aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/testing/sysfs-class-regulator315
-rw-r--r--Documentation/DocBook/kgdb.tmpl18
-rw-r--r--Documentation/SubmittingPatches26
-rw-r--r--Documentation/feature-removal-schedule.txt24
-rw-r--r--Documentation/hwmon/dme17374
-rw-r--r--Documentation/hwmon/lm8511
-rw-r--r--Documentation/i2c/upgrading-clients281
-rw-r--r--Documentation/kdump/kdump.txt20
-rw-r--r--Documentation/lguest/lguest.c519
-rw-r--r--Documentation/power/power_supply_class.txt4
-rw-r--r--Documentation/power/regulator/consumer.txt182
-rw-r--r--Documentation/power/regulator/machine.txt101
-rw-r--r--Documentation/power/regulator/overview.txt171
-rw-r--r--Documentation/power/regulator/regulator.txt30
-rw-r--r--Documentation/powerpc/00-INDEX2
-rw-r--r--Documentation/powerpc/SBC8260_memory_mapping.txt197
-rw-r--r--Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt11
-rw-r--r--Documentation/rfkill.txt20
-rw-r--r--Documentation/video4linux/CARDLIST.au08281
-rw-r--r--Documentation/video4linux/CARDLIST.em28xx45
-rw-r--r--Documentation/video4linux/gspca.txt2
-rw-r--r--MAINTAINERS23
-rw-r--r--Makefile12
-rw-r--r--arch/arm/Kconfig5
-rw-r--r--arch/arm/configs/at91cap9adk_defconfig4
-rw-r--r--arch/arm/configs/at91sam9260ek_defconfig2
-rw-r--r--arch/arm/configs/at91sam9261ek_defconfig4
-rw-r--r--arch/arm/configs/at91sam9263ek_defconfig4
-rw-r--r--arch/arm/configs/at91sam9g20ek_defconfig10
-rw-r--r--arch/arm/configs/at91sam9rlek_defconfig2
-rw-r--r--arch/arm/configs/cam60_defconfig8
-rw-r--r--arch/arm/configs/qil-a9260_defconfig8
-rw-r--r--arch/arm/configs/sam9_l9260_defconfig2
-rw-r--r--arch/arm/configs/usb-a9260_defconfig8
-rw-r--r--arch/arm/configs/usb-a9263_defconfig8
-rw-r--r--arch/arm/configs/yl9200_defconfig2
-rw-r--r--arch/arm/mach-at91/Kconfig2
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c2
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c2
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c2
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c4
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c2
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c4
-rw-r--r--arch/arm/mach-at91/board-usb-a9260.c4
-rw-r--r--arch/arm/mach-at91/board-usb-a9263.c4
-rw-r--r--arch/arm/mach-kirkwood/rd88f6281-setup.c3
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c3
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-ge-setup.c3
-rw-r--r--arch/arm/mach-orion5x/wnr854t-setup.c3
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c3
-rw-r--r--arch/arm/mm/consistent.c8
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig1
-rw-r--r--arch/cris/arch-v32/drivers/pci/dma.c106
-rw-r--r--arch/ia64/mm/hugetlbpage.c4
-rw-r--r--arch/mips/Kconfig7
-rw-r--r--arch/mips/Kconfig.debug22
-rw-r--r--arch/mips/au1000/Kconfig1
-rw-r--r--arch/mips/au1000/common/Makefile1
-rw-r--r--arch/mips/au1000/common/dbg_io.c109
-rw-r--r--arch/mips/au1000/db1x00/init.c2
-rw-r--r--arch/mips/au1000/mtx-1/init.c2
-rw-r--r--arch/mips/au1000/pb1000/init.c2
-rw-r--r--arch/mips/au1000/pb1100/init.c2
-rw-r--r--arch/mips/au1000/pb1200/init.c2
-rw-r--r--arch/mips/au1000/pb1500/init.c2
-rw-r--r--arch/mips/au1000/pb1550/init.c2
-rw-r--r--arch/mips/au1000/xxs1500/init.c2
-rw-r--r--arch/mips/basler/excite/Makefile1
-rw-r--r--arch/mips/basler/excite/excite_dbg_io.c121
-rw-r--r--arch/mips/basler/excite/excite_irq.c7
-rw-r--r--arch/mips/basler/excite/excite_setup.c4
-rw-r--r--arch/mips/configs/cobalt_defconfig378
-rw-r--r--arch/mips/configs/db1000_defconfig1
-rw-r--r--arch/mips/configs/db1100_defconfig1
-rw-r--r--arch/mips/configs/db1200_defconfig1
-rw-r--r--arch/mips/configs/db1500_defconfig1
-rw-r--r--arch/mips/configs/db1550_defconfig1
-rw-r--r--arch/mips/configs/excite_defconfig1
-rw-r--r--arch/mips/configs/ip27_defconfig1
-rw-r--r--arch/mips/configs/msp71xx_defconfig2
-rw-r--r--arch/mips/configs/mtx1_defconfig1
-rw-r--r--arch/mips/configs/pb1100_defconfig1
-rw-r--r--arch/mips/configs/pb1500_defconfig1
-rw-r--r--arch/mips/configs/pb1550_defconfig1
-rw-r--r--arch/mips/configs/pnx8550-jbs_defconfig4
-rw-r--r--arch/mips/configs/pnx8550-stb810_defconfig4
-rw-r--r--arch/mips/configs/rbtx49xx_defconfig1
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig1
-rw-r--r--arch/mips/configs/yosemite_defconfig2
-rw-r--r--arch/mips/emma2rh/markeins/platform.c1
-rw-r--r--arch/mips/emma2rh/markeins/setup.c1
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/gdb-low.S394
-rw-r--r--arch/mips/kernel/gdb-stub.c1155
-rw-r--r--arch/mips/kernel/irq.c30
-rw-r--r--arch/mips/kernel/kgdb.c281
-rw-r--r--arch/mips/kernel/traps.c21
-rw-r--r--arch/mips/mm/tlb-r3k.c4
-rw-r--r--arch/mips/mti-malta/Makefile1
-rw-r--r--arch/mips/mti-malta/malta-init.c54
-rw-r--r--arch/mips/mti-malta/malta-kgdb.c133
-rw-r--r--arch/mips/mti-malta/malta-setup.c4
-rw-r--r--arch/mips/nxp/pnx8550/common/Makefile1
-rw-r--r--arch/mips/nxp/pnx8550/common/gdb_hook.c109
-rw-r--r--arch/mips/nxp/pnx8550/common/int.c1
-rw-r--r--arch/mips/nxp/pnx8550/common/proc.c1
-rw-r--r--arch/mips/nxp/pnx8550/common/setup.c12
-rw-r--r--arch/mips/pci/ops-tx3927.c80
-rw-r--r--arch/mips/pci/ops-tx4927.c118
-rw-r--r--arch/mips/pci/pci-tx4927.c10
-rw-r--r--arch/mips/pci/pci-tx4938.c10
-rw-r--r--arch/mips/pci/pci.c6
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_serial.c73
-rw-r--r--arch/mips/pmc-sierra/yosemite/Makefile1
-rw-r--r--arch/mips/pmc-sierra/yosemite/dbg_io.c180
-rw-r--r--arch/mips/pmc-sierra/yosemite/irq.c9
-rw-r--r--arch/mips/rb532/gpio.c5
-rw-r--r--arch/mips/rb532/time.c4
-rw-r--r--arch/mips/sgi-ip22/ip22-setup.c25
-rw-r--r--arch/mips/sgi-ip27/Makefile1
-rw-r--r--arch/mips/sgi-ip27/ip27-dbgio.c60
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c80
-rw-r--r--arch/mips/sibyte/cfe/setup.c14
-rw-r--r--arch/mips/sibyte/sb1250/irq.c60
-rw-r--r--arch/mips/sibyte/swarm/Makefile1
-rw-r--r--arch/mips/sibyte/swarm/dbg_io.c76
-rw-r--r--arch/mips/txx9/Kconfig59
-rw-r--r--arch/mips/txx9/generic/Makefile2
-rw-r--r--arch/mips/txx9/generic/dbgio.c48
-rw-r--r--arch/mips/txx9/generic/irq_tx3927.c25
-rw-r--r--arch/mips/txx9/generic/pci.c36
-rw-r--r--arch/mips/txx9/generic/setup.c124
-rw-r--r--arch/mips/txx9/generic/setup_tx3927.c130
-rw-r--r--arch/mips/txx9/generic/setup_tx4927.c30
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c41
-rw-r--r--arch/mips/txx9/generic/smsc_fdc37m81x.c20
-rw-r--r--arch/mips/txx9/jmr3927/Makefile1
-rw-r--r--arch/mips/txx9/jmr3927/irq.c65
-rw-r--r--arch/mips/txx9/jmr3927/kgdb_io.c105
-rw-r--r--arch/mips/txx9/jmr3927/prom.c29
-rw-r--r--arch/mips/txx9/jmr3927/setup.c204
-rw-r--r--arch/mips/txx9/rbtx4927/irq.c161
-rw-r--r--arch/mips/txx9/rbtx4927/prom.c1
-rw-r--r--arch/mips/txx9/rbtx4927/setup.c97
-rw-r--r--arch/mips/txx9/rbtx4938/irq.c107
-rw-r--r--arch/mips/txx9/rbtx4938/prom.c1
-rw-r--r--arch/mips/txx9/rbtx4938/setup.c124
-rw-r--r--arch/powerpc/Kconfig4
-rw-r--r--arch/powerpc/boot/dts/mpc832x_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc832x_rdb.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitx.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8349emitxgp.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc834x_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc836x_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc836x_rdk.dts16
-rw-r--r--arch/powerpc/boot/dts/mpc8377_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8378_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8379_mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8536ds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8540ads.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8541cds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8548cds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8555cds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8560ads.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8568mds.dts1
-rw-r--r--arch/powerpc/boot/dts/mpc8572ds.dts1
-rw-r--r--arch/powerpc/kernel/entry_32.S17
-rw-r--r--arch/powerpc/kernel/entry_64.S10
-rw-r--r--arch/powerpc/kernel/legacy_serial.c44
-rw-r--r--arch/powerpc/kernel/lparcfg.c4
-rw-r--r--arch/powerpc/kernel/process.c8
-rw-r--r--arch/powerpc/kernel/prom_init.c39
-rw-r--r--arch/powerpc/kernel/ptrace.c64
-rw-r--r--arch/powerpc/kernel/ptrace32.c2
-rw-r--r--arch/powerpc/kernel/setup-common.c24
-rw-r--r--arch/powerpc/kernel/setup_64.c3
-rw-r--r--arch/powerpc/kernel/signal.c23
-rw-r--r--arch/powerpc/kernel/smp.c119
-rw-r--r--arch/powerpc/kernel/stacktrace.c1
-rw-r--r--arch/powerpc/kernel/sysfs.c311
-rw-r--r--arch/powerpc/kernel/vio.c6
-rw-r--r--arch/powerpc/mm/Makefile3
-rw-r--r--arch/powerpc/mm/gup.c280
-rw-r--r--arch/powerpc/mm/hugetlbpage.c9
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_mds.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_rdb.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_itx.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_mds.c1
-rw-r--r--arch/powerpc/platforms/83xx/mpc836x_mds.c1
-rw-r--r--arch/powerpc/platforms/83xx/sbc834x.c1
-rw-r--r--arch/powerpc/platforms/85xx/ksi8560.c1
-rw-r--r--arch/powerpc/platforms/85xx/mpc8536_ds.c1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ads.c1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_ds.c1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c1
-rw-r--r--arch/powerpc/platforms/85xx/sbc8560.c1
-rw-r--r--arch/powerpc/platforms/8xx/Kconfig10
-rw-r--r--arch/powerpc/platforms/Kconfig3
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c6
-rw-r--r--arch/powerpc/platforms/powermac/setup.c72
-rw-r--r--arch/powerpc/platforms/powermac/udbg_scc.c12
-rw-r--r--arch/powerpc/platforms/pseries/cmm.c8
-rw-r--r--arch/powerpc/sysdev/cpm1.c267
-rw-r--r--arch/powerpc/sysdev/cpm2.c45
-rw-r--r--arch/powerpc/sysdev/cpm_common.c123
-rw-r--r--arch/powerpc/sysdev/rtc_cmos_setup.c23
-rw-r--r--arch/s390/Kconfig3
-rw-r--r--arch/s390/kernel/compat_wrapper.S37
-rw-r--r--arch/s390/kernel/ipl.c5
-rw-r--r--arch/s390/kernel/kprobes.c6
-rw-r--r--arch/s390/kernel/mem_detect.c23
-rw-r--r--arch/s390/kernel/syscalls.S6
-rw-r--r--arch/s390/kernel/time.c2
-rw-r--r--arch/s390/lib/delay.c4
-rw-r--r--arch/s390/mm/init.c13
-rw-r--r--arch/sh/Kconfig219
-rw-r--r--arch/sh/Kconfig.debug3
-rw-r--r--arch/sh/Makefile135
-rw-r--r--arch/sh/boards/Kconfig258
-rw-r--r--arch/sh/boards/Makefile8
-rw-r--r--arch/sh/boards/board-ap325rxa.c317
-rw-r--r--arch/sh/boards/board-magicpanelr2.c (renamed from arch/sh/boards/magicpanelr2/setup.c)0
-rw-r--r--arch/sh/boards/board-rsk7203.c136
-rw-r--r--arch/sh/boards/board-sh7785lcr.c302
-rw-r--r--arch/sh/boards/board-shmin.c (renamed from arch/sh/boards/shmin/setup.c)0
-rw-r--r--arch/sh/boards/cayman/irq.c197
-rw-r--r--arch/sh/boards/cayman/setup.c187
-rw-r--r--arch/sh/boards/dreamcast/irq.c153
-rw-r--r--arch/sh/boards/dreamcast/rtc.c81
-rw-r--r--arch/sh/boards/dreamcast/setup.c64
-rw-r--r--arch/sh/boards/hp6xx/pm.c81
-rw-r--r--arch/sh/boards/hp6xx/pm_wakeup.S58
-rw-r--r--arch/sh/boards/hp6xx/setup.c121
-rw-r--r--arch/sh/boards/landisk/gio.c171
-rw-r--r--arch/sh/boards/landisk/irq.c56
-rw-r--r--arch/sh/boards/landisk/psw.c143
-rw-r--r--arch/sh/boards/landisk/setup.c105
-rw-r--r--arch/sh/boards/mach-cayman/Makefile (renamed from arch/sh/boards/cayman/Makefile)0
-rw-r--r--arch/sh/boards/mach-cayman/irq.c197
-rw-r--r--arch/sh/boards/mach-cayman/led.c (renamed from arch/sh/boards/cayman/led.c)0
-rw-r--r--arch/sh/boards/mach-cayman/setup.c187
-rw-r--r--arch/sh/boards/mach-dreamcast/Makefile (renamed from arch/sh/boards/dreamcast/Makefile)0
-rw-r--r--arch/sh/boards/mach-dreamcast/irq.c153
-rw-r--r--arch/sh/boards/mach-dreamcast/rtc.c81
-rw-r--r--arch/sh/boards/mach-dreamcast/setup.c64
-rw-r--r--arch/sh/boards/mach-edosk7705/Makefile (renamed from arch/sh/boards/renesas/edosk7705/Makefile)0
-rw-r--r--arch/sh/boards/mach-edosk7705/io.c (renamed from arch/sh/boards/renesas/edosk7705/io.c)0
-rw-r--r--arch/sh/boards/mach-edosk7705/setup.c (renamed from arch/sh/boards/renesas/edosk7705/setup.c)0
-rw-r--r--arch/sh/boards/mach-highlander/Kconfig (renamed from arch/sh/boards/renesas/r7780rp/Kconfig)0
-rw-r--r--arch/sh/boards/mach-highlander/Makefile (renamed from arch/sh/boards/renesas/r7780rp/Makefile)0
-rw-r--r--arch/sh/boards/mach-highlander/irq-r7780mp.c (renamed from arch/sh/boards/renesas/r7780rp/irq-r7780mp.c)0
-rw-r--r--arch/sh/boards/mach-highlander/irq-r7780rp.c (renamed from arch/sh/boards/renesas/r7780rp/irq-r7780rp.c)0
-rw-r--r--arch/sh/boards/mach-highlander/irq-r7785rp.c (renamed from arch/sh/boards/renesas/r7780rp/irq-r7785rp.c)0
-rw-r--r--arch/sh/boards/mach-highlander/psw.c122
-rw-r--r--arch/sh/boards/mach-highlander/setup.c (renamed from arch/sh/boards/renesas/r7780rp/setup.c)0
-rw-r--r--arch/sh/boards/mach-hp6xx/Makefile (renamed from arch/sh/boards/hp6xx/Makefile)0
-rw-r--r--arch/sh/boards/mach-hp6xx/hp6xx_apm.c (renamed from arch/sh/boards/hp6xx/hp6xx_apm.c)0
-rw-r--r--arch/sh/boards/mach-hp6xx/pm.c81
-rw-r--r--arch/sh/boards/mach-hp6xx/pm_wakeup.S58
-rw-r--r--arch/sh/boards/mach-hp6xx/setup.c121
-rw-r--r--arch/sh/boards/mach-landisk/Makefile (renamed from arch/sh/boards/landisk/Makefile)0
-rw-r--r--arch/sh/boards/mach-landisk/gio.c171
-rw-r--r--arch/sh/boards/mach-landisk/irq.c56
-rw-r--r--arch/sh/boards/mach-landisk/psw.c143
-rw-r--r--arch/sh/boards/mach-landisk/setup.c105
-rw-r--r--arch/sh/boards/mach-lboxre2/Makefile (renamed from arch/sh/boards/lboxre2/Makefile)0
-rw-r--r--arch/sh/boards/mach-lboxre2/irq.c (renamed from arch/sh/boards/lboxre2/irq.c)0
-rw-r--r--arch/sh/boards/mach-lboxre2/setup.c (renamed from arch/sh/boards/lboxre2/setup.c)0
-rw-r--r--arch/sh/boards/mach-microdev/Makefile (renamed from arch/sh/boards/superh/microdev/Makefile)0
-rw-r--r--arch/sh/boards/mach-microdev/io.c (renamed from arch/sh/boards/superh/microdev/io.c)0
-rw-r--r--arch/sh/boards/mach-microdev/irq.c (renamed from arch/sh/boards/superh/microdev/irq.c)0
-rw-r--r--arch/sh/boards/mach-microdev/led.c (renamed from arch/sh/boards/superh/microdev/led.c)0
-rw-r--r--arch/sh/boards/mach-microdev/setup.c (renamed from arch/sh/boards/superh/microdev/setup.c)0
-rw-r--r--arch/sh/boards/mach-migor/Kconfig15
-rw-r--r--arch/sh/boards/mach-migor/Makefile2
-rw-r--r--arch/sh/boards/mach-migor/lcd_qvga.c165
-rw-r--r--arch/sh/boards/mach-migor/setup.c527
-rw-r--r--arch/sh/boards/mach-r2d/Kconfig (renamed from arch/sh/boards/renesas/rts7751r2d/Kconfig)0
-rw-r--r--arch/sh/boards/mach-r2d/Makefile (renamed from arch/sh/boards/renesas/rts7751r2d/Makefile)0
-rw-r--r--arch/sh/boards/mach-r2d/irq.c (renamed from arch/sh/boards/renesas/rts7751r2d/irq.c)0
-rw-r--r--arch/sh/boards/mach-r2d/setup.c (renamed from arch/sh/boards/renesas/rts7751r2d/setup.c)0
-rw-r--r--arch/sh/boards/mach-sdk7780/Kconfig (renamed from arch/sh/boards/renesas/sdk7780/Kconfig)0
-rw-r--r--arch/sh/boards/mach-sdk7780/Makefile (renamed from arch/sh/boards/renesas/sdk7780/Makefile)0
-rw-r--r--arch/sh/boards/mach-sdk7780/irq.c (renamed from arch/sh/boards/renesas/sdk7780/irq.c)0
-rw-r--r--arch/sh/boards/mach-sdk7780/setup.c (renamed from arch/sh/boards/renesas/sdk7780/setup.c)0
-rw-r--r--arch/sh/boards/mach-se/7206/Makefile (renamed from arch/sh/boards/se/7206/Makefile)0
-rw-r--r--arch/sh/boards/mach-se/7206/io.c104
-rw-r--r--arch/sh/boards/mach-se/7206/irq.c146
-rw-r--r--arch/sh/boards/mach-se/7206/setup.c108
-rw-r--r--arch/sh/boards/mach-se/7343/Makefile (renamed from arch/sh/boards/se/7343/Makefile)0
-rw-r--r--arch/sh/boards/mach-se/7343/io.c273
-rw-r--r--arch/sh/boards/mach-se/7343/irq.c80
-rw-r--r--arch/sh/boards/mach-se/7343/setup.c152
-rw-r--r--arch/sh/boards/mach-se/770x/Makefile (renamed from arch/sh/boards/se/770x/Makefile)0
-rw-r--r--arch/sh/boards/mach-se/770x/io.c156
-rw-r--r--arch/sh/boards/mach-se/770x/irq.c108
-rw-r--r--arch/sh/boards/mach-se/770x/setup.c222
-rw-r--r--arch/sh/boards/mach-se/7721/Makefile (renamed from arch/sh/boards/se/7721/Makefile)0
-rw-r--r--arch/sh/boards/mach-se/7721/irq.c45
-rw-r--r--arch/sh/boards/mach-se/7721/setup.c99
-rw-r--r--arch/sh/boards/mach-se/7722/Makefile (renamed from arch/sh/boards/se/7722/Makefile)0
-rw-r--r--arch/sh/boards/mach-se/7722/irq.c76
-rw-r--r--arch/sh/boards/mach-se/7722/setup.c194
-rw-r--r--arch/sh/boards/mach-se/7751/Makefile (renamed from arch/sh/boards/se/7751/Makefile)0
-rw-r--r--arch/sh/boards/mach-se/7751/io.c135
-rw-r--r--arch/sh/boards/mach-se/7751/irq.c50
-rw-r--r--arch/sh/boards/mach-se/7751/pci.c (renamed from arch/sh/boards/se/7751/pci.c)0
-rw-r--r--arch/sh/boards/mach-se/7751/setup.c78
-rw-r--r--arch/sh/boards/mach-se/7780/Makefile (renamed from arch/sh/boards/se/7780/Makefile)0
-rw-r--r--arch/sh/boards/mach-se/7780/irq.c46
-rw-r--r--arch/sh/boards/mach-se/7780/setup.c124
-rw-r--r--arch/sh/boards/mach-se/Makefile9
-rw-r--r--arch/sh/boards/mach-se/board-se7619.c (renamed from arch/sh/boards/se/7619/setup.c)0
-rw-r--r--arch/sh/boards/mach-sh03/Makefile (renamed from arch/sh/boards/sh03/Makefile)0
-rw-r--r--arch/sh/boards/mach-sh03/rtc.c (renamed from arch/sh/boards/sh03/rtc.c)0
-rw-r--r--arch/sh/boards/mach-sh03/setup.c75
-rw-r--r--arch/sh/boards/mach-sh7763rdp/Makefile1
-rw-r--r--arch/sh/boards/mach-sh7763rdp/irq.c45
-rw-r--r--arch/sh/boards/mach-sh7763rdp/setup.c128
-rw-r--r--arch/sh/boards/mach-snapgear/Makefile (renamed from arch/sh/boards/snapgear/Makefile)0
-rw-r--r--arch/sh/boards/mach-snapgear/io.c (renamed from arch/sh/boards/snapgear/io.c)0
-rw-r--r--arch/sh/boards/mach-snapgear/setup.c95
-rw-r--r--arch/sh/boards/mach-systemh/Makefile (renamed from arch/sh/boards/renesas/systemh/Makefile)0
-rw-r--r--arch/sh/boards/mach-systemh/io.c (renamed from arch/sh/boards/renesas/systemh/io.c)0
-rw-r--r--arch/sh/boards/mach-systemh/irq.c (renamed from arch/sh/boards/renesas/systemh/irq.c)0
-rw-r--r--arch/sh/boards/mach-systemh/setup.c (renamed from arch/sh/boards/renesas/systemh/setup.c)0
-rw-r--r--arch/sh/boards/mach-titan/Makefile (renamed from arch/sh/boards/titan/Makefile)0
-rw-r--r--arch/sh/boards/mach-titan/io.c (renamed from arch/sh/boards/titan/io.c)0
-rw-r--r--arch/sh/boards/mach-titan/setup.c (renamed from arch/sh/boards/titan/setup.c)0
-rw-r--r--arch/sh/boards/mach-x3proto/Makefile (renamed from arch/sh/boards/renesas/x3proto/Makefile)0
-rw-r--r--arch/sh/boards/mach-x3proto/ilsel.c (renamed from arch/sh/boards/renesas/x3proto/ilsel.c)0
-rw-r--r--arch/sh/boards/mach-x3proto/setup.c (renamed from arch/sh/boards/renesas/x3proto/setup.c)0
-rw-r--r--arch/sh/boards/magicpanelr2/Kconfig13
-rw-r--r--arch/sh/boards/magicpanelr2/Makefile5
-rw-r--r--arch/sh/boards/renesas/migor/Makefile1
-rw-r--r--arch/sh/boards/renesas/migor/setup.c257
-rw-r--r--arch/sh/boards/renesas/r7780rp/psw.c122
-rw-r--r--arch/sh/boards/se/7206/io.c104
-rw-r--r--arch/sh/boards/se/7206/irq.c146
-rw-r--r--arch/sh/boards/se/7206/setup.c108
-rw-r--r--arch/sh/boards/se/7343/io.c273
-rw-r--r--arch/sh/boards/se/7343/irq.c202
-rw-r--r--arch/sh/boards/se/7343/setup.c94
-rw-r--r--arch/sh/boards/se/7619/Makefile5
-rw-r--r--arch/sh/boards/se/770x/io.c187
-rw-r--r--arch/sh/boards/se/770x/irq.c108
-rw-r--r--arch/sh/boards/se/770x/setup.c169
-rw-r--r--arch/sh/boards/se/7721/irq.c45
-rw-r--r--arch/sh/boards/se/7721/setup.c99
-rw-r--r--arch/sh/boards/se/7722/irq.c76
-rw-r--r--arch/sh/boards/se/7722/setup.c196
-rw-r--r--arch/sh/boards/se/7751/io.c135
-rw-r--r--arch/sh/boards/se/7751/irq.c50
-rw-r--r--arch/sh/boards/se/7751/setup.c78
-rw-r--r--arch/sh/boards/se/7780/irq.c46
-rw-r--r--arch/sh/boards/se/7780/setup.c124
-rw-r--r--arch/sh/boards/sh03/setup.c75
-rw-r--r--arch/sh/boards/shmin/Makefile5
-rw-r--r--arch/sh/boards/snapgear/setup.c95
-rw-r--r--arch/sh/boot/Makefile5
-rw-r--r--arch/sh/boot/compressed/Makefile_325
-rw-r--r--arch/sh/boot/compressed/Makefile_645
-rw-r--r--arch/sh/boot/compressed/head_64.S4
-rw-r--r--arch/sh/boot/compressed/piggy.S8
-rw-r--r--arch/sh/boot/compressed/vmlinux.scr9
-rw-r--r--arch/sh/configs/ap325rxa_defconfig964
-rw-r--r--arch/sh/configs/dreamcast_defconfig304
-rw-r--r--arch/sh/configs/hp6xx_defconfig258
-rw-r--r--arch/sh/configs/landisk_defconfig894
-rw-r--r--arch/sh/configs/lboxre2_defconfig725
-rw-r--r--arch/sh/configs/magicpanelr2_defconfig195
-rw-r--r--arch/sh/configs/microdev_defconfig630
-rw-r--r--arch/sh/configs/migor_defconfig63
-rw-r--r--arch/sh/configs/r7780mp_defconfig194
-rw-r--r--arch/sh/configs/r7785rp_defconfig258
-rw-r--r--arch/sh/configs/rsk7203_defconfig179
-rw-r--r--arch/sh/configs/rts7751r2d1_defconfig259
-rw-r--r--arch/sh/configs/rts7751r2dplus_defconfig259
-rw-r--r--arch/sh/configs/sdk7780_defconfig269
-rw-r--r--arch/sh/configs/se7206_defconfig38
-rw-r--r--arch/sh/configs/se7343_defconfig787
-rw-r--r--arch/sh/configs/se7619_defconfig261
-rw-r--r--arch/sh/configs/se7712_defconfig659
-rw-r--r--arch/sh/configs/sh7763rdp_defconfig1052
-rw-r--r--arch/sh/configs/sh7785lcr_defconfig1388
-rw-r--r--arch/sh/drivers/dma/dma-g2.c4
-rw-r--r--arch/sh/drivers/dma/dma-pvr2.c4
-rw-r--r--arch/sh/drivers/dma/dma-sh.c2
-rw-r--r--arch/sh/drivers/dma/dma-sh.h2
-rw-r--r--arch/sh/drivers/pci/Makefile1
-rw-r--r--arch/sh/drivers/pci/fixups-dreamcast.c2
-rw-r--r--arch/sh/drivers/pci/fixups-sh7785lcr.c46
-rw-r--r--arch/sh/drivers/pci/ops-cayman.c2
-rw-r--r--arch/sh/drivers/pci/ops-dreamcast.c4
-rw-r--r--arch/sh/drivers/pci/ops-se7780.c2
-rw-r--r--arch/sh/drivers/pci/ops-sh7785lcr.c66
-rw-r--r--arch/sh/drivers/pci/pci-auto.c2
-rw-r--r--arch/sh/drivers/pci/pci-sh5.c2
-rw-r--r--arch/sh/drivers/pci/pci.c2
-rw-r--r--arch/sh/include/asm/.gitignore1
-rw-r--r--arch/sh/include/asm/Kbuild (renamed from include/asm-sh/Kbuild)0
-rw-r--r--arch/sh/include/asm/a.out.h (renamed from include/asm-sh/a.out.h)0
-rw-r--r--arch/sh/include/asm/adc.h13
-rw-r--r--arch/sh/include/asm/addrspace.h53
-rw-r--r--arch/sh/include/asm/atomic-grb.h (renamed from include/asm-sh/atomic-grb.h)0
-rw-r--r--arch/sh/include/asm/atomic-irq.h (renamed from include/asm-sh/atomic-irq.h)0
-rw-r--r--arch/sh/include/asm/atomic-llsc.h (renamed from include/asm-sh/atomic-llsc.h)0
-rw-r--r--arch/sh/include/asm/atomic.h (renamed from include/asm-sh/atomic.h)0
-rw-r--r--arch/sh/include/asm/auxvec.h36
-rw-r--r--arch/sh/include/asm/bitops-grb.h (renamed from include/asm-sh/bitops-grb.h)0
-rw-r--r--arch/sh/include/asm/bitops-irq.h (renamed from include/asm-sh/bitops-irq.h)0
-rw-r--r--arch/sh/include/asm/bitops.h (renamed from include/asm-sh/bitops.h)0
-rw-r--r--arch/sh/include/asm/bug.h (renamed from include/asm-sh/bug.h)0
-rw-r--r--arch/sh/include/asm/bugs.h (renamed from include/asm-sh/bugs.h)0
-rw-r--r--arch/sh/include/asm/byteorder.h (renamed from include/asm-sh/byteorder.h)0
-rw-r--r--arch/sh/include/asm/cache.h51
-rw-r--r--arch/sh/include/asm/cacheflush.h81
-rw-r--r--arch/sh/include/asm/checksum.h (renamed from include/asm-sh/checksum.h)0
-rw-r--r--arch/sh/include/asm/checksum_32.h (renamed from include/asm-sh/checksum_32.h)0
-rw-r--r--arch/sh/include/asm/checksum_64.h (renamed from include/asm-sh/checksum_64.h)0
-rw-r--r--arch/sh/include/asm/clock.h97
-rw-r--r--arch/sh/include/asm/cmpxchg-grb.h (renamed from include/asm-sh/cmpxchg-grb.h)0
-rw-r--r--arch/sh/include/asm/cmpxchg-irq.h (renamed from include/asm-sh/cmpxchg-irq.h)0
-rw-r--r--arch/sh/include/asm/cpu-features.h (renamed from include/asm-sh/cpu-features.h)0
-rw-r--r--arch/sh/include/asm/cputime.h (renamed from include/asm-sh/cputime.h)0
-rw-r--r--arch/sh/include/asm/current.h (renamed from include/asm-sh/current.h)0
-rw-r--r--arch/sh/include/asm/delay.h (renamed from include/asm-sh/delay.h)0
-rw-r--r--arch/sh/include/asm/device.h12
-rw-r--r--arch/sh/include/asm/div64.h (renamed from include/asm-sh/div64.h)0
-rw-r--r--arch/sh/include/asm/dma-mapping.h193
-rw-r--r--arch/sh/include/asm/dma.h166
-rw-r--r--arch/sh/include/asm/dmabrg.h (renamed from include/asm-sh/dmabrg.h)0
-rw-r--r--arch/sh/include/asm/edosk7705.h (renamed from include/asm-sh/edosk7705.h)0
-rw-r--r--arch/sh/include/asm/elf.h244
-rw-r--r--arch/sh/include/asm/emergency-restart.h (renamed from include/asm-sh/emergency-restart.h)0
-rw-r--r--arch/sh/include/asm/entry-macros.S (renamed from include/asm-sh/entry-macros.S)0
-rw-r--r--arch/sh/include/asm/errno.h (renamed from include/asm-sh/errno.h)0
-rw-r--r--arch/sh/include/asm/fb.h (renamed from include/asm-sh/fb.h)0
-rw-r--r--arch/sh/include/asm/fcntl.h (renamed from include/asm-sh/fcntl.h)0
-rw-r--r--arch/sh/include/asm/fixmap.h (renamed from include/asm-sh/fixmap.h)0
-rw-r--r--arch/sh/include/asm/flat.h (renamed from include/asm-sh/flat.h)0
-rw-r--r--arch/sh/include/asm/fpu.h (renamed from include/asm-sh/fpu.h)0
-rw-r--r--arch/sh/include/asm/freq.h18
-rw-r--r--arch/sh/include/asm/futex-irq.h (renamed from include/asm-sh/futex-irq.h)0
-rw-r--r--arch/sh/include/asm/futex.h (renamed from include/asm-sh/futex.h)0
-rw-r--r--arch/sh/include/asm/gpio.h19
-rw-r--r--arch/sh/include/asm/hardirq.h (renamed from include/asm-sh/hardirq.h)0
-rw-r--r--arch/sh/include/asm/hd64461.h (renamed from include/asm-sh/hd64461.h)0
-rw-r--r--arch/sh/include/asm/hd64465/gpio.h (renamed from include/asm-sh/hd64465/gpio.h)0
-rw-r--r--arch/sh/include/asm/hd64465/hd64465.h (renamed from include/asm-sh/hd64465/hd64465.h)0
-rw-r--r--arch/sh/include/asm/hd64465/io.h (renamed from include/asm-sh/hd64465/io.h)0
-rw-r--r--arch/sh/include/asm/heartbeat.h (renamed from include/asm-sh/heartbeat.h)0
-rw-r--r--arch/sh/include/asm/hp6xx.h (renamed from include/asm-sh/hp6xx.h)0
-rw-r--r--arch/sh/include/asm/hugetlb.h (renamed from include/asm-sh/hugetlb.h)0
-rw-r--r--arch/sh/include/asm/hw_irq.h123
-rw-r--r--arch/sh/include/asm/i2c-sh7760.h (renamed from include/asm-sh/i2c-sh7760.h)0
-rw-r--r--arch/sh/include/asm/ilsel.h (renamed from include/asm-sh/ilsel.h)0
-rw-r--r--arch/sh/include/asm/io.h (renamed from include/asm-sh/io.h)0
-rw-r--r--arch/sh/include/asm/io_generic.h (renamed from include/asm-sh/io_generic.h)0
-rw-r--r--arch/sh/include/asm/io_trapped.h (renamed from include/asm-sh/io_trapped.h)0
-rw-r--r--arch/sh/include/asm/ioctl.h (renamed from include/asm-sh/ioctl.h)0
-rw-r--r--arch/sh/include/asm/ioctls.h (renamed from include/asm-sh/ioctls.h)0
-rw-r--r--arch/sh/include/asm/ipcbuf.h (renamed from include/asm-sh/ipcbuf.h)0
-rw-r--r--arch/sh/include/asm/irq.h57
-rw-r--r--arch/sh/include/asm/irq_regs.h (renamed from include/asm-sh/irq_regs.h)0
-rw-r--r--arch/sh/include/asm/irqflags.h (renamed from include/asm-sh/irqflags.h)0
-rw-r--r--arch/sh/include/asm/irqflags_32.h (renamed from include/asm-sh/irqflags_32.h)0
-rw-r--r--arch/sh/include/asm/irqflags_64.h85
-rw-r--r--arch/sh/include/asm/kdebug.h (renamed from include/asm-sh/kdebug.h)0
-rw-r--r--arch/sh/include/asm/kexec.h (renamed from include/asm-sh/kexec.h)0
-rw-r--r--arch/sh/include/asm/kgdb.h (renamed from include/asm-sh/kgdb.h)0
-rw-r--r--arch/sh/include/asm/kmap_types.h (renamed from include/asm-sh/kmap_types.h)0
-rw-r--r--arch/sh/include/asm/lboxre2.h (renamed from include/asm-sh/lboxre2.h)0
-rw-r--r--arch/sh/include/asm/linkage.h (renamed from include/asm-sh/linkage.h)0
-rw-r--r--arch/sh/include/asm/local.h (renamed from include/asm-sh/local.h)0
-rw-r--r--arch/sh/include/asm/machvec.h (renamed from include/asm-sh/machvec.h)0
-rw-r--r--arch/sh/include/asm/magicpanelr2.h (renamed from include/asm-sh/magicpanelr2.h)0
-rw-r--r--arch/sh/include/asm/mc146818rtc.h (renamed from include/asm-sh/mc146818rtc.h)0
-rw-r--r--arch/sh/include/asm/microdev.h (renamed from include/asm-sh/microdev.h)0
-rw-r--r--arch/sh/include/asm/migor.h65
-rw-r--r--arch/sh/include/asm/mman.h (renamed from include/asm-sh/mman.h)0
-rw-r--r--arch/sh/include/asm/mmu.h76
-rw-r--r--arch/sh/include/asm/mmu_context.h185
-rw-r--r--arch/sh/include/asm/mmu_context_32.h (renamed from include/asm-sh/mmu_context_32.h)0
-rw-r--r--arch/sh/include/asm/mmu_context_64.h78
-rw-r--r--arch/sh/include/asm/mmzone.h (renamed from include/asm-sh/mmzone.h)0
-rw-r--r--arch/sh/include/asm/module.h (renamed from include/asm-sh/module.h)0
-rw-r--r--arch/sh/include/asm/msgbuf.h (renamed from include/asm-sh/msgbuf.h)0
-rw-r--r--arch/sh/include/asm/mutex.h (renamed from include/asm-sh/mutex.h)0
-rw-r--r--arch/sh/include/asm/page.h183
-rw-r--r--arch/sh/include/asm/param.h (renamed from include/asm-sh/param.h)0
-rw-r--r--arch/sh/include/asm/parport.h (renamed from include/asm-sh/parport.h)0
-rw-r--r--arch/sh/include/asm/pci.h (renamed from include/asm-sh/pci.h)0
-rw-r--r--arch/sh/include/asm/percpu.h (renamed from include/asm-sh/percpu.h)0
-rw-r--r--arch/sh/include/asm/pgalloc.h (renamed from include/asm-sh/pgalloc.h)0
-rw-r--r--arch/sh/include/asm/pgtable.h (renamed from include/asm-sh/pgtable.h)0
-rw-r--r--arch/sh/include/asm/pgtable_32.h479
-rw-r--r--arch/sh/include/asm/pgtable_64.h (renamed from include/asm-sh/pgtable_64.h)0
-rw-r--r--arch/sh/include/asm/pm.h (renamed from include/asm-sh/pm.h)0
-rw-r--r--arch/sh/include/asm/poll.h (renamed from include/asm-sh/poll.h)0
-rw-r--r--arch/sh/include/asm/posix_types.h (renamed from include/asm-sh/posix_types.h)0
-rw-r--r--arch/sh/include/asm/posix_types_32.h (renamed from include/asm-sh/posix_types_32.h)0
-rw-r--r--arch/sh/include/asm/posix_types_64.h (renamed from include/asm-sh/posix_types_64.h)0
-rw-r--r--arch/sh/include/asm/processor.h66
-rw-r--r--arch/sh/include/asm/processor_32.h216
-rw-r--r--arch/sh/include/asm/processor_64.h275
-rw-r--r--arch/sh/include/asm/ptrace.h130
-rw-r--r--arch/sh/include/asm/push-switch.h (renamed from include/asm-sh/push-switch.h)0
-rw-r--r--arch/sh/include/asm/r7780rp.h (renamed from include/asm-sh/r7780rp.h)0
-rw-r--r--arch/sh/include/asm/resource.h (renamed from include/asm-sh/resource.h)0
-rw-r--r--arch/sh/include/asm/rtc.h16
-rw-r--r--arch/sh/include/asm/rts7751r2d.h (renamed from include/asm-sh/rts7751r2d.h)0
-rw-r--r--arch/sh/include/asm/rwsem.h (renamed from include/asm-sh/rwsem.h)0
-rw-r--r--arch/sh/include/asm/scatterlist.h (renamed from include/asm-sh/scatterlist.h)0
-rw-r--r--arch/sh/include/asm/sdk7780.h (renamed from include/asm-sh/sdk7780.h)0
-rw-r--r--arch/sh/include/asm/sections.h (renamed from include/asm-sh/sections.h)0
-rw-r--r--arch/sh/include/asm/segment.h34
-rw-r--r--arch/sh/include/asm/sembuf.h (renamed from include/asm-sh/sembuf.h)0
-rw-r--r--arch/sh/include/asm/serial.h36
-rw-r--r--arch/sh/include/asm/setup.h (renamed from include/asm-sh/setup.h)0
-rw-r--r--arch/sh/include/asm/sfp-machine.h (renamed from include/asm-sh/sfp-machine.h)0
-rw-r--r--arch/sh/include/asm/sh7760fb.h (renamed from include/asm-sh/sh7760fb.h)0
-rw-r--r--arch/sh/include/asm/sh7763rdp.h54
-rw-r--r--arch/sh/include/asm/sh7785lcr.h55
-rw-r--r--arch/sh/include/asm/sh_bios.h (renamed from include/asm-sh/sh_bios.h)0
-rw-r--r--arch/sh/include/asm/sh_keysc.h (renamed from include/asm-sh/sh_keysc.h)0
-rw-r--r--arch/sh/include/asm/sh_mobile_lcdc.h (renamed from include/asm-sh/sh_mobile_lcdc.h)0
-rw-r--r--arch/sh/include/asm/shmbuf.h (renamed from include/asm-sh/shmbuf.h)0
-rw-r--r--arch/sh/include/asm/shmin.h (renamed from include/asm-sh/shmin.h)0
-rw-r--r--arch/sh/include/asm/shmparam.h (renamed from include/asm-sh/shmparam.h)0
-rw-r--r--arch/sh/include/asm/sigcontext.h (renamed from include/asm-sh/sigcontext.h)0
-rw-r--r--arch/sh/include/asm/siginfo.h (renamed from include/asm-sh/siginfo.h)0
-rw-r--r--arch/sh/include/asm/signal.h (renamed from include/asm-sh/signal.h)0
-rw-r--r--arch/sh/include/asm/smc37c93x.h (renamed from include/asm-sh/smc37c93x.h)0
-rw-r--r--arch/sh/include/asm/smp.h (renamed from include/asm-sh/smp.h)0
-rw-r--r--arch/sh/include/asm/snapgear.h (renamed from include/asm-sh/snapgear.h)0
-rw-r--r--arch/sh/include/asm/socket.h (renamed from include/asm-sh/socket.h)0
-rw-r--r--arch/sh/include/asm/sockios.h (renamed from include/asm-sh/sockios.h)0
-rw-r--r--arch/sh/include/asm/sparsemem.h (renamed from include/asm-sh/sparsemem.h)0
-rw-r--r--arch/sh/include/asm/spi.h (renamed from include/asm-sh/spi.h)0
-rw-r--r--arch/sh/include/asm/spinlock.h (renamed from include/asm-sh/spinlock.h)0
-rw-r--r--arch/sh/include/asm/spinlock_types.h (renamed from include/asm-sh/spinlock_types.h)0
-rw-r--r--arch/sh/include/asm/stat.h (renamed from include/asm-sh/stat.h)0
-rw-r--r--arch/sh/include/asm/statfs.h (renamed from include/asm-sh/statfs.h)0
-rw-r--r--arch/sh/include/asm/string.h (renamed from include/asm-sh/string.h)0
-rw-r--r--arch/sh/include/asm/string_32.h (renamed from include/asm-sh/string_32.h)0
-rw-r--r--arch/sh/include/asm/string_64.h (renamed from include/asm-sh/string_64.h)0
-rw-r--r--arch/sh/include/asm/system.h190
-rw-r--r--arch/sh/include/asm/system_32.h (renamed from include/asm-sh/system_32.h)0
-rw-r--r--arch/sh/include/asm/system_64.h (renamed from include/asm-sh/system_64.h)0
-rw-r--r--arch/sh/include/asm/systemh7751.h (renamed from include/asm-sh/systemh7751.h)0
-rw-r--r--arch/sh/include/asm/termbits.h (renamed from include/asm-sh/termbits.h)0
-rw-r--r--arch/sh/include/asm/termios.h (renamed from include/asm-sh/termios.h)0
-rw-r--r--arch/sh/include/asm/thread_info.h141
-rw-r--r--arch/sh/include/asm/timer.h44
-rw-r--r--arch/sh/include/asm/timex.h (renamed from include/asm-sh/timex.h)0
-rw-r--r--arch/sh/include/asm/titan.h (renamed from include/asm-sh/titan.h)0
-rw-r--r--arch/sh/include/asm/tlb.h (renamed from include/asm-sh/tlb.h)0
-rw-r--r--arch/sh/include/asm/tlb_64.h (renamed from include/asm-sh/tlb_64.h)0
-rw-r--r--arch/sh/include/asm/tlbflush.h (renamed from include/asm-sh/tlbflush.h)0
-rw-r--r--arch/sh/include/asm/topology.h (renamed from include/asm-sh/topology.h)0
-rw-r--r--arch/sh/include/asm/types.h (renamed from include/asm-sh/types.h)0
-rw-r--r--arch/sh/include/asm/uaccess.h258
-rw-r--r--arch/sh/include/asm/uaccess_32.h248
-rw-r--r--arch/sh/include/asm/uaccess_64.h79
-rw-r--r--arch/sh/include/asm/ubc.h64
-rw-r--r--arch/sh/include/asm/ucontext.h (renamed from include/asm-sh/ucontext.h)0
-rw-r--r--arch/sh/include/asm/unaligned.h (renamed from include/asm-sh/unaligned.h)0
-rw-r--r--arch/sh/include/asm/unistd.h13
-rw-r--r--arch/sh/include/asm/unistd_32.h384
-rw-r--r--arch/sh/include/asm/unistd_64.h423
-rw-r--r--arch/sh/include/asm/user.h (renamed from include/asm-sh/user.h)0
-rw-r--r--arch/sh/include/asm/vga.h (renamed from include/asm-sh/vga.h)0
-rw-r--r--arch/sh/include/asm/watchdog.h107
-rw-r--r--arch/sh/include/asm/xor.h (renamed from include/asm-sh/xor.h)0
-rw-r--r--arch/sh/include/cpu-common/cpu/addrspace.h (renamed from include/asm-sh/cpu-sh2/addrspace.h)0
-rw-r--r--arch/sh/include/cpu-common/cpu/cacheflush.h44
-rw-r--r--arch/sh/include/cpu-common/cpu/mmu_context.h (renamed from include/asm-sh/cpu-sh2/mmu_context.h)0
-rw-r--r--arch/sh/include/cpu-common/cpu/rtc.h (renamed from include/asm-sh/cpu-sh2/rtc.h)0
-rw-r--r--arch/sh/include/cpu-common/cpu/sigcontext.h (renamed from include/asm-sh/cpu-sh2/sigcontext.h)0
-rw-r--r--arch/sh/include/cpu-common/cpu/timer.h (renamed from include/asm-sh/cpu-sh2/timer.h)0
-rw-r--r--arch/sh/include/cpu-sh2/cpu/cache.h (renamed from include/asm-sh/cpu-sh2/cache.h)0
-rw-r--r--arch/sh/include/cpu-sh2/cpu/dma.h (renamed from include/asm-sh/cpu-sh2/dma.h)0
-rw-r--r--arch/sh/include/cpu-sh2/cpu/freq.h (renamed from include/asm-sh/cpu-sh2/freq.h)0
-rw-r--r--arch/sh/include/cpu-sh2/cpu/ubc.h (renamed from include/asm-sh/cpu-sh2/ubc.h)0
-rw-r--r--arch/sh/include/cpu-sh2/cpu/watchdog.h (renamed from include/asm-sh/cpu-sh2/watchdog.h)0
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/cache.h (renamed from include/asm-sh/cpu-sh2a/cache.h)0
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/dma.h1
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/freq.h (renamed from include/asm-sh/cpu-sh2a/freq.h)0
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/rtc.h (renamed from include/asm-sh/cpu-sh2a/rtc.h)0
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/ubc.h1
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/watchdog.h1
-rw-r--r--arch/sh/include/cpu-sh3/cpu/adc.h (renamed from include/asm-sh/cpu-sh3/adc.h)0
-rw-r--r--arch/sh/include/cpu-sh3/cpu/cache.h (renamed from include/asm-sh/cpu-sh3/cache.h)0
-rw-r--r--arch/sh/include/cpu-sh3/cpu/cacheflush.h36
-rw-r--r--arch/sh/include/cpu-sh3/cpu/dac.h (renamed from include/asm-sh/cpu-sh3/dac.h)0
-rw-r--r--arch/sh/include/cpu-sh3/cpu/dma.h (renamed from include/asm-sh/cpu-sh3/dma.h)0
-rw-r--r--arch/sh/include/cpu-sh3/cpu/freq.h (renamed from include/asm-sh/cpu-sh3/freq.h)0
-rw-r--r--arch/sh/include/cpu-sh3/cpu/gpio.h (renamed from include/asm-sh/cpu-sh3/gpio.h)0
-rw-r--r--arch/sh/include/cpu-sh3/cpu/mmu_context.h (renamed from include/asm-sh/cpu-sh3/mmu_context.h)0
-rw-r--r--arch/sh/include/cpu-sh3/cpu/timer.h (renamed from include/asm-sh/cpu-sh3/timer.h)0
-rw-r--r--arch/sh/include/cpu-sh3/cpu/ubc.h (renamed from include/asm-sh/cpu-sh3/ubc.h)0
-rw-r--r--arch/sh/include/cpu-sh3/cpu/watchdog.h (renamed from include/asm-sh/cpu-sh3/watchdog.h)0
-rw-r--r--arch/sh/include/cpu-sh4/cpu/addrspace.h (renamed from include/asm-sh/cpu-sh4/addrspace.h)0
-rw-r--r--arch/sh/include/cpu-sh4/cpu/cache.h (renamed from include/asm-sh/cpu-sh4/cache.h)0
-rw-r--r--arch/sh/include/cpu-sh4/cpu/cacheflush.h43
-rw-r--r--arch/sh/include/cpu-sh4/cpu/dma-sh7780.h (renamed from include/asm-sh/cpu-sh4/dma-sh7780.h)0
-rw-r--r--arch/sh/include/cpu-sh4/cpu/dma.h65
-rw-r--r--arch/sh/include/cpu-sh4/cpu/fpu.h (renamed from include/asm-sh/cpu-sh4/fpu.h)0
-rw-r--r--arch/sh/include/cpu-sh4/cpu/freq.h44
-rw-r--r--arch/sh/include/cpu-sh4/cpu/mmu_context.h (renamed from include/asm-sh/cpu-sh4/mmu_context.h)0
-rw-r--r--arch/sh/include/cpu-sh4/cpu/rtc.h (renamed from include/asm-sh/cpu-sh4/rtc.h)0
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sigcontext.h (renamed from include/asm-sh/cpu-sh4/sigcontext.h)0
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sq.h (renamed from include/asm-sh/cpu-sh4/sq.h)0
-rw-r--r--arch/sh/include/cpu-sh4/cpu/timer.h (renamed from include/asm-sh/cpu-sh4/timer.h)0
-rw-r--r--arch/sh/include/cpu-sh4/cpu/ubc.h (renamed from include/asm-sh/cpu-sh4/ubc.h)0
-rw-r--r--arch/sh/include/cpu-sh4/cpu/watchdog.h (renamed from include/asm-sh/cpu-sh4/watchdog.h)0
-rw-r--r--arch/sh/include/cpu-sh5/cpu/addrspace.h (renamed from include/asm-sh/cpu-sh5/addrspace.h)0
-rw-r--r--arch/sh/include/cpu-sh5/cpu/cache.h (renamed from include/asm-sh/cpu-sh5/cache.h)0
-rw-r--r--arch/sh/include/cpu-sh5/cpu/cacheflush.h (renamed from include/asm-sh/cpu-sh5/cacheflush.h)0
-rw-r--r--arch/sh/include/cpu-sh5/cpu/dma.h (renamed from include/asm-sh/cpu-sh5/dma.h)0
-rw-r--r--arch/sh/include/cpu-sh5/cpu/irq.h (renamed from include/asm-sh/cpu-sh5/irq.h)0
-rw-r--r--arch/sh/include/cpu-sh5/cpu/mmu_context.h (renamed from include/asm-sh/cpu-sh5/mmu_context.h)0
-rw-r--r--arch/sh/include/cpu-sh5/cpu/registers.h (renamed from include/asm-sh/cpu-sh5/registers.h)0
-rw-r--r--arch/sh/include/cpu-sh5/cpu/rtc.h (renamed from include/asm-sh/cpu-sh5/rtc.h)0
-rw-r--r--arch/sh/include/mach-dreamcast/mach/dma.h (renamed from include/asm-sh/dreamcast/dma.h)0
-rw-r--r--arch/sh/include/mach-dreamcast/mach/maple.h (renamed from include/asm-sh/dreamcast/maple.h)0
-rw-r--r--arch/sh/include/mach-dreamcast/mach/pci.h25
-rw-r--r--arch/sh/include/mach-dreamcast/mach/sysasic.h (renamed from include/asm-sh/dreamcast/sysasic.h)0
-rw-r--r--arch/sh/include/mach-landisk/mach/gio.h (renamed from include/asm-sh/landisk/gio.h)0
-rw-r--r--arch/sh/include/mach-landisk/mach/iodata_landisk.h (renamed from include/asm-sh/landisk/iodata_landisk.h)0
-rw-r--r--arch/sh/include/mach-se/mach/se.h99
-rw-r--r--arch/sh/include/mach-se/mach/se7206.h (renamed from include/asm-sh/se7206.h)0
-rw-r--r--arch/sh/include/mach-se/mach/se7343.h149
-rw-r--r--arch/sh/include/mach-se/mach/se7721.h (renamed from include/asm-sh/se7721.h)0
-rw-r--r--arch/sh/include/mach-se/mach/se7722.h112
-rw-r--r--arch/sh/include/mach-se/mach/se7751.h (renamed from include/asm-sh/se7751.h)0
-rw-r--r--arch/sh/include/mach-se/mach/se7780.h (renamed from include/asm-sh/se7780.h)0
-rw-r--r--arch/sh/include/mach-sh03/mach/io.h (renamed from include/asm-sh/sh03/io.h)0
-rw-r--r--arch/sh/include/mach-sh03/mach/sh03.h (renamed from include/asm-sh/sh03/sh03.h)0
-rw-r--r--arch/sh/kernel/.gitignore1
-rw-r--r--arch/sh/kernel/Makefile_322
-rw-r--r--arch/sh/kernel/cf-enabler.c8
-rw-r--r--arch/sh/kernel/cpu/clock.c20
-rw-r--r--arch/sh/kernel/cpu/irq/intc-sh5.c2
-rw-r--r--arch/sh/kernel/cpu/irq/intc.c31
-rw-r--r--arch/sh/kernel/cpu/sh2/entry.S135
-rw-r--r--arch/sh/kernel/cpu/sh2/ex.S15
-rw-r--r--arch/sh/kernel/cpu/sh2/setup-sh7619.c24
-rw-r--r--arch/sh/kernel/cpu/sh2a/Makefile2
-rw-r--r--arch/sh/kernel/cpu/sh2a/entry.S249
-rw-r--r--arch/sh/kernel/cpu/sh2a/ex.S72
-rw-r--r--arch/sh/kernel/cpu/sh3/entry.S2
-rw-r--r--arch/sh/kernel/cpu/sh3/ex.S38
-rw-r--r--arch/sh/kernel/cpu/sh4/fpu.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c6
-rw-r--r--arch/sh/kernel/cpu/sh4/softfloat.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/sq.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/Makefile2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7343.c99
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c221
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7343.c253
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7366.c139
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c85
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7723.c138
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7763.c21
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7780.c11
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7785.c17
-rw-r--r--arch/sh/kernel/cpu/sh5/entry.S2
-rw-r--r--arch/sh/kernel/entry-common.S2
-rw-r--r--arch/sh/kernel/head_64.S4
-rw-r--r--arch/sh/kernel/irq.c2
-rw-r--r--arch/sh/kernel/process_32.c14
-rw-r--r--arch/sh/kernel/process_64.c10
-rw-r--r--arch/sh/kernel/ptrace_32.c23
-rw-r--r--arch/sh/kernel/setup.c7
-rw-r--r--arch/sh/kernel/signal_32.c36
-rw-r--r--arch/sh/kernel/syscalls_32.S6
-rw-r--r--arch/sh/kernel/syscalls_64.S6
-rw-r--r--arch/sh/kernel/time_32.c2
-rw-r--r--arch/sh/kernel/time_64.c4
-rw-r--r--arch/sh/kernel/timers/timer-tmu.c2
-rw-r--r--arch/sh/kernel/traps_32.c4
-rw-r--r--arch/sh/lib/Makefile4
-rw-r--r--arch/sh/lib64/panic.c2
-rw-r--r--arch/sh/mm/Kconfig20
-rw-r--r--arch/sh/mm/cache-debugfs.c2
-rw-r--r--arch/sh/mm/cache-sh4.c67
-rw-r--r--arch/sh/mm/consistent.c128
-rw-r--r--arch/sh/mm/fault_32.c12
-rw-r--r--arch/sh/mm/fault_64.c2
-rw-r--r--arch/sh/mm/pg-sh4.c2
-rw-r--r--arch/sh/mm/pg-sh7705.c2
-rw-r--r--arch/sh/mm/pmb.c2
-rw-r--r--arch/sh/tools/Makefile4
-rw-r--r--arch/sh/tools/mach-types4
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/include/asm/Kbuild45
-rw-r--r--arch/sparc/include/asm/agp.h (renamed from include/asm-sparc/agp.h)0
-rw-r--r--arch/sparc/include/asm/apb.h (renamed from include/asm-sparc/apb.h)0
-rw-r--r--arch/sparc/include/asm/apc.h (renamed from include/asm-sparc/apc.h)0
-rw-r--r--arch/sparc/include/asm/asi.h (renamed from include/asm-sparc/asi.h)0
-rw-r--r--arch/sparc/include/asm/asmmacro.h (renamed from include/asm-sparc/asmmacro.h)0
-rw-r--r--arch/sparc/include/asm/atomic.h8
-rw-r--r--arch/sparc/include/asm/atomic_32.h (renamed from include/asm-sparc/atomic_32.h)0
-rw-r--r--arch/sparc/include/asm/atomic_64.h (renamed from include/asm-sparc/atomic_64.h)0
-rw-r--r--arch/sparc/include/asm/auxio.h8
-rw-r--r--arch/sparc/include/asm/auxio_32.h89
-rw-r--r--arch/sparc/include/asm/auxio_64.h (renamed from include/asm-sparc/auxio_64.h)0
-rw-r--r--arch/sparc/include/asm/auxvec.h (renamed from include/asm-sparc/auxvec.h)0
-rw-r--r--arch/sparc/include/asm/backoff.h (renamed from include/asm-sparc/backoff.h)0
-rw-r--r--arch/sparc/include/asm/bbc.h (renamed from include/asm-sparc/bbc.h)0
-rw-r--r--arch/sparc/include/asm/bitext.h (renamed from include/asm-sparc/bitext.h)0
-rw-r--r--arch/sparc/include/asm/bitops.h8
-rw-r--r--arch/sparc/include/asm/bitops_32.h (renamed from include/asm-sparc/bitops_32.h)0
-rw-r--r--arch/sparc/include/asm/bitops_64.h (renamed from include/asm-sparc/bitops_64.h)0
-rw-r--r--arch/sparc/include/asm/bpp.h (renamed from include/asm-sparc/bpp.h)0
-rw-r--r--arch/sparc/include/asm/btfixup.h208
-rw-r--r--arch/sparc/include/asm/bug.h (renamed from include/asm-sparc/bug.h)0
-rw-r--r--arch/sparc/include/asm/bugs.h24
-rw-r--r--arch/sparc/include/asm/byteorder.h (renamed from include/asm-sparc/byteorder.h)0
-rw-r--r--arch/sparc/include/asm/cache.h (renamed from include/asm-sparc/cache.h)0
-rw-r--r--arch/sparc/include/asm/cacheflush.h8
-rw-r--r--arch/sparc/include/asm/cacheflush_32.h (renamed from include/asm-sparc/cacheflush_32.h)0
-rw-r--r--arch/sparc/include/asm/cacheflush_64.h (renamed from include/asm-sparc/cacheflush_64.h)0
-rw-r--r--arch/sparc/include/asm/chafsr.h (renamed from include/asm-sparc/chafsr.h)0
-rw-r--r--arch/sparc/include/asm/checksum.h8
-rw-r--r--arch/sparc/include/asm/checksum_32.h (renamed from include/asm-sparc/checksum_32.h)0
-rw-r--r--arch/sparc/include/asm/checksum_64.h (renamed from include/asm-sparc/checksum_64.h)0
-rw-r--r--arch/sparc/include/asm/chmctrl.h (renamed from include/asm-sparc/chmctrl.h)0
-rw-r--r--arch/sparc/include/asm/clock.h (renamed from include/asm-sparc/clock.h)0
-rw-r--r--arch/sparc/include/asm/cmt.h (renamed from include/asm-sparc/cmt.h)0
-rw-r--r--arch/sparc/include/asm/compat.h (renamed from include/asm-sparc/compat.h)0
-rw-r--r--arch/sparc/include/asm/compat_signal.h (renamed from include/asm-sparc/compat_signal.h)0
-rw-r--r--arch/sparc/include/asm/contregs.h (renamed from include/asm-sparc/contregs.h)0
-rw-r--r--arch/sparc/include/asm/cpudata.h8
-rw-r--r--arch/sparc/include/asm/cpudata_32.h27
-rw-r--r--arch/sparc/include/asm/cpudata_64.h (renamed from include/asm-sparc/cpudata_64.h)0
-rw-r--r--arch/sparc/include/asm/cputime.h (renamed from include/asm-sparc/cputime.h)0
-rw-r--r--arch/sparc/include/asm/current.h34
-rw-r--r--arch/sparc/include/asm/cypress.h (renamed from include/asm-sparc/cypress.h)0
-rw-r--r--arch/sparc/include/asm/dcr.h (renamed from include/asm-sparc/dcr.h)0
-rw-r--r--arch/sparc/include/asm/dcu.h (renamed from include/asm-sparc/dcu.h)0
-rw-r--r--arch/sparc/include/asm/delay.h8
-rw-r--r--arch/sparc/include/asm/delay_32.h (renamed from include/asm-sparc/delay_32.h)0
-rw-r--r--arch/sparc/include/asm/delay_64.h (renamed from include/asm-sparc/delay_64.h)0
-rw-r--r--arch/sparc/include/asm/device.h (renamed from include/asm-sparc/device.h)0
-rw-r--r--arch/sparc/include/asm/display7seg.h (renamed from include/asm-sparc/display7seg.h)0
-rw-r--r--arch/sparc/include/asm/div64.h (renamed from include/asm-sparc/div64.h)0
-rw-r--r--arch/sparc/include/asm/dma-mapping.h8
-rw-r--r--arch/sparc/include/asm/dma-mapping_32.h (renamed from include/asm-sparc/dma-mapping_32.h)0
-rw-r--r--arch/sparc/include/asm/dma-mapping_64.h (renamed from include/asm-sparc/dma-mapping_64.h)0
-rw-r--r--arch/sparc/include/asm/dma.h8
-rw-r--r--arch/sparc/include/asm/dma_32.h288
-rw-r--r--arch/sparc/include/asm/dma_64.h205
-rw-r--r--arch/sparc/include/asm/ebus.h8
-rw-r--r--arch/sparc/include/asm/ebus_32.h (renamed from include/asm-sparc/ebus_32.h)0
-rw-r--r--arch/sparc/include/asm/ebus_64.h (renamed from include/asm-sparc/ebus_64.h)0
-rw-r--r--arch/sparc/include/asm/ecc.h (renamed from include/asm-sparc/ecc.h)0
-rw-r--r--arch/sparc/include/asm/eeprom.h (renamed from include/asm-sparc/eeprom.h)0
-rw-r--r--arch/sparc/include/asm/elf.h8
-rw-r--r--arch/sparc/include/asm/elf_32.h (renamed from include/asm-sparc/elf_32.h)0
-rw-r--r--arch/sparc/include/asm/elf_64.h (renamed from include/asm-sparc/elf_64.h)0
-rw-r--r--arch/sparc/include/asm/emergency-restart.h (renamed from include/asm-sparc/emergency-restart.h)0
-rw-r--r--arch/sparc/include/asm/envctrl.h (renamed from include/asm-sparc/envctrl.h)0
-rw-r--r--arch/sparc/include/asm/errno.h (renamed from include/asm-sparc/errno.h)0
-rw-r--r--arch/sparc/include/asm/estate.h (renamed from include/asm-sparc/estate.h)0
-rw-r--r--arch/sparc/include/asm/fb.h (renamed from include/asm-sparc/fb.h)0
-rw-r--r--arch/sparc/include/asm/fbio.h (renamed from include/asm-sparc/fbio.h)0
-rw-r--r--arch/sparc/include/asm/fcntl.h (renamed from include/asm-sparc/fcntl.h)0
-rw-r--r--arch/sparc/include/asm/fhc.h (renamed from include/asm-sparc/fhc.h)0
-rw-r--r--arch/sparc/include/asm/fixmap.h (renamed from include/asm-sparc/fixmap.h)0
-rw-r--r--arch/sparc/include/asm/floppy.h8
-rw-r--r--arch/sparc/include/asm/floppy_32.h388
-rw-r--r--arch/sparc/include/asm/floppy_64.h (renamed from include/asm-sparc/floppy_64.h)0
-rw-r--r--arch/sparc/include/asm/fpumacro.h (renamed from include/asm-sparc/fpumacro.h)0
-rw-r--r--arch/sparc/include/asm/ftrace.h (renamed from include/asm-sparc64/ftrace.h)0
-rw-r--r--arch/sparc/include/asm/futex.h8
-rw-r--r--arch/sparc/include/asm/futex_32.h (renamed from include/asm-sparc/futex_32.h)0
-rw-r--r--arch/sparc/include/asm/futex_64.h (renamed from include/asm-sparc/futex_64.h)0
-rw-r--r--arch/sparc/include/asm/hardirq.h8
-rw-r--r--arch/sparc/include/asm/hardirq_32.h (renamed from include/asm-sparc/hardirq_32.h)0
-rw-r--r--arch/sparc/include/asm/hardirq_64.h (renamed from include/asm-sparc/hardirq_64.h)0
-rw-r--r--arch/sparc/include/asm/head.h8
-rw-r--r--arch/sparc/include/asm/head_32.h (renamed from include/asm-sparc/head_32.h)0
-rw-r--r--arch/sparc/include/asm/head_64.h (renamed from include/asm-sparc/head_64.h)0
-rw-r--r--arch/sparc/include/asm/highmem.h (renamed from include/asm-sparc/highmem.h)0
-rw-r--r--arch/sparc/include/asm/hugetlb.h (renamed from include/asm-sparc/hugetlb.h)0
-rw-r--r--arch/sparc/include/asm/hvtramp.h (renamed from include/asm-sparc/hvtramp.h)0
-rw-r--r--arch/sparc/include/asm/hw_irq.h (renamed from include/asm-sparc/hw_irq.h)0
-rw-r--r--arch/sparc/include/asm/hypervisor.h (renamed from include/asm-sparc/hypervisor.h)0
-rw-r--r--arch/sparc/include/asm/ide.h (renamed from include/asm-sparc/ide.h)0
-rw-r--r--arch/sparc/include/asm/idprom.h (renamed from include/asm-sparc/idprom.h)0
-rw-r--r--arch/sparc/include/asm/intr_queue.h (renamed from include/asm-sparc/intr_queue.h)0
-rw-r--r--arch/sparc/include/asm/io-unit.h (renamed from include/asm-sparc/io-unit.h)0
-rw-r--r--arch/sparc/include/asm/io.h8
-rw-r--r--arch/sparc/include/asm/io_32.h (renamed from include/asm-sparc/io_32.h)0
-rw-r--r--arch/sparc/include/asm/io_64.h (renamed from include/asm-sparc/io_64.h)0
-rw-r--r--arch/sparc/include/asm/ioctl.h (renamed from include/asm-sparc/ioctl.h)0
-rw-r--r--arch/sparc/include/asm/ioctls.h (renamed from include/asm-sparc/ioctls.h)0
-rw-r--r--arch/sparc/include/asm/iommu.h8
-rw-r--r--arch/sparc/include/asm/iommu_32.h (renamed from include/asm-sparc/iommu_32.h)0
-rw-r--r--arch/sparc/include/asm/iommu_64.h (renamed from include/asm-sparc/iommu_64.h)0
-rw-r--r--arch/sparc/include/asm/ipcbuf.h8
-rw-r--r--arch/sparc/include/asm/ipcbuf_32.h (renamed from include/asm-sparc/ipcbuf_32.h)0
-rw-r--r--arch/sparc/include/asm/ipcbuf_64.h (renamed from include/asm-sparc/ipcbuf_64.h)0
-rw-r--r--arch/sparc/include/asm/irq.h8
-rw-r--r--arch/sparc/include/asm/irq_32.h (renamed from include/asm-sparc/irq_32.h)0
-rw-r--r--arch/sparc/include/asm/irq_64.h (renamed from include/asm-sparc/irq_64.h)0
-rw-r--r--arch/sparc/include/asm/irq_regs.h (renamed from include/asm-sparc/irq_regs.h)0
-rw-r--r--arch/sparc/include/asm/irqflags.h8
-rw-r--r--arch/sparc/include/asm/irqflags_32.h39
-rw-r--r--arch/sparc/include/asm/irqflags_64.h89
-rw-r--r--arch/sparc/include/asm/jsflash.h (renamed from include/asm-sparc/jsflash.h)0
-rw-r--r--arch/sparc/include/asm/kdebug.h8
-rw-r--r--arch/sparc/include/asm/kdebug_32.h (renamed from include/asm-sparc/kdebug_32.h)0
-rw-r--r--arch/sparc/include/asm/kdebug_64.h (renamed from include/asm-sparc/kdebug_64.h)0
-rw-r--r--arch/sparc/include/asm/kgdb.h (renamed from include/asm-sparc/kgdb.h)0
-rw-r--r--arch/sparc/include/asm/kmap_types.h (renamed from include/asm-sparc/kmap_types.h)0
-rw-r--r--arch/sparc/include/asm/kprobes.h (renamed from include/asm-sparc/kprobes.h)0
-rw-r--r--arch/sparc/include/asm/ldc.h (renamed from include/asm-sparc/ldc.h)0
-rw-r--r--arch/sparc/include/asm/linkage.h (renamed from include/asm-sparc/linkage.h)0
-rw-r--r--arch/sparc/include/asm/lmb.h (renamed from include/asm-sparc/lmb.h)0
-rw-r--r--arch/sparc/include/asm/local.h (renamed from include/asm-sparc/local.h)0
-rw-r--r--arch/sparc/include/asm/lsu.h (renamed from include/asm-sparc/lsu.h)0
-rw-r--r--arch/sparc/include/asm/machines.h (renamed from include/asm-sparc/machines.h)0
-rw-r--r--arch/sparc/include/asm/mbus.h (renamed from include/asm-sparc/mbus.h)0
-rw-r--r--arch/sparc/include/asm/mc146818rtc.h8
-rw-r--r--arch/sparc/include/asm/mc146818rtc_32.h (renamed from include/asm-sparc/mc146818rtc_32.h)0
-rw-r--r--arch/sparc/include/asm/mc146818rtc_64.h (renamed from include/asm-sparc/mc146818rtc_64.h)0
-rw-r--r--arch/sparc/include/asm/mdesc.h (renamed from include/asm-sparc/mdesc.h)0
-rw-r--r--arch/sparc/include/asm/memreg.h (renamed from include/asm-sparc/memreg.h)0
-rw-r--r--arch/sparc/include/asm/mman.h (renamed from include/asm-sparc/mman.h)0
-rw-r--r--arch/sparc/include/asm/mmu.h8
-rw-r--r--arch/sparc/include/asm/mmu_32.h (renamed from include/asm-sparc/mmu_32.h)0
-rw-r--r--arch/sparc/include/asm/mmu_64.h (renamed from include/asm-sparc/mmu_64.h)0
-rw-r--r--arch/sparc/include/asm/mmu_context.h8
-rw-r--r--arch/sparc/include/asm/mmu_context_32.h (renamed from include/asm-sparc/mmu_context_32.h)0
-rw-r--r--arch/sparc/include/asm/mmu_context_64.h (renamed from include/asm-sparc/mmu_context_64.h)0
-rw-r--r--arch/sparc/include/asm/mmzone.h (renamed from include/asm-sparc/mmzone.h)0
-rw-r--r--arch/sparc/include/asm/module.h8
-rw-r--r--arch/sparc/include/asm/module_32.h (renamed from include/asm-sparc/module_32.h)0
-rw-r--r--arch/sparc/include/asm/module_64.h (renamed from include/asm-sparc/module_64.h)0
-rw-r--r--arch/sparc/include/asm/mostek.h8
-rw-r--r--arch/sparc/include/asm/mostek_32.h (renamed from include/asm-sparc/mostek_32.h)0
-rw-r--r--arch/sparc/include/asm/mostek_64.h (renamed from include/asm-sparc/mostek_64.h)0
-rw-r--r--arch/sparc/include/asm/mpmbox.h (renamed from include/asm-sparc/mpmbox.h)0
-rw-r--r--arch/sparc/include/asm/msgbuf.h (renamed from include/asm-sparc/msgbuf.h)0
-rw-r--r--arch/sparc/include/asm/msi.h (renamed from include/asm-sparc/msi.h)0
-rw-r--r--arch/sparc/include/asm/mutex.h (renamed from include/asm-sparc/mutex.h)0
-rw-r--r--arch/sparc/include/asm/mxcc.h (renamed from include/asm-sparc/mxcc.h)0
-rw-r--r--arch/sparc/include/asm/ns87303.h (renamed from include/asm-sparc/ns87303.h)0
-rw-r--r--arch/sparc/include/asm/obio.h (renamed from include/asm-sparc/obio.h)0
-rw-r--r--arch/sparc/include/asm/of_device.h (renamed from include/asm-sparc/of_device.h)0
-rw-r--r--arch/sparc/include/asm/of_platform.h8
-rw-r--r--arch/sparc/include/asm/of_platform_32.h24
-rw-r--r--arch/sparc/include/asm/of_platform_64.h25
-rw-r--r--arch/sparc/include/asm/openprom.h8
-rw-r--r--arch/sparc/include/asm/openprom_32.h (renamed from include/asm-sparc/openprom_32.h)0
-rw-r--r--arch/sparc/include/asm/openprom_64.h (renamed from include/asm-sparc/openprom_64.h)0
-rw-r--r--arch/sparc/include/asm/openpromio.h (renamed from include/asm-sparc/openpromio.h)0
-rw-r--r--arch/sparc/include/asm/oplib.h8
-rw-r--r--arch/sparc/include/asm/oplib_32.h (renamed from include/asm-sparc/oplib_32.h)0
-rw-r--r--arch/sparc/include/asm/oplib_64.h (renamed from include/asm-sparc/oplib_64.h)0
-rw-r--r--arch/sparc/include/asm/page.h8
-rw-r--r--arch/sparc/include/asm/page_32.h (renamed from include/asm-sparc/page_32.h)0
-rw-r--r--arch/sparc/include/asm/page_64.h (renamed from include/asm-sparc/page_64.h)0
-rw-r--r--arch/sparc/include/asm/param.h (renamed from include/asm-sparc/param.h)0
-rw-r--r--arch/sparc/include/asm/parport.h (renamed from include/asm-sparc/parport.h)0
-rw-r--r--arch/sparc/include/asm/pbm.h (renamed from include/asm-sparc/pbm.h)0
-rw-r--r--arch/sparc/include/asm/pci.h8
-rw-r--r--arch/sparc/include/asm/pci_32.h (renamed from include/asm-sparc/pci_32.h)0
-rw-r--r--arch/sparc/include/asm/pci_64.h (renamed from include/asm-sparc/pci_64.h)0
-rw-r--r--arch/sparc/include/asm/pcic.h (renamed from include/asm-sparc/pcic.h)0
-rw-r--r--arch/sparc/include/asm/percpu.h8
-rw-r--r--arch/sparc/include/asm/percpu_32.h (renamed from include/asm-sparc/percpu_32.h)0
-rw-r--r--arch/sparc/include/asm/percpu_64.h (renamed from include/asm-sparc/percpu_64.h)0
-rw-r--r--arch/sparc/include/asm/perfctr.h (renamed from include/asm-sparc/perfctr.h)0
-rw-r--r--arch/sparc/include/asm/pgalloc.h8
-rw-r--r--arch/sparc/include/asm/pgalloc_32.h (renamed from include/asm-sparc/pgalloc_32.h)0
-rw-r--r--arch/sparc/include/asm/pgalloc_64.h (renamed from include/asm-sparc/pgalloc_64.h)0
-rw-r--r--arch/sparc/include/asm/pgtable.h8
-rw-r--r--arch/sparc/include/asm/pgtable_32.h480
-rw-r--r--arch/sparc/include/asm/pgtable_64.h (renamed from include/asm-sparc/pgtable_64.h)0
-rw-r--r--arch/sparc/include/asm/pgtsrmmu.h (renamed from include/asm-sparc/pgtsrmmu.h)0
-rw-r--r--arch/sparc/include/asm/pgtsun4.h (renamed from include/asm-sparc/pgtsun4.h)0
-rw-r--r--arch/sparc/include/asm/pgtsun4c.h (renamed from include/asm-sparc/pgtsun4c.h)0
-rw-r--r--arch/sparc/include/asm/pil.h (renamed from include/asm-sparc/pil.h)0
-rw-r--r--arch/sparc/include/asm/poll.h (renamed from include/asm-sparc/poll.h)0
-rw-r--r--arch/sparc/include/asm/posix_types.h8
-rw-r--r--arch/sparc/include/asm/posix_types_32.h (renamed from include/asm-sparc/posix_types_32.h)0
-rw-r--r--arch/sparc/include/asm/posix_types_64.h (renamed from include/asm-sparc/posix_types_64.h)0
-rw-r--r--arch/sparc/include/asm/processor.h8
-rw-r--r--arch/sparc/include/asm/processor_32.h129
-rw-r--r--arch/sparc/include/asm/processor_64.h237
-rw-r--r--arch/sparc/include/asm/prom.h (renamed from include/asm-sparc/prom.h)0
-rw-r--r--arch/sparc/include/asm/psr.h (renamed from include/asm-sparc/psr.h)0
-rw-r--r--arch/sparc/include/asm/psrcompat.h (renamed from include/asm-sparc/psrcompat.h)0
-rw-r--r--arch/sparc/include/asm/pstate.h (renamed from include/asm-sparc/pstate.h)0
-rw-r--r--arch/sparc/include/asm/ptrace.h8
-rw-r--r--arch/sparc/include/asm/ptrace_32.h176
-rw-r--r--arch/sparc/include/asm/ptrace_64.h347
-rw-r--r--arch/sparc/include/asm/reboot.h (renamed from include/asm-sparc/reboot.h)0
-rw-r--r--arch/sparc/include/asm/reg.h8
-rw-r--r--arch/sparc/include/asm/reg_32.h79
-rw-r--r--arch/sparc/include/asm/reg_64.h56
-rw-r--r--arch/sparc/include/asm/resource.h (renamed from include/asm-sparc/resource.h)0
-rw-r--r--arch/sparc/include/asm/ross.h (renamed from include/asm-sparc/ross.h)0
-rw-r--r--arch/sparc/include/asm/rtc.h (renamed from include/asm-sparc/rtc.h)0
-rw-r--r--arch/sparc/include/asm/rwsem-const.h (renamed from include/asm-sparc/rwsem-const.h)0
-rw-r--r--arch/sparc/include/asm/rwsem.h (renamed from include/asm-sparc/rwsem.h)0
-rw-r--r--arch/sparc/include/asm/sbi.h (renamed from include/asm-sparc/sbi.h)0
-rw-r--r--arch/sparc/include/asm/sbus.h8
-rw-r--r--arch/sparc/include/asm/sbus_32.h (renamed from include/asm-sparc/sbus_32.h)0
-rw-r--r--arch/sparc/include/asm/sbus_64.h (renamed from include/asm-sparc/sbus_64.h)0
-rw-r--r--arch/sparc/include/asm/scatterlist.h8
-rw-r--r--arch/sparc/include/asm/scatterlist_32.h (renamed from include/asm-sparc/scatterlist_32.h)0
-rw-r--r--arch/sparc/include/asm/scatterlist_64.h (renamed from include/asm-sparc/scatterlist_64.h)0
-rw-r--r--arch/sparc/include/asm/scratchpad.h (renamed from include/asm-sparc/scratchpad.h)0
-rw-r--r--arch/sparc/include/asm/seccomp.h (renamed from include/asm-sparc/seccomp.h)0
-rw-r--r--arch/sparc/include/asm/sections.h8
-rw-r--r--arch/sparc/include/asm/sections_32.h (renamed from include/asm-sparc/sections_32.h)0
-rw-r--r--arch/sparc/include/asm/sections_64.h (renamed from include/asm-sparc/sections_64.h)0
-rw-r--r--arch/sparc/include/asm/sembuf.h (renamed from include/asm-sparc/sembuf.h)0
-rw-r--r--arch/sparc/include/asm/setup.h (renamed from include/asm-sparc/setup.h)0
-rw-r--r--arch/sparc/include/asm/sfafsr.h (renamed from include/asm-sparc/sfafsr.h)0
-rw-r--r--arch/sparc/include/asm/sfp-machine.h8
-rw-r--r--arch/sparc/include/asm/sfp-machine_32.h (renamed from include/asm-sparc/sfp-machine_32.h)0
-rw-r--r--arch/sparc/include/asm/sfp-machine_64.h (renamed from include/asm-sparc/sfp-machine_64.h)0
-rw-r--r--arch/sparc/include/asm/shmbuf.h (renamed from include/asm-sparc/shmbuf.h)0
-rw-r--r--arch/sparc/include/asm/shmparam.h8
-rw-r--r--arch/sparc/include/asm/shmparam_32.h (renamed from include/asm-sparc/shmparam_32.h)0
-rw-r--r--arch/sparc/include/asm/shmparam_64.h (renamed from include/asm-sparc/shmparam_64.h)0
-rw-r--r--arch/sparc/include/asm/sigcontext.h8
-rw-r--r--arch/sparc/include/asm/sigcontext_32.h (renamed from include/asm-sparc/sigcontext_32.h)0
-rw-r--r--arch/sparc/include/asm/sigcontext_64.h (renamed from include/asm-sparc/sigcontext_64.h)0
-rw-r--r--arch/sparc/include/asm/siginfo.h8
-rw-r--r--arch/sparc/include/asm/siginfo_32.h (renamed from include/asm-sparc/siginfo_32.h)0
-rw-r--r--arch/sparc/include/asm/siginfo_64.h (renamed from include/asm-sparc/siginfo_64.h)0
-rw-r--r--arch/sparc/include/asm/signal.h8
-rw-r--r--arch/sparc/include/asm/signal_32.h (renamed from include/asm-sparc/signal_32.h)0
-rw-r--r--arch/sparc/include/asm/signal_64.h (renamed from include/asm-sparc/signal_64.h)0
-rw-r--r--arch/sparc/include/asm/smp.h8
-rw-r--r--arch/sparc/include/asm/smp_32.h (renamed from include/asm-sparc/smp_32.h)0
-rw-r--r--arch/sparc/include/asm/smp_64.h (renamed from include/asm-sparc/smp_64.h)0
-rw-r--r--arch/sparc/include/asm/smpprim.h (renamed from include/asm-sparc/smpprim.h)0
-rw-r--r--arch/sparc/include/asm/socket.h (renamed from include/asm-sparc/socket.h)0
-rw-r--r--arch/sparc/include/asm/sockios.h (renamed from include/asm-sparc/sockios.h)0
-rw-r--r--arch/sparc/include/asm/sparsemem.h (renamed from include/asm-sparc/sparsemem.h)0
-rw-r--r--arch/sparc/include/asm/spinlock.h8
-rw-r--r--arch/sparc/include/asm/spinlock_32.h (renamed from include/asm-sparc/spinlock_32.h)0
-rw-r--r--arch/sparc/include/asm/spinlock_64.h (renamed from include/asm-sparc/spinlock_64.h)0
-rw-r--r--arch/sparc/include/asm/spinlock_types.h (renamed from include/asm-sparc/spinlock_types.h)0
-rw-r--r--arch/sparc/include/asm/spitfire.h (renamed from include/asm-sparc/spitfire.h)0
-rw-r--r--arch/sparc/include/asm/sstate.h (renamed from include/asm-sparc/sstate.h)0
-rw-r--r--arch/sparc/include/asm/stacktrace.h (renamed from include/asm-sparc/stacktrace.h)0
-rw-r--r--arch/sparc/include/asm/starfire.h (renamed from include/asm-sparc/starfire.h)0
-rw-r--r--arch/sparc/include/asm/stat.h8
-rw-r--r--arch/sparc/include/asm/stat_32.h (renamed from include/asm-sparc/stat_32.h)0
-rw-r--r--arch/sparc/include/asm/stat_64.h (renamed from include/asm-sparc/stat_64.h)0
-rw-r--r--arch/sparc/include/asm/statfs.h8
-rw-r--r--arch/sparc/include/asm/statfs_32.h (renamed from include/asm-sparc/statfs_32.h)0
-rw-r--r--arch/sparc/include/asm/statfs_64.h (renamed from include/asm-sparc/statfs_64.h)0
-rw-r--r--arch/sparc/include/asm/string.h8
-rw-r--r--arch/sparc/include/asm/string_32.h (renamed from include/asm-sparc/string_32.h)0
-rw-r--r--arch/sparc/include/asm/string_64.h (renamed from include/asm-sparc/string_64.h)0
-rw-r--r--arch/sparc/include/asm/sun4paddr.h (renamed from include/asm-sparc/sun4paddr.h)0
-rw-r--r--arch/sparc/include/asm/sun4prom.h (renamed from include/asm-sparc/sun4prom.h)0
-rw-r--r--arch/sparc/include/asm/sunbpp.h80
-rw-r--r--arch/sparc/include/asm/swift.h (renamed from include/asm-sparc/swift.h)0
-rw-r--r--arch/sparc/include/asm/syscall.h120
-rw-r--r--arch/sparc/include/asm/syscalls.h (renamed from include/asm-sparc/syscalls.h)0
-rw-r--r--arch/sparc/include/asm/sysen.h (renamed from include/asm-sparc/sysen.h)0
-rw-r--r--arch/sparc/include/asm/system.h8
-rw-r--r--arch/sparc/include/asm/system_32.h (renamed from include/asm-sparc/system_32.h)0
-rw-r--r--arch/sparc/include/asm/system_64.h (renamed from include/asm-sparc/system_64.h)0
-rw-r--r--arch/sparc/include/asm/termbits.h (renamed from include/asm-sparc/termbits.h)0
-rw-r--r--arch/sparc/include/asm/termios.h (renamed from include/asm-sparc/termios.h)0
-rw-r--r--arch/sparc/include/asm/thread_info.h8
-rw-r--r--arch/sparc/include/asm/thread_info_32.h158
-rw-r--r--arch/sparc/include/asm/thread_info_64.h281
-rw-r--r--arch/sparc/include/asm/timer.h8
-rw-r--r--arch/sparc/include/asm/timer_32.h (renamed from include/asm-sparc/timer_32.h)0
-rw-r--r--arch/sparc/include/asm/timer_64.h (renamed from include/asm-sparc/timer_64.h)0
-rw-r--r--arch/sparc/include/asm/timex.h8
-rw-r--r--arch/sparc/include/asm/timex_32.h15
-rw-r--r--arch/sparc/include/asm/timex_64.h19
-rw-r--r--arch/sparc/include/asm/tlb.h8
-rw-r--r--arch/sparc/include/asm/tlb_32.h (renamed from include/asm-sparc/tlb_32.h)0
-rw-r--r--arch/sparc/include/asm/tlb_64.h (renamed from include/asm-sparc/tlb_64.h)0
-rw-r--r--arch/sparc/include/asm/tlbflush.h8
-rw-r--r--arch/sparc/include/asm/tlbflush_32.h (renamed from include/asm-sparc/tlbflush_32.h)0
-rw-r--r--arch/sparc/include/asm/tlbflush_64.h (renamed from include/asm-sparc/tlbflush_64.h)0
-rw-r--r--arch/sparc/include/asm/topology.h8
-rw-r--r--arch/sparc/include/asm/topology_32.h (renamed from include/asm-sparc/topology_32.h)0
-rw-r--r--arch/sparc/include/asm/topology_64.h (renamed from include/asm-sparc/topology_64.h)0
-rw-r--r--arch/sparc/include/asm/traps.h (renamed from include/asm-sparc/traps.h)0
-rw-r--r--arch/sparc/include/asm/tsb.h (renamed from include/asm-sparc/tsb.h)0
-rw-r--r--arch/sparc/include/asm/tsunami.h (renamed from include/asm-sparc/tsunami.h)0
-rw-r--r--arch/sparc/include/asm/ttable.h (renamed from include/asm-sparc/ttable.h)0
-rw-r--r--arch/sparc/include/asm/turbosparc.h (renamed from include/asm-sparc/turbosparc.h)0
-rw-r--r--arch/sparc/include/asm/types.h (renamed from include/asm-sparc/types.h)0
-rw-r--r--arch/sparc/include/asm/uaccess.h8
-rw-r--r--arch/sparc/include/asm/uaccess_32.h (renamed from include/asm-sparc/uaccess_32.h)0
-rw-r--r--arch/sparc/include/asm/uaccess_64.h (renamed from include/asm-sparc/uaccess_64.h)0
-rw-r--r--arch/sparc/include/asm/uctx.h (renamed from include/asm-sparc/uctx.h)0
-rw-r--r--arch/sparc/include/asm/unaligned.h (renamed from include/asm-sparc/unaligned.h)0
-rw-r--r--arch/sparc/include/asm/unistd.h8
-rw-r--r--arch/sparc/include/asm/unistd_32.h (renamed from include/asm-sparc/unistd_32.h)0
-rw-r--r--arch/sparc/include/asm/unistd_64.h (renamed from include/asm-sparc/unistd_64.h)0
-rw-r--r--arch/sparc/include/asm/upa.h (renamed from include/asm-sparc/upa.h)0
-rw-r--r--arch/sparc/include/asm/user.h (renamed from include/asm-sparc/user.h)0
-rw-r--r--arch/sparc/include/asm/utrap.h51
-rw-r--r--arch/sparc/include/asm/vac-ops.h (renamed from include/asm-sparc/vac-ops.h)0
-rw-r--r--arch/sparc/include/asm/vaddrs.h64
-rw-r--r--arch/sparc/include/asm/vfc_ioctls.h (renamed from include/asm-sparc/vfc_ioctls.h)0
-rw-r--r--arch/sparc/include/asm/vga.h (renamed from include/asm-sparc/vga.h)0
-rw-r--r--arch/sparc/include/asm/viking.h (renamed from include/asm-sparc/viking.h)0
-rw-r--r--arch/sparc/include/asm/vio.h (renamed from include/asm-sparc/vio.h)0
-rw-r--r--arch/sparc/include/asm/visasm.h (renamed from include/asm-sparc/visasm.h)0
-rw-r--r--arch/sparc/include/asm/watchdog.h (renamed from include/asm-sparc/watchdog.h)0
-rw-r--r--arch/sparc/include/asm/winmacro.h (renamed from include/asm-sparc/winmacro.h)0
-rw-r--r--arch/sparc/include/asm/xor.h8
-rw-r--r--arch/sparc/include/asm/xor_32.h269
-rw-r--r--arch/sparc/include/asm/xor_64.h70
-rw-r--r--arch/sparc/kernel/entry.S12
-rw-r--r--arch/sparc/kernel/ptrace.c26
-rw-r--r--arch/sparc/kernel/rtrap.S5
-rw-r--r--arch/sparc/kernel/signal.c16
-rw-r--r--arch/sparc64/Kconfig1
-rw-r--r--arch/sparc64/kernel/compat_audit.c2
-rw-r--r--arch/sparc64/kernel/entry.h3
-rw-r--r--arch/sparc64/kernel/ptrace.c32
-rw-r--r--arch/sparc64/kernel/rtrap.S6
-rw-r--r--arch/sparc64/kernel/signal.c8
-rw-r--r--arch/sparc64/kernel/signal32.c3
-rw-r--r--arch/sparc64/kernel/syscalls.S4
-rw-r--r--arch/um/drivers/line.c14
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/kernel/acpi/cstate.c3
-rw-r--r--arch/x86/kernel/amd_iommu.c13
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c10
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c15
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c12
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-ich.c3
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c3
-rw-r--r--arch/x86/kernel/genapic_64.c1
-rw-r--r--arch/x86/kernel/ldt.c6
-rw-r--r--arch/x86/kernel/microcode.c17
-rw-r--r--arch/x86/kernel/pci-dma.c130
-rw-r--r--arch/x86/kernel/pci-gart_64.c11
-rw-r--r--arch/x86/kernel/reboot.c11
-rw-r--r--arch/x86/kernel/setup.c13
-rw-r--r--arch/x86/kernel/setup_percpu.c21
-rw-r--r--arch/x86/kvm/Kconfig1
-rw-r--r--arch/x86/lguest/boot.c3
-rw-r--r--arch/x86/lib/copy_user_64.S2
-rw-r--r--arch/x86/lib/copy_user_nocache_64.S3
-rw-r--r--arch/x86/mm/gup.c9
-rw-r--r--arch/x86/pci/fixup.c3
-rw-r--r--arch/x86/pci/i386.c26
-rw-r--r--arch/x86/pci/irq.c106
-rw-r--r--arch/x86/pci/numaq_32.c5
-rw-r--r--block/blk-core.c18
-rw-r--r--drivers/Makefile1
-rw-r--r--drivers/acpi/pci_slot.c18
-rw-r--r--drivers/acpi/processor_idle.c15
-rw-r--r--drivers/acpi/processor_perflib.c21
-rw-r--r--drivers/acpi/processor_throttling.c11
-rw-r--r--drivers/atm/iphase.c40
-rw-r--r--drivers/base/memory.c3
-rw-r--r--drivers/bluetooth/hci_usb.c7
-rw-r--r--drivers/cdrom/gdrom.c4
-rw-r--r--drivers/char/hw_random/intel-rng.c6
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c4
-rw-r--r--drivers/char/mxser.c6
-rw-r--r--drivers/char/pcmcia/ipwireless/hardware.c275
-rw-r--r--drivers/char/pcmcia/ipwireless/hardware.h4
-rw-r--r--drivers/char/pcmcia/ipwireless/main.c86
-rw-r--r--drivers/char/pcmcia/ipwireless/main.h5
-rw-r--r--drivers/char/pcmcia/ipwireless/network.c58
-rw-r--r--drivers/char/pcmcia/ipwireless/network.h1
-rw-r--r--drivers/char/pcmcia/ipwireless/tty.c2
-rw-r--r--drivers/cpufreq/cpufreq.c3
-rw-r--r--drivers/cpuidle/cpuidle.c2
-rw-r--r--drivers/firmware/dcdbas.c3
-rw-r--r--drivers/firmware/iscsi_ibft_find.c1
-rw-r--r--drivers/hwmon/Kconfig25
-rw-r--r--drivers/hwmon/adt7473.c16
-rw-r--r--drivers/hwmon/dme1737.c297
-rw-r--r--drivers/hwmon/lm75.c282
-rw-r--r--drivers/hwmon/lm85.c672
-rw-r--r--drivers/i2c/busses/i2c-bfin-twi.c35
-rw-r--r--drivers/i2c/busses/i2c-gpio.c9
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c129
-rw-r--r--drivers/ide/ppc/pmac.c13
-rw-r--r--drivers/input/keyboard/maple_keyb.c1
-rw-r--r--drivers/input/keyboard/sh_keysc.c27
-rw-r--r--drivers/input/misc/uinput.c1
-rw-r--r--drivers/input/serio/serio.c55
-rw-r--r--drivers/input/touchscreen/Kconfig12
-rw-r--r--drivers/input/touchscreen/Makefile1
-rw-r--r--drivers/input/touchscreen/ads7846.c16
-rw-r--r--drivers/input/touchscreen/atmel_tsadcc.c332
-rw-r--r--drivers/isdn/gigaset/isocdata.c5
-rw-r--r--drivers/isdn/hardware/mISDN/Kconfig1
-rw-r--r--drivers/isdn/hardware/mISDN/hfcpci.c3
-rw-r--r--drivers/isdn/hysdn/hysdn_pof.h2
-rw-r--r--drivers/lguest/core.c1
-rw-r--r--drivers/lguest/interrupts_and_traps.c24
-rw-r--r--drivers/lguest/x86/core.c4
-rw-r--r--drivers/md/bitmap.c2
-rw-r--r--drivers/md/dm-table.c29
-rw-r--r--drivers/media/common/saa7146_fops.c2
-rw-r--r--drivers/media/common/saa7146_video.c19
-rw-r--r--drivers/media/common/tuners/Kconfig16
-rw-r--r--drivers/media/common/tuners/Makefile1
-rw-r--r--drivers/media/common/tuners/mt20xx.c3
-rw-r--r--drivers/media/common/tuners/mxl5007t.c1030
-rw-r--r--drivers/media/common/tuners/mxl5007t.h104
-rw-r--r--drivers/media/common/tuners/tda9887.c2
-rw-r--r--drivers/media/common/tuners/tuner-simple.c2
-rw-r--r--drivers/media/dvb/bt8xx/Kconfig2
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig10
-rw-r--r--drivers/media/dvb/dvb-usb/Makefile3
-rw-r--r--drivers/media/dvb/dvb-usb/anysee.c2
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-ids.h1
-rw-r--r--drivers/media/dvb/dvb-usb/dw2102.c425
-rw-r--r--drivers/media/dvb/dvb-usb/dw2102.h9
-rw-r--r--drivers/media/dvb/frontends/Kconfig38
-rw-r--r--drivers/media/dvb/frontends/Makefile1
-rw-r--r--drivers/media/dvb/frontends/drx397xD.c1504
-rw-r--r--drivers/media/dvb/frontends/drx397xD.h130
-rw-r--r--drivers/media/dvb/frontends/drx397xD_fw.h40
-rw-r--r--drivers/media/dvb/frontends/z0194a.h97
-rw-r--r--drivers/media/dvb/siano/smscoreapi.c14
-rw-r--r--drivers/media/dvb/siano/smsdvb.c4
-rw-r--r--drivers/media/dvb/ttpci/Kconfig4
-rw-r--r--drivers/media/dvb/ttusb-dec/Kconfig2
-rw-r--r--drivers/media/radio/dsbr100.c18
-rw-r--r--drivers/media/radio/miropcm20-radio.c3
-rw-r--r--drivers/media/radio/radio-aimslab.c14
-rw-r--r--drivers/media/radio/radio-aztech.c14
-rw-r--r--drivers/media/radio/radio-cadet.c14
-rw-r--r--drivers/media/radio/radio-gemtek-pci.c13
-rw-r--r--drivers/media/radio/radio-gemtek.c13
-rw-r--r--drivers/media/radio/radio-maestro.c12
-rw-r--r--drivers/media/radio/radio-maxiradio.c15
-rw-r--r--drivers/media/radio/radio-rtrack2.c14
-rw-r--r--drivers/media/radio/radio-sf16fmi.c14
-rw-r--r--drivers/media/radio/radio-sf16fmr2.c14
-rw-r--r--drivers/media/radio/radio-si470x.c22
-rw-r--r--drivers/media/radio/radio-terratec.c14
-rw-r--r--drivers/media/radio/radio-trust.c14
-rw-r--r--drivers/media/radio/radio-typhoon.c14
-rw-r--r--drivers/media/radio/radio-zoltrix.c14
-rw-r--r--drivers/media/video/Kconfig19
-rw-r--r--drivers/media/video/Makefile3
-rw-r--r--drivers/media/video/arv.c1
-rw-r--r--drivers/media/video/au0828/Kconfig1
-rw-r--r--drivers/media/video/au0828/au0828-cards.c12
-rw-r--r--drivers/media/video/au0828/au0828-cards.h1
-rw-r--r--drivers/media/video/au0828/au0828-dvb.c15
-rw-r--r--drivers/media/video/bt8xx/Kconfig2
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c58
-rw-r--r--drivers/media/video/bt8xx/bttv-risc.c1
-rw-r--r--drivers/media/video/bt8xx/bttv-vbi.c1
-rw-r--r--drivers/media/video/bw-qcam.c3
-rw-r--r--drivers/media/video/c-qcam.c3
-rw-r--r--drivers/media/video/cafe_ccic.c26
-rw-r--r--drivers/media/video/compat_ioctl32.c2
-rw-r--r--drivers/media/video/cpia.c2
-rw-r--r--drivers/media/video/cpia.h1
-rw-r--r--drivers/media/video/cpia2/cpia2_core.c1
-rw-r--r--drivers/media/video/cpia2/cpia2_v4l.c5
-rw-r--r--drivers/media/video/cs5345.c2
-rw-r--r--drivers/media/video/cs53l32a.c2
-rw-r--r--drivers/media/video/cx18/Kconfig2
-rw-r--r--drivers/media/video/cx18/cx18-av-audio.c111
-rw-r--r--drivers/media/video/cx18/cx18-driver.h1
-rw-r--r--drivers/media/video/cx18/cx18-firmware.c54
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c92
-rw-r--r--drivers/media/video/cx18/cx18-streams.c5
-rw-r--r--drivers/media/video/cx23885/Kconfig2
-rw-r--r--drivers/media/video/cx23885/cx23885-417.c19
-rw-r--r--drivers/media/video/cx23885/cx23885-cards.c54
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c147
-rw-r--r--drivers/media/video/cx23885/cx23885-video.c19
-rw-r--r--drivers/media/video/cx25840/Kconfig2
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c2
-rw-r--r--drivers/media/video/cx25840/cx25840-core.h2
-rw-r--r--drivers/media/video/cx88/Kconfig3
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c15
-rw-r--r--drivers/media/video/cx88/cx88-cards.c2
-rw-r--r--drivers/media/video/cx88/cx88-core.c3
-rw-r--r--drivers/media/video/cx88/cx88-video.c37
-rw-r--r--drivers/media/video/cx88/cx88.h4
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c977
-rw-r--r--drivers/media/video/em28xx/em28xx-dvb.c13
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c61
-rw-r--r--drivers/media/video/em28xx/em28xx.h49
-rw-r--r--drivers/media/video/et61x251/et61x251_core.c5
-rw-r--r--drivers/media/video/gspca/conex.c9
-rw-r--r--drivers/media/video/gspca/etoms.c30
-rw-r--r--drivers/media/video/gspca/gspca.c43
-rw-r--r--drivers/media/video/gspca/mars.c9
-rw-r--r--drivers/media/video/gspca/ov519.c33
-rw-r--r--drivers/media/video/gspca/pac207.c29
-rw-r--r--drivers/media/video/gspca/pac7311.c22
-rw-r--r--drivers/media/video/gspca/sonixb.c484
-rw-r--r--drivers/media/video/gspca/sonixj.c492
-rw-r--r--drivers/media/video/gspca/spca500.c139
-rw-r--r--drivers/media/video/gspca/spca501.c75
-rw-r--r--drivers/media/video/gspca/spca505.c140
-rw-r--r--drivers/media/video/gspca/spca506.c121
-rw-r--r--drivers/media/video/gspca/spca508.c164
-rw-r--r--drivers/media/video/gspca/spca561.c62
-rw-r--r--drivers/media/video/gspca/stk014.c9
-rw-r--r--drivers/media/video/gspca/sunplus.c355
-rw-r--r--drivers/media/video/gspca/t613.c26
-rw-r--r--drivers/media/video/gspca/tv8532.c17
-rw-r--r--drivers/media/video/gspca/vc032x.c44
-rw-r--r--drivers/media/video/gspca/zc3xx.c486
-rw-r--r--drivers/media/video/ivtv/Kconfig2
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c5
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h1
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c130
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c7
-rw-r--r--drivers/media/video/m52790.c2
-rw-r--r--drivers/media/video/meye.c19
-rw-r--r--drivers/media/video/msp3400-driver.c2
-rw-r--r--drivers/media/video/msp3400-kthreads.c1
-rw-r--r--drivers/media/video/mt9m001.c2
-rw-r--r--drivers/media/video/ov511.c38
-rw-r--r--drivers/media/video/ov511.h1
-rw-r--r--drivers/media/video/planb.c2309
-rw-r--r--drivers/media/video/planb.h232
-rw-r--r--drivers/media/video/pms.c3
-rw-r--r--drivers/media/video/pvrusb2/Kconfig2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-context.h4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-devattr.c11
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-devattr.h26
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-fx2-cmd.h2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c9
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-core.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c6
-rw-r--r--drivers/media/video/pwc/pwc-if.c16
-rw-r--r--drivers/media/video/pwc/pwc.h2
-rw-r--r--drivers/media/video/s2255drv.c130
-rw-r--r--drivers/media/video/saa5246a.c3
-rw-r--r--drivers/media/video/saa5249.c3
-rw-r--r--drivers/media/video/saa7134/Kconfig2
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c3
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c16
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c54
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c98
-rw-r--r--drivers/media/video/saa7134/saa7134.h7
-rw-r--r--drivers/media/video/saa717x.c1
-rw-r--r--drivers/media/video/saa7196.h117
-rw-r--r--drivers/media/video/se401.c2
-rw-r--r--drivers/media/video/se401.h1
-rw-r--r--drivers/media/video/sh_mobile_ceu_camera.c1
-rw-r--r--drivers/media/video/sn9c102/sn9c102.h1
-rw-r--r--drivers/media/video/sn9c102/sn9c102_core.c62
-rw-r--r--drivers/media/video/soc_camera.c68
-rw-r--r--drivers/media/video/stk-webcam.c69
-rw-r--r--drivers/media/video/stradis.c2
-rw-r--r--drivers/media/video/stv680.c52
-rw-r--r--drivers/media/video/tda7432.c3
-rw-r--r--drivers/media/video/tda9875.c2
-rw-r--r--drivers/media/video/tlv320aic23b.c2
-rw-r--r--drivers/media/video/tuner-core.c1
-rw-r--r--drivers/media/video/tveeprom.c122
-rw-r--r--drivers/media/video/tvp5150.c2
-rw-r--r--drivers/media/video/usbvideo/usbvideo.c4
-rw-r--r--drivers/media/video/usbvideo/usbvideo.h1
-rw-r--r--drivers/media/video/usbvideo/vicam.c3
-rw-r--r--drivers/media/video/usbvision/usbvision-core.c2
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c113
-rw-r--r--drivers/media/video/uvc/uvc_ctrl.c15
-rw-r--r--drivers/media/video/uvc/uvc_driver.c4
-rw-r--r--drivers/media/video/uvc/uvc_v4l2.c1
-rw-r--r--drivers/media/video/v4l1-compat.c1
-rw-r--r--drivers/media/video/v4l2-common.c2
-rw-r--r--drivers/media/video/v4l2-dev.c422
-rw-r--r--drivers/media/video/v4l2-ioctl.c1875
-rw-r--r--drivers/media/video/videobuf-dma-contig.c8
-rw-r--r--drivers/media/video/videobuf-vmalloc.c2
-rw-r--r--drivers/media/video/videodev.c2262
-rw-r--r--drivers/media/video/vino.c4
-rw-r--r--drivers/media/video/vivi.c18
-rw-r--r--drivers/media/video/vp27smpx.c2
-rw-r--r--drivers/media/video/w9966.c5
-rw-r--r--drivers/media/video/w9968cf.c5
-rw-r--r--drivers/media/video/w9968cf.h2
-rw-r--r--drivers/media/video/wm8739.c2
-rw-r--r--drivers/media/video/wm8775.c2
-rw-r--r--drivers/media/video/zc0301/zc0301.h1
-rw-r--r--drivers/media/video/zc0301/zc0301_core.c2
-rw-r--r--drivers/media/video/zoran_card.c42
-rw-r--r--drivers/media/video/zoran_card.h2
-rw-r--r--drivers/media/video/zoran_driver.c7
-rw-r--r--drivers/media/video/zr364xx.c18
-rw-r--r--drivers/mfd/mfd-core.c32
-rw-r--r--drivers/mfd/tc6393xb.c8
-rw-r--r--drivers/misc/Kconfig25
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/sgi-gru/Makefile3
-rw-r--r--drivers/misc/sgi-gru/gru.h67
-rw-r--r--drivers/misc/sgi-gru/gru_instructions.h669
-rw-r--r--drivers/misc/sgi-gru/grufault.c633
-rw-r--r--drivers/misc/sgi-gru/grufile.c485
-rw-r--r--drivers/misc/sgi-gru/gruhandles.h663
-rw-r--r--drivers/misc/sgi-gru/grukservices.c679
-rw-r--r--drivers/misc/sgi-gru/grukservices.h134
-rw-r--r--drivers/misc/sgi-gru/grulib.h97
-rw-r--r--drivers/misc/sgi-gru/grumain.c802
-rw-r--r--drivers/misc/sgi-gru/gruprocfs.c336
-rw-r--r--drivers/misc/sgi-gru/grutables.h609
-rw-r--r--drivers/misc/sgi-gru/grutlbpurge.c372
-rw-r--r--drivers/misc/sgi-xp/Makefile10
-rw-r--r--drivers/misc/sgi-xp/xp.h225
-rw-r--r--drivers/misc/sgi-xp/xp_main.c131
-rw-r--r--drivers/misc/sgi-xp/xp_sn2.c146
-rw-r--r--drivers/misc/sgi-xp/xp_uv.c72
-rw-r--r--drivers/misc/sgi-xp/xpc.h1200
-rw-r--r--drivers/misc/sgi-xp/xpc_channel.c1585
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c977
-rw-r--r--drivers/misc/sgi-xp/xpc_partition.c928
-rw-r--r--drivers/misc/sgi-xp/xpc_sn2.c2404
-rw-r--r--drivers/misc/sgi-xp/xpc_uv.c1443
-rw-r--r--drivers/misc/sgi-xp/xpnet.c277
-rw-r--r--drivers/mmc/card/block.c17
-rw-r--r--drivers/mmc/card/mmc_test.c85
-rw-r--r--drivers/mmc/core/core.c5
-rw-r--r--drivers/mmc/host/au1xmmc.c8
-rw-r--r--drivers/mmc/host/sdhci-pci.c3
-rw-r--r--drivers/mmc/host/sdhci.c15
-rw-r--r--drivers/mmc/host/sdhci.h2
-rw-r--r--drivers/mtd/chips/jedec_probe.c2
-rw-r--r--drivers/mtd/devices/mtd_dataflash.c130
-rw-r--r--drivers/mtd/mtdsuper.c33
-rw-r--r--drivers/mtd/nand/Kconfig13
-rw-r--r--drivers/mtd/nand/bf5xx_nand.c93
-rw-r--r--drivers/mtd/nand/diskonchip.c30
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c2
-rw-r--r--drivers/mtd/nand/nandsim.c66
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/bfin_mac.c111
-rw-r--r--drivers/net/cxgb3/t3_hw.c2
-rw-r--r--drivers/net/ehea/ehea_main.c4
-rw-r--r--drivers/net/enc28j60.c6
-rw-r--r--drivers/net/forcedeth.c64
-rw-r--r--drivers/net/ibmveth.c8
-rw-r--r--drivers/net/ifb.c12
-rw-r--r--drivers/net/irda/act200l-sir.c10
-rw-r--r--drivers/net/irda/actisys-sir.c2
-rw-r--r--drivers/net/irda/ali-ircc.c246
-rw-r--r--drivers/net/irda/donauboe.c68
-rw-r--r--drivers/net/irda/girbil-sir.c12
-rw-r--r--drivers/net/irda/irda-usb.c92
-rw-r--r--drivers/net/irda/irtty-sir.c10
-rw-r--r--drivers/net/irda/kingsun-sir.c2
-rw-r--r--drivers/net/irda/litelink-sir.c8
-rw-r--r--drivers/net/irda/ma600-sir.c16
-rw-r--r--drivers/net/irda/mcp2120-sir.c12
-rw-r--r--drivers/net/irda/nsc-ircc.c119
-rw-r--r--drivers/net/irda/nsc-ircc.h3
-rw-r--r--drivers/net/irda/old_belkin-sir.c8
-rw-r--r--drivers/net/irda/sir_dev.c63
-rw-r--r--drivers/net/irda/sir_dongle.c2
-rw-r--r--drivers/net/irda/smsc-ircc2.c120
-rw-r--r--drivers/net/irda/tekram-sir.c10
-rw-r--r--drivers/net/irda/toim3232-sir.c10
-rw-r--r--drivers/net/irda/via-ircc.c80
-rw-r--r--drivers/net/irda/vlsi_ir.c92
-rw-r--r--drivers/net/irda/vlsi_ir.h2
-rw-r--r--drivers/net/irda/w83977af_ir.c62
-rw-r--r--drivers/net/mv643xx_eth.c358
-rw-r--r--drivers/net/ne.c6
-rw-r--r--drivers/net/niu.c2
-rw-r--r--drivers/net/ps3_gelic_wireless.c12
-rw-r--r--drivers/net/s2io.c29
-rw-r--r--drivers/net/sh_eth.c202
-rw-r--r--drivers/net/sh_eth.h426
-rw-r--r--drivers/net/skfp/smt.c13
-rw-r--r--drivers/net/tg3.c67
-rw-r--r--drivers/net/usb/dm9601.c52
-rw-r--r--drivers/net/wd.c2
-rw-r--r--drivers/net/wireless/ath5k/base.c99
-rw-r--r--drivers/net/wireless/ath5k/base.h2
-rw-r--r--drivers/net/wireless/ath5k/hw.c4
-rw-r--r--drivers/net/wireless/b43/main.c3
-rw-r--r--drivers/net/wireless/b43/xmit.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c5
-rw-r--r--drivers/net/wireless/b43legacy/xmit.c2
-rw-r--r--drivers/net/wireless/ipw2100.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-led.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c5
-rw-r--r--drivers/net/wireless/libertas/persistcfg.c30
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c13
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h6
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c7
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00lib.h7
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c29
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c36
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c32
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.h22
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c56
-rw-r--r--drivers/net/wireless/rtl8187.h11
-rw-r--r--drivers/net/wireless/rtl8187_dev.c93
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c1
-rw-r--r--drivers/of/Kconfig6
-rw-r--r--drivers/of/Makefile1
-rw-r--r--drivers/of/base.c88
-rw-r--r--drivers/of/of_i2c.c64
-rw-r--r--drivers/of/of_spi.c93
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c2
-rw-r--r--drivers/pci/msi.c15
-rw-r--r--drivers/pci/pci-acpi.c7
-rw-r--r--drivers/pci/pci.c10
-rw-r--r--drivers/pci/pcie/aspm.c32
-rw-r--r--drivers/pci/probe.c245
-rw-r--r--drivers/pci/quirks.c13
-rw-r--r--drivers/power/Kconfig7
-rw-r--r--drivers/power/Makefile1
-rw-r--r--drivers/power/olpc_battery.c273
-rw-r--r--drivers/power/power_supply_sysfs.c1
-rw-r--r--drivers/power/tosa_battery.c486
-rw-r--r--drivers/regulator/Kconfig59
-rw-r--r--drivers/regulator/Makefile12
-rw-r--r--drivers/regulator/bq24022.c167
-rw-r--r--drivers/regulator/core.c1903
-rw-r--r--drivers/regulator/fixed.c129
-rw-r--r--drivers/regulator/virtual.c345
-rw-r--r--drivers/rtc/interface.c10
-rw-r--r--drivers/rtc/rtc-dev.c4
-rw-r--r--drivers/s390/block/dasd_alias.c4
-rw-r--r--drivers/s390/block/dasd_devmap.c16
-rw-r--r--drivers/s390/block/dasd_eckd.c147
-rw-r--r--drivers/s390/block/dasd_eckd.h184
-rw-r--r--drivers/s390/block/dasd_int.h1
-rw-r--r--drivers/s390/char/sclp.c6
-rw-r--r--drivers/s390/char/sclp_cmd.c5
-rw-r--r--drivers/s390/char/sclp_config.c13
-rw-r--r--drivers/s390/cio/idset.c8
-rw-r--r--drivers/s390/cio/qdio_main.c2
-rw-r--r--drivers/s390/cio/qdio_perf.c2
-rw-r--r--drivers/s390/cio/qdio_setup.c4
-rw-r--r--drivers/s390/kvm/kvm_virtio.c2
-rw-r--r--drivers/s390/net/qeth_core.h5
-rw-r--r--drivers/s390/net/qeth_core_main.c63
-rw-r--r--drivers/s390/net/qeth_l2_main.c50
-rw-r--r--drivers/s390/net/qeth_l3_main.c51
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c1
-rw-r--r--drivers/serial/8250.c4
-rw-r--r--drivers/serial/Makefile1
-rw-r--r--drivers/serial/cpm_uart/cpm_uart.h11
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c66
-rw-r--r--drivers/serial/sh-sci.c17
-rw-r--r--drivers/serial/sh-sci.h40
-rw-r--r--drivers/serial/v850e_uart.c548
-rw-r--r--drivers/sh/maple/maple.c265
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c22
-rw-r--r--drivers/spi/spi.c139
-rw-r--r--drivers/spi/spi_s3c24xx.c1
-rw-r--r--drivers/usb/gadget/m66592-udc.c2
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/arkfb.c9
-rw-r--r--drivers/video/backlight/hp680_bl.c2
-rw-r--r--drivers/video/backlight/platform_lcd.c4
-rw-r--r--drivers/video/console/sticore.c30
-rw-r--r--drivers/video/gbefb.c50
-rw-r--r--drivers/video/hitfb.c2
-rw-r--r--drivers/video/pvr2fb.c6
-rw-r--r--drivers/video/sh7760fb.c1
-rw-r--r--drivers/video/vt8623fb.c9
-rw-r--r--drivers/watchdog/hpwdt.c2
-rw-r--r--fs/Kconfig.binfmt2
-rw-r--r--fs/afs/mntpt.c2
-rw-r--r--fs/binfmt_elf_fdpic.c45
-rw-r--r--fs/bio-integrity.c1
-rw-r--r--fs/block_dev.c5
-rw-r--r--fs/buffer.c48
-rw-r--r--fs/cifs/cifs_dfs_ref.c2
-rw-r--r--fs/devpts/inode.c16
-rw-r--r--fs/dlm/lock.c4
-rw-r--r--fs/dlm/lowcomms.c4
-rw-r--r--fs/dlm/user.c2
-rw-r--r--fs/dquot.c33
-rw-r--r--fs/ecryptfs/crypto.c30
-rw-r--r--fs/exec.c1
-rw-r--r--fs/ext2/inode.c1
-rw-r--r--fs/ext3/inode.c67
-rw-r--r--fs/ext3/super.c3
-rw-r--r--fs/ext4/inode.c92
-rw-r--r--fs/ext4/super.c3
-rw-r--r--fs/fcntl.c140
-rw-r--r--fs/file.c61
-rw-r--r--fs/jffs2/summary.c40
-rw-r--r--fs/jffs2/summary.h6
-rw-r--r--fs/libfs.c4
-rw-r--r--fs/namei.c17
-rw-r--r--fs/namespace.c16
-rw-r--r--fs/nfs/namespace.c2
-rw-r--r--fs/omfs/bitmap.c6
-rw-r--r--fs/omfs/dir.c2
-rw-r--r--fs/omfs/file.c6
-rw-r--r--fs/open.c56
-rw-r--r--fs/proc/generic.c27
-rw-r--r--fs/reiserfs/super.c16
-rw-r--r--fs/romfs/inode.c37
-rw-r--r--include/acpi/actbl.h1
-rw-r--r--include/asm-arm/arch-s3c2410/spi.h1
-rw-r--r--include/asm-arm/dma-mapping.h2
-rw-r--r--include/asm-arm/plat-s3c/iic.h1
-rw-r--r--include/asm-cris/dma-mapping.h2
-rw-r--r--include/asm-generic/dma-coherent.h32
-rw-r--r--include/asm-generic/gpio.h1
-rw-r--r--include/asm-generic/pgtable-nopmd.h6
-rw-r--r--include/asm-ia64/sn/mspec.h16
-rw-r--r--include/asm-mips/gdb-stub.h215
-rw-r--r--include/asm-mips/kdebug.h14
-rw-r--r--include/asm-mips/kgdb.h44
-rw-r--r--include/asm-mips/pci.h2
-rw-r--r--include/asm-mips/txx9/generic.h14
-rw-r--r--include/asm-mips/txx9/jmr3927.h2
-rw-r--r--include/asm-mips/txx9/pci.h3
-rw-r--r--include/asm-mips/txx9/smsc_fdc37m81x.h2
-rw-r--r--include/asm-mips/txx9/tx3927.h25
-rw-r--r--include/asm-mips/txx9/tx4927.h5
-rw-r--r--include/asm-mips/txx9/tx4927pcic.h8
-rw-r--r--include/asm-mips/txx9/tx4938.h7
-rw-r--r--include/asm-mips/txx9/txx927.h121
-rw-r--r--include/asm-mips/txx9irq.h4
-rw-r--r--include/asm-powerpc/cpm.h3
-rw-r--r--include/asm-powerpc/cpm2.h46
-rw-r--r--include/asm-powerpc/pgtable-4k.h2
-rw-r--r--include/asm-powerpc/pgtable-64k.h2
-rw-r--r--include/asm-powerpc/pgtable-ppc32.h3
-rw-r--r--include/asm-powerpc/pgtable-ppc64.h6
-rw-r--r--include/asm-powerpc/ptrace.h1
-rw-r--r--include/asm-powerpc/signal.h3
-rw-r--r--include/asm-powerpc/smp.h2
-rw-r--r--include/asm-powerpc/syscall.h84
-rw-r--r--include/asm-powerpc/thread_info.h5
-rw-r--r--include/asm-powerpc/topology.h2
-rw-r--r--include/asm-s390/hardirq.h14
-rw-r--r--include/asm-s390/ipl.h3
-rw-r--r--include/asm-s390/schid.h1
-rw-r--r--include/asm-s390/setup.h1
-rw-r--r--include/asm-s390/unistd.h8
-rw-r--r--include/asm-sh/.gitignore3
-rw-r--r--include/asm-sh/adc.h13
-rw-r--r--include/asm-sh/addrspace.h53
-rw-r--r--include/asm-sh/auxvec.h36
-rw-r--r--include/asm-sh/cache.h51
-rw-r--r--include/asm-sh/cacheflush.h81
-rw-r--r--include/asm-sh/clock.h82
-rw-r--r--include/asm-sh/cpu-sh2/cacheflush.h44
-rw-r--r--include/asm-sh/cpu-sh2a/addrspace.h10
-rw-r--r--include/asm-sh/cpu-sh2a/cacheflush.h1
-rw-r--r--include/asm-sh/cpu-sh2a/dma.h1
-rw-r--r--include/asm-sh/cpu-sh2a/mmu_context.h1
-rw-r--r--include/asm-sh/cpu-sh2a/timer.h1
-rw-r--r--include/asm-sh/cpu-sh2a/ubc.h1
-rw-r--r--include/asm-sh/cpu-sh2a/watchdog.h1
-rw-r--r--include/asm-sh/cpu-sh3/addrspace.h19
-rw-r--r--include/asm-sh/cpu-sh3/cacheflush.h70
-rw-r--r--include/asm-sh/cpu-sh3/rtc.h8
-rw-r--r--include/asm-sh/cpu-sh3/sigcontext.h17
-rw-r--r--include/asm-sh/cpu-sh4/cacheflush.h44
-rw-r--r--include/asm-sh/cpu-sh4/dma.h65
-rw-r--r--include/asm-sh/cpu-sh4/freq.h40
-rw-r--r--include/asm-sh/cpu-sh5/timer.h4
-rw-r--r--include/asm-sh/device.h7
-rw-r--r--include/asm-sh/dma-mapping.h192
-rw-r--r--include/asm-sh/dma.h166
-rw-r--r--include/asm-sh/dreamcast/pci.h25
-rw-r--r--include/asm-sh/elf.h193
-rw-r--r--include/asm-sh/freq.h18
-rw-r--r--include/asm-sh/gpio.h19
-rw-r--r--include/asm-sh/hw_irq.h123
-rw-r--r--include/asm-sh/irq.h57
-rw-r--r--include/asm-sh/irqflags_64.h85
-rw-r--r--include/asm-sh/migor.h58
-rw-r--r--include/asm-sh/mmu.h72
-rw-r--r--include/asm-sh/mmu_context.h184
-rw-r--r--include/asm-sh/mmu_context_64.h78
-rw-r--r--include/asm-sh/page.h181
-rw-r--r--include/asm-sh/pgtable_32.h477
-rw-r--r--include/asm-sh/processor.h65
-rw-r--r--include/asm-sh/processor_32.h219
-rw-r--r--include/asm-sh/processor_64.h279
-rw-r--r--include/asm-sh/ptrace.h125
-rw-r--r--include/asm-sh/rtc.h16
-rw-r--r--include/asm-sh/se.h82
-rw-r--r--include/asm-sh/se7343.h82
-rw-r--r--include/asm-sh/se7722.h116
-rw-r--r--include/asm-sh/segment.h6
-rw-r--r--include/asm-sh/serial.h36
-rw-r--r--include/asm-sh/system.h198
-rw-r--r--include/asm-sh/thread_info.h139
-rw-r--r--include/asm-sh/timer.h45
-rw-r--r--include/asm-sh/uaccess.h34
-rw-r--r--include/asm-sh/uaccess_32.h489
-rw-r--r--include/asm-sh/uaccess_64.h285
-rw-r--r--include/asm-sh/ubc.h64
-rw-r--r--include/asm-sh/unistd.h5
-rw-r--r--include/asm-sh/unistd_32.h378
-rw-r--r--include/asm-sh/unistd_64.h417
-rw-r--r--include/asm-sh/watchdog.h107
-rw-r--r--include/asm-sparc/Kbuild1
-rw-r--r--include/asm-sparc/atomic.h8
-rw-r--r--include/asm-sparc/auxio.h8
-rw-r--r--include/asm-sparc/auxio_32.h89
-rw-r--r--include/asm-sparc/bitops.h8
-rw-r--r--include/asm-sparc/btfixup.h208
-rw-r--r--include/asm-sparc/bugs.h24
-rw-r--r--include/asm-sparc/cacheflush.h8
-rw-r--r--include/asm-sparc/checksum.h8
-rw-r--r--include/asm-sparc/cpudata.h8
-rw-r--r--include/asm-sparc/cpudata_32.h27
-rw-r--r--include/asm-sparc/current.h34
-rw-r--r--include/asm-sparc/delay.h8
-rw-r--r--include/asm-sparc/dma-mapping.h8
-rw-r--r--include/asm-sparc/dma.h8
-rw-r--r--include/asm-sparc/dma_32.h288
-rw-r--r--include/asm-sparc/dma_64.h205
-rw-r--r--include/asm-sparc/ebus.h8
-rw-r--r--include/asm-sparc/elf.h8
-rw-r--r--include/asm-sparc/floppy.h8
-rw-r--r--include/asm-sparc/floppy_32.h388
-rw-r--r--include/asm-sparc/futex.h8
-rw-r--r--include/asm-sparc/hardirq.h8
-rw-r--r--include/asm-sparc/head.h8
-rw-r--r--include/asm-sparc/io.h8
-rw-r--r--include/asm-sparc/iommu.h8
-rw-r--r--include/asm-sparc/ipcbuf.h8
-rw-r--r--include/asm-sparc/irq.h8
-rw-r--r--include/asm-sparc/irqflags.h8
-rw-r--r--include/asm-sparc/irqflags_32.h39
-rw-r--r--include/asm-sparc/irqflags_64.h89
-rw-r--r--include/asm-sparc/kdebug.h8
-rw-r--r--include/asm-sparc/mc146818rtc.h8
-rw-r--r--include/asm-sparc/mmu.h8
-rw-r--r--include/asm-sparc/mmu_context.h8
-rw-r--r--include/asm-sparc/module.h8
-rw-r--r--include/asm-sparc/mostek.h8
-rw-r--r--include/asm-sparc/of_platform.h8
-rw-r--r--include/asm-sparc/of_platform_32.h24
-rw-r--r--include/asm-sparc/of_platform_64.h25
-rw-r--r--include/asm-sparc/openprom.h8
-rw-r--r--include/asm-sparc/oplib.h8
-rw-r--r--include/asm-sparc/page.h8
-rw-r--r--include/asm-sparc/pci.h8
-rw-r--r--include/asm-sparc/percpu.h8
-rw-r--r--include/asm-sparc/pgalloc.h8
-rw-r--r--include/asm-sparc/pgtable.h8
-rw-r--r--include/asm-sparc/pgtable_32.h480
-rw-r--r--include/asm-sparc/posix_types.h8
-rw-r--r--include/asm-sparc/processor.h8
-rw-r--r--include/asm-sparc/processor_32.h128
-rw-r--r--include/asm-sparc/processor_64.h237
-rw-r--r--include/asm-sparc/ptrace.h8
-rw-r--r--include/asm-sparc/ptrace_32.h175
-rw-r--r--include/asm-sparc/ptrace_64.h346
-rw-r--r--include/asm-sparc/reg.h8
-rw-r--r--include/asm-sparc/reg_32.h79
-rw-r--r--include/asm-sparc/reg_64.h56
-rw-r--r--include/asm-sparc/sbus.h8
-rw-r--r--include/asm-sparc/scatterlist.h8
-rw-r--r--include/asm-sparc/sections.h8
-rw-r--r--include/asm-sparc/sfp-machine.h8
-rw-r--r--include/asm-sparc/shmparam.h8
-rw-r--r--include/asm-sparc/sigcontext.h8
-rw-r--r--include/asm-sparc/siginfo.h8
-rw-r--r--include/asm-sparc/signal.h8
-rw-r--r--include/asm-sparc/smp.h8
-rw-r--r--include/asm-sparc/spinlock.h8
-rw-r--r--include/asm-sparc/stat.h8
-rw-r--r--include/asm-sparc/statfs.h8
-rw-r--r--include/asm-sparc/string.h8
-rw-r--r--include/asm-sparc/sunbpp.h80
-rw-r--r--include/asm-sparc/system.h8
-rw-r--r--include/asm-sparc/thread_info.h8
-rw-r--r--include/asm-sparc/thread_info_32.h153
-rw-r--r--include/asm-sparc/thread_info_64.h279
-rw-r--r--include/asm-sparc/timer.h8
-rw-r--r--include/asm-sparc/timex.h8
-rw-r--r--include/asm-sparc/timex_32.h15
-rw-r--r--include/asm-sparc/timex_64.h19
-rw-r--r--include/asm-sparc/tlb.h8
-rw-r--r--include/asm-sparc/tlbflush.h8
-rw-r--r--include/asm-sparc/topology.h8
-rw-r--r--include/asm-sparc/uaccess.h8
-rw-r--r--include/asm-sparc/unistd.h8
-rw-r--r--include/asm-sparc/utrap.h51
-rw-r--r--include/asm-sparc/vaddrs.h64
-rw-r--r--include/asm-sparc/xor.h8
-rw-r--r--include/asm-sparc/xor_32.h269
-rw-r--r--include/asm-sparc/xor_64.h70
-rw-r--r--include/asm-sparc64/Kbuild1
-rw-r--r--include/asm-sparc64/agp.h1
-rw-r--r--include/asm-sparc64/apb.h1
-rw-r--r--include/asm-sparc64/asi.h1
-rw-r--r--include/asm-sparc64/atomic.h1
-rw-r--r--include/asm-sparc64/auxio.h1
-rw-r--r--include/asm-sparc64/auxvec.h1
-rw-r--r--include/asm-sparc64/backoff.h1
-rw-r--r--include/asm-sparc64/bbc.h1
-rw-r--r--include/asm-sparc64/bitops.h1
-rw-r--r--include/asm-sparc64/bpp.h1
-rw-r--r--include/asm-sparc64/bug.h1
-rw-r--r--include/asm-sparc64/bugs.h1
-rw-r--r--include/asm-sparc64/byteorder.h1
-rw-r--r--include/asm-sparc64/cache.h1
-rw-r--r--include/asm-sparc64/cacheflush.h1
-rw-r--r--include/asm-sparc64/chafsr.h1
-rw-r--r--include/asm-sparc64/checksum.h1
-rw-r--r--include/asm-sparc64/chmctrl.h1
-rw-r--r--include/asm-sparc64/cmt.h1
-rw-r--r--include/asm-sparc64/compat.h1
-rw-r--r--include/asm-sparc64/compat_signal.h1
-rw-r--r--include/asm-sparc64/cpudata.h1
-rw-r--r--include/asm-sparc64/cputime.h1
-rw-r--r--include/asm-sparc64/current.h1
-rw-r--r--include/asm-sparc64/dcr.h1
-rw-r--r--include/asm-sparc64/dcu.h1
-rw-r--r--include/asm-sparc64/delay.h1
-rw-r--r--include/asm-sparc64/device.h1
-rw-r--r--include/asm-sparc64/display7seg.h1
-rw-r--r--include/asm-sparc64/div64.h1
-rw-r--r--include/asm-sparc64/dma-mapping.h1
-rw-r--r--include/asm-sparc64/dma.h1
-rw-r--r--include/asm-sparc64/ebus.h1
-rw-r--r--include/asm-sparc64/elf.h1
-rw-r--r--include/asm-sparc64/emergency-restart.h1
-rw-r--r--include/asm-sparc64/envctrl.h1
-rw-r--r--include/asm-sparc64/errno.h1
-rw-r--r--include/asm-sparc64/estate.h1
-rw-r--r--include/asm-sparc64/fb.h1
-rw-r--r--include/asm-sparc64/fbio.h1
-rw-r--r--include/asm-sparc64/fcntl.h1
-rw-r--r--include/asm-sparc64/fhc.h1
-rw-r--r--include/asm-sparc64/floppy.h1
-rw-r--r--include/asm-sparc64/fpumacro.h1
-rw-r--r--include/asm-sparc64/futex.h1
-rw-r--r--include/asm-sparc64/hardirq.h1
-rw-r--r--include/asm-sparc64/head.h1
-rw-r--r--include/asm-sparc64/hugetlb.h1
-rw-r--r--include/asm-sparc64/hvtramp.h1
-rw-r--r--include/asm-sparc64/hw_irq.h1
-rw-r--r--include/asm-sparc64/hypervisor.h1
-rw-r--r--include/asm-sparc64/ide.h1
-rw-r--r--include/asm-sparc64/idprom.h1
-rw-r--r--include/asm-sparc64/intr_queue.h1
-rw-r--r--include/asm-sparc64/io.h1
-rw-r--r--include/asm-sparc64/ioctl.h1
-rw-r--r--include/asm-sparc64/ioctls.h1
-rw-r--r--include/asm-sparc64/iommu.h1
-rw-r--r--include/asm-sparc64/ipcbuf.h1
-rw-r--r--include/asm-sparc64/irq.h1
-rw-r--r--include/asm-sparc64/irq_regs.h1
-rw-r--r--include/asm-sparc64/irqflags.h1
-rw-r--r--include/asm-sparc64/kdebug.h1
-rw-r--r--include/asm-sparc64/kgdb.h1
-rw-r--r--include/asm-sparc64/kmap_types.h1
-rw-r--r--include/asm-sparc64/kprobes.h1
-rw-r--r--include/asm-sparc64/ldc.h1
-rw-r--r--include/asm-sparc64/linkage.h1
-rw-r--r--include/asm-sparc64/lmb.h1
-rw-r--r--include/asm-sparc64/local.h1
-rw-r--r--include/asm-sparc64/lsu.h1
-rw-r--r--include/asm-sparc64/mc146818rtc.h1
-rw-r--r--include/asm-sparc64/mdesc.h1
-rw-r--r--include/asm-sparc64/mman.h1
-rw-r--r--include/asm-sparc64/mmu.h1
-rw-r--r--include/asm-sparc64/mmu_context.h1
-rw-r--r--include/asm-sparc64/mmzone.h1
-rw-r--r--include/asm-sparc64/module.h1
-rw-r--r--include/asm-sparc64/mostek.h1
-rw-r--r--include/asm-sparc64/msgbuf.h1
-rw-r--r--include/asm-sparc64/mutex.h1
-rw-r--r--include/asm-sparc64/ns87303.h1
-rw-r--r--include/asm-sparc64/of_device.h1
-rw-r--r--include/asm-sparc64/of_platform.h1
-rw-r--r--include/asm-sparc64/openprom.h1
-rw-r--r--include/asm-sparc64/openpromio.h1
-rw-r--r--include/asm-sparc64/oplib.h1
-rw-r--r--include/asm-sparc64/page.h1
-rw-r--r--include/asm-sparc64/param.h1
-rw-r--r--include/asm-sparc64/parport.h1
-rw-r--r--include/asm-sparc64/pci.h1
-rw-r--r--include/asm-sparc64/percpu.h1
-rw-r--r--include/asm-sparc64/perfctr.h1
-rw-r--r--include/asm-sparc64/pgalloc.h1
-rw-r--r--include/asm-sparc64/pgtable.h1
-rw-r--r--include/asm-sparc64/pil.h1
-rw-r--r--include/asm-sparc64/poll.h1
-rw-r--r--include/asm-sparc64/posix_types.h1
-rw-r--r--include/asm-sparc64/processor.h1
-rw-r--r--include/asm-sparc64/prom.h1
-rw-r--r--include/asm-sparc64/psrcompat.h1
-rw-r--r--include/asm-sparc64/pstate.h1
-rw-r--r--include/asm-sparc64/ptrace.h1
-rw-r--r--include/asm-sparc64/reboot.h1
-rw-r--r--include/asm-sparc64/reg.h1
-rw-r--r--include/asm-sparc64/resource.h1
-rw-r--r--include/asm-sparc64/rtc.h1
-rw-r--r--include/asm-sparc64/rwsem-const.h1
-rw-r--r--include/asm-sparc64/rwsem.h1
-rw-r--r--include/asm-sparc64/sbus.h1
-rw-r--r--include/asm-sparc64/scatterlist.h1
-rw-r--r--include/asm-sparc64/scratchpad.h1
-rw-r--r--include/asm-sparc64/seccomp.h1
-rw-r--r--include/asm-sparc64/sections.h1
-rw-r--r--include/asm-sparc64/sembuf.h1
-rw-r--r--include/asm-sparc64/setup.h1
-rw-r--r--include/asm-sparc64/sfafsr.h1
-rw-r--r--include/asm-sparc64/sfp-machine.h1
-rw-r--r--include/asm-sparc64/shmbuf.h1
-rw-r--r--include/asm-sparc64/shmparam.h1
-rw-r--r--include/asm-sparc64/sigcontext.h1
-rw-r--r--include/asm-sparc64/siginfo.h1
-rw-r--r--include/asm-sparc64/signal.h1
-rw-r--r--include/asm-sparc64/smp.h1
-rw-r--r--include/asm-sparc64/socket.h1
-rw-r--r--include/asm-sparc64/sockios.h1
-rw-r--r--include/asm-sparc64/sparsemem.h1
-rw-r--r--include/asm-sparc64/spinlock.h1
-rw-r--r--include/asm-sparc64/spinlock_types.h1
-rw-r--r--include/asm-sparc64/spitfire.h1
-rw-r--r--include/asm-sparc64/sstate.h1
-rw-r--r--include/asm-sparc64/stacktrace.h1
-rw-r--r--include/asm-sparc64/starfire.h1
-rw-r--r--include/asm-sparc64/stat.h1
-rw-r--r--include/asm-sparc64/statfs.h1
-rw-r--r--include/asm-sparc64/string.h1
-rw-r--r--include/asm-sparc64/sunbpp.h1
-rw-r--r--include/asm-sparc64/syscalls.h1
-rw-r--r--include/asm-sparc64/system.h1
-rw-r--r--include/asm-sparc64/termbits.h1
-rw-r--r--include/asm-sparc64/termios.h1
-rw-r--r--include/asm-sparc64/thread_info.h1
-rw-r--r--include/asm-sparc64/timer.h1
-rw-r--r--include/asm-sparc64/timex.h1
-rw-r--r--include/asm-sparc64/tlb.h1
-rw-r--r--include/asm-sparc64/tlbflush.h1
-rw-r--r--include/asm-sparc64/topology.h1
-rw-r--r--include/asm-sparc64/tsb.h1
-rw-r--r--include/asm-sparc64/ttable.h1
-rw-r--r--include/asm-sparc64/types.h1
-rw-r--r--include/asm-sparc64/uaccess.h1
-rw-r--r--include/asm-sparc64/uctx.h1
-rw-r--r--include/asm-sparc64/unaligned.h1
-rw-r--r--include/asm-sparc64/unistd.h1
-rw-r--r--include/asm-sparc64/upa.h1
-rw-r--r--include/asm-sparc64/user.h1
-rw-r--r--include/asm-sparc64/utrap.h1
-rw-r--r--include/asm-sparc64/vga.h1
-rw-r--r--include/asm-sparc64/vio.h1
-rw-r--r--include/asm-sparc64/visasm.h1
-rw-r--r--include/asm-sparc64/watchdog.h1
-rw-r--r--include/asm-sparc64/xor.h1
-rw-r--r--include/asm-x86/dma-mapping.h22
-rw-r--r--include/asm-x86/iommu.h2
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/blkdev.h1
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/connector.h3
-rw-r--r--include/linux/cpufreq.h1
-rw-r--r--include/linux/cpumask.h63
-rw-r--r--include/linux/file.h3
-rw-r--r--include/linux/fs.h44
-rw-r--r--include/linux/ioport.h4
-rw-r--r--include/linux/ip_vs.h245
-rw-r--r--include/linux/kallsyms.h3
-rw-r--r--include/linux/kernel.h6
-rw-r--r--include/linux/maple.h8
-rw-r--r--include/linux/mfd/core.h30
-rw-r--r--include/linux/mm.h6
-rw-r--r--include/linux/mm_types.h4
-rw-r--r--include/linux/mmu_notifier.h279
-rw-r--r--include/linux/mount.h3
-rw-r--r--include/linux/mtd/mtd.h6
-rw-r--r--include/linux/mtd/nand.h4
-rw-r--r--include/linux/netdevice.h86
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h3
-rw-r--r--include/linux/of.h1
-rw-r--r--include/linux/of_spi.h18
-rw-r--r--include/linux/page-flags.h3
-rw-r--r--include/linux/pagemap.h24
-rw-r--r--include/linux/pci-aspm.h5
-rw-r--r--include/linux/pci.h2
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/power_supply.h1
-rw-r--r--include/linux/quotaops.h2
-rw-r--r--include/linux/rculist.h28
-rw-r--r--include/linux/regulator/bq24022.h21
-rw-r--r--include/linux/regulator/consumer.h284
-rw-r--r--include/linux/regulator/driver.h99
-rw-r--r--include/linux/regulator/fixed.h22
-rw-r--r--include/linux/regulator/machine.h104
-rw-r--r--include/linux/rfkill.h8
-rw-r--r--include/linux/rmap.h8
-rw-r--r--include/linux/serio.h3
-rw-r--r--include/linux/skbuff.h6
-rw-r--r--include/linux/snmp.h2
-rw-r--r--include/linux/spi/spi.h12
-rw-r--r--include/linux/stop_machine.h50
-rw-r--r--include/linux/videodev.h15
-rw-r--r--include/linux/videodev2.h386
-rw-r--r--include/linux/videotext.h16
-rw-r--r--include/media/audiochip.h26
-rw-r--r--include/media/saa7146_vv.h1
-rw-r--r--include/media/tveeprom.h7
-rw-r--r--include/media/v4l2-chip-ident.h7
-rw-r--r--include/media/v4l2-common.h31
-rw-r--r--include/media/v4l2-dev.h325
-rw-r--r--include/media/v4l2-ioctl.h301
-rw-r--r--include/net/ip_vs.h253
-rw-r--r--include/net/mac80211.h7
-rw-r--r--include/sound/soc-dapm.h3
-rw-r--r--init/Kconfig6
-rw-r--r--init/calibrate.c2
-rw-r--r--init/main.c5
-rw-r--r--kernel/Makefile1
-rw-r--r--kernel/audit.c13
-rw-r--r--kernel/auditfilter.c10
-rw-r--r--kernel/auditsc.c4
-rw-r--r--kernel/cgroup.c39
-rw-r--r--kernel/cpu.c41
-rw-r--r--kernel/cpuset.c71
-rw-r--r--kernel/dma-coherent.c154
-rw-r--r--kernel/fork.c3
-rw-r--r--kernel/kgdb.c94
-rw-r--r--kernel/marker.c12
-rw-r--r--kernel/module.c33
-rw-r--r--kernel/printk.c8
-rw-r--r--kernel/rcuclassic.c4
-rw-r--r--kernel/resource.c2
-rw-r--r--kernel/sched.c22
-rw-r--r--kernel/stop_machine.c288
-rw-r--r--kernel/time/tick-common.c8
-rw-r--r--kernel/trace/ftrace.c6
-rw-r--r--kernel/trace/trace_sysprof.c4
-rw-r--r--kernel/workqueue.c13
-rw-r--r--lib/Kconfig.kgdb11
-rw-r--r--lib/random32.c48
-rw-r--r--lib/ratelimit.c3
-rw-r--r--lib/smp_processor_id.c5
-rw-r--r--mm/Kconfig3
-rw-r--r--mm/Makefile1
-rw-r--r--mm/filemap.c16
-rw-r--r--mm/filemap_xip.c3
-rw-r--r--mm/fremap.c3
-rw-r--r--mm/hugetlb.c6
-rw-r--r--mm/madvise.c4
-rw-r--r--mm/memcontrol.c3
-rw-r--r--mm/memory.c60
-rw-r--r--mm/mmap.c160
-rw-r--r--mm/mmu_notifier.c277
-rw-r--r--mm/mprotect.c3
-rw-r--r--mm/mremap.c6
-rw-r--r--mm/page_alloc.c21
-rw-r--r--mm/rmap.c16
-rw-r--r--mm/shmem.c3
-rw-r--r--mm/swap.c7
-rw-r--r--mm/swapfile.c4
-rw-r--r--mm/vmscan.c4
-rw-r--r--net/Kconfig7
-rw-r--r--net/atm/mpc.c22
-rw-r--r--net/bridge/br_device.c9
-rw-r--r--net/bridge/br_if.c3
-rw-r--r--net/bridge/br_netfilter.c63
-rw-r--r--net/bridge/br_private.h6
-rw-r--r--net/core/dev.c5
-rw-r--r--net/core/netpoll.c1
-rw-r--r--net/core/pktgen.c7
-rw-r--r--net/core/skbuff.c3
-rw-r--r--net/dccp/dccp.h2
-rw-r--r--net/dccp/ipv4.c9
-rw-r--r--net/dccp/ipv6.c16
-rw-r--r--net/dccp/output.c53
-rw-r--r--net/dccp/timer.c20
-rw-r--r--net/ipv4/ipcomp.c4
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c5
-rw-r--r--net/ipv4/netfilter/ipt_recent.c2
-rw-r--r--net/ipv4/proc.c2
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/tcp_ipv4.c14
-rw-r--r--net/ipv6/datagram.c2
-rw-r--r--net/ipv6/ip6_output.c4
-rw-r--r--net/ipv6/ipcomp6.c4
-rw-r--r--net/ipv6/proc.c1
-rw-r--r--net/ipv6/tcp_ipv6.c33
-rw-r--r--net/mac80211/cfg.c103
-rw-r--r--net/mac80211/main.c12
-rw-r--r--net/mac80211/mlme.c9
-rw-r--r--net/mac80211/tx.c55
-rw-r--r--net/mac80211/wep.c4
-rw-r--r--net/mac80211/wme.c3
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c29
-rw-r--r--net/netfilter/xt_hashlimit.c4
-rw-r--r--net/rfkill/rfkill.c62
-rw-r--r--net/sched/sch_api.c57
-rw-r--r--net/sched/sch_generic.c14
-rw-r--r--net/sched/sch_teql.c9
-rw-r--r--net/sunrpc/svc.c3
-rw-r--r--net/wireless/nl80211.c275
-rw-r--r--scripts/genksyms/genksyms.c2
-rw-r--r--scripts/genksyms/lex.c_shipped133
-rw-r--r--scripts/genksyms/lex.l2
-rw-r--r--scripts/genksyms/parse.c_shipped144
-rw-r--r--scripts/genksyms/parse.y2
-rw-r--r--scripts/kconfig/lex.zconf.c_shipped86
-rw-r--r--scripts/kconfig/zconf.l1
-rw-r--r--scripts/mod/modpost.c2
-rwxr-xr-xscripts/ver_linux1
-rw-r--r--security/selinux/hooks.c6
-rw-r--r--sound/i2c/other/tea575x-tuner.c2
-rw-r--r--sound/sh/aica.c2
-rw-r--r--sound/soc/fsl/fsl_dma.c7
-rw-r--r--sound/soc/fsl/fsl_ssi.c74
-rw-r--r--sound/soc/pxa/poodle.c8
-rw-r--r--sound/soc/pxa/tosa.c1
-rw-r--r--sound/soc/soc-dapm.c1
2045 files changed, 62361 insertions, 41162 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-regulator b/Documentation/ABI/testing/sysfs-class-regulator
new file mode 100644
index 000000000000..79a4a75b2d2c
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-regulator
@@ -0,0 +1,315 @@
1What: /sys/class/regulator/.../state
2Date: April 2008
3KernelVersion: 2.6.26
4Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
5Description:
6 Each regulator directory will contain a field called
7 state. This holds the regulator output state.
8
9 This will be one of the following strings:
10
11 'enabled'
12 'disabled'
13 'unknown'
14
15 'enabled' means the regulator output is ON and is supplying
16 power to the system.
17
18 'disabled' means the regulator output is OFF and is not
19 supplying power to the system..
20
21 'unknown' means software cannot determine the state.
22
23 NOTE: this field can be used in conjunction with microvolts
24 and microamps to determine regulator output levels.
25
26
27What: /sys/class/regulator/.../type
28Date: April 2008
29KernelVersion: 2.6.26
30Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
31Description:
32 Each regulator directory will contain a field called
33 type. This holds the regulator type.
34
35 This will be one of the following strings:
36
37 'voltage'
38 'current'
39 'unknown'
40
41 'voltage' means the regulator output voltage can be controlled
42 by software.
43
44 'current' means the regulator output current limit can be
45 controlled by software.
46
47 'unknown' means software cannot control either voltage or
48 current limit.
49
50
51What: /sys/class/regulator/.../microvolts
52Date: April 2008
53KernelVersion: 2.6.26
54Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
55Description:
56 Each regulator directory will contain a field called
57 microvolts. This holds the regulator output voltage setting
58 measured in microvolts (i.e. E-6 Volts).
59
60 NOTE: This value should not be used to determine the regulator
61 output voltage level as this value is the same regardless of
62 whether the regulator is enabled or disabled.
63
64
65What: /sys/class/regulator/.../microamps
66Date: April 2008
67KernelVersion: 2.6.26
68Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
69Description:
70 Each regulator directory will contain a field called
71 microamps. This holds the regulator output current limit
72 setting measured in microamps (i.e. E-6 Amps).
73
74 NOTE: This value should not be used to determine the regulator
75 output current level as this value is the same regardless of
76 whether the regulator is enabled or disabled.
77
78
79What: /sys/class/regulator/.../opmode
80Date: April 2008
81KernelVersion: 2.6.26
82Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
83Description:
84 Each regulator directory will contain a field called
85 opmode. This holds the regulator operating mode setting.
86
87 The opmode value can be one of the following strings:
88
89 'fast'
90 'normal'
91 'idle'
92 'standby'
93 'unknown'
94
95 The modes are described in include/linux/regulator/regulator.h
96
97 NOTE: This value should not be used to determine the regulator
98 output operating mode as this value is the same regardless of
99 whether the regulator is enabled or disabled.
100
101
102What: /sys/class/regulator/.../min_microvolts
103Date: April 2008
104KernelVersion: 2.6.26
105Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
106Description:
107 Each regulator directory will contain a field called
108 min_microvolts. This holds the minimum safe working regulator
109 output voltage setting for this domain measured in microvolts.
110
111 NOTE: this will return the string 'constraint not defined' if
112 the power domain has no min microvolts constraint defined by
113 platform code.
114
115
116What: /sys/class/regulator/.../max_microvolts
117Date: April 2008
118KernelVersion: 2.6.26
119Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
120Description:
121 Each regulator directory will contain a field called
122 max_microvolts. This holds the maximum safe working regulator
123 output voltage setting for this domain measured in microvolts.
124
125 NOTE: this will return the string 'constraint not defined' if
126 the power domain has no max microvolts constraint defined by
127 platform code.
128
129
130What: /sys/class/regulator/.../min_microamps
131Date: April 2008
132KernelVersion: 2.6.26
133Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
134Description:
135 Each regulator directory will contain a field called
136 min_microamps. This holds the minimum safe working regulator
137 output current limit setting for this domain measured in
138 microamps.
139
140 NOTE: this will return the string 'constraint not defined' if
141 the power domain has no min microamps constraint defined by
142 platform code.
143
144
145What: /sys/class/regulator/.../max_microamps
146Date: April 2008
147KernelVersion: 2.6.26
148Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
149Description:
150 Each regulator directory will contain a field called
151 max_microamps. This holds the maximum safe working regulator
152 output current limit setting for this domain measured in
153 microamps.
154
155 NOTE: this will return the string 'constraint not defined' if
156 the power domain has no max microamps constraint defined by
157 platform code.
158
159
160What: /sys/class/regulator/.../num_users
161Date: April 2008
162KernelVersion: 2.6.26
163Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
164Description:
165 Each regulator directory will contain a field called
166 num_users. This holds the number of consumer devices that
167 have called regulator_enable() on this regulator.
168
169
170What: /sys/class/regulator/.../requested_microamps
171Date: April 2008
172KernelVersion: 2.6.26
173Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
174Description:
175 Each regulator directory will contain a field called
176 requested_microamps. This holds the total requested load
177 current in microamps for this regulator from all its consumer
178 devices.
179
180
181What: /sys/class/regulator/.../parent
182Date: April 2008
183KernelVersion: 2.6.26
184Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
185Description:
186 Some regulator directories will contain a link called parent.
187 This points to the parent or supply regulator if one exists.
188
189What: /sys/class/regulator/.../suspend_mem_microvolts
190Date: May 2008
191KernelVersion: 2.6.26
192Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
193Description:
194 Each regulator directory will contain a field called
195 suspend_mem_microvolts. This holds the regulator output
196 voltage setting for this domain measured in microvolts when
197 the system is suspended to memory.
198
199 NOTE: this will return the string 'not defined' if
200 the power domain has no suspend to memory voltage defined by
201 platform code.
202
203What: /sys/class/regulator/.../suspend_disk_microvolts
204Date: May 2008
205KernelVersion: 2.6.26
206Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
207Description:
208 Each regulator directory will contain a field called
209 suspend_disk_microvolts. This holds the regulator output
210 voltage setting for this domain measured in microvolts when
211 the system is suspended to disk.
212
213 NOTE: this will return the string 'not defined' if
214 the power domain has no suspend to disk voltage defined by
215 platform code.
216
217What: /sys/class/regulator/.../suspend_standby_microvolts
218Date: May 2008
219KernelVersion: 2.6.26
220Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
221Description:
222 Each regulator directory will contain a field called
223 suspend_standby_microvolts. This holds the regulator output
224 voltage setting for this domain measured in microvolts when
225 the system is suspended to standby.
226
227 NOTE: this will return the string 'not defined' if
228 the power domain has no suspend to standby voltage defined by
229 platform code.
230
231What: /sys/class/regulator/.../suspend_mem_mode
232Date: May 2008
233KernelVersion: 2.6.26
234Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
235Description:
236 Each regulator directory will contain a field called
237 suspend_mem_mode. This holds the regulator operating mode
238 setting for this domain when the system is suspended to
239 memory.
240
241 NOTE: this will return the string 'not defined' if
242 the power domain has no suspend to memory mode defined by
243 platform code.
244
245What: /sys/class/regulator/.../suspend_disk_mode
246Date: May 2008
247KernelVersion: 2.6.26
248Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
249Description:
250 Each regulator directory will contain a field called
251 suspend_disk_mode. This holds the regulator operating mode
252 setting for this domain when the system is suspended to disk.
253
254 NOTE: this will return the string 'not defined' if
255 the power domain has no suspend to disk mode defined by
256 platform code.
257
258What: /sys/class/regulator/.../suspend_standby_mode
259Date: May 2008
260KernelVersion: 2.6.26
261Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
262Description:
263 Each regulator directory will contain a field called
264 suspend_standby_mode. This holds the regulator operating mode
265 setting for this domain when the system is suspended to
266 standby.
267
268 NOTE: this will return the string 'not defined' if
269 the power domain has no suspend to standby mode defined by
270 platform code.
271
272What: /sys/class/regulator/.../suspend_mem_state
273Date: May 2008
274KernelVersion: 2.6.26
275Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
276Description:
277 Each regulator directory will contain a field called
278 suspend_mem_state. This holds the regulator operating state
279 when suspended to memory.
280
281 This will be one of the following strings:
282
283 'enabled'
284 'disabled'
285 'not defined'
286
287What: /sys/class/regulator/.../suspend_disk_state
288Date: May 2008
289KernelVersion: 2.6.26
290Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
291Description:
292 Each regulator directory will contain a field called
293 suspend_disk_state. This holds the regulator operating state
294 when suspended to disk.
295
296 This will be one of the following strings:
297
298 'enabled'
299 'disabled'
300 'not defined'
301
302What: /sys/class/regulator/.../suspend_standby_state
303Date: May 2008
304KernelVersion: 2.6.26
305Contact: Liam Girdwood <lg@opensource.wolfsonmicro.com>
306Description:
307 Each regulator directory will contain a field called
308 suspend_standby_state. This holds the regulator operating
309 state when suspended to standby.
310
311 This will be one of the following strings:
312
313 'enabled'
314 'disabled'
315 'not defined'
diff --git a/Documentation/DocBook/kgdb.tmpl b/Documentation/DocBook/kgdb.tmpl
index e8acd1f03456..372dec20c8da 100644
--- a/Documentation/DocBook/kgdb.tmpl
+++ b/Documentation/DocBook/kgdb.tmpl
@@ -98,6 +98,24 @@
98 "Kernel debugging" select "KGDB: kernel debugging with remote gdb". 98 "Kernel debugging" select "KGDB: kernel debugging with remote gdb".
99 </para> 99 </para>
100 <para> 100 <para>
101 It is advised, but not required that you turn on the
102 CONFIG_FRAME_POINTER kernel option. This option inserts code to
103 into the compiled executable which saves the frame information in
104 registers or on the stack at different points which will allow a
105 debugger such as gdb to more accurately construct stack back traces
106 while debugging the kernel.
107 </para>
108 <para>
109 If the architecture that you are using supports the kernel option
110 CONFIG_DEBUG_RODATA, you should consider turning it off. This
111 option will prevent the use of software breakpoints because it
112 marks certain regions of the kernel's memory space as read-only.
113 If kgdb supports it for the architecture you are using, you can
114 use hardware breakpoints if you desire to run with the
115 CONFIG_DEBUG_RODATA option turned on, else you need to turn off
116 this option.
117 </para>
118 <para>
101 Next you should choose one of more I/O drivers to interconnect debugging 119 Next you should choose one of more I/O drivers to interconnect debugging
102 host and debugged target. Early boot debugging requires a KGDB 120 host and debugged target. Early boot debugging requires a KGDB
103 I/O driver that supports early debugging and the driver must be 121 I/O driver that supports early debugging and the driver must be
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 118ca6e9404f..f79ad9ff6031 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -528,7 +528,33 @@ See more details on the proper patch format in the following
528references. 528references.
529 529
530 530
53116) Sending "git pull" requests (from Linus emails)
531 532
533Please write the git repo address and branch name alone on the same line
534so that I can't even by mistake pull from the wrong branch, and so
535that a triple-click just selects the whole thing.
536
537So the proper format is something along the lines of:
538
539 "Please pull from
540
541 git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus
542
543 to get these changes:"
544
545so that I don't have to hunt-and-peck for the address and inevitably
546get it wrong (actually, I've only gotten it wrong a few times, and
547checking against the diffstat tells me when I get it wrong, but I'm
548just a lot more comfortable when I don't have to "look for" the right
549thing to pull, and double-check that I have the right branch-name).
550
551
552Please use "git diff -M --stat --summary" to generate the diffstat:
553the -M enables rename detection, and the summary enables a summary of
554new/deleted or renamed files.
555
556With rename detection, the statistics are rather different [...]
557because git will notice that a fair number of the changes are renames.
532 558
533----------------------------------- 559-----------------------------------
534SECTION 2 - HINTS, TIPS, AND TRICKS 560SECTION 2 - HINTS, TIPS, AND TRICKS
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 721c71b86e06..c23955404bf5 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -47,6 +47,30 @@ Who: Mauro Carvalho Chehab <mchehab@infradead.org>
47 47
48--------------------------- 48---------------------------
49 49
50What: old tuner-3036 i2c driver
51When: 2.6.28
52Why: This driver is for VERY old i2c-over-parallel port teletext receiver
53 boxes. Rather then spending effort on converting this driver to V4L2,
54 and since it is extremely unlikely that anyone still uses one of these
55 devices, it was decided to drop it.
56Who: Hans Verkuil <hverkuil@xs4all.nl>
57 Mauro Carvalho Chehab <mchehab@infradead.org>
58
59 ---------------------------
60
61What: V4L2 dpc7146 driver
62When: 2.6.28
63Why: Old driver for the dpc7146 demonstration board that is no longer
64 relevant. The last time this was tested on actual hardware was
65 probably around 2002. Since this is a driver for a demonstration
66 board the decision was made to remove it rather than spending a
67 lot of effort continually updating this driver to stay in sync
68 with the latest internal V4L2 or I2C API.
69Who: Hans Verkuil <hverkuil@xs4all.nl>
70 Mauro Carvalho Chehab <mchehab@infradead.org>
71
72---------------------------
73
50What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl]) 74What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl])
51When: November 2005 75When: November 2005
52Files: drivers/pcmcia/: pcmcia_ioctl.c 76Files: drivers/pcmcia/: pcmcia_ioctl.c
diff --git a/Documentation/hwmon/dme1737 b/Documentation/hwmon/dme1737
index 8f446070e64a..b1fe00999439 100644
--- a/Documentation/hwmon/dme1737
+++ b/Documentation/hwmon/dme1737
@@ -22,6 +22,10 @@ Module Parameters
22 and PWM output control functions. Using this parameter 22 and PWM output control functions. Using this parameter
23 shouldn't be required since the BIOS usually takes care 23 shouldn't be required since the BIOS usually takes care
24 of this. 24 of this.
25* probe_all_addr: bool Include non-standard LPC addresses 0x162e and 0x164e
26 when probing for ISA devices. This is required for the
27 following boards:
28 - VIA EPIA SN18000
25 29
26Note that there is no need to use this parameter if the driver loads without 30Note that there is no need to use this parameter if the driver loads without
27complaining. The driver will say so if it is necessary. 31complaining. The driver will say so if it is necessary.
diff --git a/Documentation/hwmon/lm85 b/Documentation/hwmon/lm85
index 9549237530cf..6d41db7f17f8 100644
--- a/Documentation/hwmon/lm85
+++ b/Documentation/hwmon/lm85
@@ -96,11 +96,6 @@ initial testing of the ADM1027 it was 1.00 degC steps. Analog Devices has
96confirmed this "bug". The ADT7463 is reported to work as described in the 96confirmed this "bug". The ADT7463 is reported to work as described in the
97documentation. The current lm85 driver does not show the offset register. 97documentation. The current lm85 driver does not show the offset register.
98 98
99The ADT7463 has a THERM asserted counter. This counter has a 22.76ms
100resolution and a range of 5.8 seconds. The driver implements a 32-bit
101accumulator of the counter value to extend the range to over a year. The
102counter will stay at it's max value until read.
103
104See the vendor datasheets for more information. There is application note 99See the vendor datasheets for more information. There is application note
105from National (AN-1260) with some additional information about the LM85. 100from National (AN-1260) with some additional information about the LM85.
106The Analog Devices datasheet is very detailed and describes a procedure for 101The Analog Devices datasheet is very detailed and describes a procedure for
@@ -206,13 +201,15 @@ Configuration choices:
206 201
207The National LM85's have two vendor specific configuration 202The National LM85's have two vendor specific configuration
208features. Tach. mode and Spinup Control. For more details on these, 203features. Tach. mode and Spinup Control. For more details on these,
209see the LM85 datasheet or Application Note AN-1260. 204see the LM85 datasheet or Application Note AN-1260. These features
205are not currently supported by the lm85 driver.
210 206
211The Analog Devices ADM1027 has several vendor specific enhancements. 207The Analog Devices ADM1027 has several vendor specific enhancements.
212The number of pulses-per-rev of the fans can be set, Tach monitoring 208The number of pulses-per-rev of the fans can be set, Tach monitoring
213can be optimized for PWM operation, and an offset can be applied to 209can be optimized for PWM operation, and an offset can be applied to
214the temperatures to compensate for systemic errors in the 210the temperatures to compensate for systemic errors in the
215measurements. 211measurements. These features are not currently supported by the lm85
212driver.
216 213
217In addition to the ADM1027 features, the ADT7463 also has Tmin control 214In addition to the ADM1027 features, the ADT7463 also has Tmin control
218and THERM asserted counts. Automatic Tmin control acts to adjust the 215and THERM asserted counts. Automatic Tmin control acts to adjust the
diff --git a/Documentation/i2c/upgrading-clients b/Documentation/i2c/upgrading-clients
new file mode 100644
index 000000000000..9a45f9bb6a25
--- /dev/null
+++ b/Documentation/i2c/upgrading-clients
@@ -0,0 +1,281 @@
1Upgrading I2C Drivers to the new 2.6 Driver Model
2=================================================
3
4Ben Dooks <ben-linux@fluff.org>
5
6Introduction
7------------
8
9This guide outlines how to alter existing Linux 2.6 client drivers from
10the old to the new new binding methods.
11
12
13Example old-style driver
14------------------------
15
16
17struct example_state {
18 struct i2c_client client;
19 ....
20};
21
22static struct i2c_driver example_driver;
23
24static unsigned short ignore[] = { I2C_CLIENT_END };
25static unsigned short normal_addr[] = { OUR_ADDR, I2C_CLIENT_END };
26
27I2C_CLIENT_INSMOD;
28
29static int example_attach(struct i2c_adapter *adap, int addr, int kind)
30{
31 struct example_state *state;
32 struct device *dev = &adap->dev; /* to use for dev_ reports */
33 int ret;
34
35 state = kzalloc(sizeof(struct example_state), GFP_KERNEL);
36 if (state == NULL) {
37 dev_err(dev, "failed to create our state\n");
38 return -ENOMEM;
39 }
40
41 example->client.addr = addr;
42 example->client.flags = 0;
43 example->client.adapter = adap;
44
45 i2c_set_clientdata(&state->i2c_client, state);
46 strlcpy(client->i2c_client.name, "example", I2C_NAME_SIZE);
47
48 ret = i2c_attach_client(&state->i2c_client);
49 if (ret < 0) {
50 dev_err(dev, "failed to attach client\n");
51 kfree(state);
52 return ret;
53 }
54
55 dev = &state->i2c_client.dev;
56
57 /* rest of the initialisation goes here. */
58
59 dev_info(dev, "example client created\n");
60
61 return 0;
62}
63
64static int __devexit example_detach(struct i2c_client *client)
65{
66 struct example_state *state = i2c_get_clientdata(client);
67
68 i2c_detach_client(client);
69 kfree(state);
70 return 0;
71}
72
73static int example_attach_adapter(struct i2c_adapter *adap)
74{
75 return i2c_probe(adap, &addr_data, example_attach);
76}
77
78static struct i2c_driver example_driver = {
79 .driver = {
80 .owner = THIS_MODULE,
81 .name = "example",
82 },
83 .attach_adapter = example_attach_adapter,
84 .detach_client = __devexit_p(example_detach),
85 .suspend = example_suspend,
86 .resume = example_resume,
87};
88
89
90Updating the client
91-------------------
92
93The new style binding model will check against a list of supported
94devices and their associated address supplied by the code registering
95the busses. This means that the driver .attach_adapter and
96.detach_adapter methods can be removed, along with the addr_data,
97as follows:
98
99- static struct i2c_driver example_driver;
100
101- static unsigned short ignore[] = { I2C_CLIENT_END };
102- static unsigned short normal_addr[] = { OUR_ADDR, I2C_CLIENT_END };
103
104- I2C_CLIENT_INSMOD;
105
106- static int example_attach_adapter(struct i2c_adapter *adap)
107- {
108- return i2c_probe(adap, &addr_data, example_attach);
109- }
110
111 static struct i2c_driver example_driver = {
112- .attach_adapter = example_attach_adapter,
113- .detach_client = __devexit_p(example_detach),
114 }
115
116Add the probe and remove methods to the i2c_driver, as so:
117
118 static struct i2c_driver example_driver = {
119+ .probe = example_probe,
120+ .remove = __devexit_p(example_remove),
121 }
122
123Change the example_attach method to accept the new parameters
124which include the i2c_client that it will be working with:
125
126- static int example_attach(struct i2c_adapter *adap, int addr, int kind)
127+ static int example_probe(struct i2c_client *client,
128+ const struct i2c_device_id *id)
129
130Change the name of example_attach to example_probe to align it with the
131i2c_driver entry names. The rest of the probe routine will now need to be
132changed as the i2c_client has already been setup for use.
133
134The necessary client fields have already been setup before
135the probe function is called, so the following client setup
136can be removed:
137
138- example->client.addr = addr;
139- example->client.flags = 0;
140- example->client.adapter = adap;
141-
142- strlcpy(client->i2c_client.name, "example", I2C_NAME_SIZE);
143
144The i2c_set_clientdata is now:
145
146- i2c_set_clientdata(&state->client, state);
147+ i2c_set_clientdata(client, state);
148
149The call to i2c_attach_client is no longer needed, if the probe
150routine exits successfully, then the driver will be automatically
151attached by the core. Change the probe routine as so:
152
153- ret = i2c_attach_client(&state->i2c_client);
154- if (ret < 0) {
155- dev_err(dev, "failed to attach client\n");
156- kfree(state);
157- return ret;
158- }
159
160
161Remove the storage of 'struct i2c_client' from the 'struct example_state'
162as we are provided with the i2c_client in our example_probe. Instead we
163store a pointer to it for when it is needed.
164
165struct example_state {
166- struct i2c_client client;
167+ struct i2c_client *client;
168
169the new i2c client as so:
170
171- struct device *dev = &adap->dev; /* to use for dev_ reports */
172+ struct device *dev = &i2c_client->dev; /* to use for dev_ reports */
173
174And remove the change after our client is attached, as the driver no
175longer needs to register a new client structure with the core:
176
177- dev = &state->i2c_client.dev;
178
179In the probe routine, ensure that the new state has the client stored
180in it:
181
182static int example_probe(struct i2c_client *i2c_client,
183 const struct i2c_device_id *id)
184{
185 struct example_state *state;
186 struct device *dev = &i2c_client->dev;
187 int ret;
188
189 state = kzalloc(sizeof(struct example_state), GFP_KERNEL);
190 if (state == NULL) {
191 dev_err(dev, "failed to create our state\n");
192 return -ENOMEM;
193 }
194
195+ state->client = i2c_client;
196
197Update the detach method, by changing the name to _remove and
198to delete the i2c_detach_client call. It is possible that you
199can also remove the ret variable as it is not not needed for
200any of the core functions.
201
202- static int __devexit example_detach(struct i2c_client *client)
203+ static int __devexit example_remove(struct i2c_client *client)
204{
205 struct example_state *state = i2c_get_clientdata(client);
206
207- i2c_detach_client(client);
208
209And finally ensure that we have the correct ID table for the i2c-core
210and other utilities:
211
212+ struct i2c_device_id example_idtable[] = {
213+ { "example", 0 },
214+ { }
215+};
216+
217+MODULE_DEVICE_TABLE(i2c, example_idtable);
218
219static struct i2c_driver example_driver = {
220 .driver = {
221 .owner = THIS_MODULE,
222 .name = "example",
223 },
224+ .id_table = example_ids,
225
226
227Our driver should now look like this:
228
229struct example_state {
230 struct i2c_client *client;
231 ....
232};
233
234static int example_probe(struct i2c_client *client,
235 const struct i2c_device_id *id)
236{
237 struct example_state *state;
238 struct device *dev = &client->dev;
239
240 state = kzalloc(sizeof(struct example_state), GFP_KERNEL);
241 if (state == NULL) {
242 dev_err(dev, "failed to create our state\n");
243 return -ENOMEM;
244 }
245
246 state->client = client;
247 i2c_set_clientdata(client, state);
248
249 /* rest of the initialisation goes here. */
250
251 dev_info(dev, "example client created\n");
252
253 return 0;
254}
255
256static int __devexit example_remove(struct i2c_client *client)
257{
258 struct example_state *state = i2c_get_clientdata(client);
259
260 kfree(state);
261 return 0;
262}
263
264static struct i2c_device_id example_idtable[] = {
265 { "example", 0 },
266 { }
267};
268
269MODULE_DEVICE_TABLE(i2c, example_idtable);
270
271static struct i2c_driver example_driver = {
272 .driver = {
273 .owner = THIS_MODULE,
274 .name = "example",
275 },
276 .id_table = example_idtable,
277 .probe = example_probe,
278 .remove = __devexit_p(example_remove),
279 .suspend = example_suspend,
280 .resume = example_resume,
281};
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
index 9691c7f5166c..0705040531a5 100644
--- a/Documentation/kdump/kdump.txt
+++ b/Documentation/kdump/kdump.txt
@@ -65,26 +65,26 @@ Install kexec-tools
65 65
662) Download the kexec-tools user-space package from the following URL: 662) Download the kexec-tools user-space package from the following URL:
67 67
68http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/kexec-tools-testing.tar.gz 68http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/kexec-tools.tar.gz
69 69
70This is a symlink to the latest version, which at the time of writing is 70This is a symlink to the latest version.
7120061214, the only release of kexec-tools-testing so far. As other versions
72are released, the older ones will remain available at
73http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
74 71
75Note: Latest kexec-tools-testing git tree is available at 72The latest kexec-tools git tree is available at:
76 73
77git://git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools-testing.git 74git://git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools.git
78or 75or
79http://www.kernel.org/git/?p=linux/kernel/git/horms/kexec-tools-testing.git;a=summary 76http://www.kernel.org/git/?p=linux/kernel/git/horms/kexec-tools.git
77
78More information about kexec-tools can be found at
79http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/README.html
80 80
813) Unpack the tarball with the tar command, as follows: 813) Unpack the tarball with the tar command, as follows:
82 82
83 tar xvpzf kexec-tools-testing.tar.gz 83 tar xvpzf kexec-tools.tar.gz
84 84
854) Change to the kexec-tools directory, as follows: 854) Change to the kexec-tools directory, as follows:
86 86
87 cd kexec-tools-testing-VERSION 87 cd kexec-tools-VERSION
88 88
895) Configure the package, as follows: 895) Configure the package, as follows:
90 90
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 82fafe0429fe..b88b0ea54e90 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -36,11 +36,13 @@
36#include <sched.h> 36#include <sched.h>
37#include <limits.h> 37#include <limits.h>
38#include <stddef.h> 38#include <stddef.h>
39#include <signal.h>
39#include "linux/lguest_launcher.h" 40#include "linux/lguest_launcher.h"
40#include "linux/virtio_config.h" 41#include "linux/virtio_config.h"
41#include "linux/virtio_net.h" 42#include "linux/virtio_net.h"
42#include "linux/virtio_blk.h" 43#include "linux/virtio_blk.h"
43#include "linux/virtio_console.h" 44#include "linux/virtio_console.h"
45#include "linux/virtio_rng.h"
44#include "linux/virtio_ring.h" 46#include "linux/virtio_ring.h"
45#include "asm-x86/bootparam.h" 47#include "asm-x86/bootparam.h"
46/*L:110 We can ignore the 39 include files we need for this program, but I do 48/*L:110 We can ignore the 39 include files we need for this program, but I do
@@ -64,8 +66,8 @@ typedef uint8_t u8;
64#endif 66#endif
65/* We can have up to 256 pages for devices. */ 67/* We can have up to 256 pages for devices. */
66#define DEVICE_PAGES 256 68#define DEVICE_PAGES 256
67/* This will occupy 2 pages: it must be a power of 2. */ 69/* This will occupy 3 pages: it must be a power of 2. */
68#define VIRTQUEUE_NUM 128 70#define VIRTQUEUE_NUM 256
69 71
70/*L:120 verbose is both a global flag and a macro. The C preprocessor allows 72/*L:120 verbose is both a global flag and a macro. The C preprocessor allows
71 * this, and although I wouldn't recommend it, it works quite nicely here. */ 73 * this, and although I wouldn't recommend it, it works quite nicely here. */
@@ -74,12 +76,19 @@ static bool verbose;
74 do { if (verbose) printf(args); } while(0) 76 do { if (verbose) printf(args); } while(0)
75/*:*/ 77/*:*/
76 78
77/* The pipe to send commands to the waker process */ 79/* File descriptors for the Waker. */
78static int waker_fd; 80struct {
81 int pipe[2];
82 int lguest_fd;
83} waker_fds;
84
79/* The pointer to the start of guest memory. */ 85/* The pointer to the start of guest memory. */
80static void *guest_base; 86static void *guest_base;
81/* The maximum guest physical address allowed, and maximum possible. */ 87/* The maximum guest physical address allowed, and maximum possible. */
82static unsigned long guest_limit, guest_max; 88static unsigned long guest_limit, guest_max;
89/* The pipe for signal hander to write to. */
90static int timeoutpipe[2];
91static unsigned int timeout_usec = 500;
83 92
84/* a per-cpu variable indicating whose vcpu is currently running */ 93/* a per-cpu variable indicating whose vcpu is currently running */
85static unsigned int __thread cpu_id; 94static unsigned int __thread cpu_id;
@@ -155,11 +164,14 @@ struct virtqueue
155 /* Last available index we saw. */ 164 /* Last available index we saw. */
156 u16 last_avail_idx; 165 u16 last_avail_idx;
157 166
158 /* The routine to call when the Guest pings us. */ 167 /* The routine to call when the Guest pings us, or timeout. */
159 void (*handle_output)(int fd, struct virtqueue *me); 168 void (*handle_output)(int fd, struct virtqueue *me, bool timeout);
160 169
161 /* Outstanding buffers */ 170 /* Outstanding buffers */
162 unsigned int inflight; 171 unsigned int inflight;
172
173 /* Is this blocked awaiting a timer? */
174 bool blocked;
163}; 175};
164 176
165/* Remember the arguments to the program so we can "reboot" */ 177/* Remember the arguments to the program so we can "reboot" */
@@ -190,6 +202,9 @@ static void *_convert(struct iovec *iov, size_t size, size_t align,
190 return iov->iov_base; 202 return iov->iov_base;
191} 203}
192 204
205/* Wrapper for the last available index. Makes it easier to change. */
206#define lg_last_avail(vq) ((vq)->last_avail_idx)
207
193/* The virtio configuration space is defined to be little-endian. x86 is 208/* The virtio configuration space is defined to be little-endian. x86 is
194 * little-endian too, but it's nice to be explicit so we have these helpers. */ 209 * little-endian too, but it's nice to be explicit so we have these helpers. */
195#define cpu_to_le16(v16) (v16) 210#define cpu_to_le16(v16) (v16)
@@ -199,6 +214,33 @@ static void *_convert(struct iovec *iov, size_t size, size_t align,
199#define le32_to_cpu(v32) (v32) 214#define le32_to_cpu(v32) (v32)
200#define le64_to_cpu(v64) (v64) 215#define le64_to_cpu(v64) (v64)
201 216
217/* Is this iovec empty? */
218static bool iov_empty(const struct iovec iov[], unsigned int num_iov)
219{
220 unsigned int i;
221
222 for (i = 0; i < num_iov; i++)
223 if (iov[i].iov_len)
224 return false;
225 return true;
226}
227
228/* Take len bytes from the front of this iovec. */
229static void iov_consume(struct iovec iov[], unsigned num_iov, unsigned len)
230{
231 unsigned int i;
232
233 for (i = 0; i < num_iov; i++) {
234 unsigned int used;
235
236 used = iov[i].iov_len < len ? iov[i].iov_len : len;
237 iov[i].iov_base += used;
238 iov[i].iov_len -= used;
239 len -= used;
240 }
241 assert(len == 0);
242}
243
202/* The device virtqueue descriptors are followed by feature bitmasks. */ 244/* The device virtqueue descriptors are followed by feature bitmasks. */
203static u8 *get_feature_bits(struct device *dev) 245static u8 *get_feature_bits(struct device *dev)
204{ 246{
@@ -254,6 +296,7 @@ static void *map_zeroed_pages(unsigned int num)
254 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, fd, 0); 296 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, fd, 0);
255 if (addr == MAP_FAILED) 297 if (addr == MAP_FAILED)
256 err(1, "Mmaping %u pages of /dev/zero", num); 298 err(1, "Mmaping %u pages of /dev/zero", num);
299 close(fd);
257 300
258 return addr; 301 return addr;
259} 302}
@@ -540,69 +583,64 @@ static void add_device_fd(int fd)
540 * watch, but handing a file descriptor mask through to the kernel is fairly 583 * watch, but handing a file descriptor mask through to the kernel is fairly
541 * icky. 584 * icky.
542 * 585 *
543 * Instead, we fork off a process which watches the file descriptors and writes 586 * Instead, we clone off a thread which watches the file descriptors and writes
544 * the LHREQ_BREAK command to the /dev/lguest file descriptor to tell the Host 587 * the LHREQ_BREAK command to the /dev/lguest file descriptor to tell the Host
545 * stop running the Guest. This causes the Launcher to return from the 588 * stop running the Guest. This causes the Launcher to return from the
546 * /dev/lguest read with -EAGAIN, where it will write to /dev/lguest to reset 589 * /dev/lguest read with -EAGAIN, where it will write to /dev/lguest to reset
547 * the LHREQ_BREAK and wake us up again. 590 * the LHREQ_BREAK and wake us up again.
548 * 591 *
549 * This, of course, is merely a different *kind* of icky. 592 * This, of course, is merely a different *kind* of icky.
593 *
594 * Given my well-known antipathy to threads, I'd prefer to use processes. But
595 * it's easier to share Guest memory with threads, and trivial to share the
596 * devices.infds as the Launcher changes it.
550 */ 597 */
551static void wake_parent(int pipefd, int lguest_fd) 598static int waker(void *unused)
552{ 599{
553 /* Add the pipe from the Launcher to the fdset in the device_list, so 600 /* Close the write end of the pipe: only the Launcher has it open. */
554 * we watch it, too. */ 601 close(waker_fds.pipe[1]);
555 add_device_fd(pipefd);
556 602
557 for (;;) { 603 for (;;) {
558 fd_set rfds = devices.infds; 604 fd_set rfds = devices.infds;
559 unsigned long args[] = { LHREQ_BREAK, 1 }; 605 unsigned long args[] = { LHREQ_BREAK, 1 };
606 unsigned int maxfd = devices.max_infd;
607
608 /* We also listen to the pipe from the Launcher. */
609 FD_SET(waker_fds.pipe[0], &rfds);
610 if (waker_fds.pipe[0] > maxfd)
611 maxfd = waker_fds.pipe[0];
560 612
561 /* Wait until input is ready from one of the devices. */ 613 /* Wait until input is ready from one of the devices. */
562 select(devices.max_infd+1, &rfds, NULL, NULL, NULL); 614 select(maxfd+1, &rfds, NULL, NULL, NULL);
563 /* Is it a message from the Launcher? */ 615
564 if (FD_ISSET(pipefd, &rfds)) { 616 /* Message from Launcher? */
565 int fd; 617 if (FD_ISSET(waker_fds.pipe[0], &rfds)) {
566 /* If read() returns 0, it means the Launcher has 618 char c;
567 * exited. We silently follow. */ 619 /* If this fails, then assume Launcher has exited.
568 if (read(pipefd, &fd, sizeof(fd)) == 0) 620 * Don't do anything on exit: we're just a thread! */
569 exit(0); 621 if (read(waker_fds.pipe[0], &c, 1) != 1)
570 /* Otherwise it's telling us to change what file 622 _exit(0);
571 * descriptors we're to listen to. Positive means 623 continue;
572 * listen to a new one, negative means stop 624 }
573 * listening. */ 625
574 if (fd >= 0) 626 /* Send LHREQ_BREAK command to snap the Launcher out of it. */
575 FD_SET(fd, &devices.infds); 627 pwrite(waker_fds.lguest_fd, args, sizeof(args), cpu_id);
576 else
577 FD_CLR(-fd - 1, &devices.infds);
578 } else /* Send LHREQ_BREAK command. */
579 pwrite(lguest_fd, args, sizeof(args), cpu_id);
580 } 628 }
629 return 0;
581} 630}
582 631
583/* This routine just sets up a pipe to the Waker process. */ 632/* This routine just sets up a pipe to the Waker process. */
584static int setup_waker(int lguest_fd) 633static void setup_waker(int lguest_fd)
585{ 634{
586 int pipefd[2], child; 635 /* This pipe is closed when Launcher dies, telling Waker. */
587 636 if (pipe(waker_fds.pipe) != 0)
588 /* We create a pipe to talk to the Waker, and also so it knows when the 637 err(1, "Creating pipe for Waker");
589 * Launcher dies (and closes pipe). */
590 pipe(pipefd);
591 child = fork();
592 if (child == -1)
593 err(1, "forking");
594
595 if (child == 0) {
596 /* We are the Waker: close the "writing" end of our copy of the
597 * pipe and start waiting for input. */
598 close(pipefd[1]);
599 wake_parent(pipefd[0], lguest_fd);
600 }
601 /* Close the reading end of our copy of the pipe. */
602 close(pipefd[0]);
603 638
604 /* Here is the fd used to talk to the waker. */ 639 /* Waker also needs to know the lguest fd */
605 return pipefd[1]; 640 waker_fds.lguest_fd = lguest_fd;
641
642 if (clone(waker, malloc(4096) + 4096, CLONE_VM | SIGCHLD, NULL) == -1)
643 err(1, "Creating Waker");
606} 644}
607 645
608/* 646/*
@@ -661,19 +699,22 @@ static unsigned get_vq_desc(struct virtqueue *vq,
661 unsigned int *out_num, unsigned int *in_num) 699 unsigned int *out_num, unsigned int *in_num)
662{ 700{
663 unsigned int i, head; 701 unsigned int i, head;
702 u16 last_avail;
664 703
665 /* Check it isn't doing very strange things with descriptor numbers. */ 704 /* Check it isn't doing very strange things with descriptor numbers. */
666 if ((u16)(vq->vring.avail->idx - vq->last_avail_idx) > vq->vring.num) 705 last_avail = lg_last_avail(vq);
706 if ((u16)(vq->vring.avail->idx - last_avail) > vq->vring.num)
667 errx(1, "Guest moved used index from %u to %u", 707 errx(1, "Guest moved used index from %u to %u",
668 vq->last_avail_idx, vq->vring.avail->idx); 708 last_avail, vq->vring.avail->idx);
669 709
670 /* If there's nothing new since last we looked, return invalid. */ 710 /* If there's nothing new since last we looked, return invalid. */
671 if (vq->vring.avail->idx == vq->last_avail_idx) 711 if (vq->vring.avail->idx == last_avail)
672 return vq->vring.num; 712 return vq->vring.num;
673 713
674 /* Grab the next descriptor number they're advertising, and increment 714 /* Grab the next descriptor number they're advertising, and increment
675 * the index we've seen. */ 715 * the index we've seen. */
676 head = vq->vring.avail->ring[vq->last_avail_idx++ % vq->vring.num]; 716 head = vq->vring.avail->ring[last_avail % vq->vring.num];
717 lg_last_avail(vq)++;
677 718
678 /* If their number is silly, that's a fatal mistake. */ 719 /* If their number is silly, that's a fatal mistake. */
679 if (head >= vq->vring.num) 720 if (head >= vq->vring.num)
@@ -821,8 +862,8 @@ static bool handle_console_input(int fd, struct device *dev)
821 unsigned long args[] = { LHREQ_BREAK, 0 }; 862 unsigned long args[] = { LHREQ_BREAK, 0 };
822 /* Close the fd so Waker will know it has to 863 /* Close the fd so Waker will know it has to
823 * exit. */ 864 * exit. */
824 close(waker_fd); 865 close(waker_fds.pipe[1]);
825 /* Just in case waker is blocked in BREAK, send 866 /* Just in case Waker is blocked in BREAK, send
826 * unbreak now. */ 867 * unbreak now. */
827 write(fd, args, sizeof(args)); 868 write(fd, args, sizeof(args));
828 exit(2); 869 exit(2);
@@ -839,7 +880,7 @@ static bool handle_console_input(int fd, struct device *dev)
839 880
840/* Handling output for console is simple: we just get all the output buffers 881/* Handling output for console is simple: we just get all the output buffers
841 * and write them to stdout. */ 882 * and write them to stdout. */
842static void handle_console_output(int fd, struct virtqueue *vq) 883static void handle_console_output(int fd, struct virtqueue *vq, bool timeout)
843{ 884{
844 unsigned int head, out, in; 885 unsigned int head, out, in;
845 int len; 886 int len;
@@ -854,6 +895,21 @@ static void handle_console_output(int fd, struct virtqueue *vq)
854 } 895 }
855} 896}
856 897
898static void block_vq(struct virtqueue *vq)
899{
900 struct itimerval itm;
901
902 vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
903 vq->blocked = true;
904
905 itm.it_interval.tv_sec = 0;
906 itm.it_interval.tv_usec = 0;
907 itm.it_value.tv_sec = 0;
908 itm.it_value.tv_usec = timeout_usec;
909
910 setitimer(ITIMER_REAL, &itm, NULL);
911}
912
857/* 913/*
858 * The Network 914 * The Network
859 * 915 *
@@ -861,22 +917,34 @@ static void handle_console_output(int fd, struct virtqueue *vq)
861 * and write them (ignoring the first element) to this device's file descriptor 917 * and write them (ignoring the first element) to this device's file descriptor
862 * (/dev/net/tun). 918 * (/dev/net/tun).
863 */ 919 */
864static void handle_net_output(int fd, struct virtqueue *vq) 920static void handle_net_output(int fd, struct virtqueue *vq, bool timeout)
865{ 921{
866 unsigned int head, out, in; 922 unsigned int head, out, in, num = 0;
867 int len; 923 int len;
868 struct iovec iov[vq->vring.num]; 924 struct iovec iov[vq->vring.num];
925 static int last_timeout_num;
869 926
870 /* Keep getting output buffers from the Guest until we run out. */ 927 /* Keep getting output buffers from the Guest until we run out. */
871 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) { 928 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) {
872 if (in) 929 if (in)
873 errx(1, "Input buffers in output queue?"); 930 errx(1, "Input buffers in output queue?");
874 /* Check header, but otherwise ignore it (we told the Guest we 931 len = writev(vq->dev->fd, iov, out);
875 * supported no features, so it shouldn't have anything 932 if (len < 0)
876 * interesting). */ 933 err(1, "Writing network packet to tun");
877 (void)convert(&iov[0], struct virtio_net_hdr);
878 len = writev(vq->dev->fd, iov+1, out-1);
879 add_used_and_trigger(fd, vq, head, len); 934 add_used_and_trigger(fd, vq, head, len);
935 num++;
936 }
937
938 /* Block further kicks and set up a timer if we saw anything. */
939 if (!timeout && num)
940 block_vq(vq);
941
942 if (timeout) {
943 if (num < last_timeout_num)
944 timeout_usec += 10;
945 else if (timeout_usec > 1)
946 timeout_usec--;
947 last_timeout_num = num;
880 } 948 }
881} 949}
882 950
@@ -887,7 +955,6 @@ static bool handle_tun_input(int fd, struct device *dev)
887 unsigned int head, in_num, out_num; 955 unsigned int head, in_num, out_num;
888 int len; 956 int len;
889 struct iovec iov[dev->vq->vring.num]; 957 struct iovec iov[dev->vq->vring.num];
890 struct virtio_net_hdr *hdr;
891 958
892 /* First we need a network buffer from the Guests's recv virtqueue. */ 959 /* First we need a network buffer from the Guests's recv virtqueue. */
893 head = get_vq_desc(dev->vq, iov, &out_num, &in_num); 960 head = get_vq_desc(dev->vq, iov, &out_num, &in_num);
@@ -896,25 +963,23 @@ static bool handle_tun_input(int fd, struct device *dev)
896 * early, the Guest won't be ready yet. Wait until the device 963 * early, the Guest won't be ready yet. Wait until the device
897 * status says it's ready. */ 964 * status says it's ready. */
898 /* FIXME: Actually want DRIVER_ACTIVE here. */ 965 /* FIXME: Actually want DRIVER_ACTIVE here. */
899 if (dev->desc->status & VIRTIO_CONFIG_S_DRIVER_OK) 966
900 warn("network: no dma buffer!"); 967 /* Now tell it we want to know if new things appear. */
968 dev->vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
969 wmb();
970
901 /* We'll turn this back on if input buffers are registered. */ 971 /* We'll turn this back on if input buffers are registered. */
902 return false; 972 return false;
903 } else if (out_num) 973 } else if (out_num)
904 errx(1, "Output buffers in network recv queue?"); 974 errx(1, "Output buffers in network recv queue?");
905 975
906 /* First element is the header: we set it to 0 (no features). */
907 hdr = convert(&iov[0], struct virtio_net_hdr);
908 hdr->flags = 0;
909 hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE;
910
911 /* Read the packet from the device directly into the Guest's buffer. */ 976 /* Read the packet from the device directly into the Guest's buffer. */
912 len = readv(dev->fd, iov+1, in_num-1); 977 len = readv(dev->fd, iov, in_num);
913 if (len <= 0) 978 if (len <= 0)
914 err(1, "reading network"); 979 err(1, "reading network");
915 980
916 /* Tell the Guest about the new packet. */ 981 /* Tell the Guest about the new packet. */
917 add_used_and_trigger(fd, dev->vq, head, sizeof(*hdr) + len); 982 add_used_and_trigger(fd, dev->vq, head, len);
918 983
919 verbose("tun input packet len %i [%02x %02x] (%s)\n", len, 984 verbose("tun input packet len %i [%02x %02x] (%s)\n", len,
920 ((u8 *)iov[1].iov_base)[0], ((u8 *)iov[1].iov_base)[1], 985 ((u8 *)iov[1].iov_base)[0], ((u8 *)iov[1].iov_base)[1],
@@ -927,11 +992,18 @@ static bool handle_tun_input(int fd, struct device *dev)
927/*L:215 This is the callback attached to the network and console input 992/*L:215 This is the callback attached to the network and console input
928 * virtqueues: it ensures we try again, in case we stopped console or net 993 * virtqueues: it ensures we try again, in case we stopped console or net
929 * delivery because Guest didn't have any buffers. */ 994 * delivery because Guest didn't have any buffers. */
930static void enable_fd(int fd, struct virtqueue *vq) 995static void enable_fd(int fd, struct virtqueue *vq, bool timeout)
931{ 996{
932 add_device_fd(vq->dev->fd); 997 add_device_fd(vq->dev->fd);
933 /* Tell waker to listen to it again */ 998 /* Snap the Waker out of its select loop. */
934 write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd)); 999 write(waker_fds.pipe[1], "", 1);
1000}
1001
1002static void net_enable_fd(int fd, struct virtqueue *vq, bool timeout)
1003{
1004 /* We don't need to know again when Guest refills receive buffer. */
1005 vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
1006 enable_fd(fd, vq, timeout);
935} 1007}
936 1008
937/* When the Guest tells us they updated the status field, we handle it. */ 1009/* When the Guest tells us they updated the status field, we handle it. */
@@ -951,7 +1023,7 @@ static void update_device_status(struct device *dev)
951 for (vq = dev->vq; vq; vq = vq->next) { 1023 for (vq = dev->vq; vq; vq = vq->next) {
952 memset(vq->vring.desc, 0, 1024 memset(vq->vring.desc, 0,
953 vring_size(vq->config.num, getpagesize())); 1025 vring_size(vq->config.num, getpagesize()));
954 vq->last_avail_idx = 0; 1026 lg_last_avail(vq) = 0;
955 } 1027 }
956 } else if (dev->desc->status & VIRTIO_CONFIG_S_FAILED) { 1028 } else if (dev->desc->status & VIRTIO_CONFIG_S_FAILED) {
957 warnx("Device %s configuration FAILED", dev->name); 1029 warnx("Device %s configuration FAILED", dev->name);
@@ -960,10 +1032,10 @@ static void update_device_status(struct device *dev)
960 1032
961 verbose("Device %s OK: offered", dev->name); 1033 verbose("Device %s OK: offered", dev->name);
962 for (i = 0; i < dev->desc->feature_len; i++) 1034 for (i = 0; i < dev->desc->feature_len; i++)
963 verbose(" %08x", get_feature_bits(dev)[i]); 1035 verbose(" %02x", get_feature_bits(dev)[i]);
964 verbose(", accepted"); 1036 verbose(", accepted");
965 for (i = 0; i < dev->desc->feature_len; i++) 1037 for (i = 0; i < dev->desc->feature_len; i++)
966 verbose(" %08x", get_feature_bits(dev) 1038 verbose(" %02x", get_feature_bits(dev)
967 [dev->desc->feature_len+i]); 1039 [dev->desc->feature_len+i]);
968 1040
969 if (dev->ready) 1041 if (dev->ready)
@@ -1000,7 +1072,7 @@ static void handle_output(int fd, unsigned long addr)
1000 if (strcmp(vq->dev->name, "console") != 0) 1072 if (strcmp(vq->dev->name, "console") != 0)
1001 verbose("Output to %s\n", vq->dev->name); 1073 verbose("Output to %s\n", vq->dev->name);
1002 if (vq->handle_output) 1074 if (vq->handle_output)
1003 vq->handle_output(fd, vq); 1075 vq->handle_output(fd, vq, false);
1004 return; 1076 return;
1005 } 1077 }
1006 } 1078 }
@@ -1014,6 +1086,29 @@ static void handle_output(int fd, unsigned long addr)
1014 strnlen(from_guest_phys(addr), guest_limit - addr)); 1086 strnlen(from_guest_phys(addr), guest_limit - addr));
1015} 1087}
1016 1088
1089static void handle_timeout(int fd)
1090{
1091 char buf[32];
1092 struct device *i;
1093 struct virtqueue *vq;
1094
1095 /* Clear the pipe */
1096 read(timeoutpipe[0], buf, sizeof(buf));
1097
1098 /* Check each device and virtqueue: flush blocked ones. */
1099 for (i = devices.dev; i; i = i->next) {
1100 for (vq = i->vq; vq; vq = vq->next) {
1101 if (!vq->blocked)
1102 continue;
1103
1104 vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
1105 vq->blocked = false;
1106 if (vq->handle_output)
1107 vq->handle_output(fd, vq, true);
1108 }
1109 }
1110}
1111
1017/* This is called when the Waker wakes us up: check for incoming file 1112/* This is called when the Waker wakes us up: check for incoming file
1018 * descriptors. */ 1113 * descriptors. */
1019static void handle_input(int fd) 1114static void handle_input(int fd)
@@ -1024,16 +1119,20 @@ static void handle_input(int fd)
1024 for (;;) { 1119 for (;;) {
1025 struct device *i; 1120 struct device *i;
1026 fd_set fds = devices.infds; 1121 fd_set fds = devices.infds;
1122 int num;
1027 1123
1124 num = select(devices.max_infd+1, &fds, NULL, NULL, &poll);
1125 /* Could get interrupted */
1126 if (num < 0)
1127 continue;
1028 /* If nothing is ready, we're done. */ 1128 /* If nothing is ready, we're done. */
1029 if (select(devices.max_infd+1, &fds, NULL, NULL, &poll) == 0) 1129 if (num == 0)
1030 break; 1130 break;
1031 1131
1032 /* Otherwise, call the device(s) which have readable file 1132 /* Otherwise, call the device(s) which have readable file
1033 * descriptors and a method of handling them. */ 1133 * descriptors and a method of handling them. */
1034 for (i = devices.dev; i; i = i->next) { 1134 for (i = devices.dev; i; i = i->next) {
1035 if (i->handle_input && FD_ISSET(i->fd, &fds)) { 1135 if (i->handle_input && FD_ISSET(i->fd, &fds)) {
1036 int dev_fd;
1037 if (i->handle_input(fd, i)) 1136 if (i->handle_input(fd, i))
1038 continue; 1137 continue;
1039 1138
@@ -1043,13 +1142,12 @@ static void handle_input(int fd)
1043 * buffers to deliver into. Console also uses 1142 * buffers to deliver into. Console also uses
1044 * it when it discovers that stdin is closed. */ 1143 * it when it discovers that stdin is closed. */
1045 FD_CLR(i->fd, &devices.infds); 1144 FD_CLR(i->fd, &devices.infds);
1046 /* Tell waker to ignore it too, by sending a
1047 * negative fd number (-1, since 0 is a valid
1048 * FD number). */
1049 dev_fd = -i->fd - 1;
1050 write(waker_fd, &dev_fd, sizeof(dev_fd));
1051 } 1145 }
1052 } 1146 }
1147
1148 /* Is this the timeout fd? */
1149 if (FD_ISSET(timeoutpipe[0], &fds))
1150 handle_timeout(fd);
1053 } 1151 }
1054} 1152}
1055 1153
@@ -1098,7 +1196,7 @@ static struct lguest_device_desc *new_dev_desc(u16 type)
1098/* Each device descriptor is followed by the description of its virtqueues. We 1196/* Each device descriptor is followed by the description of its virtqueues. We
1099 * specify how many descriptors the virtqueue is to have. */ 1197 * specify how many descriptors the virtqueue is to have. */
1100static void add_virtqueue(struct device *dev, unsigned int num_descs, 1198static void add_virtqueue(struct device *dev, unsigned int num_descs,
1101 void (*handle_output)(int fd, struct virtqueue *me)) 1199 void (*handle_output)(int, struct virtqueue *, bool))
1102{ 1200{
1103 unsigned int pages; 1201 unsigned int pages;
1104 struct virtqueue **i, *vq = malloc(sizeof(*vq)); 1202 struct virtqueue **i, *vq = malloc(sizeof(*vq));
@@ -1114,6 +1212,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
1114 vq->last_avail_idx = 0; 1212 vq->last_avail_idx = 0;
1115 vq->dev = dev; 1213 vq->dev = dev;
1116 vq->inflight = 0; 1214 vq->inflight = 0;
1215 vq->blocked = false;
1117 1216
1118 /* Initialize the configuration. */ 1217 /* Initialize the configuration. */
1119 vq->config.num = num_descs; 1218 vq->config.num = num_descs;
@@ -1246,6 +1345,24 @@ static void setup_console(void)
1246} 1345}
1247/*:*/ 1346/*:*/
1248 1347
1348static void timeout_alarm(int sig)
1349{
1350 write(timeoutpipe[1], "", 1);
1351}
1352
1353static void setup_timeout(void)
1354{
1355 if (pipe(timeoutpipe) != 0)
1356 err(1, "Creating timeout pipe");
1357
1358 if (fcntl(timeoutpipe[1], F_SETFL,
1359 fcntl(timeoutpipe[1], F_GETFL) | O_NONBLOCK) != 0)
1360 err(1, "Making timeout pipe nonblocking");
1361
1362 add_device_fd(timeoutpipe[0]);
1363 signal(SIGALRM, timeout_alarm);
1364}
1365
1249/*M:010 Inter-guest networking is an interesting area. Simplest is to have a 1366/*M:010 Inter-guest networking is an interesting area. Simplest is to have a
1250 * --sharenet=<name> option which opens or creates a named pipe. This can be 1367 * --sharenet=<name> option which opens or creates a named pipe. This can be
1251 * used to send packets to another guest in a 1:1 manner. 1368 * used to send packets to another guest in a 1:1 manner.
@@ -1264,10 +1381,25 @@ static void setup_console(void)
1264 1381
1265static u32 str2ip(const char *ipaddr) 1382static u32 str2ip(const char *ipaddr)
1266{ 1383{
1267 unsigned int byte[4]; 1384 unsigned int b[4];
1268 1385
1269 sscanf(ipaddr, "%u.%u.%u.%u", &byte[0], &byte[1], &byte[2], &byte[3]); 1386 if (sscanf(ipaddr, "%u.%u.%u.%u", &b[0], &b[1], &b[2], &b[3]) != 4)
1270 return (byte[0] << 24) | (byte[1] << 16) | (byte[2] << 8) | byte[3]; 1387 errx(1, "Failed to parse IP address '%s'", ipaddr);
1388 return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3];
1389}
1390
1391static void str2mac(const char *macaddr, unsigned char mac[6])
1392{
1393 unsigned int m[6];
1394 if (sscanf(macaddr, "%02x:%02x:%02x:%02x:%02x:%02x",
1395 &m[0], &m[1], &m[2], &m[3], &m[4], &m[5]) != 6)
1396 errx(1, "Failed to parse mac address '%s'", macaddr);
1397 mac[0] = m[0];
1398 mac[1] = m[1];
1399 mac[2] = m[2];
1400 mac[3] = m[3];
1401 mac[4] = m[4];
1402 mac[5] = m[5];
1271} 1403}
1272 1404
1273/* This code is "adapted" from libbridge: it attaches the Host end of the 1405/* This code is "adapted" from libbridge: it attaches the Host end of the
@@ -1288,6 +1420,7 @@ static void add_to_bridge(int fd, const char *if_name, const char *br_name)
1288 errx(1, "interface %s does not exist!", if_name); 1420 errx(1, "interface %s does not exist!", if_name);
1289 1421
1290 strncpy(ifr.ifr_name, br_name, IFNAMSIZ); 1422 strncpy(ifr.ifr_name, br_name, IFNAMSIZ);
1423 ifr.ifr_name[IFNAMSIZ-1] = '\0';
1291 ifr.ifr_ifindex = ifidx; 1424 ifr.ifr_ifindex = ifidx;
1292 if (ioctl(fd, SIOCBRADDIF, &ifr) < 0) 1425 if (ioctl(fd, SIOCBRADDIF, &ifr) < 0)
1293 err(1, "can't add %s to bridge %s", if_name, br_name); 1426 err(1, "can't add %s to bridge %s", if_name, br_name);
@@ -1296,64 +1429,90 @@ static void add_to_bridge(int fd, const char *if_name, const char *br_name)
1296/* This sets up the Host end of the network device with an IP address, brings 1429/* This sets up the Host end of the network device with an IP address, brings
1297 * it up so packets will flow, the copies the MAC address into the hwaddr 1430 * it up so packets will flow, the copies the MAC address into the hwaddr
1298 * pointer. */ 1431 * pointer. */
1299static void configure_device(int fd, const char *devname, u32 ipaddr, 1432static void configure_device(int fd, const char *tapif, u32 ipaddr)
1300 unsigned char hwaddr[6])
1301{ 1433{
1302 struct ifreq ifr; 1434 struct ifreq ifr;
1303 struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr; 1435 struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr;
1304 1436
1305 /* Don't read these incantations. Just cut & paste them like I did! */
1306 memset(&ifr, 0, sizeof(ifr)); 1437 memset(&ifr, 0, sizeof(ifr));
1307 strcpy(ifr.ifr_name, devname); 1438 strcpy(ifr.ifr_name, tapif);
1439
1440 /* Don't read these incantations. Just cut & paste them like I did! */
1308 sin->sin_family = AF_INET; 1441 sin->sin_family = AF_INET;
1309 sin->sin_addr.s_addr = htonl(ipaddr); 1442 sin->sin_addr.s_addr = htonl(ipaddr);
1310 if (ioctl(fd, SIOCSIFADDR, &ifr) != 0) 1443 if (ioctl(fd, SIOCSIFADDR, &ifr) != 0)
1311 err(1, "Setting %s interface address", devname); 1444 err(1, "Setting %s interface address", tapif);
1312 ifr.ifr_flags = IFF_UP; 1445 ifr.ifr_flags = IFF_UP;
1313 if (ioctl(fd, SIOCSIFFLAGS, &ifr) != 0) 1446 if (ioctl(fd, SIOCSIFFLAGS, &ifr) != 0)
1314 err(1, "Bringing interface %s up", devname); 1447 err(1, "Bringing interface %s up", tapif);
1448}
1449
1450static void get_mac(int fd, const char *tapif, unsigned char hwaddr[6])
1451{
1452 struct ifreq ifr;
1453
1454 memset(&ifr, 0, sizeof(ifr));
1455 strcpy(ifr.ifr_name, tapif);
1315 1456
1316 /* SIOC stands for Socket I/O Control. G means Get (vs S for Set 1457 /* SIOC stands for Socket I/O Control. G means Get (vs S for Set
1317 * above). IF means Interface, and HWADDR is hardware address. 1458 * above). IF means Interface, and HWADDR is hardware address.
1318 * Simple! */ 1459 * Simple! */
1319 if (ioctl(fd, SIOCGIFHWADDR, &ifr) != 0) 1460 if (ioctl(fd, SIOCGIFHWADDR, &ifr) != 0)
1320 err(1, "getting hw address for %s", devname); 1461 err(1, "getting hw address for %s", tapif);
1321 memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, 6); 1462 memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, 6);
1322} 1463}
1323 1464
1324/*L:195 Our network is a Host<->Guest network. This can either use bridging or 1465static int get_tun_device(char tapif[IFNAMSIZ])
1325 * routing, but the principle is the same: it uses the "tun" device to inject
1326 * packets into the Host as if they came in from a normal network card. We
1327 * just shunt packets between the Guest and the tun device. */
1328static void setup_tun_net(const char *arg)
1329{ 1466{
1330 struct device *dev;
1331 struct ifreq ifr; 1467 struct ifreq ifr;
1332 int netfd, ipfd; 1468 int netfd;
1333 u32 ip; 1469
1334 const char *br_name = NULL; 1470 /* Start with this zeroed. Messy but sure. */
1335 struct virtio_net_config conf; 1471 memset(&ifr, 0, sizeof(ifr));
1336 1472
1337 /* We open the /dev/net/tun device and tell it we want a tap device. A 1473 /* We open the /dev/net/tun device and tell it we want a tap device. A
1338 * tap device is like a tun device, only somehow different. To tell 1474 * tap device is like a tun device, only somehow different. To tell
1339 * the truth, I completely blundered my way through this code, but it 1475 * the truth, I completely blundered my way through this code, but it
1340 * works now! */ 1476 * works now! */
1341 netfd = open_or_die("/dev/net/tun", O_RDWR); 1477 netfd = open_or_die("/dev/net/tun", O_RDWR);
1342 memset(&ifr, 0, sizeof(ifr)); 1478 ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_VNET_HDR;
1343 ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
1344 strcpy(ifr.ifr_name, "tap%d"); 1479 strcpy(ifr.ifr_name, "tap%d");
1345 if (ioctl(netfd, TUNSETIFF, &ifr) != 0) 1480 if (ioctl(netfd, TUNSETIFF, &ifr) != 0)
1346 err(1, "configuring /dev/net/tun"); 1481 err(1, "configuring /dev/net/tun");
1482
1483 if (ioctl(netfd, TUNSETOFFLOAD,
1484 TUN_F_CSUM|TUN_F_TSO4|TUN_F_TSO6|TUN_F_TSO_ECN) != 0)
1485 err(1, "Could not set features for tun device");
1486
1347 /* We don't need checksums calculated for packets coming in this 1487 /* We don't need checksums calculated for packets coming in this
1348 * device: trust us! */ 1488 * device: trust us! */
1349 ioctl(netfd, TUNSETNOCSUM, 1); 1489 ioctl(netfd, TUNSETNOCSUM, 1);
1350 1490
1491 memcpy(tapif, ifr.ifr_name, IFNAMSIZ);
1492 return netfd;
1493}
1494
1495/*L:195 Our network is a Host<->Guest network. This can either use bridging or
1496 * routing, but the principle is the same: it uses the "tun" device to inject
1497 * packets into the Host as if they came in from a normal network card. We
1498 * just shunt packets between the Guest and the tun device. */
1499static void setup_tun_net(char *arg)
1500{
1501 struct device *dev;
1502 int netfd, ipfd;
1503 u32 ip = INADDR_ANY;
1504 bool bridging = false;
1505 char tapif[IFNAMSIZ], *p;
1506 struct virtio_net_config conf;
1507
1508 netfd = get_tun_device(tapif);
1509
1351 /* First we create a new network device. */ 1510 /* First we create a new network device. */
1352 dev = new_device("net", VIRTIO_ID_NET, netfd, handle_tun_input); 1511 dev = new_device("net", VIRTIO_ID_NET, netfd, handle_tun_input);
1353 1512
1354 /* Network devices need a receive and a send queue, just like 1513 /* Network devices need a receive and a send queue, just like
1355 * console. */ 1514 * console. */
1356 add_virtqueue(dev, VIRTQUEUE_NUM, enable_fd); 1515 add_virtqueue(dev, VIRTQUEUE_NUM, net_enable_fd);
1357 add_virtqueue(dev, VIRTQUEUE_NUM, handle_net_output); 1516 add_virtqueue(dev, VIRTQUEUE_NUM, handle_net_output);
1358 1517
1359 /* We need a socket to perform the magic network ioctls to bring up the 1518 /* We need a socket to perform the magic network ioctls to bring up the
@@ -1364,28 +1523,56 @@ static void setup_tun_net(const char *arg)
1364 1523
1365 /* If the command line was --tunnet=bridge:<name> do bridging. */ 1524 /* If the command line was --tunnet=bridge:<name> do bridging. */
1366 if (!strncmp(BRIDGE_PFX, arg, strlen(BRIDGE_PFX))) { 1525 if (!strncmp(BRIDGE_PFX, arg, strlen(BRIDGE_PFX))) {
1367 ip = INADDR_ANY; 1526 arg += strlen(BRIDGE_PFX);
1368 br_name = arg + strlen(BRIDGE_PFX); 1527 bridging = true;
1369 add_to_bridge(ipfd, ifr.ifr_name, br_name); 1528 }
1370 } else /* It is an IP address to set up the device with */ 1529
1530 /* A mac address may follow the bridge name or IP address */
1531 p = strchr(arg, ':');
1532 if (p) {
1533 str2mac(p+1, conf.mac);
1534 *p = '\0';
1535 } else {
1536 p = arg + strlen(arg);
1537 /* None supplied; query the randomly assigned mac. */
1538 get_mac(ipfd, tapif, conf.mac);
1539 }
1540
1541 /* arg is now either an IP address or a bridge name */
1542 if (bridging)
1543 add_to_bridge(ipfd, tapif, arg);
1544 else
1371 ip = str2ip(arg); 1545 ip = str2ip(arg);
1372 1546
1373 /* Set up the tun device, and get the mac address for the interface. */ 1547 /* Set up the tun device. */
1374 configure_device(ipfd, ifr.ifr_name, ip, conf.mac); 1548 configure_device(ipfd, tapif, ip);
1375 1549
1376 /* Tell Guest what MAC address to use. */ 1550 /* Tell Guest what MAC address to use. */
1377 add_feature(dev, VIRTIO_NET_F_MAC); 1551 add_feature(dev, VIRTIO_NET_F_MAC);
1378 add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY); 1552 add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY);
1553 /* Expect Guest to handle everything except UFO */
1554 add_feature(dev, VIRTIO_NET_F_CSUM);
1555 add_feature(dev, VIRTIO_NET_F_GUEST_CSUM);
1556 add_feature(dev, VIRTIO_NET_F_MAC);
1557 add_feature(dev, VIRTIO_NET_F_GUEST_TSO4);
1558 add_feature(dev, VIRTIO_NET_F_GUEST_TSO6);
1559 add_feature(dev, VIRTIO_NET_F_GUEST_ECN);
1560 add_feature(dev, VIRTIO_NET_F_HOST_TSO4);
1561 add_feature(dev, VIRTIO_NET_F_HOST_TSO6);
1562 add_feature(dev, VIRTIO_NET_F_HOST_ECN);
1379 set_config(dev, sizeof(conf), &conf); 1563 set_config(dev, sizeof(conf), &conf);
1380 1564
1381 /* We don't need the socket any more; setup is done. */ 1565 /* We don't need the socket any more; setup is done. */
1382 close(ipfd); 1566 close(ipfd);
1383 1567
1384 verbose("device %u: tun net %u.%u.%u.%u\n", 1568 devices.device_num++;
1385 devices.device_num++, 1569
1386 (u8)(ip>>24),(u8)(ip>>16),(u8)(ip>>8),(u8)ip); 1570 if (bridging)
1387 if (br_name) 1571 verbose("device %u: tun %s attached to bridge: %s\n",
1388 verbose("attached to bridge: %s\n", br_name); 1572 devices.device_num, tapif, arg);
1573 else
1574 verbose("device %u: tun %s: %s\n",
1575 devices.device_num, tapif, arg);
1389} 1576}
1390 1577
1391/* Our block (disk) device should be really simple: the Guest asks for a block 1578/* Our block (disk) device should be really simple: the Guest asks for a block
@@ -1550,7 +1737,7 @@ static bool handle_io_finish(int fd, struct device *dev)
1550} 1737}
1551 1738
1552/* When the Guest submits some I/O, we just need to wake the I/O thread. */ 1739/* When the Guest submits some I/O, we just need to wake the I/O thread. */
1553static void handle_virtblk_output(int fd, struct virtqueue *vq) 1740static void handle_virtblk_output(int fd, struct virtqueue *vq, bool timeout)
1554{ 1741{
1555 struct vblk_info *vblk = vq->dev->priv; 1742 struct vblk_info *vblk = vq->dev->priv;
1556 char c = 0; 1743 char c = 0;
@@ -1621,6 +1808,64 @@ static void setup_block_file(const char *filename)
1621 verbose("device %u: virtblock %llu sectors\n", 1808 verbose("device %u: virtblock %llu sectors\n",
1622 devices.device_num, le64_to_cpu(conf.capacity)); 1809 devices.device_num, le64_to_cpu(conf.capacity));
1623} 1810}
1811
1812/* Our random number generator device reads from /dev/random into the Guest's
1813 * input buffers. The usual case is that the Guest doesn't want random numbers
1814 * and so has no buffers although /dev/random is still readable, whereas
1815 * console is the reverse.
1816 *
1817 * The same logic applies, however. */
1818static bool handle_rng_input(int fd, struct device *dev)
1819{
1820 int len;
1821 unsigned int head, in_num, out_num, totlen = 0;
1822 struct iovec iov[dev->vq->vring.num];
1823
1824 /* First we need a buffer from the Guests's virtqueue. */
1825 head = get_vq_desc(dev->vq, iov, &out_num, &in_num);
1826
1827 /* If they're not ready for input, stop listening to this file
1828 * descriptor. We'll start again once they add an input buffer. */
1829 if (head == dev->vq->vring.num)
1830 return false;
1831
1832 if (out_num)
1833 errx(1, "Output buffers in rng?");
1834
1835 /* This is why we convert to iovecs: the readv() call uses them, and so
1836 * it reads straight into the Guest's buffer. We loop to make sure we
1837 * fill it. */
1838 while (!iov_empty(iov, in_num)) {
1839 len = readv(dev->fd, iov, in_num);
1840 if (len <= 0)
1841 err(1, "Read from /dev/random gave %i", len);
1842 iov_consume(iov, in_num, len);
1843 totlen += len;
1844 }
1845
1846 /* Tell the Guest about the new input. */
1847 add_used_and_trigger(fd, dev->vq, head, totlen);
1848
1849 /* Everything went OK! */
1850 return true;
1851}
1852
1853/* And this creates a "hardware" random number device for the Guest. */
1854static void setup_rng(void)
1855{
1856 struct device *dev;
1857 int fd;
1858
1859 fd = open_or_die("/dev/random", O_RDONLY);
1860
1861 /* The device responds to return from I/O thread. */
1862 dev = new_device("rng", VIRTIO_ID_RNG, fd, handle_rng_input);
1863
1864 /* The device has one virtqueue, where the Guest places inbufs. */
1865 add_virtqueue(dev, VIRTQUEUE_NUM, enable_fd);
1866
1867 verbose("device %u: rng\n", devices.device_num++);
1868}
1624/* That's the end of device setup. */ 1869/* That's the end of device setup. */
1625 1870
1626/*L:230 Reboot is pretty easy: clean up and exec() the Launcher afresh. */ 1871/*L:230 Reboot is pretty easy: clean up and exec() the Launcher afresh. */
@@ -1628,11 +1873,12 @@ static void __attribute__((noreturn)) restart_guest(void)
1628{ 1873{
1629 unsigned int i; 1874 unsigned int i;
1630 1875
1631 /* Closing pipes causes the Waker thread and io_threads to die, and 1876 /* Since we don't track all open fds, we simply close everything beyond
1632 * closing /dev/lguest cleans up the Guest. Since we don't track all 1877 * stderr. */
1633 * open fds, we simply close everything beyond stderr. */
1634 for (i = 3; i < FD_SETSIZE; i++) 1878 for (i = 3; i < FD_SETSIZE; i++)
1635 close(i); 1879 close(i);
1880
1881 /* The exec automatically gets rid of the I/O and Waker threads. */
1636 execv(main_args[0], main_args); 1882 execv(main_args[0], main_args);
1637 err(1, "Could not exec %s", main_args[0]); 1883 err(1, "Could not exec %s", main_args[0]);
1638} 1884}
@@ -1663,7 +1909,7 @@ static void __attribute__((noreturn)) run_guest(int lguest_fd)
1663 /* ERESTART means that we need to reboot the guest */ 1909 /* ERESTART means that we need to reboot the guest */
1664 } else if (errno == ERESTART) { 1910 } else if (errno == ERESTART) {
1665 restart_guest(); 1911 restart_guest();
1666 /* EAGAIN means the Waker wanted us to look at some input. 1912 /* EAGAIN means a signal (timeout).
1667 * Anything else means a bug or incompatible change. */ 1913 * Anything else means a bug or incompatible change. */
1668 } else if (errno != EAGAIN) 1914 } else if (errno != EAGAIN)
1669 err(1, "Running guest failed"); 1915 err(1, "Running guest failed");
@@ -1691,13 +1937,14 @@ static struct option opts[] = {
1691 { "verbose", 0, NULL, 'v' }, 1937 { "verbose", 0, NULL, 'v' },
1692 { "tunnet", 1, NULL, 't' }, 1938 { "tunnet", 1, NULL, 't' },
1693 { "block", 1, NULL, 'b' }, 1939 { "block", 1, NULL, 'b' },
1940 { "rng", 0, NULL, 'r' },
1694 { "initrd", 1, NULL, 'i' }, 1941 { "initrd", 1, NULL, 'i' },
1695 { NULL }, 1942 { NULL },
1696}; 1943};
1697static void usage(void) 1944static void usage(void)
1698{ 1945{
1699 errx(1, "Usage: lguest [--verbose] " 1946 errx(1, "Usage: lguest [--verbose] "
1700 "[--tunnet=(<ipaddr>|bridge:<bridgename>)\n" 1947 "[--tunnet=(<ipaddr>:<macaddr>|bridge:<bridgename>:<macaddr>)\n"
1701 "|--block=<filename>|--initrd=<filename>]...\n" 1948 "|--block=<filename>|--initrd=<filename>]...\n"
1702 "<mem-in-mb> vmlinux [args...]"); 1949 "<mem-in-mb> vmlinux [args...]");
1703} 1950}
@@ -1765,6 +2012,9 @@ int main(int argc, char *argv[])
1765 case 'b': 2012 case 'b':
1766 setup_block_file(optarg); 2013 setup_block_file(optarg);
1767 break; 2014 break;
2015 case 'r':
2016 setup_rng();
2017 break;
1768 case 'i': 2018 case 'i':
1769 initrd_name = optarg; 2019 initrd_name = optarg;
1770 break; 2020 break;
@@ -1783,6 +2033,9 @@ int main(int argc, char *argv[])
1783 /* We always have a console device */ 2033 /* We always have a console device */
1784 setup_console(); 2034 setup_console();
1785 2035
2036 /* We can timeout waiting for Guest network transmit. */
2037 setup_timeout();
2038
1786 /* Now we load the kernel */ 2039 /* Now we load the kernel */
1787 start = load_kernel(open_or_die(argv[optind+1], O_RDONLY)); 2040 start = load_kernel(open_or_die(argv[optind+1], O_RDONLY));
1788 2041
@@ -1826,10 +2079,10 @@ int main(int argc, char *argv[])
1826 * /dev/lguest file descriptor. */ 2079 * /dev/lguest file descriptor. */
1827 lguest_fd = tell_kernel(pgdir, start); 2080 lguest_fd = tell_kernel(pgdir, start);
1828 2081
1829 /* We fork off a child process, which wakes the Launcher whenever one 2082 /* We clone off a thread, which wakes the Launcher whenever one of the
1830 * of the input file descriptors needs attention. We call this the 2083 * input file descriptors needs attention. We call this the Waker, and
1831 * Waker, and we'll cover it in a moment. */ 2084 * we'll cover it in a moment. */
1832 waker_fd = setup_waker(lguest_fd); 2085 setup_waker(lguest_fd);
1833 2086
1834 /* Finally, run the Guest. This doesn't return. */ 2087 /* Finally, run the Guest. This doesn't return. */
1835 run_guest(lguest_fd); 2088 run_guest(lguest_fd);
diff --git a/Documentation/power/power_supply_class.txt b/Documentation/power/power_supply_class.txt
index a8686e5a6857..c6cd4956047c 100644
--- a/Documentation/power/power_supply_class.txt
+++ b/Documentation/power/power_supply_class.txt
@@ -101,6 +101,10 @@ of charge when battery became full/empty". It also could mean "value of
101charge when battery considered full/empty at given conditions (temperature, 101charge when battery considered full/empty at given conditions (temperature,
102age)". I.e. these attributes represents real thresholds, not design values. 102age)". I.e. these attributes represents real thresholds, not design values.
103 103
104CHARGE_COUNTER - the current charge counter (in µAh). This could easily
105be negative; there is no empty or full value. It is only useful for
106relative, time-based measurements.
107
104ENERGY_FULL, ENERGY_EMPTY - same as above but for energy. 108ENERGY_FULL, ENERGY_EMPTY - same as above but for energy.
105 109
106CAPACITY - capacity in percents. 110CAPACITY - capacity in percents.
diff --git a/Documentation/power/regulator/consumer.txt b/Documentation/power/regulator/consumer.txt
new file mode 100644
index 000000000000..82b7a43aadba
--- /dev/null
+++ b/Documentation/power/regulator/consumer.txt
@@ -0,0 +1,182 @@
1Regulator Consumer Driver Interface
2===================================
3
4This text describes the regulator interface for consumer device drivers.
5Please see overview.txt for a description of the terms used in this text.
6
7
81. Consumer Regulator Access (static & dynamic drivers)
9=======================================================
10
11A consumer driver can get access to it's supply regulator by calling :-
12
13regulator = regulator_get(dev, "Vcc");
14
15The consumer passes in it's struct device pointer and power supply ID. The core
16then finds the correct regulator by consulting a machine specific lookup table.
17If the lookup is successful then this call will return a pointer to the struct
18regulator that supplies this consumer.
19
20To release the regulator the consumer driver should call :-
21
22regulator_put(regulator);
23
24Consumers can be supplied by more than one regulator e.g. codec consumer with
25analog and digital supplies :-
26
27digital = regulator_get(dev, "Vcc"); /* digital core */
28analog = regulator_get(dev, "Avdd"); /* analog */
29
30The regulator access functions regulator_get() and regulator_put() will
31usually be called in your device drivers probe() and remove() respectively.
32
33
342. Regulator Output Enable & Disable (static & dynamic drivers)
35====================================================================
36
37A consumer can enable it's power supply by calling:-
38
39int regulator_enable(regulator);
40
41NOTE: The supply may already be enabled before regulator_enabled() is called.
42This may happen if the consumer shares the regulator or the regulator has been
43previously enabled by bootloader or kernel board initialization code.
44
45A consumer can determine if a regulator is enabled by calling :-
46
47int regulator_is_enabled(regulator);
48
49This will return > zero when the regulator is enabled.
50
51
52A consumer can disable it's supply when no longer needed by calling :-
53
54int regulator_disable(regulator);
55
56NOTE: This may not disable the supply if it's shared with other consumers. The
57regulator will only be disabled when the enabled reference count is zero.
58
59Finally, a regulator can be forcefully disabled in the case of an emergency :-
60
61int regulator_force_disable(regulator);
62
63NOTE: this will immediately and forcefully shutdown the regulator output. All
64consumers will be powered off.
65
66
673. Regulator Voltage Control & Status (dynamic drivers)
68======================================================
69
70Some consumer drivers need to be able to dynamically change their supply
71voltage to match system operating points. e.g. CPUfreq drivers can scale
72voltage along with frequency to save power, SD drivers may need to select the
73correct card voltage, etc.
74
75Consumers can control their supply voltage by calling :-
76
77int regulator_set_voltage(regulator, min_uV, max_uV);
78
79Where min_uV and max_uV are the minimum and maximum acceptable voltages in
80microvolts.
81
82NOTE: this can be called when the regulator is enabled or disabled. If called
83when enabled, then the voltage changes instantly, otherwise the voltage
84configuration changes and the voltage is physically set when the regulator is
85next enabled.
86
87The regulators configured voltage output can be found by calling :-
88
89int regulator_get_voltage(regulator);
90
91NOTE: get_voltage() will return the configured output voltage whether the
92regulator is enabled or disabled and should NOT be used to determine regulator
93output state. However this can be used in conjunction with is_enabled() to
94determine the regulator physical output voltage.
95
96
974. Regulator Current Limit Control & Status (dynamic drivers)
98===========================================================
99
100Some consumer drivers need to be able to dynamically change their supply
101current limit to match system operating points. e.g. LCD backlight driver can
102change the current limit to vary the backlight brightness, USB drivers may want
103to set the limit to 500mA when supplying power.
104
105Consumers can control their supply current limit by calling :-
106
107int regulator_set_current_limit(regulator, min_uV, max_uV);
108
109Where min_uA and max_uA are the minimum and maximum acceptable current limit in
110microamps.
111
112NOTE: this can be called when the regulator is enabled or disabled. If called
113when enabled, then the current limit changes instantly, otherwise the current
114limit configuration changes and the current limit is physically set when the
115regulator is next enabled.
116
117A regulators current limit can be found by calling :-
118
119int regulator_get_current_limit(regulator);
120
121NOTE: get_current_limit() will return the current limit whether the regulator
122is enabled or disabled and should not be used to determine regulator current
123load.
124
125
1265. Regulator Operating Mode Control & Status (dynamic drivers)
127=============================================================
128
129Some consumers can further save system power by changing the operating mode of
130their supply regulator to be more efficient when the consumers operating state
131changes. e.g. consumer driver is idle and subsequently draws less current
132
133Regulator operating mode can be changed indirectly or directly.
134
135Indirect operating mode control.
136--------------------------------
137Consumer drivers can request a change in their supply regulator operating mode
138by calling :-
139
140int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);
141
142This will cause the core to recalculate the total load on the regulator (based
143on all it's consumers) and change operating mode (if necessary and permitted)
144to best match the current operating load.
145
146The load_uA value can be determined from the consumers datasheet. e.g.most
147datasheets have tables showing the max current consumed in certain situations.
148
149Most consumers will use indirect operating mode control since they have no
150knowledge of the regulator or whether the regulator is shared with other
151consumers.
152
153Direct operating mode control.
154------------------------------
155Bespoke or tightly coupled drivers may want to directly control regulator
156operating mode depending on their operating point. This can be achieved by
157calling :-
158
159int regulator_set_mode(struct regulator *regulator, unsigned int mode);
160unsigned int regulator_get_mode(struct regulator *regulator);
161
162Direct mode will only be used by consumers that *know* about the regulator and
163are not sharing the regulator with other consumers.
164
165
1666. Regulator Events
167===================
168Regulators can notify consumers of external events. Events could be received by
169consumers under regulator stress or failure conditions.
170
171Consumers can register interest in regulator events by calling :-
172
173int regulator_register_notifier(struct regulator *regulator,
174 struct notifier_block *nb);
175
176Consumers can uregister interest by calling :-
177
178int regulator_unregister_notifier(struct regulator *regulator,
179 struct notifier_block *nb);
180
181Regulators use the kernel notifier framework to send event to thier interested
182consumers.
diff --git a/Documentation/power/regulator/machine.txt b/Documentation/power/regulator/machine.txt
new file mode 100644
index 000000000000..c9a35665cf70
--- /dev/null
+++ b/Documentation/power/regulator/machine.txt
@@ -0,0 +1,101 @@
1Regulator Machine Driver Interface
2===================================
3
4The regulator machine driver interface is intended for board/machine specific
5initialisation code to configure the regulator subsystem. Typical things that
6machine drivers would do are :-
7
8 1. Regulator -> Device mapping.
9 2. Regulator supply configuration.
10 3. Power Domain constraint setting.
11
12
13
141. Regulator -> device mapping
15==============================
16Consider the following machine :-
17
18 Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
19 |
20 +-> [Consumer B @ 3.3V]
21
22The drivers for consumers A & B must be mapped to the correct regulator in
23order to control their power supply. This mapping can be achieved in machine
24initialisation code by calling :-
25
26int regulator_set_device_supply(const char *regulator, struct device *dev,
27 const char *supply);
28
29and is shown with the following code :-
30
31regulator_set_device_supply("Regulator-1", devB, "Vcc");
32regulator_set_device_supply("Regulator-2", devA, "Vcc");
33
34This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2
35to the 'Vcc' supply for Consumer A.
36
37
382. Regulator supply configuration.
39==================================
40Consider the following machine (again) :-
41
42 Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
43 |
44 +-> [Consumer B @ 3.3V]
45
46Regulator-1 supplies power to Regulator-2. This relationship must be registered
47with the core so that Regulator-1 is also enabled when Consumer A enables it's
48supply (Regulator-2).
49
50This relationship can be register with the core via :-
51
52int regulator_set_supply(const char *regulator, const char *regulator_supply);
53
54In this example we would use the following code :-
55
56regulator_set_supply("Regulator-2", "Regulator-1");
57
58Relationships can be queried by calling :-
59
60const char *regulator_get_supply(const char *regulator);
61
62
633. Power Domain constraint setting.
64===================================
65Each power domain within a system has physical constraints on voltage and
66current. This must be defined in software so that the power domain is always
67operated within specifications.
68
69Consider the following machine (again) :-
70
71 Regulator-1 -+-> Regulator-2 --> [Consumer A @ 1.8 - 2.0V]
72 |
73 +-> [Consumer B @ 3.3V]
74
75This gives us two regulators and two power domains:
76
77 Domain 1: Regulator-2, Consumer B.
78 Domain 2: Consumer A.
79
80Constraints can be registered by calling :-
81
82int regulator_set_platform_constraints(const char *regulator,
83 struct regulation_constraints *constraints);
84
85The example is defined as follows :-
86
87struct regulation_constraints domain_1 = {
88 .min_uV = 3300000,
89 .max_uV = 3300000,
90 .valid_modes_mask = REGULATOR_MODE_NORMAL,
91};
92
93struct regulation_constraints domain_2 = {
94 .min_uV = 1800000,
95 .max_uV = 2000000,
96 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
97 .valid_modes_mask = REGULATOR_MODE_NORMAL,
98};
99
100regulator_set_platform_constraints("Regulator-1", &domain_1);
101regulator_set_platform_constraints("Regulator-2", &domain_2);
diff --git a/Documentation/power/regulator/overview.txt b/Documentation/power/regulator/overview.txt
new file mode 100644
index 000000000000..bdcb332bd7fb
--- /dev/null
+++ b/Documentation/power/regulator/overview.txt
@@ -0,0 +1,171 @@
1Linux voltage and current regulator framework
2=============================================
3
4About
5=====
6
7This framework is designed to provide a standard kernel interface to control
8voltage and current regulators.
9
10The intention is to allow systems to dynamically control regulator power output
11in order to save power and prolong battery life. This applies to both voltage
12regulators (where voltage output is controllable) and current sinks (where
13current limit is controllable).
14
15(C) 2008 Wolfson Microelectronics PLC.
16Author: Liam Girdwood <lg@opensource.wolfsonmicro.com>
17
18
19Nomenclature
20============
21
22Some terms used in this document:-
23
24 o Regulator - Electronic device that supplies power to other devices.
25 Most regulators can enable and disable their output whilst
26 some can control their output voltage and or current.
27
28 Input Voltage -> Regulator -> Output Voltage
29
30
31 o PMIC - Power Management IC. An IC that contains numerous regulators
32 and often contains other susbsystems.
33
34
35 o Consumer - Electronic device that is supplied power by a regulator.
36 Consumers can be classified into two types:-
37
38 Static: consumer does not change it's supply voltage or
39 current limit. It only needs to enable or disable it's
40 power supply. It's supply voltage is set by the hardware,
41 bootloader, firmware or kernel board initialisation code.
42
43 Dynamic: consumer needs to change it's supply voltage or
44 current limit to meet operation demands.
45
46
47 o Power Domain - Electronic circuit that is supplied it's input power by the
48 output power of a regulator, switch or by another power
49 domain.
50
51 The supply regulator may be behind a switch(s). i.e.
52
53 Regulator -+-> Switch-1 -+-> Switch-2 --> [Consumer A]
54 | |
55 | +-> [Consumer B], [Consumer C]
56 |
57 +-> [Consumer D], [Consumer E]
58
59 That is one regulator and three power domains:
60
61 Domain 1: Switch-1, Consumers D & E.
62 Domain 2: Switch-2, Consumers B & C.
63 Domain 3: Consumer A.
64
65 and this represents a "supplies" relationship:
66
67 Domain-1 --> Domain-2 --> Domain-3.
68
69 A power domain may have regulators that are supplied power
70 by other regulators. i.e.
71
72 Regulator-1 -+-> Regulator-2 -+-> [Consumer A]
73 |
74 +-> [Consumer B]
75
76 This gives us two regulators and two power domains:
77
78 Domain 1: Regulator-2, Consumer B.
79 Domain 2: Consumer A.
80
81 and a "supplies" relationship:
82
83 Domain-1 --> Domain-2
84
85
86 o Constraints - Constraints are used to define power levels for performance
87 and hardware protection. Constraints exist at three levels:
88
89 Regulator Level: This is defined by the regulator hardware
90 operating parameters and is specified in the regulator
91 datasheet. i.e.
92
93 - voltage output is in the range 800mV -> 3500mV.
94 - regulator current output limit is 20mA @ 5V but is
95 10mA @ 10V.
96
97 Power Domain Level: This is defined in software by kernel
98 level board initialisation code. It is used to constrain a
99 power domain to a particular power range. i.e.
100
101 - Domain-1 voltage is 3300mV
102 - Domain-2 voltage is 1400mV -> 1600mV
103 - Domain-3 current limit is 0mA -> 20mA.
104
105 Consumer Level: This is defined by consumer drivers
106 dynamically setting voltage or current limit levels.
107
108 e.g. a consumer backlight driver asks for a current increase
109 from 5mA to 10mA to increase LCD illumination. This passes
110 to through the levels as follows :-
111
112 Consumer: need to increase LCD brightness. Lookup and
113 request next current mA value in brightness table (the
114 consumer driver could be used on several different
115 personalities based upon the same reference device).
116
117 Power Domain: is the new current limit within the domain
118 operating limits for this domain and system state (e.g.
119 battery power, USB power)
120
121 Regulator Domains: is the new current limit within the
122 regulator operating parameters for input/ouput voltage.
123
124 If the regulator request passes all the constraint tests
125 then the new regulator value is applied.
126
127
128Design
129======
130
131The framework is designed and targeted at SoC based devices but may also be
132relevant to non SoC devices and is split into the following four interfaces:-
133
134
135 1. Consumer driver interface.
136
137 This uses a similar API to the kernel clock interface in that consumer
138 drivers can get and put a regulator (like they can with clocks atm) and
139 get/set voltage, current limit, mode, enable and disable. This should
140 allow consumers complete control over their supply voltage and current
141 limit. This also compiles out if not in use so drivers can be reused in
142 systems with no regulator based power control.
143
144 See Documentation/power/regulator/consumer.txt
145
146 2. Regulator driver interface.
147
148 This allows regulator drivers to register their regulators and provide
149 operations to the core. It also has a notifier call chain for propagating
150 regulator events to clients.
151
152 See Documentation/power/regulator/regulator.txt
153
154 3. Machine interface.
155
156 This interface is for machine specific code and allows the creation of
157 voltage/current domains (with constraints) for each regulator. It can
158 provide regulator constraints that will prevent device damage through
159 overvoltage or over current caused by buggy client drivers. It also
160 allows the creation of a regulator tree whereby some regulators are
161 supplied by others (similar to a clock tree).
162
163 See Documentation/power/regulator/machine.txt
164
165 4. Userspace ABI.
166
167 The framework also exports a lot of useful voltage/current/opmode data to
168 userspace via sysfs. This could be used to help monitor device power
169 consumption and status.
170
171 See Documentation/ABI/testing/regulator-sysfs.txt
diff --git a/Documentation/power/regulator/regulator.txt b/Documentation/power/regulator/regulator.txt
new file mode 100644
index 000000000000..a69050143592
--- /dev/null
+++ b/Documentation/power/regulator/regulator.txt
@@ -0,0 +1,30 @@
1Regulator Driver Interface
2==========================
3
4The regulator driver interface is relatively simple and designed to allow
5regulator drivers to register their services with the core framework.
6
7
8Registration
9============
10
11Drivers can register a regulator by calling :-
12
13struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
14 void *reg_data);
15
16This will register the regulators capabilities and operations the regulator
17core. The core does not touch reg_data (private to regulator driver).
18
19Regulators can be unregistered by calling :-
20
21void regulator_unregister(struct regulator_dev *rdev);
22
23
24Regulator Events
25================
26Regulators can send events (e.g. over temp, under voltage, etc) to consumer
27drivers by calling :-
28
29int regulator_notifier_call_chain(struct regulator_dev *rdev,
30 unsigned long event, void *data);
diff --git a/Documentation/powerpc/00-INDEX b/Documentation/powerpc/00-INDEX
index 3be84aa38dfe..29d839ce7327 100644
--- a/Documentation/powerpc/00-INDEX
+++ b/Documentation/powerpc/00-INDEX
@@ -20,8 +20,6 @@ mpc52xx-device-tree-bindings.txt
20 - MPC5200 Device Tree Bindings 20 - MPC5200 Device Tree Bindings
21ppc_htab.txt 21ppc_htab.txt
22 - info about the Linux/PPC /proc/ppc_htab entry 22 - info about the Linux/PPC /proc/ppc_htab entry
23SBC8260_memory_mapping.txt
24 - EST SBC8260 board info
25smp.txt 23smp.txt
26 - use and state info about Linux/PPC on MP machines 24 - use and state info about Linux/PPC on MP machines
27sound.txt 25sound.txt
diff --git a/Documentation/powerpc/SBC8260_memory_mapping.txt b/Documentation/powerpc/SBC8260_memory_mapping.txt
deleted file mode 100644
index e6e9ee0506c3..000000000000
--- a/Documentation/powerpc/SBC8260_memory_mapping.txt
+++ /dev/null
@@ -1,197 +0,0 @@
1Please mail me (Jon Diekema, diekema_jon@si.com or diekema@cideas.com)
2if you have questions, comments or corrections.
3
4 * EST SBC8260 Linux memory mapping rules
5
6 http://www.estc.com/
7 http://www.estc.com/products/boards/SBC8260-8240_ds.html
8
9 Initial conditions:
10 -------------------
11
12 Tasks that need to be perform by the boot ROM before control is
13 transferred to zImage (compressed Linux kernel):
14
15 - Define the IMMR to 0xf0000000
16
17 - Initialize the memory controller so that RAM is available at
18 physical address 0x00000000. On the SBC8260 is this 16M (64M)
19 SDRAM.
20
21 - The boot ROM should only clear the RAM that it is using.
22
23 The reason for doing this is to enhances the chances of a
24 successful post mortem on a Linux panic. One of the first
25 items to examine is the 16k (LOG_BUF_LEN) circular console
26 buffer called log_buf which is defined in kernel/printk.c.
27
28 - To enhance boot ROM performance, the I-cache can be enabled.
29
30 Date: Mon, 22 May 2000 14:21:10 -0700
31 From: Neil Russell <caret@c-side.com>
32
33 LiMon (LInux MONitor) runs with and starts Linux with MMU
34 off, I-cache enabled, D-cache disabled. The I-cache doesn't
35 need hints from the MMU to work correctly as the D-cache
36 does. No D-cache means no special code to handle devices in
37 the presence of cache (no snooping, etc). The use of the
38 I-cache means that the monitor can run acceptably fast
39 directly from ROM, rather than having to copy it to RAM.
40
41 - Build the board information structure (see
42 include/asm-ppc/est8260.h for its definition)
43
44 - The compressed Linux kernel (zImage) contains a bootstrap loader
45 that is position independent; you can load it into any RAM,
46 ROM or FLASH memory address >= 0x00500000 (above 5 MB), or
47 at its link address of 0x00400000 (4 MB).
48
49 Note: If zImage is loaded at its link address of 0x00400000 (4 MB),
50 then zImage will skip the step of moving itself to
51 its link address.
52
53 - Load R3 with the address of the board information structure
54
55 - Transfer control to zImage
56
57 - The Linux console port is SMC1, and the baud rate is controlled
58 from the bi_baudrate field of the board information structure.
59 On thing to keep in mind when picking the baud rate, is that
60 there is no flow control on the SMC ports. I would stick
61 with something safe and standard like 19200.
62
63 On the EST SBC8260, the SMC1 port is on the COM1 connector of
64 the board.
65
66
67 EST SBC8260 defaults:
68 ---------------------
69
70 Chip
71 Memory Sel Bus Use
72 --------------------- --- --- ----------------------------------
73 0x00000000-0x03FFFFFF CS2 60x (16M or 64M)/64M SDRAM
74 0x04000000-0x04FFFFFF CS4 local 4M/16M SDRAM (soldered to the board)
75 0x21000000-0x21000000 CS7 60x 1B/64K Flash present detect (from the flash SIMM)
76 0x21000001-0x21000001 CS7 60x 1B/64K Switches (read) and LEDs (write)
77 0x22000000-0x2200FFFF CS5 60x 8K/64K EEPROM
78 0xFC000000-0xFCFFFFFF CS6 60x 2M/16M flash (8 bits wide, soldered to the board)
79 0xFE000000-0xFFFFFFFF CS0 60x 4M/16M flash (SIMM)
80
81 Notes:
82 ------
83
84 - The chip selects can map 32K blocks and up (powers of 2)
85
86 - The SDRAM machine can handled up to 128Mbytes per chip select
87
88 - Linux uses the 60x bus memory (the SDRAM DIMM) for the
89 communications buffers.
90
91 - BATs can map 128K-256Mbytes each. There are four data BATs and
92 four instruction BATs. Generally the data and instruction BATs
93 are mapped the same.
94
95 - The IMMR must be set above the kernel virtual memory addresses,
96 which start at 0xC0000000. Otherwise, the kernel may crash as
97 soon as you start any threads or processes due to VM collisions
98 in the kernel or user process space.
99
100
101 Details from Dan Malek <dan_malek@mvista.com> on 10/29/1999:
102
103 The user application virtual space consumes the first 2 Gbytes
104 (0x00000000 to 0x7FFFFFFF). The kernel virtual text starts at
105 0xC0000000, with data following. There is a "protection hole"
106 between the end of kernel data and the start of the kernel
107 dynamically allocated space, but this space is still within
108 0xCxxxxxxx.
109
110 Obviously the kernel can't map any physical addresses 1:1 in
111 these ranges.
112
113
114 Details from Dan Malek <dan_malek@mvista.com> on 5/19/2000:
115
116 During the early kernel initialization, the kernel virtual
117 memory allocator is not operational. Prior to this KVM
118 initialization, we choose to map virtual to physical addresses
119 1:1. That is, the kernel virtual address exactly matches the
120 physical address on the bus. These mappings are typically done
121 in arch/ppc/kernel/head.S, or arch/ppc/mm/init.c. Only
122 absolutely necessary mappings should be done at this time, for
123 example board control registers or a serial uart. Normal device
124 driver initialization should map resources later when necessary.
125
126 Although platform dependent, and certainly the case for embedded
127 8xx, traditionally memory is mapped at physical address zero,
128 and I/O devices above physical address 0x80000000. The lowest
129 and highest (above 0xf0000000) I/O addresses are traditionally
130 used for devices or registers we need to map during kernel
131 initialization and prior to KVM operation. For this reason,
132 and since it followed prior PowerPC platform examples, I chose
133 to map the embedded 8xx kernel to the 0xc0000000 virtual address.
134 This way, we can enable the MMU to map the kernel for proper
135 operation, and still map a few windows before the KVM is operational.
136
137 On some systems, you could possibly run the kernel at the
138 0x80000000 or any other virtual address. It just depends upon
139 mapping that must be done prior to KVM operational. You can never
140 map devices or kernel spaces that overlap with the user virtual
141 space. This is why default IMMR mapping used by most BDM tools
142 won't work. They put the IMMR at something like 0x10000000 or
143 0x02000000 for example. You simply can't map these addresses early
144 in the kernel, and continue proper system operation.
145
146 The embedded 8xx/82xx kernel is mature enough that all you should
147 need to do is map the IMMR someplace at or above 0xf0000000 and it
148 should boot far enough to get serial console messages and KGDB
149 connected on any platform. There are lots of other subtle memory
150 management design features that you simply don't need to worry
151 about. If you are changing functions related to MMU initialization,
152 you are likely breaking things that are known to work and are
153 heading down a path of disaster and frustration. Your changes
154 should be to make the flexibility of the processor fit Linux,
155 not force arbitrary and non-workable memory mappings into Linux.
156
157 - You don't want to change KERNELLOAD or KERNELBASE, otherwise the
158 virtual memory and MMU code will get confused.
159
160 arch/ppc/Makefile:KERNELLOAD = 0xc0000000
161
162 include/asm-ppc/page.h:#define PAGE_OFFSET 0xc0000000
163 include/asm-ppc/page.h:#define KERNELBASE PAGE_OFFSET
164
165 - RAM is at physical address 0x00000000, and gets mapped to
166 virtual address 0xC0000000 for the kernel.
167
168
169 Physical addresses used by the Linux kernel:
170 --------------------------------------------
171
172 0x00000000-0x3FFFFFFF 1GB reserved for RAM
173 0xF0000000-0xF001FFFF 128K IMMR 64K used for dual port memory,
174 64K for 8260 registers
175
176
177 Logical addresses used by the Linux kernel:
178 -------------------------------------------
179
180 0xF0000000-0xFFFFFFFF 256M BAT0 (IMMR: dual port RAM, registers)
181 0xE0000000-0xEFFFFFFF 256M BAT1 (I/O space for custom boards)
182 0xC0000000-0xCFFFFFFF 256M BAT2 (RAM)
183 0xD0000000-0xDFFFFFFF 256M BAT3 (if RAM > 256MByte)
184
185
186 EST SBC8260 Linux mapping:
187 --------------------------
188
189 DBAT0, IBAT0, cache inhibited:
190
191 Chip
192 Memory Sel Use
193 --------------------- --- ---------------------------------
194 0xF0000000-0xF001FFFF n/a IMMR: dual port RAM, registers
195
196 DBAT1, IBAT1, cache inhibited:
197
diff --git a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt
index b35f3482e3e4..2ea76d9d137c 100644
--- a/Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt
+++ b/Documentation/powerpc/dts-bindings/fsl/cpm_qe/serial.txt
@@ -7,6 +7,15 @@ Currently defined compatibles:
7- fsl,cpm2-scc-uart 7- fsl,cpm2-scc-uart
8- fsl,qe-uart 8- fsl,qe-uart
9 9
10Modem control lines connected to GPIO controllers are listed in the gpios
11property as described in booting-without-of.txt, section IX.1 in the following
12order:
13
14CTS, RTS, DCD, DSR, DTR, and RI.
15
16The gpios property is optional and can be left out when control lines are
17not used.
18
10Example: 19Example:
11 20
12 serial@11a00 { 21 serial@11a00 {
@@ -18,4 +27,6 @@ Example:
18 interrupt-parent = <&PIC>; 27 interrupt-parent = <&PIC>;
19 fsl,cpm-brg = <1>; 28 fsl,cpm-brg = <1>;
20 fsl,cpm-command = <00800000>; 29 fsl,cpm-command = <00800000>;
30 gpios = <&gpio_c 15 0
31 &gpio_d 29 0>;
21 }; 32 };
diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt
index 0843ed0163a5..28b6ec87c642 100644
--- a/Documentation/rfkill.txt
+++ b/Documentation/rfkill.txt
@@ -390,9 +390,10 @@ rfkill lines are inactive, it must return RFKILL_STATE_SOFT_BLOCKED if its soft
390rfkill input line is active. Only if none of the rfkill input lines are 390rfkill input line is active. Only if none of the rfkill input lines are
391active, will it return RFKILL_STATE_UNBLOCKED. 391active, will it return RFKILL_STATE_UNBLOCKED.
392 392
393If it doesn't implement the get_state() hook, it must make sure that its calls 393Since the device has a hardware rfkill line, it IS subject to state changes
394to rfkill_force_state() are enough to keep the status always up-to-date, and it 394external to rfkill. Therefore, the driver must make sure that it calls
395must do a rfkill_force_state() on resume from sleep. 395rfkill_force_state() to keep the status always up-to-date, and it must do a
396rfkill_force_state() on resume from sleep.
396 397
397Every time the driver gets a notification from the card that one of its rfkill 398Every time the driver gets a notification from the card that one of its rfkill
398lines changed state (polling might be needed on badly designed cards that don't 399lines changed state (polling might be needed on badly designed cards that don't
@@ -422,13 +423,24 @@ of the hardware is unknown), or read-write (where the hardware can be queried
422about its current state). 423about its current state).
423 424
424The rfkill class will call the get_state hook of a device every time it needs 425The rfkill class will call the get_state hook of a device every time it needs
425to know the *real* current state of the hardware. This can happen often. 426to know the *real* current state of the hardware. This can happen often, but
427it does not do any polling, so it is not enough on hardware that is subject
428to state changes outside of the rfkill subsystem.
429
430Therefore, calling rfkill_force_state() when a state change happens is
431mandatory when the device has a hardware rfkill line, or when something else
432like the firmware could cause its state to be changed without going through the
433rfkill class.
426 434
427Some hardware provides events when its status changes. In these cases, it is 435Some hardware provides events when its status changes. In these cases, it is
428best for the driver to not provide a get_state hook, and instead register the 436best for the driver to not provide a get_state hook, and instead register the
429rfkill class *already* with the correct status, and keep it updated using 437rfkill class *already* with the correct status, and keep it updated using
430rfkill_force_state() when it gets an event from the hardware. 438rfkill_force_state() when it gets an event from the hardware.
431 439
440rfkill_force_state() must be used on the device resume handlers to update the
441rfkill status, should there be any chance of the device status changing during
442the sleep.
443
432There is no provision for a statically-allocated rfkill struct. You must 444There is no provision for a statically-allocated rfkill struct. You must
433use rfkill_allocate() to allocate one. 445use rfkill_allocate() to allocate one.
434 446
diff --git a/Documentation/video4linux/CARDLIST.au0828 b/Documentation/video4linux/CARDLIST.au0828
index 86d1c8e7b18f..eedc399e8deb 100644
--- a/Documentation/video4linux/CARDLIST.au0828
+++ b/Documentation/video4linux/CARDLIST.au0828
@@ -2,3 +2,4 @@
2 1 -> Hauppauge HVR950Q (au0828) [2040:7200,2040:7210,2040:7217,2040:721b,2040:721f,2040:7280,0fd9:0008] 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]
5 4 -> Hauppauge HVR950Q rev xxF8 (au0828) [2040:7201,2040:7211,2040:7281]
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
index 10591467ef16..89c7f32abf9f 100644
--- a/Documentation/video4linux/CARDLIST.em28xx
+++ b/Documentation/video4linux/CARDLIST.em28xx
@@ -1,11 +1,11 @@
1 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] 1 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800]
2 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2750,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883] 2 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883]
3 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] 3 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036]
4 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] 4 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208]
5 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] 5 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201]
6 5 -> MSI VOX USB 2.0 (em2820/em2840) 6 5 -> MSI VOX USB 2.0 (em2820/em2840)
7 6 -> Terratec Cinergy 200 USB (em2800) 7 6 -> Terratec Cinergy 200 USB (em2800)
8 7 -> Leadtek Winfast USB II (em2800) 8 7 -> Leadtek Winfast USB II (em2800) [0413:6023]
9 8 -> Kworld USB2800 (em2800) 9 8 -> Kworld USB2800 (em2800)
10 9 -> Pinnacle Dazzle DVC 90/DVC 100 (em2820/em2840) [2304:0207,2304:021a] 10 9 -> Pinnacle Dazzle DVC 90/DVC 100 (em2820/em2840) [2304:0207,2304:021a]
11 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500] 11 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500]
@@ -14,7 +14,46 @@
14 13 -> Terratec Prodigy XS (em2880) [0ccd:0047] 14 13 -> Terratec Prodigy XS (em2880) [0ccd:0047]
15 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840) 15 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840)
16 15 -> V-Gear PocketTV (em2800) 16 15 -> V-Gear PocketTV (em2800)
17 16 -> Hauppauge WinTV HVR 950 (em2880) [2040:6513,2040:6517,2040:651b,2040:651f] 17 16 -> Hauppauge WinTV HVR 950 (em2883) [2040:6513,2040:6517,2040:651b,2040:651f]
18 17 -> Pinnacle PCTV HD Pro Stick (em2880) [2304:0227] 18 17 -> Pinnacle PCTV HD Pro Stick (em2880) [2304:0227]
19 18 -> Hauppauge WinTV HVR 900 (R2) (em2880) [2040:6502] 19 18 -> Hauppauge WinTV HVR 900 (R2) (em2880) [2040:6502]
20 19 -> PointNix Intra-Oral Camera (em2860) 20 19 -> PointNix Intra-Oral Camera (em2860)
21 20 -> AMD ATI TV Wonder HD 600 (em2880) [0438:b002]
22 21 -> eMPIA Technology, Inc. GrabBeeX+ Video Encoder (em2800) [eb1a:2801]
23 22 -> Unknown EM2750/EM2751 webcam grabber (em2750) [eb1a:2750,eb1a:2751]
24 23 -> Huaqi DLCW-130 (em2750)
25 24 -> D-Link DUB-T210 TV Tuner (em2820/em2840) [2001:f112]
26 25 -> Gadmei UTV310 (em2820/em2840)
27 26 -> Hercules Smart TV USB 2.0 (em2820/em2840)
28 27 -> Pinnacle PCTV USB 2 (Philips FM1216ME) (em2820/em2840)
29 28 -> Leadtek Winfast USB II Deluxe (em2820/em2840)
30 29 -> Pinnacle Dazzle DVC 100 (em2820/em2840)
31 30 -> Videology 20K14XUSB USB2.0 (em2820/em2840)
32 31 -> Usbgear VD204v9 (em2821)
33 32 -> Supercomp USB 2.0 TV (em2821)
34 33 -> SIIG AVTuner-PVR/Prolink PlayTV USB 2.0 (em2821)
35 34 -> Terratec Cinergy A Hybrid XS (em2860) [0ccd:004f]
36 35 -> Typhoon DVD Maker (em2860)
37 36 -> NetGMBH Cam (em2860)
38 37 -> Gadmei UTV330 (em2860)
39 38 -> Yakumo MovieMixer (em2861)
40 39 -> KWorld PVRTV 300U (em2861) [eb1a:e300]
41 40 -> Plextor ConvertX PX-TV100U (em2861) [093b:a005]
42 41 -> Kworld 350 U DVB-T (em2870) [eb1a:e350]
43 42 -> Kworld 355 U DVB-T (em2870) [eb1a:e355,eb1a:e357]
44 43 -> Terratec Cinergy T XS (em2870) [0ccd:0043]
45 44 -> Terratec Cinergy T XS (MT2060) (em2870)
46 45 -> Pinnacle PCTV DVB-T (em2870)
47 46 -> Compro, VideoMate U3 (em2870) [185b:2870]
48 47 -> KWorld DVB-T 305U (em2880) [eb1a:e305]
49 48 -> KWorld DVB-T 310U (em2880)
50 49 -> MSI DigiVox A/D (em2880) [eb1a:e310]
51 50 -> MSI DigiVox A/D II (em2880) [eb1a:e320]
52 51 -> Terratec Hybrid XS Secam (em2880) [0ccd:004c]
53 52 -> DNT DA2 Hybrid (em2881)
54 53 -> Pinnacle Hybrid Pro (em2881)
55 54 -> Kworld VS-DVB-T 323UR (em2882) [eb1a:e323]
56 55 -> Terratec Hybrid XS (em2882) (em2882) [0ccd:005e]
57 56 -> Pinnacle Hybrid Pro (2) (em2882) [2304:0226]
58 57 -> Kworld PlusTV HD Hybrid 330 (em2883) [eb1a:a316]
59 58 -> Compro VideoMate ForYou/Stereo (em2820/em2840) [185b:2041]
diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt
index 0c4880af57a3..bcaf4ab383be 100644
--- a/Documentation/video4linux/gspca.txt
+++ b/Documentation/video4linux/gspca.txt
@@ -1,4 +1,4 @@
1List of the webcams know by gspca. 1List of the webcams known by gspca.
2 2
3The modules are: 3The modules are:
4 gspca_main main driver 4 gspca_main main driver
diff --git a/MAINTAINERS b/MAINTAINERS
index 03c5d6ccb9f8..5e6d6ab82433 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1878,13 +1878,9 @@ W: http://gigaset307x.sourceforge.net/
1878S: Maintained 1878S: Maintained
1879 1879
1880HARDWARE MONITORING 1880HARDWARE MONITORING
1881P: Mark M. Hoffman
1882M: mhoffman@lightlink.com
1883L: lm-sensors@lm-sensors.org 1881L: lm-sensors@lm-sensors.org
1884W: http://www.lm-sensors.org/ 1882W: http://www.lm-sensors.org/
1885T: git lm-sensors.org:/kernel/mhoffman/hwmon-2.6.git testing 1883S: Orphaned
1886T: git lm-sensors.org:/kernel/mhoffman/hwmon-2.6.git release
1887S: Maintained
1888 1884
1889HARDWARE RANDOM NUMBER GENERATOR CORE 1885HARDWARE RANDOM NUMBER GENERATOR CORE
1890S: Orphaned 1886S: Orphaned
@@ -3796,6 +3792,12 @@ P: Ben Nizette
3796M: bn@niasdigital.com 3792M: bn@niasdigital.com
3797S: Maintained 3793S: Maintained
3798 3794
3795SOC-CAMERA V4L2 SUBSYSTEM
3796P: Guennadi Liakhovetski
3797M: g.liakhovetski@gmx.de
3798L: video4linux-list@redhat.com
3799S: Maintained
3800
3799SOFTWARE RAID (Multiple Disks) SUPPORT 3801SOFTWARE RAID (Multiple Disks) SUPPORT
3800P: Ingo Molnar 3802P: Ingo Molnar
3801M: mingo@redhat.com 3803M: mingo@redhat.com
@@ -3962,7 +3964,7 @@ M: lethal@linux-sh.org
3962L: linux-sh@vger.kernel.org 3964L: linux-sh@vger.kernel.org
3963W: http://www.linux-sh.org 3965W: http://www.linux-sh.org
3964T: git kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6.git 3966T: git kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6.git
3965S: Maintained 3967S: Supported
3966 3968
3967SUN3/3X 3969SUN3/3X
3968P: Sam Creasey 3970P: Sam Creasey
@@ -4498,6 +4500,15 @@ M: kaber@trash.net
4498L: netdev@vger.kernel.org 4500L: netdev@vger.kernel.org
4499S: Maintained 4501S: Maintained
4500 4502
4503VOLTAGE AND CURRENT REGULATOR FRAMEWORK
4504P: Liam Girdwood
4505M: lg@opensource.wolfsonmicro.com
4506P: Mark Brown
4507M: broonie@opensource.wolfsonmicro.com
4508W: http://opensource.wolfsonmicro.com/node/15
4509T: git kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6.git
4510S: Supported
4511
4501VT1211 HARDWARE MONITOR DRIVER 4512VT1211 HARDWARE MONITOR DRIVER
4502P: Juerg Haefliger 4513P: Juerg Haefliger
4503M: juergh@gmail.com 4514M: juergh@gmail.com
diff --git a/Makefile b/Makefile
index 40f24810116c..f156f40d6334 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 26 3SUBLEVEL = 27
4EXTRAVERSION = 4EXTRAVERSION = -rc1
5NAME = Rotary Wombat 5NAME = Rotary Wombat
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -206,7 +206,11 @@ ifeq ($(ARCH),x86_64)
206endif 206endif
207 207
208# Where to locate arch specific headers 208# Where to locate arch specific headers
209hdr-arch := $(SRCARCH) 209ifeq ($(ARCH),sparc64)
210 hdr-arch := sparc
211else
212 hdr-arch := $(SRCARCH)
213endif
210 214
211KCONFIG_CONFIG ?= .config 215KCONFIG_CONFIG ?= .config
212 216
@@ -926,7 +930,7 @@ ifneq ($(KBUILD_SRC),)
926 /bin/false; \ 930 /bin/false; \
927 fi; 931 fi;
928 $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi; 932 $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
929 $(Q)if [ -e $(srctree)/include/asm-$(SRCARCH)/system.h ]; then \ 933 $(Q)if [ -e $(srctree)/include/asm-$(SRCARCH)/errno.h ]; then \
930 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \ 934 ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
931 fi 935 fi
932endif 936endif
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c8f528284a94..4b8acd2851f4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -17,6 +17,7 @@ config ARM
17 select HAVE_KRETPROBES if (HAVE_KPROBES) 17 select HAVE_KRETPROBES if (HAVE_KPROBES)
18 select HAVE_FTRACE if (!XIP_KERNEL) 18 select HAVE_FTRACE if (!XIP_KERNEL)
19 select HAVE_DYNAMIC_FTRACE if (HAVE_FTRACE) 19 select HAVE_DYNAMIC_FTRACE if (HAVE_FTRACE)
20 select HAVE_GENERIC_DMA_COHERENT
20 help 21 help
21 The ARM series is a line of low-power-consumption RISC chip designs 22 The ARM series is a line of low-power-consumption RISC chip designs
22 licensed by ARM Ltd and targeted at embedded applications and 23 licensed by ARM Ltd and targeted at embedded applications and
@@ -234,6 +235,7 @@ config ARCH_VERSATILE
234config ARCH_AT91 235config ARCH_AT91
235 bool "Atmel AT91" 236 bool "Atmel AT91"
236 select GENERIC_GPIO 237 select GENERIC_GPIO
238 select HAVE_CLK
237 help 239 help
238 This enables support for systems based on the Atmel AT91RM9200, 240 This enables support for systems based on the Atmel AT91RM9200,
239 AT91SAM9 and AT91CAP9 processors. 241 AT91SAM9 and AT91CAP9 processors.
@@ -267,7 +269,6 @@ config ARCH_EP93XX
267 select ARM_VIC 269 select ARM_VIC
268 select GENERIC_GPIO 270 select GENERIC_GPIO
269 select HAVE_CLK 271 select HAVE_CLK
270 select HAVE_CLK
271 select ARCH_REQUIRE_GPIOLIB 272 select ARCH_REQUIRE_GPIOLIB
272 help 273 help
273 This enables support for the Cirrus EP93xx series of CPUs. 274 This enables support for the Cirrus EP93xx series of CPUs.
@@ -1224,6 +1225,8 @@ source "drivers/dma/Kconfig"
1224 1225
1225source "drivers/dca/Kconfig" 1226source "drivers/dca/Kconfig"
1226 1227
1228source "drivers/regulator/Kconfig"
1229
1227source "drivers/uio/Kconfig" 1230source "drivers/uio/Kconfig"
1228 1231
1229endmenu 1232endmenu
diff --git a/arch/arm/configs/at91cap9adk_defconfig b/arch/arm/configs/at91cap9adk_defconfig
index be2b2f38fd94..bf97801a1068 100644
--- a/arch/arm/configs/at91cap9adk_defconfig
+++ b/arch/arm/configs/at91cap9adk_defconfig
@@ -170,7 +170,7 @@ CONFIG_MACH_AT91CAP9ADK=y
170# AT91 Board Options 170# AT91 Board Options
171# 171#
172CONFIG_MTD_AT91_DATAFLASH_CARD=y 172CONFIG_MTD_AT91_DATAFLASH_CARD=y
173# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set 173# CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 is not set
174 174
175# 175#
176# AT91 Feature Selections 176# AT91 Feature Selections
@@ -442,7 +442,7 @@ CONFIG_MTD_NAND=y
442# CONFIG_MTD_NAND_MUSEUM_IDS is not set 442# CONFIG_MTD_NAND_MUSEUM_IDS is not set
443CONFIG_MTD_NAND_IDS=y 443CONFIG_MTD_NAND_IDS=y
444# CONFIG_MTD_NAND_DISKONCHIP is not set 444# CONFIG_MTD_NAND_DISKONCHIP is not set
445CONFIG_MTD_NAND_AT91=y 445CONFIG_MTD_NAND_ATMEL=y
446# CONFIG_MTD_NAND_NANDSIM is not set 446# CONFIG_MTD_NAND_NANDSIM is not set
447# CONFIG_MTD_NAND_PLATFORM is not set 447# CONFIG_MTD_NAND_PLATFORM is not set
448# CONFIG_MTD_ALAUDA is not set 448# CONFIG_MTD_ALAUDA is not set
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig
index 2011adfa6758..38e6a0abeb4e 100644
--- a/arch/arm/configs/at91sam9260ek_defconfig
+++ b/arch/arm/configs/at91sam9260ek_defconfig
@@ -176,7 +176,7 @@ CONFIG_MACH_AT91SAM9260EK=y
176# AT91 Board Options 176# AT91 Board Options
177# 177#
178# CONFIG_MTD_AT91_DATAFLASH_CARD is not set 178# CONFIG_MTD_AT91_DATAFLASH_CARD is not set
179# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set 179# CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 is not set
180 180
181# 181#
182# AT91 Feature Selections 182# AT91 Feature Selections
diff --git a/arch/arm/configs/at91sam9261ek_defconfig b/arch/arm/configs/at91sam9261ek_defconfig
index 4049768962d2..93b779f94b41 100644
--- a/arch/arm/configs/at91sam9261ek_defconfig
+++ b/arch/arm/configs/at91sam9261ek_defconfig
@@ -169,7 +169,7 @@ CONFIG_MACH_AT91SAM9261EK=y
169# AT91 Board Options 169# AT91 Board Options
170# 170#
171# CONFIG_MTD_AT91_DATAFLASH_CARD is not set 171# CONFIG_MTD_AT91_DATAFLASH_CARD is not set
172# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set 172# CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 is not set
173 173
174# 174#
175# AT91 Feature Selections 175# AT91 Feature Selections
@@ -433,7 +433,7 @@ CONFIG_MTD_NAND=y
433# CONFIG_MTD_NAND_MUSEUM_IDS is not set 433# CONFIG_MTD_NAND_MUSEUM_IDS is not set
434CONFIG_MTD_NAND_IDS=y 434CONFIG_MTD_NAND_IDS=y
435# CONFIG_MTD_NAND_DISKONCHIP is not set 435# CONFIG_MTD_NAND_DISKONCHIP is not set
436CONFIG_MTD_NAND_AT91=y 436CONFIG_MTD_NAND_ATMEL=y
437# CONFIG_MTD_NAND_NANDSIM is not set 437# CONFIG_MTD_NAND_NANDSIM is not set
438# CONFIG_MTD_NAND_PLATFORM is not set 438# CONFIG_MTD_NAND_PLATFORM is not set
439# CONFIG_MTD_ALAUDA is not set 439# CONFIG_MTD_ALAUDA is not set
diff --git a/arch/arm/configs/at91sam9263ek_defconfig b/arch/arm/configs/at91sam9263ek_defconfig
index fa1c5aecb5a8..a7ddd94363ca 100644
--- a/arch/arm/configs/at91sam9263ek_defconfig
+++ b/arch/arm/configs/at91sam9263ek_defconfig
@@ -169,7 +169,7 @@ CONFIG_MACH_AT91SAM9263EK=y
169# AT91 Board Options 169# AT91 Board Options
170# 170#
171CONFIG_MTD_AT91_DATAFLASH_CARD=y 171CONFIG_MTD_AT91_DATAFLASH_CARD=y
172# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set 172# CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 is not set
173 173
174# 174#
175# AT91 Feature Selections 175# AT91 Feature Selections
@@ -428,7 +428,7 @@ CONFIG_MTD_NAND=y
428# CONFIG_MTD_NAND_MUSEUM_IDS is not set 428# CONFIG_MTD_NAND_MUSEUM_IDS is not set
429CONFIG_MTD_NAND_IDS=y 429CONFIG_MTD_NAND_IDS=y
430# CONFIG_MTD_NAND_DISKONCHIP is not set 430# CONFIG_MTD_NAND_DISKONCHIP is not set
431CONFIG_MTD_NAND_AT91=y 431CONFIG_MTD_NAND_ATMEL=y
432# CONFIG_MTD_NAND_NANDSIM is not set 432# CONFIG_MTD_NAND_NANDSIM is not set
433# CONFIG_MTD_NAND_PLATFORM is not set 433# CONFIG_MTD_NAND_PLATFORM is not set
434# CONFIG_MTD_ALAUDA is not set 434# CONFIG_MTD_ALAUDA is not set
diff --git a/arch/arm/configs/at91sam9g20ek_defconfig b/arch/arm/configs/at91sam9g20ek_defconfig
index c06863847364..df0d6ee672b3 100644
--- a/arch/arm/configs/at91sam9g20ek_defconfig
+++ b/arch/arm/configs/at91sam9g20ek_defconfig
@@ -168,7 +168,7 @@ CONFIG_MACH_AT91SAM9G20EK=y
168# AT91 Board Options 168# AT91 Board Options
169# 169#
170# CONFIG_MTD_AT91_DATAFLASH_CARD is not set 170# CONFIG_MTD_AT91_DATAFLASH_CARD is not set
171# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set 171# CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16 is not set
172 172
173# 173#
174# AT91 Feature Selections 174# AT91 Feature Selections
@@ -442,10 +442,10 @@ CONFIG_MTD_NAND=y
442# CONFIG_MTD_NAND_MUSEUM_IDS is not set 442# CONFIG_MTD_NAND_MUSEUM_IDS is not set
443CONFIG_MTD_NAND_IDS=y 443CONFIG_MTD_NAND_IDS=y
444# CONFIG_MTD_NAND_DISKONCHIP is not set 444# CONFIG_MTD_NAND_DISKONCHIP is not set
445CONFIG_MTD_NAND_AT91=y 445CONFIG_MTD_NAND_ATMEL=y
446CONFIG_MTD_NAND_AT91_ECC_SOFT=y 446CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
447# CONFIG_MTD_NAND_AT91_ECC_HW is not set 447# CONFIG_MTD_NAND_ATMEL_ECC_HW is not set
448# CONFIG_MTD_NAND_AT91_ECC_NONE is not set 448# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
449# CONFIG_MTD_NAND_NANDSIM is not set 449# CONFIG_MTD_NAND_NANDSIM is not set
450# CONFIG_MTD_NAND_PLATFORM is not set 450# CONFIG_MTD_NAND_PLATFORM is not set
451# CONFIG_MTD_ALAUDA is not set 451# CONFIG_MTD_ALAUDA is not set
diff --git a/arch/arm/configs/at91sam9rlek_defconfig b/arch/arm/configs/at91sam9rlek_defconfig
index d8ec5f9ca6ec..1c76642272a1 100644
--- a/arch/arm/configs/at91sam9rlek_defconfig
+++ b/arch/arm/configs/at91sam9rlek_defconfig
@@ -392,7 +392,7 @@ CONFIG_MTD_NAND=y
392# CONFIG_MTD_NAND_MUSEUM_IDS is not set 392# CONFIG_MTD_NAND_MUSEUM_IDS is not set
393CONFIG_MTD_NAND_IDS=y 393CONFIG_MTD_NAND_IDS=y
394# CONFIG_MTD_NAND_DISKONCHIP is not set 394# CONFIG_MTD_NAND_DISKONCHIP is not set
395CONFIG_MTD_NAND_AT91=y 395CONFIG_MTD_NAND_ATMEL=y
396# CONFIG_MTD_NAND_NANDSIM is not set 396# CONFIG_MTD_NAND_NANDSIM is not set
397# CONFIG_MTD_NAND_PLATFORM is not set 397# CONFIG_MTD_NAND_PLATFORM is not set
398# CONFIG_MTD_ONENAND is not set 398# CONFIG_MTD_ONENAND is not set
diff --git a/arch/arm/configs/cam60_defconfig b/arch/arm/configs/cam60_defconfig
index f3cd4a95373a..f945105d6cd6 100644
--- a/arch/arm/configs/cam60_defconfig
+++ b/arch/arm/configs/cam60_defconfig
@@ -466,10 +466,10 @@ CONFIG_MTD_NAND_VERIFY_WRITE=y
466# CONFIG_MTD_NAND_MUSEUM_IDS is not set 466# CONFIG_MTD_NAND_MUSEUM_IDS is not set
467CONFIG_MTD_NAND_IDS=y 467CONFIG_MTD_NAND_IDS=y
468# CONFIG_MTD_NAND_DISKONCHIP is not set 468# CONFIG_MTD_NAND_DISKONCHIP is not set
469CONFIG_MTD_NAND_AT91=y 469CONFIG_MTD_NAND_ATMEL=y
470# CONFIG_MTD_NAND_AT91_ECC_SOFT is not set 470# CONFIG_MTD_NAND_ATMEL_ECC_SOFT is not set
471CONFIG_MTD_NAND_AT91_ECC_HW=y 471CONFIG_MTD_NAND_ATMEL_ECC_HW=y
472# CONFIG_MTD_NAND_AT91_ECC_NONE is not set 472# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
473# CONFIG_MTD_NAND_NANDSIM is not set 473# CONFIG_MTD_NAND_NANDSIM is not set
474# CONFIG_MTD_NAND_PLATFORM is not set 474# CONFIG_MTD_NAND_PLATFORM is not set
475# CONFIG_MTD_ALAUDA is not set 475# CONFIG_MTD_ALAUDA is not set
diff --git a/arch/arm/configs/qil-a9260_defconfig b/arch/arm/configs/qil-a9260_defconfig
index ef903bed061e..5cbd81589647 100644
--- a/arch/arm/configs/qil-a9260_defconfig
+++ b/arch/arm/configs/qil-a9260_defconfig
@@ -458,10 +458,10 @@ CONFIG_MTD_NAND=y
458# CONFIG_MTD_NAND_MUSEUM_IDS is not set 458# CONFIG_MTD_NAND_MUSEUM_IDS is not set
459CONFIG_MTD_NAND_IDS=y 459CONFIG_MTD_NAND_IDS=y
460# CONFIG_MTD_NAND_DISKONCHIP is not set 460# CONFIG_MTD_NAND_DISKONCHIP is not set
461CONFIG_MTD_NAND_AT91=y 461CONFIG_MTD_NAND_ATMEL=y
462CONFIG_MTD_NAND_AT91_ECC_SOFT=y 462CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
463# CONFIG_MTD_NAND_AT91_ECC_HW is not set 463# CONFIG_MTD_NAND_ATMEL_ECC_HW is not set
464# CONFIG_MTD_NAND_AT91_ECC_NONE is not set 464# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
465# CONFIG_MTD_NAND_NANDSIM is not set 465# CONFIG_MTD_NAND_NANDSIM is not set
466# CONFIG_MTD_NAND_PLATFORM is not set 466# CONFIG_MTD_NAND_PLATFORM is not set
467# CONFIG_MTD_ALAUDA is not set 467# CONFIG_MTD_ALAUDA is not set
diff --git a/arch/arm/configs/sam9_l9260_defconfig b/arch/arm/configs/sam9_l9260_defconfig
index 8688362bcf7b..1174e2764875 100644
--- a/arch/arm/configs/sam9_l9260_defconfig
+++ b/arch/arm/configs/sam9_l9260_defconfig
@@ -429,7 +429,7 @@ CONFIG_MTD_NAND=y
429# CONFIG_MTD_NAND_MUSEUM_IDS is not set 429# CONFIG_MTD_NAND_MUSEUM_IDS is not set
430CONFIG_MTD_NAND_IDS=y 430CONFIG_MTD_NAND_IDS=y
431# CONFIG_MTD_NAND_DISKONCHIP is not set 431# CONFIG_MTD_NAND_DISKONCHIP is not set
432CONFIG_MTD_NAND_AT91=y 432CONFIG_MTD_NAND_ATMEL=y
433# CONFIG_MTD_NAND_NANDSIM is not set 433# CONFIG_MTD_NAND_NANDSIM is not set
434CONFIG_MTD_NAND_PLATFORM=y 434CONFIG_MTD_NAND_PLATFORM=y
435# CONFIG_MTD_ONENAND is not set 435# CONFIG_MTD_ONENAND is not set
diff --git a/arch/arm/configs/usb-a9260_defconfig b/arch/arm/configs/usb-a9260_defconfig
index 3680bd2df26d..fcb4aaabd439 100644
--- a/arch/arm/configs/usb-a9260_defconfig
+++ b/arch/arm/configs/usb-a9260_defconfig
@@ -458,10 +458,10 @@ CONFIG_MTD_NAND=y
458# CONFIG_MTD_NAND_MUSEUM_IDS is not set 458# CONFIG_MTD_NAND_MUSEUM_IDS is not set
459CONFIG_MTD_NAND_IDS=y 459CONFIG_MTD_NAND_IDS=y
460# CONFIG_MTD_NAND_DISKONCHIP is not set 460# CONFIG_MTD_NAND_DISKONCHIP is not set
461CONFIG_MTD_NAND_AT91=y 461CONFIG_MTD_NAND_ATMEL=y
462CONFIG_MTD_NAND_AT91_ECC_SOFT=y 462CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
463# CONFIG_MTD_NAND_AT91_ECC_HW is not set 463# CONFIG_MTD_NAND_ATMEL_ECC_HW is not set
464# CONFIG_MTD_NAND_AT91_ECC_NONE is not set 464# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
465# CONFIG_MTD_NAND_NANDSIM is not set 465# CONFIG_MTD_NAND_NANDSIM is not set
466# CONFIG_MTD_NAND_PLATFORM is not set 466# CONFIG_MTD_NAND_PLATFORM is not set
467# CONFIG_MTD_ALAUDA is not set 467# CONFIG_MTD_ALAUDA is not set
diff --git a/arch/arm/configs/usb-a9263_defconfig b/arch/arm/configs/usb-a9263_defconfig
index 48d455bc7363..b786e0407e8e 100644
--- a/arch/arm/configs/usb-a9263_defconfig
+++ b/arch/arm/configs/usb-a9263_defconfig
@@ -450,10 +450,10 @@ CONFIG_MTD_NAND=y
450# CONFIG_MTD_NAND_MUSEUM_IDS is not set 450# CONFIG_MTD_NAND_MUSEUM_IDS is not set
451CONFIG_MTD_NAND_IDS=y 451CONFIG_MTD_NAND_IDS=y
452# CONFIG_MTD_NAND_DISKONCHIP is not set 452# CONFIG_MTD_NAND_DISKONCHIP is not set
453CONFIG_MTD_NAND_AT91=y 453CONFIG_MTD_NAND_ATMEL=y
454CONFIG_MTD_NAND_AT91_ECC_SOFT=y 454CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
455# CONFIG_MTD_NAND_AT91_ECC_HW is not set 455# CONFIG_MTD_NAND_ATMEL_ECC_HW is not set
456# CONFIG_MTD_NAND_AT91_ECC_NONE is not set 456# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
457# CONFIG_MTD_NAND_NANDSIM is not set 457# CONFIG_MTD_NAND_NANDSIM is not set
458# CONFIG_MTD_NAND_PLATFORM is not set 458# CONFIG_MTD_NAND_PLATFORM is not set
459# CONFIG_MTD_ALAUDA is not set 459# CONFIG_MTD_ALAUDA is not set
diff --git a/arch/arm/configs/yl9200_defconfig b/arch/arm/configs/yl9200_defconfig
index 26de37f74686..a9f41c24c9dc 100644
--- a/arch/arm/configs/yl9200_defconfig
+++ b/arch/arm/configs/yl9200_defconfig
@@ -421,7 +421,7 @@ CONFIG_MTD_NAND=y
421# CONFIG_MTD_NAND_ECC_SMC is not set 421# CONFIG_MTD_NAND_ECC_SMC is not set
422# CONFIG_MTD_NAND_MUSEUM_IDS is not set 422# CONFIG_MTD_NAND_MUSEUM_IDS is not set
423CONFIG_MTD_NAND_IDS=y 423CONFIG_MTD_NAND_IDS=y
424CONFIG_MTD_NAND_AT91=y 424CONFIG_MTD_NAND_ATMEL=y
425# CONFIG_MTD_NAND_NANDSIM is not set 425# CONFIG_MTD_NAND_NANDSIM is not set
426CONFIG_MTD_NAND_PLATFORM=y 426CONFIG_MTD_NAND_PLATFORM=y
427# CONFIG_MTD_ALAUDA is not set 427# CONFIG_MTD_ALAUDA is not set
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 5bad6b9b00d7..a048b92cb407 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -297,7 +297,7 @@ config MTD_AT91_DATAFLASH_CARD
297 help 297 help
298 Enable support for the DataFlash card. 298 Enable support for the DataFlash card.
299 299
300config MTD_NAND_AT91_BUSWIDTH_16 300config MTD_NAND_ATMEL_BUSWIDTH_16
301 bool "Enable 16-bit data bus interface to NAND flash" 301 bool "Enable 16-bit data bus interface to NAND flash"
302 depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_AT91CAP9ADK) 302 depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91SAM9G20EK || MACH_AT91CAP9ADK)
303 help 303 help
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index dc8b40783d94..25765f1afca9 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -376,7 +376,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
376 * NAND / SmartMedia 376 * NAND / SmartMedia
377 * -------------------------------------------------------------------- */ 377 * -------------------------------------------------------------------- */
378 378
379#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 379#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
380static struct atmel_nand_data nand_data; 380static struct atmel_nand_data nand_data;
381 381
382#define NAND_BASE AT91_CHIPSELECT_3 382#define NAND_BASE AT91_CHIPSELECT_3
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 8ced9bc82099..d2c5c84bf6b8 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -368,7 +368,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
368 * NAND / SmartMedia 368 * NAND / SmartMedia
369 * -------------------------------------------------------------------- */ 369 * -------------------------------------------------------------------- */
370 370
371#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 371#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
372static struct atmel_nand_data nand_data; 372static struct atmel_nand_data nand_data;
373 373
374#define NAND_BASE AT91_CHIPSELECT_3 374#define NAND_BASE AT91_CHIPSELECT_3
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index cae5f52f1278..f5fec0a9cf49 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -283,7 +283,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
283 * NAND / SmartMedia 283 * NAND / SmartMedia
284 * -------------------------------------------------------------------- */ 284 * -------------------------------------------------------------------- */
285 285
286#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 286#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
287static struct atmel_nand_data nand_data; 287static struct atmel_nand_data nand_data;
288 288
289#define NAND_BASE AT91_CHIPSELECT_3 289#define NAND_BASE AT91_CHIPSELECT_3
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 483d436af22d..b80860e31383 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -198,7 +198,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
198 * NAND / SmartMedia 198 * NAND / SmartMedia
199 * -------------------------------------------------------------------- */ 199 * -------------------------------------------------------------------- */
200 200
201#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 201#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
202static struct atmel_nand_data nand_data; 202static struct atmel_nand_data nand_data;
203 203
204#define NAND_BASE AT91_CHIPSELECT_3 204#define NAND_BASE AT91_CHIPSELECT_3
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 9762b15f658a..42108d02f593 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -352,7 +352,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
352 * NAND / SmartMedia 352 * NAND / SmartMedia
353 * -------------------------------------------------------------------- */ 353 * -------------------------------------------------------------------- */
354 354
355#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 355#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
356static struct atmel_nand_data nand_data; 356static struct atmel_nand_data nand_data;
357 357
358#define NAND_BASE AT91_CHIPSELECT_3 358#define NAND_BASE AT91_CHIPSELECT_3
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 5f3094870cad..9c61576f1c8d 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -194,7 +194,7 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
194 * NAND / SmartMedia 194 * NAND / SmartMedia
195 * -------------------------------------------------------------------- */ 195 * -------------------------------------------------------------------- */
196 196
197#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE) 197#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
198static struct atmel_nand_data nand_data; 198static struct atmel_nand_data nand_data;
199 199
200#define NAND_BASE AT91_CHIPSELECT_3 200#define NAND_BASE AT91_CHIPSELECT_3
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index 117cf6c9afce..1f4725972edc 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -188,7 +188,7 @@ static struct atmel_nand_data __initdata cap9adk_nand_data = {
188// .rdy_pin = ... not connected 188// .rdy_pin = ... not connected
189 .enable_pin = AT91_PIN_PD15, 189 .enable_pin = AT91_PIN_PD15,
190 .partition_info = nand_partitions, 190 .partition_info = nand_partitions,
191#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) 191#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
192 .bus_width_16 = 1, 192 .bus_width_16 = 1,
193#else 193#else
194 .bus_width_16 = 0, 194 .bus_width_16 = 0,
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 99b4ec3818d6..33b1ccdb516d 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -140,14 +140,14 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio
140 return ek_nand_partition; 140 return ek_nand_partition;
141} 141}
142 142
143static struct at91_nand_data __initdata ek_nand_data = { 143static struct atmel_nand_data __initdata ek_nand_data = {
144 .ale = 21, 144 .ale = 21,
145 .cle = 22, 145 .cle = 22,
146// .det_pin = ... not connected 146// .det_pin = ... not connected
147 .rdy_pin = AT91_PIN_PC13, 147 .rdy_pin = AT91_PIN_PC13,
148 .enable_pin = AT91_PIN_PC14, 148 .enable_pin = AT91_PIN_PC14,
149 .partition_info = nand_partitions, 149 .partition_info = nand_partitions,
150#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) 150#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
151 .bus_width_16 = 1, 151 .bus_width_16 = 1,
152#else 152#else
153 .bus_width_16 = 0, 153 .bus_width_16 = 0,
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 57a6221943ed..3cd5f8d0e2e2 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -148,7 +148,7 @@ static struct atmel_nand_data __initdata ek_nand_data = {
148 .rdy_pin = AT91_PIN_PC13, 148 .rdy_pin = AT91_PIN_PC13,
149 .enable_pin = AT91_PIN_PC14, 149 .enable_pin = AT91_PIN_PC14,
150 .partition_info = nand_partitions, 150 .partition_info = nand_partitions,
151#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) 151#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
152 .bus_width_16 = 1, 152 .bus_width_16 = 1,
153#else 153#else
154 .bus_width_16 = 0, 154 .bus_width_16 = 0,
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 6a680795c3c8..daf93a588068 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -185,7 +185,7 @@ static struct atmel_nand_data __initdata ek_nand_data = {
185 .rdy_pin = AT91_PIN_PC13, 185 .rdy_pin = AT91_PIN_PC13,
186 .enable_pin = AT91_PIN_PC14, 186 .enable_pin = AT91_PIN_PC14,
187 .partition_info = nand_partitions, 187 .partition_info = nand_partitions,
188#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) 188#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
189 .bus_width_16 = 1, 189 .bus_width_16 = 1,
190#else 190#else
191 .bus_width_16 = 0, 191 .bus_width_16 = 0,
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 43dfbd0d543a..12bf527f93be 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -190,7 +190,7 @@ static struct atmel_nand_data __initdata ek_nand_data = {
190 .rdy_pin = AT91_PIN_PC15, 190 .rdy_pin = AT91_PIN_PC15,
191 .enable_pin = AT91_PIN_PC14, 191 .enable_pin = AT91_PIN_PC14,
192 .partition_info = nand_partitions, 192 .partition_info = nand_partitions,
193#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) 193#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
194 .bus_width_16 = 1, 194 .bus_width_16 = 1,
195#else 195#else
196 .bus_width_16 = 0, 196 .bus_width_16 = 0,
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 6605a0980117..63121197f8c9 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -194,7 +194,7 @@ static struct atmel_nand_data __initdata ek_nand_data = {
194 .rdy_pin = AT91_PIN_PA22, 194 .rdy_pin = AT91_PIN_PA22,
195 .enable_pin = AT91_PIN_PD15, 195 .enable_pin = AT91_PIN_PD15,
196 .partition_info = nand_partitions, 196 .partition_info = nand_partitions,
197#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) 197#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
198 .bus_width_16 = 1, 198 .bus_width_16 = 1,
199#else 199#else
200 .bus_width_16 = 0, 200 .bus_width_16 = 0,
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 45617c201240..e0c07952cc34 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -143,13 +143,13 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio
143} 143}
144 144
145/* det_pin is not connected */ 145/* det_pin is not connected */
146static struct at91_nand_data __initdata ek_nand_data = { 146static struct atmel_nand_data __initdata ek_nand_data = {
147 .ale = 21, 147 .ale = 21,
148 .cle = 22, 148 .cle = 22,
149 .rdy_pin = AT91_PIN_PC13, 149 .rdy_pin = AT91_PIN_PC13,
150 .enable_pin = AT91_PIN_PC14, 150 .enable_pin = AT91_PIN_PC14,
151 .partition_info = nand_partitions, 151 .partition_info = nand_partitions,
152#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) 152#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
153 .bus_width_16 = 1, 153 .bus_width_16 = 1,
154#else 154#else
155 .bus_width_16 = 0, 155 .bus_width_16 = 0,
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
index 837aedf8ffeb..2f4ecac150d9 100644
--- a/arch/arm/mach-at91/board-usb-a9260.c
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -114,14 +114,14 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio
114 return ek_nand_partition; 114 return ek_nand_partition;
115} 115}
116 116
117static struct at91_nand_data __initdata ek_nand_data = { 117static struct atmel_nand_data __initdata ek_nand_data = {
118 .ale = 21, 118 .ale = 21,
119 .cle = 22, 119 .cle = 22,
120// .det_pin = ... not connected 120// .det_pin = ... not connected
121 .rdy_pin = AT91_PIN_PC13, 121 .rdy_pin = AT91_PIN_PC13,
122 .enable_pin = AT91_PIN_PC14, 122 .enable_pin = AT91_PIN_PC14,
123 .partition_info = nand_partitions, 123 .partition_info = nand_partitions,
124#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) 124#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
125 .bus_width_16 = 1, 125 .bus_width_16 = 1,
126#else 126#else
127 .bus_width_16 = 0, 127 .bus_width_16 = 0,
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
index 95800d32bd49..0e9649d3eda1 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -127,14 +127,14 @@ static struct mtd_partition * __init nand_partitions(int size, int *num_partitio
127 return ek_nand_partition; 127 return ek_nand_partition;
128} 128}
129 129
130static struct at91_nand_data __initdata ek_nand_data = { 130static struct atmel_nand_data __initdata ek_nand_data = {
131 .ale = 21, 131 .ale = 21,
132 .cle = 22, 132 .cle = 22,
133// .det_pin = ... not connected 133// .det_pin = ... not connected
134 .rdy_pin = AT91_PIN_PA22, 134 .rdy_pin = AT91_PIN_PA22,
135 .enable_pin = AT91_PIN_PD15, 135 .enable_pin = AT91_PIN_PD15,
136 .partition_info = nand_partitions, 136 .partition_info = nand_partitions,
137#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16) 137#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
138 .bus_width_16 = 1, 138 .bus_width_16 = 1,
139#else 139#else
140 .bus_width_16 = 0, 140 .bus_width_16 = 0,
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c
index e1f8de2c74a2..b6437f47a77f 100644
--- a/arch/arm/mach-kirkwood/rd88f6281-setup.c
+++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c
@@ -18,6 +18,7 @@
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/ata_platform.h> 19#include <linux/ata_platform.h>
20#include <linux/mv643xx_eth.h> 20#include <linux/mv643xx_eth.h>
21#include <linux/ethtool.h>
21#include <asm/mach-types.h> 22#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
23#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
@@ -69,6 +70,8 @@ static struct platform_device rd88f6281_nand_flash = {
69 70
70static struct mv643xx_eth_platform_data rd88f6281_ge00_data = { 71static struct mv643xx_eth_platform_data rd88f6281_ge00_data = {
71 .phy_addr = -1, 72 .phy_addr = -1,
73 .speed = SPEED_1000,
74 .duplex = DUPLEX_FULL,
72}; 75};
73 76
74static struct mv_sata_platform_data rd88f6281_sata_data = { 77static struct mv_sata_platform_data rd88f6281_sata_data = {
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
index d50e3650a09e..73e9242da7ad 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
@@ -15,6 +15,7 @@
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/mtd/physmap.h> 16#include <linux/mtd/physmap.h>
17#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
18#include <linux/ethtool.h>
18#include <asm/mach-types.h> 19#include <asm/mach-types.h>
19#include <asm/gpio.h> 20#include <asm/gpio.h>
20#include <asm/leds.h> 21#include <asm/leds.h>
@@ -88,6 +89,8 @@ static struct orion5x_mpp_mode rd88f5181l_fxo_mpp_modes[] __initdata = {
88 89
89static struct mv643xx_eth_platform_data rd88f5181l_fxo_eth_data = { 90static struct mv643xx_eth_platform_data rd88f5181l_fxo_eth_data = {
90 .phy_addr = -1, 91 .phy_addr = -1,
92 .speed = SPEED_1000,
93 .duplex = DUPLEX_FULL,
91}; 94};
92 95
93static void __init rd88f5181l_fxo_init(void) 96static void __init rd88f5181l_fxo_init(void)
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
index b56447d32e17..ac482019abbf 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
@@ -15,6 +15,7 @@
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/mtd/physmap.h> 16#include <linux/mtd/physmap.h>
17#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
18#include <linux/ethtool.h>
18#include <linux/i2c.h> 19#include <linux/i2c.h>
19#include <asm/mach-types.h> 20#include <asm/mach-types.h>
20#include <asm/gpio.h> 21#include <asm/gpio.h>
@@ -89,6 +90,8 @@ static struct orion5x_mpp_mode rd88f5181l_ge_mpp_modes[] __initdata = {
89 90
90static struct mv643xx_eth_platform_data rd88f5181l_ge_eth_data = { 91static struct mv643xx_eth_platform_data rd88f5181l_ge_eth_data = {
91 .phy_addr = -1, 92 .phy_addr = -1,
93 .speed = SPEED_1000,
94 .duplex = DUPLEX_FULL,
92}; 95};
93 96
94static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = { 97static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = {
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c
index 1af093ff8cf3..25568c2a3d29 100644
--- a/arch/arm/mach-orion5x/wnr854t-setup.c
+++ b/arch/arm/mach-orion5x/wnr854t-setup.c
@@ -14,6 +14,7 @@
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/mtd/physmap.h> 15#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h> 16#include <linux/mv643xx_eth.h>
17#include <linux/ethtool.h>
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
18#include <asm/gpio.h> 19#include <asm/gpio.h>
19#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
@@ -92,6 +93,8 @@ static struct platform_device wnr854t_nor_flash = {
92 93
93static struct mv643xx_eth_platform_data wnr854t_eth_data = { 94static struct mv643xx_eth_platform_data wnr854t_eth_data = {
94 .phy_addr = -1, 95 .phy_addr = -1,
96 .speed = SPEED_1000,
97 .duplex = DUPLEX_FULL,
95}; 98};
96 99
97static void __init wnr854t_init(void) 100static void __init wnr854t_init(void)
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
index aeab55c6a82d..9b8ee8c48bf0 100644
--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -14,6 +14,7 @@
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/mtd/physmap.h> 15#include <linux/mtd/physmap.h>
16#include <linux/mv643xx_eth.h> 16#include <linux/mv643xx_eth.h>
17#include <linux/ethtool.h>
17#include <asm/mach-types.h> 18#include <asm/mach-types.h>
18#include <asm/gpio.h> 19#include <asm/gpio.h>
19#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
@@ -100,6 +101,8 @@ static struct platform_device wrt350n_v2_nor_flash = {
100 101
101static struct mv643xx_eth_platform_data wrt350n_v2_eth_data = { 102static struct mv643xx_eth_platform_data wrt350n_v2_eth_data = {
102 .phy_addr = -1, 103 .phy_addr = -1,
104 .speed = SPEED_1000,
105 .duplex = DUPLEX_FULL,
103}; 106};
104 107
105static void __init wrt350n_v2_init(void) 108static void __init wrt350n_v2_init(void)
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c
index 333a82a3717e..db7b3e38ef1d 100644
--- a/arch/arm/mm/consistent.c
+++ b/arch/arm/mm/consistent.c
@@ -274,6 +274,11 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
274void * 274void *
275dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp) 275dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp)
276{ 276{
277 void *memory;
278
279 if (dma_alloc_from_coherent(dev, size, handle, &memory))
280 return memory;
281
277 if (arch_is_coherent()) { 282 if (arch_is_coherent()) {
278 void *virt; 283 void *virt;
279 284
@@ -362,6 +367,9 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr
362 367
363 WARN_ON(irqs_disabled()); 368 WARN_ON(irqs_disabled());
364 369
370 if (dma_release_from_coherent(dev, get_order(size), cpu_addr))
371 return;
372
365 if (arch_is_coherent()) { 373 if (arch_is_coherent()) {
366 kfree(cpu_addr); 374 kfree(cpu_addr);
367 return; 375 return;
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index 2a92cb1886ca..7a64fcef9d07 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -641,6 +641,7 @@ config PCI
641 bool 641 bool
642 depends on ETRAX_CARDBUS 642 depends on ETRAX_CARDBUS
643 default y 643 default y
644 select HAVE_GENERIC_DMA_COHERENT
644 645
645config ETRAX_IOP_FW_LOAD 646config ETRAX_IOP_FW_LOAD
646 tristate "IO-processor hotplug firmware loading support" 647 tristate "IO-processor hotplug firmware loading support"
diff --git a/arch/cris/arch-v32/drivers/pci/dma.c b/arch/cris/arch-v32/drivers/pci/dma.c
index e0364654fc44..fbe65954ee6c 100644
--- a/arch/cris/arch-v32/drivers/pci/dma.c
+++ b/arch/cris/arch-v32/drivers/pci/dma.c
@@ -15,35 +15,16 @@
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <asm/io.h> 16#include <asm/io.h>
17 17
18struct dma_coherent_mem {
19 void *virt_base;
20 u32 device_base;
21 int size;
22 int flags;
23 unsigned long *bitmap;
24};
25
26void *dma_alloc_coherent(struct device *dev, size_t size, 18void *dma_alloc_coherent(struct device *dev, size_t size,
27 dma_addr_t *dma_handle, gfp_t gfp) 19 dma_addr_t *dma_handle, gfp_t gfp)
28{ 20{
29 void *ret; 21 void *ret;
30 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
31 int order = get_order(size); 22 int order = get_order(size);
32 /* ignore region specifiers */ 23 /* ignore region specifiers */
33 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM); 24 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
34 25
35 if (mem) { 26 if (dma_alloc_from_coherent(dev, size, dma_handle, &ret))
36 int page = bitmap_find_free_region(mem->bitmap, mem->size, 27 return ret;
37 order);
38 if (page >= 0) {
39 *dma_handle = mem->device_base + (page << PAGE_SHIFT);
40 ret = mem->virt_base + (page << PAGE_SHIFT);
41 memset(ret, 0, size);
42 return ret;
43 }
44 if (mem->flags & DMA_MEMORY_EXCLUSIVE)
45 return NULL;
46 }
47 28
48 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff)) 29 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
49 gfp |= GFP_DMA; 30 gfp |= GFP_DMA;
@@ -60,90 +41,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
60void dma_free_coherent(struct device *dev, size_t size, 41void dma_free_coherent(struct device *dev, size_t size,
61 void *vaddr, dma_addr_t dma_handle) 42 void *vaddr, dma_addr_t dma_handle)
62{ 43{
63 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
64 int order = get_order(size); 44 int order = get_order(size);
65 45
66 if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) { 46 if (!dma_release_from_coherent(dev, order, vaddr))
67 int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
68
69 bitmap_release_region(mem->bitmap, page, order);
70 } else
71 free_pages((unsigned long)vaddr, order); 47 free_pages((unsigned long)vaddr, order);
72} 48}
73 49
74int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
75 dma_addr_t device_addr, size_t size, int flags)
76{
77 void __iomem *mem_base;
78 int pages = size >> PAGE_SHIFT;
79 int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long);
80
81 if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0)
82 goto out;
83 if (!size)
84 goto out;
85 if (dev->dma_mem)
86 goto out;
87
88 /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */
89
90 mem_base = ioremap(bus_addr, size);
91 if (!mem_base)
92 goto out;
93
94 dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
95 if (!dev->dma_mem)
96 goto iounmap_out;
97 dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
98 if (!dev->dma_mem->bitmap)
99 goto free1_out;
100
101 dev->dma_mem->virt_base = mem_base;
102 dev->dma_mem->device_base = device_addr;
103 dev->dma_mem->size = pages;
104 dev->dma_mem->flags = flags;
105
106 if (flags & DMA_MEMORY_MAP)
107 return DMA_MEMORY_MAP;
108
109 return DMA_MEMORY_IO;
110
111 free1_out:
112 kfree(dev->dma_mem);
113 iounmap_out:
114 iounmap(mem_base);
115 out:
116 return 0;
117}
118EXPORT_SYMBOL(dma_declare_coherent_memory);
119
120void dma_release_declared_memory(struct device *dev)
121{
122 struct dma_coherent_mem *mem = dev->dma_mem;
123
124 if(!mem)
125 return;
126 dev->dma_mem = NULL;
127 iounmap(mem->virt_base);
128 kfree(mem->bitmap);
129 kfree(mem);
130}
131EXPORT_SYMBOL(dma_release_declared_memory);
132
133void *dma_mark_declared_memory_occupied(struct device *dev,
134 dma_addr_t device_addr, size_t size)
135{
136 struct dma_coherent_mem *mem = dev->dma_mem;
137 int pages = (size + (device_addr & ~PAGE_MASK) + PAGE_SIZE - 1) >> PAGE_SHIFT;
138 int pos, err;
139
140 if (!mem)
141 return ERR_PTR(-EINVAL);
142
143 pos = (device_addr - mem->device_base) >> PAGE_SHIFT;
144 err = bitmap_allocate_region(mem->bitmap, pos, get_order(pages));
145 if (err != 0)
146 return ERR_PTR(err);
147 return mem->virt_base + (pos << PAGE_SHIFT);
148}
149EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
diff --git a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c
index c45fc7f5a979..b0f615759e97 100644
--- a/arch/ia64/mm/hugetlbpage.c
+++ b/arch/ia64/mm/hugetlbpage.c
@@ -13,6 +13,7 @@
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/hugetlb.h> 14#include <linux/hugetlb.h>
15#include <linux/pagemap.h> 15#include <linux/pagemap.h>
16#include <linux/module.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
17#include <linux/sysctl.h> 18#include <linux/sysctl.h>
18#include <linux/log2.h> 19#include <linux/log2.h>
@@ -21,7 +22,8 @@
21#include <asm/tlb.h> 22#include <asm/tlb.h>
22#include <asm/tlbflush.h> 23#include <asm/tlbflush.h>
23 24
24unsigned int hpage_shift=HPAGE_SHIFT_DEFAULT; 25unsigned int hpage_shift = HPAGE_SHIFT_DEFAULT;
26EXPORT_SYMBOL(hpage_shift);
25 27
26pte_t * 28pte_t *
27huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz) 29huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b4c4eaa5dd26..4da736e25333 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3,6 +3,7 @@ config MIPS
3 default y 3 default y
4 select HAVE_IDE 4 select HAVE_IDE
5 select HAVE_OPROFILE 5 select HAVE_OPROFILE
6 select HAVE_ARCH_KGDB
6 # Horrible source of confusion. Die, die, die ... 7 # Horrible source of confusion. Die, die, die ...
7 select EMBEDDED 8 select EMBEDDED
8 select RTC_LIB 9 select RTC_LIB
@@ -34,7 +35,6 @@ config BASLER_EXCITE
34 select SYS_HAS_CPU_RM9000 35 select SYS_HAS_CPU_RM9000
35 select SYS_SUPPORTS_32BIT_KERNEL 36 select SYS_SUPPORTS_32BIT_KERNEL
36 select SYS_SUPPORTS_BIG_ENDIAN 37 select SYS_SUPPORTS_BIG_ENDIAN
37 select SYS_SUPPORTS_KGDB
38 help 38 help
39 The eXcite is a smart camera platform manufactured by 39 The eXcite is a smart camera platform manufactured by
40 Basler Vision Technologies AG. 40 Basler Vision Technologies AG.
@@ -280,7 +280,6 @@ config PMC_MSP
280 select SYS_HAS_CPU_MIPS32_R2 280 select SYS_HAS_CPU_MIPS32_R2
281 select SYS_SUPPORTS_32BIT_KERNEL 281 select SYS_SUPPORTS_32BIT_KERNEL
282 select SYS_SUPPORTS_BIG_ENDIAN 282 select SYS_SUPPORTS_BIG_ENDIAN
283 select SYS_SUPPORTS_KGDB
284 select IRQ_CPU 283 select IRQ_CPU
285 select SERIAL_8250 284 select SERIAL_8250
286 select SERIAL_8250_CONSOLE 285 select SERIAL_8250_CONSOLE
@@ -306,7 +305,6 @@ config PMC_YOSEMITE
306 select SYS_SUPPORTS_64BIT_KERNEL 305 select SYS_SUPPORTS_64BIT_KERNEL
307 select SYS_SUPPORTS_BIG_ENDIAN 306 select SYS_SUPPORTS_BIG_ENDIAN
308 select SYS_SUPPORTS_HIGHMEM 307 select SYS_SUPPORTS_HIGHMEM
309 select SYS_SUPPORTS_KGDB
310 select SYS_SUPPORTS_SMP 308 select SYS_SUPPORTS_SMP
311 help 309 help
312 Yosemite is an evaluation board for the RM9000x2 processor 310 Yosemite is an evaluation board for the RM9000x2 processor
@@ -359,7 +357,6 @@ config SGI_IP27
359 select SYS_HAS_CPU_R10000 357 select SYS_HAS_CPU_R10000
360 select SYS_SUPPORTS_64BIT_KERNEL 358 select SYS_SUPPORTS_64BIT_KERNEL
361 select SYS_SUPPORTS_BIG_ENDIAN 359 select SYS_SUPPORTS_BIG_ENDIAN
362 select SYS_SUPPORTS_KGDB
363 select SYS_SUPPORTS_NUMA 360 select SYS_SUPPORTS_NUMA
364 select SYS_SUPPORTS_SMP 361 select SYS_SUPPORTS_SMP
365 select GENERIC_HARDIRQS_NO__DO_IRQ 362 select GENERIC_HARDIRQS_NO__DO_IRQ
@@ -475,7 +472,6 @@ config SIBYTE_SWARM
475 select SYS_HAS_CPU_SB1 472 select SYS_HAS_CPU_SB1
476 select SYS_SUPPORTS_BIG_ENDIAN 473 select SYS_SUPPORTS_BIG_ENDIAN
477 select SYS_SUPPORTS_HIGHMEM 474 select SYS_SUPPORTS_HIGHMEM
478 select SYS_SUPPORTS_KGDB
479 select SYS_SUPPORTS_LITTLE_ENDIAN 475 select SYS_SUPPORTS_LITTLE_ENDIAN
480 select ZONE_DMA32 if 64BIT 476 select ZONE_DMA32 if 64BIT
481 477
@@ -868,7 +864,6 @@ config SOC_PNX8550
868 select SYS_HAS_EARLY_PRINTK 864 select SYS_HAS_EARLY_PRINTK
869 select SYS_SUPPORTS_32BIT_KERNEL 865 select SYS_SUPPORTS_32BIT_KERNEL
870 select GENERIC_HARDIRQS_NO__DO_IRQ 866 select GENERIC_HARDIRQS_NO__DO_IRQ
871 select SYS_SUPPORTS_KGDB
872 select GENERIC_GPIO 867 select GENERIC_GPIO
873 868
874config SWAP_IO_SPACE 869config SWAP_IO_SPACE
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index f18cf92650e3..765c8e287d2b 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -34,28 +34,6 @@ config SMTC_IDLE_HOOK_DEBUG
34 arch/mips/kernel/smtc.c. This debugging option result in significant 34 arch/mips/kernel/smtc.c. This debugging option result in significant
35 overhead so should be disabled in production kernels. 35 overhead so should be disabled in production kernels.
36 36
37config KGDB
38 bool "Remote GDB kernel debugging"
39 depends on DEBUG_KERNEL && SYS_SUPPORTS_KGDB
40 select DEBUG_INFO
41 help
42 If you say Y here, it will be possible to remotely debug the MIPS
43 kernel using gdb. This enlarges your kernel image disk size by
44 several megabytes and requires a machine with more than 16 MB,
45 better 32 MB RAM to avoid excessive linking time. This is only
46 useful for kernel hackers. If unsure, say N.
47
48config SYS_SUPPORTS_KGDB
49 bool
50
51config GDB_CONSOLE
52 bool "Console output to GDB"
53 depends on KGDB
54 help
55 If you are using GDB for remote debugging over a serial port and
56 would like kernel messages to be formatted into GDB $O packets so
57 that GDB prints them as program output, say 'Y'.
58
59config SB1XXX_CORELIS 37config SB1XXX_CORELIS
60 bool "Corelis Debugger" 38 bool "Corelis Debugger"
61 depends on SIBYTE_SB1xxx_SOC 39 depends on SIBYTE_SB1xxx_SOC
diff --git a/arch/mips/au1000/Kconfig b/arch/mips/au1000/Kconfig
index 1fe97cccead1..e4a057d80ab6 100644
--- a/arch/mips/au1000/Kconfig
+++ b/arch/mips/au1000/Kconfig
@@ -134,4 +134,3 @@ config SOC_AU1X00
134 select SYS_HAS_CPU_MIPS32_R1 134 select SYS_HAS_CPU_MIPS32_R1
135 select SYS_SUPPORTS_32BIT_KERNEL 135 select SYS_SUPPORTS_32BIT_KERNEL
136 select SYS_SUPPORTS_APM_EMULATION 136 select SYS_SUPPORTS_APM_EMULATION
137 select SYS_SUPPORTS_KGDB
diff --git a/arch/mips/au1000/common/Makefile b/arch/mips/au1000/common/Makefile
index dd0e19dacfcf..df48fd65bbf3 100644
--- a/arch/mips/au1000/common/Makefile
+++ b/arch/mips/au1000/common/Makefile
@@ -9,7 +9,6 @@ obj-y += prom.o irq.o puts.o time.o reset.o \
9 au1xxx_irqmap.o clocks.o platform.o power.o setup.o \ 9 au1xxx_irqmap.o clocks.o platform.o power.o setup.o \
10 sleeper.o cputable.o dma.o dbdma.o gpio.o 10 sleeper.o cputable.o dma.o dbdma.o gpio.o
11 11
12obj-$(CONFIG_KGDB) += dbg_io.o
13obj-$(CONFIG_PCI) += pci.o 12obj-$(CONFIG_PCI) += pci.o
14 13
15EXTRA_CFLAGS += -Werror 14EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/au1000/common/dbg_io.c b/arch/mips/au1000/common/dbg_io.c
deleted file mode 100644
index af5be7df2f2a..000000000000
--- a/arch/mips/au1000/common/dbg_io.c
+++ /dev/null
@@ -1,109 +0,0 @@
1#include <linux/types.h>
2
3#include <asm/mach-au1x00/au1000.h>
4
5#ifdef CONFIG_KGDB
6
7/*
8 * FIXME the user should be able to select the
9 * uart to be used for debugging.
10 */
11#define DEBUG_BASE UART_DEBUG_BASE
12
13#define UART16550_BAUD_2400 2400
14#define UART16550_BAUD_4800 4800
15#define UART16550_BAUD_9600 9600
16#define UART16550_BAUD_19200 19200
17#define UART16550_BAUD_38400 38400
18#define UART16550_BAUD_57600 57600
19#define UART16550_BAUD_115200 115200
20
21#define UART16550_PARITY_NONE 0
22#define UART16550_PARITY_ODD 0x08
23#define UART16550_PARITY_EVEN 0x18
24#define UART16550_PARITY_MARK 0x28
25#define UART16550_PARITY_SPACE 0x38
26
27#define UART16550_DATA_5BIT 0x0
28#define UART16550_DATA_6BIT 0x1
29#define UART16550_DATA_7BIT 0x2
30#define UART16550_DATA_8BIT 0x3
31
32#define UART16550_STOP_1BIT 0x0
33#define UART16550_STOP_2BIT 0x4
34
35
36#define UART_RX 0 /* Receive buffer */
37#define UART_TX 4 /* Transmit buffer */
38#define UART_IER 8 /* Interrupt Enable Register */
39#define UART_IIR 0xC /* Interrupt ID Register */
40#define UART_FCR 0x10 /* FIFO Control Register */
41#define UART_LCR 0x14 /* Line Control Register */
42#define UART_MCR 0x18 /* Modem Control Register */
43#define UART_LSR 0x1C /* Line Status Register */
44#define UART_MSR 0x20 /* Modem Status Register */
45#define UART_CLK 0x28 /* Baud Rat4e Clock Divider */
46#define UART_MOD_CNTRL 0x100 /* Module Control */
47
48/* memory-mapped read/write of the port */
49#define UART16550_READ(y) (au_readl(DEBUG_BASE + y) & 0xff)
50#define UART16550_WRITE(y, z) (au_writel(z & 0xff, DEBUG_BASE + y))
51
52extern unsigned long calc_clock(void);
53
54void debugInit(u32 baud, u8 data, u8 parity, u8 stop)
55{
56 if (UART16550_READ(UART_MOD_CNTRL) != 0x3)
57 UART16550_WRITE(UART_MOD_CNTRL, 3);
58 calc_clock();
59
60 /* disable interrupts */
61 UART16550_WRITE(UART_IER, 0);
62
63 /* set up baud rate */
64 {
65 u32 divisor;
66
67 /* set divisor */
68 divisor = get_au1x00_uart_baud_base() / baud;
69 UART16550_WRITE(UART_CLK, divisor & 0xffff);
70 }
71
72 /* set data format */
73 UART16550_WRITE(UART_LCR, (data | parity | stop));
74}
75
76static int remoteDebugInitialized;
77
78u8 getDebugChar(void)
79{
80 if (!remoteDebugInitialized) {
81 remoteDebugInitialized = 1;
82 debugInit(UART16550_BAUD_115200,
83 UART16550_DATA_8BIT,
84 UART16550_PARITY_NONE,
85 UART16550_STOP_1BIT);
86 }
87
88 while ((UART16550_READ(UART_LSR) & 0x1) == 0);
89 return UART16550_READ(UART_RX);
90}
91
92
93int putDebugChar(u8 byte)
94{
95 if (!remoteDebugInitialized) {
96 remoteDebugInitialized = 1;
97 debugInit(UART16550_BAUD_115200,
98 UART16550_DATA_8BIT,
99 UART16550_PARITY_NONE,
100 UART16550_STOP_1BIT);
101 }
102
103 while ((UART16550_READ(UART_LSR) & 0x40) == 0);
104 UART16550_WRITE(UART_TX, byte);
105
106 return 1;
107}
108
109#endif
diff --git a/arch/mips/au1000/db1x00/init.c b/arch/mips/au1000/db1x00/init.c
index 5ebe0de5e459..847413514964 100644
--- a/arch/mips/au1000/db1x00/init.c
+++ b/arch/mips/au1000/db1x00/init.c
@@ -57,6 +57,6 @@ void __init prom_init(void)
57 if (!memsize_str) 57 if (!memsize_str)
58 memsize = 0x04000000; 58 memsize = 0x04000000;
59 else 59 else
60 memsize = strict_strtol(memsize_str, 0, NULL); 60 strict_strtol(memsize_str, 0, &memsize);
61 add_memory_region(0, memsize, BOOT_MEM_RAM); 61 add_memory_region(0, memsize, BOOT_MEM_RAM);
62} 62}
diff --git a/arch/mips/au1000/mtx-1/init.c b/arch/mips/au1000/mtx-1/init.c
index 33a4aebe0cba..3bae13c28954 100644
--- a/arch/mips/au1000/mtx-1/init.c
+++ b/arch/mips/au1000/mtx-1/init.c
@@ -55,6 +55,6 @@ void __init prom_init(void)
55 if (!memsize_str) 55 if (!memsize_str)
56 memsize = 0x04000000; 56 memsize = 0x04000000;
57 else 57 else
58 memsize = strict_strtol(memsize_str, 0, NULL); 58 strict_strtol(memsize_str, 0, &memsize);
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 59 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 60}
diff --git a/arch/mips/au1000/pb1000/init.c b/arch/mips/au1000/pb1000/init.c
index 3837365d613d..8a9c7d57208d 100644
--- a/arch/mips/au1000/pb1000/init.c
+++ b/arch/mips/au1000/pb1000/init.c
@@ -52,6 +52,6 @@ void __init prom_init(void)
52 if (!memsize_str) 52 if (!memsize_str)
53 memsize = 0x04000000; 53 memsize = 0x04000000;
54 else 54 else
55 memsize = strict_strtol(memsize_str, 0, NULL); 55 strict_strtol(memsize_str, 0, &memsize);
56 add_memory_region(0, memsize, BOOT_MEM_RAM); 56 add_memory_region(0, memsize, BOOT_MEM_RAM);
57} 57}
diff --git a/arch/mips/au1000/pb1100/init.c b/arch/mips/au1000/pb1100/init.c
index 8355483f3de2..7c6792308bc5 100644
--- a/arch/mips/au1000/pb1100/init.c
+++ b/arch/mips/au1000/pb1100/init.c
@@ -54,7 +54,7 @@ void __init prom_init(void)
54 if (!memsize_str) 54 if (!memsize_str)
55 memsize = 0x04000000; 55 memsize = 0x04000000;
56 else 56 else
57 memsize = strict_strtol(memsize_str, 0, NULL); 57 strict_strtol(memsize_str, 0, &memsize);
58 58
59 add_memory_region(0, memsize, BOOT_MEM_RAM); 59 add_memory_region(0, memsize, BOOT_MEM_RAM);
60} 60}
diff --git a/arch/mips/au1000/pb1200/init.c b/arch/mips/au1000/pb1200/init.c
index 09fd63b86062..e9b2a0fd48ae 100644
--- a/arch/mips/au1000/pb1200/init.c
+++ b/arch/mips/au1000/pb1200/init.c
@@ -53,6 +53,6 @@ void __init prom_init(void)
53 if (!memsize_str) 53 if (!memsize_str)
54 memsize = 0x08000000; 54 memsize = 0x08000000;
55 else 55 else
56 memsize = strict_strtol(memsize_str, 0, NULL); 56 strict_strtol(memsize_str, 0, &memsize);
57 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
58} 58}
diff --git a/arch/mips/au1000/pb1500/init.c b/arch/mips/au1000/pb1500/init.c
index 49f51e165863..3b6e395cf952 100644
--- a/arch/mips/au1000/pb1500/init.c
+++ b/arch/mips/au1000/pb1500/init.c
@@ -53,6 +53,6 @@ void __init prom_init(void)
53 if (!memsize_str) 53 if (!memsize_str)
54 memsize = 0x04000000; 54 memsize = 0x04000000;
55 else 55 else
56 memsize = strict_strtol(memsize_str, 0, NULL); 56 strict_strtol(memsize_str, 0, &memsize);
57 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
58} 58}
diff --git a/arch/mips/au1000/pb1550/init.c b/arch/mips/au1000/pb1550/init.c
index 1b5f58434bb7..e1055a13a1a0 100644
--- a/arch/mips/au1000/pb1550/init.c
+++ b/arch/mips/au1000/pb1550/init.c
@@ -53,6 +53,6 @@ void __init prom_init(void)
53 if (!memsize_str) 53 if (!memsize_str)
54 memsize = 0x08000000; 54 memsize = 0x08000000;
55 else 55 else
56 memsize = strict_strtol(memsize_str, 0, NULL); 56 strict_strtol(memsize_str, 0, &memsize);
57 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
58} 58}
diff --git a/arch/mips/au1000/xxs1500/init.c b/arch/mips/au1000/xxs1500/init.c
index b849bf501c04..7516434760a1 100644
--- a/arch/mips/au1000/xxs1500/init.c
+++ b/arch/mips/au1000/xxs1500/init.c
@@ -53,6 +53,6 @@ void __init prom_init(void)
53 if (!memsize_str) 53 if (!memsize_str)
54 memsize = 0x04000000; 54 memsize = 0x04000000;
55 else 55 else
56 memsize = strict_strtol(memsize_str, 0, NULL); 56 strict_strtol(memsize_str, 0, &memsize);
57 add_memory_region(0, memsize, BOOT_MEM_RAM); 57 add_memory_region(0, memsize, BOOT_MEM_RAM);
58} 58}
diff --git a/arch/mips/basler/excite/Makefile b/arch/mips/basler/excite/Makefile
index 519142c2e4ef..cff29cf46d03 100644
--- a/arch/mips/basler/excite/Makefile
+++ b/arch/mips/basler/excite/Makefile
@@ -5,5 +5,4 @@
5obj-$(CONFIG_BASLER_EXCITE) += excite_irq.o excite_prom.o excite_setup.o \ 5obj-$(CONFIG_BASLER_EXCITE) += excite_irq.o excite_prom.o excite_setup.o \
6 excite_device.o excite_procfs.o 6 excite_device.o excite_procfs.o
7 7
8obj-$(CONFIG_KGDB) += excite_dbg_io.o
9obj-m += excite_iodev.o 8obj-m += excite_iodev.o
diff --git a/arch/mips/basler/excite/excite_dbg_io.c b/arch/mips/basler/excite/excite_dbg_io.c
deleted file mode 100644
index d289e3a868cf..000000000000
--- a/arch/mips/basler/excite/excite_dbg_io.c
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 * Copyright (C) 2004 by Basler Vision Technologies AG
3 * Author: Thomas Koeller <thomas.koeller@baslerweb.com>
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/linkage.h>
21#include <linux/init.h>
22#include <linux/kernel.h>
23#include <asm/gdb-stub.h>
24#include <asm/rm9k-ocd.h>
25#include <excite.h>
26
27#if defined(CONFIG_SERIAL_8250) && CONFIG_SERIAL_8250_NR_UARTS > 1
28#error Debug port used by serial driver
29#endif
30
31#define UART_CLK 25000000
32#define BASE_BAUD (UART_CLK / 16)
33#define REGISTER_BASE_0 0x0208UL
34#define REGISTER_BASE_1 0x0238UL
35
36#define REGISTER_BASE_DBG REGISTER_BASE_1
37
38#define CPRR 0x0004
39#define UACFG 0x0200
40#define UAINTS 0x0204
41#define UARBR (REGISTER_BASE_DBG + 0x0000)
42#define UATHR (REGISTER_BASE_DBG + 0x0004)
43#define UADLL (REGISTER_BASE_DBG + 0x0008)
44#define UAIER (REGISTER_BASE_DBG + 0x000c)
45#define UADLH (REGISTER_BASE_DBG + 0x0010)
46#define UAIIR (REGISTER_BASE_DBG + 0x0014)
47#define UAFCR (REGISTER_BASE_DBG + 0x0018)
48#define UALCR (REGISTER_BASE_DBG + 0x001c)
49#define UAMCR (REGISTER_BASE_DBG + 0x0020)
50#define UALSR (REGISTER_BASE_DBG + 0x0024)
51#define UAMSR (REGISTER_BASE_DBG + 0x0028)
52#define UASCR (REGISTER_BASE_DBG + 0x002c)
53
54#define PARITY_NONE 0
55#define PARITY_ODD 0x08
56#define PARITY_EVEN 0x18
57#define PARITY_MARK 0x28
58#define PARITY_SPACE 0x38
59
60#define DATA_5BIT 0x0
61#define DATA_6BIT 0x1
62#define DATA_7BIT 0x2
63#define DATA_8BIT 0x3
64
65#define STOP_1BIT 0x0
66#define STOP_2BIT 0x4
67
68#define BAUD_DBG 57600
69#define PARITY_DBG PARITY_NONE
70#define DATA_DBG DATA_8BIT
71#define STOP_DBG STOP_1BIT
72
73/* Initialize the serial port for KGDB debugging */
74void __init excite_kgdb_init(void)
75{
76 const u32 divisor = BASE_BAUD / BAUD_DBG;
77
78 /* Take the UART out of reset */
79 titan_writel(0x00ff1cff, CPRR);
80 titan_writel(0x00000000, UACFG);
81 titan_writel(0x00000002, UACFG);
82
83 titan_writel(0x0, UALCR);
84 titan_writel(0x0, UAIER);
85
86 /* Disable FIFOs */
87 titan_writel(0x00, UAFCR);
88
89 titan_writel(0x80, UALCR);
90 titan_writel(divisor & 0xff, UADLL);
91 titan_writel((divisor & 0xff00) >> 8, UADLH);
92 titan_writel(0x0, UALCR);
93
94 titan_writel(DATA_DBG | PARITY_DBG | STOP_DBG, UALCR);
95
96 /* Enable receiver interrupt */
97 titan_readl(UARBR);
98 titan_writel(0x1, UAIER);
99}
100
101int getDebugChar(void)
102{
103 while (!(titan_readl(UALSR) & 0x1));
104 return titan_readl(UARBR);
105}
106
107int putDebugChar(int data)
108{
109 while (!(titan_readl(UALSR) & 0x20));
110 titan_writel(data, UATHR);
111 return 1;
112}
113
114/* KGDB interrupt handler */
115asmlinkage void excite_kgdb_inthdl(void)
116{
117 if (unlikely(
118 ((titan_readl(UAIIR) & 0x7) == 4)
119 && ((titan_readl(UARBR) & 0xff) == 0x3)))
120 set_async_breakpoint(&regs->cp0_epc);
121}
diff --git a/arch/mips/basler/excite/excite_irq.c b/arch/mips/basler/excite/excite_irq.c
index 4903e067916b..934e0a6b1011 100644
--- a/arch/mips/basler/excite/excite_irq.c
+++ b/arch/mips/basler/excite/excite_irq.c
@@ -50,10 +50,6 @@ void __init arch_init_irq(void)
50 mips_cpu_irq_init(); 50 mips_cpu_irq_init();
51 rm7k_cpu_irq_init(); 51 rm7k_cpu_irq_init();
52 rm9k_cpu_irq_init(); 52 rm9k_cpu_irq_init();
53
54#ifdef CONFIG_KGDB
55 excite_kgdb_init();
56#endif
57} 53}
58 54
59asmlinkage void plat_irq_dispatch(void) 55asmlinkage void plat_irq_dispatch(void)
@@ -90,9 +86,6 @@ asmlinkage void plat_irq_dispatch(void)
90 msgint = msgintflags & msgintmask & (0x1 << (TITAN_MSGINT % 0x20)); 86 msgint = msgintflags & msgintmask & (0x1 << (TITAN_MSGINT % 0x20));
91 if ((pending & (1 << TITAN_IRQ)) && msgint) { 87 if ((pending & (1 << TITAN_IRQ)) && msgint) {
92 ocd_writel(msgint, INTP0Clear0 + (TITAN_MSGINT / 0x20 * 0x10)); 88 ocd_writel(msgint, INTP0Clear0 + (TITAN_MSGINT / 0x20 * 0x10));
93#if defined(CONFIG_KGDB)
94 excite_kgdb_inthdl();
95#endif
96 do_IRQ(TITAN_IRQ); 89 do_IRQ(TITAN_IRQ);
97 return; 90 return;
98 } 91 }
diff --git a/arch/mips/basler/excite/excite_setup.c b/arch/mips/basler/excite/excite_setup.c
index 6dd8f0d46d09..d66b3b8edf2a 100644
--- a/arch/mips/basler/excite/excite_setup.c
+++ b/arch/mips/basler/excite/excite_setup.c
@@ -95,13 +95,13 @@ static int __init excite_init_console(void)
95 /* Take the DUART out of reset */ 95 /* Take the DUART out of reset */
96 titan_writel(0x00ff1cff, CPRR); 96 titan_writel(0x00ff1cff, CPRR);
97 97
98#if defined(CONFIG_KGDB) || (CONFIG_SERIAL_8250_NR_UARTS > 1) 98#if (CONFIG_SERIAL_8250_NR_UARTS > 1)
99 /* Enable both ports */ 99 /* Enable both ports */
100 titan_writel(MASK_SER0 | MASK_SER1, UACFG); 100 titan_writel(MASK_SER0 | MASK_SER1, UACFG);
101#else 101#else
102 /* Enable port #0 only */ 102 /* Enable port #0 only */
103 titan_writel(MASK_SER0, UACFG); 103 titan_writel(MASK_SER0, UACFG);
104#endif /* defined(CONFIG_KGDB) */ 104#endif
105 105
106 /* 106 /*
107 * Set up serial port #0. Do not use autodetection; the result is 107 * Set up serial port #0. Do not use autodetection; the result is
diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
index 2678b7ec3351..eb44b72254af 100644
--- a/arch/mips/configs/cobalt_defconfig
+++ b/arch/mips/configs/cobalt_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.23-rc5 3# Linux kernel version: 2.6.26
4# Thu Sep 6 13:14:29 2007 4# Fri Jul 25 10:25:34 2008
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -10,9 +10,11 @@ CONFIG_MIPS=y
10# 10#
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_BASLER_EXCITE is not set 12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set
13CONFIG_MIPS_COBALT=y 14CONFIG_MIPS_COBALT=y
14# CONFIG_MACH_DECSTATION is not set 15# CONFIG_MACH_DECSTATION is not set
15# CONFIG_MACH_JAZZ is not set 16# CONFIG_MACH_JAZZ is not set
17# CONFIG_LASAT is not set
16# CONFIG_LEMOTE_FULONG is not set 18# CONFIG_LEMOTE_FULONG is not set
17# CONFIG_MIPS_MALTA is not set 19# CONFIG_MIPS_MALTA is not set
18# CONFIG_MIPS_SIM is not set 20# CONFIG_MIPS_SIM is not set
@@ -24,6 +26,7 @@ CONFIG_MIPS_COBALT=y
24# CONFIG_PMC_YOSEMITE is not set 26# CONFIG_PMC_YOSEMITE is not set
25# CONFIG_SGI_IP22 is not set 27# CONFIG_SGI_IP22 is not set
26# CONFIG_SGI_IP27 is not set 28# CONFIG_SGI_IP27 is not set
29# CONFIG_SGI_IP28 is not set
27# CONFIG_SGI_IP32 is not set 30# CONFIG_SGI_IP32 is not set
28# CONFIG_SIBYTE_CRHINE is not set 31# CONFIG_SIBYTE_CRHINE is not set
29# CONFIG_SIBYTE_CARMEL is not set 32# CONFIG_SIBYTE_CARMEL is not set
@@ -34,19 +37,25 @@ CONFIG_MIPS_COBALT=y
34# CONFIG_SIBYTE_SENTOSA is not set 37# CONFIG_SIBYTE_SENTOSA is not set
35# CONFIG_SIBYTE_BIGSUR is not set 38# CONFIG_SIBYTE_BIGSUR is not set
36# CONFIG_SNI_RM is not set 39# CONFIG_SNI_RM is not set
37# CONFIG_TOSHIBA_JMR3927 is not set 40# CONFIG_MACH_TX39XX is not set
38# CONFIG_TOSHIBA_RBTX4927 is not set 41# CONFIG_MACH_TX49XX is not set
39# CONFIG_TOSHIBA_RBTX4938 is not set 42# CONFIG_MIKROTIK_RB532 is not set
40# CONFIG_WR_PPMC is not set 43# CONFIG_WR_PPMC is not set
41CONFIG_RWSEM_GENERIC_SPINLOCK=y 44CONFIG_RWSEM_GENERIC_SPINLOCK=y
42# CONFIG_ARCH_HAS_ILOG2_U32 is not set 45# CONFIG_ARCH_HAS_ILOG2_U32 is not set
43# CONFIG_ARCH_HAS_ILOG2_U64 is not set 46# CONFIG_ARCH_HAS_ILOG2_U64 is not set
47CONFIG_ARCH_SUPPORTS_OPROFILE=y
44CONFIG_GENERIC_FIND_NEXT_BIT=y 48CONFIG_GENERIC_FIND_NEXT_BIT=y
45CONFIG_GENERIC_HWEIGHT=y 49CONFIG_GENERIC_HWEIGHT=y
46CONFIG_GENERIC_CALIBRATE_DELAY=y 50CONFIG_GENERIC_CALIBRATE_DELAY=y
51CONFIG_GENERIC_CLOCKEVENTS=y
47CONFIG_GENERIC_TIME=y 52CONFIG_GENERIC_TIME=y
53CONFIG_GENERIC_CMOS_UPDATE=y
48CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 54CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
49CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 55CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
56CONFIG_CEVT_GT641XX=y
57CONFIG_CEVT_R4K=y
58CONFIG_CSRC_R4K=y
50CONFIG_DMA_NONCOHERENT=y 59CONFIG_DMA_NONCOHERENT=y
51CONFIG_DMA_NEED_PCI_MAP_STATE=y 60CONFIG_DMA_NEED_PCI_MAP_STATE=y
52CONFIG_EARLY_PRINTK=y 61CONFIG_EARLY_PRINTK=y
@@ -108,6 +117,7 @@ CONFIG_CPU_HAS_SYNC=y
108CONFIG_GENERIC_HARDIRQS=y 117CONFIG_GENERIC_HARDIRQS=y
109CONFIG_GENERIC_IRQ_PROBE=y 118CONFIG_GENERIC_IRQ_PROBE=y
110CONFIG_ARCH_FLATMEM_ENABLE=y 119CONFIG_ARCH_FLATMEM_ENABLE=y
120CONFIG_ARCH_POPULATES_NODE_MAP=y
111CONFIG_SELECT_MEMORY_MODEL=y 121CONFIG_SELECT_MEMORY_MODEL=y
112CONFIG_FLATMEM_MANUAL=y 122CONFIG_FLATMEM_MANUAL=y
113# CONFIG_DISCONTIGMEM_MANUAL is not set 123# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -115,10 +125,16 @@ CONFIG_FLATMEM_MANUAL=y
115CONFIG_FLATMEM=y 125CONFIG_FLATMEM=y
116CONFIG_FLAT_NODE_MEM_MAP=y 126CONFIG_FLAT_NODE_MEM_MAP=y
117# CONFIG_SPARSEMEM_STATIC is not set 127# CONFIG_SPARSEMEM_STATIC is not set
128# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
129CONFIG_PAGEFLAGS_EXTENDED=y
118CONFIG_SPLIT_PTLOCK_CPUS=4 130CONFIG_SPLIT_PTLOCK_CPUS=4
119# CONFIG_RESOURCES_64BIT is not set 131# CONFIG_RESOURCES_64BIT is not set
120CONFIG_ZONE_DMA_FLAG=0 132CONFIG_ZONE_DMA_FLAG=0
121CONFIG_VIRT_TO_BUS=y 133CONFIG_VIRT_TO_BUS=y
134# CONFIG_TICK_ONESHOT is not set
135# CONFIG_NO_HZ is not set
136# CONFIG_HIGH_RES_TIMERS is not set
137CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
122# CONFIG_HZ_48 is not set 138# CONFIG_HZ_48 is not set
123# CONFIG_HZ_100 is not set 139# CONFIG_HZ_100 is not set
124# CONFIG_HZ_128 is not set 140# CONFIG_HZ_128 is not set
@@ -151,23 +167,28 @@ CONFIG_SYSVIPC_SYSCTL=y
151# CONFIG_POSIX_MQUEUE is not set 167# CONFIG_POSIX_MQUEUE is not set
152# CONFIG_BSD_PROCESS_ACCT is not set 168# CONFIG_BSD_PROCESS_ACCT is not set
153# CONFIG_TASKSTATS is not set 169# CONFIG_TASKSTATS is not set
154# CONFIG_USER_NS is not set
155# CONFIG_AUDIT is not set 170# CONFIG_AUDIT is not set
156# CONFIG_IKCONFIG is not set 171# CONFIG_IKCONFIG is not set
157CONFIG_LOG_BUF_SHIFT=14 172CONFIG_LOG_BUF_SHIFT=14
158CONFIG_SYSFS_DEPRECATED=y 173# CONFIG_CGROUPS is not set
174# CONFIG_GROUP_SCHED is not set
175# CONFIG_SYSFS_DEPRECATED_V2 is not set
159CONFIG_RELAY=y 176CONFIG_RELAY=y
177# CONFIG_NAMESPACES is not set
160# CONFIG_BLK_DEV_INITRD is not set 178# CONFIG_BLK_DEV_INITRD is not set
161# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 179# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
162CONFIG_SYSCTL=y 180CONFIG_SYSCTL=y
163CONFIG_EMBEDDED=y 181CONFIG_EMBEDDED=y
164CONFIG_SYSCTL_SYSCALL=y 182CONFIG_SYSCTL_SYSCALL=y
183CONFIG_SYSCTL_SYSCALL_CHECK=y
165CONFIG_KALLSYMS=y 184CONFIG_KALLSYMS=y
166# CONFIG_KALLSYMS_EXTRA_PASS is not set 185# CONFIG_KALLSYMS_EXTRA_PASS is not set
167CONFIG_HOTPLUG=y 186CONFIG_HOTPLUG=y
168CONFIG_PRINTK=y 187CONFIG_PRINTK=y
169CONFIG_BUG=y 188CONFIG_BUG=y
170CONFIG_ELF_CORE=y 189CONFIG_ELF_CORE=y
190CONFIG_PCSPKR_PLATFORM=y
191CONFIG_COMPAT_BRK=y
171CONFIG_BASE_FULL=y 192CONFIG_BASE_FULL=y
172CONFIG_FUTEX=y 193CONFIG_FUTEX=y
173CONFIG_ANON_INODES=y 194CONFIG_ANON_INODES=y
@@ -177,23 +198,37 @@ CONFIG_TIMERFD=y
177CONFIG_EVENTFD=y 198CONFIG_EVENTFD=y
178CONFIG_SHMEM=y 199CONFIG_SHMEM=y
179CONFIG_VM_EVENT_COUNTERS=y 200CONFIG_VM_EVENT_COUNTERS=y
180CONFIG_SLAB=y 201CONFIG_SLUB_DEBUG=y
181# CONFIG_SLUB is not set 202# CONFIG_SLAB is not set
203CONFIG_SLUB=y
182# CONFIG_SLOB is not set 204# CONFIG_SLOB is not set
205# CONFIG_PROFILING is not set
206# CONFIG_MARKERS is not set
207CONFIG_HAVE_OPROFILE=y
208# CONFIG_HAVE_IOREMAP_PROT is not set
209# CONFIG_HAVE_KPROBES is not set
210# CONFIG_HAVE_KRETPROBES is not set
211# CONFIG_HAVE_DMA_ATTRS is not set
212# CONFIG_USE_GENERIC_SMP_HELPERS is not set
213# CONFIG_HAVE_CLK is not set
214CONFIG_PROC_PAGE_MONITOR=y
215CONFIG_SLABINFO=y
183CONFIG_RT_MUTEXES=y 216CONFIG_RT_MUTEXES=y
184# CONFIG_TINY_SHMEM is not set 217# CONFIG_TINY_SHMEM is not set
185CONFIG_BASE_SMALL=0 218CONFIG_BASE_SMALL=0
186CONFIG_MODULES=y 219CONFIG_MODULES=y
220# CONFIG_MODULE_FORCE_LOAD is not set
187CONFIG_MODULE_UNLOAD=y 221CONFIG_MODULE_UNLOAD=y
188# CONFIG_MODULE_FORCE_UNLOAD is not set 222# CONFIG_MODULE_FORCE_UNLOAD is not set
189# CONFIG_MODVERSIONS is not set 223# CONFIG_MODVERSIONS is not set
190# CONFIG_MODULE_SRCVERSION_ALL is not set 224# CONFIG_MODULE_SRCVERSION_ALL is not set
191# CONFIG_KMOD is not set 225CONFIG_KMOD=y
192CONFIG_BLOCK=y 226CONFIG_BLOCK=y
193# CONFIG_LBD is not set 227# CONFIG_LBD is not set
194# CONFIG_BLK_DEV_IO_TRACE is not set 228# CONFIG_BLK_DEV_IO_TRACE is not set
195# CONFIG_LSF is not set 229# CONFIG_LSF is not set
196# CONFIG_BLK_DEV_BSG is not set 230# CONFIG_BLK_DEV_BSG is not set
231# CONFIG_BLK_DEV_INTEGRITY is not set
197 232
198# 233#
199# IO Schedulers 234# IO Schedulers
@@ -207,18 +242,18 @@ CONFIG_DEFAULT_AS=y
207# CONFIG_DEFAULT_CFQ is not set 242# CONFIG_DEFAULT_CFQ is not set
208# CONFIG_DEFAULT_NOOP is not set 243# CONFIG_DEFAULT_NOOP is not set
209CONFIG_DEFAULT_IOSCHED="anticipatory" 244CONFIG_DEFAULT_IOSCHED="anticipatory"
245CONFIG_CLASSIC_RCU=y
210 246
211# 247#
212# Bus options (PCI, PCMCIA, EISA, ISA, TC) 248# Bus options (PCI, PCMCIA, EISA, ISA, TC)
213# 249#
214CONFIG_HW_HAS_PCI=y 250CONFIG_HW_HAS_PCI=y
215CONFIG_PCI=y 251CONFIG_PCI=y
252CONFIG_PCI_DOMAINS=y
216# CONFIG_ARCH_SUPPORTS_MSI is not set 253# CONFIG_ARCH_SUPPORTS_MSI is not set
254CONFIG_PCI_LEGACY=y
217CONFIG_MMU=y 255CONFIG_MMU=y
218 256CONFIG_I8253=y
219#
220# PCCARD (PCMCIA/CardBus) support
221#
222# CONFIG_PCCARD is not set 257# CONFIG_PCCARD is not set
223# CONFIG_HOTPLUG_PCI is not set 258# CONFIG_HOTPLUG_PCI is not set
224 259
@@ -232,8 +267,8 @@ CONFIG_TRAD_SIGNALS=y
232# 267#
233# Power management options 268# Power management options
234# 269#
270CONFIG_ARCH_SUSPEND_POSSIBLE=y
235# CONFIG_PM is not set 271# CONFIG_PM is not set
236CONFIG_SUSPEND_UP_POSSIBLE=y
237 272
238# 273#
239# Networking 274# Networking
@@ -250,6 +285,7 @@ CONFIG_XFRM=y
250CONFIG_XFRM_USER=y 285CONFIG_XFRM_USER=y
251# CONFIG_XFRM_SUB_POLICY is not set 286# CONFIG_XFRM_SUB_POLICY is not set
252CONFIG_XFRM_MIGRATE=y 287CONFIG_XFRM_MIGRATE=y
288# CONFIG_XFRM_STATISTICS is not set
253CONFIG_NET_KEY=y 289CONFIG_NET_KEY=y
254CONFIG_NET_KEY_MIGRATE=y 290CONFIG_NET_KEY_MIGRATE=y
255CONFIG_INET=y 291CONFIG_INET=y
@@ -269,6 +305,7 @@ CONFIG_IP_FIB_HASH=y
269CONFIG_INET_XFRM_MODE_TRANSPORT=y 305CONFIG_INET_XFRM_MODE_TRANSPORT=y
270CONFIG_INET_XFRM_MODE_TUNNEL=y 306CONFIG_INET_XFRM_MODE_TUNNEL=y
271CONFIG_INET_XFRM_MODE_BEET=y 307CONFIG_INET_XFRM_MODE_BEET=y
308# CONFIG_INET_LRO is not set
272CONFIG_INET_DIAG=y 309CONFIG_INET_DIAG=y
273CONFIG_INET_TCP_DIAG=y 310CONFIG_INET_TCP_DIAG=y
274# CONFIG_TCP_CONG_ADVANCED is not set 311# CONFIG_TCP_CONG_ADVANCED is not set
@@ -276,8 +313,6 @@ CONFIG_TCP_CONG_CUBIC=y
276CONFIG_DEFAULT_TCP_CONG="cubic" 313CONFIG_DEFAULT_TCP_CONG="cubic"
277# CONFIG_TCP_MD5SIG is not set 314# CONFIG_TCP_MD5SIG is not set
278# CONFIG_IPV6 is not set 315# CONFIG_IPV6 is not set
279# CONFIG_INET6_XFRM_TUNNEL is not set
280# CONFIG_INET6_TUNNEL is not set
281# CONFIG_NETWORK_SECMARK is not set 316# CONFIG_NETWORK_SECMARK is not set
282# CONFIG_NETFILTER is not set 317# CONFIG_NETFILTER is not set
283# CONFIG_IP_DCCP is not set 318# CONFIG_IP_DCCP is not set
@@ -294,10 +329,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
294# CONFIG_LAPB is not set 329# CONFIG_LAPB is not set
295# CONFIG_ECONET is not set 330# CONFIG_ECONET is not set
296# CONFIG_WAN_ROUTER is not set 331# CONFIG_WAN_ROUTER is not set
297
298#
299# QoS and/or fair queueing
300#
301# CONFIG_NET_SCHED is not set 332# CONFIG_NET_SCHED is not set
302 333
303# 334#
@@ -305,6 +336,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
305# 336#
306# CONFIG_NET_PKTGEN is not set 337# CONFIG_NET_PKTGEN is not set
307# CONFIG_HAMRADIO is not set 338# CONFIG_HAMRADIO is not set
339# CONFIG_CAN is not set
308# CONFIG_IRDA is not set 340# CONFIG_IRDA is not set
309# CONFIG_BT is not set 341# CONFIG_BT is not set
310# CONFIG_AF_RXRPC is not set 342# CONFIG_AF_RXRPC is not set
@@ -326,9 +358,12 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
326# 358#
327# Generic Driver Options 359# Generic Driver Options
328# 360#
361CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
329CONFIG_STANDALONE=y 362CONFIG_STANDALONE=y
330CONFIG_PREVENT_FIRMWARE_BUILD=y 363CONFIG_PREVENT_FIRMWARE_BUILD=y
331CONFIG_FW_LOADER=y 364CONFIG_FW_LOADER=y
365CONFIG_FIRMWARE_IN_KERNEL=y
366CONFIG_EXTRA_FIRMWARE=""
332# CONFIG_SYS_HYPERVISOR is not set 367# CONFIG_SYS_HYPERVISOR is not set
333# CONFIG_CONNECTOR is not set 368# CONFIG_CONNECTOR is not set
334CONFIG_MTD=y 369CONFIG_MTD=y
@@ -337,6 +372,7 @@ CONFIG_MTD=y
337CONFIG_MTD_PARTITIONS=y 372CONFIG_MTD_PARTITIONS=y
338# CONFIG_MTD_REDBOOT_PARTS is not set 373# CONFIG_MTD_REDBOOT_PARTS is not set
339# CONFIG_MTD_CMDLINE_PARTS is not set 374# CONFIG_MTD_CMDLINE_PARTS is not set
375# CONFIG_MTD_AR7_PARTS is not set
340 376
341# 377#
342# User Modules And Translation Layers 378# User Modules And Translation Layers
@@ -350,6 +386,7 @@ CONFIG_MTD_BLKDEVS=y
350# CONFIG_INFTL is not set 386# CONFIG_INFTL is not set
351# CONFIG_RFD_FTL is not set 387# CONFIG_RFD_FTL is not set
352# CONFIG_SSFDC is not set 388# CONFIG_SSFDC is not set
389# CONFIG_MTD_OOPS is not set
353 390
354# 391#
355# RAM/ROM/Flash chip drivers 392# RAM/ROM/Flash chip drivers
@@ -384,6 +421,7 @@ CONFIG_MTD_PHYSMAP=y
384CONFIG_MTD_PHYSMAP_START=0x0 421CONFIG_MTD_PHYSMAP_START=0x0
385CONFIG_MTD_PHYSMAP_LEN=0x0 422CONFIG_MTD_PHYSMAP_LEN=0x0
386CONFIG_MTD_PHYSMAP_BANKWIDTH=0 423CONFIG_MTD_PHYSMAP_BANKWIDTH=0
424# CONFIG_MTD_INTEL_VR_NOR is not set
387# CONFIG_MTD_PLATRAM is not set 425# CONFIG_MTD_PLATRAM is not set
388 426
389# 427#
@@ -423,7 +461,9 @@ CONFIG_BLK_DEV_LOOP=y
423# CONFIG_BLK_DEV_RAM is not set 461# CONFIG_BLK_DEV_RAM is not set
424# CONFIG_CDROM_PKTCDVD is not set 462# CONFIG_CDROM_PKTCDVD is not set
425# CONFIG_ATA_OVER_ETH is not set 463# CONFIG_ATA_OVER_ETH is not set
464# CONFIG_BLK_DEV_HD is not set
426# CONFIG_MISC_DEVICES is not set 465# CONFIG_MISC_DEVICES is not set
466CONFIG_HAVE_IDE=y
427# CONFIG_IDE is not set 467# CONFIG_IDE is not set
428 468
429# 469#
@@ -462,10 +502,15 @@ CONFIG_SCSI_WAIT_SCAN=m
462# CONFIG_SCSI_FC_ATTRS is not set 502# CONFIG_SCSI_FC_ATTRS is not set
463# CONFIG_SCSI_ISCSI_ATTRS is not set 503# CONFIG_SCSI_ISCSI_ATTRS is not set
464# CONFIG_SCSI_SAS_LIBSAS is not set 504# CONFIG_SCSI_SAS_LIBSAS is not set
505# CONFIG_SCSI_SRP_ATTRS is not set
465# CONFIG_SCSI_LOWLEVEL is not set 506# CONFIG_SCSI_LOWLEVEL is not set
507# CONFIG_SCSI_DH is not set
466CONFIG_ATA=y 508CONFIG_ATA=y
467# CONFIG_ATA_NONSTANDARD is not set 509# CONFIG_ATA_NONSTANDARD is not set
510CONFIG_SATA_PMP=y
468# CONFIG_SATA_AHCI is not set 511# CONFIG_SATA_AHCI is not set
512# CONFIG_SATA_SIL24 is not set
513CONFIG_ATA_SFF=y
469# CONFIG_SATA_SVW is not set 514# CONFIG_SATA_SVW is not set
470# CONFIG_ATA_PIIX is not set 515# CONFIG_ATA_PIIX is not set
471# CONFIG_SATA_MV is not set 516# CONFIG_SATA_MV is not set
@@ -475,7 +520,6 @@ CONFIG_ATA=y
475# CONFIG_SATA_PROMISE is not set 520# CONFIG_SATA_PROMISE is not set
476# CONFIG_SATA_SX4 is not set 521# CONFIG_SATA_SX4 is not set
477# CONFIG_SATA_SIL is not set 522# CONFIG_SATA_SIL is not set
478# CONFIG_SATA_SIL24 is not set
479# CONFIG_SATA_SIS is not set 523# CONFIG_SATA_SIS is not set
480# CONFIG_SATA_ULI is not set 524# CONFIG_SATA_ULI is not set
481# CONFIG_SATA_VIA is not set 525# CONFIG_SATA_VIA is not set
@@ -504,7 +548,9 @@ CONFIG_ATA=y
504# CONFIG_PATA_MPIIX is not set 548# CONFIG_PATA_MPIIX is not set
505# CONFIG_PATA_OLDPIIX is not set 549# CONFIG_PATA_OLDPIIX is not set
506# CONFIG_PATA_NETCELL is not set 550# CONFIG_PATA_NETCELL is not set
551# CONFIG_PATA_NINJA32 is not set
507# CONFIG_PATA_NS87410 is not set 552# CONFIG_PATA_NS87410 is not set
553# CONFIG_PATA_NS87415 is not set
508# CONFIG_PATA_OPTI is not set 554# CONFIG_PATA_OPTI is not set
509# CONFIG_PATA_OPTIDMA is not set 555# CONFIG_PATA_OPTIDMA is not set
510# CONFIG_PATA_PDC_OLD is not set 556# CONFIG_PATA_PDC_OLD is not set
@@ -518,29 +564,27 @@ CONFIG_ATA=y
518CONFIG_PATA_VIA=y 564CONFIG_PATA_VIA=y
519# CONFIG_PATA_WINBOND is not set 565# CONFIG_PATA_WINBOND is not set
520# CONFIG_PATA_PLATFORM is not set 566# CONFIG_PATA_PLATFORM is not set
567# CONFIG_PATA_SCH is not set
521# CONFIG_MD is not set 568# CONFIG_MD is not set
569# CONFIG_FUSION is not set
522 570
523# 571#
524# Fusion MPT device support 572# IEEE 1394 (FireWire) support
525# 573#
526# CONFIG_FUSION is not set
527# CONFIG_FUSION_SPI is not set
528# CONFIG_FUSION_FC is not set
529# CONFIG_FUSION_SAS is not set
530 574
531# 575#
532# IEEE 1394 (FireWire) support 576# Enable only one of the two stacks, unless you know what you are doing
533# 577#
534# CONFIG_FIREWIRE is not set 578# CONFIG_FIREWIRE is not set
535# CONFIG_IEEE1394 is not set 579# CONFIG_IEEE1394 is not set
536# CONFIG_I2O is not set 580# CONFIG_I2O is not set
537CONFIG_NETDEVICES=y 581CONFIG_NETDEVICES=y
538# CONFIG_NETDEVICES_MULTIQUEUE is not set
539# CONFIG_DUMMY is not set 582# CONFIG_DUMMY is not set
540# CONFIG_BONDING is not set 583# CONFIG_BONDING is not set
541# CONFIG_MACVLAN is not set 584# CONFIG_MACVLAN is not set
542# CONFIG_EQUALIZER is not set 585# CONFIG_EQUALIZER is not set
543# CONFIG_TUN is not set 586# CONFIG_TUN is not set
587# CONFIG_VETH is not set
544# CONFIG_ARCNET is not set 588# CONFIG_ARCNET is not set
545# CONFIG_PHYLIB is not set 589# CONFIG_PHYLIB is not set
546CONFIG_NET_ETHERNET=y 590CONFIG_NET_ETHERNET=y
@@ -562,7 +606,12 @@ CONFIG_TULIP=y
562# CONFIG_DM9102 is not set 606# CONFIG_DM9102 is not set
563# CONFIG_ULI526X is not set 607# CONFIG_ULI526X is not set
564# CONFIG_HP100 is not set 608# CONFIG_HP100 is not set
609# CONFIG_IBM_NEW_EMAC_ZMII is not set
610# CONFIG_IBM_NEW_EMAC_RGMII is not set
611# CONFIG_IBM_NEW_EMAC_TAH is not set
612# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
565# CONFIG_NET_PCI is not set 613# CONFIG_NET_PCI is not set
614# CONFIG_B44 is not set
566# CONFIG_NETDEV_1000 is not set 615# CONFIG_NETDEV_1000 is not set
567# CONFIG_NETDEV_10000 is not set 616# CONFIG_NETDEV_10000 is not set
568# CONFIG_TR is not set 617# CONFIG_TR is not set
@@ -572,6 +621,7 @@ CONFIG_TULIP=y
572# 621#
573# CONFIG_WLAN_PRE80211 is not set 622# CONFIG_WLAN_PRE80211 is not set
574# CONFIG_WLAN_80211 is not set 623# CONFIG_WLAN_80211 is not set
624# CONFIG_IWLWIFI_LEDS is not set
575 625
576# 626#
577# USB Network Adapters 627# USB Network Adapters
@@ -580,7 +630,6 @@ CONFIG_TULIP=y
580# CONFIG_USB_KAWETH is not set 630# CONFIG_USB_KAWETH is not set
581# CONFIG_USB_PEGASUS is not set 631# CONFIG_USB_PEGASUS is not set
582# CONFIG_USB_RTL8150 is not set 632# CONFIG_USB_RTL8150 is not set
583# CONFIG_USB_USBNET_MII is not set
584# CONFIG_USB_USBNET is not set 633# CONFIG_USB_USBNET is not set
585# CONFIG_WAN is not set 634# CONFIG_WAN is not set
586# CONFIG_FDDI is not set 635# CONFIG_FDDI is not set
@@ -588,7 +637,6 @@ CONFIG_TULIP=y
588# CONFIG_PPP is not set 637# CONFIG_PPP is not set
589# CONFIG_SLIP is not set 638# CONFIG_SLIP is not set
590# CONFIG_NET_FC is not set 639# CONFIG_NET_FC is not set
591# CONFIG_SHAPER is not set
592# CONFIG_NETCONSOLE is not set 640# CONFIG_NETCONSOLE is not set
593# CONFIG_NETPOLL is not set 641# CONFIG_NETPOLL is not set
594# CONFIG_NET_POLL_CONTROLLER is not set 642# CONFIG_NET_POLL_CONTROLLER is not set
@@ -607,7 +655,6 @@ CONFIG_INPUT_POLLDEV=y
607# 655#
608# CONFIG_INPUT_MOUSEDEV is not set 656# CONFIG_INPUT_MOUSEDEV is not set
609# CONFIG_INPUT_JOYDEV is not set 657# CONFIG_INPUT_JOYDEV is not set
610# CONFIG_INPUT_TSDEV is not set
611CONFIG_INPUT_EVDEV=y 658CONFIG_INPUT_EVDEV=y
612# CONFIG_INPUT_EVBUG is not set 659# CONFIG_INPUT_EVBUG is not set
613 660
@@ -642,7 +689,9 @@ CONFIG_VT=y
642CONFIG_VT_CONSOLE=y 689CONFIG_VT_CONSOLE=y
643CONFIG_HW_CONSOLE=y 690CONFIG_HW_CONSOLE=y
644CONFIG_VT_HW_CONSOLE_BINDING=y 691CONFIG_VT_HW_CONSOLE_BINDING=y
692CONFIG_DEVKMEM=y
645# CONFIG_SERIAL_NONSTANDARD is not set 693# CONFIG_SERIAL_NONSTANDARD is not set
694# CONFIG_NOZOMI is not set
646 695
647# 696#
648# Serial drivers 697# Serial drivers
@@ -664,65 +713,122 @@ CONFIG_UNIX98_PTYS=y
664CONFIG_LEGACY_PTYS=y 713CONFIG_LEGACY_PTYS=y
665CONFIG_LEGACY_PTY_COUNT=256 714CONFIG_LEGACY_PTY_COUNT=256
666# CONFIG_IPMI_HANDLER is not set 715# CONFIG_IPMI_HANDLER is not set
667# CONFIG_WATCHDOG is not set
668# CONFIG_HW_RANDOM is not set 716# CONFIG_HW_RANDOM is not set
669# CONFIG_RTC is not set
670CONFIG_COBALT_LCD=y
671# CONFIG_R3964 is not set 717# CONFIG_R3964 is not set
672# CONFIG_APPLICOM is not set 718# CONFIG_APPLICOM is not set
673# CONFIG_DRM is not set
674# CONFIG_RAW_DRIVER is not set 719# CONFIG_RAW_DRIVER is not set
675# CONFIG_TCG_TPM is not set 720# CONFIG_TCG_TPM is not set
676CONFIG_DEVPORT=y 721CONFIG_DEVPORT=y
677# CONFIG_I2C is not set 722# CONFIG_I2C is not set
678
679#
680# SPI support
681#
682# CONFIG_SPI is not set 723# CONFIG_SPI is not set
683# CONFIG_SPI_MASTER is not set
684# CONFIG_W1 is not set 724# CONFIG_W1 is not set
685# CONFIG_POWER_SUPPLY is not set 725# CONFIG_POWER_SUPPLY is not set
686# CONFIG_HWMON is not set 726# CONFIG_HWMON is not set
727# CONFIG_THERMAL is not set
728# CONFIG_THERMAL_HWMON is not set
729# CONFIG_WATCHDOG is not set
730
731#
732# Sonics Silicon Backplane
733#
734CONFIG_SSB_POSSIBLE=y
735# CONFIG_SSB is not set
687 736
688# 737#
689# Multifunction device drivers 738# Multifunction device drivers
690# 739#
740# CONFIG_MFD_CORE is not set
691# CONFIG_MFD_SM501 is not set 741# CONFIG_MFD_SM501 is not set
742# CONFIG_HTC_PASIC3 is not set
692 743
693# 744#
694# Multimedia devices 745# Multimedia devices
695# 746#
747
748#
749# Multimedia core support
750#
696# CONFIG_VIDEO_DEV is not set 751# CONFIG_VIDEO_DEV is not set
697# CONFIG_DVB_CORE is not set 752# CONFIG_DVB_CORE is not set
753# CONFIG_VIDEO_MEDIA is not set
754
755#
756# Multimedia drivers
757#
698# CONFIG_DAB is not set 758# CONFIG_DAB is not set
699 759
700# 760#
701# Graphics support 761# Graphics support
702# 762#
763# CONFIG_DRM is not set
764# CONFIG_VGASTATE is not set
765# CONFIG_VIDEO_OUTPUT_CONTROL is not set
766CONFIG_FB=y
767# CONFIG_FIRMWARE_EDID is not set
768# CONFIG_FB_DDC is not set
769# CONFIG_FB_CFB_FILLRECT is not set
770# CONFIG_FB_CFB_COPYAREA is not set
771# CONFIG_FB_CFB_IMAGEBLIT is not set
772# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
773# CONFIG_FB_SYS_FILLRECT is not set
774# CONFIG_FB_SYS_COPYAREA is not set
775# CONFIG_FB_SYS_IMAGEBLIT is not set
776# CONFIG_FB_FOREIGN_ENDIAN is not set
777# CONFIG_FB_SYS_FOPS is not set
778# CONFIG_FB_SVGALIB is not set
779# CONFIG_FB_MACMODES is not set
780# CONFIG_FB_BACKLIGHT is not set
781# CONFIG_FB_MODE_HELPERS is not set
782# CONFIG_FB_TILEBLITTING is not set
783
784#
785# Frame buffer hardware drivers
786#
787# CONFIG_FB_CIRRUS is not set
788# CONFIG_FB_PM2 is not set
789# CONFIG_FB_CYBER2000 is not set
790# CONFIG_FB_ASILIANT is not set
791# CONFIG_FB_IMSTT is not set
792# CONFIG_FB_S1D13XXX is not set
793# CONFIG_FB_NVIDIA is not set
794# CONFIG_FB_RIVA is not set
795# CONFIG_FB_MATROX is not set
796# CONFIG_FB_RADEON is not set
797# CONFIG_FB_ATY128 is not set
798# CONFIG_FB_ATY is not set
799# CONFIG_FB_S3 is not set
800# CONFIG_FB_SAVAGE is not set
801# CONFIG_FB_SIS is not set
802# CONFIG_FB_NEOMAGIC is not set
803# CONFIG_FB_KYRO is not set
804# CONFIG_FB_3DFX is not set
805# CONFIG_FB_VOODOO1 is not set
806# CONFIG_FB_VT8623 is not set
807# CONFIG_FB_TRIDENT is not set
808# CONFIG_FB_ARK is not set
809# CONFIG_FB_PM3 is not set
810# CONFIG_FB_CARMINE is not set
811CONFIG_FB_COBALT=y
812# CONFIG_FB_VIRTUAL is not set
703# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 813# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
704 814
705# 815#
706# Display device support 816# Display device support
707# 817#
708# CONFIG_DISPLAY_SUPPORT is not set 818# CONFIG_DISPLAY_SUPPORT is not set
709# CONFIG_VGASTATE is not set
710# CONFIG_VIDEO_OUTPUT_CONTROL is not set
711# CONFIG_FB is not set
712 819
713# 820#
714# Console display driver support 821# Console display driver support
715# 822#
716# CONFIG_VGA_CONSOLE is not set 823# CONFIG_VGA_CONSOLE is not set
717CONFIG_DUMMY_CONSOLE=y 824CONFIG_DUMMY_CONSOLE=y
718 825# CONFIG_FRAMEBUFFER_CONSOLE is not set
719# 826# CONFIG_LOGO is not set
720# Sound
721#
722# CONFIG_SOUND is not set 827# CONFIG_SOUND is not set
723CONFIG_HID_SUPPORT=y 828CONFIG_HID_SUPPORT=y
724CONFIG_HID=m 829CONFIG_HID=m
725# CONFIG_HID_DEBUG is not set 830# CONFIG_HID_DEBUG is not set
831# CONFIG_HIDRAW is not set
726 832
727# 833#
728# USB Input Devices 834# USB Input Devices
@@ -743,6 +849,7 @@ CONFIG_USB_ARCH_HAS_OHCI=y
743CONFIG_USB_ARCH_HAS_EHCI=y 849CONFIG_USB_ARCH_HAS_EHCI=y
744CONFIG_USB=m 850CONFIG_USB=m
745# CONFIG_USB_DEBUG is not set 851# CONFIG_USB_DEBUG is not set
852# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
746 853
747# 854#
748# Miscellaneous USB options 855# Miscellaneous USB options
@@ -751,15 +858,18 @@ CONFIG_USB=m
751# CONFIG_USB_DEVICE_CLASS is not set 858# CONFIG_USB_DEVICE_CLASS is not set
752# CONFIG_USB_DYNAMIC_MINORS is not set 859# CONFIG_USB_DYNAMIC_MINORS is not set
753# CONFIG_USB_OTG is not set 860# CONFIG_USB_OTG is not set
861# CONFIG_USB_OTG_WHITELIST is not set
862# CONFIG_USB_OTG_BLACKLIST_HUB is not set
754 863
755# 864#
756# USB Host Controller Drivers 865# USB Host Controller Drivers
757# 866#
867# CONFIG_USB_C67X00_HCD is not set
758CONFIG_USB_EHCI_HCD=m 868CONFIG_USB_EHCI_HCD=m
759# CONFIG_USB_EHCI_SPLIT_ISO is not set
760# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 869# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
761# CONFIG_USB_EHCI_TT_NEWSCHED is not set 870# CONFIG_USB_EHCI_TT_NEWSCHED is not set
762# CONFIG_USB_ISP116X_HCD is not set 871# CONFIG_USB_ISP116X_HCD is not set
872# CONFIG_USB_ISP1760_HCD is not set
763CONFIG_USB_OHCI_HCD=m 873CONFIG_USB_OHCI_HCD=m
764# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 874# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
765# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 875# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -773,6 +883,7 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
773# 883#
774# CONFIG_USB_ACM is not set 884# CONFIG_USB_ACM is not set
775# CONFIG_USB_PRINTER is not set 885# CONFIG_USB_PRINTER is not set
886# CONFIG_USB_WDM is not set
776 887
777# 888#
778# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 889# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -785,6 +896,7 @@ CONFIG_USB_STORAGE=m
785# CONFIG_USB_STORAGE_DEBUG is not set 896# CONFIG_USB_STORAGE_DEBUG is not set
786# CONFIG_USB_STORAGE_DATAFAB is not set 897# CONFIG_USB_STORAGE_DATAFAB is not set
787# CONFIG_USB_STORAGE_FREECOM is not set 898# CONFIG_USB_STORAGE_FREECOM is not set
899# CONFIG_USB_STORAGE_ISD200 is not set
788# CONFIG_USB_STORAGE_DPCM is not set 900# CONFIG_USB_STORAGE_DPCM is not set
789# CONFIG_USB_STORAGE_USBAT is not set 901# CONFIG_USB_STORAGE_USBAT is not set
790# CONFIG_USB_STORAGE_SDDR09 is not set 902# CONFIG_USB_STORAGE_SDDR09 is not set
@@ -793,6 +905,7 @@ CONFIG_USB_STORAGE=m
793# CONFIG_USB_STORAGE_ALAUDA is not set 905# CONFIG_USB_STORAGE_ALAUDA is not set
794# CONFIG_USB_STORAGE_ONETOUCH is not set 906# CONFIG_USB_STORAGE_ONETOUCH is not set
795# CONFIG_USB_STORAGE_KARMA is not set 907# CONFIG_USB_STORAGE_KARMA is not set
908# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
796# CONFIG_USB_LIBUSUAL is not set 909# CONFIG_USB_LIBUSUAL is not set
797 910
798# 911#
@@ -800,15 +913,11 @@ CONFIG_USB_STORAGE=m
800# 913#
801# CONFIG_USB_MDC800 is not set 914# CONFIG_USB_MDC800 is not set
802# CONFIG_USB_MICROTEK is not set 915# CONFIG_USB_MICROTEK is not set
803CONFIG_USB_MON=y 916# CONFIG_USB_MON is not set
804 917
805# 918#
806# USB port drivers 919# USB port drivers
807# 920#
808
809#
810# USB Serial Converter support
811#
812# CONFIG_USB_SERIAL is not set 921# CONFIG_USB_SERIAL is not set
813 922
814# 923#
@@ -833,16 +942,10 @@ CONFIG_USB_MON=y
833# CONFIG_USB_LD is not set 942# CONFIG_USB_LD is not set
834# CONFIG_USB_TRANCEVIBRATOR is not set 943# CONFIG_USB_TRANCEVIBRATOR is not set
835# CONFIG_USB_IOWARRIOR is not set 944# CONFIG_USB_IOWARRIOR is not set
836 945# CONFIG_USB_ISIGHTFW is not set
837#
838# USB DSL modem support
839#
840
841#
842# USB Gadget Support
843#
844# CONFIG_USB_GADGET is not set 946# CONFIG_USB_GADGET is not set
845# CONFIG_MMC is not set 947# CONFIG_MMC is not set
948# CONFIG_MEMSTICK is not set
846CONFIG_NEW_LEDS=y 949CONFIG_NEW_LEDS=y
847CONFIG_LEDS_CLASS=y 950CONFIG_LEDS_CLASS=y
848 951
@@ -858,6 +961,8 @@ CONFIG_LEDS_COBALT_RAQ=y
858CONFIG_LEDS_TRIGGERS=y 961CONFIG_LEDS_TRIGGERS=y
859# CONFIG_LEDS_TRIGGER_TIMER is not set 962# CONFIG_LEDS_TRIGGER_TIMER is not set
860# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set 963# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
964# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
965# CONFIG_ACCESSIBILITY is not set
861# CONFIG_INFINIBAND is not set 966# CONFIG_INFINIBAND is not set
862CONFIG_RTC_LIB=y 967CONFIG_RTC_LIB=y
863CONFIG_RTC_CLASS=y 968CONFIG_RTC_CLASS=y
@@ -882,9 +987,10 @@ CONFIG_RTC_INTF_DEV=y
882# Platform RTC drivers 987# Platform RTC drivers
883# 988#
884CONFIG_RTC_DRV_CMOS=y 989CONFIG_RTC_DRV_CMOS=y
990# CONFIG_RTC_DRV_DS1511 is not set
885# CONFIG_RTC_DRV_DS1553 is not set 991# CONFIG_RTC_DRV_DS1553 is not set
886# CONFIG_RTC_DRV_STK17TA8 is not set
887# CONFIG_RTC_DRV_DS1742 is not set 992# CONFIG_RTC_DRV_DS1742 is not set
993# CONFIG_RTC_DRV_STK17TA8 is not set
888# CONFIG_RTC_DRV_M48T86 is not set 994# CONFIG_RTC_DRV_M48T86 is not set
889# CONFIG_RTC_DRV_M48T59 is not set 995# CONFIG_RTC_DRV_M48T59 is not set
890# CONFIG_RTC_DRV_V3020 is not set 996# CONFIG_RTC_DRV_V3020 is not set
@@ -892,23 +998,7 @@ CONFIG_RTC_DRV_CMOS=y
892# 998#
893# on-CPU RTC drivers 999# on-CPU RTC drivers
894# 1000#
895 1001# CONFIG_DMADEVICES is not set
896#
897# DMA Engine support
898#
899# CONFIG_DMA_ENGINE is not set
900
901#
902# DMA Clients
903#
904
905#
906# DMA Devices
907#
908
909#
910# Userspace I/O
911#
912# CONFIG_UIO is not set 1002# CONFIG_UIO is not set
913 1003
914# 1004#
@@ -923,22 +1013,22 @@ CONFIG_EXT3_FS=y
923CONFIG_EXT3_FS_XATTR=y 1013CONFIG_EXT3_FS_XATTR=y
924CONFIG_EXT3_FS_POSIX_ACL=y 1014CONFIG_EXT3_FS_POSIX_ACL=y
925CONFIG_EXT3_FS_SECURITY=y 1015CONFIG_EXT3_FS_SECURITY=y
926# CONFIG_EXT4DEV_FS is not set 1016CONFIG_EXT4DEV_FS=y
1017CONFIG_EXT4DEV_FS_XATTR=y
1018CONFIG_EXT4DEV_FS_POSIX_ACL=y
1019CONFIG_EXT4DEV_FS_SECURITY=y
927CONFIG_JBD=y 1020CONFIG_JBD=y
928# CONFIG_JBD_DEBUG is not set 1021CONFIG_JBD2=y
929CONFIG_FS_MBCACHE=y 1022CONFIG_FS_MBCACHE=y
930# CONFIG_REISERFS_FS is not set 1023# CONFIG_REISERFS_FS is not set
931# CONFIG_JFS_FS is not set 1024# CONFIG_JFS_FS is not set
932CONFIG_FS_POSIX_ACL=y 1025CONFIG_FS_POSIX_ACL=y
933# CONFIG_XFS_FS is not set 1026# CONFIG_XFS_FS is not set
934# CONFIG_GFS2_FS is not set
935# CONFIG_OCFS2_FS is not set 1027# CONFIG_OCFS2_FS is not set
936# CONFIG_MINIX_FS is not set 1028CONFIG_DNOTIFY=y
937# CONFIG_ROMFS_FS is not set
938CONFIG_INOTIFY=y 1029CONFIG_INOTIFY=y
939CONFIG_INOTIFY_USER=y 1030CONFIG_INOTIFY_USER=y
940# CONFIG_QUOTA is not set 1031# CONFIG_QUOTA is not set
941CONFIG_DNOTIFY=y
942# CONFIG_AUTOFS_FS is not set 1032# CONFIG_AUTOFS_FS is not set
943# CONFIG_AUTOFS4_FS is not set 1033# CONFIG_AUTOFS4_FS is not set
944# CONFIG_FUSE_FS is not set 1034# CONFIG_FUSE_FS is not set
@@ -967,7 +1057,6 @@ CONFIG_SYSFS=y
967CONFIG_TMPFS=y 1057CONFIG_TMPFS=y
968CONFIG_TMPFS_POSIX_ACL=y 1058CONFIG_TMPFS_POSIX_ACL=y
969# CONFIG_HUGETLB_PAGE is not set 1059# CONFIG_HUGETLB_PAGE is not set
970CONFIG_RAMFS=y
971CONFIG_CONFIGFS_FS=y 1060CONFIG_CONFIGFS_FS=y
972 1061
973# 1062#
@@ -983,32 +1072,28 @@ CONFIG_CONFIGFS_FS=y
983# CONFIG_JFFS2_FS is not set 1072# CONFIG_JFFS2_FS is not set
984# CONFIG_CRAMFS is not set 1073# CONFIG_CRAMFS is not set
985# CONFIG_VXFS_FS is not set 1074# CONFIG_VXFS_FS is not set
1075# CONFIG_MINIX_FS is not set
986# CONFIG_HPFS_FS is not set 1076# CONFIG_HPFS_FS is not set
987# CONFIG_QNX4FS_FS is not set 1077# CONFIG_QNX4FS_FS is not set
1078# CONFIG_ROMFS_FS is not set
988# CONFIG_SYSV_FS is not set 1079# CONFIG_SYSV_FS is not set
989# CONFIG_UFS_FS is not set 1080# CONFIG_UFS_FS is not set
990 1081CONFIG_NETWORK_FILESYSTEMS=y
991#
992# Network File Systems
993#
994CONFIG_NFS_FS=y 1082CONFIG_NFS_FS=y
995CONFIG_NFS_V3=y 1083CONFIG_NFS_V3=y
996CONFIG_NFS_V3_ACL=y 1084CONFIG_NFS_V3_ACL=y
997# CONFIG_NFS_V4 is not set 1085# CONFIG_NFS_V4 is not set
998# CONFIG_NFS_DIRECTIO is not set
999CONFIG_NFSD=y 1086CONFIG_NFSD=y
1000CONFIG_NFSD_V2_ACL=y 1087CONFIG_NFSD_V2_ACL=y
1001CONFIG_NFSD_V3=y 1088CONFIG_NFSD_V3=y
1002CONFIG_NFSD_V3_ACL=y 1089CONFIG_NFSD_V3_ACL=y
1003# CONFIG_NFSD_V4 is not set 1090# CONFIG_NFSD_V4 is not set
1004CONFIG_NFSD_TCP=y
1005CONFIG_LOCKD=y 1091CONFIG_LOCKD=y
1006CONFIG_LOCKD_V4=y 1092CONFIG_LOCKD_V4=y
1007CONFIG_EXPORTFS=y 1093CONFIG_EXPORTFS=y
1008CONFIG_NFS_ACL_SUPPORT=y 1094CONFIG_NFS_ACL_SUPPORT=y
1009CONFIG_NFS_COMMON=y 1095CONFIG_NFS_COMMON=y
1010CONFIG_SUNRPC=y 1096CONFIG_SUNRPC=y
1011# CONFIG_SUNRPC_BIND34 is not set
1012# CONFIG_RPCSEC_GSS_KRB5 is not set 1097# CONFIG_RPCSEC_GSS_KRB5 is not set
1013# CONFIG_RPCSEC_GSS_SPKM3 is not set 1098# CONFIG_RPCSEC_GSS_SPKM3 is not set
1014# CONFIG_SMB_FS is not set 1099# CONFIG_SMB_FS is not set
@@ -1022,34 +1107,26 @@ CONFIG_SUNRPC=y
1022# 1107#
1023# CONFIG_PARTITION_ADVANCED is not set 1108# CONFIG_PARTITION_ADVANCED is not set
1024CONFIG_MSDOS_PARTITION=y 1109CONFIG_MSDOS_PARTITION=y
1025
1026#
1027# Native Language Support
1028#
1029# CONFIG_NLS is not set 1110# CONFIG_NLS is not set
1030
1031#
1032# Distributed Lock Manager
1033#
1034# CONFIG_DLM is not set 1111# CONFIG_DLM is not set
1035 1112
1036# 1113#
1037# Profiling support
1038#
1039# CONFIG_PROFILING is not set
1040
1041#
1042# Kernel hacking 1114# Kernel hacking
1043# 1115#
1044CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1116CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1045# CONFIG_PRINTK_TIME is not set 1117# CONFIG_PRINTK_TIME is not set
1118CONFIG_ENABLE_WARN_DEPRECATED=y
1046CONFIG_ENABLE_MUST_CHECK=y 1119CONFIG_ENABLE_MUST_CHECK=y
1120CONFIG_FRAME_WARN=1024
1047# CONFIG_MAGIC_SYSRQ is not set 1121# CONFIG_MAGIC_SYSRQ is not set
1048# CONFIG_UNUSED_SYMBOLS is not set 1122# CONFIG_UNUSED_SYMBOLS is not set
1049# CONFIG_DEBUG_FS is not set 1123# CONFIG_DEBUG_FS is not set
1050# CONFIG_HEADERS_CHECK is not set 1124# CONFIG_HEADERS_CHECK is not set
1051# CONFIG_DEBUG_KERNEL is not set 1125# CONFIG_DEBUG_KERNEL is not set
1052CONFIG_CROSSCOMPILE=y 1126# CONFIG_SLUB_DEBUG_ON is not set
1127# CONFIG_SLUB_STATS is not set
1128# CONFIG_DEBUG_MEMORY_INIT is not set
1129# CONFIG_SAMPLES is not set
1053CONFIG_CMDLINE="" 1130CONFIG_CMDLINE=""
1054 1131
1055# 1132#
@@ -1057,14 +1134,95 @@ CONFIG_CMDLINE=""
1057# 1134#
1058# CONFIG_KEYS is not set 1135# CONFIG_KEYS is not set
1059# CONFIG_SECURITY is not set 1136# CONFIG_SECURITY is not set
1060# CONFIG_CRYPTO is not set 1137# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1138CONFIG_CRYPTO=y
1139
1140#
1141# Crypto core or helper
1142#
1143# CONFIG_CRYPTO_MANAGER is not set
1144# CONFIG_CRYPTO_GF128MUL is not set
1145# CONFIG_CRYPTO_NULL is not set
1146# CONFIG_CRYPTO_CRYPTD is not set
1147# CONFIG_CRYPTO_AUTHENC is not set
1148# CONFIG_CRYPTO_TEST is not set
1149
1150#
1151# Authenticated Encryption with Associated Data
1152#
1153# CONFIG_CRYPTO_CCM is not set
1154# CONFIG_CRYPTO_GCM is not set
1155# CONFIG_CRYPTO_SEQIV is not set
1156
1157#
1158# Block modes
1159#
1160# CONFIG_CRYPTO_CBC is not set
1161# CONFIG_CRYPTO_CTR is not set
1162# CONFIG_CRYPTO_CTS is not set
1163# CONFIG_CRYPTO_ECB is not set
1164# CONFIG_CRYPTO_LRW is not set
1165# CONFIG_CRYPTO_PCBC is not set
1166# CONFIG_CRYPTO_XTS is not set
1167
1168#
1169# Hash modes
1170#
1171# CONFIG_CRYPTO_HMAC is not set
1172# CONFIG_CRYPTO_XCBC is not set
1173
1174#
1175# Digest
1176#
1177# CONFIG_CRYPTO_CRC32C is not set
1178# CONFIG_CRYPTO_MD4 is not set
1179# CONFIG_CRYPTO_MD5 is not set
1180# CONFIG_CRYPTO_MICHAEL_MIC is not set
1181# CONFIG_CRYPTO_RMD128 is not set
1182# CONFIG_CRYPTO_RMD160 is not set
1183# CONFIG_CRYPTO_RMD256 is not set
1184# CONFIG_CRYPTO_RMD320 is not set
1185# CONFIG_CRYPTO_SHA1 is not set
1186# CONFIG_CRYPTO_SHA256 is not set
1187# CONFIG_CRYPTO_SHA512 is not set
1188# CONFIG_CRYPTO_TGR192 is not set
1189# CONFIG_CRYPTO_WP512 is not set
1190
1191#
1192# Ciphers
1193#
1194# CONFIG_CRYPTO_AES is not set
1195# CONFIG_CRYPTO_ANUBIS is not set
1196# CONFIG_CRYPTO_ARC4 is not set
1197# CONFIG_CRYPTO_BLOWFISH is not set
1198# CONFIG_CRYPTO_CAMELLIA is not set
1199# CONFIG_CRYPTO_CAST5 is not set
1200# CONFIG_CRYPTO_CAST6 is not set
1201# CONFIG_CRYPTO_DES is not set
1202# CONFIG_CRYPTO_FCRYPT is not set
1203# CONFIG_CRYPTO_KHAZAD is not set
1204# CONFIG_CRYPTO_SALSA20 is not set
1205# CONFIG_CRYPTO_SEED is not set
1206# CONFIG_CRYPTO_SERPENT is not set
1207# CONFIG_CRYPTO_TEA is not set
1208# CONFIG_CRYPTO_TWOFISH is not set
1209
1210#
1211# Compression
1212#
1213# CONFIG_CRYPTO_DEFLATE is not set
1214# CONFIG_CRYPTO_LZO is not set
1215CONFIG_CRYPTO_HW=y
1216# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1061 1217
1062# 1218#
1063# Library routines 1219# Library routines
1064# 1220#
1065CONFIG_BITREVERSE=y 1221CONFIG_BITREVERSE=y
1222# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1066# CONFIG_CRC_CCITT is not set 1223# CONFIG_CRC_CCITT is not set
1067# CONFIG_CRC16 is not set 1224CONFIG_CRC16=y
1225# CONFIG_CRC_T10DIF is not set
1068# CONFIG_CRC_ITU_T is not set 1226# CONFIG_CRC_ITU_T is not set
1069CONFIG_CRC32=y 1227CONFIG_CRC32=y
1070# CONFIG_CRC7 is not set 1228# CONFIG_CRC7 is not set
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index ebb8ad62b3a3..a279165e3a7d 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -1092,7 +1092,6 @@ CONFIG_ENABLE_MUST_CHECK=y
1092CONFIG_LOG_BUF_SHIFT=14 1092CONFIG_LOG_BUF_SHIFT=14
1093CONFIG_CROSSCOMPILE=y 1093CONFIG_CROSSCOMPILE=y
1094CONFIG_CMDLINE="" 1094CONFIG_CMDLINE=""
1095CONFIG_SYS_SUPPORTS_KGDB=y
1096 1095
1097# 1096#
1098# Security options 1097# Security options
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
index ad4e5ef65592..8944d15caf13 100644
--- a/arch/mips/configs/db1100_defconfig
+++ b/arch/mips/configs/db1100_defconfig
@@ -1092,7 +1092,6 @@ CONFIG_ENABLE_MUST_CHECK=y
1092CONFIG_LOG_BUF_SHIFT=14 1092CONFIG_LOG_BUF_SHIFT=14
1093CONFIG_CROSSCOMPILE=y 1093CONFIG_CROSSCOMPILE=y
1094CONFIG_CMDLINE="" 1094CONFIG_CMDLINE=""
1095CONFIG_SYS_SUPPORTS_KGDB=y
1096 1095
1097# 1096#
1098# Security options 1097# Security options
diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index d0dc2e83ad35..ab17973107fd 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -1174,7 +1174,6 @@ CONFIG_ENABLE_MUST_CHECK=y
1174CONFIG_LOG_BUF_SHIFT=14 1174CONFIG_LOG_BUF_SHIFT=14
1175CONFIG_CROSSCOMPILE=y 1175CONFIG_CROSSCOMPILE=y
1176CONFIG_CMDLINE="mem=48M" 1176CONFIG_CMDLINE="mem=48M"
1177CONFIG_SYS_SUPPORTS_KGDB=y
1178 1177
1179# 1178#
1180# Security options 1179# Security options
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
index 9155082313c8..b65803f19352 100644
--- a/arch/mips/configs/db1500_defconfig
+++ b/arch/mips/configs/db1500_defconfig
@@ -1392,7 +1392,6 @@ CONFIG_ENABLE_MUST_CHECK=y
1392CONFIG_LOG_BUF_SHIFT=14 1392CONFIG_LOG_BUF_SHIFT=14
1393CONFIG_CROSSCOMPILE=y 1393CONFIG_CROSSCOMPILE=y
1394CONFIG_CMDLINE="" 1394CONFIG_CMDLINE=""
1395CONFIG_SYS_SUPPORTS_KGDB=y
1396 1395
1397# 1396#
1398# Security options 1397# Security options
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
index e4e324422cd9..a190ac07740b 100644
--- a/arch/mips/configs/db1550_defconfig
+++ b/arch/mips/configs/db1550_defconfig
@@ -1209,7 +1209,6 @@ CONFIG_ENABLE_MUST_CHECK=y
1209CONFIG_LOG_BUF_SHIFT=14 1209CONFIG_LOG_BUF_SHIFT=14
1210CONFIG_CROSSCOMPILE=y 1210CONFIG_CROSSCOMPILE=y
1211CONFIG_CMDLINE="" 1211CONFIG_CMDLINE=""
1212CONFIG_SYS_SUPPORTS_KGDB=y
1213 1212
1214# 1213#
1215# Security options 1214# Security options
diff --git a/arch/mips/configs/excite_defconfig b/arch/mips/configs/excite_defconfig
index 3572e80356d2..4e465e945991 100644
--- a/arch/mips/configs/excite_defconfig
+++ b/arch/mips/configs/excite_defconfig
@@ -1269,7 +1269,6 @@ CONFIG_ENABLE_MUST_CHECK=y
1269CONFIG_LOG_BUF_SHIFT=14 1269CONFIG_LOG_BUF_SHIFT=14
1270CONFIG_CROSSCOMPILE=y 1270CONFIG_CROSSCOMPILE=y
1271CONFIG_CMDLINE="" 1271CONFIG_CMDLINE=""
1272CONFIG_SYS_SUPPORTS_KGDB=y
1273 1272
1274# 1273#
1275# Security options 1274# Security options
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 138c575a0151..831d3e5a1ea6 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -943,7 +943,6 @@ CONFIG_ENABLE_MUST_CHECK=y
943# CONFIG_DEBUG_KERNEL is not set 943# CONFIG_DEBUG_KERNEL is not set
944CONFIG_CROSSCOMPILE=y 944CONFIG_CROSSCOMPILE=y
945CONFIG_CMDLINE="" 945CONFIG_CMDLINE=""
946CONFIG_SYS_SUPPORTS_KGDB=y
947 946
948# 947#
949# Security options 948# Security options
diff --git a/arch/mips/configs/msp71xx_defconfig b/arch/mips/configs/msp71xx_defconfig
index 59d19472b161..dd13db4d0fb9 100644
--- a/arch/mips/configs/msp71xx_defconfig
+++ b/arch/mips/configs/msp71xx_defconfig
@@ -1415,8 +1415,6 @@ CONFIG_FORCED_INLINING=y
1415CONFIG_CROSSCOMPILE=y 1415CONFIG_CROSSCOMPILE=y
1416CONFIG_CMDLINE="" 1416CONFIG_CMDLINE=""
1417# CONFIG_DEBUG_STACK_USAGE is not set 1417# CONFIG_DEBUG_STACK_USAGE is not set
1418# CONFIG_KGDB is not set
1419CONFIG_SYS_SUPPORTS_KGDB=y
1420# CONFIG_RUNTIME_DEBUG is not set 1418# CONFIG_RUNTIME_DEBUG is not set
1421# CONFIG_MIPS_UNCACHED is not set 1419# CONFIG_MIPS_UNCACHED is not set
1422 1420
diff --git a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig
index bacf0dd0e345..db9272677aa2 100644
--- a/arch/mips/configs/mtx1_defconfig
+++ b/arch/mips/configs/mtx1_defconfig
@@ -3020,7 +3020,6 @@ CONFIG_MAGIC_SYSRQ=y
3020# CONFIG_DEBUG_KERNEL is not set 3020# CONFIG_DEBUG_KERNEL is not set
3021CONFIG_CROSSCOMPILE=y 3021CONFIG_CROSSCOMPILE=y
3022CONFIG_CMDLINE="" 3022CONFIG_CMDLINE=""
3023CONFIG_SYS_SUPPORTS_KGDB=y
3024 3023
3025# 3024#
3026# Security options 3025# Security options
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
index 6dfe6f793cef..9e21e333a2fc 100644
--- a/arch/mips/configs/pb1100_defconfig
+++ b/arch/mips/configs/pb1100_defconfig
@@ -1085,7 +1085,6 @@ CONFIG_ENABLE_MUST_CHECK=y
1085CONFIG_LOG_BUF_SHIFT=14 1085CONFIG_LOG_BUF_SHIFT=14
1086CONFIG_CROSSCOMPILE=y 1086CONFIG_CROSSCOMPILE=y
1087CONFIG_CMDLINE="" 1087CONFIG_CMDLINE=""
1088CONFIG_SYS_SUPPORTS_KGDB=y
1089 1088
1090# 1089#
1091# Security options 1090# Security options
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index c965a87e6a96..af67ed4f71ae 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -1202,7 +1202,6 @@ CONFIG_ENABLE_MUST_CHECK=y
1202CONFIG_LOG_BUF_SHIFT=14 1202CONFIG_LOG_BUF_SHIFT=14
1203CONFIG_CROSSCOMPILE=y 1203CONFIG_CROSSCOMPILE=y
1204CONFIG_CMDLINE="" 1204CONFIG_CMDLINE=""
1205CONFIG_SYS_SUPPORTS_KGDB=y
1206 1205
1207# 1206#
1208# Security options 1207# Security options
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
index 0778996c682f..7956f56cbf3e 100644
--- a/arch/mips/configs/pb1550_defconfig
+++ b/arch/mips/configs/pb1550_defconfig
@@ -1195,7 +1195,6 @@ CONFIG_ENABLE_MUST_CHECK=y
1195CONFIG_LOG_BUF_SHIFT=14 1195CONFIG_LOG_BUF_SHIFT=14
1196CONFIG_CROSSCOMPILE=y 1196CONFIG_CROSSCOMPILE=y
1197CONFIG_CMDLINE="" 1197CONFIG_CMDLINE=""
1198CONFIG_SYS_SUPPORTS_KGDB=y
1199 1198
1200# 1199#
1201# Security options 1200# Security options
diff --git a/arch/mips/configs/pnx8550-jbs_defconfig b/arch/mips/configs/pnx8550-jbs_defconfig
index 37c7b5ffd474..723bd5176a35 100644
--- a/arch/mips/configs/pnx8550-jbs_defconfig
+++ b/arch/mips/configs/pnx8550-jbs_defconfig
@@ -1216,10 +1216,8 @@ CONFIG_DEBUG_MUTEXES=y
1216CONFIG_FORCED_INLINING=y 1216CONFIG_FORCED_INLINING=y
1217# CONFIG_RCU_TORTURE_TEST is not set 1217# CONFIG_RCU_TORTURE_TEST is not set
1218CONFIG_CROSSCOMPILE=y 1218CONFIG_CROSSCOMPILE=y
1219CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp" 1219CONFIG_CMDLINE="console=ttyS1,38400n8 root=/dev/nfs ip=bootp"
1220# CONFIG_DEBUG_STACK_USAGE is not set 1220# CONFIG_DEBUG_STACK_USAGE is not set
1221# CONFIG_KGDB is not set
1222CONFIG_SYS_SUPPORTS_KGDB=y
1223# CONFIG_RUNTIME_DEBUG is not set 1221# CONFIG_RUNTIME_DEBUG is not set
1224 1222
1225# 1223#
diff --git a/arch/mips/configs/pnx8550-stb810_defconfig b/arch/mips/configs/pnx8550-stb810_defconfig
index 893e5c4ab66d..b5052fb42e9e 100644
--- a/arch/mips/configs/pnx8550-stb810_defconfig
+++ b/arch/mips/configs/pnx8550-stb810_defconfig
@@ -1206,10 +1206,8 @@ CONFIG_DEBUG_SLAB=y
1206CONFIG_FORCED_INLINING=y 1206CONFIG_FORCED_INLINING=y
1207# CONFIG_RCU_TORTURE_TEST is not set 1207# CONFIG_RCU_TORTURE_TEST is not set
1208CONFIG_CROSSCOMPILE=y 1208CONFIG_CROSSCOMPILE=y
1209CONFIG_CMDLINE="console=ttyS1,38400n8 kgdb=ttyS0 root=/dev/nfs ip=bootp" 1209CONFIG_CMDLINE="console=ttyS1,38400n8 root=/dev/nfs ip=bootp"
1210# CONFIG_DEBUG_STACK_USAGE is not set 1210# CONFIG_DEBUG_STACK_USAGE is not set
1211# CONFIG_KGDB is not set
1212CONFIG_SYS_SUPPORTS_KGDB=y
1213# CONFIG_RUNTIME_DEBUG is not set 1211# CONFIG_RUNTIME_DEBUG is not set
1214 1212
1215# 1213#
diff --git a/arch/mips/configs/rbtx49xx_defconfig b/arch/mips/configs/rbtx49xx_defconfig
index e42aed5a38bb..c7c0864b8ce9 100644
--- a/arch/mips/configs/rbtx49xx_defconfig
+++ b/arch/mips/configs/rbtx49xx_defconfig
@@ -742,7 +742,6 @@ CONFIG_DEBUG_FS=y
742# CONFIG_DEBUG_KERNEL is not set 742# CONFIG_DEBUG_KERNEL is not set
743# CONFIG_SAMPLES is not set 743# CONFIG_SAMPLES is not set
744CONFIG_CMDLINE="" 744CONFIG_CMDLINE=""
745CONFIG_SYS_SUPPORTS_KGDB=y
746 745
747# 746#
748# Security options 747# Security options
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
index 1ea97865f2ce..a9acaa2f9da3 100644
--- a/arch/mips/configs/sb1250-swarm_defconfig
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -963,7 +963,6 @@ CONFIG_ENABLE_MUST_CHECK=y
963# CONFIG_DEBUG_KERNEL is not set 963# CONFIG_DEBUG_KERNEL is not set
964# CONFIG_SAMPLES is not set 964# CONFIG_SAMPLES is not set
965CONFIG_CMDLINE="" 965CONFIG_CMDLINE=""
966CONFIG_SYS_SUPPORTS_KGDB=y
967# CONFIG_SB1XXX_CORELIS is not set 966# CONFIG_SB1XXX_CORELIS is not set
968 967
969# 968#
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
index 7f86c43d1bda..ea8249c75b3f 100644
--- a/arch/mips/configs/yosemite_defconfig
+++ b/arch/mips/configs/yosemite_defconfig
@@ -827,8 +827,6 @@ CONFIG_FORCED_INLINING=y
827CONFIG_CROSSCOMPILE=y 827CONFIG_CROSSCOMPILE=y
828CONFIG_CMDLINE="" 828CONFIG_CMDLINE=""
829# CONFIG_DEBUG_STACK_USAGE is not set 829# CONFIG_DEBUG_STACK_USAGE is not set
830# CONFIG_KGDB is not set
831CONFIG_SYS_SUPPORTS_KGDB=y
832# CONFIG_RUNTIME_DEBUG is not set 830# CONFIG_RUNTIME_DEBUG is not set
833 831
834# 832#
diff --git a/arch/mips/emma2rh/markeins/platform.c b/arch/mips/emma2rh/markeins/platform.c
index 11567702b155..d70627de7cfe 100644
--- a/arch/mips/emma2rh/markeins/platform.c
+++ b/arch/mips/emma2rh/markeins/platform.c
@@ -34,7 +34,6 @@
34#include <asm/bcache.h> 34#include <asm/bcache.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <asm/reboot.h> 36#include <asm/reboot.h>
37#include <asm/gdb-stub.h>
38#include <asm/traps.h> 37#include <asm/traps.h>
39#include <asm/debug.h> 38#include <asm/debug.h>
40 39
diff --git a/arch/mips/emma2rh/markeins/setup.c b/arch/mips/emma2rh/markeins/setup.c
index 62bfb455d1b1..a56c4b804b07 100644
--- a/arch/mips/emma2rh/markeins/setup.c
+++ b/arch/mips/emma2rh/markeins/setup.c
@@ -41,7 +41,6 @@
41#include <asm/bcache.h> 41#include <asm/bcache.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/reboot.h> 43#include <asm/reboot.h>
44#include <asm/gdb-stub.h>
45#include <asm/traps.h> 44#include <asm/traps.h>
46#include <asm/debug.h> 45#include <asm/debug.h>
47 46
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 0fd31974ba28..706f93974797 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -71,7 +71,7 @@ obj-$(CONFIG_MIPS32_COMPAT) += linux32.o ptrace32.o signal32.o
71obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o 71obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o
72obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o 72obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o
73 73
74obj-$(CONFIG_KGDB) += gdb-low.o gdb-stub.o 74obj-$(CONFIG_KGDB) += kgdb.o
75obj-$(CONFIG_PROC_FS) += proc.o 75obj-$(CONFIG_PROC_FS) += proc.o
76 76
77obj-$(CONFIG_64BIT) += cpu-bugs64.o 77obj-$(CONFIG_64BIT) += cpu-bugs64.o
diff --git a/arch/mips/kernel/gdb-low.S b/arch/mips/kernel/gdb-low.S
deleted file mode 100644
index 2c446063636a..000000000000
--- a/arch/mips/kernel/gdb-low.S
+++ /dev/null
@@ -1,394 +0,0 @@
1/*
2 * gdb-low.S contains the low-level trap handler for the GDB stub.
3 *
4 * Copyright (C) 1995 Andreas Busse
5 */
6#include <linux/sys.h>
7
8#include <asm/asm.h>
9#include <asm/errno.h>
10#include <asm/irqflags.h>
11#include <asm/mipsregs.h>
12#include <asm/regdef.h>
13#include <asm/stackframe.h>
14#include <asm/gdb-stub.h>
15
16#ifdef CONFIG_32BIT
17#define DMFC0 mfc0
18#define DMTC0 mtc0
19#define LDC1 lwc1
20#define SDC1 lwc1
21#endif
22#ifdef CONFIG_64BIT
23#define DMFC0 dmfc0
24#define DMTC0 dmtc0
25#define LDC1 ldc1
26#define SDC1 ldc1
27#endif
28
29/*
30 * [jsun] We reserves about 2x GDB_FR_SIZE in stack. The lower (addressed)
31 * part is used to store registers and passed to exception handler.
32 * The upper part is reserved for "call func" feature where gdb client
33 * saves some of the regs, setups call frame and passes args.
34 *
35 * A trace shows about 200 bytes are used to store about half of all regs.
36 * The rest should be big enough for frame setup and passing args.
37 */
38
39/*
40 * The low level trap handler
41 */
42 .align 5
43 NESTED(trap_low, GDB_FR_SIZE, sp)
44 .set noat
45 .set noreorder
46
47 mfc0 k0, CP0_STATUS
48 sll k0, 3 /* extract cu0 bit */
49 bltz k0, 1f
50 move k1, sp
51
52 /*
53 * Called from user mode, go somewhere else.
54 */
55 mfc0 k0, CP0_CAUSE
56 andi k0, k0, 0x7c
57#ifdef CONFIG_64BIT
58 dsll k0, k0, 1
59#endif
60 PTR_L k1, saved_vectors(k0)
61 jr k1
62 nop
631:
64 move k0, sp
65 PTR_SUBU sp, k1, GDB_FR_SIZE*2 # see comment above
66 LONG_S k0, GDB_FR_REG29(sp)
67 LONG_S $2, GDB_FR_REG2(sp)
68
69/*
70 * First save the CP0 and special registers
71 */
72
73 mfc0 v0, CP0_STATUS
74 LONG_S v0, GDB_FR_STATUS(sp)
75 mfc0 v0, CP0_CAUSE
76 LONG_S v0, GDB_FR_CAUSE(sp)
77 DMFC0 v0, CP0_EPC
78 LONG_S v0, GDB_FR_EPC(sp)
79 DMFC0 v0, CP0_BADVADDR
80 LONG_S v0, GDB_FR_BADVADDR(sp)
81 mfhi v0
82 LONG_S v0, GDB_FR_HI(sp)
83 mflo v0
84 LONG_S v0, GDB_FR_LO(sp)
85
86/*
87 * Now the integer registers
88 */
89
90 LONG_S zero, GDB_FR_REG0(sp) /* I know... */
91 LONG_S $1, GDB_FR_REG1(sp)
92 /* v0 already saved */
93 LONG_S $3, GDB_FR_REG3(sp)
94 LONG_S $4, GDB_FR_REG4(sp)
95 LONG_S $5, GDB_FR_REG5(sp)
96 LONG_S $6, GDB_FR_REG6(sp)
97 LONG_S $7, GDB_FR_REG7(sp)
98 LONG_S $8, GDB_FR_REG8(sp)
99 LONG_S $9, GDB_FR_REG9(sp)
100 LONG_S $10, GDB_FR_REG10(sp)
101 LONG_S $11, GDB_FR_REG11(sp)
102 LONG_S $12, GDB_FR_REG12(sp)
103 LONG_S $13, GDB_FR_REG13(sp)
104 LONG_S $14, GDB_FR_REG14(sp)
105 LONG_S $15, GDB_FR_REG15(sp)
106 LONG_S $16, GDB_FR_REG16(sp)
107 LONG_S $17, GDB_FR_REG17(sp)
108 LONG_S $18, GDB_FR_REG18(sp)
109 LONG_S $19, GDB_FR_REG19(sp)
110 LONG_S $20, GDB_FR_REG20(sp)
111 LONG_S $21, GDB_FR_REG21(sp)
112 LONG_S $22, GDB_FR_REG22(sp)
113 LONG_S $23, GDB_FR_REG23(sp)
114 LONG_S $24, GDB_FR_REG24(sp)
115 LONG_S $25, GDB_FR_REG25(sp)
116 LONG_S $26, GDB_FR_REG26(sp)
117 LONG_S $27, GDB_FR_REG27(sp)
118 LONG_S $28, GDB_FR_REG28(sp)
119 /* sp already saved */
120 LONG_S $30, GDB_FR_REG30(sp)
121 LONG_S $31, GDB_FR_REG31(sp)
122
123 CLI /* disable interrupts */
124 TRACE_IRQS_OFF
125
126/*
127 * Followed by the floating point registers
128 */
129 mfc0 v0, CP0_STATUS /* FPU enabled? */
130 srl v0, v0, 16
131 andi v0, v0, (ST0_CU1 >> 16)
132
133 beqz v0,2f /* disabled, skip */
134 nop
135
136 SDC1 $0, GDB_FR_FPR0(sp)
137 SDC1 $1, GDB_FR_FPR1(sp)
138 SDC1 $2, GDB_FR_FPR2(sp)
139 SDC1 $3, GDB_FR_FPR3(sp)
140 SDC1 $4, GDB_FR_FPR4(sp)
141 SDC1 $5, GDB_FR_FPR5(sp)
142 SDC1 $6, GDB_FR_FPR6(sp)
143 SDC1 $7, GDB_FR_FPR7(sp)
144 SDC1 $8, GDB_FR_FPR8(sp)
145 SDC1 $9, GDB_FR_FPR9(sp)
146 SDC1 $10, GDB_FR_FPR10(sp)
147 SDC1 $11, GDB_FR_FPR11(sp)
148 SDC1 $12, GDB_FR_FPR12(sp)
149 SDC1 $13, GDB_FR_FPR13(sp)
150 SDC1 $14, GDB_FR_FPR14(sp)
151 SDC1 $15, GDB_FR_FPR15(sp)
152 SDC1 $16, GDB_FR_FPR16(sp)
153 SDC1 $17, GDB_FR_FPR17(sp)
154 SDC1 $18, GDB_FR_FPR18(sp)
155 SDC1 $19, GDB_FR_FPR19(sp)
156 SDC1 $20, GDB_FR_FPR20(sp)
157 SDC1 $21, GDB_FR_FPR21(sp)
158 SDC1 $22, GDB_FR_FPR22(sp)
159 SDC1 $23, GDB_FR_FPR23(sp)
160 SDC1 $24, GDB_FR_FPR24(sp)
161 SDC1 $25, GDB_FR_FPR25(sp)
162 SDC1 $26, GDB_FR_FPR26(sp)
163 SDC1 $27, GDB_FR_FPR27(sp)
164 SDC1 $28, GDB_FR_FPR28(sp)
165 SDC1 $29, GDB_FR_FPR29(sp)
166 SDC1 $30, GDB_FR_FPR30(sp)
167 SDC1 $31, GDB_FR_FPR31(sp)
168
169/*
170 * FPU control registers
171 */
172
173 cfc1 v0, CP1_STATUS
174 LONG_S v0, GDB_FR_FSR(sp)
175 cfc1 v0, CP1_REVISION
176 LONG_S v0, GDB_FR_FIR(sp)
177
178/*
179 * Current stack frame ptr
180 */
181
1822:
183 LONG_S sp, GDB_FR_FRP(sp)
184
185/*
186 * CP0 registers (R4000/R4400 unused registers skipped)
187 */
188
189 mfc0 v0, CP0_INDEX
190 LONG_S v0, GDB_FR_CP0_INDEX(sp)
191 mfc0 v0, CP0_RANDOM
192 LONG_S v0, GDB_FR_CP0_RANDOM(sp)
193 DMFC0 v0, CP0_ENTRYLO0
194 LONG_S v0, GDB_FR_CP0_ENTRYLO0(sp)
195 DMFC0 v0, CP0_ENTRYLO1
196 LONG_S v0, GDB_FR_CP0_ENTRYLO1(sp)
197 DMFC0 v0, CP0_CONTEXT
198 LONG_S v0, GDB_FR_CP0_CONTEXT(sp)
199 mfc0 v0, CP0_PAGEMASK
200 LONG_S v0, GDB_FR_CP0_PAGEMASK(sp)
201 mfc0 v0, CP0_WIRED
202 LONG_S v0, GDB_FR_CP0_WIRED(sp)
203 DMFC0 v0, CP0_ENTRYHI
204 LONG_S v0, GDB_FR_CP0_ENTRYHI(sp)
205 mfc0 v0, CP0_PRID
206 LONG_S v0, GDB_FR_CP0_PRID(sp)
207
208 .set at
209
210/*
211 * Continue with the higher level handler
212 */
213
214 move a0,sp
215
216 jal handle_exception
217 nop
218
219/*
220 * Restore all writable registers, in reverse order
221 */
222
223 .set noat
224
225 LONG_L v0, GDB_FR_CP0_ENTRYHI(sp)
226 LONG_L v1, GDB_FR_CP0_WIRED(sp)
227 DMTC0 v0, CP0_ENTRYHI
228 mtc0 v1, CP0_WIRED
229 LONG_L v0, GDB_FR_CP0_PAGEMASK(sp)
230 LONG_L v1, GDB_FR_CP0_ENTRYLO1(sp)
231 mtc0 v0, CP0_PAGEMASK
232 DMTC0 v1, CP0_ENTRYLO1
233 LONG_L v0, GDB_FR_CP0_ENTRYLO0(sp)
234 LONG_L v1, GDB_FR_CP0_INDEX(sp)
235 DMTC0 v0, CP0_ENTRYLO0
236 LONG_L v0, GDB_FR_CP0_CONTEXT(sp)
237 mtc0 v1, CP0_INDEX
238 DMTC0 v0, CP0_CONTEXT
239
240
241/*
242 * Next, the floating point registers
243 */
244 mfc0 v0, CP0_STATUS /* check if the FPU is enabled */
245 srl v0, v0, 16
246 andi v0, v0, (ST0_CU1 >> 16)
247
248 beqz v0, 3f /* disabled, skip */
249 nop
250
251 LDC1 $31, GDB_FR_FPR31(sp)
252 LDC1 $30, GDB_FR_FPR30(sp)
253 LDC1 $29, GDB_FR_FPR29(sp)
254 LDC1 $28, GDB_FR_FPR28(sp)
255 LDC1 $27, GDB_FR_FPR27(sp)
256 LDC1 $26, GDB_FR_FPR26(sp)
257 LDC1 $25, GDB_FR_FPR25(sp)
258 LDC1 $24, GDB_FR_FPR24(sp)
259 LDC1 $23, GDB_FR_FPR23(sp)
260 LDC1 $22, GDB_FR_FPR22(sp)
261 LDC1 $21, GDB_FR_FPR21(sp)
262 LDC1 $20, GDB_FR_FPR20(sp)
263 LDC1 $19, GDB_FR_FPR19(sp)
264 LDC1 $18, GDB_FR_FPR18(sp)
265 LDC1 $17, GDB_FR_FPR17(sp)
266 LDC1 $16, GDB_FR_FPR16(sp)
267 LDC1 $15, GDB_FR_FPR15(sp)
268 LDC1 $14, GDB_FR_FPR14(sp)
269 LDC1 $13, GDB_FR_FPR13(sp)
270 LDC1 $12, GDB_FR_FPR12(sp)
271 LDC1 $11, GDB_FR_FPR11(sp)
272 LDC1 $10, GDB_FR_FPR10(sp)
273 LDC1 $9, GDB_FR_FPR9(sp)
274 LDC1 $8, GDB_FR_FPR8(sp)
275 LDC1 $7, GDB_FR_FPR7(sp)
276 LDC1 $6, GDB_FR_FPR6(sp)
277 LDC1 $5, GDB_FR_FPR5(sp)
278 LDC1 $4, GDB_FR_FPR4(sp)
279 LDC1 $3, GDB_FR_FPR3(sp)
280 LDC1 $2, GDB_FR_FPR2(sp)
281 LDC1 $1, GDB_FR_FPR1(sp)
282 LDC1 $0, GDB_FR_FPR0(sp)
283
284/*
285 * Now the CP0 and integer registers
286 */
287
2883:
289#ifdef CONFIG_MIPS_MT_SMTC
290 /* Read-modify write of Status must be atomic */
291 mfc0 t2, CP0_TCSTATUS
292 ori t1, t2, TCSTATUS_IXMT
293 mtc0 t1, CP0_TCSTATUS
294 andi t2, t2, TCSTATUS_IXMT
295 _ehb
296 DMT 9 # dmt t1
297 jal mips_ihb
298 nop
299#endif /* CONFIG_MIPS_MT_SMTC */
300 mfc0 t0, CP0_STATUS
301 ori t0, 0x1f
302 xori t0, 0x1f
303 mtc0 t0, CP0_STATUS
304#ifdef CONFIG_MIPS_MT_SMTC
305 andi t1, t1, VPECONTROL_TE
306 beqz t1, 9f
307 nop
308 EMT # emt
3099:
310 mfc0 t1, CP0_TCSTATUS
311 xori t1, t1, TCSTATUS_IXMT
312 or t1, t1, t2
313 mtc0 t1, CP0_TCSTATUS
314 _ehb
315#endif /* CONFIG_MIPS_MT_SMTC */
316 LONG_L v0, GDB_FR_STATUS(sp)
317 LONG_L v1, GDB_FR_EPC(sp)
318 mtc0 v0, CP0_STATUS
319 DMTC0 v1, CP0_EPC
320 LONG_L v0, GDB_FR_HI(sp)
321 LONG_L v1, GDB_FR_LO(sp)
322 mthi v0
323 mtlo v1
324 LONG_L $31, GDB_FR_REG31(sp)
325 LONG_L $30, GDB_FR_REG30(sp)
326 LONG_L $28, GDB_FR_REG28(sp)
327 LONG_L $27, GDB_FR_REG27(sp)
328 LONG_L $26, GDB_FR_REG26(sp)
329 LONG_L $25, GDB_FR_REG25(sp)
330 LONG_L $24, GDB_FR_REG24(sp)
331 LONG_L $23, GDB_FR_REG23(sp)
332 LONG_L $22, GDB_FR_REG22(sp)
333 LONG_L $21, GDB_FR_REG21(sp)
334 LONG_L $20, GDB_FR_REG20(sp)
335 LONG_L $19, GDB_FR_REG19(sp)
336 LONG_L $18, GDB_FR_REG18(sp)
337 LONG_L $17, GDB_FR_REG17(sp)
338 LONG_L $16, GDB_FR_REG16(sp)
339 LONG_L $15, GDB_FR_REG15(sp)
340 LONG_L $14, GDB_FR_REG14(sp)
341 LONG_L $13, GDB_FR_REG13(sp)
342 LONG_L $12, GDB_FR_REG12(sp)
343 LONG_L $11, GDB_FR_REG11(sp)
344 LONG_L $10, GDB_FR_REG10(sp)
345 LONG_L $9, GDB_FR_REG9(sp)
346 LONG_L $8, GDB_FR_REG8(sp)
347 LONG_L $7, GDB_FR_REG7(sp)
348 LONG_L $6, GDB_FR_REG6(sp)
349 LONG_L $5, GDB_FR_REG5(sp)
350 LONG_L $4, GDB_FR_REG4(sp)
351 LONG_L $3, GDB_FR_REG3(sp)
352 LONG_L $2, GDB_FR_REG2(sp)
353 LONG_L $1, GDB_FR_REG1(sp)
354#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
355 LONG_L k0, GDB_FR_EPC(sp)
356 LONG_L $29, GDB_FR_REG29(sp) /* Deallocate stack */
357 jr k0
358 rfe
359#else
360 LONG_L sp, GDB_FR_REG29(sp) /* Deallocate stack */
361
362 .set mips3
363 eret
364 .set mips0
365#endif
366 .set at
367 .set reorder
368 END(trap_low)
369
370LEAF(kgdb_read_byte)
3714: lb t0, (a0)
372 sb t0, (a1)
373 li v0, 0
374 jr ra
375 .section __ex_table,"a"
376 PTR 4b, kgdbfault
377 .previous
378 END(kgdb_read_byte)
379
380LEAF(kgdb_write_byte)
3815: sb a0, (a1)
382 li v0, 0
383 jr ra
384 .section __ex_table,"a"
385 PTR 5b, kgdbfault
386 .previous
387 END(kgdb_write_byte)
388
389 .type kgdbfault@function
390 .ent kgdbfault
391
392kgdbfault: li v0, -EFAULT
393 jr ra
394 .end kgdbfault
diff --git a/arch/mips/kernel/gdb-stub.c b/arch/mips/kernel/gdb-stub.c
deleted file mode 100644
index 25f4eab8ea9c..000000000000
--- a/arch/mips/kernel/gdb-stub.c
+++ /dev/null
@@ -1,1155 +0,0 @@
1/*
2 * arch/mips/kernel/gdb-stub.c
3 *
4 * Originally written by Glenn Engel, Lake Stevens Instrument Division
5 *
6 * Contributed by HP Systems
7 *
8 * Modified for SPARC by Stu Grossman, Cygnus Support.
9 *
10 * Modified for Linux/MIPS (and MIPS in general) by Andreas Busse
11 * Send complaints, suggestions etc. to <andy@waldorf-gmbh.de>
12 *
13 * Copyright (C) 1995 Andreas Busse
14 *
15 * Copyright (C) 2003 MontaVista Software Inc.
16 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
17 */
18
19/*
20 * To enable debugger support, two things need to happen. One, a
21 * call to set_debug_traps() is necessary in order to allow any breakpoints
22 * or error conditions to be properly intercepted and reported to gdb.
23 * Two, a breakpoint needs to be generated to begin communication. This
24 * is most easily accomplished by a call to breakpoint(). Breakpoint()
25 * simulates a breakpoint by executing a BREAK instruction.
26 *
27 *
28 * The following gdb commands are supported:
29 *
30 * command function Return value
31 *
32 * g return the value of the CPU registers hex data or ENN
33 * G set the value of the CPU registers OK or ENN
34 *
35 * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
36 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
37 *
38 * c Resume at current address SNN ( signal NN)
39 * cAA..AA Continue at address AA..AA SNN
40 *
41 * s Step one instruction SNN
42 * sAA..AA Step one instruction from AA..AA SNN
43 *
44 * k kill
45 *
46 * ? What was the last sigval ? SNN (signal NN)
47 *
48 * bBB..BB Set baud rate to BB..BB OK or BNN, then sets
49 * baud rate
50 *
51 * All commands and responses are sent with a packet which includes a
52 * checksum. A packet consists of
53 *
54 * $<packet info>#<checksum>.
55 *
56 * where
57 * <packet info> :: <characters representing the command or response>
58 * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>>
59 *
60 * When a packet is received, it is first acknowledged with either '+' or '-'.
61 * '+' indicates a successful transfer. '-' indicates a failed transfer.
62 *
63 * Example:
64 *
65 * Host: Reply:
66 * $m0,10#2a +$00010203040506070809101112131415#42
67 *
68 *
69 * ==============
70 * MORE EXAMPLES:
71 * ==============
72 *
73 * For reference -- the following are the steps that one
74 * company took (RidgeRun Inc) to get remote gdb debugging
75 * going. In this scenario the host machine was a PC and the
76 * target platform was a Galileo EVB64120A MIPS evaluation
77 * board.
78 *
79 * Step 1:
80 * First download gdb-5.0.tar.gz from the internet.
81 * and then build/install the package.
82 *
83 * Example:
84 * $ tar zxf gdb-5.0.tar.gz
85 * $ cd gdb-5.0
86 * $ ./configure --target=mips-linux-elf
87 * $ make
88 * $ install
89 * $ which mips-linux-elf-gdb
90 * /usr/local/bin/mips-linux-elf-gdb
91 *
92 * Step 2:
93 * Configure linux for remote debugging and build it.
94 *
95 * Example:
96 * $ cd ~/linux
97 * $ make menuconfig <go to "Kernel Hacking" and turn on remote debugging>
98 * $ make
99 *
100 * Step 3:
101 * Download the kernel to the remote target and start
102 * the kernel running. It will promptly halt and wait
103 * for the host gdb session to connect. It does this
104 * since the "Kernel Hacking" option has defined
105 * CONFIG_KGDB which in turn enables your calls
106 * to:
107 * set_debug_traps();
108 * breakpoint();
109 *
110 * Step 4:
111 * Start the gdb session on the host.
112 *
113 * Example:
114 * $ mips-linux-elf-gdb vmlinux
115 * (gdb) set remotebaud 115200
116 * (gdb) target remote /dev/ttyS1
117 * ...at this point you are connected to
118 * the remote target and can use gdb
119 * in the normal fasion. Setting
120 * breakpoints, single stepping,
121 * printing variables, etc.
122 */
123#include <linux/string.h>
124#include <linux/kernel.h>
125#include <linux/signal.h>
126#include <linux/sched.h>
127#include <linux/mm.h>
128#include <linux/console.h>
129#include <linux/init.h>
130#include <linux/smp.h>
131#include <linux/spinlock.h>
132#include <linux/slab.h>
133#include <linux/reboot.h>
134
135#include <asm/asm.h>
136#include <asm/cacheflush.h>
137#include <asm/mipsregs.h>
138#include <asm/pgtable.h>
139#include <asm/system.h>
140#include <asm/gdb-stub.h>
141#include <asm/inst.h>
142
143/*
144 * external low-level support routines
145 */
146
147extern int putDebugChar(char c); /* write a single character */
148extern char getDebugChar(void); /* read and return a single char */
149extern void trap_low(void);
150
151/*
152 * breakpoint and test functions
153 */
154extern void breakpoint(void);
155extern void breakinst(void);
156extern void async_breakpoint(void);
157extern void async_breakinst(void);
158extern void adel(void);
159
160/*
161 * local prototypes
162 */
163
164static void getpacket(char *buffer);
165static void putpacket(char *buffer);
166static int computeSignal(int tt);
167static int hex(unsigned char ch);
168static int hexToInt(char **ptr, int *intValue);
169static int hexToLong(char **ptr, long *longValue);
170static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault);
171void handle_exception(struct gdb_regs *regs);
172
173int kgdb_enabled;
174
175/*
176 * spin locks for smp case
177 */
178static DEFINE_SPINLOCK(kgdb_lock);
179static raw_spinlock_t kgdb_cpulock[NR_CPUS] = {
180 [0 ... NR_CPUS-1] = __RAW_SPIN_LOCK_UNLOCKED,
181};
182
183/*
184 * BUFMAX defines the maximum number of characters in inbound/outbound buffers
185 * at least NUMREGBYTES*2 are needed for register packets
186 */
187#define BUFMAX 2048
188
189static char input_buffer[BUFMAX];
190static char output_buffer[BUFMAX];
191static int initialized; /* !0 means we've been initialized */
192static int kgdb_started;
193static const char hexchars[]="0123456789abcdef";
194
195/* Used to prevent crashes in memory access. Note that they'll crash anyway if
196 we haven't set up fault handlers yet... */
197int kgdb_read_byte(unsigned char *address, unsigned char *dest);
198int kgdb_write_byte(unsigned char val, unsigned char *dest);
199
200/*
201 * Convert ch from a hex digit to an int
202 */
203static int hex(unsigned char ch)
204{
205 if (ch >= 'a' && ch <= 'f')
206 return ch-'a'+10;
207 if (ch >= '0' && ch <= '9')
208 return ch-'0';
209 if (ch >= 'A' && ch <= 'F')
210 return ch-'A'+10;
211 return -1;
212}
213
214/*
215 * scan for the sequence $<data>#<checksum>
216 */
217static void getpacket(char *buffer)
218{
219 unsigned char checksum;
220 unsigned char xmitcsum;
221 int i;
222 int count;
223 unsigned char ch;
224
225 do {
226 /*
227 * wait around for the start character,
228 * ignore all other characters
229 */
230 while ((ch = (getDebugChar() & 0x7f)) != '$') ;
231
232 checksum = 0;
233 xmitcsum = -1;
234 count = 0;
235
236 /*
237 * now, read until a # or end of buffer is found
238 */
239 while (count < BUFMAX) {
240 ch = getDebugChar();
241 if (ch == '#')
242 break;
243 checksum = checksum + ch;
244 buffer[count] = ch;
245 count = count + 1;
246 }
247
248 if (count >= BUFMAX)
249 continue;
250
251 buffer[count] = 0;
252
253 if (ch == '#') {
254 xmitcsum = hex(getDebugChar() & 0x7f) << 4;
255 xmitcsum |= hex(getDebugChar() & 0x7f);
256
257 if (checksum != xmitcsum)
258 putDebugChar('-'); /* failed checksum */
259 else {
260 putDebugChar('+'); /* successful transfer */
261
262 /*
263 * if a sequence char is present,
264 * reply the sequence ID
265 */
266 if (buffer[2] == ':') {
267 putDebugChar(buffer[0]);
268 putDebugChar(buffer[1]);
269
270 /*
271 * remove sequence chars from buffer
272 */
273 count = strlen(buffer);
274 for (i=3; i <= count; i++)
275 buffer[i-3] = buffer[i];
276 }
277 }
278 }
279 }
280 while (checksum != xmitcsum);
281}
282
283/*
284 * send the packet in buffer.
285 */
286static void putpacket(char *buffer)
287{
288 unsigned char checksum;
289 int count;
290 unsigned char ch;
291
292 /*
293 * $<packet info>#<checksum>.
294 */
295
296 do {
297 putDebugChar('$');
298 checksum = 0;
299 count = 0;
300
301 while ((ch = buffer[count]) != 0) {
302 if (!(putDebugChar(ch)))
303 return;
304 checksum += ch;
305 count += 1;
306 }
307
308 putDebugChar('#');
309 putDebugChar(hexchars[checksum >> 4]);
310 putDebugChar(hexchars[checksum & 0xf]);
311
312 }
313 while ((getDebugChar() & 0x7f) != '+');
314}
315
316
317/*
318 * Convert the memory pointed to by mem into hex, placing result in buf.
319 * Return a pointer to the last char put in buf (null), in case of mem fault,
320 * return 0.
321 * may_fault is non-zero if we are reading from arbitrary memory, but is currently
322 * not used.
323 */
324static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault)
325{
326 unsigned char ch;
327
328 while (count-- > 0) {
329 if (kgdb_read_byte(mem++, &ch) != 0)
330 return 0;
331 *buf++ = hexchars[ch >> 4];
332 *buf++ = hexchars[ch & 0xf];
333 }
334
335 *buf = 0;
336
337 return buf;
338}
339
340/*
341 * convert the hex array pointed to by buf into binary to be placed in mem
342 * return a pointer to the character AFTER the last byte written
343 * may_fault is non-zero if we are reading from arbitrary memory, but is currently
344 * not used.
345 */
346static char *hex2mem(char *buf, char *mem, int count, int binary, int may_fault)
347{
348 int i;
349 unsigned char ch;
350
351 for (i=0; i<count; i++)
352 {
353 if (binary) {
354 ch = *buf++;
355 if (ch == 0x7d)
356 ch = 0x20 ^ *buf++;
357 }
358 else {
359 ch = hex(*buf++) << 4;
360 ch |= hex(*buf++);
361 }
362 if (kgdb_write_byte(ch, mem++) != 0)
363 return 0;
364 }
365
366 return mem;
367}
368
369/*
370 * This table contains the mapping between SPARC hardware trap types, and
371 * signals, which are primarily what GDB understands. It also indicates
372 * which hardware traps we need to commandeer when initializing the stub.
373 */
374static struct hard_trap_info {
375 unsigned char tt; /* Trap type code for MIPS R3xxx and R4xxx */
376 unsigned char signo; /* Signal that we map this trap into */
377} hard_trap_info[] = {
378 { 6, SIGBUS }, /* instruction bus error */
379 { 7, SIGBUS }, /* data bus error */
380 { 9, SIGTRAP }, /* break */
381 { 10, SIGILL }, /* reserved instruction */
382/* { 11, SIGILL }, */ /* CPU unusable */
383 { 12, SIGFPE }, /* overflow */
384 { 13, SIGTRAP }, /* trap */
385 { 14, SIGSEGV }, /* virtual instruction cache coherency */
386 { 15, SIGFPE }, /* floating point exception */
387 { 23, SIGSEGV }, /* watch */
388 { 31, SIGSEGV }, /* virtual data cache coherency */
389 { 0, 0} /* Must be last */
390};
391
392/* Save the normal trap handlers for user-mode traps. */
393void *saved_vectors[32];
394
395/*
396 * Set up exception handlers for tracing and breakpoints
397 */
398void set_debug_traps(void)
399{
400 struct hard_trap_info *ht;
401 unsigned long flags;
402 unsigned char c;
403
404 local_irq_save(flags);
405 for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
406 saved_vectors[ht->tt] = set_except_vector(ht->tt, trap_low);
407
408 putDebugChar('+'); /* 'hello world' */
409 /*
410 * In case GDB is started before us, ack any packets
411 * (presumably "$?#xx") sitting there.
412 */
413 while((c = getDebugChar()) != '$');
414 while((c = getDebugChar()) != '#');
415 c = getDebugChar(); /* eat first csum byte */
416 c = getDebugChar(); /* eat second csum byte */
417 putDebugChar('+'); /* ack it */
418
419 initialized = 1;
420 local_irq_restore(flags);
421}
422
423void restore_debug_traps(void)
424{
425 struct hard_trap_info *ht;
426 unsigned long flags;
427
428 local_irq_save(flags);
429 for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
430 set_except_vector(ht->tt, saved_vectors[ht->tt]);
431 local_irq_restore(flags);
432}
433
434/*
435 * Convert the MIPS hardware trap type code to a Unix signal number.
436 */
437static int computeSignal(int tt)
438{
439 struct hard_trap_info *ht;
440
441 for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
442 if (ht->tt == tt)
443 return ht->signo;
444
445 return SIGHUP; /* default for things we don't know about */
446}
447
448/*
449 * While we find nice hex chars, build an int.
450 * Return number of chars processed.
451 */
452static int hexToInt(char **ptr, int *intValue)
453{
454 int numChars = 0;
455 int hexValue;
456
457 *intValue = 0;
458
459 while (**ptr) {
460 hexValue = hex(**ptr);
461 if (hexValue < 0)
462 break;
463
464 *intValue = (*intValue << 4) | hexValue;
465 numChars ++;
466
467 (*ptr)++;
468 }
469
470 return (numChars);
471}
472
473static int hexToLong(char **ptr, long *longValue)
474{
475 int numChars = 0;
476 int hexValue;
477
478 *longValue = 0;
479
480 while (**ptr) {
481 hexValue = hex(**ptr);
482 if (hexValue < 0)
483 break;
484
485 *longValue = (*longValue << 4) | hexValue;
486 numChars ++;
487
488 (*ptr)++;
489 }
490
491 return numChars;
492}
493
494
495#if 0
496/*
497 * Print registers (on target console)
498 * Used only to debug the stub...
499 */
500void show_gdbregs(struct gdb_regs * regs)
501{
502 /*
503 * Saved main processor registers
504 */
505 printk("$0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
506 regs->reg0, regs->reg1, regs->reg2, regs->reg3,
507 regs->reg4, regs->reg5, regs->reg6, regs->reg7);
508 printk("$8 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
509 regs->reg8, regs->reg9, regs->reg10, regs->reg11,
510 regs->reg12, regs->reg13, regs->reg14, regs->reg15);
511 printk("$16: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
512 regs->reg16, regs->reg17, regs->reg18, regs->reg19,
513 regs->reg20, regs->reg21, regs->reg22, regs->reg23);
514 printk("$24: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
515 regs->reg24, regs->reg25, regs->reg26, regs->reg27,
516 regs->reg28, regs->reg29, regs->reg30, regs->reg31);
517
518 /*
519 * Saved cp0 registers
520 */
521 printk("epc : %08lx\nStatus: %08lx\nCause : %08lx\n",
522 regs->cp0_epc, regs->cp0_status, regs->cp0_cause);
523}
524#endif /* dead code */
525
526/*
527 * We single-step by setting breakpoints. When an exception
528 * is handled, we need to restore the instructions hoisted
529 * when the breakpoints were set.
530 *
531 * This is where we save the original instructions.
532 */
533static struct gdb_bp_save {
534 unsigned long addr;
535 unsigned int val;
536} step_bp[2];
537
538#define BP 0x0000000d /* break opcode */
539
540/*
541 * Set breakpoint instructions for single stepping.
542 */
543static void single_step(struct gdb_regs *regs)
544{
545 union mips_instruction insn;
546 unsigned long targ;
547 int is_branch, is_cond, i;
548
549 targ = regs->cp0_epc;
550 insn.word = *(unsigned int *)targ;
551 is_branch = is_cond = 0;
552
553 switch (insn.i_format.opcode) {
554 /*
555 * jr and jalr are in r_format format.
556 */
557 case spec_op:
558 switch (insn.r_format.func) {
559 case jalr_op:
560 case jr_op:
561 targ = *(&regs->reg0 + insn.r_format.rs);
562 is_branch = 1;
563 break;
564 }
565 break;
566
567 /*
568 * This group contains:
569 * bltz_op, bgez_op, bltzl_op, bgezl_op,
570 * bltzal_op, bgezal_op, bltzall_op, bgezall_op.
571 */
572 case bcond_op:
573 is_branch = is_cond = 1;
574 targ += 4 + (insn.i_format.simmediate << 2);
575 break;
576
577 /*
578 * These are unconditional and in j_format.
579 */
580 case jal_op:
581 case j_op:
582 is_branch = 1;
583 targ += 4;
584 targ >>= 28;
585 targ <<= 28;
586 targ |= (insn.j_format.target << 2);
587 break;
588
589 /*
590 * These are conditional.
591 */
592 case beq_op:
593 case beql_op:
594 case bne_op:
595 case bnel_op:
596 case blez_op:
597 case blezl_op:
598 case bgtz_op:
599 case bgtzl_op:
600 case cop0_op:
601 case cop1_op:
602 case cop2_op:
603 case cop1x_op:
604 is_branch = is_cond = 1;
605 targ += 4 + (insn.i_format.simmediate << 2);
606 break;
607 }
608
609 if (is_branch) {
610 i = 0;
611 if (is_cond && targ != (regs->cp0_epc + 8)) {
612 step_bp[i].addr = regs->cp0_epc + 8;
613 step_bp[i++].val = *(unsigned *)(regs->cp0_epc + 8);
614 *(unsigned *)(regs->cp0_epc + 8) = BP;
615 }
616 step_bp[i].addr = targ;
617 step_bp[i].val = *(unsigned *)targ;
618 *(unsigned *)targ = BP;
619 } else {
620 step_bp[0].addr = regs->cp0_epc + 4;
621 step_bp[0].val = *(unsigned *)(regs->cp0_epc + 4);
622 *(unsigned *)(regs->cp0_epc + 4) = BP;
623 }
624}
625
626/*
627 * If asynchronously interrupted by gdb, then we need to set a breakpoint
628 * at the interrupted instruction so that we wind up stopped with a
629 * reasonable stack frame.
630 */
631static struct gdb_bp_save async_bp;
632
633/*
634 * Swap the interrupted EPC with our asynchronous breakpoint routine.
635 * This is safer than stuffing the breakpoint in-place, since no cache
636 * flushes (or resulting smp_call_functions) are required. The
637 * assumption is that only one CPU will be handling asynchronous bp's,
638 * and only one can be active at a time.
639 */
640extern spinlock_t smp_call_lock;
641
642void set_async_breakpoint(unsigned long *epc)
643{
644 /* skip breaking into userland */
645 if ((*epc & 0x80000000) == 0)
646 return;
647
648#ifdef CONFIG_SMP
649 /* avoid deadlock if someone is make IPC */
650 if (spin_is_locked(&smp_call_lock))
651 return;
652#endif
653
654 async_bp.addr = *epc;
655 *epc = (unsigned long)async_breakpoint;
656}
657
658#ifdef CONFIG_SMP
659static void kgdb_wait(void *arg)
660{
661 unsigned flags;
662 int cpu = smp_processor_id();
663
664 local_irq_save(flags);
665
666 __raw_spin_lock(&kgdb_cpulock[cpu]);
667 __raw_spin_unlock(&kgdb_cpulock[cpu]);
668
669 local_irq_restore(flags);
670}
671#endif
672
673/*
674 * GDB stub needs to call kgdb_wait on all processor with interrupts
675 * disabled, so it uses it's own special variant.
676 */
677static int kgdb_smp_call_kgdb_wait(void)
678{
679#ifdef CONFIG_SMP
680 cpumask_t mask = cpu_online_map;
681 struct call_data_struct data;
682 int cpu = smp_processor_id();
683 int cpus;
684
685 /*
686 * Can die spectacularly if this CPU isn't yet marked online
687 */
688 BUG_ON(!cpu_online(cpu));
689
690 cpu_clear(cpu, mask);
691 cpus = cpus_weight(mask);
692 if (!cpus)
693 return 0;
694
695 if (spin_is_locked(&smp_call_lock)) {
696 /*
697 * Some other processor is trying to make us do something
698 * but we're not going to respond... give up
699 */
700 return -1;
701 }
702
703 /*
704 * We will continue here, accepting the fact that
705 * the kernel may deadlock if another CPU attempts
706 * to call smp_call_function now...
707 */
708
709 data.func = kgdb_wait;
710 data.info = NULL;
711 atomic_set(&data.started, 0);
712 data.wait = 0;
713
714 spin_lock(&smp_call_lock);
715 call_data = &data;
716 mb();
717
718 core_send_ipi_mask(mask, SMP_CALL_FUNCTION);
719
720 /* Wait for response */
721 /* FIXME: lock-up detection, backtrace on lock-up */
722 while (atomic_read(&data.started) != cpus)
723 barrier();
724
725 call_data = NULL;
726 spin_unlock(&smp_call_lock);
727#endif
728
729 return 0;
730}
731
732/*
733 * This function does all command processing for interfacing to gdb. It
734 * returns 1 if you should skip the instruction at the trap address, 0
735 * otherwise.
736 */
737void handle_exception(struct gdb_regs *regs)
738{
739 int trap; /* Trap type */
740 int sigval;
741 long addr;
742 int length;
743 char *ptr;
744 unsigned long *stack;
745 int i;
746 int bflag = 0;
747
748 kgdb_started = 1;
749
750 /*
751 * acquire the big kgdb spinlock
752 */
753 if (!spin_trylock(&kgdb_lock)) {
754 /*
755 * some other CPU has the lock, we should go back to
756 * receive the gdb_wait IPC
757 */
758 return;
759 }
760
761 /*
762 * If we're in async_breakpoint(), restore the real EPC from
763 * the breakpoint.
764 */
765 if (regs->cp0_epc == (unsigned long)async_breakinst) {
766 regs->cp0_epc = async_bp.addr;
767 async_bp.addr = 0;
768 }
769
770 /*
771 * acquire the CPU spinlocks
772 */
773 for_each_online_cpu(i)
774 if (__raw_spin_trylock(&kgdb_cpulock[i]) == 0)
775 panic("kgdb: couldn't get cpulock %d\n", i);
776
777 /*
778 * force other cpus to enter kgdb
779 */
780 kgdb_smp_call_kgdb_wait();
781
782 /*
783 * If we're in breakpoint() increment the PC
784 */
785 trap = (regs->cp0_cause & 0x7c) >> 2;
786 if (trap == 9 && regs->cp0_epc == (unsigned long)breakinst)
787 regs->cp0_epc += 4;
788
789 /*
790 * If we were single_stepping, restore the opcodes hoisted
791 * for the breakpoint[s].
792 */
793 if (step_bp[0].addr) {
794 *(unsigned *)step_bp[0].addr = step_bp[0].val;
795 step_bp[0].addr = 0;
796
797 if (step_bp[1].addr) {
798 *(unsigned *)step_bp[1].addr = step_bp[1].val;
799 step_bp[1].addr = 0;
800 }
801 }
802
803 stack = (long *)regs->reg29; /* stack ptr */
804 sigval = computeSignal(trap);
805
806 /*
807 * reply to host that an exception has occurred
808 */
809 ptr = output_buffer;
810
811 /*
812 * Send trap type (converted to signal)
813 */
814 *ptr++ = 'T';
815 *ptr++ = hexchars[sigval >> 4];
816 *ptr++ = hexchars[sigval & 0xf];
817
818 /*
819 * Send Error PC
820 */
821 *ptr++ = hexchars[REG_EPC >> 4];
822 *ptr++ = hexchars[REG_EPC & 0xf];
823 *ptr++ = ':';
824 ptr = mem2hex((char *)&regs->cp0_epc, ptr, sizeof(long), 0);
825 *ptr++ = ';';
826
827 /*
828 * Send frame pointer
829 */
830 *ptr++ = hexchars[REG_FP >> 4];
831 *ptr++ = hexchars[REG_FP & 0xf];
832 *ptr++ = ':';
833 ptr = mem2hex((char *)&regs->reg30, ptr, sizeof(long), 0);
834 *ptr++ = ';';
835
836 /*
837 * Send stack pointer
838 */
839 *ptr++ = hexchars[REG_SP >> 4];
840 *ptr++ = hexchars[REG_SP & 0xf];
841 *ptr++ = ':';
842 ptr = mem2hex((char *)&regs->reg29, ptr, sizeof(long), 0);
843 *ptr++ = ';';
844
845 *ptr++ = 0;
846 putpacket(output_buffer); /* send it off... */
847
848 /*
849 * Wait for input from remote GDB
850 */
851 while (1) {
852 output_buffer[0] = 0;
853 getpacket(input_buffer);
854
855 switch (input_buffer[0])
856 {
857 case '?':
858 output_buffer[0] = 'S';
859 output_buffer[1] = hexchars[sigval >> 4];
860 output_buffer[2] = hexchars[sigval & 0xf];
861 output_buffer[3] = 0;
862 break;
863
864 /*
865 * Detach debugger; let CPU run
866 */
867 case 'D':
868 putpacket(output_buffer);
869 goto finish_kgdb;
870 break;
871
872 case 'd':
873 /* toggle debug flag */
874 break;
875
876 /*
877 * Return the value of the CPU registers
878 */
879 case 'g':
880 ptr = output_buffer;
881 ptr = mem2hex((char *)&regs->reg0, ptr, 32*sizeof(long), 0); /* r0...r31 */
882 ptr = mem2hex((char *)&regs->cp0_status, ptr, 6*sizeof(long), 0); /* cp0 */
883 ptr = mem2hex((char *)&regs->fpr0, ptr, 32*sizeof(long), 0); /* f0...31 */
884 ptr = mem2hex((char *)&regs->cp1_fsr, ptr, 2*sizeof(long), 0); /* cp1 */
885 ptr = mem2hex((char *)&regs->frame_ptr, ptr, 2*sizeof(long), 0); /* frp */
886 ptr = mem2hex((char *)&regs->cp0_index, ptr, 16*sizeof(long), 0); /* cp0 */
887 break;
888
889 /*
890 * set the value of the CPU registers - return OK
891 */
892 case 'G':
893 {
894 ptr = &input_buffer[1];
895 hex2mem(ptr, (char *)&regs->reg0, 32*sizeof(long), 0, 0);
896 ptr += 32*(2*sizeof(long));
897 hex2mem(ptr, (char *)&regs->cp0_status, 6*sizeof(long), 0, 0);
898 ptr += 6*(2*sizeof(long));
899 hex2mem(ptr, (char *)&regs->fpr0, 32*sizeof(long), 0, 0);
900 ptr += 32*(2*sizeof(long));
901 hex2mem(ptr, (char *)&regs->cp1_fsr, 2*sizeof(long), 0, 0);
902 ptr += 2*(2*sizeof(long));
903 hex2mem(ptr, (char *)&regs->frame_ptr, 2*sizeof(long), 0, 0);
904 ptr += 2*(2*sizeof(long));
905 hex2mem(ptr, (char *)&regs->cp0_index, 16*sizeof(long), 0, 0);
906 strcpy(output_buffer, "OK");
907 }
908 break;
909
910 /*
911 * mAA..AA,LLLL Read LLLL bytes at address AA..AA
912 */
913 case 'm':
914 ptr = &input_buffer[1];
915
916 if (hexToLong(&ptr, &addr)
917 && *ptr++ == ','
918 && hexToInt(&ptr, &length)) {
919 if (mem2hex((char *)addr, output_buffer, length, 1))
920 break;
921 strcpy(output_buffer, "E03");
922 } else
923 strcpy(output_buffer, "E01");
924 break;
925
926 /*
927 * XAA..AA,LLLL: Write LLLL escaped binary bytes at address AA.AA
928 */
929 case 'X':
930 bflag = 1;
931 /* fall through */
932
933 /*
934 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK
935 */
936 case 'M':
937 ptr = &input_buffer[1];
938
939 if (hexToLong(&ptr, &addr)
940 && *ptr++ == ','
941 && hexToInt(&ptr, &length)
942 && *ptr++ == ':') {
943 if (hex2mem(ptr, (char *)addr, length, bflag, 1))
944 strcpy(output_buffer, "OK");
945 else
946 strcpy(output_buffer, "E03");
947 }
948 else
949 strcpy(output_buffer, "E02");
950 break;
951
952 /*
953 * cAA..AA Continue at address AA..AA(optional)
954 */
955 case 'c':
956 /* try to read optional parameter, pc unchanged if no parm */
957
958 ptr = &input_buffer[1];
959 if (hexToLong(&ptr, &addr))
960 regs->cp0_epc = addr;
961
962 goto exit_kgdb_exception;
963 break;
964
965 /*
966 * kill the program; let us try to restart the machine
967 * Reset the whole machine.
968 */
969 case 'k':
970 case 'r':
971 machine_restart("kgdb restarts machine");
972 break;
973
974 /*
975 * Step to next instruction
976 */
977 case 's':
978 /*
979 * There is no single step insn in the MIPS ISA, so we
980 * use breakpoints and continue, instead.
981 */
982 single_step(regs);
983 goto exit_kgdb_exception;
984 /* NOTREACHED */
985 break;
986
987 /*
988 * Set baud rate (bBB)
989 * FIXME: Needs to be written
990 */
991 case 'b':
992 {
993#if 0
994 int baudrate;
995 extern void set_timer_3();
996
997 ptr = &input_buffer[1];
998 if (!hexToInt(&ptr, &baudrate))
999 {
1000 strcpy(output_buffer, "B01");
1001 break;
1002 }
1003
1004 /* Convert baud rate to uart clock divider */
1005
1006 switch (baudrate)
1007 {
1008 case 38400:
1009 baudrate = 16;
1010 break;
1011 case 19200:
1012 baudrate = 33;
1013 break;
1014 case 9600:
1015 baudrate = 65;
1016 break;
1017 default:
1018 baudrate = 0;
1019 strcpy(output_buffer, "B02");
1020 goto x1;
1021 }
1022
1023 if (baudrate) {
1024 putpacket("OK"); /* Ack before changing speed */
1025 set_timer_3(baudrate); /* Set it */
1026 }
1027#endif
1028 }
1029 break;
1030
1031 } /* switch */
1032
1033 /*
1034 * reply to the request
1035 */
1036
1037 putpacket(output_buffer);
1038
1039 } /* while */
1040
1041 return;
1042
1043finish_kgdb:
1044 restore_debug_traps();
1045
1046exit_kgdb_exception:
1047 /* release locks so other CPUs can go */
1048 for_each_online_cpu(i)
1049 __raw_spin_unlock(&kgdb_cpulock[i]);
1050 spin_unlock(&kgdb_lock);
1051
1052 __flush_cache_all();
1053 return;
1054}
1055
1056/*
1057 * This function will generate a breakpoint exception. It is used at the
1058 * beginning of a program to sync up with a debugger and can be used
1059 * otherwise as a quick means to stop program execution and "break" into
1060 * the debugger.
1061 */
1062void breakpoint(void)
1063{
1064 if (!initialized)
1065 return;
1066
1067 __asm__ __volatile__(
1068 ".globl breakinst\n\t"
1069 ".set\tnoreorder\n\t"
1070 "nop\n"
1071 "breakinst:\tbreak\n\t"
1072 "nop\n\t"
1073 ".set\treorder"
1074 );
1075}
1076
1077/* Nothing but the break; don't pollute any registers */
1078void async_breakpoint(void)
1079{
1080 __asm__ __volatile__(
1081 ".globl async_breakinst\n\t"
1082 ".set\tnoreorder\n\t"
1083 "nop\n"
1084 "async_breakinst:\tbreak\n\t"
1085 "nop\n\t"
1086 ".set\treorder"
1087 );
1088}
1089
1090void adel(void)
1091{
1092 __asm__ __volatile__(
1093 ".globl\tadel\n\t"
1094 "lui\t$8,0x8000\n\t"
1095 "lw\t$9,1($8)\n\t"
1096 );
1097}
1098
1099/*
1100 * malloc is needed by gdb client in "call func()", even a private one
1101 * will make gdb happy
1102 */
1103static void __used *malloc(size_t size)
1104{
1105 return kmalloc(size, GFP_ATOMIC);
1106}
1107
1108static void __used free(void *where)
1109{
1110 kfree(where);
1111}
1112
1113#ifdef CONFIG_GDB_CONSOLE
1114
1115void gdb_putsn(const char *str, int l)
1116{
1117 char outbuf[18];
1118
1119 if (!kgdb_started)
1120 return;
1121
1122 outbuf[0]='O';
1123
1124 while(l) {
1125 int i = (l>8)?8:l;
1126 mem2hex((char *)str, &outbuf[1], i, 0);
1127 outbuf[(i*2)+1]=0;
1128 putpacket(outbuf);
1129 str += i;
1130 l -= i;
1131 }
1132}
1133
1134static void gdb_console_write(struct console *con, const char *s, unsigned n)
1135{
1136 gdb_putsn(s, n);
1137}
1138
1139static struct console gdb_console = {
1140 .name = "gdb",
1141 .write = gdb_console_write,
1142 .flags = CON_PRINTBUFFER,
1143 .index = -1
1144};
1145
1146static int __init register_gdb_console(void)
1147{
1148 register_console(&gdb_console);
1149
1150 return 0;
1151}
1152
1153console_initcall(register_gdb_console);
1154
1155#endif
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index 6045b9a51a35..4b4007b3083a 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -21,11 +21,16 @@
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/kallsyms.h> 23#include <linux/kallsyms.h>
24#include <linux/kgdb.h>
24 25
25#include <asm/atomic.h> 26#include <asm/atomic.h>
26#include <asm/system.h> 27#include <asm/system.h>
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
28 29
30#ifdef CONFIG_KGDB
31int kgdb_early_setup;
32#endif
33
29static unsigned long irq_map[NR_IRQS / BITS_PER_LONG]; 34static unsigned long irq_map[NR_IRQS / BITS_PER_LONG];
30 35
31int allocate_irqno(void) 36int allocate_irqno(void)
@@ -126,33 +131,22 @@ asmlinkage void spurious_interrupt(void)
126 atomic_inc(&irq_err_count); 131 atomic_inc(&irq_err_count);
127} 132}
128 133
129#ifdef CONFIG_KGDB
130extern void breakpoint(void);
131extern void set_debug_traps(void);
132
133static int kgdb_flag = 1;
134static int __init nokgdb(char *str)
135{
136 kgdb_flag = 0;
137 return 1;
138}
139__setup("nokgdb", nokgdb);
140#endif
141
142void __init init_IRQ(void) 134void __init init_IRQ(void)
143{ 135{
144 int i; 136 int i;
145 137
138#ifdef CONFIG_KGDB
139 if (kgdb_early_setup)
140 return;
141#endif
142
146 for (i = 0; i < NR_IRQS; i++) 143 for (i = 0; i < NR_IRQS; i++)
147 set_irq_noprobe(i); 144 set_irq_noprobe(i);
148 145
149 arch_init_irq(); 146 arch_init_irq();
150 147
151#ifdef CONFIG_KGDB 148#ifdef CONFIG_KGDB
152 if (kgdb_flag) { 149 if (!kgdb_early_setup)
153 printk("Wait for gdb client connection ...\n"); 150 kgdb_early_setup = 1;
154 set_debug_traps();
155 breakpoint();
156 }
157#endif 151#endif
158} 152}
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
new file mode 100644
index 000000000000..c5a8b2d21ca4
--- /dev/null
+++ b/arch/mips/kernel/kgdb.c
@@ -0,0 +1,281 @@
1/*
2 * Originally written by Glenn Engel, Lake Stevens Instrument Division
3 *
4 * Contributed by HP Systems
5 *
6 * Modified for Linux/MIPS (and MIPS in general) by Andreas Busse
7 * Send complaints, suggestions etc. to <andy@waldorf-gmbh.de>
8 *
9 * Copyright (C) 1995 Andreas Busse
10 *
11 * Copyright (C) 2003 MontaVista Software Inc.
12 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
13 *
14 * Copyright (C) 2004-2005 MontaVista Software Inc.
15 * Author: Manish Lachwani, mlachwani@mvista.com or manish@koffee-break.com
16 *
17 * Copyright (C) 2007-2008 Wind River Systems, Inc.
18 * Author/Maintainer: Jason Wessel, jason.wessel@windriver.com
19 *
20 * This file is licensed under the terms of the GNU General Public License
21 * version 2. This program is licensed "as is" without any warranty of any
22 * kind, whether express or implied.
23 */
24
25#include <linux/ptrace.h> /* for linux pt_regs struct */
26#include <linux/kgdb.h>
27#include <linux/kdebug.h>
28#include <linux/sched.h>
29#include <asm/inst.h>
30#include <asm/fpu.h>
31#include <asm/cacheflush.h>
32#include <asm/processor.h>
33#include <asm/sigcontext.h>
34
35static struct hard_trap_info {
36 unsigned char tt; /* Trap type code for MIPS R3xxx and R4xxx */
37 unsigned char signo; /* Signal that we map this trap into */
38} hard_trap_info[] = {
39 { 6, SIGBUS }, /* instruction bus error */
40 { 7, SIGBUS }, /* data bus error */
41 { 9, SIGTRAP }, /* break */
42/* { 11, SIGILL }, */ /* CPU unusable */
43 { 12, SIGFPE }, /* overflow */
44 { 13, SIGTRAP }, /* trap */
45 { 14, SIGSEGV }, /* virtual instruction cache coherency */
46 { 15, SIGFPE }, /* floating point exception */
47 { 23, SIGSEGV }, /* watch */
48 { 31, SIGSEGV }, /* virtual data cache coherency */
49 { 0, 0} /* Must be last */
50};
51
52void arch_kgdb_breakpoint(void)
53{
54 __asm__ __volatile__(
55 ".globl breakinst\n\t"
56 ".set\tnoreorder\n\t"
57 "nop\n"
58 "breakinst:\tbreak\n\t"
59 "nop\n\t"
60 ".set\treorder");
61}
62
63static void kgdb_call_nmi_hook(void *ignored)
64{
65 kgdb_nmicallback(raw_smp_processor_id(), (void *)0);
66}
67
68void kgdb_roundup_cpus(unsigned long flags)
69{
70 local_irq_enable();
71 smp_call_function(kgdb_call_nmi_hook, NULL, NULL);
72 local_irq_disable();
73}
74
75static int compute_signal(int tt)
76{
77 struct hard_trap_info *ht;
78
79 for (ht = hard_trap_info; ht->tt && ht->signo; ht++)
80 if (ht->tt == tt)
81 return ht->signo;
82
83 return SIGHUP; /* default for things we don't know about */
84}
85
86void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
87{
88 int reg;
89
90#if (KGDB_GDB_REG_SIZE == 32)
91 u32 *ptr = (u32 *)gdb_regs;
92#else
93 u64 *ptr = (u64 *)gdb_regs;
94#endif
95
96 for (reg = 0; reg < 32; reg++)
97 *(ptr++) = regs->regs[reg];
98
99 *(ptr++) = regs->cp0_status;
100 *(ptr++) = regs->lo;
101 *(ptr++) = regs->hi;
102 *(ptr++) = regs->cp0_badvaddr;
103 *(ptr++) = regs->cp0_cause;
104 *(ptr++) = regs->cp0_epc;
105
106 /* FP REGS */
107 if (!(current && (regs->cp0_status & ST0_CU1)))
108 return;
109
110 save_fp(current);
111 for (reg = 0; reg < 32; reg++)
112 *(ptr++) = current->thread.fpu.fpr[reg];
113}
114
115void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
116{
117 int reg;
118
119#if (KGDB_GDB_REG_SIZE == 32)
120 const u32 *ptr = (u32 *)gdb_regs;
121#else
122 const u64 *ptr = (u64 *)gdb_regs;
123#endif
124
125 for (reg = 0; reg < 32; reg++)
126 regs->regs[reg] = *(ptr++);
127
128 regs->cp0_status = *(ptr++);
129 regs->lo = *(ptr++);
130 regs->hi = *(ptr++);
131 regs->cp0_badvaddr = *(ptr++);
132 regs->cp0_cause = *(ptr++);
133 regs->cp0_epc = *(ptr++);
134
135 /* FP REGS from current */
136 if (!(current && (regs->cp0_status & ST0_CU1)))
137 return;
138
139 for (reg = 0; reg < 32; reg++)
140 current->thread.fpu.fpr[reg] = *(ptr++);
141 restore_fp(current);
142}
143
144/*
145 * Similar to regs_to_gdb_regs() except that process is sleeping and so
146 * we may not be able to get all the info.
147 */
148void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
149{
150 int reg;
151 struct thread_info *ti = task_thread_info(p);
152 unsigned long ksp = (unsigned long)ti + THREAD_SIZE - 32;
153 struct pt_regs *regs = (struct pt_regs *)ksp - 1;
154#if (KGDB_GDB_REG_SIZE == 32)
155 u32 *ptr = (u32 *)gdb_regs;
156#else
157 u64 *ptr = (u64 *)gdb_regs;
158#endif
159
160 for (reg = 0; reg < 16; reg++)
161 *(ptr++) = regs->regs[reg];
162
163 /* S0 - S7 */
164 for (reg = 16; reg < 24; reg++)
165 *(ptr++) = regs->regs[reg];
166
167 for (reg = 24; reg < 28; reg++)
168 *(ptr++) = 0;
169
170 /* GP, SP, FP, RA */
171 for (reg = 28; reg < 32; reg++)
172 *(ptr++) = regs->regs[reg];
173
174 *(ptr++) = regs->cp0_status;
175 *(ptr++) = regs->lo;
176 *(ptr++) = regs->hi;
177 *(ptr++) = regs->cp0_badvaddr;
178 *(ptr++) = regs->cp0_cause;
179 *(ptr++) = regs->cp0_epc;
180}
181
182/*
183 * Calls linux_debug_hook before the kernel dies. If KGDB is enabled,
184 * then try to fall into the debugger
185 */
186static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd,
187 void *ptr)
188{
189 struct die_args *args = (struct die_args *)ptr;
190 struct pt_regs *regs = args->regs;
191 int trap = (regs->cp0_cause & 0x7c) >> 2;
192
193 if (fixup_exception(regs))
194 return NOTIFY_DONE;
195
196 /* Userpace events, ignore. */
197 if (user_mode(regs))
198 return NOTIFY_DONE;
199
200 if (atomic_read(&kgdb_active) != -1)
201 kgdb_nmicallback(smp_processor_id(), regs);
202
203 if (kgdb_handle_exception(trap, compute_signal(trap), 0, regs))
204 return NOTIFY_DONE;
205
206 if (atomic_read(&kgdb_setting_breakpoint))
207 if ((trap == 9) && (regs->cp0_epc == (unsigned long)breakinst))
208 regs->cp0_epc += 4;
209
210 /* In SMP mode, __flush_cache_all does IPI */
211 local_irq_enable();
212 __flush_cache_all();
213
214 return NOTIFY_STOP;
215}
216
217static struct notifier_block kgdb_notifier = {
218 .notifier_call = kgdb_mips_notify,
219};
220
221/*
222 * Handle the 's' and 'c' commands
223 */
224int kgdb_arch_handle_exception(int vector, int signo, int err_code,
225 char *remcom_in_buffer, char *remcom_out_buffer,
226 struct pt_regs *regs)
227{
228 char *ptr;
229 unsigned long address;
230 int cpu = smp_processor_id();
231
232 switch (remcom_in_buffer[0]) {
233 case 's':
234 case 'c':
235 /* handle the optional parameter */
236 ptr = &remcom_in_buffer[1];
237 if (kgdb_hex2long(&ptr, &address))
238 regs->cp0_epc = address;
239
240 atomic_set(&kgdb_cpu_doing_single_step, -1);
241 if (remcom_in_buffer[0] == 's')
242 if (kgdb_contthread)
243 atomic_set(&kgdb_cpu_doing_single_step, cpu);
244
245 return 0;
246 }
247
248 return -1;
249}
250
251struct kgdb_arch arch_kgdb_ops;
252
253/*
254 * We use kgdb_early_setup so that functions we need to call now don't
255 * cause trouble when called again later.
256 */
257int kgdb_arch_init(void)
258{
259 union mips_instruction insn = {
260 .r_format = {
261 .opcode = spec_op,
262 .func = break_op,
263 }
264 };
265 memcpy(arch_kgdb_ops.gdb_bpt_instr, insn.byte, BREAK_INSTR_SIZE);
266
267 register_die_notifier(&kgdb_notifier);
268
269 return 0;
270}
271
272/*
273 * kgdb_arch_exit - Perform any architecture specific uninitalization.
274 *
275 * This function will handle the uninitalization of any architecture
276 * specific callbacks, for dynamic registration and unregistration.
277 */
278void kgdb_arch_exit(void)
279{
280 unregister_die_notifier(&kgdb_notifier);
281}
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index b8ea4e9d0d87..426cced1e9dc 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -23,6 +23,8 @@
23#include <linux/bootmem.h> 23#include <linux/bootmem.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/ptrace.h> 25#include <linux/ptrace.h>
26#include <linux/kgdb.h>
27#include <linux/kdebug.h>
26 28
27#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
28#include <asm/branch.h> 30#include <asm/branch.h>
@@ -425,6 +427,10 @@ asmlinkage void do_be(struct pt_regs *regs)
425 printk(KERN_ALERT "%s bus error, epc == %0*lx, ra == %0*lx\n", 427 printk(KERN_ALERT "%s bus error, epc == %0*lx, ra == %0*lx\n",
426 data ? "Data" : "Instruction", 428 data ? "Data" : "Instruction",
427 field, regs->cp0_epc, field, regs->regs[31]); 429 field, regs->cp0_epc, field, regs->regs[31]);
430 if (notify_die(DIE_OOPS, "bus error", regs, SIGBUS, 0, 0)
431 == NOTIFY_STOP)
432 return;
433
428 die_if_kernel("Oops", regs); 434 die_if_kernel("Oops", regs);
429 force_sig(SIGBUS, current); 435 force_sig(SIGBUS, current);
430} 436}
@@ -623,6 +629,9 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
623{ 629{
624 siginfo_t info; 630 siginfo_t info;
625 631
632 if (notify_die(DIE_FP, "FP exception", regs, SIGFPE, 0, 0)
633 == NOTIFY_STOP)
634 return;
626 die_if_kernel("FP exception in kernel code", regs); 635 die_if_kernel("FP exception in kernel code", regs);
627 636
628 if (fcr31 & FPU_CSR_UNI_X) { 637 if (fcr31 & FPU_CSR_UNI_X) {
@@ -682,6 +691,9 @@ static void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
682 siginfo_t info; 691 siginfo_t info;
683 char b[40]; 692 char b[40];
684 693
694 if (notify_die(DIE_TRAP, str, regs, code, 0, 0) == NOTIFY_STOP)
695 return;
696
685 /* 697 /*
686 * A short test says that IRIX 5.3 sends SIGTRAP for all trap 698 * A short test says that IRIX 5.3 sends SIGTRAP for all trap
687 * insns, even for trap and break codes that indicate arithmetic 699 * insns, even for trap and break codes that indicate arithmetic
@@ -762,6 +774,10 @@ asmlinkage void do_ri(struct pt_regs *regs)
762 unsigned int opcode = 0; 774 unsigned int opcode = 0;
763 int status = -1; 775 int status = -1;
764 776
777 if (notify_die(DIE_RI, "RI Fault", regs, SIGSEGV, 0, 0)
778 == NOTIFY_STOP)
779 return;
780
765 die_if_kernel("Reserved instruction in kernel code", regs); 781 die_if_kernel("Reserved instruction in kernel code", regs);
766 782
767 if (unlikely(compute_return_epc(regs) < 0)) 783 if (unlikely(compute_return_epc(regs) < 0))
@@ -1537,6 +1553,11 @@ void __init trap_init(void)
1537 extern char except_vec4; 1553 extern char except_vec4;
1538 unsigned long i; 1554 unsigned long i;
1539 1555
1556#if defined(CONFIG_KGDB)
1557 if (kgdb_early_setup)
1558 return; /* Already done */
1559#endif
1560
1540 if (cpu_has_veic || cpu_has_vint) 1561 if (cpu_has_veic || cpu_has_vint)
1541 ebase = (unsigned long) alloc_bootmem_low_pages(0x200 + VECTORSPACING*64); 1562 ebase = (unsigned long) alloc_bootmem_low_pages(0x200 + VECTORSPACING*64);
1542 else 1563 else
diff --git a/arch/mips/mm/tlb-r3k.c b/arch/mips/mm/tlb-r3k.c
index a782549ac80e..f0cf46adb978 100644
--- a/arch/mips/mm/tlb-r3k.c
+++ b/arch/mips/mm/tlb-r3k.c
@@ -246,10 +246,6 @@ void __init add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
246 old_pagemask = read_c0_pagemask(); 246 old_pagemask = read_c0_pagemask();
247 w = read_c0_wired(); 247 w = read_c0_wired();
248 write_c0_wired(w + 1); 248 write_c0_wired(w + 1);
249 if (read_c0_wired() != w + 1) {
250 printk("[tlbwired] No WIRED reg?\n");
251 return;
252 }
253 write_c0_index(w << 8); 249 write_c0_index(w << 8);
254 write_c0_pagemask(pagemask); 250 write_c0_pagemask(pagemask);
255 write_c0_entryhi(entryhi); 251 write_c0_entryhi(entryhi);
diff --git a/arch/mips/mti-malta/Makefile b/arch/mips/mti-malta/Makefile
index f8064446e812..3b7dd722c32a 100644
--- a/arch/mips/mti-malta/Makefile
+++ b/arch/mips/mti-malta/Makefile
@@ -13,7 +13,6 @@ obj-y := malta-amon.o malta-cmdline.o \
13 13
14obj-$(CONFIG_EARLY_PRINTK) += malta-console.o 14obj-$(CONFIG_EARLY_PRINTK) += malta-console.o
15obj-$(CONFIG_PCI) += malta-pci.o 15obj-$(CONFIG_PCI) += malta-pci.o
16obj-$(CONFIG_KGDB) += malta-kgdb.o
17 16
18# FIXME FIXME FIXME 17# FIXME FIXME FIXME
19obj-$(CONFIG_MIPS_MT_SMTC) += malta_smtc.o 18obj-$(CONFIG_MIPS_MT_SMTC) += malta_smtc.o
diff --git a/arch/mips/mti-malta/malta-init.c b/arch/mips/mti-malta/malta-init.c
index c0653021a171..4832af251668 100644
--- a/arch/mips/mti-malta/malta-init.c
+++ b/arch/mips/mti-malta/malta-init.c
@@ -37,15 +37,6 @@
37 37
38#include <asm/mips-boards/malta.h> 38#include <asm/mips-boards/malta.h>
39 39
40#ifdef CONFIG_KGDB
41extern int rs_kgdb_hook(int, int);
42extern int rs_putDebugChar(char);
43extern char rs_getDebugChar(void);
44extern int saa9730_kgdb_hook(int);
45extern int saa9730_putDebugChar(char);
46extern char saa9730_getDebugChar(void);
47#endif
48
49int prom_argc; 40int prom_argc;
50int *_prom_argv, *_prom_envp; 41int *_prom_argv, *_prom_envp;
51 42
@@ -173,51 +164,6 @@ static void __init console_config(void)
173} 164}
174#endif 165#endif
175 166
176#ifdef CONFIG_KGDB
177void __init kgdb_config(void)
178{
179 extern int (*generic_putDebugChar)(char);
180 extern char (*generic_getDebugChar)(void);
181 char *argptr;
182 int line, speed;
183
184 argptr = prom_getcmdline();
185 if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
186 argptr += strlen("kgdb=ttyS");
187 if (*argptr != '0' && *argptr != '1')
188 printk("KGDB: Unknown serial line /dev/ttyS%c, "
189 "falling back to /dev/ttyS1\n", *argptr);
190 line = *argptr == '0' ? 0 : 1;
191 printk("KGDB: Using serial line /dev/ttyS%d for session\n", line);
192
193 speed = 0;
194 if (*++argptr == ',')
195 {
196 int c;
197 while ((c = *++argptr) && ('0' <= c && c <= '9'))
198 speed = speed * 10 + c - '0';
199 }
200 {
201 speed = rs_kgdb_hook(line, speed);
202 generic_putDebugChar = rs_putDebugChar;
203 generic_getDebugChar = rs_getDebugChar;
204 }
205
206 pr_info("KGDB: Using serial line /dev/ttyS%d at %d for "
207 "session, please connect your debugger\n",
208 line ? 1 : 0, speed);
209
210 {
211 char *s;
212 for (s = "Please connect GDB to this port\r\n"; *s; )
213 generic_putDebugChar(*s++);
214 }
215
216 /* Breakpoint is invoked after interrupts are initialised */
217 }
218}
219#endif
220
221static void __init mips_nmi_setup(void) 167static void __init mips_nmi_setup(void)
222{ 168{
223 void *base; 169 void *base;
diff --git a/arch/mips/mti-malta/malta-kgdb.c b/arch/mips/mti-malta/malta-kgdb.c
deleted file mode 100644
index 6a1854de4579..000000000000
--- a/arch/mips/mti-malta/malta-kgdb.c
+++ /dev/null
@@ -1,133 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 *
18 * This is the interface to the remote debugger stub.
19 */
20#include <linux/types.h>
21#include <linux/serial.h>
22#include <linux/serialP.h>
23#include <linux/serial_reg.h>
24
25#include <asm/serial.h>
26#include <asm/io.h>
27
28static struct serial_state rs_table[] = {
29 SERIAL_PORT_DFNS /* Defined in serial.h */
30};
31
32static struct async_struct kdb_port_info = {0};
33
34int (*generic_putDebugChar)(char);
35char (*generic_getDebugChar)(void);
36
37static __inline__ unsigned int serial_in(struct async_struct *info, int offset)
38{
39 return inb(info->port + offset);
40}
41
42static __inline__ void serial_out(struct async_struct *info, int offset,
43 int value)
44{
45 outb(value, info->port+offset);
46}
47
48int rs_kgdb_hook(int tty_no, int speed) {
49 int t;
50 struct serial_state *ser = &rs_table[tty_no];
51
52 kdb_port_info.state = ser;
53 kdb_port_info.magic = SERIAL_MAGIC;
54 kdb_port_info.port = ser->port;
55 kdb_port_info.flags = ser->flags;
56
57 /*
58 * Clear all interrupts
59 */
60 serial_in(&kdb_port_info, UART_LSR);
61 serial_in(&kdb_port_info, UART_RX);
62 serial_in(&kdb_port_info, UART_IIR);
63 serial_in(&kdb_port_info, UART_MSR);
64
65 /*
66 * Now, initialize the UART
67 */
68 serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8); /* reset DLAB */
69 if (kdb_port_info.flags & ASYNC_FOURPORT) {
70 kdb_port_info.MCR = UART_MCR_DTR | UART_MCR_RTS;
71 t = UART_MCR_DTR | UART_MCR_OUT1;
72 } else {
73 kdb_port_info.MCR
74 = UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2;
75 t = UART_MCR_DTR | UART_MCR_RTS;
76 }
77
78 kdb_port_info.MCR = t; /* no interrupts, please */
79 serial_out(&kdb_port_info, UART_MCR, kdb_port_info.MCR);
80
81 /*
82 * and set the speed of the serial port
83 */
84 if (speed == 0)
85 speed = 9600;
86
87 t = kdb_port_info.state->baud_base / speed;
88 /* set DLAB */
89 serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8 | UART_LCR_DLAB);
90 serial_out(&kdb_port_info, UART_DLL, t & 0xff);/* LS of divisor */
91 serial_out(&kdb_port_info, UART_DLM, t >> 8); /* MS of divisor */
92 /* reset DLAB */
93 serial_out(&kdb_port_info, UART_LCR, UART_LCR_WLEN8);
94
95 return speed;
96}
97
98int putDebugChar(char c)
99{
100 return generic_putDebugChar(c);
101}
102
103char getDebugChar(void)
104{
105 return generic_getDebugChar();
106}
107
108int rs_putDebugChar(char c)
109{
110
111 if (!kdb_port_info.state) { /* need to init device first */
112 return 0;
113 }
114
115 while ((serial_in(&kdb_port_info, UART_LSR) & UART_LSR_THRE) == 0)
116 ;
117
118 serial_out(&kdb_port_info, UART_TX, c);
119
120 return 1;
121}
122
123char rs_getDebugChar(void)
124{
125 if (!kdb_port_info.state) { /* need to init device first */
126 return 0;
127 }
128
129 while (!(serial_in(&kdb_port_info, UART_LSR) & 1))
130 ;
131
132 return serial_in(&kdb_port_info, UART_RX);
133}
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index e7cad54936ca..dc78b8983eeb 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -199,10 +199,6 @@ void __init plat_mem_setup(void)
199 */ 199 */
200 enable_dma(4); 200 enable_dma(4);
201 201
202#ifdef CONFIG_KGDB
203 kgdb_config();
204#endif
205
206#ifdef CONFIG_DMA_COHERENT 202#ifdef CONFIG_DMA_COHERENT
207 if (mips_revision_sconid != MIPS_REVISION_SCON_BONITO) 203 if (mips_revision_sconid != MIPS_REVISION_SCON_BONITO)
208 panic("Hardware DMA cache coherency not supported"); 204 panic("Hardware DMA cache coherency not supported");
diff --git a/arch/mips/nxp/pnx8550/common/Makefile b/arch/mips/nxp/pnx8550/common/Makefile
index 31cc1a5cec3b..dd9e7b1f7fd3 100644
--- a/arch/mips/nxp/pnx8550/common/Makefile
+++ b/arch/mips/nxp/pnx8550/common/Makefile
@@ -24,6 +24,5 @@
24 24
25obj-y := setup.o prom.o int.o reset.o time.o proc.o platform.o 25obj-y := setup.o prom.o int.o reset.o time.o proc.o platform.o
26obj-$(CONFIG_PCI) += pci.o 26obj-$(CONFIG_PCI) += pci.o
27obj-$(CONFIG_KGDB) += gdb_hook.o
28 27
29EXTRA_CFLAGS += -Werror 28EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/nxp/pnx8550/common/gdb_hook.c b/arch/mips/nxp/pnx8550/common/gdb_hook.c
deleted file mode 100644
index ad4624f6d9bc..000000000000
--- a/arch/mips/nxp/pnx8550/common/gdb_hook.c
+++ /dev/null
@@ -1,109 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * ########################################################################
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 *
20 * ########################################################################
21 *
22 * This is the interface to the remote debugger stub.
23 *
24 */
25#include <linux/types.h>
26#include <linux/serial.h>
27#include <linux/serialP.h>
28#include <linux/serial_reg.h>
29#include <linux/serial_ip3106.h>
30
31#include <asm/serial.h>
32#include <asm/io.h>
33
34#include <uart.h>
35
36static struct serial_state rs_table[IP3106_NR_PORTS] = {
37};
38static struct async_struct kdb_port_info = {0};
39
40void rs_kgdb_hook(int tty_no)
41{
42 struct serial_state *ser = &rs_table[tty_no];
43
44 kdb_port_info.state = ser;
45 kdb_port_info.magic = SERIAL_MAGIC;
46 kdb_port_info.port = tty_no;
47 kdb_port_info.flags = ser->flags;
48
49 /*
50 * Clear all interrupts
51 */
52 /* Clear all the transmitter FIFO counters (pointer and status) */
53 ip3106_lcr(UART_BASE, tty_no) |= IP3106_UART_LCR_TX_RST;
54 /* Clear all the receiver FIFO counters (pointer and status) */
55 ip3106_lcr(UART_BASE, tty_no) |= IP3106_UART_LCR_RX_RST;
56 /* Clear all interrupts */
57 ip3106_iclr(UART_BASE, tty_no) = IP3106_UART_INT_ALLRX |
58 IP3106_UART_INT_ALLTX;
59
60 /*
61 * Now, initialize the UART
62 */
63 ip3106_lcr(UART_BASE, tty_no) = IP3106_UART_LCR_8BIT;
64 ip3106_baud(UART_BASE, tty_no) = 5; // 38400 Baud
65}
66
67int putDebugChar(char c)
68{
69 /* Wait until FIFO not full */
70 while (((ip3106_fifo(UART_BASE, kdb_port_info.port) & IP3106_UART_FIFO_TXFIFO) >> 16) >= 16)
71 ;
72 /* Send one char */
73 ip3106_fifo(UART_BASE, kdb_port_info.port) = c;
74
75 return 1;
76}
77
78char getDebugChar(void)
79{
80 char ch;
81
82 /* Wait until there is a char in the FIFO */
83 while (!((ip3106_fifo(UART_BASE, kdb_port_info.port) &
84 IP3106_UART_FIFO_RXFIFO) >> 8))
85 ;
86 /* Read one char */
87 ch = ip3106_fifo(UART_BASE, kdb_port_info.port) &
88 IP3106_UART_FIFO_RBRTHR;
89 /* Advance the RX FIFO read pointer */
90 ip3106_lcr(UART_BASE, kdb_port_info.port) |= IP3106_UART_LCR_RX_NEXT;
91 return (ch);
92}
93
94void rs_disable_debug_interrupts(void)
95{
96 ip3106_ien(UART_BASE, kdb_port_info.port) = 0; /* Disable all interrupts */
97}
98
99void rs_enable_debug_interrupts(void)
100{
101 /* Clear all the transmitter FIFO counters (pointer and status) */
102 ip3106_lcr(UART_BASE, kdb_port_info.port) |= IP3106_UART_LCR_TX_RST;
103 /* Clear all the receiver FIFO counters (pointer and status) */
104 ip3106_lcr(UART_BASE, kdb_port_info.port) |= IP3106_UART_LCR_RX_RST;
105 /* Clear all interrupts */
106 ip3106_iclr(UART_BASE, kdb_port_info.port) = IP3106_UART_INT_ALLRX |
107 IP3106_UART_INT_ALLTX;
108 ip3106_ien(UART_BASE, kdb_port_info.port) = IP3106_UART_INT_ALLRX; /* Enable RX interrupts */
109}
diff --git a/arch/mips/nxp/pnx8550/common/int.c b/arch/mips/nxp/pnx8550/common/int.c
index aad03429a5e3..f080f114a1bf 100644
--- a/arch/mips/nxp/pnx8550/common/int.c
+++ b/arch/mips/nxp/pnx8550/common/int.c
@@ -34,7 +34,6 @@
34#include <linux/module.h> 34#include <linux/module.h>
35 35
36#include <asm/io.h> 36#include <asm/io.h>
37#include <asm/gdb-stub.h>
38#include <int.h> 37#include <int.h>
39#include <uart.h> 38#include <uart.h>
40 39
diff --git a/arch/mips/nxp/pnx8550/common/proc.c b/arch/mips/nxp/pnx8550/common/proc.c
index 18b125e3b65d..acf1fa889444 100644
--- a/arch/mips/nxp/pnx8550/common/proc.c
+++ b/arch/mips/nxp/pnx8550/common/proc.c
@@ -22,7 +22,6 @@
22#include <linux/random.h> 22#include <linux/random.h>
23 23
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/gdb-stub.h>
26#include <int.h> 25#include <int.h>
27#include <uart.h> 26#include <uart.h>
28 27
diff --git a/arch/mips/nxp/pnx8550/common/setup.c b/arch/mips/nxp/pnx8550/common/setup.c
index 92d764c97701..2aed50fef10f 100644
--- a/arch/mips/nxp/pnx8550/common/setup.c
+++ b/arch/mips/nxp/pnx8550/common/setup.c
@@ -47,7 +47,6 @@ extern void pnx8550_machine_halt(void);
47extern void pnx8550_machine_power_off(void); 47extern void pnx8550_machine_power_off(void);
48extern struct resource ioport_resource; 48extern struct resource ioport_resource;
49extern struct resource iomem_resource; 49extern struct resource iomem_resource;
50extern void rs_kgdb_hook(int tty_no);
51extern char *prom_getcmdline(void); 50extern char *prom_getcmdline(void);
52 51
53struct resource standard_io_resources[] = { 52struct resource standard_io_resources[] = {
@@ -142,16 +141,5 @@ void __init plat_mem_setup(void)
142 ip3106_baud(UART_BASE, pnx8550_console_port) = 5; 141 ip3106_baud(UART_BASE, pnx8550_console_port) = 5;
143 } 142 }
144 143
145#ifdef CONFIG_KGDB
146 argptr = prom_getcmdline();
147 if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) {
148 int line;
149 argptr += strlen("kgdb=ttyS");
150 line = *argptr == '0' ? 0 : 1;
151 rs_kgdb_hook(line);
152 pr_info("KGDB: Using ttyS%i for session, "
153 "please connect your debugger\n", line ? 1 : 0);
154 }
155#endif
156 return; 144 return;
157} 145}
diff --git a/arch/mips/pci/ops-tx3927.c b/arch/mips/pci/ops-tx3927.c
index 8a17a39e5bf2..31c150196595 100644
--- a/arch/mips/pci/ops-tx3927.c
+++ b/arch/mips/pci/ops-tx3927.c
@@ -37,45 +37,48 @@
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <linux/kernel.h> 38#include <linux/kernel.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/interrupt.h>
40 41
41#include <asm/addrspace.h> 42#include <asm/addrspace.h>
43#include <asm/txx9irq.h>
44#include <asm/txx9/pci.h>
42#include <asm/txx9/tx3927.h> 45#include <asm/txx9/tx3927.h>
43 46
44static inline int mkaddr(unsigned char bus, unsigned char dev_fn, 47static int mkaddr(struct pci_bus *bus, unsigned char devfn, unsigned char where)
45 unsigned char where)
46{ 48{
47 if (bus == 0 && dev_fn >= PCI_DEVFN(TX3927_PCIC_MAX_DEVNU, 0)) 49 if (bus->parent == NULL &&
48 return PCIBIOS_DEVICE_NOT_FOUND; 50 devfn >= PCI_DEVFN(TX3927_PCIC_MAX_DEVNU, 0))
49 51 return -1;
50 tx3927_pcicptr->ica = ((bus & 0xff) << 0x10) | 52 tx3927_pcicptr->ica =
51 ((dev_fn & 0xff) << 0x08) | 53 ((bus->number & 0xff) << 0x10) |
52 (where & 0xfc); 54 ((devfn & 0xff) << 0x08) |
55 (where & 0xfc) | (bus->parent ? 1 : 0);
53 56
54 /* clear M_ABORT and Disable M_ABORT Int. */ 57 /* clear M_ABORT and Disable M_ABORT Int. */
55 tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT; 58 tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT;
56 tx3927_pcicptr->pcistatim &= ~PCI_STATUS_REC_MASTER_ABORT; 59 tx3927_pcicptr->pcistatim &= ~PCI_STATUS_REC_MASTER_ABORT;
57 60 return 0;
58 return PCIBIOS_SUCCESSFUL;
59} 61}
60 62
61static inline int check_abort(void) 63static inline int check_abort(void)
62{ 64{
63 if (tx3927_pcicptr->pcistat & PCI_STATUS_REC_MASTER_ABORT) 65 if (tx3927_pcicptr->pcistat & PCI_STATUS_REC_MASTER_ABORT) {
64 tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT; 66 tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT;
65 tx3927_pcicptr->pcistatim |= PCI_STATUS_REC_MASTER_ABORT; 67 tx3927_pcicptr->pcistatim |= PCI_STATUS_REC_MASTER_ABORT;
68 /* flush write buffer */
69 iob();
66 return PCIBIOS_DEVICE_NOT_FOUND; 70 return PCIBIOS_DEVICE_NOT_FOUND;
67 71 }
68 return PCIBIOS_SUCCESSFUL; 72 return PCIBIOS_SUCCESSFUL;
69} 73}
70 74
71static int tx3927_pci_read_config(struct pci_bus *bus, unsigned int devfn, 75static int tx3927_pci_read_config(struct pci_bus *bus, unsigned int devfn,
72 int where, int size, u32 * val) 76 int where, int size, u32 * val)
73{ 77{
74 int ret; 78 if (mkaddr(bus, devfn, where)) {
75 79 *val = 0xffffffff;
76 ret = mkaddr(bus->number, devfn, where); 80 return PCIBIOS_DEVICE_NOT_FOUND;
77 if (ret) 81 }
78 return ret;
79 82
80 switch (size) { 83 switch (size) {
81 case 1: 84 case 1:
@@ -97,11 +100,8 @@ static int tx3927_pci_read_config(struct pci_bus *bus, unsigned int devfn,
97static int tx3927_pci_write_config(struct pci_bus *bus, unsigned int devfn, 100static int tx3927_pci_write_config(struct pci_bus *bus, unsigned int devfn,
98 int where, int size, u32 val) 101 int where, int size, u32 val)
99{ 102{
100 int ret; 103 if (mkaddr(bus, devfn, where))
101 104 return PCIBIOS_DEVICE_NOT_FOUND;
102 ret = mkaddr(bus->number, devfn, where);
103 if (ret)
104 return ret;
105 105
106 switch (size) { 106 switch (size) {
107 case 1: 107 case 1:
@@ -117,11 +117,6 @@ static int tx3927_pci_write_config(struct pci_bus *bus, unsigned int devfn,
117 tx3927_pcicptr->icd = cpu_to_le32(val); 117 tx3927_pcicptr->icd = cpu_to_le32(val);
118 } 118 }
119 119
120 if (tx3927_pcicptr->pcistat & PCI_STATUS_REC_MASTER_ABORT)
121 tx3927_pcicptr->pcistat |= PCI_STATUS_REC_MASTER_ABORT;
122 tx3927_pcicptr->pcistatim |= PCI_STATUS_REC_MASTER_ABORT;
123 return PCIBIOS_DEVICE_NOT_FOUND;
124
125 return check_abort(); 120 return check_abort();
126} 121}
127 122
@@ -202,3 +197,34 @@ void __init tx3927_pcic_setup(struct pci_controller *channel,
202 PCI_COMMAND_PARITY | PCI_COMMAND_SERR; 197 PCI_COMMAND_PARITY | PCI_COMMAND_SERR;
203 local_irq_restore(flags); 198 local_irq_restore(flags);
204} 199}
200
201static irqreturn_t tx3927_pcierr_interrupt(int irq, void *dev_id)
202{
203 struct pt_regs *regs = get_irq_regs();
204
205 if (txx9_pci_err_action != TXX9_PCI_ERR_IGNORE) {
206 printk(KERN_WARNING "PCI error interrupt at 0x%08lx.\n",
207 regs->cp0_epc);
208 printk(KERN_WARNING "pcistat:%02x, lbstat:%04lx\n",
209 tx3927_pcicptr->pcistat, tx3927_pcicptr->lbstat);
210 }
211 if (txx9_pci_err_action != TXX9_PCI_ERR_PANIC) {
212 /* clear all pci errors */
213 tx3927_pcicptr->pcistat |= TX3927_PCIC_PCISTATIM_ALL;
214 tx3927_pcicptr->istat = TX3927_PCIC_IIM_ALL;
215 tx3927_pcicptr->tstat = TX3927_PCIC_TIM_ALL;
216 tx3927_pcicptr->lbstat = TX3927_PCIC_LBIM_ALL;
217 return IRQ_HANDLED;
218 }
219 console_verbose();
220 panic("PCI error.");
221}
222
223void __init tx3927_setup_pcierr_irq(void)
224{
225 if (request_irq(TXX9_IRQ_BASE + TX3927_IR_PCI,
226 tx3927_pcierr_interrupt,
227 IRQF_DISABLED, "PCI error",
228 (void *)TX3927_PCIC_REG))
229 printk(KERN_WARNING "Failed to request irq for PCIERR\n");
230}
diff --git a/arch/mips/pci/ops-tx4927.c b/arch/mips/pci/ops-tx4927.c
index c6b49bccd274..5989e747527f 100644
--- a/arch/mips/pci/ops-tx4927.c
+++ b/arch/mips/pci/ops-tx4927.c
@@ -16,6 +16,8 @@
16 * option) any later version. 16 * option) any later version.
17 */ 17 */
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/interrupt.h>
20#include <asm/txx9/pci.h>
19#include <asm/txx9/tx4927pcic.h> 21#include <asm/txx9/tx4927pcic.h>
20 22
21static struct { 23static struct {
@@ -85,6 +87,8 @@ static int check_abort(struct tx4927_pcic_reg __iomem *pcicptr)
85 __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff) 87 __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff)
86 | (PCI_STATUS_REC_MASTER_ABORT << 16), 88 | (PCI_STATUS_REC_MASTER_ABORT << 16),
87 &pcicptr->pcistatus); 89 &pcicptr->pcistatus);
90 /* flush write buffer */
91 iob();
88 code = PCIBIOS_DEVICE_NOT_FOUND; 92 code = PCIBIOS_DEVICE_NOT_FOUND;
89 } 93 }
90 return code; 94 return code;
@@ -192,6 +196,28 @@ static struct {
192 .gbwc = 0xfe0, /* 4064 GBUSCLK for CCFG.GTOT=0b11 */ 196 .gbwc = 0xfe0, /* 4064 GBUSCLK for CCFG.GTOT=0b11 */
193}; 197};
194 198
199char *__devinit tx4927_pcibios_setup(char *str)
200{
201 unsigned long val;
202
203 if (!strncmp(str, "trdyto=", 7)) {
204 if (strict_strtoul(str + 7, 0, &val) == 0)
205 tx4927_pci_opts.trdyto = val;
206 return NULL;
207 }
208 if (!strncmp(str, "retryto=", 8)) {
209 if (strict_strtoul(str + 8, 0, &val) == 0)
210 tx4927_pci_opts.retryto = val;
211 return NULL;
212 }
213 if (!strncmp(str, "gbwc=", 5)) {
214 if (strict_strtoul(str + 5, 0, &val) == 0)
215 tx4927_pci_opts.gbwc = val;
216 return NULL;
217 }
218 return str;
219}
220
195void __init tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr, 221void __init tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr,
196 struct pci_controller *channel, int extarb) 222 struct pci_controller *channel, int extarb)
197{ 223{
@@ -406,3 +432,95 @@ void tx4927_report_pcic_status(void)
406 tx4927_report_pcic_status1(pcicptrs[i].pcicptr); 432 tx4927_report_pcic_status1(pcicptrs[i].pcicptr);
407 } 433 }
408} 434}
435
436static void tx4927_dump_pcic_settings1(struct tx4927_pcic_reg __iomem *pcicptr)
437{
438 int i;
439 __u32 __iomem *preg = (__u32 __iomem *)pcicptr;
440
441 printk(KERN_INFO "tx4927 pcic (0x%p) settings:", pcicptr);
442 for (i = 0; i < sizeof(struct tx4927_pcic_reg); i += 4, preg++) {
443 if (i % 32 == 0) {
444 printk(KERN_CONT "\n");
445 printk(KERN_INFO "%04x:", i);
446 }
447 /* skip registers with side-effects */
448 if (i == offsetof(struct tx4927_pcic_reg, g2pintack)
449 || i == offsetof(struct tx4927_pcic_reg, g2pspc)
450 || i == offsetof(struct tx4927_pcic_reg, g2pcfgadrs)
451 || i == offsetof(struct tx4927_pcic_reg, g2pcfgdata)) {
452 printk(KERN_CONT " XXXXXXXX");
453 continue;
454 }
455 printk(KERN_CONT " %08x", __raw_readl(preg));
456 }
457 printk(KERN_CONT "\n");
458}
459
460void tx4927_dump_pcic_settings(void)
461{
462 int i;
463
464 for (i = 0; i < ARRAY_SIZE(pcicptrs); i++) {
465 if (pcicptrs[i].pcicptr)
466 tx4927_dump_pcic_settings1(pcicptrs[i].pcicptr);
467 }
468}
469
470irqreturn_t tx4927_pcierr_interrupt(int irq, void *dev_id)
471{
472 struct pt_regs *regs = get_irq_regs();
473 struct tx4927_pcic_reg __iomem *pcicptr =
474 (struct tx4927_pcic_reg __iomem *)(unsigned long)dev_id;
475
476 if (txx9_pci_err_action != TXX9_PCI_ERR_IGNORE) {
477 printk(KERN_WARNING "PCIERR interrupt at 0x%0*lx\n",
478 (int)(2 * sizeof(unsigned long)), regs->cp0_epc);
479 tx4927_report_pcic_status1(pcicptr);
480 }
481 if (txx9_pci_err_action != TXX9_PCI_ERR_PANIC) {
482 /* clear all pci errors */
483 __raw_writel((__raw_readl(&pcicptr->pcistatus) & 0x0000ffff)
484 | (TX4927_PCIC_PCISTATUS_ALL << 16),
485 &pcicptr->pcistatus);
486 __raw_writel(TX4927_PCIC_G2PSTATUS_ALL, &pcicptr->g2pstatus);
487 __raw_writel(TX4927_PCIC_PBASTATUS_ALL, &pcicptr->pbastatus);
488 __raw_writel(TX4927_PCIC_PCICSTATUS_ALL, &pcicptr->pcicstatus);
489 return IRQ_HANDLED;
490 }
491 console_verbose();
492 tx4927_dump_pcic_settings1(pcicptr);
493 panic("PCI error.");
494}
495
496#ifdef CONFIG_TOSHIBA_FPCIB0
497static void __init tx4927_quirk_slc90e66_bridge(struct pci_dev *dev)
498{
499 struct tx4927_pcic_reg __iomem *pcicptr = pci_bus_to_pcicptr(dev->bus);
500
501 if (!pcicptr)
502 return;
503 if (__raw_readl(&pcicptr->pbacfg) & TX4927_PCIC_PBACFG_PBAEN) {
504 /* Reset Bus Arbiter */
505 __raw_writel(TX4927_PCIC_PBACFG_RPBA, &pcicptr->pbacfg);
506 /*
507 * swap reqBP and reqXP (raise priority of SLC90E66).
508 * SLC90E66(PCI-ISA bridge) is connected to REQ2 on
509 * PCI Backplane board.
510 */
511 __raw_writel(0x72543610, &pcicptr->pbareqport);
512 __raw_writel(0, &pcicptr->pbabm);
513 /* Use Fixed ParkMaster (required by SLC90E66) */
514 __raw_writel(TX4927_PCIC_PBACFG_FIXPA, &pcicptr->pbacfg);
515 /* Enable Bus Arbiter */
516 __raw_writel(TX4927_PCIC_PBACFG_FIXPA |
517 TX4927_PCIC_PBACFG_PBAEN,
518 &pcicptr->pbacfg);
519 printk(KERN_INFO "PCI: Use Fixed Park Master (REQPORT %08x)\n",
520 __raw_readl(&pcicptr->pbareqport));
521 }
522}
523#define PCI_DEVICE_ID_EFAR_SLC90E66_0 0x9460
524DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_SLC90E66_0,
525 tx4927_quirk_slc90e66_bridge);
526#endif
diff --git a/arch/mips/pci/pci-tx4927.c b/arch/mips/pci/pci-tx4927.c
index 27e86a09dd41..aaa900596792 100644
--- a/arch/mips/pci/pci-tx4927.c
+++ b/arch/mips/pci/pci-tx4927.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/interrupt.h>
18#include <asm/txx9/generic.h> 19#include <asm/txx9/generic.h>
19#include <asm/txx9/tx4927.h> 20#include <asm/txx9/tx4927.h>
20 21
@@ -81,3 +82,12 @@ int __init tx4927_pciclk66_setup(void)
81 pciclk = -1; 82 pciclk = -1;
82 return pciclk; 83 return pciclk;
83} 84}
85
86void __init tx4927_setup_pcierr_irq(void)
87{
88 if (request_irq(TXX9_IRQ_BASE + TX4927_IR_PCIERR,
89 tx4927_pcierr_interrupt,
90 IRQF_DISABLED, "PCI error",
91 (void *)TX4927_PCIC_REG))
92 printk(KERN_WARNING "Failed to request irq for PCIERR\n");
93}
diff --git a/arch/mips/pci/pci-tx4938.c b/arch/mips/pci/pci-tx4938.c
index e5375511c2b7..60e2c52c2c5e 100644
--- a/arch/mips/pci/pci-tx4938.c
+++ b/arch/mips/pci/pci-tx4938.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/interrupt.h>
18#include <asm/txx9/generic.h> 19#include <asm/txx9/generic.h>
19#include <asm/txx9/tx4938.h> 20#include <asm/txx9/tx4938.h>
20 21
@@ -132,3 +133,12 @@ int tx4938_pcic1_map_irq(const struct pci_dev *dev, u8 slot)
132 } 133 }
133 return -1; 134 return -1;
134} 135}
136
137void __init tx4938_setup_pcierr_irq(void)
138{
139 if (request_irq(TXX9_IRQ_BASE + TX4938_IR_PCIERR,
140 tx4927_pcierr_interrupt,
141 IRQF_DISABLED, "PCI error",
142 (void *)TX4927_PCIC_REG))
143 printk(KERN_WARNING "Failed to request irq for PCIERR\n");
144}
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 77bd5b68dc43..c7fe6ec621e6 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -328,7 +328,11 @@ EXPORT_SYMBOL(PCIBIOS_MIN_IO);
328EXPORT_SYMBOL(PCIBIOS_MIN_MEM); 328EXPORT_SYMBOL(PCIBIOS_MIN_MEM);
329#endif 329#endif
330 330
331char *pcibios_setup(char *str) 331char * (*pcibios_plat_setup)(char *str) __devinitdata;
332
333char *__devinit pcibios_setup(char *str)
332{ 334{
335 if (pcibios_plat_setup)
336 return pcibios_plat_setup(str);
333 return str; 337 return str;
334} 338}
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_serial.c b/arch/mips/pmc-sierra/msp71xx/msp_serial.c
index 9de34302e5f4..f7261628d8a6 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_serial.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_serial.c
@@ -38,68 +38,6 @@
38#include <msp_int.h> 38#include <msp_int.h>
39#include <msp_regs.h> 39#include <msp_regs.h>
40 40
41#ifdef CONFIG_KGDB
42/*
43 * kgdb uses serial port 1 so the console can remain on port 0.
44 * To use port 0 change the definition to read as follows:
45 * #define DEBUG_PORT_BASE KSEG1ADDR(MSP_UART0_BASE)
46 */
47#define DEBUG_PORT_BASE KSEG1ADDR(MSP_UART1_BASE)
48
49int putDebugChar(char c)
50{
51 volatile uint32_t *uart = (volatile uint32_t *)DEBUG_PORT_BASE;
52 uint32_t val = (uint32_t)c;
53
54 local_irq_disable();
55 while( !(uart[5] & 0x20) ); /* Wait for TXRDY */
56 uart[0] = val;
57 while( !(uart[5] & 0x20) ); /* Wait for TXRDY */
58 local_irq_enable();
59
60 return 1;
61}
62
63char getDebugChar(void)
64{
65 volatile uint32_t *uart = (volatile uint32_t *)DEBUG_PORT_BASE;
66 uint32_t val;
67
68 while( !(uart[5] & 0x01) ); /* Wait for RXRDY */
69 val = uart[0];
70
71 return (char)val;
72}
73
74void initDebugPort(unsigned int uartclk, unsigned int baudrate)
75{
76 unsigned int baud_divisor = (uartclk + 8 * baudrate)/(16 * baudrate);
77
78 /* Enable FIFOs */
79 writeb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |
80 UART_FCR_CLEAR_XMIT | UART_FCR_TRIGGER_4,
81 (char *)DEBUG_PORT_BASE + (UART_FCR * 4));
82
83 /* Select brtc divisor */
84 writeb(UART_LCR_DLAB, (char *)DEBUG_PORT_BASE + (UART_LCR * 4));
85
86 /* Store divisor lsb */
87 writeb(baud_divisor, (char *)DEBUG_PORT_BASE + (UART_TX * 4));
88
89 /* Store divisor msb */
90 writeb(baud_divisor >> 8, (char *)DEBUG_PORT_BASE + (UART_IER * 4));
91
92 /* Set 8N1 mode */
93 writeb(UART_LCR_WLEN8, (char *)DEBUG_PORT_BASE + (UART_LCR * 4));
94
95 /* Disable flow control */
96 writeb(0, (char *)DEBUG_PORT_BASE + (UART_MCR * 4));
97
98 /* Disable receive interrupt(!) */
99 writeb(0, (char *)DEBUG_PORT_BASE + (UART_IER * 4));
100}
101#endif
102
103void __init msp_serial_setup(void) 41void __init msp_serial_setup(void)
104{ 42{
105 char *s; 43 char *s;
@@ -139,17 +77,6 @@ void __init msp_serial_setup(void)
139 case MACH_MSP7120_FPGA: 77 case MACH_MSP7120_FPGA:
140 /* Enable UART1 on MSP4200 and MSP7120 */ 78 /* Enable UART1 on MSP4200 and MSP7120 */
141 *GPIO_CFG2_REG = 0x00002299; 79 *GPIO_CFG2_REG = 0x00002299;
142
143#ifdef CONFIG_KGDB
144 /* Initialize UART1 for kgdb since PMON doesn't */
145 if( DEBUG_PORT_BASE == KSEG1ADDR(MSP_UART1_BASE) ) {
146 if( mips_machtype == MACH_MSP4200_FPGA
147 || mips_machtype == MACH_MSP7120_FPGA )
148 initDebugPort(uartclk, 19200);
149 else
150 initDebugPort(uartclk, 57600);
151 }
152#endif
153 break; 80 break;
154 81
155 default: 82 default:
diff --git a/arch/mips/pmc-sierra/yosemite/Makefile b/arch/mips/pmc-sierra/yosemite/Makefile
index 8fd9a04e3534..b16f95c3df65 100644
--- a/arch/mips/pmc-sierra/yosemite/Makefile
+++ b/arch/mips/pmc-sierra/yosemite/Makefile
@@ -4,7 +4,6 @@
4 4
5obj-y += irq.o prom.o py-console.o setup.o 5obj-y += irq.o prom.o py-console.o setup.o
6 6
7obj-$(CONFIG_KGDB) += dbg_io.o
8obj-$(CONFIG_SMP) += smp.o 7obj-$(CONFIG_SMP) += smp.o
9 8
10EXTRA_CFLAGS += -Werror 9EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/pmc-sierra/yosemite/dbg_io.c b/arch/mips/pmc-sierra/yosemite/dbg_io.c
deleted file mode 100644
index 6362c702e389..000000000000
--- a/arch/mips/pmc-sierra/yosemite/dbg_io.c
+++ /dev/null
@@ -1,180 +0,0 @@
1/*
2 * Copyright 2003 PMC-Sierra
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
11 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
13 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
15 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
16 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
17 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26/*
27 * Support for KGDB for the Yosemite board. We make use of single serial
28 * port to be used for KGDB as well as console. The second serial port
29 * seems to be having a problem. Single IRQ is allocated for both the
30 * ports. Hence, the interrupt routing code needs to figure out whether
31 * the interrupt came from channel A or B.
32 */
33
34#include <asm/serial.h>
35
36/*
37 * Baud rate, Parity, Data and Stop bit settings for the
38 * serial port on the Yosemite. Note that the Early printk
39 * patch has been added. So, we should be all set to go
40 */
41#define YOSEMITE_BAUD_2400 2400
42#define YOSEMITE_BAUD_4800 4800
43#define YOSEMITE_BAUD_9600 9600
44#define YOSEMITE_BAUD_19200 19200
45#define YOSEMITE_BAUD_38400 38400
46#define YOSEMITE_BAUD_57600 57600
47#define YOSEMITE_BAUD_115200 115200
48
49#define YOSEMITE_PARITY_NONE 0
50#define YOSEMITE_PARITY_ODD 0x08
51#define YOSEMITE_PARITY_EVEN 0x18
52#define YOSEMITE_PARITY_MARK 0x28
53#define YOSEMITE_PARITY_SPACE 0x38
54
55#define YOSEMITE_DATA_5BIT 0x0
56#define YOSEMITE_DATA_6BIT 0x1
57#define YOSEMITE_DATA_7BIT 0x2
58#define YOSEMITE_DATA_8BIT 0x3
59
60#define YOSEMITE_STOP_1BIT 0x0
61#define YOSEMITE_STOP_2BIT 0x4
62
63/* This is crucial */
64#define SERIAL_REG_OFS 0x1
65
66#define SERIAL_RCV_BUFFER 0x0
67#define SERIAL_TRANS_HOLD 0x0
68#define SERIAL_SEND_BUFFER 0x0
69#define SERIAL_INTR_ENABLE (1 * SERIAL_REG_OFS)
70#define SERIAL_INTR_ID (2 * SERIAL_REG_OFS)
71#define SERIAL_DATA_FORMAT (3 * SERIAL_REG_OFS)
72#define SERIAL_LINE_CONTROL (3 * SERIAL_REG_OFS)
73#define SERIAL_MODEM_CONTROL (4 * SERIAL_REG_OFS)
74#define SERIAL_RS232_OUTPUT (4 * SERIAL_REG_OFS)
75#define SERIAL_LINE_STATUS (5 * SERIAL_REG_OFS)
76#define SERIAL_MODEM_STATUS (6 * SERIAL_REG_OFS)
77#define SERIAL_RS232_INPUT (6 * SERIAL_REG_OFS)
78#define SERIAL_SCRATCH_PAD (7 * SERIAL_REG_OFS)
79
80#define SERIAL_DIVISOR_LSB (0 * SERIAL_REG_OFS)
81#define SERIAL_DIVISOR_MSB (1 * SERIAL_REG_OFS)
82
83/*
84 * Functions to READ and WRITE to serial port 0
85 */
86#define SERIAL_READ(ofs) (*((volatile unsigned char*) \
87 (TITAN_SERIAL_BASE + ofs)))
88
89#define SERIAL_WRITE(ofs, val) ((*((volatile unsigned char*) \
90 (TITAN_SERIAL_BASE + ofs))) = val)
91
92/*
93 * Functions to READ and WRITE to serial port 1
94 */
95#define SERIAL_READ_1(ofs) (*((volatile unsigned char*) \
96 (TITAN_SERIAL_BASE_1 + ofs)))
97
98#define SERIAL_WRITE_1(ofs, val) ((*((volatile unsigned char*) \
99 (TITAN_SERIAL_BASE_1 + ofs))) = val)
100
101/*
102 * Second serial port initialization
103 */
104void init_second_port(void)
105{
106 /* Disable Interrupts */
107 SERIAL_WRITE_1(SERIAL_LINE_CONTROL, 0x0);
108 SERIAL_WRITE_1(SERIAL_INTR_ENABLE, 0x0);
109
110 {
111 unsigned int divisor;
112
113 SERIAL_WRITE_1(SERIAL_LINE_CONTROL, 0x80);
114 divisor = TITAN_SERIAL_BASE_BAUD / YOSEMITE_BAUD_115200;
115 SERIAL_WRITE_1(SERIAL_DIVISOR_LSB, divisor & 0xff);
116
117 SERIAL_WRITE_1(SERIAL_DIVISOR_MSB,
118 (divisor & 0xff00) >> 8);
119 SERIAL_WRITE_1(SERIAL_LINE_CONTROL, 0x0);
120 }
121
122 SERIAL_WRITE_1(SERIAL_DATA_FORMAT, YOSEMITE_DATA_8BIT |
123 YOSEMITE_PARITY_NONE | YOSEMITE_STOP_1BIT);
124
125 /* Enable Interrupts */
126 SERIAL_WRITE_1(SERIAL_INTR_ENABLE, 0xf);
127}
128
129/* Initialize the serial port for KGDB debugging */
130void debugInit(unsigned int baud, unsigned char data, unsigned char parity,
131 unsigned char stop)
132{
133 /* Disable Interrupts */
134 SERIAL_WRITE(SERIAL_LINE_CONTROL, 0x0);
135 SERIAL_WRITE(SERIAL_INTR_ENABLE, 0x0);
136
137 {
138 unsigned int divisor;
139
140 SERIAL_WRITE(SERIAL_LINE_CONTROL, 0x80);
141
142 divisor = TITAN_SERIAL_BASE_BAUD / baud;
143 SERIAL_WRITE(SERIAL_DIVISOR_LSB, divisor & 0xff);
144
145 SERIAL_WRITE(SERIAL_DIVISOR_MSB, (divisor & 0xff00) >> 8);
146 SERIAL_WRITE(SERIAL_LINE_CONTROL, 0x0);
147 }
148
149 SERIAL_WRITE(SERIAL_DATA_FORMAT, data | parity | stop);
150}
151
152static int remoteDebugInitialized = 0;
153
154unsigned char getDebugChar(void)
155{
156 if (!remoteDebugInitialized) {
157 remoteDebugInitialized = 1;
158 debugInit(YOSEMITE_BAUD_115200,
159 YOSEMITE_DATA_8BIT,
160 YOSEMITE_PARITY_NONE, YOSEMITE_STOP_1BIT);
161 }
162
163 while ((SERIAL_READ(SERIAL_LINE_STATUS) & 0x1) == 0);
164 return SERIAL_READ(SERIAL_RCV_BUFFER);
165}
166
167int putDebugChar(unsigned char byte)
168{
169 if (!remoteDebugInitialized) {
170 remoteDebugInitialized = 1;
171 debugInit(YOSEMITE_BAUD_115200,
172 YOSEMITE_DATA_8BIT,
173 YOSEMITE_PARITY_NONE, YOSEMITE_STOP_1BIT);
174 }
175
176 while ((SERIAL_READ(SERIAL_LINE_STATUS) & 0x20) == 0);
177 SERIAL_WRITE(SERIAL_SEND_BUFFER, byte);
178
179 return 1;
180}
diff --git a/arch/mips/pmc-sierra/yosemite/irq.c b/arch/mips/pmc-sierra/yosemite/irq.c
index 4decc2807867..5f673eba142c 100644
--- a/arch/mips/pmc-sierra/yosemite/irq.c
+++ b/arch/mips/pmc-sierra/yosemite/irq.c
@@ -141,10 +141,6 @@ asmlinkage void plat_irq_dispatch(void)
141 } 141 }
142} 142}
143 143
144#ifdef CONFIG_KGDB
145extern void init_second_port(void);
146#endif
147
148/* 144/*
149 * Initialize the next level interrupt handler 145 * Initialize the next level interrupt handler
150 */ 146 */
@@ -156,11 +152,6 @@ void __init arch_init_irq(void)
156 rm7k_cpu_irq_init(); 152 rm7k_cpu_irq_init();
157 rm9k_cpu_irq_init(); 153 rm9k_cpu_irq_init();
158 154
159#ifdef CONFIG_KGDB
160 /* At this point, initialize the second serial port */
161 init_second_port();
162#endif
163
164#ifdef CONFIG_GDB_CONSOLE 155#ifdef CONFIG_GDB_CONSOLE
165 register_gdb_console(); 156 register_gdb_console();
166#endif 157#endif
diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
index b2fe82dba0a5..00a1c7877bf4 100644
--- a/arch/mips/rb532/gpio.c
+++ b/arch/mips/rb532/gpio.c
@@ -64,7 +64,8 @@ static struct resource rb532_dev3_ctl_res[] = {
64 64
65void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val) 65void set_434_reg(unsigned reg_offs, unsigned bit, unsigned len, unsigned val)
66{ 66{
67 unsigned flags, data; 67 unsigned long flags;
68 unsigned data;
68 unsigned i = 0; 69 unsigned i = 0;
69 70
70 spin_lock_irqsave(&dev3.lock, flags); 71 spin_lock_irqsave(&dev3.lock, flags);
@@ -90,7 +91,7 @@ EXPORT_SYMBOL(get_434_reg);
90 91
91void set_latch_u5(unsigned char or_mask, unsigned char nand_mask) 92void set_latch_u5(unsigned char or_mask, unsigned char nand_mask)
92{ 93{
93 unsigned flags; 94 unsigned long flags;
94 95
95 spin_lock_irqsave(&dev3.lock, flags); 96 spin_lock_irqsave(&dev3.lock, flags);
96 97
diff --git a/arch/mips/rb532/time.c b/arch/mips/rb532/time.c
index db74edf8cefb..8e7a46855b50 100644
--- a/arch/mips/rb532/time.c
+++ b/arch/mips/rb532/time.c
@@ -49,8 +49,8 @@ static unsigned long __init cal_r4koff(void)
49 49
50void __init plat_time_init(void) 50void __init plat_time_init(void)
51{ 51{
52 unsigned int est_freq, flags; 52 unsigned int est_freq;
53 unsigned long r4k_offset; 53 unsigned long flags, r4k_offset;
54 54
55 local_irq_save(flags); 55 local_irq_save(flags);
56 56
diff --git a/arch/mips/sgi-ip22/ip22-setup.c b/arch/mips/sgi-ip22/ip22-setup.c
index 5f389ee26fca..896a1ef84829 100644
--- a/arch/mips/sgi-ip22/ip22-setup.c
+++ b/arch/mips/sgi-ip22/ip22-setup.c
@@ -20,7 +20,6 @@
20#include <asm/irq.h> 20#include <asm/irq.h>
21#include <asm/reboot.h> 21#include <asm/reboot.h>
22#include <asm/time.h> 22#include <asm/time.h>
23#include <asm/gdb-stub.h>
24#include <asm/io.h> 23#include <asm/io.h>
25#include <asm/traps.h> 24#include <asm/traps.h>
26#include <asm/sgialib.h> 25#include <asm/sgialib.h>
@@ -81,30 +80,6 @@ void __init plat_mem_setup(void)
81 add_preferred_console("arc", 0, NULL); 80 add_preferred_console("arc", 0, NULL);
82 } 81 }
83 82
84#ifdef CONFIG_KGDB
85 {
86 char *kgdb_ttyd = prom_getcmdline();
87
88 if ((kgdb_ttyd = strstr(kgdb_ttyd, "kgdb=ttyd")) != NULL) {
89 int line;
90 kgdb_ttyd += strlen("kgdb=ttyd");
91 if (*kgdb_ttyd != '1' && *kgdb_ttyd != '2')
92 printk(KERN_INFO "KGDB: Uknown serial line /dev/ttyd%c"
93 ", falling back to /dev/ttyd1\n", *kgdb_ttyd);
94 line = *kgdb_ttyd == '2' ? 0 : 1;
95 printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
96 "session\n", line ? 1 : 2);
97 rs_kgdb_hook(line);
98
99 printk(KERN_INFO "KGDB: Using serial line /dev/ttyd%d for "
100 "session, please connect your debugger\n", line ? 1:2);
101
102 kgdb_enabled = 1;
103 /* Breakpoints and stuff are in sgi_irq_setup() */
104 }
105 }
106#endif
107
108#if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE) 83#if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
109 { 84 {
110 ULONG *gfxinfo; 85 ULONG *gfxinfo;
diff --git a/arch/mips/sgi-ip27/Makefile b/arch/mips/sgi-ip27/Makefile
index e0a6871d56e4..31f4931b8484 100644
--- a/arch/mips/sgi-ip27/Makefile
+++ b/arch/mips/sgi-ip27/Makefile
@@ -7,7 +7,6 @@ obj-y := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o ip27-klnuma.o \
7 ip27-xtalk.o 7 ip27-xtalk.o
8 8
9obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o 9obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o
10obj-$(CONFIG_KGDB) += ip27-dbgio.o
11obj-$(CONFIG_SMP) += ip27-smp.o 10obj-$(CONFIG_SMP) += ip27-smp.o
12 11
13EXTRA_CFLAGS += -Werror 12EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sgi-ip27/ip27-dbgio.c b/arch/mips/sgi-ip27/ip27-dbgio.c
deleted file mode 100644
index 08fd88b36f80..000000000000
--- a/arch/mips/sgi-ip27/ip27-dbgio.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
7 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
8 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
10 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
11 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
12 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
13 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
14 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
15 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
16 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * Copyright 2004 Ralf Baechle <ralf@linux-mips.org>
23 */
24#include <asm/sn/addrs.h>
25#include <asm/sn/sn0/hub.h>
26#include <asm/sn/klconfig.h>
27#include <asm/sn/ioc3.h>
28#include <asm/sn/sn_private.h>
29
30#include <linux/serial.h>
31#include <linux/serial_core.h>
32#include <linux/serial_reg.h>
33
34#define IOC3_CLK (22000000 / 3)
35#define IOC3_FLAGS (0)
36
37static inline struct ioc3_uartregs *console_uart(void)
38{
39 struct ioc3 *ioc3;
40
41 ioc3 = (struct ioc3 *)KL_CONFIG_CH_CONS_INFO(get_nasid())->memory_base;
42
43 return &ioc3->sregs.uarta;
44}
45
46unsigned char getDebugChar(void)
47{
48 struct ioc3_uartregs *uart = console_uart();
49
50 while ((uart->iu_lsr & UART_LSR_DR) == 0);
51 return uart->iu_rbr;
52}
53
54void putDebugChar(unsigned char c)
55{
56 struct ioc3_uartregs *uart = console_uart();
57
58 while ((uart->iu_lsr & UART_LSR_THRE) == 0);
59 uart->iu_thr = c;
60}
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index db372a0f106d..a35818ed4263 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -57,30 +57,6 @@ static void bcm1480_set_affinity(unsigned int irq, cpumask_t mask);
57extern unsigned long ht_eoi_space; 57extern unsigned long ht_eoi_space;
58#endif 58#endif
59 59
60#ifdef CONFIG_KGDB
61#include <asm/gdb-stub.h>
62extern void breakpoint(void);
63static int kgdb_irq;
64#ifdef CONFIG_GDB_CONSOLE
65extern void register_gdb_console(void);
66#endif
67
68/* kgdb is on when configured. Pass "nokgdb" kernel arg to turn it off */
69static int kgdb_flag = 1;
70static int __init nokgdb(char *str)
71{
72 kgdb_flag = 0;
73 return 1;
74}
75__setup("nokgdb", nokgdb);
76
77/* Default to UART1 */
78int kgdb_port = 1;
79#ifdef CONFIG_SERIAL_SB1250_DUART
80extern char sb1250_duart_present[];
81#endif
82#endif
83
84static struct irq_chip bcm1480_irq_type = { 60static struct irq_chip bcm1480_irq_type = {
85 .name = "BCM1480-IMR", 61 .name = "BCM1480-IMR",
86 .ack = ack_bcm1480_irq, 62 .ack = ack_bcm1480_irq,
@@ -355,61 +331,10 @@ void __init arch_init_irq(void)
355 * does its own management of IP7. 331 * does its own management of IP7.
356 */ 332 */
357 333
358#ifdef CONFIG_KGDB
359 imask |= STATUSF_IP6;
360#endif
361 /* Enable necessary IPs, disable the rest */ 334 /* Enable necessary IPs, disable the rest */
362 change_c0_status(ST0_IM, imask); 335 change_c0_status(ST0_IM, imask);
363
364#ifdef CONFIG_KGDB
365 if (kgdb_flag) {
366 kgdb_irq = K_BCM1480_INT_UART_0 + kgdb_port;
367
368#ifdef CONFIG_SERIAL_SB1250_DUART
369 sb1250_duart_present[kgdb_port] = 0;
370#endif
371 /* Setup uart 1 settings, mapper */
372 /* QQQ FIXME */
373 __raw_writeq(M_DUART_IMR_BRK, IOADDR(A_DUART_IMRREG(kgdb_port)));
374
375 __raw_writeq(IMR_IP6_VAL,
376 IOADDR(A_BCM1480_IMR_REGISTER(0, R_BCM1480_IMR_INTERRUPT_MAP_BASE_H) +
377 (kgdb_irq << 3)));
378 bcm1480_unmask_irq(0, kgdb_irq);
379
380#ifdef CONFIG_GDB_CONSOLE
381 register_gdb_console();
382#endif
383 printk("Waiting for GDB on UART port %d\n", kgdb_port);
384 set_debug_traps();
385 breakpoint();
386 }
387#endif
388}
389
390#ifdef CONFIG_KGDB
391
392#include <linux/delay.h>
393
394#define duart_out(reg, val) csr_out32(val, IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
395#define duart_in(reg) csr_in32(IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
396
397static void bcm1480_kgdb_interrupt(void)
398{
399 /*
400 * Clear break-change status (allow some time for the remote
401 * host to stop the break, since we would see another
402 * interrupt on the end-of-break too)
403 */
404 kstat.irqs[smp_processor_id()][kgdb_irq]++;
405 mdelay(500);
406 duart_out(R_DUART_CMD, V_DUART_MISC_CMD_RESET_BREAK_INT |
407 M_DUART_RX_EN | M_DUART_TX_EN);
408 set_async_breakpoint(&get_irq_regs()->cp0_epc);
409} 336}
410 337
411#endif /* CONFIG_KGDB */
412
413extern void bcm1480_mailbox_interrupt(void); 338extern void bcm1480_mailbox_interrupt(void);
414 339
415static inline void dispatch_ip2(void) 340static inline void dispatch_ip2(void)
@@ -462,11 +387,6 @@ asmlinkage void plat_irq_dispatch(void)
462 bcm1480_mailbox_interrupt(); 387 bcm1480_mailbox_interrupt();
463#endif 388#endif
464 389
465#ifdef CONFIG_KGDB
466 else if (pending & CAUSEF_IP6)
467 bcm1480_kgdb_interrupt(); /* KGDB (uart 1) */
468#endif
469
470 else if (pending & CAUSEF_IP2) 390 else if (pending & CAUSEF_IP2)
471 dispatch_ip2(); 391 dispatch_ip2();
472} 392}
diff --git a/arch/mips/sibyte/cfe/setup.c b/arch/mips/sibyte/cfe/setup.c
index fd9604d5555a..3de30f79db3f 100644
--- a/arch/mips/sibyte/cfe/setup.c
+++ b/arch/mips/sibyte/cfe/setup.c
@@ -59,10 +59,6 @@ int cfe_cons_handle;
59extern unsigned long initrd_start, initrd_end; 59extern unsigned long initrd_start, initrd_end;
60#endif 60#endif
61 61
62#ifdef CONFIG_KGDB
63extern int kgdb_port;
64#endif
65
66static void __noreturn cfe_linux_exit(void *arg) 62static void __noreturn cfe_linux_exit(void *arg)
67{ 63{
68 int warm = *(int *)arg; 64 int warm = *(int *)arg;
@@ -246,9 +242,6 @@ void __init prom_init(void)
246 int argc = fw_arg0; 242 int argc = fw_arg0;
247 char **envp = (char **) fw_arg2; 243 char **envp = (char **) fw_arg2;
248 int *prom_vec = (int *) fw_arg3; 244 int *prom_vec = (int *) fw_arg3;
249#ifdef CONFIG_KGDB
250 char *arg;
251#endif
252 245
253 _machine_restart = cfe_linux_restart; 246 _machine_restart = cfe_linux_restart;
254 _machine_halt = cfe_linux_halt; 247 _machine_halt = cfe_linux_halt;
@@ -309,13 +302,6 @@ void __init prom_init(void)
309 } 302 }
310 } 303 }
311 304
312#ifdef CONFIG_KGDB
313 if ((arg = strstr(arcs_cmdline, "kgdb=duart")) != NULL)
314 kgdb_port = (arg[10] == '0') ? 0 : 1;
315 else
316 kgdb_port = 1;
317#endif
318
319#ifdef CONFIG_BLK_DEV_INITRD 305#ifdef CONFIG_BLK_DEV_INITRD
320 { 306 {
321 char *ptr; 307 char *ptr;
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index eac9065ffe0c..a5158483986e 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -57,16 +57,6 @@ static void sb1250_set_affinity(unsigned int irq, cpumask_t mask);
57extern unsigned long ldt_eoi_space; 57extern unsigned long ldt_eoi_space;
58#endif 58#endif
59 59
60#ifdef CONFIG_KGDB
61static int kgdb_irq;
62
63/* Default to UART1 */
64int kgdb_port = 1;
65#ifdef CONFIG_SERIAL_SB1250_DUART
66extern char sb1250_duart_present[];
67#endif
68#endif
69
70static struct irq_chip sb1250_irq_type = { 60static struct irq_chip sb1250_irq_type = {
71 .name = "SB1250-IMR", 61 .name = "SB1250-IMR",
72 .ack = ack_sb1250_irq, 62 .ack = ack_sb1250_irq,
@@ -313,55 +303,10 @@ void __init arch_init_irq(void)
313 * does its own management of IP7. 303 * does its own management of IP7.
314 */ 304 */
315 305
316#ifdef CONFIG_KGDB
317 imask |= STATUSF_IP6;
318#endif
319 /* Enable necessary IPs, disable the rest */ 306 /* Enable necessary IPs, disable the rest */
320 change_c0_status(ST0_IM, imask); 307 change_c0_status(ST0_IM, imask);
321
322#ifdef CONFIG_KGDB
323 if (kgdb_flag) {
324 kgdb_irq = K_INT_UART_0 + kgdb_port;
325
326#ifdef CONFIG_SERIAL_SB1250_DUART
327 sb1250_duart_present[kgdb_port] = 0;
328#endif
329 /* Setup uart 1 settings, mapper */
330 __raw_writeq(M_DUART_IMR_BRK,
331 IOADDR(A_DUART_IMRREG(kgdb_port)));
332
333 __raw_writeq(IMR_IP6_VAL,
334 IOADDR(A_IMR_REGISTER(0,
335 R_IMR_INTERRUPT_MAP_BASE) +
336 (kgdb_irq << 3)));
337 sb1250_unmask_irq(0, kgdb_irq);
338 }
339#endif
340}
341
342#ifdef CONFIG_KGDB
343
344#include <linux/delay.h>
345
346#define duart_out(reg, val) csr_out32(val, IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
347#define duart_in(reg) csr_in32(IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
348
349static void sb1250_kgdb_interrupt(void)
350{
351 /*
352 * Clear break-change status (allow some time for the remote
353 * host to stop the break, since we would see another
354 * interrupt on the end-of-break too)
355 */
356 kstat_this_cpu.irqs[kgdb_irq]++;
357 mdelay(500);
358 duart_out(R_DUART_CMD, V_DUART_MISC_CMD_RESET_BREAK_INT |
359 M_DUART_RX_EN | M_DUART_TX_EN);
360 set_async_breakpoint(&get_irq_regs()->cp0_epc);
361} 308}
362 309
363#endif /* CONFIG_KGDB */
364
365extern void sb1250_mailbox_interrupt(void); 310extern void sb1250_mailbox_interrupt(void);
366 311
367static inline void dispatch_ip2(void) 312static inline void dispatch_ip2(void)
@@ -407,11 +352,6 @@ asmlinkage void plat_irq_dispatch(void)
407 sb1250_mailbox_interrupt(); 352 sb1250_mailbox_interrupt();
408#endif 353#endif
409 354
410#ifdef CONFIG_KGDB
411 else if (pending & CAUSEF_IP6) /* KGDB (uart 1) */
412 sb1250_kgdb_interrupt();
413#endif
414
415 else if (pending & CAUSEF_IP2) 355 else if (pending & CAUSEF_IP2)
416 dispatch_ip2(); 356 dispatch_ip2();
417 else 357 else
diff --git a/arch/mips/sibyte/swarm/Makefile b/arch/mips/sibyte/swarm/Makefile
index 255d692bfa18..f18ba9201bbc 100644
--- a/arch/mips/sibyte/swarm/Makefile
+++ b/arch/mips/sibyte/swarm/Makefile
@@ -1,4 +1,3 @@
1obj-y := setup.o rtc_xicor1241.o rtc_m41t81.o 1obj-y := setup.o rtc_xicor1241.o rtc_m41t81.o
2 2
3obj-$(CONFIG_I2C_BOARDINFO) += swarm-i2c.o 3obj-$(CONFIG_I2C_BOARDINFO) += swarm-i2c.o
4obj-$(CONFIG_KGDB) += dbg_io.o
diff --git a/arch/mips/sibyte/swarm/dbg_io.c b/arch/mips/sibyte/swarm/dbg_io.c
deleted file mode 100644
index b97ae3048482..000000000000
--- a/arch/mips/sibyte/swarm/dbg_io.c
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * kgdb debug routines for SiByte boards.
3 *
4 * Copyright (C) 2001 MontaVista Software Inc.
5 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14/* -------------------- BEGINNING OF CONFIG --------------------- */
15
16#include <linux/delay.h>
17#include <asm/io.h>
18#include <asm/sibyte/sb1250.h>
19#include <asm/sibyte/sb1250_regs.h>
20#include <asm/sibyte/sb1250_uart.h>
21#include <asm/sibyte/sb1250_int.h>
22#include <asm/addrspace.h>
23
24/*
25 * We use the second serial port for kgdb traffic.
26 * 115200, 8, N, 1.
27 */
28
29#define BAUD_RATE 115200
30#define CLK_DIVISOR V_DUART_BAUD_RATE(BAUD_RATE)
31#define DATA_BITS V_DUART_BITS_PER_CHAR_8 /* or 7 */
32#define PARITY V_DUART_PARITY_MODE_NONE /* or even */
33#define STOP_BITS M_DUART_STOP_BIT_LEN_1 /* or 2 */
34
35static int duart_initialized = 0; /* 0: need to be init'ed by kgdb */
36
37/* -------------------- END OF CONFIG --------------------- */
38extern int kgdb_port;
39
40#define duart_out(reg, val) csr_out32(val, IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
41#define duart_in(reg) csr_in32(IOADDR(A_DUART_CHANREG(kgdb_port, reg)))
42
43void putDebugChar(unsigned char c);
44unsigned char getDebugChar(void);
45static void
46duart_init(int clk_divisor, int data, int parity, int stop)
47{
48 duart_out(R_DUART_MODE_REG_1, data | parity);
49 duart_out(R_DUART_MODE_REG_2, stop);
50 duart_out(R_DUART_CLK_SEL, clk_divisor);
51
52 duart_out(R_DUART_CMD, M_DUART_RX_EN | M_DUART_TX_EN); /* enable rx and tx */
53}
54
55void
56putDebugChar(unsigned char c)
57{
58 if (!duart_initialized) {
59 duart_initialized = 1;
60 duart_init(CLK_DIVISOR, DATA_BITS, PARITY, STOP_BITS);
61 }
62 while ((duart_in(R_DUART_STATUS) & M_DUART_TX_RDY) == 0);
63 duart_out(R_DUART_TX_HOLD, c);
64}
65
66unsigned char
67getDebugChar(void)
68{
69 if (!duart_initialized) {
70 duart_initialized = 1;
71 duart_init(CLK_DIVISOR, DATA_BITS, PARITY, STOP_BITS);
72 }
73 while ((duart_in(R_DUART_STATUS) & M_DUART_RX_RDY) == 0) ;
74 return duart_in(R_DUART_RX_HOLD);
75}
76
diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig
index 6de4c5aa92be..840fe757c48d 100644
--- a/arch/mips/txx9/Kconfig
+++ b/arch/mips/txx9/Kconfig
@@ -1,3 +1,27 @@
1config MACH_TX39XX
2 bool
3 select MACH_TXX9
4 select SYS_HAS_CPU_TX39XX
5
6config MACH_TX49XX
7 bool
8 select MACH_TXX9
9 select CEVT_R4K
10 select CSRC_R4K
11 select IRQ_CPU
12 select SYS_HAS_CPU_TX49XX
13 select SYS_SUPPORTS_64BIT_KERNEL
14
15config MACH_TXX9
16 bool
17 select DMA_NONCOHERENT
18 select SWAP_IO_SPACE
19 select SYS_HAS_EARLY_PRINTK
20 select SYS_SUPPORTS_32BIT_KERNEL
21 select SYS_SUPPORTS_LITTLE_ENDIAN
22 select SYS_SUPPORTS_BIG_ENDIAN
23 select GENERIC_HARDIRQS_NO__DO_IRQ
24
1config TOSHIBA_JMR3927 25config TOSHIBA_JMR3927
2 bool "Toshiba JMR-TX3927 board" 26 bool "Toshiba JMR-TX3927 board"
3 depends on MACH_TX39XX 27 depends on MACH_TX39XX
@@ -24,68 +48,37 @@ config TOSHIBA_RBTX4938
24config SOC_TX3927 48config SOC_TX3927
25 bool 49 bool
26 select CEVT_TXX9 50 select CEVT_TXX9
27 select DMA_NONCOHERENT
28 select HAS_TXX9_SERIAL 51 select HAS_TXX9_SERIAL
29 select HW_HAS_PCI 52 select HW_HAS_PCI
30 select IRQ_TXX9 53 select IRQ_TXX9
31 select SWAP_IO_SPACE
32 select SYS_HAS_CPU_TX39XX
33 select SYS_SUPPORTS_32BIT_KERNEL
34 select SYS_SUPPORTS_LITTLE_ENDIAN
35 select SYS_SUPPORTS_BIG_ENDIAN
36 select GENERIC_HARDIRQS_NO__DO_IRQ
37 select GPIO_TXX9 54 select GPIO_TXX9
38 55
39config SOC_TX4927 56config SOC_TX4927
40 bool 57 bool
41 select CEVT_R4K
42 select CSRC_R4K
43 select CEVT_TXX9 58 select CEVT_TXX9
44 select DMA_NONCOHERENT
45 select HAS_TXX9_SERIAL 59 select HAS_TXX9_SERIAL
46 select HW_HAS_PCI 60 select HW_HAS_PCI
47 select IRQ_CPU
48 select IRQ_TXX9 61 select IRQ_TXX9
49 select PCI_TX4927 62 select PCI_TX4927
50 select SWAP_IO_SPACE
51 select SYS_HAS_CPU_TX49XX
52 select SYS_SUPPORTS_32BIT_KERNEL
53 select SYS_SUPPORTS_64BIT_KERNEL
54 select SYS_SUPPORTS_LITTLE_ENDIAN
55 select SYS_SUPPORTS_BIG_ENDIAN
56 select SYS_SUPPORTS_KGDB
57 select GENERIC_HARDIRQS_NO__DO_IRQ
58 select GPIO_TXX9 63 select GPIO_TXX9
59 64
60config SOC_TX4938 65config SOC_TX4938
61 bool 66 bool
62 select CEVT_R4K
63 select CSRC_R4K
64 select CEVT_TXX9 67 select CEVT_TXX9
65 select DMA_NONCOHERENT
66 select HAS_TXX9_SERIAL 68 select HAS_TXX9_SERIAL
67 select HW_HAS_PCI 69 select HW_HAS_PCI
68 select IRQ_CPU
69 select IRQ_TXX9 70 select IRQ_TXX9
70 select PCI_TX4927 71 select PCI_TX4927
71 select SWAP_IO_SPACE
72 select SYS_HAS_CPU_TX49XX
73 select SYS_SUPPORTS_32BIT_KERNEL
74 select SYS_SUPPORTS_64BIT_KERNEL
75 select SYS_SUPPORTS_LITTLE_ENDIAN
76 select SYS_SUPPORTS_BIG_ENDIAN
77 select SYS_SUPPORTS_KGDB
78 select GENERIC_HARDIRQS_NO__DO_IRQ
79 select GPIO_TXX9 72 select GPIO_TXX9
80 73
81config TOSHIBA_FPCIB0 74config TOSHIBA_FPCIB0
82 bool "FPCIB0 Backplane Support" 75 bool "FPCIB0 Backplane Support"
83 depends on PCI && (MACH_TX39XX || MACH_TX49XX) 76 depends on PCI && MACH_TXX9
84 select I8259 77 select I8259
85 78
86config PICMG_PCI_BACKPLANE_DEFAULT 79config PICMG_PCI_BACKPLANE_DEFAULT
87 bool "Support for PICMG PCI Backplane" 80 bool "Support for PICMG PCI Backplane"
88 depends on PCI && (MACH_TX39XX || MACH_TX49XX) 81 depends on PCI && MACH_TXX9
89 default y if !TOSHIBA_FPCIB0 82 default y if !TOSHIBA_FPCIB0
90 83
91if TOSHIBA_RBTX4938 84if TOSHIBA_RBTX4938
diff --git a/arch/mips/txx9/generic/Makefile b/arch/mips/txx9/generic/Makefile
index 9c120771e65f..9bb34af26b73 100644
--- a/arch/mips/txx9/generic/Makefile
+++ b/arch/mips/txx9/generic/Makefile
@@ -4,9 +4,9 @@
4 4
5obj-y += setup.o 5obj-y += setup.o
6obj-$(CONFIG_PCI) += pci.o 6obj-$(CONFIG_PCI) += pci.o
7obj-$(CONFIG_SOC_TX3927) += setup_tx3927.o irq_tx3927.o
7obj-$(CONFIG_SOC_TX4927) += mem_tx4927.o setup_tx4927.o irq_tx4927.o 8obj-$(CONFIG_SOC_TX4927) += mem_tx4927.o setup_tx4927.o irq_tx4927.o
8obj-$(CONFIG_SOC_TX4938) += mem_tx4927.o setup_tx4938.o irq_tx4938.o 9obj-$(CONFIG_SOC_TX4938) += mem_tx4927.o setup_tx4938.o irq_tx4938.o
9obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o 10obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o
10obj-$(CONFIG_KGDB) += dbgio.o
11 11
12EXTRA_CFLAGS += -Werror 12EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/txx9/generic/dbgio.c b/arch/mips/txx9/generic/dbgio.c
deleted file mode 100644
index 33b9c672a322..000000000000
--- a/arch/mips/txx9/generic/dbgio.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * linux/arch/mips/tx4938/common/dbgio.c
3 *
4 * kgdb interface for gdb
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * Copyright 2005 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
24 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 *
31 * Support for TX4938 in 2.6 - Hiroshi DOYU <Hiroshi_DOYU@montavista.co.jp>
32 */
33
34#include <linux/types>
35
36extern u8 txx9_sio_kdbg_rd(void);
37extern int txx9_sio_kdbg_wr( u8 ch );
38
39u8 getDebugChar(void)
40{
41 return (txx9_sio_kdbg_rd());
42}
43
44int putDebugChar(u8 byte)
45{
46 return (txx9_sio_kdbg_wr(byte));
47}
48
diff --git a/arch/mips/txx9/generic/irq_tx3927.c b/arch/mips/txx9/generic/irq_tx3927.c
new file mode 100644
index 000000000000..c683f593eda2
--- /dev/null
+++ b/arch/mips/txx9/generic/irq_tx3927.c
@@ -0,0 +1,25 @@
1/*
2 * Common tx3927 irq handler
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright 2001 MontaVista Software Inc.
9 * Copyright (C) 2000-2001 Toshiba Corporation
10 */
11#include <linux/init.h>
12#include <asm/txx9irq.h>
13#include <asm/txx9/tx3927.h>
14
15void __init tx3927_irq_init(void)
16{
17 int i;
18
19 txx9_irq_init(TX3927_IRC_REG);
20 /* raise priority for timers, sio */
21 for (i = 0; i < TX3927_NR_TMR; i++)
22 txx9_irq_set_pri(TX3927_IR_TMR(i), 6);
23 for (i = 0; i < TX3927_NR_SIO; i++)
24 txx9_irq_set_pri(TX3927_IR_SIO(i), 7);
25}
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c
index 0b92d8c13208..7b637a7c0e66 100644
--- a/arch/mips/txx9/generic/pci.c
+++ b/arch/mips/txx9/generic/pci.c
@@ -386,3 +386,39 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
386{ 386{
387 return txx9_board_vec->pci_map_irq(dev, slot, pin); 387 return txx9_board_vec->pci_map_irq(dev, slot, pin);
388} 388}
389
390char * (*txx9_board_pcibios_setup)(char *str) __devinitdata;
391
392char *__devinit txx9_pcibios_setup(char *str)
393{
394 if (txx9_board_pcibios_setup && !txx9_board_pcibios_setup(str))
395 return NULL;
396 if (!strcmp(str, "picmg")) {
397 /* PICMG compliant backplane (TOSHIBA JMB-PICMG-ATX
398 (5V or 3.3V), JMB-PICMG-L2 (5V only), etc.) */
399 txx9_pci_option |= TXX9_PCI_OPT_PICMG;
400 return NULL;
401 } else if (!strcmp(str, "nopicmg")) {
402 /* non-PICMG compliant backplane (TOSHIBA
403 RBHBK4100,RBHBK4200, Interface PCM-PCM05, etc.) */
404 txx9_pci_option &= ~TXX9_PCI_OPT_PICMG;
405 return NULL;
406 } else if (!strncmp(str, "clk=", 4)) {
407 char *val = str + 4;
408 txx9_pci_option &= ~TXX9_PCI_OPT_CLK_MASK;
409 if (strcmp(val, "33") == 0)
410 txx9_pci_option |= TXX9_PCI_OPT_CLK_33;
411 else if (strcmp(val, "66") == 0)
412 txx9_pci_option |= TXX9_PCI_OPT_CLK_66;
413 else /* "auto" */
414 txx9_pci_option |= TXX9_PCI_OPT_CLK_AUTO;
415 return NULL;
416 } else if (!strncmp(str, "err=", 4)) {
417 if (!strcmp(str + 4, "panic"))
418 txx9_pci_err_action = TXX9_PCI_ERR_PANIC;
419 else if (!strcmp(str + 4, "ignore"))
420 txx9_pci_err_action = TXX9_PCI_ERR_IGNORE;
421 return NULL;
422 }
423 return str;
424}
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 8c60c78b9a9e..1bc57d0f4c5c 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -20,9 +20,13 @@
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/platform_device.h>
24#include <linux/serial_core.h>
23#include <asm/bootinfo.h> 25#include <asm/bootinfo.h>
24#include <asm/time.h> 26#include <asm/time.h>
27#include <asm/reboot.h>
25#include <asm/txx9/generic.h> 28#include <asm/txx9/generic.h>
29#include <asm/txx9/pci.h>
26#ifdef CONFIG_CPU_TX49XX 30#ifdef CONFIG_CPU_TX49XX
27#include <asm/txx9/tx4938.h> 31#include <asm/txx9/tx4938.h>
28#endif 32#endif
@@ -187,6 +191,117 @@ char * __init prom_getcmdline(void)
187 return &(arcs_cmdline[0]); 191 return &(arcs_cmdline[0]);
188} 192}
189 193
194static void __noreturn txx9_machine_halt(void)
195{
196 local_irq_disable();
197 clear_c0_status(ST0_IM);
198 while (1) {
199 if (cpu_wait) {
200 (*cpu_wait)();
201 if (cpu_has_counter) {
202 /*
203 * Clear counter interrupt while it
204 * breaks WAIT instruction even if
205 * masked.
206 */
207 write_c0_compare(0);
208 }
209 }
210 }
211}
212
213/* Watchdog support */
214void __init txx9_wdt_init(unsigned long base)
215{
216 struct resource res = {
217 .start = base,
218 .end = base + 0x100 - 1,
219 .flags = IORESOURCE_MEM,
220 };
221 platform_device_register_simple("txx9wdt", -1, &res, 1);
222}
223
224/* SPI support */
225void __init txx9_spi_init(int busid, unsigned long base, int irq)
226{
227 struct resource res[] = {
228 {
229 .start = base,
230 .end = base + 0x20 - 1,
231 .flags = IORESOURCE_MEM,
232 }, {
233 .start = irq,
234 .flags = IORESOURCE_IRQ,
235 },
236 };
237 platform_device_register_simple("spi_txx9", busid,
238 res, ARRAY_SIZE(res));
239}
240
241void __init txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr)
242{
243 struct platform_device *pdev =
244 platform_device_alloc("tc35815-mac", id);
245 if (!pdev ||
246 platform_device_add_data(pdev, ethaddr, 6) ||
247 platform_device_add(pdev))
248 platform_device_put(pdev);
249}
250
251void __init txx9_sio_init(unsigned long baseaddr, int irq,
252 unsigned int line, unsigned int sclk, int nocts)
253{
254#ifdef CONFIG_SERIAL_TXX9
255 struct uart_port req;
256
257 memset(&req, 0, sizeof(req));
258 req.line = line;
259 req.iotype = UPIO_MEM;
260 req.membase = ioremap(baseaddr, 0x24);
261 req.mapbase = baseaddr;
262 req.irq = irq;
263 if (!nocts)
264 req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
265 if (sclk) {
266 req.flags |= UPF_MAGIC_MULTIPLIER /*USE_SCLK*/;
267 req.uartclk = sclk;
268 } else
269 req.uartclk = TXX9_IMCLK;
270 early_serial_txx9_setup(&req);
271#endif /* CONFIG_SERIAL_TXX9 */
272}
273
274#ifdef CONFIG_EARLY_PRINTK
275static void __init null_prom_putchar(char c)
276{
277}
278void (*txx9_prom_putchar)(char c) __initdata = null_prom_putchar;
279
280void __init prom_putchar(char c)
281{
282 txx9_prom_putchar(c);
283}
284
285static void __iomem *early_txx9_sio_port;
286
287static void __init early_txx9_sio_putchar(char c)
288{
289#define TXX9_SICISR 0x0c
290#define TXX9_SITFIFO 0x1c
291#define TXX9_SICISR_TXALS 0x00000002
292 while (!(__raw_readl(early_txx9_sio_port + TXX9_SICISR) &
293 TXX9_SICISR_TXALS))
294 ;
295 __raw_writel(c, early_txx9_sio_port + TXX9_SITFIFO);
296}
297
298void __init txx9_sio_putchar_init(unsigned long baseaddr)
299{
300 early_txx9_sio_port = ioremap(baseaddr, 0x24);
301 txx9_prom_putchar = early_txx9_sio_putchar;
302}
303#endif /* CONFIG_EARLY_PRINTK */
304
190/* wrappers */ 305/* wrappers */
191void __init plat_mem_setup(void) 306void __init plat_mem_setup(void)
192{ 307{
@@ -194,6 +309,15 @@ void __init plat_mem_setup(void)
194 ioport_resource.end = ~0UL; /* no limit */ 309 ioport_resource.end = ~0UL; /* no limit */
195 iomem_resource.start = 0; 310 iomem_resource.start = 0;
196 iomem_resource.end = ~0UL; /* no limit */ 311 iomem_resource.end = ~0UL; /* no limit */
312
313 /* fallback restart/halt routines */
314 _machine_restart = (void (*)(char *))txx9_machine_halt;
315 _machine_halt = txx9_machine_halt;
316 pm_power_off = txx9_machine_halt;
317
318#ifdef CONFIG_PCI
319 pcibios_plat_setup = txx9_pcibios_setup;
320#endif
197 txx9_board_vec->mem_setup(); 321 txx9_board_vec->mem_setup();
198} 322}
199 323
diff --git a/arch/mips/txx9/generic/setup_tx3927.c b/arch/mips/txx9/generic/setup_tx3927.c
new file mode 100644
index 000000000000..7bd963d37fc3
--- /dev/null
+++ b/arch/mips/txx9/generic/setup_tx3927.c
@@ -0,0 +1,130 @@
1/*
2 * TX3927 setup routines
3 * Based on linux/arch/mips/txx9/jmr3927/setup.c
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Copyright (C) 2000-2001 Toshiba Corporation
7 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13#include <linux/init.h>
14#include <linux/ioport.h>
15#include <linux/delay.h>
16#include <linux/param.h>
17#include <linux/io.h>
18#include <asm/mipsregs.h>
19#include <asm/txx9irq.h>
20#include <asm/txx9tmr.h>
21#include <asm/txx9pio.h>
22#include <asm/txx9/generic.h>
23#include <asm/txx9/tx3927.h>
24
25void __init tx3927_wdt_init(void)
26{
27 txx9_wdt_init(TX3927_TMR_REG(2));
28}
29
30void __init tx3927_setup(void)
31{
32 int i;
33 unsigned int conf;
34
35 /* don't enable - see errata */
36 txx9_ccfg_toeon = 0;
37 if (strstr(prom_getcmdline(), "toeon") != NULL)
38 txx9_ccfg_toeon = 1;
39
40 txx9_reg_res_init(TX3927_REV_PCODE(), TX3927_REG_BASE,
41 TX3927_REG_SIZE);
42
43 /* SDRAMC,ROMC are configured by PROM */
44 for (i = 0; i < 8; i++) {
45 if (!(tx3927_romcptr->cr[i] & 0x8))
46 continue; /* disabled */
47 txx9_ce_res[i].start = (unsigned long)TX3927_ROMC_BA(i);
48 txx9_ce_res[i].end =
49 txx9_ce_res[i].start + TX3927_ROMC_SIZE(i) - 1;
50 request_resource(&iomem_resource, &txx9_ce_res[i]);
51 }
52
53 /* clocks */
54 txx9_gbus_clock = txx9_cpu_clock / 2;
55 /* change default value to udelay/mdelay take reasonable time */
56 loops_per_jiffy = txx9_cpu_clock / HZ / 2;
57
58 /* CCFG */
59 /* enable Timeout BusError */
60 if (txx9_ccfg_toeon)
61 tx3927_ccfgptr->ccfg |= TX3927_CCFG_TOE;
62
63 /* clear BusErrorOnWrite flag */
64 tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_BEOW;
65 if (read_c0_conf() & TX39_CONF_WBON)
66 /* Disable PCI snoop */
67 tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_PSNP;
68 else
69 /* Enable PCI SNOOP - with write through only */
70 tx3927_ccfgptr->ccfg |= TX3927_CCFG_PSNP;
71 /* do reset on watchdog */
72 tx3927_ccfgptr->ccfg |= TX3927_CCFG_WR;
73
74 printk(KERN_INFO "TX3927 -- CRIR:%08lx CCFG:%08lx PCFG:%08lx\n",
75 tx3927_ccfgptr->crir,
76 tx3927_ccfgptr->ccfg, tx3927_ccfgptr->pcfg);
77
78 /* TMR */
79 for (i = 0; i < TX3927_NR_TMR; i++)
80 txx9_tmr_init(TX3927_TMR_REG(i));
81
82 /* DMA */
83 tx3927_dmaptr->mcr = 0;
84 for (i = 0; i < ARRAY_SIZE(tx3927_dmaptr->ch); i++) {
85 /* reset channel */
86 tx3927_dmaptr->ch[i].ccr = TX3927_DMA_CCR_CHRST;
87 tx3927_dmaptr->ch[i].ccr = 0;
88 }
89 /* enable DMA */
90#ifdef __BIG_ENDIAN
91 tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN;
92#else
93 tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN | TX3927_DMA_MCR_LE;
94#endif
95
96 /* PIO */
97 __raw_writel(0, &tx3927_pioptr->maskcpu);
98 __raw_writel(0, &tx3927_pioptr->maskext);
99 txx9_gpio_init(TX3927_PIO_REG, 0, 16);
100
101 conf = read_c0_conf();
102 if (!(conf & TX39_CONF_ICE))
103 printk(KERN_INFO "TX3927 I-Cache disabled.\n");
104 if (!(conf & TX39_CONF_DCE))
105 printk(KERN_INFO "TX3927 D-Cache disabled.\n");
106 else if (!(conf & TX39_CONF_WBON))
107 printk(KERN_INFO "TX3927 D-Cache WriteThrough.\n");
108 else if (!(conf & TX39_CONF_CWFON))
109 printk(KERN_INFO "TX3927 D-Cache WriteBack.\n");
110 else
111 printk(KERN_INFO "TX3927 D-Cache WriteBack (CWF) .\n");
112}
113
114void __init tx3927_time_init(unsigned int evt_tmrnr, unsigned int src_tmrnr)
115{
116 txx9_clockevent_init(TX3927_TMR_REG(evt_tmrnr),
117 TXX9_IRQ_BASE + TX3927_IR_TMR(evt_tmrnr),
118 TXX9_IMCLK);
119 txx9_clocksource_init(TX3927_TMR_REG(src_tmrnr), TXX9_IMCLK);
120}
121
122void __init tx3927_sio_init(unsigned int sclk, unsigned int cts_mask)
123{
124 int i;
125
126 for (i = 0; i < 2; i++)
127 txx9_sio_init(TX3927_SIO_REG(i),
128 TXX9_IRQ_BASE + TX3927_IR_SIO(i),
129 i, sclk, (1 << i) & cts_mask);
130}
diff --git a/arch/mips/txx9/generic/setup_tx4927.c b/arch/mips/txx9/generic/setup_tx4927.c
index 89d6e28add93..f80d4b7a694d 100644
--- a/arch/mips/txx9/generic/setup_tx4927.c
+++ b/arch/mips/txx9/generic/setup_tx4927.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/ioport.h> 14#include <linux/ioport.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/serial_core.h>
17#include <linux/param.h> 16#include <linux/param.h>
18#include <asm/txx9irq.h> 17#include <asm/txx9irq.h>
19#include <asm/txx9tmr.h> 18#include <asm/txx9tmr.h>
@@ -21,7 +20,7 @@
21#include <asm/txx9/generic.h> 20#include <asm/txx9/generic.h>
22#include <asm/txx9/tx4927.h> 21#include <asm/txx9/tx4927.h>
23 22
24void __init tx4927_wdr_init(void) 23static void __init tx4927_wdr_init(void)
25{ 24{
26 /* clear WatchDogReset (W1C) */ 25 /* clear WatchDogReset (W1C) */
27 tx4927_ccfg_set(TX4927_CCFG_WDRST); 26 tx4927_ccfg_set(TX4927_CCFG_WDRST);
@@ -29,6 +28,11 @@ void __init tx4927_wdr_init(void)
29 tx4927_ccfg_set(TX4927_CCFG_WR); 28 tx4927_ccfg_set(TX4927_CCFG_WR);
30} 29}
31 30
31void __init tx4927_wdt_init(void)
32{
33 txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL);
34}
35
32static struct resource tx4927_sdram_resource[4]; 36static struct resource tx4927_sdram_resource[4];
33 37
34void __init tx4927_setup(void) 38void __init tx4927_setup(void)
@@ -173,22 +177,12 @@ void __init tx4927_time_init(unsigned int tmrnr)
173 TXX9_IMCLK); 177 TXX9_IMCLK);
174} 178}
175 179
176void __init tx4927_setup_serial(void) 180void __init tx4927_sio_init(unsigned int sclk, unsigned int cts_mask)
177{ 181{
178#ifdef CONFIG_SERIAL_TXX9
179 int i; 182 int i;
180 struct uart_port req; 183
181 184 for (i = 0; i < 2; i++)
182 for (i = 0; i < 2; i++) { 185 txx9_sio_init(TX4927_SIO_REG(i) & 0xfffffffffULL,
183 memset(&req, 0, sizeof(req)); 186 TXX9_IRQ_BASE + TX4927_IR_SIO(i),
184 req.line = i; 187 i, sclk, (1 << i) & cts_mask);
185 req.iotype = UPIO_MEM;
186 req.membase = (unsigned char __iomem *)TX4927_SIO_REG(i);
187 req.mapbase = TX4927_SIO_REG(i) & 0xfffffffffULL;
188 req.irq = TXX9_IRQ_BASE + TX4927_IR_SIO(i);
189 req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
190 req.uartclk = TXX9_IMCLK;
191 early_serial_txx9_setup(&req);
192 }
193#endif /* CONFIG_SERIAL_TXX9 */
194} 188}
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index 317378d8579d..f3040b9ba059 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/ioport.h> 14#include <linux/ioport.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/serial_core.h>
17#include <linux/param.h> 16#include <linux/param.h>
18#include <asm/txx9irq.h> 17#include <asm/txx9irq.h>
19#include <asm/txx9tmr.h> 18#include <asm/txx9tmr.h>
@@ -21,7 +20,7 @@
21#include <asm/txx9/generic.h> 20#include <asm/txx9/generic.h>
22#include <asm/txx9/tx4938.h> 21#include <asm/txx9/tx4938.h>
23 22
24void __init tx4938_wdr_init(void) 23static void __init tx4938_wdr_init(void)
25{ 24{
26 /* clear WatchDogReset (W1C) */ 25 /* clear WatchDogReset (W1C) */
27 tx4938_ccfg_set(TX4938_CCFG_WDRST); 26 tx4938_ccfg_set(TX4938_CCFG_WDRST);
@@ -29,6 +28,11 @@ void __init tx4938_wdr_init(void)
29 tx4938_ccfg_set(TX4938_CCFG_WR); 28 tx4938_ccfg_set(TX4938_CCFG_WR);
30} 29}
31 30
31void __init tx4938_wdt_init(void)
32{
33 txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL);
34}
35
32static struct resource tx4938_sdram_resource[4]; 36static struct resource tx4938_sdram_resource[4];
33static struct resource tx4938_sram_resource; 37static struct resource tx4938_sram_resource;
34 38
@@ -233,11 +237,9 @@ void __init tx4938_time_init(unsigned int tmrnr)
233 TXX9_IMCLK); 237 TXX9_IMCLK);
234} 238}
235 239
236void __init tx4938_setup_serial(void) 240void __init tx4938_sio_init(unsigned int sclk, unsigned int cts_mask)
237{ 241{
238#ifdef CONFIG_SERIAL_TXX9
239 int i; 242 int i;
240 struct uart_port req;
241 unsigned int ch_mask = 0; 243 unsigned int ch_mask = 0;
242 244
243 if (__raw_readq(&tx4938_ccfgptr->pcfg) & TX4938_PCFG_ETH0_SEL) 245 if (__raw_readq(&tx4938_ccfgptr->pcfg) & TX4938_PCFG_ETH0_SEL)
@@ -245,15 +247,24 @@ void __init tx4938_setup_serial(void)
245 for (i = 0; i < 2; i++) { 247 for (i = 0; i < 2; i++) {
246 if ((1 << i) & ch_mask) 248 if ((1 << i) & ch_mask)
247 continue; 249 continue;
248 memset(&req, 0, sizeof(req)); 250 txx9_sio_init(TX4938_SIO_REG(i) & 0xfffffffffULL,
249 req.line = i; 251 TXX9_IRQ_BASE + TX4938_IR_SIO(i),
250 req.iotype = UPIO_MEM; 252 i, sclk, (1 << i) & cts_mask);
251 req.membase = (unsigned char __iomem *)TX4938_SIO_REG(i);
252 req.mapbase = TX4938_SIO_REG(i) & 0xfffffffffULL;
253 req.irq = TXX9_IRQ_BASE + TX4938_IR_SIO(i);
254 req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
255 req.uartclk = TXX9_IMCLK;
256 early_serial_txx9_setup(&req);
257 } 253 }
258#endif /* CONFIG_SERIAL_TXX9 */ 254}
255
256void __init tx4938_spi_init(int busid)
257{
258 txx9_spi_init(busid, TX4938_SPI_REG & 0xfffffffffULL,
259 TXX9_IRQ_BASE + TX4938_IR_SPI);
260}
261
262void __init tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1)
263{
264 u64 pcfg = __raw_readq(&tx4938_ccfgptr->pcfg);
265
266 if (addr0 && (pcfg & TX4938_PCFG_ETH0_SEL))
267 txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH0, addr0);
268 if (addr1 && (pcfg & TX4938_PCFG_ETH1_SEL))
269 txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH1, addr1);
259} 270}
diff --git a/arch/mips/txx9/generic/smsc_fdc37m81x.c b/arch/mips/txx9/generic/smsc_fdc37m81x.c
index 69e487467fa5..a2b2d62d88e3 100644
--- a/arch/mips/txx9/generic/smsc_fdc37m81x.c
+++ b/arch/mips/txx9/generic/smsc_fdc37m81x.c
@@ -15,8 +15,6 @@
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/txx9/smsc_fdc37m81x.h> 16#include <asm/txx9/smsc_fdc37m81x.h>
17 17
18#define DEBUG
19
20/* Common Registers */ 18/* Common Registers */
21#define SMSC_FDC37M81X_CONFIG_INDEX 0x00 19#define SMSC_FDC37M81X_CONFIG_INDEX 0x00
22#define SMSC_FDC37M81X_CONFIG_DATA 0x01 20#define SMSC_FDC37M81X_CONFIG_DATA 0x01
@@ -55,7 +53,7 @@
55#define SMSC_FDC37M81X_CONFIG_EXIT 0xaa 53#define SMSC_FDC37M81X_CONFIG_EXIT 0xaa
56#define SMSC_FDC37M81X_CHIP_ID 0x4d 54#define SMSC_FDC37M81X_CHIP_ID 0x4d
57 55
58static unsigned long g_smsc_fdc37m81x_base = 0; 56static unsigned long g_smsc_fdc37m81x_base;
59 57
60static inline unsigned char smsc_fdc37m81x_rd(unsigned char index) 58static inline unsigned char smsc_fdc37m81x_rd(unsigned char index)
61{ 59{
@@ -107,7 +105,8 @@ unsigned long __init smsc_fdc37m81x_init(unsigned long port)
107 u8 chip_id; 105 u8 chip_id;
108 106
109 if (g_smsc_fdc37m81x_base) 107 if (g_smsc_fdc37m81x_base)
110 printk("smsc_fdc37m81x_init() stepping on old base=0x%0*lx\n", 108 printk(KERN_WARNING "%s: stepping on old base=0x%0*lx\n",
109 __func__,
111 field, g_smsc_fdc37m81x_base); 110 field, g_smsc_fdc37m81x_base);
112 111
113 g_smsc_fdc37m81x_base = port; 112 g_smsc_fdc37m81x_base = port;
@@ -118,7 +117,7 @@ unsigned long __init smsc_fdc37m81x_init(unsigned long port)
118 if (chip_id == SMSC_FDC37M81X_CHIP_ID) 117 if (chip_id == SMSC_FDC37M81X_CHIP_ID)
119 smsc_fdc37m81x_config_end(); 118 smsc_fdc37m81x_config_end();
120 else { 119 else {
121 printk("smsc_fdc37m81x_init() unknow chip id 0x%02x\n", 120 printk(KERN_WARNING "%s: unknow chip id 0x%02x\n", __func__,
122 chip_id); 121 chip_id);
123 g_smsc_fdc37m81x_base = 0; 122 g_smsc_fdc37m81x_base = 0;
124 } 123 }
@@ -127,22 +126,23 @@ unsigned long __init smsc_fdc37m81x_init(unsigned long port)
127} 126}
128 127
129#ifdef DEBUG 128#ifdef DEBUG
130void smsc_fdc37m81x_config_dump_one(char *key, u8 dev, u8 reg) 129static void smsc_fdc37m81x_config_dump_one(const char *key, u8 dev, u8 reg)
131{ 130{
132 printk("%s: dev=0x%02x reg=0x%02x val=0x%02x\n", key, dev, reg, 131 printk(KERN_INFO "%s: dev=0x%02x reg=0x%02x val=0x%02x\n",
132 key, dev, reg,
133 smsc_fdc37m81x_rd(reg)); 133 smsc_fdc37m81x_rd(reg));
134} 134}
135 135
136void smsc_fdc37m81x_config_dump(void) 136void smsc_fdc37m81x_config_dump(void)
137{ 137{
138 u8 orig; 138 u8 orig;
139 char *fname = "smsc_fdc37m81x_config_dump()"; 139 const char *fname = __func__;
140 140
141 smsc_fdc37m81x_config_beg(); 141 smsc_fdc37m81x_config_beg();
142 142
143 orig = smsc_fdc37m81x_rd(SMSC_FDC37M81X_DNUM); 143 orig = smsc_fdc37m81x_rd(SMSC_FDC37M81X_DNUM);
144 144
145 printk("%s: common\n", fname); 145 printk(KERN_INFO "%s: common\n", fname);
146 smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE, 146 smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE,
147 SMSC_FDC37M81X_DNUM); 147 SMSC_FDC37M81X_DNUM);
148 smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE, 148 smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE,
@@ -154,7 +154,7 @@ void smsc_fdc37m81x_config_dump(void)
154 smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE, 154 smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_NONE,
155 SMSC_FDC37M81X_PMGT); 155 SMSC_FDC37M81X_PMGT);
156 156
157 printk("%s: keyboard\n", fname); 157 printk(KERN_INFO "%s: keyboard\n", fname);
158 smsc_dc37m81x_wr(SMSC_FDC37M81X_DNUM, SMSC_FDC37M81X_KBD); 158 smsc_dc37m81x_wr(SMSC_FDC37M81X_DNUM, SMSC_FDC37M81X_KBD);
159 smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_KBD, 159 smsc_fdc37m81x_config_dump_one(fname, SMSC_FDC37M81X_KBD,
160 SMSC_FDC37M81X_ACTIVE); 160 SMSC_FDC37M81X_ACTIVE);
diff --git a/arch/mips/txx9/jmr3927/Makefile b/arch/mips/txx9/jmr3927/Makefile
index ba292c945669..20d61ac543e5 100644
--- a/arch/mips/txx9/jmr3927/Makefile
+++ b/arch/mips/txx9/jmr3927/Makefile
@@ -3,6 +3,5 @@
3# 3#
4 4
5obj-y += prom.o irq.o setup.o 5obj-y += prom.o irq.o setup.o
6obj-$(CONFIG_KGDB) += kgdb_io.o
7 6
8EXTRA_CFLAGS += -Werror 7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/txx9/jmr3927/irq.c b/arch/mips/txx9/jmr3927/irq.c
index 070c9a115e57..6ec626c9473f 100644
--- a/arch/mips/txx9/jmr3927/irq.c
+++ b/arch/mips/txx9/jmr3927/irq.c
@@ -30,15 +30,11 @@
30 * 675 Mass Ave, Cambridge, MA 02139, USA. 30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */ 31 */
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/sched.h>
34#include <linux/types.h> 33#include <linux/types.h>
35#include <linux/interrupt.h> 34#include <linux/interrupt.h>
36 35
37#include <asm/io.h> 36#include <asm/io.h>
38#include <asm/mipsregs.h> 37#include <asm/mipsregs.h>
39#include <asm/system.h>
40
41#include <asm/processor.h>
42#include <asm/txx9/generic.h> 38#include <asm/txx9/generic.h>
43#include <asm/txx9/jmr3927.h> 39#include <asm/txx9/jmr3927.h>
44 40
@@ -46,13 +42,6 @@
46#error JMR3927_IRQ_END > NR_IRQS 42#error JMR3927_IRQ_END > NR_IRQS
47#endif 43#endif
48 44
49static unsigned char irc_level[TX3927_NUM_IR] = {
50 5, 5, 5, 5, 5, 5, /* INT[5:0] */
51 7, 7, /* SIO */
52 5, 5, 5, 0, 0, /* DMA, PIO, PCI */
53 6, 6, 6 /* TMR */
54};
55
56/* 45/*
57 * CP0_STATUS is a thread's resource (saved/restored on context switch). 46 * CP0_STATUS is a thread's resource (saved/restored on context switch).
58 * So disable_irq/enable_irq MUST handle IOC/IRC registers. 47 * So disable_irq/enable_irq MUST handle IOC/IRC registers.
@@ -103,26 +92,18 @@ static int jmr3927_irq_dispatch(int pending)
103 return irq; 92 return irq;
104} 93}
105 94
106#ifdef CONFIG_PCI 95static struct irq_chip jmr3927_irq_ioc = {
107static irqreturn_t jmr3927_pcierr_interrupt(int irq, void *dev_id) 96 .name = "jmr3927_ioc",
108{ 97 .ack = mask_irq_ioc,
109 printk(KERN_WARNING "PCI error interrupt (irq 0x%x).\n", irq); 98 .mask = mask_irq_ioc,
110 printk(KERN_WARNING "pcistat:%02x, lbstat:%04lx\n", 99 .mask_ack = mask_irq_ioc,
111 tx3927_pcicptr->pcistat, tx3927_pcicptr->lbstat); 100 .unmask = unmask_irq_ioc,
112
113 return IRQ_HANDLED;
114}
115static struct irqaction pcierr_action = {
116 .handler = jmr3927_pcierr_interrupt,
117 .mask = CPU_MASK_NONE,
118 .name = "PCI error",
119}; 101};
120#endif
121
122static void __init jmr3927_irq_init(void);
123 102
124void __init jmr3927_irq_setup(void) 103void __init jmr3927_irq_setup(void)
125{ 104{
105 int i;
106
126 txx9_irq_dispatch = jmr3927_irq_dispatch; 107 txx9_irq_dispatch = jmr3927_irq_dispatch;
127 /* Now, interrupt control disabled, */ 108 /* Now, interrupt control disabled, */
128 /* all IRC interrupts are masked, */ 109 /* all IRC interrupts are masked, */
@@ -138,34 +119,10 @@ void __init jmr3927_irq_setup(void)
138 /* clear PCI Reset interrupts */ 119 /* clear PCI Reset interrupts */
139 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR); 120 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
140 121
141 jmr3927_irq_init(); 122 tx3927_irq_init();
123 for (i = JMR3927_IRQ_IOC; i < JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC; i++)
124 set_irq_chip_and_handler(i, &jmr3927_irq_ioc, handle_level_irq);
142 125
143 /* setup IOC interrupt 1 (PCI, MODEM) */ 126 /* setup IOC interrupt 1 (PCI, MODEM) */
144 set_irq_chained_handler(JMR3927_IRQ_IOCINT, handle_simple_irq); 127 set_irq_chained_handler(JMR3927_IRQ_IOCINT, handle_simple_irq);
145
146#ifdef CONFIG_PCI
147 setup_irq(JMR3927_IRQ_IRC_PCI, &pcierr_action);
148#endif
149
150 /* enable all CPU interrupt bits. */
151 set_c0_status(ST0_IM); /* IE bit is still 0. */
152}
153
154static struct irq_chip jmr3927_irq_ioc = {
155 .name = "jmr3927_ioc",
156 .ack = mask_irq_ioc,
157 .mask = mask_irq_ioc,
158 .mask_ack = mask_irq_ioc,
159 .unmask = unmask_irq_ioc,
160};
161
162static void __init jmr3927_irq_init(void)
163{
164 u32 i;
165
166 txx9_irq_init(TX3927_IRC_REG);
167 for (i = 0; i < TXx9_MAX_IR; i++)
168 txx9_irq_set_pri(i, irc_level[i]);
169 for (i = JMR3927_IRQ_IOC; i < JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC; i++)
170 set_irq_chip_and_handler(i, &jmr3927_irq_ioc, handle_level_irq);
171} 128}
diff --git a/arch/mips/txx9/jmr3927/kgdb_io.c b/arch/mips/txx9/jmr3927/kgdb_io.c
deleted file mode 100644
index 5bd757e56f79..000000000000
--- a/arch/mips/txx9/jmr3927/kgdb_io.c
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Low level uart routines to directly access a TX[34]927 SIO.
4 *
5 * Copyright 2001 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ahennessy@mvista.com or source@mvista.com
8 *
9 * Based on arch/mips/ddb5xxx/ddb5477/kgdb_io.c
10 *
11 * Copyright (C) 2000-2001 Toshiba Corporation
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
21 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */
33
34#include <asm/txx9/jmr3927.h>
35
36#define TIMEOUT 0xffffff
37
38static int remoteDebugInitialized = 0;
39static void debugInit(int baud);
40
41int putDebugChar(unsigned char c)
42{
43 int i = 0;
44
45 if (!remoteDebugInitialized) {
46 remoteDebugInitialized = 1;
47 debugInit(38400);
48 }
49
50 do {
51 slow_down();
52 i++;
53 if (i>TIMEOUT) {
54 break;
55 }
56 } while (!(tx3927_sioptr(0)->cisr & TXx927_SICISR_TXALS));
57 tx3927_sioptr(0)->tfifo = c;
58
59 return 1;
60}
61
62unsigned char getDebugChar(void)
63{
64 int i = 0;
65 int dicr;
66 char c;
67
68 if (!remoteDebugInitialized) {
69 remoteDebugInitialized = 1;
70 debugInit(38400);
71 }
72
73 /* diable RX int. */
74 dicr = tx3927_sioptr(0)->dicr;
75 tx3927_sioptr(0)->dicr = 0;
76
77 do {
78 slow_down();
79 i++;
80 if (i>TIMEOUT) {
81 break;
82 }
83 } while (tx3927_sioptr(0)->disr & TXx927_SIDISR_UVALID)
84 ;
85 c = tx3927_sioptr(0)->rfifo;
86
87 /* clear RX int. status */
88 tx3927_sioptr(0)->disr &= ~TXx927_SIDISR_RDIS;
89 /* enable RX int. */
90 tx3927_sioptr(0)->dicr = dicr;
91
92 return c;
93}
94
95static void debugInit(int baud)
96{
97 tx3927_sioptr(0)->lcr = 0x020;
98 tx3927_sioptr(0)->dicr = 0;
99 tx3927_sioptr(0)->disr = 0x4100;
100 tx3927_sioptr(0)->cisr = 0x014;
101 tx3927_sioptr(0)->fcr = 0;
102 tx3927_sioptr(0)->flcr = 0x02;
103 tx3927_sioptr(0)->bgr = ((JMR3927_BASE_BAUD + baud / 2) / baud) |
104 TXx927_SIBGR_BCLK_T0;
105}
diff --git a/arch/mips/txx9/jmr3927/prom.c b/arch/mips/txx9/jmr3927/prom.c
index 2cadb423face..70c4c8ec3e84 100644
--- a/arch/mips/txx9/jmr3927/prom.c
+++ b/arch/mips/txx9/jmr3927/prom.c
@@ -36,41 +36,18 @@
36 * 675 Mass Ave, Cambridge, MA 02139, USA. 36 * 675 Mass Ave, Cambridge, MA 02139, USA.
37 */ 37 */
38#include <linux/init.h> 38#include <linux/init.h>
39#include <linux/kernel.h>
39#include <asm/bootinfo.h> 40#include <asm/bootinfo.h>
40#include <asm/txx9/generic.h> 41#include <asm/txx9/generic.h>
41#include <asm/txx9/jmr3927.h> 42#include <asm/txx9/jmr3927.h>
42 43
43#define TIMEOUT 0xffffff
44
45void
46prom_putchar(char c)
47{
48 int i = 0;
49
50 do {
51 i++;
52 if (i>TIMEOUT)
53 break;
54 } while (!(tx3927_sioptr(1)->cisr & TXx927_SICISR_TXALS));
55 tx3927_sioptr(1)->tfifo = c;
56 return;
57}
58
59void
60puts(const char *cp)
61{
62 while (*cp)
63 prom_putchar(*cp++);
64 prom_putchar('\r');
65 prom_putchar('\n');
66}
67
68void __init jmr3927_prom_init(void) 44void __init jmr3927_prom_init(void)
69{ 45{
70 /* CCFG */ 46 /* CCFG */
71 if ((tx3927_ccfgptr->ccfg & TX3927_CCFG_TLBOFF) == 0) 47 if ((tx3927_ccfgptr->ccfg & TX3927_CCFG_TLBOFF) == 0)
72 puts("Warning: TX3927 TLB off\n"); 48 printk(KERN_ERR "TX3927 TLB off\n");
73 49
74 prom_init_cmdline(); 50 prom_init_cmdline();
75 add_memory_region(0, JMR3927_SDRAM_SIZE, BOOT_MEM_RAM); 51 add_memory_region(0, JMR3927_SDRAM_SIZE, BOOT_MEM_RAM);
52 txx9_sio_putchar_init(TX3927_SIO_REG(1));
76} 53}
diff --git a/arch/mips/txx9/jmr3927/setup.c b/arch/mips/txx9/jmr3927/setup.c
index 03647ebe4130..87db41be8a56 100644
--- a/arch/mips/txx9/jmr3927/setup.c
+++ b/arch/mips/txx9/jmr3927/setup.c
@@ -32,27 +32,18 @@
32#include <linux/types.h> 32#include <linux/types.h>
33#include <linux/ioport.h> 33#include <linux/ioport.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/pm.h>
36#include <linux/platform_device.h> 35#include <linux/platform_device.h>
37#include <linux/gpio.h> 36#include <linux/gpio.h>
38#ifdef CONFIG_SERIAL_TXX9
39#include <linux/serial_core.h>
40#endif
41#include <asm/txx9tmr.h>
42#include <asm/txx9pio.h>
43#include <asm/reboot.h> 37#include <asm/reboot.h>
38#include <asm/txx9pio.h>
44#include <asm/txx9/generic.h> 39#include <asm/txx9/generic.h>
45#include <asm/txx9/pci.h> 40#include <asm/txx9/pci.h>
46#include <asm/txx9/jmr3927.h> 41#include <asm/txx9/jmr3927.h>
47#include <asm/mipsregs.h> 42#include <asm/mipsregs.h>
48 43
49extern void puts(const char *cp); 44static void jmr3927_machine_restart(char *command)
50
51/* don't enable - see errata */
52static int jmr3927_ccfg_toeon;
53
54static inline void do_reset(void)
55{ 45{
46 local_irq_disable();
56#if 1 /* Resetting PCI bus */ 47#if 1 /* Resetting PCI bus */
57 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR); 48 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
58 jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR); 49 jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR);
@@ -61,33 +52,13 @@ static inline void do_reset(void)
61 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR); 52 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
62#endif 53#endif
63 jmr3927_ioc_reg_out(JMR3927_IOC_RESET_CPU, JMR3927_IOC_RESET_ADDR); 54 jmr3927_ioc_reg_out(JMR3927_IOC_RESET_CPU, JMR3927_IOC_RESET_ADDR);
64} 55 /* fallback */
65 56 (*_machine_halt)();
66static void jmr3927_machine_restart(char *command)
67{
68 local_irq_disable();
69 puts("Rebooting...");
70 do_reset();
71}
72
73static void jmr3927_machine_halt(void)
74{
75 puts("JMR-TX3927 halted.\n");
76 while (1);
77}
78
79static void jmr3927_machine_power_off(void)
80{
81 puts("JMR-TX3927 halted. Please turn off the power.\n");
82 while (1);
83} 57}
84 58
85static void __init jmr3927_time_init(void) 59static void __init jmr3927_time_init(void)
86{ 60{
87 txx9_clockevent_init(TX3927_TMR_REG(0), 61 tx3927_time_init(0, 1);
88 TXX9_IRQ_BASE + JMR3927_IRQ_IRC_TMR(0),
89 JMR3927_IMCLK);
90 txx9_clocksource_init(TX3927_TMR_REG(1), JMR3927_IMCLK);
91} 62}
92 63
93#define DO_WRITE_THROUGH 64#define DO_WRITE_THROUGH
@@ -102,11 +73,6 @@ static void __init jmr3927_mem_setup(void)
102 set_io_port_base(JMR3927_PORT_BASE + JMR3927_PCIIO); 73 set_io_port_base(JMR3927_PORT_BASE + JMR3927_PCIIO);
103 74
104 _machine_restart = jmr3927_machine_restart; 75 _machine_restart = jmr3927_machine_restart;
105 _machine_halt = jmr3927_machine_halt;
106 pm_power_off = jmr3927_machine_power_off;
107
108 /* Reboot on panic */
109 panic_timeout = 180;
110 76
111 /* cache setup */ 77 /* cache setup */
112 { 78 {
@@ -125,7 +91,8 @@ static void __init jmr3927_mem_setup(void)
125#endif 91#endif
126 92
127 conf = read_c0_conf(); 93 conf = read_c0_conf();
128 conf &= ~(TX39_CONF_ICE | TX39_CONF_DCE | TX39_CONF_WBON | TX39_CONF_CWFON); 94 conf &= ~(TX39_CONF_ICE | TX39_CONF_DCE |
95 TX39_CONF_WBON | TX39_CONF_CWFON);
129 conf |= mips_ic_disable ? 0 : TX39_CONF_ICE; 96 conf |= mips_ic_disable ? 0 : TX39_CONF_ICE;
130 conf |= mips_dc_disable ? 0 : TX39_CONF_DCE; 97 conf |= mips_dc_disable ? 0 : TX39_CONF_DCE;
131 conf |= mips_config_wbon ? TX39_CONF_WBON : 0; 98 conf |= mips_config_wbon ? TX39_CONF_WBON : 0;
@@ -138,47 +105,14 @@ static void __init jmr3927_mem_setup(void)
138 /* initialize board */ 105 /* initialize board */
139 jmr3927_board_init(); 106 jmr3927_board_init();
140 107
141 argptr = prom_getcmdline(); 108 tx3927_sio_init(0, 1 << 1); /* ch1: noCTS */
142
143 if ((argptr = strstr(argptr, "toeon")) != NULL)
144 jmr3927_ccfg_toeon = 1;
145 argptr = prom_getcmdline();
146 if ((argptr = strstr(argptr, "ip=")) == NULL) {
147 argptr = prom_getcmdline();
148 strcat(argptr, " ip=bootp");
149 }
150
151#ifdef CONFIG_SERIAL_TXX9
152 {
153 extern int early_serial_txx9_setup(struct uart_port *port);
154 int i;
155 struct uart_port req;
156 for(i = 0; i < 2; i++) {
157 memset(&req, 0, sizeof(req));
158 req.line = i;
159 req.iotype = UPIO_MEM;
160 req.membase = (unsigned char __iomem *)TX3927_SIO_REG(i);
161 req.mapbase = TX3927_SIO_REG(i);
162 req.irq = i == 0 ?
163 JMR3927_IRQ_IRC_SIO0 : JMR3927_IRQ_IRC_SIO1;
164 if (i == 0)
165 req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
166 req.uartclk = JMR3927_IMCLK;
167 early_serial_txx9_setup(&req);
168 }
169 }
170#ifdef CONFIG_SERIAL_TXX9_CONSOLE 109#ifdef CONFIG_SERIAL_TXX9_CONSOLE
171 argptr = prom_getcmdline(); 110 argptr = prom_getcmdline();
172 if ((argptr = strstr(argptr, "console=")) == NULL) { 111 if (!strstr(argptr, "console="))
173 argptr = prom_getcmdline();
174 strcat(argptr, " console=ttyS1,115200"); 112 strcat(argptr, " console=ttyS1,115200");
175 }
176#endif
177#endif 113#endif
178} 114}
179 115
180static void tx3927_setup(void);
181
182static void __init jmr3927_pci_setup(void) 116static void __init jmr3927_pci_setup(void)
183{ 117{
184#ifdef CONFIG_PCI 118#ifdef CONFIG_PCI
@@ -199,32 +133,13 @@ static void __init jmr3927_pci_setup(void)
199 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR); 133 jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
200 } 134 }
201 tx3927_pcic_setup(c, JMR3927_SDRAM_SIZE, extarb); 135 tx3927_pcic_setup(c, JMR3927_SDRAM_SIZE, extarb);
136 tx3927_setup_pcierr_irq();
202#endif /* CONFIG_PCI */ 137#endif /* CONFIG_PCI */
203} 138}
204 139
205static void __init jmr3927_board_init(void) 140static void __init jmr3927_board_init(void)
206{ 141{
207 tx3927_setup();
208 jmr3927_pci_setup();
209
210 /* SIO0 DTR on */
211 jmr3927_ioc_reg_out(0, JMR3927_IOC_DTR_ADDR);
212
213 jmr3927_led_set(0);
214
215 printk("JMR-TX3927 (Rev %d) --- IOC(Rev %d) DIPSW:%d,%d,%d,%d\n",
216 jmr3927_ioc_reg_in(JMR3927_IOC_BREV_ADDR) & JMR3927_REV_MASK,
217 jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_REV_MASK,
218 jmr3927_dipsw1(), jmr3927_dipsw2(),
219 jmr3927_dipsw3(), jmr3927_dipsw4());
220}
221
222static void __init tx3927_setup(void)
223{
224 int i;
225
226 txx9_cpu_clock = JMR3927_CORECLK; 142 txx9_cpu_clock = JMR3927_CORECLK;
227 txx9_gbus_clock = JMR3927_GBUSCLK;
228 /* SDRAMC are configured by PROM */ 143 /* SDRAMC are configured by PROM */
229 144
230 /* ROMC */ 145 /* ROMC */
@@ -233,74 +148,32 @@ static void __init tx3927_setup(void)
233 tx3927_romcptr->cr[3] = JMR3927_ROMCE3 | 0x0003f698; 148 tx3927_romcptr->cr[3] = JMR3927_ROMCE3 | 0x0003f698;
234 tx3927_romcptr->cr[5] = JMR3927_ROMCE5 | 0x0000f218; 149 tx3927_romcptr->cr[5] = JMR3927_ROMCE5 | 0x0000f218;
235 150
236 /* CCFG */
237 /* enable Timeout BusError */
238 if (jmr3927_ccfg_toeon)
239 tx3927_ccfgptr->ccfg |= TX3927_CCFG_TOE;
240
241 /* clear BusErrorOnWrite flag */
242 tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_BEOW;
243 /* Disable PCI snoop */
244 tx3927_ccfgptr->ccfg &= ~TX3927_CCFG_PSNP;
245 /* do reset on watchdog */
246 tx3927_ccfgptr->ccfg |= TX3927_CCFG_WR;
247
248#ifdef DO_WRITE_THROUGH
249 /* Enable PCI SNOOP - with write through only */
250 tx3927_ccfgptr->ccfg |= TX3927_CCFG_PSNP;
251#endif
252
253 /* Pin selection */ 151 /* Pin selection */
254 tx3927_ccfgptr->pcfg &= ~TX3927_PCFG_SELALL; 152 tx3927_ccfgptr->pcfg &= ~TX3927_PCFG_SELALL;
255 tx3927_ccfgptr->pcfg |= 153 tx3927_ccfgptr->pcfg |=
256 TX3927_PCFG_SELSIOC(0) | TX3927_PCFG_SELSIO_ALL | 154 TX3927_PCFG_SELSIOC(0) | TX3927_PCFG_SELSIO_ALL |
257 (TX3927_PCFG_SELDMA_ALL & ~TX3927_PCFG_SELDMA(1)); 155 (TX3927_PCFG_SELDMA_ALL & ~TX3927_PCFG_SELDMA(1));
258 156
259 printk("TX3927 -- CRIR:%08lx CCFG:%08lx PCFG:%08lx\n", 157 tx3927_setup();
260 tx3927_ccfgptr->crir,
261 tx3927_ccfgptr->ccfg, tx3927_ccfgptr->pcfg);
262
263 /* TMR */
264 for (i = 0; i < TX3927_NR_TMR; i++)
265 txx9_tmr_init(TX3927_TMR_REG(i));
266
267 /* DMA */
268 tx3927_dmaptr->mcr = 0;
269 for (i = 0; i < ARRAY_SIZE(tx3927_dmaptr->ch); i++) {
270 /* reset channel */
271 tx3927_dmaptr->ch[i].ccr = TX3927_DMA_CCR_CHRST;
272 tx3927_dmaptr->ch[i].ccr = 0;
273 }
274 /* enable DMA */
275#ifdef __BIG_ENDIAN
276 tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN;
277#else
278 tx3927_dmaptr->mcr = TX3927_DMA_MCR_MSTEN | TX3927_DMA_MCR_LE;
279#endif
280 158
281 /* PIO */
282 /* PIO[15:12] connected to LEDs */ 159 /* PIO[15:12] connected to LEDs */
283 __raw_writel(0x0000f000, &tx3927_pioptr->dir); 160 __raw_writel(0x0000f000, &tx3927_pioptr->dir);
284 __raw_writel(0, &tx3927_pioptr->maskcpu);
285 __raw_writel(0, &tx3927_pioptr->maskext);
286 txx9_gpio_init(TX3927_PIO_REG, 0, 16);
287 gpio_request(11, "dipsw1"); 161 gpio_request(11, "dipsw1");
288 gpio_request(10, "dipsw2"); 162 gpio_request(10, "dipsw2");
289 {
290 unsigned int conf;
291 163
292 conf = read_c0_conf(); 164 jmr3927_pci_setup();
293 if (!(conf & TX39_CONF_ICE)) 165
294 printk("TX3927 I-Cache disabled.\n"); 166 /* SIO0 DTR on */
295 if (!(conf & TX39_CONF_DCE)) 167 jmr3927_ioc_reg_out(0, JMR3927_IOC_DTR_ADDR);
296 printk("TX3927 D-Cache disabled.\n"); 168
297 else if (!(conf & TX39_CONF_WBON)) 169 jmr3927_led_set(0);
298 printk("TX3927 D-Cache WriteThrough.\n"); 170
299 else if (!(conf & TX39_CONF_CWFON)) 171 printk(KERN_INFO
300 printk("TX3927 D-Cache WriteBack.\n"); 172 "JMR-TX3927 (Rev %d) --- IOC(Rev %d) DIPSW:%d,%d,%d,%d\n",
301 else 173 jmr3927_ioc_reg_in(JMR3927_IOC_BREV_ADDR) & JMR3927_REV_MASK,
302 printk("TX3927 D-Cache WriteBack (CWF) .\n"); 174 jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR) & JMR3927_REV_MASK,
303 } 175 jmr3927_dipsw1(), jmr3927_dipsw2(),
176 jmr3927_dipsw3(), jmr3927_dipsw4());
304} 177}
305 178
306/* This trick makes rtc-ds1742 driver usable as is. */ 179/* This trick makes rtc-ds1742 driver usable as is. */
@@ -316,42 +189,21 @@ static unsigned long jmr3927_swizzle_addr_b(unsigned long port)
316#endif 189#endif
317} 190}
318 191
319static int __init jmr3927_rtc_init(void) 192static void __init jmr3927_rtc_init(void)
320{ 193{
321 static struct resource __initdata res = { 194 static struct resource __initdata res = {
322 .start = JMR3927_IOC_NVRAMB_ADDR - IO_BASE, 195 .start = JMR3927_IOC_NVRAMB_ADDR - IO_BASE,
323 .end = JMR3927_IOC_NVRAMB_ADDR - IO_BASE + 0x800 - 1, 196 .end = JMR3927_IOC_NVRAMB_ADDR - IO_BASE + 0x800 - 1,
324 .flags = IORESOURCE_MEM, 197 .flags = IORESOURCE_MEM,
325 }; 198 };
326 struct platform_device *dev; 199 platform_device_register_simple("rtc-ds1742", -1, &res, 1);
327 dev = platform_device_register_simple("rtc-ds1742", -1, &res, 1);
328 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
329}
330
331/* Watchdog support */
332
333static int __init txx9_wdt_init(unsigned long base)
334{
335 struct resource res = {
336 .start = base,
337 .end = base + 0x100 - 1,
338 .flags = IORESOURCE_MEM,
339 };
340 struct platform_device *dev =
341 platform_device_register_simple("txx9wdt", -1, &res, 1);
342 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
343}
344
345static int __init jmr3927_wdt_init(void)
346{
347 return txx9_wdt_init(TX3927_TMR_REG(2));
348} 200}
349 201
350static void __init jmr3927_device_init(void) 202static void __init jmr3927_device_init(void)
351{ 203{
352 __swizzle_addr_b = jmr3927_swizzle_addr_b; 204 __swizzle_addr_b = jmr3927_swizzle_addr_b;
353 jmr3927_rtc_init(); 205 jmr3927_rtc_init();
354 jmr3927_wdt_init(); 206 tx3927_wdt_init();
355} 207}
356 208
357struct txx9_board_vec jmr3927_vec __initdata = { 209struct txx9_board_vec jmr3927_vec __initdata = {
diff --git a/arch/mips/txx9/rbtx4927/irq.c b/arch/mips/txx9/rbtx4927/irq.c
index cd748a930328..00cd5231da30 100644
--- a/arch/mips/txx9/rbtx4927/irq.c
+++ b/arch/mips/txx9/rbtx4927/irq.c
@@ -27,85 +27,86 @@
27 * 675 Mass Ave, Cambridge, MA 02139, USA. 27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */ 28 */
29/* 29/*
30IRQ Device 30 * I8259A_IRQ_BASE+00
3100 RBTX4927-ISA/00 31 * I8259A_IRQ_BASE+01 PS2/Keyboard
3201 RBTX4927-ISA/01 PS2/Keyboard 32 * I8259A_IRQ_BASE+02 Cascade RBTX4927-ISA (irqs 8-15)
3302 RBTX4927-ISA/02 Cascade RBTX4927-ISA (irqs 8-15) 33 * I8259A_IRQ_BASE+03
3403 RBTX4927-ISA/03 34 * I8259A_IRQ_BASE+04
3504 RBTX4927-ISA/04 35 * I8259A_IRQ_BASE+05
3605 RBTX4927-ISA/05 36 * I8259A_IRQ_BASE+06
3706 RBTX4927-ISA/06 37 * I8259A_IRQ_BASE+07
3807 RBTX4927-ISA/07 38 * I8259A_IRQ_BASE+08
3908 RBTX4927-ISA/08 39 * I8259A_IRQ_BASE+09
4009 RBTX4927-ISA/09 40 * I8259A_IRQ_BASE+10
4110 RBTX4927-ISA/10 41 * I8259A_IRQ_BASE+11
4211 RBTX4927-ISA/11 42 * I8259A_IRQ_BASE+12 PS2/Mouse (not supported at this time)
4312 RBTX4927-ISA/12 PS2/Mouse (not supported at this time) 43 * I8259A_IRQ_BASE+13
4413 RBTX4927-ISA/13 44 * I8259A_IRQ_BASE+14 IDE
4514 RBTX4927-ISA/14 IDE 45 * I8259A_IRQ_BASE+15
4615 RBTX4927-ISA/15 46 *
47 47 * MIPS_CPU_IRQ_BASE+00 Software 0
4816 TX4927-CP0/00 Software 0 48 * MIPS_CPU_IRQ_BASE+01 Software 1
4917 TX4927-CP0/01 Software 1 49 * MIPS_CPU_IRQ_BASE+02 Cascade TX4927-CP0
5018 TX4927-CP0/02 Cascade TX4927-CP0 50 * MIPS_CPU_IRQ_BASE+03 Multiplexed -- do not use
5119 TX4927-CP0/03 Multiplexed -- do not use 51 * MIPS_CPU_IRQ_BASE+04 Multiplexed -- do not use
5220 TX4927-CP0/04 Multiplexed -- do not use 52 * MIPS_CPU_IRQ_BASE+05 Multiplexed -- do not use
5321 TX4927-CP0/05 Multiplexed -- do not use 53 * MIPS_CPU_IRQ_BASE+06 Multiplexed -- do not use
5422 TX4927-CP0/06 Multiplexed -- do not use 54 * MIPS_CPU_IRQ_BASE+07 CPU TIMER
5523 TX4927-CP0/07 CPU TIMER 55 *
56 56 * TXX9_IRQ_BASE+00
5724 TX4927-PIC/00 57 * TXX9_IRQ_BASE+01
5825 TX4927-PIC/01 58 * TXX9_IRQ_BASE+02
5926 TX4927-PIC/02 59 * TXX9_IRQ_BASE+03 Cascade RBTX4927-IOC
6027 TX4927-PIC/03 Cascade RBTX4927-IOC 60 * TXX9_IRQ_BASE+04
6128 TX4927-PIC/04 61 * TXX9_IRQ_BASE+05 RBTX4927 RTL-8019AS ethernet
6229 TX4927-PIC/05 RBTX4927 RTL-8019AS ethernet 62 * TXX9_IRQ_BASE+06
6330 TX4927-PIC/06 63 * TXX9_IRQ_BASE+07
6431 TX4927-PIC/07 64 * TXX9_IRQ_BASE+08 TX4927 SerialIO Channel 0
6532 TX4927-PIC/08 TX4927 SerialIO Channel 0 65 * TXX9_IRQ_BASE+09 TX4927 SerialIO Channel 1
6633 TX4927-PIC/09 TX4927 SerialIO Channel 1 66 * TXX9_IRQ_BASE+10
6734 TX4927-PIC/10 67 * TXX9_IRQ_BASE+11
6835 TX4927-PIC/11 68 * TXX9_IRQ_BASE+12
6936 TX4927-PIC/12 69 * TXX9_IRQ_BASE+13
7037 TX4927-PIC/13 70 * TXX9_IRQ_BASE+14
7138 TX4927-PIC/14 71 * TXX9_IRQ_BASE+15
7239 TX4927-PIC/15 72 * TXX9_IRQ_BASE+16 TX4927 PCI PCI-C
7340 TX4927-PIC/16 TX4927 PCI PCI-C 73 * TXX9_IRQ_BASE+17
7441 TX4927-PIC/17 74 * TXX9_IRQ_BASE+18
7542 TX4927-PIC/18 75 * TXX9_IRQ_BASE+19
7643 TX4927-PIC/19 76 * TXX9_IRQ_BASE+20
7744 TX4927-PIC/20 77 * TXX9_IRQ_BASE+21
7845 TX4927-PIC/21 78 * TXX9_IRQ_BASE+22 TX4927 PCI PCI-ERR
7946 TX4927-PIC/22 TX4927 PCI PCI-ERR 79 * TXX9_IRQ_BASE+23 TX4927 PCI PCI-PMA (not used)
8047 TX4927-PIC/23 TX4927 PCI PCI-PMA (not used) 80 * TXX9_IRQ_BASE+24
8148 TX4927-PIC/24 81 * TXX9_IRQ_BASE+25
8249 TX4927-PIC/25 82 * TXX9_IRQ_BASE+26
8350 TX4927-PIC/26 83 * TXX9_IRQ_BASE+27
8451 TX4927-PIC/27 84 * TXX9_IRQ_BASE+28
8552 TX4927-PIC/28 85 * TXX9_IRQ_BASE+29
8653 TX4927-PIC/29 86 * TXX9_IRQ_BASE+30
8754 TX4927-PIC/30 87 * TXX9_IRQ_BASE+31
8855 TX4927-PIC/31 88 *
89 89 * RBTX4927_IRQ_IOC+00 FPCIB0 PCI-D (SouthBridge)
9056 RBTX4927-IOC/00 FPCIB0 PCI-D PJ4/A PJ5/B SB/C PJ6/D PJ7/A (SouthBridge/NotUsed) [RTL-8139=PJ4] 90 * RBTX4927_IRQ_IOC+01 FPCIB0 PCI-C (SouthBridge)
9157 RBTX4927-IOC/01 FPCIB0 PCI-C PJ4/D PJ5/A SB/B PJ6/C PJ7/D (SouthBridge/NotUsed) [RTL-8139=PJ5] 91 * RBTX4927_IRQ_IOC+02 FPCIB0 PCI-B (SouthBridge/IDE/pin=1,INTR)
9258 RBTX4927-IOC/02 FPCIB0 PCI-B PJ4/C PJ5/D SB/A PJ6/B PJ7/C (SouthBridge/IDE/pin=1,INTR) [RTL-8139=NotSupported] 92 * RBTX4927_IRQ_IOC+03 FPCIB0 PCI-A (SouthBridge/USB/pin=4)
9359 RBTX4927-IOC/03 FPCIB0 PCI-A PJ4/B PJ5/C SB/D PJ6/A PJ7/B (SouthBridge/USB/pin=4) [RTL-8139=PJ6] 93 * RBTX4927_IRQ_IOC+04
9460 RBTX4927-IOC/04 94 * RBTX4927_IRQ_IOC+05
9561 RBTX4927-IOC/05 95 * RBTX4927_IRQ_IOC+06
9662 RBTX4927-IOC/06 96 * RBTX4927_IRQ_IOC+07
9763 RBTX4927-IOC/07 97 *
98 98 * NOTES:
99NOTES: 99 * SouthBridge/INTR is mapped to SouthBridge/A=PCI-B/#58
100SouthBridge/INTR is mapped to SouthBridge/A=PCI-B/#58 100 * SouthBridge/ISA/pin=0 no pci irq used by this device
101SouthBridge/ISA/pin=0 no pci irq used by this device 101 * SouthBridge/IDE/pin=1 no pci irq used by this device, using INTR
102SouthBridge/IDE/pin=1 no pci irq used by this device, using INTR via ISA IRQ14 102 * via ISA IRQ14
103SouthBridge/USB/pin=4 using pci irq SouthBridge/D=PCI-A=#59 103 * SouthBridge/USB/pin=4 using pci irq SouthBridge/D=PCI-A=#59
104SouthBridge/PMC/pin=0 no pci irq used by this device 104 * SouthBridge/PMC/pin=0 no pci irq used by this device
105SuperIO/PS2/Keyboard, using INTR via ISA IRQ1 105 * SuperIO/PS2/Keyboard, using INTR via ISA IRQ1
106SuperIO/PS2/Mouse, using INTR via ISA IRQ12 (mouse not currently supported) 106 * SuperIO/PS2/Mouse, using INTR via ISA IRQ12 (mouse not currently supported)
107JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthBridge, JP4, JP5, JP6 107 * JP7 is not bus master -- do NOT use -- only 4 pci bus master's
108*/ 108 * allowed -- SouthBridge, JP4, JP5, JP6
109 */
109 110
110#include <linux/init.h> 111#include <linux/init.h>
111#include <linux/types.h> 112#include <linux/types.h>
@@ -134,7 +135,7 @@ static int toshiba_rbtx4927_irq_nested(int sw_irq)
134 level3 = readb(rbtx4927_imstat_addr) & 0x1f; 135 level3 = readb(rbtx4927_imstat_addr) & 0x1f;
135 if (level3) 136 if (level3)
136 sw_irq = RBTX4927_IRQ_IOC + fls(level3) - 1; 137 sw_irq = RBTX4927_IRQ_IOC + fls(level3) - 1;
137 return (sw_irq); 138 return sw_irq;
138} 139}
139 140
140static void __init toshiba_rbtx4927_irq_ioc_init(void) 141static void __init toshiba_rbtx4927_irq_ioc_init(void)
diff --git a/arch/mips/txx9/rbtx4927/prom.c b/arch/mips/txx9/rbtx4927/prom.c
index 5c0de54ebdd2..1dc0a5b1956b 100644
--- a/arch/mips/txx9/rbtx4927/prom.c
+++ b/arch/mips/txx9/rbtx4927/prom.c
@@ -38,4 +38,5 @@ void __init rbtx4927_prom_init(void)
38{ 38{
39 prom_init_cmdline(); 39 prom_init_cmdline();
40 add_memory_region(0, tx4927_get_mem_size(), BOOT_MEM_RAM); 40 add_memory_region(0, tx4927_get_mem_size(), BOOT_MEM_RAM);
41 txx9_sio_putchar_init(TX4927_SIO_REG(0) & 0xfffffffffULL);
41} 42}
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 3da20ea3e55c..0d39bafea794 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -46,12 +46,9 @@
46#include <linux/kernel.h> 46#include <linux/kernel.h>
47#include <linux/types.h> 47#include <linux/types.h>
48#include <linux/ioport.h> 48#include <linux/ioport.h>
49#include <linux/interrupt.h>
50#include <linux/pm.h>
51#include <linux/platform_device.h> 49#include <linux/platform_device.h>
52#include <linux/delay.h> 50#include <linux/delay.h>
53#include <asm/io.h> 51#include <asm/io.h>
54#include <asm/processor.h>
55#include <asm/reboot.h> 52#include <asm/reboot.h>
56#include <asm/txx9/generic.h> 53#include <asm/txx9/generic.h>
57#include <asm/txx9/pci.h> 54#include <asm/txx9/pci.h>
@@ -103,6 +100,7 @@ static void __init tx4927_pci_setup(void)
103 tx4927_report_pciclk(); 100 tx4927_report_pciclk();
104 tx4927_pcic_setup(tx4927_pcicptr, c, extarb); 101 tx4927_pcic_setup(tx4927_pcicptr, c, extarb);
105 } 102 }
103 tx4927_setup_pcierr_irq();
106} 104}
107 105
108static void __init tx4937_pci_setup(void) 106static void __init tx4937_pci_setup(void)
@@ -149,6 +147,7 @@ static void __init tx4937_pci_setup(void)
149 tx4938_report_pciclk(); 147 tx4938_report_pciclk();
150 tx4927_pcic_setup(tx4938_pcicptr, c, extarb); 148 tx4927_pcic_setup(tx4938_pcicptr, c, extarb);
151 } 149 }
150 tx4938_setup_pcierr_irq();
152} 151}
153 152
154static void __init rbtx4927_arch_init(void) 153static void __init rbtx4927_arch_init(void)
@@ -165,17 +164,8 @@ static void __init rbtx4937_arch_init(void)
165#define rbtx4937_arch_init NULL 164#define rbtx4937_arch_init NULL
166#endif /* CONFIG_PCI */ 165#endif /* CONFIG_PCI */
167 166
168static void __noreturn wait_forever(void)
169{
170 while (1)
171 if (cpu_wait)
172 (*cpu_wait)();
173}
174
175static void toshiba_rbtx4927_restart(char *command) 167static void toshiba_rbtx4927_restart(char *command)
176{ 168{
177 printk(KERN_NOTICE "System Rebooting...\n");
178
179 /* enable the s/w reset register */ 169 /* enable the s/w reset register */
180 writeb(1, rbtx4927_softresetlock_addr); 170 writeb(1, rbtx4927_softresetlock_addr);
181 171
@@ -186,24 +176,8 @@ static void toshiba_rbtx4927_restart(char *command)
186 /* do a s/w reset */ 176 /* do a s/w reset */
187 writeb(1, rbtx4927_softreset_addr); 177 writeb(1, rbtx4927_softreset_addr);
188 178
189 /* do something passive while waiting for reset */ 179 /* fallback */
190 local_irq_disable(); 180 (*_machine_halt)();
191 wait_forever();
192 /* no return */
193}
194
195static void toshiba_rbtx4927_halt(void)
196{
197 printk(KERN_NOTICE "System Halted\n");
198 local_irq_disable();
199 wait_forever();
200 /* no return */
201}
202
203static void toshiba_rbtx4927_power_off(void)
204{
205 toshiba_rbtx4927_halt();
206 /* no return */
207} 181}
208 182
209static void __init rbtx4927_clock_init(void); 183static void __init rbtx4927_clock_init(void);
@@ -214,9 +188,6 @@ static void __init rbtx4927_mem_setup(void)
214 u32 cp0_config; 188 u32 cp0_config;
215 char *argptr; 189 char *argptr;
216 190
217 /* f/w leaves this on at startup */
218 clear_c0_status(ST0_ERL);
219
220 /* enable caches -- HCP5 does this, pmon does not */ 191 /* enable caches -- HCP5 does this, pmon does not */
221 cp0_config = read_c0_config(); 192 cp0_config = read_c0_config();
222 cp0_config = cp0_config & ~(TX49_CONF_IC | TX49_CONF_DC); 193 cp0_config = cp0_config & ~(TX49_CONF_IC | TX49_CONF_DC);
@@ -231,37 +202,21 @@ static void __init rbtx4927_mem_setup(void)
231 } 202 }
232 203
233 _machine_restart = toshiba_rbtx4927_restart; 204 _machine_restart = toshiba_rbtx4927_restart;
234 _machine_halt = toshiba_rbtx4927_halt;
235 pm_power_off = toshiba_rbtx4927_power_off;
236 205
237#ifdef CONFIG_PCI 206#ifdef CONFIG_PCI
238 txx9_alloc_pci_controller(&txx9_primary_pcic, 207 txx9_alloc_pci_controller(&txx9_primary_pcic,
239 RBTX4927_PCIMEM, RBTX4927_PCIMEM_SIZE, 208 RBTX4927_PCIMEM, RBTX4927_PCIMEM_SIZE,
240 RBTX4927_PCIIO, RBTX4927_PCIIO_SIZE); 209 RBTX4927_PCIIO, RBTX4927_PCIIO_SIZE);
210 txx9_board_pcibios_setup = tx4927_pcibios_setup;
241#else 211#else
242 set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET); 212 set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET);
243#endif 213#endif
244 214
245 tx4927_setup_serial(); 215 tx4927_sio_init(0, 0);
246#ifdef CONFIG_SERIAL_TXX9_CONSOLE 216#ifdef CONFIG_SERIAL_TXX9_CONSOLE
247 argptr = prom_getcmdline(); 217 argptr = prom_getcmdline();
248 if (strstr(argptr, "console=") == NULL) { 218 if (!strstr(argptr, "console="))
249 strcat(argptr, " console=ttyS0,38400"); 219 strcat(argptr, " console=ttyS0,38400");
250 }
251#endif
252
253#ifdef CONFIG_ROOT_NFS
254 argptr = prom_getcmdline();
255 if (strstr(argptr, "root=") == NULL) {
256 strcat(argptr, " root=/dev/nfs rw");
257 }
258#endif
259
260#ifdef CONFIG_IP_PNP
261 argptr = prom_getcmdline();
262 if (strstr(argptr, "ip=") == NULL) {
263 strcat(argptr, " ip=any");
264 }
265#endif 220#endif
266} 221}
267 222
@@ -324,19 +279,17 @@ static void __init rbtx4927_time_init(void)
324 tx4927_time_init(0); 279 tx4927_time_init(0);
325} 280}
326 281
327static int __init toshiba_rbtx4927_rtc_init(void) 282static void __init toshiba_rbtx4927_rtc_init(void)
328{ 283{
329 struct resource res = { 284 struct resource res = {
330 .start = RBTX4927_BRAMRTC_BASE - IO_BASE, 285 .start = RBTX4927_BRAMRTC_BASE - IO_BASE,
331 .end = RBTX4927_BRAMRTC_BASE - IO_BASE + 0x800 - 1, 286 .end = RBTX4927_BRAMRTC_BASE - IO_BASE + 0x800 - 1,
332 .flags = IORESOURCE_MEM, 287 .flags = IORESOURCE_MEM,
333 }; 288 };
334 struct platform_device *dev = 289 platform_device_register_simple("rtc-ds1742", -1, &res, 1);
335 platform_device_register_simple("rtc-ds1742", -1, &res, 1);
336 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
337} 290}
338 291
339static int __init rbtx4927_ne_init(void) 292static void __init rbtx4927_ne_init(void)
340{ 293{
341 struct resource res[] = { 294 struct resource res[] = {
342 { 295 {
@@ -348,36 +301,14 @@ static int __init rbtx4927_ne_init(void)
348 .flags = IORESOURCE_IRQ, 301 .flags = IORESOURCE_IRQ,
349 } 302 }
350 }; 303 };
351 struct platform_device *dev = 304 platform_device_register_simple("ne", -1, res, ARRAY_SIZE(res));
352 platform_device_register_simple("ne", -1,
353 res, ARRAY_SIZE(res));
354 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
355}
356
357/* Watchdog support */
358
359static int __init txx9_wdt_init(unsigned long base)
360{
361 struct resource res = {
362 .start = base,
363 .end = base + 0x100 - 1,
364 .flags = IORESOURCE_MEM,
365 };
366 struct platform_device *dev =
367 platform_device_register_simple("txx9wdt", -1, &res, 1);
368 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
369}
370
371static int __init rbtx4927_wdt_init(void)
372{
373 return txx9_wdt_init(TX4927_TMR_REG(2) & 0xfffffffffULL);
374} 305}
375 306
376static void __init rbtx4927_device_init(void) 307static void __init rbtx4927_device_init(void)
377{ 308{
378 toshiba_rbtx4927_rtc_init(); 309 toshiba_rbtx4927_rtc_init();
379 rbtx4927_ne_init(); 310 rbtx4927_ne_init();
380 rbtx4927_wdt_init(); 311 tx4927_wdt_init();
381} 312}
382 313
383struct txx9_board_vec rbtx4927_vec __initdata = { 314struct txx9_board_vec rbtx4927_vec __initdata = {
diff --git a/arch/mips/txx9/rbtx4938/irq.c b/arch/mips/txx9/rbtx4938/irq.c
index 3971a061657a..ca2f8306ce93 100644
--- a/arch/mips/txx9/rbtx4938/irq.c
+++ b/arch/mips/txx9/rbtx4938/irq.c
@@ -11,59 +11,57 @@
11 */ 11 */
12 12
13/* 13/*
14IRQ Device 14 * MIPS_CPU_IRQ_BASE+00 Software 0
15 15 * MIPS_CPU_IRQ_BASE+01 Software 1
1616 TX4938-CP0/00 Software 0 16 * MIPS_CPU_IRQ_BASE+02 Cascade TX4938-CP0
1717 TX4938-CP0/01 Software 1 17 * MIPS_CPU_IRQ_BASE+03 Multiplexed -- do not use
1818 TX4938-CP0/02 Cascade TX4938-CP0 18 * MIPS_CPU_IRQ_BASE+04 Multiplexed -- do not use
1919 TX4938-CP0/03 Multiplexed -- do not use 19 * MIPS_CPU_IRQ_BASE+05 Multiplexed -- do not use
2020 TX4938-CP0/04 Multiplexed -- do not use 20 * MIPS_CPU_IRQ_BASE+06 Multiplexed -- do not use
2121 TX4938-CP0/05 Multiplexed -- do not use 21 * MIPS_CPU_IRQ_BASE+07 CPU TIMER
2222 TX4938-CP0/06 Multiplexed -- do not use 22 *
2323 TX4938-CP0/07 CPU TIMER 23 * TXX9_IRQ_BASE+00
24 24 * TXX9_IRQ_BASE+01
2524 TX4938-PIC/00 25 * TXX9_IRQ_BASE+02 Cascade RBTX4938-IOC
2625 TX4938-PIC/01 26 * TXX9_IRQ_BASE+03 RBTX4938 RTL-8019AS Ethernet
2726 TX4938-PIC/02 Cascade RBTX4938-IOC 27 * TXX9_IRQ_BASE+04
2827 TX4938-PIC/03 RBTX4938 RTL-8019AS Ethernet 28 * TXX9_IRQ_BASE+05 TX4938 ETH1
2928 TX4938-PIC/04 29 * TXX9_IRQ_BASE+06 TX4938 ETH0
3029 TX4938-PIC/05 TX4938 ETH1 30 * TXX9_IRQ_BASE+07
3130 TX4938-PIC/06 TX4938 ETH0 31 * TXX9_IRQ_BASE+08 TX4938 SIO 0
3231 TX4938-PIC/07 32 * TXX9_IRQ_BASE+09 TX4938 SIO 1
3332 TX4938-PIC/08 TX4938 SIO 0 33 * TXX9_IRQ_BASE+10 TX4938 DMA0
3433 TX4938-PIC/09 TX4938 SIO 1 34 * TXX9_IRQ_BASE+11 TX4938 DMA1
3534 TX4938-PIC/10 TX4938 DMA0 35 * TXX9_IRQ_BASE+12 TX4938 DMA2
3635 TX4938-PIC/11 TX4938 DMA1 36 * TXX9_IRQ_BASE+13 TX4938 DMA3
3736 TX4938-PIC/12 TX4938 DMA2 37 * TXX9_IRQ_BASE+14
3837 TX4938-PIC/13 TX4938 DMA3 38 * TXX9_IRQ_BASE+15
3938 TX4938-PIC/14 39 * TXX9_IRQ_BASE+16 TX4938 PCIC
4039 TX4938-PIC/15 40 * TXX9_IRQ_BASE+17 TX4938 TMR0
4140 TX4938-PIC/16 TX4938 PCIC 41 * TXX9_IRQ_BASE+18 TX4938 TMR1
4241 TX4938-PIC/17 TX4938 TMR0 42 * TXX9_IRQ_BASE+19 TX4938 TMR2
4342 TX4938-PIC/18 TX4938 TMR1 43 * TXX9_IRQ_BASE+20
4443 TX4938-PIC/19 TX4938 TMR2 44 * TXX9_IRQ_BASE+21
4544 TX4938-PIC/20 45 * TXX9_IRQ_BASE+22 TX4938 PCIERR
4645 TX4938-PIC/21 46 * TXX9_IRQ_BASE+23
4746 TX4938-PIC/22 TX4938 PCIERR 47 * TXX9_IRQ_BASE+24
4847 TX4938-PIC/23 48 * TXX9_IRQ_BASE+25
4948 TX4938-PIC/24 49 * TXX9_IRQ_BASE+26
5049 TX4938-PIC/25 50 * TXX9_IRQ_BASE+27
5150 TX4938-PIC/26 51 * TXX9_IRQ_BASE+28
5251 TX4938-PIC/27 52 * TXX9_IRQ_BASE+29
5352 TX4938-PIC/28 53 * TXX9_IRQ_BASE+30
5453 TX4938-PIC/29 54 * TXX9_IRQ_BASE+31 TX4938 SPI
5554 TX4938-PIC/30 55 *
5655 TX4938-PIC/31 TX4938 SPI 56 * RBTX4938_IRQ_IOC+00 PCI-D
57 57 * RBTX4938_IRQ_IOC+01 PCI-C
5856 RBTX4938-IOC/00 PCI-D 58 * RBTX4938_IRQ_IOC+02 PCI-B
5957 RBTX4938-IOC/01 PCI-C 59 * RBTX4938_IRQ_IOC+03 PCI-A
6058 RBTX4938-IOC/02 PCI-B 60 * RBTX4938_IRQ_IOC+04 RTC
6159 RBTX4938-IOC/03 PCI-A 61 * RBTX4938_IRQ_IOC+05 ATA
6260 RBTX4938-IOC/04 RTC 62 * RBTX4938_IRQ_IOC+06 MODEM
6361 RBTX4938-IOC/05 ATA 63 * RBTX4938_IRQ_IOC+07 SWINT
6462 RBTX4938-IOC/06 MODEM 64 */
6563 RBTX4938-IOC/07 SWINT
66*/
67#include <linux/init.h> 65#include <linux/init.h>
68#include <linux/interrupt.h> 66#include <linux/interrupt.h>
69#include <asm/mipsregs.h> 67#include <asm/mipsregs.h>
@@ -93,9 +91,6 @@ static int toshiba_rbtx4938_irq_nested(int sw_irq)
93 return sw_irq; 91 return sw_irq;
94} 92}
95 93
96/**********************************************************************************/
97/* Functions for ioc */
98/**********************************************************************************/
99static void __init 94static void __init
100toshiba_rbtx4938_irq_ioc_init(void) 95toshiba_rbtx4938_irq_ioc_init(void)
101{ 96{
diff --git a/arch/mips/txx9/rbtx4938/prom.c b/arch/mips/txx9/rbtx4938/prom.c
index ee189519ce5a..d73123cd2ab9 100644
--- a/arch/mips/txx9/rbtx4938/prom.c
+++ b/arch/mips/txx9/rbtx4938/prom.c
@@ -22,4 +22,5 @@ void __init rbtx4938_prom_init(void)
22 prom_init_cmdline(); 22 prom_init_cmdline();
23#endif 23#endif
24 add_memory_region(0, tx4938_get_mem_size(), BOOT_MEM_RAM); 24 add_memory_region(0, tx4938_get_mem_size(), BOOT_MEM_RAM);
25 txx9_sio_putchar_init(TX4938_SIO_REG(0) & 0xfffffffffULL);
25} 26}
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index 6c2b99bb8af6..9ab48dec0fe8 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -13,9 +13,6 @@
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/ioport.h> 14#include <linux/ioport.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/interrupt.h>
17#include <linux/console.h>
18#include <linux/pm.h>
19#include <linux/platform_device.h> 16#include <linux/platform_device.h>
20#include <linux/gpio.h> 17#include <linux/gpio.h>
21 18
@@ -28,33 +25,14 @@
28#include <asm/txx9/spi.h> 25#include <asm/txx9/spi.h>
29#include <asm/txx9pio.h> 26#include <asm/txx9pio.h>
30 27
31static void rbtx4938_machine_halt(void)
32{
33 printk(KERN_NOTICE "System Halted\n");
34 local_irq_disable();
35
36 while (1)
37 __asm__(".set\tmips3\n\t"
38 "wait\n\t"
39 ".set\tmips0");
40}
41
42static void rbtx4938_machine_power_off(void)
43{
44 rbtx4938_machine_halt();
45 /* no return */
46}
47
48static void rbtx4938_machine_restart(char *command) 28static void rbtx4938_machine_restart(char *command)
49{ 29{
50 local_irq_disable(); 30 local_irq_disable();
51
52 printk("Rebooting...");
53 writeb(1, rbtx4938_softresetlock_addr); 31 writeb(1, rbtx4938_softresetlock_addr);
54 writeb(1, rbtx4938_sfvol_addr); 32 writeb(1, rbtx4938_sfvol_addr);
55 writeb(1, rbtx4938_softreset_addr); 33 writeb(1, rbtx4938_softreset_addr);
56 while(1) 34 /* fallback */
57 ; 35 (*_machine_halt)();
58} 36}
59 37
60static void __init rbtx4938_pci_setup(void) 38static void __init rbtx4938_pci_setup(void)
@@ -121,6 +99,7 @@ static void __init rbtx4938_pci_setup(void)
121 register_pci_controller(c); 99 register_pci_controller(c);
122 tx4927_pcic_setup(tx4938_pcic1ptr, c, 0); 100 tx4927_pcic_setup(tx4938_pcic1ptr, c, 0);
123 } 101 }
102 tx4938_setup_pcierr_irq();
124#endif /* CONFIG_PCI */ 103#endif /* CONFIG_PCI */
125} 104}
126 105
@@ -151,19 +130,7 @@ static int __init rbtx4938_ethaddr_init(void)
151 if (sum) 130 if (sum)
152 printk(KERN_WARNING "seeprom: bad checksum.\n"); 131 printk(KERN_WARNING "seeprom: bad checksum.\n");
153 } 132 }
154 for (i = 0; i < 2; i++) { 133 tx4938_ethaddr_init(&dat[4], &dat[4 + 6]);
155 unsigned int id =
156 TXX9_IRQ_BASE + (i ? TX4938_IR_ETH1 : TX4938_IR_ETH0);
157 struct platform_device *pdev;
158 if (!(__raw_readq(&tx4938_ccfgptr->pcfg) &
159 (i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL)))
160 continue;
161 pdev = platform_device_alloc("tc35815-mac", id);
162 if (!pdev ||
163 platform_device_add_data(pdev, &dat[4 + 6 * i], 6) ||
164 platform_device_add(pdev))
165 platform_device_put(pdev);
166 }
167#endif /* CONFIG_PCI */ 134#endif /* CONFIG_PCI */
168 return 0; 135 return 0;
169} 136}
@@ -193,51 +160,36 @@ static void __init rbtx4938_mem_setup(void)
193 160
194#ifdef CONFIG_PCI 161#ifdef CONFIG_PCI
195 txx9_alloc_pci_controller(&txx9_primary_pcic, 0, 0, 0, 0); 162 txx9_alloc_pci_controller(&txx9_primary_pcic, 0, 0, 0, 0);
163 txx9_board_pcibios_setup = tx4927_pcibios_setup;
196#else 164#else
197 set_io_port_base(RBTX4938_ETHER_BASE); 165 set_io_port_base(RBTX4938_ETHER_BASE);
198#endif 166#endif
199 167
200 tx4938_setup_serial(); 168 tx4938_sio_init(7372800, 0);
201#ifdef CONFIG_SERIAL_TXX9_CONSOLE 169#ifdef CONFIG_SERIAL_TXX9_CONSOLE
202 argptr = prom_getcmdline(); 170 argptr = prom_getcmdline();
203 if (strstr(argptr, "console=") == NULL) { 171 if (!strstr(argptr, "console="))
204 strcat(argptr, " console=ttyS0,38400"); 172 strcat(argptr, " console=ttyS0,38400");
205 }
206#endif 173#endif
207 174
208#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61 175#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61
209 printk("PIOSEL: disabling both ata and nand selection\n"); 176 printk(KERN_INFO "PIOSEL: disabling both ata and nand selection\n");
210 local_irq_disable();
211 txx9_clear64(&tx4938_ccfgptr->pcfg, 177 txx9_clear64(&tx4938_ccfgptr->pcfg,
212 TX4938_PCFG_NDF_SEL | TX4938_PCFG_ATA_SEL); 178 TX4938_PCFG_NDF_SEL | TX4938_PCFG_ATA_SEL);
213#endif 179#endif
214 180
215#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_NAND 181#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_NAND
216 printk("PIOSEL: enabling nand selection\n"); 182 printk(KERN_INFO "PIOSEL: enabling nand selection\n");
217 txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL); 183 txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL);
218 txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL); 184 txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL);
219#endif 185#endif
220 186
221#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_ATA 187#ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_ATA
222 printk("PIOSEL: enabling ata selection\n"); 188 printk(KERN_INFO "PIOSEL: enabling ata selection\n");
223 txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL); 189 txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL);
224 txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL); 190 txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL);
225#endif 191#endif
226 192
227#ifdef CONFIG_IP_PNP
228 argptr = prom_getcmdline();
229 if (strstr(argptr, "ip=") == NULL) {
230 strcat(argptr, " ip=any");
231 }
232#endif
233
234
235#ifdef CONFIG_FB
236 {
237 conswitchp = &dummy_con;
238 }
239#endif
240
241 rbtx4938_spi_setup(); 193 rbtx4938_spi_setup();
242 pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg); /* updated */ 194 pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg); /* updated */
243 /* fixup piosel */ 195 /* fixup piosel */
@@ -258,11 +210,9 @@ static void __init rbtx4938_mem_setup(void)
258 rbtx4938_fpga_resource.end = CPHYSADDR(RBTX4938_FPGA_REG_ADDR) + 0xffff; 210 rbtx4938_fpga_resource.end = CPHYSADDR(RBTX4938_FPGA_REG_ADDR) + 0xffff;
259 rbtx4938_fpga_resource.flags = IORESOURCE_MEM | IORESOURCE_BUSY; 211 rbtx4938_fpga_resource.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
260 if (request_resource(&txx9_ce_res[2], &rbtx4938_fpga_resource)) 212 if (request_resource(&txx9_ce_res[2], &rbtx4938_fpga_resource))
261 printk("request resource for fpga failed\n"); 213 printk(KERN_ERR "request resource for fpga failed\n");
262 214
263 _machine_restart = rbtx4938_machine_restart; 215 _machine_restart = rbtx4938_machine_restart;
264 _machine_halt = rbtx4938_machine_halt;
265 pm_power_off = rbtx4938_machine_power_off;
266 216
267 writeb(0xff, rbtx4938_led_addr); 217 writeb(0xff, rbtx4938_led_addr);
268 printk(KERN_INFO "RBTX4938 --- FPGA(Rev %02x) DIPSW:%02x,%02x\n", 218 printk(KERN_INFO "RBTX4938 --- FPGA(Rev %02x) DIPSW:%02x,%02x\n",
@@ -270,7 +220,7 @@ static void __init rbtx4938_mem_setup(void)
270 readb(rbtx4938_dipsw_addr), readb(rbtx4938_bdipsw_addr)); 220 readb(rbtx4938_dipsw_addr), readb(rbtx4938_bdipsw_addr));
271} 221}
272 222
273static int __init rbtx4938_ne_init(void) 223static void __init rbtx4938_ne_init(void)
274{ 224{
275 struct resource res[] = { 225 struct resource res[] = {
276 { 226 {
@@ -282,10 +232,7 @@ static int __init rbtx4938_ne_init(void)
282 .flags = IORESOURCE_IRQ, 232 .flags = IORESOURCE_IRQ,
283 } 233 }
284 }; 234 };
285 struct platform_device *dev = 235 platform_device_register_simple("ne", -1, res, ARRAY_SIZE(res));
286 platform_device_register_simple("ne", -1,
287 res, ARRAY_SIZE(res));
288 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
289} 236}
290 237
291static DEFINE_SPINLOCK(rbtx4938_spi_gpio_lock); 238static DEFINE_SPINLOCK(rbtx4938_spi_gpio_lock);
@@ -321,24 +268,6 @@ static struct gpio_chip rbtx4938_spi_gpio_chip = {
321 .ngpio = 3, 268 .ngpio = 3,
322}; 269};
323 270
324/* SPI support */
325
326static void __init txx9_spi_init(unsigned long base, int irq)
327{
328 struct resource res[] = {
329 {
330 .start = base,
331 .end = base + 0x20 - 1,
332 .flags = IORESOURCE_MEM,
333 }, {
334 .start = irq,
335 .flags = IORESOURCE_IRQ,
336 },
337 };
338 platform_device_register_simple("spi_txx9", 0,
339 res, ARRAY_SIZE(res));
340}
341
342static int __init rbtx4938_spi_init(void) 271static int __init rbtx4938_spi_init(void)
343{ 272{
344 struct spi_board_info srtc_info = { 273 struct spi_board_info srtc_info = {
@@ -361,7 +290,7 @@ static int __init rbtx4938_spi_init(void)
361 gpio_direction_output(16 + SEEPROM2_CS, 1); 290 gpio_direction_output(16 + SEEPROM2_CS, 1);
362 gpio_request(16 + SEEPROM3_CS, "seeprom3"); 291 gpio_request(16 + SEEPROM3_CS, "seeprom3");
363 gpio_direction_output(16 + SEEPROM3_CS, 1); 292 gpio_direction_output(16 + SEEPROM3_CS, 1);
364 txx9_spi_init(TX4938_SPI_REG & 0xfffffffffULL, RBTX4938_IRQ_IRC_SPI); 293 tx4938_spi_init(0);
365 return 0; 294 return 0;
366} 295}
367 296
@@ -372,30 +301,11 @@ static void __init rbtx4938_arch_init(void)
372 rbtx4938_spi_init(); 301 rbtx4938_spi_init();
373} 302}
374 303
375/* Watchdog support */
376
377static int __init txx9_wdt_init(unsigned long base)
378{
379 struct resource res = {
380 .start = base,
381 .end = base + 0x100 - 1,
382 .flags = IORESOURCE_MEM,
383 };
384 struct platform_device *dev =
385 platform_device_register_simple("txx9wdt", -1, &res, 1);
386 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
387}
388
389static int __init rbtx4938_wdt_init(void)
390{
391 return txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL);
392}
393
394static void __init rbtx4938_device_init(void) 304static void __init rbtx4938_device_init(void)
395{ 305{
396 rbtx4938_ethaddr_init(); 306 rbtx4938_ethaddr_init();
397 rbtx4938_ne_init(); 307 rbtx4938_ne_init();
398 rbtx4938_wdt_init(); 308 tx4938_wdt_init();
399} 309}
400 310
401struct txx9_board_vec rbtx4938_vec __initdata = { 311struct txx9_board_vec rbtx4938_vec __initdata = {
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index fe88418167c5..63c9cafda9c4 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -42,6 +42,9 @@ config GENERIC_HARDIRQS
42 bool 42 bool
43 default y 43 default y
44 44
45config HAVE_GET_USER_PAGES_FAST
46 def_bool PPC64
47
45config HAVE_SETUP_PER_CPU_AREA 48config HAVE_SETUP_PER_CPU_AREA
46 def_bool PPC64 49 def_bool PPC64
47 50
@@ -117,6 +120,7 @@ config PPC
117 select HAVE_KPROBES 120 select HAVE_KPROBES
118 select HAVE_ARCH_KGDB 121 select HAVE_ARCH_KGDB
119 select HAVE_KRETPROBES 122 select HAVE_KRETPROBES
123 select HAVE_ARCH_TRACEHOOK
120 select HAVE_LMB 124 select HAVE_LMB
121 select HAVE_DMA_ATTRS if PPC64 125 select HAVE_DMA_ATTRS if PPC64
122 select USE_GENERIC_SMP_HELPERS if SMP 126 select USE_GENERIC_SMP_HELPERS if SMP
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 7345743d3d96..fbc930410ff6 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -68,6 +68,7 @@
68 #address-cells = <1>; 68 #address-cells = <1>;
69 #size-cells = <1>; 69 #size-cells = <1>;
70 device_type = "soc"; 70 device_type = "soc";
71 compatible = "simple-bus";
71 ranges = <0x0 0xe0000000 0x00100000>; 72 ranges = <0x0 0xe0000000 0x00100000>;
72 reg = <0xe0000000 0x00000200>; 73 reg = <0xe0000000 0x00000200>;
73 bus-frequency = <132000000>; 74 bus-frequency = <132000000>;
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index e74c045a0f8c..b157d1885a28 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -51,6 +51,7 @@
51 #address-cells = <1>; 51 #address-cells = <1>;
52 #size-cells = <1>; 52 #size-cells = <1>;
53 device_type = "soc"; 53 device_type = "soc";
54 compatible = "simple-bus";
54 ranges = <0x0 0xe0000000 0x00100000>; 55 ranges = <0x0 0xe0000000 0x00100000>;
55 reg = <0xe0000000 0x00000200>; 56 reg = <0xe0000000 0x00000200>;
56 bus-frequency = <0>; 57 bus-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 8dfab5662585..700e076ef3f5 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -52,6 +52,7 @@
52 #address-cells = <1>; 52 #address-cells = <1>;
53 #size-cells = <1>; 53 #size-cells = <1>;
54 device_type = "soc"; 54 device_type = "soc";
55 compatible = "simple-bus";
55 ranges = <0x0 0xe0000000 0x00100000>; 56 ranges = <0x0 0xe0000000 0x00100000>;
56 reg = <0xe0000000 0x00000200>; 57 reg = <0xe0000000 0x00000200>;
57 bus-frequency = <0>; // from bootloader 58 bus-frequency = <0>; // from bootloader
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index 49ca3497eefb..cdd3063258ea 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -50,6 +50,7 @@
50 #address-cells = <1>; 50 #address-cells = <1>;
51 #size-cells = <1>; 51 #size-cells = <1>;
52 device_type = "soc"; 52 device_type = "soc";
53 compatible = "simple-bus";
53 ranges = <0x0 0xe0000000 0x00100000>; 54 ranges = <0x0 0xe0000000 0x00100000>;
54 reg = <0xe0000000 0x00000200>; 55 reg = <0xe0000000 0x00000200>;
55 bus-frequency = <0>; // from bootloader 56 bus-frequency = <0>; // from bootloader
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts b/arch/powerpc/boot/dts/mpc834x_mds.dts
index ba586cb7afbb..783241c00240 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -57,6 +57,7 @@
57 #address-cells = <1>; 57 #address-cells = <1>;
58 #size-cells = <1>; 58 #size-cells = <1>;
59 device_type = "soc"; 59 device_type = "soc";
60 compatible = "simple-bus";
60 ranges = <0x0 0xe0000000 0x00100000>; 61 ranges = <0x0 0xe0000000 0x00100000>;
61 reg = <0xe0000000 0x00000200>; 62 reg = <0xe0000000 0x00000200>;
62 bus-frequency = <0>; 63 bus-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 3701dae1ee02..a3b76a709951 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -61,6 +61,7 @@
61 #address-cells = <1>; 61 #address-cells = <1>;
62 #size-cells = <1>; 62 #size-cells = <1>;
63 device_type = "soc"; 63 device_type = "soc";
64 compatible = "simple-bus";
64 ranges = <0x0 0xe0000000 0x00100000>; 65 ranges = <0x0 0xe0000000 0x00100000>;
65 reg = <0xe0000000 0x00000200>; 66 reg = <0xe0000000 0x00000200>;
66 bus-frequency = <264000000>; 67 bus-frequency = <264000000>;
diff --git a/arch/powerpc/boot/dts/mpc836x_rdk.dts b/arch/powerpc/boot/dts/mpc836x_rdk.dts
index 8acd1d6577f2..89c9202f8bd7 100644
--- a/arch/powerpc/boot/dts/mpc836x_rdk.dts
+++ b/arch/powerpc/boot/dts/mpc836x_rdk.dts
@@ -149,18 +149,14 @@
149 }; 149 };
150 150
151 crypto@30000 { 151 crypto@30000 {
152 compatible = "fsl,sec2-crypto"; 152 compatible = "fsl,sec2.0";
153 reg = <0x30000 0x10000>; 153 reg = <0x30000 0x10000>;
154 interrupts = <11 8>; 154 interrupts = <11 0x8>;
155 interrupt-parent = <&ipic>; 155 interrupt-parent = <&ipic>;
156 num-channels = <4>; 156 fsl,num-channels = <4>;
157 channel-fifo-len = <24>; 157 fsl,channel-fifo-len = <24>;
158 exec-units-mask = <0x7e>; 158 fsl,exec-units-mask = <0x7e>;
159 /* 159 fsl,descriptor-types-mask = <0x01010ebf>;
160 * desc mask is for rev1.x, we need runtime fixup
161 * for >=2.x
162 */
163 descriptor-types-mask = <0x1010ebf>;
164 }; 160 };
165 161
166 ipic: interrupt-controller@700 { 162 ipic: interrupt-controller@700 {
diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
index 0a700cb5f611..432782b6d20a 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -117,6 +117,7 @@
117 #address-cells = <1>; 117 #address-cells = <1>;
118 #size-cells = <1>; 118 #size-cells = <1>;
119 device_type = "soc"; 119 device_type = "soc";
120 compatible = "simple-bus";
120 ranges = <0x0 0xe0000000 0x00100000>; 121 ranges = <0x0 0xe0000000 0x00100000>;
121 reg = <0xe0000000 0x00000200>; 122 reg = <0xe0000000 0x00000200>;
122 bus-frequency = <0>; 123 bus-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts b/arch/powerpc/boot/dts/mpc8378_mds.dts
index 29c8c76a58f7..ed32c8ddafe3 100644
--- a/arch/powerpc/boot/dts/mpc8378_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
@@ -117,6 +117,7 @@
117 #address-cells = <1>; 117 #address-cells = <1>;
118 #size-cells = <1>; 118 #size-cells = <1>;
119 device_type = "soc"; 119 device_type = "soc";
120 compatible = "simple-bus";
120 ranges = <0x0 0xe0000000 0x00100000>; 121 ranges = <0x0 0xe0000000 0x00100000>;
121 reg = <0xe0000000 0x00000200>; 122 reg = <0xe0000000 0x00000200>;
122 bus-frequency = <0>; 123 bus-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc8379_mds.dts b/arch/powerpc/boot/dts/mpc8379_mds.dts
index d641a8985ea3..f4db9ed4a301 100644
--- a/arch/powerpc/boot/dts/mpc8379_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8379_mds.dts
@@ -117,6 +117,7 @@
117 #address-cells = <1>; 117 #address-cells = <1>;
118 #size-cells = <1>; 118 #size-cells = <1>;
119 device_type = "soc"; 119 device_type = "soc";
120 compatible = "simple-bus";
120 ranges = <0x0 0xe0000000 0x00100000>; 121 ranges = <0x0 0xe0000000 0x00100000>;
121 reg = <0xe0000000 0x00000200>; 122 reg = <0xe0000000 0x00000200>;
122 bus-frequency = <0>; 123 bus-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc8536ds.dts b/arch/powerpc/boot/dts/mpc8536ds.dts
index 02cfa24a1695..1505d6855eff 100644
--- a/arch/powerpc/boot/dts/mpc8536ds.dts
+++ b/arch/powerpc/boot/dts/mpc8536ds.dts
@@ -49,6 +49,7 @@
49 #address-cells = <1>; 49 #address-cells = <1>;
50 #size-cells = <1>; 50 #size-cells = <1>;
51 device_type = "soc"; 51 device_type = "soc";
52 compatible = "simple-bus";
52 ranges = <0x0 0xffe00000 0x100000>; 53 ranges = <0x0 0xffe00000 0x100000>;
53 reg = <0xffe00000 0x1000>; 54 reg = <0xffe00000 0x1000>;
54 bus-frequency = <0>; // Filled out by uboot. 55 bus-frequency = <0>; // Filled out by uboot.
diff --git a/arch/powerpc/boot/dts/mpc8540ads.dts b/arch/powerpc/boot/dts/mpc8540ads.dts
index f2273a872b11..9568bfaff8f7 100644
--- a/arch/powerpc/boot/dts/mpc8540ads.dts
+++ b/arch/powerpc/boot/dts/mpc8540ads.dts
@@ -53,6 +53,7 @@
53 #address-cells = <1>; 53 #address-cells = <1>;
54 #size-cells = <1>; 54 #size-cells = <1>;
55 device_type = "soc"; 55 device_type = "soc";
56 compatible = "simple-bus";
56 ranges = <0x0 0xe0000000 0x100000>; 57 ranges = <0x0 0xe0000000 0x100000>;
57 reg = <0xe0000000 0x100000>; // CCSRBAR 1M 58 reg = <0xe0000000 0x100000>; // CCSRBAR 1M
58 bus-frequency = <0>; 59 bus-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc8541cds.dts b/arch/powerpc/boot/dts/mpc8541cds.dts
index c4469f19ff82..6480f4fd96e0 100644
--- a/arch/powerpc/boot/dts/mpc8541cds.dts
+++ b/arch/powerpc/boot/dts/mpc8541cds.dts
@@ -53,6 +53,7 @@
53 #address-cells = <1>; 53 #address-cells = <1>;
54 #size-cells = <1>; 54 #size-cells = <1>;
55 device_type = "soc"; 55 device_type = "soc";
56 compatible = "simple-bus";
56 ranges = <0x0 0xe0000000 0x100000>; 57 ranges = <0x0 0xe0000000 0x100000>;
57 reg = <0xe0000000 0x1000>; // CCSRBAR 1M 58 reg = <0xe0000000 0x1000>; // CCSRBAR 1M
58 bus-frequency = <0>; 59 bus-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
index 7d3829d3495e..f1fb20737e3e 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -54,6 +54,7 @@
54 #address-cells = <1>; 54 #address-cells = <1>;
55 #size-cells = <1>; 55 #size-cells = <1>;
56 device_type = "soc"; 56 device_type = "soc";
57 compatible = "simple-bus";
57 58
58 ranges = <0x0 0xe0000000 0x100000>; 59 ranges = <0x0 0xe0000000 0x100000>;
59 reg = <0xe0000000 0x1000>; // CCSRBAR 1M 60 reg = <0xe0000000 0x1000>; // CCSRBAR 1M
diff --git a/arch/powerpc/boot/dts/mpc8548cds.dts b/arch/powerpc/boot/dts/mpc8548cds.dts
index d84466bb7eca..431b496270dc 100644
--- a/arch/powerpc/boot/dts/mpc8548cds.dts
+++ b/arch/powerpc/boot/dts/mpc8548cds.dts
@@ -58,6 +58,7 @@
58 #address-cells = <1>; 58 #address-cells = <1>;
59 #size-cells = <1>; 59 #size-cells = <1>;
60 device_type = "soc"; 60 device_type = "soc";
61 compatible = "simple-bus";
61 ranges = <0x0 0xe0000000 0x100000>; 62 ranges = <0x0 0xe0000000 0x100000>;
62 reg = <0xe0000000 0x1000>; // CCSRBAR 63 reg = <0xe0000000 0x1000>; // CCSRBAR
63 bus-frequency = <0>; 64 bus-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc8555cds.dts b/arch/powerpc/boot/dts/mpc8555cds.dts
index e03a78006283..d833a5c4f476 100644
--- a/arch/powerpc/boot/dts/mpc8555cds.dts
+++ b/arch/powerpc/boot/dts/mpc8555cds.dts
@@ -53,6 +53,7 @@
53 #address-cells = <1>; 53 #address-cells = <1>;
54 #size-cells = <1>; 54 #size-cells = <1>;
55 device_type = "soc"; 55 device_type = "soc";
56 compatible = "simple-bus";
56 ranges = <0x0 0xe0000000 0x100000>; 57 ranges = <0x0 0xe0000000 0x100000>;
57 reg = <0xe0000000 0x1000>; // CCSRBAR 1M 58 reg = <0xe0000000 0x1000>; // CCSRBAR 1M
58 bus-frequency = <0>; 59 bus-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts
index ba8159de040b..4d1f2f284094 100644
--- a/arch/powerpc/boot/dts/mpc8560ads.dts
+++ b/arch/powerpc/boot/dts/mpc8560ads.dts
@@ -53,6 +53,7 @@
53 #address-cells = <1>; 53 #address-cells = <1>;
54 #size-cells = <1>; 54 #size-cells = <1>;
55 device_type = "soc"; 55 device_type = "soc";
56 compatible = "simple-bus";
56 ranges = <0x0 0xe0000000 0x100000>; 57 ranges = <0x0 0xe0000000 0x100000>;
57 reg = <0xe0000000 0x200>; 58 reg = <0xe0000000 0x200>;
58 bus-frequency = <330000000>; 59 bus-frequency = <330000000>;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 9c30a34821dc..a15f10343f53 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -60,6 +60,7 @@
60 #address-cells = <1>; 60 #address-cells = <1>;
61 #size-cells = <1>; 61 #size-cells = <1>;
62 device_type = "soc"; 62 device_type = "soc";
63 compatible = "simple-bus";
63 ranges = <0x0 0xe0000000 0x100000>; 64 ranges = <0x0 0xe0000000 0x100000>;
64 reg = <0xe0000000 0x1000>; 65 reg = <0xe0000000 0x1000>;
65 bus-frequency = <0>; 66 bus-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc8572ds.dts b/arch/powerpc/boot/dts/mpc8572ds.dts
index 08c61e3daecc..e124dd18fb5a 100644
--- a/arch/powerpc/boot/dts/mpc8572ds.dts
+++ b/arch/powerpc/boot/dts/mpc8572ds.dts
@@ -68,6 +68,7 @@
68 #address-cells = <1>; 68 #address-cells = <1>;
69 #size-cells = <1>; 69 #size-cells = <1>;
70 device_type = "soc"; 70 device_type = "soc";
71 compatible = "simple-bus";
71 ranges = <0x0 0xffe00000 0x100000>; 72 ranges = <0x0 0xffe00000 0x100000>;
72 reg = <0xffe00000 0x1000>; // CCSRBAR & soc regs, remove once parse code for immrbase fixed 73 reg = <0xffe00000 0x1000>; // CCSRBAR & soc regs, remove once parse code for immrbase fixed
73 bus-frequency = <0>; // Filled out by uboot. 74 bus-frequency = <0>; // Filled out by uboot.
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 81c8324a4a3c..1cbbf7033641 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -148,7 +148,7 @@ transfer_to_handler:
148 /* Check to see if the dbcr0 register is set up to debug. Use the 148 /* Check to see if the dbcr0 register is set up to debug. Use the
149 internal debug mode bit to do this. */ 149 internal debug mode bit to do this. */
150 lwz r12,THREAD_DBCR0(r12) 150 lwz r12,THREAD_DBCR0(r12)
151 andis. r12,r12,(DBCR0_IDM | DBSR_DAC1R | DBSR_DAC1W)@h 151 andis. r12,r12,DBCR0_IDM@h
152 beq+ 3f 152 beq+ 3f
153 /* From user and task is ptraced - load up global dbcr0 */ 153 /* From user and task is ptraced - load up global dbcr0 */
154 li r12,-1 /* clear all pending debug events */ 154 li r12,-1 /* clear all pending debug events */
@@ -292,7 +292,7 @@ syscall_exit_cont:
292 /* If the process has its own DBCR0 value, load it up. The internal 292 /* If the process has its own DBCR0 value, load it up. The internal
293 debug mode bit tells us that dbcr0 should be loaded. */ 293 debug mode bit tells us that dbcr0 should be loaded. */
294 lwz r0,THREAD+THREAD_DBCR0(r2) 294 lwz r0,THREAD+THREAD_DBCR0(r2)
295 andis. r10,r0,(DBCR0_IDM | DBSR_DAC1R | DBSR_DAC1W)@h 295 andis. r10,r0,DBCR0_IDM@h
296 bnel- load_dbcr0 296 bnel- load_dbcr0
297#endif 297#endif
298#ifdef CONFIG_44x 298#ifdef CONFIG_44x
@@ -343,7 +343,12 @@ syscall_dotrace:
343 stw r0,_TRAP(r1) 343 stw r0,_TRAP(r1)
344 addi r3,r1,STACK_FRAME_OVERHEAD 344 addi r3,r1,STACK_FRAME_OVERHEAD
345 bl do_syscall_trace_enter 345 bl do_syscall_trace_enter
346 lwz r0,GPR0(r1) /* Restore original registers */ 346 /*
347 * Restore argument registers possibly just changed.
348 * We use the return value of do_syscall_trace_enter
349 * for call number to look up in the table (r0).
350 */
351 mr r0,r3
347 lwz r3,GPR3(r1) 352 lwz r3,GPR3(r1)
348 lwz r4,GPR4(r1) 353 lwz r4,GPR4(r1)
349 lwz r5,GPR5(r1) 354 lwz r5,GPR5(r1)
@@ -720,7 +725,7 @@ restore_user:
720 /* Check whether this process has its own DBCR0 value. The internal 725 /* Check whether this process has its own DBCR0 value. The internal
721 debug mode bit tells us that dbcr0 should be loaded. */ 726 debug mode bit tells us that dbcr0 should be loaded. */
722 lwz r0,THREAD+THREAD_DBCR0(r2) 727 lwz r0,THREAD+THREAD_DBCR0(r2)
723 andis. r10,r0,(DBCR0_IDM | DBSR_DAC1R | DBSR_DAC1W)@h 728 andis. r10,r0,DBCR0_IDM@h
724 bnel- load_dbcr0 729 bnel- load_dbcr0
725#endif 730#endif
726 731
@@ -1055,8 +1060,8 @@ do_user_signal: /* r10 contains MSR_KERNEL here */
1055 SAVE_NVGPRS(r1) 1060 SAVE_NVGPRS(r1)
1056 rlwinm r3,r3,0,0,30 1061 rlwinm r3,r3,0,0,30
1057 stw r3,_TRAP(r1) 1062 stw r3,_TRAP(r1)
10582: li r3,0 10632: addi r3,r1,STACK_FRAME_OVERHEAD
1059 addi r4,r1,STACK_FRAME_OVERHEAD 1064 mr r4,r9
1060 bl do_signal 1065 bl do_signal
1061 REST_NVGPRS(r1) 1066 REST_NVGPRS(r1)
1062 b recheck 1067 b recheck
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index d7369243ae44..2d802e97097c 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -214,7 +214,12 @@ syscall_dotrace:
214 bl .save_nvgprs 214 bl .save_nvgprs
215 addi r3,r1,STACK_FRAME_OVERHEAD 215 addi r3,r1,STACK_FRAME_OVERHEAD
216 bl .do_syscall_trace_enter 216 bl .do_syscall_trace_enter
217 ld r0,GPR0(r1) /* Restore original registers */ 217 /*
218 * Restore argument registers possibly just changed.
219 * We use the return value of do_syscall_trace_enter
220 * for the call number to look up in the table (r0).
221 */
222 mr r0,r3
218 ld r3,GPR3(r1) 223 ld r3,GPR3(r1)
219 ld r4,GPR4(r1) 224 ld r4,GPR4(r1)
220 ld r5,GPR5(r1) 225 ld r5,GPR5(r1)
@@ -638,8 +643,7 @@ user_work:
638 b .ret_from_except_lite 643 b .ret_from_except_lite
639 644
6401: bl .save_nvgprs 6451: bl .save_nvgprs
641 li r3,0 646 addi r3,r1,STACK_FRAME_OVERHEAD
642 addi r4,r1,STACK_FRAME_OVERHEAD
643 bl .do_signal 647 bl .do_signal
644 b .ret_from_except 648 b .ret_from_except
645 649
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 4d96e1db55ee..9ddfaef1a184 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -493,18 +493,18 @@ static int __init serial_dev_init(void)
493device_initcall(serial_dev_init); 493device_initcall(serial_dev_init);
494 494
495 495
496#ifdef CONFIG_SERIAL_8250_CONSOLE
496/* 497/*
497 * This is called very early, as part of console_init() (typically just after 498 * This is called very early, as part of console_init() (typically just after
498 * time_init()). This function is respondible for trying to find a good 499 * time_init()). This function is respondible for trying to find a good
499 * default console on serial ports. It tries to match the open firmware 500 * default console on serial ports. It tries to match the open firmware
500 * default output with one of the available serial console drivers, either 501 * default output with one of the available serial console drivers that have
501 * one of the platform serial ports that have been probed earlier by 502 * been probed earlier by find_legacy_serial_ports()
502 * find_legacy_serial_ports() or some more platform specific ones.
503 */ 503 */
504static int __init check_legacy_serial_console(void) 504static int __init check_legacy_serial_console(void)
505{ 505{
506 struct device_node *prom_stdout = NULL; 506 struct device_node *prom_stdout = NULL;
507 int speed = 0, offset = 0; 507 int i, speed = 0, offset = 0;
508 const char *name; 508 const char *name;
509 const u32 *spd; 509 const u32 *spd;
510 510
@@ -548,31 +548,20 @@ static int __init check_legacy_serial_console(void)
548 if (spd) 548 if (spd)
549 speed = *spd; 549 speed = *spd;
550 550
551 if (0) 551 if (strcmp(name, "serial") != 0)
552 ; 552 goto not_found;
553#ifdef CONFIG_SERIAL_8250_CONSOLE 553
554 else if (strcmp(name, "serial") == 0) { 554 /* Look for it in probed array */
555 int i; 555 for (i = 0; i < legacy_serial_count; i++) {
556 /* Look for it in probed array */ 556 if (prom_stdout != legacy_serial_infos[i].np)
557 for (i = 0; i < legacy_serial_count; i++) { 557 continue;
558 if (prom_stdout != legacy_serial_infos[i].np) 558 offset = i;
559 continue; 559 speed = legacy_serial_infos[i].speed;
560 offset = i; 560 break;
561 speed = legacy_serial_infos[i].speed;
562 break;
563 }
564 if (i >= legacy_serial_count)
565 goto not_found;
566 } 561 }
567#endif /* CONFIG_SERIAL_8250_CONSOLE */ 562 if (i >= legacy_serial_count)
568#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
569 else if (strcmp(name, "ch-a") == 0)
570 offset = 0;
571 else if (strcmp(name, "ch-b") == 0)
572 offset = 1;
573#endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
574 else
575 goto not_found; 563 goto not_found;
564
576 of_node_put(prom_stdout); 565 of_node_put(prom_stdout);
577 566
578 DBG("Found serial console at ttyS%d\n", offset); 567 DBG("Found serial console at ttyS%d\n", offset);
@@ -591,3 +580,4 @@ static int __init check_legacy_serial_console(void)
591} 580}
592console_initcall(check_legacy_serial_console); 581console_initcall(check_legacy_serial_console);
593 582
583#endif /* CONFIG_SERIAL_8250_CONSOLE */
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 9f856a0c3e38..1a09719c7628 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -636,10 +636,6 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
636 retval = -EIO; 636 retval = -EIO;
637 } else if (retval == H_PARAMETER) { 637 } else if (retval == H_PARAMETER) {
638 retval = -EINVAL; 638 retval = -EINVAL;
639 } else {
640 printk(KERN_WARNING "%s: received unknown hv return code %ld",
641 __func__, retval);
642 retval = -EIO;
643 } 639 }
644 640
645 return retval; 641 return retval;
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index db2497ccc111..e030f3bd5024 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -254,7 +254,7 @@ void do_dabr(struct pt_regs *regs, unsigned long address,
254 return; 254 return;
255 255
256 /* Clear the DAC and struct entries. One shot trigger */ 256 /* Clear the DAC and struct entries. One shot trigger */
257#if (defined(CONFIG_44x) || defined(CONFIG_BOOKE)) 257#if defined(CONFIG_BOOKE)
258 mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~(DBSR_DAC1R | DBSR_DAC1W 258 mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) & ~(DBSR_DAC1R | DBSR_DAC1W
259 | DBCR0_IDM)); 259 | DBCR0_IDM));
260#endif 260#endif
@@ -286,7 +286,7 @@ int set_dabr(unsigned long dabr)
286 mtspr(SPRN_DABR, dabr); 286 mtspr(SPRN_DABR, dabr);
287#endif 287#endif
288 288
289#if defined(CONFIG_44x) || defined(CONFIG_BOOKE) 289#if defined(CONFIG_BOOKE)
290 mtspr(SPRN_DAC1, dabr); 290 mtspr(SPRN_DAC1, dabr);
291#endif 291#endif
292 292
@@ -373,7 +373,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
373 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) 373 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
374 set_dabr(new->thread.dabr); 374 set_dabr(new->thread.dabr);
375 375
376#if defined(CONFIG_44x) || defined(CONFIG_BOOKE) 376#if defined(CONFIG_BOOKE)
377 /* If new thread DAC (HW breakpoint) is the same then leave it */ 377 /* If new thread DAC (HW breakpoint) is the same then leave it */
378 if (new->thread.dabr) 378 if (new->thread.dabr)
379 set_dabr(new->thread.dabr); 379 set_dabr(new->thread.dabr);
@@ -568,7 +568,7 @@ void flush_thread(void)
568 current->thread.dabr = 0; 568 current->thread.dabr = 0;
569 set_dabr(0); 569 set_dabr(0);
570 570
571#if defined(CONFIG_44x) || defined(CONFIG_BOOKE) 571#if defined(CONFIG_BOOKE)
572 current->thread.dbcr0 &= ~(DBSR_DAC1R | DBSR_DAC1W); 572 current->thread.dbcr0 &= ~(DBSR_DAC1R | DBSR_DAC1W);
573#endif 573#endif
574 } 574 }
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index c4ab2195b9cb..b72849ac7db3 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -205,8 +205,6 @@ static int __initdata mem_reserve_cnt;
205static cell_t __initdata regbuf[1024]; 205static cell_t __initdata regbuf[1024];
206 206
207 207
208#define MAX_CPU_THREADS 2
209
210/* 208/*
211 * Error results ... some OF calls will return "-1" on error, some 209 * Error results ... some OF calls will return "-1" on error, some
212 * will return 0, some will return either. To simplify, here are 210 * will return 0, some will return either. To simplify, here are
@@ -1339,10 +1337,6 @@ static void __init prom_hold_cpus(void)
1339 unsigned int reg; 1337 unsigned int reg;
1340 phandle node; 1338 phandle node;
1341 char type[64]; 1339 char type[64];
1342 int cpuid = 0;
1343 unsigned int interrupt_server[MAX_CPU_THREADS];
1344 unsigned int cpu_threads, hw_cpu_num;
1345 int propsize;
1346 struct prom_t *_prom = &RELOC(prom); 1340 struct prom_t *_prom = &RELOC(prom);
1347 unsigned long *spinloop 1341 unsigned long *spinloop
1348 = (void *) LOW_ADDR(__secondary_hold_spinloop); 1342 = (void *) LOW_ADDR(__secondary_hold_spinloop);
@@ -1386,7 +1380,6 @@ static void __init prom_hold_cpus(void)
1386 reg = -1; 1380 reg = -1;
1387 prom_getprop(node, "reg", &reg, sizeof(reg)); 1381 prom_getprop(node, "reg", &reg, sizeof(reg));
1388 1382
1389 prom_debug("\ncpuid = 0x%x\n", cpuid);
1390 prom_debug("cpu hw idx = 0x%x\n", reg); 1383 prom_debug("cpu hw idx = 0x%x\n", reg);
1391 1384
1392 /* Init the acknowledge var which will be reset by 1385 /* Init the acknowledge var which will be reset by
@@ -1395,28 +1388,9 @@ static void __init prom_hold_cpus(void)
1395 */ 1388 */
1396 *acknowledge = (unsigned long)-1; 1389 *acknowledge = (unsigned long)-1;
1397 1390
1398 propsize = prom_getprop(node, "ibm,ppc-interrupt-server#s", 1391 if (reg != _prom->cpu) {
1399 &interrupt_server,
1400 sizeof(interrupt_server));
1401 if (propsize < 0) {
1402 /* no property. old hardware has no SMT */
1403 cpu_threads = 1;
1404 interrupt_server[0] = reg; /* fake it with phys id */
1405 } else {
1406 /* We have a threaded processor */
1407 cpu_threads = propsize / sizeof(u32);
1408 if (cpu_threads > MAX_CPU_THREADS) {
1409 prom_printf("SMT: too many threads!\n"
1410 "SMT: found %x, max is %x\n",
1411 cpu_threads, MAX_CPU_THREADS);
1412 cpu_threads = 1; /* ToDo: panic? */
1413 }
1414 }
1415
1416 hw_cpu_num = interrupt_server[0];
1417 if (hw_cpu_num != _prom->cpu) {
1418 /* Primary Thread of non-boot cpu */ 1392 /* Primary Thread of non-boot cpu */
1419 prom_printf("%x : starting cpu hw idx %x... ", cpuid, reg); 1393 prom_printf("starting cpu hw idx %x... ", reg);
1420 call_prom("start-cpu", 3, 0, node, 1394 call_prom("start-cpu", 3, 0, node,
1421 secondary_hold, reg); 1395 secondary_hold, reg);
1422 1396
@@ -1431,17 +1405,10 @@ static void __init prom_hold_cpus(void)
1431 } 1405 }
1432#ifdef CONFIG_SMP 1406#ifdef CONFIG_SMP
1433 else 1407 else
1434 prom_printf("%x : boot cpu %x\n", cpuid, reg); 1408 prom_printf("boot cpu hw idx %x\n", reg);
1435#endif /* CONFIG_SMP */ 1409#endif /* CONFIG_SMP */
1436
1437 /* Reserve cpu #s for secondary threads. They start later. */
1438 cpuid += cpu_threads;
1439 } 1410 }
1440 1411
1441 if (cpuid > NR_CPUS)
1442 prom_printf("WARNING: maximum CPUs (" __stringify(NR_CPUS)
1443 ") exceeded: ignoring extras\n");
1444
1445 prom_debug("prom_hold_cpus: end...\n"); 1412 prom_debug("prom_hold_cpus: end...\n");
1446} 1413}
1447 1414
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index a5d0e78779c8..3635be61f899 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -22,6 +22,7 @@
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/ptrace.h> 23#include <linux/ptrace.h>
24#include <linux/regset.h> 24#include <linux/regset.h>
25#include <linux/tracehook.h>
25#include <linux/elf.h> 26#include <linux/elf.h>
26#include <linux/user.h> 27#include <linux/user.h>
27#include <linux/security.h> 28#include <linux/security.h>
@@ -374,7 +375,7 @@ static int vsr_get(struct task_struct *target, const struct user_regset *regset,
374 flush_vsx_to_thread(target); 375 flush_vsx_to_thread(target);
375 376
376 for (i = 0; i < 32 ; i++) 377 for (i = 0; i < 32 ; i++)
377 buf[i] = current->thread.fpr[i][TS_VSRLOWOFFSET]; 378 buf[i] = target->thread.fpr[i][TS_VSRLOWOFFSET];
378 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, 379 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
379 buf, 0, 32 * sizeof(double)); 380 buf, 0, 32 * sizeof(double));
380 381
@@ -393,7 +394,7 @@ static int vsr_set(struct task_struct *target, const struct user_regset *regset,
393 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, 394 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
394 buf, 0, 32 * sizeof(double)); 395 buf, 0, 32 * sizeof(double));
395 for (i = 0; i < 32 ; i++) 396 for (i = 0; i < 32 ; i++)
396 current->thread.fpr[i][TS_VSRLOWOFFSET] = buf[i]; 397 target->thread.fpr[i][TS_VSRLOWOFFSET] = buf[i];
397 398
398 399
399 return ret; 400 return ret;
@@ -717,7 +718,7 @@ void user_disable_single_step(struct task_struct *task)
717 struct pt_regs *regs = task->thread.regs; 718 struct pt_regs *regs = task->thread.regs;
718 719
719 720
720#if defined(CONFIG_44x) || defined(CONFIG_BOOKE) 721#if defined(CONFIG_BOOKE)
721 /* If DAC then do not single step, skip */ 722 /* If DAC then do not single step, skip */
722 if (task->thread.dabr) 723 if (task->thread.dabr)
723 return; 724 return;
@@ -744,10 +745,11 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
744 if (addr > 0) 745 if (addr > 0)
745 return -EINVAL; 746 return -EINVAL;
746 747
748 /* The bottom 3 bits in dabr are flags */
747 if ((data & ~0x7UL) >= TASK_SIZE) 749 if ((data & ~0x7UL) >= TASK_SIZE)
748 return -EIO; 750 return -EIO;
749 751
750#ifdef CONFIG_PPC64 752#ifndef CONFIG_BOOKE
751 753
752 /* For processors using DABR (i.e. 970), the bottom 3 bits are flags. 754 /* For processors using DABR (i.e. 970), the bottom 3 bits are flags.
753 * It was assumed, on previous implementations, that 3 bits were 755 * It was assumed, on previous implementations, that 3 bits were
@@ -769,7 +771,7 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
769 task->thread.dabr = data; 771 task->thread.dabr = data;
770 772
771#endif 773#endif
772#if defined(CONFIG_44x) || defined(CONFIG_BOOKE) 774#if defined(CONFIG_BOOKE)
773 775
774 /* As described above, it was assumed 3 bits were passed with the data 776 /* As described above, it was assumed 3 bits were passed with the data
775 * address, but we will assume only the mode bits will be passed 777 * address, but we will assume only the mode bits will be passed
@@ -973,15 +975,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
973 case PTRACE_GETVSRREGS: 975 case PTRACE_GETVSRREGS:
974 return copy_regset_to_user(child, &user_ppc_native_view, 976 return copy_regset_to_user(child, &user_ppc_native_view,
975 REGSET_VSX, 977 REGSET_VSX,
976 0, (32 * sizeof(vector128) + 978 0, 32 * sizeof(double),
977 sizeof(u32)),
978 (void __user *) data); 979 (void __user *) data);
979 980
980 case PTRACE_SETVSRREGS: 981 case PTRACE_SETVSRREGS:
981 return copy_regset_from_user(child, &user_ppc_native_view, 982 return copy_regset_from_user(child, &user_ppc_native_view,
982 REGSET_VSX, 983 REGSET_VSX,
983 0, (32 * sizeof(vector128) + 984 0, 32 * sizeof(double),
984 sizeof(u32)),
985 (const void __user *) data); 985 (const void __user *) data);
986#endif 986#endif
987#ifdef CONFIG_SPE 987#ifdef CONFIG_SPE
@@ -1013,31 +1013,24 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1013 return ret; 1013 return ret;
1014} 1014}
1015 1015
1016static void do_syscall_trace(void) 1016/*
1017 * We must return the syscall number to actually look up in the table.
1018 * This can be -1L to skip running any syscall at all.
1019 */
1020long do_syscall_trace_enter(struct pt_regs *regs)
1017{ 1021{
1018 /* the 0x80 provides a way for the tracing parent to distinguish 1022 long ret = 0;
1019 between a syscall stop and SIGTRAP delivery */
1020 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
1021 ? 0x80 : 0));
1022
1023 /*
1024 * this isn't the same as continuing with a signal, but it will do
1025 * for normal use. strace only continues with a signal if the
1026 * stopping signal is not SIGTRAP. -brl
1027 */
1028 if (current->exit_code) {
1029 send_sig(current->exit_code, current, 1);
1030 current->exit_code = 0;
1031 }
1032}
1033 1023
1034void do_syscall_trace_enter(struct pt_regs *regs)
1035{
1036 secure_computing(regs->gpr[0]); 1024 secure_computing(regs->gpr[0]);
1037 1025
1038 if (test_thread_flag(TIF_SYSCALL_TRACE) 1026 if (test_thread_flag(TIF_SYSCALL_TRACE) &&
1039 && (current->ptrace & PT_PTRACED)) 1027 tracehook_report_syscall_entry(regs))
1040 do_syscall_trace(); 1028 /*
1029 * Tracing decided this syscall should not happen.
1030 * We'll return a bogus call number to get an ENOSYS
1031 * error, but leave the original number in regs->gpr[0].
1032 */
1033 ret = -1L;
1041 1034
1042 if (unlikely(current->audit_context)) { 1035 if (unlikely(current->audit_context)) {
1043#ifdef CONFIG_PPC64 1036#ifdef CONFIG_PPC64
@@ -1055,16 +1048,19 @@ void do_syscall_trace_enter(struct pt_regs *regs)
1055 regs->gpr[5] & 0xffffffff, 1048 regs->gpr[5] & 0xffffffff,
1056 regs->gpr[6] & 0xffffffff); 1049 regs->gpr[6] & 0xffffffff);
1057 } 1050 }
1051
1052 return ret ?: regs->gpr[0];
1058} 1053}
1059 1054
1060void do_syscall_trace_leave(struct pt_regs *regs) 1055void do_syscall_trace_leave(struct pt_regs *regs)
1061{ 1056{
1057 int step;
1058
1062 if (unlikely(current->audit_context)) 1059 if (unlikely(current->audit_context))
1063 audit_syscall_exit((regs->ccr&0x10000000)?AUDITSC_FAILURE:AUDITSC_SUCCESS, 1060 audit_syscall_exit((regs->ccr&0x10000000)?AUDITSC_FAILURE:AUDITSC_SUCCESS,
1064 regs->result); 1061 regs->result);
1065 1062
1066 if ((test_thread_flag(TIF_SYSCALL_TRACE) 1063 step = test_thread_flag(TIF_SINGLESTEP);
1067 || test_thread_flag(TIF_SINGLESTEP)) 1064 if (step || test_thread_flag(TIF_SYSCALL_TRACE))
1068 && (current->ptrace & PT_PTRACED)) 1065 tracehook_report_syscall_exit(regs, step);
1069 do_syscall_trace();
1070} 1066}
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c
index 67bf1a1e7e14..197d49c790ad 100644
--- a/arch/powerpc/kernel/ptrace32.c
+++ b/arch/powerpc/kernel/ptrace32.c
@@ -294,6 +294,8 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
294 case PTRACE_SETFPREGS: 294 case PTRACE_SETFPREGS:
295 case PTRACE_GETVRREGS: 295 case PTRACE_GETVRREGS:
296 case PTRACE_SETVRREGS: 296 case PTRACE_SETVRREGS:
297 case PTRACE_GETVSRREGS:
298 case PTRACE_SETVSRREGS:
297 case PTRACE_GETREGS64: 299 case PTRACE_GETREGS64:
298 case PTRACE_SETREGS64: 300 case PTRACE_SETREGS64:
299 case PPC_PTRACE_GETFPREGS: 301 case PPC_PTRACE_GETFPREGS:
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 61a3f4132087..9cc5a52711e5 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -367,7 +367,6 @@ static void __init cpu_init_thread_core_maps(int tpc)
367 * setup_cpu_maps - initialize the following cpu maps: 367 * setup_cpu_maps - initialize the following cpu maps:
368 * cpu_possible_map 368 * cpu_possible_map
369 * cpu_present_map 369 * cpu_present_map
370 * cpu_sibling_map
371 * 370 *
372 * Having the possible map set up early allows us to restrict allocations 371 * Having the possible map set up early allows us to restrict allocations
373 * of things like irqstacks to num_possible_cpus() rather than NR_CPUS. 372 * of things like irqstacks to num_possible_cpus() rather than NR_CPUS.
@@ -475,29 +474,6 @@ void __init smp_setup_cpu_maps(void)
475 */ 474 */
476 cpu_init_thread_core_maps(nthreads); 475 cpu_init_thread_core_maps(nthreads);
477} 476}
478
479/*
480 * Being that cpu_sibling_map is now a per_cpu array, then it cannot
481 * be initialized until the per_cpu areas have been created. This
482 * function is now called from setup_per_cpu_areas().
483 */
484void __init smp_setup_cpu_sibling_map(void)
485{
486#ifdef CONFIG_PPC64
487 int i, cpu, base;
488
489 for_each_possible_cpu(cpu) {
490 DBG("Sibling map for CPU %d:", cpu);
491 base = cpu_first_thread_in_core(cpu);
492 for (i = 0; i < threads_per_core; i++) {
493 cpu_set(base + i, per_cpu(cpu_sibling_map, cpu));
494 DBG(" %d", base + i);
495 }
496 DBG("\n");
497 }
498
499#endif /* CONFIG_PPC64 */
500}
501#endif /* CONFIG_SMP */ 477#endif /* CONFIG_SMP */
502 478
503#ifdef CONFIG_PCSPKR_PLATFORM 479#ifdef CONFIG_PCSPKR_PLATFORM
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 04d8de9f0fc6..8b25f51f03bf 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -611,9 +611,6 @@ void __init setup_per_cpu_areas(void)
611 paca[i].data_offset = ptr - __per_cpu_start; 611 paca[i].data_offset = ptr - __per_cpu_start;
612 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 612 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
613 } 613 }
614
615 /* Now that per_cpu is setup, initialize cpu_sibling_map */
616 smp_setup_cpu_sibling_map();
617} 614}
618#endif 615#endif
619 616
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index 7aada783ec6a..a54405ebd7b0 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -9,7 +9,7 @@
9 * this archive for more details. 9 * this archive for more details.
10 */ 10 */
11 11
12#include <linux/ptrace.h> 12#include <linux/tracehook.h>
13#include <linux/signal.h> 13#include <linux/signal.h>
14#include <asm/uaccess.h> 14#include <asm/uaccess.h>
15#include <asm/unistd.h> 15#include <asm/unistd.h>
@@ -112,7 +112,7 @@ static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka,
112 } 112 }
113} 113}
114 114
115int do_signal(sigset_t *oldset, struct pt_regs *regs) 115static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs)
116{ 116{
117 siginfo_t info; 117 siginfo_t info;
118 int signr; 118 int signr;
@@ -147,7 +147,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
147 */ 147 */
148 if (current->thread.dabr) { 148 if (current->thread.dabr) {
149 set_dabr(current->thread.dabr); 149 set_dabr(current->thread.dabr);
150#if defined(CONFIG_44x) || defined(CONFIG_BOOKE) 150#if defined(CONFIG_BOOKE)
151 mtspr(SPRN_DBCR0, current->thread.dbcr0); 151 mtspr(SPRN_DBCR0, current->thread.dbcr0);
152#endif 152#endif
153 } 153 }
@@ -177,11 +177,28 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
177 * its frame, and we can clear the TLF_RESTORE_SIGMASK flag. 177 * its frame, and we can clear the TLF_RESTORE_SIGMASK flag.
178 */ 178 */
179 current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK; 179 current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK;
180
181 /*
182 * Let tracing know that we've done the handler setup.
183 */
184 tracehook_signal_handler(signr, &info, &ka, regs,
185 test_thread_flag(TIF_SINGLESTEP));
180 } 186 }
181 187
182 return ret; 188 return ret;
183} 189}
184 190
191void do_signal(struct pt_regs *regs, unsigned long thread_info_flags)
192{
193 if (thread_info_flags & _TIF_SIGPENDING)
194 do_signal_pending(NULL, regs);
195
196 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
197 clear_thread_flag(TIF_NOTIFY_RESUME);
198 tracehook_notify_resume(regs);
199 }
200}
201
185long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, 202long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
186 unsigned long r5, unsigned long r6, unsigned long r7, 203 unsigned long r5, unsigned long r6, unsigned long r7,
187 unsigned long r8, struct pt_regs *regs) 204 unsigned long r8, struct pt_regs *regs)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index f5ae9fa222ea..5337ca7bb649 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -41,6 +41,7 @@
41#include <asm/smp.h> 41#include <asm/smp.h>
42#include <asm/time.h> 42#include <asm/time.h>
43#include <asm/machdep.h> 43#include <asm/machdep.h>
44#include <asm/cputhreads.h>
44#include <asm/cputable.h> 45#include <asm/cputable.h>
45#include <asm/system.h> 46#include <asm/system.h>
46#include <asm/mpic.h> 47#include <asm/mpic.h>
@@ -62,10 +63,12 @@ struct thread_info *secondary_ti;
62cpumask_t cpu_possible_map = CPU_MASK_NONE; 63cpumask_t cpu_possible_map = CPU_MASK_NONE;
63cpumask_t cpu_online_map = CPU_MASK_NONE; 64cpumask_t cpu_online_map = CPU_MASK_NONE;
64DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE; 65DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
66DEFINE_PER_CPU(cpumask_t, cpu_core_map) = CPU_MASK_NONE;
65 67
66EXPORT_SYMBOL(cpu_online_map); 68EXPORT_SYMBOL(cpu_online_map);
67EXPORT_SYMBOL(cpu_possible_map); 69EXPORT_SYMBOL(cpu_possible_map);
68EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); 70EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
71EXPORT_PER_CPU_SYMBOL(cpu_core_map);
69 72
70/* SMP operations for this machine */ 73/* SMP operations for this machine */
71struct smp_ops_t *smp_ops; 74struct smp_ops_t *smp_ops;
@@ -228,6 +231,8 @@ void __devinit smp_prepare_boot_cpu(void)
228 BUG_ON(smp_processor_id() != boot_cpuid); 231 BUG_ON(smp_processor_id() != boot_cpuid);
229 232
230 cpu_set(boot_cpuid, cpu_online_map); 233 cpu_set(boot_cpuid, cpu_online_map);
234 cpu_set(boot_cpuid, per_cpu(cpu_sibling_map, boot_cpuid));
235 cpu_set(boot_cpuid, per_cpu(cpu_core_map, boot_cpuid));
231#ifdef CONFIG_PPC64 236#ifdef CONFIG_PPC64
232 paca[boot_cpuid].__current = current; 237 paca[boot_cpuid].__current = current;
233#endif 238#endif
@@ -375,11 +380,60 @@ int __cpuinit __cpu_up(unsigned int cpu)
375 return 0; 380 return 0;
376} 381}
377 382
383/* Return the value of the reg property corresponding to the given
384 * logical cpu.
385 */
386int cpu_to_core_id(int cpu)
387{
388 struct device_node *np;
389 const int *reg;
390 int id = -1;
391
392 np = of_get_cpu_node(cpu, NULL);
393 if (!np)
394 goto out;
395
396 reg = of_get_property(np, "reg", NULL);
397 if (!reg)
398 goto out;
399
400 id = *reg;
401out:
402 of_node_put(np);
403 return id;
404}
405
406/* Must be called when no change can occur to cpu_present_map,
407 * i.e. during cpu online or offline.
408 */
409static struct device_node *cpu_to_l2cache(int cpu)
410{
411 struct device_node *np;
412 const phandle *php;
413 phandle ph;
414
415 if (!cpu_present(cpu))
416 return NULL;
417
418 np = of_get_cpu_node(cpu, NULL);
419 if (np == NULL)
420 return NULL;
421
422 php = of_get_property(np, "l2-cache", NULL);
423 if (php == NULL)
424 return NULL;
425 ph = *php;
426 of_node_put(np);
427
428 return of_find_node_by_phandle(ph);
429}
378 430
379/* Activate a secondary processor. */ 431/* Activate a secondary processor. */
380int __devinit start_secondary(void *unused) 432int __devinit start_secondary(void *unused)
381{ 433{
382 unsigned int cpu = smp_processor_id(); 434 unsigned int cpu = smp_processor_id();
435 struct device_node *l2_cache;
436 int i, base;
383 437
384 atomic_inc(&init_mm.mm_count); 438 atomic_inc(&init_mm.mm_count);
385 current->active_mm = &init_mm; 439 current->active_mm = &init_mm;
@@ -400,6 +454,33 @@ int __devinit start_secondary(void *unused)
400 454
401 ipi_call_lock(); 455 ipi_call_lock();
402 cpu_set(cpu, cpu_online_map); 456 cpu_set(cpu, cpu_online_map);
457 /* Update sibling maps */
458 base = cpu_first_thread_in_core(cpu);
459 for (i = 0; i < threads_per_core; i++) {
460 if (cpu_is_offline(base + i))
461 continue;
462 cpu_set(cpu, per_cpu(cpu_sibling_map, base + i));
463 cpu_set(base + i, per_cpu(cpu_sibling_map, cpu));
464
465 /* cpu_core_map should be a superset of
466 * cpu_sibling_map even if we don't have cache
467 * information, so update the former here, too.
468 */
469 cpu_set(cpu, per_cpu(cpu_core_map, base +i));
470 cpu_set(base + i, per_cpu(cpu_core_map, cpu));
471 }
472 l2_cache = cpu_to_l2cache(cpu);
473 for_each_online_cpu(i) {
474 struct device_node *np = cpu_to_l2cache(i);
475 if (!np)
476 continue;
477 if (np == l2_cache) {
478 cpu_set(cpu, per_cpu(cpu_core_map, i));
479 cpu_set(i, per_cpu(cpu_core_map, cpu));
480 }
481 of_node_put(np);
482 }
483 of_node_put(l2_cache);
403 ipi_call_unlock(); 484 ipi_call_unlock();
404 485
405 local_irq_enable(); 486 local_irq_enable();
@@ -437,10 +518,42 @@ void __init smp_cpus_done(unsigned int max_cpus)
437#ifdef CONFIG_HOTPLUG_CPU 518#ifdef CONFIG_HOTPLUG_CPU
438int __cpu_disable(void) 519int __cpu_disable(void)
439{ 520{
440 if (smp_ops->cpu_disable) 521 struct device_node *l2_cache;
441 return smp_ops->cpu_disable(); 522 int cpu = smp_processor_id();
523 int base, i;
524 int err;
442 525
443 return -ENOSYS; 526 if (!smp_ops->cpu_disable)
527 return -ENOSYS;
528
529 err = smp_ops->cpu_disable();
530 if (err)
531 return err;
532
533 /* Update sibling maps */
534 base = cpu_first_thread_in_core(cpu);
535 for (i = 0; i < threads_per_core; i++) {
536 cpu_clear(cpu, per_cpu(cpu_sibling_map, base + i));
537 cpu_clear(base + i, per_cpu(cpu_sibling_map, cpu));
538 cpu_clear(cpu, per_cpu(cpu_core_map, base +i));
539 cpu_clear(base + i, per_cpu(cpu_core_map, cpu));
540 }
541
542 l2_cache = cpu_to_l2cache(cpu);
543 for_each_present_cpu(i) {
544 struct device_node *np = cpu_to_l2cache(i);
545 if (!np)
546 continue;
547 if (np == l2_cache) {
548 cpu_clear(cpu, per_cpu(cpu_core_map, i));
549 cpu_clear(i, per_cpu(cpu_core_map, cpu));
550 }
551 of_node_put(np);
552 }
553 of_node_put(l2_cache);
554
555
556 return 0;
444} 557}
445 558
446void __cpu_die(unsigned int cpu) 559void __cpu_die(unsigned int cpu)
diff --git a/arch/powerpc/kernel/stacktrace.c b/arch/powerpc/kernel/stacktrace.c
index f2589645870a..b0dbb1daa4df 100644
--- a/arch/powerpc/kernel/stacktrace.c
+++ b/arch/powerpc/kernel/stacktrace.c
@@ -13,7 +13,6 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/stacktrace.h> 15#include <linux/stacktrace.h>
16#include <linux/module.h>
17#include <asm/ptrace.h> 16#include <asm/ptrace.h>
18#include <asm/processor.h> 17#include <asm/processor.h>
19 18
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 800e5e9a087b..56d172d16e56 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -22,6 +22,8 @@
22 22
23static DEFINE_PER_CPU(struct cpu, cpu_devices); 23static DEFINE_PER_CPU(struct cpu, cpu_devices);
24 24
25static DEFINE_PER_CPU(struct kobject *, cache_toplevel);
26
25/* SMT stuff */ 27/* SMT stuff */
26 28
27#ifdef CONFIG_PPC_MULTIPLATFORM 29#ifdef CONFIG_PPC_MULTIPLATFORM
@@ -297,8 +299,289 @@ static struct sysdev_attribute pa6t_attrs[] = {
297#endif /* CONFIG_DEBUG_KERNEL */ 299#endif /* CONFIG_DEBUG_KERNEL */
298}; 300};
299 301
302struct cache_desc {
303 struct kobject kobj;
304 struct cache_desc *next;
305 const char *type; /* Instruction, Data, or Unified */
306 u32 size; /* total cache size in KB */
307 u32 line_size; /* in bytes */
308 u32 nr_sets; /* number of sets */
309 u32 level; /* e.g. 1, 2, 3... */
310 u32 associativity; /* e.g. 8-way... 0 is fully associative */
311};
312
313DEFINE_PER_CPU(struct cache_desc *, cache_desc);
314
315static struct cache_desc *kobj_to_cache_desc(struct kobject *k)
316{
317 return container_of(k, struct cache_desc, kobj);
318}
319
320static void cache_desc_release(struct kobject *k)
321{
322 struct cache_desc *desc = kobj_to_cache_desc(k);
323
324 pr_debug("%s: releasing %s\n", __func__, kobject_name(k));
325
326 if (desc->next)
327 kobject_put(&desc->next->kobj);
328
329 kfree(kobj_to_cache_desc(k));
330}
331
332static ssize_t cache_desc_show(struct kobject *k, struct attribute *attr, char *buf)
333{
334 struct kobj_attribute *kobj_attr;
335
336 kobj_attr = container_of(attr, struct kobj_attribute, attr);
337
338 return kobj_attr->show(k, kobj_attr, buf);
339}
340
341static struct sysfs_ops cache_desc_sysfs_ops = {
342 .show = cache_desc_show,
343};
344
345static struct kobj_type cache_desc_type = {
346 .release = cache_desc_release,
347 .sysfs_ops = &cache_desc_sysfs_ops,
348};
349
350static ssize_t cache_size_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
351{
352 struct cache_desc *cache = kobj_to_cache_desc(k);
353
354 return sprintf(buf, "%uK\n", cache->size);
355}
356
357static struct kobj_attribute cache_size_attr =
358 __ATTR(size, 0444, cache_size_show, NULL);
359
360static ssize_t cache_line_size_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
361{
362 struct cache_desc *cache = kobj_to_cache_desc(k);
363
364 return sprintf(buf, "%u\n", cache->line_size);
365}
366
367static struct kobj_attribute cache_line_size_attr =
368 __ATTR(coherency_line_size, 0444, cache_line_size_show, NULL);
369
370static ssize_t cache_nr_sets_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
371{
372 struct cache_desc *cache = kobj_to_cache_desc(k);
373
374 return sprintf(buf, "%u\n", cache->nr_sets);
375}
376
377static struct kobj_attribute cache_nr_sets_attr =
378 __ATTR(number_of_sets, 0444, cache_nr_sets_show, NULL);
379
380static ssize_t cache_type_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
381{
382 struct cache_desc *cache = kobj_to_cache_desc(k);
383
384 return sprintf(buf, "%s\n", cache->type);
385}
386
387static struct kobj_attribute cache_type_attr =
388 __ATTR(type, 0444, cache_type_show, NULL);
389
390static ssize_t cache_level_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
391{
392 struct cache_desc *cache = kobj_to_cache_desc(k);
393
394 return sprintf(buf, "%u\n", cache->level);
395}
396
397static struct kobj_attribute cache_level_attr =
398 __ATTR(level, 0444, cache_level_show, NULL);
399
400static ssize_t cache_assoc_show(struct kobject *k, struct kobj_attribute *attr, char *buf)
401{
402 struct cache_desc *cache = kobj_to_cache_desc(k);
403
404 return sprintf(buf, "%u\n", cache->associativity);
405}
406
407static struct kobj_attribute cache_assoc_attr =
408 __ATTR(ways_of_associativity, 0444, cache_assoc_show, NULL);
409
410struct cache_desc_info {
411 const char *type;
412 const char *size_prop;
413 const char *line_size_prop;
414 const char *nr_sets_prop;
415};
416
417/* PowerPC Processor binding says the [di]-cache-* must be equal on
418 * unified caches, so just use d-cache properties. */
419static struct cache_desc_info ucache_info = {
420 .type = "Unified",
421 .size_prop = "d-cache-size",
422 .line_size_prop = "d-cache-line-size",
423 .nr_sets_prop = "d-cache-sets",
424};
300 425
301static void register_cpu_online(unsigned int cpu) 426static struct cache_desc_info dcache_info = {
427 .type = "Data",
428 .size_prop = "d-cache-size",
429 .line_size_prop = "d-cache-line-size",
430 .nr_sets_prop = "d-cache-sets",
431};
432
433static struct cache_desc_info icache_info = {
434 .type = "Instruction",
435 .size_prop = "i-cache-size",
436 .line_size_prop = "i-cache-line-size",
437 .nr_sets_prop = "i-cache-sets",
438};
439
440static struct cache_desc * __cpuinit create_cache_desc(struct device_node *np, struct kobject *parent, int index, int level, struct cache_desc_info *info)
441{
442 const u32 *cache_line_size;
443 struct cache_desc *new;
444 const u32 *cache_size;
445 const u32 *nr_sets;
446 int rc;
447
448 new = kzalloc(sizeof(*new), GFP_KERNEL);
449 if (!new)
450 return NULL;
451
452 rc = kobject_init_and_add(&new->kobj, &cache_desc_type, parent,
453 "index%d", index);
454 if (rc)
455 goto err;
456
457 /* type */
458 new->type = info->type;
459 rc = sysfs_create_file(&new->kobj, &cache_type_attr.attr);
460 WARN_ON(rc);
461
462 /* level */
463 new->level = level;
464 rc = sysfs_create_file(&new->kobj, &cache_level_attr.attr);
465 WARN_ON(rc);
466
467 /* size */
468 cache_size = of_get_property(np, info->size_prop, NULL);
469 if (cache_size) {
470 new->size = *cache_size / 1024;
471 rc = sysfs_create_file(&new->kobj,
472 &cache_size_attr.attr);
473 WARN_ON(rc);
474 }
475
476 /* coherency_line_size */
477 cache_line_size = of_get_property(np, info->line_size_prop, NULL);
478 if (cache_line_size) {
479 new->line_size = *cache_line_size;
480 rc = sysfs_create_file(&new->kobj,
481 &cache_line_size_attr.attr);
482 WARN_ON(rc);
483 }
484
485 /* number_of_sets */
486 nr_sets = of_get_property(np, info->nr_sets_prop, NULL);
487 if (nr_sets) {
488 new->nr_sets = *nr_sets;
489 rc = sysfs_create_file(&new->kobj,
490 &cache_nr_sets_attr.attr);
491 WARN_ON(rc);
492 }
493
494 /* ways_of_associativity */
495 if (new->nr_sets == 1) {
496 /* fully associative */
497 new->associativity = 0;
498 goto create_assoc;
499 }
500
501 if (new->nr_sets && new->size && new->line_size) {
502 /* If we have values for all of these we can derive
503 * the associativity. */
504 new->associativity =
505 ((new->size * 1024) / new->nr_sets) / new->line_size;
506create_assoc:
507 rc = sysfs_create_file(&new->kobj,
508 &cache_assoc_attr.attr);
509 WARN_ON(rc);
510 }
511
512 return new;
513err:
514 kfree(new);
515 return NULL;
516}
517
518static bool cache_is_unified(struct device_node *np)
519{
520 return of_get_property(np, "cache-unified", NULL);
521}
522
523static struct cache_desc * __cpuinit create_cache_index_info(struct device_node *np, struct kobject *parent, int index, int level)
524{
525 const phandle *next_cache_phandle;
526 struct device_node *next_cache;
527 struct cache_desc *new, **end;
528
529 pr_debug("%s(node = %s, index = %d)\n", __func__, np->full_name, index);
530
531 if (cache_is_unified(np)) {
532 new = create_cache_desc(np, parent, index, level,
533 &ucache_info);
534 } else {
535 new = create_cache_desc(np, parent, index, level,
536 &dcache_info);
537 if (new) {
538 index++;
539 new->next = create_cache_desc(np, parent, index, level,
540 &icache_info);
541 }
542 }
543 if (!new)
544 return NULL;
545
546 end = &new->next;
547 while (*end)
548 end = &(*end)->next;
549
550 next_cache_phandle = of_get_property(np, "l2-cache", NULL);
551 if (!next_cache_phandle)
552 goto out;
553
554 next_cache = of_find_node_by_phandle(*next_cache_phandle);
555 if (!next_cache)
556 goto out;
557
558 *end = create_cache_index_info(next_cache, parent, ++index, ++level);
559
560 of_node_put(next_cache);
561out:
562 return new;
563}
564
565static void __cpuinit create_cache_info(struct sys_device *sysdev)
566{
567 struct kobject *cache_toplevel;
568 struct device_node *np = NULL;
569 int cpu = sysdev->id;
570
571 cache_toplevel = kobject_create_and_add("cache", &sysdev->kobj);
572 if (!cache_toplevel)
573 return;
574 per_cpu(cache_toplevel, cpu) = cache_toplevel;
575 np = of_get_cpu_node(cpu, NULL);
576 if (np != NULL) {
577 per_cpu(cache_desc, cpu) =
578 create_cache_index_info(np, cache_toplevel, 0, 1);
579 of_node_put(np);
580 }
581 return;
582}
583
584static void __cpuinit register_cpu_online(unsigned int cpu)
302{ 585{
303 struct cpu *c = &per_cpu(cpu_devices, cpu); 586 struct cpu *c = &per_cpu(cpu_devices, cpu);
304 struct sys_device *s = &c->sysdev; 587 struct sys_device *s = &c->sysdev;
@@ -346,9 +629,33 @@ static void register_cpu_online(unsigned int cpu)
346 629
347 if (cpu_has_feature(CPU_FTR_DSCR)) 630 if (cpu_has_feature(CPU_FTR_DSCR))
348 sysdev_create_file(s, &attr_dscr); 631 sysdev_create_file(s, &attr_dscr);
632
633 create_cache_info(s);
349} 634}
350 635
351#ifdef CONFIG_HOTPLUG_CPU 636#ifdef CONFIG_HOTPLUG_CPU
637static void remove_cache_info(struct sys_device *sysdev)
638{
639 struct kobject *cache_toplevel;
640 struct cache_desc *cache_desc;
641 int cpu = sysdev->id;
642
643 cache_desc = per_cpu(cache_desc, cpu);
644 if (cache_desc != NULL) {
645 sysfs_remove_file(&cache_desc->kobj, &cache_size_attr.attr);
646 sysfs_remove_file(&cache_desc->kobj, &cache_line_size_attr.attr);
647 sysfs_remove_file(&cache_desc->kobj, &cache_type_attr.attr);
648 sysfs_remove_file(&cache_desc->kobj, &cache_level_attr.attr);
649 sysfs_remove_file(&cache_desc->kobj, &cache_nr_sets_attr.attr);
650 sysfs_remove_file(&cache_desc->kobj, &cache_assoc_attr.attr);
651
652 kobject_put(&cache_desc->kobj);
653 }
654 cache_toplevel = per_cpu(cache_toplevel, cpu);
655 if (cache_toplevel != NULL)
656 kobject_put(cache_toplevel);
657}
658
352static void unregister_cpu_online(unsigned int cpu) 659static void unregister_cpu_online(unsigned int cpu)
353{ 660{
354 struct cpu *c = &per_cpu(cpu_devices, cpu); 661 struct cpu *c = &per_cpu(cpu_devices, cpu);
@@ -399,6 +706,8 @@ static void unregister_cpu_online(unsigned int cpu)
399 706
400 if (cpu_has_feature(CPU_FTR_DSCR)) 707 if (cpu_has_feature(CPU_FTR_DSCR))
401 sysdev_remove_file(s, &attr_dscr); 708 sysdev_remove_file(s, &attr_dscr);
709
710 remove_cache_info(s);
402} 711}
403#endif /* CONFIG_HOTPLUG_CPU */ 712#endif /* CONFIG_HOTPLUG_CPU */
404 713
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index ade8aeaa2e70..22a3c33fd751 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -530,7 +530,7 @@ static dma_addr_t vio_dma_iommu_map_single(struct device *dev, void *vaddr,
530 } 530 }
531 531
532 ret = dma_iommu_ops.map_single(dev, vaddr, size, direction, attrs); 532 ret = dma_iommu_ops.map_single(dev, vaddr, size, direction, attrs);
533 if (unlikely(dma_mapping_error(ret))) { 533 if (unlikely(dma_mapping_error(dev, ret))) {
534 vio_cmo_dealloc(viodev, roundup(size, IOMMU_PAGE_SIZE)); 534 vio_cmo_dealloc(viodev, roundup(size, IOMMU_PAGE_SIZE));
535 atomic_inc(&viodev->cmo.allocs_failed); 535 atomic_inc(&viodev->cmo.allocs_failed);
536 } 536 }
@@ -1031,8 +1031,8 @@ void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired) {}
1031static int vio_cmo_bus_probe(struct vio_dev *viodev) { return 0; } 1031static int vio_cmo_bus_probe(struct vio_dev *viodev) { return 0; }
1032static void vio_cmo_bus_remove(struct vio_dev *viodev) {} 1032static void vio_cmo_bus_remove(struct vio_dev *viodev) {}
1033static void vio_cmo_set_dma_ops(struct vio_dev *viodev) {} 1033static void vio_cmo_set_dma_ops(struct vio_dev *viodev) {}
1034static void vio_cmo_bus_init() {} 1034static void vio_cmo_bus_init(void) {}
1035static void vio_cmo_sysfs_init() { } 1035static void vio_cmo_sysfs_init(void) { }
1036#endif /* CONFIG_PPC_SMLPAR */ 1036#endif /* CONFIG_PPC_SMLPAR */
1037EXPORT_SYMBOL(vio_cmo_entitlement_update); 1037EXPORT_SYMBOL(vio_cmo_entitlement_update);
1038EXPORT_SYMBOL(vio_cmo_set_dev_desired); 1038EXPORT_SYMBOL(vio_cmo_set_dev_desired);
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index 1c00e0196f6c..e7392b45a5ef 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -12,7 +12,8 @@ obj-y := fault.o mem.o \
12 mmu_context_$(CONFIG_WORD_SIZE).o 12 mmu_context_$(CONFIG_WORD_SIZE).o
13hash-$(CONFIG_PPC_NATIVE) := hash_native_64.o 13hash-$(CONFIG_PPC_NATIVE) := hash_native_64.o
14obj-$(CONFIG_PPC64) += hash_utils_64.o \ 14obj-$(CONFIG_PPC64) += hash_utils_64.o \
15 slb_low.o slb.o stab.o mmap.o $(hash-y) 15 slb_low.o slb.o stab.o \
16 gup.o mmap.o $(hash-y)
16obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o 17obj-$(CONFIG_PPC_STD_MMU_32) += ppc_mmu_32.o
17obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \ 18obj-$(CONFIG_PPC_STD_MMU) += hash_low_$(CONFIG_WORD_SIZE).o \
18 tlb_$(CONFIG_WORD_SIZE).o 19 tlb_$(CONFIG_WORD_SIZE).o
diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c
new file mode 100644
index 000000000000..9fdf4d6335e4
--- /dev/null
+++ b/arch/powerpc/mm/gup.c
@@ -0,0 +1,280 @@
1/*
2 * Lockless get_user_pages_fast for powerpc
3 *
4 * Copyright (C) 2008 Nick Piggin
5 * Copyright (C) 2008 Novell Inc.
6 */
7#undef DEBUG
8
9#include <linux/sched.h>
10#include <linux/mm.h>
11#include <linux/hugetlb.h>
12#include <linux/vmstat.h>
13#include <linux/pagemap.h>
14#include <linux/rwsem.h>
15#include <asm/pgtable.h>
16
17/*
18 * The performance critical leaf functions are made noinline otherwise gcc
19 * inlines everything into a single function which results in too much
20 * register pressure.
21 */
22static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
23 unsigned long end, int write, struct page **pages, int *nr)
24{
25 unsigned long mask, result;
26 pte_t *ptep;
27
28 result = _PAGE_PRESENT|_PAGE_USER;
29 if (write)
30 result |= _PAGE_RW;
31 mask = result | _PAGE_SPECIAL;
32
33 ptep = pte_offset_kernel(&pmd, addr);
34 do {
35 pte_t pte = *ptep;
36 struct page *page;
37
38 if ((pte_val(pte) & mask) != result)
39 return 0;
40 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
41 page = pte_page(pte);
42 if (!page_cache_get_speculative(page))
43 return 0;
44 if (unlikely(pte != *ptep)) {
45 put_page(page);
46 return 0;
47 }
48 pages[*nr] = page;
49 (*nr)++;
50
51 } while (ptep++, addr += PAGE_SIZE, addr != end);
52
53 return 1;
54}
55
56#ifdef CONFIG_HUGETLB_PAGE
57static noinline int gup_huge_pte(pte_t *ptep, struct hstate *hstate,
58 unsigned long *addr, unsigned long end,
59 int write, struct page **pages, int *nr)
60{
61 unsigned long mask;
62 unsigned long pte_end;
63 struct page *head, *page;
64 pte_t pte;
65 int refs;
66
67 pte_end = (*addr + huge_page_size(hstate)) & huge_page_mask(hstate);
68 if (pte_end < end)
69 end = pte_end;
70
71 pte = *ptep;
72 mask = _PAGE_PRESENT|_PAGE_USER;
73 if (write)
74 mask |= _PAGE_RW;
75 if ((pte_val(pte) & mask) != mask)
76 return 0;
77 /* hugepages are never "special" */
78 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
79
80 refs = 0;
81 head = pte_page(pte);
82 page = head + ((*addr & ~huge_page_mask(hstate)) >> PAGE_SHIFT);
83 do {
84 VM_BUG_ON(compound_head(page) != head);
85 pages[*nr] = page;
86 (*nr)++;
87 page++;
88 refs++;
89 } while (*addr += PAGE_SIZE, *addr != end);
90
91 if (!page_cache_add_speculative(head, refs)) {
92 *nr -= refs;
93 return 0;
94 }
95 if (unlikely(pte != *ptep)) {
96 /* Could be optimized better */
97 while (*nr) {
98 put_page(page);
99 (*nr)--;
100 }
101 }
102
103 return 1;
104}
105#endif /* CONFIG_HUGETLB_PAGE */
106
107static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
108 int write, struct page **pages, int *nr)
109{
110 unsigned long next;
111 pmd_t *pmdp;
112
113 pmdp = pmd_offset(&pud, addr);
114 do {
115 pmd_t pmd = *pmdp;
116
117 next = pmd_addr_end(addr, end);
118 if (pmd_none(pmd))
119 return 0;
120 if (!gup_pte_range(pmd, addr, next, write, pages, nr))
121 return 0;
122 } while (pmdp++, addr = next, addr != end);
123
124 return 1;
125}
126
127static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
128 int write, struct page **pages, int *nr)
129{
130 unsigned long next;
131 pud_t *pudp;
132
133 pudp = pud_offset(&pgd, addr);
134 do {
135 pud_t pud = *pudp;
136
137 next = pud_addr_end(addr, end);
138 if (pud_none(pud))
139 return 0;
140 if (!gup_pmd_range(pud, addr, next, write, pages, nr))
141 return 0;
142 } while (pudp++, addr = next, addr != end);
143
144 return 1;
145}
146
147int get_user_pages_fast(unsigned long start, int nr_pages, int write,
148 struct page **pages)
149{
150 struct mm_struct *mm = current->mm;
151 unsigned long addr, len, end;
152 unsigned long next;
153 pgd_t *pgdp;
154 int psize, nr = 0;
155 unsigned int shift;
156
157 pr_debug("%s(%lx,%x,%s)\n", __func__, start, nr_pages, write ? "write" : "read");
158
159 start &= PAGE_MASK;
160 addr = start;
161 len = (unsigned long) nr_pages << PAGE_SHIFT;
162 end = start + len;
163
164 if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
165 start, len)))
166 goto slow_irqon;
167
168 pr_debug(" aligned: %lx .. %lx\n", start, end);
169
170#ifdef CONFIG_HUGETLB_PAGE
171 /* We bail out on slice boundary crossing when hugetlb is
172 * enabled in order to not have to deal with two different
173 * page table formats
174 */
175 if (addr < SLICE_LOW_TOP) {
176 if (end > SLICE_LOW_TOP)
177 goto slow_irqon;
178
179 if (unlikely(GET_LOW_SLICE_INDEX(addr) !=
180 GET_LOW_SLICE_INDEX(end - 1)))
181 goto slow_irqon;
182 } else {
183 if (unlikely(GET_HIGH_SLICE_INDEX(addr) !=
184 GET_HIGH_SLICE_INDEX(end - 1)))
185 goto slow_irqon;
186 }
187#endif /* CONFIG_HUGETLB_PAGE */
188
189 /*
190 * XXX: batch / limit 'nr', to avoid large irq off latency
191 * needs some instrumenting to determine the common sizes used by
192 * important workloads (eg. DB2), and whether limiting the batch size
193 * will decrease performance.
194 *
195 * It seems like we're in the clear for the moment. Direct-IO is
196 * the main guy that batches up lots of get_user_pages, and even
197 * they are limited to 64-at-a-time which is not so many.
198 */
199 /*
200 * This doesn't prevent pagetable teardown, but does prevent
201 * the pagetables from being freed on powerpc.
202 *
203 * So long as we atomically load page table pointers versus teardown,
204 * we can follow the address down to the the page and take a ref on it.
205 */
206 local_irq_disable();
207
208 psize = get_slice_psize(mm, addr);
209 shift = mmu_psize_defs[psize].shift;
210
211#ifdef CONFIG_HUGETLB_PAGE
212 if (unlikely(mmu_huge_psizes[psize])) {
213 pte_t *ptep;
214 unsigned long a = addr;
215 unsigned long sz = ((1UL) << shift);
216 struct hstate *hstate = size_to_hstate(sz);
217
218 BUG_ON(!hstate);
219 /*
220 * XXX: could be optimized to avoid hstate
221 * lookup entirely (just use shift)
222 */
223
224 do {
225 VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, a)].shift);
226 ptep = huge_pte_offset(mm, a);
227 pr_debug(" %016lx: huge ptep %p\n", a, ptep);
228 if (!ptep || !gup_huge_pte(ptep, hstate, &a, end, write, pages,
229 &nr))
230 goto slow;
231 } while (a != end);
232 } else
233#endif /* CONFIG_HUGETLB_PAGE */
234 {
235 pgdp = pgd_offset(mm, addr);
236 do {
237 pgd_t pgd = *pgdp;
238
239 VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, addr)].shift);
240 pr_debug(" %016lx: normal pgd %p\n", addr, (void *)pgd);
241 next = pgd_addr_end(addr, end);
242 if (pgd_none(pgd))
243 goto slow;
244 if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
245 goto slow;
246 } while (pgdp++, addr = next, addr != end);
247 }
248 local_irq_enable();
249
250 VM_BUG_ON(nr != (end - start) >> PAGE_SHIFT);
251 return nr;
252
253 {
254 int ret;
255
256slow:
257 local_irq_enable();
258slow_irqon:
259 pr_debug(" slow path ! nr = %d\n", nr);
260
261 /* Try to get the remaining pages with get_user_pages */
262 start += nr << PAGE_SHIFT;
263 pages += nr;
264
265 down_read(&mm->mmap_sem);
266 ret = get_user_pages(current, mm, start,
267 (end - start) >> PAGE_SHIFT, write, 0, pages, NULL);
268 up_read(&mm->mmap_sem);
269
270 /* Have to be a bit careful with return values */
271 if (nr > 0) {
272 if (ret < 0)
273 ret = nr;
274 else
275 ret += nr;
276 }
277
278 return ret;
279 }
280}
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index ed0aab0208a6..f1c2d55b4377 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -736,14 +736,21 @@ static int __init hugetlbpage_init(void)
736 736
737 if (!cpu_has_feature(CPU_FTR_16M_PAGE)) 737 if (!cpu_has_feature(CPU_FTR_16M_PAGE))
738 return -ENODEV; 738 return -ENODEV;
739
739 /* Add supported huge page sizes. Need to change HUGE_MAX_HSTATE 740 /* Add supported huge page sizes. Need to change HUGE_MAX_HSTATE
740 * and adjust PTE_NONCACHE_NUM if the number of supported huge page 741 * and adjust PTE_NONCACHE_NUM if the number of supported huge page
741 * sizes changes. 742 * sizes changes.
742 */ 743 */
743 set_huge_psize(MMU_PAGE_16M); 744 set_huge_psize(MMU_PAGE_16M);
744 set_huge_psize(MMU_PAGE_64K);
745 set_huge_psize(MMU_PAGE_16G); 745 set_huge_psize(MMU_PAGE_16G);
746 746
747 /* Temporarily disable support for 64K huge pages when 64K SPU local
748 * store support is enabled as the current implementation conflicts.
749 */
750#ifndef CONFIG_SPU_FS_64K_LS
751 set_huge_psize(MMU_PAGE_64K);
752#endif
753
747 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) { 754 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) {
748 if (mmu_huge_psizes[psize]) { 755 if (mmu_huge_psizes[psize]) {
749 huge_pgtable_cache(psize) = kmem_cache_create( 756 huge_pgtable_cache(psize) = kmem_cache_create(
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index dd4be4aee314..ec43477caa63 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -105,6 +105,7 @@ static void __init mpc832x_sys_setup_arch(void)
105static struct of_device_id mpc832x_ids[] = { 105static struct of_device_id mpc832x_ids[] = {
106 { .type = "soc", }, 106 { .type = "soc", },
107 { .compatible = "soc", }, 107 { .compatible = "soc", },
108 { .compatible = "simple-bus", },
108 { .type = "qe", }, 109 { .type = "qe", },
109 { .compatible = "fsl,qe", }, 110 { .compatible = "fsl,qe", },
110 {}, 111 {},
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index f049d692d4c8..0300268ce5b8 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -115,6 +115,7 @@ static void __init mpc832x_rdb_setup_arch(void)
115static struct of_device_id mpc832x_ids[] = { 115static struct of_device_id mpc832x_ids[] = {
116 { .type = "soc", }, 116 { .type = "soc", },
117 { .compatible = "soc", }, 117 { .compatible = "soc", },
118 { .compatible = "simple-bus", },
118 { .type = "qe", }, 119 { .type = "qe", },
119 { .compatible = "fsl,qe", }, 120 { .compatible = "fsl,qe", },
120 {}, 121 {},
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 7301d77a08ee..76092d37c7d9 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -41,6 +41,7 @@
41 41
42static struct of_device_id __initdata mpc834x_itx_ids[] = { 42static struct of_device_id __initdata mpc834x_itx_ids[] = {
43 { .compatible = "fsl,pq2pro-localbus", }, 43 { .compatible = "fsl,pq2pro-localbus", },
44 { .compatible = "simple-bus", },
44 {}, 45 {},
45}; 46};
46 47
diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index 30d509aa9f08..fc3f2ed1f3e9 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -111,6 +111,7 @@ static void __init mpc834x_mds_init_IRQ(void)
111static struct of_device_id mpc834x_ids[] = { 111static struct of_device_id mpc834x_ids[] = {
112 { .type = "soc", }, 112 { .type = "soc", },
113 { .compatible = "soc", }, 113 { .compatible = "soc", },
114 { .compatible = "simple-bus", },
114 {}, 115 {},
115}; 116};
116 117
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 75b80e836576..9d46e5bdd101 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -136,6 +136,7 @@ static void __init mpc836x_mds_setup_arch(void)
136static struct of_device_id mpc836x_ids[] = { 136static struct of_device_id mpc836x_ids[] = {
137 { .type = "soc", }, 137 { .type = "soc", },
138 { .compatible = "soc", }, 138 { .compatible = "soc", },
139 { .compatible = "simple-bus", },
139 { .type = "qe", }, 140 { .type = "qe", },
140 { .compatible = "fsl,qe", }, 141 { .compatible = "fsl,qe", },
141 {}, 142 {},
diff --git a/arch/powerpc/platforms/83xx/sbc834x.c b/arch/powerpc/platforms/83xx/sbc834x.c
index fc21f5c15bab..156c4e218009 100644
--- a/arch/powerpc/platforms/83xx/sbc834x.c
+++ b/arch/powerpc/platforms/83xx/sbc834x.c
@@ -83,6 +83,7 @@ static void __init sbc834x_init_IRQ(void)
83static struct __initdata of_device_id sbc834x_ids[] = { 83static struct __initdata of_device_id sbc834x_ids[] = {
84 { .type = "soc", }, 84 { .type = "soc", },
85 { .compatible = "soc", }, 85 { .compatible = "soc", },
86 { .compatible = "simple-bus", },
86 {}, 87 {},
87}; 88};
88 89
diff --git a/arch/powerpc/platforms/85xx/ksi8560.c b/arch/powerpc/platforms/85xx/ksi8560.c
index 2145adeb220c..8a3b117b6ce2 100644
--- a/arch/powerpc/platforms/85xx/ksi8560.c
+++ b/arch/powerpc/platforms/85xx/ksi8560.c
@@ -222,6 +222,7 @@ static void ksi8560_show_cpuinfo(struct seq_file *m)
222 222
223static struct of_device_id __initdata of_bus_ids[] = { 223static struct of_device_id __initdata of_bus_ids[] = {
224 { .type = "soc", }, 224 { .type = "soc", },
225 { .type = "simple-bus", },
225 { .name = "cpm", }, 226 { .name = "cpm", },
226 { .name = "localbus", }, 227 { .name = "localbus", },
227 {}, 228 {},
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index 6b846aa1ced9..1bf5aefdfeb1 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -91,6 +91,7 @@ static void __init mpc8536_ds_setup_arch(void)
91static struct of_device_id __initdata mpc8536_ds_ids[] = { 91static struct of_device_id __initdata mpc8536_ds_ids[] = {
92 { .type = "soc", }, 92 { .type = "soc", },
93 { .compatible = "soc", }, 93 { .compatible = "soc", },
94 { .compatible = "simple-bus", },
94 {}, 95 {},
95}; 96};
96 97
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
index ba498d6f2d02..d17807a6b89a 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c
@@ -230,6 +230,7 @@ static struct of_device_id __initdata of_bus_ids[] = {
230 { .type = "soc", }, 230 { .type = "soc", },
231 { .name = "cpm", }, 231 { .name = "cpm", },
232 { .name = "localbus", }, 232 { .name = "localbus", },
233 { .compatible = "simple-bus", },
233 {}, 234 {},
234}; 235};
235 236
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 00c535806647..483b65cbabae 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -186,6 +186,7 @@ static int __init mpc8544_ds_probe(void)
186static struct of_device_id __initdata mpc85xxds_ids[] = { 186static struct of_device_id __initdata mpc85xxds_ids[] = {
187 { .type = "soc", }, 187 { .type = "soc", },
188 { .compatible = "soc", }, 188 { .compatible = "soc", },
189 { .compatible = "simple-bus", },
189 {}, 190 {},
190}; 191};
191 192
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 43a459f63e31..2494c5155919 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -260,6 +260,7 @@ machine_arch_initcall(mpc85xx_mds, board_fixups);
260static struct of_device_id mpc85xx_ids[] = { 260static struct of_device_id mpc85xx_ids[] = {
261 { .type = "soc", }, 261 { .type = "soc", },
262 { .compatible = "soc", }, 262 { .compatible = "soc", },
263 { .compatible = "simple-bus", },
263 { .type = "qe", }, 264 { .type = "qe", },
264 { .compatible = "fsl,qe", }, 265 { .compatible = "fsl,qe", },
265 {}, 266 {},
diff --git a/arch/powerpc/platforms/85xx/sbc8560.c b/arch/powerpc/platforms/85xx/sbc8560.c
index 2c580cd24e4f..6509ade71668 100644
--- a/arch/powerpc/platforms/85xx/sbc8560.c
+++ b/arch/powerpc/platforms/85xx/sbc8560.c
@@ -217,6 +217,7 @@ static struct of_device_id __initdata of_bus_ids[] = {
217 { .type = "soc", }, 217 { .type = "soc", },
218 { .name = "cpm", }, 218 { .name = "cpm", },
219 { .name = "localbus", }, 219 { .name = "localbus", },
220 { .compatible = "simple-bus", },
220 {}, 221 {},
221}; 222};
222 223
diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig
index 6fc849e51e48..71d7562e190b 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -105,6 +105,16 @@ config 8xx_COPYBACK
105 105
106 If in doubt, say Y here. 106 If in doubt, say Y here.
107 107
108config 8xx_GPIO
109 bool "GPIO API Support"
110 select GENERIC_GPIO
111 select ARCH_REQUIRE_GPIOLIB
112 help
113 Saying Y here will cause the ports on an MPC8xx processor to be used
114 with the GPIO API. If you say N here, the kernel needs less memory.
115
116 If in doubt, say Y here.
117
108config 8xx_CPU6 118config 8xx_CPU6
109 bool "CPU6 Silicon Errata (860 Pre Rev. C)" 119 bool "CPU6 Silicon Errata (860 Pre Rev. C)"
110 help 120 help
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 1d0968775c0a..4c900efa164e 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -254,6 +254,8 @@ config CPM2
254 select CPM 254 select CPM
255 select PPC_LIB_RHEAP 255 select PPC_LIB_RHEAP
256 select PPC_PCI_CHOICE 256 select PPC_PCI_CHOICE
257 select ARCH_REQUIRE_GPIOLIB
258 select GENERIC_GPIO
257 help 259 help
258 The CPM2 (Communications Processor Module) is a coprocessor on 260 The CPM2 (Communications Processor Module) is a coprocessor on
259 embedded CPUs made by Freescale. Selecting this option means that 261 embedded CPUs made by Freescale. Selecting this option means that
@@ -281,6 +283,7 @@ config FSL_ULI1575
281 283
282config CPM 284config CPM
283 bool 285 bool
286 select PPC_CLOCK
284 287
285config OF_RTC 288config OF_RTC
286 bool 289 bool
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c b/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
index 69288f653144..3233fe84d158 100644
--- a/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
@@ -96,6 +96,12 @@ static int pmi_notifier(struct notifier_block *nb,
96 struct cpufreq_frequency_table *cbe_freqs; 96 struct cpufreq_frequency_table *cbe_freqs;
97 u8 node; 97 u8 node;
98 98
99 /* Should this really be called for CPUFREQ_ADJUST, CPUFREQ_INCOMPATIBLE
100 * and CPUFREQ_NOTIFY policy events?)
101 */
102 if (event == CPUFREQ_START)
103 return 0;
104
99 cbe_freqs = cpufreq_frequency_get_table(policy->cpu); 105 cbe_freqs = cpufreq_frequency_get_table(policy->cpu);
100 node = cbe_cpu_to_node(policy->cpu); 106 node = cbe_cpu_to_node(policy->cpu);
101 107
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 31635446901a..88ccf3a08a9c 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -541,6 +541,78 @@ static int __init pmac_declare_of_platform_devices(void)
541} 541}
542machine_device_initcall(powermac, pmac_declare_of_platform_devices); 542machine_device_initcall(powermac, pmac_declare_of_platform_devices);
543 543
544#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
545/*
546 * This is called very early, as part of console_init() (typically just after
547 * time_init()). This function is respondible for trying to find a good
548 * default console on serial ports. It tries to match the open firmware
549 * default output with one of the available serial console drivers.
550 */
551static int __init check_pmac_serial_console(void)
552{
553 struct device_node *prom_stdout = NULL;
554 int offset = 0;
555 const char *name;
556#ifdef CONFIG_SERIAL_PMACZILOG_TTYS
557 char *devname = "ttyS";
558#else
559 char *devname = "ttyPZ";
560#endif
561
562 pr_debug(" -> check_pmac_serial_console()\n");
563
564 /* The user has requested a console so this is already set up. */
565 if (strstr(boot_command_line, "console=")) {
566 pr_debug(" console was specified !\n");
567 return -EBUSY;
568 }
569
570 if (!of_chosen) {
571 pr_debug(" of_chosen is NULL !\n");
572 return -ENODEV;
573 }
574
575 /* We are getting a weird phandle from OF ... */
576 /* ... So use the full path instead */
577 name = of_get_property(of_chosen, "linux,stdout-path", NULL);
578 if (name == NULL) {
579 pr_debug(" no linux,stdout-path !\n");
580 return -ENODEV;
581 }
582 prom_stdout = of_find_node_by_path(name);
583 if (!prom_stdout) {
584 pr_debug(" can't find stdout package %s !\n", name);
585 return -ENODEV;
586 }
587 pr_debug("stdout is %s\n", prom_stdout->full_name);
588
589 name = of_get_property(prom_stdout, "name", NULL);
590 if (!name) {
591 pr_debug(" stdout package has no name !\n");
592 goto not_found;
593 }
594
595 if (strcmp(name, "ch-a") == 0)
596 offset = 0;
597 else if (strcmp(name, "ch-b") == 0)
598 offset = 1;
599 else
600 goto not_found;
601 of_node_put(prom_stdout);
602
603 pr_debug("Found serial console at %s%d\n", devname, offset);
604
605 return add_preferred_console(devname, offset, NULL);
606
607 not_found:
608 pr_debug("No preferred console found !\n");
609 of_node_put(prom_stdout);
610 return -ENODEV;
611}
612console_initcall(check_pmac_serial_console);
613
614#endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
615
544/* 616/*
545 * Called very early, MMU is off, device-tree isn't unflattened 617 * Called very early, MMU is off, device-tree isn't unflattened
546 */ 618 */
diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c
index 47de4d3fc167..572771fd8463 100644
--- a/arch/powerpc/platforms/powermac/udbg_scc.c
+++ b/arch/powerpc/platforms/powermac/udbg_scc.c
@@ -125,13 +125,23 @@ void udbg_scc_init(int force_scc)
125 out_8(sccc, 0xc0); 125 out_8(sccc, 0xc0);
126 126
127 /* If SCC was the OF output port, read the BRG value, else 127 /* If SCC was the OF output port, read the BRG value, else
128 * Setup for 57600 8N1 128 * Setup for 38400 or 57600 8N1 depending on the machine
129 */ 129 */
130 if (ch_def != NULL) { 130 if (ch_def != NULL) {
131 out_8(sccc, 13); 131 out_8(sccc, 13);
132 scc_inittab[1] = in_8(sccc); 132 scc_inittab[1] = in_8(sccc);
133 out_8(sccc, 12); 133 out_8(sccc, 12);
134 scc_inittab[3] = in_8(sccc); 134 scc_inittab[3] = in_8(sccc);
135 } else if (machine_is_compatible("RackMac1,1")
136 || machine_is_compatible("RackMac1,2")
137 || machine_is_compatible("MacRISC4")) {
138 /* Xserves and G5s default to 57600 */
139 scc_inittab[1] = 0;
140 scc_inittab[3] = 0;
141 } else {
142 /* Others default to 38400 */
143 scc_inittab[1] = 0;
144 scc_inittab[3] = 1;
135 } 145 }
136 146
137 for (i = 0; i < sizeof(scc_inittab); ++i) 147 for (i = 0; i < sizeof(scc_inittab); ++i)
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index c6b3be03168b..38fe32a7cc70 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -289,7 +289,9 @@ static int cmm_thread(void *dummy)
289} 289}
290 290
291#define CMM_SHOW(name, format, args...) \ 291#define CMM_SHOW(name, format, args...) \
292 static ssize_t show_##name(struct sys_device *dev, char *buf) \ 292 static ssize_t show_##name(struct sys_device *dev, \
293 struct sysdev_attribute *attr, \
294 char *buf) \
293 { \ 295 { \
294 return sprintf(buf, format, ##args); \ 296 return sprintf(buf, format, ##args); \
295 } \ 297 } \
@@ -298,12 +300,14 @@ static int cmm_thread(void *dummy)
298CMM_SHOW(loaned_kb, "%lu\n", PAGES2KB(loaned_pages)); 300CMM_SHOW(loaned_kb, "%lu\n", PAGES2KB(loaned_pages));
299CMM_SHOW(loaned_target_kb, "%lu\n", PAGES2KB(loaned_pages_target)); 301CMM_SHOW(loaned_target_kb, "%lu\n", PAGES2KB(loaned_pages_target));
300 302
301static ssize_t show_oom_pages(struct sys_device *dev, char *buf) 303static ssize_t show_oom_pages(struct sys_device *dev,
304 struct sysdev_attribute *attr, char *buf)
302{ 305{
303 return sprintf(buf, "%lu\n", PAGES2KB(oom_freed_pages)); 306 return sprintf(buf, "%lu\n", PAGES2KB(oom_freed_pages));
304} 307}
305 308
306static ssize_t store_oom_pages(struct sys_device *dev, 309static ssize_t store_oom_pages(struct sys_device *dev,
310 struct sysdev_attribute *attr,
307 const char *buf, size_t count) 311 const char *buf, size_t count)
308{ 312{
309 unsigned long val = simple_strtoul (buf, NULL, 10); 313 unsigned long val = simple_strtoul (buf, NULL, 10);
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index 661df42830b9..4a04823e8423 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -30,6 +30,7 @@
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/irq.h> 31#include <linux/irq.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/spinlock.h>
33#include <asm/page.h> 34#include <asm/page.h>
34#include <asm/pgtable.h> 35#include <asm/pgtable.h>
35#include <asm/8xx_immap.h> 36#include <asm/8xx_immap.h>
@@ -42,6 +43,10 @@
42 43
43#include <asm/fs_pd.h> 44#include <asm/fs_pd.h>
44 45
46#ifdef CONFIG_8xx_GPIO
47#include <linux/of_gpio.h>
48#endif
49
45#define CPM_MAP_SIZE (0x4000) 50#define CPM_MAP_SIZE (0x4000)
46 51
47cpm8xx_t __iomem *cpmp; /* Pointer to comm processor space */ 52cpm8xx_t __iomem *cpmp; /* Pointer to comm processor space */
@@ -290,20 +295,24 @@ struct cpm_ioport16 {
290 __be16 res[3]; 295 __be16 res[3];
291}; 296};
292 297
293struct cpm_ioport32 { 298struct cpm_ioport32b {
294 __be32 dir, par, sor; 299 __be32 dir, par, odr, dat;
300};
301
302struct cpm_ioport32e {
303 __be32 dir, par, sor, odr, dat;
295}; 304};
296 305
297static void cpm1_set_pin32(int port, int pin, int flags) 306static void cpm1_set_pin32(int port, int pin, int flags)
298{ 307{
299 struct cpm_ioport32 __iomem *iop; 308 struct cpm_ioport32e __iomem *iop;
300 pin = 1 << (31 - pin); 309 pin = 1 << (31 - pin);
301 310
302 if (port == CPM_PORTB) 311 if (port == CPM_PORTB)
303 iop = (struct cpm_ioport32 __iomem *) 312 iop = (struct cpm_ioport32e __iomem *)
304 &mpc8xx_immr->im_cpm.cp_pbdir; 313 &mpc8xx_immr->im_cpm.cp_pbdir;
305 else 314 else
306 iop = (struct cpm_ioport32 __iomem *) 315 iop = (struct cpm_ioport32e __iomem *)
307 &mpc8xx_immr->im_cpm.cp_pedir; 316 &mpc8xx_immr->im_cpm.cp_pedir;
308 317
309 if (flags & CPM_PIN_OUTPUT) 318 if (flags & CPM_PIN_OUTPUT)
@@ -498,3 +507,251 @@ int cpm1_clk_setup(enum cpm_clk_target target, int clock, int mode)
498 507
499 return 0; 508 return 0;
500} 509}
510
511/*
512 * GPIO LIB API implementation
513 */
514#ifdef CONFIG_8xx_GPIO
515
516struct cpm1_gpio16_chip {
517 struct of_mm_gpio_chip mm_gc;
518 spinlock_t lock;
519
520 /* shadowed data register to clear/set bits safely */
521 u16 cpdata;
522};
523
524static inline struct cpm1_gpio16_chip *
525to_cpm1_gpio16_chip(struct of_mm_gpio_chip *mm_gc)
526{
527 return container_of(mm_gc, struct cpm1_gpio16_chip, mm_gc);
528}
529
530static void cpm1_gpio16_save_regs(struct of_mm_gpio_chip *mm_gc)
531{
532 struct cpm1_gpio16_chip *cpm1_gc = to_cpm1_gpio16_chip(mm_gc);
533 struct cpm_ioport16 __iomem *iop = mm_gc->regs;
534
535 cpm1_gc->cpdata = in_be16(&iop->dat);
536}
537
538static int cpm1_gpio16_get(struct gpio_chip *gc, unsigned int gpio)
539{
540 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
541 struct cpm_ioport16 __iomem *iop = mm_gc->regs;
542 u16 pin_mask;
543
544 pin_mask = 1 << (15 - gpio);
545
546 return !!(in_be16(&iop->dat) & pin_mask);
547}
548
549static void cpm1_gpio16_set(struct gpio_chip *gc, unsigned int gpio, int value)
550{
551 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
552 struct cpm1_gpio16_chip *cpm1_gc = to_cpm1_gpio16_chip(mm_gc);
553 struct cpm_ioport16 __iomem *iop = mm_gc->regs;
554 unsigned long flags;
555 u16 pin_mask = 1 << (15 - gpio);
556
557 spin_lock_irqsave(&cpm1_gc->lock, flags);
558
559 if (value)
560 cpm1_gc->cpdata |= pin_mask;
561 else
562 cpm1_gc->cpdata &= ~pin_mask;
563
564 out_be16(&iop->dat, cpm1_gc->cpdata);
565
566 spin_unlock_irqrestore(&cpm1_gc->lock, flags);
567}
568
569static int cpm1_gpio16_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
570{
571 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
572 struct cpm_ioport16 __iomem *iop = mm_gc->regs;
573 u16 pin_mask;
574
575 pin_mask = 1 << (15 - gpio);
576
577 setbits16(&iop->dir, pin_mask);
578
579 cpm1_gpio16_set(gc, gpio, val);
580
581 return 0;
582}
583
584static int cpm1_gpio16_dir_in(struct gpio_chip *gc, unsigned int gpio)
585{
586 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
587 struct cpm_ioport16 __iomem *iop = mm_gc->regs;
588 u16 pin_mask;
589
590 pin_mask = 1 << (15 - gpio);
591
592 clrbits16(&iop->dir, pin_mask);
593
594 return 0;
595}
596
597int cpm1_gpiochip_add16(struct device_node *np)
598{
599 struct cpm1_gpio16_chip *cpm1_gc;
600 struct of_mm_gpio_chip *mm_gc;
601 struct of_gpio_chip *of_gc;
602 struct gpio_chip *gc;
603
604 cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL);
605 if (!cpm1_gc)
606 return -ENOMEM;
607
608 spin_lock_init(&cpm1_gc->lock);
609
610 mm_gc = &cpm1_gc->mm_gc;
611 of_gc = &mm_gc->of_gc;
612 gc = &of_gc->gc;
613
614 mm_gc->save_regs = cpm1_gpio16_save_regs;
615 of_gc->gpio_cells = 2;
616 gc->ngpio = 16;
617 gc->direction_input = cpm1_gpio16_dir_in;
618 gc->direction_output = cpm1_gpio16_dir_out;
619 gc->get = cpm1_gpio16_get;
620 gc->set = cpm1_gpio16_set;
621
622 return of_mm_gpiochip_add(np, mm_gc);
623}
624
625struct cpm1_gpio32_chip {
626 struct of_mm_gpio_chip mm_gc;
627 spinlock_t lock;
628
629 /* shadowed data register to clear/set bits safely */
630 u32 cpdata;
631};
632
633static inline struct cpm1_gpio32_chip *
634to_cpm1_gpio32_chip(struct of_mm_gpio_chip *mm_gc)
635{
636 return container_of(mm_gc, struct cpm1_gpio32_chip, mm_gc);
637}
638
639static void cpm1_gpio32_save_regs(struct of_mm_gpio_chip *mm_gc)
640{
641 struct cpm1_gpio32_chip *cpm1_gc = to_cpm1_gpio32_chip(mm_gc);
642 struct cpm_ioport32b __iomem *iop = mm_gc->regs;
643
644 cpm1_gc->cpdata = in_be32(&iop->dat);
645}
646
647static int cpm1_gpio32_get(struct gpio_chip *gc, unsigned int gpio)
648{
649 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
650 struct cpm_ioport32b __iomem *iop = mm_gc->regs;
651 u32 pin_mask;
652
653 pin_mask = 1 << (31 - gpio);
654
655 return !!(in_be32(&iop->dat) & pin_mask);
656}
657
658static void cpm1_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value)
659{
660 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
661 struct cpm1_gpio32_chip *cpm1_gc = to_cpm1_gpio32_chip(mm_gc);
662 struct cpm_ioport32b __iomem *iop = mm_gc->regs;
663 unsigned long flags;
664 u32 pin_mask = 1 << (31 - gpio);
665
666 spin_lock_irqsave(&cpm1_gc->lock, flags);
667
668 if (value)
669 cpm1_gc->cpdata |= pin_mask;
670 else
671 cpm1_gc->cpdata &= ~pin_mask;
672
673 out_be32(&iop->dat, cpm1_gc->cpdata);
674
675 spin_unlock_irqrestore(&cpm1_gc->lock, flags);
676}
677
678static int cpm1_gpio32_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
679{
680 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
681 struct cpm_ioport32b __iomem *iop = mm_gc->regs;
682 u32 pin_mask;
683
684 pin_mask = 1 << (31 - gpio);
685
686 setbits32(&iop->dir, pin_mask);
687
688 cpm1_gpio32_set(gc, gpio, val);
689
690 return 0;
691}
692
693static int cpm1_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio)
694{
695 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
696 struct cpm_ioport32b __iomem *iop = mm_gc->regs;
697 u32 pin_mask;
698
699 pin_mask = 1 << (31 - gpio);
700
701 clrbits32(&iop->dir, pin_mask);
702
703 return 0;
704}
705
706int cpm1_gpiochip_add32(struct device_node *np)
707{
708 struct cpm1_gpio32_chip *cpm1_gc;
709 struct of_mm_gpio_chip *mm_gc;
710 struct of_gpio_chip *of_gc;
711 struct gpio_chip *gc;
712
713 cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL);
714 if (!cpm1_gc)
715 return -ENOMEM;
716
717 spin_lock_init(&cpm1_gc->lock);
718
719 mm_gc = &cpm1_gc->mm_gc;
720 of_gc = &mm_gc->of_gc;
721 gc = &of_gc->gc;
722
723 mm_gc->save_regs = cpm1_gpio32_save_regs;
724 of_gc->gpio_cells = 2;
725 gc->ngpio = 32;
726 gc->direction_input = cpm1_gpio32_dir_in;
727 gc->direction_output = cpm1_gpio32_dir_out;
728 gc->get = cpm1_gpio32_get;
729 gc->set = cpm1_gpio32_set;
730
731 return of_mm_gpiochip_add(np, mm_gc);
732}
733
734static int cpm_init_par_io(void)
735{
736 struct device_node *np;
737
738 for_each_compatible_node(np, NULL, "fsl,cpm1-pario-bank-a")
739 cpm1_gpiochip_add16(np);
740
741 for_each_compatible_node(np, NULL, "fsl,cpm1-pario-bank-b")
742 cpm1_gpiochip_add32(np);
743
744 for_each_compatible_node(np, NULL, "fsl,cpm1-pario-bank-c")
745 cpm1_gpiochip_add16(np);
746
747 for_each_compatible_node(np, NULL, "fsl,cpm1-pario-bank-d")
748 cpm1_gpiochip_add16(np);
749
750 /* Port E uses CPM2 layout */
751 for_each_compatible_node(np, NULL, "fsl,cpm1-pario-bank-e")
752 cpm2_gpiochip_add32(np);
753 return 0;
754}
755arch_initcall(cpm_init_par_io);
756
757#endif /* CONFIG_8xx_GPIO */
diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
index 5a6c5dfc53ef..f1c3395633b9 100644
--- a/arch/powerpc/sysdev/cpm2.c
+++ b/arch/powerpc/sysdev/cpm2.c
@@ -115,16 +115,10 @@ EXPORT_SYMBOL(cpm_command);
115 * Baud rate clocks are zero-based in the driver code (as that maps 115 * Baud rate clocks are zero-based in the driver code (as that maps
116 * to port numbers). Documentation uses 1-based numbering. 116 * to port numbers). Documentation uses 1-based numbering.
117 */ 117 */
118#define BRG_INT_CLK (get_brgfreq()) 118void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src)
119#define BRG_UART_CLK (BRG_INT_CLK/16)
120
121/* This function is used by UARTS, or anything else that uses a 16x
122 * oversampled clock.
123 */
124void
125cpm_setbrg(uint brg, uint rate)
126{ 119{
127 u32 __iomem *bp; 120 u32 __iomem *bp;
121 u32 val;
128 122
129 /* This is good enough to get SMCs running..... 123 /* This is good enough to get SMCs running.....
130 */ 124 */
@@ -135,34 +129,14 @@ cpm_setbrg(uint brg, uint rate)
135 brg -= 4; 129 brg -= 4;
136 } 130 }
137 bp += brg; 131 bp += brg;
138 out_be32(bp, (((BRG_UART_CLK / rate) - 1) << 1) | CPM_BRG_EN); 132 val = (((clk / rate) - 1) << 1) | CPM_BRG_EN | src;
139
140 cpm2_unmap(bp);
141}
142
143/* This function is used to set high speed synchronous baud rate
144 * clocks.
145 */
146void
147cpm2_fastbrg(uint brg, uint rate, int div16)
148{
149 u32 __iomem *bp;
150 u32 val;
151
152 if (brg < 4) {
153 bp = cpm2_map_size(im_brgc1, 16);
154 } else {
155 bp = cpm2_map_size(im_brgc5, 16);
156 brg -= 4;
157 }
158 bp += brg;
159 val = ((BRG_INT_CLK / rate) << 1) | CPM_BRG_EN;
160 if (div16) 133 if (div16)
161 val |= CPM_BRG_DIV16; 134 val |= CPM_BRG_DIV16;
162 135
163 out_be32(bp, val); 136 out_be32(bp, val);
164 cpm2_unmap(bp); 137 cpm2_unmap(bp);
165} 138}
139EXPORT_SYMBOL(__cpm2_setbrg);
166 140
167int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode) 141int cpm2_clk_setup(enum cpm_clk_target target, int clock, int mode)
168{ 142{
@@ -377,3 +351,14 @@ void cpm2_set_pin(int port, int pin, int flags)
377 else 351 else
378 clrbits32(&iop[port].odr, pin); 352 clrbits32(&iop[port].odr, pin);
379} 353}
354
355static int cpm_init_par_io(void)
356{
357 struct device_node *np;
358
359 for_each_compatible_node(np, NULL, "fsl,cpm2-pario-bank")
360 cpm2_gpiochip_add32(np);
361 return 0;
362}
363arch_initcall(cpm_init_par_io);
364
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index e4b7296acb2c..53da8a079f96 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -19,6 +19,8 @@
19 19
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/of_device.h> 21#include <linux/of_device.h>
22#include <linux/spinlock.h>
23#include <linux/of.h>
22 24
23#include <asm/udbg.h> 25#include <asm/udbg.h>
24#include <asm/io.h> 26#include <asm/io.h>
@@ -28,6 +30,10 @@
28 30
29#include <mm/mmu_decl.h> 31#include <mm/mmu_decl.h>
30 32
33#if defined(CONFIG_CPM2) || defined(CONFIG_8xx_GPIO)
34#include <linux/of_gpio.h>
35#endif
36
31#ifdef CONFIG_PPC_EARLY_DEBUG_CPM 37#ifdef CONFIG_PPC_EARLY_DEBUG_CPM
32static u32 __iomem *cpm_udbg_txdesc = 38static u32 __iomem *cpm_udbg_txdesc =
33 (u32 __iomem __force *)CONFIG_PPC_EARLY_DEBUG_CPM_ADDR; 39 (u32 __iomem __force *)CONFIG_PPC_EARLY_DEBUG_CPM_ADDR;
@@ -207,3 +213,120 @@ dma_addr_t cpm_muram_dma(void __iomem *addr)
207 return muram_pbase + ((u8 __iomem *)addr - muram_vbase); 213 return muram_pbase + ((u8 __iomem *)addr - muram_vbase);
208} 214}
209EXPORT_SYMBOL(cpm_muram_dma); 215EXPORT_SYMBOL(cpm_muram_dma);
216
217#if defined(CONFIG_CPM2) || defined(CONFIG_8xx_GPIO)
218
219struct cpm2_ioports {
220 u32 dir, par, sor, odr, dat;
221 u32 res[3];
222};
223
224struct cpm2_gpio32_chip {
225 struct of_mm_gpio_chip mm_gc;
226 spinlock_t lock;
227
228 /* shadowed data register to clear/set bits safely */
229 u32 cpdata;
230};
231
232static inline struct cpm2_gpio32_chip *
233to_cpm2_gpio32_chip(struct of_mm_gpio_chip *mm_gc)
234{
235 return container_of(mm_gc, struct cpm2_gpio32_chip, mm_gc);
236}
237
238static void cpm2_gpio32_save_regs(struct of_mm_gpio_chip *mm_gc)
239{
240 struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc);
241 struct cpm2_ioports __iomem *iop = mm_gc->regs;
242
243 cpm2_gc->cpdata = in_be32(&iop->dat);
244}
245
246static int cpm2_gpio32_get(struct gpio_chip *gc, unsigned int gpio)
247{
248 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
249 struct cpm2_ioports __iomem *iop = mm_gc->regs;
250 u32 pin_mask;
251
252 pin_mask = 1 << (31 - gpio);
253
254 return !!(in_be32(&iop->dat) & pin_mask);
255}
256
257static void cpm2_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value)
258{
259 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
260 struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc);
261 struct cpm2_ioports __iomem *iop = mm_gc->regs;
262 unsigned long flags;
263 u32 pin_mask = 1 << (31 - gpio);
264
265 spin_lock_irqsave(&cpm2_gc->lock, flags);
266
267 if (value)
268 cpm2_gc->cpdata |= pin_mask;
269 else
270 cpm2_gc->cpdata &= ~pin_mask;
271
272 out_be32(&iop->dat, cpm2_gc->cpdata);
273
274 spin_unlock_irqrestore(&cpm2_gc->lock, flags);
275}
276
277static int cpm2_gpio32_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
278{
279 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
280 struct cpm2_ioports __iomem *iop = mm_gc->regs;
281 u32 pin_mask;
282
283 pin_mask = 1 << (31 - gpio);
284
285 setbits32(&iop->dir, pin_mask);
286
287 cpm2_gpio32_set(gc, gpio, val);
288
289 return 0;
290}
291
292static int cpm2_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio)
293{
294 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
295 struct cpm2_ioports __iomem *iop = mm_gc->regs;
296 u32 pin_mask;
297
298 pin_mask = 1 << (31 - gpio);
299
300 clrbits32(&iop->dir, pin_mask);
301
302 return 0;
303}
304
305int cpm2_gpiochip_add32(struct device_node *np)
306{
307 struct cpm2_gpio32_chip *cpm2_gc;
308 struct of_mm_gpio_chip *mm_gc;
309 struct of_gpio_chip *of_gc;
310 struct gpio_chip *gc;
311
312 cpm2_gc = kzalloc(sizeof(*cpm2_gc), GFP_KERNEL);
313 if (!cpm2_gc)
314 return -ENOMEM;
315
316 spin_lock_init(&cpm2_gc->lock);
317
318 mm_gc = &cpm2_gc->mm_gc;
319 of_gc = &mm_gc->of_gc;
320 gc = &of_gc->gc;
321
322 mm_gc->save_regs = cpm2_gpio32_save_regs;
323 of_gc->gpio_cells = 2;
324 gc->ngpio = 32;
325 gc->direction_input = cpm2_gpio32_dir_in;
326 gc->direction_output = cpm2_gpio32_dir_out;
327 gc->get = cpm2_gpio32_get;
328 gc->set = cpm2_gpio32_set;
329
330 return of_mm_gpiochip_add(np, mm_gc);
331}
332#endif /* CONFIG_CPM2 || CONFIG_8xx_GPIO */
diff --git a/arch/powerpc/sysdev/rtc_cmos_setup.c b/arch/powerpc/sysdev/rtc_cmos_setup.c
index c09ddc0dbeb3..c1879ebfd4f4 100644
--- a/arch/powerpc/sysdev/rtc_cmos_setup.c
+++ b/arch/powerpc/sysdev/rtc_cmos_setup.c
@@ -21,6 +21,7 @@ static int __init add_rtc(void)
21 struct device_node *np; 21 struct device_node *np;
22 struct platform_device *pd; 22 struct platform_device *pd;
23 struct resource res[2]; 23 struct resource res[2];
24 unsigned int num_res = 1;
24 int ret; 25 int ret;
25 26
26 memset(&res, 0, sizeof(res)); 27 memset(&res, 0, sizeof(res));
@@ -41,14 +42,24 @@ static int __init add_rtc(void)
41 if (res[0].start != RTC_PORT(0)) 42 if (res[0].start != RTC_PORT(0))
42 return -EINVAL; 43 return -EINVAL;
43 44
44 /* Use a fixed interrupt value of 8 since on PPC if we are using this 45 np = of_find_compatible_node(NULL, NULL, "chrp,iic");
45 * its off an i8259 which we ensure has interrupt numbers 0..15. */ 46 if (!np)
46 res[1].start = 8; 47 np = of_find_compatible_node(NULL, NULL, "pnpPNP,000");
47 res[1].end = 8; 48 if (np) {
48 res[1].flags = IORESOURCE_IRQ; 49 of_node_put(np);
50 /*
51 * Use a fixed interrupt value of 8 since on PPC if we are
52 * using this its off an i8259 which we ensure has interrupt
53 * numbers 0..15.
54 */
55 res[1].start = 8;
56 res[1].end = 8;
57 res[1].flags = IORESOURCE_IRQ;
58 num_res++;
59 }
49 60
50 pd = platform_device_register_simple("rtc_cmos", -1, 61 pd = platform_device_register_simple("rtc_cmos", -1,
51 &res[0], 2); 62 &res[0], num_res);
52 63
53 if (IS_ERR(pd)) 64 if (IS_ERR(pd))
54 return PTR_ERR(pd); 65 return PTR_ERR(pd);
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 2ed88122be93..8d41908e2513 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -317,6 +317,9 @@ config ARCH_ENABLE_MEMORY_HOTPLUG
317 def_bool y 317 def_bool y
318 depends on SPARSEMEM 318 depends on SPARSEMEM
319 319
320config ARCH_ENABLE_MEMORY_HOTREMOVE
321 def_bool y
322
320source "mm/Kconfig" 323source "mm/Kconfig"
321 324
322comment "I/O subsystem configuration" 325comment "I/O subsystem configuration"
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index d003a6e16afb..328a20e880b5 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1732,3 +1732,40 @@ compat_sys_timerfd_gettime_wrapper:
1732 lgfr %r2,%r2 # int 1732 lgfr %r2,%r2 # int
1733 llgtr %r3,%r3 # struct compat_itimerspec * 1733 llgtr %r3,%r3 # struct compat_itimerspec *
1734 jg compat_sys_timerfd_gettime 1734 jg compat_sys_timerfd_gettime
1735
1736 .globl compat_sys_signalfd4_wrapper
1737compat_sys_signalfd4_wrapper:
1738 lgfr %r2,%r2 # int
1739 llgtr %r3,%r3 # compat_sigset_t *
1740 llgfr %r4,%r4 # compat_size_t
1741 lgfr %r5,%r5 # int
1742 jg compat_sys_signalfd4
1743
1744 .globl sys_eventfd2_wrapper
1745sys_eventfd2_wrapper:
1746 llgfr %r2,%r2 # unsigned int
1747 lgfr %r3,%r3 # int
1748 jg sys_eventfd2
1749
1750 .globl sys_inotify_init1_wrapper
1751sys_inotify_init1_wrapper:
1752 lgfr %r2,%r2 # int
1753 jg sys_inotify_init1
1754
1755 .globl sys_pipe2_wrapper
1756sys_pipe2_wrapper:
1757 llgtr %r2,%r2 # u32 *
1758 lgfr %r3,%r3 # int
1759 jg sys_pipe2 # branch to system call
1760
1761 .globl sys_dup3_wrapper
1762sys_dup3_wrapper:
1763 llgfr %r2,%r2 # unsigned int
1764 llgfr %r3,%r3 # unsigned int
1765 lgfr %r4,%r4 # int
1766 jg sys_dup3 # branch to system call
1767
1768 .globl sys_epoll_create1_wrapper
1769sys_epoll_create1_wrapper:
1770 lgfr %r2,%r2 # int
1771 jg sys_epoll_create1 # branch to system call
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 54b2779b5e2f..2dcf590faba6 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -1705,7 +1705,10 @@ void __init setup_ipl(void)
1705 1705
1706void __init ipl_update_parameters(void) 1706void __init ipl_update_parameters(void)
1707{ 1707{
1708 if (diag308(DIAG308_STORE, &ipl_block) == DIAG308_RC_OK) 1708 int rc;
1709
1710 rc = diag308(DIAG308_STORE, &ipl_block);
1711 if ((rc == DIAG308_RC_OK) || (rc == DIAG308_RC_NOCONFIG))
1709 diag308_set_works = 1; 1712 diag308_set_works = 1;
1710} 1713}
1711 1714
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 4f82e5b5f879..569079ec4ff0 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -197,7 +197,7 @@ void __kprobes arch_arm_kprobe(struct kprobe *p)
197 args.new = BREAKPOINT_INSTRUCTION; 197 args.new = BREAKPOINT_INSTRUCTION;
198 198
199 kcb->kprobe_status = KPROBE_SWAP_INST; 199 kcb->kprobe_status = KPROBE_SWAP_INST;
200 stop_machine_run(swap_instruction, &args, NR_CPUS); 200 stop_machine(swap_instruction, &args, NULL);
201 kcb->kprobe_status = status; 201 kcb->kprobe_status = status;
202} 202}
203 203
@@ -212,7 +212,7 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
212 args.new = p->opcode; 212 args.new = p->opcode;
213 213
214 kcb->kprobe_status = KPROBE_SWAP_INST; 214 kcb->kprobe_status = KPROBE_SWAP_INST;
215 stop_machine_run(swap_instruction, &args, NR_CPUS); 215 stop_machine(swap_instruction, &args, NULL);
216 kcb->kprobe_status = status; 216 kcb->kprobe_status = status;
217} 217}
218 218
@@ -331,7 +331,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
331 * No kprobe at this address. The fault has not been 331 * No kprobe at this address. The fault has not been
332 * caused by a kprobe breakpoint. The race of breakpoint 332 * caused by a kprobe breakpoint. The race of breakpoint
333 * vs. kprobe remove does not exist because on s390 we 333 * vs. kprobe remove does not exist because on s390 we
334 * use stop_machine_run to arm/disarm the breakpoints. 334 * use stop_machine to arm/disarm the breakpoints.
335 */ 335 */
336 goto no_kprobe; 336 goto no_kprobe;
337 337
diff --git a/arch/s390/kernel/mem_detect.c b/arch/s390/kernel/mem_detect.c
index 18ed7abe16c5..9872999c66d1 100644
--- a/arch/s390/kernel/mem_detect.c
+++ b/arch/s390/kernel/mem_detect.c
@@ -9,27 +9,6 @@
9#include <asm/sclp.h> 9#include <asm/sclp.h>
10#include <asm/setup.h> 10#include <asm/setup.h>
11 11
12static int memory_fast_detect(struct mem_chunk *chunk)
13{
14 unsigned long val0 = 0;
15 unsigned long val1 = 0xc;
16 int rc = -EOPNOTSUPP;
17
18 if (ipl_flags & IPL_NSS_VALID)
19 return -EOPNOTSUPP;
20 asm volatile(
21 " diag %1,%2,0x260\n"
22 "0: lhi %0,0\n"
23 "1:\n"
24 EX_TABLE(0b,1b)
25 : "+d" (rc), "+d" (val0), "+d" (val1) : : "cc");
26
27 if (rc || val0 != val1)
28 return -EOPNOTSUPP;
29 chunk->size = val0 + 1;
30 return 0;
31}
32
33static inline int tprot(unsigned long addr) 12static inline int tprot(unsigned long addr)
34{ 13{
35 int rc = -EFAULT; 14 int rc = -EFAULT;
@@ -84,8 +63,6 @@ void detect_memory_layout(struct mem_chunk chunk[])
84 unsigned long flags, cr0; 63 unsigned long flags, cr0;
85 64
86 memset(chunk, 0, MEMORY_CHUNKS * sizeof(struct mem_chunk)); 65 memset(chunk, 0, MEMORY_CHUNKS * sizeof(struct mem_chunk));
87 if (memory_fast_detect(&chunk[0]) == 0)
88 return;
89 /* Disable IRQs, DAT and low address protection so tprot does the 66 /* Disable IRQs, DAT and low address protection so tprot does the
90 * right thing and we don't get scheduled away with low address 67 * right thing and we don't get scheduled away with low address
91 * protection disabled. 68 * protection disabled.
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index c87ec687d4c6..c66d35e55142 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -330,3 +330,9 @@ SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper)
330SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper) 330SYSCALL(sys_timerfd_create,sys_timerfd_create,sys_timerfd_create_wrapper)
331SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime_wrapper) /* 320 */ 331SYSCALL(sys_timerfd_settime,sys_timerfd_settime,compat_sys_timerfd_settime_wrapper) /* 320 */
332SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime_wrapper) 332SYSCALL(sys_timerfd_gettime,sys_timerfd_gettime,compat_sys_timerfd_gettime_wrapper)
333SYSCALL(sys_signalfd4,sys_signalfd4,compat_sys_signalfd4_wrapper)
334SYSCALL(sys_eventfd2,sys_eventfd2,sys_eventfd2_wrapper)
335SYSCALL(sys_inotify_init1,sys_inotify_init1,sys_inotify_init1_wrapper)
336SYSCALL(sys_pipe2,sys_pipe2,sys_pipe2_wrapper) /* 325 */
337SYSCALL(sys_dup3,sys_dup3,sys_dup3_wrapper)
338SYSCALL(sys_epoll_create1,sys_epoll_create1,sys_epoll_create1_wrapper)
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index ab70d9bd9261..ca114fe46ffb 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -1348,7 +1348,7 @@ early_param("stp", early_parse_stp);
1348/* 1348/*
1349 * Reset STP attachment. 1349 * Reset STP attachment.
1350 */ 1350 */
1351static void stp_reset(void) 1351static void __init stp_reset(void)
1352{ 1352{
1353 int rc; 1353 int rc;
1354 1354
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c
index eae21a8ac72d..fc6ab6094df8 100644
--- a/arch/s390/lib/delay.c
+++ b/arch/s390/lib/delay.c
@@ -43,7 +43,7 @@ void __udelay(unsigned long usecs)
43 local_bh_disable(); 43 local_bh_disable();
44 local_irq_save(flags); 44 local_irq_save(flags);
45 if (raw_irqs_disabled_flags(flags)) { 45 if (raw_irqs_disabled_flags(flags)) {
46 old_cc = S390_lowcore.clock_comparator; 46 old_cc = local_tick_disable();
47 S390_lowcore.clock_comparator = -1ULL; 47 S390_lowcore.clock_comparator = -1ULL;
48 __ctl_store(cr0, 0, 0); 48 __ctl_store(cr0, 0, 0);
49 dummy = (cr0 & 0xffff00e0) | 0x00000800; 49 dummy = (cr0 & 0xffff00e0) | 0x00000800;
@@ -65,7 +65,7 @@ void __udelay(unsigned long usecs)
65 65
66 if (raw_irqs_disabled_flags(flags)) { 66 if (raw_irqs_disabled_flags(flags)) {
67 __ctl_load(cr0, 0, 0); 67 __ctl_load(cr0, 0, 0);
68 S390_lowcore.clock_comparator = old_cc; 68 local_tick_enable(old_cc);
69 } 69 }
70 if (!irq_context) 70 if (!irq_context)
71 _local_bh_enable(); 71 _local_bh_enable();
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 4993b0f594eb..1169130a97ef 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -179,7 +179,7 @@ int arch_add_memory(int nid, u64 start, u64 size)
179 int rc; 179 int rc;
180 180
181 pgdat = NODE_DATA(nid); 181 pgdat = NODE_DATA(nid);
182 zone = pgdat->node_zones + ZONE_NORMAL; 182 zone = pgdat->node_zones + ZONE_MOVABLE;
183 rc = vmem_add_mapping(start, size); 183 rc = vmem_add_mapping(start, size);
184 if (rc) 184 if (rc)
185 return rc; 185 return rc;
@@ -189,3 +189,14 @@ int arch_add_memory(int nid, u64 start, u64 size)
189 return rc; 189 return rc;
190} 190}
191#endif /* CONFIG_MEMORY_HOTPLUG */ 191#endif /* CONFIG_MEMORY_HOTPLUG */
192
193#ifdef CONFIG_MEMORY_HOTREMOVE
194int remove_memory(u64 start, u64 size)
195{
196 unsigned long start_pfn, end_pfn;
197
198 start_pfn = PFN_DOWN(start);
199 end_pfn = start_pfn + PFN_DOWN(size);
200 return offline_pages(start_pfn, end_pfn, 120 * HZ);
201}
202#endif /* CONFIG_MEMORY_HOTREMOVE */
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 8879938f3356..cb992c3d6b71 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -11,6 +11,7 @@ config SUPERH
11 select HAVE_CLK 11 select HAVE_CLK
12 select HAVE_IDE 12 select HAVE_IDE
13 select HAVE_OPROFILE 13 select HAVE_OPROFILE
14 select HAVE_GENERIC_DMA_COHERENT
14 help 15 help
15 The SuperH is a RISC processor targeted for use in embedded systems 16 The SuperH is a RISC processor targeted for use in embedded systems
16 and consumer electronics; it was also used in the Sega Dreamcast 17 and consumer electronics; it was also used in the Sega Dreamcast
@@ -23,6 +24,11 @@ config SUPERH32
23config SUPERH64 24config SUPERH64
24 def_bool y if CPU_SH5 25 def_bool y if CPU_SH5
25 26
27config ARCH_DEFCONFIG
28 string
29 default "arch/sh/configs/shx3_defconfig" if SUPERH32
30 default "arch/sh/configs/cayman_defconfig" if SUPERH64
31
26config RWSEM_GENERIC_SPINLOCK 32config RWSEM_GENERIC_SPINLOCK
27 def_bool y 33 def_bool y
28 34
@@ -347,219 +353,10 @@ config CPU_SUBTYPE_SH5_103
347endchoice 353endchoice
348 354
349source "arch/sh/mm/Kconfig" 355source "arch/sh/mm/Kconfig"
356
350source "arch/sh/Kconfig.cpu" 357source "arch/sh/Kconfig.cpu"
351 358
352menu "Board support" 359source "arch/sh/boards/Kconfig"
353
354config SOLUTION_ENGINE
355 bool
356
357config SH_SOLUTION_ENGINE
358 bool "SolutionEngine"
359 select SOLUTION_ENGINE
360 select CPU_HAS_IPR_IRQ
361 depends on CPU_SUBTYPE_SH7705 || CPU_SUBTYPE_SH7709 || CPU_SUBTYPE_SH7710 || \
362 CPU_SUBTYPE_SH7712 || CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7750S || \
363 CPU_SUBTYPE_SH7750R
364 help
365 Select SolutionEngine if configuring for a Hitachi SH7705, SH7709,
366 SH7710, SH7712, SH7750, SH7750S or SH7750R evaluation board.
367
368config SH_7206_SOLUTION_ENGINE
369 bool "SolutionEngine7206"
370 select SOLUTION_ENGINE
371 depends on CPU_SUBTYPE_SH7206
372 help
373 Select 7206 SolutionEngine if configuring for a Hitachi SH7206
374 evaluation board.
375
376config SH_7619_SOLUTION_ENGINE
377 bool "SolutionEngine7619"
378 select SOLUTION_ENGINE
379 depends on CPU_SUBTYPE_SH7619
380 help
381 Select 7619 SolutionEngine if configuring for a Hitachi SH7619
382 evaluation board.
383
384config SH_7721_SOLUTION_ENGINE
385 bool "SolutionEngine7721"
386 select SOLUTION_ENGINE
387 depends on CPU_SUBTYPE_SH7721
388 help
389 Select 7721 SolutionEngine if configuring for a Hitachi SH7721
390 evaluation board.
391
392config SH_7722_SOLUTION_ENGINE
393 bool "SolutionEngine7722"
394 select SOLUTION_ENGINE
395 depends on CPU_SUBTYPE_SH7722
396 help
397 Select 7722 SolutionEngine if configuring for a Hitachi SH772
398 evaluation board.
399
400config SH_7751_SOLUTION_ENGINE
401 bool "SolutionEngine7751"
402 select SOLUTION_ENGINE
403 select CPU_HAS_IPR_IRQ
404 depends on CPU_SUBTYPE_SH7751
405 help
406 Select 7751 SolutionEngine if configuring for a Hitachi SH7751
407 evaluation board.
408
409config SH_7780_SOLUTION_ENGINE
410 bool "SolutionEngine7780"
411 select SOLUTION_ENGINE
412 select SYS_SUPPORTS_PCI
413 depends on CPU_SUBTYPE_SH7780
414 help
415 Select 7780 SolutionEngine if configuring for a Renesas SH7780
416 evaluation board.
417
418config SH_7343_SOLUTION_ENGINE
419 bool "SolutionEngine7343"
420 select SOLUTION_ENGINE
421 depends on CPU_SUBTYPE_SH7343
422 help
423 Select 7343 SolutionEngine if configuring for a Hitachi
424 SH7343 (SH-Mobile 3AS) evaluation board.
425
426config SH_7751_SYSTEMH
427 bool "SystemH7751R"
428 depends on CPU_SUBTYPE_SH7751R
429 help
430 Select SystemH if you are configuring for a Renesas SystemH
431 7751R evaluation board.
432
433config SH_HP6XX
434 bool "HP6XX"
435 select SYS_SUPPORTS_APM_EMULATION
436 select HD6446X_SERIES
437 depends on CPU_SUBTYPE_SH7709
438 help
439 Select HP6XX if configuring for a HP jornada HP6xx.
440 More information (hardware only) at
441 <http://www.hp.com/jornada/>.
442
443config SH_DREAMCAST
444 bool "Dreamcast"
445 select SYS_SUPPORTS_PCI
446 depends on CPU_SUBTYPE_SH7091
447 help
448 Select Dreamcast if configuring for a SEGA Dreamcast.
449 More information at <http://www.linux-sh.org>
450
451config SH_SH03
452 bool "Interface CTP/PCI-SH03"
453 depends on CPU_SUBTYPE_SH7751
454 select CPU_HAS_IPR_IRQ
455 select SYS_SUPPORTS_PCI
456 help
457 CTP/PCI-SH03 is a CPU module computer that is produced
458 by Interface Corporation.
459 More information at <http://www.interface.co.jp>
460
461config SH_SECUREEDGE5410
462 bool "SecureEdge5410"
463 depends on CPU_SUBTYPE_SH7751R
464 select CPU_HAS_IPR_IRQ
465 select SYS_SUPPORTS_PCI
466 help
467 Select SecureEdge5410 if configuring for a SnapGear SH board.
468 This includes both the OEM SecureEdge products as well as the
469 SME product line.
470
471config SH_RTS7751R2D
472 bool "RTS7751R2D"
473 depends on CPU_SUBTYPE_SH7751R
474 select SYS_SUPPORTS_PCI
475 select IO_TRAPPED
476 help
477 Select RTS7751R2D if configuring for a Renesas Technology
478 Sales SH-Graphics board.
479
480config SH_SDK7780
481 bool "SDK7780R3"
482 depends on CPU_SUBTYPE_SH7780
483 select SYS_SUPPORTS_PCI
484 help
485 Select SDK7780 if configuring for a Renesas SH7780 SDK7780R3
486 evaluation board.
487
488config SH_HIGHLANDER
489 bool "Highlander"
490 depends on CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785
491 select SYS_SUPPORTS_PCI
492 select IO_TRAPPED
493
494config SH_MIGOR
495 bool "Migo-R"
496 depends on CPU_SUBTYPE_SH7722
497 help
498 Select Migo-R if configuring for the SH7722 Migo-R platform
499 by Renesas System Solutions Asia Pte. Ltd.
500
501config SH_EDOSK7705
502 bool "EDOSK7705"
503 depends on CPU_SUBTYPE_SH7705
504
505config SH_SH4202_MICRODEV
506 bool "SH4-202 MicroDev"
507 depends on CPU_SUBTYPE_SH4_202
508 help
509 Select SH4-202 MicroDev if configuring for a SuperH MicroDev board
510 with an SH4-202 CPU.
511
512config SH_LANDISK
513 bool "LANDISK"
514 depends on CPU_SUBTYPE_SH7751R
515 select SYS_SUPPORTS_PCI
516 help
517 I-O DATA DEVICE, INC. "LANDISK Series" support.
518
519config SH_TITAN
520 bool "TITAN"
521 depends on CPU_SUBTYPE_SH7751R
522 select CPU_HAS_IPR_IRQ
523 select SYS_SUPPORTS_PCI
524 help
525 Select Titan if you are configuring for a Nimble Microsystems
526 NetEngine NP51R.
527
528config SH_SHMIN
529 bool "SHMIN"
530 depends on CPU_SUBTYPE_SH7706
531 select CPU_HAS_IPR_IRQ
532 help
533 Select SHMIN if configuring for the SHMIN board.
534
535config SH_LBOX_RE2
536 bool "L-BOX RE2"
537 depends on CPU_SUBTYPE_SH7751R
538 select SYS_SUPPORTS_PCI
539 help
540 Select L-BOX RE2 if configuring for the NTT COMWARE L-BOX RE2.
541
542config SH_X3PROTO
543 bool "SH-X3 Prototype board"
544 depends on CPU_SUBTYPE_SHX3
545
546config SH_MAGIC_PANEL_R2
547 bool "Magic Panel R2"
548 depends on CPU_SUBTYPE_SH7720
549 help
550 Select Magic Panel R2 if configuring for Magic Panel R2.
551
552config SH_CAYMAN
553 bool "Hitachi Cayman"
554 depends on CPU_SUBTYPE_SH5_101 || CPU_SUBTYPE_SH5_103
555 select SYS_SUPPORTS_PCI
556
557endmenu
558
559source "arch/sh/boards/renesas/rts7751r2d/Kconfig"
560source "arch/sh/boards/renesas/r7780rp/Kconfig"
561source "arch/sh/boards/renesas/sdk7780/Kconfig"
562source "arch/sh/boards/magicpanelr2/Kconfig"
563 360
564menu "Timer and clock configuration" 361menu "Timer and clock configuration"
565 362
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index 0f4549860226..36f4b1f7066d 100644
--- a/arch/sh/Kconfig.debug
+++ b/arch/sh/Kconfig.debug
@@ -36,7 +36,8 @@ config EARLY_SCIF_CONSOLE_PORT
36 default "0xff804000" if CPU_SUBTYPE_MXG 36 default "0xff804000" if CPU_SUBTYPE_MXG
37 default "0xffc30000" if CPU_SUBTYPE_SHX3 37 default "0xffc30000" if CPU_SUBTYPE_SHX3
38 default "0xffe00000" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7763 || \ 38 default "0xffe00000" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7763 || \
39 CPU_SUBTYPE_SH7722 || CPU_SUBTYPE_SH7366 39 CPU_SUBTYPE_SH7722 || CPU_SUBTYPE_SH7366 || \
40 CPU_SUBTYPE_SH7343
40 default "0xffe80000" if CPU_SH4 41 default "0xffe80000" if CPU_SH4
41 default "0xffea0000" if CPU_SUBTYPE_SH7785 42 default "0xffea0000" if CPU_SUBTYPE_SH7785
42 default "0xfffe8000" if CPU_SUBTYPE_SH7203 43 default "0xfffe8000" if CPU_SUBTYPE_SH7203
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index fb7b1b15e392..25659ce74baa 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -68,7 +68,7 @@ OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment \
68defaultimage-$(CONFIG_SUPERH32) := zImage 68defaultimage-$(CONFIG_SUPERH32) := zImage
69 69
70# Set some sensible Kbuild defaults 70# Set some sensible Kbuild defaults
71KBUILD_DEFCONFIG := r7780mp_defconfig 71KBUILD_DEFCONFIG := shx3_defconfig
72KBUILD_IMAGE := $(defaultimage-y) 72KBUILD_IMAGE := $(defaultimage-y)
73 73
74# 74#
@@ -91,47 +91,34 @@ LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64+4'
91LDFLAGS += -EB 91LDFLAGS += -EB
92endif 92endif
93 93
94KBUILD_CFLAGS += -pipe $(cflags-y)
95KBUILD_AFLAGS += $(cflags-y)
96
97head-y := arch/sh/kernel/init_task.o 94head-y := arch/sh/kernel/init_task.o
98head-$(CONFIG_SUPERH32) += arch/sh/kernel/head_32.o 95head-$(CONFIG_SUPERH32) += arch/sh/kernel/head_32.o
99head-$(CONFIG_SUPERH64) += arch/sh/kernel/head_64.o 96head-$(CONFIG_SUPERH64) += arch/sh/kernel/head_64.o
100 97
101LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 98LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
102 99
103core-y += arch/sh/kernel/ arch/sh/mm/ 100core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/
104core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/ 101core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/
105 102
106# Boards 103# Mach groups
107machdir-$(CONFIG_SH_SOLUTION_ENGINE) += se/770x 104machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se
108machdir-$(CONFIG_SH_7722_SOLUTION_ENGINE) += se/7722 105machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx
109machdir-$(CONFIG_SH_7751_SOLUTION_ENGINE) += se/7751 106machdir-$(CONFIG_SH_DREAMCAST) += mach-dreamcast
110machdir-$(CONFIG_SH_7780_SOLUTION_ENGINE) += se/7780 107machdir-$(CONFIG_SH_SH03) += mach-sh03
111machdir-$(CONFIG_SH_7343_SOLUTION_ENGINE) += se/7343 108machdir-$(CONFIG_SH_SECUREEDGE5410) += mach-snapgear
112machdir-$(CONFIG_SH_7721_SOLUTION_ENGINE) += se/7721 109machdir-$(CONFIG_SH_RTS7751R2D) += mach-r2d
113machdir-$(CONFIG_SH_HP6XX) += hp6xx 110machdir-$(CONFIG_SH_7751_SYSTEMH) += mach-systemh
114machdir-$(CONFIG_SH_DREAMCAST) += dreamcast 111machdir-$(CONFIG_SH_EDOSK7705) += mach-edosk7705
115machdir-$(CONFIG_SH_SH03) += sh03 112machdir-$(CONFIG_SH_HIGHLANDER) += mach-highlander
116machdir-$(CONFIG_SH_SECUREEDGE5410) += snapgear 113machdir-$(CONFIG_SH_MIGOR) += mach-migor
117machdir-$(CONFIG_SH_RTS7751R2D) += renesas/rts7751r2d 114machdir-$(CONFIG_SH_SDK7780) += mach-sdk7780
118machdir-$(CONFIG_SH_7751_SYSTEMH) += renesas/systemh 115machdir-$(CONFIG_SH_X3PROTO) += mach-x3proto
119machdir-$(CONFIG_SH_EDOSK7705) += renesas/edosk7705 116machdir-$(CONFIG_SH_SH7763RDP) += mach-sh7763rdp
120machdir-$(CONFIG_SH_HIGHLANDER) += renesas/r7780rp 117machdir-$(CONFIG_SH_SH4202_MICRODEV) += mach-microdev
121machdir-$(CONFIG_SH_MIGOR) += renesas/migor 118machdir-$(CONFIG_SH_LANDISK) += mach-landisk
122machdir-$(CONFIG_SH_SDK7780) += renesas/sdk7780 119machdir-$(CONFIG_SH_TITAN) += mach-titan
123machdir-$(CONFIG_SH_X3PROTO) += renesas/x3proto 120machdir-$(CONFIG_SH_LBOX_RE2) += mach-lboxre2
124machdir-$(CONFIG_SH_SH4202_MICRODEV) += superh/microdev 121machdir-$(CONFIG_SH_CAYMAN) += mach-cayman
125machdir-$(CONFIG_SH_LANDISK) += landisk
126machdir-$(CONFIG_SH_TITAN) += titan
127machdir-$(CONFIG_SH_SHMIN) += shmin
128machdir-$(CONFIG_SH_7206_SOLUTION_ENGINE) += se/7206
129machdir-$(CONFIG_SH_7619_SOLUTION_ENGINE) += se/7619
130machdir-$(CONFIG_SH_LBOX_RE2) += lboxre2
131machdir-$(CONFIG_SH_MAGIC_PANEL_R2) += magicpanelr2
132machdir-$(CONFIG_SH_CAYMAN) += cayman
133
134incdir-y := $(notdir $(machdir-y))
135 122
136ifneq ($(machdir-y),) 123ifneq ($(machdir-y),)
137core-y += $(addprefix arch/sh/boards/, \ 124core-y += $(addprefix arch/sh/boards/, \
@@ -141,11 +128,22 @@ endif
141# Companion chips 128# Companion chips
142core-$(CONFIG_HD6446X_SERIES) += arch/sh/cchips/hd6446x/ 129core-$(CONFIG_HD6446X_SERIES) += arch/sh/cchips/hd6446x/
143 130
144cpuincdir-$(CONFIG_CPU_SH2) := cpu-sh2 131#
145cpuincdir-$(CONFIG_CPU_SH2A) := cpu-sh2a 132# CPU header paths
146cpuincdir-$(CONFIG_CPU_SH3) := cpu-sh3 133#
147cpuincdir-$(CONFIG_CPU_SH4) := cpu-sh4 134# These are ordered by optimization level. A CPU family that is a subset
148cpuincdir-$(CONFIG_CPU_SH5) := cpu-sh5 135# of another (ie, SH-2A / SH-2), is picked up first, with increasing
136# levels of genericness if nothing more suitable is situated in the
137# hierarchy.
138#
139# As an example, in order of preference, SH-2A > SH-2 > common definitions.
140#
141cpuincdir-$(CONFIG_CPU_SH2A) += cpu-sh2a
142cpuincdir-$(CONFIG_CPU_SH2) += cpu-sh2
143cpuincdir-$(CONFIG_CPU_SH3) += cpu-sh3
144cpuincdir-$(CONFIG_CPU_SH4) += cpu-sh4
145cpuincdir-$(CONFIG_CPU_SH5) += cpu-sh5
146cpuincdir-y += cpu-common # Must be last
149 147
150libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y) 148libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
151libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) 149libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
@@ -156,57 +154,17 @@ drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/
156 154
157boot := arch/sh/boot 155boot := arch/sh/boot
158 156
159ifneq ($(KBUILD_SRC),) 157cflags-y += $(foreach d, $(cpuincdir-y), -Iarch/sh/include/$(d)) \
160incdir-prefix := $(srctree)/include/asm-sh/ 158 $(foreach d, $(machdir-y), -Iarch/sh/include/$(d))
161else
162incdir-prefix :=
163endif
164
165# Update machine arch and proc symlinks if something which affects
166# them changed. We use .arch and .mach to indicate when they were
167# updated last, otherwise make uses the target directory mtime.
168
169include/asm-sh/.cpu: $(wildcard include/config/cpu/*.h) \
170 include/config/auto.conf FORCE
171 @echo ' SYMLINK include/asm-sh/cpu -> include/asm-sh/$(cpuincdir-y)'
172 $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
173 $(Q)ln -fsn $(incdir-prefix)$(cpuincdir-y) include/asm-sh/cpu
174 @touch $@
175 159
176# Most boards have their own mach directories. For the ones that 160KBUILD_CFLAGS += -pipe $(cflags-y)
177# don't, just reference the parent directory so the semantics are 161KBUILD_CPPFLAGS += $(cflags-y)
178# kept roughly the same. 162KBUILD_AFLAGS += $(cflags-y)
179#
180# When multiple boards are compiled in at the same time, preference
181# for the mach link is given to whichever has a directory for its
182# headers. However, this is only a workaround until platforms that
183# can live in the same kernel image back away from relying on the
184# mach link.
185
186include/asm-sh/.mach: $(wildcard include/config/sh/*.h) \
187 include/config/auto.conf FORCE
188 $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
189 $(Q)rm -f include/asm-sh/mach
190 $(Q)for i in $(incdir-y); do \
191 if [ -d $(srctree)/include/asm-sh/$$i ]; then \
192 echo -n ' SYMLINK include/asm-sh/mach -> '; \
193 echo -e "include/asm-sh/$$i"; \
194 ln -fsn $(incdir-prefix)$$i \
195 include/asm-sh/mach; \
196 else \
197 if [ ! -d include/asm-sh/mach ]; then \
198 echo -n ' SYMLINK include/asm-sh/mach -> '; \
199 echo -e 'include/asm-sh'; \
200 ln -fsn $(incdir-prefix)../asm-sh include/asm-sh/mach; \
201 fi; \
202 fi; \
203 done
204 @touch $@
205 163
206PHONY += maketools FORCE 164PHONY += maketools FORCE
207 165
208maketools: include/linux/version.h FORCE 166maketools: include/linux/version.h FORCE
209 $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h 167 $(Q)$(MAKE) $(build)=arch/sh/tools arch/sh/include/asm/machtypes.h
210 168
211all: $(KBUILD_IMAGE) 169all: $(KBUILD_IMAGE)
212 170
@@ -215,8 +173,7 @@ zImage uImage uImage.srec vmlinux.srec: vmlinux
215 173
216compressed: zImage 174compressed: zImage
217 175
218archprepare: include/asm-sh/.cpu include/asm-sh/.mach maketools \ 176archprepare: maketools arch/sh/lib64/syscalltab.h
219 arch/sh/lib64/syscalltab.h
220 177
221archclean: 178archclean:
222 $(Q)$(MAKE) $(clean)=$(boot) 179 $(Q)$(MAKE) $(clean)=$(boot)
@@ -258,6 +215,4 @@ arch/sh/lib64/syscalltab.h: arch/sh/kernel/syscalls_64.S
258 $(call filechk,gen-syscalltab) 215 $(call filechk,gen-syscalltab)
259 216
260CLEAN_FILES += arch/sh/lib64/syscalltab.h \ 217CLEAN_FILES += arch/sh/lib64/syscalltab.h \
261 include/asm-sh/machtypes.h \ 218 arch/sh/include/asm/machtypes.h
262 include/asm-sh/cpu include/asm-sh/.cpu \
263 include/asm-sh/mach include/asm-sh/.mach
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
new file mode 100644
index 000000000000..ae194869fd60
--- /dev/null
+++ b/arch/sh/boards/Kconfig
@@ -0,0 +1,258 @@
1menu "Board support"
2
3config SOLUTION_ENGINE
4 bool
5
6config SH_SOLUTION_ENGINE
7 bool "SolutionEngine"
8 select SOLUTION_ENGINE
9 select CPU_HAS_IPR_IRQ
10 depends on CPU_SUBTYPE_SH7705 || CPU_SUBTYPE_SH7709 || CPU_SUBTYPE_SH7710 || \
11 CPU_SUBTYPE_SH7712 || CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7750S || \
12 CPU_SUBTYPE_SH7750R
13 help
14 Select SolutionEngine if configuring for a Hitachi SH7705, SH7709,
15 SH7710, SH7712, SH7750, SH7750S or SH7750R evaluation board.
16
17config SH_7206_SOLUTION_ENGINE
18 bool "SolutionEngine7206"
19 select SOLUTION_ENGINE
20 depends on CPU_SUBTYPE_SH7206
21 help
22 Select 7206 SolutionEngine if configuring for a Hitachi SH7206
23 evaluation board.
24
25config SH_7619_SOLUTION_ENGINE
26 bool "SolutionEngine7619"
27 select SOLUTION_ENGINE
28 depends on CPU_SUBTYPE_SH7619
29 help
30 Select 7619 SolutionEngine if configuring for a Hitachi SH7619
31 evaluation board.
32
33config SH_7721_SOLUTION_ENGINE
34 bool "SolutionEngine7721"
35 select SOLUTION_ENGINE
36 depends on CPU_SUBTYPE_SH7721
37 help
38 Select 7721 SolutionEngine if configuring for a Hitachi SH7721
39 evaluation board.
40
41config SH_7722_SOLUTION_ENGINE
42 bool "SolutionEngine7722"
43 select SOLUTION_ENGINE
44 depends on CPU_SUBTYPE_SH7722
45 help
46 Select 7722 SolutionEngine if configuring for a Hitachi SH772
47 evaluation board.
48
49config SH_7751_SOLUTION_ENGINE
50 bool "SolutionEngine7751"
51 select SOLUTION_ENGINE
52 select CPU_HAS_IPR_IRQ
53 depends on CPU_SUBTYPE_SH7751
54 help
55 Select 7751 SolutionEngine if configuring for a Hitachi SH7751
56 evaluation board.
57
58config SH_7780_SOLUTION_ENGINE
59 bool "SolutionEngine7780"
60 select SOLUTION_ENGINE
61 select SYS_SUPPORTS_PCI
62 depends on CPU_SUBTYPE_SH7780
63 help
64 Select 7780 SolutionEngine if configuring for a Renesas SH7780
65 evaluation board.
66
67config SH_7343_SOLUTION_ENGINE
68 bool "SolutionEngine7343"
69 select SOLUTION_ENGINE
70 depends on CPU_SUBTYPE_SH7343
71 help
72 Select 7343 SolutionEngine if configuring for a Hitachi
73 SH7343 (SH-Mobile 3AS) evaluation board.
74
75config SH_7751_SYSTEMH
76 bool "SystemH7751R"
77 depends on CPU_SUBTYPE_SH7751R
78 help
79 Select SystemH if you are configuring for a Renesas SystemH
80 7751R evaluation board.
81
82config SH_HP6XX
83 bool "HP6XX"
84 select SYS_SUPPORTS_APM_EMULATION
85 select HD6446X_SERIES
86 depends on CPU_SUBTYPE_SH7709
87 help
88 Select HP6XX if configuring for a HP jornada HP6xx.
89 More information (hardware only) at
90 <http://www.hp.com/jornada/>.
91
92config SH_DREAMCAST
93 bool "Dreamcast"
94 select SYS_SUPPORTS_PCI
95 depends on CPU_SUBTYPE_SH7091
96 help
97 Select Dreamcast if configuring for a SEGA Dreamcast.
98 More information at <http://www.linux-sh.org>
99
100config SH_SH03
101 bool "Interface CTP/PCI-SH03"
102 depends on CPU_SUBTYPE_SH7751
103 select CPU_HAS_IPR_IRQ
104 select SYS_SUPPORTS_PCI
105 help
106 CTP/PCI-SH03 is a CPU module computer that is produced
107 by Interface Corporation.
108 More information at <http://www.interface.co.jp>
109
110config SH_SECUREEDGE5410
111 bool "SecureEdge5410"
112 depends on CPU_SUBTYPE_SH7751R
113 select CPU_HAS_IPR_IRQ
114 select SYS_SUPPORTS_PCI
115 help
116 Select SecureEdge5410 if configuring for a SnapGear SH board.
117 This includes both the OEM SecureEdge products as well as the
118 SME product line.
119
120config SH_RTS7751R2D
121 bool "RTS7751R2D"
122 depends on CPU_SUBTYPE_SH7751R
123 select SYS_SUPPORTS_PCI
124 select IO_TRAPPED
125 help
126 Select RTS7751R2D if configuring for a Renesas Technology
127 Sales SH-Graphics board.
128
129config SH_RSK7203
130 bool "RSK7203"
131 depends on CPU_SUBTYPE_SH7203
132
133config SH_SDK7780
134 bool "SDK7780R3"
135 depends on CPU_SUBTYPE_SH7780
136 select SYS_SUPPORTS_PCI
137 help
138 Select SDK7780 if configuring for a Renesas SH7780 SDK7780R3
139 evaluation board.
140
141config SH_HIGHLANDER
142 bool "Highlander"
143 depends on CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785
144 select SYS_SUPPORTS_PCI
145 select IO_TRAPPED
146
147config SH_SH7785LCR
148 bool "SH7785LCR"
149 depends on CPU_SUBTYPE_SH7785
150 select SYS_SUPPORTS_PCI
151 select IO_TRAPPED
152
153config SH_SH7785LCR_29BIT_PHYSMAPS
154 bool "SH7785LCR 29bit physmaps"
155 depends on SH_SH7785LCR
156 default y
157 help
158 This board has 2 physical memory maps. It can be changed with
159 DIP switch(S2-5). If you set the DIP switch for S2-5 = ON,
160 you can access all on-board device in 29bit address mode.
161
162config SH_MIGOR
163 bool "Migo-R"
164 depends on CPU_SUBTYPE_SH7722
165 help
166 Select Migo-R if configuring for the SH7722 Migo-R platform
167 by Renesas System Solutions Asia Pte. Ltd.
168
169config SH_AP325RXA
170 bool "AP-325RXA"
171 depends on CPU_SUBTYPE_SH7723
172 help
173 Renesas "AP-325RXA" support.
174 Compatible with ALGO SYSTEM CO.,LTD. "AP-320A"
175
176config SH_SH7763RDP
177 bool "SH7763RDP"
178 depends on CPU_SUBTYPE_SH7763
179 help
180 Select SH7763RDP if configuring for a Renesas SH7763
181 evaluation board.
182
183config SH_EDOSK7705
184 bool "EDOSK7705"
185 depends on CPU_SUBTYPE_SH7705
186
187config SH_SH4202_MICRODEV
188 bool "SH4-202 MicroDev"
189 depends on CPU_SUBTYPE_SH4_202
190 help
191 Select SH4-202 MicroDev if configuring for a SuperH MicroDev board
192 with an SH4-202 CPU.
193
194config SH_LANDISK
195 bool "LANDISK"
196 depends on CPU_SUBTYPE_SH7751R
197 select SYS_SUPPORTS_PCI
198 help
199 I-O DATA DEVICE, INC. "LANDISK Series" support.
200
201config SH_TITAN
202 bool "TITAN"
203 depends on CPU_SUBTYPE_SH7751R
204 select CPU_HAS_IPR_IRQ
205 select SYS_SUPPORTS_PCI
206 help
207 Select Titan if you are configuring for a Nimble Microsystems
208 NetEngine NP51R.
209
210config SH_SHMIN
211 bool "SHMIN"
212 depends on CPU_SUBTYPE_SH7706
213 select CPU_HAS_IPR_IRQ
214 help
215 Select SHMIN if configuring for the SHMIN board.
216
217config SH_LBOX_RE2
218 bool "L-BOX RE2"
219 depends on CPU_SUBTYPE_SH7751R
220 select SYS_SUPPORTS_PCI
221 help
222 Select L-BOX RE2 if configuring for the NTT COMWARE L-BOX RE2.
223
224config SH_X3PROTO
225 bool "SH-X3 Prototype board"
226 depends on CPU_SUBTYPE_SHX3
227
228config SH_MAGIC_PANEL_R2
229 bool "Magic Panel R2"
230 depends on CPU_SUBTYPE_SH7720
231 help
232 Select Magic Panel R2 if configuring for Magic Panel R2.
233
234config SH_CAYMAN
235 bool "Hitachi Cayman"
236 depends on CPU_SUBTYPE_SH5_101 || CPU_SUBTYPE_SH5_103
237 select SYS_SUPPORTS_PCI
238
239endmenu
240
241source "arch/sh/boards/mach-r2d/Kconfig"
242source "arch/sh/boards/mach-highlander/Kconfig"
243source "arch/sh/boards/mach-sdk7780/Kconfig"
244source "arch/sh/boards/mach-migor/Kconfig"
245
246if SH_MAGIC_PANEL_R2
247
248menu "Magic Panel R2 options"
249
250config SH_MAGIC_PANEL_R2_VERSION
251 int SH_MAGIC_PANEL_R2_VERSION
252 default "3"
253 help
254 Set the version of the Magic Panel R2
255
256endmenu
257
258endif
diff --git a/arch/sh/boards/Makefile b/arch/sh/boards/Makefile
new file mode 100644
index 000000000000..ff9b93c5a91b
--- /dev/null
+++ b/arch/sh/boards/Makefile
@@ -0,0 +1,8 @@
1#
2# Specific board support, not covered by a mach group.
3#
4obj-$(CONFIG_SH_AP325RXA) += board-ap325rxa.o
5obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o
6obj-$(CONFIG_SH_RSK7203) += board-rsk7203.o
7obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o
8obj-$(CONFIG_SH_SHMIN) += board-shmin..o
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
new file mode 100644
index 000000000000..9c71603d29a2
--- /dev/null
+++ b/arch/sh/boards/board-ap325rxa.c
@@ -0,0 +1,317 @@
1/*
2 * Renesas - AP-325RXA
3 * (Compatible with Algo System ., LTD. - AP-320A)
4 *
5 * Copyright (C) 2008 Renesas Solutions Corp.
6 * Author : Yusuke Goda <goda.yuske@renesas.com>
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12
13#include <linux/init.h>
14#include <linux/device.h>
15#include <linux/interrupt.h>
16#include <linux/platform_device.h>
17#include <linux/mtd/physmap.h>
18#include <linux/delay.h>
19#include <linux/i2c.h>
20#include <linux/delay.h>
21#include <linux/smc911x.h>
22#include <media/soc_camera_platform.h>
23#include <media/sh_mobile_ceu.h>
24#include <asm/sh_mobile_lcdc.h>
25#include <asm/io.h>
26#include <asm/clock.h>
27
28static struct smc911x_platdata smc911x_info = {
29 .flags = SMC911X_USE_32BIT,
30 .irq_flags = IRQF_TRIGGER_LOW,
31};
32
33static struct resource smc9118_resources[] = {
34 [0] = {
35 .start = 0xb6080000,
36 .end = 0xb60fffff,
37 .flags = IORESOURCE_MEM,
38 },
39 [1] = {
40 .start = 35,
41 .end = 35,
42 .flags = IORESOURCE_IRQ,
43 }
44};
45
46static struct platform_device smc9118_device = {
47 .name = "smc911x",
48 .id = -1,
49 .num_resources = ARRAY_SIZE(smc9118_resources),
50 .resource = smc9118_resources,
51 .dev = {
52 .platform_data = &smc911x_info,
53 },
54};
55
56static struct mtd_partition ap325rxa_nor_flash_partitions[] = {
57 {
58 .name = "uboot",
59 .offset = 0,
60 .size = (1 * 1024 * 1024),
61 .mask_flags = MTD_WRITEABLE, /* Read-only */
62 }, {
63 .name = "kernel",
64 .offset = MTDPART_OFS_APPEND,
65 .size = (2 * 1024 * 1024),
66 }, {
67 .name = "other",
68 .offset = MTDPART_OFS_APPEND,
69 .size = MTDPART_SIZ_FULL,
70 },
71};
72
73static struct physmap_flash_data ap325rxa_nor_flash_data = {
74 .width = 2,
75 .parts = ap325rxa_nor_flash_partitions,
76 .nr_parts = ARRAY_SIZE(ap325rxa_nor_flash_partitions),
77};
78
79static struct resource ap325rxa_nor_flash_resources[] = {
80 [0] = {
81 .name = "NOR Flash",
82 .start = 0x00000000,
83 .end = 0x00ffffff,
84 .flags = IORESOURCE_MEM,
85 }
86};
87
88static struct platform_device ap325rxa_nor_flash_device = {
89 .name = "physmap-flash",
90 .resource = ap325rxa_nor_flash_resources,
91 .num_resources = ARRAY_SIZE(ap325rxa_nor_flash_resources),
92 .dev = {
93 .platform_data = &ap325rxa_nor_flash_data,
94 },
95};
96
97#define FPGA_LCDREG 0xB4100180
98#define FPGA_BKLREG 0xB4100212
99#define FPGA_LCDREG_VAL 0x0018
100#define PORT_PHCR 0xA405010E
101#define PORT_PLCR 0xA4050114
102#define PORT_PMCR 0xA4050116
103#define PORT_PRCR 0xA405011C
104#define PORT_PSCR 0xA405011E
105#define PORT_PZCR 0xA405014C
106#define PORT_HIZCRA 0xA4050158
107#define PORT_MSELCRB 0xA4050182
108#define PORT_PSDR 0xA405013E
109#define PORT_PZDR 0xA405016C
110#define PORT_PSELD 0xA4050154
111
112static void ap320_wvga_power_on(void *board_data)
113{
114 msleep(100);
115
116 /* ASD AP-320/325 LCD ON */
117 ctrl_outw(FPGA_LCDREG_VAL, FPGA_LCDREG);
118
119 /* backlight */
120 ctrl_outw((ctrl_inw(PORT_PSCR) & ~0x00C0) | 0x40, PORT_PSCR);
121 ctrl_outb(ctrl_inb(PORT_PSDR) & ~0x08, PORT_PSDR);
122 ctrl_outw(0x100, FPGA_BKLREG);
123}
124
125static struct sh_mobile_lcdc_info lcdc_info = {
126 .clock_source = LCDC_CLK_EXTERNAL,
127 .ch[0] = {
128 .chan = LCDC_CHAN_MAINLCD,
129 .bpp = 16,
130 .interface_type = RGB18,
131 .clock_divider = 1,
132 .lcd_cfg = {
133 .name = "LB070WV1",
134 .xres = 800,
135 .yres = 480,
136 .left_margin = 40,
137 .right_margin = 160,
138 .hsync_len = 8,
139 .upper_margin = 63,
140 .lower_margin = 80,
141 .vsync_len = 1,
142 .sync = 0, /* hsync and vsync are active low */
143 },
144 .board_cfg = {
145 .display_on = ap320_wvga_power_on,
146 },
147 }
148};
149
150static struct resource lcdc_resources[] = {
151 [0] = {
152 .name = "LCDC",
153 .start = 0xfe940000, /* P4-only space */
154 .end = 0xfe941fff,
155 .flags = IORESOURCE_MEM,
156 },
157};
158
159static struct platform_device lcdc_device = {
160 .name = "sh_mobile_lcdc_fb",
161 .num_resources = ARRAY_SIZE(lcdc_resources),
162 .resource = lcdc_resources,
163 .dev = {
164 .platform_data = &lcdc_info,
165 },
166};
167
168#ifdef CONFIG_I2C
169static unsigned char camera_ncm03j_magic[] =
170{
171 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8,
172 0x1D, 0x00, 0x1E, 0x8A, 0x21, 0x00, 0x33, 0x36,
173 0x36, 0x60, 0x37, 0x08, 0x3B, 0x31, 0x44, 0x0F,
174 0x46, 0xF0, 0x4B, 0x28, 0x4C, 0x21, 0x4D, 0x55,
175 0x4E, 0x1B, 0x4F, 0xC7, 0x50, 0xFC, 0x51, 0x12,
176 0x58, 0x02, 0x66, 0xC0, 0x67, 0x46, 0x6B, 0xA0,
177 0x6C, 0x34, 0x7E, 0x25, 0x7F, 0x25, 0x8D, 0x0F,
178 0x92, 0x40, 0x93, 0x04, 0x94, 0x26, 0x95, 0x0A,
179 0x99, 0x03, 0x9A, 0xF0, 0x9B, 0x14, 0x9D, 0x7A,
180 0xC5, 0x02, 0xD6, 0x07, 0x59, 0x00, 0x5A, 0x1A,
181 0x5B, 0x2A, 0x5C, 0x37, 0x5D, 0x42, 0x5E, 0x56,
182 0xC8, 0x00, 0xC9, 0x1A, 0xCA, 0x2A, 0xCB, 0x37,
183 0xCC, 0x42, 0xCD, 0x56, 0xCE, 0x00, 0xCF, 0x1A,
184 0xD0, 0x2A, 0xD1, 0x37, 0xD2, 0x42, 0xD3, 0x56,
185 0x5F, 0x68, 0x60, 0x87, 0x61, 0xA3, 0x62, 0xBC,
186 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F,
187};
188
189static int camera_set_capture(struct soc_camera_platform_info *info,
190 int enable)
191{
192 struct i2c_adapter *a = i2c_get_adapter(0);
193 struct i2c_msg msg;
194 int ret = 0;
195 int i;
196
197 if (!enable)
198 return 0; /* no disable for now */
199
200 for (i = 0; i < ARRAY_SIZE(camera_ncm03j_magic); i += 2) {
201 u_int8_t buf[8];
202
203 msg.addr = 0x6e;
204 msg.buf = buf;
205 msg.len = 2;
206 msg.flags = 0;
207
208 buf[0] = camera_ncm03j_magic[i];
209 buf[1] = camera_ncm03j_magic[i + 1];
210
211 ret = (ret < 0) ? ret : i2c_transfer(a, &msg, 1);
212 }
213
214 return ret;
215}
216
217static struct soc_camera_platform_info camera_info = {
218 .iface = 0,
219 .format_name = "UYVY",
220 .format_depth = 16,
221 .format = {
222 .pixelformat = V4L2_PIX_FMT_UYVY,
223 .colorspace = V4L2_COLORSPACE_SMPTE170M,
224 .width = 640,
225 .height = 480,
226 },
227 .bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
228 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8,
229 .set_capture = camera_set_capture,
230};
231
232static struct platform_device camera_device = {
233 .name = "soc_camera_platform",
234 .dev = {
235 .platform_data = &camera_info,
236 },
237};
238#endif /* CONFIG_I2C */
239
240static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
241 .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
242 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8,
243};
244
245static struct resource ceu_resources[] = {
246 [0] = {
247 .name = "CEU",
248 .start = 0xfe910000,
249 .end = 0xfe91009f,
250 .flags = IORESOURCE_MEM,
251 },
252 [1] = {
253 .start = 52,
254 .flags = IORESOURCE_IRQ,
255 },
256 [2] = {
257 /* place holder for contiguous memory */
258 },
259};
260
261static struct platform_device ceu_device = {
262 .name = "sh_mobile_ceu",
263 .num_resources = ARRAY_SIZE(ceu_resources),
264 .resource = ceu_resources,
265 .dev = {
266 .platform_data = &sh_mobile_ceu_info,
267 },
268};
269
270static struct platform_device *ap325rxa_devices[] __initdata = {
271 &smc9118_device,
272 &ap325rxa_nor_flash_device,
273 &lcdc_device,
274 &ceu_device,
275#ifdef CONFIG_I2C
276 &camera_device,
277#endif
278};
279
280static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
281};
282
283static int __init ap325rxa_devices_setup(void)
284{
285 clk_always_enable("mstp200"); /* LCDC */
286 clk_always_enable("mstp203"); /* CEU */
287
288 platform_resource_setup_memory(&ceu_device, "ceu", 4 << 20);
289
290 i2c_register_board_info(0, ap325rxa_i2c_devices,
291 ARRAY_SIZE(ap325rxa_i2c_devices));
292
293 return platform_add_devices(ap325rxa_devices,
294 ARRAY_SIZE(ap325rxa_devices));
295}
296device_initcall(ap325rxa_devices_setup);
297
298static void __init ap325rxa_setup(char **cmdline_p)
299{
300 /* LCDC configuration */
301 ctrl_outw(ctrl_inw(PORT_PHCR) & ~0xffff, PORT_PHCR);
302 ctrl_outw(ctrl_inw(PORT_PLCR) & ~0xffff, PORT_PLCR);
303 ctrl_outw(ctrl_inw(PORT_PMCR) & ~0xffff, PORT_PMCR);
304 ctrl_outw(ctrl_inw(PORT_PRCR) & ~0x03ff, PORT_PRCR);
305 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x01C0, PORT_HIZCRA);
306
307 /* CEU */
308 ctrl_outw(ctrl_inw(PORT_MSELCRB) & ~0x0001, PORT_MSELCRB);
309 ctrl_outw(ctrl_inw(PORT_PSELD) & ~0x0003, PORT_PSELD);
310 ctrl_outw((ctrl_inw(PORT_PZCR) & ~0xff00) | 0x5500, PORT_PZCR);
311 ctrl_outb((ctrl_inb(PORT_PZDR) & ~0xf0) | 0x20, PORT_PZDR);
312}
313
314static struct sh_machine_vector mv_ap325rxa __initmv = {
315 .mv_name = "AP-325RXA",
316 .mv_setup = ap325rxa_setup,
317};
diff --git a/arch/sh/boards/magicpanelr2/setup.c b/arch/sh/boards/board-magicpanelr2.c
index f3b8b07ea5d6..f3b8b07ea5d6 100644
--- a/arch/sh/boards/magicpanelr2/setup.c
+++ b/arch/sh/boards/board-magicpanelr2.c
diff --git a/arch/sh/boards/board-rsk7203.c b/arch/sh/boards/board-rsk7203.c
new file mode 100644
index 000000000000..ffbedc59a973
--- /dev/null
+++ b/arch/sh/boards/board-rsk7203.c
@@ -0,0 +1,136 @@
1/*
2 * Renesas Technology Europe RSK+ 7203 Support.
3 *
4 * Copyright (C) 2008 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/types.h>
12#include <linux/platform_device.h>
13#include <linux/interrupt.h>
14#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mtd/map.h>
18#include <linux/smc911x.h>
19#include <asm/machvec.h>
20#include <asm/io.h>
21
22static struct smc911x_platdata smc911x_info = {
23 .flags = SMC911X_USE_16BIT,
24 .irq_flags = IRQF_TRIGGER_LOW,
25};
26
27static struct resource smc911x_resources[] = {
28 [0] = {
29 .start = 0x24000000,
30 .end = 0x24000000 + 0x100,
31 .flags = IORESOURCE_MEM,
32 },
33 [1] = {
34 .start = 64,
35 .end = 64,
36 .flags = IORESOURCE_IRQ,
37 },
38};
39
40static struct platform_device smc911x_device = {
41 .name = "smc911x",
42 .id = -1,
43 .num_resources = ARRAY_SIZE(smc911x_resources),
44 .resource = smc911x_resources,
45 .dev = {
46 .platform_data = &smc911x_info,
47 },
48};
49
50static const char *probes[] = { "cmdlinepart", NULL };
51
52static struct mtd_partition *parsed_partitions;
53
54static struct mtd_partition rsk7203_partitions[] = {
55 {
56 .name = "Bootloader",
57 .offset = 0x00000000,
58 .size = 0x00040000,
59 .mask_flags = MTD_WRITEABLE,
60 }, {
61 .name = "Kernel",
62 .offset = MTDPART_OFS_NXTBLK,
63 .size = 0x001c0000,
64 }, {
65 .name = "Flash_FS",
66 .offset = MTDPART_OFS_NXTBLK,
67 .size = MTDPART_SIZ_FULL,
68 }
69};
70
71static struct physmap_flash_data flash_data = {
72 .width = 2,
73};
74
75static struct resource flash_resource = {
76 .start = 0x20000000,
77 .end = 0x20400000,
78 .flags = IORESOURCE_MEM,
79};
80
81static struct platform_device flash_device = {
82 .name = "physmap-flash",
83 .id = -1,
84 .resource = &flash_resource,
85 .num_resources = 1,
86 .dev = {
87 .platform_data = &flash_data,
88 },
89};
90
91static struct mtd_info *flash_mtd;
92
93static struct map_info rsk7203_flash_map = {
94 .name = "RSK+ Flash",
95 .size = 0x400000,
96 .bankwidth = 2,
97};
98
99static void __init set_mtd_partitions(void)
100{
101 int nr_parts = 0;
102
103 simple_map_init(&rsk7203_flash_map);
104 flash_mtd = do_map_probe("cfi_probe", &rsk7203_flash_map);
105 nr_parts = parse_mtd_partitions(flash_mtd, probes,
106 &parsed_partitions, 0);
107 /* If there is no partition table, used the hard coded table */
108 if (nr_parts <= 0) {
109 flash_data.parts = rsk7203_partitions;
110 flash_data.nr_parts = ARRAY_SIZE(rsk7203_partitions);
111 } else {
112 flash_data.nr_parts = nr_parts;
113 flash_data.parts = parsed_partitions;
114 }
115}
116
117
118static struct platform_device *rsk7203_devices[] __initdata = {
119 &smc911x_device,
120 &flash_device,
121};
122
123static int __init rsk7203_devices_setup(void)
124{
125 set_mtd_partitions();
126 return platform_add_devices(rsk7203_devices,
127 ARRAY_SIZE(rsk7203_devices));
128}
129device_initcall(rsk7203_devices_setup);
130
131/*
132 * The Machine Vector
133 */
134static struct sh_machine_vector mv_rsk7203 __initmv = {
135 .mv_name = "RSK+7203",
136};
diff --git a/arch/sh/boards/board-sh7785lcr.c b/arch/sh/boards/board-sh7785lcr.c
new file mode 100644
index 000000000000..b95d674ee704
--- /dev/null
+++ b/arch/sh/boards/board-sh7785lcr.c
@@ -0,0 +1,302 @@
1/*
2 * Renesas Technology Corp. R0P7785LC0011RL Support.
3 *
4 * Copyright (C) 2008 Yoshihiro Shimoda
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/init.h>
12#include <linux/platform_device.h>
13#include <linux/sm501.h>
14#include <linux/sm501-regs.h>
15#include <linux/fb.h>
16#include <linux/mtd/physmap.h>
17#include <linux/delay.h>
18#include <linux/i2c.h>
19#include <linux/i2c-pca-platform.h>
20#include <linux/i2c-algo-pca.h>
21#include <asm/heartbeat.h>
22#include <asm/sh7785lcr.h>
23
24/*
25 * NOTE: This board has 2 physical memory maps.
26 * Please look at include/asm-sh/sh7785lcr.h or hardware manual.
27 */
28static struct resource heartbeat_resources[] = {
29 [0] = {
30 .start = PLD_LEDCR,
31 .end = PLD_LEDCR,
32 .flags = IORESOURCE_MEM,
33 },
34};
35
36static struct heartbeat_data heartbeat_data = {
37 .regsize = 8,
38};
39
40static struct platform_device heartbeat_device = {
41 .name = "heartbeat",
42 .id = -1,
43 .dev = {
44 .platform_data = &heartbeat_data,
45 },
46 .num_resources = ARRAY_SIZE(heartbeat_resources),
47 .resource = heartbeat_resources,
48};
49
50static struct mtd_partition nor_flash_partitions[] = {
51 {
52 .name = "loader",
53 .offset = 0x00000000,
54 .size = 512 * 1024,
55 },
56 {
57 .name = "bootenv",
58 .offset = MTDPART_OFS_APPEND,
59 .size = 512 * 1024,
60 },
61 {
62 .name = "kernel",
63 .offset = MTDPART_OFS_APPEND,
64 .size = 4 * 1024 * 1024,
65 },
66 {
67 .name = "data",
68 .offset = MTDPART_OFS_APPEND,
69 .size = MTDPART_SIZ_FULL,
70 },
71};
72
73static struct physmap_flash_data nor_flash_data = {
74 .width = 4,
75 .parts = nor_flash_partitions,
76 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
77};
78
79static struct resource nor_flash_resources[] = {
80 [0] = {
81 .start = NOR_FLASH_ADDR,
82 .end = NOR_FLASH_ADDR + NOR_FLASH_SIZE - 1,
83 .flags = IORESOURCE_MEM,
84 }
85};
86
87static struct platform_device nor_flash_device = {
88 .name = "physmap-flash",
89 .dev = {
90 .platform_data = &nor_flash_data,
91 },
92 .num_resources = ARRAY_SIZE(nor_flash_resources),
93 .resource = nor_flash_resources,
94};
95
96static struct resource r8a66597_usb_host_resources[] = {
97 [0] = {
98 .name = "r8a66597_hcd",
99 .start = R8A66597_ADDR,
100 .end = R8A66597_ADDR + R8A66597_SIZE - 1,
101 .flags = IORESOURCE_MEM,
102 },
103 [1] = {
104 .name = "r8a66597_hcd",
105 .start = 2,
106 .end = 2,
107 .flags = IORESOURCE_IRQ,
108 },
109};
110
111static struct platform_device r8a66597_usb_host_device = {
112 .name = "r8a66597_hcd",
113 .id = -1,
114 .dev = {
115 .dma_mask = NULL,
116 .coherent_dma_mask = 0xffffffff,
117 },
118 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
119 .resource = r8a66597_usb_host_resources,
120};
121
122static struct resource sm501_resources[] = {
123 [0] = {
124 .start = SM107_MEM_ADDR,
125 .end = SM107_MEM_ADDR + SM107_MEM_SIZE - 1,
126 .flags = IORESOURCE_MEM,
127 },
128 [1] = {
129 .start = SM107_REG_ADDR,
130 .end = SM107_REG_ADDR + SM107_REG_SIZE - 1,
131 .flags = IORESOURCE_MEM,
132 },
133 [2] = {
134 .start = 10,
135 .flags = IORESOURCE_IRQ,
136 },
137};
138
139static struct fb_videomode sm501_default_mode_crt = {
140 .pixclock = 35714, /* 28MHz */
141 .xres = 640,
142 .yres = 480,
143 .left_margin = 105,
144 .right_margin = 16,
145 .upper_margin = 33,
146 .lower_margin = 10,
147 .hsync_len = 39,
148 .vsync_len = 2,
149 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
150};
151
152static struct fb_videomode sm501_default_mode_pnl = {
153 .pixclock = 40000, /* 25MHz */
154 .xres = 640,
155 .yres = 480,
156 .left_margin = 2,
157 .right_margin = 16,
158 .upper_margin = 33,
159 .lower_margin = 10,
160 .hsync_len = 39,
161 .vsync_len = 2,
162 .sync = 0,
163};
164
165static struct sm501_platdata_fbsub sm501_pdata_fbsub_pnl = {
166 .def_bpp = 16,
167 .def_mode = &sm501_default_mode_pnl,
168 .flags = SM501FB_FLAG_USE_INIT_MODE |
169 SM501FB_FLAG_USE_HWCURSOR |
170 SM501FB_FLAG_USE_HWACCEL |
171 SM501FB_FLAG_DISABLE_AT_EXIT |
172 SM501FB_FLAG_PANEL_NO_VBIASEN,
173};
174
175static struct sm501_platdata_fbsub sm501_pdata_fbsub_crt = {
176 .def_bpp = 16,
177 .def_mode = &sm501_default_mode_crt,
178 .flags = SM501FB_FLAG_USE_INIT_MODE |
179 SM501FB_FLAG_USE_HWCURSOR |
180 SM501FB_FLAG_USE_HWACCEL |
181 SM501FB_FLAG_DISABLE_AT_EXIT,
182};
183
184static struct sm501_platdata_fb sm501_fb_pdata = {
185 .fb_route = SM501_FB_OWN,
186 .fb_crt = &sm501_pdata_fbsub_crt,
187 .fb_pnl = &sm501_pdata_fbsub_pnl,
188};
189
190static struct sm501_initdata sm501_initdata = {
191 .gpio_high = {
192 .set = 0x00001fe0,
193 .mask = 0x0,
194 },
195 .devices = 0,
196 .mclk = 84 * 1000000,
197 .m1xclk = 112 * 1000000,
198};
199
200static struct sm501_platdata sm501_platform_data = {
201 .init = &sm501_initdata,
202 .fb = &sm501_fb_pdata,
203};
204
205static struct platform_device sm501_device = {
206 .name = "sm501",
207 .id = -1,
208 .dev = {
209 .platform_data = &sm501_platform_data,
210 },
211 .num_resources = ARRAY_SIZE(sm501_resources),
212 .resource = sm501_resources,
213};
214
215static struct resource i2c_resources[] = {
216 [0] = {
217 .start = PCA9564_ADDR,
218 .end = PCA9564_ADDR + PCA9564_SIZE - 1,
219 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8BIT,
220 },
221 [1] = {
222 .start = 12,
223 .end = 12,
224 .flags = IORESOURCE_IRQ,
225 },
226};
227
228static struct i2c_pca9564_pf_platform_data i2c_platform_data = {
229 .gpio = 0,
230 .i2c_clock_speed = I2C_PCA_CON_330kHz,
231 .timeout = 100,
232};
233
234static struct platform_device i2c_device = {
235 .name = "i2c-pca-platform",
236 .id = -1,
237 .dev = {
238 .platform_data = &i2c_platform_data,
239 },
240 .num_resources = ARRAY_SIZE(i2c_resources),
241 .resource = i2c_resources,
242};
243
244static struct platform_device *sh7785lcr_devices[] __initdata = {
245 &heartbeat_device,
246 &nor_flash_device,
247 &r8a66597_usb_host_device,
248 &sm501_device,
249 &i2c_device,
250};
251
252static struct i2c_board_info __initdata sh7785lcr_i2c_devices[] = {
253 {
254 I2C_BOARD_INFO("r2025sd", 0x32),
255 },
256};
257
258static int __init sh7785lcr_devices_setup(void)
259{
260 i2c_register_board_info(0, sh7785lcr_i2c_devices,
261 ARRAY_SIZE(sh7785lcr_i2c_devices));
262
263 return platform_add_devices(sh7785lcr_devices,
264 ARRAY_SIZE(sh7785lcr_devices));
265}
266__initcall(sh7785lcr_devices_setup);
267
268/* Initialize IRQ setting */
269void __init init_sh7785lcr_IRQ(void)
270{
271 plat_irq_setup_pins(IRQ_MODE_IRQ7654);
272 plat_irq_setup_pins(IRQ_MODE_IRQ3210);
273}
274
275static void sh7785lcr_power_off(void)
276{
277 ctrl_outb(0x01, P2SEGADDR(PLD_POFCR));
278}
279
280/* Initialize the board */
281static void __init sh7785lcr_setup(char **cmdline_p)
282{
283 void __iomem *sm501_reg;
284
285 printk(KERN_INFO "Renesas Technology Corp. R0P7785LC0011RL support.\n");
286
287 pm_power_off = sh7785lcr_power_off;
288
289 /* sm501 DRAM configuration */
290 sm501_reg = (void __iomem *)0xb3e00000 + SM501_DRAM_CONTROL;
291 writel(0x000307c2, sm501_reg);
292}
293
294/*
295 * The Machine Vector
296 */
297static struct sh_machine_vector mv_sh7785lcr __initmv = {
298 .mv_name = "SH7785LCR",
299 .mv_setup = sh7785lcr_setup,
300 .mv_init_irq = init_sh7785lcr_IRQ,
301};
302
diff --git a/arch/sh/boards/shmin/setup.c b/arch/sh/boards/board-shmin.c
index 16e5dae8ecfb..16e5dae8ecfb 100644
--- a/arch/sh/boards/shmin/setup.c
+++ b/arch/sh/boards/board-shmin.c
diff --git a/arch/sh/boards/cayman/irq.c b/arch/sh/boards/cayman/irq.c
deleted file mode 100644
index 30ec7bebfaf1..000000000000
--- a/arch/sh/boards/cayman/irq.c
+++ /dev/null
@@ -1,197 +0,0 @@
1/*
2 * arch/sh/mach-cayman/irq.c - SH-5 Cayman Interrupt Support
3 *
4 * This file handles the board specific parts of the Cayman interrupt system
5 *
6 * Copyright (C) 2002 Stuart Menefy
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/io.h>
13#include <linux/irq.h>
14#include <linux/interrupt.h>
15#include <linux/signal.h>
16#include <asm/cpu/irq.h>
17#include <asm/page.h>
18
19/* Setup for the SMSC FDC37C935 / LAN91C100FD */
20#define SMSC_IRQ IRQ_IRL1
21
22/* Setup for PCI Bus 2, which transmits interrupts via the EPLD */
23#define PCI2_IRQ IRQ_IRL3
24
25unsigned long epld_virt;
26
27#define EPLD_BASE 0x04002000
28#define EPLD_STATUS_BASE (epld_virt + 0x10)
29#define EPLD_MASK_BASE (epld_virt + 0x20)
30
31/* Note the SMSC SuperIO chip and SMSC LAN chip interrupts are all muxed onto
32 the same SH-5 interrupt */
33
34static irqreturn_t cayman_interrupt_smsc(int irq, void *dev_id)
35{
36 printk(KERN_INFO "CAYMAN: spurious SMSC interrupt\n");
37 return IRQ_NONE;
38}
39
40static irqreturn_t cayman_interrupt_pci2(int irq, void *dev_id)
41{
42 printk(KERN_INFO "CAYMAN: spurious PCI interrupt, IRQ %d\n", irq);
43 return IRQ_NONE;
44}
45
46static struct irqaction cayman_action_smsc = {
47 .name = "Cayman SMSC Mux",
48 .handler = cayman_interrupt_smsc,
49 .flags = IRQF_DISABLED,
50};
51
52static struct irqaction cayman_action_pci2 = {
53 .name = "Cayman PCI2 Mux",
54 .handler = cayman_interrupt_pci2,
55 .flags = IRQF_DISABLED,
56};
57
58static void enable_cayman_irq(unsigned int irq)
59{
60 unsigned long flags;
61 unsigned long mask;
62 unsigned int reg;
63 unsigned char bit;
64
65 irq -= START_EXT_IRQS;
66 reg = EPLD_MASK_BASE + ((irq / 8) << 2);
67 bit = 1<<(irq % 8);
68 local_irq_save(flags);
69 mask = ctrl_inl(reg);
70 mask |= bit;
71 ctrl_outl(mask, reg);
72 local_irq_restore(flags);
73}
74
75void disable_cayman_irq(unsigned int irq)
76{
77 unsigned long flags;
78 unsigned long mask;
79 unsigned int reg;
80 unsigned char bit;
81
82 irq -= START_EXT_IRQS;
83 reg = EPLD_MASK_BASE + ((irq / 8) << 2);
84 bit = 1<<(irq % 8);
85 local_irq_save(flags);
86 mask = ctrl_inl(reg);
87 mask &= ~bit;
88 ctrl_outl(mask, reg);
89 local_irq_restore(flags);
90}
91
92static void ack_cayman_irq(unsigned int irq)
93{
94 disable_cayman_irq(irq);
95}
96
97static void end_cayman_irq(unsigned int irq)
98{
99 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
100 enable_cayman_irq(irq);
101}
102
103static unsigned int startup_cayman_irq(unsigned int irq)
104{
105 enable_cayman_irq(irq);
106 return 0; /* never anything pending */
107}
108
109static void shutdown_cayman_irq(unsigned int irq)
110{
111 disable_cayman_irq(irq);
112}
113
114struct hw_interrupt_type cayman_irq_type = {
115 .typename = "Cayman-IRQ",
116 .startup = startup_cayman_irq,
117 .shutdown = shutdown_cayman_irq,
118 .enable = enable_cayman_irq,
119 .disable = disable_cayman_irq,
120 .ack = ack_cayman_irq,
121 .end = end_cayman_irq,
122};
123
124int cayman_irq_demux(int evt)
125{
126 int irq = intc_evt_to_irq[evt];
127
128 if (irq == SMSC_IRQ) {
129 unsigned long status;
130 int i;
131
132 status = ctrl_inl(EPLD_STATUS_BASE) &
133 ctrl_inl(EPLD_MASK_BASE) & 0xff;
134 if (status == 0) {
135 irq = -1;
136 } else {
137 for (i=0; i<8; i++) {
138 if (status & (1<<i))
139 break;
140 }
141 irq = START_EXT_IRQS + i;
142 }
143 }
144
145 if (irq == PCI2_IRQ) {
146 unsigned long status;
147 int i;
148
149 status = ctrl_inl(EPLD_STATUS_BASE + 3 * sizeof(u32)) &
150 ctrl_inl(EPLD_MASK_BASE + 3 * sizeof(u32)) & 0xff;
151 if (status == 0) {
152 irq = -1;
153 } else {
154 for (i=0; i<8; i++) {
155 if (status & (1<<i))
156 break;
157 }
158 irq = START_EXT_IRQS + (3 * 8) + i;
159 }
160 }
161
162 return irq;
163}
164
165#if defined(CONFIG_PROC_FS) && defined(CONFIG_SYSCTL)
166int cayman_irq_describe(char* p, int irq)
167{
168 if (irq < NR_INTC_IRQS) {
169 return intc_irq_describe(p, irq);
170 } else if (irq < NR_INTC_IRQS + 8) {
171 return sprintf(p, "(SMSC %d)", irq - NR_INTC_IRQS);
172 } else if ((irq >= NR_INTC_IRQS + 24) && (irq < NR_INTC_IRQS + 32)) {
173 return sprintf(p, "(PCI2 %d)", irq - (NR_INTC_IRQS + 24));
174 }
175
176 return 0;
177}
178#endif
179
180void init_cayman_irq(void)
181{
182 int i;
183
184 epld_virt = onchip_remap(EPLD_BASE, 1024, "EPLD");
185 if (!epld_virt) {
186 printk(KERN_ERR "Cayman IRQ: Unable to remap EPLD\n");
187 return;
188 }
189
190 for (i=0; i<NR_EXT_IRQS; i++) {
191 irq_desc[START_EXT_IRQS + i].chip = &cayman_irq_type;
192 }
193
194 /* Setup the SMSC interrupt */
195 setup_irq(SMSC_IRQ, &cayman_action_smsc);
196 setup_irq(PCI2_IRQ, &cayman_action_pci2);
197}
diff --git a/arch/sh/boards/cayman/setup.c b/arch/sh/boards/cayman/setup.c
deleted file mode 100644
index 8c9fa472d8f5..000000000000
--- a/arch/sh/boards/cayman/setup.c
+++ /dev/null
@@ -1,187 +0,0 @@
1/*
2 * arch/sh/mach-cayman/setup.c
3 *
4 * SH5 Cayman support
5 *
6 * Copyright (C) 2002 David J. Mckay & Benedict Gaster
7 * Copyright (C) 2003 - 2007 Paul Mundt
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13#include <linux/init.h>
14#include <linux/io.h>
15#include <linux/kernel.h>
16#include <asm/cpu/irq.h>
17
18/*
19 * Platform Dependent Interrupt Priorities.
20 */
21
22/* Using defaults defined in irq.h */
23#define RES NO_PRIORITY /* Disabled */
24#define IR0 IRL0_PRIORITY /* IRLs */
25#define IR1 IRL1_PRIORITY
26#define IR2 IRL2_PRIORITY
27#define IR3 IRL3_PRIORITY
28#define PCA INTA_PRIORITY /* PCI Ints */
29#define PCB INTB_PRIORITY
30#define PCC INTC_PRIORITY
31#define PCD INTD_PRIORITY
32#define SER TOP_PRIORITY
33#define ERR TOP_PRIORITY
34#define PW0 TOP_PRIORITY
35#define PW1 TOP_PRIORITY
36#define PW2 TOP_PRIORITY
37#define PW3 TOP_PRIORITY
38#define DM0 NO_PRIORITY /* DMA Ints */
39#define DM1 NO_PRIORITY
40#define DM2 NO_PRIORITY
41#define DM3 NO_PRIORITY
42#define DAE NO_PRIORITY
43#define TU0 TIMER_PRIORITY /* TMU Ints */
44#define TU1 NO_PRIORITY
45#define TU2 NO_PRIORITY
46#define TI2 NO_PRIORITY
47#define ATI NO_PRIORITY /* RTC Ints */
48#define PRI NO_PRIORITY
49#define CUI RTC_PRIORITY
50#define ERI SCIF_PRIORITY /* SCIF Ints */
51#define RXI SCIF_PRIORITY
52#define BRI SCIF_PRIORITY
53#define TXI SCIF_PRIORITY
54#define ITI TOP_PRIORITY /* WDT Ints */
55
56/* Setup for the SMSC FDC37C935 */
57#define SMSC_SUPERIO_BASE 0x04000000
58#define SMSC_CONFIG_PORT_ADDR 0x3f0
59#define SMSC_INDEX_PORT_ADDR SMSC_CONFIG_PORT_ADDR
60#define SMSC_DATA_PORT_ADDR 0x3f1
61
62#define SMSC_ENTER_CONFIG_KEY 0x55
63#define SMSC_EXIT_CONFIG_KEY 0xaa
64
65#define SMCS_LOGICAL_DEV_INDEX 0x07
66#define SMSC_DEVICE_ID_INDEX 0x20
67#define SMSC_DEVICE_REV_INDEX 0x21
68#define SMSC_ACTIVATE_INDEX 0x30
69#define SMSC_PRIMARY_BASE_INDEX 0x60
70#define SMSC_SECONDARY_BASE_INDEX 0x62
71#define SMSC_PRIMARY_INT_INDEX 0x70
72#define SMSC_SECONDARY_INT_INDEX 0x72
73
74#define SMSC_IDE1_DEVICE 1
75#define SMSC_KEYBOARD_DEVICE 7
76#define SMSC_CONFIG_REGISTERS 8
77
78#define SMSC_SUPERIO_READ_INDEXED(index) ({ \
79 outb((index), SMSC_INDEX_PORT_ADDR); \
80 inb(SMSC_DATA_PORT_ADDR); })
81#define SMSC_SUPERIO_WRITE_INDEXED(val, index) ({ \
82 outb((index), SMSC_INDEX_PORT_ADDR); \
83 outb((val), SMSC_DATA_PORT_ADDR); })
84
85#define IDE1_PRIMARY_BASE 0x01f0
86#define IDE1_SECONDARY_BASE 0x03f6
87
88unsigned long smsc_superio_virt;
89
90int platform_int_priority[NR_INTC_IRQS] = {
91 IR0, IR1, IR2, IR3, PCA, PCB, PCC, PCD, /* IRQ 0- 7 */
92 RES, RES, RES, RES, SER, ERR, PW3, PW2, /* IRQ 8-15 */
93 PW1, PW0, DM0, DM1, DM2, DM3, DAE, RES, /* IRQ 16-23 */
94 RES, RES, RES, RES, RES, RES, RES, RES, /* IRQ 24-31 */
95 TU0, TU1, TU2, TI2, ATI, PRI, CUI, ERI, /* IRQ 32-39 */
96 RXI, BRI, TXI, RES, RES, RES, RES, RES, /* IRQ 40-47 */
97 RES, RES, RES, RES, RES, RES, RES, RES, /* IRQ 48-55 */
98 RES, RES, RES, RES, RES, RES, RES, ITI, /* IRQ 56-63 */
99};
100
101static int __init smsc_superio_setup(void)
102{
103 unsigned char devid, devrev;
104
105 smsc_superio_virt = onchip_remap(SMSC_SUPERIO_BASE, 1024, "SMSC SuperIO");
106 if (!smsc_superio_virt) {
107 panic("Unable to remap SMSC SuperIO\n");
108 }
109
110 /* Initially the chip is in run state */
111 /* Put it into configuration state */
112 outb(SMSC_ENTER_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
113 outb(SMSC_ENTER_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
114
115 /* Read device ID info */
116 devid = SMSC_SUPERIO_READ_INDEXED(SMSC_DEVICE_ID_INDEX);
117 devrev = SMSC_SUPERIO_READ_INDEXED(SMSC_DEVICE_REV_INDEX);
118 printk("SMSC SuperIO devid %02x rev %02x\n", devid, devrev);
119
120 /* Select the keyboard device */
121 SMSC_SUPERIO_WRITE_INDEXED(SMSC_KEYBOARD_DEVICE, SMCS_LOGICAL_DEV_INDEX);
122
123 /* enable it */
124 SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
125
126 /* Select the interrupts */
127 /* On a PC keyboard is IRQ1, mouse is IRQ12 */
128 SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_PRIMARY_INT_INDEX);
129 SMSC_SUPERIO_WRITE_INDEXED(12, SMSC_SECONDARY_INT_INDEX);
130
131#ifdef CONFIG_IDE
132 /*
133 * Only IDE1 exists on the Cayman
134 */
135
136 /* Power it on */
137 SMSC_SUPERIO_WRITE_INDEXED(1 << SMSC_IDE1_DEVICE, 0x22);
138
139 SMSC_SUPERIO_WRITE_INDEXED(SMSC_IDE1_DEVICE, SMCS_LOGICAL_DEV_INDEX);
140 SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
141
142 SMSC_SUPERIO_WRITE_INDEXED(IDE1_PRIMARY_BASE >> 8,
143 SMSC_PRIMARY_BASE_INDEX + 0);
144 SMSC_SUPERIO_WRITE_INDEXED(IDE1_PRIMARY_BASE & 0xff,
145 SMSC_PRIMARY_BASE_INDEX + 1);
146
147 SMSC_SUPERIO_WRITE_INDEXED(IDE1_SECONDARY_BASE >> 8,
148 SMSC_SECONDARY_BASE_INDEX + 0);
149 SMSC_SUPERIO_WRITE_INDEXED(IDE1_SECONDARY_BASE & 0xff,
150 SMSC_SECONDARY_BASE_INDEX + 1);
151
152 SMSC_SUPERIO_WRITE_INDEXED(14, SMSC_PRIMARY_INT_INDEX);
153
154 SMSC_SUPERIO_WRITE_INDEXED(SMSC_CONFIG_REGISTERS,
155 SMCS_LOGICAL_DEV_INDEX);
156
157 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc2); /* GP42 = nIDE1_OE */
158 SMSC_SUPERIO_WRITE_INDEXED(0x01, 0xc5); /* GP45 = IDE1_IRQ */
159 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc6); /* GP46 = nIOROP */
160 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */
161#endif
162
163 /* Exit the configuration state */
164 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
165
166 return 0;
167}
168__initcall(smsc_superio_setup);
169
170static void __iomem *cayman_ioport_map(unsigned long port, unsigned int len)
171{
172 if (port < 0x400) {
173 extern unsigned long smsc_superio_virt;
174 return (void __iomem *)((port << 2) | smsc_superio_virt);
175 }
176
177 return (void __iomem *)port;
178}
179
180extern void init_cayman_irq(void);
181
182static struct sh_machine_vector mv_cayman __initmv = {
183 .mv_name = "Hitachi Cayman",
184 .mv_nr_irqs = 64,
185 .mv_ioport_map = cayman_ioport_map,
186 .mv_init_irq = init_cayman_irq,
187};
diff --git a/arch/sh/boards/dreamcast/irq.c b/arch/sh/boards/dreamcast/irq.c
deleted file mode 100644
index 9d0673a9092a..000000000000
--- a/arch/sh/boards/dreamcast/irq.c
+++ /dev/null
@@ -1,153 +0,0 @@
1/*
2 * arch/sh/boards/dreamcast/irq.c
3 *
4 * Holly IRQ support for the Sega Dreamcast.
5 *
6 * Copyright (c) 2001, 2002 M. R. Brown <mrbrown@0xd6.org>
7 *
8 * This file is part of the LinuxDC project (www.linuxdc.org)
9 * Released under the terms of the GNU GPL v2.0
10 */
11
12#include <linux/irq.h>
13#include <asm/io.h>
14#include <asm/irq.h>
15#include <asm/dreamcast/sysasic.h>
16
17/* Dreamcast System ASIC Hardware Events -
18
19 The Dreamcast's System ASIC (a.k.a. Holly) is responsible for receiving
20 hardware events from system peripherals and triggering an SH7750 IRQ.
21 Hardware events can trigger IRQs 13, 11, or 9 depending on which bits are
22 set in the Event Mask Registers (EMRs). When a hardware event is
23 triggered, it's corresponding bit in the Event Status Registers (ESRs)
24 is set, and that bit should be rewritten to the ESR to acknowledge that
25 event.
26
27 There are three 32-bit ESRs located at 0xa05f8900 - 0xa05f6908. Event
28 types can be found in include/asm-sh/dreamcast/sysasic.h. There are three
29 groups of EMRs that parallel the ESRs. Each EMR group corresponds to an
30 IRQ, so 0xa05f6910 - 0xa05f6918 triggers IRQ 13, 0xa05f6920 - 0xa05f6928
31 triggers IRQ 11, and 0xa05f6930 - 0xa05f6938 triggers IRQ 9.
32
33 In the kernel, these events are mapped to virtual IRQs so that drivers can
34 respond to them as they would a normal interrupt. In order to keep this
35 mapping simple, the events are mapped as:
36
37 6900/6910 - Events 0-31, IRQ 13
38 6904/6924 - Events 32-63, IRQ 11
39 6908/6938 - Events 64-95, IRQ 9
40
41*/
42
43#define ESR_BASE 0x005f6900 /* Base event status register */
44#define EMR_BASE 0x005f6910 /* Base event mask register */
45
46/* Helps us determine the EMR group that this event belongs to: 0 = 0x6910,
47 1 = 0x6920, 2 = 0x6930; also determine the event offset */
48#define LEVEL(event) (((event) - HW_EVENT_IRQ_BASE) / 32)
49
50/* Return the hardware event's bit positon within the EMR/ESR */
51#define EVENT_BIT(event) (((event) - HW_EVENT_IRQ_BASE) & 31)
52
53/* For each of these *_irq routines, the IRQ passed in is the virtual IRQ
54 (logically mapped to the corresponding bit for the hardware event). */
55
56/* Disable the hardware event by masking its bit in its EMR */
57static inline void disable_systemasic_irq(unsigned int irq)
58{
59 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
60 __u32 mask;
61
62 mask = inl(emr);
63 mask &= ~(1 << EVENT_BIT(irq));
64 outl(mask, emr);
65}
66
67/* Enable the hardware event by setting its bit in its EMR */
68static inline void enable_systemasic_irq(unsigned int irq)
69{
70 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
71 __u32 mask;
72
73 mask = inl(emr);
74 mask |= (1 << EVENT_BIT(irq));
75 outl(mask, emr);
76}
77
78/* Acknowledge a hardware event by writing its bit back to its ESR */
79static void ack_systemasic_irq(unsigned int irq)
80{
81 __u32 esr = ESR_BASE + (LEVEL(irq) << 2);
82 disable_systemasic_irq(irq);
83 outl((1 << EVENT_BIT(irq)), esr);
84}
85
86/* After a IRQ has been ack'd and responded to, it needs to be renabled */
87static void end_systemasic_irq(unsigned int irq)
88{
89 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
90 enable_systemasic_irq(irq);
91}
92
93static unsigned int startup_systemasic_irq(unsigned int irq)
94{
95 enable_systemasic_irq(irq);
96
97 return 0;
98}
99
100static void shutdown_systemasic_irq(unsigned int irq)
101{
102 disable_systemasic_irq(irq);
103}
104
105struct hw_interrupt_type systemasic_int = {
106 .typename = "System ASIC",
107 .startup = startup_systemasic_irq,
108 .shutdown = shutdown_systemasic_irq,
109 .enable = enable_systemasic_irq,
110 .disable = disable_systemasic_irq,
111 .ack = ack_systemasic_irq,
112 .end = end_systemasic_irq,
113};
114
115/*
116 * Map the hardware event indicated by the processor IRQ to a virtual IRQ.
117 */
118int systemasic_irq_demux(int irq)
119{
120 __u32 emr, esr, status, level;
121 __u32 j, bit;
122
123 switch (irq) {
124 case 13:
125 level = 0;
126 break;
127 case 11:
128 level = 1;
129 break;
130 case 9:
131 level = 2;
132 break;
133 default:
134 return irq;
135 }
136 emr = EMR_BASE + (level << 4) + (level << 2);
137 esr = ESR_BASE + (level << 2);
138
139 /* Mask the ESR to filter any spurious, unwanted interrupts */
140 status = inl(esr);
141 status &= inl(emr);
142
143 /* Now scan and find the first set bit as the event to map */
144 for (bit = 1, j = 0; j < 32; bit <<= 1, j++) {
145 if (status & bit) {
146 irq = HW_EVENT_IRQ_BASE + j + (level << 5);
147 return irq;
148 }
149 }
150
151 /* Not reached */
152 return irq;
153}
diff --git a/arch/sh/boards/dreamcast/rtc.c b/arch/sh/boards/dreamcast/rtc.c
deleted file mode 100644
index b3a876a3b859..000000000000
--- a/arch/sh/boards/dreamcast/rtc.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * arch/sh/boards/dreamcast/rtc.c
3 *
4 * Dreamcast AICA RTC routines.
5 *
6 * Copyright (c) 2001, 2002 M. R. Brown <mrbrown@0xd6.org>
7 * Copyright (c) 2002 Paul Mundt <lethal@chaoticdreams.org>
8 *
9 * Released under the terms of the GNU GPL v2.0.
10 *
11 */
12
13#include <linux/time.h>
14#include <asm/rtc.h>
15#include <asm/io.h>
16
17/* The AICA RTC has an Epoch of 1/1/1950, so we must subtract 20 years (in
18 seconds) to get the standard Unix Epoch when getting the time, and add
19 20 years when setting the time. */
20#define TWENTY_YEARS ((20 * 365LU + 5) * 86400)
21
22/* The AICA RTC is represented by a 32-bit seconds counter stored in 2 16-bit
23 registers.*/
24#define AICA_RTC_SECS_H 0xa0710000
25#define AICA_RTC_SECS_L 0xa0710004
26
27/**
28 * aica_rtc_gettimeofday - Get the time from the AICA RTC
29 * @ts: pointer to resulting timespec
30 *
31 * Grabs the current RTC seconds counter and adjusts it to the Unix Epoch.
32 */
33void aica_rtc_gettimeofday(struct timespec *ts)
34{
35 unsigned long val1, val2;
36
37 do {
38 val1 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
39 (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
40
41 val2 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
42 (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
43 } while (val1 != val2);
44
45 ts->tv_sec = val1 - TWENTY_YEARS;
46
47 /* Can't get nanoseconds with just a seconds counter. */
48 ts->tv_nsec = 0;
49}
50
51/**
52 * aica_rtc_settimeofday - Set the AICA RTC to the current time
53 * @secs: contains the time_t to set
54 *
55 * Adjusts the given @tv to the AICA Epoch and sets the RTC seconds counter.
56 */
57int aica_rtc_settimeofday(const time_t secs)
58{
59 unsigned long val1, val2;
60 unsigned long adj = secs + TWENTY_YEARS;
61
62 do {
63 ctrl_outl((adj & 0xffff0000) >> 16, AICA_RTC_SECS_H);
64 ctrl_outl((adj & 0xffff), AICA_RTC_SECS_L);
65
66 val1 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
67 (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
68
69 val2 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
70 (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
71 } while (val1 != val2);
72
73 return 0;
74}
75
76void aica_time_init(void)
77{
78 rtc_sh_get_time = aica_rtc_gettimeofday;
79 rtc_sh_set_time = aica_rtc_settimeofday;
80}
81
diff --git a/arch/sh/boards/dreamcast/setup.c b/arch/sh/boards/dreamcast/setup.c
deleted file mode 100644
index 2581c8cd5df7..000000000000
--- a/arch/sh/boards/dreamcast/setup.c
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * arch/sh/boards/dreamcast/setup.c
3 *
4 * Hardware support for the Sega Dreamcast.
5 *
6 * Copyright (c) 2001, 2002 M. R. Brown <mrbrown@linuxdc.org>
7 * Copyright (c) 2002, 2003, 2004 Paul Mundt <lethal@linux-sh.org>
8 *
9 * This file is part of the LinuxDC project (www.linuxdc.org)
10 *
11 * Released under the terms of the GNU GPL v2.0.
12 *
13 * This file originally bore the message (with enclosed-$):
14 * Id: setup_dc.c,v 1.5 2001/05/24 05:09:16 mrbrown Exp
15 * SEGA Dreamcast support
16 */
17
18#include <linux/sched.h>
19#include <linux/kernel.h>
20#include <linux/param.h>
21#include <linux/interrupt.h>
22#include <linux/init.h>
23#include <linux/irq.h>
24#include <linux/device.h>
25#include <asm/io.h>
26#include <asm/irq.h>
27#include <asm/rtc.h>
28#include <asm/machvec.h>
29#include <asm/mach/sysasic.h>
30
31extern struct hw_interrupt_type systemasic_int;
32extern void aica_time_init(void);
33extern int gapspci_init(void);
34extern int systemasic_irq_demux(int);
35
36static void __init dreamcast_setup(char **cmdline_p)
37{
38 int i;
39
40 /* Mask all hardware events */
41 /* XXX */
42
43 /* Acknowledge any previous events */
44 /* XXX */
45
46 __set_io_port_base(0xa0000000);
47
48 /* Assign all virtual IRQs to the System ASIC int. handler */
49 for (i = HW_EVENT_IRQ_BASE; i < HW_EVENT_IRQ_MAX; i++)
50 irq_desc[i].chip = &systemasic_int;
51
52 board_time_init = aica_time_init;
53
54#ifdef CONFIG_PCI
55 if (gapspci_init() < 0)
56 printk(KERN_WARNING "GAPSPCI was not detected.\n");
57#endif
58}
59
60static struct sh_machine_vector mv_dreamcast __initmv = {
61 .mv_name = "Sega Dreamcast",
62 .mv_setup = dreamcast_setup,
63 .mv_irq_demux = systemasic_irq_demux,
64};
diff --git a/arch/sh/boards/hp6xx/pm.c b/arch/sh/boards/hp6xx/pm.c
deleted file mode 100644
index d22f6eac9cca..000000000000
--- a/arch/sh/boards/hp6xx/pm.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * hp6x0 Power Management Routines
3 *
4 * Copyright (c) 2006 Andriy Skulysh <askulsyh@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 */
9#include <linux/init.h>
10#include <linux/suspend.h>
11#include <linux/errno.h>
12#include <linux/time.h>
13#include <asm/io.h>
14#include <asm/hd64461.h>
15#include <asm/hp6xx.h>
16#include <asm/cpu/dac.h>
17#include <asm/pm.h>
18
19#define STBCR 0xffffff82
20#define STBCR2 0xffffff88
21
22static int hp6x0_pm_enter(suspend_state_t state)
23{
24 u8 stbcr, stbcr2;
25#ifdef CONFIG_HD64461_ENABLER
26 u8 scr;
27 u16 hd64461_stbcr;
28#endif
29
30#ifdef CONFIG_HD64461_ENABLER
31 outb(0, HD64461_PCC1CSCIER);
32
33 scr = inb(HD64461_PCC1SCR);
34 scr |= HD64461_PCCSCR_VCC1;
35 outb(scr, HD64461_PCC1SCR);
36
37 hd64461_stbcr = inw(HD64461_STBCR);
38 hd64461_stbcr |= HD64461_STBCR_SPC1ST;
39 outw(hd64461_stbcr, HD64461_STBCR);
40#endif
41
42 ctrl_outb(0x1f, DACR);
43
44 stbcr = ctrl_inb(STBCR);
45 ctrl_outb(0x01, STBCR);
46
47 stbcr2 = ctrl_inb(STBCR2);
48 ctrl_outb(0x7f , STBCR2);
49
50 outw(0xf07f, HD64461_SCPUCR);
51
52 pm_enter();
53
54 outw(0, HD64461_SCPUCR);
55 ctrl_outb(stbcr, STBCR);
56 ctrl_outb(stbcr2, STBCR2);
57
58#ifdef CONFIG_HD64461_ENABLER
59 hd64461_stbcr = inw(HD64461_STBCR);
60 hd64461_stbcr &= ~HD64461_STBCR_SPC1ST;
61 outw(hd64461_stbcr, HD64461_STBCR);
62
63 outb(0x4c, HD64461_PCC1CSCIER);
64 outb(0x00, HD64461_PCC1CSCR);
65#endif
66
67 return 0;
68}
69
70static struct platform_suspend_ops hp6x0_pm_ops = {
71 .enter = hp6x0_pm_enter,
72 .valid = suspend_valid_only_mem,
73};
74
75static int __init hp6x0_pm_init(void)
76{
77 suspend_set_ops(&hp6x0_pm_ops);
78 return 0;
79}
80
81late_initcall(hp6x0_pm_init);
diff --git a/arch/sh/boards/hp6xx/pm_wakeup.S b/arch/sh/boards/hp6xx/pm_wakeup.S
deleted file mode 100644
index 45e9bf0b9115..000000000000
--- a/arch/sh/boards/hp6xx/pm_wakeup.S
+++ /dev/null
@@ -1,58 +0,0 @@
1/*
2 * Copyright (c) 2006 Andriy Skulysh <askulsyh@gmail.com>
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 */
9
10#include <linux/linkage.h>
11#include <asm/cpu/mmu_context.h>
12
13#define k0 r0
14#define k1 r1
15#define k2 r2
16#define k3 r3
17#define k4 r4
18
19/*
20 * Kernel mode register usage:
21 * k0 scratch
22 * k1 scratch
23 * k2 scratch (Exception code)
24 * k3 scratch (Return address)
25 * k4 scratch
26 * k5 reserved
27 * k6 Global Interrupt Mask (0--15 << 4)
28 * k7 CURRENT_THREAD_INFO (pointer to current thread info)
29 */
30
31ENTRY(wakeup_start)
32! clear STBY bit
33 mov #-126, k2
34 and #127, k0
35 mov.b k0, @k2
36! enable refresh
37 mov.l 5f, k1
38 mov.w 6f, k0
39 mov.w k0, @k1
40! jump to handler
41 mov.l 2f, k2
42 mov.l 3f, k3
43 mov.l @k2, k2
44
45 mov.l 4f, k1
46 jmp @k1
47 nop
48
49 .align 2
501: .long EXPEVT
512: .long INTEVT
523: .long ret_from_irq
534: .long handle_exception
545: .long 0xffffff68
556: .word 0x0524
56
57ENTRY(wakeup_end)
58 nop
diff --git a/arch/sh/boards/hp6xx/setup.c b/arch/sh/boards/hp6xx/setup.c
deleted file mode 100644
index 2f414ac3c690..000000000000
--- a/arch/sh/boards/hp6xx/setup.c
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 * linux/arch/sh/boards/hp6xx/setup.c
3 *
4 * Copyright (C) 2002 Andriy Skulysh
5 * Copyright (C) 2007 Kristoffer Ericson <Kristoffer_e1@hotmail.com>
6 *
7 * May be copied or modified under the terms of the GNU General Public
8 * License. See linux/COPYING for more information.
9 *
10 * Setup code for HP620/HP660/HP680/HP690 (internal peripherials only)
11 */
12#include <linux/types.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <asm/hd64461.h>
16#include <asm/io.h>
17#include <asm/irq.h>
18#include <asm/hp6xx.h>
19#include <asm/cpu/dac.h>
20
21#define SCPCR 0xa4000116
22#define SCPDR 0xa4000136
23
24/* CF Slot */
25static struct resource cf_ide_resources[] = {
26 [0] = {
27 .start = 0x15000000 + 0x1f0,
28 .end = 0x15000000 + 0x1f0 + 0x08 - 0x01,
29 .flags = IORESOURCE_MEM,
30 },
31 [1] = {
32 .start = 0x15000000 + 0x1fe,
33 .end = 0x15000000 + 0x1fe + 0x01,
34 .flags = IORESOURCE_MEM,
35 },
36 [2] = {
37 .start = 77,
38 .flags = IORESOURCE_IRQ,
39 },
40};
41
42static struct platform_device cf_ide_device = {
43 .name = "pata_platform",
44 .id = -1,
45 .num_resources = ARRAY_SIZE(cf_ide_resources),
46 .resource = cf_ide_resources,
47};
48
49static struct platform_device jornadakbd_device = {
50 .name = "jornada680_kbd",
51 .id = -1,
52};
53
54static struct platform_device *hp6xx_devices[] __initdata = {
55 &cf_ide_device,
56 &jornadakbd_device,
57};
58
59static void __init hp6xx_init_irq(void)
60{
61 /* Gets touchscreen and powerbutton IRQ working */
62 plat_irq_setup_pins(IRQ_MODE_IRQ);
63}
64
65static int __init hp6xx_devices_setup(void)
66{
67 return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices));
68}
69
70static void __init hp6xx_setup(char **cmdline_p)
71{
72 u8 v8;
73 u16 v;
74
75 v = inw(HD64461_STBCR);
76 v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
77 HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
78 HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
79 HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST|
80 HD64461_STBCR_SAFECKE_IST;
81#ifndef CONFIG_HD64461_ENABLER
82 v |= HD64461_STBCR_SPC1ST;
83#endif
84 outw(v, HD64461_STBCR);
85 v = inw(HD64461_GPADR);
86 v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
87 outw(v, HD64461_GPADR);
88
89 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR);
90
91#ifndef CONFIG_HD64461_ENABLER
92 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR);
93#endif
94
95 sh_dac_output(0, DAC_SPEAKER_VOLUME);
96 sh_dac_disable(DAC_SPEAKER_VOLUME);
97 v8 = ctrl_inb(DACR);
98 v8 &= ~DACR_DAE;
99 ctrl_outb(v8,DACR);
100
101 v8 = ctrl_inb(SCPDR);
102 v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y;
103 v8 &= ~SCPDR_TS_SCAN_ENABLE;
104 ctrl_outb(v8, SCPDR);
105
106 v = ctrl_inw(SCPCR);
107 v &= ~SCPCR_TS_MASK;
108 v |= SCPCR_TS_ENABLE;
109 ctrl_outw(v, SCPCR);
110}
111device_initcall(hp6xx_devices_setup);
112
113static struct sh_machine_vector mv_hp6xx __initmv = {
114 .mv_name = "hp6xx",
115 .mv_setup = hp6xx_setup,
116 /* IRQ's : CPU(64) + CCHIP(16) + FREE_TO_USE(6) */
117 .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM + 6,
118 .mv_irq_demux = hd64461_irq_demux,
119 /* Enable IRQ0 -> IRQ3 in IRQ_MODE */
120 .mv_init_irq = hp6xx_init_irq,
121};
diff --git a/arch/sh/boards/landisk/gio.c b/arch/sh/boards/landisk/gio.c
deleted file mode 100644
index 0c15b0a50b99..000000000000
--- a/arch/sh/boards/landisk/gio.c
+++ /dev/null
@@ -1,171 +0,0 @@
1/*
2 * arch/sh/boards/landisk/gio.c - driver for landisk
3 *
4 * This driver will also support the I-O DATA Device, Inc. LANDISK Board.
5 * LANDISK and USL-5P Button, LED and GIO driver drive function.
6 *
7 * Copylight (C) 2006 kogiidena
8 * Copylight (C) 2002 Atom Create Engineering Co., Ltd. *
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 *
14 */
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/smp_lock.h>
18#include <linux/kdev_t.h>
19#include <linux/cdev.h>
20#include <linux/fs.h>
21#include <asm/io.h>
22#include <asm/uaccess.h>
23#include <asm/landisk/gio.h>
24#include <asm/landisk/iodata_landisk.h>
25
26#define DEVCOUNT 4
27#define GIO_MINOR 2 /* GIO minor no. */
28
29static dev_t dev;
30static struct cdev *cdev_p;
31static int openCnt;
32
33static int gio_open(struct inode *inode, struct file *filp)
34{
35 int minor;
36 int ret = -ENOENT;
37
38 lock_kernel();
39 minor = MINOR(inode->i_rdev);
40 if (minor < DEVCOUNT) {
41 if (openCnt > 0) {
42 ret = -EALREADY;
43 } else {
44 openCnt++;
45 ret = 0;
46 }
47 }
48 unlock_kernel();
49 return ret;
50}
51
52static int gio_close(struct inode *inode, struct file *filp)
53{
54 int minor;
55
56 minor = MINOR(inode->i_rdev);
57 if (minor < DEVCOUNT) {
58 openCnt--;
59 }
60 return 0;
61}
62
63static int gio_ioctl(struct inode *inode, struct file *filp,
64 unsigned int cmd, unsigned long arg)
65{
66 unsigned int data;
67 static unsigned int addr = 0;
68
69 if (cmd & 0x01) { /* write */
70 if (copy_from_user(&data, (int *)arg, sizeof(int))) {
71 return -EFAULT;
72 }
73 }
74
75 switch (cmd) {
76 case GIODRV_IOCSGIOSETADDR: /* address set */
77 addr = data;
78 break;
79
80 case GIODRV_IOCSGIODATA1: /* write byte */
81 ctrl_outb((unsigned char)(0x0ff & data), addr);
82 break;
83
84 case GIODRV_IOCSGIODATA2: /* write word */
85 if (addr & 0x01) {
86 return -EFAULT;
87 }
88 ctrl_outw((unsigned short int)(0x0ffff & data), addr);
89 break;
90
91 case GIODRV_IOCSGIODATA4: /* write long */
92 if (addr & 0x03) {
93 return -EFAULT;
94 }
95 ctrl_outl(data, addr);
96 break;
97
98 case GIODRV_IOCGGIODATA1: /* read byte */
99 data = ctrl_inb(addr);
100 break;
101
102 case GIODRV_IOCGGIODATA2: /* read word */
103 if (addr & 0x01) {
104 return -EFAULT;
105 }
106 data = ctrl_inw(addr);
107 break;
108
109 case GIODRV_IOCGGIODATA4: /* read long */
110 if (addr & 0x03) {
111 return -EFAULT;
112 }
113 data = ctrl_inl(addr);
114 break;
115 default:
116 return -EFAULT;
117 break;
118 }
119
120 if ((cmd & 0x01) == 0) { /* read */
121 if (copy_to_user((int *)arg, &data, sizeof(int))) {
122 return -EFAULT;
123 }
124 }
125 return 0;
126}
127
128static const struct file_operations gio_fops = {
129 .owner = THIS_MODULE,
130 .open = gio_open, /* open */
131 .release = gio_close, /* release */
132 .ioctl = gio_ioctl, /* ioctl */
133};
134
135static int __init gio_init(void)
136{
137 int error;
138
139 printk(KERN_INFO "gio: driver initialized\n");
140
141 openCnt = 0;
142
143 if ((error = alloc_chrdev_region(&dev, 0, DEVCOUNT, "gio")) < 0) {
144 printk(KERN_ERR
145 "gio: Couldn't alloc_chrdev_region, error=%d\n",
146 error);
147 return 1;
148 }
149
150 cdev_p = cdev_alloc();
151 cdev_p->ops = &gio_fops;
152 error = cdev_add(cdev_p, dev, DEVCOUNT);
153 if (error) {
154 printk(KERN_ERR
155 "gio: Couldn't cdev_add, error=%d\n", error);
156 return 1;
157 }
158
159 return 0;
160}
161
162static void __exit gio_exit(void)
163{
164 cdev_del(cdev_p);
165 unregister_chrdev_region(dev, DEVCOUNT);
166}
167
168module_init(gio_init);
169module_exit(gio_exit);
170
171MODULE_LICENSE("GPL");
diff --git a/arch/sh/boards/landisk/irq.c b/arch/sh/boards/landisk/irq.c
deleted file mode 100644
index 258649491d44..000000000000
--- a/arch/sh/boards/landisk/irq.c
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * arch/sh/boards/landisk/irq.c
3 *
4 * I-O DATA Device, Inc. LANDISK Support
5 *
6 * Copyright (C) 2005-2007 kogiidena
7 *
8 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
9 * Based largely on io_se.c.
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <linux/init.h>
16#include <linux/irq.h>
17#include <linux/interrupt.h>
18#include <linux/io.h>
19#include <asm/landisk/iodata_landisk.h>
20
21static void disable_landisk_irq(unsigned int irq)
22{
23 unsigned char mask = 0xff ^ (0x01 << (irq - 5));
24
25 ctrl_outb(ctrl_inb(PA_IMASK) & mask, PA_IMASK);
26}
27
28static void enable_landisk_irq(unsigned int irq)
29{
30 unsigned char value = (0x01 << (irq - 5));
31
32 ctrl_outb(ctrl_inb(PA_IMASK) | value, PA_IMASK);
33}
34
35static struct irq_chip landisk_irq_chip __read_mostly = {
36 .name = "LANDISK",
37 .mask = disable_landisk_irq,
38 .unmask = enable_landisk_irq,
39 .mask_ack = disable_landisk_irq,
40};
41
42/*
43 * Initialize IRQ setting
44 */
45void __init init_landisk_IRQ(void)
46{
47 int i;
48
49 for (i = 5; i < 14; i++) {
50 disable_irq_nosync(i);
51 set_irq_chip_and_handler_name(i, &landisk_irq_chip,
52 handle_level_irq, "level");
53 enable_landisk_irq(i);
54 }
55 ctrl_outb(0x00, PA_PWRINT_CLR);
56}
diff --git a/arch/sh/boards/landisk/psw.c b/arch/sh/boards/landisk/psw.c
deleted file mode 100644
index 5a9b70b5decb..000000000000
--- a/arch/sh/boards/landisk/psw.c
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 * arch/sh/boards/landisk/psw.c
3 *
4 * push switch support for LANDISK and USL-5P
5 *
6 * Copyright (C) 2006-2007 Paul Mundt
7 * Copyright (C) 2007 kogiidena
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13#include <linux/io.h>
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <linux/platform_device.h>
17#include <asm/landisk/iodata_landisk.h>
18#include <asm/push-switch.h>
19
20static irqreturn_t psw_irq_handler(int irq, void *arg)
21{
22 struct platform_device *pdev = arg;
23 struct push_switch *psw = platform_get_drvdata(pdev);
24 struct push_switch_platform_info *psw_info = pdev->dev.platform_data;
25 unsigned int sw_value;
26 int ret = 0;
27
28 sw_value = (0x0ff & (~ctrl_inb(PA_STATUS)));
29
30 /* Nothing to do if there's no state change */
31 if (psw->state) {
32 ret = 1;
33 goto out;
34 }
35
36 /* Figure out who raised it */
37 if (sw_value & (1 << psw_info->bit)) {
38 psw->state = 1;
39 mod_timer(&psw->debounce, jiffies + 50);
40 ret = 1;
41 }
42
43out:
44 /* Clear the switch IRQs */
45 ctrl_outb(0x00, PA_PWRINT_CLR);
46
47 return IRQ_RETVAL(ret);
48}
49
50static struct resource psw_power_resources[] = {
51 [0] = {
52 .start = IRQ_POWER,
53 .flags = IORESOURCE_IRQ,
54 },
55};
56
57static struct resource psw_usl5p_resources[] = {
58 [0] = {
59 .start = IRQ_BUTTON,
60 .flags = IORESOURCE_IRQ,
61 },
62};
63
64static struct push_switch_platform_info psw_power_platform_data = {
65 .name = "psw_power",
66 .bit = 4,
67 .irq_flags = IRQF_SHARED,
68 .irq_handler = psw_irq_handler,
69};
70
71static struct push_switch_platform_info psw1_platform_data = {
72 .name = "psw1",
73 .bit = 0,
74 .irq_flags = IRQF_SHARED,
75 .irq_handler = psw_irq_handler,
76};
77
78static struct push_switch_platform_info psw2_platform_data = {
79 .name = "psw2",
80 .bit = 2,
81 .irq_flags = IRQF_SHARED,
82 .irq_handler = psw_irq_handler,
83};
84
85static struct push_switch_platform_info psw3_platform_data = {
86 .name = "psw3",
87 .bit = 1,
88 .irq_flags = IRQF_SHARED,
89 .irq_handler = psw_irq_handler,
90};
91
92static struct platform_device psw_power_switch_device = {
93 .name = "push-switch",
94 .id = 0,
95 .num_resources = ARRAY_SIZE(psw_power_resources),
96 .resource = psw_power_resources,
97 .dev = {
98 .platform_data = &psw_power_platform_data,
99 },
100};
101
102static struct platform_device psw1_switch_device = {
103 .name = "push-switch",
104 .id = 1,
105 .num_resources = ARRAY_SIZE(psw_usl5p_resources),
106 .resource = psw_usl5p_resources,
107 .dev = {
108 .platform_data = &psw1_platform_data,
109 },
110};
111
112static struct platform_device psw2_switch_device = {
113 .name = "push-switch",
114 .id = 2,
115 .num_resources = ARRAY_SIZE(psw_usl5p_resources),
116 .resource = psw_usl5p_resources,
117 .dev = {
118 .platform_data = &psw2_platform_data,
119 },
120};
121
122static struct platform_device psw3_switch_device = {
123 .name = "push-switch",
124 .id = 3,
125 .num_resources = ARRAY_SIZE(psw_usl5p_resources),
126 .resource = psw_usl5p_resources,
127 .dev = {
128 .platform_data = &psw3_platform_data,
129 },
130};
131
132static struct platform_device *psw_devices[] = {
133 &psw_power_switch_device,
134 &psw1_switch_device,
135 &psw2_switch_device,
136 &psw3_switch_device,
137};
138
139static int __init psw_init(void)
140{
141 return platform_add_devices(psw_devices, ARRAY_SIZE(psw_devices));
142}
143module_init(psw_init);
diff --git a/arch/sh/boards/landisk/setup.c b/arch/sh/boards/landisk/setup.c
deleted file mode 100644
index 2b708ec72558..000000000000
--- a/arch/sh/boards/landisk/setup.c
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * arch/sh/boards/landisk/setup.c
3 *
4 * I-O DATA Device, Inc. LANDISK Support.
5 *
6 * Copyright (C) 2000 Kazumoto Kojima
7 * Copyright (C) 2002 Paul Mundt
8 * Copylight (C) 2002 Atom Create Engineering Co., Ltd.
9 * Copyright (C) 2005-2007 kogiidena
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/ata_platform.h>
18#include <linux/pm.h>
19#include <linux/mm.h>
20#include <asm/machvec.h>
21#include <asm/landisk/iodata_landisk.h>
22#include <asm/io.h>
23
24void init_landisk_IRQ(void);
25
26static void landisk_power_off(void)
27{
28 ctrl_outb(0x01, PA_SHUTDOWN);
29}
30
31static struct resource cf_ide_resources[3];
32
33static struct pata_platform_info pata_info = {
34 .ioport_shift = 1,
35};
36
37static struct platform_device cf_ide_device = {
38 .name = "pata_platform",
39 .id = -1,
40 .num_resources = ARRAY_SIZE(cf_ide_resources),
41 .resource = cf_ide_resources,
42 .dev = {
43 .platform_data = &pata_info,
44 },
45};
46
47static struct platform_device rtc_device = {
48 .name = "rs5c313",
49 .id = -1,
50};
51
52static struct platform_device *landisk_devices[] __initdata = {
53 &cf_ide_device,
54 &rtc_device,
55};
56
57static int __init landisk_devices_setup(void)
58{
59 pgprot_t prot;
60 unsigned long paddrbase;
61 void *cf_ide_base;
62
63 /* open I/O area window */
64 paddrbase = virt_to_phys((void *)PA_AREA5_IO);
65 prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
66 cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
67 if (!cf_ide_base) {
68 printk("allocate_cf_area : can't open CF I/O window!\n");
69 return -ENOMEM;
70 }
71
72 /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
73 cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40;
74 cf_ide_resources[0].end = (unsigned long)cf_ide_base + 0x40 + 0x0f;
75 cf_ide_resources[0].flags = IORESOURCE_IO;
76 cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c;
77 cf_ide_resources[1].end = (unsigned long)cf_ide_base + 0x2c + 0x03;
78 cf_ide_resources[1].flags = IORESOURCE_IO;
79 cf_ide_resources[2].start = IRQ_FATA;
80 cf_ide_resources[2].flags = IORESOURCE_IRQ;
81
82 return platform_add_devices(landisk_devices,
83 ARRAY_SIZE(landisk_devices));
84}
85
86__initcall(landisk_devices_setup);
87
88static void __init landisk_setup(char **cmdline_p)
89{
90 /* LED ON */
91 ctrl_outb(ctrl_inb(PA_LED) | 0x03, PA_LED);
92
93 printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
94 pm_power_off = landisk_power_off;
95}
96
97/*
98 * The Machine Vector
99 */
100static struct sh_machine_vector mv_landisk __initmv = {
101 .mv_name = "LANDISK",
102 .mv_nr_irqs = 72,
103 .mv_setup = landisk_setup,
104 .mv_init_irq = init_landisk_IRQ,
105};
diff --git a/arch/sh/boards/cayman/Makefile b/arch/sh/boards/mach-cayman/Makefile
index 489a8f867368..489a8f867368 100644
--- a/arch/sh/boards/cayman/Makefile
+++ b/arch/sh/boards/mach-cayman/Makefile
diff --git a/arch/sh/boards/mach-cayman/irq.c b/arch/sh/boards/mach-cayman/irq.c
new file mode 100644
index 000000000000..ceb37ae92c70
--- /dev/null
+++ b/arch/sh/boards/mach-cayman/irq.c
@@ -0,0 +1,197 @@
1/*
2 * arch/sh/mach-cayman/irq.c - SH-5 Cayman Interrupt Support
3 *
4 * This file handles the board specific parts of the Cayman interrupt system
5 *
6 * Copyright (C) 2002 Stuart Menefy
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/io.h>
13#include <linux/irq.h>
14#include <linux/interrupt.h>
15#include <linux/signal.h>
16#include <cpu/irq.h>
17#include <asm/page.h>
18
19/* Setup for the SMSC FDC37C935 / LAN91C100FD */
20#define SMSC_IRQ IRQ_IRL1
21
22/* Setup for PCI Bus 2, which transmits interrupts via the EPLD */
23#define PCI2_IRQ IRQ_IRL3
24
25unsigned long epld_virt;
26
27#define EPLD_BASE 0x04002000
28#define EPLD_STATUS_BASE (epld_virt + 0x10)
29#define EPLD_MASK_BASE (epld_virt + 0x20)
30
31/* Note the SMSC SuperIO chip and SMSC LAN chip interrupts are all muxed onto
32 the same SH-5 interrupt */
33
34static irqreturn_t cayman_interrupt_smsc(int irq, void *dev_id)
35{
36 printk(KERN_INFO "CAYMAN: spurious SMSC interrupt\n");
37 return IRQ_NONE;
38}
39
40static irqreturn_t cayman_interrupt_pci2(int irq, void *dev_id)
41{
42 printk(KERN_INFO "CAYMAN: spurious PCI interrupt, IRQ %d\n", irq);
43 return IRQ_NONE;
44}
45
46static struct irqaction cayman_action_smsc = {
47 .name = "Cayman SMSC Mux",
48 .handler = cayman_interrupt_smsc,
49 .flags = IRQF_DISABLED,
50};
51
52static struct irqaction cayman_action_pci2 = {
53 .name = "Cayman PCI2 Mux",
54 .handler = cayman_interrupt_pci2,
55 .flags = IRQF_DISABLED,
56};
57
58static void enable_cayman_irq(unsigned int irq)
59{
60 unsigned long flags;
61 unsigned long mask;
62 unsigned int reg;
63 unsigned char bit;
64
65 irq -= START_EXT_IRQS;
66 reg = EPLD_MASK_BASE + ((irq / 8) << 2);
67 bit = 1<<(irq % 8);
68 local_irq_save(flags);
69 mask = ctrl_inl(reg);
70 mask |= bit;
71 ctrl_outl(mask, reg);
72 local_irq_restore(flags);
73}
74
75void disable_cayman_irq(unsigned int irq)
76{
77 unsigned long flags;
78 unsigned long mask;
79 unsigned int reg;
80 unsigned char bit;
81
82 irq -= START_EXT_IRQS;
83 reg = EPLD_MASK_BASE + ((irq / 8) << 2);
84 bit = 1<<(irq % 8);
85 local_irq_save(flags);
86 mask = ctrl_inl(reg);
87 mask &= ~bit;
88 ctrl_outl(mask, reg);
89 local_irq_restore(flags);
90}
91
92static void ack_cayman_irq(unsigned int irq)
93{
94 disable_cayman_irq(irq);
95}
96
97static void end_cayman_irq(unsigned int irq)
98{
99 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
100 enable_cayman_irq(irq);
101}
102
103static unsigned int startup_cayman_irq(unsigned int irq)
104{
105 enable_cayman_irq(irq);
106 return 0; /* never anything pending */
107}
108
109static void shutdown_cayman_irq(unsigned int irq)
110{
111 disable_cayman_irq(irq);
112}
113
114struct hw_interrupt_type cayman_irq_type = {
115 .typename = "Cayman-IRQ",
116 .startup = startup_cayman_irq,
117 .shutdown = shutdown_cayman_irq,
118 .enable = enable_cayman_irq,
119 .disable = disable_cayman_irq,
120 .ack = ack_cayman_irq,
121 .end = end_cayman_irq,
122};
123
124int cayman_irq_demux(int evt)
125{
126 int irq = intc_evt_to_irq[evt];
127
128 if (irq == SMSC_IRQ) {
129 unsigned long status;
130 int i;
131
132 status = ctrl_inl(EPLD_STATUS_BASE) &
133 ctrl_inl(EPLD_MASK_BASE) & 0xff;
134 if (status == 0) {
135 irq = -1;
136 } else {
137 for (i=0; i<8; i++) {
138 if (status & (1<<i))
139 break;
140 }
141 irq = START_EXT_IRQS + i;
142 }
143 }
144
145 if (irq == PCI2_IRQ) {
146 unsigned long status;
147 int i;
148
149 status = ctrl_inl(EPLD_STATUS_BASE + 3 * sizeof(u32)) &
150 ctrl_inl(EPLD_MASK_BASE + 3 * sizeof(u32)) & 0xff;
151 if (status == 0) {
152 irq = -1;
153 } else {
154 for (i=0; i<8; i++) {
155 if (status & (1<<i))
156 break;
157 }
158 irq = START_EXT_IRQS + (3 * 8) + i;
159 }
160 }
161
162 return irq;
163}
164
165#if defined(CONFIG_PROC_FS) && defined(CONFIG_SYSCTL)
166int cayman_irq_describe(char* p, int irq)
167{
168 if (irq < NR_INTC_IRQS) {
169 return intc_irq_describe(p, irq);
170 } else if (irq < NR_INTC_IRQS + 8) {
171 return sprintf(p, "(SMSC %d)", irq - NR_INTC_IRQS);
172 } else if ((irq >= NR_INTC_IRQS + 24) && (irq < NR_INTC_IRQS + 32)) {
173 return sprintf(p, "(PCI2 %d)", irq - (NR_INTC_IRQS + 24));
174 }
175
176 return 0;
177}
178#endif
179
180void init_cayman_irq(void)
181{
182 int i;
183
184 epld_virt = onchip_remap(EPLD_BASE, 1024, "EPLD");
185 if (!epld_virt) {
186 printk(KERN_ERR "Cayman IRQ: Unable to remap EPLD\n");
187 return;
188 }
189
190 for (i=0; i<NR_EXT_IRQS; i++) {
191 irq_desc[START_EXT_IRQS + i].chip = &cayman_irq_type;
192 }
193
194 /* Setup the SMSC interrupt */
195 setup_irq(SMSC_IRQ, &cayman_action_smsc);
196 setup_irq(PCI2_IRQ, &cayman_action_pci2);
197}
diff --git a/arch/sh/boards/cayman/led.c b/arch/sh/boards/mach-cayman/led.c
index a808eac4ecd6..a808eac4ecd6 100644
--- a/arch/sh/boards/cayman/led.c
+++ b/arch/sh/boards/mach-cayman/led.c
diff --git a/arch/sh/boards/mach-cayman/setup.c b/arch/sh/boards/mach-cayman/setup.c
new file mode 100644
index 000000000000..e7f9cc5f2ff1
--- /dev/null
+++ b/arch/sh/boards/mach-cayman/setup.c
@@ -0,0 +1,187 @@
1/*
2 * arch/sh/mach-cayman/setup.c
3 *
4 * SH5 Cayman support
5 *
6 * Copyright (C) 2002 David J. Mckay & Benedict Gaster
7 * Copyright (C) 2003 - 2007 Paul Mundt
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13#include <linux/init.h>
14#include <linux/io.h>
15#include <linux/kernel.h>
16#include <cpu/irq.h>
17
18/*
19 * Platform Dependent Interrupt Priorities.
20 */
21
22/* Using defaults defined in irq.h */
23#define RES NO_PRIORITY /* Disabled */
24#define IR0 IRL0_PRIORITY /* IRLs */
25#define IR1 IRL1_PRIORITY
26#define IR2 IRL2_PRIORITY
27#define IR3 IRL3_PRIORITY
28#define PCA INTA_PRIORITY /* PCI Ints */
29#define PCB INTB_PRIORITY
30#define PCC INTC_PRIORITY
31#define PCD INTD_PRIORITY
32#define SER TOP_PRIORITY
33#define ERR TOP_PRIORITY
34#define PW0 TOP_PRIORITY
35#define PW1 TOP_PRIORITY
36#define PW2 TOP_PRIORITY
37#define PW3 TOP_PRIORITY
38#define DM0 NO_PRIORITY /* DMA Ints */
39#define DM1 NO_PRIORITY
40#define DM2 NO_PRIORITY
41#define DM3 NO_PRIORITY
42#define DAE NO_PRIORITY
43#define TU0 TIMER_PRIORITY /* TMU Ints */
44#define TU1 NO_PRIORITY
45#define TU2 NO_PRIORITY
46#define TI2 NO_PRIORITY
47#define ATI NO_PRIORITY /* RTC Ints */
48#define PRI NO_PRIORITY
49#define CUI RTC_PRIORITY
50#define ERI SCIF_PRIORITY /* SCIF Ints */
51#define RXI SCIF_PRIORITY
52#define BRI SCIF_PRIORITY
53#define TXI SCIF_PRIORITY
54#define ITI TOP_PRIORITY /* WDT Ints */
55
56/* Setup for the SMSC FDC37C935 */
57#define SMSC_SUPERIO_BASE 0x04000000
58#define SMSC_CONFIG_PORT_ADDR 0x3f0
59#define SMSC_INDEX_PORT_ADDR SMSC_CONFIG_PORT_ADDR
60#define SMSC_DATA_PORT_ADDR 0x3f1
61
62#define SMSC_ENTER_CONFIG_KEY 0x55
63#define SMSC_EXIT_CONFIG_KEY 0xaa
64
65#define SMCS_LOGICAL_DEV_INDEX 0x07
66#define SMSC_DEVICE_ID_INDEX 0x20
67#define SMSC_DEVICE_REV_INDEX 0x21
68#define SMSC_ACTIVATE_INDEX 0x30
69#define SMSC_PRIMARY_BASE_INDEX 0x60
70#define SMSC_SECONDARY_BASE_INDEX 0x62
71#define SMSC_PRIMARY_INT_INDEX 0x70
72#define SMSC_SECONDARY_INT_INDEX 0x72
73
74#define SMSC_IDE1_DEVICE 1
75#define SMSC_KEYBOARD_DEVICE 7
76#define SMSC_CONFIG_REGISTERS 8
77
78#define SMSC_SUPERIO_READ_INDEXED(index) ({ \
79 outb((index), SMSC_INDEX_PORT_ADDR); \
80 inb(SMSC_DATA_PORT_ADDR); })
81#define SMSC_SUPERIO_WRITE_INDEXED(val, index) ({ \
82 outb((index), SMSC_INDEX_PORT_ADDR); \
83 outb((val), SMSC_DATA_PORT_ADDR); })
84
85#define IDE1_PRIMARY_BASE 0x01f0
86#define IDE1_SECONDARY_BASE 0x03f6
87
88unsigned long smsc_superio_virt;
89
90int platform_int_priority[NR_INTC_IRQS] = {
91 IR0, IR1, IR2, IR3, PCA, PCB, PCC, PCD, /* IRQ 0- 7 */
92 RES, RES, RES, RES, SER, ERR, PW3, PW2, /* IRQ 8-15 */
93 PW1, PW0, DM0, DM1, DM2, DM3, DAE, RES, /* IRQ 16-23 */
94 RES, RES, RES, RES, RES, RES, RES, RES, /* IRQ 24-31 */
95 TU0, TU1, TU2, TI2, ATI, PRI, CUI, ERI, /* IRQ 32-39 */
96 RXI, BRI, TXI, RES, RES, RES, RES, RES, /* IRQ 40-47 */
97 RES, RES, RES, RES, RES, RES, RES, RES, /* IRQ 48-55 */
98 RES, RES, RES, RES, RES, RES, RES, ITI, /* IRQ 56-63 */
99};
100
101static int __init smsc_superio_setup(void)
102{
103 unsigned char devid, devrev;
104
105 smsc_superio_virt = onchip_remap(SMSC_SUPERIO_BASE, 1024, "SMSC SuperIO");
106 if (!smsc_superio_virt) {
107 panic("Unable to remap SMSC SuperIO\n");
108 }
109
110 /* Initially the chip is in run state */
111 /* Put it into configuration state */
112 outb(SMSC_ENTER_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
113 outb(SMSC_ENTER_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
114
115 /* Read device ID info */
116 devid = SMSC_SUPERIO_READ_INDEXED(SMSC_DEVICE_ID_INDEX);
117 devrev = SMSC_SUPERIO_READ_INDEXED(SMSC_DEVICE_REV_INDEX);
118 printk("SMSC SuperIO devid %02x rev %02x\n", devid, devrev);
119
120 /* Select the keyboard device */
121 SMSC_SUPERIO_WRITE_INDEXED(SMSC_KEYBOARD_DEVICE, SMCS_LOGICAL_DEV_INDEX);
122
123 /* enable it */
124 SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
125
126 /* Select the interrupts */
127 /* On a PC keyboard is IRQ1, mouse is IRQ12 */
128 SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_PRIMARY_INT_INDEX);
129 SMSC_SUPERIO_WRITE_INDEXED(12, SMSC_SECONDARY_INT_INDEX);
130
131#ifdef CONFIG_IDE
132 /*
133 * Only IDE1 exists on the Cayman
134 */
135
136 /* Power it on */
137 SMSC_SUPERIO_WRITE_INDEXED(1 << SMSC_IDE1_DEVICE, 0x22);
138
139 SMSC_SUPERIO_WRITE_INDEXED(SMSC_IDE1_DEVICE, SMCS_LOGICAL_DEV_INDEX);
140 SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
141
142 SMSC_SUPERIO_WRITE_INDEXED(IDE1_PRIMARY_BASE >> 8,
143 SMSC_PRIMARY_BASE_INDEX + 0);
144 SMSC_SUPERIO_WRITE_INDEXED(IDE1_PRIMARY_BASE & 0xff,
145 SMSC_PRIMARY_BASE_INDEX + 1);
146
147 SMSC_SUPERIO_WRITE_INDEXED(IDE1_SECONDARY_BASE >> 8,
148 SMSC_SECONDARY_BASE_INDEX + 0);
149 SMSC_SUPERIO_WRITE_INDEXED(IDE1_SECONDARY_BASE & 0xff,
150 SMSC_SECONDARY_BASE_INDEX + 1);
151
152 SMSC_SUPERIO_WRITE_INDEXED(14, SMSC_PRIMARY_INT_INDEX);
153
154 SMSC_SUPERIO_WRITE_INDEXED(SMSC_CONFIG_REGISTERS,
155 SMCS_LOGICAL_DEV_INDEX);
156
157 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc2); /* GP42 = nIDE1_OE */
158 SMSC_SUPERIO_WRITE_INDEXED(0x01, 0xc5); /* GP45 = IDE1_IRQ */
159 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc6); /* GP46 = nIOROP */
160 SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */
161#endif
162
163 /* Exit the configuration state */
164 outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
165
166 return 0;
167}
168__initcall(smsc_superio_setup);
169
170static void __iomem *cayman_ioport_map(unsigned long port, unsigned int len)
171{
172 if (port < 0x400) {
173 extern unsigned long smsc_superio_virt;
174 return (void __iomem *)((port << 2) | smsc_superio_virt);
175 }
176
177 return (void __iomem *)port;
178}
179
180extern void init_cayman_irq(void);
181
182static struct sh_machine_vector mv_cayman __initmv = {
183 .mv_name = "Hitachi Cayman",
184 .mv_nr_irqs = 64,
185 .mv_ioport_map = cayman_ioport_map,
186 .mv_init_irq = init_cayman_irq,
187};
diff --git a/arch/sh/boards/dreamcast/Makefile b/arch/sh/boards/mach-dreamcast/Makefile
index 7b97546c7e5f..7b97546c7e5f 100644
--- a/arch/sh/boards/dreamcast/Makefile
+++ b/arch/sh/boards/mach-dreamcast/Makefile
diff --git a/arch/sh/boards/mach-dreamcast/irq.c b/arch/sh/boards/mach-dreamcast/irq.c
new file mode 100644
index 000000000000..67bdc33dd411
--- /dev/null
+++ b/arch/sh/boards/mach-dreamcast/irq.c
@@ -0,0 +1,153 @@
1/*
2 * arch/sh/boards/dreamcast/irq.c
3 *
4 * Holly IRQ support for the Sega Dreamcast.
5 *
6 * Copyright (c) 2001, 2002 M. R. Brown <mrbrown@0xd6.org>
7 *
8 * This file is part of the LinuxDC project (www.linuxdc.org)
9 * Released under the terms of the GNU GPL v2.0
10 */
11
12#include <linux/irq.h>
13#include <asm/io.h>
14#include <asm/irq.h>
15#include <mach/sysasic.h>
16
17/* Dreamcast System ASIC Hardware Events -
18
19 The Dreamcast's System ASIC (a.k.a. Holly) is responsible for receiving
20 hardware events from system peripherals and triggering an SH7750 IRQ.
21 Hardware events can trigger IRQs 13, 11, or 9 depending on which bits are
22 set in the Event Mask Registers (EMRs). When a hardware event is
23 triggered, it's corresponding bit in the Event Status Registers (ESRs)
24 is set, and that bit should be rewritten to the ESR to acknowledge that
25 event.
26
27 There are three 32-bit ESRs located at 0xa05f8900 - 0xa05f6908. Event
28 types can be found in include/asm-sh/dreamcast/sysasic.h. There are three
29 groups of EMRs that parallel the ESRs. Each EMR group corresponds to an
30 IRQ, so 0xa05f6910 - 0xa05f6918 triggers IRQ 13, 0xa05f6920 - 0xa05f6928
31 triggers IRQ 11, and 0xa05f6930 - 0xa05f6938 triggers IRQ 9.
32
33 In the kernel, these events are mapped to virtual IRQs so that drivers can
34 respond to them as they would a normal interrupt. In order to keep this
35 mapping simple, the events are mapped as:
36
37 6900/6910 - Events 0-31, IRQ 13
38 6904/6924 - Events 32-63, IRQ 11
39 6908/6938 - Events 64-95, IRQ 9
40
41*/
42
43#define ESR_BASE 0x005f6900 /* Base event status register */
44#define EMR_BASE 0x005f6910 /* Base event mask register */
45
46/* Helps us determine the EMR group that this event belongs to: 0 = 0x6910,
47 1 = 0x6920, 2 = 0x6930; also determine the event offset */
48#define LEVEL(event) (((event) - HW_EVENT_IRQ_BASE) / 32)
49
50/* Return the hardware event's bit positon within the EMR/ESR */
51#define EVENT_BIT(event) (((event) - HW_EVENT_IRQ_BASE) & 31)
52
53/* For each of these *_irq routines, the IRQ passed in is the virtual IRQ
54 (logically mapped to the corresponding bit for the hardware event). */
55
56/* Disable the hardware event by masking its bit in its EMR */
57static inline void disable_systemasic_irq(unsigned int irq)
58{
59 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
60 __u32 mask;
61
62 mask = inl(emr);
63 mask &= ~(1 << EVENT_BIT(irq));
64 outl(mask, emr);
65}
66
67/* Enable the hardware event by setting its bit in its EMR */
68static inline void enable_systemasic_irq(unsigned int irq)
69{
70 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
71 __u32 mask;
72
73 mask = inl(emr);
74 mask |= (1 << EVENT_BIT(irq));
75 outl(mask, emr);
76}
77
78/* Acknowledge a hardware event by writing its bit back to its ESR */
79static void ack_systemasic_irq(unsigned int irq)
80{
81 __u32 esr = ESR_BASE + (LEVEL(irq) << 2);
82 disable_systemasic_irq(irq);
83 outl((1 << EVENT_BIT(irq)), esr);
84}
85
86/* After a IRQ has been ack'd and responded to, it needs to be renabled */
87static void end_systemasic_irq(unsigned int irq)
88{
89 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
90 enable_systemasic_irq(irq);
91}
92
93static unsigned int startup_systemasic_irq(unsigned int irq)
94{
95 enable_systemasic_irq(irq);
96
97 return 0;
98}
99
100static void shutdown_systemasic_irq(unsigned int irq)
101{
102 disable_systemasic_irq(irq);
103}
104
105struct hw_interrupt_type systemasic_int = {
106 .typename = "System ASIC",
107 .startup = startup_systemasic_irq,
108 .shutdown = shutdown_systemasic_irq,
109 .enable = enable_systemasic_irq,
110 .disable = disable_systemasic_irq,
111 .ack = ack_systemasic_irq,
112 .end = end_systemasic_irq,
113};
114
115/*
116 * Map the hardware event indicated by the processor IRQ to a virtual IRQ.
117 */
118int systemasic_irq_demux(int irq)
119{
120 __u32 emr, esr, status, level;
121 __u32 j, bit;
122
123 switch (irq) {
124 case 13:
125 level = 0;
126 break;
127 case 11:
128 level = 1;
129 break;
130 case 9:
131 level = 2;
132 break;
133 default:
134 return irq;
135 }
136 emr = EMR_BASE + (level << 4) + (level << 2);
137 esr = ESR_BASE + (level << 2);
138
139 /* Mask the ESR to filter any spurious, unwanted interrupts */
140 status = inl(esr);
141 status &= inl(emr);
142
143 /* Now scan and find the first set bit as the event to map */
144 for (bit = 1, j = 0; j < 32; bit <<= 1, j++) {
145 if (status & bit) {
146 irq = HW_EVENT_IRQ_BASE + j + (level << 5);
147 return irq;
148 }
149 }
150
151 /* Not reached */
152 return irq;
153}
diff --git a/arch/sh/boards/mach-dreamcast/rtc.c b/arch/sh/boards/mach-dreamcast/rtc.c
new file mode 100644
index 000000000000..a7433685798d
--- /dev/null
+++ b/arch/sh/boards/mach-dreamcast/rtc.c
@@ -0,0 +1,81 @@
1/*
2 * arch/sh/boards/dreamcast/rtc.c
3 *
4 * Dreamcast AICA RTC routines.
5 *
6 * Copyright (c) 2001, 2002 M. R. Brown <mrbrown@0xd6.org>
7 * Copyright (c) 2002 Paul Mundt <lethal@chaoticdreams.org>
8 *
9 * Released under the terms of the GNU GPL v2.0.
10 *
11 */
12
13#include <linux/time.h>
14#include <asm/rtc.h>
15#include <asm/io.h>
16
17/* The AICA RTC has an Epoch of 1/1/1950, so we must subtract 20 years (in
18 seconds) to get the standard Unix Epoch when getting the time, and add
19 20 years when setting the time. */
20#define TWENTY_YEARS ((20 * 365LU + 5) * 86400)
21
22/* The AICA RTC is represented by a 32-bit seconds counter stored in 2 16-bit
23 registers.*/
24#define AICA_RTC_SECS_H 0xa0710000
25#define AICA_RTC_SECS_L 0xa0710004
26
27/**
28 * aica_rtc_gettimeofday - Get the time from the AICA RTC
29 * @ts: pointer to resulting timespec
30 *
31 * Grabs the current RTC seconds counter and adjusts it to the Unix Epoch.
32 */
33static void aica_rtc_gettimeofday(struct timespec *ts)
34{
35 unsigned long val1, val2;
36
37 do {
38 val1 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
39 (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
40
41 val2 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
42 (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
43 } while (val1 != val2);
44
45 ts->tv_sec = val1 - TWENTY_YEARS;
46
47 /* Can't get nanoseconds with just a seconds counter. */
48 ts->tv_nsec = 0;
49}
50
51/**
52 * aica_rtc_settimeofday - Set the AICA RTC to the current time
53 * @secs: contains the time_t to set
54 *
55 * Adjusts the given @tv to the AICA Epoch and sets the RTC seconds counter.
56 */
57static int aica_rtc_settimeofday(const time_t secs)
58{
59 unsigned long val1, val2;
60 unsigned long adj = secs + TWENTY_YEARS;
61
62 do {
63 ctrl_outl((adj & 0xffff0000) >> 16, AICA_RTC_SECS_H);
64 ctrl_outl((adj & 0xffff), AICA_RTC_SECS_L);
65
66 val1 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
67 (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
68
69 val2 = ((ctrl_inl(AICA_RTC_SECS_H) & 0xffff) << 16) |
70 (ctrl_inl(AICA_RTC_SECS_L) & 0xffff);
71 } while (val1 != val2);
72
73 return 0;
74}
75
76void aica_time_init(void)
77{
78 rtc_sh_get_time = aica_rtc_gettimeofday;
79 rtc_sh_set_time = aica_rtc_settimeofday;
80}
81
diff --git a/arch/sh/boards/mach-dreamcast/setup.c b/arch/sh/boards/mach-dreamcast/setup.c
new file mode 100644
index 000000000000..7d944fc75e93
--- /dev/null
+++ b/arch/sh/boards/mach-dreamcast/setup.c
@@ -0,0 +1,64 @@
1/*
2 * arch/sh/boards/dreamcast/setup.c
3 *
4 * Hardware support for the Sega Dreamcast.
5 *
6 * Copyright (c) 2001, 2002 M. R. Brown <mrbrown@linuxdc.org>
7 * Copyright (c) 2002, 2003, 2004 Paul Mundt <lethal@linux-sh.org>
8 *
9 * This file is part of the LinuxDC project (www.linuxdc.org)
10 *
11 * Released under the terms of the GNU GPL v2.0.
12 *
13 * This file originally bore the message (with enclosed-$):
14 * Id: setup_dc.c,v 1.5 2001/05/24 05:09:16 mrbrown Exp
15 * SEGA Dreamcast support
16 */
17
18#include <linux/sched.h>
19#include <linux/kernel.h>
20#include <linux/param.h>
21#include <linux/interrupt.h>
22#include <linux/init.h>
23#include <linux/irq.h>
24#include <linux/device.h>
25#include <asm/io.h>
26#include <asm/irq.h>
27#include <asm/rtc.h>
28#include <asm/machvec.h>
29#include <mach/sysasic.h>
30
31extern struct hw_interrupt_type systemasic_int;
32extern void aica_time_init(void);
33extern int gapspci_init(void);
34extern int systemasic_irq_demux(int);
35
36static void __init dreamcast_setup(char **cmdline_p)
37{
38 int i;
39
40 /* Mask all hardware events */
41 /* XXX */
42
43 /* Acknowledge any previous events */
44 /* XXX */
45
46 __set_io_port_base(0xa0000000);
47
48 /* Assign all virtual IRQs to the System ASIC int. handler */
49 for (i = HW_EVENT_IRQ_BASE; i < HW_EVENT_IRQ_MAX; i++)
50 irq_desc[i].chip = &systemasic_int;
51
52 board_time_init = aica_time_init;
53
54#ifdef CONFIG_PCI
55 if (gapspci_init() < 0)
56 printk(KERN_WARNING "GAPSPCI was not detected.\n");
57#endif
58}
59
60static struct sh_machine_vector mv_dreamcast __initmv = {
61 .mv_name = "Sega Dreamcast",
62 .mv_setup = dreamcast_setup,
63 .mv_irq_demux = systemasic_irq_demux,
64};
diff --git a/arch/sh/boards/renesas/edosk7705/Makefile b/arch/sh/boards/mach-edosk7705/Makefile
index 14bdd531f116..14bdd531f116 100644
--- a/arch/sh/boards/renesas/edosk7705/Makefile
+++ b/arch/sh/boards/mach-edosk7705/Makefile
diff --git a/arch/sh/boards/renesas/edosk7705/io.c b/arch/sh/boards/mach-edosk7705/io.c
index 541cea2a652f..541cea2a652f 100644
--- a/arch/sh/boards/renesas/edosk7705/io.c
+++ b/arch/sh/boards/mach-edosk7705/io.c
diff --git a/arch/sh/boards/renesas/edosk7705/setup.c b/arch/sh/boards/mach-edosk7705/setup.c
index f076c45308dd..f076c45308dd 100644
--- a/arch/sh/boards/renesas/edosk7705/setup.c
+++ b/arch/sh/boards/mach-edosk7705/setup.c
diff --git a/arch/sh/boards/renesas/r7780rp/Kconfig b/arch/sh/boards/mach-highlander/Kconfig
index fc8f28e04ba3..fc8f28e04ba3 100644
--- a/arch/sh/boards/renesas/r7780rp/Kconfig
+++ b/arch/sh/boards/mach-highlander/Kconfig
diff --git a/arch/sh/boards/renesas/r7780rp/Makefile b/arch/sh/boards/mach-highlander/Makefile
index 20a10080b11f..20a10080b11f 100644
--- a/arch/sh/boards/renesas/r7780rp/Makefile
+++ b/arch/sh/boards/mach-highlander/Makefile
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c b/arch/sh/boards/mach-highlander/irq-r7780mp.c
index ae1cfcb29700..ae1cfcb29700 100644
--- a/arch/sh/boards/renesas/r7780rp/irq-r7780mp.c
+++ b/arch/sh/boards/mach-highlander/irq-r7780mp.c
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c b/arch/sh/boards/mach-highlander/irq-r7780rp.c
index 9d3921fe27c0..9d3921fe27c0 100644
--- a/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c
+++ b/arch/sh/boards/mach-highlander/irq-r7780rp.c
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c b/arch/sh/boards/mach-highlander/irq-r7785rp.c
index 896c045aa39d..896c045aa39d 100644
--- a/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c
+++ b/arch/sh/boards/mach-highlander/irq-r7785rp.c
diff --git a/arch/sh/boards/mach-highlander/psw.c b/arch/sh/boards/mach-highlander/psw.c
new file mode 100644
index 000000000000..be8d5477fc65
--- /dev/null
+++ b/arch/sh/boards/mach-highlander/psw.c
@@ -0,0 +1,122 @@
1/*
2 * arch/sh/boards/renesas/r7780rp/psw.c
3 *
4 * push switch support for RDBRP-1/RDBREVRP-1 debug boards.
5 *
6 * Copyright (C) 2006 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/io.h>
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <asm/r7780rp.h>
17#include <asm/push-switch.h>
18
19static irqreturn_t psw_irq_handler(int irq, void *arg)
20{
21 struct platform_device *pdev = arg;
22 struct push_switch *psw = platform_get_drvdata(pdev);
23 struct push_switch_platform_info *psw_info = pdev->dev.platform_data;
24 unsigned int l, mask;
25 int ret = 0;
26
27 l = ctrl_inw(PA_DBSW);
28
29 /* Nothing to do if there's no state change */
30 if (psw->state) {
31 ret = 1;
32 goto out;
33 }
34
35 mask = l & 0x70;
36 /* Figure out who raised it */
37 if (mask & (1 << psw_info->bit)) {
38 psw->state = !!(mask & (1 << psw_info->bit));
39 if (psw->state) /* debounce */
40 mod_timer(&psw->debounce, jiffies + 50);
41
42 ret = 1;
43 }
44
45out:
46 /* Clear the switch IRQs */
47 l |= (0x7 << 12);
48 ctrl_outw(l, PA_DBSW);
49
50 return IRQ_RETVAL(ret);
51}
52
53static struct resource psw_resources[] = {
54 [0] = {
55 .start = IRQ_PSW,
56 .flags = IORESOURCE_IRQ,
57 },
58};
59
60static struct push_switch_platform_info s2_platform_data = {
61 .name = "s2",
62 .bit = 6,
63 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
64 IRQF_SHARED,
65 .irq_handler = psw_irq_handler,
66};
67
68static struct platform_device s2_switch_device = {
69 .name = "push-switch",
70 .id = 0,
71 .num_resources = ARRAY_SIZE(psw_resources),
72 .resource = psw_resources,
73 .dev = {
74 .platform_data = &s2_platform_data,
75 },
76};
77
78static struct push_switch_platform_info s3_platform_data = {
79 .name = "s3",
80 .bit = 5,
81 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
82 IRQF_SHARED,
83 .irq_handler = psw_irq_handler,
84};
85
86static struct platform_device s3_switch_device = {
87 .name = "push-switch",
88 .id = 1,
89 .num_resources = ARRAY_SIZE(psw_resources),
90 .resource = psw_resources,
91 .dev = {
92 .platform_data = &s3_platform_data,
93 },
94};
95
96static struct push_switch_platform_info s4_platform_data = {
97 .name = "s4",
98 .bit = 4,
99 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
100 IRQF_SHARED,
101 .irq_handler = psw_irq_handler,
102};
103
104static struct platform_device s4_switch_device = {
105 .name = "push-switch",
106 .id = 2,
107 .num_resources = ARRAY_SIZE(psw_resources),
108 .resource = psw_resources,
109 .dev = {
110 .platform_data = &s4_platform_data,
111 },
112};
113
114static struct platform_device *psw_devices[] = {
115 &s2_switch_device, &s3_switch_device, &s4_switch_device,
116};
117
118static int __init psw_init(void)
119{
120 return platform_add_devices(psw_devices, ARRAY_SIZE(psw_devices));
121}
122module_init(psw_init);
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/mach-highlander/setup.c
index bc79afb6fc4c..bc79afb6fc4c 100644
--- a/arch/sh/boards/renesas/r7780rp/setup.c
+++ b/arch/sh/boards/mach-highlander/setup.c
diff --git a/arch/sh/boards/hp6xx/Makefile b/arch/sh/boards/mach-hp6xx/Makefile
index b3124278247c..b3124278247c 100644
--- a/arch/sh/boards/hp6xx/Makefile
+++ b/arch/sh/boards/mach-hp6xx/Makefile
diff --git a/arch/sh/boards/hp6xx/hp6xx_apm.c b/arch/sh/boards/mach-hp6xx/hp6xx_apm.c
index 177f4f028e0d..177f4f028e0d 100644
--- a/arch/sh/boards/hp6xx/hp6xx_apm.c
+++ b/arch/sh/boards/mach-hp6xx/hp6xx_apm.c
diff --git a/arch/sh/boards/mach-hp6xx/pm.c b/arch/sh/boards/mach-hp6xx/pm.c
new file mode 100644
index 000000000000..e96684def788
--- /dev/null
+++ b/arch/sh/boards/mach-hp6xx/pm.c
@@ -0,0 +1,81 @@
1/*
2 * hp6x0 Power Management Routines
3 *
4 * Copyright (c) 2006 Andriy Skulysh <askulsyh@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 */
9#include <linux/init.h>
10#include <linux/suspend.h>
11#include <linux/errno.h>
12#include <linux/time.h>
13#include <asm/io.h>
14#include <asm/hd64461.h>
15#include <asm/hp6xx.h>
16#include <cpu/dac.h>
17#include <asm/pm.h>
18
19#define STBCR 0xffffff82
20#define STBCR2 0xffffff88
21
22static int hp6x0_pm_enter(suspend_state_t state)
23{
24 u8 stbcr, stbcr2;
25#ifdef CONFIG_HD64461_ENABLER
26 u8 scr;
27 u16 hd64461_stbcr;
28#endif
29
30#ifdef CONFIG_HD64461_ENABLER
31 outb(0, HD64461_PCC1CSCIER);
32
33 scr = inb(HD64461_PCC1SCR);
34 scr |= HD64461_PCCSCR_VCC1;
35 outb(scr, HD64461_PCC1SCR);
36
37 hd64461_stbcr = inw(HD64461_STBCR);
38 hd64461_stbcr |= HD64461_STBCR_SPC1ST;
39 outw(hd64461_stbcr, HD64461_STBCR);
40#endif
41
42 ctrl_outb(0x1f, DACR);
43
44 stbcr = ctrl_inb(STBCR);
45 ctrl_outb(0x01, STBCR);
46
47 stbcr2 = ctrl_inb(STBCR2);
48 ctrl_outb(0x7f , STBCR2);
49
50 outw(0xf07f, HD64461_SCPUCR);
51
52 pm_enter();
53
54 outw(0, HD64461_SCPUCR);
55 ctrl_outb(stbcr, STBCR);
56 ctrl_outb(stbcr2, STBCR2);
57
58#ifdef CONFIG_HD64461_ENABLER
59 hd64461_stbcr = inw(HD64461_STBCR);
60 hd64461_stbcr &= ~HD64461_STBCR_SPC1ST;
61 outw(hd64461_stbcr, HD64461_STBCR);
62
63 outb(0x4c, HD64461_PCC1CSCIER);
64 outb(0x00, HD64461_PCC1CSCR);
65#endif
66
67 return 0;
68}
69
70static struct platform_suspend_ops hp6x0_pm_ops = {
71 .enter = hp6x0_pm_enter,
72 .valid = suspend_valid_only_mem,
73};
74
75static int __init hp6x0_pm_init(void)
76{
77 suspend_set_ops(&hp6x0_pm_ops);
78 return 0;
79}
80
81late_initcall(hp6x0_pm_init);
diff --git a/arch/sh/boards/mach-hp6xx/pm_wakeup.S b/arch/sh/boards/mach-hp6xx/pm_wakeup.S
new file mode 100644
index 000000000000..44b648cf6f23
--- /dev/null
+++ b/arch/sh/boards/mach-hp6xx/pm_wakeup.S
@@ -0,0 +1,58 @@
1/*
2 * Copyright (c) 2006 Andriy Skulysh <askulsyh@gmail.com>
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 */
9
10#include <linux/linkage.h>
11#include <cpu/mmu_context.h>
12
13#define k0 r0
14#define k1 r1
15#define k2 r2
16#define k3 r3
17#define k4 r4
18
19/*
20 * Kernel mode register usage:
21 * k0 scratch
22 * k1 scratch
23 * k2 scratch (Exception code)
24 * k3 scratch (Return address)
25 * k4 scratch
26 * k5 reserved
27 * k6 Global Interrupt Mask (0--15 << 4)
28 * k7 CURRENT_THREAD_INFO (pointer to current thread info)
29 */
30
31ENTRY(wakeup_start)
32! clear STBY bit
33 mov #-126, k2
34 and #127, k0
35 mov.b k0, @k2
36! enable refresh
37 mov.l 5f, k1
38 mov.w 6f, k0
39 mov.w k0, @k1
40! jump to handler
41 mov.l 2f, k2
42 mov.l 3f, k3
43 mov.l @k2, k2
44
45 mov.l 4f, k1
46 jmp @k1
47 nop
48
49 .align 2
501: .long EXPEVT
512: .long INTEVT
523: .long ret_from_irq
534: .long handle_exception
545: .long 0xffffff68
556: .word 0x0524
56
57ENTRY(wakeup_end)
58 nop
diff --git a/arch/sh/boards/mach-hp6xx/setup.c b/arch/sh/boards/mach-hp6xx/setup.c
new file mode 100644
index 000000000000..475b46caec1f
--- /dev/null
+++ b/arch/sh/boards/mach-hp6xx/setup.c
@@ -0,0 +1,121 @@
1/*
2 * linux/arch/sh/boards/hp6xx/setup.c
3 *
4 * Copyright (C) 2002 Andriy Skulysh
5 * Copyright (C) 2007 Kristoffer Ericson <Kristoffer_e1@hotmail.com>
6 *
7 * May be copied or modified under the terms of the GNU General Public
8 * License. See linux/COPYING for more information.
9 *
10 * Setup code for HP620/HP660/HP680/HP690 (internal peripherials only)
11 */
12#include <linux/types.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <asm/hd64461.h>
16#include <asm/io.h>
17#include <asm/irq.h>
18#include <asm/hp6xx.h>
19#include <cpu/dac.h>
20
21#define SCPCR 0xa4000116
22#define SCPDR 0xa4000136
23
24/* CF Slot */
25static struct resource cf_ide_resources[] = {
26 [0] = {
27 .start = 0x15000000 + 0x1f0,
28 .end = 0x15000000 + 0x1f0 + 0x08 - 0x01,
29 .flags = IORESOURCE_MEM,
30 },
31 [1] = {
32 .start = 0x15000000 + 0x1fe,
33 .end = 0x15000000 + 0x1fe + 0x01,
34 .flags = IORESOURCE_MEM,
35 },
36 [2] = {
37 .start = 77,
38 .flags = IORESOURCE_IRQ,
39 },
40};
41
42static struct platform_device cf_ide_device = {
43 .name = "pata_platform",
44 .id = -1,
45 .num_resources = ARRAY_SIZE(cf_ide_resources),
46 .resource = cf_ide_resources,
47};
48
49static struct platform_device jornadakbd_device = {
50 .name = "jornada680_kbd",
51 .id = -1,
52};
53
54static struct platform_device *hp6xx_devices[] __initdata = {
55 &cf_ide_device,
56 &jornadakbd_device,
57};
58
59static void __init hp6xx_init_irq(void)
60{
61 /* Gets touchscreen and powerbutton IRQ working */
62 plat_irq_setup_pins(IRQ_MODE_IRQ);
63}
64
65static int __init hp6xx_devices_setup(void)
66{
67 return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices));
68}
69
70static void __init hp6xx_setup(char **cmdline_p)
71{
72 u8 v8;
73 u16 v;
74
75 v = inw(HD64461_STBCR);
76 v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
77 HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
78 HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
79 HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST|
80 HD64461_STBCR_SAFECKE_IST;
81#ifndef CONFIG_HD64461_ENABLER
82 v |= HD64461_STBCR_SPC1ST;
83#endif
84 outw(v, HD64461_STBCR);
85 v = inw(HD64461_GPADR);
86 v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
87 outw(v, HD64461_GPADR);
88
89 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR);
90
91#ifndef CONFIG_HD64461_ENABLER
92 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR);
93#endif
94
95 sh_dac_output(0, DAC_SPEAKER_VOLUME);
96 sh_dac_disable(DAC_SPEAKER_VOLUME);
97 v8 = ctrl_inb(DACR);
98 v8 &= ~DACR_DAE;
99 ctrl_outb(v8,DACR);
100
101 v8 = ctrl_inb(SCPDR);
102 v8 |= SCPDR_TS_SCAN_X | SCPDR_TS_SCAN_Y;
103 v8 &= ~SCPDR_TS_SCAN_ENABLE;
104 ctrl_outb(v8, SCPDR);
105
106 v = ctrl_inw(SCPCR);
107 v &= ~SCPCR_TS_MASK;
108 v |= SCPCR_TS_ENABLE;
109 ctrl_outw(v, SCPCR);
110}
111device_initcall(hp6xx_devices_setup);
112
113static struct sh_machine_vector mv_hp6xx __initmv = {
114 .mv_name = "hp6xx",
115 .mv_setup = hp6xx_setup,
116 /* IRQ's : CPU(64) + CCHIP(16) + FREE_TO_USE(6) */
117 .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM + 6,
118 .mv_irq_demux = hd64461_irq_demux,
119 /* Enable IRQ0 -> IRQ3 in IRQ_MODE */
120 .mv_init_irq = hp6xx_init_irq,
121};
diff --git a/arch/sh/boards/landisk/Makefile b/arch/sh/boards/mach-landisk/Makefile
index a696b4277fa9..a696b4277fa9 100644
--- a/arch/sh/boards/landisk/Makefile
+++ b/arch/sh/boards/mach-landisk/Makefile
diff --git a/arch/sh/boards/mach-landisk/gio.c b/arch/sh/boards/mach-landisk/gio.c
new file mode 100644
index 000000000000..25cdf7358000
--- /dev/null
+++ b/arch/sh/boards/mach-landisk/gio.c
@@ -0,0 +1,171 @@
1/*
2 * arch/sh/boards/landisk/gio.c - driver for landisk
3 *
4 * This driver will also support the I-O DATA Device, Inc. LANDISK Board.
5 * LANDISK and USL-5P Button, LED and GIO driver drive function.
6 *
7 * Copylight (C) 2006 kogiidena
8 * Copylight (C) 2002 Atom Create Engineering Co., Ltd. *
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 *
14 */
15#include <linux/module.h>
16#include <linux/init.h>
17#include <linux/smp_lock.h>
18#include <linux/kdev_t.h>
19#include <linux/cdev.h>
20#include <linux/fs.h>
21#include <asm/io.h>
22#include <asm/uaccess.h>
23#include <mach-landisk/mach/gio.h>
24#include <mach-landisk/mach/iodata_landisk.h>
25
26#define DEVCOUNT 4
27#define GIO_MINOR 2 /* GIO minor no. */
28
29static dev_t dev;
30static struct cdev *cdev_p;
31static int openCnt;
32
33static int gio_open(struct inode *inode, struct file *filp)
34{
35 int minor;
36 int ret = -ENOENT;
37
38 lock_kernel();
39 minor = MINOR(inode->i_rdev);
40 if (minor < DEVCOUNT) {
41 if (openCnt > 0) {
42 ret = -EALREADY;
43 } else {
44 openCnt++;
45 ret = 0;
46 }
47 }
48 unlock_kernel();
49 return ret;
50}
51
52static int gio_close(struct inode *inode, struct file *filp)
53{
54 int minor;
55
56 minor = MINOR(inode->i_rdev);
57 if (minor < DEVCOUNT) {
58 openCnt--;
59 }
60 return 0;
61}
62
63static int gio_ioctl(struct inode *inode, struct file *filp,
64 unsigned int cmd, unsigned long arg)
65{
66 unsigned int data;
67 static unsigned int addr = 0;
68
69 if (cmd & 0x01) { /* write */
70 if (copy_from_user(&data, (int *)arg, sizeof(int))) {
71 return -EFAULT;
72 }
73 }
74
75 switch (cmd) {
76 case GIODRV_IOCSGIOSETADDR: /* address set */
77 addr = data;
78 break;
79
80 case GIODRV_IOCSGIODATA1: /* write byte */
81 ctrl_outb((unsigned char)(0x0ff & data), addr);
82 break;
83
84 case GIODRV_IOCSGIODATA2: /* write word */
85 if (addr & 0x01) {
86 return -EFAULT;
87 }
88 ctrl_outw((unsigned short int)(0x0ffff & data), addr);
89 break;
90
91 case GIODRV_IOCSGIODATA4: /* write long */
92 if (addr & 0x03) {
93 return -EFAULT;
94 }
95 ctrl_outl(data, addr);
96 break;
97
98 case GIODRV_IOCGGIODATA1: /* read byte */
99 data = ctrl_inb(addr);
100 break;
101
102 case GIODRV_IOCGGIODATA2: /* read word */
103 if (addr & 0x01) {
104 return -EFAULT;
105 }
106 data = ctrl_inw(addr);
107 break;
108
109 case GIODRV_IOCGGIODATA4: /* read long */
110 if (addr & 0x03) {
111 return -EFAULT;
112 }
113 data = ctrl_inl(addr);
114 break;
115 default:
116 return -EFAULT;
117 break;
118 }
119
120 if ((cmd & 0x01) == 0) { /* read */
121 if (copy_to_user((int *)arg, &data, sizeof(int))) {
122 return -EFAULT;
123 }
124 }
125 return 0;
126}
127
128static const struct file_operations gio_fops = {
129 .owner = THIS_MODULE,
130 .open = gio_open, /* open */
131 .release = gio_close, /* release */
132 .ioctl = gio_ioctl, /* ioctl */
133};
134
135static int __init gio_init(void)
136{
137 int error;
138
139 printk(KERN_INFO "gio: driver initialized\n");
140
141 openCnt = 0;
142
143 if ((error = alloc_chrdev_region(&dev, 0, DEVCOUNT, "gio")) < 0) {
144 printk(KERN_ERR
145 "gio: Couldn't alloc_chrdev_region, error=%d\n",
146 error);
147 return 1;
148 }
149
150 cdev_p = cdev_alloc();
151 cdev_p->ops = &gio_fops;
152 error = cdev_add(cdev_p, dev, DEVCOUNT);
153 if (error) {
154 printk(KERN_ERR
155 "gio: Couldn't cdev_add, error=%d\n", error);
156 return 1;
157 }
158
159 return 0;
160}
161
162static void __exit gio_exit(void)
163{
164 cdev_del(cdev_p);
165 unregister_chrdev_region(dev, DEVCOUNT);
166}
167
168module_init(gio_init);
169module_exit(gio_exit);
170
171MODULE_LICENSE("GPL");
diff --git a/arch/sh/boards/mach-landisk/irq.c b/arch/sh/boards/mach-landisk/irq.c
new file mode 100644
index 000000000000..7b284cde1f58
--- /dev/null
+++ b/arch/sh/boards/mach-landisk/irq.c
@@ -0,0 +1,56 @@
1/*
2 * arch/sh/boards/landisk/irq.c
3 *
4 * I-O DATA Device, Inc. LANDISK Support
5 *
6 * Copyright (C) 2005-2007 kogiidena
7 *
8 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
9 * Based largely on io_se.c.
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <linux/init.h>
16#include <linux/irq.h>
17#include <linux/interrupt.h>
18#include <linux/io.h>
19#include <mach-landisk/mach/iodata_landisk.h>
20
21static void disable_landisk_irq(unsigned int irq)
22{
23 unsigned char mask = 0xff ^ (0x01 << (irq - 5));
24
25 ctrl_outb(ctrl_inb(PA_IMASK) & mask, PA_IMASK);
26}
27
28static void enable_landisk_irq(unsigned int irq)
29{
30 unsigned char value = (0x01 << (irq - 5));
31
32 ctrl_outb(ctrl_inb(PA_IMASK) | value, PA_IMASK);
33}
34
35static struct irq_chip landisk_irq_chip __read_mostly = {
36 .name = "LANDISK",
37 .mask = disable_landisk_irq,
38 .unmask = enable_landisk_irq,
39 .mask_ack = disable_landisk_irq,
40};
41
42/*
43 * Initialize IRQ setting
44 */
45void __init init_landisk_IRQ(void)
46{
47 int i;
48
49 for (i = 5; i < 14; i++) {
50 disable_irq_nosync(i);
51 set_irq_chip_and_handler_name(i, &landisk_irq_chip,
52 handle_level_irq, "level");
53 enable_landisk_irq(i);
54 }
55 ctrl_outb(0x00, PA_PWRINT_CLR);
56}
diff --git a/arch/sh/boards/mach-landisk/psw.c b/arch/sh/boards/mach-landisk/psw.c
new file mode 100644
index 000000000000..e6b0efa098d1
--- /dev/null
+++ b/arch/sh/boards/mach-landisk/psw.c
@@ -0,0 +1,143 @@
1/*
2 * arch/sh/boards/landisk/psw.c
3 *
4 * push switch support for LANDISK and USL-5P
5 *
6 * Copyright (C) 2006-2007 Paul Mundt
7 * Copyright (C) 2007 kogiidena
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13#include <linux/io.h>
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <linux/platform_device.h>
17#include <mach-landisk/mach/iodata_landisk.h>
18#include <asm/push-switch.h>
19
20static irqreturn_t psw_irq_handler(int irq, void *arg)
21{
22 struct platform_device *pdev = arg;
23 struct push_switch *psw = platform_get_drvdata(pdev);
24 struct push_switch_platform_info *psw_info = pdev->dev.platform_data;
25 unsigned int sw_value;
26 int ret = 0;
27
28 sw_value = (0x0ff & (~ctrl_inb(PA_STATUS)));
29
30 /* Nothing to do if there's no state change */
31 if (psw->state) {
32 ret = 1;
33 goto out;
34 }
35
36 /* Figure out who raised it */
37 if (sw_value & (1 << psw_info->bit)) {
38 psw->state = 1;
39 mod_timer(&psw->debounce, jiffies + 50);
40 ret = 1;
41 }
42
43out:
44 /* Clear the switch IRQs */
45 ctrl_outb(0x00, PA_PWRINT_CLR);
46
47 return IRQ_RETVAL(ret);
48}
49
50static struct resource psw_power_resources[] = {
51 [0] = {
52 .start = IRQ_POWER,
53 .flags = IORESOURCE_IRQ,
54 },
55};
56
57static struct resource psw_usl5p_resources[] = {
58 [0] = {
59 .start = IRQ_BUTTON,
60 .flags = IORESOURCE_IRQ,
61 },
62};
63
64static struct push_switch_platform_info psw_power_platform_data = {
65 .name = "psw_power",
66 .bit = 4,
67 .irq_flags = IRQF_SHARED,
68 .irq_handler = psw_irq_handler,
69};
70
71static struct push_switch_platform_info psw1_platform_data = {
72 .name = "psw1",
73 .bit = 0,
74 .irq_flags = IRQF_SHARED,
75 .irq_handler = psw_irq_handler,
76};
77
78static struct push_switch_platform_info psw2_platform_data = {
79 .name = "psw2",
80 .bit = 2,
81 .irq_flags = IRQF_SHARED,
82 .irq_handler = psw_irq_handler,
83};
84
85static struct push_switch_platform_info psw3_platform_data = {
86 .name = "psw3",
87 .bit = 1,
88 .irq_flags = IRQF_SHARED,
89 .irq_handler = psw_irq_handler,
90};
91
92static struct platform_device psw_power_switch_device = {
93 .name = "push-switch",
94 .id = 0,
95 .num_resources = ARRAY_SIZE(psw_power_resources),
96 .resource = psw_power_resources,
97 .dev = {
98 .platform_data = &psw_power_platform_data,
99 },
100};
101
102static struct platform_device psw1_switch_device = {
103 .name = "push-switch",
104 .id = 1,
105 .num_resources = ARRAY_SIZE(psw_usl5p_resources),
106 .resource = psw_usl5p_resources,
107 .dev = {
108 .platform_data = &psw1_platform_data,
109 },
110};
111
112static struct platform_device psw2_switch_device = {
113 .name = "push-switch",
114 .id = 2,
115 .num_resources = ARRAY_SIZE(psw_usl5p_resources),
116 .resource = psw_usl5p_resources,
117 .dev = {
118 .platform_data = &psw2_platform_data,
119 },
120};
121
122static struct platform_device psw3_switch_device = {
123 .name = "push-switch",
124 .id = 3,
125 .num_resources = ARRAY_SIZE(psw_usl5p_resources),
126 .resource = psw_usl5p_resources,
127 .dev = {
128 .platform_data = &psw3_platform_data,
129 },
130};
131
132static struct platform_device *psw_devices[] = {
133 &psw_power_switch_device,
134 &psw1_switch_device,
135 &psw2_switch_device,
136 &psw3_switch_device,
137};
138
139static int __init psw_init(void)
140{
141 return platform_add_devices(psw_devices, ARRAY_SIZE(psw_devices));
142}
143module_init(psw_init);
diff --git a/arch/sh/boards/mach-landisk/setup.c b/arch/sh/boards/mach-landisk/setup.c
new file mode 100644
index 000000000000..db22ea2e6d49
--- /dev/null
+++ b/arch/sh/boards/mach-landisk/setup.c
@@ -0,0 +1,105 @@
1/*
2 * arch/sh/boards/landisk/setup.c
3 *
4 * I-O DATA Device, Inc. LANDISK Support.
5 *
6 * Copyright (C) 2000 Kazumoto Kojima
7 * Copyright (C) 2002 Paul Mundt
8 * Copylight (C) 2002 Atom Create Engineering Co., Ltd.
9 * Copyright (C) 2005-2007 kogiidena
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/ata_platform.h>
18#include <linux/pm.h>
19#include <linux/mm.h>
20#include <asm/machvec.h>
21#include <mach-landisk/mach/iodata_landisk.h>
22#include <asm/io.h>
23
24void init_landisk_IRQ(void);
25
26static void landisk_power_off(void)
27{
28 ctrl_outb(0x01, PA_SHUTDOWN);
29}
30
31static struct resource cf_ide_resources[3];
32
33static struct pata_platform_info pata_info = {
34 .ioport_shift = 1,
35};
36
37static struct platform_device cf_ide_device = {
38 .name = "pata_platform",
39 .id = -1,
40 .num_resources = ARRAY_SIZE(cf_ide_resources),
41 .resource = cf_ide_resources,
42 .dev = {
43 .platform_data = &pata_info,
44 },
45};
46
47static struct platform_device rtc_device = {
48 .name = "rs5c313",
49 .id = -1,
50};
51
52static struct platform_device *landisk_devices[] __initdata = {
53 &cf_ide_device,
54 &rtc_device,
55};
56
57static int __init landisk_devices_setup(void)
58{
59 pgprot_t prot;
60 unsigned long paddrbase;
61 void *cf_ide_base;
62
63 /* open I/O area window */
64 paddrbase = virt_to_phys((void *)PA_AREA5_IO);
65 prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
66 cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
67 if (!cf_ide_base) {
68 printk("allocate_cf_area : can't open CF I/O window!\n");
69 return -ENOMEM;
70 }
71
72 /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
73 cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40;
74 cf_ide_resources[0].end = (unsigned long)cf_ide_base + 0x40 + 0x0f;
75 cf_ide_resources[0].flags = IORESOURCE_IO;
76 cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c;
77 cf_ide_resources[1].end = (unsigned long)cf_ide_base + 0x2c + 0x03;
78 cf_ide_resources[1].flags = IORESOURCE_IO;
79 cf_ide_resources[2].start = IRQ_FATA;
80 cf_ide_resources[2].flags = IORESOURCE_IRQ;
81
82 return platform_add_devices(landisk_devices,
83 ARRAY_SIZE(landisk_devices));
84}
85
86__initcall(landisk_devices_setup);
87
88static void __init landisk_setup(char **cmdline_p)
89{
90 /* LED ON */
91 ctrl_outb(ctrl_inb(PA_LED) | 0x03, PA_LED);
92
93 printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
94 pm_power_off = landisk_power_off;
95}
96
97/*
98 * The Machine Vector
99 */
100static struct sh_machine_vector mv_landisk __initmv = {
101 .mv_name = "LANDISK",
102 .mv_nr_irqs = 72,
103 .mv_setup = landisk_setup,
104 .mv_init_irq = init_landisk_IRQ,
105};
diff --git a/arch/sh/boards/lboxre2/Makefile b/arch/sh/boards/mach-lboxre2/Makefile
index e9ed140c06f6..e9ed140c06f6 100644
--- a/arch/sh/boards/lboxre2/Makefile
+++ b/arch/sh/boards/mach-lboxre2/Makefile
diff --git a/arch/sh/boards/lboxre2/irq.c b/arch/sh/boards/mach-lboxre2/irq.c
index 5a1c3bbe7b50..5a1c3bbe7b50 100644
--- a/arch/sh/boards/lboxre2/irq.c
+++ b/arch/sh/boards/mach-lboxre2/irq.c
diff --git a/arch/sh/boards/lboxre2/setup.c b/arch/sh/boards/mach-lboxre2/setup.c
index c74440d38ee9..c74440d38ee9 100644
--- a/arch/sh/boards/lboxre2/setup.c
+++ b/arch/sh/boards/mach-lboxre2/setup.c
diff --git a/arch/sh/boards/superh/microdev/Makefile b/arch/sh/boards/mach-microdev/Makefile
index 1387dd6c85eb..1387dd6c85eb 100644
--- a/arch/sh/boards/superh/microdev/Makefile
+++ b/arch/sh/boards/mach-microdev/Makefile
diff --git a/arch/sh/boards/superh/microdev/io.c b/arch/sh/boards/mach-microdev/io.c
index 9f8a540f7e14..9f8a540f7e14 100644
--- a/arch/sh/boards/superh/microdev/io.c
+++ b/arch/sh/boards/mach-microdev/io.c
diff --git a/arch/sh/boards/superh/microdev/irq.c b/arch/sh/boards/mach-microdev/irq.c
index 4d335077a3ff..4d335077a3ff 100644
--- a/arch/sh/boards/superh/microdev/irq.c
+++ b/arch/sh/boards/mach-microdev/irq.c
diff --git a/arch/sh/boards/superh/microdev/led.c b/arch/sh/boards/mach-microdev/led.c
index 36e54b47a752..36e54b47a752 100644
--- a/arch/sh/boards/superh/microdev/led.c
+++ b/arch/sh/boards/mach-microdev/led.c
diff --git a/arch/sh/boards/superh/microdev/setup.c b/arch/sh/boards/mach-microdev/setup.c
index fc8cd06d66cf..fc8cd06d66cf 100644
--- a/arch/sh/boards/superh/microdev/setup.c
+++ b/arch/sh/boards/mach-microdev/setup.c
diff --git a/arch/sh/boards/mach-migor/Kconfig b/arch/sh/boards/mach-migor/Kconfig
new file mode 100644
index 000000000000..a7b3b728ec3c
--- /dev/null
+++ b/arch/sh/boards/mach-migor/Kconfig
@@ -0,0 +1,15 @@
1if SH_MIGOR
2
3choice
4 prompt "Migo-R LCD Panel Board Selection"
5 default SH_MIGOR_QVGA
6
7config SH_MIGOR_QVGA
8 bool "QVGA (320x240)"
9
10config SH_MIGOR_RTA_WVGA
11 bool "RTA WVGA (800x480)"
12
13endchoice
14
15endif
diff --git a/arch/sh/boards/mach-migor/Makefile b/arch/sh/boards/mach-migor/Makefile
new file mode 100644
index 000000000000..5f231dd25c0e
--- /dev/null
+++ b/arch/sh/boards/mach-migor/Makefile
@@ -0,0 +1,2 @@
1obj-y := setup.o
2obj-$(CONFIG_SH_MIGOR_QVGA) += lcd_qvga.o
diff --git a/arch/sh/boards/mach-migor/lcd_qvga.c b/arch/sh/boards/mach-migor/lcd_qvga.c
new file mode 100644
index 000000000000..6e9609596448
--- /dev/null
+++ b/arch/sh/boards/mach-migor/lcd_qvga.c
@@ -0,0 +1,165 @@
1/*
2 * Support for SuperH MigoR Quarter VGA LCD Panel
3 *
4 * Copyright (C) 2008 Magnus Damm
5 *
6 * Based on lcd_powertip.c from Kenati Technologies Pvt Ltd.
7 * Copyright (c) 2007 Ujjwal Pande <ujjwal@kenati.com>,
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/delay.h>
15#include <linux/err.h>
16#include <linux/fb.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <asm/sh_mobile_lcdc.h>
21#include <asm/migor.h>
22
23/* LCD Module is a PH240320T according to board schematics. This module
24 * is made up of a 240x320 LCD hooked up to a R61505U (or HX8347-A01?)
25 * Driver IC. This IC is connected to the SH7722 built-in LCDC using a
26 * SYS-80 interface configured in 16 bit mode.
27 *
28 * Index 0: "Device Code Read" returns 0x1505.
29 */
30
31static void reset_lcd_module(void)
32{
33 ctrl_outb(ctrl_inb(PORT_PHDR) & ~0x04, PORT_PHDR);
34 mdelay(2);
35 ctrl_outb(ctrl_inb(PORT_PHDR) | 0x04, PORT_PHDR);
36 mdelay(1);
37}
38
39/* DB0-DB7 are connected to D1-D8, and DB8-DB15 to D10-D17 */
40
41static unsigned long adjust_reg18(unsigned short data)
42{
43 unsigned long tmp1, tmp2;
44
45 tmp1 = (data<<1 | 0x00000001) & 0x000001FF;
46 tmp2 = (data<<2 | 0x00000200) & 0x0003FE00;
47 return tmp1 | tmp2;
48}
49
50static void write_reg(void *sys_ops_handle,
51 struct sh_mobile_lcdc_sys_bus_ops *sys_ops,
52 unsigned short reg, unsigned short data)
53{
54 sys_ops->write_index(sys_ops_handle, adjust_reg18(reg << 8 | data));
55}
56
57static void write_reg16(void *sys_ops_handle,
58 struct sh_mobile_lcdc_sys_bus_ops *sys_ops,
59 unsigned short reg, unsigned short data)
60{
61 sys_ops->write_index(sys_ops_handle, adjust_reg18(reg));
62 sys_ops->write_data(sys_ops_handle, adjust_reg18(data));
63}
64
65static unsigned long read_reg16(void *sys_ops_handle,
66 struct sh_mobile_lcdc_sys_bus_ops *sys_ops,
67 unsigned short reg)
68{
69 unsigned long data;
70
71 sys_ops->write_index(sys_ops_handle, adjust_reg18(reg));
72 data = sys_ops->read_data(sys_ops_handle);
73 return ((data >> 1) & 0xff) | ((data >> 2) & 0xff00);
74}
75
76static void migor_lcd_qvga_seq(void *sys_ops_handle,
77 struct sh_mobile_lcdc_sys_bus_ops *sys_ops,
78 unsigned short const *data, int no_data)
79{
80 int i;
81
82 for (i = 0; i < no_data; i += 2)
83 write_reg16(sys_ops_handle, sys_ops, data[i], data[i + 1]);
84}
85
86static const unsigned short sync_data[] = {
87 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
88};
89
90static const unsigned short magic0_data[] = {
91 0x0060, 0x2700, 0x0008, 0x0808, 0x0090, 0x001A, 0x0007, 0x0001,
92 0x0017, 0x0001, 0x0019, 0x0000, 0x0010, 0x17B0, 0x0011, 0x0116,
93 0x0012, 0x0198, 0x0013, 0x1400, 0x0029, 0x000C, 0x0012, 0x01B8,
94};
95
96static const unsigned short magic1_data[] = {
97 0x0030, 0x0307, 0x0031, 0x0303, 0x0032, 0x0603, 0x0033, 0x0202,
98 0x0034, 0x0202, 0x0035, 0x0202, 0x0036, 0x1F1F, 0x0037, 0x0303,
99 0x0038, 0x0303, 0x0039, 0x0603, 0x003A, 0x0202, 0x003B, 0x0102,
100 0x003C, 0x0204, 0x003D, 0x0000, 0x0001, 0x0100, 0x0002, 0x0300,
101 0x0003, 0x5028, 0x0020, 0x00ef, 0x0021, 0x0000, 0x0004, 0x0000,
102 0x0009, 0x0000, 0x000A, 0x0008, 0x000C, 0x0000, 0x000D, 0x0000,
103 0x0015, 0x8000,
104};
105
106static const unsigned short magic2_data[] = {
107 0x0061, 0x0001, 0x0092, 0x0100, 0x0093, 0x0001, 0x0007, 0x0021,
108};
109
110static const unsigned short magic3_data[] = {
111 0x0010, 0x16B0, 0x0011, 0x0111, 0x0007, 0x0061,
112};
113
114int migor_lcd_qvga_setup(void *board_data, void *sohandle,
115 struct sh_mobile_lcdc_sys_bus_ops *so)
116{
117 unsigned long xres = 320;
118 unsigned long yres = 240;
119 int k;
120
121 reset_lcd_module();
122 migor_lcd_qvga_seq(sohandle, so, sync_data, ARRAY_SIZE(sync_data));
123
124 if (read_reg16(sohandle, so, 0) != 0x1505)
125 return -ENODEV;
126
127 pr_info("Migo-R QVGA LCD Module detected.\n");
128
129 migor_lcd_qvga_seq(sohandle, so, sync_data, ARRAY_SIZE(sync_data));
130 write_reg16(sohandle, so, 0x00A4, 0x0001);
131 mdelay(10);
132
133 migor_lcd_qvga_seq(sohandle, so, magic0_data, ARRAY_SIZE(magic0_data));
134 mdelay(100);
135
136 migor_lcd_qvga_seq(sohandle, so, magic1_data, ARRAY_SIZE(magic1_data));
137 write_reg16(sohandle, so, 0x0050, 0xef - (yres - 1));
138 write_reg16(sohandle, so, 0x0051, 0x00ef);
139 write_reg16(sohandle, so, 0x0052, 0x0000);
140 write_reg16(sohandle, so, 0x0053, xres - 1);
141
142 migor_lcd_qvga_seq(sohandle, so, magic2_data, ARRAY_SIZE(magic2_data));
143 mdelay(10);
144
145 migor_lcd_qvga_seq(sohandle, so, magic3_data, ARRAY_SIZE(magic3_data));
146 mdelay(40);
147
148 /* clear GRAM to avoid displaying garbage */
149
150 write_reg16(sohandle, so, 0x0020, 0x0000); /* horiz addr */
151 write_reg16(sohandle, so, 0x0021, 0x0000); /* vert addr */
152
153 for (k = 0; k < (xres * 256); k++) /* yes, 256 words per line */
154 write_reg16(sohandle, so, 0x0022, 0x0000);
155
156 write_reg16(sohandle, so, 0x0020, 0x0000); /* reset horiz addr */
157 write_reg16(sohandle, so, 0x0021, 0x0000); /* reset vert addr */
158 write_reg16(sohandle, so, 0x0007, 0x0173);
159 mdelay(40);
160
161 /* enable display */
162 write_reg(sohandle, so, 0x00, 0x22);
163 mdelay(100);
164 return 0;
165}
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
new file mode 100644
index 000000000000..e499ee384d58
--- /dev/null
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -0,0 +1,527 @@
1/*
2 * Renesas System Solutions Asia Pte. Ltd - Migo-R
3 *
4 * Copyright (C) 2008 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/interrupt.h>
13#include <linux/input.h>
14#include <linux/mtd/physmap.h>
15#include <linux/mtd/nand.h>
16#include <linux/i2c.h>
17#include <linux/smc91x.h>
18#include <linux/delay.h>
19#include <linux/clk.h>
20#include <media/soc_camera_platform.h>
21#include <media/sh_mobile_ceu.h>
22#include <asm/clock.h>
23#include <asm/machvec.h>
24#include <asm/io.h>
25#include <asm/sh_keysc.h>
26#include <asm/sh_mobile_lcdc.h>
27#include <asm/migor.h>
28
29/* Address IRQ Size Bus Description
30 * 0x00000000 64MB 16 NOR Flash (SP29PL256N)
31 * 0x0c000000 64MB 64 SDRAM (2xK4M563233G)
32 * 0x10000000 IRQ0 16 Ethernet (SMC91C111)
33 * 0x14000000 IRQ4 16 USB 2.0 Host Controller (M66596)
34 * 0x18000000 8GB 8 NAND Flash (K9K8G08U0A)
35 */
36
37static struct smc91x_platdata smc91x_info = {
38 .flags = SMC91X_USE_16BIT,
39};
40
41static struct resource smc91x_eth_resources[] = {
42 [0] = {
43 .name = "SMC91C111" ,
44 .start = 0x10000300,
45 .end = 0x1000030f,
46 .flags = IORESOURCE_MEM,
47 },
48 [1] = {
49 .start = 32, /* IRQ0 */
50 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
51 },
52};
53
54static struct platform_device smc91x_eth_device = {
55 .name = "smc91x",
56 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
57 .resource = smc91x_eth_resources,
58 .dev = {
59 .platform_data = &smc91x_info,
60 },
61};
62
63static struct sh_keysc_info sh_keysc_info = {
64 .mode = SH_KEYSC_MODE_2, /* KEYOUT0->4, KEYIN1->5 */
65 .scan_timing = 3,
66 .delay = 5,
67 .keycodes = {
68 0, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_ENTER,
69 0, KEY_F, KEY_C, KEY_D, KEY_H, KEY_1,
70 0, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6,
71 0, KEY_7, KEY_8, KEY_9, KEY_S, KEY_0,
72 0, KEY_P, KEY_STOP, KEY_REWIND, KEY_PLAY, KEY_FASTFORWARD,
73 },
74};
75
76static struct resource sh_keysc_resources[] = {
77 [0] = {
78 .start = 0x044b0000,
79 .end = 0x044b000f,
80 .flags = IORESOURCE_MEM,
81 },
82 [1] = {
83 .start = 79,
84 .flags = IORESOURCE_IRQ,
85 },
86};
87
88static struct platform_device sh_keysc_device = {
89 .name = "sh_keysc",
90 .num_resources = ARRAY_SIZE(sh_keysc_resources),
91 .resource = sh_keysc_resources,
92 .dev = {
93 .platform_data = &sh_keysc_info,
94 },
95};
96
97static struct mtd_partition migor_nor_flash_partitions[] =
98{
99 {
100 .name = "uboot",
101 .offset = 0,
102 .size = (1 * 1024 * 1024),
103 .mask_flags = MTD_WRITEABLE, /* Read-only */
104 },
105 {
106 .name = "rootfs",
107 .offset = MTDPART_OFS_APPEND,
108 .size = (15 * 1024 * 1024),
109 },
110 {
111 .name = "other",
112 .offset = MTDPART_OFS_APPEND,
113 .size = MTDPART_SIZ_FULL,
114 },
115};
116
117static struct physmap_flash_data migor_nor_flash_data = {
118 .width = 2,
119 .parts = migor_nor_flash_partitions,
120 .nr_parts = ARRAY_SIZE(migor_nor_flash_partitions),
121};
122
123static struct resource migor_nor_flash_resources[] = {
124 [0] = {
125 .name = "NOR Flash",
126 .start = 0x00000000,
127 .end = 0x03ffffff,
128 .flags = IORESOURCE_MEM,
129 }
130};
131
132static struct platform_device migor_nor_flash_device = {
133 .name = "physmap-flash",
134 .resource = migor_nor_flash_resources,
135 .num_resources = ARRAY_SIZE(migor_nor_flash_resources),
136 .dev = {
137 .platform_data = &migor_nor_flash_data,
138 },
139};
140
141static struct mtd_partition migor_nand_flash_partitions[] = {
142 {
143 .name = "nanddata1",
144 .offset = 0x0,
145 .size = 512 * 1024 * 1024,
146 },
147 {
148 .name = "nanddata2",
149 .offset = MTDPART_OFS_APPEND,
150 .size = 512 * 1024 * 1024,
151 },
152};
153
154static void migor_nand_flash_cmd_ctl(struct mtd_info *mtd, int cmd,
155 unsigned int ctrl)
156{
157 struct nand_chip *chip = mtd->priv;
158
159 if (cmd == NAND_CMD_NONE)
160 return;
161
162 if (ctrl & NAND_CLE)
163 writeb(cmd, chip->IO_ADDR_W + 0x00400000);
164 else if (ctrl & NAND_ALE)
165 writeb(cmd, chip->IO_ADDR_W + 0x00800000);
166 else
167 writeb(cmd, chip->IO_ADDR_W);
168}
169
170static int migor_nand_flash_ready(struct mtd_info *mtd)
171{
172 return ctrl_inb(PORT_PADR) & 0x02; /* PTA1 */
173}
174
175struct platform_nand_data migor_nand_flash_data = {
176 .chip = {
177 .nr_chips = 1,
178 .partitions = migor_nand_flash_partitions,
179 .nr_partitions = ARRAY_SIZE(migor_nand_flash_partitions),
180 .chip_delay = 20,
181 .part_probe_types = (const char *[]) { "cmdlinepart", NULL },
182 },
183 .ctrl = {
184 .dev_ready = migor_nand_flash_ready,
185 .cmd_ctrl = migor_nand_flash_cmd_ctl,
186 },
187};
188
189static struct resource migor_nand_flash_resources[] = {
190 [0] = {
191 .name = "NAND Flash",
192 .start = 0x18000000,
193 .end = 0x18ffffff,
194 .flags = IORESOURCE_MEM,
195 },
196};
197
198static struct platform_device migor_nand_flash_device = {
199 .name = "gen_nand",
200 .resource = migor_nand_flash_resources,
201 .num_resources = ARRAY_SIZE(migor_nand_flash_resources),
202 .dev = {
203 .platform_data = &migor_nand_flash_data,
204 }
205};
206
207static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
208#ifdef CONFIG_SH_MIGOR_RTA_WVGA
209 .clock_source = LCDC_CLK_BUS,
210 .ch[0] = {
211 .chan = LCDC_CHAN_MAINLCD,
212 .bpp = 16,
213 .interface_type = RGB16,
214 .clock_divider = 2,
215 .lcd_cfg = {
216 .name = "LB070WV1",
217 .xres = 800,
218 .yres = 480,
219 .left_margin = 64,
220 .right_margin = 16,
221 .hsync_len = 120,
222 .upper_margin = 1,
223 .lower_margin = 17,
224 .vsync_len = 2,
225 .sync = 0,
226 },
227 }
228#endif
229#ifdef CONFIG_SH_MIGOR_QVGA
230 .clock_source = LCDC_CLK_PERIPHERAL,
231 .ch[0] = {
232 .chan = LCDC_CHAN_MAINLCD,
233 .bpp = 16,
234 .interface_type = SYS16A,
235 .clock_divider = 10,
236 .lcd_cfg = {
237 .name = "PH240320T",
238 .xres = 320,
239 .yres = 240,
240 .left_margin = 0,
241 .right_margin = 16,
242 .hsync_len = 8,
243 .upper_margin = 1,
244 .lower_margin = 17,
245 .vsync_len = 2,
246 .sync = FB_SYNC_HOR_HIGH_ACT,
247 },
248 .board_cfg = {
249 .setup_sys = migor_lcd_qvga_setup,
250 },
251 .sys_bus_cfg = {
252 .ldmt2r = 0x06000a09,
253 .ldmt3r = 0x180e3418,
254 },
255 }
256#endif
257};
258
259static struct resource migor_lcdc_resources[] = {
260 [0] = {
261 .name = "LCDC",
262 .start = 0xfe940000, /* P4-only space */
263 .end = 0xfe941fff,
264 .flags = IORESOURCE_MEM,
265 },
266};
267
268static struct platform_device migor_lcdc_device = {
269 .name = "sh_mobile_lcdc_fb",
270 .num_resources = ARRAY_SIZE(migor_lcdc_resources),
271 .resource = migor_lcdc_resources,
272 .dev = {
273 .platform_data = &sh_mobile_lcdc_info,
274 },
275};
276
277static struct clk *camera_clk;
278
279static void camera_power_on(void)
280{
281 unsigned char value;
282
283 camera_clk = clk_get(NULL, "video_clk");
284 clk_set_rate(camera_clk, 24000000);
285 clk_enable(camera_clk); /* start VIO_CKO */
286
287 mdelay(10);
288 value = ctrl_inb(PORT_PTDR);
289 value &= ~0x09;
290#ifndef CONFIG_SH_MIGOR_RTA_WVGA
291 value |= 0x01;
292#endif
293 ctrl_outb(value, PORT_PTDR);
294 mdelay(10);
295
296 ctrl_outb(value | 8, PORT_PTDR);
297}
298
299static void camera_power_off(void)
300{
301 clk_disable(camera_clk); /* stop VIO_CKO */
302 clk_put(camera_clk);
303
304 ctrl_outb(ctrl_inb(PORT_PTDR) & ~0x08, PORT_PTDR);
305}
306
307#ifdef CONFIG_I2C
308static unsigned char camera_ov772x_magic[] =
309{
310 0x09, 0x01, 0x0c, 0x10, 0x0d, 0x41, 0x0e, 0x01,
311 0x12, 0x00, 0x13, 0x8F, 0x14, 0x4A, 0x15, 0x00,
312 0x16, 0x00, 0x17, 0x23, 0x18, 0xa0, 0x19, 0x07,
313 0x1a, 0xf0, 0x1b, 0x40, 0x1f, 0x00, 0x20, 0x10,
314 0x22, 0xff, 0x23, 0x01, 0x28, 0x00, 0x29, 0xa0,
315 0x2a, 0x00, 0x2b, 0x00, 0x2c, 0xf0, 0x2d, 0x00,
316 0x2e, 0x00, 0x30, 0x80, 0x31, 0x60, 0x32, 0x00,
317 0x33, 0x00, 0x34, 0x00, 0x3d, 0x80, 0x3e, 0xe2,
318 0x3f, 0x1f, 0x42, 0x80, 0x43, 0x80, 0x44, 0x80,
319 0x45, 0x80, 0x46, 0x00, 0x47, 0x00, 0x48, 0x00,
320 0x49, 0x50, 0x4a, 0x30, 0x4b, 0x50, 0x4c, 0x50,
321 0x4d, 0x00, 0x4e, 0xef, 0x4f, 0x10, 0x50, 0x60,
322 0x51, 0x00, 0x52, 0x00, 0x53, 0x24, 0x54, 0x7a,
323 0x55, 0xfc, 0x62, 0xff, 0x63, 0xf0, 0x64, 0x1f,
324 0x65, 0x00, 0x66, 0x10, 0x67, 0x00, 0x68, 0x00,
325 0x69, 0x5c, 0x6a, 0x11, 0x6b, 0xa2, 0x6c, 0x01,
326 0x6d, 0x50, 0x6e, 0x80, 0x6f, 0x80, 0x70, 0x0f,
327 0x71, 0x00, 0x72, 0x00, 0x73, 0x0f, 0x74, 0x0f,
328 0x75, 0xff, 0x78, 0x10, 0x79, 0x70, 0x7a, 0x70,
329 0x7b, 0xf0, 0x7c, 0xf0, 0x7d, 0xf0, 0x7e, 0x0e,
330 0x7f, 0x1a, 0x80, 0x31, 0x81, 0x5a, 0x82, 0x69,
331 0x83, 0x75, 0x84, 0x7e, 0x85, 0x88, 0x86, 0x8f,
332 0x87, 0x96, 0x88, 0xa3, 0x89, 0xaf, 0x8a, 0xc4,
333 0x8b, 0xd7, 0x8c, 0xe8, 0x8d, 0x20, 0x8e, 0x00,
334 0x8f, 0x00, 0x90, 0x08, 0x91, 0x10, 0x92, 0x1f,
335 0x93, 0x01, 0x94, 0x2c, 0x95, 0x24, 0x96, 0x08,
336 0x97, 0x14, 0x98, 0x24, 0x99, 0x38, 0x9a, 0x9e,
337 0x9b, 0x00, 0x9c, 0x40, 0x9e, 0x11, 0x9f, 0x02,
338 0xa0, 0x00, 0xa1, 0x40, 0xa2, 0x40, 0xa3, 0x06,
339 0xa4, 0x00, 0xa6, 0x00, 0xa7, 0x40, 0xa8, 0x40,
340 0xa9, 0x80, 0xaa, 0x80, 0xab, 0x06, 0xac, 0xff,
341 0x12, 0x06, 0x64, 0x3f, 0x12, 0x46, 0x17, 0x3f,
342 0x18, 0x50, 0x19, 0x03, 0x1a, 0x78, 0x29, 0x50,
343 0x2c, 0x78,
344};
345
346static int ov772x_set_capture(struct soc_camera_platform_info *info,
347 int enable)
348{
349 struct i2c_adapter *a = i2c_get_adapter(0);
350 struct i2c_msg msg;
351 int ret = 0;
352 int i;
353
354 if (!enable)
355 return 0; /* camera_power_off() is enough */
356
357 for (i = 0; i < ARRAY_SIZE(camera_ov772x_magic); i += 2) {
358 u_int8_t buf[8];
359
360 msg.addr = 0x21;
361 msg.buf = buf;
362 msg.len = 2;
363 msg.flags = 0;
364
365 buf[0] = camera_ov772x_magic[i];
366 buf[1] = camera_ov772x_magic[i + 1];
367
368 ret = (ret < 0) ? ret : i2c_transfer(a, &msg, 1);
369 }
370
371 return ret;
372}
373
374static struct soc_camera_platform_info ov772x_info = {
375 .iface = 0,
376 .format_name = "RGB565",
377 .format_depth = 16,
378 .format = {
379 .pixelformat = V4L2_PIX_FMT_RGB565,
380 .colorspace = V4L2_COLORSPACE_SRGB,
381 .width = 320,
382 .height = 240,
383 },
384 .bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
385 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8,
386 .set_capture = ov772x_set_capture,
387};
388
389static struct platform_device migor_camera_device = {
390 .name = "soc_camera_platform",
391 .dev = {
392 .platform_data = &ov772x_info,
393 },
394};
395#endif /* CONFIG_I2C */
396
397static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
398 .flags = SOCAM_MASTER | SOCAM_DATAWIDTH_8 | SOCAM_PCLK_SAMPLE_RISING \
399 | SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH,
400 .enable_camera = camera_power_on,
401 .disable_camera = camera_power_off,
402};
403
404static struct resource migor_ceu_resources[] = {
405 [0] = {
406 .name = "CEU",
407 .start = 0xfe910000,
408 .end = 0xfe91009f,
409 .flags = IORESOURCE_MEM,
410 },
411 [1] = {
412 .start = 52,
413 .flags = IORESOURCE_IRQ,
414 },
415 [2] = {
416 /* place holder for contiguous memory */
417 },
418};
419
420static struct platform_device migor_ceu_device = {
421 .name = "sh_mobile_ceu",
422 .num_resources = ARRAY_SIZE(migor_ceu_resources),
423 .resource = migor_ceu_resources,
424 .dev = {
425 .platform_data = &sh_mobile_ceu_info,
426 },
427};
428
429static struct platform_device *migor_devices[] __initdata = {
430 &smc91x_eth_device,
431 &sh_keysc_device,
432 &migor_lcdc_device,
433 &migor_ceu_device,
434#ifdef CONFIG_I2C
435 &migor_camera_device,
436#endif
437 &migor_nor_flash_device,
438 &migor_nand_flash_device,
439};
440
441static struct i2c_board_info migor_i2c_devices[] = {
442 {
443 I2C_BOARD_INFO("rs5c372b", 0x32),
444 },
445 {
446 I2C_BOARD_INFO("migor_ts", 0x51),
447 .irq = 38, /* IRQ6 */
448 },
449};
450
451static int __init migor_devices_setup(void)
452{
453 clk_always_enable("mstp214"); /* KEYSC */
454 clk_always_enable("mstp200"); /* LCDC */
455 clk_always_enable("mstp203"); /* CEU */
456
457 platform_resource_setup_memory(&migor_ceu_device, "ceu", 4 << 20);
458
459 i2c_register_board_info(0, migor_i2c_devices,
460 ARRAY_SIZE(migor_i2c_devices));
461
462 return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices));
463}
464__initcall(migor_devices_setup);
465
466static void __init migor_setup(char **cmdline_p)
467{
468 /* SMC91C111 - Enable IRQ0 */
469 ctrl_outw(ctrl_inw(PORT_PJCR) & ~0x0003, PORT_PJCR);
470
471 /* KEYSC */
472 ctrl_outw(ctrl_inw(PORT_PYCR) & ~0x0fff, PORT_PYCR);
473 ctrl_outw(ctrl_inw(PORT_PZCR) & ~0x0ff0, PORT_PZCR);
474 ctrl_outw(ctrl_inw(PORT_PSELA) & ~0x4100, PORT_PSELA);
475 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
476 ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
477
478 /* NAND Flash */
479 ctrl_outw(ctrl_inw(PORT_PXCR) & 0x0fff, PORT_PXCR);
480 ctrl_outl((ctrl_inl(BSC_CS6ABCR) & ~0x00000600) | 0x00000200,
481 BSC_CS6ABCR);
482
483 /* Touch Panel - Enable IRQ6 */
484 ctrl_outw(ctrl_inw(PORT_PZCR) & ~0xc, PORT_PZCR);
485 ctrl_outw((ctrl_inw(PORT_PSELA) | 0x8000), PORT_PSELA);
486 ctrl_outw((ctrl_inw(PORT_HIZCRC) & ~0x4000), PORT_HIZCRC);
487
488#ifdef CONFIG_SH_MIGOR_RTA_WVGA
489 /* LCDC - WVGA - Enable RGB Interface signals */
490 ctrl_outw(ctrl_inw(PORT_PACR) & ~0x0003, PORT_PACR);
491 ctrl_outw(0x0000, PORT_PHCR);
492 ctrl_outw(0x0000, PORT_PLCR);
493 ctrl_outw(0x0000, PORT_PMCR);
494 ctrl_outw(ctrl_inw(PORT_PRCR) & ~0x000f, PORT_PRCR);
495 ctrl_outw((ctrl_inw(PORT_PSELD) & ~0x000d) | 0x0400, PORT_PSELD);
496 ctrl_outw(ctrl_inw(PORT_MSELCRB) & ~0x0100, PORT_MSELCRB);
497 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x01e0, PORT_HIZCRA);
498#endif
499#ifdef CONFIG_SH_MIGOR_QVGA
500 /* LCDC - QVGA - Enable SYS Interface signals */
501 ctrl_outw(ctrl_inw(PORT_PACR) & ~0x0003, PORT_PACR);
502 ctrl_outw((ctrl_inw(PORT_PHCR) & ~0xcfff) | 0x0010, PORT_PHCR);
503 ctrl_outw(0x0000, PORT_PLCR);
504 ctrl_outw(0x0000, PORT_PMCR);
505 ctrl_outw(ctrl_inw(PORT_PRCR) & ~0x030f, PORT_PRCR);
506 ctrl_outw((ctrl_inw(PORT_PSELD) & ~0x0001) | 0x0420, PORT_PSELD);
507 ctrl_outw(ctrl_inw(PORT_MSELCRB) | 0x0100, PORT_MSELCRB);
508 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x01e0, PORT_HIZCRA);
509#endif
510
511 /* CEU */
512 ctrl_outw((ctrl_inw(PORT_PTCR) & ~0x03c3) | 0x0051, PORT_PTCR);
513 ctrl_outw(ctrl_inw(PORT_PUCR) & ~0x03ff, PORT_PUCR);
514 ctrl_outw(ctrl_inw(PORT_PVCR) & ~0x03ff, PORT_PVCR);
515 ctrl_outw(ctrl_inw(PORT_PWCR) & ~0x3c00, PORT_PWCR);
516 ctrl_outw(ctrl_inw(PORT_PSELC) | 0x0001, PORT_PSELC);
517 ctrl_outw(ctrl_inw(PORT_PSELD) & ~0x2000, PORT_PSELD);
518 ctrl_outw(ctrl_inw(PORT_PSELE) | 0x000f, PORT_PSELE);
519 ctrl_outw(ctrl_inw(PORT_MSELCRB) | 0x2200, PORT_MSELCRB);
520 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x0a00, PORT_HIZCRA);
521 ctrl_outw(ctrl_inw(PORT_HIZCRB) & ~0x0003, PORT_HIZCRB);
522}
523
524static struct sh_machine_vector mv_migor __initmv = {
525 .mv_name = "Migo-R",
526 .mv_setup = migor_setup,
527};
diff --git a/arch/sh/boards/renesas/rts7751r2d/Kconfig b/arch/sh/boards/mach-r2d/Kconfig
index 8122a9667fc9..8122a9667fc9 100644
--- a/arch/sh/boards/renesas/rts7751r2d/Kconfig
+++ b/arch/sh/boards/mach-r2d/Kconfig
diff --git a/arch/sh/boards/renesas/rts7751r2d/Makefile b/arch/sh/boards/mach-r2d/Makefile
index 0d4c75a72be0..0d4c75a72be0 100644
--- a/arch/sh/boards/renesas/rts7751r2d/Makefile
+++ b/arch/sh/boards/mach-r2d/Makefile
diff --git a/arch/sh/boards/renesas/rts7751r2d/irq.c b/arch/sh/boards/mach-r2d/irq.c
index 8e49f6e51247..8e49f6e51247 100644
--- a/arch/sh/boards/renesas/rts7751r2d/irq.c
+++ b/arch/sh/boards/mach-r2d/irq.c
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/mach-r2d/setup.c
index 2308e8753bcd..2308e8753bcd 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/mach-r2d/setup.c
diff --git a/arch/sh/boards/renesas/sdk7780/Kconfig b/arch/sh/boards/mach-sdk7780/Kconfig
index 065f1df09bf1..065f1df09bf1 100644
--- a/arch/sh/boards/renesas/sdk7780/Kconfig
+++ b/arch/sh/boards/mach-sdk7780/Kconfig
diff --git a/arch/sh/boards/renesas/sdk7780/Makefile b/arch/sh/boards/mach-sdk7780/Makefile
index 3d8f0befc35d..3d8f0befc35d 100644
--- a/arch/sh/boards/renesas/sdk7780/Makefile
+++ b/arch/sh/boards/mach-sdk7780/Makefile
diff --git a/arch/sh/boards/renesas/sdk7780/irq.c b/arch/sh/boards/mach-sdk7780/irq.c
index 87cdc578f6ff..87cdc578f6ff 100644
--- a/arch/sh/boards/renesas/sdk7780/irq.c
+++ b/arch/sh/boards/mach-sdk7780/irq.c
diff --git a/arch/sh/boards/renesas/sdk7780/setup.c b/arch/sh/boards/mach-sdk7780/setup.c
index acc5932587f1..acc5932587f1 100644
--- a/arch/sh/boards/renesas/sdk7780/setup.c
+++ b/arch/sh/boards/mach-sdk7780/setup.c
diff --git a/arch/sh/boards/se/7206/Makefile b/arch/sh/boards/mach-se/7206/Makefile
index 63e7ed699f39..63e7ed699f39 100644
--- a/arch/sh/boards/se/7206/Makefile
+++ b/arch/sh/boards/mach-se/7206/Makefile
diff --git a/arch/sh/boards/mach-se/7206/io.c b/arch/sh/boards/mach-se/7206/io.c
new file mode 100644
index 000000000000..9c3a33210d61
--- /dev/null
+++ b/arch/sh/boards/mach-se/7206/io.c
@@ -0,0 +1,104 @@
1/* $Id: io.c,v 1.5 2004/02/22 23:08:43 kkojima Exp $
2 *
3 * linux/arch/sh/boards/se/7206/io.c
4 *
5 * Copyright (C) 2006 Yoshinori Sato
6 *
7 * I/O routine for Hitachi 7206 SolutionEngine.
8 *
9 */
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <asm/io.h>
14#include <mach-se/mach/se7206.h>
15
16
17static inline void delay(void)
18{
19 ctrl_inw(0x20000000); /* P2 ROM Area */
20}
21
22/* MS7750 requires special versions of in*, out* routines, since
23 PC-like io ports are located at upper half byte of 16-bit word which
24 can be accessed only with 16-bit wide. */
25
26static inline volatile __u16 *
27port2adr(unsigned int port)
28{
29 if (port >= 0x2000 && port < 0x2020)
30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
31 else if (port >= 0x300 && port < 0x310)
32 return (volatile __u16 *) (PA_SMSC + (port - 0x300));
33
34 return (volatile __u16 *)port;
35}
36
37unsigned char se7206_inb(unsigned long port)
38{
39 return (*port2adr(port)) & 0xff;
40}
41
42unsigned char se7206_inb_p(unsigned long port)
43{
44 unsigned long v;
45
46 v = (*port2adr(port)) & 0xff;
47 delay();
48 return v;
49}
50
51unsigned short se7206_inw(unsigned long port)
52{
53 return *port2adr(port);;
54}
55
56void se7206_outb(unsigned char value, unsigned long port)
57{
58 *(port2adr(port)) = value;
59}
60
61void se7206_outb_p(unsigned char value, unsigned long port)
62{
63 *(port2adr(port)) = value;
64 delay();
65}
66
67void se7206_outw(unsigned short value, unsigned long port)
68{
69 *port2adr(port) = value;
70}
71
72void se7206_insb(unsigned long port, void *addr, unsigned long count)
73{
74 volatile __u16 *p = port2adr(port);
75 __u8 *ap = addr;
76
77 while (count--)
78 *ap++ = *p;
79}
80
81void se7206_insw(unsigned long port, void *addr, unsigned long count)
82{
83 volatile __u16 *p = port2adr(port);
84 __u16 *ap = addr;
85 while (count--)
86 *ap++ = *p;
87}
88
89void se7206_outsb(unsigned long port, const void *addr, unsigned long count)
90{
91 volatile __u16 *p = port2adr(port);
92 const __u8 *ap = addr;
93
94 while (count--)
95 *p = *ap++;
96}
97
98void se7206_outsw(unsigned long port, const void *addr, unsigned long count)
99{
100 volatile __u16 *p = port2adr(port);
101 const __u16 *ap = addr;
102 while (count--)
103 *p = *ap++;
104}
diff --git a/arch/sh/boards/mach-se/7206/irq.c b/arch/sh/boards/mach-se/7206/irq.c
new file mode 100644
index 000000000000..aef7f052851a
--- /dev/null
+++ b/arch/sh/boards/mach-se/7206/irq.c
@@ -0,0 +1,146 @@
1/*
2 * linux/arch/sh/boards/se/7206/irq.c
3 *
4 * Copyright (C) 2005,2006 Yoshinori Sato
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 */
9#include <linux/init.h>
10#include <linux/irq.h>
11#include <linux/io.h>
12#include <linux/interrupt.h>
13#include <mach-se/mach/se7206.h>
14
15#define INTSTS0 0x31800000
16#define INTSTS1 0x31800002
17#define INTMSK0 0x31800004
18#define INTMSK1 0x31800006
19#define INTSEL 0x31800008
20
21#define IRQ0_IRQ 64
22#define IRQ1_IRQ 65
23#define IRQ3_IRQ 67
24
25#define INTC_IPR01 0xfffe0818
26#define INTC_ICR1 0xfffe0802
27
28static void disable_se7206_irq(unsigned int irq)
29{
30 unsigned short val;
31 unsigned short mask = 0xffff ^ (0x0f << 4 * (3 - (IRQ0_IRQ - irq)));
32 unsigned short msk0,msk1;
33
34 /* Set the priority in IPR to 0 */
35 val = ctrl_inw(INTC_IPR01);
36 val &= mask;
37 ctrl_outw(val, INTC_IPR01);
38 /* FPGA mask set */
39 msk0 = ctrl_inw(INTMSK0);
40 msk1 = ctrl_inw(INTMSK1);
41
42 switch (irq) {
43 case IRQ0_IRQ:
44 msk0 |= 0x0010;
45 break;
46 case IRQ1_IRQ:
47 msk0 |= 0x000f;
48 break;
49 case IRQ3_IRQ:
50 msk0 |= 0x0f00;
51 msk1 |= 0x00ff;
52 break;
53 }
54 ctrl_outw(msk0, INTMSK0);
55 ctrl_outw(msk1, INTMSK1);
56}
57
58static void enable_se7206_irq(unsigned int irq)
59{
60 unsigned short val;
61 unsigned short value = (0x0001 << 4 * (3 - (IRQ0_IRQ - irq)));
62 unsigned short msk0,msk1;
63
64 /* Set priority in IPR back to original value */
65 val = ctrl_inw(INTC_IPR01);
66 val |= value;
67 ctrl_outw(val, INTC_IPR01);
68
69 /* FPGA mask reset */
70 msk0 = ctrl_inw(INTMSK0);
71 msk1 = ctrl_inw(INTMSK1);
72
73 switch (irq) {
74 case IRQ0_IRQ:
75 msk0 &= ~0x0010;
76 break;
77 case IRQ1_IRQ:
78 msk0 &= ~0x000f;
79 break;
80 case IRQ3_IRQ:
81 msk0 &= ~0x0f00;
82 msk1 &= ~0x00ff;
83 break;
84 }
85 ctrl_outw(msk0, INTMSK0);
86 ctrl_outw(msk1, INTMSK1);
87}
88
89static void eoi_se7206_irq(unsigned int irq)
90{
91 unsigned short sts0,sts1;
92
93 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
94 enable_se7206_irq(irq);
95 /* FPGA isr clear */
96 sts0 = ctrl_inw(INTSTS0);
97 sts1 = ctrl_inw(INTSTS1);
98
99 switch (irq) {
100 case IRQ0_IRQ:
101 sts0 &= ~0x0010;
102 break;
103 case IRQ1_IRQ:
104 sts0 &= ~0x000f;
105 break;
106 case IRQ3_IRQ:
107 sts0 &= ~0x0f00;
108 sts1 &= ~0x00ff;
109 break;
110 }
111 ctrl_outw(sts0, INTSTS0);
112 ctrl_outw(sts1, INTSTS1);
113}
114
115static struct irq_chip se7206_irq_chip __read_mostly = {
116 .name = "SE7206-FPGA",
117 .mask = disable_se7206_irq,
118 .unmask = enable_se7206_irq,
119 .mask_ack = disable_se7206_irq,
120 .eoi = eoi_se7206_irq,
121};
122
123static void make_se7206_irq(unsigned int irq)
124{
125 disable_irq_nosync(irq);
126 set_irq_chip_and_handler_name(irq, &se7206_irq_chip,
127 handle_level_irq, "level");
128 disable_se7206_irq(irq);
129}
130
131/*
132 * Initialize IRQ setting
133 */
134void __init init_se7206_IRQ(void)
135{
136 make_se7206_irq(IRQ0_IRQ); /* SMC91C111 */
137 make_se7206_irq(IRQ1_IRQ); /* ATA */
138 make_se7206_irq(IRQ3_IRQ); /* SLOT / PCM */
139 ctrl_outw(inw(INTC_ICR1) | 0x000b ,INTC_ICR1 ) ; /* ICR1 */
140
141 /* FPGA System register setup*/
142 ctrl_outw(0x0000,INTSTS0); /* Clear INTSTS0 */
143 ctrl_outw(0x0000,INTSTS1); /* Clear INTSTS1 */
144 /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */
145 ctrl_outw(0x0001,INTSEL);
146}
diff --git a/arch/sh/boards/mach-se/7206/setup.c b/arch/sh/boards/mach-se/7206/setup.c
new file mode 100644
index 000000000000..f5466384972e
--- /dev/null
+++ b/arch/sh/boards/mach-se/7206/setup.c
@@ -0,0 +1,108 @@
1/*
2 *
3 * linux/arch/sh/boards/se/7206/setup.c
4 *
5 * Copyright (C) 2006 Yoshinori Sato
6 * Copyright (C) 2007 - 2008 Paul Mundt
7 *
8 * Hitachi 7206 SolutionEngine Support.
9 */
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/smc91x.h>
13#include <mach-se/mach/se7206.h>
14#include <asm/io.h>
15#include <asm/machvec.h>
16#include <asm/heartbeat.h>
17
18static struct resource smc91x_resources[] = {
19 [0] = {
20 .name = "smc91x-regs",
21 .start = PA_SMSC + 0x300,
22 .end = PA_SMSC + 0x300 + 0x020 - 1,
23 .flags = IORESOURCE_MEM,
24 },
25 [1] = {
26 .start = 64,
27 .end = 64,
28 .flags = IORESOURCE_IRQ,
29 },
30};
31
32static struct smc91x_platdata smc91x_info = {
33 .flags = SMC91X_USE_16BIT,
34};
35
36static struct platform_device smc91x_device = {
37 .name = "smc91x",
38 .id = -1,
39 .dev = {
40 .dma_mask = NULL,
41 .coherent_dma_mask = 0xffffffff,
42 .platform_data = &smc91x_info,
43 },
44 .num_resources = ARRAY_SIZE(smc91x_resources),
45 .resource = smc91x_resources,
46};
47
48static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
49
50static struct heartbeat_data heartbeat_data = {
51 .bit_pos = heartbeat_bit_pos,
52 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
53 .regsize = 32,
54};
55
56static struct resource heartbeat_resources[] = {
57 [0] = {
58 .start = PA_LED,
59 .end = PA_LED,
60 .flags = IORESOURCE_MEM,
61 },
62};
63
64static struct platform_device heartbeat_device = {
65 .name = "heartbeat",
66 .id = -1,
67 .dev = {
68 .platform_data = &heartbeat_data,
69 },
70 .num_resources = ARRAY_SIZE(heartbeat_resources),
71 .resource = heartbeat_resources,
72};
73
74static struct platform_device *se7206_devices[] __initdata = {
75 &smc91x_device,
76 &heartbeat_device,
77};
78
79static int __init se7206_devices_setup(void)
80{
81 return platform_add_devices(se7206_devices, ARRAY_SIZE(se7206_devices));
82}
83__initcall(se7206_devices_setup);
84
85/*
86 * The Machine Vector
87 */
88
89static struct sh_machine_vector mv_se __initmv = {
90 .mv_name = "SolutionEngine",
91 .mv_nr_irqs = 256,
92 .mv_inb = se7206_inb,
93 .mv_inw = se7206_inw,
94 .mv_outb = se7206_outb,
95 .mv_outw = se7206_outw,
96
97 .mv_inb_p = se7206_inb_p,
98 .mv_inw_p = se7206_inw,
99 .mv_outb_p = se7206_outb_p,
100 .mv_outw_p = se7206_outw,
101
102 .mv_insb = se7206_insb,
103 .mv_insw = se7206_insw,
104 .mv_outsb = se7206_outsb,
105 .mv_outsw = se7206_outsw,
106
107 .mv_init_irq = init_se7206_IRQ,
108};
diff --git a/arch/sh/boards/se/7343/Makefile b/arch/sh/boards/mach-se/7343/Makefile
index 3024796c6203..3024796c6203 100644
--- a/arch/sh/boards/se/7343/Makefile
+++ b/arch/sh/boards/mach-se/7343/Makefile
diff --git a/arch/sh/boards/mach-se/7343/io.c b/arch/sh/boards/mach-se/7343/io.c
new file mode 100644
index 000000000000..8741abc1da7b
--- /dev/null
+++ b/arch/sh/boards/mach-se/7343/io.c
@@ -0,0 +1,273 @@
1/*
2 * arch/sh/boards/se/7343/io.c
3 *
4 * I/O routine for SH-Mobile3AS 7343 SolutionEngine.
5 *
6 */
7#include <linux/kernel.h>
8#include <asm/io.h>
9#include <mach-se/mach/se7343.h>
10
11#define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a)
12
13struct iop {
14 unsigned long start, end;
15 unsigned long base;
16 struct iop *(*check) (struct iop * p, unsigned long port);
17 unsigned char (*inb) (struct iop * p, unsigned long port);
18 unsigned short (*inw) (struct iop * p, unsigned long port);
19 void (*outb) (struct iop * p, unsigned char value, unsigned long port);
20 void (*outw) (struct iop * p, unsigned short value, unsigned long port);
21};
22
23struct iop *
24simple_check(struct iop *p, unsigned long port)
25{
26 static int count;
27
28 if (count < 100)
29 count++;
30
31 port &= 0xFFFF;
32
33 if ((p->start <= port) && (port <= p->end))
34 return p;
35 else
36 badio(check, port);
37}
38
39struct iop *
40ide_check(struct iop *p, unsigned long port)
41{
42 if (((0x1f0 <= port) && (port <= 0x1f7)) || (port == 0x3f7))
43 return p;
44 return NULL;
45}
46
47unsigned char
48simple_inb(struct iop *p, unsigned long port)
49{
50 return *(unsigned char *) (p->base + port);
51}
52
53unsigned short
54simple_inw(struct iop *p, unsigned long port)
55{
56 return *(unsigned short *) (p->base + port);
57}
58
59void
60simple_outb(struct iop *p, unsigned char value, unsigned long port)
61{
62 *(unsigned char *) (p->base + port) = value;
63}
64
65void
66simple_outw(struct iop *p, unsigned short value, unsigned long port)
67{
68 *(unsigned short *) (p->base + port) = value;
69}
70
71unsigned char
72pcc_inb(struct iop *p, unsigned long port)
73{
74 unsigned long addr = p->base + port + 0x40000;
75 unsigned long v;
76
77 if (port & 1)
78 addr += 0x00400000;
79 v = *(volatile unsigned char *) addr;
80 return v;
81}
82
83void
84pcc_outb(struct iop *p, unsigned char value, unsigned long port)
85{
86 unsigned long addr = p->base + port + 0x40000;
87
88 if (port & 1)
89 addr += 0x00400000;
90 *(volatile unsigned char *) addr = value;
91}
92
93unsigned char
94bad_inb(struct iop *p, unsigned long port)
95{
96 badio(inb, port);
97}
98
99void
100bad_outb(struct iop *p, unsigned char value, unsigned long port)
101{
102 badio(inw, port);
103}
104
105#ifdef CONFIG_SMC91X
106/* MSTLANEX01 LAN at 0xb400:0000 */
107static struct iop laniop = {
108 .start = 0x00,
109 .end = 0x0F,
110 .base = 0x04000000,
111 .check = simple_check,
112 .inb = simple_inb,
113 .inw = simple_inw,
114 .outb = simple_outb,
115 .outw = simple_outw,
116};
117#endif
118
119#ifdef CONFIG_NE2000
120/* NE2000 pc card NIC */
121static struct iop neiop = {
122 .start = 0x280,
123 .end = 0x29f,
124 .base = 0xb0600000 + 0x80, /* soft 0x280 -> hard 0x300 */
125 .check = simple_check,
126 .inb = pcc_inb,
127 .inw = simple_inw,
128 .outb = pcc_outb,
129 .outw = simple_outw,
130};
131#endif
132
133#ifdef CONFIG_IDE
134/* CF in CF slot */
135static struct iop cfiop = {
136 .base = 0xb0600000,
137 .check = ide_check,
138 .inb = pcc_inb,
139 .inw = simple_inw,
140 .outb = pcc_outb,
141 .outw = simple_outw,
142};
143#endif
144
145static __inline__ struct iop *
146port2iop(unsigned long port)
147{
148 if (0) ;
149#if defined(CONFIG_SMC91X)
150 else if (laniop.check(&laniop, port))
151 return &laniop;
152#endif
153#if defined(CONFIG_NE2000)
154 else if (neiop.check(&neiop, port))
155 return &neiop;
156#endif
157#if defined(CONFIG_IDE)
158 else if (cfiop.check(&cfiop, port))
159 return &cfiop;
160#endif
161 else
162 return NULL;
163}
164
165static inline void
166delay(void)
167{
168 ctrl_inw(0xac000000);
169 ctrl_inw(0xac000000);
170}
171
172unsigned char
173sh7343se_inb(unsigned long port)
174{
175 struct iop *p = port2iop(port);
176 return (p->inb) (p, port);
177}
178
179unsigned char
180sh7343se_inb_p(unsigned long port)
181{
182 unsigned char v = sh7343se_inb(port);
183 delay();
184 return v;
185}
186
187unsigned short
188sh7343se_inw(unsigned long port)
189{
190 struct iop *p = port2iop(port);
191 return (p->inw) (p, port);
192}
193
194unsigned int
195sh7343se_inl(unsigned long port)
196{
197 badio(inl, port);
198}
199
200void
201sh7343se_outb(unsigned char value, unsigned long port)
202{
203 struct iop *p = port2iop(port);
204 (p->outb) (p, value, port);
205}
206
207void
208sh7343se_outb_p(unsigned char value, unsigned long port)
209{
210 sh7343se_outb(value, port);
211 delay();
212}
213
214void
215sh7343se_outw(unsigned short value, unsigned long port)
216{
217 struct iop *p = port2iop(port);
218 (p->outw) (p, value, port);
219}
220
221void
222sh7343se_outl(unsigned int value, unsigned long port)
223{
224 badio(outl, port);
225}
226
227void
228sh7343se_insb(unsigned long port, void *addr, unsigned long count)
229{
230 unsigned char *a = addr;
231 struct iop *p = port2iop(port);
232 while (count--)
233 *a++ = (p->inb) (p, port);
234}
235
236void
237sh7343se_insw(unsigned long port, void *addr, unsigned long count)
238{
239 unsigned short *a = addr;
240 struct iop *p = port2iop(port);
241 while (count--)
242 *a++ = (p->inw) (p, port);
243}
244
245void
246sh7343se_insl(unsigned long port, void *addr, unsigned long count)
247{
248 badio(insl, port);
249}
250
251void
252sh7343se_outsb(unsigned long port, const void *addr, unsigned long count)
253{
254 unsigned char *a = (unsigned char *) addr;
255 struct iop *p = port2iop(port);
256 while (count--)
257 (p->outb) (p, *a++, port);
258}
259
260void
261sh7343se_outsw(unsigned long port, const void *addr, unsigned long count)
262{
263 unsigned short *a = (unsigned short *) addr;
264 struct iop *p = port2iop(port);
265 while (count--)
266 (p->outw) (p, *a++, port);
267}
268
269void
270sh7343se_outsl(unsigned long port, const void *addr, unsigned long count)
271{
272 badio(outsw, port);
273}
diff --git a/arch/sh/boards/mach-se/7343/irq.c b/arch/sh/boards/mach-se/7343/irq.c
new file mode 100644
index 000000000000..5d96e2eef82a
--- /dev/null
+++ b/arch/sh/boards/mach-se/7343/irq.c
@@ -0,0 +1,80 @@
1/*
2 * linux/arch/sh/boards/se/7343/irq.c
3 *
4 * Copyright (C) 2008 Yoshihiro Shimoda
5 *
6 * Based on linux/arch/sh/boards/se/7722/irq.c
7 * Copyright (C) 2007 Nobuhiro Iwamatsu
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13#include <linux/init.h>
14#include <linux/irq.h>
15#include <linux/interrupt.h>
16#include <linux/irq.h>
17#include <linux/io.h>
18#include <mach-se/mach/se7343.h>
19
20static void disable_se7343_irq(unsigned int irq)
21{
22 unsigned int bit = irq - SE7343_FPGA_IRQ_BASE;
23 ctrl_outw(ctrl_inw(PA_CPLD_IMSK) | 1 << bit, PA_CPLD_IMSK);
24}
25
26static void enable_se7343_irq(unsigned int irq)
27{
28 unsigned int bit = irq - SE7343_FPGA_IRQ_BASE;
29 ctrl_outw(ctrl_inw(PA_CPLD_IMSK) & ~(1 << bit), PA_CPLD_IMSK);
30}
31
32static struct irq_chip se7343_irq_chip __read_mostly = {
33 .name = "SE7343-FPGA",
34 .mask = disable_se7343_irq,
35 .unmask = enable_se7343_irq,
36 .mask_ack = disable_se7343_irq,
37};
38
39static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc)
40{
41 unsigned short intv = ctrl_inw(PA_CPLD_ST);
42 struct irq_desc *ext_desc;
43 unsigned int ext_irq = SE7343_FPGA_IRQ_BASE;
44
45 intv &= (1 << SE7343_FPGA_IRQ_NR) - 1;
46
47 while (intv) {
48 if (intv & 1) {
49 ext_desc = irq_desc + ext_irq;
50 handle_level_irq(ext_irq, ext_desc);
51 }
52 intv >>= 1;
53 ext_irq++;
54 }
55}
56
57/*
58 * Initialize IRQ setting
59 */
60void __init init_7343se_IRQ(void)
61{
62 int i;
63
64 ctrl_outw(0, PA_CPLD_IMSK); /* disable all irqs */
65 ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */
66
67 for (i = 0; i < SE7343_FPGA_IRQ_NR; i++)
68 set_irq_chip_and_handler_name(SE7343_FPGA_IRQ_BASE + i,
69 &se7343_irq_chip,
70 handle_level_irq, "level");
71
72 set_irq_chained_handler(IRQ0_IRQ, se7343_irq_demux);
73 set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
74 set_irq_chained_handler(IRQ1_IRQ, se7343_irq_demux);
75 set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW);
76 set_irq_chained_handler(IRQ4_IRQ, se7343_irq_demux);
77 set_irq_type(IRQ4_IRQ, IRQ_TYPE_LEVEL_LOW);
78 set_irq_chained_handler(IRQ5_IRQ, se7343_irq_demux);
79 set_irq_type(IRQ5_IRQ, IRQ_TYPE_LEVEL_LOW);
80}
diff --git a/arch/sh/boards/mach-se/7343/setup.c b/arch/sh/boards/mach-se/7343/setup.c
new file mode 100644
index 000000000000..486f40bf9274
--- /dev/null
+++ b/arch/sh/boards/mach-se/7343/setup.c
@@ -0,0 +1,152 @@
1#include <linux/init.h>
2#include <linux/platform_device.h>
3#include <linux/mtd/physmap.h>
4#include <asm/machvec.h>
5#include <mach-se/mach/se7343.h>
6#include <asm/heartbeat.h>
7#include <asm/irq.h>
8#include <asm/io.h>
9
10static struct resource smc91x_resources[] = {
11 [0] = {
12 .start = 0x10000000,
13 .end = 0x1000000F,
14 .flags = IORESOURCE_MEM,
15 },
16 [1] = {
17 /*
18 * shared with other devices via externel
19 * interrupt controller in FPGA...
20 */
21 .start = SMC_IRQ,
22 .end = SMC_IRQ,
23 .flags = IORESOURCE_IRQ,
24 },
25};
26
27static struct platform_device smc91x_device = {
28 .name = "smc91x",
29 .id = 0,
30 .num_resources = ARRAY_SIZE(smc91x_resources),
31 .resource = smc91x_resources,
32};
33
34static struct resource heartbeat_resources[] = {
35 [0] = {
36 .start = PA_LED,
37 .end = PA_LED,
38 .flags = IORESOURCE_MEM,
39 },
40};
41
42static struct heartbeat_data heartbeat_data = {
43 .regsize = 16,
44};
45
46static struct platform_device heartbeat_device = {
47 .name = "heartbeat",
48 .id = -1,
49 .dev = {
50 .platform_data = &heartbeat_data,
51 },
52 .num_resources = ARRAY_SIZE(heartbeat_resources),
53 .resource = heartbeat_resources,
54};
55
56static struct mtd_partition nor_flash_partitions[] = {
57 {
58 .name = "loader",
59 .offset = 0x00000000,
60 .size = 128 * 1024,
61 },
62 {
63 .name = "rootfs",
64 .offset = MTDPART_OFS_APPEND,
65 .size = 31 * 1024 * 1024,
66 },
67 {
68 .name = "data",
69 .offset = MTDPART_OFS_APPEND,
70 .size = MTDPART_SIZ_FULL,
71 },
72};
73
74static struct physmap_flash_data nor_flash_data = {
75 .width = 2,
76 .parts = nor_flash_partitions,
77 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
78};
79
80static struct resource nor_flash_resources[] = {
81 [0] = {
82 .start = 0x00000000,
83 .end = 0x01ffffff,
84 .flags = IORESOURCE_MEM,
85 }
86};
87
88static struct platform_device nor_flash_device = {
89 .name = "physmap-flash",
90 .dev = {
91 .platform_data = &nor_flash_data,
92 },
93 .num_resources = ARRAY_SIZE(nor_flash_resources),
94 .resource = nor_flash_resources,
95};
96
97static struct platform_device *sh7343se_platform_devices[] __initdata = {
98 &smc91x_device,
99 &heartbeat_device,
100 &nor_flash_device,
101};
102
103static int __init sh7343se_devices_setup(void)
104{
105 return platform_add_devices(sh7343se_platform_devices,
106 ARRAY_SIZE(sh7343se_platform_devices));
107}
108device_initcall(sh7343se_devices_setup);
109
110/*
111 * Initialize the board
112 */
113static void __init sh7343se_setup(char **cmdline_p)
114{
115 ctrl_outw(0xf900, FPGA_OUT); /* FPGA */
116
117 ctrl_outw(0x0002, PORT_PECR); /* PORT E 1 = IRQ5 */
118 ctrl_outw(0x0020, PORT_PSELD);
119
120 printk(KERN_INFO "MS7343CP01 Setup...done\n");
121}
122
123/*
124 * The Machine Vector
125 */
126static struct sh_machine_vector mv_7343se __initmv = {
127 .mv_name = "SolutionEngine 7343",
128 .mv_setup = sh7343se_setup,
129 .mv_nr_irqs = 108,
130 .mv_inb = sh7343se_inb,
131 .mv_inw = sh7343se_inw,
132 .mv_inl = sh7343se_inl,
133 .mv_outb = sh7343se_outb,
134 .mv_outw = sh7343se_outw,
135 .mv_outl = sh7343se_outl,
136
137 .mv_inb_p = sh7343se_inb_p,
138 .mv_inw_p = sh7343se_inw,
139 .mv_inl_p = sh7343se_inl,
140 .mv_outb_p = sh7343se_outb_p,
141 .mv_outw_p = sh7343se_outw,
142 .mv_outl_p = sh7343se_outl,
143
144 .mv_insb = sh7343se_insb,
145 .mv_insw = sh7343se_insw,
146 .mv_insl = sh7343se_insl,
147 .mv_outsb = sh7343se_outsb,
148 .mv_outsw = sh7343se_outsw,
149 .mv_outsl = sh7343se_outsl,
150
151 .mv_init_irq = init_7343se_IRQ,
152};
diff --git a/arch/sh/boards/se/770x/Makefile b/arch/sh/boards/mach-se/770x/Makefile
index 8e624b06d5ea..8e624b06d5ea 100644
--- a/arch/sh/boards/se/770x/Makefile
+++ b/arch/sh/boards/mach-se/770x/Makefile
diff --git a/arch/sh/boards/mach-se/770x/io.c b/arch/sh/boards/mach-se/770x/io.c
new file mode 100644
index 000000000000..28833c8786ea
--- /dev/null
+++ b/arch/sh/boards/mach-se/770x/io.c
@@ -0,0 +1,156 @@
1/*
2 * Copyright (C) 2000 Kazumoto Kojima
3 *
4 * I/O routine for Hitachi SolutionEngine.
5 */
6#include <linux/kernel.h>
7#include <linux/types.h>
8#include <asm/io.h>
9#include <mach-se/mach/se.h>
10
11/* MS7750 requires special versions of in*, out* routines, since
12 PC-like io ports are located at upper half byte of 16-bit word which
13 can be accessed only with 16-bit wide. */
14
15static inline volatile __u16 *
16port2adr(unsigned int port)
17{
18 if (port & 0xff000000)
19 return ( volatile __u16 *) port;
20 if (port >= 0x2000)
21 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
22 else if (port >= 0x1000)
23 return (volatile __u16 *) (PA_83902 + (port << 1));
24 else
25 return (volatile __u16 *) (PA_SUPERIO + (port << 1));
26}
27
28static inline int
29shifted_port(unsigned long port)
30{
31 /* For IDE registers, value is not shifted */
32 if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6)
33 return 0;
34 else
35 return 1;
36}
37
38unsigned char se_inb(unsigned long port)
39{
40 if (shifted_port(port))
41 return (*port2adr(port) >> 8);
42 else
43 return (*port2adr(port))&0xff;
44}
45
46unsigned char se_inb_p(unsigned long port)
47{
48 unsigned long v;
49
50 if (shifted_port(port))
51 v = (*port2adr(port) >> 8);
52 else
53 v = (*port2adr(port))&0xff;
54 ctrl_delay();
55 return v;
56}
57
58unsigned short se_inw(unsigned long port)
59{
60 if (port >= 0x2000)
61 return *port2adr(port);
62 else
63 maybebadio(port);
64 return 0;
65}
66
67unsigned int se_inl(unsigned long port)
68{
69 maybebadio(port);
70 return 0;
71}
72
73void se_outb(unsigned char value, unsigned long port)
74{
75 if (shifted_port(port))
76 *(port2adr(port)) = value << 8;
77 else
78 *(port2adr(port)) = value;
79}
80
81void se_outb_p(unsigned char value, unsigned long port)
82{
83 if (shifted_port(port))
84 *(port2adr(port)) = value << 8;
85 else
86 *(port2adr(port)) = value;
87 ctrl_delay();
88}
89
90void se_outw(unsigned short value, unsigned long port)
91{
92 if (port >= 0x2000)
93 *port2adr(port) = value;
94 else
95 maybebadio(port);
96}
97
98void se_outl(unsigned int value, unsigned long port)
99{
100 maybebadio(port);
101}
102
103void se_insb(unsigned long port, void *addr, unsigned long count)
104{
105 volatile __u16 *p = port2adr(port);
106 __u8 *ap = addr;
107
108 if (shifted_port(port)) {
109 while (count--)
110 *ap++ = *p >> 8;
111 } else {
112 while (count--)
113 *ap++ = *p;
114 }
115}
116
117void se_insw(unsigned long port, void *addr, unsigned long count)
118{
119 volatile __u16 *p = port2adr(port);
120 __u16 *ap = addr;
121 while (count--)
122 *ap++ = *p;
123}
124
125void se_insl(unsigned long port, void *addr, unsigned long count)
126{
127 maybebadio(port);
128}
129
130void se_outsb(unsigned long port, const void *addr, unsigned long count)
131{
132 volatile __u16 *p = port2adr(port);
133 const __u8 *ap = addr;
134
135 if (shifted_port(port)) {
136 while (count--)
137 *p = *ap++ << 8;
138 } else {
139 while (count--)
140 *p = *ap++;
141 }
142}
143
144void se_outsw(unsigned long port, const void *addr, unsigned long count)
145{
146 volatile __u16 *p = port2adr(port);
147 const __u16 *ap = addr;
148
149 while (count--)
150 *p = *ap++;
151}
152
153void se_outsl(unsigned long port, const void *addr, unsigned long count)
154{
155 maybebadio(port);
156}
diff --git a/arch/sh/boards/mach-se/770x/irq.c b/arch/sh/boards/mach-se/770x/irq.c
new file mode 100644
index 000000000000..ec1fea571b52
--- /dev/null
+++ b/arch/sh/boards/mach-se/770x/irq.c
@@ -0,0 +1,108 @@
1/*
2 * linux/arch/sh/boards/se/770x/irq.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 * Copyright (C) 2006 Nobuhiro Iwamatsu
6 *
7 * Hitachi SolutionEngine Support.
8 *
9 */
10
11#include <linux/init.h>
12#include <linux/interrupt.h>
13#include <linux/irq.h>
14#include <asm/irq.h>
15#include <asm/io.h>
16#include <mach-se/mach/se.h>
17
18static struct ipr_data ipr_irq_table[] = {
19 /*
20 * Super I/O (Just mimic PC):
21 * 1: keyboard
22 * 3: serial 0
23 * 4: serial 1
24 * 5: printer
25 * 6: floppy
26 * 8: rtc
27 * 12: mouse
28 * 14: ide0
29 */
30#if defined(CONFIG_CPU_SUBTYPE_SH7705)
31 /* This is default value */
32 { 13, 0, 8, 0x0f-13, },
33 { 5 , 0, 4, 0x0f- 5, },
34 { 10, 1, 0, 0x0f-10, },
35 { 7 , 2, 4, 0x0f- 7, },
36 { 3 , 2, 0, 0x0f- 3, },
37 { 1 , 3, 12, 0x0f- 1, },
38 { 12, 3, 4, 0x0f-12, }, /* LAN */
39 { 2 , 4, 8, 0x0f- 2, }, /* PCIRQ2 */
40 { 6 , 4, 4, 0x0f- 6, }, /* PCIRQ1 */
41 { 14, 4, 0, 0x0f-14, }, /* PCIRQ0 */
42 { 0 , 5, 12, 0x0f , },
43 { 4 , 5, 4, 0x0f- 4, },
44 { 8 , 6, 12, 0x0f- 8, },
45 { 9 , 6, 8, 0x0f- 9, },
46 { 11, 6, 4, 0x0f-11, },
47#else
48 { 14, 0, 8, 0x0f-14, },
49 { 12, 0, 4, 0x0f-12, },
50 { 8, 1, 4, 0x0f- 8, },
51 { 6, 2, 12, 0x0f- 6, },
52 { 5, 2, 8, 0x0f- 5, },
53 { 4, 2, 4, 0x0f- 4, },
54 { 3, 2, 0, 0x0f- 3, },
55 { 1, 3, 12, 0x0f- 1, },
56#if defined(CONFIG_STNIC)
57 /* ST NIC */
58 { 10, 3, 4, 0x0f-10, }, /* LAN */
59#endif
60 /* MRSHPC IRQs setting */
61 { 0, 4, 12, 0x0f- 0, }, /* PCIRQ3 */
62 { 11, 4, 8, 0x0f-11, }, /* PCIRQ2 */
63 { 9, 4, 4, 0x0f- 9, }, /* PCIRQ1 */
64 { 7, 4, 0, 0x0f- 7, }, /* PCIRQ0 */
65 /* #2, #13 are allocated for SLOT IRQ #1 and #2 (for now) */
66 /* NOTE: #2 and #13 are not used on PC */
67 { 13, 6, 4, 0x0f-13, }, /* SLOTIRQ2 */
68 { 2, 6, 0, 0x0f- 2, }, /* SLOTIRQ1 */
69#endif
70};
71
72static unsigned long ipr_offsets[] = {
73 BCR_ILCRA,
74 BCR_ILCRB,
75 BCR_ILCRC,
76 BCR_ILCRD,
77 BCR_ILCRE,
78 BCR_ILCRF,
79 BCR_ILCRG,
80};
81
82static struct ipr_desc ipr_irq_desc = {
83 .ipr_offsets = ipr_offsets,
84 .nr_offsets = ARRAY_SIZE(ipr_offsets),
85
86 .ipr_data = ipr_irq_table,
87 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
88 .chip = {
89 .name = "IPR-se770x",
90 },
91};
92
93/*
94 * Initialize IRQ setting
95 */
96void __init init_se_IRQ(void)
97{
98 /* Disable all interrupts */
99 ctrl_outw(0, BCR_ILCRA);
100 ctrl_outw(0, BCR_ILCRB);
101 ctrl_outw(0, BCR_ILCRC);
102 ctrl_outw(0, BCR_ILCRD);
103 ctrl_outw(0, BCR_ILCRE);
104 ctrl_outw(0, BCR_ILCRF);
105 ctrl_outw(0, BCR_ILCRG);
106
107 register_ipr_controller(&ipr_irq_desc);
108}
diff --git a/arch/sh/boards/mach-se/770x/setup.c b/arch/sh/boards/mach-se/770x/setup.c
new file mode 100644
index 000000000000..9123d9687bf7
--- /dev/null
+++ b/arch/sh/boards/mach-se/770x/setup.c
@@ -0,0 +1,222 @@
1/*
2 * linux/arch/sh/boards/se/770x/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 */
9#include <linux/init.h>
10#include <linux/platform_device.h>
11#include <asm/machvec.h>
12#include <mach-se/mach/se.h>
13#include <asm/io.h>
14#include <asm/smc37c93x.h>
15#include <asm/heartbeat.h>
16
17/*
18 * Configure the Super I/O chip
19 */
20static void __init smsc_config(int index, int data)
21{
22 outb_p(index, INDEX_PORT);
23 outb_p(data, DATA_PORT);
24}
25
26/* XXX: Another candidate for a more generic cchip machine vector */
27static void __init smsc_setup(char **cmdline_p)
28{
29 outb_p(CONFIG_ENTER, CONFIG_PORT);
30 outb_p(CONFIG_ENTER, CONFIG_PORT);
31
32 /* FDC */
33 smsc_config(CURRENT_LDN_INDEX, LDN_FDC);
34 smsc_config(ACTIVATE_INDEX, 0x01);
35 smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */
36
37 /* AUXIO (GPIO): to use IDE1 */
38 smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO);
39 smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */
40 smsc_config(GPIO47_INDEX, 0x00); /* nIOWOP */
41
42 /* COM1 */
43 smsc_config(CURRENT_LDN_INDEX, LDN_COM1);
44 smsc_config(ACTIVATE_INDEX, 0x01);
45 smsc_config(IO_BASE_HI_INDEX, 0x03);
46 smsc_config(IO_BASE_LO_INDEX, 0xf8);
47 smsc_config(IRQ_SELECT_INDEX, 4); /* IRQ4 */
48
49 /* COM2 */
50 smsc_config(CURRENT_LDN_INDEX, LDN_COM2);
51 smsc_config(ACTIVATE_INDEX, 0x01);
52 smsc_config(IO_BASE_HI_INDEX, 0x02);
53 smsc_config(IO_BASE_LO_INDEX, 0xf8);
54 smsc_config(IRQ_SELECT_INDEX, 3); /* IRQ3 */
55
56 /* RTC */
57 smsc_config(CURRENT_LDN_INDEX, LDN_RTC);
58 smsc_config(ACTIVATE_INDEX, 0x01);
59 smsc_config(IRQ_SELECT_INDEX, 8); /* IRQ8 */
60
61 /* XXX: PARPORT, KBD, and MOUSE will come here... */
62 outb_p(CONFIG_EXIT, CONFIG_PORT);
63}
64
65
66static struct resource cf_ide_resources[] = {
67 [0] = {
68 .start = PA_MRSHPC_IO + 0x1f0,
69 .end = PA_MRSHPC_IO + 0x1f0 + 8,
70 .flags = IORESOURCE_MEM,
71 },
72 [1] = {
73 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
74 .end = PA_MRSHPC_IO + 0x1f0 + 8 + 0x206 + 8,
75 .flags = IORESOURCE_MEM,
76 },
77 [2] = {
78 .start = IRQ_CFCARD,
79 .flags = IORESOURCE_IRQ,
80 },
81};
82
83static struct platform_device cf_ide_device = {
84 .name = "pata_platform",
85 .id = -1,
86 .num_resources = ARRAY_SIZE(cf_ide_resources),
87 .resource = cf_ide_resources,
88};
89
90static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
91
92static struct heartbeat_data heartbeat_data = {
93 .bit_pos = heartbeat_bit_pos,
94 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
95 .regsize = 16,
96};
97
98static struct resource heartbeat_resources[] = {
99 [0] = {
100 .start = PA_LED,
101 .end = PA_LED,
102 .flags = IORESOURCE_MEM,
103 },
104};
105
106static struct platform_device heartbeat_device = {
107 .name = "heartbeat",
108 .id = -1,
109 .dev = {
110 .platform_data = &heartbeat_data,
111 },
112 .num_resources = ARRAY_SIZE(heartbeat_resources),
113 .resource = heartbeat_resources,
114};
115
116#if defined(CONFIG_CPU_SUBTYPE_SH7710) ||\
117 defined(CONFIG_CPU_SUBTYPE_SH7712)
118/* SH771X Ethernet driver */
119static struct resource sh_eth0_resources[] = {
120 [0] = {
121 .start = SH_ETH0_BASE,
122 .end = SH_ETH0_BASE + 0x1B8,
123 .flags = IORESOURCE_MEM,
124 },
125 [1] = {
126 .start = SH_ETH0_IRQ,
127 .end = SH_ETH0_IRQ,
128 .flags = IORESOURCE_IRQ,
129 },
130};
131
132static struct platform_device sh_eth0_device = {
133 .name = "sh-eth",
134 .id = 0,
135 .dev = {
136 .platform_data = PHY_ID,
137 },
138 .num_resources = ARRAY_SIZE(sh_eth0_resources),
139 .resource = sh_eth0_resources,
140};
141
142static struct resource sh_eth1_resources[] = {
143 [0] = {
144 .start = SH_ETH1_BASE,
145 .end = SH_ETH1_BASE + 0x1B8,
146 .flags = IORESOURCE_MEM,
147 },
148 [1] = {
149 .start = SH_ETH1_IRQ,
150 .end = SH_ETH1_IRQ,
151 .flags = IORESOURCE_IRQ,
152 },
153};
154
155static struct platform_device sh_eth1_device = {
156 .name = "sh-eth",
157 .id = 1,
158 .dev = {
159 .platform_data = PHY_ID,
160 },
161 .num_resources = ARRAY_SIZE(sh_eth1_resources),
162 .resource = sh_eth1_resources,
163};
164#endif
165
166static struct platform_device *se_devices[] __initdata = {
167 &heartbeat_device,
168 &cf_ide_device,
169#if defined(CONFIG_CPU_SUBTYPE_SH7710) ||\
170 defined(CONFIG_CPU_SUBTYPE_SH7712)
171 &sh_eth0_device,
172 &sh_eth1_device,
173#endif
174};
175
176static int __init se_devices_setup(void)
177{
178 return platform_add_devices(se_devices, ARRAY_SIZE(se_devices));
179}
180device_initcall(se_devices_setup);
181
182/*
183 * The Machine Vector
184 */
185static struct sh_machine_vector mv_se __initmv = {
186 .mv_name = "SolutionEngine",
187 .mv_setup = smsc_setup,
188#if defined(CONFIG_CPU_SH4)
189 .mv_nr_irqs = 48,
190#elif defined(CONFIG_CPU_SUBTYPE_SH7708)
191 .mv_nr_irqs = 32,
192#elif defined(CONFIG_CPU_SUBTYPE_SH7709)
193 .mv_nr_irqs = 61,
194#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
195 .mv_nr_irqs = 86,
196#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
197 .mv_nr_irqs = 104,
198#endif
199
200 .mv_inb = se_inb,
201 .mv_inw = se_inw,
202 .mv_inl = se_inl,
203 .mv_outb = se_outb,
204 .mv_outw = se_outw,
205 .mv_outl = se_outl,
206
207 .mv_inb_p = se_inb_p,
208 .mv_inw_p = se_inw,
209 .mv_inl_p = se_inl,
210 .mv_outb_p = se_outb_p,
211 .mv_outw_p = se_outw,
212 .mv_outl_p = se_outl,
213
214 .mv_insb = se_insb,
215 .mv_insw = se_insw,
216 .mv_insl = se_insl,
217 .mv_outsb = se_outsb,
218 .mv_outsw = se_outsw,
219 .mv_outsl = se_outsl,
220
221 .mv_init_irq = init_se_IRQ,
222};
diff --git a/arch/sh/boards/se/7721/Makefile b/arch/sh/boards/mach-se/7721/Makefile
index 7f09030980b3..7f09030980b3 100644
--- a/arch/sh/boards/se/7721/Makefile
+++ b/arch/sh/boards/mach-se/7721/Makefile
diff --git a/arch/sh/boards/mach-se/7721/irq.c b/arch/sh/boards/mach-se/7721/irq.c
new file mode 100644
index 000000000000..b417acc4dad0
--- /dev/null
+++ b/arch/sh/boards/mach-se/7721/irq.c
@@ -0,0 +1,45 @@
1/*
2 * linux/arch/sh/boards/se/7721/irq.c
3 *
4 * Copyright (C) 2008 Renesas Solutions Corp.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/irq.h>
12#include <linux/interrupt.h>
13#include <linux/io.h>
14#include <mach-se/mach/se7721.h>
15
16enum {
17 UNUSED = 0,
18
19 /* board specific interrupt sources */
20 MRSHPC,
21};
22
23static struct intc_vect vectors[] __initdata = {
24 INTC_IRQ(MRSHPC, MRSHPC_IRQ0),
25};
26
27static struct intc_prio_reg prio_registers[] __initdata = {
28 { FPGA_ILSR6, 0, 8, 4, /* IRLMSK */
29 { 0, MRSHPC } },
30};
31
32static DECLARE_INTC_DESC(intc_desc, "SE7721", vectors,
33 NULL, NULL, prio_registers, NULL);
34
35/*
36 * Initialize IRQ setting
37 */
38void __init init_se7721_IRQ(void)
39{
40 /* PPCR */
41 ctrl_outw(ctrl_inw(0xa4050118) & ~0x00ff, 0xa4050118);
42
43 register_intc_controller(&intc_desc);
44 intc_set_priority(MRSHPC_IRQ0, 0xf - MRSHPC_IRQ0);
45}
diff --git a/arch/sh/boards/mach-se/7721/setup.c b/arch/sh/boards/mach-se/7721/setup.c
new file mode 100644
index 000000000000..d3fc80ff4d83
--- /dev/null
+++ b/arch/sh/boards/mach-se/7721/setup.c
@@ -0,0 +1,99 @@
1/*
2 * linux/arch/sh/boards/se/7721/setup.c
3 *
4 * Copyright (C) 2008 Renesas Solutions Corp.
5 *
6 * Hitachi UL SolutionEngine 7721 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 *
12 */
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <asm/machvec.h>
16#include <mach-se/mach/se7721.h>
17#include <asm/io.h>
18#include <asm/heartbeat.h>
19
20static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
21
22static struct heartbeat_data heartbeat_data = {
23 .bit_pos = heartbeat_bit_pos,
24 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
25 .regsize = 16,
26};
27
28static struct resource heartbeat_resources[] = {
29 [0] = {
30 .start = PA_LED,
31 .end = PA_LED,
32 .flags = IORESOURCE_MEM,
33 },
34};
35
36static struct platform_device heartbeat_device = {
37 .name = "heartbeat",
38 .id = -1,
39 .dev = {
40 .platform_data = &heartbeat_data,
41 },
42 .num_resources = ARRAY_SIZE(heartbeat_resources),
43 .resource = heartbeat_resources,
44};
45
46static struct resource cf_ide_resources[] = {
47 [0] = {
48 .start = PA_MRSHPC_IO + 0x1f0,
49 .end = PA_MRSHPC_IO + 0x1f0 + 8 ,
50 .flags = IORESOURCE_IO,
51 },
52 [1] = {
53 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
54 .end = PA_MRSHPC_IO + 0x1f0 + 8 + 0x206 + 8,
55 .flags = IORESOURCE_IO,
56 },
57 [2] = {
58 .start = MRSHPC_IRQ0,
59 .flags = IORESOURCE_IRQ,
60 },
61};
62
63static struct platform_device cf_ide_device = {
64 .name = "pata_platform",
65 .id = -1,
66 .num_resources = ARRAY_SIZE(cf_ide_resources),
67 .resource = cf_ide_resources,
68};
69
70static struct platform_device *se7721_devices[] __initdata = {
71 &cf_ide_device,
72 &heartbeat_device
73};
74
75static int __init se7721_devices_setup(void)
76{
77 return platform_add_devices(se7721_devices,
78 ARRAY_SIZE(se7721_devices));
79}
80device_initcall(se7721_devices_setup);
81
82static void __init se7721_setup(char **cmdline_p)
83{
84 /* for USB */
85 ctrl_outw(0x0000, 0xA405010C); /* PGCR */
86 ctrl_outw(0x0000, 0xA405010E); /* PHCR */
87 ctrl_outw(0x00AA, 0xA4050118); /* PPCR */
88 ctrl_outw(0x0000, 0xA4050124); /* PSELA */
89}
90
91/*
92 * The Machine Vector
93 */
94struct sh_machine_vector mv_se7721 __initmv = {
95 .mv_name = "Solution Engine 7721",
96 .mv_setup = se7721_setup,
97 .mv_nr_irqs = 109,
98 .mv_init_irq = init_se7721_IRQ,
99};
diff --git a/arch/sh/boards/se/7722/Makefile b/arch/sh/boards/mach-se/7722/Makefile
index 8694373389e5..8694373389e5 100644
--- a/arch/sh/boards/se/7722/Makefile
+++ b/arch/sh/boards/mach-se/7722/Makefile
diff --git a/arch/sh/boards/mach-se/7722/irq.c b/arch/sh/boards/mach-se/7722/irq.c
new file mode 100644
index 000000000000..02d21a3e2a8f
--- /dev/null
+++ b/arch/sh/boards/mach-se/7722/irq.c
@@ -0,0 +1,76 @@
1/*
2 * linux/arch/sh/boards/se/7722/irq.c
3 *
4 * Copyright (C) 2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7722 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/interrupt.h>
15#include <asm/irq.h>
16#include <asm/io.h>
17#include <mach-se/mach/se7722.h>
18
19static void disable_se7722_irq(unsigned int irq)
20{
21 unsigned int bit = irq - SE7722_FPGA_IRQ_BASE;
22 ctrl_outw(ctrl_inw(IRQ01_MASK) | 1 << bit, IRQ01_MASK);
23}
24
25static void enable_se7722_irq(unsigned int irq)
26{
27 unsigned int bit = irq - SE7722_FPGA_IRQ_BASE;
28 ctrl_outw(ctrl_inw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK);
29}
30
31static struct irq_chip se7722_irq_chip __read_mostly = {
32 .name = "SE7722-FPGA",
33 .mask = disable_se7722_irq,
34 .unmask = enable_se7722_irq,
35 .mask_ack = disable_se7722_irq,
36};
37
38static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
39{
40 unsigned short intv = ctrl_inw(IRQ01_STS);
41 struct irq_desc *ext_desc;
42 unsigned int ext_irq = SE7722_FPGA_IRQ_BASE;
43
44 intv &= (1 << SE7722_FPGA_IRQ_NR) - 1;
45
46 while (intv) {
47 if (intv & 1) {
48 ext_desc = irq_desc + ext_irq;
49 handle_level_irq(ext_irq, ext_desc);
50 }
51 intv >>= 1;
52 ext_irq++;
53 }
54}
55
56/*
57 * Initialize IRQ setting
58 */
59void __init init_se7722_IRQ(void)
60{
61 int i;
62
63 ctrl_outw(0, IRQ01_MASK); /* disable all irqs */
64 ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */
65
66 for (i = 0; i < SE7722_FPGA_IRQ_NR; i++)
67 set_irq_chip_and_handler_name(SE7722_FPGA_IRQ_BASE + i,
68 &se7722_irq_chip,
69 handle_level_irq, "level");
70
71 set_irq_chained_handler(IRQ0_IRQ, se7722_irq_demux);
72 set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
73
74 set_irq_chained_handler(IRQ1_IRQ, se7722_irq_demux);
75 set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW);
76}
diff --git a/arch/sh/boards/mach-se/7722/setup.c b/arch/sh/boards/mach-se/7722/setup.c
new file mode 100644
index 000000000000..fe6f96517e12
--- /dev/null
+++ b/arch/sh/boards/mach-se/7722/setup.c
@@ -0,0 +1,194 @@
1/*
2 * linux/arch/sh/boards/se/7722/setup.c
3 *
4 * Copyright (C) 2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7722 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 *
12 */
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/ata_platform.h>
16#include <linux/input.h>
17#include <linux/smc91x.h>
18#include <asm/machvec.h>
19#include <asm/clock.h>
20#include <mach-se/mach/se7722.h>
21#include <asm/io.h>
22#include <asm/heartbeat.h>
23#include <asm/sh_keysc.h>
24
25/* Heartbeat */
26static struct heartbeat_data heartbeat_data = {
27 .regsize = 16,
28};
29
30static struct resource heartbeat_resources[] = {
31 [0] = {
32 .start = PA_LED,
33 .end = PA_LED,
34 .flags = IORESOURCE_MEM,
35 },
36};
37
38static struct platform_device heartbeat_device = {
39 .name = "heartbeat",
40 .id = -1,
41 .dev = {
42 .platform_data = &heartbeat_data,
43 },
44 .num_resources = ARRAY_SIZE(heartbeat_resources),
45 .resource = heartbeat_resources,
46};
47
48/* SMC91x */
49static struct smc91x_platdata smc91x_info = {
50 .flags = SMC91X_USE_16BIT,
51};
52
53static struct resource smc91x_eth_resources[] = {
54 [0] = {
55 .name = "smc91x-regs" ,
56 .start = PA_LAN + 0x300,
57 .end = PA_LAN + 0x300 + 0x10 ,
58 .flags = IORESOURCE_MEM,
59 },
60 [1] = {
61 .start = SMC_IRQ,
62 .end = SMC_IRQ,
63 .flags = IORESOURCE_IRQ,
64 },
65};
66
67static struct platform_device smc91x_eth_device = {
68 .name = "smc91x",
69 .id = 0,
70 .dev = {
71 .dma_mask = NULL, /* don't use dma */
72 .coherent_dma_mask = 0xffffffff,
73 .platform_data = &smc91x_info,
74 },
75 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
76 .resource = smc91x_eth_resources,
77};
78
79static struct resource cf_ide_resources[] = {
80 [0] = {
81 .start = PA_MRSHPC_IO + 0x1f0,
82 .end = PA_MRSHPC_IO + 0x1f0 + 8 ,
83 .flags = IORESOURCE_IO,
84 },
85 [1] = {
86 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
87 .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
88 .flags = IORESOURCE_IO,
89 },
90 [2] = {
91 .start = MRSHPC_IRQ0,
92 .end = MRSHPC_IRQ0,
93 .flags = IORESOURCE_IRQ,
94 },
95};
96
97static struct platform_device cf_ide_device = {
98 .name = "pata_platform",
99 .id = -1,
100 .num_resources = ARRAY_SIZE(cf_ide_resources),
101 .resource = cf_ide_resources,
102};
103
104static struct sh_keysc_info sh_keysc_info = {
105 .mode = SH_KEYSC_MODE_1, /* KEYOUT0->5, KEYIN0->4 */
106 .scan_timing = 3,
107 .delay = 5,
108 .keycodes = { /* SW1 -> SW30 */
109 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
110 KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
111 KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
112 KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T,
113 KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y,
114 KEY_Z,
115 KEY_HOME, KEY_SLEEP, KEY_WAKEUP, KEY_COFFEE, /* life */
116 },
117};
118
119static struct resource sh_keysc_resources[] = {
120 [0] = {
121 .start = 0x044b0000,
122 .end = 0x044b000f,
123 .flags = IORESOURCE_MEM,
124 },
125 [1] = {
126 .start = 79,
127 .flags = IORESOURCE_IRQ,
128 },
129};
130
131static struct platform_device sh_keysc_device = {
132 .name = "sh_keysc",
133 .num_resources = ARRAY_SIZE(sh_keysc_resources),
134 .resource = sh_keysc_resources,
135 .dev = {
136 .platform_data = &sh_keysc_info,
137 },
138};
139
140static struct platform_device *se7722_devices[] __initdata = {
141 &heartbeat_device,
142 &smc91x_eth_device,
143 &cf_ide_device,
144 &sh_keysc_device,
145};
146
147static int __init se7722_devices_setup(void)
148{
149 clk_always_enable("mstp214"); /* KEYSC */
150
151 return platform_add_devices(se7722_devices,
152 ARRAY_SIZE(se7722_devices));
153}
154device_initcall(se7722_devices_setup);
155
156static void __init se7722_setup(char **cmdline_p)
157{
158 ctrl_outw(0x010D, FPGA_OUT); /* FPGA */
159
160 ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */
161 ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */
162
163 /* LCDC I/O */
164 ctrl_outw(0x0020, PORT_PSELD);
165
166 /* SIOF1*/
167 ctrl_outw(0x0003, PORT_PSELB);
168 ctrl_outw(0xe000, PORT_PSELC);
169 ctrl_outw(0x0000, PORT_PKCR);
170
171 /* LCDC */
172 ctrl_outw(0x4020, PORT_PHCR);
173 ctrl_outw(0x0000, PORT_PLCR);
174 ctrl_outw(0x0000, PORT_PMCR);
175 ctrl_outw(0x0002, PORT_PRCR);
176 ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */
177
178 /* KEYSC */
179 ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */
180 ctrl_outw(0x0000, PORT_PYCR);
181 ctrl_outw(0x0000, PORT_PZCR);
182 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
183 ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
184}
185
186/*
187 * The Machine Vector
188 */
189static struct sh_machine_vector mv_se7722 __initmv = {
190 .mv_name = "Solution Engine 7722" ,
191 .mv_setup = se7722_setup ,
192 .mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR,
193 .mv_init_irq = init_se7722_IRQ,
194};
diff --git a/arch/sh/boards/se/7751/Makefile b/arch/sh/boards/mach-se/7751/Makefile
index dbc29f3a9de5..dbc29f3a9de5 100644
--- a/arch/sh/boards/se/7751/Makefile
+++ b/arch/sh/boards/mach-se/7751/Makefile
diff --git a/arch/sh/boards/mach-se/7751/io.c b/arch/sh/boards/mach-se/7751/io.c
new file mode 100644
index 000000000000..6287ae570319
--- /dev/null
+++ b/arch/sh/boards/mach-se/7751/io.c
@@ -0,0 +1,135 @@
1/*
2 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
3 * Based largely on io_se.c.
4 *
5 * I/O routine for Hitachi 7751 SolutionEngine.
6 *
7 * Initial version only to support LAN access; some
8 * placeholder code from io_se.c left in with the
9 * expectation of later SuperIO and PCMCIA access.
10 */
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/pci.h>
14#include <asm/io.h>
15#include <mach-se/mach/se7751.h>
16#include <asm/addrspace.h>
17
18static inline volatile u16 *port2adr(unsigned int port)
19{
20 if (port >= 0x2000)
21 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
22 maybebadio((unsigned long)port);
23 return (volatile __u16*)port;
24}
25
26/*
27 * General outline: remap really low stuff [eventually] to SuperIO,
28 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
29 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
30 * should be way beyond the window, and is used w/o translation for
31 * compatibility.
32 */
33unsigned char sh7751se_inb(unsigned long port)
34{
35 if (PXSEG(port))
36 return *(volatile unsigned char *)port;
37 else if (is_pci_ioaddr(port))
38 return *(volatile unsigned char *)pci_ioaddr(port);
39 else
40 return (*port2adr(port)) & 0xff;
41}
42
43unsigned char sh7751se_inb_p(unsigned long port)
44{
45 unsigned char v;
46
47 if (PXSEG(port))
48 v = *(volatile unsigned char *)port;
49 else if (is_pci_ioaddr(port))
50 v = *(volatile unsigned char *)pci_ioaddr(port);
51 else
52 v = (*port2adr(port)) & 0xff;
53 ctrl_delay();
54 return v;
55}
56
57unsigned short sh7751se_inw(unsigned long port)
58{
59 if (PXSEG(port))
60 return *(volatile unsigned short *)port;
61 else if (is_pci_ioaddr(port))
62 return *(volatile unsigned short *)pci_ioaddr(port);
63 else if (port >= 0x2000)
64 return *port2adr(port);
65 else
66 maybebadio(port);
67 return 0;
68}
69
70unsigned int sh7751se_inl(unsigned long port)
71{
72 if (PXSEG(port))
73 return *(volatile unsigned long *)port;
74 else if (is_pci_ioaddr(port))
75 return *(volatile unsigned int *)pci_ioaddr(port);
76 else if (port >= 0x2000)
77 return *port2adr(port);
78 else
79 maybebadio(port);
80 return 0;
81}
82
83void sh7751se_outb(unsigned char value, unsigned long port)
84{
85
86 if (PXSEG(port))
87 *(volatile unsigned char *)port = value;
88 else if (is_pci_ioaddr(port))
89 *((unsigned char*)pci_ioaddr(port)) = value;
90 else
91 *(port2adr(port)) = value;
92}
93
94void sh7751se_outb_p(unsigned char value, unsigned long port)
95{
96 if (PXSEG(port))
97 *(volatile unsigned char *)port = value;
98 else if (is_pci_ioaddr(port))
99 *((unsigned char*)pci_ioaddr(port)) = value;
100 else
101 *(port2adr(port)) = value;
102 ctrl_delay();
103}
104
105void sh7751se_outw(unsigned short value, unsigned long port)
106{
107 if (PXSEG(port))
108 *(volatile unsigned short *)port = value;
109 else if (is_pci_ioaddr(port))
110 *((unsigned short *)pci_ioaddr(port)) = value;
111 else if (port >= 0x2000)
112 *port2adr(port) = value;
113 else
114 maybebadio(port);
115}
116
117void sh7751se_outl(unsigned int value, unsigned long port)
118{
119 if (PXSEG(port))
120 *(volatile unsigned long *)port = value;
121 else if (is_pci_ioaddr(port))
122 *((unsigned long*)pci_ioaddr(port)) = value;
123 else
124 maybebadio(port);
125}
126
127void sh7751se_insl(unsigned long port, void *addr, unsigned long count)
128{
129 maybebadio(port);
130}
131
132void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count)
133{
134 maybebadio(port);
135}
diff --git a/arch/sh/boards/mach-se/7751/irq.c b/arch/sh/boards/mach-se/7751/irq.c
new file mode 100644
index 000000000000..5c9847ea1e7c
--- /dev/null
+++ b/arch/sh/boards/mach-se/7751/irq.c
@@ -0,0 +1,50 @@
1/*
2 * linux/arch/sh/boards/se/7751/irq.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 * Modified for 7751 Solution Engine by
9 * Ian da Silva and Jeremy Siegel, 2001.
10 */
11
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <asm/irq.h>
15#include <mach-se/mach/se7751.h>
16
17static struct ipr_data ipr_irq_table[] = {
18 { 13, 3, 3, 2 },
19 /* Add additional entries here as drivers are added and tested. */
20};
21
22static unsigned long ipr_offsets[] = {
23 BCR_ILCRA,
24 BCR_ILCRB,
25 BCR_ILCRC,
26 BCR_ILCRD,
27 BCR_ILCRE,
28 BCR_ILCRF,
29 BCR_ILCRG,
30};
31
32static struct ipr_desc ipr_irq_desc = {
33 .ipr_offsets = ipr_offsets,
34 .nr_offsets = ARRAY_SIZE(ipr_offsets),
35
36 .ipr_data = ipr_irq_table,
37 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
38
39 .chip = {
40 .name = "IPR-se7751",
41 },
42};
43
44/*
45 * Initialize IRQ setting
46 */
47void __init init_7751se_IRQ(void)
48{
49 register_ipr_controller(&ipr_irq_desc);
50}
diff --git a/arch/sh/boards/se/7751/pci.c b/arch/sh/boards/mach-se/7751/pci.c
index 203b2923fe7f..203b2923fe7f 100644
--- a/arch/sh/boards/se/7751/pci.c
+++ b/arch/sh/boards/mach-se/7751/pci.c
diff --git a/arch/sh/boards/mach-se/7751/setup.c b/arch/sh/boards/mach-se/7751/setup.c
new file mode 100644
index 000000000000..50572512e3e8
--- /dev/null
+++ b/arch/sh/boards/mach-se/7751/setup.c
@@ -0,0 +1,78 @@
1/*
2 * linux/arch/sh/boards/se/7751/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 * Modified for 7751 Solution Engine by
9 * Ian da Silva and Jeremy Siegel, 2001.
10 */
11#include <linux/init.h>
12#include <linux/platform_device.h>
13#include <asm/machvec.h>
14#include <mach-se/mach/se7751.h>
15#include <asm/io.h>
16#include <asm/heartbeat.h>
17
18static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
19
20static struct heartbeat_data heartbeat_data = {
21 .bit_pos = heartbeat_bit_pos,
22 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
23};
24
25static struct resource heartbeat_resources[] = {
26 [0] = {
27 .start = PA_LED,
28 .end = PA_LED,
29 .flags = IORESOURCE_MEM,
30 },
31};
32
33static struct platform_device heartbeat_device = {
34 .name = "heartbeat",
35 .id = -1,
36 .dev = {
37 .platform_data = &heartbeat_data,
38 },
39 .num_resources = ARRAY_SIZE(heartbeat_resources),
40 .resource = heartbeat_resources,
41};
42
43static struct platform_device *se7751_devices[] __initdata = {
44 &heartbeat_device,
45};
46
47static int __init se7751_devices_setup(void)
48{
49 return platform_add_devices(se7751_devices, ARRAY_SIZE(se7751_devices));
50}
51__initcall(se7751_devices_setup);
52
53/*
54 * The Machine Vector
55 */
56static struct sh_machine_vector mv_7751se __initmv = {
57 .mv_name = "7751 SolutionEngine",
58 .mv_nr_irqs = 72,
59
60 .mv_inb = sh7751se_inb,
61 .mv_inw = sh7751se_inw,
62 .mv_inl = sh7751se_inl,
63 .mv_outb = sh7751se_outb,
64 .mv_outw = sh7751se_outw,
65 .mv_outl = sh7751se_outl,
66
67 .mv_inb_p = sh7751se_inb_p,
68 .mv_inw_p = sh7751se_inw,
69 .mv_inl_p = sh7751se_inl,
70 .mv_outb_p = sh7751se_outb_p,
71 .mv_outw_p = sh7751se_outw,
72 .mv_outl_p = sh7751se_outl,
73
74 .mv_insl = sh7751se_insl,
75 .mv_outsl = sh7751se_outsl,
76
77 .mv_init_irq = init_7751se_IRQ,
78};
diff --git a/arch/sh/boards/se/7780/Makefile b/arch/sh/boards/mach-se/7780/Makefile
index 6b88adae3ecc..6b88adae3ecc 100644
--- a/arch/sh/boards/se/7780/Makefile
+++ b/arch/sh/boards/mach-se/7780/Makefile
diff --git a/arch/sh/boards/mach-se/7780/irq.c b/arch/sh/boards/mach-se/7780/irq.c
new file mode 100644
index 000000000000..66ad292c9fc3
--- /dev/null
+++ b/arch/sh/boards/mach-se/7780/irq.c
@@ -0,0 +1,46 @@
1/*
2 * linux/arch/sh/boards/se/7780/irq.c
3 *
4 * Copyright (C) 2006,2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7780 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/interrupt.h>
15#include <asm/irq.h>
16#include <asm/io.h>
17#include <mach-se/mach/se7780.h>
18
19/*
20 * Initialize IRQ setting
21 */
22void __init init_se7780_IRQ(void)
23{
24 /* enable all interrupt at FPGA */
25 ctrl_outw(0, FPGA_INTMSK1);
26 /* mask SM501 interrupt */
27 ctrl_outw((ctrl_inw(FPGA_INTMSK1) | 0x0002), FPGA_INTMSK1);
28 /* enable all interrupt at FPGA */
29 ctrl_outw(0, FPGA_INTMSK2);
30
31 /* set FPGA INTSEL register */
32 /* FPGA + 0x06 */
33 ctrl_outw( ((IRQPIN_SM501 << IRQPOS_SM501) |
34 (IRQPIN_SMC91CX << IRQPOS_SMC91CX)), FPGA_INTSEL1);
35
36 /* FPGA + 0x08 */
37 ctrl_outw(((IRQPIN_EXTINT4 << IRQPOS_EXTINT4) |
38 (IRQPIN_EXTINT3 << IRQPOS_EXTINT3) |
39 (IRQPIN_EXTINT2 << IRQPOS_EXTINT2) |
40 (IRQPIN_EXTINT1 << IRQPOS_EXTINT1)), FPGA_INTSEL2);
41
42 /* FPGA + 0x0A */
43 ctrl_outw((IRQPIN_PCCPW << IRQPOS_PCCPW), FPGA_INTSEL3);
44
45 plat_irq_setup_pins(IRQ_MODE_IRQ); /* install handlers for IRQ0-7 */
46}
diff --git a/arch/sh/boards/mach-se/7780/setup.c b/arch/sh/boards/mach-se/7780/setup.c
new file mode 100644
index 000000000000..1d3a867e94e3
--- /dev/null
+++ b/arch/sh/boards/mach-se/7780/setup.c
@@ -0,0 +1,124 @@
1/*
2 * linux/arch/sh/boards/se/7780/setup.c
3 *
4 * Copyright (C) 2006,2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7780 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <asm/machvec.h>
15#include <mach-se/mach/se7780.h>
16#include <asm/io.h>
17#include <asm/heartbeat.h>
18
19/* Heartbeat */
20static struct heartbeat_data heartbeat_data = {
21 .regsize = 16,
22};
23
24static struct resource heartbeat_resources[] = {
25 [0] = {
26 .start = PA_LED,
27 .end = PA_LED,
28 .flags = IORESOURCE_MEM,
29 },
30};
31
32static struct platform_device heartbeat_device = {
33 .name = "heartbeat",
34 .id = -1,
35 .dev = {
36 .platform_data = &heartbeat_data,
37 },
38 .num_resources = ARRAY_SIZE(heartbeat_resources),
39 .resource = heartbeat_resources,
40};
41
42/* SMC91x */
43static struct resource smc91x_eth_resources[] = {
44 [0] = {
45 .name = "smc91x-regs" ,
46 .start = PA_LAN + 0x300,
47 .end = PA_LAN + 0x300 + 0x10 ,
48 .flags = IORESOURCE_MEM,
49 },
50 [1] = {
51 .start = SMC_IRQ,
52 .end = SMC_IRQ,
53 .flags = IORESOURCE_IRQ,
54 },
55};
56
57static struct platform_device smc91x_eth_device = {
58 .name = "smc91x",
59 .id = 0,
60 .dev = {
61 .dma_mask = NULL, /* don't use dma */
62 .coherent_dma_mask = 0xffffffff,
63 },
64 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
65 .resource = smc91x_eth_resources,
66};
67
68static struct platform_device *se7780_devices[] __initdata = {
69 &heartbeat_device,
70 &smc91x_eth_device,
71};
72
73static int __init se7780_devices_setup(void)
74{
75 return platform_add_devices(se7780_devices,
76 ARRAY_SIZE(se7780_devices));
77}
78device_initcall(se7780_devices_setup);
79
80#define GPIO_PHCR 0xFFEA000E
81#define GPIO_PMSELR 0xFFEA0080
82#define GPIO_PECR 0xFFEA0008
83
84static void __init se7780_setup(char **cmdline_p)
85{
86 /* "SH-Linux" on LED Display */
87 ctrl_outw( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) );
88 ctrl_outw( 'H' , PA_LED_DISP + (DISP_SEL1_ADDR << 1) );
89 ctrl_outw( '-' , PA_LED_DISP + (DISP_SEL2_ADDR << 1) );
90 ctrl_outw( 'L' , PA_LED_DISP + (DISP_SEL3_ADDR << 1) );
91 ctrl_outw( 'i' , PA_LED_DISP + (DISP_SEL4_ADDR << 1) );
92 ctrl_outw( 'n' , PA_LED_DISP + (DISP_SEL5_ADDR << 1) );
93 ctrl_outw( 'u' , PA_LED_DISP + (DISP_SEL6_ADDR << 1) );
94 ctrl_outw( 'x' , PA_LED_DISP + (DISP_SEL7_ADDR << 1) );
95
96 printk(KERN_INFO "Hitachi UL Solutions Engine 7780SE03 support.\n");
97
98 /*
99 * PCI REQ/GNT setting
100 * REQ0/GNT0 -> USB
101 * REQ1/GNT1 -> PC Card
102 * REQ2/GNT2 -> Serial ATA
103 * REQ3/GNT3 -> PCI slot
104 */
105 ctrl_outw(0x0213, FPGA_REQSEL);
106
107 /* GPIO setting */
108 ctrl_outw(0x0000, GPIO_PECR);
109 ctrl_outw(ctrl_inw(GPIO_PHCR)&0xfff3, GPIO_PHCR);
110 ctrl_outw(0x0c00, GPIO_PMSELR);
111
112 /* iVDR Power ON */
113 ctrl_outw(0x0001, FPGA_IVDRPW);
114}
115
116/*
117 * The Machine Vector
118 */
119static struct sh_machine_vector mv_se7780 __initmv = {
120 .mv_name = "Solution Engine 7780" ,
121 .mv_setup = se7780_setup ,
122 .mv_nr_irqs = 111 ,
123 .mv_init_irq = init_se7780_IRQ,
124};
diff --git a/arch/sh/boards/mach-se/Makefile b/arch/sh/boards/mach-se/Makefile
new file mode 100644
index 000000000000..2de42bae4b4f
--- /dev/null
+++ b/arch/sh/boards/mach-se/Makefile
@@ -0,0 +1,9 @@
1obj-$(CONFIG_SH_7619_SOLUTION_ENGINE) += board-se7619.o
2
3obj-$(CONFIG_SH_SOLUTION_ENGINE) += 770x/
4obj-$(CONFIG_SH_7206_SOLUTION_ENGINE) += 7206/
5obj-$(CONFIG_SH_7722_SOLUTION_ENGINE) += 7722/
6obj-$(CONFIG_SH_7751_SOLUTION_ENGINE) += 7751/
7obj-$(CONFIG_SH_7780_SOLUTION_ENGINE) += 7780/
8obj-$(CONFIG_SH_7343_SOLUTION_ENGINE) += 7343/
9obj-$(CONFIG_SH_7721_SOLUTION_ENGINE) += 7721/
diff --git a/arch/sh/boards/se/7619/setup.c b/arch/sh/boards/mach-se/board-se7619.c
index 1d0ef7faa10d..1d0ef7faa10d 100644
--- a/arch/sh/boards/se/7619/setup.c
+++ b/arch/sh/boards/mach-se/board-se7619.c
diff --git a/arch/sh/boards/sh03/Makefile b/arch/sh/boards/mach-sh03/Makefile
index 400306a796ec..400306a796ec 100644
--- a/arch/sh/boards/sh03/Makefile
+++ b/arch/sh/boards/mach-sh03/Makefile
diff --git a/arch/sh/boards/sh03/rtc.c b/arch/sh/boards/mach-sh03/rtc.c
index 0a9266bb51c5..0a9266bb51c5 100644
--- a/arch/sh/boards/sh03/rtc.c
+++ b/arch/sh/boards/mach-sh03/rtc.c
diff --git a/arch/sh/boards/mach-sh03/setup.c b/arch/sh/boards/mach-sh03/setup.c
new file mode 100644
index 000000000000..5771219be3fd
--- /dev/null
+++ b/arch/sh/boards/mach-sh03/setup.c
@@ -0,0 +1,75 @@
1/*
2 * linux/arch/sh/boards/sh03/setup.c
3 *
4 * Copyright (C) 2004 Interface Co.,Ltd. Saito.K
5 *
6 */
7
8#include <linux/init.h>
9#include <linux/irq.h>
10#include <linux/pci.h>
11#include <linux/platform_device.h>
12#include <asm/io.h>
13#include <asm/rtc.h>
14#include <mach-sh03/mach/io.h>
15#include <mach-sh03/mach/sh03.h>
16#include <asm/addrspace.h>
17
18static void __init init_sh03_IRQ(void)
19{
20 plat_irq_setup_pins(IRQ_MODE_IRQ);
21}
22
23extern void *cf_io_base;
24
25static void __iomem *sh03_ioport_map(unsigned long port, unsigned int size)
26{
27 if (PXSEG(port))
28 return (void __iomem *)port;
29 /* CompactFlash (IDE) */
30 if (((port >= 0x1f0) && (port <= 0x1f7)) || (port == 0x3f6))
31 return (void __iomem *)((unsigned long)cf_io_base + port);
32
33 return (void __iomem *)(port + PCI_IO_BASE);
34}
35
36/* arch/sh/boards/sh03/rtc.c */
37void sh03_time_init(void);
38
39static void __init sh03_setup(char **cmdline_p)
40{
41 board_time_init = sh03_time_init;
42}
43
44static struct resource heartbeat_resources[] = {
45 [0] = {
46 .start = 0xa0800000,
47 .end = 0xa0800000,
48 .flags = IORESOURCE_MEM,
49 },
50};
51
52static struct platform_device heartbeat_device = {
53 .name = "heartbeat",
54 .id = -1,
55 .num_resources = ARRAY_SIZE(heartbeat_resources),
56 .resource = heartbeat_resources,
57};
58
59static struct platform_device *sh03_devices[] __initdata = {
60 &heartbeat_device,
61};
62
63static int __init sh03_devices_setup(void)
64{
65 return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices));
66}
67__initcall(sh03_devices_setup);
68
69static struct sh_machine_vector mv_sh03 __initmv = {
70 .mv_name = "Interface (CTP/PCI-SH03)",
71 .mv_setup = sh03_setup,
72 .mv_nr_irqs = 48,
73 .mv_ioport_map = sh03_ioport_map,
74 .mv_init_irq = init_sh03_IRQ,
75};
diff --git a/arch/sh/boards/mach-sh7763rdp/Makefile b/arch/sh/boards/mach-sh7763rdp/Makefile
new file mode 100644
index 000000000000..f6c0b55516d2
--- /dev/null
+++ b/arch/sh/boards/mach-sh7763rdp/Makefile
@@ -0,0 +1 @@
obj-y := setup.o irq.o
diff --git a/arch/sh/boards/mach-sh7763rdp/irq.c b/arch/sh/boards/mach-sh7763rdp/irq.c
new file mode 100644
index 000000000000..fd850bad2dec
--- /dev/null
+++ b/arch/sh/boards/mach-sh7763rdp/irq.c
@@ -0,0 +1,45 @@
1/*
2 * linux/arch/sh/boards/renesas/sh7763rdp/irq.c
3 *
4 * Renesas Solutions SH7763RDP Support.
5 *
6 * Copyright (C) 2008 Renesas Solutions Corp.
7 * Copyright (C) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13
14#include <linux/init.h>
15#include <linux/irq.h>
16#include <asm/io.h>
17#include <asm/irq.h>
18#include <asm/sh7763rdp.h>
19
20#define INTC_BASE (0xFFD00000)
21#define INTC_INT2PRI7 (INTC_BASE+0x4001C)
22#define INTC_INT2MSKCR (INTC_BASE+0x4003C)
23#define INTC_INT2MSKCR1 (INTC_BASE+0x400D4)
24
25/*
26 * Initialize IRQ setting
27 */
28void __init init_sh7763rdp_IRQ(void)
29{
30 /* GPIO enabled */
31 ctrl_outl(1 << 25, INTC_INT2MSKCR);
32
33 /* enable GPIO interrupts */
34 ctrl_outl((ctrl_inl(INTC_INT2PRI7) & 0xFF00FFFF) | 0x000F0000,
35 INTC_INT2PRI7);
36
37 /* USBH enabled */
38 ctrl_outl(1 << 17, INTC_INT2MSKCR1);
39
40 /* GETHER enabled */
41 ctrl_outl(1 << 16, INTC_INT2MSKCR1);
42
43 /* DMAC enabled */
44 ctrl_outl(1 << 8, INTC_INT2MSKCR);
45}
diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c b/arch/sh/boards/mach-sh7763rdp/setup.c
new file mode 100644
index 000000000000..925f16af7121
--- /dev/null
+++ b/arch/sh/boards/mach-sh7763rdp/setup.c
@@ -0,0 +1,128 @@
1/*
2 * linux/arch/sh/boards/renesas/sh7763rdp/setup.c
3 *
4 * Renesas Solutions sh7763rdp board
5 *
6 * Copyright (C) 2008 Renesas Solutions Corp.
7 * Copyright (C) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/interrupt.h>
16#include <linux/input.h>
17#include <linux/mtd/physmap.h>
18#include <asm/io.h>
19#include <asm/sh7763rdp.h>
20
21/* NOR Flash */
22static struct mtd_partition sh7763rdp_nor_flash_partitions[] = {
23 {
24 .name = "U-Boot",
25 .offset = 0,
26 .size = (2 * 128 * 1024),
27 .mask_flags = MTD_WRITEABLE, /* Read-only */
28 }, {
29 .name = "Linux-Kernel",
30 .offset = MTDPART_OFS_APPEND,
31 .size = (20 * 128 * 1024),
32 }, {
33 .name = "Root Filesystem",
34 .offset = MTDPART_OFS_APPEND,
35 .size = MTDPART_SIZ_FULL,
36 },
37};
38
39static struct physmap_flash_data sh7763rdp_nor_flash_data = {
40 .width = 2,
41 .parts = sh7763rdp_nor_flash_partitions,
42 .nr_parts = ARRAY_SIZE(sh7763rdp_nor_flash_partitions),
43};
44
45static struct resource sh7763rdp_nor_flash_resources[] = {
46 [0] = {
47 .name = "NOR Flash",
48 .start = 0,
49 .end = (64 * 1024 * 1024),
50 .flags = IORESOURCE_MEM,
51 },
52};
53
54static struct platform_device sh7763rdp_nor_flash_device = {
55 .name = "physmap-flash",
56 .resource = sh7763rdp_nor_flash_resources,
57 .num_resources = ARRAY_SIZE(sh7763rdp_nor_flash_resources),
58 .dev = {
59 .platform_data = &sh7763rdp_nor_flash_data,
60 },
61};
62
63static struct platform_device *sh7763rdp_devices[] __initdata = {
64 &sh7763rdp_nor_flash_device,
65};
66
67static int __init sh7763rdp_devices_setup(void)
68{
69 return platform_add_devices(sh7763rdp_devices,
70 ARRAY_SIZE(sh7763rdp_devices));
71}
72__initcall(sh7763rdp_devices_setup);
73
74static void __init sh7763rdp_setup(char **cmdline_p)
75{
76 /* Board version check */
77 if (ctrl_inw(CPLD_BOARD_ID_ERV_REG) == 0xECB1)
78 printk(KERN_INFO "RTE Standard Configuration\n");
79 else
80 printk(KERN_INFO "RTA Standard Configuration\n");
81
82 /* USB pin select bits (clear bit 5-2 to 0) */
83 ctrl_outw((ctrl_inw(PORT_PSEL2) & 0xFFC3), PORT_PSEL2);
84 /* USBH setup port I controls to other (clear bits 4-9 to 0) */
85 ctrl_outw(ctrl_inw(PORT_PICR) & 0xFC0F, PORT_PICR);
86
87 /* Select USB Host controller */
88 ctrl_outw(0x00, USB_USBHSC);
89
90 /* For LCD */
91 /* set PTJ7-1, bits 15-2 of PJCR to 0 */
92 ctrl_outw(ctrl_inw(PORT_PJCR) & 0x0003, PORT_PJCR);
93 /* set PTI5, bits 11-10 of PICR to 0 */
94 ctrl_outw(ctrl_inw(PORT_PICR) & 0xF3FF, PORT_PICR);
95 ctrl_outw(0, PORT_PKCR);
96 ctrl_outw(0, PORT_PLCR);
97 /* set PSEL2 bits 14-8, 5-4, of PSEL2 to 0 */
98 ctrl_outw((ctrl_inw(PORT_PSEL2) & 0x00C0), PORT_PSEL2);
99 /* set PSEL3 bits 14-12, 6-4, 2-0 of PSEL3 to 0 */
100 ctrl_outw((ctrl_inw(PORT_PSEL3) & 0x0700), PORT_PSEL3);
101
102 /* For HAC */
103 /* bit3-0 0100:HAC & SSI1 enable */
104 ctrl_outw((ctrl_inw(PORT_PSEL1) & 0xFFF0) | 0x0004, PORT_PSEL1);
105 /* bit14 1:SSI_HAC_CLK enable */
106 ctrl_outw(ctrl_inw(PORT_PSEL4) | 0x4000, PORT_PSEL4);
107
108 /* SH-Ether */
109 ctrl_outw((ctrl_inw(PORT_PSEL1) & ~0xff00) | 0x2400, PORT_PSEL1);
110 ctrl_outw(0x0, PORT_PFCR);
111 ctrl_outw(0x0, PORT_PFCR);
112 ctrl_outw(0x0, PORT_PFCR);
113
114 /* MMC */
115 /*selects SCIF and MMC other functions */
116 ctrl_outw(0x0001, PORT_PSEL0);
117 /* MMC clock operates */
118 ctrl_outl(ctrl_inl(MSTPCR1) & ~0x8, MSTPCR1);
119 ctrl_outw(ctrl_inw(PORT_PACR) & ~0x3000, PORT_PACR);
120 ctrl_outw(ctrl_inw(PORT_PCCR) & ~0xCFC3, PORT_PCCR);
121}
122
123static struct sh_machine_vector mv_sh7763rdp __initmv = {
124 .mv_name = "sh7763drp",
125 .mv_setup = sh7763rdp_setup,
126 .mv_nr_irqs = 112,
127 .mv_init_irq = init_sh7763rdp_IRQ,
128};
diff --git a/arch/sh/boards/snapgear/Makefile b/arch/sh/boards/mach-snapgear/Makefile
index d2d2f4b6a502..d2d2f4b6a502 100644
--- a/arch/sh/boards/snapgear/Makefile
+++ b/arch/sh/boards/mach-snapgear/Makefile
diff --git a/arch/sh/boards/snapgear/io.c b/arch/sh/boards/mach-snapgear/io.c
index 0f4824264557..0f4824264557 100644
--- a/arch/sh/boards/snapgear/io.c
+++ b/arch/sh/boards/mach-snapgear/io.c
diff --git a/arch/sh/boards/mach-snapgear/setup.c b/arch/sh/boards/mach-snapgear/setup.c
new file mode 100644
index 000000000000..a5e349d3dda2
--- /dev/null
+++ b/arch/sh/boards/mach-snapgear/setup.c
@@ -0,0 +1,95 @@
1/*
2 * linux/arch/sh/boards/snapgear/setup.c
3 *
4 * Copyright (C) 2002 David McCullough <davidm@snapgear.com>
5 * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
6 *
7 * Based on files with the following comments:
8 *
9 * Copyright (C) 2000 Kazumoto Kojima
10 *
11 * Modified for 7751 Solution Engine by
12 * Ian da Silva and Jeremy Siegel, 2001.
13 */
14#include <linux/init.h>
15#include <linux/irq.h>
16#include <linux/interrupt.h>
17#include <linux/timer.h>
18#include <linux/delay.h>
19#include <linux/module.h>
20#include <linux/sched.h>
21#include <asm/machvec.h>
22#include <asm/snapgear.h>
23#include <asm/irq.h>
24#include <asm/io.h>
25#include <cpu/timer.h>
26
27/*
28 * EraseConfig handling functions
29 */
30
31static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
32{
33 (void)ctrl_inb(0xb8000000); /* dummy read */
34
35 printk("SnapGear: erase switch interrupt!\n");
36
37 return IRQ_HANDLED;
38}
39
40static int __init eraseconfig_init(void)
41{
42 printk("SnapGear: EraseConfig init\n");
43 /* Setup "EraseConfig" switch on external IRQ 0 */
44 if (request_irq(IRL0_IRQ, eraseconfig_interrupt, IRQF_DISABLED,
45 "Erase Config", NULL))
46 printk("SnapGear: failed to register IRQ%d for Reset witch\n",
47 IRL0_IRQ);
48 else
49 printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
50 IRL0_IRQ);
51 return(0);
52}
53
54module_init(eraseconfig_init);
55
56/****************************************************************************/
57/*
58 * Initialize IRQ setting
59 *
60 * IRL0 = erase switch
61 * IRL1 = eth0
62 * IRL2 = eth1
63 * IRL3 = crypto
64 */
65
66static void __init init_snapgear_IRQ(void)
67{
68 printk("Setup SnapGear IRQ/IPR ...\n");
69 /* enable individual interrupt mode for externals */
70 plat_irq_setup_pins(IRQ_MODE_IRQ);
71}
72
73/*
74 * The Machine Vector
75 */
76static struct sh_machine_vector mv_snapgear __initmv = {
77 .mv_name = "SnapGear SecureEdge5410",
78 .mv_nr_irqs = 72,
79
80 .mv_inb = snapgear_inb,
81 .mv_inw = snapgear_inw,
82 .mv_inl = snapgear_inl,
83 .mv_outb = snapgear_outb,
84 .mv_outw = snapgear_outw,
85 .mv_outl = snapgear_outl,
86
87 .mv_inb_p = snapgear_inb_p,
88 .mv_inw_p = snapgear_inw,
89 .mv_inl_p = snapgear_inl,
90 .mv_outb_p = snapgear_outb_p,
91 .mv_outw_p = snapgear_outw,
92 .mv_outl_p = snapgear_outl,
93
94 .mv_init_irq = init_snapgear_IRQ,
95};
diff --git a/arch/sh/boards/renesas/systemh/Makefile b/arch/sh/boards/mach-systemh/Makefile
index 2cc6a23d9d39..2cc6a23d9d39 100644
--- a/arch/sh/boards/renesas/systemh/Makefile
+++ b/arch/sh/boards/mach-systemh/Makefile
diff --git a/arch/sh/boards/renesas/systemh/io.c b/arch/sh/boards/mach-systemh/io.c
index 1b767e1a1428..1b767e1a1428 100644
--- a/arch/sh/boards/renesas/systemh/io.c
+++ b/arch/sh/boards/mach-systemh/io.c
diff --git a/arch/sh/boards/renesas/systemh/irq.c b/arch/sh/boards/mach-systemh/irq.c
index 0ba2fe674c47..0ba2fe674c47 100644
--- a/arch/sh/boards/renesas/systemh/irq.c
+++ b/arch/sh/boards/mach-systemh/irq.c
diff --git a/arch/sh/boards/renesas/systemh/setup.c b/arch/sh/boards/mach-systemh/setup.c
index ee78af842778..ee78af842778 100644
--- a/arch/sh/boards/renesas/systemh/setup.c
+++ b/arch/sh/boards/mach-systemh/setup.c
diff --git a/arch/sh/boards/titan/Makefile b/arch/sh/boards/mach-titan/Makefile
index 08d753700062..08d753700062 100644
--- a/arch/sh/boards/titan/Makefile
+++ b/arch/sh/boards/mach-titan/Makefile
diff --git a/arch/sh/boards/titan/io.c b/arch/sh/boards/mach-titan/io.c
index 4730c1dd697d..4730c1dd697d 100644
--- a/arch/sh/boards/titan/io.c
+++ b/arch/sh/boards/mach-titan/io.c
diff --git a/arch/sh/boards/titan/setup.c b/arch/sh/boards/mach-titan/setup.c
index 5de3b2ad71af..5de3b2ad71af 100644
--- a/arch/sh/boards/titan/setup.c
+++ b/arch/sh/boards/mach-titan/setup.c
diff --git a/arch/sh/boards/renesas/x3proto/Makefile b/arch/sh/boards/mach-x3proto/Makefile
index 983e4551fecf..983e4551fecf 100644
--- a/arch/sh/boards/renesas/x3proto/Makefile
+++ b/arch/sh/boards/mach-x3proto/Makefile
diff --git a/arch/sh/boards/renesas/x3proto/ilsel.c b/arch/sh/boards/mach-x3proto/ilsel.c
index b5c673c39337..b5c673c39337 100644
--- a/arch/sh/boards/renesas/x3proto/ilsel.c
+++ b/arch/sh/boards/mach-x3proto/ilsel.c
diff --git a/arch/sh/boards/renesas/x3proto/setup.c b/arch/sh/boards/mach-x3proto/setup.c
index abc5b6d418fe..abc5b6d418fe 100644
--- a/arch/sh/boards/renesas/x3proto/setup.c
+++ b/arch/sh/boards/mach-x3proto/setup.c
diff --git a/arch/sh/boards/magicpanelr2/Kconfig b/arch/sh/boards/magicpanelr2/Kconfig
deleted file mode 100644
index b0abddc3e84f..000000000000
--- a/arch/sh/boards/magicpanelr2/Kconfig
+++ /dev/null
@@ -1,13 +0,0 @@
1if SH_MAGIC_PANEL_R2
2
3menu "Magic Panel R2 options"
4
5config SH_MAGIC_PANEL_R2_VERSION
6 int SH_MAGIC_PANEL_R2_VERSION
7 default "3"
8 help
9 Set the version of the Magic Panel R2
10
11endmenu
12
13endif
diff --git a/arch/sh/boards/magicpanelr2/Makefile b/arch/sh/boards/magicpanelr2/Makefile
deleted file mode 100644
index 7a6d586b9072..000000000000
--- a/arch/sh/boards/magicpanelr2/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the Magic Panel specific parts
3#
4
5obj-y := setup.o \ No newline at end of file
diff --git a/arch/sh/boards/renesas/migor/Makefile b/arch/sh/boards/renesas/migor/Makefile
deleted file mode 100644
index 77037567633b..000000000000
--- a/arch/sh/boards/renesas/migor/Makefile
+++ /dev/null
@@ -1 +0,0 @@
1obj-y := setup.o
diff --git a/arch/sh/boards/renesas/migor/setup.c b/arch/sh/boards/renesas/migor/setup.c
deleted file mode 100644
index 963c99322095..000000000000
--- a/arch/sh/boards/renesas/migor/setup.c
+++ /dev/null
@@ -1,257 +0,0 @@
1/*
2 * Renesas System Solutions Asia Pte. Ltd - Migo-R
3 *
4 * Copyright (C) 2008 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/interrupt.h>
13#include <linux/input.h>
14#include <linux/mtd/physmap.h>
15#include <linux/mtd/nand.h>
16#include <linux/i2c.h>
17#include <linux/smc91x.h>
18#include <asm/machvec.h>
19#include <asm/io.h>
20#include <asm/sh_keysc.h>
21#include <asm/migor.h>
22
23/* Address IRQ Size Bus Description
24 * 0x00000000 64MB 16 NOR Flash (SP29PL256N)
25 * 0x0c000000 64MB 64 SDRAM (2xK4M563233G)
26 * 0x10000000 IRQ0 16 Ethernet (SMC91C111)
27 * 0x14000000 IRQ4 16 USB 2.0 Host Controller (M66596)
28 * 0x18000000 8GB 8 NAND Flash (K9K8G08U0A)
29 */
30
31static struct smc91x_platdata smc91x_info = {
32 .flags = SMC91X_USE_16BIT,
33};
34
35static struct resource smc91x_eth_resources[] = {
36 [0] = {
37 .name = "SMC91C111" ,
38 .start = 0x10000300,
39 .end = 0x1000030f,
40 .flags = IORESOURCE_MEM,
41 },
42 [1] = {
43 .start = 32, /* IRQ0 */
44 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
45 },
46};
47
48static struct platform_device smc91x_eth_device = {
49 .name = "smc91x",
50 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
51 .resource = smc91x_eth_resources,
52 .dev = {
53 .platform_data = &smc91x_info,
54 },
55};
56
57static struct sh_keysc_info sh_keysc_info = {
58 .mode = SH_KEYSC_MODE_2, /* KEYOUT0->4, KEYIN1->5 */
59 .scan_timing = 3,
60 .delay = 5,
61 .keycodes = {
62 0, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_ENTER,
63 0, KEY_F, KEY_C, KEY_D, KEY_H, KEY_1,
64 0, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6,
65 0, KEY_7, KEY_8, KEY_9, KEY_S, KEY_0,
66 0, KEY_P, KEY_STOP, KEY_REWIND, KEY_PLAY, KEY_FASTFORWARD,
67 },
68};
69
70static struct resource sh_keysc_resources[] = {
71 [0] = {
72 .start = 0x044b0000,
73 .end = 0x044b000f,
74 .flags = IORESOURCE_MEM,
75 },
76 [1] = {
77 .start = 79,
78 .flags = IORESOURCE_IRQ,
79 },
80};
81
82static struct platform_device sh_keysc_device = {
83 .name = "sh_keysc",
84 .num_resources = ARRAY_SIZE(sh_keysc_resources),
85 .resource = sh_keysc_resources,
86 .dev = {
87 .platform_data = &sh_keysc_info,
88 },
89};
90
91static struct mtd_partition migor_nor_flash_partitions[] =
92{
93 {
94 .name = "uboot",
95 .offset = 0,
96 .size = (1 * 1024 * 1024),
97 .mask_flags = MTD_WRITEABLE, /* Read-only */
98 },
99 {
100 .name = "rootfs",
101 .offset = MTDPART_OFS_APPEND,
102 .size = (15 * 1024 * 1024),
103 },
104 {
105 .name = "other",
106 .offset = MTDPART_OFS_APPEND,
107 .size = MTDPART_SIZ_FULL,
108 },
109};
110
111static struct physmap_flash_data migor_nor_flash_data = {
112 .width = 2,
113 .parts = migor_nor_flash_partitions,
114 .nr_parts = ARRAY_SIZE(migor_nor_flash_partitions),
115};
116
117static struct resource migor_nor_flash_resources[] = {
118 [0] = {
119 .name = "NOR Flash",
120 .start = 0x00000000,
121 .end = 0x03ffffff,
122 .flags = IORESOURCE_MEM,
123 }
124};
125
126static struct platform_device migor_nor_flash_device = {
127 .name = "physmap-flash",
128 .resource = migor_nor_flash_resources,
129 .num_resources = ARRAY_SIZE(migor_nor_flash_resources),
130 .dev = {
131 .platform_data = &migor_nor_flash_data,
132 },
133};
134
135static struct mtd_partition migor_nand_flash_partitions[] = {
136 {
137 .name = "nanddata1",
138 .offset = 0x0,
139 .size = 512 * 1024 * 1024,
140 },
141 {
142 .name = "nanddata2",
143 .offset = MTDPART_OFS_APPEND,
144 .size = 512 * 1024 * 1024,
145 },
146};
147
148static void migor_nand_flash_cmd_ctl(struct mtd_info *mtd, int cmd,
149 unsigned int ctrl)
150{
151 struct nand_chip *chip = mtd->priv;
152
153 if (cmd == NAND_CMD_NONE)
154 return;
155
156 if (ctrl & NAND_CLE)
157 writeb(cmd, chip->IO_ADDR_W + 0x00400000);
158 else if (ctrl & NAND_ALE)
159 writeb(cmd, chip->IO_ADDR_W + 0x00800000);
160 else
161 writeb(cmd, chip->IO_ADDR_W);
162}
163
164static int migor_nand_flash_ready(struct mtd_info *mtd)
165{
166 return ctrl_inb(PORT_PADR) & 0x02; /* PTA1 */
167}
168
169struct platform_nand_data migor_nand_flash_data = {
170 .chip = {
171 .nr_chips = 1,
172 .partitions = migor_nand_flash_partitions,
173 .nr_partitions = ARRAY_SIZE(migor_nand_flash_partitions),
174 .chip_delay = 20,
175 .part_probe_types = (const char *[]) { "cmdlinepart", NULL },
176 },
177 .ctrl = {
178 .dev_ready = migor_nand_flash_ready,
179 .cmd_ctrl = migor_nand_flash_cmd_ctl,
180 },
181};
182
183static struct resource migor_nand_flash_resources[] = {
184 [0] = {
185 .name = "NAND Flash",
186 .start = 0x18000000,
187 .end = 0x18ffffff,
188 .flags = IORESOURCE_MEM,
189 },
190};
191
192static struct platform_device migor_nand_flash_device = {
193 .name = "gen_nand",
194 .resource = migor_nand_flash_resources,
195 .num_resources = ARRAY_SIZE(migor_nand_flash_resources),
196 .dev = {
197 .platform_data = &migor_nand_flash_data,
198 }
199};
200
201static struct platform_device *migor_devices[] __initdata = {
202 &smc91x_eth_device,
203 &sh_keysc_device,
204 &migor_nor_flash_device,
205 &migor_nand_flash_device,
206};
207
208static struct i2c_board_info __initdata migor_i2c_devices[] = {
209 {
210 I2C_BOARD_INFO("rs5c372b", 0x32),
211 },
212 {
213 I2C_BOARD_INFO("migor_ts", 0x51),
214 .irq = 38, /* IRQ6 */
215 },
216};
217
218static int __init migor_devices_setup(void)
219{
220 i2c_register_board_info(0, migor_i2c_devices,
221 ARRAY_SIZE(migor_i2c_devices));
222
223 return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices));
224}
225__initcall(migor_devices_setup);
226
227static void __init migor_setup(char **cmdline_p)
228{
229 /* SMC91C111 - Enable IRQ0 */
230 ctrl_outw(ctrl_inw(PORT_PJCR) & ~0x0003, PORT_PJCR);
231
232 /* KEYSC */
233 ctrl_outw(ctrl_inw(PORT_PYCR) & ~0x0fff, PORT_PYCR);
234 ctrl_outw(ctrl_inw(PORT_PZCR) & ~0x0ff0, PORT_PZCR);
235 ctrl_outw(ctrl_inw(PORT_PSELA) & ~0x4100, PORT_PSELA);
236 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
237 ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
238 ctrl_outl(ctrl_inl(MSTPCR2) & ~0x00004000, MSTPCR2);
239
240 /* NAND Flash */
241 ctrl_outw(ctrl_inw(PORT_PXCR) & 0x0fff, PORT_PXCR);
242 ctrl_outl((ctrl_inl(BSC_CS6ABCR) & ~0x00000600) | 0x00000200,
243 BSC_CS6ABCR);
244
245 /* I2C */
246 ctrl_outl(ctrl_inl(MSTPCR1) & ~0x00000200, MSTPCR1);
247
248 /* Touch Panel - Enable IRQ6 */
249 ctrl_outw(ctrl_inw(PORT_PZCR) & ~0xc, PORT_PZCR);
250 ctrl_outw((ctrl_inw(PORT_PSELA) | 0x8000), PORT_PSELA);
251 ctrl_outw((ctrl_inw(PORT_HIZCRC) & ~0x4000), PORT_HIZCRC);
252}
253
254static struct sh_machine_vector mv_migor __initmv = {
255 .mv_name = "Migo-R",
256 .mv_setup = migor_setup,
257};
diff --git a/arch/sh/boards/renesas/r7780rp/psw.c b/arch/sh/boards/renesas/r7780rp/psw.c
deleted file mode 100644
index c844dfa5d58d..000000000000
--- a/arch/sh/boards/renesas/r7780rp/psw.c
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * arch/sh/boards/renesas/r7780rp/psw.c
3 *
4 * push switch support for RDBRP-1/RDBREVRP-1 debug boards.
5 *
6 * Copyright (C) 2006 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/io.h>
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/platform_device.h>
16#include <asm/mach/r7780rp.h>
17#include <asm/push-switch.h>
18
19static irqreturn_t psw_irq_handler(int irq, void *arg)
20{
21 struct platform_device *pdev = arg;
22 struct push_switch *psw = platform_get_drvdata(pdev);
23 struct push_switch_platform_info *psw_info = pdev->dev.platform_data;
24 unsigned int l, mask;
25 int ret = 0;
26
27 l = ctrl_inw(PA_DBSW);
28
29 /* Nothing to do if there's no state change */
30 if (psw->state) {
31 ret = 1;
32 goto out;
33 }
34
35 mask = l & 0x70;
36 /* Figure out who raised it */
37 if (mask & (1 << psw_info->bit)) {
38 psw->state = !!(mask & (1 << psw_info->bit));
39 if (psw->state) /* debounce */
40 mod_timer(&psw->debounce, jiffies + 50);
41
42 ret = 1;
43 }
44
45out:
46 /* Clear the switch IRQs */
47 l |= (0x7 << 12);
48 ctrl_outw(l, PA_DBSW);
49
50 return IRQ_RETVAL(ret);
51}
52
53static struct resource psw_resources[] = {
54 [0] = {
55 .start = IRQ_PSW,
56 .flags = IORESOURCE_IRQ,
57 },
58};
59
60static struct push_switch_platform_info s2_platform_data = {
61 .name = "s2",
62 .bit = 6,
63 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
64 IRQF_SHARED,
65 .irq_handler = psw_irq_handler,
66};
67
68static struct platform_device s2_switch_device = {
69 .name = "push-switch",
70 .id = 0,
71 .num_resources = ARRAY_SIZE(psw_resources),
72 .resource = psw_resources,
73 .dev = {
74 .platform_data = &s2_platform_data,
75 },
76};
77
78static struct push_switch_platform_info s3_platform_data = {
79 .name = "s3",
80 .bit = 5,
81 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
82 IRQF_SHARED,
83 .irq_handler = psw_irq_handler,
84};
85
86static struct platform_device s3_switch_device = {
87 .name = "push-switch",
88 .id = 1,
89 .num_resources = ARRAY_SIZE(psw_resources),
90 .resource = psw_resources,
91 .dev = {
92 .platform_data = &s3_platform_data,
93 },
94};
95
96static struct push_switch_platform_info s4_platform_data = {
97 .name = "s4",
98 .bit = 4,
99 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
100 IRQF_SHARED,
101 .irq_handler = psw_irq_handler,
102};
103
104static struct platform_device s4_switch_device = {
105 .name = "push-switch",
106 .id = 2,
107 .num_resources = ARRAY_SIZE(psw_resources),
108 .resource = psw_resources,
109 .dev = {
110 .platform_data = &s4_platform_data,
111 },
112};
113
114static struct platform_device *psw_devices[] = {
115 &s2_switch_device, &s3_switch_device, &s4_switch_device,
116};
117
118static int __init psw_init(void)
119{
120 return platform_add_devices(psw_devices, ARRAY_SIZE(psw_devices));
121}
122module_init(psw_init);
diff --git a/arch/sh/boards/se/7206/io.c b/arch/sh/boards/se/7206/io.c
deleted file mode 100644
index 1308e618e044..000000000000
--- a/arch/sh/boards/se/7206/io.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/* $Id: io.c,v 1.5 2004/02/22 23:08:43 kkojima Exp $
2 *
3 * linux/arch/sh/boards/se/7206/io.c
4 *
5 * Copyright (C) 2006 Yoshinori Sato
6 *
7 * I/O routine for Hitachi 7206 SolutionEngine.
8 *
9 */
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <asm/io.h>
14#include <asm/se7206.h>
15
16
17static inline void delay(void)
18{
19 ctrl_inw(0x20000000); /* P2 ROM Area */
20}
21
22/* MS7750 requires special versions of in*, out* routines, since
23 PC-like io ports are located at upper half byte of 16-bit word which
24 can be accessed only with 16-bit wide. */
25
26static inline volatile __u16 *
27port2adr(unsigned int port)
28{
29 if (port >= 0x2000 && port < 0x2020)
30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
31 else if (port >= 0x300 && port < 0x310)
32 return (volatile __u16 *) (PA_SMSC + (port - 0x300));
33
34 return (volatile __u16 *)port;
35}
36
37unsigned char se7206_inb(unsigned long port)
38{
39 return (*port2adr(port)) & 0xff;
40}
41
42unsigned char se7206_inb_p(unsigned long port)
43{
44 unsigned long v;
45
46 v = (*port2adr(port)) & 0xff;
47 delay();
48 return v;
49}
50
51unsigned short se7206_inw(unsigned long port)
52{
53 return *port2adr(port);;
54}
55
56void se7206_outb(unsigned char value, unsigned long port)
57{
58 *(port2adr(port)) = value;
59}
60
61void se7206_outb_p(unsigned char value, unsigned long port)
62{
63 *(port2adr(port)) = value;
64 delay();
65}
66
67void se7206_outw(unsigned short value, unsigned long port)
68{
69 *port2adr(port) = value;
70}
71
72void se7206_insb(unsigned long port, void *addr, unsigned long count)
73{
74 volatile __u16 *p = port2adr(port);
75 __u8 *ap = addr;
76
77 while (count--)
78 *ap++ = *p;
79}
80
81void se7206_insw(unsigned long port, void *addr, unsigned long count)
82{
83 volatile __u16 *p = port2adr(port);
84 __u16 *ap = addr;
85 while (count--)
86 *ap++ = *p;
87}
88
89void se7206_outsb(unsigned long port, const void *addr, unsigned long count)
90{
91 volatile __u16 *p = port2adr(port);
92 const __u8 *ap = addr;
93
94 while (count--)
95 *p = *ap++;
96}
97
98void se7206_outsw(unsigned long port, const void *addr, unsigned long count)
99{
100 volatile __u16 *p = port2adr(port);
101 const __u16 *ap = addr;
102 while (count--)
103 *p = *ap++;
104}
diff --git a/arch/sh/boards/se/7206/irq.c b/arch/sh/boards/se/7206/irq.c
deleted file mode 100644
index 9d5bfc77d0de..000000000000
--- a/arch/sh/boards/se/7206/irq.c
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/7206/irq.c
3 *
4 * Copyright (C) 2005,2006 Yoshinori Sato
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 */
9#include <linux/init.h>
10#include <linux/irq.h>
11#include <linux/io.h>
12#include <linux/interrupt.h>
13#include <asm/se7206.h>
14
15#define INTSTS0 0x31800000
16#define INTSTS1 0x31800002
17#define INTMSK0 0x31800004
18#define INTMSK1 0x31800006
19#define INTSEL 0x31800008
20
21#define IRQ0_IRQ 64
22#define IRQ1_IRQ 65
23#define IRQ3_IRQ 67
24
25#define INTC_IPR01 0xfffe0818
26#define INTC_ICR1 0xfffe0802
27
28static void disable_se7206_irq(unsigned int irq)
29{
30 unsigned short val;
31 unsigned short mask = 0xffff ^ (0x0f << 4 * (3 - (IRQ0_IRQ - irq)));
32 unsigned short msk0,msk1;
33
34 /* Set the priority in IPR to 0 */
35 val = ctrl_inw(INTC_IPR01);
36 val &= mask;
37 ctrl_outw(val, INTC_IPR01);
38 /* FPGA mask set */
39 msk0 = ctrl_inw(INTMSK0);
40 msk1 = ctrl_inw(INTMSK1);
41
42 switch (irq) {
43 case IRQ0_IRQ:
44 msk0 |= 0x0010;
45 break;
46 case IRQ1_IRQ:
47 msk0 |= 0x000f;
48 break;
49 case IRQ3_IRQ:
50 msk0 |= 0x0f00;
51 msk1 |= 0x00ff;
52 break;
53 }
54 ctrl_outw(msk0, INTMSK0);
55 ctrl_outw(msk1, INTMSK1);
56}
57
58static void enable_se7206_irq(unsigned int irq)
59{
60 unsigned short val;
61 unsigned short value = (0x0001 << 4 * (3 - (IRQ0_IRQ - irq)));
62 unsigned short msk0,msk1;
63
64 /* Set priority in IPR back to original value */
65 val = ctrl_inw(INTC_IPR01);
66 val |= value;
67 ctrl_outw(val, INTC_IPR01);
68
69 /* FPGA mask reset */
70 msk0 = ctrl_inw(INTMSK0);
71 msk1 = ctrl_inw(INTMSK1);
72
73 switch (irq) {
74 case IRQ0_IRQ:
75 msk0 &= ~0x0010;
76 break;
77 case IRQ1_IRQ:
78 msk0 &= ~0x000f;
79 break;
80 case IRQ3_IRQ:
81 msk0 &= ~0x0f00;
82 msk1 &= ~0x00ff;
83 break;
84 }
85 ctrl_outw(msk0, INTMSK0);
86 ctrl_outw(msk1, INTMSK1);
87}
88
89static void eoi_se7206_irq(unsigned int irq)
90{
91 unsigned short sts0,sts1;
92
93 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
94 enable_se7206_irq(irq);
95 /* FPGA isr clear */
96 sts0 = ctrl_inw(INTSTS0);
97 sts1 = ctrl_inw(INTSTS1);
98
99 switch (irq) {
100 case IRQ0_IRQ:
101 sts0 &= ~0x0010;
102 break;
103 case IRQ1_IRQ:
104 sts0 &= ~0x000f;
105 break;
106 case IRQ3_IRQ:
107 sts0 &= ~0x0f00;
108 sts1 &= ~0x00ff;
109 break;
110 }
111 ctrl_outw(sts0, INTSTS0);
112 ctrl_outw(sts1, INTSTS1);
113}
114
115static struct irq_chip se7206_irq_chip __read_mostly = {
116 .name = "SE7206-FPGA",
117 .mask = disable_se7206_irq,
118 .unmask = enable_se7206_irq,
119 .mask_ack = disable_se7206_irq,
120 .eoi = eoi_se7206_irq,
121};
122
123static void make_se7206_irq(unsigned int irq)
124{
125 disable_irq_nosync(irq);
126 set_irq_chip_and_handler_name(irq, &se7206_irq_chip,
127 handle_level_irq, "level");
128 disable_se7206_irq(irq);
129}
130
131/*
132 * Initialize IRQ setting
133 */
134void __init init_se7206_IRQ(void)
135{
136 make_se7206_irq(IRQ0_IRQ); /* SMC91C111 */
137 make_se7206_irq(IRQ1_IRQ); /* ATA */
138 make_se7206_irq(IRQ3_IRQ); /* SLOT / PCM */
139 ctrl_outw(inw(INTC_ICR1) | 0x000b ,INTC_ICR1 ) ; /* ICR1 */
140
141 /* FPGA System register setup*/
142 ctrl_outw(0x0000,INTSTS0); /* Clear INTSTS0 */
143 ctrl_outw(0x0000,INTSTS1); /* Clear INTSTS1 */
144 /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */
145 ctrl_outw(0x0001,INTSEL);
146}
diff --git a/arch/sh/boards/se/7206/setup.c b/arch/sh/boards/se/7206/setup.c
deleted file mode 100644
index 4fe84cc08406..000000000000
--- a/arch/sh/boards/se/7206/setup.c
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 *
3 * linux/arch/sh/boards/se/7206/setup.c
4 *
5 * Copyright (C) 2006 Yoshinori Sato
6 * Copyright (C) 2007 - 2008 Paul Mundt
7 *
8 * Hitachi 7206 SolutionEngine Support.
9 */
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/smc91x.h>
13#include <asm/se7206.h>
14#include <asm/io.h>
15#include <asm/machvec.h>
16#include <asm/heartbeat.h>
17
18static struct resource smc91x_resources[] = {
19 [0] = {
20 .name = "smc91x-regs",
21 .start = PA_SMSC + 0x300,
22 .end = PA_SMSC + 0x300 + 0x020 - 1,
23 .flags = IORESOURCE_MEM,
24 },
25 [1] = {
26 .start = 64,
27 .end = 64,
28 .flags = IORESOURCE_IRQ,
29 },
30};
31
32static struct smc91x_platdata smc91x_info = {
33 .flags = SMC91X_USE_16BIT,
34};
35
36static struct platform_device smc91x_device = {
37 .name = "smc91x",
38 .id = -1,
39 .dev = {
40 .dma_mask = NULL,
41 .coherent_dma_mask = 0xffffffff,
42 .platform_data = &smc91x_info,
43 },
44 .num_resources = ARRAY_SIZE(smc91x_resources),
45 .resource = smc91x_resources,
46};
47
48static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
49
50static struct heartbeat_data heartbeat_data = {
51 .bit_pos = heartbeat_bit_pos,
52 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
53 .regsize = 32,
54};
55
56static struct resource heartbeat_resources[] = {
57 [0] = {
58 .start = PA_LED,
59 .end = PA_LED,
60 .flags = IORESOURCE_MEM,
61 },
62};
63
64static struct platform_device heartbeat_device = {
65 .name = "heartbeat",
66 .id = -1,
67 .dev = {
68 .platform_data = &heartbeat_data,
69 },
70 .num_resources = ARRAY_SIZE(heartbeat_resources),
71 .resource = heartbeat_resources,
72};
73
74static struct platform_device *se7206_devices[] __initdata = {
75 &smc91x_device,
76 &heartbeat_device,
77};
78
79static int __init se7206_devices_setup(void)
80{
81 return platform_add_devices(se7206_devices, ARRAY_SIZE(se7206_devices));
82}
83__initcall(se7206_devices_setup);
84
85/*
86 * The Machine Vector
87 */
88
89static struct sh_machine_vector mv_se __initmv = {
90 .mv_name = "SolutionEngine",
91 .mv_nr_irqs = 256,
92 .mv_inb = se7206_inb,
93 .mv_inw = se7206_inw,
94 .mv_outb = se7206_outb,
95 .mv_outw = se7206_outw,
96
97 .mv_inb_p = se7206_inb_p,
98 .mv_inw_p = se7206_inw,
99 .mv_outb_p = se7206_outb_p,
100 .mv_outw_p = se7206_outw,
101
102 .mv_insb = se7206_insb,
103 .mv_insw = se7206_insw,
104 .mv_outsb = se7206_outsb,
105 .mv_outsw = se7206_outsw,
106
107 .mv_init_irq = init_se7206_IRQ,
108};
diff --git a/arch/sh/boards/se/7343/io.c b/arch/sh/boards/se/7343/io.c
deleted file mode 100644
index 3a6d11424938..000000000000
--- a/arch/sh/boards/se/7343/io.c
+++ /dev/null
@@ -1,273 +0,0 @@
1/*
2 * arch/sh/boards/se/7343/io.c
3 *
4 * I/O routine for SH-Mobile3AS 7343 SolutionEngine.
5 *
6 */
7#include <linux/kernel.h>
8#include <asm/io.h>
9#include <asm/mach/se7343.h>
10
11#define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a)
12
13struct iop {
14 unsigned long start, end;
15 unsigned long base;
16 struct iop *(*check) (struct iop * p, unsigned long port);
17 unsigned char (*inb) (struct iop * p, unsigned long port);
18 unsigned short (*inw) (struct iop * p, unsigned long port);
19 void (*outb) (struct iop * p, unsigned char value, unsigned long port);
20 void (*outw) (struct iop * p, unsigned short value, unsigned long port);
21};
22
23struct iop *
24simple_check(struct iop *p, unsigned long port)
25{
26 static int count;
27
28 if (count < 100)
29 count++;
30
31 port &= 0xFFFF;
32
33 if ((p->start <= port) && (port <= p->end))
34 return p;
35 else
36 badio(check, port);
37}
38
39struct iop *
40ide_check(struct iop *p, unsigned long port)
41{
42 if (((0x1f0 <= port) && (port <= 0x1f7)) || (port == 0x3f7))
43 return p;
44 return NULL;
45}
46
47unsigned char
48simple_inb(struct iop *p, unsigned long port)
49{
50 return *(unsigned char *) (p->base + port);
51}
52
53unsigned short
54simple_inw(struct iop *p, unsigned long port)
55{
56 return *(unsigned short *) (p->base + port);
57}
58
59void
60simple_outb(struct iop *p, unsigned char value, unsigned long port)
61{
62 *(unsigned char *) (p->base + port) = value;
63}
64
65void
66simple_outw(struct iop *p, unsigned short value, unsigned long port)
67{
68 *(unsigned short *) (p->base + port) = value;
69}
70
71unsigned char
72pcc_inb(struct iop *p, unsigned long port)
73{
74 unsigned long addr = p->base + port + 0x40000;
75 unsigned long v;
76
77 if (port & 1)
78 addr += 0x00400000;
79 v = *(volatile unsigned char *) addr;
80 return v;
81}
82
83void
84pcc_outb(struct iop *p, unsigned char value, unsigned long port)
85{
86 unsigned long addr = p->base + port + 0x40000;
87
88 if (port & 1)
89 addr += 0x00400000;
90 *(volatile unsigned char *) addr = value;
91}
92
93unsigned char
94bad_inb(struct iop *p, unsigned long port)
95{
96 badio(inb, port);
97}
98
99void
100bad_outb(struct iop *p, unsigned char value, unsigned long port)
101{
102 badio(inw, port);
103}
104
105#ifdef CONFIG_SMC91X
106/* MSTLANEX01 LAN at 0xb400:0000 */
107static struct iop laniop = {
108 .start = 0x00,
109 .end = 0x0F,
110 .base = 0x04000000,
111 .check = simple_check,
112 .inb = simple_inb,
113 .inw = simple_inw,
114 .outb = simple_outb,
115 .outw = simple_outw,
116};
117#endif
118
119#ifdef CONFIG_NE2000
120/* NE2000 pc card NIC */
121static struct iop neiop = {
122 .start = 0x280,
123 .end = 0x29f,
124 .base = 0xb0600000 + 0x80, /* soft 0x280 -> hard 0x300 */
125 .check = simple_check,
126 .inb = pcc_inb,
127 .inw = simple_inw,
128 .outb = pcc_outb,
129 .outw = simple_outw,
130};
131#endif
132
133#ifdef CONFIG_IDE
134/* CF in CF slot */
135static struct iop cfiop = {
136 .base = 0xb0600000,
137 .check = ide_check,
138 .inb = pcc_inb,
139 .inw = simple_inw,
140 .outb = pcc_outb,
141 .outw = simple_outw,
142};
143#endif
144
145static __inline__ struct iop *
146port2iop(unsigned long port)
147{
148 if (0) ;
149#if defined(CONFIG_SMC91X)
150 else if (laniop.check(&laniop, port))
151 return &laniop;
152#endif
153#if defined(CONFIG_NE2000)
154 else if (neiop.check(&neiop, port))
155 return &neiop;
156#endif
157#if defined(CONFIG_IDE)
158 else if (cfiop.check(&cfiop, port))
159 return &cfiop;
160#endif
161 else
162 return NULL;
163}
164
165static inline void
166delay(void)
167{
168 ctrl_inw(0xac000000);
169 ctrl_inw(0xac000000);
170}
171
172unsigned char
173sh7343se_inb(unsigned long port)
174{
175 struct iop *p = port2iop(port);
176 return (p->inb) (p, port);
177}
178
179unsigned char
180sh7343se_inb_p(unsigned long port)
181{
182 unsigned char v = sh7343se_inb(port);
183 delay();
184 return v;
185}
186
187unsigned short
188sh7343se_inw(unsigned long port)
189{
190 struct iop *p = port2iop(port);
191 return (p->inw) (p, port);
192}
193
194unsigned int
195sh7343se_inl(unsigned long port)
196{
197 badio(inl, port);
198}
199
200void
201sh7343se_outb(unsigned char value, unsigned long port)
202{
203 struct iop *p = port2iop(port);
204 (p->outb) (p, value, port);
205}
206
207void
208sh7343se_outb_p(unsigned char value, unsigned long port)
209{
210 sh7343se_outb(value, port);
211 delay();
212}
213
214void
215sh7343se_outw(unsigned short value, unsigned long port)
216{
217 struct iop *p = port2iop(port);
218 (p->outw) (p, value, port);
219}
220
221void
222sh7343se_outl(unsigned int value, unsigned long port)
223{
224 badio(outl, port);
225}
226
227void
228sh7343se_insb(unsigned long port, void *addr, unsigned long count)
229{
230 unsigned char *a = addr;
231 struct iop *p = port2iop(port);
232 while (count--)
233 *a++ = (p->inb) (p, port);
234}
235
236void
237sh7343se_insw(unsigned long port, void *addr, unsigned long count)
238{
239 unsigned short *a = addr;
240 struct iop *p = port2iop(port);
241 while (count--)
242 *a++ = (p->inw) (p, port);
243}
244
245void
246sh7343se_insl(unsigned long port, void *addr, unsigned long count)
247{
248 badio(insl, port);
249}
250
251void
252sh7343se_outsb(unsigned long port, const void *addr, unsigned long count)
253{
254 unsigned char *a = (unsigned char *) addr;
255 struct iop *p = port2iop(port);
256 while (count--)
257 (p->outb) (p, *a++, port);
258}
259
260void
261sh7343se_outsw(unsigned long port, const void *addr, unsigned long count)
262{
263 unsigned short *a = (unsigned short *) addr;
264 struct iop *p = port2iop(port);
265 while (count--)
266 (p->outw) (p, *a++, port);
267}
268
269void
270sh7343se_outsl(unsigned long port, const void *addr, unsigned long count)
271{
272 badio(outsw, port);
273}
diff --git a/arch/sh/boards/se/7343/irq.c b/arch/sh/boards/se/7343/irq.c
deleted file mode 100644
index 763f6deba814..000000000000
--- a/arch/sh/boards/se/7343/irq.c
+++ /dev/null
@@ -1,202 +0,0 @@
1/*
2 * arch/sh/boards/se/7343/irq.c
3 *
4 */
5#include <linux/init.h>
6#include <linux/interrupt.h>
7#include <linux/irq.h>
8#include <asm/irq.h>
9#include <asm/io.h>
10#include <asm/mach/se7343.h>
11
12static void
13disable_intreq_irq(unsigned int irq)
14{
15 int bit = irq - OFFCHIP_IRQ_BASE;
16 u16 val;
17
18 val = ctrl_inw(PA_CPLD_IMSK);
19 val |= 1 << bit;
20 ctrl_outw(val, PA_CPLD_IMSK);
21}
22
23static void
24enable_intreq_irq(unsigned int irq)
25{
26 int bit = irq - OFFCHIP_IRQ_BASE;
27 u16 val;
28
29 val = ctrl_inw(PA_CPLD_IMSK);
30 val &= ~(1 << bit);
31 ctrl_outw(val, PA_CPLD_IMSK);
32}
33
34static void
35mask_and_ack_intreq_irq(unsigned int irq)
36{
37 disable_intreq_irq(irq);
38}
39
40static unsigned int
41startup_intreq_irq(unsigned int irq)
42{
43 enable_intreq_irq(irq);
44 return 0;
45}
46
47static void
48shutdown_intreq_irq(unsigned int irq)
49{
50 disable_intreq_irq(irq);
51}
52
53static void
54end_intreq_irq(unsigned int irq)
55{
56 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
57 enable_intreq_irq(irq);
58}
59
60static struct hw_interrupt_type intreq_irq_type = {
61 .typename = "FPGA-IRQ",
62 .startup = startup_intreq_irq,
63 .shutdown = shutdown_intreq_irq,
64 .enable = enable_intreq_irq,
65 .disable = disable_intreq_irq,
66 .ack = mask_and_ack_intreq_irq,
67 .end = end_intreq_irq
68};
69
70static void
71make_intreq_irq(unsigned int irq)
72{
73 disable_irq_nosync(irq);
74 irq_desc[irq].chip = &intreq_irq_type;
75 disable_intreq_irq(irq);
76}
77
78int
79shmse_irq_demux(int irq)
80{
81 int bit;
82 volatile u16 val;
83
84 if (irq == IRQ5_IRQ) {
85 /* Read status Register */
86 val = ctrl_inw(PA_CPLD_ST);
87 bit = ffs(val);
88 if (bit != 0)
89 return OFFCHIP_IRQ_BASE + bit - 1;
90 }
91 return irq;
92}
93
94/* IRQ5 is multiplexed between the following sources:
95 * 1. PC Card socket
96 * 2. Extension slot
97 * 3. USB Controller
98 * 4. Serial Controller
99 *
100 * We configure IRQ5 as a cascade IRQ.
101 */
102static struct irqaction irq5 = {
103 .handler = no_action,
104 .mask = CPU_MASK_NONE,
105 .name = "IRQ5-cascade",
106};
107
108static struct ipr_data se7343_irq5_ipr_map[] = {
109 { IRQ5_IRQ, IRQ5_IPR_ADDR+2, IRQ5_IPR_POS, IRQ5_PRIORITY },
110};
111static struct ipr_data se7343_siof0_vpu_ipr_map[] = {
112 { SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY },
113 { VPU_IRQ, VPU_IPR_ADDR, VPU_IPR_POS, 8 },
114};
115static struct ipr_data se7343_other_ipr_map[] = {
116 { DMTE0_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
117 { DMTE1_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
118 { DMTE2_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
119 { DMTE3_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
120 { DMTE4_IRQ, DMA2_IPR_ADDR, DMA2_IPR_POS, DMA2_PRIORITY },
121 { DMTE5_IRQ, DMA2_IPR_ADDR, DMA2_IPR_POS, DMA2_PRIORITY },
122
123 /* I2C block */
124 { IIC0_ALI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
125 { IIC0_TACKI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
126 { IIC0_WAITI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
127 { IIC0_DTEI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
128
129 { IIC1_ALI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, IIC1_PRIORITY },
130 { IIC1_TACKI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, IIC1_PRIORITY },
131 { IIC1_WAITI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, IIC1_PRIORITY },
132 { IIC1_DTEI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, IIC1_PRIORITY },
133
134 /* SIOF */
135 { SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY },
136
137 /* SIU */
138 { SIU_IRQ, SIU_IPR_ADDR, SIU_IPR_POS, SIU_PRIORITY },
139
140 /* VIO interrupt */
141 { CEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY },
142 { BEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY },
143 { VEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY },
144
145 /*MFI interrupt*/
146
147 { MFI_IRQ, MFI_IPR_ADDR, MFI_IPR_POS, MFI_PRIORITY },
148
149 /* LCD controller */
150 { LCDC_IRQ, LCDC_IPR_ADDR, LCDC_IPR_POS, LCDC_PRIORITY },
151};
152
153/*
154 * Initialize IRQ setting
155 */
156void __init
157init_7343se_IRQ(void)
158{
159 /* Setup Multiplexed interrupts */
160 ctrl_outw(8, PA_CPLD_MODESET); /* Set all CPLD interrupts to active
161 * low.
162 */
163 /* Mask all CPLD controller interrupts */
164 ctrl_outw(0x0fff, PA_CPLD_IMSK);
165
166 /* PC Card interrupts */
167 make_intreq_irq(PC_IRQ0);
168 make_intreq_irq(PC_IRQ1);
169 make_intreq_irq(PC_IRQ2);
170 make_intreq_irq(PC_IRQ3);
171
172 /* Extension Slot Interrupts */
173 make_intreq_irq(EXT_IRQ0);
174 make_intreq_irq(EXT_IRQ1);
175 make_intreq_irq(EXT_IRQ2);
176 make_intreq_irq(EXT_IRQ3);
177
178 /* USB Controller interrupts */
179 make_intreq_irq(USB_IRQ0);
180 make_intreq_irq(USB_IRQ1);
181
182 /* Serial Controller interrupts */
183 make_intreq_irq(UART_IRQ0);
184 make_intreq_irq(UART_IRQ1);
185
186 /* Setup all external interrupts to be active low */
187 ctrl_outw(0xaaaa, INTC_ICR1);
188
189 make_ipr_irq(se7343_irq5_ipr_map, ARRAY_SIZE(se7343_irq5_ipr_map));
190
191 setup_irq(IRQ5_IRQ, &irq5);
192 /* Set port control to use IRQ5 */
193 *(u16 *)0xA4050108 &= ~0xc;
194
195 make_ipr_irq(se7343_siof0_vpu_ipr_map, ARRAY_SIZE(se7343_siof0_vpu_ipr_map));
196
197 ctrl_outb(0x0f, INTC_IMCR5); /* enable SCIF IRQ */
198
199 make_ipr_irq(se7343_other_ipr_map, ARRAY_SIZE(se7343_other_ipr_map));
200
201 ctrl_outw(0x2000, PA_MRSHPC + 0x0c); /* mrshpc irq enable */
202}
diff --git a/arch/sh/boards/se/7343/setup.c b/arch/sh/boards/se/7343/setup.c
deleted file mode 100644
index c9431b3a051b..000000000000
--- a/arch/sh/boards/se/7343/setup.c
+++ /dev/null
@@ -1,94 +0,0 @@
1#include <linux/init.h>
2#include <linux/platform_device.h>
3#include <asm/machvec.h>
4#include <asm/mach/se7343.h>
5#include <asm/irq.h>
6
7void init_7343se_IRQ(void);
8
9static struct resource smc91x_resources[] = {
10 [0] = {
11 .start = 0x10000000,
12 .end = 0x1000000F,
13 .flags = IORESOURCE_MEM,
14 },
15 [1] = {
16 /*
17 * shared with other devices via externel
18 * interrupt controller in FPGA...
19 */
20 .start = EXT_IRQ2,
21 .end = EXT_IRQ2,
22 .flags = IORESOURCE_IRQ,
23 },
24};
25
26static struct platform_device smc91x_device = {
27 .name = "smc91x",
28 .id = 0,
29 .num_resources = ARRAY_SIZE(smc91x_resources),
30 .resource = smc91x_resources,
31};
32
33static struct resource heartbeat_resources[] = {
34 [0] = {
35 .start = PA_LED,
36 .end = PA_LED,
37 .flags = IORESOURCE_MEM,
38 },
39};
40
41static struct platform_device heartbeat_device = {
42 .name = "heartbeat",
43 .id = -1,
44 .num_resources = ARRAY_SIZE(heartbeat_resources),
45 .resource = heartbeat_resources,
46};
47
48static struct platform_device *sh7343se_platform_devices[] __initdata = {
49 &smc91x_device,
50 &heartbeat_device,
51};
52
53static int __init sh7343se_devices_setup(void)
54{
55 return platform_add_devices(sh7343se_platform_devices,
56 ARRAY_SIZE(sh7343se_platform_devices));
57}
58
59static void __init sh7343se_setup(char **cmdline_p)
60{
61 device_initcall(sh7343se_devices_setup);
62}
63
64/*
65 * The Machine Vector
66 */
67static struct sh_machine_vector mv_7343se __initmv = {
68 .mv_name = "SolutionEngine 7343",
69 .mv_setup = sh7343se_setup,
70 .mv_nr_irqs = 108,
71 .mv_inb = sh7343se_inb,
72 .mv_inw = sh7343se_inw,
73 .mv_inl = sh7343se_inl,
74 .mv_outb = sh7343se_outb,
75 .mv_outw = sh7343se_outw,
76 .mv_outl = sh7343se_outl,
77
78 .mv_inb_p = sh7343se_inb_p,
79 .mv_inw_p = sh7343se_inw,
80 .mv_inl_p = sh7343se_inl,
81 .mv_outb_p = sh7343se_outb_p,
82 .mv_outw_p = sh7343se_outw,
83 .mv_outl_p = sh7343se_outl,
84
85 .mv_insb = sh7343se_insb,
86 .mv_insw = sh7343se_insw,
87 .mv_insl = sh7343se_insl,
88 .mv_outsb = sh7343se_outsb,
89 .mv_outsw = sh7343se_outsw,
90 .mv_outsl = sh7343se_outsl,
91
92 .mv_init_irq = init_7343se_IRQ,
93 .mv_irq_demux = shmse_irq_demux,
94};
diff --git a/arch/sh/boards/se/7619/Makefile b/arch/sh/boards/se/7619/Makefile
deleted file mode 100644
index d21775c28cda..000000000000
--- a/arch/sh/boards/se/7619/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the 7619 SolutionEngine specific parts of the kernel
3#
4
5obj-y := setup.o
diff --git a/arch/sh/boards/se/770x/io.c b/arch/sh/boards/se/770x/io.c
deleted file mode 100644
index c4550473d4c3..000000000000
--- a/arch/sh/boards/se/770x/io.c
+++ /dev/null
@@ -1,187 +0,0 @@
1/* $Id: io.c,v 1.7 2006/02/05 21:55:29 lethal Exp $
2 *
3 * linux/arch/sh/kernel/io_se.c
4 *
5 * Copyright (C) 2000 Kazumoto Kojima
6 *
7 * I/O routine for Hitachi SolutionEngine.
8 *
9 */
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <asm/io.h>
14#include <asm/se.h>
15
16/* SH pcmcia io window base, start and end. */
17int sh_pcic_io_wbase = 0xb8400000;
18int sh_pcic_io_start;
19int sh_pcic_io_stop;
20int sh_pcic_io_type;
21int sh_pcic_io_dummy;
22
23/* MS7750 requires special versions of in*, out* routines, since
24 PC-like io ports are located at upper half byte of 16-bit word which
25 can be accessed only with 16-bit wide. */
26
27static inline volatile __u16 *
28port2adr(unsigned int port)
29{
30 if (port & 0xff000000)
31 return ( volatile __u16 *) port;
32 if (port >= 0x2000)
33 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
34 else if (port >= 0x1000)
35 return (volatile __u16 *) (PA_83902 + (port << 1));
36 else if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)
37 return (volatile __u16 *) (sh_pcic_io_wbase + (port &~ 1));
38 else
39 return (volatile __u16 *) (PA_SUPERIO + (port << 1));
40}
41
42static inline int
43shifted_port(unsigned long port)
44{
45 /* For IDE registers, value is not shifted */
46 if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6)
47 return 0;
48 else
49 return 1;
50}
51
52unsigned char se_inb(unsigned long port)
53{
54 if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)
55 return *(__u8 *) (sh_pcic_io_wbase + 0x40000 + port);
56 else if (shifted_port(port))
57 return (*port2adr(port) >> 8);
58 else
59 return (*port2adr(port))&0xff;
60}
61
62unsigned char se_inb_p(unsigned long port)
63{
64 unsigned long v;
65
66 if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)
67 v = *(__u8 *) (sh_pcic_io_wbase + 0x40000 + port);
68 else if (shifted_port(port))
69 v = (*port2adr(port) >> 8);
70 else
71 v = (*port2adr(port))&0xff;
72 ctrl_delay();
73 return v;
74}
75
76unsigned short se_inw(unsigned long port)
77{
78 if (port >= 0x2000 ||
79 (sh_pcic_io_start <= port && port <= sh_pcic_io_stop))
80 return *port2adr(port);
81 else
82 maybebadio(port);
83 return 0;
84}
85
86unsigned int se_inl(unsigned long port)
87{
88 maybebadio(port);
89 return 0;
90}
91
92void se_outb(unsigned char value, unsigned long port)
93{
94 if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)
95 *(__u8 *)(sh_pcic_io_wbase + port) = value;
96 else if (shifted_port(port))
97 *(port2adr(port)) = value << 8;
98 else
99 *(port2adr(port)) = value;
100}
101
102void se_outb_p(unsigned char value, unsigned long port)
103{
104 if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)
105 *(__u8 *)(sh_pcic_io_wbase + port) = value;
106 else if (shifted_port(port))
107 *(port2adr(port)) = value << 8;
108 else
109 *(port2adr(port)) = value;
110 ctrl_delay();
111}
112
113void se_outw(unsigned short value, unsigned long port)
114{
115 if (port >= 0x2000 ||
116 (sh_pcic_io_start <= port && port <= sh_pcic_io_stop))
117 *port2adr(port) = value;
118 else
119 maybebadio(port);
120}
121
122void se_outl(unsigned int value, unsigned long port)
123{
124 maybebadio(port);
125}
126
127void se_insb(unsigned long port, void *addr, unsigned long count)
128{
129 volatile __u16 *p = port2adr(port);
130 __u8 *ap = addr;
131
132 if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop) {
133 volatile __u8 *bp = (__u8 *) (sh_pcic_io_wbase + 0x40000 + port);
134 while (count--)
135 *ap++ = *bp;
136 } else if (shifted_port(port)) {
137 while (count--)
138 *ap++ = *p >> 8;
139 } else {
140 while (count--)
141 *ap++ = *p;
142 }
143}
144
145void se_insw(unsigned long port, void *addr, unsigned long count)
146{
147 volatile __u16 *p = port2adr(port);
148 __u16 *ap = addr;
149 while (count--)
150 *ap++ = *p;
151}
152
153void se_insl(unsigned long port, void *addr, unsigned long count)
154{
155 maybebadio(port);
156}
157
158void se_outsb(unsigned long port, const void *addr, unsigned long count)
159{
160 volatile __u16 *p = port2adr(port);
161 const __u8 *ap = addr;
162
163 if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop) {
164 volatile __u8 *bp = (__u8 *) (sh_pcic_io_wbase + port);
165 while (count--)
166 *bp = *ap++;
167 } else if (shifted_port(port)) {
168 while (count--)
169 *p = *ap++ << 8;
170 } else {
171 while (count--)
172 *p = *ap++;
173 }
174}
175
176void se_outsw(unsigned long port, const void *addr, unsigned long count)
177{
178 volatile __u16 *p = port2adr(port);
179 const __u16 *ap = addr;
180 while (count--)
181 *p = *ap++;
182}
183
184void se_outsl(unsigned long port, const void *addr, unsigned long count)
185{
186 maybebadio(port);
187}
diff --git a/arch/sh/boards/se/770x/irq.c b/arch/sh/boards/se/770x/irq.c
deleted file mode 100644
index cdb0807928a5..000000000000
--- a/arch/sh/boards/se/770x/irq.c
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/770x/irq.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 * Copyright (C) 2006 Nobuhiro Iwamatsu
6 *
7 * Hitachi SolutionEngine Support.
8 *
9 */
10
11#include <linux/init.h>
12#include <linux/interrupt.h>
13#include <linux/irq.h>
14#include <asm/irq.h>
15#include <asm/io.h>
16#include <asm/se.h>
17
18static struct ipr_data ipr_irq_table[] = {
19 /*
20 * Super I/O (Just mimic PC):
21 * 1: keyboard
22 * 3: serial 0
23 * 4: serial 1
24 * 5: printer
25 * 6: floppy
26 * 8: rtc
27 * 12: mouse
28 * 14: ide0
29 */
30#if defined(CONFIG_CPU_SUBTYPE_SH7705)
31 /* This is default value */
32 { 13, 0, 8, 0x0f-13, },
33 { 5 , 0, 4, 0x0f- 5, },
34 { 10, 1, 0, 0x0f-10, },
35 { 7 , 2, 4, 0x0f- 7, },
36 { 3 , 2, 0, 0x0f- 3, },
37 { 1 , 3, 12, 0x0f- 1, },
38 { 12, 3, 4, 0x0f-12, }, /* LAN */
39 { 2 , 4, 8, 0x0f- 2, }, /* PCIRQ2 */
40 { 6 , 4, 4, 0x0f- 6, }, /* PCIRQ1 */
41 { 14, 4, 0, 0x0f-14, }, /* PCIRQ0 */
42 { 0 , 5, 12, 0x0f , },
43 { 4 , 5, 4, 0x0f- 4, },
44 { 8 , 6, 12, 0x0f- 8, },
45 { 9 , 6, 8, 0x0f- 9, },
46 { 11, 6, 4, 0x0f-11, },
47#else
48 { 14, 0, 8, 0x0f-14, },
49 { 12, 0, 4, 0x0f-12, },
50 { 8, 1, 4, 0x0f- 8, },
51 { 6, 2, 12, 0x0f- 6, },
52 { 5, 2, 8, 0x0f- 5, },
53 { 4, 2, 4, 0x0f- 4, },
54 { 3, 2, 0, 0x0f- 3, },
55 { 1, 3, 12, 0x0f- 1, },
56#if defined(CONFIG_STNIC)
57 /* ST NIC */
58 { 10, 3, 4, 0x0f-10, }, /* LAN */
59#endif
60 /* MRSHPC IRQs setting */
61 { 0, 4, 12, 0x0f- 0, }, /* PCIRQ3 */
62 { 11, 4, 8, 0x0f-11, }, /* PCIRQ2 */
63 { 9, 4, 4, 0x0f- 9, }, /* PCIRQ1 */
64 { 7, 4, 0, 0x0f- 7, }, /* PCIRQ0 */
65 /* #2, #13 are allocated for SLOT IRQ #1 and #2 (for now) */
66 /* NOTE: #2 and #13 are not used on PC */
67 { 13, 6, 4, 0x0f-13, }, /* SLOTIRQ2 */
68 { 2, 6, 0, 0x0f- 2, }, /* SLOTIRQ1 */
69#endif
70};
71
72static unsigned long ipr_offsets[] = {
73 BCR_ILCRA,
74 BCR_ILCRB,
75 BCR_ILCRC,
76 BCR_ILCRD,
77 BCR_ILCRE,
78 BCR_ILCRF,
79 BCR_ILCRG,
80};
81
82static struct ipr_desc ipr_irq_desc = {
83 .ipr_offsets = ipr_offsets,
84 .nr_offsets = ARRAY_SIZE(ipr_offsets),
85
86 .ipr_data = ipr_irq_table,
87 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
88 .chip = {
89 .name = "IPR-se770x",
90 },
91};
92
93/*
94 * Initialize IRQ setting
95 */
96void __init init_se_IRQ(void)
97{
98 /* Disable all interrupts */
99 ctrl_outw(0, BCR_ILCRA);
100 ctrl_outw(0, BCR_ILCRB);
101 ctrl_outw(0, BCR_ILCRC);
102 ctrl_outw(0, BCR_ILCRD);
103 ctrl_outw(0, BCR_ILCRE);
104 ctrl_outw(0, BCR_ILCRF);
105 ctrl_outw(0, BCR_ILCRG);
106
107 register_ipr_controller(&ipr_irq_desc);
108}
diff --git a/arch/sh/boards/se/770x/setup.c b/arch/sh/boards/se/770x/setup.c
deleted file mode 100644
index 318bc8a3969c..000000000000
--- a/arch/sh/boards/se/770x/setup.c
+++ /dev/null
@@ -1,169 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/770x/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 */
9#include <linux/init.h>
10#include <linux/platform_device.h>
11#include <asm/machvec.h>
12#include <asm/se.h>
13#include <asm/io.h>
14#include <asm/smc37c93x.h>
15#include <asm/heartbeat.h>
16
17void init_se_IRQ(void);
18
19/*
20 * Configure the Super I/O chip
21 */
22static void __init smsc_config(int index, int data)
23{
24 outb_p(index, INDEX_PORT);
25 outb_p(data, DATA_PORT);
26}
27
28/* XXX: Another candidate for a more generic cchip machine vector */
29static void __init smsc_setup(char **cmdline_p)
30{
31 outb_p(CONFIG_ENTER, CONFIG_PORT);
32 outb_p(CONFIG_ENTER, CONFIG_PORT);
33
34 /* FDC */
35 smsc_config(CURRENT_LDN_INDEX, LDN_FDC);
36 smsc_config(ACTIVATE_INDEX, 0x01);
37 smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */
38
39 /* AUXIO (GPIO): to use IDE1 */
40 smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO);
41 smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */
42 smsc_config(GPIO47_INDEX, 0x00); /* nIOWOP */
43
44 /* COM1 */
45 smsc_config(CURRENT_LDN_INDEX, LDN_COM1);
46 smsc_config(ACTIVATE_INDEX, 0x01);
47 smsc_config(IO_BASE_HI_INDEX, 0x03);
48 smsc_config(IO_BASE_LO_INDEX, 0xf8);
49 smsc_config(IRQ_SELECT_INDEX, 4); /* IRQ4 */
50
51 /* COM2 */
52 smsc_config(CURRENT_LDN_INDEX, LDN_COM2);
53 smsc_config(ACTIVATE_INDEX, 0x01);
54 smsc_config(IO_BASE_HI_INDEX, 0x02);
55 smsc_config(IO_BASE_LO_INDEX, 0xf8);
56 smsc_config(IRQ_SELECT_INDEX, 3); /* IRQ3 */
57
58 /* RTC */
59 smsc_config(CURRENT_LDN_INDEX, LDN_RTC);
60 smsc_config(ACTIVATE_INDEX, 0x01);
61 smsc_config(IRQ_SELECT_INDEX, 8); /* IRQ8 */
62
63 /* XXX: PARPORT, KBD, and MOUSE will come here... */
64 outb_p(CONFIG_EXIT, CONFIG_PORT);
65}
66
67
68static struct resource cf_ide_resources[] = {
69 [0] = {
70 .start = PA_MRSHPC_IO + 0x1f0,
71 .end = PA_MRSHPC_IO + 0x1f0 + 8,
72 .flags = IORESOURCE_MEM,
73 },
74 [1] = {
75 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
76 .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
77 .flags = IORESOURCE_MEM,
78 },
79 [2] = {
80 .start = IRQ_CFCARD,
81 .flags = IORESOURCE_IRQ,
82 },
83};
84
85static struct platform_device cf_ide_device = {
86 .name = "pata_platform",
87 .id = -1,
88 .num_resources = ARRAY_SIZE(cf_ide_resources),
89 .resource = cf_ide_resources,
90};
91
92static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
93
94static struct heartbeat_data heartbeat_data = {
95 .bit_pos = heartbeat_bit_pos,
96 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
97 .regsize = 16,
98};
99
100static struct resource heartbeat_resources[] = {
101 [0] = {
102 .start = PA_LED,
103 .end = PA_LED,
104 .flags = IORESOURCE_MEM,
105 },
106};
107
108static struct platform_device heartbeat_device = {
109 .name = "heartbeat",
110 .id = -1,
111 .dev = {
112 .platform_data = &heartbeat_data,
113 },
114 .num_resources = ARRAY_SIZE(heartbeat_resources),
115 .resource = heartbeat_resources,
116};
117
118static struct platform_device *se_devices[] __initdata = {
119 &heartbeat_device,
120 &cf_ide_device,
121};
122
123static int __init se_devices_setup(void)
124{
125 return platform_add_devices(se_devices, ARRAY_SIZE(se_devices));
126}
127device_initcall(se_devices_setup);
128
129/*
130 * The Machine Vector
131 */
132static struct sh_machine_vector mv_se __initmv = {
133 .mv_name = "SolutionEngine",
134 .mv_setup = smsc_setup,
135#if defined(CONFIG_CPU_SH4)
136 .mv_nr_irqs = 48,
137#elif defined(CONFIG_CPU_SUBTYPE_SH7708)
138 .mv_nr_irqs = 32,
139#elif defined(CONFIG_CPU_SUBTYPE_SH7709)
140 .mv_nr_irqs = 61,
141#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
142 .mv_nr_irqs = 86,
143#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
144 .mv_nr_irqs = 104,
145#endif
146
147 .mv_inb = se_inb,
148 .mv_inw = se_inw,
149 .mv_inl = se_inl,
150 .mv_outb = se_outb,
151 .mv_outw = se_outw,
152 .mv_outl = se_outl,
153
154 .mv_inb_p = se_inb_p,
155 .mv_inw_p = se_inw,
156 .mv_inl_p = se_inl,
157 .mv_outb_p = se_outb_p,
158 .mv_outw_p = se_outw,
159 .mv_outl_p = se_outl,
160
161 .mv_insb = se_insb,
162 .mv_insw = se_insw,
163 .mv_insl = se_insl,
164 .mv_outsb = se_outsb,
165 .mv_outsw = se_outsw,
166 .mv_outsl = se_outsl,
167
168 .mv_init_irq = init_se_IRQ,
169};
diff --git a/arch/sh/boards/se/7721/irq.c b/arch/sh/boards/se/7721/irq.c
deleted file mode 100644
index c4fdd622bf8b..000000000000
--- a/arch/sh/boards/se/7721/irq.c
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/7721/irq.c
3 *
4 * Copyright (C) 2008 Renesas Solutions Corp.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/irq.h>
12#include <linux/interrupt.h>
13#include <linux/io.h>
14#include <asm/se7721.h>
15
16enum {
17 UNUSED = 0,
18
19 /* board specific interrupt sources */
20 MRSHPC,
21};
22
23static struct intc_vect vectors[] __initdata = {
24 INTC_IRQ(MRSHPC, MRSHPC_IRQ0),
25};
26
27static struct intc_prio_reg prio_registers[] __initdata = {
28 { FPGA_ILSR6, 0, 8, 4, /* IRLMSK */
29 { 0, MRSHPC } },
30};
31
32static DECLARE_INTC_DESC(intc_desc, "SE7721", vectors,
33 NULL, NULL, prio_registers, NULL);
34
35/*
36 * Initialize IRQ setting
37 */
38void __init init_se7721_IRQ(void)
39{
40 /* PPCR */
41 ctrl_outw(ctrl_inw(0xa4050118) & ~0x00ff, 0xa4050118);
42
43 register_intc_controller(&intc_desc);
44 intc_set_priority(MRSHPC_IRQ0, 0xf - MRSHPC_IRQ0);
45}
diff --git a/arch/sh/boards/se/7721/setup.c b/arch/sh/boards/se/7721/setup.c
deleted file mode 100644
index 1be3e92752f7..000000000000
--- a/arch/sh/boards/se/7721/setup.c
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/7721/setup.c
3 *
4 * Copyright (C) 2008 Renesas Solutions Corp.
5 *
6 * Hitachi UL SolutionEngine 7721 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 *
12 */
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <asm/machvec.h>
16#include <asm/se7721.h>
17#include <asm/io.h>
18#include <asm/heartbeat.h>
19
20static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
21
22static struct heartbeat_data heartbeat_data = {
23 .bit_pos = heartbeat_bit_pos,
24 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
25 .regsize = 16,
26};
27
28static struct resource heartbeat_resources[] = {
29 [0] = {
30 .start = PA_LED,
31 .end = PA_LED,
32 .flags = IORESOURCE_MEM,
33 },
34};
35
36static struct platform_device heartbeat_device = {
37 .name = "heartbeat",
38 .id = -1,
39 .dev = {
40 .platform_data = &heartbeat_data,
41 },
42 .num_resources = ARRAY_SIZE(heartbeat_resources),
43 .resource = heartbeat_resources,
44};
45
46static struct resource cf_ide_resources[] = {
47 [0] = {
48 .start = PA_MRSHPC_IO + 0x1f0,
49 .end = PA_MRSHPC_IO + 0x1f0 + 8 ,
50 .flags = IORESOURCE_IO,
51 },
52 [1] = {
53 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
54 .end = PA_MRSHPC_IO + 0x1f0 + 8 + 0x206 + 8,
55 .flags = IORESOURCE_IO,
56 },
57 [2] = {
58 .start = MRSHPC_IRQ0,
59 .flags = IORESOURCE_IRQ,
60 },
61};
62
63static struct platform_device cf_ide_device = {
64 .name = "pata_platform",
65 .id = -1,
66 .num_resources = ARRAY_SIZE(cf_ide_resources),
67 .resource = cf_ide_resources,
68};
69
70static struct platform_device *se7721_devices[] __initdata = {
71 &cf_ide_device,
72 &heartbeat_device
73};
74
75static int __init se7721_devices_setup(void)
76{
77 return platform_add_devices(se7721_devices,
78 ARRAY_SIZE(se7721_devices));
79}
80device_initcall(se7721_devices_setup);
81
82static void __init se7721_setup(char **cmdline_p)
83{
84 /* for USB */
85 ctrl_outw(0x0000, 0xA405010C); /* PGCR */
86 ctrl_outw(0x0000, 0xA405010E); /* PHCR */
87 ctrl_outw(0x00AA, 0xA4050118); /* PPCR */
88 ctrl_outw(0x0000, 0xA4050124); /* PSELA */
89}
90
91/*
92 * The Machine Vector
93 */
94struct sh_machine_vector mv_se7721 __initmv = {
95 .mv_name = "Solution Engine 7721",
96 .mv_setup = se7721_setup,
97 .mv_nr_irqs = 109,
98 .mv_init_irq = init_se7721_IRQ,
99};
diff --git a/arch/sh/boards/se/7722/irq.c b/arch/sh/boards/se/7722/irq.c
deleted file mode 100644
index 0b03f3f610b8..000000000000
--- a/arch/sh/boards/se/7722/irq.c
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/7722/irq.c
3 *
4 * Copyright (C) 2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7722 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/interrupt.h>
15#include <asm/irq.h>
16#include <asm/io.h>
17#include <asm/se7722.h>
18
19static void disable_se7722_irq(unsigned int irq)
20{
21 unsigned int bit = irq - SE7722_FPGA_IRQ_BASE;
22 ctrl_outw(ctrl_inw(IRQ01_MASK) | 1 << bit, IRQ01_MASK);
23}
24
25static void enable_se7722_irq(unsigned int irq)
26{
27 unsigned int bit = irq - SE7722_FPGA_IRQ_BASE;
28 ctrl_outw(ctrl_inw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK);
29}
30
31static struct irq_chip se7722_irq_chip __read_mostly = {
32 .name = "SE7722-FPGA",
33 .mask = disable_se7722_irq,
34 .unmask = enable_se7722_irq,
35 .mask_ack = disable_se7722_irq,
36};
37
38static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
39{
40 unsigned short intv = ctrl_inw(IRQ01_STS);
41 struct irq_desc *ext_desc;
42 unsigned int ext_irq = SE7722_FPGA_IRQ_BASE;
43
44 intv &= (1 << SE7722_FPGA_IRQ_NR) - 1;
45
46 while (intv) {
47 if (intv & 1) {
48 ext_desc = irq_desc + ext_irq;
49 handle_level_irq(ext_irq, ext_desc);
50 }
51 intv >>= 1;
52 ext_irq++;
53 }
54}
55
56/*
57 * Initialize IRQ setting
58 */
59void __init init_se7722_IRQ(void)
60{
61 int i;
62
63 ctrl_outw(0, IRQ01_MASK); /* disable all irqs */
64 ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */
65
66 for (i = 0; i < SE7722_FPGA_IRQ_NR; i++)
67 set_irq_chip_and_handler_name(SE7722_FPGA_IRQ_BASE + i,
68 &se7722_irq_chip,
69 handle_level_irq, "level");
70
71 set_irq_chained_handler(IRQ0_IRQ, se7722_irq_demux);
72 set_irq_type(IRQ0_IRQ, IRQ_TYPE_LEVEL_LOW);
73
74 set_irq_chained_handler(IRQ1_IRQ, se7722_irq_demux);
75 set_irq_type(IRQ1_IRQ, IRQ_TYPE_LEVEL_LOW);
76}
diff --git a/arch/sh/boards/se/7722/setup.c b/arch/sh/boards/se/7722/setup.c
deleted file mode 100644
index ede3957fc14a..000000000000
--- a/arch/sh/boards/se/7722/setup.c
+++ /dev/null
@@ -1,196 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/7722/setup.c
3 *
4 * Copyright (C) 2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7722 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 *
12 */
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/ata_platform.h>
16#include <linux/input.h>
17#include <linux/smc91x.h>
18#include <asm/machvec.h>
19#include <asm/se7722.h>
20#include <asm/io.h>
21#include <asm/heartbeat.h>
22#include <asm/sh_keysc.h>
23
24/* Heartbeat */
25static struct heartbeat_data heartbeat_data = {
26 .regsize = 16,
27};
28
29static struct resource heartbeat_resources[] = {
30 [0] = {
31 .start = PA_LED,
32 .end = PA_LED,
33 .flags = IORESOURCE_MEM,
34 },
35};
36
37static struct platform_device heartbeat_device = {
38 .name = "heartbeat",
39 .id = -1,
40 .dev = {
41 .platform_data = &heartbeat_data,
42 },
43 .num_resources = ARRAY_SIZE(heartbeat_resources),
44 .resource = heartbeat_resources,
45};
46
47/* SMC91x */
48static struct smc91x_platdata smc91x_info = {
49 .flags = SMC91X_USE_16BIT,
50};
51
52static struct resource smc91x_eth_resources[] = {
53 [0] = {
54 .name = "smc91x-regs" ,
55 .start = PA_LAN + 0x300,
56 .end = PA_LAN + 0x300 + 0x10 ,
57 .flags = IORESOURCE_MEM,
58 },
59 [1] = {
60 .start = SMC_IRQ,
61 .end = SMC_IRQ,
62 .flags = IORESOURCE_IRQ,
63 },
64};
65
66static struct platform_device smc91x_eth_device = {
67 .name = "smc91x",
68 .id = 0,
69 .dev = {
70 .dma_mask = NULL, /* don't use dma */
71 .coherent_dma_mask = 0xffffffff,
72 .platform_data = &smc91x_info,
73 },
74 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
75 .resource = smc91x_eth_resources,
76};
77
78static struct resource cf_ide_resources[] = {
79 [0] = {
80 .start = PA_MRSHPC_IO + 0x1f0,
81 .end = PA_MRSHPC_IO + 0x1f0 + 8 ,
82 .flags = IORESOURCE_IO,
83 },
84 [1] = {
85 .start = PA_MRSHPC_IO + 0x1f0 + 0x206,
86 .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8,
87 .flags = IORESOURCE_IO,
88 },
89 [2] = {
90 .start = MRSHPC_IRQ0,
91 .end = MRSHPC_IRQ0,
92 .flags = IORESOURCE_IRQ,
93 },
94};
95
96static struct platform_device cf_ide_device = {
97 .name = "pata_platform",
98 .id = -1,
99 .num_resources = ARRAY_SIZE(cf_ide_resources),
100 .resource = cf_ide_resources,
101};
102
103static struct sh_keysc_info sh_keysc_info = {
104 .mode = SH_KEYSC_MODE_1, /* KEYOUT0->5, KEYIN0->4 */
105 .scan_timing = 3,
106 .delay = 5,
107 .keycodes = { /* SW1 -> SW30 */
108 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
109 KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
110 KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
111 KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T,
112 KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y,
113 KEY_Z,
114 KEY_HOME, KEY_SLEEP, KEY_WAKEUP, KEY_COFFEE, /* life */
115 },
116};
117
118static struct resource sh_keysc_resources[] = {
119 [0] = {
120 .start = 0x044b0000,
121 .end = 0x044b000f,
122 .flags = IORESOURCE_MEM,
123 },
124 [1] = {
125 .start = 79,
126 .flags = IORESOURCE_IRQ,
127 },
128};
129
130static struct platform_device sh_keysc_device = {
131 .name = "sh_keysc",
132 .num_resources = ARRAY_SIZE(sh_keysc_resources),
133 .resource = sh_keysc_resources,
134 .dev = {
135 .platform_data = &sh_keysc_info,
136 },
137};
138
139static struct platform_device *se7722_devices[] __initdata = {
140 &heartbeat_device,
141 &smc91x_eth_device,
142 &cf_ide_device,
143 &sh_keysc_device,
144};
145
146static int __init se7722_devices_setup(void)
147{
148 return platform_add_devices(se7722_devices,
149 ARRAY_SIZE(se7722_devices));
150}
151device_initcall(se7722_devices_setup);
152
153static void __init se7722_setup(char **cmdline_p)
154{
155 ctrl_outw(0x010D, FPGA_OUT); /* FPGA */
156
157 ctrl_outl(0x00051001, MSTPCR0);
158 ctrl_outl(0x00000000, MSTPCR1);
159 /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC, USB */
160 ctrl_outl(0xffffb7c0, MSTPCR2);
161
162 ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */
163 ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */
164
165 /* LCDC I/O */
166 ctrl_outw(0x0020, PORT_PSELD);
167
168 /* SIOF1*/
169 ctrl_outw(0x0003, PORT_PSELB);
170 ctrl_outw(0xe000, PORT_PSELC);
171 ctrl_outw(0x0000, PORT_PKCR);
172
173 /* LCDC */
174 ctrl_outw(0x4020, PORT_PHCR);
175 ctrl_outw(0x0000, PORT_PLCR);
176 ctrl_outw(0x0000, PORT_PMCR);
177 ctrl_outw(0x0002, PORT_PRCR);
178 ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */
179
180 /* KEYSC */
181 ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */
182 ctrl_outw(0x0000, PORT_PYCR);
183 ctrl_outw(0x0000, PORT_PZCR);
184 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x4000, PORT_HIZCRA);
185 ctrl_outw(ctrl_inw(PORT_HIZCRC) & ~0xc000, PORT_HIZCRC);
186}
187
188/*
189 * The Machine Vector
190 */
191static struct sh_machine_vector mv_se7722 __initmv = {
192 .mv_name = "Solution Engine 7722" ,
193 .mv_setup = se7722_setup ,
194 .mv_nr_irqs = SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_NR,
195 .mv_init_irq = init_se7722_IRQ,
196};
diff --git a/arch/sh/boards/se/7751/io.c b/arch/sh/boards/se/7751/io.c
deleted file mode 100644
index e8d846cec89d..000000000000
--- a/arch/sh/boards/se/7751/io.c
+++ /dev/null
@@ -1,135 +0,0 @@
1/*
2 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
3 * Based largely on io_se.c.
4 *
5 * I/O routine for Hitachi 7751 SolutionEngine.
6 *
7 * Initial version only to support LAN access; some
8 * placeholder code from io_se.c left in with the
9 * expectation of later SuperIO and PCMCIA access.
10 */
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/pci.h>
14#include <asm/io.h>
15#include <asm/se7751.h>
16#include <asm/addrspace.h>
17
18static inline volatile u16 *port2adr(unsigned int port)
19{
20 if (port >= 0x2000)
21 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
22 maybebadio((unsigned long)port);
23 return (volatile __u16*)port;
24}
25
26/*
27 * General outline: remap really low stuff [eventually] to SuperIO,
28 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
29 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
30 * should be way beyond the window, and is used w/o translation for
31 * compatibility.
32 */
33unsigned char sh7751se_inb(unsigned long port)
34{
35 if (PXSEG(port))
36 return *(volatile unsigned char *)port;
37 else if (is_pci_ioaddr(port))
38 return *(volatile unsigned char *)pci_ioaddr(port);
39 else
40 return (*port2adr(port)) & 0xff;
41}
42
43unsigned char sh7751se_inb_p(unsigned long port)
44{
45 unsigned char v;
46
47 if (PXSEG(port))
48 v = *(volatile unsigned char *)port;
49 else if (is_pci_ioaddr(port))
50 v = *(volatile unsigned char *)pci_ioaddr(port);
51 else
52 v = (*port2adr(port)) & 0xff;
53 ctrl_delay();
54 return v;
55}
56
57unsigned short sh7751se_inw(unsigned long port)
58{
59 if (PXSEG(port))
60 return *(volatile unsigned short *)port;
61 else if (is_pci_ioaddr(port))
62 return *(volatile unsigned short *)pci_ioaddr(port);
63 else if (port >= 0x2000)
64 return *port2adr(port);
65 else
66 maybebadio(port);
67 return 0;
68}
69
70unsigned int sh7751se_inl(unsigned long port)
71{
72 if (PXSEG(port))
73 return *(volatile unsigned long *)port;
74 else if (is_pci_ioaddr(port))
75 return *(volatile unsigned int *)pci_ioaddr(port);
76 else if (port >= 0x2000)
77 return *port2adr(port);
78 else
79 maybebadio(port);
80 return 0;
81}
82
83void sh7751se_outb(unsigned char value, unsigned long port)
84{
85
86 if (PXSEG(port))
87 *(volatile unsigned char *)port = value;
88 else if (is_pci_ioaddr(port))
89 *((unsigned char*)pci_ioaddr(port)) = value;
90 else
91 *(port2adr(port)) = value;
92}
93
94void sh7751se_outb_p(unsigned char value, unsigned long port)
95{
96 if (PXSEG(port))
97 *(volatile unsigned char *)port = value;
98 else if (is_pci_ioaddr(port))
99 *((unsigned char*)pci_ioaddr(port)) = value;
100 else
101 *(port2adr(port)) = value;
102 ctrl_delay();
103}
104
105void sh7751se_outw(unsigned short value, unsigned long port)
106{
107 if (PXSEG(port))
108 *(volatile unsigned short *)port = value;
109 else if (is_pci_ioaddr(port))
110 *((unsigned short *)pci_ioaddr(port)) = value;
111 else if (port >= 0x2000)
112 *port2adr(port) = value;
113 else
114 maybebadio(port);
115}
116
117void sh7751se_outl(unsigned int value, unsigned long port)
118{
119 if (PXSEG(port))
120 *(volatile unsigned long *)port = value;
121 else if (is_pci_ioaddr(port))
122 *((unsigned long*)pci_ioaddr(port)) = value;
123 else
124 maybebadio(port);
125}
126
127void sh7751se_insl(unsigned long port, void *addr, unsigned long count)
128{
129 maybebadio(port);
130}
131
132void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count)
133{
134 maybebadio(port);
135}
diff --git a/arch/sh/boards/se/7751/irq.c b/arch/sh/boards/se/7751/irq.c
deleted file mode 100644
index c3d12590e5db..000000000000
--- a/arch/sh/boards/se/7751/irq.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/7751/irq.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 * Modified for 7751 Solution Engine by
9 * Ian da Silva and Jeremy Siegel, 2001.
10 */
11
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <asm/irq.h>
15#include <asm/se7751.h>
16
17static struct ipr_data ipr_irq_table[] = {
18 { 13, 3, 3, 2 },
19 /* Add additional entries here as drivers are added and tested. */
20};
21
22static unsigned long ipr_offsets[] = {
23 BCR_ILCRA,
24 BCR_ILCRB,
25 BCR_ILCRC,
26 BCR_ILCRD,
27 BCR_ILCRE,
28 BCR_ILCRF,
29 BCR_ILCRG,
30};
31
32static struct ipr_desc ipr_irq_desc = {
33 .ipr_offsets = ipr_offsets,
34 .nr_offsets = ARRAY_SIZE(ipr_offsets),
35
36 .ipr_data = ipr_irq_table,
37 .nr_irqs = ARRAY_SIZE(ipr_irq_table),
38
39 .chip = {
40 .name = "IPR-se7751",
41 },
42};
43
44/*
45 * Initialize IRQ setting
46 */
47void __init init_7751se_IRQ(void)
48{
49 register_ipr_controller(&ipr_irq_desc);
50}
diff --git a/arch/sh/boards/se/7751/setup.c b/arch/sh/boards/se/7751/setup.c
deleted file mode 100644
index deefbfd92591..000000000000
--- a/arch/sh/boards/se/7751/setup.c
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/7751/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 * Modified for 7751 Solution Engine by
9 * Ian da Silva and Jeremy Siegel, 2001.
10 */
11#include <linux/init.h>
12#include <linux/platform_device.h>
13#include <asm/machvec.h>
14#include <asm/se7751.h>
15#include <asm/io.h>
16#include <asm/heartbeat.h>
17
18static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
19
20static struct heartbeat_data heartbeat_data = {
21 .bit_pos = heartbeat_bit_pos,
22 .nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
23};
24
25static struct resource heartbeat_resources[] = {
26 [0] = {
27 .start = PA_LED,
28 .end = PA_LED,
29 .flags = IORESOURCE_MEM,
30 },
31};
32
33static struct platform_device heartbeat_device = {
34 .name = "heartbeat",
35 .id = -1,
36 .dev = {
37 .platform_data = &heartbeat_data,
38 },
39 .num_resources = ARRAY_SIZE(heartbeat_resources),
40 .resource = heartbeat_resources,
41};
42
43static struct platform_device *se7751_devices[] __initdata = {
44 &heartbeat_device,
45};
46
47static int __init se7751_devices_setup(void)
48{
49 return platform_add_devices(se7751_devices, ARRAY_SIZE(se7751_devices));
50}
51__initcall(se7751_devices_setup);
52
53/*
54 * The Machine Vector
55 */
56static struct sh_machine_vector mv_7751se __initmv = {
57 .mv_name = "7751 SolutionEngine",
58 .mv_nr_irqs = 72,
59
60 .mv_inb = sh7751se_inb,
61 .mv_inw = sh7751se_inw,
62 .mv_inl = sh7751se_inl,
63 .mv_outb = sh7751se_outb,
64 .mv_outw = sh7751se_outw,
65 .mv_outl = sh7751se_outl,
66
67 .mv_inb_p = sh7751se_inb_p,
68 .mv_inw_p = sh7751se_inw,
69 .mv_inl_p = sh7751se_inl,
70 .mv_outb_p = sh7751se_outb_p,
71 .mv_outw_p = sh7751se_outw,
72 .mv_outl_p = sh7751se_outl,
73
74 .mv_insl = sh7751se_insl,
75 .mv_outsl = sh7751se_outsl,
76
77 .mv_init_irq = init_7751se_IRQ,
78};
diff --git a/arch/sh/boards/se/7780/irq.c b/arch/sh/boards/se/7780/irq.c
deleted file mode 100644
index 6bd70da6bb47..000000000000
--- a/arch/sh/boards/se/7780/irq.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/7780/irq.c
3 *
4 * Copyright (C) 2006,2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7780 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/interrupt.h>
15#include <asm/irq.h>
16#include <asm/io.h>
17#include <asm/se7780.h>
18
19/*
20 * Initialize IRQ setting
21 */
22void __init init_se7780_IRQ(void)
23{
24 /* enable all interrupt at FPGA */
25 ctrl_outw(0, FPGA_INTMSK1);
26 /* mask SM501 interrupt */
27 ctrl_outw((ctrl_inw(FPGA_INTMSK1) | 0x0002), FPGA_INTMSK1);
28 /* enable all interrupt at FPGA */
29 ctrl_outw(0, FPGA_INTMSK2);
30
31 /* set FPGA INTSEL register */
32 /* FPGA + 0x06 */
33 ctrl_outw( ((IRQPIN_SM501 << IRQPOS_SM501) |
34 (IRQPIN_SMC91CX << IRQPOS_SMC91CX)), FPGA_INTSEL1);
35
36 /* FPGA + 0x08 */
37 ctrl_outw(((IRQPIN_EXTINT4 << IRQPOS_EXTINT4) |
38 (IRQPIN_EXTINT3 << IRQPOS_EXTINT3) |
39 (IRQPIN_EXTINT2 << IRQPOS_EXTINT2) |
40 (IRQPIN_EXTINT1 << IRQPOS_EXTINT1)), FPGA_INTSEL2);
41
42 /* FPGA + 0x0A */
43 ctrl_outw((IRQPIN_PCCPW << IRQPOS_PCCPW), FPGA_INTSEL3);
44
45 plat_irq_setup_pins(IRQ_MODE_IRQ); /* install handlers for IRQ0-7 */
46}
diff --git a/arch/sh/boards/se/7780/setup.c b/arch/sh/boards/se/7780/setup.c
deleted file mode 100644
index 0f08ab3b2bec..000000000000
--- a/arch/sh/boards/se/7780/setup.c
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/7780/setup.c
3 *
4 * Copyright (C) 2006,2007 Nobuhiro Iwamatsu
5 *
6 * Hitachi UL SolutionEngine 7780 Support.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <asm/machvec.h>
15#include <asm/se7780.h>
16#include <asm/io.h>
17#include <asm/heartbeat.h>
18
19/* Heartbeat */
20static struct heartbeat_data heartbeat_data = {
21 .regsize = 16,
22};
23
24static struct resource heartbeat_resources[] = {
25 [0] = {
26 .start = PA_LED,
27 .end = PA_LED,
28 .flags = IORESOURCE_MEM,
29 },
30};
31
32static struct platform_device heartbeat_device = {
33 .name = "heartbeat",
34 .id = -1,
35 .dev = {
36 .platform_data = &heartbeat_data,
37 },
38 .num_resources = ARRAY_SIZE(heartbeat_resources),
39 .resource = heartbeat_resources,
40};
41
42/* SMC91x */
43static struct resource smc91x_eth_resources[] = {
44 [0] = {
45 .name = "smc91x-regs" ,
46 .start = PA_LAN + 0x300,
47 .end = PA_LAN + 0x300 + 0x10 ,
48 .flags = IORESOURCE_MEM,
49 },
50 [1] = {
51 .start = SMC_IRQ,
52 .end = SMC_IRQ,
53 .flags = IORESOURCE_IRQ,
54 },
55};
56
57static struct platform_device smc91x_eth_device = {
58 .name = "smc91x",
59 .id = 0,
60 .dev = {
61 .dma_mask = NULL, /* don't use dma */
62 .coherent_dma_mask = 0xffffffff,
63 },
64 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
65 .resource = smc91x_eth_resources,
66};
67
68static struct platform_device *se7780_devices[] __initdata = {
69 &heartbeat_device,
70 &smc91x_eth_device,
71};
72
73static int __init se7780_devices_setup(void)
74{
75 return platform_add_devices(se7780_devices,
76 ARRAY_SIZE(se7780_devices));
77}
78device_initcall(se7780_devices_setup);
79
80#define GPIO_PHCR 0xFFEA000E
81#define GPIO_PMSELR 0xFFEA0080
82#define GPIO_PECR 0xFFEA0008
83
84static void __init se7780_setup(char **cmdline_p)
85{
86 /* "SH-Linux" on LED Display */
87 ctrl_outw( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) );
88 ctrl_outw( 'H' , PA_LED_DISP + (DISP_SEL1_ADDR << 1) );
89 ctrl_outw( '-' , PA_LED_DISP + (DISP_SEL2_ADDR << 1) );
90 ctrl_outw( 'L' , PA_LED_DISP + (DISP_SEL3_ADDR << 1) );
91 ctrl_outw( 'i' , PA_LED_DISP + (DISP_SEL4_ADDR << 1) );
92 ctrl_outw( 'n' , PA_LED_DISP + (DISP_SEL5_ADDR << 1) );
93 ctrl_outw( 'u' , PA_LED_DISP + (DISP_SEL6_ADDR << 1) );
94 ctrl_outw( 'x' , PA_LED_DISP + (DISP_SEL7_ADDR << 1) );
95
96 printk(KERN_INFO "Hitachi UL Solutions Engine 7780SE03 support.\n");
97
98 /*
99 * PCI REQ/GNT setting
100 * REQ0/GNT0 -> USB
101 * REQ1/GNT1 -> PC Card
102 * REQ2/GNT2 -> Serial ATA
103 * REQ3/GNT3 -> PCI slot
104 */
105 ctrl_outw(0x0213, FPGA_REQSEL);
106
107 /* GPIO setting */
108 ctrl_outw(0x0000, GPIO_PECR);
109 ctrl_outw(ctrl_inw(GPIO_PHCR)&0xfff3, GPIO_PHCR);
110 ctrl_outw(0x0c00, GPIO_PMSELR);
111
112 /* iVDR Power ON */
113 ctrl_outw(0x0001, FPGA_IVDRPW);
114}
115
116/*
117 * The Machine Vector
118 */
119static struct sh_machine_vector mv_se7780 __initmv = {
120 .mv_name = "Solution Engine 7780" ,
121 .mv_setup = se7780_setup ,
122 .mv_nr_irqs = 111 ,
123 .mv_init_irq = init_se7780_IRQ,
124};
diff --git a/arch/sh/boards/sh03/setup.c b/arch/sh/boards/sh03/setup.c
deleted file mode 100644
index 934ac4f1c48f..000000000000
--- a/arch/sh/boards/sh03/setup.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * linux/arch/sh/boards/sh03/setup.c
3 *
4 * Copyright (C) 2004 Interface Co.,Ltd. Saito.K
5 *
6 */
7
8#include <linux/init.h>
9#include <linux/irq.h>
10#include <linux/pci.h>
11#include <linux/platform_device.h>
12#include <asm/io.h>
13#include <asm/rtc.h>
14#include <asm/sh03/io.h>
15#include <asm/sh03/sh03.h>
16#include <asm/addrspace.h>
17
18static void __init init_sh03_IRQ(void)
19{
20 plat_irq_setup_pins(IRQ_MODE_IRQ);
21}
22
23extern void *cf_io_base;
24
25static void __iomem *sh03_ioport_map(unsigned long port, unsigned int size)
26{
27 if (PXSEG(port))
28 return (void __iomem *)port;
29 /* CompactFlash (IDE) */
30 if (((port >= 0x1f0) && (port <= 0x1f7)) || (port == 0x3f6))
31 return (void __iomem *)((unsigned long)cf_io_base + port);
32
33 return (void __iomem *)(port + PCI_IO_BASE);
34}
35
36/* arch/sh/boards/sh03/rtc.c */
37void sh03_time_init(void);
38
39static void __init sh03_setup(char **cmdline_p)
40{
41 board_time_init = sh03_time_init;
42}
43
44static struct resource heartbeat_resources[] = {
45 [0] = {
46 .start = 0xa0800000,
47 .end = 0xa0800000,
48 .flags = IORESOURCE_MEM,
49 },
50};
51
52static struct platform_device heartbeat_device = {
53 .name = "heartbeat",
54 .id = -1,
55 .num_resources = ARRAY_SIZE(heartbeat_resources),
56 .resource = heartbeat_resources,
57};
58
59static struct platform_device *sh03_devices[] __initdata = {
60 &heartbeat_device,
61};
62
63static int __init sh03_devices_setup(void)
64{
65 return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices));
66}
67__initcall(sh03_devices_setup);
68
69static struct sh_machine_vector mv_sh03 __initmv = {
70 .mv_name = "Interface (CTP/PCI-SH03)",
71 .mv_setup = sh03_setup,
72 .mv_nr_irqs = 48,
73 .mv_ioport_map = sh03_ioport_map,
74 .mv_init_irq = init_sh03_IRQ,
75};
diff --git a/arch/sh/boards/shmin/Makefile b/arch/sh/boards/shmin/Makefile
deleted file mode 100644
index 3190cc72430e..000000000000
--- a/arch/sh/boards/shmin/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the SHMIN board.
3#
4
5obj-y := setup.o
diff --git a/arch/sh/boards/snapgear/setup.c b/arch/sh/boards/snapgear/setup.c
deleted file mode 100644
index 7022483f98e8..000000000000
--- a/arch/sh/boards/snapgear/setup.c
+++ /dev/null
@@ -1,95 +0,0 @@
1/*
2 * linux/arch/sh/boards/snapgear/setup.c
3 *
4 * Copyright (C) 2002 David McCullough <davidm@snapgear.com>
5 * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
6 *
7 * Based on files with the following comments:
8 *
9 * Copyright (C) 2000 Kazumoto Kojima
10 *
11 * Modified for 7751 Solution Engine by
12 * Ian da Silva and Jeremy Siegel, 2001.
13 */
14#include <linux/init.h>
15#include <linux/irq.h>
16#include <linux/interrupt.h>
17#include <linux/timer.h>
18#include <linux/delay.h>
19#include <linux/module.h>
20#include <linux/sched.h>
21#include <asm/machvec.h>
22#include <asm/snapgear.h>
23#include <asm/irq.h>
24#include <asm/io.h>
25#include <asm/cpu/timer.h>
26
27/*
28 * EraseConfig handling functions
29 */
30
31static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
32{
33 (void)ctrl_inb(0xb8000000); /* dummy read */
34
35 printk("SnapGear: erase switch interrupt!\n");
36
37 return IRQ_HANDLED;
38}
39
40static int __init eraseconfig_init(void)
41{
42 printk("SnapGear: EraseConfig init\n");
43 /* Setup "EraseConfig" switch on external IRQ 0 */
44 if (request_irq(IRL0_IRQ, eraseconfig_interrupt, IRQF_DISABLED,
45 "Erase Config", NULL))
46 printk("SnapGear: failed to register IRQ%d for Reset witch\n",
47 IRL0_IRQ);
48 else
49 printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
50 IRL0_IRQ);
51 return(0);
52}
53
54module_init(eraseconfig_init);
55
56/****************************************************************************/
57/*
58 * Initialize IRQ setting
59 *
60 * IRL0 = erase switch
61 * IRL1 = eth0
62 * IRL2 = eth1
63 * IRL3 = crypto
64 */
65
66static void __init init_snapgear_IRQ(void)
67{
68 printk("Setup SnapGear IRQ/IPR ...\n");
69 /* enable individual interrupt mode for externals */
70 plat_irq_setup_pins(IRQ_MODE_IRQ);
71}
72
73/*
74 * The Machine Vector
75 */
76static struct sh_machine_vector mv_snapgear __initmv = {
77 .mv_name = "SnapGear SecureEdge5410",
78 .mv_nr_irqs = 72,
79
80 .mv_inb = snapgear_inb,
81 .mv_inw = snapgear_inw,
82 .mv_inl = snapgear_inl,
83 .mv_outb = snapgear_outb,
84 .mv_outw = snapgear_outw,
85 .mv_outl = snapgear_outl,
86
87 .mv_inb_p = snapgear_inb_p,
88 .mv_inw_p = snapgear_inw,
89 .mv_inl_p = snapgear_inl,
90 .mv_outb_p = snapgear_outb_p,
91 .mv_outw_p = snapgear_outw,
92 .mv_outl_p = snapgear_outl,
93
94 .mv_init_irq = init_snapgear_IRQ,
95};
diff --git a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile
index 89b408620dcb..5b54965eef98 100644
--- a/arch/sh/boot/Makefile
+++ b/arch/sh/boot/Makefile
@@ -18,9 +18,10 @@ CONFIG_PAGE_OFFSET ?= 0x80000000
18CONFIG_MEMORY_START ?= 0x0c000000 18CONFIG_MEMORY_START ?= 0x0c000000
19CONFIG_BOOT_LINK_OFFSET ?= 0x00800000 19CONFIG_BOOT_LINK_OFFSET ?= 0x00800000
20CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000 20CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000
21CONFIG_ENTRY_OFFSET ?= 0x00001000
21 22
22export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \ 23export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \
23 CONFIG_ZERO_PAGE_OFFSET 24 CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET
24 25
25targets := zImage vmlinux.srec uImage uImage.srec 26targets := zImage vmlinux.srec uImage uImage.srec
26subdir- := compressed 27subdir- := compressed
@@ -40,7 +41,7 @@ KERNEL_LOAD := $(shell /bin/bash -c 'printf "0x%08x" \
40KERNEL_ENTRY := $(shell /bin/bash -c 'printf "0x%08x" \ 41KERNEL_ENTRY := $(shell /bin/bash -c 'printf "0x%08x" \
41 $$[$(CONFIG_PAGE_OFFSET) + \ 42 $$[$(CONFIG_PAGE_OFFSET) + \
42 $(CONFIG_MEMORY_START) + \ 43 $(CONFIG_MEMORY_START) + \
43 $(CONFIG_ZERO_PAGE_OFFSET)+0x1000]') 44 $(CONFIG_ZERO_PAGE_OFFSET) + $(CONFIG_ENTRY_OFFSET)]')
44 45
45quiet_cmd_uimage = UIMAGE $@ 46quiet_cmd_uimage = UIMAGE $@
46 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \ 47 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \
diff --git a/arch/sh/boot/compressed/Makefile_32 b/arch/sh/boot/compressed/Makefile_32
index c0d25fb1aa60..47685f618ae7 100644
--- a/arch/sh/boot/compressed/Makefile_32
+++ b/arch/sh/boot/compressed/Makefile_32
@@ -35,8 +35,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE
35$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 35$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
36 $(call if_changed,gzip) 36 $(call if_changed,gzip)
37 37
38LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh-linux -T
39OBJCOPYFLAGS += -R .empty_zero_page 38OBJCOPYFLAGS += -R .empty_zero_page
40 39
41$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE 40$(obj)/piggy.o: $(obj)/piggy.S $(obj)/vmlinux.bin.gz FORCE
42 $(call if_changed,ld) 41 $(call if_changed,as_o_S)
diff --git a/arch/sh/boot/compressed/Makefile_64 b/arch/sh/boot/compressed/Makefile_64
index 912f3e205a0d..658d4f915556 100644
--- a/arch/sh/boot/compressed/Makefile_64
+++ b/arch/sh/boot/compressed/Makefile_64
@@ -37,8 +37,7 @@ $(obj)/vmlinux.bin: vmlinux FORCE
37$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 37$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
38 $(call if_changed,gzip) 38 $(call if_changed,gzip)
39 39
40LDFLAGS_piggy.o := -r --format binary --oformat elf32-sh64-linux -T
41OBJCOPYFLAGS += -R .empty_zero_page 40OBJCOPYFLAGS += -R .empty_zero_page
42 41
43$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE 42$(obj)/piggy.o: $(obj)/piggy.S $(obj)/vmlinux.bin.gz FORCE
44 $(call if_changed,ld) 43 $(call if_changed,as_o_S)
diff --git a/arch/sh/boot/compressed/head_64.S b/arch/sh/boot/compressed/head_64.S
index f72c1989f5f2..622eac3cf556 100644
--- a/arch/sh/boot/compressed/head_64.S
+++ b/arch/sh/boot/compressed/head_64.S
@@ -14,8 +14,8 @@
14 * Copyright (C) 2002 Stuart Menefy (stuart.menefy@st.com) 14 * Copyright (C) 2002 Stuart Menefy (stuart.menefy@st.com)
15 */ 15 */
16#include <asm/cache.h> 16#include <asm/cache.h>
17#include <asm/cpu/mmu_context.h> 17#include <cpu/mmu_context.h>
18#include <asm/cpu/registers.h> 18#include <cpu/registers.h>
19 19
20/* 20/*
21 * Fixed TLB entries to identity map the beginning of RAM 21 * Fixed TLB entries to identity map the beginning of RAM
diff --git a/arch/sh/boot/compressed/piggy.S b/arch/sh/boot/compressed/piggy.S
new file mode 100644
index 000000000000..566071926b13
--- /dev/null
+++ b/arch/sh/boot/compressed/piggy.S
@@ -0,0 +1,8 @@
1 .global input_len, input_data
2 .data
3input_len:
4 .long input_data_end - input_data
5input_data:
6 .incbin "arch/sh/boot/compressed/vmlinux.bin.gz"
7input_data_end:
8 .end
diff --git a/arch/sh/boot/compressed/vmlinux.scr b/arch/sh/boot/compressed/vmlinux.scr
deleted file mode 100644
index 1ed9d791f863..000000000000
--- a/arch/sh/boot/compressed/vmlinux.scr
+++ /dev/null
@@ -1,9 +0,0 @@
1SECTIONS
2{
3 .data : {
4 input_len = .;
5 LONG(input_data_end - input_data) input_data = .;
6 *(.data)
7 input_data_end = .;
8 }
9}
diff --git a/arch/sh/configs/ap325rxa_defconfig b/arch/sh/configs/ap325rxa_defconfig
new file mode 100644
index 000000000000..29926a9b9ce2
--- /dev/null
+++ b/arch/sh/configs/ap325rxa_defconfig
@@ -0,0 +1,964 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26
4# Wed Jul 30 01:18:59 2008
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_BUG=y
11CONFIG_GENERIC_FIND_NEXT_BIT=y
12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_GENERIC_IRQ_PROBE=y
15CONFIG_GENERIC_CALIBRATE_DELAY=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_CLOCKEVENTS=y
18CONFIG_STACKTRACE_SUPPORT=y
19CONFIG_LOCKDEP_SUPPORT=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y
23CONFIG_ARCH_SUPPORTS_AOUT=y
24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
25
26#
27# General setup
28#
29CONFIG_EXPERIMENTAL=y
30CONFIG_BROKEN_ON_SMP=y
31CONFIG_LOCK_KERNEL=y
32CONFIG_INIT_ENV_ARG_LIMIT=32
33CONFIG_LOCALVERSION=""
34# CONFIG_LOCALVERSION_AUTO is not set
35CONFIG_SWAP=y
36CONFIG_SYSVIPC=y
37CONFIG_SYSVIPC_SYSCTL=y
38# CONFIG_POSIX_MQUEUE is not set
39CONFIG_BSD_PROCESS_ACCT=y
40# CONFIG_BSD_PROCESS_ACCT_V3 is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_AUDIT is not set
43# CONFIG_IKCONFIG is not set
44CONFIG_LOG_BUF_SHIFT=14
45# CONFIG_CGROUPS is not set
46CONFIG_GROUP_SCHED=y
47CONFIG_FAIR_GROUP_SCHED=y
48# CONFIG_RT_GROUP_SCHED is not set
49CONFIG_USER_SCHED=y
50# CONFIG_CGROUP_SCHED is not set
51CONFIG_SYSFS_DEPRECATED=y
52CONFIG_SYSFS_DEPRECATED_V2=y
53# CONFIG_RELAY is not set
54# CONFIG_NAMESPACES is not set
55# CONFIG_BLK_DEV_INITRD is not set
56CONFIG_CC_OPTIMIZE_FOR_SIZE=y
57CONFIG_SYSCTL=y
58CONFIG_EMBEDDED=y
59CONFIG_UID16=y
60CONFIG_SYSCTL_SYSCALL=y
61CONFIG_SYSCTL_SYSCALL_CHECK=y
62# CONFIG_KALLSYMS 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
80# CONFIG_PROFILING is not set
81# CONFIG_MARKERS is not set
82CONFIG_HAVE_OPROFILE=y
83# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
84# CONFIG_HAVE_IOREMAP_PROT is not set
85# CONFIG_HAVE_KPROBES is not set
86# CONFIG_HAVE_KRETPROBES is not set
87# CONFIG_HAVE_ARCH_TRACEHOOK is not set
88# CONFIG_HAVE_DMA_ATTRS is not set
89# CONFIG_USE_GENERIC_SMP_HELPERS is not set
90CONFIG_HAVE_CLK=y
91CONFIG_PROC_PAGE_MONITOR=y
92CONFIG_SLABINFO=y
93CONFIG_RT_MUTEXES=y
94# CONFIG_TINY_SHMEM is not set
95CONFIG_BASE_SMALL=0
96CONFIG_MODULES=y
97# CONFIG_MODULE_FORCE_LOAD is not set
98CONFIG_MODULE_UNLOAD=y
99# CONFIG_MODULE_FORCE_UNLOAD is not set
100# CONFIG_MODVERSIONS is not set
101# CONFIG_MODULE_SRCVERSION_ALL is not set
102CONFIG_KMOD=y
103CONFIG_BLOCK=y
104# CONFIG_LBD is not set
105# CONFIG_BLK_DEV_IO_TRACE is not set
106# CONFIG_LSF is not set
107# CONFIG_BLK_DEV_BSG is not set
108# CONFIG_BLK_DEV_INTEGRITY is not set
109
110#
111# IO Schedulers
112#
113CONFIG_IOSCHED_NOOP=y
114CONFIG_IOSCHED_AS=y
115CONFIG_IOSCHED_DEADLINE=y
116CONFIG_IOSCHED_CFQ=y
117# CONFIG_DEFAULT_AS is not set
118# CONFIG_DEFAULT_DEADLINE is not set
119CONFIG_DEFAULT_CFQ=y
120# CONFIG_DEFAULT_NOOP is not set
121CONFIG_DEFAULT_IOSCHED="cfq"
122CONFIG_CLASSIC_RCU=y
123
124#
125# System type
126#
127CONFIG_CPU_SH4=y
128CONFIG_CPU_SH4A=y
129CONFIG_CPU_SHX2=y
130# CONFIG_CPU_SUBTYPE_SH7619 is not set
131# CONFIG_CPU_SUBTYPE_SH7203 is not set
132# CONFIG_CPU_SUBTYPE_SH7206 is not set
133# CONFIG_CPU_SUBTYPE_SH7263 is not set
134# CONFIG_CPU_SUBTYPE_MXG is not set
135# CONFIG_CPU_SUBTYPE_SH7705 is not set
136# CONFIG_CPU_SUBTYPE_SH7706 is not set
137# CONFIG_CPU_SUBTYPE_SH7707 is not set
138# CONFIG_CPU_SUBTYPE_SH7708 is not set
139# CONFIG_CPU_SUBTYPE_SH7709 is not set
140# CONFIG_CPU_SUBTYPE_SH7710 is not set
141# CONFIG_CPU_SUBTYPE_SH7712 is not set
142# CONFIG_CPU_SUBTYPE_SH7720 is not set
143# CONFIG_CPU_SUBTYPE_SH7721 is not set
144# CONFIG_CPU_SUBTYPE_SH7750 is not set
145# CONFIG_CPU_SUBTYPE_SH7091 is not set
146# CONFIG_CPU_SUBTYPE_SH7750R is not set
147# CONFIG_CPU_SUBTYPE_SH7750S is not set
148# CONFIG_CPU_SUBTYPE_SH7751 is not set
149# CONFIG_CPU_SUBTYPE_SH7751R is not set
150# CONFIG_CPU_SUBTYPE_SH7760 is not set
151# CONFIG_CPU_SUBTYPE_SH4_202 is not set
152CONFIG_CPU_SUBTYPE_SH7723=y
153# CONFIG_CPU_SUBTYPE_SH7763 is not set
154# CONFIG_CPU_SUBTYPE_SH7770 is not set
155# CONFIG_CPU_SUBTYPE_SH7780 is not set
156# CONFIG_CPU_SUBTYPE_SH7785 is not set
157# CONFIG_CPU_SUBTYPE_SHX3 is not set
158# CONFIG_CPU_SUBTYPE_SH7343 is not set
159# CONFIG_CPU_SUBTYPE_SH7722 is not set
160# CONFIG_CPU_SUBTYPE_SH7366 is not set
161# CONFIG_CPU_SUBTYPE_SH5_101 is not set
162# CONFIG_CPU_SUBTYPE_SH5_103 is not set
163
164#
165# Memory management options
166#
167CONFIG_QUICKLIST=y
168CONFIG_MMU=y
169CONFIG_PAGE_OFFSET=0x80000000
170CONFIG_MEMORY_START=0x08000000
171CONFIG_MEMORY_SIZE=0x08000000
172CONFIG_29BIT=y
173# CONFIG_X2TLB is not set
174CONFIG_VSYSCALL=y
175CONFIG_ARCH_FLATMEM_ENABLE=y
176CONFIG_ARCH_SPARSEMEM_ENABLE=y
177CONFIG_ARCH_SPARSEMEM_DEFAULT=y
178CONFIG_MAX_ACTIVE_REGIONS=1
179CONFIG_ARCH_POPULATES_NODE_MAP=y
180CONFIG_ARCH_SELECT_MEMORY_MODEL=y
181CONFIG_PAGE_SIZE_4KB=y
182# CONFIG_PAGE_SIZE_8KB is not set
183# CONFIG_PAGE_SIZE_16KB is not set
184# CONFIG_PAGE_SIZE_64KB is not set
185CONFIG_ENTRY_OFFSET=0x00001000
186CONFIG_SELECT_MEMORY_MODEL=y
187CONFIG_FLATMEM_MANUAL=y
188# CONFIG_DISCONTIGMEM_MANUAL is not set
189# CONFIG_SPARSEMEM_MANUAL is not set
190CONFIG_FLATMEM=y
191CONFIG_FLAT_NODE_MEM_MAP=y
192CONFIG_SPARSEMEM_STATIC=y
193# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
194CONFIG_PAGEFLAGS_EXTENDED=y
195CONFIG_SPLIT_PTLOCK_CPUS=4
196# CONFIG_RESOURCES_64BIT is not set
197CONFIG_ZONE_DMA_FLAG=0
198CONFIG_NR_QUICK=2
199
200#
201# Cache configuration
202#
203# CONFIG_SH_DIRECT_MAPPED is not set
204CONFIG_CACHE_WRITEBACK=y
205# CONFIG_CACHE_WRITETHROUGH is not set
206# CONFIG_CACHE_OFF is not set
207
208#
209# Processor features
210#
211CONFIG_CPU_LITTLE_ENDIAN=y
212# CONFIG_CPU_BIG_ENDIAN is not set
213CONFIG_SH_FPU=y
214# CONFIG_SH_STORE_QUEUES is not set
215CONFIG_CPU_HAS_INTEVT=y
216CONFIG_CPU_HAS_SR_RB=y
217CONFIG_CPU_HAS_PTEA=y
218CONFIG_CPU_HAS_FPU=y
219
220#
221# Board support
222#
223CONFIG_SH_AP325RXA=y
224
225#
226# Timer and clock configuration
227#
228CONFIG_SH_TMU=y
229CONFIG_SH_TIMER_IRQ=16
230CONFIG_SH_PCLK_FREQ=33333333
231CONFIG_TICK_ONESHOT=y
232# CONFIG_NO_HZ is not set
233CONFIG_HIGH_RES_TIMERS=y
234CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
235
236#
237# CPU Frequency scaling
238#
239# CONFIG_CPU_FREQ is not set
240
241#
242# DMA support
243#
244# CONFIG_SH_DMA is not set
245
246#
247# Companion Chips
248#
249
250#
251# Additional SuperH Device Drivers
252#
253# CONFIG_HEARTBEAT is not set
254# CONFIG_PUSH_SWITCH is not set
255
256#
257# Kernel features
258#
259# CONFIG_HZ_100 is not set
260CONFIG_HZ_250=y
261# CONFIG_HZ_300 is not set
262# CONFIG_HZ_1000 is not set
263CONFIG_HZ=250
264# CONFIG_SCHED_HRTICK is not set
265# CONFIG_KEXEC is not set
266# CONFIG_CRASH_DUMP is not set
267# CONFIG_PREEMPT_NONE is not set
268# CONFIG_PREEMPT_VOLUNTARY is not set
269CONFIG_PREEMPT=y
270# CONFIG_PREEMPT_RCU is not set
271CONFIG_GUSA=y
272
273#
274# Boot options
275#
276CONFIG_ZERO_PAGE_OFFSET=0x00001000
277CONFIG_BOOT_LINK_OFFSET=0x00800000
278CONFIG_CMDLINE_BOOL=y
279CONFIG_CMDLINE="console=tty1 console=ttySC5,38400 root=/dev/nfs ip=dhcp"
280
281#
282# Bus options
283#
284# CONFIG_ARCH_SUPPORTS_MSI is not set
285# CONFIG_PCCARD is not set
286
287#
288# Executable file formats
289#
290CONFIG_BINFMT_ELF=y
291# CONFIG_BINFMT_MISC is not set
292
293#
294# Networking
295#
296CONFIG_NET=y
297
298#
299# Networking options
300#
301CONFIG_PACKET=y
302# CONFIG_PACKET_MMAP is not set
303CONFIG_UNIX=y
304# CONFIG_NET_KEY is not set
305CONFIG_INET=y
306# CONFIG_IP_MULTICAST is not set
307CONFIG_IP_ADVANCED_ROUTER=y
308CONFIG_ASK_IP_FIB_HASH=y
309# CONFIG_IP_FIB_TRIE is not set
310CONFIG_IP_FIB_HASH=y
311# CONFIG_IP_MULTIPLE_TABLES is not set
312# CONFIG_IP_ROUTE_MULTIPATH is not set
313# CONFIG_IP_ROUTE_VERBOSE is not set
314CONFIG_IP_PNP=y
315CONFIG_IP_PNP_DHCP=y
316# CONFIG_IP_PNP_BOOTP is not set
317# CONFIG_IP_PNP_RARP is not set
318# CONFIG_NET_IPIP is not set
319# CONFIG_NET_IPGRE is not set
320# CONFIG_ARPD is not set
321# CONFIG_SYN_COOKIES is not set
322# CONFIG_INET_AH is not set
323# CONFIG_INET_ESP is not set
324# CONFIG_INET_IPCOMP is not set
325# CONFIG_INET_XFRM_TUNNEL is not set
326# CONFIG_INET_TUNNEL is not set
327# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
328# CONFIG_INET_XFRM_MODE_TUNNEL is not set
329# CONFIG_INET_XFRM_MODE_BEET is not set
330# CONFIG_INET_LRO is not set
331CONFIG_INET_DIAG=y
332CONFIG_INET_TCP_DIAG=y
333# CONFIG_TCP_CONG_ADVANCED is not set
334CONFIG_TCP_CONG_CUBIC=y
335CONFIG_DEFAULT_TCP_CONG="cubic"
336# CONFIG_TCP_MD5SIG is not set
337# CONFIG_IPV6 is not set
338# CONFIG_NETWORK_SECMARK is not set
339# CONFIG_NETFILTER is not set
340# CONFIG_IP_DCCP is not set
341# CONFIG_IP_SCTP is not set
342# CONFIG_TIPC is not set
343# CONFIG_ATM is not set
344# CONFIG_BRIDGE is not set
345# CONFIG_VLAN_8021Q is not set
346# CONFIG_DECNET is not set
347# CONFIG_LLC2 is not set
348# CONFIG_IPX is not set
349# CONFIG_ATALK is not set
350# CONFIG_X25 is not set
351# CONFIG_LAPB is not set
352# CONFIG_ECONET is not set
353# CONFIG_WAN_ROUTER is not set
354# CONFIG_NET_SCHED is not set
355
356#
357# Network testing
358#
359# CONFIG_NET_PKTGEN is not set
360# CONFIG_HAMRADIO is not set
361# CONFIG_CAN is not set
362# CONFIG_IRDA is not set
363# CONFIG_BT is not set
364# CONFIG_AF_RXRPC is not set
365
366#
367# Wireless
368#
369# CONFIG_CFG80211 is not set
370# CONFIG_WIRELESS_EXT is not set
371# CONFIG_MAC80211 is not set
372# CONFIG_IEEE80211 is not set
373# CONFIG_RFKILL is not set
374# CONFIG_NET_9P is not set
375
376#
377# Device Drivers
378#
379
380#
381# Generic Driver Options
382#
383CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
384CONFIG_STANDALONE=y
385CONFIG_PREVENT_FIRMWARE_BUILD=y
386CONFIG_FW_LOADER=y
387CONFIG_FIRMWARE_IN_KERNEL=y
388CONFIG_EXTRA_FIRMWARE=""
389# CONFIG_SYS_HYPERVISOR is not set
390# CONFIG_CONNECTOR is not set
391CONFIG_MTD=y
392# CONFIG_MTD_DEBUG is not set
393CONFIG_MTD_CONCAT=y
394CONFIG_MTD_PARTITIONS=y
395# CONFIG_MTD_REDBOOT_PARTS is not set
396CONFIG_MTD_CMDLINE_PARTS=y
397# CONFIG_MTD_AR7_PARTS is not set
398
399#
400# User Modules And Translation Layers
401#
402CONFIG_MTD_CHAR=y
403CONFIG_MTD_BLKDEVS=y
404CONFIG_MTD_BLOCK=y
405# CONFIG_FTL is not set
406# CONFIG_NFTL is not set
407# CONFIG_INFTL is not set
408# CONFIG_RFD_FTL is not set
409# CONFIG_SSFDC is not set
410# CONFIG_MTD_OOPS is not set
411
412#
413# RAM/ROM/Flash chip drivers
414#
415CONFIG_MTD_CFI=y
416# CONFIG_MTD_JEDECPROBE is not set
417CONFIG_MTD_GEN_PROBE=y
418# CONFIG_MTD_CFI_ADV_OPTIONS 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_CFI_INTELEXT is not set
430CONFIG_MTD_CFI_AMDSTD=y
431# CONFIG_MTD_CFI_STAA is not set
432CONFIG_MTD_CFI_UTIL=y
433# CONFIG_MTD_RAM is not set
434# CONFIG_MTD_ROM is not set
435# CONFIG_MTD_ABSENT is not set
436
437#
438# Mapping drivers for chip access
439#
440# CONFIG_MTD_COMPLEX_MAPPINGS is not set
441CONFIG_MTD_PHYSMAP=y
442CONFIG_MTD_PHYSMAP_START=0xffffffff
443CONFIG_MTD_PHYSMAP_LEN=0
444CONFIG_MTD_PHYSMAP_BANKWIDTH=0
445# CONFIG_MTD_PLATRAM is not set
446
447#
448# Self-contained MTD device drivers
449#
450# CONFIG_MTD_SLRAM is not set
451# CONFIG_MTD_PHRAM is not set
452# CONFIG_MTD_MTDRAM is not set
453# CONFIG_MTD_BLOCK2MTD is not set
454
455#
456# Disk-On-Chip Device Drivers
457#
458# CONFIG_MTD_DOC2000 is not set
459# CONFIG_MTD_DOC2001 is not set
460# CONFIG_MTD_DOC2001PLUS is not set
461# CONFIG_MTD_NAND is not set
462# CONFIG_MTD_ONENAND is not set
463
464#
465# UBI - Unsorted block images
466#
467# CONFIG_MTD_UBI is not set
468# CONFIG_PARPORT is not set
469CONFIG_BLK_DEV=y
470# CONFIG_BLK_DEV_COW_COMMON is not set
471# CONFIG_BLK_DEV_LOOP is not set
472# CONFIG_BLK_DEV_NBD is not set
473CONFIG_BLK_DEV_RAM=y
474CONFIG_BLK_DEV_RAM_COUNT=4
475CONFIG_BLK_DEV_RAM_SIZE=4096
476# CONFIG_BLK_DEV_XIP is not set
477# CONFIG_CDROM_PKTCDVD is not set
478# CONFIG_ATA_OVER_ETH is not set
479# CONFIG_BLK_DEV_HD is not set
480CONFIG_MISC_DEVICES=y
481# CONFIG_EEPROM_93CX6 is not set
482# CONFIG_ENCLOSURE_SERVICES is not set
483CONFIG_HAVE_IDE=y
484# CONFIG_IDE 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#
509# CONFIG_SCSI_MULTI_LUN is not set
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_SCSI_DH is not set
527# CONFIG_ATA is not set
528# CONFIG_MD is not set
529CONFIG_NETDEVICES=y
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
536# CONFIG_PHYLIB is not set
537CONFIG_NET_ETHERNET=y
538CONFIG_MII=y
539# CONFIG_AX88796 is not set
540# CONFIG_STNIC is not set
541# CONFIG_SMC91X is not set
542CONFIG_SMC911X=y
543# CONFIG_IBM_NEW_EMAC_ZMII is not set
544# CONFIG_IBM_NEW_EMAC_RGMII is not set
545# CONFIG_IBM_NEW_EMAC_TAH is not set
546# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
547# CONFIG_B44 is not set
548# CONFIG_NETDEV_1000 is not set
549# CONFIG_NETDEV_10000 is not set
550
551#
552# Wireless LAN
553#
554# CONFIG_WLAN_PRE80211 is not set
555# CONFIG_WLAN_80211 is not set
556# CONFIG_IWLWIFI_LEDS is not set
557# CONFIG_WAN is not set
558# CONFIG_PPP is not set
559# CONFIG_SLIP is not set
560# CONFIG_NETCONSOLE is not set
561# CONFIG_NETPOLL is not set
562# CONFIG_NET_POLL_CONTROLLER is not set
563# CONFIG_ISDN is not set
564# CONFIG_PHONE is not set
565
566#
567# Input device support
568#
569CONFIG_INPUT=y
570# CONFIG_INPUT_FF_MEMLESS is not set
571# CONFIG_INPUT_POLLDEV is not set
572
573#
574# Userland interfaces
575#
576# CONFIG_INPUT_MOUSEDEV is not set
577# CONFIG_INPUT_JOYDEV is not set
578# CONFIG_INPUT_EVDEV is not set
579# CONFIG_INPUT_EVBUG is not set
580
581#
582# Input Device Drivers
583#
584# CONFIG_INPUT_KEYBOARD is not set
585# CONFIG_INPUT_MOUSE is not set
586# CONFIG_INPUT_JOYSTICK is not set
587# CONFIG_INPUT_TABLET is not set
588# CONFIG_INPUT_TOUCHSCREEN is not set
589# CONFIG_INPUT_MISC is not set
590
591#
592# Hardware I/O ports
593#
594# CONFIG_SERIO is not set
595# CONFIG_GAMEPORT is not set
596
597#
598# Character devices
599#
600CONFIG_VT=y
601CONFIG_CONSOLE_TRANSLATIONS=y
602CONFIG_VT_CONSOLE=y
603CONFIG_HW_CONSOLE=y
604CONFIG_VT_HW_CONSOLE_BINDING=y
605CONFIG_DEVKMEM=y
606# CONFIG_SERIAL_NONSTANDARD is not set
607
608#
609# Serial drivers
610#
611# CONFIG_SERIAL_8250 is not set
612
613#
614# Non-8250 serial port support
615#
616CONFIG_SERIAL_SH_SCI=y
617CONFIG_SERIAL_SH_SCI_NR_UARTS=6
618CONFIG_SERIAL_SH_SCI_CONSOLE=y
619CONFIG_SERIAL_CORE=y
620CONFIG_SERIAL_CORE_CONSOLE=y
621CONFIG_UNIX98_PTYS=y
622CONFIG_LEGACY_PTYS=y
623CONFIG_LEGACY_PTY_COUNT=256
624# CONFIG_IPMI_HANDLER is not set
625CONFIG_HW_RANDOM=y
626# CONFIG_R3964 is not set
627# CONFIG_RAW_DRIVER is not set
628# CONFIG_TCG_TPM is not set
629# CONFIG_I2C is not set
630# CONFIG_SPI is not set
631# CONFIG_W1 is not set
632# CONFIG_POWER_SUPPLY is not set
633# CONFIG_HWMON is not set
634# CONFIG_THERMAL is not set
635# CONFIG_THERMAL_HWMON is not set
636# CONFIG_WATCHDOG is not set
637
638#
639# Sonics Silicon Backplane
640#
641CONFIG_SSB_POSSIBLE=y
642# CONFIG_SSB is not set
643
644#
645# Multifunction device drivers
646#
647# CONFIG_MFD_CORE is not set
648# CONFIG_MFD_SM501 is not set
649# CONFIG_HTC_PASIC3 is not set
650
651#
652# Multimedia devices
653#
654
655#
656# Multimedia core support
657#
658# CONFIG_VIDEO_DEV is not set
659# CONFIG_DVB_CORE is not set
660# CONFIG_VIDEO_MEDIA is not set
661
662#
663# Multimedia drivers
664#
665# CONFIG_DAB is not set
666
667#
668# Graphics support
669#
670# CONFIG_VGASTATE is not set
671# CONFIG_VIDEO_OUTPUT_CONTROL is not set
672# CONFIG_FB is not set
673# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
674
675#
676# Display device support
677#
678# CONFIG_DISPLAY_SUPPORT is not set
679
680#
681# Console display driver support
682#
683CONFIG_DUMMY_CONSOLE=y
684# CONFIG_SOUND is not set
685# CONFIG_HID_SUPPORT is not set
686# CONFIG_USB_SUPPORT is not set
687# CONFIG_MMC is not set
688# CONFIG_MEMSTICK is not set
689# CONFIG_NEW_LEDS is not set
690# CONFIG_ACCESSIBILITY is not set
691# CONFIG_RTC_CLASS is not set
692# CONFIG_DMADEVICES is not set
693# CONFIG_UIO is not set
694
695#
696# File systems
697#
698CONFIG_EXT2_FS=y
699CONFIG_EXT2_FS_XATTR=y
700CONFIG_EXT2_FS_POSIX_ACL=y
701CONFIG_EXT2_FS_SECURITY=y
702# CONFIG_EXT2_FS_XIP is not set
703CONFIG_EXT3_FS=y
704CONFIG_EXT3_FS_XATTR=y
705CONFIG_EXT3_FS_POSIX_ACL=y
706CONFIG_EXT3_FS_SECURITY=y
707# CONFIG_EXT4DEV_FS is not set
708CONFIG_JBD=y
709CONFIG_FS_MBCACHE=y
710# CONFIG_REISERFS_FS is not set
711# CONFIG_JFS_FS is not set
712CONFIG_FS_POSIX_ACL=y
713# CONFIG_XFS_FS is not set
714# CONFIG_OCFS2_FS is not set
715CONFIG_DNOTIFY=y
716CONFIG_INOTIFY=y
717CONFIG_INOTIFY_USER=y
718# CONFIG_QUOTA is not set
719# CONFIG_AUTOFS_FS is not set
720# CONFIG_AUTOFS4_FS is not set
721# CONFIG_FUSE_FS is not set
722
723#
724# CD-ROM/DVD Filesystems
725#
726# CONFIG_ISO9660_FS is not set
727# CONFIG_UDF_FS is not set
728
729#
730# DOS/FAT/NT Filesystems
731#
732CONFIG_FAT_FS=y
733# CONFIG_MSDOS_FS is not set
734CONFIG_VFAT_FS=y
735CONFIG_FAT_DEFAULT_CODEPAGE=437
736CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
737# CONFIG_NTFS_FS is not set
738
739#
740# Pseudo filesystems
741#
742CONFIG_PROC_FS=y
743CONFIG_PROC_KCORE=y
744CONFIG_PROC_SYSCTL=y
745CONFIG_SYSFS=y
746CONFIG_TMPFS=y
747# CONFIG_TMPFS_POSIX_ACL is not set
748# CONFIG_HUGETLBFS is not set
749# CONFIG_HUGETLB_PAGE is not set
750# CONFIG_CONFIGFS_FS is not set
751
752#
753# Miscellaneous filesystems
754#
755# CONFIG_ADFS_FS is not set
756# CONFIG_AFFS_FS is not set
757# CONFIG_HFS_FS is not set
758# CONFIG_HFSPLUS_FS is not set
759# CONFIG_BEFS_FS is not set
760# CONFIG_BFS_FS is not set
761# CONFIG_EFS_FS is not set
762# CONFIG_JFFS2_FS is not set
763# CONFIG_CRAMFS is not set
764# CONFIG_VXFS_FS is not set
765# CONFIG_MINIX_FS is not set
766# CONFIG_OMFS_FS is not set
767# CONFIG_HPFS_FS is not set
768# CONFIG_QNX4FS_FS is not set
769# CONFIG_ROMFS_FS is not set
770# CONFIG_SYSV_FS is not set
771# CONFIG_UFS_FS is not set
772CONFIG_NETWORK_FILESYSTEMS=y
773CONFIG_NFS_FS=y
774CONFIG_NFS_V3=y
775# CONFIG_NFS_V3_ACL is not set
776# CONFIG_NFS_V4 is not set
777CONFIG_ROOT_NFS=y
778CONFIG_NFSD=y
779CONFIG_NFSD_V3=y
780# CONFIG_NFSD_V3_ACL is not set
781# CONFIG_NFSD_V4 is not set
782CONFIG_LOCKD=y
783CONFIG_LOCKD_V4=y
784CONFIG_EXPORTFS=y
785CONFIG_NFS_COMMON=y
786CONFIG_SUNRPC=y
787# CONFIG_RPCSEC_GSS_KRB5 is not set
788# CONFIG_RPCSEC_GSS_SPKM3 is not set
789# CONFIG_SMB_FS is not set
790# CONFIG_CIFS is not set
791# CONFIG_NCP_FS is not set
792# CONFIG_CODA_FS is not set
793# CONFIG_AFS_FS is not set
794
795#
796# Partition Types
797#
798# CONFIG_PARTITION_ADVANCED is not set
799CONFIG_MSDOS_PARTITION=y
800CONFIG_NLS=y
801CONFIG_NLS_DEFAULT="iso8859-1"
802CONFIG_NLS_CODEPAGE_437=y
803# CONFIG_NLS_CODEPAGE_737 is not set
804# CONFIG_NLS_CODEPAGE_775 is not set
805# CONFIG_NLS_CODEPAGE_850 is not set
806# CONFIG_NLS_CODEPAGE_852 is not set
807# CONFIG_NLS_CODEPAGE_855 is not set
808# CONFIG_NLS_CODEPAGE_857 is not set
809# CONFIG_NLS_CODEPAGE_860 is not set
810# CONFIG_NLS_CODEPAGE_861 is not set
811# CONFIG_NLS_CODEPAGE_862 is not set
812# CONFIG_NLS_CODEPAGE_863 is not set
813# CONFIG_NLS_CODEPAGE_864 is not set
814# CONFIG_NLS_CODEPAGE_865 is not set
815# CONFIG_NLS_CODEPAGE_866 is not set
816# CONFIG_NLS_CODEPAGE_869 is not set
817# CONFIG_NLS_CODEPAGE_936 is not set
818# CONFIG_NLS_CODEPAGE_950 is not set
819CONFIG_NLS_CODEPAGE_932=y
820# CONFIG_NLS_CODEPAGE_949 is not set
821# CONFIG_NLS_CODEPAGE_874 is not set
822# CONFIG_NLS_ISO8859_8 is not set
823# CONFIG_NLS_CODEPAGE_1250 is not set
824# CONFIG_NLS_CODEPAGE_1251 is not set
825# CONFIG_NLS_ASCII is not set
826CONFIG_NLS_ISO8859_1=y
827# CONFIG_NLS_ISO8859_2 is not set
828# CONFIG_NLS_ISO8859_3 is not set
829# CONFIG_NLS_ISO8859_4 is not set
830# CONFIG_NLS_ISO8859_5 is not set
831# CONFIG_NLS_ISO8859_6 is not set
832# CONFIG_NLS_ISO8859_7 is not set
833# CONFIG_NLS_ISO8859_9 is not set
834# CONFIG_NLS_ISO8859_13 is not set
835# CONFIG_NLS_ISO8859_14 is not set
836# CONFIG_NLS_ISO8859_15 is not set
837# CONFIG_NLS_KOI8_R is not set
838# CONFIG_NLS_KOI8_U is not set
839# CONFIG_NLS_UTF8 is not set
840# CONFIG_DLM is not set
841
842#
843# Kernel hacking
844#
845CONFIG_TRACE_IRQFLAGS_SUPPORT=y
846# CONFIG_PRINTK_TIME is not set
847CONFIG_ENABLE_WARN_DEPRECATED=y
848# CONFIG_ENABLE_MUST_CHECK is not set
849CONFIG_FRAME_WARN=1024
850# CONFIG_MAGIC_SYSRQ is not set
851# CONFIG_UNUSED_SYMBOLS is not set
852# CONFIG_DEBUG_FS is not set
853# CONFIG_HEADERS_CHECK is not set
854# CONFIG_DEBUG_KERNEL is not set
855# CONFIG_DEBUG_BUGVERBOSE is not set
856# CONFIG_DEBUG_MEMORY_INIT is not set
857# CONFIG_SAMPLES is not set
858# CONFIG_SH_STANDARD_BIOS is not set
859# CONFIG_EARLY_SCIF_CONSOLE is not set
860# CONFIG_SH_KGDB is not set
861
862#
863# Security options
864#
865# CONFIG_KEYS is not set
866# CONFIG_SECURITY is not set
867# CONFIG_SECURITY_FILE_CAPABILITIES is not set
868CONFIG_CRYPTO=y
869
870#
871# Crypto core or helper
872#
873CONFIG_CRYPTO_ALGAPI=y
874CONFIG_CRYPTO_BLKCIPHER=y
875CONFIG_CRYPTO_MANAGER=y
876# CONFIG_CRYPTO_GF128MUL is not set
877# CONFIG_CRYPTO_NULL is not set
878# CONFIG_CRYPTO_CRYPTD is not set
879# CONFIG_CRYPTO_AUTHENC is not set
880# CONFIG_CRYPTO_TEST is not set
881
882#
883# Authenticated Encryption with Associated Data
884#
885# CONFIG_CRYPTO_CCM is not set
886# CONFIG_CRYPTO_GCM is not set
887# CONFIG_CRYPTO_SEQIV is not set
888
889#
890# Block modes
891#
892CONFIG_CRYPTO_CBC=y
893# CONFIG_CRYPTO_CTR is not set
894# CONFIG_CRYPTO_CTS is not set
895# CONFIG_CRYPTO_ECB is not set
896# CONFIG_CRYPTO_LRW is not set
897# CONFIG_CRYPTO_PCBC is not set
898# CONFIG_CRYPTO_XTS is not set
899
900#
901# Hash modes
902#
903# CONFIG_CRYPTO_HMAC is not set
904# CONFIG_CRYPTO_XCBC is not set
905
906#
907# Digest
908#
909# CONFIG_CRYPTO_CRC32C is not set
910# CONFIG_CRYPTO_MD4 is not set
911# CONFIG_CRYPTO_MD5 is not set
912# CONFIG_CRYPTO_MICHAEL_MIC is not set
913# CONFIG_CRYPTO_RMD128 is not set
914# CONFIG_CRYPTO_RMD160 is not set
915# CONFIG_CRYPTO_RMD256 is not set
916# CONFIG_CRYPTO_RMD320 is not set
917# CONFIG_CRYPTO_SHA1 is not set
918# CONFIG_CRYPTO_SHA256 is not set
919# CONFIG_CRYPTO_SHA512 is not set
920# CONFIG_CRYPTO_TGR192 is not set
921# CONFIG_CRYPTO_WP512 is not set
922
923#
924# Ciphers
925#
926# CONFIG_CRYPTO_AES is not set
927# CONFIG_CRYPTO_ANUBIS is not set
928# CONFIG_CRYPTO_ARC4 is not set
929# CONFIG_CRYPTO_BLOWFISH is not set
930# CONFIG_CRYPTO_CAMELLIA is not set
931# CONFIG_CRYPTO_CAST5 is not set
932# CONFIG_CRYPTO_CAST6 is not set
933# CONFIG_CRYPTO_DES is not set
934# CONFIG_CRYPTO_FCRYPT is not set
935# CONFIG_CRYPTO_KHAZAD is not set
936# CONFIG_CRYPTO_SALSA20 is not set
937# CONFIG_CRYPTO_SEED is not set
938# CONFIG_CRYPTO_SERPENT is not set
939# CONFIG_CRYPTO_TEA is not set
940# CONFIG_CRYPTO_TWOFISH is not set
941
942#
943# Compression
944#
945# CONFIG_CRYPTO_DEFLATE is not set
946# CONFIG_CRYPTO_LZO is not set
947CONFIG_CRYPTO_HW=y
948
949#
950# Library routines
951#
952CONFIG_BITREVERSE=y
953# CONFIG_GENERIC_FIND_FIRST_BIT is not set
954# CONFIG_CRC_CCITT is not set
955# CONFIG_CRC16 is not set
956CONFIG_CRC_T10DIF=y
957# CONFIG_CRC_ITU_T is not set
958CONFIG_CRC32=y
959# CONFIG_CRC7 is not set
960# CONFIG_LIBCRC32C is not set
961CONFIG_PLIST=y
962CONFIG_HAS_IOMEM=y
963CONFIG_HAS_IOPORT=y
964CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/dreamcast_defconfig b/arch/sh/configs/dreamcast_defconfig
index 57728788b753..d4075283956d 100644
--- a/arch/sh/configs/dreamcast_defconfig
+++ b/arch/sh/configs/dreamcast_defconfig
@@ -1,9 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc7 3# Linux kernel version: 2.6.26
4# Fri Sep 21 15:46:27 2007 4# Wed Jul 30 01:34:24 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
9CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -19,6 +21,7 @@ CONFIG_LOCKDEP_SUPPORT=y
19# CONFIG_ARCH_HAS_ILOG2_U32 is not set 21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
20# CONFIG_ARCH_HAS_ILOG2_U64 is not set 22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
21CONFIG_ARCH_NO_VIRT_TO_BUS=y 23CONFIG_ARCH_NO_VIRT_TO_BUS=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
23 26
24# 27#
@@ -37,12 +40,15 @@ CONFIG_SYSVIPC_SYSCTL=y
37CONFIG_BSD_PROCESS_ACCT=y 40CONFIG_BSD_PROCESS_ACCT=y
38# CONFIG_BSD_PROCESS_ACCT_V3 is not set 41# CONFIG_BSD_PROCESS_ACCT_V3 is not set
39# CONFIG_TASKSTATS is not set 42# CONFIG_TASKSTATS is not set
40# CONFIG_USER_NS is not set
41# CONFIG_AUDIT is not set 43# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 44# CONFIG_IKCONFIG is not set
43CONFIG_LOG_BUF_SHIFT=14 45CONFIG_LOG_BUF_SHIFT=14
46# CONFIG_CGROUPS is not set
47# CONFIG_GROUP_SCHED is not set
44CONFIG_SYSFS_DEPRECATED=y 48CONFIG_SYSFS_DEPRECATED=y
49CONFIG_SYSFS_DEPRECATED_V2=y
45# CONFIG_RELAY is not set 50# CONFIG_RELAY is not set
51# CONFIG_NAMESPACES is not set
46# CONFIG_BLK_DEV_INITRD is not set 52# CONFIG_BLK_DEV_INITRD is not set
47CONFIG_CC_OPTIMIZE_FOR_SIZE=y 53CONFIG_CC_OPTIMIZE_FOR_SIZE=y
48CONFIG_SYSCTL=y 54CONFIG_SYSCTL=y
@@ -55,21 +61,38 @@ CONFIG_HOTPLUG=y
55CONFIG_PRINTK=y 61CONFIG_PRINTK=y
56CONFIG_BUG=y 62CONFIG_BUG=y
57CONFIG_ELF_CORE=y 63CONFIG_ELF_CORE=y
64CONFIG_COMPAT_BRK=y
58CONFIG_BASE_FULL=y 65CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y 66CONFIG_FUTEX=y
60CONFIG_ANON_INODES=y 67CONFIG_ANON_INODES=y
61CONFIG_EPOLL=y 68CONFIG_EPOLL=y
62CONFIG_SIGNALFD=y 69CONFIG_SIGNALFD=y
70CONFIG_TIMERFD=y
63CONFIG_EVENTFD=y 71CONFIG_EVENTFD=y
64CONFIG_SHMEM=y 72CONFIG_SHMEM=y
65CONFIG_VM_EVENT_COUNTERS=y 73CONFIG_VM_EVENT_COUNTERS=y
66CONFIG_SLAB=y 74CONFIG_SLAB=y
67# CONFIG_SLUB is not set 75# CONFIG_SLUB is not set
68# CONFIG_SLOB is not set 76# CONFIG_SLOB is not set
77CONFIG_PROFILING=y
78# CONFIG_MARKERS is not set
79# CONFIG_OPROFILE is not set
80CONFIG_HAVE_OPROFILE=y
81# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
82# CONFIG_HAVE_IOREMAP_PROT is not set
83# CONFIG_HAVE_KPROBES is not set
84# CONFIG_HAVE_KRETPROBES is not set
85# CONFIG_HAVE_ARCH_TRACEHOOK is not set
86# CONFIG_HAVE_DMA_ATTRS is not set
87# CONFIG_USE_GENERIC_SMP_HELPERS is not set
88CONFIG_HAVE_CLK=y
89CONFIG_PROC_PAGE_MONITOR=y
90CONFIG_SLABINFO=y
69CONFIG_RT_MUTEXES=y 91CONFIG_RT_MUTEXES=y
70# CONFIG_TINY_SHMEM is not set 92# CONFIG_TINY_SHMEM is not set
71CONFIG_BASE_SMALL=0 93CONFIG_BASE_SMALL=0
72CONFIG_MODULES=y 94CONFIG_MODULES=y
95# CONFIG_MODULE_FORCE_LOAD is not set
73CONFIG_MODULE_UNLOAD=y 96CONFIG_MODULE_UNLOAD=y
74# CONFIG_MODULE_FORCE_UNLOAD is not set 97# CONFIG_MODULE_FORCE_UNLOAD is not set
75# CONFIG_MODVERSIONS is not set 98# CONFIG_MODVERSIONS is not set
@@ -80,6 +103,7 @@ CONFIG_BLOCK=y
80# CONFIG_BLK_DEV_IO_TRACE is not set 103# CONFIG_BLK_DEV_IO_TRACE is not set
81# CONFIG_LSF is not set 104# CONFIG_LSF is not set
82# CONFIG_BLK_DEV_BSG is not set 105# CONFIG_BLK_DEV_BSG is not set
106# CONFIG_BLK_DEV_INTEGRITY is not set
83 107
84# 108#
85# IO Schedulers 109# IO Schedulers
@@ -93,13 +117,17 @@ CONFIG_DEFAULT_AS=y
93# CONFIG_DEFAULT_CFQ is not set 117# CONFIG_DEFAULT_CFQ is not set
94# CONFIG_DEFAULT_NOOP is not set 118# CONFIG_DEFAULT_NOOP is not set
95CONFIG_DEFAULT_IOSCHED="anticipatory" 119CONFIG_DEFAULT_IOSCHED="anticipatory"
120CONFIG_CLASSIC_RCU=y
96 121
97# 122#
98# System type 123# System type
99# 124#
100CONFIG_CPU_SH4=y 125CONFIG_CPU_SH4=y
101# CONFIG_CPU_SUBTYPE_SH7619 is not set 126# CONFIG_CPU_SUBTYPE_SH7619 is not set
127# CONFIG_CPU_SUBTYPE_SH7203 is not set
102# CONFIG_CPU_SUBTYPE_SH7206 is not set 128# CONFIG_CPU_SUBTYPE_SH7206 is not set
129# CONFIG_CPU_SUBTYPE_SH7263 is not set
130# CONFIG_CPU_SUBTYPE_MXG is not set
103# CONFIG_CPU_SUBTYPE_SH7705 is not set 131# CONFIG_CPU_SUBTYPE_SH7705 is not set
104# CONFIG_CPU_SUBTYPE_SH7706 is not set 132# CONFIG_CPU_SUBTYPE_SH7706 is not set
105# CONFIG_CPU_SUBTYPE_SH7707 is not set 133# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -108,6 +136,7 @@ CONFIG_CPU_SH4=y
108# CONFIG_CPU_SUBTYPE_SH7710 is not set 136# CONFIG_CPU_SUBTYPE_SH7710 is not set
109# CONFIG_CPU_SUBTYPE_SH7712 is not set 137# CONFIG_CPU_SUBTYPE_SH7712 is not set
110# CONFIG_CPU_SUBTYPE_SH7720 is not set 138# CONFIG_CPU_SUBTYPE_SH7720 is not set
139# CONFIG_CPU_SUBTYPE_SH7721 is not set
111# CONFIG_CPU_SUBTYPE_SH7750 is not set 140# CONFIG_CPU_SUBTYPE_SH7750 is not set
112CONFIG_CPU_SUBTYPE_SH7091=y 141CONFIG_CPU_SUBTYPE_SH7091=y
113# CONFIG_CPU_SUBTYPE_SH7750R is not set 142# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -116,14 +145,17 @@ CONFIG_CPU_SUBTYPE_SH7091=y
116# CONFIG_CPU_SUBTYPE_SH7751R is not set 145# CONFIG_CPU_SUBTYPE_SH7751R is not set
117# CONFIG_CPU_SUBTYPE_SH7760 is not set 146# CONFIG_CPU_SUBTYPE_SH7760 is not set
118# CONFIG_CPU_SUBTYPE_SH4_202 is not set 147# CONFIG_CPU_SUBTYPE_SH4_202 is not set
119# CONFIG_CPU_SUBTYPE_ST40STB1 is not set 148# CONFIG_CPU_SUBTYPE_SH7723 is not set
120# CONFIG_CPU_SUBTYPE_ST40GX1 is not set 149# CONFIG_CPU_SUBTYPE_SH7763 is not set
121# CONFIG_CPU_SUBTYPE_SH7770 is not set 150# CONFIG_CPU_SUBTYPE_SH7770 is not set
122# CONFIG_CPU_SUBTYPE_SH7780 is not set 151# CONFIG_CPU_SUBTYPE_SH7780 is not set
123# CONFIG_CPU_SUBTYPE_SH7785 is not set 152# CONFIG_CPU_SUBTYPE_SH7785 is not set
124# CONFIG_CPU_SUBTYPE_SHX3 is not set 153# CONFIG_CPU_SUBTYPE_SHX3 is not set
125# CONFIG_CPU_SUBTYPE_SH7343 is not set 154# CONFIG_CPU_SUBTYPE_SH7343 is not set
126# CONFIG_CPU_SUBTYPE_SH7722 is not set 155# CONFIG_CPU_SUBTYPE_SH7722 is not set
156# CONFIG_CPU_SUBTYPE_SH7366 is not set
157# CONFIG_CPU_SUBTYPE_SH5_101 is not set
158# CONFIG_CPU_SUBTYPE_SH5_103 is not set
127 159
128# 160#
129# Memory management options 161# Memory management options
@@ -133,6 +165,7 @@ CONFIG_MMU=y
133CONFIG_PAGE_OFFSET=0x80000000 165CONFIG_PAGE_OFFSET=0x80000000
134CONFIG_MEMORY_START=0x0c000000 166CONFIG_MEMORY_START=0x0c000000
135CONFIG_MEMORY_SIZE=0x01000000 167CONFIG_MEMORY_SIZE=0x01000000
168CONFIG_29BIT=y
136CONFIG_VSYSCALL=y 169CONFIG_VSYSCALL=y
137CONFIG_ARCH_FLATMEM_ENABLE=y 170CONFIG_ARCH_FLATMEM_ENABLE=y
138CONFIG_ARCH_SPARSEMEM_ENABLE=y 171CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -142,12 +175,15 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
142CONFIG_ARCH_SELECT_MEMORY_MODEL=y 175CONFIG_ARCH_SELECT_MEMORY_MODEL=y
143CONFIG_PAGE_SIZE_4KB=y 176CONFIG_PAGE_SIZE_4KB=y
144# CONFIG_PAGE_SIZE_8KB is not set 177# CONFIG_PAGE_SIZE_8KB is not set
178# CONFIG_PAGE_SIZE_16KB is not set
145# CONFIG_PAGE_SIZE_64KB is not set 179# CONFIG_PAGE_SIZE_64KB is not set
180CONFIG_ENTRY_OFFSET=0x00001000
146CONFIG_HUGETLB_PAGE_SIZE_64K=y 181CONFIG_HUGETLB_PAGE_SIZE_64K=y
147# CONFIG_HUGETLB_PAGE_SIZE_256K is not set 182# CONFIG_HUGETLB_PAGE_SIZE_256K is not set
148# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set 183# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
149# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set 184# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set
150# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set 185# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set
186# CONFIG_HUGETLB_PAGE_SIZE_512MB is not set
151CONFIG_SELECT_MEMORY_MODEL=y 187CONFIG_SELECT_MEMORY_MODEL=y
152CONFIG_FLATMEM_MANUAL=y 188CONFIG_FLATMEM_MANUAL=y
153# CONFIG_DISCONTIGMEM_MANUAL is not set 189# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -155,6 +191,8 @@ CONFIG_FLATMEM_MANUAL=y
155CONFIG_FLATMEM=y 191CONFIG_FLATMEM=y
156CONFIG_FLAT_NODE_MEM_MAP=y 192CONFIG_FLAT_NODE_MEM_MAP=y
157CONFIG_SPARSEMEM_STATIC=y 193CONFIG_SPARSEMEM_STATIC=y
194# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
195CONFIG_PAGEFLAGS_EXTENDED=y
158CONFIG_SPLIT_PTLOCK_CPUS=4 196CONFIG_SPLIT_PTLOCK_CPUS=4
159# CONFIG_RESOURCES_64BIT is not set 197# CONFIG_RESOURCES_64BIT is not set
160CONFIG_ZONE_DMA_FLAG=0 198CONFIG_ZONE_DMA_FLAG=0
@@ -194,6 +232,7 @@ CONFIG_SH_PCLK_FREQ=49876504
194# CONFIG_TICK_ONESHOT is not set 232# CONFIG_TICK_ONESHOT is not set
195# CONFIG_NO_HZ is not set 233# CONFIG_NO_HZ is not set
196# CONFIG_HIGH_RES_TIMERS is not set 234# CONFIG_HIGH_RES_TIMERS is not set
235CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
197 236
198# 237#
199# CPU Frequency scaling 238# CPU Frequency scaling
@@ -204,7 +243,10 @@ CONFIG_CPU_FREQ_TABLE=y
204CONFIG_CPU_FREQ_STAT=y 243CONFIG_CPU_FREQ_STAT=y
205# CONFIG_CPU_FREQ_STAT_DETAILS is not set 244# CONFIG_CPU_FREQ_STAT_DETAILS is not set
206CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 245CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
246# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
207# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 247# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
248# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
249# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
208CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 250CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
209CONFIG_CPU_FREQ_GOV_POWERSAVE=y 251CONFIG_CPU_FREQ_GOV_POWERSAVE=y
210CONFIG_CPU_FREQ_GOV_USERSPACE=y 252CONFIG_CPU_FREQ_GOV_USERSPACE=y
@@ -239,12 +281,15 @@ CONFIG_HZ_250=y
239# CONFIG_HZ_300 is not set 281# CONFIG_HZ_300 is not set
240# CONFIG_HZ_1000 is not set 282# CONFIG_HZ_1000 is not set
241CONFIG_HZ=250 283CONFIG_HZ=250
284# CONFIG_SCHED_HRTICK is not set
242# CONFIG_KEXEC is not set 285# CONFIG_KEXEC is not set
243# CONFIG_CRASH_DUMP is not set 286# CONFIG_CRASH_DUMP is not set
244# CONFIG_PREEMPT_NONE is not set 287# CONFIG_PREEMPT_NONE is not set
245# CONFIG_PREEMPT_VOLUNTARY is not set 288# CONFIG_PREEMPT_VOLUNTARY is not set
246CONFIG_PREEMPT=y 289CONFIG_PREEMPT=y
247CONFIG_PREEMPT_BKL=y 290# CONFIG_PREEMPT_RCU is not set
291CONFIG_GUSA=y
292# CONFIG_GUSA_RB is not set
248 293
249# 294#
250# Boot options 295# Boot options
@@ -263,10 +308,7 @@ CONFIG_PCI=y
263CONFIG_SH_PCIDMA_NONCOHERENT=y 308CONFIG_SH_PCIDMA_NONCOHERENT=y
264CONFIG_PCI_AUTO=y 309CONFIG_PCI_AUTO=y
265# CONFIG_ARCH_SUPPORTS_MSI is not set 310# CONFIG_ARCH_SUPPORTS_MSI is not set
266 311CONFIG_PCI_LEGACY=y
267#
268# PCCARD (PCMCIA/CardBus) support
269#
270# CONFIG_PCCARD is not set 312# CONFIG_PCCARD is not set
271# CONFIG_HOTPLUG_PCI is not set 313# CONFIG_HOTPLUG_PCI is not set
272 314
@@ -291,6 +333,7 @@ CONFIG_XFRM=y
291# CONFIG_XFRM_USER is not set 333# CONFIG_XFRM_USER is not set
292# CONFIG_XFRM_SUB_POLICY is not set 334# CONFIG_XFRM_SUB_POLICY is not set
293# CONFIG_XFRM_MIGRATE is not set 335# CONFIG_XFRM_MIGRATE is not set
336# CONFIG_XFRM_STATISTICS is not set
294# CONFIG_NET_KEY is not set 337# CONFIG_NET_KEY is not set
295CONFIG_INET=y 338CONFIG_INET=y
296# CONFIG_IP_MULTICAST is not set 339# CONFIG_IP_MULTICAST is not set
@@ -309,6 +352,7 @@ CONFIG_IP_FIB_HASH=y
309CONFIG_INET_XFRM_MODE_TRANSPORT=y 352CONFIG_INET_XFRM_MODE_TRANSPORT=y
310CONFIG_INET_XFRM_MODE_TUNNEL=y 353CONFIG_INET_XFRM_MODE_TUNNEL=y
311CONFIG_INET_XFRM_MODE_BEET=y 354CONFIG_INET_XFRM_MODE_BEET=y
355# CONFIG_INET_LRO is not set
312CONFIG_INET_DIAG=y 356CONFIG_INET_DIAG=y
313CONFIG_INET_TCP_DIAG=y 357CONFIG_INET_TCP_DIAG=y
314# CONFIG_TCP_CONG_ADVANCED is not set 358# CONFIG_TCP_CONG_ADVANCED is not set
@@ -316,8 +360,6 @@ CONFIG_TCP_CONG_CUBIC=y
316CONFIG_DEFAULT_TCP_CONG="cubic" 360CONFIG_DEFAULT_TCP_CONG="cubic"
317# CONFIG_TCP_MD5SIG is not set 361# CONFIG_TCP_MD5SIG is not set
318# CONFIG_IPV6 is not set 362# CONFIG_IPV6 is not set
319# CONFIG_INET6_XFRM_TUNNEL is not set
320# CONFIG_INET6_TUNNEL is not set
321# CONFIG_NETWORK_SECMARK is not set 363# CONFIG_NETWORK_SECMARK is not set
322# CONFIG_NETFILTER is not set 364# CONFIG_NETFILTER is not set
323# CONFIG_IP_DCCP is not set 365# CONFIG_IP_DCCP is not set
@@ -334,10 +376,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
334# CONFIG_LAPB is not set 376# CONFIG_LAPB is not set
335# CONFIG_ECONET is not set 377# CONFIG_ECONET is not set
336# CONFIG_WAN_ROUTER is not set 378# CONFIG_WAN_ROUTER is not set
337
338#
339# QoS and/or fair queueing
340#
341# CONFIG_NET_SCHED is not set 379# CONFIG_NET_SCHED is not set
342 380
343# 381#
@@ -345,6 +383,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
345# 383#
346# CONFIG_NET_PKTGEN is not set 384# CONFIG_NET_PKTGEN is not set
347# CONFIG_HAMRADIO is not set 385# CONFIG_HAMRADIO is not set
386# CONFIG_CAN is not set
348# CONFIG_IRDA is not set 387# CONFIG_IRDA is not set
349# CONFIG_BT is not set 388# CONFIG_BT is not set
350# CONFIG_AF_RXRPC is not set 389# CONFIG_AF_RXRPC is not set
@@ -366,6 +405,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
366# 405#
367# Generic Driver Options 406# Generic Driver Options
368# 407#
408CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
369# CONFIG_STANDALONE is not set 409# CONFIG_STANDALONE is not set
370CONFIG_PREVENT_FIRMWARE_BUILD=y 410CONFIG_PREVENT_FIRMWARE_BUILD=y
371# CONFIG_FW_LOADER is not set 411# CONFIG_FW_LOADER is not set
@@ -374,6 +414,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
374# CONFIG_MTD is not set 414# CONFIG_MTD is not set
375# CONFIG_PARPORT is not set 415# CONFIG_PARPORT is not set
376CONFIG_BLK_DEV=y 416CONFIG_BLK_DEV=y
417CONFIG_GDROM=y
377# CONFIG_BLK_CPQ_CISS_DA is not set 418# CONFIG_BLK_CPQ_CISS_DA is not set
378# CONFIG_BLK_DEV_DAC960 is not set 419# CONFIG_BLK_DEV_DAC960 is not set
379# CONFIG_BLK_DEV_UMEM is not set 420# CONFIG_BLK_DEV_UMEM is not set
@@ -384,11 +425,15 @@ CONFIG_BLK_DEV=y
384# CONFIG_BLK_DEV_RAM is not set 425# CONFIG_BLK_DEV_RAM is not set
385# CONFIG_CDROM_PKTCDVD is not set 426# CONFIG_CDROM_PKTCDVD is not set
386# CONFIG_ATA_OVER_ETH is not set 427# CONFIG_ATA_OVER_ETH is not set
428# CONFIG_BLK_DEV_HD is not set
387CONFIG_MISC_DEVICES=y 429CONFIG_MISC_DEVICES=y
388# CONFIG_PHANTOM is not set 430# CONFIG_PHANTOM is not set
389# CONFIG_EEPROM_93CX6 is not set 431# CONFIG_EEPROM_93CX6 is not set
390# CONFIG_SGI_IOC4 is not set 432# CONFIG_SGI_IOC4 is not set
391# CONFIG_TIFM_CORE is not set 433# CONFIG_TIFM_CORE is not set
434# CONFIG_ENCLOSURE_SERVICES is not set
435# CONFIG_HP_ILO is not set
436CONFIG_HAVE_IDE=y
392# CONFIG_IDE is not set 437# CONFIG_IDE is not set
393 438
394# 439#
@@ -400,44 +445,49 @@ CONFIG_MISC_DEVICES=y
400# CONFIG_SCSI_NETLINK is not set 445# CONFIG_SCSI_NETLINK is not set
401# CONFIG_ATA is not set 446# CONFIG_ATA is not set
402# CONFIG_MD is not set 447# CONFIG_MD is not set
448# CONFIG_FUSION is not set
403 449
404# 450#
405# Fusion MPT device support 451# IEEE 1394 (FireWire) support
406# 452#
407# CONFIG_FUSION is not set
408 453
409# 454#
410# IEEE 1394 (FireWire) support 455# Enable only one of the two stacks, unless you know what you are doing
411# 456#
412# CONFIG_FIREWIRE is not set 457# CONFIG_FIREWIRE is not set
413# CONFIG_IEEE1394 is not set 458# CONFIG_IEEE1394 is not set
414# CONFIG_I2O is not set 459# CONFIG_I2O is not set
415CONFIG_NETDEVICES=y 460CONFIG_NETDEVICES=y
416# CONFIG_NETDEVICES_MULTIQUEUE is not set
417# CONFIG_DUMMY is not set 461# CONFIG_DUMMY is not set
418# CONFIG_BONDING is not set 462# CONFIG_BONDING is not set
419# CONFIG_MACVLAN is not set 463# CONFIG_MACVLAN is not set
420# CONFIG_EQUALIZER is not set 464# CONFIG_EQUALIZER is not set
421# CONFIG_TUN is not set 465# CONFIG_TUN is not set
466# CONFIG_VETH is not set
422# CONFIG_ARCNET is not set 467# CONFIG_ARCNET is not set
423# CONFIG_PHYLIB is not set 468# CONFIG_PHYLIB is not set
424CONFIG_NET_ETHERNET=y 469CONFIG_NET_ETHERNET=y
425CONFIG_MII=y 470CONFIG_MII=y
471# CONFIG_AX88796 is not set
426# CONFIG_STNIC is not set 472# CONFIG_STNIC is not set
427# CONFIG_HAPPYMEAL is not set 473# CONFIG_HAPPYMEAL is not set
428# CONFIG_SUNGEM is not set 474# CONFIG_SUNGEM is not set
429# CONFIG_CASSINI is not set 475# CONFIG_CASSINI is not set
430# CONFIG_NET_VENDOR_3COM is not set 476# CONFIG_NET_VENDOR_3COM is not set
431# CONFIG_SMC91X is not set 477# CONFIG_SMC91X is not set
478# CONFIG_SMC911X is not set
432# CONFIG_NET_TULIP is not set 479# CONFIG_NET_TULIP is not set
433# CONFIG_HP100 is not set 480# CONFIG_HP100 is not set
481# CONFIG_IBM_NEW_EMAC_ZMII is not set
482# CONFIG_IBM_NEW_EMAC_RGMII is not set
483# CONFIG_IBM_NEW_EMAC_TAH is not set
484# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
434CONFIG_NET_PCI=y 485CONFIG_NET_PCI=y
435# CONFIG_PCNET32 is not set 486# CONFIG_PCNET32 is not set
436# CONFIG_AMD8111_ETH is not set 487# CONFIG_AMD8111_ETH is not set
437# CONFIG_ADAPTEC_STARFIRE is not set 488# CONFIG_ADAPTEC_STARFIRE is not set
438# CONFIG_B44 is not set 489# CONFIG_B44 is not set
439# CONFIG_FORCEDETH is not set 490# CONFIG_FORCEDETH is not set
440# CONFIG_DGRS is not set
441# CONFIG_EEPRO100 is not set 491# CONFIG_EEPRO100 is not set
442# CONFIG_E100 is not set 492# CONFIG_E100 is not set
443# CONFIG_FEALNX is not set 493# CONFIG_FEALNX is not set
@@ -449,6 +499,7 @@ CONFIG_8139TOO=y
449# CONFIG_8139TOO_TUNE_TWISTER is not set 499# CONFIG_8139TOO_TUNE_TWISTER is not set
450# CONFIG_8139TOO_8129 is not set 500# CONFIG_8139TOO_8129 is not set
451# CONFIG_8139_OLD_RX_RESET is not set 501# CONFIG_8139_OLD_RX_RESET is not set
502# CONFIG_R6040 is not set
452# CONFIG_SIS900 is not set 503# CONFIG_SIS900 is not set
453# CONFIG_EPIC100 is not set 504# CONFIG_EPIC100 is not set
454# CONFIG_SUNDANCE is not set 505# CONFIG_SUNDANCE is not set
@@ -464,12 +515,12 @@ CONFIG_8139TOO=y
464# 515#
465# CONFIG_WLAN_PRE80211 is not set 516# CONFIG_WLAN_PRE80211 is not set
466# CONFIG_WLAN_80211 is not set 517# CONFIG_WLAN_80211 is not set
518# CONFIG_IWLWIFI_LEDS is not set
467# CONFIG_WAN is not set 519# CONFIG_WAN is not set
468# CONFIG_FDDI is not set 520# CONFIG_FDDI is not set
469# CONFIG_HIPPI is not set 521# CONFIG_HIPPI is not set
470# CONFIG_PPP is not set 522# CONFIG_PPP is not set
471# CONFIG_SLIP is not set 523# CONFIG_SLIP is not set
472# CONFIG_SHAPER is not set
473# CONFIG_NETCONSOLE is not set 524# CONFIG_NETCONSOLE is not set
474# CONFIG_NETPOLL is not set 525# CONFIG_NETPOLL is not set
475# CONFIG_NET_POLL_CONTROLLER is not set 526# CONFIG_NET_POLL_CONTROLLER is not set
@@ -491,7 +542,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
491CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 542CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
492CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 543CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
493# CONFIG_INPUT_JOYDEV is not set 544# CONFIG_INPUT_JOYDEV is not set
494# CONFIG_INPUT_TSDEV is not set
495# CONFIG_INPUT_EVDEV is not set 545# CONFIG_INPUT_EVDEV is not set
496# CONFIG_INPUT_EVBUG is not set 546# CONFIG_INPUT_EVBUG is not set
497 547
@@ -505,6 +555,8 @@ CONFIG_INPUT_KEYBOARD=y
505# CONFIG_KEYBOARD_XTKBD is not set 555# CONFIG_KEYBOARD_XTKBD is not set
506# CONFIG_KEYBOARD_NEWTON is not set 556# CONFIG_KEYBOARD_NEWTON is not set
507# CONFIG_KEYBOARD_STOWAWAY is not set 557# CONFIG_KEYBOARD_STOWAWAY is not set
558# CONFIG_KEYBOARD_MAPLE is not set
559# CONFIG_KEYBOARD_SH_KEYSC is not set
508CONFIG_INPUT_MOUSE=y 560CONFIG_INPUT_MOUSE=y
509# CONFIG_MOUSE_PS2 is not set 561# CONFIG_MOUSE_PS2 is not set
510# CONFIG_MOUSE_SERIAL is not set 562# CONFIG_MOUSE_SERIAL is not set
@@ -530,10 +582,13 @@ CONFIG_SERIO_LIBPS2=y
530# Character devices 582# Character devices
531# 583#
532CONFIG_VT=y 584CONFIG_VT=y
585CONFIG_CONSOLE_TRANSLATIONS=y
533CONFIG_VT_CONSOLE=y 586CONFIG_VT_CONSOLE=y
534CONFIG_HW_CONSOLE=y 587CONFIG_HW_CONSOLE=y
535# CONFIG_VT_HW_CONSOLE_BINDING is not set 588# CONFIG_VT_HW_CONSOLE_BINDING is not set
589CONFIG_DEVKMEM=y
536# CONFIG_SERIAL_NONSTANDARD is not set 590# CONFIG_SERIAL_NONSTANDARD is not set
591# CONFIG_NOZOMI is not set
537 592
538# 593#
539# Serial drivers 594# Serial drivers
@@ -553,6 +608,19 @@ CONFIG_UNIX98_PTYS=y
553CONFIG_LEGACY_PTYS=y 608CONFIG_LEGACY_PTYS=y
554CONFIG_LEGACY_PTY_COUNT=256 609CONFIG_LEGACY_PTY_COUNT=256
555# CONFIG_IPMI_HANDLER is not set 610# CONFIG_IPMI_HANDLER is not set
611CONFIG_HW_RANDOM=y
612# CONFIG_R3964 is not set
613# CONFIG_APPLICOM is not set
614# CONFIG_RAW_DRIVER is not set
615# CONFIG_TCG_TPM is not set
616CONFIG_DEVPORT=y
617# CONFIG_I2C is not set
618# CONFIG_SPI is not set
619# CONFIG_W1 is not set
620# CONFIG_POWER_SUPPLY is not set
621# CONFIG_HWMON is not set
622# CONFIG_THERMAL is not set
623# CONFIG_THERMAL_HWMON is not set
556CONFIG_WATCHDOG=y 624CONFIG_WATCHDOG=y
557# CONFIG_WATCHDOG_NOWAYOUT is not set 625# CONFIG_WATCHDOG_NOWAYOUT is not set
558 626
@@ -568,45 +636,40 @@ CONFIG_SH_WDT=y
568# 636#
569# CONFIG_PCIPCWATCHDOG is not set 637# CONFIG_PCIPCWATCHDOG is not set
570# CONFIG_WDTPCI is not set 638# CONFIG_WDTPCI is not set
571CONFIG_HW_RANDOM=y
572# CONFIG_R3964 is not set
573# CONFIG_APPLICOM is not set
574# CONFIG_DRM is not set
575# CONFIG_RAW_DRIVER is not set
576# CONFIG_TCG_TPM is not set
577CONFIG_DEVPORT=y
578# CONFIG_I2C is not set
579 639
580# 640#
581# SPI support 641# Sonics Silicon Backplane
582# 642#
583# CONFIG_SPI is not set 643CONFIG_SSB_POSSIBLE=y
584# CONFIG_SPI_MASTER is not set 644# CONFIG_SSB is not set
585# CONFIG_W1 is not set
586# CONFIG_POWER_SUPPLY is not set
587# CONFIG_HWMON is not set
588 645
589# 646#
590# Multifunction device drivers 647# Multifunction device drivers
591# 648#
649# CONFIG_MFD_CORE is not set
592# CONFIG_MFD_SM501 is not set 650# CONFIG_MFD_SM501 is not set
651# CONFIG_HTC_PASIC3 is not set
593 652
594# 653#
595# Multimedia devices 654# Multimedia devices
596# 655#
656
657#
658# Multimedia core support
659#
597# CONFIG_VIDEO_DEV is not set 660# CONFIG_VIDEO_DEV is not set
598# CONFIG_DVB_CORE is not set 661# CONFIG_DVB_CORE is not set
599# CONFIG_DAB is not set 662# CONFIG_VIDEO_MEDIA is not set
600 663
601# 664#
602# Graphics support 665# Multimedia drivers
603# 666#
604# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 667# CONFIG_DAB is not set
605 668
606# 669#
607# Display device support 670# Graphics support
608# 671#
609# CONFIG_DISPLAY_SUPPORT is not set 672# CONFIG_DRM is not set
610# CONFIG_VGASTATE is not set 673# CONFIG_VGASTATE is not set
611CONFIG_VIDEO_OUTPUT_CONTROL=m 674CONFIG_VIDEO_OUTPUT_CONTROL=m
612CONFIG_FB=y 675CONFIG_FB=y
@@ -615,11 +678,12 @@ CONFIG_FIRMWARE_EDID=y
615CONFIG_FB_CFB_FILLRECT=y 678CONFIG_FB_CFB_FILLRECT=y
616CONFIG_FB_CFB_COPYAREA=y 679CONFIG_FB_CFB_COPYAREA=y
617CONFIG_FB_CFB_IMAGEBLIT=y 680CONFIG_FB_CFB_IMAGEBLIT=y
681# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
618# CONFIG_FB_SYS_FILLRECT is not set 682# CONFIG_FB_SYS_FILLRECT is not set
619# CONFIG_FB_SYS_COPYAREA is not set 683# CONFIG_FB_SYS_COPYAREA is not set
620# CONFIG_FB_SYS_IMAGEBLIT is not set 684# CONFIG_FB_SYS_IMAGEBLIT is not set
685# CONFIG_FB_FOREIGN_ENDIAN is not set
621# CONFIG_FB_SYS_FOPS is not set 686# CONFIG_FB_SYS_FOPS is not set
622CONFIG_FB_DEFERRED_IO=y
623# CONFIG_FB_SVGALIB is not set 687# CONFIG_FB_SVGALIB is not set
624# CONFIG_FB_MACMODES is not set 688# CONFIG_FB_MACMODES is not set
625# CONFIG_FB_BACKLIGHT is not set 689# CONFIG_FB_BACKLIGHT is not set
@@ -653,7 +717,15 @@ CONFIG_FB_PVR2=y
653# CONFIG_FB_TRIDENT is not set 717# CONFIG_FB_TRIDENT is not set
654# CONFIG_FB_ARK is not set 718# CONFIG_FB_ARK is not set
655# CONFIG_FB_PM3 is not set 719# CONFIG_FB_PM3 is not set
720# CONFIG_FB_CARMINE is not set
721# CONFIG_FB_SH_MOBILE_LCDC is not set
656# CONFIG_FB_VIRTUAL is not set 722# CONFIG_FB_VIRTUAL is not set
723# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
724
725#
726# Display device support
727#
728# CONFIG_DISPLAY_SUPPORT is not set
657 729
658# 730#
659# Console display driver support 731# Console display driver support
@@ -680,49 +752,30 @@ CONFIG_LOGO=y
680# CONFIG_LOGO_SUPERH_MONO is not set 752# CONFIG_LOGO_SUPERH_MONO is not set
681# CONFIG_LOGO_SUPERH_VGA16 is not set 753# CONFIG_LOGO_SUPERH_VGA16 is not set
682CONFIG_LOGO_SUPERH_CLUT224=y 754CONFIG_LOGO_SUPERH_CLUT224=y
683
684#
685# Sound
686#
687# CONFIG_SOUND is not set 755# CONFIG_SOUND is not set
688CONFIG_HID_SUPPORT=y 756CONFIG_HID_SUPPORT=y
689CONFIG_HID=y 757CONFIG_HID=y
690# CONFIG_HID_DEBUG is not set 758# CONFIG_HID_DEBUG is not set
759# CONFIG_HIDRAW is not set
691CONFIG_USB_SUPPORT=y 760CONFIG_USB_SUPPORT=y
692CONFIG_USB_ARCH_HAS_HCD=y 761CONFIG_USB_ARCH_HAS_HCD=y
693CONFIG_USB_ARCH_HAS_OHCI=y 762CONFIG_USB_ARCH_HAS_OHCI=y
694CONFIG_USB_ARCH_HAS_EHCI=y 763CONFIG_USB_ARCH_HAS_EHCI=y
695# CONFIG_USB is not set 764# CONFIG_USB is not set
765# CONFIG_USB_OTG_WHITELIST is not set
766# CONFIG_USB_OTG_BLACKLIST_HUB is not set
696 767
697# 768#
698# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 769# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
699# 770#
700
701#
702# USB Gadget Support
703#
704# CONFIG_USB_GADGET is not set 771# CONFIG_USB_GADGET is not set
705# CONFIG_MMC is not set 772# CONFIG_MMC is not set
773# CONFIG_MEMSTICK is not set
706# CONFIG_NEW_LEDS is not set 774# CONFIG_NEW_LEDS is not set
775# CONFIG_ACCESSIBILITY is not set
707# CONFIG_INFINIBAND is not set 776# CONFIG_INFINIBAND is not set
708# CONFIG_RTC_CLASS is not set 777# CONFIG_RTC_CLASS is not set
709 778# CONFIG_DMADEVICES is not set
710#
711# DMA Engine support
712#
713# CONFIG_DMA_ENGINE is not set
714
715#
716# DMA Clients
717#
718
719#
720# DMA Devices
721#
722
723#
724# Userspace I/O
725#
726# CONFIG_UIO is not set 779# CONFIG_UIO is not set
727 780
728# 781#
@@ -735,14 +788,11 @@ CONFIG_USB_ARCH_HAS_EHCI=y
735# CONFIG_JFS_FS is not set 788# CONFIG_JFS_FS is not set
736# CONFIG_FS_POSIX_ACL is not set 789# CONFIG_FS_POSIX_ACL is not set
737# CONFIG_XFS_FS is not set 790# CONFIG_XFS_FS is not set
738# CONFIG_GFS2_FS is not set
739# CONFIG_OCFS2_FS is not set 791# CONFIG_OCFS2_FS is not set
740# CONFIG_MINIX_FS is not set 792# CONFIG_DNOTIFY is not set
741# CONFIG_ROMFS_FS is not set
742CONFIG_INOTIFY=y 793CONFIG_INOTIFY=y
743CONFIG_INOTIFY_USER=y 794CONFIG_INOTIFY_USER=y
744# CONFIG_QUOTA is not set 795# CONFIG_QUOTA is not set
745# CONFIG_DNOTIFY is not set
746# CONFIG_AUTOFS_FS is not set 796# CONFIG_AUTOFS_FS is not set
747# CONFIG_AUTOFS4_FS is not set 797# CONFIG_AUTOFS4_FS is not set
748# CONFIG_FUSE_FS is not set 798# CONFIG_FUSE_FS is not set
@@ -771,7 +821,6 @@ CONFIG_TMPFS=y
771# CONFIG_TMPFS_POSIX_ACL is not set 821# CONFIG_TMPFS_POSIX_ACL is not set
772CONFIG_HUGETLBFS=y 822CONFIG_HUGETLBFS=y
773CONFIG_HUGETLB_PAGE=y 823CONFIG_HUGETLB_PAGE=y
774CONFIG_RAMFS=y
775# CONFIG_CONFIGFS_FS is not set 824# CONFIG_CONFIGFS_FS is not set
776 825
777# 826#
@@ -786,14 +835,14 @@ CONFIG_RAMFS=y
786# CONFIG_EFS_FS is not set 835# CONFIG_EFS_FS is not set
787# CONFIG_CRAMFS is not set 836# CONFIG_CRAMFS is not set
788# CONFIG_VXFS_FS is not set 837# CONFIG_VXFS_FS is not set
838# CONFIG_MINIX_FS is not set
839# CONFIG_OMFS_FS is not set
789# CONFIG_HPFS_FS is not set 840# CONFIG_HPFS_FS is not set
790# CONFIG_QNX4FS_FS is not set 841# CONFIG_QNX4FS_FS is not set
842# CONFIG_ROMFS_FS is not set
791# CONFIG_SYSV_FS is not set 843# CONFIG_SYSV_FS is not set
792# CONFIG_UFS_FS is not set 844# CONFIG_UFS_FS is not set
793 845CONFIG_NETWORK_FILESYSTEMS=y
794#
795# Network File Systems
796#
797# CONFIG_NFS_FS is not set 846# CONFIG_NFS_FS is not set
798# CONFIG_NFSD is not set 847# CONFIG_NFSD is not set
799# CONFIG_SMB_FS is not set 848# CONFIG_SMB_FS is not set
@@ -807,35 +856,25 @@ CONFIG_RAMFS=y
807# 856#
808# CONFIG_PARTITION_ADVANCED is not set 857# CONFIG_PARTITION_ADVANCED is not set
809CONFIG_MSDOS_PARTITION=y 858CONFIG_MSDOS_PARTITION=y
810
811#
812# Native Language Support
813#
814# CONFIG_NLS is not set 859# CONFIG_NLS is not set
815
816#
817# Distributed Lock Manager
818#
819# CONFIG_DLM is not set 860# CONFIG_DLM is not set
820 861
821# 862#
822# Profiling support
823#
824CONFIG_PROFILING=y
825# CONFIG_OPROFILE is not set
826
827#
828# Kernel hacking 863# Kernel hacking
829# 864#
830CONFIG_TRACE_IRQFLAGS_SUPPORT=y 865CONFIG_TRACE_IRQFLAGS_SUPPORT=y
831# CONFIG_PRINTK_TIME is not set 866# CONFIG_PRINTK_TIME is not set
867CONFIG_ENABLE_WARN_DEPRECATED=y
832CONFIG_ENABLE_MUST_CHECK=y 868CONFIG_ENABLE_MUST_CHECK=y
869CONFIG_FRAME_WARN=1024
833# CONFIG_MAGIC_SYSRQ is not set 870# CONFIG_MAGIC_SYSRQ is not set
834# CONFIG_UNUSED_SYMBOLS is not set 871# CONFIG_UNUSED_SYMBOLS is not set
835# CONFIG_DEBUG_FS is not set 872# CONFIG_DEBUG_FS is not set
836# CONFIG_HEADERS_CHECK is not set 873# CONFIG_HEADERS_CHECK is not set
837# CONFIG_DEBUG_KERNEL is not set 874# CONFIG_DEBUG_KERNEL is not set
838# CONFIG_DEBUG_BUGVERBOSE is not set 875# CONFIG_DEBUG_BUGVERBOSE is not set
876# CONFIG_DEBUG_MEMORY_INIT is not set
877# CONFIG_SAMPLES is not set
839# CONFIG_SH_STANDARD_BIOS is not set 878# CONFIG_SH_STANDARD_BIOS is not set
840# CONFIG_EARLY_SCIF_CONSOLE is not set 879# CONFIG_EARLY_SCIF_CONSOLE is not set
841# CONFIG_SH_KGDB is not set 880# CONFIG_SH_KGDB is not set
@@ -845,14 +884,95 @@ CONFIG_ENABLE_MUST_CHECK=y
845# 884#
846# CONFIG_KEYS is not set 885# CONFIG_KEYS is not set
847# CONFIG_SECURITY is not set 886# CONFIG_SECURITY is not set
848# CONFIG_CRYPTO is not set 887# CONFIG_SECURITY_FILE_CAPABILITIES is not set
888CONFIG_CRYPTO=y
889
890#
891# Crypto core or helper
892#
893# CONFIG_CRYPTO_MANAGER is not set
894# CONFIG_CRYPTO_GF128MUL is not set
895# CONFIG_CRYPTO_NULL is not set
896# CONFIG_CRYPTO_CRYPTD is not set
897# CONFIG_CRYPTO_AUTHENC is not set
898# CONFIG_CRYPTO_TEST is not set
899
900#
901# Authenticated Encryption with Associated Data
902#
903# CONFIG_CRYPTO_CCM is not set
904# CONFIG_CRYPTO_GCM is not set
905# CONFIG_CRYPTO_SEQIV is not set
906
907#
908# Block modes
909#
910# CONFIG_CRYPTO_CBC is not set
911# CONFIG_CRYPTO_CTR is not set
912# CONFIG_CRYPTO_CTS is not set
913# CONFIG_CRYPTO_ECB is not set
914# CONFIG_CRYPTO_LRW is not set
915# CONFIG_CRYPTO_PCBC is not set
916# CONFIG_CRYPTO_XTS is not set
917
918#
919# Hash modes
920#
921# CONFIG_CRYPTO_HMAC is not set
922# CONFIG_CRYPTO_XCBC is not set
923
924#
925# Digest
926#
927# CONFIG_CRYPTO_CRC32C is not set
928# CONFIG_CRYPTO_MD4 is not set
929# CONFIG_CRYPTO_MD5 is not set
930# CONFIG_CRYPTO_MICHAEL_MIC is not set
931# CONFIG_CRYPTO_RMD128 is not set
932# CONFIG_CRYPTO_RMD160 is not set
933# CONFIG_CRYPTO_RMD256 is not set
934# CONFIG_CRYPTO_RMD320 is not set
935# CONFIG_CRYPTO_SHA1 is not set
936# CONFIG_CRYPTO_SHA256 is not set
937# CONFIG_CRYPTO_SHA512 is not set
938# CONFIG_CRYPTO_TGR192 is not set
939# CONFIG_CRYPTO_WP512 is not set
940
941#
942# Ciphers
943#
944# CONFIG_CRYPTO_AES is not set
945# CONFIG_CRYPTO_ANUBIS is not set
946# CONFIG_CRYPTO_ARC4 is not set
947# CONFIG_CRYPTO_BLOWFISH is not set
948# CONFIG_CRYPTO_CAMELLIA is not set
949# CONFIG_CRYPTO_CAST5 is not set
950# CONFIG_CRYPTO_CAST6 is not set
951# CONFIG_CRYPTO_DES is not set
952# CONFIG_CRYPTO_FCRYPT is not set
953# CONFIG_CRYPTO_KHAZAD is not set
954# CONFIG_CRYPTO_SALSA20 is not set
955# CONFIG_CRYPTO_SEED is not set
956# CONFIG_CRYPTO_SERPENT is not set
957# CONFIG_CRYPTO_TEA is not set
958# CONFIG_CRYPTO_TWOFISH is not set
959
960#
961# Compression
962#
963# CONFIG_CRYPTO_DEFLATE is not set
964# CONFIG_CRYPTO_LZO is not set
965CONFIG_CRYPTO_HW=y
966# CONFIG_CRYPTO_DEV_HIFN_795X is not set
849 967
850# 968#
851# Library routines 969# Library routines
852# 970#
853CONFIG_BITREVERSE=y 971CONFIG_BITREVERSE=y
972# CONFIG_GENERIC_FIND_FIRST_BIT is not set
854# CONFIG_CRC_CCITT is not set 973# CONFIG_CRC_CCITT is not set
855# CONFIG_CRC16 is not set 974# CONFIG_CRC16 is not set
975# CONFIG_CRC_T10DIF is not set
856# CONFIG_CRC_ITU_T is not set 976# CONFIG_CRC_ITU_T is not set
857CONFIG_CRC32=y 977CONFIG_CRC32=y
858# CONFIG_CRC7 is not set 978# CONFIG_CRC7 is not set
diff --git a/arch/sh/configs/hp6xx_defconfig b/arch/sh/configs/hp6xx_defconfig
index 756d38dc2f71..41e25b3a5b01 100644
--- a/arch/sh/configs/hp6xx_defconfig
+++ b/arch/sh/configs/hp6xx_defconfig
@@ -1,9 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc4 3# Linux kernel version: 2.6.26
4# Tue Sep 11 19:42:44 2007 4# Wed Jul 30 01:24:57 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
9CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -20,6 +22,7 @@ CONFIG_LOCKDEP_SUPPORT=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set 22# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set 23# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y 24CONFIG_ARCH_NO_VIRT_TO_BUS=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24 27
25# 28#
@@ -34,12 +37,15 @@ CONFIG_SWAP=y
34# CONFIG_SYSVIPC is not set 37# CONFIG_SYSVIPC is not set
35CONFIG_BSD_PROCESS_ACCT=y 38CONFIG_BSD_PROCESS_ACCT=y
36# CONFIG_BSD_PROCESS_ACCT_V3 is not set 39# CONFIG_BSD_PROCESS_ACCT_V3 is not set
37# CONFIG_USER_NS is not set
38CONFIG_IKCONFIG=y 40CONFIG_IKCONFIG=y
39CONFIG_IKCONFIG_PROC=y 41CONFIG_IKCONFIG_PROC=y
40CONFIG_LOG_BUF_SHIFT=14 42CONFIG_LOG_BUF_SHIFT=14
43# CONFIG_CGROUPS is not set
44# CONFIG_GROUP_SCHED is not set
41CONFIG_SYSFS_DEPRECATED=y 45CONFIG_SYSFS_DEPRECATED=y
46CONFIG_SYSFS_DEPRECATED_V2=y
42# CONFIG_RELAY is not set 47# CONFIG_RELAY is not set
48# CONFIG_NAMESPACES is not set
43# CONFIG_BLK_DEV_INITRD is not set 49# CONFIG_BLK_DEV_INITRD is not set
44# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 50# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
45CONFIG_SYSCTL=y 51CONFIG_SYSCTL=y
@@ -52,6 +58,7 @@ CONFIG_HOTPLUG=y
52CONFIG_PRINTK=y 58CONFIG_PRINTK=y
53CONFIG_BUG=y 59CONFIG_BUG=y
54CONFIG_ELF_CORE=y 60CONFIG_ELF_CORE=y
61CONFIG_COMPAT_BRK=y
55CONFIG_BASE_FULL=y 62CONFIG_BASE_FULL=y
56CONFIG_FUTEX=y 63CONFIG_FUTEX=y
57CONFIG_ANON_INODES=y 64CONFIG_ANON_INODES=y
@@ -64,6 +71,19 @@ CONFIG_VM_EVENT_COUNTERS=y
64CONFIG_SLAB=y 71CONFIG_SLAB=y
65# CONFIG_SLUB is not set 72# CONFIG_SLUB is not set
66# CONFIG_SLOB is not set 73# CONFIG_SLOB is not set
74# CONFIG_PROFILING is not set
75# CONFIG_MARKERS is not set
76CONFIG_HAVE_OPROFILE=y
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
79# CONFIG_HAVE_KPROBES is not set
80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84CONFIG_HAVE_CLK=y
85CONFIG_PROC_PAGE_MONITOR=y
86CONFIG_SLABINFO=y
67CONFIG_RT_MUTEXES=y 87CONFIG_RT_MUTEXES=y
68# CONFIG_TINY_SHMEM is not set 88# CONFIG_TINY_SHMEM is not set
69CONFIG_BASE_SMALL=0 89CONFIG_BASE_SMALL=0
@@ -73,6 +93,7 @@ CONFIG_BLOCK=y
73# CONFIG_BLK_DEV_IO_TRACE is not set 93# CONFIG_BLK_DEV_IO_TRACE is not set
74# CONFIG_LSF is not set 94# CONFIG_LSF is not set
75# CONFIG_BLK_DEV_BSG is not set 95# CONFIG_BLK_DEV_BSG is not set
96# CONFIG_BLK_DEV_INTEGRITY is not set
76 97
77# 98#
78# IO Schedulers 99# IO Schedulers
@@ -86,13 +107,17 @@ CONFIG_DEFAULT_AS=y
86# CONFIG_DEFAULT_CFQ is not set 107# CONFIG_DEFAULT_CFQ is not set
87# CONFIG_DEFAULT_NOOP is not set 108# CONFIG_DEFAULT_NOOP is not set
88CONFIG_DEFAULT_IOSCHED="anticipatory" 109CONFIG_DEFAULT_IOSCHED="anticipatory"
110CONFIG_CLASSIC_RCU=y
89 111
90# 112#
91# System type 113# System type
92# 114#
93CONFIG_CPU_SH3=y 115CONFIG_CPU_SH3=y
94# CONFIG_CPU_SUBTYPE_SH7619 is not set 116# CONFIG_CPU_SUBTYPE_SH7619 is not set
117# CONFIG_CPU_SUBTYPE_SH7203 is not set
95# CONFIG_CPU_SUBTYPE_SH7206 is not set 118# CONFIG_CPU_SUBTYPE_SH7206 is not set
119# CONFIG_CPU_SUBTYPE_SH7263 is not set
120# CONFIG_CPU_SUBTYPE_MXG is not set
96# CONFIG_CPU_SUBTYPE_SH7705 is not set 121# CONFIG_CPU_SUBTYPE_SH7705 is not set
97# CONFIG_CPU_SUBTYPE_SH7706 is not set 122# CONFIG_CPU_SUBTYPE_SH7706 is not set
98# CONFIG_CPU_SUBTYPE_SH7707 is not set 123# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -101,6 +126,7 @@ CONFIG_CPU_SUBTYPE_SH7709=y
101# CONFIG_CPU_SUBTYPE_SH7710 is not set 126# CONFIG_CPU_SUBTYPE_SH7710 is not set
102# CONFIG_CPU_SUBTYPE_SH7712 is not set 127# CONFIG_CPU_SUBTYPE_SH7712 is not set
103# CONFIG_CPU_SUBTYPE_SH7720 is not set 128# CONFIG_CPU_SUBTYPE_SH7720 is not set
129# CONFIG_CPU_SUBTYPE_SH7721 is not set
104# CONFIG_CPU_SUBTYPE_SH7750 is not set 130# CONFIG_CPU_SUBTYPE_SH7750 is not set
105# CONFIG_CPU_SUBTYPE_SH7091 is not set 131# CONFIG_CPU_SUBTYPE_SH7091 is not set
106# CONFIG_CPU_SUBTYPE_SH7750R is not set 132# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -109,14 +135,17 @@ CONFIG_CPU_SUBTYPE_SH7709=y
109# CONFIG_CPU_SUBTYPE_SH7751R is not set 135# CONFIG_CPU_SUBTYPE_SH7751R is not set
110# CONFIG_CPU_SUBTYPE_SH7760 is not set 136# CONFIG_CPU_SUBTYPE_SH7760 is not set
111# CONFIG_CPU_SUBTYPE_SH4_202 is not set 137# CONFIG_CPU_SUBTYPE_SH4_202 is not set
112# CONFIG_CPU_SUBTYPE_ST40STB1 is not set 138# CONFIG_CPU_SUBTYPE_SH7723 is not set
113# CONFIG_CPU_SUBTYPE_ST40GX1 is not set 139# CONFIG_CPU_SUBTYPE_SH7763 is not set
114# CONFIG_CPU_SUBTYPE_SH7770 is not set 140# CONFIG_CPU_SUBTYPE_SH7770 is not set
115# CONFIG_CPU_SUBTYPE_SH7780 is not set 141# CONFIG_CPU_SUBTYPE_SH7780 is not set
116# CONFIG_CPU_SUBTYPE_SH7785 is not set 142# CONFIG_CPU_SUBTYPE_SH7785 is not set
117# CONFIG_CPU_SUBTYPE_SHX3 is not set 143# CONFIG_CPU_SUBTYPE_SHX3 is not set
118# CONFIG_CPU_SUBTYPE_SH7343 is not set 144# CONFIG_CPU_SUBTYPE_SH7343 is not set
119# CONFIG_CPU_SUBTYPE_SH7722 is not set 145# CONFIG_CPU_SUBTYPE_SH7722 is not set
146# CONFIG_CPU_SUBTYPE_SH7366 is not set
147# CONFIG_CPU_SUBTYPE_SH5_101 is not set
148# CONFIG_CPU_SUBTYPE_SH5_103 is not set
120 149
121# 150#
122# Memory management options 151# Memory management options
@@ -126,6 +155,7 @@ CONFIG_MMU=y
126CONFIG_PAGE_OFFSET=0x80000000 155CONFIG_PAGE_OFFSET=0x80000000
127CONFIG_MEMORY_START=0x0d000000 156CONFIG_MEMORY_START=0x0d000000
128CONFIG_MEMORY_SIZE=0x00400000 157CONFIG_MEMORY_SIZE=0x00400000
158CONFIG_29BIT=y
129CONFIG_VSYSCALL=y 159CONFIG_VSYSCALL=y
130CONFIG_ARCH_FLATMEM_ENABLE=y 160CONFIG_ARCH_FLATMEM_ENABLE=y
131CONFIG_ARCH_SPARSEMEM_ENABLE=y 161CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -135,7 +165,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
135CONFIG_ARCH_SELECT_MEMORY_MODEL=y 165CONFIG_ARCH_SELECT_MEMORY_MODEL=y
136CONFIG_PAGE_SIZE_4KB=y 166CONFIG_PAGE_SIZE_4KB=y
137# CONFIG_PAGE_SIZE_8KB is not set 167# CONFIG_PAGE_SIZE_8KB is not set
168# CONFIG_PAGE_SIZE_16KB is not set
138# CONFIG_PAGE_SIZE_64KB is not set 169# CONFIG_PAGE_SIZE_64KB is not set
170CONFIG_ENTRY_OFFSET=0x00001000
139CONFIG_SELECT_MEMORY_MODEL=y 171CONFIG_SELECT_MEMORY_MODEL=y
140CONFIG_FLATMEM_MANUAL=y 172CONFIG_FLATMEM_MANUAL=y
141# CONFIG_DISCONTIGMEM_MANUAL is not set 173# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -143,6 +175,8 @@ CONFIG_FLATMEM_MANUAL=y
143CONFIG_FLATMEM=y 175CONFIG_FLATMEM=y
144CONFIG_FLAT_NODE_MEM_MAP=y 176CONFIG_FLAT_NODE_MEM_MAP=y
145CONFIG_SPARSEMEM_STATIC=y 177CONFIG_SPARSEMEM_STATIC=y
178# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
179CONFIG_PAGEFLAGS_EXTENDED=y
146CONFIG_SPLIT_PTLOCK_CPUS=4 180CONFIG_SPLIT_PTLOCK_CPUS=4
147# CONFIG_RESOURCES_64BIT is not set 181# CONFIG_RESOURCES_64BIT is not set
148CONFIG_ZONE_DMA_FLAG=0 182CONFIG_ZONE_DMA_FLAG=0
@@ -181,6 +215,7 @@ CONFIG_SH_PCLK_FREQ=22110000
181# CONFIG_TICK_ONESHOT is not set 215# CONFIG_TICK_ONESHOT is not set
182# CONFIG_NO_HZ is not set 216# CONFIG_NO_HZ is not set
183# CONFIG_HIGH_RES_TIMERS is not set 217# CONFIG_HIGH_RES_TIMERS is not set
218CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
184 219
185# 220#
186# CPU Frequency scaling 221# CPU Frequency scaling
@@ -219,11 +254,14 @@ CONFIG_HZ_250=y
219# CONFIG_HZ_300 is not set 254# CONFIG_HZ_300 is not set
220# CONFIG_HZ_1000 is not set 255# CONFIG_HZ_1000 is not set
221CONFIG_HZ=250 256CONFIG_HZ=250
257# CONFIG_SCHED_HRTICK is not set
222# CONFIG_KEXEC is not set 258# CONFIG_KEXEC is not set
223# CONFIG_CRASH_DUMP is not set 259# CONFIG_CRASH_DUMP is not set
224CONFIG_PREEMPT_NONE=y 260CONFIG_PREEMPT_NONE=y
225# CONFIG_PREEMPT_VOLUNTARY is not set 261# CONFIG_PREEMPT_VOLUNTARY is not set
226# CONFIG_PREEMPT is not set 262# CONFIG_PREEMPT is not set
263CONFIG_GUSA=y
264# CONFIG_GUSA_RB is not set
227 265
228# 266#
229# Boot options 267# Boot options
@@ -237,10 +275,6 @@ CONFIG_BOOT_LINK_OFFSET=0x00800000
237# 275#
238CONFIG_ISA=y 276CONFIG_ISA=y
239# CONFIG_ARCH_SUPPORTS_MSI is not set 277# CONFIG_ARCH_SUPPORTS_MSI is not set
240
241#
242# PCCARD (PCMCIA/CardBus) support
243#
244CONFIG_PCCARD=y 278CONFIG_PCCARD=y
245# CONFIG_PCMCIA_DEBUG is not set 279# CONFIG_PCMCIA_DEBUG is not set
246CONFIG_PCMCIA=y 280CONFIG_PCMCIA=y
@@ -263,11 +297,12 @@ CONFIG_BINFMT_ELF=y
263# 297#
264# Power management options (EXPERIMENTAL) 298# Power management options (EXPERIMENTAL)
265# 299#
300CONFIG_ARCH_SUSPEND_POSSIBLE=y
266CONFIG_PM=y 301CONFIG_PM=y
267CONFIG_PM_LEGACY=y
268# CONFIG_PM_DEBUG is not set 302# CONFIG_PM_DEBUG is not set
269CONFIG_PM_SLEEP=y 303CONFIG_PM_SLEEP=y
270CONFIG_SUSPEND=y 304CONFIG_SUSPEND=y
305CONFIG_SUSPEND_FREEZER=y
271CONFIG_APM_EMULATION=y 306CONFIG_APM_EMULATION=y
272 307
273# 308#
@@ -282,9 +317,12 @@ CONFIG_APM_EMULATION=y
282# 317#
283# Generic Driver Options 318# Generic Driver Options
284# 319#
320CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
285# CONFIG_STANDALONE is not set 321# CONFIG_STANDALONE is not set
286CONFIG_PREVENT_FIRMWARE_BUILD=y 322CONFIG_PREVENT_FIRMWARE_BUILD=y
287CONFIG_FW_LOADER=y 323CONFIG_FW_LOADER=y
324CONFIG_FIRMWARE_IN_KERNEL=y
325CONFIG_EXTRA_FIRMWARE=""
288# CONFIG_SYS_HYPERVISOR is not set 326# CONFIG_SYS_HYPERVISOR is not set
289# CONFIG_MTD is not set 327# CONFIG_MTD is not set
290# CONFIG_PARPORT is not set 328# CONFIG_PARPORT is not set
@@ -294,8 +332,11 @@ CONFIG_BLK_DEV=y
294# CONFIG_BLK_DEV_LOOP is not set 332# CONFIG_BLK_DEV_LOOP is not set
295# CONFIG_BLK_DEV_RAM is not set 333# CONFIG_BLK_DEV_RAM is not set
296# CONFIG_CDROM_PKTCDVD is not set 334# CONFIG_CDROM_PKTCDVD is not set
335# CONFIG_BLK_DEV_HD is not set
297CONFIG_MISC_DEVICES=y 336CONFIG_MISC_DEVICES=y
298# CONFIG_EEPROM_93CX6 is not set 337# CONFIG_EEPROM_93CX6 is not set
338# CONFIG_ENCLOSURE_SERVICES is not set
339CONFIG_HAVE_IDE=y
299# CONFIG_IDE is not set 340# CONFIG_IDE is not set
300 341
301# 342#
@@ -332,6 +373,7 @@ CONFIG_BLK_DEV_SD=y
332# CONFIG_SCSI_SPI_ATTRS is not set 373# CONFIG_SCSI_SPI_ATTRS is not set
333# CONFIG_SCSI_FC_ATTRS is not set 374# CONFIG_SCSI_FC_ATTRS is not set
334# CONFIG_SCSI_SAS_LIBSAS is not set 375# CONFIG_SCSI_SAS_LIBSAS is not set
376# CONFIG_SCSI_SRP_ATTRS is not set
335CONFIG_SCSI_LOWLEVEL=y 377CONFIG_SCSI_LOWLEVEL=y
336# CONFIG_SCSI_AHA152X is not set 378# CONFIG_SCSI_AHA152X is not set
337# CONFIG_SCSI_AIC7XXX_OLD is not set 379# CONFIG_SCSI_AIC7XXX_OLD is not set
@@ -342,14 +384,17 @@ CONFIG_SCSI_LOWLEVEL=y
342# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set 384# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
343# CONFIG_SCSI_NCR53C406A is not set 385# CONFIG_SCSI_NCR53C406A is not set
344# CONFIG_SCSI_PAS16 is not set 386# CONFIG_SCSI_PAS16 is not set
345# CONFIG_SCSI_PSI240I is not set
346# CONFIG_SCSI_QLOGIC_FAS is not set 387# CONFIG_SCSI_QLOGIC_FAS is not set
347# CONFIG_SCSI_SYM53C416 is not set 388# CONFIG_SCSI_SYM53C416 is not set
348# CONFIG_SCSI_T128 is not set 389# CONFIG_SCSI_T128 is not set
349# CONFIG_SCSI_DEBUG is not set 390# CONFIG_SCSI_DEBUG is not set
350# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set 391# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
392# CONFIG_SCSI_DH is not set
351CONFIG_ATA=y 393CONFIG_ATA=y
352# CONFIG_ATA_NONSTANDARD is not set 394# CONFIG_ATA_NONSTANDARD is not set
395CONFIG_SATA_PMP=y
396CONFIG_ATA_SFF=y
397# CONFIG_SATA_MV is not set
353# CONFIG_PATA_LEGACY is not set 398# CONFIG_PATA_LEGACY is not set
354# CONFIG_PATA_PCMCIA is not set 399# CONFIG_PATA_PCMCIA is not set
355# CONFIG_PATA_QDI is not set 400# CONFIG_PATA_QDI is not set
@@ -370,11 +415,9 @@ CONFIG_INPUT_POLLDEV=y
370# 415#
371# CONFIG_INPUT_MOUSEDEV is not set 416# CONFIG_INPUT_MOUSEDEV is not set
372# CONFIG_INPUT_JOYDEV is not set 417# CONFIG_INPUT_JOYDEV is not set
373CONFIG_INPUT_TSDEV=y
374CONFIG_INPUT_TSDEV_SCREEN_X=240
375CONFIG_INPUT_TSDEV_SCREEN_Y=320
376CONFIG_INPUT_EVDEV=y 418CONFIG_INPUT_EVDEV=y
377# CONFIG_INPUT_EVBUG is not set 419# CONFIG_INPUT_EVBUG is not set
420# CONFIG_INPUT_APMPOWER is not set
378 421
379# 422#
380# Input Device Drivers 423# Input Device Drivers
@@ -387,6 +430,7 @@ CONFIG_INPUT_KEYBOARD=y
387# CONFIG_KEYBOARD_NEWTON is not set 430# CONFIG_KEYBOARD_NEWTON is not set
388# CONFIG_KEYBOARD_STOWAWAY is not set 431# CONFIG_KEYBOARD_STOWAWAY is not set
389CONFIG_KEYBOARD_HP6XX=y 432CONFIG_KEYBOARD_HP6XX=y
433# CONFIG_KEYBOARD_SH_KEYSC is not set
390# CONFIG_INPUT_MOUSE is not set 434# CONFIG_INPUT_MOUSE is not set
391# CONFIG_INPUT_JOYSTICK is not set 435# CONFIG_INPUT_JOYSTICK is not set
392# CONFIG_INPUT_TABLET is not set 436# CONFIG_INPUT_TABLET is not set
@@ -395,12 +439,15 @@ CONFIG_INPUT_TOUCHSCREEN=y
395# CONFIG_TOUCHSCREEN_GUNZE is not set 439# CONFIG_TOUCHSCREEN_GUNZE is not set
396# CONFIG_TOUCHSCREEN_ELO is not set 440# CONFIG_TOUCHSCREEN_ELO is not set
397# CONFIG_TOUCHSCREEN_MTOUCH is not set 441# CONFIG_TOUCHSCREEN_MTOUCH is not set
442# CONFIG_TOUCHSCREEN_INEXIO is not set
398# CONFIG_TOUCHSCREEN_MK712 is not set 443# CONFIG_TOUCHSCREEN_MK712 is not set
399CONFIG_TOUCHSCREEN_HP600=y 444CONFIG_TOUCHSCREEN_HP600=y
445# CONFIG_TOUCHSCREEN_HTCPEN is not set
400# CONFIG_TOUCHSCREEN_PENMOUNT is not set 446# CONFIG_TOUCHSCREEN_PENMOUNT is not set
401# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set 447# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
402# CONFIG_TOUCHSCREEN_TOUCHWIN is not set 448# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
403# CONFIG_TOUCHSCREEN_UCB1400 is not set 449# CONFIG_TOUCHSCREEN_UCB1400 is not set
450# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
404# CONFIG_INPUT_MISC is not set 451# CONFIG_INPUT_MISC is not set
405 452
406# 453#
@@ -417,9 +464,11 @@ CONFIG_SERIO=y
417# Character devices 464# Character devices
418# 465#
419CONFIG_VT=y 466CONFIG_VT=y
467CONFIG_CONSOLE_TRANSLATIONS=y
420CONFIG_VT_CONSOLE=y 468CONFIG_VT_CONSOLE=y
421CONFIG_HW_CONSOLE=y 469CONFIG_HW_CONSOLE=y
422# CONFIG_VT_HW_CONSOLE_BINDING is not set 470# CONFIG_VT_HW_CONSOLE_BINDING is not set
471CONFIG_DEVKMEM=y
423# CONFIG_SERIAL_NONSTANDARD is not set 472# CONFIG_SERIAL_NONSTANDARD is not set
424 473
425# 474#
@@ -439,7 +488,6 @@ CONFIG_UNIX98_PTYS=y
439CONFIG_LEGACY_PTYS=y 488CONFIG_LEGACY_PTYS=y
440CONFIG_LEGACY_PTY_COUNT=64 489CONFIG_LEGACY_PTY_COUNT=64
441# CONFIG_IPMI_HANDLER is not set 490# CONFIG_IPMI_HANDLER is not set
442# CONFIG_WATCHDOG is not set
443CONFIG_HW_RANDOM=y 491CONFIG_HW_RANDOM=y
444# CONFIG_DTLK is not set 492# CONFIG_DTLK is not set
445# CONFIG_R3964 is not set 493# CONFIG_R3964 is not set
@@ -454,39 +502,45 @@ CONFIG_HW_RANDOM=y
454# CONFIG_TCG_TPM is not set 502# CONFIG_TCG_TPM is not set
455CONFIG_DEVPORT=y 503CONFIG_DEVPORT=y
456# CONFIG_I2C is not set 504# CONFIG_I2C is not set
457
458#
459# SPI support
460#
461# CONFIG_SPI is not set 505# CONFIG_SPI is not set
462# CONFIG_SPI_MASTER is not set
463# CONFIG_W1 is not set 506# CONFIG_W1 is not set
464# CONFIG_POWER_SUPPLY is not set 507# CONFIG_POWER_SUPPLY is not set
465# CONFIG_HWMON is not set 508# CONFIG_HWMON is not set
509# CONFIG_THERMAL is not set
510# CONFIG_THERMAL_HWMON is not set
511# CONFIG_WATCHDOG is not set
512
513#
514# Sonics Silicon Backplane
515#
516CONFIG_SSB_POSSIBLE=y
517# CONFIG_SSB is not set
466 518
467# 519#
468# Multifunction device drivers 520# Multifunction device drivers
469# 521#
522# CONFIG_MFD_CORE is not set
470# CONFIG_MFD_SM501 is not set 523# CONFIG_MFD_SM501 is not set
524# CONFIG_HTC_PASIC3 is not set
471 525
472# 526#
473# Multimedia devices 527# Multimedia devices
474# 528#
529
530#
531# Multimedia core support
532#
475# CONFIG_VIDEO_DEV is not set 533# CONFIG_VIDEO_DEV is not set
476# CONFIG_DAB is not set 534# CONFIG_VIDEO_MEDIA is not set
477 535
478# 536#
479# Graphics support 537# Multimedia drivers
480# 538#
481CONFIG_BACKLIGHT_LCD_SUPPORT=y 539# CONFIG_DAB is not set
482CONFIG_LCD_CLASS_DEVICE=y
483CONFIG_BACKLIGHT_CLASS_DEVICE=y
484CONFIG_BACKLIGHT_HP680=y
485 540
486# 541#
487# Display device support 542# Graphics support
488# 543#
489# CONFIG_DISPLAY_SUPPORT is not set
490# CONFIG_VGASTATE is not set 544# CONFIG_VGASTATE is not set
491CONFIG_VIDEO_OUTPUT_CONTROL=y 545CONFIG_VIDEO_OUTPUT_CONTROL=y
492CONFIG_FB=y 546CONFIG_FB=y
@@ -495,11 +549,12 @@ CONFIG_FIRMWARE_EDID=y
495CONFIG_FB_CFB_FILLRECT=y 549CONFIG_FB_CFB_FILLRECT=y
496CONFIG_FB_CFB_COPYAREA=y 550CONFIG_FB_CFB_COPYAREA=y
497CONFIG_FB_CFB_IMAGEBLIT=y 551CONFIG_FB_CFB_IMAGEBLIT=y
552# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
498# CONFIG_FB_SYS_FILLRECT is not set 553# CONFIG_FB_SYS_FILLRECT is not set
499# CONFIG_FB_SYS_COPYAREA is not set 554# CONFIG_FB_SYS_COPYAREA is not set
500# CONFIG_FB_SYS_IMAGEBLIT is not set 555# CONFIG_FB_SYS_IMAGEBLIT is not set
556# CONFIG_FB_FOREIGN_ENDIAN is not set
501# CONFIG_FB_SYS_FOPS is not set 557# CONFIG_FB_SYS_FOPS is not set
502CONFIG_FB_DEFERRED_IO=y
503# CONFIG_FB_SVGALIB is not set 558# CONFIG_FB_SVGALIB is not set
504# CONFIG_FB_MACMODES is not set 559# CONFIG_FB_MACMODES is not set
505# CONFIG_FB_BACKLIGHT is not set 560# CONFIG_FB_BACKLIGHT is not set
@@ -511,7 +566,20 @@ CONFIG_FB_DEFERRED_IO=y
511# 566#
512# CONFIG_FB_S1D13XXX is not set 567# CONFIG_FB_S1D13XXX is not set
513CONFIG_FB_HIT=y 568CONFIG_FB_HIT=y
569CONFIG_FB_SH_MOBILE_LCDC=y
514# CONFIG_FB_VIRTUAL is not set 570# CONFIG_FB_VIRTUAL is not set
571CONFIG_BACKLIGHT_LCD_SUPPORT=y
572CONFIG_LCD_CLASS_DEVICE=y
573# CONFIG_LCD_ILI9320 is not set
574# CONFIG_LCD_PLATFORM is not set
575CONFIG_BACKLIGHT_CLASS_DEVICE=y
576# CONFIG_BACKLIGHT_CORGI is not set
577CONFIG_BACKLIGHT_HP680=y
578
579#
580# Display device support
581#
582# CONFIG_DISPLAY_SUPPORT is not set
515 583
516# 584#
517# Console display driver support 585# Console display driver support
@@ -533,15 +601,13 @@ CONFIG_FONT_PEARL_8x8=y
533# CONFIG_FONT_SUN12x22 is not set 601# CONFIG_FONT_SUN12x22 is not set
534# CONFIG_FONT_10x18 is not set 602# CONFIG_FONT_10x18 is not set
535# CONFIG_LOGO is not set 603# CONFIG_LOGO is not set
536
537#
538# Sound
539#
540# CONFIG_SOUND is not set 604# CONFIG_SOUND is not set
541# CONFIG_HID_SUPPORT is not set 605# CONFIG_HID_SUPPORT is not set
542# CONFIG_USB_SUPPORT is not set 606# CONFIG_USB_SUPPORT is not set
543# CONFIG_MMC is not set 607# CONFIG_MMC is not set
608# CONFIG_MEMSTICK is not set
544# CONFIG_NEW_LEDS is not set 609# CONFIG_NEW_LEDS is not set
610# CONFIG_ACCESSIBILITY is not set
545CONFIG_RTC_LIB=y 611CONFIG_RTC_LIB=y
546CONFIG_RTC_CLASS=y 612CONFIG_RTC_CLASS=y
547CONFIG_RTC_HCTOSYS=y 613CONFIG_RTC_HCTOSYS=y
@@ -564,9 +630,10 @@ CONFIG_RTC_INTF_DEV=y
564# 630#
565# Platform RTC drivers 631# Platform RTC drivers
566# 632#
633# CONFIG_RTC_DRV_DS1511 is not set
567# CONFIG_RTC_DRV_DS1553 is not set 634# CONFIG_RTC_DRV_DS1553 is not set
568# CONFIG_RTC_DRV_STK17TA8 is not set
569# CONFIG_RTC_DRV_DS1742 is not set 635# CONFIG_RTC_DRV_DS1742 is not set
636# CONFIG_RTC_DRV_STK17TA8 is not set
570# CONFIG_RTC_DRV_M48T86 is not set 637# CONFIG_RTC_DRV_M48T86 is not set
571# CONFIG_RTC_DRV_M48T59 is not set 638# CONFIG_RTC_DRV_M48T59 is not set
572# CONFIG_RTC_DRV_V3020 is not set 639# CONFIG_RTC_DRV_V3020 is not set
@@ -575,23 +642,7 @@ CONFIG_RTC_INTF_DEV=y
575# on-CPU RTC drivers 642# on-CPU RTC drivers
576# 643#
577CONFIG_RTC_DRV_SH=y 644CONFIG_RTC_DRV_SH=y
578 645# CONFIG_DMADEVICES is not set
579#
580# DMA Engine support
581#
582# CONFIG_DMA_ENGINE is not set
583
584#
585# DMA Clients
586#
587
588#
589# DMA Devices
590#
591
592#
593# Userspace I/O
594#
595# CONFIG_UIO is not set 646# CONFIG_UIO is not set
596 647
597# 648#
@@ -606,13 +657,10 @@ CONFIG_EXT2_FS=y
606# CONFIG_JFS_FS is not set 657# CONFIG_JFS_FS is not set
607# CONFIG_FS_POSIX_ACL is not set 658# CONFIG_FS_POSIX_ACL is not set
608# CONFIG_XFS_FS is not set 659# CONFIG_XFS_FS is not set
609# CONFIG_GFS2_FS is not set 660CONFIG_DNOTIFY=y
610# CONFIG_MINIX_FS is not set
611# CONFIG_ROMFS_FS is not set
612CONFIG_INOTIFY=y 661CONFIG_INOTIFY=y
613CONFIG_INOTIFY_USER=y 662CONFIG_INOTIFY_USER=y
614# CONFIG_QUOTA is not set 663# CONFIG_QUOTA is not set
615CONFIG_DNOTIFY=y
616# CONFIG_AUTOFS_FS is not set 664# CONFIG_AUTOFS_FS is not set
617# CONFIG_AUTOFS4_FS is not set 665# CONFIG_AUTOFS4_FS is not set
618# CONFIG_FUSE_FS is not set 666# CONFIG_FUSE_FS is not set
@@ -643,7 +691,6 @@ CONFIG_SYSFS=y
643# CONFIG_TMPFS is not set 691# CONFIG_TMPFS is not set
644# CONFIG_HUGETLBFS is not set 692# CONFIG_HUGETLBFS is not set
645# CONFIG_HUGETLB_PAGE is not set 693# CONFIG_HUGETLB_PAGE is not set
646CONFIG_RAMFS=y
647# CONFIG_CONFIGFS_FS is not set 694# CONFIG_CONFIGFS_FS is not set
648 695
649# 696#
@@ -658,8 +705,11 @@ CONFIG_RAMFS=y
658# CONFIG_EFS_FS is not set 705# CONFIG_EFS_FS is not set
659# CONFIG_CRAMFS is not set 706# CONFIG_CRAMFS is not set
660# CONFIG_VXFS_FS is not set 707# CONFIG_VXFS_FS is not set
708# CONFIG_MINIX_FS is not set
709# CONFIG_OMFS_FS is not set
661# CONFIG_HPFS_FS is not set 710# CONFIG_HPFS_FS is not set
662# CONFIG_QNX4FS_FS is not set 711# CONFIG_QNX4FS_FS is not set
712# CONFIG_ROMFS_FS is not set
663# CONFIG_SYSV_FS is not set 713# CONFIG_SYSV_FS is not set
664# CONFIG_UFS_FS is not set 714# CONFIG_UFS_FS is not set
665 715
@@ -668,10 +718,6 @@ CONFIG_RAMFS=y
668# 718#
669# CONFIG_PARTITION_ADVANCED is not set 719# CONFIG_PARTITION_ADVANCED is not set
670CONFIG_MSDOS_PARTITION=y 720CONFIG_MSDOS_PARTITION=y
671
672#
673# Native Language Support
674#
675CONFIG_NLS=y 721CONFIG_NLS=y
676CONFIG_NLS_DEFAULT="iso8859-1" 722CONFIG_NLS_DEFAULT="iso8859-1"
677# CONFIG_NLS_CODEPAGE_437 is not set 723# CONFIG_NLS_CODEPAGE_437 is not set
@@ -714,22 +760,21 @@ CONFIG_NLS_CODEPAGE_850=y
714# CONFIG_NLS_UTF8 is not set 760# CONFIG_NLS_UTF8 is not set
715 761
716# 762#
717# Profiling support
718#
719# CONFIG_PROFILING is not set
720
721#
722# Kernel hacking 763# Kernel hacking
723# 764#
724CONFIG_TRACE_IRQFLAGS_SUPPORT=y 765CONFIG_TRACE_IRQFLAGS_SUPPORT=y
725# CONFIG_PRINTK_TIME is not set 766# CONFIG_PRINTK_TIME is not set
767CONFIG_ENABLE_WARN_DEPRECATED=y
726CONFIG_ENABLE_MUST_CHECK=y 768CONFIG_ENABLE_MUST_CHECK=y
769CONFIG_FRAME_WARN=1024
727# CONFIG_MAGIC_SYSRQ is not set 770# CONFIG_MAGIC_SYSRQ is not set
728# CONFIG_UNUSED_SYMBOLS is not set 771# CONFIG_UNUSED_SYMBOLS is not set
729# CONFIG_DEBUG_FS is not set 772# CONFIG_DEBUG_FS is not set
730# CONFIG_HEADERS_CHECK is not set 773# CONFIG_HEADERS_CHECK is not set
731# CONFIG_DEBUG_KERNEL is not set 774# CONFIG_DEBUG_KERNEL is not set
732# CONFIG_DEBUG_BUGVERBOSE is not set 775# CONFIG_DEBUG_BUGVERBOSE is not set
776# CONFIG_DEBUG_MEMORY_INIT is not set
777# CONFIG_SAMPLES is not set
733# CONFIG_SH_STANDARD_BIOS is not set 778# CONFIG_SH_STANDARD_BIOS is not set
734# CONFIG_EARLY_SCIF_CONSOLE is not set 779# CONFIG_EARLY_SCIF_CONSOLE is not set
735# CONFIG_SH_KGDB is not set 780# CONFIG_SH_KGDB is not set
@@ -739,50 +784,95 @@ CONFIG_ENABLE_MUST_CHECK=y
739# 784#
740# CONFIG_KEYS is not set 785# CONFIG_KEYS is not set
741# CONFIG_SECURITY is not set 786# CONFIG_SECURITY is not set
787# CONFIG_SECURITY_FILE_CAPABILITIES is not set
742CONFIG_CRYPTO=y 788CONFIG_CRYPTO=y
789
790#
791# Crypto core or helper
792#
743CONFIG_CRYPTO_ALGAPI=y 793CONFIG_CRYPTO_ALGAPI=y
744CONFIG_CRYPTO_BLKCIPHER=y 794CONFIG_CRYPTO_BLKCIPHER=y
745CONFIG_CRYPTO_MANAGER=y 795CONFIG_CRYPTO_MANAGER=y
796# CONFIG_CRYPTO_GF128MUL is not set
797# CONFIG_CRYPTO_NULL is not set
798# CONFIG_CRYPTO_CRYPTD is not set
799# CONFIG_CRYPTO_AUTHENC is not set
800
801#
802# Authenticated Encryption with Associated Data
803#
804# CONFIG_CRYPTO_CCM is not set
805# CONFIG_CRYPTO_GCM is not set
806# CONFIG_CRYPTO_SEQIV is not set
807
808#
809# Block modes
810#
811CONFIG_CRYPTO_CBC=y
812# CONFIG_CRYPTO_CTR is not set
813# CONFIG_CRYPTO_CTS is not set
814CONFIG_CRYPTO_ECB=y
815# CONFIG_CRYPTO_LRW is not set
816CONFIG_CRYPTO_PCBC=y
817# CONFIG_CRYPTO_XTS is not set
818
819#
820# Hash modes
821#
746# CONFIG_CRYPTO_HMAC is not set 822# CONFIG_CRYPTO_HMAC is not set
747# CONFIG_CRYPTO_XCBC is not set 823# CONFIG_CRYPTO_XCBC is not set
748# CONFIG_CRYPTO_NULL is not set 824
825#
826# Digest
827#
828# CONFIG_CRYPTO_CRC32C is not set
749# CONFIG_CRYPTO_MD4 is not set 829# CONFIG_CRYPTO_MD4 is not set
750CONFIG_CRYPTO_MD5=y 830CONFIG_CRYPTO_MD5=y
831# CONFIG_CRYPTO_MICHAEL_MIC is not set
832# CONFIG_CRYPTO_RMD128 is not set
833# CONFIG_CRYPTO_RMD160 is not set
834# CONFIG_CRYPTO_RMD256 is not set
835# CONFIG_CRYPTO_RMD320 is not set
751# CONFIG_CRYPTO_SHA1 is not set 836# CONFIG_CRYPTO_SHA1 is not set
752# CONFIG_CRYPTO_SHA256 is not set 837# CONFIG_CRYPTO_SHA256 is not set
753# CONFIG_CRYPTO_SHA512 is not set 838# CONFIG_CRYPTO_SHA512 is not set
754# CONFIG_CRYPTO_WP512 is not set
755# CONFIG_CRYPTO_TGR192 is not set 839# CONFIG_CRYPTO_TGR192 is not set
756# CONFIG_CRYPTO_GF128MUL is not set 840# CONFIG_CRYPTO_WP512 is not set
757CONFIG_CRYPTO_ECB=y 841
758CONFIG_CRYPTO_CBC=y 842#
759CONFIG_CRYPTO_PCBC=y 843# Ciphers
760# CONFIG_CRYPTO_LRW is not set 844#
761# CONFIG_CRYPTO_CRYPTD is not set
762# CONFIG_CRYPTO_DES is not set
763# CONFIG_CRYPTO_FCRYPT is not set
764# CONFIG_CRYPTO_BLOWFISH is not set
765# CONFIG_CRYPTO_TWOFISH is not set
766# CONFIG_CRYPTO_SERPENT is not set
767# CONFIG_CRYPTO_AES is not set 845# CONFIG_CRYPTO_AES is not set
846# CONFIG_CRYPTO_ANUBIS is not set
847# CONFIG_CRYPTO_ARC4 is not set
848# CONFIG_CRYPTO_BLOWFISH is not set
849# CONFIG_CRYPTO_CAMELLIA is not set
768# CONFIG_CRYPTO_CAST5 is not set 850# CONFIG_CRYPTO_CAST5 is not set
769# CONFIG_CRYPTO_CAST6 is not set 851# CONFIG_CRYPTO_CAST6 is not set
770# CONFIG_CRYPTO_TEA is not set 852# CONFIG_CRYPTO_DES is not set
771# CONFIG_CRYPTO_ARC4 is not set 853# CONFIG_CRYPTO_FCRYPT is not set
772# CONFIG_CRYPTO_KHAZAD is not set 854# CONFIG_CRYPTO_KHAZAD is not set
773# CONFIG_CRYPTO_ANUBIS is not set 855# CONFIG_CRYPTO_SALSA20 is not set
856# CONFIG_CRYPTO_SEED is not set
857# CONFIG_CRYPTO_SERPENT is not set
858# CONFIG_CRYPTO_TEA is not set
859# CONFIG_CRYPTO_TWOFISH is not set
860
861#
862# Compression
863#
774# CONFIG_CRYPTO_DEFLATE is not set 864# CONFIG_CRYPTO_DEFLATE is not set
775# CONFIG_CRYPTO_MICHAEL_MIC is not set 865# CONFIG_CRYPTO_LZO is not set
776# CONFIG_CRYPTO_CRC32C is not set
777# CONFIG_CRYPTO_CAMELLIA is not set
778# CONFIG_CRYPTO_HW is not set 866# CONFIG_CRYPTO_HW is not set
779 867
780# 868#
781# Library routines 869# Library routines
782# 870#
783CONFIG_BITREVERSE=y 871CONFIG_BITREVERSE=y
872# CONFIG_GENERIC_FIND_FIRST_BIT is not set
784# CONFIG_CRC_CCITT is not set 873# CONFIG_CRC_CCITT is not set
785CONFIG_CRC16=y 874CONFIG_CRC16=y
875CONFIG_CRC_T10DIF=y
786# CONFIG_CRC_ITU_T is not set 876# CONFIG_CRC_ITU_T is not set
787CONFIG_CRC32=y 877CONFIG_CRC32=y
788# CONFIG_CRC7 is not set 878# CONFIG_CRC7 is not set
diff --git a/arch/sh/configs/landisk_defconfig b/arch/sh/configs/landisk_defconfig
index 38f934ab50c7..99cc39c5c6ca 100644
--- a/arch/sh/configs/landisk_defconfig
+++ b/arch/sh/configs/landisk_defconfig
@@ -1,44 +1,53 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.19 3# Linux kernel version: 2.6.26
4# Thu Dec 7 17:13:04 2006 4# Wed Jul 30 01:35:07 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_BUG=y
8CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
9CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
11CONFIG_GENERIC_IRQ_PROBE=y 14CONFIG_GENERIC_IRQ_PROBE=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 15CONFIG_GENERIC_CALIBRATE_DELAY=y
13# CONFIG_GENERIC_TIME is not set 16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_CLOCKEVENTS=y
18CONFIG_SYS_SUPPORTS_PCI=y
14CONFIG_STACKTRACE_SUPPORT=y 19CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y 20CONFIG_LOCKDEP_SUPPORT=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_ARCH_NO_VIRT_TO_BUS=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
16CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
17 26
18# 27#
19# Code maturity level options 28# General setup
20# 29#
21CONFIG_EXPERIMENTAL=y 30CONFIG_EXPERIMENTAL=y
22CONFIG_BROKEN_ON_SMP=y 31CONFIG_BROKEN_ON_SMP=y
23CONFIG_INIT_ENV_ARG_LIMIT=32 32CONFIG_INIT_ENV_ARG_LIMIT=32
24
25#
26# General setup
27#
28CONFIG_LOCALVERSION="" 33CONFIG_LOCALVERSION=""
29CONFIG_LOCALVERSION_AUTO=y 34CONFIG_LOCALVERSION_AUTO=y
30CONFIG_SWAP=y 35CONFIG_SWAP=y
31CONFIG_SYSVIPC=y 36CONFIG_SYSVIPC=y
32# CONFIG_IPC_NS is not set 37CONFIG_SYSVIPC_SYSCTL=y
33# CONFIG_POSIX_MQUEUE is not set 38# CONFIG_POSIX_MQUEUE is not set
34# CONFIG_BSD_PROCESS_ACCT is not set 39# CONFIG_BSD_PROCESS_ACCT is not set
35# CONFIG_TASKSTATS is not set 40# CONFIG_TASKSTATS is not set
36# CONFIG_UTS_NS is not set
37# CONFIG_AUDIT is not set 41# CONFIG_AUDIT is not set
38# CONFIG_IKCONFIG is not set 42# CONFIG_IKCONFIG is not set
43CONFIG_LOG_BUF_SHIFT=14
44# CONFIG_CGROUPS is not set
45# CONFIG_GROUP_SCHED is not set
39CONFIG_SYSFS_DEPRECATED=y 46CONFIG_SYSFS_DEPRECATED=y
47CONFIG_SYSFS_DEPRECATED_V2=y
40# CONFIG_RELAY is not set 48# CONFIG_RELAY is not set
41CONFIG_INITRAMFS_SOURCE="" 49# CONFIG_NAMESPACES is not set
50# CONFIG_BLK_DEV_INITRD is not set
42CONFIG_CC_OPTIMIZE_FOR_SIZE=y 51CONFIG_CC_OPTIMIZE_FOR_SIZE=y
43CONFIG_SYSCTL=y 52CONFIG_SYSCTL=y
44CONFIG_EMBEDDED=y 53CONFIG_EMBEDDED=y
@@ -50,34 +59,48 @@ CONFIG_HOTPLUG=y
50CONFIG_PRINTK=y 59CONFIG_PRINTK=y
51CONFIG_BUG=y 60CONFIG_BUG=y
52CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
62CONFIG_COMPAT_BRK=y
53CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
54CONFIG_FUTEX=y 64CONFIG_FUTEX=y
65CONFIG_ANON_INODES=y
55CONFIG_EPOLL=y 66CONFIG_EPOLL=y
67CONFIG_SIGNALFD=y
68CONFIG_TIMERFD=y
69CONFIG_EVENTFD=y
56CONFIG_SHMEM=y 70CONFIG_SHMEM=y
57CONFIG_SLAB=y
58CONFIG_VM_EVENT_COUNTERS=y 71CONFIG_VM_EVENT_COUNTERS=y
72CONFIG_SLAB=y
73# CONFIG_SLUB is not set
74# CONFIG_SLOB is not set
75# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set
77CONFIG_HAVE_OPROFILE=y
78# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
79# CONFIG_HAVE_IOREMAP_PROT is not set
80# CONFIG_HAVE_KPROBES is not set
81# CONFIG_HAVE_KRETPROBES is not set
82# CONFIG_HAVE_ARCH_TRACEHOOK is not set
83# CONFIG_HAVE_DMA_ATTRS is not set
84# CONFIG_USE_GENERIC_SMP_HELPERS is not set
85CONFIG_HAVE_CLK=y
86CONFIG_PROC_PAGE_MONITOR=y
87CONFIG_SLABINFO=y
59CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
60# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
61CONFIG_BASE_SMALL=0 90CONFIG_BASE_SMALL=0
62# CONFIG_SLOB is not set
63
64#
65# Loadable module support
66#
67CONFIG_MODULES=y 91CONFIG_MODULES=y
92# CONFIG_MODULE_FORCE_LOAD is not set
68CONFIG_MODULE_UNLOAD=y 93CONFIG_MODULE_UNLOAD=y
69CONFIG_MODULE_FORCE_UNLOAD=y 94CONFIG_MODULE_FORCE_UNLOAD=y
70# CONFIG_MODVERSIONS is not set 95# CONFIG_MODVERSIONS is not set
71# CONFIG_MODULE_SRCVERSION_ALL is not set 96# CONFIG_MODULE_SRCVERSION_ALL is not set
72CONFIG_KMOD=y 97CONFIG_KMOD=y
73
74#
75# Block layer
76#
77CONFIG_BLOCK=y 98CONFIG_BLOCK=y
78# CONFIG_LBD is not set 99# CONFIG_LBD is not set
79# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
80# CONFIG_LSF is not set 101# CONFIG_LSF is not set
102# CONFIG_BLK_DEV_BSG is not set
103# CONFIG_BLK_DEV_INTEGRITY is not set
81 104
82# 105#
83# IO Schedulers 106# IO Schedulers
@@ -91,67 +114,26 @@ CONFIG_DEFAULT_AS=y
91# CONFIG_DEFAULT_CFQ is not set 114# CONFIG_DEFAULT_CFQ is not set
92# CONFIG_DEFAULT_NOOP is not set 115# CONFIG_DEFAULT_NOOP is not set
93CONFIG_DEFAULT_IOSCHED="anticipatory" 116CONFIG_DEFAULT_IOSCHED="anticipatory"
117CONFIG_CLASSIC_RCU=y
94 118
95# 119#
96# System type 120# System type
97# 121#
98# CONFIG_SH_SOLUTION_ENGINE is not set
99# CONFIG_SH_7751_SOLUTION_ENGINE is not set
100# CONFIG_SH_7300_SOLUTION_ENGINE is not set
101# CONFIG_SH_7343_SOLUTION_ENGINE is not set
102# CONFIG_SH_73180_SOLUTION_ENGINE is not set
103# CONFIG_SH_7751_SYSTEMH is not set
104# CONFIG_SH_HP6XX is not set
105# CONFIG_SH_EC3104 is not set
106# CONFIG_SH_SATURN is not set
107# CONFIG_SH_DREAMCAST is not set
108# CONFIG_SH_BIGSUR is not set
109# CONFIG_SH_MPC1211 is not set
110# CONFIG_SH_SH03 is not set
111# CONFIG_SH_SECUREEDGE5410 is not set
112# CONFIG_SH_HS7751RVOIP is not set
113# CONFIG_SH_7710VOIPGW is not set
114# CONFIG_SH_RTS7751R2D is not set
115# CONFIG_SH_R7780RP is not set
116# CONFIG_SH_EDOSK7705 is not set
117# CONFIG_SH_SH4202_MICRODEV is not set
118CONFIG_SH_LANDISK=y
119# CONFIG_SH_TITAN is not set
120# CONFIG_SH_SHMIN is not set
121# CONFIG_SH_7206_SOLUTION_ENGINE is not set
122# CONFIG_SH_7619_SOLUTION_ENGINE is not set
123# CONFIG_SH_UNKNOWN is not set
124
125#
126# Processor selection
127#
128CONFIG_CPU_SH4=y 122CONFIG_CPU_SH4=y
129
130#
131# SH-2 Processor Support
132#
133# CONFIG_CPU_SUBTYPE_SH7604 is not set
134# CONFIG_CPU_SUBTYPE_SH7619 is not set 123# CONFIG_CPU_SUBTYPE_SH7619 is not set
135 124# CONFIG_CPU_SUBTYPE_SH7203 is not set
136#
137# SH-2A Processor Support
138#
139# CONFIG_CPU_SUBTYPE_SH7206 is not set 125# CONFIG_CPU_SUBTYPE_SH7206 is not set
140 126# CONFIG_CPU_SUBTYPE_SH7263 is not set
141# 127# CONFIG_CPU_SUBTYPE_MXG is not set
142# SH-3 Processor Support
143#
144# CONFIG_CPU_SUBTYPE_SH7300 is not set
145# CONFIG_CPU_SUBTYPE_SH7705 is not set 128# CONFIG_CPU_SUBTYPE_SH7705 is not set
146# CONFIG_CPU_SUBTYPE_SH7706 is not set 129# CONFIG_CPU_SUBTYPE_SH7706 is not set
147# CONFIG_CPU_SUBTYPE_SH7707 is not set 130# CONFIG_CPU_SUBTYPE_SH7707 is not set
148# CONFIG_CPU_SUBTYPE_SH7708 is not set 131# CONFIG_CPU_SUBTYPE_SH7708 is not set
149# CONFIG_CPU_SUBTYPE_SH7709 is not set 132# CONFIG_CPU_SUBTYPE_SH7709 is not set
150# CONFIG_CPU_SUBTYPE_SH7710 is not set 133# CONFIG_CPU_SUBTYPE_SH7710 is not set
151 134# CONFIG_CPU_SUBTYPE_SH7712 is not set
152# 135# CONFIG_CPU_SUBTYPE_SH7720 is not set
153# SH-4 Processor Support 136# CONFIG_CPU_SUBTYPE_SH7721 is not set
154#
155# CONFIG_CPU_SUBTYPE_SH7750 is not set 137# CONFIG_CPU_SUBTYPE_SH7750 is not set
156# CONFIG_CPU_SUBTYPE_SH7091 is not set 138# CONFIG_CPU_SUBTYPE_SH7091 is not set
157# CONFIG_CPU_SUBTYPE_SH7750R is not set 139# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -160,53 +142,60 @@ CONFIG_CPU_SH4=y
160CONFIG_CPU_SUBTYPE_SH7751R=y 142CONFIG_CPU_SUBTYPE_SH7751R=y
161# CONFIG_CPU_SUBTYPE_SH7760 is not set 143# CONFIG_CPU_SUBTYPE_SH7760 is not set
162# CONFIG_CPU_SUBTYPE_SH4_202 is not set 144# CONFIG_CPU_SUBTYPE_SH4_202 is not set
163 145# CONFIG_CPU_SUBTYPE_SH7723 is not set
164# 146# CONFIG_CPU_SUBTYPE_SH7763 is not set
165# ST40 Processor Support
166#
167# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
168# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
169
170#
171# SH-4A Processor Support
172#
173# CONFIG_CPU_SUBTYPE_SH7770 is not set 147# CONFIG_CPU_SUBTYPE_SH7770 is not set
174# CONFIG_CPU_SUBTYPE_SH7780 is not set 148# CONFIG_CPU_SUBTYPE_SH7780 is not set
175# CONFIG_CPU_SUBTYPE_SH7785 is not set 149# CONFIG_CPU_SUBTYPE_SH7785 is not set
176 150# CONFIG_CPU_SUBTYPE_SHX3 is not set
177#
178# SH4AL-DSP Processor Support
179#
180# CONFIG_CPU_SUBTYPE_SH73180 is not set
181# CONFIG_CPU_SUBTYPE_SH7343 is not set 151# CONFIG_CPU_SUBTYPE_SH7343 is not set
152# CONFIG_CPU_SUBTYPE_SH7722 is not set
153# CONFIG_CPU_SUBTYPE_SH7366 is not set
154# CONFIG_CPU_SUBTYPE_SH5_101 is not set
155# CONFIG_CPU_SUBTYPE_SH5_103 is not set
182 156
183# 157#
184# Memory management options 158# Memory management options
185# 159#
160CONFIG_QUICKLIST=y
186CONFIG_MMU=y 161CONFIG_MMU=y
187CONFIG_PAGE_OFFSET=0x80000000 162CONFIG_PAGE_OFFSET=0x80000000
188CONFIG_MEMORY_START=0x0c000000 163CONFIG_MEMORY_START=0x0c000000
189CONFIG_MEMORY_SIZE=0x04000000 164CONFIG_MEMORY_SIZE=0x04000000
165CONFIG_29BIT=y
190CONFIG_VSYSCALL=y 166CONFIG_VSYSCALL=y
167CONFIG_ARCH_FLATMEM_ENABLE=y
168CONFIG_ARCH_SPARSEMEM_ENABLE=y
169CONFIG_ARCH_SPARSEMEM_DEFAULT=y
170CONFIG_MAX_ACTIVE_REGIONS=1
171CONFIG_ARCH_POPULATES_NODE_MAP=y
172CONFIG_ARCH_SELECT_MEMORY_MODEL=y
191CONFIG_PAGE_SIZE_4KB=y 173CONFIG_PAGE_SIZE_4KB=y
192# CONFIG_PAGE_SIZE_8KB is not set 174# CONFIG_PAGE_SIZE_8KB is not set
175# CONFIG_PAGE_SIZE_16KB is not set
193# CONFIG_PAGE_SIZE_64KB is not set 176# CONFIG_PAGE_SIZE_64KB is not set
177CONFIG_ENTRY_OFFSET=0x00001000
194CONFIG_SELECT_MEMORY_MODEL=y 178CONFIG_SELECT_MEMORY_MODEL=y
195CONFIG_FLATMEM_MANUAL=y 179CONFIG_FLATMEM_MANUAL=y
196# CONFIG_DISCONTIGMEM_MANUAL is not set 180# CONFIG_DISCONTIGMEM_MANUAL is not set
197# CONFIG_SPARSEMEM_MANUAL is not set 181# CONFIG_SPARSEMEM_MANUAL is not set
198CONFIG_FLATMEM=y 182CONFIG_FLATMEM=y
199CONFIG_FLAT_NODE_MEM_MAP=y 183CONFIG_FLAT_NODE_MEM_MAP=y
200# CONFIG_SPARSEMEM_STATIC is not set 184CONFIG_SPARSEMEM_STATIC=y
185# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
186CONFIG_PAGEFLAGS_EXTENDED=y
201CONFIG_SPLIT_PTLOCK_CPUS=4 187CONFIG_SPLIT_PTLOCK_CPUS=4
202# CONFIG_RESOURCES_64BIT is not set 188# CONFIG_RESOURCES_64BIT is not set
189CONFIG_ZONE_DMA_FLAG=0
190CONFIG_NR_QUICK=2
203 191
204# 192#
205# Cache configuration 193# Cache configuration
206# 194#
207# CONFIG_SH_DIRECT_MAPPED is not set 195# CONFIG_SH_DIRECT_MAPPED is not set
208# CONFIG_SH_WRITETHROUGH is not set 196CONFIG_CACHE_WRITEBACK=y
209# CONFIG_SH_OCRAM is not set 197# CONFIG_CACHE_WRITETHROUGH is not set
198# CONFIG_CACHE_OFF is not set
210 199
211# 200#
212# Processor features 201# Processor features
@@ -214,19 +203,32 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
214CONFIG_CPU_LITTLE_ENDIAN=y 203CONFIG_CPU_LITTLE_ENDIAN=y
215# CONFIG_CPU_BIG_ENDIAN is not set 204# CONFIG_CPU_BIG_ENDIAN is not set
216CONFIG_SH_FPU=y 205CONFIG_SH_FPU=y
217# CONFIG_SH_DSP is not set
218# CONFIG_SH_STORE_QUEUES is not set 206# CONFIG_SH_STORE_QUEUES is not set
219CONFIG_CPU_HAS_INTEVT=y 207CONFIG_CPU_HAS_INTEVT=y
220CONFIG_CPU_HAS_INTC_IRQ=y
221CONFIG_CPU_HAS_SR_RB=y 208CONFIG_CPU_HAS_SR_RB=y
222CONFIG_CPU_HAS_PTEA=y 209CONFIG_CPU_HAS_PTEA=y
210CONFIG_CPU_HAS_FPU=y
223 211
224# 212#
225# Timer support 213# Board support
214#
215# CONFIG_SH_7751_SYSTEMH is not set
216# CONFIG_SH_SECUREEDGE5410 is not set
217# CONFIG_SH_RTS7751R2D is not set
218CONFIG_SH_LANDISK=y
219# CONFIG_SH_TITAN is not set
220# CONFIG_SH_LBOX_RE2 is not set
221
222#
223# Timer and clock configuration
226# 224#
227CONFIG_SH_TMU=y 225CONFIG_SH_TMU=y
228CONFIG_SH_TIMER_IRQ=16 226CONFIG_SH_TIMER_IRQ=16
229CONFIG_SH_PCLK_FREQ=33333333 227CONFIG_SH_PCLK_FREQ=33333333
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
230 232
231# 233#
232# CPU Frequency scaling 234# CPU Frequency scaling
@@ -241,12 +243,11 @@ CONFIG_SH_PCLK_FREQ=33333333
241# 243#
242# Companion Chips 244# Companion Chips
243# 245#
244# CONFIG_HD6446X_SERIES is not set
245CONFIG_HEARTBEAT=y
246 246
247# 247#
248# Additional SuperH Device Drivers 248# Additional SuperH Device Drivers
249# 249#
250CONFIG_HEARTBEAT=y
250# CONFIG_PUSH_SWITCH is not set 251# CONFIG_PUSH_SWITCH is not set
251 252
252# 253#
@@ -254,13 +255,17 @@ CONFIG_HEARTBEAT=y
254# 255#
255# CONFIG_HZ_100 is not set 256# CONFIG_HZ_100 is not set
256CONFIG_HZ_250=y 257CONFIG_HZ_250=y
258# CONFIG_HZ_300 is not set
257# CONFIG_HZ_1000 is not set 259# CONFIG_HZ_1000 is not set
258CONFIG_HZ=250 260CONFIG_HZ=250
261# CONFIG_SCHED_HRTICK is not set
259CONFIG_KEXEC=y 262CONFIG_KEXEC=y
260# CONFIG_SMP is not set 263# CONFIG_CRASH_DUMP is not set
261CONFIG_PREEMPT_NONE=y 264CONFIG_PREEMPT_NONE=y
262# CONFIG_PREEMPT_VOLUNTARY is not set 265# CONFIG_PREEMPT_VOLUNTARY is not set
263# CONFIG_PREEMPT is not set 266# CONFIG_PREEMPT is not set
267CONFIG_GUSA=y
268# CONFIG_GUSA_RB is not set
264 269
265# 270#
266# Boot options 271# Boot options
@@ -273,16 +278,12 @@ CONFIG_BOOT_LINK_OFFSET=0x00800000
273# 278#
274# Bus options 279# Bus options
275# 280#
276CONFIG_ISA=y
277CONFIG_PCI=y 281CONFIG_PCI=y
278CONFIG_SH_PCIDMA_NONCOHERENT=y 282CONFIG_SH_PCIDMA_NONCOHERENT=y
279CONFIG_PCI_AUTO=y 283CONFIG_PCI_AUTO=y
280CONFIG_PCI_AUTO_UPDATE_RESOURCES=y 284CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
281# CONFIG_PCI_MULTITHREAD_PROBE is not set 285# CONFIG_ARCH_SUPPORTS_MSI is not set
282 286CONFIG_PCI_LEGACY=y
283#
284# PCCARD (PCMCIA/CardBus) support
285#
286CONFIG_PCCARD=y 287CONFIG_PCCARD=y
287# CONFIG_PCMCIA_DEBUG is not set 288# CONFIG_PCMCIA_DEBUG is not set
288CONFIG_PCMCIA=y 289CONFIG_PCMCIA=y
@@ -301,29 +302,16 @@ CONFIG_YENTA_ENE_TUNE=y
301CONFIG_YENTA_TOSHIBA=y 302CONFIG_YENTA_TOSHIBA=y
302# CONFIG_PD6729 is not set 303# CONFIG_PD6729 is not set
303# CONFIG_I82092 is not set 304# CONFIG_I82092 is not set
304# CONFIG_I82365 is not set
305# CONFIG_TCIC is not set
306CONFIG_PCMCIA_PROBE=y
307CONFIG_PCCARD_NONSTATIC=y 305CONFIG_PCCARD_NONSTATIC=y
308
309#
310# PCI Hotplug Support
311#
312# CONFIG_HOTPLUG_PCI is not set 306# CONFIG_HOTPLUG_PCI is not set
313 307
314# 308#
315# Executable file formats 309# Executable file formats
316# 310#
317CONFIG_BINFMT_ELF=y 311CONFIG_BINFMT_ELF=y
318# CONFIG_BINFMT_FLAT is not set
319# CONFIG_BINFMT_MISC is not set 312# CONFIG_BINFMT_MISC is not set
320 313
321# 314#
322# Power management options (EXPERIMENTAL)
323#
324# CONFIG_PM is not set
325
326#
327# Networking 315# Networking
328# 316#
329CONFIG_NET=y 317CONFIG_NET=y
@@ -331,13 +319,14 @@ CONFIG_NET=y
331# 319#
332# Networking options 320# Networking options
333# 321#
334# CONFIG_NETDEBUG is not set
335CONFIG_PACKET=y 322CONFIG_PACKET=y
336# CONFIG_PACKET_MMAP is not set 323# CONFIG_PACKET_MMAP is not set
337CONFIG_UNIX=y 324CONFIG_UNIX=y
338CONFIG_XFRM=y 325CONFIG_XFRM=y
339# CONFIG_XFRM_USER is not set 326# CONFIG_XFRM_USER is not set
340# CONFIG_XFRM_SUB_POLICY is not set 327# CONFIG_XFRM_SUB_POLICY is not set
328# CONFIG_XFRM_MIGRATE is not set
329# CONFIG_XFRM_STATISTICS is not set
341# CONFIG_NET_KEY is not set 330# CONFIG_NET_KEY is not set
342CONFIG_INET=y 331CONFIG_INET=y
343# CONFIG_IP_MULTICAST is not set 332# CONFIG_IP_MULTICAST is not set
@@ -364,49 +353,36 @@ CONFIG_IP_PNP=y
364CONFIG_INET_XFRM_MODE_TRANSPORT=y 353CONFIG_INET_XFRM_MODE_TRANSPORT=y
365CONFIG_INET_XFRM_MODE_TUNNEL=y 354CONFIG_INET_XFRM_MODE_TUNNEL=y
366CONFIG_INET_XFRM_MODE_BEET=y 355CONFIG_INET_XFRM_MODE_BEET=y
356# CONFIG_INET_LRO is not set
367CONFIG_INET_DIAG=y 357CONFIG_INET_DIAG=y
368CONFIG_INET_TCP_DIAG=y 358CONFIG_INET_TCP_DIAG=y
369# CONFIG_TCP_CONG_ADVANCED is not set 359# CONFIG_TCP_CONG_ADVANCED is not set
370CONFIG_TCP_CONG_CUBIC=y 360CONFIG_TCP_CONG_CUBIC=y
371CONFIG_DEFAULT_TCP_CONG="cubic" 361CONFIG_DEFAULT_TCP_CONG="cubic"
372# CONFIG_TCP_MD5SIG is not set 362# CONFIG_TCP_MD5SIG is not set
373
374#
375# IP: Virtual Server Configuration
376#
377# CONFIG_IP_VS is not set 363# CONFIG_IP_VS is not set
378# CONFIG_IPV6 is not set 364# CONFIG_IPV6 is not set
379# CONFIG_INET6_XFRM_TUNNEL is not set
380# CONFIG_INET6_TUNNEL is not set
381# CONFIG_NETWORK_SECMARK is not set 365# CONFIG_NETWORK_SECMARK is not set
382CONFIG_NETFILTER=y 366CONFIG_NETFILTER=y
383# CONFIG_NETFILTER_DEBUG is not set 367# CONFIG_NETFILTER_DEBUG is not set
368CONFIG_NETFILTER_ADVANCED=y
384 369
385# 370#
386# Core Netfilter Configuration 371# Core Netfilter Configuration
387# 372#
388# CONFIG_NETFILTER_NETLINK is not set 373# CONFIG_NETFILTER_NETLINK_QUEUE is not set
389# CONFIG_NF_CONNTRACK_ENABLED is not set 374# CONFIG_NETFILTER_NETLINK_LOG is not set
375# CONFIG_NF_CONNTRACK is not set
390# CONFIG_NETFILTER_XTABLES is not set 376# CONFIG_NETFILTER_XTABLES is not set
391 377
392# 378#
393# IP: Netfilter Configuration 379# IP: Netfilter Configuration
394# 380#
395CONFIG_IP_NF_QUEUE=m 381CONFIG_IP_NF_QUEUE=m
396 382# CONFIG_IP_NF_IPTABLES is not set
397# 383# CONFIG_IP_NF_ARPTABLES is not set
398# DCCP Configuration (EXPERIMENTAL)
399#
400# CONFIG_IP_DCCP is not set 384# CONFIG_IP_DCCP is not set
401
402#
403# SCTP Configuration (EXPERIMENTAL)
404#
405# CONFIG_IP_SCTP is not set 385# CONFIG_IP_SCTP is not set
406
407#
408# TIPC Configuration (EXPERIMENTAL)
409#
410# CONFIG_TIPC is not set 386# CONFIG_TIPC is not set
411# CONFIG_ATM is not set 387# CONFIG_ATM is not set
412# CONFIG_BRIDGE is not set 388# CONFIG_BRIDGE is not set
@@ -421,10 +397,6 @@ CONFIG_ATALK=m
421# CONFIG_LAPB is not set 397# CONFIG_LAPB is not set
422# CONFIG_ECONET is not set 398# CONFIG_ECONET is not set
423# CONFIG_WAN_ROUTER is not set 399# CONFIG_WAN_ROUTER is not set
424
425#
426# QoS and/or fair queueing
427#
428# CONFIG_NET_SCHED is not set 400# CONFIG_NET_SCHED is not set
429 401
430# 402#
@@ -432,9 +404,20 @@ CONFIG_ATALK=m
432# 404#
433# CONFIG_NET_PKTGEN is not set 405# CONFIG_NET_PKTGEN is not set
434# CONFIG_HAMRADIO is not set 406# CONFIG_HAMRADIO is not set
407# CONFIG_CAN is not set
435# CONFIG_IRDA is not set 408# CONFIG_IRDA is not set
436# CONFIG_BT is not set 409# CONFIG_BT is not set
410# CONFIG_AF_RXRPC is not set
411
412#
413# Wireless
414#
415# CONFIG_CFG80211 is not set
416# CONFIG_WIRELESS_EXT is not set
417# CONFIG_MAC80211 is not set
437# CONFIG_IEEE80211 is not set 418# CONFIG_IEEE80211 is not set
419# CONFIG_RFKILL is not set
420# CONFIG_NET_9P is not set
438 421
439# 422#
440# Device Drivers 423# Device Drivers
@@ -443,35 +426,17 @@ CONFIG_ATALK=m
443# 426#
444# Generic Driver Options 427# Generic Driver Options
445# 428#
429CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
446CONFIG_STANDALONE=y 430CONFIG_STANDALONE=y
447CONFIG_PREVENT_FIRMWARE_BUILD=y 431CONFIG_PREVENT_FIRMWARE_BUILD=y
448CONFIG_FW_LOADER=y 432CONFIG_FW_LOADER=y
433CONFIG_FIRMWARE_IN_KERNEL=y
434CONFIG_EXTRA_FIRMWARE=""
449# CONFIG_SYS_HYPERVISOR is not set 435# CONFIG_SYS_HYPERVISOR is not set
450
451#
452# Connector - unified userspace <-> kernelspace linker
453#
454# CONFIG_CONNECTOR is not set 436# CONFIG_CONNECTOR is not set
455
456#
457# Memory Technology Devices (MTD)
458#
459# CONFIG_MTD is not set 437# CONFIG_MTD is not set
460
461#
462# Parallel port support
463#
464# CONFIG_PARPORT is not set 438# CONFIG_PARPORT is not set
465 439CONFIG_BLK_DEV=y
466#
467# Plug and Play support
468#
469# CONFIG_PNP is not set
470
471#
472# Block devices
473#
474# CONFIG_BLK_CPQ_DA is not set
475# CONFIG_BLK_CPQ_CISS_DA is not set 440# CONFIG_BLK_CPQ_CISS_DA is not set
476# CONFIG_BLK_DEV_DAC960 is not set 441# CONFIG_BLK_DEV_DAC960 is not set
477# CONFIG_BLK_DEV_UMEM is not set 442# CONFIG_BLK_DEV_UMEM is not set
@@ -484,63 +449,66 @@ CONFIG_BLK_DEV_LOOP=y
484CONFIG_BLK_DEV_RAM=y 449CONFIG_BLK_DEV_RAM=y
485CONFIG_BLK_DEV_RAM_COUNT=16 450CONFIG_BLK_DEV_RAM_COUNT=16
486CONFIG_BLK_DEV_RAM_SIZE=4096 451CONFIG_BLK_DEV_RAM_SIZE=4096
487CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 452# CONFIG_BLK_DEV_XIP is not set
488# CONFIG_BLK_DEV_INITRD is not set
489# CONFIG_CDROM_PKTCDVD is not set 453# CONFIG_CDROM_PKTCDVD is not set
490# CONFIG_ATA_OVER_ETH is not set 454# CONFIG_ATA_OVER_ETH is not set
491 455# CONFIG_BLK_DEV_HD is not set
492# 456CONFIG_MISC_DEVICES=y
493# Misc devices 457# CONFIG_PHANTOM is not set
494# 458# CONFIG_EEPROM_93CX6 is not set
495# CONFIG_SGI_IOC4 is not set 459# CONFIG_SGI_IOC4 is not set
496# CONFIG_TIFM_CORE is not set 460# CONFIG_TIFM_CORE is not set
497 461# CONFIG_ENCLOSURE_SERVICES is not set
498# 462# CONFIG_HP_ILO is not set
499# ATA/ATAPI/MFM/RLL support 463CONFIG_HAVE_IDE=y
500#
501CONFIG_IDE=y 464CONFIG_IDE=y
502CONFIG_IDE_MAX_HWIFS=4 465CONFIG_IDE_MAX_HWIFS=4
503CONFIG_BLK_DEV_IDE=y 466CONFIG_BLK_DEV_IDE=y
504 467
505# 468#
506# Please see Documentation/ide.txt for help/info on IDE drives 469# Please see Documentation/ide/ide.txt for help/info on IDE drives
507# 470#
471CONFIG_IDE_ATAPI=y
508# CONFIG_BLK_DEV_IDE_SATA is not set 472# CONFIG_BLK_DEV_IDE_SATA is not set
509CONFIG_BLK_DEV_IDEDISK=y 473CONFIG_BLK_DEV_IDEDISK=y
510# CONFIG_IDEDISK_MULTI_MODE is not set 474# CONFIG_IDEDISK_MULTI_MODE is not set
511# CONFIG_BLK_DEV_IDECS is not set 475# CONFIG_BLK_DEV_IDECS is not set
476# CONFIG_BLK_DEV_DELKIN is not set
512CONFIG_BLK_DEV_IDECD=y 477CONFIG_BLK_DEV_IDECD=y
478CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
513# CONFIG_BLK_DEV_IDETAPE is not set 479# CONFIG_BLK_DEV_IDETAPE is not set
514# CONFIG_BLK_DEV_IDEFLOPPY is not set 480# CONFIG_BLK_DEV_IDEFLOPPY is not set
515CONFIG_BLK_DEV_IDESCSI=y 481CONFIG_BLK_DEV_IDESCSI=y
516# CONFIG_IDE_TASK_IOCTL is not set 482# CONFIG_IDE_TASK_IOCTL is not set
483CONFIG_IDE_PROC_FS=y
517 484
518# 485#
519# IDE chipset support/bugfixes 486# IDE chipset support/bugfixes
520# 487#
521CONFIG_IDE_GENERIC=y 488# CONFIG_BLK_DEV_PLATFORM is not set
489CONFIG_BLK_DEV_IDEDMA_SFF=y
490
491#
492# PCI IDE chipsets support
493#
522CONFIG_BLK_DEV_IDEPCI=y 494CONFIG_BLK_DEV_IDEPCI=y
523CONFIG_IDEPCI_SHARE_IRQ=y 495CONFIG_IDEPCI_PCIBUS_ORDER=y
524CONFIG_BLK_DEV_OFFBOARD=y 496CONFIG_BLK_DEV_OFFBOARD=y
525CONFIG_BLK_DEV_GENERIC=y 497CONFIG_BLK_DEV_GENERIC=y
526# CONFIG_BLK_DEV_OPTI621 is not set 498# CONFIG_BLK_DEV_OPTI621 is not set
527CONFIG_BLK_DEV_IDEDMA_PCI=y 499CONFIG_BLK_DEV_IDEDMA_PCI=y
528# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
529CONFIG_IDEDMA_PCI_AUTO=y
530CONFIG_IDEDMA_ONLYDISK=y
531CONFIG_BLK_DEV_AEC62XX=y 500CONFIG_BLK_DEV_AEC62XX=y
532# CONFIG_BLK_DEV_ALI15X3 is not set 501# CONFIG_BLK_DEV_ALI15X3 is not set
533# CONFIG_BLK_DEV_AMD74XX is not set 502# CONFIG_BLK_DEV_AMD74XX is not set
534# CONFIG_BLK_DEV_CMD64X is not set 503# CONFIG_BLK_DEV_CMD64X is not set
535# CONFIG_BLK_DEV_TRIFLEX is not set 504# CONFIG_BLK_DEV_TRIFLEX is not set
536# CONFIG_BLK_DEV_CY82C693 is not set
537# CONFIG_BLK_DEV_CS5520 is not set 505# CONFIG_BLK_DEV_CS5520 is not set
538# CONFIG_BLK_DEV_CS5530 is not set 506# CONFIG_BLK_DEV_CS5530 is not set
539# CONFIG_BLK_DEV_HPT34X is not set
540# CONFIG_BLK_DEV_HPT366 is not set 507# CONFIG_BLK_DEV_HPT366 is not set
541# CONFIG_BLK_DEV_JMICRON is not set 508# CONFIG_BLK_DEV_JMICRON is not set
542# CONFIG_BLK_DEV_SC1200 is not set 509# CONFIG_BLK_DEV_SC1200 is not set
543# CONFIG_BLK_DEV_PIIX is not set 510# CONFIG_BLK_DEV_PIIX is not set
511# CONFIG_BLK_DEV_IT8213 is not set
544# CONFIG_BLK_DEV_IT821X is not set 512# CONFIG_BLK_DEV_IT821X is not set
545# CONFIG_BLK_DEV_NS87415 is not set 513# CONFIG_BLK_DEV_NS87415 is not set
546# CONFIG_BLK_DEV_PDC202XX_OLD is not set 514# CONFIG_BLK_DEV_PDC202XX_OLD is not set
@@ -550,18 +518,15 @@ CONFIG_BLK_DEV_AEC62XX=y
550# CONFIG_BLK_DEV_SLC90E66 is not set 518# CONFIG_BLK_DEV_SLC90E66 is not set
551# CONFIG_BLK_DEV_TRM290 is not set 519# CONFIG_BLK_DEV_TRM290 is not set
552# CONFIG_BLK_DEV_VIA82CXXX is not set 520# CONFIG_BLK_DEV_VIA82CXXX is not set
553# CONFIG_IDE_ARM is not set 521# CONFIG_BLK_DEV_TC86C001 is not set
554# CONFIG_IDE_CHIPSETS is not set
555CONFIG_BLK_DEV_IDEDMA=y 522CONFIG_BLK_DEV_IDEDMA=y
556# CONFIG_IDEDMA_IVB is not set
557CONFIG_IDEDMA_AUTO=y
558# CONFIG_BLK_DEV_HD is not set
559 523
560# 524#
561# SCSI device support 525# SCSI device support
562# 526#
563# CONFIG_RAID_ATTRS is not set 527# CONFIG_RAID_ATTRS is not set
564CONFIG_SCSI=y 528CONFIG_SCSI=y
529CONFIG_SCSI_DMA=y
565# CONFIG_SCSI_TGT is not set 530# CONFIG_SCSI_TGT is not set
566# CONFIG_SCSI_NETLINK is not set 531# CONFIG_SCSI_NETLINK is not set
567CONFIG_SCSI_PROC_FS=y 532CONFIG_SCSI_PROC_FS=y
@@ -583,6 +548,7 @@ CONFIG_SCSI_MULTI_LUN=y
583# CONFIG_SCSI_CONSTANTS is not set 548# CONFIG_SCSI_CONSTANTS is not set
584# CONFIG_SCSI_LOGGING is not set 549# CONFIG_SCSI_LOGGING is not set
585# CONFIG_SCSI_SCAN_ASYNC is not set 550# CONFIG_SCSI_SCAN_ASYNC is not set
551CONFIG_SCSI_WAIT_SCAN=m
586 552
587# 553#
588# SCSI Transports 554# SCSI Transports
@@ -590,77 +556,43 @@ CONFIG_SCSI_MULTI_LUN=y
590# CONFIG_SCSI_SPI_ATTRS is not set 556# CONFIG_SCSI_SPI_ATTRS is not set
591# CONFIG_SCSI_FC_ATTRS is not set 557# CONFIG_SCSI_FC_ATTRS is not set
592# CONFIG_SCSI_ISCSI_ATTRS is not set 558# CONFIG_SCSI_ISCSI_ATTRS is not set
593# CONFIG_SCSI_SAS_ATTRS is not set
594# CONFIG_SCSI_SAS_LIBSAS is not set 559# CONFIG_SCSI_SAS_LIBSAS is not set
595 560# CONFIG_SCSI_SRP_ATTRS is not set
596# 561CONFIG_SCSI_LOWLEVEL=y
597# SCSI low-level drivers
598#
599# CONFIG_ISCSI_TCP is not set 562# CONFIG_ISCSI_TCP is not set
600# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 563# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
601# CONFIG_SCSI_3W_9XXX is not set 564# CONFIG_SCSI_3W_9XXX is not set
602# CONFIG_SCSI_ACARD is not set 565# CONFIG_SCSI_ACARD is not set
603# CONFIG_SCSI_AHA152X is not set
604# CONFIG_SCSI_AACRAID is not set 566# CONFIG_SCSI_AACRAID is not set
605# CONFIG_SCSI_AIC7XXX is not set 567# CONFIG_SCSI_AIC7XXX is not set
606# CONFIG_SCSI_AIC7XXX_OLD is not set 568# CONFIG_SCSI_AIC7XXX_OLD is not set
607# CONFIG_SCSI_AIC79XX is not set 569# CONFIG_SCSI_AIC79XX is not set
608# CONFIG_SCSI_AIC94XX is not set 570# CONFIG_SCSI_AIC94XX is not set
609# CONFIG_SCSI_DPT_I2O is not set
610# CONFIG_SCSI_IN2000 is not set
611# CONFIG_SCSI_ARCMSR is not set 571# CONFIG_SCSI_ARCMSR is not set
612# CONFIG_MEGARAID_NEWGEN is not set 572# CONFIG_MEGARAID_NEWGEN is not set
613# CONFIG_MEGARAID_LEGACY is not set 573# CONFIG_MEGARAID_LEGACY is not set
614# CONFIG_MEGARAID_SAS is not set 574# CONFIG_MEGARAID_SAS is not set
615# CONFIG_SCSI_HPTIOP is not set 575# CONFIG_SCSI_HPTIOP is not set
616# CONFIG_SCSI_DMX3191D is not set 576# CONFIG_SCSI_DMX3191D is not set
617# CONFIG_SCSI_DTC3280 is not set
618# CONFIG_SCSI_FUTURE_DOMAIN is not set 577# CONFIG_SCSI_FUTURE_DOMAIN is not set
619# CONFIG_SCSI_GENERIC_NCR5380 is not set
620# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
621# CONFIG_SCSI_IPS is not set 578# CONFIG_SCSI_IPS is not set
622# CONFIG_SCSI_INITIO is not set 579# CONFIG_SCSI_INITIO is not set
623# CONFIG_SCSI_INIA100 is not set 580# CONFIG_SCSI_INIA100 is not set
624# CONFIG_SCSI_NCR53C406A is not set 581# CONFIG_SCSI_MVSAS is not set
625# CONFIG_SCSI_STEX is not set 582# CONFIG_SCSI_STEX is not set
626# CONFIG_SCSI_SYM53C8XX_2 is not set 583# CONFIG_SCSI_SYM53C8XX_2 is not set
627# CONFIG_SCSI_PAS16 is not set
628# CONFIG_SCSI_PSI240I is not set
629# CONFIG_SCSI_QLOGIC_FAS is not set
630# CONFIG_SCSI_QLOGIC_1280 is not set 584# CONFIG_SCSI_QLOGIC_1280 is not set
631# CONFIG_SCSI_QLA_FC is not set 585# CONFIG_SCSI_QLA_FC is not set
632# CONFIG_SCSI_QLA_ISCSI is not set 586# CONFIG_SCSI_QLA_ISCSI is not set
633# CONFIG_SCSI_LPFC is not set 587# CONFIG_SCSI_LPFC is not set
634# CONFIG_SCSI_SYM53C416 is not set
635# CONFIG_SCSI_DC395x is not set 588# CONFIG_SCSI_DC395x is not set
636# CONFIG_SCSI_DC390T is not set 589# CONFIG_SCSI_DC390T is not set
637# CONFIG_SCSI_T128 is not set
638# CONFIG_SCSI_NSP32 is not set 590# CONFIG_SCSI_NSP32 is not set
639# CONFIG_SCSI_DEBUG is not set 591# CONFIG_SCSI_DEBUG is not set
640# CONFIG_SCSI_SRP is not set 592# CONFIG_SCSI_SRP is not set
641 593# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
642# 594# CONFIG_SCSI_DH is not set
643# PCMCIA SCSI adapter support
644#
645# CONFIG_PCMCIA_AHA152X is not set
646# CONFIG_PCMCIA_FDOMAIN is not set
647# CONFIG_PCMCIA_NINJA_SCSI is not set
648# CONFIG_PCMCIA_QLOGIC is not set
649# CONFIG_PCMCIA_SYM53C500 is not set
650
651#
652# Serial ATA (prod) and Parallel ATA (experimental) drivers
653#
654# CONFIG_ATA is not set 595# CONFIG_ATA is not set
655
656#
657# Old CD-ROM drivers (not SCSI, not IDE)
658#
659# CONFIG_CD_NO_IDESCSI is not set
660
661#
662# Multi-device support (RAID and LVM)
663#
664CONFIG_MD=y 596CONFIG_MD=y
665CONFIG_BLK_DEV_MD=m 597CONFIG_BLK_DEV_MD=m
666CONFIG_MD_LINEAR=m 598CONFIG_MD_LINEAR=m
@@ -671,76 +603,49 @@ CONFIG_MD_RAID1=m
671# CONFIG_MD_MULTIPATH is not set 603# CONFIG_MD_MULTIPATH is not set
672# CONFIG_MD_FAULTY is not set 604# CONFIG_MD_FAULTY is not set
673# CONFIG_BLK_DEV_DM is not set 605# CONFIG_BLK_DEV_DM is not set
674
675#
676# Fusion MPT device support
677#
678# CONFIG_FUSION is not set 606# CONFIG_FUSION is not set
679# CONFIG_FUSION_SPI is not set
680# CONFIG_FUSION_FC is not set
681# CONFIG_FUSION_SAS is not set
682 607
683# 608#
684# IEEE 1394 (FireWire) support 609# IEEE 1394 (FireWire) support
685# 610#
686# CONFIG_IEEE1394 is not set
687 611
688# 612#
689# I2O device support 613# Enable only one of the two stacks, unless you know what you are doing
690# 614#
615# CONFIG_FIREWIRE is not set
616# CONFIG_IEEE1394 is not set
691# CONFIG_I2O is not set 617# CONFIG_I2O is not set
692
693#
694# Network device support
695#
696CONFIG_NETDEVICES=y 618CONFIG_NETDEVICES=y
697# CONFIG_DUMMY is not set 619# CONFIG_DUMMY is not set
698# CONFIG_BONDING is not set 620# CONFIG_BONDING is not set
621# CONFIG_MACVLAN is not set
699# CONFIG_EQUALIZER is not set 622# CONFIG_EQUALIZER is not set
700CONFIG_TUN=m 623CONFIG_TUN=m
701 624# CONFIG_VETH is not set
702#
703# ARCnet devices
704#
705# CONFIG_ARCNET is not set 625# CONFIG_ARCNET is not set
706
707#
708# PHY device support
709#
710# CONFIG_PHYLIB is not set 626# CONFIG_PHYLIB is not set
711
712#
713# Ethernet (10 or 100Mbit)
714#
715CONFIG_NET_ETHERNET=y 627CONFIG_NET_ETHERNET=y
716CONFIG_MII=y 628CONFIG_MII=y
629# CONFIG_AX88796 is not set
717# CONFIG_STNIC is not set 630# CONFIG_STNIC is not set
718# CONFIG_HAPPYMEAL is not set 631# CONFIG_HAPPYMEAL is not set
719# CONFIG_SUNGEM is not set 632# CONFIG_SUNGEM is not set
720# CONFIG_CASSINI is not set 633# CONFIG_CASSINI is not set
721# CONFIG_NET_VENDOR_3COM is not set 634# CONFIG_NET_VENDOR_3COM is not set
722# CONFIG_NET_VENDOR_SMC is not set
723# CONFIG_SMC91X is not set 635# CONFIG_SMC91X is not set
724# CONFIG_NET_VENDOR_RACAL is not set 636# CONFIG_SMC911X is not set
725
726#
727# Tulip family network device support
728#
729# CONFIG_NET_TULIP is not set 637# CONFIG_NET_TULIP is not set
730# CONFIG_AT1700 is not set
731# CONFIG_DEPCA is not set
732# CONFIG_HP100 is not set 638# CONFIG_HP100 is not set
733# CONFIG_NET_ISA is not set 639# CONFIG_IBM_NEW_EMAC_ZMII is not set
640# CONFIG_IBM_NEW_EMAC_RGMII is not set
641# CONFIG_IBM_NEW_EMAC_TAH is not set
642# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
734CONFIG_NET_PCI=y 643CONFIG_NET_PCI=y
735# CONFIG_PCNET32 is not set 644# CONFIG_PCNET32 is not set
736# CONFIG_AMD8111_ETH is not set 645# CONFIG_AMD8111_ETH is not set
737# CONFIG_ADAPTEC_STARFIRE is not set 646# CONFIG_ADAPTEC_STARFIRE is not set
738# CONFIG_AC3200 is not set
739# CONFIG_APRICOT is not set
740# CONFIG_B44 is not set 647# CONFIG_B44 is not set
741# CONFIG_FORCEDETH is not set 648# CONFIG_FORCEDETH is not set
742# CONFIG_CS89x0 is not set
743# CONFIG_DGRS is not set
744# CONFIG_EEPRO100 is not set 649# CONFIG_EEPRO100 is not set
745# CONFIG_E100 is not set 650# CONFIG_E100 is not set
746# CONFIG_FEALNX is not set 651# CONFIG_FEALNX is not set
@@ -748,18 +653,20 @@ CONFIG_NET_PCI=y
748# CONFIG_NE2K_PCI is not set 653# CONFIG_NE2K_PCI is not set
749CONFIG_8139CP=y 654CONFIG_8139CP=y
750# CONFIG_8139TOO is not set 655# CONFIG_8139TOO is not set
656# CONFIG_R6040 is not set
751# CONFIG_SIS900 is not set 657# CONFIG_SIS900 is not set
752# CONFIG_EPIC100 is not set 658# CONFIG_EPIC100 is not set
753# CONFIG_SUNDANCE is not set 659# CONFIG_SUNDANCE is not set
754# CONFIG_TLAN is not set 660# CONFIG_TLAN is not set
755# CONFIG_VIA_RHINE is not set 661# CONFIG_VIA_RHINE is not set
756 662# CONFIG_SC92031 is not set
757# 663CONFIG_NETDEV_1000=y
758# Ethernet (1000 Mbit)
759#
760# CONFIG_ACENIC is not set 664# CONFIG_ACENIC is not set
761# CONFIG_DL2K is not set 665# CONFIG_DL2K is not set
762# CONFIG_E1000 is not set 666# CONFIG_E1000 is not set
667# CONFIG_E1000E is not set
668# CONFIG_IP1000 is not set
669# CONFIG_IGB is not set
763# CONFIG_NS83820 is not set 670# CONFIG_NS83820 is not set
764# CONFIG_HAMACHI is not set 671# CONFIG_HAMACHI is not set
765# CONFIG_YELLOWFIN is not set 672# CONFIG_YELLOWFIN is not set
@@ -767,58 +674,53 @@ CONFIG_8139CP=y
767# CONFIG_SIS190 is not set 674# CONFIG_SIS190 is not set
768# CONFIG_SKGE is not set 675# CONFIG_SKGE is not set
769# CONFIG_SKY2 is not set 676# CONFIG_SKY2 is not set
770# CONFIG_SK98LIN is not set
771# CONFIG_VIA_VELOCITY is not set 677# CONFIG_VIA_VELOCITY is not set
772# CONFIG_TIGON3 is not set 678# CONFIG_TIGON3 is not set
773# CONFIG_BNX2 is not set 679# CONFIG_BNX2 is not set
774# CONFIG_QLA3XXX is not set 680# CONFIG_QLA3XXX is not set
775 681# CONFIG_ATL1 is not set
776# 682# CONFIG_ATL1E is not set
777# Ethernet (10000 Mbit) 683CONFIG_NETDEV_10000=y
778#
779# CONFIG_CHELSIO_T1 is not set 684# CONFIG_CHELSIO_T1 is not set
685# CONFIG_CHELSIO_T3 is not set
686# CONFIG_IXGBE is not set
780# CONFIG_IXGB is not set 687# CONFIG_IXGB is not set
781# CONFIG_S2IO is not set 688# CONFIG_S2IO is not set
782# CONFIG_MYRI10GE is not set 689# CONFIG_MYRI10GE is not set
783# CONFIG_NETXEN_NIC is not set 690# CONFIG_NETXEN_NIC is not set
784 691# CONFIG_NIU is not set
785# 692# CONFIG_MLX4_CORE is not set
786# Token Ring devices 693# CONFIG_TEHUTI is not set
787# 694# CONFIG_BNX2X is not set
695# CONFIG_SFC is not set
788# CONFIG_TR is not set 696# CONFIG_TR is not set
789 697
790# 698#
791# Wireless LAN (non-hamradio) 699# Wireless LAN
792# 700#
793# CONFIG_NET_RADIO is not set 701# CONFIG_WLAN_PRE80211 is not set
702# CONFIG_WLAN_80211 is not set
703# CONFIG_IWLWIFI_LEDS is not set
794 704
795# 705#
796# PCMCIA network device support 706# USB Network Adapters
797# 707#
708# CONFIG_USB_CATC is not set
709# CONFIG_USB_KAWETH is not set
710CONFIG_USB_PEGASUS=m
711CONFIG_USB_RTL8150=m
712# CONFIG_USB_USBNET is not set
798# CONFIG_NET_PCMCIA is not set 713# CONFIG_NET_PCMCIA is not set
799
800#
801# Wan interfaces
802#
803# CONFIG_WAN is not set 714# CONFIG_WAN is not set
804# CONFIG_FDDI is not set 715# CONFIG_FDDI is not set
805# CONFIG_HIPPI is not set 716# CONFIG_HIPPI is not set
806# CONFIG_PPP is not set 717# CONFIG_PPP is not set
807# CONFIG_SLIP is not set 718# CONFIG_SLIP is not set
808# CONFIG_NET_FC is not set 719# CONFIG_NET_FC is not set
809# CONFIG_SHAPER is not set
810# CONFIG_NETCONSOLE is not set 720# CONFIG_NETCONSOLE is not set
811# CONFIG_NETPOLL is not set 721# CONFIG_NETPOLL is not set
812# CONFIG_NET_POLL_CONTROLLER is not set 722# CONFIG_NET_POLL_CONTROLLER is not set
813
814#
815# ISDN subsystem
816#
817# CONFIG_ISDN is not set 723# CONFIG_ISDN is not set
818
819#
820# Telephony Support
821#
822# CONFIG_PHONE is not set 724# CONFIG_PHONE is not set
823 725
824# 726#
@@ -826,6 +728,7 @@ CONFIG_8139CP=y
826# 728#
827CONFIG_INPUT=y 729CONFIG_INPUT=y
828# CONFIG_INPUT_FF_MEMLESS is not set 730# CONFIG_INPUT_FF_MEMLESS is not set
731# CONFIG_INPUT_POLLDEV is not set
829 732
830# 733#
831# Userland interfaces 734# Userland interfaces
@@ -835,7 +738,6 @@ CONFIG_INPUT_MOUSEDEV=y
835CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 738CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
836CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 739CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
837# CONFIG_INPUT_JOYDEV is not set 740# CONFIG_INPUT_JOYDEV is not set
838# CONFIG_INPUT_TSDEV is not set
839# CONFIG_INPUT_EVDEV is not set 741# CONFIG_INPUT_EVDEV is not set
840# CONFIG_INPUT_EVBUG is not set 742# CONFIG_INPUT_EVBUG is not set
841 743
@@ -845,6 +747,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
845# CONFIG_INPUT_KEYBOARD is not set 747# CONFIG_INPUT_KEYBOARD is not set
846# CONFIG_INPUT_MOUSE is not set 748# CONFIG_INPUT_MOUSE is not set
847# CONFIG_INPUT_JOYSTICK is not set 749# CONFIG_INPUT_JOYSTICK is not set
750# CONFIG_INPUT_TABLET is not set
848# CONFIG_INPUT_TOUCHSCREEN is not set 751# CONFIG_INPUT_TOUCHSCREEN is not set
849# CONFIG_INPUT_MISC is not set 752# CONFIG_INPUT_MISC is not set
850 753
@@ -858,10 +761,13 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
858# Character devices 761# Character devices
859# 762#
860CONFIG_VT=y 763CONFIG_VT=y
764CONFIG_CONSOLE_TRANSLATIONS=y
861CONFIG_VT_CONSOLE=y 765CONFIG_VT_CONSOLE=y
862CONFIG_HW_CONSOLE=y 766CONFIG_HW_CONSOLE=y
863# CONFIG_VT_HW_CONSOLE_BINDING is not set 767# CONFIG_VT_HW_CONSOLE_BINDING is not set
768CONFIG_DEVKMEM=y
864# CONFIG_SERIAL_NONSTANDARD is not set 769# CONFIG_SERIAL_NONSTANDARD is not set
770# CONFIG_NOZOMI is not set
865 771
866# 772#
867# Serial drivers 773# Serial drivers
@@ -880,22 +786,10 @@ CONFIG_SERIAL_CORE_CONSOLE=y
880CONFIG_UNIX98_PTYS=y 786CONFIG_UNIX98_PTYS=y
881CONFIG_LEGACY_PTYS=y 787CONFIG_LEGACY_PTYS=y
882CONFIG_LEGACY_PTY_COUNT=256 788CONFIG_LEGACY_PTY_COUNT=256
883
884#
885# IPMI
886#
887# CONFIG_IPMI_HANDLER is not set 789# CONFIG_IPMI_HANDLER is not set
888
889#
890# Watchdog Cards
891#
892# CONFIG_WATCHDOG is not set
893CONFIG_HW_RANDOM=y 790CONFIG_HW_RANDOM=y
894# CONFIG_GEN_RTC is not set
895# CONFIG_DTLK is not set
896# CONFIG_R3964 is not set 791# CONFIG_R3964 is not set
897# CONFIG_APPLICOM is not set 792# CONFIG_APPLICOM is not set
898# CONFIG_DRM is not set
899 793
900# 794#
901# PCMCIA character devices 795# PCMCIA character devices
@@ -903,65 +797,77 @@ CONFIG_HW_RANDOM=y
903# CONFIG_SYNCLINK_CS is not set 797# CONFIG_SYNCLINK_CS is not set
904# CONFIG_CARDMAN_4000 is not set 798# CONFIG_CARDMAN_4000 is not set
905# CONFIG_CARDMAN_4040 is not set 799# CONFIG_CARDMAN_4040 is not set
800# CONFIG_IPWIRELESS is not set
906# CONFIG_RAW_DRIVER is not set 801# CONFIG_RAW_DRIVER is not set
907
908#
909# TPM devices
910#
911# CONFIG_TCG_TPM is not set 802# CONFIG_TCG_TPM is not set
912 803CONFIG_DEVPORT=y
913#
914# I2C support
915#
916# CONFIG_I2C is not set 804# CONFIG_I2C is not set
917
918#
919# SPI support
920#
921# CONFIG_SPI is not set 805# CONFIG_SPI is not set
922# CONFIG_SPI_MASTER is not set
923
924#
925# Dallas's 1-wire bus
926#
927# CONFIG_W1 is not set 806# CONFIG_W1 is not set
928 807# CONFIG_POWER_SUPPLY is not set
929#
930# Hardware Monitoring support
931#
932CONFIG_HWMON=y 808CONFIG_HWMON=y
933# CONFIG_HWMON_VID is not set 809# CONFIG_HWMON_VID is not set
934# CONFIG_SENSORS_ABITUGURU is not set 810# CONFIG_SENSORS_I5K_AMB is not set
935# CONFIG_SENSORS_F71805F is not set 811# CONFIG_SENSORS_F71805F is not set
812# CONFIG_SENSORS_F71882FG is not set
813# CONFIG_SENSORS_IT87 is not set
814# CONFIG_SENSORS_PC87360 is not set
815# CONFIG_SENSORS_PC87427 is not set
816# CONFIG_SENSORS_SIS5595 is not set
817# CONFIG_SENSORS_SMSC47M1 is not set
818# CONFIG_SENSORS_SMSC47B397 is not set
819# CONFIG_SENSORS_VIA686A is not set
936# CONFIG_SENSORS_VT1211 is not set 820# CONFIG_SENSORS_VT1211 is not set
821# CONFIG_SENSORS_VT8231 is not set
822# CONFIG_SENSORS_W83627HF is not set
823# CONFIG_SENSORS_W83627EHF is not set
937# CONFIG_HWMON_DEBUG_CHIP is not set 824# CONFIG_HWMON_DEBUG_CHIP is not set
825# CONFIG_THERMAL is not set
826# CONFIG_THERMAL_HWMON is not set
827# CONFIG_WATCHDOG is not set
828
829#
830# Sonics Silicon Backplane
831#
832CONFIG_SSB_POSSIBLE=y
833# CONFIG_SSB is not set
834
835#
836# Multifunction device drivers
837#
838# CONFIG_MFD_CORE is not set
839# CONFIG_MFD_SM501 is not set
840# CONFIG_HTC_PASIC3 is not set
938 841
939# 842#
940# Multimedia devices 843# Multimedia devices
941# 844#
942CONFIG_VIDEO_DEV=m
943CONFIG_VIDEO_V4L1=y
944CONFIG_VIDEO_V4L1_COMPAT=y
945CONFIG_VIDEO_V4L2=y
946 845
947# 846#
948# Video Capture Adapters 847# Multimedia core support
949# 848#
849CONFIG_VIDEO_DEV=m
850CONFIG_VIDEO_V4L2_COMMON=m
851CONFIG_VIDEO_ALLOW_V4L1=y
852CONFIG_VIDEO_V4L1_COMPAT=y
853# CONFIG_DVB_CORE is not set
854CONFIG_VIDEO_MEDIA=m
950 855
951# 856#
952# Video Capture Adapters 857# Multimedia drivers
953# 858#
859# CONFIG_MEDIA_ATTACH is not set
860CONFIG_VIDEO_V4L2=m
861CONFIG_VIDEO_V4L1=m
862CONFIG_VIDEO_CAPTURE_DRIVERS=y
954# CONFIG_VIDEO_ADV_DEBUG is not set 863# CONFIG_VIDEO_ADV_DEBUG is not set
955CONFIG_VIDEO_HELPER_CHIPS_AUTO=y 864CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
956# CONFIG_VIDEO_VIVI is not set 865# CONFIG_VIDEO_VIVI is not set
957# CONFIG_VIDEO_PMS is not set
958# CONFIG_VIDEO_CPIA is not set 866# CONFIG_VIDEO_CPIA is not set
959# CONFIG_VIDEO_CPIA2 is not set 867# CONFIG_VIDEO_CPIA2 is not set
960# CONFIG_VIDEO_STRADIS is not set 868CONFIG_V4L_USB_DRIVERS=y
961 869# CONFIG_USB_VIDEO_CLASS is not set
962# 870# CONFIG_USB_GSPCA is not set
963# V4L USB devices
964#
965CONFIG_VIDEO_USBVIDEO=m 871CONFIG_VIDEO_USBVIDEO=m
966CONFIG_USB_VICAM=m 872CONFIG_USB_VICAM=m
967CONFIG_USB_IBMCAM=m 873CONFIG_USB_IBMCAM=m
@@ -975,106 +881,100 @@ CONFIG_USB_STV680=m
975# CONFIG_USB_ZC0301 is not set 881# CONFIG_USB_ZC0301 is not set
976CONFIG_USB_PWC=m 882CONFIG_USB_PWC=m
977# CONFIG_USB_PWC_DEBUG is not set 883# CONFIG_USB_PWC_DEBUG is not set
978 884# CONFIG_USB_ZR364XX is not set
979# 885# CONFIG_USB_STKWEBCAM is not set
980# Radio Adapters 886# CONFIG_USB_S2255 is not set
981# 887# CONFIG_SOC_CAMERA is not set
982# CONFIG_RADIO_CADET is not set 888# CONFIG_VIDEO_SH_MOBILE_CEU is not set
983# CONFIG_RADIO_RTRACK is not set 889CONFIG_RADIO_ADAPTERS=y
984# CONFIG_RADIO_RTRACK2 is not set
985# CONFIG_RADIO_AZTECH is not set
986# CONFIG_RADIO_GEMTEK is not set
987# CONFIG_RADIO_GEMTEK_PCI is not set 890# CONFIG_RADIO_GEMTEK_PCI is not set
988# CONFIG_RADIO_MAXIRADIO is not set 891# CONFIG_RADIO_MAXIRADIO is not set
989# CONFIG_RADIO_MAESTRO is not set 892# CONFIG_RADIO_MAESTRO is not set
990# CONFIG_RADIO_SF16FMI is not set
991# CONFIG_RADIO_SF16FMR2 is not set
992# CONFIG_RADIO_TERRATEC is not set
993# CONFIG_RADIO_TRUST is not set
994# CONFIG_RADIO_TYPHOON is not set
995# CONFIG_RADIO_ZOLTRIX is not set
996CONFIG_USB_DSBR=m 893CONFIG_USB_DSBR=m
894# CONFIG_USB_SI470X is not set
895# CONFIG_DAB is not set
997 896
998# 897#
999# Digital Video Broadcasting Devices 898# Graphics support
1000# 899#
1001# CONFIG_DVB is not set 900# CONFIG_DRM is not set
1002CONFIG_USB_DABUSB=m 901# CONFIG_VGASTATE is not set
902# CONFIG_VIDEO_OUTPUT_CONTROL is not set
903# CONFIG_FB is not set
904# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1003 905
1004# 906#
1005# Graphics support 907# Display device support
1006# 908#
1007CONFIG_FIRMWARE_EDID=y 909# CONFIG_DISPLAY_SUPPORT is not set
1008# CONFIG_FB is not set
1009 910
1010# 911#
1011# Console display driver support 912# Console display driver support
1012# 913#
1013# CONFIG_MDA_CONSOLE is not set
1014CONFIG_DUMMY_CONSOLE=y 914CONFIG_DUMMY_CONSOLE=y
1015CONFIG_FONT_8x16=y 915CONFIG_FONT_8x16=y
1016# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1017
1018#
1019# Sound
1020#
1021CONFIG_SOUND=m 916CONFIG_SOUND=m
1022
1023#
1024# Advanced Linux Sound Architecture
1025#
1026# CONFIG_SND is not set 917# CONFIG_SND is not set
918CONFIG_SOUND_PRIME=m
919CONFIG_HID_SUPPORT=y
920CONFIG_HID=y
921# CONFIG_HID_DEBUG is not set
922# CONFIG_HIDRAW is not set
1027 923
1028# 924#
1029# Open Sound System 925# USB Input Devices
1030# 926#
1031CONFIG_SOUND_PRIME=m 927CONFIG_USB_HID=m
1032# CONFIG_OSS_OBSOLETE_DRIVER is not set 928# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1033# CONFIG_SOUND_BT878 is not set 929# CONFIG_HID_FF is not set
1034# CONFIG_SOUND_ES1371 is not set 930# CONFIG_USB_HIDDEV is not set
1035# CONFIG_SOUND_ICH is not set
1036# CONFIG_SOUND_TRIDENT is not set
1037# CONFIG_SOUND_MSNDCLAS is not set
1038# CONFIG_SOUND_MSNDPIN is not set
1039# CONFIG_SOUND_VIA82CXXX is not set
1040 931
1041# 932#
1042# USB support 933# USB HID Boot Protocol drivers
1043# 934#
935# CONFIG_USB_KBD is not set
936# CONFIG_USB_MOUSE is not set
937CONFIG_USB_SUPPORT=y
1044CONFIG_USB_ARCH_HAS_HCD=y 938CONFIG_USB_ARCH_HAS_HCD=y
1045CONFIG_USB_ARCH_HAS_OHCI=y 939CONFIG_USB_ARCH_HAS_OHCI=y
1046CONFIG_USB_ARCH_HAS_EHCI=y 940CONFIG_USB_ARCH_HAS_EHCI=y
1047CONFIG_USB=y 941CONFIG_USB=y
1048# CONFIG_USB_DEBUG is not set 942# CONFIG_USB_DEBUG is not set
943# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1049 944
1050# 945#
1051# Miscellaneous USB options 946# Miscellaneous USB options
1052# 947#
1053CONFIG_USB_DEVICEFS=y 948CONFIG_USB_DEVICEFS=y
1054# CONFIG_USB_BANDWIDTH is not set 949CONFIG_USB_DEVICE_CLASS=y
1055# CONFIG_USB_DYNAMIC_MINORS is not set 950# CONFIG_USB_DYNAMIC_MINORS is not set
1056# CONFIG_USB_MULTITHREAD_PROBE is not set
1057# CONFIG_USB_OTG is not set 951# CONFIG_USB_OTG is not set
952# CONFIG_USB_OTG_WHITELIST is not set
953# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1058 954
1059# 955#
1060# USB Host Controller Drivers 956# USB Host Controller Drivers
1061# 957#
958# CONFIG_USB_C67X00_HCD is not set
1062CONFIG_USB_EHCI_HCD=y 959CONFIG_USB_EHCI_HCD=y
1063# CONFIG_USB_EHCI_SPLIT_ISO is not set
1064# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 960# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1065# CONFIG_USB_EHCI_TT_NEWSCHED is not set 961# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1066# CONFIG_USB_ISP116X_HCD is not set 962# CONFIG_USB_ISP116X_HCD is not set
963# CONFIG_USB_ISP1760_HCD is not set
1067CONFIG_USB_OHCI_HCD=y 964CONFIG_USB_OHCI_HCD=y
1068# CONFIG_USB_OHCI_BIG_ENDIAN is not set 965# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
966# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1069CONFIG_USB_OHCI_LITTLE_ENDIAN=y 967CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1070# CONFIG_USB_UHCI_HCD is not set 968# CONFIG_USB_UHCI_HCD is not set
1071# CONFIG_USB_SL811_HCD is not set 969# CONFIG_USB_SL811_HCD is not set
970# CONFIG_USB_R8A66597_HCD is not set
1072 971
1073# 972#
1074# USB Device Class drivers 973# USB Device Class drivers
1075# 974#
1076# CONFIG_USB_ACM is not set 975# CONFIG_USB_ACM is not set
1077CONFIG_USB_PRINTER=m 976CONFIG_USB_PRINTER=m
977# CONFIG_USB_WDM is not set
1078 978
1079# 979#
1080# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 980# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1094,66 +994,28 @@ CONFIG_USB_STORAGE_SDDR09=y
1094CONFIG_USB_STORAGE_SDDR55=y 994CONFIG_USB_STORAGE_SDDR55=y
1095CONFIG_USB_STORAGE_JUMPSHOT=y 995CONFIG_USB_STORAGE_JUMPSHOT=y
1096# CONFIG_USB_STORAGE_ALAUDA is not set 996# CONFIG_USB_STORAGE_ALAUDA is not set
997# CONFIG_USB_STORAGE_ONETOUCH is not set
1097# CONFIG_USB_STORAGE_KARMA is not set 998# CONFIG_USB_STORAGE_KARMA is not set
999# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1098# CONFIG_USB_LIBUSUAL is not set 1000# CONFIG_USB_LIBUSUAL is not set
1099 1001
1100# 1002#
1101# USB Input Devices
1102#
1103CONFIG_USB_HID=m
1104CONFIG_USB_HIDINPUT=y
1105# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1106# CONFIG_HID_FF is not set
1107# CONFIG_USB_HIDDEV is not set
1108
1109#
1110# USB HID Boot Protocol drivers
1111#
1112# CONFIG_USB_KBD is not set
1113# CONFIG_USB_MOUSE is not set
1114# CONFIG_USB_AIPTEK is not set
1115# CONFIG_USB_WACOM is not set
1116# CONFIG_USB_ACECAD is not set
1117# CONFIG_USB_KBTAB is not set
1118# CONFIG_USB_POWERMATE is not set
1119# CONFIG_USB_TOUCHSCREEN is not set
1120# CONFIG_USB_YEALINK is not set
1121# CONFIG_USB_XPAD is not set
1122# CONFIG_USB_ATI_REMOTE is not set
1123# CONFIG_USB_ATI_REMOTE2 is not set
1124# CONFIG_USB_KEYSPAN_REMOTE is not set
1125# CONFIG_USB_APPLETOUCH is not set
1126
1127#
1128# USB Imaging devices 1003# USB Imaging devices
1129# 1004#
1130# CONFIG_USB_MDC800 is not set 1005# CONFIG_USB_MDC800 is not set
1131# CONFIG_USB_MICROTEK is not set 1006# CONFIG_USB_MICROTEK is not set
1132
1133#
1134# USB Network Adapters
1135#
1136# CONFIG_USB_CATC is not set
1137# CONFIG_USB_KAWETH is not set
1138CONFIG_USB_PEGASUS=m
1139CONFIG_USB_RTL8150=m
1140# CONFIG_USB_USBNET_MII is not set
1141# CONFIG_USB_USBNET is not set
1142CONFIG_USB_MON=y 1007CONFIG_USB_MON=y
1143 1008
1144# 1009#
1145# USB port drivers 1010# USB port drivers
1146# 1011#
1147
1148#
1149# USB Serial Converter support
1150#
1151CONFIG_USB_SERIAL=m 1012CONFIG_USB_SERIAL=m
1013# CONFIG_USB_EZUSB is not set
1152# CONFIG_USB_SERIAL_GENERIC is not set 1014# CONFIG_USB_SERIAL_GENERIC is not set
1153# CONFIG_USB_SERIAL_AIRCABLE is not set 1015# CONFIG_USB_SERIAL_AIRCABLE is not set
1154# CONFIG_USB_SERIAL_AIRPRIME is not set
1155# CONFIG_USB_SERIAL_ARK3116 is not set 1016# CONFIG_USB_SERIAL_ARK3116 is not set
1156# CONFIG_USB_SERIAL_BELKIN is not set 1017# CONFIG_USB_SERIAL_BELKIN is not set
1018# CONFIG_USB_SERIAL_CH341 is not set
1157# CONFIG_USB_SERIAL_WHITEHEAT is not set 1019# CONFIG_USB_SERIAL_WHITEHEAT is not set
1158# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set 1020# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1159# CONFIG_USB_SERIAL_CP2101 is not set 1021# CONFIG_USB_SERIAL_CP2101 is not set
@@ -1168,6 +1030,7 @@ CONFIG_USB_SERIAL_FTDI_SIO=m
1168# CONFIG_USB_SERIAL_EDGEPORT_TI is not set 1030# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1169# CONFIG_USB_SERIAL_GARMIN is not set 1031# CONFIG_USB_SERIAL_GARMIN is not set
1170# CONFIG_USB_SERIAL_IPW is not set 1032# CONFIG_USB_SERIAL_IPW is not set
1033# CONFIG_USB_SERIAL_IUU is not set
1171# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set 1034# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1172# CONFIG_USB_SERIAL_KEYSPAN is not set 1035# CONFIG_USB_SERIAL_KEYSPAN is not set
1173# CONFIG_USB_SERIAL_KLSI is not set 1036# CONFIG_USB_SERIAL_KLSI is not set
@@ -1175,8 +1038,11 @@ CONFIG_USB_SERIAL_FTDI_SIO=m
1175# CONFIG_USB_SERIAL_MCT_U232 is not set 1038# CONFIG_USB_SERIAL_MCT_U232 is not set
1176# CONFIG_USB_SERIAL_MOS7720 is not set 1039# CONFIG_USB_SERIAL_MOS7720 is not set
1177# CONFIG_USB_SERIAL_MOS7840 is not set 1040# CONFIG_USB_SERIAL_MOS7840 is not set
1041# CONFIG_USB_SERIAL_MOTOROLA is not set
1178# CONFIG_USB_SERIAL_NAVMAN is not set 1042# CONFIG_USB_SERIAL_NAVMAN is not set
1179CONFIG_USB_SERIAL_PL2303=m 1043CONFIG_USB_SERIAL_PL2303=m
1044# CONFIG_USB_SERIAL_OTI6858 is not set
1045# CONFIG_USB_SERIAL_SPCP8X5 is not set
1180# CONFIG_USB_SERIAL_HP4X is not set 1046# CONFIG_USB_SERIAL_HP4X is not set
1181# CONFIG_USB_SERIAL_SAFE is not set 1047# CONFIG_USB_SERIAL_SAFE is not set
1182# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set 1048# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
@@ -1197,6 +1063,7 @@ CONFIG_USB_EMI26=m
1197# CONFIG_USB_RIO500 is not set 1063# CONFIG_USB_RIO500 is not set
1198# CONFIG_USB_LEGOTOWER is not set 1064# CONFIG_USB_LEGOTOWER is not set
1199# CONFIG_USB_LCD is not set 1065# CONFIG_USB_LCD is not set
1066# CONFIG_USB_BERRY_CHARGE is not set
1200# CONFIG_USB_LED is not set 1067# CONFIG_USB_LED is not set
1201# CONFIG_USB_CYPRESS_CY7C63 is not set 1068# CONFIG_USB_CYPRESS_CY7C63 is not set
1202# CONFIG_USB_CYTHERM is not set 1069# CONFIG_USB_CYTHERM is not set
@@ -1208,61 +1075,18 @@ CONFIG_USB_SISUSBVGA=m
1208CONFIG_USB_SISUSBVGA_CON=y 1075CONFIG_USB_SISUSBVGA_CON=y
1209# CONFIG_USB_LD is not set 1076# CONFIG_USB_LD is not set
1210# CONFIG_USB_TRANCEVIBRATOR is not set 1077# CONFIG_USB_TRANCEVIBRATOR is not set
1078# CONFIG_USB_IOWARRIOR is not set
1211# CONFIG_USB_TEST is not set 1079# CONFIG_USB_TEST is not set
1212 1080# CONFIG_USB_ISIGHTFW is not set
1213#
1214# USB DSL modem support
1215#
1216
1217#
1218# USB Gadget Support
1219#
1220# CONFIG_USB_GADGET is not set 1081# CONFIG_USB_GADGET is not set
1221
1222#
1223# MMC/SD Card support
1224#
1225# CONFIG_MMC is not set 1082# CONFIG_MMC is not set
1226 1083# CONFIG_MEMSTICK is not set
1227#
1228# LED devices
1229#
1230# CONFIG_NEW_LEDS is not set 1084# CONFIG_NEW_LEDS is not set
1231 1085# CONFIG_ACCESSIBILITY is not set
1232#
1233# LED drivers
1234#
1235
1236#
1237# LED Triggers
1238#
1239
1240#
1241# InfiniBand support
1242#
1243# CONFIG_INFINIBAND is not set 1086# CONFIG_INFINIBAND is not set
1244
1245#
1246# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1247#
1248
1249#
1250# Real Time Clock
1251#
1252# CONFIG_RTC_CLASS is not set 1087# CONFIG_RTC_CLASS is not set
1253 1088# CONFIG_DMADEVICES is not set
1254# 1089# CONFIG_UIO is not set
1255# DMA Engine support
1256#
1257# CONFIG_DMA_ENGINE is not set
1258
1259#
1260# DMA Clients
1261#
1262
1263#
1264# DMA Devices
1265#
1266 1090
1267# 1091#
1268# File systems 1092# File systems
@@ -1276,7 +1100,6 @@ CONFIG_EXT3_FS_XATTR=y
1276# CONFIG_EXT3_FS_SECURITY is not set 1100# CONFIG_EXT3_FS_SECURITY is not set
1277# CONFIG_EXT4DEV_FS is not set 1101# CONFIG_EXT4DEV_FS is not set
1278CONFIG_JBD=y 1102CONFIG_JBD=y
1279# CONFIG_JBD_DEBUG is not set
1280CONFIG_FS_MBCACHE=y 1103CONFIG_FS_MBCACHE=y
1281CONFIG_REISERFS_FS=y 1104CONFIG_REISERFS_FS=y
1282# CONFIG_REISERFS_CHECK is not set 1105# CONFIG_REISERFS_CHECK is not set
@@ -1285,14 +1108,11 @@ CONFIG_REISERFS_FS=y
1285# CONFIG_JFS_FS is not set 1108# CONFIG_JFS_FS is not set
1286# CONFIG_FS_POSIX_ACL is not set 1109# CONFIG_FS_POSIX_ACL is not set
1287# CONFIG_XFS_FS is not set 1110# CONFIG_XFS_FS is not set
1288# CONFIG_GFS2_FS is not set
1289# CONFIG_OCFS2_FS is not set 1111# CONFIG_OCFS2_FS is not set
1290# CONFIG_MINIX_FS is not set 1112CONFIG_DNOTIFY=y
1291CONFIG_ROMFS_FS=y
1292CONFIG_INOTIFY=y 1113CONFIG_INOTIFY=y
1293CONFIG_INOTIFY_USER=y 1114CONFIG_INOTIFY_USER=y
1294# CONFIG_QUOTA is not set 1115# CONFIG_QUOTA is not set
1295CONFIG_DNOTIFY=y
1296# CONFIG_AUTOFS_FS is not set 1116# CONFIG_AUTOFS_FS is not set
1297# CONFIG_AUTOFS4_FS is not set 1117# CONFIG_AUTOFS4_FS is not set
1298# CONFIG_FUSE_FS is not set 1118# CONFIG_FUSE_FS is not set
@@ -1328,7 +1148,6 @@ CONFIG_TMPFS=y
1328# CONFIG_TMPFS_POSIX_ACL is not set 1148# CONFIG_TMPFS_POSIX_ACL is not set
1329# CONFIG_HUGETLBFS is not set 1149# CONFIG_HUGETLBFS is not set
1330# CONFIG_HUGETLB_PAGE is not set 1150# CONFIG_HUGETLB_PAGE is not set
1331CONFIG_RAMFS=y
1332# CONFIG_CONFIGFS_FS is not set 1151# CONFIG_CONFIGFS_FS is not set
1333 1152
1334# 1153#
@@ -1343,26 +1162,24 @@ CONFIG_RAMFS=y
1343# CONFIG_EFS_FS is not set 1162# CONFIG_EFS_FS is not set
1344# CONFIG_CRAMFS is not set 1163# CONFIG_CRAMFS is not set
1345# CONFIG_VXFS_FS is not set 1164# CONFIG_VXFS_FS is not set
1165# CONFIG_MINIX_FS is not set
1166# CONFIG_OMFS_FS is not set
1346# CONFIG_HPFS_FS is not set 1167# CONFIG_HPFS_FS is not set
1347# CONFIG_QNX4FS_FS is not set 1168# CONFIG_QNX4FS_FS is not set
1169CONFIG_ROMFS_FS=y
1348# CONFIG_SYSV_FS is not set 1170# CONFIG_SYSV_FS is not set
1349CONFIG_UFS_FS=m 1171CONFIG_UFS_FS=m
1350# CONFIG_UFS_FS_WRITE is not set 1172# CONFIG_UFS_FS_WRITE is not set
1351# CONFIG_UFS_DEBUG is not set 1173# CONFIG_UFS_DEBUG is not set
1352 1174CONFIG_NETWORK_FILESYSTEMS=y
1353#
1354# Network File Systems
1355#
1356CONFIG_NFS_FS=m 1175CONFIG_NFS_FS=m
1357CONFIG_NFS_V3=y 1176CONFIG_NFS_V3=y
1358# CONFIG_NFS_V3_ACL is not set 1177# CONFIG_NFS_V3_ACL is not set
1359# CONFIG_NFS_V4 is not set 1178# CONFIG_NFS_V4 is not set
1360# CONFIG_NFS_DIRECTIO is not set
1361CONFIG_NFSD=m 1179CONFIG_NFSD=m
1362CONFIG_NFSD_V3=y 1180CONFIG_NFSD_V3=y
1363# CONFIG_NFSD_V3_ACL is not set 1181# CONFIG_NFSD_V3_ACL is not set
1364# CONFIG_NFSD_V4 is not set 1182# CONFIG_NFSD_V4 is not set
1365CONFIG_NFSD_TCP=y
1366CONFIG_LOCKD=m 1183CONFIG_LOCKD=m
1367CONFIG_LOCKD_V4=y 1184CONFIG_LOCKD_V4=y
1368CONFIG_EXPORTFS=m 1185CONFIG_EXPORTFS=m
@@ -1376,17 +1193,12 @@ CONFIG_SMB_FS=m
1376# CONFIG_NCP_FS is not set 1193# CONFIG_NCP_FS is not set
1377# CONFIG_CODA_FS is not set 1194# CONFIG_CODA_FS is not set
1378# CONFIG_AFS_FS is not set 1195# CONFIG_AFS_FS is not set
1379# CONFIG_9P_FS is not set
1380 1196
1381# 1197#
1382# Partition Types 1198# Partition Types
1383# 1199#
1384# CONFIG_PARTITION_ADVANCED is not set 1200# CONFIG_PARTITION_ADVANCED is not set
1385CONFIG_MSDOS_PARTITION=y 1201CONFIG_MSDOS_PARTITION=y
1386
1387#
1388# Native Language Support
1389#
1390CONFIG_NLS=y 1202CONFIG_NLS=y
1391CONFIG_NLS_DEFAULT="iso8859-1" 1203CONFIG_NLS_DEFAULT="iso8859-1"
1392CONFIG_NLS_CODEPAGE_437=y 1204CONFIG_NLS_CODEPAGE_437=y
@@ -1427,46 +1239,128 @@ CONFIG_NLS_CODEPAGE_932=y
1427# CONFIG_NLS_KOI8_R is not set 1239# CONFIG_NLS_KOI8_R is not set
1428# CONFIG_NLS_KOI8_U is not set 1240# CONFIG_NLS_KOI8_U is not set
1429# CONFIG_NLS_UTF8 is not set 1241# CONFIG_NLS_UTF8 is not set
1430 1242# CONFIG_DLM is not set
1431#
1432# Profiling support
1433#
1434# CONFIG_PROFILING is not set
1435 1243
1436# 1244#
1437# Kernel hacking 1245# Kernel hacking
1438# 1246#
1439CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1247CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1440# CONFIG_PRINTK_TIME is not set 1248# CONFIG_PRINTK_TIME is not set
1249CONFIG_ENABLE_WARN_DEPRECATED=y
1441CONFIG_ENABLE_MUST_CHECK=y 1250CONFIG_ENABLE_MUST_CHECK=y
1251CONFIG_FRAME_WARN=1024
1442# CONFIG_MAGIC_SYSRQ is not set 1252# CONFIG_MAGIC_SYSRQ is not set
1443# CONFIG_UNUSED_SYMBOLS is not set 1253# CONFIG_UNUSED_SYMBOLS is not set
1444# CONFIG_DEBUG_KERNEL is not set
1445CONFIG_LOG_BUF_SHIFT=14
1446# CONFIG_DEBUG_BUGVERBOSE is not set
1447# CONFIG_DEBUG_FS is not set 1254# CONFIG_DEBUG_FS is not set
1448# CONFIG_HEADERS_CHECK is not set 1255# CONFIG_HEADERS_CHECK is not set
1256# CONFIG_DEBUG_KERNEL is not set
1257# CONFIG_DEBUG_BUGVERBOSE is not set
1258# CONFIG_DEBUG_MEMORY_INIT is not set
1259# CONFIG_SAMPLES is not set
1449CONFIG_SH_STANDARD_BIOS=y 1260CONFIG_SH_STANDARD_BIOS=y
1450# CONFIG_EARLY_SCIF_CONSOLE is not set 1261# CONFIG_EARLY_SCIF_CONSOLE is not set
1451# CONFIG_EARLY_PRINTK is not set 1262# CONFIG_EARLY_PRINTK is not set
1452# CONFIG_KGDB is not set 1263# CONFIG_SH_KGDB is not set
1453 1264
1454# 1265#
1455# Security options 1266# Security options
1456# 1267#
1457# CONFIG_KEYS is not set 1268# CONFIG_KEYS is not set
1458# CONFIG_SECURITY is not set 1269# CONFIG_SECURITY is not set
1270# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1271CONFIG_CRYPTO=y
1272
1273#
1274# Crypto core or helper
1275#
1276# CONFIG_CRYPTO_MANAGER is not set
1277# CONFIG_CRYPTO_GF128MUL is not set
1278# CONFIG_CRYPTO_NULL is not set
1279# CONFIG_CRYPTO_CRYPTD is not set
1280# CONFIG_CRYPTO_AUTHENC is not set
1281# CONFIG_CRYPTO_TEST is not set
1282
1283#
1284# Authenticated Encryption with Associated Data
1285#
1286# CONFIG_CRYPTO_CCM is not set
1287# CONFIG_CRYPTO_GCM is not set
1288# CONFIG_CRYPTO_SEQIV is not set
1289
1290#
1291# Block modes
1292#
1293# CONFIG_CRYPTO_CBC is not set
1294# CONFIG_CRYPTO_CTR is not set
1295# CONFIG_CRYPTO_CTS is not set
1296# CONFIG_CRYPTO_ECB is not set
1297# CONFIG_CRYPTO_LRW is not set
1298# CONFIG_CRYPTO_PCBC is not set
1299# CONFIG_CRYPTO_XTS is not set
1300
1301#
1302# Hash modes
1303#
1304# CONFIG_CRYPTO_HMAC is not set
1305# CONFIG_CRYPTO_XCBC is not set
1306
1307#
1308# Digest
1309#
1310# CONFIG_CRYPTO_CRC32C is not set
1311# CONFIG_CRYPTO_MD4 is not set
1312# CONFIG_CRYPTO_MD5 is not set
1313# CONFIG_CRYPTO_MICHAEL_MIC is not set
1314# CONFIG_CRYPTO_RMD128 is not set
1315# CONFIG_CRYPTO_RMD160 is not set
1316# CONFIG_CRYPTO_RMD256 is not set
1317# CONFIG_CRYPTO_RMD320 is not set
1318# CONFIG_CRYPTO_SHA1 is not set
1319# CONFIG_CRYPTO_SHA256 is not set
1320# CONFIG_CRYPTO_SHA512 is not set
1321# CONFIG_CRYPTO_TGR192 is not set
1322# CONFIG_CRYPTO_WP512 is not set
1323
1324#
1325# Ciphers
1326#
1327# CONFIG_CRYPTO_AES is not set
1328# CONFIG_CRYPTO_ANUBIS is not set
1329# CONFIG_CRYPTO_ARC4 is not set
1330# CONFIG_CRYPTO_BLOWFISH is not set
1331# CONFIG_CRYPTO_CAMELLIA is not set
1332# CONFIG_CRYPTO_CAST5 is not set
1333# CONFIG_CRYPTO_CAST6 is not set
1334# CONFIG_CRYPTO_DES is not set
1335# CONFIG_CRYPTO_FCRYPT is not set
1336# CONFIG_CRYPTO_KHAZAD is not set
1337# CONFIG_CRYPTO_SALSA20 is not set
1338# CONFIG_CRYPTO_SEED is not set
1339# CONFIG_CRYPTO_SERPENT is not set
1340# CONFIG_CRYPTO_TEA is not set
1341# CONFIG_CRYPTO_TWOFISH is not set
1459 1342
1460# 1343#
1461# Cryptographic options 1344# Compression
1462# 1345#
1463# CONFIG_CRYPTO is not set 1346# CONFIG_CRYPTO_DEFLATE is not set
1347# CONFIG_CRYPTO_LZO is not set
1348CONFIG_CRYPTO_HW=y
1349# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1464 1350
1465# 1351#
1466# Library routines 1352# Library routines
1467# 1353#
1354CONFIG_BITREVERSE=y
1355# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1468# CONFIG_CRC_CCITT is not set 1356# CONFIG_CRC_CCITT is not set
1469# CONFIG_CRC16 is not set 1357# CONFIG_CRC16 is not set
1358CONFIG_CRC_T10DIF=y
1359# CONFIG_CRC_ITU_T is not set
1470CONFIG_CRC32=y 1360CONFIG_CRC32=y
1361# CONFIG_CRC7 is not set
1471# CONFIG_LIBCRC32C is not set 1362# CONFIG_LIBCRC32C is not set
1472CONFIG_PLIST=y 1363CONFIG_PLIST=y
1364CONFIG_HAS_IOMEM=y
1365CONFIG_HAS_IOPORT=y
1366CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/lboxre2_defconfig b/arch/sh/configs/lboxre2_defconfig
index b68b6cdbb78f..aecdfd33c695 100644
--- a/arch/sh/configs/lboxre2_defconfig
+++ b/arch/sh/configs/lboxre2_defconfig
@@ -1,9 +1,11 @@
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-rc4 3# Linux kernel version: 2.6.26
4# Sat Mar 24 22:04:27 2007 4# Wed Jul 30 01:39:41 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
9CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -11,37 +13,40 @@ CONFIG_GENERIC_HWEIGHT=y
11CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
12CONFIG_GENERIC_IRQ_PROBE=y 14CONFIG_GENERIC_IRQ_PROBE=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 15CONFIG_GENERIC_CALIBRATE_DELAY=y
14# CONFIG_GENERIC_TIME is not set 16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_CLOCKEVENTS=y
18CONFIG_SYS_SUPPORTS_PCI=y
15CONFIG_STACKTRACE_SUPPORT=y 19CONFIG_STACKTRACE_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y 20CONFIG_LOCKDEP_SUPPORT=y
17# CONFIG_ARCH_HAS_ILOG2_U32 is not set 21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
18# CONFIG_ARCH_HAS_ILOG2_U64 is not set 22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_ARCH_NO_VIRT_TO_BUS=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
20 26
21# 27#
22# Code maturity level options 28# General setup
23# 29#
24CONFIG_EXPERIMENTAL=y 30CONFIG_EXPERIMENTAL=y
25CONFIG_BROKEN_ON_SMP=y 31CONFIG_BROKEN_ON_SMP=y
26CONFIG_INIT_ENV_ARG_LIMIT=32 32CONFIG_INIT_ENV_ARG_LIMIT=32
27
28#
29# General setup
30#
31CONFIG_LOCALVERSION="" 33CONFIG_LOCALVERSION=""
32CONFIG_LOCALVERSION_AUTO=y 34CONFIG_LOCALVERSION_AUTO=y
33CONFIG_SWAP=y 35CONFIG_SWAP=y
34CONFIG_SYSVIPC=y 36CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set
36CONFIG_SYSVIPC_SYSCTL=y 37CONFIG_SYSVIPC_SYSCTL=y
37# CONFIG_POSIX_MQUEUE is not set 38# CONFIG_POSIX_MQUEUE is not set
38# CONFIG_BSD_PROCESS_ACCT is not set 39# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set 40# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set
41# CONFIG_AUDIT is not set 41# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 42# CONFIG_IKCONFIG is not set
43CONFIG_LOG_BUF_SHIFT=14
44# CONFIG_CGROUPS is not set
45# CONFIG_GROUP_SCHED is not set
43CONFIG_SYSFS_DEPRECATED=y 46CONFIG_SYSFS_DEPRECATED=y
47CONFIG_SYSFS_DEPRECATED_V2=y
44# CONFIG_RELAY is not set 48# CONFIG_RELAY is not set
49# CONFIG_NAMESPACES is not set
45# CONFIG_BLK_DEV_INITRD is not set 50# CONFIG_BLK_DEV_INITRD is not set
46CONFIG_CC_OPTIMIZE_FOR_SIZE=y 51CONFIG_CC_OPTIMIZE_FOR_SIZE=y
47CONFIG_SYSCTL=y 52CONFIG_SYSCTL=y
@@ -54,34 +59,48 @@ CONFIG_HOTPLUG=y
54CONFIG_PRINTK=y 59CONFIG_PRINTK=y
55CONFIG_BUG=y 60CONFIG_BUG=y
56CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
62CONFIG_COMPAT_BRK=y
57CONFIG_BASE_FULL=y 63CONFIG_BASE_FULL=y
58CONFIG_FUTEX=y 64CONFIG_FUTEX=y
65CONFIG_ANON_INODES=y
59CONFIG_EPOLL=y 66CONFIG_EPOLL=y
67CONFIG_SIGNALFD=y
68CONFIG_TIMERFD=y
69CONFIG_EVENTFD=y
60CONFIG_SHMEM=y 70CONFIG_SHMEM=y
61CONFIG_SLAB=y
62CONFIG_VM_EVENT_COUNTERS=y 71CONFIG_VM_EVENT_COUNTERS=y
72CONFIG_SLAB=y
73# CONFIG_SLUB is not set
74# CONFIG_SLOB is not set
75# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set
77CONFIG_HAVE_OPROFILE=y
78# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
79# CONFIG_HAVE_IOREMAP_PROT is not set
80# CONFIG_HAVE_KPROBES is not set
81# CONFIG_HAVE_KRETPROBES is not set
82# CONFIG_HAVE_ARCH_TRACEHOOK is not set
83# CONFIG_HAVE_DMA_ATTRS is not set
84# CONFIG_USE_GENERIC_SMP_HELPERS is not set
85CONFIG_HAVE_CLK=y
86CONFIG_PROC_PAGE_MONITOR=y
87CONFIG_SLABINFO=y
63CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
64# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
65CONFIG_BASE_SMALL=0 90CONFIG_BASE_SMALL=0
66# CONFIG_SLOB is not set
67
68#
69# Loadable module support
70#
71CONFIG_MODULES=y 91CONFIG_MODULES=y
92# CONFIG_MODULE_FORCE_LOAD is not set
72CONFIG_MODULE_UNLOAD=y 93CONFIG_MODULE_UNLOAD=y
73CONFIG_MODULE_FORCE_UNLOAD=y 94CONFIG_MODULE_FORCE_UNLOAD=y
74# CONFIG_MODVERSIONS is not set 95# CONFIG_MODVERSIONS is not set
75# CONFIG_MODULE_SRCVERSION_ALL is not set 96# CONFIG_MODULE_SRCVERSION_ALL is not set
76CONFIG_KMOD=y 97CONFIG_KMOD=y
77
78#
79# Block layer
80#
81CONFIG_BLOCK=y 98CONFIG_BLOCK=y
82# CONFIG_LBD is not set 99# CONFIG_LBD is not set
83# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
84# CONFIG_LSF is not set 101# CONFIG_LSF is not set
102# CONFIG_BLK_DEV_BSG is not set
103# CONFIG_BLK_DEV_INTEGRITY is not set
85 104
86# 105#
87# IO Schedulers 106# IO Schedulers
@@ -95,66 +114,26 @@ CONFIG_DEFAULT_AS=y
95# CONFIG_DEFAULT_CFQ is not set 114# CONFIG_DEFAULT_CFQ is not set
96# CONFIG_DEFAULT_NOOP is not set 115# CONFIG_DEFAULT_NOOP is not set
97CONFIG_DEFAULT_IOSCHED="anticipatory" 116CONFIG_DEFAULT_IOSCHED="anticipatory"
117CONFIG_CLASSIC_RCU=y
98 118
99# 119#
100# System type 120# System type
101# 121#
102# CONFIG_SH_SOLUTION_ENGINE is not set
103# CONFIG_SH_7751_SOLUTION_ENGINE is not set
104# CONFIG_SH_7300_SOLUTION_ENGINE is not set
105# CONFIG_SH_7343_SOLUTION_ENGINE is not set
106# CONFIG_SH_73180_SOLUTION_ENGINE is not set
107# CONFIG_SH_7751_SYSTEMH is not set
108# CONFIG_SH_HP6XX is not set
109# CONFIG_SH_SATURN is not set
110# CONFIG_SH_DREAMCAST is not set
111# CONFIG_SH_MPC1211 is not set
112# CONFIG_SH_SH03 is not set
113# CONFIG_SH_SECUREEDGE5410 is not set
114# CONFIG_SH_HS7751RVOIP is not set
115# CONFIG_SH_7710VOIPGW is not set
116# CONFIG_SH_RTS7751R2D is not set
117# CONFIG_SH_HIGHLANDER is not set
118# CONFIG_SH_EDOSK7705 is not set
119# CONFIG_SH_SH4202_MICRODEV is not set
120# CONFIG_SH_LANDISK is not set
121# CONFIG_SH_TITAN is not set
122# CONFIG_SH_SHMIN is not set
123# CONFIG_SH_7206_SOLUTION_ENGINE is not set
124# CONFIG_SH_7619_SOLUTION_ENGINE is not set
125CONFIG_SH_LBOX_RE2=y
126# CONFIG_SH_UNKNOWN is not set
127
128#
129# Processor selection
130#
131CONFIG_CPU_SH4=y 122CONFIG_CPU_SH4=y
132
133#
134# SH-2 Processor Support
135#
136# CONFIG_CPU_SUBTYPE_SH7604 is not set
137# CONFIG_CPU_SUBTYPE_SH7619 is not set 123# CONFIG_CPU_SUBTYPE_SH7619 is not set
138 124# CONFIG_CPU_SUBTYPE_SH7203 is not set
139#
140# SH-2A Processor Support
141#
142# CONFIG_CPU_SUBTYPE_SH7206 is not set 125# CONFIG_CPU_SUBTYPE_SH7206 is not set
143 126# CONFIG_CPU_SUBTYPE_SH7263 is not set
144# 127# CONFIG_CPU_SUBTYPE_MXG is not set
145# SH-3 Processor Support
146#
147# CONFIG_CPU_SUBTYPE_SH7300 is not set
148# CONFIG_CPU_SUBTYPE_SH7705 is not set 128# CONFIG_CPU_SUBTYPE_SH7705 is not set
149# CONFIG_CPU_SUBTYPE_SH7706 is not set 129# CONFIG_CPU_SUBTYPE_SH7706 is not set
150# CONFIG_CPU_SUBTYPE_SH7707 is not set 130# CONFIG_CPU_SUBTYPE_SH7707 is not set
151# CONFIG_CPU_SUBTYPE_SH7708 is not set 131# CONFIG_CPU_SUBTYPE_SH7708 is not set
152# CONFIG_CPU_SUBTYPE_SH7709 is not set 132# CONFIG_CPU_SUBTYPE_SH7709 is not set
153# CONFIG_CPU_SUBTYPE_SH7710 is not set 133# CONFIG_CPU_SUBTYPE_SH7710 is not set
154 134# CONFIG_CPU_SUBTYPE_SH7712 is not set
155# 135# CONFIG_CPU_SUBTYPE_SH7720 is not set
156# SH-4 Processor Support 136# CONFIG_CPU_SUBTYPE_SH7721 is not set
157#
158# CONFIG_CPU_SUBTYPE_SH7750 is not set 137# CONFIG_CPU_SUBTYPE_SH7750 is not set
159# CONFIG_CPU_SUBTYPE_SH7091 is not set 138# CONFIG_CPU_SUBTYPE_SH7091 is not set
160# CONFIG_CPU_SUBTYPE_SH7750R is not set 139# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -163,55 +142,60 @@ CONFIG_CPU_SH4=y
163CONFIG_CPU_SUBTYPE_SH7751R=y 142CONFIG_CPU_SUBTYPE_SH7751R=y
164# CONFIG_CPU_SUBTYPE_SH7760 is not set 143# CONFIG_CPU_SUBTYPE_SH7760 is not set
165# CONFIG_CPU_SUBTYPE_SH4_202 is not set 144# CONFIG_CPU_SUBTYPE_SH4_202 is not set
166 145# CONFIG_CPU_SUBTYPE_SH7723 is not set
167# 146# CONFIG_CPU_SUBTYPE_SH7763 is not set
168# ST40 Processor Support
169#
170# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
171# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
172
173#
174# SH-4A Processor Support
175#
176# CONFIG_CPU_SUBTYPE_SH7770 is not set 147# CONFIG_CPU_SUBTYPE_SH7770 is not set
177# CONFIG_CPU_SUBTYPE_SH7780 is not set 148# CONFIG_CPU_SUBTYPE_SH7780 is not set
178# CONFIG_CPU_SUBTYPE_SH7785 is not set 149# CONFIG_CPU_SUBTYPE_SH7785 is not set
179 150# CONFIG_CPU_SUBTYPE_SHX3 is not set
180#
181# SH4AL-DSP Processor Support
182#
183# CONFIG_CPU_SUBTYPE_SH73180 is not set
184# CONFIG_CPU_SUBTYPE_SH7343 is not set 151# CONFIG_CPU_SUBTYPE_SH7343 is not set
185# CONFIG_CPU_SUBTYPE_SH7722 is not set 152# CONFIG_CPU_SUBTYPE_SH7722 is not set
153# CONFIG_CPU_SUBTYPE_SH7366 is not set
154# CONFIG_CPU_SUBTYPE_SH5_101 is not set
155# CONFIG_CPU_SUBTYPE_SH5_103 is not set
186 156
187# 157#
188# Memory management options 158# Memory management options
189# 159#
160CONFIG_QUICKLIST=y
190CONFIG_MMU=y 161CONFIG_MMU=y
191CONFIG_PAGE_OFFSET=0x80000000 162CONFIG_PAGE_OFFSET=0x80000000
192CONFIG_MEMORY_START=0x0c000000 163CONFIG_MEMORY_START=0x0c000000
193CONFIG_MEMORY_SIZE=0x04000000 164CONFIG_MEMORY_SIZE=0x04000000
165CONFIG_29BIT=y
194CONFIG_VSYSCALL=y 166CONFIG_VSYSCALL=y
167CONFIG_ARCH_FLATMEM_ENABLE=y
168CONFIG_ARCH_SPARSEMEM_ENABLE=y
169CONFIG_ARCH_SPARSEMEM_DEFAULT=y
170CONFIG_MAX_ACTIVE_REGIONS=1
171CONFIG_ARCH_POPULATES_NODE_MAP=y
172CONFIG_ARCH_SELECT_MEMORY_MODEL=y
195CONFIG_PAGE_SIZE_4KB=y 173CONFIG_PAGE_SIZE_4KB=y
196# CONFIG_PAGE_SIZE_8KB is not set 174# CONFIG_PAGE_SIZE_8KB is not set
175# CONFIG_PAGE_SIZE_16KB is not set
197# CONFIG_PAGE_SIZE_64KB is not set 176# CONFIG_PAGE_SIZE_64KB is not set
177CONFIG_ENTRY_OFFSET=0x00001000
198CONFIG_SELECT_MEMORY_MODEL=y 178CONFIG_SELECT_MEMORY_MODEL=y
199CONFIG_FLATMEM_MANUAL=y 179CONFIG_FLATMEM_MANUAL=y
200# CONFIG_DISCONTIGMEM_MANUAL is not set 180# CONFIG_DISCONTIGMEM_MANUAL is not set
201# CONFIG_SPARSEMEM_MANUAL is not set 181# CONFIG_SPARSEMEM_MANUAL is not set
202CONFIG_FLATMEM=y 182CONFIG_FLATMEM=y
203CONFIG_FLAT_NODE_MEM_MAP=y 183CONFIG_FLAT_NODE_MEM_MAP=y
204# CONFIG_SPARSEMEM_STATIC is not set 184CONFIG_SPARSEMEM_STATIC=y
185# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
186CONFIG_PAGEFLAGS_EXTENDED=y
205CONFIG_SPLIT_PTLOCK_CPUS=4 187CONFIG_SPLIT_PTLOCK_CPUS=4
206# CONFIG_RESOURCES_64BIT is not set 188# CONFIG_RESOURCES_64BIT is not set
207CONFIG_ZONE_DMA_FLAG=0 189CONFIG_ZONE_DMA_FLAG=0
190CONFIG_NR_QUICK=2
208 191
209# 192#
210# Cache configuration 193# Cache configuration
211# 194#
212# CONFIG_SH_DIRECT_MAPPED is not set 195# CONFIG_SH_DIRECT_MAPPED is not set
213# CONFIG_SH_WRITETHROUGH is not set 196CONFIG_CACHE_WRITEBACK=y
214# CONFIG_SH_OCRAM is not set 197# CONFIG_CACHE_WRITETHROUGH is not set
198# CONFIG_CACHE_OFF is not set
215 199
216# 200#
217# Processor features 201# Processor features
@@ -219,12 +203,21 @@ CONFIG_ZONE_DMA_FLAG=0
219CONFIG_CPU_LITTLE_ENDIAN=y 203CONFIG_CPU_LITTLE_ENDIAN=y
220# CONFIG_CPU_BIG_ENDIAN is not set 204# CONFIG_CPU_BIG_ENDIAN is not set
221CONFIG_SH_FPU=y 205CONFIG_SH_FPU=y
222# CONFIG_SH_DSP is not set
223# CONFIG_SH_STORE_QUEUES is not set 206# CONFIG_SH_STORE_QUEUES is not set
224CONFIG_CPU_HAS_INTEVT=y 207CONFIG_CPU_HAS_INTEVT=y
225CONFIG_CPU_HAS_INTC_IRQ=y
226CONFIG_CPU_HAS_SR_RB=y 208CONFIG_CPU_HAS_SR_RB=y
227CONFIG_CPU_HAS_PTEA=y 209CONFIG_CPU_HAS_PTEA=y
210CONFIG_CPU_HAS_FPU=y
211
212#
213# Board support
214#
215# CONFIG_SH_7751_SYSTEMH is not set
216# CONFIG_SH_SECUREEDGE5410 is not set
217# CONFIG_SH_RTS7751R2D is not set
218# CONFIG_SH_LANDISK is not set
219# CONFIG_SH_TITAN is not set
220CONFIG_SH_LBOX_RE2=y
228 221
229# 222#
230# Timer and clock configuration 223# Timer and clock configuration
@@ -232,6 +225,10 @@ CONFIG_CPU_HAS_PTEA=y
232CONFIG_SH_TMU=y 225CONFIG_SH_TMU=y
233CONFIG_SH_TIMER_IRQ=16 226CONFIG_SH_TIMER_IRQ=16
234CONFIG_SH_PCLK_FREQ=40000000 227CONFIG_SH_PCLK_FREQ=40000000
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
235 232
236# 233#
237# CPU Frequency scaling 234# CPU Frequency scaling
@@ -246,7 +243,6 @@ CONFIG_SH_PCLK_FREQ=40000000
246# 243#
247# Companion Chips 244# Companion Chips
248# 245#
249# CONFIG_HD6446X_SERIES is not set
250 246
251# 247#
252# Additional SuperH Device Drivers 248# Additional SuperH Device Drivers
@@ -262,11 +258,14 @@ CONFIG_HZ_250=y
262# CONFIG_HZ_300 is not set 258# CONFIG_HZ_300 is not set
263# CONFIG_HZ_1000 is not set 259# CONFIG_HZ_1000 is not set
264CONFIG_HZ=250 260CONFIG_HZ=250
261# CONFIG_SCHED_HRTICK is not set
265CONFIG_KEXEC=y 262CONFIG_KEXEC=y
266# CONFIG_SMP is not set 263# CONFIG_CRASH_DUMP is not set
267CONFIG_PREEMPT_NONE=y 264CONFIG_PREEMPT_NONE=y
268# CONFIG_PREEMPT_VOLUNTARY is not set 265# CONFIG_PREEMPT_VOLUNTARY is not set
269# CONFIG_PREEMPT is not set 266# CONFIG_PREEMPT is not set
267CONFIG_GUSA=y
268# CONFIG_GUSA_RB is not set
270 269
271# 270#
272# Boot options 271# Boot options
@@ -280,15 +279,12 @@ CONFIG_CMDLINE="console=ttySC1,115200 root=/dev/sda1"
280# 279#
281# Bus options 280# Bus options
282# 281#
283CONFIG_ISA=y
284CONFIG_PCI=y 282CONFIG_PCI=y
285CONFIG_SH_PCIDMA_NONCOHERENT=y 283CONFIG_SH_PCIDMA_NONCOHERENT=y
286CONFIG_PCI_AUTO=y 284CONFIG_PCI_AUTO=y
287CONFIG_PCI_AUTO_UPDATE_RESOURCES=y 285CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
288 286# CONFIG_ARCH_SUPPORTS_MSI is not set
289# 287CONFIG_PCI_LEGACY=y
290# PCCARD (PCMCIA/CardBus) support
291#
292CONFIG_PCCARD=y 288CONFIG_PCCARD=y
293CONFIG_PCMCIA_DEBUG=y 289CONFIG_PCMCIA_DEBUG=y
294CONFIG_PCMCIA=y 290CONFIG_PCMCIA=y
@@ -306,29 +302,16 @@ CONFIG_YENTA_O2=y
306# CONFIG_YENTA_TOSHIBA is not set 302# CONFIG_YENTA_TOSHIBA is not set
307# CONFIG_PD6729 is not set 303# CONFIG_PD6729 is not set
308# CONFIG_I82092 is not set 304# CONFIG_I82092 is not set
309# CONFIG_I82365 is not set
310# CONFIG_TCIC is not set
311CONFIG_PCMCIA_PROBE=y
312CONFIG_PCCARD_NONSTATIC=y 305CONFIG_PCCARD_NONSTATIC=y
313
314#
315# PCI Hotplug Support
316#
317# CONFIG_HOTPLUG_PCI is not set 306# CONFIG_HOTPLUG_PCI is not set
318 307
319# 308#
320# Executable file formats 309# Executable file formats
321# 310#
322CONFIG_BINFMT_ELF=y 311CONFIG_BINFMT_ELF=y
323# CONFIG_BINFMT_FLAT is not set
324# CONFIG_BINFMT_MISC is not set 312# CONFIG_BINFMT_MISC is not set
325 313
326# 314#
327# Power management options (EXPERIMENTAL)
328#
329# CONFIG_PM is not set
330
331#
332# Networking 315# Networking
333# 316#
334CONFIG_NET=y 317CONFIG_NET=y
@@ -336,7 +319,6 @@ CONFIG_NET=y
336# 319#
337# Networking options 320# Networking options
338# 321#
339# CONFIG_NETDEBUG is not set
340CONFIG_PACKET=y 322CONFIG_PACKET=y
341# CONFIG_PACKET_MMAP is not set 323# CONFIG_PACKET_MMAP is not set
342CONFIG_UNIX=y 324CONFIG_UNIX=y
@@ -344,6 +326,7 @@ CONFIG_XFRM=y
344# CONFIG_XFRM_USER is not set 326# CONFIG_XFRM_USER is not set
345# CONFIG_XFRM_SUB_POLICY is not set 327# CONFIG_XFRM_SUB_POLICY is not set
346# CONFIG_XFRM_MIGRATE is not set 328# CONFIG_XFRM_MIGRATE is not set
329# CONFIG_XFRM_STATISTICS is not set
347# CONFIG_NET_KEY is not set 330# CONFIG_NET_KEY is not set
348CONFIG_INET=y 331CONFIG_INET=y
349# CONFIG_IP_MULTICAST is not set 332# CONFIG_IP_MULTICAST is not set
@@ -370,29 +353,26 @@ CONFIG_IP_PNP=y
370CONFIG_INET_XFRM_MODE_TRANSPORT=y 353CONFIG_INET_XFRM_MODE_TRANSPORT=y
371CONFIG_INET_XFRM_MODE_TUNNEL=y 354CONFIG_INET_XFRM_MODE_TUNNEL=y
372CONFIG_INET_XFRM_MODE_BEET=y 355CONFIG_INET_XFRM_MODE_BEET=y
356# CONFIG_INET_LRO is not set
373CONFIG_INET_DIAG=y 357CONFIG_INET_DIAG=y
374CONFIG_INET_TCP_DIAG=y 358CONFIG_INET_TCP_DIAG=y
375# CONFIG_TCP_CONG_ADVANCED is not set 359# CONFIG_TCP_CONG_ADVANCED is not set
376CONFIG_TCP_CONG_CUBIC=y 360CONFIG_TCP_CONG_CUBIC=y
377CONFIG_DEFAULT_TCP_CONG="cubic" 361CONFIG_DEFAULT_TCP_CONG="cubic"
378# CONFIG_TCP_MD5SIG is not set 362# CONFIG_TCP_MD5SIG is not set
379
380#
381# IP: Virtual Server Configuration
382#
383# CONFIG_IP_VS is not set 363# CONFIG_IP_VS is not set
384# CONFIG_IPV6 is not set 364# CONFIG_IPV6 is not set
385# CONFIG_INET6_XFRM_TUNNEL is not set
386# CONFIG_INET6_TUNNEL is not set
387# CONFIG_NETWORK_SECMARK is not set 365# CONFIG_NETWORK_SECMARK is not set
388CONFIG_NETFILTER=y 366CONFIG_NETFILTER=y
389# CONFIG_NETFILTER_DEBUG is not set 367# CONFIG_NETFILTER_DEBUG is not set
368CONFIG_NETFILTER_ADVANCED=y
390 369
391# 370#
392# Core Netfilter Configuration 371# Core Netfilter Configuration
393# 372#
394# CONFIG_NETFILTER_NETLINK is not set 373# CONFIG_NETFILTER_NETLINK_QUEUE is not set
395# CONFIG_NF_CONNTRACK_ENABLED is not set 374# CONFIG_NETFILTER_NETLINK_LOG is not set
375# CONFIG_NF_CONNTRACK is not set
396# CONFIG_NETFILTER_XTABLES is not set 376# CONFIG_NETFILTER_XTABLES is not set
397 377
398# 378#
@@ -401,20 +381,8 @@ CONFIG_NETFILTER=y
401# CONFIG_IP_NF_QUEUE is not set 381# CONFIG_IP_NF_QUEUE is not set
402# CONFIG_IP_NF_IPTABLES is not set 382# CONFIG_IP_NF_IPTABLES is not set
403# CONFIG_IP_NF_ARPTABLES is not set 383# CONFIG_IP_NF_ARPTABLES is not set
404
405#
406# DCCP Configuration (EXPERIMENTAL)
407#
408# CONFIG_IP_DCCP is not set 384# CONFIG_IP_DCCP is not set
409
410#
411# SCTP Configuration (EXPERIMENTAL)
412#
413# CONFIG_IP_SCTP is not set 385# CONFIG_IP_SCTP is not set
414
415#
416# TIPC Configuration (EXPERIMENTAL)
417#
418# CONFIG_TIPC is not set 386# CONFIG_TIPC is not set
419# CONFIG_ATM is not set 387# CONFIG_ATM is not set
420# CONFIG_BRIDGE is not set 388# CONFIG_BRIDGE is not set
@@ -427,10 +395,6 @@ CONFIG_NETFILTER=y
427# CONFIG_LAPB is not set 395# CONFIG_LAPB is not set
428# CONFIG_ECONET is not set 396# CONFIG_ECONET is not set
429# CONFIG_WAN_ROUTER is not set 397# CONFIG_WAN_ROUTER is not set
430
431#
432# QoS and/or fair queueing
433#
434# CONFIG_NET_SCHED is not set 398# CONFIG_NET_SCHED is not set
435 399
436# 400#
@@ -438,9 +402,20 @@ CONFIG_NETFILTER=y
438# 402#
439# CONFIG_NET_PKTGEN is not set 403# CONFIG_NET_PKTGEN is not set
440# CONFIG_HAMRADIO is not set 404# CONFIG_HAMRADIO is not set
405# CONFIG_CAN is not set
441# CONFIG_IRDA is not set 406# CONFIG_IRDA is not set
442# CONFIG_BT is not set 407# CONFIG_BT is not set
408# CONFIG_AF_RXRPC is not set
409
410#
411# Wireless
412#
413# CONFIG_CFG80211 is not set
414# CONFIG_WIRELESS_EXT is not set
415# CONFIG_MAC80211 is not set
443# CONFIG_IEEE80211 is not set 416# CONFIG_IEEE80211 is not set
417# CONFIG_RFKILL is not set
418# CONFIG_NET_9P is not set
444 419
445# 420#
446# Device Drivers 421# Device Drivers
@@ -449,36 +424,17 @@ CONFIG_NETFILTER=y
449# 424#
450# Generic Driver Options 425# Generic Driver Options
451# 426#
427CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
452CONFIG_STANDALONE=y 428CONFIG_STANDALONE=y
453CONFIG_PREVENT_FIRMWARE_BUILD=y 429CONFIG_PREVENT_FIRMWARE_BUILD=y
454CONFIG_FW_LOADER=y 430CONFIG_FW_LOADER=y
431CONFIG_FIRMWARE_IN_KERNEL=y
432CONFIG_EXTRA_FIRMWARE=""
455# CONFIG_SYS_HYPERVISOR is not set 433# CONFIG_SYS_HYPERVISOR is not set
456
457#
458# Connector - unified userspace <-> kernelspace linker
459#
460# CONFIG_CONNECTOR is not set 434# CONFIG_CONNECTOR is not set
461
462#
463# Memory Technology Devices (MTD)
464#
465# CONFIG_MTD is not set 435# CONFIG_MTD is not set
466
467#
468# Parallel port support
469#
470# CONFIG_PARPORT is not set 436# CONFIG_PARPORT is not set
471 437CONFIG_BLK_DEV=y
472#
473# Plug and Play support
474#
475# CONFIG_PNP is not set
476# CONFIG_PNPACPI is not set
477
478#
479# Block devices
480#
481# CONFIG_BLK_CPQ_DA is not set
482# CONFIG_BLK_CPQ_CISS_DA is not set 438# CONFIG_BLK_CPQ_CISS_DA is not set
483# CONFIG_BLK_DEV_DAC960 is not set 439# CONFIG_BLK_DEV_DAC960 is not set
484# CONFIG_BLK_DEV_UMEM is not set 440# CONFIG_BLK_DEV_UMEM is not set
@@ -490,19 +446,18 @@ CONFIG_BLK_DEV_LOOP=y
490CONFIG_BLK_DEV_RAM=y 446CONFIG_BLK_DEV_RAM=y
491CONFIG_BLK_DEV_RAM_COUNT=16 447CONFIG_BLK_DEV_RAM_COUNT=16
492CONFIG_BLK_DEV_RAM_SIZE=4096 448CONFIG_BLK_DEV_RAM_SIZE=4096
493CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 449# CONFIG_BLK_DEV_XIP is not set
494# CONFIG_CDROM_PKTCDVD is not set 450# CONFIG_CDROM_PKTCDVD is not set
495# CONFIG_ATA_OVER_ETH is not set 451# CONFIG_ATA_OVER_ETH is not set
496 452# CONFIG_BLK_DEV_HD is not set
497# 453CONFIG_MISC_DEVICES=y
498# Misc devices 454# CONFIG_PHANTOM is not set
499# 455# CONFIG_EEPROM_93CX6 is not set
500# CONFIG_SGI_IOC4 is not set 456# CONFIG_SGI_IOC4 is not set
501# CONFIG_TIFM_CORE is not set 457# CONFIG_TIFM_CORE is not set
502 458# CONFIG_ENCLOSURE_SERVICES is not set
503# 459# CONFIG_HP_ILO is not set
504# ATA/ATAPI/MFM/RLL support 460CONFIG_HAVE_IDE=y
505#
506# CONFIG_IDE is not set 461# CONFIG_IDE is not set
507 462
508# 463#
@@ -510,6 +465,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
510# 465#
511# CONFIG_RAID_ATTRS is not set 466# CONFIG_RAID_ATTRS is not set
512CONFIG_SCSI=y 467CONFIG_SCSI=y
468CONFIG_SCSI_DMA=y
513# CONFIG_SCSI_TGT is not set 469# CONFIG_SCSI_TGT is not set
514# CONFIG_SCSI_NETLINK is not set 470# CONFIG_SCSI_NETLINK is not set
515CONFIG_SCSI_PROC_FS=y 471CONFIG_SCSI_PROC_FS=y
@@ -531,6 +487,7 @@ CONFIG_BLK_DEV_SD=y
531# CONFIG_SCSI_CONSTANTS is not set 487# CONFIG_SCSI_CONSTANTS is not set
532# CONFIG_SCSI_LOGGING is not set 488# CONFIG_SCSI_LOGGING is not set
533# CONFIG_SCSI_SCAN_ASYNC is not set 489# CONFIG_SCSI_SCAN_ASYNC is not set
490CONFIG_SCSI_WAIT_SCAN=m
534 491
535# 492#
536# SCSI Transports 493# SCSI Transports
@@ -538,71 +495,49 @@ CONFIG_BLK_DEV_SD=y
538# CONFIG_SCSI_SPI_ATTRS is not set 495# CONFIG_SCSI_SPI_ATTRS is not set
539# CONFIG_SCSI_FC_ATTRS is not set 496# CONFIG_SCSI_FC_ATTRS is not set
540# CONFIG_SCSI_ISCSI_ATTRS is not set 497# CONFIG_SCSI_ISCSI_ATTRS is not set
541# CONFIG_SCSI_SAS_ATTRS is not set
542# CONFIG_SCSI_SAS_LIBSAS is not set 498# CONFIG_SCSI_SAS_LIBSAS is not set
543 499# CONFIG_SCSI_SRP_ATTRS is not set
544# 500CONFIG_SCSI_LOWLEVEL=y
545# SCSI low-level drivers
546#
547# CONFIG_ISCSI_TCP is not set 501# CONFIG_ISCSI_TCP is not set
548# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 502# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
549# CONFIG_SCSI_3W_9XXX is not set 503# CONFIG_SCSI_3W_9XXX is not set
550# CONFIG_SCSI_ACARD is not set 504# CONFIG_SCSI_ACARD is not set
551# CONFIG_SCSI_AHA152X is not set
552# CONFIG_SCSI_AACRAID is not set 505# CONFIG_SCSI_AACRAID is not set
553# CONFIG_SCSI_AIC7XXX is not set 506# CONFIG_SCSI_AIC7XXX is not set
554# CONFIG_SCSI_AIC7XXX_OLD is not set 507# CONFIG_SCSI_AIC7XXX_OLD is not set
555# CONFIG_SCSI_AIC79XX is not set 508# CONFIG_SCSI_AIC79XX is not set
556# CONFIG_SCSI_AIC94XX is not set 509# CONFIG_SCSI_AIC94XX is not set
557# CONFIG_SCSI_DPT_I2O is not set
558# CONFIG_SCSI_IN2000 is not set
559# CONFIG_SCSI_ARCMSR is not set 510# CONFIG_SCSI_ARCMSR is not set
560# CONFIG_MEGARAID_NEWGEN is not set 511# CONFIG_MEGARAID_NEWGEN is not set
561# CONFIG_MEGARAID_LEGACY is not set 512# CONFIG_MEGARAID_LEGACY is not set
562# CONFIG_MEGARAID_SAS is not set 513# CONFIG_MEGARAID_SAS is not set
563# CONFIG_SCSI_HPTIOP is not set 514# CONFIG_SCSI_HPTIOP is not set
564# CONFIG_SCSI_DMX3191D is not set 515# CONFIG_SCSI_DMX3191D is not set
565# CONFIG_SCSI_DTC3280 is not set
566# CONFIG_SCSI_FUTURE_DOMAIN is not set 516# CONFIG_SCSI_FUTURE_DOMAIN is not set
567# CONFIG_SCSI_GENERIC_NCR5380 is not set
568# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
569# CONFIG_SCSI_IPS is not set 517# CONFIG_SCSI_IPS is not set
570# CONFIG_SCSI_INITIO is not set 518# CONFIG_SCSI_INITIO is not set
571# CONFIG_SCSI_INIA100 is not set 519# CONFIG_SCSI_INIA100 is not set
572# CONFIG_SCSI_NCR53C406A is not set 520# CONFIG_SCSI_MVSAS is not set
573# CONFIG_SCSI_STEX is not set 521# CONFIG_SCSI_STEX is not set
574# CONFIG_SCSI_SYM53C8XX_2 is not set 522# CONFIG_SCSI_SYM53C8XX_2 is not set
575# CONFIG_SCSI_IPR is not set 523# CONFIG_SCSI_IPR is not set
576# CONFIG_SCSI_PAS16 is not set
577# CONFIG_SCSI_PSI240I is not set
578# CONFIG_SCSI_QLOGIC_FAS is not set
579# CONFIG_SCSI_QLOGIC_1280 is not set 524# CONFIG_SCSI_QLOGIC_1280 is not set
580# CONFIG_SCSI_QLA_FC is not set 525# CONFIG_SCSI_QLA_FC is not set
581# CONFIG_SCSI_QLA_ISCSI is not set 526# CONFIG_SCSI_QLA_ISCSI is not set
582# CONFIG_SCSI_LPFC is not set 527# CONFIG_SCSI_LPFC is not set
583# CONFIG_SCSI_SYM53C416 is not set
584# CONFIG_SCSI_DC395x is not set 528# CONFIG_SCSI_DC395x is not set
585# CONFIG_SCSI_DC390T is not set 529# CONFIG_SCSI_DC390T is not set
586# CONFIG_SCSI_T128 is not set
587# CONFIG_SCSI_NSP32 is not set 530# CONFIG_SCSI_NSP32 is not set
588# CONFIG_SCSI_DEBUG is not set 531# CONFIG_SCSI_DEBUG is not set
589# CONFIG_SCSI_SRP is not set 532# CONFIG_SCSI_SRP is not set
590 533# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
591# 534# CONFIG_SCSI_DH is not set
592# PCMCIA SCSI adapter support
593#
594# CONFIG_PCMCIA_AHA152X is not set
595# CONFIG_PCMCIA_FDOMAIN is not set
596# CONFIG_PCMCIA_NINJA_SCSI is not set
597# CONFIG_PCMCIA_QLOGIC is not set
598# CONFIG_PCMCIA_SYM53C500 is not set
599
600#
601# Serial ATA (prod) and Parallel ATA (experimental) drivers
602#
603CONFIG_ATA=y 535CONFIG_ATA=y
604# CONFIG_ATA_NONSTANDARD is not set 536# CONFIG_ATA_NONSTANDARD is not set
537CONFIG_SATA_PMP=y
605# CONFIG_SATA_AHCI is not set 538# CONFIG_SATA_AHCI is not set
539# CONFIG_SATA_SIL24 is not set
540CONFIG_ATA_SFF=y
606# CONFIG_SATA_SVW is not set 541# CONFIG_SATA_SVW is not set
607# CONFIG_ATA_PIIX is not set 542# CONFIG_ATA_PIIX is not set
608# CONFIG_SATA_MV is not set 543# CONFIG_SATA_MV is not set
@@ -612,7 +547,6 @@ CONFIG_ATA=y
612# CONFIG_SATA_PROMISE is not set 547# CONFIG_SATA_PROMISE is not set
613# CONFIG_SATA_SX4 is not set 548# CONFIG_SATA_SX4 is not set
614# CONFIG_SATA_SIL is not set 549# CONFIG_SATA_SIL is not set
615# CONFIG_SATA_SIL24 is not set
616# CONFIG_SATA_SIS is not set 550# CONFIG_SATA_SIS is not set
617# CONFIG_SATA_ULI is not set 551# CONFIG_SATA_ULI is not set
618# CONFIG_SATA_VIA is not set 552# CONFIG_SATA_VIA is not set
@@ -622,6 +556,7 @@ CONFIG_ATA=y
622# CONFIG_PATA_AMD is not set 556# CONFIG_PATA_AMD is not set
623# CONFIG_PATA_ARTOP is not set 557# CONFIG_PATA_ARTOP is not set
624# CONFIG_PATA_ATIIXP is not set 558# CONFIG_PATA_ATIIXP is not set
559# CONFIG_PATA_CMD640_PCI is not set
625# CONFIG_PATA_CMD64X is not set 560# CONFIG_PATA_CMD64X is not set
626# CONFIG_PATA_CS5520 is not set 561# CONFIG_PATA_CS5520 is not set
627# CONFIG_PATA_CS5530 is not set 562# CONFIG_PATA_CS5530 is not set
@@ -635,18 +570,18 @@ CONFIG_ATA=y
635# CONFIG_PATA_IT821X is not set 570# CONFIG_PATA_IT821X is not set
636# CONFIG_PATA_IT8213 is not set 571# CONFIG_PATA_IT8213 is not set
637# CONFIG_PATA_JMICRON is not set 572# CONFIG_PATA_JMICRON is not set
638# CONFIG_PATA_LEGACY is not set
639# CONFIG_PATA_TRIFLEX is not set 573# CONFIG_PATA_TRIFLEX is not set
640# CONFIG_PATA_MARVELL is not set 574# CONFIG_PATA_MARVELL is not set
641# CONFIG_PATA_MPIIX is not set 575# CONFIG_PATA_MPIIX is not set
642# CONFIG_PATA_OLDPIIX is not set 576# CONFIG_PATA_OLDPIIX is not set
643# CONFIG_PATA_NETCELL is not set 577# CONFIG_PATA_NETCELL is not set
578# CONFIG_PATA_NINJA32 is not set
644# CONFIG_PATA_NS87410 is not set 579# CONFIG_PATA_NS87410 is not set
580# CONFIG_PATA_NS87415 is not set
645# CONFIG_PATA_OPTI is not set 581# CONFIG_PATA_OPTI is not set
646# CONFIG_PATA_OPTIDMA is not set 582# CONFIG_PATA_OPTIDMA is not set
647# CONFIG_PATA_PCMCIA is not set 583# CONFIG_PATA_PCMCIA is not set
648# CONFIG_PATA_PDC_OLD is not set 584# CONFIG_PATA_PDC_OLD is not set
649# CONFIG_PATA_QDI is not set
650# CONFIG_PATA_RADISYS is not set 585# CONFIG_PATA_RADISYS is not set
651# CONFIG_PATA_RZ1000 is not set 586# CONFIG_PATA_RZ1000 is not set
652# CONFIG_PATA_SC1200 is not set 587# CONFIG_PATA_SC1200 is not set
@@ -656,88 +591,52 @@ CONFIG_ATA=y
656# CONFIG_PATA_SIS is not set 591# CONFIG_PATA_SIS is not set
657# CONFIG_PATA_VIA is not set 592# CONFIG_PATA_VIA is not set
658# CONFIG_PATA_WINBOND is not set 593# CONFIG_PATA_WINBOND is not set
659# CONFIG_PATA_WINBOND_VLB is not set
660CONFIG_PATA_PLATFORM=y 594CONFIG_PATA_PLATFORM=y
661 595# CONFIG_PATA_SCH is not set
662#
663# Old CD-ROM drivers (not SCSI, not IDE)
664#
665# CONFIG_CD_NO_IDESCSI is not set
666
667#
668# Multi-device support (RAID and LVM)
669#
670# CONFIG_MD is not set 596# CONFIG_MD is not set
671
672#
673# Fusion MPT device support
674#
675# CONFIG_FUSION is not set 597# CONFIG_FUSION is not set
676# CONFIG_FUSION_SPI is not set
677# CONFIG_FUSION_FC is not set
678# CONFIG_FUSION_SAS is not set
679 598
680# 599#
681# IEEE 1394 (FireWire) support 600# IEEE 1394 (FireWire) support
682# 601#
683# CONFIG_IEEE1394 is not set
684 602
685# 603#
686# I2O device support 604# Enable only one of the two stacks, unless you know what you are doing
687# 605#
606# CONFIG_FIREWIRE is not set
607# CONFIG_IEEE1394 is not set
688# CONFIG_I2O is not set 608# CONFIG_I2O is not set
689
690#
691# Network device support
692#
693CONFIG_NETDEVICES=y 609CONFIG_NETDEVICES=y
694# CONFIG_DUMMY is not set 610# CONFIG_DUMMY is not set
695# CONFIG_BONDING is not set 611# CONFIG_BONDING is not set
612# CONFIG_MACVLAN is not set
696# CONFIG_EQUALIZER is not set 613# CONFIG_EQUALIZER is not set
697# CONFIG_TUN is not set 614# CONFIG_TUN is not set
698 615# CONFIG_VETH is not set
699#
700# ARCnet devices
701#
702# CONFIG_ARCNET is not set 616# CONFIG_ARCNET is not set
703
704#
705# PHY device support
706#
707# CONFIG_PHYLIB is not set 617# CONFIG_PHYLIB is not set
708
709#
710# Ethernet (10 or 100Mbit)
711#
712CONFIG_NET_ETHERNET=y 618CONFIG_NET_ETHERNET=y
713CONFIG_MII=y 619CONFIG_MII=y
620# CONFIG_AX88796 is not set
714# CONFIG_STNIC is not set 621# CONFIG_STNIC is not set
715# CONFIG_HAPPYMEAL is not set 622# CONFIG_HAPPYMEAL is not set
716# CONFIG_SUNGEM is not set 623# CONFIG_SUNGEM is not set
717# CONFIG_CASSINI is not set 624# CONFIG_CASSINI is not set
718# CONFIG_NET_VENDOR_3COM is not set 625# CONFIG_NET_VENDOR_3COM is not set
719# CONFIG_NET_VENDOR_SMC is not set
720# CONFIG_SMC91X is not set 626# CONFIG_SMC91X is not set
721# CONFIG_NET_VENDOR_RACAL is not set 627# CONFIG_SMC911X is not set
722
723#
724# Tulip family network device support
725#
726# CONFIG_NET_TULIP is not set 628# CONFIG_NET_TULIP is not set
727# CONFIG_AT1700 is not set
728# CONFIG_DEPCA is not set
729# CONFIG_HP100 is not set 629# CONFIG_HP100 is not set
730# CONFIG_NET_ISA is not set 630# CONFIG_IBM_NEW_EMAC_ZMII is not set
631# CONFIG_IBM_NEW_EMAC_RGMII is not set
632# CONFIG_IBM_NEW_EMAC_TAH is not set
633# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
731CONFIG_NET_PCI=y 634CONFIG_NET_PCI=y
732# CONFIG_PCNET32 is not set 635# CONFIG_PCNET32 is not set
733# CONFIG_AMD8111_ETH is not set 636# CONFIG_AMD8111_ETH is not set
734# CONFIG_ADAPTEC_STARFIRE is not set 637# CONFIG_ADAPTEC_STARFIRE is not set
735# CONFIG_AC3200 is not set
736# CONFIG_APRICOT is not set
737# CONFIG_B44 is not set 638# CONFIG_B44 is not set
738# CONFIG_FORCEDETH is not set 639# CONFIG_FORCEDETH is not set
739# CONFIG_CS89x0 is not set
740# CONFIG_DGRS is not set
741# CONFIG_EEPRO100 is not set 640# CONFIG_EEPRO100 is not set
742# CONFIG_E100 is not set 641# CONFIG_E100 is not set
743# CONFIG_FEALNX is not set 642# CONFIG_FEALNX is not set
@@ -749,19 +648,20 @@ CONFIG_8139TOO_PIO=y
749CONFIG_8139TOO_TUNE_TWISTER=y 648CONFIG_8139TOO_TUNE_TWISTER=y
750# CONFIG_8139TOO_8129 is not set 649# CONFIG_8139TOO_8129 is not set
751# CONFIG_8139_OLD_RX_RESET is not set 650# CONFIG_8139_OLD_RX_RESET is not set
651# CONFIG_R6040 is not set
752# CONFIG_SIS900 is not set 652# CONFIG_SIS900 is not set
753# CONFIG_EPIC100 is not set 653# CONFIG_EPIC100 is not set
754# CONFIG_SUNDANCE is not set 654# CONFIG_SUNDANCE is not set
755# CONFIG_TLAN is not set 655# CONFIG_TLAN is not set
756# CONFIG_VIA_RHINE is not set 656# CONFIG_VIA_RHINE is not set
757# CONFIG_SC92031 is not set 657# CONFIG_SC92031 is not set
758 658CONFIG_NETDEV_1000=y
759#
760# Ethernet (1000 Mbit)
761#
762# CONFIG_ACENIC is not set 659# CONFIG_ACENIC is not set
763# CONFIG_DL2K is not set 660# CONFIG_DL2K is not set
764# CONFIG_E1000 is not set 661# CONFIG_E1000 is not set
662# CONFIG_E1000E is not set
663# CONFIG_IP1000 is not set
664# CONFIG_IGB is not set
765# CONFIG_NS83820 is not set 665# CONFIG_NS83820 is not set
766# CONFIG_HAMACHI is not set 666# CONFIG_HAMACHI is not set
767# CONFIG_YELLOWFIN is not set 667# CONFIG_YELLOWFIN is not set
@@ -769,36 +669,33 @@ CONFIG_8139TOO_TUNE_TWISTER=y
769# CONFIG_SIS190 is not set 669# CONFIG_SIS190 is not set
770# CONFIG_SKGE is not set 670# CONFIG_SKGE is not set
771# CONFIG_SKY2 is not set 671# CONFIG_SKY2 is not set
772# CONFIG_SK98LIN is not set
773# CONFIG_VIA_VELOCITY is not set 672# CONFIG_VIA_VELOCITY is not set
774# CONFIG_TIGON3 is not set 673# CONFIG_TIGON3 is not set
775# CONFIG_BNX2 is not set 674# CONFIG_BNX2 is not set
776# CONFIG_QLA3XXX is not set 675# CONFIG_QLA3XXX is not set
777# CONFIG_ATL1 is not set 676# CONFIG_ATL1 is not set
778 677# CONFIG_ATL1E is not set
779# 678CONFIG_NETDEV_10000=y
780# Ethernet (10000 Mbit)
781#
782# CONFIG_CHELSIO_T1 is not set 679# CONFIG_CHELSIO_T1 is not set
783# CONFIG_CHELSIO_T3 is not set 680# CONFIG_CHELSIO_T3 is not set
681# CONFIG_IXGBE is not set
784# CONFIG_IXGB is not set 682# CONFIG_IXGB is not set
785# CONFIG_S2IO is not set 683# CONFIG_S2IO is not set
786# CONFIG_MYRI10GE is not set 684# CONFIG_MYRI10GE is not set
787# CONFIG_NETXEN_NIC is not set 685# CONFIG_NETXEN_NIC is not set
788 686# CONFIG_NIU is not set
789# 687# CONFIG_MLX4_CORE is not set
790# Token Ring devices 688# CONFIG_TEHUTI is not set
791# 689# CONFIG_BNX2X is not set
690# CONFIG_SFC is not set
792# CONFIG_TR is not set 691# CONFIG_TR is not set
793 692
794# 693#
795# Wireless LAN (non-hamradio) 694# Wireless LAN
796#
797# CONFIG_NET_RADIO is not set
798
799#
800# PCMCIA network device support
801# 695#
696# CONFIG_WLAN_PRE80211 is not set
697# CONFIG_WLAN_80211 is not set
698# CONFIG_IWLWIFI_LEDS is not set
802CONFIG_NET_PCMCIA=y 699CONFIG_NET_PCMCIA=y
803# CONFIG_PCMCIA_3C589 is not set 700# CONFIG_PCMCIA_3C589 is not set
804# CONFIG_PCMCIA_3C574 is not set 701# CONFIG_PCMCIA_3C574 is not set
@@ -808,29 +705,16 @@ CONFIG_PCMCIA_PCNET=y
808# CONFIG_PCMCIA_SMC91C92 is not set 705# CONFIG_PCMCIA_SMC91C92 is not set
809# CONFIG_PCMCIA_XIRC2PS is not set 706# CONFIG_PCMCIA_XIRC2PS is not set
810# CONFIG_PCMCIA_AXNET is not set 707# CONFIG_PCMCIA_AXNET is not set
811
812#
813# Wan interfaces
814#
815# CONFIG_WAN is not set 708# CONFIG_WAN is not set
816# CONFIG_FDDI is not set 709# CONFIG_FDDI is not set
817# CONFIG_HIPPI is not set 710# CONFIG_HIPPI is not set
818# CONFIG_PPP is not set 711# CONFIG_PPP is not set
819# CONFIG_SLIP is not set 712# CONFIG_SLIP is not set
820# CONFIG_NET_FC is not set 713# CONFIG_NET_FC is not set
821# CONFIG_SHAPER is not set
822# CONFIG_NETCONSOLE is not set 714# CONFIG_NETCONSOLE is not set
823# CONFIG_NETPOLL is not set 715# CONFIG_NETPOLL is not set
824# CONFIG_NET_POLL_CONTROLLER is not set 716# CONFIG_NET_POLL_CONTROLLER is not set
825
826#
827# ISDN subsystem
828#
829# CONFIG_ISDN is not set 717# CONFIG_ISDN is not set
830
831#
832# Telephony Support
833#
834# CONFIG_PHONE is not set 718# CONFIG_PHONE is not set
835 719
836# 720#
@@ -838,6 +722,7 @@ CONFIG_PCMCIA_PCNET=y
838# 722#
839CONFIG_INPUT=y 723CONFIG_INPUT=y
840# CONFIG_INPUT_FF_MEMLESS is not set 724# CONFIG_INPUT_FF_MEMLESS is not set
725# CONFIG_INPUT_POLLDEV is not set
841 726
842# 727#
843# Userland interfaces 728# Userland interfaces
@@ -847,7 +732,6 @@ CONFIG_INPUT_MOUSEDEV=y
847CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 732CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
848CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 733CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
849# CONFIG_INPUT_JOYDEV is not set 734# CONFIG_INPUT_JOYDEV is not set
850# CONFIG_INPUT_TSDEV is not set
851# CONFIG_INPUT_EVDEV is not set 735# CONFIG_INPUT_EVDEV is not set
852# CONFIG_INPUT_EVBUG is not set 736# CONFIG_INPUT_EVBUG is not set
853 737
@@ -857,6 +741,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
857# CONFIG_INPUT_KEYBOARD is not set 741# CONFIG_INPUT_KEYBOARD is not set
858# CONFIG_INPUT_MOUSE is not set 742# CONFIG_INPUT_MOUSE is not set
859# CONFIG_INPUT_JOYSTICK is not set 743# CONFIG_INPUT_JOYSTICK is not set
744# CONFIG_INPUT_TABLET is not set
860# CONFIG_INPUT_TOUCHSCREEN is not set 745# CONFIG_INPUT_TOUCHSCREEN is not set
861# CONFIG_INPUT_MISC is not set 746# CONFIG_INPUT_MISC is not set
862 747
@@ -870,10 +755,13 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
870# Character devices 755# Character devices
871# 756#
872CONFIG_VT=y 757CONFIG_VT=y
758CONFIG_CONSOLE_TRANSLATIONS=y
873CONFIG_VT_CONSOLE=y 759CONFIG_VT_CONSOLE=y
874CONFIG_HW_CONSOLE=y 760CONFIG_HW_CONSOLE=y
875# CONFIG_VT_HW_CONSOLE_BINDING is not set 761# CONFIG_VT_HW_CONSOLE_BINDING is not set
762CONFIG_DEVKMEM=y
876# CONFIG_SERIAL_NONSTANDARD is not set 763# CONFIG_SERIAL_NONSTANDARD is not set
764# CONFIG_NOZOMI is not set
877 765
878# 766#
879# Serial drivers 767# Serial drivers
@@ -892,22 +780,10 @@ CONFIG_SERIAL_CORE_CONSOLE=y
892CONFIG_UNIX98_PTYS=y 780CONFIG_UNIX98_PTYS=y
893CONFIG_LEGACY_PTYS=y 781CONFIG_LEGACY_PTYS=y
894CONFIG_LEGACY_PTY_COUNT=256 782CONFIG_LEGACY_PTY_COUNT=256
895
896#
897# IPMI
898#
899# CONFIG_IPMI_HANDLER is not set 783# CONFIG_IPMI_HANDLER is not set
900
901#
902# Watchdog Cards
903#
904# CONFIG_WATCHDOG is not set
905CONFIG_HW_RANDOM=y 784CONFIG_HW_RANDOM=y
906# CONFIG_GEN_RTC is not set
907# CONFIG_DTLK is not set
908# CONFIG_R3964 is not set 785# CONFIG_R3964 is not set
909# CONFIG_APPLICOM is not set 786# CONFIG_APPLICOM is not set
910# CONFIG_DRM is not set
911 787
912# 788#
913# PCMCIA character devices 789# PCMCIA character devices
@@ -915,125 +791,104 @@ CONFIG_HW_RANDOM=y
915# CONFIG_SYNCLINK_CS is not set 791# CONFIG_SYNCLINK_CS is not set
916# CONFIG_CARDMAN_4000 is not set 792# CONFIG_CARDMAN_4000 is not set
917# CONFIG_CARDMAN_4040 is not set 793# CONFIG_CARDMAN_4040 is not set
794# CONFIG_IPWIRELESS is not set
918# CONFIG_RAW_DRIVER is not set 795# CONFIG_RAW_DRIVER is not set
919
920#
921# TPM devices
922#
923# CONFIG_TCG_TPM is not set 796# CONFIG_TCG_TPM is not set
924 797CONFIG_DEVPORT=y
925#
926# I2C support
927#
928# CONFIG_I2C is not set 798# CONFIG_I2C is not set
929
930#
931# SPI support
932#
933# CONFIG_SPI is not set 799# CONFIG_SPI is not set
934# CONFIG_SPI_MASTER is not set
935
936#
937# Dallas's 1-wire bus
938#
939# CONFIG_W1 is not set 800# CONFIG_W1 is not set
940 801# CONFIG_POWER_SUPPLY is not set
941#
942# Hardware Monitoring support
943#
944CONFIG_HWMON=y 802CONFIG_HWMON=y
945# CONFIG_HWMON_VID is not set 803# CONFIG_HWMON_VID is not set
946# CONFIG_SENSORS_ABITUGURU is not set 804# CONFIG_SENSORS_I5K_AMB is not set
947# CONFIG_SENSORS_F71805F is not set 805# CONFIG_SENSORS_F71805F is not set
806# CONFIG_SENSORS_F71882FG is not set
807# CONFIG_SENSORS_IT87 is not set
808# CONFIG_SENSORS_PC87360 is not set
948# CONFIG_SENSORS_PC87427 is not set 809# CONFIG_SENSORS_PC87427 is not set
810# CONFIG_SENSORS_SIS5595 is not set
811# CONFIG_SENSORS_SMSC47M1 is not set
812# CONFIG_SENSORS_SMSC47B397 is not set
813# CONFIG_SENSORS_VIA686A is not set
949# CONFIG_SENSORS_VT1211 is not set 814# CONFIG_SENSORS_VT1211 is not set
815# CONFIG_SENSORS_VT8231 is not set
816# CONFIG_SENSORS_W83627HF is not set
817# CONFIG_SENSORS_W83627EHF is not set
950# CONFIG_HWMON_DEBUG_CHIP is not set 818# CONFIG_HWMON_DEBUG_CHIP is not set
819# CONFIG_THERMAL is not set
820# CONFIG_THERMAL_HWMON is not set
821# CONFIG_WATCHDOG is not set
822
823#
824# Sonics Silicon Backplane
825#
826CONFIG_SSB_POSSIBLE=y
827# CONFIG_SSB is not set
951 828
952# 829#
953# Multifunction device drivers 830# Multifunction device drivers
954# 831#
832# CONFIG_MFD_CORE is not set
955# CONFIG_MFD_SM501 is not set 833# CONFIG_MFD_SM501 is not set
834# CONFIG_HTC_PASIC3 is not set
956 835
957# 836#
958# Multimedia devices 837# Multimedia devices
959# 838#
839
840#
841# Multimedia core support
842#
960# CONFIG_VIDEO_DEV is not set 843# CONFIG_VIDEO_DEV is not set
844# CONFIG_DVB_CORE is not set
845# CONFIG_VIDEO_MEDIA is not set
961 846
962# 847#
963# Digital Video Broadcasting Devices 848# Multimedia drivers
964# 849#
965# CONFIG_DVB is not set 850# CONFIG_DAB is not set
966 851
967# 852#
968# Graphics support 853# Graphics support
969# 854#
970# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 855# CONFIG_DRM is not set
856# CONFIG_VGASTATE is not set
857# CONFIG_VIDEO_OUTPUT_CONTROL is not set
971# CONFIG_FB is not set 858# CONFIG_FB is not set
859# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
972 860
973# 861#
974# Console display driver support 862# Display device support
975# 863#
976# CONFIG_MDA_CONSOLE is not set 864# CONFIG_DISPLAY_SUPPORT is not set
977CONFIG_DUMMY_CONSOLE=y
978 865
979# 866#
980# Sound 867# Console display driver support
981# 868#
869CONFIG_DUMMY_CONSOLE=y
982# CONFIG_SOUND is not set 870# CONFIG_SOUND is not set
983 871CONFIG_HID_SUPPORT=y
984#
985# HID Devices
986#
987CONFIG_HID=y 872CONFIG_HID=y
988# CONFIG_HID_DEBUG is not set 873# CONFIG_HID_DEBUG is not set
989 874# CONFIG_HIDRAW is not set
990# 875CONFIG_USB_SUPPORT=y
991# USB support
992#
993CONFIG_USB_ARCH_HAS_HCD=y 876CONFIG_USB_ARCH_HAS_HCD=y
994CONFIG_USB_ARCH_HAS_OHCI=y 877CONFIG_USB_ARCH_HAS_OHCI=y
995CONFIG_USB_ARCH_HAS_EHCI=y 878CONFIG_USB_ARCH_HAS_EHCI=y
996# CONFIG_USB is not set 879# CONFIG_USB is not set
880# CONFIG_USB_OTG_WHITELIST is not set
881# CONFIG_USB_OTG_BLACKLIST_HUB is not set
997 882
998# 883#
999# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 884# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1000# 885#
1001
1002#
1003# USB Gadget Support
1004#
1005# CONFIG_USB_GADGET is not set 886# CONFIG_USB_GADGET is not set
1006
1007#
1008# MMC/SD Card support
1009#
1010# CONFIG_MMC is not set 887# CONFIG_MMC is not set
1011 888# CONFIG_MEMSTICK is not set
1012#
1013# LED devices
1014#
1015# CONFIG_NEW_LEDS is not set 889# CONFIG_NEW_LEDS is not set
1016 890# CONFIG_ACCESSIBILITY is not set
1017#
1018# LED drivers
1019#
1020
1021#
1022# LED Triggers
1023#
1024
1025#
1026# InfiniBand support
1027#
1028# CONFIG_INFINIBAND is not set 891# CONFIG_INFINIBAND is not set
1029
1030#
1031# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1032#
1033
1034#
1035# Real Time Clock
1036#
1037CONFIG_RTC_LIB=y 892CONFIG_RTC_LIB=y
1038CONFIG_RTC_CLASS=y 893CONFIG_RTC_CLASS=y
1039CONFIG_RTC_HCTOSYS=y 894CONFIG_RTC_HCTOSYS=y
@@ -1047,37 +902,29 @@ CONFIG_RTC_INTF_SYSFS=y
1047CONFIG_RTC_INTF_PROC=y 902CONFIG_RTC_INTF_PROC=y
1048CONFIG_RTC_INTF_DEV=y 903CONFIG_RTC_INTF_DEV=y
1049# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set 904# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1050
1051#
1052# RTC drivers
1053#
1054# CONFIG_RTC_DRV_DS1553 is not set
1055# CONFIG_RTC_DRV_DS1742 is not set
1056# CONFIG_RTC_DRV_M48T86 is not set
1057# CONFIG_RTC_DRV_SH is not set
1058# CONFIG_RTC_DRV_TEST is not set 905# CONFIG_RTC_DRV_TEST is not set
1059# CONFIG_RTC_DRV_V3020 is not set
1060
1061#
1062# DMA Engine support
1063#
1064# CONFIG_DMA_ENGINE is not set
1065
1066#
1067# DMA Clients
1068#
1069 906
1070# 907#
1071# DMA Devices 908# SPI RTC drivers
1072# 909#
1073 910
1074# 911#
1075# Auxiliary Display support 912# Platform RTC drivers
1076# 913#
914# CONFIG_RTC_DRV_DS1511 is not set
915# CONFIG_RTC_DRV_DS1553 is not set
916# CONFIG_RTC_DRV_DS1742 is not set
917# CONFIG_RTC_DRV_STK17TA8 is not set
918# CONFIG_RTC_DRV_M48T86 is not set
919# CONFIG_RTC_DRV_M48T59 is not set
920# CONFIG_RTC_DRV_V3020 is not set
1077 921
1078# 922#
1079# Virtualization 923# on-CPU RTC drivers
1080# 924#
925# CONFIG_RTC_DRV_SH is not set
926# CONFIG_DMADEVICES is not set
927# CONFIG_UIO is not set
1081 928
1082# 929#
1083# File systems 930# File systems
@@ -1091,20 +938,16 @@ CONFIG_EXT3_FS_XATTR=y
1091# CONFIG_EXT3_FS_SECURITY is not set 938# CONFIG_EXT3_FS_SECURITY is not set
1092# CONFIG_EXT4DEV_FS is not set 939# CONFIG_EXT4DEV_FS is not set
1093CONFIG_JBD=y 940CONFIG_JBD=y
1094# CONFIG_JBD_DEBUG is not set
1095CONFIG_FS_MBCACHE=y 941CONFIG_FS_MBCACHE=y
1096# CONFIG_REISERFS_FS is not set 942# CONFIG_REISERFS_FS is not set
1097# CONFIG_JFS_FS is not set 943# CONFIG_JFS_FS is not set
1098# CONFIG_FS_POSIX_ACL is not set 944# CONFIG_FS_POSIX_ACL is not set
1099# CONFIG_XFS_FS is not set 945# CONFIG_XFS_FS is not set
1100# CONFIG_GFS2_FS is not set
1101# CONFIG_OCFS2_FS is not set 946# CONFIG_OCFS2_FS is not set
1102# CONFIG_MINIX_FS is not set 947CONFIG_DNOTIFY=y
1103CONFIG_ROMFS_FS=y
1104CONFIG_INOTIFY=y 948CONFIG_INOTIFY=y
1105CONFIG_INOTIFY_USER=y 949CONFIG_INOTIFY_USER=y
1106# CONFIG_QUOTA is not set 950# CONFIG_QUOTA is not set
1107CONFIG_DNOTIFY=y
1108# CONFIG_AUTOFS_FS is not set 951# CONFIG_AUTOFS_FS is not set
1109# CONFIG_AUTOFS4_FS is not set 952# CONFIG_AUTOFS4_FS is not set
1110# CONFIG_FUSE_FS is not set 953# CONFIG_FUSE_FS is not set
@@ -1136,7 +979,6 @@ CONFIG_TMPFS=y
1136# CONFIG_TMPFS_POSIX_ACL is not set 979# CONFIG_TMPFS_POSIX_ACL is not set
1137# CONFIG_HUGETLBFS is not set 980# CONFIG_HUGETLBFS is not set
1138# CONFIG_HUGETLB_PAGE is not set 981# CONFIG_HUGETLB_PAGE is not set
1139CONFIG_RAMFS=y
1140# CONFIG_CONFIGFS_FS is not set 982# CONFIG_CONFIGFS_FS is not set
1141 983
1142# 984#
@@ -1151,14 +993,14 @@ CONFIG_RAMFS=y
1151# CONFIG_EFS_FS is not set 993# CONFIG_EFS_FS is not set
1152# CONFIG_CRAMFS is not set 994# CONFIG_CRAMFS is not set
1153# CONFIG_VXFS_FS is not set 995# CONFIG_VXFS_FS is not set
996# CONFIG_MINIX_FS is not set
997# CONFIG_OMFS_FS is not set
1154# CONFIG_HPFS_FS is not set 998# CONFIG_HPFS_FS is not set
1155# CONFIG_QNX4FS_FS is not set 999# CONFIG_QNX4FS_FS is not set
1000CONFIG_ROMFS_FS=y
1156# CONFIG_SYSV_FS is not set 1001# CONFIG_SYSV_FS is not set
1157# CONFIG_UFS_FS is not set 1002# CONFIG_UFS_FS is not set
1158 1003CONFIG_NETWORK_FILESYSTEMS=y
1159#
1160# Network File Systems
1161#
1162# CONFIG_NFS_FS is not set 1004# CONFIG_NFS_FS is not set
1163# CONFIG_NFSD is not set 1005# CONFIG_NFSD is not set
1164# CONFIG_SMB_FS is not set 1006# CONFIG_SMB_FS is not set
@@ -1166,17 +1008,12 @@ CONFIG_RAMFS=y
1166# CONFIG_NCP_FS is not set 1008# CONFIG_NCP_FS is not set
1167# CONFIG_CODA_FS is not set 1009# CONFIG_CODA_FS is not set
1168# CONFIG_AFS_FS is not set 1010# CONFIG_AFS_FS is not set
1169# CONFIG_9P_FS is not set
1170 1011
1171# 1012#
1172# Partition Types 1013# Partition Types
1173# 1014#
1174# CONFIG_PARTITION_ADVANCED is not set 1015# CONFIG_PARTITION_ADVANCED is not set
1175CONFIG_MSDOS_PARTITION=y 1016CONFIG_MSDOS_PARTITION=y
1176
1177#
1178# Native Language Support
1179#
1180CONFIG_NLS=y 1017CONFIG_NLS=y
1181CONFIG_NLS_DEFAULT="iso8859-1" 1018CONFIG_NLS_DEFAULT="iso8859-1"
1182CONFIG_NLS_CODEPAGE_437=y 1019CONFIG_NLS_CODEPAGE_437=y
@@ -1217,30 +1054,24 @@ CONFIG_NLS_CODEPAGE_437=y
1217# CONFIG_NLS_KOI8_R is not set 1054# CONFIG_NLS_KOI8_R is not set
1218# CONFIG_NLS_KOI8_U is not set 1055# CONFIG_NLS_KOI8_U is not set
1219# CONFIG_NLS_UTF8 is not set 1056# CONFIG_NLS_UTF8 is not set
1220
1221#
1222# Distributed Lock Manager
1223#
1224# CONFIG_DLM is not set 1057# CONFIG_DLM is not set
1225 1058
1226# 1059#
1227# Profiling support
1228#
1229# CONFIG_PROFILING is not set
1230
1231#
1232# Kernel hacking 1060# Kernel hacking
1233# 1061#
1234CONFIG_TRACE_IRQFLAGS_SUPPORT=y 1062CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1235# CONFIG_PRINTK_TIME is not set 1063# CONFIG_PRINTK_TIME is not set
1064CONFIG_ENABLE_WARN_DEPRECATED=y
1236CONFIG_ENABLE_MUST_CHECK=y 1065CONFIG_ENABLE_MUST_CHECK=y
1066CONFIG_FRAME_WARN=1024
1237# CONFIG_MAGIC_SYSRQ is not set 1067# CONFIG_MAGIC_SYSRQ is not set
1238# CONFIG_UNUSED_SYMBOLS is not set 1068# CONFIG_UNUSED_SYMBOLS is not set
1239# CONFIG_DEBUG_FS is not set 1069# CONFIG_DEBUG_FS is not set
1240# CONFIG_HEADERS_CHECK is not set 1070# CONFIG_HEADERS_CHECK is not set
1241# CONFIG_DEBUG_KERNEL is not set 1071# CONFIG_DEBUG_KERNEL is not set
1242CONFIG_LOG_BUF_SHIFT=14
1243# CONFIG_DEBUG_BUGVERBOSE is not set 1072# CONFIG_DEBUG_BUGVERBOSE is not set
1073# CONFIG_DEBUG_MEMORY_INIT is not set
1074# CONFIG_SAMPLES is not set
1244CONFIG_SH_STANDARD_BIOS=y 1075CONFIG_SH_STANDARD_BIOS=y
1245# CONFIG_EARLY_SCIF_CONSOLE is not set 1076# CONFIG_EARLY_SCIF_CONSOLE is not set
1246# CONFIG_EARLY_PRINTK is not set 1077# CONFIG_EARLY_PRINTK is not set
@@ -1251,20 +1082,100 @@ CONFIG_SH_STANDARD_BIOS=y
1251# 1082#
1252# CONFIG_KEYS is not set 1083# CONFIG_KEYS is not set
1253# CONFIG_SECURITY is not set 1084# CONFIG_SECURITY is not set
1085# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1086CONFIG_CRYPTO=y
1087
1088#
1089# Crypto core or helper
1090#
1091# CONFIG_CRYPTO_MANAGER is not set
1092# CONFIG_CRYPTO_GF128MUL is not set
1093# CONFIG_CRYPTO_NULL is not set
1094# CONFIG_CRYPTO_CRYPTD is not set
1095# CONFIG_CRYPTO_AUTHENC is not set
1096# CONFIG_CRYPTO_TEST is not set
1097
1098#
1099# Authenticated Encryption with Associated Data
1100#
1101# CONFIG_CRYPTO_CCM is not set
1102# CONFIG_CRYPTO_GCM is not set
1103# CONFIG_CRYPTO_SEQIV is not set
1104
1105#
1106# Block modes
1107#
1108# CONFIG_CRYPTO_CBC is not set
1109# CONFIG_CRYPTO_CTR is not set
1110# CONFIG_CRYPTO_CTS is not set
1111# CONFIG_CRYPTO_ECB is not set
1112# CONFIG_CRYPTO_LRW is not set
1113# CONFIG_CRYPTO_PCBC is not set
1114# CONFIG_CRYPTO_XTS is not set
1115
1116#
1117# Hash modes
1118#
1119# CONFIG_CRYPTO_HMAC is not set
1120# CONFIG_CRYPTO_XCBC is not set
1121
1122#
1123# Digest
1124#
1125# CONFIG_CRYPTO_CRC32C is not set
1126# CONFIG_CRYPTO_MD4 is not set
1127# CONFIG_CRYPTO_MD5 is not set
1128# CONFIG_CRYPTO_MICHAEL_MIC is not set
1129# CONFIG_CRYPTO_RMD128 is not set
1130# CONFIG_CRYPTO_RMD160 is not set
1131# CONFIG_CRYPTO_RMD256 is not set
1132# CONFIG_CRYPTO_RMD320 is not set
1133# CONFIG_CRYPTO_SHA1 is not set
1134# CONFIG_CRYPTO_SHA256 is not set
1135# CONFIG_CRYPTO_SHA512 is not set
1136# CONFIG_CRYPTO_TGR192 is not set
1137# CONFIG_CRYPTO_WP512 is not set
1138
1139#
1140# Ciphers
1141#
1142# CONFIG_CRYPTO_AES is not set
1143# CONFIG_CRYPTO_ANUBIS is not set
1144# CONFIG_CRYPTO_ARC4 is not set
1145# CONFIG_CRYPTO_BLOWFISH is not set
1146# CONFIG_CRYPTO_CAMELLIA is not set
1147# CONFIG_CRYPTO_CAST5 is not set
1148# CONFIG_CRYPTO_CAST6 is not set
1149# CONFIG_CRYPTO_DES is not set
1150# CONFIG_CRYPTO_FCRYPT is not set
1151# CONFIG_CRYPTO_KHAZAD is not set
1152# CONFIG_CRYPTO_SALSA20 is not set
1153# CONFIG_CRYPTO_SEED is not set
1154# CONFIG_CRYPTO_SERPENT is not set
1155# CONFIG_CRYPTO_TEA is not set
1156# CONFIG_CRYPTO_TWOFISH is not set
1254 1157
1255# 1158#
1256# Cryptographic options 1159# Compression
1257# 1160#
1258# CONFIG_CRYPTO is not set 1161# CONFIG_CRYPTO_DEFLATE is not set
1162# CONFIG_CRYPTO_LZO is not set
1163CONFIG_CRYPTO_HW=y
1164# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1259 1165
1260# 1166#
1261# Library routines 1167# Library routines
1262# 1168#
1263CONFIG_BITREVERSE=y 1169CONFIG_BITREVERSE=y
1170# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1264# CONFIG_CRC_CCITT is not set 1171# CONFIG_CRC_CCITT is not set
1265# CONFIG_CRC16 is not set 1172# CONFIG_CRC16 is not set
1173CONFIG_CRC_T10DIF=y
1174# CONFIG_CRC_ITU_T is not set
1266CONFIG_CRC32=y 1175CONFIG_CRC32=y
1176# CONFIG_CRC7 is not set
1267# CONFIG_LIBCRC32C is not set 1177# CONFIG_LIBCRC32C is not set
1268CONFIG_PLIST=y 1178CONFIG_PLIST=y
1269CONFIG_HAS_IOMEM=y 1179CONFIG_HAS_IOMEM=y
1270CONFIG_HAS_IOPORT=y 1180CONFIG_HAS_IOPORT=y
1181CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/magicpanelr2_defconfig b/arch/sh/configs/magicpanelr2_defconfig
index f8398a5f10ee..a3a80f3d27c0 100644
--- a/arch/sh/configs/magicpanelr2_defconfig
+++ b/arch/sh/configs/magicpanelr2_defconfig
@@ -1,9 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23-rc2 3# Linux kernel version: 2.6.26
4# Fri Aug 17 12:15:16 2007 4# Wed Jul 30 01:41:08 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
9CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -18,6 +20,7 @@ CONFIG_LOCKDEP_SUPPORT=y
18# CONFIG_ARCH_HAS_ILOG2_U32 is not set 20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
19# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
20CONFIG_ARCH_NO_VIRT_TO_BUS=y 22CONFIG_ARCH_NO_VIRT_TO_BUS=y
23CONFIG_ARCH_SUPPORTS_AOUT=y
21CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
22 25
23# 26#
@@ -35,12 +38,16 @@ CONFIG_POSIX_MQUEUE=y
35CONFIG_BSD_PROCESS_ACCT=y 38CONFIG_BSD_PROCESS_ACCT=y
36CONFIG_BSD_PROCESS_ACCT_V3=y 39CONFIG_BSD_PROCESS_ACCT_V3=y
37# CONFIG_TASKSTATS is not set 40# CONFIG_TASKSTATS is not set
38# CONFIG_USER_NS is not set
39CONFIG_AUDIT=y 41CONFIG_AUDIT=y
42# CONFIG_AUDITSYSCALL is not set
40# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=17 44CONFIG_LOG_BUF_SHIFT=17
45# CONFIG_CGROUPS is not set
46# CONFIG_GROUP_SCHED is not set
42CONFIG_SYSFS_DEPRECATED=y 47CONFIG_SYSFS_DEPRECATED=y
48CONFIG_SYSFS_DEPRECATED_V2=y
43CONFIG_RELAY=y 49CONFIG_RELAY=y
50# CONFIG_NAMESPACES is not set
44CONFIG_BLK_DEV_INITRD=y 51CONFIG_BLK_DEV_INITRD=y
45CONFIG_INITRAMFS_SOURCE="" 52CONFIG_INITRAMFS_SOURCE=""
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 53# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -48,6 +55,7 @@ CONFIG_SYSCTL=y
48CONFIG_EMBEDDED=y 55CONFIG_EMBEDDED=y
49CONFIG_UID16=y 56CONFIG_UID16=y
50CONFIG_SYSCTL_SYSCALL=y 57CONFIG_SYSCTL_SYSCALL=y
58CONFIG_SYSCTL_SYSCALL_CHECK=y
51CONFIG_KALLSYMS=y 59CONFIG_KALLSYMS=y
52CONFIG_KALLSYMS_ALL=y 60CONFIG_KALLSYMS_ALL=y
53# CONFIG_KALLSYMS_EXTRA_PASS is not set 61# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -55,6 +63,7 @@ CONFIG_HOTPLUG=y
55CONFIG_PRINTK=y 63CONFIG_PRINTK=y
56CONFIG_BUG=y 64CONFIG_BUG=y
57CONFIG_ELF_CORE=y 65CONFIG_ELF_CORE=y
66CONFIG_COMPAT_BRK=y
58CONFIG_BASE_FULL=y 67CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y 68CONFIG_FUTEX=y
60CONFIG_ANON_INODES=y 69CONFIG_ANON_INODES=y
@@ -67,10 +76,24 @@ CONFIG_VM_EVENT_COUNTERS=y
67CONFIG_SLAB=y 76CONFIG_SLAB=y
68# CONFIG_SLUB is not set 77# CONFIG_SLUB is not set
69# CONFIG_SLOB 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_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
83# CONFIG_HAVE_IOREMAP_PROT is not set
84# CONFIG_HAVE_KPROBES is not set
85# CONFIG_HAVE_KRETPROBES is not set
86# CONFIG_HAVE_ARCH_TRACEHOOK is not set
87# CONFIG_HAVE_DMA_ATTRS is not set
88# CONFIG_USE_GENERIC_SMP_HELPERS is not set
89CONFIG_HAVE_CLK=y
90CONFIG_PROC_PAGE_MONITOR=y
91CONFIG_SLABINFO=y
70CONFIG_RT_MUTEXES=y 92CONFIG_RT_MUTEXES=y
71# CONFIG_TINY_SHMEM is not set 93# CONFIG_TINY_SHMEM is not set
72CONFIG_BASE_SMALL=0 94CONFIG_BASE_SMALL=0
73CONFIG_MODULES=y 95CONFIG_MODULES=y
96# CONFIG_MODULE_FORCE_LOAD is not set
74CONFIG_MODULE_UNLOAD=y 97CONFIG_MODULE_UNLOAD=y
75# CONFIG_MODULE_FORCE_UNLOAD is not set 98# CONFIG_MODULE_FORCE_UNLOAD is not set
76CONFIG_MODVERSIONS=y 99CONFIG_MODVERSIONS=y
@@ -81,6 +104,7 @@ CONFIG_BLOCK=y
81# CONFIG_BLK_DEV_IO_TRACE is not set 104# CONFIG_BLK_DEV_IO_TRACE is not set
82# CONFIG_LSF is not set 105# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set 106# CONFIG_BLK_DEV_BSG is not set
107# CONFIG_BLK_DEV_INTEGRITY is not set
84 108
85# 109#
86# IO Schedulers 110# IO Schedulers
@@ -94,13 +118,17 @@ CONFIG_IOSCHED_NOOP=y
94# CONFIG_DEFAULT_CFQ is not set 118# CONFIG_DEFAULT_CFQ is not set
95CONFIG_DEFAULT_NOOP=y 119CONFIG_DEFAULT_NOOP=y
96CONFIG_DEFAULT_IOSCHED="noop" 120CONFIG_DEFAULT_IOSCHED="noop"
121CONFIG_CLASSIC_RCU=y
97 122
98# 123#
99# System type 124# System type
100# 125#
101CONFIG_CPU_SH3=y 126CONFIG_CPU_SH3=y
102# CONFIG_CPU_SUBTYPE_SH7619 is not set 127# CONFIG_CPU_SUBTYPE_SH7619 is not set
128# CONFIG_CPU_SUBTYPE_SH7203 is not set
103# CONFIG_CPU_SUBTYPE_SH7206 is not set 129# CONFIG_CPU_SUBTYPE_SH7206 is not set
130# CONFIG_CPU_SUBTYPE_SH7263 is not set
131# CONFIG_CPU_SUBTYPE_MXG is not set
104# CONFIG_CPU_SUBTYPE_SH7705 is not set 132# CONFIG_CPU_SUBTYPE_SH7705 is not set
105# CONFIG_CPU_SUBTYPE_SH7706 is not set 133# CONFIG_CPU_SUBTYPE_SH7706 is not set
106# CONFIG_CPU_SUBTYPE_SH7707 is not set 134# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -109,6 +137,7 @@ CONFIG_CPU_SH3=y
109# CONFIG_CPU_SUBTYPE_SH7710 is not set 137# CONFIG_CPU_SUBTYPE_SH7710 is not set
110# CONFIG_CPU_SUBTYPE_SH7712 is not set 138# CONFIG_CPU_SUBTYPE_SH7712 is not set
111CONFIG_CPU_SUBTYPE_SH7720=y 139CONFIG_CPU_SUBTYPE_SH7720=y
140# CONFIG_CPU_SUBTYPE_SH7721 is not set
112# CONFIG_CPU_SUBTYPE_SH7750 is not set 141# CONFIG_CPU_SUBTYPE_SH7750 is not set
113# CONFIG_CPU_SUBTYPE_SH7091 is not set 142# CONFIG_CPU_SUBTYPE_SH7091 is not set
114# CONFIG_CPU_SUBTYPE_SH7750R is not set 143# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -117,14 +146,17 @@ CONFIG_CPU_SUBTYPE_SH7720=y
117# CONFIG_CPU_SUBTYPE_SH7751R is not set 146# CONFIG_CPU_SUBTYPE_SH7751R is not set
118# CONFIG_CPU_SUBTYPE_SH7760 is not set 147# CONFIG_CPU_SUBTYPE_SH7760 is not set
119# CONFIG_CPU_SUBTYPE_SH4_202 is not set 148# CONFIG_CPU_SUBTYPE_SH4_202 is not set
120# CONFIG_CPU_SUBTYPE_ST40STB1 is not set 149# CONFIG_CPU_SUBTYPE_SH7723 is not set
121# CONFIG_CPU_SUBTYPE_ST40GX1 is not set 150# CONFIG_CPU_SUBTYPE_SH7763 is not set
122# CONFIG_CPU_SUBTYPE_SH7770 is not set 151# CONFIG_CPU_SUBTYPE_SH7770 is not set
123# CONFIG_CPU_SUBTYPE_SH7780 is not set 152# CONFIG_CPU_SUBTYPE_SH7780 is not set
124# CONFIG_CPU_SUBTYPE_SH7785 is not set 153# CONFIG_CPU_SUBTYPE_SH7785 is not set
125# CONFIG_CPU_SUBTYPE_SHX3 is not set 154# CONFIG_CPU_SUBTYPE_SHX3 is not set
126# CONFIG_CPU_SUBTYPE_SH7343 is not set 155# CONFIG_CPU_SUBTYPE_SH7343 is not set
127# CONFIG_CPU_SUBTYPE_SH7722 is not set 156# CONFIG_CPU_SUBTYPE_SH7722 is not set
157# CONFIG_CPU_SUBTYPE_SH7366 is not set
158# CONFIG_CPU_SUBTYPE_SH5_101 is not set
159# CONFIG_CPU_SUBTYPE_SH5_103 is not set
128 160
129# 161#
130# Memory management options 162# Memory management options
@@ -134,6 +166,7 @@ CONFIG_MMU=y
134CONFIG_PAGE_OFFSET=0x80000000 166CONFIG_PAGE_OFFSET=0x80000000
135CONFIG_MEMORY_START=0x0C000000 167CONFIG_MEMORY_START=0x0C000000
136CONFIG_MEMORY_SIZE=0x03F00000 168CONFIG_MEMORY_SIZE=0x03F00000
169CONFIG_29BIT=y
137CONFIG_VSYSCALL=y 170CONFIG_VSYSCALL=y
138CONFIG_ARCH_FLATMEM_ENABLE=y 171CONFIG_ARCH_FLATMEM_ENABLE=y
139CONFIG_ARCH_SPARSEMEM_ENABLE=y 172CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -143,7 +176,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
143CONFIG_ARCH_SELECT_MEMORY_MODEL=y 176CONFIG_ARCH_SELECT_MEMORY_MODEL=y
144CONFIG_PAGE_SIZE_4KB=y 177CONFIG_PAGE_SIZE_4KB=y
145# CONFIG_PAGE_SIZE_8KB is not set 178# CONFIG_PAGE_SIZE_8KB is not set
179# CONFIG_PAGE_SIZE_16KB is not set
146# CONFIG_PAGE_SIZE_64KB is not set 180# CONFIG_PAGE_SIZE_64KB is not set
181CONFIG_ENTRY_OFFSET=0x00001000
147CONFIG_SELECT_MEMORY_MODEL=y 182CONFIG_SELECT_MEMORY_MODEL=y
148CONFIG_FLATMEM_MANUAL=y 183CONFIG_FLATMEM_MANUAL=y
149# CONFIG_DISCONTIGMEM_MANUAL is not set 184# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -151,6 +186,8 @@ CONFIG_FLATMEM_MANUAL=y
151CONFIG_FLATMEM=y 186CONFIG_FLATMEM=y
152CONFIG_FLAT_NODE_MEM_MAP=y 187CONFIG_FLAT_NODE_MEM_MAP=y
153CONFIG_SPARSEMEM_STATIC=y 188CONFIG_SPARSEMEM_STATIC=y
189# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
190CONFIG_PAGEFLAGS_EXTENDED=y
154CONFIG_SPLIT_PTLOCK_CPUS=4 191CONFIG_SPLIT_PTLOCK_CPUS=4
155# CONFIG_RESOURCES_64BIT is not set 192# CONFIG_RESOURCES_64BIT is not set
156CONFIG_ZONE_DMA_FLAG=0 193CONFIG_ZONE_DMA_FLAG=0
@@ -173,7 +210,6 @@ CONFIG_CPU_LITTLE_ENDIAN=y
173CONFIG_SH_DSP=y 210CONFIG_SH_DSP=y
174CONFIG_SH_ADC=y 211CONFIG_SH_ADC=y
175CONFIG_CPU_HAS_INTEVT=y 212CONFIG_CPU_HAS_INTEVT=y
176CONFIG_CPU_HAS_INTC_IRQ=y
177CONFIG_CPU_HAS_SR_RB=y 213CONFIG_CPU_HAS_SR_RB=y
178CONFIG_CPU_HAS_DSP=y 214CONFIG_CPU_HAS_DSP=y
179 215
@@ -196,6 +232,7 @@ CONFIG_SH_PCLK_FREQ=24000000
196# CONFIG_TICK_ONESHOT is not set 232# CONFIG_TICK_ONESHOT is not set
197# CONFIG_NO_HZ is not set 233# CONFIG_NO_HZ is not set
198# CONFIG_HIGH_RES_TIMERS is not set 234# CONFIG_HIGH_RES_TIMERS is not set
235CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
199 236
200# 237#
201# CPU Frequency scaling 238# CPU Frequency scaling
@@ -228,11 +265,14 @@ CONFIG_HZ_250=y
228# CONFIG_HZ_300 is not set 265# CONFIG_HZ_300 is not set
229# CONFIG_HZ_1000 is not set 266# CONFIG_HZ_1000 is not set
230CONFIG_HZ=250 267CONFIG_HZ=250
268# CONFIG_SCHED_HRTICK is not set
231# CONFIG_KEXEC is not set 269# CONFIG_KEXEC is not set
232# CONFIG_CRASH_DUMP is not set 270# CONFIG_CRASH_DUMP is not set
233CONFIG_PREEMPT_NONE=y 271CONFIG_PREEMPT_NONE=y
234# CONFIG_PREEMPT_VOLUNTARY is not set 272# CONFIG_PREEMPT_VOLUNTARY is not set
235# CONFIG_PREEMPT is not set 273# CONFIG_PREEMPT is not set
274CONFIG_GUSA=y
275# CONFIG_GUSA_RB is not set
236 276
237# 277#
238# Boot options 278# Boot options
@@ -245,10 +285,6 @@ CONFIG_BOOT_LINK_OFFSET=0x00800000
245# Bus options 285# Bus options
246# 286#
247# CONFIG_ARCH_SUPPORTS_MSI is not set 287# CONFIG_ARCH_SUPPORTS_MSI is not set
248
249#
250# PCCARD (PCMCIA/CardBus) support
251#
252# CONFIG_PCCARD is not set 288# CONFIG_PCCARD is not set
253 289
254# 290#
@@ -289,6 +325,7 @@ CONFIG_IP_PNP_DHCP=y
289# CONFIG_INET_XFRM_MODE_TRANSPORT is not set 325# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
290# CONFIG_INET_XFRM_MODE_TUNNEL is not set 326# CONFIG_INET_XFRM_MODE_TUNNEL is not set
291# CONFIG_INET_XFRM_MODE_BEET is not set 327# CONFIG_INET_XFRM_MODE_BEET is not set
328# CONFIG_INET_LRO is not set
292CONFIG_INET_DIAG=y 329CONFIG_INET_DIAG=y
293CONFIG_INET_TCP_DIAG=y 330CONFIG_INET_TCP_DIAG=y
294# CONFIG_TCP_CONG_ADVANCED is not set 331# CONFIG_TCP_CONG_ADVANCED is not set
@@ -296,8 +333,6 @@ CONFIG_TCP_CONG_CUBIC=y
296CONFIG_DEFAULT_TCP_CONG="cubic" 333CONFIG_DEFAULT_TCP_CONG="cubic"
297# CONFIG_TCP_MD5SIG is not set 334# CONFIG_TCP_MD5SIG is not set
298# CONFIG_IPV6 is not set 335# CONFIG_IPV6 is not set
299# CONFIG_INET6_XFRM_TUNNEL is not set
300# CONFIG_INET6_TUNNEL is not set
301# CONFIG_NETWORK_SECMARK is not set 336# CONFIG_NETWORK_SECMARK is not set
302# CONFIG_NETFILTER is not set 337# CONFIG_NETFILTER is not set
303# CONFIG_IP_DCCP is not set 338# CONFIG_IP_DCCP is not set
@@ -314,10 +349,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
314# CONFIG_LAPB is not set 349# CONFIG_LAPB is not set
315# CONFIG_ECONET is not set 350# CONFIG_ECONET is not set
316# CONFIG_WAN_ROUTER is not set 351# CONFIG_WAN_ROUTER is not set
317
318#
319# QoS and/or fair queueing
320#
321# CONFIG_NET_SCHED is not set 352# CONFIG_NET_SCHED is not set
322 353
323# 354#
@@ -325,6 +356,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
325# 356#
326# CONFIG_NET_PKTGEN is not set 357# CONFIG_NET_PKTGEN is not set
327# CONFIG_HAMRADIO is not set 358# CONFIG_HAMRADIO is not set
359# CONFIG_CAN is not set
328# CONFIG_IRDA is not set 360# CONFIG_IRDA is not set
329# CONFIG_BT is not set 361# CONFIG_BT is not set
330# CONFIG_AF_RXRPC is not set 362# CONFIG_AF_RXRPC is not set
@@ -346,9 +378,12 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
346# 378#
347# Generic Driver Options 379# Generic Driver Options
348# 380#
381CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
349# CONFIG_STANDALONE is not set 382# CONFIG_STANDALONE is not set
350# CONFIG_PREVENT_FIRMWARE_BUILD is not set 383# CONFIG_PREVENT_FIRMWARE_BUILD is not set
351CONFIG_FW_LOADER=y 384CONFIG_FW_LOADER=y
385CONFIG_FIRMWARE_IN_KERNEL=y
386CONFIG_EXTRA_FIRMWARE=""
352# CONFIG_DEBUG_DRIVER is not set 387# CONFIG_DEBUG_DRIVER is not set
353# CONFIG_DEBUG_DEVRES is not set 388# CONFIG_DEBUG_DEVRES is not set
354# CONFIG_SYS_HYPERVISOR is not set 389# CONFIG_SYS_HYPERVISOR is not set
@@ -362,6 +397,7 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
362# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set 397# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
363# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set 398# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
364CONFIG_MTD_CMDLINE_PARTS=y 399CONFIG_MTD_CMDLINE_PARTS=y
400# CONFIG_MTD_AR7_PARTS is not set
365 401
366# 402#
367# User Modules And Translation Layers 403# User Modules And Translation Layers
@@ -374,6 +410,7 @@ CONFIG_MTD_BLOCK=y
374# CONFIG_INFTL is not set 410# CONFIG_INFTL is not set
375# CONFIG_RFD_FTL is not set 411# CONFIG_RFD_FTL is not set
376# CONFIG_SSFDC is not set 412# CONFIG_SSFDC is not set
413# CONFIG_MTD_OOPS is not set
377 414
378# 415#
379# RAM/ROM/Flash chip drivers 416# RAM/ROM/Flash chip drivers
@@ -408,7 +445,6 @@ CONFIG_MTD_PHYSMAP=y
408CONFIG_MTD_PHYSMAP_START=0x0000000 445CONFIG_MTD_PHYSMAP_START=0x0000000
409CONFIG_MTD_PHYSMAP_LEN=0 446CONFIG_MTD_PHYSMAP_LEN=0
410CONFIG_MTD_PHYSMAP_BANKWIDTH=0 447CONFIG_MTD_PHYSMAP_BANKWIDTH=0
411# CONFIG_MTD_SOLUTIONENGINE is not set
412# CONFIG_MTD_PLATRAM is not set 448# CONFIG_MTD_PLATRAM is not set
413 449
414# 450#
@@ -440,11 +476,14 @@ CONFIG_BLK_DEV=y
440CONFIG_BLK_DEV_RAM=y 476CONFIG_BLK_DEV_RAM=y
441CONFIG_BLK_DEV_RAM_COUNT=16 477CONFIG_BLK_DEV_RAM_COUNT=16
442CONFIG_BLK_DEV_RAM_SIZE=65536 478CONFIG_BLK_DEV_RAM_SIZE=65536
443CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 479# CONFIG_BLK_DEV_XIP is not set
444# CONFIG_CDROM_PKTCDVD is not set 480# CONFIG_CDROM_PKTCDVD is not set
445# CONFIG_ATA_OVER_ETH is not set 481# CONFIG_ATA_OVER_ETH is not set
482# CONFIG_BLK_DEV_HD is not set
446CONFIG_MISC_DEVICES=y 483CONFIG_MISC_DEVICES=y
447# CONFIG_EEPROM_93CX6 is not set 484# CONFIG_EEPROM_93CX6 is not set
485# CONFIG_ENCLOSURE_SERVICES is not set
486CONFIG_HAVE_IDE=y
448# CONFIG_IDE is not set 487# CONFIG_IDE is not set
449 488
450# 489#
@@ -457,18 +496,24 @@ CONFIG_MISC_DEVICES=y
457# CONFIG_ATA is not set 496# CONFIG_ATA is not set
458# CONFIG_MD is not set 497# CONFIG_MD is not set
459CONFIG_NETDEVICES=y 498CONFIG_NETDEVICES=y
460# CONFIG_NETDEVICES_MULTIQUEUE is not set
461# CONFIG_DUMMY is not set 499# CONFIG_DUMMY is not set
462# CONFIG_BONDING is not set 500# CONFIG_BONDING is not set
463# CONFIG_MACVLAN is not set 501# CONFIG_MACVLAN is not set
464# CONFIG_EQUALIZER is not set 502# CONFIG_EQUALIZER is not set
465# CONFIG_TUN is not set 503# CONFIG_TUN is not set
504# CONFIG_VETH is not set
466# CONFIG_PHYLIB is not set 505# CONFIG_PHYLIB is not set
467CONFIG_NET_ETHERNET=y 506CONFIG_NET_ETHERNET=y
468CONFIG_MII=y 507CONFIG_MII=y
508# CONFIG_AX88796 is not set
469# CONFIG_STNIC is not set 509# CONFIG_STNIC is not set
470# CONFIG_SMC91X is not set 510# CONFIG_SMC91X is not set
471CONFIG_SMC911X=y 511CONFIG_SMC911X=y
512# CONFIG_IBM_NEW_EMAC_ZMII is not set
513# CONFIG_IBM_NEW_EMAC_RGMII is not set
514# CONFIG_IBM_NEW_EMAC_TAH is not set
515# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
516# CONFIG_B44 is not set
472# CONFIG_NETDEV_1000 is not set 517# CONFIG_NETDEV_1000 is not set
473# CONFIG_NETDEV_10000 is not set 518# CONFIG_NETDEV_10000 is not set
474 519
@@ -477,10 +522,10 @@ CONFIG_SMC911X=y
477# 522#
478# CONFIG_WLAN_PRE80211 is not set 523# CONFIG_WLAN_PRE80211 is not set
479# CONFIG_WLAN_80211 is not set 524# CONFIG_WLAN_80211 is not set
525# CONFIG_IWLWIFI_LEDS is not set
480# CONFIG_WAN is not set 526# CONFIG_WAN is not set
481# CONFIG_PPP is not set 527# CONFIG_PPP is not set
482# CONFIG_SLIP is not set 528# CONFIG_SLIP is not set
483# CONFIG_SHAPER is not set
484# CONFIG_NETCONSOLE is not set 529# CONFIG_NETCONSOLE is not set
485# CONFIG_NETPOLL is not set 530# CONFIG_NETPOLL is not set
486# CONFIG_NET_POLL_CONTROLLER is not set 531# CONFIG_NET_POLL_CONTROLLER is not set
@@ -502,7 +547,6 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
502CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 547CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
503CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 548CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
504# CONFIG_INPUT_JOYDEV is not set 549# CONFIG_INPUT_JOYDEV is not set
505# CONFIG_INPUT_TSDEV is not set
506CONFIG_INPUT_EVDEV=y 550CONFIG_INPUT_EVDEV=y
507# CONFIG_INPUT_EVBUG is not set 551# CONFIG_INPUT_EVBUG is not set
508 552
@@ -516,6 +560,7 @@ CONFIG_KEYBOARD_ATKBD=y
516# CONFIG_KEYBOARD_XTKBD is not set 560# CONFIG_KEYBOARD_XTKBD is not set
517# CONFIG_KEYBOARD_NEWTON is not set 561# CONFIG_KEYBOARD_NEWTON is not set
518# CONFIG_KEYBOARD_STOWAWAY is not set 562# CONFIG_KEYBOARD_STOWAWAY is not set
563# CONFIG_KEYBOARD_SH_KEYSC is not set
519CONFIG_INPUT_MOUSE=y 564CONFIG_INPUT_MOUSE=y
520# CONFIG_MOUSE_PS2 is not set 565# CONFIG_MOUSE_PS2 is not set
521# CONFIG_MOUSE_SERIAL is not set 566# CONFIG_MOUSE_SERIAL is not set
@@ -539,9 +584,11 @@ CONFIG_SERIO_LIBPS2=y
539# Character devices 584# Character devices
540# 585#
541CONFIG_VT=y 586CONFIG_VT=y
587CONFIG_CONSOLE_TRANSLATIONS=y
542CONFIG_VT_CONSOLE=y 588CONFIG_VT_CONSOLE=y
543CONFIG_HW_CONSOLE=y 589CONFIG_HW_CONSOLE=y
544# CONFIG_VT_HW_CONSOLE_BINDING is not set 590# CONFIG_VT_HW_CONSOLE_BINDING is not set
591CONFIG_DEVKMEM=y
545# CONFIG_SERIAL_NONSTANDARD is not set 592# CONFIG_SERIAL_NONSTANDARD is not set
546 593
547# 594#
@@ -569,60 +616,72 @@ CONFIG_UNIX98_PTYS=y
569CONFIG_LEGACY_PTYS=y 616CONFIG_LEGACY_PTYS=y
570CONFIG_LEGACY_PTY_COUNT=256 617CONFIG_LEGACY_PTY_COUNT=256
571# CONFIG_IPMI_HANDLER is not set 618# CONFIG_IPMI_HANDLER is not set
572# CONFIG_WATCHDOG is not set
573# CONFIG_HW_RANDOM is not set 619# CONFIG_HW_RANDOM is not set
574# CONFIG_R3964 is not set 620# CONFIG_R3964 is not set
575# CONFIG_RAW_DRIVER is not set 621# CONFIG_RAW_DRIVER is not set
576# CONFIG_TCG_TPM is not set 622# CONFIG_TCG_TPM is not set
577# CONFIG_I2C is not set 623# CONFIG_I2C is not set
578
579#
580# SPI support
581#
582# CONFIG_SPI is not set 624# CONFIG_SPI is not set
583# CONFIG_SPI_MASTER is not set
584# CONFIG_W1 is not set 625# CONFIG_W1 is not set
585# CONFIG_POWER_SUPPLY is not set 626# CONFIG_POWER_SUPPLY is not set
586# CONFIG_HWMON is not set 627# CONFIG_HWMON is not set
628# CONFIG_THERMAL is not set
629# CONFIG_THERMAL_HWMON is not set
630# CONFIG_WATCHDOG is not set
631
632#
633# Sonics Silicon Backplane
634#
635CONFIG_SSB_POSSIBLE=y
636# CONFIG_SSB is not set
587 637
588# 638#
589# Multifunction device drivers 639# Multifunction device drivers
590# 640#
641# CONFIG_MFD_CORE is not set
591# CONFIG_MFD_SM501 is not set 642# CONFIG_MFD_SM501 is not set
643# CONFIG_HTC_PASIC3 is not set
592 644
593# 645#
594# Multimedia devices 646# Multimedia devices
595# 647#
648
649#
650# Multimedia core support
651#
596# CONFIG_VIDEO_DEV is not set 652# CONFIG_VIDEO_DEV is not set
597# CONFIG_DVB_CORE is not set 653# CONFIG_DVB_CORE is not set
654# CONFIG_VIDEO_MEDIA is not set
655
656#
657# Multimedia drivers
658#
598CONFIG_DAB=y 659CONFIG_DAB=y
599 660
600# 661#
601# Graphics support 662# Graphics support
602# 663#
664# CONFIG_VGASTATE is not set
665# CONFIG_VIDEO_OUTPUT_CONTROL is not set
666# CONFIG_FB is not set
603# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 667# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
604 668
605# 669#
606# Display device support 670# Display device support
607# 671#
608# CONFIG_DISPLAY_SUPPORT is not set 672# CONFIG_DISPLAY_SUPPORT is not set
609# CONFIG_VGASTATE is not set
610# CONFIG_VIDEO_OUTPUT_CONTROL is not set
611# CONFIG_FB is not set
612 673
613# 674#
614# Console display driver support 675# Console display driver support
615# 676#
616CONFIG_DUMMY_CONSOLE=y 677CONFIG_DUMMY_CONSOLE=y
617
618#
619# Sound
620#
621# CONFIG_SOUND is not set 678# CONFIG_SOUND is not set
622# CONFIG_HID_SUPPORT is not set 679# CONFIG_HID_SUPPORT is not set
623# CONFIG_USB_SUPPORT is not set 680# CONFIG_USB_SUPPORT is not set
624# CONFIG_MMC is not set 681# CONFIG_MMC is not set
682# CONFIG_MEMSTICK is not set
625# CONFIG_NEW_LEDS is not set 683# CONFIG_NEW_LEDS is not set
684# CONFIG_ACCESSIBILITY is not set
626CONFIG_RTC_LIB=y 685CONFIG_RTC_LIB=y
627CONFIG_RTC_CLASS=y 686CONFIG_RTC_CLASS=y
628# CONFIG_RTC_HCTOSYS is not set 687# CONFIG_RTC_HCTOSYS is not set
@@ -644,9 +703,10 @@ CONFIG_RTC_INTF_DEV=y
644# 703#
645# Platform RTC drivers 704# Platform RTC drivers
646# 705#
706# CONFIG_RTC_DRV_DS1511 is not set
647# CONFIG_RTC_DRV_DS1553 is not set 707# CONFIG_RTC_DRV_DS1553 is not set
648# CONFIG_RTC_DRV_STK17TA8 is not set
649# CONFIG_RTC_DRV_DS1742 is not set 708# CONFIG_RTC_DRV_DS1742 is not set
709# CONFIG_RTC_DRV_STK17TA8 is not set
650# CONFIG_RTC_DRV_M48T86 is not set 710# CONFIG_RTC_DRV_M48T86 is not set
651# CONFIG_RTC_DRV_M48T59 is not set 711# CONFIG_RTC_DRV_M48T59 is not set
652# CONFIG_RTC_DRV_V3020 is not set 712# CONFIG_RTC_DRV_V3020 is not set
@@ -655,23 +715,7 @@ CONFIG_RTC_INTF_DEV=y
655# on-CPU RTC drivers 715# on-CPU RTC drivers
656# 716#
657CONFIG_RTC_DRV_SH=y 717CONFIG_RTC_DRV_SH=y
658 718# CONFIG_DMADEVICES is not set
659#
660# DMA Engine support
661#
662# CONFIG_DMA_ENGINE is not set
663
664#
665# DMA Clients
666#
667
668#
669# DMA Devices
670#
671
672#
673# Userspace I/O
674#
675# CONFIG_UIO is not set 719# CONFIG_UIO is not set
676 720
677# 721#
@@ -684,18 +728,14 @@ CONFIG_EXT3_FS=y
684# CONFIG_EXT3_FS_XATTR is not set 728# CONFIG_EXT3_FS_XATTR is not set
685# CONFIG_EXT4DEV_FS is not set 729# CONFIG_EXT4DEV_FS is not set
686CONFIG_JBD=y 730CONFIG_JBD=y
687# CONFIG_JBD_DEBUG is not set
688# CONFIG_REISERFS_FS is not set 731# CONFIG_REISERFS_FS is not set
689# CONFIG_JFS_FS is not set 732# CONFIG_JFS_FS is not set
690# CONFIG_FS_POSIX_ACL is not set 733# CONFIG_FS_POSIX_ACL is not set
691# CONFIG_XFS_FS is not set 734# CONFIG_XFS_FS is not set
692# CONFIG_GFS2_FS is not set
693# CONFIG_OCFS2_FS is not set 735# CONFIG_OCFS2_FS is not set
694# CONFIG_MINIX_FS is not set 736# CONFIG_DNOTIFY is not set
695# CONFIG_ROMFS_FS is not set
696# CONFIG_INOTIFY is not set 737# CONFIG_INOTIFY is not set
697# CONFIG_QUOTA is not set 738# CONFIG_QUOTA is not set
698# CONFIG_DNOTIFY is not set
699# CONFIG_AUTOFS_FS is not set 739# CONFIG_AUTOFS_FS is not set
700# CONFIG_AUTOFS4_FS is not set 740# CONFIG_AUTOFS4_FS is not set
701# CONFIG_FUSE_FS is not set 741# CONFIG_FUSE_FS is not set
@@ -724,7 +764,6 @@ CONFIG_TMPFS=y
724# CONFIG_TMPFS_POSIX_ACL is not set 764# CONFIG_TMPFS_POSIX_ACL is not set
725# CONFIG_HUGETLBFS is not set 765# CONFIG_HUGETLBFS is not set
726# CONFIG_HUGETLB_PAGE is not set 766# CONFIG_HUGETLB_PAGE is not set
727CONFIG_RAMFS=y
728# CONFIG_CONFIGFS_FS is not set 767# CONFIG_CONFIGFS_FS is not set
729 768
730# 769#
@@ -744,30 +783,29 @@ CONFIG_JFFS2_FS_DEBUG=0
744# CONFIG_JFFS2_FS_XATTR is not set 783# CONFIG_JFFS2_FS_XATTR is not set
745# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 784# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
746CONFIG_JFFS2_ZLIB=y 785CONFIG_JFFS2_ZLIB=y
786# CONFIG_JFFS2_LZO is not set
747CONFIG_JFFS2_RTIME=y 787CONFIG_JFFS2_RTIME=y
748# CONFIG_JFFS2_RUBIN is not set 788# CONFIG_JFFS2_RUBIN is not set
749# CONFIG_CRAMFS is not set 789# CONFIG_CRAMFS is not set
750# CONFIG_VXFS_FS is not set 790# CONFIG_VXFS_FS is not set
791# CONFIG_MINIX_FS is not set
792# CONFIG_OMFS_FS is not set
751# CONFIG_HPFS_FS is not set 793# CONFIG_HPFS_FS is not set
752# CONFIG_QNX4FS_FS is not set 794# CONFIG_QNX4FS_FS is not set
795# CONFIG_ROMFS_FS is not set
753# CONFIG_SYSV_FS is not set 796# CONFIG_SYSV_FS is not set
754# CONFIG_UFS_FS is not set 797# CONFIG_UFS_FS is not set
755 798CONFIG_NETWORK_FILESYSTEMS=y
756#
757# Network File Systems
758#
759CONFIG_NFS_FS=y 799CONFIG_NFS_FS=y
760CONFIG_NFS_V3=y 800CONFIG_NFS_V3=y
761# CONFIG_NFS_V3_ACL is not set 801# CONFIG_NFS_V3_ACL is not set
762# CONFIG_NFS_V4 is not set 802# CONFIG_NFS_V4 is not set
763# CONFIG_NFS_DIRECTIO is not set
764# CONFIG_NFSD is not set
765CONFIG_ROOT_NFS=y 803CONFIG_ROOT_NFS=y
804# CONFIG_NFSD is not set
766CONFIG_LOCKD=y 805CONFIG_LOCKD=y
767CONFIG_LOCKD_V4=y 806CONFIG_LOCKD_V4=y
768CONFIG_NFS_COMMON=y 807CONFIG_NFS_COMMON=y
769CONFIG_SUNRPC=y 808CONFIG_SUNRPC=y
770CONFIG_SUNRPC_BIND34=y
771# CONFIG_RPCSEC_GSS_KRB5 is not set 809# CONFIG_RPCSEC_GSS_KRB5 is not set
772# CONFIG_RPCSEC_GSS_SPKM3 is not set 810# CONFIG_RPCSEC_GSS_SPKM3 is not set
773# CONFIG_SMB_FS is not set 811# CONFIG_SMB_FS is not set
@@ -781,10 +819,6 @@ CONFIG_SUNRPC_BIND34=y
781# 819#
782# CONFIG_PARTITION_ADVANCED is not set 820# CONFIG_PARTITION_ADVANCED is not set
783CONFIG_MSDOS_PARTITION=y 821CONFIG_MSDOS_PARTITION=y
784
785#
786# Native Language Support
787#
788CONFIG_NLS=y 822CONFIG_NLS=y
789CONFIG_NLS_DEFAULT="cp437" 823CONFIG_NLS_DEFAULT="cp437"
790CONFIG_NLS_CODEPAGE_437=y 824CONFIG_NLS_CODEPAGE_437=y
@@ -825,23 +859,16 @@ CONFIG_NLS_ISO8859_1=y
825# CONFIG_NLS_KOI8_R is not set 859# CONFIG_NLS_KOI8_R is not set
826# CONFIG_NLS_KOI8_U is not set 860# CONFIG_NLS_KOI8_U is not set
827# CONFIG_NLS_UTF8 is not set 861# CONFIG_NLS_UTF8 is not set
828
829#
830# Distributed Lock Manager
831#
832# CONFIG_DLM is not set 862# CONFIG_DLM is not set
833 863
834# 864#
835# Profiling support
836#
837# CONFIG_PROFILING is not set
838
839#
840# Kernel hacking 865# Kernel hacking
841# 866#
842CONFIG_TRACE_IRQFLAGS_SUPPORT=y 867CONFIG_TRACE_IRQFLAGS_SUPPORT=y
843# CONFIG_PRINTK_TIME is not set 868# CONFIG_PRINTK_TIME is not set
869CONFIG_ENABLE_WARN_DEPRECATED=y
844CONFIG_ENABLE_MUST_CHECK=y 870CONFIG_ENABLE_MUST_CHECK=y
871CONFIG_FRAME_WARN=1024
845CONFIG_MAGIC_SYSRQ=y 872CONFIG_MAGIC_SYSRQ=y
846# CONFIG_UNUSED_SYMBOLS is not set 873# CONFIG_UNUSED_SYMBOLS is not set
847# CONFIG_DEBUG_FS is not set 874# CONFIG_DEBUG_FS is not set
@@ -852,6 +879,7 @@ CONFIG_DEBUG_KERNEL=y
852# CONFIG_SCHED_DEBUG is not set 879# CONFIG_SCHED_DEBUG is not set
853# CONFIG_SCHEDSTATS is not set 880# CONFIG_SCHEDSTATS is not set
854# CONFIG_TIMER_STATS is not set 881# CONFIG_TIMER_STATS is not set
882# CONFIG_DEBUG_OBJECTS is not set
855# CONFIG_DEBUG_SLAB is not set 883# CONFIG_DEBUG_SLAB is not set
856# CONFIG_DEBUG_RT_MUTEXES is not set 884# CONFIG_DEBUG_RT_MUTEXES is not set
857# CONFIG_RT_MUTEX_TESTER is not set 885# CONFIG_RT_MUTEX_TESTER is not set
@@ -866,11 +894,16 @@ CONFIG_DEBUG_KOBJECT=y
866CONFIG_DEBUG_BUGVERBOSE=y 894CONFIG_DEBUG_BUGVERBOSE=y
867CONFIG_DEBUG_INFO=y 895CONFIG_DEBUG_INFO=y
868# CONFIG_DEBUG_VM is not set 896# CONFIG_DEBUG_VM is not set
897# CONFIG_DEBUG_WRITECOUNT is not set
898# CONFIG_DEBUG_MEMORY_INIT is not set
869# CONFIG_DEBUG_LIST is not set 899# CONFIG_DEBUG_LIST is not set
900# CONFIG_DEBUG_SG is not set
870CONFIG_FRAME_POINTER=y 901CONFIG_FRAME_POINTER=y
871# CONFIG_FORCED_INLINING is not set 902# CONFIG_BOOT_PRINTK_DELAY is not set
872# CONFIG_RCU_TORTURE_TEST is not set 903# CONFIG_RCU_TORTURE_TEST is not set
904# CONFIG_BACKTRACE_SELF_TEST is not set
873# CONFIG_FAULT_INJECTION is not set 905# CONFIG_FAULT_INJECTION is not set
906# CONFIG_SAMPLES is not set
874# CONFIG_SH_STANDARD_BIOS is not set 907# CONFIG_SH_STANDARD_BIOS is not set
875CONFIG_EARLY_SCIF_CONSOLE=y 908CONFIG_EARLY_SCIF_CONSOLE=y
876CONFIG_EARLY_SCIF_CONSOLE_PORT=0xa4430000 909CONFIG_EARLY_SCIF_CONSOLE_PORT=0xa4430000
@@ -879,6 +912,7 @@ CONFIG_EARLY_PRINTK=y
879# CONFIG_DEBUG_STACKOVERFLOW is not set 912# CONFIG_DEBUG_STACKOVERFLOW is not set
880# CONFIG_DEBUG_STACK_USAGE is not set 913# CONFIG_DEBUG_STACK_USAGE is not set
881# CONFIG_4KSTACKS is not set 914# CONFIG_4KSTACKS is not set
915# CONFIG_IRQSTACKS is not set
882CONFIG_SH_KGDB=y 916CONFIG_SH_KGDB=y
883 917
884# 918#
@@ -904,14 +938,17 @@ CONFIG_KGDB_DEFBITS_8=y
904# 938#
905# CONFIG_KEYS is not set 939# CONFIG_KEYS is not set
906# CONFIG_SECURITY is not set 940# CONFIG_SECURITY is not set
941# CONFIG_SECURITY_FILE_CAPABILITIES is not set
907# CONFIG_CRYPTO is not set 942# CONFIG_CRYPTO is not set
908 943
909# 944#
910# Library routines 945# Library routines
911# 946#
912CONFIG_BITREVERSE=y 947CONFIG_BITREVERSE=y
948# CONFIG_GENERIC_FIND_FIRST_BIT is not set
913CONFIG_CRC_CCITT=m 949CONFIG_CRC_CCITT=m
914CONFIG_CRC16=m 950CONFIG_CRC16=m
951# CONFIG_CRC_T10DIF is not set
915# CONFIG_CRC_ITU_T is not set 952# CONFIG_CRC_ITU_T is not set
916CONFIG_CRC32=y 953CONFIG_CRC32=y
917# CONFIG_CRC7 is not set 954# CONFIG_CRC7 is not set
diff --git a/arch/sh/configs/microdev_defconfig b/arch/sh/configs/microdev_defconfig
index e89d951c3c16..e4b900e72dcd 100644
--- a/arch/sh/configs/microdev_defconfig
+++ b/arch/sh/configs/microdev_defconfig
@@ -1,28 +1,35 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18 3# Linux kernel version: 2.6.26
4# Tue Oct 3 11:27:01 2006 4# Wed Jul 30 01:47:16 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_BUG=y
8CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
9CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
11CONFIG_GENERIC_IRQ_PROBE=y 14CONFIG_GENERIC_IRQ_PROBE=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 15CONFIG_GENERIC_CALIBRATE_DELAY=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_CLOCKEVENTS=y
18CONFIG_STACKTRACE_SUPPORT=y
19CONFIG_LOCKDEP_SUPPORT=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y
23CONFIG_ARCH_SUPPORTS_AOUT=y
13CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
14 25
15# 26#
16# Code maturity level options 27# General setup
17# 28#
18CONFIG_EXPERIMENTAL=y 29CONFIG_EXPERIMENTAL=y
19CONFIG_BROKEN_ON_SMP=y 30CONFIG_BROKEN_ON_SMP=y
20CONFIG_LOCK_KERNEL=y 31CONFIG_LOCK_KERNEL=y
21CONFIG_INIT_ENV_ARG_LIMIT=32 32CONFIG_INIT_ENV_ARG_LIMIT=32
22
23#
24# General setup
25#
26CONFIG_LOCALVERSION="" 33CONFIG_LOCALVERSION=""
27CONFIG_LOCALVERSION_AUTO=y 34CONFIG_LOCALVERSION_AUTO=y
28CONFIG_SWAP=y 35CONFIG_SWAP=y
@@ -31,10 +38,16 @@ CONFIG_SWAP=y
31CONFIG_BSD_PROCESS_ACCT=y 38CONFIG_BSD_PROCESS_ACCT=y
32# CONFIG_BSD_PROCESS_ACCT_V3 is not set 39# CONFIG_BSD_PROCESS_ACCT_V3 is not set
33# CONFIG_TASKSTATS is not set 40# CONFIG_TASKSTATS is not set
34# CONFIG_UTS_NS is not set
35# CONFIG_AUDIT is not set 41# CONFIG_AUDIT is not set
36# CONFIG_IKCONFIG is not set 42# CONFIG_IKCONFIG is not set
43CONFIG_LOG_BUF_SHIFT=14
44# CONFIG_CGROUPS is not set
45# CONFIG_GROUP_SCHED is not set
46CONFIG_SYSFS_DEPRECATED=y
47CONFIG_SYSFS_DEPRECATED_V2=y
37# CONFIG_RELAY is not set 48# CONFIG_RELAY is not set
49# CONFIG_NAMESPACES is not set
50CONFIG_BLK_DEV_INITRD=y
38CONFIG_INITRAMFS_SOURCE="" 51CONFIG_INITRAMFS_SOURCE=""
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 52# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SYSCTL=y 53CONFIG_SYSCTL=y
@@ -47,29 +60,42 @@ CONFIG_HOTPLUG=y
47CONFIG_PRINTK=y 60CONFIG_PRINTK=y
48CONFIG_BUG=y 61CONFIG_BUG=y
49CONFIG_ELF_CORE=y 62CONFIG_ELF_CORE=y
63CONFIG_COMPAT_BRK=y
50CONFIG_BASE_FULL=y 64CONFIG_BASE_FULL=y
51CONFIG_FUTEX=y 65CONFIG_FUTEX=y
66CONFIG_ANON_INODES=y
52CONFIG_EPOLL=y 67CONFIG_EPOLL=y
68CONFIG_SIGNALFD=y
69CONFIG_TIMERFD=y
70CONFIG_EVENTFD=y
53CONFIG_SHMEM=y 71CONFIG_SHMEM=y
54CONFIG_SLAB=y
55CONFIG_VM_EVENT_COUNTERS=y 72CONFIG_VM_EVENT_COUNTERS=y
73CONFIG_SLAB=y
74# CONFIG_SLUB is not set
75# CONFIG_SLOB is not set
76# CONFIG_PROFILING is not set
77# CONFIG_MARKERS is not set
78CONFIG_HAVE_OPROFILE=y
79# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
80# CONFIG_HAVE_IOREMAP_PROT is not set
81# CONFIG_HAVE_KPROBES is not set
82# CONFIG_HAVE_KRETPROBES is not set
83# CONFIG_HAVE_ARCH_TRACEHOOK is not set
84# CONFIG_HAVE_DMA_ATTRS is not set
85# CONFIG_USE_GENERIC_SMP_HELPERS is not set
86CONFIG_HAVE_CLK=y
87CONFIG_PROC_PAGE_MONITOR=y
88CONFIG_SLABINFO=y
56CONFIG_RT_MUTEXES=y 89CONFIG_RT_MUTEXES=y
57# CONFIG_TINY_SHMEM is not set 90# CONFIG_TINY_SHMEM is not set
58CONFIG_BASE_SMALL=0 91CONFIG_BASE_SMALL=0
59# CONFIG_SLOB is not set
60
61#
62# Loadable module support
63#
64# CONFIG_MODULES is not set 92# CONFIG_MODULES is not set
65
66#
67# Block layer
68#
69CONFIG_BLOCK=y 93CONFIG_BLOCK=y
70# CONFIG_LBD is not set 94# CONFIG_LBD is not set
71# CONFIG_BLK_DEV_IO_TRACE is not set 95# CONFIG_BLK_DEV_IO_TRACE is not set
72# CONFIG_LSF is not set 96# CONFIG_LSF is not set
97# CONFIG_BLK_DEV_BSG is not set
98# CONFIG_BLK_DEV_INTEGRITY is not set
73 99
74# 100#
75# IO Schedulers 101# IO Schedulers
@@ -83,59 +109,26 @@ CONFIG_DEFAULT_AS=y
83# CONFIG_DEFAULT_CFQ is not set 109# CONFIG_DEFAULT_CFQ is not set
84# CONFIG_DEFAULT_NOOP is not set 110# CONFIG_DEFAULT_NOOP is not set
85CONFIG_DEFAULT_IOSCHED="anticipatory" 111CONFIG_DEFAULT_IOSCHED="anticipatory"
112CONFIG_CLASSIC_RCU=y
86 113
87# 114#
88# System type 115# System type
89# 116#
90# CONFIG_SH_SOLUTION_ENGINE is not set
91# CONFIG_SH_7751_SOLUTION_ENGINE is not set
92# CONFIG_SH_7300_SOLUTION_ENGINE is not set
93# CONFIG_SH_7343_SOLUTION_ENGINE is not set
94# CONFIG_SH_73180_SOLUTION_ENGINE is not set
95# CONFIG_SH_7751_SYSTEMH is not set
96# CONFIG_SH_HP6XX is not set
97# CONFIG_SH_EC3104 is not set
98# CONFIG_SH_SATURN is not set
99# CONFIG_SH_DREAMCAST is not set
100# CONFIG_SH_BIGSUR is not set
101# CONFIG_SH_MPC1211 is not set
102# CONFIG_SH_SH03 is not set
103# CONFIG_SH_SECUREEDGE5410 is not set
104# CONFIG_SH_HS7751RVOIP is not set
105# CONFIG_SH_7710VOIPGW is not set
106# CONFIG_SH_RTS7751R2D is not set
107# CONFIG_SH_R7780RP is not set
108# CONFIG_SH_EDOSK7705 is not set
109CONFIG_SH_SH4202_MICRODEV=y
110# CONFIG_SH_LANDISK is not set
111# CONFIG_SH_TITAN is not set
112# CONFIG_SH_SHMIN is not set
113# CONFIG_SH_UNKNOWN is not set
114
115#
116# Processor selection
117#
118CONFIG_CPU_SH4=y 117CONFIG_CPU_SH4=y
119 118# CONFIG_CPU_SUBTYPE_SH7619 is not set
120# 119# CONFIG_CPU_SUBTYPE_SH7203 is not set
121# SH-2 Processor Support 120# CONFIG_CPU_SUBTYPE_SH7206 is not set
122# 121# CONFIG_CPU_SUBTYPE_SH7263 is not set
123# CONFIG_CPU_SUBTYPE_SH7604 is not set 122# CONFIG_CPU_SUBTYPE_MXG is not set
124
125#
126# SH-3 Processor Support
127#
128# CONFIG_CPU_SUBTYPE_SH7300 is not set
129# CONFIG_CPU_SUBTYPE_SH7705 is not set 123# CONFIG_CPU_SUBTYPE_SH7705 is not set
130# CONFIG_CPU_SUBTYPE_SH7706 is not set 124# CONFIG_CPU_SUBTYPE_SH7706 is not set
131# CONFIG_CPU_SUBTYPE_SH7707 is not set 125# CONFIG_CPU_SUBTYPE_SH7707 is not set
132# CONFIG_CPU_SUBTYPE_SH7708 is not set 126# CONFIG_CPU_SUBTYPE_SH7708 is not set
133# CONFIG_CPU_SUBTYPE_SH7709 is not set 127# CONFIG_CPU_SUBTYPE_SH7709 is not set
134# CONFIG_CPU_SUBTYPE_SH7710 is not set 128# CONFIG_CPU_SUBTYPE_SH7710 is not set
135 129# CONFIG_CPU_SUBTYPE_SH7712 is not set
136# 130# CONFIG_CPU_SUBTYPE_SH7720 is not set
137# SH-4 Processor Support 131# CONFIG_CPU_SUBTYPE_SH7721 is not set
138#
139# CONFIG_CPU_SUBTYPE_SH7750 is not set 132# CONFIG_CPU_SUBTYPE_SH7750 is not set
140# CONFIG_CPU_SUBTYPE_SH7091 is not set 133# CONFIG_CPU_SUBTYPE_SH7091 is not set
141# CONFIG_CPU_SUBTYPE_SH7750R is not set 134# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -144,67 +137,94 @@ CONFIG_CPU_SH4=y
144# CONFIG_CPU_SUBTYPE_SH7751R is not set 137# CONFIG_CPU_SUBTYPE_SH7751R is not set
145# CONFIG_CPU_SUBTYPE_SH7760 is not set 138# CONFIG_CPU_SUBTYPE_SH7760 is not set
146CONFIG_CPU_SUBTYPE_SH4_202=y 139CONFIG_CPU_SUBTYPE_SH4_202=y
147 140# CONFIG_CPU_SUBTYPE_SH7723 is not set
148# 141# CONFIG_CPU_SUBTYPE_SH7763 is not set
149# ST40 Processor Support
150#
151# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
152# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
153
154#
155# SH-4A Processor Support
156#
157# CONFIG_CPU_SUBTYPE_SH7770 is not set 142# CONFIG_CPU_SUBTYPE_SH7770 is not set
158# CONFIG_CPU_SUBTYPE_SH7780 is not set 143# CONFIG_CPU_SUBTYPE_SH7780 is not set
159 144# CONFIG_CPU_SUBTYPE_SH7785 is not set
160# 145# CONFIG_CPU_SUBTYPE_SHX3 is not set
161# SH4AL-DSP Processor Support
162#
163# CONFIG_CPU_SUBTYPE_SH73180 is not set
164# CONFIG_CPU_SUBTYPE_SH7343 is not set 146# CONFIG_CPU_SUBTYPE_SH7343 is not set
147# CONFIG_CPU_SUBTYPE_SH7722 is not set
148# CONFIG_CPU_SUBTYPE_SH7366 is not set
149# CONFIG_CPU_SUBTYPE_SH5_101 is not set
150# CONFIG_CPU_SUBTYPE_SH5_103 is not set
165 151
166# 152#
167# Memory management options 153# Memory management options
168# 154#
155CONFIG_QUICKLIST=y
169CONFIG_MMU=y 156CONFIG_MMU=y
170CONFIG_PAGE_OFFSET=0x80000000 157CONFIG_PAGE_OFFSET=0x80000000
171CONFIG_MEMORY_START=0x08000000 158CONFIG_MEMORY_START=0x08000000
172CONFIG_MEMORY_SIZE=0x04000000 159CONFIG_MEMORY_SIZE=0x04000000
160CONFIG_29BIT=y
173CONFIG_VSYSCALL=y 161CONFIG_VSYSCALL=y
162CONFIG_ARCH_FLATMEM_ENABLE=y
163CONFIG_ARCH_SPARSEMEM_ENABLE=y
164CONFIG_ARCH_SPARSEMEM_DEFAULT=y
165CONFIG_MAX_ACTIVE_REGIONS=1
166CONFIG_ARCH_POPULATES_NODE_MAP=y
167CONFIG_ARCH_SELECT_MEMORY_MODEL=y
168CONFIG_PAGE_SIZE_4KB=y
169# CONFIG_PAGE_SIZE_8KB is not set
170# CONFIG_PAGE_SIZE_16KB is not set
171# CONFIG_PAGE_SIZE_64KB is not set
172CONFIG_ENTRY_OFFSET=0x00001000
174CONFIG_HUGETLB_PAGE_SIZE_64K=y 173CONFIG_HUGETLB_PAGE_SIZE_64K=y
174# CONFIG_HUGETLB_PAGE_SIZE_256K is not set
175# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set 175# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
176# CONFIG_HUGETLB_PAGE_SIZE_4MB is not set
177# CONFIG_HUGETLB_PAGE_SIZE_64MB is not set
178# CONFIG_HUGETLB_PAGE_SIZE_512MB is not set
176CONFIG_SELECT_MEMORY_MODEL=y 179CONFIG_SELECT_MEMORY_MODEL=y
177CONFIG_FLATMEM_MANUAL=y 180CONFIG_FLATMEM_MANUAL=y
178# CONFIG_DISCONTIGMEM_MANUAL is not set 181# CONFIG_DISCONTIGMEM_MANUAL is not set
179# CONFIG_SPARSEMEM_MANUAL is not set 182# CONFIG_SPARSEMEM_MANUAL is not set
180CONFIG_FLATMEM=y 183CONFIG_FLATMEM=y
181CONFIG_FLAT_NODE_MEM_MAP=y 184CONFIG_FLAT_NODE_MEM_MAP=y
182# CONFIG_SPARSEMEM_STATIC is not set 185CONFIG_SPARSEMEM_STATIC=y
186# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
187CONFIG_PAGEFLAGS_EXTENDED=y
183CONFIG_SPLIT_PTLOCK_CPUS=4 188CONFIG_SPLIT_PTLOCK_CPUS=4
184# CONFIG_RESOURCES_64BIT is not set 189# CONFIG_RESOURCES_64BIT is not set
190CONFIG_ZONE_DMA_FLAG=0
191CONFIG_NR_QUICK=2
185 192
186# 193#
187# Cache configuration 194# Cache configuration
188# 195#
189# CONFIG_SH_DIRECT_MAPPED is not set 196# CONFIG_SH_DIRECT_MAPPED is not set
190CONFIG_SH_WRITETHROUGH=y 197CONFIG_CACHE_WRITEBACK=y
191# CONFIG_SH_OCRAM is not set 198# CONFIG_CACHE_WRITETHROUGH is not set
199# CONFIG_CACHE_OFF is not set
192 200
193# 201#
194# Processor features 202# Processor features
195# 203#
196CONFIG_CPU_LITTLE_ENDIAN=y 204CONFIG_CPU_LITTLE_ENDIAN=y
205# CONFIG_CPU_BIG_ENDIAN is not set
197CONFIG_SH_FPU=y 206CONFIG_SH_FPU=y
198# CONFIG_SH_DSP is not set
199# CONFIG_SH_STORE_QUEUES is not set 207# CONFIG_SH_STORE_QUEUES is not set
200CONFIG_CPU_HAS_INTEVT=y 208CONFIG_CPU_HAS_INTEVT=y
201CONFIG_CPU_HAS_SR_RB=y 209CONFIG_CPU_HAS_SR_RB=y
210CONFIG_CPU_HAS_PTEA=y
211CONFIG_CPU_HAS_FPU=y
202 212
203# 213#
204# Timer support 214# Board support
215#
216CONFIG_SH_SH4202_MICRODEV=y
217
218#
219# Timer and clock configuration
205# 220#
206CONFIG_SH_TMU=y 221CONFIG_SH_TMU=y
222CONFIG_SH_TIMER_IRQ=16
207CONFIG_SH_PCLK_FREQ=66000000 223CONFIG_SH_PCLK_FREQ=66000000
224# CONFIG_TICK_ONESHOT is not set
225# CONFIG_NO_HZ is not set
226# CONFIG_HIGH_RES_TIMERS is not set
227CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
208 228
209# 229#
210# CPU Frequency scaling 230# CPU Frequency scaling
@@ -214,6 +234,7 @@ CONFIG_SH_PCLK_FREQ=66000000
214# 234#
215# DMA support 235# DMA support
216# 236#
237CONFIG_SH_DMA_API=y
217CONFIG_SH_DMA=y 238CONFIG_SH_DMA=y
218CONFIG_NR_ONCHIP_DMA_CHANNELS=4 239CONFIG_NR_ONCHIP_DMA_CHANNELS=4
219# CONFIG_NR_DMA_CHANNELS_BOOL is not set 240# CONFIG_NR_DMA_CHANNELS_BOOL is not set
@@ -221,22 +242,30 @@ CONFIG_NR_ONCHIP_DMA_CHANNELS=4
221# 242#
222# Companion Chips 243# Companion Chips
223# 244#
224# CONFIG_HD6446X_SERIES is not set 245
246#
247# Additional SuperH Device Drivers
248#
225CONFIG_HEARTBEAT=y 249CONFIG_HEARTBEAT=y
250# CONFIG_PUSH_SWITCH is not set
226 251
227# 252#
228# Kernel features 253# Kernel features
229# 254#
230# CONFIG_HZ_100 is not set 255# CONFIG_HZ_100 is not set
231CONFIG_HZ_250=y 256CONFIG_HZ_250=y
257# CONFIG_HZ_300 is not set
232# CONFIG_HZ_1000 is not set 258# CONFIG_HZ_1000 is not set
233CONFIG_HZ=250 259CONFIG_HZ=250
260# CONFIG_SCHED_HRTICK is not set
234# CONFIG_KEXEC is not set 261# CONFIG_KEXEC is not set
235# CONFIG_SMP is not set 262# CONFIG_CRASH_DUMP is not set
236# CONFIG_PREEMPT_NONE is not set 263# CONFIG_PREEMPT_NONE is not set
237# CONFIG_PREEMPT_VOLUNTARY is not set 264# CONFIG_PREEMPT_VOLUNTARY is not set
238CONFIG_PREEMPT=y 265CONFIG_PREEMPT=y
239CONFIG_PREEMPT_BKL=y 266# CONFIG_PREEMPT_RCU is not set
267CONFIG_GUSA=y
268# CONFIG_GUSA_RB is not set
240 269
241# 270#
242# Boot options 271# Boot options
@@ -251,30 +280,16 @@ CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/hda1"
251# Bus options 280# Bus options
252# 281#
253CONFIG_SUPERHYWAY=y 282CONFIG_SUPERHYWAY=y
254# CONFIG_PCI is not set 283# CONFIG_ARCH_SUPPORTS_MSI is not set
255
256#
257# PCCARD (PCMCIA/CardBus) support
258#
259# CONFIG_PCCARD is not set 284# CONFIG_PCCARD is not set
260 285
261# 286#
262# PCI Hotplug Support
263#
264
265#
266# Executable file formats 287# Executable file formats
267# 288#
268CONFIG_BINFMT_ELF=y 289CONFIG_BINFMT_ELF=y
269# CONFIG_BINFMT_FLAT is not set
270# CONFIG_BINFMT_MISC is not set 290# CONFIG_BINFMT_MISC is not set
271 291
272# 292#
273# Power management options (EXPERIMENTAL)
274#
275# CONFIG_PM is not set
276
277#
278# Networking 293# Networking
279# 294#
280CONFIG_NET=y 295CONFIG_NET=y
@@ -282,12 +297,13 @@ CONFIG_NET=y
282# 297#
283# Networking options 298# Networking options
284# 299#
285# CONFIG_NETDEBUG is not set
286# CONFIG_PACKET is not set 300# CONFIG_PACKET is not set
287# CONFIG_UNIX is not set 301# CONFIG_UNIX is not set
288CONFIG_XFRM=y 302CONFIG_XFRM=y
289# CONFIG_XFRM_USER is not set 303# CONFIG_XFRM_USER is not set
290# CONFIG_XFRM_SUB_POLICY is not set 304# CONFIG_XFRM_SUB_POLICY is not set
305# CONFIG_XFRM_MIGRATE is not set
306# CONFIG_XFRM_STATISTICS is not set
291# CONFIG_NET_KEY is not set 307# CONFIG_NET_KEY is not set
292CONFIG_INET=y 308CONFIG_INET=y
293# CONFIG_IP_MULTICAST is not set 309# CONFIG_IP_MULTICAST is not set
@@ -308,30 +324,19 @@ CONFIG_IP_PNP=y
308# CONFIG_INET_TUNNEL is not set 324# CONFIG_INET_TUNNEL is not set
309CONFIG_INET_XFRM_MODE_TRANSPORT=y 325CONFIG_INET_XFRM_MODE_TRANSPORT=y
310CONFIG_INET_XFRM_MODE_TUNNEL=y 326CONFIG_INET_XFRM_MODE_TUNNEL=y
327CONFIG_INET_XFRM_MODE_BEET=y
328# CONFIG_INET_LRO is not set
311CONFIG_INET_DIAG=y 329CONFIG_INET_DIAG=y
312CONFIG_INET_TCP_DIAG=y 330CONFIG_INET_TCP_DIAG=y
313# CONFIG_TCP_CONG_ADVANCED is not set 331# CONFIG_TCP_CONG_ADVANCED is not set
314CONFIG_TCP_CONG_CUBIC=y 332CONFIG_TCP_CONG_CUBIC=y
315CONFIG_DEFAULT_TCP_CONG="cubic" 333CONFIG_DEFAULT_TCP_CONG="cubic"
334# CONFIG_TCP_MD5SIG is not set
316# CONFIG_IPV6 is not set 335# CONFIG_IPV6 is not set
317# CONFIG_INET6_XFRM_TUNNEL is not set
318# CONFIG_INET6_TUNNEL is not set
319# CONFIG_NETWORK_SECMARK is not set 336# CONFIG_NETWORK_SECMARK is not set
320# CONFIG_NETFILTER is not set 337# CONFIG_NETFILTER is not set
321
322#
323# DCCP Configuration (EXPERIMENTAL)
324#
325# CONFIG_IP_DCCP is not set 338# CONFIG_IP_DCCP is not set
326
327#
328# SCTP Configuration (EXPERIMENTAL)
329#
330# CONFIG_IP_SCTP is not set 339# CONFIG_IP_SCTP is not set
331
332#
333# TIPC Configuration (EXPERIMENTAL)
334#
335# CONFIG_TIPC is not set 340# CONFIG_TIPC is not set
336# CONFIG_ATM is not set 341# CONFIG_ATM is not set
337# CONFIG_BRIDGE is not set 342# CONFIG_BRIDGE is not set
@@ -344,10 +349,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
344# CONFIG_LAPB is not set 349# CONFIG_LAPB is not set
345# CONFIG_ECONET is not set 350# CONFIG_ECONET is not set
346# CONFIG_WAN_ROUTER is not set 351# CONFIG_WAN_ROUTER is not set
347
348#
349# QoS and/or fair queueing
350#
351# CONFIG_NET_SCHED is not set 352# CONFIG_NET_SCHED is not set
352 353
353# 354#
@@ -355,9 +356,20 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
355# 356#
356# CONFIG_NET_PKTGEN is not set 357# CONFIG_NET_PKTGEN is not set
357# CONFIG_HAMRADIO is not set 358# CONFIG_HAMRADIO is not set
359# CONFIG_CAN is not set
358# CONFIG_IRDA is not set 360# CONFIG_IRDA is not set
359# CONFIG_BT is not set 361# CONFIG_BT is not set
362# CONFIG_AF_RXRPC is not set
363
364#
365# Wireless
366#
367# CONFIG_CFG80211 is not set
368# CONFIG_WIRELESS_EXT is not set
369# CONFIG_MAC80211 is not set
360# CONFIG_IEEE80211 is not set 370# CONFIG_IEEE80211 is not set
371# CONFIG_RFKILL is not set
372# CONFIG_NET_9P is not set
361 373
362# 374#
363# Device Drivers 375# Device Drivers
@@ -366,159 +378,96 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
366# 378#
367# Generic Driver Options 379# Generic Driver Options
368# 380#
381CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
369CONFIG_STANDALONE=y 382CONFIG_STANDALONE=y
370CONFIG_PREVENT_FIRMWARE_BUILD=y 383CONFIG_PREVENT_FIRMWARE_BUILD=y
371# CONFIG_FW_LOADER is not set 384# CONFIG_FW_LOADER is not set
372# CONFIG_SYS_HYPERVISOR is not set 385# CONFIG_SYS_HYPERVISOR is not set
373
374#
375# Connector - unified userspace <-> kernelspace linker
376#
377# CONFIG_CONNECTOR is not set 386# CONFIG_CONNECTOR is not set
378
379#
380# Memory Technology Devices (MTD)
381#
382# CONFIG_MTD is not set 387# CONFIG_MTD is not set
383
384#
385# Parallel port support
386#
387# CONFIG_PARPORT is not set 388# CONFIG_PARPORT is not set
388 389CONFIG_BLK_DEV=y
389#
390# Plug and Play support
391#
392
393#
394# Block devices
395#
396# CONFIG_BLK_DEV_COW_COMMON is not set 390# CONFIG_BLK_DEV_COW_COMMON is not set
397# CONFIG_BLK_DEV_LOOP is not set 391# CONFIG_BLK_DEV_LOOP is not set
398# CONFIG_BLK_DEV_NBD is not set 392# CONFIG_BLK_DEV_NBD is not set
399CONFIG_BLK_DEV_RAM=y 393CONFIG_BLK_DEV_RAM=y
400CONFIG_BLK_DEV_RAM_COUNT=16 394CONFIG_BLK_DEV_RAM_COUNT=16
401CONFIG_BLK_DEV_RAM_SIZE=4096 395CONFIG_BLK_DEV_RAM_SIZE=4096
402CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 396# CONFIG_BLK_DEV_XIP is not set
403CONFIG_BLK_DEV_INITRD=y
404# CONFIG_CDROM_PKTCDVD is not set 397# CONFIG_CDROM_PKTCDVD is not set
405# CONFIG_ATA_OVER_ETH is not set 398# CONFIG_ATA_OVER_ETH is not set
406 399# CONFIG_BLK_DEV_HD is not set
407# 400CONFIG_MISC_DEVICES=y
408# ATA/ATAPI/MFM/RLL support 401# CONFIG_EEPROM_93CX6 is not set
409# 402# CONFIG_ENCLOSURE_SERVICES is not set
403CONFIG_HAVE_IDE=y
410CONFIG_IDE=y 404CONFIG_IDE=y
411CONFIG_IDE_MAX_HWIFS=1 405CONFIG_IDE_MAX_HWIFS=1
412CONFIG_BLK_DEV_IDE=y 406CONFIG_BLK_DEV_IDE=y
413 407
414# 408#
415# Please see Documentation/ide.txt for help/info on IDE drives 409# Please see Documentation/ide/ide.txt for help/info on IDE drives
416# 410#
417# CONFIG_BLK_DEV_IDE_SATA is not set 411# CONFIG_BLK_DEV_IDE_SATA is not set
418CONFIG_BLK_DEV_IDEDISK=y 412CONFIG_BLK_DEV_IDEDISK=y
419# CONFIG_IDEDISK_MULTI_MODE is not set 413# CONFIG_IDEDISK_MULTI_MODE is not set
420CONFIG_BLK_DEV_IDECD=y 414CONFIG_BLK_DEV_IDECD=y
415CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
421# CONFIG_BLK_DEV_IDETAPE is not set 416# CONFIG_BLK_DEV_IDETAPE is not set
422# CONFIG_BLK_DEV_IDEFLOPPY is not set 417# CONFIG_BLK_DEV_IDEFLOPPY is not set
423# CONFIG_IDE_TASK_IOCTL is not set 418# CONFIG_IDE_TASK_IOCTL is not set
419CONFIG_IDE_PROC_FS=y
424 420
425# 421#
426# IDE chipset support/bugfixes 422# IDE chipset support/bugfixes
427# 423#
428CONFIG_IDE_GENERIC=y 424# CONFIG_BLK_DEV_PLATFORM is not set
429# CONFIG_IDE_ARM is not set
430# CONFIG_BLK_DEV_IDEDMA is not set 425# CONFIG_BLK_DEV_IDEDMA is not set
431# CONFIG_IDEDMA_AUTO is not set
432# CONFIG_BLK_DEV_HD is not set
433 426
434# 427#
435# SCSI device support 428# SCSI device support
436# 429#
437# CONFIG_RAID_ATTRS is not set 430# CONFIG_RAID_ATTRS is not set
438# CONFIG_SCSI is not set 431# CONFIG_SCSI is not set
432# CONFIG_SCSI_DMA is not set
439# CONFIG_SCSI_NETLINK is not set 433# CONFIG_SCSI_NETLINK is not set
440
441#
442# Serial ATA (prod) and Parallel ATA (experimental) drivers
443#
444# CONFIG_ATA is not set 434# CONFIG_ATA is not set
445
446#
447# Multi-device support (RAID and LVM)
448#
449# CONFIG_MD is not set 435# CONFIG_MD is not set
450
451#
452# Fusion MPT device support
453#
454# CONFIG_FUSION is not set
455
456#
457# IEEE 1394 (FireWire) support
458#
459
460#
461# I2O device support
462#
463
464#
465# Network device support
466#
467CONFIG_NETDEVICES=y 436CONFIG_NETDEVICES=y
468# CONFIG_DUMMY is not set 437# CONFIG_DUMMY is not set
469# CONFIG_BONDING is not set 438# CONFIG_BONDING is not set
439# CONFIG_MACVLAN is not set
470# CONFIG_EQUALIZER is not set 440# CONFIG_EQUALIZER is not set
471# CONFIG_TUN is not set 441# CONFIG_TUN is not set
472 442# CONFIG_VETH is not set
473#
474# PHY device support
475#
476# CONFIG_PHYLIB is not set 443# CONFIG_PHYLIB is not set
477
478#
479# Ethernet (10 or 100Mbit)
480#
481CONFIG_NET_ETHERNET=y 444CONFIG_NET_ETHERNET=y
482CONFIG_MII=y 445CONFIG_MII=y
446# CONFIG_AX88796 is not set
483# CONFIG_STNIC is not set 447# CONFIG_STNIC is not set
484CONFIG_SMC91X=y 448CONFIG_SMC91X=y
449# CONFIG_SMC911X is not set
450# CONFIG_IBM_NEW_EMAC_ZMII is not set
451# CONFIG_IBM_NEW_EMAC_RGMII is not set
452# CONFIG_IBM_NEW_EMAC_TAH is not set
453# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
454# CONFIG_B44 is not set
455CONFIG_NETDEV_1000=y
456CONFIG_NETDEV_10000=y
485 457
486# 458#
487# Ethernet (1000 Mbit) 459# Wireless LAN
488#
489
490#
491# Ethernet (10000 Mbit)
492#
493
494#
495# Token Ring devices
496#
497
498#
499# Wireless LAN (non-hamradio)
500#
501# CONFIG_NET_RADIO is not set
502
503#
504# Wan interfaces
505# 460#
461# CONFIG_WLAN_PRE80211 is not set
462# CONFIG_WLAN_80211 is not set
463# CONFIG_IWLWIFI_LEDS is not set
506# CONFIG_WAN is not set 464# CONFIG_WAN is not set
507# CONFIG_PPP is not set 465# CONFIG_PPP is not set
508# CONFIG_SLIP is not set 466# CONFIG_SLIP is not set
509# CONFIG_SHAPER is not set
510# CONFIG_NETCONSOLE is not set 467# CONFIG_NETCONSOLE is not set
511# CONFIG_NETPOLL is not set 468# CONFIG_NETPOLL is not set
512# CONFIG_NET_POLL_CONTROLLER is not set 469# CONFIG_NET_POLL_CONTROLLER is not set
513
514#
515# ISDN subsystem
516#
517# CONFIG_ISDN is not set 470# CONFIG_ISDN is not set
518
519#
520# Telephony Support
521#
522# CONFIG_PHONE is not set 471# CONFIG_PHONE is not set
523 472
524# 473#
@@ -536,6 +485,7 @@ CONFIG_SMC91X=y
536# Character devices 485# Character devices
537# 486#
538# CONFIG_VT is not set 487# CONFIG_VT is not set
488CONFIG_DEVKMEM=y
539# CONFIG_SERIAL_NONSTANDARD is not set 489# CONFIG_SERIAL_NONSTANDARD is not set
540 490
541# 491#
@@ -554,143 +504,93 @@ CONFIG_SERIAL_CORE_CONSOLE=y
554CONFIG_UNIX98_PTYS=y 504CONFIG_UNIX98_PTYS=y
555CONFIG_LEGACY_PTYS=y 505CONFIG_LEGACY_PTYS=y
556CONFIG_LEGACY_PTY_COUNT=256 506CONFIG_LEGACY_PTY_COUNT=256
557
558#
559# IPMI
560#
561# CONFIG_IPMI_HANDLER is not set 507# CONFIG_IPMI_HANDLER is not set
562
563#
564# Watchdog Cards
565#
566# CONFIG_WATCHDOG is not set
567CONFIG_HW_RANDOM=y 508CONFIG_HW_RANDOM=y
568# CONFIG_GEN_RTC is not set
569# CONFIG_DTLK is not set
570# CONFIG_R3964 is not set 509# CONFIG_R3964 is not set
571
572#
573# Ftape, the floppy tape device driver
574#
575# CONFIG_RAW_DRIVER is not set 510# CONFIG_RAW_DRIVER is not set
576
577#
578# TPM devices
579#
580# CONFIG_TCG_TPM is not set 511# CONFIG_TCG_TPM is not set
581# CONFIG_TELCLOCK is not set
582
583#
584# I2C support
585#
586# CONFIG_I2C is not set 512# CONFIG_I2C is not set
587
588#
589# SPI support
590#
591# CONFIG_SPI is not set 513# CONFIG_SPI is not set
592# CONFIG_SPI_MASTER is not set 514# CONFIG_W1 is not set
593 515# CONFIG_POWER_SUPPLY is not set
594#
595# Dallas's 1-wire bus
596#
597
598#
599# Hardware Monitoring support
600#
601CONFIG_HWMON=y 516CONFIG_HWMON=y
602# CONFIG_HWMON_VID is not set 517# CONFIG_HWMON_VID is not set
603# CONFIG_SENSORS_ABITUGURU is not set
604# CONFIG_SENSORS_F71805F is not set 518# CONFIG_SENSORS_F71805F is not set
519# CONFIG_SENSORS_F71882FG is not set
520# CONFIG_SENSORS_IT87 is not set
521# CONFIG_SENSORS_PC87360 is not set
522# CONFIG_SENSORS_PC87427 is not set
523# CONFIG_SENSORS_SMSC47M1 is not set
524# CONFIG_SENSORS_SMSC47B397 is not set
605# CONFIG_SENSORS_VT1211 is not set 525# CONFIG_SENSORS_VT1211 is not set
526# CONFIG_SENSORS_W83627HF is not set
527# CONFIG_SENSORS_W83627EHF is not set
606# CONFIG_HWMON_DEBUG_CHIP is not set 528# CONFIG_HWMON_DEBUG_CHIP is not set
529# CONFIG_THERMAL is not set
530# CONFIG_THERMAL_HWMON is not set
531# CONFIG_WATCHDOG is not set
607 532
608# 533#
609# Misc devices 534# Sonics Silicon Backplane
610# 535#
536CONFIG_SSB_POSSIBLE=y
537# CONFIG_SSB is not set
538
539#
540# Multifunction device drivers
541#
542# CONFIG_MFD_CORE is not set
543# CONFIG_MFD_SM501 is not set
544# CONFIG_HTC_PASIC3 is not set
611 545
612# 546#
613# Multimedia devices 547# Multimedia devices
614# 548#
549
550#
551# Multimedia core support
552#
615# CONFIG_VIDEO_DEV is not set 553# CONFIG_VIDEO_DEV is not set
616CONFIG_VIDEO_V4L2=y 554# CONFIG_DVB_CORE is not set
555# CONFIG_VIDEO_MEDIA is not set
617 556
618# 557#
619# Digital Video Broadcasting Devices 558# Multimedia drivers
620# 559#
621# CONFIG_DVB is not set 560# CONFIG_DAB is not set
622 561
623# 562#
624# Graphics support 563# Graphics support
625# 564#
626CONFIG_FIRMWARE_EDID=y 565# CONFIG_VGASTATE is not set
566# CONFIG_VIDEO_OUTPUT_CONTROL is not set
627# CONFIG_FB is not set 567# CONFIG_FB is not set
628# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 568# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
629 569
630# 570#
631# Sound 571# Display device support
632# 572#
573# CONFIG_DISPLAY_SUPPORT is not set
633# CONFIG_SOUND is not set 574# CONFIG_SOUND is not set
634 575CONFIG_USB_SUPPORT=y
635# 576CONFIG_USB_ARCH_HAS_HCD=y
636# USB support
637#
638# CONFIG_USB_ARCH_HAS_HCD is not set
639# CONFIG_USB_ARCH_HAS_OHCI is not set 577# CONFIG_USB_ARCH_HAS_OHCI is not set
640# CONFIG_USB_ARCH_HAS_EHCI is not set 578# CONFIG_USB_ARCH_HAS_EHCI is not set
579# CONFIG_USB is not set
580# CONFIG_USB_OTG_WHITELIST is not set
581# CONFIG_USB_OTG_BLACKLIST_HUB is not set
641 582
642# 583#
643# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 584# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
644# 585#
645
646#
647# USB Gadget Support
648#
649# CONFIG_USB_GADGET is not set 586# CONFIG_USB_GADGET is not set
650
651#
652# MMC/SD Card support
653#
654# CONFIG_MMC is not set 587# CONFIG_MMC is not set
655 588# CONFIG_MEMSTICK is not set
656#
657# LED devices
658#
659# CONFIG_NEW_LEDS is not set 589# CONFIG_NEW_LEDS is not set
660 590# CONFIG_ACCESSIBILITY is not set
661#
662# LED drivers
663#
664
665#
666# LED Triggers
667#
668
669#
670# InfiniBand support
671#
672
673#
674# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
675#
676
677#
678# Real Time Clock
679#
680# CONFIG_RTC_CLASS is not set 591# CONFIG_RTC_CLASS is not set
681 592# CONFIG_DMADEVICES is not set
682# 593# CONFIG_UIO is not set
683# DMA Engine support
684#
685# CONFIG_DMA_ENGINE is not set
686
687#
688# DMA Clients
689#
690
691#
692# DMA Devices
693#
694 594
695# 595#
696# File systems 596# File systems
@@ -702,20 +602,18 @@ CONFIG_EXT3_FS=y
702CONFIG_EXT3_FS_XATTR=y 602CONFIG_EXT3_FS_XATTR=y
703# CONFIG_EXT3_FS_POSIX_ACL is not set 603# CONFIG_EXT3_FS_POSIX_ACL is not set
704# CONFIG_EXT3_FS_SECURITY is not set 604# CONFIG_EXT3_FS_SECURITY is not set
605# CONFIG_EXT4DEV_FS is not set
705CONFIG_JBD=y 606CONFIG_JBD=y
706# CONFIG_JBD_DEBUG is not set
707CONFIG_FS_MBCACHE=y 607CONFIG_FS_MBCACHE=y
708# CONFIG_REISERFS_FS is not set 608# CONFIG_REISERFS_FS is not set
709# CONFIG_JFS_FS is not set 609# CONFIG_JFS_FS is not set
710# CONFIG_FS_POSIX_ACL is not set 610# CONFIG_FS_POSIX_ACL is not set
711# CONFIG_XFS_FS is not set 611# CONFIG_XFS_FS is not set
712# CONFIG_OCFS2_FS is not set 612# CONFIG_OCFS2_FS is not set
713# CONFIG_MINIX_FS is not set 613CONFIG_DNOTIFY=y
714# CONFIG_ROMFS_FS is not set
715CONFIG_INOTIFY=y 614CONFIG_INOTIFY=y
716CONFIG_INOTIFY_USER=y 615CONFIG_INOTIFY_USER=y
717# CONFIG_QUOTA is not set 616# CONFIG_QUOTA is not set
718CONFIG_DNOTIFY=y
719# CONFIG_AUTOFS_FS is not set 617# CONFIG_AUTOFS_FS is not set
720# CONFIG_AUTOFS4_FS is not set 618# CONFIG_AUTOFS4_FS is not set
721# CONFIG_FUSE_FS is not set 619# CONFIG_FUSE_FS is not set
@@ -747,7 +645,6 @@ CONFIG_TMPFS=y
747# CONFIG_TMPFS_POSIX_ACL is not set 645# CONFIG_TMPFS_POSIX_ACL is not set
748CONFIG_HUGETLBFS=y 646CONFIG_HUGETLBFS=y
749CONFIG_HUGETLB_PAGE=y 647CONFIG_HUGETLB_PAGE=y
750CONFIG_RAMFS=y
751# CONFIG_CONFIGFS_FS is not set 648# CONFIG_CONFIGFS_FS is not set
752 649
753# 650#
@@ -762,21 +659,20 @@ CONFIG_RAMFS=y
762# CONFIG_EFS_FS is not set 659# CONFIG_EFS_FS is not set
763# CONFIG_CRAMFS is not set 660# CONFIG_CRAMFS is not set
764# CONFIG_VXFS_FS is not set 661# CONFIG_VXFS_FS is not set
662# CONFIG_MINIX_FS is not set
663# CONFIG_OMFS_FS is not set
765# CONFIG_HPFS_FS is not set 664# CONFIG_HPFS_FS is not set
766# CONFIG_QNX4FS_FS is not set 665# CONFIG_QNX4FS_FS is not set
666# CONFIG_ROMFS_FS is not set
767# CONFIG_SYSV_FS is not set 667# CONFIG_SYSV_FS is not set
768# CONFIG_UFS_FS is not set 668# CONFIG_UFS_FS is not set
769 669CONFIG_NETWORK_FILESYSTEMS=y
770#
771# Network File Systems
772#
773CONFIG_NFS_FS=y 670CONFIG_NFS_FS=y
774CONFIG_NFS_V3=y 671CONFIG_NFS_V3=y
775# CONFIG_NFS_V3_ACL is not set 672# CONFIG_NFS_V3_ACL is not set
776CONFIG_NFS_V4=y 673CONFIG_NFS_V4=y
777# CONFIG_NFS_DIRECTIO is not set
778# CONFIG_NFSD is not set
779CONFIG_ROOT_NFS=y 674CONFIG_ROOT_NFS=y
675# CONFIG_NFSD is not set
780CONFIG_LOCKD=y 676CONFIG_LOCKD=y
781CONFIG_LOCKD_V4=y 677CONFIG_LOCKD_V4=y
782CONFIG_NFS_COMMON=y 678CONFIG_NFS_COMMON=y
@@ -789,17 +685,12 @@ CONFIG_RPCSEC_GSS_KRB5=y
789# CONFIG_NCP_FS is not set 685# CONFIG_NCP_FS is not set
790# CONFIG_CODA_FS is not set 686# CONFIG_CODA_FS is not set
791# CONFIG_AFS_FS is not set 687# CONFIG_AFS_FS is not set
792# CONFIG_9P_FS is not set
793 688
794# 689#
795# Partition Types 690# Partition Types
796# 691#
797# CONFIG_PARTITION_ADVANCED is not set 692# CONFIG_PARTITION_ADVANCED is not set
798CONFIG_MSDOS_PARTITION=y 693CONFIG_MSDOS_PARTITION=y
799
800#
801# Native Language Support
802#
803CONFIG_NLS=y 694CONFIG_NLS=y
804CONFIG_NLS_DEFAULT="iso8859-1" 695CONFIG_NLS_DEFAULT="iso8859-1"
805# CONFIG_NLS_CODEPAGE_437 is not set 696# CONFIG_NLS_CODEPAGE_437 is not set
@@ -840,76 +731,127 @@ CONFIG_NLS_DEFAULT="iso8859-1"
840# CONFIG_NLS_KOI8_R is not set 731# CONFIG_NLS_KOI8_R is not set
841# CONFIG_NLS_KOI8_U is not set 732# CONFIG_NLS_KOI8_U is not set
842# CONFIG_NLS_UTF8 is not set 733# CONFIG_NLS_UTF8 is not set
843 734# CONFIG_DLM is not set
844#
845# Profiling support
846#
847# CONFIG_PROFILING is not set
848 735
849# 736#
850# Kernel hacking 737# Kernel hacking
851# 738#
739CONFIG_TRACE_IRQFLAGS_SUPPORT=y
852# CONFIG_PRINTK_TIME is not set 740# CONFIG_PRINTK_TIME is not set
741CONFIG_ENABLE_WARN_DEPRECATED=y
853CONFIG_ENABLE_MUST_CHECK=y 742CONFIG_ENABLE_MUST_CHECK=y
743CONFIG_FRAME_WARN=1024
854# CONFIG_MAGIC_SYSRQ is not set 744# CONFIG_MAGIC_SYSRQ is not set
855# CONFIG_UNUSED_SYMBOLS is not set 745# CONFIG_UNUSED_SYMBOLS is not set
746# CONFIG_DEBUG_FS is not set
747# CONFIG_HEADERS_CHECK is not set
856# CONFIG_DEBUG_KERNEL is not set 748# CONFIG_DEBUG_KERNEL is not set
857CONFIG_LOG_BUF_SHIFT=14
858# CONFIG_DEBUG_BUGVERBOSE is not set 749# CONFIG_DEBUG_BUGVERBOSE is not set
859# CONFIG_DEBUG_FS is not set 750# CONFIG_DEBUG_MEMORY_INIT is not set
860# CONFIG_UNWIND_INFO is not set 751# CONFIG_SAMPLES is not set
861# CONFIG_SH_STANDARD_BIOS is not set 752# CONFIG_SH_STANDARD_BIOS is not set
862# CONFIG_EARLY_SCIF_CONSOLE is not set 753# CONFIG_EARLY_SCIF_CONSOLE is not set
863# CONFIG_KGDB is not set 754# CONFIG_SH_KGDB is not set
864 755
865# 756#
866# Security options 757# Security options
867# 758#
868# CONFIG_KEYS is not set 759# CONFIG_KEYS is not set
869# CONFIG_SECURITY is not set 760# CONFIG_SECURITY is not set
761# CONFIG_SECURITY_FILE_CAPABILITIES is not set
762CONFIG_CRYPTO=y
870 763
871# 764#
872# Cryptographic options 765# Crypto core or helper
873# 766#
874CONFIG_CRYPTO=y
875CONFIG_CRYPTO_ALGAPI=y 767CONFIG_CRYPTO_ALGAPI=y
876CONFIG_CRYPTO_BLKCIPHER=y 768CONFIG_CRYPTO_BLKCIPHER=y
877CONFIG_CRYPTO_MANAGER=y 769CONFIG_CRYPTO_MANAGER=y
878# CONFIG_CRYPTO_HMAC is not set 770# CONFIG_CRYPTO_GF128MUL is not set
879# CONFIG_CRYPTO_NULL is not set 771# CONFIG_CRYPTO_NULL is not set
772# CONFIG_CRYPTO_CRYPTD is not set
773# CONFIG_CRYPTO_AUTHENC is not set
774
775#
776# Authenticated Encryption with Associated Data
777#
778# CONFIG_CRYPTO_CCM is not set
779# CONFIG_CRYPTO_GCM is not set
780# CONFIG_CRYPTO_SEQIV is not set
781
782#
783# Block modes
784#
785CONFIG_CRYPTO_CBC=y
786# CONFIG_CRYPTO_CTR is not set
787# CONFIG_CRYPTO_CTS is not set
788CONFIG_CRYPTO_ECB=y
789# CONFIG_CRYPTO_LRW is not set
790# CONFIG_CRYPTO_PCBC is not set
791# CONFIG_CRYPTO_XTS is not set
792
793#
794# Hash modes
795#
796# CONFIG_CRYPTO_HMAC is not set
797# CONFIG_CRYPTO_XCBC is not set
798
799#
800# Digest
801#
802# CONFIG_CRYPTO_CRC32C is not set
880# CONFIG_CRYPTO_MD4 is not set 803# CONFIG_CRYPTO_MD4 is not set
881CONFIG_CRYPTO_MD5=y 804CONFIG_CRYPTO_MD5=y
805# CONFIG_CRYPTO_MICHAEL_MIC is not set
806# CONFIG_CRYPTO_RMD128 is not set
807# CONFIG_CRYPTO_RMD160 is not set
808# CONFIG_CRYPTO_RMD256 is not set
809# CONFIG_CRYPTO_RMD320 is not set
882# CONFIG_CRYPTO_SHA1 is not set 810# CONFIG_CRYPTO_SHA1 is not set
883# CONFIG_CRYPTO_SHA256 is not set 811# CONFIG_CRYPTO_SHA256 is not set
884# CONFIG_CRYPTO_SHA512 is not set 812# CONFIG_CRYPTO_SHA512 is not set
885# CONFIG_CRYPTO_WP512 is not set
886# CONFIG_CRYPTO_TGR192 is not set 813# CONFIG_CRYPTO_TGR192 is not set
887CONFIG_CRYPTO_ECB=y 814# CONFIG_CRYPTO_WP512 is not set
888CONFIG_CRYPTO_CBC=y 815
889CONFIG_CRYPTO_DES=y 816#
890# CONFIG_CRYPTO_BLOWFISH is not set 817# Ciphers
891# CONFIG_CRYPTO_TWOFISH is not set 818#
892# CONFIG_CRYPTO_SERPENT is not set
893# CONFIG_CRYPTO_AES is not set 819# CONFIG_CRYPTO_AES is not set
820# CONFIG_CRYPTO_ANUBIS is not set
821# CONFIG_CRYPTO_ARC4 is not set
822# CONFIG_CRYPTO_BLOWFISH is not set
823# CONFIG_CRYPTO_CAMELLIA is not set
894# CONFIG_CRYPTO_CAST5 is not set 824# CONFIG_CRYPTO_CAST5 is not set
895# CONFIG_CRYPTO_CAST6 is not set 825# CONFIG_CRYPTO_CAST6 is not set
896# CONFIG_CRYPTO_TEA is not set 826CONFIG_CRYPTO_DES=y
897# CONFIG_CRYPTO_ARC4 is not set 827# CONFIG_CRYPTO_FCRYPT is not set
898# CONFIG_CRYPTO_KHAZAD is not set 828# CONFIG_CRYPTO_KHAZAD is not set
899# CONFIG_CRYPTO_ANUBIS is not set 829# CONFIG_CRYPTO_SALSA20 is not set
900# CONFIG_CRYPTO_DEFLATE is not set 830# CONFIG_CRYPTO_SEED is not set
901# CONFIG_CRYPTO_MICHAEL_MIC is not set 831# CONFIG_CRYPTO_SERPENT is not set
902# CONFIG_CRYPTO_CRC32C is not set 832# CONFIG_CRYPTO_TEA is not set
833# CONFIG_CRYPTO_TWOFISH is not set
903 834
904# 835#
905# Hardware crypto devices 836# Compression
906# 837#
838# CONFIG_CRYPTO_DEFLATE is not set
839# CONFIG_CRYPTO_LZO is not set
840CONFIG_CRYPTO_HW=y
907 841
908# 842#
909# Library routines 843# Library routines
910# 844#
845CONFIG_BITREVERSE=y
846# CONFIG_GENERIC_FIND_FIRST_BIT is not set
911# CONFIG_CRC_CCITT is not set 847# CONFIG_CRC_CCITT is not set
912# CONFIG_CRC16 is not set 848# CONFIG_CRC16 is not set
849# CONFIG_CRC_T10DIF is not set
850# CONFIG_CRC_ITU_T is not set
913CONFIG_CRC32=y 851CONFIG_CRC32=y
852# CONFIG_CRC7 is not set
914# CONFIG_LIBCRC32C is not set 853# CONFIG_LIBCRC32C is not set
915CONFIG_PLIST=y 854CONFIG_PLIST=y
855CONFIG_HAS_IOMEM=y
856CONFIG_HAS_IOPORT=y
857CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/migor_defconfig b/arch/sh/configs/migor_defconfig
index 287408b2ace6..c4b3e1d8950d 100644
--- a/arch/sh/configs/migor_defconfig
+++ b/arch/sh/configs/migor_defconfig
@@ -1,10 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc3 3# Linux kernel version: 2.6.26
4# Thu May 22 14:30:07 2008 4# Wed Jul 30 01:44:41 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -77,9 +78,14 @@ CONFIG_PROFILING=y
77# CONFIG_MARKERS is not set 78# CONFIG_MARKERS is not set
78CONFIG_OPROFILE=y 79CONFIG_OPROFILE=y
79CONFIG_HAVE_OPROFILE=y 80CONFIG_HAVE_OPROFILE=y
81# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
82# CONFIG_HAVE_IOREMAP_PROT is not set
80# CONFIG_HAVE_KPROBES is not set 83# CONFIG_HAVE_KPROBES is not set
81# CONFIG_HAVE_KRETPROBES is not set 84# CONFIG_HAVE_KRETPROBES is not set
85# CONFIG_HAVE_ARCH_TRACEHOOK is not set
82# CONFIG_HAVE_DMA_ATTRS is not set 86# CONFIG_HAVE_DMA_ATTRS is not set
87# CONFIG_USE_GENERIC_SMP_HELPERS is not set
88CONFIG_HAVE_CLK=y
83CONFIG_PROC_PAGE_MONITOR=y 89CONFIG_PROC_PAGE_MONITOR=y
84CONFIG_SLABINFO=y 90CONFIG_SLABINFO=y
85CONFIG_RT_MUTEXES=y 91CONFIG_RT_MUTEXES=y
@@ -90,12 +96,13 @@ CONFIG_MODULES=y
90# CONFIG_MODULE_UNLOAD is not set 96# CONFIG_MODULE_UNLOAD is not set
91# CONFIG_MODVERSIONS is not set 97# CONFIG_MODVERSIONS is not set
92# CONFIG_MODULE_SRCVERSION_ALL is not set 98# CONFIG_MODULE_SRCVERSION_ALL is not set
93# CONFIG_KMOD is not set 99CONFIG_KMOD=y
94CONFIG_BLOCK=y 100CONFIG_BLOCK=y
95# CONFIG_LBD is not set 101# CONFIG_LBD is not set
96# CONFIG_BLK_DEV_IO_TRACE is not set 102# CONFIG_BLK_DEV_IO_TRACE is not set
97# CONFIG_LSF is not set 103# CONFIG_LSF is not set
98# CONFIG_BLK_DEV_BSG is not set 104# CONFIG_BLK_DEV_BSG is not set
105# CONFIG_BLK_DEV_INTEGRITY is not set
99 106
100# 107#
101# IO Schedulers 108# IO Schedulers
@@ -173,7 +180,9 @@ CONFIG_ARCH_SELECT_MEMORY_MODEL=y
173CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 180CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
174CONFIG_PAGE_SIZE_4KB=y 181CONFIG_PAGE_SIZE_4KB=y
175# CONFIG_PAGE_SIZE_8KB is not set 182# CONFIG_PAGE_SIZE_8KB is not set
183# CONFIG_PAGE_SIZE_16KB is not set
176# CONFIG_PAGE_SIZE_64KB is not set 184# CONFIG_PAGE_SIZE_64KB is not set
185CONFIG_ENTRY_OFFSET=0x00001000
177CONFIG_SELECT_MEMORY_MODEL=y 186CONFIG_SELECT_MEMORY_MODEL=y
178# CONFIG_FLATMEM_MANUAL is not set 187# CONFIG_FLATMEM_MANUAL is not set
179# CONFIG_DISCONTIGMEM_MANUAL is not set 188# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -216,6 +225,8 @@ CONFIG_CPU_HAS_DSP=y
216# 225#
217# CONFIG_SH_7722_SOLUTION_ENGINE is not set 226# CONFIG_SH_7722_SOLUTION_ENGINE is not set
218CONFIG_SH_MIGOR=y 227CONFIG_SH_MIGOR=y
228CONFIG_SH_MIGOR_QVGA=y
229# CONFIG_SH_MIGOR_RTA_WVGA is not set
219 230
220# 231#
221# Timer and clock configuration 232# Timer and clock configuration
@@ -362,6 +373,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
362# 373#
363# CONFIG_CFG80211 is not set 374# CONFIG_CFG80211 is not set
364CONFIG_WIRELESS_EXT=y 375CONFIG_WIRELESS_EXT=y
376CONFIG_WIRELESS_EXT_SYSFS=y
365# CONFIG_MAC80211 is not set 377# CONFIG_MAC80211 is not set
366# CONFIG_IEEE80211 is not set 378# CONFIG_IEEE80211 is not set
367# CONFIG_RFKILL is not set 379# CONFIG_RFKILL is not set
@@ -378,6 +390,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
378CONFIG_STANDALONE=y 390CONFIG_STANDALONE=y
379CONFIG_PREVENT_FIRMWARE_BUILD=y 391CONFIG_PREVENT_FIRMWARE_BUILD=y
380CONFIG_FW_LOADER=m 392CONFIG_FW_LOADER=m
393CONFIG_FIRMWARE_IN_KERNEL=y
394CONFIG_EXTRA_FIRMWARE=""
381# CONFIG_SYS_HYPERVISOR is not set 395# CONFIG_SYS_HYPERVISOR is not set
382# CONFIG_CONNECTOR is not set 396# CONFIG_CONNECTOR is not set
383CONFIG_MTD=y 397CONFIG_MTD=y
@@ -475,6 +489,7 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
475# CONFIG_BLK_DEV_XIP is not set 489# CONFIG_BLK_DEV_XIP is not set
476# CONFIG_CDROM_PKTCDVD is not set 490# CONFIG_CDROM_PKTCDVD is not set
477# CONFIG_ATA_OVER_ETH is not set 491# CONFIG_ATA_OVER_ETH is not set
492# CONFIG_BLK_DEV_HD is not set
478CONFIG_MISC_DEVICES=y 493CONFIG_MISC_DEVICES=y
479# CONFIG_EEPROM_93CX6 is not set 494# CONFIG_EEPROM_93CX6 is not set
480# CONFIG_ENCLOSURE_SERVICES is not set 495# CONFIG_ENCLOSURE_SERVICES is not set
@@ -521,10 +536,10 @@ CONFIG_SCSI_WAIT_SCAN=m
521CONFIG_SCSI_LOWLEVEL=y 536CONFIG_SCSI_LOWLEVEL=y
522# CONFIG_ISCSI_TCP is not set 537# CONFIG_ISCSI_TCP is not set
523# CONFIG_SCSI_DEBUG is not set 538# CONFIG_SCSI_DEBUG is not set
539# CONFIG_SCSI_DH is not set
524# CONFIG_ATA is not set 540# CONFIG_ATA is not set
525# CONFIG_MD is not set 541# CONFIG_MD is not set
526CONFIG_NETDEVICES=y 542CONFIG_NETDEVICES=y
527# CONFIG_NETDEVICES_MULTIQUEUE is not set
528# CONFIG_DUMMY is not set 543# CONFIG_DUMMY is not set
529# CONFIG_BONDING is not set 544# CONFIG_BONDING is not set
530# CONFIG_MACVLAN is not set 545# CONFIG_MACVLAN is not set
@@ -537,6 +552,7 @@ CONFIG_MII=y
537# CONFIG_AX88796 is not set 552# CONFIG_AX88796 is not set
538# CONFIG_STNIC is not set 553# CONFIG_STNIC is not set
539CONFIG_SMC91X=y 554CONFIG_SMC91X=y
555# CONFIG_SMC911X is not set
540# CONFIG_IBM_NEW_EMAC_ZMII is not set 556# CONFIG_IBM_NEW_EMAC_ZMII is not set
541# CONFIG_IBM_NEW_EMAC_RGMII is not set 557# CONFIG_IBM_NEW_EMAC_RGMII is not set
542# CONFIG_IBM_NEW_EMAC_TAH is not set 558# CONFIG_IBM_NEW_EMAC_TAH is not set
@@ -602,6 +618,7 @@ CONFIG_KEYBOARD_SH_KEYSC=y
602# Character devices 618# Character devices
603# 619#
604CONFIG_VT=y 620CONFIG_VT=y
621CONFIG_CONSOLE_TRANSLATIONS=y
605CONFIG_VT_CONSOLE=y 622CONFIG_VT_CONSOLE=y
606CONFIG_HW_CONSOLE=y 623CONFIG_HW_CONSOLE=y
607CONFIG_VT_HW_CONSOLE_BINDING=y 624CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -636,21 +653,35 @@ CONFIG_I2C_BOARDINFO=y
636# 653#
637# I2C Hardware Bus support 654# I2C Hardware Bus support
638# 655#
656
657#
658# I2C system bus drivers (mostly embedded / system-on-chip)
659#
639# CONFIG_I2C_OCORES is not set 660# CONFIG_I2C_OCORES is not set
640# CONFIG_I2C_PARPORT_LIGHT is not set 661CONFIG_I2C_SH_MOBILE=y
641# CONFIG_I2C_SIMTEC is not set 662# CONFIG_I2C_SIMTEC is not set
663
664#
665# External I2C/SMBus adapter drivers
666#
667# CONFIG_I2C_PARPORT_LIGHT is not set
642# CONFIG_I2C_TAOS_EVM is not set 668# CONFIG_I2C_TAOS_EVM is not set
643# CONFIG_I2C_STUB is not set 669
670#
671# Other I2C/SMBus bus drivers
672#
644# CONFIG_I2C_PCA_PLATFORM is not set 673# CONFIG_I2C_PCA_PLATFORM is not set
645CONFIG_I2C_SH_MOBILE=y 674# CONFIG_I2C_STUB is not set
646 675
647# 676#
648# Miscellaneous I2C Chip support 677# Miscellaneous I2C Chip support
649# 678#
650# CONFIG_DS1682 is not set 679# CONFIG_DS1682 is not set
680# CONFIG_AT24 is not set
651# CONFIG_SENSORS_EEPROM is not set 681# CONFIG_SENSORS_EEPROM is not set
652# CONFIG_SENSORS_PCF8574 is not set 682# CONFIG_SENSORS_PCF8574 is not set
653# CONFIG_PCF8575 is not set 683# CONFIG_PCF8575 is not set
684# CONFIG_SENSORS_PCA9539 is not set
654# CONFIG_SENSORS_PCF8591 is not set 685# CONFIG_SENSORS_PCF8591 is not set
655# CONFIG_SENSORS_MAX6875 is not set 686# CONFIG_SENSORS_MAX6875 is not set
656# CONFIG_SENSORS_TSL2550 is not set 687# CONFIG_SENSORS_TSL2550 is not set
@@ -663,6 +694,7 @@ CONFIG_I2C_SH_MOBILE=y
663# CONFIG_POWER_SUPPLY is not set 694# CONFIG_POWER_SUPPLY is not set
664# CONFIG_HWMON is not set 695# CONFIG_HWMON is not set
665# CONFIG_THERMAL is not set 696# CONFIG_THERMAL is not set
697# CONFIG_THERMAL_HWMON is not set
666# CONFIG_WATCHDOG is not set 698# CONFIG_WATCHDOG is not set
667 699
668# 700#
@@ -674,6 +706,7 @@ CONFIG_SSB_POSSIBLE=y
674# 706#
675# Multifunction device drivers 707# Multifunction device drivers
676# 708#
709# CONFIG_MFD_CORE is not set
677# CONFIG_MFD_SM501 is not set 710# CONFIG_MFD_SM501 is not set
678# CONFIG_HTC_PASIC3 is not set 711# CONFIG_HTC_PASIC3 is not set
679 712
@@ -710,10 +743,6 @@ CONFIG_SSB_POSSIBLE=y
710# Console display driver support 743# Console display driver support
711# 744#
712CONFIG_DUMMY_CONSOLE=y 745CONFIG_DUMMY_CONSOLE=y
713
714#
715# Sound
716#
717# CONFIG_SOUND is not set 746# CONFIG_SOUND is not set
718CONFIG_HID_SUPPORT=y 747CONFIG_HID_SUPPORT=y
719CONFIG_HID=y 748CONFIG_HID=y
@@ -738,7 +767,7 @@ CONFIG_USB_GADGET_SELECTED=y
738# CONFIG_USB_GADGET_ATMEL_USBA is not set 767# CONFIG_USB_GADGET_ATMEL_USBA is not set
739# CONFIG_USB_GADGET_FSL_USB2 is not set 768# CONFIG_USB_GADGET_FSL_USB2 is not set
740# CONFIG_USB_GADGET_NET2280 is not set 769# CONFIG_USB_GADGET_NET2280 is not set
741# CONFIG_USB_GADGET_PXA2XX is not set 770# CONFIG_USB_GADGET_PXA25X is not set
742CONFIG_USB_GADGET_M66592=y 771CONFIG_USB_GADGET_M66592=y
743CONFIG_USB_M66592=y 772CONFIG_USB_M66592=y
744CONFIG_SUPERH_BUILT_IN_M66592=y 773CONFIG_SUPERH_BUILT_IN_M66592=y
@@ -757,6 +786,7 @@ CONFIG_USB_GADGET_DUALSPEED=y
757CONFIG_USB_G_SERIAL=y 786CONFIG_USB_G_SERIAL=y
758# CONFIG_USB_MIDI_GADGET is not set 787# CONFIG_USB_MIDI_GADGET is not set
759# CONFIG_USB_G_PRINTER is not set 788# CONFIG_USB_G_PRINTER is not set
789# CONFIG_USB_CDC_COMPOSITE is not set
760# CONFIG_MMC is not set 790# CONFIG_MMC is not set
761# CONFIG_MEMSTICK is not set 791# CONFIG_MEMSTICK is not set
762# CONFIG_NEW_LEDS is not set 792# CONFIG_NEW_LEDS is not set
@@ -790,6 +820,7 @@ CONFIG_RTC_DRV_RS5C372=y
790# CONFIG_RTC_DRV_PCF8583 is not set 820# CONFIG_RTC_DRV_PCF8583 is not set
791# CONFIG_RTC_DRV_M41T80 is not set 821# CONFIG_RTC_DRV_M41T80 is not set
792# CONFIG_RTC_DRV_S35390A is not set 822# CONFIG_RTC_DRV_S35390A is not set
823# CONFIG_RTC_DRV_FM3130 is not set
793 824
794# 825#
795# SPI RTC drivers 826# SPI RTC drivers
@@ -810,6 +841,7 @@ CONFIG_RTC_DRV_RS5C372=y
810# on-CPU RTC drivers 841# on-CPU RTC drivers
811# 842#
812CONFIG_RTC_DRV_SH=y 843CONFIG_RTC_DRV_SH=y
844# CONFIG_DMADEVICES is not set
813# CONFIG_UIO is not set 845# CONFIG_UIO is not set
814 846
815# 847#
@@ -870,6 +902,7 @@ CONFIG_TMPFS=y
870# CONFIG_CRAMFS is not set 902# CONFIG_CRAMFS is not set
871# CONFIG_VXFS_FS is not set 903# CONFIG_VXFS_FS is not set
872# CONFIG_MINIX_FS is not set 904# CONFIG_MINIX_FS is not set
905# CONFIG_OMFS_FS is not set
873# CONFIG_HPFS_FS is not set 906# CONFIG_HPFS_FS is not set
874# CONFIG_QNX4FS_FS is not set 907# CONFIG_QNX4FS_FS is not set
875# CONFIG_ROMFS_FS is not set 908# CONFIG_ROMFS_FS is not set
@@ -899,6 +932,7 @@ CONFIG_DEBUG_FS=y
899# CONFIG_HEADERS_CHECK is not set 932# CONFIG_HEADERS_CHECK is not set
900# CONFIG_DEBUG_KERNEL is not set 933# CONFIG_DEBUG_KERNEL is not set
901# CONFIG_DEBUG_BUGVERBOSE is not set 934# CONFIG_DEBUG_BUGVERBOSE is not set
935# CONFIG_DEBUG_MEMORY_INIT is not set
902# CONFIG_SAMPLES is not set 936# CONFIG_SAMPLES is not set
903# CONFIG_SH_STANDARD_BIOS is not set 937# CONFIG_SH_STANDARD_BIOS is not set
904CONFIG_EARLY_SCIF_CONSOLE=y 938CONFIG_EARLY_SCIF_CONSOLE=y
@@ -955,6 +989,10 @@ CONFIG_CRYPTO=y
955# CONFIG_CRYPTO_MD4 is not set 989# CONFIG_CRYPTO_MD4 is not set
956# CONFIG_CRYPTO_MD5 is not set 990# CONFIG_CRYPTO_MD5 is not set
957# CONFIG_CRYPTO_MICHAEL_MIC is not set 991# CONFIG_CRYPTO_MICHAEL_MIC is not set
992# CONFIG_CRYPTO_RMD128 is not set
993# CONFIG_CRYPTO_RMD160 is not set
994# CONFIG_CRYPTO_RMD256 is not set
995# CONFIG_CRYPTO_RMD320 is not set
958# CONFIG_CRYPTO_SHA1 is not set 996# CONFIG_CRYPTO_SHA1 is not set
959# CONFIG_CRYPTO_SHA256 is not set 997# CONFIG_CRYPTO_SHA256 is not set
960# CONFIG_CRYPTO_SHA512 is not set 998# CONFIG_CRYPTO_SHA512 is not set
@@ -994,6 +1032,7 @@ CONFIG_BITREVERSE=y
994# CONFIG_GENERIC_FIND_FIRST_BIT is not set 1032# CONFIG_GENERIC_FIND_FIRST_BIT is not set
995# CONFIG_CRC_CCITT is not set 1033# CONFIG_CRC_CCITT is not set
996# CONFIG_CRC16 is not set 1034# CONFIG_CRC16 is not set
1035CONFIG_CRC_T10DIF=y
997# CONFIG_CRC_ITU_T is not set 1036# CONFIG_CRC_ITU_T is not set
998CONFIG_CRC32=y 1037CONFIG_CRC32=y
999# CONFIG_CRC7 is not set 1038# CONFIG_CRC7 is not set
diff --git a/arch/sh/configs/r7780mp_defconfig b/arch/sh/configs/r7780mp_defconfig
index 1a072615ffd4..57a300797584 100644
--- a/arch/sh/configs/r7780mp_defconfig
+++ b/arch/sh/configs/r7780mp_defconfig
@@ -1,10 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.25-rc4 3# Linux kernel version: 2.6.26
4# Thu Mar 6 15:39:59 2008 4# Wed Jul 30 01:51:13 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -84,13 +85,20 @@ CONFIG_PROFILING=y
84# CONFIG_MARKERS is not set 85# CONFIG_MARKERS is not set
85CONFIG_OPROFILE=m 86CONFIG_OPROFILE=m
86CONFIG_HAVE_OPROFILE=y 87CONFIG_HAVE_OPROFILE=y
88# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
89# CONFIG_HAVE_IOREMAP_PROT is not set
87# CONFIG_HAVE_KPROBES is not set 90# CONFIG_HAVE_KPROBES is not set
88# CONFIG_HAVE_KRETPROBES is not set 91# CONFIG_HAVE_KRETPROBES is not set
92# CONFIG_HAVE_ARCH_TRACEHOOK is not set
93# CONFIG_HAVE_DMA_ATTRS is not set
94# CONFIG_USE_GENERIC_SMP_HELPERS is not set
95CONFIG_HAVE_CLK=y
89CONFIG_PROC_PAGE_MONITOR=y 96CONFIG_PROC_PAGE_MONITOR=y
90CONFIG_SLABINFO=y 97CONFIG_SLABINFO=y
91# CONFIG_TINY_SHMEM is not set 98# CONFIG_TINY_SHMEM is not set
92CONFIG_BASE_SMALL=0 99CONFIG_BASE_SMALL=0
93CONFIG_MODULES=y 100CONFIG_MODULES=y
101# CONFIG_MODULE_FORCE_LOAD is not set
94CONFIG_MODULE_UNLOAD=y 102CONFIG_MODULE_UNLOAD=y
95# CONFIG_MODULE_FORCE_UNLOAD is not set 103# CONFIG_MODULE_FORCE_UNLOAD is not set
96# CONFIG_MODVERSIONS is not set 104# CONFIG_MODVERSIONS is not set
@@ -101,6 +109,7 @@ CONFIG_BLOCK=y
101# CONFIG_BLK_DEV_IO_TRACE is not set 109# CONFIG_BLK_DEV_IO_TRACE is not set
102# CONFIG_LSF is not set 110# CONFIG_LSF is not set
103# CONFIG_BLK_DEV_BSG is not set 111# CONFIG_BLK_DEV_BSG is not set
112# CONFIG_BLK_DEV_INTEGRITY is not set
104 113
105# 114#
106# IO Schedulers 115# IO Schedulers
@@ -115,7 +124,6 @@ CONFIG_IOSCHED_NOOP=y
115CONFIG_DEFAULT_NOOP=y 124CONFIG_DEFAULT_NOOP=y
116CONFIG_DEFAULT_IOSCHED="noop" 125CONFIG_DEFAULT_IOSCHED="noop"
117CONFIG_CLASSIC_RCU=y 126CONFIG_CLASSIC_RCU=y
118# CONFIG_PREEMPT_RCU is not set
119 127
120# 128#
121# System type 129# System type
@@ -126,6 +134,7 @@ CONFIG_CPU_SH4A=y
126# CONFIG_CPU_SUBTYPE_SH7203 is not set 134# CONFIG_CPU_SUBTYPE_SH7203 is not set
127# CONFIG_CPU_SUBTYPE_SH7206 is not set 135# CONFIG_CPU_SUBTYPE_SH7206 is not set
128# CONFIG_CPU_SUBTYPE_SH7263 is not set 136# CONFIG_CPU_SUBTYPE_SH7263 is not set
137# CONFIG_CPU_SUBTYPE_MXG is not set
129# CONFIG_CPU_SUBTYPE_SH7705 is not set 138# CONFIG_CPU_SUBTYPE_SH7705 is not set
130# CONFIG_CPU_SUBTYPE_SH7706 is not set 139# CONFIG_CPU_SUBTYPE_SH7706 is not set
131# CONFIG_CPU_SUBTYPE_SH7707 is not set 140# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -143,6 +152,7 @@ CONFIG_CPU_SH4A=y
143# CONFIG_CPU_SUBTYPE_SH7751R is not set 152# CONFIG_CPU_SUBTYPE_SH7751R is not set
144# CONFIG_CPU_SUBTYPE_SH7760 is not set 153# CONFIG_CPU_SUBTYPE_SH7760 is not set
145# CONFIG_CPU_SUBTYPE_SH4_202 is not set 154# CONFIG_CPU_SUBTYPE_SH4_202 is not set
155# CONFIG_CPU_SUBTYPE_SH7723 is not set
146# CONFIG_CPU_SUBTYPE_SH7763 is not set 156# CONFIG_CPU_SUBTYPE_SH7763 is not set
147# CONFIG_CPU_SUBTYPE_SH7770 is not set 157# CONFIG_CPU_SUBTYPE_SH7770 is not set
148CONFIG_CPU_SUBTYPE_SH7780=y 158CONFIG_CPU_SUBTYPE_SH7780=y
@@ -173,7 +183,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
173CONFIG_ARCH_SELECT_MEMORY_MODEL=y 183CONFIG_ARCH_SELECT_MEMORY_MODEL=y
174CONFIG_PAGE_SIZE_4KB=y 184CONFIG_PAGE_SIZE_4KB=y
175# CONFIG_PAGE_SIZE_8KB is not set 185# CONFIG_PAGE_SIZE_8KB is not set
186# CONFIG_PAGE_SIZE_16KB is not set
176# CONFIG_PAGE_SIZE_64KB is not set 187# CONFIG_PAGE_SIZE_64KB is not set
188CONFIG_ENTRY_OFFSET=0x00001000
177CONFIG_HUGETLB_PAGE_SIZE_64K=y 189CONFIG_HUGETLB_PAGE_SIZE_64K=y
178# CONFIG_HUGETLB_PAGE_SIZE_256K is not set 190# CONFIG_HUGETLB_PAGE_SIZE_256K is not set
179# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set 191# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
@@ -188,6 +200,7 @@ CONFIG_FLATMEM=y
188CONFIG_FLAT_NODE_MEM_MAP=y 200CONFIG_FLAT_NODE_MEM_MAP=y
189CONFIG_SPARSEMEM_STATIC=y 201CONFIG_SPARSEMEM_STATIC=y
190# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 202# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
203CONFIG_PAGEFLAGS_EXTENDED=y
191CONFIG_SPLIT_PTLOCK_CPUS=4 204CONFIG_SPLIT_PTLOCK_CPUS=4
192# CONFIG_RESOURCES_64BIT is not set 205# CONFIG_RESOURCES_64BIT is not set
193CONFIG_ZONE_DMA_FLAG=0 206CONFIG_ZONE_DMA_FLAG=0
@@ -268,7 +281,7 @@ CONFIG_KEXEC=y
268# CONFIG_PREEMPT_NONE is not set 281# CONFIG_PREEMPT_NONE is not set
269# CONFIG_PREEMPT_VOLUNTARY is not set 282# CONFIG_PREEMPT_VOLUNTARY is not set
270CONFIG_PREEMPT=y 283CONFIG_PREEMPT=y
271CONFIG_RCU_TRACE=y 284# CONFIG_PREEMPT_RCU is not set
272CONFIG_GUSA=y 285CONFIG_GUSA=y
273 286
274# 287#
@@ -348,14 +361,13 @@ CONFIG_TCP_CONG_CUBIC=y
348CONFIG_DEFAULT_TCP_CONG="cubic" 361CONFIG_DEFAULT_TCP_CONG="cubic"
349# CONFIG_TCP_MD5SIG is not set 362# CONFIG_TCP_MD5SIG is not set
350# CONFIG_IPV6 is not set 363# CONFIG_IPV6 is not set
351# CONFIG_INET6_XFRM_TUNNEL is not set
352# CONFIG_INET6_TUNNEL is not set
353# CONFIG_NETWORK_SECMARK is not set 364# CONFIG_NETWORK_SECMARK is not set
354# CONFIG_NETFILTER is not set 365# CONFIG_NETFILTER is not set
355# CONFIG_IP_DCCP is not set 366# CONFIG_IP_DCCP is not set
356# CONFIG_IP_SCTP is not set 367# CONFIG_IP_SCTP is not set
357# CONFIG_TIPC is not set 368# CONFIG_TIPC is not set
358# CONFIG_ATM is not set 369# CONFIG_ATM is not set
370CONFIG_STP=m
359CONFIG_BRIDGE=m 371CONFIG_BRIDGE=m
360# CONFIG_VLAN_8021Q is not set 372# CONFIG_VLAN_8021Q is not set
361# CONFIG_DECNET is not set 373# CONFIG_DECNET is not set
@@ -384,6 +396,7 @@ CONFIG_LLC=m
384# 396#
385# CONFIG_CFG80211 is not set 397# CONFIG_CFG80211 is not set
386CONFIG_WIRELESS_EXT=y 398CONFIG_WIRELESS_EXT=y
399CONFIG_WIRELESS_EXT_SYSFS=y
387# CONFIG_MAC80211 is not set 400# CONFIG_MAC80211 is not set
388# CONFIG_IEEE80211 is not set 401# CONFIG_IEEE80211 is not set
389# CONFIG_RFKILL is not set 402# CONFIG_RFKILL is not set
@@ -400,6 +413,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
400CONFIG_STANDALONE=y 413CONFIG_STANDALONE=y
401CONFIG_PREVENT_FIRMWARE_BUILD=y 414CONFIG_PREVENT_FIRMWARE_BUILD=y
402CONFIG_FW_LOADER=m 415CONFIG_FW_LOADER=m
416CONFIG_FIRMWARE_IN_KERNEL=y
417CONFIG_EXTRA_FIRMWARE=""
403# CONFIG_DEBUG_DRIVER is not set 418# CONFIG_DEBUG_DRIVER is not set
404# CONFIG_DEBUG_DEVRES is not set 419# CONFIG_DEBUG_DEVRES is not set
405# CONFIG_SYS_HYPERVISOR is not set 420# CONFIG_SYS_HYPERVISOR is not set
@@ -420,12 +435,14 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
420# CONFIG_BLK_DEV_XIP is not set 435# CONFIG_BLK_DEV_XIP is not set
421# CONFIG_CDROM_PKTCDVD is not set 436# CONFIG_CDROM_PKTCDVD is not set
422# CONFIG_ATA_OVER_ETH is not set 437# CONFIG_ATA_OVER_ETH is not set
438# CONFIG_BLK_DEV_HD is not set
423CONFIG_MISC_DEVICES=y 439CONFIG_MISC_DEVICES=y
424# CONFIG_PHANTOM is not set 440# CONFIG_PHANTOM is not set
425CONFIG_EEPROM_93CX6=y 441CONFIG_EEPROM_93CX6=y
426# CONFIG_SGI_IOC4 is not set 442# CONFIG_SGI_IOC4 is not set
427# CONFIG_TIFM_CORE is not set 443# CONFIG_TIFM_CORE is not set
428# CONFIG_ENCLOSURE_SERVICES is not set 444# CONFIG_ENCLOSURE_SERVICES is not set
445# CONFIG_HP_ILO is not set
429CONFIG_HAVE_IDE=y 446CONFIG_HAVE_IDE=y
430# CONFIG_IDE is not set 447# CONFIG_IDE is not set
431 448
@@ -499,9 +516,13 @@ CONFIG_SCSI_LOWLEVEL=y
499# CONFIG_SCSI_NSP32 is not set 516# CONFIG_SCSI_NSP32 is not set
500# CONFIG_SCSI_DEBUG is not set 517# CONFIG_SCSI_DEBUG is not set
501# CONFIG_SCSI_SRP is not set 518# CONFIG_SCSI_SRP is not set
519# CONFIG_SCSI_DH is not set
502CONFIG_ATA=y 520CONFIG_ATA=y
503# CONFIG_ATA_NONSTANDARD is not set 521# CONFIG_ATA_NONSTANDARD is not set
522CONFIG_SATA_PMP=y
504# CONFIG_SATA_AHCI is not set 523# CONFIG_SATA_AHCI is not set
524# CONFIG_SATA_SIL24 is not set
525CONFIG_ATA_SFF=y
505# CONFIG_SATA_SVW is not set 526# CONFIG_SATA_SVW is not set
506# CONFIG_ATA_PIIX is not set 527# CONFIG_ATA_PIIX is not set
507# CONFIG_SATA_MV is not set 528# CONFIG_SATA_MV is not set
@@ -511,7 +532,6 @@ CONFIG_ATA=y
511# CONFIG_SATA_PROMISE is not set 532# CONFIG_SATA_PROMISE is not set
512# CONFIG_SATA_SX4 is not set 533# CONFIG_SATA_SX4 is not set
513CONFIG_SATA_SIL=y 534CONFIG_SATA_SIL=y
514# CONFIG_SATA_SIL24 is not set
515# CONFIG_SATA_SIS is not set 535# CONFIG_SATA_SIS is not set
516# CONFIG_SATA_ULI is not set 536# CONFIG_SATA_ULI is not set
517# CONFIG_SATA_VIA is not set 537# CONFIG_SATA_VIA is not set
@@ -556,17 +576,21 @@ CONFIG_SATA_SIL=y
556# CONFIG_PATA_VIA is not set 576# CONFIG_PATA_VIA is not set
557# CONFIG_PATA_WINBOND is not set 577# CONFIG_PATA_WINBOND is not set
558CONFIG_PATA_PLATFORM=y 578CONFIG_PATA_PLATFORM=y
579# CONFIG_PATA_SCH is not set
559# CONFIG_MD is not set 580# CONFIG_MD is not set
560# CONFIG_FUSION is not set 581# CONFIG_FUSION is not set
561 582
562# 583#
563# IEEE 1394 (FireWire) support 584# IEEE 1394 (FireWire) support
564# 585#
586
587#
588# Enable only one of the two stacks, unless you know what you are doing
589#
565# CONFIG_FIREWIRE is not set 590# CONFIG_FIREWIRE is not set
566# CONFIG_IEEE1394 is not set 591# CONFIG_IEEE1394 is not set
567# CONFIG_I2O is not set 592# CONFIG_I2O is not set
568CONFIG_NETDEVICES=y 593CONFIG_NETDEVICES=y
569# CONFIG_NETDEVICES_MULTIQUEUE is not set
570# CONFIG_DUMMY is not set 594# CONFIG_DUMMY is not set
571# CONFIG_BONDING is not set 595# CONFIG_BONDING is not set
572# CONFIG_MACVLAN is not set 596# CONFIG_MACVLAN is not set
@@ -585,6 +609,7 @@ CONFIG_AX88796_93CX6=y
585# CONFIG_CASSINI is not set 609# CONFIG_CASSINI is not set
586# CONFIG_NET_VENDOR_3COM is not set 610# CONFIG_NET_VENDOR_3COM is not set
587# CONFIG_SMC91X is not set 611# CONFIG_SMC91X is not set
612# CONFIG_SMC911X is not set
588# CONFIG_NET_TULIP is not set 613# CONFIG_NET_TULIP is not set
589# CONFIG_HP100 is not set 614# CONFIG_HP100 is not set
590# CONFIG_IBM_NEW_EMAC_ZMII is not set 615# CONFIG_IBM_NEW_EMAC_ZMII is not set
@@ -593,7 +618,6 @@ CONFIG_AX88796_93CX6=y
593# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 618# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
594CONFIG_NET_PCI=y 619CONFIG_NET_PCI=y
595CONFIG_PCNET32=m 620CONFIG_PCNET32=m
596# CONFIG_PCNET32_NAPI is not set
597# CONFIG_AMD8111_ETH is not set 621# CONFIG_AMD8111_ETH is not set
598# CONFIG_ADAPTEC_STARFIRE is not set 622# CONFIG_ADAPTEC_STARFIRE is not set
599# CONFIG_B44 is not set 623# CONFIG_B44 is not set
@@ -616,32 +640,28 @@ CONFIG_8139TOO_8129=y
616# CONFIG_TLAN is not set 640# CONFIG_TLAN is not set
617CONFIG_VIA_RHINE=m 641CONFIG_VIA_RHINE=m
618CONFIG_VIA_RHINE_MMIO=y 642CONFIG_VIA_RHINE_MMIO=y
619# CONFIG_VIA_RHINE_NAPI is not set
620# CONFIG_SC92031 is not set 643# CONFIG_SC92031 is not set
621CONFIG_NETDEV_1000=y 644CONFIG_NETDEV_1000=y
622# CONFIG_ACENIC is not set 645# CONFIG_ACENIC is not set
623# CONFIG_DL2K is not set 646# CONFIG_DL2K is not set
624CONFIG_E1000=m 647CONFIG_E1000=m
625# CONFIG_E1000_NAPI is not set
626# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 648# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
627# CONFIG_E1000E is not set 649# CONFIG_E1000E is not set
628# CONFIG_E1000E_ENABLED is not set
629# CONFIG_IP1000 is not set 650# CONFIG_IP1000 is not set
630# CONFIG_IGB is not set 651# CONFIG_IGB is not set
631# CONFIG_NS83820 is not set 652# CONFIG_NS83820 is not set
632# CONFIG_HAMACHI is not set 653# CONFIG_HAMACHI is not set
633# CONFIG_YELLOWFIN is not set 654# CONFIG_YELLOWFIN is not set
634CONFIG_R8169=y 655CONFIG_R8169=y
635# CONFIG_R8169_NAPI is not set
636# CONFIG_SIS190 is not set 656# CONFIG_SIS190 is not set
637# CONFIG_SKGE is not set 657# CONFIG_SKGE is not set
638# CONFIG_SKY2 is not set 658# CONFIG_SKY2 is not set
639# CONFIG_SK98LIN is not set
640# CONFIG_VIA_VELOCITY is not set 659# CONFIG_VIA_VELOCITY is not set
641# CONFIG_TIGON3 is not set 660# CONFIG_TIGON3 is not set
642# CONFIG_BNX2 is not set 661# CONFIG_BNX2 is not set
643# CONFIG_QLA3XXX is not set 662# CONFIG_QLA3XXX is not set
644# CONFIG_ATL1 is not set 663# CONFIG_ATL1 is not set
664# CONFIG_ATL1E is not set
645CONFIG_NETDEV_10000=y 665CONFIG_NETDEV_10000=y
646# CONFIG_CHELSIO_T1 is not set 666# CONFIG_CHELSIO_T1 is not set
647# CONFIG_CHELSIO_T3 is not set 667# CONFIG_CHELSIO_T3 is not set
@@ -654,6 +674,7 @@ CONFIG_NETDEV_10000=y
654# CONFIG_MLX4_CORE is not set 674# CONFIG_MLX4_CORE is not set
655# CONFIG_TEHUTI is not set 675# CONFIG_TEHUTI is not set
656# CONFIG_BNX2X is not set 676# CONFIG_BNX2X is not set
677# CONFIG_SFC is not set
657# CONFIG_TR is not set 678# CONFIG_TR is not set
658 679
659# 680#
@@ -661,6 +682,7 @@ CONFIG_NETDEV_10000=y
661# 682#
662# CONFIG_WLAN_PRE80211 is not set 683# CONFIG_WLAN_PRE80211 is not set
663# CONFIG_WLAN_80211 is not set 684# CONFIG_WLAN_80211 is not set
685# CONFIG_IWLWIFI_LEDS is not set
664# CONFIG_WAN is not set 686# CONFIG_WAN is not set
665# CONFIG_FDDI is not set 687# CONFIG_FDDI is not set
666# CONFIG_HIPPI is not set 688# CONFIG_HIPPI is not set
@@ -701,6 +723,7 @@ CONFIG_KEYBOARD_ATKBD=y
701# CONFIG_KEYBOARD_XTKBD is not set 723# CONFIG_KEYBOARD_XTKBD is not set
702# CONFIG_KEYBOARD_NEWTON is not set 724# CONFIG_KEYBOARD_NEWTON is not set
703# CONFIG_KEYBOARD_STOWAWAY is not set 725# CONFIG_KEYBOARD_STOWAWAY is not set
726# CONFIG_KEYBOARD_SH_KEYSC is not set
704# CONFIG_INPUT_MOUSE is not set 727# CONFIG_INPUT_MOUSE is not set
705# CONFIG_INPUT_JOYSTICK is not set 728# CONFIG_INPUT_JOYSTICK is not set
706# CONFIG_INPUT_TABLET is not set 729# CONFIG_INPUT_TABLET is not set
@@ -722,6 +745,7 @@ CONFIG_SERIO_LIBPS2=y
722# Character devices 745# Character devices
723# 746#
724# CONFIG_VT is not set 747# CONFIG_VT is not set
748CONFIG_DEVKMEM=y
725# CONFIG_SERIAL_NONSTANDARD is not set 749# CONFIG_SERIAL_NONSTANDARD is not set
726# CONFIG_NOZOMI is not set 750# CONFIG_NOZOMI is not set
727 751
@@ -750,12 +774,7 @@ CONFIG_HW_RANDOM=y
750# CONFIG_TCG_TPM is not set 774# CONFIG_TCG_TPM is not set
751CONFIG_DEVPORT=y 775CONFIG_DEVPORT=y
752# CONFIG_I2C is not set 776# CONFIG_I2C is not set
753
754#
755# SPI support
756#
757# CONFIG_SPI is not set 777# CONFIG_SPI is not set
758# CONFIG_SPI_MASTER is not set
759# CONFIG_W1 is not set 778# CONFIG_W1 is not set
760# CONFIG_POWER_SUPPLY is not set 779# CONFIG_POWER_SUPPLY is not set
761CONFIG_HWMON=y 780CONFIG_HWMON=y
@@ -776,6 +795,7 @@ CONFIG_HWMON=y
776# CONFIG_SENSORS_W83627EHF is not set 795# CONFIG_SENSORS_W83627EHF is not set
777# CONFIG_HWMON_DEBUG_CHIP is not set 796# CONFIG_HWMON_DEBUG_CHIP is not set
778CONFIG_THERMAL=y 797CONFIG_THERMAL=y
798# CONFIG_THERMAL_HWMON is not set
779# CONFIG_WATCHDOG is not set 799# CONFIG_WATCHDOG is not set
780 800
781# 801#
@@ -787,13 +807,24 @@ CONFIG_SSB_POSSIBLE=y
787# 807#
788# Multifunction device drivers 808# Multifunction device drivers
789# 809#
810# CONFIG_MFD_CORE is not set
790# CONFIG_MFD_SM501 is not set 811# CONFIG_MFD_SM501 is not set
812# CONFIG_HTC_PASIC3 is not set
791 813
792# 814#
793# Multimedia devices 815# Multimedia devices
794# 816#
817
818#
819# Multimedia core support
820#
795# CONFIG_VIDEO_DEV is not set 821# CONFIG_VIDEO_DEV is not set
796# CONFIG_DVB_CORE is not set 822# CONFIG_DVB_CORE is not set
823# CONFIG_VIDEO_MEDIA is not set
824
825#
826# Multimedia drivers
827#
797CONFIG_DAB=y 828CONFIG_DAB=y
798 829
799# 830#
@@ -809,24 +840,9 @@ CONFIG_DAB=y
809# Display device support 840# Display device support
810# 841#
811# CONFIG_DISPLAY_SUPPORT is not set 842# CONFIG_DISPLAY_SUPPORT is not set
812
813#
814# Sound
815#
816CONFIG_SOUND=m 843CONFIG_SOUND=m
817
818#
819# Advanced Linux Sound Architecture
820#
821# CONFIG_SND is not set 844# CONFIG_SND is not set
822
823#
824# Open Sound System
825#
826CONFIG_SOUND_PRIME=m 845CONFIG_SOUND_PRIME=m
827# CONFIG_SOUND_TRIDENT is not set
828# CONFIG_SOUND_MSNDCLAS is not set
829# CONFIG_SOUND_MSNDPIN is not set
830CONFIG_HID_SUPPORT=y 846CONFIG_HID_SUPPORT=y
831CONFIG_HID=y 847CONFIG_HID=y
832# CONFIG_HID_DEBUG is not set 848# CONFIG_HID_DEBUG is not set
@@ -836,6 +852,8 @@ CONFIG_USB_ARCH_HAS_HCD=y
836CONFIG_USB_ARCH_HAS_OHCI=y 852CONFIG_USB_ARCH_HAS_OHCI=y
837CONFIG_USB_ARCH_HAS_EHCI=y 853CONFIG_USB_ARCH_HAS_EHCI=y
838# CONFIG_USB is not set 854# CONFIG_USB is not set
855# CONFIG_USB_OTG_WHITELIST is not set
856# CONFIG_USB_OTG_BLACKLIST_HUB is not set
839 857
840# 858#
841# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 859# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -844,6 +862,7 @@ CONFIG_USB_ARCH_HAS_EHCI=y
844# CONFIG_MMC is not set 862# CONFIG_MMC is not set
845# CONFIG_MEMSTICK is not set 863# CONFIG_MEMSTICK is not set
846# CONFIG_NEW_LEDS is not set 864# CONFIG_NEW_LEDS is not set
865# CONFIG_ACCESSIBILITY is not set
847# CONFIG_INFINIBAND is not set 866# CONFIG_INFINIBAND is not set
848CONFIG_RTC_LIB=y 867CONFIG_RTC_LIB=y
849CONFIG_RTC_CLASS=y 868CONFIG_RTC_CLASS=y
@@ -879,10 +898,7 @@ CONFIG_RTC_INTF_DEV=y
879# on-CPU RTC drivers 898# on-CPU RTC drivers
880# 899#
881CONFIG_RTC_DRV_SH=y 900CONFIG_RTC_DRV_SH=y
882 901# CONFIG_DMADEVICES is not set
883#
884# Userspace I/O
885#
886# CONFIG_UIO is not set 902# CONFIG_UIO is not set
887 903
888# 904#
@@ -903,7 +919,6 @@ CONFIG_FS_MBCACHE=y
903# CONFIG_JFS_FS is not set 919# CONFIG_JFS_FS is not set
904CONFIG_FS_POSIX_ACL=y 920CONFIG_FS_POSIX_ACL=y
905# CONFIG_XFS_FS is not set 921# CONFIG_XFS_FS is not set
906# CONFIG_GFS2_FS is not set
907# CONFIG_OCFS2_FS is not set 922# CONFIG_OCFS2_FS is not set
908CONFIG_DNOTIFY=y 923CONFIG_DNOTIFY=y
909CONFIG_INOTIFY=y 924CONFIG_INOTIFY=y
@@ -957,6 +972,7 @@ CONFIG_CONFIGFS_FS=m
957# CONFIG_CRAMFS is not set 972# CONFIG_CRAMFS is not set
958# CONFIG_VXFS_FS is not set 973# CONFIG_VXFS_FS is not set
959CONFIG_MINIX_FS=y 974CONFIG_MINIX_FS=y
975# CONFIG_OMFS_FS is not set
960# CONFIG_HPFS_FS is not set 976# CONFIG_HPFS_FS is not set
961# CONFIG_QNX4FS_FS is not set 977# CONFIG_QNX4FS_FS is not set
962# CONFIG_ROMFS_FS is not set 978# CONFIG_ROMFS_FS is not set
@@ -967,20 +983,17 @@ CONFIG_NFS_FS=y
967CONFIG_NFS_V3=y 983CONFIG_NFS_V3=y
968# CONFIG_NFS_V3_ACL is not set 984# CONFIG_NFS_V3_ACL is not set
969CONFIG_NFS_V4=y 985CONFIG_NFS_V4=y
970# CONFIG_NFS_DIRECTIO is not set 986CONFIG_ROOT_NFS=y
971CONFIG_NFSD=y 987CONFIG_NFSD=y
972CONFIG_NFSD_V3=y 988CONFIG_NFSD_V3=y
973# CONFIG_NFSD_V3_ACL is not set 989# CONFIG_NFSD_V3_ACL is not set
974CONFIG_NFSD_V4=y 990CONFIG_NFSD_V4=y
975CONFIG_NFSD_TCP=y
976CONFIG_ROOT_NFS=y
977CONFIG_LOCKD=y 991CONFIG_LOCKD=y
978CONFIG_LOCKD_V4=y 992CONFIG_LOCKD_V4=y
979CONFIG_EXPORTFS=y 993CONFIG_EXPORTFS=y
980CONFIG_NFS_COMMON=y 994CONFIG_NFS_COMMON=y
981CONFIG_SUNRPC=y 995CONFIG_SUNRPC=y
982CONFIG_SUNRPC_GSS=y 996CONFIG_SUNRPC_GSS=y
983# CONFIG_SUNRPC_BIND34 is not set
984CONFIG_RPCSEC_GSS_KRB5=y 997CONFIG_RPCSEC_GSS_KRB5=y
985# CONFIG_RPCSEC_GSS_SPKM3 is not set 998# CONFIG_RPCSEC_GSS_SPKM3 is not set
986# CONFIG_SMB_FS is not set 999# CONFIG_SMB_FS is not set
@@ -1043,6 +1056,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1043# CONFIG_PRINTK_TIME is not set 1056# CONFIG_PRINTK_TIME is not set
1044CONFIG_ENABLE_WARN_DEPRECATED=y 1057CONFIG_ENABLE_WARN_DEPRECATED=y
1045CONFIG_ENABLE_MUST_CHECK=y 1058CONFIG_ENABLE_MUST_CHECK=y
1059CONFIG_FRAME_WARN=1024
1046CONFIG_MAGIC_SYSRQ=y 1060CONFIG_MAGIC_SYSRQ=y
1047# CONFIG_UNUSED_SYMBOLS is not set 1061# CONFIG_UNUSED_SYMBOLS is not set
1048CONFIG_DEBUG_FS=y 1062CONFIG_DEBUG_FS=y
@@ -1050,9 +1064,12 @@ CONFIG_DEBUG_FS=y
1050CONFIG_DEBUG_KERNEL=y 1064CONFIG_DEBUG_KERNEL=y
1051# CONFIG_DEBUG_SHIRQ is not set 1065# CONFIG_DEBUG_SHIRQ is not set
1052CONFIG_DETECT_SOFTLOCKUP=y 1066CONFIG_DETECT_SOFTLOCKUP=y
1067# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1068CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1053CONFIG_SCHED_DEBUG=y 1069CONFIG_SCHED_DEBUG=y
1054# CONFIG_SCHEDSTATS is not set 1070# CONFIG_SCHEDSTATS is not set
1055# CONFIG_TIMER_STATS is not set 1071# CONFIG_TIMER_STATS is not set
1072# CONFIG_DEBUG_OBJECTS is not set
1056# CONFIG_DEBUG_SLAB is not set 1073# CONFIG_DEBUG_SLAB is not set
1057# CONFIG_DEBUG_PREEMPT is not set 1074# CONFIG_DEBUG_PREEMPT is not set
1058# CONFIG_DEBUG_SPINLOCK is not set 1075# CONFIG_DEBUG_SPINLOCK is not set
@@ -1066,6 +1083,8 @@ CONFIG_SCHED_DEBUG=y
1066CONFIG_DEBUG_BUGVERBOSE=y 1083CONFIG_DEBUG_BUGVERBOSE=y
1067CONFIG_DEBUG_INFO=y 1084CONFIG_DEBUG_INFO=y
1068# CONFIG_DEBUG_VM is not set 1085# CONFIG_DEBUG_VM is not set
1086# CONFIG_DEBUG_WRITECOUNT is not set
1087# CONFIG_DEBUG_MEMORY_INIT is not set
1069# CONFIG_DEBUG_LIST is not set 1088# CONFIG_DEBUG_LIST is not set
1070# CONFIG_DEBUG_SG is not set 1089# CONFIG_DEBUG_SG is not set
1071# CONFIG_FRAME_POINTER is not set 1090# CONFIG_FRAME_POINTER is not set
@@ -1091,51 +1110,84 @@ CONFIG_DEBUG_STACKOVERFLOW=y
1091# CONFIG_SECURITY is not set 1110# CONFIG_SECURITY is not set
1092# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1111# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1093CONFIG_CRYPTO=y 1112CONFIG_CRYPTO=y
1113
1114#
1115# Crypto core or helper
1116#
1094CONFIG_CRYPTO_ALGAPI=y 1117CONFIG_CRYPTO_ALGAPI=y
1095CONFIG_CRYPTO_BLKCIPHER=y 1118CONFIG_CRYPTO_BLKCIPHER=y
1096# CONFIG_CRYPTO_SEQIV is not set
1097CONFIG_CRYPTO_HASH=y 1119CONFIG_CRYPTO_HASH=y
1098CONFIG_CRYPTO_MANAGER=y 1120CONFIG_CRYPTO_MANAGER=y
1121# CONFIG_CRYPTO_GF128MUL is not set
1122# CONFIG_CRYPTO_NULL is not set
1123# CONFIG_CRYPTO_CRYPTD is not set
1124# CONFIG_CRYPTO_AUTHENC is not set
1125# CONFIG_CRYPTO_TEST is not set
1126
1127#
1128# Authenticated Encryption with Associated Data
1129#
1130# CONFIG_CRYPTO_CCM is not set
1131# CONFIG_CRYPTO_GCM is not set
1132# CONFIG_CRYPTO_SEQIV is not set
1133
1134#
1135# Block modes
1136#
1137CONFIG_CRYPTO_CBC=y
1138# CONFIG_CRYPTO_CTR is not set
1139# CONFIG_CRYPTO_CTS is not set
1140CONFIG_CRYPTO_ECB=m
1141# CONFIG_CRYPTO_LRW is not set
1142CONFIG_CRYPTO_PCBC=m
1143# CONFIG_CRYPTO_XTS is not set
1144
1145#
1146# Hash modes
1147#
1099CONFIG_CRYPTO_HMAC=y 1148CONFIG_CRYPTO_HMAC=y
1100# CONFIG_CRYPTO_XCBC is not set 1149# CONFIG_CRYPTO_XCBC is not set
1101# CONFIG_CRYPTO_NULL is not set 1150
1151#
1152# Digest
1153#
1154# CONFIG_CRYPTO_CRC32C is not set
1102# CONFIG_CRYPTO_MD4 is not set 1155# CONFIG_CRYPTO_MD4 is not set
1103CONFIG_CRYPTO_MD5=y 1156CONFIG_CRYPTO_MD5=y
1157# CONFIG_CRYPTO_MICHAEL_MIC is not set
1158# CONFIG_CRYPTO_RMD128 is not set
1159# CONFIG_CRYPTO_RMD160 is not set
1160# CONFIG_CRYPTO_RMD256 is not set
1161# CONFIG_CRYPTO_RMD320 is not set
1104# CONFIG_CRYPTO_SHA1 is not set 1162# CONFIG_CRYPTO_SHA1 is not set
1105# CONFIG_CRYPTO_SHA256 is not set 1163# CONFIG_CRYPTO_SHA256 is not set
1106# CONFIG_CRYPTO_SHA512 is not set 1164# CONFIG_CRYPTO_SHA512 is not set
1107# CONFIG_CRYPTO_WP512 is not set
1108# CONFIG_CRYPTO_TGR192 is not set 1165# CONFIG_CRYPTO_TGR192 is not set
1109# CONFIG_CRYPTO_GF128MUL is not set 1166# CONFIG_CRYPTO_WP512 is not set
1110CONFIG_CRYPTO_ECB=m 1167
1111CONFIG_CRYPTO_CBC=y 1168#
1112CONFIG_CRYPTO_PCBC=m 1169# Ciphers
1113# CONFIG_CRYPTO_LRW is not set 1170#
1114# CONFIG_CRYPTO_XTS is not set
1115# CONFIG_CRYPTO_CTR is not set
1116# CONFIG_CRYPTO_GCM is not set
1117# CONFIG_CRYPTO_CCM is not set
1118# CONFIG_CRYPTO_CRYPTD is not set
1119CONFIG_CRYPTO_DES=y
1120# CONFIG_CRYPTO_FCRYPT is not set
1121# CONFIG_CRYPTO_BLOWFISH is not set
1122# CONFIG_CRYPTO_TWOFISH is not set
1123# CONFIG_CRYPTO_SERPENT is not set
1124# CONFIG_CRYPTO_AES is not set 1171# CONFIG_CRYPTO_AES is not set
1172# CONFIG_CRYPTO_ANUBIS is not set
1173# CONFIG_CRYPTO_ARC4 is not set
1174# CONFIG_CRYPTO_BLOWFISH is not set
1175# CONFIG_CRYPTO_CAMELLIA is not set
1125# CONFIG_CRYPTO_CAST5 is not set 1176# CONFIG_CRYPTO_CAST5 is not set
1126# CONFIG_CRYPTO_CAST6 is not set 1177# CONFIG_CRYPTO_CAST6 is not set
1127# CONFIG_CRYPTO_TEA is not set 1178CONFIG_CRYPTO_DES=y
1128# CONFIG_CRYPTO_ARC4 is not set 1179# CONFIG_CRYPTO_FCRYPT is not set
1129# CONFIG_CRYPTO_KHAZAD is not set 1180# CONFIG_CRYPTO_KHAZAD is not set
1130# CONFIG_CRYPTO_ANUBIS is not set
1131# CONFIG_CRYPTO_SEED is not set
1132# CONFIG_CRYPTO_SALSA20 is not set 1181# CONFIG_CRYPTO_SALSA20 is not set
1182# CONFIG_CRYPTO_SEED is not set
1183# CONFIG_CRYPTO_SERPENT is not set
1184# CONFIG_CRYPTO_TEA is not set
1185# CONFIG_CRYPTO_TWOFISH is not set
1186
1187#
1188# Compression
1189#
1133# CONFIG_CRYPTO_DEFLATE is not set 1190# CONFIG_CRYPTO_DEFLATE is not set
1134# CONFIG_CRYPTO_MICHAEL_MIC is not set
1135# CONFIG_CRYPTO_CRC32C is not set
1136# CONFIG_CRYPTO_CAMELLIA is not set
1137# CONFIG_CRYPTO_TEST is not set
1138# CONFIG_CRYPTO_AUTHENC is not set
1139# CONFIG_CRYPTO_LZO is not set 1191# CONFIG_CRYPTO_LZO is not set
1140CONFIG_CRYPTO_HW=y 1192CONFIG_CRYPTO_HW=y
1141# CONFIG_CRYPTO_DEV_HIFN_795X is not set 1193# CONFIG_CRYPTO_DEV_HIFN_795X is not set
@@ -1144,8 +1196,10 @@ CONFIG_CRYPTO_HW=y
1144# Library routines 1196# Library routines
1145# 1197#
1146CONFIG_BITREVERSE=y 1198CONFIG_BITREVERSE=y
1199# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1147# CONFIG_CRC_CCITT is not set 1200# CONFIG_CRC_CCITT is not set
1148# CONFIG_CRC16 is not set 1201# CONFIG_CRC16 is not set
1202CONFIG_CRC_T10DIF=y
1149# CONFIG_CRC_ITU_T is not set 1203# CONFIG_CRC_ITU_T is not set
1150CONFIG_CRC32=y 1204CONFIG_CRC32=y
1151# CONFIG_CRC7 is not set 1205# CONFIG_CRC7 is not set
diff --git a/arch/sh/configs/r7785rp_defconfig b/arch/sh/configs/r7785rp_defconfig
index 0dc1ce7b9349..1d09d24d4298 100644
--- a/arch/sh/configs/r7785rp_defconfig
+++ b/arch/sh/configs/r7785rp_defconfig
@@ -1,10 +1,11 @@
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-rc3 3# Linux kernel version: 2.6.26
4# Fri Nov 23 14:03:57 2007 4# Wed Jul 30 00:59:19 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -21,6 +22,8 @@ CONFIG_LOCKDEP_SUPPORT=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set 22# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set 23# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_ARCH_NO_VIRT_TO_BUS=y 24CONFIG_ARCH_NO_VIRT_TO_BUS=y
25CONFIG_ARCH_SUPPORTS_AOUT=y
26CONFIG_IO_TRAPPED=y
24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
25 28
26# 29#
@@ -39,18 +42,16 @@ CONFIG_SYSVIPC_SYSCTL=y
39CONFIG_BSD_PROCESS_ACCT=y 42CONFIG_BSD_PROCESS_ACCT=y
40# CONFIG_BSD_PROCESS_ACCT_V3 is not set 43# CONFIG_BSD_PROCESS_ACCT_V3 is not set
41# CONFIG_TASKSTATS is not set 44# 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_AUDIT is not set
45CONFIG_IKCONFIG=y 46CONFIG_IKCONFIG=y
46CONFIG_IKCONFIG_PROC=y 47CONFIG_IKCONFIG_PROC=y
47CONFIG_LOG_BUF_SHIFT=14 48CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set 49# CONFIG_CGROUPS is not set
49CONFIG_FAIR_GROUP_SCHED=y 50# CONFIG_GROUP_SCHED is not set
50CONFIG_FAIR_USER_SCHED=y 51CONFIG_SYSFS_DEPRECATED=y
51# CONFIG_FAIR_CGROUP_SCHED is not set 52CONFIG_SYSFS_DEPRECATED_V2=y
52# CONFIG_SYSFS_DEPRECATED is not set
53# CONFIG_RELAY is not set 53# CONFIG_RELAY is not set
54# CONFIG_NAMESPACES is not set
54# CONFIG_BLK_DEV_INITRD is not set 55# CONFIG_BLK_DEV_INITRD is not set
55CONFIG_CC_OPTIMIZE_FOR_SIZE=y 56CONFIG_CC_OPTIMIZE_FOR_SIZE=y
56CONFIG_SYSCTL=y 57CONFIG_SYSCTL=y
@@ -64,20 +65,37 @@ CONFIG_HOTPLUG=y
64CONFIG_PRINTK=y 65CONFIG_PRINTK=y
65CONFIG_BUG=y 66CONFIG_BUG=y
66CONFIG_ELF_CORE=y 67CONFIG_ELF_CORE=y
68CONFIG_COMPAT_BRK=y
67CONFIG_BASE_FULL=y 69CONFIG_BASE_FULL=y
68# CONFIG_FUTEX is not set 70# CONFIG_FUTEX is not set
69CONFIG_ANON_INODES=y 71CONFIG_ANON_INODES=y
70# CONFIG_EPOLL is not set 72# CONFIG_EPOLL is not set
71CONFIG_SIGNALFD=y 73CONFIG_SIGNALFD=y
74CONFIG_TIMERFD=y
72CONFIG_EVENTFD=y 75CONFIG_EVENTFD=y
73CONFIG_SHMEM=y 76CONFIG_SHMEM=y
74CONFIG_VM_EVENT_COUNTERS=y 77CONFIG_VM_EVENT_COUNTERS=y
75CONFIG_SLAB=y 78CONFIG_SLAB=y
76# CONFIG_SLUB is not set 79# CONFIG_SLUB is not set
77# CONFIG_SLOB is not set 80# CONFIG_SLOB is not set
81CONFIG_PROFILING=y
82# CONFIG_MARKERS is not set
83CONFIG_OPROFILE=m
84CONFIG_HAVE_OPROFILE=y
85# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
86# CONFIG_HAVE_IOREMAP_PROT is not set
87# CONFIG_HAVE_KPROBES is not set
88# CONFIG_HAVE_KRETPROBES is not set
89# CONFIG_HAVE_ARCH_TRACEHOOK is not set
90# CONFIG_HAVE_DMA_ATTRS is not set
91# CONFIG_USE_GENERIC_SMP_HELPERS is not set
92CONFIG_HAVE_CLK=y
93CONFIG_PROC_PAGE_MONITOR=y
94CONFIG_SLABINFO=y
78# CONFIG_TINY_SHMEM is not set 95# CONFIG_TINY_SHMEM is not set
79CONFIG_BASE_SMALL=0 96CONFIG_BASE_SMALL=0
80CONFIG_MODULES=y 97CONFIG_MODULES=y
98# CONFIG_MODULE_FORCE_LOAD is not set
81CONFIG_MODULE_UNLOAD=y 99CONFIG_MODULE_UNLOAD=y
82# CONFIG_MODULE_FORCE_UNLOAD is not set 100# CONFIG_MODULE_FORCE_UNLOAD is not set
83# CONFIG_MODVERSIONS is not set 101# CONFIG_MODVERSIONS is not set
@@ -88,6 +106,7 @@ CONFIG_BLOCK=y
88# CONFIG_BLK_DEV_IO_TRACE is not set 106# CONFIG_BLK_DEV_IO_TRACE is not set
89# CONFIG_LSF is not set 107# CONFIG_LSF is not set
90# CONFIG_BLK_DEV_BSG is not set 108# CONFIG_BLK_DEV_BSG is not set
109# CONFIG_BLK_DEV_INTEGRITY is not set
91 110
92# 111#
93# IO Schedulers 112# IO Schedulers
@@ -101,6 +120,7 @@ CONFIG_IOSCHED_NOOP=y
101# CONFIG_DEFAULT_CFQ is not set 120# CONFIG_DEFAULT_CFQ is not set
102CONFIG_DEFAULT_NOOP=y 121CONFIG_DEFAULT_NOOP=y
103CONFIG_DEFAULT_IOSCHED="noop" 122CONFIG_DEFAULT_IOSCHED="noop"
123CONFIG_CLASSIC_RCU=y
104 124
105# 125#
106# System type 126# System type
@@ -109,7 +129,10 @@ CONFIG_CPU_SH4=y
109CONFIG_CPU_SH4A=y 129CONFIG_CPU_SH4A=y
110CONFIG_CPU_SHX2=y 130CONFIG_CPU_SHX2=y
111# CONFIG_CPU_SUBTYPE_SH7619 is not set 131# CONFIG_CPU_SUBTYPE_SH7619 is not set
132# CONFIG_CPU_SUBTYPE_SH7203 is not set
112# CONFIG_CPU_SUBTYPE_SH7206 is not set 133# CONFIG_CPU_SUBTYPE_SH7206 is not set
134# CONFIG_CPU_SUBTYPE_SH7263 is not set
135# CONFIG_CPU_SUBTYPE_MXG is not set
113# CONFIG_CPU_SUBTYPE_SH7705 is not set 136# CONFIG_CPU_SUBTYPE_SH7705 is not set
114# CONFIG_CPU_SUBTYPE_SH7706 is not set 137# CONFIG_CPU_SUBTYPE_SH7706 is not set
115# CONFIG_CPU_SUBTYPE_SH7707 is not set 138# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -118,6 +141,7 @@ CONFIG_CPU_SHX2=y
118# CONFIG_CPU_SUBTYPE_SH7710 is not set 141# CONFIG_CPU_SUBTYPE_SH7710 is not set
119# CONFIG_CPU_SUBTYPE_SH7712 is not set 142# CONFIG_CPU_SUBTYPE_SH7712 is not set
120# CONFIG_CPU_SUBTYPE_SH7720 is not set 143# CONFIG_CPU_SUBTYPE_SH7720 is not set
144# CONFIG_CPU_SUBTYPE_SH7721 is not set
121# CONFIG_CPU_SUBTYPE_SH7750 is not set 145# CONFIG_CPU_SUBTYPE_SH7750 is not set
122# CONFIG_CPU_SUBTYPE_SH7091 is not set 146# CONFIG_CPU_SUBTYPE_SH7091 is not set
123# CONFIG_CPU_SUBTYPE_SH7750R is not set 147# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -126,12 +150,15 @@ CONFIG_CPU_SHX2=y
126# CONFIG_CPU_SUBTYPE_SH7751R is not set 150# CONFIG_CPU_SUBTYPE_SH7751R is not set
127# CONFIG_CPU_SUBTYPE_SH7760 is not set 151# CONFIG_CPU_SUBTYPE_SH7760 is not set
128# CONFIG_CPU_SUBTYPE_SH4_202 is not set 152# CONFIG_CPU_SUBTYPE_SH4_202 is not set
153# CONFIG_CPU_SUBTYPE_SH7723 is not set
154# CONFIG_CPU_SUBTYPE_SH7763 is not set
129# CONFIG_CPU_SUBTYPE_SH7770 is not set 155# CONFIG_CPU_SUBTYPE_SH7770 is not set
130# CONFIG_CPU_SUBTYPE_SH7780 is not set 156# CONFIG_CPU_SUBTYPE_SH7780 is not set
131CONFIG_CPU_SUBTYPE_SH7785=y 157CONFIG_CPU_SUBTYPE_SH7785=y
132# CONFIG_CPU_SUBTYPE_SHX3 is not set 158# CONFIG_CPU_SUBTYPE_SHX3 is not set
133# CONFIG_CPU_SUBTYPE_SH7343 is not set 159# CONFIG_CPU_SUBTYPE_SH7343 is not set
134# CONFIG_CPU_SUBTYPE_SH7722 is not set 160# CONFIG_CPU_SUBTYPE_SH7722 is not set
161# CONFIG_CPU_SUBTYPE_SH7366 is not set
135# CONFIG_CPU_SUBTYPE_SH5_101 is not set 162# CONFIG_CPU_SUBTYPE_SH5_101 is not set
136# CONFIG_CPU_SUBTYPE_SH5_103 is not set 163# CONFIG_CPU_SUBTYPE_SH5_103 is not set
137 164
@@ -157,7 +184,9 @@ CONFIG_ARCH_SELECT_MEMORY_MODEL=y
157CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 184CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
158CONFIG_PAGE_SIZE_4KB=y 185CONFIG_PAGE_SIZE_4KB=y
159# CONFIG_PAGE_SIZE_8KB is not set 186# CONFIG_PAGE_SIZE_8KB is not set
187# CONFIG_PAGE_SIZE_16KB is not set
160# CONFIG_PAGE_SIZE_64KB is not set 188# CONFIG_PAGE_SIZE_64KB is not set
189CONFIG_ENTRY_OFFSET=0x00001000
161# CONFIG_HUGETLB_PAGE_SIZE_64K is not set 190# CONFIG_HUGETLB_PAGE_SIZE_64K is not set
162# CONFIG_HUGETLB_PAGE_SIZE_256K is not set 191# CONFIG_HUGETLB_PAGE_SIZE_256K is not set
163CONFIG_HUGETLB_PAGE_SIZE_1MB=y 192CONFIG_HUGETLB_PAGE_SIZE_1MB=y
@@ -173,6 +202,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y
173CONFIG_SPARSEMEM_STATIC=y 202CONFIG_SPARSEMEM_STATIC=y
174# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 203# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
175# CONFIG_MEMORY_HOTPLUG is not set 204# CONFIG_MEMORY_HOTPLUG is not set
205CONFIG_PAGEFLAGS_EXTENDED=y
176CONFIG_SPLIT_PTLOCK_CPUS=4 206CONFIG_SPLIT_PTLOCK_CPUS=4
177# CONFIG_RESOURCES_64BIT is not set 207# CONFIG_RESOURCES_64BIT is not set
178CONFIG_ZONE_DMA_FLAG=0 208CONFIG_ZONE_DMA_FLAG=0
@@ -202,6 +232,7 @@ CONFIG_CPU_HAS_FPU=y
202# Board support 232# Board support
203# 233#
204CONFIG_SH_HIGHLANDER=y 234CONFIG_SH_HIGHLANDER=y
235# CONFIG_SH_SH7785LCR is not set
205# CONFIG_SH_R7780RP is not set 236# CONFIG_SH_R7780RP is not set
206# CONFIG_SH_R7780MP is not set 237# CONFIG_SH_R7780MP is not set
207CONFIG_SH_R7785RP=y 238CONFIG_SH_R7785RP=y
@@ -245,12 +276,13 @@ CONFIG_HZ_250=y
245# CONFIG_HZ_300 is not set 276# CONFIG_HZ_300 is not set
246# CONFIG_HZ_1000 is not set 277# CONFIG_HZ_1000 is not set
247CONFIG_HZ=250 278CONFIG_HZ=250
279# CONFIG_SCHED_HRTICK is not set
248CONFIG_KEXEC=y 280CONFIG_KEXEC=y
249# CONFIG_CRASH_DUMP is not set 281# CONFIG_CRASH_DUMP is not set
250# CONFIG_PREEMPT_NONE is not set 282# CONFIG_PREEMPT_NONE is not set
251# CONFIG_PREEMPT_VOLUNTARY is not set 283# CONFIG_PREEMPT_VOLUNTARY is not set
252CONFIG_PREEMPT=y 284CONFIG_PREEMPT=y
253CONFIG_PREEMPT_BKL=y 285# CONFIG_PREEMPT_RCU is not set
254CONFIG_GUSA=y 286CONFIG_GUSA=y
255 287
256# 288#
@@ -295,6 +327,7 @@ CONFIG_XFRM=y
295# CONFIG_XFRM_USER is not set 327# CONFIG_XFRM_USER is not set
296# CONFIG_XFRM_SUB_POLICY is not set 328# CONFIG_XFRM_SUB_POLICY is not set
297# CONFIG_XFRM_MIGRATE is not set 329# CONFIG_XFRM_MIGRATE is not set
330# CONFIG_XFRM_STATISTICS is not set
298# CONFIG_NET_KEY is not set 331# CONFIG_NET_KEY is not set
299CONFIG_INET=y 332CONFIG_INET=y
300# CONFIG_IP_MULTICAST is not set 333# CONFIG_IP_MULTICAST is not set
@@ -329,14 +362,13 @@ CONFIG_TCP_CONG_CUBIC=y
329CONFIG_DEFAULT_TCP_CONG="cubic" 362CONFIG_DEFAULT_TCP_CONG="cubic"
330# CONFIG_TCP_MD5SIG is not set 363# CONFIG_TCP_MD5SIG is not set
331# CONFIG_IPV6 is not set 364# CONFIG_IPV6 is not set
332# CONFIG_INET6_XFRM_TUNNEL is not set
333# CONFIG_INET6_TUNNEL is not set
334# CONFIG_NETWORK_SECMARK is not set 365# CONFIG_NETWORK_SECMARK is not set
335# CONFIG_NETFILTER is not set 366# CONFIG_NETFILTER is not set
336# CONFIG_IP_DCCP is not set 367# CONFIG_IP_DCCP is not set
337# CONFIG_IP_SCTP is not set 368# CONFIG_IP_SCTP is not set
338# CONFIG_TIPC is not set 369# CONFIG_TIPC is not set
339# CONFIG_ATM is not set 370# CONFIG_ATM is not set
371CONFIG_STP=m
340CONFIG_BRIDGE=m 372CONFIG_BRIDGE=m
341# CONFIG_VLAN_8021Q is not set 373# CONFIG_VLAN_8021Q is not set
342# CONFIG_DECNET is not set 374# CONFIG_DECNET is not set
@@ -355,6 +387,7 @@ CONFIG_LLC=m
355# 387#
356# CONFIG_NET_PKTGEN is not set 388# CONFIG_NET_PKTGEN is not set
357# CONFIG_HAMRADIO is not set 389# CONFIG_HAMRADIO is not set
390# CONFIG_CAN is not set
358# CONFIG_IRDA is not set 391# CONFIG_IRDA is not set
359# CONFIG_BT is not set 392# CONFIG_BT is not set
360# CONFIG_AF_RXRPC is not set 393# CONFIG_AF_RXRPC is not set
@@ -364,6 +397,7 @@ CONFIG_LLC=m
364# 397#
365# CONFIG_CFG80211 is not set 398# CONFIG_CFG80211 is not set
366CONFIG_WIRELESS_EXT=y 399CONFIG_WIRELESS_EXT=y
400CONFIG_WIRELESS_EXT_SYSFS=y
367# CONFIG_MAC80211 is not set 401# CONFIG_MAC80211 is not set
368# CONFIG_IEEE80211 is not set 402# CONFIG_IEEE80211 is not set
369# CONFIG_RFKILL is not set 403# CONFIG_RFKILL is not set
@@ -380,6 +414,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
380CONFIG_STANDALONE=y 414CONFIG_STANDALONE=y
381CONFIG_PREVENT_FIRMWARE_BUILD=y 415CONFIG_PREVENT_FIRMWARE_BUILD=y
382CONFIG_FW_LOADER=m 416CONFIG_FW_LOADER=m
417CONFIG_FIRMWARE_IN_KERNEL=y
418CONFIG_EXTRA_FIRMWARE=""
383# CONFIG_DEBUG_DRIVER is not set 419# CONFIG_DEBUG_DRIVER is not set
384# CONFIG_DEBUG_DEVRES is not set 420# CONFIG_DEBUG_DEVRES is not set
385# CONFIG_SYS_HYPERVISOR is not set 421# CONFIG_SYS_HYPERVISOR is not set
@@ -397,14 +433,18 @@ CONFIG_BLK_DEV=y
397CONFIG_BLK_DEV_RAM=y 433CONFIG_BLK_DEV_RAM=y
398CONFIG_BLK_DEV_RAM_COUNT=16 434CONFIG_BLK_DEV_RAM_COUNT=16
399CONFIG_BLK_DEV_RAM_SIZE=4096 435CONFIG_BLK_DEV_RAM_SIZE=4096
400CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 436# CONFIG_BLK_DEV_XIP is not set
401# CONFIG_CDROM_PKTCDVD is not set 437# CONFIG_CDROM_PKTCDVD is not set
402# CONFIG_ATA_OVER_ETH is not set 438# CONFIG_ATA_OVER_ETH is not set
439# CONFIG_BLK_DEV_HD is not set
403CONFIG_MISC_DEVICES=y 440CONFIG_MISC_DEVICES=y
404# CONFIG_PHANTOM is not set 441# CONFIG_PHANTOM is not set
405CONFIG_EEPROM_93CX6=y 442CONFIG_EEPROM_93CX6=y
406# CONFIG_SGI_IOC4 is not set 443# CONFIG_SGI_IOC4 is not set
407# CONFIG_TIFM_CORE is not set 444# CONFIG_TIFM_CORE is not set
445# CONFIG_ENCLOSURE_SERVICES is not set
446# CONFIG_HP_ILO is not set
447CONFIG_HAVE_IDE=y
408# CONFIG_IDE is not set 448# CONFIG_IDE is not set
409 449
410# 450#
@@ -464,6 +504,7 @@ CONFIG_SCSI_LOWLEVEL=y
464# CONFIG_SCSI_IPS is not set 504# CONFIG_SCSI_IPS is not set
465# CONFIG_SCSI_INITIO is not set 505# CONFIG_SCSI_INITIO is not set
466# CONFIG_SCSI_INIA100 is not set 506# CONFIG_SCSI_INIA100 is not set
507# CONFIG_SCSI_MVSAS is not set
467# CONFIG_SCSI_STEX is not set 508# CONFIG_SCSI_STEX is not set
468# CONFIG_SCSI_SYM53C8XX_2 is not set 509# CONFIG_SCSI_SYM53C8XX_2 is not set
469# CONFIG_SCSI_IPR is not set 510# CONFIG_SCSI_IPR is not set
@@ -476,9 +517,13 @@ CONFIG_SCSI_LOWLEVEL=y
476# CONFIG_SCSI_NSP32 is not set 517# CONFIG_SCSI_NSP32 is not set
477# CONFIG_SCSI_DEBUG is not set 518# CONFIG_SCSI_DEBUG is not set
478# CONFIG_SCSI_SRP is not set 519# CONFIG_SCSI_SRP is not set
520# CONFIG_SCSI_DH is not set
479CONFIG_ATA=y 521CONFIG_ATA=y
480# CONFIG_ATA_NONSTANDARD is not set 522# CONFIG_ATA_NONSTANDARD is not set
523CONFIG_SATA_PMP=y
481# CONFIG_SATA_AHCI is not set 524# CONFIG_SATA_AHCI is not set
525# CONFIG_SATA_SIL24 is not set
526CONFIG_ATA_SFF=y
482# CONFIG_SATA_SVW is not set 527# CONFIG_SATA_SVW is not set
483# CONFIG_ATA_PIIX is not set 528# CONFIG_ATA_PIIX is not set
484# CONFIG_SATA_MV is not set 529# CONFIG_SATA_MV is not set
@@ -488,7 +533,6 @@ CONFIG_ATA=y
488# CONFIG_SATA_PROMISE is not set 533# CONFIG_SATA_PROMISE is not set
489# CONFIG_SATA_SX4 is not set 534# CONFIG_SATA_SX4 is not set
490CONFIG_SATA_SIL=y 535CONFIG_SATA_SIL=y
491# CONFIG_SATA_SIL24 is not set
492# CONFIG_SATA_SIS is not set 536# CONFIG_SATA_SIS is not set
493# CONFIG_SATA_ULI is not set 537# CONFIG_SATA_ULI is not set
494# CONFIG_SATA_VIA is not set 538# CONFIG_SATA_VIA is not set
@@ -517,6 +561,7 @@ CONFIG_SATA_SIL=y
517# CONFIG_PATA_MPIIX is not set 561# CONFIG_PATA_MPIIX is not set
518# CONFIG_PATA_OLDPIIX is not set 562# CONFIG_PATA_OLDPIIX is not set
519# CONFIG_PATA_NETCELL is not set 563# CONFIG_PATA_NETCELL is not set
564# CONFIG_PATA_NINJA32 is not set
520# CONFIG_PATA_NS87410 is not set 565# CONFIG_PATA_NS87410 is not set
521# CONFIG_PATA_NS87415 is not set 566# CONFIG_PATA_NS87415 is not set
522# CONFIG_PATA_OPTI is not set 567# CONFIG_PATA_OPTI is not set
@@ -532,24 +577,27 @@ CONFIG_SATA_SIL=y
532# CONFIG_PATA_VIA is not set 577# CONFIG_PATA_VIA is not set
533# CONFIG_PATA_WINBOND is not set 578# CONFIG_PATA_WINBOND is not set
534CONFIG_PATA_PLATFORM=y 579CONFIG_PATA_PLATFORM=y
580# CONFIG_PATA_SCH is not set
535# CONFIG_MD is not set 581# CONFIG_MD is not set
536# CONFIG_FUSION is not set 582# CONFIG_FUSION is not set
537 583
538# 584#
539# IEEE 1394 (FireWire) support 585# IEEE 1394 (FireWire) support
540# 586#
587
588#
589# Enable only one of the two stacks, unless you know what you are doing
590#
541# CONFIG_FIREWIRE is not set 591# CONFIG_FIREWIRE is not set
542# CONFIG_IEEE1394 is not set 592# CONFIG_IEEE1394 is not set
543# CONFIG_I2O is not set 593# CONFIG_I2O is not set
544CONFIG_NETDEVICES=y 594CONFIG_NETDEVICES=y
545# CONFIG_NETDEVICES_MULTIQUEUE is not set
546# CONFIG_DUMMY is not set 595# CONFIG_DUMMY is not set
547# CONFIG_BONDING is not set 596# CONFIG_BONDING is not set
548# CONFIG_MACVLAN is not set 597# CONFIG_MACVLAN is not set
549# CONFIG_EQUALIZER is not set 598# CONFIG_EQUALIZER is not set
550# CONFIG_TUN is not set 599# CONFIG_TUN is not set
551# CONFIG_VETH is not set 600# CONFIG_VETH is not set
552# CONFIG_IP1000 is not set
553# CONFIG_ARCNET is not set 601# CONFIG_ARCNET is not set
554# CONFIG_PHYLIB is not set 602# CONFIG_PHYLIB is not set
555CONFIG_NET_ETHERNET=y 603CONFIG_NET_ETHERNET=y
@@ -576,20 +624,21 @@ CONFIG_NETDEV_1000=y
576# CONFIG_DL2K is not set 624# CONFIG_DL2K is not set
577# CONFIG_E1000 is not set 625# CONFIG_E1000 is not set
578# CONFIG_E1000E is not set 626# CONFIG_E1000E is not set
627# CONFIG_IP1000 is not set
628# CONFIG_IGB is not set
579# CONFIG_NS83820 is not set 629# CONFIG_NS83820 is not set
580# CONFIG_HAMACHI is not set 630# CONFIG_HAMACHI is not set
581# CONFIG_YELLOWFIN is not set 631# CONFIG_YELLOWFIN is not set
582CONFIG_R8169=y 632CONFIG_R8169=y
583# CONFIG_R8169_NAPI is not set
584# CONFIG_SIS190 is not set 633# CONFIG_SIS190 is not set
585# CONFIG_SKGE is not set 634# CONFIG_SKGE is not set
586# CONFIG_SKY2 is not set 635# CONFIG_SKY2 is not set
587# CONFIG_SK98LIN is not set
588# CONFIG_VIA_VELOCITY is not set 636# CONFIG_VIA_VELOCITY is not set
589# CONFIG_TIGON3 is not set 637# CONFIG_TIGON3 is not set
590# CONFIG_BNX2 is not set 638# CONFIG_BNX2 is not set
591# CONFIG_QLA3XXX is not set 639# CONFIG_QLA3XXX is not set
592# CONFIG_ATL1 is not set 640# CONFIG_ATL1 is not set
641# CONFIG_ATL1E is not set
593CONFIG_NETDEV_10000=y 642CONFIG_NETDEV_10000=y
594# CONFIG_CHELSIO_T1 is not set 643# CONFIG_CHELSIO_T1 is not set
595# CONFIG_CHELSIO_T3 is not set 644# CONFIG_CHELSIO_T3 is not set
@@ -601,6 +650,8 @@ CONFIG_NETDEV_10000=y
601# CONFIG_NIU is not set 650# CONFIG_NIU is not set
602# CONFIG_MLX4_CORE is not set 651# CONFIG_MLX4_CORE is not set
603# CONFIG_TEHUTI is not set 652# CONFIG_TEHUTI is not set
653# CONFIG_BNX2X is not set
654# CONFIG_SFC is not set
604# CONFIG_TR is not set 655# CONFIG_TR is not set
605 656
606# 657#
@@ -608,13 +659,13 @@ CONFIG_NETDEV_10000=y
608# 659#
609# CONFIG_WLAN_PRE80211 is not set 660# CONFIG_WLAN_PRE80211 is not set
610# CONFIG_WLAN_80211 is not set 661# CONFIG_WLAN_80211 is not set
662# CONFIG_IWLWIFI_LEDS is not set
611# CONFIG_WAN is not set 663# CONFIG_WAN is not set
612# CONFIG_FDDI is not set 664# CONFIG_FDDI is not set
613# CONFIG_HIPPI is not set 665# CONFIG_HIPPI is not set
614# CONFIG_PPP is not set 666# CONFIG_PPP is not set
615# CONFIG_SLIP is not set 667# CONFIG_SLIP is not set
616# CONFIG_NET_FC is not set 668# CONFIG_NET_FC is not set
617# CONFIG_SHAPER is not set
618# CONFIG_NETCONSOLE is not set 669# CONFIG_NETCONSOLE is not set
619# CONFIG_NETPOLL is not set 670# CONFIG_NETPOLL is not set
620# CONFIG_NET_POLL_CONTROLLER is not set 671# CONFIG_NET_POLL_CONTROLLER is not set
@@ -649,6 +700,7 @@ CONFIG_KEYBOARD_ATKBD=y
649# CONFIG_KEYBOARD_XTKBD is not set 700# CONFIG_KEYBOARD_XTKBD is not set
650# CONFIG_KEYBOARD_NEWTON is not set 701# CONFIG_KEYBOARD_NEWTON is not set
651# CONFIG_KEYBOARD_STOWAWAY is not set 702# CONFIG_KEYBOARD_STOWAWAY is not set
703# CONFIG_KEYBOARD_SH_KEYSC is not set
652# CONFIG_INPUT_MOUSE is not set 704# CONFIG_INPUT_MOUSE is not set
653# CONFIG_INPUT_JOYSTICK is not set 705# CONFIG_INPUT_JOYSTICK is not set
654# CONFIG_INPUT_TABLET is not set 706# CONFIG_INPUT_TABLET is not set
@@ -670,7 +722,9 @@ CONFIG_SERIO_LIBPS2=y
670# Character devices 722# Character devices
671# 723#
672# CONFIG_VT is not set 724# CONFIG_VT is not set
725CONFIG_DEVKMEM=y
673# CONFIG_SERIAL_NONSTANDARD is not set 726# CONFIG_SERIAL_NONSTANDARD is not set
727# CONFIG_NOZOMI is not set
674 728
675# 729#
676# Serial drivers 730# Serial drivers
@@ -697,12 +751,7 @@ CONFIG_HW_RANDOM=y
697# CONFIG_TCG_TPM is not set 751# CONFIG_TCG_TPM is not set
698CONFIG_DEVPORT=y 752CONFIG_DEVPORT=y
699# CONFIG_I2C is not set 753# CONFIG_I2C is not set
700
701#
702# SPI support
703#
704# CONFIG_SPI is not set 754# CONFIG_SPI is not set
705# CONFIG_SPI_MASTER is not set
706# CONFIG_W1 is not set 755# CONFIG_W1 is not set
707# CONFIG_POWER_SUPPLY is not set 756# CONFIG_POWER_SUPPLY is not set
708CONFIG_HWMON=y 757CONFIG_HWMON=y
@@ -722,6 +771,8 @@ CONFIG_HWMON=y
722# CONFIG_SENSORS_W83627HF is not set 771# CONFIG_SENSORS_W83627HF is not set
723# CONFIG_SENSORS_W83627EHF is not set 772# CONFIG_SENSORS_W83627EHF is not set
724# CONFIG_HWMON_DEBUG_CHIP is not set 773# CONFIG_HWMON_DEBUG_CHIP is not set
774# CONFIG_THERMAL is not set
775# CONFIG_THERMAL_HWMON is not set
725# CONFIG_WATCHDOG is not set 776# CONFIG_WATCHDOG is not set
726 777
727# 778#
@@ -733,13 +784,24 @@ CONFIG_SSB_POSSIBLE=y
733# 784#
734# Multifunction device drivers 785# Multifunction device drivers
735# 786#
787# CONFIG_MFD_CORE is not set
736# CONFIG_MFD_SM501 is not set 788# CONFIG_MFD_SM501 is not set
789# CONFIG_HTC_PASIC3 is not set
737 790
738# 791#
739# Multimedia devices 792# Multimedia devices
740# 793#
794
795#
796# Multimedia core support
797#
741# CONFIG_VIDEO_DEV is not set 798# CONFIG_VIDEO_DEV is not set
742# CONFIG_DVB_CORE is not set 799# CONFIG_DVB_CORE is not set
800# CONFIG_VIDEO_MEDIA is not set
801
802#
803# Multimedia drivers
804#
743# CONFIG_DAB is not set 805# CONFIG_DAB is not set
744 806
745# 807#
@@ -751,15 +813,15 @@ CONFIG_SSB_POSSIBLE=y
751CONFIG_FB=y 813CONFIG_FB=y
752# CONFIG_FIRMWARE_EDID is not set 814# CONFIG_FIRMWARE_EDID is not set
753# CONFIG_FB_DDC is not set 815# CONFIG_FB_DDC is not set
754# CONFIG_FB_CFB_FILLRECT is not set 816CONFIG_FB_CFB_FILLRECT=m
755# CONFIG_FB_CFB_COPYAREA is not set 817CONFIG_FB_CFB_COPYAREA=m
756# CONFIG_FB_CFB_IMAGEBLIT is not set 818CONFIG_FB_CFB_IMAGEBLIT=m
757# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set 819# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
758# CONFIG_FB_SYS_FILLRECT is not set 820# CONFIG_FB_SYS_FILLRECT is not set
759# CONFIG_FB_SYS_COPYAREA is not set 821# CONFIG_FB_SYS_COPYAREA is not set
760# CONFIG_FB_SYS_IMAGEBLIT is not set 822# CONFIG_FB_SYS_IMAGEBLIT is not set
823# CONFIG_FB_FOREIGN_ENDIAN is not set
761# CONFIG_FB_SYS_FOPS is not set 824# CONFIG_FB_SYS_FOPS is not set
762CONFIG_FB_DEFERRED_IO=y
763# CONFIG_FB_SVGALIB is not set 825# CONFIG_FB_SVGALIB is not set
764# CONFIG_FB_MACMODES is not set 826# CONFIG_FB_MACMODES is not set
765# CONFIG_FB_BACKLIGHT is not set 827# CONFIG_FB_BACKLIGHT is not set
@@ -792,6 +854,8 @@ CONFIG_FB_DEFERRED_IO=y
792# CONFIG_FB_TRIDENT is not set 854# CONFIG_FB_TRIDENT is not set
793# CONFIG_FB_ARK is not set 855# CONFIG_FB_ARK is not set
794# CONFIG_FB_PM3 is not set 856# CONFIG_FB_PM3 is not set
857# CONFIG_FB_CARMINE is not set
858CONFIG_FB_SH_MOBILE_LCDC=m
795# CONFIG_FB_VIRTUAL is not set 859# CONFIG_FB_VIRTUAL is not set
796# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 860# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
797 861
@@ -800,24 +864,9 @@ CONFIG_FB_DEFERRED_IO=y
800# 864#
801# CONFIG_DISPLAY_SUPPORT is not set 865# CONFIG_DISPLAY_SUPPORT is not set
802# CONFIG_LOGO is not set 866# CONFIG_LOGO is not set
803
804#
805# Sound
806#
807CONFIG_SOUND=m 867CONFIG_SOUND=m
808
809#
810# Advanced Linux Sound Architecture
811#
812# CONFIG_SND is not set 868# CONFIG_SND is not set
813
814#
815# Open Sound System
816#
817CONFIG_SOUND_PRIME=m 869CONFIG_SOUND_PRIME=m
818# CONFIG_SOUND_TRIDENT is not set
819# CONFIG_SOUND_MSNDCLAS is not set
820# CONFIG_SOUND_MSNDPIN is not set
821CONFIG_HID_SUPPORT=y 870CONFIG_HID_SUPPORT=y
822CONFIG_HID=y 871CONFIG_HID=y
823# CONFIG_HID_DEBUG is not set 872# CONFIG_HID_DEBUG is not set
@@ -827,17 +876,17 @@ CONFIG_USB_ARCH_HAS_HCD=y
827CONFIG_USB_ARCH_HAS_OHCI=y 876CONFIG_USB_ARCH_HAS_OHCI=y
828CONFIG_USB_ARCH_HAS_EHCI=y 877CONFIG_USB_ARCH_HAS_EHCI=y
829# CONFIG_USB is not set 878# CONFIG_USB is not set
879# CONFIG_USB_OTG_WHITELIST is not set
880# CONFIG_USB_OTG_BLACKLIST_HUB is not set
830 881
831# 882#
832# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 883# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
833# 884#
834
835#
836# USB Gadget Support
837#
838# CONFIG_USB_GADGET is not set 885# CONFIG_USB_GADGET is not set
839# CONFIG_MMC is not set 886# CONFIG_MMC is not set
887# CONFIG_MEMSTICK is not set
840# CONFIG_NEW_LEDS is not set 888# CONFIG_NEW_LEDS is not set
889# CONFIG_ACCESSIBILITY is not set
841# CONFIG_INFINIBAND is not set 890# CONFIG_INFINIBAND is not set
842CONFIG_RTC_LIB=y 891CONFIG_RTC_LIB=y
843CONFIG_RTC_CLASS=y 892CONFIG_RTC_CLASS=y
@@ -861,9 +910,10 @@ CONFIG_RTC_INTF_DEV=y
861# 910#
862# Platform RTC drivers 911# Platform RTC drivers
863# 912#
913# CONFIG_RTC_DRV_DS1511 is not set
864# CONFIG_RTC_DRV_DS1553 is not set 914# CONFIG_RTC_DRV_DS1553 is not set
865# CONFIG_RTC_DRV_STK17TA8 is not set
866# CONFIG_RTC_DRV_DS1742 is not set 915# CONFIG_RTC_DRV_DS1742 is not set
916# CONFIG_RTC_DRV_STK17TA8 is not set
867# CONFIG_RTC_DRV_M48T86 is not set 917# CONFIG_RTC_DRV_M48T86 is not set
868# CONFIG_RTC_DRV_M48T59 is not set 918# CONFIG_RTC_DRV_M48T59 is not set
869# CONFIG_RTC_DRV_V3020 is not set 919# CONFIG_RTC_DRV_V3020 is not set
@@ -872,10 +922,7 @@ CONFIG_RTC_INTF_DEV=y
872# on-CPU RTC drivers 922# on-CPU RTC drivers
873# 923#
874CONFIG_RTC_DRV_SH=y 924CONFIG_RTC_DRV_SH=y
875 925# CONFIG_DMADEVICES is not set
876#
877# Userspace I/O
878#
879# CONFIG_UIO is not set 926# CONFIG_UIO is not set
880 927
881# 928#
@@ -896,14 +943,11 @@ CONFIG_FS_MBCACHE=y
896# CONFIG_JFS_FS is not set 943# CONFIG_JFS_FS is not set
897CONFIG_FS_POSIX_ACL=y 944CONFIG_FS_POSIX_ACL=y
898# CONFIG_XFS_FS is not set 945# CONFIG_XFS_FS is not set
899# CONFIG_GFS2_FS is not set
900# CONFIG_OCFS2_FS is not set 946# CONFIG_OCFS2_FS is not set
901CONFIG_MINIX_FS=y 947CONFIG_DNOTIFY=y
902# CONFIG_ROMFS_FS is not set
903CONFIG_INOTIFY=y 948CONFIG_INOTIFY=y
904CONFIG_INOTIFY_USER=y 949CONFIG_INOTIFY_USER=y
905# CONFIG_QUOTA is not set 950# CONFIG_QUOTA is not set
906CONFIG_DNOTIFY=y
907# CONFIG_AUTOFS_FS is not set 951# CONFIG_AUTOFS_FS is not set
908# CONFIG_AUTOFS4_FS is not set 952# CONFIG_AUTOFS4_FS is not set
909CONFIG_FUSE_FS=m 953CONFIG_FUSE_FS=m
@@ -951,8 +995,11 @@ CONFIG_CONFIGFS_FS=m
951# CONFIG_EFS_FS is not set 995# CONFIG_EFS_FS is not set
952# CONFIG_CRAMFS is not set 996# CONFIG_CRAMFS is not set
953# CONFIG_VXFS_FS is not set 997# CONFIG_VXFS_FS is not set
998CONFIG_MINIX_FS=y
999# CONFIG_OMFS_FS is not set
954# CONFIG_HPFS_FS is not set 1000# CONFIG_HPFS_FS is not set
955# CONFIG_QNX4FS_FS is not set 1001# CONFIG_QNX4FS_FS is not set
1002# CONFIG_ROMFS_FS is not set
956# CONFIG_SYSV_FS is not set 1003# CONFIG_SYSV_FS is not set
957# CONFIG_UFS_FS is not set 1004# CONFIG_UFS_FS is not set
958CONFIG_NETWORK_FILESYSTEMS=y 1005CONFIG_NETWORK_FILESYSTEMS=y
@@ -960,20 +1007,17 @@ CONFIG_NFS_FS=y
960CONFIG_NFS_V3=y 1007CONFIG_NFS_V3=y
961# CONFIG_NFS_V3_ACL is not set 1008# CONFIG_NFS_V3_ACL is not set
962CONFIG_NFS_V4=y 1009CONFIG_NFS_V4=y
963# CONFIG_NFS_DIRECTIO is not set 1010CONFIG_ROOT_NFS=y
964CONFIG_NFSD=y 1011CONFIG_NFSD=y
965CONFIG_NFSD_V3=y 1012CONFIG_NFSD_V3=y
966# CONFIG_NFSD_V3_ACL is not set 1013# CONFIG_NFSD_V3_ACL is not set
967CONFIG_NFSD_V4=y 1014CONFIG_NFSD_V4=y
968CONFIG_NFSD_TCP=y
969CONFIG_ROOT_NFS=y
970CONFIG_LOCKD=y 1015CONFIG_LOCKD=y
971CONFIG_LOCKD_V4=y 1016CONFIG_LOCKD_V4=y
972CONFIG_EXPORTFS=y 1017CONFIG_EXPORTFS=y
973CONFIG_NFS_COMMON=y 1018CONFIG_NFS_COMMON=y
974CONFIG_SUNRPC=y 1019CONFIG_SUNRPC=y
975CONFIG_SUNRPC_GSS=y 1020CONFIG_SUNRPC_GSS=y
976# CONFIG_SUNRPC_BIND34 is not set
977CONFIG_RPCSEC_GSS_KRB5=y 1021CONFIG_RPCSEC_GSS_KRB5=y
978# CONFIG_RPCSEC_GSS_SPKM3 is not set 1022# CONFIG_RPCSEC_GSS_SPKM3 is not set
979# CONFIG_SMB_FS is not set 1023# CONFIG_SMB_FS is not set
@@ -1028,10 +1072,6 @@ CONFIG_NLS_ISO8859_1=y
1028# CONFIG_NLS_KOI8_U is not set 1072# CONFIG_NLS_KOI8_U is not set
1029# CONFIG_NLS_UTF8 is not set 1073# CONFIG_NLS_UTF8 is not set
1030# CONFIG_DLM is not set 1074# CONFIG_DLM is not set
1031CONFIG_INSTRUMENTATION=y
1032CONFIG_PROFILING=y
1033CONFIG_OPROFILE=m
1034# CONFIG_MARKERS is not set
1035 1075
1036# 1076#
1037# Kernel hacking 1077# Kernel hacking
@@ -1040,6 +1080,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1040# CONFIG_PRINTK_TIME is not set 1080# CONFIG_PRINTK_TIME is not set
1041CONFIG_ENABLE_WARN_DEPRECATED=y 1081CONFIG_ENABLE_WARN_DEPRECATED=y
1042CONFIG_ENABLE_MUST_CHECK=y 1082CONFIG_ENABLE_MUST_CHECK=y
1083CONFIG_FRAME_WARN=1024
1043CONFIG_MAGIC_SYSRQ=y 1084CONFIG_MAGIC_SYSRQ=y
1044# CONFIG_UNUSED_SYMBOLS is not set 1085# CONFIG_UNUSED_SYMBOLS is not set
1045CONFIG_DEBUG_FS=y 1086CONFIG_DEBUG_FS=y
@@ -1050,6 +1091,7 @@ CONFIG_DEBUG_KERNEL=y
1050CONFIG_SCHED_DEBUG=y 1091CONFIG_SCHED_DEBUG=y
1051# CONFIG_SCHEDSTATS is not set 1092# CONFIG_SCHEDSTATS is not set
1052# CONFIG_TIMER_STATS is not set 1093# CONFIG_TIMER_STATS is not set
1094# CONFIG_DEBUG_OBJECTS is not set
1053# CONFIG_DEBUG_SLAB is not set 1095# CONFIG_DEBUG_SLAB is not set
1054# CONFIG_DEBUG_PREEMPT is not set 1096# CONFIG_DEBUG_PREEMPT is not set
1055CONFIG_DEBUG_SPINLOCK=y 1097CONFIG_DEBUG_SPINLOCK=y
@@ -1066,12 +1108,14 @@ CONFIG_STACKTRACE=y
1066CONFIG_DEBUG_BUGVERBOSE=y 1108CONFIG_DEBUG_BUGVERBOSE=y
1067CONFIG_DEBUG_INFO=y 1109CONFIG_DEBUG_INFO=y
1068# CONFIG_DEBUG_VM is not set 1110# CONFIG_DEBUG_VM is not set
1111# CONFIG_DEBUG_WRITECOUNT is not set
1112# CONFIG_DEBUG_MEMORY_INIT is not set
1069# CONFIG_DEBUG_LIST is not set 1113# CONFIG_DEBUG_LIST is not set
1070# CONFIG_DEBUG_SG is not set 1114# CONFIG_DEBUG_SG is not set
1071CONFIG_FRAME_POINTER=y 1115CONFIG_FRAME_POINTER=y
1072CONFIG_FORCED_INLINING=y
1073# CONFIG_BOOT_PRINTK_DELAY is not set 1116# CONFIG_BOOT_PRINTK_DELAY is not set
1074# CONFIG_RCU_TORTURE_TEST is not set 1117# CONFIG_RCU_TORTURE_TEST is not set
1118# CONFIG_BACKTRACE_SELF_TEST is not set
1075# CONFIG_FAULT_INJECTION is not set 1119# CONFIG_FAULT_INJECTION is not set
1076# CONFIG_SAMPLES is not set 1120# CONFIG_SAMPLES is not set
1077CONFIG_SH_STANDARD_BIOS=y 1121CONFIG_SH_STANDARD_BIOS=y
@@ -1091,54 +1135,96 @@ CONFIG_4KSTACKS=y
1091# CONFIG_SECURITY is not set 1135# CONFIG_SECURITY is not set
1092# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1136# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1093CONFIG_CRYPTO=y 1137CONFIG_CRYPTO=y
1138
1139#
1140# Crypto core or helper
1141#
1094CONFIG_CRYPTO_ALGAPI=y 1142CONFIG_CRYPTO_ALGAPI=y
1095CONFIG_CRYPTO_BLKCIPHER=y 1143CONFIG_CRYPTO_BLKCIPHER=y
1096CONFIG_CRYPTO_HASH=y 1144CONFIG_CRYPTO_HASH=y
1097CONFIG_CRYPTO_MANAGER=y 1145CONFIG_CRYPTO_MANAGER=y
1146# CONFIG_CRYPTO_GF128MUL is not set
1147# CONFIG_CRYPTO_NULL is not set
1148# CONFIG_CRYPTO_CRYPTD is not set
1149# CONFIG_CRYPTO_AUTHENC is not set
1150# CONFIG_CRYPTO_TEST is not set
1151
1152#
1153# Authenticated Encryption with Associated Data
1154#
1155# CONFIG_CRYPTO_CCM is not set
1156# CONFIG_CRYPTO_GCM is not set
1157# CONFIG_CRYPTO_SEQIV is not set
1158
1159#
1160# Block modes
1161#
1162CONFIG_CRYPTO_CBC=y
1163# CONFIG_CRYPTO_CTR is not set
1164# CONFIG_CRYPTO_CTS is not set
1165CONFIG_CRYPTO_ECB=m
1166# CONFIG_CRYPTO_LRW is not set
1167CONFIG_CRYPTO_PCBC=m
1168# CONFIG_CRYPTO_XTS is not set
1169
1170#
1171# Hash modes
1172#
1098CONFIG_CRYPTO_HMAC=y 1173CONFIG_CRYPTO_HMAC=y
1099# CONFIG_CRYPTO_XCBC is not set 1174# CONFIG_CRYPTO_XCBC is not set
1100# CONFIG_CRYPTO_NULL is not set 1175
1176#
1177# Digest
1178#
1179# CONFIG_CRYPTO_CRC32C is not set
1101# CONFIG_CRYPTO_MD4 is not set 1180# CONFIG_CRYPTO_MD4 is not set
1102CONFIG_CRYPTO_MD5=y 1181CONFIG_CRYPTO_MD5=y
1182# CONFIG_CRYPTO_MICHAEL_MIC is not set
1183# CONFIG_CRYPTO_RMD128 is not set
1184# CONFIG_CRYPTO_RMD160 is not set
1185# CONFIG_CRYPTO_RMD256 is not set
1186# CONFIG_CRYPTO_RMD320 is not set
1103# CONFIG_CRYPTO_SHA1 is not set 1187# CONFIG_CRYPTO_SHA1 is not set
1104# CONFIG_CRYPTO_SHA256 is not set 1188# CONFIG_CRYPTO_SHA256 is not set
1105# CONFIG_CRYPTO_SHA512 is not set 1189# CONFIG_CRYPTO_SHA512 is not set
1106# CONFIG_CRYPTO_WP512 is not set
1107# CONFIG_CRYPTO_TGR192 is not set 1190# CONFIG_CRYPTO_TGR192 is not set
1108# CONFIG_CRYPTO_GF128MUL is not set 1191# CONFIG_CRYPTO_WP512 is not set
1109CONFIG_CRYPTO_ECB=m 1192
1110CONFIG_CRYPTO_CBC=y 1193#
1111CONFIG_CRYPTO_PCBC=m 1194# Ciphers
1112# CONFIG_CRYPTO_LRW is not set 1195#
1113# CONFIG_CRYPTO_XTS is not set
1114# CONFIG_CRYPTO_CRYPTD is not set
1115CONFIG_CRYPTO_DES=y
1116# CONFIG_CRYPTO_FCRYPT is not set
1117# CONFIG_CRYPTO_BLOWFISH is not set
1118# CONFIG_CRYPTO_TWOFISH is not set
1119# CONFIG_CRYPTO_SERPENT is not set
1120# CONFIG_CRYPTO_AES is not set 1196# CONFIG_CRYPTO_AES is not set
1197# CONFIG_CRYPTO_ANUBIS is not set
1198# CONFIG_CRYPTO_ARC4 is not set
1199# CONFIG_CRYPTO_BLOWFISH is not set
1200# CONFIG_CRYPTO_CAMELLIA is not set
1121# CONFIG_CRYPTO_CAST5 is not set 1201# CONFIG_CRYPTO_CAST5 is not set
1122# CONFIG_CRYPTO_CAST6 is not set 1202# CONFIG_CRYPTO_CAST6 is not set
1123# CONFIG_CRYPTO_TEA is not set 1203CONFIG_CRYPTO_DES=y
1124# CONFIG_CRYPTO_ARC4 is not set 1204# CONFIG_CRYPTO_FCRYPT is not set
1125# CONFIG_CRYPTO_KHAZAD is not set 1205# CONFIG_CRYPTO_KHAZAD is not set
1126# CONFIG_CRYPTO_ANUBIS is not set 1206# CONFIG_CRYPTO_SALSA20 is not set
1127# CONFIG_CRYPTO_SEED is not set 1207# CONFIG_CRYPTO_SEED is not set
1208# CONFIG_CRYPTO_SERPENT is not set
1209# CONFIG_CRYPTO_TEA is not set
1210# CONFIG_CRYPTO_TWOFISH is not set
1211
1212#
1213# Compression
1214#
1128# CONFIG_CRYPTO_DEFLATE is not set 1215# CONFIG_CRYPTO_DEFLATE is not set
1129# CONFIG_CRYPTO_MICHAEL_MIC is not set 1216# CONFIG_CRYPTO_LZO is not set
1130# CONFIG_CRYPTO_CRC32C is not set
1131# CONFIG_CRYPTO_CAMELLIA is not set
1132# CONFIG_CRYPTO_TEST is not set
1133# CONFIG_CRYPTO_AUTHENC is not set
1134CONFIG_CRYPTO_HW=y 1217CONFIG_CRYPTO_HW=y
1218# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1135 1219
1136# 1220#
1137# Library routines 1221# Library routines
1138# 1222#
1139CONFIG_BITREVERSE=y 1223CONFIG_BITREVERSE=y
1224# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1140# CONFIG_CRC_CCITT is not set 1225# CONFIG_CRC_CCITT is not set
1141# CONFIG_CRC16 is not set 1226# CONFIG_CRC16 is not set
1227CONFIG_CRC_T10DIF=y
1142# CONFIG_CRC_ITU_T is not set 1228# CONFIG_CRC_ITU_T is not set
1143CONFIG_CRC32=y 1229CONFIG_CRC32=y
1144# CONFIG_CRC7 is not set 1230# CONFIG_CRC7 is not set
diff --git a/arch/sh/configs/rsk7203_defconfig b/arch/sh/configs/rsk7203_defconfig
index a0ebd439cbd2..840fe3843ffa 100644
--- a/arch/sh/configs/rsk7203_defconfig
+++ b/arch/sh/configs/rsk7203_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.26-rc4 3# Linux kernel version: 2.6.26
4# Tue Jun 3 13:02:42 2008 4# Mon Jul 28 22:23:03 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -33,21 +33,22 @@ CONFIG_LOCALVERSION=""
33CONFIG_SYSVIPC=y 33CONFIG_SYSVIPC=y
34CONFIG_SYSVIPC_SYSCTL=y 34CONFIG_SYSVIPC_SYSCTL=y
35CONFIG_POSIX_MQUEUE=y 35CONFIG_POSIX_MQUEUE=y
36# CONFIG_BSD_PROCESS_ACCT is not set 36CONFIG_BSD_PROCESS_ACCT=y
37# CONFIG_BSD_PROCESS_ACCT_V3 is not set
37# CONFIG_TASKSTATS is not set 38# CONFIG_TASKSTATS is not set
38# CONFIG_AUDIT is not set 39# CONFIG_AUDIT is not set
39# CONFIG_IKCONFIG is not set 40CONFIG_IKCONFIG=y
41# CONFIG_IKCONFIG_PROC is not set
40CONFIG_LOG_BUF_SHIFT=14 42CONFIG_LOG_BUF_SHIFT=14
41# CONFIG_CGROUPS is not set 43# CONFIG_CGROUPS is not set
42CONFIG_GROUP_SCHED=y 44# CONFIG_GROUP_SCHED is not set
43CONFIG_FAIR_GROUP_SCHED=y 45# CONFIG_SYSFS_DEPRECATED_V2 is not set
44# CONFIG_RT_GROUP_SCHED is not set
45CONFIG_USER_SCHED=y
46# CONFIG_CGROUP_SCHED is not set
47CONFIG_SYSFS_DEPRECATED=y
48CONFIG_SYSFS_DEPRECATED_V2=y
49# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
50# CONFIG_NAMESPACES is not set 47CONFIG_NAMESPACES=y
48CONFIG_UTS_NS=y
49CONFIG_IPC_NS=y
50CONFIG_USER_NS=y
51CONFIG_PID_NS=y
51CONFIG_BLK_DEV_INITRD=y 52CONFIG_BLK_DEV_INITRD=y
52CONFIG_INITRAMFS_SOURCE="" 53CONFIG_INITRAMFS_SOURCE=""
53CONFIG_CC_OPTIMIZE_FOR_SIZE=y 54CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -72,26 +73,36 @@ CONFIG_SIGNALFD=y
72CONFIG_TIMERFD=y 73CONFIG_TIMERFD=y
73CONFIG_EVENTFD=y 74CONFIG_EVENTFD=y
74CONFIG_VM_EVENT_COUNTERS=y 75CONFIG_VM_EVENT_COUNTERS=y
75CONFIG_SLAB=y 76# CONFIG_SLAB is not set
76# CONFIG_SLUB is not set 77# CONFIG_SLUB is not set
77# CONFIG_SLOB is not set 78CONFIG_SLOB=y
78CONFIG_PROFILING=y 79CONFIG_PROFILING=y
79# CONFIG_MARKERS is not set 80# CONFIG_MARKERS is not set
80CONFIG_OPROFILE=y 81CONFIG_OPROFILE=y
81CONFIG_HAVE_OPROFILE=y 82CONFIG_HAVE_OPROFILE=y
83# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
84# CONFIG_HAVE_IOREMAP_PROT is not set
82# CONFIG_HAVE_KPROBES is not set 85# CONFIG_HAVE_KPROBES is not set
83# CONFIG_HAVE_KRETPROBES is not set 86# CONFIG_HAVE_KRETPROBES is not set
87# CONFIG_HAVE_ARCH_TRACEHOOK is not set
84# CONFIG_HAVE_DMA_ATTRS is not set 88# CONFIG_HAVE_DMA_ATTRS is not set
85CONFIG_SLABINFO=y 89# CONFIG_USE_GENERIC_SMP_HELPERS is not set
90CONFIG_HAVE_CLK=y
86CONFIG_RT_MUTEXES=y 91CONFIG_RT_MUTEXES=y
87CONFIG_TINY_SHMEM=y 92CONFIG_TINY_SHMEM=y
88CONFIG_BASE_SMALL=0 93CONFIG_BASE_SMALL=0
89# CONFIG_MODULES is not set 94CONFIG_MODULES=y
95# CONFIG_MODULE_FORCE_LOAD is not set
96# CONFIG_MODULE_UNLOAD is not set
97# CONFIG_MODVERSIONS is not set
98# CONFIG_MODULE_SRCVERSION_ALL is not set
99CONFIG_KMOD=y
90CONFIG_BLOCK=y 100CONFIG_BLOCK=y
91# CONFIG_LBD is not set 101# CONFIG_LBD is not set
92# CONFIG_BLK_DEV_IO_TRACE is not set 102# CONFIG_BLK_DEV_IO_TRACE is not set
93# CONFIG_LSF is not set 103# CONFIG_LSF is not set
94# CONFIG_BLK_DEV_BSG is not set 104# CONFIG_BLK_DEV_BSG is not set
105# CONFIG_BLK_DEV_INTEGRITY is not set
95 106
96# 107#
97# IO Schedulers 108# IO Schedulers
@@ -162,7 +173,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
162CONFIG_ARCH_SELECT_MEMORY_MODEL=y 173CONFIG_ARCH_SELECT_MEMORY_MODEL=y
163CONFIG_PAGE_SIZE_4KB=y 174CONFIG_PAGE_SIZE_4KB=y
164# CONFIG_PAGE_SIZE_8KB is not set 175# CONFIG_PAGE_SIZE_8KB is not set
176# CONFIG_PAGE_SIZE_16KB is not set
165# CONFIG_PAGE_SIZE_64KB is not set 177# CONFIG_PAGE_SIZE_64KB is not set
178CONFIG_ENTRY_OFFSET=0x00001000
166CONFIG_SELECT_MEMORY_MODEL=y 179CONFIG_SELECT_MEMORY_MODEL=y
167CONFIG_FLATMEM_MANUAL=y 180CONFIG_FLATMEM_MANUAL=y
168# CONFIG_DISCONTIGMEM_MANUAL is not set 181# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -196,6 +209,7 @@ CONFIG_CPU_HAS_FPU=y
196# 209#
197# Board support 210# Board support
198# 211#
212CONFIG_SH_RSK7203=y
199 213
200# 214#
201# Timer and clock configuration 215# Timer and clock configuration
@@ -274,6 +288,7 @@ CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ignore_loglevel"
274# 288#
275# Executable file formats 289# Executable file formats
276# 290#
291CONFIG_BINFMT_ELF_FDPIC=y
277CONFIG_BINFMT_FLAT=y 292CONFIG_BINFMT_FLAT=y
278CONFIG_BINFMT_ZFLAT=y 293CONFIG_BINFMT_ZFLAT=y
279CONFIG_BINFMT_SHARED_FLAT=y 294CONFIG_BINFMT_SHARED_FLAT=y
@@ -424,8 +439,8 @@ CONFIG_MTD_CFI_UTIL=y
424# 439#
425# CONFIG_MTD_COMPLEX_MAPPINGS is not set 440# CONFIG_MTD_COMPLEX_MAPPINGS is not set
426CONFIG_MTD_PHYSMAP=y 441CONFIG_MTD_PHYSMAP=y
427CONFIG_MTD_PHYSMAP_START=0x20000000 442CONFIG_MTD_PHYSMAP_START=0x0
428CONFIG_MTD_PHYSMAP_LEN=0x01000000 443CONFIG_MTD_PHYSMAP_LEN=0x0
429CONFIG_MTD_PHYSMAP_BANKWIDTH=4 444CONFIG_MTD_PHYSMAP_BANKWIDTH=4
430# CONFIG_MTD_UCLINUX is not set 445# CONFIG_MTD_UCLINUX is not set
431# CONFIG_MTD_PLATRAM is not set 446# CONFIG_MTD_PLATRAM is not set
@@ -456,9 +471,11 @@ CONFIG_BLK_DEV=y
456# CONFIG_BLK_DEV_COW_COMMON is not set 471# CONFIG_BLK_DEV_COW_COMMON is not set
457# CONFIG_BLK_DEV_LOOP is not set 472# CONFIG_BLK_DEV_LOOP is not set
458# CONFIG_BLK_DEV_NBD is not set 473# CONFIG_BLK_DEV_NBD is not set
474# CONFIG_BLK_DEV_UB is not set
459# CONFIG_BLK_DEV_RAM is not set 475# CONFIG_BLK_DEV_RAM is not set
460# CONFIG_CDROM_PKTCDVD is not set 476# CONFIG_CDROM_PKTCDVD is not set
461# CONFIG_ATA_OVER_ETH is not set 477# CONFIG_ATA_OVER_ETH is not set
478# CONFIG_BLK_DEV_HD is not set
462CONFIG_MISC_DEVICES=y 479CONFIG_MISC_DEVICES=y
463# CONFIG_EEPROM_93CX6 is not set 480# CONFIG_EEPROM_93CX6 is not set
464# CONFIG_ENCLOSURE_SERVICES is not set 481# CONFIG_ENCLOSURE_SERVICES is not set
@@ -475,7 +492,6 @@ CONFIG_HAVE_IDE=y
475# CONFIG_ATA is not set 492# CONFIG_ATA is not set
476# CONFIG_MD is not set 493# CONFIG_MD is not set
477CONFIG_NETDEVICES=y 494CONFIG_NETDEVICES=y
478# CONFIG_NETDEVICES_MULTIQUEUE is not set
479# CONFIG_DUMMY is not set 495# CONFIG_DUMMY is not set
480# CONFIG_BONDING is not set 496# CONFIG_BONDING is not set
481# CONFIG_MACVLAN is not set 497# CONFIG_MACVLAN is not set
@@ -487,15 +503,15 @@ CONFIG_NET_ETHERNET=y
487CONFIG_MII=y 503CONFIG_MII=y
488# CONFIG_AX88796 is not set 504# CONFIG_AX88796 is not set
489# CONFIG_STNIC is not set 505# CONFIG_STNIC is not set
490CONFIG_SMC91X=y 506# CONFIG_SMC91X is not set
507CONFIG_SMC911X=y
491# CONFIG_IBM_NEW_EMAC_ZMII is not set 508# CONFIG_IBM_NEW_EMAC_ZMII is not set
492# CONFIG_IBM_NEW_EMAC_RGMII is not set 509# CONFIG_IBM_NEW_EMAC_RGMII is not set
493# CONFIG_IBM_NEW_EMAC_TAH is not set 510# CONFIG_IBM_NEW_EMAC_TAH is not set
494# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 511# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
495# CONFIG_B44 is not set 512# CONFIG_B44 is not set
496CONFIG_NETDEV_1000=y 513# CONFIG_NETDEV_1000 is not set
497# CONFIG_E1000E_ENABLED is not set 514# CONFIG_NETDEV_10000 is not set
498CONFIG_NETDEV_10000=y
499 515
500# 516#
501# Wireless LAN 517# Wireless LAN
@@ -503,6 +519,15 @@ CONFIG_NETDEV_10000=y
503# CONFIG_WLAN_PRE80211 is not set 519# CONFIG_WLAN_PRE80211 is not set
504# CONFIG_WLAN_80211 is not set 520# CONFIG_WLAN_80211 is not set
505# CONFIG_IWLWIFI_LEDS is not set 521# CONFIG_IWLWIFI_LEDS is not set
522
523#
524# USB Network Adapters
525#
526# CONFIG_USB_CATC is not set
527# CONFIG_USB_KAWETH is not set
528# CONFIG_USB_PEGASUS is not set
529# CONFIG_USB_RTL8150 is not set
530# CONFIG_USB_USBNET is not set
506# CONFIG_WAN is not set 531# CONFIG_WAN is not set
507# CONFIG_PPP is not set 532# CONFIG_PPP is not set
508# CONFIG_SLIP is not set 533# CONFIG_SLIP is not set
@@ -587,6 +612,7 @@ CONFIG_SSB_POSSIBLE=y
587# 612#
588# Multifunction device drivers 613# Multifunction device drivers
589# 614#
615# CONFIG_MFD_CORE is not set
590# CONFIG_MFD_SM501 is not set 616# CONFIG_MFD_SM501 is not set
591# CONFIG_HTC_PASIC3 is not set 617# CONFIG_HTC_PASIC3 is not set
592 618
@@ -605,6 +631,7 @@ CONFIG_SSB_POSSIBLE=y
605# Multimedia drivers 631# Multimedia drivers
606# 632#
607CONFIG_DAB=y 633CONFIG_DAB=y
634# CONFIG_USB_DABUSB is not set
608 635
609# 636#
610# Graphics support 637# Graphics support
@@ -618,26 +645,96 @@ CONFIG_VIDEO_OUTPUT_CONTROL=y
618# Display device support 645# Display device support
619# 646#
620# CONFIG_DISPLAY_SUPPORT is not set 647# CONFIG_DISPLAY_SUPPORT is not set
621
622#
623# Sound
624#
625# CONFIG_SOUND is not set 648# CONFIG_SOUND is not set
626CONFIG_HID_SUPPORT=y 649CONFIG_HID_SUPPORT=y
627CONFIG_HID=y 650CONFIG_HID=y
628# CONFIG_HID_DEBUG is not set 651# CONFIG_HID_DEBUG is not set
629# CONFIG_HIDRAW is not set 652# CONFIG_HIDRAW is not set
653
654#
655# USB Input Devices
656#
657CONFIG_USB_HID=y
658# CONFIG_USB_HIDINPUT_POWERBOOK is not set
659# CONFIG_HID_FF is not set
660# CONFIG_USB_HIDDEV is not set
630CONFIG_USB_SUPPORT=y 661CONFIG_USB_SUPPORT=y
631CONFIG_USB_ARCH_HAS_HCD=y 662CONFIG_USB_ARCH_HAS_HCD=y
632# CONFIG_USB_ARCH_HAS_OHCI is not set 663# CONFIG_USB_ARCH_HAS_OHCI is not set
633# CONFIG_USB_ARCH_HAS_EHCI is not set 664# CONFIG_USB_ARCH_HAS_EHCI is not set
634# CONFIG_USB is not set 665CONFIG_USB=y
666# CONFIG_USB_DEBUG is not set
667CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
668
669#
670# Miscellaneous USB options
671#
672CONFIG_USB_DEVICEFS=y
673CONFIG_USB_DEVICE_CLASS=y
674# CONFIG_USB_DYNAMIC_MINORS is not set
675# CONFIG_USB_OTG is not set
635# CONFIG_USB_OTG_WHITELIST is not set 676# CONFIG_USB_OTG_WHITELIST is not set
636# CONFIG_USB_OTG_BLACKLIST_HUB is not set 677# CONFIG_USB_OTG_BLACKLIST_HUB is not set
637 678
638# 679#
680# USB Host Controller Drivers
681#
682# CONFIG_USB_C67X00_HCD is not set
683# CONFIG_USB_ISP116X_HCD is not set
684# CONFIG_USB_ISP1760_HCD is not set
685# CONFIG_USB_SL811_HCD is not set
686CONFIG_USB_R8A66597_HCD=y
687
688#
689# USB Device Class drivers
690#
691# CONFIG_USB_ACM is not set
692# CONFIG_USB_PRINTER is not set
693# CONFIG_USB_WDM is not set
694
695#
639# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 696# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
640# 697#
698
699#
700# may also be needed; see USB_STORAGE Help for more information
701#
702# CONFIG_USB_LIBUSUAL is not set
703
704#
705# USB Imaging devices
706#
707# CONFIG_USB_MDC800 is not set
708CONFIG_USB_MON=y
709
710#
711# USB port drivers
712#
713# CONFIG_USB_SERIAL is not set
714
715#
716# USB Miscellaneous drivers
717#
718# CONFIG_USB_EMI62 is not set
719# CONFIG_USB_EMI26 is not set
720# CONFIG_USB_ADUTUX is not set
721# CONFIG_USB_AUERSWALD is not set
722# CONFIG_USB_RIO500 is not set
723# CONFIG_USB_LEGOTOWER is not set
724# CONFIG_USB_LCD is not set
725# CONFIG_USB_BERRY_CHARGE is not set
726# CONFIG_USB_LED is not set
727# CONFIG_USB_CYPRESS_CY7C63 is not set
728# CONFIG_USB_CYTHERM is not set
729# CONFIG_USB_PHIDGET is not set
730# CONFIG_USB_IDMOUSE is not set
731# CONFIG_USB_FTDI_ELAN is not set
732# CONFIG_USB_APPLEDISPLAY is not set
733# CONFIG_USB_LD is not set
734# CONFIG_USB_TRANCEVIBRATOR is not set
735# CONFIG_USB_IOWARRIOR is not set
736# CONFIG_USB_TEST is not set
737# CONFIG_USB_ISIGHTFW is not set
641# CONFIG_USB_GADGET is not set 738# CONFIG_USB_GADGET is not set
642# CONFIG_MMC is not set 739# CONFIG_MMC is not set
643# CONFIG_MEMSTICK is not set 740# CONFIG_MEMSTICK is not set
@@ -677,6 +774,7 @@ CONFIG_RTC_INTF_DEV=y
677# on-CPU RTC drivers 774# on-CPU RTC drivers
678# 775#
679CONFIG_RTC_DRV_SH=y 776CONFIG_RTC_DRV_SH=y
777# CONFIG_DMADEVICES is not set
680# CONFIG_UIO is not set 778# CONFIG_UIO is not set
681 779
682# 780#
@@ -734,6 +832,7 @@ CONFIG_SYSFS=y
734# CONFIG_CRAMFS is not set 832# CONFIG_CRAMFS is not set
735# CONFIG_VXFS_FS is not set 833# CONFIG_VXFS_FS is not set
736# CONFIG_MINIX_FS is not set 834# CONFIG_MINIX_FS is not set
835# CONFIG_OMFS_FS is not set
737# CONFIG_HPFS_FS is not set 836# CONFIG_HPFS_FS is not set
738# CONFIG_QNX4FS_FS is not set 837# CONFIG_QNX4FS_FS is not set
739CONFIG_ROMFS_FS=y 838CONFIG_ROMFS_FS=y
@@ -743,12 +842,11 @@ CONFIG_NETWORK_FILESYSTEMS=y
743CONFIG_NFS_FS=y 842CONFIG_NFS_FS=y
744# CONFIG_NFS_V3 is not set 843# CONFIG_NFS_V3 is not set
745# CONFIG_NFS_V4 is not set 844# CONFIG_NFS_V4 is not set
746# CONFIG_NFSD is not set
747CONFIG_ROOT_NFS=y 845CONFIG_ROOT_NFS=y
846# CONFIG_NFSD is not set
748CONFIG_LOCKD=y 847CONFIG_LOCKD=y
749CONFIG_NFS_COMMON=y 848CONFIG_NFS_COMMON=y
750CONFIG_SUNRPC=y 849CONFIG_SUNRPC=y
751# CONFIG_SUNRPC_BIND34 is not set
752# CONFIG_RPCSEC_GSS_KRB5 is not set 850# CONFIG_RPCSEC_GSS_KRB5 is not set
753# CONFIG_RPCSEC_GSS_SPKM3 is not set 851# CONFIG_RPCSEC_GSS_SPKM3 is not set
754# CONFIG_SMB_FS is not set 852# CONFIG_SMB_FS is not set
@@ -775,16 +873,20 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
775CONFIG_FRAME_WARN=1024 873CONFIG_FRAME_WARN=1024
776CONFIG_MAGIC_SYSRQ=y 874CONFIG_MAGIC_SYSRQ=y
777# CONFIG_UNUSED_SYMBOLS is not set 875# CONFIG_UNUSED_SYMBOLS is not set
778# CONFIG_DEBUG_FS is not set 876CONFIG_DEBUG_FS=y
779# CONFIG_HEADERS_CHECK is not set 877# CONFIG_HEADERS_CHECK is not set
780CONFIG_DEBUG_KERNEL=y 878CONFIG_DEBUG_KERNEL=y
781CONFIG_DEBUG_SHIRQ=y 879CONFIG_DEBUG_SHIRQ=y
782CONFIG_DETECT_SOFTLOCKUP=y 880CONFIG_DETECT_SOFTLOCKUP=y
881# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
882CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
783CONFIG_SCHED_DEBUG=y 883CONFIG_SCHED_DEBUG=y
784# CONFIG_SCHEDSTATS is not set 884# CONFIG_SCHEDSTATS is not set
785# CONFIG_TIMER_STATS is not set 885# CONFIG_TIMER_STATS is not set
786# CONFIG_DEBUG_OBJECTS is not set 886CONFIG_DEBUG_OBJECTS=y
787# CONFIG_DEBUG_SLAB is not set 887# CONFIG_DEBUG_OBJECTS_SELFTEST is not set
888# CONFIG_DEBUG_OBJECTS_FREE is not set
889# CONFIG_DEBUG_OBJECTS_TIMERS is not set
788# CONFIG_DEBUG_RT_MUTEXES is not set 890# CONFIG_DEBUG_RT_MUTEXES is not set
789# CONFIG_RT_MUTEX_TESTER is not set 891# CONFIG_RT_MUTEX_TESTER is not set
790# CONFIG_DEBUG_SPINLOCK is not set 892# CONFIG_DEBUG_SPINLOCK is not set
@@ -797,12 +899,14 @@ CONFIG_DEBUG_SPINLOCK_SLEEP=y
797# CONFIG_DEBUG_KOBJECT is not set 899# CONFIG_DEBUG_KOBJECT is not set
798CONFIG_DEBUG_BUGVERBOSE=y 900CONFIG_DEBUG_BUGVERBOSE=y
799CONFIG_DEBUG_INFO=y 901CONFIG_DEBUG_INFO=y
800# CONFIG_DEBUG_VM is not set 902CONFIG_DEBUG_VM=y
801# CONFIG_DEBUG_WRITECOUNT is not set 903CONFIG_DEBUG_WRITECOUNT=y
802# CONFIG_DEBUG_LIST is not set 904# CONFIG_DEBUG_MEMORY_INIT is not set
803# CONFIG_DEBUG_SG is not set 905CONFIG_DEBUG_LIST=y
906CONFIG_DEBUG_SG=y
804CONFIG_FRAME_POINTER=y 907CONFIG_FRAME_POINTER=y
805# CONFIG_BOOT_PRINTK_DELAY is not set 908# CONFIG_BOOT_PRINTK_DELAY is not set
909# CONFIG_RCU_TORTURE_TEST is not set
806# CONFIG_BACKTRACE_SELF_TEST is not set 910# CONFIG_BACKTRACE_SELF_TEST is not set
807# CONFIG_FAULT_INJECTION is not set 911# CONFIG_FAULT_INJECTION is not set
808# CONFIG_SAMPLES is not set 912# CONFIG_SAMPLES is not set
@@ -830,6 +934,7 @@ CONFIG_BITREVERSE=y
830# CONFIG_GENERIC_FIND_FIRST_BIT is not set 934# CONFIG_GENERIC_FIND_FIRST_BIT is not set
831# CONFIG_CRC_CCITT is not set 935# CONFIG_CRC_CCITT is not set
832# CONFIG_CRC16 is not set 936# CONFIG_CRC16 is not set
937# CONFIG_CRC_T10DIF is not set
833# CONFIG_CRC_ITU_T is not set 938# CONFIG_CRC_ITU_T is not set
834CONFIG_CRC32=y 939CONFIG_CRC32=y
835# CONFIG_CRC7 is not set 940# CONFIG_CRC7 is not set
diff --git a/arch/sh/configs/rts7751r2d1_defconfig b/arch/sh/configs/rts7751r2d1_defconfig
index 3a915fd436d9..8413236c1b37 100644
--- a/arch/sh/configs/rts7751r2d1_defconfig
+++ b/arch/sh/configs/rts7751r2d1_defconfig
@@ -1,10 +1,11 @@
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
4# Thu Feb 7 16:25:55 2008 4# Wed Jul 30 01:55:52 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -20,6 +21,8 @@ CONFIG_LOCKDEP_SUPPORT=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set 21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set 22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y 23CONFIG_ARCH_NO_VIRT_TO_BUS=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
25CONFIG_IO_TRAPPED=y
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24 27
25# 28#
@@ -36,17 +39,15 @@ CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 39# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set 40# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set 41# CONFIG_TASKSTATS is not set
39# CONFIG_USER_NS is not set
40# CONFIG_PID_NS is not set
41# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
43CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
44# CONFIG_CGROUPS is not set 45# CONFIG_CGROUPS is not set
45CONFIG_FAIR_GROUP_SCHED=y 46# CONFIG_GROUP_SCHED is not set
46CONFIG_FAIR_USER_SCHED=y
47# CONFIG_FAIR_CGROUP_SCHED is not set
48CONFIG_SYSFS_DEPRECATED=y 47CONFIG_SYSFS_DEPRECATED=y
48CONFIG_SYSFS_DEPRECATED_V2=y
49# CONFIG_RELAY is not set 49# CONFIG_RELAY is not set
50# CONFIG_NAMESPACES is not set
50# CONFIG_BLK_DEV_INITRD is not set 51# CONFIG_BLK_DEV_INITRD is not set
51# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 52# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
52CONFIG_SYSCTL=y 53CONFIG_SYSCTL=y
@@ -76,22 +77,31 @@ CONFIG_PROFILING=y
76# CONFIG_MARKERS is not set 77# CONFIG_MARKERS is not set
77CONFIG_OPROFILE=y 78CONFIG_OPROFILE=y
78CONFIG_HAVE_OPROFILE=y 79CONFIG_HAVE_OPROFILE=y
80# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
81# CONFIG_HAVE_IOREMAP_PROT is not set
79# CONFIG_HAVE_KPROBES is not set 82# CONFIG_HAVE_KPROBES is not set
83# CONFIG_HAVE_KRETPROBES is not set
84# CONFIG_HAVE_ARCH_TRACEHOOK is not set
85# CONFIG_HAVE_DMA_ATTRS is not set
86# CONFIG_USE_GENERIC_SMP_HELPERS is not set
87CONFIG_HAVE_CLK=y
80CONFIG_PROC_PAGE_MONITOR=y 88CONFIG_PROC_PAGE_MONITOR=y
81CONFIG_SLABINFO=y 89CONFIG_SLABINFO=y
82CONFIG_RT_MUTEXES=y 90CONFIG_RT_MUTEXES=y
83# CONFIG_TINY_SHMEM is not set 91# CONFIG_TINY_SHMEM is not set
84CONFIG_BASE_SMALL=0 92CONFIG_BASE_SMALL=0
85CONFIG_MODULES=y 93CONFIG_MODULES=y
94# CONFIG_MODULE_FORCE_LOAD is not set
86# CONFIG_MODULE_UNLOAD is not set 95# CONFIG_MODULE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 96# CONFIG_MODVERSIONS is not set
88# CONFIG_MODULE_SRCVERSION_ALL is not set 97# CONFIG_MODULE_SRCVERSION_ALL is not set
89# CONFIG_KMOD is not set 98CONFIG_KMOD=y
90CONFIG_BLOCK=y 99CONFIG_BLOCK=y
91# CONFIG_LBD is not set 100# CONFIG_LBD is not set
92# CONFIG_BLK_DEV_IO_TRACE is not set 101# CONFIG_BLK_DEV_IO_TRACE is not set
93# CONFIG_LSF is not set 102# CONFIG_LSF is not set
94# CONFIG_BLK_DEV_BSG is not set 103# CONFIG_BLK_DEV_BSG is not set
104# CONFIG_BLK_DEV_INTEGRITY is not set
95 105
96# 106#
97# IO Schedulers 107# IO Schedulers
@@ -106,7 +116,6 @@ CONFIG_DEFAULT_AS=y
106# CONFIG_DEFAULT_NOOP is not set 116# CONFIG_DEFAULT_NOOP is not set
107CONFIG_DEFAULT_IOSCHED="anticipatory" 117CONFIG_DEFAULT_IOSCHED="anticipatory"
108CONFIG_CLASSIC_RCU=y 118CONFIG_CLASSIC_RCU=y
109# CONFIG_PREEMPT_RCU is not set
110 119
111# 120#
112# System type 121# System type
@@ -116,6 +125,7 @@ CONFIG_CPU_SH4=y
116# CONFIG_CPU_SUBTYPE_SH7203 is not set 125# CONFIG_CPU_SUBTYPE_SH7203 is not set
117# CONFIG_CPU_SUBTYPE_SH7206 is not set 126# CONFIG_CPU_SUBTYPE_SH7206 is not set
118# CONFIG_CPU_SUBTYPE_SH7263 is not set 127# CONFIG_CPU_SUBTYPE_SH7263 is not set
128# CONFIG_CPU_SUBTYPE_MXG is not set
119# CONFIG_CPU_SUBTYPE_SH7705 is not set 129# CONFIG_CPU_SUBTYPE_SH7705 is not set
120# CONFIG_CPU_SUBTYPE_SH7706 is not set 130# CONFIG_CPU_SUBTYPE_SH7706 is not set
121# CONFIG_CPU_SUBTYPE_SH7707 is not set 131# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -133,6 +143,7 @@ CONFIG_CPU_SH4=y
133CONFIG_CPU_SUBTYPE_SH7751R=y 143CONFIG_CPU_SUBTYPE_SH7751R=y
134# CONFIG_CPU_SUBTYPE_SH7760 is not set 144# CONFIG_CPU_SUBTYPE_SH7760 is not set
135# CONFIG_CPU_SUBTYPE_SH4_202 is not set 145# CONFIG_CPU_SUBTYPE_SH4_202 is not set
146# CONFIG_CPU_SUBTYPE_SH7723 is not set
136# CONFIG_CPU_SUBTYPE_SH7763 is not set 147# CONFIG_CPU_SUBTYPE_SH7763 is not set
137# CONFIG_CPU_SUBTYPE_SH7770 is not set 148# CONFIG_CPU_SUBTYPE_SH7770 is not set
138# CONFIG_CPU_SUBTYPE_SH7780 is not set 149# CONFIG_CPU_SUBTYPE_SH7780 is not set
@@ -140,6 +151,7 @@ CONFIG_CPU_SUBTYPE_SH7751R=y
140# CONFIG_CPU_SUBTYPE_SHX3 is not set 151# CONFIG_CPU_SUBTYPE_SHX3 is not set
141# CONFIG_CPU_SUBTYPE_SH7343 is not set 152# CONFIG_CPU_SUBTYPE_SH7343 is not set
142# CONFIG_CPU_SUBTYPE_SH7722 is not set 153# CONFIG_CPU_SUBTYPE_SH7722 is not set
154# CONFIG_CPU_SUBTYPE_SH7366 is not set
143# CONFIG_CPU_SUBTYPE_SH5_101 is not set 155# CONFIG_CPU_SUBTYPE_SH5_101 is not set
144# CONFIG_CPU_SUBTYPE_SH5_103 is not set 156# CONFIG_CPU_SUBTYPE_SH5_103 is not set
145 157
@@ -161,7 +173,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
161CONFIG_ARCH_SELECT_MEMORY_MODEL=y 173CONFIG_ARCH_SELECT_MEMORY_MODEL=y
162CONFIG_PAGE_SIZE_4KB=y 174CONFIG_PAGE_SIZE_4KB=y
163# CONFIG_PAGE_SIZE_8KB is not set 175# CONFIG_PAGE_SIZE_8KB is not set
176# CONFIG_PAGE_SIZE_16KB is not set
164# CONFIG_PAGE_SIZE_64KB is not set 177# CONFIG_PAGE_SIZE_64KB is not set
178CONFIG_ENTRY_OFFSET=0x00001000
165CONFIG_SELECT_MEMORY_MODEL=y 179CONFIG_SELECT_MEMORY_MODEL=y
166CONFIG_FLATMEM_MANUAL=y 180CONFIG_FLATMEM_MANUAL=y
167# CONFIG_DISCONTIGMEM_MANUAL is not set 181# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -170,6 +184,7 @@ CONFIG_FLATMEM=y
170CONFIG_FLAT_NODE_MEM_MAP=y 184CONFIG_FLAT_NODE_MEM_MAP=y
171CONFIG_SPARSEMEM_STATIC=y 185CONFIG_SPARSEMEM_STATIC=y
172# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 186# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
187CONFIG_PAGEFLAGS_EXTENDED=y
173CONFIG_SPLIT_PTLOCK_CPUS=4 188CONFIG_SPLIT_PTLOCK_CPUS=4
174# CONFIG_RESOURCES_64BIT is not set 189# CONFIG_RESOURCES_64BIT is not set
175CONFIG_ZONE_DMA_FLAG=0 190CONFIG_ZONE_DMA_FLAG=0
@@ -256,7 +271,6 @@ CONFIG_HZ=250
256CONFIG_PREEMPT_NONE=y 271CONFIG_PREEMPT_NONE=y
257# CONFIG_PREEMPT_VOLUNTARY is not set 272# CONFIG_PREEMPT_VOLUNTARY is not set
258# CONFIG_PREEMPT is not set 273# CONFIG_PREEMPT is not set
259CONFIG_RCU_TRACE=y
260CONFIG_GUSA=y 274CONFIG_GUSA=y
261# CONFIG_GUSA_RB is not set 275# CONFIG_GUSA_RB is not set
262 276
@@ -332,8 +346,6 @@ CONFIG_TCP_CONG_CUBIC=y
332CONFIG_DEFAULT_TCP_CONG="cubic" 346CONFIG_DEFAULT_TCP_CONG="cubic"
333# CONFIG_TCP_MD5SIG is not set 347# CONFIG_TCP_MD5SIG is not set
334# CONFIG_IPV6 is not set 348# CONFIG_IPV6 is not set
335# CONFIG_INET6_XFRM_TUNNEL is not set
336# CONFIG_INET6_TUNNEL is not set
337# CONFIG_NETWORK_SECMARK is not set 349# CONFIG_NETWORK_SECMARK is not set
338# CONFIG_NETFILTER is not set 350# CONFIG_NETFILTER is not set
339# CONFIG_IP_DCCP is not set 351# CONFIG_IP_DCCP is not set
@@ -367,6 +379,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
367# 379#
368# CONFIG_CFG80211 is not set 380# CONFIG_CFG80211 is not set
369CONFIG_WIRELESS_EXT=y 381CONFIG_WIRELESS_EXT=y
382CONFIG_WIRELESS_EXT_SYSFS=y
370# CONFIG_MAC80211 is not set 383# CONFIG_MAC80211 is not set
371# CONFIG_IEEE80211 is not set 384# CONFIG_IEEE80211 is not set
372# CONFIG_RFKILL is not set 385# CONFIG_RFKILL is not set
@@ -383,6 +396,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
383CONFIG_STANDALONE=y 396CONFIG_STANDALONE=y
384CONFIG_PREVENT_FIRMWARE_BUILD=y 397CONFIG_PREVENT_FIRMWARE_BUILD=y
385CONFIG_FW_LOADER=m 398CONFIG_FW_LOADER=m
399CONFIG_FIRMWARE_IN_KERNEL=y
400CONFIG_EXTRA_FIRMWARE=""
386# CONFIG_SYS_HYPERVISOR is not set 401# CONFIG_SYS_HYPERVISOR is not set
387# CONFIG_CONNECTOR is not set 402# CONFIG_CONNECTOR is not set
388# CONFIG_MTD is not set 403# CONFIG_MTD is not set
@@ -399,14 +414,18 @@ CONFIG_BLK_DEV=y
399CONFIG_BLK_DEV_RAM=y 414CONFIG_BLK_DEV_RAM=y
400CONFIG_BLK_DEV_RAM_COUNT=16 415CONFIG_BLK_DEV_RAM_COUNT=16
401CONFIG_BLK_DEV_RAM_SIZE=4096 416CONFIG_BLK_DEV_RAM_SIZE=4096
402CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 417# CONFIG_BLK_DEV_XIP is not set
403# CONFIG_CDROM_PKTCDVD is not set 418# CONFIG_CDROM_PKTCDVD is not set
404# CONFIG_ATA_OVER_ETH is not set 419# CONFIG_ATA_OVER_ETH is not set
420# CONFIG_BLK_DEV_HD is not set
405CONFIG_MISC_DEVICES=y 421CONFIG_MISC_DEVICES=y
406# CONFIG_PHANTOM is not set 422# CONFIG_PHANTOM is not set
407# CONFIG_EEPROM_93CX6 is not set 423# CONFIG_EEPROM_93CX6 is not set
408# CONFIG_SGI_IOC4 is not set 424# CONFIG_SGI_IOC4 is not set
409# CONFIG_TIFM_CORE is not set 425# CONFIG_TIFM_CORE is not set
426# CONFIG_ENCLOSURE_SERVICES is not set
427# CONFIG_HP_ILO is not set
428CONFIG_HAVE_IDE=y
410# CONFIG_IDE is not set 429# CONFIG_IDE is not set
411 430
412# 431#
@@ -466,6 +485,7 @@ CONFIG_SCSI_LOWLEVEL=y
466# CONFIG_SCSI_IPS is not set 485# CONFIG_SCSI_IPS is not set
467# CONFIG_SCSI_INITIO is not set 486# CONFIG_SCSI_INITIO is not set
468# CONFIG_SCSI_INIA100 is not set 487# CONFIG_SCSI_INIA100 is not set
488# CONFIG_SCSI_MVSAS is not set
469# CONFIG_SCSI_STEX is not set 489# CONFIG_SCSI_STEX is not set
470# CONFIG_SCSI_SYM53C8XX_2 is not set 490# CONFIG_SCSI_SYM53C8XX_2 is not set
471# CONFIG_SCSI_IPR is not set 491# CONFIG_SCSI_IPR is not set
@@ -478,9 +498,13 @@ CONFIG_SCSI_LOWLEVEL=y
478# CONFIG_SCSI_NSP32 is not set 498# CONFIG_SCSI_NSP32 is not set
479# CONFIG_SCSI_DEBUG is not set 499# CONFIG_SCSI_DEBUG is not set
480# CONFIG_SCSI_SRP is not set 500# CONFIG_SCSI_SRP is not set
501# CONFIG_SCSI_DH is not set
481CONFIG_ATA=y 502CONFIG_ATA=y
482# CONFIG_ATA_NONSTANDARD is not set 503# CONFIG_ATA_NONSTANDARD is not set
504CONFIG_SATA_PMP=y
483# CONFIG_SATA_AHCI is not set 505# CONFIG_SATA_AHCI is not set
506# CONFIG_SATA_SIL24 is not set
507CONFIG_ATA_SFF=y
484# CONFIG_SATA_SVW is not set 508# CONFIG_SATA_SVW is not set
485# CONFIG_ATA_PIIX is not set 509# CONFIG_ATA_PIIX is not set
486# CONFIG_SATA_MV is not set 510# CONFIG_SATA_MV is not set
@@ -490,7 +514,6 @@ CONFIG_ATA=y
490# CONFIG_SATA_PROMISE is not set 514# CONFIG_SATA_PROMISE is not set
491# CONFIG_SATA_SX4 is not set 515# CONFIG_SATA_SX4 is not set
492# CONFIG_SATA_SIL is not set 516# CONFIG_SATA_SIL is not set
493# CONFIG_SATA_SIL24 is not set
494# CONFIG_SATA_SIS is not set 517# CONFIG_SATA_SIS is not set
495# CONFIG_SATA_ULI is not set 518# CONFIG_SATA_ULI is not set
496# CONFIG_SATA_VIA is not set 519# CONFIG_SATA_VIA is not set
@@ -535,17 +558,21 @@ CONFIG_ATA=y
535# CONFIG_PATA_VIA is not set 558# CONFIG_PATA_VIA is not set
536# CONFIG_PATA_WINBOND is not set 559# CONFIG_PATA_WINBOND is not set
537CONFIG_PATA_PLATFORM=y 560CONFIG_PATA_PLATFORM=y
561# CONFIG_PATA_SCH is not set
538# CONFIG_MD is not set 562# CONFIG_MD is not set
539# CONFIG_FUSION is not set 563# CONFIG_FUSION is not set
540 564
541# 565#
542# IEEE 1394 (FireWire) support 566# IEEE 1394 (FireWire) support
543# 567#
568
569#
570# Enable only one of the two stacks, unless you know what you are doing
571#
544# CONFIG_FIREWIRE is not set 572# CONFIG_FIREWIRE is not set
545# CONFIG_IEEE1394 is not set 573# CONFIG_IEEE1394 is not set
546# CONFIG_I2O is not set 574# CONFIG_I2O is not set
547CONFIG_NETDEVICES=y 575CONFIG_NETDEVICES=y
548# CONFIG_NETDEVICES_MULTIQUEUE is not set
549# CONFIG_DUMMY is not set 576# CONFIG_DUMMY is not set
550# CONFIG_BONDING is not set 577# CONFIG_BONDING is not set
551# CONFIG_MACVLAN is not set 578# CONFIG_MACVLAN is not set
@@ -564,6 +591,7 @@ CONFIG_MII=y
564# CONFIG_NET_VENDOR_3COM is not set 591# CONFIG_NET_VENDOR_3COM is not set
565# CONFIG_SMC91X is not set 592# CONFIG_SMC91X is not set
566# CONFIG_ENC28J60 is not set 593# CONFIG_ENC28J60 is not set
594# CONFIG_SMC911X is not set
567# CONFIG_NET_TULIP is not set 595# CONFIG_NET_TULIP is not set
568# CONFIG_HP100 is not set 596# CONFIG_HP100 is not set
569# CONFIG_IBM_NEW_EMAC_ZMII is not set 597# CONFIG_IBM_NEW_EMAC_ZMII is not set
@@ -599,7 +627,6 @@ CONFIG_NETDEV_1000=y
599# CONFIG_DL2K is not set 627# CONFIG_DL2K is not set
600# CONFIG_E1000 is not set 628# CONFIG_E1000 is not set
601# CONFIG_E1000E is not set 629# CONFIG_E1000E is not set
602# CONFIG_E1000E_ENABLED is not set
603# CONFIG_IP1000 is not set 630# CONFIG_IP1000 is not set
604# CONFIG_IGB is not set 631# CONFIG_IGB is not set
605# CONFIG_NS83820 is not set 632# CONFIG_NS83820 is not set
@@ -609,12 +636,12 @@ CONFIG_NETDEV_1000=y
609# CONFIG_SIS190 is not set 636# CONFIG_SIS190 is not set
610# CONFIG_SKGE is not set 637# CONFIG_SKGE is not set
611# CONFIG_SKY2 is not set 638# CONFIG_SKY2 is not set
612# CONFIG_SK98LIN is not set
613# CONFIG_VIA_VELOCITY is not set 639# CONFIG_VIA_VELOCITY is not set
614# CONFIG_TIGON3 is not set 640# CONFIG_TIGON3 is not set
615# CONFIG_BNX2 is not set 641# CONFIG_BNX2 is not set
616# CONFIG_QLA3XXX is not set 642# CONFIG_QLA3XXX is not set
617# CONFIG_ATL1 is not set 643# CONFIG_ATL1 is not set
644# CONFIG_ATL1E is not set
618CONFIG_NETDEV_10000=y 645CONFIG_NETDEV_10000=y
619# CONFIG_CHELSIO_T1 is not set 646# CONFIG_CHELSIO_T1 is not set
620# CONFIG_CHELSIO_T3 is not set 647# CONFIG_CHELSIO_T3 is not set
@@ -627,6 +654,7 @@ CONFIG_NETDEV_10000=y
627# CONFIG_MLX4_CORE is not set 654# CONFIG_MLX4_CORE is not set
628# CONFIG_TEHUTI is not set 655# CONFIG_TEHUTI is not set
629# CONFIG_BNX2X is not set 656# CONFIG_BNX2X is not set
657# CONFIG_SFC is not set
630# CONFIG_TR is not set 658# CONFIG_TR is not set
631 659
632# 660#
@@ -634,6 +662,7 @@ CONFIG_NETDEV_10000=y
634# 662#
635# CONFIG_WLAN_PRE80211 is not set 663# CONFIG_WLAN_PRE80211 is not set
636# CONFIG_WLAN_80211 is not set 664# CONFIG_WLAN_80211 is not set
665# CONFIG_IWLWIFI_LEDS is not set
637 666
638# 667#
639# USB Network Adapters 668# USB Network Adapters
@@ -690,9 +719,11 @@ CONFIG_INPUT=y
690# Character devices 719# Character devices
691# 720#
692CONFIG_VT=y 721CONFIG_VT=y
722CONFIG_CONSOLE_TRANSLATIONS=y
693CONFIG_VT_CONSOLE=y 723CONFIG_VT_CONSOLE=y
694CONFIG_HW_CONSOLE=y 724CONFIG_HW_CONSOLE=y
695CONFIG_VT_HW_CONSOLE_BINDING=y 725CONFIG_VT_HW_CONSOLE_BINDING=y
726CONFIG_DEVKMEM=y
696# CONFIG_SERIAL_NONSTANDARD is not set 727# CONFIG_SERIAL_NONSTANDARD is not set
697# CONFIG_NOZOMI is not set 728# CONFIG_NOZOMI is not set
698 729
@@ -726,10 +757,6 @@ CONFIG_HW_RANDOM=y
726# CONFIG_TCG_TPM is not set 757# CONFIG_TCG_TPM is not set
727CONFIG_DEVPORT=y 758CONFIG_DEVPORT=y
728# CONFIG_I2C is not set 759# CONFIG_I2C is not set
729
730#
731# SPI support
732#
733CONFIG_SPI=y 760CONFIG_SPI=y
734CONFIG_SPI_MASTER=y 761CONFIG_SPI_MASTER=y
735 762
@@ -765,6 +792,8 @@ CONFIG_HWMON=y
765# CONFIG_SENSORS_W83627HF is not set 792# CONFIG_SENSORS_W83627HF is not set
766# CONFIG_SENSORS_W83627EHF is not set 793# CONFIG_SENSORS_W83627EHF is not set
767# CONFIG_HWMON_DEBUG_CHIP is not set 794# CONFIG_HWMON_DEBUG_CHIP is not set
795# CONFIG_THERMAL is not set
796# CONFIG_THERMAL_HWMON is not set
768# CONFIG_WATCHDOG is not set 797# CONFIG_WATCHDOG is not set
769 798
770# 799#
@@ -776,13 +805,24 @@ CONFIG_SSB_POSSIBLE=y
776# 805#
777# Multifunction device drivers 806# Multifunction device drivers
778# 807#
808# CONFIG_MFD_CORE is not set
779CONFIG_MFD_SM501=y 809CONFIG_MFD_SM501=y
810# CONFIG_HTC_PASIC3 is not set
780 811
781# 812#
782# Multimedia devices 813# Multimedia devices
783# 814#
815
816#
817# Multimedia core support
818#
784# CONFIG_VIDEO_DEV is not set 819# CONFIG_VIDEO_DEV is not set
785# CONFIG_DVB_CORE is not set 820# CONFIG_DVB_CORE is not set
821# CONFIG_VIDEO_MEDIA is not set
822
823#
824# Multimedia drivers
825#
786CONFIG_DAB=y 826CONFIG_DAB=y
787# CONFIG_USB_DABUSB is not set 827# CONFIG_USB_DABUSB is not set
788 828
@@ -802,8 +842,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
802# CONFIG_FB_SYS_FILLRECT is not set 842# CONFIG_FB_SYS_FILLRECT is not set
803# CONFIG_FB_SYS_COPYAREA is not set 843# CONFIG_FB_SYS_COPYAREA is not set
804# CONFIG_FB_SYS_IMAGEBLIT is not set 844# CONFIG_FB_SYS_IMAGEBLIT is not set
845# CONFIG_FB_FOREIGN_ENDIAN is not set
805# CONFIG_FB_SYS_FOPS is not set 846# CONFIG_FB_SYS_FOPS is not set
806CONFIG_FB_DEFERRED_IO=y
807# CONFIG_FB_SVGALIB is not set 847# CONFIG_FB_SVGALIB is not set
808# CONFIG_FB_MACMODES is not set 848# CONFIG_FB_MACMODES is not set
809# CONFIG_FB_BACKLIGHT is not set 849# CONFIG_FB_BACKLIGHT is not set
@@ -836,6 +876,8 @@ CONFIG_FB_DEFERRED_IO=y
836# CONFIG_FB_TRIDENT is not set 876# CONFIG_FB_TRIDENT is not set
837# CONFIG_FB_ARK is not set 877# CONFIG_FB_ARK is not set
838# CONFIG_FB_PM3 is not set 878# CONFIG_FB_PM3 is not set
879# CONFIG_FB_CARMINE is not set
880CONFIG_FB_SH_MOBILE_LCDC=m
839CONFIG_FB_SM501=y 881CONFIG_FB_SM501=y
840# CONFIG_FB_VIRTUAL is not set 882# CONFIG_FB_VIRTUAL is not set
841# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 883# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
@@ -862,15 +904,7 @@ CONFIG_LOGO=y
862# CONFIG_LOGO_SUPERH_MONO is not set 904# CONFIG_LOGO_SUPERH_MONO is not set
863# CONFIG_LOGO_SUPERH_VGA16 is not set 905# CONFIG_LOGO_SUPERH_VGA16 is not set
864CONFIG_LOGO_SUPERH_CLUT224=y 906CONFIG_LOGO_SUPERH_CLUT224=y
865
866#
867# Sound
868#
869CONFIG_SOUND=y 907CONFIG_SOUND=y
870
871#
872# Advanced Linux Sound Architecture
873#
874CONFIG_SND=m 908CONFIG_SND=m
875CONFIG_SND_TIMER=m 909CONFIG_SND_TIMER=m
876CONFIG_SND_PCM=m 910CONFIG_SND_PCM=m
@@ -884,21 +918,17 @@ CONFIG_SND_SUPPORT_OLD_API=y
884CONFIG_SND_VERBOSE_PROCFS=y 918CONFIG_SND_VERBOSE_PROCFS=y
885# CONFIG_SND_VERBOSE_PRINTK is not set 919# CONFIG_SND_VERBOSE_PRINTK is not set
886# CONFIG_SND_DEBUG is not set 920# CONFIG_SND_DEBUG is not set
887 921CONFIG_SND_VMASTER=y
888#
889# Generic devices
890#
891CONFIG_SND_MPU401_UART=m 922CONFIG_SND_MPU401_UART=m
892CONFIG_SND_OPL3_LIB=m 923CONFIG_SND_OPL3_LIB=m
893CONFIG_SND_AC97_CODEC=m 924CONFIG_SND_AC97_CODEC=m
925CONFIG_SND_DRIVERS=y
894# CONFIG_SND_DUMMY is not set 926# CONFIG_SND_DUMMY is not set
895# CONFIG_SND_MTPAV is not set 927# CONFIG_SND_MTPAV is not set
896# CONFIG_SND_SERIAL_U16550 is not set 928# CONFIG_SND_SERIAL_U16550 is not set
897# CONFIG_SND_MPU401 is not set 929# CONFIG_SND_MPU401 is not set
898 930# CONFIG_SND_AC97_POWER_SAVE is not set
899# 931CONFIG_SND_PCI=y
900# PCI devices
901#
902# CONFIG_SND_AD1889 is not set 932# CONFIG_SND_AD1889 is not set
903# CONFIG_SND_ALS300 is not set 933# CONFIG_SND_ALS300 is not set
904# CONFIG_SND_ALI5451 is not set 934# CONFIG_SND_ALI5451 is not set
@@ -907,6 +937,7 @@ CONFIG_SND_AC97_CODEC=m
907# CONFIG_SND_AU8810 is not set 937# CONFIG_SND_AU8810 is not set
908# CONFIG_SND_AU8820 is not set 938# CONFIG_SND_AU8820 is not set
909# CONFIG_SND_AU8830 is not set 939# CONFIG_SND_AU8830 is not set
940# CONFIG_SND_AW2 is not set
910# CONFIG_SND_AZT3328 is not set 941# CONFIG_SND_AZT3328 is not set
911# CONFIG_SND_BT87X is not set 942# CONFIG_SND_BT87X is not set
912# CONFIG_SND_CA0106 is not set 943# CONFIG_SND_CA0106 is not set
@@ -957,43 +988,13 @@ CONFIG_SND_AC97_CODEC=m
957# CONFIG_SND_VIRTUOSO is not set 988# CONFIG_SND_VIRTUOSO is not set
958# CONFIG_SND_VX222 is not set 989# CONFIG_SND_VX222 is not set
959CONFIG_SND_YMFPCI=m 990CONFIG_SND_YMFPCI=m
960CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y 991CONFIG_SND_SPI=y
961# CONFIG_SND_AC97_POWER_SAVE is not set 992CONFIG_SND_SUPERH=y
962 993CONFIG_SND_USB=y
963#
964# SPI devices
965#
966
967#
968# SUPERH devices
969#
970
971#
972# USB devices
973#
974# CONFIG_SND_USB_AUDIO is not set 994# CONFIG_SND_USB_AUDIO is not set
975# CONFIG_SND_USB_CAIAQ is not set 995# CONFIG_SND_USB_CAIAQ is not set
976
977#
978# System on Chip audio support
979#
980# CONFIG_SND_SOC is not set 996# CONFIG_SND_SOC is not set
981
982#
983# SoC Audio support for SuperH
984#
985
986#
987# ALSA SoC audio for Freescale SOCs
988#
989
990#
991# Open Sound System
992#
993CONFIG_SOUND_PRIME=m 997CONFIG_SOUND_PRIME=m
994# CONFIG_SOUND_TRIDENT is not set
995# CONFIG_SOUND_MSNDCLAS is not set
996# CONFIG_SOUND_MSNDPIN is not set
997CONFIG_AC97_BUS=m 998CONFIG_AC97_BUS=m
998CONFIG_HID_SUPPORT=y 999CONFIG_HID_SUPPORT=y
999CONFIG_HID=y 1000CONFIG_HID=y
@@ -1022,12 +1023,16 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
1022CONFIG_USB_DEVICE_CLASS=y 1023CONFIG_USB_DEVICE_CLASS=y
1023# CONFIG_USB_DYNAMIC_MINORS is not set 1024# CONFIG_USB_DYNAMIC_MINORS is not set
1024# CONFIG_USB_OTG is not set 1025# CONFIG_USB_OTG is not set
1026# CONFIG_USB_OTG_WHITELIST is not set
1027# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1025 1028
1026# 1029#
1027# USB Host Controller Drivers 1030# USB Host Controller Drivers
1028# 1031#
1032# CONFIG_USB_C67X00_HCD is not set
1029# CONFIG_USB_EHCI_HCD is not set 1033# CONFIG_USB_EHCI_HCD is not set
1030# CONFIG_USB_ISP116X_HCD is not set 1034# CONFIG_USB_ISP116X_HCD is not set
1035# CONFIG_USB_ISP1760_HCD is not set
1031CONFIG_USB_OHCI_HCD=y 1036CONFIG_USB_OHCI_HCD=y
1032# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1037# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1033# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1038# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1041,6 +1046,7 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1041# 1046#
1042# CONFIG_USB_ACM is not set 1047# CONFIG_USB_ACM is not set
1043# CONFIG_USB_PRINTER is not set 1048# CONFIG_USB_PRINTER is not set
1049# CONFIG_USB_WDM is not set
1044 1050
1045# 1051#
1046# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1052# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1060,7 +1066,9 @@ CONFIG_USB_STORAGE=y
1060# CONFIG_USB_STORAGE_SDDR55 is not set 1066# CONFIG_USB_STORAGE_SDDR55 is not set
1061# CONFIG_USB_STORAGE_JUMPSHOT is not set 1067# CONFIG_USB_STORAGE_JUMPSHOT is not set
1062# CONFIG_USB_STORAGE_ALAUDA is not set 1068# CONFIG_USB_STORAGE_ALAUDA is not set
1069# CONFIG_USB_STORAGE_ONETOUCH is not set
1063# CONFIG_USB_STORAGE_KARMA is not set 1070# CONFIG_USB_STORAGE_KARMA is not set
1071# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1064CONFIG_USB_LIBUSUAL=y 1072CONFIG_USB_LIBUSUAL=y
1065 1073
1066# 1074#
@@ -1096,9 +1104,12 @@ CONFIG_USB_LIBUSUAL=y
1096# CONFIG_USB_LD is not set 1104# CONFIG_USB_LD is not set
1097# CONFIG_USB_TRANCEVIBRATOR is not set 1105# CONFIG_USB_TRANCEVIBRATOR is not set
1098# CONFIG_USB_IOWARRIOR is not set 1106# CONFIG_USB_IOWARRIOR is not set
1107# CONFIG_USB_ISIGHTFW is not set
1099# CONFIG_USB_GADGET is not set 1108# CONFIG_USB_GADGET is not set
1100# CONFIG_MMC is not set 1109# CONFIG_MMC is not set
1110# CONFIG_MEMSTICK is not set
1101# CONFIG_NEW_LEDS is not set 1111# CONFIG_NEW_LEDS is not set
1112# CONFIG_ACCESSIBILITY is not set
1102# CONFIG_INFINIBAND is not set 1113# CONFIG_INFINIBAND is not set
1103CONFIG_RTC_LIB=y 1114CONFIG_RTC_LIB=y
1104CONFIG_RTC_CLASS=y 1115CONFIG_RTC_CLASS=y
@@ -1118,6 +1129,8 @@ CONFIG_RTC_INTF_DEV=y
1118# 1129#
1119# SPI RTC drivers 1130# SPI RTC drivers
1120# 1131#
1132# CONFIG_RTC_DRV_M41T94 is not set
1133# CONFIG_RTC_DRV_DS1305 is not set
1121# CONFIG_RTC_DRV_MAX6902 is not set 1134# CONFIG_RTC_DRV_MAX6902 is not set
1122CONFIG_RTC_DRV_R9701=y 1135CONFIG_RTC_DRV_R9701=y
1123# CONFIG_RTC_DRV_RS5C348 is not set 1136# CONFIG_RTC_DRV_RS5C348 is not set
@@ -1137,10 +1150,7 @@ CONFIG_RTC_DRV_R9701=y
1137# on-CPU RTC drivers 1150# on-CPU RTC drivers
1138# 1151#
1139# CONFIG_RTC_DRV_SH is not set 1152# CONFIG_RTC_DRV_SH is not set
1140 1153# CONFIG_DMADEVICES is not set
1141#
1142# Userspace I/O
1143#
1144# CONFIG_UIO is not set 1154# CONFIG_UIO is not set
1145 1155
1146# 1156#
@@ -1155,14 +1165,11 @@ CONFIG_EXT2_FS=y
1155# CONFIG_JFS_FS is not set 1165# CONFIG_JFS_FS is not set
1156# CONFIG_FS_POSIX_ACL is not set 1166# CONFIG_FS_POSIX_ACL is not set
1157# CONFIG_XFS_FS is not set 1167# CONFIG_XFS_FS is not set
1158# CONFIG_GFS2_FS is not set
1159# CONFIG_OCFS2_FS is not set 1168# CONFIG_OCFS2_FS is not set
1160CONFIG_MINIX_FS=y 1169CONFIG_DNOTIFY=y
1161# CONFIG_ROMFS_FS is not set
1162CONFIG_INOTIFY=y 1170CONFIG_INOTIFY=y
1163CONFIG_INOTIFY_USER=y 1171CONFIG_INOTIFY_USER=y
1164# CONFIG_QUOTA is not set 1172# CONFIG_QUOTA is not set
1165CONFIG_DNOTIFY=y
1166# CONFIG_AUTOFS_FS is not set 1173# CONFIG_AUTOFS_FS is not set
1167# CONFIG_AUTOFS4_FS is not set 1174# CONFIG_AUTOFS4_FS is not set
1168# CONFIG_FUSE_FS is not set 1175# CONFIG_FUSE_FS is not set
@@ -1208,8 +1215,11 @@ CONFIG_TMPFS=y
1208# CONFIG_EFS_FS is not set 1215# CONFIG_EFS_FS is not set
1209# CONFIG_CRAMFS is not set 1216# CONFIG_CRAMFS is not set
1210# CONFIG_VXFS_FS is not set 1217# CONFIG_VXFS_FS is not set
1218CONFIG_MINIX_FS=y
1219# CONFIG_OMFS_FS is not set
1211# CONFIG_HPFS_FS is not set 1220# CONFIG_HPFS_FS is not set
1212# CONFIG_QNX4FS_FS is not set 1221# CONFIG_QNX4FS_FS is not set
1222# CONFIG_ROMFS_FS is not set
1213# CONFIG_SYSV_FS is not set 1223# CONFIG_SYSV_FS is not set
1214# CONFIG_UFS_FS is not set 1224# CONFIG_UFS_FS is not set
1215CONFIG_NETWORK_FILESYSTEMS=y 1225CONFIG_NETWORK_FILESYSTEMS=y
@@ -1275,12 +1285,14 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1275# CONFIG_PRINTK_TIME is not set 1285# CONFIG_PRINTK_TIME is not set
1276CONFIG_ENABLE_WARN_DEPRECATED=y 1286CONFIG_ENABLE_WARN_DEPRECATED=y
1277CONFIG_ENABLE_MUST_CHECK=y 1287CONFIG_ENABLE_MUST_CHECK=y
1288CONFIG_FRAME_WARN=1024
1278# CONFIG_MAGIC_SYSRQ is not set 1289# CONFIG_MAGIC_SYSRQ is not set
1279# CONFIG_UNUSED_SYMBOLS is not set 1290# CONFIG_UNUSED_SYMBOLS is not set
1280CONFIG_DEBUG_FS=y 1291CONFIG_DEBUG_FS=y
1281# CONFIG_HEADERS_CHECK is not set 1292# CONFIG_HEADERS_CHECK is not set
1282# CONFIG_DEBUG_KERNEL is not set 1293# CONFIG_DEBUG_KERNEL is not set
1283# CONFIG_DEBUG_BUGVERBOSE is not set 1294# CONFIG_DEBUG_BUGVERBOSE is not set
1295# CONFIG_DEBUG_MEMORY_INIT is not set
1284# CONFIG_SAMPLES is not set 1296# CONFIG_SAMPLES is not set
1285# CONFIG_SH_STANDARD_BIOS is not set 1297# CONFIG_SH_STANDARD_BIOS is not set
1286CONFIG_EARLY_SCIF_CONSOLE=y 1298CONFIG_EARLY_SCIF_CONSOLE=y
@@ -1295,48 +1307,81 @@ CONFIG_EARLY_PRINTK=y
1295# CONFIG_SECURITY is not set 1307# CONFIG_SECURITY is not set
1296# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1308# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1297CONFIG_CRYPTO=y 1309CONFIG_CRYPTO=y
1298# CONFIG_CRYPTO_SEQIV is not set 1310
1311#
1312# Crypto core or helper
1313#
1299# CONFIG_CRYPTO_MANAGER is not set 1314# CONFIG_CRYPTO_MANAGER is not set
1315# CONFIG_CRYPTO_GF128MUL is not set
1316# CONFIG_CRYPTO_NULL is not set
1317# CONFIG_CRYPTO_CRYPTD is not set
1318# CONFIG_CRYPTO_AUTHENC is not set
1319# CONFIG_CRYPTO_TEST is not set
1320
1321#
1322# Authenticated Encryption with Associated Data
1323#
1324# CONFIG_CRYPTO_CCM is not set
1325# CONFIG_CRYPTO_GCM is not set
1326# CONFIG_CRYPTO_SEQIV is not set
1327
1328#
1329# Block modes
1330#
1331# CONFIG_CRYPTO_CBC is not set
1332# CONFIG_CRYPTO_CTR is not set
1333# CONFIG_CRYPTO_CTS is not set
1334# CONFIG_CRYPTO_ECB is not set
1335# CONFIG_CRYPTO_LRW is not set
1336# CONFIG_CRYPTO_PCBC is not set
1337# CONFIG_CRYPTO_XTS is not set
1338
1339#
1340# Hash modes
1341#
1300# CONFIG_CRYPTO_HMAC is not set 1342# CONFIG_CRYPTO_HMAC is not set
1301# CONFIG_CRYPTO_XCBC is not set 1343# CONFIG_CRYPTO_XCBC is not set
1302# CONFIG_CRYPTO_NULL is not set 1344
1345#
1346# Digest
1347#
1348# CONFIG_CRYPTO_CRC32C is not set
1303# CONFIG_CRYPTO_MD4 is not set 1349# CONFIG_CRYPTO_MD4 is not set
1304# CONFIG_CRYPTO_MD5 is not set 1350# CONFIG_CRYPTO_MD5 is not set
1351# CONFIG_CRYPTO_MICHAEL_MIC is not set
1352# CONFIG_CRYPTO_RMD128 is not set
1353# CONFIG_CRYPTO_RMD160 is not set
1354# CONFIG_CRYPTO_RMD256 is not set
1355# CONFIG_CRYPTO_RMD320 is not set
1305# CONFIG_CRYPTO_SHA1 is not set 1356# CONFIG_CRYPTO_SHA1 is not set
1306# CONFIG_CRYPTO_SHA256 is not set 1357# CONFIG_CRYPTO_SHA256 is not set
1307# CONFIG_CRYPTO_SHA512 is not set 1358# CONFIG_CRYPTO_SHA512 is not set
1308# CONFIG_CRYPTO_WP512 is not set
1309# CONFIG_CRYPTO_TGR192 is not set 1359# CONFIG_CRYPTO_TGR192 is not set
1310# CONFIG_CRYPTO_GF128MUL is not set 1360# CONFIG_CRYPTO_WP512 is not set
1311# CONFIG_CRYPTO_ECB is not set 1361
1312# CONFIG_CRYPTO_CBC is not set 1362#
1313# CONFIG_CRYPTO_PCBC is not set 1363# Ciphers
1314# CONFIG_CRYPTO_LRW is not set 1364#
1315# CONFIG_CRYPTO_XTS is not set
1316# CONFIG_CRYPTO_CTR is not set
1317# CONFIG_CRYPTO_GCM is not set
1318# CONFIG_CRYPTO_CCM is not set
1319# CONFIG_CRYPTO_CRYPTD is not set
1320# CONFIG_CRYPTO_DES is not set
1321# CONFIG_CRYPTO_FCRYPT is not set
1322# CONFIG_CRYPTO_BLOWFISH is not set
1323# CONFIG_CRYPTO_TWOFISH is not set
1324# CONFIG_CRYPTO_SERPENT is not set
1325# CONFIG_CRYPTO_AES is not set 1365# CONFIG_CRYPTO_AES is not set
1366# CONFIG_CRYPTO_ANUBIS is not set
1367# CONFIG_CRYPTO_ARC4 is not set
1368# CONFIG_CRYPTO_BLOWFISH is not set
1369# CONFIG_CRYPTO_CAMELLIA is not set
1326# CONFIG_CRYPTO_CAST5 is not set 1370# CONFIG_CRYPTO_CAST5 is not set
1327# CONFIG_CRYPTO_CAST6 is not set 1371# CONFIG_CRYPTO_CAST6 is not set
1328# CONFIG_CRYPTO_TEA is not set 1372# CONFIG_CRYPTO_DES is not set
1329# CONFIG_CRYPTO_ARC4 is not set 1373# CONFIG_CRYPTO_FCRYPT is not set
1330# CONFIG_CRYPTO_KHAZAD is not set 1374# CONFIG_CRYPTO_KHAZAD is not set
1331# CONFIG_CRYPTO_ANUBIS is not set
1332# CONFIG_CRYPTO_SEED is not set
1333# CONFIG_CRYPTO_SALSA20 is not set 1375# CONFIG_CRYPTO_SALSA20 is not set
1376# CONFIG_CRYPTO_SEED is not set
1377# CONFIG_CRYPTO_SERPENT is not set
1378# CONFIG_CRYPTO_TEA is not set
1379# CONFIG_CRYPTO_TWOFISH is not set
1380
1381#
1382# Compression
1383#
1334# CONFIG_CRYPTO_DEFLATE is not set 1384# CONFIG_CRYPTO_DEFLATE is not set
1335# CONFIG_CRYPTO_MICHAEL_MIC is not set
1336# CONFIG_CRYPTO_CRC32C is not set
1337# CONFIG_CRYPTO_CAMELLIA is not set
1338# CONFIG_CRYPTO_TEST is not set
1339# CONFIG_CRYPTO_AUTHENC is not set
1340# CONFIG_CRYPTO_LZO is not set 1385# CONFIG_CRYPTO_LZO is not set
1341CONFIG_CRYPTO_HW=y 1386CONFIG_CRYPTO_HW=y
1342# CONFIG_CRYPTO_DEV_HIFN_795X is not set 1387# CONFIG_CRYPTO_DEV_HIFN_795X is not set
@@ -1345,8 +1390,10 @@ CONFIG_CRYPTO_HW=y
1345# Library routines 1390# Library routines
1346# 1391#
1347CONFIG_BITREVERSE=y 1392CONFIG_BITREVERSE=y
1393# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1348# CONFIG_CRC_CCITT is not set 1394# CONFIG_CRC_CCITT is not set
1349# CONFIG_CRC16 is not set 1395# CONFIG_CRC16 is not set
1396CONFIG_CRC_T10DIF=y
1350# CONFIG_CRC_ITU_T is not set 1397# CONFIG_CRC_ITU_T is not set
1351CONFIG_CRC32=y 1398CONFIG_CRC32=y
1352# CONFIG_CRC7 is not set 1399# CONFIG_CRC7 is not set
diff --git a/arch/sh/configs/rts7751r2dplus_defconfig b/arch/sh/configs/rts7751r2dplus_defconfig
index 0a6d3b9e648b..7d9fa6e9ded5 100644
--- a/arch/sh/configs/rts7751r2dplus_defconfig
+++ b/arch/sh/configs/rts7751r2dplus_defconfig
@@ -1,10 +1,11 @@
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
4# Thu Feb 7 16:17:47 2008 4# Wed Jul 30 01:59:18 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -20,6 +21,8 @@ CONFIG_LOCKDEP_SUPPORT=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set 21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set 22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y 23CONFIG_ARCH_NO_VIRT_TO_BUS=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
25CONFIG_IO_TRAPPED=y
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24 27
25# 28#
@@ -36,17 +39,15 @@ CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set 39# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set 40# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set 41# CONFIG_TASKSTATS is not set
39# CONFIG_USER_NS is not set
40# CONFIG_PID_NS is not set
41# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 43# CONFIG_IKCONFIG is not set
43CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
44# CONFIG_CGROUPS is not set 45# CONFIG_CGROUPS is not set
45CONFIG_FAIR_GROUP_SCHED=y 46# CONFIG_GROUP_SCHED is not set
46CONFIG_FAIR_USER_SCHED=y
47# CONFIG_FAIR_CGROUP_SCHED is not set
48CONFIG_SYSFS_DEPRECATED=y 47CONFIG_SYSFS_DEPRECATED=y
48CONFIG_SYSFS_DEPRECATED_V2=y
49# CONFIG_RELAY is not set 49# CONFIG_RELAY is not set
50# CONFIG_NAMESPACES is not set
50# CONFIG_BLK_DEV_INITRD is not set 51# CONFIG_BLK_DEV_INITRD is not set
51# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 52# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
52CONFIG_SYSCTL=y 53CONFIG_SYSCTL=y
@@ -76,22 +77,31 @@ CONFIG_PROFILING=y
76# CONFIG_MARKERS is not set 77# CONFIG_MARKERS is not set
77CONFIG_OPROFILE=y 78CONFIG_OPROFILE=y
78CONFIG_HAVE_OPROFILE=y 79CONFIG_HAVE_OPROFILE=y
80# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
81# CONFIG_HAVE_IOREMAP_PROT is not set
79# CONFIG_HAVE_KPROBES is not set 82# CONFIG_HAVE_KPROBES is not set
83# CONFIG_HAVE_KRETPROBES is not set
84# CONFIG_HAVE_ARCH_TRACEHOOK is not set
85# CONFIG_HAVE_DMA_ATTRS is not set
86# CONFIG_USE_GENERIC_SMP_HELPERS is not set
87CONFIG_HAVE_CLK=y
80CONFIG_PROC_PAGE_MONITOR=y 88CONFIG_PROC_PAGE_MONITOR=y
81CONFIG_SLABINFO=y 89CONFIG_SLABINFO=y
82CONFIG_RT_MUTEXES=y 90CONFIG_RT_MUTEXES=y
83# CONFIG_TINY_SHMEM is not set 91# CONFIG_TINY_SHMEM is not set
84CONFIG_BASE_SMALL=0 92CONFIG_BASE_SMALL=0
85CONFIG_MODULES=y 93CONFIG_MODULES=y
94# CONFIG_MODULE_FORCE_LOAD is not set
86# CONFIG_MODULE_UNLOAD is not set 95# CONFIG_MODULE_UNLOAD is not set
87# CONFIG_MODVERSIONS is not set 96# CONFIG_MODVERSIONS is not set
88# CONFIG_MODULE_SRCVERSION_ALL is not set 97# CONFIG_MODULE_SRCVERSION_ALL is not set
89# CONFIG_KMOD is not set 98CONFIG_KMOD=y
90CONFIG_BLOCK=y 99CONFIG_BLOCK=y
91# CONFIG_LBD is not set 100# CONFIG_LBD is not set
92# CONFIG_BLK_DEV_IO_TRACE is not set 101# CONFIG_BLK_DEV_IO_TRACE is not set
93# CONFIG_LSF is not set 102# CONFIG_LSF is not set
94# CONFIG_BLK_DEV_BSG is not set 103# CONFIG_BLK_DEV_BSG is not set
104# CONFIG_BLK_DEV_INTEGRITY is not set
95 105
96# 106#
97# IO Schedulers 107# IO Schedulers
@@ -106,7 +116,6 @@ CONFIG_DEFAULT_AS=y
106# CONFIG_DEFAULT_NOOP is not set 116# CONFIG_DEFAULT_NOOP is not set
107CONFIG_DEFAULT_IOSCHED="anticipatory" 117CONFIG_DEFAULT_IOSCHED="anticipatory"
108CONFIG_CLASSIC_RCU=y 118CONFIG_CLASSIC_RCU=y
109# CONFIG_PREEMPT_RCU is not set
110 119
111# 120#
112# System type 121# System type
@@ -116,6 +125,7 @@ CONFIG_CPU_SH4=y
116# CONFIG_CPU_SUBTYPE_SH7203 is not set 125# CONFIG_CPU_SUBTYPE_SH7203 is not set
117# CONFIG_CPU_SUBTYPE_SH7206 is not set 126# CONFIG_CPU_SUBTYPE_SH7206 is not set
118# CONFIG_CPU_SUBTYPE_SH7263 is not set 127# CONFIG_CPU_SUBTYPE_SH7263 is not set
128# CONFIG_CPU_SUBTYPE_MXG is not set
119# CONFIG_CPU_SUBTYPE_SH7705 is not set 129# CONFIG_CPU_SUBTYPE_SH7705 is not set
120# CONFIG_CPU_SUBTYPE_SH7706 is not set 130# CONFIG_CPU_SUBTYPE_SH7706 is not set
121# CONFIG_CPU_SUBTYPE_SH7707 is not set 131# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -133,6 +143,7 @@ CONFIG_CPU_SH4=y
133CONFIG_CPU_SUBTYPE_SH7751R=y 143CONFIG_CPU_SUBTYPE_SH7751R=y
134# CONFIG_CPU_SUBTYPE_SH7760 is not set 144# CONFIG_CPU_SUBTYPE_SH7760 is not set
135# CONFIG_CPU_SUBTYPE_SH4_202 is not set 145# CONFIG_CPU_SUBTYPE_SH4_202 is not set
146# CONFIG_CPU_SUBTYPE_SH7723 is not set
136# CONFIG_CPU_SUBTYPE_SH7763 is not set 147# CONFIG_CPU_SUBTYPE_SH7763 is not set
137# CONFIG_CPU_SUBTYPE_SH7770 is not set 148# CONFIG_CPU_SUBTYPE_SH7770 is not set
138# CONFIG_CPU_SUBTYPE_SH7780 is not set 149# CONFIG_CPU_SUBTYPE_SH7780 is not set
@@ -140,6 +151,7 @@ CONFIG_CPU_SUBTYPE_SH7751R=y
140# CONFIG_CPU_SUBTYPE_SHX3 is not set 151# CONFIG_CPU_SUBTYPE_SHX3 is not set
141# CONFIG_CPU_SUBTYPE_SH7343 is not set 152# CONFIG_CPU_SUBTYPE_SH7343 is not set
142# CONFIG_CPU_SUBTYPE_SH7722 is not set 153# CONFIG_CPU_SUBTYPE_SH7722 is not set
154# CONFIG_CPU_SUBTYPE_SH7366 is not set
143# CONFIG_CPU_SUBTYPE_SH5_101 is not set 155# CONFIG_CPU_SUBTYPE_SH5_101 is not set
144# CONFIG_CPU_SUBTYPE_SH5_103 is not set 156# CONFIG_CPU_SUBTYPE_SH5_103 is not set
145 157
@@ -161,7 +173,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
161CONFIG_ARCH_SELECT_MEMORY_MODEL=y 173CONFIG_ARCH_SELECT_MEMORY_MODEL=y
162CONFIG_PAGE_SIZE_4KB=y 174CONFIG_PAGE_SIZE_4KB=y
163# CONFIG_PAGE_SIZE_8KB is not set 175# CONFIG_PAGE_SIZE_8KB is not set
176# CONFIG_PAGE_SIZE_16KB is not set
164# CONFIG_PAGE_SIZE_64KB is not set 177# CONFIG_PAGE_SIZE_64KB is not set
178CONFIG_ENTRY_OFFSET=0x00001000
165CONFIG_SELECT_MEMORY_MODEL=y 179CONFIG_SELECT_MEMORY_MODEL=y
166CONFIG_FLATMEM_MANUAL=y 180CONFIG_FLATMEM_MANUAL=y
167# CONFIG_DISCONTIGMEM_MANUAL is not set 181# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -170,6 +184,7 @@ CONFIG_FLATMEM=y
170CONFIG_FLAT_NODE_MEM_MAP=y 184CONFIG_FLAT_NODE_MEM_MAP=y
171CONFIG_SPARSEMEM_STATIC=y 185CONFIG_SPARSEMEM_STATIC=y
172# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 186# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
187CONFIG_PAGEFLAGS_EXTENDED=y
173CONFIG_SPLIT_PTLOCK_CPUS=4 188CONFIG_SPLIT_PTLOCK_CPUS=4
174# CONFIG_RESOURCES_64BIT is not set 189# CONFIG_RESOURCES_64BIT is not set
175CONFIG_ZONE_DMA_FLAG=0 190CONFIG_ZONE_DMA_FLAG=0
@@ -256,7 +271,6 @@ CONFIG_HZ=250
256CONFIG_PREEMPT_NONE=y 271CONFIG_PREEMPT_NONE=y
257# CONFIG_PREEMPT_VOLUNTARY is not set 272# CONFIG_PREEMPT_VOLUNTARY is not set
258# CONFIG_PREEMPT is not set 273# CONFIG_PREEMPT is not set
259CONFIG_RCU_TRACE=y
260CONFIG_GUSA=y 274CONFIG_GUSA=y
261# CONFIG_GUSA_RB is not set 275# CONFIG_GUSA_RB is not set
262 276
@@ -332,8 +346,6 @@ CONFIG_TCP_CONG_CUBIC=y
332CONFIG_DEFAULT_TCP_CONG="cubic" 346CONFIG_DEFAULT_TCP_CONG="cubic"
333# CONFIG_TCP_MD5SIG is not set 347# CONFIG_TCP_MD5SIG is not set
334# CONFIG_IPV6 is not set 348# CONFIG_IPV6 is not set
335# CONFIG_INET6_XFRM_TUNNEL is not set
336# CONFIG_INET6_TUNNEL is not set
337# CONFIG_NETWORK_SECMARK is not set 349# CONFIG_NETWORK_SECMARK is not set
338# CONFIG_NETFILTER is not set 350# CONFIG_NETFILTER is not set
339# CONFIG_IP_DCCP is not set 351# CONFIG_IP_DCCP is not set
@@ -367,6 +379,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
367# 379#
368# CONFIG_CFG80211 is not set 380# CONFIG_CFG80211 is not set
369CONFIG_WIRELESS_EXT=y 381CONFIG_WIRELESS_EXT=y
382CONFIG_WIRELESS_EXT_SYSFS=y
370# CONFIG_MAC80211 is not set 383# CONFIG_MAC80211 is not set
371# CONFIG_IEEE80211 is not set 384# CONFIG_IEEE80211 is not set
372# CONFIG_RFKILL is not set 385# CONFIG_RFKILL is not set
@@ -383,6 +396,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
383CONFIG_STANDALONE=y 396CONFIG_STANDALONE=y
384CONFIG_PREVENT_FIRMWARE_BUILD=y 397CONFIG_PREVENT_FIRMWARE_BUILD=y
385CONFIG_FW_LOADER=m 398CONFIG_FW_LOADER=m
399CONFIG_FIRMWARE_IN_KERNEL=y
400CONFIG_EXTRA_FIRMWARE=""
386# CONFIG_SYS_HYPERVISOR is not set 401# CONFIG_SYS_HYPERVISOR is not set
387# CONFIG_CONNECTOR is not set 402# CONFIG_CONNECTOR is not set
388# CONFIG_MTD is not set 403# CONFIG_MTD is not set
@@ -399,14 +414,18 @@ CONFIG_BLK_DEV=y
399CONFIG_BLK_DEV_RAM=y 414CONFIG_BLK_DEV_RAM=y
400CONFIG_BLK_DEV_RAM_COUNT=16 415CONFIG_BLK_DEV_RAM_COUNT=16
401CONFIG_BLK_DEV_RAM_SIZE=4096 416CONFIG_BLK_DEV_RAM_SIZE=4096
402CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 417# CONFIG_BLK_DEV_XIP is not set
403# CONFIG_CDROM_PKTCDVD is not set 418# CONFIG_CDROM_PKTCDVD is not set
404# CONFIG_ATA_OVER_ETH is not set 419# CONFIG_ATA_OVER_ETH is not set
420# CONFIG_BLK_DEV_HD is not set
405CONFIG_MISC_DEVICES=y 421CONFIG_MISC_DEVICES=y
406# CONFIG_PHANTOM is not set 422# CONFIG_PHANTOM is not set
407# CONFIG_EEPROM_93CX6 is not set 423# CONFIG_EEPROM_93CX6 is not set
408# CONFIG_SGI_IOC4 is not set 424# CONFIG_SGI_IOC4 is not set
409# CONFIG_TIFM_CORE is not set 425# CONFIG_TIFM_CORE is not set
426# CONFIG_ENCLOSURE_SERVICES is not set
427# CONFIG_HP_ILO is not set
428CONFIG_HAVE_IDE=y
410# CONFIG_IDE is not set 429# CONFIG_IDE is not set
411 430
412# 431#
@@ -466,6 +485,7 @@ CONFIG_SCSI_LOWLEVEL=y
466# CONFIG_SCSI_IPS is not set 485# CONFIG_SCSI_IPS is not set
467# CONFIG_SCSI_INITIO is not set 486# CONFIG_SCSI_INITIO is not set
468# CONFIG_SCSI_INIA100 is not set 487# CONFIG_SCSI_INIA100 is not set
488# CONFIG_SCSI_MVSAS is not set
469# CONFIG_SCSI_STEX is not set 489# CONFIG_SCSI_STEX is not set
470# CONFIG_SCSI_SYM53C8XX_2 is not set 490# CONFIG_SCSI_SYM53C8XX_2 is not set
471# CONFIG_SCSI_IPR is not set 491# CONFIG_SCSI_IPR is not set
@@ -478,9 +498,13 @@ CONFIG_SCSI_LOWLEVEL=y
478# CONFIG_SCSI_NSP32 is not set 498# CONFIG_SCSI_NSP32 is not set
479# CONFIG_SCSI_DEBUG is not set 499# CONFIG_SCSI_DEBUG is not set
480# CONFIG_SCSI_SRP is not set 500# CONFIG_SCSI_SRP is not set
501# CONFIG_SCSI_DH is not set
481CONFIG_ATA=y 502CONFIG_ATA=y
482# CONFIG_ATA_NONSTANDARD is not set 503# CONFIG_ATA_NONSTANDARD is not set
504CONFIG_SATA_PMP=y
483# CONFIG_SATA_AHCI is not set 505# CONFIG_SATA_AHCI is not set
506# CONFIG_SATA_SIL24 is not set
507CONFIG_ATA_SFF=y
484# CONFIG_SATA_SVW is not set 508# CONFIG_SATA_SVW is not set
485# CONFIG_ATA_PIIX is not set 509# CONFIG_ATA_PIIX is not set
486# CONFIG_SATA_MV is not set 510# CONFIG_SATA_MV is not set
@@ -490,7 +514,6 @@ CONFIG_ATA=y
490# CONFIG_SATA_PROMISE is not set 514# CONFIG_SATA_PROMISE is not set
491# CONFIG_SATA_SX4 is not set 515# CONFIG_SATA_SX4 is not set
492# CONFIG_SATA_SIL is not set 516# CONFIG_SATA_SIL is not set
493# CONFIG_SATA_SIL24 is not set
494# CONFIG_SATA_SIS is not set 517# CONFIG_SATA_SIS is not set
495# CONFIG_SATA_ULI is not set 518# CONFIG_SATA_ULI is not set
496# CONFIG_SATA_VIA is not set 519# CONFIG_SATA_VIA is not set
@@ -535,17 +558,21 @@ CONFIG_ATA=y
535# CONFIG_PATA_VIA is not set 558# CONFIG_PATA_VIA is not set
536# CONFIG_PATA_WINBOND is not set 559# CONFIG_PATA_WINBOND is not set
537CONFIG_PATA_PLATFORM=y 560CONFIG_PATA_PLATFORM=y
561# CONFIG_PATA_SCH is not set
538# CONFIG_MD is not set 562# CONFIG_MD is not set
539# CONFIG_FUSION is not set 563# CONFIG_FUSION is not set
540 564
541# 565#
542# IEEE 1394 (FireWire) support 566# IEEE 1394 (FireWire) support
543# 567#
568
569#
570# Enable only one of the two stacks, unless you know what you are doing
571#
544# CONFIG_FIREWIRE is not set 572# CONFIG_FIREWIRE is not set
545# CONFIG_IEEE1394 is not set 573# CONFIG_IEEE1394 is not set
546# CONFIG_I2O is not set 574# CONFIG_I2O is not set
547CONFIG_NETDEVICES=y 575CONFIG_NETDEVICES=y
548# CONFIG_NETDEVICES_MULTIQUEUE is not set
549# CONFIG_DUMMY is not set 576# CONFIG_DUMMY is not set
550# CONFIG_BONDING is not set 577# CONFIG_BONDING is not set
551# CONFIG_MACVLAN is not set 578# CONFIG_MACVLAN is not set
@@ -564,6 +591,7 @@ CONFIG_MII=y
564# CONFIG_NET_VENDOR_3COM is not set 591# CONFIG_NET_VENDOR_3COM is not set
565# CONFIG_SMC91X is not set 592# CONFIG_SMC91X is not set
566# CONFIG_ENC28J60 is not set 593# CONFIG_ENC28J60 is not set
594# CONFIG_SMC911X is not set
567# CONFIG_NET_TULIP is not set 595# CONFIG_NET_TULIP is not set
568# CONFIG_HP100 is not set 596# CONFIG_HP100 is not set
569# CONFIG_IBM_NEW_EMAC_ZMII is not set 597# CONFIG_IBM_NEW_EMAC_ZMII is not set
@@ -599,7 +627,6 @@ CONFIG_NETDEV_1000=y
599# CONFIG_DL2K is not set 627# CONFIG_DL2K is not set
600# CONFIG_E1000 is not set 628# CONFIG_E1000 is not set
601# CONFIG_E1000E is not set 629# CONFIG_E1000E is not set
602# CONFIG_E1000E_ENABLED is not set
603# CONFIG_IP1000 is not set 630# CONFIG_IP1000 is not set
604# CONFIG_IGB is not set 631# CONFIG_IGB is not set
605# CONFIG_NS83820 is not set 632# CONFIG_NS83820 is not set
@@ -609,12 +636,12 @@ CONFIG_NETDEV_1000=y
609# CONFIG_SIS190 is not set 636# CONFIG_SIS190 is not set
610# CONFIG_SKGE is not set 637# CONFIG_SKGE is not set
611# CONFIG_SKY2 is not set 638# CONFIG_SKY2 is not set
612# CONFIG_SK98LIN is not set
613# CONFIG_VIA_VELOCITY is not set 639# CONFIG_VIA_VELOCITY is not set
614# CONFIG_TIGON3 is not set 640# CONFIG_TIGON3 is not set
615# CONFIG_BNX2 is not set 641# CONFIG_BNX2 is not set
616# CONFIG_QLA3XXX is not set 642# CONFIG_QLA3XXX is not set
617# CONFIG_ATL1 is not set 643# CONFIG_ATL1 is not set
644# CONFIG_ATL1E is not set
618CONFIG_NETDEV_10000=y 645CONFIG_NETDEV_10000=y
619# CONFIG_CHELSIO_T1 is not set 646# CONFIG_CHELSIO_T1 is not set
620# CONFIG_CHELSIO_T3 is not set 647# CONFIG_CHELSIO_T3 is not set
@@ -627,6 +654,7 @@ CONFIG_NETDEV_10000=y
627# CONFIG_MLX4_CORE is not set 654# CONFIG_MLX4_CORE is not set
628# CONFIG_TEHUTI is not set 655# CONFIG_TEHUTI is not set
629# CONFIG_BNX2X is not set 656# CONFIG_BNX2X is not set
657# CONFIG_SFC is not set
630# CONFIG_TR is not set 658# CONFIG_TR is not set
631 659
632# 660#
@@ -634,6 +662,7 @@ CONFIG_NETDEV_10000=y
634# 662#
635# CONFIG_WLAN_PRE80211 is not set 663# CONFIG_WLAN_PRE80211 is not set
636# CONFIG_WLAN_80211 is not set 664# CONFIG_WLAN_80211 is not set
665# CONFIG_IWLWIFI_LEDS is not set
637 666
638# 667#
639# USB Network Adapters 668# USB Network Adapters
@@ -690,9 +719,11 @@ CONFIG_INPUT=y
690# Character devices 719# Character devices
691# 720#
692CONFIG_VT=y 721CONFIG_VT=y
722CONFIG_CONSOLE_TRANSLATIONS=y
693CONFIG_VT_CONSOLE=y 723CONFIG_VT_CONSOLE=y
694CONFIG_HW_CONSOLE=y 724CONFIG_HW_CONSOLE=y
695CONFIG_VT_HW_CONSOLE_BINDING=y 725CONFIG_VT_HW_CONSOLE_BINDING=y
726CONFIG_DEVKMEM=y
696# CONFIG_SERIAL_NONSTANDARD is not set 727# CONFIG_SERIAL_NONSTANDARD is not set
697# CONFIG_NOZOMI is not set 728# CONFIG_NOZOMI is not set
698 729
@@ -726,10 +757,6 @@ CONFIG_HW_RANDOM=y
726# CONFIG_TCG_TPM is not set 757# CONFIG_TCG_TPM is not set
727CONFIG_DEVPORT=y 758CONFIG_DEVPORT=y
728# CONFIG_I2C is not set 759# CONFIG_I2C is not set
729
730#
731# SPI support
732#
733CONFIG_SPI=y 760CONFIG_SPI=y
734CONFIG_SPI_MASTER=y 761CONFIG_SPI_MASTER=y
735 762
@@ -765,6 +792,8 @@ CONFIG_HWMON=y
765# CONFIG_SENSORS_W83627HF is not set 792# CONFIG_SENSORS_W83627HF is not set
766# CONFIG_SENSORS_W83627EHF is not set 793# CONFIG_SENSORS_W83627EHF is not set
767# CONFIG_HWMON_DEBUG_CHIP is not set 794# CONFIG_HWMON_DEBUG_CHIP is not set
795# CONFIG_THERMAL is not set
796# CONFIG_THERMAL_HWMON is not set
768# CONFIG_WATCHDOG is not set 797# CONFIG_WATCHDOG is not set
769 798
770# 799#
@@ -776,13 +805,24 @@ CONFIG_SSB_POSSIBLE=y
776# 805#
777# Multifunction device drivers 806# Multifunction device drivers
778# 807#
808# CONFIG_MFD_CORE is not set
779CONFIG_MFD_SM501=y 809CONFIG_MFD_SM501=y
810# CONFIG_HTC_PASIC3 is not set
780 811
781# 812#
782# Multimedia devices 813# Multimedia devices
783# 814#
815
816#
817# Multimedia core support
818#
784# CONFIG_VIDEO_DEV is not set 819# CONFIG_VIDEO_DEV is not set
785# CONFIG_DVB_CORE is not set 820# CONFIG_DVB_CORE is not set
821# CONFIG_VIDEO_MEDIA is not set
822
823#
824# Multimedia drivers
825#
786CONFIG_DAB=y 826CONFIG_DAB=y
787# CONFIG_USB_DABUSB is not set 827# CONFIG_USB_DABUSB is not set
788 828
@@ -802,8 +842,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y
802# CONFIG_FB_SYS_FILLRECT is not set 842# CONFIG_FB_SYS_FILLRECT is not set
803# CONFIG_FB_SYS_COPYAREA is not set 843# CONFIG_FB_SYS_COPYAREA is not set
804# CONFIG_FB_SYS_IMAGEBLIT is not set 844# CONFIG_FB_SYS_IMAGEBLIT is not set
845# CONFIG_FB_FOREIGN_ENDIAN is not set
805# CONFIG_FB_SYS_FOPS is not set 846# CONFIG_FB_SYS_FOPS is not set
806CONFIG_FB_DEFERRED_IO=y
807# CONFIG_FB_SVGALIB is not set 847# CONFIG_FB_SVGALIB is not set
808# CONFIG_FB_MACMODES is not set 848# CONFIG_FB_MACMODES is not set
809# CONFIG_FB_BACKLIGHT is not set 849# CONFIG_FB_BACKLIGHT is not set
@@ -836,6 +876,8 @@ CONFIG_FB_DEFERRED_IO=y
836# CONFIG_FB_TRIDENT is not set 876# CONFIG_FB_TRIDENT is not set
837# CONFIG_FB_ARK is not set 877# CONFIG_FB_ARK is not set
838# CONFIG_FB_PM3 is not set 878# CONFIG_FB_PM3 is not set
879# CONFIG_FB_CARMINE is not set
880CONFIG_FB_SH_MOBILE_LCDC=m
839CONFIG_FB_SM501=y 881CONFIG_FB_SM501=y
840# CONFIG_FB_VIRTUAL is not set 882# CONFIG_FB_VIRTUAL is not set
841# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 883# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
@@ -862,15 +904,7 @@ CONFIG_LOGO=y
862# CONFIG_LOGO_SUPERH_MONO is not set 904# CONFIG_LOGO_SUPERH_MONO is not set
863# CONFIG_LOGO_SUPERH_VGA16 is not set 905# CONFIG_LOGO_SUPERH_VGA16 is not set
864CONFIG_LOGO_SUPERH_CLUT224=y 906CONFIG_LOGO_SUPERH_CLUT224=y
865
866#
867# Sound
868#
869CONFIG_SOUND=y 907CONFIG_SOUND=y
870
871#
872# Advanced Linux Sound Architecture
873#
874CONFIG_SND=m 908CONFIG_SND=m
875CONFIG_SND_TIMER=m 909CONFIG_SND_TIMER=m
876CONFIG_SND_PCM=m 910CONFIG_SND_PCM=m
@@ -884,21 +918,17 @@ CONFIG_SND_SUPPORT_OLD_API=y
884CONFIG_SND_VERBOSE_PROCFS=y 918CONFIG_SND_VERBOSE_PROCFS=y
885# CONFIG_SND_VERBOSE_PRINTK is not set 919# CONFIG_SND_VERBOSE_PRINTK is not set
886# CONFIG_SND_DEBUG is not set 920# CONFIG_SND_DEBUG is not set
887 921CONFIG_SND_VMASTER=y
888#
889# Generic devices
890#
891CONFIG_SND_MPU401_UART=m 922CONFIG_SND_MPU401_UART=m
892CONFIG_SND_OPL3_LIB=m 923CONFIG_SND_OPL3_LIB=m
893CONFIG_SND_AC97_CODEC=m 924CONFIG_SND_AC97_CODEC=m
925CONFIG_SND_DRIVERS=y
894# CONFIG_SND_DUMMY is not set 926# CONFIG_SND_DUMMY is not set
895# CONFIG_SND_MTPAV is not set 927# CONFIG_SND_MTPAV is not set
896# CONFIG_SND_SERIAL_U16550 is not set 928# CONFIG_SND_SERIAL_U16550 is not set
897# CONFIG_SND_MPU401 is not set 929# CONFIG_SND_MPU401 is not set
898 930# CONFIG_SND_AC97_POWER_SAVE is not set
899# 931CONFIG_SND_PCI=y
900# PCI devices
901#
902# CONFIG_SND_AD1889 is not set 932# CONFIG_SND_AD1889 is not set
903# CONFIG_SND_ALS300 is not set 933# CONFIG_SND_ALS300 is not set
904# CONFIG_SND_ALI5451 is not set 934# CONFIG_SND_ALI5451 is not set
@@ -907,6 +937,7 @@ CONFIG_SND_AC97_CODEC=m
907# CONFIG_SND_AU8810 is not set 937# CONFIG_SND_AU8810 is not set
908# CONFIG_SND_AU8820 is not set 938# CONFIG_SND_AU8820 is not set
909# CONFIG_SND_AU8830 is not set 939# CONFIG_SND_AU8830 is not set
940# CONFIG_SND_AW2 is not set
910# CONFIG_SND_AZT3328 is not set 941# CONFIG_SND_AZT3328 is not set
911# CONFIG_SND_BT87X is not set 942# CONFIG_SND_BT87X is not set
912# CONFIG_SND_CA0106 is not set 943# CONFIG_SND_CA0106 is not set
@@ -957,43 +988,13 @@ CONFIG_SND_AC97_CODEC=m
957# CONFIG_SND_VIRTUOSO is not set 988# CONFIG_SND_VIRTUOSO is not set
958# CONFIG_SND_VX222 is not set 989# CONFIG_SND_VX222 is not set
959CONFIG_SND_YMFPCI=m 990CONFIG_SND_YMFPCI=m
960CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL=y 991CONFIG_SND_SPI=y
961# CONFIG_SND_AC97_POWER_SAVE is not set 992CONFIG_SND_SUPERH=y
962 993CONFIG_SND_USB=y
963#
964# SPI devices
965#
966
967#
968# SUPERH devices
969#
970
971#
972# USB devices
973#
974# CONFIG_SND_USB_AUDIO is not set 994# CONFIG_SND_USB_AUDIO is not set
975# CONFIG_SND_USB_CAIAQ is not set 995# CONFIG_SND_USB_CAIAQ is not set
976
977#
978# System on Chip audio support
979#
980# CONFIG_SND_SOC is not set 996# CONFIG_SND_SOC is not set
981
982#
983# SoC Audio support for SuperH
984#
985
986#
987# ALSA SoC audio for Freescale SOCs
988#
989
990#
991# Open Sound System
992#
993CONFIG_SOUND_PRIME=m 997CONFIG_SOUND_PRIME=m
994# CONFIG_SOUND_TRIDENT is not set
995# CONFIG_SOUND_MSNDCLAS is not set
996# CONFIG_SOUND_MSNDPIN is not set
997CONFIG_AC97_BUS=m 998CONFIG_AC97_BUS=m
998CONFIG_HID_SUPPORT=y 999CONFIG_HID_SUPPORT=y
999CONFIG_HID=y 1000CONFIG_HID=y
@@ -1022,12 +1023,16 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
1022CONFIG_USB_DEVICE_CLASS=y 1023CONFIG_USB_DEVICE_CLASS=y
1023# CONFIG_USB_DYNAMIC_MINORS is not set 1024# CONFIG_USB_DYNAMIC_MINORS is not set
1024# CONFIG_USB_OTG is not set 1025# CONFIG_USB_OTG is not set
1026# CONFIG_USB_OTG_WHITELIST is not set
1027# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1025 1028
1026# 1029#
1027# USB Host Controller Drivers 1030# USB Host Controller Drivers
1028# 1031#
1032# CONFIG_USB_C67X00_HCD is not set
1029# CONFIG_USB_EHCI_HCD is not set 1033# CONFIG_USB_EHCI_HCD is not set
1030# CONFIG_USB_ISP116X_HCD is not set 1034# CONFIG_USB_ISP116X_HCD is not set
1035# CONFIG_USB_ISP1760_HCD is not set
1031CONFIG_USB_OHCI_HCD=y 1036CONFIG_USB_OHCI_HCD=y
1032# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1037# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1033# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1038# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1041,6 +1046,7 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1041# 1046#
1042# CONFIG_USB_ACM is not set 1047# CONFIG_USB_ACM is not set
1043# CONFIG_USB_PRINTER is not set 1048# CONFIG_USB_PRINTER is not set
1049# CONFIG_USB_WDM is not set
1044 1050
1045# 1051#
1046# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1052# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1060,7 +1066,9 @@ CONFIG_USB_STORAGE=y
1060# CONFIG_USB_STORAGE_SDDR55 is not set 1066# CONFIG_USB_STORAGE_SDDR55 is not set
1061# CONFIG_USB_STORAGE_JUMPSHOT is not set 1067# CONFIG_USB_STORAGE_JUMPSHOT is not set
1062# CONFIG_USB_STORAGE_ALAUDA is not set 1068# CONFIG_USB_STORAGE_ALAUDA is not set
1069# CONFIG_USB_STORAGE_ONETOUCH is not set
1063# CONFIG_USB_STORAGE_KARMA is not set 1070# CONFIG_USB_STORAGE_KARMA is not set
1071# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1064CONFIG_USB_LIBUSUAL=y 1072CONFIG_USB_LIBUSUAL=y
1065 1073
1066# 1074#
@@ -1096,9 +1104,12 @@ CONFIG_USB_LIBUSUAL=y
1096# CONFIG_USB_LD is not set 1104# CONFIG_USB_LD is not set
1097# CONFIG_USB_TRANCEVIBRATOR is not set 1105# CONFIG_USB_TRANCEVIBRATOR is not set
1098# CONFIG_USB_IOWARRIOR is not set 1106# CONFIG_USB_IOWARRIOR is not set
1107# CONFIG_USB_ISIGHTFW is not set
1099# CONFIG_USB_GADGET is not set 1108# CONFIG_USB_GADGET is not set
1100# CONFIG_MMC is not set 1109# CONFIG_MMC is not set
1110# CONFIG_MEMSTICK is not set
1101# CONFIG_NEW_LEDS is not set 1111# CONFIG_NEW_LEDS is not set
1112# CONFIG_ACCESSIBILITY is not set
1102# CONFIG_INFINIBAND is not set 1113# CONFIG_INFINIBAND is not set
1103CONFIG_RTC_LIB=y 1114CONFIG_RTC_LIB=y
1104CONFIG_RTC_CLASS=y 1115CONFIG_RTC_CLASS=y
@@ -1118,6 +1129,8 @@ CONFIG_RTC_INTF_DEV=y
1118# 1129#
1119# SPI RTC drivers 1130# SPI RTC drivers
1120# 1131#
1132# CONFIG_RTC_DRV_M41T94 is not set
1133# CONFIG_RTC_DRV_DS1305 is not set
1121# CONFIG_RTC_DRV_MAX6902 is not set 1134# CONFIG_RTC_DRV_MAX6902 is not set
1122CONFIG_RTC_DRV_R9701=y 1135CONFIG_RTC_DRV_R9701=y
1123# CONFIG_RTC_DRV_RS5C348 is not set 1136# CONFIG_RTC_DRV_RS5C348 is not set
@@ -1137,10 +1150,7 @@ CONFIG_RTC_DRV_R9701=y
1137# on-CPU RTC drivers 1150# on-CPU RTC drivers
1138# 1151#
1139# CONFIG_RTC_DRV_SH is not set 1152# CONFIG_RTC_DRV_SH is not set
1140 1153# CONFIG_DMADEVICES is not set
1141#
1142# Userspace I/O
1143#
1144# CONFIG_UIO is not set 1154# CONFIG_UIO is not set
1145 1155
1146# 1156#
@@ -1155,14 +1165,11 @@ CONFIG_EXT2_FS=y
1155# CONFIG_JFS_FS is not set 1165# CONFIG_JFS_FS is not set
1156# CONFIG_FS_POSIX_ACL is not set 1166# CONFIG_FS_POSIX_ACL is not set
1157# CONFIG_XFS_FS is not set 1167# CONFIG_XFS_FS is not set
1158# CONFIG_GFS2_FS is not set
1159# CONFIG_OCFS2_FS is not set 1168# CONFIG_OCFS2_FS is not set
1160CONFIG_MINIX_FS=y 1169CONFIG_DNOTIFY=y
1161# CONFIG_ROMFS_FS is not set
1162CONFIG_INOTIFY=y 1170CONFIG_INOTIFY=y
1163CONFIG_INOTIFY_USER=y 1171CONFIG_INOTIFY_USER=y
1164# CONFIG_QUOTA is not set 1172# CONFIG_QUOTA is not set
1165CONFIG_DNOTIFY=y
1166# CONFIG_AUTOFS_FS is not set 1173# CONFIG_AUTOFS_FS is not set
1167# CONFIG_AUTOFS4_FS is not set 1174# CONFIG_AUTOFS4_FS is not set
1168# CONFIG_FUSE_FS is not set 1175# CONFIG_FUSE_FS is not set
@@ -1208,8 +1215,11 @@ CONFIG_TMPFS=y
1208# CONFIG_EFS_FS is not set 1215# CONFIG_EFS_FS is not set
1209# CONFIG_CRAMFS is not set 1216# CONFIG_CRAMFS is not set
1210# CONFIG_VXFS_FS is not set 1217# CONFIG_VXFS_FS is not set
1218CONFIG_MINIX_FS=y
1219# CONFIG_OMFS_FS is not set
1211# CONFIG_HPFS_FS is not set 1220# CONFIG_HPFS_FS is not set
1212# CONFIG_QNX4FS_FS is not set 1221# CONFIG_QNX4FS_FS is not set
1222# CONFIG_ROMFS_FS is not set
1213# CONFIG_SYSV_FS is not set 1223# CONFIG_SYSV_FS is not set
1214# CONFIG_UFS_FS is not set 1224# CONFIG_UFS_FS is not set
1215CONFIG_NETWORK_FILESYSTEMS=y 1225CONFIG_NETWORK_FILESYSTEMS=y
@@ -1275,12 +1285,14 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1275# CONFIG_PRINTK_TIME is not set 1285# CONFIG_PRINTK_TIME is not set
1276CONFIG_ENABLE_WARN_DEPRECATED=y 1286CONFIG_ENABLE_WARN_DEPRECATED=y
1277CONFIG_ENABLE_MUST_CHECK=y 1287CONFIG_ENABLE_MUST_CHECK=y
1288CONFIG_FRAME_WARN=1024
1278# CONFIG_MAGIC_SYSRQ is not set 1289# CONFIG_MAGIC_SYSRQ is not set
1279# CONFIG_UNUSED_SYMBOLS is not set 1290# CONFIG_UNUSED_SYMBOLS is not set
1280CONFIG_DEBUG_FS=y 1291CONFIG_DEBUG_FS=y
1281# CONFIG_HEADERS_CHECK is not set 1292# CONFIG_HEADERS_CHECK is not set
1282# CONFIG_DEBUG_KERNEL is not set 1293# CONFIG_DEBUG_KERNEL is not set
1283# CONFIG_DEBUG_BUGVERBOSE is not set 1294# CONFIG_DEBUG_BUGVERBOSE is not set
1295# CONFIG_DEBUG_MEMORY_INIT is not set
1284# CONFIG_SAMPLES is not set 1296# CONFIG_SAMPLES is not set
1285# CONFIG_SH_STANDARD_BIOS is not set 1297# CONFIG_SH_STANDARD_BIOS is not set
1286CONFIG_EARLY_SCIF_CONSOLE=y 1298CONFIG_EARLY_SCIF_CONSOLE=y
@@ -1295,48 +1307,81 @@ CONFIG_EARLY_PRINTK=y
1295# CONFIG_SECURITY is not set 1307# CONFIG_SECURITY is not set
1296# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1308# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1297CONFIG_CRYPTO=y 1309CONFIG_CRYPTO=y
1298# CONFIG_CRYPTO_SEQIV is not set 1310
1311#
1312# Crypto core or helper
1313#
1299# CONFIG_CRYPTO_MANAGER is not set 1314# CONFIG_CRYPTO_MANAGER is not set
1315# CONFIG_CRYPTO_GF128MUL is not set
1316# CONFIG_CRYPTO_NULL is not set
1317# CONFIG_CRYPTO_CRYPTD is not set
1318# CONFIG_CRYPTO_AUTHENC is not set
1319# CONFIG_CRYPTO_TEST is not set
1320
1321#
1322# Authenticated Encryption with Associated Data
1323#
1324# CONFIG_CRYPTO_CCM is not set
1325# CONFIG_CRYPTO_GCM is not set
1326# CONFIG_CRYPTO_SEQIV is not set
1327
1328#
1329# Block modes
1330#
1331# CONFIG_CRYPTO_CBC is not set
1332# CONFIG_CRYPTO_CTR is not set
1333# CONFIG_CRYPTO_CTS is not set
1334# CONFIG_CRYPTO_ECB is not set
1335# CONFIG_CRYPTO_LRW is not set
1336# CONFIG_CRYPTO_PCBC is not set
1337# CONFIG_CRYPTO_XTS is not set
1338
1339#
1340# Hash modes
1341#
1300# CONFIG_CRYPTO_HMAC is not set 1342# CONFIG_CRYPTO_HMAC is not set
1301# CONFIG_CRYPTO_XCBC is not set 1343# CONFIG_CRYPTO_XCBC is not set
1302# CONFIG_CRYPTO_NULL is not set 1344
1345#
1346# Digest
1347#
1348# CONFIG_CRYPTO_CRC32C is not set
1303# CONFIG_CRYPTO_MD4 is not set 1349# CONFIG_CRYPTO_MD4 is not set
1304# CONFIG_CRYPTO_MD5 is not set 1350# CONFIG_CRYPTO_MD5 is not set
1351# CONFIG_CRYPTO_MICHAEL_MIC is not set
1352# CONFIG_CRYPTO_RMD128 is not set
1353# CONFIG_CRYPTO_RMD160 is not set
1354# CONFIG_CRYPTO_RMD256 is not set
1355# CONFIG_CRYPTO_RMD320 is not set
1305# CONFIG_CRYPTO_SHA1 is not set 1356# CONFIG_CRYPTO_SHA1 is not set
1306# CONFIG_CRYPTO_SHA256 is not set 1357# CONFIG_CRYPTO_SHA256 is not set
1307# CONFIG_CRYPTO_SHA512 is not set 1358# CONFIG_CRYPTO_SHA512 is not set
1308# CONFIG_CRYPTO_WP512 is not set
1309# CONFIG_CRYPTO_TGR192 is not set 1359# CONFIG_CRYPTO_TGR192 is not set
1310# CONFIG_CRYPTO_GF128MUL is not set 1360# CONFIG_CRYPTO_WP512 is not set
1311# CONFIG_CRYPTO_ECB is not set 1361
1312# CONFIG_CRYPTO_CBC is not set 1362#
1313# CONFIG_CRYPTO_PCBC is not set 1363# Ciphers
1314# CONFIG_CRYPTO_LRW is not set 1364#
1315# CONFIG_CRYPTO_XTS is not set
1316# CONFIG_CRYPTO_CTR is not set
1317# CONFIG_CRYPTO_GCM is not set
1318# CONFIG_CRYPTO_CCM is not set
1319# CONFIG_CRYPTO_CRYPTD is not set
1320# CONFIG_CRYPTO_DES is not set
1321# CONFIG_CRYPTO_FCRYPT is not set
1322# CONFIG_CRYPTO_BLOWFISH is not set
1323# CONFIG_CRYPTO_TWOFISH is not set
1324# CONFIG_CRYPTO_SERPENT is not set
1325# CONFIG_CRYPTO_AES is not set 1365# CONFIG_CRYPTO_AES is not set
1366# CONFIG_CRYPTO_ANUBIS is not set
1367# CONFIG_CRYPTO_ARC4 is not set
1368# CONFIG_CRYPTO_BLOWFISH is not set
1369# CONFIG_CRYPTO_CAMELLIA is not set
1326# CONFIG_CRYPTO_CAST5 is not set 1370# CONFIG_CRYPTO_CAST5 is not set
1327# CONFIG_CRYPTO_CAST6 is not set 1371# CONFIG_CRYPTO_CAST6 is not set
1328# CONFIG_CRYPTO_TEA is not set 1372# CONFIG_CRYPTO_DES is not set
1329# CONFIG_CRYPTO_ARC4 is not set 1373# CONFIG_CRYPTO_FCRYPT is not set
1330# CONFIG_CRYPTO_KHAZAD is not set 1374# CONFIG_CRYPTO_KHAZAD is not set
1331# CONFIG_CRYPTO_ANUBIS is not set
1332# CONFIG_CRYPTO_SEED is not set
1333# CONFIG_CRYPTO_SALSA20 is not set 1375# CONFIG_CRYPTO_SALSA20 is not set
1376# CONFIG_CRYPTO_SEED is not set
1377# CONFIG_CRYPTO_SERPENT is not set
1378# CONFIG_CRYPTO_TEA is not set
1379# CONFIG_CRYPTO_TWOFISH is not set
1380
1381#
1382# Compression
1383#
1334# CONFIG_CRYPTO_DEFLATE is not set 1384# CONFIG_CRYPTO_DEFLATE is not set
1335# CONFIG_CRYPTO_MICHAEL_MIC is not set
1336# CONFIG_CRYPTO_CRC32C is not set
1337# CONFIG_CRYPTO_CAMELLIA is not set
1338# CONFIG_CRYPTO_TEST is not set
1339# CONFIG_CRYPTO_AUTHENC is not set
1340# CONFIG_CRYPTO_LZO is not set 1385# CONFIG_CRYPTO_LZO is not set
1341CONFIG_CRYPTO_HW=y 1386CONFIG_CRYPTO_HW=y
1342# CONFIG_CRYPTO_DEV_HIFN_795X is not set 1387# CONFIG_CRYPTO_DEV_HIFN_795X is not set
@@ -1345,8 +1390,10 @@ CONFIG_CRYPTO_HW=y
1345# Library routines 1390# Library routines
1346# 1391#
1347CONFIG_BITREVERSE=y 1392CONFIG_BITREVERSE=y
1393# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1348# CONFIG_CRC_CCITT is not set 1394# CONFIG_CRC_CCITT is not set
1349# CONFIG_CRC16 is not set 1395# CONFIG_CRC16 is not set
1396CONFIG_CRC_T10DIF=y
1350# CONFIG_CRC_ITU_T is not set 1397# CONFIG_CRC_ITU_T is not set
1351CONFIG_CRC32=y 1398CONFIG_CRC32=y
1352# CONFIG_CRC7 is not set 1399# CONFIG_CRC7 is not set
diff --git a/arch/sh/configs/sdk7780_defconfig b/arch/sh/configs/sdk7780_defconfig
index bb9bcd6591ab..6d834f242905 100644
--- a/arch/sh/configs/sdk7780_defconfig
+++ b/arch/sh/configs/sdk7780_defconfig
@@ -1,10 +1,11 @@
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-rc7 3# Linux kernel version: 2.6.26
4# Tue Jan 22 11:34:03 2008 4# Wed Jul 30 02:00:12 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -20,6 +21,7 @@ CONFIG_LOCKDEP_SUPPORT=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set 21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set 22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y 23CONFIG_ARCH_NO_VIRT_TO_BUS=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24 26
25# 27#
@@ -38,24 +40,23 @@ CONFIG_POSIX_MQUEUE=y
38CONFIG_BSD_PROCESS_ACCT=y 40CONFIG_BSD_PROCESS_ACCT=y
39# CONFIG_BSD_PROCESS_ACCT_V3 is not set 41# CONFIG_BSD_PROCESS_ACCT_V3 is not set
40# CONFIG_TASKSTATS is not set 42# CONFIG_TASKSTATS is not set
41# CONFIG_USER_NS is not set
42# CONFIG_PID_NS is not set
43# CONFIG_AUDIT is not set 43# CONFIG_AUDIT is not set
44CONFIG_IKCONFIG=y 44CONFIG_IKCONFIG=y
45CONFIG_IKCONFIG_PROC=y 45CONFIG_IKCONFIG_PROC=y
46CONFIG_LOG_BUF_SHIFT=18 46CONFIG_LOG_BUF_SHIFT=18
47# CONFIG_CGROUPS is not set 47# CONFIG_CGROUPS is not set
48CONFIG_FAIR_GROUP_SCHED=y 48# CONFIG_GROUP_SCHED is not set
49CONFIG_FAIR_USER_SCHED=y
50# CONFIG_FAIR_CGROUP_SCHED is not set
51CONFIG_SYSFS_DEPRECATED=y 49CONFIG_SYSFS_DEPRECATED=y
50CONFIG_SYSFS_DEPRECATED_V2=y
52CONFIG_RELAY=y 51CONFIG_RELAY=y
52# CONFIG_NAMESPACES is not set
53# CONFIG_BLK_DEV_INITRD is not set 53# CONFIG_BLK_DEV_INITRD is not set
54CONFIG_CC_OPTIMIZE_FOR_SIZE=y 54CONFIG_CC_OPTIMIZE_FOR_SIZE=y
55CONFIG_SYSCTL=y 55CONFIG_SYSCTL=y
56CONFIG_EMBEDDED=y 56CONFIG_EMBEDDED=y
57CONFIG_UID16=y 57CONFIG_UID16=y
58CONFIG_SYSCTL_SYSCALL=y 58CONFIG_SYSCTL_SYSCALL=y
59CONFIG_SYSCTL_SYSCALL_CHECK=y
59CONFIG_KALLSYMS=y 60CONFIG_KALLSYMS=y
60CONFIG_KALLSYMS_ALL=y 61CONFIG_KALLSYMS_ALL=y
61# CONFIG_KALLSYMS_EXTRA_PASS is not set 62# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -63,11 +64,13 @@ CONFIG_HOTPLUG=y
63CONFIG_PRINTK=y 64CONFIG_PRINTK=y
64CONFIG_BUG=y 65CONFIG_BUG=y
65CONFIG_ELF_CORE=y 66CONFIG_ELF_CORE=y
67CONFIG_COMPAT_BRK=y
66CONFIG_BASE_FULL=y 68CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y 69CONFIG_FUTEX=y
68CONFIG_ANON_INODES=y 70CONFIG_ANON_INODES=y
69CONFIG_EPOLL=y 71CONFIG_EPOLL=y
70CONFIG_SIGNALFD=y 72CONFIG_SIGNALFD=y
73CONFIG_TIMERFD=y
71CONFIG_EVENTFD=y 74CONFIG_EVENTFD=y
72CONFIG_SHMEM=y 75CONFIG_SHMEM=y
73CONFIG_VM_EVENT_COUNTERS=y 76CONFIG_VM_EVENT_COUNTERS=y
@@ -75,11 +78,24 @@ CONFIG_SLUB_DEBUG=y
75# CONFIG_SLAB is not set 78# CONFIG_SLAB is not set
76CONFIG_SLUB=y 79CONFIG_SLUB=y
77# CONFIG_SLOB is not set 80# CONFIG_SLOB is not set
81# CONFIG_PROFILING is not set
82# CONFIG_MARKERS is not set
83CONFIG_HAVE_OPROFILE=y
84# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
85# CONFIG_HAVE_IOREMAP_PROT is not set
86# CONFIG_HAVE_KPROBES is not set
87# CONFIG_HAVE_KRETPROBES is not set
88# CONFIG_HAVE_ARCH_TRACEHOOK is not set
89# CONFIG_HAVE_DMA_ATTRS is not set
90# CONFIG_USE_GENERIC_SMP_HELPERS is not set
91CONFIG_HAVE_CLK=y
92CONFIG_PROC_PAGE_MONITOR=y
78CONFIG_SLABINFO=y 93CONFIG_SLABINFO=y
79CONFIG_RT_MUTEXES=y 94CONFIG_RT_MUTEXES=y
80# CONFIG_TINY_SHMEM is not set 95# CONFIG_TINY_SHMEM is not set
81CONFIG_BASE_SMALL=0 96CONFIG_BASE_SMALL=0
82CONFIG_MODULES=y 97CONFIG_MODULES=y
98# CONFIG_MODULE_FORCE_LOAD is not set
83CONFIG_MODULE_UNLOAD=y 99CONFIG_MODULE_UNLOAD=y
84CONFIG_MODULE_FORCE_UNLOAD=y 100CONFIG_MODULE_FORCE_UNLOAD=y
85# CONFIG_MODVERSIONS is not set 101# CONFIG_MODVERSIONS is not set
@@ -90,6 +106,7 @@ CONFIG_LBD=y
90# CONFIG_BLK_DEV_IO_TRACE is not set 106# CONFIG_BLK_DEV_IO_TRACE is not set
91# CONFIG_LSF is not set 107# CONFIG_LSF is not set
92# CONFIG_BLK_DEV_BSG is not set 108# CONFIG_BLK_DEV_BSG is not set
109# CONFIG_BLK_DEV_INTEGRITY is not set
93 110
94# 111#
95# IO Schedulers 112# IO Schedulers
@@ -103,6 +120,7 @@ CONFIG_DEFAULT_AS=y
103# CONFIG_DEFAULT_CFQ is not set 120# CONFIG_DEFAULT_CFQ is not set
104# CONFIG_DEFAULT_NOOP is not set 121# CONFIG_DEFAULT_NOOP is not set
105CONFIG_DEFAULT_IOSCHED="anticipatory" 122CONFIG_DEFAULT_IOSCHED="anticipatory"
123CONFIG_CLASSIC_RCU=y
106 124
107# 125#
108# System type 126# System type
@@ -113,6 +131,7 @@ CONFIG_CPU_SH4A=y
113# CONFIG_CPU_SUBTYPE_SH7203 is not set 131# CONFIG_CPU_SUBTYPE_SH7203 is not set
114# CONFIG_CPU_SUBTYPE_SH7206 is not set 132# CONFIG_CPU_SUBTYPE_SH7206 is not set
115# CONFIG_CPU_SUBTYPE_SH7263 is not set 133# CONFIG_CPU_SUBTYPE_SH7263 is not set
134# CONFIG_CPU_SUBTYPE_MXG is not set
116# CONFIG_CPU_SUBTYPE_SH7705 is not set 135# CONFIG_CPU_SUBTYPE_SH7705 is not set
117# CONFIG_CPU_SUBTYPE_SH7706 is not set 136# CONFIG_CPU_SUBTYPE_SH7706 is not set
118# CONFIG_CPU_SUBTYPE_SH7707 is not set 137# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -130,6 +149,7 @@ CONFIG_CPU_SH4A=y
130# CONFIG_CPU_SUBTYPE_SH7751R is not set 149# CONFIG_CPU_SUBTYPE_SH7751R is not set
131# CONFIG_CPU_SUBTYPE_SH7760 is not set 150# CONFIG_CPU_SUBTYPE_SH7760 is not set
132# CONFIG_CPU_SUBTYPE_SH4_202 is not set 151# CONFIG_CPU_SUBTYPE_SH4_202 is not set
152# CONFIG_CPU_SUBTYPE_SH7723 is not set
133# CONFIG_CPU_SUBTYPE_SH7763 is not set 153# CONFIG_CPU_SUBTYPE_SH7763 is not set
134# CONFIG_CPU_SUBTYPE_SH7770 is not set 154# CONFIG_CPU_SUBTYPE_SH7770 is not set
135CONFIG_CPU_SUBTYPE_SH7780=y 155CONFIG_CPU_SUBTYPE_SH7780=y
@@ -137,6 +157,7 @@ CONFIG_CPU_SUBTYPE_SH7780=y
137# CONFIG_CPU_SUBTYPE_SHX3 is not set 157# CONFIG_CPU_SUBTYPE_SHX3 is not set
138# CONFIG_CPU_SUBTYPE_SH7343 is not set 158# CONFIG_CPU_SUBTYPE_SH7343 is not set
139# CONFIG_CPU_SUBTYPE_SH7722 is not set 159# CONFIG_CPU_SUBTYPE_SH7722 is not set
160# CONFIG_CPU_SUBTYPE_SH7366 is not set
140# CONFIG_CPU_SUBTYPE_SH5_101 is not set 161# CONFIG_CPU_SUBTYPE_SH5_101 is not set
141# CONFIG_CPU_SUBTYPE_SH5_103 is not set 162# CONFIG_CPU_SUBTYPE_SH5_103 is not set
142 163
@@ -159,7 +180,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
159CONFIG_ARCH_SELECT_MEMORY_MODEL=y 180CONFIG_ARCH_SELECT_MEMORY_MODEL=y
160CONFIG_PAGE_SIZE_4KB=y 181CONFIG_PAGE_SIZE_4KB=y
161# CONFIG_PAGE_SIZE_8KB is not set 182# CONFIG_PAGE_SIZE_8KB is not set
183# CONFIG_PAGE_SIZE_16KB is not set
162# CONFIG_PAGE_SIZE_64KB is not set 184# CONFIG_PAGE_SIZE_64KB is not set
185CONFIG_ENTRY_OFFSET=0x00001000
163CONFIG_HUGETLB_PAGE_SIZE_64K=y 186CONFIG_HUGETLB_PAGE_SIZE_64K=y
164# CONFIG_HUGETLB_PAGE_SIZE_256K is not set 187# CONFIG_HUGETLB_PAGE_SIZE_256K is not set
165# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set 188# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
@@ -174,6 +197,7 @@ CONFIG_FLATMEM=y
174CONFIG_FLAT_NODE_MEM_MAP=y 197CONFIG_FLAT_NODE_MEM_MAP=y
175CONFIG_SPARSEMEM_STATIC=y 198CONFIG_SPARSEMEM_STATIC=y
176# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set 199# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
200CONFIG_PAGEFLAGS_EXTENDED=y
177CONFIG_SPLIT_PTLOCK_CPUS=4 201CONFIG_SPLIT_PTLOCK_CPUS=4
178CONFIG_RESOURCES_64BIT=y 202CONFIG_RESOURCES_64BIT=y
179CONFIG_ZONE_DMA_FLAG=0 203CONFIG_ZONE_DMA_FLAG=0
@@ -205,7 +229,6 @@ CONFIG_CPU_HAS_FPU=y
205# CONFIG_SH_7780_SOLUTION_ENGINE is not set 229# CONFIG_SH_7780_SOLUTION_ENGINE is not set
206CONFIG_SH_SDK7780=y 230CONFIG_SH_SDK7780=y
207# CONFIG_SH_HIGHLANDER is not set 231# CONFIG_SH_HIGHLANDER is not set
208# CONFIG_SH_SDK7780_STANDALONE is not set
209CONFIG_SH_SDK7780_BASE=y 232CONFIG_SH_SDK7780_BASE=y
210 233
211# 234#
@@ -250,12 +273,13 @@ CONFIG_HZ_250=y
250# CONFIG_HZ_300 is not set 273# CONFIG_HZ_300 is not set
251# CONFIG_HZ_1000 is not set 274# CONFIG_HZ_1000 is not set
252CONFIG_HZ=250 275CONFIG_HZ=250
276# CONFIG_SCHED_HRTICK is not set
253# CONFIG_KEXEC is not set 277# CONFIG_KEXEC is not set
254# CONFIG_CRASH_DUMP is not set 278# CONFIG_CRASH_DUMP is not set
255# CONFIG_PREEMPT_NONE is not set 279# CONFIG_PREEMPT_NONE is not set
256# CONFIG_PREEMPT_VOLUNTARY is not set 280# CONFIG_PREEMPT_VOLUNTARY is not set
257CONFIG_PREEMPT=y 281CONFIG_PREEMPT=y
258CONFIG_PREEMPT_BKL=y 282# CONFIG_PREEMPT_RCU is not set
259CONFIG_GUSA=y 283CONFIG_GUSA=y
260 284
261# 285#
@@ -321,6 +345,7 @@ CONFIG_XFRM=y
321# CONFIG_XFRM_USER is not set 345# CONFIG_XFRM_USER is not set
322# CONFIG_XFRM_SUB_POLICY is not set 346# CONFIG_XFRM_SUB_POLICY is not set
323# CONFIG_XFRM_MIGRATE is not set 347# CONFIG_XFRM_MIGRATE is not set
348# CONFIG_XFRM_STATISTICS is not set
324# CONFIG_NET_KEY is not set 349# CONFIG_NET_KEY is not set
325CONFIG_INET=y 350CONFIG_INET=y
326CONFIG_IP_MULTICAST=y 351CONFIG_IP_MULTICAST=y
@@ -370,8 +395,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
370# CONFIG_INET6_XFRM_MODE_BEET is not set 395# CONFIG_INET6_XFRM_MODE_BEET is not set
371# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set 396# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
372CONFIG_IPV6_SIT=y 397CONFIG_IPV6_SIT=y
398CONFIG_IPV6_NDISC_NODETYPE=y
373# CONFIG_IPV6_TUNNEL is not set 399# CONFIG_IPV6_TUNNEL is not set
374# CONFIG_IPV6_MULTIPLE_TABLES is not set 400# CONFIG_IPV6_MULTIPLE_TABLES is not set
401# CONFIG_IPV6_MROUTE is not set
375# CONFIG_NETWORK_SECMARK is not set 402# CONFIG_NETWORK_SECMARK is not set
376# CONFIG_NETFILTER is not set 403# CONFIG_NETFILTER is not set
377# CONFIG_IP_DCCP is not set 404# CONFIG_IP_DCCP is not set
@@ -397,7 +424,6 @@ CONFIG_NET_SCHED=y
397# CONFIG_NET_SCH_HTB is not set 424# CONFIG_NET_SCH_HTB is not set
398# CONFIG_NET_SCH_HFSC is not set 425# CONFIG_NET_SCH_HFSC is not set
399# CONFIG_NET_SCH_PRIO is not set 426# CONFIG_NET_SCH_PRIO is not set
400# CONFIG_NET_SCH_RR is not set
401# CONFIG_NET_SCH_RED is not set 427# CONFIG_NET_SCH_RED is not set
402# CONFIG_NET_SCH_SFQ is not set 428# CONFIG_NET_SCH_SFQ is not set
403# CONFIG_NET_SCH_TEQL is not set 429# CONFIG_NET_SCH_TEQL is not set
@@ -405,7 +431,6 @@ CONFIG_NET_SCHED=y
405# CONFIG_NET_SCH_GRED is not set 431# CONFIG_NET_SCH_GRED is not set
406# CONFIG_NET_SCH_DSMARK is not set 432# CONFIG_NET_SCH_DSMARK is not set
407# CONFIG_NET_SCH_NETEM is not set 433# CONFIG_NET_SCH_NETEM is not set
408# CONFIG_NET_SCH_INGRESS is not set
409 434
410# 435#
411# Classification 436# Classification
@@ -417,9 +442,9 @@ CONFIG_NET_SCHED=y
417# CONFIG_NET_CLS_U32 is not set 442# CONFIG_NET_CLS_U32 is not set
418# CONFIG_NET_CLS_RSVP is not set 443# CONFIG_NET_CLS_RSVP is not set
419# CONFIG_NET_CLS_RSVP6 is not set 444# CONFIG_NET_CLS_RSVP6 is not set
445# CONFIG_NET_CLS_FLOW is not set
420# CONFIG_NET_EMATCH is not set 446# CONFIG_NET_EMATCH is not set
421# CONFIG_NET_CLS_ACT is not set 447# CONFIG_NET_CLS_ACT is not set
422# CONFIG_NET_CLS_POLICE is not set
423CONFIG_NET_SCH_FIFO=y 448CONFIG_NET_SCH_FIFO=y
424 449
425# 450#
@@ -427,6 +452,7 @@ CONFIG_NET_SCH_FIFO=y
427# 452#
428# CONFIG_NET_PKTGEN is not set 453# CONFIG_NET_PKTGEN is not set
429# CONFIG_HAMRADIO is not set 454# CONFIG_HAMRADIO is not set
455# CONFIG_CAN is not set
430# CONFIG_IRDA is not set 456# CONFIG_IRDA is not set
431# CONFIG_BT is not set 457# CONFIG_BT is not set
432# CONFIG_AF_RXRPC is not set 458# CONFIG_AF_RXRPC is not set
@@ -452,6 +478,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
452CONFIG_STANDALONE=y 478CONFIG_STANDALONE=y
453CONFIG_PREVENT_FIRMWARE_BUILD=y 479CONFIG_PREVENT_FIRMWARE_BUILD=y
454CONFIG_FW_LOADER=y 480CONFIG_FW_LOADER=y
481CONFIG_FIRMWARE_IN_KERNEL=y
482CONFIG_EXTRA_FIRMWARE=""
455# CONFIG_DEBUG_DRIVER is not set 483# CONFIG_DEBUG_DRIVER is not set
456# CONFIG_DEBUG_DEVRES is not set 484# CONFIG_DEBUG_DEVRES is not set
457# CONFIG_SYS_HYPERVISOR is not set 485# CONFIG_SYS_HYPERVISOR is not set
@@ -475,16 +503,18 @@ CONFIG_BLK_DEV_LOOP=y
475CONFIG_BLK_DEV_RAM=y 503CONFIG_BLK_DEV_RAM=y
476CONFIG_BLK_DEV_RAM_COUNT=16 504CONFIG_BLK_DEV_RAM_COUNT=16
477CONFIG_BLK_DEV_RAM_SIZE=4096 505CONFIG_BLK_DEV_RAM_SIZE=4096
478CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 506# CONFIG_BLK_DEV_XIP is not set
479# CONFIG_CDROM_PKTCDVD is not set 507# CONFIG_CDROM_PKTCDVD is not set
480# CONFIG_ATA_OVER_ETH is not set 508# CONFIG_ATA_OVER_ETH is not set
509# CONFIG_BLK_DEV_HD is not set
481# CONFIG_MISC_DEVICES is not set 510# CONFIG_MISC_DEVICES is not set
511CONFIG_HAVE_IDE=y
482CONFIG_IDE=y 512CONFIG_IDE=y
483CONFIG_IDE_MAX_HWIFS=4 513CONFIG_IDE_MAX_HWIFS=4
484CONFIG_BLK_DEV_IDE=y 514CONFIG_BLK_DEV_IDE=y
485 515
486# 516#
487# Please see Documentation/ide.txt for help/info on IDE drives 517# Please see Documentation/ide/ide.txt for help/info on IDE drives
488# 518#
489# CONFIG_BLK_DEV_IDE_SATA is not set 519# CONFIG_BLK_DEV_IDE_SATA is not set
490CONFIG_BLK_DEV_IDEDISK=y 520CONFIG_BLK_DEV_IDEDISK=y
@@ -492,6 +522,7 @@ CONFIG_IDEDISK_MULTI_MODE=y
492# CONFIG_BLK_DEV_IDECS is not set 522# CONFIG_BLK_DEV_IDECS is not set
493# CONFIG_BLK_DEV_DELKIN is not set 523# CONFIG_BLK_DEV_DELKIN is not set
494CONFIG_BLK_DEV_IDECD=y 524CONFIG_BLK_DEV_IDECD=y
525CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
495# CONFIG_BLK_DEV_IDETAPE is not set 526# CONFIG_BLK_DEV_IDETAPE is not set
496# CONFIG_BLK_DEV_IDEFLOPPY is not set 527# CONFIG_BLK_DEV_IDEFLOPPY is not set
497# CONFIG_BLK_DEV_IDESCSI is not set 528# CONFIG_BLK_DEV_IDESCSI is not set
@@ -501,14 +532,12 @@ CONFIG_IDE_PROC_FS=y
501# 532#
502# IDE chipset support/bugfixes 533# IDE chipset support/bugfixes
503# 534#
504CONFIG_IDE_GENERIC=y
505CONFIG_BLK_DEV_PLATFORM=y 535CONFIG_BLK_DEV_PLATFORM=y
506 536
507# 537#
508# PCI IDE chipsets support 538# PCI IDE chipsets support
509# 539#
510CONFIG_BLK_DEV_IDEPCI=y 540CONFIG_BLK_DEV_IDEPCI=y
511# CONFIG_IDEPCI_SHARE_IRQ is not set
512CONFIG_IDEPCI_PCIBUS_ORDER=y 541CONFIG_IDEPCI_PCIBUS_ORDER=y
513# CONFIG_BLK_DEV_OFFBOARD is not set 542# CONFIG_BLK_DEV_OFFBOARD is not set
514CONFIG_BLK_DEV_GENERIC=y 543CONFIG_BLK_DEV_GENERIC=y
@@ -518,10 +547,8 @@ CONFIG_BLK_DEV_GENERIC=y
518# CONFIG_BLK_DEV_AMD74XX is not set 547# CONFIG_BLK_DEV_AMD74XX is not set
519# CONFIG_BLK_DEV_CMD64X is not set 548# CONFIG_BLK_DEV_CMD64X is not set
520# CONFIG_BLK_DEV_TRIFLEX is not set 549# CONFIG_BLK_DEV_TRIFLEX is not set
521# CONFIG_BLK_DEV_CY82C693 is not set
522# CONFIG_BLK_DEV_CS5520 is not set 550# CONFIG_BLK_DEV_CS5520 is not set
523# CONFIG_BLK_DEV_CS5530 is not set 551# CONFIG_BLK_DEV_CS5530 is not set
524# CONFIG_BLK_DEV_HPT34X is not set
525# CONFIG_BLK_DEV_HPT366 is not set 552# CONFIG_BLK_DEV_HPT366 is not set
526# CONFIG_BLK_DEV_JMICRON is not set 553# CONFIG_BLK_DEV_JMICRON is not set
527# CONFIG_BLK_DEV_SC1200 is not set 554# CONFIG_BLK_DEV_SC1200 is not set
@@ -537,10 +564,7 @@ CONFIG_BLK_DEV_GENERIC=y
537# CONFIG_BLK_DEV_TRM290 is not set 564# CONFIG_BLK_DEV_TRM290 is not set
538# CONFIG_BLK_DEV_VIA82CXXX is not set 565# CONFIG_BLK_DEV_VIA82CXXX is not set
539# CONFIG_BLK_DEV_TC86C001 is not set 566# CONFIG_BLK_DEV_TC86C001 is not set
540# CONFIG_IDE_ARM is not set
541# CONFIG_BLK_DEV_IDEDMA is not set 567# CONFIG_BLK_DEV_IDEDMA is not set
542# CONFIG_IDE_ARCH_OBSOLETE_INIT is not set
543# CONFIG_BLK_DEV_HD is not set
544 568
545# 569#
546# SCSI device support 570# SCSI device support
@@ -600,6 +624,7 @@ CONFIG_SCSI_LOWLEVEL=y
600# CONFIG_SCSI_IPS is not set 624# CONFIG_SCSI_IPS is not set
601# CONFIG_SCSI_INITIO is not set 625# CONFIG_SCSI_INITIO is not set
602# CONFIG_SCSI_INIA100 is not set 626# CONFIG_SCSI_INIA100 is not set
627# CONFIG_SCSI_MVSAS is not set
603# CONFIG_SCSI_STEX is not set 628# CONFIG_SCSI_STEX is not set
604# CONFIG_SCSI_SYM53C8XX_2 is not set 629# CONFIG_SCSI_SYM53C8XX_2 is not set
605# CONFIG_SCSI_IPR is not set 630# CONFIG_SCSI_IPR is not set
@@ -613,9 +638,13 @@ CONFIG_SCSI_LOWLEVEL=y
613# CONFIG_SCSI_DEBUG is not set 638# CONFIG_SCSI_DEBUG is not set
614# CONFIG_SCSI_SRP is not set 639# CONFIG_SCSI_SRP is not set
615# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set 640# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
641# CONFIG_SCSI_DH is not set
616CONFIG_ATA=y 642CONFIG_ATA=y
617# CONFIG_ATA_NONSTANDARD is not set 643# CONFIG_ATA_NONSTANDARD is not set
644CONFIG_SATA_PMP=y
618# CONFIG_SATA_AHCI is not set 645# CONFIG_SATA_AHCI is not set
646# CONFIG_SATA_SIL24 is not set
647CONFIG_ATA_SFF=y
619# CONFIG_SATA_SVW is not set 648# CONFIG_SATA_SVW is not set
620# CONFIG_ATA_PIIX is not set 649# CONFIG_ATA_PIIX is not set
621# CONFIG_SATA_MV is not set 650# CONFIG_SATA_MV is not set
@@ -625,7 +654,6 @@ CONFIG_ATA=y
625# CONFIG_SATA_PROMISE is not set 654# CONFIG_SATA_PROMISE is not set
626# CONFIG_SATA_SX4 is not set 655# CONFIG_SATA_SX4 is not set
627# CONFIG_SATA_SIL is not set 656# CONFIG_SATA_SIL is not set
628# CONFIG_SATA_SIL24 is not set
629# CONFIG_SATA_SIS is not set 657# CONFIG_SATA_SIS is not set
630# CONFIG_SATA_ULI is not set 658# CONFIG_SATA_ULI is not set
631# CONFIG_SATA_VIA is not set 659# CONFIG_SATA_VIA is not set
@@ -654,6 +682,7 @@ CONFIG_ATA=y
654# CONFIG_PATA_MPIIX is not set 682# CONFIG_PATA_MPIIX is not set
655# CONFIG_PATA_OLDPIIX is not set 683# CONFIG_PATA_OLDPIIX is not set
656# CONFIG_PATA_NETCELL is not set 684# CONFIG_PATA_NETCELL is not set
685# CONFIG_PATA_NINJA32 is not set
657# CONFIG_PATA_NS87410 is not set 686# CONFIG_PATA_NS87410 is not set
658# CONFIG_PATA_NS87415 is not set 687# CONFIG_PATA_NS87415 is not set
659# CONFIG_PATA_OPTI is not set 688# CONFIG_PATA_OPTI is not set
@@ -670,6 +699,7 @@ CONFIG_ATA=y
670# CONFIG_PATA_VIA is not set 699# CONFIG_PATA_VIA is not set
671# CONFIG_PATA_WINBOND is not set 700# CONFIG_PATA_WINBOND is not set
672# CONFIG_PATA_PLATFORM is not set 701# CONFIG_PATA_PLATFORM is not set
702# CONFIG_PATA_SCH is not set
673CONFIG_MD=y 703CONFIG_MD=y
674# CONFIG_BLK_DEV_MD is not set 704# CONFIG_BLK_DEV_MD is not set
675CONFIG_BLK_DEV_DM=y 705CONFIG_BLK_DEV_DM=y
@@ -686,11 +716,14 @@ CONFIG_BLK_DEV_DM=y
686# 716#
687# IEEE 1394 (FireWire) support 717# IEEE 1394 (FireWire) support
688# 718#
719
720#
721# Enable only one of the two stacks, unless you know what you are doing
722#
689# CONFIG_FIREWIRE is not set 723# CONFIG_FIREWIRE is not set
690# CONFIG_IEEE1394 is not set 724# CONFIG_IEEE1394 is not set
691# CONFIG_I2O is not set 725# CONFIG_I2O is not set
692CONFIG_NETDEVICES=y 726CONFIG_NETDEVICES=y
693# CONFIG_NETDEVICES_MULTIQUEUE is not set
694# CONFIG_DUMMY is not set 727# CONFIG_DUMMY is not set
695# CONFIG_BONDING is not set 728# CONFIG_BONDING is not set
696# CONFIG_MACVLAN is not set 729# CONFIG_MACVLAN is not set
@@ -708,6 +741,7 @@ CONFIG_MII=y
708# CONFIG_CASSINI is not set 741# CONFIG_CASSINI is not set
709# CONFIG_NET_VENDOR_3COM is not set 742# CONFIG_NET_VENDOR_3COM is not set
710CONFIG_SMC91X=y 743CONFIG_SMC91X=y
744# CONFIG_SMC911X is not set
711# CONFIG_NET_TULIP is not set 745# CONFIG_NET_TULIP is not set
712# CONFIG_HP100 is not set 746# CONFIG_HP100 is not set
713# CONFIG_IBM_NEW_EMAC_ZMII is not set 747# CONFIG_IBM_NEW_EMAC_ZMII is not set
@@ -726,6 +760,7 @@ CONFIG_SMC91X=y
726# 760#
727# CONFIG_WLAN_PRE80211 is not set 761# CONFIG_WLAN_PRE80211 is not set
728# CONFIG_WLAN_80211 is not set 762# CONFIG_WLAN_80211 is not set
763# CONFIG_IWLWIFI_LEDS is not set
729 764
730# 765#
731# USB Network Adapters 766# USB Network Adapters
@@ -743,7 +778,6 @@ CONFIG_SMC91X=y
743# CONFIG_PPP is not set 778# CONFIG_PPP is not set
744# CONFIG_SLIP is not set 779# CONFIG_SLIP is not set
745# CONFIG_NET_FC is not set 780# CONFIG_NET_FC is not set
746# CONFIG_SHAPER is not set
747CONFIG_NETCONSOLE=y 781CONFIG_NETCONSOLE=y
748# CONFIG_NETCONSOLE_DYNAMIC is not set 782# CONFIG_NETCONSOLE_DYNAMIC is not set
749CONFIG_NETPOLL=y 783CONFIG_NETPOLL=y
@@ -780,6 +814,7 @@ CONFIG_KEYBOARD_ATKBD=y
780# CONFIG_KEYBOARD_XTKBD is not set 814# CONFIG_KEYBOARD_XTKBD is not set
781# CONFIG_KEYBOARD_NEWTON is not set 815# CONFIG_KEYBOARD_NEWTON is not set
782# CONFIG_KEYBOARD_STOWAWAY is not set 816# CONFIG_KEYBOARD_STOWAWAY is not set
817# CONFIG_KEYBOARD_SH_KEYSC is not set
783CONFIG_INPUT_MOUSE=y 818CONFIG_INPUT_MOUSE=y
784CONFIG_MOUSE_PS2=y 819CONFIG_MOUSE_PS2=y
785CONFIG_MOUSE_PS2_ALPS=y 820CONFIG_MOUSE_PS2_ALPS=y
@@ -812,10 +847,13 @@ CONFIG_SERIO_LIBPS2=y
812# Character devices 847# Character devices
813# 848#
814CONFIG_VT=y 849CONFIG_VT=y
850CONFIG_CONSOLE_TRANSLATIONS=y
815CONFIG_VT_CONSOLE=y 851CONFIG_VT_CONSOLE=y
816CONFIG_HW_CONSOLE=y 852CONFIG_HW_CONSOLE=y
817# CONFIG_VT_HW_CONSOLE_BINDING is not set 853# CONFIG_VT_HW_CONSOLE_BINDING is not set
854CONFIG_DEVKMEM=y
818# CONFIG_SERIAL_NONSTANDARD is not set 855# CONFIG_SERIAL_NONSTANDARD is not set
856# CONFIG_NOZOMI is not set
819 857
820# 858#
821# Serial drivers 859# Serial drivers
@@ -847,22 +885,20 @@ CONFIG_HW_RANDOM=y
847# CONFIG_SYNCLINK_CS is not set 885# CONFIG_SYNCLINK_CS is not set
848# CONFIG_CARDMAN_4000 is not set 886# CONFIG_CARDMAN_4000 is not set
849# CONFIG_CARDMAN_4040 is not set 887# CONFIG_CARDMAN_4040 is not set
888# CONFIG_IPWIRELESS is not set
850# CONFIG_RAW_DRIVER is not set 889# CONFIG_RAW_DRIVER is not set
851# CONFIG_TCG_TPM is not set 890# CONFIG_TCG_TPM is not set
852CONFIG_DEVPORT=y 891CONFIG_DEVPORT=y
853# CONFIG_I2C is not set 892# CONFIG_I2C is not set
854
855#
856# SPI support
857#
858# CONFIG_SPI is not set 893# CONFIG_SPI is not set
859# CONFIG_SPI_MASTER is not set
860# CONFIG_W1 is not set 894# CONFIG_W1 is not set
861CONFIG_POWER_SUPPLY=y 895CONFIG_POWER_SUPPLY=y
862# CONFIG_POWER_SUPPLY_DEBUG is not set 896# CONFIG_POWER_SUPPLY_DEBUG is not set
863# CONFIG_PDA_POWER is not set 897# CONFIG_PDA_POWER is not set
864# CONFIG_BATTERY_DS2760 is not set 898# CONFIG_BATTERY_DS2760 is not set
865# CONFIG_HWMON is not set 899# CONFIG_HWMON is not set
900# CONFIG_THERMAL is not set
901# CONFIG_THERMAL_HWMON is not set
866# CONFIG_WATCHDOG is not set 902# CONFIG_WATCHDOG is not set
867 903
868# 904#
@@ -870,8 +906,10 @@ CONFIG_POWER_SUPPLY=y
870# 906#
871CONFIG_SSB_POSSIBLE=y 907CONFIG_SSB_POSSIBLE=y
872CONFIG_SSB=y 908CONFIG_SSB=y
909CONFIG_SSB_SPROM=y
873CONFIG_SSB_PCIHOST_POSSIBLE=y 910CONFIG_SSB_PCIHOST_POSSIBLE=y
874CONFIG_SSB_PCIHOST=y 911CONFIG_SSB_PCIHOST=y
912# CONFIG_SSB_B43_PCI_BRIDGE is not set
875CONFIG_SSB_PCMCIAHOST_POSSIBLE=y 913CONFIG_SSB_PCMCIAHOST_POSSIBLE=y
876# CONFIG_SSB_PCMCIAHOST is not set 914# CONFIG_SSB_PCMCIAHOST is not set
877# CONFIG_SSB_SILENT is not set 915# CONFIG_SSB_SILENT is not set
@@ -882,13 +920,24 @@ CONFIG_SSB_DRIVER_PCICORE=y
882# 920#
883# Multifunction device drivers 921# Multifunction device drivers
884# 922#
923# CONFIG_MFD_CORE is not set
885# CONFIG_MFD_SM501 is not set 924# CONFIG_MFD_SM501 is not set
925# CONFIG_HTC_PASIC3 is not set
886 926
887# 927#
888# Multimedia devices 928# Multimedia devices
889# 929#
930
931#
932# Multimedia core support
933#
890# CONFIG_VIDEO_DEV is not set 934# CONFIG_VIDEO_DEV is not set
891# CONFIG_DVB_CORE is not set 935# CONFIG_DVB_CORE is not set
936# CONFIG_VIDEO_MEDIA is not set
937
938#
939# Multimedia drivers
940#
892# CONFIG_DAB is not set 941# CONFIG_DAB is not set
893 942
894# 943#
@@ -900,15 +949,15 @@ CONFIG_SSB_DRIVER_PCICORE=y
900CONFIG_FB=y 949CONFIG_FB=y
901# CONFIG_FIRMWARE_EDID is not set 950# CONFIG_FIRMWARE_EDID is not set
902# CONFIG_FB_DDC is not set 951# CONFIG_FB_DDC is not set
903# CONFIG_FB_CFB_FILLRECT is not set 952CONFIG_FB_CFB_FILLRECT=m
904# CONFIG_FB_CFB_COPYAREA is not set 953CONFIG_FB_CFB_COPYAREA=m
905# CONFIG_FB_CFB_IMAGEBLIT is not set 954CONFIG_FB_CFB_IMAGEBLIT=m
906# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set 955# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
907# CONFIG_FB_SYS_FILLRECT is not set 956# CONFIG_FB_SYS_FILLRECT is not set
908# CONFIG_FB_SYS_COPYAREA is not set 957# CONFIG_FB_SYS_COPYAREA is not set
909# CONFIG_FB_SYS_IMAGEBLIT is not set 958# CONFIG_FB_SYS_IMAGEBLIT is not set
959# CONFIG_FB_FOREIGN_ENDIAN is not set
910# CONFIG_FB_SYS_FOPS is not set 960# CONFIG_FB_SYS_FOPS is not set
911CONFIG_FB_DEFERRED_IO=y
912# CONFIG_FB_SVGALIB is not set 961# CONFIG_FB_SVGALIB is not set
913# CONFIG_FB_MACMODES is not set 962# CONFIG_FB_MACMODES is not set
914# CONFIG_FB_BACKLIGHT is not set 963# CONFIG_FB_BACKLIGHT is not set
@@ -941,6 +990,8 @@ CONFIG_FB_DEFERRED_IO=y
941# CONFIG_FB_TRIDENT is not set 990# CONFIG_FB_TRIDENT is not set
942# CONFIG_FB_ARK is not set 991# CONFIG_FB_ARK is not set
943# CONFIG_FB_PM3 is not set 992# CONFIG_FB_PM3 is not set
993# CONFIG_FB_CARMINE is not set
994CONFIG_FB_SH_MOBILE_LCDC=m
944# CONFIG_FB_VIRTUAL is not set 995# CONFIG_FB_VIRTUAL is not set
945# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 996# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
946 997
@@ -970,24 +1021,9 @@ CONFIG_LOGO_LINUX_CLUT224=y
970CONFIG_LOGO_SUPERH_MONO=y 1021CONFIG_LOGO_SUPERH_MONO=y
971CONFIG_LOGO_SUPERH_VGA16=y 1022CONFIG_LOGO_SUPERH_VGA16=y
972CONFIG_LOGO_SUPERH_CLUT224=y 1023CONFIG_LOGO_SUPERH_CLUT224=y
973
974#
975# Sound
976#
977CONFIG_SOUND=y 1024CONFIG_SOUND=y
978
979#
980# Advanced Linux Sound Architecture
981#
982# CONFIG_SND is not set 1025# CONFIG_SND is not set
983
984#
985# Open Sound System
986#
987CONFIG_SOUND_PRIME=y 1026CONFIG_SOUND_PRIME=y
988# CONFIG_SOUND_TRIDENT is not set
989# CONFIG_SOUND_MSNDCLAS is not set
990# CONFIG_SOUND_MSNDPIN is not set
991CONFIG_HID_SUPPORT=y 1027CONFIG_HID_SUPPORT=y
992CONFIG_HID=y 1028CONFIG_HID=y
993# CONFIG_HID_DEBUG is not set 1029# CONFIG_HID_DEBUG is not set
@@ -1006,6 +1042,7 @@ CONFIG_USB_ARCH_HAS_OHCI=y
1006CONFIG_USB_ARCH_HAS_EHCI=y 1042CONFIG_USB_ARCH_HAS_EHCI=y
1007CONFIG_USB=y 1043CONFIG_USB=y
1008CONFIG_USB_DEBUG=y 1044CONFIG_USB_DEBUG=y
1045# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1009 1046
1010# 1047#
1011# Miscellaneous USB options 1048# Miscellaneous USB options
@@ -1014,15 +1051,18 @@ CONFIG_USB_DEVICEFS=y
1014# CONFIG_USB_DEVICE_CLASS is not set 1051# CONFIG_USB_DEVICE_CLASS is not set
1015# CONFIG_USB_DYNAMIC_MINORS is not set 1052# CONFIG_USB_DYNAMIC_MINORS is not set
1016# CONFIG_USB_OTG is not set 1053# CONFIG_USB_OTG is not set
1054# CONFIG_USB_OTG_WHITELIST is not set
1055# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1017 1056
1018# 1057#
1019# USB Host Controller Drivers 1058# USB Host Controller Drivers
1020# 1059#
1060# CONFIG_USB_C67X00_HCD is not set
1021CONFIG_USB_EHCI_HCD=y 1061CONFIG_USB_EHCI_HCD=y
1022# CONFIG_USB_EHCI_SPLIT_ISO is not set
1023# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 1062# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1024# CONFIG_USB_EHCI_TT_NEWSCHED is not set 1063# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1025# CONFIG_USB_ISP116X_HCD is not set 1064# CONFIG_USB_ISP116X_HCD is not set
1065# CONFIG_USB_ISP1760_HCD is not set
1026# CONFIG_USB_OHCI_HCD is not set 1066# CONFIG_USB_OHCI_HCD is not set
1027# CONFIG_USB_UHCI_HCD is not set 1067# CONFIG_USB_UHCI_HCD is not set
1028# CONFIG_USB_SL811_HCD is not set 1068# CONFIG_USB_SL811_HCD is not set
@@ -1033,6 +1073,7 @@ CONFIG_USB_EHCI_HCD=y
1033# 1073#
1034# CONFIG_USB_ACM is not set 1074# CONFIG_USB_ACM is not set
1035CONFIG_USB_PRINTER=y 1075CONFIG_USB_PRINTER=y
1076# CONFIG_USB_WDM is not set
1036 1077
1037# 1078#
1038# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1079# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1054,6 +1095,7 @@ CONFIG_USB_STORAGE=y
1054# CONFIG_USB_STORAGE_ALAUDA is not set 1095# CONFIG_USB_STORAGE_ALAUDA is not set
1055# CONFIG_USB_STORAGE_ONETOUCH is not set 1096# CONFIG_USB_STORAGE_ONETOUCH is not set
1056# CONFIG_USB_STORAGE_KARMA is not set 1097# CONFIG_USB_STORAGE_KARMA is not set
1098# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1057# CONFIG_USB_LIBUSUAL is not set 1099# CONFIG_USB_LIBUSUAL is not set
1058 1100
1059# 1101#
@@ -1067,10 +1109,6 @@ CONFIG_USB_MON=y
1067# USB port drivers 1109# USB port drivers
1068# 1110#
1069# CONFIG_USB_USS720 is not set 1111# CONFIG_USB_USS720 is not set
1070
1071#
1072# USB Serial Converter support
1073#
1074# CONFIG_USB_SERIAL is not set 1112# CONFIG_USB_SERIAL is not set
1075 1113
1076# 1114#
@@ -1096,16 +1134,10 @@ CONFIG_USB_MON=y
1096# CONFIG_USB_TRANCEVIBRATOR is not set 1134# CONFIG_USB_TRANCEVIBRATOR is not set
1097# CONFIG_USB_IOWARRIOR is not set 1135# CONFIG_USB_IOWARRIOR is not set
1098# CONFIG_USB_TEST is not set 1136# CONFIG_USB_TEST is not set
1099 1137# CONFIG_USB_ISIGHTFW is not set
1100#
1101# USB DSL modem support
1102#
1103
1104#
1105# USB Gadget Support
1106#
1107# CONFIG_USB_GADGET is not set 1138# CONFIG_USB_GADGET is not set
1108# CONFIG_MMC is not set 1139# CONFIG_MMC is not set
1140# CONFIG_MEMSTICK is not set
1109CONFIG_NEW_LEDS=y 1141CONFIG_NEW_LEDS=y
1110CONFIG_LEDS_CLASS=y 1142CONFIG_LEDS_CLASS=y
1111 1143
@@ -1117,13 +1149,11 @@ CONFIG_LEDS_CLASS=y
1117# LED Triggers 1149# LED Triggers
1118# 1150#
1119# CONFIG_LEDS_TRIGGERS is not set 1151# CONFIG_LEDS_TRIGGERS is not set
1152# CONFIG_ACCESSIBILITY is not set
1120# CONFIG_INFINIBAND is not set 1153# CONFIG_INFINIBAND is not set
1121# CONFIG_RTC_CLASS is not set 1154# CONFIG_RTC_CLASS is not set
1155# CONFIG_DMADEVICES is not set
1122# CONFIG_AUXDISPLAY is not set 1156# CONFIG_AUXDISPLAY is not set
1123
1124#
1125# Userspace I/O
1126#
1127# CONFIG_UIO is not set 1157# CONFIG_UIO is not set
1128 1158
1129# 1159#
@@ -1145,14 +1175,11 @@ CONFIG_FS_MBCACHE=y
1145# CONFIG_JFS_FS is not set 1175# CONFIG_JFS_FS is not set
1146CONFIG_FS_POSIX_ACL=y 1176CONFIG_FS_POSIX_ACL=y
1147# CONFIG_XFS_FS is not set 1177# CONFIG_XFS_FS is not set
1148# CONFIG_GFS2_FS is not set
1149# CONFIG_OCFS2_FS is not set 1178# CONFIG_OCFS2_FS is not set
1150CONFIG_MINIX_FS=y 1179CONFIG_DNOTIFY=y
1151# CONFIG_ROMFS_FS is not set
1152CONFIG_INOTIFY=y 1180CONFIG_INOTIFY=y
1153CONFIG_INOTIFY_USER=y 1181CONFIG_INOTIFY_USER=y
1154# CONFIG_QUOTA is not set 1182# CONFIG_QUOTA is not set
1155CONFIG_DNOTIFY=y
1156# CONFIG_AUTOFS_FS is not set 1183# CONFIG_AUTOFS_FS is not set
1157CONFIG_AUTOFS4_FS=y 1184CONFIG_AUTOFS4_FS=y
1158# CONFIG_FUSE_FS is not set 1185# CONFIG_FUSE_FS is not set
@@ -1203,8 +1230,11 @@ CONFIG_HUGETLB_PAGE=y
1203# CONFIG_EFS_FS is not set 1230# CONFIG_EFS_FS is not set
1204# CONFIG_CRAMFS is not set 1231# CONFIG_CRAMFS is not set
1205# CONFIG_VXFS_FS is not set 1232# CONFIG_VXFS_FS is not set
1233CONFIG_MINIX_FS=y
1234# CONFIG_OMFS_FS is not set
1206# CONFIG_HPFS_FS is not set 1235# CONFIG_HPFS_FS is not set
1207# CONFIG_QNX4FS_FS is not set 1236# CONFIG_QNX4FS_FS is not set
1237# CONFIG_ROMFS_FS is not set
1208# CONFIG_SYSV_FS is not set 1238# CONFIG_SYSV_FS is not set
1209# CONFIG_UFS_FS is not set 1239# CONFIG_UFS_FS is not set
1210CONFIG_NETWORK_FILESYSTEMS=y 1240CONFIG_NETWORK_FILESYSTEMS=y
@@ -1212,19 +1242,16 @@ CONFIG_NFS_FS=y
1212CONFIG_NFS_V3=y 1242CONFIG_NFS_V3=y
1213# CONFIG_NFS_V3_ACL is not set 1243# CONFIG_NFS_V3_ACL is not set
1214# CONFIG_NFS_V4 is not set 1244# CONFIG_NFS_V4 is not set
1215# CONFIG_NFS_DIRECTIO is not set 1245CONFIG_ROOT_NFS=y
1216CONFIG_NFSD=y 1246CONFIG_NFSD=y
1217CONFIG_NFSD_V3=y 1247CONFIG_NFSD_V3=y
1218# CONFIG_NFSD_V3_ACL is not set 1248# CONFIG_NFSD_V3_ACL is not set
1219# CONFIG_NFSD_V4 is not set 1249# CONFIG_NFSD_V4 is not set
1220CONFIG_NFSD_TCP=y
1221CONFIG_ROOT_NFS=y
1222CONFIG_LOCKD=y 1250CONFIG_LOCKD=y
1223CONFIG_LOCKD_V4=y 1251CONFIG_LOCKD_V4=y
1224CONFIG_EXPORTFS=y 1252CONFIG_EXPORTFS=y
1225CONFIG_NFS_COMMON=y 1253CONFIG_NFS_COMMON=y
1226CONFIG_SUNRPC=y 1254CONFIG_SUNRPC=y
1227# CONFIG_SUNRPC_BIND34 is not set
1228# CONFIG_RPCSEC_GSS_KRB5 is not set 1255# CONFIG_RPCSEC_GSS_KRB5 is not set
1229# CONFIG_RPCSEC_GSS_SPKM3 is not set 1256# CONFIG_RPCSEC_GSS_SPKM3 is not set
1230# CONFIG_SMB_FS is not set 1257# CONFIG_SMB_FS is not set
@@ -1279,7 +1306,6 @@ CONFIG_NLS_ISO8859_15=y
1279# CONFIG_NLS_KOI8_U is not set 1306# CONFIG_NLS_KOI8_U is not set
1280CONFIG_NLS_UTF8=y 1307CONFIG_NLS_UTF8=y
1281# CONFIG_DLM is not set 1308# CONFIG_DLM is not set
1282# CONFIG_INSTRUMENTATION is not set
1283 1309
1284# 1310#
1285# Kernel hacking 1311# Kernel hacking
@@ -1288,6 +1314,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1288# CONFIG_PRINTK_TIME is not set 1314# CONFIG_PRINTK_TIME is not set
1289CONFIG_ENABLE_WARN_DEPRECATED=y 1315CONFIG_ENABLE_WARN_DEPRECATED=y
1290# CONFIG_ENABLE_MUST_CHECK is not set 1316# CONFIG_ENABLE_MUST_CHECK is not set
1317CONFIG_FRAME_WARN=1024
1291CONFIG_MAGIC_SYSRQ=y 1318CONFIG_MAGIC_SYSRQ=y
1292CONFIG_UNUSED_SYMBOLS=y 1319CONFIG_UNUSED_SYMBOLS=y
1293# CONFIG_DEBUG_FS is not set 1320# CONFIG_DEBUG_FS is not set
@@ -1295,10 +1322,14 @@ CONFIG_UNUSED_SYMBOLS=y
1295CONFIG_DEBUG_KERNEL=y 1322CONFIG_DEBUG_KERNEL=y
1296# CONFIG_DEBUG_SHIRQ is not set 1323# CONFIG_DEBUG_SHIRQ is not set
1297CONFIG_DETECT_SOFTLOCKUP=y 1324CONFIG_DETECT_SOFTLOCKUP=y
1325# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1326CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1298# CONFIG_SCHED_DEBUG is not set 1327# CONFIG_SCHED_DEBUG is not set
1299# CONFIG_SCHEDSTATS is not set 1328# CONFIG_SCHEDSTATS is not set
1300CONFIG_TIMER_STATS=y 1329CONFIG_TIMER_STATS=y
1330# CONFIG_DEBUG_OBJECTS is not set
1301# CONFIG_SLUB_DEBUG_ON is not set 1331# CONFIG_SLUB_DEBUG_ON is not set
1332# CONFIG_SLUB_STATS is not set
1302CONFIG_DEBUG_PREEMPT=y 1333CONFIG_DEBUG_PREEMPT=y
1303# CONFIG_DEBUG_RT_MUTEXES is not set 1334# CONFIG_DEBUG_RT_MUTEXES is not set
1304# CONFIG_RT_MUTEX_TESTER is not set 1335# CONFIG_RT_MUTEX_TESTER is not set
@@ -1313,12 +1344,14 @@ CONFIG_DEBUG_PREEMPT=y
1313CONFIG_DEBUG_BUGVERBOSE=y 1344CONFIG_DEBUG_BUGVERBOSE=y
1314CONFIG_DEBUG_INFO=y 1345CONFIG_DEBUG_INFO=y
1315# CONFIG_DEBUG_VM is not set 1346# CONFIG_DEBUG_VM is not set
1347# CONFIG_DEBUG_WRITECOUNT is not set
1348# CONFIG_DEBUG_MEMORY_INIT is not set
1316# CONFIG_DEBUG_LIST is not set 1349# CONFIG_DEBUG_LIST is not set
1317# CONFIG_DEBUG_SG is not set 1350# CONFIG_DEBUG_SG is not set
1318# CONFIG_FRAME_POINTER is not set 1351# CONFIG_FRAME_POINTER is not set
1319# CONFIG_FORCED_INLINING is not set
1320# CONFIG_BOOT_PRINTK_DELAY is not set 1352# CONFIG_BOOT_PRINTK_DELAY is not set
1321# CONFIG_RCU_TORTURE_TEST is not set 1353# CONFIG_RCU_TORTURE_TEST is not set
1354# CONFIG_BACKTRACE_SELF_TEST is not set
1322# CONFIG_FAULT_INJECTION is not set 1355# CONFIG_FAULT_INJECTION is not set
1323# CONFIG_SAMPLES is not set 1356# CONFIG_SAMPLES is not set
1324CONFIG_SH_STANDARD_BIOS=y 1357CONFIG_SH_STANDARD_BIOS=y
@@ -1338,52 +1371,94 @@ CONFIG_DEBUG_STACKOVERFLOW=y
1338# CONFIG_SECURITY is not set 1371# CONFIG_SECURITY is not set
1339# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1372# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1340CONFIG_CRYPTO=y 1373CONFIG_CRYPTO=y
1374
1375#
1376# Crypto core or helper
1377#
1341CONFIG_CRYPTO_ALGAPI=y 1378CONFIG_CRYPTO_ALGAPI=y
1342# CONFIG_CRYPTO_MANAGER is not set 1379# CONFIG_CRYPTO_MANAGER is not set
1380# CONFIG_CRYPTO_GF128MUL is not set
1381# CONFIG_CRYPTO_NULL is not set
1382# CONFIG_CRYPTO_CRYPTD is not set
1383# CONFIG_CRYPTO_AUTHENC is not set
1384# CONFIG_CRYPTO_TEST is not set
1385
1386#
1387# Authenticated Encryption with Associated Data
1388#
1389# CONFIG_CRYPTO_CCM is not set
1390# CONFIG_CRYPTO_GCM is not set
1391# CONFIG_CRYPTO_SEQIV is not set
1392
1393#
1394# Block modes
1395#
1396# CONFIG_CRYPTO_CBC is not set
1397# CONFIG_CRYPTO_CTR is not set
1398# CONFIG_CRYPTO_CTS is not set
1399# CONFIG_CRYPTO_ECB is not set
1400# CONFIG_CRYPTO_LRW is not set
1401# CONFIG_CRYPTO_PCBC is not set
1402# CONFIG_CRYPTO_XTS is not set
1403
1404#
1405# Hash modes
1406#
1343# CONFIG_CRYPTO_HMAC is not set 1407# CONFIG_CRYPTO_HMAC is not set
1344# CONFIG_CRYPTO_XCBC is not set 1408# CONFIG_CRYPTO_XCBC is not set
1345# CONFIG_CRYPTO_NULL is not set 1409
1410#
1411# Digest
1412#
1413# CONFIG_CRYPTO_CRC32C is not set
1346# CONFIG_CRYPTO_MD4 is not set 1414# CONFIG_CRYPTO_MD4 is not set
1347CONFIG_CRYPTO_MD5=y 1415CONFIG_CRYPTO_MD5=y
1416# CONFIG_CRYPTO_MICHAEL_MIC is not set
1417# CONFIG_CRYPTO_RMD128 is not set
1418# CONFIG_CRYPTO_RMD160 is not set
1419# CONFIG_CRYPTO_RMD256 is not set
1420# CONFIG_CRYPTO_RMD320 is not set
1348# CONFIG_CRYPTO_SHA1 is not set 1421# CONFIG_CRYPTO_SHA1 is not set
1349# CONFIG_CRYPTO_SHA256 is not set 1422# CONFIG_CRYPTO_SHA256 is not set
1350# CONFIG_CRYPTO_SHA512 is not set 1423# CONFIG_CRYPTO_SHA512 is not set
1351# CONFIG_CRYPTO_WP512 is not set
1352# CONFIG_CRYPTO_TGR192 is not set 1424# CONFIG_CRYPTO_TGR192 is not set
1353# CONFIG_CRYPTO_GF128MUL is not set 1425# CONFIG_CRYPTO_WP512 is not set
1354# CONFIG_CRYPTO_ECB is not set 1426
1355# CONFIG_CRYPTO_CBC is not set 1427#
1356# CONFIG_CRYPTO_PCBC is not set 1428# Ciphers
1357# CONFIG_CRYPTO_LRW is not set 1429#
1358# CONFIG_CRYPTO_XTS is not set
1359# CONFIG_CRYPTO_CRYPTD is not set
1360CONFIG_CRYPTO_DES=y
1361# CONFIG_CRYPTO_FCRYPT is not set
1362# CONFIG_CRYPTO_BLOWFISH is not set
1363# CONFIG_CRYPTO_TWOFISH is not set
1364# CONFIG_CRYPTO_SERPENT is not set
1365# CONFIG_CRYPTO_AES is not set 1430# CONFIG_CRYPTO_AES is not set
1431# CONFIG_CRYPTO_ANUBIS is not set
1432# CONFIG_CRYPTO_ARC4 is not set
1433# CONFIG_CRYPTO_BLOWFISH is not set
1434# CONFIG_CRYPTO_CAMELLIA is not set
1366# CONFIG_CRYPTO_CAST5 is not set 1435# CONFIG_CRYPTO_CAST5 is not set
1367# CONFIG_CRYPTO_CAST6 is not set 1436# CONFIG_CRYPTO_CAST6 is not set
1368# CONFIG_CRYPTO_TEA is not set 1437CONFIG_CRYPTO_DES=y
1369# CONFIG_CRYPTO_ARC4 is not set 1438# CONFIG_CRYPTO_FCRYPT is not set
1370# CONFIG_CRYPTO_KHAZAD is not set 1439# CONFIG_CRYPTO_KHAZAD is not set
1371# CONFIG_CRYPTO_ANUBIS is not set 1440# CONFIG_CRYPTO_SALSA20 is not set
1372# CONFIG_CRYPTO_SEED is not set 1441# CONFIG_CRYPTO_SEED is not set
1442# CONFIG_CRYPTO_SERPENT is not set
1443# CONFIG_CRYPTO_TEA is not set
1444# CONFIG_CRYPTO_TWOFISH is not set
1445
1446#
1447# Compression
1448#
1373# CONFIG_CRYPTO_DEFLATE is not set 1449# CONFIG_CRYPTO_DEFLATE is not set
1374# CONFIG_CRYPTO_MICHAEL_MIC is not set 1450# CONFIG_CRYPTO_LZO is not set
1375# CONFIG_CRYPTO_CRC32C is not set
1376# CONFIG_CRYPTO_CAMELLIA is not set
1377# CONFIG_CRYPTO_TEST is not set
1378# CONFIG_CRYPTO_AUTHENC is not set
1379CONFIG_CRYPTO_HW=y 1451CONFIG_CRYPTO_HW=y
1452# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1380 1453
1381# 1454#
1382# Library routines 1455# Library routines
1383# 1456#
1384CONFIG_BITREVERSE=y 1457CONFIG_BITREVERSE=y
1458# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1385# CONFIG_CRC_CCITT is not set 1459# CONFIG_CRC_CCITT is not set
1386# CONFIG_CRC16 is not set 1460# CONFIG_CRC16 is not set
1461CONFIG_CRC_T10DIF=y
1387# CONFIG_CRC_ITU_T is not set 1462# CONFIG_CRC_ITU_T is not set
1388CONFIG_CRC32=y 1463CONFIG_CRC32=y
1389# CONFIG_CRC7 is not set 1464# CONFIG_CRC7 is not set
diff --git a/arch/sh/configs/se7206_defconfig b/arch/sh/configs/se7206_defconfig
index 6b34baa26eae..af15cbef12ba 100644
--- a/arch/sh/configs/se7206_defconfig
+++ b/arch/sh/configs/se7206_defconfig
@@ -1,10 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.26
4# Tue Jun 3 20:27:08 2008 4# Wed Jul 30 02:06:07 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
8CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -87,9 +88,14 @@ CONFIG_PROFILING=y
87# CONFIG_MARKERS is not set 88# CONFIG_MARKERS is not set
88CONFIG_OPROFILE=y 89CONFIG_OPROFILE=y
89CONFIG_HAVE_OPROFILE=y 90CONFIG_HAVE_OPROFILE=y
91# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
92# CONFIG_HAVE_IOREMAP_PROT is not set
90# CONFIG_HAVE_KPROBES is not set 93# CONFIG_HAVE_KPROBES is not set
91# CONFIG_HAVE_KRETPROBES is not set 94# CONFIG_HAVE_KRETPROBES is not set
95# CONFIG_HAVE_ARCH_TRACEHOOK is not set
92# CONFIG_HAVE_DMA_ATTRS is not set 96# CONFIG_HAVE_DMA_ATTRS is not set
97# CONFIG_USE_GENERIC_SMP_HELPERS is not set
98CONFIG_HAVE_CLK=y
93CONFIG_RT_MUTEXES=y 99CONFIG_RT_MUTEXES=y
94CONFIG_TINY_SHMEM=y 100CONFIG_TINY_SHMEM=y
95CONFIG_BASE_SMALL=0 101CONFIG_BASE_SMALL=0
@@ -99,12 +105,13 @@ CONFIG_MODULE_UNLOAD=y
99# CONFIG_MODULE_FORCE_UNLOAD is not set 105# CONFIG_MODULE_FORCE_UNLOAD is not set
100# CONFIG_MODVERSIONS is not set 106# CONFIG_MODVERSIONS is not set
101# CONFIG_MODULE_SRCVERSION_ALL is not set 107# CONFIG_MODULE_SRCVERSION_ALL is not set
102# CONFIG_KMOD is not set 108CONFIG_KMOD=y
103CONFIG_BLOCK=y 109CONFIG_BLOCK=y
104# CONFIG_LBD is not set 110# CONFIG_LBD is not set
105# CONFIG_BLK_DEV_IO_TRACE is not set 111# CONFIG_BLK_DEV_IO_TRACE is not set
106# CONFIG_LSF is not set 112# CONFIG_LSF is not set
107# CONFIG_BLK_DEV_BSG is not set 113# CONFIG_BLK_DEV_BSG is not set
114# CONFIG_BLK_DEV_INTEGRITY is not set
108 115
109# 116#
110# IO Schedulers 117# IO Schedulers
@@ -175,7 +182,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
175CONFIG_ARCH_SELECT_MEMORY_MODEL=y 182CONFIG_ARCH_SELECT_MEMORY_MODEL=y
176CONFIG_PAGE_SIZE_4KB=y 183CONFIG_PAGE_SIZE_4KB=y
177# CONFIG_PAGE_SIZE_8KB is not set 184# CONFIG_PAGE_SIZE_8KB is not set
185# CONFIG_PAGE_SIZE_16KB is not set
178# CONFIG_PAGE_SIZE_64KB is not set 186# CONFIG_PAGE_SIZE_64KB is not set
187CONFIG_ENTRY_OFFSET=0x00001000
179CONFIG_SELECT_MEMORY_MODEL=y 188CONFIG_SELECT_MEMORY_MODEL=y
180CONFIG_FLATMEM_MANUAL=y 189CONFIG_FLATMEM_MANUAL=y
181# CONFIG_DISCONTIGMEM_MANUAL is not set 190# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -294,6 +303,7 @@ CONFIG_CF_BASE_ADDR=0xb8000000
294# 303#
295# Executable file formats 304# Executable file formats
296# 305#
306CONFIG_BINFMT_ELF_FDPIC=y
297CONFIG_BINFMT_FLAT=y 307CONFIG_BINFMT_FLAT=y
298CONFIG_BINFMT_ZFLAT=y 308CONFIG_BINFMT_ZFLAT=y
299CONFIG_BINFMT_SHARED_FLAT=y 309CONFIG_BINFMT_SHARED_FLAT=y
@@ -487,6 +497,7 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
487# CONFIG_BLK_DEV_XIP is not set 497# CONFIG_BLK_DEV_XIP is not set
488# CONFIG_CDROM_PKTCDVD is not set 498# CONFIG_CDROM_PKTCDVD is not set
489# CONFIG_ATA_OVER_ETH is not set 499# CONFIG_ATA_OVER_ETH is not set
500# CONFIG_BLK_DEV_HD is not set
490CONFIG_MISC_DEVICES=y 501CONFIG_MISC_DEVICES=y
491CONFIG_EEPROM_93CX6=y 502CONFIG_EEPROM_93CX6=y
492# CONFIG_ENCLOSURE_SERVICES is not set 503# CONFIG_ENCLOSURE_SERVICES is not set
@@ -503,7 +514,6 @@ CONFIG_HAVE_IDE=y
503# CONFIG_ATA is not set 514# CONFIG_ATA is not set
504# CONFIG_MD is not set 515# CONFIG_MD is not set
505CONFIG_NETDEVICES=y 516CONFIG_NETDEVICES=y
506# CONFIG_NETDEVICES_MULTIQUEUE is not set
507# CONFIG_DUMMY is not set 517# CONFIG_DUMMY is not set
508# CONFIG_BONDING is not set 518# CONFIG_BONDING is not set
509# CONFIG_MACVLAN is not set 519# CONFIG_MACVLAN is not set
@@ -516,6 +526,7 @@ CONFIG_MII=y
516# CONFIG_AX88796 is not set 526# CONFIG_AX88796 is not set
517# CONFIG_STNIC is not set 527# CONFIG_STNIC is not set
518CONFIG_SMC91X=y 528CONFIG_SMC91X=y
529# CONFIG_SMC911X is not set
519# CONFIG_IBM_NEW_EMAC_ZMII is not set 530# CONFIG_IBM_NEW_EMAC_ZMII is not set
520# CONFIG_IBM_NEW_EMAC_RGMII is not set 531# CONFIG_IBM_NEW_EMAC_RGMII is not set
521# CONFIG_IBM_NEW_EMAC_TAH is not set 532# CONFIG_IBM_NEW_EMAC_TAH is not set
@@ -583,6 +594,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
583# CONFIG_POWER_SUPPLY is not set 594# CONFIG_POWER_SUPPLY is not set
584# CONFIG_HWMON is not set 595# CONFIG_HWMON is not set
585# CONFIG_THERMAL is not set 596# CONFIG_THERMAL is not set
597# CONFIG_THERMAL_HWMON is not set
586# CONFIG_WATCHDOG is not set 598# CONFIG_WATCHDOG is not set
587 599
588# 600#
@@ -594,6 +606,7 @@ CONFIG_SSB_POSSIBLE=y
594# 606#
595# Multifunction device drivers 607# Multifunction device drivers
596# 608#
609# CONFIG_MFD_CORE is not set
597# CONFIG_MFD_SM501 is not set 610# CONFIG_MFD_SM501 is not set
598# CONFIG_HTC_PASIC3 is not set 611# CONFIG_HTC_PASIC3 is not set
599 612
@@ -625,10 +638,6 @@ CONFIG_SSB_POSSIBLE=y
625# Display device support 638# Display device support
626# 639#
627# CONFIG_DISPLAY_SUPPORT is not set 640# CONFIG_DISPLAY_SUPPORT is not set
628
629#
630# Sound
631#
632# CONFIG_SOUND is not set 641# CONFIG_SOUND is not set
633# CONFIG_USB_SUPPORT is not set 642# CONFIG_USB_SUPPORT is not set
634# CONFIG_MMC is not set 643# CONFIG_MMC is not set
@@ -669,6 +678,7 @@ CONFIG_RTC_INTF_DEV=y
669# on-CPU RTC drivers 678# on-CPU RTC drivers
670# 679#
671CONFIG_RTC_DRV_SH=y 680CONFIG_RTC_DRV_SH=y
681# CONFIG_DMADEVICES is not set
672# CONFIG_UIO is not set 682# CONFIG_UIO is not set
673 683
674# 684#
@@ -728,6 +738,7 @@ CONFIG_CONFIGFS_FS=y
728CONFIG_CRAMFS=y 738CONFIG_CRAMFS=y
729# CONFIG_VXFS_FS is not set 739# CONFIG_VXFS_FS is not set
730# CONFIG_MINIX_FS is not set 740# CONFIG_MINIX_FS is not set
741# CONFIG_OMFS_FS is not set
731# CONFIG_HPFS_FS is not set 742# CONFIG_HPFS_FS is not set
732# CONFIG_QNX4FS_FS is not set 743# CONFIG_QNX4FS_FS is not set
733CONFIG_ROMFS_FS=y 744CONFIG_ROMFS_FS=y
@@ -738,13 +749,12 @@ CONFIG_NFS_FS=y
738CONFIG_NFS_V3=y 749CONFIG_NFS_V3=y
739# CONFIG_NFS_V3_ACL is not set 750# CONFIG_NFS_V3_ACL is not set
740# CONFIG_NFS_V4 is not set 751# CONFIG_NFS_V4 is not set
741# CONFIG_NFSD is not set
742CONFIG_ROOT_NFS=y 752CONFIG_ROOT_NFS=y
753# CONFIG_NFSD is not set
743CONFIG_LOCKD=y 754CONFIG_LOCKD=y
744CONFIG_LOCKD_V4=y 755CONFIG_LOCKD_V4=y
745CONFIG_NFS_COMMON=y 756CONFIG_NFS_COMMON=y
746CONFIG_SUNRPC=y 757CONFIG_SUNRPC=y
747# CONFIG_SUNRPC_BIND34 is not set
748# CONFIG_RPCSEC_GSS_KRB5 is not set 758# CONFIG_RPCSEC_GSS_KRB5 is not set
749# CONFIG_RPCSEC_GSS_SPKM3 is not set 759# CONFIG_RPCSEC_GSS_SPKM3 is not set
750# CONFIG_SMB_FS is not set 760# CONFIG_SMB_FS is not set
@@ -776,6 +786,8 @@ CONFIG_DEBUG_FS=y
776CONFIG_DEBUG_KERNEL=y 786CONFIG_DEBUG_KERNEL=y
777# CONFIG_DEBUG_SHIRQ is not set 787# CONFIG_DEBUG_SHIRQ is not set
778CONFIG_DETECT_SOFTLOCKUP=y 788CONFIG_DETECT_SOFTLOCKUP=y
789# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
790CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
779CONFIG_SCHED_DEBUG=y 791CONFIG_SCHED_DEBUG=y
780# CONFIG_SCHEDSTATS is not set 792# CONFIG_SCHEDSTATS is not set
781# CONFIG_TIMER_STATS is not set 793# CONFIG_TIMER_STATS is not set
@@ -795,6 +807,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
795# CONFIG_DEBUG_INFO is not set 807# CONFIG_DEBUG_INFO is not set
796CONFIG_DEBUG_VM=y 808CONFIG_DEBUG_VM=y
797# CONFIG_DEBUG_WRITECOUNT is not set 809# CONFIG_DEBUG_WRITECOUNT is not set
810# CONFIG_DEBUG_MEMORY_INIT is not set
798CONFIG_DEBUG_LIST=y 811CONFIG_DEBUG_LIST=y
799# CONFIG_DEBUG_SG is not set 812# CONFIG_DEBUG_SG is not set
800CONFIG_FRAME_POINTER=y 813CONFIG_FRAME_POINTER=y
@@ -860,6 +873,10 @@ CONFIG_CRYPTO_ALGAPI=y
860# CONFIG_CRYPTO_MD4 is not set 873# CONFIG_CRYPTO_MD4 is not set
861# CONFIG_CRYPTO_MD5 is not set 874# CONFIG_CRYPTO_MD5 is not set
862# CONFIG_CRYPTO_MICHAEL_MIC is not set 875# CONFIG_CRYPTO_MICHAEL_MIC is not set
876# CONFIG_CRYPTO_RMD128 is not set
877# CONFIG_CRYPTO_RMD160 is not set
878# CONFIG_CRYPTO_RMD256 is not set
879# CONFIG_CRYPTO_RMD320 is not set
863# CONFIG_CRYPTO_SHA1 is not set 880# CONFIG_CRYPTO_SHA1 is not set
864# CONFIG_CRYPTO_SHA256 is not set 881# CONFIG_CRYPTO_SHA256 is not set
865# CONFIG_CRYPTO_SHA512 is not set 882# CONFIG_CRYPTO_SHA512 is not set
@@ -899,6 +916,7 @@ CONFIG_BITREVERSE=y
899# CONFIG_GENERIC_FIND_FIRST_BIT is not set 916# CONFIG_GENERIC_FIND_FIRST_BIT is not set
900CONFIG_CRC_CCITT=y 917CONFIG_CRC_CCITT=y
901CONFIG_CRC16=y 918CONFIG_CRC16=y
919# CONFIG_CRC_T10DIF is not set
902CONFIG_CRC_ITU_T=y 920CONFIG_CRC_ITU_T=y
903CONFIG_CRC32=y 921CONFIG_CRC32=y
904CONFIG_CRC7=y 922CONFIG_CRC7=y
diff --git a/arch/sh/configs/se7343_defconfig b/arch/sh/configs/se7343_defconfig
index 84c0075e2ad4..4e30b70377e2 100644
--- a/arch/sh/configs/se7343_defconfig
+++ b/arch/sh/configs/se7343_defconfig
@@ -1,40 +1,56 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18 3# Linux kernel version: 2.6.26
4# Tue Oct 3 11:46:17 2006 4# Wed Jul 30 02:08:38 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_BUG=y
8CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
9CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
11CONFIG_GENERIC_IRQ_PROBE=y 14CONFIG_GENERIC_IRQ_PROBE=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 15CONFIG_GENERIC_CALIBRATE_DELAY=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_CLOCKEVENTS=y
18CONFIG_STACKTRACE_SUPPORT=y
19CONFIG_LOCKDEP_SUPPORT=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y
23CONFIG_ARCH_SUPPORTS_AOUT=y
13CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
14 25
15# 26#
16# Code maturity level options 27# General setup
17# 28#
18CONFIG_EXPERIMENTAL=y 29CONFIG_EXPERIMENTAL=y
19CONFIG_BROKEN_ON_SMP=y 30CONFIG_BROKEN_ON_SMP=y
20CONFIG_INIT_ENV_ARG_LIMIT=32 31CONFIG_INIT_ENV_ARG_LIMIT=32
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION="" 32CONFIG_LOCALVERSION=""
26CONFIG_LOCALVERSION_AUTO=y 33CONFIG_LOCALVERSION_AUTO=y
27# CONFIG_SWAP is not set 34# CONFIG_SWAP is not set
28CONFIG_SYSVIPC=y 35CONFIG_SYSVIPC=y
29# CONFIG_IPC_NS is not set 36CONFIG_SYSVIPC_SYSCTL=y
30CONFIG_POSIX_MQUEUE=y 37CONFIG_POSIX_MQUEUE=y
31# CONFIG_BSD_PROCESS_ACCT is not set 38# CONFIG_BSD_PROCESS_ACCT is not set
32# CONFIG_TASKSTATS is not set 39# CONFIG_TASKSTATS is not set
33# CONFIG_UTS_NS is not set
34# CONFIG_AUDIT is not set 40# CONFIG_AUDIT is not set
35# CONFIG_IKCONFIG is not set 41# CONFIG_IKCONFIG is not set
42CONFIG_LOG_BUF_SHIFT=14
43# CONFIG_CGROUPS is not set
44CONFIG_GROUP_SCHED=y
45CONFIG_FAIR_GROUP_SCHED=y
46# CONFIG_RT_GROUP_SCHED is not set
47CONFIG_USER_SCHED=y
48# CONFIG_CGROUP_SCHED is not set
49CONFIG_SYSFS_DEPRECATED=y
50CONFIG_SYSFS_DEPRECATED_V2=y
36# CONFIG_RELAY is not set 51# CONFIG_RELAY is not set
37CONFIG_INITRAMFS_SOURCE="" 52# CONFIG_NAMESPACES is not set
53# CONFIG_BLK_DEV_INITRD is not set
38CONFIG_CC_OPTIMIZE_FOR_SIZE=y 54CONFIG_CC_OPTIMIZE_FOR_SIZE=y
39CONFIG_SYSCTL=y 55CONFIG_SYSCTL=y
40CONFIG_EMBEDDED=y 56CONFIG_EMBEDDED=y
@@ -46,33 +62,47 @@ CONFIG_HOTPLUG=y
46CONFIG_PRINTK=y 62CONFIG_PRINTK=y
47CONFIG_BUG=y 63CONFIG_BUG=y
48CONFIG_ELF_CORE=y 64CONFIG_ELF_CORE=y
65CONFIG_COMPAT_BRK=y
49CONFIG_BASE_FULL=y 66CONFIG_BASE_FULL=y
50# CONFIG_FUTEX is not set 67# CONFIG_FUTEX is not set
68CONFIG_ANON_INODES=y
51# CONFIG_EPOLL is not set 69# CONFIG_EPOLL is not set
70CONFIG_SIGNALFD=y
71CONFIG_TIMERFD=y
72CONFIG_EVENTFD=y
52# CONFIG_SHMEM is not set 73# CONFIG_SHMEM is not set
53CONFIG_SLAB=y
54CONFIG_VM_EVENT_COUNTERS=y 74CONFIG_VM_EVENT_COUNTERS=y
75CONFIG_SLAB=y
76# CONFIG_SLUB is not set
77# CONFIG_SLOB is not set
78# CONFIG_PROFILING is not set
79# CONFIG_MARKERS is not set
80CONFIG_HAVE_OPROFILE=y
81# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
82# CONFIG_HAVE_IOREMAP_PROT is not set
83# CONFIG_HAVE_KPROBES is not set
84# CONFIG_HAVE_KRETPROBES is not set
85# CONFIG_HAVE_ARCH_TRACEHOOK is not set
86# CONFIG_HAVE_DMA_ATTRS is not set
87# CONFIG_USE_GENERIC_SMP_HELPERS is not set
88CONFIG_HAVE_CLK=y
89CONFIG_PROC_PAGE_MONITOR=y
90CONFIG_SLABINFO=y
55CONFIG_TINY_SHMEM=y 91CONFIG_TINY_SHMEM=y
56CONFIG_BASE_SMALL=0 92CONFIG_BASE_SMALL=0
57# CONFIG_SLOB is not set
58
59#
60# Loadable module support
61#
62CONFIG_MODULES=y 93CONFIG_MODULES=y
94# CONFIG_MODULE_FORCE_LOAD is not set
63CONFIG_MODULE_UNLOAD=y 95CONFIG_MODULE_UNLOAD=y
64CONFIG_MODULE_FORCE_UNLOAD=y 96CONFIG_MODULE_FORCE_UNLOAD=y
65# CONFIG_MODVERSIONS is not set 97# CONFIG_MODVERSIONS is not set
66# CONFIG_MODULE_SRCVERSION_ALL is not set 98# CONFIG_MODULE_SRCVERSION_ALL is not set
67# CONFIG_KMOD is not set 99CONFIG_KMOD=y
68
69#
70# Block layer
71#
72CONFIG_BLOCK=y 100CONFIG_BLOCK=y
73# CONFIG_LBD is not set 101# CONFIG_LBD is not set
74# CONFIG_BLK_DEV_IO_TRACE is not set 102# CONFIG_BLK_DEV_IO_TRACE is not set
75# CONFIG_LSF is not set 103# CONFIG_LSF is not set
104# CONFIG_BLK_DEV_BSG is not set
105# CONFIG_BLK_DEV_INTEGRITY is not set
76 106
77# 107#
78# IO Schedulers 108# IO Schedulers
@@ -86,62 +116,28 @@ CONFIG_DEFAULT_DEADLINE=y
86# CONFIG_DEFAULT_CFQ is not set 116# CONFIG_DEFAULT_CFQ is not set
87# CONFIG_DEFAULT_NOOP is not set 117# CONFIG_DEFAULT_NOOP is not set
88CONFIG_DEFAULT_IOSCHED="deadline" 118CONFIG_DEFAULT_IOSCHED="deadline"
119CONFIG_CLASSIC_RCU=y
89 120
90# 121#
91# System type 122# System type
92# 123#
93CONFIG_SOLUTION_ENGINE=y
94# CONFIG_SH_SOLUTION_ENGINE is not set
95# CONFIG_SH_7751_SOLUTION_ENGINE is not set
96# CONFIG_SH_7300_SOLUTION_ENGINE is not set
97CONFIG_SH_7343_SOLUTION_ENGINE=y
98# CONFIG_SH_73180_SOLUTION_ENGINE is not set
99# CONFIG_SH_7751_SYSTEMH is not set
100# CONFIG_SH_HP6XX is not set
101# CONFIG_SH_EC3104 is not set
102# CONFIG_SH_SATURN is not set
103# CONFIG_SH_DREAMCAST is not set
104# CONFIG_SH_BIGSUR is not set
105# CONFIG_SH_MPC1211 is not set
106# CONFIG_SH_SH03 is not set
107# CONFIG_SH_SECUREEDGE5410 is not set
108# CONFIG_SH_HS7751RVOIP is not set
109# CONFIG_SH_7710VOIPGW is not set
110# CONFIG_SH_RTS7751R2D is not set
111# CONFIG_SH_R7780RP is not set
112# CONFIG_SH_EDOSK7705 is not set
113# CONFIG_SH_SH4202_MICRODEV is not set
114# CONFIG_SH_LANDISK is not set
115# CONFIG_SH_TITAN is not set
116# CONFIG_SH_SHMIN is not set
117# CONFIG_SH_UNKNOWN is not set
118
119#
120# Processor selection
121#
122CONFIG_CPU_SH4=y 124CONFIG_CPU_SH4=y
123CONFIG_CPU_SH4A=y 125CONFIG_CPU_SH4A=y
124CONFIG_CPU_SH4AL_DSP=y 126CONFIG_CPU_SH4AL_DSP=y
125 127# CONFIG_CPU_SUBTYPE_SH7619 is not set
126# 128# CONFIG_CPU_SUBTYPE_SH7203 is not set
127# SH-2 Processor Support 129# CONFIG_CPU_SUBTYPE_SH7206 is not set
128# 130# CONFIG_CPU_SUBTYPE_SH7263 is not set
129# CONFIG_CPU_SUBTYPE_SH7604 is not set 131# CONFIG_CPU_SUBTYPE_MXG is not set
130
131#
132# SH-3 Processor Support
133#
134# CONFIG_CPU_SUBTYPE_SH7300 is not set
135# CONFIG_CPU_SUBTYPE_SH7705 is not set 132# CONFIG_CPU_SUBTYPE_SH7705 is not set
136# CONFIG_CPU_SUBTYPE_SH7706 is not set 133# CONFIG_CPU_SUBTYPE_SH7706 is not set
137# CONFIG_CPU_SUBTYPE_SH7707 is not set 134# CONFIG_CPU_SUBTYPE_SH7707 is not set
138# CONFIG_CPU_SUBTYPE_SH7708 is not set 135# CONFIG_CPU_SUBTYPE_SH7708 is not set
139# CONFIG_CPU_SUBTYPE_SH7709 is not set 136# CONFIG_CPU_SUBTYPE_SH7709 is not set
140# CONFIG_CPU_SUBTYPE_SH7710 is not set 137# CONFIG_CPU_SUBTYPE_SH7710 is not set
141 138# CONFIG_CPU_SUBTYPE_SH7712 is not set
142# 139# CONFIG_CPU_SUBTYPE_SH7720 is not set
143# SH-4 Processor Support 140# CONFIG_CPU_SUBTYPE_SH7721 is not set
144#
145# CONFIG_CPU_SUBTYPE_SH7750 is not set 141# CONFIG_CPU_SUBTYPE_SH7750 is not set
146# CONFIG_CPU_SUBTYPE_SH7091 is not set 142# CONFIG_CPU_SUBTYPE_SH7091 is not set
147# CONFIG_CPU_SUBTYPE_SH7750R is not set 143# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -150,67 +146,89 @@ CONFIG_CPU_SH4AL_DSP=y
150# CONFIG_CPU_SUBTYPE_SH7751R is not set 146# CONFIG_CPU_SUBTYPE_SH7751R is not set
151# CONFIG_CPU_SUBTYPE_SH7760 is not set 147# CONFIG_CPU_SUBTYPE_SH7760 is not set
152# CONFIG_CPU_SUBTYPE_SH4_202 is not set 148# CONFIG_CPU_SUBTYPE_SH4_202 is not set
153 149# CONFIG_CPU_SUBTYPE_SH7723 is not set
154# 150# CONFIG_CPU_SUBTYPE_SH7763 is not set
155# ST40 Processor Support
156#
157# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
158# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
159
160#
161# SH-4A Processor Support
162#
163# CONFIG_CPU_SUBTYPE_SH7770 is not set 151# CONFIG_CPU_SUBTYPE_SH7770 is not set
164# CONFIG_CPU_SUBTYPE_SH7780 is not set 152# CONFIG_CPU_SUBTYPE_SH7780 is not set
165 153# CONFIG_CPU_SUBTYPE_SH7785 is not set
166# 154# CONFIG_CPU_SUBTYPE_SHX3 is not set
167# SH4AL-DSP Processor Support
168#
169# CONFIG_CPU_SUBTYPE_SH73180 is not set
170CONFIG_CPU_SUBTYPE_SH7343=y 155CONFIG_CPU_SUBTYPE_SH7343=y
156# CONFIG_CPU_SUBTYPE_SH7722 is not set
157# CONFIG_CPU_SUBTYPE_SH7366 is not set
158# CONFIG_CPU_SUBTYPE_SH5_101 is not set
159# CONFIG_CPU_SUBTYPE_SH5_103 is not set
171 160
172# 161#
173# Memory management options 162# Memory management options
174# 163#
164CONFIG_QUICKLIST=y
175CONFIG_MMU=y 165CONFIG_MMU=y
176CONFIG_PAGE_OFFSET=0x80000000 166CONFIG_PAGE_OFFSET=0x80000000
177CONFIG_MEMORY_START=0x0c000000 167CONFIG_MEMORY_START=0x0c000000
178CONFIG_MEMORY_SIZE=0x01000000 168CONFIG_MEMORY_SIZE=0x01000000
179CONFIG_32BIT=y 169CONFIG_29BIT=y
180CONFIG_VSYSCALL=y 170CONFIG_VSYSCALL=y
171CONFIG_ARCH_FLATMEM_ENABLE=y
172CONFIG_ARCH_SPARSEMEM_ENABLE=y
173CONFIG_ARCH_SPARSEMEM_DEFAULT=y
174CONFIG_MAX_ACTIVE_REGIONS=1
175CONFIG_ARCH_POPULATES_NODE_MAP=y
176CONFIG_ARCH_SELECT_MEMORY_MODEL=y
177CONFIG_PAGE_SIZE_4KB=y
178# CONFIG_PAGE_SIZE_8KB is not set
179# CONFIG_PAGE_SIZE_16KB is not set
180# CONFIG_PAGE_SIZE_64KB is not set
181CONFIG_ENTRY_OFFSET=0x00001000
181CONFIG_SELECT_MEMORY_MODEL=y 182CONFIG_SELECT_MEMORY_MODEL=y
182CONFIG_FLATMEM_MANUAL=y 183CONFIG_FLATMEM_MANUAL=y
183# CONFIG_DISCONTIGMEM_MANUAL is not set 184# CONFIG_DISCONTIGMEM_MANUAL is not set
184# CONFIG_SPARSEMEM_MANUAL is not set 185# CONFIG_SPARSEMEM_MANUAL is not set
185CONFIG_FLATMEM=y 186CONFIG_FLATMEM=y
186CONFIG_FLAT_NODE_MEM_MAP=y 187CONFIG_FLAT_NODE_MEM_MAP=y
187# CONFIG_SPARSEMEM_STATIC is not set 188CONFIG_SPARSEMEM_STATIC=y
189# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
190CONFIG_PAGEFLAGS_EXTENDED=y
188CONFIG_SPLIT_PTLOCK_CPUS=4 191CONFIG_SPLIT_PTLOCK_CPUS=4
189# CONFIG_RESOURCES_64BIT is not set 192# CONFIG_RESOURCES_64BIT is not set
193CONFIG_ZONE_DMA_FLAG=0
194CONFIG_NR_QUICK=2
190 195
191# 196#
192# Cache configuration 197# Cache configuration
193# 198#
194# CONFIG_SH_DIRECT_MAPPED is not set 199# CONFIG_SH_DIRECT_MAPPED is not set
195# CONFIG_SH_WRITETHROUGH is not set 200CONFIG_CACHE_WRITEBACK=y
196# CONFIG_SH_OCRAM is not set 201# CONFIG_CACHE_WRITETHROUGH is not set
202# CONFIG_CACHE_OFF is not set
197 203
198# 204#
199# Processor features 205# Processor features
200# 206#
201CONFIG_CPU_LITTLE_ENDIAN=y 207CONFIG_CPU_LITTLE_ENDIAN=y
202# CONFIG_SH_FPU is not set 208# CONFIG_CPU_BIG_ENDIAN is not set
203# CONFIG_SH_FPU_EMU is not set 209# CONFIG_SH_FPU_EMU is not set
204CONFIG_SH_DSP=y 210CONFIG_SH_DSP=y
205# CONFIG_SH_STORE_QUEUES is not set 211# CONFIG_SH_STORE_QUEUES is not set
206CONFIG_CPU_HAS_INTEVT=y 212CONFIG_CPU_HAS_INTEVT=y
207CONFIG_CPU_HAS_SR_RB=y 213CONFIG_CPU_HAS_SR_RB=y
214CONFIG_CPU_HAS_DSP=y
215
216#
217# Board support
218#
219CONFIG_SOLUTION_ENGINE=y
220CONFIG_SH_7343_SOLUTION_ENGINE=y
208 221
209# 222#
210# Timer support 223# Timer and clock configuration
211# 224#
212CONFIG_SH_TMU=y 225CONFIG_SH_TMU=y
226CONFIG_SH_TIMER_IRQ=16
213CONFIG_SH_PCLK_FREQ=27000000 227CONFIG_SH_PCLK_FREQ=27000000
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
214 232
215# 233#
216# CPU Frequency scaling 234# CPU Frequency scaling
@@ -225,57 +243,50 @@ CONFIG_SH_PCLK_FREQ=27000000
225# 243#
226# Companion Chips 244# Companion Chips
227# 245#
228# CONFIG_HD6446X_SERIES is not set 246
247#
248# Additional SuperH Device Drivers
249#
229CONFIG_HEARTBEAT=y 250CONFIG_HEARTBEAT=y
251# CONFIG_PUSH_SWITCH is not set
230 252
231# 253#
232# Kernel features 254# Kernel features
233# 255#
234# CONFIG_HZ_100 is not set 256# CONFIG_HZ_100 is not set
235CONFIG_HZ_250=y 257CONFIG_HZ_250=y
258# CONFIG_HZ_300 is not set
236# CONFIG_HZ_1000 is not set 259# CONFIG_HZ_1000 is not set
237CONFIG_HZ=250 260CONFIG_HZ=250
261# CONFIG_SCHED_HRTICK is not set
238# CONFIG_KEXEC is not set 262# CONFIG_KEXEC is not set
239# CONFIG_SMP is not set 263# CONFIG_CRASH_DUMP is not set
240CONFIG_PREEMPT_NONE=y 264CONFIG_PREEMPT_NONE=y
241# CONFIG_PREEMPT_VOLUNTARY is not set 265# CONFIG_PREEMPT_VOLUNTARY is not set
242# CONFIG_PREEMPT is not set 266# CONFIG_PREEMPT is not set
267CONFIG_GUSA=y
243 268
244# 269#
245# Boot options 270# Boot options
246# 271#
247CONFIG_ZERO_PAGE_OFFSET=0x00001000 272CONFIG_ZERO_PAGE_OFFSET=0x00001000
248CONFIG_BOOT_LINK_OFFSET=0x00800000 273CONFIG_BOOT_LINK_OFFSET=0x00800000
249# CONFIG_UBC_WAKEUP is not set
250# CONFIG_CMDLINE_BOOL is not set 274# CONFIG_CMDLINE_BOOL is not set
251 275
252# 276#
253# Bus options 277# Bus options
254# 278#
255# CONFIG_PCI is not set 279# CONFIG_CF_ENABLER is not set
256 280# CONFIG_ARCH_SUPPORTS_MSI is not set
257#
258# PCCARD (PCMCIA/CardBus) support
259#
260# CONFIG_PCCARD is not set 281# CONFIG_PCCARD is not set
261 282
262# 283#
263# PCI Hotplug Support
264#
265
266#
267# Executable file formats 284# Executable file formats
268# 285#
269CONFIG_BINFMT_ELF=y 286CONFIG_BINFMT_ELF=y
270# CONFIG_BINFMT_FLAT is not set
271# CONFIG_BINFMT_MISC is not set 287# CONFIG_BINFMT_MISC is not set
272 288
273# 289#
274# Power management options (EXPERIMENTAL)
275#
276# CONFIG_PM is not set
277
278#
279# Networking 290# Networking
280# 291#
281CONFIG_NET=y 292CONFIG_NET=y
@@ -283,22 +294,20 @@ CONFIG_NET=y
283# 294#
284# Networking options 295# Networking options
285# 296#
286# CONFIG_NETDEBUG is not set
287CONFIG_PACKET=y 297CONFIG_PACKET=y
288CONFIG_PACKET_MMAP=y 298CONFIG_PACKET_MMAP=y
289CONFIG_UNIX=y 299CONFIG_UNIX=y
290CONFIG_XFRM=y 300CONFIG_XFRM=y
291# CONFIG_XFRM_USER is not set 301# CONFIG_XFRM_USER is not set
292# CONFIG_XFRM_SUB_POLICY is not set 302# CONFIG_XFRM_SUB_POLICY is not set
303# CONFIG_XFRM_MIGRATE is not set
304# CONFIG_XFRM_STATISTICS is not set
293# CONFIG_NET_KEY is not set 305# CONFIG_NET_KEY is not set
294CONFIG_INET=y 306CONFIG_INET=y
295# CONFIG_IP_MULTICAST is not set 307# CONFIG_IP_MULTICAST is not set
296# CONFIG_IP_ADVANCED_ROUTER is not set 308# CONFIG_IP_ADVANCED_ROUTER is not set
297CONFIG_IP_FIB_HASH=y 309CONFIG_IP_FIB_HASH=y
298CONFIG_IP_PNP=y 310# CONFIG_IP_PNP is not set
299CONFIG_IP_PNP_DHCP=y
300# CONFIG_IP_PNP_BOOTP is not set
301# CONFIG_IP_PNP_RARP is not set
302# CONFIG_NET_IPIP is not set 311# CONFIG_NET_IPIP is not set
303# CONFIG_NET_IPGRE is not set 312# CONFIG_NET_IPGRE is not set
304# CONFIG_ARPD is not set 313# CONFIG_ARPD is not set
@@ -310,29 +319,18 @@ CONFIG_SYN_COOKIES=y
310# CONFIG_INET_TUNNEL is not set 319# CONFIG_INET_TUNNEL is not set
311CONFIG_INET_XFRM_MODE_TRANSPORT=y 320CONFIG_INET_XFRM_MODE_TRANSPORT=y
312CONFIG_INET_XFRM_MODE_TUNNEL=y 321CONFIG_INET_XFRM_MODE_TUNNEL=y
322CONFIG_INET_XFRM_MODE_BEET=y
323# CONFIG_INET_LRO is not set
313# CONFIG_INET_DIAG is not set 324# CONFIG_INET_DIAG is not set
314# CONFIG_TCP_CONG_ADVANCED is not set 325# CONFIG_TCP_CONG_ADVANCED is not set
315CONFIG_TCP_CONG_CUBIC=y 326CONFIG_TCP_CONG_CUBIC=y
316CONFIG_DEFAULT_TCP_CONG="cubic" 327CONFIG_DEFAULT_TCP_CONG="cubic"
328# CONFIG_TCP_MD5SIG is not set
317# CONFIG_IPV6 is not set 329# CONFIG_IPV6 is not set
318# CONFIG_INET6_XFRM_TUNNEL is not set
319# CONFIG_INET6_TUNNEL is not set
320# CONFIG_NETWORK_SECMARK is not set 330# CONFIG_NETWORK_SECMARK is not set
321# CONFIG_NETFILTER is not set 331# CONFIG_NETFILTER is not set
322
323#
324# DCCP Configuration (EXPERIMENTAL)
325#
326# CONFIG_IP_DCCP is not set 332# CONFIG_IP_DCCP is not set
327
328#
329# SCTP Configuration (EXPERIMENTAL)
330#
331# CONFIG_IP_SCTP is not set 333# CONFIG_IP_SCTP is not set
332
333#
334# TIPC Configuration (EXPERIMENTAL)
335#
336# CONFIG_TIPC is not set 334# CONFIG_TIPC is not set
337# CONFIG_ATM is not set 335# CONFIG_ATM is not set
338# CONFIG_BRIDGE is not set 336# CONFIG_BRIDGE is not set
@@ -345,10 +343,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
345# CONFIG_LAPB is not set 343# CONFIG_LAPB is not set
346# CONFIG_ECONET is not set 344# CONFIG_ECONET is not set
347# CONFIG_WAN_ROUTER is not set 345# CONFIG_WAN_ROUTER is not set
348
349#
350# QoS and/or fair queueing
351#
352# CONFIG_NET_SCHED is not set 346# CONFIG_NET_SCHED is not set
353 347
354# 348#
@@ -356,9 +350,20 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
356# 350#
357# CONFIG_NET_PKTGEN is not set 351# CONFIG_NET_PKTGEN is not set
358# CONFIG_HAMRADIO is not set 352# CONFIG_HAMRADIO is not set
353# CONFIG_CAN is not set
359# CONFIG_IRDA is not set 354# CONFIG_IRDA is not set
360# CONFIG_BT is not set 355# CONFIG_BT is not set
356# CONFIG_AF_RXRPC is not set
357
358#
359# Wireless
360#
361# CONFIG_CFG80211 is not set
362# CONFIG_WIRELESS_EXT is not set
363# CONFIG_MAC80211 is not set
361# CONFIG_IEEE80211 is not set 364# CONFIG_IEEE80211 is not set
365# CONFIG_RFKILL is not set
366# CONFIG_NET_9P is not set
362 367
363# 368#
364# Device Drivers 369# Device Drivers
@@ -367,36 +372,34 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
367# 372#
368# Generic Driver Options 373# Generic Driver Options
369# 374#
375CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
370CONFIG_STANDALONE=y 376CONFIG_STANDALONE=y
371CONFIG_PREVENT_FIRMWARE_BUILD=y 377CONFIG_PREVENT_FIRMWARE_BUILD=y
372CONFIG_FW_LOADER=y 378CONFIG_FW_LOADER=y
379CONFIG_FIRMWARE_IN_KERNEL=y
380CONFIG_EXTRA_FIRMWARE=""
373# CONFIG_SYS_HYPERVISOR is not set 381# CONFIG_SYS_HYPERVISOR is not set
374
375#
376# Connector - unified userspace <-> kernelspace linker
377#
378# CONFIG_CONNECTOR is not set 382# CONFIG_CONNECTOR is not set
379
380#
381# Memory Technology Devices (MTD)
382#
383CONFIG_MTD=y 383CONFIG_MTD=y
384# CONFIG_MTD_DEBUG is not set 384# CONFIG_MTD_DEBUG is not set
385CONFIG_MTD_CONCAT=y 385CONFIG_MTD_CONCAT=y
386CONFIG_MTD_PARTITIONS=y 386CONFIG_MTD_PARTITIONS=y
387# CONFIG_MTD_REDBOOT_PARTS is not set 387# CONFIG_MTD_REDBOOT_PARTS is not set
388# CONFIG_MTD_CMDLINE_PARTS is not set 388# CONFIG_MTD_CMDLINE_PARTS is not set
389# CONFIG_MTD_AR7_PARTS is not set
389 390
390# 391#
391# User Modules And Translation Layers 392# User Modules And Translation Layers
392# 393#
393CONFIG_MTD_CHAR=y 394CONFIG_MTD_CHAR=y
395CONFIG_MTD_BLKDEVS=y
394CONFIG_MTD_BLOCK=y 396CONFIG_MTD_BLOCK=y
395# CONFIG_FTL is not set 397# CONFIG_FTL is not set
396# CONFIG_NFTL is not set 398# CONFIG_NFTL is not set
397# CONFIG_INFTL is not set 399# CONFIG_INFTL is not set
398# CONFIG_RFD_FTL is not set 400# CONFIG_RFD_FTL is not set
399# CONFIG_SSFDC is not set 401# CONFIG_SSFDC is not set
402# CONFIG_MTD_OOPS is not set
400 403
401# 404#
402# RAM/ROM/Flash chip drivers 405# RAM/ROM/Flash chip drivers
@@ -422,13 +425,15 @@ CONFIG_MTD_CFI_UTIL=y
422CONFIG_MTD_RAM=y 425CONFIG_MTD_RAM=y
423# CONFIG_MTD_ROM is not set 426# CONFIG_MTD_ROM is not set
424# CONFIG_MTD_ABSENT is not set 427# CONFIG_MTD_ABSENT is not set
425# CONFIG_MTD_OBSOLETE_CHIPS is not set
426 428
427# 429#
428# Mapping drivers for chip access 430# Mapping drivers for chip access
429# 431#
430# CONFIG_MTD_COMPLEX_MAPPINGS is not set 432# CONFIG_MTD_COMPLEX_MAPPINGS is not set
431# CONFIG_MTD_PHYSMAP is not set 433CONFIG_MTD_PHYSMAP=y
434CONFIG_MTD_PHYSMAP_START=0x0
435CONFIG_MTD_PHYSMAP_LEN=0
436CONFIG_MTD_PHYSMAP_BANKWIDTH=0
432# CONFIG_MTD_PLATRAM is not set 437# CONFIG_MTD_PLATRAM is not set
433 438
434# 439#
@@ -445,130 +450,102 @@ CONFIG_MTD_RAM=y
445# CONFIG_MTD_DOC2000 is not set 450# CONFIG_MTD_DOC2000 is not set
446# CONFIG_MTD_DOC2001 is not set 451# CONFIG_MTD_DOC2001 is not set
447# CONFIG_MTD_DOC2001PLUS is not set 452# CONFIG_MTD_DOC2001PLUS is not set
448
449#
450# NAND Flash Device Drivers
451#
452# CONFIG_MTD_NAND is not set 453# CONFIG_MTD_NAND is not set
453
454#
455# OneNAND Flash Device Drivers
456#
457# CONFIG_MTD_ONENAND is not set 454# CONFIG_MTD_ONENAND is not set
458 455
459# 456#
460# Parallel port support 457# UBI - Unsorted block images
461# 458#
459# CONFIG_MTD_UBI is not set
462# CONFIG_PARPORT is not set 460# CONFIG_PARPORT is not set
463 461CONFIG_BLK_DEV=y
464#
465# Plug and Play support
466#
467
468#
469# Block devices
470#
471# CONFIG_BLK_DEV_COW_COMMON is not set 462# CONFIG_BLK_DEV_COW_COMMON is not set
472# CONFIG_BLK_DEV_LOOP is not set 463# CONFIG_BLK_DEV_LOOP is not set
473# CONFIG_BLK_DEV_NBD is not set 464# CONFIG_BLK_DEV_NBD is not set
474# CONFIG_BLK_DEV_RAM is not set 465# CONFIG_BLK_DEV_RAM is not set
475# CONFIG_BLK_DEV_INITRD is not set
476# CONFIG_CDROM_PKTCDVD is not set 466# CONFIG_CDROM_PKTCDVD is not set
477# CONFIG_ATA_OVER_ETH is not set 467# CONFIG_ATA_OVER_ETH is not set
478 468# CONFIG_BLK_DEV_HD is not set
479# 469# CONFIG_MISC_DEVICES is not set
480# ATA/ATAPI/MFM/RLL support 470CONFIG_HAVE_IDE=y
481#
482# CONFIG_IDE is not set 471# CONFIG_IDE is not set
483 472
484# 473#
485# SCSI device support 474# SCSI device support
486# 475#
487# CONFIG_RAID_ATTRS is not set 476# CONFIG_RAID_ATTRS is not set
488# CONFIG_SCSI is not set 477CONFIG_SCSI=y
478CONFIG_SCSI_DMA=y
479# CONFIG_SCSI_TGT is not set
489# CONFIG_SCSI_NETLINK is not set 480# CONFIG_SCSI_NETLINK is not set
481CONFIG_SCSI_PROC_FS=y
490 482
491# 483#
492# Serial ATA (prod) and Parallel ATA (experimental) drivers 484# SCSI support type (disk, tape, CD-ROM)
493# 485#
494# CONFIG_ATA is not set 486# CONFIG_BLK_DEV_SD is not set
487# CONFIG_CHR_DEV_ST is not set
488# CONFIG_CHR_DEV_OSST is not set
489# CONFIG_BLK_DEV_SR is not set
490# CONFIG_CHR_DEV_SG is not set
491# CONFIG_CHR_DEV_SCH is not set
495 492
496# 493#
497# Multi-device support (RAID and LVM) 494# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
498# 495#
499# CONFIG_MD is not set 496CONFIG_SCSI_MULTI_LUN=y
497# CONFIG_SCSI_CONSTANTS is not set
498# CONFIG_SCSI_LOGGING is not set
499# CONFIG_SCSI_SCAN_ASYNC is not set
500CONFIG_SCSI_WAIT_SCAN=m
500 501
501# 502#
502# Fusion MPT device support 503# SCSI Transports
503#
504# CONFIG_FUSION is not set
505
506#
507# IEEE 1394 (FireWire) support
508#
509
510#
511# I2O device support
512#
513
514#
515# Network device support
516# 504#
505# CONFIG_SCSI_SPI_ATTRS is not set
506# CONFIG_SCSI_FC_ATTRS is not set
507# CONFIG_SCSI_ISCSI_ATTRS is not set
508# CONFIG_SCSI_SAS_LIBSAS is not set
509# CONFIG_SCSI_SRP_ATTRS is not set
510# CONFIG_SCSI_LOWLEVEL is not set
511# CONFIG_SCSI_DH is not set
512# CONFIG_ATA is not set
513# CONFIG_MD is not set
517CONFIG_NETDEVICES=y 514CONFIG_NETDEVICES=y
518# CONFIG_DUMMY is not set 515# CONFIG_DUMMY is not set
519# CONFIG_BONDING is not set 516# CONFIG_BONDING is not set
517# CONFIG_MACVLAN is not set
520# CONFIG_EQUALIZER is not set 518# CONFIG_EQUALIZER is not set
521# CONFIG_TUN is not set 519# CONFIG_TUN is not set
522 520# CONFIG_VETH is not set
523#
524# PHY device support
525#
526# CONFIG_PHYLIB is not set 521# CONFIG_PHYLIB is not set
527
528#
529# Ethernet (10 or 100Mbit)
530#
531CONFIG_NET_ETHERNET=y 522CONFIG_NET_ETHERNET=y
532CONFIG_MII=y 523CONFIG_MII=y
524# CONFIG_AX88796 is not set
533# CONFIG_STNIC is not set 525# CONFIG_STNIC is not set
534CONFIG_SMC91X=y 526CONFIG_SMC91X=y
527# CONFIG_SMC911X is not set
528# CONFIG_IBM_NEW_EMAC_ZMII is not set
529# CONFIG_IBM_NEW_EMAC_RGMII is not set
530# CONFIG_IBM_NEW_EMAC_TAH is not set
531# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
532# CONFIG_B44 is not set
533CONFIG_NETDEV_1000=y
534CONFIG_NETDEV_10000=y
535 535
536# 536#
537# Ethernet (1000 Mbit) 537# Wireless LAN
538#
539
540#
541# Ethernet (10000 Mbit)
542#
543
544#
545# Token Ring devices
546#
547
548#
549# Wireless LAN (non-hamradio)
550#
551# CONFIG_NET_RADIO is not set
552
553#
554# Wan interfaces
555# 538#
539# CONFIG_WLAN_PRE80211 is not set
540# CONFIG_WLAN_80211 is not set
541# CONFIG_IWLWIFI_LEDS is not set
556# CONFIG_WAN is not set 542# CONFIG_WAN is not set
557# CONFIG_PPP is not set 543# CONFIG_PPP is not set
558# CONFIG_SLIP is not set 544# CONFIG_SLIP is not set
559# CONFIG_SHAPER is not set
560# CONFIG_NETCONSOLE is not set 545# CONFIG_NETCONSOLE is not set
561# CONFIG_NETPOLL is not set 546# CONFIG_NETPOLL is not set
562# CONFIG_NET_POLL_CONTROLLER is not set 547# CONFIG_NET_POLL_CONTROLLER is not set
563
564#
565# ISDN subsystem
566#
567# CONFIG_ISDN is not set 548# CONFIG_ISDN is not set
568
569#
570# Telephony Support
571#
572# CONFIG_PHONE is not set 549# CONFIG_PHONE is not set
573 550
574# 551#
@@ -576,13 +553,13 @@ CONFIG_SMC91X=y
576# 553#
577CONFIG_INPUT=y 554CONFIG_INPUT=y
578# CONFIG_INPUT_FF_MEMLESS is not set 555# CONFIG_INPUT_FF_MEMLESS is not set
556# CONFIG_INPUT_POLLDEV is not set
579 557
580# 558#
581# Userland interfaces 559# Userland interfaces
582# 560#
583# CONFIG_INPUT_MOUSEDEV is not set 561# CONFIG_INPUT_MOUSEDEV is not set
584# CONFIG_INPUT_JOYDEV is not set 562# CONFIG_INPUT_JOYDEV is not set
585# CONFIG_INPUT_TSDEV is not set
586# CONFIG_INPUT_EVDEV is not set 563# CONFIG_INPUT_EVDEV is not set
587# CONFIG_INPUT_EVBUG is not set 564# CONFIG_INPUT_EVBUG is not set
588 565
@@ -592,6 +569,7 @@ CONFIG_INPUT=y
592# CONFIG_INPUT_KEYBOARD is not set 569# CONFIG_INPUT_KEYBOARD is not set
593# CONFIG_INPUT_MOUSE is not set 570# CONFIG_INPUT_MOUSE is not set
594# CONFIG_INPUT_JOYSTICK is not set 571# CONFIG_INPUT_JOYSTICK is not set
572# CONFIG_INPUT_TABLET is not set
595# CONFIG_INPUT_TOUCHSCREEN is not set 573# CONFIG_INPUT_TOUCHSCREEN is not set
596# CONFIG_INPUT_MISC is not set 574# CONFIG_INPUT_MISC is not set
597 575
@@ -605,9 +583,11 @@ CONFIG_INPUT=y
605# Character devices 583# Character devices
606# 584#
607CONFIG_VT=y 585CONFIG_VT=y
586CONFIG_CONSOLE_TRANSLATIONS=y
608CONFIG_VT_CONSOLE=y 587CONFIG_VT_CONSOLE=y
609CONFIG_HW_CONSOLE=y 588CONFIG_HW_CONSOLE=y
610# CONFIG_VT_HW_CONSOLE_BINDING is not set 589# CONFIG_VT_HW_CONSOLE_BINDING is not set
590CONFIG_DEVKMEM=y
611# CONFIG_SERIAL_NONSTANDARD is not set 591# CONFIG_SERIAL_NONSTANDARD is not set
612 592
613# 593#
@@ -626,156 +606,106 @@ CONFIG_SERIAL_CORE_CONSOLE=y
626# CONFIG_UNIX98_PTYS is not set 606# CONFIG_UNIX98_PTYS is not set
627CONFIG_LEGACY_PTYS=y 607CONFIG_LEGACY_PTYS=y
628CONFIG_LEGACY_PTY_COUNT=256 608CONFIG_LEGACY_PTY_COUNT=256
629
630#
631# IPMI
632#
633# CONFIG_IPMI_HANDLER is not set 609# CONFIG_IPMI_HANDLER is not set
634
635#
636# Watchdog Cards
637#
638# CONFIG_WATCHDOG is not set
639CONFIG_HW_RANDOM=y 610CONFIG_HW_RANDOM=y
640# CONFIG_GEN_RTC is not set
641# CONFIG_DTLK is not set
642# CONFIG_R3964 is not set 611# CONFIG_R3964 is not set
643
644#
645# Ftape, the floppy tape device driver
646#
647# CONFIG_RAW_DRIVER is not set 612# CONFIG_RAW_DRIVER is not set
648
649#
650# TPM devices
651#
652# CONFIG_TCG_TPM is not set 613# CONFIG_TCG_TPM is not set
653# CONFIG_TELCLOCK is not set 614# CONFIG_I2C is not set
654
655#
656# I2C support
657#
658CONFIG_I2C=y
659CONFIG_I2C_CHARDEV=y
660
661#
662# I2C Algorithms
663#
664# CONFIG_I2C_ALGOBIT is not set
665# CONFIG_I2C_ALGOPCF is not set
666# CONFIG_I2C_ALGOPCA is not set
667
668#
669# I2C Hardware Bus support
670#
671# CONFIG_I2C_OCORES is not set
672# CONFIG_I2C_PARPORT_LIGHT is not set
673# CONFIG_I2C_STUB is not set
674# CONFIG_I2C_PCA_ISA is not set
675
676#
677# Miscellaneous I2C Chip support
678#
679# CONFIG_SENSORS_DS1337 is not set
680# CONFIG_SENSORS_DS1374 is not set
681# CONFIG_SENSORS_EEPROM is not set
682# CONFIG_SENSORS_PCF8574 is not set
683# CONFIG_SENSORS_PCA9539 is not set
684# CONFIG_SENSORS_PCF8591 is not set
685# CONFIG_SENSORS_MAX6875 is not set
686# CONFIG_I2C_DEBUG_CORE is not set
687# CONFIG_I2C_DEBUG_ALGO is not set
688# CONFIG_I2C_DEBUG_BUS is not set
689# CONFIG_I2C_DEBUG_CHIP is not set
690
691#
692# SPI support
693#
694# CONFIG_SPI is not set 615# CONFIG_SPI is not set
695# CONFIG_SPI_MASTER is not set 616# CONFIG_W1 is not set
617# CONFIG_POWER_SUPPLY is not set
618# CONFIG_HWMON is not set
619# CONFIG_THERMAL is not set
620# CONFIG_THERMAL_HWMON is not set
621# CONFIG_WATCHDOG is not set
696 622
697# 623#
698# Dallas's 1-wire bus 624# Sonics Silicon Backplane
699# 625#
626CONFIG_SSB_POSSIBLE=y
627# CONFIG_SSB is not set
700 628
701# 629#
702# Hardware Monitoring support 630# Multifunction device drivers
703# 631#
704# CONFIG_HWMON is not set 632# CONFIG_MFD_CORE is not set
705# CONFIG_HWMON_VID is not set 633# CONFIG_MFD_SM501 is not set
634# CONFIG_HTC_PASIC3 is not set
706 635
707# 636#
708# Misc devices 637# Multimedia devices
709# 638#
710 639
711# 640#
712# Multimedia devices 641# Multimedia core support
713# 642#
714CONFIG_VIDEO_DEV=y 643CONFIG_VIDEO_DEV=y
715CONFIG_VIDEO_V4L1=y 644CONFIG_VIDEO_V4L2_COMMON=y
645CONFIG_VIDEO_ALLOW_V4L1=y
716CONFIG_VIDEO_V4L1_COMPAT=y 646CONFIG_VIDEO_V4L1_COMPAT=y
717CONFIG_VIDEO_V4L2=y 647# CONFIG_DVB_CORE is not set
648CONFIG_VIDEO_MEDIA=y
718 649
719# 650#
720# Video Capture Adapters 651# Multimedia drivers
721#
722
723#
724# Video Capture Adapters
725# 652#
653# CONFIG_MEDIA_ATTACH is not set
654CONFIG_VIDEO_V4L2=y
655CONFIG_VIDEO_V4L1=y
656CONFIG_VIDEO_CAPTURE_DRIVERS=y
726# CONFIG_VIDEO_ADV_DEBUG is not set 657# CONFIG_VIDEO_ADV_DEBUG is not set
727CONFIG_VIDEO_HELPER_CHIPS_AUTO=y 658CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
728# CONFIG_VIDEO_VIVI is not set 659# CONFIG_VIDEO_VIVI is not set
729# CONFIG_VIDEO_CPIA is not set 660# CONFIG_VIDEO_CPIA is not set
730# CONFIG_VIDEO_SAA5246A is not set 661# CONFIG_SOC_CAMERA is not set
731# CONFIG_VIDEO_SAA5249 is not set 662# CONFIG_VIDEO_SH_MOBILE_CEU is not set
732# CONFIG_TUNER_3036 is not set 663CONFIG_RADIO_ADAPTERS=y
733 664# CONFIG_DAB is not set
734#
735# Radio Adapters
736#
737
738#
739# Digital Video Broadcasting Devices
740#
741# CONFIG_DVB is not set
742 665
743# 666#
744# Graphics support 667# Graphics support
745# 668#
746CONFIG_FIRMWARE_EDID=y 669# CONFIG_VGASTATE is not set
670# CONFIG_VIDEO_OUTPUT_CONTROL is not set
747CONFIG_FB=y 671CONFIG_FB=y
748# CONFIG_FB_CFB_FILLRECT is not set 672CONFIG_FIRMWARE_EDID=y
749# CONFIG_FB_CFB_COPYAREA is not set 673# CONFIG_FB_DDC is not set
750# CONFIG_FB_CFB_IMAGEBLIT is not set 674CONFIG_FB_CFB_FILLRECT=m
675CONFIG_FB_CFB_COPYAREA=m
676CONFIG_FB_CFB_IMAGEBLIT=m
677# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
678# CONFIG_FB_SYS_FILLRECT is not set
679# CONFIG_FB_SYS_COPYAREA is not set
680# CONFIG_FB_SYS_IMAGEBLIT is not set
681# CONFIG_FB_FOREIGN_ENDIAN is not set
682# CONFIG_FB_SYS_FOPS is not set
683# CONFIG_FB_SVGALIB is not set
751# CONFIG_FB_MACMODES is not set 684# CONFIG_FB_MACMODES is not set
752# CONFIG_FB_BACKLIGHT is not set 685# CONFIG_FB_BACKLIGHT is not set
753# CONFIG_FB_MODE_HELPERS is not set 686# CONFIG_FB_MODE_HELPERS is not set
754# CONFIG_FB_TILEBLITTING is not set 687# CONFIG_FB_TILEBLITTING is not set
755# CONFIG_FB_EPSON1355 is not set
756# CONFIG_FB_S1D13XXX is not set
757# CONFIG_FB_VIRTUAL is not set
758 688
759# 689#
760# Console display driver support 690# Frame buffer hardware drivers
761# 691#
762CONFIG_DUMMY_CONSOLE=y 692# CONFIG_FB_S1D13XXX is not set
763# CONFIG_FRAMEBUFFER_CONSOLE is not set 693CONFIG_FB_SH_MOBILE_LCDC=m
764 694# CONFIG_FB_VIRTUAL is not set
765#
766# Logo configuration
767#
768# CONFIG_LOGO is not set
769# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 695# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
770 696
771# 697#
772# Sound 698# Display device support
773# 699#
774CONFIG_SOUND=y 700# CONFIG_DISPLAY_SUPPORT is not set
775 701
776# 702#
777# Advanced Linux Sound Architecture 703# Console display driver support
778# 704#
705CONFIG_DUMMY_CONSOLE=y
706# CONFIG_FRAMEBUFFER_CONSOLE is not set
707# CONFIG_LOGO is not set
708CONFIG_SOUND=y
779CONFIG_SND=y 709CONFIG_SND=y
780CONFIG_SND_TIMER=y 710CONFIG_SND_TIMER=y
781CONFIG_SND_PCM=y 711CONFIG_SND_PCM=y
@@ -791,96 +721,49 @@ CONFIG_SND_SUPPORT_OLD_API=y
791CONFIG_SND_VERBOSE_PROCFS=y 721CONFIG_SND_VERBOSE_PROCFS=y
792# CONFIG_SND_VERBOSE_PRINTK is not set 722# CONFIG_SND_VERBOSE_PRINTK is not set
793# CONFIG_SND_DEBUG is not set 723# CONFIG_SND_DEBUG is not set
794 724CONFIG_SND_DRIVERS=y
795#
796# Generic devices
797#
798# CONFIG_SND_DUMMY is not set 725# CONFIG_SND_DUMMY is not set
799# CONFIG_SND_VIRMIDI is not set 726# CONFIG_SND_VIRMIDI is not set
800# CONFIG_SND_MTPAV is not set 727# CONFIG_SND_MTPAV is not set
801# CONFIG_SND_SERIAL_U16550 is not set 728# CONFIG_SND_SERIAL_U16550 is not set
802# CONFIG_SND_MPU401 is not set 729# CONFIG_SND_MPU401 is not set
803 730CONFIG_SND_SUPERH=y
804# 731# CONFIG_SND_SOC is not set
805# Open Sound System
806#
807# CONFIG_SOUND_PRIME is not set 732# CONFIG_SOUND_PRIME is not set
808 733CONFIG_HID_SUPPORT=y
809# 734CONFIG_HID=y
810# USB support 735# CONFIG_HID_DEBUG is not set
811# 736# CONFIG_HIDRAW is not set
812# CONFIG_USB_ARCH_HAS_HCD is not set 737# CONFIG_USB_SUPPORT is not set
813# CONFIG_USB_ARCH_HAS_OHCI is not set
814# CONFIG_USB_ARCH_HAS_EHCI is not set
815
816#
817# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
818#
819
820#
821# USB Gadget Support
822#
823# CONFIG_USB_GADGET is not set
824
825#
826# MMC/SD Card support
827#
828# CONFIG_MMC is not set 738# CONFIG_MMC is not set
829 739# CONFIG_MEMSTICK is not set
830#
831# LED devices
832#
833# CONFIG_NEW_LEDS is not set 740# CONFIG_NEW_LEDS is not set
834 741# CONFIG_ACCESSIBILITY is not set
835#
836# LED drivers
837#
838
839#
840# LED Triggers
841#
842
843#
844# InfiniBand support
845#
846
847#
848# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
849#
850
851#
852# Real Time Clock
853#
854# CONFIG_RTC_CLASS is not set 742# CONFIG_RTC_CLASS is not set
855 743# CONFIG_DMADEVICES is not set
856# 744# CONFIG_UIO is not set
857# DMA Engine support
858#
859# CONFIG_DMA_ENGINE is not set
860
861#
862# DMA Clients
863#
864
865#
866# DMA Devices
867#
868 745
869# 746#
870# File systems 747# File systems
871# 748#
872# CONFIG_EXT2_FS is not set 749CONFIG_EXT2_FS=y
873# CONFIG_EXT3_FS is not set 750# CONFIG_EXT2_FS_XATTR is not set
751# CONFIG_EXT2_FS_XIP is not set
752CONFIG_EXT3_FS=y
753CONFIG_EXT3_FS_XATTR=y
754# CONFIG_EXT3_FS_POSIX_ACL is not set
755# CONFIG_EXT3_FS_SECURITY is not set
756# CONFIG_EXT4DEV_FS is not set
757CONFIG_JBD=y
758CONFIG_FS_MBCACHE=y
874# CONFIG_REISERFS_FS is not set 759# CONFIG_REISERFS_FS is not set
875# CONFIG_JFS_FS is not set 760# CONFIG_JFS_FS is not set
876# CONFIG_FS_POSIX_ACL is not set 761# CONFIG_FS_POSIX_ACL is not set
877# CONFIG_XFS_FS is not set 762# CONFIG_XFS_FS is not set
878# CONFIG_OCFS2_FS is not set 763# CONFIG_OCFS2_FS is not set
879# CONFIG_MINIX_FS is not set 764# CONFIG_DNOTIFY is not set
880# CONFIG_ROMFS_FS is not set
881# CONFIG_INOTIFY is not set 765# CONFIG_INOTIFY is not set
882# CONFIG_QUOTA is not set 766# CONFIG_QUOTA is not set
883# CONFIG_DNOTIFY is not set
884# CONFIG_AUTOFS_FS is not set 767# CONFIG_AUTOFS_FS is not set
885# CONFIG_AUTOFS4_FS is not set 768# CONFIG_AUTOFS4_FS is not set
886# CONFIG_FUSE_FS is not set 769# CONFIG_FUSE_FS is not set
@@ -909,7 +792,6 @@ CONFIG_TMPFS=y
909# CONFIG_TMPFS_POSIX_ACL is not set 792# CONFIG_TMPFS_POSIX_ACL is not set
910# CONFIG_HUGETLBFS is not set 793# CONFIG_HUGETLBFS is not set
911# CONFIG_HUGETLB_PAGE is not set 794# CONFIG_HUGETLB_PAGE is not set
912CONFIG_RAMFS=y
913# CONFIG_CONFIGFS_FS is not set 795# CONFIG_CONFIGFS_FS is not set
914 796
915# 797#
@@ -922,35 +804,34 @@ CONFIG_RAMFS=y
922# CONFIG_BEFS_FS is not set 804# CONFIG_BEFS_FS is not set
923# CONFIG_BFS_FS is not set 805# CONFIG_BFS_FS is not set
924# CONFIG_EFS_FS is not set 806# CONFIG_EFS_FS is not set
925# CONFIG_JFFS_FS is not set
926CONFIG_JFFS2_FS=y 807CONFIG_JFFS2_FS=y
927CONFIG_JFFS2_FS_DEBUG=0 808CONFIG_JFFS2_FS_DEBUG=0
928CONFIG_JFFS2_FS_WRITEBUFFER=y 809CONFIG_JFFS2_FS_WRITEBUFFER=y
810# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
929# CONFIG_JFFS2_SUMMARY is not set 811# CONFIG_JFFS2_SUMMARY is not set
930# CONFIG_JFFS2_FS_XATTR is not set 812# CONFIG_JFFS2_FS_XATTR is not set
931# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 813# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
932CONFIG_JFFS2_ZLIB=y 814CONFIG_JFFS2_ZLIB=y
815# CONFIG_JFFS2_LZO is not set
933CONFIG_JFFS2_RTIME=y 816CONFIG_JFFS2_RTIME=y
934# CONFIG_JFFS2_RUBIN is not set 817# CONFIG_JFFS2_RUBIN is not set
935# CONFIG_CRAMFS is not set 818CONFIG_CRAMFS=y
936# CONFIG_VXFS_FS is not set 819# CONFIG_VXFS_FS is not set
820# CONFIG_MINIX_FS is not set
821# CONFIG_OMFS_FS is not set
937# CONFIG_HPFS_FS is not set 822# CONFIG_HPFS_FS is not set
938# CONFIG_QNX4FS_FS is not set 823# CONFIG_QNX4FS_FS is not set
824# CONFIG_ROMFS_FS is not set
939# CONFIG_SYSV_FS is not set 825# CONFIG_SYSV_FS is not set
940# CONFIG_UFS_FS is not set 826# CONFIG_UFS_FS is not set
941 827CONFIG_NETWORK_FILESYSTEMS=y
942#
943# Network File Systems
944#
945CONFIG_NFS_FS=y 828CONFIG_NFS_FS=y
946CONFIG_NFS_V3=y 829CONFIG_NFS_V3=y
947# CONFIG_NFS_V3_ACL is not set 830# CONFIG_NFS_V3_ACL is not set
948# CONFIG_NFS_V4 is not set 831# CONFIG_NFS_V4 is not set
949# CONFIG_NFS_DIRECTIO is not set
950CONFIG_NFSD=y 832CONFIG_NFSD=y
951# CONFIG_NFSD_V3 is not set 833# CONFIG_NFSD_V3 is not set
952# CONFIG_NFSD_TCP is not set 834# CONFIG_NFSD_V4 is not set
953CONFIG_ROOT_NFS=y
954CONFIG_LOCKD=y 835CONFIG_LOCKD=y
955CONFIG_LOCKD_V4=y 836CONFIG_LOCKD_V4=y
956CONFIG_EXPORTFS=y 837CONFIG_EXPORTFS=y
@@ -963,56 +844,136 @@ CONFIG_SUNRPC=y
963# CONFIG_NCP_FS is not set 844# CONFIG_NCP_FS is not set
964# CONFIG_CODA_FS is not set 845# CONFIG_CODA_FS is not set
965# CONFIG_AFS_FS is not set 846# CONFIG_AFS_FS is not set
966# CONFIG_9P_FS is not set
967 847
968# 848#
969# Partition Types 849# Partition Types
970# 850#
971# CONFIG_PARTITION_ADVANCED is not set 851# CONFIG_PARTITION_ADVANCED is not set
972CONFIG_MSDOS_PARTITION=y 852CONFIG_MSDOS_PARTITION=y
973
974#
975# Native Language Support
976#
977# CONFIG_NLS is not set 853# CONFIG_NLS is not set
978 854# CONFIG_DLM is not set
979#
980# Profiling support
981#
982# CONFIG_PROFILING is not set
983 855
984# 856#
985# Kernel hacking 857# Kernel hacking
986# 858#
859CONFIG_TRACE_IRQFLAGS_SUPPORT=y
987# CONFIG_PRINTK_TIME is not set 860# CONFIG_PRINTK_TIME is not set
861CONFIG_ENABLE_WARN_DEPRECATED=y
988CONFIG_ENABLE_MUST_CHECK=y 862CONFIG_ENABLE_MUST_CHECK=y
863CONFIG_FRAME_WARN=1024
989# CONFIG_MAGIC_SYSRQ is not set 864# CONFIG_MAGIC_SYSRQ is not set
990# CONFIG_UNUSED_SYMBOLS is not set 865# CONFIG_UNUSED_SYMBOLS is not set
866# CONFIG_DEBUG_FS is not set
867# CONFIG_HEADERS_CHECK is not set
991# CONFIG_DEBUG_KERNEL is not set 868# CONFIG_DEBUG_KERNEL is not set
992CONFIG_LOG_BUF_SHIFT=14
993# CONFIG_DEBUG_BUGVERBOSE is not set 869# CONFIG_DEBUG_BUGVERBOSE is not set
994# CONFIG_DEBUG_FS is not set 870# CONFIG_DEBUG_MEMORY_INIT is not set
871# CONFIG_SAMPLES is not set
995# CONFIG_SH_STANDARD_BIOS is not set 872# CONFIG_SH_STANDARD_BIOS is not set
996# CONFIG_EARLY_SCIF_CONSOLE is not set 873CONFIG_EARLY_SCIF_CONSOLE=y
997# CONFIG_KGDB is not set 874CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe00000
875CONFIG_EARLY_PRINTK=y
876# CONFIG_SH_KGDB is not set
998 877
999# 878#
1000# Security options 879# Security options
1001# 880#
1002# CONFIG_KEYS is not set 881# CONFIG_KEYS is not set
1003# CONFIG_SECURITY is not set 882# CONFIG_SECURITY is not set
883# CONFIG_SECURITY_FILE_CAPABILITIES is not set
884CONFIG_CRYPTO=y
885
886#
887# Crypto core or helper
888#
889# CONFIG_CRYPTO_MANAGER is not set
890# CONFIG_CRYPTO_GF128MUL is not set
891# CONFIG_CRYPTO_NULL is not set
892# CONFIG_CRYPTO_CRYPTD is not set
893# CONFIG_CRYPTO_AUTHENC is not set
894# CONFIG_CRYPTO_TEST is not set
895
896#
897# Authenticated Encryption with Associated Data
898#
899# CONFIG_CRYPTO_CCM is not set
900# CONFIG_CRYPTO_GCM is not set
901# CONFIG_CRYPTO_SEQIV is not set
902
903#
904# Block modes
905#
906# CONFIG_CRYPTO_CBC is not set
907# CONFIG_CRYPTO_CTR is not set
908# CONFIG_CRYPTO_CTS is not set
909# CONFIG_CRYPTO_ECB is not set
910# CONFIG_CRYPTO_LRW is not set
911# CONFIG_CRYPTO_PCBC is not set
912# CONFIG_CRYPTO_XTS is not set
913
914#
915# Hash modes
916#
917# CONFIG_CRYPTO_HMAC is not set
918# CONFIG_CRYPTO_XCBC is not set
919
920#
921# Digest
922#
923# CONFIG_CRYPTO_CRC32C is not set
924# CONFIG_CRYPTO_MD4 is not set
925# CONFIG_CRYPTO_MD5 is not set
926# CONFIG_CRYPTO_MICHAEL_MIC is not set
927# CONFIG_CRYPTO_RMD128 is not set
928# CONFIG_CRYPTO_RMD160 is not set
929# CONFIG_CRYPTO_RMD256 is not set
930# CONFIG_CRYPTO_RMD320 is not set
931# CONFIG_CRYPTO_SHA1 is not set
932# CONFIG_CRYPTO_SHA256 is not set
933# CONFIG_CRYPTO_SHA512 is not set
934# CONFIG_CRYPTO_TGR192 is not set
935# CONFIG_CRYPTO_WP512 is not set
936
937#
938# Ciphers
939#
940# CONFIG_CRYPTO_AES is not set
941# CONFIG_CRYPTO_ANUBIS is not set
942# CONFIG_CRYPTO_ARC4 is not set
943# CONFIG_CRYPTO_BLOWFISH is not set
944# CONFIG_CRYPTO_CAMELLIA is not set
945# CONFIG_CRYPTO_CAST5 is not set
946# CONFIG_CRYPTO_CAST6 is not set
947# CONFIG_CRYPTO_DES is not set
948# CONFIG_CRYPTO_FCRYPT is not set
949# CONFIG_CRYPTO_KHAZAD is not set
950# CONFIG_CRYPTO_SALSA20 is not set
951# CONFIG_CRYPTO_SEED is not set
952# CONFIG_CRYPTO_SERPENT is not set
953# CONFIG_CRYPTO_TEA is not set
954# CONFIG_CRYPTO_TWOFISH is not set
1004 955
1005# 956#
1006# Cryptographic options 957# Compression
1007# 958#
1008# CONFIG_CRYPTO is not set 959# CONFIG_CRYPTO_DEFLATE is not set
960# CONFIG_CRYPTO_LZO is not set
961CONFIG_CRYPTO_HW=y
1009 962
1010# 963#
1011# Library routines 964# Library routines
1012# 965#
966CONFIG_BITREVERSE=y
967# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1013# CONFIG_CRC_CCITT is not set 968# CONFIG_CRC_CCITT is not set
1014# CONFIG_CRC16 is not set 969# CONFIG_CRC16 is not set
970# CONFIG_CRC_T10DIF is not set
971# CONFIG_CRC_ITU_T is not set
1015CONFIG_CRC32=y 972CONFIG_CRC32=y
973# CONFIG_CRC7 is not set
1016# CONFIG_LIBCRC32C is not set 974# CONFIG_LIBCRC32C is not set
1017CONFIG_ZLIB_INFLATE=y 975CONFIG_ZLIB_INFLATE=y
1018CONFIG_ZLIB_DEFLATE=y 976CONFIG_ZLIB_DEFLATE=y
977CONFIG_HAS_IOMEM=y
978CONFIG_HAS_IOPORT=y
979CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/se7619_defconfig b/arch/sh/configs/se7619_defconfig
index 3a3c3c1f507d..80c1c72edb56 100644
--- a/arch/sh/configs/se7619_defconfig
+++ b/arch/sh/configs/se7619_defconfig
@@ -1,9 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22-rc4 3# Linux kernel version: 2.6.26
4# Fri Jun 15 19:43:06 2007 4# Wed Jul 30 02:12:32 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_BUG=y 10CONFIG_GENERIC_BUG=y
9CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -17,27 +19,26 @@ CONFIG_STACKTRACE_SUPPORT=y
17CONFIG_LOCKDEP_SUPPORT=y 19CONFIG_LOCKDEP_SUPPORT=y
18# CONFIG_ARCH_HAS_ILOG2_U32 is not set 20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
19# CONFIG_ARCH_HAS_ILOG2_U64 is not set 21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y
23CONFIG_ARCH_SUPPORTS_AOUT=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 25
22# 26#
23# Code maturity level options 27# General setup
24# 28#
25CONFIG_EXPERIMENTAL=y 29CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 30CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32 31CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION="" 32CONFIG_LOCALVERSION=""
33# CONFIG_LOCALVERSION_AUTO is not set 33# CONFIG_LOCALVERSION_AUTO is not set
34# CONFIG_SYSVIPC is not set 34# CONFIG_SYSVIPC is not set
35# CONFIG_BSD_PROCESS_ACCT is not set 35# CONFIG_BSD_PROCESS_ACCT is not set
36# CONFIG_UTS_NS is not set
37# CONFIG_IKCONFIG is not set 36# CONFIG_IKCONFIG is not set
38CONFIG_LOG_BUF_SHIFT=14 37CONFIG_LOG_BUF_SHIFT=14
39CONFIG_SYSFS_DEPRECATED=y 38# CONFIG_CGROUPS is not set
39# CONFIG_GROUP_SCHED is not set
40# CONFIG_RELAY is not set 40# CONFIG_RELAY is not set
41# CONFIG_NAMESPACES is not set
41# CONFIG_BLK_DEV_INITRD is not set 42# CONFIG_BLK_DEV_INITRD is not set
42CONFIG_CC_OPTIMIZE_FOR_SIZE=y 43CONFIG_CC_OPTIMIZE_FOR_SIZE=y
43CONFIG_SYSCTL=y 44CONFIG_SYSCTL=y
@@ -49,6 +50,7 @@ CONFIG_EMBEDDED=y
49CONFIG_PRINTK=y 50CONFIG_PRINTK=y
50CONFIG_BUG=y 51CONFIG_BUG=y
51# CONFIG_ELF_CORE is not set 52# CONFIG_ELF_CORE is not set
53CONFIG_COMPAT_BRK=y
52# CONFIG_BASE_FULL is not set 54# CONFIG_BASE_FULL is not set
53# CONFIG_FUTEX is not set 55# CONFIG_FUTEX is not set
54CONFIG_ANON_INODES=y 56CONFIG_ANON_INODES=y
@@ -60,20 +62,26 @@ CONFIG_EVENTFD=y
60CONFIG_SLAB=y 62CONFIG_SLAB=y
61# CONFIG_SLUB is not set 63# CONFIG_SLUB is not set
62# CONFIG_SLOB is not set 64# CONFIG_SLOB is not set
65# CONFIG_PROFILING is not set
66# CONFIG_MARKERS is not set
67CONFIG_HAVE_OPROFILE=y
68# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
69# CONFIG_HAVE_IOREMAP_PROT is not set
70# CONFIG_HAVE_KPROBES is not set
71# CONFIG_HAVE_KRETPROBES is not set
72# CONFIG_HAVE_ARCH_TRACEHOOK is not set
73# CONFIG_HAVE_DMA_ATTRS is not set
74# CONFIG_USE_GENERIC_SMP_HELPERS is not set
75CONFIG_HAVE_CLK=y
76CONFIG_SLABINFO=y
63CONFIG_TINY_SHMEM=y 77CONFIG_TINY_SHMEM=y
64CONFIG_BASE_SMALL=1 78CONFIG_BASE_SMALL=1
65
66#
67# Loadable module support
68#
69# CONFIG_MODULES is not set 79# CONFIG_MODULES is not set
70
71#
72# Block layer
73#
74CONFIG_BLOCK=y 80CONFIG_BLOCK=y
75# CONFIG_LBD is not set 81# CONFIG_LBD is not set
76# CONFIG_LSF is not set 82# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set
84# CONFIG_BLK_DEV_INTEGRITY is not set
77 85
78# 86#
79# IO Schedulers 87# IO Schedulers
@@ -87,14 +95,17 @@ CONFIG_IOSCHED_NOOP=y
87# CONFIG_DEFAULT_CFQ is not set 95# CONFIG_DEFAULT_CFQ is not set
88CONFIG_DEFAULT_NOOP=y 96CONFIG_DEFAULT_NOOP=y
89CONFIG_DEFAULT_IOSCHED="noop" 97CONFIG_DEFAULT_IOSCHED="noop"
98CONFIG_CLASSIC_RCU=y
90 99
91# 100#
92# System type 101# System type
93# 102#
94CONFIG_CPU_SH2=y 103CONFIG_CPU_SH2=y
95CONFIG_CPU_SUBTYPE_SH7619=y 104CONFIG_CPU_SUBTYPE_SH7619=y
105# CONFIG_CPU_SUBTYPE_SH7203 is not set
96# CONFIG_CPU_SUBTYPE_SH7206 is not set 106# CONFIG_CPU_SUBTYPE_SH7206 is not set
97# CONFIG_CPU_SUBTYPE_SH7300 is not set 107# CONFIG_CPU_SUBTYPE_SH7263 is not set
108# CONFIG_CPU_SUBTYPE_MXG is not set
98# CONFIG_CPU_SUBTYPE_SH7705 is not set 109# CONFIG_CPU_SUBTYPE_SH7705 is not set
99# CONFIG_CPU_SUBTYPE_SH7706 is not set 110# CONFIG_CPU_SUBTYPE_SH7706 is not set
100# CONFIG_CPU_SUBTYPE_SH7707 is not set 111# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -102,6 +113,8 @@ CONFIG_CPU_SUBTYPE_SH7619=y
102# CONFIG_CPU_SUBTYPE_SH7709 is not set 113# CONFIG_CPU_SUBTYPE_SH7709 is not set
103# CONFIG_CPU_SUBTYPE_SH7710 is not set 114# CONFIG_CPU_SUBTYPE_SH7710 is not set
104# CONFIG_CPU_SUBTYPE_SH7712 is not set 115# CONFIG_CPU_SUBTYPE_SH7712 is not set
116# CONFIG_CPU_SUBTYPE_SH7720 is not set
117# CONFIG_CPU_SUBTYPE_SH7721 is not set
105# CONFIG_CPU_SUBTYPE_SH7750 is not set 118# CONFIG_CPU_SUBTYPE_SH7750 is not set
106# CONFIG_CPU_SUBTYPE_SH7091 is not set 119# CONFIG_CPU_SUBTYPE_SH7091 is not set
107# CONFIG_CPU_SUBTYPE_SH7750R is not set 120# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -110,14 +123,17 @@ CONFIG_CPU_SUBTYPE_SH7619=y
110# CONFIG_CPU_SUBTYPE_SH7751R is not set 123# CONFIG_CPU_SUBTYPE_SH7751R is not set
111# CONFIG_CPU_SUBTYPE_SH7760 is not set 124# CONFIG_CPU_SUBTYPE_SH7760 is not set
112# CONFIG_CPU_SUBTYPE_SH4_202 is not set 125# CONFIG_CPU_SUBTYPE_SH4_202 is not set
113# CONFIG_CPU_SUBTYPE_ST40STB1 is not set 126# CONFIG_CPU_SUBTYPE_SH7723 is not set
114# CONFIG_CPU_SUBTYPE_ST40GX1 is not set 127# CONFIG_CPU_SUBTYPE_SH7763 is not set
115# CONFIG_CPU_SUBTYPE_SH7770 is not set 128# CONFIG_CPU_SUBTYPE_SH7770 is not set
116# CONFIG_CPU_SUBTYPE_SH7780 is not set 129# CONFIG_CPU_SUBTYPE_SH7780 is not set
117# CONFIG_CPU_SUBTYPE_SH7785 is not set 130# CONFIG_CPU_SUBTYPE_SH7785 is not set
118# CONFIG_CPU_SUBTYPE_SH73180 is not set 131# CONFIG_CPU_SUBTYPE_SHX3 is not set
119# CONFIG_CPU_SUBTYPE_SH7343 is not set 132# CONFIG_CPU_SUBTYPE_SH7343 is not set
120# CONFIG_CPU_SUBTYPE_SH7722 is not set 133# CONFIG_CPU_SUBTYPE_SH7722 is not set
134# CONFIG_CPU_SUBTYPE_SH7366 is not set
135# CONFIG_CPU_SUBTYPE_SH5_101 is not set
136# CONFIG_CPU_SUBTYPE_SH5_103 is not set
121 137
122# 138#
123# Memory management options 139# Memory management options
@@ -126,6 +142,7 @@ CONFIG_QUICKLIST=y
126CONFIG_PAGE_OFFSET=0x00000000 142CONFIG_PAGE_OFFSET=0x00000000
127CONFIG_MEMORY_START=0x0c000000 143CONFIG_MEMORY_START=0x0c000000
128CONFIG_MEMORY_SIZE=0x04000000 144CONFIG_MEMORY_SIZE=0x04000000
145CONFIG_29BIT=y
129CONFIG_ARCH_FLATMEM_ENABLE=y 146CONFIG_ARCH_FLATMEM_ENABLE=y
130CONFIG_ARCH_SPARSEMEM_ENABLE=y 147CONFIG_ARCH_SPARSEMEM_ENABLE=y
131CONFIG_ARCH_SPARSEMEM_DEFAULT=y 148CONFIG_ARCH_SPARSEMEM_DEFAULT=y
@@ -134,7 +151,9 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
134CONFIG_ARCH_SELECT_MEMORY_MODEL=y 151CONFIG_ARCH_SELECT_MEMORY_MODEL=y
135CONFIG_PAGE_SIZE_4KB=y 152CONFIG_PAGE_SIZE_4KB=y
136# CONFIG_PAGE_SIZE_8KB is not set 153# CONFIG_PAGE_SIZE_8KB is not set
154# CONFIG_PAGE_SIZE_16KB is not set
137# CONFIG_PAGE_SIZE_64KB is not set 155# CONFIG_PAGE_SIZE_64KB is not set
156CONFIG_ENTRY_OFFSET=0x00001000
138CONFIG_SELECT_MEMORY_MODEL=y 157CONFIG_SELECT_MEMORY_MODEL=y
139CONFIG_FLATMEM_MANUAL=y 158CONFIG_FLATMEM_MANUAL=y
140# CONFIG_DISCONTIGMEM_MANUAL is not set 159# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -142,6 +161,8 @@ CONFIG_FLATMEM_MANUAL=y
142CONFIG_FLATMEM=y 161CONFIG_FLATMEM=y
143CONFIG_FLAT_NODE_MEM_MAP=y 162CONFIG_FLAT_NODE_MEM_MAP=y
144CONFIG_SPARSEMEM_STATIC=y 163CONFIG_SPARSEMEM_STATIC=y
164# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
165CONFIG_PAGEFLAGS_EXTENDED=y
145CONFIG_SPLIT_PTLOCK_CPUS=4 166CONFIG_SPLIT_PTLOCK_CPUS=4
146# CONFIG_RESOURCES_64BIT is not set 167# CONFIG_RESOURCES_64BIT is not set
147CONFIG_ZONE_DMA_FLAG=0 168CONFIG_ZONE_DMA_FLAG=0
@@ -151,7 +172,9 @@ CONFIG_NR_QUICK=2
151# Cache configuration 172# Cache configuration
152# 173#
153# CONFIG_SH_DIRECT_MAPPED is not set 174# CONFIG_SH_DIRECT_MAPPED is not set
154CONFIG_SH_WRITETHROUGH=y 175# CONFIG_CACHE_WRITEBACK is not set
176CONFIG_CACHE_WRITETHROUGH=y
177# CONFIG_CACHE_OFF is not set
155 178
156# 179#
157# Processor features 180# Processor features
@@ -159,8 +182,6 @@ CONFIG_SH_WRITETHROUGH=y
159# CONFIG_CPU_LITTLE_ENDIAN is not set 182# CONFIG_CPU_LITTLE_ENDIAN is not set
160CONFIG_CPU_BIG_ENDIAN=y 183CONFIG_CPU_BIG_ENDIAN=y
161# CONFIG_SH_FPU_EMU is not set 184# CONFIG_SH_FPU_EMU is not set
162# CONFIG_SH_DSP is not set
163CONFIG_CPU_HAS_IPR_IRQ=y
164 185
165# 186#
166# Board support 187# Board support
@@ -185,7 +206,6 @@ CONFIG_SH_CLK_MD=5
185# 206#
186# DMA support 207# DMA support
187# 208#
188# CONFIG_SH_DMA is not set
189 209
190# 210#
191# Companion Chips 211# Companion Chips
@@ -205,11 +225,13 @@ CONFIG_HZ_100=y
205# CONFIG_HZ_300 is not set 225# CONFIG_HZ_300 is not set
206# CONFIG_HZ_1000 is not set 226# CONFIG_HZ_1000 is not set
207CONFIG_HZ=100 227CONFIG_HZ=100
228# CONFIG_SCHED_HRTICK is not set
208# CONFIG_KEXEC is not set 229# CONFIG_KEXEC is not set
209# CONFIG_CRASH_DUMP is not set 230# CONFIG_CRASH_DUMP is not set
210CONFIG_PREEMPT_NONE=y 231CONFIG_PREEMPT_NONE=y
211# CONFIG_PREEMPT_VOLUNTARY is not set 232# CONFIG_PREEMPT_VOLUNTARY is not set
212# CONFIG_PREEMPT is not set 233# CONFIG_PREEMPT is not set
234CONFIG_GUSA=y
213 235
214# 236#
215# Boot options 237# Boot options
@@ -221,15 +243,13 @@ CONFIG_BOOT_LINK_OFFSET=0x00800000
221# 243#
222# Bus options 244# Bus options
223# 245#
246# CONFIG_CF_ENABLER is not set
224# CONFIG_ARCH_SUPPORTS_MSI is not set 247# CONFIG_ARCH_SUPPORTS_MSI is not set
225 248
226# 249#
227# PCCARD (PCMCIA/CardBus) support
228#
229
230#
231# Executable file formats 250# Executable file formats
232# 251#
252CONFIG_BINFMT_ELF_FDPIC=y
233CONFIG_BINFMT_FLAT=y 253CONFIG_BINFMT_FLAT=y
234CONFIG_BINFMT_ZFLAT=y 254CONFIG_BINFMT_ZFLAT=y
235# CONFIG_BINFMT_SHARED_FLAT is not set 255# CONFIG_BINFMT_SHARED_FLAT is not set
@@ -250,10 +270,6 @@ CONFIG_BINFMT_ZFLAT=y
250# CONFIG_STANDALONE is not set 270# CONFIG_STANDALONE is not set
251# CONFIG_PREVENT_FIRMWARE_BUILD is not set 271# CONFIG_PREVENT_FIRMWARE_BUILD is not set
252# CONFIG_SYS_HYPERVISOR is not set 272# CONFIG_SYS_HYPERVISOR is not set
253
254#
255# Connector - unified userspace <-> kernelspace linker
256#
257CONFIG_MTD=y 273CONFIG_MTD=y
258# CONFIG_MTD_DEBUG is not set 274# CONFIG_MTD_DEBUG is not set
259CONFIG_MTD_CONCAT=y 275CONFIG_MTD_CONCAT=y
@@ -263,6 +279,7 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
263# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set 279# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
264# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set 280# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
265# CONFIG_MTD_CMDLINE_PARTS is not set 281# CONFIG_MTD_CMDLINE_PARTS is not set
282# CONFIG_MTD_AR7_PARTS is not set
266 283
267# 284#
268# User Modules And Translation Layers 285# User Modules And Translation Layers
@@ -275,6 +292,7 @@ CONFIG_MTD_BLOCK=y
275# CONFIG_INFTL is not set 292# CONFIG_INFTL is not set
276# CONFIG_RFD_FTL is not set 293# CONFIG_RFD_FTL is not set
277# CONFIG_SSFDC is not set 294# CONFIG_SSFDC is not set
295# CONFIG_MTD_OOPS is not set
278 296
279# 297#
280# RAM/ROM/Flash chip drivers 298# RAM/ROM/Flash chip drivers
@@ -334,29 +352,17 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
334# UBI - Unsorted block images 352# UBI - Unsorted block images
335# 353#
336# CONFIG_MTD_UBI is not set 354# CONFIG_MTD_UBI is not set
337
338#
339# Parallel port support
340#
341# CONFIG_PARPORT is not set 355# CONFIG_PARPORT is not set
342 356CONFIG_BLK_DEV=y
343#
344# Plug and Play support
345#
346# CONFIG_PNPACPI is not set
347
348#
349# Block devices
350#
351# CONFIG_BLK_DEV_COW_COMMON is not set 357# CONFIG_BLK_DEV_COW_COMMON is not set
352# CONFIG_BLK_DEV_LOOP is not set 358# CONFIG_BLK_DEV_LOOP is not set
353# CONFIG_BLK_DEV_RAM is not set 359# CONFIG_BLK_DEV_RAM is not set
354# CONFIG_CDROM_PKTCDVD is not set 360# CONFIG_CDROM_PKTCDVD is not set
355 361# CONFIG_BLK_DEV_HD is not set
356# 362CONFIG_MISC_DEVICES=y
357# Misc devices 363# CONFIG_EEPROM_93CX6 is not set
358# 364# CONFIG_ENCLOSURE_SERVICES is not set
359# CONFIG_BLINK is not set 365CONFIG_HAVE_IDE=y
360# CONFIG_IDE is not set 366# CONFIG_IDE is not set
361 367
362# 368#
@@ -364,21 +370,10 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
364# 370#
365# CONFIG_RAID_ATTRS is not set 371# CONFIG_RAID_ATTRS is not set
366# CONFIG_SCSI is not set 372# CONFIG_SCSI is not set
373# CONFIG_SCSI_DMA is not set
367# CONFIG_SCSI_NETLINK is not set 374# CONFIG_SCSI_NETLINK is not set
368# CONFIG_ATA is not set 375# CONFIG_ATA is not set
369
370#
371# Multi-device support (RAID and LVM)
372#
373# CONFIG_MD is not set 376# CONFIG_MD is not set
374
375#
376# ISDN subsystem
377#
378
379#
380# Telephony Support
381#
382# CONFIG_PHONE is not set 377# CONFIG_PHONE is not set
383 378
384# 379#
@@ -386,13 +381,13 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
386# 381#
387CONFIG_INPUT=y 382CONFIG_INPUT=y
388# CONFIG_INPUT_FF_MEMLESS is not set 383# CONFIG_INPUT_FF_MEMLESS is not set
384# CONFIG_INPUT_POLLDEV is not set
389 385
390# 386#
391# Userland interfaces 387# Userland interfaces
392# 388#
393# CONFIG_INPUT_MOUSEDEV is not set 389# CONFIG_INPUT_MOUSEDEV is not set
394# CONFIG_INPUT_JOYDEV is not set 390# CONFIG_INPUT_JOYDEV is not set
395# CONFIG_INPUT_TSDEV is not set
396# CONFIG_INPUT_EVDEV is not set 391# CONFIG_INPUT_EVDEV is not set
397# CONFIG_INPUT_EVBUG is not set 392# CONFIG_INPUT_EVBUG is not set
398 393
@@ -416,6 +411,7 @@ CONFIG_INPUT=y
416# Character devices 411# Character devices
417# 412#
418# CONFIG_VT is not set 413# CONFIG_VT is not set
414CONFIG_DEVKMEM=y
419# CONFIG_SERIAL_NONSTANDARD is not set 415# CONFIG_SERIAL_NONSTANDARD is not set
420 416
421# 417#
@@ -433,123 +429,84 @@ CONFIG_SERIAL_CORE=y
433CONFIG_SERIAL_CORE_CONSOLE=y 429CONFIG_SERIAL_CORE_CONSOLE=y
434# CONFIG_UNIX98_PTYS is not set 430# CONFIG_UNIX98_PTYS is not set
435# CONFIG_LEGACY_PTYS is not set 431# CONFIG_LEGACY_PTYS is not set
436
437#
438# IPMI
439#
440# CONFIG_IPMI_HANDLER is not set 432# CONFIG_IPMI_HANDLER is not set
441# CONFIG_WATCHDOG is not set
442# CONFIG_HW_RANDOM is not set 433# CONFIG_HW_RANDOM is not set
443# CONFIG_R3964 is not set 434# CONFIG_R3964 is not set
444# CONFIG_RAW_DRIVER is not set 435# CONFIG_RAW_DRIVER is not set
445
446#
447# TPM devices
448#
449# CONFIG_TCG_TPM is not set 436# CONFIG_TCG_TPM is not set
450# CONFIG_I2C is not set 437# CONFIG_I2C is not set
451
452#
453# SPI support
454#
455# CONFIG_SPI is not set 438# CONFIG_SPI is not set
456# CONFIG_SPI_MASTER is not set 439# CONFIG_W1 is not set
440# CONFIG_POWER_SUPPLY is not set
441# CONFIG_HWMON is not set
442# CONFIG_THERMAL is not set
443# CONFIG_THERMAL_HWMON is not set
444# CONFIG_WATCHDOG is not set
457 445
458# 446#
459# Dallas's 1-wire bus 447# Sonics Silicon Backplane
460# 448#
461# CONFIG_W1 is not set 449CONFIG_SSB_POSSIBLE=y
462# CONFIG_HWMON is not set 450# CONFIG_SSB is not set
463 451
464# 452#
465# Multifunction device drivers 453# Multifunction device drivers
466# 454#
455# CONFIG_MFD_CORE is not set
467# CONFIG_MFD_SM501 is not set 456# CONFIG_MFD_SM501 is not set
457# CONFIG_HTC_PASIC3 is not set
468 458
469# 459#
470# Multimedia devices 460# Multimedia devices
471# 461#
462
463#
464# Multimedia core support
465#
472# CONFIG_VIDEO_DEV is not set 466# CONFIG_VIDEO_DEV is not set
473CONFIG_DAB=y 467# CONFIG_VIDEO_MEDIA is not set
474 468
475# 469#
476# Graphics support 470# Multimedia drivers
477# 471#
478# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 472CONFIG_DAB=y
479 473
480# 474#
481# Display device support 475# Graphics support
482# 476#
483# CONFIG_DISPLAY_SUPPORT is not set
484# CONFIG_VGASTATE is not set 477# CONFIG_VGASTATE is not set
478# CONFIG_VIDEO_OUTPUT_CONTROL is not set
485# CONFIG_FB is not set 479# CONFIG_FB is not set
480# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
486 481
487# 482#
488# Sound 483# Display device support
489# 484#
485# CONFIG_DISPLAY_SUPPORT is not set
490# CONFIG_SOUND is not set 486# CONFIG_SOUND is not set
491 487CONFIG_HID_SUPPORT=y
492#
493# HID Devices
494#
495CONFIG_HID=y 488CONFIG_HID=y
496# CONFIG_HID_DEBUG is not set 489# CONFIG_HID_DEBUG is not set
497 490# CONFIG_HIDRAW is not set
498# 491CONFIG_USB_SUPPORT=y
499# USB support 492CONFIG_USB_ARCH_HAS_HCD=y
500#
501# CONFIG_USB_ARCH_HAS_HCD is not set
502# CONFIG_USB_ARCH_HAS_OHCI is not set 493# CONFIG_USB_ARCH_HAS_OHCI is not set
503# CONFIG_USB_ARCH_HAS_EHCI is not set 494# CONFIG_USB_ARCH_HAS_EHCI is not set
495# CONFIG_USB is not set
496# CONFIG_USB_OTG_WHITELIST is not set
497# CONFIG_USB_OTG_BLACKLIST_HUB is not set
504 498
505# 499#
506# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 500# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
507# 501#
508
509#
510# USB Gadget Support
511#
512# CONFIG_USB_GADGET is not set 502# CONFIG_USB_GADGET is not set
513# CONFIG_MMC is not set 503# CONFIG_MMC is not set
514 504# CONFIG_MEMSTICK is not set
515#
516# LED devices
517#
518# CONFIG_NEW_LEDS is not set 505# CONFIG_NEW_LEDS is not set
519 506# CONFIG_ACCESSIBILITY is not set
520#
521# LED drivers
522#
523
524#
525# LED Triggers
526#
527
528#
529# InfiniBand support
530#
531
532#
533# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
534#
535
536#
537# Real Time Clock
538#
539# CONFIG_RTC_CLASS is not set 507# CONFIG_RTC_CLASS is not set
540 508# CONFIG_DMADEVICES is not set
541# 509# CONFIG_UIO is not set
542# DMA Engine support
543#
544# CONFIG_DMA_ENGINE is not set
545
546#
547# DMA Clients
548#
549
550#
551# DMA Devices
552#
553 510
554# 511#
555# File systems 512# File systems
@@ -561,12 +518,9 @@ CONFIG_HID=y
561# CONFIG_JFS_FS is not set 518# CONFIG_JFS_FS is not set
562# CONFIG_FS_POSIX_ACL is not set 519# CONFIG_FS_POSIX_ACL is not set
563# CONFIG_XFS_FS is not set 520# CONFIG_XFS_FS is not set
564# CONFIG_GFS2_FS is not set 521# CONFIG_DNOTIFY is not set
565# CONFIG_MINIX_FS is not set
566CONFIG_ROMFS_FS=y
567# CONFIG_INOTIFY is not set 522# CONFIG_INOTIFY is not set
568# CONFIG_QUOTA is not set 523# CONFIG_QUOTA is not set
569# CONFIG_DNOTIFY is not set
570# CONFIG_AUTOFS_FS is not set 524# CONFIG_AUTOFS_FS is not set
571# CONFIG_AUTOFS4_FS is not set 525# CONFIG_AUTOFS4_FS is not set
572# CONFIG_FUSE_FS is not set 526# CONFIG_FUSE_FS is not set
@@ -592,7 +546,6 @@ CONFIG_PROC_SYSCTL=y
592# CONFIG_SYSFS is not set 546# CONFIG_SYSFS is not set
593# CONFIG_TMPFS is not set 547# CONFIG_TMPFS is not set
594# CONFIG_HUGETLB_PAGE is not set 548# CONFIG_HUGETLB_PAGE is not set
595CONFIG_RAMFS=y
596 549
597# 550#
598# Miscellaneous filesystems 551# Miscellaneous filesystems
@@ -607,8 +560,11 @@ CONFIG_RAMFS=y
607# CONFIG_JFFS2_FS is not set 560# CONFIG_JFFS2_FS is not set
608# CONFIG_CRAMFS is not set 561# CONFIG_CRAMFS is not set
609# CONFIG_VXFS_FS is not set 562# CONFIG_VXFS_FS is not set
563# CONFIG_MINIX_FS is not set
564# CONFIG_OMFS_FS is not set
610# CONFIG_HPFS_FS is not set 565# CONFIG_HPFS_FS is not set
611# CONFIG_QNX4FS_FS is not set 566# CONFIG_QNX4FS_FS is not set
567CONFIG_ROMFS_FS=y
612# CONFIG_SYSV_FS is not set 568# CONFIG_SYSV_FS is not set
613# CONFIG_UFS_FS is not set 569# CONFIG_UFS_FS is not set
614 570
@@ -617,28 +573,23 @@ CONFIG_RAMFS=y
617# 573#
618# CONFIG_PARTITION_ADVANCED is not set 574# CONFIG_PARTITION_ADVANCED is not set
619CONFIG_MSDOS_PARTITION=y 575CONFIG_MSDOS_PARTITION=y
620
621#
622# Native Language Support
623#
624# CONFIG_NLS is not set 576# CONFIG_NLS is not set
625 577
626# 578#
627# Profiling support
628#
629# CONFIG_PROFILING is not set
630
631#
632# Kernel hacking 579# Kernel hacking
633# 580#
634CONFIG_TRACE_IRQFLAGS_SUPPORT=y 581CONFIG_TRACE_IRQFLAGS_SUPPORT=y
635# CONFIG_PRINTK_TIME is not set 582# CONFIG_PRINTK_TIME is not set
583CONFIG_ENABLE_WARN_DEPRECATED=y
636# CONFIG_ENABLE_MUST_CHECK is not set 584# CONFIG_ENABLE_MUST_CHECK is not set
585CONFIG_FRAME_WARN=1024
637# CONFIG_MAGIC_SYSRQ is not set 586# CONFIG_MAGIC_SYSRQ is not set
638# CONFIG_UNUSED_SYMBOLS is not set 587# CONFIG_UNUSED_SYMBOLS is not set
639# CONFIG_HEADERS_CHECK is not set 588# CONFIG_HEADERS_CHECK is not set
640# CONFIG_DEBUG_KERNEL is not set 589# CONFIG_DEBUG_KERNEL is not set
641# CONFIG_DEBUG_BUGVERBOSE is not set 590# CONFIG_DEBUG_BUGVERBOSE is not set
591# CONFIG_DEBUG_MEMORY_INIT is not set
592# CONFIG_SAMPLES is not set
642# CONFIG_SH_STANDARD_BIOS is not set 593# CONFIG_SH_STANDARD_BIOS is not set
643# CONFIG_EARLY_SCIF_CONSOLE is not set 594# CONFIG_EARLY_SCIF_CONSOLE is not set
644 595
@@ -646,20 +597,20 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
646# Security options 597# Security options
647# 598#
648# CONFIG_KEYS is not set 599# CONFIG_KEYS is not set
649 600# CONFIG_SECURITY_FILE_CAPABILITIES is not set
650#
651# Cryptographic options
652#
653# CONFIG_CRYPTO is not set 601# CONFIG_CRYPTO is not set
654 602
655# 603#
656# Library routines 604# Library routines
657# 605#
658CONFIG_BITREVERSE=y 606CONFIG_BITREVERSE=y
607# CONFIG_GENERIC_FIND_FIRST_BIT is not set
659# CONFIG_CRC_CCITT is not set 608# CONFIG_CRC_CCITT is not set
660# CONFIG_CRC16 is not set 609# CONFIG_CRC16 is not set
610# CONFIG_CRC_T10DIF is not set
661# CONFIG_CRC_ITU_T is not set 611# CONFIG_CRC_ITU_T is not set
662CONFIG_CRC32=y 612CONFIG_CRC32=y
613# CONFIG_CRC7 is not set
663# CONFIG_LIBCRC32C is not set 614# CONFIG_LIBCRC32C is not set
664CONFIG_ZLIB_INFLATE=y 615CONFIG_ZLIB_INFLATE=y
665CONFIG_HAS_IOMEM=y 616CONFIG_HAS_IOMEM=y
diff --git a/arch/sh/configs/se7712_defconfig b/arch/sh/configs/se7712_defconfig
index 2dd83af988f0..7be79cd04eb0 100644
--- a/arch/sh/configs/se7712_defconfig
+++ b/arch/sh/configs/se7712_defconfig
@@ -1,53 +1,57 @@
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-rc4 3# Linux kernel version: 2.6.26-rc6
4# Wed Mar 28 10:19:02 2007 4# Wed Jun 18 16:36:08 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_FIND_NEXT_BIT=y 9CONFIG_GENERIC_FIND_NEXT_BIT=y
9CONFIG_GENERIC_HWEIGHT=y 10CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_HARDIRQS=y 11CONFIG_GENERIC_HARDIRQS=y
11CONFIG_GENERIC_IRQ_PROBE=y 12CONFIG_GENERIC_IRQ_PROBE=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
13# CONFIG_GENERIC_TIME is not set 14CONFIG_GENERIC_TIME=y
15CONFIG_GENERIC_CLOCKEVENTS=y
14CONFIG_STACKTRACE_SUPPORT=y 16CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y 17CONFIG_LOCKDEP_SUPPORT=y
16# CONFIG_ARCH_HAS_ILOG2_U32 is not set 18# CONFIG_ARCH_HAS_ILOG2_U32 is not set
17# CONFIG_ARCH_HAS_ILOG2_U64 is not set 19# CONFIG_ARCH_HAS_ILOG2_U64 is not set
20CONFIG_ARCH_NO_VIRT_TO_BUS=y
21CONFIG_ARCH_SUPPORTS_AOUT=y
18CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 22CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
19 23
20# 24#
21# Code maturity level options 25# General setup
22# 26#
23CONFIG_EXPERIMENTAL=y 27CONFIG_EXPERIMENTAL=y
24CONFIG_BROKEN_ON_SMP=y 28CONFIG_BROKEN_ON_SMP=y
25CONFIG_INIT_ENV_ARG_LIMIT=32 29CONFIG_INIT_ENV_ARG_LIMIT=32
26
27#
28# General setup
29#
30CONFIG_LOCALVERSION="" 30CONFIG_LOCALVERSION=""
31# CONFIG_LOCALVERSION_AUTO is not set 31# CONFIG_LOCALVERSION_AUTO is not set
32# CONFIG_SWAP is not set 32# CONFIG_SWAP is not set
33CONFIG_SYSVIPC=y 33CONFIG_SYSVIPC=y
34# CONFIG_IPC_NS is not set
35CONFIG_SYSVIPC_SYSCTL=y 34CONFIG_SYSVIPC_SYSCTL=y
36CONFIG_POSIX_MQUEUE=y 35CONFIG_POSIX_MQUEUE=y
37CONFIG_BSD_PROCESS_ACCT=y 36CONFIG_BSD_PROCESS_ACCT=y
38# CONFIG_BSD_PROCESS_ACCT_V3 is not set 37# CONFIG_BSD_PROCESS_ACCT_V3 is not set
39# CONFIG_TASKSTATS is not set 38# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set
41# CONFIG_AUDIT is not set 39# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 40# CONFIG_IKCONFIG is not set
41CONFIG_LOG_BUF_SHIFT=14
42# CONFIG_CGROUPS is not set
43# CONFIG_GROUP_SCHED is not set
43CONFIG_SYSFS_DEPRECATED=y 44CONFIG_SYSFS_DEPRECATED=y
45CONFIG_SYSFS_DEPRECATED_V2=y
44# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
47# CONFIG_NAMESPACES is not set
45# CONFIG_BLK_DEV_INITRD is not set 48# CONFIG_BLK_DEV_INITRD is not set
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 49# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SYSCTL=y 50CONFIG_SYSCTL=y
48CONFIG_EMBEDDED=y 51CONFIG_EMBEDDED=y
49CONFIG_UID16=y 52CONFIG_UID16=y
50CONFIG_SYSCTL_SYSCALL=y 53CONFIG_SYSCTL_SYSCALL=y
54CONFIG_SYSCTL_SYSCALL_CHECK=y
51CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
52CONFIG_KALLSYMS_ALL=y 56CONFIG_KALLSYMS_ALL=y
53# CONFIG_KALLSYMS_EXTRA_PASS is not set 57# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -55,33 +59,41 @@ CONFIG_HOTPLUG=y
55CONFIG_PRINTK=y 59CONFIG_PRINTK=y
56# CONFIG_BUG is not set 60# CONFIG_BUG is not set
57CONFIG_ELF_CORE=y 61CONFIG_ELF_CORE=y
62CONFIG_COMPAT_BRK=y
58# CONFIG_BASE_FULL is not set 63# CONFIG_BASE_FULL is not set
59CONFIG_FUTEX=y 64CONFIG_FUTEX=y
65CONFIG_ANON_INODES=y
60CONFIG_EPOLL=y 66CONFIG_EPOLL=y
67CONFIG_SIGNALFD=y
68CONFIG_TIMERFD=y
69CONFIG_EVENTFD=y
61# CONFIG_SHMEM is not set 70# CONFIG_SHMEM is not set
62CONFIG_SLAB=y
63CONFIG_VM_EVENT_COUNTERS=y 71CONFIG_VM_EVENT_COUNTERS=y
72CONFIG_SLAB=y
73# CONFIG_SLUB is not set
74# CONFIG_SLOB is not set
75# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set
77CONFIG_HAVE_OPROFILE=y
78# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set
80# CONFIG_HAVE_DMA_ATTRS is not set
81CONFIG_PROC_PAGE_MONITOR=y
82CONFIG_SLABINFO=y
64CONFIG_RT_MUTEXES=y 83CONFIG_RT_MUTEXES=y
65CONFIG_TINY_SHMEM=y 84CONFIG_TINY_SHMEM=y
66CONFIG_BASE_SMALL=1 85CONFIG_BASE_SMALL=1
67# CONFIG_SLOB is not set
68
69#
70# Loadable module support
71#
72CONFIG_MODULES=y 86CONFIG_MODULES=y
87# CONFIG_MODULE_FORCE_LOAD is not set
73# CONFIG_MODULE_UNLOAD is not set 88# CONFIG_MODULE_UNLOAD is not set
74# CONFIG_MODVERSIONS is not set 89# CONFIG_MODVERSIONS is not set
75# CONFIG_MODULE_SRCVERSION_ALL is not set 90# CONFIG_MODULE_SRCVERSION_ALL is not set
76# CONFIG_KMOD is not set 91# CONFIG_KMOD is not set
77
78#
79# Block layer
80#
81CONFIG_BLOCK=y 92CONFIG_BLOCK=y
82# CONFIG_LBD is not set 93# CONFIG_LBD is not set
83# CONFIG_BLK_DEV_IO_TRACE is not set 94# CONFIG_BLK_DEV_IO_TRACE is not set
84# CONFIG_LSF is not set 95# CONFIG_LSF is not set
96# CONFIG_BLK_DEV_BSG is not set
85 97
86# 98#
87# IO Schedulers 99# IO Schedulers
@@ -95,57 +107,17 @@ CONFIG_IOSCHED_NOOP=y
95# CONFIG_DEFAULT_CFQ is not set 107# CONFIG_DEFAULT_CFQ is not set
96CONFIG_DEFAULT_NOOP=y 108CONFIG_DEFAULT_NOOP=y
97CONFIG_DEFAULT_IOSCHED="noop" 109CONFIG_DEFAULT_IOSCHED="noop"
110CONFIG_CLASSIC_RCU=y
98 111
99# 112#
100# System type 113# System type
101# 114#
102CONFIG_SOLUTION_ENGINE=y
103CONFIG_SH_SOLUTION_ENGINE=y
104# CONFIG_SH_7751_SOLUTION_ENGINE is not set
105# CONFIG_SH_7300_SOLUTION_ENGINE is not set
106# CONFIG_SH_7343_SOLUTION_ENGINE is not set
107# CONFIG_SH_73180_SOLUTION_ENGINE is not set
108# CONFIG_SH_7751_SYSTEMH is not set
109# CONFIG_SH_HP6XX is not set
110# CONFIG_SH_SATURN is not set
111# CONFIG_SH_DREAMCAST is not set
112# CONFIG_SH_MPC1211 is not set
113# CONFIG_SH_SH03 is not set
114# CONFIG_SH_SECUREEDGE5410 is not set
115# CONFIG_SH_HS7751RVOIP is not set
116# CONFIG_SH_7710VOIPGW is not set
117# CONFIG_SH_RTS7751R2D is not set
118# CONFIG_SH_HIGHLANDER is not set
119# CONFIG_SH_EDOSK7705 is not set
120# CONFIG_SH_SH4202_MICRODEV is not set
121# CONFIG_SH_LANDISK is not set
122# CONFIG_SH_TITAN is not set
123# CONFIG_SH_SHMIN is not set
124# CONFIG_SH_7206_SOLUTION_ENGINE is not set
125# CONFIG_SH_7619_SOLUTION_ENGINE is not set
126# CONFIG_SH_LBOX_RE2 is not set
127# CONFIG_SH_UNKNOWN is not set
128
129#
130# Processor selection
131#
132CONFIG_CPU_SH3=y 115CONFIG_CPU_SH3=y
133
134#
135# SH-2 Processor Support
136#
137# CONFIG_CPU_SUBTYPE_SH7604 is not set
138# CONFIG_CPU_SUBTYPE_SH7619 is not set 116# CONFIG_CPU_SUBTYPE_SH7619 is not set
139 117# CONFIG_CPU_SUBTYPE_SH7203 is not set
140#
141# SH-2A Processor Support
142#
143# CONFIG_CPU_SUBTYPE_SH7206 is not set 118# CONFIG_CPU_SUBTYPE_SH7206 is not set
144 119# CONFIG_CPU_SUBTYPE_SH7263 is not set
145# 120# CONFIG_CPU_SUBTYPE_MXG is not set
146# SH-3 Processor Support
147#
148# CONFIG_CPU_SUBTYPE_SH7300 is not set
149# CONFIG_CPU_SUBTYPE_SH7705 is not set 121# CONFIG_CPU_SUBTYPE_SH7705 is not set
150# CONFIG_CPU_SUBTYPE_SH7706 is not set 122# CONFIG_CPU_SUBTYPE_SH7706 is not set
151# CONFIG_CPU_SUBTYPE_SH7707 is not set 123# CONFIG_CPU_SUBTYPE_SH7707 is not set
@@ -153,10 +125,8 @@ CONFIG_CPU_SH3=y
153# CONFIG_CPU_SUBTYPE_SH7709 is not set 125# CONFIG_CPU_SUBTYPE_SH7709 is not set
154# CONFIG_CPU_SUBTYPE_SH7710 is not set 126# CONFIG_CPU_SUBTYPE_SH7710 is not set
155CONFIG_CPU_SUBTYPE_SH7712=y 127CONFIG_CPU_SUBTYPE_SH7712=y
156 128# CONFIG_CPU_SUBTYPE_SH7720 is not set
157# 129# CONFIG_CPU_SUBTYPE_SH7721 is not set
158# SH-4 Processor Support
159#
160# CONFIG_CPU_SUBTYPE_SH7750 is not set 130# CONFIG_CPU_SUBTYPE_SH7750 is not set
161# CONFIG_CPU_SUBTYPE_SH7091 is not set 131# CONFIG_CPU_SUBTYPE_SH7091 is not set
162# CONFIG_CPU_SUBTYPE_SH7750R is not set 132# CONFIG_CPU_SUBTYPE_SH7750R is not set
@@ -165,37 +135,37 @@ CONFIG_CPU_SUBTYPE_SH7712=y
165# CONFIG_CPU_SUBTYPE_SH7751R is not set 135# CONFIG_CPU_SUBTYPE_SH7751R is not set
166# CONFIG_CPU_SUBTYPE_SH7760 is not set 136# CONFIG_CPU_SUBTYPE_SH7760 is not set
167# CONFIG_CPU_SUBTYPE_SH4_202 is not set 137# CONFIG_CPU_SUBTYPE_SH4_202 is not set
168 138# CONFIG_CPU_SUBTYPE_SH7723 is not set
169# 139# CONFIG_CPU_SUBTYPE_SH7763 is not set
170# ST40 Processor Support
171#
172# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
173# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
174
175#
176# SH-4A Processor Support
177#
178# CONFIG_CPU_SUBTYPE_SH7770 is not set 140# CONFIG_CPU_SUBTYPE_SH7770 is not set
179# CONFIG_CPU_SUBTYPE_SH7780 is not set 141# CONFIG_CPU_SUBTYPE_SH7780 is not set
180# CONFIG_CPU_SUBTYPE_SH7785 is not set 142# CONFIG_CPU_SUBTYPE_SH7785 is not set
181 143# CONFIG_CPU_SUBTYPE_SHX3 is not set
182#
183# SH4AL-DSP Processor Support
184#
185# CONFIG_CPU_SUBTYPE_SH73180 is not set
186# CONFIG_CPU_SUBTYPE_SH7343 is not set 144# CONFIG_CPU_SUBTYPE_SH7343 is not set
187# CONFIG_CPU_SUBTYPE_SH7722 is not set 145# CONFIG_CPU_SUBTYPE_SH7722 is not set
146# CONFIG_CPU_SUBTYPE_SH7366 is not set
147# CONFIG_CPU_SUBTYPE_SH5_101 is not set
148# CONFIG_CPU_SUBTYPE_SH5_103 is not set
188 149
189# 150#
190# Memory management options 151# Memory management options
191# 152#
153CONFIG_QUICKLIST=y
192CONFIG_MMU=y 154CONFIG_MMU=y
193CONFIG_PAGE_OFFSET=0x80000000 155CONFIG_PAGE_OFFSET=0x80000000
194CONFIG_MEMORY_START=0x0c000000 156CONFIG_MEMORY_START=0x0c000000
195CONFIG_MEMORY_SIZE=0x02000000 157CONFIG_MEMORY_SIZE=0x02000000
158CONFIG_29BIT=y
196CONFIG_VSYSCALL=y 159CONFIG_VSYSCALL=y
160CONFIG_ARCH_FLATMEM_ENABLE=y
161CONFIG_ARCH_SPARSEMEM_ENABLE=y
162CONFIG_ARCH_SPARSEMEM_DEFAULT=y
163CONFIG_MAX_ACTIVE_REGIONS=1
164CONFIG_ARCH_POPULATES_NODE_MAP=y
165CONFIG_ARCH_SELECT_MEMORY_MODEL=y
197CONFIG_PAGE_SIZE_4KB=y 166CONFIG_PAGE_SIZE_4KB=y
198# CONFIG_PAGE_SIZE_8KB is not set 167# CONFIG_PAGE_SIZE_8KB is not set
168# CONFIG_PAGE_SIZE_16KB is not set
199# CONFIG_PAGE_SIZE_64KB is not set 169# CONFIG_PAGE_SIZE_64KB is not set
200CONFIG_SELECT_MEMORY_MODEL=y 170CONFIG_SELECT_MEMORY_MODEL=y
201CONFIG_FLATMEM_MANUAL=y 171CONFIG_FLATMEM_MANUAL=y
@@ -203,21 +173,21 @@ CONFIG_FLATMEM_MANUAL=y
203# CONFIG_SPARSEMEM_MANUAL is not set 173# CONFIG_SPARSEMEM_MANUAL is not set
204CONFIG_FLATMEM=y 174CONFIG_FLATMEM=y
205CONFIG_FLAT_NODE_MEM_MAP=y 175CONFIG_FLAT_NODE_MEM_MAP=y
206# CONFIG_SPARSEMEM_STATIC is not set 176CONFIG_SPARSEMEM_STATIC=y
177# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
178CONFIG_PAGEFLAGS_EXTENDED=y
207CONFIG_SPLIT_PTLOCK_CPUS=4 179CONFIG_SPLIT_PTLOCK_CPUS=4
208# CONFIG_RESOURCES_64BIT is not set 180# CONFIG_RESOURCES_64BIT is not set
209CONFIG_ZONE_DMA_FLAG=0 181CONFIG_ZONE_DMA_FLAG=0
182CONFIG_NR_QUICK=2
210 183
211# 184#
212# Cache configuration 185# Cache configuration
213# 186#
214# CONFIG_SH_DIRECT_MAPPED is not set 187# CONFIG_SH_DIRECT_MAPPED is not set
215# CONFIG_SH_WRITETHROUGH is not set 188CONFIG_CACHE_WRITEBACK=y
216# CONFIG_SH_OCRAM is not set 189# CONFIG_CACHE_WRITETHROUGH is not set
217CONFIG_CF_ENABLER=y 190# CONFIG_CACHE_OFF is not set
218# CONFIG_CF_AREA5 is not set
219CONFIG_CF_AREA6=y
220CONFIG_CF_BASE_ADDR=0xb8000000
221 191
222# 192#
223# Processor features 193# Processor features
@@ -230,6 +200,14 @@ CONFIG_CPU_LITTLE_ENDIAN=y
230CONFIG_CPU_HAS_INTEVT=y 200CONFIG_CPU_HAS_INTEVT=y
231CONFIG_CPU_HAS_IPR_IRQ=y 201CONFIG_CPU_HAS_IPR_IRQ=y
232CONFIG_CPU_HAS_SR_RB=y 202CONFIG_CPU_HAS_SR_RB=y
203CONFIG_CPU_HAS_DSP=y
204
205#
206# Board support
207#
208CONFIG_SOLUTION_ENGINE=y
209CONFIG_SH_SOLUTION_ENGINE=y
210# CONFIG_SH_AP325RXA is not set
233 211
234# 212#
235# Timer and clock configuration 213# Timer and clock configuration
@@ -237,6 +215,10 @@ CONFIG_CPU_HAS_SR_RB=y
237CONFIG_SH_TMU=y 215CONFIG_SH_TMU=y
238CONFIG_SH_TIMER_IRQ=16 216CONFIG_SH_TIMER_IRQ=16
239CONFIG_SH_PCLK_FREQ=66666666 217CONFIG_SH_PCLK_FREQ=66666666
218# CONFIG_TICK_ONESHOT is not set
219# CONFIG_NO_HZ is not set
220# CONFIG_HIGH_RES_TIMERS is not set
221CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
240 222
241# 223#
242# CPU Frequency scaling 224# CPU Frequency scaling
@@ -251,7 +233,6 @@ CONFIG_SH_PCLK_FREQ=66666666
251# 233#
252# Companion Chips 234# Companion Chips
253# 235#
254# CONFIG_HD6446X_SERIES is not set
255 236
256# 237#
257# Additional SuperH Device Drivers 238# Additional SuperH Device Drivers
@@ -267,48 +248,40 @@ CONFIG_HZ_250=y
267# CONFIG_HZ_300 is not set 248# CONFIG_HZ_300 is not set
268# CONFIG_HZ_1000 is not set 249# CONFIG_HZ_1000 is not set
269CONFIG_HZ=250 250CONFIG_HZ=250
251# CONFIG_SCHED_HRTICK is not set
270# CONFIG_KEXEC is not set 252# CONFIG_KEXEC is not set
271# CONFIG_SMP is not set 253# CONFIG_CRASH_DUMP is not set
272# CONFIG_PREEMPT_NONE is not set 254# CONFIG_PREEMPT_NONE is not set
273CONFIG_PREEMPT_VOLUNTARY=y 255CONFIG_PREEMPT_VOLUNTARY=y
274# CONFIG_PREEMPT is not set 256# CONFIG_PREEMPT is not set
257CONFIG_GUSA=y
258# CONFIG_GUSA_RB is not set
275 259
276# 260#
277# Boot options 261# Boot options
278# 262#
279CONFIG_ZERO_PAGE_OFFSET=0x00001000 263CONFIG_ZERO_PAGE_OFFSET=0x00001000
280CONFIG_BOOT_LINK_OFFSET=0x00800000 264CONFIG_BOOT_LINK_OFFSET=0x00800000
281# CONFIG_UBC_WAKEUP is not set
282CONFIG_CMDLINE_BOOL=y 265CONFIG_CMDLINE_BOOL=y
283CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1" 266CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
284 267
285# 268#
286# Bus options 269# Bus options
287# 270#
288# CONFIG_PCI is not set 271CONFIG_CF_ENABLER=y
289 272# CONFIG_CF_AREA5 is not set
290# 273CONFIG_CF_AREA6=y
291# PCCARD (PCMCIA/CardBus) support 274CONFIG_CF_BASE_ADDR=0xb8000000
292# 275# CONFIG_ARCH_SUPPORTS_MSI is not set
293# CONFIG_PCCARD is not set 276# CONFIG_PCCARD is not set
294 277
295# 278#
296# PCI Hotplug Support
297#
298
299#
300# Executable file formats 279# Executable file formats
301# 280#
302CONFIG_BINFMT_ELF=y 281CONFIG_BINFMT_ELF=y
303# CONFIG_BINFMT_FLAT is not set
304# CONFIG_BINFMT_MISC is not set 282# CONFIG_BINFMT_MISC is not set
305 283
306# 284#
307# Power management options (EXPERIMENTAL)
308#
309# CONFIG_PM is not set
310
311#
312# Networking 285# Networking
313# 286#
314CONFIG_NET=y 287CONFIG_NET=y
@@ -316,7 +289,6 @@ CONFIG_NET=y
316# 289#
317# Networking options 290# Networking options
318# 291#
319# CONFIG_NETDEBUG is not set
320CONFIG_PACKET=y 292CONFIG_PACKET=y
321CONFIG_PACKET_MMAP=y 293CONFIG_PACKET_MMAP=y
322CONFIG_UNIX=y 294CONFIG_UNIX=y
@@ -324,6 +296,7 @@ CONFIG_XFRM=y
324# CONFIG_XFRM_USER is not set 296# CONFIG_XFRM_USER is not set
325# CONFIG_XFRM_SUB_POLICY is not set 297# CONFIG_XFRM_SUB_POLICY is not set
326# CONFIG_XFRM_MIGRATE is not set 298# CONFIG_XFRM_MIGRATE is not set
299# CONFIG_XFRM_STATISTICS is not set
327CONFIG_NET_KEY=y 300CONFIG_NET_KEY=y
328# CONFIG_NET_KEY_MIGRATE is not set 301# CONFIG_NET_KEY_MIGRATE is not set
329CONFIG_INET=y 302CONFIG_INET=y
@@ -334,11 +307,10 @@ CONFIG_ASK_IP_FIB_HASH=y
334CONFIG_IP_FIB_HASH=y 307CONFIG_IP_FIB_HASH=y
335CONFIG_IP_MULTIPLE_TABLES=y 308CONFIG_IP_MULTIPLE_TABLES=y
336CONFIG_IP_ROUTE_MULTIPATH=y 309CONFIG_IP_ROUTE_MULTIPATH=y
337# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set
338CONFIG_IP_ROUTE_VERBOSE=y 310CONFIG_IP_ROUTE_VERBOSE=y
339CONFIG_IP_PNP=y 311CONFIG_IP_PNP=y
340CONFIG_IP_PNP_DHCP=y 312CONFIG_IP_PNP_DHCP=y
341# CONFIG_IP_PNP_BOOTP is not set 313CONFIG_IP_PNP_BOOTP=y
342# CONFIG_IP_PNP_RARP is not set 314# CONFIG_IP_PNP_RARP is not set
343# CONFIG_NET_IPIP is not set 315# CONFIG_NET_IPIP is not set
344# CONFIG_NET_IPGRE is not set 316# CONFIG_NET_IPGRE is not set
@@ -355,30 +327,17 @@ CONFIG_INET_TUNNEL=y
355CONFIG_INET_XFRM_MODE_TRANSPORT=y 327CONFIG_INET_XFRM_MODE_TRANSPORT=y
356CONFIG_INET_XFRM_MODE_TUNNEL=y 328CONFIG_INET_XFRM_MODE_TUNNEL=y
357CONFIG_INET_XFRM_MODE_BEET=y 329CONFIG_INET_XFRM_MODE_BEET=y
330# CONFIG_INET_LRO is not set
358# CONFIG_INET_DIAG is not set 331# CONFIG_INET_DIAG is not set
359# CONFIG_TCP_CONG_ADVANCED is not set 332# CONFIG_TCP_CONG_ADVANCED is not set
360CONFIG_TCP_CONG_CUBIC=y 333CONFIG_TCP_CONG_CUBIC=y
361CONFIG_DEFAULT_TCP_CONG="cubic" 334CONFIG_DEFAULT_TCP_CONG="cubic"
362# CONFIG_TCP_MD5SIG is not set 335# CONFIG_TCP_MD5SIG is not set
363# CONFIG_IPV6 is not set 336# CONFIG_IPV6 is not set
364# CONFIG_INET6_XFRM_TUNNEL is not set
365# CONFIG_INET6_TUNNEL is not set
366# CONFIG_NETWORK_SECMARK is not set 337# CONFIG_NETWORK_SECMARK is not set
367# CONFIG_NETFILTER is not set 338# CONFIG_NETFILTER is not set
368
369#
370# DCCP Configuration (EXPERIMENTAL)
371#
372# CONFIG_IP_DCCP is not set 339# CONFIG_IP_DCCP is not set
373
374#
375# SCTP Configuration (EXPERIMENTAL)
376#
377# CONFIG_IP_SCTP is not set 340# CONFIG_IP_SCTP is not set
378
379#
380# TIPC Configuration (EXPERIMENTAL)
381#
382# CONFIG_TIPC is not set 341# CONFIG_TIPC is not set
383# CONFIG_ATM is not set 342# CONFIG_ATM is not set
384# CONFIG_BRIDGE is not set 343# CONFIG_BRIDGE is not set
@@ -391,15 +350,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
391# CONFIG_LAPB is not set 350# CONFIG_LAPB is not set
392# CONFIG_ECONET is not set 351# CONFIG_ECONET is not set
393# CONFIG_WAN_ROUTER is not set 352# CONFIG_WAN_ROUTER is not set
394
395#
396# QoS and/or fair queueing
397#
398CONFIG_NET_SCHED=y 353CONFIG_NET_SCHED=y
399CONFIG_NET_SCH_FIFO=y
400CONFIG_NET_SCH_CLK_JIFFIES=y
401# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
402# CONFIG_NET_SCH_CLK_CPU is not set
403 354
404# 355#
405# Queueing/Scheduling 356# Queueing/Scheduling
@@ -408,6 +359,7 @@ CONFIG_NET_SCH_CBQ=y
408CONFIG_NET_SCH_HTB=y 359CONFIG_NET_SCH_HTB=y
409CONFIG_NET_SCH_HFSC=y 360CONFIG_NET_SCH_HFSC=y
410CONFIG_NET_SCH_PRIO=y 361CONFIG_NET_SCH_PRIO=y
362# CONFIG_NET_SCH_RR is not set
411CONFIG_NET_SCH_RED=y 363CONFIG_NET_SCH_RED=y
412CONFIG_NET_SCH_SFQ=y 364CONFIG_NET_SCH_SFQ=y
413CONFIG_NET_SCH_TEQL=y 365CONFIG_NET_SCH_TEQL=y
@@ -415,7 +367,6 @@ CONFIG_NET_SCH_TBF=y
415CONFIG_NET_SCH_GRED=y 367CONFIG_NET_SCH_GRED=y
416CONFIG_NET_SCH_DSMARK=y 368CONFIG_NET_SCH_DSMARK=y
417CONFIG_NET_SCH_NETEM=y 369CONFIG_NET_SCH_NETEM=y
418CONFIG_NET_SCH_INGRESS=y
419 370
420# 371#
421# Classification 372# Classification
@@ -429,50 +380,55 @@ CONFIG_NET_CLS_FW=y
429# CONFIG_NET_CLS_U32 is not set 380# CONFIG_NET_CLS_U32 is not set
430# CONFIG_NET_CLS_RSVP is not set 381# CONFIG_NET_CLS_RSVP is not set
431# CONFIG_NET_CLS_RSVP6 is not set 382# CONFIG_NET_CLS_RSVP6 is not set
383# CONFIG_NET_CLS_FLOW is not set
432# CONFIG_NET_EMATCH is not set 384# CONFIG_NET_EMATCH is not set
433# CONFIG_NET_CLS_ACT is not set 385# CONFIG_NET_CLS_ACT is not set
434# CONFIG_NET_CLS_POLICE is not set
435CONFIG_NET_CLS_IND=y 386CONFIG_NET_CLS_IND=y
436CONFIG_NET_ESTIMATOR=y 387CONFIG_NET_SCH_FIFO=y
437 388
438# 389#
439# Network testing 390# Network testing
440# 391#
441# CONFIG_NET_PKTGEN is not set 392# CONFIG_NET_PKTGEN is not set
442# CONFIG_HAMRADIO is not set 393# CONFIG_HAMRADIO is not set
394# CONFIG_CAN is not set
443# CONFIG_IRDA is not set 395# CONFIG_IRDA is not set
444# CONFIG_BT is not set 396# CONFIG_BT is not set
445# CONFIG_IEEE80211 is not set 397# CONFIG_AF_RXRPC is not set
446CONFIG_FIB_RULES=y 398CONFIG_FIB_RULES=y
447 399
448# 400#
401# Wireless
402#
403# CONFIG_CFG80211 is not set
404# CONFIG_WIRELESS_EXT is not set
405# CONFIG_MAC80211 is not set
406# CONFIG_IEEE80211 is not set
407# CONFIG_RFKILL is not set
408# CONFIG_NET_9P is not set
409
410#
449# Device Drivers 411# Device Drivers
450# 412#
451 413
452# 414#
453# Generic Driver Options 415# Generic Driver Options
454# 416#
417CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
455CONFIG_STANDALONE=y 418CONFIG_STANDALONE=y
456CONFIG_PREVENT_FIRMWARE_BUILD=y 419CONFIG_PREVENT_FIRMWARE_BUILD=y
457CONFIG_FW_LOADER=y 420CONFIG_FW_LOADER=y
458# CONFIG_DEBUG_DRIVER is not set 421# CONFIG_DEBUG_DRIVER is not set
459# CONFIG_DEBUG_DEVRES is not set 422# CONFIG_DEBUG_DEVRES is not set
460# CONFIG_SYS_HYPERVISOR is not set 423# CONFIG_SYS_HYPERVISOR is not set
461
462#
463# Connector - unified userspace <-> kernelspace linker
464#
465# CONFIG_CONNECTOR is not set 424# CONFIG_CONNECTOR is not set
466
467#
468# Memory Technology Devices (MTD)
469#
470CONFIG_MTD=y 425CONFIG_MTD=y
471# CONFIG_MTD_DEBUG is not set 426# CONFIG_MTD_DEBUG is not set
472CONFIG_MTD_CONCAT=y 427CONFIG_MTD_CONCAT=y
473CONFIG_MTD_PARTITIONS=y 428CONFIG_MTD_PARTITIONS=y
474# CONFIG_MTD_REDBOOT_PARTS is not set 429# CONFIG_MTD_REDBOOT_PARTS is not set
475# CONFIG_MTD_CMDLINE_PARTS is not set 430# CONFIG_MTD_CMDLINE_PARTS is not set
431# CONFIG_MTD_AR7_PARTS is not set
476 432
477# 433#
478# User Modules And Translation Layers 434# User Modules And Translation Layers
@@ -485,6 +441,7 @@ CONFIG_MTD_BLOCK=y
485# CONFIG_INFTL is not set 441# CONFIG_INFTL is not set
486# CONFIG_RFD_FTL is not set 442# CONFIG_RFD_FTL is not set
487# CONFIG_SSFDC is not set 443# CONFIG_SSFDC is not set
444# CONFIG_MTD_OOPS is not set
488 445
489# 446#
490# RAM/ROM/Flash chip drivers 447# RAM/ROM/Flash chip drivers
@@ -510,7 +467,6 @@ CONFIG_MTD_CFI_UTIL=y
510# CONFIG_MTD_RAM is not set 467# CONFIG_MTD_RAM is not set
511# CONFIG_MTD_ROM is not set 468# CONFIG_MTD_ROM is not set
512# CONFIG_MTD_ABSENT is not set 469# CONFIG_MTD_ABSENT is not set
513# CONFIG_MTD_OBSOLETE_CHIPS is not set
514 470
515# 471#
516# Mapping drivers for chip access 472# Mapping drivers for chip access
@@ -533,44 +489,25 @@ CONFIG_MTD_CFI_UTIL=y
533# CONFIG_MTD_DOC2000 is not set 489# CONFIG_MTD_DOC2000 is not set
534# CONFIG_MTD_DOC2001 is not set 490# CONFIG_MTD_DOC2001 is not set
535# CONFIG_MTD_DOC2001PLUS is not set 491# CONFIG_MTD_DOC2001PLUS is not set
536
537#
538# NAND Flash Device Drivers
539#
540# CONFIG_MTD_NAND is not set 492# CONFIG_MTD_NAND is not set
541
542#
543# OneNAND Flash Device Drivers
544#
545# CONFIG_MTD_ONENAND is not set 493# CONFIG_MTD_ONENAND is not set
546 494
547# 495#
548# Parallel port support 496# UBI - Unsorted block images
549# 497#
498# CONFIG_MTD_UBI is not set
550# CONFIG_PARPORT is not set 499# CONFIG_PARPORT is not set
551 500CONFIG_BLK_DEV=y
552#
553# Plug and Play support
554#
555# CONFIG_PNPACPI is not set
556
557#
558# Block devices
559#
560# CONFIG_BLK_DEV_COW_COMMON is not set 501# CONFIG_BLK_DEV_COW_COMMON is not set
561# CONFIG_BLK_DEV_LOOP is not set 502# CONFIG_BLK_DEV_LOOP is not set
562# CONFIG_BLK_DEV_NBD is not set 503# CONFIG_BLK_DEV_NBD is not set
563# CONFIG_BLK_DEV_RAM is not set 504# CONFIG_BLK_DEV_RAM is not set
564# CONFIG_CDROM_PKTCDVD is not set 505# CONFIG_CDROM_PKTCDVD is not set
565# CONFIG_ATA_OVER_ETH is not set 506# CONFIG_ATA_OVER_ETH is not set
566 507CONFIG_MISC_DEVICES=y
567# 508# CONFIG_EEPROM_93CX6 is not set
568# Misc devices 509# CONFIG_ENCLOSURE_SERVICES is not set
569# 510CONFIG_HAVE_IDE=y
570
571#
572# ATA/ATAPI/MFM/RLL support
573#
574# CONFIG_IDE is not set 511# CONFIG_IDE is not set
575 512
576# 513#
@@ -578,6 +515,7 @@ CONFIG_MTD_CFI_UTIL=y
578# 515#
579# CONFIG_RAID_ATTRS is not set 516# CONFIG_RAID_ATTRS is not set
580CONFIG_SCSI=y 517CONFIG_SCSI=y
518CONFIG_SCSI_DMA=y
581# CONFIG_SCSI_TGT is not set 519# CONFIG_SCSI_TGT is not set
582# CONFIG_SCSI_NETLINK is not set 520# CONFIG_SCSI_NETLINK is not set
583CONFIG_SCSI_PROC_FS=y 521CONFIG_SCSI_PROC_FS=y
@@ -599,6 +537,7 @@ CONFIG_BLK_DEV_SD=y
599# CONFIG_SCSI_CONSTANTS is not set 537# CONFIG_SCSI_CONSTANTS is not set
600# CONFIG_SCSI_LOGGING is not set 538# CONFIG_SCSI_LOGGING is not set
601# CONFIG_SCSI_SCAN_ASYNC is not set 539# CONFIG_SCSI_SCAN_ASYNC is not set
540CONFIG_SCSI_WAIT_SCAN=m
602 541
603# 542#
604# SCSI Transports 543# SCSI Transports
@@ -606,94 +545,72 @@ CONFIG_BLK_DEV_SD=y
606# CONFIG_SCSI_SPI_ATTRS is not set 545# CONFIG_SCSI_SPI_ATTRS is not set
607# CONFIG_SCSI_FC_ATTRS is not set 546# CONFIG_SCSI_FC_ATTRS is not set
608# CONFIG_SCSI_ISCSI_ATTRS is not set 547# CONFIG_SCSI_ISCSI_ATTRS is not set
609# CONFIG_SCSI_SAS_ATTRS is not set
610# CONFIG_SCSI_SAS_LIBSAS is not set 548# CONFIG_SCSI_SAS_LIBSAS is not set
611 549# CONFIG_SCSI_SRP_ATTRS is not set
612# 550CONFIG_SCSI_LOWLEVEL=y
613# SCSI low-level drivers
614#
615# CONFIG_ISCSI_TCP is not set 551# CONFIG_ISCSI_TCP is not set
616# CONFIG_SCSI_DEBUG is not set 552# CONFIG_SCSI_DEBUG is not set
617
618#
619# Serial ATA (prod) and Parallel ATA (experimental) drivers
620#
621CONFIG_ATA=y 553CONFIG_ATA=y
622# CONFIG_ATA_NONSTANDARD is not set 554# CONFIG_ATA_NONSTANDARD is not set
555CONFIG_SATA_PMP=y
556CONFIG_ATA_SFF=y
557# CONFIG_SATA_MV is not set
623CONFIG_PATA_PLATFORM=y 558CONFIG_PATA_PLATFORM=y
624
625#
626# Multi-device support (RAID and LVM)
627#
628# CONFIG_MD is not set 559# CONFIG_MD is not set
629
630#
631# Fusion MPT device support
632#
633# CONFIG_FUSION is not set
634
635#
636# IEEE 1394 (FireWire) support
637#
638
639#
640# I2O device support
641#
642
643#
644# Network device support
645#
646CONFIG_NETDEVICES=y 560CONFIG_NETDEVICES=y
561# CONFIG_NETDEVICES_MULTIQUEUE is not set
647# CONFIG_DUMMY is not set 562# CONFIG_DUMMY is not set
648# CONFIG_BONDING is not set 563# CONFIG_BONDING is not set
564# CONFIG_MACVLAN is not set
649# CONFIG_EQUALIZER is not set 565# CONFIG_EQUALIZER is not set
650# CONFIG_TUN is not set 566# CONFIG_TUN is not set
651 567# CONFIG_VETH is not set
652# 568CONFIG_PHYLIB=y
653# PHY device support 569
654# 570#
655 571# MII PHY device drivers
656# 572#
657# Ethernet (10 or 100Mbit) 573# CONFIG_MARVELL_PHY is not set
658# 574# CONFIG_DAVICOM_PHY is not set
659# CONFIG_NET_ETHERNET is not set 575# CONFIG_QSEMI_PHY is not set
660 576# CONFIG_LXT_PHY is not set
661# 577# CONFIG_CICADA_PHY is not set
662# Ethernet (1000 Mbit) 578# CONFIG_VITESSE_PHY is not set
663# 579# CONFIG_SMSC_PHY is not set
664 580# CONFIG_BROADCOM_PHY is not set
665# 581# CONFIG_ICPLUS_PHY is not set
666# Ethernet (10000 Mbit) 582# CONFIG_REALTEK_PHY is not set
667# 583# CONFIG_FIXED_PHY is not set
668 584CONFIG_MDIO_BITBANG=y
669# 585CONFIG_NET_ETHERNET=y
670# Token Ring devices 586CONFIG_MII=y
671# 587# CONFIG_AX88796 is not set
672 588# CONFIG_STNIC is not set
673# 589CONFIG_SH_ETH=y
674# Wireless LAN (non-hamradio) 590# CONFIG_SMC91X is not set
675# 591# CONFIG_SMC911X is not set
676# CONFIG_NET_RADIO is not set 592# CONFIG_IBM_NEW_EMAC_ZMII is not set
677 593# CONFIG_IBM_NEW_EMAC_RGMII is not set
678# 594# CONFIG_IBM_NEW_EMAC_TAH is not set
679# Wan interfaces 595# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
680# 596# CONFIG_B44 is not set
597CONFIG_NETDEV_1000=y
598# CONFIG_E1000E_ENABLED is not set
599CONFIG_NETDEV_10000=y
600
601#
602# Wireless LAN
603#
604# CONFIG_WLAN_PRE80211 is not set
605# CONFIG_WLAN_80211 is not set
606# CONFIG_IWLWIFI_LEDS is not set
681# CONFIG_WAN is not set 607# CONFIG_WAN is not set
682# CONFIG_PPP is not set 608# CONFIG_PPP is not set
683# CONFIG_SLIP is not set 609# CONFIG_SLIP is not set
684# CONFIG_SHAPER is not set
685# CONFIG_NETCONSOLE is not set 610# CONFIG_NETCONSOLE is not set
686# CONFIG_NETPOLL is not set 611# CONFIG_NETPOLL is not set
687# CONFIG_NET_POLL_CONTROLLER is not set 612# CONFIG_NET_POLL_CONTROLLER is not set
688
689#
690# ISDN subsystem
691#
692# CONFIG_ISDN is not set 613# CONFIG_ISDN is not set
693
694#
695# Telephony Support
696#
697# CONFIG_PHONE is not set 614# CONFIG_PHONE is not set
698 615
699# 616#
@@ -711,6 +628,7 @@ CONFIG_NETDEVICES=y
711# Character devices 628# Character devices
712# 629#
713# CONFIG_VT is not set 630# CONFIG_VT is not set
631CONFIG_DEVKMEM=y
714# CONFIG_SERIAL_NONSTANDARD is not set 632# CONFIG_SERIAL_NONSTANDARD is not set
715 633
716# 634#
@@ -728,99 +646,78 @@ CONFIG_SERIAL_CORE=y
728CONFIG_SERIAL_CORE_CONSOLE=y 646CONFIG_SERIAL_CORE_CONSOLE=y
729CONFIG_UNIX98_PTYS=y 647CONFIG_UNIX98_PTYS=y
730# CONFIG_LEGACY_PTYS is not set 648# CONFIG_LEGACY_PTYS is not set
731
732#
733# IPMI
734#
735# CONFIG_IPMI_HANDLER is not set 649# CONFIG_IPMI_HANDLER is not set
736
737#
738# Watchdog Cards
739#
740# CONFIG_WATCHDOG is not set
741CONFIG_HW_RANDOM=m 650CONFIG_HW_RANDOM=m
742# CONFIG_GEN_RTC is not set
743# CONFIG_DTLK is not set
744# CONFIG_R3964 is not set 651# CONFIG_R3964 is not set
745# CONFIG_RAW_DRIVER is not set 652# CONFIG_RAW_DRIVER is not set
746
747#
748# TPM devices
749#
750# CONFIG_TCG_TPM is not set 653# CONFIG_TCG_TPM is not set
751
752#
753# I2C support
754#
755# CONFIG_I2C is not set 654# CONFIG_I2C is not set
756
757#
758# SPI support
759#
760# CONFIG_SPI is not set 655# CONFIG_SPI is not set
761# CONFIG_SPI_MASTER is not set
762
763#
764# Dallas's 1-wire bus
765#
766# CONFIG_W1 is not set 656# CONFIG_W1 is not set
657# CONFIG_POWER_SUPPLY is not set
658# CONFIG_HWMON is not set
659# CONFIG_THERMAL is not set
660# CONFIG_WATCHDOG is not set
767 661
768# 662#
769# Hardware Monitoring support 663# Sonics Silicon Backplane
770# 664#
771# CONFIG_HWMON is not set 665CONFIG_SSB_POSSIBLE=y
772# CONFIG_HWMON_VID is not set 666# CONFIG_SSB is not set
773 667
774# 668#
775# Multifunction device drivers 669# Multifunction device drivers
776# 670#
777# CONFIG_MFD_SM501 is not set 671# CONFIG_MFD_SM501 is not set
672# CONFIG_HTC_PASIC3 is not set
778 673
779# 674#
780# Multimedia devices 675# Multimedia devices
781# 676#
677
678#
679# Multimedia core support
680#
782# CONFIG_VIDEO_DEV is not set 681# CONFIG_VIDEO_DEV is not set
682# CONFIG_DVB_CORE is not set
683# CONFIG_VIDEO_MEDIA is not set
783 684
784# 685#
785# Digital Video Broadcasting Devices 686# Multimedia drivers
786# 687#
787# CONFIG_DVB is not set 688# CONFIG_DAB is not set
788 689
789# 690#
790# Graphics support 691# Graphics support
791# 692#
792# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 693# CONFIG_VGASTATE is not set
694# CONFIG_VIDEO_OUTPUT_CONTROL is not set
793# CONFIG_FB is not set 695# CONFIG_FB is not set
696# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
794 697
795# 698#
796# Sound 699# Display device support
797# 700#
798# CONFIG_SOUND is not set 701# CONFIG_DISPLAY_SUPPORT is not set
799 702
800# 703#
801# USB support 704# Sound
802# 705#
803# CONFIG_USB_ARCH_HAS_HCD is not set 706# CONFIG_SOUND is not set
707CONFIG_USB_SUPPORT=y
708CONFIG_USB_ARCH_HAS_HCD=y
804# CONFIG_USB_ARCH_HAS_OHCI is not set 709# CONFIG_USB_ARCH_HAS_OHCI is not set
805# CONFIG_USB_ARCH_HAS_EHCI is not set 710# CONFIG_USB_ARCH_HAS_EHCI is not set
711# CONFIG_USB is not set
712# CONFIG_USB_OTG_WHITELIST is not set
713# CONFIG_USB_OTG_BLACKLIST_HUB is not set
806 714
807# 715#
808# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 716# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
809# 717#
810
811#
812# USB Gadget Support
813#
814# CONFIG_USB_GADGET is not set 718# CONFIG_USB_GADGET is not set
815
816#
817# MMC/SD Card support
818#
819# CONFIG_MMC is not set 719# CONFIG_MMC is not set
820 720# CONFIG_MEMSTICK is not set
821#
822# LED devices
823#
824CONFIG_NEW_LEDS=y 721CONFIG_NEW_LEDS=y
825CONFIG_LEDS_CLASS=y 722CONFIG_LEDS_CLASS=y
826 723
@@ -834,40 +731,10 @@ CONFIG_LEDS_CLASS=y
834CONFIG_LEDS_TRIGGERS=y 731CONFIG_LEDS_TRIGGERS=y
835# CONFIG_LEDS_TRIGGER_TIMER is not set 732# CONFIG_LEDS_TRIGGER_TIMER is not set
836# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set 733# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
837 734# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
838# 735# CONFIG_ACCESSIBILITY is not set
839# InfiniBand support
840#
841
842#
843# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
844#
845
846#
847# Real Time Clock
848#
849# CONFIG_RTC_CLASS is not set 736# CONFIG_RTC_CLASS is not set
850 737# CONFIG_UIO is not set
851#
852# DMA Engine support
853#
854# CONFIG_DMA_ENGINE is not set
855
856#
857# DMA Clients
858#
859
860#
861# DMA Devices
862#
863
864#
865# Auxiliary Display support
866#
867
868#
869# Virtualization
870#
871 738
872# 739#
873# File systems 740# File systems
@@ -877,20 +744,21 @@ CONFIG_EXT2_FS_XATTR=y
877CONFIG_EXT2_FS_POSIX_ACL=y 744CONFIG_EXT2_FS_POSIX_ACL=y
878CONFIG_EXT2_FS_SECURITY=y 745CONFIG_EXT2_FS_SECURITY=y
879# CONFIG_EXT2_FS_XIP is not set 746# CONFIG_EXT2_FS_XIP is not set
880# CONFIG_EXT3_FS is not set 747CONFIG_EXT3_FS=y
748CONFIG_EXT3_FS_XATTR=y
749# CONFIG_EXT3_FS_POSIX_ACL is not set
750# CONFIG_EXT3_FS_SECURITY is not set
881# CONFIG_EXT4DEV_FS is not set 751# CONFIG_EXT4DEV_FS is not set
752CONFIG_JBD=y
882CONFIG_FS_MBCACHE=y 753CONFIG_FS_MBCACHE=y
883# CONFIG_REISERFS_FS is not set 754# CONFIG_REISERFS_FS is not set
884# CONFIG_JFS_FS is not set 755# CONFIG_JFS_FS is not set
885CONFIG_FS_POSIX_ACL=y 756CONFIG_FS_POSIX_ACL=y
886# CONFIG_XFS_FS is not set 757# CONFIG_XFS_FS is not set
887# CONFIG_GFS2_FS is not set
888# CONFIG_OCFS2_FS is not set 758# CONFIG_OCFS2_FS is not set
889# CONFIG_MINIX_FS is not set 759# CONFIG_DNOTIFY is not set
890# CONFIG_ROMFS_FS is not set
891# CONFIG_INOTIFY is not set 760# CONFIG_INOTIFY is not set
892# CONFIG_QUOTA is not set 761# CONFIG_QUOTA is not set
893# CONFIG_DNOTIFY is not set
894# CONFIG_AUTOFS_FS is not set 762# CONFIG_AUTOFS_FS is not set
895# CONFIG_AUTOFS4_FS is not set 763# CONFIG_AUTOFS4_FS is not set
896# CONFIG_FUSE_FS is not set 764# CONFIG_FUSE_FS is not set
@@ -919,7 +787,6 @@ CONFIG_TMPFS=y
919# CONFIG_TMPFS_POSIX_ACL is not set 787# CONFIG_TMPFS_POSIX_ACL is not set
920# CONFIG_HUGETLBFS is not set 788# CONFIG_HUGETLBFS is not set
921# CONFIG_HUGETLB_PAGE is not set 789# CONFIG_HUGETLB_PAGE is not set
922CONFIG_RAMFS=y
923# CONFIG_CONFIGFS_FS is not set 790# CONFIG_CONFIGFS_FS is not set
924 791
925# 792#
@@ -935,68 +802,67 @@ CONFIG_RAMFS=y
935CONFIG_JFFS2_FS=y 802CONFIG_JFFS2_FS=y
936CONFIG_JFFS2_FS_DEBUG=0 803CONFIG_JFFS2_FS_DEBUG=0
937CONFIG_JFFS2_FS_WRITEBUFFER=y 804CONFIG_JFFS2_FS_WRITEBUFFER=y
805# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
938# CONFIG_JFFS2_SUMMARY is not set 806# CONFIG_JFFS2_SUMMARY is not set
939# CONFIG_JFFS2_FS_XATTR is not set 807# CONFIG_JFFS2_FS_XATTR is not set
940# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 808# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
941CONFIG_JFFS2_ZLIB=y 809CONFIG_JFFS2_ZLIB=y
810# CONFIG_JFFS2_LZO is not set
942CONFIG_JFFS2_RTIME=y 811CONFIG_JFFS2_RTIME=y
943# CONFIG_JFFS2_RUBIN is not set 812# CONFIG_JFFS2_RUBIN is not set
944CONFIG_CRAMFS=y 813CONFIG_CRAMFS=y
945# CONFIG_VXFS_FS is not set 814# CONFIG_VXFS_FS is not set
815# CONFIG_MINIX_FS is not set
946# CONFIG_HPFS_FS is not set 816# CONFIG_HPFS_FS is not set
947# CONFIG_QNX4FS_FS is not set 817# CONFIG_QNX4FS_FS is not set
818# CONFIG_ROMFS_FS is not set
948# CONFIG_SYSV_FS is not set 819# CONFIG_SYSV_FS is not set
949# CONFIG_UFS_FS is not set 820# CONFIG_UFS_FS is not set
950 821CONFIG_NETWORK_FILESYSTEMS=y
951# 822CONFIG_NFS_FS=y
952# Network File Systems 823# CONFIG_NFS_V3 is not set
953# 824# CONFIG_NFS_V4 is not set
954# CONFIG_NFS_FS is not set
955# CONFIG_NFSD is not set 825# CONFIG_NFSD is not set
826CONFIG_ROOT_NFS=y
827CONFIG_LOCKD=y
828CONFIG_NFS_COMMON=y
829CONFIG_SUNRPC=y
830# CONFIG_SUNRPC_BIND34 is not set
831# CONFIG_RPCSEC_GSS_KRB5 is not set
832# CONFIG_RPCSEC_GSS_SPKM3 is not set
956# CONFIG_SMB_FS is not set 833# CONFIG_SMB_FS is not set
957# CONFIG_CIFS is not set 834# CONFIG_CIFS is not set
958# CONFIG_NCP_FS is not set 835# CONFIG_NCP_FS is not set
959# CONFIG_CODA_FS is not set 836# CONFIG_CODA_FS is not set
960# CONFIG_AFS_FS is not set 837# CONFIG_AFS_FS is not set
961# CONFIG_9P_FS is not set
962 838
963# 839#
964# Partition Types 840# Partition Types
965# 841#
966# CONFIG_PARTITION_ADVANCED is not set 842# CONFIG_PARTITION_ADVANCED is not set
967CONFIG_MSDOS_PARTITION=y 843CONFIG_MSDOS_PARTITION=y
968
969#
970# Native Language Support
971#
972# CONFIG_NLS is not set 844# CONFIG_NLS is not set
973
974#
975# Distributed Lock Manager
976#
977# CONFIG_DLM is not set 845# CONFIG_DLM is not set
978 846
979# 847#
980# Profiling support
981#
982# CONFIG_PROFILING is not set
983
984#
985# Kernel hacking 848# Kernel hacking
986# 849#
987CONFIG_TRACE_IRQFLAGS_SUPPORT=y 850CONFIG_TRACE_IRQFLAGS_SUPPORT=y
988# CONFIG_PRINTK_TIME is not set 851# CONFIG_PRINTK_TIME is not set
852CONFIG_ENABLE_WARN_DEPRECATED=y
989CONFIG_ENABLE_MUST_CHECK=y 853CONFIG_ENABLE_MUST_CHECK=y
854CONFIG_FRAME_WARN=1024
990# CONFIG_MAGIC_SYSRQ is not set 855# CONFIG_MAGIC_SYSRQ is not set
991# CONFIG_UNUSED_SYMBOLS is not set 856# CONFIG_UNUSED_SYMBOLS is not set
992# CONFIG_DEBUG_FS is not set 857# CONFIG_DEBUG_FS is not set
993# CONFIG_HEADERS_CHECK is not set 858# CONFIG_HEADERS_CHECK is not set
994CONFIG_DEBUG_KERNEL=y 859CONFIG_DEBUG_KERNEL=y
995# CONFIG_DEBUG_SHIRQ is not set 860# CONFIG_DEBUG_SHIRQ is not set
996CONFIG_LOG_BUF_SHIFT=14
997# CONFIG_DETECT_SOFTLOCKUP is not set 861# CONFIG_DETECT_SOFTLOCKUP is not set
862CONFIG_SCHED_DEBUG=y
998# CONFIG_SCHEDSTATS is not set 863# CONFIG_SCHEDSTATS is not set
999# CONFIG_TIMER_STATS is not set 864# CONFIG_TIMER_STATS is not set
865# CONFIG_DEBUG_OBJECTS is not set
1000# CONFIG_DEBUG_SLAB is not set 866# CONFIG_DEBUG_SLAB is not set
1001# CONFIG_DEBUG_RT_MUTEXES is not set 867# CONFIG_DEBUG_RT_MUTEXES is not set
1002# CONFIG_RT_MUTEX_TESTER is not set 868# CONFIG_RT_MUTEX_TESTER is not set
@@ -1004,21 +870,28 @@ CONFIG_LOG_BUF_SHIFT=14
1004# CONFIG_DEBUG_MUTEXES is not set 870# CONFIG_DEBUG_MUTEXES is not set
1005# CONFIG_DEBUG_LOCK_ALLOC is not set 871# CONFIG_DEBUG_LOCK_ALLOC is not set
1006# CONFIG_PROVE_LOCKING is not set 872# CONFIG_PROVE_LOCKING is not set
873# CONFIG_LOCK_STAT is not set
1007# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 874# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1008# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 875# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1009# CONFIG_DEBUG_KOBJECT is not set 876# CONFIG_DEBUG_KOBJECT is not set
1010CONFIG_DEBUG_INFO=y 877CONFIG_DEBUG_INFO=y
1011# CONFIG_DEBUG_VM is not set 878# CONFIG_DEBUG_VM is not set
879# CONFIG_DEBUG_WRITECOUNT is not set
1012# CONFIG_DEBUG_LIST is not set 880# CONFIG_DEBUG_LIST is not set
881# CONFIG_DEBUG_SG is not set
1013CONFIG_FRAME_POINTER=y 882CONFIG_FRAME_POINTER=y
1014# CONFIG_FORCED_INLINING is not set 883# CONFIG_BOOT_PRINTK_DELAY is not set
1015# CONFIG_RCU_TORTURE_TEST is not set 884# CONFIG_RCU_TORTURE_TEST is not set
885# CONFIG_BACKTRACE_SELF_TEST is not set
1016# CONFIG_FAULT_INJECTION is not set 886# CONFIG_FAULT_INJECTION is not set
887# CONFIG_SAMPLES is not set
1017# CONFIG_SH_STANDARD_BIOS is not set 888# CONFIG_SH_STANDARD_BIOS is not set
1018# CONFIG_EARLY_SCIF_CONSOLE is not set 889# CONFIG_EARLY_SCIF_CONSOLE is not set
890# CONFIG_DEBUG_BOOTMEM is not set
1019# CONFIG_DEBUG_STACKOVERFLOW is not set 891# CONFIG_DEBUG_STACKOVERFLOW is not set
1020# CONFIG_DEBUG_STACK_USAGE is not set 892# CONFIG_DEBUG_STACK_USAGE is not set
1021# CONFIG_4KSTACKS is not set 893# CONFIG_4KSTACKS is not set
894# CONFIG_IRQSTACKS is not set
1022# CONFIG_SH_KGDB is not set 895# CONFIG_SH_KGDB is not set
1023 896
1024# 897#
@@ -1026,62 +899,100 @@ CONFIG_FRAME_POINTER=y
1026# 899#
1027# CONFIG_KEYS is not set 900# CONFIG_KEYS is not set
1028# CONFIG_SECURITY is not set 901# CONFIG_SECURITY is not set
902# CONFIG_SECURITY_FILE_CAPABILITIES is not set
903CONFIG_CRYPTO=y
1029 904
1030# 905#
1031# Cryptographic options 906# Crypto core or helper
1032# 907#
1033CONFIG_CRYPTO=y
1034CONFIG_CRYPTO_ALGAPI=y 908CONFIG_CRYPTO_ALGAPI=y
909CONFIG_CRYPTO_AEAD=y
1035CONFIG_CRYPTO_BLKCIPHER=y 910CONFIG_CRYPTO_BLKCIPHER=y
1036CONFIG_CRYPTO_HASH=y 911CONFIG_CRYPTO_HASH=y
1037CONFIG_CRYPTO_MANAGER=y 912CONFIG_CRYPTO_MANAGER=y
913# CONFIG_CRYPTO_GF128MUL is not set
914# CONFIG_CRYPTO_NULL is not set
915# CONFIG_CRYPTO_CRYPTD is not set
916CONFIG_CRYPTO_AUTHENC=y
917# CONFIG_CRYPTO_TEST is not set
918
919#
920# Authenticated Encryption with Associated Data
921#
922# CONFIG_CRYPTO_CCM is not set
923# CONFIG_CRYPTO_GCM is not set
924# CONFIG_CRYPTO_SEQIV is not set
925
926#
927# Block modes
928#
929CONFIG_CRYPTO_CBC=y
930# CONFIG_CRYPTO_CTR is not set
931# CONFIG_CRYPTO_CTS is not set
932CONFIG_CRYPTO_ECB=m
933# CONFIG_CRYPTO_LRW is not set
934CONFIG_CRYPTO_PCBC=m
935# CONFIG_CRYPTO_XTS is not set
936
937#
938# Hash modes
939#
1038CONFIG_CRYPTO_HMAC=y 940CONFIG_CRYPTO_HMAC=y
1039# CONFIG_CRYPTO_XCBC is not set 941# CONFIG_CRYPTO_XCBC is not set
1040# CONFIG_CRYPTO_NULL is not set 942
943#
944# Digest
945#
946# CONFIG_CRYPTO_CRC32C is not set
1041# CONFIG_CRYPTO_MD4 is not set 947# CONFIG_CRYPTO_MD4 is not set
1042CONFIG_CRYPTO_MD5=y 948CONFIG_CRYPTO_MD5=y
949# CONFIG_CRYPTO_MICHAEL_MIC is not set
1043CONFIG_CRYPTO_SHA1=y 950CONFIG_CRYPTO_SHA1=y
1044# CONFIG_CRYPTO_SHA256 is not set 951# CONFIG_CRYPTO_SHA256 is not set
1045# CONFIG_CRYPTO_SHA512 is not set 952# CONFIG_CRYPTO_SHA512 is not set
1046# CONFIG_CRYPTO_WP512 is not set
1047# CONFIG_CRYPTO_TGR192 is not set 953# CONFIG_CRYPTO_TGR192 is not set
1048# CONFIG_CRYPTO_GF128MUL is not set 954# CONFIG_CRYPTO_WP512 is not set
1049CONFIG_CRYPTO_ECB=m 955
1050CONFIG_CRYPTO_CBC=y 956#
1051CONFIG_CRYPTO_PCBC=m 957# Ciphers
1052# CONFIG_CRYPTO_LRW is not set 958#
1053CONFIG_CRYPTO_DES=y
1054# CONFIG_CRYPTO_FCRYPT is not set
1055# CONFIG_CRYPTO_BLOWFISH is not set
1056# CONFIG_CRYPTO_TWOFISH is not set
1057# CONFIG_CRYPTO_SERPENT is not set
1058# CONFIG_CRYPTO_AES is not set 959# CONFIG_CRYPTO_AES is not set
960# CONFIG_CRYPTO_ANUBIS is not set
961# CONFIG_CRYPTO_ARC4 is not set
962# CONFIG_CRYPTO_BLOWFISH is not set
963# CONFIG_CRYPTO_CAMELLIA is not set
1059# CONFIG_CRYPTO_CAST5 is not set 964# CONFIG_CRYPTO_CAST5 is not set
1060# CONFIG_CRYPTO_CAST6 is not set 965# CONFIG_CRYPTO_CAST6 is not set
1061# CONFIG_CRYPTO_TEA is not set 966CONFIG_CRYPTO_DES=y
1062# CONFIG_CRYPTO_ARC4 is not set 967# CONFIG_CRYPTO_FCRYPT is not set
1063# CONFIG_CRYPTO_KHAZAD is not set 968# CONFIG_CRYPTO_KHAZAD is not set
1064# CONFIG_CRYPTO_ANUBIS is not set 969# CONFIG_CRYPTO_SALSA20 is not set
1065CONFIG_CRYPTO_DEFLATE=y 970# CONFIG_CRYPTO_SEED is not set
1066# CONFIG_CRYPTO_MICHAEL_MIC is not set 971# CONFIG_CRYPTO_SERPENT is not set
1067# CONFIG_CRYPTO_CRC32C is not set 972# CONFIG_CRYPTO_TEA is not set
1068# CONFIG_CRYPTO_CAMELLIA is not set 973# CONFIG_CRYPTO_TWOFISH is not set
1069# CONFIG_CRYPTO_TEST is not set
1070 974
1071# 975#
1072# Hardware crypto devices 976# Compression
1073# 977#
978CONFIG_CRYPTO_DEFLATE=y
979# CONFIG_CRYPTO_LZO is not set
980CONFIG_CRYPTO_HW=y
1074 981
1075# 982#
1076# Library routines 983# Library routines
1077# 984#
1078CONFIG_BITREVERSE=y 985CONFIG_BITREVERSE=y
986# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1079CONFIG_CRC_CCITT=y 987CONFIG_CRC_CCITT=y
1080# CONFIG_CRC16 is not set 988# CONFIG_CRC16 is not set
989# CONFIG_CRC_ITU_T is not set
1081CONFIG_CRC32=y 990CONFIG_CRC32=y
991# CONFIG_CRC7 is not set
1082# CONFIG_LIBCRC32C is not set 992# CONFIG_LIBCRC32C is not set
1083CONFIG_ZLIB_INFLATE=y 993CONFIG_ZLIB_INFLATE=y
1084CONFIG_ZLIB_DEFLATE=y 994CONFIG_ZLIB_DEFLATE=y
1085CONFIG_PLIST=y 995CONFIG_PLIST=y
1086CONFIG_HAS_IOMEM=y 996CONFIG_HAS_IOMEM=y
1087CONFIG_HAS_IOPORT=y 997CONFIG_HAS_IOPORT=y
998CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/sh7763rdp_defconfig b/arch/sh/configs/sh7763rdp_defconfig
new file mode 100644
index 000000000000..83f3fe5db3e5
--- /dev/null
+++ b/arch/sh/configs/sh7763rdp_defconfig
@@ -0,0 +1,1052 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4
4# Fri Jun 6 12:20:17 2008
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y
11CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_HARDIRQS=y
13CONFIG_GENERIC_IRQ_PROBE=y
14CONFIG_GENERIC_CALIBRATE_DELAY=y
15CONFIG_GENERIC_TIME=y
16CONFIG_GENERIC_CLOCKEVENTS=y
17CONFIG_STACKTRACE_SUPPORT=y
18CONFIG_LOCKDEP_SUPPORT=y
19# CONFIG_ARCH_HAS_ILOG2_U32 is not set
20# CONFIG_ARCH_HAS_ILOG2_U64 is not set
21CONFIG_ARCH_NO_VIRT_TO_BUS=y
22CONFIG_ARCH_SUPPORTS_AOUT=y
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
24
25#
26# General setup
27#
28CONFIG_EXPERIMENTAL=y
29CONFIG_BROKEN_ON_SMP=y
30CONFIG_INIT_ENV_ARG_LIMIT=32
31CONFIG_LOCALVERSION=""
32CONFIG_LOCALVERSION_AUTO=y
33CONFIG_SWAP=y
34CONFIG_SYSVIPC=y
35CONFIG_SYSVIPC_SYSCTL=y
36# CONFIG_POSIX_MQUEUE is not set
37# CONFIG_BSD_PROCESS_ACCT is not set
38# CONFIG_TASKSTATS is not set
39# CONFIG_AUDIT is not set
40CONFIG_IKCONFIG=y
41CONFIG_IKCONFIG_PROC=y
42CONFIG_LOG_BUF_SHIFT=14
43# CONFIG_CGROUPS is not set
44CONFIG_GROUP_SCHED=y
45CONFIG_FAIR_GROUP_SCHED=y
46# CONFIG_RT_GROUP_SCHED is not set
47CONFIG_USER_SCHED=y
48# CONFIG_CGROUP_SCHED is not set
49CONFIG_SYSFS_DEPRECATED=y
50CONFIG_SYSFS_DEPRECATED_V2=y
51# CONFIG_RELAY is not set
52CONFIG_NAMESPACES=y
53CONFIG_UTS_NS=y
54CONFIG_IPC_NS=y
55# CONFIG_USER_NS is not set
56# CONFIG_PID_NS is not set
57# CONFIG_BLK_DEV_INITRD is not set
58CONFIG_CC_OPTIMIZE_FOR_SIZE=y
59CONFIG_SYSCTL=y
60CONFIG_EMBEDDED=y
61CONFIG_UID16=y
62# CONFIG_SYSCTL_SYSCALL is not set
63CONFIG_KALLSYMS=y
64# CONFIG_KALLSYMS_EXTRA_PASS is not set
65CONFIG_HOTPLUG=y
66CONFIG_PRINTK=y
67CONFIG_BUG=y
68CONFIG_ELF_CORE=y
69CONFIG_COMPAT_BRK=y
70CONFIG_BASE_FULL=y
71CONFIG_FUTEX=y
72CONFIG_ANON_INODES=y
73CONFIG_EPOLL=y
74CONFIG_SIGNALFD=y
75CONFIG_TIMERFD=y
76CONFIG_EVENTFD=y
77CONFIG_SHMEM=y
78CONFIG_VM_EVENT_COUNTERS=y
79CONFIG_SLAB=y
80# CONFIG_SLUB is not set
81# CONFIG_SLOB is not set
82CONFIG_PROFILING=y
83# CONFIG_MARKERS is not set
84CONFIG_OPROFILE=y
85CONFIG_HAVE_OPROFILE=y
86# CONFIG_HAVE_KPROBES is not set
87# CONFIG_HAVE_KRETPROBES is not set
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
96# CONFIG_MODULE_UNLOAD is not set
97# CONFIG_MODVERSIONS is not set
98# CONFIG_MODULE_SRCVERSION_ALL is not set
99# CONFIG_KMOD is not set
100CONFIG_BLOCK=y
101# CONFIG_LBD is not set
102# CONFIG_BLK_DEV_IO_TRACE is not set
103# CONFIG_LSF is not set
104# CONFIG_BLK_DEV_BSG is not set
105
106#
107# IO Schedulers
108#
109CONFIG_IOSCHED_NOOP=y
110CONFIG_IOSCHED_AS=y
111CONFIG_IOSCHED_DEADLINE=y
112CONFIG_IOSCHED_CFQ=y
113CONFIG_DEFAULT_AS=y
114# CONFIG_DEFAULT_DEADLINE is not set
115# CONFIG_DEFAULT_CFQ is not set
116# CONFIG_DEFAULT_NOOP is not set
117CONFIG_DEFAULT_IOSCHED="anticipatory"
118CONFIG_CLASSIC_RCU=y
119
120#
121# System type
122#
123CONFIG_CPU_SH4=y
124CONFIG_CPU_SH4A=y
125# CONFIG_CPU_SUBTYPE_SH7619 is not set
126# CONFIG_CPU_SUBTYPE_SH7203 is not set
127# CONFIG_CPU_SUBTYPE_SH7206 is not set
128# CONFIG_CPU_SUBTYPE_SH7263 is not set
129# CONFIG_CPU_SUBTYPE_MXG is not set
130# CONFIG_CPU_SUBTYPE_SH7705 is not set
131# CONFIG_CPU_SUBTYPE_SH7706 is not set
132# CONFIG_CPU_SUBTYPE_SH7707 is not set
133# CONFIG_CPU_SUBTYPE_SH7708 is not set
134# CONFIG_CPU_SUBTYPE_SH7709 is not set
135# CONFIG_CPU_SUBTYPE_SH7710 is not set
136# CONFIG_CPU_SUBTYPE_SH7712 is not set
137# CONFIG_CPU_SUBTYPE_SH7720 is not set
138# CONFIG_CPU_SUBTYPE_SH7721 is not set
139# CONFIG_CPU_SUBTYPE_SH7750 is not set
140# CONFIG_CPU_SUBTYPE_SH7091 is not set
141# CONFIG_CPU_SUBTYPE_SH7750R is not set
142# CONFIG_CPU_SUBTYPE_SH7750S is not set
143# CONFIG_CPU_SUBTYPE_SH7751 is not set
144# CONFIG_CPU_SUBTYPE_SH7751R is not set
145# CONFIG_CPU_SUBTYPE_SH7760 is not set
146# CONFIG_CPU_SUBTYPE_SH4_202 is not set
147# CONFIG_CPU_SUBTYPE_SH7723 is not set
148CONFIG_CPU_SUBTYPE_SH7763=y
149# CONFIG_CPU_SUBTYPE_SH7770 is not set
150# CONFIG_CPU_SUBTYPE_SH7780 is not set
151# CONFIG_CPU_SUBTYPE_SH7785 is not set
152# CONFIG_CPU_SUBTYPE_SHX3 is not set
153# CONFIG_CPU_SUBTYPE_SH7343 is not set
154# CONFIG_CPU_SUBTYPE_SH7722 is not set
155# CONFIG_CPU_SUBTYPE_SH7366 is not set
156# CONFIG_CPU_SUBTYPE_SH5_101 is not set
157# CONFIG_CPU_SUBTYPE_SH5_103 is not set
158
159#
160# Memory management options
161#
162CONFIG_QUICKLIST=y
163CONFIG_MMU=y
164CONFIG_PAGE_OFFSET=0x80000000
165CONFIG_MEMORY_START=0x0c000000
166CONFIG_MEMORY_SIZE=0x04000000
167CONFIG_29BIT=y
168CONFIG_VSYSCALL=y
169CONFIG_ARCH_FLATMEM_ENABLE=y
170CONFIG_ARCH_SPARSEMEM_ENABLE=y
171CONFIG_ARCH_SPARSEMEM_DEFAULT=y
172CONFIG_MAX_ACTIVE_REGIONS=1
173CONFIG_ARCH_POPULATES_NODE_MAP=y
174CONFIG_ARCH_SELECT_MEMORY_MODEL=y
175CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
176CONFIG_PAGE_SIZE_4KB=y
177# CONFIG_PAGE_SIZE_8KB is not set
178# CONFIG_PAGE_SIZE_16KB is not set
179# CONFIG_PAGE_SIZE_64KB is not set
180CONFIG_SELECT_MEMORY_MODEL=y
181# CONFIG_FLATMEM_MANUAL is not set
182# CONFIG_DISCONTIGMEM_MANUAL is not set
183CONFIG_SPARSEMEM_MANUAL=y
184CONFIG_SPARSEMEM=y
185CONFIG_HAVE_MEMORY_PRESENT=y
186CONFIG_SPARSEMEM_STATIC=y
187# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
188# CONFIG_MEMORY_HOTPLUG is not set
189CONFIG_PAGEFLAGS_EXTENDED=y
190CONFIG_SPLIT_PTLOCK_CPUS=4
191# CONFIG_RESOURCES_64BIT is not set
192CONFIG_ZONE_DMA_FLAG=0
193CONFIG_NR_QUICK=2
194
195#
196# Cache configuration
197#
198# CONFIG_SH_DIRECT_MAPPED is not set
199CONFIG_CACHE_WRITEBACK=y
200# CONFIG_CACHE_WRITETHROUGH is not set
201# CONFIG_CACHE_OFF is not set
202
203#
204# Processor features
205#
206CONFIG_CPU_LITTLE_ENDIAN=y
207# CONFIG_CPU_BIG_ENDIAN is not set
208CONFIG_SH_FPU=y
209# CONFIG_SH_STORE_QUEUES is not set
210CONFIG_CPU_HAS_INTEVT=y
211CONFIG_CPU_HAS_SR_RB=y
212CONFIG_CPU_HAS_FPU=y
213
214#
215# Board support
216#
217CONFIG_SH_SH7763RDP=y
218
219#
220# Timer and clock configuration
221#
222CONFIG_SH_TMU=y
223CONFIG_SH_TIMER_IRQ=28
224CONFIG_SH_PCLK_FREQ=66666666
225# CONFIG_TICK_ONESHOT is not set
226# CONFIG_NO_HZ is not set
227# CONFIG_HIGH_RES_TIMERS is not set
228CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
229
230#
231# CPU Frequency scaling
232#
233# CONFIG_CPU_FREQ is not set
234
235#
236# DMA support
237#
238# CONFIG_SH_DMA is not set
239
240#
241# Companion Chips
242#
243
244#
245# Additional SuperH Device Drivers
246#
247# CONFIG_HEARTBEAT is not set
248# CONFIG_PUSH_SWITCH is not set
249
250#
251# Kernel features
252#
253# CONFIG_HZ_100 is not set
254CONFIG_HZ_250=y
255# CONFIG_HZ_300 is not set
256# CONFIG_HZ_1000 is not set
257CONFIG_HZ=250
258# CONFIG_SCHED_HRTICK is not set
259# CONFIG_KEXEC is not set
260# CONFIG_CRASH_DUMP is not set
261CONFIG_PREEMPT_NONE=y
262# CONFIG_PREEMPT_VOLUNTARY is not set
263# CONFIG_PREEMPT is not set
264CONFIG_GUSA=y
265
266#
267# Boot options
268#
269CONFIG_ZERO_PAGE_OFFSET=0x00001000
270CONFIG_BOOT_LINK_OFFSET=0x00800000
271CONFIG_CMDLINE_BOOL=y
272CONFIG_CMDLINE="console=ttySC2,115200 root=/dev/sda1 rootdelay=10"
273
274#
275# Bus options
276#
277# CONFIG_ARCH_SUPPORTS_MSI is not set
278# CONFIG_PCCARD is not set
279
280#
281# Executable file formats
282#
283CONFIG_BINFMT_ELF=y
284# CONFIG_BINFMT_MISC is not set
285
286#
287# Networking
288#
289CONFIG_NET=y
290
291#
292# Networking options
293#
294CONFIG_PACKET=y
295# CONFIG_PACKET_MMAP is not set
296CONFIG_UNIX=y
297CONFIG_XFRM=y
298# CONFIG_XFRM_USER is not set
299# CONFIG_XFRM_SUB_POLICY is not set
300# CONFIG_XFRM_MIGRATE is not set
301# CONFIG_XFRM_STATISTICS is not set
302# CONFIG_NET_KEY is not set
303CONFIG_INET=y
304# CONFIG_IP_MULTICAST is not set
305# CONFIG_IP_ADVANCED_ROUTER is not set
306CONFIG_IP_FIB_HASH=y
307CONFIG_IP_PNP=y
308CONFIG_IP_PNP_DHCP=y
309CONFIG_IP_PNP_BOOTP=y
310# CONFIG_IP_PNP_RARP is not set
311# CONFIG_NET_IPIP is not set
312# CONFIG_NET_IPGRE is not set
313# CONFIG_ARPD is not set
314# CONFIG_SYN_COOKIES is not set
315# CONFIG_INET_AH is not set
316# CONFIG_INET_ESP is not set
317# CONFIG_INET_IPCOMP is not set
318# CONFIG_INET_XFRM_TUNNEL is not set
319# CONFIG_INET_TUNNEL is not set
320CONFIG_INET_XFRM_MODE_TRANSPORT=y
321CONFIG_INET_XFRM_MODE_TUNNEL=y
322CONFIG_INET_XFRM_MODE_BEET=y
323# CONFIG_INET_LRO is not set
324CONFIG_INET_DIAG=y
325CONFIG_INET_TCP_DIAG=y
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_NETWORK_SECMARK is not set
332# CONFIG_NETFILTER is not set
333# CONFIG_IP_DCCP is not set
334# CONFIG_IP_SCTP is not set
335# CONFIG_TIPC is not set
336# CONFIG_ATM is not set
337# CONFIG_BRIDGE is not set
338# CONFIG_VLAN_8021Q is not set
339# CONFIG_DECNET is not set
340# CONFIG_LLC2 is not set
341# CONFIG_IPX is not set
342# CONFIG_ATALK is not set
343# CONFIG_X25 is not set
344# CONFIG_LAPB is not set
345# CONFIG_ECONET is not set
346# CONFIG_WAN_ROUTER is not set
347# CONFIG_NET_SCHED is not set
348
349#
350# Network testing
351#
352# CONFIG_NET_PKTGEN is not set
353# CONFIG_HAMRADIO is not set
354# CONFIG_CAN is not set
355# CONFIG_IRDA is not set
356# CONFIG_BT is not set
357# CONFIG_AF_RXRPC is not set
358
359#
360# Wireless
361#
362# CONFIG_CFG80211 is not set
363CONFIG_WIRELESS_EXT=y
364# CONFIG_MAC80211 is not set
365# CONFIG_IEEE80211 is not set
366# CONFIG_RFKILL is not set
367# CONFIG_NET_9P is not set
368
369#
370# Device Drivers
371#
372
373#
374# Generic Driver Options
375#
376CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
377CONFIG_STANDALONE=y
378CONFIG_PREVENT_FIRMWARE_BUILD=y
379CONFIG_FW_LOADER=y
380# CONFIG_SYS_HYPERVISOR is not set
381# CONFIG_CONNECTOR is not set
382CONFIG_MTD=y
383# CONFIG_MTD_DEBUG is not set
384# CONFIG_MTD_CONCAT is not set
385CONFIG_MTD_PARTITIONS=y
386# CONFIG_MTD_REDBOOT_PARTS is not set
387CONFIG_MTD_CMDLINE_PARTS=y
388# CONFIG_MTD_AR7_PARTS is not set
389
390#
391# User Modules And Translation Layers
392#
393# CONFIG_MTD_CHAR is not set
394CONFIG_MTD_BLKDEVS=y
395# CONFIG_MTD_BLOCK is not set
396# CONFIG_MTD_BLOCK_RO is not set
397# CONFIG_FTL is not set
398# CONFIG_NFTL is not set
399# CONFIG_INFTL is not set
400# CONFIG_RFD_FTL is not set
401# CONFIG_SSFDC is not set
402# CONFIG_MTD_OOPS is not set
403
404#
405# RAM/ROM/Flash chip drivers
406#
407CONFIG_MTD_CFI=y
408CONFIG_MTD_JEDECPROBE=y
409CONFIG_MTD_GEN_PROBE=y
410CONFIG_MTD_CFI_ADV_OPTIONS=y
411CONFIG_MTD_CFI_NOSWAP=y
412# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
413# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
414CONFIG_MTD_CFI_GEOMETRY=y
415CONFIG_MTD_MAP_BANK_WIDTH_1=y
416CONFIG_MTD_MAP_BANK_WIDTH_2=y
417# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
418# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
419# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
420# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
421CONFIG_MTD_CFI_I1=y
422CONFIG_MTD_CFI_I2=y
423# CONFIG_MTD_CFI_I4 is not set
424# CONFIG_MTD_CFI_I8 is not set
425# CONFIG_MTD_OTP is not set
426CONFIG_MTD_CFI_INTELEXT=y
427CONFIG_MTD_CFI_AMDSTD=y
428CONFIG_MTD_CFI_STAA=y
429CONFIG_MTD_CFI_UTIL=y
430# CONFIG_MTD_RAM is not set
431# CONFIG_MTD_ROM is not set
432# CONFIG_MTD_ABSENT is not set
433
434#
435# Mapping drivers for chip access
436#
437CONFIG_MTD_COMPLEX_MAPPINGS=y
438CONFIG_MTD_PHYSMAP=y
439CONFIG_MTD_PHYSMAP_START=0x8000000
440CONFIG_MTD_PHYSMAP_LEN=0
441CONFIG_MTD_PHYSMAP_BANKWIDTH=2
442# CONFIG_MTD_PLATRAM is not set
443
444#
445# Self-contained MTD device drivers
446#
447# CONFIG_MTD_SLRAM is not set
448# CONFIG_MTD_PHRAM is not set
449# CONFIG_MTD_MTDRAM is not set
450# CONFIG_MTD_BLOCK2MTD is not set
451
452#
453# Disk-On-Chip Device Drivers
454#
455# CONFIG_MTD_DOC2000 is not set
456# CONFIG_MTD_DOC2001 is not set
457# CONFIG_MTD_DOC2001PLUS is not set
458# CONFIG_MTD_NAND is not set
459# CONFIG_MTD_ONENAND is not set
460
461#
462# UBI - Unsorted block images
463#
464# CONFIG_MTD_UBI is not set
465# CONFIG_PARPORT is not set
466CONFIG_BLK_DEV=y
467# CONFIG_BLK_DEV_COW_COMMON is not set
468# CONFIG_BLK_DEV_LOOP is not set
469# CONFIG_BLK_DEV_NBD is not set
470# CONFIG_BLK_DEV_UB is not set
471# CONFIG_BLK_DEV_RAM is not set
472# CONFIG_CDROM_PKTCDVD is not set
473# CONFIG_ATA_OVER_ETH is not set
474# CONFIG_MISC_DEVICES is not set
475CONFIG_HAVE_IDE=y
476# CONFIG_IDE 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#
501# CONFIG_SCSI_MULTI_LUN is not set
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_REALTEK_PHY is not set
543# CONFIG_FIXED_PHY is not set
544CONFIG_MDIO_BITBANG=y
545CONFIG_NET_ETHERNET=y
546CONFIG_MII=y
547# CONFIG_AX88796 is not set
548# CONFIG_STNIC is not set
549# CONFIG_SMC91X 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
555# CONFIG_NETDEV_1000 is not set
556# CONFIG_NETDEV_10000 is not set
557
558#
559# Wireless LAN
560#
561# CONFIG_WLAN_PRE80211 is not set
562# CONFIG_WLAN_80211 is not set
563# CONFIG_IWLWIFI_LEDS is not set
564
565#
566# USB Network Adapters
567#
568# CONFIG_USB_CATC is not set
569# CONFIG_USB_KAWETH is not set
570# CONFIG_USB_PEGASUS is not set
571# CONFIG_USB_RTL8150 is not set
572# CONFIG_USB_USBNET is not set
573# CONFIG_WAN is not set
574# CONFIG_PPP is not set
575# CONFIG_SLIP 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# CONFIG_PHONE is not set
581
582#
583# Input device support
584#
585CONFIG_INPUT=y
586# CONFIG_INPUT_FF_MEMLESS is not set
587# CONFIG_INPUT_POLLDEV is not set
588
589#
590# Userland interfaces
591#
592# CONFIG_INPUT_MOUSEDEV is not set
593# CONFIG_INPUT_JOYDEV is not set
594# CONFIG_INPUT_EVDEV is not set
595# CONFIG_INPUT_EVBUG is not set
596
597#
598# Input Device Drivers
599#
600# CONFIG_INPUT_KEYBOARD is not set
601# CONFIG_INPUT_MOUSE is not set
602# CONFIG_INPUT_JOYSTICK is not set
603# CONFIG_INPUT_TABLET is not set
604# CONFIG_INPUT_TOUCHSCREEN is not set
605# CONFIG_INPUT_MISC is not set
606
607#
608# Hardware I/O ports
609#
610# CONFIG_SERIO is not set
611# CONFIG_GAMEPORT is not set
612
613#
614# Character devices
615#
616# CONFIG_VT is not set
617CONFIG_DEVKMEM=y
618# CONFIG_SERIAL_NONSTANDARD is not set
619
620#
621# Serial drivers
622#
623# CONFIG_SERIAL_8250 is not set
624
625#
626# Non-8250 serial port support
627#
628CONFIG_SERIAL_SH_SCI=y
629CONFIG_SERIAL_SH_SCI_NR_UARTS=3
630CONFIG_SERIAL_SH_SCI_CONSOLE=y
631CONFIG_SERIAL_CORE=y
632CONFIG_SERIAL_CORE_CONSOLE=y
633CONFIG_UNIX98_PTYS=y
634CONFIG_LEGACY_PTYS=y
635CONFIG_LEGACY_PTY_COUNT=256
636# CONFIG_IPMI_HANDLER is not set
637CONFIG_HW_RANDOM=y
638# CONFIG_R3964 is not set
639# CONFIG_RAW_DRIVER is not set
640# CONFIG_TCG_TPM is not set
641# CONFIG_I2C is not set
642# CONFIG_SPI is not set
643# CONFIG_W1 is not set
644# CONFIG_POWER_SUPPLY is not set
645# CONFIG_HWMON is not set
646# CONFIG_THERMAL is not set
647# CONFIG_WATCHDOG is not set
648
649#
650# Sonics Silicon Backplane
651#
652CONFIG_SSB_POSSIBLE=y
653# CONFIG_SSB is not set
654
655#
656# Multifunction device drivers
657#
658# CONFIG_MFD_SM501 is not set
659# CONFIG_HTC_PASIC3 is not set
660
661#
662# Multimedia devices
663#
664
665#
666# Multimedia core support
667#
668# CONFIG_VIDEO_DEV is not set
669# CONFIG_DVB_CORE is not set
670# CONFIG_VIDEO_MEDIA is not set
671
672#
673# Multimedia drivers
674#
675# CONFIG_DAB is not set
676
677#
678# Graphics support
679#
680# CONFIG_VGASTATE is not set
681# CONFIG_VIDEO_OUTPUT_CONTROL is not set
682# CONFIG_FB is not set
683# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
684
685#
686# Display device support
687#
688# CONFIG_DISPLAY_SUPPORT is not set
689
690#
691# Sound
692#
693# CONFIG_SOUND is not set
694# CONFIG_HID_SUPPORT is not set
695CONFIG_USB_SUPPORT=y
696CONFIG_USB_ARCH_HAS_HCD=y
697CONFIG_USB_ARCH_HAS_OHCI=y
698# CONFIG_USB_ARCH_HAS_EHCI is not set
699CONFIG_USB=y
700# CONFIG_USB_DEBUG is not set
701# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
702
703#
704# Miscellaneous USB options
705#
706# CONFIG_USB_DEVICEFS is not set
707CONFIG_USB_DEVICE_CLASS=y
708# CONFIG_USB_DYNAMIC_MINORS is not set
709# CONFIG_USB_OTG is not set
710# CONFIG_USB_OTG_WHITELIST is not set
711# CONFIG_USB_OTG_BLACKLIST_HUB is not set
712
713#
714# USB Host Controller Drivers
715#
716# CONFIG_USB_C67X00_HCD is not set
717# CONFIG_USB_ISP116X_HCD is not set
718# CONFIG_USB_ISP1760_HCD is not set
719CONFIG_USB_OHCI_HCD=y
720# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
721# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
722CONFIG_USB_OHCI_LITTLE_ENDIAN=y
723# CONFIG_USB_SL811_HCD is not set
724# CONFIG_USB_R8A66597_HCD is not set
725
726#
727# USB Device Class drivers
728#
729# CONFIG_USB_ACM is not set
730# CONFIG_USB_PRINTER is not set
731# CONFIG_USB_WDM is not set
732
733#
734# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
735#
736
737#
738# may also be needed; see USB_STORAGE Help for more information
739#
740CONFIG_USB_STORAGE=y
741# CONFIG_USB_STORAGE_DEBUG is not set
742# CONFIG_USB_STORAGE_DATAFAB is not set
743# CONFIG_USB_STORAGE_FREECOM is not set
744# CONFIG_USB_STORAGE_ISD200 is not set
745# CONFIG_USB_STORAGE_DPCM is not set
746# CONFIG_USB_STORAGE_USBAT is not set
747# CONFIG_USB_STORAGE_SDDR09 is not set
748# CONFIG_USB_STORAGE_SDDR55 is not set
749# CONFIG_USB_STORAGE_JUMPSHOT is not set
750# CONFIG_USB_STORAGE_ALAUDA is not set
751# CONFIG_USB_STORAGE_ONETOUCH is not set
752# CONFIG_USB_STORAGE_KARMA is not set
753# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
754# CONFIG_USB_LIBUSUAL is not set
755
756#
757# USB Imaging devices
758#
759# CONFIG_USB_MDC800 is not set
760# CONFIG_USB_MICROTEK is not set
761CONFIG_USB_MON=y
762
763#
764# USB port drivers
765#
766# CONFIG_USB_SERIAL is not set
767
768#
769# USB Miscellaneous drivers
770#
771# CONFIG_USB_EMI62 is not set
772# CONFIG_USB_EMI26 is not set
773# CONFIG_USB_ADUTUX is not set
774# CONFIG_USB_AUERSWALD is not set
775# CONFIG_USB_RIO500 is not set
776# CONFIG_USB_LEGOTOWER is not set
777# CONFIG_USB_LCD is not set
778# CONFIG_USB_BERRY_CHARGE is not set
779# CONFIG_USB_LED is not set
780# CONFIG_USB_CYPRESS_CY7C63 is not set
781# CONFIG_USB_CYTHERM is not set
782# CONFIG_USB_PHIDGET is not set
783# CONFIG_USB_IDMOUSE is not set
784# CONFIG_USB_FTDI_ELAN is not set
785# CONFIG_USB_APPLEDISPLAY is not set
786# CONFIG_USB_LD is not set
787# CONFIG_USB_TRANCEVIBRATOR is not set
788# CONFIG_USB_IOWARRIOR is not set
789# CONFIG_USB_ISIGHTFW is not set
790# CONFIG_USB_GADGET is not set
791# CONFIG_MMC is not set
792# CONFIG_MEMSTICK is not set
793# CONFIG_NEW_LEDS is not set
794# CONFIG_ACCESSIBILITY is not set
795# CONFIG_RTC_CLASS is not set
796# CONFIG_UIO is not set
797
798#
799# File systems
800#
801CONFIG_EXT2_FS=y
802# CONFIG_EXT2_FS_XATTR is not set
803# CONFIG_EXT2_FS_XIP is not set
804CONFIG_EXT3_FS=y
805CONFIG_EXT3_FS_XATTR=y
806# CONFIG_EXT3_FS_POSIX_ACL is not set
807# CONFIG_EXT3_FS_SECURITY is not set
808# CONFIG_EXT4DEV_FS is not set
809CONFIG_JBD=y
810CONFIG_FS_MBCACHE=y
811# CONFIG_REISERFS_FS is not set
812# CONFIG_JFS_FS is not set
813CONFIG_FS_POSIX_ACL=y
814# CONFIG_XFS_FS is not set
815# CONFIG_OCFS2_FS is not set
816CONFIG_DNOTIFY=y
817CONFIG_INOTIFY=y
818CONFIG_INOTIFY_USER=y
819# CONFIG_QUOTA is not set
820CONFIG_AUTOFS_FS=y
821CONFIG_AUTOFS4_FS=y
822# CONFIG_FUSE_FS is not set
823CONFIG_GENERIC_ACL=y
824
825#
826# CD-ROM/DVD Filesystems
827#
828# CONFIG_ISO9660_FS is not set
829# CONFIG_UDF_FS is not set
830
831#
832# DOS/FAT/NT Filesystems
833#
834CONFIG_FAT_FS=y
835CONFIG_MSDOS_FS=y
836CONFIG_VFAT_FS=y
837CONFIG_FAT_DEFAULT_CODEPAGE=437
838CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
839# CONFIG_NTFS_FS is not set
840
841#
842# Pseudo filesystems
843#
844CONFIG_PROC_FS=y
845CONFIG_PROC_KCORE=y
846CONFIG_PROC_SYSCTL=y
847CONFIG_SYSFS=y
848CONFIG_TMPFS=y
849CONFIG_TMPFS_POSIX_ACL=y
850# CONFIG_HUGETLBFS is not set
851# CONFIG_HUGETLB_PAGE is not set
852# CONFIG_CONFIGFS_FS is not set
853
854#
855# Miscellaneous filesystems
856#
857# CONFIG_ADFS_FS is not set
858# CONFIG_AFFS_FS is not set
859# CONFIG_HFS_FS is not set
860# CONFIG_HFSPLUS_FS is not set
861# CONFIG_BEFS_FS is not set
862# CONFIG_BFS_FS is not set
863# CONFIG_EFS_FS is not set
864# CONFIG_JFFS2_FS is not set
865# CONFIG_CRAMFS is not set
866# CONFIG_VXFS_FS is not set
867# CONFIG_MINIX_FS is not set
868# CONFIG_HPFS_FS is not set
869# CONFIG_QNX4FS_FS is not set
870# CONFIG_ROMFS_FS is not set
871# CONFIG_SYSV_FS is not set
872# CONFIG_UFS_FS is not set
873CONFIG_NETWORK_FILESYSTEMS=y
874CONFIG_NFS_FS=y
875# CONFIG_NFS_V3 is not set
876# CONFIG_NFS_V4 is not set
877# CONFIG_NFSD is not set
878CONFIG_ROOT_NFS=y
879CONFIG_LOCKD=y
880CONFIG_NFS_COMMON=y
881CONFIG_SUNRPC=y
882# CONFIG_SUNRPC_BIND34 is not set
883# CONFIG_RPCSEC_GSS_KRB5 is not set
884# CONFIG_RPCSEC_GSS_SPKM3 is not set
885# CONFIG_SMB_FS is not set
886# CONFIG_CIFS is not set
887# CONFIG_NCP_FS is not set
888# CONFIG_CODA_FS is not set
889# CONFIG_AFS_FS is not set
890
891#
892# Partition Types
893#
894# CONFIG_PARTITION_ADVANCED is not set
895CONFIG_MSDOS_PARTITION=y
896CONFIG_NLS=y
897CONFIG_NLS_DEFAULT="iso8859-1"
898CONFIG_NLS_CODEPAGE_437=y
899CONFIG_NLS_CODEPAGE_737=y
900CONFIG_NLS_CODEPAGE_775=y
901CONFIG_NLS_CODEPAGE_850=y
902CONFIG_NLS_CODEPAGE_852=y
903CONFIG_NLS_CODEPAGE_855=y
904CONFIG_NLS_CODEPAGE_857=y
905CONFIG_NLS_CODEPAGE_860=y
906CONFIG_NLS_CODEPAGE_861=y
907CONFIG_NLS_CODEPAGE_862=y
908CONFIG_NLS_CODEPAGE_863=y
909CONFIG_NLS_CODEPAGE_864=y
910CONFIG_NLS_CODEPAGE_865=y
911CONFIG_NLS_CODEPAGE_866=y
912CONFIG_NLS_CODEPAGE_869=y
913CONFIG_NLS_CODEPAGE_936=y
914CONFIG_NLS_CODEPAGE_950=y
915CONFIG_NLS_CODEPAGE_932=y
916CONFIG_NLS_CODEPAGE_949=y
917CONFIG_NLS_CODEPAGE_874=y
918CONFIG_NLS_ISO8859_8=y
919CONFIG_NLS_CODEPAGE_1250=y
920CONFIG_NLS_CODEPAGE_1251=y
921CONFIG_NLS_ASCII=y
922CONFIG_NLS_ISO8859_1=y
923CONFIG_NLS_ISO8859_2=y
924CONFIG_NLS_ISO8859_3=y
925CONFIG_NLS_ISO8859_4=y
926CONFIG_NLS_ISO8859_5=y
927CONFIG_NLS_ISO8859_6=y
928CONFIG_NLS_ISO8859_7=y
929CONFIG_NLS_ISO8859_9=y
930CONFIG_NLS_ISO8859_13=y
931CONFIG_NLS_ISO8859_14=y
932CONFIG_NLS_ISO8859_15=y
933CONFIG_NLS_KOI8_R=y
934CONFIG_NLS_KOI8_U=y
935CONFIG_NLS_UTF8=y
936# CONFIG_DLM is not set
937
938#
939# Kernel hacking
940#
941CONFIG_TRACE_IRQFLAGS_SUPPORT=y
942# CONFIG_PRINTK_TIME is not set
943# CONFIG_ENABLE_WARN_DEPRECATED is not set
944# CONFIG_ENABLE_MUST_CHECK is not set
945CONFIG_FRAME_WARN=1024
946# CONFIG_MAGIC_SYSRQ is not set
947# CONFIG_UNUSED_SYMBOLS is not set
948# CONFIG_DEBUG_FS is not set
949# CONFIG_HEADERS_CHECK is not set
950# CONFIG_DEBUG_KERNEL is not set
951# CONFIG_DEBUG_BUGVERBOSE is not set
952# CONFIG_SAMPLES is not set
953# CONFIG_SH_STANDARD_BIOS is not set
954# CONFIG_EARLY_SCIF_CONSOLE is not set
955# CONFIG_SH_KGDB is not set
956
957#
958# Security options
959#
960# CONFIG_KEYS is not set
961# CONFIG_SECURITY is not set
962# CONFIG_SECURITY_FILE_CAPABILITIES is not set
963CONFIG_CRYPTO=y
964
965#
966# Crypto core or helper
967#
968# CONFIG_CRYPTO_MANAGER is not set
969# CONFIG_CRYPTO_GF128MUL is not set
970# CONFIG_CRYPTO_NULL is not set
971# CONFIG_CRYPTO_CRYPTD is not set
972# CONFIG_CRYPTO_AUTHENC is not set
973# CONFIG_CRYPTO_TEST is not set
974
975#
976# Authenticated Encryption with Associated Data
977#
978# CONFIG_CRYPTO_CCM is not set
979# CONFIG_CRYPTO_GCM is not set
980# CONFIG_CRYPTO_SEQIV is not set
981
982#
983# Block modes
984#
985# CONFIG_CRYPTO_CBC is not set
986# CONFIG_CRYPTO_CTR is not set
987# CONFIG_CRYPTO_CTS is not set
988# CONFIG_CRYPTO_ECB is not set
989# CONFIG_CRYPTO_LRW is not set
990# CONFIG_CRYPTO_PCBC is not set
991# CONFIG_CRYPTO_XTS is not set
992
993#
994# Hash modes
995#
996# CONFIG_CRYPTO_HMAC is not set
997# CONFIG_CRYPTO_XCBC is not set
998
999#
1000# Digest
1001#
1002# CONFIG_CRYPTO_CRC32C is not set
1003# CONFIG_CRYPTO_MD4 is not set
1004# CONFIG_CRYPTO_MD5 is not set
1005# CONFIG_CRYPTO_MICHAEL_MIC is not set
1006# CONFIG_CRYPTO_SHA1 is not set
1007# CONFIG_CRYPTO_SHA256 is not set
1008# CONFIG_CRYPTO_SHA512 is not set
1009# CONFIG_CRYPTO_TGR192 is not set
1010# CONFIG_CRYPTO_WP512 is not set
1011
1012#
1013# Ciphers
1014#
1015# CONFIG_CRYPTO_AES is not set
1016# CONFIG_CRYPTO_ANUBIS is not set
1017# CONFIG_CRYPTO_ARC4 is not set
1018# CONFIG_CRYPTO_BLOWFISH is not set
1019# CONFIG_CRYPTO_CAMELLIA is not set
1020# CONFIG_CRYPTO_CAST5 is not set
1021# CONFIG_CRYPTO_CAST6 is not set
1022# CONFIG_CRYPTO_DES is not set
1023# CONFIG_CRYPTO_FCRYPT is not set
1024# CONFIG_CRYPTO_KHAZAD is not set
1025# CONFIG_CRYPTO_SALSA20 is not set
1026# CONFIG_CRYPTO_SEED is not set
1027# CONFIG_CRYPTO_SERPENT is not set
1028# CONFIG_CRYPTO_TEA is not set
1029# CONFIG_CRYPTO_TWOFISH is not set
1030
1031#
1032# Compression
1033#
1034# CONFIG_CRYPTO_DEFLATE is not set
1035# CONFIG_CRYPTO_LZO is not set
1036CONFIG_CRYPTO_HW=y
1037
1038#
1039# Library routines
1040#
1041CONFIG_BITREVERSE=y
1042# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1043# CONFIG_CRC_CCITT is not set
1044# CONFIG_CRC16 is not set
1045# CONFIG_CRC_ITU_T is not set
1046CONFIG_CRC32=y
1047# CONFIG_CRC7 is not set
1048# CONFIG_LIBCRC32C is not set
1049CONFIG_PLIST=y
1050CONFIG_HAS_IOMEM=y
1051CONFIG_HAS_IOPORT=y
1052CONFIG_HAS_DMA=y
diff --git a/arch/sh/configs/sh7785lcr_defconfig b/arch/sh/configs/sh7785lcr_defconfig
new file mode 100644
index 000000000000..ff72697365d1
--- /dev/null
+++ b/arch/sh/configs/sh7785lcr_defconfig
@@ -0,0 +1,1388 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc8
4# Tue Jul 15 21:37:59 2008
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_BUG=y
10CONFIG_GENERIC_FIND_NEXT_BIT=y
11CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_HARDIRQS=y
13CONFIG_GENERIC_IRQ_PROBE=y
14CONFIG_GENERIC_CALIBRATE_DELAY=y
15CONFIG_GENERIC_TIME=y
16CONFIG_GENERIC_CLOCKEVENTS=y
17CONFIG_SYS_SUPPORTS_NUMA=y
18CONFIG_SYS_SUPPORTS_PCI=y
19CONFIG_STACKTRACE_SUPPORT=y
20CONFIG_LOCKDEP_SUPPORT=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_ARCH_NO_VIRT_TO_BUS=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
25CONFIG_IO_TRAPPED=y
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_LOCK_KERNEL=y
34CONFIG_INIT_ENV_ARG_LIMIT=32
35CONFIG_LOCALVERSION=""
36CONFIG_LOCALVERSION_AUTO=y
37CONFIG_SWAP=y
38CONFIG_SYSVIPC=y
39CONFIG_SYSVIPC_SYSCTL=y
40# CONFIG_POSIX_MQUEUE is not set
41CONFIG_BSD_PROCESS_ACCT=y
42# CONFIG_BSD_PROCESS_ACCT_V3 is not set
43# CONFIG_TASKSTATS is not set
44# CONFIG_AUDIT is not set
45CONFIG_IKCONFIG=y
46CONFIG_IKCONFIG_PROC=y
47CONFIG_LOG_BUF_SHIFT=14
48# CONFIG_CGROUPS is not set
49CONFIG_GROUP_SCHED=y
50CONFIG_FAIR_GROUP_SCHED=y
51# CONFIG_RT_GROUP_SCHED is not set
52CONFIG_USER_SCHED=y
53# CONFIG_CGROUP_SCHED is not set
54CONFIG_SYSFS_DEPRECATED=y
55CONFIG_SYSFS_DEPRECATED_V2=y
56# CONFIG_RELAY is not set
57# CONFIG_NAMESPACES is not set
58# CONFIG_BLK_DEV_INITRD is not set
59CONFIG_CC_OPTIMIZE_FOR_SIZE=y
60CONFIG_SYSCTL=y
61CONFIG_EMBEDDED=y
62CONFIG_UID16=y
63CONFIG_SYSCTL_SYSCALL=y
64CONFIG_SYSCTL_SYSCALL_CHECK=y
65CONFIG_KALLSYMS=y
66# CONFIG_KALLSYMS_ALL is not set
67# CONFIG_KALLSYMS_EXTRA_PASS is not set
68CONFIG_HOTPLUG=y
69CONFIG_PRINTK=y
70CONFIG_BUG=y
71CONFIG_ELF_CORE=y
72CONFIG_COMPAT_BRK=y
73CONFIG_BASE_FULL=y
74CONFIG_FUTEX=y
75CONFIG_ANON_INODES=y
76CONFIG_EPOLL=y
77CONFIG_SIGNALFD=y
78CONFIG_TIMERFD=y
79CONFIG_EVENTFD=y
80CONFIG_SHMEM=y
81CONFIG_VM_EVENT_COUNTERS=y
82CONFIG_SLAB=y
83# CONFIG_SLUB is not set
84# CONFIG_SLOB is not set
85CONFIG_PROFILING=y
86# CONFIG_MARKERS is not set
87# CONFIG_OPROFILE is not set
88CONFIG_HAVE_OPROFILE=y
89# CONFIG_HAVE_KPROBES is not set
90# CONFIG_HAVE_KRETPROBES is not set
91# CONFIG_HAVE_DMA_ATTRS is not set
92CONFIG_PROC_PAGE_MONITOR=y
93CONFIG_SLABINFO=y
94CONFIG_RT_MUTEXES=y
95# CONFIG_TINY_SHMEM is not set
96CONFIG_BASE_SMALL=0
97CONFIG_MODULES=y
98# CONFIG_MODULE_FORCE_LOAD is not set
99CONFIG_MODULE_UNLOAD=y
100# CONFIG_MODULE_FORCE_UNLOAD is not set
101# CONFIG_MODVERSIONS is not set
102# CONFIG_MODULE_SRCVERSION_ALL is not set
103CONFIG_KMOD=y
104CONFIG_BLOCK=y
105# CONFIG_LBD is not set
106# CONFIG_BLK_DEV_IO_TRACE is not set
107# CONFIG_LSF is not set
108# CONFIG_BLK_DEV_BSG is not set
109
110#
111# IO Schedulers
112#
113CONFIG_IOSCHED_NOOP=y
114CONFIG_IOSCHED_AS=y
115CONFIG_IOSCHED_DEADLINE=y
116CONFIG_IOSCHED_CFQ=y
117# CONFIG_DEFAULT_AS is not set
118# CONFIG_DEFAULT_DEADLINE is not set
119CONFIG_DEFAULT_CFQ=y
120# CONFIG_DEFAULT_NOOP is not set
121CONFIG_DEFAULT_IOSCHED="cfq"
122CONFIG_CLASSIC_RCU=y
123
124#
125# System type
126#
127CONFIG_CPU_SH4=y
128CONFIG_CPU_SH4A=y
129CONFIG_CPU_SHX2=y
130# CONFIG_CPU_SUBTYPE_SH7619 is not set
131# CONFIG_CPU_SUBTYPE_SH7203 is not set
132# CONFIG_CPU_SUBTYPE_SH7206 is not set
133# CONFIG_CPU_SUBTYPE_SH7263 is not set
134# CONFIG_CPU_SUBTYPE_MXG is not set
135# CONFIG_CPU_SUBTYPE_SH7705 is not set
136# CONFIG_CPU_SUBTYPE_SH7706 is not set
137# CONFIG_CPU_SUBTYPE_SH7707 is not set
138# CONFIG_CPU_SUBTYPE_SH7708 is not set
139# CONFIG_CPU_SUBTYPE_SH7709 is not set
140# CONFIG_CPU_SUBTYPE_SH7710 is not set
141# CONFIG_CPU_SUBTYPE_SH7712 is not set
142# CONFIG_CPU_SUBTYPE_SH7720 is not set
143# CONFIG_CPU_SUBTYPE_SH7721 is not set
144# CONFIG_CPU_SUBTYPE_SH7750 is not set
145# CONFIG_CPU_SUBTYPE_SH7091 is not set
146# CONFIG_CPU_SUBTYPE_SH7750R is not set
147# CONFIG_CPU_SUBTYPE_SH7750S is not set
148# CONFIG_CPU_SUBTYPE_SH7751 is not set
149# CONFIG_CPU_SUBTYPE_SH7751R is not set
150# CONFIG_CPU_SUBTYPE_SH7760 is not set
151# CONFIG_CPU_SUBTYPE_SH4_202 is not set
152# CONFIG_CPU_SUBTYPE_SH7723 is not set
153# CONFIG_CPU_SUBTYPE_SH7763 is not set
154# CONFIG_CPU_SUBTYPE_SH7770 is not set
155# CONFIG_CPU_SUBTYPE_SH7780 is not set
156CONFIG_CPU_SUBTYPE_SH7785=y
157# CONFIG_CPU_SUBTYPE_SHX3 is not set
158# CONFIG_CPU_SUBTYPE_SH7343 is not set
159# CONFIG_CPU_SUBTYPE_SH7722 is not set
160# CONFIG_CPU_SUBTYPE_SH7366 is not set
161# CONFIG_CPU_SUBTYPE_SH5_101 is not set
162# CONFIG_CPU_SUBTYPE_SH5_103 is not set
163
164#
165# Memory management options
166#
167CONFIG_QUICKLIST=y
168CONFIG_MMU=y
169CONFIG_PAGE_OFFSET=0x80000000
170CONFIG_MEMORY_START=0x08000000
171CONFIG_MEMORY_SIZE=0x08000000
172CONFIG_29BIT=y
173# CONFIG_PMB is not set
174# CONFIG_X2TLB is not set
175CONFIG_VSYSCALL=y
176# CONFIG_NUMA is not set
177CONFIG_ARCH_FLATMEM_ENABLE=y
178CONFIG_ARCH_SPARSEMEM_ENABLE=y
179CONFIG_ARCH_SPARSEMEM_DEFAULT=y
180CONFIG_MAX_ACTIVE_REGIONS=2
181CONFIG_ARCH_POPULATES_NODE_MAP=y
182CONFIG_ARCH_SELECT_MEMORY_MODEL=y
183CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
184CONFIG_PAGE_SIZE_4KB=y
185# CONFIG_PAGE_SIZE_8KB is not set
186# CONFIG_PAGE_SIZE_16KB is not set
187# CONFIG_PAGE_SIZE_64KB is not set
188CONFIG_SELECT_MEMORY_MODEL=y
189# CONFIG_FLATMEM_MANUAL is not set
190# CONFIG_DISCONTIGMEM_MANUAL is not set
191CONFIG_SPARSEMEM_MANUAL=y
192CONFIG_SPARSEMEM=y
193CONFIG_HAVE_MEMORY_PRESENT=y
194CONFIG_SPARSEMEM_STATIC=y
195# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
196# CONFIG_MEMORY_HOTPLUG is not set
197CONFIG_PAGEFLAGS_EXTENDED=y
198CONFIG_SPLIT_PTLOCK_CPUS=4
199# CONFIG_RESOURCES_64BIT is not set
200CONFIG_ZONE_DMA_FLAG=0
201CONFIG_NR_QUICK=2
202
203#
204# Cache configuration
205#
206# CONFIG_SH_DIRECT_MAPPED is not set
207CONFIG_CACHE_WRITEBACK=y
208# CONFIG_CACHE_WRITETHROUGH is not set
209# CONFIG_CACHE_OFF is not set
210
211#
212# Processor features
213#
214CONFIG_CPU_LITTLE_ENDIAN=y
215# CONFIG_CPU_BIG_ENDIAN is not set
216CONFIG_SH_FPU=y
217CONFIG_SH_STORE_QUEUES=y
218CONFIG_CPU_HAS_INTEVT=y
219CONFIG_CPU_HAS_SR_RB=y
220CONFIG_CPU_HAS_PTEA=y
221CONFIG_CPU_HAS_FPU=y
222
223#
224# Board support
225#
226# CONFIG_SH_HIGHLANDER is not set
227CONFIG_SH_SH7785LCR=y
228CONFIG_SH_SH7785LCR_29BIT_PHYSMAPS=y
229
230#
231# Timer and clock configuration
232#
233CONFIG_SH_TMU=y
234CONFIG_SH_TIMER_IRQ=28
235CONFIG_SH_PCLK_FREQ=50000000
236CONFIG_TICK_ONESHOT=y
237# CONFIG_NO_HZ is not set
238CONFIG_HIGH_RES_TIMERS=y
239CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
240
241#
242# CPU Frequency scaling
243#
244# CONFIG_CPU_FREQ is not set
245
246#
247# DMA support
248#
249# CONFIG_SH_DMA is not set
250
251#
252# Companion Chips
253#
254
255#
256# Additional SuperH Device Drivers
257#
258CONFIG_HEARTBEAT=y
259# CONFIG_PUSH_SWITCH is not set
260
261#
262# Kernel features
263#
264# CONFIG_HZ_100 is not set
265CONFIG_HZ_250=y
266# CONFIG_HZ_300 is not set
267# CONFIG_HZ_1000 is not set
268CONFIG_HZ=250
269# CONFIG_SCHED_HRTICK is not set
270CONFIG_KEXEC=y
271# CONFIG_CRASH_DUMP is not set
272# CONFIG_PREEMPT_NONE is not set
273# CONFIG_PREEMPT_VOLUNTARY is not set
274CONFIG_PREEMPT=y
275# CONFIG_PREEMPT_RCU is not set
276CONFIG_GUSA=y
277
278#
279# Boot options
280#
281CONFIG_ZERO_PAGE_OFFSET=0x00001000
282CONFIG_BOOT_LINK_OFFSET=0x00800000
283# CONFIG_CMDLINE_BOOL is not set
284
285#
286# Bus options
287#
288CONFIG_PCI=y
289CONFIG_SH_PCIDMA_NONCOHERENT=y
290CONFIG_PCI_AUTO=y
291CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
292# CONFIG_ARCH_SUPPORTS_MSI is not set
293CONFIG_PCI_LEGACY=y
294# CONFIG_PCI_DEBUG is not set
295# CONFIG_PCCARD is not set
296# CONFIG_HOTPLUG_PCI is not set
297
298#
299# Executable file formats
300#
301CONFIG_BINFMT_ELF=y
302# CONFIG_BINFMT_MISC is not set
303
304#
305# Networking
306#
307CONFIG_NET=y
308
309#
310# Networking options
311#
312CONFIG_PACKET=y
313# CONFIG_PACKET_MMAP is not set
314CONFIG_UNIX=y
315CONFIG_XFRM=y
316# CONFIG_XFRM_USER is not set
317# CONFIG_XFRM_SUB_POLICY is not set
318# CONFIG_XFRM_MIGRATE is not set
319# CONFIG_XFRM_STATISTICS is not set
320# CONFIG_NET_KEY is not set
321CONFIG_INET=y
322# CONFIG_IP_MULTICAST is not set
323CONFIG_IP_ADVANCED_ROUTER=y
324CONFIG_ASK_IP_FIB_HASH=y
325# CONFIG_IP_FIB_TRIE is not set
326CONFIG_IP_FIB_HASH=y
327# CONFIG_IP_MULTIPLE_TABLES is not set
328# CONFIG_IP_ROUTE_MULTIPATH is not set
329# CONFIG_IP_ROUTE_VERBOSE is not set
330CONFIG_IP_PNP=y
331CONFIG_IP_PNP_DHCP=y
332# CONFIG_IP_PNP_BOOTP is not set
333# CONFIG_IP_PNP_RARP is not set
334# CONFIG_NET_IPIP is not set
335# CONFIG_NET_IPGRE is not set
336# CONFIG_ARPD is not set
337# CONFIG_SYN_COOKIES is not set
338# CONFIG_INET_AH is not set
339# CONFIG_INET_ESP is not set
340# CONFIG_INET_IPCOMP is not set
341# CONFIG_INET_XFRM_TUNNEL is not set
342# CONFIG_INET_TUNNEL is not set
343CONFIG_INET_XFRM_MODE_TRANSPORT=y
344CONFIG_INET_XFRM_MODE_TUNNEL=y
345CONFIG_INET_XFRM_MODE_BEET=y
346# CONFIG_INET_LRO is not set
347CONFIG_INET_DIAG=y
348CONFIG_INET_TCP_DIAG=y
349# CONFIG_TCP_CONG_ADVANCED is not set
350CONFIG_TCP_CONG_CUBIC=y
351CONFIG_DEFAULT_TCP_CONG="cubic"
352# CONFIG_TCP_MD5SIG is not set
353# CONFIG_IPV6 is not set
354# CONFIG_NETWORK_SECMARK is not set
355# CONFIG_NETFILTER is not set
356# CONFIG_IP_DCCP is not set
357# CONFIG_IP_SCTP is not set
358# CONFIG_TIPC is not set
359# CONFIG_ATM is not set
360# CONFIG_BRIDGE is not set
361# CONFIG_VLAN_8021Q is not set
362# CONFIG_DECNET is not set
363# CONFIG_LLC2 is not set
364# CONFIG_IPX is not set
365# CONFIG_ATALK is not set
366# CONFIG_X25 is not set
367# CONFIG_LAPB is not set
368# CONFIG_ECONET is not set
369# CONFIG_WAN_ROUTER is not set
370# CONFIG_NET_SCHED is not set
371
372#
373# Network testing
374#
375# CONFIG_NET_PKTGEN is not set
376# CONFIG_HAMRADIO is not set
377# CONFIG_CAN is not set
378# CONFIG_IRDA is not set
379# CONFIG_BT is not set
380# CONFIG_AF_RXRPC is not set
381
382#
383# Wireless
384#
385# CONFIG_CFG80211 is not set
386CONFIG_WIRELESS_EXT=y
387# CONFIG_MAC80211 is not set
388# CONFIG_IEEE80211 is not set
389# CONFIG_RFKILL is not set
390# CONFIG_NET_9P is not set
391
392#
393# Device Drivers
394#
395
396#
397# Generic Driver Options
398#
399CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
400CONFIG_STANDALONE=y
401CONFIG_PREVENT_FIRMWARE_BUILD=y
402# CONFIG_FW_LOADER is not set
403# CONFIG_DEBUG_DRIVER is not set
404# CONFIG_DEBUG_DEVRES is not set
405# CONFIG_SYS_HYPERVISOR is not set
406# CONFIG_CONNECTOR is not set
407CONFIG_MTD=y
408# CONFIG_MTD_DEBUG is not set
409CONFIG_MTD_CONCAT=y
410CONFIG_MTD_PARTITIONS=y
411# CONFIG_MTD_REDBOOT_PARTS is not set
412# CONFIG_MTD_CMDLINE_PARTS is not set
413# CONFIG_MTD_AR7_PARTS is not set
414
415#
416# User Modules And Translation Layers
417#
418CONFIG_MTD_CHAR=y
419CONFIG_MTD_BLKDEVS=y
420CONFIG_MTD_BLOCK=y
421# CONFIG_FTL is not set
422# CONFIG_NFTL is not set
423# CONFIG_INFTL is not set
424# CONFIG_RFD_FTL is not set
425# CONFIG_SSFDC is not set
426# CONFIG_MTD_OOPS is not set
427
428#
429# RAM/ROM/Flash chip drivers
430#
431CONFIG_MTD_CFI=y
432# CONFIG_MTD_JEDECPROBE is not set
433CONFIG_MTD_GEN_PROBE=y
434# CONFIG_MTD_CFI_ADV_OPTIONS is not set
435CONFIG_MTD_MAP_BANK_WIDTH_1=y
436CONFIG_MTD_MAP_BANK_WIDTH_2=y
437CONFIG_MTD_MAP_BANK_WIDTH_4=y
438# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
439# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
440# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
441CONFIG_MTD_CFI_I1=y
442CONFIG_MTD_CFI_I2=y
443# CONFIG_MTD_CFI_I4 is not set
444# CONFIG_MTD_CFI_I8 is not set
445# CONFIG_MTD_CFI_INTELEXT is not set
446CONFIG_MTD_CFI_AMDSTD=y
447# CONFIG_MTD_CFI_STAA is not set
448CONFIG_MTD_CFI_UTIL=y
449# CONFIG_MTD_RAM is not set
450# CONFIG_MTD_ROM is not set
451# CONFIG_MTD_ABSENT is not set
452
453#
454# Mapping drivers for chip access
455#
456# CONFIG_MTD_COMPLEX_MAPPINGS is not set
457CONFIG_MTD_PHYSMAP=y
458CONFIG_MTD_PHYSMAP_START=0x00000000
459CONFIG_MTD_PHYSMAP_LEN=0x0
460CONFIG_MTD_PHYSMAP_BANKWIDTH=0
461# CONFIG_MTD_INTEL_VR_NOR is not set
462# CONFIG_MTD_PLATRAM is not set
463
464#
465# Self-contained MTD device drivers
466#
467# CONFIG_MTD_PMC551 is not set
468# CONFIG_MTD_SLRAM is not set
469# CONFIG_MTD_PHRAM is not set
470# CONFIG_MTD_MTDRAM is not set
471# CONFIG_MTD_BLOCK2MTD is not set
472
473#
474# Disk-On-Chip Device Drivers
475#
476# CONFIG_MTD_DOC2000 is not set
477# CONFIG_MTD_DOC2001 is not set
478# CONFIG_MTD_DOC2001PLUS is not set
479# CONFIG_MTD_NAND is not set
480# CONFIG_MTD_ONENAND is not set
481
482#
483# UBI - Unsorted block images
484#
485# CONFIG_MTD_UBI is not set
486# CONFIG_PARPORT is not set
487CONFIG_BLK_DEV=y
488# CONFIG_BLK_CPQ_CISS_DA is not set
489# CONFIG_BLK_DEV_DAC960 is not set
490# CONFIG_BLK_DEV_UMEM is not set
491# CONFIG_BLK_DEV_COW_COMMON is not set
492# CONFIG_BLK_DEV_LOOP is not set
493# CONFIG_BLK_DEV_NBD is not set
494# CONFIG_BLK_DEV_SX8 is not set
495# CONFIG_BLK_DEV_UB is not set
496CONFIG_BLK_DEV_RAM=y
497CONFIG_BLK_DEV_RAM_COUNT=16
498CONFIG_BLK_DEV_RAM_SIZE=4096
499# CONFIG_BLK_DEV_XIP is not set
500# CONFIG_CDROM_PKTCDVD is not set
501# CONFIG_ATA_OVER_ETH is not set
502# CONFIG_MISC_DEVICES is not set
503CONFIG_HAVE_IDE=y
504# CONFIG_IDE is not set
505
506#
507# SCSI device support
508#
509# CONFIG_RAID_ATTRS is not set
510CONFIG_SCSI=y
511CONFIG_SCSI_DMA=y
512# CONFIG_SCSI_TGT is not set
513# CONFIG_SCSI_NETLINK is not set
514CONFIG_SCSI_PROC_FS=y
515
516#
517# SCSI support type (disk, tape, CD-ROM)
518#
519CONFIG_BLK_DEV_SD=y
520# CONFIG_CHR_DEV_ST is not set
521# CONFIG_CHR_DEV_OSST is not set
522# CONFIG_BLK_DEV_SR is not set
523# CONFIG_CHR_DEV_SG is not set
524# CONFIG_CHR_DEV_SCH is not set
525
526#
527# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
528#
529# CONFIG_SCSI_MULTI_LUN is not set
530# CONFIG_SCSI_CONSTANTS is not set
531# CONFIG_SCSI_LOGGING is not set
532# CONFIG_SCSI_SCAN_ASYNC is not set
533CONFIG_SCSI_WAIT_SCAN=m
534
535#
536# SCSI Transports
537#
538# CONFIG_SCSI_SPI_ATTRS is not set
539# CONFIG_SCSI_FC_ATTRS is not set
540# CONFIG_SCSI_ISCSI_ATTRS is not set
541# CONFIG_SCSI_SAS_LIBSAS is not set
542# CONFIG_SCSI_SRP_ATTRS is not set
543# CONFIG_SCSI_LOWLEVEL is not set
544CONFIG_ATA=y
545# CONFIG_ATA_NONSTANDARD is not set
546CONFIG_SATA_PMP=y
547# CONFIG_SATA_AHCI is not set
548# CONFIG_SATA_SIL24 is not set
549CONFIG_ATA_SFF=y
550# CONFIG_SATA_SVW is not set
551# CONFIG_ATA_PIIX is not set
552# CONFIG_SATA_MV is not set
553# CONFIG_SATA_NV is not set
554# CONFIG_PDC_ADMA is not set
555# CONFIG_SATA_QSTOR is not set
556# CONFIG_SATA_PROMISE is not set
557# CONFIG_SATA_SX4 is not set
558CONFIG_SATA_SIL=y
559# CONFIG_SATA_SIS is not set
560# CONFIG_SATA_ULI is not set
561# CONFIG_SATA_VIA is not set
562# CONFIG_SATA_VITESSE is not set
563# CONFIG_SATA_INIC162X is not set
564# CONFIG_PATA_ALI is not set
565# CONFIG_PATA_AMD is not set
566# CONFIG_PATA_ARTOP is not set
567# CONFIG_PATA_ATIIXP is not set
568# CONFIG_PATA_CMD640_PCI is not set
569# CONFIG_PATA_CMD64X is not set
570# CONFIG_PATA_CS5520 is not set
571# CONFIG_PATA_CS5530 is not set
572# CONFIG_PATA_CYPRESS is not set
573# CONFIG_PATA_EFAR is not set
574# CONFIG_ATA_GENERIC is not set
575# CONFIG_PATA_HPT366 is not set
576# CONFIG_PATA_HPT37X is not set
577# CONFIG_PATA_HPT3X2N is not set
578# CONFIG_PATA_HPT3X3 is not set
579# CONFIG_PATA_IT821X is not set
580# CONFIG_PATA_IT8213 is not set
581# CONFIG_PATA_JMICRON is not set
582# CONFIG_PATA_TRIFLEX is not set
583# CONFIG_PATA_MARVELL is not set
584# CONFIG_PATA_MPIIX is not set
585# CONFIG_PATA_OLDPIIX is not set
586# CONFIG_PATA_NETCELL is not set
587# CONFIG_PATA_NINJA32 is not set
588# CONFIG_PATA_NS87410 is not set
589# CONFIG_PATA_NS87415 is not set
590# CONFIG_PATA_OPTI is not set
591# CONFIG_PATA_OPTIDMA is not set
592# CONFIG_PATA_PDC_OLD is not set
593# CONFIG_PATA_RADISYS is not set
594# CONFIG_PATA_RZ1000 is not set
595# CONFIG_PATA_SC1200 is not set
596# CONFIG_PATA_SERVERWORKS is not set
597# CONFIG_PATA_PDC2027X is not set
598# CONFIG_PATA_SIL680 is not set
599# CONFIG_PATA_SIS is not set
600# CONFIG_PATA_VIA is not set
601# CONFIG_PATA_WINBOND is not set
602# CONFIG_PATA_PLATFORM is not set
603# CONFIG_PATA_SCH is not set
604# CONFIG_MD is not set
605# CONFIG_FUSION is not set
606
607#
608# IEEE 1394 (FireWire) support
609#
610
611#
612# Enable only one of the two stacks, unless you know what you are doing
613#
614# CONFIG_FIREWIRE is not set
615# CONFIG_IEEE1394 is not set
616# CONFIG_I2O is not set
617CONFIG_NETDEVICES=y
618# CONFIG_NETDEVICES_MULTIQUEUE is not set
619# CONFIG_DUMMY is not set
620# CONFIG_BONDING is not set
621# CONFIG_MACVLAN is not set
622# CONFIG_EQUALIZER is not set
623# CONFIG_TUN is not set
624# CONFIG_VETH is not set
625# CONFIG_ARCNET is not set
626# CONFIG_NET_ETHERNET is not set
627CONFIG_NETDEV_1000=y
628# CONFIG_ACENIC is not set
629# CONFIG_DL2K is not set
630# CONFIG_E1000 is not set
631# CONFIG_E1000E is not set
632# CONFIG_E1000E_ENABLED is not set
633# CONFIG_IP1000 is not set
634# CONFIG_IGB is not set
635# CONFIG_NS83820 is not set
636# CONFIG_HAMACHI is not set
637# CONFIG_YELLOWFIN is not set
638CONFIG_R8169=y
639# CONFIG_R8169_NAPI is not set
640# CONFIG_SIS190 is not set
641# CONFIG_SKGE is not set
642# CONFIG_SKY2 is not set
643# CONFIG_VIA_VELOCITY is not set
644# CONFIG_TIGON3 is not set
645# CONFIG_BNX2 is not set
646# CONFIG_QLA3XXX is not set
647# CONFIG_ATL1 is not set
648# CONFIG_NETDEV_10000 is not set
649# CONFIG_TR is not set
650
651#
652# Wireless LAN
653#
654# CONFIG_WLAN_PRE80211 is not set
655# CONFIG_WLAN_80211 is not set
656# CONFIG_IWLWIFI_LEDS is not set
657
658#
659# USB Network Adapters
660#
661# CONFIG_USB_CATC is not set
662# CONFIG_USB_KAWETH is not set
663# CONFIG_USB_PEGASUS is not set
664# CONFIG_USB_RTL8150 is not set
665# CONFIG_USB_USBNET is not set
666# CONFIG_WAN is not set
667# CONFIG_FDDI is not set
668# CONFIG_HIPPI is not set
669# CONFIG_PPP is not set
670# CONFIG_SLIP is not set
671# CONFIG_NET_FC is not set
672# CONFIG_NETCONSOLE is not set
673# CONFIG_NETPOLL is not set
674# CONFIG_NET_POLL_CONTROLLER is not set
675# CONFIG_ISDN is not set
676# CONFIG_PHONE is not set
677
678#
679# Input device support
680#
681CONFIG_INPUT=y
682# CONFIG_INPUT_FF_MEMLESS is not set
683# CONFIG_INPUT_POLLDEV is not set
684
685#
686# Userland interfaces
687#
688CONFIG_INPUT_MOUSEDEV=y
689# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
690CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
691CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
692# CONFIG_INPUT_JOYDEV is not set
693# CONFIG_INPUT_EVDEV is not set
694# CONFIG_INPUT_EVBUG is not set
695
696#
697# Input Device Drivers
698#
699CONFIG_INPUT_KEYBOARD=y
700# CONFIG_KEYBOARD_ATKBD is not set
701# CONFIG_KEYBOARD_SUNKBD is not set
702# CONFIG_KEYBOARD_LKKBD is not set
703# CONFIG_KEYBOARD_XTKBD is not set
704# CONFIG_KEYBOARD_NEWTON is not set
705# CONFIG_KEYBOARD_STOWAWAY is not set
706# CONFIG_KEYBOARD_SH_KEYSC is not set
707# CONFIG_INPUT_MOUSE is not set
708# CONFIG_INPUT_JOYSTICK is not set
709# CONFIG_INPUT_TABLET is not set
710# CONFIG_INPUT_TOUCHSCREEN is not set
711# CONFIG_INPUT_MISC is not set
712
713#
714# Hardware I/O ports
715#
716# CONFIG_SERIO is not set
717# CONFIG_GAMEPORT is not set
718
719#
720# Character devices
721#
722CONFIG_VT=y
723CONFIG_VT_CONSOLE=y
724CONFIG_HW_CONSOLE=y
725CONFIG_VT_HW_CONSOLE_BINDING=y
726CONFIG_DEVKMEM=y
727# CONFIG_SERIAL_NONSTANDARD is not set
728# CONFIG_NOZOMI is not set
729
730#
731# Serial drivers
732#
733# CONFIG_SERIAL_8250 is not set
734
735#
736# Non-8250 serial port support
737#
738CONFIG_SERIAL_SH_SCI=y
739CONFIG_SERIAL_SH_SCI_NR_UARTS=6
740CONFIG_SERIAL_SH_SCI_CONSOLE=y
741CONFIG_SERIAL_CORE=y
742CONFIG_SERIAL_CORE_CONSOLE=y
743# CONFIG_SERIAL_JSM is not set
744CONFIG_UNIX98_PTYS=y
745CONFIG_LEGACY_PTYS=y
746CONFIG_LEGACY_PTY_COUNT=256
747# CONFIG_IPMI_HANDLER is not set
748CONFIG_HW_RANDOM=y
749# CONFIG_R3964 is not set
750# CONFIG_APPLICOM is not set
751# CONFIG_RAW_DRIVER is not set
752# CONFIG_TCG_TPM is not set
753CONFIG_DEVPORT=y
754CONFIG_I2C=y
755CONFIG_I2C_BOARDINFO=y
756# CONFIG_I2C_CHARDEV is not set
757CONFIG_I2C_ALGOPCA=y
758
759#
760# I2C Hardware Bus support
761#
762# CONFIG_I2C_ALI1535 is not set
763# CONFIG_I2C_ALI1563 is not set
764# CONFIG_I2C_ALI15X3 is not set
765# CONFIG_I2C_AMD756 is not set
766# CONFIG_I2C_AMD8111 is not set
767# CONFIG_I2C_I801 is not set
768# CONFIG_I2C_I810 is not set
769# CONFIG_I2C_PIIX4 is not set
770# CONFIG_I2C_NFORCE2 is not set
771# CONFIG_I2C_OCORES is not set
772# CONFIG_I2C_PARPORT_LIGHT is not set
773# CONFIG_I2C_PROSAVAGE is not set
774# CONFIG_I2C_SAVAGE4 is not set
775# CONFIG_I2C_SIMTEC is not set
776# CONFIG_I2C_SIS5595 is not set
777# CONFIG_I2C_SIS630 is not set
778# CONFIG_I2C_SIS96X is not set
779# CONFIG_I2C_TAOS_EVM is not set
780# CONFIG_I2C_STUB is not set
781# CONFIG_I2C_TINY_USB is not set
782# CONFIG_I2C_VIA is not set
783# CONFIG_I2C_VIAPRO is not set
784# CONFIG_I2C_VOODOO3 is not set
785CONFIG_I2C_PCA_PLATFORM=y
786# CONFIG_I2C_SH_MOBILE is not set
787
788#
789# Miscellaneous I2C Chip support
790#
791# CONFIG_DS1682 is not set
792# CONFIG_SENSORS_EEPROM is not set
793# CONFIG_SENSORS_PCF8574 is not set
794# CONFIG_PCF8575 is not set
795# CONFIG_SENSORS_PCF8591 is not set
796# CONFIG_SENSORS_MAX6875 is not set
797# CONFIG_SENSORS_TSL2550 is not set
798# CONFIG_I2C_DEBUG_CORE is not set
799# CONFIG_I2C_DEBUG_ALGO is not set
800# CONFIG_I2C_DEBUG_BUS is not set
801# CONFIG_I2C_DEBUG_CHIP is not set
802# CONFIG_SPI is not set
803# CONFIG_W1 is not set
804# CONFIG_POWER_SUPPLY is not set
805# CONFIG_HWMON is not set
806# CONFIG_THERMAL is not set
807# CONFIG_THERMAL_HWMON is not set
808# CONFIG_WATCHDOG is not set
809
810#
811# Sonics Silicon Backplane
812#
813CONFIG_SSB_POSSIBLE=y
814# CONFIG_SSB is not set
815
816#
817# Multifunction device drivers
818#
819CONFIG_MFD_SM501=y
820# CONFIG_HTC_PASIC3 is not set
821
822#
823# Multimedia devices
824#
825
826#
827# Multimedia core support
828#
829# CONFIG_VIDEO_DEV is not set
830# CONFIG_DVB_CORE is not set
831# CONFIG_VIDEO_MEDIA is not set
832
833#
834# Multimedia drivers
835#
836# CONFIG_DAB is not set
837
838#
839# Graphics support
840#
841# CONFIG_DRM is not set
842# CONFIG_VGASTATE is not set
843# CONFIG_VIDEO_OUTPUT_CONTROL is not set
844CONFIG_FB=y
845# CONFIG_FIRMWARE_EDID is not set
846# CONFIG_FB_DDC is not set
847CONFIG_FB_CFB_FILLRECT=y
848CONFIG_FB_CFB_COPYAREA=y
849CONFIG_FB_CFB_IMAGEBLIT=y
850# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
851# CONFIG_FB_SYS_FILLRECT is not set
852# CONFIG_FB_SYS_COPYAREA is not set
853# CONFIG_FB_SYS_IMAGEBLIT is not set
854# CONFIG_FB_FOREIGN_ENDIAN is not set
855# CONFIG_FB_SYS_FOPS is not set
856# CONFIG_FB_SVGALIB is not set
857# CONFIG_FB_MACMODES is not set
858# CONFIG_FB_BACKLIGHT is not set
859# CONFIG_FB_MODE_HELPERS is not set
860# CONFIG_FB_TILEBLITTING is not set
861
862#
863# Frame buffer hardware drivers
864#
865# CONFIG_FB_CIRRUS is not set
866# CONFIG_FB_PM2 is not set
867# CONFIG_FB_CYBER2000 is not set
868# CONFIG_FB_ASILIANT is not set
869# CONFIG_FB_IMSTT is not set
870# CONFIG_FB_S1D13XXX is not set
871# CONFIG_FB_NVIDIA is not set
872# CONFIG_FB_RIVA is not set
873# CONFIG_FB_MATROX is not set
874# CONFIG_FB_RADEON is not set
875# CONFIG_FB_ATY128 is not set
876# CONFIG_FB_ATY is not set
877# CONFIG_FB_S3 is not set
878# CONFIG_FB_SAVAGE is not set
879# CONFIG_FB_SIS is not set
880# CONFIG_FB_NEOMAGIC is not set
881# CONFIG_FB_KYRO is not set
882# CONFIG_FB_3DFX is not set
883# CONFIG_FB_VOODOO1 is not set
884# CONFIG_FB_VT8623 is not set
885# CONFIG_FB_TRIDENT is not set
886# CONFIG_FB_ARK is not set
887# CONFIG_FB_PM3 is not set
888CONFIG_FB_SM501=y
889# CONFIG_FB_VIRTUAL is not set
890# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
891
892#
893# Display device support
894#
895# CONFIG_DISPLAY_SUPPORT is not set
896
897#
898# Console display driver support
899#
900CONFIG_DUMMY_CONSOLE=y
901CONFIG_FRAMEBUFFER_CONSOLE=y
902# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
903# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
904# CONFIG_FONTS is not set
905CONFIG_FONT_8x8=y
906CONFIG_FONT_8x16=y
907CONFIG_LOGO=y
908# CONFIG_LOGO_LINUX_MONO is not set
909# CONFIG_LOGO_LINUX_VGA16 is not set
910CONFIG_LOGO_LINUX_CLUT224=y
911# CONFIG_LOGO_SUPERH_MONO is not set
912# CONFIG_LOGO_SUPERH_VGA16 is not set
913# CONFIG_LOGO_SUPERH_CLUT224 is not set
914
915#
916# Sound
917#
918# CONFIG_SOUND is not set
919CONFIG_HID_SUPPORT=y
920CONFIG_HID=y
921# CONFIG_HID_DEBUG is not set
922# CONFIG_HIDRAW is not set
923
924#
925# USB Input Devices
926#
927CONFIG_USB_HID=y
928# CONFIG_USB_HIDINPUT_POWERBOOK is not set
929# CONFIG_HID_FF is not set
930# CONFIG_USB_HIDDEV is not set
931CONFIG_USB_SUPPORT=y
932CONFIG_USB_ARCH_HAS_HCD=y
933CONFIG_USB_ARCH_HAS_OHCI=y
934CONFIG_USB_ARCH_HAS_EHCI=y
935CONFIG_USB=y
936# CONFIG_USB_DEBUG is not set
937# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
938
939#
940# Miscellaneous USB options
941#
942CONFIG_USB_DEVICEFS=y
943CONFIG_USB_DEVICE_CLASS=y
944# CONFIG_USB_DYNAMIC_MINORS is not set
945# CONFIG_USB_OTG is not set
946# CONFIG_USB_OTG_WHITELIST is not set
947# CONFIG_USB_OTG_BLACKLIST_HUB is not set
948
949#
950# USB Host Controller Drivers
951#
952# CONFIG_USB_C67X00_HCD is not set
953CONFIG_USB_EHCI_HCD=m
954# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
955# CONFIG_USB_EHCI_TT_NEWSCHED is not set
956# CONFIG_USB_ISP116X_HCD is not set
957# CONFIG_USB_ISP1760_HCD is not set
958CONFIG_USB_OHCI_HCD=m
959# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
960# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
961CONFIG_USB_OHCI_LITTLE_ENDIAN=y
962# CONFIG_USB_UHCI_HCD is not set
963# CONFIG_USB_SL811_HCD is not set
964CONFIG_USB_R8A66597_HCD=y
965
966#
967# USB Device Class drivers
968#
969# CONFIG_USB_ACM is not set
970# CONFIG_USB_PRINTER is not set
971# CONFIG_USB_WDM is not set
972
973#
974# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
975#
976
977#
978# may also be needed; see USB_STORAGE Help for more information
979#
980CONFIG_USB_STORAGE=y
981# CONFIG_USB_STORAGE_DEBUG is not set
982# CONFIG_USB_STORAGE_DATAFAB is not set
983# CONFIG_USB_STORAGE_FREECOM is not set
984# CONFIG_USB_STORAGE_ISD200 is not set
985# CONFIG_USB_STORAGE_DPCM is not set
986# CONFIG_USB_STORAGE_USBAT is not set
987# CONFIG_USB_STORAGE_SDDR09 is not set
988# CONFIG_USB_STORAGE_SDDR55 is not set
989# CONFIG_USB_STORAGE_JUMPSHOT is not set
990# CONFIG_USB_STORAGE_ALAUDA is not set
991# CONFIG_USB_STORAGE_ONETOUCH is not set
992# CONFIG_USB_STORAGE_KARMA is not set
993# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
994# CONFIG_USB_LIBUSUAL is not set
995
996#
997# USB Imaging devices
998#
999# CONFIG_USB_MDC800 is not set
1000# CONFIG_USB_MICROTEK is not set
1001CONFIG_USB_MON=y
1002
1003#
1004# USB port drivers
1005#
1006# CONFIG_USB_SERIAL is not set
1007
1008#
1009# USB Miscellaneous drivers
1010#
1011# CONFIG_USB_EMI62 is not set
1012# CONFIG_USB_EMI26 is not set
1013# CONFIG_USB_ADUTUX is not set
1014# CONFIG_USB_AUERSWALD is not set
1015# CONFIG_USB_RIO500 is not set
1016# CONFIG_USB_LEGOTOWER is not set
1017# CONFIG_USB_LCD is not set
1018# CONFIG_USB_BERRY_CHARGE is not set
1019# CONFIG_USB_LED is not set
1020# CONFIG_USB_CYPRESS_CY7C63 is not set
1021# CONFIG_USB_CYTHERM is not set
1022# CONFIG_USB_PHIDGET is not set
1023# CONFIG_USB_IDMOUSE is not set
1024# CONFIG_USB_FTDI_ELAN is not set
1025# CONFIG_USB_APPLEDISPLAY is not set
1026# CONFIG_USB_SISUSBVGA is not set
1027# CONFIG_USB_LD is not set
1028# CONFIG_USB_TRANCEVIBRATOR is not set
1029# CONFIG_USB_IOWARRIOR is not set
1030CONFIG_USB_TEST=m
1031# CONFIG_USB_ISIGHTFW is not set
1032# CONFIG_USB_GADGET is not set
1033# CONFIG_MMC is not set
1034# CONFIG_MEMSTICK is not set
1035# CONFIG_NEW_LEDS is not set
1036# CONFIG_ACCESSIBILITY is not set
1037# CONFIG_INFINIBAND is not set
1038CONFIG_RTC_LIB=y
1039CONFIG_RTC_CLASS=y
1040CONFIG_RTC_HCTOSYS=y
1041CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1042# CONFIG_RTC_DEBUG is not set
1043
1044#
1045# RTC interfaces
1046#
1047CONFIG_RTC_INTF_SYSFS=y
1048CONFIG_RTC_INTF_PROC=y
1049CONFIG_RTC_INTF_DEV=y
1050# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1051# CONFIG_RTC_DRV_TEST is not set
1052
1053#
1054# I2C RTC drivers
1055#
1056# CONFIG_RTC_DRV_DS1307 is not set
1057# CONFIG_RTC_DRV_DS1374 is not set
1058# CONFIG_RTC_DRV_DS1672 is not set
1059# CONFIG_RTC_DRV_MAX6900 is not set
1060CONFIG_RTC_DRV_RS5C372=y
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# CONFIG_RTC_DRV_FM3130 is not set
1068
1069#
1070# SPI RTC drivers
1071#
1072
1073#
1074# Platform RTC drivers
1075#
1076# CONFIG_RTC_DRV_DS1511 is not set
1077# CONFIG_RTC_DRV_DS1553 is not set
1078# CONFIG_RTC_DRV_DS1742 is not set
1079# CONFIG_RTC_DRV_STK17TA8 is not set
1080# CONFIG_RTC_DRV_M48T86 is not set
1081# CONFIG_RTC_DRV_M48T59 is not set
1082# CONFIG_RTC_DRV_V3020 is not set
1083
1084#
1085# on-CPU RTC drivers
1086#
1087# CONFIG_RTC_DRV_SH is not set
1088# CONFIG_UIO is not set
1089
1090#
1091# File systems
1092#
1093CONFIG_EXT2_FS=y
1094# CONFIG_EXT2_FS_XATTR is not set
1095# CONFIG_EXT2_FS_XIP is not set
1096CONFIG_EXT3_FS=y
1097CONFIG_EXT3_FS_XATTR=y
1098# CONFIG_EXT3_FS_POSIX_ACL is not set
1099# CONFIG_EXT3_FS_SECURITY is not set
1100# CONFIG_EXT4DEV_FS is not set
1101CONFIG_JBD=y
1102CONFIG_FS_MBCACHE=y
1103# CONFIG_REISERFS_FS is not set
1104# CONFIG_JFS_FS is not set
1105CONFIG_FS_POSIX_ACL=y
1106# CONFIG_XFS_FS is not set
1107# CONFIG_OCFS2_FS is not set
1108CONFIG_DNOTIFY=y
1109CONFIG_INOTIFY=y
1110CONFIG_INOTIFY_USER=y
1111# CONFIG_QUOTA is not set
1112# CONFIG_AUTOFS_FS is not set
1113# CONFIG_AUTOFS4_FS is not set
1114# CONFIG_FUSE_FS is not set
1115
1116#
1117# CD-ROM/DVD Filesystems
1118#
1119# CONFIG_ISO9660_FS is not set
1120# CONFIG_UDF_FS is not set
1121
1122#
1123# DOS/FAT/NT Filesystems
1124#
1125CONFIG_FAT_FS=y
1126CONFIG_MSDOS_FS=y
1127CONFIG_VFAT_FS=y
1128CONFIG_FAT_DEFAULT_CODEPAGE=437
1129CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1130CONFIG_NTFS_FS=y
1131# CONFIG_NTFS_DEBUG is not set
1132CONFIG_NTFS_RW=y
1133
1134#
1135# Pseudo filesystems
1136#
1137CONFIG_PROC_FS=y
1138CONFIG_PROC_KCORE=y
1139CONFIG_PROC_SYSCTL=y
1140CONFIG_SYSFS=y
1141CONFIG_TMPFS=y
1142# CONFIG_TMPFS_POSIX_ACL is not set
1143# CONFIG_HUGETLBFS is not set
1144# CONFIG_HUGETLB_PAGE is not set
1145# CONFIG_CONFIGFS_FS is not set
1146
1147#
1148# Miscellaneous filesystems
1149#
1150# CONFIG_ADFS_FS is not set
1151# CONFIG_AFFS_FS is not set
1152# CONFIG_HFS_FS is not set
1153# CONFIG_HFSPLUS_FS is not set
1154# CONFIG_BEFS_FS is not set
1155# CONFIG_BFS_FS is not set
1156# CONFIG_EFS_FS is not set
1157# CONFIG_JFFS2_FS is not set
1158# CONFIG_CRAMFS is not set
1159# CONFIG_VXFS_FS is not set
1160CONFIG_MINIX_FS=y
1161# CONFIG_HPFS_FS is not set
1162# CONFIG_QNX4FS_FS is not set
1163# CONFIG_ROMFS_FS is not set
1164# CONFIG_SYSV_FS is not set
1165# CONFIG_UFS_FS is not set
1166CONFIG_NETWORK_FILESYSTEMS=y
1167CONFIG_NFS_FS=y
1168CONFIG_NFS_V3=y
1169# CONFIG_NFS_V3_ACL is not set
1170CONFIG_NFS_V4=y
1171CONFIG_NFSD=y
1172CONFIG_NFSD_V3=y
1173# CONFIG_NFSD_V3_ACL is not set
1174CONFIG_NFSD_V4=y
1175CONFIG_ROOT_NFS=y
1176CONFIG_LOCKD=y
1177CONFIG_LOCKD_V4=y
1178CONFIG_EXPORTFS=y
1179CONFIG_NFS_COMMON=y
1180CONFIG_SUNRPC=y
1181CONFIG_SUNRPC_GSS=y
1182# CONFIG_SUNRPC_BIND34 is not set
1183CONFIG_RPCSEC_GSS_KRB5=y
1184# CONFIG_RPCSEC_GSS_SPKM3 is not set
1185# CONFIG_SMB_FS is not set
1186# CONFIG_CIFS is not set
1187# CONFIG_NCP_FS is not set
1188# CONFIG_CODA_FS is not set
1189# CONFIG_AFS_FS is not set
1190
1191#
1192# Partition Types
1193#
1194# CONFIG_PARTITION_ADVANCED is not set
1195CONFIG_MSDOS_PARTITION=y
1196CONFIG_NLS=y
1197CONFIG_NLS_DEFAULT="iso8859-1"
1198CONFIG_NLS_CODEPAGE_437=y
1199# CONFIG_NLS_CODEPAGE_737 is not set
1200# CONFIG_NLS_CODEPAGE_775 is not set
1201# CONFIG_NLS_CODEPAGE_850 is not set
1202# CONFIG_NLS_CODEPAGE_852 is not set
1203# CONFIG_NLS_CODEPAGE_855 is not set
1204# CONFIG_NLS_CODEPAGE_857 is not set
1205# CONFIG_NLS_CODEPAGE_860 is not set
1206# CONFIG_NLS_CODEPAGE_861 is not set
1207# CONFIG_NLS_CODEPAGE_862 is not set
1208# CONFIG_NLS_CODEPAGE_863 is not set
1209# CONFIG_NLS_CODEPAGE_864 is not set
1210# CONFIG_NLS_CODEPAGE_865 is not set
1211# CONFIG_NLS_CODEPAGE_866 is not set
1212# CONFIG_NLS_CODEPAGE_869 is not set
1213# CONFIG_NLS_CODEPAGE_936 is not set
1214# CONFIG_NLS_CODEPAGE_950 is not set
1215CONFIG_NLS_CODEPAGE_932=y
1216# CONFIG_NLS_CODEPAGE_949 is not set
1217# CONFIG_NLS_CODEPAGE_874 is not set
1218# CONFIG_NLS_ISO8859_8 is not set
1219# CONFIG_NLS_CODEPAGE_1250 is not set
1220# CONFIG_NLS_CODEPAGE_1251 is not set
1221# CONFIG_NLS_ASCII is not set
1222CONFIG_NLS_ISO8859_1=y
1223# CONFIG_NLS_ISO8859_2 is not set
1224# CONFIG_NLS_ISO8859_3 is not set
1225# CONFIG_NLS_ISO8859_4 is not set
1226# CONFIG_NLS_ISO8859_5 is not set
1227# CONFIG_NLS_ISO8859_6 is not set
1228# CONFIG_NLS_ISO8859_7 is not set
1229# CONFIG_NLS_ISO8859_9 is not set
1230# CONFIG_NLS_ISO8859_13 is not set
1231# CONFIG_NLS_ISO8859_14 is not set
1232# CONFIG_NLS_ISO8859_15 is not set
1233# CONFIG_NLS_KOI8_R is not set
1234# CONFIG_NLS_KOI8_U is not set
1235# CONFIG_NLS_UTF8 is not set
1236# CONFIG_DLM is not set
1237
1238#
1239# Kernel hacking
1240#
1241CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1242# CONFIG_PRINTK_TIME is not set
1243# CONFIG_ENABLE_WARN_DEPRECATED is not set
1244# CONFIG_ENABLE_MUST_CHECK is not set
1245CONFIG_FRAME_WARN=1024
1246# CONFIG_MAGIC_SYSRQ is not set
1247# CONFIG_UNUSED_SYMBOLS is not set
1248# CONFIG_DEBUG_FS is not set
1249# CONFIG_HEADERS_CHECK is not set
1250CONFIG_DEBUG_KERNEL=y
1251# CONFIG_DEBUG_SHIRQ is not set
1252CONFIG_DETECT_SOFTLOCKUP=y
1253CONFIG_SCHED_DEBUG=y
1254# CONFIG_SCHEDSTATS is not set
1255# CONFIG_TIMER_STATS is not set
1256# CONFIG_DEBUG_OBJECTS is not set
1257# CONFIG_DEBUG_SLAB is not set
1258CONFIG_DEBUG_PREEMPT=y
1259# CONFIG_DEBUG_RT_MUTEXES is not set
1260# CONFIG_RT_MUTEX_TESTER is not set
1261# CONFIG_DEBUG_SPINLOCK is not set
1262# CONFIG_DEBUG_MUTEXES is not set
1263# CONFIG_DEBUG_LOCK_ALLOC is not set
1264# CONFIG_PROVE_LOCKING is not set
1265# CONFIG_LOCK_STAT is not set
1266# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1267# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1268# CONFIG_DEBUG_KOBJECT is not set
1269# CONFIG_DEBUG_BUGVERBOSE is not set
1270# CONFIG_DEBUG_INFO is not set
1271# CONFIG_DEBUG_VM is not set
1272# CONFIG_DEBUG_WRITECOUNT is not set
1273# CONFIG_DEBUG_LIST is not set
1274# CONFIG_DEBUG_SG is not set
1275# CONFIG_FRAME_POINTER is not set
1276# CONFIG_BOOT_PRINTK_DELAY is not set
1277# CONFIG_RCU_TORTURE_TEST is not set
1278# CONFIG_BACKTRACE_SELF_TEST is not set
1279# CONFIG_FAULT_INJECTION is not set
1280# CONFIG_SAMPLES is not set
1281# CONFIG_SH_STANDARD_BIOS is not set
1282# CONFIG_EARLY_SCIF_CONSOLE is not set
1283# CONFIG_DEBUG_BOOTMEM is not set
1284# CONFIG_DEBUG_STACKOVERFLOW is not set
1285# CONFIG_DEBUG_STACK_USAGE is not set
1286# CONFIG_4KSTACKS is not set
1287# CONFIG_IRQSTACKS is not set
1288# CONFIG_SH_KGDB is not set
1289
1290#
1291# Security options
1292#
1293# CONFIG_KEYS is not set
1294# CONFIG_SECURITY is not set
1295# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1296CONFIG_CRYPTO=y
1297
1298#
1299# Crypto core or helper
1300#
1301CONFIG_CRYPTO_ALGAPI=y
1302CONFIG_CRYPTO_BLKCIPHER=y
1303CONFIG_CRYPTO_HASH=y
1304CONFIG_CRYPTO_MANAGER=y
1305# CONFIG_CRYPTO_GF128MUL is not set
1306# CONFIG_CRYPTO_NULL is not set
1307# CONFIG_CRYPTO_CRYPTD is not set
1308# CONFIG_CRYPTO_AUTHENC is not set
1309# CONFIG_CRYPTO_TEST is not set
1310
1311#
1312# Authenticated Encryption with Associated Data
1313#
1314# CONFIG_CRYPTO_CCM is not set
1315# CONFIG_CRYPTO_GCM is not set
1316# CONFIG_CRYPTO_SEQIV is not set
1317
1318#
1319# Block modes
1320#
1321CONFIG_CRYPTO_CBC=y
1322# CONFIG_CRYPTO_CTR is not set
1323# CONFIG_CRYPTO_CTS is not set
1324# CONFIG_CRYPTO_ECB is not set
1325# CONFIG_CRYPTO_LRW is not set
1326# CONFIG_CRYPTO_PCBC is not set
1327# CONFIG_CRYPTO_XTS is not set
1328
1329#
1330# Hash modes
1331#
1332CONFIG_CRYPTO_HMAC=y
1333# CONFIG_CRYPTO_XCBC is not set
1334
1335#
1336# Digest
1337#
1338# CONFIG_CRYPTO_CRC32C is not set
1339# CONFIG_CRYPTO_MD4 is not set
1340CONFIG_CRYPTO_MD5=y
1341# CONFIG_CRYPTO_MICHAEL_MIC is not set
1342# CONFIG_CRYPTO_SHA1 is not set
1343# CONFIG_CRYPTO_SHA256 is not set
1344# CONFIG_CRYPTO_SHA512 is not set
1345# CONFIG_CRYPTO_TGR192 is not set
1346# CONFIG_CRYPTO_WP512 is not set
1347
1348#
1349# Ciphers
1350#
1351# CONFIG_CRYPTO_AES is not set
1352# CONFIG_CRYPTO_ANUBIS is not set
1353# CONFIG_CRYPTO_ARC4 is not set
1354# CONFIG_CRYPTO_BLOWFISH is not set
1355# CONFIG_CRYPTO_CAMELLIA is not set
1356# CONFIG_CRYPTO_CAST5 is not set
1357# CONFIG_CRYPTO_CAST6 is not set
1358CONFIG_CRYPTO_DES=y
1359# CONFIG_CRYPTO_FCRYPT is not set
1360# CONFIG_CRYPTO_KHAZAD is not set
1361# CONFIG_CRYPTO_SALSA20 is not set
1362# CONFIG_CRYPTO_SEED is not set
1363# CONFIG_CRYPTO_SERPENT is not set
1364# CONFIG_CRYPTO_TEA is not set
1365# CONFIG_CRYPTO_TWOFISH is not set
1366
1367#
1368# Compression
1369#
1370# CONFIG_CRYPTO_DEFLATE is not set
1371# CONFIG_CRYPTO_LZO is not set
1372# CONFIG_CRYPTO_HW is not set
1373
1374#
1375# Library routines
1376#
1377CONFIG_BITREVERSE=y
1378# CONFIG_GENERIC_FIND_FIRST_BIT is not set
1379# CONFIG_CRC_CCITT is not set
1380# CONFIG_CRC16 is not set
1381# CONFIG_CRC_ITU_T is not set
1382CONFIG_CRC32=y
1383# CONFIG_CRC7 is not set
1384# CONFIG_LIBCRC32C is not set
1385CONFIG_PLIST=y
1386CONFIG_HAS_IOMEM=y
1387CONFIG_HAS_IOPORT=y
1388CONFIG_HAS_DMA=y
diff --git a/arch/sh/drivers/dma/dma-g2.c b/arch/sh/drivers/dma/dma-g2.c
index 0caf11bb7e27..af7bb589c2c8 100644
--- a/arch/sh/drivers/dma/dma-g2.c
+++ b/arch/sh/drivers/dma/dma-g2.c
@@ -14,8 +14,8 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/mach/sysasic.h> 17#include <mach/sysasic.h>
18#include <asm/mach/dma.h> 18#include <mach/dma.h>
19#include <asm/dma.h> 19#include <asm/dma.h>
20 20
21struct g2_channel { 21struct g2_channel {
diff --git a/arch/sh/drivers/dma/dma-pvr2.c b/arch/sh/drivers/dma/dma-pvr2.c
index 838fad566eaf..391cbe1c2956 100644
--- a/arch/sh/drivers/dma/dma-pvr2.c
+++ b/arch/sh/drivers/dma/dma-pvr2.c
@@ -13,8 +13,8 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <asm/mach/sysasic.h> 16#include <mach/sysasic.h>
17#include <asm/mach/dma.h> 17#include <mach/dma.h>
18#include <asm/dma.h> 18#include <asm/dma.h>
19#include <asm/io.h> 19#include <asm/io.h>
20 20
diff --git a/arch/sh/drivers/dma/dma-sh.c b/arch/sh/drivers/dma/dma-sh.c
index 71ff3d6f26e2..b2ffe649c7c0 100644
--- a/arch/sh/drivers/dma/dma-sh.c
+++ b/arch/sh/drivers/dma/dma-sh.c
@@ -14,7 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <asm/dreamcast/dma.h> 17#include <mach-dreamcast/mach/dma.h>
18#include <asm/dma.h> 18#include <asm/dma.h>
19#include <asm/io.h> 19#include <asm/io.h>
20#include "dma-sh.h" 20#include "dma-sh.h"
diff --git a/arch/sh/drivers/dma/dma-sh.h b/arch/sh/drivers/dma/dma-sh.h
index 0f591fbc922d..b05af34fc15d 100644
--- a/arch/sh/drivers/dma/dma-sh.h
+++ b/arch/sh/drivers/dma/dma-sh.h
@@ -11,7 +11,7 @@
11#ifndef __DMA_SH_H 11#ifndef __DMA_SH_H
12#define __DMA_SH_H 12#define __DMA_SH_H
13 13
14#include <asm/cpu/dma.h> 14#include <cpu/dma.h>
15 15
16/* Definitions for the SuperH DMAC */ 16/* Definitions for the SuperH DMAC */
17#define REQ_L 0x00000000 17#define REQ_L 0x00000000
diff --git a/arch/sh/drivers/pci/Makefile b/arch/sh/drivers/pci/Makefile
index 0718805774e8..847e90894d1b 100644
--- a/arch/sh/drivers/pci/Makefile
+++ b/arch/sh/drivers/pci/Makefile
@@ -23,3 +23,4 @@ obj-$(CONFIG_SH_LANDISK) += ops-landisk.o
23obj-$(CONFIG_SH_LBOX_RE2) += ops-lboxre2.o fixups-lboxre2.o 23obj-$(CONFIG_SH_LBOX_RE2) += ops-lboxre2.o fixups-lboxre2.o
24obj-$(CONFIG_SH_7780_SOLUTION_ENGINE) += ops-se7780.o fixups-se7780.o 24obj-$(CONFIG_SH_7780_SOLUTION_ENGINE) += ops-se7780.o fixups-se7780.o
25obj-$(CONFIG_SH_CAYMAN) += ops-cayman.o 25obj-$(CONFIG_SH_CAYMAN) += ops-cayman.o
26obj-$(CONFIG_SH_SH7785LCR) += ops-sh7785lcr.o fixups-sh7785lcr.o
diff --git a/arch/sh/drivers/pci/fixups-dreamcast.c b/arch/sh/drivers/pci/fixups-dreamcast.c
index c44699301eeb..2bf85cf091e1 100644
--- a/arch/sh/drivers/pci/fixups-dreamcast.c
+++ b/arch/sh/drivers/pci/fixups-dreamcast.c
@@ -26,7 +26,7 @@
26 26
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/mach/pci.h> 29#include <mach/pci.h>
30 30
31static void __init gapspci_fixup_resources(struct pci_dev *dev) 31static void __init gapspci_fixup_resources(struct pci_dev *dev)
32{ 32{
diff --git a/arch/sh/drivers/pci/fixups-sh7785lcr.c b/arch/sh/drivers/pci/fixups-sh7785lcr.c
new file mode 100644
index 000000000000..4949e601387a
--- /dev/null
+++ b/arch/sh/drivers/pci/fixups-sh7785lcr.c
@@ -0,0 +1,46 @@
1/*
2 * arch/sh/drivers/pci/fixups-sh7785lcr.c
3 *
4 * R0P7785LC0011RL PCI fixups
5 * Copyright (C) 2008 Yoshihiro Shimoda
6 *
7 * Based on arch/sh/drivers/pci/fixups-r7780rp.c
8 * Copyright (C) 2003 Lineo uSolutions, Inc.
9 * Copyright (C) 2004 - 2006 Paul Mundt
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <linux/pci.h>
16#include "pci-sh4.h"
17
18int pci_fixup_pcic(void)
19{
20 pci_write_reg(0x000043ff, SH4_PCIINTM);
21 pci_write_reg(0x0000380f, SH4_PCIAINTM);
22
23 pci_write_reg(0xfbb00047, SH7780_PCICMD);
24 pci_write_reg(0x00000000, SH7780_PCIIBAR);
25
26 pci_write_reg(0x00011912, SH7780_PCISVID);
27 pci_write_reg(0x08000000, SH7780_PCICSCR0);
28 pci_write_reg(0x0000001b, SH7780_PCICSAR0);
29 pci_write_reg(0xfd000000, SH7780_PCICSCR1);
30 pci_write_reg(0x0000000f, SH7780_PCICSAR1);
31
32 pci_write_reg(0xfd000000, SH7780_PCIMBR0);
33 pci_write_reg(0x00fc0000, SH7780_PCIMBMR0);
34
35#ifdef CONFIG_32BIT
36 pci_write_reg(0xc0000000, SH7780_PCIMBR2);
37 pci_write_reg(0x20000000 - SH7780_PCI_IO_SIZE, SH7780_PCIMBMR2);
38#endif
39
40 /* Set IOBR for windows containing area specified in pci.h */
41 pci_write_reg((PCIBIOS_MIN_IO & ~(SH7780_PCI_IO_SIZE - 1)),
42 SH7780_PCIIOBR);
43 pci_write_reg(((SH7780_PCI_IO_SIZE - 1) & (7 << 18)), SH7780_PCIIOBMR);
44
45 return 0;
46}
diff --git a/arch/sh/drivers/pci/ops-cayman.c b/arch/sh/drivers/pci/ops-cayman.c
index 980275ffa30b..5ccf9ea3a9de 100644
--- a/arch/sh/drivers/pci/ops-cayman.c
+++ b/arch/sh/drivers/pci/ops-cayman.c
@@ -2,7 +2,7 @@
2#include <linux/init.h> 2#include <linux/init.h>
3#include <linux/pci.h> 3#include <linux/pci.h>
4#include <linux/types.h> 4#include <linux/types.h>
5#include <asm/cpu/irq.h> 5#include <cpu/irq.h>
6#include "pci-sh5.h" 6#include "pci-sh5.h"
7 7
8static inline u8 bridge_swizzle(u8 pin, u8 slot) 8static inline u8 bridge_swizzle(u8 pin, u8 slot)
diff --git a/arch/sh/drivers/pci/ops-dreamcast.c b/arch/sh/drivers/pci/ops-dreamcast.c
index e1284fc69361..f5d2a2aa6f3f 100644
--- a/arch/sh/drivers/pci/ops-dreamcast.c
+++ b/arch/sh/drivers/pci/ops-dreamcast.c
@@ -22,10 +22,11 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/pci.h> 24#include <linux/pci.h>
25#include <linux/module.h>
25 26
26#include <asm/io.h> 27#include <asm/io.h>
27#include <asm/irq.h> 28#include <asm/irq.h>
28#include <asm/mach/pci.h> 29#include <mach/pci.h>
29 30
30static struct resource gapspci_io_resource = { 31static struct resource gapspci_io_resource = {
31 .name = "GAPSPCI IO", 32 .name = "GAPSPCI IO",
@@ -48,6 +49,7 @@ struct pci_channel board_pci_channels[] = {
48 &gapspci_mem_resource, 0, 1 }, 49 &gapspci_mem_resource, 0, 1 },
49 { 0, } 50 { 0, }
50}; 51};
52EXPORT_SYMBOL(board_pci_channels);
51 53
52/* 54/*
53 * The !gapspci_config_access case really shouldn't happen, ever, unless 55 * The !gapspci_config_access case really shouldn't happen, ever, unless
diff --git a/arch/sh/drivers/pci/ops-se7780.c b/arch/sh/drivers/pci/ops-se7780.c
index bbdb48c124a2..3145c62484d6 100644
--- a/arch/sh/drivers/pci/ops-se7780.c
+++ b/arch/sh/drivers/pci/ops-se7780.c
@@ -13,7 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <asm/se7780.h> 16#include <mach-se/mach/se7780.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include "pci-sh4.h" 18#include "pci-sh4.h"
19 19
diff --git a/arch/sh/drivers/pci/ops-sh7785lcr.c b/arch/sh/drivers/pci/ops-sh7785lcr.c
new file mode 100644
index 000000000000..b3bd68702059
--- /dev/null
+++ b/arch/sh/drivers/pci/ops-sh7785lcr.c
@@ -0,0 +1,66 @@
1/*
2 * Author: Ian DaSilva (idasilva@mvista.com)
3 *
4 * Highly leveraged from pci-bigsur.c, written by Dustin McIntire.
5 *
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
8 *
9 * PCI initialization for the Renesas R0P7785LC0011RL board
10 * Based on arch/sh/drivers/pci/ops-r7780rp.c
11 *
12 */
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/init.h>
16#include <linux/delay.h>
17#include <linux/pci.h>
18#include "pci-sh4.h"
19
20static char irq_tab[] __initdata = {
21 65, 66, 67, 68,
22};
23
24int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
25{
26 return irq_tab[slot];
27}
28
29static struct resource sh7785_io_resource = {
30 .name = "SH7785_IO",
31 .start = SH7780_PCI_IO_BASE,
32 .end = SH7780_PCI_IO_BASE + SH7780_PCI_IO_SIZE - 1,
33 .flags = IORESOURCE_IO
34};
35
36static struct resource sh7785_mem_resource = {
37 .name = "SH7785_mem",
38 .start = SH7780_PCI_MEMORY_BASE,
39 .end = SH7780_PCI_MEMORY_BASE + SH7780_PCI_MEM_SIZE - 1,
40 .flags = IORESOURCE_MEM
41};
42
43struct pci_channel board_pci_channels[] = {
44 { &sh4_pci_ops, &sh7785_io_resource, &sh7785_mem_resource, 0, 0xff },
45 { NULL, NULL, NULL, 0, 0 },
46};
47EXPORT_SYMBOL(board_pci_channels);
48
49static struct sh4_pci_address_map sh7785_pci_map = {
50 .window0 = {
51 .base = SH7780_CS2_BASE_ADDR,
52 .size = 0x04000000,
53 },
54
55 .window1 = {
56 .base = SH7780_CS3_BASE_ADDR,
57 .size = 0x04000000,
58 },
59
60 .flags = SH4_PCIC_NO_RESET,
61};
62
63int __init pcibios_init_platform(void)
64{
65 return sh7780_pcic_init(&sh7785_pci_map);
66}
diff --git a/arch/sh/drivers/pci/pci-auto.c b/arch/sh/drivers/pci/pci-auto.c
index ea404704ace8..cf48b12ee58c 100644
--- a/arch/sh/drivers/pci/pci-auto.c
+++ b/arch/sh/drivers/pci/pci-auto.c
@@ -78,7 +78,7 @@ static struct pci_dev *fake_pci_dev(struct pci_channel *hose,
78} 78}
79 79
80#define EARLY_PCI_OP(rw, size, type) \ 80#define EARLY_PCI_OP(rw, size, type) \
81int early_##rw##_config_##size(struct pci_channel *hose, \ 81static int early_##rw##_config_##size(struct pci_channel *hose, \
82 int top_bus, int bus, int devfn, int offset, type value) \ 82 int top_bus, int bus, int devfn, int offset, type value) \
83{ \ 83{ \
84 return pci_##rw##_config_##size( \ 84 return pci_##rw##_config_##size( \
diff --git a/arch/sh/drivers/pci/pci-sh5.c b/arch/sh/drivers/pci/pci-sh5.c
index a00a4df8c02d..7a97438762c8 100644
--- a/arch/sh/drivers/pci/pci-sh5.c
+++ b/arch/sh/drivers/pci/pci-sh5.c
@@ -19,7 +19,7 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <asm/cpu/irq.h> 22#include <cpu/irq.h>
23#include <asm/pci.h> 23#include <asm/pci.h>
24#include <asm/io.h> 24#include <asm/io.h>
25#include "pci-sh5.h" 25#include "pci-sh5.h"
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index f57095a2617c..d3839e609aac 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -135,7 +135,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
135 * If we set up a device for bus mastering, we need to check and set 135 * If we set up a device for bus mastering, we need to check and set
136 * the latency timer as it may not be properly set. 136 * the latency timer as it may not be properly set.
137 */ 137 */
138unsigned int pcibios_max_latency = 255; 138static unsigned int pcibios_max_latency = 255;
139 139
140void pcibios_set_master(struct pci_dev *dev) 140void pcibios_set_master(struct pci_dev *dev)
141{ 141{
diff --git a/arch/sh/include/asm/.gitignore b/arch/sh/include/asm/.gitignore
new file mode 100644
index 000000000000..378db779fb6c
--- /dev/null
+++ b/arch/sh/include/asm/.gitignore
@@ -0,0 +1 @@
machtypes.h
diff --git a/include/asm-sh/Kbuild b/arch/sh/include/asm/Kbuild
index 43910cdf78a5..43910cdf78a5 100644
--- a/include/asm-sh/Kbuild
+++ b/arch/sh/include/asm/Kbuild
diff --git a/include/asm-sh/a.out.h b/arch/sh/include/asm/a.out.h
index 1f93130e179c..1f93130e179c 100644
--- a/include/asm-sh/a.out.h
+++ b/arch/sh/include/asm/a.out.h
diff --git a/arch/sh/include/asm/adc.h b/arch/sh/include/asm/adc.h
new file mode 100644
index 000000000000..48824c1fab80
--- /dev/null
+++ b/arch/sh/include/asm/adc.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_ADC_H
2#define __ASM_ADC_H
3#ifdef __KERNEL__
4/*
5 * Copyright (C) 2004 Andriy Skulysh
6 */
7
8#include <cpu/adc.h>
9
10int adc_single(unsigned int channel);
11
12#endif /* __KERNEL__ */
13#endif /* __ASM_ADC_H */
diff --git a/arch/sh/include/asm/addrspace.h b/arch/sh/include/asm/addrspace.h
new file mode 100644
index 000000000000..2702d81bfc0d
--- /dev/null
+++ b/arch/sh/include/asm/addrspace.h
@@ -0,0 +1,53 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999 by Kaz Kojima
7 *
8 * Defitions for the address spaces of the SH CPUs.
9 */
10#ifndef __ASM_SH_ADDRSPACE_H
11#define __ASM_SH_ADDRSPACE_H
12
13#ifdef __KERNEL__
14
15#include <cpu/addrspace.h>
16
17/* If this CPU supports segmentation, hook up the helpers */
18#ifdef P1SEG
19
20/*
21 [ P0/U0 (virtual) ] 0x00000000 <------ User space
22 [ P1 (fixed) cached ] 0x80000000 <------ Kernel space
23 [ P2 (fixed) non-cachable] 0xA0000000 <------ Physical access
24 [ P3 (virtual) cached] 0xC0000000 <------ vmalloced area
25 [ P4 control ] 0xE0000000
26 */
27
28/* Returns the privileged segment base of a given address */
29#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000)
30
31/* Returns the physical address of a PnSEG (n=1,2) address */
32#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
33
34#ifdef CONFIG_29BIT
35/*
36 * Map an address to a certain privileged segment
37 */
38#define P1SEGADDR(a) \
39 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P1SEG))
40#define P2SEGADDR(a) \
41 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P2SEG))
42#define P3SEGADDR(a) \
43 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P3SEG))
44#define P4SEGADDR(a) \
45 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P4SEG))
46#endif /* 29BIT */
47#endif /* P1SEG */
48
49/* Check if an address can be reached in 29 bits */
50#define IS_29BIT(a) (((unsigned long)(a)) < 0x20000000)
51
52#endif /* __KERNEL__ */
53#endif /* __ASM_SH_ADDRSPACE_H */
diff --git a/include/asm-sh/atomic-grb.h b/arch/sh/include/asm/atomic-grb.h
index 4c5b7dbfcedb..4c5b7dbfcedb 100644
--- a/include/asm-sh/atomic-grb.h
+++ b/arch/sh/include/asm/atomic-grb.h
diff --git a/include/asm-sh/atomic-irq.h b/arch/sh/include/asm/atomic-irq.h
index 74f7943cff6f..74f7943cff6f 100644
--- a/include/asm-sh/atomic-irq.h
+++ b/arch/sh/include/asm/atomic-irq.h
diff --git a/include/asm-sh/atomic-llsc.h b/arch/sh/include/asm/atomic-llsc.h
index 4b00b78e3f4f..4b00b78e3f4f 100644
--- a/include/asm-sh/atomic-llsc.h
+++ b/arch/sh/include/asm/atomic-llsc.h
diff --git a/include/asm-sh/atomic.h b/arch/sh/include/asm/atomic.h
index c043ef003028..c043ef003028 100644
--- a/include/asm-sh/atomic.h
+++ b/arch/sh/include/asm/atomic.h
diff --git a/arch/sh/include/asm/auxvec.h b/arch/sh/include/asm/auxvec.h
new file mode 100644
index 000000000000..483effd65e00
--- /dev/null
+++ b/arch/sh/include/asm/auxvec.h
@@ -0,0 +1,36 @@
1#ifndef __ASM_SH_AUXVEC_H
2#define __ASM_SH_AUXVEC_H
3
4/*
5 * Architecture-neutral AT_ values in 0-17, leave some room
6 * for more of them.
7 */
8
9/*
10 * This entry gives some information about the FPU initialization
11 * performed by the kernel.
12 */
13#define AT_FPUCW 18 /* Used FPU control word. */
14
15#if defined(CONFIG_VSYSCALL) || !defined(__KERNEL__)
16/*
17 * Only define this in the vsyscall case, the entry point to
18 * the vsyscall page gets placed here. The kernel will attempt
19 * to build a gate VMA we don't care about otherwise..
20 */
21#define AT_SYSINFO_EHDR 33
22#endif
23
24/*
25 * More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the
26 * value is -1, then the cache doesn't exist. Otherwise:
27 *
28 * bit 0-3: Cache set-associativity; 0 means fully associative.
29 * bit 4-7: Log2 of cacheline size.
30 * bit 8-31: Size of the entire cache >> 8.
31 */
32#define AT_L1I_CACHESHAPE 34
33#define AT_L1D_CACHESHAPE 35
34#define AT_L2_CACHESHAPE 36
35
36#endif /* __ASM_SH_AUXVEC_H */
diff --git a/include/asm-sh/bitops-grb.h b/arch/sh/include/asm/bitops-grb.h
index a5907b94395b..a5907b94395b 100644
--- a/include/asm-sh/bitops-grb.h
+++ b/arch/sh/include/asm/bitops-grb.h
diff --git a/include/asm-sh/bitops-irq.h b/arch/sh/include/asm/bitops-irq.h
index 653a12750584..653a12750584 100644
--- a/include/asm-sh/bitops-irq.h
+++ b/arch/sh/include/asm/bitops-irq.h
diff --git a/include/asm-sh/bitops.h b/arch/sh/include/asm/bitops.h
index d7d382f63ee5..d7d382f63ee5 100644
--- a/include/asm-sh/bitops.h
+++ b/arch/sh/include/asm/bitops.h
diff --git a/include/asm-sh/bug.h b/arch/sh/include/asm/bug.h
index c01718040166..c01718040166 100644
--- a/include/asm-sh/bug.h
+++ b/arch/sh/include/asm/bug.h
diff --git a/include/asm-sh/bugs.h b/arch/sh/include/asm/bugs.h
index 121b2ecddfc3..121b2ecddfc3 100644
--- a/include/asm-sh/bugs.h
+++ b/arch/sh/include/asm/bugs.h
diff --git a/include/asm-sh/byteorder.h b/arch/sh/include/asm/byteorder.h
index 4c13e6117563..4c13e6117563 100644
--- a/include/asm-sh/byteorder.h
+++ b/arch/sh/include/asm/byteorder.h
diff --git a/arch/sh/include/asm/cache.h b/arch/sh/include/asm/cache.h
new file mode 100644
index 000000000000..02df18ea9608
--- /dev/null
+++ b/arch/sh/include/asm/cache.h
@@ -0,0 +1,51 @@
1/* $Id: cache.h,v 1.6 2004/03/11 18:08:05 lethal Exp $
2 *
3 * include/asm-sh/cache.h
4 *
5 * Copyright 1999 (C) Niibe Yutaka
6 * Copyright 2002, 2003 (C) Paul Mundt
7 */
8#ifndef __ASM_SH_CACHE_H
9#define __ASM_SH_CACHE_H
10#ifdef __KERNEL__
11
12#include <linux/init.h>
13#include <cpu/cache.h>
14
15#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
16
17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18
19#ifndef __ASSEMBLY__
20struct cache_info {
21 unsigned int ways; /* Number of cache ways */
22 unsigned int sets; /* Number of cache sets */
23 unsigned int linesz; /* Cache line size (bytes) */
24
25 unsigned int way_size; /* sets * line size */
26
27 /*
28 * way_incr is the address offset for accessing the next way
29 * in memory mapped cache array ops.
30 */
31 unsigned int way_incr;
32 unsigned int entry_shift;
33 unsigned int entry_mask;
34
35 /*
36 * Compute a mask which selects the address bits which overlap between
37 * 1. those used to select the cache set during indexing
38 * 2. those in the physical page number.
39 */
40 unsigned int alias_mask;
41
42 unsigned int n_aliases; /* Number of aliases */
43
44 unsigned long flags;
45};
46
47int __init detect_cpu_and_cache_system(void);
48
49#endif /* __ASSEMBLY__ */
50#endif /* __KERNEL__ */
51#endif /* __ASM_SH_CACHE_H */
diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
new file mode 100644
index 000000000000..09acbc32d6c7
--- /dev/null
+++ b/arch/sh/include/asm/cacheflush.h
@@ -0,0 +1,81 @@
1#ifndef __ASM_SH_CACHEFLUSH_H
2#define __ASM_SH_CACHEFLUSH_H
3
4#ifdef __KERNEL__
5
6#ifdef CONFIG_CACHE_OFF
7/*
8 * Nothing to do when the cache is disabled, initial flush and explicit
9 * disabling is handled at CPU init time.
10 *
11 * See arch/sh/kernel/cpu/init.c:cache_init().
12 */
13#define p3_cache_init() do { } while (0)
14#define flush_cache_all() do { } while (0)
15#define flush_cache_mm(mm) do { } while (0)
16#define flush_cache_dup_mm(mm) do { } while (0)
17#define flush_cache_range(vma, start, end) do { } while (0)
18#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
19#define flush_dcache_page(page) do { } while (0)
20#define flush_icache_range(start, end) do { } while (0)
21#define flush_icache_page(vma,pg) do { } while (0)
22#define flush_dcache_mmap_lock(mapping) do { } while (0)
23#define flush_dcache_mmap_unlock(mapping) do { } while (0)
24#define flush_cache_sigtramp(vaddr) do { } while (0)
25#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
26#define __flush_wback_region(start, size) do { (void)(start); } while (0)
27#define __flush_purge_region(start, size) do { (void)(start); } while (0)
28#define __flush_invalidate_region(start, size) do { (void)(start); } while (0)
29#else
30#include <cpu/cacheflush.h>
31
32/*
33 * Consistent DMA requires that the __flush_xxx() primitives must be set
34 * for any of the enabled non-coherent caches (most of the UP CPUs),
35 * regardless of PIPT or VIPT cache configurations.
36 */
37
38/* Flush (write-back only) a region (smaller than a page) */
39extern void __flush_wback_region(void *start, int size);
40/* Flush (write-back & invalidate) a region (smaller than a page) */
41extern void __flush_purge_region(void *start, int size);
42/* Flush (invalidate only) a region (smaller than a page) */
43extern void __flush_invalidate_region(void *start, int size);
44#endif
45
46#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
47static inline void flush_kernel_dcache_page(struct page *page)
48{
49 flush_dcache_page(page);
50}
51
52#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF)
53extern void copy_to_user_page(struct vm_area_struct *vma,
54 struct page *page, unsigned long vaddr, void *dst, const void *src,
55 unsigned long len);
56
57extern void copy_from_user_page(struct vm_area_struct *vma,
58 struct page *page, unsigned long vaddr, void *dst, const void *src,
59 unsigned long len);
60#else
61#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
62 do { \
63 flush_cache_page(vma, vaddr, page_to_pfn(page));\
64 memcpy(dst, src, len); \
65 flush_icache_user_range(vma, page, vaddr, len); \
66 } while (0)
67
68#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
69 do { \
70 flush_cache_page(vma, vaddr, page_to_pfn(page));\
71 memcpy(dst, src, len); \
72 } while (0)
73#endif
74
75#define flush_cache_vmap(start, end) flush_cache_all()
76#define flush_cache_vunmap(start, end) flush_cache_all()
77
78#define HAVE_ARCH_UNMAPPED_AREA
79
80#endif /* __KERNEL__ */
81#endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/include/asm-sh/checksum.h b/arch/sh/include/asm/checksum.h
index 67496ab0ef04..67496ab0ef04 100644
--- a/include/asm-sh/checksum.h
+++ b/arch/sh/include/asm/checksum.h
diff --git a/include/asm-sh/checksum_32.h b/arch/sh/include/asm/checksum_32.h
index 14b7ac2f0a07..14b7ac2f0a07 100644
--- a/include/asm-sh/checksum_32.h
+++ b/arch/sh/include/asm/checksum_32.h
diff --git a/include/asm-sh/checksum_64.h b/arch/sh/include/asm/checksum_64.h
index 9c62a031a8f5..9c62a031a8f5 100644
--- a/include/asm-sh/checksum_64.h
+++ b/arch/sh/include/asm/checksum_64.h
diff --git a/arch/sh/include/asm/clock.h b/arch/sh/include/asm/clock.h
new file mode 100644
index 000000000000..720dfab7b15e
--- /dev/null
+++ b/arch/sh/include/asm/clock.h
@@ -0,0 +1,97 @@
1#ifndef __ASM_SH_CLOCK_H
2#define __ASM_SH_CLOCK_H
3
4#include <linux/kref.h>
5#include <linux/list.h>
6#include <linux/seq_file.h>
7#include <linux/clk.h>
8#include <linux/err.h>
9
10struct clk;
11
12struct clk_ops {
13 void (*init)(struct clk *clk);
14 void (*enable)(struct clk *clk);
15 void (*disable)(struct clk *clk);
16 void (*recalc)(struct clk *clk);
17 int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
18 long (*round_rate)(struct clk *clk, unsigned long rate);
19};
20
21struct clk {
22 struct list_head node;
23 const char *name;
24 int id;
25 struct module *owner;
26
27 struct clk *parent;
28 struct clk_ops *ops;
29
30 struct kref kref;
31
32 unsigned long rate;
33 unsigned long flags;
34 unsigned long arch_flags;
35};
36
37#define CLK_ALWAYS_ENABLED (1 << 0)
38#define CLK_RATE_PROPAGATES (1 << 1)
39
40/* Should be defined by processor-specific code */
41void arch_init_clk_ops(struct clk_ops **, int type);
42
43/* arch/sh/kernel/cpu/clock.c */
44int clk_init(void);
45
46void clk_recalc_rate(struct clk *);
47
48int clk_register(struct clk *);
49void clk_unregister(struct clk *);
50
51static inline int clk_always_enable(const char *id)
52{
53 struct clk *clk;
54 int ret;
55
56 clk = clk_get(NULL, id);
57 if (IS_ERR(clk))
58 return PTR_ERR(clk);
59
60 ret = clk_enable(clk);
61 if (ret)
62 clk_put(clk);
63
64 return ret;
65}
66
67/* the exported API, in addition to clk_set_rate */
68/**
69 * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
70 * @clk: clock source
71 * @rate: desired clock rate in Hz
72 * @algo_id: algorithm id to be passed down to ops->set_rate
73 *
74 * Returns success (0) or negative errno.
75 */
76int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
77
78enum clk_sh_algo_id {
79 NO_CHANGE = 0,
80
81 IUS_N1_N1,
82 IUS_322,
83 IUS_522,
84 IUS_N11,
85
86 SB_N1,
87
88 SB3_N1,
89 SB3_32,
90 SB3_43,
91 SB3_54,
92
93 BP_N1,
94
95 IP_N1,
96};
97#endif /* __ASM_SH_CLOCK_H */
diff --git a/include/asm-sh/cmpxchg-grb.h b/arch/sh/include/asm/cmpxchg-grb.h
index e2681abe764f..e2681abe764f 100644
--- a/include/asm-sh/cmpxchg-grb.h
+++ b/arch/sh/include/asm/cmpxchg-grb.h
diff --git a/include/asm-sh/cmpxchg-irq.h b/arch/sh/include/asm/cmpxchg-irq.h
index 43049ec0554b..43049ec0554b 100644
--- a/include/asm-sh/cmpxchg-irq.h
+++ b/arch/sh/include/asm/cmpxchg-irq.h
diff --git a/include/asm-sh/cpu-features.h b/arch/sh/include/asm/cpu-features.h
index 86308aa39731..86308aa39731 100644
--- a/include/asm-sh/cpu-features.h
+++ b/arch/sh/include/asm/cpu-features.h
diff --git a/include/asm-sh/cputime.h b/arch/sh/include/asm/cputime.h
index 6ca395d1393e..6ca395d1393e 100644
--- a/include/asm-sh/cputime.h
+++ b/arch/sh/include/asm/cputime.h
diff --git a/include/asm-sh/current.h b/arch/sh/include/asm/current.h
index 62b63880b333..62b63880b333 100644
--- a/include/asm-sh/current.h
+++ b/arch/sh/include/asm/current.h
diff --git a/include/asm-sh/delay.h b/arch/sh/include/asm/delay.h
index 4b16bf9b56bd..4b16bf9b56bd 100644
--- a/include/asm-sh/delay.h
+++ b/arch/sh/include/asm/delay.h
diff --git a/arch/sh/include/asm/device.h b/arch/sh/include/asm/device.h
new file mode 100644
index 000000000000..efd511d0803a
--- /dev/null
+++ b/arch/sh/include/asm/device.h
@@ -0,0 +1,12 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
8struct platform_device;
9/* allocate contiguous memory chunk and fill in struct resource */
10int platform_resource_setup_memory(struct platform_device *pdev,
11 char *name, unsigned long memsize);
12
diff --git a/include/asm-sh/div64.h b/arch/sh/include/asm/div64.h
index 6cd978cefb28..6cd978cefb28 100644
--- a/include/asm-sh/div64.h
+++ b/arch/sh/include/asm/div64.h
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
new file mode 100644
index 000000000000..627315ecdb52
--- /dev/null
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -0,0 +1,193 @@
1#ifndef __ASM_SH_DMA_MAPPING_H
2#define __ASM_SH_DMA_MAPPING_H
3
4#include <linux/mm.h>
5#include <linux/scatterlist.h>
6#include <asm/cacheflush.h>
7#include <asm/io.h>
8#include <asm-generic/dma-coherent.h>
9
10extern struct bus_type pci_bus_type;
11
12#define dma_supported(dev, mask) (1)
13
14static inline int dma_set_mask(struct device *dev, u64 mask)
15{
16 if (!dev->dma_mask || !dma_supported(dev, mask))
17 return -EIO;
18
19 *dev->dma_mask = mask;
20
21 return 0;
22}
23
24void *dma_alloc_coherent(struct device *dev, size_t size,
25 dma_addr_t *dma_handle, gfp_t flag);
26
27void dma_free_coherent(struct device *dev, size_t size,
28 void *vaddr, dma_addr_t dma_handle);
29
30void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
31 enum dma_data_direction dir);
32
33#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
34#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
35#define dma_is_consistent(d, h) (1)
36
37static inline dma_addr_t dma_map_single(struct device *dev,
38 void *ptr, size_t size,
39 enum dma_data_direction dir)
40{
41#if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
42 if (dev->bus == &pci_bus_type)
43 return virt_to_phys(ptr);
44#endif
45 dma_cache_sync(dev, ptr, size, dir);
46
47 return virt_to_phys(ptr);
48}
49
50#define dma_unmap_single(dev, addr, size, dir) do { } while (0)
51
52static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
53 int nents, enum dma_data_direction dir)
54{
55 int i;
56
57 for (i = 0; i < nents; i++) {
58#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
59 dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
60#endif
61 sg[i].dma_address = sg_phys(&sg[i]);
62 }
63
64 return nents;
65}
66
67#define dma_unmap_sg(dev, sg, nents, dir) do { } while (0)
68
69static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
70 unsigned long offset, size_t size,
71 enum dma_data_direction dir)
72{
73 return dma_map_single(dev, page_address(page) + offset, size, dir);
74}
75
76static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
77 size_t size, enum dma_data_direction dir)
78{
79 dma_unmap_single(dev, dma_address, size, dir);
80}
81
82static inline void dma_sync_single(struct device *dev, dma_addr_t dma_handle,
83 size_t size, enum dma_data_direction dir)
84{
85#if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
86 if (dev->bus == &pci_bus_type)
87 return;
88#endif
89 dma_cache_sync(dev, phys_to_virt(dma_handle), size, dir);
90}
91
92static inline void dma_sync_single_range(struct device *dev,
93 dma_addr_t dma_handle,
94 unsigned long offset, size_t size,
95 enum dma_data_direction dir)
96{
97#if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
98 if (dev->bus == &pci_bus_type)
99 return;
100#endif
101 dma_cache_sync(dev, phys_to_virt(dma_handle) + offset, size, dir);
102}
103
104static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
105 int nelems, enum dma_data_direction dir)
106{
107 int i;
108
109 for (i = 0; i < nelems; i++) {
110#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
111 dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
112#endif
113 sg[i].dma_address = sg_phys(&sg[i]);
114 }
115}
116
117static inline void dma_sync_single_for_cpu(struct device *dev,
118 dma_addr_t dma_handle, size_t size,
119 enum dma_data_direction dir)
120{
121 dma_sync_single(dev, dma_handle, size, dir);
122}
123
124static inline void dma_sync_single_for_device(struct device *dev,
125 dma_addr_t dma_handle,
126 size_t size,
127 enum dma_data_direction dir)
128{
129 dma_sync_single(dev, dma_handle, size, dir);
130}
131
132static inline void dma_sync_single_range_for_cpu(struct device *dev,
133 dma_addr_t dma_handle,
134 unsigned long offset,
135 size_t size,
136 enum dma_data_direction direction)
137{
138 dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction);
139}
140
141static inline void dma_sync_single_range_for_device(struct device *dev,
142 dma_addr_t dma_handle,
143 unsigned long offset,
144 size_t size,
145 enum dma_data_direction direction)
146{
147 dma_sync_single_for_device(dev, dma_handle+offset, size, direction);
148}
149
150
151static inline void dma_sync_sg_for_cpu(struct device *dev,
152 struct scatterlist *sg, int nelems,
153 enum dma_data_direction dir)
154{
155 dma_sync_sg(dev, sg, nelems, dir);
156}
157
158static inline void dma_sync_sg_for_device(struct device *dev,
159 struct scatterlist *sg, int nelems,
160 enum dma_data_direction dir)
161{
162 dma_sync_sg(dev, sg, nelems, dir);
163}
164
165
166static inline int dma_get_cache_alignment(void)
167{
168 /*
169 * Each processor family will define its own L1_CACHE_SHIFT,
170 * L1_CACHE_BYTES wraps to this, so this is always safe.
171 */
172 return L1_CACHE_BYTES;
173}
174
175static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
176{
177 return dma_addr == 0;
178}
179
180#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
181
182extern int
183dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
184 dma_addr_t device_addr, size_t size, int flags);
185
186extern void
187dma_release_declared_memory(struct device *dev);
188
189extern void *
190dma_mark_declared_memory_occupied(struct device *dev,
191 dma_addr_t device_addr, size_t size);
192
193#endif /* __ASM_SH_DMA_MAPPING_H */
diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h
new file mode 100644
index 000000000000..beca7128e2ab
--- /dev/null
+++ b/arch/sh/include/asm/dma.h
@@ -0,0 +1,166 @@
1/*
2 * include/asm-sh/dma.h
3 *
4 * Copyright (C) 2003, 2004 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_SH_DMA_H
11#define __ASM_SH_DMA_H
12#ifdef __KERNEL__
13
14#include <linux/spinlock.h>
15#include <linux/wait.h>
16#include <linux/sched.h>
17#include <linux/sysdev.h>
18#include <cpu/dma.h>
19
20/* The maximum address that we can perform a DMA transfer to on this platform */
21/* Don't define MAX_DMA_ADDRESS; it's useless on the SuperH and any
22 occurrence should be flagged as an error. */
23/* But... */
24/* XXX: This is not applicable to SuperH, just needed for alloc_bootmem */
25#define MAX_DMA_ADDRESS (PAGE_OFFSET+0x10000000)
26
27#ifdef CONFIG_NR_DMA_CHANNELS
28# define MAX_DMA_CHANNELS (CONFIG_NR_DMA_CHANNELS)
29#else
30# define MAX_DMA_CHANNELS (CONFIG_NR_ONCHIP_DMA_CHANNELS)
31#endif
32
33/*
34 * Read and write modes can mean drastically different things depending on the
35 * channel configuration. Consult your DMAC documentation and module
36 * implementation for further clues.
37 */
38#define DMA_MODE_READ 0x00
39#define DMA_MODE_WRITE 0x01
40#define DMA_MODE_MASK 0x01
41
42#define DMA_AUTOINIT 0x10
43
44/*
45 * DMAC (dma_info) flags
46 */
47enum {
48 DMAC_CHANNELS_CONFIGURED = 0x01,
49 DMAC_CHANNELS_TEI_CAPABLE = 0x02, /* Transfer end interrupt */
50};
51
52/*
53 * DMA channel capabilities / flags
54 */
55enum {
56 DMA_CONFIGURED = 0x01,
57
58 /*
59 * Transfer end interrupt, inherited from DMAC.
60 * wait_queue used in dma_wait_for_completion.
61 */
62 DMA_TEI_CAPABLE = 0x02,
63};
64
65extern spinlock_t dma_spin_lock;
66
67struct dma_channel;
68
69struct dma_ops {
70 int (*request)(struct dma_channel *chan);
71 void (*free)(struct dma_channel *chan);
72
73 int (*get_residue)(struct dma_channel *chan);
74 int (*xfer)(struct dma_channel *chan);
75 int (*configure)(struct dma_channel *chan, unsigned long flags);
76 int (*extend)(struct dma_channel *chan, unsigned long op, void *param);
77};
78
79struct dma_channel {
80 char dev_id[16]; /* unique name per DMAC of channel */
81
82 unsigned int chan; /* DMAC channel number */
83 unsigned int vchan; /* Virtual channel number */
84
85 unsigned int mode;
86 unsigned int count;
87
88 unsigned long sar;
89 unsigned long dar;
90
91 const char **caps;
92
93 unsigned long flags;
94 atomic_t busy;
95
96 wait_queue_head_t wait_queue;
97
98 struct sys_device dev;
99 void *priv_data;
100};
101
102struct dma_info {
103 struct platform_device *pdev;
104
105 const char *name;
106 unsigned int nr_channels;
107 unsigned long flags;
108
109 struct dma_ops *ops;
110 struct dma_channel *channels;
111
112 struct list_head list;
113 int first_channel_nr;
114 int first_vchannel_nr;
115};
116
117struct dma_chan_caps {
118 int ch_num;
119 const char **caplist;
120};
121
122#define to_dma_channel(channel) container_of(channel, struct dma_channel, dev)
123
124/* arch/sh/drivers/dma/dma-api.c */
125extern int dma_xfer(unsigned int chan, unsigned long from,
126 unsigned long to, size_t size, unsigned int mode);
127
128#define dma_write(chan, from, to, size) \
129 dma_xfer(chan, from, to, size, DMA_MODE_WRITE)
130#define dma_write_page(chan, from, to) \
131 dma_write(chan, from, to, PAGE_SIZE)
132
133#define dma_read(chan, from, to, size) \
134 dma_xfer(chan, from, to, size, DMA_MODE_READ)
135#define dma_read_page(chan, from, to) \
136 dma_read(chan, from, to, PAGE_SIZE)
137
138extern int request_dma_bycap(const char **dmac, const char **caps,
139 const char *dev_id);
140extern int request_dma(unsigned int chan, const char *dev_id);
141extern void free_dma(unsigned int chan);
142extern int get_dma_residue(unsigned int chan);
143extern struct dma_info *get_dma_info(unsigned int chan);
144extern struct dma_channel *get_dma_channel(unsigned int chan);
145extern void dma_wait_for_completion(unsigned int chan);
146extern void dma_configure_channel(unsigned int chan, unsigned long flags);
147
148extern int register_dmac(struct dma_info *info);
149extern void unregister_dmac(struct dma_info *info);
150extern struct dma_info *get_dma_info_by_name(const char *dmac_name);
151
152extern int dma_extend(unsigned int chan, unsigned long op, void *param);
153extern int register_chan_caps(const char *dmac, struct dma_chan_caps *capslist);
154
155/* arch/sh/drivers/dma/dma-sysfs.c */
156extern int dma_create_sysfs_files(struct dma_channel *, struct dma_info *);
157extern void dma_remove_sysfs_files(struct dma_channel *, struct dma_info *);
158
159#ifdef CONFIG_PCI
160extern int isa_dma_bridge_buggy;
161#else
162#define isa_dma_bridge_buggy (0)
163#endif
164
165#endif /* __KERNEL__ */
166#endif /* __ASM_SH_DMA_H */
diff --git a/include/asm-sh/dmabrg.h b/arch/sh/include/asm/dmabrg.h
index c5edba216cf1..c5edba216cf1 100644
--- a/include/asm-sh/dmabrg.h
+++ b/arch/sh/include/asm/dmabrg.h
diff --git a/include/asm-sh/edosk7705.h b/arch/sh/include/asm/edosk7705.h
index 5bdc9d9be3de..5bdc9d9be3de 100644
--- a/include/asm-sh/edosk7705.h
+++ b/arch/sh/include/asm/edosk7705.h
diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
new file mode 100644
index 000000000000..f01449a8d378
--- /dev/null
+++ b/arch/sh/include/asm/elf.h
@@ -0,0 +1,244 @@
1#ifndef __ASM_SH_ELF_H
2#define __ASM_SH_ELF_H
3
4#include <linux/utsname.h>
5#include <asm/auxvec.h>
6#include <asm/ptrace.h>
7#include <asm/user.h>
8
9/* ELF header e_flags defines */
10#define EF_SH_PIC 0x100 /* -fpic */
11#define EF_SH_FDPIC 0x8000 /* -mfdpic */
12
13/* SH (particularly SHcompact) relocation types */
14#define R_SH_NONE 0
15#define R_SH_DIR32 1
16#define R_SH_REL32 2
17#define R_SH_DIR8WPN 3
18#define R_SH_IND12W 4
19#define R_SH_DIR8WPL 5
20#define R_SH_DIR8WPZ 6
21#define R_SH_DIR8BP 7
22#define R_SH_DIR8W 8
23#define R_SH_DIR8L 9
24#define R_SH_SWITCH16 25
25#define R_SH_SWITCH32 26
26#define R_SH_USES 27
27#define R_SH_COUNT 28
28#define R_SH_ALIGN 29
29#define R_SH_CODE 30
30#define R_SH_DATA 31
31#define R_SH_LABEL 32
32#define R_SH_SWITCH8 33
33#define R_SH_GNU_VTINHERIT 34
34#define R_SH_GNU_VTENTRY 35
35#define R_SH_TLS_GD_32 144
36#define R_SH_TLS_LD_32 145
37#define R_SH_TLS_LDO_32 146
38#define R_SH_TLS_IE_32 147
39#define R_SH_TLS_LE_32 148
40#define R_SH_TLS_DTPMOD32 149
41#define R_SH_TLS_DTPOFF32 150
42#define R_SH_TLS_TPOFF32 151
43#define R_SH_GOT32 160
44#define R_SH_PLT32 161
45#define R_SH_COPY 162
46#define R_SH_GLOB_DAT 163
47#define R_SH_JMP_SLOT 164
48#define R_SH_RELATIVE 165
49#define R_SH_GOTOFF 166
50#define R_SH_GOTPC 167
51
52/* FDPIC relocs */
53#define R_SH_GOT20 70
54#define R_SH_GOTOFF20 71
55#define R_SH_GOTFUNCDESC 72
56#define R_SH_GOTFUNCDESC20 73
57#define R_SH_GOTOFFFUNCDESC 74
58#define R_SH_GOTOFFFUNCDESC20 75
59#define R_SH_FUNCDESC 76
60#define R_SH_FUNCDESC_VALUE 77
61
62#if 0 /* XXX - later .. */
63#define R_SH_GOT20 198
64#define R_SH_GOTOFF20 199
65#define R_SH_GOTFUNCDESC 200
66#define R_SH_GOTFUNCDESC20 201
67#define R_SH_GOTOFFFUNCDESC 202
68#define R_SH_GOTOFFFUNCDESC20 203
69#define R_SH_FUNCDESC 204
70#define R_SH_FUNCDESC_VALUE 205
71#endif
72
73/* SHmedia relocs */
74#define R_SH_IMM_LOW16 246
75#define R_SH_IMM_LOW16_PCREL 247
76#define R_SH_IMM_MEDLOW16 248
77#define R_SH_IMM_MEDLOW16_PCREL 249
78/* Keep this the last entry. */
79#define R_SH_NUM 256
80
81/*
82 * ELF register definitions..
83 */
84
85typedef unsigned long elf_greg_t;
86
87#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
88typedef elf_greg_t elf_gregset_t[ELF_NGREG];
89
90typedef struct user_fpu_struct elf_fpregset_t;
91
92/*
93 * These are used to set parameters in the core dumps.
94 */
95#define ELF_CLASS ELFCLASS32
96#ifdef __LITTLE_ENDIAN__
97#define ELF_DATA ELFDATA2LSB
98#else
99#define ELF_DATA ELFDATA2MSB
100#endif
101#define ELF_ARCH EM_SH
102
103#ifdef __KERNEL__
104/*
105 * This is used to ensure we don't load something for the wrong architecture.
106 */
107#define elf_check_arch(x) ((x)->e_machine == EM_SH)
108#define elf_check_fdpic(x) ((x)->e_flags & EF_SH_FDPIC)
109#define elf_check_const_displacement(x) ((x)->e_flags & EF_SH_PIC)
110
111#define USE_ELF_CORE_DUMP
112#define ELF_FDPIC_CORE_EFLAGS EF_SH_FDPIC
113#define ELF_EXEC_PAGESIZE PAGE_SIZE
114
115/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
116 use of this is to invoke "./ld.so someprog" to test out a new version of
117 the loader. We need to make sure that it is out of the way of the program
118 that it will "exec", and that there is sufficient room for the brk. */
119
120#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
121
122#define ELF_CORE_COPY_REGS(_dest,_regs) \
123 memcpy((char *) &_dest, (char *) _regs, \
124 sizeof(struct pt_regs));
125
126/* This yields a mask that user programs can use to figure out what
127 instruction set this CPU supports. This could be done in user space,
128 but it's not easy, and we've already done it here. */
129
130#define ELF_HWCAP (boot_cpu_data.flags)
131
132/* This yields a string that ld.so will use to load implementation
133 specific libraries for optimization. This is more specific in
134 intent than poking at uname or /proc/cpuinfo.
135
136 For the moment, we have only optimizations for the Intel generations,
137 but that could change... */
138
139#define ELF_PLATFORM (utsname()->machine)
140
141#ifdef __SH5__
142#define ELF_PLAT_INIT(_r, load_addr) \
143 do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0; \
144 _r->regs[4]=0; _r->regs[5]=0; _r->regs[6]=0; _r->regs[7]=0; \
145 _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \
146 _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; _r->regs[15]=0; \
147 _r->regs[16]=0; _r->regs[17]=0; _r->regs[18]=0; _r->regs[19]=0; \
148 _r->regs[20]=0; _r->regs[21]=0; _r->regs[22]=0; _r->regs[23]=0; \
149 _r->regs[24]=0; _r->regs[25]=0; _r->regs[26]=0; _r->regs[27]=0; \
150 _r->regs[28]=0; _r->regs[29]=0; _r->regs[30]=0; _r->regs[31]=0; \
151 _r->regs[32]=0; _r->regs[33]=0; _r->regs[34]=0; _r->regs[35]=0; \
152 _r->regs[36]=0; _r->regs[37]=0; _r->regs[38]=0; _r->regs[39]=0; \
153 _r->regs[40]=0; _r->regs[41]=0; _r->regs[42]=0; _r->regs[43]=0; \
154 _r->regs[44]=0; _r->regs[45]=0; _r->regs[46]=0; _r->regs[47]=0; \
155 _r->regs[48]=0; _r->regs[49]=0; _r->regs[50]=0; _r->regs[51]=0; \
156 _r->regs[52]=0; _r->regs[53]=0; _r->regs[54]=0; _r->regs[55]=0; \
157 _r->regs[56]=0; _r->regs[57]=0; _r->regs[58]=0; _r->regs[59]=0; \
158 _r->regs[60]=0; _r->regs[61]=0; _r->regs[62]=0; \
159 _r->tregs[0]=0; _r->tregs[1]=0; _r->tregs[2]=0; _r->tregs[3]=0; \
160 _r->tregs[4]=0; _r->tregs[5]=0; _r->tregs[6]=0; _r->tregs[7]=0; \
161 _r->sr = SR_FD | SR_MMU; } while (0)
162#else
163#define ELF_PLAT_INIT(_r, load_addr) \
164 do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0; \
165 _r->regs[4]=0; _r->regs[5]=0; _r->regs[6]=0; _r->regs[7]=0; \
166 _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \
167 _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; \
168 _r->sr = SR_FD; } while (0)
169
170#define ELF_FDPIC_PLAT_INIT(_r, _exec_map_addr, _interp_map_addr, \
171 _dynamic_addr) \
172do { \
173 _r->regs[0] = 0; \
174 _r->regs[1] = 0; \
175 _r->regs[2] = 0; \
176 _r->regs[3] = 0; \
177 _r->regs[4] = 0; \
178 _r->regs[5] = 0; \
179 _r->regs[6] = 0; \
180 _r->regs[7] = 0; \
181 _r->regs[8] = _exec_map_addr; \
182 _r->regs[9] = _interp_map_addr; \
183 _r->regs[10] = _dynamic_addr; \
184 _r->regs[11] = 0; \
185 _r->regs[12] = 0; \
186 _r->regs[13] = 0; \
187 _r->regs[14] = 0; \
188 _r->sr = SR_FD; \
189} while (0)
190#endif
191
192#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
193struct task_struct;
194extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
195extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
196
197#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
198#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
199
200#ifdef CONFIG_VSYSCALL
201/* vDSO has arch_setup_additional_pages */
202#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
203struct linux_binprm;
204extern int arch_setup_additional_pages(struct linux_binprm *bprm,
205 int executable_stack);
206
207extern unsigned int vdso_enabled;
208extern void __kernel_vsyscall;
209
210#define VDSO_BASE ((unsigned long)current->mm->context.vdso)
211#define VDSO_SYM(x) (VDSO_BASE + (unsigned long)(x))
212
213#define VSYSCALL_AUX_ENT \
214 if (vdso_enabled) \
215 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE);
216#else
217#define VSYSCALL_AUX_ENT
218#endif /* CONFIG_VSYSCALL */
219
220#ifdef CONFIG_SH_FPU
221#define FPU_AUX_ENT NEW_AUX_ENT(AT_FPUCW, FPSCR_INIT)
222#else
223#define FPU_AUX_ENT
224#endif
225
226extern int l1i_cache_shape, l1d_cache_shape, l2_cache_shape;
227
228/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
229#define ARCH_DLINFO \
230do { \
231 /* Optional FPU initialization */ \
232 FPU_AUX_ENT; \
233 \
234 /* Optional vsyscall entry */ \
235 VSYSCALL_AUX_ENT; \
236 \
237 /* Cache desc */ \
238 NEW_AUX_ENT(AT_L1I_CACHESHAPE, l1i_cache_shape); \
239 NEW_AUX_ENT(AT_L1D_CACHESHAPE, l1d_cache_shape); \
240 NEW_AUX_ENT(AT_L2_CACHESHAPE, l2_cache_shape); \
241} while (0)
242
243#endif /* __KERNEL__ */
244#endif /* __ASM_SH_ELF_H */
diff --git a/include/asm-sh/emergency-restart.h b/arch/sh/include/asm/emergency-restart.h
index 108d8c48e42e..108d8c48e42e 100644
--- a/include/asm-sh/emergency-restart.h
+++ b/arch/sh/include/asm/emergency-restart.h
diff --git a/include/asm-sh/entry-macros.S b/arch/sh/include/asm/entry-macros.S
index 2dab0b8d9454..2dab0b8d9454 100644
--- a/include/asm-sh/entry-macros.S
+++ b/arch/sh/include/asm/entry-macros.S
diff --git a/include/asm-sh/errno.h b/arch/sh/include/asm/errno.h
index 51cf6f9cebb8..51cf6f9cebb8 100644
--- a/include/asm-sh/errno.h
+++ b/arch/sh/include/asm/errno.h
diff --git a/include/asm-sh/fb.h b/arch/sh/include/asm/fb.h
index d92e99cd8c8a..d92e99cd8c8a 100644
--- a/include/asm-sh/fb.h
+++ b/arch/sh/include/asm/fb.h
diff --git a/include/asm-sh/fcntl.h b/arch/sh/include/asm/fcntl.h
index 46ab12db5739..46ab12db5739 100644
--- a/include/asm-sh/fcntl.h
+++ b/arch/sh/include/asm/fcntl.h
diff --git a/include/asm-sh/fixmap.h b/arch/sh/include/asm/fixmap.h
index 721fcc4d5e98..721fcc4d5e98 100644
--- a/include/asm-sh/fixmap.h
+++ b/arch/sh/include/asm/fixmap.h
diff --git a/include/asm-sh/flat.h b/arch/sh/include/asm/flat.h
index 0cc800299e06..0cc800299e06 100644
--- a/include/asm-sh/flat.h
+++ b/arch/sh/include/asm/flat.h
diff --git a/include/asm-sh/fpu.h b/arch/sh/include/asm/fpu.h
index 91462fea1507..91462fea1507 100644
--- a/include/asm-sh/fpu.h
+++ b/arch/sh/include/asm/fpu.h
diff --git a/arch/sh/include/asm/freq.h b/arch/sh/include/asm/freq.h
new file mode 100644
index 000000000000..4ece90b09b9c
--- /dev/null
+++ b/arch/sh/include/asm/freq.h
@@ -0,0 +1,18 @@
1/*
2 * include/asm-sh/freq.h
3 *
4 * Copyright (C) 2002, 2003 Paul Mundt
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11#ifndef __ASM_SH_FREQ_H
12#define __ASM_SH_FREQ_H
13#ifdef __KERNEL__
14
15#include <cpu/freq.h>
16
17#endif /* __KERNEL__ */
18#endif /* __ASM_SH_FREQ_H */
diff --git a/include/asm-sh/futex-irq.h b/arch/sh/include/asm/futex-irq.h
index a9f16a7f9aea..a9f16a7f9aea 100644
--- a/include/asm-sh/futex-irq.h
+++ b/arch/sh/include/asm/futex-irq.h
diff --git a/include/asm-sh/futex.h b/arch/sh/include/asm/futex.h
index 68256ec5fa35..68256ec5fa35 100644
--- a/include/asm-sh/futex.h
+++ b/arch/sh/include/asm/futex.h
diff --git a/arch/sh/include/asm/gpio.h b/arch/sh/include/asm/gpio.h
new file mode 100644
index 000000000000..cf32bd2df881
--- /dev/null
+++ b/arch/sh/include/asm/gpio.h
@@ -0,0 +1,19 @@
1/*
2 * include/asm-sh/gpio.h
3 *
4 * Copyright (C) 2007 Markus Brunner, Mark Jonas
5 *
6 * Addresses for the Pin Function Controller
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#ifndef __ASM_SH_GPIO_H
13#define __ASM_SH_GPIO_H
14
15#if defined(CONFIG_CPU_SH3)
16#include <cpu/gpio.h>
17#endif
18
19#endif /* __ASM_SH_GPIO_H */
diff --git a/include/asm-sh/hardirq.h b/arch/sh/include/asm/hardirq.h
index 715ee237fc77..715ee237fc77 100644
--- a/include/asm-sh/hardirq.h
+++ b/arch/sh/include/asm/hardirq.h
diff --git a/include/asm-sh/hd64461.h b/arch/sh/include/asm/hd64461.h
index 8c1353baf00f..8c1353baf00f 100644
--- a/include/asm-sh/hd64461.h
+++ b/arch/sh/include/asm/hd64461.h
diff --git a/include/asm-sh/hd64465/gpio.h b/arch/sh/include/asm/hd64465/gpio.h
index a3cdca2713dd..a3cdca2713dd 100644
--- a/include/asm-sh/hd64465/gpio.h
+++ b/arch/sh/include/asm/hd64465/gpio.h
diff --git a/include/asm-sh/hd64465/hd64465.h b/arch/sh/include/asm/hd64465/hd64465.h
index cfd0e803d2a2..cfd0e803d2a2 100644
--- a/include/asm-sh/hd64465/hd64465.h
+++ b/arch/sh/include/asm/hd64465/hd64465.h
diff --git a/include/asm-sh/hd64465/io.h b/arch/sh/include/asm/hd64465/io.h
index 139f1472e5bb..139f1472e5bb 100644
--- a/include/asm-sh/hd64465/io.h
+++ b/arch/sh/include/asm/hd64465/io.h
diff --git a/include/asm-sh/heartbeat.h b/arch/sh/include/asm/heartbeat.h
index 724a43ed245e..724a43ed245e 100644
--- a/include/asm-sh/heartbeat.h
+++ b/arch/sh/include/asm/heartbeat.h
diff --git a/include/asm-sh/hp6xx.h b/arch/sh/include/asm/hp6xx.h
index 0d4165a32dcd..0d4165a32dcd 100644
--- a/include/asm-sh/hp6xx.h
+++ b/arch/sh/include/asm/hp6xx.h
diff --git a/include/asm-sh/hugetlb.h b/arch/sh/include/asm/hugetlb.h
index 967068fb79ac..967068fb79ac 100644
--- a/include/asm-sh/hugetlb.h
+++ b/arch/sh/include/asm/hugetlb.h
diff --git a/arch/sh/include/asm/hw_irq.h b/arch/sh/include/asm/hw_irq.h
new file mode 100644
index 000000000000..d557b00111bf
--- /dev/null
+++ b/arch/sh/include/asm/hw_irq.h
@@ -0,0 +1,123 @@
1#ifndef __ASM_SH_HW_IRQ_H
2#define __ASM_SH_HW_IRQ_H
3
4#include <linux/init.h>
5#include <asm/atomic.h>
6
7extern atomic_t irq_err_count;
8
9struct ipr_data {
10 unsigned char irq;
11 unsigned char ipr_idx; /* Index for the IPR registered */
12 unsigned char shift; /* Number of bits to shift the data */
13 unsigned char priority; /* The priority */
14};
15
16struct ipr_desc {
17 unsigned long *ipr_offsets;
18 unsigned int nr_offsets;
19 struct ipr_data *ipr_data;
20 unsigned int nr_irqs;
21 struct irq_chip chip;
22};
23
24void register_ipr_controller(struct ipr_desc *);
25
26typedef unsigned char intc_enum;
27
28struct intc_vect {
29 intc_enum enum_id;
30 unsigned short vect;
31};
32
33#define INTC_VECT(enum_id, vect) { enum_id, vect }
34#define INTC_IRQ(enum_id, irq) INTC_VECT(enum_id, irq2evt(irq))
35
36struct intc_group {
37 intc_enum enum_id;
38 intc_enum enum_ids[32];
39};
40
41#define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
42
43struct intc_mask_reg {
44 unsigned long set_reg, clr_reg, reg_width;
45 intc_enum enum_ids[32];
46#ifdef CONFIG_SMP
47 unsigned long smp;
48#endif
49};
50
51struct intc_prio_reg {
52 unsigned long set_reg, clr_reg, reg_width, field_width;
53 intc_enum enum_ids[16];
54#ifdef CONFIG_SMP
55 unsigned long smp;
56#endif
57};
58
59struct intc_sense_reg {
60 unsigned long reg, reg_width, field_width;
61 intc_enum enum_ids[16];
62};
63
64#ifdef CONFIG_SMP
65#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
66#else
67#define INTC_SMP(stride, nr)
68#endif
69
70struct intc_desc {
71 struct intc_vect *vectors;
72 unsigned int nr_vectors;
73 struct intc_group *groups;
74 unsigned int nr_groups;
75 struct intc_mask_reg *mask_regs;
76 unsigned int nr_mask_regs;
77 struct intc_prio_reg *prio_regs;
78 unsigned int nr_prio_regs;
79 struct intc_sense_reg *sense_regs;
80 unsigned int nr_sense_regs;
81 char *name;
82#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
83 struct intc_mask_reg *ack_regs;
84 unsigned int nr_ack_regs;
85#endif
86};
87
88#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
89#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
90 mask_regs, prio_regs, sense_regs) \
91struct intc_desc symbol __initdata = { \
92 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
93 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
94 _INTC_ARRAY(sense_regs), \
95 chipname, \
96}
97
98#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
99#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \
100 mask_regs, prio_regs, sense_regs, ack_regs) \
101struct intc_desc symbol __initdata = { \
102 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
103 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
104 _INTC_ARRAY(sense_regs), \
105 chipname, \
106 _INTC_ARRAY(ack_regs), \
107}
108#endif
109
110void __init register_intc_controller(struct intc_desc *desc);
111int intc_set_priority(unsigned int irq, unsigned int prio);
112
113void __init plat_irq_setup(void);
114#ifdef CONFIG_CPU_SH3
115void __init plat_irq_setup_sh3(void);
116#endif
117
118enum { IRQ_MODE_IRQ, IRQ_MODE_IRQ7654, IRQ_MODE_IRQ3210,
119 IRQ_MODE_IRL7654_MASK, IRQ_MODE_IRL3210_MASK,
120 IRQ_MODE_IRL7654, IRQ_MODE_IRL3210 };
121void __init plat_irq_setup_pins(int mode);
122
123#endif /* __ASM_SH_HW_IRQ_H */
diff --git a/include/asm-sh/i2c-sh7760.h b/arch/sh/include/asm/i2c-sh7760.h
index 24182116711f..24182116711f 100644
--- a/include/asm-sh/i2c-sh7760.h
+++ b/arch/sh/include/asm/i2c-sh7760.h
diff --git a/include/asm-sh/ilsel.h b/arch/sh/include/asm/ilsel.h
index e3d304b280f6..e3d304b280f6 100644
--- a/include/asm-sh/ilsel.h
+++ b/arch/sh/include/asm/ilsel.h
diff --git a/include/asm-sh/io.h b/arch/sh/include/asm/io.h
index a4fbf0c84fb1..a4fbf0c84fb1 100644
--- a/include/asm-sh/io.h
+++ b/arch/sh/include/asm/io.h
diff --git a/include/asm-sh/io_generic.h b/arch/sh/include/asm/io_generic.h
index 92fc6070d7b3..92fc6070d7b3 100644
--- a/include/asm-sh/io_generic.h
+++ b/arch/sh/include/asm/io_generic.h
diff --git a/include/asm-sh/io_trapped.h b/arch/sh/include/asm/io_trapped.h
index f1251d4f0ba9..f1251d4f0ba9 100644
--- a/include/asm-sh/io_trapped.h
+++ b/arch/sh/include/asm/io_trapped.h
diff --git a/include/asm-sh/ioctl.h b/arch/sh/include/asm/ioctl.h
index b279fe06dfe5..b279fe06dfe5 100644
--- a/include/asm-sh/ioctl.h
+++ b/arch/sh/include/asm/ioctl.h
diff --git a/include/asm-sh/ioctls.h b/arch/sh/include/asm/ioctls.h
index c212c371a4a5..c212c371a4a5 100644
--- a/include/asm-sh/ioctls.h
+++ b/arch/sh/include/asm/ioctls.h
diff --git a/include/asm-sh/ipcbuf.h b/arch/sh/include/asm/ipcbuf.h
index 5ffc9972a7ea..5ffc9972a7ea 100644
--- a/include/asm-sh/ipcbuf.h
+++ b/arch/sh/include/asm/ipcbuf.h
diff --git a/arch/sh/include/asm/irq.h b/arch/sh/include/asm/irq.h
new file mode 100644
index 000000000000..6195a531c1b0
--- /dev/null
+++ b/arch/sh/include/asm/irq.h
@@ -0,0 +1,57 @@
1#ifndef __ASM_SH_IRQ_H
2#define __ASM_SH_IRQ_H
3
4#include <asm/machvec.h>
5
6/*
7 * A sane default based on a reasonable vector table size, platforms are
8 * advised to cap this at the hard limit that they're interested in
9 * through the machvec.
10 */
11#define NR_IRQS 256
12
13/*
14 * Convert back and forth between INTEVT and IRQ values.
15 */
16#ifdef CONFIG_CPU_HAS_INTEVT
17#define evt2irq(evt) (((evt) >> 5) - 16)
18#define irq2evt(irq) (((irq) + 16) << 5)
19#else
20#define evt2irq(evt) (evt)
21#define irq2evt(irq) (irq)
22#endif
23
24/*
25 * Simple Mask Register Support
26 */
27extern void make_maskreg_irq(unsigned int irq);
28extern unsigned short *irq_mask_register;
29
30/*
31 * PINT IRQs
32 */
33void init_IRQ_pint(void);
34void make_imask_irq(unsigned int irq);
35
36static inline int generic_irq_demux(int irq)
37{
38 return irq;
39}
40
41#define irq_canonicalize(irq) (irq)
42#define irq_demux(irq) sh_mv.mv_irq_demux(irq)
43
44#ifdef CONFIG_IRQSTACKS
45extern void irq_ctx_init(int cpu);
46extern void irq_ctx_exit(int cpu);
47# define __ARCH_HAS_DO_SOFTIRQ
48#else
49# define irq_ctx_init(cpu) do { } while (0)
50# define irq_ctx_exit(cpu) do { } while (0)
51#endif
52
53#ifdef CONFIG_CPU_SH5
54#include <cpu/irq.h>
55#endif
56
57#endif /* __ASM_SH_IRQ_H */
diff --git a/include/asm-sh/irq_regs.h b/arch/sh/include/asm/irq_regs.h
index 3dd9c0b70270..3dd9c0b70270 100644
--- a/include/asm-sh/irq_regs.h
+++ b/arch/sh/include/asm/irq_regs.h
diff --git a/include/asm-sh/irqflags.h b/arch/sh/include/asm/irqflags.h
index 46e71da5be6b..46e71da5be6b 100644
--- a/include/asm-sh/irqflags.h
+++ b/arch/sh/include/asm/irqflags.h
diff --git a/include/asm-sh/irqflags_32.h b/arch/sh/include/asm/irqflags_32.h
index 60218f541340..60218f541340 100644
--- a/include/asm-sh/irqflags_32.h
+++ b/arch/sh/include/asm/irqflags_32.h
diff --git a/arch/sh/include/asm/irqflags_64.h b/arch/sh/include/asm/irqflags_64.h
new file mode 100644
index 000000000000..88f65222c1d4
--- /dev/null
+++ b/arch/sh/include/asm/irqflags_64.h
@@ -0,0 +1,85 @@
1#ifndef __ASM_SH_IRQFLAGS_64_H
2#define __ASM_SH_IRQFLAGS_64_H
3
4#include <cpu/registers.h>
5
6#define SR_MASK_LL 0x00000000000000f0LL
7#define SR_BL_LL 0x0000000010000000LL
8
9static inline void raw_local_irq_enable(void)
10{
11 unsigned long long __dummy0, __dummy1 = ~SR_MASK_LL;
12
13 __asm__ __volatile__("getcon " __SR ", %0\n\t"
14 "and %0, %1, %0\n\t"
15 "putcon %0, " __SR "\n\t"
16 : "=&r" (__dummy0)
17 : "r" (__dummy1));
18}
19
20static inline void raw_local_irq_disable(void)
21{
22 unsigned long long __dummy0, __dummy1 = SR_MASK_LL;
23
24 __asm__ __volatile__("getcon " __SR ", %0\n\t"
25 "or %0, %1, %0\n\t"
26 "putcon %0, " __SR "\n\t"
27 : "=&r" (__dummy0)
28 : "r" (__dummy1));
29}
30
31static inline void set_bl_bit(void)
32{
33 unsigned long long __dummy0, __dummy1 = SR_BL_LL;
34
35 __asm__ __volatile__("getcon " __SR ", %0\n\t"
36 "or %0, %1, %0\n\t"
37 "putcon %0, " __SR "\n\t"
38 : "=&r" (__dummy0)
39 : "r" (__dummy1));
40
41}
42
43static inline void clear_bl_bit(void)
44{
45 unsigned long long __dummy0, __dummy1 = ~SR_BL_LL;
46
47 __asm__ __volatile__("getcon " __SR ", %0\n\t"
48 "and %0, %1, %0\n\t"
49 "putcon %0, " __SR "\n\t"
50 : "=&r" (__dummy0)
51 : "r" (__dummy1));
52}
53
54static inline unsigned long __raw_local_save_flags(void)
55{
56 unsigned long long __dummy = SR_MASK_LL;
57 unsigned long flags;
58
59 __asm__ __volatile__ (
60 "getcon " __SR ", %0\n\t"
61 "and %0, %1, %0"
62 : "=&r" (flags)
63 : "r" (__dummy));
64
65 return flags;
66}
67
68static inline unsigned long __raw_local_irq_save(void)
69{
70 unsigned long long __dummy0, __dummy1 = SR_MASK_LL;
71 unsigned long flags;
72
73 __asm__ __volatile__ (
74 "getcon " __SR ", %1\n\t"
75 "or %1, r63, %0\n\t"
76 "or %1, %2, %1\n\t"
77 "putcon %1, " __SR "\n\t"
78 "and %0, %2, %0"
79 : "=&r" (flags), "=&r" (__dummy0)
80 : "r" (__dummy1));
81
82 return flags;
83}
84
85#endif /* __ASM_SH_IRQFLAGS_64_H */
diff --git a/include/asm-sh/kdebug.h b/arch/sh/include/asm/kdebug.h
index 49cd69051a88..49cd69051a88 100644
--- a/include/asm-sh/kdebug.h
+++ b/arch/sh/include/asm/kdebug.h
diff --git a/include/asm-sh/kexec.h b/arch/sh/include/asm/kexec.h
index 00f4260ef09b..00f4260ef09b 100644
--- a/include/asm-sh/kexec.h
+++ b/arch/sh/include/asm/kexec.h
diff --git a/include/asm-sh/kgdb.h b/arch/sh/include/asm/kgdb.h
index 24e42078f36f..24e42078f36f 100644
--- a/include/asm-sh/kgdb.h
+++ b/arch/sh/include/asm/kgdb.h
diff --git a/include/asm-sh/kmap_types.h b/arch/sh/include/asm/kmap_types.h
index 84d565c696be..84d565c696be 100644
--- a/include/asm-sh/kmap_types.h
+++ b/arch/sh/include/asm/kmap_types.h
diff --git a/include/asm-sh/lboxre2.h b/arch/sh/include/asm/lboxre2.h
index e6d160504923..e6d160504923 100644
--- a/include/asm-sh/lboxre2.h
+++ b/arch/sh/include/asm/lboxre2.h
diff --git a/include/asm-sh/linkage.h b/arch/sh/include/asm/linkage.h
index 3565a4f4009f..3565a4f4009f 100644
--- a/include/asm-sh/linkage.h
+++ b/arch/sh/include/asm/linkage.h
diff --git a/include/asm-sh/local.h b/arch/sh/include/asm/local.h
index 9ed9b9cb459a..9ed9b9cb459a 100644
--- a/include/asm-sh/local.h
+++ b/arch/sh/include/asm/local.h
diff --git a/include/asm-sh/machvec.h b/arch/sh/include/asm/machvec.h
index b2e4124070ae..b2e4124070ae 100644
--- a/include/asm-sh/machvec.h
+++ b/arch/sh/include/asm/machvec.h
diff --git a/include/asm-sh/magicpanelr2.h b/arch/sh/include/asm/magicpanelr2.h
index c644a77ee357..c644a77ee357 100644
--- a/include/asm-sh/magicpanelr2.h
+++ b/arch/sh/include/asm/magicpanelr2.h
diff --git a/include/asm-sh/mc146818rtc.h b/arch/sh/include/asm/mc146818rtc.h
index 0aee96a97330..0aee96a97330 100644
--- a/include/asm-sh/mc146818rtc.h
+++ b/arch/sh/include/asm/mc146818rtc.h
diff --git a/include/asm-sh/microdev.h b/arch/sh/include/asm/microdev.h
index 1aed15856e11..1aed15856e11 100644
--- a/include/asm-sh/microdev.h
+++ b/arch/sh/include/asm/microdev.h
diff --git a/arch/sh/include/asm/migor.h b/arch/sh/include/asm/migor.h
new file mode 100644
index 000000000000..10016e0f4a4e
--- /dev/null
+++ b/arch/sh/include/asm/migor.h
@@ -0,0 +1,65 @@
1#ifndef __ASM_SH_MIGOR_H
2#define __ASM_SH_MIGOR_H
3
4/*
5 * linux/include/asm-sh/migor.h
6 *
7 * Copyright (C) 2008 Renesas Solutions
8 *
9 * Portions Copyright (C) 2007 Nobuhiro Iwamatsu
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 *
15 */
16#include <asm/addrspace.h>
17
18/* GPIO */
19#define PORT_PACR 0xa4050100
20#define PORT_PDCR 0xa4050106
21#define PORT_PECR 0xa4050108
22#define PORT_PHCR 0xa405010e
23#define PORT_PJCR 0xa4050110
24#define PORT_PKCR 0xa4050112
25#define PORT_PLCR 0xa4050114
26#define PORT_PMCR 0xa4050116
27#define PORT_PRCR 0xa405011c
28#define PORT_PTCR 0xa4050140
29#define PORT_PUCR 0xa4050142
30#define PORT_PVCR 0xa4050144
31#define PORT_PWCR 0xa4050146
32#define PORT_PXCR 0xa4050148
33#define PORT_PYCR 0xa405014a
34#define PORT_PZCR 0xa405014c
35#define PORT_PADR 0xa4050120
36#define PORT_PHDR 0xa405012e
37#define PORT_PTDR 0xa4050160
38#define PORT_PWDR 0xa4050166
39
40#define PORT_HIZCRA 0xa4050158
41#define PORT_HIZCRC 0xa405015c
42
43#define PORT_MSELCRB 0xa4050182
44
45#define MSTPCR1 0xa4150034
46#define MSTPCR2 0xa4150038
47
48#define PORT_PSELA 0xa405014e
49#define PORT_PSELB 0xa4050150
50#define PORT_PSELC 0xa4050152
51#define PORT_PSELD 0xa4050154
52#define PORT_PSELE 0xa4050156
53
54#define PORT_HIZCRA 0xa4050158
55#define PORT_HIZCRB 0xa405015a
56#define PORT_HIZCRC 0xa405015c
57
58#define BSC_CS6ABCR 0xfec1001c
59
60#include <asm/sh_mobile_lcdc.h>
61
62int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle,
63 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
64
65#endif /* __ASM_SH_MIGOR_H */
diff --git a/include/asm-sh/mman.h b/arch/sh/include/asm/mman.h
index 156eb0225cf6..156eb0225cf6 100644
--- a/include/asm-sh/mman.h
+++ b/arch/sh/include/asm/mman.h
diff --git a/arch/sh/include/asm/mmu.h b/arch/sh/include/asm/mmu.h
new file mode 100644
index 000000000000..fdcb93bc6d11
--- /dev/null
+++ b/arch/sh/include/asm/mmu.h
@@ -0,0 +1,76 @@
1#ifndef __MMU_H
2#define __MMU_H
3
4/* Default "unsigned long" context */
5typedef unsigned long mm_context_id_t[NR_CPUS];
6
7typedef struct {
8#ifdef CONFIG_MMU
9 mm_context_id_t id;
10 void *vdso;
11#else
12 struct vm_list_struct *vmlist;
13 unsigned long end_brk;
14#endif
15#ifdef CONFIG_BINFMT_ELF_FDPIC
16 unsigned long exec_fdpic_loadmap;
17 unsigned long interp_fdpic_loadmap;
18#endif
19} mm_context_t;
20
21/*
22 * Privileged Space Mapping Buffer (PMB) definitions
23 */
24#define PMB_PASCR 0xff000070
25#define PMB_IRMCR 0xff000078
26
27#define PMB_ADDR 0xf6100000
28#define PMB_DATA 0xf7100000
29#define PMB_ENTRY_MAX 16
30#define PMB_E_MASK 0x0000000f
31#define PMB_E_SHIFT 8
32
33#define PMB_SZ_16M 0x00000000
34#define PMB_SZ_64M 0x00000010
35#define PMB_SZ_128M 0x00000080
36#define PMB_SZ_512M 0x00000090
37#define PMB_SZ_MASK PMB_SZ_512M
38#define PMB_C 0x00000008
39#define PMB_WT 0x00000001
40#define PMB_UB 0x00000200
41#define PMB_V 0x00000100
42
43#define PMB_NO_ENTRY (-1)
44
45struct pmb_entry;
46
47struct pmb_entry {
48 unsigned long vpn;
49 unsigned long ppn;
50 unsigned long flags;
51
52 /*
53 * 0 .. NR_PMB_ENTRIES for specific entry selection, or
54 * PMB_NO_ENTRY to search for a free one
55 */
56 int entry;
57
58 struct pmb_entry *next;
59 /* Adjacent entry link for contiguous multi-entry mappings */
60 struct pmb_entry *link;
61};
62
63/* arch/sh/mm/pmb.c */
64int __set_pmb_entry(unsigned long vpn, unsigned long ppn,
65 unsigned long flags, int *entry);
66int set_pmb_entry(struct pmb_entry *pmbe);
67void clear_pmb_entry(struct pmb_entry *pmbe);
68struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
69 unsigned long flags);
70void pmb_free(struct pmb_entry *pmbe);
71long pmb_remap(unsigned long virt, unsigned long phys,
72 unsigned long size, unsigned long flags);
73void pmb_unmap(unsigned long addr);
74
75#endif /* __MMU_H */
76
diff --git a/arch/sh/include/asm/mmu_context.h b/arch/sh/include/asm/mmu_context.h
new file mode 100644
index 000000000000..04c0c9733ad6
--- /dev/null
+++ b/arch/sh/include/asm/mmu_context.h
@@ -0,0 +1,185 @@
1/*
2 * Copyright (C) 1999 Niibe Yutaka
3 * Copyright (C) 2003 - 2007 Paul Mundt
4 *
5 * ASID handling idea taken from MIPS implementation.
6 */
7#ifndef __ASM_SH_MMU_CONTEXT_H
8#define __ASM_SH_MMU_CONTEXT_H
9
10#ifdef __KERNEL__
11#include <cpu/mmu_context.h>
12#include <asm/tlbflush.h>
13#include <asm/uaccess.h>
14#include <asm/io.h>
15#include <asm-generic/mm_hooks.h>
16
17/*
18 * The MMU "context" consists of two things:
19 * (a) TLB cache version (or round, cycle whatever expression you like)
20 * (b) ASID (Address Space IDentifier)
21 */
22#define MMU_CONTEXT_ASID_MASK 0x000000ff
23#define MMU_CONTEXT_VERSION_MASK 0xffffff00
24#define MMU_CONTEXT_FIRST_VERSION 0x00000100
25#define NO_CONTEXT 0
26
27/* ASID is 8-bit value, so it can't be 0x100 */
28#define MMU_NO_ASID 0x100
29
30#define asid_cache(cpu) (cpu_data[cpu].asid_cache)
31
32#ifdef CONFIG_MMU
33#define cpu_context(cpu, mm) ((mm)->context.id[cpu])
34
35#define cpu_asid(cpu, mm) \
36 (cpu_context((cpu), (mm)) & MMU_CONTEXT_ASID_MASK)
37
38/*
39 * Virtual Page Number mask
40 */
41#define MMU_VPN_MASK 0xfffff000
42
43#if defined(CONFIG_SUPERH32)
44#include "mmu_context_32.h"
45#else
46#include "mmu_context_64.h"
47#endif
48
49/*
50 * Get MMU context if needed.
51 */
52static inline void get_mmu_context(struct mm_struct *mm, unsigned int cpu)
53{
54 unsigned long asid = asid_cache(cpu);
55
56 /* Check if we have old version of context. */
57 if (((cpu_context(cpu, mm) ^ asid) & MMU_CONTEXT_VERSION_MASK) == 0)
58 /* It's up to date, do nothing */
59 return;
60
61 /* It's old, we need to get new context with new version. */
62 if (!(++asid & MMU_CONTEXT_ASID_MASK)) {
63 /*
64 * We exhaust ASID of this version.
65 * Flush all TLB and start new cycle.
66 */
67 flush_tlb_all();
68
69#ifdef CONFIG_SUPERH64
70 /*
71 * The SH-5 cache uses the ASIDs, requiring both the I and D
72 * cache to be flushed when the ASID is exhausted. Weak.
73 */
74 flush_cache_all();
75#endif
76
77 /*
78 * Fix version; Note that we avoid version #0
79 * to distingush NO_CONTEXT.
80 */
81 if (!asid)
82 asid = MMU_CONTEXT_FIRST_VERSION;
83 }
84
85 cpu_context(cpu, mm) = asid_cache(cpu) = asid;
86}
87
88/*
89 * Initialize the context related info for a new mm_struct
90 * instance.
91 */
92static inline int init_new_context(struct task_struct *tsk,
93 struct mm_struct *mm)
94{
95 int i;
96
97 for (i = 0; i < num_online_cpus(); i++)
98 cpu_context(i, mm) = NO_CONTEXT;
99
100 return 0;
101}
102
103/*
104 * After we have set current->mm to a new value, this activates
105 * the context for the new mm so we see the new mappings.
106 */
107static inline void activate_context(struct mm_struct *mm, unsigned int cpu)
108{
109 get_mmu_context(mm, cpu);
110 set_asid(cpu_asid(cpu, mm));
111}
112
113static inline void switch_mm(struct mm_struct *prev,
114 struct mm_struct *next,
115 struct task_struct *tsk)
116{
117 unsigned int cpu = smp_processor_id();
118
119 if (likely(prev != next)) {
120 cpu_set(cpu, next->cpu_vm_mask);
121 set_TTB(next->pgd);
122 activate_context(next, cpu);
123 } else
124 if (!cpu_test_and_set(cpu, next->cpu_vm_mask))
125 activate_context(next, cpu);
126}
127#else
128#define get_mmu_context(mm) do { } while (0)
129#define init_new_context(tsk,mm) (0)
130#define destroy_context(mm) do { } while (0)
131#define set_asid(asid) do { } while (0)
132#define get_asid() (0)
133#define cpu_asid(cpu, mm) ({ (void)cpu; 0; })
134#define switch_and_save_asid(asid) (0)
135#define set_TTB(pgd) do { } while (0)
136#define get_TTB() (0)
137#define activate_context(mm,cpu) do { } while (0)
138#define switch_mm(prev,next,tsk) do { } while (0)
139#endif /* CONFIG_MMU */
140
141#define activate_mm(prev, next) switch_mm((prev),(next),NULL)
142#define deactivate_mm(tsk,mm) do { } while (0)
143#define enter_lazy_tlb(mm,tsk) do { } while (0)
144
145#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4)
146/*
147 * If this processor has an MMU, we need methods to turn it off/on ..
148 * paging_init() will also have to be updated for the processor in
149 * question.
150 */
151static inline void enable_mmu(void)
152{
153 unsigned int cpu = smp_processor_id();
154
155 /* Enable MMU */
156 ctrl_outl(MMU_CONTROL_INIT, MMUCR);
157 ctrl_barrier();
158
159 if (asid_cache(cpu) == NO_CONTEXT)
160 asid_cache(cpu) = MMU_CONTEXT_FIRST_VERSION;
161
162 set_asid(asid_cache(cpu) & MMU_CONTEXT_ASID_MASK);
163}
164
165static inline void disable_mmu(void)
166{
167 unsigned long cr;
168
169 cr = ctrl_inl(MMUCR);
170 cr &= ~MMU_CONTROL_INIT;
171 ctrl_outl(cr, MMUCR);
172
173 ctrl_barrier();
174}
175#else
176/*
177 * MMU control handlers for processors lacking memory
178 * management hardware.
179 */
180#define enable_mmu() do { } while (0)
181#define disable_mmu() do { } while (0)
182#endif
183
184#endif /* __KERNEL__ */
185#endif /* __ASM_SH_MMU_CONTEXT_H */
diff --git a/include/asm-sh/mmu_context_32.h b/arch/sh/include/asm/mmu_context_32.h
index f4f9aebd68b7..f4f9aebd68b7 100644
--- a/include/asm-sh/mmu_context_32.h
+++ b/arch/sh/include/asm/mmu_context_32.h
diff --git a/arch/sh/include/asm/mmu_context_64.h b/arch/sh/include/asm/mmu_context_64.h
new file mode 100644
index 000000000000..de121025d87f
--- /dev/null
+++ b/arch/sh/include/asm/mmu_context_64.h
@@ -0,0 +1,78 @@
1#ifndef __ASM_SH_MMU_CONTEXT_64_H
2#define __ASM_SH_MMU_CONTEXT_64_H
3
4/*
5 * sh64-specific mmu_context interface.
6 *
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 * Copyright (C) 2003 - 2007 Paul Mundt
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 */
14#include <cpu/registers.h>
15#include <asm/cacheflush.h>
16
17#define SR_ASID_MASK 0xffffffffff00ffffULL
18#define SR_ASID_SHIFT 16
19
20/*
21 * Destroy context related info for an mm_struct that is about
22 * to be put to rest.
23 */
24static inline void destroy_context(struct mm_struct *mm)
25{
26 /* Well, at least free TLB entries */
27 flush_tlb_mm(mm);
28}
29
30static inline unsigned long get_asid(void)
31{
32 unsigned long long sr;
33
34 asm volatile ("getcon " __SR ", %0\n\t"
35 : "=r" (sr));
36
37 sr = (sr >> SR_ASID_SHIFT) & MMU_CONTEXT_ASID_MASK;
38 return (unsigned long) sr;
39}
40
41/* Set ASID into SR */
42static inline void set_asid(unsigned long asid)
43{
44 unsigned long long sr, pc;
45
46 asm volatile ("getcon " __SR ", %0" : "=r" (sr));
47
48 sr = (sr & SR_ASID_MASK) | (asid << SR_ASID_SHIFT);
49
50 /*
51 * It is possible that this function may be inlined and so to avoid
52 * the assembler reporting duplicate symbols we make use of the
53 * gas trick of generating symbols using numerics and forward
54 * reference.
55 */
56 asm volatile ("movi 1, %1\n\t"
57 "shlli %1, 28, %1\n\t"
58 "or %0, %1, %1\n\t"
59 "putcon %1, " __SR "\n\t"
60 "putcon %0, " __SSR "\n\t"
61 "movi 1f, %1\n\t"
62 "ori %1, 1 , %1\n\t"
63 "putcon %1, " __SPC "\n\t"
64 "rte\n"
65 "1:\n\t"
66 : "=r" (sr), "=r" (pc) : "0" (sr));
67}
68
69/* arch/sh/kernel/cpu/sh5/entry.S */
70extern unsigned long switch_and_save_asid(unsigned long new_asid);
71
72/* No spare register to twiddle, so use a software cache */
73extern pgd_t *mmu_pdtp_cache;
74
75#define set_TTB(pgd) (mmu_pdtp_cache = (pgd))
76#define get_TTB() (mmu_pdtp_cache)
77
78#endif /* __ASM_SH_MMU_CONTEXT_64_H */
diff --git a/include/asm-sh/mmzone.h b/arch/sh/include/asm/mmzone.h
index 2969253c4042..2969253c4042 100644
--- a/include/asm-sh/mmzone.h
+++ b/arch/sh/include/asm/mmzone.h
diff --git a/include/asm-sh/module.h b/arch/sh/include/asm/module.h
index 46eccd331660..46eccd331660 100644
--- a/include/asm-sh/module.h
+++ b/arch/sh/include/asm/module.h
diff --git a/include/asm-sh/msgbuf.h b/arch/sh/include/asm/msgbuf.h
index 517432343fb5..517432343fb5 100644
--- a/include/asm-sh/msgbuf.h
+++ b/arch/sh/include/asm/msgbuf.h
diff --git a/include/asm-sh/mutex.h b/arch/sh/include/asm/mutex.h
index 458c1f7fbc18..458c1f7fbc18 100644
--- a/include/asm-sh/mutex.h
+++ b/arch/sh/include/asm/mutex.h
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
new file mode 100644
index 000000000000..77fb8bf02e4e
--- /dev/null
+++ b/arch/sh/include/asm/page.h
@@ -0,0 +1,183 @@
1#ifndef __ASM_SH_PAGE_H
2#define __ASM_SH_PAGE_H
3
4/*
5 * Copyright (C) 1999 Niibe Yutaka
6 */
7
8#include <linux/const.h>
9
10/* PAGE_SHIFT determines the page size */
11#if defined(CONFIG_PAGE_SIZE_4KB)
12# define PAGE_SHIFT 12
13#elif defined(CONFIG_PAGE_SIZE_8KB)
14# define PAGE_SHIFT 13
15#elif defined(CONFIG_PAGE_SIZE_16KB)
16# define PAGE_SHIFT 14
17#elif defined(CONFIG_PAGE_SIZE_64KB)
18# define PAGE_SHIFT 16
19#else
20# error "Bogus kernel page size?"
21#endif
22
23#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
24#define PAGE_MASK (~(PAGE_SIZE-1))
25#define PTE_MASK PAGE_MASK
26
27#if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
28#define HPAGE_SHIFT 16
29#elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)
30#define HPAGE_SHIFT 18
31#elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
32#define HPAGE_SHIFT 20
33#elif defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
34#define HPAGE_SHIFT 22
35#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB)
36#define HPAGE_SHIFT 26
37#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512MB)
38#define HPAGE_SHIFT 29
39#endif
40
41#ifdef CONFIG_HUGETLB_PAGE
42#define HPAGE_SIZE (1UL << HPAGE_SHIFT)
43#define HPAGE_MASK (~(HPAGE_SIZE-1))
44#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT)
45#endif
46
47#ifndef __ASSEMBLY__
48
49extern unsigned long shm_align_mask;
50extern unsigned long max_low_pfn, min_low_pfn;
51extern unsigned long memory_start, memory_end;
52
53extern void clear_page(void *to);
54extern void copy_page(void *to, void *from);
55
56#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
57 (defined(CONFIG_CPU_SH5) || defined(CONFIG_CPU_SH4) || \
58 defined(CONFIG_SH7705_CACHE_32KB))
59struct page;
60struct vm_area_struct;
61extern void clear_user_page(void *to, unsigned long address, struct page *page);
62extern void copy_user_page(void *to, void *from, unsigned long address,
63 struct page *page);
64#if defined(CONFIG_CPU_SH4)
65extern void copy_user_highpage(struct page *to, struct page *from,
66 unsigned long vaddr, struct vm_area_struct *vma);
67#define __HAVE_ARCH_COPY_USER_HIGHPAGE
68#endif
69#else
70#define clear_user_page(page, vaddr, pg) clear_page(page)
71#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
72#endif
73
74/*
75 * These are used to make use of C type-checking..
76 */
77#ifdef CONFIG_X2TLB
78typedef struct { unsigned long pte_low, pte_high; } pte_t;
79typedef struct { unsigned long long pgprot; } pgprot_t;
80typedef struct { unsigned long long pgd; } pgd_t;
81#define pte_val(x) \
82 ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
83#define __pte(x) \
84 ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; })
85#elif defined(CONFIG_SUPERH32)
86typedef struct { unsigned long pte_low; } pte_t;
87typedef struct { unsigned long pgprot; } pgprot_t;
88typedef struct { unsigned long pgd; } pgd_t;
89#define pte_val(x) ((x).pte_low)
90#define __pte(x) ((pte_t) { (x) } )
91#else
92typedef struct { unsigned long long pte_low; } pte_t;
93typedef struct { unsigned long pgprot; } pgprot_t;
94typedef struct { unsigned long pgd; } pgd_t;
95#define pte_val(x) ((x).pte_low)
96#define __pte(x) ((pte_t) { (x) } )
97#endif
98
99#define pgd_val(x) ((x).pgd)
100#define pgprot_val(x) ((x).pgprot)
101
102#define __pgd(x) ((pgd_t) { (x) } )
103#define __pgprot(x) ((pgprot_t) { (x) } )
104
105typedef struct page *pgtable_t;
106
107#endif /* !__ASSEMBLY__ */
108
109/*
110 * __MEMORY_START and SIZE are the physical addresses and size of RAM.
111 */
112#define __MEMORY_START CONFIG_MEMORY_START
113#define __MEMORY_SIZE CONFIG_MEMORY_SIZE
114
115/*
116 * PAGE_OFFSET is the virtual address of the start of kernel address
117 * space.
118 */
119#define PAGE_OFFSET CONFIG_PAGE_OFFSET
120
121/*
122 * Virtual to physical RAM address translation.
123 *
124 * In 29 bit mode, the physical offset of RAM from address 0 is visible in
125 * the kernel virtual address space, and thus we don't have to take
126 * this into account when translating. However in 32 bit mode this offset
127 * is not visible (it is part of the PMB mapping) and so needs to be
128 * added or subtracted as required.
129 */
130#ifdef CONFIG_32BIT
131#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET+__MEMORY_START)
132#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET-__MEMORY_START))
133#else
134#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
135#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
136#endif
137
138#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
139#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
140
141/*
142 * PFN = physical frame number (ie PFN 0 == physical address 0)
143 * PFN_START is the PFN of the first page of RAM. By defining this we
144 * don't have struct page entries for the portion of address space
145 * between physical address 0 and the start of RAM.
146 */
147#define PFN_START (__MEMORY_START >> PAGE_SHIFT)
148#define ARCH_PFN_OFFSET (PFN_START)
149#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
150#ifdef CONFIG_FLATMEM
151#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn)
152#endif
153#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
154
155#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
156 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
157
158#include <asm-generic/memory_model.h>
159#include <asm-generic/page.h>
160
161/* vDSO support */
162#ifdef CONFIG_VSYSCALL
163#define __HAVE_ARCH_GATE_AREA
164#endif
165
166/*
167 * Some drivers need to perform DMA into kmalloc'ed buffers
168 * and so we have to increase the kmalloc minalign for this.
169 */
170#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
171
172#ifdef CONFIG_SUPERH64
173/*
174 * While BYTES_PER_WORD == 4 on the current sh64 ABI, GCC will still
175 * happily generate {ld/st}.q pairs, requiring us to have 8-byte
176 * alignment to avoid traps. The kmalloc alignment is gauranteed by
177 * virtue of L1_CACHE_BYTES, requiring this to only be special cased
178 * for slab caches.
179 */
180#define ARCH_SLAB_MINALIGN 8
181#endif
182
183#endif /* __ASM_SH_PAGE_H */
diff --git a/include/asm-sh/param.h b/arch/sh/include/asm/param.h
index ae245afdfd6a..ae245afdfd6a 100644
--- a/include/asm-sh/param.h
+++ b/arch/sh/include/asm/param.h
diff --git a/include/asm-sh/parport.h b/arch/sh/include/asm/parport.h
index f67ba60a2acd..f67ba60a2acd 100644
--- a/include/asm-sh/parport.h
+++ b/arch/sh/include/asm/parport.h
diff --git a/include/asm-sh/pci.h b/arch/sh/include/asm/pci.h
index df1d383e18a5..df1d383e18a5 100644
--- a/include/asm-sh/pci.h
+++ b/arch/sh/include/asm/pci.h
diff --git a/include/asm-sh/percpu.h b/arch/sh/include/asm/percpu.h
index 4db4b39a4399..4db4b39a4399 100644
--- a/include/asm-sh/percpu.h
+++ b/arch/sh/include/asm/percpu.h
diff --git a/include/asm-sh/pgalloc.h b/arch/sh/include/asm/pgalloc.h
index 84dd2db7104c..84dd2db7104c 100644
--- a/include/asm-sh/pgalloc.h
+++ b/arch/sh/include/asm/pgalloc.h
diff --git a/include/asm-sh/pgtable.h b/arch/sh/include/asm/pgtable.h
index a4a8f8b93463..a4a8f8b93463 100644
--- a/include/asm-sh/pgtable.h
+++ b/arch/sh/include/asm/pgtable.h
diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h
new file mode 100644
index 000000000000..72ea209195bd
--- /dev/null
+++ b/arch/sh/include/asm/pgtable_32.h
@@ -0,0 +1,479 @@
1#ifndef __ASM_SH_PGTABLE_32_H
2#define __ASM_SH_PGTABLE_32_H
3
4/*
5 * Linux PTEL encoding.
6 *
7 * Hardware and software bit definitions for the PTEL value (see below for
8 * notes on SH-X2 MMUs and 64-bit PTEs):
9 *
10 * - Bits 0 and 7 are reserved on SH-3 (_PAGE_WT and _PAGE_SZ1 on SH-4).
11 *
12 * - Bit 1 is the SH-bit, but is unused on SH-3 due to an MMU bug (the
13 * hardware PTEL value can't have the SH-bit set when MMUCR.IX is set,
14 * which is the default in cpu-sh3/mmu_context.h:MMU_CONTROL_INIT).
15 *
16 * In order to keep this relatively clean, do not use these for defining
17 * SH-3 specific flags until all of the other unused bits have been
18 * exhausted.
19 *
20 * - Bit 9 is reserved by everyone and used by _PAGE_PROTNONE.
21 *
22 * - Bits 10 and 11 are low bits of the PPN that are reserved on >= 4K pages.
23 * Bit 10 is used for _PAGE_ACCESSED, bit 11 remains unused.
24 *
25 * - On 29 bit platforms, bits 31 to 29 are used for the space attributes
26 * and timing control which (together with bit 0) are moved into the
27 * old-style PTEA on the parts that support it.
28 *
29 * XXX: Leave the _PAGE_FILE and _PAGE_WT overhaul for a rainy day.
30 *
31 * SH-X2 MMUs and extended PTEs
32 *
33 * SH-X2 supports an extended mode TLB with split data arrays due to the
34 * number of bits needed for PR and SZ (now EPR and ESZ) encodings. The PR and
35 * SZ bit placeholders still exist in data array 1, but are implemented as
36 * reserved bits, with the real logic existing in data array 2.
37 *
38 * The downside to this is that we can no longer fit everything in to a 32-bit
39 * PTE encoding, so a 64-bit pte_t is necessary for these parts. On the plus
40 * side, this gives us quite a few spare bits to play with for future usage.
41 */
42/* Legacy and compat mode bits */
43#define _PAGE_WT 0x001 /* WT-bit on SH-4, 0 on SH-3 */
44#define _PAGE_HW_SHARED 0x002 /* SH-bit : shared among processes */
45#define _PAGE_DIRTY 0x004 /* D-bit : page changed */
46#define _PAGE_CACHABLE 0x008 /* C-bit : cachable */
47#define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */
48#define _PAGE_RW 0x020 /* PR0-bit : write access allowed */
49#define _PAGE_USER 0x040 /* PR1-bit : user space access allowed*/
50#define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */
51#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */
52#define _PAGE_PROTNONE 0x200 /* software: if not present */
53#define _PAGE_ACCESSED 0x400 /* software: page referenced */
54#define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */
55
56#define _PAGE_SZ_MASK (_PAGE_SZ0 | _PAGE_SZ1)
57#define _PAGE_PR_MASK (_PAGE_RW | _PAGE_USER)
58
59/* Extended mode bits */
60#define _PAGE_EXT_ESZ0 0x0010 /* ESZ0-bit: Size of page */
61#define _PAGE_EXT_ESZ1 0x0020 /* ESZ1-bit: Size of page */
62#define _PAGE_EXT_ESZ2 0x0040 /* ESZ2-bit: Size of page */
63#define _PAGE_EXT_ESZ3 0x0080 /* ESZ3-bit: Size of page */
64
65#define _PAGE_EXT_USER_EXEC 0x0100 /* EPR0-bit: User space executable */
66#define _PAGE_EXT_USER_WRITE 0x0200 /* EPR1-bit: User space writable */
67#define _PAGE_EXT_USER_READ 0x0400 /* EPR2-bit: User space readable */
68
69#define _PAGE_EXT_KERN_EXEC 0x0800 /* EPR3-bit: Kernel space executable */
70#define _PAGE_EXT_KERN_WRITE 0x1000 /* EPR4-bit: Kernel space writable */
71#define _PAGE_EXT_KERN_READ 0x2000 /* EPR5-bit: Kernel space readable */
72
73/* Wrapper for extended mode pgprot twiddling */
74#define _PAGE_EXT(x) ((unsigned long long)(x) << 32)
75
76/* software: moves to PTEA.TC (Timing Control) */
77#define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */
78#define _PAGE_PCC_AREA6 0x80000000 /* use BSC registers for area6 */
79
80/* software: moves to PTEA.SA[2:0] (Space Attributes) */
81#define _PAGE_PCC_IODYN 0x00000001 /* IO space, dynamically sized bus */
82#define _PAGE_PCC_IO8 0x20000000 /* IO space, 8 bit bus */
83#define _PAGE_PCC_IO16 0x20000001 /* IO space, 16 bit bus */
84#define _PAGE_PCC_COM8 0x40000000 /* Common Memory space, 8 bit bus */
85#define _PAGE_PCC_COM16 0x40000001 /* Common Memory space, 16 bit bus */
86#define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */
87#define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */
88
89/* Mask which drops unused bits from the PTEL value */
90#if defined(CONFIG_CPU_SH3)
91#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \
92 _PAGE_FILE | _PAGE_SZ1 | \
93 _PAGE_HW_SHARED)
94#elif defined(CONFIG_X2TLB)
95/* Get rid of the legacy PR/SZ bits when using extended mode */
96#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | \
97 _PAGE_FILE | _PAGE_PR_MASK | _PAGE_SZ_MASK)
98#else
99#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_FILE)
100#endif
101
102#define _PAGE_FLAGS_HARDWARE_MASK (PHYS_ADDR_MASK & ~(_PAGE_CLEAR_FLAGS))
103
104/* Hardware flags, page size encoding */
105#if !defined(CONFIG_MMU)
106# define _PAGE_FLAGS_HARD 0ULL
107#elif defined(CONFIG_X2TLB)
108# if defined(CONFIG_PAGE_SIZE_4KB)
109# define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ0)
110# elif defined(CONFIG_PAGE_SIZE_8KB)
111# define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ1)
112# elif defined(CONFIG_PAGE_SIZE_64KB)
113# define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ2)
114# endif
115#else
116# if defined(CONFIG_PAGE_SIZE_4KB)
117# define _PAGE_FLAGS_HARD _PAGE_SZ0
118# elif defined(CONFIG_PAGE_SIZE_64KB)
119# define _PAGE_FLAGS_HARD _PAGE_SZ1
120# endif
121#endif
122
123#if defined(CONFIG_X2TLB)
124# if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
125# define _PAGE_SZHUGE (_PAGE_EXT_ESZ2)
126# elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)
127# define _PAGE_SZHUGE (_PAGE_EXT_ESZ0 | _PAGE_EXT_ESZ2)
128# elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
129# define _PAGE_SZHUGE (_PAGE_EXT_ESZ0 | _PAGE_EXT_ESZ1 | _PAGE_EXT_ESZ2)
130# elif defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
131# define _PAGE_SZHUGE (_PAGE_EXT_ESZ3)
132# elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB)
133# define _PAGE_SZHUGE (_PAGE_EXT_ESZ2 | _PAGE_EXT_ESZ3)
134# endif
135#else
136# if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
137# define _PAGE_SZHUGE (_PAGE_SZ1)
138# elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
139# define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1)
140# endif
141#endif
142
143/*
144 * Stub out _PAGE_SZHUGE if we don't have a good definition for it,
145 * to make pte_mkhuge() happy.
146 */
147#ifndef _PAGE_SZHUGE
148# define _PAGE_SZHUGE (_PAGE_FLAGS_HARD)
149#endif
150
151#define _PAGE_CHG_MASK \
152 (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY)
153
154#ifndef __ASSEMBLY__
155
156#if defined(CONFIG_X2TLB) /* SH-X2 TLB */
157#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE | \
158 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
159
160#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
161 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
162 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
163 _PAGE_EXT_KERN_WRITE | \
164 _PAGE_EXT_USER_READ | \
165 _PAGE_EXT_USER_WRITE))
166
167#define PAGE_EXECREAD __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
168 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
169 _PAGE_EXT(_PAGE_EXT_KERN_EXEC | \
170 _PAGE_EXT_KERN_READ | \
171 _PAGE_EXT_USER_EXEC | \
172 _PAGE_EXT_USER_READ))
173
174#define PAGE_COPY PAGE_EXECREAD
175
176#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
177 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
178 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
179 _PAGE_EXT_USER_READ))
180
181#define PAGE_WRITEONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
182 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
183 _PAGE_EXT(_PAGE_EXT_KERN_WRITE | \
184 _PAGE_EXT_USER_WRITE))
185
186#define PAGE_RWX __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
187 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
188 _PAGE_EXT(_PAGE_EXT_KERN_WRITE | \
189 _PAGE_EXT_KERN_READ | \
190 _PAGE_EXT_KERN_EXEC | \
191 _PAGE_EXT_USER_WRITE | \
192 _PAGE_EXT_USER_READ | \
193 _PAGE_EXT_USER_EXEC))
194
195#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
196 _PAGE_DIRTY | _PAGE_ACCESSED | \
197 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD | \
198 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
199 _PAGE_EXT_KERN_WRITE | \
200 _PAGE_EXT_KERN_EXEC))
201
202#define PAGE_KERNEL_NOCACHE \
203 __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | \
204 _PAGE_ACCESSED | _PAGE_HW_SHARED | \
205 _PAGE_FLAGS_HARD | \
206 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
207 _PAGE_EXT_KERN_WRITE | \
208 _PAGE_EXT_KERN_EXEC))
209
210#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
211 _PAGE_DIRTY | _PAGE_ACCESSED | \
212 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD | \
213 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
214 _PAGE_EXT_KERN_EXEC))
215
216#define PAGE_KERNEL_PCC(slot, type) \
217 __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | \
218 _PAGE_ACCESSED | _PAGE_FLAGS_HARD | \
219 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
220 _PAGE_EXT_KERN_WRITE | \
221 _PAGE_EXT_KERN_EXEC) \
222 (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | \
223 (type))
224
225#elif defined(CONFIG_MMU) /* SH-X TLB */
226#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE | \
227 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
228
229#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
230 _PAGE_CACHABLE | _PAGE_ACCESSED | \
231 _PAGE_FLAGS_HARD)
232
233#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | \
234 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
235
236#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | \
237 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
238
239#define PAGE_EXECREAD PAGE_READONLY
240#define PAGE_RWX PAGE_SHARED
241#define PAGE_WRITEONLY PAGE_SHARED
242
243#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | \
244 _PAGE_DIRTY | _PAGE_ACCESSED | \
245 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
246
247#define PAGE_KERNEL_NOCACHE \
248 __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \
249 _PAGE_ACCESSED | _PAGE_HW_SHARED | \
250 _PAGE_FLAGS_HARD)
251
252#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
253 _PAGE_DIRTY | _PAGE_ACCESSED | \
254 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
255
256#define PAGE_KERNEL_PCC(slot, type) \
257 __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \
258 _PAGE_ACCESSED | _PAGE_FLAGS_HARD | \
259 (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | \
260 (type))
261#else /* no mmu */
262#define PAGE_NONE __pgprot(0)
263#define PAGE_SHARED __pgprot(0)
264#define PAGE_COPY __pgprot(0)
265#define PAGE_EXECREAD __pgprot(0)
266#define PAGE_RWX __pgprot(0)
267#define PAGE_READONLY __pgprot(0)
268#define PAGE_WRITEONLY __pgprot(0)
269#define PAGE_KERNEL __pgprot(0)
270#define PAGE_KERNEL_NOCACHE __pgprot(0)
271#define PAGE_KERNEL_RO __pgprot(0)
272
273#define PAGE_KERNEL_PCC(slot, type) \
274 __pgprot(0)
275#endif
276
277#endif /* __ASSEMBLY__ */
278
279#ifndef __ASSEMBLY__
280
281/*
282 * Certain architectures need to do special things when PTEs
283 * within a page table are directly modified. Thus, the following
284 * hook is made available.
285 */
286#ifdef CONFIG_X2TLB
287static inline void set_pte(pte_t *ptep, pte_t pte)
288{
289 ptep->pte_high = pte.pte_high;
290 smp_wmb();
291 ptep->pte_low = pte.pte_low;
292}
293#else
294#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
295#endif
296
297#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
298
299/*
300 * (pmds are folded into pgds so this doesn't get actually called,
301 * but the define is needed for a generic inline function.)
302 */
303#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
304
305#define pfn_pte(pfn, prot) \
306 __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
307#define pfn_pmd(pfn, prot) \
308 __pmd(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
309
310#define pte_none(x) (!pte_val(x))
311#define pte_present(x) ((x).pte_low & (_PAGE_PRESENT | _PAGE_PROTNONE))
312
313#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
314
315#define pmd_none(x) (!pmd_val(x))
316#define pmd_present(x) (pmd_val(x))
317#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
318#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
319
320#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
321#define pte_page(x) pfn_to_page(pte_pfn(x))
322
323/*
324 * The following only work if pte_present() is true.
325 * Undefined behaviour if not..
326 */
327#define pte_not_present(pte) (!((pte).pte_low & _PAGE_PRESENT))
328#define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY)
329#define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED)
330#define pte_file(pte) ((pte).pte_low & _PAGE_FILE)
331#define pte_special(pte) (0)
332
333#ifdef CONFIG_X2TLB
334#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE)
335#else
336#define pte_write(pte) ((pte).pte_low & _PAGE_RW)
337#endif
338
339#define PTE_BIT_FUNC(h,fn,op) \
340static inline pte_t pte_##fn(pte_t pte) { pte.pte_##h op; return pte; }
341
342#ifdef CONFIG_X2TLB
343/*
344 * We cheat a bit in the SH-X2 TLB case. As the permission bits are
345 * individually toggled (and user permissions are entirely decoupled from
346 * kernel permissions), we attempt to couple them a bit more sanely here.
347 */
348PTE_BIT_FUNC(high, wrprotect, &= ~_PAGE_EXT_USER_WRITE);
349PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE);
350PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE);
351#else
352PTE_BIT_FUNC(low, wrprotect, &= ~_PAGE_RW);
353PTE_BIT_FUNC(low, mkwrite, |= _PAGE_RW);
354PTE_BIT_FUNC(low, mkhuge, |= _PAGE_SZHUGE);
355#endif
356
357PTE_BIT_FUNC(low, mkclean, &= ~_PAGE_DIRTY);
358PTE_BIT_FUNC(low, mkdirty, |= _PAGE_DIRTY);
359PTE_BIT_FUNC(low, mkold, &= ~_PAGE_ACCESSED);
360PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED);
361
362static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
363
364/*
365 * Macro and implementation to make a page protection as uncachable.
366 */
367#define pgprot_writecombine(prot) \
368 __pgprot(pgprot_val(prot) & ~_PAGE_CACHABLE)
369
370#define pgprot_noncached pgprot_writecombine
371
372/*
373 * Conversion functions: convert a page and protection to a page entry,
374 * and a page entry and page directory to the page they refer to.
375 *
376 * extern pte_t mk_pte(struct page *page, pgprot_t pgprot)
377 */
378#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
379
380static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
381{
382 pte.pte_low &= _PAGE_CHG_MASK;
383 pte.pte_low |= pgprot_val(newprot);
384
385#ifdef CONFIG_X2TLB
386 pte.pte_high |= pgprot_val(newprot) >> 32;
387#endif
388
389 return pte;
390}
391
392#define pmd_page_vaddr(pmd) ((unsigned long)pmd_val(pmd))
393#define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
394
395/* to find an entry in a page-table-directory. */
396#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
397#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
398
399/* to find an entry in a kernel page-table-directory */
400#define pgd_offset_k(address) pgd_offset(&init_mm, address)
401
402/* Find an entry in the third-level page table.. */
403#define pte_index(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
404#define pte_offset_kernel(dir, address) \
405 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
406#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
407#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address)
408
409#define pte_unmap(pte) do { } while (0)
410#define pte_unmap_nested(pte) do { } while (0)
411
412#ifdef CONFIG_X2TLB
413#define pte_ERROR(e) \
414 printk("%s:%d: bad pte %p(%08lx%08lx).\n", __FILE__, __LINE__, \
415 &(e), (e).pte_high, (e).pte_low)
416#define pgd_ERROR(e) \
417 printk("%s:%d: bad pgd %016llx.\n", __FILE__, __LINE__, pgd_val(e))
418#else
419#define pte_ERROR(e) \
420 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
421#define pgd_ERROR(e) \
422 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
423#endif
424
425/*
426 * Encode and de-code a swap entry
427 *
428 * Constraints:
429 * _PAGE_FILE at bit 0
430 * _PAGE_PRESENT at bit 8
431 * _PAGE_PROTNONE at bit 9
432 *
433 * For the normal case, we encode the swap type into bits 0:7 and the
434 * swap offset into bits 10:30. For the 64-bit PTE case, we keep the
435 * preserved bits in the low 32-bits and use the upper 32 as the swap
436 * offset (along with a 5-bit type), following the same approach as x86
437 * PAE. This keeps the logic quite simple, and allows for a full 32
438 * PTE_FILE_MAX_BITS, as opposed to the 29-bits we're constrained with
439 * in the pte_low case.
440 *
441 * As is evident by the Alpha code, if we ever get a 64-bit unsigned
442 * long (swp_entry_t) to match up with the 64-bit PTEs, this all becomes
443 * much cleaner..
444 *
445 * NOTE: We should set ZEROs at the position of _PAGE_PRESENT
446 * and _PAGE_PROTNONE bits
447 */
448#ifdef CONFIG_X2TLB
449#define __swp_type(x) ((x).val & 0x1f)
450#define __swp_offset(x) ((x).val >> 5)
451#define __swp_entry(type, offset) ((swp_entry_t){ (type) | (offset) << 5})
452#define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high })
453#define __swp_entry_to_pte(x) ((pte_t){ 0, (x).val })
454
455/*
456 * Encode and decode a nonlinear file mapping entry
457 */
458#define pte_to_pgoff(pte) ((pte).pte_high)
459#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) })
460
461#define PTE_FILE_MAX_BITS 32
462#else
463#define __swp_type(x) ((x).val & 0xff)
464#define __swp_offset(x) ((x).val >> 10)
465#define __swp_entry(type, offset) ((swp_entry_t){(type) | (offset) <<10})
466
467#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 1 })
468#define __swp_entry_to_pte(x) ((pte_t) { (x).val << 1 })
469
470/*
471 * Encode and decode a nonlinear file mapping entry
472 */
473#define PTE_FILE_MAX_BITS 29
474#define pte_to_pgoff(pte) (pte_val(pte) >> 1)
475#define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE })
476#endif
477
478#endif /* __ASSEMBLY__ */
479#endif /* __ASM_SH_PGTABLE_32_H */
diff --git a/include/asm-sh/pgtable_64.h b/arch/sh/include/asm/pgtable_64.h
index c78990cda557..c78990cda557 100644
--- a/include/asm-sh/pgtable_64.h
+++ b/arch/sh/include/asm/pgtable_64.h
diff --git a/include/asm-sh/pm.h b/arch/sh/include/asm/pm.h
index 56fdbd6b1c94..56fdbd6b1c94 100644
--- a/include/asm-sh/pm.h
+++ b/arch/sh/include/asm/pm.h
diff --git a/include/asm-sh/poll.h b/arch/sh/include/asm/poll.h
index c98509d3149e..c98509d3149e 100644
--- a/include/asm-sh/poll.h
+++ b/arch/sh/include/asm/poll.h
diff --git a/include/asm-sh/posix_types.h b/arch/sh/include/asm/posix_types.h
index 4eeb723aee7e..4eeb723aee7e 100644
--- a/include/asm-sh/posix_types.h
+++ b/arch/sh/include/asm/posix_types.h
diff --git a/include/asm-sh/posix_types_32.h b/arch/sh/include/asm/posix_types_32.h
index 0a3d2f54ab27..0a3d2f54ab27 100644
--- a/include/asm-sh/posix_types_32.h
+++ b/arch/sh/include/asm/posix_types_32.h
diff --git a/include/asm-sh/posix_types_64.h b/arch/sh/include/asm/posix_types_64.h
index 0620317a6f0f..0620317a6f0f 100644
--- a/include/asm-sh/posix_types_64.h
+++ b/arch/sh/include/asm/posix_types_64.h
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
new file mode 100644
index 000000000000..15d9f92ca383
--- /dev/null
+++ b/arch/sh/include/asm/processor.h
@@ -0,0 +1,66 @@
1#ifndef __ASM_SH_PROCESSOR_H
2#define __ASM_SH_PROCESSOR_H
3
4#include <asm/cpu-features.h>
5#include <asm/segment.h>
6
7#ifndef __ASSEMBLY__
8/*
9 * CPU type and hardware bug flags. Kept separately for each CPU.
10 *
11 * Each one of these also needs a CONFIG_CPU_SUBTYPE_xxx entry
12 * in arch/sh/mm/Kconfig, as well as an entry in arch/sh/kernel/setup.c
13 * for parsing the subtype in get_cpu_subtype().
14 */
15enum cpu_type {
16 /* SH-2 types */
17 CPU_SH7619,
18
19 /* SH-2A types */
20 CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_MXG,
21
22 /* SH-3 types */
23 CPU_SH7705, CPU_SH7706, CPU_SH7707,
24 CPU_SH7708, CPU_SH7708S, CPU_SH7708R,
25 CPU_SH7709, CPU_SH7709A, CPU_SH7710, CPU_SH7712,
26 CPU_SH7720, CPU_SH7721, CPU_SH7729,
27
28 /* SH-4 types */
29 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
30 CPU_SH7760, CPU_SH4_202, CPU_SH4_501,
31
32 /* SH-4A types */
33 CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785,
34 CPU_SH7723, CPU_SHX3,
35
36 /* SH4AL-DSP types */
37 CPU_SH7343, CPU_SH7722, CPU_SH7366,
38
39 /* SH-5 types */
40 CPU_SH5_101, CPU_SH5_103,
41
42 /* Unknown subtype */
43 CPU_SH_NONE
44};
45
46/* Forward decl */
47struct sh_cpuinfo;
48
49/* arch/sh/kernel/setup.c */
50const char *get_cpu_subtype(struct sh_cpuinfo *c);
51
52#ifdef CONFIG_VSYSCALL
53int vsyscall_init(void);
54#else
55#define vsyscall_init() do { } while (0)
56#endif
57
58#endif /* __ASSEMBLY__ */
59
60#ifdef CONFIG_SUPERH32
61# include "processor_32.h"
62#else
63# include "processor_64.h"
64#endif
65
66#endif /* __ASM_SH_PROCESSOR_H */
diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
new file mode 100644
index 000000000000..0dadd75bd93c
--- /dev/null
+++ b/arch/sh/include/asm/processor_32.h
@@ -0,0 +1,216 @@
1/*
2 * include/asm-sh/processor.h
3 *
4 * Copyright (C) 1999, 2000 Niibe Yutaka
5 * Copyright (C) 2002, 2003 Paul Mundt
6 */
7
8#ifndef __ASM_SH_PROCESSOR_32_H
9#define __ASM_SH_PROCESSOR_32_H
10#ifdef __KERNEL__
11
12#include <linux/compiler.h>
13#include <asm/page.h>
14#include <asm/types.h>
15#include <asm/cache.h>
16#include <asm/ptrace.h>
17
18/*
19 * Default implementation of macro that returns current
20 * instruction pointer ("program counter").
21 */
22#define current_text_addr() ({ void *pc; __asm__("mova 1f, %0\n.align 2\n1:":"=z" (pc)); pc; })
23
24/* Core Processor Version Register */
25#define CCN_PVR 0xff000030
26#define CCN_CVR 0xff000040
27#define CCN_PRR 0xff000044
28
29struct sh_cpuinfo {
30 unsigned int type;
31 int cut_major, cut_minor;
32 unsigned long loops_per_jiffy;
33 unsigned long asid_cache;
34
35 struct cache_info icache; /* Primary I-cache */
36 struct cache_info dcache; /* Primary D-cache */
37 struct cache_info scache; /* Secondary cache */
38
39 unsigned long flags;
40} __attribute__ ((aligned(L1_CACHE_BYTES)));
41
42extern struct sh_cpuinfo cpu_data[];
43#define boot_cpu_data cpu_data[0]
44#define current_cpu_data cpu_data[smp_processor_id()]
45#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
46
47/*
48 * User space process size: 2GB.
49 *
50 * Since SH7709 and SH7750 have "area 7", we can't use 0x7c000000--0x7fffffff
51 */
52#define TASK_SIZE 0x7c000000UL
53
54#define STACK_TOP TASK_SIZE
55#define STACK_TOP_MAX STACK_TOP
56
57/* This decides where the kernel will search for a free chunk of vm
58 * space during mmap's.
59 */
60#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
61
62/*
63 * Bit of SR register
64 *
65 * FD-bit:
66 * When it's set, it means the processor doesn't have right to use FPU,
67 * and it results exception when the floating operation is executed.
68 *
69 * IMASK-bit:
70 * Interrupt level mask
71 */
72#define SR_DSP 0x00001000
73#define SR_IMASK 0x000000f0
74#define SR_FD 0x00008000
75
76/*
77 * FPU structure and data
78 */
79
80struct sh_fpu_hard_struct {
81 unsigned long fp_regs[16];
82 unsigned long xfp_regs[16];
83 unsigned long fpscr;
84 unsigned long fpul;
85
86 long status; /* software status information */
87};
88
89/* Dummy fpu emulator */
90struct sh_fpu_soft_struct {
91 unsigned long fp_regs[16];
92 unsigned long xfp_regs[16];
93 unsigned long fpscr;
94 unsigned long fpul;
95
96 unsigned char lookahead;
97 unsigned long entry_pc;
98};
99
100union sh_fpu_union {
101 struct sh_fpu_hard_struct hard;
102 struct sh_fpu_soft_struct soft;
103};
104
105struct thread_struct {
106 /* Saved registers when thread is descheduled */
107 unsigned long sp;
108 unsigned long pc;
109
110 /* Hardware debugging registers */
111 unsigned long ubc_pc;
112
113 /* floating point info */
114 union sh_fpu_union fpu;
115};
116
117/* Count of active tasks with UBC settings */
118extern int ubc_usercnt;
119
120#define INIT_THREAD { \
121 .sp = sizeof(init_stack) + (long) &init_stack, \
122}
123
124/*
125 * Do necessary setup to start up a newly executed thread.
126 */
127#define start_thread(regs, new_pc, new_sp) \
128 set_fs(USER_DS); \
129 regs->pr = 0; \
130 regs->sr = SR_FD; /* User mode. */ \
131 regs->pc = new_pc; \
132 regs->regs[15] = new_sp
133
134/* Forward declaration, a strange C thing */
135struct task_struct;
136struct mm_struct;
137
138/* Free all resources held by a thread. */
139extern void release_thread(struct task_struct *);
140
141/* Prepare to copy thread state - unlazy all lazy status */
142#define prepare_to_copy(tsk) do { } while (0)
143
144/*
145 * create a kernel thread without removing it from tasklists
146 */
147extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
148
149/* Copy and release all segment info associated with a VM */
150#define copy_segments(p, mm) do { } while(0)
151#define release_segments(mm) do { } while(0)
152
153/*
154 * FPU lazy state save handling.
155 */
156
157static __inline__ void disable_fpu(void)
158{
159 unsigned long __dummy;
160
161 /* Set FD flag in SR */
162 __asm__ __volatile__("stc sr, %0\n\t"
163 "or %1, %0\n\t"
164 "ldc %0, sr"
165 : "=&r" (__dummy)
166 : "r" (SR_FD));
167}
168
169static __inline__ void enable_fpu(void)
170{
171 unsigned long __dummy;
172
173 /* Clear out FD flag in SR */
174 __asm__ __volatile__("stc sr, %0\n\t"
175 "and %1, %0\n\t"
176 "ldc %0, sr"
177 : "=&r" (__dummy)
178 : "r" (~SR_FD));
179}
180
181/* Double presision, NANS as NANS, rounding to nearest, no exceptions */
182#define FPSCR_INIT 0x00080000
183
184#define FPSCR_CAUSE_MASK 0x0001f000 /* Cause bits */
185#define FPSCR_FLAG_MASK 0x0000007c /* Flag bits */
186
187/*
188 * Return saved PC of a blocked thread.
189 */
190#define thread_saved_pc(tsk) (tsk->thread.pc)
191
192void show_trace(struct task_struct *tsk, unsigned long *sp,
193 struct pt_regs *regs);
194extern unsigned long get_wchan(struct task_struct *p);
195
196#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
197#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[15])
198
199#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
200#define cpu_relax() barrier()
201
202#if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH3) || \
203 defined(CONFIG_CPU_SH4)
204#define PREFETCH_STRIDE L1_CACHE_BYTES
205#define ARCH_HAS_PREFETCH
206#define ARCH_HAS_PREFETCHW
207static inline void prefetch(void *x)
208{
209 __asm__ __volatile__ ("pref @%0\n\t" : : "r" (x) : "memory");
210}
211
212#define prefetchw(x) prefetch(x)
213#endif
214
215#endif /* __KERNEL__ */
216#endif /* __ASM_SH_PROCESSOR_32_H */
diff --git a/arch/sh/include/asm/processor_64.h b/arch/sh/include/asm/processor_64.h
new file mode 100644
index 000000000000..770d5169983b
--- /dev/null
+++ b/arch/sh/include/asm/processor_64.h
@@ -0,0 +1,275 @@
1#ifndef __ASM_SH_PROCESSOR_64_H
2#define __ASM_SH_PROCESSOR_64_H
3
4/*
5 * include/asm-sh/processor_64.h
6 *
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 * Copyright (C) 2003 Paul Mundt
9 * Copyright (C) 2004 Richard Curnow
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#ifndef __ASSEMBLY__
16
17#include <linux/compiler.h>
18#include <asm/page.h>
19#include <asm/types.h>
20#include <asm/cache.h>
21#include <asm/ptrace.h>
22#include <cpu/registers.h>
23
24/*
25 * Default implementation of macro that returns current
26 * instruction pointer ("program counter").
27 */
28#define current_text_addr() ({ \
29void *pc; \
30unsigned long long __dummy = 0; \
31__asm__("gettr tr0, %1\n\t" \
32 "pta 4, tr0\n\t" \
33 "gettr tr0, %0\n\t" \
34 "ptabs %1, tr0\n\t" \
35 :"=r" (pc), "=r" (__dummy) \
36 : "1" (__dummy)); \
37pc; })
38
39/*
40 * TLB information structure
41 *
42 * Defined for both I and D tlb, per-processor.
43 */
44struct tlb_info {
45 unsigned long long next;
46 unsigned long long first;
47 unsigned long long last;
48
49 unsigned int entries;
50 unsigned int step;
51
52 unsigned long flags;
53};
54
55struct sh_cpuinfo {
56 enum cpu_type type;
57 unsigned long loops_per_jiffy;
58 unsigned long asid_cache;
59
60 unsigned int cpu_clock, master_clock, bus_clock, module_clock;
61
62 /* Cache info */
63 struct cache_info icache;
64 struct cache_info dcache;
65 struct cache_info scache;
66
67 /* TLB info */
68 struct tlb_info itlb;
69 struct tlb_info dtlb;
70
71 unsigned long flags;
72};
73
74extern struct sh_cpuinfo cpu_data[];
75#define boot_cpu_data cpu_data[0]
76#define current_cpu_data cpu_data[smp_processor_id()]
77#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
78
79#endif
80
81/*
82 * User space process size: 2GB - 4k.
83 */
84#define TASK_SIZE 0x7ffff000UL
85
86#define STACK_TOP TASK_SIZE
87#define STACK_TOP_MAX STACK_TOP
88
89/* This decides where the kernel will search for a free chunk of vm
90 * space during mmap's.
91 */
92#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
93
94/*
95 * Bit of SR register
96 *
97 * FD-bit:
98 * When it's set, it means the processor doesn't have right to use FPU,
99 * and it results exception when the floating operation is executed.
100 *
101 * IMASK-bit:
102 * Interrupt level mask
103 *
104 * STEP-bit:
105 * Single step bit
106 *
107 */
108#if defined(CONFIG_SH64_SR_WATCH)
109#define SR_MMU 0x84000000
110#else
111#define SR_MMU 0x80000000
112#endif
113
114#define SR_IMASK 0x000000f0
115#define SR_FD 0x00008000
116#define SR_SSTEP 0x08000000
117
118#ifndef __ASSEMBLY__
119
120/*
121 * FPU structure and data : require 8-byte alignment as we need to access it
122 with fld.p, fst.p
123 */
124
125struct sh_fpu_hard_struct {
126 unsigned long fp_regs[64];
127 unsigned int fpscr;
128 /* long status; * software status information */
129};
130
131#if 0
132/* Dummy fpu emulator */
133struct sh_fpu_soft_struct {
134 unsigned long long fp_regs[32];
135 unsigned int fpscr;
136 unsigned char lookahead;
137 unsigned long entry_pc;
138};
139#endif
140
141union sh_fpu_union {
142 struct sh_fpu_hard_struct hard;
143 /* 'hard' itself only produces 32 bit alignment, yet we need
144 to access it using 64 bit load/store as well. */
145 unsigned long long alignment_dummy;
146};
147
148struct thread_struct {
149 unsigned long sp;
150 unsigned long pc;
151 /* This stores the address of the pt_regs built during a context
152 switch, or of the register save area built for a kernel mode
153 exception. It is used for backtracing the stack of a sleeping task
154 or one that traps in kernel mode. */
155 struct pt_regs *kregs;
156 /* This stores the address of the pt_regs constructed on entry from
157 user mode. It is a fixed value over the lifetime of a process, or
158 NULL for a kernel thread. */
159 struct pt_regs *uregs;
160
161 unsigned long trap_no, error_code;
162 unsigned long address;
163 /* Hardware debugging registers may come here */
164
165 /* floating point info */
166 union sh_fpu_union fpu;
167};
168
169#define INIT_MMAP \
170{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
171
172extern struct pt_regs fake_swapper_regs;
173
174#define INIT_THREAD { \
175 .sp = sizeof(init_stack) + \
176 (long) &init_stack, \
177 .pc = 0, \
178 .kregs = &fake_swapper_regs, \
179 .uregs = NULL, \
180 .trap_no = 0, \
181 .error_code = 0, \
182 .address = 0, \
183 .fpu = { { { 0, } }, } \
184}
185
186/*
187 * Do necessary setup to start up a newly executed thread.
188 */
189#define SR_USER (SR_MMU | SR_FD)
190
191#define start_thread(regs, new_pc, new_sp) \
192 set_fs(USER_DS); \
193 regs->sr = SR_USER; /* User mode. */ \
194 regs->pc = new_pc - 4; /* Compensate syscall exit */ \
195 regs->pc |= 1; /* Set SHmedia ! */ \
196 regs->regs[18] = 0; \
197 regs->regs[15] = new_sp
198
199/* Forward declaration, a strange C thing */
200struct task_struct;
201struct mm_struct;
202
203/* Free all resources held by a thread. */
204extern void release_thread(struct task_struct *);
205/*
206 * create a kernel thread without removing it from tasklists
207 */
208extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
209
210
211/* Copy and release all segment info associated with a VM */
212#define copy_segments(p, mm) do { } while (0)
213#define release_segments(mm) do { } while (0)
214#define forget_segments() do { } while (0)
215#define prepare_to_copy(tsk) do { } while (0)
216/*
217 * FPU lazy state save handling.
218 */
219
220static inline void disable_fpu(void)
221{
222 unsigned long long __dummy;
223
224 /* Set FD flag in SR */
225 __asm__ __volatile__("getcon " __SR ", %0\n\t"
226 "or %0, %1, %0\n\t"
227 "putcon %0, " __SR "\n\t"
228 : "=&r" (__dummy)
229 : "r" (SR_FD));
230}
231
232static inline void enable_fpu(void)
233{
234 unsigned long long __dummy;
235
236 /* Clear out FD flag in SR */
237 __asm__ __volatile__("getcon " __SR ", %0\n\t"
238 "and %0, %1, %0\n\t"
239 "putcon %0, " __SR "\n\t"
240 : "=&r" (__dummy)
241 : "r" (~SR_FD));
242}
243
244/* Round to nearest, no exceptions on inexact, overflow, underflow,
245 zero-divide, invalid. Configure option for whether to flush denorms to
246 zero, or except if a denorm is encountered. */
247#if defined(CONFIG_SH64_FPU_DENORM_FLUSH)
248#define FPSCR_INIT 0x00040000
249#else
250#define FPSCR_INIT 0x00000000
251#endif
252
253#ifdef CONFIG_SH_FPU
254/* Initialise the FP state of a task */
255void fpinit(struct sh_fpu_hard_struct *fpregs);
256#else
257#define fpinit(fpregs) do { } while (0)
258#endif
259
260extern struct task_struct *last_task_used_math;
261
262/*
263 * Return saved PC of a blocked thread.
264 */
265#define thread_saved_pc(tsk) (tsk->thread.pc)
266
267extern unsigned long get_wchan(struct task_struct *p);
268
269#define KSTK_EIP(tsk) ((tsk)->thread.pc)
270#define KSTK_ESP(tsk) ((tsk)->thread.sp)
271
272#define cpu_relax() barrier()
273
274#endif /* __ASSEMBLY__ */
275#endif /* __ASM_SH_PROCESSOR_64_H */
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
new file mode 100644
index 000000000000..643ab5a7cf3b
--- /dev/null
+++ b/arch/sh/include/asm/ptrace.h
@@ -0,0 +1,130 @@
1#ifndef __ASM_SH_PTRACE_H
2#define __ASM_SH_PTRACE_H
3
4/*
5 * Copyright (C) 1999, 2000 Niibe Yutaka
6 *
7 */
8#if defined(__SH5__)
9struct pt_regs {
10 unsigned long long pc;
11 unsigned long long sr;
12 unsigned long long syscall_nr;
13 unsigned long long regs[63];
14 unsigned long long tregs[8];
15 unsigned long long pad[2];
16};
17#else
18/*
19 * GCC defines register number like this:
20 * -----------------------------
21 * 0 - 15 are integer registers
22 * 17 - 22 are control/special registers
23 * 24 - 39 fp registers
24 * 40 - 47 xd registers
25 * 48 - fpscr register
26 * -----------------------------
27 *
28 * We follows above, except:
29 * 16 --- program counter (PC)
30 * 22 --- syscall #
31 * 23 --- floating point communication register
32 */
33#define REG_REG0 0
34#define REG_REG15 15
35
36#define REG_PC 16
37
38#define REG_PR 17
39#define REG_SR 18
40#define REG_GBR 19
41#define REG_MACH 20
42#define REG_MACL 21
43
44#define REG_SYSCALL 22
45
46#define REG_FPREG0 23
47#define REG_FPREG15 38
48#define REG_XFREG0 39
49#define REG_XFREG15 54
50
51#define REG_FPSCR 55
52#define REG_FPUL 56
53
54/*
55 * This struct defines the way the registers are stored on the
56 * kernel stack during a system call or other kernel entry.
57 */
58struct pt_regs {
59 unsigned long regs[16];
60 unsigned long pc;
61 unsigned long pr;
62 unsigned long sr;
63 unsigned long gbr;
64 unsigned long mach;
65 unsigned long macl;
66 long tra;
67};
68
69/*
70 * This struct defines the way the DSP registers are stored on the
71 * kernel stack during a system call or other kernel entry.
72 */
73struct pt_dspregs {
74 unsigned long a1;
75 unsigned long a0g;
76 unsigned long a1g;
77 unsigned long m0;
78 unsigned long m1;
79 unsigned long a0;
80 unsigned long x0;
81 unsigned long x1;
82 unsigned long y0;
83 unsigned long y1;
84 unsigned long dsr;
85 unsigned long rs;
86 unsigned long re;
87 unsigned long mod;
88};
89
90#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */
91
92#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
93#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
94
95#define PTRACE_GETDSPREGS 55
96#define PTRACE_SETDSPREGS 56
97#endif
98
99#ifdef __KERNEL__
100#include <asm/addrspace.h>
101
102#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
103#define instruction_pointer(regs) ((unsigned long)(regs)->pc)
104
105extern void show_regs(struct pt_regs *);
106
107#ifdef CONFIG_SH_DSP
108#define task_pt_regs(task) \
109 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
110 - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
111#else
112#define task_pt_regs(task) \
113 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
114 - sizeof(unsigned long)) - 1)
115#endif
116
117static inline unsigned long profile_pc(struct pt_regs *regs)
118{
119 unsigned long pc = instruction_pointer(regs);
120
121#ifdef P2SEG
122 if (pc >= P2SEG && pc < P3SEG)
123 pc -= 0x20000000;
124#endif
125
126 return pc;
127}
128#endif /* __KERNEL__ */
129
130#endif /* __ASM_SH_PTRACE_H */
diff --git a/include/asm-sh/push-switch.h b/arch/sh/include/asm/push-switch.h
index 4903f9e52dd8..4903f9e52dd8 100644
--- a/include/asm-sh/push-switch.h
+++ b/arch/sh/include/asm/push-switch.h
diff --git a/include/asm-sh/r7780rp.h b/arch/sh/include/asm/r7780rp.h
index 306f7359f7d4..306f7359f7d4 100644
--- a/include/asm-sh/r7780rp.h
+++ b/arch/sh/include/asm/r7780rp.h
diff --git a/include/asm-sh/resource.h b/arch/sh/include/asm/resource.h
index 9c2499a86ec0..9c2499a86ec0 100644
--- a/include/asm-sh/resource.h
+++ b/arch/sh/include/asm/resource.h
diff --git a/arch/sh/include/asm/rtc.h b/arch/sh/include/asm/rtc.h
new file mode 100644
index 000000000000..1813f4202a24
--- /dev/null
+++ b/arch/sh/include/asm/rtc.h
@@ -0,0 +1,16 @@
1#ifndef _ASM_RTC_H
2#define _ASM_RTC_H
3
4extern void (*board_time_init)(void);
5extern void (*rtc_sh_get_time)(struct timespec *);
6extern int (*rtc_sh_set_time)(const time_t);
7
8#define RTC_CAP_4_DIGIT_YEAR (1 << 0)
9
10struct sh_rtc_platform_info {
11 unsigned long capabilities;
12};
13
14#include <cpu/rtc.h>
15
16#endif /* _ASM_RTC_H */
diff --git a/include/asm-sh/rts7751r2d.h b/arch/sh/include/asm/rts7751r2d.h
index 0a800157b826..0a800157b826 100644
--- a/include/asm-sh/rts7751r2d.h
+++ b/arch/sh/include/asm/rts7751r2d.h
diff --git a/include/asm-sh/rwsem.h b/arch/sh/include/asm/rwsem.h
index 1987f3ea7f1b..1987f3ea7f1b 100644
--- a/include/asm-sh/rwsem.h
+++ b/arch/sh/include/asm/rwsem.h
diff --git a/include/asm-sh/scatterlist.h b/arch/sh/include/asm/scatterlist.h
index 2084d0373693..2084d0373693 100644
--- a/include/asm-sh/scatterlist.h
+++ b/arch/sh/include/asm/scatterlist.h
diff --git a/include/asm-sh/sdk7780.h b/arch/sh/include/asm/sdk7780.h
index 697dc865f21b..697dc865f21b 100644
--- a/include/asm-sh/sdk7780.h
+++ b/arch/sh/include/asm/sdk7780.h
diff --git a/include/asm-sh/sections.h b/arch/sh/include/asm/sections.h
index 8f8f4ad400df..8f8f4ad400df 100644
--- a/include/asm-sh/sections.h
+++ b/arch/sh/include/asm/sections.h
diff --git a/arch/sh/include/asm/segment.h b/arch/sh/include/asm/segment.h
new file mode 100644
index 000000000000..5e2725f4ac49
--- /dev/null
+++ b/arch/sh/include/asm/segment.h
@@ -0,0 +1,34 @@
1#ifndef __ASM_SH_SEGMENT_H
2#define __ASM_SH_SEGMENT_H
3
4#ifndef __ASSEMBLY__
5
6typedef struct {
7 unsigned long seg;
8} mm_segment_t;
9
10#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
11
12/*
13 * The fs value determines whether argument validity checking should be
14 * performed or not. If get_fs() == USER_DS, checking is performed, with
15 * get_fs() == KERNEL_DS, checking is bypassed.
16 *
17 * For historical reasons, these macros are grossly misnamed.
18 */
19#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFFUL)
20#ifdef CONFIG_MMU
21#define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
22#else
23#define USER_DS KERNEL_DS
24#endif
25
26#define segment_eq(a,b) ((a).seg == (b).seg)
27
28#define get_ds() (KERNEL_DS)
29
30#define get_fs() (current_thread_info()->addr_limit)
31#define set_fs(x) (current_thread_info()->addr_limit = (x))
32
33#endif /* __ASSEMBLY__ */
34#endif /* __ASM_SH_SEGMENT_H */
diff --git a/include/asm-sh/sembuf.h b/arch/sh/include/asm/sembuf.h
index d79f3bd570b2..d79f3bd570b2 100644
--- a/include/asm-sh/sembuf.h
+++ b/arch/sh/include/asm/sembuf.h
diff --git a/arch/sh/include/asm/serial.h b/arch/sh/include/asm/serial.h
new file mode 100644
index 000000000000..e13cc948ee60
--- /dev/null
+++ b/arch/sh/include/asm/serial.h
@@ -0,0 +1,36 @@
1/*
2 * include/asm-sh/serial.h
3 *
4 * Configuration details for 8250, 16450, 16550, etc. serial ports
5 */
6
7#ifndef _ASM_SERIAL_H
8#define _ASM_SERIAL_H
9
10#include <linux/kernel.h>
11
12/*
13 * This assumes you have a 1.8432 MHz clock for your UART.
14 *
15 * It'd be nice if someone built a serial card with a 24.576 MHz
16 * clock, since the 16550A is capable of handling a top speed of 1.5
17 * megabits/second; but this requires the faster clock.
18 */
19#define BASE_BAUD ( 1843200 / 16 )
20
21#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
22
23#ifdef CONFIG_HD64465
24#include <asm/hd64465/hd64465.h>
25
26#define SERIAL_PORT_DFNS \
27 /* UART CLK PORT IRQ FLAGS */ \
28 { 0, BASE_BAUD, 0x3F8, HD64465_IRQ_UART, STD_COM_FLAGS } /* ttyS0 */
29
30#else
31
32#define SERIAL_PORT_DFNS
33
34#endif
35
36#endif /* _ASM_SERIAL_H */
diff --git a/include/asm-sh/setup.h b/arch/sh/include/asm/setup.h
index 55a2bd328d99..55a2bd328d99 100644
--- a/include/asm-sh/setup.h
+++ b/arch/sh/include/asm/setup.h
diff --git a/include/asm-sh/sfp-machine.h b/arch/sh/include/asm/sfp-machine.h
index d3c548443f2a..d3c548443f2a 100644
--- a/include/asm-sh/sfp-machine.h
+++ b/arch/sh/include/asm/sfp-machine.h
diff --git a/include/asm-sh/sh7760fb.h b/arch/sh/include/asm/sh7760fb.h
index 8767f61aceca..8767f61aceca 100644
--- a/include/asm-sh/sh7760fb.h
+++ b/arch/sh/include/asm/sh7760fb.h
diff --git a/arch/sh/include/asm/sh7763rdp.h b/arch/sh/include/asm/sh7763rdp.h
new file mode 100644
index 000000000000..8750cc852977
--- /dev/null
+++ b/arch/sh/include/asm/sh7763rdp.h
@@ -0,0 +1,54 @@
1#ifndef __ASM_SH_SH7763RDP_H
2#define __ASM_SH_SH7763RDP_H
3
4/*
5 * linux/include/asm-sh/sh7763drp.h
6 *
7 * Copyright (C) 2008 Renesas Solutions
8 * Copyright (C) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 *
14 */
15#include <asm/addrspace.h>
16
17/* clock control */
18#define MSTPCR1 0xFFC80038
19
20/* PORT */
21#define PORT_PSEL0 0xFFEF0070
22#define PORT_PSEL1 0xFFEF0072
23#define PORT_PSEL2 0xFFEF0074
24#define PORT_PSEL3 0xFFEF0076
25#define PORT_PSEL4 0xFFEF0078
26
27#define PORT_PACR 0xFFEF0000
28#define PORT_PCCR 0xFFEF0004
29#define PORT_PFCR 0xFFEF000A
30#define PORT_PGCR 0xFFEF000C
31#define PORT_PHCR 0xFFEF000E
32#define PORT_PICR 0xFFEF0010
33#define PORT_PJCR 0xFFEF0012
34#define PORT_PKCR 0xFFEF0014
35#define PORT_PLCR 0xFFEF0016
36#define PORT_PMCR 0xFFEF0018
37#define PORT_PNCR 0xFFEF001A
38
39/* FPGA */
40#define CPLD_BOARD_ID_ERV_REG 0xB1000000
41#define CPLD_CPLD_CMD_REG 0xB1000006
42
43/*
44 * USB SH7763RDP board can use Host only.
45 */
46#define USB_USBHSC 0xFFEC80f0
47
48/* arch/sh/boards/renesas/sh7763rdp/irq.c */
49void init_sh7763rdp_IRQ(void);
50int sh7763rdp_irq_demux(int irq);
51#define __IO_PREFIX sh7763rdp
52#include <asm/io_generic.h>
53
54#endif /* __ASM_SH_SH7763RDP_H */
diff --git a/arch/sh/include/asm/sh7785lcr.h b/arch/sh/include/asm/sh7785lcr.h
new file mode 100644
index 000000000000..1ce27d5c7491
--- /dev/null
+++ b/arch/sh/include/asm/sh7785lcr.h
@@ -0,0 +1,55 @@
1#ifndef __ASM_SH_RENESAS_SH7785LCR_H
2#define __ASM_SH_RENESAS_SH7785LCR_H
3
4/*
5 * This board has 2 physical memory maps.
6 * It can be changed with DIP switch(S2-5).
7 *
8 * phys address | S2-5 = OFF | S2-5 = ON
9 * -----------------------------+---------------+---------------
10 * 0x00000000 - 0x03ffffff(CS0) | NOR Flash | NOR Flash
11 * 0x04000000 - 0x05ffffff(CS1) | PLD | PLD
12 * 0x06000000 - 0x07ffffff(CS1) | reserved | I2C
13 * 0x08000000 - 0x0bffffff(CS2) | USB | DDR SDRAM
14 * 0x0c000000 - 0x0fffffff(CS3) | SD | DDR SDRAM
15 * 0x10000000 - 0x13ffffff(CS4) | SM107 | SM107
16 * 0x14000000 - 0x17ffffff(CS5) | I2C | USB
17 * 0x18000000 - 0x1bffffff(CS6) | reserved | SD
18 * 0x40000000 - 0x5fffffff | DDR SDRAM | (cannot use)
19 *
20 */
21
22#define NOR_FLASH_ADDR 0x00000000
23#define NOR_FLASH_SIZE 0x04000000
24
25#define PLD_BASE_ADDR 0x04000000
26#define PLD_PCICR (PLD_BASE_ADDR + 0x00)
27#define PLD_LCD_BK_CONTR (PLD_BASE_ADDR + 0x02)
28#define PLD_LOCALCR (PLD_BASE_ADDR + 0x04)
29#define PLD_POFCR (PLD_BASE_ADDR + 0x06)
30#define PLD_LEDCR (PLD_BASE_ADDR + 0x08)
31#define PLD_SWSR (PLD_BASE_ADDR + 0x0a)
32#define PLD_VERSR (PLD_BASE_ADDR + 0x0c)
33#define PLD_MMSR (PLD_BASE_ADDR + 0x0e)
34
35#define SM107_MEM_ADDR 0x10000000
36#define SM107_MEM_SIZE 0x00e00000
37#define SM107_REG_ADDR 0x13e00000
38#define SM107_REG_SIZE 0x00200000
39
40#if defined(CONFIG_SH_SH7785LCR_29BIT_PHYSMAPS)
41#define R8A66597_ADDR 0x14000000 /* USB */
42#define CG200_ADDR 0x18000000 /* SD */
43#define PCA9564_ADDR 0x06000000 /* I2C */
44#else
45#define R8A66597_ADDR 0x08000000
46#define CG200_ADDR 0x0c000000
47#define PCA9564_ADDR 0x14000000
48#endif
49
50#define R8A66597_SIZE 0x00000100
51#define CG200_SIZE 0x00010000
52#define PCA9564_SIZE 0x00000100
53
54#endif /* __ASM_SH_RENESAS_SH7785LCR_H */
55
diff --git a/include/asm-sh/sh_bios.h b/arch/sh/include/asm/sh_bios.h
index 0ca261956e3d..0ca261956e3d 100644
--- a/include/asm-sh/sh_bios.h
+++ b/arch/sh/include/asm/sh_bios.h
diff --git a/include/asm-sh/sh_keysc.h b/arch/sh/include/asm/sh_keysc.h
index b5a4dd5a9729..b5a4dd5a9729 100644
--- a/include/asm-sh/sh_keysc.h
+++ b/arch/sh/include/asm/sh_keysc.h
diff --git a/include/asm-sh/sh_mobile_lcdc.h b/arch/sh/include/asm/sh_mobile_lcdc.h
index 27677727df4d..27677727df4d 100644
--- a/include/asm-sh/sh_mobile_lcdc.h
+++ b/arch/sh/include/asm/sh_mobile_lcdc.h
diff --git a/include/asm-sh/shmbuf.h b/arch/sh/include/asm/shmbuf.h
index b2101f490521..b2101f490521 100644
--- a/include/asm-sh/shmbuf.h
+++ b/arch/sh/include/asm/shmbuf.h
diff --git a/include/asm-sh/shmin.h b/arch/sh/include/asm/shmin.h
index 36ba138a81fb..36ba138a81fb 100644
--- a/include/asm-sh/shmin.h
+++ b/arch/sh/include/asm/shmin.h
diff --git a/include/asm-sh/shmparam.h b/arch/sh/include/asm/shmparam.h
index ba1758d90106..ba1758d90106 100644
--- a/include/asm-sh/shmparam.h
+++ b/arch/sh/include/asm/shmparam.h
diff --git a/include/asm-sh/sigcontext.h b/arch/sh/include/asm/sigcontext.h
index 8ce1435bc0bf..8ce1435bc0bf 100644
--- a/include/asm-sh/sigcontext.h
+++ b/arch/sh/include/asm/sigcontext.h
diff --git a/include/asm-sh/siginfo.h b/arch/sh/include/asm/siginfo.h
index 813040ed68a9..813040ed68a9 100644
--- a/include/asm-sh/siginfo.h
+++ b/arch/sh/include/asm/siginfo.h
diff --git a/include/asm-sh/signal.h b/arch/sh/include/asm/signal.h
index 5c5c1e852089..5c5c1e852089 100644
--- a/include/asm-sh/signal.h
+++ b/arch/sh/include/asm/signal.h
diff --git a/include/asm-sh/smc37c93x.h b/arch/sh/include/asm/smc37c93x.h
index 585da2a8fc45..585da2a8fc45 100644
--- a/include/asm-sh/smc37c93x.h
+++ b/arch/sh/include/asm/smc37c93x.h
diff --git a/include/asm-sh/smp.h b/arch/sh/include/asm/smp.h
index 593343cd26ee..593343cd26ee 100644
--- a/include/asm-sh/smp.h
+++ b/arch/sh/include/asm/smp.h
diff --git a/include/asm-sh/snapgear.h b/arch/sh/include/asm/snapgear.h
index 042d95f51c4d..042d95f51c4d 100644
--- a/include/asm-sh/snapgear.h
+++ b/arch/sh/include/asm/snapgear.h
diff --git a/include/asm-sh/socket.h b/arch/sh/include/asm/socket.h
index 6d4bf6512959..6d4bf6512959 100644
--- a/include/asm-sh/socket.h
+++ b/arch/sh/include/asm/socket.h
diff --git a/include/asm-sh/sockios.h b/arch/sh/include/asm/sockios.h
index cf8b96b1f9ab..cf8b96b1f9ab 100644
--- a/include/asm-sh/sockios.h
+++ b/arch/sh/include/asm/sockios.h
diff --git a/include/asm-sh/sparsemem.h b/arch/sh/include/asm/sparsemem.h
index 547a540b6667..547a540b6667 100644
--- a/include/asm-sh/sparsemem.h
+++ b/arch/sh/include/asm/sparsemem.h
diff --git a/include/asm-sh/spi.h b/arch/sh/include/asm/spi.h
index e96f5b0953c8..e96f5b0953c8 100644
--- a/include/asm-sh/spi.h
+++ b/arch/sh/include/asm/spi.h
diff --git a/include/asm-sh/spinlock.h b/arch/sh/include/asm/spinlock.h
index e793181d64da..e793181d64da 100644
--- a/include/asm-sh/spinlock.h
+++ b/arch/sh/include/asm/spinlock.h
diff --git a/include/asm-sh/spinlock_types.h b/arch/sh/include/asm/spinlock_types.h
index b4d244e7b60c..b4d244e7b60c 100644
--- a/include/asm-sh/spinlock_types.h
+++ b/arch/sh/include/asm/spinlock_types.h
diff --git a/include/asm-sh/stat.h b/arch/sh/include/asm/stat.h
index e1810cc6e3da..e1810cc6e3da 100644
--- a/include/asm-sh/stat.h
+++ b/arch/sh/include/asm/stat.h
diff --git a/include/asm-sh/statfs.h b/arch/sh/include/asm/statfs.h
index 9202a023328f..9202a023328f 100644
--- a/include/asm-sh/statfs.h
+++ b/arch/sh/include/asm/statfs.h
diff --git a/include/asm-sh/string.h b/arch/sh/include/asm/string.h
index 8c1ea21dc0ae..8c1ea21dc0ae 100644
--- a/include/asm-sh/string.h
+++ b/arch/sh/include/asm/string.h
diff --git a/include/asm-sh/string_32.h b/arch/sh/include/asm/string_32.h
index 55f8db6bc1d7..55f8db6bc1d7 100644
--- a/include/asm-sh/string_32.h
+++ b/arch/sh/include/asm/string_32.h
diff --git a/include/asm-sh/string_64.h b/arch/sh/include/asm/string_64.h
index aa1fef229c78..aa1fef229c78 100644
--- a/include/asm-sh/string_64.h
+++ b/arch/sh/include/asm/string_64.h
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h
new file mode 100644
index 000000000000..056d68cd2108
--- /dev/null
+++ b/arch/sh/include/asm/system.h
@@ -0,0 +1,190 @@
1#ifndef __ASM_SH_SYSTEM_H
2#define __ASM_SH_SYSTEM_H
3
4/*
5 * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima
6 * Copyright (C) 2002 Paul Mundt
7 */
8
9#include <linux/irqflags.h>
10#include <linux/compiler.h>
11#include <linux/linkage.h>
12#include <asm/types.h>
13#include <asm/ptrace.h>
14
15#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */
16
17#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5)
18#define __icbi() \
19{ \
20 unsigned long __addr; \
21 __addr = 0xa8000000; \
22 __asm__ __volatile__( \
23 "icbi %0\n\t" \
24 : /* no output */ \
25 : "m" (__m(__addr))); \
26}
27#endif
28
29/*
30 * A brief note on ctrl_barrier(), the control register write barrier.
31 *
32 * Legacy SH cores typically require a sequence of 8 nops after
33 * modification of a control register in order for the changes to take
34 * effect. On newer cores (like the sh4a and sh5) this is accomplished
35 * with icbi.
36 *
37 * Also note that on sh4a in the icbi case we can forego a synco for the
38 * write barrier, as it's not necessary for control registers.
39 *
40 * Historically we have only done this type of barrier for the MMUCR, but
41 * it's also necessary for the CCR, so we make it generic here instead.
42 */
43#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5)
44#define mb() __asm__ __volatile__ ("synco": : :"memory")
45#define rmb() mb()
46#define wmb() __asm__ __volatile__ ("synco": : :"memory")
47#define ctrl_barrier() __icbi()
48#define read_barrier_depends() do { } while(0)
49#else
50#define mb() __asm__ __volatile__ ("": : :"memory")
51#define rmb() mb()
52#define wmb() __asm__ __volatile__ ("": : :"memory")
53#define ctrl_barrier() __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop")
54#define read_barrier_depends() do { } while(0)
55#endif
56
57#ifdef CONFIG_SMP
58#define smp_mb() mb()
59#define smp_rmb() rmb()
60#define smp_wmb() wmb()
61#define smp_read_barrier_depends() read_barrier_depends()
62#else
63#define smp_mb() barrier()
64#define smp_rmb() barrier()
65#define smp_wmb() barrier()
66#define smp_read_barrier_depends() do { } while(0)
67#endif
68
69#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
70
71#ifdef CONFIG_GUSA_RB
72#include <asm/cmpxchg-grb.h>
73#else
74#include <asm/cmpxchg-irq.h>
75#endif
76
77extern void __xchg_called_with_bad_pointer(void);
78
79#define __xchg(ptr, x, size) \
80({ \
81 unsigned long __xchg__res; \
82 volatile void *__xchg_ptr = (ptr); \
83 switch (size) { \
84 case 4: \
85 __xchg__res = xchg_u32(__xchg_ptr, x); \
86 break; \
87 case 1: \
88 __xchg__res = xchg_u8(__xchg_ptr, x); \
89 break; \
90 default: \
91 __xchg_called_with_bad_pointer(); \
92 __xchg__res = x; \
93 break; \
94 } \
95 \
96 __xchg__res; \
97})
98
99#define xchg(ptr,x) \
100 ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr))))
101
102/* This function doesn't exist, so you'll get a linker error
103 * if something tries to do an invalid cmpxchg(). */
104extern void __cmpxchg_called_with_bad_pointer(void);
105
106#define __HAVE_ARCH_CMPXCHG 1
107
108static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
109 unsigned long new, int size)
110{
111 switch (size) {
112 case 4:
113 return __cmpxchg_u32(ptr, old, new);
114 }
115 __cmpxchg_called_with_bad_pointer();
116 return old;
117}
118
119#define cmpxchg(ptr,o,n) \
120 ({ \
121 __typeof__(*(ptr)) _o_ = (o); \
122 __typeof__(*(ptr)) _n_ = (n); \
123 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
124 (unsigned long)_n_, sizeof(*(ptr))); \
125 })
126
127extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
128
129extern void *set_exception_table_vec(unsigned int vec, void *handler);
130
131static inline void *set_exception_table_evt(unsigned int evt, void *handler)
132{
133 return set_exception_table_vec(evt >> 5, handler);
134}
135
136/*
137 * SH-2A has both 16 and 32-bit opcodes, do lame encoding checks.
138 */
139#ifdef CONFIG_CPU_SH2A
140extern unsigned int instruction_size(unsigned int insn);
141#elif defined(CONFIG_SUPERH32)
142#define instruction_size(insn) (2)
143#else
144#define instruction_size(insn) (4)
145#endif
146
147extern unsigned long cached_to_uncached;
148
149extern struct dentry *sh_debugfs_root;
150
151void per_cpu_trap_init(void);
152
153asmlinkage void break_point_trap(void);
154
155#ifdef CONFIG_SUPERH32
156#define BUILD_TRAP_HANDLER(name) \
157asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5, \
158 unsigned long r6, unsigned long r7, \
159 struct pt_regs __regs)
160
161#define TRAP_HANDLER_DECL \
162 struct pt_regs *regs = RELOC_HIDE(&__regs, 0); \
163 unsigned int vec = regs->tra; \
164 (void)vec;
165#else
166#define BUILD_TRAP_HANDLER(name) \
167asmlinkage void name##_trap_handler(unsigned int vec, struct pt_regs *regs)
168#define TRAP_HANDLER_DECL
169#endif
170
171BUILD_TRAP_HANDLER(address_error);
172BUILD_TRAP_HANDLER(debug);
173BUILD_TRAP_HANDLER(bug);
174BUILD_TRAP_HANDLER(fpu_error);
175BUILD_TRAP_HANDLER(fpu_state_restore);
176
177#define arch_align_stack(x) (x)
178
179struct mem_access {
180 unsigned long (*from)(void *dst, const void *src, unsigned long cnt);
181 unsigned long (*to)(void *dst, const void *src, unsigned long cnt);
182};
183
184#ifdef CONFIG_SUPERH32
185# include "system_32.h"
186#else
187# include "system_64.h"
188#endif
189
190#endif
diff --git a/include/asm-sh/system_32.h b/arch/sh/include/asm/system_32.h
index f11bcf0855ed..f11bcf0855ed 100644
--- a/include/asm-sh/system_32.h
+++ b/arch/sh/include/asm/system_32.h
diff --git a/include/asm-sh/system_64.h b/arch/sh/include/asm/system_64.h
index 943acf5ea07c..943acf5ea07c 100644
--- a/include/asm-sh/system_64.h
+++ b/arch/sh/include/asm/system_64.h
diff --git a/include/asm-sh/systemh7751.h b/arch/sh/include/asm/systemh7751.h
index 4161122c84ef..4161122c84ef 100644
--- a/include/asm-sh/systemh7751.h
+++ b/arch/sh/include/asm/systemh7751.h
diff --git a/include/asm-sh/termbits.h b/arch/sh/include/asm/termbits.h
index 77db116948cf..77db116948cf 100644
--- a/include/asm-sh/termbits.h
+++ b/arch/sh/include/asm/termbits.h
diff --git a/include/asm-sh/termios.h b/arch/sh/include/asm/termios.h
index 0a8c793c76f2..0a8c793c76f2 100644
--- a/include/asm-sh/termios.h
+++ b/arch/sh/include/asm/termios.h
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
new file mode 100644
index 000000000000..eeb4c747119e
--- /dev/null
+++ b/arch/sh/include/asm/thread_info.h
@@ -0,0 +1,141 @@
1#ifndef __ASM_SH_THREAD_INFO_H
2#define __ASM_SH_THREAD_INFO_H
3
4/* SuperH version
5 * Copyright (C) 2002 Niibe Yutaka
6 *
7 * The copyright of original i386 version is:
8 *
9 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
10 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
11 */
12#ifdef __KERNEL__
13#include <asm/page.h>
14
15#ifndef __ASSEMBLY__
16#include <asm/processor.h>
17
18struct thread_info {
19 struct task_struct *task; /* main task structure */
20 struct exec_domain *exec_domain; /* execution domain */
21 unsigned long flags; /* low level flags */
22 __u32 cpu;
23 int preempt_count; /* 0 => preemptable, <0 => BUG */
24 mm_segment_t addr_limit; /* thread address space */
25 struct restart_block restart_block;
26 unsigned long previous_sp; /* sp of previous stack in case
27 of nested IRQ stacks */
28 __u8 supervisor_stack[0];
29};
30
31#endif
32
33#define PREEMPT_ACTIVE 0x10000000
34
35#if defined(CONFIG_4KSTACKS)
36#define THREAD_SIZE_ORDER (0)
37#elif defined(CONFIG_PAGE_SIZE_4KB)
38#define THREAD_SIZE_ORDER (1)
39#elif defined(CONFIG_PAGE_SIZE_8KB)
40#define THREAD_SIZE_ORDER (1)
41#elif defined(CONFIG_PAGE_SIZE_16KB)
42#define THREAD_SIZE_ORDER (0)
43#elif defined(CONFIG_PAGE_SIZE_64KB)
44#define THREAD_SIZE_ORDER (0)
45#else
46#error "Unknown thread size"
47#endif
48
49#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
50#define STACK_WARN (THREAD_SIZE >> 3)
51
52/*
53 * macros/functions for gaining access to the thread information structure
54 */
55#ifndef __ASSEMBLY__
56#define INIT_THREAD_INFO(tsk) \
57{ \
58 .task = &tsk, \
59 .exec_domain = &default_exec_domain, \
60 .flags = 0, \
61 .cpu = 0, \
62 .preempt_count = 1, \
63 .addr_limit = KERNEL_DS, \
64 .restart_block = { \
65 .fn = do_no_restart_syscall, \
66 }, \
67}
68
69#define init_thread_info (init_thread_union.thread_info)
70#define init_stack (init_thread_union.stack)
71
72/* how to get the current stack pointer from C */
73register unsigned long current_stack_pointer asm("r15") __used;
74
75/* how to get the thread information struct from C */
76static inline struct thread_info *current_thread_info(void)
77{
78 struct thread_info *ti;
79#if defined(CONFIG_SUPERH64)
80 __asm__ __volatile__ ("getcon cr17, %0" : "=r" (ti));
81#elif defined(CONFIG_CPU_HAS_SR_RB)
82 __asm__ __volatile__ ("stc r7_bank, %0" : "=r" (ti));
83#else
84 unsigned long __dummy;
85
86 __asm__ __volatile__ (
87 "mov r15, %0\n\t"
88 "and %1, %0\n\t"
89 : "=&r" (ti), "=r" (__dummy)
90 : "1" (~(THREAD_SIZE - 1))
91 : "memory");
92#endif
93
94 return ti;
95}
96
97#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
98
99/* thread information allocation */
100#ifdef CONFIG_DEBUG_STACK_USAGE
101#define alloc_thread_info(ti) kzalloc(THREAD_SIZE, GFP_KERNEL)
102#else
103#define alloc_thread_info(ti) kmalloc(THREAD_SIZE, GFP_KERNEL)
104#endif
105#define free_thread_info(ti) kfree(ti)
106
107#endif /* __ASSEMBLY__ */
108
109/*
110 * thread information flags
111 * - these are process state flags that various assembly files may need to access
112 * - pending work-to-be-done flags are in LSW
113 * - other flags in MSW
114 */
115#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
116#define TIF_SIGPENDING 1 /* signal pending */
117#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
118#define TIF_RESTORE_SIGMASK 3 /* restore signal mask in do_signal() */
119#define TIF_SINGLESTEP 4 /* singlestepping active */
120#define TIF_SYSCALL_AUDIT 5
121#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
122#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
123#define TIF_MEMDIE 18
124#define TIF_FREEZE 19
125
126#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
127#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
128#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
129#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
130#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
131#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
132#define _TIF_USEDFPU (1<<TIF_USEDFPU)
133#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
134#define _TIF_FREEZE (1<<TIF_FREEZE)
135
136#define _TIF_WORK_MASK 0x000000FE /* work to do on interrupt/exception return */
137#define _TIF_ALLWORK_MASK 0x000000FF /* work to do on any return to u-space */
138
139#endif /* __KERNEL__ */
140
141#endif /* __ASM_SH_THREAD_INFO_H */
diff --git a/arch/sh/include/asm/timer.h b/arch/sh/include/asm/timer.h
new file mode 100644
index 000000000000..a7ca3a195bb5
--- /dev/null
+++ b/arch/sh/include/asm/timer.h
@@ -0,0 +1,44 @@
1#ifndef __ASM_SH_TIMER_H
2#define __ASM_SH_TIMER_H
3
4#include <linux/sysdev.h>
5#include <linux/clocksource.h>
6#include <cpu/timer.h>
7
8struct sys_timer_ops {
9 int (*init)(void);
10 int (*start)(void);
11 int (*stop)(void);
12 cycle_t (*read)(void);
13#ifndef CONFIG_GENERIC_TIME
14 unsigned long (*get_offset)(void);
15#endif
16};
17
18struct sys_timer {
19 const char *name;
20
21 struct sys_device dev;
22 struct sys_timer_ops *ops;
23};
24
25#define TICK_SIZE (tick_nsec / 1000)
26
27extern struct sys_timer tmu_timer, cmt_timer, mtu2_timer;
28extern struct sys_timer *sys_timer;
29
30#ifndef CONFIG_GENERIC_TIME
31static inline unsigned long get_timer_offset(void)
32{
33 return sys_timer->ops->get_offset();
34}
35#endif
36
37/* arch/sh/kernel/timers/timer.c */
38struct sys_timer *get_sys_timer(void);
39
40/* arch/sh/kernel/time.c */
41void handle_timer_tick(void);
42extern unsigned long sh_hpt_frequency;
43
44#endif /* __ASM_SH_TIMER_H */
diff --git a/include/asm-sh/timex.h b/arch/sh/include/asm/timex.h
index a873e24113cf..a873e24113cf 100644
--- a/include/asm-sh/timex.h
+++ b/arch/sh/include/asm/timex.h
diff --git a/include/asm-sh/titan.h b/arch/sh/include/asm/titan.h
index 03f3583c8918..03f3583c8918 100644
--- a/include/asm-sh/titan.h
+++ b/arch/sh/include/asm/titan.h
diff --git a/include/asm-sh/tlb.h b/arch/sh/include/asm/tlb.h
index 88ff1ae8a6b8..88ff1ae8a6b8 100644
--- a/include/asm-sh/tlb.h
+++ b/arch/sh/include/asm/tlb.h
diff --git a/include/asm-sh/tlb_64.h b/arch/sh/include/asm/tlb_64.h
index 0a96f3af69e3..0a96f3af69e3 100644
--- a/include/asm-sh/tlb_64.h
+++ b/arch/sh/include/asm/tlb_64.h
diff --git a/include/asm-sh/tlbflush.h b/arch/sh/include/asm/tlbflush.h
index e0ac97221ae6..e0ac97221ae6 100644
--- a/include/asm-sh/tlbflush.h
+++ b/arch/sh/include/asm/tlbflush.h
diff --git a/include/asm-sh/topology.h b/arch/sh/include/asm/topology.h
index 95f0085e098a..95f0085e098a 100644
--- a/include/asm-sh/topology.h
+++ b/arch/sh/include/asm/topology.h
diff --git a/include/asm-sh/types.h b/arch/sh/include/asm/types.h
index beea4e6f8dfd..beea4e6f8dfd 100644
--- a/include/asm-sh/types.h
+++ b/arch/sh/include/asm/types.h
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h
new file mode 100644
index 000000000000..075848f43b6a
--- /dev/null
+++ b/arch/sh/include/asm/uaccess.h
@@ -0,0 +1,258 @@
1#ifndef __ASM_SH_UACCESS_H
2#define __ASM_SH_UACCESS_H
3
4#include <linux/errno.h>
5#include <linux/sched.h>
6#include <asm/segment.h>
7
8#define VERIFY_READ 0
9#define VERIFY_WRITE 1
10
11#define __addr_ok(addr) \
12 ((unsigned long __force)(addr) < current_thread_info()->addr_limit.seg)
13
14/*
15 * __access_ok: Check if address with size is OK or not.
16 *
17 * Uhhuh, this needs 33-bit arithmetic. We have a carry..
18 *
19 * sum := addr + size; carry? --> flag = true;
20 * if (sum >= addr_limit) flag = true;
21 */
22#define __access_ok(addr, size) \
23 (__addr_ok((addr) + (size)))
24#define access_ok(type, addr, size) \
25 (__chk_user_ptr(addr), \
26 __access_ok((unsigned long __force)(addr), (size)))
27
28/*
29 * Uh, these should become the main single-value transfer routines ...
30 * They automatically use the right size if we just have the right
31 * pointer type ...
32 *
33 * As SuperH uses the same address space for kernel and user data, we
34 * can just do these as direct assignments.
35 *
36 * Careful to not
37 * (a) re-use the arguments for side effects (sizeof is ok)
38 * (b) require any knowledge of processes at this stage
39 */
40#define put_user(x,ptr) __put_user_check((x), (ptr), sizeof(*(ptr)))
41#define get_user(x,ptr) __get_user_check((x), (ptr), sizeof(*(ptr)))
42
43/*
44 * The "__xxx" versions do not do address space checking, useful when
45 * doing multiple accesses to the same area (the user has to do the
46 * checks by hand with "access_ok()")
47 */
48#define __put_user(x,ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
49#define __get_user(x,ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
50
51struct __large_struct { unsigned long buf[100]; };
52#define __m(x) (*(struct __large_struct __user *)(x))
53
54#define __get_user_nocheck(x,ptr,size) \
55({ \
56 long __gu_err; \
57 unsigned long __gu_val; \
58 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
59 __chk_user_ptr(ptr); \
60 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
61 (x) = (__typeof__(*(ptr)))__gu_val; \
62 __gu_err; \
63})
64
65#define __get_user_check(x,ptr,size) \
66({ \
67 long __gu_err = -EFAULT; \
68 unsigned long __gu_val = 0; \
69 const __typeof__(*(ptr)) *__gu_addr = (ptr); \
70 if (likely(access_ok(VERIFY_READ, __gu_addr, (size)))) \
71 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
72 (x) = (__typeof__(*(ptr)))__gu_val; \
73 __gu_err; \
74})
75
76#define __put_user_nocheck(x,ptr,size) \
77({ \
78 long __pu_err; \
79 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
80 __typeof__(*(ptr)) __pu_val = x; \
81 __chk_user_ptr(ptr); \
82 __put_user_size(__pu_val, __pu_addr, (size), __pu_err); \
83 __pu_err; \
84})
85
86#define __put_user_check(x,ptr,size) \
87({ \
88 long __pu_err = -EFAULT; \
89 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
90 __typeof__(*(ptr)) __pu_val = x; \
91 if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) \
92 __put_user_size(__pu_val, __pu_addr, (size), \
93 __pu_err); \
94 __pu_err; \
95})
96
97#ifdef CONFIG_SUPERH32
98# include "uaccess_32.h"
99#else
100# include "uaccess_64.h"
101#endif
102
103/* Generic arbitrary sized copy. */
104/* Return the number of bytes NOT copied */
105__kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n);
106
107static __always_inline unsigned long
108__copy_from_user(void *to, const void __user *from, unsigned long n)
109{
110 return __copy_user(to, (__force void *)from, n);
111}
112
113static __always_inline unsigned long __must_check
114__copy_to_user(void __user *to, const void *from, unsigned long n)
115{
116 return __copy_user((__force void *)to, from, n);
117}
118
119#define __copy_to_user_inatomic __copy_to_user
120#define __copy_from_user_inatomic __copy_from_user
121
122/*
123 * Clear the area and return remaining number of bytes
124 * (on failure. Usually it's 0.)
125 */
126__kernel_size_t __clear_user(void *addr, __kernel_size_t size);
127
128#define clear_user(addr,n) \
129({ \
130 void __user * __cl_addr = (addr); \
131 unsigned long __cl_size = (n); \
132 \
133 if (__cl_size && access_ok(VERIFY_WRITE, \
134 ((unsigned long)(__cl_addr)), __cl_size)) \
135 __cl_size = __clear_user(__cl_addr, __cl_size); \
136 \
137 __cl_size; \
138})
139
140/**
141 * strncpy_from_user: - Copy a NUL terminated string from userspace.
142 * @dst: Destination address, in kernel space. This buffer must be at
143 * least @count bytes long.
144 * @src: Source address, in user space.
145 * @count: Maximum number of bytes to copy, including the trailing NUL.
146 *
147 * Copies a NUL-terminated string from userspace to kernel space.
148 *
149 * On success, returns the length of the string (not including the trailing
150 * NUL).
151 *
152 * If access to userspace fails, returns -EFAULT (some data may have been
153 * copied).
154 *
155 * If @count is smaller than the length of the string, copies @count bytes
156 * and returns @count.
157 */
158#define strncpy_from_user(dest,src,count) \
159({ \
160 unsigned long __sfu_src = (unsigned long)(src); \
161 int __sfu_count = (int)(count); \
162 long __sfu_res = -EFAULT; \
163 \
164 if (__access_ok(__sfu_src, __sfu_count)) \
165 __sfu_res = __strncpy_from_user((unsigned long)(dest), \
166 __sfu_src, __sfu_count); \
167 \
168 __sfu_res; \
169})
170
171static inline unsigned long
172copy_from_user(void *to, const void __user *from, unsigned long n)
173{
174 unsigned long __copy_from = (unsigned long) from;
175 __kernel_size_t __copy_size = (__kernel_size_t) n;
176
177 if (__copy_size && __access_ok(__copy_from, __copy_size))
178 return __copy_user(to, from, __copy_size);
179
180 return __copy_size;
181}
182
183static inline unsigned long
184copy_to_user(void __user *to, const void *from, unsigned long n)
185{
186 unsigned long __copy_to = (unsigned long) to;
187 __kernel_size_t __copy_size = (__kernel_size_t) n;
188
189 if (__copy_size && __access_ok(__copy_to, __copy_size))
190 return __copy_user(to, from, __copy_size);
191
192 return __copy_size;
193}
194
195/**
196 * strnlen_user: - Get the size of a string in user space.
197 * @s: The string to measure.
198 * @n: The maximum valid length
199 *
200 * Context: User context only. This function may sleep.
201 *
202 * Get the size of a NUL-terminated string in user space.
203 *
204 * Returns the size of the string INCLUDING the terminating NUL.
205 * On exception, returns 0.
206 * If the string is too long, returns a value greater than @n.
207 */
208static inline long strnlen_user(const char __user *s, long n)
209{
210 if (!__addr_ok(s))
211 return 0;
212 else
213 return __strnlen_user(s, n);
214}
215
216/**
217 * strlen_user: - Get the size of a string in user space.
218 * @str: The string to measure.
219 *
220 * Context: User context only. This function may sleep.
221 *
222 * Get the size of a NUL-terminated string in user space.
223 *
224 * Returns the size of the string INCLUDING the terminating NUL.
225 * On exception, returns 0.
226 *
227 * If there is a limit on the length of a valid string, you may wish to
228 * consider using strnlen_user() instead.
229 */
230#define strlen_user(str) strnlen_user(str, ~0UL >> 1)
231
232/*
233 * The exception table consists of pairs of addresses: the first is the
234 * address of an instruction that is allowed to fault, and the second is
235 * the address at which the program should continue. No registers are
236 * modified, so it is entirely up to the continuation code to figure out
237 * what to do.
238 *
239 * All the routines below use bits of fixup code that are out of line
240 * with the main instruction path. This means when everything is well,
241 * we don't even have to jump over them. Further, they do not intrude
242 * on our cache or tlb entries.
243 */
244struct exception_table_entry {
245 unsigned long insn, fixup;
246};
247
248#if defined(CONFIG_SUPERH64) && defined(CONFIG_MMU)
249#define ARCH_HAS_SEARCH_EXTABLE
250#endif
251
252int fixup_exception(struct pt_regs *regs);
253/* Returns 0 if exception not found and fixup.unit otherwise. */
254unsigned long search_exception_table(unsigned long addr);
255const struct exception_table_entry *search_exception_tables(unsigned long addr);
256
257
258#endif /* __ASM_SH_UACCESS_H */
diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h
new file mode 100644
index 000000000000..ae0d24f6653f
--- /dev/null
+++ b/arch/sh/include/asm/uaccess_32.h
@@ -0,0 +1,248 @@
1/*
2 * User space memory access functions
3 *
4 * Copyright (C) 1999, 2002 Niibe Yutaka
5 * Copyright (C) 2003 - 2008 Paul Mundt
6 *
7 * Based on:
8 * MIPS implementation version 1.15 by
9 * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
10 * and i386 version.
11 */
12#ifndef __ASM_SH_UACCESS_32_H
13#define __ASM_SH_UACCESS_32_H
14
15#define __get_user_size(x,ptr,size,retval) \
16do { \
17 retval = 0; \
18 switch (size) { \
19 case 1: \
20 __get_user_asm(x, ptr, retval, "b"); \
21 break; \
22 case 2: \
23 __get_user_asm(x, ptr, retval, "w"); \
24 break; \
25 case 4: \
26 __get_user_asm(x, ptr, retval, "l"); \
27 break; \
28 default: \
29 __get_user_unknown(); \
30 break; \
31 } \
32} while (0)
33
34#ifdef CONFIG_MMU
35#define __get_user_asm(x, addr, err, insn) \
36({ \
37__asm__ __volatile__( \
38 "1:\n\t" \
39 "mov." insn " %2, %1\n\t" \
40 "2:\n" \
41 ".section .fixup,\"ax\"\n" \
42 "3:\n\t" \
43 "mov #0, %1\n\t" \
44 "mov.l 4f, %0\n\t" \
45 "jmp @%0\n\t" \
46 " mov %3, %0\n\t" \
47 ".balign 4\n" \
48 "4: .long 2b\n\t" \
49 ".previous\n" \
50 ".section __ex_table,\"a\"\n\t" \
51 ".long 1b, 3b\n\t" \
52 ".previous" \
53 :"=&r" (err), "=&r" (x) \
54 :"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
55#else
56#define __get_user_asm(x, addr, err, insn) \
57do { \
58 __asm__ __volatile__ ( \
59 "mov." insn " %1, %0\n\t" \
60 : "=&r" (x) \
61 : "m" (__m(addr)) \
62 ); \
63} while (0)
64#endif /* CONFIG_MMU */
65
66extern void __get_user_unknown(void);
67
68#define __put_user_size(x,ptr,size,retval) \
69do { \
70 retval = 0; \
71 switch (size) { \
72 case 1: \
73 __put_user_asm(x, ptr, retval, "b"); \
74 break; \
75 case 2: \
76 __put_user_asm(x, ptr, retval, "w"); \
77 break; \
78 case 4: \
79 __put_user_asm(x, ptr, retval, "l"); \
80 break; \
81 case 8: \
82 __put_user_u64(x, ptr, retval); \
83 break; \
84 default: \
85 __put_user_unknown(); \
86 } \
87} while (0)
88
89#ifdef CONFIG_MMU
90#define __put_user_asm(x, addr, err, insn) \
91do { \
92 __asm__ __volatile__ ( \
93 "1:\n\t" \
94 "mov." insn " %1, %2\n\t" \
95 "2:\n" \
96 ".section .fixup,\"ax\"\n" \
97 "3:\n\t" \
98 "mov.l 4f, %0\n\t" \
99 "jmp @%0\n\t" \
100 " mov %3, %0\n\t" \
101 ".balign 4\n" \
102 "4: .long 2b\n\t" \
103 ".previous\n" \
104 ".section __ex_table,\"a\"\n\t" \
105 ".long 1b, 3b\n\t" \
106 ".previous" \
107 : "=&r" (err) \
108 : "r" (x), "m" (__m(addr)), "i" (-EFAULT), \
109 "0" (err) \
110 : "memory" \
111 ); \
112} while (0)
113#else
114#define __put_user_asm(x, addr, err, insn) \
115do { \
116 __asm__ __volatile__ ( \
117 "mov." insn " %0, %1\n\t" \
118 : /* no outputs */ \
119 : "r" (x), "m" (__m(addr)) \
120 : "memory" \
121 ); \
122} while (0)
123#endif /* CONFIG_MMU */
124
125#if defined(CONFIG_CPU_LITTLE_ENDIAN)
126#define __put_user_u64(val,addr,retval) \
127({ \
128__asm__ __volatile__( \
129 "1:\n\t" \
130 "mov.l %R1,%2\n\t" \
131 "mov.l %S1,%T2\n\t" \
132 "2:\n" \
133 ".section .fixup,\"ax\"\n" \
134 "3:\n\t" \
135 "mov.l 4f,%0\n\t" \
136 "jmp @%0\n\t" \
137 " mov %3,%0\n\t" \
138 ".balign 4\n" \
139 "4: .long 2b\n\t" \
140 ".previous\n" \
141 ".section __ex_table,\"a\"\n\t" \
142 ".long 1b, 3b\n\t" \
143 ".previous" \
144 : "=r" (retval) \
145 : "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
146 : "memory"); })
147#else
148#define __put_user_u64(val,addr,retval) \
149({ \
150__asm__ __volatile__( \
151 "1:\n\t" \
152 "mov.l %S1,%2\n\t" \
153 "mov.l %R1,%T2\n\t" \
154 "2:\n" \
155 ".section .fixup,\"ax\"\n" \
156 "3:\n\t" \
157 "mov.l 4f,%0\n\t" \
158 "jmp @%0\n\t" \
159 " mov %3,%0\n\t" \
160 ".balign 4\n" \
161 "4: .long 2b\n\t" \
162 ".previous\n" \
163 ".section __ex_table,\"a\"\n\t" \
164 ".long 1b, 3b\n\t" \
165 ".previous" \
166 : "=r" (retval) \
167 : "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
168 : "memory"); })
169#endif
170
171extern void __put_user_unknown(void);
172
173static inline int
174__strncpy_from_user(unsigned long __dest, unsigned long __user __src, int __count)
175{
176 __kernel_size_t res;
177 unsigned long __dummy, _d, _s, _c;
178
179 __asm__ __volatile__(
180 "9:\n"
181 "mov.b @%2+, %1\n\t"
182 "cmp/eq #0, %1\n\t"
183 "bt/s 2f\n"
184 "1:\n"
185 "mov.b %1, @%3\n\t"
186 "dt %4\n\t"
187 "bf/s 9b\n\t"
188 " add #1, %3\n\t"
189 "2:\n\t"
190 "sub %4, %0\n"
191 "3:\n"
192 ".section .fixup,\"ax\"\n"
193 "4:\n\t"
194 "mov.l 5f, %1\n\t"
195 "jmp @%1\n\t"
196 " mov %9, %0\n\t"
197 ".balign 4\n"
198 "5: .long 3b\n"
199 ".previous\n"
200 ".section __ex_table,\"a\"\n"
201 " .balign 4\n"
202 " .long 9b,4b\n"
203 ".previous"
204 : "=r" (res), "=&z" (__dummy), "=r" (_s), "=r" (_d), "=r"(_c)
205 : "0" (__count), "2" (__src), "3" (__dest), "4" (__count),
206 "i" (-EFAULT)
207 : "memory", "t");
208
209 return res;
210}
211
212/*
213 * Return the size of a string (including the ending 0 even when we have
214 * exceeded the maximum string length).
215 */
216static inline long __strnlen_user(const char __user *__s, long __n)
217{
218 unsigned long res;
219 unsigned long __dummy;
220
221 __asm__ __volatile__(
222 "1:\t"
223 "mov.b @(%0,%3), %1\n\t"
224 "cmp/eq %4, %0\n\t"
225 "bt/s 2f\n\t"
226 " add #1, %0\n\t"
227 "tst %1, %1\n\t"
228 "bf 1b\n\t"
229 "2:\n"
230 ".section .fixup,\"ax\"\n"
231 "3:\n\t"
232 "mov.l 4f, %1\n\t"
233 "jmp @%1\n\t"
234 " mov #0, %0\n"
235 ".balign 4\n"
236 "4: .long 2b\n"
237 ".previous\n"
238 ".section __ex_table,\"a\"\n"
239 " .balign 4\n"
240 " .long 1b,3b\n"
241 ".previous"
242 : "=z" (res), "=&r" (__dummy)
243 : "0" (0), "r" (__s), "r" (__n)
244 : "t");
245 return res;
246}
247
248#endif /* __ASM_SH_UACCESS_32_H */
diff --git a/arch/sh/include/asm/uaccess_64.h b/arch/sh/include/asm/uaccess_64.h
new file mode 100644
index 000000000000..81b3d515fcb3
--- /dev/null
+++ b/arch/sh/include/asm/uaccess_64.h
@@ -0,0 +1,79 @@
1#ifndef __ASM_SH_UACCESS_64_H
2#define __ASM_SH_UACCESS_64_H
3
4/*
5 * include/asm-sh/uaccess_64.h
6 *
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 * Copyright (C) 2003, 2004 Paul Mundt
9 *
10 * User space memory access functions
11 *
12 * Copyright (C) 1999 Niibe Yutaka
13 *
14 * Based on:
15 * MIPS implementation version 1.15 by
16 * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
17 * and i386 version.
18 *
19 * This file is subject to the terms and conditions of the GNU General Public
20 * License. See the file "COPYING" in the main directory of this archive
21 * for more details.
22 */
23
24#define __get_user_size(x,ptr,size,retval) \
25do { \
26 retval = 0; \
27 switch (size) { \
28 case 1: \
29 retval = __get_user_asm_b(x, ptr); \
30 break; \
31 case 2: \
32 retval = __get_user_asm_w(x, ptr); \
33 break; \
34 case 4: \
35 retval = __get_user_asm_l(x, ptr); \
36 break; \
37 case 8: \
38 retval = __get_user_asm_q(x, ptr); \
39 break; \
40 default: \
41 __get_user_unknown(); \
42 break; \
43 } \
44} while (0)
45
46extern long __get_user_asm_b(void *, long);
47extern long __get_user_asm_w(void *, long);
48extern long __get_user_asm_l(void *, long);
49extern long __get_user_asm_q(void *, long);
50extern void __get_user_unknown(void);
51
52#define __put_user_size(x,ptr,size,retval) \
53do { \
54 retval = 0; \
55 switch (size) { \
56 case 1: \
57 retval = __put_user_asm_b(x, ptr); \
58 break; \
59 case 2: \
60 retval = __put_user_asm_w(x, ptr); \
61 break; \
62 case 4: \
63 retval = __put_user_asm_l(x, ptr); \
64 break; \
65 case 8: \
66 retval = __put_user_asm_q(x, ptr); \
67 break; \
68 default: \
69 __put_user_unknown(); \
70 } \
71} while (0)
72
73extern long __put_user_asm_b(void *, long);
74extern long __put_user_asm_w(void *, long);
75extern long __put_user_asm_l(void *, long);
76extern long __put_user_asm_q(void *, long);
77extern void __put_user_unknown(void);
78
79#endif /* __ASM_SH_UACCESS_64_H */
diff --git a/arch/sh/include/asm/ubc.h b/arch/sh/include/asm/ubc.h
new file mode 100644
index 000000000000..a7b9028bbfbb
--- /dev/null
+++ b/arch/sh/include/asm/ubc.h
@@ -0,0 +1,64 @@
1/*
2 * include/asm-sh/ubc.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2002, 2003 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#ifndef __ASM_SH_UBC_H
12#define __ASM_SH_UBC_H
13#ifdef __KERNEL__
14
15#include <cpu/ubc.h>
16
17/* User Break Controller */
18#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709)
19#define UBC_TYPE_SH7729 (current_cpu_data.type == CPU_SH7729)
20#else
21#define UBC_TYPE_SH7729 0
22#endif
23
24#define BAMR_ASID (1 << 2)
25#define BAMR_NONE 0
26#define BAMR_10 0x1
27#define BAMR_12 0x2
28#define BAMR_ALL 0x3
29#define BAMR_16 0x8
30#define BAMR_20 0x9
31
32#define BBR_INST (1 << 4)
33#define BBR_DATA (2 << 4)
34#define BBR_READ (1 << 2)
35#define BBR_WRITE (2 << 2)
36#define BBR_BYTE 0x1
37#define BBR_HALF 0x2
38#define BBR_LONG 0x3
39#define BBR_QUAD (1 << 6) /* SH7750 */
40#define BBR_CPU (1 << 6) /* SH7709A,SH7729 */
41#define BBR_DMA (2 << 6) /* SH7709A,SH7729 */
42
43#define BRCR_CMFA (1 << 15)
44#define BRCR_CMFB (1 << 14)
45#define BRCR_PCTE (1 << 11)
46#define BRCR_PCBA (1 << 10) /* 1: after execution */
47#define BRCR_DBEB (1 << 7)
48#define BRCR_PCBB (1 << 6)
49#define BRCR_SEQ (1 << 3)
50#define BRCR_UBDE (1 << 0)
51
52#ifndef __ASSEMBLY__
53/* arch/sh/kernel/cpu/ubc.S */
54extern void ubc_sleep(void);
55
56#ifdef CONFIG_UBC_WAKEUP
57extern void ubc_wakeup(void);
58#else
59#define ubc_wakeup() do { } while (0)
60#endif
61#endif
62
63#endif /* __KERNEL__ */
64#endif /* __ASM_SH_UBC_H */
diff --git a/include/asm-sh/ucontext.h b/arch/sh/include/asm/ucontext.h
index 202ef1d5a3c4..202ef1d5a3c4 100644
--- a/include/asm-sh/ucontext.h
+++ b/arch/sh/include/asm/ucontext.h
diff --git a/include/asm-sh/unaligned.h b/arch/sh/include/asm/unaligned.h
index c1641a01d50f..c1641a01d50f 100644
--- a/include/asm-sh/unaligned.h
+++ b/arch/sh/include/asm/unaligned.h
diff --git a/arch/sh/include/asm/unistd.h b/arch/sh/include/asm/unistd.h
new file mode 100644
index 000000000000..65be656ead7d
--- /dev/null
+++ b/arch/sh/include/asm/unistd.h
@@ -0,0 +1,13 @@
1#ifdef __KERNEL__
2# ifdef CONFIG_SUPERH32
3# include "unistd_32.h"
4# else
5# include "unistd_64.h"
6# endif
7#else
8# ifdef __SH5__
9# include "unistd_64.h"
10# else
11# include "unistd_32.h"
12# endif
13#endif
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h
new file mode 100644
index 000000000000..d52c000cf924
--- /dev/null
+++ b/arch/sh/include/asm/unistd_32.h
@@ -0,0 +1,384 @@
1#ifndef __ASM_SH_UNISTD_H
2#define __ASM_SH_UNISTD_H
3
4/*
5 * Copyright (C) 1999 Niibe Yutaka
6 */
7
8/*
9 * This file contains the system call numbers.
10 */
11
12#define __NR_restart_syscall 0
13#define __NR_exit 1
14#define __NR_fork 2
15#define __NR_read 3
16#define __NR_write 4
17#define __NR_open 5
18#define __NR_close 6
19#define __NR_waitpid 7
20#define __NR_creat 8
21#define __NR_link 9
22#define __NR_unlink 10
23#define __NR_execve 11
24#define __NR_chdir 12
25#define __NR_time 13
26#define __NR_mknod 14
27#define __NR_chmod 15
28#define __NR_lchown 16
29#define __NR_break 17
30#define __NR_oldstat 18
31#define __NR_lseek 19
32#define __NR_getpid 20
33#define __NR_mount 21
34#define __NR_umount 22
35#define __NR_setuid 23
36#define __NR_getuid 24
37#define __NR_stime 25
38#define __NR_ptrace 26
39#define __NR_alarm 27
40#define __NR_oldfstat 28
41#define __NR_pause 29
42#define __NR_utime 30
43#define __NR_stty 31
44#define __NR_gtty 32
45#define __NR_access 33
46#define __NR_nice 34
47#define __NR_ftime 35
48#define __NR_sync 36
49#define __NR_kill 37
50#define __NR_rename 38
51#define __NR_mkdir 39
52#define __NR_rmdir 40
53#define __NR_dup 41
54#define __NR_pipe 42
55#define __NR_times 43
56#define __NR_prof 44
57#define __NR_brk 45
58#define __NR_setgid 46
59#define __NR_getgid 47
60#define __NR_signal 48
61#define __NR_geteuid 49
62#define __NR_getegid 50
63#define __NR_acct 51
64#define __NR_umount2 52
65#define __NR_lock 53
66#define __NR_ioctl 54
67#define __NR_fcntl 55
68#define __NR_mpx 56
69#define __NR_setpgid 57
70#define __NR_ulimit 58
71#define __NR_oldolduname 59
72#define __NR_umask 60
73#define __NR_chroot 61
74#define __NR_ustat 62
75#define __NR_dup2 63
76#define __NR_getppid 64
77#define __NR_getpgrp 65
78#define __NR_setsid 66
79#define __NR_sigaction 67
80#define __NR_sgetmask 68
81#define __NR_ssetmask 69
82#define __NR_setreuid 70
83#define __NR_setregid 71
84#define __NR_sigsuspend 72
85#define __NR_sigpending 73
86#define __NR_sethostname 74
87#define __NR_setrlimit 75
88#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
89#define __NR_getrusage 77
90#define __NR_gettimeofday 78
91#define __NR_settimeofday 79
92#define __NR_getgroups 80
93#define __NR_setgroups 81
94#define __NR_select 82
95#define __NR_symlink 83
96#define __NR_oldlstat 84
97#define __NR_readlink 85
98#define __NR_uselib 86
99#define __NR_swapon 87
100#define __NR_reboot 88
101#define __NR_readdir 89
102#define __NR_mmap 90
103#define __NR_munmap 91
104#define __NR_truncate 92
105#define __NR_ftruncate 93
106#define __NR_fchmod 94
107#define __NR_fchown 95
108#define __NR_getpriority 96
109#define __NR_setpriority 97
110#define __NR_profil 98
111#define __NR_statfs 99
112#define __NR_fstatfs 100
113#define __NR_ioperm 101
114#define __NR_socketcall 102
115#define __NR_syslog 103
116#define __NR_setitimer 104
117#define __NR_getitimer 105
118#define __NR_stat 106
119#define __NR_lstat 107
120#define __NR_fstat 108
121#define __NR_olduname 109
122#define __NR_iopl 110
123#define __NR_vhangup 111
124#define __NR_idle 112
125#define __NR_vm86old 113
126#define __NR_wait4 114
127#define __NR_swapoff 115
128#define __NR_sysinfo 116
129#define __NR_ipc 117
130#define __NR_fsync 118
131#define __NR_sigreturn 119
132#define __NR_clone 120
133#define __NR_setdomainname 121
134#define __NR_uname 122
135#define __NR_modify_ldt 123
136#define __NR_adjtimex 124
137#define __NR_mprotect 125
138#define __NR_sigprocmask 126
139#define __NR_create_module 127
140#define __NR_init_module 128
141#define __NR_delete_module 129
142#define __NR_get_kernel_syms 130
143#define __NR_quotactl 131
144#define __NR_getpgid 132
145#define __NR_fchdir 133
146#define __NR_bdflush 134
147#define __NR_sysfs 135
148#define __NR_personality 136
149#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
150#define __NR_setfsuid 138
151#define __NR_setfsgid 139
152#define __NR__llseek 140
153#define __NR_getdents 141
154#define __NR__newselect 142
155#define __NR_flock 143
156#define __NR_msync 144
157#define __NR_readv 145
158#define __NR_writev 146
159#define __NR_getsid 147
160#define __NR_fdatasync 148
161#define __NR__sysctl 149
162#define __NR_mlock 150
163#define __NR_munlock 151
164#define __NR_mlockall 152
165#define __NR_munlockall 153
166#define __NR_sched_setparam 154
167#define __NR_sched_getparam 155
168#define __NR_sched_setscheduler 156
169#define __NR_sched_getscheduler 157
170#define __NR_sched_yield 158
171#define __NR_sched_get_priority_max 159
172#define __NR_sched_get_priority_min 160
173#define __NR_sched_rr_get_interval 161
174#define __NR_nanosleep 162
175#define __NR_mremap 163
176#define __NR_setresuid 164
177#define __NR_getresuid 165
178#define __NR_vm86 166
179#define __NR_query_module 167
180#define __NR_poll 168
181#define __NR_nfsservctl 169
182#define __NR_setresgid 170
183#define __NR_getresgid 171
184#define __NR_prctl 172
185#define __NR_rt_sigreturn 173
186#define __NR_rt_sigaction 174
187#define __NR_rt_sigprocmask 175
188#define __NR_rt_sigpending 176
189#define __NR_rt_sigtimedwait 177
190#define __NR_rt_sigqueueinfo 178
191#define __NR_rt_sigsuspend 179
192#define __NR_pread64 180
193#define __NR_pwrite64 181
194#define __NR_chown 182
195#define __NR_getcwd 183
196#define __NR_capget 184
197#define __NR_capset 185
198#define __NR_sigaltstack 186
199#define __NR_sendfile 187
200#define __NR_streams1 188 /* some people actually want it */
201#define __NR_streams2 189 /* some people actually want it */
202#define __NR_vfork 190
203#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
204#define __NR_mmap2 192
205#define __NR_truncate64 193
206#define __NR_ftruncate64 194
207#define __NR_stat64 195
208#define __NR_lstat64 196
209#define __NR_fstat64 197
210#define __NR_lchown32 198
211#define __NR_getuid32 199
212#define __NR_getgid32 200
213#define __NR_geteuid32 201
214#define __NR_getegid32 202
215#define __NR_setreuid32 203
216#define __NR_setregid32 204
217#define __NR_getgroups32 205
218#define __NR_setgroups32 206
219#define __NR_fchown32 207
220#define __NR_setresuid32 208
221#define __NR_getresuid32 209
222#define __NR_setresgid32 210
223#define __NR_getresgid32 211
224#define __NR_chown32 212
225#define __NR_setuid32 213
226#define __NR_setgid32 214
227#define __NR_setfsuid32 215
228#define __NR_setfsgid32 216
229#define __NR_pivot_root 217
230#define __NR_mincore 218
231#define __NR_madvise 219
232#define __NR_getdents64 220
233#define __NR_fcntl64 221
234/* 223 is unused */
235#define __NR_gettid 224
236#define __NR_readahead 225
237#define __NR_setxattr 226
238#define __NR_lsetxattr 227
239#define __NR_fsetxattr 228
240#define __NR_getxattr 229
241#define __NR_lgetxattr 230
242#define __NR_fgetxattr 231
243#define __NR_listxattr 232
244#define __NR_llistxattr 233
245#define __NR_flistxattr 234
246#define __NR_removexattr 235
247#define __NR_lremovexattr 236
248#define __NR_fremovexattr 237
249#define __NR_tkill 238
250#define __NR_sendfile64 239
251#define __NR_futex 240
252#define __NR_sched_setaffinity 241
253#define __NR_sched_getaffinity 242
254#define __NR_set_thread_area 243
255#define __NR_get_thread_area 244
256#define __NR_io_setup 245
257#define __NR_io_destroy 246
258#define __NR_io_getevents 247
259#define __NR_io_submit 248
260#define __NR_io_cancel 249
261#define __NR_fadvise64 250
262
263#define __NR_exit_group 252
264#define __NR_lookup_dcookie 253
265#define __NR_epoll_create 254
266#define __NR_epoll_ctl 255
267#define __NR_epoll_wait 256
268#define __NR_remap_file_pages 257
269#define __NR_set_tid_address 258
270#define __NR_timer_create 259
271#define __NR_timer_settime (__NR_timer_create+1)
272#define __NR_timer_gettime (__NR_timer_create+2)
273#define __NR_timer_getoverrun (__NR_timer_create+3)
274#define __NR_timer_delete (__NR_timer_create+4)
275#define __NR_clock_settime (__NR_timer_create+5)
276#define __NR_clock_gettime (__NR_timer_create+6)
277#define __NR_clock_getres (__NR_timer_create+7)
278#define __NR_clock_nanosleep (__NR_timer_create+8)
279#define __NR_statfs64 268
280#define __NR_fstatfs64 269
281#define __NR_tgkill 270
282#define __NR_utimes 271
283#define __NR_fadvise64_64 272
284#define __NR_vserver 273
285#define __NR_mbind 274
286#define __NR_get_mempolicy 275
287#define __NR_set_mempolicy 276
288#define __NR_mq_open 277
289#define __NR_mq_unlink (__NR_mq_open+1)
290#define __NR_mq_timedsend (__NR_mq_open+2)
291#define __NR_mq_timedreceive (__NR_mq_open+3)
292#define __NR_mq_notify (__NR_mq_open+4)
293#define __NR_mq_getsetattr (__NR_mq_open+5)
294#define __NR_kexec_load 283
295#define __NR_waitid 284
296#define __NR_add_key 285
297#define __NR_request_key 286
298#define __NR_keyctl 287
299#define __NR_ioprio_set 288
300#define __NR_ioprio_get 289
301#define __NR_inotify_init 290
302#define __NR_inotify_add_watch 291
303#define __NR_inotify_rm_watch 292
304/* 293 is unused */
305#define __NR_migrate_pages 294
306#define __NR_openat 295
307#define __NR_mkdirat 296
308#define __NR_mknodat 297
309#define __NR_fchownat 298
310#define __NR_futimesat 299
311#define __NR_fstatat64 300
312#define __NR_unlinkat 301
313#define __NR_renameat 302
314#define __NR_linkat 303
315#define __NR_symlinkat 304
316#define __NR_readlinkat 305
317#define __NR_fchmodat 306
318#define __NR_faccessat 307
319#define __NR_pselect6 308
320#define __NR_ppoll 309
321#define __NR_unshare 310
322#define __NR_set_robust_list 311
323#define __NR_get_robust_list 312
324#define __NR_splice 313
325#define __NR_sync_file_range 314
326#define __NR_tee 315
327#define __NR_vmsplice 316
328#define __NR_move_pages 317
329#define __NR_getcpu 318
330#define __NR_epoll_pwait 319
331#define __NR_utimensat 320
332#define __NR_signalfd 321
333#define __NR_timerfd_create 322
334#define __NR_eventfd 323
335#define __NR_fallocate 324
336#define __NR_timerfd_settime 325
337#define __NR_timerfd_gettime 326
338#define __NR_signalfd4 327
339#define __NR_eventfd2 328
340#define __NR_epoll_create1 329
341#define __NR_dup3 330
342#define __NR_pipe2 331
343#define __NR_inotify_init1 332
344
345#define NR_syscalls 333
346
347#ifdef __KERNEL__
348
349#define __ARCH_WANT_IPC_PARSE_VERSION
350#define __ARCH_WANT_OLD_READDIR
351#define __ARCH_WANT_OLD_STAT
352#define __ARCH_WANT_STAT64
353#define __ARCH_WANT_SYS_ALARM
354#define __ARCH_WANT_SYS_GETHOSTNAME
355#define __ARCH_WANT_SYS_PAUSE
356#define __ARCH_WANT_SYS_SGETMASK
357#define __ARCH_WANT_SYS_SIGNAL
358#define __ARCH_WANT_SYS_TIME
359#define __ARCH_WANT_SYS_UTIME
360#define __ARCH_WANT_SYS_WAITPID
361#define __ARCH_WANT_SYS_SOCKETCALL
362#define __ARCH_WANT_SYS_FADVISE64
363#define __ARCH_WANT_SYS_GETPGRP
364#define __ARCH_WANT_SYS_LLSEEK
365#define __ARCH_WANT_SYS_NICE
366#define __ARCH_WANT_SYS_OLD_GETRLIMIT
367#define __ARCH_WANT_SYS_OLDUMOUNT
368#define __ARCH_WANT_SYS_SIGPENDING
369#define __ARCH_WANT_SYS_SIGPROCMASK
370#define __ARCH_WANT_SYS_RT_SIGACTION
371#define __ARCH_WANT_SYS_RT_SIGSUSPEND
372
373/*
374 * "Conditional" syscalls
375 *
376 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
377 * but it doesn't work on all toolchains, so we just do it by hand
378 */
379#ifndef cond_syscall
380#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
381#endif
382
383#endif /* __KERNEL__ */
384#endif /* __ASM_SH_UNISTD_H */
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h
new file mode 100644
index 000000000000..7c54e91753c1
--- /dev/null
+++ b/arch/sh/include/asm/unistd_64.h
@@ -0,0 +1,423 @@
1#ifndef __ASM_SH_UNISTD_64_H
2#define __ASM_SH_UNISTD_64_H
3
4/*
5 * include/asm-sh/unistd_64.h
6 *
7 * This file contains the system call numbers.
8 *
9 * Copyright (C) 2000, 2001 Paolo Alberelli
10 * Copyright (C) 2003 - 2007 Paul Mundt
11 * Copyright (C) 2004 Sean McGoogan
12 *
13 * This file is subject to the terms and conditions of the GNU General Public
14 * License. See the file "COPYING" in the main directory of this archive
15 * for more details.
16 */
17#define __NR_restart_syscall 0
18#define __NR_exit 1
19#define __NR_fork 2
20#define __NR_read 3
21#define __NR_write 4
22#define __NR_open 5
23#define __NR_close 6
24#define __NR_waitpid 7
25#define __NR_creat 8
26#define __NR_link 9
27#define __NR_unlink 10
28#define __NR_execve 11
29#define __NR_chdir 12
30#define __NR_time 13
31#define __NR_mknod 14
32#define __NR_chmod 15
33#define __NR_lchown 16
34#define __NR_break 17
35#define __NR_oldstat 18
36#define __NR_lseek 19
37#define __NR_getpid 20
38#define __NR_mount 21
39#define __NR_umount 22
40#define __NR_setuid 23
41#define __NR_getuid 24
42#define __NR_stime 25
43#define __NR_ptrace 26
44#define __NR_alarm 27
45#define __NR_oldfstat 28
46#define __NR_pause 29
47#define __NR_utime 30
48#define __NR_stty 31
49#define __NR_gtty 32
50#define __NR_access 33
51#define __NR_nice 34
52#define __NR_ftime 35
53#define __NR_sync 36
54#define __NR_kill 37
55#define __NR_rename 38
56#define __NR_mkdir 39
57#define __NR_rmdir 40
58#define __NR_dup 41
59#define __NR_pipe 42
60#define __NR_times 43
61#define __NR_prof 44
62#define __NR_brk 45
63#define __NR_setgid 46
64#define __NR_getgid 47
65#define __NR_signal 48
66#define __NR_geteuid 49
67#define __NR_getegid 50
68#define __NR_acct 51
69#define __NR_umount2 52
70#define __NR_lock 53
71#define __NR_ioctl 54
72#define __NR_fcntl 55
73#define __NR_mpx 56
74#define __NR_setpgid 57
75#define __NR_ulimit 58
76#define __NR_oldolduname 59
77#define __NR_umask 60
78#define __NR_chroot 61
79#define __NR_ustat 62
80#define __NR_dup2 63
81#define __NR_getppid 64
82#define __NR_getpgrp 65
83#define __NR_setsid 66
84#define __NR_sigaction 67
85#define __NR_sgetmask 68
86#define __NR_ssetmask 69
87#define __NR_setreuid 70
88#define __NR_setregid 71
89#define __NR_sigsuspend 72
90#define __NR_sigpending 73
91#define __NR_sethostname 74
92#define __NR_setrlimit 75
93#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
94#define __NR_getrusage 77
95#define __NR_gettimeofday 78
96#define __NR_settimeofday 79
97#define __NR_getgroups 80
98#define __NR_setgroups 81
99#define __NR_select 82
100#define __NR_symlink 83
101#define __NR_oldlstat 84
102#define __NR_readlink 85
103#define __NR_uselib 86
104#define __NR_swapon 87
105#define __NR_reboot 88
106#define __NR_readdir 89
107#define __NR_mmap 90
108#define __NR_munmap 91
109#define __NR_truncate 92
110#define __NR_ftruncate 93
111#define __NR_fchmod 94
112#define __NR_fchown 95
113#define __NR_getpriority 96
114#define __NR_setpriority 97
115#define __NR_profil 98
116#define __NR_statfs 99
117#define __NR_fstatfs 100
118#define __NR_ioperm 101
119#define __NR_socketcall 102 /* old implementation of socket systemcall */
120#define __NR_syslog 103
121#define __NR_setitimer 104
122#define __NR_getitimer 105
123#define __NR_stat 106
124#define __NR_lstat 107
125#define __NR_fstat 108
126#define __NR_olduname 109
127#define __NR_iopl 110
128#define __NR_vhangup 111
129#define __NR_idle 112
130#define __NR_vm86old 113
131#define __NR_wait4 114
132#define __NR_swapoff 115
133#define __NR_sysinfo 116
134#define __NR_ipc 117
135#define __NR_fsync 118
136#define __NR_sigreturn 119
137#define __NR_clone 120
138#define __NR_setdomainname 121
139#define __NR_uname 122
140#define __NR_modify_ldt 123
141#define __NR_adjtimex 124
142#define __NR_mprotect 125
143#define __NR_sigprocmask 126
144#define __NR_create_module 127
145#define __NR_init_module 128
146#define __NR_delete_module 129
147#define __NR_get_kernel_syms 130
148#define __NR_quotactl 131
149#define __NR_getpgid 132
150#define __NR_fchdir 133
151#define __NR_bdflush 134
152#define __NR_sysfs 135
153#define __NR_personality 136
154#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
155#define __NR_setfsuid 138
156#define __NR_setfsgid 139
157#define __NR__llseek 140
158#define __NR_getdents 141
159#define __NR__newselect 142
160#define __NR_flock 143
161#define __NR_msync 144
162#define __NR_readv 145
163#define __NR_writev 146
164#define __NR_getsid 147
165#define __NR_fdatasync 148
166#define __NR__sysctl 149
167#define __NR_mlock 150
168#define __NR_munlock 151
169#define __NR_mlockall 152
170#define __NR_munlockall 153
171#define __NR_sched_setparam 154
172#define __NR_sched_getparam 155
173#define __NR_sched_setscheduler 156
174#define __NR_sched_getscheduler 157
175#define __NR_sched_yield 158
176#define __NR_sched_get_priority_max 159
177#define __NR_sched_get_priority_min 160
178#define __NR_sched_rr_get_interval 161
179#define __NR_nanosleep 162
180#define __NR_mremap 163
181#define __NR_setresuid 164
182#define __NR_getresuid 165
183#define __NR_vm86 166
184#define __NR_query_module 167
185#define __NR_poll 168
186#define __NR_nfsservctl 169
187#define __NR_setresgid 170
188#define __NR_getresgid 171
189#define __NR_prctl 172
190#define __NR_rt_sigreturn 173
191#define __NR_rt_sigaction 174
192#define __NR_rt_sigprocmask 175
193#define __NR_rt_sigpending 176
194#define __NR_rt_sigtimedwait 177
195#define __NR_rt_sigqueueinfo 178
196#define __NR_rt_sigsuspend 179
197#define __NR_pread64 180
198#define __NR_pwrite64 181
199#define __NR_chown 182
200#define __NR_getcwd 183
201#define __NR_capget 184
202#define __NR_capset 185
203#define __NR_sigaltstack 186
204#define __NR_sendfile 187
205#define __NR_streams1 188 /* some people actually want it */
206#define __NR_streams2 189 /* some people actually want it */
207#define __NR_vfork 190
208#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
209#define __NR_mmap2 192
210#define __NR_truncate64 193
211#define __NR_ftruncate64 194
212#define __NR_stat64 195
213#define __NR_lstat64 196
214#define __NR_fstat64 197
215#define __NR_lchown32 198
216#define __NR_getuid32 199
217#define __NR_getgid32 200
218#define __NR_geteuid32 201
219#define __NR_getegid32 202
220#define __NR_setreuid32 203
221#define __NR_setregid32 204
222#define __NR_getgroups32 205
223#define __NR_setgroups32 206
224#define __NR_fchown32 207
225#define __NR_setresuid32 208
226#define __NR_getresuid32 209
227#define __NR_setresgid32 210
228#define __NR_getresgid32 211
229#define __NR_chown32 212
230#define __NR_setuid32 213
231#define __NR_setgid32 214
232#define __NR_setfsuid32 215
233#define __NR_setfsgid32 216
234#define __NR_pivot_root 217
235#define __NR_mincore 218
236#define __NR_madvise 219
237
238/* Non-multiplexed socket family */
239#define __NR_socket 220
240#define __NR_bind 221
241#define __NR_connect 222
242#define __NR_listen 223
243#define __NR_accept 224
244#define __NR_getsockname 225
245#define __NR_getpeername 226
246#define __NR_socketpair 227
247#define __NR_send 228
248#define __NR_sendto 229
249#define __NR_recv 230
250#define __NR_recvfrom 231
251#define __NR_shutdown 232
252#define __NR_setsockopt 233
253#define __NR_getsockopt 234
254#define __NR_sendmsg 235
255#define __NR_recvmsg 236
256
257/* Non-multiplexed IPC family */
258#define __NR_semop 237
259#define __NR_semget 238
260#define __NR_semctl 239
261#define __NR_msgsnd 240
262#define __NR_msgrcv 241
263#define __NR_msgget 242
264#define __NR_msgctl 243
265#if 0
266#define __NR_shmatcall 244
267#endif
268#define __NR_shmdt 245
269#define __NR_shmget 246
270#define __NR_shmctl 247
271
272#define __NR_getdents64 248
273#define __NR_fcntl64 249
274/* 223 is unused */
275#define __NR_gettid 252
276#define __NR_readahead 253
277#define __NR_setxattr 254
278#define __NR_lsetxattr 255
279#define __NR_fsetxattr 256
280#define __NR_getxattr 257
281#define __NR_lgetxattr 258
282#define __NR_fgetxattr 269
283#define __NR_listxattr 260
284#define __NR_llistxattr 261
285#define __NR_flistxattr 262
286#define __NR_removexattr 263
287#define __NR_lremovexattr 264
288#define __NR_fremovexattr 265
289#define __NR_tkill 266
290#define __NR_sendfile64 267
291#define __NR_futex 268
292#define __NR_sched_setaffinity 269
293#define __NR_sched_getaffinity 270
294#define __NR_set_thread_area 271
295#define __NR_get_thread_area 272
296#define __NR_io_setup 273
297#define __NR_io_destroy 274
298#define __NR_io_getevents 275
299#define __NR_io_submit 276
300#define __NR_io_cancel 277
301#define __NR_fadvise64 278
302#define __NR_exit_group 280
303
304#define __NR_lookup_dcookie 281
305#define __NR_epoll_create 282
306#define __NR_epoll_ctl 283
307#define __NR_epoll_wait 284
308#define __NR_remap_file_pages 285
309#define __NR_set_tid_address 286
310#define __NR_timer_create 287
311#define __NR_timer_settime (__NR_timer_create+1)
312#define __NR_timer_gettime (__NR_timer_create+2)
313#define __NR_timer_getoverrun (__NR_timer_create+3)
314#define __NR_timer_delete (__NR_timer_create+4)
315#define __NR_clock_settime (__NR_timer_create+5)
316#define __NR_clock_gettime (__NR_timer_create+6)
317#define __NR_clock_getres (__NR_timer_create+7)
318#define __NR_clock_nanosleep (__NR_timer_create+8)
319#define __NR_statfs64 296
320#define __NR_fstatfs64 297
321#define __NR_tgkill 298
322#define __NR_utimes 299
323#define __NR_fadvise64_64 300
324#define __NR_vserver 301
325#define __NR_mbind 302
326#define __NR_get_mempolicy 303
327#define __NR_set_mempolicy 304
328#define __NR_mq_open 305
329#define __NR_mq_unlink (__NR_mq_open+1)
330#define __NR_mq_timedsend (__NR_mq_open+2)
331#define __NR_mq_timedreceive (__NR_mq_open+3)
332#define __NR_mq_notify (__NR_mq_open+4)
333#define __NR_mq_getsetattr (__NR_mq_open+5)
334#define __NR_kexec_load 311
335#define __NR_waitid 312
336#define __NR_add_key 313
337#define __NR_request_key 314
338#define __NR_keyctl 315
339#define __NR_ioprio_set 316
340#define __NR_ioprio_get 317
341#define __NR_inotify_init 318
342#define __NR_inotify_add_watch 319
343#define __NR_inotify_rm_watch 320
344/* 321 is unused */
345#define __NR_migrate_pages 322
346#define __NR_openat 323
347#define __NR_mkdirat 324
348#define __NR_mknodat 325
349#define __NR_fchownat 326
350#define __NR_futimesat 327
351#define __NR_fstatat64 328
352#define __NR_unlinkat 329
353#define __NR_renameat 330
354#define __NR_linkat 331
355#define __NR_symlinkat 332
356#define __NR_readlinkat 333
357#define __NR_fchmodat 334
358#define __NR_faccessat 335
359#define __NR_pselect6 336
360#define __NR_ppoll 337
361#define __NR_unshare 338
362#define __NR_set_robust_list 339
363#define __NR_get_robust_list 340
364#define __NR_splice 341
365#define __NR_sync_file_range 342
366#define __NR_tee 343
367#define __NR_vmsplice 344
368#define __NR_move_pages 345
369#define __NR_getcpu 346
370#define __NR_epoll_pwait 347
371#define __NR_utimensat 348
372#define __NR_signalfd 349
373#define __NR_timerfd_create 350
374#define __NR_eventfd 351
375#define __NR_fallocate 352
376#define __NR_timerfd_settime 353
377#define __NR_timerfd_gettime 354
378#define __NR_signalfd4 355
379#define __NR_eventfd2 356
380#define __NR_epoll_create1 357
381#define __NR_dup3 358
382#define __NR_pipe2 359
383#define __NR_inotify_init1 360
384
385#ifdef __KERNEL__
386
387#define NR_syscalls 361
388
389#define __ARCH_WANT_IPC_PARSE_VERSION
390#define __ARCH_WANT_OLD_READDIR
391#define __ARCH_WANT_OLD_STAT
392#define __ARCH_WANT_STAT64
393#define __ARCH_WANT_SYS_ALARM
394#define __ARCH_WANT_SYS_GETHOSTNAME
395#define __ARCH_WANT_SYS_PAUSE
396#define __ARCH_WANT_SYS_SGETMASK
397#define __ARCH_WANT_SYS_SIGNAL
398#define __ARCH_WANT_SYS_TIME
399#define __ARCH_WANT_SYS_UTIME
400#define __ARCH_WANT_SYS_WAITPID
401#define __ARCH_WANT_SYS_SOCKETCALL
402#define __ARCH_WANT_SYS_FADVISE64
403#define __ARCH_WANT_SYS_GETPGRP
404#define __ARCH_WANT_SYS_LLSEEK
405#define __ARCH_WANT_SYS_NICE
406#define __ARCH_WANT_SYS_OLD_GETRLIMIT
407#define __ARCH_WANT_SYS_OLDUMOUNT
408#define __ARCH_WANT_SYS_SIGPENDING
409#define __ARCH_WANT_SYS_SIGPROCMASK
410#define __ARCH_WANT_SYS_RT_SIGACTION
411
412/*
413 * "Conditional" syscalls
414 *
415 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
416 * but it doesn't work on all toolchains, so we just do it by hand
417 */
418#ifndef cond_syscall
419#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
420#endif
421
422#endif /* __KERNEL__ */
423#endif /* __ASM_SH_UNISTD_64_H */
diff --git a/include/asm-sh/user.h b/arch/sh/include/asm/user.h
index 8fd3cf6c58d4..8fd3cf6c58d4 100644
--- a/include/asm-sh/user.h
+++ b/arch/sh/include/asm/user.h
diff --git a/include/asm-sh/vga.h b/arch/sh/include/asm/vga.h
index 06a5de8ace1a..06a5de8ace1a 100644
--- a/include/asm-sh/vga.h
+++ b/arch/sh/include/asm/vga.h
diff --git a/arch/sh/include/asm/watchdog.h b/arch/sh/include/asm/watchdog.h
new file mode 100644
index 000000000000..f024fed00a72
--- /dev/null
+++ b/arch/sh/include/asm/watchdog.h
@@ -0,0 +1,107 @@
1/*
2 * include/asm-sh/watchdog.h
3 *
4 * Copyright (C) 2002, 2003 Paul Mundt
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11#ifndef __ASM_SH_WATCHDOG_H
12#define __ASM_SH_WATCHDOG_H
13#ifdef __KERNEL__
14
15#include <linux/types.h>
16#include <cpu/watchdog.h>
17#include <asm/io.h>
18
19/*
20 * See cpu-sh2/watchdog.h for explanation of this stupidity..
21 */
22#ifndef WTCNT_R
23# define WTCNT_R WTCNT
24#endif
25
26#ifndef WTCSR_R
27# define WTCSR_R WTCSR
28#endif
29
30#define WTCNT_HIGH 0x5a
31#define WTCSR_HIGH 0xa5
32
33#define WTCSR_CKS2 0x04
34#define WTCSR_CKS1 0x02
35#define WTCSR_CKS0 0x01
36
37/*
38 * CKS0-2 supports a number of clock division ratios. At the time the watchdog
39 * is enabled, it defaults to a 41 usec overflow period .. we overload this to
40 * something a little more reasonable, and really can't deal with anything
41 * lower than WTCSR_CKS_1024, else we drop back into the usec range.
42 *
43 * Clock Division Ratio Overflow Period
44 * --------------------------------------------
45 * 1/32 (initial value) 41 usecs
46 * 1/64 82 usecs
47 * 1/128 164 usecs
48 * 1/256 328 usecs
49 * 1/512 656 usecs
50 * 1/1024 1.31 msecs
51 * 1/2048 2.62 msecs
52 * 1/4096 5.25 msecs
53 */
54#define WTCSR_CKS_32 0x00
55#define WTCSR_CKS_64 0x01
56#define WTCSR_CKS_128 0x02
57#define WTCSR_CKS_256 0x03
58#define WTCSR_CKS_512 0x04
59#define WTCSR_CKS_1024 0x05
60#define WTCSR_CKS_2048 0x06
61#define WTCSR_CKS_4096 0x07
62
63/**
64 * sh_wdt_read_cnt - Read from Counter
65 * Reads back the WTCNT value.
66 */
67static inline __u8 sh_wdt_read_cnt(void)
68{
69 return ctrl_inb(WTCNT_R);
70}
71
72/**
73 * sh_wdt_write_cnt - Write to Counter
74 * @val: Value to write
75 *
76 * Writes the given value @val to the lower byte of the timer counter.
77 * The upper byte is set manually on each write.
78 */
79static inline void sh_wdt_write_cnt(__u8 val)
80{
81 ctrl_outw((WTCNT_HIGH << 8) | (__u16)val, WTCNT);
82}
83
84/**
85 * sh_wdt_read_csr - Read from Control/Status Register
86 *
87 * Reads back the WTCSR value.
88 */
89static inline __u8 sh_wdt_read_csr(void)
90{
91 return ctrl_inb(WTCSR_R);
92}
93
94/**
95 * sh_wdt_write_csr - Write to Control/Status Register
96 * @val: Value to write
97 *
98 * Writes the given value @val to the lower byte of the control/status
99 * register. The upper byte is set manually on each write.
100 */
101static inline void sh_wdt_write_csr(__u8 val)
102{
103 ctrl_outw((WTCSR_HIGH << 8) | (__u16)val, WTCSR);
104}
105
106#endif /* __KERNEL__ */
107#endif /* __ASM_SH_WATCHDOG_H */
diff --git a/include/asm-sh/xor.h b/arch/sh/include/asm/xor.h
index c82eb12a5b18..c82eb12a5b18 100644
--- a/include/asm-sh/xor.h
+++ b/arch/sh/include/asm/xor.h
diff --git a/include/asm-sh/cpu-sh2/addrspace.h b/arch/sh/include/cpu-common/cpu/addrspace.h
index 2b9ab93efa4e..2b9ab93efa4e 100644
--- a/include/asm-sh/cpu-sh2/addrspace.h
+++ b/arch/sh/include/cpu-common/cpu/addrspace.h
diff --git a/arch/sh/include/cpu-common/cpu/cacheflush.h b/arch/sh/include/cpu-common/cpu/cacheflush.h
new file mode 100644
index 000000000000..c3db00b73605
--- /dev/null
+++ b/arch/sh/include/cpu-common/cpu/cacheflush.h
@@ -0,0 +1,44 @@
1/*
2 * include/asm-sh/cpu-sh2/cacheflush.h
3 *
4 * Copyright (C) 2003 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH2_CACHEFLUSH_H
11#define __ASM_CPU_SH2_CACHEFLUSH_H
12
13/*
14 * Cache flushing:
15 *
16 * - flush_cache_all() flushes entire cache
17 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
18 * - flush_cache_dup mm(mm) handles cache flushing when forking
19 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
20 * - flush_cache_range(vma, start, end) flushes a range of pages
21 *
22 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
23 * - flush_icache_range(start, end) flushes(invalidates) a range for icache
24 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
25 *
26 * Caches are indexed (effectively) by physical address on SH-2, so
27 * we don't need them.
28 */
29#define flush_cache_all() do { } while (0)
30#define flush_cache_mm(mm) do { } while (0)
31#define flush_cache_dup_mm(mm) do { } while (0)
32#define flush_cache_range(vma, start, end) do { } while (0)
33#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
34#define flush_dcache_page(page) do { } while (0)
35#define flush_dcache_mmap_lock(mapping) do { } while (0)
36#define flush_dcache_mmap_unlock(mapping) do { } while (0)
37#define flush_icache_range(start, end) do { } while (0)
38#define flush_icache_page(vma,pg) do { } while (0)
39#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
40#define flush_cache_sigtramp(vaddr) do { } while (0)
41
42#define p3_cache_init() do { } while (0)
43
44#endif /* __ASM_CPU_SH2_CACHEFLUSH_H */
diff --git a/include/asm-sh/cpu-sh2/mmu_context.h b/arch/sh/include/cpu-common/cpu/mmu_context.h
index beeb299e01ec..beeb299e01ec 100644
--- a/include/asm-sh/cpu-sh2/mmu_context.h
+++ b/arch/sh/include/cpu-common/cpu/mmu_context.h
diff --git a/include/asm-sh/cpu-sh2/rtc.h b/arch/sh/include/cpu-common/cpu/rtc.h
index 39e2d6e94782..39e2d6e94782 100644
--- a/include/asm-sh/cpu-sh2/rtc.h
+++ b/arch/sh/include/cpu-common/cpu/rtc.h
diff --git a/include/asm-sh/cpu-sh2/sigcontext.h b/arch/sh/include/cpu-common/cpu/sigcontext.h
index fe5c15dd6e87..fe5c15dd6e87 100644
--- a/include/asm-sh/cpu-sh2/sigcontext.h
+++ b/arch/sh/include/cpu-common/cpu/sigcontext.h
diff --git a/include/asm-sh/cpu-sh2/timer.h b/arch/sh/include/cpu-common/cpu/timer.h
index a39c241e8195..a39c241e8195 100644
--- a/include/asm-sh/cpu-sh2/timer.h
+++ b/arch/sh/include/cpu-common/cpu/timer.h
diff --git a/include/asm-sh/cpu-sh2/cache.h b/arch/sh/include/cpu-sh2/cpu/cache.h
index 4e0b16500686..4e0b16500686 100644
--- a/include/asm-sh/cpu-sh2/cache.h
+++ b/arch/sh/include/cpu-sh2/cpu/cache.h
diff --git a/include/asm-sh/cpu-sh2/dma.h b/arch/sh/include/cpu-sh2/cpu/dma.h
index d66b43cdc637..d66b43cdc637 100644
--- a/include/asm-sh/cpu-sh2/dma.h
+++ b/arch/sh/include/cpu-sh2/cpu/dma.h
diff --git a/include/asm-sh/cpu-sh2/freq.h b/arch/sh/include/cpu-sh2/cpu/freq.h
index 31de475da70b..31de475da70b 100644
--- a/include/asm-sh/cpu-sh2/freq.h
+++ b/arch/sh/include/cpu-sh2/cpu/freq.h
diff --git a/include/asm-sh/cpu-sh2/ubc.h b/arch/sh/include/cpu-sh2/cpu/ubc.h
index ba0e87f19c7a..ba0e87f19c7a 100644
--- a/include/asm-sh/cpu-sh2/ubc.h
+++ b/arch/sh/include/cpu-sh2/cpu/ubc.h
diff --git a/include/asm-sh/cpu-sh2/watchdog.h b/arch/sh/include/cpu-sh2/cpu/watchdog.h
index 393161c9c6d0..393161c9c6d0 100644
--- a/include/asm-sh/cpu-sh2/watchdog.h
+++ b/arch/sh/include/cpu-sh2/cpu/watchdog.h
diff --git a/include/asm-sh/cpu-sh2a/cache.h b/arch/sh/include/cpu-sh2a/cpu/cache.h
index afe228b3f493..afe228b3f493 100644
--- a/include/asm-sh/cpu-sh2a/cache.h
+++ b/arch/sh/include/cpu-sh2a/cpu/cache.h
diff --git a/arch/sh/include/cpu-sh2a/cpu/dma.h b/arch/sh/include/cpu-sh2a/cpu/dma.h
new file mode 100644
index 000000000000..27a13ef4fdfc
--- /dev/null
+++ b/arch/sh/include/cpu-sh2a/cpu/dma.h
@@ -0,0 +1 @@
#include <cpu-sh2/cpu/dma.h>
diff --git a/include/asm-sh/cpu-sh2a/freq.h b/arch/sh/include/cpu-sh2a/cpu/freq.h
index 830fd43b6cdc..830fd43b6cdc 100644
--- a/include/asm-sh/cpu-sh2a/freq.h
+++ b/arch/sh/include/cpu-sh2a/cpu/freq.h
diff --git a/include/asm-sh/cpu-sh2a/rtc.h b/arch/sh/include/cpu-sh2a/cpu/rtc.h
index afb511e2bed7..afb511e2bed7 100644
--- a/include/asm-sh/cpu-sh2a/rtc.h
+++ b/arch/sh/include/cpu-sh2a/cpu/rtc.h
diff --git a/arch/sh/include/cpu-sh2a/cpu/ubc.h b/arch/sh/include/cpu-sh2a/cpu/ubc.h
new file mode 100644
index 000000000000..8ce2fc1cf625
--- /dev/null
+++ b/arch/sh/include/cpu-sh2a/cpu/ubc.h
@@ -0,0 +1 @@
#include <cpu-sh2/cpu/ubc.h>
diff --git a/arch/sh/include/cpu-sh2a/cpu/watchdog.h b/arch/sh/include/cpu-sh2a/cpu/watchdog.h
new file mode 100644
index 000000000000..e7e8259e468c
--- /dev/null
+++ b/arch/sh/include/cpu-sh2a/cpu/watchdog.h
@@ -0,0 +1 @@
#include <cpu-sh2/cpu/watchdog.h>
diff --git a/include/asm-sh/cpu-sh3/adc.h b/arch/sh/include/cpu-sh3/cpu/adc.h
index b289e3ca19a6..b289e3ca19a6 100644
--- a/include/asm-sh/cpu-sh3/adc.h
+++ b/arch/sh/include/cpu-sh3/cpu/adc.h
diff --git a/include/asm-sh/cpu-sh3/cache.h b/arch/sh/include/cpu-sh3/cpu/cache.h
index bee2d81c56bf..bee2d81c56bf 100644
--- a/include/asm-sh/cpu-sh3/cache.h
+++ b/arch/sh/include/cpu-sh3/cpu/cache.h
diff --git a/arch/sh/include/cpu-sh3/cpu/cacheflush.h b/arch/sh/include/cpu-sh3/cpu/cacheflush.h
new file mode 100644
index 000000000000..abc909880807
--- /dev/null
+++ b/arch/sh/include/cpu-sh3/cpu/cacheflush.h
@@ -0,0 +1,36 @@
1/*
2 * include/asm-sh/cpu-sh3/cacheflush.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH3_CACHEFLUSH_H
11#define __ASM_CPU_SH3_CACHEFLUSH_H
12
13#if defined(CONFIG_SH7705_CACHE_32KB)
14/* SH7705 is an SH3 processor with 32KB cache. This has alias issues like the
15 * SH4. Unlike the SH4 this is a unified cache so we need to do some work
16 * in mmap when 'exec'ing a new binary
17 */
18 /* 32KB cache, 4kb PAGE sizes need to check bit 12 */
19#define CACHE_ALIAS 0x00001000
20
21#define PG_mapped PG_arch_1
22
23void flush_cache_all(void);
24void flush_cache_mm(struct mm_struct *mm);
25#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
26void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
27 unsigned long end);
28void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
29void flush_dcache_page(struct page *pg);
30void flush_icache_range(unsigned long start, unsigned long end);
31void flush_icache_page(struct vm_area_struct *vma, struct page *page);
32#else
33#include <cpu-common/cpu/cacheflush.h>
34#endif
35
36#endif /* __ASM_CPU_SH3_CACHEFLUSH_H */
diff --git a/include/asm-sh/cpu-sh3/dac.h b/arch/sh/include/cpu-sh3/cpu/dac.h
index 05fda8316ebc..05fda8316ebc 100644
--- a/include/asm-sh/cpu-sh3/dac.h
+++ b/arch/sh/include/cpu-sh3/cpu/dac.h
diff --git a/include/asm-sh/cpu-sh3/dma.h b/arch/sh/include/cpu-sh3/cpu/dma.h
index 6813c3220a1d..6813c3220a1d 100644
--- a/include/asm-sh/cpu-sh3/dma.h
+++ b/arch/sh/include/cpu-sh3/cpu/dma.h
diff --git a/include/asm-sh/cpu-sh3/freq.h b/arch/sh/include/cpu-sh3/cpu/freq.h
index 53c62302b2e3..53c62302b2e3 100644
--- a/include/asm-sh/cpu-sh3/freq.h
+++ b/arch/sh/include/cpu-sh3/cpu/freq.h
diff --git a/include/asm-sh/cpu-sh3/gpio.h b/arch/sh/include/cpu-sh3/cpu/gpio.h
index 4e53eb314b8f..4e53eb314b8f 100644
--- a/include/asm-sh/cpu-sh3/gpio.h
+++ b/arch/sh/include/cpu-sh3/cpu/gpio.h
diff --git a/include/asm-sh/cpu-sh3/mmu_context.h b/arch/sh/include/cpu-sh3/cpu/mmu_context.h
index ab09da73ce77..ab09da73ce77 100644
--- a/include/asm-sh/cpu-sh3/mmu_context.h
+++ b/arch/sh/include/cpu-sh3/cpu/mmu_context.h
diff --git a/include/asm-sh/cpu-sh3/timer.h b/arch/sh/include/cpu-sh3/cpu/timer.h
index 793acf12aa08..793acf12aa08 100644
--- a/include/asm-sh/cpu-sh3/timer.h
+++ b/arch/sh/include/cpu-sh3/cpu/timer.h
diff --git a/include/asm-sh/cpu-sh3/ubc.h b/arch/sh/include/cpu-sh3/cpu/ubc.h
index 4e6381d5ff7a..4e6381d5ff7a 100644
--- a/include/asm-sh/cpu-sh3/ubc.h
+++ b/arch/sh/include/cpu-sh3/cpu/ubc.h
diff --git a/include/asm-sh/cpu-sh3/watchdog.h b/arch/sh/include/cpu-sh3/cpu/watchdog.h
index 4ee0347298d8..4ee0347298d8 100644
--- a/include/asm-sh/cpu-sh3/watchdog.h
+++ b/arch/sh/include/cpu-sh3/cpu/watchdog.h
diff --git a/include/asm-sh/cpu-sh4/addrspace.h b/arch/sh/include/cpu-sh4/cpu/addrspace.h
index a3fa733c1c7d..a3fa733c1c7d 100644
--- a/include/asm-sh/cpu-sh4/addrspace.h
+++ b/arch/sh/include/cpu-sh4/cpu/addrspace.h
diff --git a/include/asm-sh/cpu-sh4/cache.h b/arch/sh/include/cpu-sh4/cpu/cache.h
index 1c61ebf5c8e3..1c61ebf5c8e3 100644
--- a/include/asm-sh/cpu-sh4/cache.h
+++ b/arch/sh/include/cpu-sh4/cpu/cache.h
diff --git a/arch/sh/include/cpu-sh4/cpu/cacheflush.h b/arch/sh/include/cpu-sh4/cpu/cacheflush.h
new file mode 100644
index 000000000000..065306d376eb
--- /dev/null
+++ b/arch/sh/include/cpu-sh4/cpu/cacheflush.h
@@ -0,0 +1,43 @@
1/*
2 * include/asm-sh/cpu-sh4/cacheflush.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2003 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#ifndef __ASM_CPU_SH4_CACHEFLUSH_H
12#define __ASM_CPU_SH4_CACHEFLUSH_H
13
14/*
15 * Caches are broken on SH-4 (unless we use write-through
16 * caching; in which case they're only semi-broken),
17 * so we need them.
18 */
19void flush_cache_all(void);
20void flush_dcache_all(void);
21void flush_cache_mm(struct mm_struct *mm);
22#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
23void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
24 unsigned long end);
25void flush_cache_page(struct vm_area_struct *vma, unsigned long addr,
26 unsigned long pfn);
27void flush_dcache_page(struct page *pg);
28
29#define flush_dcache_mmap_lock(mapping) do { } while (0)
30#define flush_dcache_mmap_unlock(mapping) do { } while (0)
31
32void flush_icache_range(unsigned long start, unsigned long end);
33void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
34 unsigned long addr, int len);
35
36#define flush_icache_page(vma,pg) do { } while (0)
37
38/* Initialization of P3 area for copy_user_page */
39void p3_cache_init(void);
40
41#define PG_mapped PG_arch_1
42
43#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */
diff --git a/include/asm-sh/cpu-sh4/dma-sh7780.h b/arch/sh/include/cpu-sh4/cpu/dma-sh7780.h
index 71b426a6e482..71b426a6e482 100644
--- a/include/asm-sh/cpu-sh4/dma-sh7780.h
+++ b/arch/sh/include/cpu-sh4/cpu/dma-sh7780.h
diff --git a/arch/sh/include/cpu-sh4/cpu/dma.h b/arch/sh/include/cpu-sh4/cpu/dma.h
new file mode 100644
index 000000000000..235b7cd1fc9a
--- /dev/null
+++ b/arch/sh/include/cpu-sh4/cpu/dma.h
@@ -0,0 +1,65 @@
1#ifndef __ASM_CPU_SH4_DMA_H
2#define __ASM_CPU_SH4_DMA_H
3
4#define DMAOR_INIT ( 0x8000 | DMAOR_DME )
5
6/* SH7751/7760/7780 DMA IRQ sources */
7#define DMTE0_IRQ 34
8#define DMTE1_IRQ 35
9#define DMTE2_IRQ 36
10#define DMTE3_IRQ 37
11#define DMTE4_IRQ 44
12#define DMTE5_IRQ 45
13#define DMTE6_IRQ 46
14#define DMTE7_IRQ 47
15#define DMAE_IRQ 38
16
17#ifdef CONFIG_CPU_SH4A
18#define SH_DMAC_BASE 0xfc808020
19
20#define CHCR_TS_MASK 0x18
21#define CHCR_TS_SHIFT 3
22
23#include <cpu/dma-sh7780.h>
24#else
25#define SH_DMAC_BASE 0xffa00000
26
27/* Definitions for the SuperH DMAC */
28#define TM_BURST 0x0000080
29#define TS_8 0x00000010
30#define TS_16 0x00000020
31#define TS_32 0x00000030
32#define TS_64 0x00000000
33
34#define CHCR_TS_MASK 0x70
35#define CHCR_TS_SHIFT 4
36
37#define DMAOR_COD 0x00000008
38
39/*
40 * The SuperH DMAC supports a number of transmit sizes, we list them here,
41 * with their respective values as they appear in the CHCR registers.
42 *
43 * Defaults to a 64-bit transfer size.
44 */
45enum {
46 XMIT_SZ_64BIT,
47 XMIT_SZ_8BIT,
48 XMIT_SZ_16BIT,
49 XMIT_SZ_32BIT,
50 XMIT_SZ_256BIT,
51};
52
53/*
54 * The DMA count is defined as the number of bytes to transfer.
55 */
56static unsigned int ts_shift[] __maybe_unused = {
57 [XMIT_SZ_64BIT] = 3,
58 [XMIT_SZ_8BIT] = 0,
59 [XMIT_SZ_16BIT] = 1,
60 [XMIT_SZ_32BIT] = 2,
61 [XMIT_SZ_256BIT] = 5,
62};
63#endif
64
65#endif /* __ASM_CPU_SH4_DMA_H */
diff --git a/include/asm-sh/cpu-sh4/fpu.h b/arch/sh/include/cpu-sh4/cpu/fpu.h
index febef7342528..febef7342528 100644
--- a/include/asm-sh/cpu-sh4/fpu.h
+++ b/arch/sh/include/cpu-sh4/cpu/fpu.h
diff --git a/arch/sh/include/cpu-sh4/cpu/freq.h b/arch/sh/include/cpu-sh4/cpu/freq.h
new file mode 100644
index 000000000000..c23af81c2e70
--- /dev/null
+++ b/arch/sh/include/cpu-sh4/cpu/freq.h
@@ -0,0 +1,44 @@
1/*
2 * include/asm-sh/cpu-sh4/freq.h
3 *
4 * Copyright (C) 2002, 2003 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH4_FREQ_H
11#define __ASM_CPU_SH4_FREQ_H
12
13#if defined(CONFIG_CPU_SUBTYPE_SH7722) || \
14 defined(CONFIG_CPU_SUBTYPE_SH7723) || \
15 defined(CONFIG_CPU_SUBTYPE_SH7343) || \
16 defined(CONFIG_CPU_SUBTYPE_SH7366)
17#define FRQCR 0xa4150000
18#define VCLKCR 0xa4150004
19#define SCLKACR 0xa4150008
20#define SCLKBCR 0xa415000c
21#define IrDACLKCR 0xa4150010
22#define MSTPCR0 0xa4150030
23#define MSTPCR1 0xa4150034
24#define MSTPCR2 0xa4150038
25#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
26 defined(CONFIG_CPU_SUBTYPE_SH7780)
27#define FRQCR 0xffc80000
28#elif defined(CONFIG_CPU_SUBTYPE_SH7785)
29#define FRQCR0 0xffc80000
30#define FRQCR1 0xffc80004
31#define FRQMR1 0xffc80014
32#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
33#define FRQCR 0xffc00014
34#else
35#define FRQCR 0xffc00000
36#define FRQCR_PSTBY 0x0200
37#define FRQCR_PLLEN 0x0400
38#define FRQCR_CKOEN 0x0800
39#endif
40#define MIN_DIVISOR_NR 0
41#define MAX_DIVISOR_NR 3
42
43#endif /* __ASM_CPU_SH4_FREQ_H */
44
diff --git a/include/asm-sh/cpu-sh4/mmu_context.h b/arch/sh/include/cpu-sh4/cpu/mmu_context.h
index 9ea8eb27b18e..9ea8eb27b18e 100644
--- a/include/asm-sh/cpu-sh4/mmu_context.h
+++ b/arch/sh/include/cpu-sh4/cpu/mmu_context.h
diff --git a/include/asm-sh/cpu-sh4/rtc.h b/arch/sh/include/cpu-sh4/cpu/rtc.h
index 25b1e6adfe8c..25b1e6adfe8c 100644
--- a/include/asm-sh/cpu-sh4/rtc.h
+++ b/arch/sh/include/cpu-sh4/cpu/rtc.h
diff --git a/include/asm-sh/cpu-sh4/sigcontext.h b/arch/sh/include/cpu-sh4/cpu/sigcontext.h
index ab392f120e06..ab392f120e06 100644
--- a/include/asm-sh/cpu-sh4/sigcontext.h
+++ b/arch/sh/include/cpu-sh4/cpu/sigcontext.h
diff --git a/include/asm-sh/cpu-sh4/sq.h b/arch/sh/include/cpu-sh4/cpu/sq.h
index 586d6491816a..586d6491816a 100644
--- a/include/asm-sh/cpu-sh4/sq.h
+++ b/arch/sh/include/cpu-sh4/cpu/sq.h
diff --git a/include/asm-sh/cpu-sh4/timer.h b/arch/sh/include/cpu-sh4/cpu/timer.h
index d1e796b96888..d1e796b96888 100644
--- a/include/asm-sh/cpu-sh4/timer.h
+++ b/arch/sh/include/cpu-sh4/cpu/timer.h
diff --git a/include/asm-sh/cpu-sh4/ubc.h b/arch/sh/include/cpu-sh4/cpu/ubc.h
index c86e17050935..c86e17050935 100644
--- a/include/asm-sh/cpu-sh4/ubc.h
+++ b/arch/sh/include/cpu-sh4/cpu/ubc.h
diff --git a/include/asm-sh/cpu-sh4/watchdog.h b/arch/sh/include/cpu-sh4/cpu/watchdog.h
index 259f6a0ce23d..259f6a0ce23d 100644
--- a/include/asm-sh/cpu-sh4/watchdog.h
+++ b/arch/sh/include/cpu-sh4/cpu/watchdog.h
diff --git a/include/asm-sh/cpu-sh5/addrspace.h b/arch/sh/include/cpu-sh5/cpu/addrspace.h
index dc36b9a03af6..dc36b9a03af6 100644
--- a/include/asm-sh/cpu-sh5/addrspace.h
+++ b/arch/sh/include/cpu-sh5/cpu/addrspace.h
diff --git a/include/asm-sh/cpu-sh5/cache.h b/arch/sh/include/cpu-sh5/cpu/cache.h
index ed050ab526f2..ed050ab526f2 100644
--- a/include/asm-sh/cpu-sh5/cache.h
+++ b/arch/sh/include/cpu-sh5/cpu/cache.h
diff --git a/include/asm-sh/cpu-sh5/cacheflush.h b/arch/sh/include/cpu-sh5/cpu/cacheflush.h
index 5a11f0b7e66a..5a11f0b7e66a 100644
--- a/include/asm-sh/cpu-sh5/cacheflush.h
+++ b/arch/sh/include/cpu-sh5/cpu/cacheflush.h
diff --git a/include/asm-sh/cpu-sh5/dma.h b/arch/sh/include/cpu-sh5/cpu/dma.h
index 7bf6bb3d35ed..7bf6bb3d35ed 100644
--- a/include/asm-sh/cpu-sh5/dma.h
+++ b/arch/sh/include/cpu-sh5/cpu/dma.h
diff --git a/include/asm-sh/cpu-sh5/irq.h b/arch/sh/include/cpu-sh5/cpu/irq.h
index f0f0756e6e84..f0f0756e6e84 100644
--- a/include/asm-sh/cpu-sh5/irq.h
+++ b/arch/sh/include/cpu-sh5/cpu/irq.h
diff --git a/include/asm-sh/cpu-sh5/mmu_context.h b/arch/sh/include/cpu-sh5/cpu/mmu_context.h
index 68a1d2cff457..68a1d2cff457 100644
--- a/include/asm-sh/cpu-sh5/mmu_context.h
+++ b/arch/sh/include/cpu-sh5/cpu/mmu_context.h
diff --git a/include/asm-sh/cpu-sh5/registers.h b/arch/sh/include/cpu-sh5/cpu/registers.h
index 6664ea6f1566..6664ea6f1566 100644
--- a/include/asm-sh/cpu-sh5/registers.h
+++ b/arch/sh/include/cpu-sh5/cpu/registers.h
diff --git a/include/asm-sh/cpu-sh5/rtc.h b/arch/sh/include/cpu-sh5/cpu/rtc.h
index 12ea0ed144e1..12ea0ed144e1 100644
--- a/include/asm-sh/cpu-sh5/rtc.h
+++ b/arch/sh/include/cpu-sh5/cpu/rtc.h
diff --git a/include/asm-sh/dreamcast/dma.h b/arch/sh/include/mach-dreamcast/mach/dma.h
index ddd68e788705..ddd68e788705 100644
--- a/include/asm-sh/dreamcast/dma.h
+++ b/arch/sh/include/mach-dreamcast/mach/dma.h
diff --git a/include/asm-sh/dreamcast/maple.h b/arch/sh/include/mach-dreamcast/mach/maple.h
index 51f6a87f1f11..51f6a87f1f11 100644
--- a/include/asm-sh/dreamcast/maple.h
+++ b/arch/sh/include/mach-dreamcast/mach/maple.h
diff --git a/arch/sh/include/mach-dreamcast/mach/pci.h b/arch/sh/include/mach-dreamcast/mach/pci.h
new file mode 100644
index 000000000000..75fc9009e092
--- /dev/null
+++ b/arch/sh/include/mach-dreamcast/mach/pci.h
@@ -0,0 +1,25 @@
1/*
2 * include/asm-sh/dreamcast/pci.h
3 *
4 * Copyright (C) 2001, 2002 M. R. Brown
5 * Copyright (C) 2002, 2003 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#ifndef __ASM_SH_DREAMCAST_PCI_H
12#define __ASM_SH_DREAMCAST_PCI_H
13
14#include <mach-dreamcast/mach/sysasic.h>
15
16#define GAPSPCI_REGS 0x01001400
17#define GAPSPCI_DMA_BASE 0x01840000
18#define GAPSPCI_DMA_SIZE 32768
19#define GAPSPCI_BBA_CONFIG 0x01001600
20#define GAPSPCI_BBA_CONFIG_SIZE 0x2000
21
22#define GAPSPCI_IRQ HW_EVENT_EXTERNAL
23
24#endif /* __ASM_SH_DREAMCAST_PCI_H */
25
diff --git a/include/asm-sh/dreamcast/sysasic.h b/arch/sh/include/mach-dreamcast/mach/sysasic.h
index f33426608a87..f33426608a87 100644
--- a/include/asm-sh/dreamcast/sysasic.h
+++ b/arch/sh/include/mach-dreamcast/mach/sysasic.h
diff --git a/include/asm-sh/landisk/gio.h b/arch/sh/include/mach-landisk/mach/gio.h
index 35d7368b718a..35d7368b718a 100644
--- a/include/asm-sh/landisk/gio.h
+++ b/arch/sh/include/mach-landisk/mach/gio.h
diff --git a/include/asm-sh/landisk/iodata_landisk.h b/arch/sh/include/mach-landisk/mach/iodata_landisk.h
index 6fb04ab38b9f..6fb04ab38b9f 100644
--- a/include/asm-sh/landisk/iodata_landisk.h
+++ b/arch/sh/include/mach-landisk/mach/iodata_landisk.h
diff --git a/arch/sh/include/mach-se/mach/se.h b/arch/sh/include/mach-se/mach/se.h
new file mode 100644
index 000000000000..eb23000e1bbe
--- /dev/null
+++ b/arch/sh/include/mach-se/mach/se.h
@@ -0,0 +1,99 @@
1#ifndef __ASM_SH_HITACHI_SE_H
2#define __ASM_SH_HITACHI_SE_H
3
4/*
5 * linux/include/asm-sh/hitachi_se.h
6 *
7 * Copyright (C) 2000 Kazumoto Kojima
8 *
9 * Hitachi SolutionEngine support
10 */
11
12/* Box specific addresses. */
13
14#define PA_ROM 0x00000000 /* EPROM */
15#define PA_ROM_SIZE 0x00400000 /* EPROM size 4M byte */
16#define PA_FROM 0x01000000 /* EPROM */
17#define PA_FROM_SIZE 0x00400000 /* EPROM size 4M byte */
18#define PA_EXT1 0x04000000
19#define PA_EXT1_SIZE 0x04000000
20#define PA_EXT2 0x08000000
21#define PA_EXT2_SIZE 0x04000000
22#define PA_SDRAM 0x0c000000
23#define PA_SDRAM_SIZE 0x04000000
24
25#define PA_EXT4 0x12000000
26#define PA_EXT4_SIZE 0x02000000
27#define PA_EXT5 0x14000000
28#define PA_EXT5_SIZE 0x04000000
29#define PA_PCIC 0x18000000 /* MR-SHPC-01 PCMCIA */
30
31#define PA_83902 0xb0000000 /* DP83902A */
32#define PA_83902_IF 0xb0040000 /* DP83902A remote io port */
33#define PA_83902_RST 0xb0080000 /* DP83902A reset port */
34
35#define PA_SUPERIO 0xb0400000 /* SMC37C935A super io chip */
36#define PA_DIPSW0 0xb0800000 /* Dip switch 5,6 */
37#define PA_DIPSW1 0xb0800002 /* Dip switch 7,8 */
38#define PA_LED 0xb0c00000 /* LED */
39#if defined(CONFIG_CPU_SUBTYPE_SH7705)
40#define PA_BCR 0xb0e00000
41#else
42#define PA_BCR 0xb1400000 /* FPGA */
43#endif
44
45#define PA_MRSHPC 0xb83fffe0 /* MR-SHPC-01 PCMCIA controller */
46#define PA_MRSHPC_MW1 0xb8400000 /* MR-SHPC-01 memory window base */
47#define PA_MRSHPC_MW2 0xb8500000 /* MR-SHPC-01 attribute window base */
48#define PA_MRSHPC_IO 0xb8600000 /* MR-SHPC-01 I/O window base */
49#define MRSHPC_OPTION (PA_MRSHPC + 6)
50#define MRSHPC_CSR (PA_MRSHPC + 8)
51#define MRSHPC_ISR (PA_MRSHPC + 10)
52#define MRSHPC_ICR (PA_MRSHPC + 12)
53#define MRSHPC_CPWCR (PA_MRSHPC + 14)
54#define MRSHPC_MW0CR1 (PA_MRSHPC + 16)
55#define MRSHPC_MW1CR1 (PA_MRSHPC + 18)
56#define MRSHPC_IOWCR1 (PA_MRSHPC + 20)
57#define MRSHPC_MW0CR2 (PA_MRSHPC + 22)
58#define MRSHPC_MW1CR2 (PA_MRSHPC + 24)
59#define MRSHPC_IOWCR2 (PA_MRSHPC + 26)
60#define MRSHPC_CDCR (PA_MRSHPC + 28)
61#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30)
62
63#define BCR_ILCRA (PA_BCR + 0)
64#define BCR_ILCRB (PA_BCR + 2)
65#define BCR_ILCRC (PA_BCR + 4)
66#define BCR_ILCRD (PA_BCR + 6)
67#define BCR_ILCRE (PA_BCR + 8)
68#define BCR_ILCRF (PA_BCR + 10)
69#define BCR_ILCRG (PA_BCR + 12)
70
71#if defined(CONFIG_CPU_SUBTYPE_SH7705)
72#define IRQ_STNIC 12
73#define IRQ_CFCARD 14
74#else
75#define IRQ_STNIC 10
76#define IRQ_CFCARD 7
77#endif
78
79/* SH Ether support (SH7710/SH7712) */
80/* Base address */
81#define SH_ETH0_BASE 0xA7000000
82#define SH_ETH1_BASE 0xA7000400
83/* PHY ID */
84#if defined(CONFIG_CPU_SUBTYPE_SH7710)
85# define PHY_ID 0x00
86#elif defined(CONFIG_CPU_SUBTYPE_SH7712)
87# define PHY_ID 0x01
88#endif
89/* Ether IRQ */
90#define SH_ETH0_IRQ 80
91#define SH_ETH1_IRQ 81
92#define SH_TSU_IRQ 82
93
94void init_se_IRQ(void);
95
96#define __IO_PREFIX se
97#include <asm/io_generic.h>
98
99#endif /* __ASM_SH_HITACHI_SE_H */
diff --git a/include/asm-sh/se7206.h b/arch/sh/include/mach-se/mach/se7206.h
index 698eb80389ab..698eb80389ab 100644
--- a/include/asm-sh/se7206.h
+++ b/arch/sh/include/mach-se/mach/se7206.h
diff --git a/arch/sh/include/mach-se/mach/se7343.h b/arch/sh/include/mach-se/mach/se7343.h
new file mode 100644
index 000000000000..98458460e632
--- /dev/null
+++ b/arch/sh/include/mach-se/mach/se7343.h
@@ -0,0 +1,149 @@
1#ifndef __ASM_SH_HITACHI_SE7343_H
2#define __ASM_SH_HITACHI_SE7343_H
3
4/*
5 * include/asm-sh/se/se7343.h
6 *
7 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
8 *
9 * SH-Mobile SolutionEngine 7343 support
10 */
11
12/* Box specific addresses. */
13
14/* Area 0 */
15#define PA_ROM 0x00000000 /* EPROM */
16#define PA_ROM_SIZE 0x00400000 /* EPROM size 4M byte(Actually 2MB) */
17#define PA_FROM 0x00400000 /* Flash ROM */
18#define PA_FROM_SIZE 0x00400000 /* Flash size 4M byte */
19#define PA_SRAM 0x00800000 /* SRAM */
20#define PA_FROM_SIZE 0x00400000 /* SRAM size 4M byte */
21/* Area 1 */
22#define PA_EXT1 0x04000000
23#define PA_EXT1_SIZE 0x04000000
24/* Area 2 */
25#define PA_EXT2 0x08000000
26#define PA_EXT2_SIZE 0x04000000
27/* Area 3 */
28#define PA_SDRAM 0x0c000000
29#define PA_SDRAM_SIZE 0x04000000
30/* Area 4 */
31#define PA_PCIC 0x10000000 /* MR-SHPC-01 PCMCIA */
32#define PA_MRSHPC 0xb03fffe0 /* MR-SHPC-01 PCMCIA controller */
33#define PA_MRSHPC_MW1 0xb0400000 /* MR-SHPC-01 memory window base */
34#define PA_MRSHPC_MW2 0xb0500000 /* MR-SHPC-01 attribute window base */
35#define PA_MRSHPC_IO 0xb0600000 /* MR-SHPC-01 I/O window base */
36#define MRSHPC_OPTION (PA_MRSHPC + 6)
37#define MRSHPC_CSR (PA_MRSHPC + 8)
38#define MRSHPC_ISR (PA_MRSHPC + 10)
39#define MRSHPC_ICR (PA_MRSHPC + 12)
40#define MRSHPC_CPWCR (PA_MRSHPC + 14)
41#define MRSHPC_MW0CR1 (PA_MRSHPC + 16)
42#define MRSHPC_MW1CR1 (PA_MRSHPC + 18)
43#define MRSHPC_IOWCR1 (PA_MRSHPC + 20)
44#define MRSHPC_MW0CR2 (PA_MRSHPC + 22)
45#define MRSHPC_MW1CR2 (PA_MRSHPC + 24)
46#define MRSHPC_IOWCR2 (PA_MRSHPC + 26)
47#define MRSHPC_CDCR (PA_MRSHPC + 28)
48#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30)
49#define PA_LED 0xb0C00000 /* LED */
50#define LED_SHIFT 0
51#define PA_DIPSW 0xb0900000 /* Dip switch 31 */
52#define PA_CPLD_MODESET 0xb1400004 /* CPLD Mode set register */
53#define PA_CPLD_ST 0xb1400008 /* CPLD Interrupt status register */
54#define PA_CPLD_IMSK 0xb140000a /* CPLD Interrupt mask register */
55/* Area 5 */
56#define PA_EXT5 0x14000000
57#define PA_EXT5_SIZE 0x04000000
58/* Area 6 */
59#define PA_LCD1 0xb8000000
60#define PA_LCD2 0xb8800000
61
62#define PORT_PACR 0xA4050100
63#define PORT_PBCR 0xA4050102
64#define PORT_PCCR 0xA4050104
65#define PORT_PDCR 0xA4050106
66#define PORT_PECR 0xA4050108
67#define PORT_PFCR 0xA405010A
68#define PORT_PGCR 0xA405010C
69#define PORT_PHCR 0xA405010E
70#define PORT_PJCR 0xA4050110
71#define PORT_PKCR 0xA4050112
72#define PORT_PLCR 0xA4050114
73#define PORT_PMCR 0xA4050116
74#define PORT_PNCR 0xA4050118
75#define PORT_PQCR 0xA405011A
76#define PORT_PRCR 0xA405011C
77#define PORT_PSCR 0xA405011E
78#define PORT_PTCR 0xA4050140
79#define PORT_PUCR 0xA4050142
80#define PORT_PVCR 0xA4050144
81#define PORT_PWCR 0xA4050146
82#define PORT_PYCR 0xA4050148
83#define PORT_PZCR 0xA405014A
84
85#define PORT_PSELA 0xA405014C
86#define PORT_PSELB 0xA405014E
87#define PORT_PSELC 0xA4050150
88#define PORT_PSELD 0xA4050152
89#define PORT_PSELE 0xA4050154
90
91#define PORT_HIZCRA 0xA4050156
92#define PORT_HIZCRB 0xA4050158
93#define PORT_HIZCRC 0xA405015C
94
95#define PORT_DRVCR 0xA4050180
96
97#define PORT_PADR 0xA4050120
98#define PORT_PBDR 0xA4050122
99#define PORT_PCDR 0xA4050124
100#define PORT_PDDR 0xA4050126
101#define PORT_PEDR 0xA4050128
102#define PORT_PFDR 0xA405012A
103#define PORT_PGDR 0xA405012C
104#define PORT_PHDR 0xA405012E
105#define PORT_PJDR 0xA4050130
106#define PORT_PKDR 0xA4050132
107#define PORT_PLDR 0xA4050134
108#define PORT_PMDR 0xA4050136
109#define PORT_PNDR 0xA4050138
110#define PORT_PQDR 0xA405013A
111#define PORT_PRDR 0xA405013C
112#define PORT_PTDR 0xA4050160
113#define PORT_PUDR 0xA4050162
114#define PORT_PVDR 0xA4050164
115#define PORT_PWDR 0xA4050166
116#define PORT_PYDR 0xA4050168
117
118#define FPGA_IN 0xb1400000
119#define FPGA_OUT 0xb1400002
120
121#define __IO_PREFIX sh7343se
122#include <asm/io_generic.h>
123
124#define IRQ0_IRQ 32
125#define IRQ1_IRQ 33
126#define IRQ4_IRQ 36
127#define IRQ5_IRQ 37
128
129#define SE7343_FPGA_IRQ_MRSHPC0 0
130#define SE7343_FPGA_IRQ_MRSHPC1 1
131#define SE7343_FPGA_IRQ_MRSHPC2 2
132#define SE7343_FPGA_IRQ_MRSHPC3 3
133#define SE7343_FPGA_IRQ_SMC 6 /* EXT_IRQ2 */
134#define SE7343_FPGA_IRQ_USB 8
135
136#define SE7343_FPGA_IRQ_NR 11
137#define SE7343_FPGA_IRQ_BASE 120
138
139#define MRSHPC_IRQ3 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC3)
140#define MRSHPC_IRQ2 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC2)
141#define MRSHPC_IRQ1 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC1)
142#define MRSHPC_IRQ0 (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_MRSHPC0)
143#define SMC_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_SMC)
144#define USB_IRQ (SE7343_FPGA_IRQ_BASE + SE7343_FPGA_IRQ_USB)
145
146/* arch/sh/boards/se/7343/irq.c */
147void init_7343se_IRQ(void);
148
149#endif /* __ASM_SH_HITACHI_SE7343_H */
diff --git a/include/asm-sh/se7721.h b/arch/sh/include/mach-se/mach/se7721.h
index b957f6041193..b957f6041193 100644
--- a/include/asm-sh/se7721.h
+++ b/arch/sh/include/mach-se/mach/se7721.h
diff --git a/arch/sh/include/mach-se/mach/se7722.h b/arch/sh/include/mach-se/mach/se7722.h
new file mode 100644
index 000000000000..e971d9a82f4a
--- /dev/null
+++ b/arch/sh/include/mach-se/mach/se7722.h
@@ -0,0 +1,112 @@
1#ifndef __ASM_SH_SE7722_H
2#define __ASM_SH_SE7722_H
3
4/*
5 * linux/include/asm-sh/se7722.h
6 *
7 * Copyright (C) 2007 Nobuhiro Iwamatsu
8 *
9 * Hitachi UL SolutionEngine 7722 Support.
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 *
15 */
16#include <asm/addrspace.h>
17
18/* Box specific addresses. */
19#define SE_AREA0_WIDTH 4 /* Area0: 32bit */
20#define PA_ROM 0xa0000000 /* EPROM */
21#define PA_ROM_SIZE 0x00200000 /* EPROM size 2M byte */
22#define PA_FROM 0xa1000000 /* Flash-ROM */
23#define PA_FROM_SIZE 0x01000000 /* Flash-ROM size 16M byte */
24#define PA_EXT1 0xa4000000
25#define PA_EXT1_SIZE 0x04000000
26#define PA_SDRAM 0xaC000000 /* DDR-SDRAM(Area3) 64MB */
27#define PA_SDRAM_SIZE 0x04000000
28
29#define PA_EXT4 0xb0000000
30#define PA_EXT4_SIZE 0x04000000
31
32#define PA_PERIPHERAL 0xB0000000
33
34#define PA_PCIC PA_PERIPHERAL /* MR-SHPC-01 PCMCIA */
35#define PA_MRSHPC (PA_PERIPHERAL + 0x003fffe0) /* MR-SHPC-01 PCMCIA controller */
36#define PA_MRSHPC_MW1 (PA_PERIPHERAL + 0x00400000) /* MR-SHPC-01 memory window base */
37#define PA_MRSHPC_MW2 (PA_PERIPHERAL + 0x00500000) /* MR-SHPC-01 attribute window base */
38#define PA_MRSHPC_IO (PA_PERIPHERAL + 0x00600000) /* MR-SHPC-01 I/O window base */
39#define MRSHPC_OPTION (PA_MRSHPC + 6)
40#define MRSHPC_CSR (PA_MRSHPC + 8)
41#define MRSHPC_ISR (PA_MRSHPC + 10)
42#define MRSHPC_ICR (PA_MRSHPC + 12)
43#define MRSHPC_CPWCR (PA_MRSHPC + 14)
44#define MRSHPC_MW0CR1 (PA_MRSHPC + 16)
45#define MRSHPC_MW1CR1 (PA_MRSHPC + 18)
46#define MRSHPC_IOWCR1 (PA_MRSHPC + 20)
47#define MRSHPC_MW0CR2 (PA_MRSHPC + 22)
48#define MRSHPC_MW1CR2 (PA_MRSHPC + 24)
49#define MRSHPC_IOWCR2 (PA_MRSHPC + 26)
50#define MRSHPC_CDCR (PA_MRSHPC + 28)
51#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30)
52
53#define PA_LED (PA_PERIPHERAL + 0x00800000) /* 8bit LED */
54#define PA_FPGA (PA_PERIPHERAL + 0x01800000) /* FPGA base address */
55
56#define PA_LAN (PA_AREA6_IO + 0) /* SMC LAN91C111 */
57/* GPIO */
58#define FPGA_IN 0xb1840000UL
59#define FPGA_OUT 0xb1840004UL
60
61#define PORT_PECR 0xA4050108UL
62#define PORT_PJCR 0xA4050110UL
63#define PORT_PSELD 0xA4050154UL
64#define PORT_PSELB 0xA4050150UL
65
66#define PORT_PSELC 0xA4050152UL
67#define PORT_PKCR 0xA4050112UL
68#define PORT_PHCR 0xA405010EUL
69#define PORT_PLCR 0xA4050114UL
70#define PORT_PMCR 0xA4050116UL
71#define PORT_PRCR 0xA405011CUL
72#define PORT_PXCR 0xA4050148UL
73#define PORT_PSELA 0xA405014EUL
74#define PORT_PYCR 0xA405014AUL
75#define PORT_PZCR 0xA405014CUL
76#define PORT_HIZCRA 0xA4050158UL
77#define PORT_HIZCRC 0xA405015CUL
78
79/* IRQ */
80#define IRQ0_IRQ 32
81#define IRQ1_IRQ 33
82
83#define IRQ01_MODE 0xb1800000
84#define IRQ01_STS 0xb1800004
85#define IRQ01_MASK 0xb1800008
86
87/* Bits in IRQ01_* registers */
88
89#define SE7722_FPGA_IRQ_USB 0 /* IRQ0 */
90#define SE7722_FPGA_IRQ_SMC 1 /* IRQ0 */
91#define SE7722_FPGA_IRQ_MRSHPC0 2 /* IRQ1 */
92#define SE7722_FPGA_IRQ_MRSHPC1 3 /* IRQ1 */
93#define SE7722_FPGA_IRQ_MRSHPC2 4 /* IRQ1 */
94#define SE7722_FPGA_IRQ_MRSHPC3 5 /* IRQ1 */
95
96#define SE7722_FPGA_IRQ_NR 6
97#define SE7722_FPGA_IRQ_BASE 110
98
99#define MRSHPC_IRQ3 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC3)
100#define MRSHPC_IRQ2 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC2)
101#define MRSHPC_IRQ1 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC1)
102#define MRSHPC_IRQ0 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC0)
103#define SMC_IRQ (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_SMC)
104#define USB_IRQ (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_USB)
105
106/* arch/sh/boards/se/7722/irq.c */
107void init_se7722_IRQ(void);
108
109#define __IO_PREFIX se7722
110#include <asm/io_generic.h>
111
112#endif /* __ASM_SH_SE7722_H */
diff --git a/include/asm-sh/se7751.h b/arch/sh/include/mach-se/mach/se7751.h
index b36792ac5d66..b36792ac5d66 100644
--- a/include/asm-sh/se7751.h
+++ b/arch/sh/include/mach-se/mach/se7751.h
diff --git a/include/asm-sh/se7780.h b/arch/sh/include/mach-se/mach/se7780.h
index 40e9b41458cd..40e9b41458cd 100644
--- a/include/asm-sh/se7780.h
+++ b/arch/sh/include/mach-se/mach/se7780.h
diff --git a/include/asm-sh/sh03/io.h b/arch/sh/include/mach-sh03/mach/io.h
index c39c785bba94..c39c785bba94 100644
--- a/include/asm-sh/sh03/io.h
+++ b/arch/sh/include/mach-sh03/mach/io.h
diff --git a/include/asm-sh/sh03/sh03.h b/arch/sh/include/mach-sh03/mach/sh03.h
index 19c40b80428d..19c40b80428d 100644
--- a/include/asm-sh/sh03/sh03.h
+++ b/arch/sh/include/mach-sh03/mach/sh03.h
diff --git a/arch/sh/kernel/.gitignore b/arch/sh/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/sh/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/sh/kernel/Makefile_32 b/arch/sh/kernel/Makefile_32
index 4bbdce36b92b..0e6905fe9fec 100644
--- a/arch/sh/kernel/Makefile_32
+++ b/arch/sh/kernel/Makefile_32
@@ -21,7 +21,7 @@ obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
21obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 21obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
22obj-$(CONFIG_PM) += pm.o 22obj-$(CONFIG_PM) += pm.o
23obj-$(CONFIG_STACKTRACE) += stacktrace.o 23obj-$(CONFIG_STACKTRACE) += stacktrace.o
24obj-$(CONFIG_BINFMT_ELF) += dump_task.o 24obj-$(CONFIG_ELF_CORE) += dump_task.o
25obj-$(CONFIG_IO_TRAPPED) += io_trapped.o 25obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
26 26
27EXTRA_CFLAGS += -Werror 27EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/kernel/cf-enabler.c b/arch/sh/kernel/cf-enabler.c
index 01ff4d05aab0..bea40339919b 100644
--- a/arch/sh/kernel/cf-enabler.c
+++ b/arch/sh/kernel/cf-enabler.c
@@ -80,11 +80,11 @@ static int __init cf_init_default(void)
80} 80}
81 81
82#if defined(CONFIG_SH_SOLUTION_ENGINE) 82#if defined(CONFIG_SH_SOLUTION_ENGINE)
83#include <asm/se.h> 83#include <mach-se/mach/se.h>
84#elif defined(CONFIG_SH_7722_SOLUTION_ENGINE) 84#elif defined(CONFIG_SH_7722_SOLUTION_ENGINE)
85#include <asm/se7722.h> 85#include <mach-se/mach/se7722.h>
86#elif defined(CONFIG_SH_7721_SOLUTION_ENGINE) 86#elif defined(CONFIG_SH_7721_SOLUTION_ENGINE)
87#include <asm/se7721.h> 87#include <mach-se/mach/se7721.h>
88#endif 88#endif
89 89
90/* 90/*
@@ -157,7 +157,7 @@ static int __init cf_init_se(void)
157} 157}
158#endif 158#endif
159 159
160int __init cf_init(void) 160static int __init cf_init(void)
161{ 161{
162 if (mach_is_se() || mach_is_7722se() || mach_is_7721se()) 162 if (mach_is_se() || mach_is_7722se() || mach_is_7721se())
163 return cf_init_se(); 163 return cf_init_se();
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index b5f1e23ed57c..f5eb56e6bc59 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -88,7 +88,7 @@ static void propagate_rate(struct clk *clk)
88 } 88 }
89} 89}
90 90
91int __clk_enable(struct clk *clk) 91static int __clk_enable(struct clk *clk)
92{ 92{
93 /* 93 /*
94 * See if this is the first time we're enabling the clock, some 94 * See if this is the first time we're enabling the clock, some
@@ -111,7 +111,6 @@ int __clk_enable(struct clk *clk)
111 111
112 return 0; 112 return 0;
113} 113}
114EXPORT_SYMBOL_GPL(__clk_enable);
115 114
116int clk_enable(struct clk *clk) 115int clk_enable(struct clk *clk)
117{ 116{
@@ -131,7 +130,7 @@ static void clk_kref_release(struct kref *kref)
131 /* Nothing to do */ 130 /* Nothing to do */
132} 131}
133 132
134void __clk_disable(struct clk *clk) 133static void __clk_disable(struct clk *clk)
135{ 134{
136 int count = kref_put(&clk->kref, clk_kref_release); 135 int count = kref_put(&clk->kref, clk_kref_release);
137 136
@@ -143,7 +142,6 @@ void __clk_disable(struct clk *clk)
143 clk->ops->disable(clk); 142 clk->ops->disable(clk);
144 } 143 }
145} 144}
146EXPORT_SYMBOL_GPL(__clk_disable);
147 145
148void clk_disable(struct clk *clk) 146void clk_disable(struct clk *clk)
149{ 147{
@@ -310,15 +308,11 @@ static int show_clocks(char *buf, char **start, off_t off,
310 list_for_each_entry_reverse(clk, &clock_list, node) { 308 list_for_each_entry_reverse(clk, &clock_list, node) {
311 unsigned long rate = clk_get_rate(clk); 309 unsigned long rate = clk_get_rate(clk);
312 310
313 /* 311 p += sprintf(p, "%-12s\t: %ld.%02ldMHz\t%s\n", clk->name,
314 * Don't bother listing dummy clocks with no ancestry 312 rate / 1000000, (rate % 1000000) / 10000,
315 * that only support enable and disable ops. 313 ((clk->flags & CLK_ALWAYS_ENABLED) ||
316 */ 314 (atomic_read(&clk->kref.refcount) != 1)) ?
317 if (unlikely(!rate && !clk->parent)) 315 "enabled" : "disabled");
318 continue;
319
320 p += sprintf(p, "%-12s\t: %ld.%02ldMHz\n", clk->name,
321 rate / 1000000, (rate % 1000000) / 10000);
322 } 316 }
323 317
324 return p - buf; 318 return p - buf;
diff --git a/arch/sh/kernel/cpu/irq/intc-sh5.c b/arch/sh/kernel/cpu/irq/intc-sh5.c
index 79baa47af977..726f0335da76 100644
--- a/arch/sh/kernel/cpu/irq/intc-sh5.c
+++ b/arch/sh/kernel/cpu/irq/intc-sh5.c
@@ -20,7 +20,7 @@
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/bitops.h> 22#include <linux/bitops.h>
23#include <asm/cpu/irq.h> 23#include <cpu/irq.h>
24#include <asm/page.h> 24#include <asm/page.h>
25 25
26/* 26/*
diff --git a/arch/sh/kernel/cpu/irq/intc.c b/arch/sh/kernel/cpu/irq/intc.c
index da5dae787888..8c70e201bde0 100644
--- a/arch/sh/kernel/cpu/irq/intc.c
+++ b/arch/sh/kernel/cpu/irq/intc.c
@@ -62,7 +62,7 @@ struct intc_desc_int {
62#endif 62#endif
63 63
64static unsigned int intc_prio_level[NR_IRQS]; /* for now */ 64static unsigned int intc_prio_level[NR_IRQS]; /* for now */
65#ifdef CONFIG_CPU_SH3 65#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
66static unsigned long ack_handle[NR_IRQS]; 66static unsigned long ack_handle[NR_IRQS];
67#endif 67#endif
68 68
@@ -231,7 +231,7 @@ static void intc_disable(unsigned int irq)
231 } 231 }
232} 232}
233 233
234#ifdef CONFIG_CPU_SH3 234#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
235static void intc_mask_ack(unsigned int irq) 235static void intc_mask_ack(unsigned int irq)
236{ 236{
237 struct intc_desc_int *d = get_intc_desc(irq); 237 struct intc_desc_int *d = get_intc_desc(irq);
@@ -244,8 +244,23 @@ static void intc_mask_ack(unsigned int irq)
244 244
245 if (handle) { 245 if (handle) {
246 addr = INTC_REG(d, _INTC_ADDR_D(handle), 0); 246 addr = INTC_REG(d, _INTC_ADDR_D(handle), 0);
247 ctrl_inb(addr); 247 switch (_INTC_FN(handle)) {
248 ctrl_outb(0x3f ^ set_field(0, 1, handle), addr); 248 case REG_FN_MODIFY_BASE + 0: /* 8bit */
249 ctrl_inb(addr);
250 ctrl_outb(0xff ^ set_field(0, 1, handle), addr);
251 break;
252 case REG_FN_MODIFY_BASE + 1: /* 16bit */
253 ctrl_inw(addr);
254 ctrl_outw(0xffff ^ set_field(0, 1, handle), addr);
255 break;
256 case REG_FN_MODIFY_BASE + 3: /* 32bit */
257 ctrl_inl(addr);
258 ctrl_outl(0xffffffff ^ set_field(0, 1, handle), addr);
259 break;
260 default:
261 BUG();
262 break;
263 }
249 } 264 }
250} 265}
251#endif 266#endif
@@ -466,7 +481,7 @@ static unsigned int __init intc_prio_data(struct intc_desc *desc,
466 return 0; 481 return 0;
467} 482}
468 483
469#ifdef CONFIG_CPU_SH3 484#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
470static unsigned int __init intc_ack_data(struct intc_desc *desc, 485static unsigned int __init intc_ack_data(struct intc_desc *desc,
471 struct intc_desc_int *d, 486 struct intc_desc_int *d,
472 intc_enum enum_id) 487 intc_enum enum_id)
@@ -601,7 +616,7 @@ static void __init intc_register_irq(struct intc_desc *desc,
601 /* irq should be disabled by default */ 616 /* irq should be disabled by default */
602 d->chip.mask(irq); 617 d->chip.mask(irq);
603 618
604#ifdef CONFIG_CPU_SH3 619#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
605 if (desc->ack_regs) 620 if (desc->ack_regs)
606 ack_handle[irq] = intc_ack_data(desc, d, enum_id); 621 ack_handle[irq] = intc_ack_data(desc, d, enum_id);
607#endif 622#endif
@@ -635,7 +650,7 @@ void __init register_intc_controller(struct intc_desc *desc)
635 d->nr_reg += desc->prio_regs ? desc->nr_prio_regs * 2 : 0; 650 d->nr_reg += desc->prio_regs ? desc->nr_prio_regs * 2 : 0;
636 d->nr_reg += desc->sense_regs ? desc->nr_sense_regs : 0; 651 d->nr_reg += desc->sense_regs ? desc->nr_sense_regs : 0;
637 652
638#ifdef CONFIG_CPU_SH3 653#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
639 d->nr_reg += desc->ack_regs ? desc->nr_ack_regs : 0; 654 d->nr_reg += desc->ack_regs ? desc->nr_ack_regs : 0;
640#endif 655#endif
641 d->reg = alloc_bootmem(d->nr_reg * sizeof(*d->reg)); 656 d->reg = alloc_bootmem(d->nr_reg * sizeof(*d->reg));
@@ -676,7 +691,7 @@ void __init register_intc_controller(struct intc_desc *desc)
676 d->chip.mask_ack = intc_disable; 691 d->chip.mask_ack = intc_disable;
677 d->chip.set_type = intc_set_sense; 692 d->chip.set_type = intc_set_sense;
678 693
679#ifdef CONFIG_CPU_SH3 694#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4A)
680 if (desc->ack_regs) { 695 if (desc->ack_regs) {
681 for (i = 0; i < desc->nr_ack_regs; i++) 696 for (i = 0; i < desc->nr_ack_regs; i++)
682 k += save_reg(d, k, desc->ack_regs[i].set_reg, 0); 697 k += save_reg(d, k, desc->ack_regs[i].set_reg, 0);
diff --git a/arch/sh/kernel/cpu/sh2/entry.S b/arch/sh/kernel/cpu/sh2/entry.S
index 0fc89069d8c7..becc54c45692 100644
--- a/arch/sh/kernel/cpu/sh2/entry.S
+++ b/arch/sh/kernel/cpu/sh2/entry.S
@@ -3,7 +3,7 @@
3 * 3 *
4 * The SH-2 exception entry 4 * The SH-2 exception entry
5 * 5 *
6 * Copyright (C) 2005,2006 Yoshinori Sato 6 * Copyright (C) 2005-2008 Yoshinori Sato
7 * Copyright (C) 2005 AXE,Inc. 7 * Copyright (C) 2005 AXE,Inc.
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General Public 9 * This file is subject to the terms and conditions of the GNU General Public
@@ -14,7 +14,7 @@
14#include <linux/linkage.h> 14#include <linux/linkage.h>
15#include <asm/asm-offsets.h> 15#include <asm/asm-offsets.h>
16#include <asm/thread_info.h> 16#include <asm/thread_info.h>
17#include <asm/cpu/mmu_context.h> 17#include <cpu/mmu_context.h>
18#include <asm/unistd.h> 18#include <asm/unistd.h>
19#include <asm/errno.h> 19#include <asm/errno.h>
20#include <asm/page.h> 20#include <asm/page.h>
@@ -36,43 +36,41 @@ OFF_TRA = (16*4+6*4)
36#include <asm/entry-macros.S> 36#include <asm/entry-macros.S>
37 37
38ENTRY(exception_handler) 38ENTRY(exception_handler)
39 ! already saved r0/r1 39 ! stack
40 ! r0 <- point sp
41 ! r1
42 ! pc
43 ! sr
44 ! r0 = temporary
45 ! r1 = vector (pseudo EXPEVT / INTEVT / TRA)
40 mov.l r2,@-sp 46 mov.l r2,@-sp
41 mov.l r3,@-sp 47 mov.l r3,@-sp
42 mov r0,r1
43 cli 48 cli
44 mov.l $cpu_mode,r2 49 mov.l $cpu_mode,r2
45 mov.l @r2,r0 50 mov.l @r2,r0
46 mov.l @(5*4,r15),r3 ! previous SR 51 mov.l @(5*4,r15),r3 ! previous SR
47 shll2 r3 ! set "S" flag 52 or r0,r3 ! set MD
48 rotl r0 ! T <- "S" flag 53 tst r0,r0
49 rotl r0 ! "S" flag is LSB 54 bf/s 1f ! previous mode check
50 rotcr r3 ! T -> r3:b30 55 mov.l r3,@(5*4,r15) ! update SR
51 shlr r3
52 shlr r0
53 bt/s 1f
54 mov.l r3,@(5*4,r15) ! copy cpu mode to SR
55 ! switch to kernel mode 56 ! switch to kernel mode
56 mov #1,r0 57 mov.l __md_bit,r0
57 rotr r0
58 rotr r0
59 mov.l r0,@r2 ! enter kernel mode 58 mov.l r0,@r2 ! enter kernel mode
60 mov.l $current_thread_info,r2 59 mov.l $current_thread_info,r2
61 mov.l @r2,r2 60 mov.l @r2,r2
62 mov #0x20,r0 61 mov #(THREAD_SIZE >> 8),r0
63 shll8 r0 62 shll8 r0
64 add r2,r0 63 add r2,r0
65 mov r15,r2 ! r2 = user stack top 64 mov r15,r2 ! r2 = user stack top
66 mov r0,r15 ! switch kernel stack 65 mov r0,r15 ! switch kernel stack
67 add #-4,r15 ! dummy
68 mov.l r1,@-r15 ! TRA 66 mov.l r1,@-r15 ! TRA
69 sts.l macl, @-r15 67 sts.l macl, @-r15
70 sts.l mach, @-r15 68 sts.l mach, @-r15
71 stc.l gbr, @-r15 69 stc.l gbr, @-r15
72 mov.l @(4*4,r2),r0 70 mov.l @(5*4,r2),r0
73 mov.l @(5*4,r2),r1 71 mov.l r0,@-r15 ! original SR
74 mov.l r1,@-r15 ! original SR
75 sts.l pr,@-r15 72 sts.l pr,@-r15
73 mov.l @(4*4,r2),r0
76 mov.l r0,@-r15 ! original PC 74 mov.l r0,@-r15 ! original PC
77 mov r2,r3 75 mov r2,r3
78 add #(4+2)*4,r3 ! rewind r0 - r3 + exception frame 76 add #(4+2)*4,r3 ! rewind r0 - r3 + exception frame
@@ -88,14 +86,15 @@ ENTRY(exception_handler)
88 mov.l r6,@-r15 86 mov.l r6,@-r15
89 mov.l r5,@-r15 87 mov.l r5,@-r15
90 mov.l r4,@-r15 88 mov.l r4,@-r15
89 mov r1,r9 ! save TRA
91 mov r2,r8 ! copy user -> kernel stack 90 mov r2,r8 ! copy user -> kernel stack
92 mov.l @r8+,r3 91 mov.l @(0,r8),r3
93 mov.l r3,@-r15 92 mov.l r3,@-r15
94 mov.l @r8+,r2 93 mov.l @(4,r8),r2
95 mov.l r2,@-r15 94 mov.l r2,@-r15
96 mov.l @r8+,r1 95 mov.l @(12,r8),r1
97 mov.l r1,@-r15 96 mov.l r1,@-r15
98 mov.l @r8+,r0 97 mov.l @(8,r8),r0
99 bra 2f 98 bra 2f
100 mov.l r0,@-r15 99 mov.l r0,@-r15
1011: 1001:
@@ -107,10 +106,11 @@ ENTRY(exception_handler)
107 mov.l r0,@-r15 106 mov.l r0,@-r15
108 mov.l @r2+,r0 ! old R2 107 mov.l @r2+,r0 ! old R2
109 mov.l r0,@-r15 108 mov.l r0,@-r15
110 mov.l @r2+,r0 ! old R1 109 mov.l @(4,r2),r0 ! old R1
111 mov.l r0,@-r15
112 mov.l @r2+,r0 ! old R0
113 mov.l r0,@-r15 110 mov.l r0,@-r15
111 mov.l @r2,r0 ! old R0
112 mov.l r0,@-r15
113 add #8,r2
114 mov.l @r2+,r3 ! old PC 114 mov.l @r2+,r3 ! old PC
115 mov.l @r2+,r0 ! old SR 115 mov.l @r2+,r0 ! old SR
116 add #-4,r2 ! exception frame stub (sr) 116 add #-4,r2 ! exception frame stub (sr)
@@ -135,14 +135,12 @@ ENTRY(exception_handler)
135 mov.l r6,@-r2 135 mov.l r6,@-r2
136 mov.l r5,@-r2 136 mov.l r5,@-r2
137 mov.l r4,@-r2 137 mov.l r4,@-r2
138 mov r1,r9
138 mov.l @(OFF_R0,r15),r0 139 mov.l @(OFF_R0,r15),r0
139 mov.l @(OFF_R1,r15),r1 140 mov.l @(OFF_R1,r15),r1
140 mov.l @(OFF_R2,r15),r2 141 mov.l @(OFF_R2,r15),r2
141 mov.l @(OFF_R3,r15),r3 142 mov.l @(OFF_R3,r15),r3
1422: 1432:
143 mov #OFF_TRA,r8
144 add r15,r8
145 mov.l @r8,r9
146 mov #64,r8 144 mov #64,r8
147 cmp/hs r8,r9 145 cmp/hs r8,r9
148 bt interrupt_entry ! vec >= 64 is interrupt 146 bt interrupt_entry ! vec >= 64 is interrupt
@@ -150,26 +148,14 @@ ENTRY(exception_handler)
150 cmp/hs r8,r9 148 cmp/hs r8,r9
151 bt trap_entry ! 64 > vec >= 32 is trap 149 bt trap_entry ! 64 > vec >= 32 is trap
152 150
153#if defined(CONFIG_SH_FPU)
154 mov #13,r8
155 cmp/eq r8,r9
156 bt 10f ! fpu
157 nop
158#endif
159
160 mov.l 4f,r8 151 mov.l 4f,r8
161 mov r9,r4 152 mov r9,r4
162 shll2 r9 153 shll2 r9
163 add r9,r8 154 add r9,r8
164 mov.l @r8,r8 155 mov.l @r8,r8 ! exception handler address
165 mov #0,r9 156 tst r8,r8
166 cmp/eq r9,r8
167 bf 3f 157 bf 3f
168 mov.l 8f,r8 ! unhandled exception 158 mov.l 8f,r8 ! unhandled exception
169#if defined(CONFIG_SH_FPU)
17010:
171 mov.l 9f, r8 ! unhandled exception
172#endif
1733: 1593:
174 mov.l 5f,r10 160 mov.l 5f,r10
175 jmp @r8 161 jmp @r8
@@ -188,10 +174,7 @@ interrupt_entry:
1885: .long ret_from_exception 1745: .long ret_from_exception
1896: .long ret_from_irq 1756: .long ret_from_irq
1907: .long do_IRQ 1767: .long do_IRQ
1918: .long do_exception_error 1778: .long exception_error
192#ifdef CONFIG_SH_FPU
1939: .long fpu_error_trap_handler
194#endif
195 178
196trap_entry: 179trap_entry:
197 mov #0x30,r8 180 mov #0x30,r8
@@ -200,24 +183,9 @@ trap_entry:
200 add #-0x10,r9 ! convert SH2 to SH3/4 ABI 183 add #-0x10,r9 ! convert SH2 to SH3/4 ABI
2011: 1841:
202 shll2 r9 ! TRA 185 shll2 r9 ! TRA
203 mov #OFF_TRA,r8 186 bra system_call ! jump common systemcall entry
204 add r15,r8 187 mov r9,r8
205 mov.l r9,@r8
206 mov r9,r8
207#ifdef CONFIG_TRACE_IRQFLAGS
208 mov.l 2f, r9
209 jsr @r9
210 nop
211#endif
212 sti
213 bra system_call
214 nop
215 188
216 .align 2
217#ifdef CONFIG_TRACE_IRQFLAGS
2182: .long trace_hardirqs_on
219#endif
220
221#if defined(CONFIG_SH_STANDARD_BIOS) 189#if defined(CONFIG_SH_STANDARD_BIOS)
222 /* Unwind the stack and jmp to the debug entry */ 190 /* Unwind the stack and jmp to the debug entry */
223ENTRY(sh_bios_handler) 191ENTRY(sh_bios_handler)
@@ -240,7 +208,7 @@ ENTRY(sh_bios_handler)
240 mov.l @r2,r2 208 mov.l @r2,r2
241 stc sr,r3 209 stc sr,r3
242 mov.l r2,@r0 210 mov.l r2,@r0
243 mov.l r3,@r0 211 mov.l r3,@(4,r0)
244 mov.l r1,@(8,r0) 212 mov.l r1,@(8,r0)
245 mov.l @r15+, r0 213 mov.l @r15+, r0
246 mov.l @r15+, r1 214 mov.l @r15+, r1
@@ -272,22 +240,30 @@ ENTRY(address_error_trap_handler)
272 mov.l 1f,r0 240 mov.l 1f,r0
273 jmp @r0 241 jmp @r0
274 mov #0,r5 ! writeaccess is unknown 242 mov #0,r5 ! writeaccess is unknown
275 .align 2
276 243
244 .align 2
2771: .long do_address_error 2451: .long do_address_error
278 246
279restore_all: 247restore_all:
280 cli 248 stc sr,r0
281#ifdef CONFIG_TRACE_IRQFLAGS 249 or #0xf0,r0
282 mov.l 1f, r0 250 ldc r0,sr ! all interrupt block (same BL = 1)
283 jsr @r0 251 ! restore special register
284 nop 252 ! overlap exception frame
285#endif 253 mov r15,r0
254 add #17*4,r0
255 lds.l @r0+,pr
256 add #4,r0
257 ldc.l @r0+,gbr
258 lds.l @r0+,mach
259 lds.l @r0+,macl
286 mov r15,r0 260 mov r15,r0
287 mov.l $cpu_mode,r2 261 mov.l $cpu_mode,r2
288 mov #OFF_SR,r3 262 mov #OFF_SR,r3
289 mov.l @(r0,r3),r1 263 mov.l @(r0,r3),r1
290 mov.l r1,@r2 264 mov.l __md_bit,r3
265 and r1,r3 ! copy MD bit
266 mov.l r3,@r2
291 shll2 r1 ! clear MD bit 267 shll2 r1 ! clear MD bit
292 shlr2 r1 268 shlr2 r1
293 mov.l @(OFF_SP,r0),r2 269 mov.l @(OFF_SP,r0),r2
@@ -297,12 +273,6 @@ restore_all:
297 mov #OFF_PC,r3 273 mov #OFF_PC,r3
298 mov.l @(r0,r3),r1 274 mov.l @(r0,r3),r1
299 mov.l r1,@r2 ! set pc 275 mov.l r1,@r2 ! set pc
300 add #4*16+4,r0
301 lds.l @r0+,pr
302 add #4,r0 ! skip sr
303 ldc.l @r0+,gbr
304 lds.l @r0+,mach
305 lds.l @r0+,macl
306 get_current_thread_info r0, r1 276 get_current_thread_info r0, r1
307 mov.l $current_thread_info,r1 277 mov.l $current_thread_info,r1
308 mov.l r0,@r1 278 mov.l r0,@r1
@@ -326,9 +296,8 @@ restore_all:
326 nop 296 nop
327 297
328 .align 2 298 .align 2
329#ifdef CONFIG_TRACE_IRQFLAGS 299__md_bit:
3301: .long trace_hardirqs_off 300 .long 0x40000000
331#endif
332$current_thread_info: 301$current_thread_info:
333 .long __current_thread_info 302 .long __current_thread_info
334$cpu_mode: 303$cpu_mode:
diff --git a/arch/sh/kernel/cpu/sh2/ex.S b/arch/sh/kernel/cpu/sh2/ex.S
index 6d285af7846c..85b0bf81fc1d 100644
--- a/arch/sh/kernel/cpu/sh2/ex.S
+++ b/arch/sh/kernel/cpu/sh2/ex.S
@@ -18,16 +18,17 @@
18exception_entry: 18exception_entry:
19no = 0 19no = 0
20 .rept 256 20 .rept 256
21 mov.l r0,@-sp 21 mov.l r1,@-sp
22 mov #no,r0
23 bra exception_trampoline 22 bra exception_trampoline
24 and #0xff,r0 23 mov #no,r1
25no = no + 1 24no = no + 1
26 .endr 25 .endr
27exception_trampoline: 26exception_trampoline:
28 mov.l r1,@-sp 27 mov.l r0,@-sp
29 mov.l $exception_handler,r1 28 mov.l $exception_handler,r0
30 jmp @r1 29 extu.b r1,r1
30 jmp @r0
31 extu.w r1,r1
31 32
32 .align 2 33 .align 2
33$exception_entry: 34$exception_entry:
@@ -41,6 +42,6 @@ $exception_handler:
41ENTRY(vbr_base) 42ENTRY(vbr_base)
42vector = 0 43vector = 0
43 .rept 256 44 .rept 256
44 .long exception_entry + vector * 8 45 .long exception_entry + vector * 6
45vector = vector + 1 46vector = vector + 1
46 .endr 47 .endr
diff --git a/arch/sh/kernel/cpu/sh2/setup-sh7619.c b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
index cc530f4d84d6..56e5878e5516 100644
--- a/arch/sh/kernel/cpu/sh2/setup-sh7619.c
+++ b/arch/sh/kernel/cpu/sh2/setup-sh7619.c
@@ -96,8 +96,32 @@ static struct platform_device sci_device = {
96 }, 96 },
97}; 97};
98 98
99static struct resource eth_resources[] = {
100 [0] = {
101 .start = 0xfb000000,
102 .end = 0xfb0001c8,
103 .flags = IORESOURCE_MEM,
104 },
105 [1] = {
106 .start = 85,
107 .end = 85,
108 .flags = IORESOURCE_IRQ,
109 },
110};
111
112static struct platform_device eth_device = {
113 .name = "sh-eth",
114 .id = -1,
115 .dev = {
116 .platform_data = (void *)1,
117 },
118 .num_resources = ARRAY_SIZE(eth_resources),
119 .resource = eth_resources,
120};
121
99static struct platform_device *sh7619_devices[] __initdata = { 122static struct platform_device *sh7619_devices[] __initdata = {
100 &sci_device, 123 &sci_device,
124 &eth_device,
101}; 125};
102 126
103static int __init sh7619_devices_setup(void) 127static int __init sh7619_devices_setup(void)
diff --git a/arch/sh/kernel/cpu/sh2a/Makefile b/arch/sh/kernel/cpu/sh2a/Makefile
index 7e2b90cfa7bf..1ab1ecf4c768 100644
--- a/arch/sh/kernel/cpu/sh2a/Makefile
+++ b/arch/sh/kernel/cpu/sh2a/Makefile
@@ -4,7 +4,7 @@
4 4
5obj-y := common.o probe.o opcode_helper.o 5obj-y := common.o probe.o opcode_helper.o
6 6
7common-y += $(addprefix ../sh2/, ex.o entry.o) 7common-y += ex.o entry.o
8 8
9obj-$(CONFIG_SH_FPU) += fpu.o 9obj-$(CONFIG_SH_FPU) += fpu.o
10 10
diff --git a/arch/sh/kernel/cpu/sh2a/entry.S b/arch/sh/kernel/cpu/sh2a/entry.S
new file mode 100644
index 000000000000..ab3903eeda5c
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh2a/entry.S
@@ -0,0 +1,249 @@
1/*
2 * arch/sh/kernel/cpu/sh2a/entry.S
3 *
4 * The SH-2A exception entry
5 *
6 * Copyright (C) 2008 Yoshinori Sato
7 * Based on arch/sh/kernel/cpu/sh2/entry.S
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13
14#include <linux/linkage.h>
15#include <asm/asm-offsets.h>
16#include <asm/thread_info.h>
17#include <cpu/mmu_context.h>
18#include <asm/unistd.h>
19#include <asm/errno.h>
20#include <asm/page.h>
21
22/* Offsets to the stack */
23OFF_R0 = 0 /* Return value. New ABI also arg4 */
24OFF_R1 = 4 /* New ABI: arg5 */
25OFF_R2 = 8 /* New ABI: arg6 */
26OFF_R3 = 12 /* New ABI: syscall_nr */
27OFF_R4 = 16 /* New ABI: arg0 */
28OFF_R5 = 20 /* New ABI: arg1 */
29OFF_R6 = 24 /* New ABI: arg2 */
30OFF_R7 = 28 /* New ABI: arg3 */
31OFF_SP = (15*4)
32OFF_PC = (16*4)
33OFF_SR = (16*4+2*4)
34OFF_TRA = (16*4+6*4)
35
36#include <asm/entry-macros.S>
37
38ENTRY(exception_handler)
39 ! stack
40 ! r0 <- point sp
41 ! r1
42 ! pc
43 ! sr
44 ! r0 = temporary
45 ! r1 = vector (pseudo EXPEVT / INTEVT / TRA)
46 mov.l r2,@-sp
47 cli
48 mov.l $cpu_mode,r2
49 bld.b #6,@(0,r2) !previus SR.MD
50 bst.b #6,@(4*4,r15) !set cpu mode to SR.MD
51 bt 1f
52 ! switch to kernel mode
53 bset.b #6,@(0,r2) !set SR.MD
54 mov.l $current_thread_info,r2
55 mov.l @r2,r2
56 mov #(THREAD_SIZE >> 8),r0
57 shll8 r0
58 add r2,r0 ! r0 = kernel stack tail
59 mov r15,r2 ! r2 = user stack top
60 mov r0,r15 ! switch kernel stack
61 mov.l r1,@-r15 ! TRA
62 sts.l macl, @-r15
63 sts.l mach, @-r15
64 stc.l gbr, @-r15
65 mov.l @(4*4,r2),r0
66 mov.l r0,@-r15 ! original SR
67 sts.l pr,@-r15
68 mov.l @(3*4,r2),r0
69 mov.l r0,@-r15 ! original PC
70 mov r2,r0
71 add #(3+2)*4,r0 ! rewind r0 - r3 + exception frame
72 lds r0,pr ! pr = original SP
73 movmu.l r3,@-r15 ! save regs
74 mov r2,r8 ! r8 = previus stack top
75 mov r1,r9 ! r9 = interrupt vector
76 ! restore previous stack
77 mov.l @r8+,r2
78 mov.l @r8+,r0
79 mov.l @r8+,r1
80 bra 2f
81 movml.l r2,@-r15
821:
83 ! in kernel exception
84 mov r15,r2
85 add #-((OFF_TRA + 4) - OFF_PC) + 5*4,r15
86 movmu.l r3,@-r15
87 mov r2,r8 ! r8 = previous stack top
88 mov r1,r9 ! r9 = interrupt vector
89 ! restore exception frame & regs
90 mov.l @r8+,r2 ! old R2
91 mov.l @r8+,r0 ! old R0
92 mov.l @r8+,r1 ! old R1
93 mov.l @r8+,r10 ! old PC
94 mov.l @r8+,r11 ! old SR
95 movml.l r2,@-r15
96 mov.l r10,@(OFF_PC,r15)
97 mov.l r11,@(OFF_SR,r15)
98 mov.l r8,@(OFF_SP,r15) ! save old sp
99 mov r15,r8
100 add #OFF_TRA + 4,r8
101 mov.l r9,@-r8
102 sts.l macl,@-r8
103 sts.l mach,@-r8
104 stc.l gbr,@-r8
105 add #-4,r8
106 sts.l pr,@-r8
1072:
108 ! dispatch exception / interrupt
109 mov #64,r8
110 cmp/hs r8,r9
111 bt interrupt_entry ! vec >= 64 is interrupt
112 mov #32,r8
113 cmp/hs r8,r9
114 bt trap_entry ! 64 > vec >= 32 is trap
115
116 mov.l 4f,r8
117 mov r9,r4
118 shll2 r9
119 add r9,r8
120 mov.l @r8,r8 ! exception handler address
121 tst r8,r8
122 bf 3f
123 mov.l 8f,r8 ! unhandled exception
1243:
125 mov.l 5f,r10
126 jmp @r8
127 lds r10,pr
128
129interrupt_entry:
130 mov r9,r4
131 mov r15,r5
132 mov.l 7f,r8
133 mov.l 6f,r9
134 jmp @r8
135 lds r9,pr
136
137 .align 2
1384: .long exception_handling_table
1395: .long ret_from_exception
1406: .long ret_from_irq
1417: .long do_IRQ
1428: .long exception_error
143
144trap_entry:
145 mov #0x30,r8
146 cmp/ge r8,r9 ! vector 0x20-0x2f is systemcall
147 bt 1f
148 add #-0x10,r9 ! convert SH2 to SH3/4 ABI
1491:
150 shll2 r9 ! TRA
151 bra system_call ! jump common systemcall entry
152 mov r9,r8
153
154#if defined(CONFIG_SH_STANDARD_BIOS)
155 /* Unwind the stack and jmp to the debug entry */
156ENTRY(sh_bios_handler)
157 mov r15,r0
158 add #(22-4)*4-4,r0
159 ldc.l @r0+,gbr
160 lds.l @r0+,mach
161 lds.l @r0+,macl
162 mov r15,r0
163 mov.l @(OFF_SP,r0),r1
164 mov.l @(OFF_SR,r2),r3
165 mov.l r3,@-r1
166 mov.l @(OFF_SP,r2),r3
167 mov.l r3,@-r1
168 mov r15,r0
169 add #(22-4)*4-8,r0
170 mov.l 1f,r2
171 mov.l @r2,r2
172 stc sr,r3
173 mov.l r2,@r0
174 mov.l r3,@(4,r0)
175 mov.l r1,@(8,r0)
176 movml.l @r15+,r14
177 add #8,r15
178 lds.l @r15+, pr
179 rte
180 mov.l @r15+,r15
181 .align 2
1821: .long gdb_vbr_vector
183#endif /* CONFIG_SH_STANDARD_BIOS */
184
185ENTRY(address_error_trap_handler)
186 mov r15,r4 ! regs
187 mov.l @(OFF_PC,r15),r6 ! pc
188 mov.l 1f,r0
189 jmp @r0
190 mov #0,r5 ! writeaccess is unknown
191
192 .align 2
1931: .long do_address_error
194
195restore_all:
196 stc sr,r0
197 or #0xf0,r0
198 ldc r0,sr ! all interrupt block (same BL = 1)
199 ! restore special register
200 ! overlap exception frame
201 mov r15,r0
202 add #17*4,r0
203 lds.l @r0+,pr
204 add #4,r0
205 ldc.l @r0+,gbr
206 lds.l @r0+,mach
207 lds.l @r0+,macl
208 mov r15,r0
209 mov.l $cpu_mode,r2
210 bld.b #6,@(OFF_SR,r15)
211 bst.b #6,@(0,r2) ! save CPU mode
212 mov.l @(OFF_SR,r0),r1
213 shll2 r1
214 shlr2 r1 ! clear MD bit
215 mov.l @(OFF_SP,r0),r2
216 add #-8,r2
217 mov.l r2,@(OFF_SP,r0) ! point exception frame top
218 mov.l r1,@(4,r2) ! set sr
219 mov.l @(OFF_PC,r0),r1
220 mov.l r1,@r2 ! set pc
221 get_current_thread_info r0, r1
222 mov.l $current_thread_info,r1
223 mov.l r0,@r1
224 movml.l @r15+,r14
225 mov.l @r15,r15
226 rte
227 nop
228
229 .align 2
230$current_thread_info:
231 .long __current_thread_info
232$cpu_mode:
233 .long __cpu_mode
234
235! common exception handler
236#include "../../entry-common.S"
237
238 .data
239! cpu operation mode
240! bit30 = MD (compatible SH3/4)
241__cpu_mode:
242 .long 0x40000000
243
244 .section .bss
245__current_thread_info:
246 .long 0
247
248ENTRY(exception_handling_table)
249 .space 4*32
diff --git a/arch/sh/kernel/cpu/sh2a/ex.S b/arch/sh/kernel/cpu/sh2a/ex.S
new file mode 100644
index 000000000000..3ead9e63965a
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh2a/ex.S
@@ -0,0 +1,72 @@
1/*
2 * arch/sh/kernel/cpu/sh2a/ex.S
3 *
4 * The SH-2A exception vector table
5 *
6 * Copyright (C) 2008 Yoshinori Sato
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12
13#include <linux/linkage.h>
14
15!
16! convert Exception Vector to Exception Number
17!
18
19! exception no 0 to 255
20exception_entry0:
21no = 0
22 .rept 256
23 mov.l r1,@-sp
24 bra exception_trampoline0
25 mov #no,r1
26no = no + 1
27 .endr
28exception_trampoline0:
29 mov.l r0,@-sp
30 mov.l 1f,r0
31 extu.b r1,r1
32 jmp @r0
33 extu.w r1,r1
34
35 .align 2
361: .long exception_handler
37
38! exception no 256 to 511
39exception_entry1:
40no = 0
41 .rept 256
42 mov.l r1,@-sp
43 bra exception_trampoline1
44 mov #no,r1
45no = no + 1
46 .endr
47exception_trampoline1:
48 mov.l r0,@-sp
49 extu.b r1,r1
50 movi20 #0x100,r0
51 add r0,r1
52 mov.l 1f,r0
53 jmp @r0
54 extu.w r1,r1
55
56 .align 2
571: .long exception_handler
58
59 !
60! Exception Vector Base
61!
62 .align 2
63ENTRY(vbr_base)
64vector = 0
65 .rept 256
66 .long exception_entry0 + vector * 6
67vector = vector + 1
68 .endr
69 .rept 256
70 .long exception_entry1 + vector * 6
71vector = vector + 1
72 .endr
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S
index 4004073f98cd..3fe482dd05c1 100644
--- a/arch/sh/kernel/cpu/sh3/entry.S
+++ b/arch/sh/kernel/cpu/sh3/entry.S
@@ -14,7 +14,7 @@
14#include <asm/asm-offsets.h> 14#include <asm/asm-offsets.h>
15#include <asm/thread_info.h> 15#include <asm/thread_info.h>
16#include <asm/unistd.h> 16#include <asm/unistd.h>
17#include <asm/cpu/mmu_context.h> 17#include <cpu/mmu_context.h>
18#include <asm/page.h> 18#include <asm/page.h>
19 19
20! NOTE: 20! NOTE:
diff --git a/arch/sh/kernel/cpu/sh3/ex.S b/arch/sh/kernel/cpu/sh3/ex.S
index 11b6d9c6edae..dac429726899 100644
--- a/arch/sh/kernel/cpu/sh3/ex.S
+++ b/arch/sh/kernel/cpu/sh3/ex.S
@@ -4,7 +4,7 @@
4 * The SH-3 and SH-4 exception vector table. 4 * The SH-3 and SH-4 exception vector table.
5 5
6 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka 6 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka
7 * Copyright (C) 2003 - 2006 Paul Mundt 7 * Copyright (C) 2003 - 2008 Paul Mundt
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General Public 9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive 10 * License. See the file "COPYING" in the main directory of this archive
@@ -12,13 +12,30 @@
12 */ 12 */
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14 14
15#if !defined(CONFIG_MMU)
16#define tlb_miss_load exception_error
17#define tlb_miss_store exception_error
18#define initial_page_write exception_error
19#define tlb_protection_violation_load exception_error
20#define tlb_protection_violation_store exception_error
21#define address_error_load exception_error
22#define address_error_store exception_error
23#endif
24
25#if !defined(CONFIG_SH_FPU)
26#define fpu_error_trap_handler exception_error
27#endif
28
29#if !defined(CONFIG_KGDB_NMI)
30#define kgdb_handle_exception exception_error
31#endif
32
15 .align 2 33 .align 2
16 .data 34 .data
17 35
18ENTRY(exception_handling_table) 36ENTRY(exception_handling_table)
19 .long exception_error /* 000 */ 37 .long exception_error /* 000 */
20 .long exception_error 38 .long exception_error
21#if defined(CONFIG_MMU)
22 .long tlb_miss_load /* 040 */ 39 .long tlb_miss_load /* 040 */
23 .long tlb_miss_store 40 .long tlb_miss_store
24 .long initial_page_write 41 .long initial_page_write
@@ -26,30 +43,13 @@ ENTRY(exception_handling_table)
26 .long tlb_protection_violation_store 43 .long tlb_protection_violation_store
27 .long address_error_load 44 .long address_error_load
28 .long address_error_store /* 100 */ 45 .long address_error_store /* 100 */
29#else
30 .long exception_error ! tlb miss load /* 040 */
31 .long exception_error ! tlb miss store
32 .long exception_error ! initial page write
33 .long exception_error ! tlb prot violation load
34 .long exception_error ! tlb prot violation store
35 .long exception_error ! address error load
36 .long exception_error ! address error store /* 100 */
37#endif
38#if defined(CONFIG_SH_FPU)
39 .long fpu_error_trap_handler /* 120 */ 46 .long fpu_error_trap_handler /* 120 */
40#else
41 .long exception_error /* 120 */
42#endif
43 .long exception_error /* 140 */ 47 .long exception_error /* 140 */
44 .long system_call ! Unconditional Trap /* 160 */ 48 .long system_call ! Unconditional Trap /* 160 */
45 .long exception_error ! reserved_instruction (filled by trap_init) /* 180 */ 49 .long exception_error ! reserved_instruction (filled by trap_init) /* 180 */
46 .long exception_error ! illegal_slot_instruction (filled by trap_init) /*1A0*/ 50 .long exception_error ! illegal_slot_instruction (filled by trap_init) /*1A0*/
47ENTRY(nmi_slot) 51ENTRY(nmi_slot)
48#if defined (CONFIG_KGDB_NMI)
49 .long kgdb_handle_exception /* 1C0 */ ! Allow trap to debugger 52 .long kgdb_handle_exception /* 1C0 */ ! Allow trap to debugger
50#else
51 .long exception_none /* 1C0 */ ! Not implemented yet
52#endif
53ENTRY(user_break_point_trap) 53ENTRY(user_break_point_trap)
54 .long break_point_trap /* 1E0 */ 54 .long break_point_trap /* 1E0 */
55 55
diff --git a/arch/sh/kernel/cpu/sh4/fpu.c b/arch/sh/kernel/cpu/sh4/fpu.c
index 8020796139f1..2d452f67fb87 100644
--- a/arch/sh/kernel/cpu/sh4/fpu.c
+++ b/arch/sh/kernel/cpu/sh4/fpu.c
@@ -13,7 +13,7 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/signal.h> 14#include <linux/signal.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <asm/cpu/fpu.h> 16#include <cpu/fpu.h>
17#include <asm/processor.h> 17#include <asm/processor.h>
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/fpu.h> 19#include <asm/fpu.h>
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index be4926969181..2e42572b1b11 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -50,14 +50,18 @@ int __init detect_cpu_and_cache_system(void)
50 boot_cpu_data.dcache.ways = 1; 50 boot_cpu_data.dcache.ways = 1;
51 boot_cpu_data.dcache.linesz = L1_CACHE_BYTES; 51 boot_cpu_data.dcache.linesz = L1_CACHE_BYTES;
52 52
53 /* We don't know the chip cut */
54 boot_cpu_data.cut_major = boot_cpu_data.cut_minor = -1;
55
53 /* 56 /*
54 * Setup some generic flags we can probe on SH-4A parts 57 * Setup some generic flags we can probe on SH-4A parts
55 */ 58 */
56 if (((pvr >> 24) & 0xff) == 0x10) { 59 if (((pvr >> 16) & 0xff) == 0x10) {
57 if ((cvr & 0x10000000) == 0) 60 if ((cvr & 0x10000000) == 0)
58 boot_cpu_data.flags |= CPU_HAS_DSP; 61 boot_cpu_data.flags |= CPU_HAS_DSP;
59 62
60 boot_cpu_data.flags |= CPU_HAS_LLSC; 63 boot_cpu_data.flags |= CPU_HAS_LLSC;
64 boot_cpu_data.cut_major = pvr & 0x7f;
61 } 65 }
62 66
63 /* FPU detection works for everyone */ 67 /* FPU detection works for everyone */
diff --git a/arch/sh/kernel/cpu/sh4/softfloat.c b/arch/sh/kernel/cpu/sh4/softfloat.c
index 7b2d337ee412..828cb57cb959 100644
--- a/arch/sh/kernel/cpu/sh4/softfloat.c
+++ b/arch/sh/kernel/cpu/sh4/softfloat.c
@@ -36,7 +36,7 @@
36 * and Kamel Khelifi <kamel.khelifi@st.com> 36 * and Kamel Khelifi <kamel.khelifi@st.com>
37 */ 37 */
38#include <linux/kernel.h> 38#include <linux/kernel.h>
39#include <asm/cpu/fpu.h> 39#include <cpu/fpu.h>
40 40
41#define LIT64( a ) a##LL 41#define LIT64( a ) a##LL
42 42
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c
index 9561b02ade0e..dcdf959a3d44 100644
--- a/arch/sh/kernel/cpu/sh4/sq.c
+++ b/arch/sh/kernel/cpu/sh4/sq.c
@@ -22,7 +22,7 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <asm/page.h> 23#include <asm/page.h>
24#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
25#include <asm/cpu/sq.h> 25#include <cpu/sq.h>
26 26
27struct sq_mapping; 27struct sq_mapping;
28 28
diff --git a/arch/sh/kernel/cpu/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile
index a880e7968750..9381ad8da263 100644
--- a/arch/sh/kernel/cpu/sh4a/Makefile
+++ b/arch/sh/kernel/cpu/sh4a/Makefile
@@ -21,7 +21,7 @@ clock-$(CONFIG_CPU_SUBTYPE_SH7763) := clock-sh7763.o
21clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o 21clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o
22clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o 22clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o
23clock-$(CONFIG_CPU_SUBTYPE_SH7785) := clock-sh7785.o 23clock-$(CONFIG_CPU_SUBTYPE_SH7785) := clock-sh7785.o
24clock-$(CONFIG_CPU_SUBTYPE_SH7343) := clock-sh7343.o 24clock-$(CONFIG_CPU_SUBTYPE_SH7343) := clock-sh7722.o
25clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7722.o 25clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7722.o
26clock-$(CONFIG_CPU_SUBTYPE_SH7723) := clock-sh7722.o 26clock-$(CONFIG_CPU_SUBTYPE_SH7723) := clock-sh7722.o
27clock-$(CONFIG_CPU_SUBTYPE_SH7366) := clock-sh7722.o 27clock-$(CONFIG_CPU_SUBTYPE_SH7366) := clock-sh7722.o
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c b/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
deleted file mode 100644
index 7adc4f16e95a..000000000000
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7343.c
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * arch/sh/kernel/cpu/sh4a/clock-sh7343.c
3 *
4 * SH7343/SH7722 support for the clock framework
5 *
6 * Copyright (C) 2006 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/io.h>
15#include <asm/clock.h>
16#include <asm/freq.h>
17
18/*
19 * SH7343/SH7722 uses a common set of multipliers and divisors, so this
20 * is quite simple..
21 */
22static int multipliers[] = { 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
23static int divisors[] = { 1, 3, 2, 5, 3, 4, 5, 6, 8, 10, 12, 16, 20 };
24
25#define pll_calc() (((ctrl_inl(FRQCR) >> 24) & 0x1f) + 1)
26
27static void master_clk_init(struct clk *clk)
28{
29 clk->parent = clk_get(NULL, "cpu_clk");
30}
31
32static void master_clk_recalc(struct clk *clk)
33{
34 int idx = (ctrl_inl(FRQCR) & 0x000f);
35 clk->rate *= clk->parent->rate * multipliers[idx] / divisors[idx];
36}
37
38static struct clk_ops sh7343_master_clk_ops = {
39 .init = master_clk_init,
40 .recalc = master_clk_recalc,
41};
42
43static void module_clk_init(struct clk *clk)
44{
45 clk->parent = NULL;
46 clk->rate = CONFIG_SH_PCLK_FREQ;
47}
48
49static struct clk_ops sh7343_module_clk_ops = {
50 .init = module_clk_init,
51};
52
53static void bus_clk_init(struct clk *clk)
54{
55 clk->parent = clk_get(NULL, "cpu_clk");
56}
57
58static void bus_clk_recalc(struct clk *clk)
59{
60 int idx = (ctrl_inl(FRQCR) >> 8) & 0x000f;
61 clk->rate = clk->parent->rate * multipliers[idx] / divisors[idx];
62}
63
64static struct clk_ops sh7343_bus_clk_ops = {
65 .init = bus_clk_init,
66 .recalc = bus_clk_recalc,
67};
68
69static void cpu_clk_init(struct clk *clk)
70{
71 clk->parent = clk_get(NULL, "module_clk");
72 clk->flags |= CLK_RATE_PROPAGATES;
73 clk_set_rate(clk, clk_get_rate(clk));
74}
75
76static void cpu_clk_recalc(struct clk *clk)
77{
78 int idx = (ctrl_inl(FRQCR) >> 20) & 0x000f;
79 clk->rate = clk->parent->rate * pll_calc() *
80 multipliers[idx] / divisors[idx];
81}
82
83static struct clk_ops sh7343_cpu_clk_ops = {
84 .init = cpu_clk_init,
85 .recalc = cpu_clk_recalc,
86};
87
88static struct clk_ops *sh7343_clk_ops[] = {
89 &sh7343_master_clk_ops,
90 &sh7343_module_clk_ops,
91 &sh7343_bus_clk_ops,
92 &sh7343_cpu_clk_ops,
93};
94
95void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
96{
97 if (idx < ARRAY_SIZE(sh7343_clk_ops))
98 *ops = sh7343_clk_ops[idx];
99}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index 299138ebe160..db913855c2fd 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/sh/kernel/cpu/sh4a/clock-sh7722.c 2 * arch/sh/kernel/cpu/sh4a/clock-sh7722.c
3 * 3 *
4 * SH7722 & SH7366 support for the clock framework 4 * SH7343, SH7722, SH7723 & SH7366 support for the clock framework
5 * 5 *
6 * Copyright (c) 2006-2007 Nomad Global Solutions Inc 6 * Copyright (c) 2006-2007 Nomad Global Solutions Inc
7 * Based on code for sh7343 by Paul Mundt 7 * Based on code for sh7343 by Paul Mundt
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/stringify.h>
17#include <asm/clock.h> 18#include <asm/clock.h>
18#include <asm/freq.h> 19#include <asm/freq.h>
19 20
@@ -411,40 +412,40 @@ static struct clk_ops sh7722_frqcr_clk_ops = {
411 * clock ops methods for SIU A/B and IrDA clock 412 * clock ops methods for SIU A/B and IrDA clock
412 * 413 *
413 */ 414 */
414static int sh7722_siu_which(struct clk *clk) 415
416#ifndef CONFIG_CPU_SUBTYPE_SH7343
417
418static int sh7722_siu_set_rate(struct clk *clk, unsigned long rate, int algo_id)
415{ 419{
416 if (!strcmp(clk->name, "siu_a_clk")) 420 unsigned long r;
417 return 0; 421 int div;
418 if (!strcmp(clk->name, "siu_b_clk")) 422
419 return 1; 423 r = ctrl_inl(clk->arch_flags);
420#if defined(CONFIG_CPU_SUBTYPE_SH7722) 424 div = sh7722_find_divisors(clk->parent->rate, rate);
421 if (!strcmp(clk->name, "irda_clk")) 425 if (div < 0)
422 return 2; 426 return div;
423#endif 427 r = (r & ~0xF) | div;
424 return -EINVAL; 428 ctrl_outl(r, clk->arch_flags);
429 return 0;
425} 430}
426 431
427static unsigned long sh7722_siu_regs[] = { 432static void sh7722_siu_recalc(struct clk *clk)
428 [0] = SCLKACR, 433{
429 [1] = SCLKBCR, 434 unsigned long r;
430#if defined(CONFIG_CPU_SUBTYPE_SH7722) 435
431 [2] = IrDACLKCR, 436 r = ctrl_inl(clk->arch_flags);
432#endif 437 clk->rate = clk->parent->rate * 2 / divisors2[r & 0xF];
433}; 438}
434 439
435static int sh7722_siu_start_stop(struct clk *clk, int enable) 440static int sh7722_siu_start_stop(struct clk *clk, int enable)
436{ 441{
437 int siu = sh7722_siu_which(clk);
438 unsigned long r; 442 unsigned long r;
439 443
440 if (siu < 0) 444 r = ctrl_inl(clk->arch_flags);
441 return siu;
442 BUG_ON(siu > 2);
443 r = ctrl_inl(sh7722_siu_regs[siu]);
444 if (enable) 445 if (enable)
445 ctrl_outl(r & ~(1 << 8), sh7722_siu_regs[siu]); 446 ctrl_outl(r & ~(1 << 8), clk->arch_flags);
446 else 447 else
447 ctrl_outl(r | (1 << 8), sh7722_siu_regs[siu]); 448 ctrl_outl(r | (1 << 8), clk->arch_flags);
448 return 0; 449 return 0;
449} 450}
450 451
@@ -458,6 +459,15 @@ static void sh7722_siu_disable(struct clk *clk)
458 sh7722_siu_start_stop(clk, 0); 459 sh7722_siu_start_stop(clk, 0);
459} 460}
460 461
462static struct clk_ops sh7722_siu_clk_ops = {
463 .recalc = sh7722_siu_recalc,
464 .set_rate = sh7722_siu_set_rate,
465 .enable = sh7722_siu_enable,
466 .disable = sh7722_siu_disable,
467};
468
469#endif /* CONFIG_CPU_SUBTYPE_SH7343 */
470
461static void sh7722_video_enable(struct clk *clk) 471static void sh7722_video_enable(struct clk *clk)
462{ 472{
463 unsigned long r; 473 unsigned long r;
@@ -494,43 +504,6 @@ static void sh7722_video_recalc(struct clk *clk)
494 clk->rate = clk->parent->rate / ((r & 0x3F) + 1); 504 clk->rate = clk->parent->rate / ((r & 0x3F) + 1);
495} 505}
496 506
497static int sh7722_siu_set_rate(struct clk *clk, unsigned long rate, int algo_id)
498{
499 int siu = sh7722_siu_which(clk);
500 unsigned long r;
501 int div;
502
503 if (siu < 0)
504 return siu;
505 BUG_ON(siu > 2);
506 r = ctrl_inl(sh7722_siu_regs[siu]);
507 div = sh7722_find_divisors(clk->parent->rate, rate);
508 if (div < 0)
509 return div;
510 r = (r & ~0xF) | div;
511 ctrl_outl(r, sh7722_siu_regs[siu]);
512 return 0;
513}
514
515static void sh7722_siu_recalc(struct clk *clk)
516{
517 int siu = sh7722_siu_which(clk);
518 unsigned long r;
519
520 if (siu < 0)
521 return /* siu */ ;
522 BUG_ON(siu > 2);
523 r = ctrl_inl(sh7722_siu_regs[siu]);
524 clk->rate = clk->parent->rate * 2 / divisors2[r & 0xF];
525}
526
527static struct clk_ops sh7722_siu_clk_ops = {
528 .recalc = sh7722_siu_recalc,
529 .set_rate = sh7722_siu_set_rate,
530 .enable = sh7722_siu_enable,
531 .disable = sh7722_siu_disable,
532};
533
534static struct clk_ops sh7722_video_clk_ops = { 507static struct clk_ops sh7722_video_clk_ops = {
535 .recalc = sh7722_video_recalc, 508 .recalc = sh7722_video_recalc,
536 .set_rate = sh7722_video_set_rate, 509 .set_rate = sh7722_video_set_rate,
@@ -560,6 +533,9 @@ static struct clk sh7722_sdram_clock = {
560 .ops = &sh7722_frqcr_clk_ops, 533 .ops = &sh7722_frqcr_clk_ops,
561}; 534};
562 535
536
537#ifndef CONFIG_CPU_SUBTYPE_SH7343
538
563/* 539/*
564 * these three clocks - SIU A, SIU B, IrDA - share the same clk_ops 540 * these three clocks - SIU A, SIU B, IrDA - share the same clk_ops
565 * methods of clk_ops determine which register they should access by 541 * methods of clk_ops determine which register they should access by
@@ -567,36 +543,151 @@ static struct clk sh7722_sdram_clock = {
567 */ 543 */
568static struct clk sh7722_siu_a_clock = { 544static struct clk sh7722_siu_a_clock = {
569 .name = "siu_a_clk", 545 .name = "siu_a_clk",
546 .arch_flags = SCLKACR,
570 .ops = &sh7722_siu_clk_ops, 547 .ops = &sh7722_siu_clk_ops,
571}; 548};
572 549
573static struct clk sh7722_siu_b_clock = { 550static struct clk sh7722_siu_b_clock = {
574 .name = "siu_b_clk", 551 .name = "siu_b_clk",
552 .arch_flags = SCLKBCR,
575 .ops = &sh7722_siu_clk_ops, 553 .ops = &sh7722_siu_clk_ops,
576}; 554};
577 555
578#if defined(CONFIG_CPU_SUBTYPE_SH7722) 556#if defined(CONFIG_CPU_SUBTYPE_SH7722)
579static struct clk sh7722_irda_clock = { 557static struct clk sh7722_irda_clock = {
580 .name = "irda_clk", 558 .name = "irda_clk",
559 .arch_flags = IrDACLKCR,
581 .ops = &sh7722_siu_clk_ops, 560 .ops = &sh7722_siu_clk_ops,
582}; 561};
583#endif 562#endif
563#endif /* CONFIG_CPU_SUBTYPE_SH7343 */
584 564
585static struct clk sh7722_video_clock = { 565static struct clk sh7722_video_clock = {
586 .name = "video_clk", 566 .name = "video_clk",
587 .ops = &sh7722_video_clk_ops, 567 .ops = &sh7722_video_clk_ops,
588}; 568};
589 569
570static int sh7722_mstpcr_start_stop(struct clk *clk, unsigned long reg,
571 int enable)
572{
573 unsigned long bit = clk->arch_flags;
574 unsigned long r;
575
576 r = ctrl_inl(reg);
577
578 if (enable)
579 r &= ~(1 << bit);
580 else
581 r |= (1 << bit);
582
583 ctrl_outl(r, reg);
584 return 0;
585}
586
587static void sh7722_mstpcr0_enable(struct clk *clk)
588{
589 sh7722_mstpcr_start_stop(clk, MSTPCR0, 1);
590}
591
592static void sh7722_mstpcr0_disable(struct clk *clk)
593{
594 sh7722_mstpcr_start_stop(clk, MSTPCR0, 0);
595}
596
597static void sh7722_mstpcr1_enable(struct clk *clk)
598{
599 sh7722_mstpcr_start_stop(clk, MSTPCR1, 1);
600}
601
602static void sh7722_mstpcr1_disable(struct clk *clk)
603{
604 sh7722_mstpcr_start_stop(clk, MSTPCR1, 0);
605}
606
607static void sh7722_mstpcr2_enable(struct clk *clk)
608{
609 sh7722_mstpcr_start_stop(clk, MSTPCR2, 1);
610}
611
612static void sh7722_mstpcr2_disable(struct clk *clk)
613{
614 sh7722_mstpcr_start_stop(clk, MSTPCR2, 0);
615}
616
617static struct clk_ops sh7722_mstpcr0_clk_ops = {
618 .enable = sh7722_mstpcr0_enable,
619 .disable = sh7722_mstpcr0_disable,
620};
621
622static struct clk_ops sh7722_mstpcr1_clk_ops = {
623 .enable = sh7722_mstpcr1_enable,
624 .disable = sh7722_mstpcr1_disable,
625};
626
627static struct clk_ops sh7722_mstpcr2_clk_ops = {
628 .enable = sh7722_mstpcr2_enable,
629 .disable = sh7722_mstpcr2_disable,
630};
631
632#define DECLARE_MSTPCRN(regnr, bitnr, bitstr) \
633{ \
634 .name = "mstp" __stringify(regnr) bitstr, \
635 .arch_flags = bitnr, \
636 .ops = &sh7722_mstpcr ## regnr ## _clk_ops, \
637}
638
639#define DECLARE_MSTPCR(regnr) \
640 DECLARE_MSTPCRN(regnr, 31, "31"), \
641 DECLARE_MSTPCRN(regnr, 30, "30"), \
642 DECLARE_MSTPCRN(regnr, 29, "29"), \
643 DECLARE_MSTPCRN(regnr, 28, "28"), \
644 DECLARE_MSTPCRN(regnr, 27, "27"), \
645 DECLARE_MSTPCRN(regnr, 26, "26"), \
646 DECLARE_MSTPCRN(regnr, 25, "25"), \
647 DECLARE_MSTPCRN(regnr, 24, "24"), \
648 DECLARE_MSTPCRN(regnr, 23, "23"), \
649 DECLARE_MSTPCRN(regnr, 22, "22"), \
650 DECLARE_MSTPCRN(regnr, 21, "21"), \
651 DECLARE_MSTPCRN(regnr, 20, "20"), \
652 DECLARE_MSTPCRN(regnr, 19, "19"), \
653 DECLARE_MSTPCRN(regnr, 18, "18"), \
654 DECLARE_MSTPCRN(regnr, 17, "17"), \
655 DECLARE_MSTPCRN(regnr, 16, "16"), \
656 DECLARE_MSTPCRN(regnr, 15, "15"), \
657 DECLARE_MSTPCRN(regnr, 14, "14"), \
658 DECLARE_MSTPCRN(regnr, 13, "13"), \
659 DECLARE_MSTPCRN(regnr, 12, "12"), \
660 DECLARE_MSTPCRN(regnr, 11, "11"), \
661 DECLARE_MSTPCRN(regnr, 10, "10"), \
662 DECLARE_MSTPCRN(regnr, 9, "09"), \
663 DECLARE_MSTPCRN(regnr, 8, "08"), \
664 DECLARE_MSTPCRN(regnr, 7, "07"), \
665 DECLARE_MSTPCRN(regnr, 6, "06"), \
666 DECLARE_MSTPCRN(regnr, 5, "05"), \
667 DECLARE_MSTPCRN(regnr, 4, "04"), \
668 DECLARE_MSTPCRN(regnr, 3, "03"), \
669 DECLARE_MSTPCRN(regnr, 2, "02"), \
670 DECLARE_MSTPCRN(regnr, 1, "01"), \
671 DECLARE_MSTPCRN(regnr, 0, "00")
672
673static struct clk sh7722_mstpcr[] = {
674 DECLARE_MSTPCR(0),
675 DECLARE_MSTPCR(1),
676 DECLARE_MSTPCR(2),
677};
678
590static struct clk *sh7722_clocks[] = { 679static struct clk *sh7722_clocks[] = {
591 &sh7722_umem_clock, 680 &sh7722_umem_clock,
592 &sh7722_sh_clock, 681 &sh7722_sh_clock,
593 &sh7722_peripheral_clock, 682 &sh7722_peripheral_clock,
594 &sh7722_sdram_clock, 683 &sh7722_sdram_clock,
684#ifndef CONFIG_CPU_SUBTYPE_SH7343
595 &sh7722_siu_a_clock, 685 &sh7722_siu_a_clock,
596 &sh7722_siu_b_clock, 686 &sh7722_siu_b_clock,
597#if defined(CONFIG_CPU_SUBTYPE_SH7722) 687#if defined(CONFIG_CPU_SUBTYPE_SH7722)
598 &sh7722_irda_clock, 688 &sh7722_irda_clock,
599#endif 689#endif
690#endif
600 &sh7722_video_clock, 691 &sh7722_video_clock,
601}; 692};
602 693
@@ -629,5 +720,11 @@ int __init arch_clk_init(void)
629 clk_register(sh7722_clocks[i]); 720 clk_register(sh7722_clocks[i]);
630 } 721 }
631 clk_put(master); 722 clk_put(master);
723
724 for (i = 0; i < ARRAY_SIZE(sh7722_mstpcr); i++) {
725 pr_debug( "Registering mstpcr '%s'\n", sh7722_mstpcr[i].name);
726 clk_register(&sh7722_mstpcr[i]);
727 }
728
632 return 0; 729 return 0;
633} 730}
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
index 6d4f50cd4aaf..78881b4214da 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
@@ -11,6 +11,104 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/serial_sci.h> 13#include <linux/serial_sci.h>
14#include <linux/uio_driver.h>
15#include <asm/clock.h>
16
17static struct resource iic0_resources[] = {
18 [0] = {
19 .name = "IIC0",
20 .start = 0x04470000,
21 .end = 0x04470017,
22 .flags = IORESOURCE_MEM,
23 },
24 [1] = {
25 .start = 96,
26 .end = 99,
27 .flags = IORESOURCE_IRQ,
28 },
29};
30
31static struct platform_device iic0_device = {
32 .name = "i2c-sh_mobile",
33 .num_resources = ARRAY_SIZE(iic0_resources),
34 .resource = iic0_resources,
35};
36
37static struct resource iic1_resources[] = {
38 [0] = {
39 .name = "IIC1",
40 .start = 0x04750000,
41 .end = 0x04750017,
42 .flags = IORESOURCE_MEM,
43 },
44 [1] = {
45 .start = 44,
46 .end = 47,
47 .flags = IORESOURCE_IRQ,
48 },
49};
50
51static struct platform_device iic1_device = {
52 .name = "i2c-sh_mobile",
53 .num_resources = ARRAY_SIZE(iic1_resources),
54 .resource = iic1_resources,
55};
56
57static struct uio_info vpu_platform_data = {
58 .name = "VPU4",
59 .version = "0",
60 .irq = 60,
61};
62
63static struct resource vpu_resources[] = {
64 [0] = {
65 .name = "VPU",
66 .start = 0xfe900000,
67 .end = 0xfe9022eb,
68 .flags = IORESOURCE_MEM,
69 },
70 [1] = {
71 /* place holder for contiguous memory */
72 },
73};
74
75static struct platform_device vpu_device = {
76 .name = "uio_pdrv_genirq",
77 .id = 0,
78 .dev = {
79 .platform_data = &vpu_platform_data,
80 },
81 .resource = vpu_resources,
82 .num_resources = ARRAY_SIZE(vpu_resources),
83};
84
85static struct uio_info veu_platform_data = {
86 .name = "VEU",
87 .version = "0",
88 .irq = 54,
89};
90
91static struct resource veu_resources[] = {
92 [0] = {
93 .name = "VEU",
94 .start = 0xfe920000,
95 .end = 0xfe9200b7,
96 .flags = IORESOURCE_MEM,
97 },
98 [1] = {
99 /* place holder for contiguous memory */
100 },
101};
102
103static struct platform_device veu_device = {
104 .name = "uio_pdrv_genirq",
105 .id = 1,
106 .dev = {
107 .platform_data = &veu_platform_data,
108 },
109 .resource = veu_resources,
110 .num_resources = ARRAY_SIZE(veu_resources),
111};
14 112
15static struct plat_sci_port sci_platform_data[] = { 113static struct plat_sci_port sci_platform_data[] = {
16 { 114 {
@@ -32,16 +130,171 @@ static struct platform_device sci_device = {
32}; 130};
33 131
34static struct platform_device *sh7343_devices[] __initdata = { 132static struct platform_device *sh7343_devices[] __initdata = {
133 &iic0_device,
134 &iic1_device,
35 &sci_device, 135 &sci_device,
136 &vpu_device,
137 &veu_device,
36}; 138};
37 139
38static int __init sh7343_devices_setup(void) 140static int __init sh7343_devices_setup(void)
39{ 141{
142 clk_always_enable("mstp031"); /* TLB */
143 clk_always_enable("mstp030"); /* IC */
144 clk_always_enable("mstp029"); /* OC */
145 clk_always_enable("mstp028"); /* URAM */
146 clk_always_enable("mstp026"); /* XYMEM */
147 clk_always_enable("mstp023"); /* INTC3 */
148 clk_always_enable("mstp022"); /* INTC */
149 clk_always_enable("mstp020"); /* SuperHyway */
150 clk_always_enable("mstp109"); /* I2C0 */
151 clk_always_enable("mstp108"); /* I2C1 */
152 clk_always_enable("mstp202"); /* VEU */
153 clk_always_enable("mstp201"); /* VPU */
154
155 platform_resource_setup_memory(&vpu_device, "vpu", 1 << 20);
156 platform_resource_setup_memory(&veu_device, "veu", 2 << 20);
157
40 return platform_add_devices(sh7343_devices, 158 return platform_add_devices(sh7343_devices,
41 ARRAY_SIZE(sh7343_devices)); 159 ARRAY_SIZE(sh7343_devices));
42} 160}
43__initcall(sh7343_devices_setup); 161__initcall(sh7343_devices_setup);
44 162
163enum {
164 UNUSED = 0,
165
166 /* interrupt sources */
167 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
168 DMAC0, DMAC1, DMAC2, DMAC3,
169 VIO_CEUI, VIO_BEUI, VIO_VEUI, VOU,
170 MFI, VPU, TPU, Z3D4, USBI0, USBI1,
171 MMC_ERR, MMC_TRAN, MMC_FSTAT, MMC_FRDY,
172 DMAC4, DMAC5, DMAC_DADERR,
173 KEYSC,
174 SCIF, SCIF1, SCIF2, SCIF3, SCIF4,
175 SIOF0, SIOF1, SIO,
176 FLCTL_FLSTEI, FLCTL_FLENDI, FLCTL_FLTREQ0I, FLCTL_FLTREQ1I,
177 I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI,
178 I2C1_ALI, I2C1_TACKI, I2C1_WAITI, I2C1_DTEI,
179 SIM_TEI, SIM_TXI, SIM_RXI, SIM_ERI,
180 IRDA,
181 SDHI0, SDHI1, SDHI2, SDHI3,
182 CMT, TSIF, SIU,
183 TMU0, TMU1, TMU2,
184 JPU, LCDC,
185
186 /* interrupt groups */
187
188 DMAC0123, VIOVOU, MMC, DMAC45, FLCTL, I2C0, I2C1, SIM, SDHI, USB,
189};
190
191static struct intc_vect vectors[] __initdata = {
192 INTC_VECT(IRQ0, 0x600), INTC_VECT(IRQ1, 0x620),
193 INTC_VECT(IRQ2, 0x640), INTC_VECT(IRQ3, 0x660),
194 INTC_VECT(IRQ4, 0x680), INTC_VECT(IRQ5, 0x6a0),
195 INTC_VECT(IRQ6, 0x6c0), INTC_VECT(IRQ7, 0x6e0),
196 INTC_VECT(I2C1_ALI, 0x780), INTC_VECT(I2C1_TACKI, 0x7a0),
197 INTC_VECT(I2C1_WAITI, 0x7c0), INTC_VECT(I2C1_DTEI, 0x7e0),
198 INTC_VECT(DMAC0, 0x800), INTC_VECT(DMAC1, 0x820),
199 INTC_VECT(DMAC2, 0x840), INTC_VECT(DMAC3, 0x860),
200 INTC_VECT(VIO_CEUI, 0x880), INTC_VECT(VIO_BEUI, 0x8a0),
201 INTC_VECT(VIO_VEUI, 0x8c0), INTC_VECT(VOU, 0x8e0),
202 INTC_VECT(MFI, 0x900), INTC_VECT(VPU, 0x980),
203 INTC_VECT(TPU, 0x9a0), INTC_VECT(Z3D4, 0x9e0),
204 INTC_VECT(USBI0, 0xa20), INTC_VECT(USBI1, 0xa40),
205 INTC_VECT(MMC_ERR, 0xb00), INTC_VECT(MMC_TRAN, 0xb20),
206 INTC_VECT(MMC_FSTAT, 0xb40), INTC_VECT(MMC_FRDY, 0xb60),
207 INTC_VECT(DMAC4, 0xb80), INTC_VECT(DMAC5, 0xba0),
208 INTC_VECT(DMAC_DADERR, 0xbc0), INTC_VECT(KEYSC, 0xbe0),
209 INTC_VECT(SCIF, 0xc00), INTC_VECT(SCIF1, 0xc20),
210 INTC_VECT(SCIF2, 0xc40), INTC_VECT(SCIF3, 0xc60),
211 INTC_VECT(SIOF0, 0xc80), INTC_VECT(SIOF1, 0xca0),
212 INTC_VECT(SIO, 0xd00),
213 INTC_VECT(FLCTL_FLSTEI, 0xd80), INTC_VECT(FLCTL_FLENDI, 0xda0),
214 INTC_VECT(FLCTL_FLTREQ0I, 0xdc0), INTC_VECT(FLCTL_FLTREQ1I, 0xde0),
215 INTC_VECT(I2C0_ALI, 0xe00), INTC_VECT(I2C0_TACKI, 0xe20),
216 INTC_VECT(I2C0_WAITI, 0xe40), INTC_VECT(I2C0_DTEI, 0xe60),
217 INTC_VECT(SDHI0, 0xe80), INTC_VECT(SDHI1, 0xea0),
218 INTC_VECT(SDHI2, 0xec0), INTC_VECT(SDHI3, 0xee0),
219 INTC_VECT(CMT, 0xf00), INTC_VECT(TSIF, 0xf20),
220 INTC_VECT(SIU, 0xf80),
221 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
222 INTC_VECT(TMU2, 0x440),
223 INTC_VECT(JPU, 0x560), INTC_VECT(LCDC, 0x580),
224};
225
226static struct intc_group groups[] __initdata = {
227 INTC_GROUP(DMAC0123, DMAC0, DMAC1, DMAC2, DMAC3),
228 INTC_GROUP(VIOVOU, VIO_CEUI, VIO_BEUI, VIO_VEUI, VOU),
229 INTC_GROUP(MMC, MMC_FRDY, MMC_FSTAT, MMC_TRAN, MMC_ERR),
230 INTC_GROUP(DMAC45, DMAC4, DMAC5, DMAC_DADERR),
231 INTC_GROUP(FLCTL, FLCTL_FLSTEI, FLCTL_FLENDI,
232 FLCTL_FLTREQ0I, FLCTL_FLTREQ1I),
233 INTC_GROUP(I2C0, I2C0_ALI, I2C0_TACKI, I2C0_WAITI, I2C0_DTEI),
234 INTC_GROUP(I2C1, I2C1_ALI, I2C1_TACKI, I2C1_WAITI, I2C1_DTEI),
235 INTC_GROUP(SIM, SIM_TEI, SIM_TXI, SIM_RXI, SIM_ERI),
236 INTC_GROUP(SDHI, SDHI0, SDHI1, SDHI2, SDHI3),
237 INTC_GROUP(USB, USBI0, USBI1),
238};
239
240static struct intc_mask_reg mask_registers[] __initdata = {
241 { 0xa4080084, 0xa40800c4, 8, /* IMR1 / IMCR1 */
242 { VOU, VIO_VEUI, VIO_BEUI, VIO_CEUI, DMAC3, DMAC2, DMAC1, DMAC0 } },
243 { 0xa4080088, 0xa40800c8, 8, /* IMR2 / IMCR2 */
244 { 0, 0, 0, VPU, 0, 0, 0, MFI } },
245 { 0xa408008c, 0xa40800cc, 8, /* IMR3 / IMCR3 */
246 { SIM_TEI, SIM_TXI, SIM_RXI, SIM_ERI, 0, 0, 0, IRDA } },
247 { 0xa4080090, 0xa40800d0, 8, /* IMR4 / IMCR4 */
248 { 0, TMU2, TMU1, TMU0, JPU, 0, 0, LCDC } },
249 { 0xa4080094, 0xa40800d4, 8, /* IMR5 / IMCR5 */
250 { KEYSC, DMAC_DADERR, DMAC5, DMAC4, SCIF3, SCIF2, SCIF1, SCIF } },
251 { 0xa4080098, 0xa40800d8, 8, /* IMR6 / IMCR6 */
252 { 0, 0, 0, SIO, Z3D4, 0, SIOF1, SIOF0 } },
253 { 0xa408009c, 0xa40800dc, 8, /* IMR7 / IMCR7 */
254 { I2C0_DTEI, I2C0_WAITI, I2C0_TACKI, I2C0_ALI,
255 FLCTL_FLTREQ1I, FLCTL_FLTREQ0I, FLCTL_FLENDI, FLCTL_FLSTEI } },
256 { 0xa40800a0, 0xa40800e0, 8, /* IMR8 / IMCR8 */
257 { SDHI3, SDHI2, SDHI1, SDHI0, 0, 0, 0, SIU } },
258 { 0xa40800a4, 0xa40800e4, 8, /* IMR9 / IMCR9 */
259 { 0, 0, 0, CMT, 0, USBI1, USBI0 } },
260 { 0xa40800a8, 0xa40800e8, 8, /* IMR10 / IMCR10 */
261 { MMC_FRDY, MMC_FSTAT, MMC_TRAN, MMC_ERR } },
262 { 0xa40800ac, 0xa40800ec, 8, /* IMR11 / IMCR11 */
263 { I2C1_DTEI, I2C1_WAITI, I2C1_TACKI, I2C1_ALI, TPU, 0, 0, TSIF } },
264 { 0xa4140044, 0xa4140064, 8, /* INTMSK00 / INTMSKCLR00 */
265 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
266};
267
268static struct intc_prio_reg prio_registers[] __initdata = {
269 { 0xa4080000, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2 } },
270 { 0xa4080004, 0, 16, 4, /* IPRB */ { JPU, LCDC, SIM } },
271 { 0xa4080010, 0, 16, 4, /* IPRE */ { DMAC0123, VIOVOU, MFI, VPU } },
272 { 0xa4080014, 0, 16, 4, /* IPRF */ { KEYSC, DMAC45, USB, CMT } },
273 { 0xa4080018, 0, 16, 4, /* IPRG */ { SCIF, SCIF1, SCIF2, SCIF3 } },
274 { 0xa408001c, 0, 16, 4, /* IPRH */ { SIOF0, SIOF1, FLCTL, I2C0 } },
275 { 0xa4080020, 0, 16, 4, /* IPRI */ { SIO, 0, TSIF, I2C1 } },
276 { 0xa4080024, 0, 16, 4, /* IPRJ */ { Z3D4, 0, SIU } },
277 { 0xa4080028, 0, 16, 4, /* IPRK */ { 0, MMC, 0, SDHI } },
278 { 0xa408002c, 0, 16, 4, /* IPRL */ { 0, 0, TPU } },
279 { 0xa4140010, 0, 32, 4, /* INTPRI00 */
280 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
281};
282
283static struct intc_sense_reg sense_registers[] __initdata = {
284 { 0xa414001c, 16, 2, /* ICR1 */
285 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
286};
287
288static struct intc_mask_reg ack_registers[] __initdata = {
289 { 0xa4140024, 0, 8, /* INTREQ00 */
290 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
291};
292
293static DECLARE_INTC_DESC_ACK(intc_desc, "sh7343", vectors, groups,
294 mask_registers, prio_registers, sense_registers,
295 ack_registers);
296
45void __init plat_irq_setup(void) 297void __init plat_irq_setup(void)
46{ 298{
299 register_intc_controller(&intc_desc);
47} 300}
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
index f26b5cdad0d1..6851dba02f31 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
@@ -13,6 +13,112 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/serial.h> 14#include <linux/serial.h>
15#include <linux/serial_sci.h> 15#include <linux/serial_sci.h>
16#include <linux/uio_driver.h>
17#include <asm/clock.h>
18
19static struct resource iic_resources[] = {
20 [0] = {
21 .name = "IIC",
22 .start = 0x04470000,
23 .end = 0x04470017,
24 .flags = IORESOURCE_MEM,
25 },
26 [1] = {
27 .start = 96,
28 .end = 99,
29 .flags = IORESOURCE_IRQ,
30 },
31};
32
33static struct platform_device iic_device = {
34 .name = "i2c-sh_mobile",
35 .num_resources = ARRAY_SIZE(iic_resources),
36 .resource = iic_resources,
37};
38
39static struct uio_info vpu_platform_data = {
40 .name = "VPU5",
41 .version = "0",
42 .irq = 60,
43};
44
45static struct resource vpu_resources[] = {
46 [0] = {
47 .name = "VPU",
48 .start = 0xfe900000,
49 .end = 0xfe902807,
50 .flags = IORESOURCE_MEM,
51 },
52 [1] = {
53 /* place holder for contiguous memory */
54 },
55};
56
57static struct platform_device vpu_device = {
58 .name = "uio_pdrv_genirq",
59 .id = 0,
60 .dev = {
61 .platform_data = &vpu_platform_data,
62 },
63 .resource = vpu_resources,
64 .num_resources = ARRAY_SIZE(vpu_resources),
65};
66
67static struct uio_info veu0_platform_data = {
68 .name = "VEU",
69 .version = "0",
70 .irq = 54,
71};
72
73static struct resource veu0_resources[] = {
74 [0] = {
75 .name = "VEU(1)",
76 .start = 0xfe920000,
77 .end = 0xfe9200b7,
78 .flags = IORESOURCE_MEM,
79 },
80 [1] = {
81 /* place holder for contiguous memory */
82 },
83};
84
85static struct platform_device veu0_device = {
86 .name = "uio_pdrv_genirq",
87 .id = 1,
88 .dev = {
89 .platform_data = &veu0_platform_data,
90 },
91 .resource = veu0_resources,
92 .num_resources = ARRAY_SIZE(veu0_resources),
93};
94
95static struct uio_info veu1_platform_data = {
96 .name = "VEU",
97 .version = "0",
98 .irq = 27,
99};
100
101static struct resource veu1_resources[] = {
102 [0] = {
103 .name = "VEU(2)",
104 .start = 0xfe924000,
105 .end = 0xfe9240b7,
106 .flags = IORESOURCE_MEM,
107 },
108 [1] = {
109 /* place holder for contiguous memory */
110 },
111};
112
113static struct platform_device veu1_device = {
114 .name = "uio_pdrv_genirq",
115 .id = 2,
116 .dev = {
117 .platform_data = &veu1_platform_data,
118 },
119 .resource = veu1_resources,
120 .num_resources = ARRAY_SIZE(veu1_resources),
121};
16 122
17static struct plat_sci_port sci_platform_data[] = { 123static struct plat_sci_port sci_platform_data[] = {
18 { 124 {
@@ -34,11 +140,32 @@ static struct platform_device sci_device = {
34}; 140};
35 141
36static struct platform_device *sh7366_devices[] __initdata = { 142static struct platform_device *sh7366_devices[] __initdata = {
143 &iic_device,
37 &sci_device, 144 &sci_device,
145 &vpu_device,
146 &veu0_device,
147 &veu1_device,
38}; 148};
39 149
40static int __init sh7366_devices_setup(void) 150static int __init sh7366_devices_setup(void)
41{ 151{
152 clk_always_enable("mstp031"); /* TLB */
153 clk_always_enable("mstp030"); /* IC */
154 clk_always_enable("mstp029"); /* OC */
155 clk_always_enable("mstp028"); /* RSMEM */
156 clk_always_enable("mstp026"); /* XYMEM */
157 clk_always_enable("mstp023"); /* INTC3 */
158 clk_always_enable("mstp022"); /* INTC */
159 clk_always_enable("mstp020"); /* SuperHyway */
160 clk_always_enable("mstp109"); /* I2C */
161 clk_always_enable("mstp207"); /* VEU-2 */
162 clk_always_enable("mstp202"); /* VEU-1 */
163 clk_always_enable("mstp201"); /* VPU */
164
165 platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20);
166 platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20);
167 platform_resource_setup_memory(&veu1_device, "veu1", 2 << 20);
168
42 return platform_add_devices(sh7366_devices, 169 return platform_add_devices(sh7366_devices,
43 ARRAY_SIZE(sh7366_devices)); 170 ARRAY_SIZE(sh7366_devices));
44} 171}
@@ -97,7 +224,7 @@ static struct intc_vect vectors[] __initdata = {
97 INTC_VECT(SIU, 0xf80), 224 INTC_VECT(SIU, 0xf80),
98 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420), 225 INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),
99 INTC_VECT(TMU2, 0x440), 226 INTC_VECT(TMU2, 0x440),
100 INTC_VECT(VEU2, 0x580), INTC_VECT(LCDC, 0x580), 227 INTC_VECT(VEU2, 0x560), INTC_VECT(LCDC, 0x580),
101}; 228};
102 229
103static struct intc_group groups[] __initdata = { 230static struct intc_group groups[] __initdata = {
@@ -163,8 +290,14 @@ static struct intc_sense_reg sense_registers[] __initdata = {
163 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } }, 290 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
164}; 291};
165 292
166static DECLARE_INTC_DESC(intc_desc, "sh7366", vectors, groups, 293static struct intc_mask_reg ack_registers[] __initdata = {
167 mask_registers, prio_registers, sense_registers); 294 { 0xa4140024, 0, 8, /* INTREQ00 */
295 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
296};
297
298static DECLARE_INTC_DESC_ACK(intc_desc, "sh7366", vectors, groups,
299 mask_registers, prio_registers, sense_registers,
300 ack_registers);
168 301
169void __init plat_irq_setup(void) 302void __init plat_irq_setup(void)
170{ 303{
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index 62ebccf18b3c..de1ede92176e 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -12,6 +12,8 @@
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/serial_sci.h> 13#include <linux/serial_sci.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/uio_driver.h>
16#include <asm/clock.h>
15#include <asm/mmzone.h> 17#include <asm/mmzone.h>
16 18
17static struct resource usbf_resources[] = { 19static struct resource usbf_resources[] = {
@@ -59,6 +61,62 @@ static struct platform_device iic_device = {
59 .resource = iic_resources, 61 .resource = iic_resources,
60}; 62};
61 63
64static struct uio_info vpu_platform_data = {
65 .name = "VPU4",
66 .version = "0",
67 .irq = 60,
68};
69
70static struct resource vpu_resources[] = {
71 [0] = {
72 .name = "VPU",
73 .start = 0xfe900000,
74 .end = 0xfe9022eb,
75 .flags = IORESOURCE_MEM,
76 },
77 [1] = {
78 /* place holder for contiguous memory */
79 },
80};
81
82static struct platform_device vpu_device = {
83 .name = "uio_pdrv_genirq",
84 .id = 0,
85 .dev = {
86 .platform_data = &vpu_platform_data,
87 },
88 .resource = vpu_resources,
89 .num_resources = ARRAY_SIZE(vpu_resources),
90};
91
92static struct uio_info veu_platform_data = {
93 .name = "VEU",
94 .version = "0",
95 .irq = 54,
96};
97
98static struct resource veu_resources[] = {
99 [0] = {
100 .name = "VEU",
101 .start = 0xfe920000,
102 .end = 0xfe9200b7,
103 .flags = IORESOURCE_MEM,
104 },
105 [1] = {
106 /* place holder for contiguous memory */
107 },
108};
109
110static struct platform_device veu_device = {
111 .name = "uio_pdrv_genirq",
112 .id = 1,
113 .dev = {
114 .platform_data = &veu_platform_data,
115 },
116 .resource = veu_resources,
117 .num_resources = ARRAY_SIZE(veu_resources),
118};
119
62static struct plat_sci_port sci_platform_data[] = { 120static struct plat_sci_port sci_platform_data[] = {
63 { 121 {
64 .mapbase = 0xffe00000, 122 .mapbase = 0xffe00000,
@@ -95,10 +153,27 @@ static struct platform_device *sh7722_devices[] __initdata = {
95 &usbf_device, 153 &usbf_device,
96 &iic_device, 154 &iic_device,
97 &sci_device, 155 &sci_device,
156 &vpu_device,
157 &veu_device,
98}; 158};
99 159
100static int __init sh7722_devices_setup(void) 160static int __init sh7722_devices_setup(void)
101{ 161{
162 clk_always_enable("mstp031"); /* TLB */
163 clk_always_enable("mstp030"); /* IC */
164 clk_always_enable("mstp029"); /* OC */
165 clk_always_enable("mstp028"); /* URAM */
166 clk_always_enable("mstp026"); /* XYMEM */
167 clk_always_enable("mstp022"); /* INTC */
168 clk_always_enable("mstp020"); /* SuperHyway */
169 clk_always_enable("mstp109"); /* I2C */
170 clk_always_enable("mstp211"); /* USB */
171 clk_always_enable("mstp202"); /* VEU */
172 clk_always_enable("mstp201"); /* VPU */
173
174 platform_resource_setup_memory(&vpu_device, "vpu", 1 << 20);
175 platform_resource_setup_memory(&veu_device, "veu", 2 << 20);
176
102 return platform_add_devices(sh7722_devices, 177 return platform_add_devices(sh7722_devices,
103 ARRAY_SIZE(sh7722_devices)); 178 ARRAY_SIZE(sh7722_devices));
104} 179}
@@ -229,8 +304,14 @@ static struct intc_sense_reg sense_registers[] __initdata = {
229 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } }, 304 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
230}; 305};
231 306
232static DECLARE_INTC_DESC(intc_desc, "sh7722", vectors, groups, 307static struct intc_mask_reg ack_registers[] __initdata = {
233 mask_registers, prio_registers, sense_registers); 308 { 0xa4140024, 0, 8, /* INTREQ00 */
309 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
310};
311
312static DECLARE_INTC_DESC_ACK(intc_desc, "sh7722", vectors, groups,
313 mask_registers, prio_registers, sense_registers,
314 ack_registers);
234 315
235void __init plat_irq_setup(void) 316void __init plat_irq_setup(void)
236{ 317{
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
index a0470f2f5479..cd6baffdc896 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
@@ -12,8 +12,94 @@
12#include <linux/serial.h> 12#include <linux/serial.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/serial_sci.h> 14#include <linux/serial_sci.h>
15#include <linux/uio_driver.h>
16#include <asm/clock.h>
15#include <asm/mmzone.h> 17#include <asm/mmzone.h>
16 18
19static struct uio_info vpu_platform_data = {
20 .name = "VPU5",
21 .version = "0",
22 .irq = 60,
23};
24
25static struct resource vpu_resources[] = {
26 [0] = {
27 .name = "VPU",
28 .start = 0xfe900000,
29 .end = 0xfe902807,
30 .flags = IORESOURCE_MEM,
31 },
32 [1] = {
33 /* place holder for contiguous memory */
34 },
35};
36
37static struct platform_device vpu_device = {
38 .name = "uio_pdrv_genirq",
39 .id = 0,
40 .dev = {
41 .platform_data = &vpu_platform_data,
42 },
43 .resource = vpu_resources,
44 .num_resources = ARRAY_SIZE(vpu_resources),
45};
46
47static struct uio_info veu0_platform_data = {
48 .name = "VEU",
49 .version = "0",
50 .irq = 54,
51};
52
53static struct resource veu0_resources[] = {
54 [0] = {
55 .name = "VEU2H0",
56 .start = 0xfe920000,
57 .end = 0xfe92027b,
58 .flags = IORESOURCE_MEM,
59 },
60 [1] = {
61 /* place holder for contiguous memory */
62 },
63};
64
65static struct platform_device veu0_device = {
66 .name = "uio_pdrv_genirq",
67 .id = 1,
68 .dev = {
69 .platform_data = &veu0_platform_data,
70 },
71 .resource = veu0_resources,
72 .num_resources = ARRAY_SIZE(veu0_resources),
73};
74
75static struct uio_info veu1_platform_data = {
76 .name = "VEU",
77 .version = "0",
78 .irq = 27,
79};
80
81static struct resource veu1_resources[] = {
82 [0] = {
83 .name = "VEU2H1",
84 .start = 0xfe924000,
85 .end = 0xfe92427b,
86 .flags = IORESOURCE_MEM,
87 },
88 [1] = {
89 /* place holder for contiguous memory */
90 },
91};
92
93static struct platform_device veu1_device = {
94 .name = "uio_pdrv_genirq",
95 .id = 2,
96 .dev = {
97 .platform_data = &veu1_platform_data,
98 },
99 .resource = veu1_resources,
100 .num_resources = ARRAY_SIZE(veu1_resources),
101};
102
17static struct plat_sci_port sci_platform_data[] = { 103static struct plat_sci_port sci_platform_data[] = {
18 { 104 {
19 .mapbase = 0xffe00000, 105 .mapbase = 0xffe00000,
@@ -113,14 +199,56 @@ static struct platform_device sh7723_usb_host_device = {
113 .resource = sh7723_usb_host_resources, 199 .resource = sh7723_usb_host_resources,
114}; 200};
115 201
202static struct resource iic_resources[] = {
203 [0] = {
204 .name = "IIC",
205 .start = 0x04470000,
206 .end = 0x04470017,
207 .flags = IORESOURCE_MEM,
208 },
209 [1] = {
210 .start = 96,
211 .end = 99,
212 .flags = IORESOURCE_IRQ,
213 },
214};
215
216static struct platform_device iic_device = {
217 .name = "i2c-sh_mobile",
218 .num_resources = ARRAY_SIZE(iic_resources),
219 .resource = iic_resources,
220};
221
116static struct platform_device *sh7723_devices[] __initdata = { 222static struct platform_device *sh7723_devices[] __initdata = {
117 &sci_device, 223 &sci_device,
118 &rtc_device, 224 &rtc_device,
225 &iic_device,
119 &sh7723_usb_host_device, 226 &sh7723_usb_host_device,
227 &vpu_device,
228 &veu0_device,
229 &veu1_device,
120}; 230};
121 231
122static int __init sh7723_devices_setup(void) 232static int __init sh7723_devices_setup(void)
123{ 233{
234 clk_always_enable("mstp031"); /* TLB */
235 clk_always_enable("mstp030"); /* IC */
236 clk_always_enable("mstp029"); /* OC */
237 clk_always_enable("mstp024"); /* FPU */
238 clk_always_enable("mstp022"); /* INTC */
239 clk_always_enable("mstp020"); /* SuperHyway */
240 clk_always_enable("mstp000"); /* MERAM */
241 clk_always_enable("mstp109"); /* I2C */
242 clk_always_enable("mstp108"); /* RTC */
243 clk_always_enable("mstp211"); /* USB */
244 clk_always_enable("mstp206"); /* VEU2H1 */
245 clk_always_enable("mstp202"); /* VEU2H0 */
246 clk_always_enable("mstp201"); /* VPU */
247
248 platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20);
249 platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20);
250 platform_resource_setup_memory(&veu1_device, "veu1", 2 << 20);
251
124 return platform_add_devices(sh7723_devices, 252 return platform_add_devices(sh7723_devices,
125 ARRAY_SIZE(sh7723_devices)); 253 ARRAY_SIZE(sh7723_devices));
126} 254}
@@ -326,8 +454,14 @@ static struct intc_sense_reg sense_registers[] __initdata = {
326 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } }, 454 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
327}; 455};
328 456
329static DECLARE_INTC_DESC(intc_desc, "sh7723", vectors, groups, 457static struct intc_mask_reg ack_registers[] __initdata = {
330 mask_registers, prio_registers, sense_registers); 458 { 0xa4140024, 0, 8, /* INTREQ00 */
459 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
460};
461
462static DECLARE_INTC_DESC_ACK(intc_desc, "sh7723", vectors, groups,
463 mask_registers, prio_registers, sense_registers,
464 ack_registers);
331 465
332void __init plat_irq_setup(void) 466void __init plat_irq_setup(void)
333{ 467{
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
index f189a559462b..3c5b629887a8 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2006 Paul Mundt 4 * Copyright (C) 2006 Paul Mundt
5 * Copyright (C) 2007 Yoshihiro Shimoda 5 * Copyright (C) 2007 Yoshihiro Shimoda
6 * Copyright (C) 2008 Nobuhiro Iwamatsu
6 * 7 *
7 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -56,6 +57,11 @@ static struct plat_sci_port sci_platform_data[] = {
56 .type = PORT_SCIF, 57 .type = PORT_SCIF,
57 .irqs = { 76, 77, 79, 78 }, 58 .irqs = { 76, 77, 79, 78 },
58 }, { 59 }, {
60 .mapbase = 0xffe10000,
61 .flags = UPF_BOOT_AUTOCONF,
62 .type = PORT_SCIF,
63 .irqs = { 104, 105, 107, 106 },
64 }, {
59 .flags = 0, 65 .flags = 0,
60 } 66 }
61}; 67};
@@ -208,8 +214,8 @@ static struct intc_vect vectors[] __initdata = {
208 INTC_VECT(TMU5, 0xe40), INTC_VECT(ADC, 0xe60), 214 INTC_VECT(TMU5, 0xe40), INTC_VECT(ADC, 0xe60),
209 INTC_VECT(SSI0, 0xe80), INTC_VECT(SSI1, 0xea0), 215 INTC_VECT(SSI0, 0xe80), INTC_VECT(SSI1, 0xea0),
210 INTC_VECT(SSI2, 0xec0), INTC_VECT(SSI3, 0xee0), 216 INTC_VECT(SSI2, 0xec0), INTC_VECT(SSI3, 0xee0),
211 INTC_VECT(SCIF1_ERI, 0xf00), INTC_VECT(SCIF1_RXI, 0xf20), 217 INTC_VECT(SCIF2_ERI, 0xf00), INTC_VECT(SCIF2_RXI, 0xf20),
212 INTC_VECT(SCIF1_BRI, 0xf40), INTC_VECT(SCIF1_TXI, 0xf60), 218 INTC_VECT(SCIF2_BRI, 0xf40), INTC_VECT(SCIF2_TXI, 0xf60),
213 INTC_VECT(GPIO_CH0, 0xf80), INTC_VECT(GPIO_CH1, 0xfa0), 219 INTC_VECT(GPIO_CH0, 0xf80), INTC_VECT(GPIO_CH1, 0xfa0),
214 INTC_VECT(GPIO_CH2, 0xfc0), INTC_VECT(GPIO_CH3, 0xfe0), 220 INTC_VECT(GPIO_CH2, 0xfc0), INTC_VECT(GPIO_CH3, 0xfe0),
215}; 221};
@@ -290,9 +296,14 @@ static struct intc_sense_reg irq_sense_registers[] __initdata = {
290 IRQ4, IRQ5, IRQ6, IRQ7 } }, 296 IRQ4, IRQ5, IRQ6, IRQ7 } },
291}; 297};
292 298
293static DECLARE_INTC_DESC(intc_irq_desc, "sh7763-irq", irq_vectors, 299static struct intc_mask_reg irq_ack_registers[] __initdata = {
294 NULL, irq_mask_registers, irq_prio_registers, 300 { 0xffd00024, 0, 32, /* INTREQ */
295 irq_sense_registers); 301 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
302};
303
304static DECLARE_INTC_DESC_ACK(intc_irq_desc, "sh7763-irq", irq_vectors,
305 NULL, irq_mask_registers, irq_prio_registers,
306 irq_sense_registers, irq_ack_registers);
296 307
297 308
298/* External interrupt pins in IRL mode */ 309/* External interrupt pins in IRL mode */
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
index 18dbbe23fea1..fb8200cc7440 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
@@ -217,9 +217,14 @@ static struct intc_sense_reg irq_sense_registers[] __initdata = {
217 IRQ4, IRQ5, IRQ6, IRQ7 } }, 217 IRQ4, IRQ5, IRQ6, IRQ7 } },
218}; 218};
219 219
220static DECLARE_INTC_DESC(intc_irq_desc, "sh7780-irq", irq_vectors, 220static struct intc_mask_reg irq_ack_registers[] __initdata = {
221 NULL, irq_mask_registers, irq_prio_registers, 221 { 0xffd00024, 0, 32, /* INTREQ */
222 irq_sense_registers); 222 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
223};
224
225static DECLARE_INTC_DESC_ACK(intc_irq_desc, "sh7780-irq", irq_vectors,
226 NULL, irq_mask_registers, irq_prio_registers,
227 irq_sense_registers, irq_ack_registers);
223 228
224/* External interrupt pins in IRL mode */ 229/* External interrupt pins in IRL mode */
225 230
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
index 621e7329ec63..30baa63b24c8 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
@@ -238,13 +238,18 @@ static struct intc_sense_reg sense_registers[] __initdata = {
238 IRQ4, IRQ5, IRQ6, IRQ7 } }, 238 IRQ4, IRQ5, IRQ6, IRQ7 } },
239}; 239};
240 240
241static DECLARE_INTC_DESC(intc_desc_irq0123, "sh7785-irq0123", vectors_irq0123, 241static struct intc_mask_reg ack_registers[] __initdata = {
242 NULL, mask_registers, prio_registers, 242 { 0xffd00024, 0, 32, /* INTREQ */
243 sense_registers); 243 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
244};
245
246static DECLARE_INTC_DESC_ACK(intc_desc_irq0123, "sh7785-irq0123",
247 vectors_irq0123, NULL, mask_registers,
248 prio_registers, sense_registers, ack_registers);
244 249
245static DECLARE_INTC_DESC(intc_desc_irq4567, "sh7785-irq4567", vectors_irq4567, 250static DECLARE_INTC_DESC_ACK(intc_desc_irq4567, "sh7785-irq4567",
246 NULL, mask_registers, prio_registers, 251 vectors_irq4567, NULL, mask_registers,
247 sense_registers); 252 prio_registers, sense_registers, ack_registers);
248 253
249/* External interrupt pins in IRL mode */ 254/* External interrupt pins in IRL mode */
250 255
diff --git a/arch/sh/kernel/cpu/sh5/entry.S b/arch/sh/kernel/cpu/sh5/entry.S
index 05372ed6c568..ca08e7f26a3a 100644
--- a/arch/sh/kernel/cpu/sh5/entry.S
+++ b/arch/sh/kernel/cpu/sh5/entry.S
@@ -11,7 +11,7 @@
11 */ 11 */
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/sys.h> 13#include <linux/sys.h>
14#include <asm/cpu/registers.h> 14#include <cpu/registers.h>
15#include <asm/processor.h> 15#include <asm/processor.h>
16#include <asm/unistd.h> 16#include <asm/unistd.h>
17#include <asm/thread_info.h> 17#include <asm/thread_info.h>
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index 718bd2356b34..5e0dd1933847 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -192,7 +192,7 @@ work_resched:
192 .align 2 192 .align 2
1931: .long schedule 1931: .long schedule
1942: .long do_notify_resume 1942: .long do_notify_resume
1953: .long restore_all 1953: .long resume_userspace
196#ifdef CONFIG_TRACE_IRQFLAGS 196#ifdef CONFIG_TRACE_IRQFLAGS
1974: .long trace_hardirqs_on 1974: .long trace_hardirqs_on
1985: .long trace_hardirqs_off 1985: .long trace_hardirqs_off
diff --git a/arch/sh/kernel/head_64.S b/arch/sh/kernel/head_64.S
index f42d4c0feb76..7ccfb995a398 100644
--- a/arch/sh/kernel/head_64.S
+++ b/arch/sh/kernel/head_64.S
@@ -11,8 +11,8 @@
11#include <asm/page.h> 11#include <asm/page.h>
12#include <asm/cache.h> 12#include <asm/cache.h>
13#include <asm/tlb.h> 13#include <asm/tlb.h>
14#include <asm/cpu/registers.h> 14#include <cpu/registers.h>
15#include <asm/cpu/mmu_context.h> 15#include <cpu/mmu_context.h>
16#include <asm/thread_info.h> 16#include <asm/thread_info.h>
17 17
18/* 18/*
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index a2a99e487e33..64b7690c664c 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -15,7 +15,7 @@
15#include <asm/machvec.h> 15#include <asm/machvec.h>
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <asm/thread_info.h> 17#include <asm/thread_info.h>
18#include <asm/cpu/mmu_context.h> 18#include <cpu/mmu_context.h>
19 19
20atomic_t irq_err_count; 20atomic_t irq_err_count;
21 21
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index 921892c351da..3326a45749d9 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -34,18 +34,6 @@ void (*pm_idle)(void);
34void (*pm_power_off)(void); 34void (*pm_power_off)(void);
35EXPORT_SYMBOL(pm_power_off); 35EXPORT_SYMBOL(pm_power_off);
36 36
37void disable_hlt(void)
38{
39 hlt_counter++;
40}
41EXPORT_SYMBOL(disable_hlt);
42
43void enable_hlt(void)
44{
45 hlt_counter--;
46}
47EXPORT_SYMBOL(enable_hlt);
48
49static int __init nohlt_setup(char *__unused) 37static int __init nohlt_setup(char *__unused)
50{ 38{
51 hlt_counter = 1; 39 hlt_counter = 1;
@@ -60,7 +48,7 @@ static int __init hlt_setup(char *__unused)
60} 48}
61__setup("hlt", hlt_setup); 49__setup("hlt", hlt_setup);
62 50
63void default_idle(void) 51static void default_idle(void)
64{ 52{
65 if (!hlt_counter) { 53 if (!hlt_counter) {
66 clear_thread_flag(TIF_POLLING_NRFLAG); 54 clear_thread_flag(TIF_POLLING_NRFLAG);
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index 0283d8133075..b9dbd2d3b4a5 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -36,16 +36,6 @@ static int hlt_counter = 1;
36 36
37#define HARD_IDLE_TIMEOUT (HZ / 3) 37#define HARD_IDLE_TIMEOUT (HZ / 3)
38 38
39void disable_hlt(void)
40{
41 hlt_counter++;
42}
43
44void enable_hlt(void)
45{
46 hlt_counter--;
47}
48
49static int __init nohlt_setup(char *__unused) 39static int __init nohlt_setup(char *__unused)
50{ 40{
51 hlt_counter = 1; 41 hlt_counter = 1;
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index fddb547f3c2b..2bc72def5cf8 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -241,6 +241,29 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
241 break; 241 break;
242 } 242 }
243#endif 243#endif
244#ifdef CONFIG_BINFMT_ELF_FDPIC
245 case PTRACE_GETFDPIC: {
246 unsigned long tmp = 0;
247
248 switch (addr) {
249 case PTRACE_GETFDPIC_EXEC:
250 tmp = child->mm->context.exec_fdpic_loadmap;
251 break;
252 case PTRACE_GETFDPIC_INTERP:
253 tmp = child->mm->context.interp_fdpic_loadmap;
254 break;
255 default:
256 break;
257 }
258
259 ret = 0;
260 if (put_user(tmp, (unsigned long *) data)) {
261 ret = -EFAULT;
262 break;
263 }
264 break;
265 }
266#endif
244 default: 267 default:
245 ret = ptrace_request(child, request, addr, data); 268 ret = ptrace_request(child, request, addr, data);
246 break; 269 break;
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index bca2bbc575db..6339d0c95715 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -398,6 +398,7 @@ const char *get_cpu_subtype(struct sh_cpuinfo *c)
398{ 398{
399 return cpu_name[c->type]; 399 return cpu_name[c->type];
400} 400}
401EXPORT_SYMBOL(get_cpu_subtype);
401 402
402#ifdef CONFIG_PROC_FS 403#ifdef CONFIG_PROC_FS
403/* Symbolic CPU flags, keep in sync with asm/cpu-features.h */ 404/* Symbolic CPU flags, keep in sync with asm/cpu-features.h */
@@ -452,6 +453,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
452 seq_printf(m, "processor\t: %d\n", cpu); 453 seq_printf(m, "processor\t: %d\n", cpu);
453 seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine); 454 seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine);
454 seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype(c)); 455 seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype(c));
456 if (c->cut_major == -1)
457 seq_printf(m, "cut\t\t: unknown\n");
458 else if (c->cut_minor == -1)
459 seq_printf(m, "cut\t\t: %d.x\n", c->cut_major);
460 else
461 seq_printf(m, "cut\t\t: %d.%d\n", c->cut_major, c->cut_minor);
455 462
456 show_cpuflags(m, c); 463 show_cpuflags(m, c);
457 464
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index f311551d9a05..4bbbde895a53 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -33,6 +33,11 @@
33 33
34#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 34#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
35 35
36struct fdpic_func_descriptor {
37 unsigned long text;
38 unsigned long GOT;
39};
40
36/* 41/*
37 * Atomically swap in the new signal mask, and wait for a signal. 42 * Atomically swap in the new signal mask, and wait for a signal.
38 */ 43 */
@@ -368,6 +373,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
368 err |= __put_user(OR_R0_R0, &frame->retcode[6]); 373 err |= __put_user(OR_R0_R0, &frame->retcode[6]);
369 err |= __put_user((__NR_sigreturn), &frame->retcode[7]); 374 err |= __put_user((__NR_sigreturn), &frame->retcode[7]);
370 regs->pr = (unsigned long) frame->retcode; 375 regs->pr = (unsigned long) frame->retcode;
376 flush_icache_range(regs->pr, regs->pr + sizeof(frame->retcode));
371 } 377 }
372 378
373 if (err) 379 if (err)
@@ -378,18 +384,21 @@ static int setup_frame(int sig, struct k_sigaction *ka,
378 regs->regs[4] = signal; /* Arg for signal handler */ 384 regs->regs[4] = signal; /* Arg for signal handler */
379 regs->regs[5] = 0; 385 regs->regs[5] = 0;
380 regs->regs[6] = (unsigned long) &frame->sc; 386 regs->regs[6] = (unsigned long) &frame->sc;
381 regs->pc = (unsigned long) ka->sa.sa_handler; 387
388 if (current->personality & FDPIC_FUNCPTRS) {
389 struct fdpic_func_descriptor __user *funcptr =
390 (struct fdpic_func_descriptor __user *)ka->sa.sa_handler;
391
392 __get_user(regs->pc, &funcptr->text);
393 __get_user(regs->regs[12], &funcptr->GOT);
394 } else
395 regs->pc = (unsigned long)ka->sa.sa_handler;
382 396
383 set_fs(USER_DS); 397 set_fs(USER_DS);
384 398
385 pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n", 399 pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
386 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr); 400 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);
387 401
388 flush_cache_sigtramp(regs->pr);
389
390 if ((-regs->pr & (L1_CACHE_BYTES-1)) < sizeof(frame->retcode))
391 flush_cache_sigtramp(regs->pr + L1_CACHE_BYTES);
392
393 return 0; 402 return 0;
394 403
395give_sigsegv: 404give_sigsegv:
@@ -458,17 +467,22 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
458 regs->regs[4] = signal; /* Arg for signal handler */ 467 regs->regs[4] = signal; /* Arg for signal handler */
459 regs->regs[5] = (unsigned long) &frame->info; 468 regs->regs[5] = (unsigned long) &frame->info;
460 regs->regs[6] = (unsigned long) &frame->uc; 469 regs->regs[6] = (unsigned long) &frame->uc;
461 regs->pc = (unsigned long) ka->sa.sa_handler; 470
471 if (current->personality & FDPIC_FUNCPTRS) {
472 struct fdpic_func_descriptor __user *funcptr =
473 (struct fdpic_func_descriptor __user *)ka->sa.sa_handler;
474
475 __get_user(regs->pc, &funcptr->text);
476 __get_user(regs->regs[12], &funcptr->GOT);
477 } else
478 regs->pc = (unsigned long)ka->sa.sa_handler;
462 479
463 set_fs(USER_DS); 480 set_fs(USER_DS);
464 481
465 pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n", 482 pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
466 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr); 483 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);
467 484
468 flush_cache_sigtramp(regs->pr); 485 flush_icache_range(regs->pr, regs->pr + sizeof(frame->retcode));
469
470 if ((-regs->pr & (L1_CACHE_BYTES-1)) < sizeof(frame->retcode))
471 flush_cache_sigtramp(regs->pr + L1_CACHE_BYTES);
472 486
473 return 0; 487 return 0;
474 488
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index a46cc3a41148..0af693e65764 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -343,3 +343,9 @@ ENTRY(sys_call_table)
343 .long sys_fallocate 343 .long sys_fallocate
344 .long sys_timerfd_settime /* 325 */ 344 .long sys_timerfd_settime /* 325 */
345 .long sys_timerfd_gettime 345 .long sys_timerfd_gettime
346 .long sys_signalfd4
347 .long sys_eventfd2
348 .long sys_epoll_create1
349 .long sys_dup3 /* 330 */
350 .long sys_pipe2
351 .long sys_inotify_init1
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index d5d7843aad94..0b436aa3cad7 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -381,3 +381,9 @@ sys_call_table:
381 .long sys_fallocate 381 .long sys_fallocate
382 .long sys_timerfd_settime 382 .long sys_timerfd_settime
383 .long sys_timerfd_gettime 383 .long sys_timerfd_gettime
384 .long sys_signalfd4 /* 355 */
385 .long sys_eventfd2
386 .long sys_epoll_create1
387 .long sys_dup3
388 .long sys_pipe2
389 .long sys_inotify_init1 /* 360 */
diff --git a/arch/sh/kernel/time_32.c b/arch/sh/kernel/time_32.c
index 7281342c044d..0758b5ee8180 100644
--- a/arch/sh/kernel/time_32.c
+++ b/arch/sh/kernel/time_32.c
@@ -211,7 +211,7 @@ unsigned long sh_hpt_frequency = 0;
211 211
212#define NSEC_PER_CYC_SHIFT 10 212#define NSEC_PER_CYC_SHIFT 10
213 213
214struct clocksource clocksource_sh = { 214static struct clocksource clocksource_sh = {
215 .name = "SuperH", 215 .name = "SuperH",
216 .rating = 200, 216 .rating = 200,
217 .mask = CLOCKSOURCE_MASK(32), 217 .mask = CLOCKSOURCE_MASK(32),
diff --git a/arch/sh/kernel/time_64.c b/arch/sh/kernel/time_64.c
index 022a55f1c1d4..791edabf7d83 100644
--- a/arch/sh/kernel/time_64.c
+++ b/arch/sh/kernel/time_64.c
@@ -33,8 +33,8 @@
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/io.h> 34#include <linux/io.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <asm/cpu/registers.h> /* required by inline __asm__ stmt. */ 36#include <cpu/registers.h> /* required by inline __asm__ stmt. */
37#include <asm/cpu/irq.h> 37#include <cpu/irq.h>
38#include <asm/addrspace.h> 38#include <asm/addrspace.h>
39#include <asm/processor.h> 39#include <asm/processor.h>
40#include <asm/uaccess.h> 40#include <asm/uaccess.h>
diff --git a/arch/sh/kernel/timers/timer-tmu.c b/arch/sh/kernel/timers/timer-tmu.c
index 8935570008d2..1ca9ad49b541 100644
--- a/arch/sh/kernel/timers/timer-tmu.c
+++ b/arch/sh/kernel/timers/timer-tmu.c
@@ -209,7 +209,7 @@ static int tmu_timer_init(void)
209 return 0; 209 return 0;
210} 210}
211 211
212struct sys_timer_ops tmu_timer_ops = { 212static struct sys_timer_ops tmu_timer_ops = {
213 .init = tmu_timer_init, 213 .init = tmu_timer_init,
214 .start = tmu_timer_start, 214 .start = tmu_timer_start,
215 .stop = tmu_timer_stop, 215 .stop = tmu_timer_stop,
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index e08b3bfeb656..511a9426cec5 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -43,6 +43,7 @@
43# define TRAP_ILLEGAL_SLOT_INST 6 43# define TRAP_ILLEGAL_SLOT_INST 6
44# define TRAP_ADDRESS_ERROR 9 44# define TRAP_ADDRESS_ERROR 9
45# ifdef CONFIG_CPU_SH2A 45# ifdef CONFIG_CPU_SH2A
46# define TRAP_FPU_ERROR 13
46# define TRAP_DIVZERO_ERROR 17 47# define TRAP_DIVZERO_ERROR 17
47# define TRAP_DIVOVF_ERROR 18 48# define TRAP_DIVOVF_ERROR 18
48# endif 49# endif
@@ -851,6 +852,9 @@ void __init trap_init(void)
851#ifdef CONFIG_CPU_SH2A 852#ifdef CONFIG_CPU_SH2A
852 set_exception_table_vec(TRAP_DIVZERO_ERROR, do_divide_error); 853 set_exception_table_vec(TRAP_DIVZERO_ERROR, do_divide_error);
853 set_exception_table_vec(TRAP_DIVOVF_ERROR, do_divide_error); 854 set_exception_table_vec(TRAP_DIVOVF_ERROR, do_divide_error);
855#ifdef CONFIG_SH_FPU
856 set_exception_table_vec(TRAP_FPU_ERROR, fpu_error_trap_handler);
857#endif
854#endif 858#endif
855 859
856 /* Setup VBR for boot cpu */ 860 /* Setup VBR for boot cpu */
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index ebb55d1149f5..8596cc78e18d 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -2,9 +2,11 @@
2# Makefile for SuperH-specific library files.. 2# Makefile for SuperH-specific library files..
3# 3#
4 4
5lib-y = delay.o io.o memset.o memmove.o memchr.o \ 5lib-y = delay.o memset.o memmove.o memchr.o \
6 checksum.o strlen.o div64.o div64-generic.o 6 checksum.o strlen.o div64.o div64-generic.o
7 7
8obj-y += io.o
9
8memcpy-y := memcpy.o 10memcpy-y := memcpy.o
9memcpy-$(CONFIG_CPU_SH4) := memcpy-sh4.o 11memcpy-$(CONFIG_CPU_SH4) := memcpy-sh4.o
10 12
diff --git a/arch/sh/lib64/panic.c b/arch/sh/lib64/panic.c
index ff559e2a96f7..da32ba7b5fcc 100644
--- a/arch/sh/lib64/panic.c
+++ b/arch/sh/lib64/panic.c
@@ -8,7 +8,7 @@
8 8
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <asm/io.h> 10#include <asm/io.h>
11#include <asm/cpu/registers.h> 11#include <cpu/registers.h>
12 12
13/* THIS IS A PHYSICAL ADDRESS */ 13/* THIS IS A PHYSICAL ADDRESS */
14#define HDSP2534_ADDR (0x04002100) 14#define HDSP2534_ADDR (0x04002100)
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 5fd218430b19..56d0a7daa34b 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -145,25 +145,39 @@ choice
145 145
146config PAGE_SIZE_4KB 146config PAGE_SIZE_4KB
147 bool "4kB" 147 bool "4kB"
148 depends on !X2TLB 148 depends on !MMU || !X2TLB
149 help 149 help
150 This is the default page size used by all SuperH CPUs. 150 This is the default page size used by all SuperH CPUs.
151 151
152config PAGE_SIZE_8KB 152config PAGE_SIZE_8KB
153 bool "8kB" 153 bool "8kB"
154 depends on X2TLB 154 depends on !MMU || X2TLB
155 help 155 help
156 This enables 8kB pages as supported by SH-X2 and later MMUs. 156 This enables 8kB pages as supported by SH-X2 and later MMUs.
157 157
158config PAGE_SIZE_16KB
159 bool "16kB"
160 depends on !MMU
161 help
162 This enables 16kB pages on MMU-less SH systems.
163
158config PAGE_SIZE_64KB 164config PAGE_SIZE_64KB
159 bool "64kB" 165 bool "64kB"
160 depends on CPU_SH4 || CPU_SH5 166 depends on !MMU || CPU_SH4 || CPU_SH5
161 help 167 help
162 This enables support for 64kB pages, possible on all SH-4 168 This enables support for 64kB pages, possible on all SH-4
163 CPUs and later. 169 CPUs and later.
164 170
165endchoice 171endchoice
166 172
173config ENTRY_OFFSET
174 hex
175 default "0x00001000" if PAGE_SIZE_4KB
176 default "0x00002000" if PAGE_SIZE_8KB
177 default "0x00004000" if PAGE_SIZE_16KB
178 default "0x00010000" if PAGE_SIZE_64KB
179 default "0x00000000"
180
167choice 181choice
168 prompt "HugeTLB page size" 182 prompt "HugeTLB page size"
169 depends on HUGETLB_PAGE && (CPU_SH4 || CPU_SH5) && MMU 183 depends on HUGETLB_PAGE && (CPU_SH4 || CPU_SH5) && MMU
diff --git a/arch/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c
index c5b56d52b7d2..0e189ccd4a77 100644
--- a/arch/sh/mm/cache-debugfs.c
+++ b/arch/sh/mm/cache-debugfs.c
@@ -120,7 +120,7 @@ static const struct file_operations cache_debugfs_fops = {
120 .open = cache_debugfs_open, 120 .open = cache_debugfs_open,
121 .read = seq_read, 121 .read = seq_read,
122 .llseek = seq_lseek, 122 .llseek = seq_lseek,
123 .release = seq_release, 123 .release = single_release,
124}; 124};
125 125
126static int __init cache_debugfs_init(void) 126static int __init cache_debugfs_init(void)
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index 43d7ff6b6ec7..1fdc8d90254a 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -4,6 +4,7 @@
4 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka 4 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka
5 * Copyright (C) 2001 - 2007 Paul Mundt 5 * Copyright (C) 2001 - 2007 Paul Mundt
6 * Copyright (C) 2003 Richard Curnow 6 * Copyright (C) 2003 Richard Curnow
7 * Copyright (c) 2007 STMicroelectronics (R&D) Ltd.
7 * 8 *
8 * This file is subject to the terms and conditions of the GNU General Public 9 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 10 * License. See the file "COPYING" in the main directory of this archive
@@ -22,6 +23,7 @@
22 * entirety. 23 * entirety.
23 */ 24 */
24#define MAX_DCACHE_PAGES 64 /* XXX: Tune for ways */ 25#define MAX_DCACHE_PAGES 64 /* XXX: Tune for ways */
26#define MAX_ICACHE_PAGES 32
25 27
26static void __flush_dcache_segment_1way(unsigned long start, 28static void __flush_dcache_segment_1way(unsigned long start,
27 unsigned long extent); 29 unsigned long extent);
@@ -178,42 +180,45 @@ void __flush_invalidate_region(void *start, int size)
178/* 180/*
179 * Write back the range of D-cache, and purge the I-cache. 181 * Write back the range of D-cache, and purge the I-cache.
180 * 182 *
181 * Called from kernel/module.c:sys_init_module and routine for a.out format. 183 * Called from kernel/module.c:sys_init_module and routine for a.out format,
184 * signal handler code and kprobes code
182 */ 185 */
183void flush_icache_range(unsigned long start, unsigned long end) 186void flush_icache_range(unsigned long start, unsigned long end)
184{ 187{
185 flush_cache_all(); 188 int icacheaddr;
186} 189 unsigned long flags, v;
187
188/*
189 * Write back the D-cache and purge the I-cache for signal trampoline.
190 * .. which happens to be the same behavior as flush_icache_range().
191 * So, we simply flush out a line.
192 */
193void __uses_jump_to_uncached flush_cache_sigtramp(unsigned long addr)
194{
195 unsigned long v, index;
196 unsigned long flags;
197 int i; 190 int i;
198 191
199 v = addr & ~(L1_CACHE_BYTES-1); 192 /* If there are too many pages then just blow the caches */
200 asm volatile("ocbwb %0" 193 if (((end - start) >> PAGE_SHIFT) >= MAX_ICACHE_PAGES) {
201 : /* no output */ 194 flush_cache_all();
202 : "m" (__m(v))); 195 } else {
203 196 /* selectively flush d-cache then invalidate the i-cache */
204 index = CACHE_IC_ADDRESS_ARRAY | 197 /* this is inefficient, so only use for small ranges */
205 (v & boot_cpu_data.icache.entry_mask); 198 start &= ~(L1_CACHE_BYTES-1);
206 199 end += L1_CACHE_BYTES-1;
207 local_irq_save(flags); 200 end &= ~(L1_CACHE_BYTES-1);
208 jump_to_uncached(); 201
209 202 local_irq_save(flags);
210 for (i = 0; i < boot_cpu_data.icache.ways; 203 jump_to_uncached();
211 i++, index += boot_cpu_data.icache.way_incr) 204
212 ctrl_outl(0, index); /* Clear out Valid-bit */ 205 for (v = start; v < end; v+=L1_CACHE_BYTES) {
213 206 asm volatile("ocbwb %0"
214 back_to_cached(); 207 : /* no output */
215 wmb(); 208 : "m" (__m(v)));
216 local_irq_restore(flags); 209
210 icacheaddr = CACHE_IC_ADDRESS_ARRAY | (
211 v & cpu_data->icache.entry_mask);
212
213 for (i = 0; i < cpu_data->icache.ways;
214 i++, icacheaddr += cpu_data->icache.way_incr)
215 /* Clear i-cache line valid-bit */
216 ctrl_outl(0, icacheaddr);
217 }
218
219 back_to_cached();
220 local_irq_restore(flags);
221 }
217} 222}
218 223
219static inline void flush_cache_4096(unsigned long start, 224static inline void flush_cache_4096(unsigned long start,
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index d3c33fc5b1c2..b2ce014401b5 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -10,6 +10,7 @@
10 * for more details. 10 * for more details.
11 */ 11 */
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/platform_device.h>
13#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
14#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
15#include <asm/addrspace.h> 16#include <asm/addrspace.h>
@@ -27,21 +28,10 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
27 dma_addr_t *dma_handle, gfp_t gfp) 28 dma_addr_t *dma_handle, gfp_t gfp)
28{ 29{
29 void *ret, *ret_nocache; 30 void *ret, *ret_nocache;
30 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
31 int order = get_order(size); 31 int order = get_order(size);
32 32
33 if (mem) { 33 if (dma_alloc_from_coherent(dev, size, dma_handle, &ret))
34 int page = bitmap_find_free_region(mem->bitmap, mem->size, 34 return ret;
35 order);
36 if (page >= 0) {
37 *dma_handle = mem->device_base + (page << PAGE_SHIFT);
38 ret = mem->virt_base + (page << PAGE_SHIFT);
39 memset(ret, 0, size);
40 return ret;
41 }
42 if (mem->flags & DMA_MEMORY_EXCLUSIVE)
43 return NULL;
44 }
45 35
46 ret = (void *)__get_free_pages(gfp, order); 36 ret = (void *)__get_free_pages(gfp, order);
47 if (!ret) 37 if (!ret)
@@ -71,11 +61,7 @@ void dma_free_coherent(struct device *dev, size_t size,
71 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; 61 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
72 int order = get_order(size); 62 int order = get_order(size);
73 63
74 if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) { 64 if (!dma_release_from_coherent(dev, order, vaddr)) {
75 int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
76
77 bitmap_release_region(mem->bitmap, page, order);
78 } else {
79 WARN_ON(irqs_disabled()); /* for portability */ 65 WARN_ON(irqs_disabled()); /* for portability */
80 BUG_ON(mem && mem->flags & DMA_MEMORY_EXCLUSIVE); 66 BUG_ON(mem && mem->flags & DMA_MEMORY_EXCLUSIVE);
81 free_pages((unsigned long)phys_to_virt(dma_handle), order); 67 free_pages((unsigned long)phys_to_virt(dma_handle), order);
@@ -84,83 +70,6 @@ void dma_free_coherent(struct device *dev, size_t size,
84} 70}
85EXPORT_SYMBOL(dma_free_coherent); 71EXPORT_SYMBOL(dma_free_coherent);
86 72
87int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
88 dma_addr_t device_addr, size_t size, int flags)
89{
90 void __iomem *mem_base = NULL;
91 int pages = size >> PAGE_SHIFT;
92 int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long);
93
94 if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0)
95 goto out;
96 if (!size)
97 goto out;
98 if (dev->dma_mem)
99 goto out;
100
101 /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */
102
103 mem_base = ioremap_nocache(bus_addr, size);
104 if (!mem_base)
105 goto out;
106
107 dev->dma_mem = kmalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
108 if (!dev->dma_mem)
109 goto out;
110 dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
111 if (!dev->dma_mem->bitmap)
112 goto free1_out;
113
114 dev->dma_mem->virt_base = mem_base;
115 dev->dma_mem->device_base = device_addr;
116 dev->dma_mem->size = pages;
117 dev->dma_mem->flags = flags;
118
119 if (flags & DMA_MEMORY_MAP)
120 return DMA_MEMORY_MAP;
121
122 return DMA_MEMORY_IO;
123
124 free1_out:
125 kfree(dev->dma_mem);
126 out:
127 if (mem_base)
128 iounmap(mem_base);
129 return 0;
130}
131EXPORT_SYMBOL(dma_declare_coherent_memory);
132
133void dma_release_declared_memory(struct device *dev)
134{
135 struct dma_coherent_mem *mem = dev->dma_mem;
136
137 if (!mem)
138 return;
139 dev->dma_mem = NULL;
140 iounmap(mem->virt_base);
141 kfree(mem->bitmap);
142 kfree(mem);
143}
144EXPORT_SYMBOL(dma_release_declared_memory);
145
146void *dma_mark_declared_memory_occupied(struct device *dev,
147 dma_addr_t device_addr, size_t size)
148{
149 struct dma_coherent_mem *mem = dev->dma_mem;
150 int pages = (size + (device_addr & ~PAGE_MASK) + PAGE_SIZE - 1) >> PAGE_SHIFT;
151 int pos, err;
152
153 if (!mem)
154 return ERR_PTR(-EINVAL);
155
156 pos = (device_addr - mem->device_base) >> PAGE_SHIFT;
157 err = bitmap_allocate_region(mem->bitmap, pos, get_order(pages));
158 if (err != 0)
159 return ERR_PTR(err);
160 return mem->virt_base + (pos << PAGE_SHIFT);
161}
162EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
163
164void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 73void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
165 enum dma_data_direction direction) 74 enum dma_data_direction direction)
166{ 75{
@@ -185,3 +94,32 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
185 } 94 }
186} 95}
187EXPORT_SYMBOL(dma_cache_sync); 96EXPORT_SYMBOL(dma_cache_sync);
97
98int platform_resource_setup_memory(struct platform_device *pdev,
99 char *name, unsigned long memsize)
100{
101 struct resource *r;
102 dma_addr_t dma_handle;
103 void *buf;
104
105 r = pdev->resource + pdev->num_resources - 1;
106 if (r->flags) {
107 pr_warning("%s: unable to find empty space for resource\n",
108 name);
109 return -EINVAL;
110 }
111
112 buf = dma_alloc_coherent(NULL, memsize, &dma_handle, GFP_KERNEL);
113 if (!buf) {
114 pr_warning("%s: unable to allocate memory\n", name);
115 return -ENOMEM;
116 }
117
118 memset(buf, 0, memsize);
119
120 r->flags = IORESOURCE_MEM;
121 r->start = dma_handle;
122 r->end = r->start + memsize - 1;
123 r->name = name;
124 return 0;
125}
diff --git a/arch/sh/mm/fault_32.c b/arch/sh/mm/fault_32.c
index d1fa27594c6e..0c776fdfbdda 100644
--- a/arch/sh/mm/fault_32.c
+++ b/arch/sh/mm/fault_32.c
@@ -37,16 +37,12 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
37 int fault; 37 int fault;
38 siginfo_t info; 38 siginfo_t info;
39 39
40 trace_hardirqs_on();
41 local_irq_enable();
42
43#ifdef CONFIG_SH_KGDB 40#ifdef CONFIG_SH_KGDB
44 if (kgdb_nofault && kgdb_bus_err_hook) 41 if (kgdb_nofault && kgdb_bus_err_hook)
45 kgdb_bus_err_hook(); 42 kgdb_bus_err_hook();
46#endif 43#endif
47 44
48 tsk = current; 45 tsk = current;
49 mm = tsk->mm;
50 si_code = SEGV_MAPERR; 46 si_code = SEGV_MAPERR;
51 47
52 if (unlikely(address >= TASK_SIZE)) { 48 if (unlikely(address >= TASK_SIZE)) {
@@ -88,6 +84,14 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
88 return; 84 return;
89 } 85 }
90 86
87 /* Only enable interrupts if they were on before the fault */
88 if ((regs->sr & SR_IMASK) != SR_IMASK) {
89 trace_hardirqs_on();
90 local_irq_enable();
91 }
92
93 mm = tsk->mm;
94
91 /* 95 /*
92 * If we're in an interrupt or have no user 96 * If we're in an interrupt or have no user
93 * context, we must not take the fault.. 97 * context, we must not take the fault..
diff --git a/arch/sh/mm/fault_64.c b/arch/sh/mm/fault_64.c
index 399d53710d2f..bd63b961b2a9 100644
--- a/arch/sh/mm/fault_64.c
+++ b/arch/sh/mm/fault_64.c
@@ -39,7 +39,7 @@
39#include <asm/uaccess.h> 39#include <asm/uaccess.h>
40#include <asm/pgalloc.h> 40#include <asm/pgalloc.h>
41#include <asm/mmu_context.h> 41#include <asm/mmu_context.h>
42#include <asm/cpu/registers.h> 42#include <cpu/registers.h>
43 43
44/* Callable from fault.c, so not static */ 44/* Callable from fault.c, so not static */
45inline void __do_tlb_refill(unsigned long address, 45inline void __do_tlb_refill(unsigned long address,
diff --git a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c
index 8c7a9ca79879..38870e0fc182 100644
--- a/arch/sh/mm/pg-sh4.c
+++ b/arch/sh/mm/pg-sh4.c
@@ -111,7 +111,7 @@ EXPORT_SYMBOL(copy_user_highpage);
111/* 111/*
112 * For SH-4, we have our own implementation for ptep_get_and_clear 112 * For SH-4, we have our own implementation for ptep_get_and_clear
113 */ 113 */
114inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 114pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
115{ 115{
116 pte_t pte = *ptep; 116 pte_t pte = *ptep;
117 117
diff --git a/arch/sh/mm/pg-sh7705.c b/arch/sh/mm/pg-sh7705.c
index 7f885b7f8aff..eaf25147194c 100644
--- a/arch/sh/mm/pg-sh7705.c
+++ b/arch/sh/mm/pg-sh7705.c
@@ -118,7 +118,7 @@ void copy_user_page(void *to, void *from, unsigned long address, struct page *pg
118 * For SH7705, we have our own implementation for ptep_get_and_clear 118 * For SH7705, we have our own implementation for ptep_get_and_clear
119 * Copied from pg-sh4.c 119 * Copied from pg-sh4.c
120 */ 120 */
121inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 121pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
122{ 122{
123 pte_t pte = *ptep; 123 pte_t pte = *ptep;
124 124
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index 46911bcbf17b..cef727669c87 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -385,7 +385,7 @@ static const struct file_operations pmb_debugfs_fops = {
385 .open = pmb_debugfs_open, 385 .open = pmb_debugfs_open,
386 .read = seq_read, 386 .read = seq_read,
387 .llseek = seq_lseek, 387 .llseek = seq_lseek,
388 .release = seq_release, 388 .release = single_release,
389}; 389};
390 390
391static int __init pmb_debugfs_init(void) 391static int __init pmb_debugfs_init(void)
diff --git a/arch/sh/tools/Makefile b/arch/sh/tools/Makefile
index 567516b58acc..b5d202be8206 100644
--- a/arch/sh/tools/Makefile
+++ b/arch/sh/tools/Makefile
@@ -10,7 +10,7 @@
10# Shamelessly cloned from ARM. 10# Shamelessly cloned from ARM.
11# 11#
12 12
13include/asm-sh/machtypes.h: $(src)/gen-mach-types $(src)/mach-types 13arch/sh/include/asm/machtypes.h: $(src)/gen-mach-types $(src)/mach-types
14 @echo ' Generating $@' 14 @echo ' Generating $@'
15 $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi 15 $(Q)if [ ! -d arch/sh/include/asm ]; then mkdir -p arch/sh/include/asm; fi
16 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } 16 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types
index 1bba7d36be90..0a11cc08f0a5 100644
--- a/arch/sh/tools/mach-types
+++ b/arch/sh/tools/mach-types
@@ -46,3 +46,7 @@ R2D_1 RTS7751R2D_1
46CAYMAN SH_CAYMAN 46CAYMAN SH_CAYMAN
47SDK7780 SH_SDK7780 47SDK7780 SH_SDK7780
48MIGOR SH_MIGOR 48MIGOR SH_MIGOR
49RSK7203 SH_RSK7203
50AP325RXA SH_AP325RXA
51SH7763RDP SH_SH7763RDP
52SH7785LCR SH_SH7785LCR
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 375de7c6d082..a214002114ed 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -68,6 +68,7 @@ config SPARC
68 select HAVE_IDE 68 select HAVE_IDE
69 select HAVE_OPROFILE 69 select HAVE_OPROFILE
70 select HAVE_ARCH_KGDB if !SMP 70 select HAVE_ARCH_KGDB if !SMP
71 select HAVE_ARCH_TRACEHOOK
71 72
72# Identify this as a Sparc32 build 73# Identify this as a Sparc32 build
73config SPARC32 74config SPARC32
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
new file mode 100644
index 000000000000..a5f0ce734ff7
--- /dev/null
+++ b/arch/sparc/include/asm/Kbuild
@@ -0,0 +1,45 @@
1# User exported sparc header files
2include include/asm-generic/Kbuild.asm
3
4header-y += ipcbuf_32.h
5header-y += ipcbuf_64.h
6header-y += posix_types_32.h
7header-y += posix_types_64.h
8header-y += ptrace_32.h
9header-y += ptrace_64.h
10header-y += sigcontext_32.h
11header-y += sigcontext_64.h
12header-y += siginfo_32.h
13header-y += siginfo_64.h
14header-y += signal_32.h
15header-y += signal_64.h
16header-y += stat_32.h
17header-y += stat_64.h
18header-y += statfs_32.h
19header-y += statfs_64.h
20header-y += unistd_32.h
21header-y += unistd_64.h
22
23header-y += apc.h
24header-y += asi.h
25header-y += bpp.h
26header-y += display7seg.h
27header-y += envctrl.h
28header-y += fbio.h
29header-y += jsflash.h
30header-y += openprom.h
31header-y += openprom_32.h
32header-y += openprom_64.h
33header-y += openpromio.h
34header-y += perfctr.h
35header-y += psrcompat.h
36header-y += psr.h
37header-y += pstate.h
38header-y += reg.h
39header-y += reg_32.h
40header-y += reg_64.h
41header-y += traps.h
42header-y += uctx.h
43header-y += utrap.h
44header-y += vfc_ioctls.h
45header-y += watchdog.h
diff --git a/include/asm-sparc/agp.h b/arch/sparc/include/asm/agp.h
index c2456870b05c..c2456870b05c 100644
--- a/include/asm-sparc/agp.h
+++ b/arch/sparc/include/asm/agp.h
diff --git a/include/asm-sparc/apb.h b/arch/sparc/include/asm/apb.h
index 8f3b57db810f..8f3b57db810f 100644
--- a/include/asm-sparc/apb.h
+++ b/arch/sparc/include/asm/apb.h
diff --git a/include/asm-sparc/apc.h b/arch/sparc/include/asm/apc.h
index 24e9a7d4d97e..24e9a7d4d97e 100644
--- a/include/asm-sparc/apc.h
+++ b/arch/sparc/include/asm/apc.h
diff --git a/include/asm-sparc/asi.h b/arch/sparc/include/asm/asi.h
index 74703c5ef985..74703c5ef985 100644
--- a/include/asm-sparc/asi.h
+++ b/arch/sparc/include/asm/asi.h
diff --git a/include/asm-sparc/asmmacro.h b/arch/sparc/include/asm/asmmacro.h
index a619a4d97aae..a619a4d97aae 100644
--- a/include/asm-sparc/asmmacro.h
+++ b/arch/sparc/include/asm/asmmacro.h
diff --git a/arch/sparc/include/asm/atomic.h b/arch/sparc/include/asm/atomic.h
new file mode 100644
index 000000000000..8ff83d8cc33f
--- /dev/null
+++ b/arch/sparc/include/asm/atomic.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_ATOMIC_H
2#define ___ASM_SPARC_ATOMIC_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/atomic_64.h>
5#else
6#include <asm/atomic_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/atomic_32.h b/arch/sparc/include/asm/atomic_32.h
index 5c944b5a8040..5c944b5a8040 100644
--- a/include/asm-sparc/atomic_32.h
+++ b/arch/sparc/include/asm/atomic_32.h
diff --git a/include/asm-sparc/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
index 2c71ec4a3b18..2c71ec4a3b18 100644
--- a/include/asm-sparc/atomic_64.h
+++ b/arch/sparc/include/asm/atomic_64.h
diff --git a/arch/sparc/include/asm/auxio.h b/arch/sparc/include/asm/auxio.h
new file mode 100644
index 000000000000..13dc67f03011
--- /dev/null
+++ b/arch/sparc/include/asm/auxio.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_AUXIO_H
2#define ___ASM_SPARC_AUXIO_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/auxio_64.h>
5#else
6#include <asm/auxio_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/auxio_32.h b/arch/sparc/include/asm/auxio_32.h
new file mode 100644
index 000000000000..e03e088be95f
--- /dev/null
+++ b/arch/sparc/include/asm/auxio_32.h
@@ -0,0 +1,89 @@
1/*
2 * auxio.h: Definitions and code for the Auxiliary I/O register.
3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 */
6#ifndef _SPARC_AUXIO_H
7#define _SPARC_AUXIO_H
8
9#include <asm/system.h>
10#include <asm/vaddrs.h>
11
12/* This register is an unsigned char in IO space. It does two things.
13 * First, it is used to control the front panel LED light on machines
14 * that have it (good for testing entry points to trap handlers and irq's)
15 * Secondly, it controls various floppy drive parameters.
16 */
17#define AUXIO_ORMEIN 0xf0 /* All writes must set these bits. */
18#define AUXIO_ORMEIN4M 0xc0 /* sun4m - All writes must set these bits. */
19#define AUXIO_FLPY_DENS 0x20 /* Floppy density, high if set. Read only. */
20#define AUXIO_FLPY_DCHG 0x10 /* A disk change occurred. Read only. */
21#define AUXIO_EDGE_ON 0x10 /* sun4m - On means Jumper block is in. */
22#define AUXIO_FLPY_DSEL 0x08 /* Drive select/start-motor. Write only. */
23#define AUXIO_LINK_TEST 0x08 /* sun4m - On means TPE Carrier detect. */
24
25/* Set the following to one, then zero, after doing a pseudo DMA transfer. */
26#define AUXIO_FLPY_TCNT 0x04 /* Floppy terminal count. Write only. */
27
28/* Set the following to zero to eject the floppy. */
29#define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */
30#define AUXIO_LED 0x01 /* On if set, off if unset. Read/Write */
31
32#ifndef __ASSEMBLY__
33
34/*
35 * NOTE: these routines are implementation dependent--
36 * understand the hardware you are querying!
37 */
38extern void set_auxio(unsigned char bits_on, unsigned char bits_off);
39extern unsigned char get_auxio(void); /* .../asm/floppy.h */
40
41/*
42 * The following routines are provided for driver-compatibility
43 * with sparc64 (primarily sunlance.c)
44 */
45
46#define AUXIO_LTE_ON 1
47#define AUXIO_LTE_OFF 0
48
49/* auxio_set_lte - Set Link Test Enable (TPE Link Detect)
50 *
51 * on - AUXIO_LTE_ON or AUXIO_LTE_OFF
52 */
53#define auxio_set_lte(on) \
54do { \
55 if(on) { \
56 set_auxio(AUXIO_LINK_TEST, 0); \
57 } else { \
58 set_auxio(0, AUXIO_LINK_TEST); \
59 } \
60} while (0)
61
62#define AUXIO_LED_ON 1
63#define AUXIO_LED_OFF 0
64
65/* auxio_set_led - Set system front panel LED
66 *
67 * on - AUXIO_LED_ON or AUXIO_LED_OFF
68 */
69#define auxio_set_led(on) \
70do { \
71 if(on) { \
72 set_auxio(AUXIO_LED, 0); \
73 } else { \
74 set_auxio(0, AUXIO_LED); \
75 } \
76} while (0)
77
78#endif /* !(__ASSEMBLY__) */
79
80
81/* AUXIO2 (Power Off Control) */
82extern __volatile__ unsigned char * auxio_power_register;
83
84#define AUXIO_POWER_DETECT_FAILURE 32
85#define AUXIO_POWER_CLEAR_FAILURE 2
86#define AUXIO_POWER_OFF 1
87
88
89#endif /* !(_SPARC_AUXIO_H) */
diff --git a/include/asm-sparc/auxio_64.h b/arch/sparc/include/asm/auxio_64.h
index f61cd1e3e395..f61cd1e3e395 100644
--- a/include/asm-sparc/auxio_64.h
+++ b/arch/sparc/include/asm/auxio_64.h
diff --git a/include/asm-sparc/auxvec.h b/arch/sparc/include/asm/auxvec.h
index ad6f360261f6..ad6f360261f6 100644
--- a/include/asm-sparc/auxvec.h
+++ b/arch/sparc/include/asm/auxvec.h
diff --git a/include/asm-sparc/backoff.h b/arch/sparc/include/asm/backoff.h
index fa1fdf67e350..fa1fdf67e350 100644
--- a/include/asm-sparc/backoff.h
+++ b/arch/sparc/include/asm/backoff.h
diff --git a/include/asm-sparc/bbc.h b/arch/sparc/include/asm/bbc.h
index 423a85800aae..423a85800aae 100644
--- a/include/asm-sparc/bbc.h
+++ b/arch/sparc/include/asm/bbc.h
diff --git a/include/asm-sparc/bitext.h b/arch/sparc/include/asm/bitext.h
index 297b2f2fcb49..297b2f2fcb49 100644
--- a/include/asm-sparc/bitext.h
+++ b/arch/sparc/include/asm/bitext.h
diff --git a/arch/sparc/include/asm/bitops.h b/arch/sparc/include/asm/bitops.h
new file mode 100644
index 000000000000..b1edd94bd64f
--- /dev/null
+++ b/arch/sparc/include/asm/bitops.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_BITOPS_H
2#define ___ASM_SPARC_BITOPS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/bitops_64.h>
5#else
6#include <asm/bitops_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/bitops_32.h b/arch/sparc/include/asm/bitops_32.h
index 68b98a7e6454..68b98a7e6454 100644
--- a/include/asm-sparc/bitops_32.h
+++ b/arch/sparc/include/asm/bitops_32.h
diff --git a/include/asm-sparc/bitops_64.h b/arch/sparc/include/asm/bitops_64.h
index bb87b8080220..bb87b8080220 100644
--- a/include/asm-sparc/bitops_64.h
+++ b/arch/sparc/include/asm/bitops_64.h
diff --git a/include/asm-sparc/bpp.h b/arch/sparc/include/asm/bpp.h
index 31f515e499a7..31f515e499a7 100644
--- a/include/asm-sparc/bpp.h
+++ b/arch/sparc/include/asm/bpp.h
diff --git a/arch/sparc/include/asm/btfixup.h b/arch/sparc/include/asm/btfixup.h
new file mode 100644
index 000000000000..797722cf69f2
--- /dev/null
+++ b/arch/sparc/include/asm/btfixup.h
@@ -0,0 +1,208 @@
1/*
2 * asm/btfixup.h: Macros for boot time linking.
3 *
4 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 */
6
7#ifndef _SPARC_BTFIXUP_H
8#define _SPARC_BTFIXUP_H
9
10#include <linux/init.h>
11
12#ifndef __ASSEMBLY__
13
14#ifdef MODULE
15extern unsigned int ___illegal_use_of_BTFIXUP_SIMM13_in_module(void);
16extern unsigned int ___illegal_use_of_BTFIXUP_SETHI_in_module(void);
17extern unsigned int ___illegal_use_of_BTFIXUP_HALF_in_module(void);
18extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void);
19
20#define BTFIXUP_SIMM13(__name) ___illegal_use_of_BTFIXUP_SIMM13_in_module()
21#define BTFIXUP_HALF(__name) ___illegal_use_of_BTFIXUP_HALF_in_module()
22#define BTFIXUP_SETHI(__name) ___illegal_use_of_BTFIXUP_SETHI_in_module()
23#define BTFIXUP_INT(__name) ___illegal_use_of_BTFIXUP_INT_in_module()
24#define BTFIXUP_BLACKBOX(__name) ___illegal_use_of_BTFIXUP_BLACKBOX_in_module
25
26#else
27
28#define BTFIXUP_SIMM13(__name) ___sf_##__name()
29#define BTFIXUP_HALF(__name) ___af_##__name()
30#define BTFIXUP_SETHI(__name) ___hf_##__name()
31#define BTFIXUP_INT(__name) ((unsigned int)&___i_##__name)
32/* This must be written in assembly and present in a sethi */
33#define BTFIXUP_BLACKBOX(__name) ___b_##__name
34#endif /* MODULE */
35
36/* Fixup call xx */
37
38#define BTFIXUPDEF_CALL(__type, __name, __args...) \
39 extern __type ___f_##__name(__args); \
40 extern unsigned ___fs_##__name[3];
41#define BTFIXUPDEF_CALL_CONST(__type, __name, __args...) \
42 extern __type ___f_##__name(__args) __attribute_const__; \
43 extern unsigned ___fs_##__name[3];
44#define BTFIXUP_CALL(__name) ___f_##__name
45
46#define BTFIXUPDEF_BLACKBOX(__name) \
47 extern unsigned ___bs_##__name[2];
48
49/* Put bottom 13bits into some register variable */
50
51#define BTFIXUPDEF_SIMM13(__name) \
52 static inline unsigned int ___sf_##__name(void) __attribute_const__; \
53 extern unsigned ___ss_##__name[2]; \
54 static inline unsigned int ___sf_##__name(void) { \
55 unsigned int ret; \
56 __asm__ ("or %%g0, ___s_" #__name ", %0" : "=r"(ret)); \
57 return ret; \
58 }
59#define BTFIXUPDEF_SIMM13_INIT(__name,__val) \
60 static inline unsigned int ___sf_##__name(void) __attribute_const__; \
61 extern unsigned ___ss_##__name[2]; \
62 static inline unsigned int ___sf_##__name(void) { \
63 unsigned int ret; \
64 __asm__ ("or %%g0, ___s_" #__name "__btset_" #__val ", %0" : "=r"(ret));\
65 return ret; \
66 }
67
68/* Put either bottom 13 bits, or upper 22 bits into some register variable
69 * (depending on the value, this will lead into sethi FIX, reg; or
70 * mov FIX, reg; )
71 */
72
73#define BTFIXUPDEF_HALF(__name) \
74 static inline unsigned int ___af_##__name(void) __attribute_const__; \
75 extern unsigned ___as_##__name[2]; \
76 static inline unsigned int ___af_##__name(void) { \
77 unsigned int ret; \
78 __asm__ ("or %%g0, ___a_" #__name ", %0" : "=r"(ret)); \
79 return ret; \
80 }
81#define BTFIXUPDEF_HALF_INIT(__name,__val) \
82 static inline unsigned int ___af_##__name(void) __attribute_const__; \
83 extern unsigned ___as_##__name[2]; \
84 static inline unsigned int ___af_##__name(void) { \
85 unsigned int ret; \
86 __asm__ ("or %%g0, ___a_" #__name "__btset_" #__val ", %0" : "=r"(ret));\
87 return ret; \
88 }
89
90/* Put upper 22 bits into some register variable */
91
92#define BTFIXUPDEF_SETHI(__name) \
93 static inline unsigned int ___hf_##__name(void) __attribute_const__; \
94 extern unsigned ___hs_##__name[2]; \
95 static inline unsigned int ___hf_##__name(void) { \
96 unsigned int ret; \
97 __asm__ ("sethi %%hi(___h_" #__name "), %0" : "=r"(ret)); \
98 return ret; \
99 }
100#define BTFIXUPDEF_SETHI_INIT(__name,__val) \
101 static inline unsigned int ___hf_##__name(void) __attribute_const__; \
102 extern unsigned ___hs_##__name[2]; \
103 static inline unsigned int ___hf_##__name(void) { \
104 unsigned int ret; \
105 __asm__ ("sethi %%hi(___h_" #__name "__btset_" #__val "), %0" : \
106 "=r"(ret)); \
107 return ret; \
108 }
109
110/* Put a full 32bit integer into some register variable */
111
112#define BTFIXUPDEF_INT(__name) \
113 extern unsigned char ___i_##__name; \
114 extern unsigned ___is_##__name[2];
115
116#define BTFIXUPCALL_NORM 0x00000000 /* Always call */
117#define BTFIXUPCALL_NOP 0x01000000 /* Possibly optimize to nop */
118#define BTFIXUPCALL_RETINT(i) (0x90102000|((i) & 0x1fff)) /* Possibly optimize to mov i, %o0 */
119#define BTFIXUPCALL_ORINT(i) (0x90122000|((i) & 0x1fff)) /* Possibly optimize to or %o0, i, %o0 */
120#define BTFIXUPCALL_RETO0 0x01000000 /* Return first parameter, actually a nop */
121#define BTFIXUPCALL_ANDNINT(i) (0x902a2000|((i) & 0x1fff)) /* Possibly optimize to andn %o0, i, %o0 */
122#define BTFIXUPCALL_SWAPO0O1 0xd27a0000 /* Possibly optimize to swap [%o0],%o1 */
123#define BTFIXUPCALL_SWAPO0G0 0xc07a0000 /* Possibly optimize to swap [%o0],%g0 */
124#define BTFIXUPCALL_SWAPG1G2 0xc4784000 /* Possibly optimize to swap [%g1],%g2 */
125#define BTFIXUPCALL_STG0O0 0xc0220000 /* Possibly optimize to st %g0,[%o0] */
126#define BTFIXUPCALL_STO1O0 0xd2220000 /* Possibly optimize to st %o1,[%o0] */
127
128#define BTFIXUPSET_CALL(__name, __addr, __insn) \
129 do { \
130 ___fs_##__name[0] |= 1; \
131 ___fs_##__name[1] = (unsigned long)__addr; \
132 ___fs_##__name[2] = __insn; \
133 } while (0)
134
135#define BTFIXUPSET_BLACKBOX(__name, __func) \
136 do { \
137 ___bs_##__name[0] |= 1; \
138 ___bs_##__name[1] = (unsigned long)__func; \
139 } while (0)
140
141#define BTFIXUPCOPY_CALL(__name, __from) \
142 do { \
143 ___fs_##__name[0] |= 1; \
144 ___fs_##__name[1] = ___fs_##__from[1]; \
145 ___fs_##__name[2] = ___fs_##__from[2]; \
146 } while (0)
147
148#define BTFIXUPSET_SIMM13(__name, __val) \
149 do { \
150 ___ss_##__name[0] |= 1; \
151 ___ss_##__name[1] = (unsigned)__val; \
152 } while (0)
153
154#define BTFIXUPCOPY_SIMM13(__name, __from) \
155 do { \
156 ___ss_##__name[0] |= 1; \
157 ___ss_##__name[1] = ___ss_##__from[1]; \
158 } while (0)
159
160#define BTFIXUPSET_HALF(__name, __val) \
161 do { \
162 ___as_##__name[0] |= 1; \
163 ___as_##__name[1] = (unsigned)__val; \
164 } while (0)
165
166#define BTFIXUPCOPY_HALF(__name, __from) \
167 do { \
168 ___as_##__name[0] |= 1; \
169 ___as_##__name[1] = ___as_##__from[1]; \
170 } while (0)
171
172#define BTFIXUPSET_SETHI(__name, __val) \
173 do { \
174 ___hs_##__name[0] |= 1; \
175 ___hs_##__name[1] = (unsigned)__val; \
176 } while (0)
177
178#define BTFIXUPCOPY_SETHI(__name, __from) \
179 do { \
180 ___hs_##__name[0] |= 1; \
181 ___hs_##__name[1] = ___hs_##__from[1]; \
182 } while (0)
183
184#define BTFIXUPSET_INT(__name, __val) \
185 do { \
186 ___is_##__name[0] |= 1; \
187 ___is_##__name[1] = (unsigned)__val; \
188 } while (0)
189
190#define BTFIXUPCOPY_INT(__name, __from) \
191 do { \
192 ___is_##__name[0] |= 1; \
193 ___is_##__name[1] = ___is_##__from[1]; \
194 } while (0)
195
196#define BTFIXUPVAL_CALL(__name) \
197 ((unsigned long)___fs_##__name[1])
198
199extern void btfixup(void);
200
201#else /* __ASSEMBLY__ */
202
203#define BTFIXUP_SETHI(__name) %hi(___h_ ## __name)
204#define BTFIXUP_SETHI_INIT(__name,__val) %hi(___h_ ## __name ## __btset_ ## __val)
205
206#endif /* __ASSEMBLY__ */
207
208#endif /* !(_SPARC_BTFIXUP_H) */
diff --git a/include/asm-sparc/bug.h b/arch/sparc/include/asm/bug.h
index 8a59e5a8c217..8a59e5a8c217 100644
--- a/include/asm-sparc/bug.h
+++ b/arch/sparc/include/asm/bug.h
diff --git a/arch/sparc/include/asm/bugs.h b/arch/sparc/include/asm/bugs.h
new file mode 100644
index 000000000000..e179bc12f64a
--- /dev/null
+++ b/arch/sparc/include/asm/bugs.h
@@ -0,0 +1,24 @@
1/* include/asm/bugs.h: Sparc probes for various bugs.
2 *
3 * Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#ifdef CONFIG_SPARC32
7#include <asm/cpudata.h>
8#endif
9
10#ifdef CONFIG_SPARC64
11#include <asm/sstate.h>
12#endif
13
14extern unsigned long loops_per_jiffy;
15
16static void __init check_bugs(void)
17{
18#if defined(CONFIG_SPARC32) && !defined(CONFIG_SMP)
19 cpu_data(0).udelay_val = loops_per_jiffy;
20#endif
21#ifdef CONFIG_SPARC64
22 sstate_running();
23#endif
24}
diff --git a/include/asm-sparc/byteorder.h b/arch/sparc/include/asm/byteorder.h
index bcd83aa351c5..bcd83aa351c5 100644
--- a/include/asm-sparc/byteorder.h
+++ b/arch/sparc/include/asm/byteorder.h
diff --git a/include/asm-sparc/cache.h b/arch/sparc/include/asm/cache.h
index 41f85ae4bd4a..41f85ae4bd4a 100644
--- a/include/asm-sparc/cache.h
+++ b/arch/sparc/include/asm/cache.h
diff --git a/arch/sparc/include/asm/cacheflush.h b/arch/sparc/include/asm/cacheflush.h
new file mode 100644
index 000000000000..049168087b19
--- /dev/null
+++ b/arch/sparc/include/asm/cacheflush.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_CACHEFLUSH_H
2#define ___ASM_SPARC_CACHEFLUSH_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/cacheflush_64.h>
5#else
6#include <asm/cacheflush_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/cacheflush_32.h b/arch/sparc/include/asm/cacheflush_32.h
index 68ac10910271..68ac10910271 100644
--- a/include/asm-sparc/cacheflush_32.h
+++ b/arch/sparc/include/asm/cacheflush_32.h
diff --git a/include/asm-sparc/cacheflush_64.h b/arch/sparc/include/asm/cacheflush_64.h
index c43321729b3b..c43321729b3b 100644
--- a/include/asm-sparc/cacheflush_64.h
+++ b/arch/sparc/include/asm/cacheflush_64.h
diff --git a/include/asm-sparc/chafsr.h b/arch/sparc/include/asm/chafsr.h
index 85c69b38220b..85c69b38220b 100644
--- a/include/asm-sparc/chafsr.h
+++ b/arch/sparc/include/asm/chafsr.h
diff --git a/arch/sparc/include/asm/checksum.h b/arch/sparc/include/asm/checksum.h
new file mode 100644
index 000000000000..7ac0d7497bc5
--- /dev/null
+++ b/arch/sparc/include/asm/checksum.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_CHECKSUM_H
2#define ___ASM_SPARC_CHECKSUM_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/checksum_64.h>
5#else
6#include <asm/checksum_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/checksum_32.h b/arch/sparc/include/asm/checksum_32.h
index bdbda1453aa9..bdbda1453aa9 100644
--- a/include/asm-sparc/checksum_32.h
+++ b/arch/sparc/include/asm/checksum_32.h
diff --git a/include/asm-sparc/checksum_64.h b/arch/sparc/include/asm/checksum_64.h
index 019b9615e43c..019b9615e43c 100644
--- a/include/asm-sparc/checksum_64.h
+++ b/arch/sparc/include/asm/checksum_64.h
diff --git a/include/asm-sparc/chmctrl.h b/arch/sparc/include/asm/chmctrl.h
index 859b4a4b0d30..859b4a4b0d30 100644
--- a/include/asm-sparc/chmctrl.h
+++ b/arch/sparc/include/asm/chmctrl.h
diff --git a/include/asm-sparc/clock.h b/arch/sparc/include/asm/clock.h
index 2cf99dadec56..2cf99dadec56 100644
--- a/include/asm-sparc/clock.h
+++ b/arch/sparc/include/asm/clock.h
diff --git a/include/asm-sparc/cmt.h b/arch/sparc/include/asm/cmt.h
index 870db5928577..870db5928577 100644
--- a/include/asm-sparc/cmt.h
+++ b/arch/sparc/include/asm/cmt.h
diff --git a/include/asm-sparc/compat.h b/arch/sparc/include/asm/compat.h
index f260b58f5ce9..f260b58f5ce9 100644
--- a/include/asm-sparc/compat.h
+++ b/arch/sparc/include/asm/compat.h
diff --git a/include/asm-sparc/compat_signal.h b/arch/sparc/include/asm/compat_signal.h
index b759eab9b51c..b759eab9b51c 100644
--- a/include/asm-sparc/compat_signal.h
+++ b/arch/sparc/include/asm/compat_signal.h
diff --git a/include/asm-sparc/contregs.h b/arch/sparc/include/asm/contregs.h
index 48fa8a4ef357..48fa8a4ef357 100644
--- a/include/asm-sparc/contregs.h
+++ b/arch/sparc/include/asm/contregs.h
diff --git a/arch/sparc/include/asm/cpudata.h b/arch/sparc/include/asm/cpudata.h
new file mode 100644
index 000000000000..b5976de7cacd
--- /dev/null
+++ b/arch/sparc/include/asm/cpudata.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_CPUDATA_H
2#define ___ASM_SPARC_CPUDATA_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/cpudata_64.h>
5#else
6#include <asm/cpudata_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/cpudata_32.h b/arch/sparc/include/asm/cpudata_32.h
new file mode 100644
index 000000000000..31d48a0e32c7
--- /dev/null
+++ b/arch/sparc/include/asm/cpudata_32.h
@@ -0,0 +1,27 @@
1/* cpudata.h: Per-cpu parameters.
2 *
3 * Copyright (C) 2004 Keith M Wesolowski (wesolows@foobazco.org)
4 *
5 * Based on include/asm/cpudata.h and Linux 2.4 smp.h
6 * both (C) David S. Miller.
7 */
8
9#ifndef _SPARC_CPUDATA_H
10#define _SPARC_CPUDATA_H
11
12#include <linux/percpu.h>
13
14typedef struct {
15 unsigned long udelay_val;
16 unsigned long clock_tick;
17 unsigned int multiplier;
18 unsigned int counter;
19 int prom_node;
20 int mid;
21 int next;
22} cpuinfo_sparc;
23
24DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
25#define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu))
26
27#endif /* _SPARC_CPUDATA_H */
diff --git a/include/asm-sparc/cpudata_64.h b/arch/sparc/include/asm/cpudata_64.h
index 532975ecfe10..532975ecfe10 100644
--- a/include/asm-sparc/cpudata_64.h
+++ b/arch/sparc/include/asm/cpudata_64.h
diff --git a/include/asm-sparc/cputime.h b/arch/sparc/include/asm/cputime.h
index 1a642b81e019..1a642b81e019 100644
--- a/include/asm-sparc/cputime.h
+++ b/arch/sparc/include/asm/cputime.h
diff --git a/arch/sparc/include/asm/current.h b/arch/sparc/include/asm/current.h
new file mode 100644
index 000000000000..10a0df55a574
--- /dev/null
+++ b/arch/sparc/include/asm/current.h
@@ -0,0 +1,34 @@
1/* include/asm/current.h
2 *
3 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
4 * Copyright (C) 2002 Pete Zaitcev (zaitcev@yahoo.com)
5 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
6 *
7 * Derived from "include/asm-s390/current.h" by
8 * Martin Schwidefsky (schwidefsky@de.ibm.com)
9 * Derived from "include/asm-i386/current.h"
10*/
11#ifndef _SPARC_CURRENT_H
12#define _SPARC_CURRENT_H
13
14#include <linux/thread_info.h>
15
16#ifdef CONFIG_SPARC64
17register struct task_struct *current asm("g4");
18#endif
19
20#ifdef CONFIG_SPARC32
21/* We might want to consider using %g4 like sparc64 to shave a few cycles.
22 *
23 * Two stage process (inline + #define) for type-checking.
24 * We also obfuscate get_current() to check if anyone used that by mistake.
25 */
26struct task_struct;
27static inline struct task_struct *__get_current(void)
28{
29 return current_thread_info()->task;
30}
31#define current __get_current()
32#endif
33
34#endif /* !(_SPARC_CURRENT_H) */
diff --git a/include/asm-sparc/cypress.h b/arch/sparc/include/asm/cypress.h
index 95e9772ea394..95e9772ea394 100644
--- a/include/asm-sparc/cypress.h
+++ b/arch/sparc/include/asm/cypress.h
diff --git a/include/asm-sparc/dcr.h b/arch/sparc/include/asm/dcr.h
index 620c9ba642e9..620c9ba642e9 100644
--- a/include/asm-sparc/dcr.h
+++ b/arch/sparc/include/asm/dcr.h
diff --git a/include/asm-sparc/dcu.h b/arch/sparc/include/asm/dcu.h
index 0f704e106a1b..0f704e106a1b 100644
--- a/include/asm-sparc/dcu.h
+++ b/arch/sparc/include/asm/dcu.h
diff --git a/arch/sparc/include/asm/delay.h b/arch/sparc/include/asm/delay.h
new file mode 100644
index 000000000000..467caa2a97a0
--- /dev/null
+++ b/arch/sparc/include/asm/delay.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_DELAY_H
2#define ___ASM_SPARC_DELAY_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/delay_64.h>
5#else
6#include <asm/delay_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/delay_32.h b/arch/sparc/include/asm/delay_32.h
index bc9aba2bead6..bc9aba2bead6 100644
--- a/include/asm-sparc/delay_32.h
+++ b/arch/sparc/include/asm/delay_32.h
diff --git a/include/asm-sparc/delay_64.h b/arch/sparc/include/asm/delay_64.h
index a77aa622d762..a77aa622d762 100644
--- a/include/asm-sparc/delay_64.h
+++ b/arch/sparc/include/asm/delay_64.h
diff --git a/include/asm-sparc/device.h b/arch/sparc/include/asm/device.h
index 19790eb99cc6..19790eb99cc6 100644
--- a/include/asm-sparc/device.h
+++ b/arch/sparc/include/asm/device.h
diff --git a/include/asm-sparc/display7seg.h b/arch/sparc/include/asm/display7seg.h
index 86d4a901df24..86d4a901df24 100644
--- a/include/asm-sparc/display7seg.h
+++ b/arch/sparc/include/asm/display7seg.h
diff --git a/include/asm-sparc/div64.h b/arch/sparc/include/asm/div64.h
index 6cd978cefb28..6cd978cefb28 100644
--- a/include/asm-sparc/div64.h
+++ b/arch/sparc/include/asm/div64.h
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
new file mode 100644
index 000000000000..0f4150e26619
--- /dev/null
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_DMA_MAPPING_H
2#define ___ASM_SPARC_DMA_MAPPING_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/dma-mapping_64.h>
5#else
6#include <asm/dma-mapping_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/dma-mapping_32.h b/arch/sparc/include/asm/dma-mapping_32.h
index f3a641e6b2c8..f3a641e6b2c8 100644
--- a/include/asm-sparc/dma-mapping_32.h
+++ b/arch/sparc/include/asm/dma-mapping_32.h
diff --git a/include/asm-sparc/dma-mapping_64.h b/arch/sparc/include/asm/dma-mapping_64.h
index bfa64f9702d5..bfa64f9702d5 100644
--- a/include/asm-sparc/dma-mapping_64.h
+++ b/arch/sparc/include/asm/dma-mapping_64.h
diff --git a/arch/sparc/include/asm/dma.h b/arch/sparc/include/asm/dma.h
new file mode 100644
index 000000000000..aa1d90ac04c5
--- /dev/null
+++ b/arch/sparc/include/asm/dma.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_DMA_H
2#define ___ASM_SPARC_DMA_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/dma_64.h>
5#else
6#include <asm/dma_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/dma_32.h b/arch/sparc/include/asm/dma_32.h
new file mode 100644
index 000000000000..cf7189c0079b
--- /dev/null
+++ b/arch/sparc/include/asm/dma_32.h
@@ -0,0 +1,288 @@
1/* include/asm/dma.h
2 *
3 * Copyright 1995 (C) David S. Miller (davem@davemloft.net)
4 */
5
6#ifndef _ASM_SPARC_DMA_H
7#define _ASM_SPARC_DMA_H
8
9#include <linux/kernel.h>
10#include <linux/types.h>
11
12#include <asm/vac-ops.h> /* for invalidate's, etc. */
13#include <asm/sbus.h>
14#include <asm/delay.h>
15#include <asm/oplib.h>
16#include <asm/system.h>
17#include <asm/io.h>
18#include <linux/spinlock.h>
19
20struct page;
21extern spinlock_t dma_spin_lock;
22
23static inline unsigned long claim_dma_lock(void)
24{
25 unsigned long flags;
26 spin_lock_irqsave(&dma_spin_lock, flags);
27 return flags;
28}
29
30static inline void release_dma_lock(unsigned long flags)
31{
32 spin_unlock_irqrestore(&dma_spin_lock, flags);
33}
34
35/* These are irrelevant for Sparc DMA, but we leave it in so that
36 * things can compile.
37 */
38#define MAX_DMA_CHANNELS 8
39#define MAX_DMA_ADDRESS (~0UL)
40#define DMA_MODE_READ 1
41#define DMA_MODE_WRITE 2
42
43/* Useful constants */
44#define SIZE_16MB (16*1024*1024)
45#define SIZE_64K (64*1024)
46
47/* SBUS DMA controller reg offsets */
48#define DMA_CSR 0x00UL /* rw DMA control/status register 0x00 */
49#define DMA_ADDR 0x04UL /* rw DMA transfer address register 0x04 */
50#define DMA_COUNT 0x08UL /* rw DMA transfer count register 0x08 */
51#define DMA_TEST 0x0cUL /* rw DMA test/debug register 0x0c */
52
53/* DVMA chip revisions */
54enum dvma_rev {
55 dvmarev0,
56 dvmaesc1,
57 dvmarev1,
58 dvmarev2,
59 dvmarev3,
60 dvmarevplus,
61 dvmahme
62};
63
64#define DMA_HASCOUNT(rev) ((rev)==dvmaesc1)
65
66/* Linux DMA information structure, filled during probe. */
67struct sbus_dma {
68 struct sbus_dma *next;
69 struct sbus_dev *sdev;
70 void __iomem *regs;
71
72 /* Status, misc info */
73 int node; /* Prom node for this DMA device */
74 int running; /* Are we doing DMA now? */
75 int allocated; /* Are we "owned" by anyone yet? */
76
77 /* Transfer information. */
78 unsigned long addr; /* Start address of current transfer */
79 int nbytes; /* Size of current transfer */
80 int realbytes; /* For splitting up large transfers, etc. */
81
82 /* DMA revision */
83 enum dvma_rev revision;
84};
85
86extern struct sbus_dma *dma_chain;
87
88/* Broken hardware... */
89#ifdef CONFIG_SUN4
90/* Have to sort this out. Does rev0 work fine on sun4[cmd] without isbroken?
91 * Or is rev0 present only on sun4 boxes? -jj */
92#define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev0 || (dma)->revision == dvmarev1)
93#else
94#define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev1)
95#endif
96#define DMA_ISESC1(dma) ((dma)->revision == dvmaesc1)
97
98/* Main routines in dma.c */
99extern void dvma_init(struct sbus_bus *);
100
101/* Fields in the cond_reg register */
102/* First, the version identification bits */
103#define DMA_DEVICE_ID 0xf0000000 /* Device identification bits */
104#define DMA_VERS0 0x00000000 /* Sunray DMA version */
105#define DMA_ESCV1 0x40000000 /* DMA ESC Version 1 */
106#define DMA_VERS1 0x80000000 /* DMA rev 1 */
107#define DMA_VERS2 0xa0000000 /* DMA rev 2 */
108#define DMA_VERHME 0xb0000000 /* DMA hme gate array */
109#define DMA_VERSPLUS 0x90000000 /* DMA rev 1 PLUS */
110
111#define DMA_HNDL_INTR 0x00000001 /* An IRQ needs to be handled */
112#define DMA_HNDL_ERROR 0x00000002 /* We need to take an error */
113#define DMA_FIFO_ISDRAIN 0x0000000c /* The DMA FIFO is draining */
114#define DMA_INT_ENAB 0x00000010 /* Turn on interrupts */
115#define DMA_FIFO_INV 0x00000020 /* Invalidate the FIFO */
116#define DMA_ACC_SZ_ERR 0x00000040 /* The access size was bad */
117#define DMA_FIFO_STDRAIN 0x00000040 /* DMA_VERS1 Drain the FIFO */
118#define DMA_RST_SCSI 0x00000080 /* Reset the SCSI controller */
119#define DMA_RST_ENET DMA_RST_SCSI /* Reset the ENET controller */
120#define DMA_RST_BPP DMA_RST_SCSI /* Reset the BPP controller */
121#define DMA_ST_WRITE 0x00000100 /* write from device to memory */
122#define DMA_ENABLE 0x00000200 /* Fire up DMA, handle requests */
123#define DMA_PEND_READ 0x00000400 /* DMA_VERS1/0/PLUS Pending Read */
124#define DMA_ESC_BURST 0x00000800 /* 1=16byte 0=32byte */
125#define DMA_READ_AHEAD 0x00001800 /* DMA read ahead partial longword */
126#define DMA_DSBL_RD_DRN 0x00001000 /* No EC drain on slave reads */
127#define DMA_BCNT_ENAB 0x00002000 /* If on, use the byte counter */
128#define DMA_TERM_CNTR 0x00004000 /* Terminal counter */
129#define DMA_SCSI_SBUS64 0x00008000 /* HME: Enable 64-bit SBUS mode. */
130#define DMA_CSR_DISAB 0x00010000 /* No FIFO drains during csr */
131#define DMA_SCSI_DISAB 0x00020000 /* No FIFO drains during reg */
132#define DMA_DSBL_WR_INV 0x00020000 /* No EC inval. on slave writes */
133#define DMA_ADD_ENABLE 0x00040000 /* Special ESC DVMA optimization */
134#define DMA_E_BURSTS 0x000c0000 /* ENET: SBUS r/w burst mask */
135#define DMA_E_BURST32 0x00040000 /* ENET: SBUS 32 byte r/w burst */
136#define DMA_E_BURST16 0x00000000 /* ENET: SBUS 16 byte r/w burst */
137#define DMA_BRST_SZ 0x000c0000 /* SCSI: SBUS r/w burst size */
138#define DMA_BRST64 0x00080000 /* SCSI: 64byte bursts (HME on UltraSparc only) */
139#define DMA_BRST32 0x00040000 /* SCSI/BPP: 32byte bursts */
140#define DMA_BRST16 0x00000000 /* SCSI/BPP: 16byte bursts */
141#define DMA_BRST0 0x00080000 /* SCSI: no bursts (non-HME gate arrays) */
142#define DMA_ADDR_DISAB 0x00100000 /* No FIFO drains during addr */
143#define DMA_2CLKS 0x00200000 /* Each transfer = 2 clock ticks */
144#define DMA_3CLKS 0x00400000 /* Each transfer = 3 clock ticks */
145#define DMA_EN_ENETAUI DMA_3CLKS /* Put lance into AUI-cable mode */
146#define DMA_CNTR_DISAB 0x00800000 /* No IRQ when DMA_TERM_CNTR set */
147#define DMA_AUTO_NADDR 0x01000000 /* Use "auto nxt addr" feature */
148#define DMA_SCSI_ON 0x02000000 /* Enable SCSI dma */
149#define DMA_BPP_ON DMA_SCSI_ON /* Enable BPP dma */
150#define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */
151#define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */
152#define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */
153#define DMA_RESET_FAS366 0x08000000 /* HME: Assert RESET to FAS366 */
154
155/* Values describing the burst-size property from the PROM */
156#define DMA_BURST1 0x01
157#define DMA_BURST2 0x02
158#define DMA_BURST4 0x04
159#define DMA_BURST8 0x08
160#define DMA_BURST16 0x10
161#define DMA_BURST32 0x20
162#define DMA_BURST64 0x40
163#define DMA_BURSTBITS 0x7f
164
165/* Determine highest possible final transfer address given a base */
166#define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL))
167
168/* Yes, I hack a lot of elisp in my spare time... */
169#define DMA_ERROR_P(regs) ((((regs)->cond_reg) & DMA_HNDL_ERROR))
170#define DMA_IRQ_P(regs) ((((regs)->cond_reg) & (DMA_HNDL_INTR | DMA_HNDL_ERROR)))
171#define DMA_WRITE_P(regs) ((((regs)->cond_reg) & DMA_ST_WRITE))
172#define DMA_OFF(regs) ((((regs)->cond_reg) &= (~DMA_ENABLE)))
173#define DMA_INTSOFF(regs) ((((regs)->cond_reg) &= (~DMA_INT_ENAB)))
174#define DMA_INTSON(regs) ((((regs)->cond_reg) |= (DMA_INT_ENAB)))
175#define DMA_PUNTFIFO(regs) ((((regs)->cond_reg) |= DMA_FIFO_INV))
176#define DMA_SETSTART(regs, addr) ((((regs)->st_addr) = (char *) addr))
177#define DMA_BEGINDMA_W(regs) \
178 ((((regs)->cond_reg |= (DMA_ST_WRITE|DMA_ENABLE|DMA_INT_ENAB))))
179#define DMA_BEGINDMA_R(regs) \
180 ((((regs)->cond_reg |= ((DMA_ENABLE|DMA_INT_ENAB)&(~DMA_ST_WRITE)))))
181
182/* For certain DMA chips, we need to disable ints upon irq entry
183 * and turn them back on when we are done. So in any ESP interrupt
184 * handler you *must* call DMA_IRQ_ENTRY upon entry and DMA_IRQ_EXIT
185 * when leaving the handler. You have been warned...
186 */
187#define DMA_IRQ_ENTRY(dma, dregs) do { \
188 if(DMA_ISBROKEN(dma)) DMA_INTSOFF(dregs); \
189 } while (0)
190
191#define DMA_IRQ_EXIT(dma, dregs) do { \
192 if(DMA_ISBROKEN(dma)) DMA_INTSON(dregs); \
193 } while(0)
194
195#if 0 /* P3 this stuff is inline in ledma.c:init_restart_ledma() */
196/* Pause until counter runs out or BIT isn't set in the DMA condition
197 * register.
198 */
199static inline void sparc_dma_pause(struct sparc_dma_registers *regs,
200 unsigned long bit)
201{
202 int ctr = 50000; /* Let's find some bugs ;) */
203
204 /* Busy wait until the bit is not set any more */
205 while((regs->cond_reg&bit) && (ctr>0)) {
206 ctr--;
207 __delay(5);
208 }
209
210 /* Check for bogus outcome. */
211 if(!ctr)
212 panic("DMA timeout");
213}
214
215/* Reset the friggin' thing... */
216#define DMA_RESET(dma) do { \
217 struct sparc_dma_registers *regs = dma->regs; \
218 /* Let the current FIFO drain itself */ \
219 sparc_dma_pause(regs, (DMA_FIFO_ISDRAIN)); \
220 /* Reset the logic */ \
221 regs->cond_reg |= (DMA_RST_SCSI); /* assert */ \
222 __delay(400); /* let the bits set ;) */ \
223 regs->cond_reg &= ~(DMA_RST_SCSI); /* de-assert */ \
224 sparc_dma_enable_interrupts(regs); /* Re-enable interrupts */ \
225 /* Enable FAST transfers if available */ \
226 if(dma->revision>dvmarev1) regs->cond_reg |= DMA_3CLKS; \
227 dma->running = 0; \
228} while(0)
229#endif
230
231#define for_each_dvma(dma) \
232 for((dma) = dma_chain; (dma); (dma) = (dma)->next)
233
234extern int get_dma_list(char *);
235extern int request_dma(unsigned int, __const__ char *);
236extern void free_dma(unsigned int);
237
238/* From PCI */
239
240#ifdef CONFIG_PCI
241extern int isa_dma_bridge_buggy;
242#else
243#define isa_dma_bridge_buggy (0)
244#endif
245
246/* Routines for data transfer buffers. */
247BTFIXUPDEF_CALL(char *, mmu_lockarea, char *, unsigned long)
248BTFIXUPDEF_CALL(void, mmu_unlockarea, char *, unsigned long)
249
250#define mmu_lockarea(vaddr,len) BTFIXUP_CALL(mmu_lockarea)(vaddr,len)
251#define mmu_unlockarea(vaddr,len) BTFIXUP_CALL(mmu_unlockarea)(vaddr,len)
252
253/* These are implementations for sbus_map_sg/sbus_unmap_sg... collapse later */
254BTFIXUPDEF_CALL(__u32, mmu_get_scsi_one, char *, unsigned long, struct sbus_bus *sbus)
255BTFIXUPDEF_CALL(void, mmu_get_scsi_sgl, struct scatterlist *, int, struct sbus_bus *sbus)
256BTFIXUPDEF_CALL(void, mmu_release_scsi_one, __u32, unsigned long, struct sbus_bus *sbus)
257BTFIXUPDEF_CALL(void, mmu_release_scsi_sgl, struct scatterlist *, int, struct sbus_bus *sbus)
258
259#define mmu_get_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_get_scsi_one)(vaddr,len,sbus)
260#define mmu_get_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_get_scsi_sgl)(sg,sz,sbus)
261#define mmu_release_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_release_scsi_one)(vaddr,len,sbus)
262#define mmu_release_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_release_scsi_sgl)(sg,sz,sbus)
263
264/*
265 * mmu_map/unmap are provided by iommu/iounit; Invalid to call on IIep.
266 *
267 * The mmu_map_dma_area establishes two mappings in one go.
268 * These mappings point to pages normally mapped at 'va' (linear address).
269 * First mapping is for CPU visible address at 'a', uncached.
270 * This is an alias, but it works because it is an uncached mapping.
271 * Second mapping is for device visible address, or "bus" address.
272 * The bus address is returned at '*pba'.
273 *
274 * These functions seem distinct, but are hard to split. On sun4c,
275 * at least for now, 'a' is equal to bus address, and retured in *pba.
276 * On sun4m, page attributes depend on the CPU type, so we have to
277 * know if we are mapping RAM or I/O, so it has to be an additional argument
278 * to a separate mapping function for CPU visible mappings.
279 */
280BTFIXUPDEF_CALL(int, mmu_map_dma_area, dma_addr_t *, unsigned long, unsigned long, int len)
281BTFIXUPDEF_CALL(struct page *, mmu_translate_dvma, unsigned long busa)
282BTFIXUPDEF_CALL(void, mmu_unmap_dma_area, unsigned long busa, int len)
283
284#define mmu_map_dma_area(pba,va,a,len) BTFIXUP_CALL(mmu_map_dma_area)(pba,va,a,len)
285#define mmu_unmap_dma_area(ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(ba,len)
286#define mmu_translate_dvma(ba) BTFIXUP_CALL(mmu_translate_dvma)(ba)
287
288#endif /* !(_ASM_SPARC_DMA_H) */
diff --git a/arch/sparc/include/asm/dma_64.h b/arch/sparc/include/asm/dma_64.h
new file mode 100644
index 000000000000..46a8aecffc02
--- /dev/null
+++ b/arch/sparc/include/asm/dma_64.h
@@ -0,0 +1,205 @@
1/*
2 * include/asm/dma.h
3 *
4 * Copyright 1996 (C) David S. Miller (davem@caip.rutgers.edu)
5 */
6
7#ifndef _ASM_SPARC64_DMA_H
8#define _ASM_SPARC64_DMA_H
9
10#include <linux/kernel.h>
11#include <linux/types.h>
12#include <linux/spinlock.h>
13
14#include <asm/sbus.h>
15#include <asm/delay.h>
16#include <asm/oplib.h>
17
18/* These are irrelevant for Sparc DMA, but we leave it in so that
19 * things can compile.
20 */
21#define MAX_DMA_CHANNELS 8
22#define DMA_MODE_READ 1
23#define DMA_MODE_WRITE 2
24#define MAX_DMA_ADDRESS (~0UL)
25
26/* Useful constants */
27#define SIZE_16MB (16*1024*1024)
28#define SIZE_64K (64*1024)
29
30/* SBUS DMA controller reg offsets */
31#define DMA_CSR 0x00UL /* rw DMA control/status register 0x00 */
32#define DMA_ADDR 0x04UL /* rw DMA transfer address register 0x04 */
33#define DMA_COUNT 0x08UL /* rw DMA transfer count register 0x08 */
34#define DMA_TEST 0x0cUL /* rw DMA test/debug register 0x0c */
35
36/* DVMA chip revisions */
37enum dvma_rev {
38 dvmarev0,
39 dvmaesc1,
40 dvmarev1,
41 dvmarev2,
42 dvmarev3,
43 dvmarevplus,
44 dvmahme
45};
46
47#define DMA_HASCOUNT(rev) ((rev)==dvmaesc1)
48
49/* Linux DMA information structure, filled during probe. */
50struct sbus_dma {
51 struct sbus_dma *next;
52 struct sbus_dev *sdev;
53 void __iomem *regs;
54
55 /* Status, misc info */
56 int node; /* Prom node for this DMA device */
57 int running; /* Are we doing DMA now? */
58 int allocated; /* Are we "owned" by anyone yet? */
59
60 /* Transfer information. */
61 u32 addr; /* Start address of current transfer */
62 int nbytes; /* Size of current transfer */
63 int realbytes; /* For splitting up large transfers, etc. */
64
65 /* DMA revision */
66 enum dvma_rev revision;
67};
68
69extern struct sbus_dma *dma_chain;
70
71/* Broken hardware... */
72#define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev1)
73#define DMA_ISESC1(dma) ((dma)->revision == dvmaesc1)
74
75/* Main routines in dma.c */
76extern void dvma_init(struct sbus_bus *);
77
78/* Fields in the cond_reg register */
79/* First, the version identification bits */
80#define DMA_DEVICE_ID 0xf0000000 /* Device identification bits */
81#define DMA_VERS0 0x00000000 /* Sunray DMA version */
82#define DMA_ESCV1 0x40000000 /* DMA ESC Version 1 */
83#define DMA_VERS1 0x80000000 /* DMA rev 1 */
84#define DMA_VERS2 0xa0000000 /* DMA rev 2 */
85#define DMA_VERHME 0xb0000000 /* DMA hme gate array */
86#define DMA_VERSPLUS 0x90000000 /* DMA rev 1 PLUS */
87
88#define DMA_HNDL_INTR 0x00000001 /* An IRQ needs to be handled */
89#define DMA_HNDL_ERROR 0x00000002 /* We need to take an error */
90#define DMA_FIFO_ISDRAIN 0x0000000c /* The DMA FIFO is draining */
91#define DMA_INT_ENAB 0x00000010 /* Turn on interrupts */
92#define DMA_FIFO_INV 0x00000020 /* Invalidate the FIFO */
93#define DMA_ACC_SZ_ERR 0x00000040 /* The access size was bad */
94#define DMA_FIFO_STDRAIN 0x00000040 /* DMA_VERS1 Drain the FIFO */
95#define DMA_RST_SCSI 0x00000080 /* Reset the SCSI controller */
96#define DMA_RST_ENET DMA_RST_SCSI /* Reset the ENET controller */
97#define DMA_ST_WRITE 0x00000100 /* write from device to memory */
98#define DMA_ENABLE 0x00000200 /* Fire up DMA, handle requests */
99#define DMA_PEND_READ 0x00000400 /* DMA_VERS1/0/PLUS Pending Read */
100#define DMA_ESC_BURST 0x00000800 /* 1=16byte 0=32byte */
101#define DMA_READ_AHEAD 0x00001800 /* DMA read ahead partial longword */
102#define DMA_DSBL_RD_DRN 0x00001000 /* No EC drain on slave reads */
103#define DMA_BCNT_ENAB 0x00002000 /* If on, use the byte counter */
104#define DMA_TERM_CNTR 0x00004000 /* Terminal counter */
105#define DMA_SCSI_SBUS64 0x00008000 /* HME: Enable 64-bit SBUS mode. */
106#define DMA_CSR_DISAB 0x00010000 /* No FIFO drains during csr */
107#define DMA_SCSI_DISAB 0x00020000 /* No FIFO drains during reg */
108#define DMA_DSBL_WR_INV 0x00020000 /* No EC inval. on slave writes */
109#define DMA_ADD_ENABLE 0x00040000 /* Special ESC DVMA optimization */
110#define DMA_E_BURSTS 0x000c0000 /* ENET: SBUS r/w burst mask */
111#define DMA_E_BURST32 0x00040000 /* ENET: SBUS 32 byte r/w burst */
112#define DMA_E_BURST16 0x00000000 /* ENET: SBUS 16 byte r/w burst */
113#define DMA_BRST_SZ 0x000c0000 /* SCSI: SBUS r/w burst size */
114#define DMA_BRST64 0x000c0000 /* SCSI: 64byte bursts (HME on UltraSparc only) */
115#define DMA_BRST32 0x00040000 /* SCSI: 32byte bursts */
116#define DMA_BRST16 0x00000000 /* SCSI: 16byte bursts */
117#define DMA_BRST0 0x00080000 /* SCSI: no bursts (non-HME gate arrays) */
118#define DMA_ADDR_DISAB 0x00100000 /* No FIFO drains during addr */
119#define DMA_2CLKS 0x00200000 /* Each transfer = 2 clock ticks */
120#define DMA_3CLKS 0x00400000 /* Each transfer = 3 clock ticks */
121#define DMA_EN_ENETAUI DMA_3CLKS /* Put lance into AUI-cable mode */
122#define DMA_CNTR_DISAB 0x00800000 /* No IRQ when DMA_TERM_CNTR set */
123#define DMA_AUTO_NADDR 0x01000000 /* Use "auto nxt addr" feature */
124#define DMA_SCSI_ON 0x02000000 /* Enable SCSI dma */
125#define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */
126#define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */
127#define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */
128#define DMA_RESET_FAS366 0x08000000 /* HME: Assert RESET to FAS366 */
129
130/* Values describing the burst-size property from the PROM */
131#define DMA_BURST1 0x01
132#define DMA_BURST2 0x02
133#define DMA_BURST4 0x04
134#define DMA_BURST8 0x08
135#define DMA_BURST16 0x10
136#define DMA_BURST32 0x20
137#define DMA_BURST64 0x40
138#define DMA_BURSTBITS 0x7f
139
140/* Determine highest possible final transfer address given a base */
141#define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL))
142
143/* Yes, I hack a lot of elisp in my spare time... */
144#define DMA_ERROR_P(regs) ((sbus_readl((regs) + DMA_CSR) & DMA_HNDL_ERROR))
145#define DMA_IRQ_P(regs) ((sbus_readl((regs) + DMA_CSR)) & (DMA_HNDL_INTR | DMA_HNDL_ERROR))
146#define DMA_WRITE_P(regs) ((sbus_readl((regs) + DMA_CSR) & DMA_ST_WRITE))
147#define DMA_OFF(__regs) \
148do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
149 tmp &= ~DMA_ENABLE; \
150 sbus_writel(tmp, (__regs) + DMA_CSR); \
151} while(0)
152#define DMA_INTSOFF(__regs) \
153do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
154 tmp &= ~DMA_INT_ENAB; \
155 sbus_writel(tmp, (__regs) + DMA_CSR); \
156} while(0)
157#define DMA_INTSON(__regs) \
158do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
159 tmp |= DMA_INT_ENAB; \
160 sbus_writel(tmp, (__regs) + DMA_CSR); \
161} while(0)
162#define DMA_PUNTFIFO(__regs) \
163do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
164 tmp |= DMA_FIFO_INV; \
165 sbus_writel(tmp, (__regs) + DMA_CSR); \
166} while(0)
167#define DMA_SETSTART(__regs, __addr) \
168 sbus_writel((u32)(__addr), (__regs) + DMA_ADDR);
169#define DMA_BEGINDMA_W(__regs) \
170do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
171 tmp |= (DMA_ST_WRITE|DMA_ENABLE|DMA_INT_ENAB); \
172 sbus_writel(tmp, (__regs) + DMA_CSR); \
173} while(0)
174#define DMA_BEGINDMA_R(__regs) \
175do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
176 tmp |= (DMA_ENABLE|DMA_INT_ENAB); \
177 tmp &= ~DMA_ST_WRITE; \
178 sbus_writel(tmp, (__regs) + DMA_CSR); \
179} while(0)
180
181/* For certain DMA chips, we need to disable ints upon irq entry
182 * and turn them back on when we are done. So in any ESP interrupt
183 * handler you *must* call DMA_IRQ_ENTRY upon entry and DMA_IRQ_EXIT
184 * when leaving the handler. You have been warned...
185 */
186#define DMA_IRQ_ENTRY(dma, dregs) do { \
187 if(DMA_ISBROKEN(dma)) DMA_INTSOFF(dregs); \
188 } while (0)
189
190#define DMA_IRQ_EXIT(dma, dregs) do { \
191 if(DMA_ISBROKEN(dma)) DMA_INTSON(dregs); \
192 } while(0)
193
194#define for_each_dvma(dma) \
195 for((dma) = dma_chain; (dma); (dma) = (dma)->next)
196
197/* From PCI */
198
199#ifdef CONFIG_PCI
200extern int isa_dma_bridge_buggy;
201#else
202#define isa_dma_bridge_buggy (0)
203#endif
204
205#endif /* !(_ASM_SPARC64_DMA_H) */
diff --git a/arch/sparc/include/asm/ebus.h b/arch/sparc/include/asm/ebus.h
new file mode 100644
index 000000000000..83a6d16c22e6
--- /dev/null
+++ b/arch/sparc/include/asm/ebus.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_EBUS_H
2#define ___ASM_SPARC_EBUS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/ebus_64.h>
5#else
6#include <asm/ebus_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/ebus_32.h b/arch/sparc/include/asm/ebus_32.h
index 29cb7dfc6b79..29cb7dfc6b79 100644
--- a/include/asm-sparc/ebus_32.h
+++ b/arch/sparc/include/asm/ebus_32.h
diff --git a/include/asm-sparc/ebus_64.h b/arch/sparc/include/asm/ebus_64.h
index fcc62b97ced5..fcc62b97ced5 100644
--- a/include/asm-sparc/ebus_64.h
+++ b/arch/sparc/include/asm/ebus_64.h
diff --git a/include/asm-sparc/ecc.h b/arch/sparc/include/asm/ecc.h
index ccb84b66fef1..ccb84b66fef1 100644
--- a/include/asm-sparc/ecc.h
+++ b/arch/sparc/include/asm/ecc.h
diff --git a/include/asm-sparc/eeprom.h b/arch/sparc/include/asm/eeprom.h
index e17beeceb405..e17beeceb405 100644
--- a/include/asm-sparc/eeprom.h
+++ b/arch/sparc/include/asm/eeprom.h
diff --git a/arch/sparc/include/asm/elf.h b/arch/sparc/include/asm/elf.h
new file mode 100644
index 000000000000..0a2816c50b07
--- /dev/null
+++ b/arch/sparc/include/asm/elf.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_ELF_H
2#define ___ASM_SPARC_ELF_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/elf_64.h>
5#else
6#include <asm/elf_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/elf_32.h b/arch/sparc/include/asm/elf_32.h
index d043f80bc2fd..d043f80bc2fd 100644
--- a/include/asm-sparc/elf_32.h
+++ b/arch/sparc/include/asm/elf_32.h
diff --git a/include/asm-sparc/elf_64.h b/arch/sparc/include/asm/elf_64.h
index 0818a1308f4e..0818a1308f4e 100644
--- a/include/asm-sparc/elf_64.h
+++ b/arch/sparc/include/asm/elf_64.h
diff --git a/include/asm-sparc/emergency-restart.h b/arch/sparc/include/asm/emergency-restart.h
index 108d8c48e42e..108d8c48e42e 100644
--- a/include/asm-sparc/emergency-restart.h
+++ b/arch/sparc/include/asm/emergency-restart.h
diff --git a/include/asm-sparc/envctrl.h b/arch/sparc/include/asm/envctrl.h
index 624fa7e2da8e..624fa7e2da8e 100644
--- a/include/asm-sparc/envctrl.h
+++ b/arch/sparc/include/asm/envctrl.h
diff --git a/include/asm-sparc/errno.h b/arch/sparc/include/asm/errno.h
index a9ef172977de..a9ef172977de 100644
--- a/include/asm-sparc/errno.h
+++ b/arch/sparc/include/asm/errno.h
diff --git a/include/asm-sparc/estate.h b/arch/sparc/include/asm/estate.h
index 520c08560d1b..520c08560d1b 100644
--- a/include/asm-sparc/estate.h
+++ b/arch/sparc/include/asm/estate.h
diff --git a/include/asm-sparc/fb.h b/arch/sparc/include/asm/fb.h
index b83e44729655..b83e44729655 100644
--- a/include/asm-sparc/fb.h
+++ b/arch/sparc/include/asm/fb.h
diff --git a/include/asm-sparc/fbio.h b/arch/sparc/include/asm/fbio.h
index b9215a0907d3..b9215a0907d3 100644
--- a/include/asm-sparc/fbio.h
+++ b/arch/sparc/include/asm/fbio.h
diff --git a/include/asm-sparc/fcntl.h b/arch/sparc/include/asm/fcntl.h
index d4d9c9d852c3..d4d9c9d852c3 100644
--- a/include/asm-sparc/fcntl.h
+++ b/arch/sparc/include/asm/fcntl.h
diff --git a/include/asm-sparc/fhc.h b/arch/sparc/include/asm/fhc.h
index 788cbc46a116..788cbc46a116 100644
--- a/include/asm-sparc/fhc.h
+++ b/arch/sparc/include/asm/fhc.h
diff --git a/include/asm-sparc/fixmap.h b/arch/sparc/include/asm/fixmap.h
index f18fc0755adf..f18fc0755adf 100644
--- a/include/asm-sparc/fixmap.h
+++ b/arch/sparc/include/asm/fixmap.h
diff --git a/arch/sparc/include/asm/floppy.h b/arch/sparc/include/asm/floppy.h
new file mode 100644
index 000000000000..faebd335b600
--- /dev/null
+++ b/arch/sparc/include/asm/floppy.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_FLOPPY_H
2#define ___ASM_SPARC_FLOPPY_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/floppy_64.h>
5#else
6#include <asm/floppy_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h
new file mode 100644
index 000000000000..ae3f00bf22ff
--- /dev/null
+++ b/arch/sparc/include/asm/floppy_32.h
@@ -0,0 +1,388 @@
1/* asm/floppy.h: Sparc specific parts of the Floppy driver.
2 *
3 * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
4 */
5
6#ifndef __ASM_SPARC_FLOPPY_H
7#define __ASM_SPARC_FLOPPY_H
8
9#include <asm/page.h>
10#include <asm/pgtable.h>
11#include <asm/system.h>
12#include <asm/idprom.h>
13#include <asm/machines.h>
14#include <asm/oplib.h>
15#include <asm/auxio.h>
16#include <asm/irq.h>
17
18/* We don't need no stinkin' I/O port allocation crap. */
19#undef release_region
20#undef request_region
21#define release_region(X, Y) do { } while(0)
22#define request_region(X, Y, Z) (1)
23
24/* References:
25 * 1) Netbsd Sun floppy driver.
26 * 2) NCR 82077 controller manual
27 * 3) Intel 82077 controller manual
28 */
29struct sun_flpy_controller {
30 volatile unsigned char status_82072; /* Main Status reg. */
31#define dcr_82072 status_82072 /* Digital Control reg. */
32#define status1_82077 status_82072 /* Auxiliary Status reg. 1 */
33
34 volatile unsigned char data_82072; /* Data fifo. */
35#define status2_82077 data_82072 /* Auxiliary Status reg. 2 */
36
37 volatile unsigned char dor_82077; /* Digital Output reg. */
38 volatile unsigned char tapectl_82077; /* What the? Tape control reg? */
39
40 volatile unsigned char status_82077; /* Main Status Register. */
41#define drs_82077 status_82077 /* Digital Rate Select reg. */
42
43 volatile unsigned char data_82077; /* Data fifo. */
44 volatile unsigned char ___unused;
45 volatile unsigned char dir_82077; /* Digital Input reg. */
46#define dcr_82077 dir_82077 /* Config Control reg. */
47};
48
49/* You'll only ever find one controller on a SparcStation anyways. */
50static struct sun_flpy_controller *sun_fdc = NULL;
51extern volatile unsigned char *fdc_status;
52
53struct sun_floppy_ops {
54 unsigned char (*fd_inb)(int port);
55 void (*fd_outb)(unsigned char value, int port);
56};
57
58static struct sun_floppy_ops sun_fdops;
59
60#define fd_inb(port) sun_fdops.fd_inb(port)
61#define fd_outb(value,port) sun_fdops.fd_outb(value,port)
62#define fd_enable_dma() sun_fd_enable_dma()
63#define fd_disable_dma() sun_fd_disable_dma()
64#define fd_request_dma() (0) /* nothing... */
65#define fd_free_dma() /* nothing... */
66#define fd_clear_dma_ff() /* nothing... */
67#define fd_set_dma_mode(mode) sun_fd_set_dma_mode(mode)
68#define fd_set_dma_addr(addr) sun_fd_set_dma_addr(addr)
69#define fd_set_dma_count(count) sun_fd_set_dma_count(count)
70#define fd_enable_irq() /* nothing... */
71#define fd_disable_irq() /* nothing... */
72#define fd_cacheflush(addr, size) /* nothing... */
73#define fd_request_irq() sun_fd_request_irq()
74#define fd_free_irq() /* nothing... */
75#if 0 /* P3: added by Alain, these cause a MMU corruption. 19960524 XXX */
76#define fd_dma_mem_alloc(size) ((unsigned long) vmalloc(size))
77#define fd_dma_mem_free(addr,size) (vfree((void *)(addr)))
78#endif
79
80/* XXX This isn't really correct. XXX */
81#define get_dma_residue(x) (0)
82
83#define FLOPPY0_TYPE 4
84#define FLOPPY1_TYPE 0
85
86/* Super paranoid... */
87#undef HAVE_DISABLE_HLT
88
89/* Here is where we catch the floppy driver trying to initialize,
90 * therefore this is where we call the PROM device tree probing
91 * routine etc. on the Sparc.
92 */
93#define FDC1 sun_floppy_init()
94
95#define N_FDC 1
96#define N_DRIVE 8
97
98/* No 64k boundary crossing problems on the Sparc. */
99#define CROSS_64KB(a,s) (0)
100
101/* Routines unique to each controller type on a Sun. */
102static void sun_set_dor(unsigned char value, int fdc_82077)
103{
104 if (sparc_cpu_model == sun4c) {
105 unsigned int bits = 0;
106 if (value & 0x10)
107 bits |= AUXIO_FLPY_DSEL;
108 if ((value & 0x80) == 0)
109 bits |= AUXIO_FLPY_EJCT;
110 set_auxio(bits, (~bits) & (AUXIO_FLPY_DSEL|AUXIO_FLPY_EJCT));
111 }
112 if (fdc_82077) {
113 sun_fdc->dor_82077 = value;
114 }
115}
116
117static unsigned char sun_read_dir(void)
118{
119 if (sparc_cpu_model == sun4c)
120 return (get_auxio() & AUXIO_FLPY_DCHG) ? 0x80 : 0;
121 else
122 return sun_fdc->dir_82077;
123}
124
125static unsigned char sun_82072_fd_inb(int port)
126{
127 udelay(5);
128 switch(port & 7) {
129 default:
130 printk("floppy: Asked to read unknown port %d\n", port);
131 panic("floppy: Port bolixed.");
132 case 4: /* FD_STATUS */
133 return sun_fdc->status_82072 & ~STATUS_DMA;
134 case 5: /* FD_DATA */
135 return sun_fdc->data_82072;
136 case 7: /* FD_DIR */
137 return sun_read_dir();
138 };
139 panic("sun_82072_fd_inb: How did I get here?");
140}
141
142static void sun_82072_fd_outb(unsigned char value, int port)
143{
144 udelay(5);
145 switch(port & 7) {
146 default:
147 printk("floppy: Asked to write to unknown port %d\n", port);
148 panic("floppy: Port bolixed.");
149 case 2: /* FD_DOR */
150 sun_set_dor(value, 0);
151 break;
152 case 5: /* FD_DATA */
153 sun_fdc->data_82072 = value;
154 break;
155 case 7: /* FD_DCR */
156 sun_fdc->dcr_82072 = value;
157 break;
158 case 4: /* FD_STATUS */
159 sun_fdc->status_82072 = value;
160 break;
161 };
162 return;
163}
164
165static unsigned char sun_82077_fd_inb(int port)
166{
167 udelay(5);
168 switch(port & 7) {
169 default:
170 printk("floppy: Asked to read unknown port %d\n", port);
171 panic("floppy: Port bolixed.");
172 case 0: /* FD_STATUS_0 */
173 return sun_fdc->status1_82077;
174 case 1: /* FD_STATUS_1 */
175 return sun_fdc->status2_82077;
176 case 2: /* FD_DOR */
177 return sun_fdc->dor_82077;
178 case 3: /* FD_TDR */
179 return sun_fdc->tapectl_82077;
180 case 4: /* FD_STATUS */
181 return sun_fdc->status_82077 & ~STATUS_DMA;
182 case 5: /* FD_DATA */
183 return sun_fdc->data_82077;
184 case 7: /* FD_DIR */
185 return sun_read_dir();
186 };
187 panic("sun_82077_fd_inb: How did I get here?");
188}
189
190static void sun_82077_fd_outb(unsigned char value, int port)
191{
192 udelay(5);
193 switch(port & 7) {
194 default:
195 printk("floppy: Asked to write to unknown port %d\n", port);
196 panic("floppy: Port bolixed.");
197 case 2: /* FD_DOR */
198 sun_set_dor(value, 1);
199 break;
200 case 5: /* FD_DATA */
201 sun_fdc->data_82077 = value;
202 break;
203 case 7: /* FD_DCR */
204 sun_fdc->dcr_82077 = value;
205 break;
206 case 4: /* FD_STATUS */
207 sun_fdc->status_82077 = value;
208 break;
209 case 3: /* FD_TDR */
210 sun_fdc->tapectl_82077 = value;
211 break;
212 };
213 return;
214}
215
216/* For pseudo-dma (Sun floppy drives have no real DMA available to
217 * them so we must eat the data fifo bytes directly ourselves) we have
218 * three state variables. doing_pdma tells our inline low-level
219 * assembly floppy interrupt entry point whether it should sit and eat
220 * bytes from the fifo or just transfer control up to the higher level
221 * floppy interrupt c-code. I tried very hard but I could not get the
222 * pseudo-dma to work in c-code without getting many overruns and
223 * underruns. If non-zero, doing_pdma encodes the direction of
224 * the transfer for debugging. 1=read 2=write
225 */
226extern char *pdma_vaddr;
227extern unsigned long pdma_size;
228extern volatile int doing_pdma;
229
230/* This is software state */
231extern char *pdma_base;
232extern unsigned long pdma_areasize;
233
234/* Common routines to all controller types on the Sparc. */
235static inline void virtual_dma_init(void)
236{
237 /* nothing... */
238}
239
240static inline void sun_fd_disable_dma(void)
241{
242 doing_pdma = 0;
243 if (pdma_base) {
244 mmu_unlockarea(pdma_base, pdma_areasize);
245 pdma_base = NULL;
246 }
247}
248
249static inline void sun_fd_set_dma_mode(int mode)
250{
251 switch(mode) {
252 case DMA_MODE_READ:
253 doing_pdma = 1;
254 break;
255 case DMA_MODE_WRITE:
256 doing_pdma = 2;
257 break;
258 default:
259 printk("Unknown dma mode %d\n", mode);
260 panic("floppy: Giving up...");
261 }
262}
263
264static inline void sun_fd_set_dma_addr(char *buffer)
265{
266 pdma_vaddr = buffer;
267}
268
269static inline void sun_fd_set_dma_count(int length)
270{
271 pdma_size = length;
272}
273
274static inline void sun_fd_enable_dma(void)
275{
276 pdma_vaddr = mmu_lockarea(pdma_vaddr, pdma_size);
277 pdma_base = pdma_vaddr;
278 pdma_areasize = pdma_size;
279}
280
281/* Our low-level entry point in arch/sparc/kernel/entry.S */
282extern int sparc_floppy_request_irq(int irq, unsigned long flags,
283 irq_handler_t irq_handler);
284
285static int sun_fd_request_irq(void)
286{
287 static int once = 0;
288 int error;
289
290 if(!once) {
291 once = 1;
292 error = sparc_floppy_request_irq(FLOPPY_IRQ,
293 IRQF_DISABLED,
294 floppy_interrupt);
295 return ((error == 0) ? 0 : -1);
296 } else return 0;
297}
298
299static struct linux_prom_registers fd_regs[2];
300
301static int sun_floppy_init(void)
302{
303 char state[128];
304 int tnode, fd_node, num_regs;
305 struct resource r;
306
307 use_virtual_dma = 1;
308
309 FLOPPY_IRQ = 11;
310 /* Forget it if we aren't on a machine that could possibly
311 * ever have a floppy drive.
312 */
313 if((sparc_cpu_model != sun4c && sparc_cpu_model != sun4m) ||
314 ((idprom->id_machtype == (SM_SUN4C | SM_4C_SLC)) ||
315 (idprom->id_machtype == (SM_SUN4C | SM_4C_ELC)))) {
316 /* We certainly don't have a floppy controller. */
317 goto no_sun_fdc;
318 }
319 /* Well, try to find one. */
320 tnode = prom_getchild(prom_root_node);
321 fd_node = prom_searchsiblings(tnode, "obio");
322 if(fd_node != 0) {
323 tnode = prom_getchild(fd_node);
324 fd_node = prom_searchsiblings(tnode, "SUNW,fdtwo");
325 } else {
326 fd_node = prom_searchsiblings(tnode, "fd");
327 }
328 if(fd_node == 0) {
329 goto no_sun_fdc;
330 }
331
332 /* The sun4m lets us know if the controller is actually usable. */
333 if(sparc_cpu_model == sun4m &&
334 prom_getproperty(fd_node, "status", state, sizeof(state)) != -1) {
335 if(!strcmp(state, "disabled")) {
336 goto no_sun_fdc;
337 }
338 }
339 num_regs = prom_getproperty(fd_node, "reg", (char *) fd_regs, sizeof(fd_regs));
340 num_regs = (num_regs / sizeof(fd_regs[0]));
341 prom_apply_obio_ranges(fd_regs, num_regs);
342 memset(&r, 0, sizeof(r));
343 r.flags = fd_regs[0].which_io;
344 r.start = fd_regs[0].phys_addr;
345 sun_fdc = (struct sun_flpy_controller *)
346 sbus_ioremap(&r, 0, fd_regs[0].reg_size, "floppy");
347
348 /* Last minute sanity check... */
349 if(sun_fdc->status_82072 == 0xff) {
350 sun_fdc = NULL;
351 goto no_sun_fdc;
352 }
353
354 sun_fdops.fd_inb = sun_82077_fd_inb;
355 sun_fdops.fd_outb = sun_82077_fd_outb;
356 fdc_status = &sun_fdc->status_82077;
357
358 if (sun_fdc->dor_82077 == 0x80) {
359 sun_fdc->dor_82077 = 0x02;
360 if (sun_fdc->dor_82077 == 0x80) {
361 sun_fdops.fd_inb = sun_82072_fd_inb;
362 sun_fdops.fd_outb = sun_82072_fd_outb;
363 fdc_status = &sun_fdc->status_82072;
364 }
365 }
366
367 /* Success... */
368 allowed_drive_mask = 0x01;
369 return (int) sun_fdc;
370
371no_sun_fdc:
372 return -1;
373}
374
375static int sparc_eject(void)
376{
377 set_dor(0x00, 0xff, 0x90);
378 udelay(500);
379 set_dor(0x00, 0x6f, 0x00);
380 udelay(500);
381 return 0;
382}
383
384#define fd_eject(drive) sparc_eject()
385
386#define EXTRA_FLOPPY_PARAMS
387
388#endif /* !(__ASM_SPARC_FLOPPY_H) */
diff --git a/include/asm-sparc/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index c39db1060bc7..c39db1060bc7 100644
--- a/include/asm-sparc/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
diff --git a/include/asm-sparc/fpumacro.h b/arch/sparc/include/asm/fpumacro.h
index cc463fec806f..cc463fec806f 100644
--- a/include/asm-sparc/fpumacro.h
+++ b/arch/sparc/include/asm/fpumacro.h
diff --git a/include/asm-sparc64/ftrace.h b/arch/sparc/include/asm/ftrace.h
index d27716cd38c1..d27716cd38c1 100644
--- a/include/asm-sparc64/ftrace.h
+++ b/arch/sparc/include/asm/ftrace.h
diff --git a/arch/sparc/include/asm/futex.h b/arch/sparc/include/asm/futex.h
new file mode 100644
index 000000000000..736335f36713
--- /dev/null
+++ b/arch/sparc/include/asm/futex.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_FUTEX_H
2#define ___ASM_SPARC_FUTEX_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/futex_64.h>
5#else
6#include <asm/futex_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/futex_32.h b/arch/sparc/include/asm/futex_32.h
index 6a332a9f099c..6a332a9f099c 100644
--- a/include/asm-sparc/futex_32.h
+++ b/arch/sparc/include/asm/futex_32.h
diff --git a/include/asm-sparc/futex_64.h b/arch/sparc/include/asm/futex_64.h
index d8378935ae90..d8378935ae90 100644
--- a/include/asm-sparc/futex_64.h
+++ b/arch/sparc/include/asm/futex_64.h
diff --git a/arch/sparc/include/asm/hardirq.h b/arch/sparc/include/asm/hardirq.h
new file mode 100644
index 000000000000..44d4e2345148
--- /dev/null
+++ b/arch/sparc/include/asm/hardirq.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_HARDIRQ_H
2#define ___ASM_SPARC_HARDIRQ_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/hardirq_64.h>
5#else
6#include <asm/hardirq_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/hardirq_32.h b/arch/sparc/include/asm/hardirq_32.h
index 4f63ed8df551..4f63ed8df551 100644
--- a/include/asm-sparc/hardirq_32.h
+++ b/arch/sparc/include/asm/hardirq_32.h
diff --git a/include/asm-sparc/hardirq_64.h b/arch/sparc/include/asm/hardirq_64.h
index 7c29fd1a87aa..7c29fd1a87aa 100644
--- a/include/asm-sparc/hardirq_64.h
+++ b/arch/sparc/include/asm/hardirq_64.h
diff --git a/arch/sparc/include/asm/head.h b/arch/sparc/include/asm/head.h
new file mode 100644
index 000000000000..be8f03f3e731
--- /dev/null
+++ b/arch/sparc/include/asm/head.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_HEAD_H
2#define ___ASM_SPARC_HEAD_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/head_64.h>
5#else
6#include <asm/head_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/head_32.h b/arch/sparc/include/asm/head_32.h
index 7c35491a8b53..7c35491a8b53 100644
--- a/include/asm-sparc/head_32.h
+++ b/arch/sparc/include/asm/head_32.h
diff --git a/include/asm-sparc/head_64.h b/arch/sparc/include/asm/head_64.h
index 10e9dabc4c41..10e9dabc4c41 100644
--- a/include/asm-sparc/head_64.h
+++ b/arch/sparc/include/asm/head_64.h
diff --git a/include/asm-sparc/highmem.h b/arch/sparc/include/asm/highmem.h
index 3de42e776274..3de42e776274 100644
--- a/include/asm-sparc/highmem.h
+++ b/arch/sparc/include/asm/highmem.h
diff --git a/include/asm-sparc/hugetlb.h b/arch/sparc/include/asm/hugetlb.h
index 177061064ee6..177061064ee6 100644
--- a/include/asm-sparc/hugetlb.h
+++ b/arch/sparc/include/asm/hugetlb.h
diff --git a/include/asm-sparc/hvtramp.h b/arch/sparc/include/asm/hvtramp.h
index b2b9b947b3a4..b2b9b947b3a4 100644
--- a/include/asm-sparc/hvtramp.h
+++ b/arch/sparc/include/asm/hvtramp.h
diff --git a/include/asm-sparc/hw_irq.h b/arch/sparc/include/asm/hw_irq.h
index 8d30a7694be2..8d30a7694be2 100644
--- a/include/asm-sparc/hw_irq.h
+++ b/arch/sparc/include/asm/hw_irq.h
diff --git a/include/asm-sparc/hypervisor.h b/arch/sparc/include/asm/hypervisor.h
index 109ae24ba242..109ae24ba242 100644
--- a/include/asm-sparc/hypervisor.h
+++ b/arch/sparc/include/asm/hypervisor.h
diff --git a/include/asm-sparc/ide.h b/arch/sparc/include/asm/ide.h
index b7af3d658239..b7af3d658239 100644
--- a/include/asm-sparc/ide.h
+++ b/arch/sparc/include/asm/ide.h
diff --git a/include/asm-sparc/idprom.h b/arch/sparc/include/asm/idprom.h
index 6976aa2439c6..6976aa2439c6 100644
--- a/include/asm-sparc/idprom.h
+++ b/arch/sparc/include/asm/idprom.h
diff --git a/include/asm-sparc/intr_queue.h b/arch/sparc/include/asm/intr_queue.h
index 206077dedc2a..206077dedc2a 100644
--- a/include/asm-sparc/intr_queue.h
+++ b/arch/sparc/include/asm/intr_queue.h
diff --git a/include/asm-sparc/io-unit.h b/arch/sparc/include/asm/io-unit.h
index 96823b47fd45..96823b47fd45 100644
--- a/include/asm-sparc/io-unit.h
+++ b/arch/sparc/include/asm/io-unit.h
diff --git a/arch/sparc/include/asm/io.h b/arch/sparc/include/asm/io.h
new file mode 100644
index 000000000000..a34b2994937a
--- /dev/null
+++ b/arch/sparc/include/asm/io.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_IO_H
2#define ___ASM_SPARC_IO_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/io_64.h>
5#else
6#include <asm/io_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/io_32.h b/arch/sparc/include/asm/io_32.h
index 10d7da450070..10d7da450070 100644
--- a/include/asm-sparc/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
diff --git a/include/asm-sparc/io_64.h b/arch/sparc/include/asm/io_64.h
index 0bff078ffdd0..0bff078ffdd0 100644
--- a/include/asm-sparc/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
diff --git a/include/asm-sparc/ioctl.h b/arch/sparc/include/asm/ioctl.h
index 7d6bd51321b9..7d6bd51321b9 100644
--- a/include/asm-sparc/ioctl.h
+++ b/arch/sparc/include/asm/ioctl.h
diff --git a/include/asm-sparc/ioctls.h b/arch/sparc/include/asm/ioctls.h
index 1fe6855c5c18..1fe6855c5c18 100644
--- a/include/asm-sparc/ioctls.h
+++ b/arch/sparc/include/asm/ioctls.h
diff --git a/arch/sparc/include/asm/iommu.h b/arch/sparc/include/asm/iommu.h
new file mode 100644
index 000000000000..e650965b4a8d
--- /dev/null
+++ b/arch/sparc/include/asm/iommu.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_IOMMU_H
2#define ___ASM_SPARC_IOMMU_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/iommu_64.h>
5#else
6#include <asm/iommu_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/iommu_32.h b/arch/sparc/include/asm/iommu_32.h
index 70c589c05a10..70c589c05a10 100644
--- a/include/asm-sparc/iommu_32.h
+++ b/arch/sparc/include/asm/iommu_32.h
diff --git a/include/asm-sparc/iommu_64.h b/arch/sparc/include/asm/iommu_64.h
index d7b9afcba08b..d7b9afcba08b 100644
--- a/include/asm-sparc/iommu_64.h
+++ b/arch/sparc/include/asm/iommu_64.h
diff --git a/arch/sparc/include/asm/ipcbuf.h b/arch/sparc/include/asm/ipcbuf.h
new file mode 100644
index 000000000000..17d6ef7b23a4
--- /dev/null
+++ b/arch/sparc/include/asm/ipcbuf.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_IPCBUF_H
2#define ___ASM_SPARC_IPCBUF_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/ipcbuf_64.h>
5#else
6#include <asm/ipcbuf_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/ipcbuf_32.h b/arch/sparc/include/asm/ipcbuf_32.h
index 6387209518f2..6387209518f2 100644
--- a/include/asm-sparc/ipcbuf_32.h
+++ b/arch/sparc/include/asm/ipcbuf_32.h
diff --git a/include/asm-sparc/ipcbuf_64.h b/arch/sparc/include/asm/ipcbuf_64.h
index a44b855b98db..a44b855b98db 100644
--- a/include/asm-sparc/ipcbuf_64.h
+++ b/arch/sparc/include/asm/ipcbuf_64.h
diff --git a/arch/sparc/include/asm/irq.h b/arch/sparc/include/asm/irq.h
new file mode 100644
index 000000000000..3b44a6a14074
--- /dev/null
+++ b/arch/sparc/include/asm/irq.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_IRQ_H
2#define ___ASM_SPARC_IRQ_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/irq_64.h>
5#else
6#include <asm/irq_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/irq_32.h b/arch/sparc/include/asm/irq_32.h
index fe205cc444b8..fe205cc444b8 100644
--- a/include/asm-sparc/irq_32.h
+++ b/arch/sparc/include/asm/irq_32.h
diff --git a/include/asm-sparc/irq_64.h b/arch/sparc/include/asm/irq_64.h
index 0bb9bf531745..0bb9bf531745 100644
--- a/include/asm-sparc/irq_64.h
+++ b/arch/sparc/include/asm/irq_64.h
diff --git a/include/asm-sparc/irq_regs.h b/arch/sparc/include/asm/irq_regs.h
index 3dd9c0b70270..3dd9c0b70270 100644
--- a/include/asm-sparc/irq_regs.h
+++ b/arch/sparc/include/asm/irq_regs.h
diff --git a/arch/sparc/include/asm/irqflags.h b/arch/sparc/include/asm/irqflags.h
new file mode 100644
index 000000000000..1e138632bd3f
--- /dev/null
+++ b/arch/sparc/include/asm/irqflags.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_IRQFLAGS_H
2#define ___ASM_SPARC_IRQFLAGS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/irqflags_64.h>
5#else
6#include <asm/irqflags_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/irqflags_32.h b/arch/sparc/include/asm/irqflags_32.h
new file mode 100644
index 000000000000..0fca9d97d44f
--- /dev/null
+++ b/arch/sparc/include/asm/irqflags_32.h
@@ -0,0 +1,39 @@
1/*
2 * include/asm/irqflags.h
3 *
4 * IRQ flags handling
5 *
6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers.
9 */
10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H
12
13#ifndef __ASSEMBLY__
14
15extern void raw_local_irq_restore(unsigned long);
16extern unsigned long __raw_local_irq_save(void);
17extern void raw_local_irq_enable(void);
18
19static inline unsigned long getipl(void)
20{
21 unsigned long retval;
22
23 __asm__ __volatile__("rd %%psr, %0" : "=r" (retval));
24 return retval;
25}
26
27#define raw_local_save_flags(flags) ((flags) = getipl())
28#define raw_local_irq_save(flags) ((flags) = __raw_local_irq_save())
29#define raw_local_irq_disable() ((void) __raw_local_irq_save())
30#define raw_irqs_disabled() ((getipl() & PSR_PIL) != 0)
31
32static inline int raw_irqs_disabled_flags(unsigned long flags)
33{
34 return ((flags & PSR_PIL) != 0);
35}
36
37#endif /* (__ASSEMBLY__) */
38
39#endif /* !(_ASM_IRQFLAGS_H) */
diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h
new file mode 100644
index 000000000000..bb42e59162aa
--- /dev/null
+++ b/arch/sparc/include/asm/irqflags_64.h
@@ -0,0 +1,89 @@
1/*
2 * include/asm/irqflags.h
3 *
4 * IRQ flags handling
5 *
6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers.
9 */
10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H
12
13#ifndef __ASSEMBLY__
14
15static inline unsigned long __raw_local_save_flags(void)
16{
17 unsigned long flags;
18
19 __asm__ __volatile__(
20 "rdpr %%pil, %0"
21 : "=r" (flags)
22 );
23
24 return flags;
25}
26
27#define raw_local_save_flags(flags) \
28 do { (flags) = __raw_local_save_flags(); } while (0)
29
30static inline void raw_local_irq_restore(unsigned long flags)
31{
32 __asm__ __volatile__(
33 "wrpr %0, %%pil"
34 : /* no output */
35 : "r" (flags)
36 : "memory"
37 );
38}
39
40static inline void raw_local_irq_disable(void)
41{
42 __asm__ __volatile__(
43 "wrpr 15, %%pil"
44 : /* no outputs */
45 : /* no inputs */
46 : "memory"
47 );
48}
49
50static inline void raw_local_irq_enable(void)
51{
52 __asm__ __volatile__(
53 "wrpr 0, %%pil"
54 : /* no outputs */
55 : /* no inputs */
56 : "memory"
57 );
58}
59
60static inline int raw_irqs_disabled_flags(unsigned long flags)
61{
62 return (flags > 0);
63}
64
65static inline int raw_irqs_disabled(void)
66{
67 unsigned long flags = __raw_local_save_flags();
68
69 return raw_irqs_disabled_flags(flags);
70}
71
72/*
73 * For spinlocks, etc:
74 */
75static inline unsigned long __raw_local_irq_save(void)
76{
77 unsigned long flags = __raw_local_save_flags();
78
79 raw_local_irq_disable();
80
81 return flags;
82}
83
84#define raw_local_irq_save(flags) \
85 do { (flags) = __raw_local_irq_save(); } while (0)
86
87#endif /* (__ASSEMBLY__) */
88
89#endif /* !(_ASM_IRQFLAGS_H) */
diff --git a/include/asm-sparc/jsflash.h b/arch/sparc/include/asm/jsflash.h
index 3457f29bd73b..3457f29bd73b 100644
--- a/include/asm-sparc/jsflash.h
+++ b/arch/sparc/include/asm/jsflash.h
diff --git a/arch/sparc/include/asm/kdebug.h b/arch/sparc/include/asm/kdebug.h
new file mode 100644
index 000000000000..8d12581ca386
--- /dev/null
+++ b/arch/sparc/include/asm/kdebug.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_KDEBUG_H
2#define ___ASM_SPARC_KDEBUG_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/kdebug_64.h>
5#else
6#include <asm/kdebug_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/kdebug_32.h b/arch/sparc/include/asm/kdebug_32.h
index f69fe7d84b3c..f69fe7d84b3c 100644
--- a/include/asm-sparc/kdebug_32.h
+++ b/arch/sparc/include/asm/kdebug_32.h
diff --git a/include/asm-sparc/kdebug_64.h b/arch/sparc/include/asm/kdebug_64.h
index f905b773235a..f905b773235a 100644
--- a/include/asm-sparc/kdebug_64.h
+++ b/arch/sparc/include/asm/kdebug_64.h
diff --git a/include/asm-sparc/kgdb.h b/arch/sparc/include/asm/kgdb.h
index b6ef301d05bf..b6ef301d05bf 100644
--- a/include/asm-sparc/kgdb.h
+++ b/arch/sparc/include/asm/kgdb.h
diff --git a/include/asm-sparc/kmap_types.h b/arch/sparc/include/asm/kmap_types.h
index 602f5e034f7a..602f5e034f7a 100644
--- a/include/asm-sparc/kmap_types.h
+++ b/arch/sparc/include/asm/kmap_types.h
diff --git a/include/asm-sparc/kprobes.h b/arch/sparc/include/asm/kprobes.h
index 5879d71afdaa..5879d71afdaa 100644
--- a/include/asm-sparc/kprobes.h
+++ b/arch/sparc/include/asm/kprobes.h
diff --git a/include/asm-sparc/ldc.h b/arch/sparc/include/asm/ldc.h
index bdb524a7b814..bdb524a7b814 100644
--- a/include/asm-sparc/ldc.h
+++ b/arch/sparc/include/asm/ldc.h
diff --git a/include/asm-sparc/linkage.h b/arch/sparc/include/asm/linkage.h
index 291c2d01c44f..291c2d01c44f 100644
--- a/include/asm-sparc/linkage.h
+++ b/arch/sparc/include/asm/linkage.h
diff --git a/include/asm-sparc/lmb.h b/arch/sparc/include/asm/lmb.h
index 6a352cbcf520..6a352cbcf520 100644
--- a/include/asm-sparc/lmb.h
+++ b/arch/sparc/include/asm/lmb.h
diff --git a/include/asm-sparc/local.h b/arch/sparc/include/asm/local.h
index bc80815a435c..bc80815a435c 100644
--- a/include/asm-sparc/local.h
+++ b/arch/sparc/include/asm/local.h
diff --git a/include/asm-sparc/lsu.h b/arch/sparc/include/asm/lsu.h
index 7190f8de90a0..7190f8de90a0 100644
--- a/include/asm-sparc/lsu.h
+++ b/arch/sparc/include/asm/lsu.h
diff --git a/include/asm-sparc/machines.h b/arch/sparc/include/asm/machines.h
index c28c2f248794..c28c2f248794 100644
--- a/include/asm-sparc/machines.h
+++ b/arch/sparc/include/asm/machines.h
diff --git a/include/asm-sparc/mbus.h b/arch/sparc/include/asm/mbus.h
index 69f07a022ee6..69f07a022ee6 100644
--- a/include/asm-sparc/mbus.h
+++ b/arch/sparc/include/asm/mbus.h
diff --git a/arch/sparc/include/asm/mc146818rtc.h b/arch/sparc/include/asm/mc146818rtc.h
new file mode 100644
index 000000000000..67ed9e3a0235
--- /dev/null
+++ b/arch/sparc/include/asm/mc146818rtc.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_MC146818RTC_H
2#define ___ASM_SPARC_MC146818RTC_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/mc146818rtc_64.h>
5#else
6#include <asm/mc146818rtc_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/mc146818rtc_32.h b/arch/sparc/include/asm/mc146818rtc_32.h
index fa7eac926582..fa7eac926582 100644
--- a/include/asm-sparc/mc146818rtc_32.h
+++ b/arch/sparc/include/asm/mc146818rtc_32.h
diff --git a/include/asm-sparc/mc146818rtc_64.h b/arch/sparc/include/asm/mc146818rtc_64.h
index e9c0fcc25c6f..e9c0fcc25c6f 100644
--- a/include/asm-sparc/mc146818rtc_64.h
+++ b/arch/sparc/include/asm/mc146818rtc_64.h
diff --git a/include/asm-sparc/mdesc.h b/arch/sparc/include/asm/mdesc.h
index 1acc7272e537..1acc7272e537 100644
--- a/include/asm-sparc/mdesc.h
+++ b/arch/sparc/include/asm/mdesc.h
diff --git a/include/asm-sparc/memreg.h b/arch/sparc/include/asm/memreg.h
index 845ad2b39183..845ad2b39183 100644
--- a/include/asm-sparc/memreg.h
+++ b/arch/sparc/include/asm/memreg.h
diff --git a/include/asm-sparc/mman.h b/arch/sparc/include/asm/mman.h
index fdfbbf0a4736..fdfbbf0a4736 100644
--- a/include/asm-sparc/mman.h
+++ b/arch/sparc/include/asm/mman.h
diff --git a/arch/sparc/include/asm/mmu.h b/arch/sparc/include/asm/mmu.h
new file mode 100644
index 000000000000..88fa313887db
--- /dev/null
+++ b/arch/sparc/include/asm/mmu.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_MMU_H
2#define ___ASM_SPARC_MMU_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/mmu_64.h>
5#else
6#include <asm/mmu_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/mmu_32.h b/arch/sparc/include/asm/mmu_32.h
index ccd36d26615a..ccd36d26615a 100644
--- a/include/asm-sparc/mmu_32.h
+++ b/arch/sparc/include/asm/mmu_32.h
diff --git a/include/asm-sparc/mmu_64.h b/arch/sparc/include/asm/mmu_64.h
index 9067dc500535..9067dc500535 100644
--- a/include/asm-sparc/mmu_64.h
+++ b/arch/sparc/include/asm/mmu_64.h
diff --git a/arch/sparc/include/asm/mmu_context.h b/arch/sparc/include/asm/mmu_context.h
new file mode 100644
index 000000000000..5531346c64f9
--- /dev/null
+++ b/arch/sparc/include/asm/mmu_context.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_MMU_CONTEXT_H
2#define ___ASM_SPARC_MMU_CONTEXT_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/mmu_context_64.h>
5#else
6#include <asm/mmu_context_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/mmu_context_32.h b/arch/sparc/include/asm/mmu_context_32.h
index 671a997b9e69..671a997b9e69 100644
--- a/include/asm-sparc/mmu_context_32.h
+++ b/arch/sparc/include/asm/mmu_context_32.h
diff --git a/include/asm-sparc/mmu_context_64.h b/arch/sparc/include/asm/mmu_context_64.h
index 5693ab482606..5693ab482606 100644
--- a/include/asm-sparc/mmu_context_64.h
+++ b/arch/sparc/include/asm/mmu_context_64.h
diff --git a/include/asm-sparc/mmzone.h b/arch/sparc/include/asm/mmzone.h
index ebf5986c12ed..ebf5986c12ed 100644
--- a/include/asm-sparc/mmzone.h
+++ b/arch/sparc/include/asm/mmzone.h
diff --git a/arch/sparc/include/asm/module.h b/arch/sparc/include/asm/module.h
new file mode 100644
index 000000000000..e82cf9a3e60e
--- /dev/null
+++ b/arch/sparc/include/asm/module.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_MODULE_H
2#define ___ASM_SPARC_MODULE_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/module_64.h>
5#else
6#include <asm/module_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/module_32.h b/arch/sparc/include/asm/module_32.h
index cbd9e67b0c0b..cbd9e67b0c0b 100644
--- a/include/asm-sparc/module_32.h
+++ b/arch/sparc/include/asm/module_32.h
diff --git a/include/asm-sparc/module_64.h b/arch/sparc/include/asm/module_64.h
index 3d77ba465783..3d77ba465783 100644
--- a/include/asm-sparc/module_64.h
+++ b/arch/sparc/include/asm/module_64.h
diff --git a/arch/sparc/include/asm/mostek.h b/arch/sparc/include/asm/mostek.h
new file mode 100644
index 000000000000..433be3e0a69b
--- /dev/null
+++ b/arch/sparc/include/asm/mostek.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_MOSTEK_H
2#define ___ASM_SPARC_MOSTEK_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/mostek_64.h>
5#else
6#include <asm/mostek_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/mostek_32.h b/arch/sparc/include/asm/mostek_32.h
index a99590c4c507..a99590c4c507 100644
--- a/include/asm-sparc/mostek_32.h
+++ b/arch/sparc/include/asm/mostek_32.h
diff --git a/include/asm-sparc/mostek_64.h b/arch/sparc/include/asm/mostek_64.h
index c5652de2ace2..c5652de2ace2 100644
--- a/include/asm-sparc/mostek_64.h
+++ b/arch/sparc/include/asm/mostek_64.h
diff --git a/include/asm-sparc/mpmbox.h b/arch/sparc/include/asm/mpmbox.h
index f8423039b242..f8423039b242 100644
--- a/include/asm-sparc/mpmbox.h
+++ b/arch/sparc/include/asm/mpmbox.h
diff --git a/include/asm-sparc/msgbuf.h b/arch/sparc/include/asm/msgbuf.h
index efc7cbe9788f..efc7cbe9788f 100644
--- a/include/asm-sparc/msgbuf.h
+++ b/arch/sparc/include/asm/msgbuf.h
diff --git a/include/asm-sparc/msi.h b/arch/sparc/include/asm/msi.h
index 724ca5667052..724ca5667052 100644
--- a/include/asm-sparc/msi.h
+++ b/arch/sparc/include/asm/msi.h
diff --git a/include/asm-sparc/mutex.h b/arch/sparc/include/asm/mutex.h
index 458c1f7fbc18..458c1f7fbc18 100644
--- a/include/asm-sparc/mutex.h
+++ b/arch/sparc/include/asm/mutex.h
diff --git a/include/asm-sparc/mxcc.h b/arch/sparc/include/asm/mxcc.h
index c0517bd05bde..c0517bd05bde 100644
--- a/include/asm-sparc/mxcc.h
+++ b/arch/sparc/include/asm/mxcc.h
diff --git a/include/asm-sparc/ns87303.h b/arch/sparc/include/asm/ns87303.h
index 686defe6aaa0..686defe6aaa0 100644
--- a/include/asm-sparc/ns87303.h
+++ b/arch/sparc/include/asm/ns87303.h
diff --git a/include/asm-sparc/obio.h b/arch/sparc/include/asm/obio.h
index 1a7544ceb574..1a7544ceb574 100644
--- a/include/asm-sparc/obio.h
+++ b/arch/sparc/include/asm/obio.h
diff --git a/include/asm-sparc/of_device.h b/arch/sparc/include/asm/of_device.h
index e5f5aedc2293..e5f5aedc2293 100644
--- a/include/asm-sparc/of_device.h
+++ b/arch/sparc/include/asm/of_device.h
diff --git a/arch/sparc/include/asm/of_platform.h b/arch/sparc/include/asm/of_platform.h
new file mode 100644
index 000000000000..aa699775ffba
--- /dev/null
+++ b/arch/sparc/include/asm/of_platform.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_OF_PLATFORM_H
2#define ___ASM_SPARC_OF_PLATFORM_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/of_platform_64.h>
5#else
6#include <asm/of_platform_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/of_platform_32.h b/arch/sparc/include/asm/of_platform_32.h
new file mode 100644
index 000000000000..723f7c9b7411
--- /dev/null
+++ b/arch/sparc/include/asm/of_platform_32.h
@@ -0,0 +1,24 @@
1#ifndef _ASM_SPARC_OF_PLATFORM_H
2#define _ASM_SPARC_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 * Modified for Sparc by merging parts of asm/of_device.h
7 * by Stephen Rothwell
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
15
16/* This is just here during the transition */
17#include <linux/of_platform.h>
18
19extern struct bus_type ebus_bus_type;
20extern struct bus_type sbus_bus_type;
21
22#define of_bus_type of_platform_bus_type /* for compatibility */
23
24#endif /* _ASM_SPARC_OF_PLATFORM_H */
diff --git a/arch/sparc/include/asm/of_platform_64.h b/arch/sparc/include/asm/of_platform_64.h
new file mode 100644
index 000000000000..4f66a5f6342d
--- /dev/null
+++ b/arch/sparc/include/asm/of_platform_64.h
@@ -0,0 +1,25 @@
1#ifndef _ASM_SPARC64_OF_PLATFORM_H
2#define _ASM_SPARC64_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 * Modified for Sparc by merging parts of asm/of_device.h
7 * by Stephen Rothwell
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
15
16/* This is just here during the transition */
17#include <linux/of_platform.h>
18
19extern struct bus_type isa_bus_type;
20extern struct bus_type ebus_bus_type;
21extern struct bus_type sbus_bus_type;
22
23#define of_bus_type of_platform_bus_type /* for compatibility */
24
25#endif /* _ASM_SPARC64_OF_PLATFORM_H */
diff --git a/arch/sparc/include/asm/openprom.h b/arch/sparc/include/asm/openprom.h
new file mode 100644
index 000000000000..aaeae905ed3f
--- /dev/null
+++ b/arch/sparc/include/asm/openprom.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_OPENPROM_H
2#define ___ASM_SPARC_OPENPROM_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/openprom_64.h>
5#else
6#include <asm/openprom_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/openprom_32.h b/arch/sparc/include/asm/openprom_32.h
index 8b1649f29ed9..8b1649f29ed9 100644
--- a/include/asm-sparc/openprom_32.h
+++ b/arch/sparc/include/asm/openprom_32.h
diff --git a/include/asm-sparc/openprom_64.h b/arch/sparc/include/asm/openprom_64.h
index b69e4a8c9170..b69e4a8c9170 100644
--- a/include/asm-sparc/openprom_64.h
+++ b/arch/sparc/include/asm/openprom_64.h
diff --git a/include/asm-sparc/openpromio.h b/arch/sparc/include/asm/openpromio.h
index 917fb8e9c633..917fb8e9c633 100644
--- a/include/asm-sparc/openpromio.h
+++ b/arch/sparc/include/asm/openpromio.h
diff --git a/arch/sparc/include/asm/oplib.h b/arch/sparc/include/asm/oplib.h
new file mode 100644
index 000000000000..72e04e13a6b4
--- /dev/null
+++ b/arch/sparc/include/asm/oplib.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_OPLIB_H
2#define ___ASM_SPARC_OPLIB_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/oplib_64.h>
5#else
6#include <asm/oplib_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/oplib_32.h b/arch/sparc/include/asm/oplib_32.h
index b2631da259e0..b2631da259e0 100644
--- a/include/asm-sparc/oplib_32.h
+++ b/arch/sparc/include/asm/oplib_32.h
diff --git a/include/asm-sparc/oplib_64.h b/arch/sparc/include/asm/oplib_64.h
index 6d2c2ca98039..6d2c2ca98039 100644
--- a/include/asm-sparc/oplib_64.h
+++ b/arch/sparc/include/asm/oplib_64.h
diff --git a/arch/sparc/include/asm/page.h b/arch/sparc/include/asm/page.h
new file mode 100644
index 000000000000..f21de0349025
--- /dev/null
+++ b/arch/sparc/include/asm/page.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_PAGE_H
2#define ___ASM_SPARC_PAGE_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/page_64.h>
5#else
6#include <asm/page_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/page_32.h b/arch/sparc/include/asm/page_32.h
index cf5fb70ca1c1..cf5fb70ca1c1 100644
--- a/include/asm-sparc/page_32.h
+++ b/arch/sparc/include/asm/page_32.h
diff --git a/include/asm-sparc/page_64.h b/arch/sparc/include/asm/page_64.h
index b579b910ef51..b579b910ef51 100644
--- a/include/asm-sparc/page_64.h
+++ b/arch/sparc/include/asm/page_64.h
diff --git a/include/asm-sparc/param.h b/arch/sparc/include/asm/param.h
index 9836d9a3cb9a..9836d9a3cb9a 100644
--- a/include/asm-sparc/param.h
+++ b/arch/sparc/include/asm/param.h
diff --git a/include/asm-sparc/parport.h b/arch/sparc/include/asm/parport.h
index 7818b2523b8d..7818b2523b8d 100644
--- a/include/asm-sparc/parport.h
+++ b/arch/sparc/include/asm/parport.h
diff --git a/include/asm-sparc/pbm.h b/arch/sparc/include/asm/pbm.h
index 458a4916d14d..458a4916d14d 100644
--- a/include/asm-sparc/pbm.h
+++ b/arch/sparc/include/asm/pbm.h
diff --git a/arch/sparc/include/asm/pci.h b/arch/sparc/include/asm/pci.h
new file mode 100644
index 000000000000..6e14fd179335
--- /dev/null
+++ b/arch/sparc/include/asm/pci.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_PCI_H
2#define ___ASM_SPARC_PCI_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/pci_64.h>
5#else
6#include <asm/pci_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/pci_32.h b/arch/sparc/include/asm/pci_32.h
index 0ee949d220c0..0ee949d220c0 100644
--- a/include/asm-sparc/pci_32.h
+++ b/arch/sparc/include/asm/pci_32.h
diff --git a/include/asm-sparc/pci_64.h b/arch/sparc/include/asm/pci_64.h
index 4f79a54948f6..4f79a54948f6 100644
--- a/include/asm-sparc/pci_64.h
+++ b/arch/sparc/include/asm/pci_64.h
diff --git a/include/asm-sparc/pcic.h b/arch/sparc/include/asm/pcic.h
index f20ef562b265..f20ef562b265 100644
--- a/include/asm-sparc/pcic.h
+++ b/arch/sparc/include/asm/pcic.h
diff --git a/arch/sparc/include/asm/percpu.h b/arch/sparc/include/asm/percpu.h
new file mode 100644
index 000000000000..bfb1d19ff1bf
--- /dev/null
+++ b/arch/sparc/include/asm/percpu.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_PERCPU_H
2#define ___ASM_SPARC_PERCPU_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/percpu_64.h>
5#else
6#include <asm/percpu_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/percpu_32.h b/arch/sparc/include/asm/percpu_32.h
index 06066a7aaec3..06066a7aaec3 100644
--- a/include/asm-sparc/percpu_32.h
+++ b/arch/sparc/include/asm/percpu_32.h
diff --git a/include/asm-sparc/percpu_64.h b/arch/sparc/include/asm/percpu_64.h
index bee64593023e..bee64593023e 100644
--- a/include/asm-sparc/percpu_64.h
+++ b/arch/sparc/include/asm/percpu_64.h
diff --git a/include/asm-sparc/perfctr.h b/arch/sparc/include/asm/perfctr.h
index 836873002b75..836873002b75 100644
--- a/include/asm-sparc/perfctr.h
+++ b/arch/sparc/include/asm/perfctr.h
diff --git a/arch/sparc/include/asm/pgalloc.h b/arch/sparc/include/asm/pgalloc.h
new file mode 100644
index 000000000000..b6db1f7cdcab
--- /dev/null
+++ b/arch/sparc/include/asm/pgalloc.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_PGALLOC_H
2#define ___ASM_SPARC_PGALLOC_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/pgalloc_64.h>
5#else
6#include <asm/pgalloc_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/pgalloc_32.h b/arch/sparc/include/asm/pgalloc_32.h
index 681582d26969..681582d26969 100644
--- a/include/asm-sparc/pgalloc_32.h
+++ b/arch/sparc/include/asm/pgalloc_32.h
diff --git a/include/asm-sparc/pgalloc_64.h b/arch/sparc/include/asm/pgalloc_64.h
index 5bdfa2c6e400..5bdfa2c6e400 100644
--- a/include/asm-sparc/pgalloc_64.h
+++ b/arch/sparc/include/asm/pgalloc_64.h
diff --git a/arch/sparc/include/asm/pgtable.h b/arch/sparc/include/asm/pgtable.h
new file mode 100644
index 000000000000..59ba6f620732
--- /dev/null
+++ b/arch/sparc/include/asm/pgtable.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_PGTABLE_H
2#define ___ASM_SPARC_PGTABLE_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/pgtable_64.h>
5#else
6#include <asm/pgtable_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
new file mode 100644
index 000000000000..08237fda8874
--- /dev/null
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -0,0 +1,480 @@
1#ifndef _SPARC_PGTABLE_H
2#define _SPARC_PGTABLE_H
3
4/* asm/pgtable.h: Defines and functions used to work
5 * with Sparc page tables.
6 *
7 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
8 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
9 */
10
11#ifndef __ASSEMBLY__
12#include <asm-generic/4level-fixup.h>
13
14#include <linux/spinlock.h>
15#include <linux/swap.h>
16#include <asm/types.h>
17#ifdef CONFIG_SUN4
18#include <asm/pgtsun4.h>
19#else
20#include <asm/pgtsun4c.h>
21#endif
22#include <asm/pgtsrmmu.h>
23#include <asm/vac-ops.h>
24#include <asm/oplib.h>
25#include <asm/btfixup.h>
26#include <asm/system.h>
27
28
29struct vm_area_struct;
30struct page;
31
32extern void load_mmu(void);
33extern unsigned long calc_highpages(void);
34
35BTFIXUPDEF_SIMM13(pgdir_shift)
36BTFIXUPDEF_SETHI(pgdir_size)
37BTFIXUPDEF_SETHI(pgdir_mask)
38
39BTFIXUPDEF_SIMM13(ptrs_per_pmd)
40BTFIXUPDEF_SIMM13(ptrs_per_pgd)
41BTFIXUPDEF_SIMM13(user_ptrs_per_pgd)
42
43#define pte_ERROR(e) __builtin_trap()
44#define pmd_ERROR(e) __builtin_trap()
45#define pgd_ERROR(e) __builtin_trap()
46
47BTFIXUPDEF_INT(page_none)
48BTFIXUPDEF_INT(page_copy)
49BTFIXUPDEF_INT(page_readonly)
50BTFIXUPDEF_INT(page_kernel)
51
52#define PMD_SHIFT SUN4C_PMD_SHIFT
53#define PMD_SIZE (1UL << PMD_SHIFT)
54#define PMD_MASK (~(PMD_SIZE-1))
55#define PMD_ALIGN(__addr) (((__addr) + ~PMD_MASK) & PMD_MASK)
56#define PGDIR_SHIFT BTFIXUP_SIMM13(pgdir_shift)
57#define PGDIR_SIZE BTFIXUP_SETHI(pgdir_size)
58#define PGDIR_MASK BTFIXUP_SETHI(pgdir_mask)
59#define PTRS_PER_PTE 1024
60#define PTRS_PER_PMD BTFIXUP_SIMM13(ptrs_per_pmd)
61#define PTRS_PER_PGD BTFIXUP_SIMM13(ptrs_per_pgd)
62#define USER_PTRS_PER_PGD BTFIXUP_SIMM13(user_ptrs_per_pgd)
63#define FIRST_USER_ADDRESS 0
64#define PTE_SIZE (PTRS_PER_PTE*4)
65
66#define PAGE_NONE __pgprot(BTFIXUP_INT(page_none))
67extern pgprot_t PAGE_SHARED;
68#define PAGE_COPY __pgprot(BTFIXUP_INT(page_copy))
69#define PAGE_READONLY __pgprot(BTFIXUP_INT(page_readonly))
70
71extern unsigned long page_kernel;
72
73#ifdef MODULE
74#define PAGE_KERNEL page_kernel
75#else
76#define PAGE_KERNEL __pgprot(BTFIXUP_INT(page_kernel))
77#endif
78
79/* Top-level page directory */
80extern pgd_t swapper_pg_dir[1024];
81
82extern void paging_init(void);
83
84/* Page table for 0-4MB for everybody, on the Sparc this
85 * holds the same as on the i386.
86 */
87extern pte_t pg0[1024];
88extern pte_t pg1[1024];
89extern pte_t pg2[1024];
90extern pte_t pg3[1024];
91
92extern unsigned long ptr_in_current_pgd;
93
94/* Here is a trick, since mmap.c need the initializer elements for
95 * protection_map[] to be constant at compile time, I set the following
96 * to all zeros. I set it to the real values after I link in the
97 * appropriate MMU page table routines at boot time.
98 */
99#define __P000 __pgprot(0)
100#define __P001 __pgprot(0)
101#define __P010 __pgprot(0)
102#define __P011 __pgprot(0)
103#define __P100 __pgprot(0)
104#define __P101 __pgprot(0)
105#define __P110 __pgprot(0)
106#define __P111 __pgprot(0)
107
108#define __S000 __pgprot(0)
109#define __S001 __pgprot(0)
110#define __S010 __pgprot(0)
111#define __S011 __pgprot(0)
112#define __S100 __pgprot(0)
113#define __S101 __pgprot(0)
114#define __S110 __pgprot(0)
115#define __S111 __pgprot(0)
116
117extern int num_contexts;
118
119/* First physical page can be anywhere, the following is needed so that
120 * va-->pa and vice versa conversions work properly without performance
121 * hit for all __pa()/__va() operations.
122 */
123extern unsigned long phys_base;
124extern unsigned long pfn_base;
125
126/*
127 * BAD_PAGETABLE is used when we need a bogus page-table, while
128 * BAD_PAGE is used for a bogus page.
129 *
130 * ZERO_PAGE is a global shared page that is always zero: used
131 * for zero-mapped memory areas etc..
132 */
133extern pte_t * __bad_pagetable(void);
134extern pte_t __bad_page(void);
135extern unsigned long empty_zero_page;
136
137#define BAD_PAGETABLE __bad_pagetable()
138#define BAD_PAGE __bad_page()
139#define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page))
140
141/*
142 */
143BTFIXUPDEF_CALL_CONST(struct page *, pmd_page, pmd_t)
144BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page_vaddr, pgd_t)
145
146#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd)
147#define pgd_page_vaddr(pgd) BTFIXUP_CALL(pgd_page_vaddr)(pgd)
148
149BTFIXUPDEF_SETHI(none_mask)
150BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t)
151BTFIXUPDEF_CALL(void, pte_clear, pte_t *)
152
153static inline int pte_none(pte_t pte)
154{
155 return !(pte_val(pte) & ~BTFIXUP_SETHI(none_mask));
156}
157
158#define pte_present(pte) BTFIXUP_CALL(pte_present)(pte)
159#define pte_clear(mm,addr,pte) BTFIXUP_CALL(pte_clear)(pte)
160
161BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t)
162BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t)
163BTFIXUPDEF_CALL(void, pmd_clear, pmd_t *)
164
165static inline int pmd_none(pmd_t pmd)
166{
167 return !(pmd_val(pmd) & ~BTFIXUP_SETHI(none_mask));
168}
169
170#define pmd_bad(pmd) BTFIXUP_CALL(pmd_bad)(pmd)
171#define pmd_present(pmd) BTFIXUP_CALL(pmd_present)(pmd)
172#define pmd_clear(pmd) BTFIXUP_CALL(pmd_clear)(pmd)
173
174BTFIXUPDEF_CALL_CONST(int, pgd_none, pgd_t)
175BTFIXUPDEF_CALL_CONST(int, pgd_bad, pgd_t)
176BTFIXUPDEF_CALL_CONST(int, pgd_present, pgd_t)
177BTFIXUPDEF_CALL(void, pgd_clear, pgd_t *)
178
179#define pgd_none(pgd) BTFIXUP_CALL(pgd_none)(pgd)
180#define pgd_bad(pgd) BTFIXUP_CALL(pgd_bad)(pgd)
181#define pgd_present(pgd) BTFIXUP_CALL(pgd_present)(pgd)
182#define pgd_clear(pgd) BTFIXUP_CALL(pgd_clear)(pgd)
183
184/*
185 * The following only work if pte_present() is true.
186 * Undefined behaviour if not..
187 */
188BTFIXUPDEF_HALF(pte_writei)
189BTFIXUPDEF_HALF(pte_dirtyi)
190BTFIXUPDEF_HALF(pte_youngi)
191
192static int pte_write(pte_t pte) __attribute_const__;
193static inline int pte_write(pte_t pte)
194{
195 return pte_val(pte) & BTFIXUP_HALF(pte_writei);
196}
197
198static int pte_dirty(pte_t pte) __attribute_const__;
199static inline int pte_dirty(pte_t pte)
200{
201 return pte_val(pte) & BTFIXUP_HALF(pte_dirtyi);
202}
203
204static int pte_young(pte_t pte) __attribute_const__;
205static inline int pte_young(pte_t pte)
206{
207 return pte_val(pte) & BTFIXUP_HALF(pte_youngi);
208}
209
210/*
211 * The following only work if pte_present() is not true.
212 */
213BTFIXUPDEF_HALF(pte_filei)
214
215static int pte_file(pte_t pte) __attribute_const__;
216static inline int pte_file(pte_t pte)
217{
218 return pte_val(pte) & BTFIXUP_HALF(pte_filei);
219}
220
221static inline int pte_special(pte_t pte)
222{
223 return 0;
224}
225
226/*
227 */
228BTFIXUPDEF_HALF(pte_wrprotecti)
229BTFIXUPDEF_HALF(pte_mkcleani)
230BTFIXUPDEF_HALF(pte_mkoldi)
231
232static pte_t pte_wrprotect(pte_t pte) __attribute_const__;
233static inline pte_t pte_wrprotect(pte_t pte)
234{
235 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_wrprotecti));
236}
237
238static pte_t pte_mkclean(pte_t pte) __attribute_const__;
239static inline pte_t pte_mkclean(pte_t pte)
240{
241 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkcleani));
242}
243
244static pte_t pte_mkold(pte_t pte) __attribute_const__;
245static inline pte_t pte_mkold(pte_t pte)
246{
247 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkoldi));
248}
249
250BTFIXUPDEF_CALL_CONST(pte_t, pte_mkwrite, pte_t)
251BTFIXUPDEF_CALL_CONST(pte_t, pte_mkdirty, pte_t)
252BTFIXUPDEF_CALL_CONST(pte_t, pte_mkyoung, pte_t)
253
254#define pte_mkwrite(pte) BTFIXUP_CALL(pte_mkwrite)(pte)
255#define pte_mkdirty(pte) BTFIXUP_CALL(pte_mkdirty)(pte)
256#define pte_mkyoung(pte) BTFIXUP_CALL(pte_mkyoung)(pte)
257
258#define pte_mkspecial(pte) (pte)
259
260#define pfn_pte(pfn, prot) mk_pte(pfn_to_page(pfn), prot)
261
262BTFIXUPDEF_CALL(unsigned long, pte_pfn, pte_t)
263#define pte_pfn(pte) BTFIXUP_CALL(pte_pfn)(pte)
264#define pte_page(pte) pfn_to_page(pte_pfn(pte))
265
266/*
267 * Conversion functions: convert a page and protection to a page entry,
268 * and a page entry and page directory to the page they refer to.
269 */
270BTFIXUPDEF_CALL_CONST(pte_t, mk_pte, struct page *, pgprot_t)
271
272BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_phys, unsigned long, pgprot_t)
273BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_io, unsigned long, pgprot_t, int)
274BTFIXUPDEF_CALL_CONST(pgprot_t, pgprot_noncached, pgprot_t)
275
276#define mk_pte(page,pgprot) BTFIXUP_CALL(mk_pte)(page,pgprot)
277#define mk_pte_phys(page,pgprot) BTFIXUP_CALL(mk_pte_phys)(page,pgprot)
278#define mk_pte_io(page,pgprot,space) BTFIXUP_CALL(mk_pte_io)(page,pgprot,space)
279
280#define pgprot_noncached(pgprot) BTFIXUP_CALL(pgprot_noncached)(pgprot)
281
282BTFIXUPDEF_INT(pte_modify_mask)
283
284static pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__;
285static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
286{
287 return __pte((pte_val(pte) & BTFIXUP_INT(pte_modify_mask)) |
288 pgprot_val(newprot));
289}
290
291#define pgd_index(address) ((address) >> PGDIR_SHIFT)
292
293/* to find an entry in a page-table-directory */
294#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
295
296/* to find an entry in a kernel page-table-directory */
297#define pgd_offset_k(address) pgd_offset(&init_mm, address)
298
299/* Find an entry in the second-level page table.. */
300BTFIXUPDEF_CALL(pmd_t *, pmd_offset, pgd_t *, unsigned long)
301#define pmd_offset(dir,addr) BTFIXUP_CALL(pmd_offset)(dir,addr)
302
303/* Find an entry in the third-level page table.. */
304BTFIXUPDEF_CALL(pte_t *, pte_offset_kernel, pmd_t *, unsigned long)
305#define pte_offset_kernel(dir,addr) BTFIXUP_CALL(pte_offset_kernel)(dir,addr)
306
307/*
308 * This shortcut works on sun4m (and sun4d) because the nocache area is static,
309 * and sun4c is guaranteed to have no highmem anyway.
310 */
311#define pte_offset_map(d, a) pte_offset_kernel(d,a)
312#define pte_offset_map_nested(d, a) pte_offset_kernel(d,a)
313
314#define pte_unmap(pte) do{}while(0)
315#define pte_unmap_nested(pte) do{}while(0)
316
317/* Certain architectures need to do special things when pte's
318 * within a page table are directly modified. Thus, the following
319 * hook is made available.
320 */
321
322BTFIXUPDEF_CALL(void, set_pte, pte_t *, pte_t)
323
324#define set_pte(ptep,pteval) BTFIXUP_CALL(set_pte)(ptep,pteval)
325#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
326
327struct seq_file;
328BTFIXUPDEF_CALL(void, mmu_info, struct seq_file *)
329
330#define mmu_info(p) BTFIXUP_CALL(mmu_info)(p)
331
332/* Fault handler stuff... */
333#define FAULT_CODE_PROT 0x1
334#define FAULT_CODE_WRITE 0x2
335#define FAULT_CODE_USER 0x4
336
337BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t)
338
339#define update_mmu_cache(vma,addr,pte) BTFIXUP_CALL(update_mmu_cache)(vma,addr,pte)
340
341BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long,
342 unsigned long, unsigned int)
343BTFIXUPDEF_CALL(void, sparc_unmapiorange, unsigned long, unsigned int)
344#define sparc_mapiorange(bus,pa,va,len) BTFIXUP_CALL(sparc_mapiorange)(bus,pa,va,len)
345#define sparc_unmapiorange(va,len) BTFIXUP_CALL(sparc_unmapiorange)(va,len)
346
347extern int invalid_segment;
348
349/* Encode and de-code a swap entry */
350BTFIXUPDEF_CALL(unsigned long, __swp_type, swp_entry_t)
351BTFIXUPDEF_CALL(unsigned long, __swp_offset, swp_entry_t)
352BTFIXUPDEF_CALL(swp_entry_t, __swp_entry, unsigned long, unsigned long)
353
354#define __swp_type(__x) BTFIXUP_CALL(__swp_type)(__x)
355#define __swp_offset(__x) BTFIXUP_CALL(__swp_offset)(__x)
356#define __swp_entry(__type,__off) BTFIXUP_CALL(__swp_entry)(__type,__off)
357
358#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
359#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
360
361/* file-offset-in-pte helpers */
362BTFIXUPDEF_CALL(unsigned long, pte_to_pgoff, pte_t pte);
363BTFIXUPDEF_CALL(pte_t, pgoff_to_pte, unsigned long pgoff);
364
365#define pte_to_pgoff(pte) BTFIXUP_CALL(pte_to_pgoff)(pte)
366#define pgoff_to_pte(off) BTFIXUP_CALL(pgoff_to_pte)(off)
367
368/*
369 * This is made a constant because mm/fremap.c required a constant.
370 * Note that layout of these bits is different between sun4c.c and srmmu.c.
371 */
372#define PTE_FILE_MAX_BITS 24
373
374/*
375 */
376struct ctx_list {
377 struct ctx_list *next;
378 struct ctx_list *prev;
379 unsigned int ctx_number;
380 struct mm_struct *ctx_mm;
381};
382
383extern struct ctx_list *ctx_list_pool; /* Dynamically allocated */
384extern struct ctx_list ctx_free; /* Head of free list */
385extern struct ctx_list ctx_used; /* Head of used contexts list */
386
387#define NO_CONTEXT -1
388
389static inline void remove_from_ctx_list(struct ctx_list *entry)
390{
391 entry->next->prev = entry->prev;
392 entry->prev->next = entry->next;
393}
394
395static inline void add_to_ctx_list(struct ctx_list *head, struct ctx_list *entry)
396{
397 entry->next = head;
398 (entry->prev = head->prev)->next = entry;
399 head->prev = entry;
400}
401#define add_to_free_ctxlist(entry) add_to_ctx_list(&ctx_free, entry)
402#define add_to_used_ctxlist(entry) add_to_ctx_list(&ctx_used, entry)
403
404static inline unsigned long
405__get_phys (unsigned long addr)
406{
407 switch (sparc_cpu_model){
408 case sun4:
409 case sun4c:
410 return sun4c_get_pte (addr) << PAGE_SHIFT;
411 case sun4m:
412 case sun4d:
413 return ((srmmu_get_pte (addr) & 0xffffff00) << 4);
414 default:
415 return 0;
416 }
417}
418
419static inline int
420__get_iospace (unsigned long addr)
421{
422 switch (sparc_cpu_model){
423 case sun4:
424 case sun4c:
425 return -1; /* Don't check iospace on sun4c */
426 case sun4m:
427 case sun4d:
428 return (srmmu_get_pte (addr) >> 28);
429 default:
430 return -1;
431 }
432}
433
434extern unsigned long *sparc_valid_addr_bitmap;
435
436/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
437#define kern_addr_valid(addr) \
438 (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap))
439
440extern int io_remap_pfn_range(struct vm_area_struct *vma,
441 unsigned long from, unsigned long pfn,
442 unsigned long size, pgprot_t prot);
443
444/*
445 * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in
446 * its high 4 bits. These macros/functions put it there or get it from there.
447 */
448#define MK_IOSPACE_PFN(space, pfn) (pfn | (space << (BITS_PER_LONG - 4)))
449#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4))
450#define GET_PFN(pfn) (pfn & 0x0fffffffUL)
451
452#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
453#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
454({ \
455 int __changed = !pte_same(*(__ptep), __entry); \
456 if (__changed) { \
457 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
458 flush_tlb_page(__vma, __address); \
459 } \
460 (sparc_cpu_model == sun4c) || __changed; \
461})
462
463#include <asm-generic/pgtable.h>
464
465#endif /* !(__ASSEMBLY__) */
466
467#define VMALLOC_START 0xfe600000
468/* XXX Alter this when I get around to fixing sun4c - Anton */
469#define VMALLOC_END 0xffc00000
470
471
472/* We provide our own get_unmapped_area to cope with VA holes for userland */
473#define HAVE_ARCH_UNMAPPED_AREA
474
475/*
476 * No page table caches to initialise
477 */
478#define pgtable_cache_init() do { } while (0)
479
480#endif /* !(_SPARC_PGTABLE_H) */
diff --git a/include/asm-sparc/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index bb9ec2cce355..bb9ec2cce355 100644
--- a/include/asm-sparc/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
diff --git a/include/asm-sparc/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h
index 808555fc1d58..808555fc1d58 100644
--- a/include/asm-sparc/pgtsrmmu.h
+++ b/arch/sparc/include/asm/pgtsrmmu.h
diff --git a/include/asm-sparc/pgtsun4.h b/arch/sparc/include/asm/pgtsun4.h
index 5a0d661fb82e..5a0d661fb82e 100644
--- a/include/asm-sparc/pgtsun4.h
+++ b/arch/sparc/include/asm/pgtsun4.h
diff --git a/include/asm-sparc/pgtsun4c.h b/arch/sparc/include/asm/pgtsun4c.h
index aeb25e912179..aeb25e912179 100644
--- a/include/asm-sparc/pgtsun4c.h
+++ b/arch/sparc/include/asm/pgtsun4c.h
diff --git a/include/asm-sparc/pil.h b/arch/sparc/include/asm/pil.h
index 71819bb943fc..71819bb943fc 100644
--- a/include/asm-sparc/pil.h
+++ b/arch/sparc/include/asm/pil.h
diff --git a/include/asm-sparc/poll.h b/arch/sparc/include/asm/poll.h
index 091d3ad2e830..091d3ad2e830 100644
--- a/include/asm-sparc/poll.h
+++ b/arch/sparc/include/asm/poll.h
diff --git a/arch/sparc/include/asm/posix_types.h b/arch/sparc/include/asm/posix_types.h
new file mode 100644
index 000000000000..03a0e091a884
--- /dev/null
+++ b/arch/sparc/include/asm/posix_types.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_POSIX_TYPES_H
2#define ___ASM_SPARC_POSIX_TYPES_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/posix_types_64.h>
5#else
6#include <asm/posix_types_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/posix_types_32.h b/arch/sparc/include/asm/posix_types_32.h
index 6bb6eb1ca0f2..6bb6eb1ca0f2 100644
--- a/include/asm-sparc/posix_types_32.h
+++ b/arch/sparc/include/asm/posix_types_32.h
diff --git a/include/asm-sparc/posix_types_64.h b/arch/sparc/include/asm/posix_types_64.h
index ba8f93295763..ba8f93295763 100644
--- a/include/asm-sparc/posix_types_64.h
+++ b/arch/sparc/include/asm/posix_types_64.h
diff --git a/arch/sparc/include/asm/processor.h b/arch/sparc/include/asm/processor.h
new file mode 100644
index 000000000000..9da9646bf6c6
--- /dev/null
+++ b/arch/sparc/include/asm/processor.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_PROCESSOR_H
2#define ___ASM_SPARC_PROCESSOR_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/processor_64.h>
5#else
6#include <asm/processor_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h
new file mode 100644
index 000000000000..2ae67a2e7f3a
--- /dev/null
+++ b/arch/sparc/include/asm/processor_32.h
@@ -0,0 +1,129 @@
1/* include/asm/processor.h
2 *
3 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
4 */
5
6#ifndef __ASM_SPARC_PROCESSOR_H
7#define __ASM_SPARC_PROCESSOR_H
8
9/*
10 * Sparc32 implementation of macro that returns current
11 * instruction pointer ("program counter").
12 */
13#define current_text_addr() ({ void *pc; __asm__("sethi %%hi(1f), %0; or %0, %%lo(1f), %0;\n1:" : "=r" (pc)); pc; })
14
15#include <asm/psr.h>
16#include <asm/ptrace.h>
17#include <asm/head.h>
18#include <asm/signal.h>
19#include <asm/btfixup.h>
20#include <asm/page.h>
21
22/*
23 * The sparc has no problems with write protection
24 */
25#define wp_works_ok 1
26#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
27
28/* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too...
29 * That one page is used to protect kernel from intruders, so that
30 * we can make our access_ok test faster
31 */
32#define TASK_SIZE PAGE_OFFSET
33#ifdef __KERNEL__
34#define STACK_TOP (PAGE_OFFSET - PAGE_SIZE)
35#define STACK_TOP_MAX STACK_TOP
36#endif /* __KERNEL__ */
37
38struct task_struct;
39
40#ifdef __KERNEL__
41struct fpq {
42 unsigned long *insn_addr;
43 unsigned long insn;
44};
45#endif
46
47typedef struct {
48 int seg;
49} mm_segment_t;
50
51/* The Sparc processor specific thread struct. */
52struct thread_struct {
53 struct pt_regs *kregs;
54 unsigned int _pad1;
55
56 /* Special child fork kpsr/kwim values. */
57 unsigned long fork_kpsr __attribute__ ((aligned (8)));
58 unsigned long fork_kwim;
59
60 /* Floating point regs */
61 unsigned long float_regs[32] __attribute__ ((aligned (8)));
62 unsigned long fsr;
63 unsigned long fpqdepth;
64 struct fpq fpqueue[16];
65 unsigned long flags;
66 mm_segment_t current_ds;
67};
68
69#define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */
70#define SPARC_FLAG_UNALIGNED 0x2 /* is allowed to do unaligned accesses */
71
72#define INIT_THREAD { \
73 .flags = SPARC_FLAG_KTHREAD, \
74 .current_ds = KERNEL_DS, \
75}
76
77/* Return saved PC of a blocked thread. */
78extern unsigned long thread_saved_pc(struct task_struct *t);
79
80/* Do necessary setup to start up a newly executed thread. */
81static inline void start_thread(struct pt_regs * regs, unsigned long pc,
82 unsigned long sp)
83{
84 register unsigned long zero asm("g1");
85
86 regs->psr = (regs->psr & (PSR_CWP)) | PSR_S;
87 regs->pc = ((pc & (~3)) - 4);
88 regs->npc = regs->pc + 4;
89 regs->y = 0;
90 zero = 0;
91 __asm__ __volatile__("std\t%%g0, [%0 + %3 + 0x00]\n\t"
92 "std\t%%g0, [%0 + %3 + 0x08]\n\t"
93 "std\t%%g0, [%0 + %3 + 0x10]\n\t"
94 "std\t%%g0, [%0 + %3 + 0x18]\n\t"
95 "std\t%%g0, [%0 + %3 + 0x20]\n\t"
96 "std\t%%g0, [%0 + %3 + 0x28]\n\t"
97 "std\t%%g0, [%0 + %3 + 0x30]\n\t"
98 "st\t%1, [%0 + %3 + 0x38]\n\t"
99 "st\t%%g0, [%0 + %3 + 0x3c]"
100 : /* no outputs */
101 : "r" (regs),
102 "r" (sp - sizeof(struct reg_window)),
103 "r" (zero),
104 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))
105 : "memory");
106}
107
108/* Free all resources held by a thread. */
109#define release_thread(tsk) do { } while(0)
110extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
111
112/* Prepare to copy thread state - unlazy all lazy status */
113#define prepare_to_copy(tsk) do { } while (0)
114
115extern unsigned long get_wchan(struct task_struct *);
116
117#define task_pt_regs(tsk) ((tsk)->thread.kregs)
118#define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc)
119#define KSTK_ESP(tsk) ((tsk)->thread.kregs->u_regs[UREG_FP])
120
121#ifdef __KERNEL__
122
123extern struct task_struct *last_task_used_math;
124
125#define cpu_relax() barrier()
126
127#endif
128
129#endif /* __ASM_SPARC_PROCESSOR_H */
diff --git a/arch/sparc/include/asm/processor_64.h b/arch/sparc/include/asm/processor_64.h
new file mode 100644
index 000000000000..137a6bd72fc8
--- /dev/null
+++ b/arch/sparc/include/asm/processor_64.h
@@ -0,0 +1,237 @@
1/*
2 * include/asm/processor.h
3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5 */
6
7#ifndef __ASM_SPARC64_PROCESSOR_H
8#define __ASM_SPARC64_PROCESSOR_H
9
10/*
11 * Sparc64 implementation of macro that returns current
12 * instruction pointer ("program counter").
13 */
14#define current_text_addr() ({ void *pc; __asm__("rd %%pc, %0" : "=r" (pc)); pc; })
15
16#include <asm/asi.h>
17#include <asm/pstate.h>
18#include <asm/ptrace.h>
19#include <asm/page.h>
20
21/* The sparc has no problems with write protection */
22#define wp_works_ok 1
23#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
24
25/*
26 * User lives in his very own context, and cannot reference us. Note
27 * that TASK_SIZE is a misnomer, it really gives maximum user virtual
28 * address that the kernel will allocate out.
29 *
30 * XXX No longer using virtual page tables, kill this upper limit...
31 */
32#define VA_BITS 44
33#ifndef __ASSEMBLY__
34#define VPTE_SIZE (1UL << (VA_BITS - PAGE_SHIFT + 3))
35#else
36#define VPTE_SIZE (1 << (VA_BITS - PAGE_SHIFT + 3))
37#endif
38
39#define TASK_SIZE ((unsigned long)-VPTE_SIZE)
40#define TASK_SIZE_OF(tsk) \
41 (test_tsk_thread_flag(tsk,TIF_32BIT) ? \
42 (1UL << 32UL) : TASK_SIZE)
43#ifdef __KERNEL__
44
45#define STACK_TOP32 ((1UL << 32UL) - PAGE_SIZE)
46#define STACK_TOP64 (0x0000080000000000UL - (1UL << 32UL))
47
48#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
49 STACK_TOP32 : STACK_TOP64)
50
51#define STACK_TOP_MAX STACK_TOP64
52
53#endif
54
55#ifndef __ASSEMBLY__
56
57typedef struct {
58 unsigned char seg;
59} mm_segment_t;
60
61/* The Sparc processor specific thread struct. */
62/* XXX This should die, everything can go into thread_info now. */
63struct thread_struct {
64#ifdef CONFIG_DEBUG_SPINLOCK
65 /* How many spinlocks held by this thread.
66 * Used with spin lock debugging to catch tasks
67 * sleeping illegally with locks held.
68 */
69 int smp_lock_count;
70 unsigned int smp_lock_pc;
71#else
72 int dummy; /* f'in gcc bug... */
73#endif
74};
75
76#endif /* !(__ASSEMBLY__) */
77
78#ifndef CONFIG_DEBUG_SPINLOCK
79#define INIT_THREAD { \
80 0, \
81}
82#else /* CONFIG_DEBUG_SPINLOCK */
83#define INIT_THREAD { \
84/* smp_lock_count, smp_lock_pc, */ \
85 0, 0, \
86}
87#endif /* !(CONFIG_DEBUG_SPINLOCK) */
88
89#ifndef __ASSEMBLY__
90
91#include <linux/types.h>
92
93/* Return saved PC of a blocked thread. */
94struct task_struct;
95extern unsigned long thread_saved_pc(struct task_struct *);
96
97/* On Uniprocessor, even in RMO processes see TSO semantics */
98#ifdef CONFIG_SMP
99#define TSTATE_INITIAL_MM TSTATE_TSO
100#else
101#define TSTATE_INITIAL_MM TSTATE_RMO
102#endif
103
104/* Do necessary setup to start up a newly executed thread. */
105#define start_thread(regs, pc, sp) \
106do { \
107 unsigned long __asi = ASI_PNF; \
108 regs->tstate = (regs->tstate & (TSTATE_CWP)) | (TSTATE_INITIAL_MM|TSTATE_IE) | (__asi << 24UL); \
109 regs->tpc = ((pc & (~3)) - 4); \
110 regs->tnpc = regs->tpc + 4; \
111 regs->y = 0; \
112 set_thread_wstate(1 << 3); \
113 if (current_thread_info()->utraps) { \
114 if (*(current_thread_info()->utraps) < 2) \
115 kfree(current_thread_info()->utraps); \
116 else \
117 (*(current_thread_info()->utraps))--; \
118 current_thread_info()->utraps = NULL; \
119 } \
120 __asm__ __volatile__( \
121 "stx %%g0, [%0 + %2 + 0x00]\n\t" \
122 "stx %%g0, [%0 + %2 + 0x08]\n\t" \
123 "stx %%g0, [%0 + %2 + 0x10]\n\t" \
124 "stx %%g0, [%0 + %2 + 0x18]\n\t" \
125 "stx %%g0, [%0 + %2 + 0x20]\n\t" \
126 "stx %%g0, [%0 + %2 + 0x28]\n\t" \
127 "stx %%g0, [%0 + %2 + 0x30]\n\t" \
128 "stx %%g0, [%0 + %2 + 0x38]\n\t" \
129 "stx %%g0, [%0 + %2 + 0x40]\n\t" \
130 "stx %%g0, [%0 + %2 + 0x48]\n\t" \
131 "stx %%g0, [%0 + %2 + 0x50]\n\t" \
132 "stx %%g0, [%0 + %2 + 0x58]\n\t" \
133 "stx %%g0, [%0 + %2 + 0x60]\n\t" \
134 "stx %%g0, [%0 + %2 + 0x68]\n\t" \
135 "stx %1, [%0 + %2 + 0x70]\n\t" \
136 "stx %%g0, [%0 + %2 + 0x78]\n\t" \
137 "wrpr %%g0, (1 << 3), %%wstate\n\t" \
138 : \
139 : "r" (regs), "r" (sp - sizeof(struct reg_window) - STACK_BIAS), \
140 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \
141} while (0)
142
143#define start_thread32(regs, pc, sp) \
144do { \
145 unsigned long __asi = ASI_PNF; \
146 pc &= 0x00000000ffffffffUL; \
147 sp &= 0x00000000ffffffffUL; \
148 regs->tstate = (regs->tstate & (TSTATE_CWP))|(TSTATE_INITIAL_MM|TSTATE_IE|TSTATE_AM) | (__asi << 24UL); \
149 regs->tpc = ((pc & (~3)) - 4); \
150 regs->tnpc = regs->tpc + 4; \
151 regs->y = 0; \
152 set_thread_wstate(2 << 3); \
153 if (current_thread_info()->utraps) { \
154 if (*(current_thread_info()->utraps) < 2) \
155 kfree(current_thread_info()->utraps); \
156 else \
157 (*(current_thread_info()->utraps))--; \
158 current_thread_info()->utraps = NULL; \
159 } \
160 __asm__ __volatile__( \
161 "stx %%g0, [%0 + %2 + 0x00]\n\t" \
162 "stx %%g0, [%0 + %2 + 0x08]\n\t" \
163 "stx %%g0, [%0 + %2 + 0x10]\n\t" \
164 "stx %%g0, [%0 + %2 + 0x18]\n\t" \
165 "stx %%g0, [%0 + %2 + 0x20]\n\t" \
166 "stx %%g0, [%0 + %2 + 0x28]\n\t" \
167 "stx %%g0, [%0 + %2 + 0x30]\n\t" \
168 "stx %%g0, [%0 + %2 + 0x38]\n\t" \
169 "stx %%g0, [%0 + %2 + 0x40]\n\t" \
170 "stx %%g0, [%0 + %2 + 0x48]\n\t" \
171 "stx %%g0, [%0 + %2 + 0x50]\n\t" \
172 "stx %%g0, [%0 + %2 + 0x58]\n\t" \
173 "stx %%g0, [%0 + %2 + 0x60]\n\t" \
174 "stx %%g0, [%0 + %2 + 0x68]\n\t" \
175 "stx %1, [%0 + %2 + 0x70]\n\t" \
176 "stx %%g0, [%0 + %2 + 0x78]\n\t" \
177 "wrpr %%g0, (2 << 3), %%wstate\n\t" \
178 : \
179 : "r" (regs), "r" (sp - sizeof(struct reg_window32)), \
180 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \
181} while (0)
182
183/* Free all resources held by a thread. */
184#define release_thread(tsk) do { } while (0)
185
186/* Prepare to copy thread state - unlazy all lazy status */
187#define prepare_to_copy(tsk) do { } while (0)
188
189extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
190
191extern unsigned long get_wchan(struct task_struct *task);
192
193#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs)
194#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc)
195#define KSTK_ESP(tsk) (task_pt_regs(tsk)->u_regs[UREG_FP])
196
197#define cpu_relax() barrier()
198
199/* Prefetch support. This is tuned for UltraSPARC-III and later.
200 * UltraSPARC-I will treat these as nops, and UltraSPARC-II has
201 * a shallower prefetch queue than later chips.
202 */
203#define ARCH_HAS_PREFETCH
204#define ARCH_HAS_PREFETCHW
205#define ARCH_HAS_SPINLOCK_PREFETCH
206
207static inline void prefetch(const void *x)
208{
209 /* We do not use the read prefetch mnemonic because that
210 * prefetches into the prefetch-cache which only is accessible
211 * by floating point operations in UltraSPARC-III and later.
212 * By contrast, "#one_write" prefetches into the L2 cache
213 * in shared state.
214 */
215 __asm__ __volatile__("prefetch [%0], #one_write"
216 : /* no outputs */
217 : "r" (x));
218}
219
220static inline void prefetchw(const void *x)
221{
222 /* The most optimal prefetch to use for writes is
223 * "#n_writes". This brings the cacheline into the
224 * L2 cache in "owned" state.
225 */
226 __asm__ __volatile__("prefetch [%0], #n_writes"
227 : /* no outputs */
228 : "r" (x));
229}
230
231#define spin_lock_prefetch(x) prefetchw(x)
232
233#define HAVE_ARCH_PICK_MMAP_LAYOUT
234
235#endif /* !(__ASSEMBLY__) */
236
237#endif /* !(__ASM_SPARC64_PROCESSOR_H) */
diff --git a/include/asm-sparc/prom.h b/arch/sparc/include/asm/prom.h
index fd55522481cd..fd55522481cd 100644
--- a/include/asm-sparc/prom.h
+++ b/arch/sparc/include/asm/prom.h
diff --git a/include/asm-sparc/psr.h b/arch/sparc/include/asm/psr.h
index b8c0e5f0a66b..b8c0e5f0a66b 100644
--- a/include/asm-sparc/psr.h
+++ b/arch/sparc/include/asm/psr.h
diff --git a/include/asm-sparc/psrcompat.h b/arch/sparc/include/asm/psrcompat.h
index 44b6327dbbf5..44b6327dbbf5 100644
--- a/include/asm-sparc/psrcompat.h
+++ b/arch/sparc/include/asm/psrcompat.h
diff --git a/include/asm-sparc/pstate.h b/arch/sparc/include/asm/pstate.h
index a26a53777bb0..a26a53777bb0 100644
--- a/include/asm-sparc/pstate.h
+++ b/arch/sparc/include/asm/pstate.h
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h
new file mode 100644
index 000000000000..6dcbe2eed2e2
--- /dev/null
+++ b/arch/sparc/include/asm/ptrace.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_PTRACE_H
2#define ___ASM_SPARC_PTRACE_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/ptrace_64.h>
5#else
6#include <asm/ptrace_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/ptrace_32.h b/arch/sparc/include/asm/ptrace_32.h
new file mode 100644
index 000000000000..d43c88b86834
--- /dev/null
+++ b/arch/sparc/include/asm/ptrace_32.h
@@ -0,0 +1,176 @@
1#ifndef _SPARC_PTRACE_H
2#define _SPARC_PTRACE_H
3
4#include <asm/psr.h>
5
6/* This struct defines the way the registers are stored on the
7 * stack during a system call and basically all traps.
8 */
9
10#ifndef __ASSEMBLY__
11
12#include <linux/types.h>
13
14struct pt_regs {
15 unsigned long psr;
16 unsigned long pc;
17 unsigned long npc;
18 unsigned long y;
19 unsigned long u_regs[16]; /* globals and ins */
20};
21
22#define UREG_G0 0
23#define UREG_G1 1
24#define UREG_G2 2
25#define UREG_G3 3
26#define UREG_G4 4
27#define UREG_G5 5
28#define UREG_G6 6
29#define UREG_G7 7
30#define UREG_I0 8
31#define UREG_I1 9
32#define UREG_I2 10
33#define UREG_I3 11
34#define UREG_I4 12
35#define UREG_I5 13
36#define UREG_I6 14
37#define UREG_I7 15
38#define UREG_WIM UREG_G0
39#define UREG_FADDR UREG_G0
40#define UREG_FP UREG_I6
41#define UREG_RETPC UREG_I7
42
43static inline bool pt_regs_is_syscall(struct pt_regs *regs)
44{
45 return (regs->psr & PSR_SYSCALL);
46}
47
48static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
49{
50 return (regs->psr &= ~PSR_SYSCALL);
51}
52
53/* A register window */
54struct reg_window {
55 unsigned long locals[8];
56 unsigned long ins[8];
57};
58
59/* A Sparc stack frame */
60struct sparc_stackf {
61 unsigned long locals[8];
62 unsigned long ins[6];
63 struct sparc_stackf *fp;
64 unsigned long callers_pc;
65 char *structptr;
66 unsigned long xargs[6];
67 unsigned long xxargs[1];
68};
69
70#define TRACEREG_SZ sizeof(struct pt_regs)
71#define STACKFRAME_SZ sizeof(struct sparc_stackf)
72
73#ifdef __KERNEL__
74
75#define user_mode(regs) (!((regs)->psr & PSR_PS))
76#define instruction_pointer(regs) ((regs)->pc)
77#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
78unsigned long profile_pc(struct pt_regs *);
79extern void show_regs(struct pt_regs *);
80#endif
81
82#else /* __ASSEMBLY__ */
83/* For assembly code. */
84#define TRACEREG_SZ 0x50
85#define STACKFRAME_SZ 0x60
86#endif
87
88/*
89 * The asm-offsets.h is a generated file, so we cannot include it.
90 * It may be OK for glibc headers, but it's utterly pointless for C code.
91 * The assembly code using those offsets has to include it explicitly.
92 */
93/* #include <asm/asm-offsets.h> */
94
95/* These are for pt_regs. */
96#define PT_PSR 0x0
97#define PT_PC 0x4
98#define PT_NPC 0x8
99#define PT_Y 0xc
100#define PT_G0 0x10
101#define PT_WIM PT_G0
102#define PT_G1 0x14
103#define PT_G2 0x18
104#define PT_G3 0x1c
105#define PT_G4 0x20
106#define PT_G5 0x24
107#define PT_G6 0x28
108#define PT_G7 0x2c
109#define PT_I0 0x30
110#define PT_I1 0x34
111#define PT_I2 0x38
112#define PT_I3 0x3c
113#define PT_I4 0x40
114#define PT_I5 0x44
115#define PT_I6 0x48
116#define PT_FP PT_I6
117#define PT_I7 0x4c
118
119/* Reg_window offsets */
120#define RW_L0 0x00
121#define RW_L1 0x04
122#define RW_L2 0x08
123#define RW_L3 0x0c
124#define RW_L4 0x10
125#define RW_L5 0x14
126#define RW_L6 0x18
127#define RW_L7 0x1c
128#define RW_I0 0x20
129#define RW_I1 0x24
130#define RW_I2 0x28
131#define RW_I3 0x2c
132#define RW_I4 0x30
133#define RW_I5 0x34
134#define RW_I6 0x38
135#define RW_I7 0x3c
136
137/* Stack_frame offsets */
138#define SF_L0 0x00
139#define SF_L1 0x04
140#define SF_L2 0x08
141#define SF_L3 0x0c
142#define SF_L4 0x10
143#define SF_L5 0x14
144#define SF_L6 0x18
145#define SF_L7 0x1c
146#define SF_I0 0x20
147#define SF_I1 0x24
148#define SF_I2 0x28
149#define SF_I3 0x2c
150#define SF_I4 0x30
151#define SF_I5 0x34
152#define SF_FP 0x38
153#define SF_PC 0x3c
154#define SF_RETP 0x40
155#define SF_XARG0 0x44
156#define SF_XARG1 0x48
157#define SF_XARG2 0x4c
158#define SF_XARG3 0x50
159#define SF_XARG4 0x54
160#define SF_XARG5 0x58
161#define SF_XXARG 0x5c
162
163/* Stuff for the ptrace system call */
164#define PTRACE_SPARC_DETACH 11
165#define PTRACE_GETREGS 12
166#define PTRACE_SETREGS 13
167#define PTRACE_GETFPREGS 14
168#define PTRACE_SETFPREGS 15
169#define PTRACE_READDATA 16
170#define PTRACE_WRITEDATA 17
171#define PTRACE_READTEXT 18
172#define PTRACE_WRITETEXT 19
173#define PTRACE_GETFPAREGS 20
174#define PTRACE_SETFPAREGS 21
175
176#endif /* !(_SPARC_PTRACE_H) */
diff --git a/arch/sparc/include/asm/ptrace_64.h b/arch/sparc/include/asm/ptrace_64.h
new file mode 100644
index 000000000000..ec6d45c84cd0
--- /dev/null
+++ b/arch/sparc/include/asm/ptrace_64.h
@@ -0,0 +1,347 @@
1#ifndef _SPARC64_PTRACE_H
2#define _SPARC64_PTRACE_H
3
4#include <asm/pstate.h>
5
6/* This struct defines the way the registers are stored on the
7 * stack during a system call and basically all traps.
8 */
9
10/* This magic value must have the low 9 bits clear,
11 * as that is where we encode the %tt value, see below.
12 */
13#define PT_REGS_MAGIC 0x57ac6c00
14
15#ifndef __ASSEMBLY__
16
17#include <linux/types.h>
18
19struct pt_regs {
20 unsigned long u_regs[16]; /* globals and ins */
21 unsigned long tstate;
22 unsigned long tpc;
23 unsigned long tnpc;
24 unsigned int y;
25
26 /* We encode a magic number, PT_REGS_MAGIC, along
27 * with the %tt (trap type) register value at trap
28 * entry time. The magic number allows us to identify
29 * accurately a trap stack frame in the stack
30 * unwinder, and the %tt value allows us to test
31 * things like "in a system call" etc. for an arbitray
32 * process.
33 *
34 * The PT_REGS_MAGIC is choosen such that it can be
35 * loaded completely using just a sethi instruction.
36 */
37 unsigned int magic;
38};
39
40static inline int pt_regs_trap_type(struct pt_regs *regs)
41{
42 return regs->magic & 0x1ff;
43}
44
45static inline bool pt_regs_is_syscall(struct pt_regs *regs)
46{
47 return (regs->tstate & TSTATE_SYSCALL);
48}
49
50static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
51{
52 return (regs->tstate &= ~TSTATE_SYSCALL);
53}
54
55struct pt_regs32 {
56 unsigned int psr;
57 unsigned int pc;
58 unsigned int npc;
59 unsigned int y;
60 unsigned int u_regs[16]; /* globals and ins */
61};
62
63#define UREG_G0 0
64#define UREG_G1 1
65#define UREG_G2 2
66#define UREG_G3 3
67#define UREG_G4 4
68#define UREG_G5 5
69#define UREG_G6 6
70#define UREG_G7 7
71#define UREG_I0 8
72#define UREG_I1 9
73#define UREG_I2 10
74#define UREG_I3 11
75#define UREG_I4 12
76#define UREG_I5 13
77#define UREG_I6 14
78#define UREG_I7 15
79#define UREG_FP UREG_I6
80#define UREG_RETPC UREG_I7
81
82/* A V9 register window */
83struct reg_window {
84 unsigned long locals[8];
85 unsigned long ins[8];
86};
87
88/* A 32-bit register window. */
89struct reg_window32 {
90 unsigned int locals[8];
91 unsigned int ins[8];
92};
93
94/* A V9 Sparc stack frame */
95struct sparc_stackf {
96 unsigned long locals[8];
97 unsigned long ins[6];
98 struct sparc_stackf *fp;
99 unsigned long callers_pc;
100 char *structptr;
101 unsigned long xargs[6];
102 unsigned long xxargs[1];
103};
104
105/* A 32-bit Sparc stack frame */
106struct sparc_stackf32 {
107 unsigned int locals[8];
108 unsigned int ins[6];
109 unsigned int fp;
110 unsigned int callers_pc;
111 unsigned int structptr;
112 unsigned int xargs[6];
113 unsigned int xxargs[1];
114};
115
116struct sparc_trapf {
117 unsigned long locals[8];
118 unsigned long ins[8];
119 unsigned long _unused;
120 struct pt_regs *regs;
121};
122
123#define TRACEREG_SZ sizeof(struct pt_regs)
124#define STACKFRAME_SZ sizeof(struct sparc_stackf)
125
126#define TRACEREG32_SZ sizeof(struct pt_regs32)
127#define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
128
129#ifdef __KERNEL__
130
131struct global_reg_snapshot {
132 unsigned long tstate;
133 unsigned long tpc;
134 unsigned long tnpc;
135 unsigned long o7;
136 unsigned long i7;
137 struct thread_info *thread;
138 unsigned long pad1;
139 unsigned long pad2;
140};
141
142#define __ARCH_WANT_COMPAT_SYS_PTRACE
143
144#define force_successful_syscall_return() \
145do { current_thread_info()->syscall_noerror = 1; \
146} while (0)
147#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
148#define instruction_pointer(regs) ((regs)->tpc)
149#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
150#define regs_return_value(regs) ((regs)->u_regs[UREG_I0])
151#ifdef CONFIG_SMP
152extern unsigned long profile_pc(struct pt_regs *);
153#else
154#define profile_pc(regs) instruction_pointer(regs)
155#endif
156extern void show_regs(struct pt_regs *);
157extern void __show_regs(struct pt_regs *);
158#endif
159
160#else /* __ASSEMBLY__ */
161/* For assembly code. */
162#define TRACEREG_SZ 0xa0
163#define STACKFRAME_SZ 0xc0
164
165#define TRACEREG32_SZ 0x50
166#define STACKFRAME32_SZ 0x60
167#endif
168
169#ifdef __KERNEL__
170#define STACK_BIAS 2047
171#endif
172
173/* These are for pt_regs. */
174#define PT_V9_G0 0x00
175#define PT_V9_G1 0x08
176#define PT_V9_G2 0x10
177#define PT_V9_G3 0x18
178#define PT_V9_G4 0x20
179#define PT_V9_G5 0x28
180#define PT_V9_G6 0x30
181#define PT_V9_G7 0x38
182#define PT_V9_I0 0x40
183#define PT_V9_I1 0x48
184#define PT_V9_I2 0x50
185#define PT_V9_I3 0x58
186#define PT_V9_I4 0x60
187#define PT_V9_I5 0x68
188#define PT_V9_I6 0x70
189#define PT_V9_FP PT_V9_I6
190#define PT_V9_I7 0x78
191#define PT_V9_TSTATE 0x80
192#define PT_V9_TPC 0x88
193#define PT_V9_TNPC 0x90
194#define PT_V9_Y 0x98
195#define PT_V9_MAGIC 0x9c
196#define PT_TSTATE PT_V9_TSTATE
197#define PT_TPC PT_V9_TPC
198#define PT_TNPC PT_V9_TNPC
199
200/* These for pt_regs32. */
201#define PT_PSR 0x0
202#define PT_PC 0x4
203#define PT_NPC 0x8
204#define PT_Y 0xc
205#define PT_G0 0x10
206#define PT_WIM PT_G0
207#define PT_G1 0x14
208#define PT_G2 0x18
209#define PT_G3 0x1c
210#define PT_G4 0x20
211#define PT_G5 0x24
212#define PT_G6 0x28
213#define PT_G7 0x2c
214#define PT_I0 0x30
215#define PT_I1 0x34
216#define PT_I2 0x38
217#define PT_I3 0x3c
218#define PT_I4 0x40
219#define PT_I5 0x44
220#define PT_I6 0x48
221#define PT_FP PT_I6
222#define PT_I7 0x4c
223
224/* Reg_window offsets */
225#define RW_V9_L0 0x00
226#define RW_V9_L1 0x08
227#define RW_V9_L2 0x10
228#define RW_V9_L3 0x18
229#define RW_V9_L4 0x20
230#define RW_V9_L5 0x28
231#define RW_V9_L6 0x30
232#define RW_V9_L7 0x38
233#define RW_V9_I0 0x40
234#define RW_V9_I1 0x48
235#define RW_V9_I2 0x50
236#define RW_V9_I3 0x58
237#define RW_V9_I4 0x60
238#define RW_V9_I5 0x68
239#define RW_V9_I6 0x70
240#define RW_V9_I7 0x78
241
242#define RW_L0 0x00
243#define RW_L1 0x04
244#define RW_L2 0x08
245#define RW_L3 0x0c
246#define RW_L4 0x10
247#define RW_L5 0x14
248#define RW_L6 0x18
249#define RW_L7 0x1c
250#define RW_I0 0x20
251#define RW_I1 0x24
252#define RW_I2 0x28
253#define RW_I3 0x2c
254#define RW_I4 0x30
255#define RW_I5 0x34
256#define RW_I6 0x38
257#define RW_I7 0x3c
258
259/* Stack_frame offsets */
260#define SF_V9_L0 0x00
261#define SF_V9_L1 0x08
262#define SF_V9_L2 0x10
263#define SF_V9_L3 0x18
264#define SF_V9_L4 0x20
265#define SF_V9_L5 0x28
266#define SF_V9_L6 0x30
267#define SF_V9_L7 0x38
268#define SF_V9_I0 0x40
269#define SF_V9_I1 0x48
270#define SF_V9_I2 0x50
271#define SF_V9_I3 0x58
272#define SF_V9_I4 0x60
273#define SF_V9_I5 0x68
274#define SF_V9_FP 0x70
275#define SF_V9_PC 0x78
276#define SF_V9_RETP 0x80
277#define SF_V9_XARG0 0x88
278#define SF_V9_XARG1 0x90
279#define SF_V9_XARG2 0x98
280#define SF_V9_XARG3 0xa0
281#define SF_V9_XARG4 0xa8
282#define SF_V9_XARG5 0xb0
283#define SF_V9_XXARG 0xb8
284
285#define SF_L0 0x00
286#define SF_L1 0x04
287#define SF_L2 0x08
288#define SF_L3 0x0c
289#define SF_L4 0x10
290#define SF_L5 0x14
291#define SF_L6 0x18
292#define SF_L7 0x1c
293#define SF_I0 0x20
294#define SF_I1 0x24
295#define SF_I2 0x28
296#define SF_I3 0x2c
297#define SF_I4 0x30
298#define SF_I5 0x34
299#define SF_FP 0x38
300#define SF_PC 0x3c
301#define SF_RETP 0x40
302#define SF_XARG0 0x44
303#define SF_XARG1 0x48
304#define SF_XARG2 0x4c
305#define SF_XARG3 0x50
306#define SF_XARG4 0x54
307#define SF_XARG5 0x58
308#define SF_XXARG 0x5c
309
310#ifdef __KERNEL__
311
312/* global_reg_snapshot offsets */
313#define GR_SNAP_TSTATE 0x00
314#define GR_SNAP_TPC 0x08
315#define GR_SNAP_TNPC 0x10
316#define GR_SNAP_O7 0x18
317#define GR_SNAP_I7 0x20
318#define GR_SNAP_THREAD 0x28
319#define GR_SNAP_PAD1 0x30
320#define GR_SNAP_PAD2 0x38
321
322#endif /* __KERNEL__ */
323
324/* Stuff for the ptrace system call */
325#define PTRACE_SPARC_DETACH 11
326#define PTRACE_GETREGS 12
327#define PTRACE_SETREGS 13
328#define PTRACE_GETFPREGS 14
329#define PTRACE_SETFPREGS 15
330#define PTRACE_READDATA 16
331#define PTRACE_WRITEDATA 17
332#define PTRACE_READTEXT 18
333#define PTRACE_WRITETEXT 19
334#define PTRACE_GETFPAREGS 20
335#define PTRACE_SETFPAREGS 21
336
337/* There are for debugging 64-bit processes, either from a 32 or 64 bit
338 * parent. Thus their complements are for debugging 32-bit processes only.
339 */
340
341#define PTRACE_GETREGS64 22
342#define PTRACE_SETREGS64 23
343/* PTRACE_SYSCALL is 24 */
344#define PTRACE_GETFPREGS64 25
345#define PTRACE_SETFPREGS64 26
346
347#endif /* !(_SPARC64_PTRACE_H) */
diff --git a/include/asm-sparc/reboot.h b/arch/sparc/include/asm/reboot.h
index 3f3f43f5be5e..3f3f43f5be5e 100644
--- a/include/asm-sparc/reboot.h
+++ b/arch/sparc/include/asm/reboot.h
diff --git a/arch/sparc/include/asm/reg.h b/arch/sparc/include/asm/reg.h
new file mode 100644
index 000000000000..0c16e19cae4d
--- /dev/null
+++ b/arch/sparc/include/asm/reg.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_REG_H
2#define ___ASM_SPARC_REG_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/reg_64.h>
5#else
6#include <asm/reg_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/reg_32.h b/arch/sparc/include/asm/reg_32.h
new file mode 100644
index 000000000000..1efb056fb3d1
--- /dev/null
+++ b/arch/sparc/include/asm/reg_32.h
@@ -0,0 +1,79 @@
1/*
2 * linux/include/asm/reg.h
3 * Layout of the registers as expected by gdb on the Sparc
4 * we should replace the user.h definitions with those in
5 * this file, we don't even use the other
6 * -miguel
7 *
8 * The names of the structures, constants and aliases in this file
9 * have the same names as the sunos ones, some programs rely on these
10 * names (gdb for example).
11 *
12 */
13
14#ifndef __SPARC_REG_H
15#define __SPARC_REG_H
16
17struct regs {
18 int r_psr;
19#define r_ps r_psr
20 int r_pc;
21 int r_npc;
22 int r_y;
23 int r_g1;
24 int r_g2;
25 int r_g3;
26 int r_g4;
27 int r_g5;
28 int r_g6;
29 int r_g7;
30 int r_o0;
31 int r_o1;
32 int r_o2;
33 int r_o3;
34 int r_o4;
35 int r_o5;
36 int r_o6;
37 int r_o7;
38};
39
40struct fpq {
41 unsigned long *addr;
42 unsigned long instr;
43};
44
45struct fq {
46 union {
47 double whole;
48 struct fpq fpq;
49 } FQu;
50};
51
52#define FPU_REGS_TYPE unsigned int
53#define FPU_FSR_TYPE unsigned
54
55struct fp_status {
56 union {
57 FPU_REGS_TYPE Fpu_regs[32];
58 double Fpu_dregs[16];
59 } fpu_fr;
60 FPU_FSR_TYPE Fpu_fsr;
61 unsigned Fpu_flags;
62 unsigned Fpu_extra;
63 unsigned Fpu_qcnt;
64 struct fq Fpu_q[16];
65};
66
67#define fpu_regs f_fpstatus.fpu_fr.Fpu_regs
68#define fpu_dregs f_fpstatus.fpu_fr.Fpu_dregs
69#define fpu_fsr f_fpstatus.Fpu_fsr
70#define fpu_flags f_fpstatus.Fpu_flags
71#define fpu_extra f_fpstatus.Fpu_extra
72#define fpu_q f_fpstatus.Fpu_q
73#define fpu_qcnt f_fpstatus.Fpu_qcnt
74
75struct fpu {
76 struct fp_status f_fpstatus;
77};
78
79#endif /* __SPARC_REG_H */
diff --git a/arch/sparc/include/asm/reg_64.h b/arch/sparc/include/asm/reg_64.h
new file mode 100644
index 000000000000..6f277d7c7d88
--- /dev/null
+++ b/arch/sparc/include/asm/reg_64.h
@@ -0,0 +1,56 @@
1/*
2 * linux/asm/reg.h
3 * Layout of the registers as expected by gdb on the Sparc
4 * we should replace the user.h definitions with those in
5 * this file, we don't even use the other
6 * -miguel
7 *
8 * The names of the structures, constants and aliases in this file
9 * have the same names as the sunos ones, some programs rely on these
10 * names (gdb for example).
11 *
12 */
13
14#ifndef __SPARC64_REG_H
15#define __SPARC64_REG_H
16
17struct regs {
18 unsigned long r_g1;
19 unsigned long r_g2;
20 unsigned long r_g3;
21 unsigned long r_g4;
22 unsigned long r_g5;
23 unsigned long r_g6;
24 unsigned long r_g7;
25 unsigned long r_o0;
26 unsigned long r_o1;
27 unsigned long r_o2;
28 unsigned long r_o3;
29 unsigned long r_o4;
30 unsigned long r_o5;
31 unsigned long r_o6;
32 unsigned long r_o7;
33 unsigned long __pad;
34 unsigned long r_tstate;
35 unsigned long r_tpc;
36 unsigned long r_tnpc;
37 unsigned int r_y;
38 unsigned int r_fprs;
39};
40
41#define FPU_REGS_TYPE unsigned int
42#define FPU_FSR_TYPE unsigned long
43
44struct fp_status {
45 unsigned long fpu_fr[32];
46 unsigned long Fpu_fsr;
47};
48
49struct fpu {
50 struct fp_status f_fpstatus;
51};
52
53#define fpu_regs f_fpstatus.fpu_fr
54#define fpu_fsr f_fpstatus.Fpu_fsr
55
56#endif /* __SPARC64_REG_H */
diff --git a/include/asm-sparc/resource.h b/arch/sparc/include/asm/resource.h
index fe163cafb4c7..fe163cafb4c7 100644
--- a/include/asm-sparc/resource.h
+++ b/arch/sparc/include/asm/resource.h
diff --git a/include/asm-sparc/ross.h b/arch/sparc/include/asm/ross.h
index ecb6e81786a6..ecb6e81786a6 100644
--- a/include/asm-sparc/ross.h
+++ b/arch/sparc/include/asm/ross.h
diff --git a/include/asm-sparc/rtc.h b/arch/sparc/include/asm/rtc.h
index f9ecb1fe2ecd..f9ecb1fe2ecd 100644
--- a/include/asm-sparc/rtc.h
+++ b/arch/sparc/include/asm/rtc.h
diff --git a/include/asm-sparc/rwsem-const.h b/arch/sparc/include/asm/rwsem-const.h
index a303c9d64d84..a303c9d64d84 100644
--- a/include/asm-sparc/rwsem-const.h
+++ b/arch/sparc/include/asm/rwsem-const.h
diff --git a/include/asm-sparc/rwsem.h b/arch/sparc/include/asm/rwsem.h
index 1dc129ac2feb..1dc129ac2feb 100644
--- a/include/asm-sparc/rwsem.h
+++ b/arch/sparc/include/asm/rwsem.h
diff --git a/include/asm-sparc/sbi.h b/arch/sparc/include/asm/sbi.h
index 5eb7f1965d33..5eb7f1965d33 100644
--- a/include/asm-sparc/sbi.h
+++ b/arch/sparc/include/asm/sbi.h
diff --git a/arch/sparc/include/asm/sbus.h b/arch/sparc/include/asm/sbus.h
new file mode 100644
index 000000000000..f82481ab44db
--- /dev/null
+++ b/arch/sparc/include/asm/sbus.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_SBUS_H
2#define ___ASM_SPARC_SBUS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/sbus_64.h>
5#else
6#include <asm/sbus_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/sbus_32.h b/arch/sparc/include/asm/sbus_32.h
index 77b5d3aadc99..77b5d3aadc99 100644
--- a/include/asm-sparc/sbus_32.h
+++ b/arch/sparc/include/asm/sbus_32.h
diff --git a/include/asm-sparc/sbus_64.h b/arch/sparc/include/asm/sbus_64.h
index 0e16b6dd7e96..0e16b6dd7e96 100644
--- a/include/asm-sparc/sbus_64.h
+++ b/arch/sparc/include/asm/sbus_64.h
diff --git a/arch/sparc/include/asm/scatterlist.h b/arch/sparc/include/asm/scatterlist.h
new file mode 100644
index 000000000000..ec21a4517641
--- /dev/null
+++ b/arch/sparc/include/asm/scatterlist.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_SCATTERLIST_H
2#define ___ASM_SPARC_SCATTERLIST_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/scatterlist_64.h>
5#else
6#include <asm/scatterlist_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/scatterlist_32.h b/arch/sparc/include/asm/scatterlist_32.h
index c82609ca1d0f..c82609ca1d0f 100644
--- a/include/asm-sparc/scatterlist_32.h
+++ b/arch/sparc/include/asm/scatterlist_32.h
diff --git a/include/asm-sparc/scatterlist_64.h b/arch/sparc/include/asm/scatterlist_64.h
index 81bd058f9382..81bd058f9382 100644
--- a/include/asm-sparc/scatterlist_64.h
+++ b/arch/sparc/include/asm/scatterlist_64.h
diff --git a/include/asm-sparc/scratchpad.h b/arch/sparc/include/asm/scratchpad.h
index 5e8b01fb3343..5e8b01fb3343 100644
--- a/include/asm-sparc/scratchpad.h
+++ b/arch/sparc/include/asm/scratchpad.h
diff --git a/include/asm-sparc/seccomp.h b/arch/sparc/include/asm/seccomp.h
index 7fcd9968192b..7fcd9968192b 100644
--- a/include/asm-sparc/seccomp.h
+++ b/arch/sparc/include/asm/seccomp.h
diff --git a/arch/sparc/include/asm/sections.h b/arch/sparc/include/asm/sections.h
new file mode 100644
index 000000000000..c7c69b00967f
--- /dev/null
+++ b/arch/sparc/include/asm/sections.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_SECTIONS_H
2#define ___ASM_SPARC_SECTIONS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/sections_64.h>
5#else
6#include <asm/sections_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/sections_32.h b/arch/sparc/include/asm/sections_32.h
index 6832841df051..6832841df051 100644
--- a/include/asm-sparc/sections_32.h
+++ b/arch/sparc/include/asm/sections_32.h
diff --git a/include/asm-sparc/sections_64.h b/arch/sparc/include/asm/sections_64.h
index 3f4b9fdc28d0..3f4b9fdc28d0 100644
--- a/include/asm-sparc/sections_64.h
+++ b/arch/sparc/include/asm/sections_64.h
diff --git a/include/asm-sparc/sembuf.h b/arch/sparc/include/asm/sembuf.h
index faee1be08d67..faee1be08d67 100644
--- a/include/asm-sparc/sembuf.h
+++ b/arch/sparc/include/asm/sembuf.h
diff --git a/include/asm-sparc/setup.h b/arch/sparc/include/asm/setup.h
index 2643c62f4ac0..2643c62f4ac0 100644
--- a/include/asm-sparc/setup.h
+++ b/arch/sparc/include/asm/setup.h
diff --git a/include/asm-sparc/sfafsr.h b/arch/sparc/include/asm/sfafsr.h
index e96137b04a4f..e96137b04a4f 100644
--- a/include/asm-sparc/sfafsr.h
+++ b/arch/sparc/include/asm/sfafsr.h
diff --git a/arch/sparc/include/asm/sfp-machine.h b/arch/sparc/include/asm/sfp-machine.h
new file mode 100644
index 000000000000..4ebc3823ed4f
--- /dev/null
+++ b/arch/sparc/include/asm/sfp-machine.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_SFP_MACHINE_H
2#define ___ASM_SPARC_SFP_MACHINE_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/sfp-machine_64.h>
5#else
6#include <asm/sfp-machine_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/sfp-machine_32.h b/arch/sparc/include/asm/sfp-machine_32.h
index 01d9c3b5a73b..01d9c3b5a73b 100644
--- a/include/asm-sparc/sfp-machine_32.h
+++ b/arch/sparc/include/asm/sfp-machine_32.h
diff --git a/include/asm-sparc/sfp-machine_64.h b/arch/sparc/include/asm/sfp-machine_64.h
index ca913ef40bd5..ca913ef40bd5 100644
--- a/include/asm-sparc/sfp-machine_64.h
+++ b/arch/sparc/include/asm/sfp-machine_64.h
diff --git a/include/asm-sparc/shmbuf.h b/arch/sparc/include/asm/shmbuf.h
index 83a16055363f..83a16055363f 100644
--- a/include/asm-sparc/shmbuf.h
+++ b/arch/sparc/include/asm/shmbuf.h
diff --git a/arch/sparc/include/asm/shmparam.h b/arch/sparc/include/asm/shmparam.h
new file mode 100644
index 000000000000..8bf0cfe0694f
--- /dev/null
+++ b/arch/sparc/include/asm/shmparam.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_SHMPARAM_H
2#define ___ASM_SPARC_SHMPARAM_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/shmparam_64.h>
5#else
6#include <asm/shmparam_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/shmparam_32.h b/arch/sparc/include/asm/shmparam_32.h
index 59a1243c12f3..59a1243c12f3 100644
--- a/include/asm-sparc/shmparam_32.h
+++ b/arch/sparc/include/asm/shmparam_32.h
diff --git a/include/asm-sparc/shmparam_64.h b/arch/sparc/include/asm/shmparam_64.h
index 1ed0d6701a9b..1ed0d6701a9b 100644
--- a/include/asm-sparc/shmparam_64.h
+++ b/arch/sparc/include/asm/shmparam_64.h
diff --git a/arch/sparc/include/asm/sigcontext.h b/arch/sparc/include/asm/sigcontext.h
new file mode 100644
index 000000000000..e92de7e286b5
--- /dev/null
+++ b/arch/sparc/include/asm/sigcontext.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_SIGCONTEXT_H
2#define ___ASM_SPARC_SIGCONTEXT_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/sigcontext_64.h>
5#else
6#include <asm/sigcontext_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/sigcontext_32.h b/arch/sparc/include/asm/sigcontext_32.h
index c5fb60dcbd75..c5fb60dcbd75 100644
--- a/include/asm-sparc/sigcontext_32.h
+++ b/arch/sparc/include/asm/sigcontext_32.h
diff --git a/include/asm-sparc/sigcontext_64.h b/arch/sparc/include/asm/sigcontext_64.h
index 1c868d680cfc..1c868d680cfc 100644
--- a/include/asm-sparc/sigcontext_64.h
+++ b/arch/sparc/include/asm/sigcontext_64.h
diff --git a/arch/sparc/include/asm/siginfo.h b/arch/sparc/include/asm/siginfo.h
new file mode 100644
index 000000000000..bd81f8d7f5ce
--- /dev/null
+++ b/arch/sparc/include/asm/siginfo.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_SIGINFO_H
2#define ___ASM_SPARC_SIGINFO_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/siginfo_64.h>
5#else
6#include <asm/siginfo_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/siginfo_32.h b/arch/sparc/include/asm/siginfo_32.h
index 3c71af135c52..3c71af135c52 100644
--- a/include/asm-sparc/siginfo_32.h
+++ b/arch/sparc/include/asm/siginfo_32.h
diff --git a/include/asm-sparc/siginfo_64.h b/arch/sparc/include/asm/siginfo_64.h
index c96e6c30f8b0..c96e6c30f8b0 100644
--- a/include/asm-sparc/siginfo_64.h
+++ b/arch/sparc/include/asm/siginfo_64.h
diff --git a/arch/sparc/include/asm/signal.h b/arch/sparc/include/asm/signal.h
new file mode 100644
index 000000000000..27ab05dc203e
--- /dev/null
+++ b/arch/sparc/include/asm/signal.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_SIGNAL_H
2#define ___ASM_SPARC_SIGNAL_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/signal_64.h>
5#else
6#include <asm/signal_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/signal_32.h b/arch/sparc/include/asm/signal_32.h
index 96a60ab03ca1..96a60ab03ca1 100644
--- a/include/asm-sparc/signal_32.h
+++ b/arch/sparc/include/asm/signal_32.h
diff --git a/include/asm-sparc/signal_64.h b/arch/sparc/include/asm/signal_64.h
index ab1509a101c5..ab1509a101c5 100644
--- a/include/asm-sparc/signal_64.h
+++ b/arch/sparc/include/asm/signal_64.h
diff --git a/arch/sparc/include/asm/smp.h b/arch/sparc/include/asm/smp.h
new file mode 100644
index 000000000000..b59672d0e19b
--- /dev/null
+++ b/arch/sparc/include/asm/smp.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_SMP_H
2#define ___ASM_SPARC_SMP_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/smp_64.h>
5#else
6#include <asm/smp_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/smp_32.h b/arch/sparc/include/asm/smp_32.h
index 7201752cf934..7201752cf934 100644
--- a/include/asm-sparc/smp_32.h
+++ b/arch/sparc/include/asm/smp_32.h
diff --git a/include/asm-sparc/smp_64.h b/arch/sparc/include/asm/smp_64.h
index 57224dd37b3a..57224dd37b3a 100644
--- a/include/asm-sparc/smp_64.h
+++ b/arch/sparc/include/asm/smp_64.h
diff --git a/include/asm-sparc/smpprim.h b/arch/sparc/include/asm/smpprim.h
index eb849d862c64..eb849d862c64 100644
--- a/include/asm-sparc/smpprim.h
+++ b/arch/sparc/include/asm/smpprim.h
diff --git a/include/asm-sparc/socket.h b/arch/sparc/include/asm/socket.h
index bf50d0c2d583..bf50d0c2d583 100644
--- a/include/asm-sparc/socket.h
+++ b/arch/sparc/include/asm/socket.h
diff --git a/include/asm-sparc/sockios.h b/arch/sparc/include/asm/sockios.h
index 990ea746486b..990ea746486b 100644
--- a/include/asm-sparc/sockios.h
+++ b/arch/sparc/include/asm/sockios.h
diff --git a/include/asm-sparc/sparsemem.h b/arch/sparc/include/asm/sparsemem.h
index b99d4e4b6d28..b99d4e4b6d28 100644
--- a/include/asm-sparc/sparsemem.h
+++ b/arch/sparc/include/asm/sparsemem.h
diff --git a/arch/sparc/include/asm/spinlock.h b/arch/sparc/include/asm/spinlock.h
new file mode 100644
index 000000000000..f276b0036b2c
--- /dev/null
+++ b/arch/sparc/include/asm/spinlock.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_SPINLOCK_H
2#define ___ASM_SPARC_SPINLOCK_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/spinlock_64.h>
5#else
6#include <asm/spinlock_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/spinlock_32.h b/arch/sparc/include/asm/spinlock_32.h
index de2249b267c6..de2249b267c6 100644
--- a/include/asm-sparc/spinlock_32.h
+++ b/arch/sparc/include/asm/spinlock_32.h
diff --git a/include/asm-sparc/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h
index 0006fe9f8c7a..0006fe9f8c7a 100644
--- a/include/asm-sparc/spinlock_64.h
+++ b/arch/sparc/include/asm/spinlock_64.h
diff --git a/include/asm-sparc/spinlock_types.h b/arch/sparc/include/asm/spinlock_types.h
index 37cbe01c585b..37cbe01c585b 100644
--- a/include/asm-sparc/spinlock_types.h
+++ b/arch/sparc/include/asm/spinlock_types.h
diff --git a/include/asm-sparc/spitfire.h b/arch/sparc/include/asm/spitfire.h
index 985ea7e31992..985ea7e31992 100644
--- a/include/asm-sparc/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
diff --git a/include/asm-sparc/sstate.h b/arch/sparc/include/asm/sstate.h
index a7c35dbcb281..a7c35dbcb281 100644
--- a/include/asm-sparc/sstate.h
+++ b/arch/sparc/include/asm/sstate.h
diff --git a/include/asm-sparc/stacktrace.h b/arch/sparc/include/asm/stacktrace.h
index 6cee39adf6d6..6cee39adf6d6 100644
--- a/include/asm-sparc/stacktrace.h
+++ b/arch/sparc/include/asm/stacktrace.h
diff --git a/include/asm-sparc/starfire.h b/arch/sparc/include/asm/starfire.h
index 07bafd31e33c..07bafd31e33c 100644
--- a/include/asm-sparc/starfire.h
+++ b/arch/sparc/include/asm/starfire.h
diff --git a/arch/sparc/include/asm/stat.h b/arch/sparc/include/asm/stat.h
new file mode 100644
index 000000000000..d8153013df72
--- /dev/null
+++ b/arch/sparc/include/asm/stat.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_STAT_H
2#define ___ASM_SPARC_STAT_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/stat_64.h>
5#else
6#include <asm/stat_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/stat_32.h b/arch/sparc/include/asm/stat_32.h
index 2299e1d5d94c..2299e1d5d94c 100644
--- a/include/asm-sparc/stat_32.h
+++ b/arch/sparc/include/asm/stat_32.h
diff --git a/include/asm-sparc/stat_64.h b/arch/sparc/include/asm/stat_64.h
index 9650fdea847f..9650fdea847f 100644
--- a/include/asm-sparc/stat_64.h
+++ b/arch/sparc/include/asm/stat_64.h
diff --git a/arch/sparc/include/asm/statfs.h b/arch/sparc/include/asm/statfs.h
new file mode 100644
index 000000000000..5e937a73743d
--- /dev/null
+++ b/arch/sparc/include/asm/statfs.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_STATFS_H
2#define ___ASM_SPARC_STATFS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/statfs_64.h>
5#else
6#include <asm/statfs_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/statfs_32.h b/arch/sparc/include/asm/statfs_32.h
index 304520fa8863..304520fa8863 100644
--- a/include/asm-sparc/statfs_32.h
+++ b/arch/sparc/include/asm/statfs_32.h
diff --git a/include/asm-sparc/statfs_64.h b/arch/sparc/include/asm/statfs_64.h
index 79b3c890a5fa..79b3c890a5fa 100644
--- a/include/asm-sparc/statfs_64.h
+++ b/arch/sparc/include/asm/statfs_64.h
diff --git a/arch/sparc/include/asm/string.h b/arch/sparc/include/asm/string.h
new file mode 100644
index 000000000000..98b72a0c8e6e
--- /dev/null
+++ b/arch/sparc/include/asm/string.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_STRING_H
2#define ___ASM_SPARC_STRING_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/string_64.h>
5#else
6#include <asm/string_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/string_32.h b/arch/sparc/include/asm/string_32.h
index 6c5fddb7e6b5..6c5fddb7e6b5 100644
--- a/include/asm-sparc/string_32.h
+++ b/arch/sparc/include/asm/string_32.h
diff --git a/include/asm-sparc/string_64.h b/arch/sparc/include/asm/string_64.h
index 43161f2d17eb..43161f2d17eb 100644
--- a/include/asm-sparc/string_64.h
+++ b/arch/sparc/include/asm/string_64.h
diff --git a/include/asm-sparc/sun4paddr.h b/arch/sparc/include/asm/sun4paddr.h
index d52985f19f42..d52985f19f42 100644
--- a/include/asm-sparc/sun4paddr.h
+++ b/arch/sparc/include/asm/sun4paddr.h
diff --git a/include/asm-sparc/sun4prom.h b/arch/sparc/include/asm/sun4prom.h
index 9c8b4cbf629a..9c8b4cbf629a 100644
--- a/include/asm-sparc/sun4prom.h
+++ b/arch/sparc/include/asm/sun4prom.h
diff --git a/arch/sparc/include/asm/sunbpp.h b/arch/sparc/include/asm/sunbpp.h
new file mode 100644
index 000000000000..d81a02eaf78b
--- /dev/null
+++ b/arch/sparc/include/asm/sunbpp.h
@@ -0,0 +1,80 @@
1/*
2 * include/asm/sunbpp.h
3 */
4
5#ifndef _ASM_SPARC_SUNBPP_H
6#define _ASM_SPARC_SUNBPP_H
7
8struct bpp_regs {
9 /* DMA registers */
10 __volatile__ __u32 p_csr; /* DMA Control/Status Register */
11 __volatile__ __u32 p_addr; /* Address Register */
12 __volatile__ __u32 p_bcnt; /* Byte Count Register */
13 __volatile__ __u32 p_tst_csr; /* Test Control/Status (DMA2 only) */
14 /* Parallel Port registers */
15 __volatile__ __u16 p_hcr; /* Hardware Configuration Register */
16 __volatile__ __u16 p_ocr; /* Operation Configuration Register */
17 __volatile__ __u8 p_dr; /* Parallel Data Register */
18 __volatile__ __u8 p_tcr; /* Transfer Control Register */
19 __volatile__ __u8 p_or; /* Output Register */
20 __volatile__ __u8 p_ir; /* Input Register */
21 __volatile__ __u16 p_icr; /* Interrupt Control Register */
22};
23
24/* P_HCR. Time is in increments of SBus clock. */
25#define P_HCR_TEST 0x8000 /* Allows buried counters to be read */
26#define P_HCR_DSW 0x7f00 /* Data strobe width (in ticks) */
27#define P_HCR_DDS 0x007f /* Data setup before strobe (in ticks) */
28
29/* P_OCR. */
30#define P_OCR_MEM_CLR 0x8000
31#define P_OCR_DATA_SRC 0x4000 /* ) */
32#define P_OCR_DS_DSEL 0x2000 /* ) Bidirectional */
33#define P_OCR_BUSY_DSEL 0x1000 /* ) selects */
34#define P_OCR_ACK_DSEL 0x0800 /* ) */
35#define P_OCR_EN_DIAG 0x0400
36#define P_OCR_BUSY_OP 0x0200 /* Busy operation */
37#define P_OCR_ACK_OP 0x0100 /* Ack operation */
38#define P_OCR_SRST 0x0080 /* Reset state machines. Not selfcleaning. */
39#define P_OCR_IDLE 0x0008 /* PP data transfer state machine is idle */
40#define P_OCR_V_ILCK 0x0002 /* Versatec faded. Zebra only. */
41#define P_OCR_EN_VER 0x0001 /* Enable Versatec (0 - enable). Zebra only. */
42
43/* P_TCR */
44#define P_TCR_DIR 0x08
45#define P_TCR_BUSY 0x04
46#define P_TCR_ACK 0x02
47#define P_TCR_DS 0x01 /* Strobe */
48
49/* P_OR */
50#define P_OR_V3 0x20 /* ) */
51#define P_OR_V2 0x10 /* ) on Zebra only */
52#define P_OR_V1 0x08 /* ) */
53#define P_OR_INIT 0x04
54#define P_OR_AFXN 0x02 /* Auto Feed */
55#define P_OR_SLCT_IN 0x01
56
57/* P_IR */
58#define P_IR_PE 0x04
59#define P_IR_SLCT 0x02
60#define P_IR_ERR 0x01
61
62/* P_ICR */
63#define P_DS_IRQ 0x8000 /* RW1 */
64#define P_ACK_IRQ 0x4000 /* RW1 */
65#define P_BUSY_IRQ 0x2000 /* RW1 */
66#define P_PE_IRQ 0x1000 /* RW1 */
67#define P_SLCT_IRQ 0x0800 /* RW1 */
68#define P_ERR_IRQ 0x0400 /* RW1 */
69#define P_DS_IRQ_EN 0x0200 /* RW Always on rising edge */
70#define P_ACK_IRQ_EN 0x0100 /* RW Always on rising edge */
71#define P_BUSY_IRP 0x0080 /* RW 1= rising edge */
72#define P_BUSY_IRQ_EN 0x0040 /* RW */
73#define P_PE_IRP 0x0020 /* RW 1= rising edge */
74#define P_PE_IRQ_EN 0x0010 /* RW */
75#define P_SLCT_IRP 0x0008 /* RW 1= rising edge */
76#define P_SLCT_IRQ_EN 0x0004 /* RW */
77#define P_ERR_IRP 0x0002 /* RW1 1= rising edge */
78#define P_ERR_IRQ_EN 0x0001 /* RW */
79
80#endif /* !(_ASM_SPARC_SUNBPP_H) */
diff --git a/include/asm-sparc/swift.h b/arch/sparc/include/asm/swift.h
index e535061bf755..e535061bf755 100644
--- a/include/asm-sparc/swift.h
+++ b/arch/sparc/include/asm/swift.h
diff --git a/arch/sparc/include/asm/syscall.h b/arch/sparc/include/asm/syscall.h
new file mode 100644
index 000000000000..7486c605e23c
--- /dev/null
+++ b/arch/sparc/include/asm/syscall.h
@@ -0,0 +1,120 @@
1#ifndef __ASM_SPARC_SYSCALL_H
2#define __ASM_SPARC_SYSCALL_H
3
4#include <linux/kernel.h>
5#include <linux/sched.h>
6#include <asm/ptrace.h>
7
8/* The system call number is given by the user in %g1 */
9static inline long syscall_get_nr(struct task_struct *task,
10 struct pt_regs *regs)
11{
12 int syscall_p = pt_regs_is_syscall(regs);
13
14 return (syscall_p ? regs->u_regs[UREG_G1] : -1L);
15}
16
17static inline void syscall_rollback(struct task_struct *task,
18 struct pt_regs *regs)
19{
20 /* XXX This needs some thought. On Sparc we don't
21 * XXX save away the original %o0 value somewhere.
22 * XXX Instead we hold it in register %l5 at the top
23 * XXX level trap frame and pass this down to the signal
24 * XXX dispatch code which is the only place that value
25 * XXX ever was needed.
26 */
27}
28
29#ifdef CONFIG_SPARC32
30static inline bool syscall_has_error(struct pt_regs *regs)
31{
32 return (regs->psr & PSR_C) ? true : false;
33}
34static inline void syscall_set_error(struct pt_regs *regs)
35{
36 regs->psr |= PSR_C;
37}
38static inline void syscall_clear_error(struct pt_regs *regs)
39{
40 regs->psr &= ~PSR_C;
41}
42#else
43static inline bool syscall_has_error(struct pt_regs *regs)
44{
45 return (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY)) ? true : false;
46}
47static inline void syscall_set_error(struct pt_regs *regs)
48{
49 regs->tstate |= (TSTATE_XCARRY | TSTATE_ICARRY);
50}
51static inline void syscall_clear_error(struct pt_regs *regs)
52{
53 regs->tstate &= ~(TSTATE_XCARRY | TSTATE_ICARRY);
54}
55#endif
56
57static inline long syscall_get_error(struct task_struct *task,
58 struct pt_regs *regs)
59{
60 long val = regs->u_regs[UREG_I0];
61
62 return (syscall_has_error(regs) ? -val : 0);
63}
64
65static inline long syscall_get_return_value(struct task_struct *task,
66 struct pt_regs *regs)
67{
68 long val = regs->u_regs[UREG_I0];
69
70 return val;
71}
72
73static inline void syscall_set_return_value(struct task_struct *task,
74 struct pt_regs *regs,
75 int error, long val)
76{
77 if (error) {
78 syscall_set_error(regs);
79 regs->u_regs[UREG_I0] = -error;
80 } else {
81 syscall_clear_error(regs);
82 regs->u_regs[UREG_I0] = val;
83 }
84}
85
86static inline void syscall_get_arguments(struct task_struct *task,
87 struct pt_regs *regs,
88 unsigned int i, unsigned int n,
89 unsigned long *args)
90{
91 int zero_extend = 0;
92 unsigned int j;
93
94#ifdef CONFIG_SPARC64
95 if (test_tsk_thread_flag(task, TIF_32BIT))
96 zero_extend = 1;
97#endif
98
99 for (j = 0; j < n; j++) {
100 unsigned long val = regs->u_regs[UREG_I0 + i + j];
101
102 if (zero_extend)
103 args[j] = (u32) val;
104 else
105 args[j] = val;
106 }
107}
108
109static inline void syscall_set_arguments(struct task_struct *task,
110 struct pt_regs *regs,
111 unsigned int i, unsigned int n,
112 const unsigned long *args)
113{
114 unsigned int j;
115
116 for (j = 0; j < n; j++)
117 regs->u_regs[UREG_I0 + i + j] = args[j];
118}
119
120#endif /* __ASM_SPARC_SYSCALL_H */
diff --git a/include/asm-sparc/syscalls.h b/arch/sparc/include/asm/syscalls.h
index 45a43f637a14..45a43f637a14 100644
--- a/include/asm-sparc/syscalls.h
+++ b/arch/sparc/include/asm/syscalls.h
diff --git a/include/asm-sparc/sysen.h b/arch/sparc/include/asm/sysen.h
index 6af34abde6e7..6af34abde6e7 100644
--- a/include/asm-sparc/sysen.h
+++ b/arch/sparc/include/asm/sysen.h
diff --git a/arch/sparc/include/asm/system.h b/arch/sparc/include/asm/system.h
new file mode 100644
index 000000000000..7944a7cfc996
--- /dev/null
+++ b/arch/sparc/include/asm/system.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_SYSTEM_H
2#define ___ASM_SPARC_SYSTEM_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/system_64.h>
5#else
6#include <asm/system_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/system_32.h b/arch/sparc/include/asm/system_32.h
index b4b024445fc9..b4b024445fc9 100644
--- a/include/asm-sparc/system_32.h
+++ b/arch/sparc/include/asm/system_32.h
diff --git a/include/asm-sparc/system_64.h b/arch/sparc/include/asm/system_64.h
index db9e742a406a..db9e742a406a 100644
--- a/include/asm-sparc/system_64.h
+++ b/arch/sparc/include/asm/system_64.h
diff --git a/include/asm-sparc/termbits.h b/arch/sparc/include/asm/termbits.h
index d6ca3e2754f5..d6ca3e2754f5 100644
--- a/include/asm-sparc/termbits.h
+++ b/arch/sparc/include/asm/termbits.h
diff --git a/include/asm-sparc/termios.h b/arch/sparc/include/asm/termios.h
index e8ba95399643..e8ba95399643 100644
--- a/include/asm-sparc/termios.h
+++ b/arch/sparc/include/asm/termios.h
diff --git a/arch/sparc/include/asm/thread_info.h b/arch/sparc/include/asm/thread_info.h
new file mode 100644
index 000000000000..122d7acc07e6
--- /dev/null
+++ b/arch/sparc/include/asm/thread_info.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_THREAD_INFO_H
2#define ___ASM_SPARC_THREAD_INFO_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/thread_info_64.h>
5#else
6#include <asm/thread_info_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
new file mode 100644
index 000000000000..cbb892d0dff0
--- /dev/null
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -0,0 +1,158 @@
1/*
2 * thread_info.h: sparc low-level thread information
3 * adapted from the ppc version by Pete Zaitcev, which was
4 * adapted from the i386 version by Paul Mackerras
5 *
6 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
7 * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
8 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
9 */
10
11#ifndef _ASM_THREAD_INFO_H
12#define _ASM_THREAD_INFO_H
13
14#ifdef __KERNEL__
15
16#ifndef __ASSEMBLY__
17
18#include <asm/btfixup.h>
19#include <asm/ptrace.h>
20#include <asm/page.h>
21
22/*
23 * Low level task data.
24 *
25 * If you change this, change the TI_* offsets below to match.
26 */
27#define NSWINS 8
28struct thread_info {
29 unsigned long uwinmask;
30 struct task_struct *task; /* main task structure */
31 struct exec_domain *exec_domain; /* execution domain */
32 unsigned long flags; /* low level flags */
33 int cpu; /* cpu we're on */
34 int preempt_count; /* 0 => preemptable,
35 <0 => BUG */
36 int softirq_count;
37 int hardirq_count;
38
39 /* Context switch saved kernel state. */
40 unsigned long ksp; /* ... ksp __attribute__ ((aligned (8))); */
41 unsigned long kpc;
42 unsigned long kpsr;
43 unsigned long kwim;
44
45 /* A place to store user windows and stack pointers
46 * when the stack needs inspection.
47 */
48 struct reg_window reg_window[NSWINS]; /* align for ldd! */
49 unsigned long rwbuf_stkptrs[NSWINS];
50 unsigned long w_saved;
51
52 struct restart_block restart_block;
53};
54
55/*
56 * macros/functions for gaining access to the thread information structure
57 *
58 * preempt_count needs to be 1 initially, until the scheduler is functional.
59 */
60#define INIT_THREAD_INFO(tsk) \
61{ \
62 .uwinmask = 0, \
63 .task = &tsk, \
64 .exec_domain = &default_exec_domain, \
65 .flags = 0, \
66 .cpu = 0, \
67 .preempt_count = 1, \
68 .restart_block = { \
69 .fn = do_no_restart_syscall, \
70 }, \
71}
72
73#define init_thread_info (init_thread_union.thread_info)
74#define init_stack (init_thread_union.stack)
75
76/* how to get the thread information struct from C */
77register struct thread_info *current_thread_info_reg asm("g6");
78#define current_thread_info() (current_thread_info_reg)
79
80/*
81 * thread information allocation
82 */
83#if PAGE_SHIFT == 13
84#define THREAD_INFO_ORDER 0
85#else /* PAGE_SHIFT */
86#define THREAD_INFO_ORDER 1
87#endif
88
89#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
90
91BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info, void)
92#define alloc_thread_info(tsk) BTFIXUP_CALL(alloc_thread_info)()
93
94BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
95#define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti)
96
97#endif /* __ASSEMBLY__ */
98
99/*
100 * Size of kernel stack for each process.
101 * Observe the order of get_free_pages() in alloc_thread_info().
102 * The sun4 has 8K stack too, because it's short on memory, and 16K is a waste.
103 */
104#define THREAD_SIZE 8192
105
106/*
107 * Offsets in thread_info structure, used in assembly code
108 * The "#define REGWIN_SZ 0x40" was abolished, so no multiplications.
109 */
110#define TI_UWINMASK 0x00 /* uwinmask */
111#define TI_TASK 0x04
112#define TI_EXECDOMAIN 0x08 /* exec_domain */
113#define TI_FLAGS 0x0c
114#define TI_CPU 0x10
115#define TI_PREEMPT 0x14 /* preempt_count */
116#define TI_SOFTIRQ 0x18 /* softirq_count */
117#define TI_HARDIRQ 0x1c /* hardirq_count */
118#define TI_KSP 0x20 /* ksp */
119#define TI_KPC 0x24 /* kpc (ldd'ed with kpc) */
120#define TI_KPSR 0x28 /* kpsr */
121#define TI_KWIM 0x2c /* kwim (ldd'ed with kpsr) */
122#define TI_REG_WINDOW 0x30
123#define TI_RWIN_SPTRS 0x230
124#define TI_W_SAVED 0x250
125/* #define TI_RESTART_BLOCK 0x25n */ /* Nobody cares */
126
127#define PREEMPT_ACTIVE 0x4000000
128
129/*
130 * thread information flag bit numbers
131 */
132#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
133#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
134#define TIF_SIGPENDING 2 /* signal pending */
135#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
136#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
137#define TIF_USEDFPU 8 /* FPU was used by this task
138 * this quantum (SMP) */
139#define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling
140 * TIF_NEED_RESCHED */
141#define TIF_MEMDIE 10
142
143/* as above, but as bit values */
144#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
145#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
146#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
147#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
148#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
149#define _TIF_USEDFPU (1<<TIF_USEDFPU)
150#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
151
152#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \
153 _TIF_SIGPENDING | \
154 _TIF_RESTORE_SIGMASK)
155
156#endif /* __KERNEL__ */
157
158#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
new file mode 100644
index 000000000000..c0a737d7292c
--- /dev/null
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -0,0 +1,281 @@
1/* thread_info.h: sparc64 low-level thread information
2 *
3 * Copyright (C) 2002 David S. Miller (davem@redhat.com)
4 */
5
6#ifndef _ASM_THREAD_INFO_H
7#define _ASM_THREAD_INFO_H
8
9#ifdef __KERNEL__
10
11#define NSWINS 7
12
13#define TI_FLAG_BYTE_FAULT_CODE 0
14#define TI_FLAG_FAULT_CODE_SHIFT 56
15#define TI_FLAG_BYTE_WSTATE 1
16#define TI_FLAG_WSTATE_SHIFT 48
17#define TI_FLAG_BYTE_CWP 2
18#define TI_FLAG_CWP_SHIFT 40
19#define TI_FLAG_BYTE_CURRENT_DS 3
20#define TI_FLAG_CURRENT_DS_SHIFT 32
21#define TI_FLAG_BYTE_FPDEPTH 4
22#define TI_FLAG_FPDEPTH_SHIFT 24
23#define TI_FLAG_BYTE_WSAVED 5
24#define TI_FLAG_WSAVED_SHIFT 16
25
26#include <asm/page.h>
27
28#ifndef __ASSEMBLY__
29
30#include <asm/ptrace.h>
31#include <asm/types.h>
32
33struct task_struct;
34struct exec_domain;
35
36struct thread_info {
37 /* D$ line 1 */
38 struct task_struct *task;
39 unsigned long flags;
40 __u8 fpsaved[7];
41 __u8 status;
42 unsigned long ksp;
43
44 /* D$ line 2 */
45 unsigned long fault_address;
46 struct pt_regs *kregs;
47 struct exec_domain *exec_domain;
48 int preempt_count; /* 0 => preemptable, <0 => BUG */
49 __u8 new_child;
50 __u8 syscall_noerror;
51 __u16 cpu;
52
53 unsigned long *utraps;
54
55 struct reg_window reg_window[NSWINS];
56 unsigned long rwbuf_stkptrs[NSWINS];
57
58 unsigned long gsr[7];
59 unsigned long xfsr[7];
60
61 __u64 __user *user_cntd0;
62 __u64 __user *user_cntd1;
63 __u64 kernel_cntd0, kernel_cntd1;
64 __u64 pcr_reg;
65
66 struct restart_block restart_block;
67
68 struct pt_regs *kern_una_regs;
69 unsigned int kern_una_insn;
70
71 unsigned long fpregs[0] __attribute__ ((aligned(64)));
72};
73
74#endif /* !(__ASSEMBLY__) */
75
76/* offsets into the thread_info struct for assembly code access */
77#define TI_TASK 0x00000000
78#define TI_FLAGS 0x00000008
79#define TI_FAULT_CODE (TI_FLAGS + TI_FLAG_BYTE_FAULT_CODE)
80#define TI_WSTATE (TI_FLAGS + TI_FLAG_BYTE_WSTATE)
81#define TI_CWP (TI_FLAGS + TI_FLAG_BYTE_CWP)
82#define TI_CURRENT_DS (TI_FLAGS + TI_FLAG_BYTE_CURRENT_DS)
83#define TI_FPDEPTH (TI_FLAGS + TI_FLAG_BYTE_FPDEPTH)
84#define TI_WSAVED (TI_FLAGS + TI_FLAG_BYTE_WSAVED)
85#define TI_FPSAVED 0x00000010
86#define TI_KSP 0x00000018
87#define TI_FAULT_ADDR 0x00000020
88#define TI_KREGS 0x00000028
89#define TI_EXEC_DOMAIN 0x00000030
90#define TI_PRE_COUNT 0x00000038
91#define TI_NEW_CHILD 0x0000003c
92#define TI_SYS_NOERROR 0x0000003d
93#define TI_CPU 0x0000003e
94#define TI_UTRAPS 0x00000040
95#define TI_REG_WINDOW 0x00000048
96#define TI_RWIN_SPTRS 0x000003c8
97#define TI_GSR 0x00000400
98#define TI_XFSR 0x00000438
99#define TI_USER_CNTD0 0x00000470
100#define TI_USER_CNTD1 0x00000478
101#define TI_KERN_CNTD0 0x00000480
102#define TI_KERN_CNTD1 0x00000488
103#define TI_PCR 0x00000490
104#define TI_RESTART_BLOCK 0x00000498
105#define TI_KUNA_REGS 0x000004c0
106#define TI_KUNA_INSN 0x000004c8
107#define TI_FPREGS 0x00000500
108
109/* We embed this in the uppermost byte of thread_info->flags */
110#define FAULT_CODE_WRITE 0x01 /* Write access, implies D-TLB */
111#define FAULT_CODE_DTLB 0x02 /* Miss happened in D-TLB */
112#define FAULT_CODE_ITLB 0x04 /* Miss happened in I-TLB */
113#define FAULT_CODE_WINFIXUP 0x08 /* Miss happened during spill/fill */
114#define FAULT_CODE_BLKCOMMIT 0x10 /* Use blk-commit ASI in copy_page */
115
116#if PAGE_SHIFT == 13
117#define THREAD_SIZE (2*PAGE_SIZE)
118#define THREAD_SHIFT (PAGE_SHIFT + 1)
119#else /* PAGE_SHIFT == 13 */
120#define THREAD_SIZE PAGE_SIZE
121#define THREAD_SHIFT PAGE_SHIFT
122#endif /* PAGE_SHIFT == 13 */
123
124#define PREEMPT_ACTIVE 0x4000000
125
126/*
127 * macros/functions for gaining access to the thread information structure
128 *
129 * preempt_count needs to be 1 initially, until the scheduler is functional.
130 */
131#ifndef __ASSEMBLY__
132
133#define INIT_THREAD_INFO(tsk) \
134{ \
135 .task = &tsk, \
136 .flags = ((unsigned long)ASI_P) << TI_FLAG_CURRENT_DS_SHIFT, \
137 .exec_domain = &default_exec_domain, \
138 .preempt_count = 1, \
139 .restart_block = { \
140 .fn = do_no_restart_syscall, \
141 }, \
142}
143
144#define init_thread_info (init_thread_union.thread_info)
145#define init_stack (init_thread_union.stack)
146
147/* how to get the thread information struct from C */
148register struct thread_info *current_thread_info_reg asm("g6");
149#define current_thread_info() (current_thread_info_reg)
150
151/* thread information allocation */
152#if PAGE_SHIFT == 13
153#define __THREAD_INFO_ORDER 1
154#else /* PAGE_SHIFT == 13 */
155#define __THREAD_INFO_ORDER 0
156#endif /* PAGE_SHIFT == 13 */
157
158#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
159
160#ifdef CONFIG_DEBUG_STACK_USAGE
161#define alloc_thread_info(tsk) \
162({ \
163 struct thread_info *ret; \
164 \
165 ret = (struct thread_info *) \
166 __get_free_pages(GFP_KERNEL, __THREAD_INFO_ORDER); \
167 if (ret) \
168 memset(ret, 0, PAGE_SIZE<<__THREAD_INFO_ORDER); \
169 ret; \
170})
171#else
172#define alloc_thread_info(tsk) \
173 ((struct thread_info *)__get_free_pages(GFP_KERNEL, __THREAD_INFO_ORDER))
174#endif
175
176#define free_thread_info(ti) \
177 free_pages((unsigned long)(ti),__THREAD_INFO_ORDER)
178
179#define __thread_flag_byte_ptr(ti) \
180 ((unsigned char *)(&((ti)->flags)))
181#define __cur_thread_flag_byte_ptr __thread_flag_byte_ptr(current_thread_info())
182
183#define get_thread_fault_code() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FAULT_CODE])
184#define set_thread_fault_code(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FAULT_CODE] = (val))
185#define get_thread_wstate() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSTATE])
186#define set_thread_wstate(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSTATE] = (val))
187#define get_thread_cwp() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP])
188#define set_thread_cwp(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP] = (val))
189#define get_thread_current_ds() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS])
190#define set_thread_current_ds(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS] = (val))
191#define get_thread_fpdepth() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH])
192#define set_thread_fpdepth(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH] = (val))
193#define get_thread_wsaved() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED])
194#define set_thread_wsaved(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED] = (val))
195
196#endif /* !(__ASSEMBLY__) */
197
198/*
199 * Thread information flags, only 16 bits are available as we encode
200 * other values into the upper 6 bytes.
201 *
202 * On trap return we need to test several values:
203 *
204 * user: need_resched, notify_resume, sigpending, wsaved, perfctr
205 * kernel: fpdepth
206 *
207 * So to check for work in the kernel case we simply load the fpdepth
208 * byte out of the flags and test it. For the user case we encode the
209 * lower 3 bytes of flags as follows:
210 * ----------------------------------------
211 * | wsaved | flags byte 1 | flags byte 2 |
212 * ----------------------------------------
213 * This optimizes the user test into:
214 * ldx [%g6 + TI_FLAGS], REG1
215 * sethi %hi(_TIF_USER_WORK_MASK), REG2
216 * or REG2, %lo(_TIF_USER_WORK_MASK), REG2
217 * andcc REG1, REG2, %g0
218 * be,pt no_work_to_do
219 * nop
220 */
221#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
222#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
223#define TIF_SIGPENDING 2 /* signal pending */
224#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
225#define TIF_PERFCTR 4 /* performance counters active */
226#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */
227/* flag bit 6 is available */
228#define TIF_32BIT 7 /* 32-bit binary */
229/* flag bit 8 is available */
230#define TIF_SECCOMP 9 /* secure computing */
231#define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */
232/* flag bit 11 is available */
233/* NOTE: Thread flags >= 12 should be ones we have no interest
234 * in using in assembly, else we can't use the mask as
235 * an immediate value in instructions such as andcc.
236 */
237#define TIF_ABI_PENDING 12
238#define TIF_MEMDIE 13
239#define TIF_POLLING_NRFLAG 14
240
241#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
242#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
243#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
244#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
245#define _TIF_PERFCTR (1<<TIF_PERFCTR)
246#define _TIF_UNALIGNED (1<<TIF_UNALIGNED)
247#define _TIF_32BIT (1<<TIF_32BIT)
248#define _TIF_SECCOMP (1<<TIF_SECCOMP)
249#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
250#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
251#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
252
253#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \
254 _TIF_DO_NOTIFY_RESUME_MASK | \
255 _TIF_NEED_RESCHED | _TIF_PERFCTR)
256#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING)
257
258/*
259 * Thread-synchronous status.
260 *
261 * This is different from the flags in that nobody else
262 * ever touches our thread-synchronous status, so we don't
263 * have to worry about atomic accesses.
264 *
265 * Note that there are only 8 bits available.
266 */
267#define TS_RESTORE_SIGMASK 0x0001 /* restore signal mask in do_signal() */
268
269#ifndef __ASSEMBLY__
270#define HAVE_SET_RESTORE_SIGMASK 1
271static inline void set_restore_sigmask(void)
272{
273 struct thread_info *ti = current_thread_info();
274 ti->status |= TS_RESTORE_SIGMASK;
275 set_bit(TIF_SIGPENDING, &ti->flags);
276}
277#endif /* !__ASSEMBLY__ */
278
279#endif /* __KERNEL__ */
280
281#endif /* _ASM_THREAD_INFO_H */
diff --git a/arch/sparc/include/asm/timer.h b/arch/sparc/include/asm/timer.h
new file mode 100644
index 000000000000..612fd2779d9e
--- /dev/null
+++ b/arch/sparc/include/asm/timer.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_TIMER_H
2#define ___ASM_SPARC_TIMER_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/timer_64.h>
5#else
6#include <asm/timer_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/timer_32.h b/arch/sparc/include/asm/timer_32.h
index 361e53898dd7..361e53898dd7 100644
--- a/include/asm-sparc/timer_32.h
+++ b/arch/sparc/include/asm/timer_32.h
diff --git a/include/asm-sparc/timer_64.h b/arch/sparc/include/asm/timer_64.h
index 5b779fd1f788..5b779fd1f788 100644
--- a/include/asm-sparc/timer_64.h
+++ b/arch/sparc/include/asm/timer_64.h
diff --git a/arch/sparc/include/asm/timex.h b/arch/sparc/include/asm/timex.h
new file mode 100644
index 000000000000..70cc37b73827
--- /dev/null
+++ b/arch/sparc/include/asm/timex.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_TIMEX_H
2#define ___ASM_SPARC_TIMEX_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/timex_64.h>
5#else
6#include <asm/timex_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/timex_32.h b/arch/sparc/include/asm/timex_32.h
new file mode 100644
index 000000000000..b6ccdb0d6f7d
--- /dev/null
+++ b/arch/sparc/include/asm/timex_32.h
@@ -0,0 +1,15 @@
1/*
2 * linux/include/asm/timex.h
3 *
4 * sparc architecture timex specifications
5 */
6#ifndef _ASMsparc_TIMEX_H
7#define _ASMsparc_TIMEX_H
8
9#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
10
11/* XXX Maybe do something better at some point... -DaveM */
12typedef unsigned long cycles_t;
13#define get_cycles() (0)
14
15#endif
diff --git a/arch/sparc/include/asm/timex_64.h b/arch/sparc/include/asm/timex_64.h
new file mode 100644
index 000000000000..18b30bc9823b
--- /dev/null
+++ b/arch/sparc/include/asm/timex_64.h
@@ -0,0 +1,19 @@
1/*
2 * linux/include/asm/timex.h
3 *
4 * sparc64 architecture timex specifications
5 */
6#ifndef _ASMsparc64_TIMEX_H
7#define _ASMsparc64_TIMEX_H
8
9#include <asm/timer.h>
10
11#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
12
13/* Getting on the cycle counter on sparc64. */
14typedef unsigned long cycles_t;
15#define get_cycles() tick_ops->get_tick()
16
17#define ARCH_HAS_READ_CURRENT_TIMER
18
19#endif
diff --git a/arch/sparc/include/asm/tlb.h b/arch/sparc/include/asm/tlb.h
new file mode 100644
index 000000000000..92d0393bbcdc
--- /dev/null
+++ b/arch/sparc/include/asm/tlb.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_TLB_H
2#define ___ASM_SPARC_TLB_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/tlb_64.h>
5#else
6#include <asm/tlb_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/tlb_32.h b/arch/sparc/include/asm/tlb_32.h
index 6d02d1ce53f3..6d02d1ce53f3 100644
--- a/include/asm-sparc/tlb_32.h
+++ b/arch/sparc/include/asm/tlb_32.h
diff --git a/include/asm-sparc/tlb_64.h b/arch/sparc/include/asm/tlb_64.h
index ec81cdedef2c..ec81cdedef2c 100644
--- a/include/asm-sparc/tlb_64.h
+++ b/arch/sparc/include/asm/tlb_64.h
diff --git a/arch/sparc/include/asm/tlbflush.h b/arch/sparc/include/asm/tlbflush.h
new file mode 100644
index 000000000000..2c9629fad1e2
--- /dev/null
+++ b/arch/sparc/include/asm/tlbflush.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_TLBFLUSH_H
2#define ___ASM_SPARC_TLBFLUSH_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/tlbflush_64.h>
5#else
6#include <asm/tlbflush_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/tlbflush_32.h b/arch/sparc/include/asm/tlbflush_32.h
index fe0a71abc9bb..fe0a71abc9bb 100644
--- a/include/asm-sparc/tlbflush_32.h
+++ b/arch/sparc/include/asm/tlbflush_32.h
diff --git a/include/asm-sparc/tlbflush_64.h b/arch/sparc/include/asm/tlbflush_64.h
index fbb675dbe0c9..fbb675dbe0c9 100644
--- a/include/asm-sparc/tlbflush_64.h
+++ b/arch/sparc/include/asm/tlbflush_64.h
diff --git a/arch/sparc/include/asm/topology.h b/arch/sparc/include/asm/topology.h
new file mode 100644
index 000000000000..ee4f191d394a
--- /dev/null
+++ b/arch/sparc/include/asm/topology.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_TOPOLOGY_H
2#define ___ASM_SPARC_TOPOLOGY_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/topology_64.h>
5#else
6#include <asm/topology_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/topology_32.h b/arch/sparc/include/asm/topology_32.h
index ee5ac9c9da28..ee5ac9c9da28 100644
--- a/include/asm-sparc/topology_32.h
+++ b/arch/sparc/include/asm/topology_32.h
diff --git a/include/asm-sparc/topology_64.h b/arch/sparc/include/asm/topology_64.h
index 001c04027c82..001c04027c82 100644
--- a/include/asm-sparc/topology_64.h
+++ b/arch/sparc/include/asm/topology_64.h
diff --git a/include/asm-sparc/traps.h b/arch/sparc/include/asm/traps.h
index bebdbf8f43a8..bebdbf8f43a8 100644
--- a/include/asm-sparc/traps.h
+++ b/arch/sparc/include/asm/traps.h
diff --git a/include/asm-sparc/tsb.h b/arch/sparc/include/asm/tsb.h
index 76e4299dd9bc..76e4299dd9bc 100644
--- a/include/asm-sparc/tsb.h
+++ b/arch/sparc/include/asm/tsb.h
diff --git a/include/asm-sparc/tsunami.h b/arch/sparc/include/asm/tsunami.h
index 5bbd1d523baa..5bbd1d523baa 100644
--- a/include/asm-sparc/tsunami.h
+++ b/arch/sparc/include/asm/tsunami.h
diff --git a/include/asm-sparc/ttable.h b/arch/sparc/include/asm/ttable.h
index 5708ba2719fb..5708ba2719fb 100644
--- a/include/asm-sparc/ttable.h
+++ b/arch/sparc/include/asm/ttable.h
diff --git a/include/asm-sparc/turbosparc.h b/arch/sparc/include/asm/turbosparc.h
index 17c73282db0a..17c73282db0a 100644
--- a/include/asm-sparc/turbosparc.h
+++ b/arch/sparc/include/asm/turbosparc.h
diff --git a/include/asm-sparc/types.h b/arch/sparc/include/asm/types.h
index 8c28fde5eaa2..8c28fde5eaa2 100644
--- a/include/asm-sparc/types.h
+++ b/arch/sparc/include/asm/types.h
diff --git a/arch/sparc/include/asm/uaccess.h b/arch/sparc/include/asm/uaccess.h
new file mode 100644
index 000000000000..e88fbe5c0457
--- /dev/null
+++ b/arch/sparc/include/asm/uaccess.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_UACCESS_H
2#define ___ASM_SPARC_UACCESS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/uaccess_64.h>
5#else
6#include <asm/uaccess_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/uaccess_32.h b/arch/sparc/include/asm/uaccess_32.h
index 47d5619d43fa..47d5619d43fa 100644
--- a/include/asm-sparc/uaccess_32.h
+++ b/arch/sparc/include/asm/uaccess_32.h
diff --git a/include/asm-sparc/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
index 296ef30e05c8..296ef30e05c8 100644
--- a/include/asm-sparc/uaccess_64.h
+++ b/arch/sparc/include/asm/uaccess_64.h
diff --git a/include/asm-sparc/uctx.h b/arch/sparc/include/asm/uctx.h
index dc937c75ffdd..dc937c75ffdd 100644
--- a/include/asm-sparc/uctx.h
+++ b/arch/sparc/include/asm/uctx.h
diff --git a/include/asm-sparc/unaligned.h b/arch/sparc/include/asm/unaligned.h
index 11d2d5fb5902..11d2d5fb5902 100644
--- a/include/asm-sparc/unaligned.h
+++ b/arch/sparc/include/asm/unaligned.h
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
new file mode 100644
index 000000000000..4207fb362da0
--- /dev/null
+++ b/arch/sparc/include/asm/unistd.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_UNISTD_H
2#define ___ASM_SPARC_UNISTD_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/unistd_64.h>
5#else
6#include <asm/unistd_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/unistd_32.h b/arch/sparc/include/asm/unistd_32.h
index 648643a9f139..648643a9f139 100644
--- a/include/asm-sparc/unistd_32.h
+++ b/arch/sparc/include/asm/unistd_32.h
diff --git a/include/asm-sparc/unistd_64.h b/arch/sparc/include/asm/unistd_64.h
index c5cc0e052321..c5cc0e052321 100644
--- a/include/asm-sparc/unistd_64.h
+++ b/arch/sparc/include/asm/unistd_64.h
diff --git a/include/asm-sparc/upa.h b/arch/sparc/include/asm/upa.h
index 5b1633223f92..5b1633223f92 100644
--- a/include/asm-sparc/upa.h
+++ b/arch/sparc/include/asm/upa.h
diff --git a/include/asm-sparc/user.h b/arch/sparc/include/asm/user.h
index 3400ea87f148..3400ea87f148 100644
--- a/include/asm-sparc/user.h
+++ b/arch/sparc/include/asm/user.h
diff --git a/arch/sparc/include/asm/utrap.h b/arch/sparc/include/asm/utrap.h
new file mode 100644
index 000000000000..b10e527c22d9
--- /dev/null
+++ b/arch/sparc/include/asm/utrap.h
@@ -0,0 +1,51 @@
1/*
2 * include/asm/utrap.h
3 *
4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 */
6
7#ifndef __ASM_SPARC64_UTRAP_H
8#define __ASM_SPARC64_UTRAP_H
9
10#define UT_INSTRUCTION_EXCEPTION 1
11#define UT_INSTRUCTION_ERROR 2
12#define UT_INSTRUCTION_PROTECTION 3
13#define UT_ILLTRAP_INSTRUCTION 4
14#define UT_ILLEGAL_INSTRUCTION 5
15#define UT_PRIVILEGED_OPCODE 6
16#define UT_FP_DISABLED 7
17#define UT_FP_EXCEPTION_IEEE_754 8
18#define UT_FP_EXCEPTION_OTHER 9
19#define UT_TAG_OVERVIEW 10
20#define UT_DIVISION_BY_ZERO 11
21#define UT_DATA_EXCEPTION 12
22#define UT_DATA_ERROR 13
23#define UT_DATA_PROTECTION 14
24#define UT_MEM_ADDRESS_NOT_ALIGNED 15
25#define UT_PRIVILEGED_ACTION 16
26#define UT_ASYNC_DATA_ERROR 17
27#define UT_TRAP_INSTRUCTION_16 18
28#define UT_TRAP_INSTRUCTION_17 19
29#define UT_TRAP_INSTRUCTION_18 20
30#define UT_TRAP_INSTRUCTION_19 21
31#define UT_TRAP_INSTRUCTION_20 22
32#define UT_TRAP_INSTRUCTION_21 23
33#define UT_TRAP_INSTRUCTION_22 24
34#define UT_TRAP_INSTRUCTION_23 25
35#define UT_TRAP_INSTRUCTION_24 26
36#define UT_TRAP_INSTRUCTION_25 27
37#define UT_TRAP_INSTRUCTION_26 28
38#define UT_TRAP_INSTRUCTION_27 29
39#define UT_TRAP_INSTRUCTION_28 30
40#define UT_TRAP_INSTRUCTION_29 31
41#define UT_TRAP_INSTRUCTION_30 32
42#define UT_TRAP_INSTRUCTION_31 33
43
44#define UTH_NOCHANGE (-1)
45
46#ifndef __ASSEMBLY__
47typedef int utrap_entry_t;
48typedef void *utrap_handler_t;
49#endif /* __ASSEMBLY__ */
50
51#endif /* !(__ASM_SPARC64_PROCESSOR_H) */
diff --git a/include/asm-sparc/vac-ops.h b/arch/sparc/include/asm/vac-ops.h
index d10527611f11..d10527611f11 100644
--- a/include/asm-sparc/vac-ops.h
+++ b/arch/sparc/include/asm/vac-ops.h
diff --git a/arch/sparc/include/asm/vaddrs.h b/arch/sparc/include/asm/vaddrs.h
new file mode 100644
index 000000000000..541e13755cec
--- /dev/null
+++ b/arch/sparc/include/asm/vaddrs.h
@@ -0,0 +1,64 @@
1#ifndef _SPARC_VADDRS_H
2#define _SPARC_VADDRS_H
3
4#include <asm/head.h>
5
6/*
7 * asm/vaddrs.h: Here we define the virtual addresses at
8 * which important things will be mapped.
9 *
10 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
11 * Copyright (C) 2000 Anton Blanchard (anton@samba.org)
12 */
13
14#define SRMMU_MAXMEM 0x0c000000
15
16#define SRMMU_NOCACHE_VADDR (KERNBASE + SRMMU_MAXMEM)
17 /* = 0x0fc000000 */
18/* XXX Empiricals - this needs to go away - KMW */
19#define SRMMU_MIN_NOCACHE_PAGES (550)
20#define SRMMU_MAX_NOCACHE_PAGES (1280)
21
22/* The following constant is used in mm/srmmu.c::srmmu_nocache_calcsize()
23 * to determine the amount of memory that will be reserved as nocache:
24 *
25 * 256 pages will be taken as nocache per each
26 * SRMMU_NOCACHE_ALCRATIO MB of system memory.
27 *
28 * limits enforced: nocache minimum = 256 pages
29 * nocache maximum = 1280 pages
30 */
31#define SRMMU_NOCACHE_ALCRATIO 64 /* 256 pages per 64MB of system RAM */
32
33#define SUN4M_IOBASE_VADDR 0xfd000000 /* Base for mapping pages */
34#define IOBASE_VADDR 0xfe000000
35#define IOBASE_END 0xfe600000
36
37/*
38 * On the sun4/4c we need a place
39 * to reliably map locked down kernel data. This includes the
40 * task_struct and kernel stack pages of each process plus the
41 * scsi buffers during dvma IO transfers, also the floppy buffers
42 * during pseudo dma which runs with traps off (no faults allowed).
43 * Some quick calculations yield:
44 * NR_TASKS <512> * (3 * PAGE_SIZE) == 0x600000
45 * Subtract this from 0xc00000 and you get 0x927C0 of vm left
46 * over to map SCSI dvma + floppy pseudo-dma buffers. So be
47 * careful if you change NR_TASKS or else there won't be enough
48 * room for it all.
49 */
50#define SUN4C_LOCK_VADDR 0xff000000
51#define SUN4C_LOCK_END 0xffc00000
52
53#define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */
54#define KADB_DEBUGGER_ENDVM 0xffd00000
55#define DEBUG_FIRSTVADDR KADB_DEBUGGER_BEGVM
56#define DEBUG_LASTVADDR KADB_DEBUGGER_ENDVM
57
58#define LINUX_OPPROM_BEGVM 0xffd00000
59#define LINUX_OPPROM_ENDVM 0xfff00000
60
61#define DVMA_VADDR 0xfff00000 /* Base area of the DVMA on suns */
62#define DVMA_END 0xfffc0000
63
64#endif /* !(_SPARC_VADDRS_H) */
diff --git a/include/asm-sparc/vfc_ioctls.h b/arch/sparc/include/asm/vfc_ioctls.h
index af8b69007b22..af8b69007b22 100644
--- a/include/asm-sparc/vfc_ioctls.h
+++ b/arch/sparc/include/asm/vfc_ioctls.h
diff --git a/include/asm-sparc/vga.h b/arch/sparc/include/asm/vga.h
index c69d5b2ba19a..c69d5b2ba19a 100644
--- a/include/asm-sparc/vga.h
+++ b/arch/sparc/include/asm/vga.h
diff --git a/include/asm-sparc/viking.h b/arch/sparc/include/asm/viking.h
index 989930aeb093..989930aeb093 100644
--- a/include/asm-sparc/viking.h
+++ b/arch/sparc/include/asm/viking.h
diff --git a/include/asm-sparc/vio.h b/arch/sparc/include/asm/vio.h
index d4de32f0f8af..d4de32f0f8af 100644
--- a/include/asm-sparc/vio.h
+++ b/arch/sparc/include/asm/vio.h
diff --git a/include/asm-sparc/visasm.h b/arch/sparc/include/asm/visasm.h
index de797b9bf552..de797b9bf552 100644
--- a/include/asm-sparc/visasm.h
+++ b/arch/sparc/include/asm/visasm.h
diff --git a/include/asm-sparc/watchdog.h b/arch/sparc/include/asm/watchdog.h
index 5baf2d3919cf..5baf2d3919cf 100644
--- a/include/asm-sparc/watchdog.h
+++ b/arch/sparc/include/asm/watchdog.h
diff --git a/include/asm-sparc/winmacro.h b/arch/sparc/include/asm/winmacro.h
index 5b0a06dc3bcb..5b0a06dc3bcb 100644
--- a/include/asm-sparc/winmacro.h
+++ b/arch/sparc/include/asm/winmacro.h
diff --git a/arch/sparc/include/asm/xor.h b/arch/sparc/include/asm/xor.h
new file mode 100644
index 000000000000..8ed591c7db2d
--- /dev/null
+++ b/arch/sparc/include/asm/xor.h
@@ -0,0 +1,8 @@
1#ifndef ___ASM_SPARC_XOR_H
2#define ___ASM_SPARC_XOR_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/xor_64.h>
5#else
6#include <asm/xor_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/xor_32.h b/arch/sparc/include/asm/xor_32.h
new file mode 100644
index 000000000000..44bfa0787f3f
--- /dev/null
+++ b/arch/sparc/include/asm/xor_32.h
@@ -0,0 +1,269 @@
1/*
2 * include/asm/xor.h
3 *
4 * Optimized RAID-5 checksumming functions for 32-bit Sparc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * You should have received a copy of the GNU General Public License
12 * (for example /usr/src/linux/COPYING); if not, write to the Free
13 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
14 */
15
16/*
17 * High speed xor_block operation for RAID4/5 utilizing the
18 * ldd/std SPARC instructions.
19 *
20 * Copyright (C) 1999 Jakub Jelinek (jj@ultra.linux.cz)
21 */
22
23static void
24sparc_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
25{
26 int lines = bytes / (sizeof (long)) / 8;
27
28 do {
29 __asm__ __volatile__(
30 "ldd [%0 + 0x00], %%g2\n\t"
31 "ldd [%0 + 0x08], %%g4\n\t"
32 "ldd [%0 + 0x10], %%o0\n\t"
33 "ldd [%0 + 0x18], %%o2\n\t"
34 "ldd [%1 + 0x00], %%o4\n\t"
35 "ldd [%1 + 0x08], %%l0\n\t"
36 "ldd [%1 + 0x10], %%l2\n\t"
37 "ldd [%1 + 0x18], %%l4\n\t"
38 "xor %%g2, %%o4, %%g2\n\t"
39 "xor %%g3, %%o5, %%g3\n\t"
40 "xor %%g4, %%l0, %%g4\n\t"
41 "xor %%g5, %%l1, %%g5\n\t"
42 "xor %%o0, %%l2, %%o0\n\t"
43 "xor %%o1, %%l3, %%o1\n\t"
44 "xor %%o2, %%l4, %%o2\n\t"
45 "xor %%o3, %%l5, %%o3\n\t"
46 "std %%g2, [%0 + 0x00]\n\t"
47 "std %%g4, [%0 + 0x08]\n\t"
48 "std %%o0, [%0 + 0x10]\n\t"
49 "std %%o2, [%0 + 0x18]\n"
50 :
51 : "r" (p1), "r" (p2)
52 : "g2", "g3", "g4", "g5",
53 "o0", "o1", "o2", "o3", "o4", "o5",
54 "l0", "l1", "l2", "l3", "l4", "l5");
55 p1 += 8;
56 p2 += 8;
57 } while (--lines > 0);
58}
59
60static void
61sparc_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
62 unsigned long *p3)
63{
64 int lines = bytes / (sizeof (long)) / 8;
65
66 do {
67 __asm__ __volatile__(
68 "ldd [%0 + 0x00], %%g2\n\t"
69 "ldd [%0 + 0x08], %%g4\n\t"
70 "ldd [%0 + 0x10], %%o0\n\t"
71 "ldd [%0 + 0x18], %%o2\n\t"
72 "ldd [%1 + 0x00], %%o4\n\t"
73 "ldd [%1 + 0x08], %%l0\n\t"
74 "ldd [%1 + 0x10], %%l2\n\t"
75 "ldd [%1 + 0x18], %%l4\n\t"
76 "xor %%g2, %%o4, %%g2\n\t"
77 "xor %%g3, %%o5, %%g3\n\t"
78 "ldd [%2 + 0x00], %%o4\n\t"
79 "xor %%g4, %%l0, %%g4\n\t"
80 "xor %%g5, %%l1, %%g5\n\t"
81 "ldd [%2 + 0x08], %%l0\n\t"
82 "xor %%o0, %%l2, %%o0\n\t"
83 "xor %%o1, %%l3, %%o1\n\t"
84 "ldd [%2 + 0x10], %%l2\n\t"
85 "xor %%o2, %%l4, %%o2\n\t"
86 "xor %%o3, %%l5, %%o3\n\t"
87 "ldd [%2 + 0x18], %%l4\n\t"
88 "xor %%g2, %%o4, %%g2\n\t"
89 "xor %%g3, %%o5, %%g3\n\t"
90 "xor %%g4, %%l0, %%g4\n\t"
91 "xor %%g5, %%l1, %%g5\n\t"
92 "xor %%o0, %%l2, %%o0\n\t"
93 "xor %%o1, %%l3, %%o1\n\t"
94 "xor %%o2, %%l4, %%o2\n\t"
95 "xor %%o3, %%l5, %%o3\n\t"
96 "std %%g2, [%0 + 0x00]\n\t"
97 "std %%g4, [%0 + 0x08]\n\t"
98 "std %%o0, [%0 + 0x10]\n\t"
99 "std %%o2, [%0 + 0x18]\n"
100 :
101 : "r" (p1), "r" (p2), "r" (p3)
102 : "g2", "g3", "g4", "g5",
103 "o0", "o1", "o2", "o3", "o4", "o5",
104 "l0", "l1", "l2", "l3", "l4", "l5");
105 p1 += 8;
106 p2 += 8;
107 p3 += 8;
108 } while (--lines > 0);
109}
110
111static void
112sparc_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
113 unsigned long *p3, unsigned long *p4)
114{
115 int lines = bytes / (sizeof (long)) / 8;
116
117 do {
118 __asm__ __volatile__(
119 "ldd [%0 + 0x00], %%g2\n\t"
120 "ldd [%0 + 0x08], %%g4\n\t"
121 "ldd [%0 + 0x10], %%o0\n\t"
122 "ldd [%0 + 0x18], %%o2\n\t"
123 "ldd [%1 + 0x00], %%o4\n\t"
124 "ldd [%1 + 0x08], %%l0\n\t"
125 "ldd [%1 + 0x10], %%l2\n\t"
126 "ldd [%1 + 0x18], %%l4\n\t"
127 "xor %%g2, %%o4, %%g2\n\t"
128 "xor %%g3, %%o5, %%g3\n\t"
129 "ldd [%2 + 0x00], %%o4\n\t"
130 "xor %%g4, %%l0, %%g4\n\t"
131 "xor %%g5, %%l1, %%g5\n\t"
132 "ldd [%2 + 0x08], %%l0\n\t"
133 "xor %%o0, %%l2, %%o0\n\t"
134 "xor %%o1, %%l3, %%o1\n\t"
135 "ldd [%2 + 0x10], %%l2\n\t"
136 "xor %%o2, %%l4, %%o2\n\t"
137 "xor %%o3, %%l5, %%o3\n\t"
138 "ldd [%2 + 0x18], %%l4\n\t"
139 "xor %%g2, %%o4, %%g2\n\t"
140 "xor %%g3, %%o5, %%g3\n\t"
141 "ldd [%3 + 0x00], %%o4\n\t"
142 "xor %%g4, %%l0, %%g4\n\t"
143 "xor %%g5, %%l1, %%g5\n\t"
144 "ldd [%3 + 0x08], %%l0\n\t"
145 "xor %%o0, %%l2, %%o0\n\t"
146 "xor %%o1, %%l3, %%o1\n\t"
147 "ldd [%3 + 0x10], %%l2\n\t"
148 "xor %%o2, %%l4, %%o2\n\t"
149 "xor %%o3, %%l5, %%o3\n\t"
150 "ldd [%3 + 0x18], %%l4\n\t"
151 "xor %%g2, %%o4, %%g2\n\t"
152 "xor %%g3, %%o5, %%g3\n\t"
153 "xor %%g4, %%l0, %%g4\n\t"
154 "xor %%g5, %%l1, %%g5\n\t"
155 "xor %%o0, %%l2, %%o0\n\t"
156 "xor %%o1, %%l3, %%o1\n\t"
157 "xor %%o2, %%l4, %%o2\n\t"
158 "xor %%o3, %%l5, %%o3\n\t"
159 "std %%g2, [%0 + 0x00]\n\t"
160 "std %%g4, [%0 + 0x08]\n\t"
161 "std %%o0, [%0 + 0x10]\n\t"
162 "std %%o2, [%0 + 0x18]\n"
163 :
164 : "r" (p1), "r" (p2), "r" (p3), "r" (p4)
165 : "g2", "g3", "g4", "g5",
166 "o0", "o1", "o2", "o3", "o4", "o5",
167 "l0", "l1", "l2", "l3", "l4", "l5");
168 p1 += 8;
169 p2 += 8;
170 p3 += 8;
171 p4 += 8;
172 } while (--lines > 0);
173}
174
175static void
176sparc_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
177 unsigned long *p3, unsigned long *p4, unsigned long *p5)
178{
179 int lines = bytes / (sizeof (long)) / 8;
180
181 do {
182 __asm__ __volatile__(
183 "ldd [%0 + 0x00], %%g2\n\t"
184 "ldd [%0 + 0x08], %%g4\n\t"
185 "ldd [%0 + 0x10], %%o0\n\t"
186 "ldd [%0 + 0x18], %%o2\n\t"
187 "ldd [%1 + 0x00], %%o4\n\t"
188 "ldd [%1 + 0x08], %%l0\n\t"
189 "ldd [%1 + 0x10], %%l2\n\t"
190 "ldd [%1 + 0x18], %%l4\n\t"
191 "xor %%g2, %%o4, %%g2\n\t"
192 "xor %%g3, %%o5, %%g3\n\t"
193 "ldd [%2 + 0x00], %%o4\n\t"
194 "xor %%g4, %%l0, %%g4\n\t"
195 "xor %%g5, %%l1, %%g5\n\t"
196 "ldd [%2 + 0x08], %%l0\n\t"
197 "xor %%o0, %%l2, %%o0\n\t"
198 "xor %%o1, %%l3, %%o1\n\t"
199 "ldd [%2 + 0x10], %%l2\n\t"
200 "xor %%o2, %%l4, %%o2\n\t"
201 "xor %%o3, %%l5, %%o3\n\t"
202 "ldd [%2 + 0x18], %%l4\n\t"
203 "xor %%g2, %%o4, %%g2\n\t"
204 "xor %%g3, %%o5, %%g3\n\t"
205 "ldd [%3 + 0x00], %%o4\n\t"
206 "xor %%g4, %%l0, %%g4\n\t"
207 "xor %%g5, %%l1, %%g5\n\t"
208 "ldd [%3 + 0x08], %%l0\n\t"
209 "xor %%o0, %%l2, %%o0\n\t"
210 "xor %%o1, %%l3, %%o1\n\t"
211 "ldd [%3 + 0x10], %%l2\n\t"
212 "xor %%o2, %%l4, %%o2\n\t"
213 "xor %%o3, %%l5, %%o3\n\t"
214 "ldd [%3 + 0x18], %%l4\n\t"
215 "xor %%g2, %%o4, %%g2\n\t"
216 "xor %%g3, %%o5, %%g3\n\t"
217 "ldd [%4 + 0x00], %%o4\n\t"
218 "xor %%g4, %%l0, %%g4\n\t"
219 "xor %%g5, %%l1, %%g5\n\t"
220 "ldd [%4 + 0x08], %%l0\n\t"
221 "xor %%o0, %%l2, %%o0\n\t"
222 "xor %%o1, %%l3, %%o1\n\t"
223 "ldd [%4 + 0x10], %%l2\n\t"
224 "xor %%o2, %%l4, %%o2\n\t"
225 "xor %%o3, %%l5, %%o3\n\t"
226 "ldd [%4 + 0x18], %%l4\n\t"
227 "xor %%g2, %%o4, %%g2\n\t"
228 "xor %%g3, %%o5, %%g3\n\t"
229 "xor %%g4, %%l0, %%g4\n\t"
230 "xor %%g5, %%l1, %%g5\n\t"
231 "xor %%o0, %%l2, %%o0\n\t"
232 "xor %%o1, %%l3, %%o1\n\t"
233 "xor %%o2, %%l4, %%o2\n\t"
234 "xor %%o3, %%l5, %%o3\n\t"
235 "std %%g2, [%0 + 0x00]\n\t"
236 "std %%g4, [%0 + 0x08]\n\t"
237 "std %%o0, [%0 + 0x10]\n\t"
238 "std %%o2, [%0 + 0x18]\n"
239 :
240 : "r" (p1), "r" (p2), "r" (p3), "r" (p4), "r" (p5)
241 : "g2", "g3", "g4", "g5",
242 "o0", "o1", "o2", "o3", "o4", "o5",
243 "l0", "l1", "l2", "l3", "l4", "l5");
244 p1 += 8;
245 p2 += 8;
246 p3 += 8;
247 p4 += 8;
248 p5 += 8;
249 } while (--lines > 0);
250}
251
252static struct xor_block_template xor_block_SPARC = {
253 .name = "SPARC",
254 .do_2 = sparc_2,
255 .do_3 = sparc_3,
256 .do_4 = sparc_4,
257 .do_5 = sparc_5,
258};
259
260/* For grins, also test the generic routines. */
261#include <asm-generic/xor.h>
262
263#undef XOR_TRY_TEMPLATES
264#define XOR_TRY_TEMPLATES \
265 do { \
266 xor_speed(&xor_block_8regs); \
267 xor_speed(&xor_block_32regs); \
268 xor_speed(&xor_block_SPARC); \
269 } while (0)
diff --git a/arch/sparc/include/asm/xor_64.h b/arch/sparc/include/asm/xor_64.h
new file mode 100644
index 000000000000..bee4bf4be3af
--- /dev/null
+++ b/arch/sparc/include/asm/xor_64.h
@@ -0,0 +1,70 @@
1/*
2 * include/asm/xor.h
3 *
4 * High speed xor_block operation for RAID4/5 utilizing the
5 * UltraSparc Visual Instruction Set and Niagara block-init
6 * twin-load instructions.
7 *
8 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
9 * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
15 *
16 * You should have received a copy of the GNU General Public License
17 * (for example /usr/src/linux/COPYING); if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#include <asm/spitfire.h>
22
23extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *);
24extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *,
25 unsigned long *);
26extern void xor_vis_4(unsigned long, unsigned long *, unsigned long *,
27 unsigned long *, unsigned long *);
28extern void xor_vis_5(unsigned long, unsigned long *, unsigned long *,
29 unsigned long *, unsigned long *, unsigned long *);
30
31/* XXX Ugh, write cheetah versions... -DaveM */
32
33static struct xor_block_template xor_block_VIS = {
34 .name = "VIS",
35 .do_2 = xor_vis_2,
36 .do_3 = xor_vis_3,
37 .do_4 = xor_vis_4,
38 .do_5 = xor_vis_5,
39};
40
41extern void xor_niagara_2(unsigned long, unsigned long *, unsigned long *);
42extern void xor_niagara_3(unsigned long, unsigned long *, unsigned long *,
43 unsigned long *);
44extern void xor_niagara_4(unsigned long, unsigned long *, unsigned long *,
45 unsigned long *, unsigned long *);
46extern void xor_niagara_5(unsigned long, unsigned long *, unsigned long *,
47 unsigned long *, unsigned long *, unsigned long *);
48
49static struct xor_block_template xor_block_niagara = {
50 .name = "Niagara",
51 .do_2 = xor_niagara_2,
52 .do_3 = xor_niagara_3,
53 .do_4 = xor_niagara_4,
54 .do_5 = xor_niagara_5,
55};
56
57#undef XOR_TRY_TEMPLATES
58#define XOR_TRY_TEMPLATES \
59 do { \
60 xor_speed(&xor_block_VIS); \
61 xor_speed(&xor_block_niagara); \
62 } while (0)
63
64/* For VIS for everything except Niagara. */
65#define XOR_SELECT_TEMPLATE(FASTEST) \
66 ((tlb_type == hypervisor && \
67 (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \
68 sun4v_chip_type == SUN4V_CHIP_NIAGARA2)) ? \
69 &xor_block_niagara : \
70 &xor_block_VIS)
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index 2f96256dc515..e8cdf715a546 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -1196,8 +1196,9 @@ sys_rt_sigreturn:
1196 be 1f 1196 be 1f
1197 nop 1197 nop
1198 1198
1199 add %sp, STACKFRAME_SZ, %o0
1199 call syscall_trace 1200 call syscall_trace
1200 nop 1201 mov 1, %o1
1201 1202
12021: 12031:
1203 /* We are returning to a signal handler. */ 1204 /* We are returning to a signal handler. */
@@ -1287,8 +1288,12 @@ linux_fast_syscall:
1287 mov %i3, %o3 1288 mov %i3, %o3
1288 1289
1289linux_syscall_trace: 1290linux_syscall_trace:
1291 add %sp, STACKFRAME_SZ, %o0
1290 call syscall_trace 1292 call syscall_trace
1291 nop 1293 mov 0, %o1
1294 cmp %o0, 0
1295 bne 3f
1296 mov -ENOSYS, %o0
1292 mov %i0, %o0 1297 mov %i0, %o0
1293 mov %i1, %o1 1298 mov %i1, %o1
1294 mov %i2, %o2 1299 mov %i2, %o2
@@ -1337,6 +1342,7 @@ syscall_is_too_hard:
1337 call %l7 1342 call %l7
1338 mov %i5, %o5 1343 mov %i5, %o5
1339 1344
13453:
1340 st %o0, [%sp + STACKFRAME_SZ + PT_I0] 1346 st %o0, [%sp + STACKFRAME_SZ + PT_I0]
1341 1347
1342ret_sys_call: 1348ret_sys_call:
@@ -1374,6 +1380,8 @@ ret_sys_call:
1374 st %l2, [%sp + STACKFRAME_SZ + PT_NPC] 1380 st %l2, [%sp + STACKFRAME_SZ + PT_NPC]
1375 1381
1376linux_syscall_trace2: 1382linux_syscall_trace2:
1383 add %sp, STACKFRAME_SZ, %o0
1384 mov 1, %o1
1377 call syscall_trace 1385 call syscall_trace
1378 add %l1, 0x4, %l2 /* npc = npc+4 */ 1386 add %l1, 0x4, %l2 /* npc = npc+4 */
1379 st %l1, [%sp + STACKFRAME_SZ + PT_PC] 1387 st %l1, [%sp + STACKFRAME_SZ + PT_PC]
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
index 81f3b929743f..20699c701412 100644
--- a/arch/sparc/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace.c
@@ -21,6 +21,7 @@
21#include <linux/signal.h> 21#include <linux/signal.h>
22#include <linux/regset.h> 22#include <linux/regset.h>
23#include <linux/elf.h> 23#include <linux/elf.h>
24#include <linux/tracehook.h>
24 25
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
26#include <asm/system.h> 27#include <asm/system.h>
@@ -450,21 +451,16 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
450 return ret; 451 return ret;
451} 452}
452 453
453asmlinkage void syscall_trace(void) 454asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p)
454{ 455{
455 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 456 int ret = 0;
456 return; 457
457 if (!(current->ptrace & PT_PTRACED)) 458 if (test_thread_flag(TIF_SYSCALL_TRACE)) {
458 return; 459 if (syscall_exit_p)
459 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) 460 tracehook_report_syscall_exit(regs, 0);
460 ? 0x80 : 0)); 461 else
461 /* 462 ret = tracehook_report_syscall_entry(regs);
462 * this isn't the same as continuing with a signal, but it will do
463 * for normal use. strace only continues with a signal if the
464 * stopping signal is not SIGTRAP. -brl
465 */
466 if (current->exit_code) {
467 send_sig (current->exit_code, current, 1);
468 current->exit_code = 0;
469 } 463 }
464
465 return ret;
470} 466}
diff --git a/arch/sparc/kernel/rtrap.S b/arch/sparc/kernel/rtrap.S
index 891f460b7b96..4da2e1f66290 100644
--- a/arch/sparc/kernel/rtrap.S
+++ b/arch/sparc/kernel/rtrap.S
@@ -69,12 +69,13 @@ ret_trap_lockless_ipi:
69 69
70 ld [%curptr + TI_FLAGS], %g2 70 ld [%curptr + TI_FLAGS], %g2
71signal_p: 71signal_p:
72 andcc %g2, (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK), %g0 72 andcc %g2, _TIF_DO_NOTIFY_RESUME_MASK, %g0
73 bz,a ret_trap_continue 73 bz,a ret_trap_continue
74 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr 74 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr
75 75
76 mov %g2, %o2
76 mov %l5, %o1 77 mov %l5, %o1
77 call do_signal 78 call do_notify_resume
78 add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr 79 add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr
79 80
80 /* Fall through. */ 81 /* Fall through. */
diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c
index 3fd1df9f9ba7..c94f91c8b6e0 100644
--- a/arch/sparc/kernel/signal.c
+++ b/arch/sparc/kernel/signal.c
@@ -18,6 +18,7 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/binfmts.h> /* do_coredum */ 19#include <linux/binfmts.h> /* do_coredum */
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21#include <linux/tracehook.h>
21 22
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
23#include <asm/ptrace.h> 24#include <asm/ptrace.h>
@@ -513,7 +514,7 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
513 * want to handle. Thus you cannot kill init even with a SIGKILL even by 514 * want to handle. Thus you cannot kill init even with a SIGKILL even by
514 * mistake. 515 * mistake.
515 */ 516 */
516asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0) 517static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
517{ 518{
518 struct k_sigaction ka; 519 struct k_sigaction ka;
519 int restart_syscall; 520 int restart_syscall;
@@ -552,6 +553,8 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0)
552 */ 553 */
553 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 554 if (test_thread_flag(TIF_RESTORE_SIGMASK))
554 clear_thread_flag(TIF_RESTORE_SIGMASK); 555 clear_thread_flag(TIF_RESTORE_SIGMASK);
556
557 tracehook_signal_handler(signr, &info, &ka, regs, 0);
555 return; 558 return;
556 } 559 }
557 if (restart_syscall && 560 if (restart_syscall &&
@@ -579,6 +582,17 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0)
579 } 582 }
580} 583}
581 584
585void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0,
586 unsigned long thread_info_flags)
587{
588 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
589 do_signal(regs, orig_i0);
590 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
591 clear_thread_flag(TIF_NOTIFY_RESUME);
592 tracehook_notify_resume(regs);
593 }
594}
595
582asmlinkage int 596asmlinkage int
583do_sys_sigstack(struct sigstack __user *ssptr, struct sigstack __user *ossptr, 597do_sys_sigstack(struct sigstack __user *ssptr, struct sigstack __user *ossptr,
584 unsigned long sp) 598 unsigned long sp)
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 7c88263256af..923a98959fa7 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -17,6 +17,7 @@ config SPARC64
17 select HAVE_LMB 17 select HAVE_LMB
18 select HAVE_ARCH_KGDB 18 select HAVE_ARCH_KGDB
19 select USE_GENERIC_SMP_HELPERS if SMP 19 select USE_GENERIC_SMP_HELPERS if SMP
20 select HAVE_ARCH_TRACEHOOK
20 21
21config GENERIC_TIME 22config GENERIC_TIME
22 bool 23 bool
diff --git a/arch/sparc64/kernel/compat_audit.c b/arch/sparc64/kernel/compat_audit.c
index c1979482aa92..c831b0a4e660 100644
--- a/arch/sparc64/kernel/compat_audit.c
+++ b/arch/sparc64/kernel/compat_audit.c
@@ -1,4 +1,4 @@
1#include <asm-sparc/unistd.h> 1#include <asm/unistd_32.h>
2 2
3unsigned sparc32_dir_class[] = { 3unsigned sparc32_dir_class[] = {
4#include <asm-generic/audit_dir_write.h> 4#include <asm-generic/audit_dir_write.h>
diff --git a/arch/sparc64/kernel/entry.h b/arch/sparc64/kernel/entry.h
index 32fbab620852..fc294a292899 100644
--- a/arch/sparc64/kernel/entry.h
+++ b/arch/sparc64/kernel/entry.h
@@ -22,8 +22,7 @@ extern void do_notify_resume(struct pt_regs *regs,
22 unsigned long orig_i0, 22 unsigned long orig_i0,
23 unsigned long thread_info_flags); 23 unsigned long thread_info_flags);
24 24
25extern asmlinkage void syscall_trace(struct pt_regs *regs, 25extern asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p);
26 int syscall_exit_p);
27 26
28extern void bad_trap_tl1(struct pt_regs *regs, long lvl); 27extern void bad_trap_tl1(struct pt_regs *regs, long lvl);
29 28
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index f6c9fc92921d..bd578cc4856d 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -23,6 +23,7 @@
23#include <linux/audit.h> 23#include <linux/audit.h>
24#include <linux/signal.h> 24#include <linux/signal.h>
25#include <linux/regset.h> 25#include <linux/regset.h>
26#include <linux/tracehook.h>
26#include <linux/compat.h> 27#include <linux/compat.h>
27#include <linux/elf.h> 28#include <linux/elf.h>
28 29
@@ -1049,8 +1050,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1049 return ret; 1050 return ret;
1050} 1051}
1051 1052
1052asmlinkage void syscall_trace(struct pt_regs *regs, int syscall_exit_p) 1053asmlinkage int syscall_trace(struct pt_regs *regs, int syscall_exit_p)
1053{ 1054{
1055 int ret = 0;
1056
1054 /* do the secure computing check first */ 1057 /* do the secure computing check first */
1055 secure_computing(regs->u_regs[UREG_G1]); 1058 secure_computing(regs->u_regs[UREG_G1]);
1056 1059
@@ -1064,27 +1067,14 @@ asmlinkage void syscall_trace(struct pt_regs *regs, int syscall_exit_p)
1064 audit_syscall_exit(result, regs->u_regs[UREG_I0]); 1067 audit_syscall_exit(result, regs->u_regs[UREG_I0]);
1065 } 1068 }
1066 1069
1067 if (!(current->ptrace & PT_PTRACED)) 1070 if (test_thread_flag(TIF_SYSCALL_TRACE)) {
1068 goto out; 1071 if (syscall_exit_p)
1069 1072 tracehook_report_syscall_exit(regs, 0);
1070 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 1073 else
1071 goto out; 1074 ret = tracehook_report_syscall_entry(regs);
1072
1073 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
1074 ? 0x80 : 0));
1075
1076 /*
1077 * this isn't the same as continuing with a signal, but it will do
1078 * for normal use. strace only continues with a signal if the
1079 * stopping signal is not SIGTRAP. -brl
1080 */
1081 if (current->exit_code) {
1082 send_sig(current->exit_code, current, 1);
1083 current->exit_code = 0;
1084 } 1075 }
1085 1076
1086out: 1077 if (unlikely(current->audit_context) && !syscall_exit_p && !ret)
1087 if (unlikely(current->audit_context) && !syscall_exit_p)
1088 audit_syscall_entry((test_thread_flag(TIF_32BIT) ? 1078 audit_syscall_entry((test_thread_flag(TIF_32BIT) ?
1089 AUDIT_ARCH_SPARC : 1079 AUDIT_ARCH_SPARC :
1090 AUDIT_ARCH_SPARC64), 1080 AUDIT_ARCH_SPARC64),
@@ -1093,4 +1083,6 @@ out:
1093 regs->u_regs[UREG_I1], 1083 regs->u_regs[UREG_I1],
1094 regs->u_regs[UREG_I2], 1084 regs->u_regs[UREG_I2],
1095 regs->u_regs[UREG_I3]); 1085 regs->u_regs[UREG_I3]);
1086
1087 return ret;
1096} 1088}
diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S
index c6fc695fe1fe..97a993c1f7f3 100644
--- a/arch/sparc64/kernel/rtrap.S
+++ b/arch/sparc64/kernel/rtrap.S
@@ -46,7 +46,7 @@ __handle_user_windows:
46 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 46 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
47 ldx [%g6 + TI_FLAGS], %l0 47 ldx [%g6 + TI_FLAGS], %l0
48 48
491: andcc %l0, _TIF_SIGPENDING, %g0 491: andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
50 be,pt %xcc, __handle_user_windows_continue 50 be,pt %xcc, __handle_user_windows_continue
51 nop 51 nop
52 mov %l5, %o1 52 mov %l5, %o1
@@ -86,7 +86,7 @@ __handle_perfctrs:
86 wrpr %g0, RTRAP_PSTATE, %pstate 86 wrpr %g0, RTRAP_PSTATE, %pstate
87 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 87 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
88 ldx [%g6 + TI_FLAGS], %l0 88 ldx [%g6 + TI_FLAGS], %l0
891: andcc %l0, _TIF_SIGPENDING, %g0 891: andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
90 90
91 be,pt %xcc, __handle_perfctrs_continue 91 be,pt %xcc, __handle_perfctrs_continue
92 sethi %hi(TSTATE_PEF), %o0 92 sethi %hi(TSTATE_PEF), %o0
@@ -195,7 +195,7 @@ __handle_preemption_continue:
195 andcc %l1, %o0, %g0 195 andcc %l1, %o0, %g0
196 andcc %l0, _TIF_NEED_RESCHED, %g0 196 andcc %l0, _TIF_NEED_RESCHED, %g0
197 bne,pn %xcc, __handle_preemption 197 bne,pn %xcc, __handle_preemption
198 andcc %l0, _TIF_SIGPENDING, %g0 198 andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
199 bne,pn %xcc, __handle_signal 199 bne,pn %xcc, __handle_signal
200__handle_signal_continue: 200__handle_signal_continue:
201 ldub [%g6 + TI_WSAVED], %o2 201 ldub [%g6 + TI_WSAVED], %o2
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
index 9667e96fd513..d1b84456a9ee 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc64/kernel/signal.c
@@ -17,11 +17,13 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/wait.h> 18#include <linux/wait.h>
19#include <linux/ptrace.h> 19#include <linux/ptrace.h>
20#include <linux/tracehook.h>
20#include <linux/unistd.h> 21#include <linux/unistd.h>
21#include <linux/mm.h> 22#include <linux/mm.h>
22#include <linux/tty.h> 23#include <linux/tty.h>
23#include <linux/binfmts.h> 24#include <linux/binfmts.h>
24#include <linux/bitops.h> 25#include <linux/bitops.h>
26#include <linux/tracehook.h>
25 27
26#include <asm/uaccess.h> 28#include <asm/uaccess.h>
27#include <asm/ptrace.h> 29#include <asm/ptrace.h>
@@ -574,6 +576,8 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
574 * clear the TS_RESTORE_SIGMASK flag. 576 * clear the TS_RESTORE_SIGMASK flag.
575 */ 577 */
576 current_thread_info()->status &= ~TS_RESTORE_SIGMASK; 578 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
579
580 tracehook_signal_handler(signr, &info, &ka, regs, 0);
577 return; 581 return;
578 } 582 }
579 if (restart_syscall && 583 if (restart_syscall &&
@@ -605,4 +609,8 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long
605{ 609{
606 if (thread_info_flags & _TIF_SIGPENDING) 610 if (thread_info_flags & _TIF_SIGPENDING)
607 do_signal(regs, orig_i0); 611 do_signal(regs, orig_i0);
612 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
613 clear_thread_flag(TIF_NOTIFY_RESUME);
614 tracehook_notify_resume(regs);
615 }
608} 616}
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index 97cdd1bf4a10..ba5b09ad6666 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -19,6 +19,7 @@
19#include <linux/binfmts.h> 19#include <linux/binfmts.h>
20#include <linux/compat.h> 20#include <linux/compat.h>
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22#include <linux/tracehook.h>
22 23
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24#include <asm/ptrace.h> 25#include <asm/ptrace.h>
@@ -794,6 +795,8 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs,
794 * clear the TS_RESTORE_SIGMASK flag. 795 * clear the TS_RESTORE_SIGMASK flag.
795 */ 796 */
796 current_thread_info()->status &= ~TS_RESTORE_SIGMASK; 797 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
798
799 tracehook_signal_handler(signr, &info, &ka, regs, 0);
797 return; 800 return;
798 } 801 }
799 if (restart_syscall && 802 if (restart_syscall &&
diff --git a/arch/sparc64/kernel/syscalls.S b/arch/sparc64/kernel/syscalls.S
index db19ed67acf6..a2f24270ed8a 100644
--- a/arch/sparc64/kernel/syscalls.S
+++ b/arch/sparc64/kernel/syscalls.S
@@ -162,6 +162,8 @@ linux_syscall_trace32:
162 add %sp, PTREGS_OFF, %o0 162 add %sp, PTREGS_OFF, %o0
163 call syscall_trace 163 call syscall_trace
164 clr %o1 164 clr %o1
165 brnz,pn %o0, 3f
166 mov -ENOSYS, %o0
165 srl %i0, 0, %o0 167 srl %i0, 0, %o0
166 srl %i4, 0, %o4 168 srl %i4, 0, %o4
167 srl %i1, 0, %o1 169 srl %i1, 0, %o1
@@ -173,6 +175,8 @@ linux_syscall_trace:
173 add %sp, PTREGS_OFF, %o0 175 add %sp, PTREGS_OFF, %o0
174 call syscall_trace 176 call syscall_trace
175 clr %o1 177 clr %o1
178 brnz,pn %o0, 3f
179 mov -ENOSYS, %o0
176 mov %i0, %o0 180 mov %i0, %o0
177 mov %i1, %o1 181 mov %i1, %o1
178 mov %i2, %o2 182 mov %i2, %o2
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 5047490fc299..d741f35d7b3a 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -362,19 +362,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data)
362 if (tty == NULL) 362 if (tty == NULL)
363 return IRQ_NONE; 363 return IRQ_NONE;
364 364
365 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && 365 tty_wakeup(tty);
366 (tty->ldisc.write_wakeup != NULL))
367 (tty->ldisc.write_wakeup)(tty);
368
369 /*
370 * BLOCKING mode
371 * In blocking mode, everything sleeps on tty->write_wait.
372 * Sleeping in the console driver would break non-blocking
373 * writes.
374 */
375
376 if (waitqueue_active(&tty->write_wait))
377 wake_up_interruptible(&tty->write_wait);
378 return IRQ_HANDLED; 366 return IRQ_HANDLED;
379} 367}
380 368
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b6fa2877b173..3d0f2b6a5a16 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -30,6 +30,7 @@ config X86
30 select HAVE_FTRACE 30 select HAVE_FTRACE
31 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) 31 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
32 select HAVE_ARCH_KGDB if !X86_VOYAGER 32 select HAVE_ARCH_KGDB if !X86_VOYAGER
33 select HAVE_GENERIC_DMA_COHERENT if X86_32
33 select HAVE_EFFICIENT_UNALIGNED_ACCESS 34 select HAVE_EFFICIENT_UNALIGNED_ACCESS
34 35
35config ARCH_DEFCONFIG 36config ARCH_DEFCONFIG
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index 9220cf46aa10..c2502eb9aa83 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -73,7 +73,6 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
73 struct cpuinfo_x86 *c = &cpu_data(cpu); 73 struct cpuinfo_x86 *c = &cpu_data(cpu);
74 74
75 cpumask_t saved_mask; 75 cpumask_t saved_mask;
76 cpumask_of_cpu_ptr(new_mask, cpu);
77 int retval; 76 int retval;
78 unsigned int eax, ebx, ecx, edx; 77 unsigned int eax, ebx, ecx, edx;
79 unsigned int edx_part; 78 unsigned int edx_part;
@@ -92,7 +91,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
92 91
93 /* Make sure we are running on right CPU */ 92 /* Make sure we are running on right CPU */
94 saved_mask = current->cpus_allowed; 93 saved_mask = current->cpus_allowed;
95 retval = set_cpus_allowed_ptr(current, new_mask); 94 retval = set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
96 if (retval) 95 if (retval)
97 return -1; 96 return -1;
98 97
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 74697408576f..22d7d050905d 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -29,9 +29,6 @@
29 29
30#define CMD_SET_TYPE(cmd, t) ((cmd)->data[1] |= ((t) << 28)) 30#define CMD_SET_TYPE(cmd, t) ((cmd)->data[1] |= ((t) << 28))
31 31
32#define to_pages(addr, size) \
33 (round_up(((addr) & ~PAGE_MASK) + (size), PAGE_SIZE) >> PAGE_SHIFT)
34
35#define EXIT_LOOP_COUNT 10000000 32#define EXIT_LOOP_COUNT 10000000
36 33
37static DEFINE_RWLOCK(amd_iommu_devtable_lock); 34static DEFINE_RWLOCK(amd_iommu_devtable_lock);
@@ -185,7 +182,7 @@ static int iommu_flush_pages(struct amd_iommu *iommu, u16 domid,
185 u64 address, size_t size) 182 u64 address, size_t size)
186{ 183{
187 int s = 0; 184 int s = 0;
188 unsigned pages = to_pages(address, size); 185 unsigned pages = iommu_num_pages(address, size);
189 186
190 address &= PAGE_MASK; 187 address &= PAGE_MASK;
191 188
@@ -557,8 +554,8 @@ static struct dma_ops_domain *dma_ops_domain_alloc(struct amd_iommu *iommu,
557 if (iommu->exclusion_start && 554 if (iommu->exclusion_start &&
558 iommu->exclusion_start < dma_dom->aperture_size) { 555 iommu->exclusion_start < dma_dom->aperture_size) {
559 unsigned long startpage = iommu->exclusion_start >> PAGE_SHIFT; 556 unsigned long startpage = iommu->exclusion_start >> PAGE_SHIFT;
560 int pages = to_pages(iommu->exclusion_start, 557 int pages = iommu_num_pages(iommu->exclusion_start,
561 iommu->exclusion_length); 558 iommu->exclusion_length);
562 dma_ops_reserve_addresses(dma_dom, startpage, pages); 559 dma_ops_reserve_addresses(dma_dom, startpage, pages);
563 } 560 }
564 561
@@ -767,7 +764,7 @@ static dma_addr_t __map_single(struct device *dev,
767 unsigned int pages; 764 unsigned int pages;
768 int i; 765 int i;
769 766
770 pages = to_pages(paddr, size); 767 pages = iommu_num_pages(paddr, size);
771 paddr &= PAGE_MASK; 768 paddr &= PAGE_MASK;
772 769
773 address = dma_ops_alloc_addresses(dev, dma_dom, pages); 770 address = dma_ops_alloc_addresses(dev, dma_dom, pages);
@@ -802,7 +799,7 @@ static void __unmap_single(struct amd_iommu *iommu,
802 if ((dma_addr == 0) || (dma_addr + size > dma_dom->aperture_size)) 799 if ((dma_addr == 0) || (dma_addr + size > dma_dom->aperture_size))
803 return; 800 return;
804 801
805 pages = to_pages(dma_addr, size); 802 pages = iommu_num_pages(dma_addr, size);
806 dma_addr &= PAGE_MASK; 803 dma_addr &= PAGE_MASK;
807 start = dma_addr; 804 start = dma_addr;
808 805
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index ff2fff56f0a8..dd097b835839 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -200,12 +200,10 @@ static void drv_read(struct drv_cmd *cmd)
200static void drv_write(struct drv_cmd *cmd) 200static void drv_write(struct drv_cmd *cmd)
201{ 201{
202 cpumask_t saved_mask = current->cpus_allowed; 202 cpumask_t saved_mask = current->cpus_allowed;
203 cpumask_of_cpu_ptr_declare(cpu_mask);
204 unsigned int i; 203 unsigned int i;
205 204
206 for_each_cpu_mask_nr(i, cmd->mask) { 205 for_each_cpu_mask_nr(i, cmd->mask) {
207 cpumask_of_cpu_ptr_next(cpu_mask, i); 206 set_cpus_allowed_ptr(current, &cpumask_of_cpu(i));
208 set_cpus_allowed_ptr(current, cpu_mask);
209 do_drv_write(cmd); 207 do_drv_write(cmd);
210 } 208 }
211 209
@@ -269,12 +267,11 @@ static unsigned int get_measured_perf(unsigned int cpu)
269 } aperf_cur, mperf_cur; 267 } aperf_cur, mperf_cur;
270 268
271 cpumask_t saved_mask; 269 cpumask_t saved_mask;
272 cpumask_of_cpu_ptr(cpu_mask, cpu);
273 unsigned int perf_percent; 270 unsigned int perf_percent;
274 unsigned int retval; 271 unsigned int retval;
275 272
276 saved_mask = current->cpus_allowed; 273 saved_mask = current->cpus_allowed;
277 set_cpus_allowed_ptr(current, cpu_mask); 274 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
278 if (get_cpu() != cpu) { 275 if (get_cpu() != cpu) {
279 /* We were not able to run on requested processor */ 276 /* We were not able to run on requested processor */
280 put_cpu(); 277 put_cpu();
@@ -340,7 +337,6 @@ static unsigned int get_measured_perf(unsigned int cpu)
340 337
341static unsigned int get_cur_freq_on_cpu(unsigned int cpu) 338static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
342{ 339{
343 cpumask_of_cpu_ptr(cpu_mask, cpu);
344 struct acpi_cpufreq_data *data = per_cpu(drv_data, cpu); 340 struct acpi_cpufreq_data *data = per_cpu(drv_data, cpu);
345 unsigned int freq; 341 unsigned int freq;
346 unsigned int cached_freq; 342 unsigned int cached_freq;
@@ -353,7 +349,7 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
353 } 349 }
354 350
355 cached_freq = data->freq_table[data->acpi_data->state].frequency; 351 cached_freq = data->freq_table[data->acpi_data->state].frequency;
356 freq = extract_freq(get_cur_val(cpu_mask), data); 352 freq = extract_freq(get_cur_val(&cpumask_of_cpu(cpu)), data);
357 if (freq != cached_freq) { 353 if (freq != cached_freq) {
358 /* 354 /*
359 * The dreaded BIOS frequency change behind our back. 355 * The dreaded BIOS frequency change behind our back.
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 53c7b6936973..c45ca6d4dce1 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -479,12 +479,11 @@ static int core_voltage_post_transition(struct powernow_k8_data *data, u32 reqvi
479static int check_supported_cpu(unsigned int cpu) 479static int check_supported_cpu(unsigned int cpu)
480{ 480{
481 cpumask_t oldmask; 481 cpumask_t oldmask;
482 cpumask_of_cpu_ptr(cpu_mask, cpu);
483 u32 eax, ebx, ecx, edx; 482 u32 eax, ebx, ecx, edx;
484 unsigned int rc = 0; 483 unsigned int rc = 0;
485 484
486 oldmask = current->cpus_allowed; 485 oldmask = current->cpus_allowed;
487 set_cpus_allowed_ptr(current, cpu_mask); 486 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
488 487
489 if (smp_processor_id() != cpu) { 488 if (smp_processor_id() != cpu) {
490 printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu); 489 printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu);
@@ -1017,7 +1016,6 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i
1017static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsigned relation) 1016static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsigned relation)
1018{ 1017{
1019 cpumask_t oldmask; 1018 cpumask_t oldmask;
1020 cpumask_of_cpu_ptr(cpu_mask, pol->cpu);
1021 struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); 1019 struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu);
1022 u32 checkfid; 1020 u32 checkfid;
1023 u32 checkvid; 1021 u32 checkvid;
@@ -1032,7 +1030,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
1032 1030
1033 /* only run on specific CPU from here on */ 1031 /* only run on specific CPU from here on */
1034 oldmask = current->cpus_allowed; 1032 oldmask = current->cpus_allowed;
1035 set_cpus_allowed_ptr(current, cpu_mask); 1033 set_cpus_allowed_ptr(current, &cpumask_of_cpu(pol->cpu));
1036 1034
1037 if (smp_processor_id() != pol->cpu) { 1035 if (smp_processor_id() != pol->cpu) {
1038 printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); 1036 printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
@@ -1107,7 +1105,6 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1107{ 1105{
1108 struct powernow_k8_data *data; 1106 struct powernow_k8_data *data;
1109 cpumask_t oldmask; 1107 cpumask_t oldmask;
1110 cpumask_of_cpu_ptr_declare(newmask);
1111 int rc; 1108 int rc;
1112 1109
1113 if (!cpu_online(pol->cpu)) 1110 if (!cpu_online(pol->cpu))
@@ -1159,8 +1156,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1159 1156
1160 /* only run on specific CPU from here on */ 1157 /* only run on specific CPU from here on */
1161 oldmask = current->cpus_allowed; 1158 oldmask = current->cpus_allowed;
1162 cpumask_of_cpu_ptr_next(newmask, pol->cpu); 1159 set_cpus_allowed_ptr(current, &cpumask_of_cpu(pol->cpu));
1163 set_cpus_allowed_ptr(current, newmask);
1164 1160
1165 if (smp_processor_id() != pol->cpu) { 1161 if (smp_processor_id() != pol->cpu) {
1166 printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); 1162 printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
@@ -1182,7 +1178,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1182 set_cpus_allowed_ptr(current, &oldmask); 1178 set_cpus_allowed_ptr(current, &oldmask);
1183 1179
1184 if (cpu_family == CPU_HW_PSTATE) 1180 if (cpu_family == CPU_HW_PSTATE)
1185 pol->cpus = *newmask; 1181 pol->cpus = cpumask_of_cpu(pol->cpu);
1186 else 1182 else
1187 pol->cpus = per_cpu(cpu_core_map, pol->cpu); 1183 pol->cpus = per_cpu(cpu_core_map, pol->cpu);
1188 data->available_cores = &(pol->cpus); 1184 data->available_cores = &(pol->cpus);
@@ -1248,7 +1244,6 @@ static unsigned int powernowk8_get (unsigned int cpu)
1248{ 1244{
1249 struct powernow_k8_data *data; 1245 struct powernow_k8_data *data;
1250 cpumask_t oldmask = current->cpus_allowed; 1246 cpumask_t oldmask = current->cpus_allowed;
1251 cpumask_of_cpu_ptr(newmask, cpu);
1252 unsigned int khz = 0; 1247 unsigned int khz = 0;
1253 unsigned int first; 1248 unsigned int first;
1254 1249
@@ -1258,7 +1253,7 @@ static unsigned int powernowk8_get (unsigned int cpu)
1258 if (!data) 1253 if (!data)
1259 return -EINVAL; 1254 return -EINVAL;
1260 1255
1261 set_cpus_allowed_ptr(current, newmask); 1256 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
1262 if (smp_processor_id() != cpu) { 1257 if (smp_processor_id() != cpu) {
1263 printk(KERN_ERR PFX 1258 printk(KERN_ERR PFX
1264 "limiting to CPU %d failed in powernowk8_get\n", cpu); 1259 "limiting to CPU %d failed in powernowk8_get\n", cpu);
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
index ca2ac13b7af2..15e13c01cc36 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -324,10 +324,9 @@ static unsigned int get_cur_freq(unsigned int cpu)
324 unsigned l, h; 324 unsigned l, h;
325 unsigned clock_freq; 325 unsigned clock_freq;
326 cpumask_t saved_mask; 326 cpumask_t saved_mask;
327 cpumask_of_cpu_ptr(new_mask, cpu);
328 327
329 saved_mask = current->cpus_allowed; 328 saved_mask = current->cpus_allowed;
330 set_cpus_allowed_ptr(current, new_mask); 329 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
331 if (smp_processor_id() != cpu) 330 if (smp_processor_id() != cpu)
332 return 0; 331 return 0;
333 332
@@ -585,15 +584,12 @@ static int centrino_target (struct cpufreq_policy *policy,
585 * Best effort undo.. 584 * Best effort undo..
586 */ 585 */
587 586
588 if (!cpus_empty(*covered_cpus)) { 587 if (!cpus_empty(*covered_cpus))
589 cpumask_of_cpu_ptr_declare(new_mask);
590
591 for_each_cpu_mask_nr(j, *covered_cpus) { 588 for_each_cpu_mask_nr(j, *covered_cpus) {
592 cpumask_of_cpu_ptr_next(new_mask, j); 589 set_cpus_allowed_ptr(current,
593 set_cpus_allowed_ptr(current, new_mask); 590 &cpumask_of_cpu(j));
594 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); 591 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
595 } 592 }
596 }
597 593
598 tmp = freqs.new; 594 tmp = freqs.new;
599 freqs.new = freqs.old; 595 freqs.new = freqs.old;
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
index 2f3728dc24f6..191f7263c61d 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
@@ -244,8 +244,7 @@ static unsigned int _speedstep_get(const cpumask_t *cpus)
244 244
245static unsigned int speedstep_get(unsigned int cpu) 245static unsigned int speedstep_get(unsigned int cpu)
246{ 246{
247 cpumask_of_cpu_ptr(newmask, cpu); 247 return _speedstep_get(&cpumask_of_cpu(cpu));
248 return _speedstep_get(newmask);
249} 248}
250 249
251/** 250/**
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 650d40f7912b..6b0a10b002f1 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -516,7 +516,6 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
516 unsigned long j; 516 unsigned long j;
517 int retval; 517 int retval;
518 cpumask_t oldmask; 518 cpumask_t oldmask;
519 cpumask_of_cpu_ptr(newmask, cpu);
520 519
521 if (num_cache_leaves == 0) 520 if (num_cache_leaves == 0)
522 return -ENOENT; 521 return -ENOENT;
@@ -527,7 +526,7 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
527 return -ENOMEM; 526 return -ENOMEM;
528 527
529 oldmask = current->cpus_allowed; 528 oldmask = current->cpus_allowed;
530 retval = set_cpus_allowed_ptr(current, newmask); 529 retval = set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
531 if (retval) 530 if (retval)
532 goto out; 531 goto out;
533 532
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c
index 1fa8be5bd217..eaff0bbb1444 100644
--- a/arch/x86/kernel/genapic_64.c
+++ b/arch/x86/kernel/genapic_64.c
@@ -99,3 +99,4 @@ int is_uv_system(void)
99{ 99{
100 return uv_system_type != UV_NONE; 100 return uv_system_type != UV_NONE;
101} 101}
102EXPORT_SYMBOL_GPL(is_uv_system);
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index 3fee2aa50f3f..b68e21f06f4f 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -62,12 +62,10 @@ static int alloc_ldt(mm_context_t *pc, int mincount, int reload)
62 62
63 if (reload) { 63 if (reload) {
64#ifdef CONFIG_SMP 64#ifdef CONFIG_SMP
65 cpumask_of_cpu_ptr_declare(mask);
66
67 preempt_disable(); 65 preempt_disable();
68 load_LDT(pc); 66 load_LDT(pc);
69 cpumask_of_cpu_ptr_next(mask, smp_processor_id()); 67 if (!cpus_equal(current->mm->cpu_vm_mask,
70 if (!cpus_equal(current->mm->cpu_vm_mask, *mask)) 68 cpumask_of_cpu(smp_processor_id())))
71 smp_call_function(flush_ldt, current->mm, 1); 69 smp_call_function(flush_ldt, current->mm, 1);
72 preempt_enable(); 70 preempt_enable();
73#else 71#else
diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c
index 6994c751590e..652fa5c38ebe 100644
--- a/arch/x86/kernel/microcode.c
+++ b/arch/x86/kernel/microcode.c
@@ -388,7 +388,6 @@ static int do_microcode_update (void)
388 void *new_mc = NULL; 388 void *new_mc = NULL;
389 int cpu; 389 int cpu;
390 cpumask_t old; 390 cpumask_t old;
391 cpumask_of_cpu_ptr_declare(newmask);
392 391
393 old = current->cpus_allowed; 392 old = current->cpus_allowed;
394 393
@@ -405,8 +404,7 @@ static int do_microcode_update (void)
405 404
406 if (!uci->valid) 405 if (!uci->valid)
407 continue; 406 continue;
408 cpumask_of_cpu_ptr_next(newmask, cpu); 407 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
409 set_cpus_allowed_ptr(current, newmask);
410 error = get_maching_microcode(new_mc, cpu); 408 error = get_maching_microcode(new_mc, cpu);
411 if (error < 0) 409 if (error < 0)
412 goto out; 410 goto out;
@@ -576,7 +574,6 @@ static int apply_microcode_check_cpu(int cpu)
576 struct cpuinfo_x86 *c = &cpu_data(cpu); 574 struct cpuinfo_x86 *c = &cpu_data(cpu);
577 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 575 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
578 cpumask_t old; 576 cpumask_t old;
579 cpumask_of_cpu_ptr(newmask, cpu);
580 unsigned int val[2]; 577 unsigned int val[2];
581 int err = 0; 578 int err = 0;
582 579
@@ -585,7 +582,7 @@ static int apply_microcode_check_cpu(int cpu)
585 return 0; 582 return 0;
586 583
587 old = current->cpus_allowed; 584 old = current->cpus_allowed;
588 set_cpus_allowed_ptr(current, newmask); 585 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
589 586
590 /* Check if the microcode we have in memory matches the CPU */ 587 /* Check if the microcode we have in memory matches the CPU */
591 if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || 588 if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
@@ -623,12 +620,11 @@ static int apply_microcode_check_cpu(int cpu)
623static void microcode_init_cpu(int cpu, int resume) 620static void microcode_init_cpu(int cpu, int resume)
624{ 621{
625 cpumask_t old; 622 cpumask_t old;
626 cpumask_of_cpu_ptr(newmask, cpu);
627 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 623 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
628 624
629 old = current->cpus_allowed; 625 old = current->cpus_allowed;
630 626
631 set_cpus_allowed_ptr(current, newmask); 627 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
632 mutex_lock(&microcode_mutex); 628 mutex_lock(&microcode_mutex);
633 collect_cpu_info(cpu); 629 collect_cpu_info(cpu);
634 if (uci->valid && system_state == SYSTEM_RUNNING && !resume) 630 if (uci->valid && system_state == SYSTEM_RUNNING && !resume)
@@ -661,13 +657,10 @@ static ssize_t reload_store(struct sys_device *dev,
661 if (end == buf) 657 if (end == buf)
662 return -EINVAL; 658 return -EINVAL;
663 if (val == 1) { 659 if (val == 1) {
664 cpumask_t old; 660 cpumask_t old = current->cpus_allowed;
665 cpumask_of_cpu_ptr(newmask, cpu);
666
667 old = current->cpus_allowed;
668 661
669 get_online_cpus(); 662 get_online_cpus();
670 set_cpus_allowed_ptr(current, newmask); 663 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
671 664
672 mutex_lock(&microcode_mutex); 665 mutex_lock(&microcode_mutex);
673 if (uci->valid) 666 if (uci->valid)
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 37544123896d..87d4d6964ec2 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -123,6 +123,14 @@ void __init pci_iommu_alloc(void)
123 123
124 pci_swiotlb_init(); 124 pci_swiotlb_init();
125} 125}
126
127unsigned long iommu_num_pages(unsigned long addr, unsigned long len)
128{
129 unsigned long size = roundup((addr & ~PAGE_MASK) + len, PAGE_SIZE);
130
131 return size >> PAGE_SHIFT;
132}
133EXPORT_SYMBOL(iommu_num_pages);
126#endif 134#endif
127 135
128/* 136/*
@@ -192,124 +200,6 @@ static __init int iommu_setup(char *p)
192} 200}
193early_param("iommu", iommu_setup); 201early_param("iommu", iommu_setup);
194 202
195#ifdef CONFIG_X86_32
196int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
197 dma_addr_t device_addr, size_t size, int flags)
198{
199 void __iomem *mem_base = NULL;
200 int pages = size >> PAGE_SHIFT;
201 int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long);
202
203 if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0)
204 goto out;
205 if (!size)
206 goto out;
207 if (dev->dma_mem)
208 goto out;
209
210 /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */
211
212 mem_base = ioremap(bus_addr, size);
213 if (!mem_base)
214 goto out;
215
216 dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
217 if (!dev->dma_mem)
218 goto out;
219 dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
220 if (!dev->dma_mem->bitmap)
221 goto free1_out;
222
223 dev->dma_mem->virt_base = mem_base;
224 dev->dma_mem->device_base = device_addr;
225 dev->dma_mem->size = pages;
226 dev->dma_mem->flags = flags;
227
228 if (flags & DMA_MEMORY_MAP)
229 return DMA_MEMORY_MAP;
230
231 return DMA_MEMORY_IO;
232
233 free1_out:
234 kfree(dev->dma_mem);
235 out:
236 if (mem_base)
237 iounmap(mem_base);
238 return 0;
239}
240EXPORT_SYMBOL(dma_declare_coherent_memory);
241
242void dma_release_declared_memory(struct device *dev)
243{
244 struct dma_coherent_mem *mem = dev->dma_mem;
245
246 if (!mem)
247 return;
248 dev->dma_mem = NULL;
249 iounmap(mem->virt_base);
250 kfree(mem->bitmap);
251 kfree(mem);
252}
253EXPORT_SYMBOL(dma_release_declared_memory);
254
255void *dma_mark_declared_memory_occupied(struct device *dev,
256 dma_addr_t device_addr, size_t size)
257{
258 struct dma_coherent_mem *mem = dev->dma_mem;
259 int pos, err;
260 int pages = (size + (device_addr & ~PAGE_MASK) + PAGE_SIZE - 1);
261
262 pages >>= PAGE_SHIFT;
263
264 if (!mem)
265 return ERR_PTR(-EINVAL);
266
267 pos = (device_addr - mem->device_base) >> PAGE_SHIFT;
268 err = bitmap_allocate_region(mem->bitmap, pos, get_order(pages));
269 if (err != 0)
270 return ERR_PTR(err);
271 return mem->virt_base + (pos << PAGE_SHIFT);
272}
273EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
274
275static int dma_alloc_from_coherent_mem(struct device *dev, ssize_t size,
276 dma_addr_t *dma_handle, void **ret)
277{
278 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
279 int order = get_order(size);
280
281 if (mem) {
282 int page = bitmap_find_free_region(mem->bitmap, mem->size,
283 order);
284 if (page >= 0) {
285 *dma_handle = mem->device_base + (page << PAGE_SHIFT);
286 *ret = mem->virt_base + (page << PAGE_SHIFT);
287 memset(*ret, 0, size);
288 }
289 if (mem->flags & DMA_MEMORY_EXCLUSIVE)
290 *ret = NULL;
291 }
292 return (mem != NULL);
293}
294
295static int dma_release_coherent(struct device *dev, int order, void *vaddr)
296{
297 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
298
299 if (mem && vaddr >= mem->virt_base && vaddr <
300 (mem->virt_base + (mem->size << PAGE_SHIFT))) {
301 int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
302
303 bitmap_release_region(mem->bitmap, page, order);
304 return 1;
305 }
306 return 0;
307}
308#else
309#define dma_alloc_from_coherent_mem(dev, size, handle, ret) (0)
310#define dma_release_coherent(dev, order, vaddr) (0)
311#endif /* CONFIG_X86_32 */
312
313int dma_supported(struct device *dev, u64 mask) 203int dma_supported(struct device *dev, u64 mask)
314{ 204{
315 struct dma_mapping_ops *ops = get_dma_ops(dev); 205 struct dma_mapping_ops *ops = get_dma_ops(dev);
@@ -379,7 +269,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
379 /* ignore region specifiers */ 269 /* ignore region specifiers */
380 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); 270 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
381 271
382 if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory)) 272 if (dma_alloc_from_coherent(dev, size, dma_handle, &memory))
383 return memory; 273 return memory;
384 274
385 if (!dev) { 275 if (!dev) {
@@ -484,7 +374,7 @@ void dma_free_coherent(struct device *dev, size_t size,
484 374
485 int order = get_order(size); 375 int order = get_order(size);
486 WARN_ON(irqs_disabled()); /* for portability */ 376 WARN_ON(irqs_disabled()); /* for portability */
487 if (dma_release_coherent(dev, order, vaddr)) 377 if (dma_release_from_coherent(dev, order, vaddr))
488 return; 378 return;
489 if (ops->unmap_single) 379 if (ops->unmap_single)
490 ops->unmap_single(dev, bus, size, 0); 380 ops->unmap_single(dev, bus, size, 0);
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 744126e64950..49285f8fd4d5 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -67,9 +67,6 @@ static u32 gart_unmapped_entry;
67 (((x) & 0xfffff000) | (((x) >> 32) << 4) | GPTE_VALID | GPTE_COHERENT) 67 (((x) & 0xfffff000) | (((x) >> 32) << 4) | GPTE_VALID | GPTE_COHERENT)
68#define GPTE_DECODE(x) (((x) & 0xfffff000) | (((u64)(x) & 0xff0) << 28)) 68#define GPTE_DECODE(x) (((x) & 0xfffff000) | (((u64)(x) & 0xff0) << 28))
69 69
70#define to_pages(addr, size) \
71 (round_up(((addr) & ~PAGE_MASK) + (size), PAGE_SIZE) >> PAGE_SHIFT)
72
73#define EMERGENCY_PAGES 32 /* = 128KB */ 70#define EMERGENCY_PAGES 32 /* = 128KB */
74 71
75#ifdef CONFIG_AGP 72#ifdef CONFIG_AGP
@@ -241,7 +238,7 @@ nonforced_iommu(struct device *dev, unsigned long addr, size_t size)
241static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem, 238static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
242 size_t size, int dir) 239 size_t size, int dir)
243{ 240{
244 unsigned long npages = to_pages(phys_mem, size); 241 unsigned long npages = iommu_num_pages(phys_mem, size);
245 unsigned long iommu_page = alloc_iommu(dev, npages); 242 unsigned long iommu_page = alloc_iommu(dev, npages);
246 int i; 243 int i;
247 244
@@ -304,7 +301,7 @@ static void gart_unmap_single(struct device *dev, dma_addr_t dma_addr,
304 return; 301 return;
305 302
306 iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT; 303 iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT;
307 npages = to_pages(dma_addr, size); 304 npages = iommu_num_pages(dma_addr, size);
308 for (i = 0; i < npages; i++) { 305 for (i = 0; i < npages; i++) {
309 iommu_gatt_base[iommu_page + i] = gart_unmapped_entry; 306 iommu_gatt_base[iommu_page + i] = gart_unmapped_entry;
310 CLEAR_LEAK(iommu_page + i); 307 CLEAR_LEAK(iommu_page + i);
@@ -387,7 +384,7 @@ static int __dma_map_cont(struct device *dev, struct scatterlist *start,
387 } 384 }
388 385
389 addr = phys_addr; 386 addr = phys_addr;
390 pages = to_pages(s->offset, s->length); 387 pages = iommu_num_pages(s->offset, s->length);
391 while (pages--) { 388 while (pages--) {
392 iommu_gatt_base[iommu_page] = GPTE_ENCODE(addr); 389 iommu_gatt_base[iommu_page] = GPTE_ENCODE(addr);
393 SET_LEAK(iommu_page); 390 SET_LEAK(iommu_page);
@@ -470,7 +467,7 @@ gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
470 467
471 seg_size += s->length; 468 seg_size += s->length;
472 need = nextneed; 469 need = nextneed;
473 pages += to_pages(s->offset, s->length); 470 pages += iommu_num_pages(s->offset, s->length);
474 ps = s; 471 ps = s;
475 } 472 }
476 if (dma_map_cont(dev, start_sg, i - start, sgmap, pages, need) < 0) 473 if (dma_map_cont(dev, start_sg, i - start, sgmap, pages, need) < 0)
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 06a9f643817e..724adfc63cb9 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -414,25 +414,20 @@ void native_machine_shutdown(void)
414 414
415 /* The boot cpu is always logical cpu 0 */ 415 /* The boot cpu is always logical cpu 0 */
416 int reboot_cpu_id = 0; 416 int reboot_cpu_id = 0;
417 cpumask_of_cpu_ptr(newmask, reboot_cpu_id);
418 417
419#ifdef CONFIG_X86_32 418#ifdef CONFIG_X86_32
420 /* See if there has been given a command line override */ 419 /* See if there has been given a command line override */
421 if ((reboot_cpu != -1) && (reboot_cpu < NR_CPUS) && 420 if ((reboot_cpu != -1) && (reboot_cpu < NR_CPUS) &&
422 cpu_online(reboot_cpu)) { 421 cpu_online(reboot_cpu))
423 reboot_cpu_id = reboot_cpu; 422 reboot_cpu_id = reboot_cpu;
424 cpumask_of_cpu_ptr_next(newmask, reboot_cpu_id);
425 }
426#endif 423#endif
427 424
428 /* Make certain the cpu I'm about to reboot on is online */ 425 /* Make certain the cpu I'm about to reboot on is online */
429 if (!cpu_online(reboot_cpu_id)) { 426 if (!cpu_online(reboot_cpu_id))
430 reboot_cpu_id = smp_processor_id(); 427 reboot_cpu_id = smp_processor_id();
431 cpumask_of_cpu_ptr_next(newmask, reboot_cpu_id);
432 }
433 428
434 /* Make certain I only run on the appropriate processor */ 429 /* Make certain I only run on the appropriate processor */
435 set_cpus_allowed_ptr(current, newmask); 430 set_cpus_allowed_ptr(current, &cpumask_of_cpu(reboot_cpu_id));
436 431
437 /* O.K Now that I'm on the appropriate processor, 432 /* O.K Now that I'm on the appropriate processor,
438 * stop all of the others. 433 * stop all of the others.
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index b520dae02bf4..2d888586385d 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -788,10 +788,6 @@ void __init setup_arch(char **cmdline_p)
788 788
789 initmem_init(0, max_pfn); 789 initmem_init(0, max_pfn);
790 790
791#ifdef CONFIG_X86_64
792 dma32_reserve_bootmem();
793#endif
794
795#ifdef CONFIG_ACPI_SLEEP 791#ifdef CONFIG_ACPI_SLEEP
796 /* 792 /*
797 * Reserve low memory region for sleep support. 793 * Reserve low memory region for sleep support.
@@ -806,6 +802,15 @@ void __init setup_arch(char **cmdline_p)
806#endif 802#endif
807 reserve_crashkernel(); 803 reserve_crashkernel();
808 804
805#ifdef CONFIG_X86_64
806 /*
807 * dma32_reserve_bootmem() allocates bootmem which may conflict
808 * with the crashkernel command line, so do that after
809 * reserve_crashkernel()
810 */
811 dma32_reserve_bootmem();
812#endif
813
809 reserve_ibft_region(); 814 reserve_ibft_region();
810 815
811#ifdef CONFIG_KVM_CLOCK 816#ifdef CONFIG_KVM_CLOCK
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index f7745f94c006..76e305e064f9 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -80,24 +80,6 @@ static void __init setup_per_cpu_maps(void)
80#endif 80#endif
81} 81}
82 82
83#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
84cpumask_t *cpumask_of_cpu_map __read_mostly;
85EXPORT_SYMBOL(cpumask_of_cpu_map);
86
87/* requires nr_cpu_ids to be initialized */
88static void __init setup_cpumask_of_cpu(void)
89{
90 int i;
91
92 /* alloc_bootmem zeroes memory */
93 cpumask_of_cpu_map = alloc_bootmem_low(sizeof(cpumask_t) * nr_cpu_ids);
94 for (i = 0; i < nr_cpu_ids; i++)
95 cpu_set(i, cpumask_of_cpu_map[i]);
96}
97#else
98static inline void setup_cpumask_of_cpu(void) { }
99#endif
100
101#ifdef CONFIG_X86_32 83#ifdef CONFIG_X86_32
102/* 84/*
103 * Great future not-so-futuristic plan: make i386 and x86_64 do it 85 * Great future not-so-futuristic plan: make i386 and x86_64 do it
@@ -197,9 +179,6 @@ void __init setup_per_cpu_areas(void)
197 179
198 /* Setup node to cpumask map */ 180 /* Setup node to cpumask map */
199 setup_node_to_cpumask_map(); 181 setup_node_to_cpumask_map();
200
201 /* Setup cpumask_of_cpu map */
202 setup_cpumask_of_cpu();
203} 182}
204 183
205#endif 184#endif
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 8d45fabc5f3b..ce3251ce5504 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -21,6 +21,7 @@ config KVM
21 tristate "Kernel-based Virtual Machine (KVM) support" 21 tristate "Kernel-based Virtual Machine (KVM) support"
22 depends on HAVE_KVM 22 depends on HAVE_KVM
23 select PREEMPT_NOTIFIERS 23 select PREEMPT_NOTIFIERS
24 select MMU_NOTIFIER
24 select ANON_INODES 25 select ANON_INODES
25 ---help--- 26 ---help---
26 Support hosting fully virtualized guest machines using hardware 27 Support hosting fully virtualized guest machines using hardware
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 0313a5eec412..d9249a882aa5 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -1014,6 +1014,9 @@ __init void lguest_init(void)
1014 init_pg_tables_start = __pa(pg0); 1014 init_pg_tables_start = __pa(pg0);
1015 init_pg_tables_end = __pa(pg0); 1015 init_pg_tables_end = __pa(pg0);
1016 1016
1017 /* As described in head_32.S, we map the first 128M of memory. */
1018 max_pfn_mapped = (128*1024*1024) >> PAGE_SHIFT;
1019
1017 /* Load the %fs segment register (the per-cpu segment register) with 1020 /* Load the %fs segment register (the per-cpu segment register) with
1018 * the normal data segment to get through booting. */ 1021 * the normal data segment to get through booting. */
1019 asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_DS) : "memory"); 1022 asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_DS) : "memory");
diff --git a/arch/x86/lib/copy_user_64.S b/arch/x86/lib/copy_user_64.S
index dfdf428975c0..f118c110af32 100644
--- a/arch/x86/lib/copy_user_64.S
+++ b/arch/x86/lib/copy_user_64.S
@@ -52,7 +52,7 @@
52 jnz 100b 52 jnz 100b
53102: 53102:
54 .section .fixup,"ax" 54 .section .fixup,"ax"
55103: addl %r8d,%edx /* ecx is zerorest also */ 55103: addl %ecx,%edx /* ecx is zerorest also */
56 jmp copy_user_handle_tail 56 jmp copy_user_handle_tail
57 .previous 57 .previous
58 58
diff --git a/arch/x86/lib/copy_user_nocache_64.S b/arch/x86/lib/copy_user_nocache_64.S
index 40e0e309d27e..cb0c112386fb 100644
--- a/arch/x86/lib/copy_user_nocache_64.S
+++ b/arch/x86/lib/copy_user_nocache_64.S
@@ -32,7 +32,7 @@
32 jnz 100b 32 jnz 100b
33102: 33102:
34 .section .fixup,"ax" 34 .section .fixup,"ax"
35103: addl %r8d,%edx /* ecx is zerorest also */ 35103: addl %ecx,%edx /* ecx is zerorest also */
36 jmp copy_user_handle_tail 36 jmp copy_user_handle_tail
37 .previous 37 .previous
38 38
@@ -108,7 +108,6 @@ ENTRY(__copy_user_nocache)
108 jmp 60f 108 jmp 60f
10950: movl %ecx,%edx 10950: movl %ecx,%edx
11060: sfence 11060: sfence
111 movl %r8d,%ecx
112 jmp copy_user_handle_tail 111 jmp copy_user_handle_tail
113 .previous 112 .previous
114 113
diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
index 3085f25b4355..007bb06c7504 100644
--- a/arch/x86/mm/gup.c
+++ b/arch/x86/mm/gup.c
@@ -223,14 +223,17 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
223 struct page **pages) 223 struct page **pages)
224{ 224{
225 struct mm_struct *mm = current->mm; 225 struct mm_struct *mm = current->mm;
226 unsigned long end = start + (nr_pages << PAGE_SHIFT); 226 unsigned long addr, len, end;
227 unsigned long addr = start;
228 unsigned long next; 227 unsigned long next;
229 pgd_t *pgdp; 228 pgd_t *pgdp;
230 int nr = 0; 229 int nr = 0;
231 230
231 start &= PAGE_MASK;
232 addr = start;
233 len = (unsigned long) nr_pages << PAGE_SHIFT;
234 end = start + len;
232 if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ, 235 if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
233 start, nr_pages*PAGE_SIZE))) 236 start, len)))
234 goto slow_irqon; 237 goto slow_irqon;
235 238
236 /* 239 /*
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index ff3a6a336342..4bdaa590375d 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -23,7 +23,8 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
23 pci_read_config_byte(d, reg++, &busno); 23 pci_read_config_byte(d, reg++, &busno);
24 pci_read_config_byte(d, reg++, &suba); 24 pci_read_config_byte(d, reg++, &suba);
25 pci_read_config_byte(d, reg++, &subb); 25 pci_read_config_byte(d, reg++, &subb);
26 DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); 26 dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno,
27 suba, subb);
27 if (busno) 28 if (busno)
28 pci_scan_bus_with_sysdata(busno); /* Bus A */ 29 pci_scan_bus_with_sysdata(busno); /* Bus A */
29 if (suba < subb) 30 if (suba < subb)
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index a09505806b82..5807d1bc73f7 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -128,10 +128,8 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
128 pr = pci_find_parent_resource(dev, r); 128 pr = pci_find_parent_resource(dev, r);
129 if (!r->start || !pr || 129 if (!r->start || !pr ||
130 request_resource(pr, r) < 0) { 130 request_resource(pr, r) < 0) {
131 printk(KERN_ERR "PCI: Cannot allocate " 131 dev_err(&dev->dev, "BAR %d: can't "
132 "resource region %d " 132 "allocate resource\n", idx);
133 "of bridge %s\n",
134 idx, pci_name(dev));
135 /* 133 /*
136 * Something is wrong with the region. 134 * Something is wrong with the region.
137 * Invalidate the resource to prevent 135 * Invalidate the resource to prevent
@@ -166,15 +164,15 @@ static void __init pcibios_allocate_resources(int pass)
166 else 164 else
167 disabled = !(command & PCI_COMMAND_MEMORY); 165 disabled = !(command & PCI_COMMAND_MEMORY);
168 if (pass == disabled) { 166 if (pass == disabled) {
169 DBG("PCI: Resource %08lx-%08lx " 167 dev_dbg(&dev->dev, "resource %#08llx-%#08llx "
170 "(f=%lx, d=%d, p=%d)\n", 168 "(f=%lx, d=%d, p=%d)\n",
171 r->start, r->end, r->flags, disabled, pass); 169 (unsigned long long) r->start,
170 (unsigned long long) r->end,
171 r->flags, disabled, pass);
172 pr = pci_find_parent_resource(dev, r); 172 pr = pci_find_parent_resource(dev, r);
173 if (!pr || request_resource(pr, r) < 0) { 173 if (!pr || request_resource(pr, r) < 0) {
174 printk(KERN_ERR "PCI: Cannot allocate " 174 dev_err(&dev->dev, "BAR %d: can't "
175 "resource region %d " 175 "allocate resource\n", idx);
176 "of device %s\n",
177 idx, pci_name(dev));
178 /* We'll assign a new address later */ 176 /* We'll assign a new address later */
179 r->end -= r->start; 177 r->end -= r->start;
180 r->start = 0; 178 r->start = 0;
@@ -187,8 +185,7 @@ static void __init pcibios_allocate_resources(int pass)
187 /* Turn the ROM off, leave the resource region, 185 /* Turn the ROM off, leave the resource region,
188 * but keep it unregistered. */ 186 * but keep it unregistered. */
189 u32 reg; 187 u32 reg;
190 DBG("PCI: Switching off ROM of %s\n", 188 dev_dbg(&dev->dev, "disabling ROM\n");
191 pci_name(dev));
192 r->flags &= ~IORESOURCE_ROM_ENABLE; 189 r->flags &= ~IORESOURCE_ROM_ENABLE;
193 pci_read_config_dword(dev, 190 pci_read_config_dword(dev,
194 dev->rom_base_reg, &reg); 191 dev->rom_base_reg, &reg);
@@ -257,8 +254,7 @@ void pcibios_set_master(struct pci_dev *dev)
257 lat = pcibios_max_latency; 254 lat = pcibios_max_latency;
258 else 255 else
259 return; 256 return;
260 printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n", 257 dev_printk(KERN_DEBUG, &dev->dev, "setting latency timer to %d\n", lat);
261 pci_name(dev), lat);
262 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); 258 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
263} 259}
264 260
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 6a06a2eb0597..fec0123b33a9 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -436,7 +436,7 @@ static int pirq_vlsi_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
436{ 436{
437 WARN_ON_ONCE(pirq >= 9); 437 WARN_ON_ONCE(pirq >= 9);
438 if (pirq > 8) { 438 if (pirq > 8) {
439 printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq); 439 dev_info(&dev->dev, "VLSI router PIRQ escape (%d)\n", pirq);
440 return 0; 440 return 0;
441 } 441 }
442 return read_config_nybble(router, 0x74, pirq-1); 442 return read_config_nybble(router, 0x74, pirq-1);
@@ -446,7 +446,7 @@ static int pirq_vlsi_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
446{ 446{
447 WARN_ON_ONCE(pirq >= 9); 447 WARN_ON_ONCE(pirq >= 9);
448 if (pirq > 8) { 448 if (pirq > 8) {
449 printk(KERN_INFO "VLSI router pirq escape (%d)\n", pirq); 449 dev_info(&dev->dev, "VLSI router PIRQ escape (%d)\n", pirq);
450 return 0; 450 return 0;
451 } 451 }
452 write_config_nybble(router, 0x74, pirq-1, irq); 452 write_config_nybble(router, 0x74, pirq-1, irq);
@@ -492,15 +492,17 @@ static int pirq_amd756_get(struct pci_dev *router, struct pci_dev *dev, int pirq
492 irq = 0; 492 irq = 0;
493 if (pirq <= 4) 493 if (pirq <= 4)
494 irq = read_config_nybble(router, 0x56, pirq - 1); 494 irq = read_config_nybble(router, 0x56, pirq - 1);
495 printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d get irq : %2d\n", 495 dev_info(&dev->dev,
496 dev->vendor, dev->device, pirq, irq); 496 "AMD756: dev [%04x/%04x], router PIRQ %d get IRQ %d\n",
497 dev->vendor, dev->device, pirq, irq);
497 return irq; 498 return irq;
498} 499}
499 500
500static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) 501static int pirq_amd756_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
501{ 502{
502 printk(KERN_INFO "AMD756: dev %04x:%04x, router pirq : %d SET irq : %2d\n", 503 dev_info(&dev->dev,
503 dev->vendor, dev->device, pirq, irq); 504 "AMD756: dev [%04x/%04x], router PIRQ %d set IRQ %d\n",
505 dev->vendor, dev->device, pirq, irq);
504 if (pirq <= 4) 506 if (pirq <= 4)
505 write_config_nybble(router, 0x56, pirq - 1, irq); 507 write_config_nybble(router, 0x56, pirq - 1, irq);
506 return 1; 508 return 1;
@@ -730,7 +732,6 @@ static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router,
730 switch (device) { 732 switch (device) {
731 case PCI_DEVICE_ID_AL_M1533: 733 case PCI_DEVICE_ID_AL_M1533:
732 case PCI_DEVICE_ID_AL_M1563: 734 case PCI_DEVICE_ID_AL_M1563:
733 printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n");
734 r->name = "ALI"; 735 r->name = "ALI";
735 r->get = pirq_ali_get; 736 r->get = pirq_ali_get;
736 r->set = pirq_ali_set; 737 r->set = pirq_ali_set;
@@ -840,11 +841,9 @@ static void __init pirq_find_router(struct irq_router *r)
840 h->probe(r, pirq_router_dev, pirq_router_dev->device)) 841 h->probe(r, pirq_router_dev, pirq_router_dev->device))
841 break; 842 break;
842 } 843 }
843 printk(KERN_INFO "PCI: Using IRQ router %s [%04x/%04x] at %s\n", 844 dev_info(&pirq_router_dev->dev, "%s IRQ router [%04x/%04x]\n",
844 pirq_router.name, 845 pirq_router.name,
845 pirq_router_dev->vendor, 846 pirq_router_dev->vendor, pirq_router_dev->device);
846 pirq_router_dev->device,
847 pci_name(pirq_router_dev));
848 847
849 /* The device remains referenced for the kernel lifetime */ 848 /* The device remains referenced for the kernel lifetime */
850} 849}
@@ -877,7 +876,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
877 /* Find IRQ pin */ 876 /* Find IRQ pin */
878 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); 877 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
879 if (!pin) { 878 if (!pin) {
880 DBG(KERN_DEBUG " -> no interrupt pin\n"); 879 dev_dbg(&dev->dev, "no interrupt pin\n");
881 return 0; 880 return 0;
882 } 881 }
883 pin = pin - 1; 882 pin = pin - 1;
@@ -887,20 +886,20 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
887 if (!pirq_table) 886 if (!pirq_table)
888 return 0; 887 return 0;
889 888
890 DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin);
891 info = pirq_get_info(dev); 889 info = pirq_get_info(dev);
892 if (!info) { 890 if (!info) {
893 DBG(" -> not found in routing table\n" KERN_DEBUG); 891 dev_dbg(&dev->dev, "PCI INT %c not found in routing table\n",
892 'A' + pin);
894 return 0; 893 return 0;
895 } 894 }
896 pirq = info->irq[pin].link; 895 pirq = info->irq[pin].link;
897 mask = info->irq[pin].bitmap; 896 mask = info->irq[pin].bitmap;
898 if (!pirq) { 897 if (!pirq) {
899 DBG(" -> not routed\n" KERN_DEBUG); 898 dev_dbg(&dev->dev, "PCI INT %c not routed\n", 'A' + pin);
900 return 0; 899 return 0;
901 } 900 }
902 DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask, 901 dev_dbg(&dev->dev, "PCI INT %c -> PIRQ %02x, mask %04x, excl %04x",
903 pirq_table->exclusive_irqs); 902 'A' + pin, pirq, mask, pirq_table->exclusive_irqs);
904 mask &= pcibios_irq_mask; 903 mask &= pcibios_irq_mask;
905 904
906 /* Work around broken HP Pavilion Notebooks which assign USB to 905 /* Work around broken HP Pavilion Notebooks which assign USB to
@@ -930,10 +929,8 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
930 if (pci_probe & PCI_USE_PIRQ_MASK) 929 if (pci_probe & PCI_USE_PIRQ_MASK)
931 newirq = 0; 930 newirq = 0;
932 else 931 else
933 printk("\n" KERN_WARNING 932 dev_warn(&dev->dev, "IRQ %d doesn't match PIRQ mask "
934 "PCI: IRQ %i for device %s doesn't match PIRQ mask - try pci=usepirqmask\n" 933 "%#x; try pci=usepirqmask\n", newirq, mask);
935 KERN_DEBUG, newirq,
936 pci_name(dev));
937 } 934 }
938 if (!newirq && assign) { 935 if (!newirq && assign) {
939 for (i = 0; i < 16; i++) { 936 for (i = 0; i < 16; i++) {
@@ -944,39 +941,35 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
944 newirq = i; 941 newirq = i;
945 } 942 }
946 } 943 }
947 DBG(" -> newirq=%d", newirq); 944 dev_dbg(&dev->dev, "PCI INT %c -> newirq %d", 'A' + pin, newirq);
948 945
949 /* Check if it is hardcoded */ 946 /* Check if it is hardcoded */
950 if ((pirq & 0xf0) == 0xf0) { 947 if ((pirq & 0xf0) == 0xf0) {
951 irq = pirq & 0xf; 948 irq = pirq & 0xf;
952 DBG(" -> hardcoded IRQ %d\n", irq); 949 msg = "hardcoded";
953 msg = "Hardcoded";
954 } else if (r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \ 950 } else if (r->get && (irq = r->get(pirq_router_dev, dev, pirq)) && \
955 ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask))) { 951 ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask))) {
956 DBG(" -> got IRQ %d\n", irq); 952 msg = "found";
957 msg = "Found";
958 eisa_set_level_irq(irq); 953 eisa_set_level_irq(irq);
959 } else if (newirq && r->set && 954 } else if (newirq && r->set &&
960 (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) { 955 (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) {
961 DBG(" -> assigning IRQ %d", newirq);
962 if (r->set(pirq_router_dev, dev, pirq, newirq)) { 956 if (r->set(pirq_router_dev, dev, pirq, newirq)) {
963 eisa_set_level_irq(newirq); 957 eisa_set_level_irq(newirq);
964 DBG(" ... OK\n"); 958 msg = "assigned";
965 msg = "Assigned";
966 irq = newirq; 959 irq = newirq;
967 } 960 }
968 } 961 }
969 962
970 if (!irq) { 963 if (!irq) {
971 DBG(" ... failed\n");
972 if (newirq && mask == (1 << newirq)) { 964 if (newirq && mask == (1 << newirq)) {
973 msg = "Guessed"; 965 msg = "guessed";
974 irq = newirq; 966 irq = newirq;
975 } else 967 } else {
968 dev_dbg(&dev->dev, "can't route interrupt\n");
976 return 0; 969 return 0;
970 }
977 } 971 }
978 printk(KERN_INFO "PCI: %s IRQ %d for device %s\n", msg, irq, 972 dev_info(&dev->dev, "%s PCI INT %c -> IRQ %d\n", msg, 'A' + pin, irq);
979 pci_name(dev));
980 973
981 /* Update IRQ for all devices with the same pirq value */ 974 /* Update IRQ for all devices with the same pirq value */
982 while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) { 975 while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) {
@@ -996,17 +989,17 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
996 (!(pci_probe & PCI_USE_PIRQ_MASK) || \ 989 (!(pci_probe & PCI_USE_PIRQ_MASK) || \
997 ((1 << dev2->irq) & mask))) { 990 ((1 << dev2->irq) & mask))) {
998#ifndef CONFIG_PCI_MSI 991#ifndef CONFIG_PCI_MSI
999 printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n", 992 dev_info(&dev2->dev, "IRQ routing conflict: "
1000 pci_name(dev2), dev2->irq, irq); 993 "have IRQ %d, want IRQ %d\n",
994 dev2->irq, irq);
1001#endif 995#endif
1002 continue; 996 continue;
1003 } 997 }
1004 dev2->irq = irq; 998 dev2->irq = irq;
1005 pirq_penalty[irq]++; 999 pirq_penalty[irq]++;
1006 if (dev != dev2) 1000 if (dev != dev2)
1007 printk(KERN_INFO 1001 dev_info(&dev->dev, "sharing IRQ %d with %s\n",
1008 "PCI: Sharing IRQ %d with %s\n", 1002 irq, pci_name(dev2));
1009 irq, pci_name(dev2));
1010 } 1003 }
1011 } 1004 }
1012 return 1; 1005 return 1;
@@ -1025,8 +1018,7 @@ static void __init pcibios_fixup_irqs(void)
1025 * already in use. 1018 * already in use.
1026 */ 1019 */
1027 if (dev->irq >= 16) { 1020 if (dev->irq >= 16) {
1028 DBG(KERN_DEBUG "%s: ignoring bogus IRQ %d\n", 1021 dev_dbg(&dev->dev, "ignoring bogus IRQ %d\n", dev->irq);
1029 pci_name(dev), dev->irq);
1030 dev->irq = 0; 1022 dev->irq = 0;
1031 } 1023 }
1032 /* 1024 /*
@@ -1070,12 +1062,12 @@ static void __init pcibios_fixup_irqs(void)
1070 irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, 1062 irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
1071 PCI_SLOT(bridge->devfn), pin); 1063 PCI_SLOT(bridge->devfn), pin);
1072 if (irq >= 0) 1064 if (irq >= 0)
1073 printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n", 1065 dev_warn(&dev->dev, "using bridge %s INT %c to get IRQ %d\n",
1074 pci_name(bridge), 'A' + pin, irq); 1066 pci_name(bridge),
1067 'A' + pin, irq);
1075 } 1068 }
1076 if (irq >= 0) { 1069 if (irq >= 0) {
1077 printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", 1070 dev_info(&dev->dev, "PCI->APIC IRQ transform: INT %c -> IRQ %d\n", 'A' + pin, irq);
1078 pci_name(dev), 'A' + pin, irq);
1079 dev->irq = irq; 1071 dev->irq = irq;
1080 } 1072 }
1081 } 1073 }
@@ -1231,25 +1223,24 @@ static int pirq_enable_irq(struct pci_dev *dev)
1231 irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, 1223 irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number,
1232 PCI_SLOT(bridge->devfn), pin); 1224 PCI_SLOT(bridge->devfn), pin);
1233 if (irq >= 0) 1225 if (irq >= 0)
1234 printk(KERN_WARNING 1226 dev_warn(&dev->dev, "using bridge %s "
1235 "PCI: using PPB %s[%c] to get irq %d\n", 1227 "INT %c to get IRQ %d\n",
1236 pci_name(bridge), 1228 pci_name(bridge), 'A' + pin,
1237 'A' + pin, irq); 1229 irq);
1238 dev = bridge; 1230 dev = bridge;
1239 } 1231 }
1240 dev = temp_dev; 1232 dev = temp_dev;
1241 if (irq >= 0) { 1233 if (irq >= 0) {
1242 printk(KERN_INFO 1234 dev_info(&dev->dev, "PCI->APIC IRQ transform: "
1243 "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n", 1235 "INT %c -> IRQ %d\n", 'A' + pin, irq);
1244 pci_name(dev), 'A' + pin, irq);
1245 dev->irq = irq; 1236 dev->irq = irq;
1246 return 0; 1237 return 0;
1247 } else 1238 } else
1248 msg = " Probably buggy MP table."; 1239 msg = "; probably buggy MP table";
1249 } else if (pci_probe & PCI_BIOS_IRQ_SCAN) 1240 } else if (pci_probe & PCI_BIOS_IRQ_SCAN)
1250 msg = ""; 1241 msg = "";
1251 else 1242 else
1252 msg = " Please try using pci=biosirq."; 1243 msg = "; please try using pci=biosirq";
1253 1244
1254 /* 1245 /*
1255 * With IDE legacy devices the IRQ lookup failure is not 1246 * With IDE legacy devices the IRQ lookup failure is not
@@ -1259,9 +1250,8 @@ static int pirq_enable_irq(struct pci_dev *dev)
1259 !(dev->class & 0x5)) 1250 !(dev->class & 0x5))
1260 return 0; 1251 return 0;
1261 1252
1262 printk(KERN_WARNING 1253 dev_warn(&dev->dev, "can't find IRQ for PCI INT %c%s\n",
1263 "PCI: No IRQ known for interrupt pin %c of device %s.%s\n", 1254 'A' + pin, msg);
1264 'A' + pin, pci_name(dev), msg);
1265 } 1255 }
1266 return 0; 1256 return 0;
1267} 1257}
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c
index f4b16dc11dad..1177845d3186 100644
--- a/arch/x86/pci/numaq_32.c
+++ b/arch/x86/pci/numaq_32.c
@@ -131,13 +131,14 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
131 u8 busno, suba, subb; 131 u8 busno, suba, subb;
132 int quad = BUS2QUAD(d->bus->number); 132 int quad = BUS2QUAD(d->bus->number);
133 133
134 printk("PCI: Searching for i450NX host bridges on %s\n", pci_name(d)); 134 dev_info(&d->dev, "searching for i450NX host bridges\n");
135 reg = 0xd0; 135 reg = 0xd0;
136 for(pxb=0; pxb<2; pxb++) { 136 for(pxb=0; pxb<2; pxb++) {
137 pci_read_config_byte(d, reg++, &busno); 137 pci_read_config_byte(d, reg++, &busno);
138 pci_read_config_byte(d, reg++, &suba); 138 pci_read_config_byte(d, reg++, &suba);
139 pci_read_config_byte(d, reg++, &subb); 139 pci_read_config_byte(d, reg++, &subb);
140 DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb); 140 dev_dbg(&d->dev, "i450NX PXB %d: %02x/%02x/%02x\n",
141 pxb, busno, suba, subb);
141 if (busno) { 142 if (busno) {
142 /* Bus A */ 143 /* Bus A */
143 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno)); 144 pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno));
diff --git a/block/blk-core.c b/block/blk-core.c
index fef79ccb2a11..4889eb86a39e 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -212,6 +212,24 @@ void blk_plug_device(struct request_queue *q)
212} 212}
213EXPORT_SYMBOL(blk_plug_device); 213EXPORT_SYMBOL(blk_plug_device);
214 214
215/**
216 * blk_plug_device_unlocked - plug a device without queue lock held
217 * @q: The &struct request_queue to plug
218 *
219 * Description:
220 * Like @blk_plug_device(), but grabs the queue lock and disables
221 * interrupts.
222 **/
223void blk_plug_device_unlocked(struct request_queue *q)
224{
225 unsigned long flags;
226
227 spin_lock_irqsave(q->queue_lock, flags);
228 blk_plug_device(q);
229 spin_unlock_irqrestore(q->queue_lock, flags);
230}
231EXPORT_SYMBOL(blk_plug_device_unlocked);
232
215/* 233/*
216 * remove the queue from the plugged list, if present. called with 234 * remove the queue from the plugged list, if present. called with
217 * queue lock held and interrupts disabled. 235 * queue lock held and interrupts disabled.
diff --git a/drivers/Makefile b/drivers/Makefile
index 54ec5e718c0e..a280ab3d0833 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -97,3 +97,4 @@ obj-$(CONFIG_PPC_PS3) += ps3/
97obj-$(CONFIG_OF) += of/ 97obj-$(CONFIG_OF) += of/
98obj-$(CONFIG_SSB) += ssb/ 98obj-$(CONFIG_SSB) += ssb/
99obj-$(CONFIG_VIRTIO) += virtio/ 99obj-$(CONFIG_VIRTIO) += virtio/
100obj-$(CONFIG_REGULATOR) += regulator/
diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
index dd376f7ad090..d5b4ef898879 100644
--- a/drivers/acpi/pci_slot.c
+++ b/drivers/acpi/pci_slot.c
@@ -76,9 +76,9 @@ static struct acpi_pci_driver acpi_pci_slot_driver = {
76}; 76};
77 77
78static int 78static int
79check_slot(acpi_handle handle, int *device, unsigned long *sun) 79check_slot(acpi_handle handle, unsigned long *sun)
80{ 80{
81 int retval = 0; 81 int device = -1;
82 unsigned long adr, sta; 82 unsigned long adr, sta;
83 acpi_status status; 83 acpi_status status;
84 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 84 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -89,32 +89,27 @@ check_slot(acpi_handle handle, int *device, unsigned long *sun)
89 if (check_sta_before_sun) { 89 if (check_sta_before_sun) {
90 /* If SxFy doesn't have _STA, we just assume it's there */ 90 /* If SxFy doesn't have _STA, we just assume it's there */
91 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); 91 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
92 if (ACPI_SUCCESS(status) && !(sta & ACPI_STA_DEVICE_PRESENT)) { 92 if (ACPI_SUCCESS(status) && !(sta & ACPI_STA_DEVICE_PRESENT))
93 retval = -1;
94 goto out; 93 goto out;
95 }
96 } 94 }
97 95
98 status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr); 96 status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
99 if (ACPI_FAILURE(status)) { 97 if (ACPI_FAILURE(status)) {
100 dbg("_ADR returned %d on %s\n", status, (char *)buffer.pointer); 98 dbg("_ADR returned %d on %s\n", status, (char *)buffer.pointer);
101 retval = -1;
102 goto out; 99 goto out;
103 } 100 }
104 101
105 *device = (adr >> 16) & 0xffff;
106
107 /* No _SUN == not a slot == bail */ 102 /* No _SUN == not a slot == bail */
108 status = acpi_evaluate_integer(handle, "_SUN", NULL, sun); 103 status = acpi_evaluate_integer(handle, "_SUN", NULL, sun);
109 if (ACPI_FAILURE(status)) { 104 if (ACPI_FAILURE(status)) {
110 dbg("_SUN returned %d on %s\n", status, (char *)buffer.pointer); 105 dbg("_SUN returned %d on %s\n", status, (char *)buffer.pointer);
111 retval = -1;
112 goto out; 106 goto out;
113 } 107 }
114 108
109 device = (adr >> 16) & 0xffff;
115out: 110out:
116 kfree(buffer.pointer); 111 kfree(buffer.pointer);
117 return retval; 112 return device;
118} 113}
119 114
120struct callback_args { 115struct callback_args {
@@ -144,7 +139,8 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
144 struct callback_args *parent_context = context; 139 struct callback_args *parent_context = context;
145 struct pci_bus *pci_bus = parent_context->pci_bus; 140 struct pci_bus *pci_bus = parent_context->pci_bus;
146 141
147 if (check_slot(handle, &device, &sun)) 142 device = check_slot(handle, &sun);
143 if (device < 0)
148 return AE_OK; 144 return AE_OK;
149 145
150 slot = kmalloc(sizeof(*slot), GFP_KERNEL); 146 slot = kmalloc(sizeof(*slot), GFP_KERNEL);
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index b7f2963693a7..283c08f5f4d4 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -1332,9 +1332,15 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1332 if (!pr->flags.power_setup_done) 1332 if (!pr->flags.power_setup_done)
1333 return -ENODEV; 1333 return -ENODEV;
1334 1334
1335 /* Fall back to the default idle loop */ 1335 /*
1336 pm_idle = pm_idle_save; 1336 * Fall back to the default idle loop, when pm_idle_save had
1337 synchronize_sched(); /* Relies on interrupts forcing exit from idle. */ 1337 * been initialized.
1338 */
1339 if (pm_idle_save) {
1340 pm_idle = pm_idle_save;
1341 /* Relies on interrupts forcing exit from idle. */
1342 synchronize_sched();
1343 }
1338 1344
1339 pr->flags.power = 0; 1345 pr->flags.power = 0;
1340 result = acpi_processor_get_power_info(pr); 1346 result = acpi_processor_get_power_info(pr);
@@ -1896,7 +1902,8 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
1896 1902
1897 /* Unregister the idle handler when processor #0 is removed. */ 1903 /* Unregister the idle handler when processor #0 is removed. */
1898 if (pr->id == 0) { 1904 if (pr->id == 0) {
1899 pm_idle = pm_idle_save; 1905 if (pm_idle_save)
1906 pm_idle = pm_idle_save;
1900 1907
1901 /* 1908 /*
1902 * We are about to unload the current idle thread pm callback 1909 * We are about to unload the current idle thread pm callback
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index b4749969c6b4..0133af49cf06 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -64,7 +64,13 @@ static DEFINE_MUTEX(performance_mutex);
64 * policy is adjusted accordingly. 64 * policy is adjusted accordingly.
65 */ 65 */
66 66
67static unsigned int ignore_ppc = 0; 67/* ignore_ppc:
68 * -1 -> cpufreq low level drivers not initialized -> _PSS, etc. not called yet
69 * ignore _PPC
70 * 0 -> cpufreq low level drivers initialized -> consider _PPC values
71 * 1 -> ignore _PPC totally -> forced by user through boot param
72 */
73static unsigned int ignore_ppc = -1;
68module_param(ignore_ppc, uint, 0644); 74module_param(ignore_ppc, uint, 0644);
69MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \ 75MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \
70 "limited by BIOS, this should help"); 76 "limited by BIOS, this should help");
@@ -72,7 +78,7 @@ MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \
72#define PPC_REGISTERED 1 78#define PPC_REGISTERED 1
73#define PPC_IN_USE 2 79#define PPC_IN_USE 2
74 80
75static int acpi_processor_ppc_status = 0; 81static int acpi_processor_ppc_status;
76 82
77static int acpi_processor_ppc_notifier(struct notifier_block *nb, 83static int acpi_processor_ppc_notifier(struct notifier_block *nb,
78 unsigned long event, void *data) 84 unsigned long event, void *data)
@@ -81,13 +87,18 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
81 struct acpi_processor *pr; 87 struct acpi_processor *pr;
82 unsigned int ppc = 0; 88 unsigned int ppc = 0;
83 89
84 if (ignore_ppc) 90 if (event == CPUFREQ_START && ignore_ppc <= 0) {
91 ignore_ppc = 0;
85 return 0; 92 return 0;
93 }
86 94
87 mutex_lock(&performance_mutex); 95 if (ignore_ppc)
96 return 0;
88 97
89 if (event != CPUFREQ_INCOMPATIBLE) 98 if (event != CPUFREQ_INCOMPATIBLE)
90 goto out; 99 return 0;
100
101 mutex_lock(&performance_mutex);
91 102
92 pr = per_cpu(processors, policy->cpu); 103 pr = per_cpu(processors, policy->cpu);
93 if (!pr || !pr->performance) 104 if (!pr || !pr->performance)
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index a2c3f9cfa549..a56fc6c4394b 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -827,7 +827,6 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr)
827static int acpi_processor_get_throttling(struct acpi_processor *pr) 827static int acpi_processor_get_throttling(struct acpi_processor *pr)
828{ 828{
829 cpumask_t saved_mask; 829 cpumask_t saved_mask;
830 cpumask_of_cpu_ptr_declare(new_mask);
831 int ret; 830 int ret;
832 831
833 if (!pr) 832 if (!pr)
@@ -839,8 +838,7 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr)
839 * Migrate task to the cpu pointed by pr. 838 * Migrate task to the cpu pointed by pr.
840 */ 839 */
841 saved_mask = current->cpus_allowed; 840 saved_mask = current->cpus_allowed;
842 cpumask_of_cpu_ptr_next(new_mask, pr->id); 841 set_cpus_allowed_ptr(current, &cpumask_of_cpu(pr->id));
843 set_cpus_allowed_ptr(current, new_mask);
844 ret = pr->throttling.acpi_processor_get_throttling(pr); 842 ret = pr->throttling.acpi_processor_get_throttling(pr);
845 /* restore the previous state */ 843 /* restore the previous state */
846 set_cpus_allowed_ptr(current, &saved_mask); 844 set_cpus_allowed_ptr(current, &saved_mask);
@@ -989,7 +987,6 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr,
989int acpi_processor_set_throttling(struct acpi_processor *pr, int state) 987int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
990{ 988{
991 cpumask_t saved_mask; 989 cpumask_t saved_mask;
992 cpumask_of_cpu_ptr_declare(new_mask);
993 int ret = 0; 990 int ret = 0;
994 unsigned int i; 991 unsigned int i;
995 struct acpi_processor *match_pr; 992 struct acpi_processor *match_pr;
@@ -1028,8 +1025,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
1028 * it can be called only for the cpu pointed by pr. 1025 * it can be called only for the cpu pointed by pr.
1029 */ 1026 */
1030 if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { 1027 if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) {
1031 cpumask_of_cpu_ptr_next(new_mask, pr->id); 1028 set_cpus_allowed_ptr(current, &cpumask_of_cpu(pr->id));
1032 set_cpus_allowed_ptr(current, new_mask);
1033 ret = p_throttling->acpi_processor_set_throttling(pr, 1029 ret = p_throttling->acpi_processor_set_throttling(pr,
1034 t_state.target_state); 1030 t_state.target_state);
1035 } else { 1031 } else {
@@ -1060,8 +1056,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
1060 continue; 1056 continue;
1061 } 1057 }
1062 t_state.cpu = i; 1058 t_state.cpu = i;
1063 cpumask_of_cpu_ptr_next(new_mask, i); 1059 set_cpus_allowed_ptr(current, &cpumask_of_cpu(i));
1064 set_cpus_allowed_ptr(current, new_mask);
1065 ret = match_pr->throttling. 1060 ret = match_pr->throttling.
1066 acpi_processor_set_throttling( 1061 acpi_processor_set_throttling(
1067 match_pr, t_state.target_state); 1062 match_pr, t_state.target_state);
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 24df73ad326d..088885ed51b9 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -156,8 +156,8 @@ static void ia_hack_tcq(IADEV *dev) {
156 } 156 }
157 iavcc_r->vc_desc_cnt--; 157 iavcc_r->vc_desc_cnt--;
158 dev->desc_tbl[desc1 -1].timestamp = 0; 158 dev->desc_tbl[desc1 -1].timestamp = 0;
159 IF_EVENT(printk("ia_hack: return_q skb = 0x%x desc = %d\n", 159 IF_EVENT(printk("ia_hack: return_q skb = 0x%p desc = %d\n",
160 (u32)dev->desc_tbl[desc1 -1].txskb, desc1);) 160 dev->desc_tbl[desc1 -1].txskb, desc1);)
161 if (iavcc_r->pcr < dev->rate_limit) { 161 if (iavcc_r->pcr < dev->rate_limit) {
162 IA_SKB_STATE (dev->desc_tbl[desc1-1].txskb) |= IA_TX_DONE; 162 IA_SKB_STATE (dev->desc_tbl[desc1-1].txskb) |= IA_TX_DONE;
163 if (ia_enque_rtn_q(&dev->tx_return_q, dev->desc_tbl[desc1 -1]) < 0) 163 if (ia_enque_rtn_q(&dev->tx_return_q, dev->desc_tbl[desc1 -1]) < 0)
@@ -527,8 +527,8 @@ static int ia_cbr_setup (IADEV *dev, struct atm_vcc *vcc) {
527 inc = 0; 527 inc = 0;
528 testSlot = idealSlot; 528 testSlot = idealSlot;
529 TstSchedTbl = (u16*)(SchedTbl+testSlot); //set index and read in value 529 TstSchedTbl = (u16*)(SchedTbl+testSlot); //set index and read in value
530 IF_CBR(printk("CBR Testslot 0x%x AT Location 0x%x, NumToAssign=%d\n", 530 IF_CBR(printk("CBR Testslot 0x%x AT Location 0x%p, NumToAssign=%d\n",
531 testSlot, (u32)TstSchedTbl,toBeAssigned);) 531 testSlot, TstSchedTbl,toBeAssigned);)
532 memcpy((caddr_t)&cbrVC,(caddr_t)TstSchedTbl,sizeof(cbrVC)); 532 memcpy((caddr_t)&cbrVC,(caddr_t)TstSchedTbl,sizeof(cbrVC));
533 while (cbrVC) // If another VC at this location, we have to keep looking 533 while (cbrVC) // If another VC at this location, we have to keep looking
534 { 534 {
@@ -536,8 +536,8 @@ static int ia_cbr_setup (IADEV *dev, struct atm_vcc *vcc) {
536 testSlot = idealSlot - inc; 536 testSlot = idealSlot - inc;
537 if (testSlot < 0) { // Wrap if necessary 537 if (testSlot < 0) { // Wrap if necessary
538 testSlot += dev->CbrTotEntries; 538 testSlot += dev->CbrTotEntries;
539 IF_CBR(printk("Testslot Wrap. STable Start=0x%x,Testslot=%d\n", 539 IF_CBR(printk("Testslot Wrap. STable Start=0x%p,Testslot=%d\n",
540 (u32)SchedTbl,testSlot);) 540 SchedTbl,testSlot);)
541 } 541 }
542 TstSchedTbl = (u16 *)(SchedTbl + testSlot); // set table index 542 TstSchedTbl = (u16 *)(SchedTbl + testSlot); // set table index
543 memcpy((caddr_t)&cbrVC,(caddr_t)TstSchedTbl,sizeof(cbrVC)); 543 memcpy((caddr_t)&cbrVC,(caddr_t)TstSchedTbl,sizeof(cbrVC));
@@ -552,8 +552,8 @@ static int ia_cbr_setup (IADEV *dev, struct atm_vcc *vcc) {
552 } 552 }
553 // set table index and read in value 553 // set table index and read in value
554 TstSchedTbl = (u16*)(SchedTbl + testSlot); 554 TstSchedTbl = (u16*)(SchedTbl + testSlot);
555 IF_CBR(printk("Reading CBR Tbl from 0x%x, CbrVal=0x%x Iteration %d\n", 555 IF_CBR(printk("Reading CBR Tbl from 0x%p, CbrVal=0x%x Iteration %d\n",
556 (u32)TstSchedTbl,cbrVC,inc);) 556 TstSchedTbl,cbrVC,inc);)
557 memcpy((caddr_t)&cbrVC,(caddr_t)TstSchedTbl,sizeof(cbrVC)); 557 memcpy((caddr_t)&cbrVC,(caddr_t)TstSchedTbl,sizeof(cbrVC));
558 } /* while */ 558 } /* while */
559 // Move this VCI number into this location of the CBR Sched table. 559 // Move this VCI number into this location of the CBR Sched table.
@@ -1427,11 +1427,11 @@ static int rx_init(struct atm_dev *dev)
1427 /* We know this is 32bit bus addressed so the following is safe */ 1427 /* We know this is 32bit bus addressed so the following is safe */
1428 writel(iadev->rx_dle_dma & 0xfffff000, 1428 writel(iadev->rx_dle_dma & 0xfffff000,
1429 iadev->dma + IPHASE5575_RX_LIST_ADDR); 1429 iadev->dma + IPHASE5575_RX_LIST_ADDR);
1430 IF_INIT(printk("Tx Dle list addr: 0x%08x value: 0x%0x\n", 1430 IF_INIT(printk("Tx Dle list addr: 0x%p value: 0x%0x\n",
1431 (u32)(iadev->dma+IPHASE5575_TX_LIST_ADDR), 1431 iadev->dma+IPHASE5575_TX_LIST_ADDR,
1432 *(u32*)(iadev->dma+IPHASE5575_TX_LIST_ADDR)); 1432 *(u32*)(iadev->dma+IPHASE5575_TX_LIST_ADDR));
1433 printk("Rx Dle list addr: 0x%08x value: 0x%0x\n", 1433 printk("Rx Dle list addr: 0x%p value: 0x%0x\n",
1434 (u32)(iadev->dma+IPHASE5575_RX_LIST_ADDR), 1434 iadev->dma+IPHASE5575_RX_LIST_ADDR,
1435 *(u32*)(iadev->dma+IPHASE5575_RX_LIST_ADDR));) 1435 *(u32*)(iadev->dma+IPHASE5575_RX_LIST_ADDR));)
1436 1436
1437 writew(0xffff, iadev->reass_reg+REASS_MASK_REG); 1437 writew(0xffff, iadev->reass_reg+REASS_MASK_REG);
@@ -1470,7 +1470,7 @@ static int rx_init(struct atm_dev *dev)
1470 buf_desc_ptr++; 1470 buf_desc_ptr++;
1471 rx_pkt_start += iadev->rx_buf_sz; 1471 rx_pkt_start += iadev->rx_buf_sz;
1472 } 1472 }
1473 IF_INIT(printk("Rx Buffer desc ptr: 0x%0x\n", (u32)(buf_desc_ptr));) 1473 IF_INIT(printk("Rx Buffer desc ptr: 0x%p\n", buf_desc_ptr);)
1474 i = FREE_BUF_DESC_Q*iadev->memSize; 1474 i = FREE_BUF_DESC_Q*iadev->memSize;
1475 writew(i >> 16, iadev->reass_reg+REASS_QUEUE_BASE); 1475 writew(i >> 16, iadev->reass_reg+REASS_QUEUE_BASE);
1476 writew(i, iadev->reass_reg+FREEQ_ST_ADR); 1476 writew(i, iadev->reass_reg+FREEQ_ST_ADR);
@@ -1487,7 +1487,7 @@ static int rx_init(struct atm_dev *dev)
1487 *freeq_start = (u_short)i; 1487 *freeq_start = (u_short)i;
1488 freeq_start++; 1488 freeq_start++;
1489 } 1489 }
1490 IF_INIT(printk("freeq_start: 0x%0x\n", (u32)freeq_start);) 1490 IF_INIT(printk("freeq_start: 0x%p\n", freeq_start);)
1491 /* Packet Complete Queue */ 1491 /* Packet Complete Queue */
1492 i = (PKT_COMP_Q * iadev->memSize) & 0xffff; 1492 i = (PKT_COMP_Q * iadev->memSize) & 0xffff;
1493 writew(i, iadev->reass_reg+PCQ_ST_ADR); 1493 writew(i, iadev->reass_reg+PCQ_ST_ADR);
@@ -1713,7 +1713,7 @@ static void tx_dle_intr(struct atm_dev *dev)
1713 IA_SKB_STATE(skb) |= IA_DLED; 1713 IA_SKB_STATE(skb) |= IA_DLED;
1714 skb_queue_tail(&iavcc->txing_skb, skb); 1714 skb_queue_tail(&iavcc->txing_skb, skb);
1715 } 1715 }
1716 IF_EVENT(printk("tx_dle_intr: enque skb = 0x%x \n", (u32)skb);) 1716 IF_EVENT(printk("tx_dle_intr: enque skb = 0x%p \n", skb);)
1717 if (++dle == iadev->tx_dle_q.end) 1717 if (++dle == iadev->tx_dle_q.end)
1718 dle = iadev->tx_dle_q.start; 1718 dle = iadev->tx_dle_q.start;
1719 } 1719 }
@@ -2044,8 +2044,8 @@ static int tx_init(struct atm_dev *dev)
2044 writew(tmp16, iadev->seg_reg+CBR_TAB_END+1); // CBR_PTR; 2044 writew(tmp16, iadev->seg_reg+CBR_TAB_END+1); // CBR_PTR;
2045 tmp16 = (CBR_SCHED_TABLE*iadev->memSize + iadev->num_vc*6 - 2) >> 1; 2045 tmp16 = (CBR_SCHED_TABLE*iadev->memSize + iadev->num_vc*6 - 2) >> 1;
2046 writew(tmp16, iadev->seg_reg+CBR_TAB_END); 2046 writew(tmp16, iadev->seg_reg+CBR_TAB_END);
2047 IF_INIT(printk("iadev->seg_reg = 0x%x CBR_PTR_BASE = 0x%x\n", 2047 IF_INIT(printk("iadev->seg_reg = 0x%p CBR_PTR_BASE = 0x%x\n",
2048 (u32)iadev->seg_reg, readw(iadev->seg_reg+CBR_PTR_BASE));) 2048 iadev->seg_reg, readw(iadev->seg_reg+CBR_PTR_BASE));)
2049 IF_INIT(printk("CBR_TAB_BEG = 0x%x, CBR_TAB_END = 0x%x, CBR_PTR = 0x%x\n", 2049 IF_INIT(printk("CBR_TAB_BEG = 0x%x, CBR_TAB_END = 0x%x, CBR_PTR = 0x%x\n",
2050 readw(iadev->seg_reg+CBR_TAB_BEG), readw(iadev->seg_reg+CBR_TAB_END), 2050 readw(iadev->seg_reg+CBR_TAB_BEG), readw(iadev->seg_reg+CBR_TAB_END),
2051 readw(iadev->seg_reg+CBR_TAB_END+1));) 2051 readw(iadev->seg_reg+CBR_TAB_END+1));)
@@ -2963,8 +2963,8 @@ static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb) {
2963 2963
2964 /* Put the packet in a tx buffer */ 2964 /* Put the packet in a tx buffer */
2965 trailer = iadev->tx_buf[desc-1].cpcs; 2965 trailer = iadev->tx_buf[desc-1].cpcs;
2966 IF_TX(printk("Sent: skb = 0x%x skb->data: 0x%x len: %d, desc: %d\n", 2966 IF_TX(printk("Sent: skb = 0x%p skb->data: 0x%p len: %d, desc: %d\n",
2967 (u32)skb, (u32)skb->data, skb->len, desc);) 2967 skb, skb->data, skb->len, desc);)
2968 trailer->control = 0; 2968 trailer->control = 0;
2969 /*big endian*/ 2969 /*big endian*/
2970 trailer->length = ((skb->len & 0xff) << 8) | ((skb->len & 0xff00) >> 8); 2970 trailer->length = ((skb->len & 0xff) << 8) | ((skb->len & 0xff00) >> 8);
@@ -3181,7 +3181,7 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
3181 } 3181 }
3182 dev->dev_data = iadev; 3182 dev->dev_data = iadev;
3183 IF_INIT(printk(DEV_LABEL "registered at (itf :%d)\n", dev->number);) 3183 IF_INIT(printk(DEV_LABEL "registered at (itf :%d)\n", dev->number);)
3184 IF_INIT(printk("dev_id = 0x%x iadev->LineRate = %d \n", (u32)dev, 3184 IF_INIT(printk("dev_id = 0x%p iadev->LineRate = %d \n", dev,
3185 iadev->LineRate);) 3185 iadev->LineRate);)
3186 3186
3187 pci_set_drvdata(pdev, dev); 3187 pci_set_drvdata(pdev, dev);
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 3ad49a00029f..af0d175c025d 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -103,7 +103,8 @@ static ssize_t show_mem_phys_index(struct sys_device *dev,
103/* 103/*
104 * Show whether the section of memory is likely to be hot-removable 104 * Show whether the section of memory is likely to be hot-removable
105 */ 105 */
106static ssize_t show_mem_removable(struct sys_device *dev, char *buf) 106static ssize_t show_mem_removable(struct sys_device *dev,
107 struct sysdev_attribute *attr, char *buf)
107{ 108{
108 unsigned long start_pfn; 109 unsigned long start_pfn;
109 int ret; 110 int ret;
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index 192522ebb771..c33bb59ed1fa 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -134,6 +134,13 @@ static struct usb_device_id blacklist_ids[] = {
134 134
135 /* Dell laptop with Broadcom chip */ 135 /* Dell laptop with Broadcom chip */
136 { USB_DEVICE(0x413c, 0x8126), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, 136 { USB_DEVICE(0x413c, 0x8126), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
137 /* Dell Wireless 370 */
138 { USB_DEVICE(0x413c, 0x8156), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
139 /* Dell Wireless 410 */
140 { USB_DEVICE(0x413c, 0x8152), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
141
142 /* Broadcom 2046 */
143 { USB_DEVICE(0x0a5c, 0x2151), .driver_info = HCI_RESET },
137 144
138 /* Microsoft Wireless Transceiver for Bluetooth 2.0 */ 145 /* Microsoft Wireless Transceiver for Bluetooth 2.0 */
139 { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET }, 146 { USB_DEVICE(0x045e, 0x009c), .driver_info = HCI_RESET },
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 71ec426ecffc..1e0455bd6df9 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -39,8 +39,8 @@
39#include <asm/io.h> 39#include <asm/io.h>
40#include <asm/dma.h> 40#include <asm/dma.h>
41#include <asm/delay.h> 41#include <asm/delay.h>
42#include <asm/mach/dma.h> 42#include <mach/dma.h>
43#include <asm/mach/sysasic.h> 43#include <mach/sysasic.h>
44 44
45#define GDROM_DEV_NAME "gdrom" 45#define GDROM_DEV_NAME "gdrom"
46#define GD_SESSION_OFFSET 150 46#define GD_SESSION_OFFSET 150
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c
index 27fdc0866496..8a2fce0756ec 100644
--- a/drivers/char/hw_random/intel-rng.c
+++ b/drivers/char/hw_random/intel-rng.c
@@ -241,7 +241,7 @@ static int __init intel_rng_hw_init(void *_intel_rng_hw)
241 struct intel_rng_hw *intel_rng_hw = _intel_rng_hw; 241 struct intel_rng_hw *intel_rng_hw = _intel_rng_hw;
242 u8 mfc, dvc; 242 u8 mfc, dvc;
243 243
244 /* interrupts disabled in stop_machine_run call */ 244 /* interrupts disabled in stop_machine call */
245 245
246 if (!(intel_rng_hw->fwh_dec_en1_val & FWH_F8_EN_MASK)) 246 if (!(intel_rng_hw->fwh_dec_en1_val & FWH_F8_EN_MASK))
247 pci_write_config_byte(intel_rng_hw->dev, 247 pci_write_config_byte(intel_rng_hw->dev,
@@ -365,10 +365,10 @@ static int __init mod_init(void)
365 * location with the Read ID command, all activity on the system 365 * location with the Read ID command, all activity on the system
366 * must be stopped until the state is back to normal. 366 * must be stopped until the state is back to normal.
367 * 367 *
368 * Use stop_machine_run because IPIs can be blocked by disabling 368 * Use stop_machine because IPIs can be blocked by disabling
369 * interrupts. 369 * interrupts.
370 */ 370 */
371 err = stop_machine_run(intel_rng_hw_init, intel_rng_hw, NR_CPUS); 371 err = stop_machine(intel_rng_hw_init, intel_rng_hw, NULL);
372 pci_dev_put(dev); 372 pci_dev_put(dev);
373 iounmap(intel_rng_hw->mem); 373 iounmap(intel_rng_hw->mem);
374 kfree(intel_rng_hw); 374 kfree(intel_rng_hw);
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 192688344ed2..f52931e1c16e 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -66,8 +66,8 @@
66#include <linux/ctype.h> 66#include <linux/ctype.h>
67 67
68#ifdef CONFIG_PPC_OF 68#ifdef CONFIG_PPC_OF
69#include <asm/of_device.h> 69#include <linux/of_device.h>
70#include <asm/of_platform.h> 70#include <linux/of_platform.h>
71#endif 71#endif
72 72
73#define PFX "ipmi_si: " 73#define PFX "ipmi_si: "
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index e30575e87648..b638403e8e9c 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -1612,8 +1612,10 @@ static int mxser_ioctl_special(unsigned int cmd, void __user *argp)
1612 1612
1613 switch (cmd) { 1613 switch (cmd) {
1614 case MOXA_GET_MAJOR: 1614 case MOXA_GET_MAJOR:
1615 printk(KERN_WARNING "mxser: '%s' uses deprecated ioctl %x, fix " 1615 if (printk_ratelimit())
1616 "your userspace\n", current->comm, cmd); 1616 printk(KERN_WARNING "mxser: '%s' uses deprecated ioctl "
1617 "%x (GET_MAJOR), fix your userspace\n",
1618 current->comm, cmd);
1617 return put_user(ttymajor, (int __user *)argp); 1619 return put_user(ttymajor, (int __user *)argp);
1618 1620
1619 case MOXA_CHKPORTENABLE: 1621 case MOXA_CHKPORTENABLE:
diff --git a/drivers/char/pcmcia/ipwireless/hardware.c b/drivers/char/pcmcia/ipwireless/hardware.c
index 929101ecbae2..4c1820cad712 100644
--- a/drivers/char/pcmcia/ipwireless/hardware.c
+++ b/drivers/char/pcmcia/ipwireless/hardware.c
@@ -30,11 +30,11 @@
30static void ipw_send_setup_packet(struct ipw_hardware *hw); 30static void ipw_send_setup_packet(struct ipw_hardware *hw);
31static void handle_received_SETUP_packet(struct ipw_hardware *ipw, 31static void handle_received_SETUP_packet(struct ipw_hardware *ipw,
32 unsigned int address, 32 unsigned int address,
33 unsigned char *data, int len, 33 const unsigned char *data, int len,
34 int is_last); 34 int is_last);
35static void ipwireless_setup_timer(unsigned long data); 35static void ipwireless_setup_timer(unsigned long data);
36static void handle_received_CTRL_packet(struct ipw_hardware *hw, 36static void handle_received_CTRL_packet(struct ipw_hardware *hw,
37 unsigned int channel_idx, unsigned char *data, int len); 37 unsigned int channel_idx, const unsigned char *data, int len);
38 38
39/*#define TIMING_DIAGNOSTICS*/ 39/*#define TIMING_DIAGNOSTICS*/
40 40
@@ -79,8 +79,7 @@ static void report_timing(void)
79 timing_stats.last_report_time = jiffies; 79 timing_stats.last_report_time = jiffies;
80 if (!first) 80 if (!first)
81 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 81 printk(KERN_INFO IPWIRELESS_PCCARD_NAME
82 ": %u us elapsed - read %lu bytes in %u us, " 82 ": %u us elapsed - read %lu bytes in %u us, wrote %lu bytes in %u us\n",
83 "wrote %lu bytes in %u us\n",
84 jiffies_to_usecs(since), 83 jiffies_to_usecs(since),
85 timing_stats.read_bytes, 84 timing_stats.read_bytes,
86 jiffies_to_usecs(timing_stats.read_time), 85 jiffies_to_usecs(timing_stats.read_time),
@@ -133,29 +132,17 @@ enum {
133#define NL_FOLLOWING_PACKET_HEADER_SIZE 1 132#define NL_FOLLOWING_PACKET_HEADER_SIZE 1
134 133
135struct nl_first_packet_header { 134struct nl_first_packet_header {
136#if defined(__BIG_ENDIAN_BITFIELD)
137 unsigned char packet_rank:2;
138 unsigned char address:3;
139 unsigned char protocol:3;
140#else
141 unsigned char protocol:3; 135 unsigned char protocol:3;
142 unsigned char address:3; 136 unsigned char address:3;
143 unsigned char packet_rank:2; 137 unsigned char packet_rank:2;
144#endif
145 unsigned char length_lsb; 138 unsigned char length_lsb;
146 unsigned char length_msb; 139 unsigned char length_msb;
147}; 140};
148 141
149struct nl_packet_header { 142struct nl_packet_header {
150#if defined(__BIG_ENDIAN_BITFIELD)
151 unsigned char packet_rank:2;
152 unsigned char address:3;
153 unsigned char protocol:3;
154#else
155 unsigned char protocol:3; 143 unsigned char protocol:3;
156 unsigned char address:3; 144 unsigned char address:3;
157 unsigned char packet_rank:2; 145 unsigned char packet_rank:2;
158#endif
159}; 146};
160 147
161/* Value of 'packet_rank' above */ 148/* Value of 'packet_rank' above */
@@ -227,15 +214,12 @@ struct MEMINFREG {
227 unsigned short memreg_tx_new; /* TX2 (new) Register (R/W) */ 214 unsigned short memreg_tx_new; /* TX2 (new) Register (R/W) */
228}; 215};
229 216
230#define IODMADPR 0x00 /* DMA Data Port Register (R/W) */
231
232#define CARD_PRESENT_VALUE (0xBEEFCAFEUL) 217#define CARD_PRESENT_VALUE (0xBEEFCAFEUL)
233 218
234#define MEMTX_TX 0x0001 219#define MEMTX_TX 0x0001
235#define MEMRX_RX 0x0001 220#define MEMRX_RX 0x0001
236#define MEMRX_RX_DONE 0x0001 221#define MEMRX_RX_DONE 0x0001
237#define MEMRX_PCINTACKK 0x0001 222#define MEMRX_PCINTACKK 0x0001
238#define MEMRX_MEMSPURIOUSINT 0x0001
239 223
240#define NL_NUM_OF_PRIORITIES 3 224#define NL_NUM_OF_PRIORITIES 3
241#define NL_NUM_OF_PROTOCOLS 3 225#define NL_NUM_OF_PROTOCOLS 3
@@ -245,7 +229,7 @@ struct ipw_hardware {
245 unsigned int base_port; 229 unsigned int base_port;
246 short hw_version; 230 short hw_version;
247 unsigned short ll_mtu; 231 unsigned short ll_mtu;
248 spinlock_t spinlock; 232 spinlock_t lock;
249 233
250 int initializing; 234 int initializing;
251 int init_loops; 235 int init_loops;
@@ -386,26 +370,52 @@ static void dump_data_bytes(const char *type, const unsigned char *data,
386 length < DUMP_MAX_BYTES ? length : DUMP_MAX_BYTES); 370 length < DUMP_MAX_BYTES ? length : DUMP_MAX_BYTES);
387} 371}
388 372
389static int do_send_fragment(struct ipw_hardware *hw, const unsigned char *data, 373static void swap_packet_bitfield_to_le(unsigned char *data)
374{
375#ifdef __BIG_ENDIAN_BITFIELD
376 unsigned char tmp = *data, ret = 0;
377
378 /*
379 * transform bits from aa.bbb.ccc to ccc.bbb.aa
380 */
381 ret |= tmp & 0xc0 >> 6;
382 ret |= tmp & 0x38 >> 1;
383 ret |= tmp & 0x07 << 5;
384 *data = ret & 0xff;
385#endif
386}
387
388static void swap_packet_bitfield_from_le(unsigned char *data)
389{
390#ifdef __BIG_ENDIAN_BITFIELD
391 unsigned char tmp = *data, ret = 0;
392
393 /*
394 * transform bits from ccc.bbb.aa to aa.bbb.ccc
395 */
396 ret |= tmp & 0xe0 >> 5;
397 ret |= tmp & 0x1c << 1;
398 ret |= tmp & 0x03 << 6;
399 *data = ret & 0xff;
400#endif
401}
402
403static void do_send_fragment(struct ipw_hardware *hw, unsigned char *data,
390 unsigned length) 404 unsigned length)
391{ 405{
392 int i; 406 unsigned i;
393 unsigned long flags; 407 unsigned long flags;
394 408
395 start_timing(); 409 start_timing();
396 410 BUG_ON(length > hw->ll_mtu);
397 if (length == 0)
398 return 0;
399
400 if (length > hw->ll_mtu)
401 return -1;
402 411
403 if (ipwireless_debug) 412 if (ipwireless_debug)
404 dump_data_bytes("send", data, length); 413 dump_data_bytes("send", data, length);
405 414
406 spin_lock_irqsave(&hw->spinlock, flags); 415 spin_lock_irqsave(&hw->lock, flags);
407 416
408 hw->tx_ready = 0; 417 hw->tx_ready = 0;
418 swap_packet_bitfield_to_le(data);
409 419
410 if (hw->hw_version == HW_VERSION_1) { 420 if (hw->hw_version == HW_VERSION_1) {
411 outw((unsigned short) length, hw->base_port + IODWR); 421 outw((unsigned short) length, hw->base_port + IODWR);
@@ -414,7 +424,7 @@ static int do_send_fragment(struct ipw_hardware *hw, const unsigned char *data,
414 unsigned short d = data[i]; 424 unsigned short d = data[i];
415 __le16 raw_data; 425 __le16 raw_data;
416 426
417 if (likely(i + 1 < length)) 427 if (i + 1 < length)
418 d |= data[i + 1] << 8; 428 d |= data[i + 1] << 8;
419 raw_data = cpu_to_le16(d); 429 raw_data = cpu_to_le16(d);
420 outw(raw_data, hw->base_port + IODWR); 430 outw(raw_data, hw->base_port + IODWR);
@@ -422,32 +432,30 @@ static int do_send_fragment(struct ipw_hardware *hw, const unsigned char *data,
422 432
423 outw(DCR_TXDONE, hw->base_port + IODCR); 433 outw(DCR_TXDONE, hw->base_port + IODCR);
424 } else if (hw->hw_version == HW_VERSION_2) { 434 } else if (hw->hw_version == HW_VERSION_2) {
425 outw((unsigned short) length, hw->base_port + IODMADPR); 435 outw((unsigned short) length, hw->base_port);
426 436
427 for (i = 0; i < length; i += 2) { 437 for (i = 0; i < length; i += 2) {
428 unsigned short d = data[i]; 438 unsigned short d = data[i];
429 __le16 raw_data; 439 __le16 raw_data;
430 440
431 if ((i + 1 < length)) 441 if (i + 1 < length)
432 d |= data[i + 1] << 8; 442 d |= data[i + 1] << 8;
433 raw_data = cpu_to_le16(d); 443 raw_data = cpu_to_le16(d);
434 outw(raw_data, hw->base_port + IODMADPR); 444 outw(raw_data, hw->base_port);
435 } 445 }
436 while ((i & 3) != 2) { 446 while ((i & 3) != 2) {
437 outw((unsigned short) 0xDEAD, hw->base_port + IODMADPR); 447 outw((unsigned short) 0xDEAD, hw->base_port);
438 i += 2; 448 i += 2;
439 } 449 }
440 writew(MEMRX_RX, &hw->memory_info_regs->memreg_rx); 450 writew(MEMRX_RX, &hw->memory_info_regs->memreg_rx);
441 } 451 }
442 452
443 spin_unlock_irqrestore(&hw->spinlock, flags); 453 spin_unlock_irqrestore(&hw->lock, flags);
444 454
445 end_write_timing(length); 455 end_write_timing(length);
446
447 return 0;
448} 456}
449 457
450static int do_send_packet(struct ipw_hardware *hw, struct ipw_tx_packet *packet) 458static void do_send_packet(struct ipw_hardware *hw, struct ipw_tx_packet *packet)
451{ 459{
452 unsigned short fragment_data_len; 460 unsigned short fragment_data_len;
453 unsigned short data_left = packet->length - packet->offset; 461 unsigned short data_left = packet->length - packet->offset;
@@ -462,6 +470,10 @@ static int do_send_packet(struct ipw_hardware *hw, struct ipw_tx_packet *packet)
462 if (data_left < fragment_data_len) 470 if (data_left < fragment_data_len)
463 fragment_data_len = data_left; 471 fragment_data_len = data_left;
464 472
473 /*
474 * hdr_first is now in machine bitfield order, which will be swapped
475 * to le just before it goes to hw
476 */
465 pkt.hdr_first.protocol = packet->protocol; 477 pkt.hdr_first.protocol = packet->protocol;
466 pkt.hdr_first.address = packet->dest_addr; 478 pkt.hdr_first.address = packet->dest_addr;
467 pkt.hdr_first.packet_rank = 0; 479 pkt.hdr_first.packet_rank = 0;
@@ -493,25 +505,23 @@ static int do_send_packet(struct ipw_hardware *hw, struct ipw_tx_packet *packet)
493 */ 505 */
494 unsigned long flags; 506 unsigned long flags;
495 507
496 spin_lock_irqsave(&hw->spinlock, flags); 508 spin_lock_irqsave(&hw->lock, flags);
497 list_add(&packet->queue, &hw->tx_queue[0]); 509 list_add(&packet->queue, &hw->tx_queue[0]);
498 hw->tx_queued++; 510 hw->tx_queued++;
499 spin_unlock_irqrestore(&hw->spinlock, flags); 511 spin_unlock_irqrestore(&hw->lock, flags);
500 } else { 512 } else {
501 if (packet->packet_callback) 513 if (packet->packet_callback)
502 packet->packet_callback(packet->callback_data, 514 packet->packet_callback(packet->callback_data,
503 packet->length); 515 packet->length);
504 kfree(packet); 516 kfree(packet);
505 } 517 }
506
507 return 0;
508} 518}
509 519
510static void ipw_setup_hardware(struct ipw_hardware *hw) 520static void ipw_setup_hardware(struct ipw_hardware *hw)
511{ 521{
512 unsigned long flags; 522 unsigned long flags;
513 523
514 spin_lock_irqsave(&hw->spinlock, flags); 524 spin_lock_irqsave(&hw->lock, flags);
515 if (hw->hw_version == HW_VERSION_1) { 525 if (hw->hw_version == HW_VERSION_1) {
516 /* Reset RX FIFO */ 526 /* Reset RX FIFO */
517 outw(DCR_RXRESET, hw->base_port + IODCR); 527 outw(DCR_RXRESET, hw->base_port + IODCR);
@@ -530,7 +540,7 @@ static void ipw_setup_hardware(struct ipw_hardware *hw)
530 csr |= 1; 540 csr |= 1;
531 writew(csr, &hw->memregs_CCR->reg_config_and_status); 541 writew(csr, &hw->memregs_CCR->reg_config_and_status);
532 } 542 }
533 spin_unlock_irqrestore(&hw->spinlock, flags); 543 spin_unlock_irqrestore(&hw->lock, flags);
534} 544}
535 545
536/* 546/*
@@ -549,28 +559,23 @@ static struct ipw_rx_packet *pool_allocate(struct ipw_hardware *hw,
549 if (!packet) { 559 if (!packet) {
550 unsigned long flags; 560 unsigned long flags;
551 561
552 /* 562 spin_lock_irqsave(&hw->lock, flags);
553 * If this is the first fragment, then we will need to fetch a
554 * packet to put it in.
555 */
556 spin_lock_irqsave(&hw->spinlock, flags);
557 /* If we have one in our pool, then pull it out. */
558 if (!list_empty(&hw->rx_pool)) { 563 if (!list_empty(&hw->rx_pool)) {
559 packet = list_first_entry(&hw->rx_pool, 564 packet = list_first_entry(&hw->rx_pool,
560 struct ipw_rx_packet, queue); 565 struct ipw_rx_packet, queue);
561 list_del(&packet->queue);
562 hw->rx_pool_size--; 566 hw->rx_pool_size--;
563 spin_unlock_irqrestore(&hw->spinlock, flags); 567 spin_unlock_irqrestore(&hw->lock, flags);
568 list_del(&packet->queue);
564 } else { 569 } else {
565 /* Otherwise allocate a new one. */ 570 const int min_capacity =
566 static int min_capacity = 256; 571 ipwireless_ppp_mru(hw->network) + 2;
567 int new_capacity; 572 int new_capacity;
568 573
569 spin_unlock_irqrestore(&hw->spinlock, flags); 574 spin_unlock_irqrestore(&hw->lock, flags);
570 new_capacity = 575 new_capacity =
571 minimum_free_space > min_capacity 576 (minimum_free_space > min_capacity
572 ? minimum_free_space 577 ? minimum_free_space
573 : min_capacity; 578 : min_capacity);
574 packet = kmalloc(sizeof(struct ipw_rx_packet) 579 packet = kmalloc(sizeof(struct ipw_rx_packet)
575 + new_capacity, GFP_ATOMIC); 580 + new_capacity, GFP_ATOMIC);
576 if (!packet) 581 if (!packet)
@@ -580,10 +585,6 @@ static struct ipw_rx_packet *pool_allocate(struct ipw_hardware *hw,
580 packet->length = 0; 585 packet->length = 0;
581 } 586 }
582 587
583 /*
584 * If this packet does not have sufficient capacity for the data we
585 * want to add, then make it bigger.
586 */
587 if (packet->length + minimum_free_space > packet->capacity) { 588 if (packet->length + minimum_free_space > packet->capacity) {
588 struct ipw_rx_packet *old_packet = packet; 589 struct ipw_rx_packet *old_packet = packet;
589 590
@@ -610,13 +611,15 @@ static void pool_free(struct ipw_hardware *hw, struct ipw_rx_packet *packet)
610 kfree(packet); 611 kfree(packet);
611 else { 612 else {
612 hw->rx_pool_size++; 613 hw->rx_pool_size++;
613 list_add_tail(&packet->queue, &hw->rx_pool); 614 list_add(&packet->queue, &hw->rx_pool);
614 } 615 }
615} 616}
616 617
617static void queue_received_packet(struct ipw_hardware *hw, 618static void queue_received_packet(struct ipw_hardware *hw,
618 unsigned int protocol, unsigned int address, 619 unsigned int protocol,
619 unsigned char *data, int length, int is_last) 620 unsigned int address,
621 const unsigned char *data, int length,
622 int is_last)
620{ 623{
621 unsigned int channel_idx = address - 1; 624 unsigned int channel_idx = address - 1;
622 struct ipw_rx_packet *packet = NULL; 625 struct ipw_rx_packet *packet = NULL;
@@ -658,9 +661,9 @@ static void queue_received_packet(struct ipw_hardware *hw,
658 packet = *assem; 661 packet = *assem;
659 *assem = NULL; 662 *assem = NULL;
660 /* Count queued DATA bytes only */ 663 /* Count queued DATA bytes only */
661 spin_lock_irqsave(&hw->spinlock, flags); 664 spin_lock_irqsave(&hw->lock, flags);
662 hw->rx_bytes_queued += packet->length; 665 hw->rx_bytes_queued += packet->length;
663 spin_unlock_irqrestore(&hw->spinlock, flags); 666 spin_unlock_irqrestore(&hw->lock, flags);
664 } 667 }
665 } else { 668 } else {
666 /* If it's a CTRL packet, don't assemble, just queue it. */ 669 /* If it's a CTRL packet, don't assemble, just queue it. */
@@ -682,13 +685,13 @@ static void queue_received_packet(struct ipw_hardware *hw,
682 * network layer. 685 * network layer.
683 */ 686 */
684 if (packet) { 687 if (packet) {
685 spin_lock_irqsave(&hw->spinlock, flags); 688 spin_lock_irqsave(&hw->lock, flags);
686 list_add_tail(&packet->queue, &hw->rx_queue); 689 list_add_tail(&packet->queue, &hw->rx_queue);
687 /* Block reception of incoming packets if queue is full. */ 690 /* Block reception of incoming packets if queue is full. */
688 hw->blocking_rx = 691 hw->blocking_rx =
689 hw->rx_bytes_queued >= IPWIRELESS_RX_QUEUE_SIZE; 692 (hw->rx_bytes_queued >= IPWIRELESS_RX_QUEUE_SIZE);
690 693
691 spin_unlock_irqrestore(&hw->spinlock, flags); 694 spin_unlock_irqrestore(&hw->lock, flags);
692 schedule_work(&hw->work_rx); 695 schedule_work(&hw->work_rx);
693 } 696 }
694} 697}
@@ -702,7 +705,7 @@ static void ipw_receive_data_work(struct work_struct *work_rx)
702 container_of(work_rx, struct ipw_hardware, work_rx); 705 container_of(work_rx, struct ipw_hardware, work_rx);
703 unsigned long flags; 706 unsigned long flags;
704 707
705 spin_lock_irqsave(&hw->spinlock, flags); 708 spin_lock_irqsave(&hw->lock, flags);
706 while (!list_empty(&hw->rx_queue)) { 709 while (!list_empty(&hw->rx_queue)) {
707 struct ipw_rx_packet *packet = 710 struct ipw_rx_packet *packet =
708 list_first_entry(&hw->rx_queue, 711 list_first_entry(&hw->rx_queue,
@@ -720,7 +723,7 @@ static void ipw_receive_data_work(struct work_struct *work_rx)
720 if (packet->protocol == TL_PROTOCOLID_COM_DATA) { 723 if (packet->protocol == TL_PROTOCOLID_COM_DATA) {
721 if (hw->network != NULL) { 724 if (hw->network != NULL) {
722 /* If the network hasn't been disconnected. */ 725 /* If the network hasn't been disconnected. */
723 spin_unlock_irqrestore(&hw->spinlock, flags); 726 spin_unlock_irqrestore(&hw->lock, flags);
724 /* 727 /*
725 * This must run unlocked due to tty processing 728 * This must run unlocked due to tty processing
726 * and mutex locking 729 * and mutex locking
@@ -731,7 +734,7 @@ static void ipw_receive_data_work(struct work_struct *work_rx)
731 (unsigned char *)packet 734 (unsigned char *)packet
732 + sizeof(struct ipw_rx_packet), 735 + sizeof(struct ipw_rx_packet),
733 packet->length); 736 packet->length);
734 spin_lock_irqsave(&hw->spinlock, flags); 737 spin_lock_irqsave(&hw->lock, flags);
735 } 738 }
736 /* Count queued DATA bytes only */ 739 /* Count queued DATA bytes only */
737 hw->rx_bytes_queued -= packet->length; 740 hw->rx_bytes_queued -= packet->length;
@@ -755,15 +758,15 @@ static void ipw_receive_data_work(struct work_struct *work_rx)
755 if (hw->shutting_down) 758 if (hw->shutting_down)
756 break; 759 break;
757 } 760 }
758 spin_unlock_irqrestore(&hw->spinlock, flags); 761 spin_unlock_irqrestore(&hw->lock, flags);
759} 762}
760 763
761static void handle_received_CTRL_packet(struct ipw_hardware *hw, 764static void handle_received_CTRL_packet(struct ipw_hardware *hw,
762 unsigned int channel_idx, 765 unsigned int channel_idx,
763 unsigned char *data, int len) 766 const unsigned char *data, int len)
764{ 767{
765 struct ipw_control_packet_body *body = 768 const struct ipw_control_packet_body *body =
766 (struct ipw_control_packet_body *) data; 769 (const struct ipw_control_packet_body *) data;
767 unsigned int changed_mask; 770 unsigned int changed_mask;
768 771
769 if (len != sizeof(struct ipw_control_packet_body)) { 772 if (len != sizeof(struct ipw_control_packet_body)) {
@@ -805,13 +808,13 @@ static void handle_received_CTRL_packet(struct ipw_hardware *hw,
805} 808}
806 809
807static void handle_received_packet(struct ipw_hardware *hw, 810static void handle_received_packet(struct ipw_hardware *hw,
808 union nl_packet *packet, 811 const union nl_packet *packet,
809 unsigned short len) 812 unsigned short len)
810{ 813{
811 unsigned int protocol = packet->hdr.protocol; 814 unsigned int protocol = packet->hdr.protocol;
812 unsigned int address = packet->hdr.address; 815 unsigned int address = packet->hdr.address;
813 unsigned int header_length; 816 unsigned int header_length;
814 unsigned char *data; 817 const unsigned char *data;
815 unsigned int data_len; 818 unsigned int data_len;
816 int is_last = packet->hdr.packet_rank & NL_LAST_PACKET; 819 int is_last = packet->hdr.packet_rank & NL_LAST_PACKET;
817 820
@@ -850,7 +853,7 @@ static void acknowledge_data_read(struct ipw_hardware *hw)
850static void do_receive_packet(struct ipw_hardware *hw) 853static void do_receive_packet(struct ipw_hardware *hw)
851{ 854{
852 unsigned len; 855 unsigned len;
853 unsigned int i; 856 unsigned i;
854 unsigned char pkt[LL_MTU_MAX]; 857 unsigned char pkt[LL_MTU_MAX];
855 858
856 start_timing(); 859 start_timing();
@@ -859,8 +862,7 @@ static void do_receive_packet(struct ipw_hardware *hw)
859 len = inw(hw->base_port + IODRR); 862 len = inw(hw->base_port + IODRR);
860 if (len > hw->ll_mtu) { 863 if (len > hw->ll_mtu) {
861 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 864 printk(KERN_INFO IPWIRELESS_PCCARD_NAME
862 ": received a packet of %u bytes - " 865 ": received a packet of %u bytes - longer than the MTU!\n", len);
863 "longer than the MTU!\n", len);
864 outw(DCR_RXDONE | DCR_RXRESET, hw->base_port + IODCR); 866 outw(DCR_RXDONE | DCR_RXRESET, hw->base_port + IODCR);
865 return; 867 return;
866 } 868 }
@@ -873,18 +875,17 @@ static void do_receive_packet(struct ipw_hardware *hw)
873 pkt[i + 1] = (unsigned char) (data >> 8); 875 pkt[i + 1] = (unsigned char) (data >> 8);
874 } 876 }
875 } else { 877 } else {
876 len = inw(hw->base_port + IODMADPR); 878 len = inw(hw->base_port);
877 if (len > hw->ll_mtu) { 879 if (len > hw->ll_mtu) {
878 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 880 printk(KERN_INFO IPWIRELESS_PCCARD_NAME
879 ": received a packet of %u bytes - " 881 ": received a packet of %u bytes - longer than the MTU!\n", len);
880 "longer than the MTU!\n", len);
881 writew(MEMRX_PCINTACKK, 882 writew(MEMRX_PCINTACKK,
882 &hw->memory_info_regs->memreg_pc_interrupt_ack); 883 &hw->memory_info_regs->memreg_pc_interrupt_ack);
883 return; 884 return;
884 } 885 }
885 886
886 for (i = 0; i < len; i += 2) { 887 for (i = 0; i < len; i += 2) {
887 __le16 raw_data = inw(hw->base_port + IODMADPR); 888 __le16 raw_data = inw(hw->base_port);
888 unsigned short data = le16_to_cpu(raw_data); 889 unsigned short data = le16_to_cpu(raw_data);
889 890
890 pkt[i] = (unsigned char) data; 891 pkt[i] = (unsigned char) data;
@@ -892,13 +893,15 @@ static void do_receive_packet(struct ipw_hardware *hw)
892 } 893 }
893 894
894 while ((i & 3) != 2) { 895 while ((i & 3) != 2) {
895 inw(hw->base_port + IODMADPR); 896 inw(hw->base_port);
896 i += 2; 897 i += 2;
897 } 898 }
898 } 899 }
899 900
900 acknowledge_data_read(hw); 901 acknowledge_data_read(hw);
901 902
903 swap_packet_bitfield_from_le(pkt);
904
902 if (ipwireless_debug) 905 if (ipwireless_debug)
903 dump_data_bytes("recv", pkt, len); 906 dump_data_bytes("recv", pkt, len);
904 907
@@ -916,8 +919,7 @@ static int get_current_packet_priority(struct ipw_hardware *hw)
916 * until setup is complete. 919 * until setup is complete.
917 */ 920 */
918 return (hw->to_setup || hw->initializing 921 return (hw->to_setup || hw->initializing
919 ? PRIO_SETUP + 1 : 922 ? PRIO_SETUP + 1 : NL_NUM_OF_PRIORITIES);
920 NL_NUM_OF_PRIORITIES);
921} 923}
922 924
923/* 925/*
@@ -928,17 +930,17 @@ static int get_packets_from_hw(struct ipw_hardware *hw)
928 int received = 0; 930 int received = 0;
929 unsigned long flags; 931 unsigned long flags;
930 932
931 spin_lock_irqsave(&hw->spinlock, flags); 933 spin_lock_irqsave(&hw->lock, flags);
932 while (hw->rx_ready && !hw->blocking_rx) { 934 while (hw->rx_ready && !hw->blocking_rx) {
933 received = 1; 935 received = 1;
934 hw->rx_ready--; 936 hw->rx_ready--;
935 spin_unlock_irqrestore(&hw->spinlock, flags); 937 spin_unlock_irqrestore(&hw->lock, flags);
936 938
937 do_receive_packet(hw); 939 do_receive_packet(hw);
938 940
939 spin_lock_irqsave(&hw->spinlock, flags); 941 spin_lock_irqsave(&hw->lock, flags);
940 } 942 }
941 spin_unlock_irqrestore(&hw->spinlock, flags); 943 spin_unlock_irqrestore(&hw->lock, flags);
942 944
943 return received; 945 return received;
944} 946}
@@ -954,7 +956,7 @@ static int send_pending_packet(struct ipw_hardware *hw, int priority_limit)
954 int more_to_send = 0; 956 int more_to_send = 0;
955 unsigned long flags; 957 unsigned long flags;
956 958
957 spin_lock_irqsave(&hw->spinlock, flags); 959 spin_lock_irqsave(&hw->lock, flags);
958 if (hw->tx_queued && hw->tx_ready) { 960 if (hw->tx_queued && hw->tx_ready) {
959 int priority; 961 int priority;
960 struct ipw_tx_packet *packet = NULL; 962 struct ipw_tx_packet *packet = NULL;
@@ -975,17 +977,17 @@ static int send_pending_packet(struct ipw_hardware *hw, int priority_limit)
975 } 977 }
976 if (!packet) { 978 if (!packet) {
977 hw->tx_queued = 0; 979 hw->tx_queued = 0;
978 spin_unlock_irqrestore(&hw->spinlock, flags); 980 spin_unlock_irqrestore(&hw->lock, flags);
979 return 0; 981 return 0;
980 } 982 }
981 983
982 spin_unlock_irqrestore(&hw->spinlock, flags); 984 spin_unlock_irqrestore(&hw->lock, flags);
983 985
984 /* Send */ 986 /* Send */
985 do_send_packet(hw, packet); 987 do_send_packet(hw, packet);
986 988
987 /* Check if more to send */ 989 /* Check if more to send */
988 spin_lock_irqsave(&hw->spinlock, flags); 990 spin_lock_irqsave(&hw->lock, flags);
989 for (priority = 0; priority < priority_limit; priority++) 991 for (priority = 0; priority < priority_limit; priority++)
990 if (!list_empty(&hw->tx_queue[priority])) { 992 if (!list_empty(&hw->tx_queue[priority])) {
991 more_to_send = 1; 993 more_to_send = 1;
@@ -995,7 +997,7 @@ static int send_pending_packet(struct ipw_hardware *hw, int priority_limit)
995 if (!more_to_send) 997 if (!more_to_send)
996 hw->tx_queued = 0; 998 hw->tx_queued = 0;
997 } 999 }
998 spin_unlock_irqrestore(&hw->spinlock, flags); 1000 spin_unlock_irqrestore(&hw->lock, flags);
999 1001
1000 return more_to_send; 1002 return more_to_send;
1001} 1003}
@@ -1008,9 +1010,9 @@ static void ipwireless_do_tasklet(unsigned long hw_)
1008 struct ipw_hardware *hw = (struct ipw_hardware *) hw_; 1010 struct ipw_hardware *hw = (struct ipw_hardware *) hw_;
1009 unsigned long flags; 1011 unsigned long flags;
1010 1012
1011 spin_lock_irqsave(&hw->spinlock, flags); 1013 spin_lock_irqsave(&hw->lock, flags);
1012 if (hw->shutting_down) { 1014 if (hw->shutting_down) {
1013 spin_unlock_irqrestore(&hw->spinlock, flags); 1015 spin_unlock_irqrestore(&hw->lock, flags);
1014 return; 1016 return;
1015 } 1017 }
1016 1018
@@ -1019,7 +1021,7 @@ static void ipwireless_do_tasklet(unsigned long hw_)
1019 * Initial setup data sent to hardware 1021 * Initial setup data sent to hardware
1020 */ 1022 */
1021 hw->to_setup = 2; 1023 hw->to_setup = 2;
1022 spin_unlock_irqrestore(&hw->spinlock, flags); 1024 spin_unlock_irqrestore(&hw->lock, flags);
1023 1025
1024 ipw_setup_hardware(hw); 1026 ipw_setup_hardware(hw);
1025 ipw_send_setup_packet(hw); 1027 ipw_send_setup_packet(hw);
@@ -1030,7 +1032,7 @@ static void ipwireless_do_tasklet(unsigned long hw_)
1030 int priority_limit = get_current_packet_priority(hw); 1032 int priority_limit = get_current_packet_priority(hw);
1031 int again; 1033 int again;
1032 1034
1033 spin_unlock_irqrestore(&hw->spinlock, flags); 1035 spin_unlock_irqrestore(&hw->lock, flags);
1034 1036
1035 do { 1037 do {
1036 again = send_pending_packet(hw, priority_limit); 1038 again = send_pending_packet(hw, priority_limit);
@@ -1068,16 +1070,16 @@ static irqreturn_t ipwireless_handle_v1_interrupt(int irq,
1068 /* Transmit complete. */ 1070 /* Transmit complete. */
1069 if (irqn & IR_TXINTR) { 1071 if (irqn & IR_TXINTR) {
1070 ack |= IR_TXINTR; 1072 ack |= IR_TXINTR;
1071 spin_lock_irqsave(&hw->spinlock, flags); 1073 spin_lock_irqsave(&hw->lock, flags);
1072 hw->tx_ready = 1; 1074 hw->tx_ready = 1;
1073 spin_unlock_irqrestore(&hw->spinlock, flags); 1075 spin_unlock_irqrestore(&hw->lock, flags);
1074 } 1076 }
1075 /* Received data */ 1077 /* Received data */
1076 if (irqn & IR_RXINTR) { 1078 if (irqn & IR_RXINTR) {
1077 ack |= IR_RXINTR; 1079 ack |= IR_RXINTR;
1078 spin_lock_irqsave(&hw->spinlock, flags); 1080 spin_lock_irqsave(&hw->lock, flags);
1079 hw->rx_ready++; 1081 hw->rx_ready++;
1080 spin_unlock_irqrestore(&hw->spinlock, flags); 1082 spin_unlock_irqrestore(&hw->lock, flags);
1081 } 1083 }
1082 if (ack != 0) { 1084 if (ack != 0) {
1083 outw(ack, hw->base_port + IOIR); 1085 outw(ack, hw->base_port + IOIR);
@@ -1128,9 +1130,8 @@ static irqreturn_t ipwireless_handle_v2_v3_interrupt(int irq,
1128 } else { 1130 } else {
1129 return IRQ_NONE; 1131 return IRQ_NONE;
1130 } 1132 }
1131 } else { 1133 } else
1132 return IRQ_NONE; 1134 return IRQ_NONE;
1133 }
1134 } 1135 }
1135 1136
1136 /* 1137 /*
@@ -1149,9 +1150,9 @@ static irqreturn_t ipwireless_handle_v2_v3_interrupt(int irq,
1149 if (hw->serial_number_detected) { 1150 if (hw->serial_number_detected) {
1150 if (memtx_serial != hw->last_memtx_serial) { 1151 if (memtx_serial != hw->last_memtx_serial) {
1151 hw->last_memtx_serial = memtx_serial; 1152 hw->last_memtx_serial = memtx_serial;
1152 spin_lock_irqsave(&hw->spinlock, flags); 1153 spin_lock_irqsave(&hw->lock, flags);
1153 hw->rx_ready++; 1154 hw->rx_ready++;
1154 spin_unlock_irqrestore(&hw->spinlock, flags); 1155 spin_unlock_irqrestore(&hw->lock, flags);
1155 rx = 1; 1156 rx = 1;
1156 } else 1157 } else
1157 /* Ignore 'Timer Recovery' duplicates. */ 1158 /* Ignore 'Timer Recovery' duplicates. */
@@ -1166,18 +1167,18 @@ static irqreturn_t ipwireless_handle_v2_v3_interrupt(int irq,
1166 printk(KERN_DEBUG IPWIRELESS_PCCARD_NAME 1167 printk(KERN_DEBUG IPWIRELESS_PCCARD_NAME
1167 ": memreg_tx serial num detected\n"); 1168 ": memreg_tx serial num detected\n");
1168 1169
1169 spin_lock_irqsave(&hw->spinlock, flags); 1170 spin_lock_irqsave(&hw->lock, flags);
1170 hw->rx_ready++; 1171 hw->rx_ready++;
1171 spin_unlock_irqrestore(&hw->spinlock, flags); 1172 spin_unlock_irqrestore(&hw->lock, flags);
1172 } 1173 }
1173 rx = 1; 1174 rx = 1;
1174 } 1175 }
1175 } 1176 }
1176 if (memrxdone & MEMRX_RX_DONE) { 1177 if (memrxdone & MEMRX_RX_DONE) {
1177 writew(0, &hw->memory_info_regs->memreg_rx_done); 1178 writew(0, &hw->memory_info_regs->memreg_rx_done);
1178 spin_lock_irqsave(&hw->spinlock, flags); 1179 spin_lock_irqsave(&hw->lock, flags);
1179 hw->tx_ready = 1; 1180 hw->tx_ready = 1;
1180 spin_unlock_irqrestore(&hw->spinlock, flags); 1181 spin_unlock_irqrestore(&hw->lock, flags);
1181 tx = 1; 1182 tx = 1;
1182 } 1183 }
1183 if (tx) 1184 if (tx)
@@ -1195,8 +1196,7 @@ static irqreturn_t ipwireless_handle_v2_v3_interrupt(int irq,
1195 ": spurious interrupt - new_tx mode\n"); 1196 ": spurious interrupt - new_tx mode\n");
1196 else { 1197 else {
1197 printk(KERN_WARNING IPWIRELESS_PCCARD_NAME 1198 printk(KERN_WARNING IPWIRELESS_PCCARD_NAME
1198 ": no valid memreg_tx value - " 1199 ": no valid memreg_tx value - switching to the old memreg_tx\n");
1199 "switching to the old memreg_tx\n");
1200 hw->memreg_tx = 1200 hw->memreg_tx =
1201 &hw->memory_info_regs->memreg_tx_old; 1201 &hw->memory_info_regs->memreg_tx_old;
1202 try_mem_tx_old = 1; 1202 try_mem_tx_old = 1;
@@ -1211,7 +1211,7 @@ static irqreturn_t ipwireless_handle_v2_v3_interrupt(int irq,
1211 return IRQ_HANDLED; 1211 return IRQ_HANDLED;
1212} 1212}
1213 1213
1214irqreturn_t ipwireless_interrupt(int irq, void *dev_id, struct pt_regs *regs) 1214irqreturn_t ipwireless_interrupt(int irq, void *dev_id)
1215{ 1215{
1216 struct ipw_hardware *hw = dev_id; 1216 struct ipw_hardware *hw = dev_id;
1217 1217
@@ -1226,9 +1226,9 @@ static void flush_packets_to_hw(struct ipw_hardware *hw)
1226 int priority_limit; 1226 int priority_limit;
1227 unsigned long flags; 1227 unsigned long flags;
1228 1228
1229 spin_lock_irqsave(&hw->spinlock, flags); 1229 spin_lock_irqsave(&hw->lock, flags);
1230 priority_limit = get_current_packet_priority(hw); 1230 priority_limit = get_current_packet_priority(hw);
1231 spin_unlock_irqrestore(&hw->spinlock, flags); 1231 spin_unlock_irqrestore(&hw->lock, flags);
1232 1232
1233 while (send_pending_packet(hw, priority_limit)); 1233 while (send_pending_packet(hw, priority_limit));
1234} 1234}
@@ -1238,10 +1238,10 @@ static void send_packet(struct ipw_hardware *hw, int priority,
1238{ 1238{
1239 unsigned long flags; 1239 unsigned long flags;
1240 1240
1241 spin_lock_irqsave(&hw->spinlock, flags); 1241 spin_lock_irqsave(&hw->lock, flags);
1242 list_add_tail(&packet->queue, &hw->tx_queue[priority]); 1242 list_add_tail(&packet->queue, &hw->tx_queue[priority]);
1243 hw->tx_queued++; 1243 hw->tx_queued++;
1244 spin_unlock_irqrestore(&hw->spinlock, flags); 1244 spin_unlock_irqrestore(&hw->lock, flags);
1245 1245
1246 flush_packets_to_hw(hw); 1246 flush_packets_to_hw(hw);
1247} 1247}
@@ -1291,21 +1291,20 @@ static void *alloc_ctrl_packet(int header_size,
1291} 1291}
1292 1292
1293int ipwireless_send_packet(struct ipw_hardware *hw, unsigned int channel_idx, 1293int ipwireless_send_packet(struct ipw_hardware *hw, unsigned int channel_idx,
1294 unsigned char *data, unsigned int length, 1294 const unsigned char *data, unsigned int length,
1295 void (*callback) (void *cb, unsigned int length), 1295 void (*callback) (void *cb, unsigned int length),
1296 void *callback_data) 1296 void *callback_data)
1297{ 1297{
1298 struct ipw_tx_packet *packet; 1298 struct ipw_tx_packet *packet;
1299 1299
1300 packet = alloc_data_packet(length, 1300 packet = alloc_data_packet(length, (channel_idx + 1),
1301 (unsigned char) (channel_idx + 1), 1301 TL_PROTOCOLID_COM_DATA);
1302 TL_PROTOCOLID_COM_DATA);
1303 if (!packet) 1302 if (!packet)
1304 return -ENOMEM; 1303 return -ENOMEM;
1305 packet->packet_callback = callback; 1304 packet->packet_callback = callback;
1306 packet->callback_data = callback_data; 1305 packet->callback_data = callback_data;
1307 memcpy((unsigned char *) packet + 1306 memcpy((unsigned char *) packet + sizeof(struct ipw_tx_packet), data,
1308 sizeof(struct ipw_tx_packet), data, length); 1307 length);
1309 1308
1310 send_packet(hw, PRIO_DATA, packet); 1309 send_packet(hw, PRIO_DATA, packet);
1311 return 0; 1310 return 0;
@@ -1321,12 +1320,11 @@ static int set_control_line(struct ipw_hardware *hw, int prio,
1321 protocolid = TL_PROTOCOLID_SETUP; 1320 protocolid = TL_PROTOCOLID_SETUP;
1322 1321
1323 packet = alloc_ctrl_packet(sizeof(struct ipw_control_packet), 1322 packet = alloc_ctrl_packet(sizeof(struct ipw_control_packet),
1324 (unsigned char) (channel_idx + 1), 1323 (channel_idx + 1), protocolid, line);
1325 protocolid, line);
1326 if (!packet) 1324 if (!packet)
1327 return -ENOMEM; 1325 return -ENOMEM;
1328 packet->header.length = sizeof(struct ipw_control_packet_body); 1326 packet->header.length = sizeof(struct ipw_control_packet_body);
1329 packet->body.value = (unsigned char) (state == 0 ? 0 : 1); 1327 packet->body.value = (state == 0 ? 0 : 1);
1330 send_packet(hw, prio, &packet->header); 1328 send_packet(hw, prio, &packet->header);
1331 return 0; 1329 return 0;
1332} 1330}
@@ -1504,8 +1502,7 @@ static void handle_setup_get_version_rsp(struct ipw_hardware *hw,
1504 if (vers_no == TL_SETUP_VERSION) 1502 if (vers_no == TL_SETUP_VERSION)
1505 __handle_setup_get_version_rsp(hw); 1503 __handle_setup_get_version_rsp(hw);
1506 else 1504 else
1507 printk(KERN_ERR 1505 printk(KERN_ERR IPWIRELESS_PCCARD_NAME
1508 IPWIRELESS_PCCARD_NAME
1509 ": invalid hardware version no %u\n", 1506 ": invalid hardware version no %u\n",
1510 (unsigned int) vers_no); 1507 (unsigned int) vers_no);
1511} 1508}
@@ -1528,10 +1525,10 @@ static void ipw_send_setup_packet(struct ipw_hardware *hw)
1528 1525
1529static void handle_received_SETUP_packet(struct ipw_hardware *hw, 1526static void handle_received_SETUP_packet(struct ipw_hardware *hw,
1530 unsigned int address, 1527 unsigned int address,
1531 unsigned char *data, int len, 1528 const unsigned char *data, int len,
1532 int is_last) 1529 int is_last)
1533{ 1530{
1534 union ipw_setup_rx_msg *rx_msg = (union ipw_setup_rx_msg *) data; 1531 const union ipw_setup_rx_msg *rx_msg = (const union ipw_setup_rx_msg *) data;
1535 1532
1536 if (address != ADDR_SETUP_PROT) { 1533 if (address != ADDR_SETUP_PROT) {
1537 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 1534 printk(KERN_INFO IPWIRELESS_PCCARD_NAME
@@ -1629,7 +1626,7 @@ struct ipw_hardware *ipwireless_hardware_create(void)
1629 1626
1630 INIT_LIST_HEAD(&hw->rx_queue); 1627 INIT_LIST_HEAD(&hw->rx_queue);
1631 INIT_LIST_HEAD(&hw->rx_pool); 1628 INIT_LIST_HEAD(&hw->rx_pool);
1632 spin_lock_init(&hw->spinlock); 1629 spin_lock_init(&hw->lock);
1633 tasklet_init(&hw->tasklet, ipwireless_do_tasklet, (unsigned long) hw); 1630 tasklet_init(&hw->tasklet, ipwireless_do_tasklet, (unsigned long) hw);
1634 INIT_WORK(&hw->work_rx, ipw_receive_data_work); 1631 INIT_WORK(&hw->work_rx, ipw_receive_data_work);
1635 setup_timer(&hw->setup_timer, ipwireless_setup_timer, 1632 setup_timer(&hw->setup_timer, ipwireless_setup_timer,
@@ -1651,8 +1648,8 @@ void ipwireless_init_hardware_v1(struct ipw_hardware *hw,
1651 enable_irq(hw->irq); 1648 enable_irq(hw->irq);
1652 } 1649 }
1653 hw->base_port = base_port; 1650 hw->base_port = base_port;
1654 hw->hw_version = is_v2_card ? HW_VERSION_2 : HW_VERSION_1; 1651 hw->hw_version = (is_v2_card ? HW_VERSION_2 : HW_VERSION_1);
1655 hw->ll_mtu = hw->hw_version == HW_VERSION_1 ? LL_MTU_V1 : LL_MTU_V2; 1652 hw->ll_mtu = (hw->hw_version == HW_VERSION_1 ? LL_MTU_V1 : LL_MTU_V2);
1656 hw->memregs_CCR = (struct MEMCCR __iomem *) 1653 hw->memregs_CCR = (struct MEMCCR __iomem *)
1657 ((unsigned short __iomem *) attr_memory + 0x200); 1654 ((unsigned short __iomem *) attr_memory + 0x200);
1658 hw->memory_info_regs = (struct MEMINFREG __iomem *) common_memory; 1655 hw->memory_info_regs = (struct MEMINFREG __iomem *) common_memory;
@@ -1695,10 +1692,10 @@ static void ipwireless_setup_timer(unsigned long data)
1695 if (is_card_present(hw)) { 1692 if (is_card_present(hw)) {
1696 unsigned long flags; 1693 unsigned long flags;
1697 1694
1698 spin_lock_irqsave(&hw->spinlock, flags); 1695 spin_lock_irqsave(&hw->lock, flags);
1699 hw->to_setup = 1; 1696 hw->to_setup = 1;
1700 hw->tx_ready = 1; 1697 hw->tx_ready = 1;
1701 spin_unlock_irqrestore(&hw->spinlock, flags); 1698 spin_unlock_irqrestore(&hw->lock, flags);
1702 tasklet_schedule(&hw->tasklet); 1699 tasklet_schedule(&hw->tasklet);
1703 } 1700 }
1704 1701
diff --git a/drivers/char/pcmcia/ipwireless/hardware.h b/drivers/char/pcmcia/ipwireless/hardware.h
index 19ce5eb266b1..90a8590e43b0 100644
--- a/drivers/char/pcmcia/ipwireless/hardware.h
+++ b/drivers/char/pcmcia/ipwireless/hardware.h
@@ -34,14 +34,14 @@ struct ipw_network;
34 34
35struct ipw_hardware *ipwireless_hardware_create(void); 35struct ipw_hardware *ipwireless_hardware_create(void);
36void ipwireless_hardware_free(struct ipw_hardware *hw); 36void ipwireless_hardware_free(struct ipw_hardware *hw);
37irqreturn_t ipwireless_interrupt(int irq, void *dev_id, struct pt_regs *regs); 37irqreturn_t ipwireless_interrupt(int irq, void *dev_id);
38int ipwireless_set_DTR(struct ipw_hardware *hw, unsigned int channel_idx, 38int ipwireless_set_DTR(struct ipw_hardware *hw, unsigned int channel_idx,
39 int state); 39 int state);
40int ipwireless_set_RTS(struct ipw_hardware *hw, unsigned int channel_idx, 40int ipwireless_set_RTS(struct ipw_hardware *hw, unsigned int channel_idx,
41 int state); 41 int state);
42int ipwireless_send_packet(struct ipw_hardware *hw, 42int ipwireless_send_packet(struct ipw_hardware *hw,
43 unsigned int channel_idx, 43 unsigned int channel_idx,
44 unsigned char *data, 44 const unsigned char *data,
45 unsigned int length, 45 unsigned int length,
46 void (*packet_sent_callback) (void *cb, 46 void (*packet_sent_callback) (void *cb,
47 unsigned int length), 47 unsigned int length),
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c
index cc7dcea2d283..5eca7a99afe6 100644
--- a/drivers/char/pcmcia/ipwireless/main.c
+++ b/drivers/char/pcmcia/ipwireless/main.c
@@ -49,7 +49,7 @@ static void ipwireless_detach(struct pcmcia_device *link);
49/* Debug mode: more verbose, print sent/recv bytes */ 49/* Debug mode: more verbose, print sent/recv bytes */
50int ipwireless_debug; 50int ipwireless_debug;
51int ipwireless_loopback; 51int ipwireless_loopback;
52int ipwireless_out_queue = 1; 52int ipwireless_out_queue = 10;
53 53
54module_param_named(debug, ipwireless_debug, int, 0); 54module_param_named(debug, ipwireless_debug, int, 0);
55module_param_named(loopback, ipwireless_loopback, int, 0); 55module_param_named(loopback, ipwireless_loopback, int, 0);
@@ -57,7 +57,7 @@ module_param_named(out_queue, ipwireless_out_queue, int, 0);
57MODULE_PARM_DESC(debug, "switch on debug messages [0]"); 57MODULE_PARM_DESC(debug, "switch on debug messages [0]");
58MODULE_PARM_DESC(loopback, 58MODULE_PARM_DESC(loopback,
59 "debug: enable ras_raw channel [0]"); 59 "debug: enable ras_raw channel [0]");
60MODULE_PARM_DESC(out_queue, "debug: set size of outgoing queue [1]"); 60MODULE_PARM_DESC(out_queue, "debug: set size of outgoing PPP queue [10]");
61 61
62/* Executes in process context. */ 62/* Executes in process context. */
63static void signalled_reboot_work(struct work_struct *work_reboot) 63static void signalled_reboot_work(struct work_struct *work_reboot)
@@ -88,8 +88,6 @@ static int config_ipwireless(struct ipw_dev *ipw)
88 unsigned short buf[64]; 88 unsigned short buf[64];
89 cisparse_t parse; 89 cisparse_t parse;
90 unsigned short cor_value; 90 unsigned short cor_value;
91 win_req_t request_attr_memory;
92 win_req_t request_common_memory;
93 memreq_t memreq_attr_memory; 91 memreq_t memreq_attr_memory;
94 memreq_t memreq_common_memory; 92 memreq_t memreq_common_memory;
95 93
@@ -188,6 +186,9 @@ static int config_ipwireless(struct ipw_dev *ipw)
188 goto exit0; 186 goto exit0;
189 } 187 }
190 188
189 request_region(link->io.BasePort1, link->io.NumPorts1,
190 IPWIRELESS_PCCARD_NAME);
191
191 /* memory settings */ 192 /* memory settings */
192 193
193 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; 194 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
@@ -214,16 +215,16 @@ static int config_ipwireless(struct ipw_dev *ipw)
214 } 215 }
215 216
216 if (parse.cftable_entry.mem.nwin > 0) { 217 if (parse.cftable_entry.mem.nwin > 0) {
217 request_common_memory.Attributes = 218 ipw->request_common_memory.Attributes =
218 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; 219 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE;
219 request_common_memory.Base = 220 ipw->request_common_memory.Base =
220 parse.cftable_entry.mem.win[0].host_addr; 221 parse.cftable_entry.mem.win[0].host_addr;
221 request_common_memory.Size = parse.cftable_entry.mem.win[0].len; 222 ipw->request_common_memory.Size = parse.cftable_entry.mem.win[0].len;
222 if (request_common_memory.Size < 0x1000) 223 if (ipw->request_common_memory.Size < 0x1000)
223 request_common_memory.Size = 0x1000; 224 ipw->request_common_memory.Size = 0x1000;
224 request_common_memory.AccessSpeed = 0; 225 ipw->request_common_memory.AccessSpeed = 0;
225 226
226 ret = pcmcia_request_window(&link, &request_common_memory, 227 ret = pcmcia_request_window(&link, &ipw->request_common_memory,
227 &ipw->handle_common_memory); 228 &ipw->handle_common_memory);
228 229
229 if (ret != CS_SUCCESS) { 230 if (ret != CS_SUCCESS) {
@@ -246,16 +247,18 @@ static int config_ipwireless(struct ipw_dev *ipw)
246 ipw->is_v2_card = 247 ipw->is_v2_card =
247 parse.cftable_entry.mem.win[0].len == 0x100; 248 parse.cftable_entry.mem.win[0].len == 0x100;
248 249
249 ipw->common_memory = ioremap(request_common_memory.Base, 250 ipw->common_memory = ioremap(ipw->request_common_memory.Base,
250 request_common_memory.Size); 251 ipw->request_common_memory.Size);
252 request_mem_region(ipw->request_common_memory.Base,
253 ipw->request_common_memory.Size, IPWIRELESS_PCCARD_NAME);
251 254
252 request_attr_memory.Attributes = 255 ipw->request_attr_memory.Attributes =
253 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE; 256 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE;
254 request_attr_memory.Base = 0; 257 ipw->request_attr_memory.Base = 0;
255 request_attr_memory.Size = 0; /* this used to be 0x1000 */ 258 ipw->request_attr_memory.Size = 0; /* this used to be 0x1000 */
256 request_attr_memory.AccessSpeed = 0; 259 ipw->request_attr_memory.AccessSpeed = 0;
257 260
258 ret = pcmcia_request_window(&link, &request_attr_memory, 261 ret = pcmcia_request_window(&link, &ipw->request_attr_memory,
259 &ipw->handle_attr_memory); 262 &ipw->handle_attr_memory);
260 263
261 if (ret != CS_SUCCESS) { 264 if (ret != CS_SUCCESS) {
@@ -274,8 +277,10 @@ static int config_ipwireless(struct ipw_dev *ipw)
274 goto exit2; 277 goto exit2;
275 } 278 }
276 279
277 ipw->attr_memory = ioremap(request_attr_memory.Base, 280 ipw->attr_memory = ioremap(ipw->request_attr_memory.Base,
278 request_attr_memory.Size); 281 ipw->request_attr_memory.Size);
282 request_mem_region(ipw->request_attr_memory.Base, ipw->request_attr_memory.Size,
283 IPWIRELESS_PCCARD_NAME);
279 } 284 }
280 285
281 INIT_WORK(&ipw->work_reboot, signalled_reboot_work); 286 INIT_WORK(&ipw->work_reboot, signalled_reboot_work);
@@ -311,14 +316,13 @@ static int config_ipwireless(struct ipw_dev *ipw)
311 (unsigned int) link->irq.AssignedIRQ); 316 (unsigned int) link->irq.AssignedIRQ);
312 if (ipw->attr_memory && ipw->common_memory) 317 if (ipw->attr_memory && ipw->common_memory)
313 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 318 printk(KERN_INFO IPWIRELESS_PCCARD_NAME
314 ": attr memory 0x%08lx-0x%08lx, " 319 ": attr memory 0x%08lx-0x%08lx, common memory 0x%08lx-0x%08lx\n",
315 "common memory 0x%08lx-0x%08lx\n", 320 ipw->request_attr_memory.Base,
316 request_attr_memory.Base, 321 ipw->request_attr_memory.Base
317 request_attr_memory.Base 322 + ipw->request_attr_memory.Size - 1,
318 + request_attr_memory.Size - 1, 323 ipw->request_common_memory.Base,
319 request_common_memory.Base, 324 ipw->request_common_memory.Base
320 request_common_memory.Base 325 + ipw->request_common_memory.Size - 1);
321 + request_common_memory.Size - 1);
322 326
323 ipw->network = ipwireless_network_create(ipw->hardware); 327 ipw->network = ipwireless_network_create(ipw->hardware);
324 if (!ipw->network) 328 if (!ipw->network)
@@ -350,12 +354,16 @@ exit4:
350 pcmcia_disable_device(link); 354 pcmcia_disable_device(link);
351exit3: 355exit3:
352 if (ipw->attr_memory) { 356 if (ipw->attr_memory) {
357 release_mem_region(ipw->request_attr_memory.Base,
358 ipw->request_attr_memory.Size);
353 iounmap(ipw->attr_memory); 359 iounmap(ipw->attr_memory);
354 pcmcia_release_window(ipw->handle_attr_memory); 360 pcmcia_release_window(ipw->handle_attr_memory);
355 pcmcia_disable_device(link); 361 pcmcia_disable_device(link);
356 } 362 }
357exit2: 363exit2:
358 if (ipw->common_memory) { 364 if (ipw->common_memory) {
365 release_mem_region(ipw->request_common_memory.Base,
366 ipw->request_common_memory.Size);
359 iounmap(ipw->common_memory); 367 iounmap(ipw->common_memory);
360 pcmcia_release_window(ipw->handle_common_memory); 368 pcmcia_release_window(ipw->handle_common_memory);
361 } 369 }
@@ -367,19 +375,25 @@ exit0:
367 375
368static void release_ipwireless(struct ipw_dev *ipw) 376static void release_ipwireless(struct ipw_dev *ipw)
369{ 377{
370 struct pcmcia_device *link = ipw->link; 378 pcmcia_disable_device(ipw->link);
371
372 pcmcia_disable_device(link);
373 379
374 if (ipw->common_memory) 380 if (ipw->common_memory) {
381 release_mem_region(ipw->request_common_memory.Base,
382 ipw->request_common_memory.Size);
375 iounmap(ipw->common_memory); 383 iounmap(ipw->common_memory);
376 if (ipw->attr_memory) 384 }
385 if (ipw->attr_memory) {
386 release_mem_region(ipw->request_attr_memory.Base,
387 ipw->request_attr_memory.Size);
377 iounmap(ipw->attr_memory); 388 iounmap(ipw->attr_memory);
389 }
378 if (ipw->common_memory) 390 if (ipw->common_memory)
379 pcmcia_release_window(ipw->handle_common_memory); 391 pcmcia_release_window(ipw->handle_common_memory);
380 if (ipw->attr_memory) 392 if (ipw->attr_memory)
381 pcmcia_release_window(ipw->handle_attr_memory); 393 pcmcia_release_window(ipw->handle_attr_memory);
382 pcmcia_disable_device(link); 394
395 /* Break the link with Card Services */
396 pcmcia_disable_device(ipw->link);
383} 397}
384 398
385/* 399/*
@@ -437,10 +451,6 @@ static void ipwireless_detach(struct pcmcia_device *link)
437 451
438 release_ipwireless(ipw); 452 release_ipwireless(ipw);
439 453
440 /* Break the link with Card Services */
441 if (link)
442 pcmcia_disable_device(link);
443
444 if (ipw->tty != NULL) 454 if (ipw->tty != NULL)
445 ipwireless_tty_free(ipw->tty); 455 ipwireless_tty_free(ipw->tty);
446 if (ipw->network != NULL) 456 if (ipw->network != NULL)
diff --git a/drivers/char/pcmcia/ipwireless/main.h b/drivers/char/pcmcia/ipwireless/main.h
index 1bfdcc8d47d6..0e0363af9ab2 100644
--- a/drivers/char/pcmcia/ipwireless/main.h
+++ b/drivers/char/pcmcia/ipwireless/main.h
@@ -45,10 +45,15 @@ struct ipw_tty;
45struct ipw_dev { 45struct ipw_dev {
46 struct pcmcia_device *link; 46 struct pcmcia_device *link;
47 int is_v2_card; 47 int is_v2_card;
48
48 window_handle_t handle_attr_memory; 49 window_handle_t handle_attr_memory;
49 void __iomem *attr_memory; 50 void __iomem *attr_memory;
51 win_req_t request_attr_memory;
52
50 window_handle_t handle_common_memory; 53 window_handle_t handle_common_memory;
51 void __iomem *common_memory; 54 void __iomem *common_memory;
55 win_req_t request_common_memory;
56
52 dev_node_t nodes[2]; 57 dev_node_t nodes[2];
53 /* Reference to attribute memory, containing CIS data */ 58 /* Reference to attribute memory, containing CIS data */
54 void *attribute_memory; 59 void *attribute_memory;
diff --git a/drivers/char/pcmcia/ipwireless/network.c b/drivers/char/pcmcia/ipwireless/network.c
index fe914d34f7f6..590762a7f217 100644
--- a/drivers/char/pcmcia/ipwireless/network.c
+++ b/drivers/char/pcmcia/ipwireless/network.c
@@ -29,7 +29,6 @@
29#include "main.h" 29#include "main.h"
30#include "tty.h" 30#include "tty.h"
31 31
32#define MAX_OUTGOING_PACKETS_QUEUED ipwireless_out_queue
33#define MAX_ASSOCIATED_TTYS 2 32#define MAX_ASSOCIATED_TTYS 2
34 33
35#define SC_RCV_BITS (SC_RCV_B7_1|SC_RCV_B7_0|SC_RCV_ODDP|SC_RCV_EVNP) 34#define SC_RCV_BITS (SC_RCV_B7_1|SC_RCV_B7_0|SC_RCV_ODDP|SC_RCV_EVNP)
@@ -46,7 +45,7 @@ struct ipw_network {
46 /* Number of packets queued up in hardware module. */ 45 /* Number of packets queued up in hardware module. */
47 int outgoing_packets_queued; 46 int outgoing_packets_queued;
48 /* Spinlock to avoid interrupts during shutdown */ 47 /* Spinlock to avoid interrupts during shutdown */
49 spinlock_t spinlock; 48 spinlock_t lock;
50 struct mutex close_lock; 49 struct mutex close_lock;
51 50
52 /* PPP ioctl data, not actually used anywere */ 51 /* PPP ioctl data, not actually used anywere */
@@ -68,20 +67,20 @@ static void notify_packet_sent(void *callback_data, unsigned int packet_length)
68 struct ipw_network *network = callback_data; 67 struct ipw_network *network = callback_data;
69 unsigned long flags; 68 unsigned long flags;
70 69
71 spin_lock_irqsave(&network->spinlock, flags); 70 spin_lock_irqsave(&network->lock, flags);
72 network->outgoing_packets_queued--; 71 network->outgoing_packets_queued--;
73 if (network->ppp_channel != NULL) { 72 if (network->ppp_channel != NULL) {
74 if (network->ppp_blocked) { 73 if (network->ppp_blocked) {
75 network->ppp_blocked = 0; 74 network->ppp_blocked = 0;
76 spin_unlock_irqrestore(&network->spinlock, flags); 75 spin_unlock_irqrestore(&network->lock, flags);
77 ppp_output_wakeup(network->ppp_channel); 76 ppp_output_wakeup(network->ppp_channel);
78 if (ipwireless_debug) 77 if (ipwireless_debug)
79 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 78 printk(KERN_DEBUG IPWIRELESS_PCCARD_NAME
80 ": ppp unblocked\n"); 79 ": ppp unblocked\n");
81 } else 80 } else
82 spin_unlock_irqrestore(&network->spinlock, flags); 81 spin_unlock_irqrestore(&network->lock, flags);
83 } else 82 } else
84 spin_unlock_irqrestore(&network->spinlock, flags); 83 spin_unlock_irqrestore(&network->lock, flags);
85} 84}
86 85
87/* 86/*
@@ -93,8 +92,8 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel,
93 struct ipw_network *network = ppp_channel->private; 92 struct ipw_network *network = ppp_channel->private;
94 unsigned long flags; 93 unsigned long flags;
95 94
96 spin_lock_irqsave(&network->spinlock, flags); 95 spin_lock_irqsave(&network->lock, flags);
97 if (network->outgoing_packets_queued < MAX_OUTGOING_PACKETS_QUEUED) { 96 if (network->outgoing_packets_queued < ipwireless_out_queue) {
98 unsigned char *buf; 97 unsigned char *buf;
99 static unsigned char header[] = { 98 static unsigned char header[] = {
100 PPP_ALLSTATIONS, /* 0xff */ 99 PPP_ALLSTATIONS, /* 0xff */
@@ -103,7 +102,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel,
103 int ret; 102 int ret;
104 103
105 network->outgoing_packets_queued++; 104 network->outgoing_packets_queued++;
106 spin_unlock_irqrestore(&network->spinlock, flags); 105 spin_unlock_irqrestore(&network->lock, flags);
107 106
108 /* 107 /*
109 * If we have the requested amount of headroom in the skb we 108 * If we have the requested amount of headroom in the skb we
@@ -144,7 +143,9 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel,
144 * needs to be unblocked once we are ready to send. 143 * needs to be unblocked once we are ready to send.
145 */ 144 */
146 network->ppp_blocked = 1; 145 network->ppp_blocked = 1;
147 spin_unlock_irqrestore(&network->spinlock, flags); 146 spin_unlock_irqrestore(&network->lock, flags);
147 if (ipwireless_debug)
148 printk(KERN_DEBUG IPWIRELESS_PCCARD_NAME ": ppp blocked\n");
148 return 0; 149 return 0;
149 } 150 }
150} 151}
@@ -249,11 +250,11 @@ static void do_go_online(struct work_struct *work_go_online)
249 work_go_online); 250 work_go_online);
250 unsigned long flags; 251 unsigned long flags;
251 252
252 spin_lock_irqsave(&network->spinlock, flags); 253 spin_lock_irqsave(&network->lock, flags);
253 if (!network->ppp_channel) { 254 if (!network->ppp_channel) {
254 struct ppp_channel *channel; 255 struct ppp_channel *channel;
255 256
256 spin_unlock_irqrestore(&network->spinlock, flags); 257 spin_unlock_irqrestore(&network->lock, flags);
257 channel = kzalloc(sizeof(struct ppp_channel), GFP_KERNEL); 258 channel = kzalloc(sizeof(struct ppp_channel), GFP_KERNEL);
258 if (!channel) { 259 if (!channel) {
259 printk(KERN_ERR IPWIRELESS_PCCARD_NAME 260 printk(KERN_ERR IPWIRELESS_PCCARD_NAME
@@ -273,10 +274,10 @@ static void do_go_online(struct work_struct *work_go_online)
273 network->xaccm[3] = 0x60000000U; 274 network->xaccm[3] = 0x60000000U;
274 network->raccm = ~0U; 275 network->raccm = ~0U;
275 ppp_register_channel(channel); 276 ppp_register_channel(channel);
276 spin_lock_irqsave(&network->spinlock, flags); 277 spin_lock_irqsave(&network->lock, flags);
277 network->ppp_channel = channel; 278 network->ppp_channel = channel;
278 } 279 }
279 spin_unlock_irqrestore(&network->spinlock, flags); 280 spin_unlock_irqrestore(&network->lock, flags);
280} 281}
281 282
282static void do_go_offline(struct work_struct *work_go_offline) 283static void do_go_offline(struct work_struct *work_go_offline)
@@ -287,16 +288,16 @@ static void do_go_offline(struct work_struct *work_go_offline)
287 unsigned long flags; 288 unsigned long flags;
288 289
289 mutex_lock(&network->close_lock); 290 mutex_lock(&network->close_lock);
290 spin_lock_irqsave(&network->spinlock, flags); 291 spin_lock_irqsave(&network->lock, flags);
291 if (network->ppp_channel != NULL) { 292 if (network->ppp_channel != NULL) {
292 struct ppp_channel *channel = network->ppp_channel; 293 struct ppp_channel *channel = network->ppp_channel;
293 294
294 network->ppp_channel = NULL; 295 network->ppp_channel = NULL;
295 spin_unlock_irqrestore(&network->spinlock, flags); 296 spin_unlock_irqrestore(&network->lock, flags);
296 mutex_unlock(&network->close_lock); 297 mutex_unlock(&network->close_lock);
297 ppp_unregister_channel(channel); 298 ppp_unregister_channel(channel);
298 } else { 299 } else {
299 spin_unlock_irqrestore(&network->spinlock, flags); 300 spin_unlock_irqrestore(&network->lock, flags);
300 mutex_unlock(&network->close_lock); 301 mutex_unlock(&network->close_lock);
301 } 302 }
302} 303}
@@ -381,18 +382,18 @@ void ipwireless_network_packet_received(struct ipw_network *network,
381 * the PPP layer. 382 * the PPP layer.
382 */ 383 */
383 mutex_lock(&network->close_lock); 384 mutex_lock(&network->close_lock);
384 spin_lock_irqsave(&network->spinlock, flags); 385 spin_lock_irqsave(&network->lock, flags);
385 if (network->ppp_channel != NULL) { 386 if (network->ppp_channel != NULL) {
386 struct sk_buff *skb; 387 struct sk_buff *skb;
387 388
388 spin_unlock_irqrestore(&network->spinlock, 389 spin_unlock_irqrestore(&network->lock,
389 flags); 390 flags);
390 391
391 /* Send the data to the ppp_generic module. */ 392 /* Send the data to the ppp_generic module. */
392 skb = ipw_packet_received_skb(data, length); 393 skb = ipw_packet_received_skb(data, length);
393 ppp_input(network->ppp_channel, skb); 394 ppp_input(network->ppp_channel, skb);
394 } else 395 } else
395 spin_unlock_irqrestore(&network->spinlock, 396 spin_unlock_irqrestore(&network->lock,
396 flags); 397 flags);
397 mutex_unlock(&network->close_lock); 398 mutex_unlock(&network->close_lock);
398 } 399 }
@@ -410,7 +411,7 @@ struct ipw_network *ipwireless_network_create(struct ipw_hardware *hw)
410 if (!network) 411 if (!network)
411 return NULL; 412 return NULL;
412 413
413 spin_lock_init(&network->spinlock); 414 spin_lock_init(&network->lock);
414 mutex_init(&network->close_lock); 415 mutex_init(&network->close_lock);
415 416
416 network->hardware = hw; 417 network->hardware = hw;
@@ -478,10 +479,10 @@ int ipwireless_ppp_channel_index(struct ipw_network *network)
478 int ret = -1; 479 int ret = -1;
479 unsigned long flags; 480 unsigned long flags;
480 481
481 spin_lock_irqsave(&network->spinlock, flags); 482 spin_lock_irqsave(&network->lock, flags);
482 if (network->ppp_channel != NULL) 483 if (network->ppp_channel != NULL)
483 ret = ppp_channel_index(network->ppp_channel); 484 ret = ppp_channel_index(network->ppp_channel);
484 spin_unlock_irqrestore(&network->spinlock, flags); 485 spin_unlock_irqrestore(&network->lock, flags);
485 486
486 return ret; 487 return ret;
487} 488}
@@ -491,10 +492,15 @@ int ipwireless_ppp_unit_number(struct ipw_network *network)
491 int ret = -1; 492 int ret = -1;
492 unsigned long flags; 493 unsigned long flags;
493 494
494 spin_lock_irqsave(&network->spinlock, flags); 495 spin_lock_irqsave(&network->lock, flags);
495 if (network->ppp_channel != NULL) 496 if (network->ppp_channel != NULL)
496 ret = ppp_unit_number(network->ppp_channel); 497 ret = ppp_unit_number(network->ppp_channel);
497 spin_unlock_irqrestore(&network->spinlock, flags); 498 spin_unlock_irqrestore(&network->lock, flags);
498 499
499 return ret; 500 return ret;
500} 501}
502
503int ipwireless_ppp_mru(const struct ipw_network *network)
504{
505 return network->mru;
506}
diff --git a/drivers/char/pcmcia/ipwireless/network.h b/drivers/char/pcmcia/ipwireless/network.h
index ccacd26fc7ef..561f765b3334 100644
--- a/drivers/char/pcmcia/ipwireless/network.h
+++ b/drivers/char/pcmcia/ipwireless/network.h
@@ -48,5 +48,6 @@ void ipwireless_ppp_open(struct ipw_network *net);
48void ipwireless_ppp_close(struct ipw_network *net); 48void ipwireless_ppp_close(struct ipw_network *net);
49int ipwireless_ppp_channel_index(struct ipw_network *net); 49int ipwireless_ppp_channel_index(struct ipw_network *net);
50int ipwireless_ppp_unit_number(struct ipw_network *net); 50int ipwireless_ppp_unit_number(struct ipw_network *net);
51int ipwireless_ppp_mru(const struct ipw_network *net);
51 52
52#endif 53#endif
diff --git a/drivers/char/pcmcia/ipwireless/tty.c b/drivers/char/pcmcia/ipwireless/tty.c
index 42f3815c5ce3..b1414507997c 100644
--- a/drivers/char/pcmcia/ipwireless/tty.c
+++ b/drivers/char/pcmcia/ipwireless/tty.c
@@ -259,7 +259,7 @@ static int ipw_write(struct tty_struct *linux_tty,
259 } 259 }
260 260
261 ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS, 261 ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS,
262 (unsigned char *) buf, count, 262 buf, count,
263 ipw_write_packet_sent_callback, tty); 263 ipw_write_packet_sent_callback, tty);
264 if (ret == -1) { 264 if (ret == -1) {
265 mutex_unlock(&tty->ipw_tty_mutex); 265 mutex_unlock(&tty->ipw_tty_mutex);
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 8d6a3ff02672..8a67f16987db 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -825,6 +825,9 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
825 policy->user_policy.min = policy->cpuinfo.min_freq; 825 policy->user_policy.min = policy->cpuinfo.min_freq;
826 policy->user_policy.max = policy->cpuinfo.max_freq; 826 policy->user_policy.max = policy->cpuinfo.max_freq;
827 827
828 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
829 CPUFREQ_START, policy);
830
828#ifdef CONFIG_SMP 831#ifdef CONFIG_SMP
829 832
830#ifdef CONFIG_HOTPLUG_CPU 833#ifdef CONFIG_HOTPLUG_CPU
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 5405769020a1..5ce07b517c58 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -94,7 +94,7 @@ void cpuidle_install_idle_handler(void)
94 */ 94 */
95void cpuidle_uninstall_idle_handler(void) 95void cpuidle_uninstall_idle_handler(void)
96{ 96{
97 if (enabled_devices && (pm_idle != pm_idle_old)) { 97 if (enabled_devices && pm_idle_old && (pm_idle != pm_idle_old)) {
98 pm_idle = pm_idle_old; 98 pm_idle = pm_idle_old;
99 cpuidle_kick_cpus(); 99 cpuidle_kick_cpus();
100 } 100 }
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c
index c66817e7717b..50a071f1c945 100644
--- a/drivers/firmware/dcdbas.c
+++ b/drivers/firmware/dcdbas.c
@@ -245,7 +245,6 @@ static ssize_t host_control_on_shutdown_store(struct device *dev,
245static int smi_request(struct smi_cmd *smi_cmd) 245static int smi_request(struct smi_cmd *smi_cmd)
246{ 246{
247 cpumask_t old_mask; 247 cpumask_t old_mask;
248 cpumask_of_cpu_ptr(new_mask, 0);
249 int ret = 0; 248 int ret = 0;
250 249
251 if (smi_cmd->magic != SMI_CMD_MAGIC) { 250 if (smi_cmd->magic != SMI_CMD_MAGIC) {
@@ -256,7 +255,7 @@ static int smi_request(struct smi_cmd *smi_cmd)
256 255
257 /* SMI requires CPU 0 */ 256 /* SMI requires CPU 0 */
258 old_mask = current->cpus_allowed; 257 old_mask = current->cpus_allowed;
259 set_cpus_allowed_ptr(current, new_mask); 258 set_cpus_allowed_ptr(current, &cpumask_of_cpu(0));
260 if (smp_processor_id() != 0) { 259 if (smp_processor_id() != 0) {
261 dev_dbg(&dcdbas_pdev->dev, "%s: failed to get CPU 0\n", 260 dev_dbg(&dcdbas_pdev->dev, "%s: failed to get CPU 0\n",
262 __func__); 261 __func__);
diff --git a/drivers/firmware/iscsi_ibft_find.c b/drivers/firmware/iscsi_ibft_find.c
index 11f17440fea6..d53fbbfefa3e 100644
--- a/drivers/firmware/iscsi_ibft_find.c
+++ b/drivers/firmware/iscsi_ibft_find.c
@@ -81,4 +81,3 @@ void __init reserve_ibft_region(void)
81 if (ibft_addr) 81 if (ibft_addr)
82 reserve_bootmem(pos, PAGE_ALIGN(len), BOOTMEM_DEFAULT); 82 reserve_bootmem(pos, PAGE_ALIGN(len), BOOTMEM_DEFAULT);
83} 83}
84EXPORT_SYMBOL_GPL(reserve_ibft_region);
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 00ff53348491..c882fd05cf29 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -394,13 +394,24 @@ config SENSORS_LM75
394 tristate "National Semiconductor LM75 and compatibles" 394 tristate "National Semiconductor LM75 and compatibles"
395 depends on I2C 395 depends on I2C
396 help 396 help
397 If you say yes here you get support for National Semiconductor LM75 397 If you say yes here you get support for one common type of
398 sensor chips and clones: Dallas Semiconductor DS75 and DS1775 (in 398 temperature sensor chip, with models including:
399 9-bit precision mode), and TelCom (now Microchip) TCN75. 399
400 400 - Dallas Semiconductor DS75 and DS1775
401 The DS75 and DS1775 in 10- to 12-bit precision modes will require 401 - Maxim MAX6625 and MAX6626
402 a force module parameter. The driver will not handle the extra 402 - Microchip MCP980x
403 precision anyhow. 403 - National Semiconductor LM75
404 - NXP's LM75A
405 - ST Microelectronics STDS75
406 - TelCom (now Microchip) TCN75
407 - Texas Instruments TMP100, TMP101, TMP75, TMP175, TMP275
408
409 This driver supports driver model based binding through board
410 specific I2C device tables.
411
412 It also supports the "legacy" style of driver binding. To use
413 that with some chips which don't replicate LM75 quirks exactly,
414 you may need the "force" module parameter.
404 415
405 This driver can also be built as a module. If so, the module 416 This driver can also be built as a module. If so, the module
406 will be called lm75. 417 will be called lm75.
diff --git a/drivers/hwmon/adt7473.c b/drivers/hwmon/adt7473.c
index ce4a7cb5a116..3a0b63136479 100644
--- a/drivers/hwmon/adt7473.c
+++ b/drivers/hwmon/adt7473.c
@@ -39,32 +39,20 @@ I2C_CLIENT_INSMOD_1(adt7473);
39#define ADT7473_REG_BASE_ADDR 0x20 39#define ADT7473_REG_BASE_ADDR 0x20
40 40
41#define ADT7473_REG_VOLT_BASE_ADDR 0x21 41#define ADT7473_REG_VOLT_BASE_ADDR 0x21
42#define ADT7473_REG_VOLT_MAX_ADDR 0x22
43#define ADT7473_REG_VOLT_MIN_BASE_ADDR 0x46 42#define ADT7473_REG_VOLT_MIN_BASE_ADDR 0x46
44#define ADT7473_REG_VOLT_MIN_MAX_ADDR 0x49
45 43
46#define ADT7473_REG_TEMP_BASE_ADDR 0x25 44#define ADT7473_REG_TEMP_BASE_ADDR 0x25
47#define ADT7473_REG_TEMP_MAX_ADDR 0x27
48#define ADT7473_REG_TEMP_LIMITS_BASE_ADDR 0x4E 45#define ADT7473_REG_TEMP_LIMITS_BASE_ADDR 0x4E
49#define ADT7473_REG_TEMP_LIMITS_MAX_ADDR 0x53
50#define ADT7473_REG_TEMP_TMIN_BASE_ADDR 0x67 46#define ADT7473_REG_TEMP_TMIN_BASE_ADDR 0x67
51#define ADT7473_REG_TEMP_TMIN_MAX_ADDR 0x69
52#define ADT7473_REG_TEMP_TMAX_BASE_ADDR 0x6A 47#define ADT7473_REG_TEMP_TMAX_BASE_ADDR 0x6A
53#define ADT7473_REG_TEMP_TMAX_MAX_ADDR 0x6C
54 48
55#define ADT7473_REG_FAN_BASE_ADDR 0x28 49#define ADT7473_REG_FAN_BASE_ADDR 0x28
56#define ADT7473_REG_FAN_MAX_ADDR 0x2F
57#define ADT7473_REG_FAN_MIN_BASE_ADDR 0x54 50#define ADT7473_REG_FAN_MIN_BASE_ADDR 0x54
58#define ADT7473_REG_FAN_MIN_MAX_ADDR 0x5B
59 51
60#define ADT7473_REG_PWM_BASE_ADDR 0x30 52#define ADT7473_REG_PWM_BASE_ADDR 0x30
61#define ADT7473_REG_PWM_MAX_ADDR 0x32
62#define ADT7473_REG_PWM_MIN_BASE_ADDR 0x64 53#define ADT7473_REG_PWM_MIN_BASE_ADDR 0x64
63#define ADT7473_REG_PWM_MIN_MAX_ADDR 0x66
64#define ADT7473_REG_PWM_MAX_BASE_ADDR 0x38 54#define ADT7473_REG_PWM_MAX_BASE_ADDR 0x38
65#define ADT7473_REG_PWM_MAX_MAX_ADDR 0x3A
66#define ADT7473_REG_PWM_BHVR_BASE_ADDR 0x5C 55#define ADT7473_REG_PWM_BHVR_BASE_ADDR 0x5C
67#define ADT7473_REG_PWM_BHVR_MAX_ADDR 0x5E
68#define ADT7473_PWM_BHVR_MASK 0xE0 56#define ADT7473_PWM_BHVR_MASK 0xE0
69#define ADT7473_PWM_BHVR_SHIFT 5 57#define ADT7473_PWM_BHVR_SHIFT 5
70 58
@@ -102,7 +90,6 @@ I2C_CLIENT_INSMOD_1(adt7473);
102#define ADT7473_FAN4_ALARM 0x20 90#define ADT7473_FAN4_ALARM 0x20
103#define ADT7473_R1T_SHORT 0x40 91#define ADT7473_R1T_SHORT 0x40
104#define ADT7473_R2T_SHORT 0x80 92#define ADT7473_R2T_SHORT 0x80
105#define ADT7473_REG_MAX_ADDR 0x80
106 93
107#define ALARM2(x) ((x) << 8) 94#define ALARM2(x) ((x) << 8)
108 95
@@ -583,10 +570,9 @@ static ssize_t set_max_duty_at_crit(struct device *dev,
583 struct i2c_client *client = to_i2c_client(dev); 570 struct i2c_client *client = to_i2c_client(dev);
584 struct adt7473_data *data = i2c_get_clientdata(client); 571 struct adt7473_data *data = i2c_get_clientdata(client);
585 int temp = simple_strtol(buf, NULL, 10); 572 int temp = simple_strtol(buf, NULL, 10);
586 temp = temp && 0xFF;
587 573
588 mutex_lock(&data->lock); 574 mutex_lock(&data->lock);
589 data->max_duty_at_overheat = temp; 575 data->max_duty_at_overheat = !!temp;
590 reg = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG4); 576 reg = i2c_smbus_read_byte_data(client, ADT7473_REG_CFG4);
591 if (temp) 577 if (temp)
592 reg |= ADT7473_CFG4_MAX_DUTY_AT_OVT; 578 reg |= ADT7473_CFG4_MAX_DUTY_AT_OVT;
diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
index 7673f65877e1..5e2cf0aef480 100644
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -48,6 +48,11 @@ static unsigned short force_id;
48module_param(force_id, ushort, 0); 48module_param(force_id, ushort, 0);
49MODULE_PARM_DESC(force_id, "Override the detected device ID"); 49MODULE_PARM_DESC(force_id, "Override the detected device ID");
50 50
51static int probe_all_addr;
52module_param(probe_all_addr, bool, 0);
53MODULE_PARM_DESC(probe_all_addr, "Include probing of non-standard LPC "
54 "addresses");
55
51/* Addresses to scan */ 56/* Addresses to scan */
52static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END}; 57static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};
53 58
@@ -176,6 +181,7 @@ struct dme1737_data {
176 int valid; /* !=0 if following fields are valid */ 181 int valid; /* !=0 if following fields are valid */
177 unsigned long last_update; /* in jiffies */ 182 unsigned long last_update; /* in jiffies */
178 unsigned long last_vbat; /* in jiffies */ 183 unsigned long last_vbat; /* in jiffies */
184 enum chips type;
179 185
180 u8 vid; 186 u8 vid;
181 u8 pwm_rr_en; 187 u8 pwm_rr_en;
@@ -210,20 +216,27 @@ struct dme1737_data {
210}; 216};
211 217
212/* Nominal voltage values */ 218/* Nominal voltage values */
213static const int IN_NOMINAL[] = {5000, 2250, 3300, 5000, 12000, 3300, 3300}; 219static const int IN_NOMINAL_DME1737[] = {5000, 2250, 3300, 5000, 12000, 3300,
220 3300};
221static const int IN_NOMINAL_SCH311x[] = {2500, 1500, 3300, 5000, 12000, 3300,
222 3300};
223#define IN_NOMINAL(ix, type) (((type) == dme1737) ? \
224 IN_NOMINAL_DME1737[(ix)] : \
225 IN_NOMINAL_SCH311x[(ix)])
214 226
215/* Voltage input 227/* Voltage input
216 * Voltage inputs have 16 bits resolution, limit values have 8 bits 228 * Voltage inputs have 16 bits resolution, limit values have 8 bits
217 * resolution. */ 229 * resolution. */
218static inline int IN_FROM_REG(int reg, int ix, int res) 230static inline int IN_FROM_REG(int reg, int ix, int res, int type)
219{ 231{
220 return (reg * IN_NOMINAL[ix] + (3 << (res - 3))) / (3 << (res - 2)); 232 return (reg * IN_NOMINAL(ix, type) + (3 << (res - 3))) /
233 (3 << (res - 2));
221} 234}
222 235
223static inline int IN_TO_REG(int val, int ix) 236static inline int IN_TO_REG(int val, int ix, int type)
224{ 237{
225 return SENSORS_LIMIT((val * 192 + IN_NOMINAL[ix] / 2) / 238 return SENSORS_LIMIT((val * 192 + IN_NOMINAL(ix, type) / 2) /
226 IN_NOMINAL[ix], 0, 255); 239 IN_NOMINAL(ix, type), 0, 255);
227} 240}
228 241
229/* Temperature input 242/* Temperature input
@@ -722,13 +735,13 @@ static ssize_t show_in(struct device *dev, struct device_attribute *attr,
722 735
723 switch (fn) { 736 switch (fn) {
724 case SYS_IN_INPUT: 737 case SYS_IN_INPUT:
725 res = IN_FROM_REG(data->in[ix], ix, 16); 738 res = IN_FROM_REG(data->in[ix], ix, 16, data->type);
726 break; 739 break;
727 case SYS_IN_MIN: 740 case SYS_IN_MIN:
728 res = IN_FROM_REG(data->in_min[ix], ix, 8); 741 res = IN_FROM_REG(data->in_min[ix], ix, 8, data->type);
729 break; 742 break;
730 case SYS_IN_MAX: 743 case SYS_IN_MAX:
731 res = IN_FROM_REG(data->in_max[ix], ix, 8); 744 res = IN_FROM_REG(data->in_max[ix], ix, 8, data->type);
732 break; 745 break;
733 case SYS_IN_ALARM: 746 case SYS_IN_ALARM:
734 res = (data->alarms >> DME1737_BIT_ALARM_IN[ix]) & 0x01; 747 res = (data->alarms >> DME1737_BIT_ALARM_IN[ix]) & 0x01;
@@ -755,12 +768,12 @@ static ssize_t set_in(struct device *dev, struct device_attribute *attr,
755 mutex_lock(&data->update_lock); 768 mutex_lock(&data->update_lock);
756 switch (fn) { 769 switch (fn) {
757 case SYS_IN_MIN: 770 case SYS_IN_MIN:
758 data->in_min[ix] = IN_TO_REG(val, ix); 771 data->in_min[ix] = IN_TO_REG(val, ix, data->type);
759 dme1737_write(client, DME1737_REG_IN_MIN(ix), 772 dme1737_write(client, DME1737_REG_IN_MIN(ix),
760 data->in_min[ix]); 773 data->in_min[ix]);
761 break; 774 break;
762 case SYS_IN_MAX: 775 case SYS_IN_MAX:
763 data->in_max[ix] = IN_TO_REG(val, ix); 776 data->in_max[ix] = IN_TO_REG(val, ix, data->type);
764 dme1737_write(client, DME1737_REG_IN_MAX(ix), 777 dme1737_write(client, DME1737_REG_IN_MAX(ix),
765 data->in_max[ix]); 778 data->in_max[ix]);
766 break; 779 break;
@@ -1501,9 +1514,9 @@ SENSOR_DEVICE_ATTR_PWM_1TO3(3);
1501/* PWMs 5-6 */ 1514/* PWMs 5-6 */
1502 1515
1503#define SENSOR_DEVICE_ATTR_PWM_5TO6(ix) \ 1516#define SENSOR_DEVICE_ATTR_PWM_5TO6(ix) \
1504static SENSOR_DEVICE_ATTR_2(pwm##ix, S_IRUGO | S_IWUSR, \ 1517static SENSOR_DEVICE_ATTR_2(pwm##ix, S_IRUGO, \
1505 show_pwm, set_pwm, SYS_PWM, ix-1); \ 1518 show_pwm, set_pwm, SYS_PWM, ix-1); \
1506static SENSOR_DEVICE_ATTR_2(pwm##ix##_freq, S_IRUGO | S_IWUSR, \ 1519static SENSOR_DEVICE_ATTR_2(pwm##ix##_freq, S_IRUGO, \
1507 show_pwm, set_pwm, SYS_PWM_FREQ, ix-1); \ 1520 show_pwm, set_pwm, SYS_PWM_FREQ, ix-1); \
1508static SENSOR_DEVICE_ATTR_2(pwm##ix##_enable, S_IRUGO, \ 1521static SENSOR_DEVICE_ATTR_2(pwm##ix##_enable, S_IRUGO, \
1509 show_pwm, NULL, SYS_PWM_ENABLE, ix-1) 1522 show_pwm, NULL, SYS_PWM_ENABLE, ix-1)
@@ -1517,91 +1530,75 @@ static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm);
1517static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); 1530static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
1518static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); /* for ISA devices */ 1531static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); /* for ISA devices */
1519 1532
1520#define SENSOR_DEV_ATTR_IN(ix) \
1521&sensor_dev_attr_in##ix##_input.dev_attr.attr, \
1522&sensor_dev_attr_in##ix##_min.dev_attr.attr, \
1523&sensor_dev_attr_in##ix##_max.dev_attr.attr, \
1524&sensor_dev_attr_in##ix##_alarm.dev_attr.attr
1525
1526/* These attributes are read-writeable only if the chip is *not* locked */
1527#define SENSOR_DEV_ATTR_TEMP_LOCK(ix) \
1528&sensor_dev_attr_temp##ix##_offset.dev_attr.attr
1529
1530#define SENSOR_DEV_ATTR_TEMP(ix) \
1531SENSOR_DEV_ATTR_TEMP_LOCK(ix), \
1532&sensor_dev_attr_temp##ix##_input.dev_attr.attr, \
1533&sensor_dev_attr_temp##ix##_min.dev_attr.attr, \
1534&sensor_dev_attr_temp##ix##_max.dev_attr.attr, \
1535&sensor_dev_attr_temp##ix##_alarm.dev_attr.attr, \
1536&sensor_dev_attr_temp##ix##_fault.dev_attr.attr
1537
1538/* These attributes are read-writeable only if the chip is *not* locked */
1539#define SENSOR_DEV_ATTR_ZONE_LOCK(ix) \
1540&sensor_dev_attr_zone##ix##_auto_point1_temp_hyst.dev_attr.attr, \
1541&sensor_dev_attr_zone##ix##_auto_point1_temp.dev_attr.attr, \
1542&sensor_dev_attr_zone##ix##_auto_point2_temp.dev_attr.attr, \
1543&sensor_dev_attr_zone##ix##_auto_point3_temp.dev_attr.attr
1544
1545#define SENSOR_DEV_ATTR_ZONE(ix) \
1546SENSOR_DEV_ATTR_ZONE_LOCK(ix), \
1547&sensor_dev_attr_zone##ix##_auto_channels_temp.dev_attr.attr
1548
1549#define SENSOR_DEV_ATTR_FAN_1TO4(ix) \
1550&sensor_dev_attr_fan##ix##_input.dev_attr.attr, \
1551&sensor_dev_attr_fan##ix##_min.dev_attr.attr, \
1552&sensor_dev_attr_fan##ix##_alarm.dev_attr.attr, \
1553&sensor_dev_attr_fan##ix##_type.dev_attr.attr
1554
1555#define SENSOR_DEV_ATTR_FAN_5TO6(ix) \
1556&sensor_dev_attr_fan##ix##_input.dev_attr.attr, \
1557&sensor_dev_attr_fan##ix##_min.dev_attr.attr, \
1558&sensor_dev_attr_fan##ix##_alarm.dev_attr.attr, \
1559&sensor_dev_attr_fan##ix##_max.dev_attr.attr
1560
1561/* These attributes are read-writeable only if the chip is *not* locked */
1562#define SENSOR_DEV_ATTR_PWM_1TO3_LOCK(ix) \
1563&sensor_dev_attr_pwm##ix##_freq.dev_attr.attr, \
1564&sensor_dev_attr_pwm##ix##_enable.dev_attr.attr, \
1565&sensor_dev_attr_pwm##ix##_ramp_rate.dev_attr.attr, \
1566&sensor_dev_attr_pwm##ix##_auto_channels_zone.dev_attr.attr, \
1567&sensor_dev_attr_pwm##ix##_auto_pwm_min.dev_attr.attr, \
1568&sensor_dev_attr_pwm##ix##_auto_point1_pwm.dev_attr.attr
1569
1570#define SENSOR_DEV_ATTR_PWM_1TO3(ix) \
1571SENSOR_DEV_ATTR_PWM_1TO3_LOCK(ix), \
1572&sensor_dev_attr_pwm##ix.dev_attr.attr, \
1573&sensor_dev_attr_pwm##ix##_auto_point2_pwm.dev_attr.attr
1574
1575/* These attributes are read-writeable only if the chip is *not* locked */
1576#define SENSOR_DEV_ATTR_PWM_5TO6_LOCK(ix) \
1577&sensor_dev_attr_pwm##ix.dev_attr.attr, \
1578&sensor_dev_attr_pwm##ix##_freq.dev_attr.attr
1579
1580#define SENSOR_DEV_ATTR_PWM_5TO6(ix) \
1581SENSOR_DEV_ATTR_PWM_5TO6_LOCK(ix), \
1582&sensor_dev_attr_pwm##ix##_enable.dev_attr.attr
1583
1584/* This struct holds all the attributes that are always present and need to be 1533/* This struct holds all the attributes that are always present and need to be
1585 * created unconditionally. The attributes that need modification of their 1534 * created unconditionally. The attributes that need modification of their
1586 * permissions are created read-only and write permissions are added or removed 1535 * permissions are created read-only and write permissions are added or removed
1587 * on the fly when required */ 1536 * on the fly when required */
1588static struct attribute *dme1737_attr[] ={ 1537static struct attribute *dme1737_attr[] ={
1589 /* Voltages */ 1538 /* Voltages */
1590 SENSOR_DEV_ATTR_IN(0), 1539 &sensor_dev_attr_in0_input.dev_attr.attr,
1591 SENSOR_DEV_ATTR_IN(1), 1540 &sensor_dev_attr_in0_min.dev_attr.attr,
1592 SENSOR_DEV_ATTR_IN(2), 1541 &sensor_dev_attr_in0_max.dev_attr.attr,
1593 SENSOR_DEV_ATTR_IN(3), 1542 &sensor_dev_attr_in0_alarm.dev_attr.attr,
1594 SENSOR_DEV_ATTR_IN(4), 1543 &sensor_dev_attr_in1_input.dev_attr.attr,
1595 SENSOR_DEV_ATTR_IN(5), 1544 &sensor_dev_attr_in1_min.dev_attr.attr,
1596 SENSOR_DEV_ATTR_IN(6), 1545 &sensor_dev_attr_in1_max.dev_attr.attr,
1546 &sensor_dev_attr_in1_alarm.dev_attr.attr,
1547 &sensor_dev_attr_in2_input.dev_attr.attr,
1548 &sensor_dev_attr_in2_min.dev_attr.attr,
1549 &sensor_dev_attr_in2_max.dev_attr.attr,
1550 &sensor_dev_attr_in2_alarm.dev_attr.attr,
1551 &sensor_dev_attr_in3_input.dev_attr.attr,
1552 &sensor_dev_attr_in3_min.dev_attr.attr,
1553 &sensor_dev_attr_in3_max.dev_attr.attr,
1554 &sensor_dev_attr_in3_alarm.dev_attr.attr,
1555 &sensor_dev_attr_in4_input.dev_attr.attr,
1556 &sensor_dev_attr_in4_min.dev_attr.attr,
1557 &sensor_dev_attr_in4_max.dev_attr.attr,
1558 &sensor_dev_attr_in4_alarm.dev_attr.attr,
1559 &sensor_dev_attr_in5_input.dev_attr.attr,
1560 &sensor_dev_attr_in5_min.dev_attr.attr,
1561 &sensor_dev_attr_in5_max.dev_attr.attr,
1562 &sensor_dev_attr_in5_alarm.dev_attr.attr,
1563 &sensor_dev_attr_in6_input.dev_attr.attr,
1564 &sensor_dev_attr_in6_min.dev_attr.attr,
1565 &sensor_dev_attr_in6_max.dev_attr.attr,
1566 &sensor_dev_attr_in6_alarm.dev_attr.attr,
1597 /* Temperatures */ 1567 /* Temperatures */
1598 SENSOR_DEV_ATTR_TEMP(1), 1568 &sensor_dev_attr_temp1_input.dev_attr.attr,
1599 SENSOR_DEV_ATTR_TEMP(2), 1569 &sensor_dev_attr_temp1_min.dev_attr.attr,
1600 SENSOR_DEV_ATTR_TEMP(3), 1570 &sensor_dev_attr_temp1_max.dev_attr.attr,
1571 &sensor_dev_attr_temp1_alarm.dev_attr.attr,
1572 &sensor_dev_attr_temp1_fault.dev_attr.attr,
1573 &sensor_dev_attr_temp1_offset.dev_attr.attr,
1574 &sensor_dev_attr_temp2_input.dev_attr.attr,
1575 &sensor_dev_attr_temp2_min.dev_attr.attr,
1576 &sensor_dev_attr_temp2_max.dev_attr.attr,
1577 &sensor_dev_attr_temp2_alarm.dev_attr.attr,
1578 &sensor_dev_attr_temp2_fault.dev_attr.attr,
1579 &sensor_dev_attr_temp2_offset.dev_attr.attr,
1580 &sensor_dev_attr_temp3_input.dev_attr.attr,
1581 &sensor_dev_attr_temp3_min.dev_attr.attr,
1582 &sensor_dev_attr_temp3_max.dev_attr.attr,
1583 &sensor_dev_attr_temp3_alarm.dev_attr.attr,
1584 &sensor_dev_attr_temp3_fault.dev_attr.attr,
1585 &sensor_dev_attr_temp3_offset.dev_attr.attr,
1601 /* Zones */ 1586 /* Zones */
1602 SENSOR_DEV_ATTR_ZONE(1), 1587 &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr,
1603 SENSOR_DEV_ATTR_ZONE(2), 1588 &sensor_dev_attr_zone1_auto_point1_temp.dev_attr.attr,
1604 SENSOR_DEV_ATTR_ZONE(3), 1589 &sensor_dev_attr_zone1_auto_point2_temp.dev_attr.attr,
1590 &sensor_dev_attr_zone1_auto_point3_temp.dev_attr.attr,
1591 &sensor_dev_attr_zone1_auto_channels_temp.dev_attr.attr,
1592 &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr,
1593 &sensor_dev_attr_zone2_auto_point1_temp.dev_attr.attr,
1594 &sensor_dev_attr_zone2_auto_point2_temp.dev_attr.attr,
1595 &sensor_dev_attr_zone2_auto_point3_temp.dev_attr.attr,
1596 &sensor_dev_attr_zone2_auto_channels_temp.dev_attr.attr,
1597 &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr,
1598 &sensor_dev_attr_zone3_auto_point1_temp.dev_attr.attr,
1599 &sensor_dev_attr_zone3_auto_point2_temp.dev_attr.attr,
1600 &sensor_dev_attr_zone3_auto_point3_temp.dev_attr.attr,
1601 &sensor_dev_attr_zone3_auto_channels_temp.dev_attr.attr,
1605 /* Misc */ 1602 /* Misc */
1606 &dev_attr_vrm.attr, 1603 &dev_attr_vrm.attr,
1607 &dev_attr_cpu0_vid.attr, 1604 &dev_attr_cpu0_vid.attr,
@@ -1616,23 +1613,48 @@ static const struct attribute_group dme1737_group = {
1616 * Their creation depends on the chip configuration which is determined during 1613 * Their creation depends on the chip configuration which is determined during
1617 * module load. */ 1614 * module load. */
1618static struct attribute *dme1737_attr_pwm1[] = { 1615static struct attribute *dme1737_attr_pwm1[] = {
1619 SENSOR_DEV_ATTR_PWM_1TO3(1), 1616 &sensor_dev_attr_pwm1.dev_attr.attr,
1617 &sensor_dev_attr_pwm1_freq.dev_attr.attr,
1618 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
1619 &sensor_dev_attr_pwm1_ramp_rate.dev_attr.attr,
1620 &sensor_dev_attr_pwm1_auto_channels_zone.dev_attr.attr,
1621 &sensor_dev_attr_pwm1_auto_pwm_min.dev_attr.attr,
1622 &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr,
1623 &sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr,
1620 NULL 1624 NULL
1621}; 1625};
1622static struct attribute *dme1737_attr_pwm2[] = { 1626static struct attribute *dme1737_attr_pwm2[] = {
1623 SENSOR_DEV_ATTR_PWM_1TO3(2), 1627 &sensor_dev_attr_pwm2.dev_attr.attr,
1628 &sensor_dev_attr_pwm2_freq.dev_attr.attr,
1629 &sensor_dev_attr_pwm2_enable.dev_attr.attr,
1630 &sensor_dev_attr_pwm2_ramp_rate.dev_attr.attr,
1631 &sensor_dev_attr_pwm2_auto_channels_zone.dev_attr.attr,
1632 &sensor_dev_attr_pwm2_auto_pwm_min.dev_attr.attr,
1633 &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr,
1634 &sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr,
1624 NULL 1635 NULL
1625}; 1636};
1626static struct attribute *dme1737_attr_pwm3[] = { 1637static struct attribute *dme1737_attr_pwm3[] = {
1627 SENSOR_DEV_ATTR_PWM_1TO3(3), 1638 &sensor_dev_attr_pwm3.dev_attr.attr,
1639 &sensor_dev_attr_pwm3_freq.dev_attr.attr,
1640 &sensor_dev_attr_pwm3_enable.dev_attr.attr,
1641 &sensor_dev_attr_pwm3_ramp_rate.dev_attr.attr,
1642 &sensor_dev_attr_pwm3_auto_channels_zone.dev_attr.attr,
1643 &sensor_dev_attr_pwm3_auto_pwm_min.dev_attr.attr,
1644 &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr,
1645 &sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr,
1628 NULL 1646 NULL
1629}; 1647};
1630static struct attribute *dme1737_attr_pwm5[] = { 1648static struct attribute *dme1737_attr_pwm5[] = {
1631 SENSOR_DEV_ATTR_PWM_5TO6(5), 1649 &sensor_dev_attr_pwm5.dev_attr.attr,
1650 &sensor_dev_attr_pwm5_freq.dev_attr.attr,
1651 &sensor_dev_attr_pwm5_enable.dev_attr.attr,
1632 NULL 1652 NULL
1633}; 1653};
1634static struct attribute *dme1737_attr_pwm6[] = { 1654static struct attribute *dme1737_attr_pwm6[] = {
1635 SENSOR_DEV_ATTR_PWM_5TO6(6), 1655 &sensor_dev_attr_pwm6.dev_attr.attr,
1656 &sensor_dev_attr_pwm6_freq.dev_attr.attr,
1657 &sensor_dev_attr_pwm6_enable.dev_attr.attr,
1636 NULL 1658 NULL
1637}; 1659};
1638 1660
@@ -1649,27 +1671,45 @@ static const struct attribute_group dme1737_pwm_group[] = {
1649 * Their creation depends on the chip configuration which is determined during 1671 * Their creation depends on the chip configuration which is determined during
1650 * module load. */ 1672 * module load. */
1651static struct attribute *dme1737_attr_fan1[] = { 1673static struct attribute *dme1737_attr_fan1[] = {
1652 SENSOR_DEV_ATTR_FAN_1TO4(1), 1674 &sensor_dev_attr_fan1_input.dev_attr.attr,
1675 &sensor_dev_attr_fan1_min.dev_attr.attr,
1676 &sensor_dev_attr_fan1_alarm.dev_attr.attr,
1677 &sensor_dev_attr_fan1_type.dev_attr.attr,
1653 NULL 1678 NULL
1654}; 1679};
1655static struct attribute *dme1737_attr_fan2[] = { 1680static struct attribute *dme1737_attr_fan2[] = {
1656 SENSOR_DEV_ATTR_FAN_1TO4(2), 1681 &sensor_dev_attr_fan2_input.dev_attr.attr,
1682 &sensor_dev_attr_fan2_min.dev_attr.attr,
1683 &sensor_dev_attr_fan2_alarm.dev_attr.attr,
1684 &sensor_dev_attr_fan2_type.dev_attr.attr,
1657 NULL 1685 NULL
1658}; 1686};
1659static struct attribute *dme1737_attr_fan3[] = { 1687static struct attribute *dme1737_attr_fan3[] = {
1660 SENSOR_DEV_ATTR_FAN_1TO4(3), 1688 &sensor_dev_attr_fan3_input.dev_attr.attr,
1689 &sensor_dev_attr_fan3_min.dev_attr.attr,
1690 &sensor_dev_attr_fan3_alarm.dev_attr.attr,
1691 &sensor_dev_attr_fan3_type.dev_attr.attr,
1661 NULL 1692 NULL
1662}; 1693};
1663static struct attribute *dme1737_attr_fan4[] = { 1694static struct attribute *dme1737_attr_fan4[] = {
1664 SENSOR_DEV_ATTR_FAN_1TO4(4), 1695 &sensor_dev_attr_fan4_input.dev_attr.attr,
1696 &sensor_dev_attr_fan4_min.dev_attr.attr,
1697 &sensor_dev_attr_fan4_alarm.dev_attr.attr,
1698 &sensor_dev_attr_fan4_type.dev_attr.attr,
1665 NULL 1699 NULL
1666}; 1700};
1667static struct attribute *dme1737_attr_fan5[] = { 1701static struct attribute *dme1737_attr_fan5[] = {
1668 SENSOR_DEV_ATTR_FAN_5TO6(5), 1702 &sensor_dev_attr_fan5_input.dev_attr.attr,
1703 &sensor_dev_attr_fan5_min.dev_attr.attr,
1704 &sensor_dev_attr_fan5_alarm.dev_attr.attr,
1705 &sensor_dev_attr_fan5_max.dev_attr.attr,
1669 NULL 1706 NULL
1670}; 1707};
1671static struct attribute *dme1737_attr_fan6[] = { 1708static struct attribute *dme1737_attr_fan6[] = {
1672 SENSOR_DEV_ATTR_FAN_5TO6(6), 1709 &sensor_dev_attr_fan6_input.dev_attr.attr,
1710 &sensor_dev_attr_fan6_min.dev_attr.attr,
1711 &sensor_dev_attr_fan6_alarm.dev_attr.attr,
1712 &sensor_dev_attr_fan6_max.dev_attr.attr,
1673 NULL 1713 NULL
1674}; 1714};
1675 1715
@@ -1686,13 +1726,22 @@ static const struct attribute_group dme1737_fan_group[] = {
1686 * writeable if the chip is *not* locked. Otherwise they stay read-only. */ 1726 * writeable if the chip is *not* locked. Otherwise they stay read-only. */
1687static struct attribute *dme1737_attr_lock[] = { 1727static struct attribute *dme1737_attr_lock[] = {
1688 /* Temperatures */ 1728 /* Temperatures */
1689 SENSOR_DEV_ATTR_TEMP_LOCK(1), 1729 &sensor_dev_attr_temp1_offset.dev_attr.attr,
1690 SENSOR_DEV_ATTR_TEMP_LOCK(2), 1730 &sensor_dev_attr_temp2_offset.dev_attr.attr,
1691 SENSOR_DEV_ATTR_TEMP_LOCK(3), 1731 &sensor_dev_attr_temp3_offset.dev_attr.attr,
1692 /* Zones */ 1732 /* Zones */
1693 SENSOR_DEV_ATTR_ZONE_LOCK(1), 1733 &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr,
1694 SENSOR_DEV_ATTR_ZONE_LOCK(2), 1734 &sensor_dev_attr_zone1_auto_point1_temp.dev_attr.attr,
1695 SENSOR_DEV_ATTR_ZONE_LOCK(3), 1735 &sensor_dev_attr_zone1_auto_point2_temp.dev_attr.attr,
1736 &sensor_dev_attr_zone1_auto_point3_temp.dev_attr.attr,
1737 &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr,
1738 &sensor_dev_attr_zone2_auto_point1_temp.dev_attr.attr,
1739 &sensor_dev_attr_zone2_auto_point2_temp.dev_attr.attr,
1740 &sensor_dev_attr_zone2_auto_point3_temp.dev_attr.attr,
1741 &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr,
1742 &sensor_dev_attr_zone3_auto_point1_temp.dev_attr.attr,
1743 &sensor_dev_attr_zone3_auto_point2_temp.dev_attr.attr,
1744 &sensor_dev_attr_zone3_auto_point3_temp.dev_attr.attr,
1696 NULL 1745 NULL
1697}; 1746};
1698 1747
@@ -1704,23 +1753,40 @@ static const struct attribute_group dme1737_lock_group = {
1704 * writeable if the chip is *not* locked and the respective PWM is available. 1753 * writeable if the chip is *not* locked and the respective PWM is available.
1705 * Otherwise they stay read-only. */ 1754 * Otherwise they stay read-only. */
1706static struct attribute *dme1737_attr_pwm1_lock[] = { 1755static struct attribute *dme1737_attr_pwm1_lock[] = {
1707 SENSOR_DEV_ATTR_PWM_1TO3_LOCK(1), 1756 &sensor_dev_attr_pwm1_freq.dev_attr.attr,
1757 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
1758 &sensor_dev_attr_pwm1_ramp_rate.dev_attr.attr,
1759 &sensor_dev_attr_pwm1_auto_channels_zone.dev_attr.attr,
1760 &sensor_dev_attr_pwm1_auto_pwm_min.dev_attr.attr,
1761 &sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr,
1708 NULL 1762 NULL
1709}; 1763};
1710static struct attribute *dme1737_attr_pwm2_lock[] = { 1764static struct attribute *dme1737_attr_pwm2_lock[] = {
1711 SENSOR_DEV_ATTR_PWM_1TO3_LOCK(2), 1765 &sensor_dev_attr_pwm2_freq.dev_attr.attr,
1766 &sensor_dev_attr_pwm2_enable.dev_attr.attr,
1767 &sensor_dev_attr_pwm2_ramp_rate.dev_attr.attr,
1768 &sensor_dev_attr_pwm2_auto_channels_zone.dev_attr.attr,
1769 &sensor_dev_attr_pwm2_auto_pwm_min.dev_attr.attr,
1770 &sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr,
1712 NULL 1771 NULL
1713}; 1772};
1714static struct attribute *dme1737_attr_pwm3_lock[] = { 1773static struct attribute *dme1737_attr_pwm3_lock[] = {
1715 SENSOR_DEV_ATTR_PWM_1TO3_LOCK(3), 1774 &sensor_dev_attr_pwm3_freq.dev_attr.attr,
1775 &sensor_dev_attr_pwm3_enable.dev_attr.attr,
1776 &sensor_dev_attr_pwm3_ramp_rate.dev_attr.attr,
1777 &sensor_dev_attr_pwm3_auto_channels_zone.dev_attr.attr,
1778 &sensor_dev_attr_pwm3_auto_pwm_min.dev_attr.attr,
1779 &sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr,
1716 NULL 1780 NULL
1717}; 1781};
1718static struct attribute *dme1737_attr_pwm5_lock[] = { 1782static struct attribute *dme1737_attr_pwm5_lock[] = {
1719 SENSOR_DEV_ATTR_PWM_5TO6_LOCK(5), 1783 &sensor_dev_attr_pwm5.dev_attr.attr,
1784 &sensor_dev_attr_pwm5_freq.dev_attr.attr,
1720 NULL 1785 NULL
1721}; 1786};
1722static struct attribute *dme1737_attr_pwm6_lock[] = { 1787static struct attribute *dme1737_attr_pwm6_lock[] = {
1723 SENSOR_DEV_ATTR_PWM_5TO6_LOCK(6), 1788 &sensor_dev_attr_pwm6.dev_attr.attr,
1789 &sensor_dev_attr_pwm6_freq.dev_attr.attr,
1724 NULL 1790 NULL
1725}; 1791};
1726 1792
@@ -2109,6 +2175,7 @@ static int dme1737_i2c_detect(struct i2c_adapter *adapter, int address,
2109 2175
2110 kind = dme1737; 2176 kind = dme1737;
2111 name = "dme1737"; 2177 name = "dme1737";
2178 data->type = kind;
2112 2179
2113 /* Fill in the remaining client fields and put it into the global 2180 /* Fill in the remaining client fields and put it into the global
2114 * list */ 2181 * list */
@@ -2301,6 +2368,7 @@ static int __devinit dme1737_isa_probe(struct platform_device *pdev)
2301 err = -ENODEV; 2368 err = -ENODEV;
2302 goto exit_kfree; 2369 goto exit_kfree;
2303 } 2370 }
2371 data->type = -1;
2304 2372
2305 /* Fill in the remaining client fields and initialize the mutex */ 2373 /* Fill in the remaining client fields and initialize the mutex */
2306 strlcpy(client->name, "sch311x", I2C_NAME_SIZE); 2374 strlcpy(client->name, "sch311x", I2C_NAME_SIZE);
@@ -2377,7 +2445,10 @@ static int __init dme1737_init(void)
2377 } 2445 }
2378 2446
2379 if (dme1737_isa_detect(0x2e, &addr) && 2447 if (dme1737_isa_detect(0x2e, &addr) &&
2380 dme1737_isa_detect(0x4e, &addr)) { 2448 dme1737_isa_detect(0x4e, &addr) &&
2449 (!probe_all_addr ||
2450 (dme1737_isa_detect(0x162e, &addr) &&
2451 dme1737_isa_detect(0x164e, &addr)))) {
2381 /* Return 0 if we didn't find an ISA device */ 2452 /* Return 0 if we didn't find an ISA device */
2382 return 0; 2453 return 0;
2383 } 2454 }
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index de698dc73020..7880c273c2c5 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -30,14 +30,37 @@
30#include "lm75.h" 30#include "lm75.h"
31 31
32 32
33/* Addresses to scan */ 33/*
34 * This driver handles the LM75 and compatible digital temperature sensors.
35 * Only types which are _not_ listed in I2C_CLIENT_INSMOD_*() need to be
36 * listed here. We start at 9 since I2C_CLIENT_INSMOD_*() currently allow
37 * definition of up to 8 chip types (plus zero).
38 */
39
40enum lm75_type { /* keep sorted in alphabetical order */
41 ds1775 = 9,
42 ds75,
43 /* lm75 -- in I2C_CLIENT_INSMOD_1() */
44 lm75a,
45 max6625,
46 max6626,
47 mcp980x,
48 stds75,
49 tcn75,
50 tmp100,
51 tmp101,
52 tmp175,
53 tmp275,
54 tmp75,
55};
56
57/* Addresses scanned by legacy style driver binding */
34static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, 58static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
35 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; 59 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
36 60
37/* Insmod parameters */ 61/* Insmod parameters (only for legacy style driver binding) */
38I2C_CLIENT_INSMOD_1(lm75); 62I2C_CLIENT_INSMOD_1(lm75);
39 63
40/* Many LM75 constants specified below */
41 64
42/* The LM75 registers */ 65/* The LM75 registers */
43#define LM75_REG_CONF 0x01 66#define LM75_REG_CONF 0x01
@@ -49,10 +72,11 @@ static const u8 LM75_REG_TEMP[3] = {
49 72
50/* Each client has this additional data */ 73/* Each client has this additional data */
51struct lm75_data { 74struct lm75_data {
52 struct i2c_client client; 75 struct i2c_client *client;
53 struct device *hwmon_dev; 76 struct device *hwmon_dev;
54 struct mutex update_lock; 77 struct mutex update_lock;
55 char valid; /* !=0 if following fields are valid */ 78 u8 orig_conf;
79 char valid; /* !=0 if registers are valid */
56 unsigned long last_updated; /* In jiffies */ 80 unsigned long last_updated; /* In jiffies */
57 u16 temp[3]; /* Register values, 81 u16 temp[3]; /* Register values,
58 0 = input 82 0 = input
@@ -60,23 +84,14 @@ struct lm75_data {
60 2 = hyst */ 84 2 = hyst */
61}; 85};
62 86
63static int lm75_attach_adapter(struct i2c_adapter *adapter);
64static int lm75_detect(struct i2c_adapter *adapter, int address, int kind);
65static void lm75_init_client(struct i2c_client *client);
66static int lm75_detach_client(struct i2c_client *client);
67static int lm75_read_value(struct i2c_client *client, u8 reg); 87static int lm75_read_value(struct i2c_client *client, u8 reg);
68static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value); 88static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value);
69static struct lm75_data *lm75_update_device(struct device *dev); 89static struct lm75_data *lm75_update_device(struct device *dev);
70 90
71 91
72/* This is the driver that will be inserted */ 92/*-----------------------------------------------------------------------*/
73static struct i2c_driver lm75_driver = { 93
74 .driver = { 94/* sysfs attributes for hwmon */
75 .name = "lm75",
76 },
77 .attach_adapter = lm75_attach_adapter,
78 .detach_client = lm75_detach_client,
79};
80 95
81static ssize_t show_temp(struct device *dev, struct device_attribute *da, 96static ssize_t show_temp(struct device *dev, struct device_attribute *da,
82 char *buf) 97 char *buf)
@@ -109,13 +124,6 @@ static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO,
109 show_temp, set_temp, 2); 124 show_temp, set_temp, 2);
110static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); 125static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
111 126
112static int lm75_attach_adapter(struct i2c_adapter *adapter)
113{
114 if (!(adapter->class & I2C_CLASS_HWMON))
115 return 0;
116 return i2c_probe(adapter, &addr_data, lm75_detect);
117}
118
119static struct attribute *lm75_attributes[] = { 127static struct attribute *lm75_attributes[] = {
120 &sensor_dev_attr_temp1_input.dev_attr.attr, 128 &sensor_dev_attr_temp1_input.dev_attr.attr,
121 &sensor_dev_attr_temp1_max.dev_attr.attr, 129 &sensor_dev_attr_temp1_max.dev_attr.attr,
@@ -128,32 +136,144 @@ static const struct attribute_group lm75_group = {
128 .attrs = lm75_attributes, 136 .attrs = lm75_attributes,
129}; 137};
130 138
139/*-----------------------------------------------------------------------*/
140
141/* "New style" I2C driver binding -- following the driver model */
142
143static int
144lm75_probe(struct i2c_client *client, const struct i2c_device_id *id)
145{
146 struct lm75_data *data;
147 int status;
148 u8 set_mask, clr_mask;
149 int new;
150
151 if (!i2c_check_functionality(client->adapter,
152 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA))
153 return -EIO;
154
155 data = kzalloc(sizeof(struct lm75_data), GFP_KERNEL);
156 if (!data)
157 return -ENOMEM;
158
159 i2c_set_clientdata(client, data);
160
161 data->client = client;
162 mutex_init(&data->update_lock);
163
164 /* Set to LM75 resolution (9 bits, 1/2 degree C) and range.
165 * Then tweak to be more precise when appropriate.
166 */
167 set_mask = 0;
168 clr_mask = (1 << 0) /* continuous conversions */
169 | (1 << 6) | (1 << 5); /* 9-bit mode */
170
171 /* configure as specified */
172 status = lm75_read_value(client, LM75_REG_CONF);
173 if (status < 0) {
174 dev_dbg(&client->dev, "Can't read config? %d\n", status);
175 goto exit_free;
176 }
177 data->orig_conf = status;
178 new = status & ~clr_mask;
179 new |= set_mask;
180 if (status != new)
181 lm75_write_value(client, LM75_REG_CONF, new);
182 dev_dbg(&client->dev, "Config %02x\n", new);
183
184 /* Register sysfs hooks */
185 status = sysfs_create_group(&client->dev.kobj, &lm75_group);
186 if (status)
187 goto exit_free;
188
189 data->hwmon_dev = hwmon_device_register(&client->dev);
190 if (IS_ERR(data->hwmon_dev)) {
191 status = PTR_ERR(data->hwmon_dev);
192 goto exit_remove;
193 }
194
195 dev_info(&client->dev, "%s: sensor '%s'\n",
196 data->hwmon_dev->bus_id, client->name);
197
198 return 0;
199
200exit_remove:
201 sysfs_remove_group(&client->dev.kobj, &lm75_group);
202exit_free:
203 i2c_set_clientdata(client, NULL);
204 kfree(data);
205 return status;
206}
207
208static int lm75_remove(struct i2c_client *client)
209{
210 struct lm75_data *data = i2c_get_clientdata(client);
211
212 hwmon_device_unregister(data->hwmon_dev);
213 sysfs_remove_group(&client->dev.kobj, &lm75_group);
214 lm75_write_value(client, LM75_REG_CONF, data->orig_conf);
215 i2c_set_clientdata(client, NULL);
216 kfree(data);
217 return 0;
218}
219
220static const struct i2c_device_id lm75_ids[] = {
221 { "ds1775", ds1775, },
222 { "ds75", ds75, },
223 { "lm75", lm75, },
224 { "lm75a", lm75a, },
225 { "max6625", max6625, },
226 { "max6626", max6626, },
227 { "mcp980x", mcp980x, },
228 { "stds75", stds75, },
229 { "tcn75", tcn75, },
230 { "tmp100", tmp100, },
231 { "tmp101", tmp101, },
232 { "tmp175", tmp175, },
233 { "tmp275", tmp275, },
234 { "tmp75", tmp75, },
235 { /* LIST END */ }
236};
237MODULE_DEVICE_TABLE(i2c, lm75_ids);
238
239static struct i2c_driver lm75_driver = {
240 .driver = {
241 .name = "lm75",
242 },
243 .probe = lm75_probe,
244 .remove = lm75_remove,
245 .id_table = lm75_ids,
246};
247
248/*-----------------------------------------------------------------------*/
249
250/* "Legacy" I2C driver binding */
251
252static struct i2c_driver lm75_legacy_driver;
253
131/* This function is called by i2c_probe */ 254/* This function is called by i2c_probe */
132static int lm75_detect(struct i2c_adapter *adapter, int address, int kind) 255static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
133{ 256{
134 int i; 257 int i;
135 struct i2c_client *new_client; 258 struct i2c_client *new_client;
136 struct lm75_data *data;
137 int err = 0; 259 int err = 0;
138 const char *name = "";
139 260
140 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | 261 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
141 I2C_FUNC_SMBUS_WORD_DATA)) 262 I2C_FUNC_SMBUS_WORD_DATA))
142 goto exit; 263 goto exit;
143 264
144 /* OK. For now, we presume we have a valid client. We now create the 265 /* OK. For now, we presume we have a valid address. We create the
145 client structure, even though we cannot fill it completely yet. 266 client structure, even though there may be no sensor present.
146 But it allows us to access lm75_{read,write}_value. */ 267 But it allows us to use i2c_smbus_read_*_data() calls. */
147 if (!(data = kzalloc(sizeof(struct lm75_data), GFP_KERNEL))) { 268 new_client = kzalloc(sizeof *new_client, GFP_KERNEL);
269 if (!new_client) {
148 err = -ENOMEM; 270 err = -ENOMEM;
149 goto exit; 271 goto exit;
150 } 272 }
151 273
152 new_client = &data->client;
153 i2c_set_clientdata(new_client, data);
154 new_client->addr = address; 274 new_client->addr = address;
155 new_client->adapter = adapter; 275 new_client->adapter = adapter;
156 new_client->driver = &lm75_driver; 276 new_client->driver = &lm75_legacy_driver;
157 new_client->flags = 0; 277 new_client->flags = 0;
158 278
159 /* Now, we do the remaining detection. There is no identification- 279 /* Now, we do the remaining detection. There is no identification-
@@ -174,17 +294,17 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
174 || i2c_smbus_read_word_data(new_client, 5) != hyst 294 || i2c_smbus_read_word_data(new_client, 5) != hyst
175 || i2c_smbus_read_word_data(new_client, 6) != hyst 295 || i2c_smbus_read_word_data(new_client, 6) != hyst
176 || i2c_smbus_read_word_data(new_client, 7) != hyst) 296 || i2c_smbus_read_word_data(new_client, 7) != hyst)
177 goto exit_free; 297 goto exit_free;
178 os = i2c_smbus_read_word_data(new_client, 3); 298 os = i2c_smbus_read_word_data(new_client, 3);
179 if (i2c_smbus_read_word_data(new_client, 4) != os 299 if (i2c_smbus_read_word_data(new_client, 4) != os
180 || i2c_smbus_read_word_data(new_client, 5) != os 300 || i2c_smbus_read_word_data(new_client, 5) != os
181 || i2c_smbus_read_word_data(new_client, 6) != os 301 || i2c_smbus_read_word_data(new_client, 6) != os
182 || i2c_smbus_read_word_data(new_client, 7) != os) 302 || i2c_smbus_read_word_data(new_client, 7) != os)
183 goto exit_free; 303 goto exit_free;
184 304
185 /* Unused bits */ 305 /* Unused bits */
186 if (conf & 0xe0) 306 if (conf & 0xe0)
187 goto exit_free; 307 goto exit_free;
188 308
189 /* Addresses cycling */ 309 /* Addresses cycling */
190 for (i = 8; i < 0xff; i += 8) 310 for (i = 8; i < 0xff; i += 8)
@@ -194,58 +314,57 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, int kind)
194 goto exit_free; 314 goto exit_free;
195 } 315 }
196 316
197 /* Determine the chip type - only one kind supported! */ 317 /* NOTE: we treat "force=..." and "force_lm75=..." the same.
198 if (kind <= 0) 318 * Only new-style driver binding distinguishes chip types.
199 kind = lm75; 319 */
200 320 strlcpy(new_client->name, "lm75", I2C_NAME_SIZE);
201 if (kind == lm75) {
202 name = "lm75";
203 }
204
205 /* Fill in the remaining client fields and put it into the global list */
206 strlcpy(new_client->name, name, I2C_NAME_SIZE);
207 data->valid = 0;
208 mutex_init(&data->update_lock);
209 321
210 /* Tell the I2C layer a new client has arrived */ 322 /* Tell the I2C layer a new client has arrived */
211 if ((err = i2c_attach_client(new_client))) 323 err = i2c_attach_client(new_client);
324 if (err)
212 goto exit_free; 325 goto exit_free;
213 326
214 /* Initialize the LM75 chip */ 327 err = lm75_probe(new_client, NULL);
215 lm75_init_client(new_client); 328 if (err < 0)
216
217 /* Register sysfs hooks */
218 if ((err = sysfs_create_group(&new_client->dev.kobj, &lm75_group)))
219 goto exit_detach; 329 goto exit_detach;
220 330
221 data->hwmon_dev = hwmon_device_register(&new_client->dev);
222 if (IS_ERR(data->hwmon_dev)) {
223 err = PTR_ERR(data->hwmon_dev);
224 goto exit_remove;
225 }
226
227 return 0; 331 return 0;
228 332
229exit_remove:
230 sysfs_remove_group(&new_client->dev.kobj, &lm75_group);
231exit_detach: 333exit_detach:
232 i2c_detach_client(new_client); 334 i2c_detach_client(new_client);
233exit_free: 335exit_free:
234 kfree(data); 336 kfree(new_client);
235exit: 337exit:
236 return err; 338 return err;
237} 339}
238 340
341static int lm75_attach_adapter(struct i2c_adapter *adapter)
342{
343 if (!(adapter->class & I2C_CLASS_HWMON))
344 return 0;
345 return i2c_probe(adapter, &addr_data, lm75_detect);
346}
347
239static int lm75_detach_client(struct i2c_client *client) 348static int lm75_detach_client(struct i2c_client *client)
240{ 349{
241 struct lm75_data *data = i2c_get_clientdata(client); 350 lm75_remove(client);
242 hwmon_device_unregister(data->hwmon_dev);
243 sysfs_remove_group(&client->dev.kobj, &lm75_group);
244 i2c_detach_client(client); 351 i2c_detach_client(client);
245 kfree(data); 352 kfree(client);
246 return 0; 353 return 0;
247} 354}
248 355
356static struct i2c_driver lm75_legacy_driver = {
357 .driver = {
358 .name = "lm75_legacy",
359 },
360 .attach_adapter = lm75_attach_adapter,
361 .detach_client = lm75_detach_client,
362};
363
364/*-----------------------------------------------------------------------*/
365
366/* register access */
367
249/* All registers are word-sized, except for the configuration register. 368/* All registers are word-sized, except for the configuration register.
250 LM75 uses a high-byte first convention, which is exactly opposite to 369 LM75 uses a high-byte first convention, which is exactly opposite to
251 the SMBus standard. */ 370 the SMBus standard. */
@@ -268,16 +387,6 @@ static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
268 return i2c_smbus_write_word_data(client, reg, swab16(value)); 387 return i2c_smbus_write_word_data(client, reg, swab16(value));
269} 388}
270 389
271static void lm75_init_client(struct i2c_client *client)
272{
273 int reg;
274
275 /* Enable if in shutdown mode */
276 reg = lm75_read_value(client, LM75_REG_CONF);
277 if (reg >= 0 && (reg & 0x01))
278 lm75_write_value(client, LM75_REG_CONF, reg & 0xfe);
279}
280
281static struct lm75_data *lm75_update_device(struct device *dev) 390static struct lm75_data *lm75_update_device(struct device *dev)
282{ 391{
283 struct i2c_client *client = to_i2c_client(dev); 392 struct i2c_client *client = to_i2c_client(dev);
@@ -309,13 +418,28 @@ static struct lm75_data *lm75_update_device(struct device *dev)
309 return data; 418 return data;
310} 419}
311 420
421/*-----------------------------------------------------------------------*/
422
423/* module glue */
424
312static int __init sensors_lm75_init(void) 425static int __init sensors_lm75_init(void)
313{ 426{
314 return i2c_add_driver(&lm75_driver); 427 int status;
428
429 status = i2c_add_driver(&lm75_driver);
430 if (status < 0)
431 return status;
432
433 status = i2c_add_driver(&lm75_legacy_driver);
434 if (status < 0)
435 i2c_del_driver(&lm75_driver);
436
437 return status;
315} 438}
316 439
317static void __exit sensors_lm75_exit(void) 440static void __exit sensors_lm75_exit(void)
318{ 441{
442 i2c_del_driver(&lm75_legacy_driver);
319 i2c_del_driver(&lm75_driver); 443 i2c_del_driver(&lm75_driver);
320} 444}
321 445
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c
index ee5eca1c1921..12d446f54f97 100644
--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -1,7 +1,7 @@
1/* 1/*
2 lm85.c - Part of lm_sensors, Linux kernel modules for hardware 2 lm85.c - Part of lm_sensors, Linux kernel modules for hardware
3 monitoring 3 monitoring
4 Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl> 4 Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
5 Copyright (c) 2002, 2003 Philip Pokorny <ppokorny@penguincomputing.com> 5 Copyright (c) 2002, 2003 Philip Pokorny <ppokorny@penguincomputing.com>
6 Copyright (c) 2003 Margit Schubert-While <margitsw@t-online.de> 6 Copyright (c) 2003 Margit Schubert-While <margitsw@t-online.de>
7 Copyright (c) 2004 Justin Thiessen <jthiessen@penguincomputing.com> 7 Copyright (c) 2004 Justin Thiessen <jthiessen@penguincomputing.com>
@@ -51,24 +51,17 @@ I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102);
51#define LM85_REG_TEMP_MAX(nr) (0x4f + (nr) * 2) 51#define LM85_REG_TEMP_MAX(nr) (0x4f + (nr) * 2)
52 52
53/* Fan speeds are LSB, MSB (2 bytes) */ 53/* Fan speeds are LSB, MSB (2 bytes) */
54#define LM85_REG_FAN(nr) (0x28 + (nr) *2) 54#define LM85_REG_FAN(nr) (0x28 + (nr) * 2)
55#define LM85_REG_FAN_MIN(nr) (0x54 + (nr) *2) 55#define LM85_REG_FAN_MIN(nr) (0x54 + (nr) * 2)
56 56
57#define LM85_REG_PWM(nr) (0x30 + (nr)) 57#define LM85_REG_PWM(nr) (0x30 + (nr))
58 58
59#define ADT7463_REG_OPPOINT(nr) (0x33 + (nr))
60
61#define ADT7463_REG_TMIN_CTL1 0x36
62#define ADT7463_REG_TMIN_CTL2 0x37
63
64#define LM85_REG_DEVICE 0x3d
65#define LM85_REG_COMPANY 0x3e 59#define LM85_REG_COMPANY 0x3e
66#define LM85_REG_VERSTEP 0x3f 60#define LM85_REG_VERSTEP 0x3f
67/* These are the recognized values for the above regs */ 61/* These are the recognized values for the above regs */
68#define LM85_DEVICE_ADX 0x27
69#define LM85_COMPANY_NATIONAL 0x01 62#define LM85_COMPANY_NATIONAL 0x01
70#define LM85_COMPANY_ANALOG_DEV 0x41 63#define LM85_COMPANY_ANALOG_DEV 0x41
71#define LM85_COMPANY_SMSC 0x5c 64#define LM85_COMPANY_SMSC 0x5c
72#define LM85_VERSTEP_VMASK 0xf0 65#define LM85_VERSTEP_VMASK 0xf0
73#define LM85_VERSTEP_GENERIC 0x60 66#define LM85_VERSTEP_GENERIC 0x60
74#define LM85_VERSTEP_LM85C 0x60 67#define LM85_VERSTEP_LM85C 0x60
@@ -91,58 +84,45 @@ I2C_CLIENT_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102);
91#define LM85_REG_AFAN_CONFIG(nr) (0x5c + (nr)) 84#define LM85_REG_AFAN_CONFIG(nr) (0x5c + (nr))
92#define LM85_REG_AFAN_RANGE(nr) (0x5f + (nr)) 85#define LM85_REG_AFAN_RANGE(nr) (0x5f + (nr))
93#define LM85_REG_AFAN_SPIKE1 0x62 86#define LM85_REG_AFAN_SPIKE1 0x62
94#define LM85_REG_AFAN_SPIKE2 0x63
95#define LM85_REG_AFAN_MINPWM(nr) (0x64 + (nr)) 87#define LM85_REG_AFAN_MINPWM(nr) (0x64 + (nr))
96#define LM85_REG_AFAN_LIMIT(nr) (0x67 + (nr)) 88#define LM85_REG_AFAN_LIMIT(nr) (0x67 + (nr))
97#define LM85_REG_AFAN_CRITICAL(nr) (0x6a + (nr)) 89#define LM85_REG_AFAN_CRITICAL(nr) (0x6a + (nr))
98#define LM85_REG_AFAN_HYST1 0x6d 90#define LM85_REG_AFAN_HYST1 0x6d
99#define LM85_REG_AFAN_HYST2 0x6e 91#define LM85_REG_AFAN_HYST2 0x6e
100 92
101#define LM85_REG_TACH_MODE 0x74
102#define LM85_REG_SPINUP_CTL 0x75
103
104#define ADM1027_REG_TEMP_OFFSET(nr) (0x70 + (nr))
105#define ADM1027_REG_CONFIG2 0x73
106#define ADM1027_REG_INTMASK1 0x74
107#define ADM1027_REG_INTMASK2 0x75
108#define ADM1027_REG_EXTEND_ADC1 0x76 93#define ADM1027_REG_EXTEND_ADC1 0x76
109#define ADM1027_REG_EXTEND_ADC2 0x77 94#define ADM1027_REG_EXTEND_ADC2 0x77
110#define ADM1027_REG_CONFIG3 0x78
111#define ADM1027_REG_FAN_PPR 0x7b
112
113#define ADT7463_REG_THERM 0x79
114#define ADT7463_REG_THERM_LIMIT 0x7A
115 95
116#define EMC6D100_REG_ALARM3 0x7d 96#define EMC6D100_REG_ALARM3 0x7d
117/* IN5, IN6 and IN7 */ 97/* IN5, IN6 and IN7 */
118#define EMC6D100_REG_IN(nr) (0x70 + ((nr)-5)) 98#define EMC6D100_REG_IN(nr) (0x70 + ((nr) - 5))
119#define EMC6D100_REG_IN_MIN(nr) (0x73 + ((nr)-5) * 2) 99#define EMC6D100_REG_IN_MIN(nr) (0x73 + ((nr) - 5) * 2)
120#define EMC6D100_REG_IN_MAX(nr) (0x74 + ((nr)-5) * 2) 100#define EMC6D100_REG_IN_MAX(nr) (0x74 + ((nr) - 5) * 2)
121#define EMC6D102_REG_EXTEND_ADC1 0x85 101#define EMC6D102_REG_EXTEND_ADC1 0x85
122#define EMC6D102_REG_EXTEND_ADC2 0x86 102#define EMC6D102_REG_EXTEND_ADC2 0x86
123#define EMC6D102_REG_EXTEND_ADC3 0x87 103#define EMC6D102_REG_EXTEND_ADC3 0x87
124#define EMC6D102_REG_EXTEND_ADC4 0x88 104#define EMC6D102_REG_EXTEND_ADC4 0x88
125 105
126 106
127/* Conversions. Rounding and limit checking is only done on the TO_REG 107/* Conversions. Rounding and limit checking is only done on the TO_REG
128 variants. Note that you should be a bit careful with which arguments 108 variants. Note that you should be a bit careful with which arguments
129 these macros are called: arguments may be evaluated more than once. 109 these macros are called: arguments may be evaluated more than once.
130 */ 110 */
131 111
132/* IN are scaled acording to built-in resistors */ 112/* IN are scaled acording to built-in resistors */
133static int lm85_scaling[] = { /* .001 Volts */ 113static const int lm85_scaling[] = { /* .001 Volts */
134 2500, 2250, 3300, 5000, 12000, 114 2500, 2250, 3300, 5000, 12000,
135 3300, 1500, 1800 /*EMC6D100*/ 115 3300, 1500, 1800 /*EMC6D100*/
136 }; 116};
137#define SCALE(val,from,to) (((val)*(to) + ((from)/2))/(from)) 117#define SCALE(val, from, to) (((val) * (to) + ((from) / 2)) / (from))
138 118
139#define INS_TO_REG(n,val) \ 119#define INS_TO_REG(n, val) \
140 SENSORS_LIMIT(SCALE(val,lm85_scaling[n],192),0,255) 120 SENSORS_LIMIT(SCALE(val, lm85_scaling[n], 192), 0, 255)
141 121
142#define INSEXT_FROM_REG(n,val,ext) \ 122#define INSEXT_FROM_REG(n, val, ext) \
143 SCALE(((val) << 4) + (ext), 192 << 4, lm85_scaling[n]) 123 SCALE(((val) << 4) + (ext), 192 << 4, lm85_scaling[n])
144 124
145#define INS_FROM_REG(n,val) SCALE((val), 192, lm85_scaling[n]) 125#define INS_FROM_REG(n, val) SCALE((val), 192, lm85_scaling[n])
146 126
147/* FAN speed is measured using 90kHz clock */ 127/* FAN speed is measured using 90kHz clock */
148static inline u16 FAN_TO_REG(unsigned long val) 128static inline u16 FAN_TO_REG(unsigned long val)
@@ -151,16 +131,17 @@ static inline u16 FAN_TO_REG(unsigned long val)
151 return 0xffff; 131 return 0xffff;
152 return SENSORS_LIMIT(5400000 / val, 1, 0xfffe); 132 return SENSORS_LIMIT(5400000 / val, 1, 0xfffe);
153} 133}
154#define FAN_FROM_REG(val) ((val)==0?-1:(val)==0xffff?0:5400000/(val)) 134#define FAN_FROM_REG(val) ((val) == 0 ? -1 : (val) == 0xffff ? 0 : \
135 5400000 / (val))
155 136
156/* Temperature is reported in .001 degC increments */ 137/* Temperature is reported in .001 degC increments */
157#define TEMP_TO_REG(val) \ 138#define TEMP_TO_REG(val) \
158 SENSORS_LIMIT(SCALE(val,1000,1),-127,127) 139 SENSORS_LIMIT(SCALE(val, 1000, 1), -127, 127)
159#define TEMPEXT_FROM_REG(val,ext) \ 140#define TEMPEXT_FROM_REG(val, ext) \
160 SCALE(((val) << 4) + (ext), 16, 1000) 141 SCALE(((val) << 4) + (ext), 16, 1000)
161#define TEMP_FROM_REG(val) ((val) * 1000) 142#define TEMP_FROM_REG(val) ((val) * 1000)
162 143
163#define PWM_TO_REG(val) (SENSORS_LIMIT(val,0,255)) 144#define PWM_TO_REG(val) SENSORS_LIMIT(val, 0, 255)
164#define PWM_FROM_REG(val) (val) 145#define PWM_FROM_REG(val) (val)
165 146
166 147
@@ -183,17 +164,17 @@ static inline u16 FAN_TO_REG(unsigned long val)
183 */ 164 */
184 165
185/* These are the zone temperature range encodings in .001 degree C */ 166/* These are the zone temperature range encodings in .001 degree C */
186static int lm85_range_map[] = { 167static const int lm85_range_map[] = {
187 2000, 2500, 3300, 4000, 5000, 6600, 168 2000, 2500, 3300, 4000, 5000, 6600, 8000, 10000,
188 8000, 10000, 13300, 16000, 20000, 26600, 169 13300, 16000, 20000, 26600, 32000, 40000, 53300, 80000
189 32000, 40000, 53300, 80000 170};
190 }; 171
191static int RANGE_TO_REG( int range ) 172static int RANGE_TO_REG(int range)
192{ 173{
193 int i; 174 int i;
194 175
195 if (range >= lm85_range_map[15]) 176 if (range >= lm85_range_map[15])
196 return 15 ; 177 return 15;
197 178
198 /* Find the closest match */ 179 /* Find the closest match */
199 for (i = 14; i >= 0; --i) { 180 for (i = 14; i >= 0; --i) {
@@ -207,28 +188,25 @@ static int RANGE_TO_REG( int range )
207 188
208 return 0; 189 return 0;
209} 190}
210#define RANGE_FROM_REG(val) (lm85_range_map[(val)&0x0f]) 191#define RANGE_FROM_REG(val) lm85_range_map[(val) & 0x0f]
211 192
212/* These are the Acoustic Enhancement, or Temperature smoothing encodings
213 * NOTE: The enable/disable bit is INCLUDED in these encodings as the
214 * MSB (bit 3, value 8). If the enable bit is 0, the encoded value
215 * is ignored, or set to 0.
216 */
217/* These are the PWM frequency encodings */ 193/* These are the PWM frequency encodings */
218static int lm85_freq_map[] = { /* .1 Hz */ 194static const int lm85_freq_map[] = { /* .1 Hz */
219 100, 150, 230, 300, 380, 470, 620, 940 195 100, 150, 230, 300, 380, 470, 620, 940
220 }; 196};
221static int FREQ_TO_REG( int freq ) 197
198static int FREQ_TO_REG(int freq)
222{ 199{
223 int i; 200 int i;
224 201
225 if( freq >= lm85_freq_map[7] ) { return 7 ; } 202 if (freq >= lm85_freq_map[7])
226 for( i = 0 ; i < 7 ; ++i ) 203 return 7;
227 if( freq <= lm85_freq_map[i] ) 204 for (i = 0; i < 7; ++i)
228 break ; 205 if (freq <= lm85_freq_map[i])
229 return( i & 0x07 ); 206 break;
207 return i;
230} 208}
231#define FREQ_FROM_REG(val) (lm85_freq_map[(val)&0x07]) 209#define FREQ_FROM_REG(val) lm85_freq_map[(val) & 0x07]
232 210
233/* Since we can't use strings, I'm abusing these numbers 211/* Since we can't use strings, I'm abusing these numbers
234 * to stand in for the following meanings: 212 * to stand in for the following meanings:
@@ -242,30 +220,23 @@ static int FREQ_TO_REG( int freq )
242 * -2 -- PWM responds to manual control 220 * -2 -- PWM responds to manual control
243 */ 221 */
244 222
245static int lm85_zone_map[] = { 1, 2, 3, -1, 0, 23, 123, -2 }; 223static const int lm85_zone_map[] = { 1, 2, 3, -1, 0, 23, 123, -2 };
246#define ZONE_FROM_REG(val) (lm85_zone_map[((val)>>5)&0x07]) 224#define ZONE_FROM_REG(val) lm85_zone_map[(val) >> 5]
247 225
248static int ZONE_TO_REG( int zone ) 226static int ZONE_TO_REG(int zone)
249{ 227{
250 int i; 228 int i;
251 229
252 for( i = 0 ; i <= 7 ; ++i ) 230 for (i = 0; i <= 7; ++i)
253 if( zone == lm85_zone_map[i] ) 231 if (zone == lm85_zone_map[i])
254 break ; 232 break;
255 if( i > 7 ) /* Not found. */ 233 if (i > 7) /* Not found. */
256 i = 3; /* Always 100% */ 234 i = 3; /* Always 100% */
257 return( (i & 0x07)<<5 ); 235 return i << 5;
258} 236}
259 237
260#define HYST_TO_REG(val) (SENSORS_LIMIT(((val)+500)/1000,0,15)) 238#define HYST_TO_REG(val) SENSORS_LIMIT(((val) + 500) / 1000, 0, 15)
261#define HYST_FROM_REG(val) ((val)*1000) 239#define HYST_FROM_REG(val) ((val) * 1000)
262
263#define OFFSET_TO_REG(val) (SENSORS_LIMIT((val)/25,-127,127))
264#define OFFSET_FROM_REG(val) ((val)*25)
265
266#define PPR_MASK(fan) (0x03<<(fan *2))
267#define PPR_TO_REG(val,fan) (SENSORS_LIMIT((val)-1,0,3)<<(fan *2))
268#define PPR_FROM_REG(val,fan) ((((val)>>(fan * 2))&0x03)+1)
269 240
270/* Chip sampling rates 241/* Chip sampling rates
271 * 242 *
@@ -292,11 +263,11 @@ struct lm85_zone {
292 u8 hyst; /* Low limit hysteresis. (0-15) */ 263 u8 hyst; /* Low limit hysteresis. (0-15) */
293 u8 range; /* Temp range, encoded */ 264 u8 range; /* Temp range, encoded */
294 s8 critical; /* "All fans ON" temp limit */ 265 s8 critical; /* "All fans ON" temp limit */
295 u8 off_desired; /* Actual "off" temperature specified. Preserved 266 u8 off_desired; /* Actual "off" temperature specified. Preserved
296 * to prevent "drift" as other autofan control 267 * to prevent "drift" as other autofan control
297 * values change. 268 * values change.
298 */ 269 */
299 u8 max_desired; /* Actual "max" temperature specified. Preserved 270 u8 max_desired; /* Actual "max" temperature specified. Preserved
300 * to prevent "drift" as other autofan control 271 * to prevent "drift" as other autofan control
301 * values change. 272 * values change.
302 */ 273 */
@@ -327,23 +298,13 @@ struct lm85_data {
327 s8 temp[3]; /* Register value */ 298 s8 temp[3]; /* Register value */
328 s8 temp_min[3]; /* Register value */ 299 s8 temp_min[3]; /* Register value */
329 s8 temp_max[3]; /* Register value */ 300 s8 temp_max[3]; /* Register value */
330 s8 temp_offset[3]; /* Register value */
331 u16 fan[4]; /* Register value */ 301 u16 fan[4]; /* Register value */
332 u16 fan_min[4]; /* Register value */ 302 u16 fan_min[4]; /* Register value */
333 u8 pwm[3]; /* Register value */ 303 u8 pwm[3]; /* Register value */
334 u8 spinup_ctl; /* Register encoding, combined */
335 u8 tach_mode; /* Register encoding, combined */
336 u8 temp_ext[3]; /* Decoded values */ 304 u8 temp_ext[3]; /* Decoded values */
337 u8 in_ext[8]; /* Decoded values */ 305 u8 in_ext[8]; /* Decoded values */
338 u8 fan_ppr; /* Register value */
339 u8 smooth[3]; /* Register encoding */
340 u8 vid; /* Register value */ 306 u8 vid; /* Register value */
341 u8 vrm; /* VRM version */ 307 u8 vrm; /* VRM version */
342 u8 syncpwm3; /* Saved PWM3 for TACH 2,3,4 config */
343 u8 oppoint[3]; /* Register value */
344 u16 tmin_ctl; /* Register value */
345 unsigned long therm_total; /* Cummulative therm count */
346 u8 therm_limit; /* Register value */
347 u32 alarms; /* Register encoding, combined */ 308 u32 alarms; /* Register encoding, combined */
348 struct lm85_autofan autofan[3]; 309 struct lm85_autofan autofan[3];
349 struct lm85_zone zone[3]; 310 struct lm85_zone zone[3];
@@ -355,9 +316,8 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
355static int lm85_detach_client(struct i2c_client *client); 316static int lm85_detach_client(struct i2c_client *client);
356 317
357static int lm85_read_value(struct i2c_client *client, u8 reg); 318static int lm85_read_value(struct i2c_client *client, u8 reg);
358static int lm85_write_value(struct i2c_client *client, u8 reg, int value); 319static void lm85_write_value(struct i2c_client *client, u8 reg, int value);
359static struct lm85_data *lm85_update_device(struct device *dev); 320static struct lm85_data *lm85_update_device(struct device *dev);
360static void lm85_init_client(struct i2c_client *client);
361 321
362 322
363static struct i2c_driver lm85_driver = { 323static struct i2c_driver lm85_driver = {
@@ -375,7 +335,7 @@ static ssize_t show_fan(struct device *dev, struct device_attribute *attr,
375{ 335{
376 int nr = to_sensor_dev_attr(attr)->index; 336 int nr = to_sensor_dev_attr(attr)->index;
377 struct lm85_data *data = lm85_update_device(dev); 337 struct lm85_data *data = lm85_update_device(dev);
378 return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan[nr]) ); 338 return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr]));
379} 339}
380 340
381static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, 341static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr,
@@ -383,7 +343,7 @@ static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr,
383{ 343{
384 int nr = to_sensor_dev_attr(attr)->index; 344 int nr = to_sensor_dev_attr(attr)->index;
385 struct lm85_data *data = lm85_update_device(dev); 345 struct lm85_data *data = lm85_update_device(dev);
386 return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan_min[nr]) ); 346 return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr]));
387} 347}
388 348
389static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, 349static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
@@ -414,7 +374,8 @@ show_fan_offset(4);
414 374
415/* vid, vrm, alarms */ 375/* vid, vrm, alarms */
416 376
417static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) 377static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr,
378 char *buf)
418{ 379{
419 struct lm85_data *data = lm85_update_device(dev); 380 struct lm85_data *data = lm85_update_device(dev);
420 int vid; 381 int vid;
@@ -432,13 +393,15 @@ static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, c
432 393
433static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); 394static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL);
434 395
435static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) 396static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr,
397 char *buf)
436{ 398{
437 struct lm85_data *data = dev_get_drvdata(dev); 399 struct lm85_data *data = dev_get_drvdata(dev);
438 return sprintf(buf, "%ld\n", (long) data->vrm); 400 return sprintf(buf, "%ld\n", (long) data->vrm);
439} 401}
440 402
441static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 403static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,
404 const char *buf, size_t count)
442{ 405{
443 struct lm85_data *data = dev_get_drvdata(dev); 406 struct lm85_data *data = dev_get_drvdata(dev);
444 data->vrm = simple_strtoul(buf, NULL, 10); 407 data->vrm = simple_strtoul(buf, NULL, 10);
@@ -447,7 +410,8 @@ static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr,
447 410
448static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg); 411static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm_reg, store_vrm_reg);
449 412
450static ssize_t show_alarms_reg(struct device *dev, struct device_attribute *attr, char *buf) 413static ssize_t show_alarms_reg(struct device *dev, struct device_attribute
414 *attr, char *buf)
451{ 415{
452 struct lm85_data *data = lm85_update_device(dev); 416 struct lm85_data *data = lm85_update_device(dev);
453 return sprintf(buf, "%u\n", data->alarms); 417 return sprintf(buf, "%u\n", data->alarms);
@@ -488,7 +452,7 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
488{ 452{
489 int nr = to_sensor_dev_attr(attr)->index; 453 int nr = to_sensor_dev_attr(attr)->index;
490 struct lm85_data *data = lm85_update_device(dev); 454 struct lm85_data *data = lm85_update_device(dev);
491 return sprintf(buf,"%d\n", PWM_FROM_REG(data->pwm[nr]) ); 455 return sprintf(buf, "%d\n", PWM_FROM_REG(data->pwm[nr]));
492} 456}
493 457
494static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, 458static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
@@ -581,17 +545,16 @@ static ssize_t show_in(struct device *dev, struct device_attribute *attr,
581{ 545{
582 int nr = to_sensor_dev_attr(attr)->index; 546 int nr = to_sensor_dev_attr(attr)->index;
583 struct lm85_data *data = lm85_update_device(dev); 547 struct lm85_data *data = lm85_update_device(dev);
584 return sprintf( buf, "%d\n", INSEXT_FROM_REG(nr, 548 return sprintf(buf, "%d\n", INSEXT_FROM_REG(nr, data->in[nr],
585 data->in[nr], 549 data->in_ext[nr]));
586 data->in_ext[nr]));
587} 550}
588 551
589static ssize_t show_in_min(struct device *dev, struct device_attribute *attr, 552static ssize_t show_in_min(struct device *dev, struct device_attribute *attr,
590 char *buf) 553 char *buf)
591{ 554{
592 int nr = to_sensor_dev_attr(attr)->index; 555 int nr = to_sensor_dev_attr(attr)->index;
593 struct lm85_data *data = lm85_update_device(dev); 556 struct lm85_data *data = lm85_update_device(dev);
594 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_min[nr]) ); 557 return sprintf(buf, "%d\n", INS_FROM_REG(nr, data->in_min[nr]));
595} 558}
596 559
597static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, 560static ssize_t set_in_min(struct device *dev, struct device_attribute *attr,
@@ -614,7 +577,7 @@ static ssize_t show_in_max(struct device *dev, struct device_attribute *attr,
614{ 577{
615 int nr = to_sensor_dev_attr(attr)->index; 578 int nr = to_sensor_dev_attr(attr)->index;
616 struct lm85_data *data = lm85_update_device(dev); 579 struct lm85_data *data = lm85_update_device(dev);
617 return sprintf(buf,"%d\n", INS_FROM_REG(nr, data->in_max[nr]) ); 580 return sprintf(buf, "%d\n", INS_FROM_REG(nr, data->in_max[nr]));
618} 581}
619 582
620static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, 583static ssize_t set_in_max(struct device *dev, struct device_attribute *attr,
@@ -656,8 +619,8 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
656{ 619{
657 int nr = to_sensor_dev_attr(attr)->index; 620 int nr = to_sensor_dev_attr(attr)->index;
658 struct lm85_data *data = lm85_update_device(dev); 621 struct lm85_data *data = lm85_update_device(dev);
659 return sprintf(buf,"%d\n", TEMPEXT_FROM_REG(data->temp[nr], 622 return sprintf(buf, "%d\n", TEMPEXT_FROM_REG(data->temp[nr],
660 data->temp_ext[nr])); 623 data->temp_ext[nr]));
661} 624}
662 625
663static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr, 626static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr,
@@ -665,7 +628,7 @@ static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr,
665{ 628{
666 int nr = to_sensor_dev_attr(attr)->index; 629 int nr = to_sensor_dev_attr(attr)->index;
667 struct lm85_data *data = lm85_update_device(dev); 630 struct lm85_data *data = lm85_update_device(dev);
668 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_min[nr]) ); 631 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[nr]));
669} 632}
670 633
671static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, 634static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
@@ -688,7 +651,7 @@ static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr,
688{ 651{
689 int nr = to_sensor_dev_attr(attr)->index; 652 int nr = to_sensor_dev_attr(attr)->index;
690 struct lm85_data *data = lm85_update_device(dev); 653 struct lm85_data *data = lm85_update_device(dev);
691 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->temp_max[nr]) ); 654 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[nr]));
692} 655}
693 656
694static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, 657static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
@@ -697,7 +660,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
697 int nr = to_sensor_dev_attr(attr)->index; 660 int nr = to_sensor_dev_attr(attr)->index;
698 struct i2c_client *client = to_i2c_client(dev); 661 struct i2c_client *client = to_i2c_client(dev);
699 struct lm85_data *data = i2c_get_clientdata(client); 662 struct lm85_data *data = i2c_get_clientdata(client);
700 long val = simple_strtol(buf, NULL, 10); 663 long val = simple_strtol(buf, NULL, 10);
701 664
702 mutex_lock(&data->update_lock); 665 mutex_lock(&data->update_lock);
703 data->temp_max[nr] = TEMP_TO_REG(val); 666 data->temp_max[nr] = TEMP_TO_REG(val);
@@ -726,7 +689,7 @@ static ssize_t show_pwm_auto_channels(struct device *dev,
726{ 689{
727 int nr = to_sensor_dev_attr(attr)->index; 690 int nr = to_sensor_dev_attr(attr)->index;
728 struct lm85_data *data = lm85_update_device(dev); 691 struct lm85_data *data = lm85_update_device(dev);
729 return sprintf(buf,"%d\n", ZONE_FROM_REG(data->autofan[nr].config)); 692 return sprintf(buf, "%d\n", ZONE_FROM_REG(data->autofan[nr].config));
730} 693}
731 694
732static ssize_t set_pwm_auto_channels(struct device *dev, 695static ssize_t set_pwm_auto_channels(struct device *dev,
@@ -735,11 +698,11 @@ static ssize_t set_pwm_auto_channels(struct device *dev,
735 int nr = to_sensor_dev_attr(attr)->index; 698 int nr = to_sensor_dev_attr(attr)->index;
736 struct i2c_client *client = to_i2c_client(dev); 699 struct i2c_client *client = to_i2c_client(dev);
737 struct lm85_data *data = i2c_get_clientdata(client); 700 struct lm85_data *data = i2c_get_clientdata(client);
738 long val = simple_strtol(buf, NULL, 10); 701 long val = simple_strtol(buf, NULL, 10);
739 702
740 mutex_lock(&data->update_lock); 703 mutex_lock(&data->update_lock);
741 data->autofan[nr].config = (data->autofan[nr].config & (~0xe0)) 704 data->autofan[nr].config = (data->autofan[nr].config & (~0xe0))
742 | ZONE_TO_REG(val) ; 705 | ZONE_TO_REG(val);
743 lm85_write_value(client, LM85_REG_AFAN_CONFIG(nr), 706 lm85_write_value(client, LM85_REG_AFAN_CONFIG(nr),
744 data->autofan[nr].config); 707 data->autofan[nr].config);
745 mutex_unlock(&data->update_lock); 708 mutex_unlock(&data->update_lock);
@@ -751,7 +714,7 @@ static ssize_t show_pwm_auto_pwm_min(struct device *dev,
751{ 714{
752 int nr = to_sensor_dev_attr(attr)->index; 715 int nr = to_sensor_dev_attr(attr)->index;
753 struct lm85_data *data = lm85_update_device(dev); 716 struct lm85_data *data = lm85_update_device(dev);
754 return sprintf(buf,"%d\n", PWM_FROM_REG(data->autofan[nr].min_pwm)); 717 return sprintf(buf, "%d\n", PWM_FROM_REG(data->autofan[nr].min_pwm));
755} 718}
756 719
757static ssize_t set_pwm_auto_pwm_min(struct device *dev, 720static ssize_t set_pwm_auto_pwm_min(struct device *dev,
@@ -775,7 +738,7 @@ static ssize_t show_pwm_auto_pwm_minctl(struct device *dev,
775{ 738{
776 int nr = to_sensor_dev_attr(attr)->index; 739 int nr = to_sensor_dev_attr(attr)->index;
777 struct lm85_data *data = lm85_update_device(dev); 740 struct lm85_data *data = lm85_update_device(dev);
778 return sprintf(buf,"%d\n", data->autofan[nr].min_off); 741 return sprintf(buf, "%d\n", data->autofan[nr].min_off);
779} 742}
780 743
781static ssize_t set_pwm_auto_pwm_minctl(struct device *dev, 744static ssize_t set_pwm_auto_pwm_minctl(struct device *dev,
@@ -785,15 +748,15 @@ static ssize_t set_pwm_auto_pwm_minctl(struct device *dev,
785 struct i2c_client *client = to_i2c_client(dev); 748 struct i2c_client *client = to_i2c_client(dev);
786 struct lm85_data *data = i2c_get_clientdata(client); 749 struct lm85_data *data = i2c_get_clientdata(client);
787 long val = simple_strtol(buf, NULL, 10); 750 long val = simple_strtol(buf, NULL, 10);
751 u8 tmp;
788 752
789 mutex_lock(&data->update_lock); 753 mutex_lock(&data->update_lock);
790 data->autofan[nr].min_off = val; 754 data->autofan[nr].min_off = val;
791 lm85_write_value(client, LM85_REG_AFAN_SPIKE1, data->smooth[0] 755 tmp = lm85_read_value(client, LM85_REG_AFAN_SPIKE1);
792 | data->syncpwm3 756 tmp &= ~(0x20 << nr);
793 | (data->autofan[0].min_off ? 0x20 : 0) 757 if (data->autofan[nr].min_off)
794 | (data->autofan[1].min_off ? 0x40 : 0) 758 tmp |= 0x20 << nr;
795 | (data->autofan[2].min_off ? 0x80 : 0) 759 lm85_write_value(client, LM85_REG_AFAN_SPIKE1, tmp);
796 );
797 mutex_unlock(&data->update_lock); 760 mutex_unlock(&data->update_lock);
798 return count; 761 return count;
799} 762}
@@ -803,7 +766,7 @@ static ssize_t show_pwm_auto_pwm_freq(struct device *dev,
803{ 766{
804 int nr = to_sensor_dev_attr(attr)->index; 767 int nr = to_sensor_dev_attr(attr)->index;
805 struct lm85_data *data = lm85_update_device(dev); 768 struct lm85_data *data = lm85_update_device(dev);
806 return sprintf(buf,"%d\n", FREQ_FROM_REG(data->autofan[nr].freq)); 769 return sprintf(buf, "%d\n", FREQ_FROM_REG(data->autofan[nr].freq));
807} 770}
808 771
809static ssize_t set_pwm_auto_pwm_freq(struct device *dev, 772static ssize_t set_pwm_auto_pwm_freq(struct device *dev,
@@ -818,8 +781,7 @@ static ssize_t set_pwm_auto_pwm_freq(struct device *dev,
818 data->autofan[nr].freq = FREQ_TO_REG(val); 781 data->autofan[nr].freq = FREQ_TO_REG(val);
819 lm85_write_value(client, LM85_REG_AFAN_RANGE(nr), 782 lm85_write_value(client, LM85_REG_AFAN_RANGE(nr),
820 (data->zone[nr].range << 4) 783 (data->zone[nr].range << 4)
821 | data->autofan[nr].freq 784 | data->autofan[nr].freq);
822 );
823 mutex_unlock(&data->update_lock); 785 mutex_unlock(&data->update_lock);
824 return count; 786 return count;
825} 787}
@@ -849,7 +811,7 @@ static ssize_t show_temp_auto_temp_off(struct device *dev,
849{ 811{
850 int nr = to_sensor_dev_attr(attr)->index; 812 int nr = to_sensor_dev_attr(attr)->index;
851 struct lm85_data *data = lm85_update_device(dev); 813 struct lm85_data *data = lm85_update_device(dev);
852 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) - 814 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].limit) -
853 HYST_FROM_REG(data->zone[nr].hyst)); 815 HYST_FROM_REG(data->zone[nr].hyst));
854} 816}
855 817
@@ -866,15 +828,13 @@ static ssize_t set_temp_auto_temp_off(struct device *dev,
866 min = TEMP_FROM_REG(data->zone[nr].limit); 828 min = TEMP_FROM_REG(data->zone[nr].limit);
867 data->zone[nr].off_desired = TEMP_TO_REG(val); 829 data->zone[nr].off_desired = TEMP_TO_REG(val);
868 data->zone[nr].hyst = HYST_TO_REG(min - val); 830 data->zone[nr].hyst = HYST_TO_REG(min - val);
869 if ( nr == 0 || nr == 1 ) { 831 if (nr == 0 || nr == 1) {
870 lm85_write_value(client, LM85_REG_AFAN_HYST1, 832 lm85_write_value(client, LM85_REG_AFAN_HYST1,
871 (data->zone[0].hyst << 4) 833 (data->zone[0].hyst << 4)
872 | data->zone[1].hyst 834 | data->zone[1].hyst);
873 );
874 } else { 835 } else {
875 lm85_write_value(client, LM85_REG_AFAN_HYST2, 836 lm85_write_value(client, LM85_REG_AFAN_HYST2,
876 (data->zone[2].hyst << 4) 837 (data->zone[2].hyst << 4));
877 );
878 } 838 }
879 mutex_unlock(&data->update_lock); 839 mutex_unlock(&data->update_lock);
880 return count; 840 return count;
@@ -885,7 +845,7 @@ static ssize_t show_temp_auto_temp_min(struct device *dev,
885{ 845{
886 int nr = to_sensor_dev_attr(attr)->index; 846 int nr = to_sensor_dev_attr(attr)->index;
887 struct lm85_data *data = lm85_update_device(dev); 847 struct lm85_data *data = lm85_update_device(dev);
888 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) ); 848 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].limit));
889} 849}
890 850
891static ssize_t set_temp_auto_temp_min(struct device *dev, 851static ssize_t set_temp_auto_temp_min(struct device *dev,
@@ -913,15 +873,13 @@ static ssize_t set_temp_auto_temp_min(struct device *dev,
913 data->zone[nr].hyst = HYST_TO_REG(TEMP_FROM_REG( 873 data->zone[nr].hyst = HYST_TO_REG(TEMP_FROM_REG(
914 data->zone[nr].limit) - TEMP_FROM_REG( 874 data->zone[nr].limit) - TEMP_FROM_REG(
915 data->zone[nr].off_desired)); 875 data->zone[nr].off_desired));
916 if ( nr == 0 || nr == 1 ) { 876 if (nr == 0 || nr == 1) {
917 lm85_write_value(client, LM85_REG_AFAN_HYST1, 877 lm85_write_value(client, LM85_REG_AFAN_HYST1,
918 (data->zone[0].hyst << 4) 878 (data->zone[0].hyst << 4)
919 | data->zone[1].hyst 879 | data->zone[1].hyst);
920 );
921 } else { 880 } else {
922 lm85_write_value(client, LM85_REG_AFAN_HYST2, 881 lm85_write_value(client, LM85_REG_AFAN_HYST2,
923 (data->zone[2].hyst << 4) 882 (data->zone[2].hyst << 4));
924 );
925 } 883 }
926 mutex_unlock(&data->update_lock); 884 mutex_unlock(&data->update_lock);
927 return count; 885 return count;
@@ -932,7 +890,7 @@ static ssize_t show_temp_auto_temp_max(struct device *dev,
932{ 890{
933 int nr = to_sensor_dev_attr(attr)->index; 891 int nr = to_sensor_dev_attr(attr)->index;
934 struct lm85_data *data = lm85_update_device(dev); 892 struct lm85_data *data = lm85_update_device(dev);
935 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].limit) + 893 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].limit) +
936 RANGE_FROM_REG(data->zone[nr].range)); 894 RANGE_FROM_REG(data->zone[nr].range));
937} 895}
938 896
@@ -962,11 +920,11 @@ static ssize_t show_temp_auto_temp_crit(struct device *dev,
962{ 920{
963 int nr = to_sensor_dev_attr(attr)->index; 921 int nr = to_sensor_dev_attr(attr)->index;
964 struct lm85_data *data = lm85_update_device(dev); 922 struct lm85_data *data = lm85_update_device(dev);
965 return sprintf(buf,"%d\n", TEMP_FROM_REG(data->zone[nr].critical)); 923 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->zone[nr].critical));
966} 924}
967 925
968static ssize_t set_temp_auto_temp_crit(struct device *dev, 926static ssize_t set_temp_auto_temp_crit(struct device *dev,
969 struct device_attribute *attr,const char *buf, size_t count) 927 struct device_attribute *attr, const char *buf, size_t count)
970{ 928{
971 int nr = to_sensor_dev_attr(attr)->index; 929 int nr = to_sensor_dev_attr(attr)->index;
972 struct i2c_client *client = to_i2c_client(dev); 930 struct i2c_client *client = to_i2c_client(dev);
@@ -1127,20 +1085,37 @@ static const struct attribute_group lm85_group_in567 = {
1127 .attrs = lm85_attributes_in567, 1085 .attrs = lm85_attributes_in567,
1128}; 1086};
1129 1087
1088static void lm85_init_client(struct i2c_client *client)
1089{
1090 int value;
1091
1092 /* Start monitoring if needed */
1093 value = lm85_read_value(client, LM85_REG_CONFIG);
1094 if (!(value & 0x01)) {
1095 dev_info(&client->dev, "Starting monitoring\n");
1096 lm85_write_value(client, LM85_REG_CONFIG, value | 0x01);
1097 }
1098
1099 /* Warn about unusual configuration bits */
1100 if (value & 0x02)
1101 dev_warn(&client->dev, "Device configuration is locked\n");
1102 if (!(value & 0x04))
1103 dev_warn(&client->dev, "Device is not ready\n");
1104}
1105
1130static int lm85_detect(struct i2c_adapter *adapter, int address, 1106static int lm85_detect(struct i2c_adapter *adapter, int address,
1131 int kind) 1107 int kind)
1132{ 1108{
1133 int company, verstep ; 1109 int company, verstep;
1134 struct i2c_client *new_client = NULL; 1110 struct i2c_client *client;
1135 struct lm85_data *data; 1111 struct lm85_data *data;
1136 int err = 0; 1112 int err = 0;
1137 const char *type_name = ""; 1113 const char *type_name;
1138 1114
1139 if (!i2c_check_functionality(adapter, 1115 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
1140 I2C_FUNC_SMBUS_BYTE_DATA)) {
1141 /* We need to be able to do byte I/O */ 1116 /* We need to be able to do byte I/O */
1142 goto ERROR0 ; 1117 goto ERROR0;
1143 }; 1118 }
1144 1119
1145 /* OK. For now, we presume we have a valid client. We now create the 1120 /* OK. For now, we presume we have a valid client. We now create the
1146 client structure, even though we cannot fill it completely yet. 1121 client structure, even though we cannot fill it completely yet.
@@ -1151,138 +1126,145 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
1151 goto ERROR0; 1126 goto ERROR0;
1152 } 1127 }
1153 1128
1154 new_client = &data->client; 1129 client = &data->client;
1155 i2c_set_clientdata(new_client, data); 1130 i2c_set_clientdata(client, data);
1156 new_client->addr = address; 1131 client->addr = address;
1157 new_client->adapter = adapter; 1132 client->adapter = adapter;
1158 new_client->driver = &lm85_driver; 1133 client->driver = &lm85_driver;
1159 new_client->flags = 0;
1160 1134
1161 /* Now, we do the remaining detection. */ 1135 /* Now, we do the remaining detection. */
1162 1136
1163 company = lm85_read_value(new_client, LM85_REG_COMPANY); 1137 company = lm85_read_value(client, LM85_REG_COMPANY);
1164 verstep = lm85_read_value(new_client, LM85_REG_VERSTEP); 1138 verstep = lm85_read_value(client, LM85_REG_VERSTEP);
1165 1139
1166 dev_dbg(&adapter->dev, "Detecting device at %d,0x%02x with" 1140 dev_dbg(&adapter->dev, "Detecting device at %d,0x%02x with"
1167 " COMPANY: 0x%02x and VERSTEP: 0x%02x\n", 1141 " COMPANY: 0x%02x and VERSTEP: 0x%02x\n",
1168 i2c_adapter_id(new_client->adapter), new_client->addr, 1142 i2c_adapter_id(client->adapter), client->addr,
1169 company, verstep); 1143 company, verstep);
1170 1144
1171 /* If auto-detecting, Determine the chip type. */ 1145 /* If auto-detecting, Determine the chip type. */
1172 if (kind <= 0) { 1146 if (kind <= 0) {
1173 dev_dbg(&adapter->dev, "Autodetecting device at %d,0x%02x ...\n", 1147 dev_dbg(&adapter->dev, "Autodetecting device at %d,0x%02x ...\n",
1174 i2c_adapter_id(adapter), address ); 1148 i2c_adapter_id(adapter), address);
1175 if( company == LM85_COMPANY_NATIONAL 1149 if (company == LM85_COMPANY_NATIONAL
1176 && verstep == LM85_VERSTEP_LM85C ) { 1150 && verstep == LM85_VERSTEP_LM85C) {
1177 kind = lm85c ; 1151 kind = lm85c;
1178 } else if( company == LM85_COMPANY_NATIONAL 1152 } else if (company == LM85_COMPANY_NATIONAL
1179 && verstep == LM85_VERSTEP_LM85B ) { 1153 && verstep == LM85_VERSTEP_LM85B) {
1180 kind = lm85b ; 1154 kind = lm85b;
1181 } else if( company == LM85_COMPANY_NATIONAL 1155 } else if (company == LM85_COMPANY_NATIONAL
1182 && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC ) { 1156 && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) {
1183 dev_err(&adapter->dev, "Unrecognized version/stepping 0x%02x" 1157 dev_err(&adapter->dev, "Unrecognized version/stepping 0x%02x"
1184 " Defaulting to LM85.\n", verstep); 1158 " Defaulting to LM85.\n", verstep);
1185 kind = any_chip ; 1159 kind = any_chip;
1186 } else if( company == LM85_COMPANY_ANALOG_DEV 1160 } else if (company == LM85_COMPANY_ANALOG_DEV
1187 && verstep == LM85_VERSTEP_ADM1027 ) { 1161 && verstep == LM85_VERSTEP_ADM1027) {
1188 kind = adm1027 ; 1162 kind = adm1027;
1189 } else if( company == LM85_COMPANY_ANALOG_DEV 1163 } else if (company == LM85_COMPANY_ANALOG_DEV
1190 && (verstep == LM85_VERSTEP_ADT7463 1164 && (verstep == LM85_VERSTEP_ADT7463
1191 || verstep == LM85_VERSTEP_ADT7463C) ) { 1165 || verstep == LM85_VERSTEP_ADT7463C)) {
1192 kind = adt7463 ; 1166 kind = adt7463;
1193 } else if( company == LM85_COMPANY_ANALOG_DEV 1167 } else if (company == LM85_COMPANY_ANALOG_DEV
1194 && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC ) { 1168 && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) {
1195 dev_err(&adapter->dev, "Unrecognized version/stepping 0x%02x" 1169 dev_err(&adapter->dev, "Unrecognized version/stepping 0x%02x"
1196 " Defaulting to Generic LM85.\n", verstep ); 1170 " Defaulting to Generic LM85.\n", verstep);
1197 kind = any_chip ; 1171 kind = any_chip;
1198 } else if( company == LM85_COMPANY_SMSC 1172 } else if (company == LM85_COMPANY_SMSC
1199 && (verstep == LM85_VERSTEP_EMC6D100_A0 1173 && (verstep == LM85_VERSTEP_EMC6D100_A0
1200 || verstep == LM85_VERSTEP_EMC6D100_A1) ) { 1174 || verstep == LM85_VERSTEP_EMC6D100_A1)) {
1201 /* Unfortunately, we can't tell a '100 from a '101 1175 /* Unfortunately, we can't tell a '100 from a '101
1202 * from the registers. Since a '101 is a '100 1176 * from the registers. Since a '101 is a '100
1203 * in a package with fewer pins and therefore no 1177 * in a package with fewer pins and therefore no
1204 * 3.3V, 1.5V or 1.8V inputs, perhaps if those 1178 * 3.3V, 1.5V or 1.8V inputs, perhaps if those
1205 * inputs read 0, then it's a '101. 1179 * inputs read 0, then it's a '101.
1206 */ 1180 */
1207 kind = emc6d100 ; 1181 kind = emc6d100;
1208 } else if( company == LM85_COMPANY_SMSC 1182 } else if (company == LM85_COMPANY_SMSC
1209 && verstep == LM85_VERSTEP_EMC6D102) { 1183 && verstep == LM85_VERSTEP_EMC6D102) {
1210 kind = emc6d102 ; 1184 kind = emc6d102;
1211 } else if( company == LM85_COMPANY_SMSC 1185 } else if (company == LM85_COMPANY_SMSC
1212 && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) { 1186 && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) {
1213 dev_err(&adapter->dev, "lm85: Detected SMSC chip\n"); 1187 dev_err(&adapter->dev, "lm85: Detected SMSC chip\n");
1214 dev_err(&adapter->dev, "lm85: Unrecognized version/stepping 0x%02x" 1188 dev_err(&adapter->dev, "lm85: Unrecognized version/stepping 0x%02x"
1215 " Defaulting to Generic LM85.\n", verstep ); 1189 " Defaulting to Generic LM85.\n", verstep);
1216 kind = any_chip ; 1190 kind = any_chip;
1217 } else if( kind == any_chip 1191 } else if (kind == any_chip
1218 && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) { 1192 && (verstep & LM85_VERSTEP_VMASK) == LM85_VERSTEP_GENERIC) {
1219 dev_err(&adapter->dev, "Generic LM85 Version 6 detected\n"); 1193 dev_err(&adapter->dev, "Generic LM85 Version 6 detected\n");
1220 /* Leave kind as "any_chip" */ 1194 /* Leave kind as "any_chip" */
1221 } else { 1195 } else {
1222 dev_dbg(&adapter->dev, "Autodetection failed\n"); 1196 dev_dbg(&adapter->dev, "Autodetection failed\n");
1223 /* Not an LM85 ... */ 1197 /* Not an LM85... */
1224 if( kind == any_chip ) { /* User used force=x,y */ 1198 if (kind == any_chip) { /* User used force=x,y */
1225 dev_err(&adapter->dev, "Generic LM85 Version 6 not" 1199 dev_err(&adapter->dev, "Generic LM85 Version 6 not"
1226 " found at %d,0x%02x. Try force_lm85c.\n", 1200 " found at %d,0x%02x. Try force_lm85c.\n",
1227 i2c_adapter_id(adapter), address ); 1201 i2c_adapter_id(adapter), address);
1228 } 1202 }
1229 err = 0 ; 1203 err = 0;
1230 goto ERROR1; 1204 goto ERROR1;
1231 } 1205 }
1232 } 1206 }
1233 1207
1234 /* Fill in the chip specific driver values */ 1208 /* Fill in the chip specific driver values */
1235 if ( kind == any_chip ) { 1209 switch (kind) {
1236 type_name = "lm85"; 1210 case lm85b:
1237 } else if ( kind == lm85b ) {
1238 type_name = "lm85b"; 1211 type_name = "lm85b";
1239 } else if ( kind == lm85c ) { 1212 break;
1213 case lm85c:
1240 type_name = "lm85c"; 1214 type_name = "lm85c";
1241 } else if ( kind == adm1027 ) { 1215 break;
1216 case adm1027:
1242 type_name = "adm1027"; 1217 type_name = "adm1027";
1243 } else if ( kind == adt7463 ) { 1218 break;
1219 case adt7463:
1244 type_name = "adt7463"; 1220 type_name = "adt7463";
1245 } else if ( kind == emc6d100){ 1221 break;
1222 case emc6d100:
1246 type_name = "emc6d100"; 1223 type_name = "emc6d100";
1247 } else if ( kind == emc6d102 ) { 1224 break;
1225 case emc6d102:
1248 type_name = "emc6d102"; 1226 type_name = "emc6d102";
1227 break;
1228 default:
1229 type_name = "lm85";
1249 } 1230 }
1250 strlcpy(new_client->name, type_name, I2C_NAME_SIZE); 1231 strlcpy(client->name, type_name, I2C_NAME_SIZE);
1251 1232
1252 /* Fill in the remaining client fields */ 1233 /* Fill in the remaining client fields */
1253 data->type = kind; 1234 data->type = kind;
1254 data->valid = 0;
1255 mutex_init(&data->update_lock); 1235 mutex_init(&data->update_lock);
1256 1236
1257 /* Tell the I2C layer a new client has arrived */ 1237 /* Tell the I2C layer a new client has arrived */
1258 if ((err = i2c_attach_client(new_client))) 1238 err = i2c_attach_client(client);
1239 if (err)
1259 goto ERROR1; 1240 goto ERROR1;
1260 1241
1261 /* Set the VRM version */ 1242 /* Set the VRM version */
1262 data->vrm = vid_which_vrm(); 1243 data->vrm = vid_which_vrm();
1263 1244
1264 /* Initialize the LM85 chip */ 1245 /* Initialize the LM85 chip */
1265 lm85_init_client(new_client); 1246 lm85_init_client(client);
1266 1247
1267 /* Register sysfs hooks */ 1248 /* Register sysfs hooks */
1268 if ((err = sysfs_create_group(&new_client->dev.kobj, &lm85_group))) 1249 err = sysfs_create_group(&client->dev.kobj, &lm85_group);
1250 if (err)
1269 goto ERROR2; 1251 goto ERROR2;
1270 1252
1271 /* The ADT7463 has an optional VRM 10 mode where pin 21 is used 1253 /* The ADT7463 has an optional VRM 10 mode where pin 21 is used
1272 as a sixth digital VID input rather than an analog input. */ 1254 as a sixth digital VID input rather than an analog input. */
1273 data->vid = lm85_read_value(new_client, LM85_REG_VID); 1255 data->vid = lm85_read_value(client, LM85_REG_VID);
1274 if (!(kind == adt7463 && (data->vid & 0x80))) 1256 if (!(kind == adt7463 && (data->vid & 0x80)))
1275 if ((err = sysfs_create_group(&new_client->dev.kobj, 1257 if ((err = sysfs_create_group(&client->dev.kobj,
1276 &lm85_group_in4))) 1258 &lm85_group_in4)))
1277 goto ERROR3; 1259 goto ERROR3;
1278 1260
1279 /* The EMC6D100 has 3 additional voltage inputs */ 1261 /* The EMC6D100 has 3 additional voltage inputs */
1280 if (kind == emc6d100) 1262 if (kind == emc6d100)
1281 if ((err = sysfs_create_group(&new_client->dev.kobj, 1263 if ((err = sysfs_create_group(&client->dev.kobj,
1282 &lm85_group_in567))) 1264 &lm85_group_in567)))
1283 goto ERROR3; 1265 goto ERROR3;
1284 1266
1285 data->hwmon_dev = hwmon_device_register(&new_client->dev); 1267 data->hwmon_dev = hwmon_device_register(&client->dev);
1286 if (IS_ERR(data->hwmon_dev)) { 1268 if (IS_ERR(data->hwmon_dev)) {
1287 err = PTR_ERR(data->hwmon_dev); 1269 err = PTR_ERR(data->hwmon_dev);
1288 goto ERROR3; 1270 goto ERROR3;
@@ -1291,16 +1273,16 @@ static int lm85_detect(struct i2c_adapter *adapter, int address,
1291 return 0; 1273 return 0;
1292 1274
1293 /* Error out and cleanup code */ 1275 /* Error out and cleanup code */
1294 ERROR3: 1276 ERROR3:
1295 sysfs_remove_group(&new_client->dev.kobj, &lm85_group); 1277 sysfs_remove_group(&client->dev.kobj, &lm85_group);
1296 sysfs_remove_group(&new_client->dev.kobj, &lm85_group_in4); 1278 sysfs_remove_group(&client->dev.kobj, &lm85_group_in4);
1297 if (kind == emc6d100) 1279 if (kind == emc6d100)
1298 sysfs_remove_group(&new_client->dev.kobj, &lm85_group_in567); 1280 sysfs_remove_group(&client->dev.kobj, &lm85_group_in567);
1299 ERROR2: 1281 ERROR2:
1300 i2c_detach_client(new_client); 1282 i2c_detach_client(client);
1301 ERROR1: 1283 ERROR1:
1302 kfree(data); 1284 kfree(data);
1303 ERROR0: 1285 ERROR0:
1304 return err; 1286 return err;
1305} 1287}
1306 1288
@@ -1323,100 +1305,46 @@ static int lm85_read_value(struct i2c_client *client, u8 reg)
1323 int res; 1305 int res;
1324 1306
1325 /* What size location is it? */ 1307 /* What size location is it? */
1326 switch( reg ) { 1308 switch (reg) {
1327 case LM85_REG_FAN(0) : /* Read WORD data */ 1309 case LM85_REG_FAN(0): /* Read WORD data */
1328 case LM85_REG_FAN(1) : 1310 case LM85_REG_FAN(1):
1329 case LM85_REG_FAN(2) : 1311 case LM85_REG_FAN(2):
1330 case LM85_REG_FAN(3) : 1312 case LM85_REG_FAN(3):
1331 case LM85_REG_FAN_MIN(0) : 1313 case LM85_REG_FAN_MIN(0):
1332 case LM85_REG_FAN_MIN(1) : 1314 case LM85_REG_FAN_MIN(1):
1333 case LM85_REG_FAN_MIN(2) : 1315 case LM85_REG_FAN_MIN(2):
1334 case LM85_REG_FAN_MIN(3) : 1316 case LM85_REG_FAN_MIN(3):
1335 case LM85_REG_ALARM1 : /* Read both bytes at once */ 1317 case LM85_REG_ALARM1: /* Read both bytes at once */
1336 res = i2c_smbus_read_byte_data(client, reg) & 0xff ; 1318 res = i2c_smbus_read_byte_data(client, reg) & 0xff;
1337 res |= i2c_smbus_read_byte_data(client, reg+1) << 8 ; 1319 res |= i2c_smbus_read_byte_data(client, reg + 1) << 8;
1338 break ; 1320 break;
1339 case ADT7463_REG_TMIN_CTL1 : /* Read WORD MSB, LSB */
1340 res = i2c_smbus_read_byte_data(client, reg) << 8 ;
1341 res |= i2c_smbus_read_byte_data(client, reg+1) & 0xff ;
1342 break ;
1343 default: /* Read BYTE data */ 1321 default: /* Read BYTE data */
1344 res = i2c_smbus_read_byte_data(client, reg); 1322 res = i2c_smbus_read_byte_data(client, reg);
1345 break ; 1323 break;
1346 } 1324 }
1347 1325
1348 return res ; 1326 return res;
1349} 1327}
1350 1328
1351static int lm85_write_value(struct i2c_client *client, u8 reg, int value) 1329static void lm85_write_value(struct i2c_client *client, u8 reg, int value)
1352{ 1330{
1353 int res ; 1331 switch (reg) {
1354 1332 case LM85_REG_FAN(0): /* Write WORD data */
1355 switch( reg ) { 1333 case LM85_REG_FAN(1):
1356 case LM85_REG_FAN(0) : /* Write WORD data */ 1334 case LM85_REG_FAN(2):
1357 case LM85_REG_FAN(1) : 1335 case LM85_REG_FAN(3):
1358 case LM85_REG_FAN(2) : 1336 case LM85_REG_FAN_MIN(0):
1359 case LM85_REG_FAN(3) : 1337 case LM85_REG_FAN_MIN(1):
1360 case LM85_REG_FAN_MIN(0) : 1338 case LM85_REG_FAN_MIN(2):
1361 case LM85_REG_FAN_MIN(1) : 1339 case LM85_REG_FAN_MIN(3):
1362 case LM85_REG_FAN_MIN(2) :
1363 case LM85_REG_FAN_MIN(3) :
1364 /* NOTE: ALARM is read only, so not included here */ 1340 /* NOTE: ALARM is read only, so not included here */
1365 res = i2c_smbus_write_byte_data(client, reg, value & 0xff) ; 1341 i2c_smbus_write_byte_data(client, reg, value & 0xff);
1366 res |= i2c_smbus_write_byte_data(client, reg+1, (value>>8) & 0xff) ; 1342 i2c_smbus_write_byte_data(client, reg + 1, value >> 8);
1367 break ; 1343 break;
1368 case ADT7463_REG_TMIN_CTL1 : /* Write WORD MSB, LSB */
1369 res = i2c_smbus_write_byte_data(client, reg, (value>>8) & 0xff);
1370 res |= i2c_smbus_write_byte_data(client, reg+1, value & 0xff) ;
1371 break ;
1372 default: /* Write BYTE data */ 1344 default: /* Write BYTE data */
1373 res = i2c_smbus_write_byte_data(client, reg, value); 1345 i2c_smbus_write_byte_data(client, reg, value);
1374 break ; 1346 break;
1375 } 1347 }
1376
1377 return res ;
1378}
1379
1380static void lm85_init_client(struct i2c_client *client)
1381{
1382 int value;
1383 struct lm85_data *data = i2c_get_clientdata(client);
1384
1385 dev_dbg(&client->dev, "Initializing device\n");
1386
1387 /* Warn if part was not "READY" */
1388 value = lm85_read_value(client, LM85_REG_CONFIG);
1389 dev_dbg(&client->dev, "LM85_REG_CONFIG is: 0x%02x\n", value);
1390 if( value & 0x02 ) {
1391 dev_err(&client->dev, "Client (%d,0x%02x) config is locked.\n",
1392 i2c_adapter_id(client->adapter), client->addr );
1393 };
1394 if( ! (value & 0x04) ) {
1395 dev_err(&client->dev, "Client (%d,0x%02x) is not ready.\n",
1396 i2c_adapter_id(client->adapter), client->addr );
1397 };
1398 if( value & 0x10
1399 && ( data->type == adm1027
1400 || data->type == adt7463 ) ) {
1401 dev_err(&client->dev, "Client (%d,0x%02x) VxI mode is set. "
1402 "Please report this to the lm85 maintainer.\n",
1403 i2c_adapter_id(client->adapter), client->addr );
1404 };
1405
1406 /* WE INTENTIONALLY make no changes to the limits,
1407 * offsets, pwms, fans and zones. If they were
1408 * configured, we don't want to mess with them.
1409 * If they weren't, the default is 100% PWM, no
1410 * control and will suffice until 'sensors -s'
1411 * can be run by the user.
1412 */
1413
1414 /* Start monitoring */
1415 value = lm85_read_value(client, LM85_REG_CONFIG);
1416 /* Try to clear LOCK, Set START, save everything else */
1417 value = (value & ~ 0x02) | 0x01 ;
1418 dev_dbg(&client->dev, "Setting CONFIG to: 0x%02x\n", value);
1419 lm85_write_value(client, LM85_REG_CONFIG, value);
1420} 1348}
1421 1349
1422static struct lm85_data *lm85_update_device(struct device *dev) 1350static struct lm85_data *lm85_update_device(struct device *dev)
@@ -1427,28 +1355,30 @@ static struct lm85_data *lm85_update_device(struct device *dev)
1427 1355
1428 mutex_lock(&data->update_lock); 1356 mutex_lock(&data->update_lock);
1429 1357
1430 if ( !data->valid || 1358 if (!data->valid ||
1431 time_after(jiffies, data->last_reading + LM85_DATA_INTERVAL) ) { 1359 time_after(jiffies, data->last_reading + LM85_DATA_INTERVAL)) {
1432 /* Things that change quickly */ 1360 /* Things that change quickly */
1433 dev_dbg(&client->dev, "Reading sensor values\n"); 1361 dev_dbg(&client->dev, "Reading sensor values\n");
1434 1362
1435 /* Have to read extended bits first to "freeze" the 1363 /* Have to read extended bits first to "freeze" the
1436 * more significant bits that are read later. 1364 * more significant bits that are read later.
1437 * There are 2 additional resolution bits per channel and we 1365 * There are 2 additional resolution bits per channel and we
1438 * have room for 4, so we shift them to the left. 1366 * have room for 4, so we shift them to the left.
1439 */ 1367 */
1440 if ( (data->type == adm1027) || (data->type == adt7463) ) { 1368 if (data->type == adm1027 || data->type == adt7463) {
1441 int ext1 = lm85_read_value(client, 1369 int ext1 = lm85_read_value(client,
1442 ADM1027_REG_EXTEND_ADC1); 1370 ADM1027_REG_EXTEND_ADC1);
1443 int ext2 = lm85_read_value(client, 1371 int ext2 = lm85_read_value(client,
1444 ADM1027_REG_EXTEND_ADC2); 1372 ADM1027_REG_EXTEND_ADC2);
1445 int val = (ext1 << 8) + ext2; 1373 int val = (ext1 << 8) + ext2;
1446 1374
1447 for(i = 0; i <= 4; i++) 1375 for (i = 0; i <= 4; i++)
1448 data->in_ext[i] = ((val>>(i * 2))&0x03) << 2; 1376 data->in_ext[i] =
1377 ((val >> (i * 2)) & 0x03) << 2;
1449 1378
1450 for(i = 0; i <= 2; i++) 1379 for (i = 0; i <= 2; i++)
1451 data->temp_ext[i] = (val>>((i + 4) * 2))&0x0c; 1380 data->temp_ext[i] =
1381 (val >> ((i + 4) * 2)) & 0x0c;
1452 } 1382 }
1453 1383
1454 data->vid = lm85_read_value(client, LM85_REG_VID); 1384 data->vid = lm85_read_value(client, LM85_REG_VID);
@@ -1456,6 +1386,8 @@ static struct lm85_data *lm85_update_device(struct device *dev)
1456 for (i = 0; i <= 3; ++i) { 1386 for (i = 0; i <= 3; ++i) {
1457 data->in[i] = 1387 data->in[i] =
1458 lm85_read_value(client, LM85_REG_IN(i)); 1388 lm85_read_value(client, LM85_REG_IN(i));
1389 data->fan[i] =
1390 lm85_read_value(client, LM85_REG_FAN(i));
1459 } 1391 }
1460 1392
1461 if (!(data->type == adt7463 && (data->vid & 0x80))) { 1393 if (!(data->type == adt7463 && (data->vid & 0x80))) {
@@ -1463,38 +1395,25 @@ static struct lm85_data *lm85_update_device(struct device *dev)
1463 LM85_REG_IN(4)); 1395 LM85_REG_IN(4));
1464 } 1396 }
1465 1397
1466 for (i = 0; i <= 3; ++i) {
1467 data->fan[i] =
1468 lm85_read_value(client, LM85_REG_FAN(i));
1469 }
1470
1471 for (i = 0; i <= 2; ++i) { 1398 for (i = 0; i <= 2; ++i) {
1472 data->temp[i] = 1399 data->temp[i] =
1473 lm85_read_value(client, LM85_REG_TEMP(i)); 1400 lm85_read_value(client, LM85_REG_TEMP(i));
1474 }
1475
1476 for (i = 0; i <= 2; ++i) {
1477 data->pwm[i] = 1401 data->pwm[i] =
1478 lm85_read_value(client, LM85_REG_PWM(i)); 1402 lm85_read_value(client, LM85_REG_PWM(i));
1479 } 1403 }
1480 1404
1481 data->alarms = lm85_read_value(client, LM85_REG_ALARM1); 1405 data->alarms = lm85_read_value(client, LM85_REG_ALARM1);
1482 1406
1483 if ( data->type == adt7463 ) { 1407 if (data->type == emc6d100) {
1484 if( data->therm_total < ULONG_MAX - 256 ) {
1485 data->therm_total +=
1486 lm85_read_value(client, ADT7463_REG_THERM );
1487 }
1488 } else if ( data->type == emc6d100 ) {
1489 /* Three more voltage sensors */ 1408 /* Three more voltage sensors */
1490 for (i = 5; i <= 7; ++i) { 1409 for (i = 5; i <= 7; ++i) {
1491 data->in[i] = 1410 data->in[i] = lm85_read_value(client,
1492 lm85_read_value(client, EMC6D100_REG_IN(i)); 1411 EMC6D100_REG_IN(i));
1493 } 1412 }
1494 /* More alarm bits */ 1413 /* More alarm bits */
1495 data->alarms |= 1414 data->alarms |= lm85_read_value(client,
1496 lm85_read_value(client, EMC6D100_REG_ALARM3) << 16; 1415 EMC6D100_REG_ALARM3) << 16;
1497 } else if (data->type == emc6d102 ) { 1416 } else if (data->type == emc6d102) {
1498 /* Have to read LSB bits after the MSB ones because 1417 /* Have to read LSB bits after the MSB ones because
1499 the reading of the MSB bits has frozen the 1418 the reading of the MSB bits has frozen the
1500 LSBs (backward from the ADM1027). 1419 LSBs (backward from the ADM1027).
@@ -1509,20 +1428,20 @@ static struct lm85_data *lm85_update_device(struct device *dev)
1509 EMC6D102_REG_EXTEND_ADC4); 1428 EMC6D102_REG_EXTEND_ADC4);
1510 data->in_ext[0] = ext3 & 0x0f; 1429 data->in_ext[0] = ext3 & 0x0f;
1511 data->in_ext[1] = ext4 & 0x0f; 1430 data->in_ext[1] = ext4 & 0x0f;
1512 data->in_ext[2] = (ext4 >> 4) & 0x0f; 1431 data->in_ext[2] = ext4 >> 4;
1513 data->in_ext[3] = (ext3 >> 4) & 0x0f; 1432 data->in_ext[3] = ext3 >> 4;
1514 data->in_ext[4] = (ext2 >> 4) & 0x0f; 1433 data->in_ext[4] = ext2 >> 4;
1515 1434
1516 data->temp_ext[0] = ext1 & 0x0f; 1435 data->temp_ext[0] = ext1 & 0x0f;
1517 data->temp_ext[1] = ext2 & 0x0f; 1436 data->temp_ext[1] = ext2 & 0x0f;
1518 data->temp_ext[2] = (ext1 >> 4) & 0x0f; 1437 data->temp_ext[2] = ext1 >> 4;
1519 } 1438 }
1520 1439
1521 data->last_reading = jiffies ; 1440 data->last_reading = jiffies;
1522 }; /* last_reading */ 1441 } /* last_reading */
1523 1442
1524 if ( !data->valid || 1443 if (!data->valid ||
1525 time_after(jiffies, data->last_config + LM85_CONFIG_INTERVAL) ) { 1444 time_after(jiffies, data->last_config + LM85_CONFIG_INTERVAL)) {
1526 /* Things that don't change often */ 1445 /* Things that don't change often */
1527 dev_dbg(&client->dev, "Reading config values\n"); 1446 dev_dbg(&client->dev, "Reading config values\n");
1528 1447
@@ -1531,6 +1450,8 @@ static struct lm85_data *lm85_update_device(struct device *dev)
1531 lm85_read_value(client, LM85_REG_IN_MIN(i)); 1450 lm85_read_value(client, LM85_REG_IN_MIN(i));
1532 data->in_max[i] = 1451 data->in_max[i] =
1533 lm85_read_value(client, LM85_REG_IN_MAX(i)); 1452 lm85_read_value(client, LM85_REG_IN_MAX(i));
1453 data->fan_min[i] =
1454 lm85_read_value(client, LM85_REG_FAN_MIN(i));
1534 } 1455 }
1535 1456
1536 if (!(data->type == adt7463 && (data->vid & 0x80))) { 1457 if (!(data->type == adt7463 && (data->vid & 0x80))) {
@@ -1540,34 +1461,28 @@ static struct lm85_data *lm85_update_device(struct device *dev)
1540 LM85_REG_IN_MAX(4)); 1461 LM85_REG_IN_MAX(4));
1541 } 1462 }
1542 1463
1543 if ( data->type == emc6d100 ) { 1464 if (data->type == emc6d100) {
1544 for (i = 5; i <= 7; ++i) { 1465 for (i = 5; i <= 7; ++i) {
1545 data->in_min[i] = 1466 data->in_min[i] = lm85_read_value(client,
1546 lm85_read_value(client, EMC6D100_REG_IN_MIN(i)); 1467 EMC6D100_REG_IN_MIN(i));
1547 data->in_max[i] = 1468 data->in_max[i] = lm85_read_value(client,
1548 lm85_read_value(client, EMC6D100_REG_IN_MAX(i)); 1469 EMC6D100_REG_IN_MAX(i));
1549 } 1470 }
1550 } 1471 }
1551 1472
1552 for (i = 0; i <= 3; ++i) {
1553 data->fan_min[i] =
1554 lm85_read_value(client, LM85_REG_FAN_MIN(i));
1555 }
1556
1557 for (i = 0; i <= 2; ++i) { 1473 for (i = 0; i <= 2; ++i) {
1474 int val;
1475
1558 data->temp_min[i] = 1476 data->temp_min[i] =
1559 lm85_read_value(client, LM85_REG_TEMP_MIN(i)); 1477 lm85_read_value(client, LM85_REG_TEMP_MIN(i));
1560 data->temp_max[i] = 1478 data->temp_max[i] =
1561 lm85_read_value(client, LM85_REG_TEMP_MAX(i)); 1479 lm85_read_value(client, LM85_REG_TEMP_MAX(i));
1562 }
1563 1480
1564 for (i = 0; i <= 2; ++i) {
1565 int val ;
1566 data->autofan[i].config = 1481 data->autofan[i].config =
1567 lm85_read_value(client, LM85_REG_AFAN_CONFIG(i)); 1482 lm85_read_value(client, LM85_REG_AFAN_CONFIG(i));
1568 val = lm85_read_value(client, LM85_REG_AFAN_RANGE(i)); 1483 val = lm85_read_value(client, LM85_REG_AFAN_RANGE(i));
1569 data->autofan[i].freq = val & 0x07 ; 1484 data->autofan[i].freq = val & 0x07;
1570 data->zone[i].range = (val >> 4) & 0x0f ; 1485 data->zone[i].range = val >> 4;
1571 data->autofan[i].min_pwm = 1486 data->autofan[i].min_pwm =
1572 lm85_read_value(client, LM85_REG_AFAN_MINPWM(i)); 1487 lm85_read_value(client, LM85_REG_AFAN_MINPWM(i));
1573 data->zone[i].limit = 1488 data->zone[i].limit =
@@ -1577,50 +1492,19 @@ static struct lm85_data *lm85_update_device(struct device *dev)
1577 } 1492 }
1578 1493
1579 i = lm85_read_value(client, LM85_REG_AFAN_SPIKE1); 1494 i = lm85_read_value(client, LM85_REG_AFAN_SPIKE1);
1580 data->smooth[0] = i & 0x0f ; 1495 data->autofan[0].min_off = (i & 0x20) != 0;
1581 data->syncpwm3 = i & 0x10 ; /* Save PWM3 config */ 1496 data->autofan[1].min_off = (i & 0x40) != 0;
1582 data->autofan[0].min_off = (i & 0x20) != 0 ; 1497 data->autofan[2].min_off = (i & 0x80) != 0;
1583 data->autofan[1].min_off = (i & 0x40) != 0 ;
1584 data->autofan[2].min_off = (i & 0x80) != 0 ;
1585 i = lm85_read_value(client, LM85_REG_AFAN_SPIKE2);
1586 data->smooth[1] = (i>>4) & 0x0f ;
1587 data->smooth[2] = i & 0x0f ;
1588 1498
1589 i = lm85_read_value(client, LM85_REG_AFAN_HYST1); 1499 i = lm85_read_value(client, LM85_REG_AFAN_HYST1);
1590 data->zone[0].hyst = (i>>4) & 0x0f ; 1500 data->zone[0].hyst = i >> 4;
1591 data->zone[1].hyst = i & 0x0f ; 1501 data->zone[1].hyst = i & 0x0f;
1592 1502
1593 i = lm85_read_value(client, LM85_REG_AFAN_HYST2); 1503 i = lm85_read_value(client, LM85_REG_AFAN_HYST2);
1594 data->zone[2].hyst = (i>>4) & 0x0f ; 1504 data->zone[2].hyst = i >> 4;
1595 1505
1596 if ( (data->type == lm85b) || (data->type == lm85c) ) {
1597 data->tach_mode = lm85_read_value(client,
1598 LM85_REG_TACH_MODE );
1599 data->spinup_ctl = lm85_read_value(client,
1600 LM85_REG_SPINUP_CTL );
1601 } else if ( (data->type == adt7463) || (data->type == adm1027) ) {
1602 if ( data->type == adt7463 ) {
1603 for (i = 0; i <= 2; ++i) {
1604 data->oppoint[i] = lm85_read_value(client,
1605 ADT7463_REG_OPPOINT(i) );
1606 }
1607 data->tmin_ctl = lm85_read_value(client,
1608 ADT7463_REG_TMIN_CTL1 );
1609 data->therm_limit = lm85_read_value(client,
1610 ADT7463_REG_THERM_LIMIT );
1611 }
1612 for (i = 0; i <= 2; ++i) {
1613 data->temp_offset[i] = lm85_read_value(client,
1614 ADM1027_REG_TEMP_OFFSET(i) );
1615 }
1616 data->tach_mode = lm85_read_value(client,
1617 ADM1027_REG_CONFIG3 );
1618 data->fan_ppr = lm85_read_value(client,
1619 ADM1027_REG_FAN_PPR );
1620 }
1621
1622 data->last_config = jiffies; 1506 data->last_config = jiffies;
1623 }; /* last_config */ 1507 } /* last_config */
1624 1508
1625 data->valid = 1; 1509 data->valid = 1;
1626 1510
@@ -1635,17 +1519,15 @@ static int __init sm_lm85_init(void)
1635 return i2c_add_driver(&lm85_driver); 1519 return i2c_add_driver(&lm85_driver);
1636} 1520}
1637 1521
1638static void __exit sm_lm85_exit(void) 1522static void __exit sm_lm85_exit(void)
1639{ 1523{
1640 i2c_del_driver(&lm85_driver); 1524 i2c_del_driver(&lm85_driver);
1641} 1525}
1642 1526
1643/* Thanks to Richard Barrington for adding the LM85 to sensors-detect.
1644 * Thanks to Margit Schubert-While <margitsw@t-online.de> for help with
1645 * post 2.7.0 CVS changes.
1646 */
1647MODULE_LICENSE("GPL"); 1527MODULE_LICENSE("GPL");
1648MODULE_AUTHOR("Philip Pokorny <ppokorny@penguincomputing.com>, Margit Schubert-While <margitsw@t-online.de>, Justin Thiessen <jthiessen@penguincomputing.com"); 1528MODULE_AUTHOR("Philip Pokorny <ppokorny@penguincomputing.com>, "
1529 "Margit Schubert-While <margitsw@t-online.de>, "
1530 "Justin Thiessen <jthiessen@penguincomputing.com>");
1649MODULE_DESCRIPTION("LM85-B, LM85-C driver"); 1531MODULE_DESCRIPTION("LM85-B, LM85-C driver");
1650 1532
1651module_init(sm_lm85_init); 1533module_init(sm_lm85_init);
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
index 48d084bdf7c8..3c855ff2992f 100644
--- a/drivers/i2c/busses/i2c-bfin-twi.c
+++ b/drivers/i2c/busses/i2c-bfin-twi.c
@@ -49,6 +49,8 @@ struct bfin_twi_iface {
49 struct i2c_msg *pmsg; 49 struct i2c_msg *pmsg;
50 int msg_num; 50 int msg_num;
51 int cur_msg; 51 int cur_msg;
52 u16 saved_clkdiv;
53 u16 saved_control;
52 void __iomem *regs_base; 54 void __iomem *regs_base;
53}; 55};
54 56
@@ -565,32 +567,43 @@ static u32 bfin_twi_functionality(struct i2c_adapter *adap)
565 I2C_FUNC_I2C; 567 I2C_FUNC_I2C;
566} 568}
567 569
568
569static struct i2c_algorithm bfin_twi_algorithm = { 570static struct i2c_algorithm bfin_twi_algorithm = {
570 .master_xfer = bfin_twi_master_xfer, 571 .master_xfer = bfin_twi_master_xfer,
571 .smbus_xfer = bfin_twi_smbus_xfer, 572 .smbus_xfer = bfin_twi_smbus_xfer,
572 .functionality = bfin_twi_functionality, 573 .functionality = bfin_twi_functionality,
573}; 574};
574 575
575 576static int i2c_bfin_twi_suspend(struct platform_device *pdev, pm_message_t state)
576static int i2c_bfin_twi_suspend(struct platform_device *dev, pm_message_t state)
577{ 577{
578 struct bfin_twi_iface *iface = platform_get_drvdata(dev); 578 struct bfin_twi_iface *iface = platform_get_drvdata(pdev);
579
580 iface->saved_clkdiv = read_CLKDIV(iface);
581 iface->saved_control = read_CONTROL(iface);
582
583 free_irq(iface->irq, iface);
579 584
580 /* Disable TWI */ 585 /* Disable TWI */
581 write_CONTROL(iface, read_CONTROL(iface) & ~TWI_ENA); 586 write_CONTROL(iface, iface->saved_control & ~TWI_ENA);
582 SSYNC();
583 587
584 return 0; 588 return 0;
585} 589}
586 590
587static int i2c_bfin_twi_resume(struct platform_device *dev) 591static int i2c_bfin_twi_resume(struct platform_device *pdev)
588{ 592{
589 struct bfin_twi_iface *iface = platform_get_drvdata(dev); 593 struct bfin_twi_iface *iface = platform_get_drvdata(pdev);
590 594
591 /* Enable TWI */ 595 int rc = request_irq(iface->irq, bfin_twi_interrupt_entry,
592 write_CONTROL(iface, read_CONTROL(iface) | TWI_ENA); 596 IRQF_DISABLED, pdev->name, iface);
593 SSYNC(); 597 if (rc) {
598 dev_err(&pdev->dev, "Can't get IRQ %d !\n", iface->irq);
599 return -ENODEV;
600 }
601
602 /* Resume TWI interface clock as specified */
603 write_CLKDIV(iface, iface->saved_clkdiv);
604
605 /* Resume TWI */
606 write_CONTROL(iface, iface->saved_control);
594 607
595 return 0; 608 return 0;
596} 609}
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 79b455a1f090..32104eac8d3d 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -77,7 +77,7 @@ static int i2c_gpio_getscl(void *data)
77 return gpio_get_value(pdata->scl_pin); 77 return gpio_get_value(pdata->scl_pin);
78} 78}
79 79
80static int __init i2c_gpio_probe(struct platform_device *pdev) 80static int __devinit i2c_gpio_probe(struct platform_device *pdev)
81{ 81{
82 struct i2c_gpio_platform_data *pdata; 82 struct i2c_gpio_platform_data *pdata;
83 struct i2c_algo_bit_data *bit_data; 83 struct i2c_algo_bit_data *bit_data;
@@ -174,7 +174,7 @@ err_alloc_adap:
174 return ret; 174 return ret;
175} 175}
176 176
177static int __exit i2c_gpio_remove(struct platform_device *pdev) 177static int __devexit i2c_gpio_remove(struct platform_device *pdev)
178{ 178{
179 struct i2c_gpio_platform_data *pdata; 179 struct i2c_gpio_platform_data *pdata;
180 struct i2c_adapter *adap; 180 struct i2c_adapter *adap;
@@ -196,14 +196,15 @@ static struct platform_driver i2c_gpio_driver = {
196 .name = "i2c-gpio", 196 .name = "i2c-gpio",
197 .owner = THIS_MODULE, 197 .owner = THIS_MODULE,
198 }, 198 },
199 .remove = __exit_p(i2c_gpio_remove), 199 .probe = i2c_gpio_probe,
200 .remove = __devexit_p(i2c_gpio_remove),
200}; 201};
201 202
202static int __init i2c_gpio_init(void) 203static int __init i2c_gpio_init(void)
203{ 204{
204 int ret; 205 int ret;
205 206
206 ret = platform_driver_probe(&i2c_gpio_driver, i2c_gpio_probe); 207 ret = platform_driver_register(&i2c_gpio_driver);
207 if (ret) 208 if (ret)
208 printk(KERN_ERR "i2c-gpio: probe failed: %d\n", ret); 209 printk(KERN_ERR "i2c-gpio: probe failed: %d\n", ret);
209 210
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 007390ad9810..4864723c7425 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -33,6 +33,7 @@
33#include <linux/err.h> 33#include <linux/err.h>
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35#include <linux/clk.h> 35#include <linux/clk.h>
36#include <linux/cpufreq.h>
36 37
37#include <asm/hardware.h> 38#include <asm/hardware.h>
38#include <asm/irq.h> 39#include <asm/irq.h>
@@ -64,6 +65,7 @@ struct s3c24xx_i2c {
64 unsigned int tx_setup; 65 unsigned int tx_setup;
65 66
66 enum s3c24xx_i2c_state state; 67 enum s3c24xx_i2c_state state;
68 unsigned long clkrate;
67 69
68 void __iomem *regs; 70 void __iomem *regs;
69 struct clk *clk; 71 struct clk *clk;
@@ -71,6 +73,10 @@ struct s3c24xx_i2c {
71 struct resource *irq; 73 struct resource *irq;
72 struct resource *ioarea; 74 struct resource *ioarea;
73 struct i2c_adapter adap; 75 struct i2c_adapter adap;
76
77#ifdef CONFIG_CPU_FREQ
78 struct notifier_block freq_transition;
79#endif
74}; 80};
75 81
76/* default platform data to use if not supplied in the platform_device 82/* default platform data to use if not supplied in the platform_device
@@ -501,6 +507,9 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg *msgs, int
501 unsigned long timeout; 507 unsigned long timeout;
502 int ret; 508 int ret;
503 509
510 if (!readl(i2c->regs + S3C2410_IICCON) & S3C2410_IICCON_IRQEN)
511 return -EIO;
512
504 ret = s3c24xx_i2c_set_master(i2c); 513 ret = s3c24xx_i2c_set_master(i2c);
505 if (ret != 0) { 514 if (ret != 0) {
506 dev_err(i2c->dev, "cannot get bus (error %d)\n", ret); 515 dev_err(i2c->dev, "cannot get bus (error %d)\n", ret);
@@ -636,27 +645,28 @@ static inline int freq_acceptable(unsigned int freq, unsigned int wanted)
636 return (diff >= -2 && diff <= 2); 645 return (diff >= -2 && diff <= 2);
637} 646}
638 647
639/* s3c24xx_i2c_getdivisor 648/* s3c24xx_i2c_clockrate
640 * 649 *
641 * work out a divisor for the user requested frequency setting, 650 * work out a divisor for the user requested frequency setting,
642 * either by the requested frequency, or scanning the acceptable 651 * either by the requested frequency, or scanning the acceptable
643 * range of frequencies until something is found 652 * range of frequencies until something is found
644*/ 653*/
645 654
646static int s3c24xx_i2c_getdivisor(struct s3c24xx_i2c *i2c, 655static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
647 struct s3c2410_platform_i2c *pdata,
648 unsigned long *iicon,
649 unsigned int *got)
650{ 656{
657 struct s3c2410_platform_i2c *pdata;
651 unsigned long clkin = clk_get_rate(i2c->clk); 658 unsigned long clkin = clk_get_rate(i2c->clk);
652
653 unsigned int divs, div1; 659 unsigned int divs, div1;
660 u32 iiccon;
654 int freq; 661 int freq;
655 int start, end; 662 int start, end;
656 663
664 i2c->clkrate = clkin;
665
666 pdata = s3c24xx_i2c_get_platformdata(i2c->adap.dev.parent);
657 clkin /= 1000; /* clkin now in KHz */ 667 clkin /= 1000; /* clkin now in KHz */
658 668
659 dev_dbg(i2c->dev, "pdata %p, freq %lu %lu..%lu\n", 669 dev_dbg(i2c->dev, "pdata %p, freq %lu %lu..%lu\n",
660 pdata, pdata->bus_freq, pdata->min_freq, pdata->max_freq); 670 pdata, pdata->bus_freq, pdata->min_freq, pdata->max_freq);
661 671
662 if (pdata->bus_freq != 0) { 672 if (pdata->bus_freq != 0) {
@@ -688,11 +698,79 @@ static int s3c24xx_i2c_getdivisor(struct s3c24xx_i2c *i2c,
688 698
689 found: 699 found:
690 *got = freq; 700 *got = freq;
691 *iicon |= (divs-1); 701
692 *iicon |= (div1 == 512) ? S3C2410_IICCON_TXDIV_512 : 0; 702 iiccon = readl(i2c->regs + S3C2410_IICCON);
703 iiccon &= ~(S3C2410_IICCON_SCALEMASK | S3C2410_IICCON_TXDIV_512);
704 iiccon |= (divs-1);
705
706 if (div1 == 512)
707 iiccon |= S3C2410_IICCON_TXDIV_512;
708
709 writel(iiccon, i2c->regs + S3C2410_IICCON);
710
711 return 0;
712}
713
714#ifdef CONFIG_CPU_FREQ
715
716#define freq_to_i2c(_n) container_of(_n, struct s3c24xx_i2c, freq_transition)
717
718static int s3c24xx_i2c_cpufreq_transition(struct notifier_block *nb,
719 unsigned long val, void *data)
720{
721 struct s3c24xx_i2c *i2c = freq_to_i2c(nb);
722 unsigned long flags;
723 unsigned int got;
724 int delta_f;
725 int ret;
726
727 delta_f = clk_get_rate(i2c->clk) - i2c->clkrate;
728
729 /* if we're post-change and the input clock has slowed down
730 * or at pre-change and the clock is about to speed up, then
731 * adjust our clock rate. <0 is slow, >0 speedup.
732 */
733
734 if ((val == CPUFREQ_POSTCHANGE && delta_f < 0) ||
735 (val == CPUFREQ_PRECHANGE && delta_f > 0)) {
736 spin_lock_irqsave(&i2c->lock, flags);
737 ret = s3c24xx_i2c_clockrate(i2c, &got);
738 spin_unlock_irqrestore(&i2c->lock, flags);
739
740 if (ret < 0)
741 dev_err(i2c->dev, "cannot find frequency\n");
742 else
743 dev_info(i2c->dev, "setting freq %d\n", got);
744 }
745
746 return 0;
747}
748
749static inline int s3c24xx_i2c_register_cpufreq(struct s3c24xx_i2c *i2c)
750{
751 i2c->freq_transition.notifier_call = s3c24xx_i2c_cpufreq_transition;
752
753 return cpufreq_register_notifier(&i2c->freq_transition,
754 CPUFREQ_TRANSITION_NOTIFIER);
755}
756
757static inline void s3c24xx_i2c_deregister_cpufreq(struct s3c24xx_i2c *i2c)
758{
759 cpufreq_unregister_notifier(&i2c->freq_transition,
760 CPUFREQ_TRANSITION_NOTIFIER);
761}
762
763#else
764static inline int s3c24xx_i2c_register_cpufreq(struct s3c24xx_i2c *i2c)
765{
693 return 0; 766 return 0;
694} 767}
695 768
769static inline void s3c24xx_i2c_deregister_cpufreq(struct s3c24xx_i2c *i2c)
770{
771}
772#endif
773
696/* s3c24xx_i2c_init 774/* s3c24xx_i2c_init
697 * 775 *
698 * initialise the controller, set the IO lines and frequency 776 * initialise the controller, set the IO lines and frequency
@@ -719,9 +797,12 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
719 797
720 dev_info(i2c->dev, "slave address 0x%02x\n", pdata->slave_addr); 798 dev_info(i2c->dev, "slave address 0x%02x\n", pdata->slave_addr);
721 799
800 writel(iicon, i2c->regs + S3C2410_IICCON);
801
722 /* we need to work out the divisors for the clock... */ 802 /* we need to work out the divisors for the clock... */
723 803
724 if (s3c24xx_i2c_getdivisor(i2c, pdata, &iicon, &freq) != 0) { 804 if (s3c24xx_i2c_clockrate(i2c, &freq) != 0) {
805 writel(0, i2c->regs + S3C2410_IICCON);
725 dev_err(i2c->dev, "cannot meet bus frequency required\n"); 806 dev_err(i2c->dev, "cannot meet bus frequency required\n");
726 return -EINVAL; 807 return -EINVAL;
727 } 808 }
@@ -730,8 +811,6 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
730 811
731 dev_info(i2c->dev, "bus frequency set to %d KHz\n", freq); 812 dev_info(i2c->dev, "bus frequency set to %d KHz\n", freq);
732 dev_dbg(i2c->dev, "S3C2410_IICCON=0x%02lx\n", iicon); 813 dev_dbg(i2c->dev, "S3C2410_IICCON=0x%02lx\n", iicon);
733
734 writel(iicon, i2c->regs + S3C2410_IICCON);
735 814
736 /* check for s3c2440 i2c controller */ 815 /* check for s3c2440 i2c controller */
737 816
@@ -752,9 +831,12 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
752static int s3c24xx_i2c_probe(struct platform_device *pdev) 831static int s3c24xx_i2c_probe(struct platform_device *pdev)
753{ 832{
754 struct s3c24xx_i2c *i2c = &s3c24xx_i2c; 833 struct s3c24xx_i2c *i2c = &s3c24xx_i2c;
834 struct s3c2410_platform_i2c *pdata;
755 struct resource *res; 835 struct resource *res;
756 int ret; 836 int ret;
757 837
838 pdata = s3c24xx_i2c_get_platformdata(&pdev->dev);
839
758 /* find the clock and enable it */ 840 /* find the clock and enable it */
759 841
760 i2c->dev = &pdev->dev; 842 i2c->dev = &pdev->dev;
@@ -832,17 +914,34 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
832 dev_dbg(&pdev->dev, "irq resource %p (%lu)\n", res, 914 dev_dbg(&pdev->dev, "irq resource %p (%lu)\n", res,
833 (unsigned long)res->start); 915 (unsigned long)res->start);
834 916
835 ret = i2c_add_adapter(&i2c->adap); 917 ret = s3c24xx_i2c_register_cpufreq(i2c);
836 if (ret < 0) { 918 if (ret < 0) {
837 dev_err(&pdev->dev, "failed to add bus to i2c core\n"); 919 dev_err(&pdev->dev, "failed to register cpufreq notifier\n");
838 goto err_irq; 920 goto err_irq;
839 } 921 }
840 922
923 /* Note, previous versions of the driver used i2c_add_adapter()
924 * to add the bus at any number. We now pass the bus number via
925 * the platform data, so if unset it will now default to always
926 * being bus 0.
927 */
928
929 i2c->adap.nr = pdata->bus_num;
930
931 ret = i2c_add_numbered_adapter(&i2c->adap);
932 if (ret < 0) {
933 dev_err(&pdev->dev, "failed to add bus to i2c core\n");
934 goto err_cpufreq;
935 }
936
841 platform_set_drvdata(pdev, i2c); 937 platform_set_drvdata(pdev, i2c);
842 938
843 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id); 939 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id);
844 return 0; 940 return 0;
845 941
942 err_cpufreq:
943 s3c24xx_i2c_deregister_cpufreq(i2c);
944
846 err_irq: 945 err_irq:
847 free_irq(i2c->irq->start, i2c); 946 free_irq(i2c->irq->start, i2c);
848 947
@@ -870,6 +969,8 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev)
870{ 969{
871 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); 970 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
872 971
972 s3c24xx_i2c_deregister_cpufreq(i2c);
973
873 i2c_del_adapter(&i2c->adap); 974 i2c_del_adapter(&i2c->adap);
874 free_irq(i2c->irq->start, i2c); 975 free_irq(i2c->irq->start, i2c);
875 976
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index c521bf6e1bf2..fa2be26272d5 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1086,6 +1086,11 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, hw_regs_t *hw)
1086 /* Make sure we have sane timings */ 1086 /* Make sure we have sane timings */
1087 sanitize_timings(pmif); 1087 sanitize_timings(pmif);
1088 1088
1089 host = ide_host_alloc(&d, hws);
1090 if (host == NULL)
1091 return -ENOMEM;
1092 hwif = host->ports[0];
1093
1089#ifndef CONFIG_PPC64 1094#ifndef CONFIG_PPC64
1090 /* XXX FIXME: Media bay stuff need re-organizing */ 1095 /* XXX FIXME: Media bay stuff need re-organizing */
1091 if (np->parent && np->parent->name 1096 if (np->parent && np->parent->name
@@ -1119,11 +1124,11 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif, hw_regs_t *hw)
1119 pmif->mdev ? "macio" : "PCI", pmif->aapl_bus_id, 1124 pmif->mdev ? "macio" : "PCI", pmif->aapl_bus_id,
1120 pmif->mediabay ? " (mediabay)" : "", hw->irq); 1125 pmif->mediabay ? " (mediabay)" : "", hw->irq);
1121 1126
1122 rc = ide_host_add(&d, hws, &host); 1127 rc = ide_host_register(host, &d, hws);
1123 if (rc) 1128 if (rc) {
1129 ide_host_free(host);
1124 return rc; 1130 return rc;
1125 1131 }
1126 hwif = host->ports[0];
1127 1132
1128 return 0; 1133 return 0;
1129} 1134}
diff --git a/drivers/input/keyboard/maple_keyb.c b/drivers/input/keyboard/maple_keyb.c
index 2b404284c28a..7797ef6e5e64 100644
--- a/drivers/input/keyboard/maple_keyb.c
+++ b/drivers/input/keyboard/maple_keyb.c
@@ -27,7 +27,6 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/timer.h> 28#include <linux/timer.h>
29#include <linux/maple.h> 29#include <linux/maple.h>
30#include <asm/mach/maple.h>
31 30
32/* Very simple mutex to ensure proper cleanup */ 31/* Very simple mutex to ensure proper cleanup */
33static DEFINE_MUTEX(maple_keyb_mutex); 32static DEFINE_MUTEX(maple_keyb_mutex);
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c
index 8486abc457ed..c600ab7f93e8 100644
--- a/drivers/input/keyboard/sh_keysc.c
+++ b/drivers/input/keyboard/sh_keysc.c
@@ -158,25 +158,18 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
158 memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata)); 158 memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata));
159 pdata = &priv->pdata; 159 pdata = &priv->pdata;
160 160
161 res = request_mem_region(res->start, res_size(res), pdev->name);
162 if (res == NULL) {
163 dev_err(&pdev->dev, "failed to request I/O memory\n");
164 error = -EBUSY;
165 goto err1;
166 }
167
168 priv->iomem_base = ioremap_nocache(res->start, res_size(res)); 161 priv->iomem_base = ioremap_nocache(res->start, res_size(res));
169 if (priv->iomem_base == NULL) { 162 if (priv->iomem_base == NULL) {
170 dev_err(&pdev->dev, "failed to remap I/O memory\n"); 163 dev_err(&pdev->dev, "failed to remap I/O memory\n");
171 error = -ENXIO; 164 error = -ENXIO;
172 goto err2; 165 goto err1;
173 } 166 }
174 167
175 priv->input = input_allocate_device(); 168 priv->input = input_allocate_device();
176 if (!priv->input) { 169 if (!priv->input) {
177 dev_err(&pdev->dev, "failed to allocate input device\n"); 170 dev_err(&pdev->dev, "failed to allocate input device\n");
178 error = -ENOMEM; 171 error = -ENOMEM;
179 goto err3; 172 goto err2;
180 } 173 }
181 174
182 input = priv->input; 175 input = priv->input;
@@ -194,7 +187,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
194 error = request_irq(irq, sh_keysc_isr, 0, pdev->name, pdev); 187 error = request_irq(irq, sh_keysc_isr, 0, pdev->name, pdev);
195 if (error) { 188 if (error) {
196 dev_err(&pdev->dev, "failed to request IRQ\n"); 189 dev_err(&pdev->dev, "failed to request IRQ\n");
197 goto err4; 190 goto err3;
198 } 191 }
199 192
200 for (i = 0; i < SH_KEYSC_MAXKEYS; i++) { 193 for (i = 0; i < SH_KEYSC_MAXKEYS; i++) {
@@ -206,7 +199,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
206 error = input_register_device(input); 199 error = input_register_device(input);
207 if (error) { 200 if (error) {
208 dev_err(&pdev->dev, "failed to register input device\n"); 201 dev_err(&pdev->dev, "failed to register input device\n");
209 goto err5; 202 goto err4;
210 } 203 }
211 204
212 iowrite16((sh_keysc_mode[pdata->mode].kymd << 8) | 205 iowrite16((sh_keysc_mode[pdata->mode].kymd << 8) |
@@ -214,14 +207,12 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
214 iowrite16(0, priv->iomem_base + KYOUTDR_OFFS); 207 iowrite16(0, priv->iomem_base + KYOUTDR_OFFS);
215 iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS); 208 iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS);
216 return 0; 209 return 0;
217 err5:
218 free_irq(irq, pdev);
219 err4: 210 err4:
220 input_free_device(input); 211 free_irq(irq, pdev);
221 err3: 212 err3:
222 iounmap(priv->iomem_base); 213 input_free_device(input);
223 err2: 214 err2:
224 release_mem_region(res->start, res_size(res)); 215 iounmap(priv->iomem_base);
225 err1: 216 err1:
226 platform_set_drvdata(pdev, NULL); 217 platform_set_drvdata(pdev, NULL);
227 kfree(priv); 218 kfree(priv);
@@ -232,7 +223,6 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
232static int __devexit sh_keysc_remove(struct platform_device *pdev) 223static int __devexit sh_keysc_remove(struct platform_device *pdev)
233{ 224{
234 struct sh_keysc_priv *priv = platform_get_drvdata(pdev); 225 struct sh_keysc_priv *priv = platform_get_drvdata(pdev);
235 struct resource *res;
236 226
237 iowrite16(KYCR2_IRQ_DISABLED, priv->iomem_base + KYCR2_OFFS); 227 iowrite16(KYCR2_IRQ_DISABLED, priv->iomem_base + KYCR2_OFFS);
238 228
@@ -240,9 +230,6 @@ static int __devexit sh_keysc_remove(struct platform_device *pdev)
240 free_irq(platform_get_irq(pdev, 0), pdev); 230 free_irq(platform_get_irq(pdev, 0), pdev);
241 iounmap(priv->iomem_base); 231 iounmap(priv->iomem_base);
242 232
243 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
244 release_mem_region(res->start, res_size(res));
245
246 platform_set_drvdata(pdev, NULL); 233 platform_set_drvdata(pdev, NULL);
247 kfree(priv); 234 kfree(priv);
248 return 0; 235 return 0;
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 2bcfa0b35061..223d56d5555b 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -37,7 +37,6 @@
37#include <linux/fs.h> 37#include <linux/fs.h>
38#include <linux/miscdevice.h> 38#include <linux/miscdevice.h>
39#include <linux/uinput.h> 39#include <linux/uinput.h>
40#include <linux/smp_lock.h>
41 40
42static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 41static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
43{ 42{
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 78f2abb5c11b..2f12d60eee3b 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -63,8 +63,9 @@ static LIST_HEAD(serio_list);
63static struct bus_type serio_bus; 63static struct bus_type serio_bus;
64 64
65static void serio_add_port(struct serio *serio); 65static void serio_add_port(struct serio *serio);
66static void serio_reconnect_port(struct serio *serio); 66static int serio_reconnect_port(struct serio *serio);
67static void serio_disconnect_port(struct serio *serio); 67static void serio_disconnect_port(struct serio *serio);
68static void serio_reconnect_chain(struct serio *serio);
68static void serio_attach_driver(struct serio_driver *drv); 69static void serio_attach_driver(struct serio_driver *drv);
69 70
70static int serio_connect_driver(struct serio *serio, struct serio_driver *drv) 71static int serio_connect_driver(struct serio *serio, struct serio_driver *drv)
@@ -161,6 +162,7 @@ static void serio_find_driver(struct serio *serio)
161enum serio_event_type { 162enum serio_event_type {
162 SERIO_RESCAN_PORT, 163 SERIO_RESCAN_PORT,
163 SERIO_RECONNECT_PORT, 164 SERIO_RECONNECT_PORT,
165 SERIO_RECONNECT_CHAIN,
164 SERIO_REGISTER_PORT, 166 SERIO_REGISTER_PORT,
165 SERIO_ATTACH_DRIVER, 167 SERIO_ATTACH_DRIVER,
166}; 168};
@@ -315,6 +317,10 @@ static void serio_handle_event(void)
315 serio_find_driver(event->object); 317 serio_find_driver(event->object);
316 break; 318 break;
317 319
320 case SERIO_RECONNECT_CHAIN:
321 serio_reconnect_chain(event->object);
322 break;
323
318 case SERIO_ATTACH_DRIVER: 324 case SERIO_ATTACH_DRIVER:
319 serio_attach_driver(event->object); 325 serio_attach_driver(event->object);
320 break; 326 break;
@@ -470,7 +476,7 @@ static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *
470 if (!strncmp(buf, "none", count)) { 476 if (!strncmp(buf, "none", count)) {
471 serio_disconnect_port(serio); 477 serio_disconnect_port(serio);
472 } else if (!strncmp(buf, "reconnect", count)) { 478 } else if (!strncmp(buf, "reconnect", count)) {
473 serio_reconnect_port(serio); 479 serio_reconnect_chain(serio);
474 } else if (!strncmp(buf, "rescan", count)) { 480 } else if (!strncmp(buf, "rescan", count)) {
475 serio_disconnect_port(serio); 481 serio_disconnect_port(serio);
476 serio_find_driver(serio); 482 serio_find_driver(serio);
@@ -620,14 +626,30 @@ static void serio_destroy_port(struct serio *serio)
620} 626}
621 627
622/* 628/*
629 * Reconnect serio port (re-initialize attached device).
630 * If reconnect fails (old device is no longer attached or
631 * there was no device to begin with) we do full rescan in
632 * hope of finding a driver for the port.
633 */
634static int serio_reconnect_port(struct serio *serio)
635{
636 int error = serio_reconnect_driver(serio);
637
638 if (error) {
639 serio_disconnect_port(serio);
640 serio_find_driver(serio);
641 }
642
643 return error;
644}
645
646/*
623 * Reconnect serio port and all its children (re-initialize attached devices) 647 * Reconnect serio port and all its children (re-initialize attached devices)
624 */ 648 */
625static void serio_reconnect_port(struct serio *serio) 649static void serio_reconnect_chain(struct serio *serio)
626{ 650{
627 do { 651 do {
628 if (serio_reconnect_driver(serio)) { 652 if (serio_reconnect_port(serio)) {
629 serio_disconnect_port(serio);
630 serio_find_driver(serio);
631 /* Ok, old children are now gone, we are done */ 653 /* Ok, old children are now gone, we are done */
632 break; 654 break;
633 } 655 }
@@ -673,7 +695,7 @@ void serio_rescan(struct serio *serio)
673 695
674void serio_reconnect(struct serio *serio) 696void serio_reconnect(struct serio *serio)
675{ 697{
676 serio_queue_event(serio, NULL, SERIO_RECONNECT_PORT); 698 serio_queue_event(serio, NULL, SERIO_RECONNECT_CHAIN);
677} 699}
678 700
679/* 701/*
@@ -927,19 +949,16 @@ static int serio_suspend(struct device *dev, pm_message_t state)
927 949
928static int serio_resume(struct device *dev) 950static int serio_resume(struct device *dev)
929{ 951{
930 struct serio *serio = to_serio_port(dev); 952 /*
931 953 * Driver reconnect can take a while, so better let kseriod
932 if (dev->power.power_state.event != PM_EVENT_ON && 954 * deal with it.
933 serio_reconnect_driver(serio)) { 955 */
934 /* 956 if (dev->power.power_state.event != PM_EVENT_ON) {
935 * Driver re-probing can take a while, so better let kseriod 957 dev->power.power_state = PMSG_ON;
936 * deal with it. 958 serio_queue_event(to_serio_port(dev), NULL,
937 */ 959 SERIO_RECONNECT_PORT);
938 serio_rescan(serio);
939 } 960 }
940 961
941 dev->power.power_state = PMSG_ON;
942
943 return 0; 962 return 0;
944} 963}
945#endif /* CONFIG_PM */ 964#endif /* CONFIG_PM */
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index e57366521572..6e60a97a234c 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -205,6 +205,18 @@ config TOUCHSCREEN_TOUCHWIN
205 To compile this driver as a module, choose M here: the 205 To compile this driver as a module, choose M here: the
206 module will be called touchwin. 206 module will be called touchwin.
207 207
208config TOUCHSCREEN_ATMEL_TSADCC
209 tristate "Atmel Touchscreen Interface"
210 depends on ARCH_AT91SAM9RL
211 help
212 Say Y here if you have a 4-wire touchscreen connected to the
213 ADC Controller on your Atmel SoC (such as the AT91SAM9RL).
214
215 If unsure, say N.
216
217 To compile this driver as a module, choose M here: the
218 module will be called atmel_tsadcc.
219
208config TOUCHSCREEN_UCB1400 220config TOUCHSCREEN_UCB1400
209 tristate "Philips UCB1400 touchscreen" 221 tristate "Philips UCB1400 touchscreen"
210 select AC97_BUS 222 select AC97_BUS
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index 39a804cd80f1..15cf29079489 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -7,6 +7,7 @@
7wm97xx-ts-y := wm97xx-core.o 7wm97xx-ts-y := wm97xx-core.o
8 8
9obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o 9obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o
10obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o
10obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o 11obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o
11obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o 12obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o
12obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o 13obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 907a45fe9d40..ce6f48c695f5 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -517,7 +517,9 @@ static void ads7846_rx(void *ads)
517 if (x == MAX_12BIT) 517 if (x == MAX_12BIT)
518 x = 0; 518 x = 0;
519 519
520 if (likely(x && z1)) { 520 if (ts->model == 7843) {
521 Rt = ts->pressure_max / 2;
522 } else if (likely(x && z1)) {
521 /* compute touch pressure resistance using equation #2 */ 523 /* compute touch pressure resistance using equation #2 */
522 Rt = z2; 524 Rt = z2;
523 Rt -= z1; 525 Rt -= z1;
@@ -525,11 +527,9 @@ static void ads7846_rx(void *ads)
525 Rt *= ts->x_plate_ohms; 527 Rt *= ts->x_plate_ohms;
526 Rt /= z1; 528 Rt /= z1;
527 Rt = (Rt + 2047) >> 12; 529 Rt = (Rt + 2047) >> 12;
528 } else 530 } else {
529 Rt = 0; 531 Rt = 0;
530 532 }
531 if (ts->model == 7843)
532 Rt = ts->pressure_max / 2;
533 533
534 /* Sample found inconsistent by debouncing or pressure is beyond 534 /* Sample found inconsistent by debouncing or pressure is beyond
535 * the maximum. Don't report it to user space, repeat at least 535 * the maximum. Don't report it to user space, repeat at least
@@ -633,19 +633,17 @@ static void ads7846_rx_val(void *ads)
633 struct ads7846 *ts = ads; 633 struct ads7846 *ts = ads;
634 struct spi_message *m; 634 struct spi_message *m;
635 struct spi_transfer *t; 635 struct spi_transfer *t;
636 u16 *rx_val;
637 int val; 636 int val;
638 int action; 637 int action;
639 int status; 638 int status;
640 639
641 m = &ts->msg[ts->msg_idx]; 640 m = &ts->msg[ts->msg_idx];
642 t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list); 641 t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list);
643 rx_val = t->rx_buf;
644 642
645 /* adjust: on-wire is a must-ignore bit, a BE12 value, then padding; 643 /* adjust: on-wire is a must-ignore bit, a BE12 value, then padding;
646 * built from two 8 bit values written msb-first. 644 * built from two 8 bit values written msb-first.
647 */ 645 */
648 val = be16_to_cpu(*rx_val) >> 3; 646 val = be16_to_cpup((__be16 *)t->rx_buf) >> 3;
649 647
650 action = ts->filter(ts->filter_data, ts->msg_idx, &val); 648 action = ts->filter(ts->filter_data, ts->msg_idx, &val);
651 switch (action) { 649 switch (action) {
@@ -659,7 +657,7 @@ static void ads7846_rx_val(void *ads)
659 m = ts->last_msg; 657 m = ts->last_msg;
660 break; 658 break;
661 case ADS7846_FILTER_OK: 659 case ADS7846_FILTER_OK:
662 *rx_val = val; 660 *(u16 *)t->rx_buf = val;
663 ts->tc.ignore = 0; 661 ts->tc.ignore = 0;
664 m = &ts->msg[++ts->msg_idx]; 662 m = &ts->msg[++ts->msg_idx];
665 break; 663 break;
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c
new file mode 100644
index 000000000000..eee126b19e8b
--- /dev/null
+++ b/drivers/input/touchscreen/atmel_tsadcc.c
@@ -0,0 +1,332 @@
1/*
2 * Atmel Touch Screen Driver
3 *
4 * Copyright (c) 2008 ATMEL
5 * Copyright (c) 2008 Dan Liang
6 * Copyright (c) 2008 TimeSys Corporation
7 * Copyright (c) 2008 Justin Waters
8 *
9 * Based on touchscreen code from Atmel Corporation.
10 *
11 * 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 * published by the Free Software Foundation.
14 */
15#include <linux/init.h>
16#include <linux/err.h>
17#include <linux/kernel.h>
18#include <linux/module.h>
19#include <linux/input.h>
20#include <linux/slab.h>
21#include <linux/interrupt.h>
22#include <linux/clk.h>
23#include <linux/platform_device.h>
24#include <linux/io.h>
25
26/* Register definitions based on AT91SAM9RL64 preliminary draft datasheet */
27
28#define ATMEL_TSADCC_CR 0x00 /* Control register */
29#define ATMEL_TSADCC_SWRST (1 << 0) /* Software Reset*/
30#define ATMEL_TSADCC_START (1 << 1) /* Start conversion */
31
32#define ATMEL_TSADCC_MR 0x04 /* Mode register */
33#define ATMEL_TSADCC_TSAMOD (3 << 0) /* ADC mode */
34#define ATMEL_TSADCC_TSAMOD_ADC_ONLY_MODE (0x0) /* ADC Mode */
35#define ATMEL_TSADCC_TSAMOD_TS_ONLY_MODE (0x1) /* Touch Screen Only Mode */
36#define ATMEL_TSADCC_LOWRES (1 << 4) /* Resolution selection */
37#define ATMEL_TSADCC_SLEEP (1 << 5) /* Sleep mode */
38#define ATMEL_TSADCC_PENDET (1 << 6) /* Pen Detect selection */
39#define ATMEL_TSADCC_PRESCAL (0x3f << 8) /* Prescalar Rate Selection */
40#define ATMEL_TSADCC_STARTUP (0x7f << 16) /* Start Up time */
41#define ATMEL_TSADCC_SHTIM (0xf << 24) /* Sample & Hold time */
42#define ATMEL_TSADCC_PENDBC (0xf << 28) /* Pen Detect debouncing time */
43
44#define ATMEL_TSADCC_TRGR 0x08 /* Trigger register */
45#define ATMEL_TSADCC_TRGMOD (7 << 0) /* Trigger mode */
46#define ATMEL_TSADCC_TRGMOD_NONE (0 << 0)
47#define ATMEL_TSADCC_TRGMOD_EXT_RISING (1 << 0)
48#define ATMEL_TSADCC_TRGMOD_EXT_FALLING (2 << 0)
49#define ATMEL_TSADCC_TRGMOD_EXT_ANY (3 << 0)
50#define ATMEL_TSADCC_TRGMOD_PENDET (4 << 0)
51#define ATMEL_TSADCC_TRGMOD_PERIOD (5 << 0)
52#define ATMEL_TSADCC_TRGMOD_CONTINUOUS (6 << 0)
53#define ATMEL_TSADCC_TRGPER (0xffff << 16) /* Trigger period */
54
55#define ATMEL_TSADCC_TSR 0x0C /* Touch Screen register */
56#define ATMEL_TSADCC_TSFREQ (0xf << 0) /* TS Frequency in Interleaved mode */
57#define ATMEL_TSADCC_TSSHTIM (0xf << 24) /* Sample & Hold time */
58
59#define ATMEL_TSADCC_CHER 0x10 /* Channel Enable register */
60#define ATMEL_TSADCC_CHDR 0x14 /* Channel Disable register */
61#define ATMEL_TSADCC_CHSR 0x18 /* Channel Status register */
62#define ATMEL_TSADCC_CH(n) (1 << (n)) /* Channel number */
63
64#define ATMEL_TSADCC_SR 0x1C /* Status register */
65#define ATMEL_TSADCC_EOC(n) (1 << ((n)+0)) /* End of conversion for channel N */
66#define ATMEL_TSADCC_OVRE(n) (1 << ((n)+8)) /* Overrun error for channel N */
67#define ATMEL_TSADCC_DRDY (1 << 16) /* Data Ready */
68#define ATMEL_TSADCC_GOVRE (1 << 17) /* General Overrun Error */
69#define ATMEL_TSADCC_ENDRX (1 << 18) /* End of RX Buffer */
70#define ATMEL_TSADCC_RXBUFF (1 << 19) /* TX Buffer full */
71#define ATMEL_TSADCC_PENCNT (1 << 20) /* Pen contact */
72#define ATMEL_TSADCC_NOCNT (1 << 21) /* No contact */
73
74#define ATMEL_TSADCC_LCDR 0x20 /* Last Converted Data register */
75#define ATMEL_TSADCC_DATA (0x3ff << 0) /* Channel data */
76
77#define ATMEL_TSADCC_IER 0x24 /* Interrupt Enable register */
78#define ATMEL_TSADCC_IDR 0x28 /* Interrupt Disable register */
79#define ATMEL_TSADCC_IMR 0x2C /* Interrupt Mask register */
80#define ATMEL_TSADCC_CDR0 0x30 /* Channel Data 0 */
81#define ATMEL_TSADCC_CDR1 0x34 /* Channel Data 1 */
82#define ATMEL_TSADCC_CDR2 0x38 /* Channel Data 2 */
83#define ATMEL_TSADCC_CDR3 0x3C /* Channel Data 3 */
84#define ATMEL_TSADCC_CDR4 0x40 /* Channel Data 4 */
85#define ATMEL_TSADCC_CDR5 0x44 /* Channel Data 5 */
86
87#define ADC_CLOCK 1000000
88
89struct atmel_tsadcc {
90 struct input_dev *input;
91 char phys[32];
92 struct clk *clk;
93 int irq;
94};
95
96static void __iomem *tsc_base;
97
98#define atmel_tsadcc_read(reg) __raw_readl(tsc_base + (reg))
99#define atmel_tsadcc_write(reg, val) __raw_writel((val), tsc_base + (reg))
100
101static irqreturn_t atmel_tsadcc_interrupt(int irq, void *dev)
102{
103 struct input_dev *input_dev = ((struct atmel_tsadcc *)dev)->input;
104
105 unsigned int absx;
106 unsigned int absy;
107 unsigned int status;
108 unsigned int reg;
109
110 status = atmel_tsadcc_read(ATMEL_TSADCC_SR);
111 status &= atmel_tsadcc_read(ATMEL_TSADCC_IMR);
112
113 if (status & ATMEL_TSADCC_NOCNT) {
114 /* Contact lost */
115 reg = atmel_tsadcc_read(ATMEL_TSADCC_MR) | ATMEL_TSADCC_PENDBC;
116
117 atmel_tsadcc_write(ATMEL_TSADCC_MR, reg);
118 atmel_tsadcc_write(ATMEL_TSADCC_TRGR, ATMEL_TSADCC_TRGMOD_NONE);
119 atmel_tsadcc_write(ATMEL_TSADCC_IDR,
120 ATMEL_TSADCC_EOC(3) | ATMEL_TSADCC_NOCNT);
121 atmel_tsadcc_write(ATMEL_TSADCC_IER, ATMEL_TSADCC_PENCNT);
122
123 input_report_key(input_dev, BTN_TOUCH, 0);
124 input_sync(input_dev);
125
126 } else if (status & ATMEL_TSADCC_PENCNT) {
127 /* Pen detected */
128 reg = atmel_tsadcc_read(ATMEL_TSADCC_MR);
129 reg &= ~ATMEL_TSADCC_PENDBC;
130
131 atmel_tsadcc_write(ATMEL_TSADCC_IDR, ATMEL_TSADCC_PENCNT);
132 atmel_tsadcc_write(ATMEL_TSADCC_MR, reg);
133 atmel_tsadcc_write(ATMEL_TSADCC_IER,
134 ATMEL_TSADCC_EOC(3) | ATMEL_TSADCC_NOCNT);
135 atmel_tsadcc_write(ATMEL_TSADCC_TRGR,
136 ATMEL_TSADCC_TRGMOD_PERIOD | (0x0FFF << 16));
137
138 } else if (status & ATMEL_TSADCC_EOC(3)) {
139 /* Conversion finished */
140
141 absx = atmel_tsadcc_read(ATMEL_TSADCC_CDR3) << 10;
142 absx /= atmel_tsadcc_read(ATMEL_TSADCC_CDR2);
143
144 absy = atmel_tsadcc_read(ATMEL_TSADCC_CDR1) << 10;
145 absy /= atmel_tsadcc_read(ATMEL_TSADCC_CDR0);
146
147 input_report_abs(input_dev, ABS_X, absx);
148 input_report_abs(input_dev, ABS_Y, absy);
149 input_report_key(input_dev, BTN_TOUCH, 1);
150 input_sync(input_dev);
151 }
152
153 return IRQ_HANDLED;
154}
155
156/*
157 * The functions for inserting/removing us as a module.
158 */
159
160static int __devinit atmel_tsadcc_probe(struct platform_device *pdev)
161{
162 struct atmel_tsadcc *ts_dev;
163 struct input_dev *input_dev;
164 struct resource *res;
165 int err = 0;
166 unsigned int prsc;
167 unsigned int reg;
168
169 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
170 if (!res) {
171 dev_err(&pdev->dev, "no mmio resource defined.\n");
172 return -ENXIO;
173 }
174
175 /* Allocate memory for device */
176 ts_dev = kzalloc(sizeof(struct atmel_tsadcc), GFP_KERNEL);
177 if (!ts_dev) {
178 dev_err(&pdev->dev, "failed to allocate memory.\n");
179 return -ENOMEM;
180 }
181 platform_set_drvdata(pdev, ts_dev);
182
183 input_dev = input_allocate_device();
184 if (!input_dev) {
185 dev_err(&pdev->dev, "failed to allocate input device.\n");
186 err = -EBUSY;
187 goto err_free_mem;
188 }
189
190 ts_dev->irq = platform_get_irq(pdev, 0);
191 if (ts_dev->irq < 0) {
192 dev_err(&pdev->dev, "no irq ID is designated.\n");
193 err = -ENODEV;
194 goto err_free_dev;
195 }
196
197 if (!request_mem_region(res->start, res->end - res->start + 1,
198 "atmel tsadcc regs")) {
199 dev_err(&pdev->dev, "resources is unavailable.\n");
200 err = -EBUSY;
201 goto err_free_dev;
202 }
203
204 tsc_base = ioremap(res->start, res->end - res->start + 1);
205 if (!tsc_base) {
206 dev_err(&pdev->dev, "failed to map registers.\n");
207 err = -ENOMEM;
208 goto err_release_mem;
209 }
210
211 err = request_irq(ts_dev->irq, atmel_tsadcc_interrupt, IRQF_DISABLED,
212 pdev->dev.driver->name, ts_dev);
213 if (err) {
214 dev_err(&pdev->dev, "failed to allocate irq.\n");
215 goto err_unmap_regs;
216 }
217
218 ts_dev->clk = clk_get(&pdev->dev, "tsc_clk");
219 if (IS_ERR(ts_dev->clk)) {
220 dev_err(&pdev->dev, "failed to get ts_clk\n");
221 err = PTR_ERR(ts_dev->clk);
222 goto err_free_irq;
223 }
224
225 ts_dev->input = input_dev;
226
227 snprintf(ts_dev->phys, sizeof(ts_dev->phys),
228 "%s/input0", pdev->dev.bus_id);
229
230 input_dev->name = "atmel touch screen controller";
231 input_dev->phys = ts_dev->phys;
232 input_dev->dev.parent = &pdev->dev;
233
234 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
235 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
236
237 input_set_abs_params(input_dev, ABS_X, 0, 0x3FF, 0, 0);
238 input_set_abs_params(input_dev, ABS_Y, 0, 0x3FF, 0, 0);
239
240 /* clk_enable() always returns 0, no need to check it */
241 clk_enable(ts_dev->clk);
242
243 prsc = clk_get_rate(ts_dev->clk);
244 dev_info(&pdev->dev, "Master clock is set at: %d Hz\n", prsc);
245
246 prsc = prsc / ADC_CLOCK / 2 - 1;
247
248 reg = ATMEL_TSADCC_TSAMOD_TS_ONLY_MODE |
249 ((0x00 << 5) & ATMEL_TSADCC_SLEEP) | /* Normal Mode */
250 ((0x01 << 6) & ATMEL_TSADCC_PENDET) | /* Enable Pen Detect */
251 ((prsc << 8) & ATMEL_TSADCC_PRESCAL) | /* PRESCAL */
252 ((0x13 << 16) & ATMEL_TSADCC_STARTUP) | /* STARTUP */
253 ((0x0F << 28) & ATMEL_TSADCC_PENDBC); /* PENDBC */
254
255 atmel_tsadcc_write(ATMEL_TSADCC_CR, ATMEL_TSADCC_SWRST);
256 atmel_tsadcc_write(ATMEL_TSADCC_MR, reg);
257 atmel_tsadcc_write(ATMEL_TSADCC_TRGR, ATMEL_TSADCC_TRGMOD_NONE);
258 atmel_tsadcc_write(ATMEL_TSADCC_TSR, (0x3 << 24) & ATMEL_TSADCC_TSSHTIM);
259
260 atmel_tsadcc_read(ATMEL_TSADCC_SR);
261 atmel_tsadcc_write(ATMEL_TSADCC_IER, ATMEL_TSADCC_PENCNT);
262
263 /* All went ok, so register to the input system */
264 err = input_register_device(input_dev);
265 if (err)
266 goto err_fail;
267
268 return 0;
269
270err_fail:
271 clk_disable(ts_dev->clk);
272 clk_put(ts_dev->clk);
273err_free_irq:
274 free_irq(ts_dev->irq, ts_dev);
275err_unmap_regs:
276 iounmap(tsc_base);
277err_release_mem:
278 release_mem_region(res->start, res->end - res->start + 1);
279err_free_dev:
280 input_free_device(ts_dev->input);
281err_free_mem:
282 kfree(ts_dev);
283 return err;
284}
285
286static int __devexit atmel_tsadcc_remove(struct platform_device *pdev)
287{
288 struct atmel_tsadcc *ts_dev = dev_get_drvdata(&pdev->dev);
289 struct resource *res;
290
291 free_irq(ts_dev->irq, ts_dev);
292
293 input_unregister_device(ts_dev->input);
294
295 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
296 iounmap(tsc_base);
297 release_mem_region(res->start, res->end - res->start + 1);
298
299 clk_disable(ts_dev->clk);
300 clk_put(ts_dev->clk);
301
302 kfree(ts_dev);
303
304 return 0;
305}
306
307static struct platform_driver atmel_tsadcc_driver = {
308 .probe = atmel_tsadcc_probe,
309 .remove = __devexit_p(atmel_tsadcc_remove),
310 .driver = {
311 .name = "atmel_tsadcc",
312 },
313};
314
315static int __init atmel_tsadcc_init(void)
316{
317 return platform_driver_register(&atmel_tsadcc_driver);
318}
319
320static void __exit atmel_tsadcc_exit(void)
321{
322 platform_driver_unregister(&atmel_tsadcc_driver);
323}
324
325module_init(atmel_tsadcc_init);
326module_exit(atmel_tsadcc_exit);
327
328
329MODULE_LICENSE("GPL");
330MODULE_DESCRIPTION("Atmel TouchScreen Driver");
331MODULE_AUTHOR("Dan Liang <dan.liang@atmel.com>");
332
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c
index e30a7773f93c..fbce5222d83c 100644
--- a/drivers/isdn/gigaset/isocdata.c
+++ b/drivers/isdn/gigaset/isocdata.c
@@ -247,7 +247,6 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
247#ifdef CONFIG_GIGASET_DEBUG 247#ifdef CONFIG_GIGASET_DEBUG
248 unsigned char c; 248 unsigned char c;
249 static char dbgline[3 * 32 + 1]; 249 static char dbgline[3 * 32 + 1];
250 static const char hexdigit[] = "0123456789abcdef";
251 int i = 0; 250 int i = 0;
252 while (count-- > 0) { 251 while (count-- > 0) {
253 if (i > sizeof(dbgline) - 4) { 252 if (i > sizeof(dbgline) - 4) {
@@ -258,8 +257,8 @@ static inline void dump_bytes(enum debuglevel level, const char *tag,
258 c = *bytes++; 257 c = *bytes++;
259 dbgline[i] = (i && !(i % 12)) ? '-' : ' '; 258 dbgline[i] = (i && !(i % 12)) ? '-' : ' ';
260 i++; 259 i++;
261 dbgline[i++] = hexdigit[(c >> 4) & 0x0f]; 260 dbgline[i++] = hex_asc_hi(c);
262 dbgline[i++] = hexdigit[c & 0x0f]; 261 dbgline[i++] = hex_asc_lo(c);
263 } 262 }
264 dbgline[i] = '\0'; 263 dbgline[i] = '\0';
265 gig_dbg(level, "%s:%s", tag, dbgline); 264 gig_dbg(level, "%s:%s", tag, dbgline);
diff --git a/drivers/isdn/hardware/mISDN/Kconfig b/drivers/isdn/hardware/mISDN/Kconfig
index 9cd5f5f62280..14793480c453 100644
--- a/drivers/isdn/hardware/mISDN/Kconfig
+++ b/drivers/isdn/hardware/mISDN/Kconfig
@@ -7,7 +7,6 @@ config MISDN_HFCPCI
7 tristate "Support for HFC PCI cards" 7 tristate "Support for HFC PCI cards"
8 depends on MISDN 8 depends on MISDN
9 depends on PCI 9 depends on PCI
10 depends on VIRT_TO_BUS
11 help 10 help
12 Enable support for cards with Cologne Chip AG's 11 Enable support for cards with Cologne Chip AG's
13 HFC PCI chip. 12 HFC PCI chip.
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index 917968530e1e..3231814e7efa 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -1988,8 +1988,7 @@ setup_hw(struct hfc_pci *hc)
1988 printk(KERN_INFO 1988 printk(KERN_INFO
1989 "HFC-PCI: defined at mem %#lx fifo %#lx(%#lx) IRQ %d HZ %d\n", 1989 "HFC-PCI: defined at mem %#lx fifo %#lx(%#lx) IRQ %d HZ %d\n",
1990 (u_long) hc->hw.pci_io, (u_long) hc->hw.fifos, 1990 (u_long) hc->hw.pci_io, (u_long) hc->hw.fifos,
1991 (u_long) virt_to_bus(hc->hw.fifos), 1991 (u_long) hc->hw.dmahandle, hc->irq, HZ);
1992 hc->irq, HZ);
1993 /* enable memory mapped ports, disable busmaster */ 1992 /* enable memory mapped ports, disable busmaster */
1994 pci_write_config_word(hc->pdev, PCI_COMMAND, PCI_ENA_MEMIO); 1993 pci_write_config_word(hc->pdev, PCI_COMMAND, PCI_ENA_MEMIO);
1995 hc->hw.int_m2 = 0; 1994 hc->hw.int_m2 = 0;
diff --git a/drivers/isdn/hysdn/hysdn_pof.h b/drivers/isdn/hysdn/hysdn_pof.h
index a368d6caca0e..3a72b908900f 100644
--- a/drivers/isdn/hysdn/hysdn_pof.h
+++ b/drivers/isdn/hysdn/hysdn_pof.h
@@ -60,7 +60,7 @@ typedef struct PofRecHdr_tag { /* Pof record header */
60 60
61typedef struct PofTimeStamp_tag { 61typedef struct PofTimeStamp_tag {
62/*00 */ unsigned long UnixTime __attribute__((packed)); 62/*00 */ unsigned long UnixTime __attribute__((packed));
63 /*04 */ unsigned char DateTimeText[0x28] __attribute__((packed)); 63 /*04 */ unsigned char DateTimeText[0x28];
64 /* =40 */ 64 /* =40 */
65/*2C */ 65/*2C */
66} tPofTimeStamp; 66} tPofTimeStamp;
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 5eea4356d703..90663e01a56e 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -135,6 +135,7 @@ static void unmap_switcher(void)
135 /* Now we just need to free the pages we copied the switcher into */ 135 /* Now we just need to free the pages we copied the switcher into */
136 for (i = 0; i < TOTAL_SWITCHER_PAGES; i++) 136 for (i = 0; i < TOTAL_SWITCHER_PAGES; i++)
137 __free_pages(switcher_page[i], 0); 137 __free_pages(switcher_page[i], 0);
138 kfree(switcher_page);
138} 139}
139 140
140/*H:032 141/*H:032
diff --git a/drivers/lguest/interrupts_and_traps.c b/drivers/lguest/interrupts_and_traps.c
index 0414ddf87587..a1039068f95c 100644
--- a/drivers/lguest/interrupts_and_traps.c
+++ b/drivers/lguest/interrupts_and_traps.c
@@ -406,7 +406,8 @@ void load_guest_idt_entry(struct lg_cpu *cpu, unsigned int num, u32 lo, u32 hi)
406 * deliver_trap() to bounce it back into the Guest. */ 406 * deliver_trap() to bounce it back into the Guest. */
407static void default_idt_entry(struct desc_struct *idt, 407static void default_idt_entry(struct desc_struct *idt,
408 int trap, 408 int trap,
409 const unsigned long handler) 409 const unsigned long handler,
410 const struct desc_struct *base)
410{ 411{
411 /* A present interrupt gate. */ 412 /* A present interrupt gate. */
412 u32 flags = 0x8e00; 413 u32 flags = 0x8e00;
@@ -415,6 +416,10 @@ static void default_idt_entry(struct desc_struct *idt,
415 * the Guest to use the "int" instruction to trigger it. */ 416 * the Guest to use the "int" instruction to trigger it. */
416 if (trap == LGUEST_TRAP_ENTRY) 417 if (trap == LGUEST_TRAP_ENTRY)
417 flags |= (GUEST_PL << 13); 418 flags |= (GUEST_PL << 13);
419 else if (base)
420 /* Copy priv. level from what Guest asked for. This allows
421 * debug (int 3) traps from Guest userspace, for example. */
422 flags |= (base->b & 0x6000);
418 423
419 /* Now pack it into the IDT entry in its weird format. */ 424 /* Now pack it into the IDT entry in its weird format. */
420 idt->a = (LGUEST_CS<<16) | (handler&0x0000FFFF); 425 idt->a = (LGUEST_CS<<16) | (handler&0x0000FFFF);
@@ -428,7 +433,7 @@ void setup_default_idt_entries(struct lguest_ro_state *state,
428 unsigned int i; 433 unsigned int i;
429 434
430 for (i = 0; i < ARRAY_SIZE(state->guest_idt); i++) 435 for (i = 0; i < ARRAY_SIZE(state->guest_idt); i++)
431 default_idt_entry(&state->guest_idt[i], i, def[i]); 436 default_idt_entry(&state->guest_idt[i], i, def[i], NULL);
432} 437}
433 438
434/*H:240 We don't use the IDT entries in the "struct lguest" directly, instead 439/*H:240 We don't use the IDT entries in the "struct lguest" directly, instead
@@ -442,6 +447,8 @@ void copy_traps(const struct lg_cpu *cpu, struct desc_struct *idt,
442 /* We can simply copy the direct traps, otherwise we use the default 447 /* We can simply copy the direct traps, otherwise we use the default
443 * ones in the Switcher: they will return to the Host. */ 448 * ones in the Switcher: they will return to the Host. */
444 for (i = 0; i < ARRAY_SIZE(cpu->arch.idt); i++) { 449 for (i = 0; i < ARRAY_SIZE(cpu->arch.idt); i++) {
450 const struct desc_struct *gidt = &cpu->arch.idt[i];
451
445 /* If no Guest can ever override this trap, leave it alone. */ 452 /* If no Guest can ever override this trap, leave it alone. */
446 if (!direct_trap(i)) 453 if (!direct_trap(i))
447 continue; 454 continue;
@@ -449,12 +456,15 @@ void copy_traps(const struct lg_cpu *cpu, struct desc_struct *idt,
449 /* Only trap gates (type 15) can go direct to the Guest. 456 /* Only trap gates (type 15) can go direct to the Guest.
450 * Interrupt gates (type 14) disable interrupts as they are 457 * Interrupt gates (type 14) disable interrupts as they are
451 * entered, which we never let the Guest do. Not present 458 * entered, which we never let the Guest do. Not present
452 * entries (type 0x0) also can't go direct, of course. */ 459 * entries (type 0x0) also can't go direct, of course.
453 if (idt_type(cpu->arch.idt[i].a, cpu->arch.idt[i].b) == 0xF) 460 *
454 idt[i] = cpu->arch.idt[i]; 461 * If it can't go direct, we still need to copy the priv. level:
462 * they might want to give userspace access to a software
463 * interrupt. */
464 if (idt_type(gidt->a, gidt->b) == 0xF)
465 idt[i] = *gidt;
455 else 466 else
456 /* Reset it to the default. */ 467 default_idt_entry(&idt[i], i, def[i], gidt);
457 default_idt_entry(&idt[i], i, def[i]);
458 } 468 }
459} 469}
460 470
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index 95dfda52b4f9..bf7942327bda 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -480,7 +480,7 @@ void __init lguest_arch_host_init(void)
480 * bit on its CPU, depending on the argument (0 == unset). */ 480 * bit on its CPU, depending on the argument (0 == unset). */
481 on_each_cpu(adjust_pge, (void *)0, 1); 481 on_each_cpu(adjust_pge, (void *)0, 1);
482 /* Turn off the feature in the global feature set. */ 482 /* Turn off the feature in the global feature set. */
483 clear_bit(X86_FEATURE_PGE, boot_cpu_data.x86_capability); 483 clear_cpu_cap(&boot_cpu_data, X86_FEATURE_PGE);
484 } 484 }
485 put_online_cpus(); 485 put_online_cpus();
486}; 486};
@@ -491,7 +491,7 @@ void __exit lguest_arch_host_fini(void)
491 /* If we had PGE before we started, turn it back on now. */ 491 /* If we had PGE before we started, turn it back on now. */
492 get_online_cpus(); 492 get_online_cpus();
493 if (cpu_had_pge) { 493 if (cpu_had_pge) {
494 set_bit(X86_FEATURE_PGE, boot_cpu_data.x86_capability); 494 set_cpu_cap(&boot_cpu_data, X86_FEATURE_PGE);
495 /* adjust_pge's argument "1" means set PGE. */ 495 /* adjust_pge's argument "1" means set PGE. */
496 on_each_cpu(adjust_pge, (void *)1, 1); 496 on_each_cpu(adjust_pge, (void *)1, 1);
497 } 497 }
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 621a272a2c74..7e65bad522cb 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1234,7 +1234,7 @@ int bitmap_startwrite(struct bitmap *bitmap, sector_t offset, unsigned long sect
1234 case 0: 1234 case 0:
1235 bitmap_file_set_bit(bitmap, offset); 1235 bitmap_file_set_bit(bitmap, offset);
1236 bitmap_count_page(bitmap,offset, 1); 1236 bitmap_count_page(bitmap,offset, 1);
1237 blk_plug_device(bitmap->mddev->queue); 1237 blk_plug_device_unlocked(bitmap->mddev->queue);
1238 /* fall through */ 1238 /* fall through */
1239 case 1: 1239 case 1:
1240 *bmc = 2; 1240 *bmc = 2;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 798e468103b8..61f441409234 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -316,29 +316,12 @@ static inline int check_space(struct dm_table *t)
316 */ 316 */
317static int lookup_device(const char *path, dev_t *dev) 317static int lookup_device(const char *path, dev_t *dev)
318{ 318{
319 int r; 319 struct block_device *bdev = lookup_bdev(path);
320 struct nameidata nd; 320 if (IS_ERR(bdev))
321 struct inode *inode; 321 return PTR_ERR(bdev);
322 322 *dev = bdev->bd_dev;
323 if ((r = path_lookup(path, LOOKUP_FOLLOW, &nd))) 323 bdput(bdev);
324 return r; 324 return 0;
325
326 inode = nd.path.dentry->d_inode;
327 if (!inode) {
328 r = -ENOENT;
329 goto out;
330 }
331
332 if (!S_ISBLK(inode->i_mode)) {
333 r = -ENOTBLK;
334 goto out;
335 }
336
337 *dev = inode->i_rdev;
338
339 out:
340 path_put(&nd.path);
341 return r;
342} 325}
343 326
344/* 327/*
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index 171afe7da6b6..cf6a817d5059 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -563,7 +563,7 @@ int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev
563 563
564 DEB_EE(("dev:%p\n",dev)); 564 DEB_EE(("dev:%p\n",dev));
565 565
566 if( VFL_TYPE_GRABBER == (*vid)->type ) { 566 if ((*vid)->vfl_type == VFL_TYPE_GRABBER) {
567 vv->video_minor = -1; 567 vv->video_minor = -1;
568 } else { 568 } else {
569 vv->vbi_minor = -1; 569 vv->vbi_minor = -1;
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index a5e62750eea3..e8bc7abf2409 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -656,7 +656,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu
656 656
657 /* if we have a user buffer, the first page may not be 657 /* if we have a user buffer, the first page may not be
658 aligned to a page boundary. */ 658 aligned to a page boundary. */
659 pt1->offset = list->offset; 659 pt1->offset = dma->sglist->offset;
660 pt2->offset = pt1->offset+o1; 660 pt2->offset = pt1->offset+o1;
661 pt3->offset = pt1->offset+o2; 661 pt3->offset = pt1->offset+o2;
662 662
@@ -958,21 +958,18 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
958 case VIDIOC_ENUM_FMT: 958 case VIDIOC_ENUM_FMT:
959 { 959 {
960 struct v4l2_fmtdesc *f = arg; 960 struct v4l2_fmtdesc *f = arg;
961 int index;
962 961
963 switch (f->type) { 962 switch (f->type) {
964 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 963 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
965 case V4L2_BUF_TYPE_VIDEO_OVERLAY: { 964 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
966 index = f->index; 965 if (f->index >= NUM_FORMATS)
967 if (index < 0 || index >= NUM_FORMATS) {
968 return -EINVAL; 966 return -EINVAL;
969 } 967 strlcpy((char *)f->description, formats[f->index].name,
970 memset(f,0,sizeof(*f)); 968 sizeof(f->description));
971 f->index = index; 969 f->pixelformat = formats[f->index].pixelformat;
972 strlcpy((char *)f->description,formats[index].name,sizeof(f->description)); 970 f->flags = 0;
973 f->pixelformat = formats[index].pixelformat; 971 memset(f->reserved, 0, sizeof(f->reserved));
974 break; 972 break;
975 }
976 default: 973 default:
977 return -EINVAL; 974 return -EINVAL;
978 } 975 }
diff --git a/drivers/media/common/tuners/Kconfig b/drivers/media/common/tuners/Kconfig
index 850d5689b14d..6f92beaa5ac8 100644
--- a/drivers/media/common/tuners/Kconfig
+++ b/drivers/media/common/tuners/Kconfig
@@ -21,9 +21,8 @@ config MEDIA_TUNER
21 tristate 21 tristate
22 default VIDEO_MEDIA && I2C 22 default VIDEO_MEDIA && I2C
23 depends on VIDEO_MEDIA && I2C 23 depends on VIDEO_MEDIA && I2C
24 select FW_LOADER if !MEDIA_TUNER_CUSTOMIZE && HOTPLUG 24 select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMIZE
25 select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMIZE && HOTPLUG 25 select MEDIA_TUNER_XC5000 if !MEDIA_TUNER_CUSTOMIZE
26 select MEDIA_TUNER_XC5000 if !MEDIA_TUNER_CUSTOMIZE && HOTPLUG
27 select MEDIA_TUNER_MT20XX if !MEDIA_TUNER_CUSTOMIZE 26 select MEDIA_TUNER_MT20XX if !MEDIA_TUNER_CUSTOMIZE
28 select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMIZE 27 select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMIZE
29 select MEDIA_TUNER_TEA5761 if !MEDIA_TUNER_CUSTOMIZE 28 select MEDIA_TUNER_TEA5761 if !MEDIA_TUNER_CUSTOMIZE
@@ -138,8 +137,6 @@ config MEDIA_TUNER_QT1010
138config MEDIA_TUNER_XC2028 137config MEDIA_TUNER_XC2028
139 tristate "XCeive xc2028/xc3028 tuners" 138 tristate "XCeive xc2028/xc3028 tuners"
140 depends on VIDEO_MEDIA && I2C 139 depends on VIDEO_MEDIA && I2C
141 depends on HOTPLUG
142 select FW_LOADER
143 default m if MEDIA_TUNER_CUSTOMIZE 140 default m if MEDIA_TUNER_CUSTOMIZE
144 help 141 help
145 Say Y here to include support for the xc2028/xc3028 tuners. 142 Say Y here to include support for the xc2028/xc3028 tuners.
@@ -147,8 +144,6 @@ config MEDIA_TUNER_XC2028
147config MEDIA_TUNER_XC5000 144config MEDIA_TUNER_XC5000
148 tristate "Xceive XC5000 silicon tuner" 145 tristate "Xceive XC5000 silicon tuner"
149 depends on VIDEO_MEDIA && I2C 146 depends on VIDEO_MEDIA && I2C
150 depends on HOTPLUG
151 select FW_LOADER
152 default m if DVB_FE_CUSTOMISE 147 default m if DVB_FE_CUSTOMISE
153 help 148 help
154 A driver for the silicon tuner XC5000 from Xceive. 149 A driver for the silicon tuner XC5000 from Xceive.
@@ -162,4 +157,11 @@ config MEDIA_TUNER_MXL5005S
162 help 157 help
163 A driver for the silicon tuner MXL5005S from MaxLinear. 158 A driver for the silicon tuner MXL5005S from MaxLinear.
164 159
160config MEDIA_TUNER_MXL5007T
161 tristate "MaxLinear MxL5007T silicon tuner"
162 depends on VIDEO_MEDIA && I2C
163 default m if DVB_FE_CUSTOMISE
164 help
165 A driver for the silicon tuner MxL5007T from MaxLinear.
166
165endif # MEDIA_TUNER_CUSTOMIZE 167endif # MEDIA_TUNER_CUSTOMIZE
diff --git a/drivers/media/common/tuners/Makefile b/drivers/media/common/tuners/Makefile
index 55f7e6706297..4dfbe5b8264f 100644
--- a/drivers/media/common/tuners/Makefile
+++ b/drivers/media/common/tuners/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_MEDIA_TUNER_MT2266) += mt2266.o
21obj-$(CONFIG_MEDIA_TUNER_QT1010) += qt1010.o 21obj-$(CONFIG_MEDIA_TUNER_QT1010) += qt1010.o
22obj-$(CONFIG_MEDIA_TUNER_MT2131) += mt2131.o 22obj-$(CONFIG_MEDIA_TUNER_MT2131) += mt2131.o
23obj-$(CONFIG_MEDIA_TUNER_MXL5005S) += mxl5005s.o 23obj-$(CONFIG_MEDIA_TUNER_MXL5005S) += mxl5005s.o
24obj-$(CONFIG_MEDIA_TUNER_MXL5007T) += mxl5007t.o
24 25
25EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core 26EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
26EXTRA_CFLAGS += -Idrivers/media/dvb/frontends 27EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
diff --git a/drivers/media/common/tuners/mt20xx.c b/drivers/media/common/tuners/mt20xx.c
index fbcb28233737..35b763a16d53 100644
--- a/drivers/media/common/tuners/mt20xx.c
+++ b/drivers/media/common/tuners/mt20xx.c
@@ -148,7 +148,8 @@ static int mt2032_compute_freq(struct dvb_frontend *fe,
148 tuner_dbg("mt2032: rfin=%d lo2=%d lo2n=%d lo2a=%d num=%d lo2freq=%d\n", 148 tuner_dbg("mt2032: rfin=%d lo2=%d lo2n=%d lo2a=%d num=%d lo2freq=%d\n",
149 rfin,lo2,lo2n,lo2a,lo2num,lo2freq); 149 rfin,lo2,lo2n,lo2a,lo2num,lo2freq);
150 150
151 if(lo1a<0 || lo1a>7 || lo1n<17 ||lo1n>48 || lo2a<0 ||lo2a >7 ||lo2n<17 || lo2n>30) { 151 if (lo1a > 7 || lo1n < 17 || lo1n > 48 || lo2a > 7 || lo2n < 17 ||
152 lo2n > 30) {
152 tuner_info("mt2032: frequency parameters out of range: %d %d %d %d\n", 153 tuner_info("mt2032: frequency parameters out of range: %d %d %d %d\n",
153 lo1a, lo1n, lo2a,lo2n); 154 lo1a, lo1n, lo2a,lo2n);
154 return(-1); 155 return(-1);
diff --git a/drivers/media/common/tuners/mxl5007t.c b/drivers/media/common/tuners/mxl5007t.c
new file mode 100644
index 000000000000..cb25e43502fe
--- /dev/null
+++ b/drivers/media/common/tuners/mxl5007t.c
@@ -0,0 +1,1030 @@
1/*
2 * mxl5007t.c - driver for the MaxLinear MxL5007T silicon tuner
3 *
4 * Copyright (C) 2008 Michael Krufky <mkrufky@linuxtv.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#include <linux/i2c.h>
22#include <linux/types.h>
23#include <linux/videodev2.h>
24#include "tuner-i2c.h"
25#include "mxl5007t.h"
26
27static DEFINE_MUTEX(mxl5007t_list_mutex);
28static LIST_HEAD(hybrid_tuner_instance_list);
29
30static int mxl5007t_debug;
31module_param_named(debug, mxl5007t_debug, int, 0644);
32MODULE_PARM_DESC(debug, "set debug level");
33
34/* ------------------------------------------------------------------------- */
35
36#define mxl_printk(kern, fmt, arg...) \
37 printk(kern "%s: " fmt "\n", __func__, ##arg)
38
39#define mxl_err(fmt, arg...) \
40 mxl_printk(KERN_ERR, "%d: " fmt, __LINE__, ##arg)
41
42#define mxl_warn(fmt, arg...) \
43 mxl_printk(KERN_WARNING, fmt, ##arg)
44
45#define mxl_info(fmt, arg...) \
46 mxl_printk(KERN_INFO, fmt, ##arg)
47
48#define mxl_debug(fmt, arg...) \
49({ \
50 if (mxl5007t_debug) \
51 mxl_printk(KERN_DEBUG, fmt, ##arg); \
52})
53
54#define mxl_fail(ret) \
55({ \
56 int __ret; \
57 __ret = (ret < 0); \
58 if (__ret) \
59 mxl_printk(KERN_ERR, "error %d on line %d", \
60 ret, __LINE__); \
61 __ret; \
62})
63
64/* ------------------------------------------------------------------------- */
65
66#define MHz 1000000
67
68enum mxl5007t_mode {
69 MxL_MODE_OTA_DVBT_ATSC = 0,
70 MxL_MODE_OTA_NTSC_PAL_GH = 1,
71 MxL_MODE_OTA_PAL_IB = 2,
72 MxL_MODE_OTA_PAL_D_SECAM_KL = 3,
73 MxL_MODE_OTA_ISDBT = 4,
74 MxL_MODE_CABLE_DIGITAL = 0x10,
75 MxL_MODE_CABLE_NTSC_PAL_GH = 0x11,
76 MxL_MODE_CABLE_PAL_IB = 0x12,
77 MxL_MODE_CABLE_PAL_D_SECAM_KL = 0x13,
78 MxL_MODE_CABLE_SCTE40 = 0x14,
79};
80
81enum mxl5007t_chip_version {
82 MxL_UNKNOWN_ID = 0x00,
83 MxL_5007_V1_F1 = 0x11,
84 MxL_5007_V1_F2 = 0x12,
85 MxL_5007_V2_100_F1 = 0x21,
86 MxL_5007_V2_100_F2 = 0x22,
87 MxL_5007_V2_200_F1 = 0x23,
88 MxL_5007_V2_200_F2 = 0x24,
89};
90
91struct reg_pair_t {
92 u8 reg;
93 u8 val;
94};
95
96/* ------------------------------------------------------------------------- */
97
98static struct reg_pair_t init_tab[] = {
99 { 0x0b, 0x44 }, /* XTAL */
100 { 0x0c, 0x60 }, /* IF */
101 { 0x10, 0x00 }, /* MISC */
102 { 0x12, 0xca }, /* IDAC */
103 { 0x16, 0x90 }, /* MODE */
104 { 0x32, 0x38 }, /* MODE Analog/Digital */
105 { 0xd8, 0x18 }, /* CLK_OUT_ENABLE */
106 { 0x2c, 0x34 }, /* OVERRIDE */
107 { 0x4d, 0x40 }, /* OVERRIDE */
108 { 0x7f, 0x02 }, /* OVERRIDE */
109 { 0x9a, 0x52 }, /* OVERRIDE */
110 { 0x48, 0x5a }, /* OVERRIDE */
111 { 0x76, 0x1a }, /* OVERRIDE */
112 { 0x6a, 0x48 }, /* OVERRIDE */
113 { 0x64, 0x28 }, /* OVERRIDE */
114 { 0x66, 0xe6 }, /* OVERRIDE */
115 { 0x35, 0x0e }, /* OVERRIDE */
116 { 0x7e, 0x01 }, /* OVERRIDE */
117 { 0x83, 0x00 }, /* OVERRIDE */
118 { 0x04, 0x0b }, /* OVERRIDE */
119 { 0x05, 0x01 }, /* TOP_MASTER_ENABLE */
120 { 0, 0 }
121};
122
123static struct reg_pair_t init_tab_cable[] = {
124 { 0x0b, 0x44 }, /* XTAL */
125 { 0x0c, 0x60 }, /* IF */
126 { 0x10, 0x00 }, /* MISC */
127 { 0x12, 0xca }, /* IDAC */
128 { 0x16, 0x90 }, /* MODE */
129 { 0x32, 0x38 }, /* MODE A/D */
130 { 0x71, 0x3f }, /* TOP1 */
131 { 0x72, 0x3f }, /* TOP2 */
132 { 0x74, 0x3f }, /* TOP3 */
133 { 0xd8, 0x18 }, /* CLK_OUT_ENABLE */
134 { 0x2c, 0x34 }, /* OVERRIDE */
135 { 0x4d, 0x40 }, /* OVERRIDE */
136 { 0x7f, 0x02 }, /* OVERRIDE */
137 { 0x9a, 0x52 }, /* OVERRIDE */
138 { 0x48, 0x5a }, /* OVERRIDE */
139 { 0x76, 0x1a }, /* OVERRIDE */
140 { 0x6a, 0x48 }, /* OVERRIDE */
141 { 0x64, 0x28 }, /* OVERRIDE */
142 { 0x66, 0xe6 }, /* OVERRIDE */
143 { 0x35, 0x0e }, /* OVERRIDE */
144 { 0x7e, 0x01 }, /* OVERRIDE */
145 { 0x04, 0x0b }, /* OVERRIDE */
146 { 0x68, 0xb4 }, /* OVERRIDE */
147 { 0x36, 0x00 }, /* OVERRIDE */
148 { 0x05, 0x01 }, /* TOP_MASTER_ENABLE */
149 { 0, 0 }
150};
151
152/* ------------------------------------------------------------------------- */
153
154static struct reg_pair_t reg_pair_rftune[] = {
155 { 0x11, 0x00 }, /* abort tune */
156 { 0x13, 0x15 },
157 { 0x14, 0x40 },
158 { 0x15, 0x0e },
159 { 0x11, 0x02 }, /* start tune */
160 { 0, 0 }
161};
162
163/* ------------------------------------------------------------------------- */
164
165struct mxl5007t_state {
166 struct list_head hybrid_tuner_instance_list;
167 struct tuner_i2c_props i2c_props;
168
169 struct mutex lock;
170
171 struct mxl5007t_config *config;
172
173 enum mxl5007t_chip_version chip_id;
174
175 struct reg_pair_t tab_init[ARRAY_SIZE(init_tab)];
176 struct reg_pair_t tab_init_cable[ARRAY_SIZE(init_tab_cable)];
177 struct reg_pair_t tab_rftune[ARRAY_SIZE(reg_pair_rftune)];
178
179 u32 frequency;
180 u32 bandwidth;
181};
182
183/* ------------------------------------------------------------------------- */
184
185/* called by _init and _rftun to manipulate the register arrays */
186
187static void set_reg_bits(struct reg_pair_t *reg_pair, u8 reg, u8 mask, u8 val)
188{
189 unsigned int i = 0;
190
191 while (reg_pair[i].reg || reg_pair[i].val) {
192 if (reg_pair[i].reg == reg) {
193 reg_pair[i].val &= ~mask;
194 reg_pair[i].val |= val;
195 }
196 i++;
197
198 }
199 return;
200}
201
202static void copy_reg_bits(struct reg_pair_t *reg_pair1,
203 struct reg_pair_t *reg_pair2)
204{
205 unsigned int i, j;
206
207 i = j = 0;
208
209 while (reg_pair1[i].reg || reg_pair1[i].val) {
210 while (reg_pair2[j].reg || reg_pair2[j].reg) {
211 if (reg_pair1[i].reg != reg_pair2[j].reg) {
212 j++;
213 continue;
214 }
215 reg_pair2[j].val = reg_pair1[i].val;
216 break;
217 }
218 i++;
219 }
220 return;
221}
222
223/* ------------------------------------------------------------------------- */
224
225static void mxl5007t_set_mode_bits(struct mxl5007t_state *state,
226 enum mxl5007t_mode mode,
227 s32 if_diff_out_level)
228{
229 switch (mode) {
230 case MxL_MODE_OTA_DVBT_ATSC:
231 set_reg_bits(state->tab_init, 0x32, 0x0f, 0x06);
232 set_reg_bits(state->tab_init, 0x35, 0xff, 0x0e);
233 break;
234 case MxL_MODE_OTA_ISDBT:
235 set_reg_bits(state->tab_init, 0x32, 0x0f, 0x06);
236 set_reg_bits(state->tab_init, 0x35, 0xff, 0x12);
237 break;
238 case MxL_MODE_OTA_NTSC_PAL_GH:
239 set_reg_bits(state->tab_init, 0x16, 0x70, 0x00);
240 set_reg_bits(state->tab_init, 0x32, 0xff, 0x85);
241 break;
242 case MxL_MODE_OTA_PAL_IB:
243 set_reg_bits(state->tab_init, 0x16, 0x70, 0x10);
244 set_reg_bits(state->tab_init, 0x32, 0xff, 0x85);
245 break;
246 case MxL_MODE_OTA_PAL_D_SECAM_KL:
247 set_reg_bits(state->tab_init, 0x16, 0x70, 0x20);
248 set_reg_bits(state->tab_init, 0x32, 0xff, 0x85);
249 break;
250 case MxL_MODE_CABLE_DIGITAL:
251 set_reg_bits(state->tab_init_cable, 0x71, 0xff, 0x01);
252 set_reg_bits(state->tab_init_cable, 0x72, 0xff,
253 8 - if_diff_out_level);
254 set_reg_bits(state->tab_init_cable, 0x74, 0xff, 0x17);
255 break;
256 case MxL_MODE_CABLE_NTSC_PAL_GH:
257 set_reg_bits(state->tab_init, 0x16, 0x70, 0x00);
258 set_reg_bits(state->tab_init, 0x32, 0xff, 0x85);
259 set_reg_bits(state->tab_init_cable, 0x71, 0xff, 0x01);
260 set_reg_bits(state->tab_init_cable, 0x72, 0xff,
261 8 - if_diff_out_level);
262 set_reg_bits(state->tab_init_cable, 0x74, 0xff, 0x17);
263 break;
264 case MxL_MODE_CABLE_PAL_IB:
265 set_reg_bits(state->tab_init, 0x16, 0x70, 0x10);
266 set_reg_bits(state->tab_init, 0x32, 0xff, 0x85);
267 set_reg_bits(state->tab_init_cable, 0x71, 0xff, 0x01);
268 set_reg_bits(state->tab_init_cable, 0x72, 0xff,
269 8 - if_diff_out_level);
270 set_reg_bits(state->tab_init_cable, 0x74, 0xff, 0x17);
271 break;
272 case MxL_MODE_CABLE_PAL_D_SECAM_KL:
273 set_reg_bits(state->tab_init, 0x16, 0x70, 0x20);
274 set_reg_bits(state->tab_init, 0x32, 0xff, 0x85);
275 set_reg_bits(state->tab_init_cable, 0x71, 0xff, 0x01);
276 set_reg_bits(state->tab_init_cable, 0x72, 0xff,
277 8 - if_diff_out_level);
278 set_reg_bits(state->tab_init_cable, 0x74, 0xff, 0x17);
279 break;
280 case MxL_MODE_CABLE_SCTE40:
281 set_reg_bits(state->tab_init_cable, 0x36, 0xff, 0x08);
282 set_reg_bits(state->tab_init_cable, 0x68, 0xff, 0xbc);
283 set_reg_bits(state->tab_init_cable, 0x71, 0xff, 0x01);
284 set_reg_bits(state->tab_init_cable, 0x72, 0xff,
285 8 - if_diff_out_level);
286 set_reg_bits(state->tab_init_cable, 0x74, 0xff, 0x17);
287 break;
288 default:
289 mxl_fail(-EINVAL);
290 }
291 return;
292}
293
294static void mxl5007t_set_if_freq_bits(struct mxl5007t_state *state,
295 enum mxl5007t_if_freq if_freq,
296 int invert_if)
297{
298 u8 val;
299
300 switch (if_freq) {
301 case MxL_IF_4_MHZ:
302 val = 0x00;
303 break;
304 case MxL_IF_4_5_MHZ:
305 val = 0x20;
306 break;
307 case MxL_IF_4_57_MHZ:
308 val = 0x30;
309 break;
310 case MxL_IF_5_MHZ:
311 val = 0x40;
312 break;
313 case MxL_IF_5_38_MHZ:
314 val = 0x50;
315 break;
316 case MxL_IF_6_MHZ:
317 val = 0x60;
318 break;
319 case MxL_IF_6_28_MHZ:
320 val = 0x70;
321 break;
322 case MxL_IF_9_1915_MHZ:
323 val = 0x80;
324 break;
325 case MxL_IF_35_25_MHZ:
326 val = 0x90;
327 break;
328 case MxL_IF_36_15_MHZ:
329 val = 0xa0;
330 break;
331 case MxL_IF_44_MHZ:
332 val = 0xb0;
333 break;
334 default:
335 mxl_fail(-EINVAL);
336 return;
337 }
338 set_reg_bits(state->tab_init, 0x0c, 0xf0, val);
339
340 /* set inverted IF or normal IF */
341 set_reg_bits(state->tab_init, 0x0c, 0x08, invert_if ? 0x08 : 0x00);
342
343 return;
344}
345
346static void mxl5007t_set_xtal_freq_bits(struct mxl5007t_state *state,
347 enum mxl5007t_xtal_freq xtal_freq)
348{
349 u8 val;
350
351 switch (xtal_freq) {
352 case MxL_XTAL_16_MHZ:
353 val = 0x00; /* select xtal freq & Ref Freq */
354 break;
355 case MxL_XTAL_20_MHZ:
356 val = 0x11;
357 break;
358 case MxL_XTAL_20_25_MHZ:
359 val = 0x22;
360 break;
361 case MxL_XTAL_20_48_MHZ:
362 val = 0x33;
363 break;
364 case MxL_XTAL_24_MHZ:
365 val = 0x44;
366 break;
367 case MxL_XTAL_25_MHZ:
368 val = 0x55;
369 break;
370 case MxL_XTAL_25_14_MHZ:
371 val = 0x66;
372 break;
373 case MxL_XTAL_27_MHZ:
374 val = 0x77;
375 break;
376 case MxL_XTAL_28_8_MHZ:
377 val = 0x88;
378 break;
379 case MxL_XTAL_32_MHZ:
380 val = 0x99;
381 break;
382 case MxL_XTAL_40_MHZ:
383 val = 0xaa;
384 break;
385 case MxL_XTAL_44_MHZ:
386 val = 0xbb;
387 break;
388 case MxL_XTAL_48_MHZ:
389 val = 0xcc;
390 break;
391 case MxL_XTAL_49_3811_MHZ:
392 val = 0xdd;
393 break;
394 default:
395 mxl_fail(-EINVAL);
396 return;
397 }
398 set_reg_bits(state->tab_init, 0x0b, 0xff, val);
399
400 return;
401}
402
403static struct reg_pair_t *mxl5007t_calc_init_regs(struct mxl5007t_state *state,
404 enum mxl5007t_mode mode)
405{
406 struct mxl5007t_config *cfg = state->config;
407
408 memcpy(&state->tab_init, &init_tab, sizeof(init_tab));
409 memcpy(&state->tab_init_cable, &init_tab_cable, sizeof(init_tab_cable));
410
411 mxl5007t_set_mode_bits(state, mode, cfg->if_diff_out_level);
412 mxl5007t_set_if_freq_bits(state, cfg->if_freq_hz, cfg->invert_if);
413 mxl5007t_set_xtal_freq_bits(state, cfg->xtal_freq_hz);
414
415 set_reg_bits(state->tab_init, 0x10, 0x40, cfg->loop_thru_enable << 6);
416
417 set_reg_bits(state->tab_init, 0xd8, 0x08, cfg->clk_out_enable << 3);
418
419 set_reg_bits(state->tab_init, 0x10, 0x07, cfg->clk_out_amp);
420
421 /* set IDAC to automatic mode control by AGC */
422 set_reg_bits(state->tab_init, 0x12, 0x80, 0x00);
423
424 if (mode >= MxL_MODE_CABLE_DIGITAL) {
425 copy_reg_bits(state->tab_init, state->tab_init_cable);
426 return state->tab_init_cable;
427 } else
428 return state->tab_init;
429}
430
431/* ------------------------------------------------------------------------- */
432
433enum mxl5007t_bw_mhz {
434 MxL_BW_6MHz = 6,
435 MxL_BW_7MHz = 7,
436 MxL_BW_8MHz = 8,
437};
438
439static void mxl5007t_set_bw_bits(struct mxl5007t_state *state,
440 enum mxl5007t_bw_mhz bw)
441{
442 u8 val;
443
444 switch (bw) {
445 case MxL_BW_6MHz:
446 val = 0x15; /* set DIG_MODEINDEX, DIG_MODEINDEX_A,
447 * and DIG_MODEINDEX_CSF */
448 break;
449 case MxL_BW_7MHz:
450 val = 0x21;
451 break;
452 case MxL_BW_8MHz:
453 val = 0x3f;
454 break;
455 default:
456 mxl_fail(-EINVAL);
457 return;
458 }
459 set_reg_bits(state->tab_rftune, 0x13, 0x3f, val);
460
461 return;
462}
463
464static struct
465reg_pair_t *mxl5007t_calc_rf_tune_regs(struct mxl5007t_state *state,
466 u32 rf_freq, enum mxl5007t_bw_mhz bw)
467{
468 u32 dig_rf_freq = 0;
469 u32 temp;
470 u32 frac_divider = 1000000;
471 unsigned int i;
472
473 memcpy(&state->tab_rftune, &reg_pair_rftune, sizeof(reg_pair_rftune));
474
475 mxl5007t_set_bw_bits(state, bw);
476
477 /* Convert RF frequency into 16 bits =>
478 * 10 bit integer (MHz) + 6 bit fraction */
479 dig_rf_freq = rf_freq / MHz;
480
481 temp = rf_freq % MHz;
482
483 for (i = 0; i < 6; i++) {
484 dig_rf_freq <<= 1;
485 frac_divider /= 2;
486 if (temp > frac_divider) {
487 temp -= frac_divider;
488 dig_rf_freq++;
489 }
490 }
491
492 /* add to have shift center point by 7.8124 kHz */
493 if (temp > 7812)
494 dig_rf_freq++;
495
496 set_reg_bits(state->tab_rftune, 0x14, 0xff, (u8)dig_rf_freq);
497 set_reg_bits(state->tab_rftune, 0x15, 0xff, (u8)(dig_rf_freq >> 8));
498
499 return state->tab_rftune;
500}
501
502/* ------------------------------------------------------------------------- */
503
504static int mxl5007t_write_reg(struct mxl5007t_state *state, u8 reg, u8 val)
505{
506 u8 buf[] = { reg, val };
507 struct i2c_msg msg = { .addr = state->i2c_props.addr, .flags = 0,
508 .buf = buf, .len = 2 };
509 int ret;
510
511 ret = i2c_transfer(state->i2c_props.adap, &msg, 1);
512 if (ret != 1) {
513 mxl_err("failed!");
514 return -EREMOTEIO;
515 }
516 return 0;
517}
518
519static int mxl5007t_write_regs(struct mxl5007t_state *state,
520 struct reg_pair_t *reg_pair)
521{
522 unsigned int i = 0;
523 int ret = 0;
524
525 while ((ret == 0) && (reg_pair[i].reg || reg_pair[i].val)) {
526 ret = mxl5007t_write_reg(state,
527 reg_pair[i].reg, reg_pair[i].val);
528 i++;
529 }
530 return ret;
531}
532
533static int mxl5007t_read_reg(struct mxl5007t_state *state, u8 reg, u8 *val)
534{
535 struct i2c_msg msg[] = {
536 { .addr = state->i2c_props.addr, .flags = 0,
537 .buf = &reg, .len = 1 },
538 { .addr = state->i2c_props.addr, .flags = I2C_M_RD,
539 .buf = val, .len = 1 },
540 };
541 int ret;
542
543 ret = i2c_transfer(state->i2c_props.adap, msg, 2);
544 if (ret != 2) {
545 mxl_err("failed!");
546 return -EREMOTEIO;
547 }
548 return 0;
549}
550
551static int mxl5007t_soft_reset(struct mxl5007t_state *state)
552{
553 u8 d = 0xff;
554 struct i2c_msg msg = { .addr = state->i2c_props.addr, .flags = 0,
555 .buf = &d, .len = 1 };
556
557 int ret = i2c_transfer(state->i2c_props.adap, &msg, 1);
558
559 if (ret != 1) {
560 mxl_err("failed!");
561 return -EREMOTEIO;
562 }
563 return 0;
564}
565
566static int mxl5007t_tuner_init(struct mxl5007t_state *state,
567 enum mxl5007t_mode mode)
568{
569 struct reg_pair_t *init_regs;
570 int ret;
571
572 ret = mxl5007t_soft_reset(state);
573 if (mxl_fail(ret))
574 goto fail;
575
576 /* calculate initialization reg array */
577 init_regs = mxl5007t_calc_init_regs(state, mode);
578
579 ret = mxl5007t_write_regs(state, init_regs);
580 if (mxl_fail(ret))
581 goto fail;
582 mdelay(1);
583
584 ret = mxl5007t_write_reg(state, 0x2c, 0x35);
585 mxl_fail(ret);
586fail:
587 return ret;
588}
589
590static int mxl5007t_tuner_rf_tune(struct mxl5007t_state *state, u32 rf_freq_hz,
591 enum mxl5007t_bw_mhz bw)
592{
593 struct reg_pair_t *rf_tune_regs;
594 int ret;
595
596 /* calculate channel change reg array */
597 rf_tune_regs = mxl5007t_calc_rf_tune_regs(state, rf_freq_hz, bw);
598
599 ret = mxl5007t_write_regs(state, rf_tune_regs);
600 if (mxl_fail(ret))
601 goto fail;
602 msleep(3);
603fail:
604 return ret;
605}
606
607/* ------------------------------------------------------------------------- */
608
609static int mxl5007t_synth_lock_status(struct mxl5007t_state *state,
610 int *rf_locked, int *ref_locked)
611{
612 u8 d;
613 int ret;
614
615 *rf_locked = 0;
616 *ref_locked = 0;
617
618 ret = mxl5007t_read_reg(state, 0xcf, &d);
619 if (mxl_fail(ret))
620 goto fail;
621
622 if ((d & 0x0c) == 0x0c)
623 *rf_locked = 1;
624
625 if ((d & 0x03) == 0x03)
626 *ref_locked = 1;
627fail:
628 return ret;
629}
630
631static int mxl5007t_check_rf_input_power(struct mxl5007t_state *state,
632 s32 *rf_input_level)
633{
634 u8 d1, d2;
635 int ret;
636
637 ret = mxl5007t_read_reg(state, 0xb7, &d1);
638 if (mxl_fail(ret))
639 goto fail;
640
641 ret = mxl5007t_read_reg(state, 0xbf, &d2);
642 if (mxl_fail(ret))
643 goto fail;
644
645 d2 = d2 >> 4;
646 if (d2 > 7)
647 d2 += 0xf0;
648
649 *rf_input_level = (s32)(d1 + d2 - 113);
650fail:
651 return ret;
652}
653
654/* ------------------------------------------------------------------------- */
655
656static int mxl5007t_get_status(struct dvb_frontend *fe, u32 *status)
657{
658 struct mxl5007t_state *state = fe->tuner_priv;
659 int rf_locked, ref_locked;
660 s32 rf_input_level;
661 int ret;
662
663 if (fe->ops.i2c_gate_ctrl)
664 fe->ops.i2c_gate_ctrl(fe, 1);
665
666 ret = mxl5007t_synth_lock_status(state, &rf_locked, &ref_locked);
667 if (mxl_fail(ret))
668 goto fail;
669 mxl_debug("%s%s", rf_locked ? "rf locked " : "",
670 ref_locked ? "ref locked" : "");
671
672 ret = mxl5007t_check_rf_input_power(state, &rf_input_level);
673 if (mxl_fail(ret))
674 goto fail;
675 mxl_debug("rf input power: %d", rf_input_level);
676fail:
677 if (fe->ops.i2c_gate_ctrl)
678 fe->ops.i2c_gate_ctrl(fe, 0);
679
680 return ret;
681}
682
683/* ------------------------------------------------------------------------- */
684
685static int mxl5007t_set_params(struct dvb_frontend *fe,
686 struct dvb_frontend_parameters *params)
687{
688 struct mxl5007t_state *state = fe->tuner_priv;
689 enum mxl5007t_bw_mhz bw;
690 enum mxl5007t_mode mode;
691 int ret;
692 u32 freq = params->frequency;
693
694 if (fe->ops.info.type == FE_ATSC) {
695 switch (params->u.vsb.modulation) {
696 case VSB_8:
697 case VSB_16:
698 mode = MxL_MODE_OTA_DVBT_ATSC;
699 break;
700 case QAM_64:
701 case QAM_256:
702 mode = MxL_MODE_CABLE_DIGITAL;
703 break;
704 default:
705 mxl_err("modulation not set!");
706 return -EINVAL;
707 }
708 bw = MxL_BW_6MHz;
709 } else if (fe->ops.info.type == FE_OFDM) {
710 switch (params->u.ofdm.bandwidth) {
711 case BANDWIDTH_6_MHZ:
712 bw = MxL_BW_6MHz;
713 break;
714 case BANDWIDTH_7_MHZ:
715 bw = MxL_BW_7MHz;
716 break;
717 case BANDWIDTH_8_MHZ:
718 bw = MxL_BW_8MHz;
719 break;
720 default:
721 mxl_err("bandwidth not set!");
722 return -EINVAL;
723 }
724 mode = MxL_MODE_OTA_DVBT_ATSC;
725 } else {
726 mxl_err("modulation type not supported!");
727 return -EINVAL;
728 }
729
730 if (fe->ops.i2c_gate_ctrl)
731 fe->ops.i2c_gate_ctrl(fe, 1);
732
733 mutex_lock(&state->lock);
734
735 ret = mxl5007t_tuner_init(state, mode);
736 if (mxl_fail(ret))
737 goto fail;
738
739 ret = mxl5007t_tuner_rf_tune(state, freq, bw);
740 if (mxl_fail(ret))
741 goto fail;
742
743 state->frequency = freq;
744 state->bandwidth = (fe->ops.info.type == FE_OFDM) ?
745 params->u.ofdm.bandwidth : 0;
746fail:
747 mutex_unlock(&state->lock);
748
749 if (fe->ops.i2c_gate_ctrl)
750 fe->ops.i2c_gate_ctrl(fe, 0);
751
752 return ret;
753}
754
755static int mxl5007t_set_analog_params(struct dvb_frontend *fe,
756 struct analog_parameters *params)
757{
758 struct mxl5007t_state *state = fe->tuner_priv;
759 enum mxl5007t_bw_mhz bw = 0; /* FIXME */
760 enum mxl5007t_mode cbl_mode;
761 enum mxl5007t_mode ota_mode;
762 char *mode_name;
763 int ret;
764 u32 freq = params->frequency * 62500;
765
766#define cable 1
767 if (params->std & V4L2_STD_MN) {
768 cbl_mode = MxL_MODE_CABLE_NTSC_PAL_GH;
769 ota_mode = MxL_MODE_OTA_NTSC_PAL_GH;
770 mode_name = "MN";
771 } else if (params->std & V4L2_STD_B) {
772 cbl_mode = MxL_MODE_CABLE_PAL_IB;
773 ota_mode = MxL_MODE_OTA_PAL_IB;
774 mode_name = "B";
775 } else if (params->std & V4L2_STD_GH) {
776 cbl_mode = MxL_MODE_CABLE_NTSC_PAL_GH;
777 ota_mode = MxL_MODE_OTA_NTSC_PAL_GH;
778 mode_name = "GH";
779 } else if (params->std & V4L2_STD_PAL_I) {
780 cbl_mode = MxL_MODE_CABLE_PAL_IB;
781 ota_mode = MxL_MODE_OTA_PAL_IB;
782 mode_name = "I";
783 } else if (params->std & V4L2_STD_DK) {
784 cbl_mode = MxL_MODE_CABLE_PAL_D_SECAM_KL;
785 ota_mode = MxL_MODE_OTA_PAL_D_SECAM_KL;
786 mode_name = "DK";
787 } else if (params->std & V4L2_STD_SECAM_L) {
788 cbl_mode = MxL_MODE_CABLE_PAL_D_SECAM_KL;
789 ota_mode = MxL_MODE_OTA_PAL_D_SECAM_KL;
790 mode_name = "L";
791 } else if (params->std & V4L2_STD_SECAM_LC) {
792 cbl_mode = MxL_MODE_CABLE_PAL_D_SECAM_KL;
793 ota_mode = MxL_MODE_OTA_PAL_D_SECAM_KL;
794 mode_name = "L'";
795 } else {
796 mode_name = "xx";
797 /* FIXME */
798 cbl_mode = MxL_MODE_CABLE_NTSC_PAL_GH;
799 ota_mode = MxL_MODE_OTA_NTSC_PAL_GH;
800 }
801 mxl_debug("setting mxl5007 to system %s", mode_name);
802
803 if (fe->ops.i2c_gate_ctrl)
804 fe->ops.i2c_gate_ctrl(fe, 1);
805
806 mutex_lock(&state->lock);
807
808 ret = mxl5007t_tuner_init(state, cable ? cbl_mode : ota_mode);
809 if (mxl_fail(ret))
810 goto fail;
811
812 ret = mxl5007t_tuner_rf_tune(state, freq, bw);
813 if (mxl_fail(ret))
814 goto fail;
815
816 state->frequency = freq;
817 state->bandwidth = 0;
818fail:
819 mutex_unlock(&state->lock);
820
821 if (fe->ops.i2c_gate_ctrl)
822 fe->ops.i2c_gate_ctrl(fe, 0);
823
824 return ret;
825}
826
827/* ------------------------------------------------------------------------- */
828
829static int mxl5007t_init(struct dvb_frontend *fe)
830{
831 struct mxl5007t_state *state = fe->tuner_priv;
832 int ret;
833 u8 d;
834
835 if (fe->ops.i2c_gate_ctrl)
836 fe->ops.i2c_gate_ctrl(fe, 1);
837
838 ret = mxl5007t_read_reg(state, 0x05, &d);
839 if (mxl_fail(ret))
840 goto fail;
841
842 ret = mxl5007t_write_reg(state, 0x05, d | 0x01);
843 mxl_fail(ret);
844fail:
845 if (fe->ops.i2c_gate_ctrl)
846 fe->ops.i2c_gate_ctrl(fe, 0);
847
848 return ret;
849}
850
851static int mxl5007t_sleep(struct dvb_frontend *fe)
852{
853 struct mxl5007t_state *state = fe->tuner_priv;
854 int ret;
855 u8 d;
856
857 if (fe->ops.i2c_gate_ctrl)
858 fe->ops.i2c_gate_ctrl(fe, 1);
859
860 ret = mxl5007t_read_reg(state, 0x05, &d);
861 if (mxl_fail(ret))
862 goto fail;
863
864 ret = mxl5007t_write_reg(state, 0x05, d & ~0x01);
865 mxl_fail(ret);
866fail:
867 if (fe->ops.i2c_gate_ctrl)
868 fe->ops.i2c_gate_ctrl(fe, 0);
869
870 return ret;
871}
872
873/* ------------------------------------------------------------------------- */
874
875static int mxl5007t_get_frequency(struct dvb_frontend *fe, u32 *frequency)
876{
877 struct mxl5007t_state *state = fe->tuner_priv;
878 *frequency = state->frequency;
879 return 0;
880}
881
882static int mxl5007t_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
883{
884 struct mxl5007t_state *state = fe->tuner_priv;
885 *bandwidth = state->bandwidth;
886 return 0;
887}
888
889static int mxl5007t_release(struct dvb_frontend *fe)
890{
891 struct mxl5007t_state *state = fe->tuner_priv;
892
893 mutex_lock(&mxl5007t_list_mutex);
894
895 if (state)
896 hybrid_tuner_release_state(state);
897
898 mutex_unlock(&mxl5007t_list_mutex);
899
900 fe->tuner_priv = NULL;
901
902 return 0;
903}
904
905/* ------------------------------------------------------------------------- */
906
907static struct dvb_tuner_ops mxl5007t_tuner_ops = {
908 .info = {
909 .name = "MaxLinear MxL5007T",
910 },
911 .init = mxl5007t_init,
912 .sleep = mxl5007t_sleep,
913 .set_params = mxl5007t_set_params,
914 .set_analog_params = mxl5007t_set_analog_params,
915 .get_status = mxl5007t_get_status,
916 .get_frequency = mxl5007t_get_frequency,
917 .get_bandwidth = mxl5007t_get_bandwidth,
918 .release = mxl5007t_release,
919};
920
921static int mxl5007t_get_chip_id(struct mxl5007t_state *state)
922{
923 char *name;
924 int ret;
925 u8 id;
926
927 ret = mxl5007t_read_reg(state, 0xd3, &id);
928 if (mxl_fail(ret))
929 goto fail;
930
931 switch (id) {
932 case MxL_5007_V1_F1:
933 name = "MxL5007.v1.f1";
934 break;
935 case MxL_5007_V1_F2:
936 name = "MxL5007.v1.f2";
937 break;
938 case MxL_5007_V2_100_F1:
939 name = "MxL5007.v2.100.f1";
940 break;
941 case MxL_5007_V2_100_F2:
942 name = "MxL5007.v2.100.f2";
943 break;
944 case MxL_5007_V2_200_F1:
945 name = "MxL5007.v2.200.f1";
946 break;
947 case MxL_5007_V2_200_F2:
948 name = "MxL5007.v2.200.f2";
949 break;
950 default:
951 name = "MxL5007T";
952 id = MxL_UNKNOWN_ID;
953 }
954 state->chip_id = id;
955 mxl_info("%s detected @ %d-%04x", name,
956 i2c_adapter_id(state->i2c_props.adap),
957 state->i2c_props.addr);
958 return 0;
959fail:
960 mxl_warn("unable to identify device @ %d-%04x",
961 i2c_adapter_id(state->i2c_props.adap),
962 state->i2c_props.addr);
963
964 state->chip_id = MxL_UNKNOWN_ID;
965 return ret;
966}
967
968struct dvb_frontend *mxl5007t_attach(struct dvb_frontend *fe,
969 struct i2c_adapter *i2c, u8 addr,
970 struct mxl5007t_config *cfg)
971{
972 struct mxl5007t_state *state = NULL;
973 int instance, ret;
974
975 mutex_lock(&mxl5007t_list_mutex);
976 instance = hybrid_tuner_request_state(struct mxl5007t_state, state,
977 hybrid_tuner_instance_list,
978 i2c, addr, "mxl5007");
979 switch (instance) {
980 case 0:
981 goto fail;
982 break;
983 case 1:
984 /* new tuner instance */
985 state->config = cfg;
986
987 mutex_init(&state->lock);
988
989 if (fe->ops.i2c_gate_ctrl)
990 fe->ops.i2c_gate_ctrl(fe, 1);
991
992 ret = mxl5007t_get_chip_id(state);
993
994 if (fe->ops.i2c_gate_ctrl)
995 fe->ops.i2c_gate_ctrl(fe, 0);
996
997 /* check return value of mxl5007t_get_chip_id */
998 if (mxl_fail(ret))
999 goto fail;
1000 break;
1001 default:
1002 /* existing tuner instance */
1003 break;
1004 }
1005 fe->tuner_priv = state;
1006 mutex_unlock(&mxl5007t_list_mutex);
1007
1008 memcpy(&fe->ops.tuner_ops, &mxl5007t_tuner_ops,
1009 sizeof(struct dvb_tuner_ops));
1010
1011 return fe;
1012fail:
1013 mutex_unlock(&mxl5007t_list_mutex);
1014
1015 mxl5007t_release(fe);
1016 return NULL;
1017}
1018EXPORT_SYMBOL_GPL(mxl5007t_attach);
1019MODULE_DESCRIPTION("MaxLinear MxL5007T Silicon IC tuner driver");
1020MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>");
1021MODULE_LICENSE("GPL");
1022MODULE_VERSION("0.1");
1023
1024/*
1025 * Overrides for Emacs so that we follow Linus's tabbing style.
1026 * ---------------------------------------------------------------------------
1027 * Local variables:
1028 * c-basic-offset: 8
1029 * End:
1030 */
diff --git a/drivers/media/common/tuners/mxl5007t.h b/drivers/media/common/tuners/mxl5007t.h
new file mode 100644
index 000000000000..aa3eea0b5262
--- /dev/null
+++ b/drivers/media/common/tuners/mxl5007t.h
@@ -0,0 +1,104 @@
1/*
2 * mxl5007t.h - driver for the MaxLinear MxL5007T silicon tuner
3 *
4 * Copyright (C) 2008 Michael Krufky <mkrufky@linuxtv.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef __MXL5007T_H__
22#define __MXL5007T_H__
23
24#include "dvb_frontend.h"
25
26/* ------------------------------------------------------------------------- */
27
28enum mxl5007t_if_freq {
29 MxL_IF_4_MHZ, /* 4000000 */
30 MxL_IF_4_5_MHZ, /* 4500000 */
31 MxL_IF_4_57_MHZ, /* 4570000 */
32 MxL_IF_5_MHZ, /* 5000000 */
33 MxL_IF_5_38_MHZ, /* 5380000 */
34 MxL_IF_6_MHZ, /* 6000000 */
35 MxL_IF_6_28_MHZ, /* 6280000 */
36 MxL_IF_9_1915_MHZ, /* 9191500 */
37 MxL_IF_35_25_MHZ, /* 35250000 */
38 MxL_IF_36_15_MHZ, /* 36150000 */
39 MxL_IF_44_MHZ, /* 44000000 */
40};
41
42enum mxl5007t_xtal_freq {
43 MxL_XTAL_16_MHZ, /* 16000000 */
44 MxL_XTAL_20_MHZ, /* 20000000 */
45 MxL_XTAL_20_25_MHZ, /* 20250000 */
46 MxL_XTAL_20_48_MHZ, /* 20480000 */
47 MxL_XTAL_24_MHZ, /* 24000000 */
48 MxL_XTAL_25_MHZ, /* 25000000 */
49 MxL_XTAL_25_14_MHZ, /* 25140000 */
50 MxL_XTAL_27_MHZ, /* 27000000 */
51 MxL_XTAL_28_8_MHZ, /* 28800000 */
52 MxL_XTAL_32_MHZ, /* 32000000 */
53 MxL_XTAL_40_MHZ, /* 40000000 */
54 MxL_XTAL_44_MHZ, /* 44000000 */
55 MxL_XTAL_48_MHZ, /* 48000000 */
56 MxL_XTAL_49_3811_MHZ, /* 49381100 */
57};
58
59enum mxl5007t_clkout_amp {
60 MxL_CLKOUT_AMP_0_94V = 0,
61 MxL_CLKOUT_AMP_0_53V = 1,
62 MxL_CLKOUT_AMP_0_37V = 2,
63 MxL_CLKOUT_AMP_0_28V = 3,
64 MxL_CLKOUT_AMP_0_23V = 4,
65 MxL_CLKOUT_AMP_0_20V = 5,
66 MxL_CLKOUT_AMP_0_17V = 6,
67 MxL_CLKOUT_AMP_0_15V = 7,
68};
69
70struct mxl5007t_config {
71 s32 if_diff_out_level;
72 enum mxl5007t_clkout_amp clk_out_amp;
73 enum mxl5007t_xtal_freq xtal_freq_hz;
74 enum mxl5007t_if_freq if_freq_hz;
75 unsigned int invert_if:1;
76 unsigned int loop_thru_enable:1;
77 unsigned int clk_out_enable:1;
78};
79
80#if defined(CONFIG_MEDIA_TUNER_MXL5007T) || (defined(CONFIG_MEDIA_TUNER_MXL5007T_MODULE) && defined(MODULE))
81extern struct dvb_frontend *mxl5007t_attach(struct dvb_frontend *fe,
82 struct i2c_adapter *i2c, u8 addr,
83 struct mxl5007t_config *cfg);
84#else
85static inline struct dvb_frontend *mxl5007t_attach(struct dvb_frontend *fe,
86 struct i2c_adapter *i2c,
87 u8 addr,
88 struct mxl5007t_config *cfg)
89{
90 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
91 return NULL;
92}
93#endif
94
95#endif /* __MXL5007T_H__ */
96
97/*
98 * Overrides for Emacs so that we follow Linus's tabbing style.
99 * ---------------------------------------------------------------------------
100 * Local variables:
101 * c-basic-offset: 8
102 * End:
103 */
104
diff --git a/drivers/media/common/tuners/tda9887.c b/drivers/media/common/tuners/tda9887.c
index a0545ba957b0..72abf0b73486 100644
--- a/drivers/media/common/tuners/tda9887.c
+++ b/drivers/media/common/tuners/tda9887.c
@@ -6,7 +6,7 @@
6#include <linux/errno.h> 6#include <linux/errno.h>
7#include <linux/slab.h> 7#include <linux/slab.h>
8#include <linux/delay.h> 8#include <linux/delay.h>
9#include <linux/videodev.h> 9#include <linux/videodev2.h>
10#include <media/v4l2-common.h> 10#include <media/v4l2-common.h>
11#include <media/tuner.h> 11#include <media/tuner.h>
12#include "tuner-i2c.h" 12#include "tuner-i2c.h"
diff --git a/drivers/media/common/tuners/tuner-simple.c b/drivers/media/common/tuners/tuner-simple.c
index 266c255cf0d8..597e47f5d69c 100644
--- a/drivers/media/common/tuners/tuner-simple.c
+++ b/drivers/media/common/tuners/tuner-simple.c
@@ -6,7 +6,7 @@
6 */ 6 */
7#include <linux/delay.h> 7#include <linux/delay.h>
8#include <linux/i2c.h> 8#include <linux/i2c.h>
9#include <linux/videodev.h> 9#include <linux/videodev2.h>
10#include <media/tuner.h> 10#include <media/tuner.h>
11#include <media/v4l2-common.h> 11#include <media/v4l2-common.h>
12#include <media/tuner-types.h> 12#include <media/tuner-types.h>
diff --git a/drivers/media/dvb/bt8xx/Kconfig b/drivers/media/dvb/bt8xx/Kconfig
index 7588db1319d0..7e9c090fc04e 100644
--- a/drivers/media/dvb/bt8xx/Kconfig
+++ b/drivers/media/dvb/bt8xx/Kconfig
@@ -1,7 +1,6 @@
1config DVB_BT8XX 1config DVB_BT8XX
2 tristate "BT8xx based PCI cards" 2 tristate "BT8xx based PCI cards"
3 depends on DVB_CORE && PCI && I2C && VIDEO_BT848 3 depends on DVB_CORE && PCI && I2C && VIDEO_BT848
4 depends on HOTPLUG # due to FW_LOADER
5 select DVB_MT352 if !DVB_FE_CUSTOMISE 4 select DVB_MT352 if !DVB_FE_CUSTOMISE
6 select DVB_SP887X if !DVB_FE_CUSTOMISE 5 select DVB_SP887X if !DVB_FE_CUSTOMISE
7 select DVB_NXT6000 if !DVB_FE_CUSTOMISE 6 select DVB_NXT6000 if !DVB_FE_CUSTOMISE
@@ -10,7 +9,6 @@ config DVB_BT8XX
10 select DVB_LGDT330X if !DVB_FE_CUSTOMISE 9 select DVB_LGDT330X if !DVB_FE_CUSTOMISE
11 select DVB_ZL10353 if !DVB_FE_CUSTOMISE 10 select DVB_ZL10353 if !DVB_FE_CUSTOMISE
12 select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE 11 select MEDIA_TUNER_SIMPLE if !DVB_FE_CUSTOMISE
13 select FW_LOADER
14 help 12 help
15 Support for PCI cards based on the Bt8xx PCI bridge. Examples are 13 Support for PCI cards based on the Bt8xx PCI bridge. Examples are
16 the Nebula cards, the Pinnacle PCTV cards, the Twinhan DST cards, 14 the Nebula cards, the Pinnacle PCTV cards, the Twinhan DST cards,
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index a577c0f89f67..e84152b7576d 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -1,8 +1,6 @@
1config DVB_USB 1config DVB_USB
2 tristate "Support for various USB DVB devices" 2 tristate "Support for various USB DVB devices"
3 depends on DVB_CORE && USB && I2C && INPUT 3 depends on DVB_CORE && USB && I2C && INPUT
4 depends on HOTPLUG # due to FW_LOADER
5 select FW_LOADER
6 help 4 help
7 By enabling this you will be able to choose the various supported 5 By enabling this you will be able to choose the various supported
8 USB1.1 and USB2.0 DVB devices. 6 USB1.1 and USB2.0 DVB devices.
@@ -246,6 +244,14 @@ config DVB_USB_AF9005_REMOTE
246 Say Y here to support the default remote control decoding for the 244 Say Y here to support the default remote control decoding for the
247 Afatech AF9005 based receiver. 245 Afatech AF9005 based receiver.
248 246
247config DVB_USB_DW2102
248 tristate "DvbWorld 2102 DVB-S USB2.0 receiver"
249 depends on DVB_USB
250 select DVB_STV0299 if !DVB_FE_CUSTOMISE
251 select DVB_PLL if !DVB_FE_CUSTOMISE
252 help
253 Say Y here to support the DvbWorld 2102 DVB-S USB2.0 receiver.
254
249config DVB_USB_ANYSEE 255config DVB_USB_ANYSEE
250 tristate "Anysee DVB-T/C USB2.0 support" 256 tristate "Anysee DVB-T/C USB2.0 support"
251 depends on DVB_USB 257 depends on DVB_USB
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index 44c11e45e564..e206f1ea0027 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -64,6 +64,9 @@ obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
64dvb-usb-anysee-objs = anysee.o 64dvb-usb-anysee-objs = anysee.o
65obj-$(CONFIG_DVB_USB_ANYSEE) += dvb-usb-anysee.o 65obj-$(CONFIG_DVB_USB_ANYSEE) += dvb-usb-anysee.o
66 66
67dvb-usb-dw2102-objs = dw2102.o
68obj-$(CONFIG_DVB_USB_DW2102) += dvb-usb-dw2102.o
69
67EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ 70EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
68# due to tuner-xc3028 71# due to tuner-xc3028
69EXTRA_CFLAGS += -Idrivers/media/common/tuners 72EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c
index adfd4fc82efd..2f408d2e1ef3 100644
--- a/drivers/media/dvb/dvb-usb/anysee.c
+++ b/drivers/media/dvb/dvb-usb/anysee.c
@@ -43,7 +43,7 @@ module_param_named(debug, dvb_usb_anysee_debug, int, 0644);
43MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS); 43MODULE_PARM_DESC(debug, "set debugging level" DVB_USB_DEBUG_STATUS);
44DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 44DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
45 45
46struct mutex anysee_usb_mutex; 46static struct mutex anysee_usb_mutex;
47 47
48static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen, 48static int anysee_ctrl_msg(struct dvb_usb_device *d, u8 *sbuf, u8 slen,
49 u8 *rbuf, u8 rlen) 49 u8 *rbuf, u8 rlen)
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index e5238b31e946..029b437caf9a 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -204,5 +204,6 @@
204#define USB_PID_ASUS_U3000 0x171f 204#define USB_PID_ASUS_U3000 0x171f
205#define USB_PID_ASUS_U3100 0x173f 205#define USB_PID_ASUS_U3100 0x173f
206#define USB_PID_YUAN_EC372S 0x1edc 206#define USB_PID_YUAN_EC372S 0x1edc
207#define USB_PID_DW2102 0x2102
207 208
208#endif 209#endif
diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c
new file mode 100644
index 000000000000..a4d898b44e55
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/dw2102.c
@@ -0,0 +1,425 @@
1/* DVB USB framework compliant Linux driver for the DVBWorld DVB-S 2102 Card
2*
3* Copyright (C) 2008 Igor M. Liplianin (liplianin@me.by)
4*
5* This program is free software; you can redistribute it and/or modify it
6* under the terms of the GNU General Public License as published by the
7* Free Software Foundation, version 2.
8*
9* see Documentation/dvb/README.dvb-usb for more information
10*/
11#include <linux/version.h>
12#include "dw2102.h"
13#include "stv0299.h"
14#include "z0194a.h"
15
16#ifndef USB_PID_DW2102
17#define USB_PID_DW2102 0x2102
18#endif
19
20#define DW2102_READ_MSG 0
21#define DW2102_WRITE_MSG 1
22
23#define REG_1F_SYMBOLRATE_BYTE0 0x1f
24#define REG_20_SYMBOLRATE_BYTE1 0x20
25#define REG_21_SYMBOLRATE_BYTE2 0x21
26
27#define DW2102_VOLTAGE_CTRL (0x1800)
28#define DW2102_RC_QUERY (0x1a00)
29
30struct dw2102_state {
31 u32 last_key_pressed;
32};
33struct dw2102_rc_keys {
34 u32 keycode;
35 u32 event;
36};
37
38DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
39
40static int dw2102_op_rw(struct usb_device *dev, u8 request, u16 value,
41 u8 *data, u16 len, int flags)
42{
43 int ret;
44 u8 u8buf[len];
45
46 unsigned int pipe = (flags == DW2102_READ_MSG) ?
47 usb_rcvctrlpipe(dev, 0) : usb_sndctrlpipe(dev, 0);
48 u8 request_type = (flags == DW2102_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT;
49
50 if (flags == DW2102_WRITE_MSG)
51 memcpy(u8buf, data, len);
52 ret = usb_control_msg(dev, pipe, request,
53 request_type | USB_TYPE_VENDOR, value, 0 , u8buf, len, 2000);
54
55 if (flags == DW2102_READ_MSG)
56 memcpy(data, u8buf, len);
57 return ret;
58}
59
60/* I2C */
61
62static int dw2102_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
63 int num)
64{
65struct dvb_usb_device *d = i2c_get_adapdata(adap);
66 int i = 0, ret = 0;
67 u8 buf6[] = {0x2c, 0x05, 0xc0, 0, 0, 0, 0};
68 u8 request;
69 u16 value;
70
71 if (!d)
72 return -ENODEV;
73 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
74 return -EAGAIN;
75
76 switch (num) {
77 case 2:
78 /* read stv0299 register */
79 request = 0xb5;
80 value = msg[0].buf[0];/* register */
81 for (i = 0; i < msg[1].len; i++) {
82 value = value + i;
83 ret = dw2102_op_rw(d->udev, 0xb5,
84 value, buf6, 2, DW2102_READ_MSG);
85 msg[1].buf[i] = buf6[0];
86
87 }
88 break;
89 case 1:
90 switch (msg[0].addr) {
91 case 0x68:
92 /* write to stv0299 register */
93 buf6[0] = 0x2a;
94 buf6[1] = msg[0].buf[0];
95 buf6[2] = msg[0].buf[1];
96 ret = dw2102_op_rw(d->udev, 0xb2,
97 0, buf6, 3, DW2102_WRITE_MSG);
98 break;
99 case 0x60:
100 if (msg[0].flags == 0) {
101 /* write to tuner pll */
102 buf6[0] = 0x2c;
103 buf6[1] = 5;
104 buf6[2] = 0xc0;
105 buf6[3] = msg[0].buf[0];
106 buf6[4] = msg[0].buf[1];
107 buf6[5] = msg[0].buf[2];
108 buf6[6] = msg[0].buf[3];
109 ret = dw2102_op_rw(d->udev, 0xb2,
110 0, buf6, 7, DW2102_WRITE_MSG);
111 } else {
112 /* write to tuner pll */
113 ret = dw2102_op_rw(d->udev, 0xb5,
114 0, buf6, 1, DW2102_READ_MSG);
115 msg[0].buf[0] = buf6[0];
116 }
117 break;
118 case (DW2102_RC_QUERY):
119 ret = dw2102_op_rw(d->udev, 0xb8,
120 0, buf6, 2, DW2102_READ_MSG);
121 msg[0].buf[0] = buf6[0];
122 msg[0].buf[1] = buf6[1];
123 break;
124 case (DW2102_VOLTAGE_CTRL):
125 buf6[0] = 0x30;
126 buf6[1] = msg[0].buf[0];
127 ret = dw2102_op_rw(d->udev, 0xb2,
128 0, buf6, 2, DW2102_WRITE_MSG);
129 break;
130 }
131
132 break;
133 }
134
135 mutex_unlock(&d->i2c_mutex);
136 return num;
137}
138
139static u32 dw2102_i2c_func(struct i2c_adapter *adapter)
140{
141 return I2C_FUNC_I2C;
142}
143
144static struct i2c_algorithm dw2102_i2c_algo = {
145 .master_xfer = dw2102_i2c_transfer,
146 .functionality = dw2102_i2c_func,
147};
148
149static int dw2102_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
150{
151 static u8 command_13v[1] = {0x00};
152 static u8 command_18v[1] = {0x01};
153 struct i2c_msg msg[] = {
154 {.addr = DW2102_VOLTAGE_CTRL, .flags = 0,
155 .buf = command_13v, .len = 1},
156 };
157
158 struct dvb_usb_adapter *udev_adap =
159 (struct dvb_usb_adapter *)(fe->dvb->priv);
160 if (voltage == SEC_VOLTAGE_18)
161 msg[0].buf = command_18v;
162 i2c_transfer(&udev_adap->dev->i2c_adap, msg, 1);
163 return 0;
164}
165
166static int dw2102_frontend_attach(struct dvb_usb_adapter *d)
167{
168 d->fe = dvb_attach(stv0299_attach, &sharp_z0194a_config,
169 &d->dev->i2c_adap);
170 if (d->fe != NULL) {
171 d->fe->ops.set_voltage = dw2102_set_voltage;
172 info("Attached stv0299!\n");
173 return 0;
174 }
175 return -EIO;
176}
177
178static int dw2102_tuner_attach(struct dvb_usb_adapter *adap)
179{
180 dvb_attach(dvb_pll_attach, adap->fe, 0x60,
181 &adap->dev->i2c_adap, DVB_PLL_OPERA1);
182 return 0;
183}
184
185static struct dvb_usb_rc_key dw2102_rc_keys[] = {
186 { 0xf8, 0x0a, KEY_Q }, /*power*/
187 { 0xf8, 0x0c, KEY_M }, /*mute*/
188 { 0xf8, 0x11, KEY_1 },
189 { 0xf8, 0x12, KEY_2 },
190 { 0xf8, 0x13, KEY_3 },
191 { 0xf8, 0x14, KEY_4 },
192 { 0xf8, 0x15, KEY_5 },
193 { 0xf8, 0x16, KEY_6 },
194 { 0xf8, 0x17, KEY_7 },
195 { 0xf8, 0x18, KEY_8 },
196 { 0xf8, 0x19, KEY_9 },
197 { 0xf8, 0x10, KEY_0 },
198 { 0xf8, 0x1c, KEY_PAGEUP }, /*ch+*/
199 { 0xf8, 0x0f, KEY_PAGEDOWN }, /*ch-*/
200 { 0xf8, 0x1a, KEY_O }, /*vol+*/
201 { 0xf8, 0x0e, KEY_Z }, /*vol-*/
202 { 0xf8, 0x04, KEY_R }, /*rec*/
203 { 0xf8, 0x09, KEY_D }, /*fav*/
204 { 0xf8, 0x08, KEY_BACKSPACE }, /*rewind*/
205 { 0xf8, 0x07, KEY_A }, /*fast*/
206 { 0xf8, 0x0b, KEY_P }, /*pause*/
207 { 0xf8, 0x02, KEY_ESC }, /*cancel*/
208 { 0xf8, 0x03, KEY_G }, /*tab*/
209 { 0xf8, 0x00, KEY_UP }, /*up*/
210 { 0xf8, 0x1f, KEY_ENTER }, /*ok*/
211 { 0xf8, 0x01, KEY_DOWN }, /*down*/
212 { 0xf8, 0x05, KEY_C }, /*cap*/
213 { 0xf8, 0x06, KEY_S }, /*stop*/
214 { 0xf8, 0x40, KEY_F }, /*full*/
215 { 0xf8, 0x1e, KEY_W }, /*tvmode*/
216 { 0xf8, 0x1b, KEY_B }, /*recall*/
217
218};
219
220
221
222static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
223{
224 struct dw2102_state *st = d->priv;
225 u8 key[2];
226 struct i2c_msg msg[] = {
227 {.addr = DW2102_RC_QUERY, .flags = I2C_M_RD, .buf = key,
228 .len = 2},
229 };
230 int i;
231
232 *state = REMOTE_NO_KEY_PRESSED;
233 if (dw2102_i2c_transfer(&d->i2c_adap, msg, 1) == 1) {
234 for (i = 0; i < ARRAY_SIZE(dw2102_rc_keys); i++) {
235 if (dw2102_rc_keys[i].data == msg[0].buf[0]) {
236 *state = REMOTE_KEY_PRESSED;
237 *event = dw2102_rc_keys[i].event;
238 st->last_key_pressed =
239 dw2102_rc_keys[i].event;
240 break;
241 }
242 st->last_key_pressed = 0;
243 }
244 }
245 /* info("key: %x %x\n",key[0],key[1]); */
246 return 0;
247}
248
249static struct usb_device_id dw2102_table[] = {
250 {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)},
251 {USB_DEVICE(USB_VID_CYPRESS, 0x2101)},
252 { }
253};
254
255MODULE_DEVICE_TABLE(usb, dw2102_table);
256
257static int dw2102_load_firmware(struct usb_device *dev,
258 const struct firmware *frmwr)
259{
260 u8 *b, *p;
261 int ret = 0, i;
262 u8 reset;
263 u8 reset16 [] = {0, 0, 0, 0, 0, 0, 0};
264 const struct firmware *fw;
265 const char *filename = "dvb-usb-dw2101.fw";
266 switch (dev->descriptor.idProduct) {
267 case 0x2101:
268 ret = request_firmware(&fw, filename, &dev->dev);
269 if (ret != 0) {
270 err("did not find the firmware file. (%s) "
271 "Please see linux/Documentation/dvb/ for more details "
272 "on firmware-problems.", filename);
273 return ret;
274 }
275 break;
276 case USB_PID_DW2102:
277 fw = frmwr;
278 break;
279 }
280 info("start downloading DW2102 firmware");
281 p = kmalloc(fw->size, GFP_KERNEL);
282 reset = 1;
283 /*stop the CPU*/
284 dw2102_op_rw(dev, 0xa0, 0x7f92, &reset, 1, DW2102_WRITE_MSG);
285 dw2102_op_rw(dev, 0xa0, 0xe600, &reset, 1, DW2102_WRITE_MSG);
286
287 if (p != NULL) {
288 memcpy(p, fw->data, fw->size);
289 for (i = 0; i < fw->size; i += 0x40) {
290 b = (u8 *) p + i;
291 if (dw2102_op_rw
292 (dev, 0xa0, i, b , 0x40,
293 DW2102_WRITE_MSG) != 0x40
294 ) {
295 err("error while transferring firmware");
296 ret = -EINVAL;
297 break;
298 }
299 }
300 /* restart the CPU */
301 reset = 0;
302 if (ret || dw2102_op_rw
303 (dev, 0xa0, 0x7f92, &reset, 1,
304 DW2102_WRITE_MSG) != 1) {
305 err("could not restart the USB controller CPU.");
306 ret = -EINVAL;
307 }
308 if (ret || dw2102_op_rw
309 (dev, 0xa0, 0xe600, &reset, 1,
310 DW2102_WRITE_MSG) != 1) {
311 err("could not restart the USB controller CPU.");
312 ret = -EINVAL;
313 }
314 /* init registers */
315 switch (dev->descriptor.idProduct) {
316 case USB_PID_DW2102:
317 dw2102_op_rw
318 (dev, 0xbf, 0x0040, &reset, 0,
319 DW2102_WRITE_MSG);
320 dw2102_op_rw
321 (dev, 0xb9, 0x0000, &reset16[0], 2,
322 DW2102_READ_MSG);
323 break;
324 case 0x2101:
325 dw2102_op_rw
326 (dev, 0xbc, 0x0030, &reset16[0], 2,
327 DW2102_READ_MSG);
328 dw2102_op_rw
329 (dev, 0xba, 0x0000, &reset16[0], 7,
330 DW2102_READ_MSG);
331 dw2102_op_rw
332 (dev, 0xba, 0x0000, &reset16[0], 7,
333 DW2102_READ_MSG);
334 dw2102_op_rw
335 (dev, 0xb9, 0x0000, &reset16[0], 2,
336 DW2102_READ_MSG);
337 break;
338 }
339 kfree(p);
340 }
341 return ret;
342}
343
344static struct dvb_usb_device_properties dw2102_properties = {
345 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
346 .usb_ctrl = DEVICE_SPECIFIC,
347 .firmware = "dvb-usb-dw2102.fw",
348 .size_of_priv = sizeof(struct dw2102_state),
349 .no_reconnect = 1,
350
351 .i2c_algo = &dw2102_i2c_algo,
352 .rc_key_map = dw2102_rc_keys,
353 .rc_key_map_size = ARRAY_SIZE(dw2102_rc_keys),
354 .rc_interval = 150,
355 .rc_query = dw2102_rc_query,
356
357 .generic_bulk_ctrl_endpoint = 0x81,
358 /* parameter for the MPEG2-data transfer */
359 .num_adapters = 1,
360 .download_firmware = dw2102_load_firmware,
361 .adapter = {
362 {
363 .frontend_attach = dw2102_frontend_attach,
364 .streaming_ctrl = NULL,
365 .tuner_attach = dw2102_tuner_attach,
366 .stream = {
367 .type = USB_BULK,
368 .count = 8,
369 .endpoint = 0x82,
370 .u = {
371 .bulk = {
372 .buffersize = 4096,
373 }
374 }
375 },
376 }
377 },
378 .num_device_descs = 2,
379 .devices = {
380 {"DVBWorld DVB-S 2102 USB2.0",
381 {&dw2102_table[0], NULL},
382 {NULL},
383 },
384 {"DVBWorld DVB-S 2101 USB2.0",
385 {&dw2102_table[1], NULL},
386 {NULL},
387 },
388 }
389};
390
391static int dw2102_probe(struct usb_interface *intf,
392 const struct usb_device_id *id)
393{
394 return dvb_usb_device_init(intf, &dw2102_properties,
395 THIS_MODULE, NULL, adapter_nr);
396}
397
398static struct usb_driver dw2102_driver = {
399 .name = "dw2102",
400 .probe = dw2102_probe,
401 .disconnect = dvb_usb_device_exit,
402 .id_table = dw2102_table,
403};
404
405static int __init dw2102_module_init(void)
406{
407 int ret = usb_register(&dw2102_driver);
408 if (ret)
409 err("usb_register failed. Error number %d", ret);
410
411 return ret;
412}
413
414static void __exit dw2102_module_exit(void)
415{
416 usb_deregister(&dw2102_driver);
417}
418
419module_init(dw2102_module_init);
420module_exit(dw2102_module_exit);
421
422MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by");
423MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101 2102 USB2.0 device");
424MODULE_VERSION("0.1");
425MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/dw2102.h b/drivers/media/dvb/dvb-usb/dw2102.h
new file mode 100644
index 000000000000..7a310f906837
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/dw2102.h
@@ -0,0 +1,9 @@
1#ifndef _DW2102_H_
2#define _DW2102_H_
3
4#define DVB_USB_LOG_PREFIX "dw2102"
5#include "dvb-usb.h"
6
7extern int dvb_usb_dw2102_debug;
8#define deb_xfer(args...) dprintk(dvb_usb_dw2102_debug, 0x02, args)
9#endif
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig
index c20553c4da1f..574dffe91b68 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -97,9 +97,8 @@ comment "DVB-T (terrestrial) frontends"
97 97
98config DVB_SP8870 98config DVB_SP8870
99 tristate "Spase sp8870 based" 99 tristate "Spase sp8870 based"
100 depends on DVB_CORE && I2C && HOTPLUG 100 depends on DVB_CORE && I2C
101 default m if DVB_FE_CUSTOMISE 101 default m if DVB_FE_CUSTOMISE
102 select FW_LOADER
103 help 102 help
104 A DVB-T tuner module. Say Y when you want to support this frontend. 103 A DVB-T tuner module. Say Y when you want to support this frontend.
105 104
@@ -110,9 +109,8 @@ config DVB_SP8870
110 109
111config DVB_SP887X 110config DVB_SP887X
112 tristate "Spase sp887x based" 111 tristate "Spase sp887x based"
113 depends on DVB_CORE && I2C && HOTPLUG 112 depends on DVB_CORE && I2C
114 default m if DVB_FE_CUSTOMISE 113 default m if DVB_FE_CUSTOMISE
115 select FW_LOADER
116 help 114 help
117 A DVB-T tuner module. Say Y when you want to support this frontend. 115 A DVB-T tuner module. Say Y when you want to support this frontend.
118 116
@@ -135,6 +133,20 @@ config DVB_CX22702
135 help 133 help
136 A DVB-T tuner module. Say Y when you want to support this frontend. 134 A DVB-T tuner module. Say Y when you want to support this frontend.
137 135
136config DVB_DRX397XD
137 tristate "Micronas DRX3975D/DRX3977D based"
138 depends on DVB_CORE && I2C && HOTPLUG
139 default m if DVB_FE_CUSTOMISE
140 select FW_LOADER
141 help
142 A DVB-T tuner module. Say Y when you want to support this frontend.
143
144 TODO:
145 This driver needs external firmware. Please use the command
146 "<kerneldir>/Documentation/dvb/get_dvb_firmware drx397xD" to
147 download/extract them, and then copy them to /usr/lib/hotplug/firmware
148 or /lib/firmware (depending on configuration of firmware hotplug).
149
138config DVB_L64781 150config DVB_L64781
139 tristate "LSI L64781" 151 tristate "LSI L64781"
140 depends on DVB_CORE && I2C 152 depends on DVB_CORE && I2C
@@ -144,9 +156,8 @@ config DVB_L64781
144 156
145config DVB_TDA1004X 157config DVB_TDA1004X
146 tristate "Philips TDA10045H/TDA10046H based" 158 tristate "Philips TDA10045H/TDA10046H based"
147 depends on DVB_CORE && I2C && HOTPLUG 159 depends on DVB_CORE && I2C
148 default m if DVB_FE_CUSTOMISE 160 default m if DVB_FE_CUSTOMISE
149 select FW_LOADER
150 help 161 help
151 A DVB-T tuner module. Say Y when you want to support this frontend. 162 A DVB-T tuner module. Say Y when you want to support this frontend.
152 163
@@ -211,9 +222,8 @@ config DVB_DIB7000P
211 222
212config DVB_TDA10048 223config DVB_TDA10048
213 tristate "Philips TDA10048HN based" 224 tristate "Philips TDA10048HN based"
214 depends on DVB_CORE && I2C && HOTPLUG 225 depends on DVB_CORE && I2C
215 default m if DVB_FE_CUSTOMISE 226 default m if DVB_FE_CUSTOMISE
216 select FW_LOADER
217 help 227 help
218 A DVB-T tuner module. Say Y when you want to support this frontend. 228 A DVB-T tuner module. Say Y when you want to support this frontend.
219 229
@@ -253,9 +263,8 @@ comment "ATSC (North American/Korean Terrestrial/Cable DTV) frontends"
253 263
254config DVB_NXT200X 264config DVB_NXT200X
255 tristate "NxtWave Communications NXT2002/NXT2004 based" 265 tristate "NxtWave Communications NXT2002/NXT2004 based"
256 depends on DVB_CORE && I2C && HOTPLUG 266 depends on DVB_CORE && I2C
257 default m if DVB_FE_CUSTOMISE 267 default m if DVB_FE_CUSTOMISE
258 select FW_LOADER
259 help 268 help
260 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want 269 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
261 to support this frontend. 270 to support this frontend.
@@ -268,9 +277,8 @@ config DVB_NXT200X
268 277
269config DVB_OR51211 278config DVB_OR51211
270 tristate "Oren OR51211 based" 279 tristate "Oren OR51211 based"
271 depends on DVB_CORE && I2C && HOTPLUG 280 depends on DVB_CORE && I2C
272 default m if DVB_FE_CUSTOMISE 281 default m if DVB_FE_CUSTOMISE
273 select FW_LOADER
274 help 282 help
275 An ATSC 8VSB tuner module. Say Y when you want to support this frontend. 283 An ATSC 8VSB tuner module. Say Y when you want to support this frontend.
276 284
@@ -281,9 +289,8 @@ config DVB_OR51211
281 289
282config DVB_OR51132 290config DVB_OR51132
283 tristate "Oren OR51132 based" 291 tristate "Oren OR51132 based"
284 depends on DVB_CORE && I2C && HOTPLUG 292 depends on DVB_CORE && I2C
285 default m if DVB_FE_CUSTOMISE 293 default m if DVB_FE_CUSTOMISE
286 select FW_LOADER
287 help 294 help
288 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want 295 An ATSC 8VSB and QAM64/256 tuner module. Say Y when you want
289 to support this frontend. 296 to support this frontend.
@@ -297,9 +304,8 @@ config DVB_OR51132
297 304
298config DVB_BCM3510 305config DVB_BCM3510
299 tristate "Broadcom BCM3510" 306 tristate "Broadcom BCM3510"
300 depends on DVB_CORE && I2C && HOTPLUG 307 depends on DVB_CORE && I2C
301 default m if DVB_FE_CUSTOMISE 308 default m if DVB_FE_CUSTOMISE
302 select FW_LOADER
303 help 309 help
304 An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to 310 An ATSC 8VSB/16VSB and QAM64/256 tuner module. Say Y when you want to
305 support this frontend. 311 support this frontend.
diff --git a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
index a89dc0fc4c6f..028da55611c0 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_DVB_NXT6000) += nxt6000.o
25obj-$(CONFIG_DVB_MT352) += mt352.o 25obj-$(CONFIG_DVB_MT352) += mt352.o
26obj-$(CONFIG_DVB_ZL10353) += zl10353.o 26obj-$(CONFIG_DVB_ZL10353) += zl10353.o
27obj-$(CONFIG_DVB_CX22702) += cx22702.o 27obj-$(CONFIG_DVB_CX22702) += cx22702.o
28obj-$(CONFIG_DVB_DRX397XD) += drx397xD.o
28obj-$(CONFIG_DVB_TDA10021) += tda10021.o 29obj-$(CONFIG_DVB_TDA10021) += tda10021.o
29obj-$(CONFIG_DVB_TDA10023) += tda10023.o 30obj-$(CONFIG_DVB_TDA10023) += tda10023.o
30obj-$(CONFIG_DVB_STV0297) += stv0297.o 31obj-$(CONFIG_DVB_STV0297) += stv0297.o
diff --git a/drivers/media/dvb/frontends/drx397xD.c b/drivers/media/dvb/frontends/drx397xD.c
new file mode 100644
index 000000000000..3cbed874a6f8
--- /dev/null
+++ b/drivers/media/dvb/frontends/drx397xD.c
@@ -0,0 +1,1504 @@
1/*
2 * Driver for Micronas drx397xD demodulator
3 *
4 * Copyright (C) 2007 Henk Vergonet <Henk.Vergonet@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#define DEBUG /* uncomment if you want debugging output */
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/moduleparam.h>
24#include <linux/init.h>
25#include <linux/device.h>
26#include <linux/delay.h>
27#include <linux/string.h>
28#include <linux/firmware.h>
29#include <asm/div64.h>
30
31#include "dvb_frontend.h"
32#include "drx397xD.h"
33
34static const char mod_name[] = "drx397xD";
35
36#define MAX_CLOCK_DRIFT 200 /* maximal 200 PPM allowed */
37
38#define F_SET_0D0h 1
39#define F_SET_0D4h 2
40
41typedef enum fw_ix {
42#define _FW_ENTRY(a, b) b
43#include "drx397xD_fw.h"
44} fw_ix_t;
45
46/* chip specifics */
47struct drx397xD_state {
48 struct i2c_adapter *i2c;
49 struct dvb_frontend frontend;
50 struct drx397xD_config config;
51 fw_ix_t chip_rev;
52 int flags;
53 u32 bandwidth_parm; /* internal bandwidth conversions */
54 u32 f_osc; /* w90: actual osc frequency [Hz] */
55};
56
57/*******************************************************************************
58 * Firmware
59 ******************************************************************************/
60
61static const char *blob_name[] = {
62#define _BLOB_ENTRY(a, b) a
63#include "drx397xD_fw.h"
64};
65
66typedef enum blob_ix {
67#define _BLOB_ENTRY(a, b) b
68#include "drx397xD_fw.h"
69} blob_ix_t;
70
71static struct {
72 const char *name;
73 const struct firmware *file;
74 rwlock_t lock;
75 int refcnt;
76 const u8 *data[ARRAY_SIZE(blob_name)];
77} fw[] = {
78#define _FW_ENTRY(a, b) { \
79 .name = a, \
80 .file = 0, \
81 .lock = RW_LOCK_UNLOCKED, \
82 .refcnt = 0, \
83 .data = { } }
84#include "drx397xD_fw.h"
85};
86
87/* use only with writer lock aquired */
88static void _drx_release_fw(struct drx397xD_state *s, fw_ix_t ix)
89{
90 memset(&fw[ix].data[0], 0, sizeof(fw[0].data));
91 if (fw[ix].file)
92 release_firmware(fw[ix].file);
93}
94
95static void drx_release_fw(struct drx397xD_state *s)
96{
97 fw_ix_t ix = s->chip_rev;
98
99 pr_debug("%s\n", __FUNCTION__);
100
101 write_lock(&fw[ix].lock);
102 if (fw[ix].refcnt) {
103 fw[ix].refcnt--;
104 if (fw[ix].refcnt == 0)
105 _drx_release_fw(s, ix);
106 }
107 write_unlock(&fw[ix].lock);
108}
109
110static int drx_load_fw(struct drx397xD_state *s, fw_ix_t ix)
111{
112 const u8 *data;
113 size_t size, len;
114 int i = 0, j, rc = -EINVAL;
115
116 pr_debug("%s\n", __FUNCTION__);
117
118 if (ix < 0 || ix >= ARRAY_SIZE(fw))
119 return -EINVAL;
120 s->chip_rev = ix;
121
122 write_lock(&fw[ix].lock);
123 if (fw[ix].file) {
124 rc = 0;
125 goto exit_ok;
126 }
127 memset(&fw[ix].data[0], 0, sizeof(fw[0].data));
128
129 if (request_firmware(&fw[ix].file, fw[ix].name, &s->i2c->dev) != 0) {
130 printk(KERN_ERR "%s: Firmware \"%s\" not available\n",
131 mod_name, fw[ix].name);
132 rc = -ENOENT;
133 goto exit_err;
134 }
135
136 if (!fw[ix].file->data || fw[ix].file->size < 10)
137 goto exit_corrupt;
138
139 data = fw[ix].file->data;
140 size = fw[ix].file->size;
141
142 if (data[i++] != 2) /* check firmware version */
143 goto exit_corrupt;
144
145 do {
146 switch (data[i++]) {
147 case 0x00: /* bytecode */
148 if (i >= size)
149 break;
150 i += data[i];
151 case 0x01: /* reset */
152 case 0x02: /* sleep */
153 i++;
154 break;
155 case 0xfe: /* name */
156 len = strnlen(&data[i], size - i);
157 if (i + len + 1 >= size)
158 goto exit_corrupt;
159 if (data[i + len + 1] != 0)
160 goto exit_corrupt;
161 for (j = 0; j < ARRAY_SIZE(blob_name); j++) {
162 if (strcmp(blob_name[j], &data[i]) == 0) {
163 fw[ix].data[j] = &data[i + len + 1];
164 pr_debug("Loading %s\n", blob_name[j]);
165 }
166 }
167 i += len + 1;
168 break;
169 case 0xff: /* file terminator */
170 if (i == size) {
171 rc = 0;
172 goto exit_ok;
173 }
174 default:
175 goto exit_corrupt;
176 }
177 } while (i < size);
178 exit_corrupt:
179 printk(KERN_ERR "%s: Firmware is corrupt\n", mod_name);
180 exit_err:
181 _drx_release_fw(s, ix);
182 fw[ix].refcnt--;
183 exit_ok:
184 fw[ix].refcnt++;
185 write_unlock(&fw[ix].lock);
186 return rc;
187}
188
189/*******************************************************************************
190 * i2c bus IO
191 ******************************************************************************/
192
193static int write_fw(struct drx397xD_state *s, blob_ix_t ix)
194{
195 struct i2c_msg msg = {.addr = s->config.demod_address,.flags = 0 };
196 const u8 *data;
197 int len, rc = 0, i = 0;
198
199 if (ix < 0 || ix >= ARRAY_SIZE(blob_name)) {
200 pr_debug("%s drx_fw_ix_t out of range\n", __FUNCTION__);
201 return -EINVAL;
202 }
203 pr_debug("%s %s\n", __FUNCTION__, blob_name[ix]);
204
205 read_lock(&fw[s->chip_rev].lock);
206 data = fw[s->chip_rev].data[ix];
207 if (!data) {
208 rc = -EINVAL;
209 goto exit_rc;
210 }
211
212 for (;;) {
213 switch (data[i++]) {
214 case 0: /* bytecode */
215 len = data[i++];
216 msg.len = len;
217 msg.buf = (__u8 *) &data[i];
218 if (i2c_transfer(s->i2c, &msg, 1) != 1) {
219 rc = -EIO;
220 goto exit_rc;
221 }
222 i += len;
223 break;
224 case 1: /* reset */
225 case 2: /* sleep */
226 i++;
227 break;
228 default:
229 goto exit_rc;
230 }
231 }
232 exit_rc:
233 read_unlock(&fw[s->chip_rev].lock);
234 return 0;
235}
236
237/* Function is not endian safe, use the RD16 wrapper below */
238static int _read16(struct drx397xD_state *s, u32 i2c_adr)
239{
240 int rc;
241 u8 a[4];
242 u16 v;
243 struct i2c_msg msg[2] = {
244 {
245 .addr = s->config.demod_address,
246 .flags = 0,
247 .buf = a,
248 .len = sizeof(a)
249 }
250 , {
251 .addr = s->config.demod_address,
252 .flags = I2C_M_RD,
253 .buf = (u8 *) & v,
254 .len = sizeof(v)
255 }
256 };
257
258 *(u32 *) a = i2c_adr;
259
260 rc = i2c_transfer(s->i2c, msg, 2);
261 if (rc != 2)
262 return -EIO;
263
264 return le16_to_cpu(v);
265}
266
267/* Function is not endian safe, use the WR16.. wrappers below */
268static int _write16(struct drx397xD_state *s, u32 i2c_adr, u16 val)
269{
270 u8 a[6];
271 int rc;
272 struct i2c_msg msg = {
273 .addr = s->config.demod_address,
274 .flags = 0,
275 .buf = a,
276 .len = sizeof(a)
277 };
278
279 *(u32 *) a = i2c_adr;
280 *(u16 *) & a[4] = val;
281
282 rc = i2c_transfer(s->i2c, &msg, 1);
283 if (rc != 1)
284 return -EIO;
285 return 0;
286}
287
288#define WR16(ss,adr, val) \
289 _write16(ss, I2C_ADR_C0(adr), cpu_to_le16(val))
290#define WR16_E0(ss,adr, val) \
291 _write16(ss, I2C_ADR_E0(adr), cpu_to_le16(val))
292#define RD16(ss,adr) \
293 _read16(ss, I2C_ADR_C0(adr))
294
295#define EXIT_RC( cmd ) if ( (rc = (cmd)) < 0) goto exit_rc
296
297/*******************************************************************************
298 * Tuner callback
299 ******************************************************************************/
300
301static int PLL_Set(struct drx397xD_state *s,
302 struct dvb_frontend_parameters *fep, int *df_tuner)
303{
304 struct dvb_frontend *fe = &s->frontend;
305 u32 f_tuner, f = fep->frequency;
306 int rc;
307
308 pr_debug("%s\n", __FUNCTION__);
309
310 if ((f > s->frontend.ops.tuner_ops.info.frequency_max) ||
311 (f < s->frontend.ops.tuner_ops.info.frequency_min))
312 return -EINVAL;
313
314 *df_tuner = 0;
315 if (!s->frontend.ops.tuner_ops.set_params ||
316 !s->frontend.ops.tuner_ops.get_frequency)
317 return -ENOSYS;
318
319 rc = s->frontend.ops.tuner_ops.set_params(fe, fep);
320 if (rc < 0)
321 return rc;
322
323 rc = s->frontend.ops.tuner_ops.get_frequency(fe, &f_tuner);
324 if (rc < 0)
325 return rc;
326
327 *df_tuner = f_tuner - f;
328 pr_debug("%s requested %d [Hz] tuner %d [Hz]\n", __FUNCTION__, f,
329 f_tuner);
330
331 return 0;
332}
333
334/*******************************************************************************
335 * Demodulator helper functions
336 ******************************************************************************/
337
338static int SC_WaitForReady(struct drx397xD_state *s)
339{
340 int cnt = 1000;
341 int rc;
342
343 pr_debug("%s\n", __FUNCTION__);
344
345 while (cnt--) {
346 rc = RD16(s, 0x820043);
347 if (rc == 0)
348 return 0;
349 }
350 return -1;
351}
352
353static int SC_SendCommand(struct drx397xD_state *s, int cmd)
354{
355 int rc;
356
357 pr_debug("%s\n", __FUNCTION__);
358
359 WR16(s, 0x820043, cmd);
360 SC_WaitForReady(s);
361 rc = RD16(s, 0x820042);
362 if ((rc & 0xffff) == 0xffff)
363 return -1;
364 return 0;
365}
366
367static int HI_Command(struct drx397xD_state *s, u16 cmd)
368{
369 int rc, cnt = 1000;
370
371 pr_debug("%s\n", __FUNCTION__);
372
373 rc = WR16(s, 0x420032, cmd);
374 if (rc < 0)
375 return rc;
376
377 do {
378 rc = RD16(s, 0x420032);
379 if (rc == 0) {
380 rc = RD16(s, 0x420031);
381 return rc;
382 }
383 if (rc < 0)
384 return rc;
385 } while (--cnt);
386 return rc;
387}
388
389static int HI_CfgCommand(struct drx397xD_state *s)
390{
391
392 pr_debug("%s\n", __FUNCTION__);
393
394 WR16(s, 0x420033, 0x3973);
395 WR16(s, 0x420034, s->config.w50); // code 4, log 4
396 WR16(s, 0x420035, s->config.w52); // code 15, log 9
397 WR16(s, 0x420036, s->config.demod_address << 1);
398 WR16(s, 0x420037, s->config.w56); // code (set_i2c ?? initX 1 ), log 1
399// WR16(s, 0x420033, 0x3973);
400 if ((s->config.w56 & 8) == 0)
401 return HI_Command(s, 3);
402 return WR16(s, 0x420032, 0x3);
403}
404
405static const u8 fastIncrDecLUT_15273[] = {
406 0x0e, 0x0f, 0x0f, 0x10, 0x11, 0x12, 0x12, 0x13, 0x14,
407 0x15, 0x16, 0x17, 0x18, 0x1a, 0x1b, 0x1c, 0x1d, 0x1f
408};
409
410static const u8 slowIncrDecLUT_15272[] = {
411 3, 4, 4, 5, 6
412};
413
414static int SetCfgIfAgc(struct drx397xD_state *s, struct drx397xD_CfgIfAgc *agc)
415{
416 u16 w06 = agc->w06;
417 u16 w08 = agc->w08;
418 u16 w0A = agc->w0A;
419 u16 w0C = agc->w0C;
420 int quot, rem, i, rc = -EINVAL;
421
422 pr_debug("%s\n", __FUNCTION__);
423
424 if (agc->w04 > 0x3ff)
425 goto exit_rc;
426
427 if (agc->d00 == 1) {
428 EXIT_RC(RD16(s, 0x0c20010));
429 rc &= ~0x10;
430 EXIT_RC(WR16(s, 0x0c20010, rc));
431 return WR16(s, 0x0c20030, agc->w04 & 0x7ff);
432 }
433
434 if (agc->d00 != 0)
435 goto exit_rc;
436 if (w0A < w08)
437 goto exit_rc;
438 if (w0A > 0x3ff)
439 goto exit_rc;
440 if (w0C > 0x3ff)
441 goto exit_rc;
442 if (w06 > 0x3ff)
443 goto exit_rc;
444
445 EXIT_RC(RD16(s, 0x0c20010));
446 rc |= 0x10;
447 EXIT_RC(WR16(s, 0x0c20010, rc));
448
449 EXIT_RC(WR16(s, 0x0c20025, (w06 >> 1) & 0x1ff));
450 EXIT_RC(WR16(s, 0x0c20031, (w0A - w08) >> 1));
451 EXIT_RC(WR16(s, 0x0c20032, ((w0A + w08) >> 1) - 0x1ff));
452
453 quot = w0C / 113;
454 rem = w0C % 113;
455 if (quot <= 8) {
456 quot = 8 - quot;
457 } else {
458 quot = 0;
459 rem += 113;
460 }
461
462 EXIT_RC(WR16(s, 0x0c20024, quot));
463
464 i = fastIncrDecLUT_15273[rem / 8];
465 EXIT_RC(WR16(s, 0x0c2002d, i));
466 EXIT_RC(WR16(s, 0x0c2002e, i));
467
468 i = slowIncrDecLUT_15272[rem / 28];
469 EXIT_RC(WR16(s, 0x0c2002b, i));
470 rc = WR16(s, 0x0c2002c, i);
471 exit_rc:
472 return rc;
473}
474
475static int SetCfgRfAgc(struct drx397xD_state *s, struct drx397xD_CfgRfAgc *agc)
476{
477 u16 w04 = agc->w04;
478 u16 w06 = agc->w06;
479 int rc = -1;
480
481 pr_debug("%s %d 0x%x 0x%x\n", __FUNCTION__, agc->d00, w04, w06);
482
483 if (w04 > 0x3ff)
484 goto exit_rc;
485
486 switch (agc->d00) {
487 case 1:
488 if (w04 == 0x3ff)
489 w04 = 0x400;
490
491 EXIT_RC(WR16(s, 0x0c20036, w04));
492 s->config.w9C &= ~2;
493 EXIT_RC(WR16(s, 0x0c20015, s->config.w9C));
494 EXIT_RC(RD16(s, 0x0c20010));
495 rc &= 0xbfdf;
496 EXIT_RC(WR16(s, 0x0c20010, rc));
497 EXIT_RC(RD16(s, 0x0c20013));
498 rc &= ~2;
499 break;
500 case 0:
501 // loc_8000659
502 s->config.w9C &= ~2;
503 EXIT_RC(WR16(s, 0x0c20015, s->config.w9C));
504 EXIT_RC(RD16(s, 0x0c20010));
505 rc &= 0xbfdf;
506 rc |= 0x4000;
507 EXIT_RC(WR16(s, 0x0c20010, rc));
508 EXIT_RC(WR16(s, 0x0c20051, (w06 >> 4) & 0x3f));
509 EXIT_RC(RD16(s, 0x0c20013));
510 rc &= ~2;
511 break;
512 default:
513 s->config.w9C |= 2;
514 EXIT_RC(WR16(s, 0x0c20015, s->config.w9C));
515 EXIT_RC(RD16(s, 0x0c20010));
516 rc &= 0xbfdf;
517 EXIT_RC(WR16(s, 0x0c20010, rc));
518
519 EXIT_RC(WR16(s, 0x0c20036, 0));
520
521 EXIT_RC(RD16(s, 0x0c20013));
522 rc |= 2;
523 }
524 rc = WR16(s, 0x0c20013, rc);
525 exit_rc:
526 return rc;
527}
528
529static int GetLockStatus(struct drx397xD_state *s, int *lockstat)
530{
531 int rc;
532
533 *lockstat = 0;
534
535 rc = RD16(s, 0x082004b);
536 if (rc < 0)
537 return rc;
538
539 if (s->config.d60 != 2)
540 return 0;
541
542 if ((rc & 7) == 7)
543 *lockstat |= 1;
544 if ((rc & 3) == 3)
545 *lockstat |= 2;
546 if (rc & 1)
547 *lockstat |= 4;
548 return 0;
549}
550
551static int CorrectSysClockDeviation(struct drx397xD_state *s)
552{
553 int rc = -EINVAL;
554 int lockstat;
555 u32 clk, clk_limit;
556
557 pr_debug("%s\n", __FUNCTION__);
558
559 if (s->config.d5C == 0) {
560 EXIT_RC(WR16(s, 0x08200e8, 0x010));
561 EXIT_RC(WR16(s, 0x08200e9, 0x113));
562 s->config.d5C = 1;
563 return rc;
564 }
565 if (s->config.d5C != 1)
566 goto exit_rc;
567
568 rc = RD16(s, 0x0820048);
569
570 rc = GetLockStatus(s, &lockstat);
571 if (rc < 0)
572 goto exit_rc;
573 if ((lockstat & 1) == 0)
574 goto exit_rc;
575
576 EXIT_RC(WR16(s, 0x0420033, 0x200));
577 EXIT_RC(WR16(s, 0x0420034, 0xc5));
578 EXIT_RC(WR16(s, 0x0420035, 0x10));
579 EXIT_RC(WR16(s, 0x0420036, 0x1));
580 EXIT_RC(WR16(s, 0x0420037, 0xa));
581 EXIT_RC(HI_Command(s, 6));
582 EXIT_RC(RD16(s, 0x0420040));
583 clk = rc;
584 EXIT_RC(RD16(s, 0x0420041));
585 clk |= rc << 16;
586
587 if (clk <= 0x26ffff)
588 goto exit_rc;
589 if (clk > 0x610000)
590 goto exit_rc;
591
592 if (!s->bandwidth_parm)
593 return -EINVAL;
594
595 /* round & convert to Hz */
596 clk = ((u64) (clk + 0x800000) * s->bandwidth_parm + (1 << 20)) >> 21;
597 clk_limit = s->config.f_osc * MAX_CLOCK_DRIFT / 1000;
598
599 if (clk - s->config.f_osc * 1000 + clk_limit <= 2 * clk_limit) {
600 s->f_osc = clk;
601 pr_debug("%s: osc %d %d [Hz]\n", __FUNCTION__,
602 s->config.f_osc * 1000, clk - s->config.f_osc * 1000);
603 }
604 rc = WR16(s, 0x08200e8, 0);
605 exit_rc:
606 return rc;
607}
608
609static int ConfigureMPEGOutput(struct drx397xD_state *s, int type)
610{
611 int rc, si, bp;
612
613 pr_debug("%s\n", __FUNCTION__);
614
615 si = s->config.wA0;
616 if (s->config.w98 == 0) {
617 si |= 1;
618 bp = 0;
619 } else {
620 si &= ~1;
621 bp = 0x200;
622 }
623 if (s->config.w9A == 0) {
624 si |= 0x80;
625 } else {
626 si &= ~0x80;
627 }
628
629 EXIT_RC(WR16(s, 0x2150045, 0));
630 EXIT_RC(WR16(s, 0x2150010, si));
631 EXIT_RC(WR16(s, 0x2150011, bp));
632 rc = WR16(s, 0x2150012, (type == 0 ? 0xfff : 0));
633 exit_rc:
634 return rc;
635}
636
637static int drx_tune(struct drx397xD_state *s,
638 struct dvb_frontend_parameters *fep)
639{
640 u16 v22 = 0;
641 u16 v1C = 0;
642 u16 v1A = 0;
643 u16 v18 = 0;
644 u32 edi = 0, ebx = 0, ebp = 0, edx = 0;
645 u16 v20 = 0, v1E = 0, v16 = 0, v14 = 0, v12 = 0, v10 = 0, v0E = 0;
646
647 int rc, df_tuner;
648 int a, b, c, d;
649 pr_debug("%s %d\n", __FUNCTION__, s->config.d60);
650
651 if (s->config.d60 != 2)
652 goto set_tuner;
653 rc = CorrectSysClockDeviation(s);
654 if (rc < 0)
655 goto set_tuner;
656
657 s->config.d60 = 1;
658 rc = ConfigureMPEGOutput(s, 0);
659 if (rc < 0)
660 goto set_tuner;
661 set_tuner:
662
663 rc = PLL_Set(s, fep, &df_tuner);
664 if (rc < 0) {
665 printk(KERN_ERR "Error in pll_set\n");
666 goto exit_rc;
667 }
668 msleep(200);
669
670 a = rc = RD16(s, 0x2150016);
671 if (rc < 0)
672 goto exit_rc;
673 b = rc = RD16(s, 0x2150010);
674 if (rc < 0)
675 goto exit_rc;
676 c = rc = RD16(s, 0x2150034);
677 if (rc < 0)
678 goto exit_rc;
679 d = rc = RD16(s, 0x2150035);
680 if (rc < 0)
681 goto exit_rc;
682 rc = WR16(s, 0x2150014, c);
683 rc = WR16(s, 0x2150015, d);
684 rc = WR16(s, 0x2150010, 0);
685 rc = WR16(s, 0x2150000, 2);
686 rc = WR16(s, 0x2150036, 0x0fff);
687 rc = WR16(s, 0x2150016, a);
688
689 rc = WR16(s, 0x2150010, 2);
690 rc = WR16(s, 0x2150007, 0);
691 rc = WR16(s, 0x2150000, 1);
692 rc = WR16(s, 0x2110000, 0);
693 rc = WR16(s, 0x0800000, 0);
694 rc = WR16(s, 0x2800000, 0);
695 rc = WR16(s, 0x2110010, 0x664);
696
697 rc = write_fw(s, DRXD_ResetECRAM);
698 rc = WR16(s, 0x2110000, 1);
699
700 rc = write_fw(s, DRXD_InitSC);
701 if (rc < 0)
702 goto exit_rc;
703
704 rc = SetCfgIfAgc(s, &s->config.ifagc);
705 if (rc < 0)
706 goto exit_rc;
707
708 rc = SetCfgRfAgc(s, &s->config.rfagc);
709 if (rc < 0)
710 goto exit_rc;
711
712 if (fep->u.ofdm.transmission_mode != TRANSMISSION_MODE_2K)
713 v22 = 1;
714 switch (fep->u.ofdm.transmission_mode) {
715 case TRANSMISSION_MODE_8K:
716 edi = 1;
717 if (s->chip_rev == DRXD_FW_B1)
718 break;
719
720 rc = WR16(s, 0x2010010, 0);
721 if (rc < 0)
722 break;
723 v1C = 0x63;
724 v1A = 0x53;
725 v18 = 0x43;
726 break;
727 default:
728 edi = 0;
729 if (s->chip_rev == DRXD_FW_B1)
730 break;
731
732 rc = WR16(s, 0x2010010, 1);
733 if (rc < 0)
734 break;
735
736 v1C = 0x61;
737 v1A = 0x47;
738 v18 = 0x41;
739 }
740
741 switch (fep->u.ofdm.guard_interval) {
742 case GUARD_INTERVAL_1_4:
743 edi |= 0x0c;
744 break;
745 case GUARD_INTERVAL_1_8:
746 edi |= 0x08;
747 break;
748 case GUARD_INTERVAL_1_16:
749 edi |= 0x04;
750 break;
751 case GUARD_INTERVAL_1_32:
752 break;
753 default:
754 v22 |= 2;
755 }
756
757 ebx = 0;
758 ebp = 0;
759 v20 = 0;
760 v1E = 0;
761 v16 = 0;
762 v14 = 0;
763 v12 = 0;
764 v10 = 0;
765 v0E = 0;
766
767 switch (fep->u.ofdm.hierarchy_information) {
768 case HIERARCHY_1:
769 edi |= 0x40;
770 if (s->chip_rev == DRXD_FW_B1)
771 break;
772 rc = WR16(s, 0x1c10047, 1);
773 if (rc < 0)
774 goto exit_rc;
775 rc = WR16(s, 0x2010012, 1);
776 if (rc < 0)
777 goto exit_rc;
778 ebx = 0x19f;
779 ebp = 0x1fb;
780 v20 = 0x0c0;
781 v1E = 0x195;
782 v16 = 0x1d6;
783 v14 = 0x1ef;
784 v12 = 4;
785 v10 = 5;
786 v0E = 5;
787 break;
788 case HIERARCHY_2:
789 edi |= 0x80;
790 if (s->chip_rev == DRXD_FW_B1)
791 break;
792 rc = WR16(s, 0x1c10047, 2);
793 if (rc < 0)
794 goto exit_rc;
795 rc = WR16(s, 0x2010012, 2);
796 if (rc < 0)
797 goto exit_rc;
798 ebx = 0x08f;
799 ebp = 0x12f;
800 v20 = 0x0c0;
801 v1E = 0x11e;
802 v16 = 0x1d6;
803 v14 = 0x15e;
804 v12 = 4;
805 v10 = 5;
806 v0E = 5;
807 break;
808 case HIERARCHY_4:
809 edi |= 0xc0;
810 if (s->chip_rev == DRXD_FW_B1)
811 break;
812 rc = WR16(s, 0x1c10047, 3);
813 if (rc < 0)
814 goto exit_rc;
815 rc = WR16(s, 0x2010012, 3);
816 if (rc < 0)
817 goto exit_rc;
818 ebx = 0x14d;
819 ebp = 0x197;
820 v20 = 0x0c0;
821 v1E = 0x1ce;
822 v16 = 0x1d6;
823 v14 = 0x11a;
824 v12 = 4;
825 v10 = 6;
826 v0E = 5;
827 break;
828 default:
829 v22 |= 8;
830 if (s->chip_rev == DRXD_FW_B1)
831 break;
832 rc = WR16(s, 0x1c10047, 0);
833 if (rc < 0)
834 goto exit_rc;
835 rc = WR16(s, 0x2010012, 0);
836 if (rc < 0)
837 goto exit_rc;
838 // QPSK QAM16 QAM64
839 ebx = 0x19f; // 62
840 ebp = 0x1fb; // 15
841 v20 = 0x16a; // 62
842 v1E = 0x195; // 62
843 v16 = 0x1bb; // 15
844 v14 = 0x1ef; // 15
845 v12 = 5; // 16
846 v10 = 5; // 16
847 v0E = 5; // 16
848 }
849
850 switch (fep->u.ofdm.constellation) {
851 default:
852 v22 |= 4;
853 case QPSK:
854 if (s->chip_rev == DRXD_FW_B1)
855 break;
856
857 rc = WR16(s, 0x1c10046, 0);
858 if (rc < 0)
859 goto exit_rc;
860 rc = WR16(s, 0x2010011, 0);
861 if (rc < 0)
862 goto exit_rc;
863 rc = WR16(s, 0x201001a, 0x10);
864 if (rc < 0)
865 goto exit_rc;
866 rc = WR16(s, 0x201001b, 0);
867 if (rc < 0)
868 goto exit_rc;
869 rc = WR16(s, 0x201001c, 0);
870 if (rc < 0)
871 goto exit_rc;
872 rc = WR16(s, 0x1c10062, v20);
873 if (rc < 0)
874 goto exit_rc;
875 rc = WR16(s, 0x1c1002a, v1C);
876 if (rc < 0)
877 goto exit_rc;
878 rc = WR16(s, 0x1c10015, v16);
879 if (rc < 0)
880 goto exit_rc;
881 rc = WR16(s, 0x1c10016, v12);
882 if (rc < 0)
883 goto exit_rc;
884 break;
885 case QAM_16:
886 edi |= 0x10;
887 if (s->chip_rev == DRXD_FW_B1)
888 break;
889
890 rc = WR16(s, 0x1c10046, 1);
891 if (rc < 0)
892 goto exit_rc;
893 rc = WR16(s, 0x2010011, 1);
894 if (rc < 0)
895 goto exit_rc;
896 rc = WR16(s, 0x201001a, 0x10);
897 if (rc < 0)
898 goto exit_rc;
899 rc = WR16(s, 0x201001b, 4);
900 if (rc < 0)
901 goto exit_rc;
902 rc = WR16(s, 0x201001c, 0);
903 if (rc < 0)
904 goto exit_rc;
905 rc = WR16(s, 0x1c10062, v1E);
906 if (rc < 0)
907 goto exit_rc;
908 rc = WR16(s, 0x1c1002a, v1A);
909 if (rc < 0)
910 goto exit_rc;
911 rc = WR16(s, 0x1c10015, v14);
912 if (rc < 0)
913 goto exit_rc;
914 rc = WR16(s, 0x1c10016, v10);
915 if (rc < 0)
916 goto exit_rc;
917 break;
918 case QAM_64:
919 edi |= 0x20;
920 rc = WR16(s, 0x1c10046, 2);
921 if (rc < 0)
922 goto exit_rc;
923 rc = WR16(s, 0x2010011, 2);
924 if (rc < 0)
925 goto exit_rc;
926 rc = WR16(s, 0x201001a, 0x20);
927 if (rc < 0)
928 goto exit_rc;
929 rc = WR16(s, 0x201001b, 8);
930 if (rc < 0)
931 goto exit_rc;
932 rc = WR16(s, 0x201001c, 2);
933 if (rc < 0)
934 goto exit_rc;
935 rc = WR16(s, 0x1c10062, ebx);
936 if (rc < 0)
937 goto exit_rc;
938 rc = WR16(s, 0x1c1002a, v18);
939 if (rc < 0)
940 goto exit_rc;
941 rc = WR16(s, 0x1c10015, ebp);
942 if (rc < 0)
943 goto exit_rc;
944 rc = WR16(s, 0x1c10016, v0E);
945 if (rc < 0)
946 goto exit_rc;
947 break;
948 }
949
950 if (s->config.s20d24 == 1) {
951 rc = WR16(s, 0x2010013, 0);
952 } else {
953 rc = WR16(s, 0x2010013, 1);
954 edi |= 0x1000;
955 }
956
957 switch (fep->u.ofdm.code_rate_HP) {
958 default:
959 v22 |= 0x10;
960 case FEC_1_2:
961 if (s->chip_rev == DRXD_FW_B1)
962 break;
963 rc = WR16(s, 0x2090011, 0);
964 break;
965 case FEC_2_3:
966 edi |= 0x200;
967 if (s->chip_rev == DRXD_FW_B1)
968 break;
969 rc = WR16(s, 0x2090011, 1);
970 break;
971 case FEC_3_4:
972 edi |= 0x400;
973 if (s->chip_rev == DRXD_FW_B1)
974 break;
975 rc = WR16(s, 0x2090011, 2);
976 break;
977 case FEC_5_6: /* 5 */
978 edi |= 0x600;
979 if (s->chip_rev == DRXD_FW_B1)
980 break;
981 rc = WR16(s, 0x2090011, 3);
982 break;
983 case FEC_7_8: /* 7 */
984 edi |= 0x800;
985 if (s->chip_rev == DRXD_FW_B1)
986 break;
987 rc = WR16(s, 0x2090011, 4);
988 break;
989 };
990 if (rc < 0)
991 goto exit_rc;
992
993 switch (fep->u.ofdm.bandwidth) {
994 default:
995 rc = -EINVAL;
996 goto exit_rc;
997 case BANDWIDTH_8_MHZ: /* 0 */
998 case BANDWIDTH_AUTO:
999 rc = WR16(s, 0x0c2003f, 0x32);
1000 s->bandwidth_parm = ebx = 0x8b8249; // 9142857
1001 edx = 0;
1002 break;
1003 case BANDWIDTH_7_MHZ:
1004 rc = WR16(s, 0x0c2003f, 0x3b);
1005 s->bandwidth_parm = ebx = 0x7a1200; // 8000000
1006 edx = 0x4807;
1007 break;
1008 case BANDWIDTH_6_MHZ:
1009 rc = WR16(s, 0x0c2003f, 0x47);
1010 s->bandwidth_parm = ebx = 0x68a1b6; // 6857142
1011 edx = 0x0f07;
1012 break;
1013 };
1014
1015 if (rc < 0)
1016 goto exit_rc;
1017
1018 rc = WR16(s, 0x08200ec, edx);
1019 if (rc < 0)
1020 goto exit_rc;
1021
1022 rc = RD16(s, 0x0820050);
1023 if (rc < 0)
1024 goto exit_rc;
1025 rc = WR16(s, 0x0820050, rc);
1026
1027 {
1028 /* Configure bandwidth specific factor */
1029 ebx = div64_u64(((u64) (s->f_osc) << 21) + (ebx >> 1),
1030 (u64)ebx) - 0x800000;
1031 EXIT_RC(WR16(s, 0x0c50010, ebx & 0xffff));
1032 EXIT_RC(WR16(s, 0x0c50011, ebx >> 16));
1033
1034 /* drx397xD oscillator calibration */
1035 ebx = div64_u64(((u64) (s->config.f_if + df_tuner) << 28) +
1036 (s->f_osc >> 1), (u64)s->f_osc);
1037 }
1038 ebx &= 0xfffffff;
1039 if (fep->inversion == INVERSION_ON)
1040 ebx = 0x10000000 - ebx;
1041
1042 EXIT_RC(WR16(s, 0x0c30010, ebx & 0xffff));
1043 EXIT_RC(WR16(s, 0x0c30011, ebx >> 16));
1044
1045 EXIT_RC(WR16(s, 0x0800000, 1));
1046 EXIT_RC(RD16(s, 0x0800000));
1047
1048
1049 EXIT_RC(SC_WaitForReady(s));
1050 EXIT_RC(WR16(s, 0x0820042, 0));
1051 EXIT_RC(WR16(s, 0x0820041, v22));
1052 EXIT_RC(WR16(s, 0x0820040, edi));
1053 EXIT_RC(SC_SendCommand(s, 3));
1054
1055 rc = RD16(s, 0x0800000);
1056
1057 SC_WaitForReady(s);
1058 WR16(s, 0x0820042, 0);
1059 WR16(s, 0x0820041, 1);
1060 WR16(s, 0x0820040, 1);
1061 SC_SendCommand(s, 1);
1062
1063// rc = WR16(s, 0x2150000, 1);
1064// if (rc < 0) goto exit_rc;
1065
1066 rc = WR16(s, 0x2150000, 2);
1067 rc = WR16(s, 0x2150016, a);
1068 rc = WR16(s, 0x2150010, 4);
1069 rc = WR16(s, 0x2150036, 0);
1070 rc = WR16(s, 0x2150000, 1);
1071 s->config.d60 = 2;
1072 exit_rc:
1073 return rc;
1074}
1075
1076/*******************************************************************************
1077 * DVB interface
1078 ******************************************************************************/
1079
1080static int drx397x_init(struct dvb_frontend *fe)
1081{
1082 struct drx397xD_state *s = fe->demodulator_priv;
1083 int rc;
1084
1085 pr_debug("%s\n", __FUNCTION__);
1086
1087 s->config.rfagc.d00 = 2; /* 0x7c */
1088 s->config.rfagc.w04 = 0;
1089 s->config.rfagc.w06 = 0x3ff;
1090
1091 s->config.ifagc.d00 = 0; /* 0x68 */
1092 s->config.ifagc.w04 = 0;
1093 s->config.ifagc.w06 = 140;
1094 s->config.ifagc.w08 = 0;
1095 s->config.ifagc.w0A = 0x3ff;
1096 s->config.ifagc.w0C = 0x388;
1097
1098 /* for signal strenght calculations */
1099 s->config.ss76 = 820;
1100 s->config.ss78 = 2200;
1101 s->config.ss7A = 150;
1102
1103 /* HI_CfgCommand */
1104 s->config.w50 = 4;
1105 s->config.w52 = 9; // 0xf;
1106
1107 s->config.f_if = 42800000; /* d14: intermediate frequency [Hz] */
1108 s->config.f_osc = 48000; /* s66 : oscillator frequency [kHz] */
1109 s->config.w92 = 12000; // 20000;
1110
1111 s->config.w9C = 0x000e;
1112 s->config.w9E = 0x0000;
1113
1114 /* ConfigureMPEGOutput params */
1115 s->config.wA0 = 4;
1116 s->config.w98 = 1; // 0;
1117 s->config.w9A = 1;
1118
1119 /* get chip revision */
1120 rc = RD16(s, 0x2410019);
1121 if (rc < 0)
1122 return -ENODEV;
1123
1124 if (rc == 0) {
1125 printk(KERN_INFO "%s: chip revision A2\n", mod_name);
1126 rc = drx_load_fw(s, DRXD_FW_A2);
1127 } else {
1128
1129 rc = (rc >> 12) - 3;
1130 switch (rc) {
1131 case 1:
1132 s->flags |= F_SET_0D4h;
1133 case 0:
1134 case 4:
1135 s->flags |= F_SET_0D0h;
1136 break;
1137 case 2:
1138 case 5:
1139 break;
1140 case 3:
1141 s->flags |= F_SET_0D4h;
1142 break;
1143 default:
1144 return -ENODEV;
1145 };
1146 printk(KERN_INFO "%s: chip revision B1.%d\n", mod_name, rc);
1147 rc = drx_load_fw(s, DRXD_FW_B1);
1148 }
1149 if (rc < 0)
1150 goto error;
1151
1152 rc = WR16(s, 0x0420033, 0x3973);
1153 if (rc < 0)
1154 goto error;
1155
1156 rc = HI_Command(s, 2);
1157
1158 msleep(1);
1159
1160 if (s->chip_rev == DRXD_FW_A2) {
1161 rc = WR16(s, 0x043012d, 0x47F);
1162 if (rc < 0)
1163 goto error;
1164 }
1165 rc = WR16_E0(s, 0x0400000, 0);
1166 if (rc < 0)
1167 goto error;
1168
1169 if (s->config.w92 > 20000 || s->config.w92 % 4000) {
1170 printk(KERN_ERR "%s: invalid osc frequency\n", mod_name);
1171 rc = -1;
1172 goto error;
1173 }
1174
1175 rc = WR16(s, 0x2410010, 1);
1176 if (rc < 0)
1177 goto error;
1178 rc = WR16(s, 0x2410011, 0x15);
1179 if (rc < 0)
1180 goto error;
1181 rc = WR16(s, 0x2410012, s->config.w92 / 4000);
1182 if (rc < 0)
1183 goto error;
1184#ifdef ORIG_FW
1185 rc = WR16(s, 0x2410015, 2);
1186 if (rc < 0)
1187 goto error;
1188#endif
1189 rc = WR16(s, 0x2410017, 0x3973);
1190 if (rc < 0)
1191 goto error;
1192
1193 s->f_osc = s->config.f_osc * 1000; /* initial estimator */
1194
1195 s->config.w56 = 1;
1196
1197 rc = HI_CfgCommand(s);
1198 if (rc < 0)
1199 goto error;
1200
1201 rc = write_fw(s, DRXD_InitAtomicRead);
1202 if (rc < 0)
1203 goto error;
1204
1205 if (s->chip_rev == DRXD_FW_A2) {
1206 rc = WR16(s, 0x2150013, 0);
1207 if (rc < 0)
1208 goto error;
1209 }
1210
1211 rc = WR16_E0(s, 0x0400002, 0);
1212 if (rc < 0)
1213 goto error;
1214 rc = WR16(s, 0x0400002, 0);
1215 if (rc < 0)
1216 goto error;
1217
1218 if (s->chip_rev == DRXD_FW_A2) {
1219 rc = write_fw(s, DRXD_ResetCEFR);
1220 if (rc < 0)
1221 goto error;
1222 }
1223 rc = write_fw(s, DRXD_microcode);
1224 if (rc < 0)
1225 goto error;
1226
1227 s->config.w9C = 0x0e;
1228 if (s->flags & F_SET_0D0h) {
1229 s->config.w9C = 0;
1230 rc = RD16(s, 0x0c20010);
1231 if (rc < 0)
1232 goto write_DRXD_InitFE_1;
1233
1234 rc &= ~0x1000;
1235 rc = WR16(s, 0x0c20010, rc);
1236 if (rc < 0)
1237 goto write_DRXD_InitFE_1;
1238
1239 rc = RD16(s, 0x0c20011);
1240 if (rc < 0)
1241 goto write_DRXD_InitFE_1;
1242
1243 rc &= ~0x8;
1244 rc = WR16(s, 0x0c20011, rc);
1245 if (rc < 0)
1246 goto write_DRXD_InitFE_1;
1247
1248 rc = WR16(s, 0x0c20012, 1);
1249 }
1250
1251 write_DRXD_InitFE_1:
1252
1253 rc = write_fw(s, DRXD_InitFE_1);
1254 if (rc < 0)
1255 goto error;
1256
1257 rc = 1;
1258 if (s->chip_rev == DRXD_FW_B1) {
1259 if (s->flags & F_SET_0D0h)
1260 rc = 0;
1261 } else {
1262 if (s->flags & F_SET_0D0h)
1263 rc = 4;
1264 }
1265
1266 rc = WR16(s, 0x0C20012, rc);
1267 if (rc < 0)
1268 goto error;
1269
1270 rc = WR16(s, 0x0C20013, s->config.w9E);
1271 if (rc < 0)
1272 goto error;
1273 rc = WR16(s, 0x0C20015, s->config.w9C);
1274 if (rc < 0)
1275 goto error;
1276
1277 rc = write_fw(s, DRXD_InitFE_2);
1278 if (rc < 0)
1279 goto error;
1280 rc = write_fw(s, DRXD_InitFT);
1281 if (rc < 0)
1282 goto error;
1283 rc = write_fw(s, DRXD_InitCP);
1284 if (rc < 0)
1285 goto error;
1286 rc = write_fw(s, DRXD_InitCE);
1287 if (rc < 0)
1288 goto error;
1289 rc = write_fw(s, DRXD_InitEQ);
1290 if (rc < 0)
1291 goto error;
1292 rc = write_fw(s, DRXD_InitEC);
1293 if (rc < 0)
1294 goto error;
1295 rc = write_fw(s, DRXD_InitSC);
1296 if (rc < 0)
1297 goto error;
1298
1299 rc = SetCfgIfAgc(s, &s->config.ifagc);
1300 if (rc < 0)
1301 goto error;
1302
1303 rc = SetCfgRfAgc(s, &s->config.rfagc);
1304 if (rc < 0)
1305 goto error;
1306
1307 rc = ConfigureMPEGOutput(s, 1);
1308 rc = WR16(s, 0x08201fe, 0x0017);
1309 rc = WR16(s, 0x08201ff, 0x0101);
1310
1311 s->config.d5C = 0;
1312 s->config.d60 = 1;
1313 s->config.d48 = 1;
1314 error:
1315 return rc;
1316}
1317
1318static int drx397x_get_frontend(struct dvb_frontend *fe,
1319 struct dvb_frontend_parameters *params)
1320{
1321 return 0;
1322}
1323
1324static int drx397x_set_frontend(struct dvb_frontend *fe,
1325 struct dvb_frontend_parameters *params)
1326{
1327 struct drx397xD_state *s = fe->demodulator_priv;
1328
1329 s->config.s20d24 = 1; // 0;
1330 return drx_tune(s, params);
1331}
1332
1333static int drx397x_get_tune_settings(struct dvb_frontend *fe,
1334 struct dvb_frontend_tune_settings
1335 *fe_tune_settings)
1336{
1337 fe_tune_settings->min_delay_ms = 10000;
1338 fe_tune_settings->step_size = 0;
1339 fe_tune_settings->max_drift = 0;
1340 return 0;
1341}
1342
1343static int drx397x_read_status(struct dvb_frontend *fe, fe_status_t * status)
1344{
1345 struct drx397xD_state *s = fe->demodulator_priv;
1346 int lockstat;
1347
1348 GetLockStatus(s, &lockstat);
1349 /* TODO */
1350// if (lockstat & 1)
1351// CorrectSysClockDeviation(s);
1352
1353 *status = 0;
1354 if (lockstat & 2) {
1355 CorrectSysClockDeviation(s);
1356 ConfigureMPEGOutput(s, 1);
1357 *status = FE_HAS_LOCK | FE_HAS_SYNC | FE_HAS_VITERBI;
1358 }
1359 if (lockstat & 4) {
1360 *status |= FE_HAS_CARRIER | FE_HAS_SIGNAL;
1361 }
1362
1363 return 0;
1364}
1365
1366static int drx397x_read_ber(struct dvb_frontend *fe, unsigned int *ber)
1367{
1368 *ber = 0;
1369 return 0;
1370}
1371
1372static int drx397x_read_snr(struct dvb_frontend *fe, u16 * snr)
1373{
1374 *snr = 0;
1375 return 0;
1376}
1377
1378static int drx397x_read_signal_strength(struct dvb_frontend *fe, u16 * strength)
1379{
1380 struct drx397xD_state *s = fe->demodulator_priv;
1381 int rc;
1382
1383 if (s->config.ifagc.d00 == 2) {
1384 *strength = 0xffff;
1385 return 0;
1386 }
1387 rc = RD16(s, 0x0c20035);
1388 if (rc < 0) {
1389 *strength = 0;
1390 return 0;
1391 }
1392 rc &= 0x3ff;
1393 /* Signal strength is calculated using the following formula:
1394 *
1395 * a = 2200 * 150 / (2200 + 150);
1396 * a = a * 3300 / (a + 820);
1397 * b = 2200 * 3300 / (2200 + 820);
1398 * c = (((b-a) * rc) >> 10 + a) << 4;
1399 * strength = ~c & 0xffff;
1400 *
1401 * The following does the same but with less rounding errors:
1402 */
1403 *strength = ~(7720 + (rc * 30744 >> 10));
1404 return 0;
1405}
1406
1407static int drx397x_read_ucblocks(struct dvb_frontend *fe,
1408 unsigned int *ucblocks)
1409{
1410 *ucblocks = 0;
1411 return 0;
1412}
1413
1414static int drx397x_sleep(struct dvb_frontend *fe)
1415{
1416 return 0;
1417}
1418
1419static void drx397x_release(struct dvb_frontend *fe)
1420{
1421 struct drx397xD_state *s = fe->demodulator_priv;
1422 printk(KERN_INFO "%s: release demodulator\n", mod_name);
1423 if (s) {
1424 drx_release_fw(s);
1425 kfree(s);
1426 }
1427
1428}
1429
1430static struct dvb_frontend_ops drx397x_ops = {
1431
1432 .info = {
1433 .name = "Micronas DRX397xD DVB-T Frontend",
1434 .type = FE_OFDM,
1435 .frequency_min = 47125000,
1436 .frequency_max = 855250000,
1437 .frequency_stepsize = 166667,
1438 .frequency_tolerance = 0,
1439 .caps = /* 0x0C01B2EAE */
1440 FE_CAN_FEC_1_2 | // = 0x2,
1441 FE_CAN_FEC_2_3 | // = 0x4,
1442 FE_CAN_FEC_3_4 | // = 0x8,
1443 FE_CAN_FEC_5_6 | // = 0x20,
1444 FE_CAN_FEC_7_8 | // = 0x80,
1445 FE_CAN_FEC_AUTO | // = 0x200,
1446 FE_CAN_QPSK | // = 0x400,
1447 FE_CAN_QAM_16 | // = 0x800,
1448 FE_CAN_QAM_64 | // = 0x2000,
1449 FE_CAN_QAM_AUTO | // = 0x10000,
1450 FE_CAN_TRANSMISSION_MODE_AUTO | // = 0x20000,
1451 FE_CAN_GUARD_INTERVAL_AUTO | // = 0x80000,
1452 FE_CAN_HIERARCHY_AUTO | // = 0x100000,
1453 FE_CAN_RECOVER | // = 0x40000000,
1454 FE_CAN_MUTE_TS // = 0x80000000
1455 },
1456
1457 .release = drx397x_release,
1458 .init = drx397x_init,
1459 .sleep = drx397x_sleep,
1460
1461 .set_frontend = drx397x_set_frontend,
1462 .get_tune_settings = drx397x_get_tune_settings,
1463 .get_frontend = drx397x_get_frontend,
1464
1465 .read_status = drx397x_read_status,
1466 .read_snr = drx397x_read_snr,
1467 .read_signal_strength = drx397x_read_signal_strength,
1468 .read_ber = drx397x_read_ber,
1469 .read_ucblocks = drx397x_read_ucblocks,
1470};
1471
1472struct dvb_frontend *drx397xD_attach(const struct drx397xD_config *config,
1473 struct i2c_adapter *i2c)
1474{
1475 struct drx397xD_state *s = NULL;
1476
1477 /* allocate memory for the internal state */
1478 s = kzalloc(sizeof(struct drx397xD_state), GFP_KERNEL);
1479 if (s == NULL)
1480 goto error;
1481
1482 /* setup the state */
1483 s->i2c = i2c;
1484 memcpy(&s->config, config, sizeof(struct drx397xD_config));
1485
1486 /* check if the demod is there */
1487 if (RD16(s, 0x2410019) < 0)
1488 goto error;
1489
1490 /* create dvb_frontend */
1491 memcpy(&s->frontend.ops, &drx397x_ops, sizeof(struct dvb_frontend_ops));
1492 s->frontend.demodulator_priv = s;
1493
1494 return &s->frontend;
1495 error:
1496 kfree(s);
1497 return NULL;
1498}
1499
1500MODULE_DESCRIPTION("Micronas DRX397xD DVB-T Frontend");
1501MODULE_AUTHOR("Henk Vergonet");
1502MODULE_LICENSE("GPL");
1503
1504EXPORT_SYMBOL(drx397xD_attach);
diff --git a/drivers/media/dvb/frontends/drx397xD.h b/drivers/media/dvb/frontends/drx397xD.h
new file mode 100644
index 000000000000..ddc7a07971b7
--- /dev/null
+++ b/drivers/media/dvb/frontends/drx397xD.h
@@ -0,0 +1,130 @@
1/*
2 * Driver for Micronas DVB-T drx397xD demodulator
3 *
4 * Copyright (C) 2007 Henk vergonet <Henk.Vergonet@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 *
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.=
20 */
21
22#ifndef _DRX397XD_H_INCLUDED
23#define _DRX397XD_H_INCLUDED
24
25#include <linux/dvb/frontend.h>
26
27#define DRX_F_STEPSIZE 166667
28#define DRX_F_OFFSET 36000000
29
30#define I2C_ADR_C0(x) \
31( (u32)cpu_to_le32( \
32 (u32)( \
33 (((u32)(x) & (u32)0x000000ffUL) ) | \
34 (((u32)(x) & (u32)0x0000ff00UL) << 16) | \
35 (((u32)(x) & (u32)0x0fff0000UL) >> 8) | \
36 ( (u32)0x00c00000UL) \
37 )) \
38)
39
40#define I2C_ADR_E0(x) \
41( (u32)cpu_to_le32( \
42 (u32)( \
43 (((u32)(x) & (u32)0x000000ffUL) ) | \
44 (((u32)(x) & (u32)0x0000ff00UL) << 16) | \
45 (((u32)(x) & (u32)0x0fff0000UL) >> 8) | \
46 ( (u32)0x00e00000UL) \
47 )) \
48)
49
50struct drx397xD_CfgRfAgc /* 0x7c */
51{
52 int d00; /* 2 */
53 u16 w04;
54 u16 w06;
55};
56
57struct drx397xD_CfgIfAgc /* 0x68 */
58{
59 int d00; /* 0 */
60 u16 w04; /* 0 */
61 u16 w06;
62 u16 w08;
63 u16 w0A;
64 u16 w0C;
65};
66
67struct drx397xD_s20 {
68 int d04;
69 u32 d18;
70 u32 d1C;
71 u32 d20;
72 u32 d14;
73 u32 d24;
74 u32 d0C;
75 u32 d08;
76};
77
78struct drx397xD_config
79{
80 /* demodulator's I2C address */
81 u8 demod_address; /* 0x0f */
82
83 struct drx397xD_CfgIfAgc ifagc; /* 0x68 */
84 struct drx397xD_CfgRfAgc rfagc; /* 0x7c */
85 u32 s20d24;
86
87 /* HI_CfgCommand parameters */
88 u16 w50, w52, /* w54, */ w56;
89
90 int d5C;
91 int d60;
92 int d48;
93 int d28;
94
95 u32 f_if; /* d14: intermediate frequency [Hz] */
96 /* 36000000 on Cinergy 2400i DT */
97 /* 42800000 on Pinnacle Hybrid PRO 330e */
98
99 u16 f_osc; /* s66: 48000 oscillator frequency [kHz] */
100
101 u16 w92; /* 20000 */
102
103 u16 wA0;
104 u16 w98;
105 u16 w9A;
106
107 u16 w9C; /* 0xe0 */
108 u16 w9E; /* 0x00 */
109
110 /* used for signal strength calculations in
111 drx397x_read_signal_strength
112 */
113 u16 ss78; // 2200
114 u16 ss7A; // 150
115 u16 ss76; // 820
116};
117
118#if defined(CONFIG_DVB_DRX397XD) || (defined(CONFIG_DVB_DRX397XD_MODULE) && defined(MODULE))
119extern struct dvb_frontend* drx397xD_attach(const struct drx397xD_config *config,
120 struct i2c_adapter *i2c);
121#else
122static inline struct dvb_frontend* drx397xD_attach(const struct drx397xD_config *config,
123 struct i2c_adapter *i2c)
124{
125 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
126 return NULL;
127}
128#endif /* CONFIG_DVB_DRX397XD */
129
130#endif /* _DRX397XD_H_INCLUDED */
diff --git a/drivers/media/dvb/frontends/drx397xD_fw.h b/drivers/media/dvb/frontends/drx397xD_fw.h
new file mode 100644
index 000000000000..01de02a81cd4
--- /dev/null
+++ b/drivers/media/dvb/frontends/drx397xD_fw.h
@@ -0,0 +1,40 @@
1/*
2 * Firmware definitions for Micronas drx397xD
3 *
4 * Copyright (C) 2007 Henk Vergonet <Henk.Vergonet@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifdef _FW_ENTRY
21 _FW_ENTRY("drx397xD.A2.fw", DRXD_FW_A2 = 0 ),
22 _FW_ENTRY("drx397xD.B1.fw", DRXD_FW_B1 ),
23#undef _FW_ENTRY
24#endif /* _FW_ENTRY */
25
26#ifdef _BLOB_ENTRY
27 _BLOB_ENTRY("InitAtomicRead", DRXD_InitAtomicRead = 0 ),
28 _BLOB_ENTRY("InitCE", DRXD_InitCE ),
29 _BLOB_ENTRY("InitCP", DRXD_InitCP ),
30 _BLOB_ENTRY("InitEC", DRXD_InitEC ),
31 _BLOB_ENTRY("InitEQ", DRXD_InitEQ ),
32 _BLOB_ENTRY("InitFE_1", DRXD_InitFE_1 ),
33 _BLOB_ENTRY("InitFE_2", DRXD_InitFE_2 ),
34 _BLOB_ENTRY("InitFT", DRXD_InitFT ),
35 _BLOB_ENTRY("InitSC", DRXD_InitSC ),
36 _BLOB_ENTRY("ResetCEFR", DRXD_ResetCEFR ),
37 _BLOB_ENTRY("ResetECRAM", DRXD_ResetECRAM ),
38 _BLOB_ENTRY("microcode", DRXD_microcode ),
39#undef _BLOB_ENTRY
40#endif /* _BLOB_ENTRY */
diff --git a/drivers/media/dvb/frontends/z0194a.h b/drivers/media/dvb/frontends/z0194a.h
new file mode 100644
index 000000000000..d2876d2e1769
--- /dev/null
+++ b/drivers/media/dvb/frontends/z0194a.h
@@ -0,0 +1,97 @@
1/* z0194a.h Sharp z0194a tuner support
2*
3* Copyright (C) 2008 Igor M. Liplianin (liplianin@me.by)
4*
5* This program is free software; you can redistribute it and/or modify it
6* under the terms of the GNU General Public License as published by the
7* Free Software Foundation, version 2.
8*
9* see Documentation/dvb/README.dvb-usb for more information
10*/
11
12#ifndef Z0194A
13#define Z0194A
14
15static int sharp_z0194a__set_symbol_rate(struct dvb_frontend *fe,
16 u32 srate, u32 ratio)
17{
18 u8 aclk = 0;
19 u8 bclk = 0;
20
21 if (srate < 1500000) {
22 aclk = 0xb7; bclk = 0x47; }
23 else if (srate < 3000000) {
24 aclk = 0xb7; bclk = 0x4b; }
25 else if (srate < 7000000) {
26 aclk = 0xb7; bclk = 0x4f; }
27 else if (srate < 14000000) {
28 aclk = 0xb7; bclk = 0x53; }
29 else if (srate < 30000000) {
30 aclk = 0xb6; bclk = 0x53; }
31 else if (srate < 45000000) {
32 aclk = 0xb4; bclk = 0x51; }
33
34 stv0299_writereg(fe, 0x13, aclk);
35 stv0299_writereg(fe, 0x14, bclk);
36 stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff);
37 stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff);
38 stv0299_writereg(fe, 0x21, (ratio) & 0xf0);
39
40 return 0;
41}
42
43static u8 sharp_z0194a__inittab[] = {
44 0x01, 0x15,
45 0x02, 0x00,
46 0x03, 0x00,
47 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
48 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */
49 0x06, 0x40, /* DAC not used, set to high impendance mode */
50 0x07, 0x00, /* DAC LSB */
51 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */
52 0x09, 0x00, /* FIFO */
53 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
54 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */
55 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */
56 0x10, 0x3f, /* AGC2 0x3d */
57 0x11, 0x84,
58 0x12, 0xb9,
59 0x15, 0xc9, /* lock detector threshold */
60 0x16, 0x00,
61 0x17, 0x00,
62 0x18, 0x00,
63 0x19, 0x00,
64 0x1a, 0x00,
65 0x1f, 0x50,
66 0x20, 0x00,
67 0x21, 0x00,
68 0x22, 0x00,
69 0x23, 0x00,
70 0x28, 0x00, /* out imp: normal out type: parallel FEC mode:0 */
71 0x29, 0x1e, /* 1/2 threshold */
72 0x2a, 0x14, /* 2/3 threshold */
73 0x2b, 0x0f, /* 3/4 threshold */
74 0x2c, 0x09, /* 5/6 threshold */
75 0x2d, 0x05, /* 7/8 threshold */
76 0x2e, 0x01,
77 0x31, 0x1f, /* test all FECs */
78 0x32, 0x19, /* viterbi and synchro search */
79 0x33, 0xfc, /* rs control */
80 0x34, 0x93, /* error control */
81 0x0f, 0x52,
82 0xff, 0xff
83};
84
85static struct stv0299_config sharp_z0194a_config = {
86 .demod_address = 0x68,
87 .inittab = sharp_z0194a__inittab,
88 .mclk = 88000000UL,
89 .invert = 1,
90 .skip_reinit = 0,
91 .lock_output = STV0299_LOCKOUTPUT_1,
92 .volt13_op0_op1 = STV0299_VOLT13_OP1,
93 .min_delay_ms = 100,
94 .set_symbol_rate = sharp_z0194a__set_symbol_rate,
95};
96
97#endif
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c
index b4b8ed795c95..c5f45fed69dc 100644
--- a/drivers/media/dvb/siano/smscoreapi.c
+++ b/drivers/media/dvb/siano/smscoreapi.c
@@ -110,12 +110,12 @@ struct smscore_registry_entry_t {
110 enum sms_device_type_st type; 110 enum sms_device_type_st type;
111}; 111};
112 112
113struct list_head g_smscore_notifyees; 113static struct list_head g_smscore_notifyees;
114struct list_head g_smscore_devices; 114static struct list_head g_smscore_devices;
115struct mutex g_smscore_deviceslock; 115static struct mutex g_smscore_deviceslock;
116 116
117struct list_head g_smscore_registry; 117static struct list_head g_smscore_registry;
118struct mutex g_smscore_registrylock; 118static struct mutex g_smscore_registrylock;
119 119
120static int default_mode = 4; 120static int default_mode = 4;
121 121
@@ -1187,7 +1187,7 @@ int smsclient_sendrequest(struct smscore_client_t *client,
1187} 1187}
1188 1188
1189 1189
1190int smscore_module_init(void) 1190static int __init smscore_module_init(void)
1191{ 1191{
1192 int rc = 0; 1192 int rc = 0;
1193 1193
@@ -1209,7 +1209,7 @@ int smscore_module_init(void)
1209 return rc; 1209 return rc;
1210} 1210}
1211 1211
1212void smscore_module_exit(void) 1212static void __exit smscore_module_exit(void)
1213{ 1213{
1214 1214
1215 kmutex_lock(&g_smscore_deviceslock); 1215 kmutex_lock(&g_smscore_deviceslock);
diff --git a/drivers/media/dvb/siano/smsdvb.c b/drivers/media/dvb/siano/smsdvb.c
index 6f9c18563867..229274a14110 100644
--- a/drivers/media/dvb/siano/smsdvb.c
+++ b/drivers/media/dvb/siano/smsdvb.c
@@ -27,8 +27,8 @@
27 27
28DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 28DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
29 29
30struct list_head g_smsdvb_clients; 30static struct list_head g_smsdvb_clients;
31struct mutex g_smsdvb_clientslock; 31static struct mutex g_smsdvb_clientslock;
32 32
33static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb) 33static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
34{ 34{
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig
index 87c973ac668b..41b5a988b619 100644
--- a/drivers/media/dvb/ttpci/Kconfig
+++ b/drivers/media/dvb/ttpci/Kconfig
@@ -5,8 +5,6 @@ config TTPCI_EEPROM
5config DVB_AV7110 5config DVB_AV7110
6 tristate "AV7110 cards" 6 tristate "AV7110 cards"
7 depends on DVB_CORE && PCI && I2C 7 depends on DVB_CORE && PCI && I2C
8 depends on HOTPLUG
9 select FW_LOADER if !DVB_AV7110_FIRMWARE
10 select TTPCI_EEPROM 8 select TTPCI_EEPROM
11 select VIDEO_SAA7146_VV 9 select VIDEO_SAA7146_VV
12 depends on VIDEO_DEV # dependencies of VIDEO_SAA7146_VV 10 depends on VIDEO_DEV # dependencies of VIDEO_SAA7146_VV
@@ -127,14 +125,12 @@ config DVB_BUDGET_AV
127 depends on DVB_BUDGET_CORE && I2C 125 depends on DVB_BUDGET_CORE && I2C
128 select VIDEO_SAA7146_VV 126 select VIDEO_SAA7146_VV
129 depends on VIDEO_DEV # dependencies of VIDEO_SAA7146_VV 127 depends on VIDEO_DEV # dependencies of VIDEO_SAA7146_VV
130 depends on HOTPLUG # dependency of FW_LOADER
131 select DVB_PLL if !DVB_FE_CUSTOMISE 128 select DVB_PLL if !DVB_FE_CUSTOMISE
132 select DVB_STV0299 if !DVB_FE_CUSTOMISE 129 select DVB_STV0299 if !DVB_FE_CUSTOMISE
133 select DVB_TDA1004X if !DVB_FE_CUSTOMISE 130 select DVB_TDA1004X if !DVB_FE_CUSTOMISE
134 select DVB_TDA10021 if !DVB_FE_CUSTOMISE 131 select DVB_TDA10021 if !DVB_FE_CUSTOMISE
135 select DVB_TDA10023 if !DVB_FE_CUSTOMISE 132 select DVB_TDA10023 if !DVB_FE_CUSTOMISE
136 select DVB_TUA6100 if !DVB_FE_CUSTOMISE 133 select DVB_TUA6100 if !DVB_FE_CUSTOMISE
137 select FW_LOADER
138 help 134 help
139 Support for simple SAA7146 based DVB cards 135 Support for simple SAA7146 based DVB cards
140 (so called Budget- or Nova-PCI cards) without onboard 136 (so called Budget- or Nova-PCI cards) without onboard
diff --git a/drivers/media/dvb/ttusb-dec/Kconfig b/drivers/media/dvb/ttusb-dec/Kconfig
index a23cc0aa17d3..d5f48a3102bd 100644
--- a/drivers/media/dvb/ttusb-dec/Kconfig
+++ b/drivers/media/dvb/ttusb-dec/Kconfig
@@ -1,8 +1,6 @@
1config DVB_TTUSB_DEC 1config DVB_TTUSB_DEC
2 tristate "Technotrend/Hauppauge USB DEC devices" 2 tristate "Technotrend/Hauppauge USB DEC devices"
3 depends on DVB_CORE && USB && INPUT 3 depends on DVB_CORE && USB && INPUT
4 depends on HOTPLUG # due to FW_LOADER
5 select FW_LOADER
6 select CRC32 4 select CRC32
7 help 5 help
8 Support for external USB adapters designed by Technotrend and 6 Support for external USB adapters designed by Technotrend and
diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c
index 4e3f83e4e48f..1ed88f3abe61 100644
--- a/drivers/media/radio/dsbr100.c
+++ b/drivers/media/radio/dsbr100.c
@@ -85,6 +85,7 @@
85#include <linux/input.h> 85#include <linux/input.h>
86#include <linux/videodev2.h> 86#include <linux/videodev2.h>
87#include <media/v4l2-common.h> 87#include <media/v4l2-common.h>
88#include <media/v4l2-ioctl.h>
88#include <linux/usb.h> 89#include <linux/usb.h>
89 90
90/* 91/*
@@ -444,14 +445,7 @@ static const struct file_operations usb_dsbr100_fops = {
444 .llseek = no_llseek, 445 .llseek = no_llseek,
445}; 446};
446 447
447/* V4L2 interface */ 448static const struct v4l2_ioctl_ops usb_dsbr100_ioctl_ops = {
448static struct video_device dsbr100_videodev_template =
449{
450 .owner = THIS_MODULE,
451 .name = "D-Link DSB-R 100",
452 .type = VID_TYPE_TUNER,
453 .fops = &usb_dsbr100_fops,
454 .release = video_device_release,
455 .vidioc_querycap = vidioc_querycap, 449 .vidioc_querycap = vidioc_querycap,
456 .vidioc_g_tuner = vidioc_g_tuner, 450 .vidioc_g_tuner = vidioc_g_tuner,
457 .vidioc_s_tuner = vidioc_s_tuner, 451 .vidioc_s_tuner = vidioc_s_tuner,
@@ -466,6 +460,14 @@ static struct video_device dsbr100_videodev_template =
466 .vidioc_s_input = vidioc_s_input, 460 .vidioc_s_input = vidioc_s_input,
467}; 461};
468 462
463/* V4L2 interface */
464static struct video_device dsbr100_videodev_template = {
465 .name = "D-Link DSB-R 100",
466 .fops = &usb_dsbr100_fops,
467 .ioctl_ops = &usb_dsbr100_ioctl_ops,
468 .release = video_device_release,
469};
470
469/* check if the device is present and register with v4l and 471/* check if the device is present and register with v4l and
470usb if it is */ 472usb if it is */
471static int usb_dsbr100_probe(struct usb_interface *intf, 473static int usb_dsbr100_probe(struct usb_interface *intf,
diff --git a/drivers/media/radio/miropcm20-radio.c b/drivers/media/radio/miropcm20-radio.c
index 09fe6f1cdf14..7fd7ee2d32c1 100644
--- a/drivers/media/radio/miropcm20-radio.c
+++ b/drivers/media/radio/miropcm20-radio.c
@@ -23,6 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/videodev.h> 24#include <linux/videodev.h>
25#include <media/v4l2-common.h> 25#include <media/v4l2-common.h>
26#include <media/v4l2-ioctl.h>
26#include "oss/aci.h" 27#include "oss/aci.h"
27#include "miropcm20-rds-core.h" 28#include "miropcm20-rds-core.h"
28 29
@@ -228,9 +229,7 @@ static const struct file_operations pcm20_fops = {
228}; 229};
229 230
230static struct video_device pcm20_radio = { 231static struct video_device pcm20_radio = {
231 .owner = THIS_MODULE,
232 .name = "Miro PCM 20 radio", 232 .name = "Miro PCM 20 radio",
233 .type = VID_TYPE_TUNER,
234 .fops = &pcm20_fops, 233 .fops = &pcm20_fops,
235 .priv = &pcm20_unit 234 .priv = &pcm20_unit
236}; 235};
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c
index 1ec18ed1a733..eba9209b3024 100644
--- a/drivers/media/radio/radio-aimslab.c
+++ b/drivers/media/radio/radio-aimslab.c
@@ -36,6 +36,7 @@
36#include <asm/uaccess.h> /* copy to/from user */ 36#include <asm/uaccess.h> /* copy to/from user */
37#include <linux/videodev2.h> /* kernel radio structs */ 37#include <linux/videodev2.h> /* kernel radio structs */
38#include <media/v4l2-common.h> 38#include <media/v4l2-common.h>
39#include <media/v4l2-ioctl.h>
39 40
40#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 41#include <linux/version.h> /* for KERNEL_VERSION MACRO */
41#define RADIO_VERSION KERNEL_VERSION(0,0,2) 42#define RADIO_VERSION KERNEL_VERSION(0,0,2)
@@ -388,12 +389,7 @@ static const struct file_operations rtrack_fops = {
388 .llseek = no_llseek, 389 .llseek = no_llseek,
389}; 390};
390 391
391static struct video_device rtrack_radio= 392static const struct v4l2_ioctl_ops rtrack_ioctl_ops = {
392{
393 .owner = THIS_MODULE,
394 .name = "RadioTrack radio",
395 .type = VID_TYPE_TUNER,
396 .fops = &rtrack_fops,
397 .vidioc_querycap = vidioc_querycap, 393 .vidioc_querycap = vidioc_querycap,
398 .vidioc_g_tuner = vidioc_g_tuner, 394 .vidioc_g_tuner = vidioc_g_tuner,
399 .vidioc_s_tuner = vidioc_s_tuner, 395 .vidioc_s_tuner = vidioc_s_tuner,
@@ -408,6 +404,12 @@ static struct video_device rtrack_radio=
408 .vidioc_s_ctrl = vidioc_s_ctrl, 404 .vidioc_s_ctrl = vidioc_s_ctrl,
409}; 405};
410 406
407static struct video_device rtrack_radio = {
408 .name = "RadioTrack radio",
409 .fops = &rtrack_fops,
410 .ioctl_ops = &rtrack_ioctl_ops,
411};
412
411static int __init rtrack_init(void) 413static int __init rtrack_init(void)
412{ 414{
413 if(io==-1) 415 if(io==-1)
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c
index 46cdb549eac7..3fe5504428c5 100644
--- a/drivers/media/radio/radio-aztech.c
+++ b/drivers/media/radio/radio-aztech.c
@@ -33,6 +33,7 @@
33#include <asm/uaccess.h> /* copy to/from user */ 33#include <asm/uaccess.h> /* copy to/from user */
34#include <linux/videodev2.h> /* kernel radio structs */ 34#include <linux/videodev2.h> /* kernel radio structs */
35#include <media/v4l2-common.h> 35#include <media/v4l2-common.h>
36#include <media/v4l2-ioctl.h>
36 37
37#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 38#include <linux/version.h> /* for KERNEL_VERSION MACRO */
38#define RADIO_VERSION KERNEL_VERSION(0,0,2) 39#define RADIO_VERSION KERNEL_VERSION(0,0,2)
@@ -352,12 +353,7 @@ static const struct file_operations aztech_fops = {
352 .llseek = no_llseek, 353 .llseek = no_llseek,
353}; 354};
354 355
355static struct video_device aztech_radio= 356static const struct v4l2_ioctl_ops aztech_ioctl_ops = {
356{
357 .owner = THIS_MODULE,
358 .name = "Aztech radio",
359 .type = VID_TYPE_TUNER,
360 .fops = &aztech_fops,
361 .vidioc_querycap = vidioc_querycap, 357 .vidioc_querycap = vidioc_querycap,
362 .vidioc_g_tuner = vidioc_g_tuner, 358 .vidioc_g_tuner = vidioc_g_tuner,
363 .vidioc_s_tuner = vidioc_s_tuner, 359 .vidioc_s_tuner = vidioc_s_tuner,
@@ -372,6 +368,12 @@ static struct video_device aztech_radio=
372 .vidioc_s_ctrl = vidioc_s_ctrl, 368 .vidioc_s_ctrl = vidioc_s_ctrl,
373}; 369};
374 370
371static struct video_device aztech_radio = {
372 .name = "Aztech radio",
373 .fops = &aztech_fops,
374 .ioctl_ops = &aztech_ioctl_ops,
375};
376
375module_param_named(debug,aztech_radio.debug, int, 0644); 377module_param_named(debug,aztech_radio.debug, int, 0644);
376MODULE_PARM_DESC(debug,"activates debug info"); 378MODULE_PARM_DESC(debug,"activates debug info");
377 379
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
index b14db53ea456..6166e726ed72 100644
--- a/drivers/media/radio/radio-cadet.c
+++ b/drivers/media/radio/radio-cadet.c
@@ -39,6 +39,7 @@
39#include <asm/uaccess.h> /* copy to/from user */ 39#include <asm/uaccess.h> /* copy to/from user */
40#include <linux/videodev2.h> /* V4L2 API defs */ 40#include <linux/videodev2.h> /* V4L2 API defs */
41#include <media/v4l2-common.h> 41#include <media/v4l2-common.h>
42#include <media/v4l2-ioctl.h>
42#include <linux/param.h> 43#include <linux/param.h>
43#include <linux/pnp.h> 44#include <linux/pnp.h>
44 45
@@ -569,12 +570,7 @@ static const struct file_operations cadet_fops = {
569 .llseek = no_llseek, 570 .llseek = no_llseek,
570}; 571};
571 572
572static struct video_device cadet_radio= 573static const struct v4l2_ioctl_ops cadet_ioctl_ops = {
573{
574 .owner = THIS_MODULE,
575 .name = "Cadet radio",
576 .type = VID_TYPE_TUNER,
577 .fops = &cadet_fops,
578 .vidioc_querycap = vidioc_querycap, 574 .vidioc_querycap = vidioc_querycap,
579 .vidioc_g_tuner = vidioc_g_tuner, 575 .vidioc_g_tuner = vidioc_g_tuner,
580 .vidioc_s_tuner = vidioc_s_tuner, 576 .vidioc_s_tuner = vidioc_s_tuner,
@@ -589,6 +585,12 @@ static struct video_device cadet_radio=
589 .vidioc_s_input = vidioc_s_input, 585 .vidioc_s_input = vidioc_s_input,
590}; 586};
591 587
588static struct video_device cadet_radio = {
589 .name = "Cadet radio",
590 .fops = &cadet_fops,
591 .ioctl_ops = &cadet_ioctl_ops,
592};
593
592#ifdef CONFIG_PNP 594#ifdef CONFIG_PNP
593 595
594static struct pnp_device_id cadet_pnp_devices[] = { 596static struct pnp_device_id cadet_pnp_devices[] = {
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c
index de49be971480..36e754e3ffb2 100644
--- a/drivers/media/radio/radio-gemtek-pci.c
+++ b/drivers/media/radio/radio-gemtek-pci.c
@@ -46,6 +46,7 @@
46#include <linux/pci.h> 46#include <linux/pci.h>
47#include <linux/videodev2.h> 47#include <linux/videodev2.h>
48#include <media/v4l2-common.h> 48#include <media/v4l2-common.h>
49#include <media/v4l2-ioctl.h>
49#include <linux/errno.h> 50#include <linux/errno.h>
50 51
51#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 52#include <linux/version.h> /* for KERNEL_VERSION MACRO */
@@ -374,11 +375,7 @@ static const struct file_operations gemtek_pci_fops = {
374 .llseek = no_llseek, 375 .llseek = no_llseek,
375}; 376};
376 377
377static struct video_device vdev_template = { 378static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = {
378 .owner = THIS_MODULE,
379 .name = "Gemtek PCI Radio",
380 .type = VID_TYPE_TUNER,
381 .fops = &gemtek_pci_fops,
382 .vidioc_querycap = vidioc_querycap, 379 .vidioc_querycap = vidioc_querycap,
383 .vidioc_g_tuner = vidioc_g_tuner, 380 .vidioc_g_tuner = vidioc_g_tuner,
384 .vidioc_s_tuner = vidioc_s_tuner, 381 .vidioc_s_tuner = vidioc_s_tuner,
@@ -393,6 +390,12 @@ static struct video_device vdev_template = {
393 .vidioc_s_ctrl = vidioc_s_ctrl, 390 .vidioc_s_ctrl = vidioc_s_ctrl,
394}; 391};
395 392
393static struct video_device vdev_template = {
394 .name = "Gemtek PCI Radio",
395 .fops = &gemtek_pci_fops,
396 .ioctl_ops = &gemtek_pci_ioctl_ops,
397};
398
396static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci_device_id *pci_id ) 399static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci_device_id *pci_id )
397{ 400{
398 struct gemtek_pci_card *card; 401 struct gemtek_pci_card *card;
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c
index 81f6aeb1cd11..2b1a6221de6d 100644
--- a/drivers/media/radio/radio-gemtek.c
+++ b/drivers/media/radio/radio-gemtek.c
@@ -23,6 +23,7 @@
23#include <asm/io.h> /* outb, outb_p */ 23#include <asm/io.h> /* outb, outb_p */
24#include <asm/uaccess.h> /* copy to/from user */ 24#include <asm/uaccess.h> /* copy to/from user */
25#include <linux/videodev2.h> /* kernel radio structs */ 25#include <linux/videodev2.h> /* kernel radio structs */
26#include <media/v4l2-ioctl.h>
26#include <media/v4l2-common.h> 27#include <media/v4l2-common.h>
27#include <linux/spinlock.h> 28#include <linux/spinlock.h>
28 29
@@ -552,11 +553,7 @@ static int vidioc_s_audio(struct file *file, void *priv, struct v4l2_audio *a)
552 return 0; 553 return 0;
553} 554}
554 555
555static struct video_device gemtek_radio = { 556static const struct v4l2_ioctl_ops gemtek_ioctl_ops = {
556 .owner = THIS_MODULE,
557 .name = "GemTek Radio card",
558 .type = VID_TYPE_TUNER,
559 .fops = &gemtek_fops,
560 .vidioc_querycap = vidioc_querycap, 557 .vidioc_querycap = vidioc_querycap,
561 .vidioc_g_tuner = vidioc_g_tuner, 558 .vidioc_g_tuner = vidioc_g_tuner,
562 .vidioc_s_tuner = vidioc_s_tuner, 559 .vidioc_s_tuner = vidioc_s_tuner,
@@ -571,6 +568,12 @@ static struct video_device gemtek_radio = {
571 .vidioc_s_ctrl = vidioc_s_ctrl 568 .vidioc_s_ctrl = vidioc_s_ctrl
572}; 569};
573 570
571static struct video_device gemtek_radio = {
572 .name = "GemTek Radio card",
573 .fops = &gemtek_fops,
574 .ioctl_ops = &gemtek_ioctl_ops,
575};
576
574/* 577/*
575 * Initialization / cleanup related stuff. 578 * Initialization / cleanup related stuff.
576 */ 579 */
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c
index bddd3c409aa9..0ada1c697e8a 100644
--- a/drivers/media/radio/radio-maestro.c
+++ b/drivers/media/radio/radio-maestro.c
@@ -27,6 +27,7 @@
27#include <linux/pci.h> 27#include <linux/pci.h>
28#include <linux/videodev2.h> 28#include <linux/videodev2.h>
29#include <media/v4l2-common.h> 29#include <media/v4l2-common.h>
30#include <media/v4l2-ioctl.h>
30 31
31#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 32#include <linux/version.h> /* for KERNEL_VERSION MACRO */
32#define RADIO_VERSION KERNEL_VERSION(0,0,6) 33#define RADIO_VERSION KERNEL_VERSION(0,0,6)
@@ -354,10 +355,7 @@ static u16 __devinit radio_power_on(struct radio_device *dev)
354 return (ofreq == radio_bits_get(dev)); 355 return (ofreq == radio_bits_get(dev));
355} 356}
356 357
357static struct video_device maestro_radio = { 358static const struct v4l2_ioctl_ops maestro_ioctl_ops = {
358 .name = "Maestro radio",
359 .type = VID_TYPE_TUNER,
360 .fops = &maestro_fops,
361 .vidioc_querycap = vidioc_querycap, 359 .vidioc_querycap = vidioc_querycap,
362 .vidioc_g_tuner = vidioc_g_tuner, 360 .vidioc_g_tuner = vidioc_g_tuner,
363 .vidioc_s_tuner = vidioc_s_tuner, 361 .vidioc_s_tuner = vidioc_s_tuner,
@@ -372,6 +370,12 @@ static struct video_device maestro_radio = {
372 .vidioc_s_ctrl = vidioc_s_ctrl, 370 .vidioc_s_ctrl = vidioc_s_ctrl,
373}; 371};
374 372
373static struct video_device maestro_radio = {
374 .name = "Maestro radio",
375 .fops = &maestro_fops,
376 .ioctl_ops = &maestro_ioctl_ops,
377};
378
375static int __devinit maestro_probe(struct pci_dev *pdev, 379static int __devinit maestro_probe(struct pci_dev *pdev,
376 const struct pci_device_id *ent) 380 const struct pci_device_id *ent)
377{ 381{
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index 0133ecf3e040..43c75497dc49 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -44,6 +44,7 @@
44#include <linux/pci.h> 44#include <linux/pci.h>
45#include <linux/videodev2.h> 45#include <linux/videodev2.h>
46#include <media/v4l2-common.h> 46#include <media/v4l2-common.h>
47#include <media/v4l2-ioctl.h>
47 48
48#define DRIVER_VERSION "0.77" 49#define DRIVER_VERSION "0.77"
49 50
@@ -373,13 +374,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv,
373 return -EINVAL; 374 return -EINVAL;
374} 375}
375 376
376static struct video_device maxiradio_radio = 377static const struct v4l2_ioctl_ops maxiradio_ioctl_ops = {
377{
378 .owner = THIS_MODULE,
379 .name = "Maxi Radio FM2000 radio",
380 .type = VID_TYPE_TUNER,
381 .fops = &maxiradio_fops,
382
383 .vidioc_querycap = vidioc_querycap, 378 .vidioc_querycap = vidioc_querycap,
384 .vidioc_g_tuner = vidioc_g_tuner, 379 .vidioc_g_tuner = vidioc_g_tuner,
385 .vidioc_s_tuner = vidioc_s_tuner, 380 .vidioc_s_tuner = vidioc_s_tuner,
@@ -394,6 +389,12 @@ static struct video_device maxiradio_radio =
394 .vidioc_s_ctrl = vidioc_s_ctrl, 389 .vidioc_s_ctrl = vidioc_s_ctrl,
395}; 390};
396 391
392static struct video_device maxiradio_radio = {
393 .name = "Maxi Radio FM2000 radio",
394 .fops = &maxiradio_fops,
395 .ioctl_ops = &maxiradio_ioctl_ops,
396};
397
397static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 398static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
398{ 399{
399 if(!request_region(pci_resource_start(pdev, 0), 400 if(!request_region(pci_resource_start(pdev, 0),
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c
index 070802103dc3..e2dde0807268 100644
--- a/drivers/media/radio/radio-rtrack2.c
+++ b/drivers/media/radio/radio-rtrack2.c
@@ -17,6 +17,7 @@
17#include <asm/uaccess.h> /* copy to/from user */ 17#include <asm/uaccess.h> /* copy to/from user */
18#include <linux/videodev2.h> /* kernel radio structs */ 18#include <linux/videodev2.h> /* kernel radio structs */
19#include <media/v4l2-common.h> 19#include <media/v4l2-common.h>
20#include <media/v4l2-ioctl.h>
20#include <linux/spinlock.h> 21#include <linux/spinlock.h>
21 22
22#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 23#include <linux/version.h> /* for KERNEL_VERSION MACRO */
@@ -294,12 +295,7 @@ static const struct file_operations rtrack2_fops = {
294 .llseek = no_llseek, 295 .llseek = no_llseek,
295}; 296};
296 297
297static struct video_device rtrack2_radio= 298static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = {
298{
299 .owner = THIS_MODULE,
300 .name = "RadioTrack II radio",
301 .type = VID_TYPE_TUNER,
302 .fops = &rtrack2_fops,
303 .vidioc_querycap = vidioc_querycap, 299 .vidioc_querycap = vidioc_querycap,
304 .vidioc_g_tuner = vidioc_g_tuner, 300 .vidioc_g_tuner = vidioc_g_tuner,
305 .vidioc_s_tuner = vidioc_s_tuner, 301 .vidioc_s_tuner = vidioc_s_tuner,
@@ -314,6 +310,12 @@ static struct video_device rtrack2_radio=
314 .vidioc_s_input = vidioc_s_input, 310 .vidioc_s_input = vidioc_s_input,
315}; 311};
316 312
313static struct video_device rtrack2_radio = {
314 .name = "RadioTrack II radio",
315 .fops = &rtrack2_fops,
316 .ioctl_ops = &rtrack2_ioctl_ops,
317};
318
317static int __init rtrack2_init(void) 319static int __init rtrack2_init(void)
318{ 320{
319 if(io==-1) 321 if(io==-1)
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c
index 66e052fd3909..bb5d92f104af 100644
--- a/drivers/media/radio/radio-sf16fmi.c
+++ b/drivers/media/radio/radio-sf16fmi.c
@@ -24,6 +24,7 @@
24#include <linux/delay.h> /* udelay */ 24#include <linux/delay.h> /* udelay */
25#include <linux/videodev2.h> /* kernel radio structs */ 25#include <linux/videodev2.h> /* kernel radio structs */
26#include <media/v4l2-common.h> 26#include <media/v4l2-common.h>
27#include <media/v4l2-ioctl.h>
27#include <linux/isapnp.h> 28#include <linux/isapnp.h>
28#include <asm/io.h> /* outb, outb_p */ 29#include <asm/io.h> /* outb, outb_p */
29#include <asm/uaccess.h> /* copy to/from user */ 30#include <asm/uaccess.h> /* copy to/from user */
@@ -294,12 +295,7 @@ static const struct file_operations fmi_fops = {
294 .llseek = no_llseek, 295 .llseek = no_llseek,
295}; 296};
296 297
297static struct video_device fmi_radio= 298static const struct v4l2_ioctl_ops fmi_ioctl_ops = {
298{
299 .owner = THIS_MODULE,
300 .name = "SF16FMx radio",
301 .type = VID_TYPE_TUNER,
302 .fops = &fmi_fops,
303 .vidioc_querycap = vidioc_querycap, 299 .vidioc_querycap = vidioc_querycap,
304 .vidioc_g_tuner = vidioc_g_tuner, 300 .vidioc_g_tuner = vidioc_g_tuner,
305 .vidioc_s_tuner = vidioc_s_tuner, 301 .vidioc_s_tuner = vidioc_s_tuner,
@@ -314,6 +310,12 @@ static struct video_device fmi_radio=
314 .vidioc_s_ctrl = vidioc_s_ctrl, 310 .vidioc_s_ctrl = vidioc_s_ctrl,
315}; 311};
316 312
313static struct video_device fmi_radio = {
314 .name = "SF16FMx radio",
315 .fops = &fmi_fops,
316 .ioctl_ops = &fmi_ioctl_ops,
317};
318
317/* ladis: this is my card. does any other types exist? */ 319/* ladis: this is my card. does any other types exist? */
318static struct isapnp_device_id id_table[] __devinitdata = { 320static struct isapnp_device_id id_table[] __devinitdata = {
319 { ISAPNP_ANY_ID, ISAPNP_ANY_ID, 321 { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c
index b0ccf7cb5952..6290553d24be 100644
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -22,6 +22,7 @@
22#include <asm/uaccess.h> /* copy to/from user */ 22#include <asm/uaccess.h> /* copy to/from user */
23#include <linux/videodev2.h> /* kernel radio structs */ 23#include <linux/videodev2.h> /* kernel radio structs */
24#include <media/v4l2-common.h> 24#include <media/v4l2-common.h>
25#include <media/v4l2-ioctl.h>
25#include <linux/mutex.h> 26#include <linux/mutex.h>
26 27
27static struct mutex lock; 28static struct mutex lock;
@@ -410,12 +411,7 @@ static const struct file_operations fmr2_fops = {
410 .llseek = no_llseek, 411 .llseek = no_llseek,
411}; 412};
412 413
413static struct video_device fmr2_radio= 414static const struct v4l2_ioctl_ops fmr2_ioctl_ops = {
414{
415 .owner = THIS_MODULE,
416 .name = "SF16FMR2 radio",
417 . type = VID_TYPE_TUNER,
418 .fops = &fmr2_fops,
419 .vidioc_querycap = vidioc_querycap, 415 .vidioc_querycap = vidioc_querycap,
420 .vidioc_g_tuner = vidioc_g_tuner, 416 .vidioc_g_tuner = vidioc_g_tuner,
421 .vidioc_s_tuner = vidioc_s_tuner, 417 .vidioc_s_tuner = vidioc_s_tuner,
@@ -430,6 +426,12 @@ static struct video_device fmr2_radio=
430 .vidioc_s_ctrl = vidioc_s_ctrl, 426 .vidioc_s_ctrl = vidioc_s_ctrl,
431}; 427};
432 428
429static struct video_device fmr2_radio = {
430 .name = "SF16FMR2 radio",
431 .fops = &fmr2_fops,
432 .ioctl_ops = &fmr2_ioctl_ops,
433};
434
433static int __init fmr2_init(void) 435static int __init fmr2_init(void)
434{ 436{
435 fmr2_unit.port = io; 437 fmr2_unit.port = io;
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c
index dc93a882b385..a4984ff87c9c 100644
--- a/drivers/media/radio/radio-si470x.c
+++ b/drivers/media/radio/radio-si470x.c
@@ -133,6 +133,7 @@
133#include <linux/videodev2.h> 133#include <linux/videodev2.h>
134#include <linux/mutex.h> 134#include <linux/mutex.h>
135#include <media/v4l2-common.h> 135#include <media/v4l2-common.h>
136#include <media/v4l2-ioctl.h>
136#include <media/rds.h> 137#include <media/rds.h>
137#include <asm/unaligned.h> 138#include <asm/unaligned.h>
138 139
@@ -1585,15 +1586,7 @@ done:
1585 return retval; 1586 return retval;
1586} 1587}
1587 1588
1588 1589static const struct v4l2_ioctl_ops si470x_ioctl_ops = {
1589/*
1590 * si470x_viddev_tamples - video device interface
1591 */
1592static struct video_device si470x_viddev_template = {
1593 .fops = &si470x_fops,
1594 .name = DRIVER_NAME,
1595 .type = VID_TYPE_TUNER,
1596 .release = video_device_release,
1597 .vidioc_querycap = si470x_vidioc_querycap, 1590 .vidioc_querycap = si470x_vidioc_querycap,
1598 .vidioc_g_input = si470x_vidioc_g_input, 1591 .vidioc_g_input = si470x_vidioc_g_input,
1599 .vidioc_s_input = si470x_vidioc_s_input, 1592 .vidioc_s_input = si470x_vidioc_s_input,
@@ -1607,7 +1600,16 @@ static struct video_device si470x_viddev_template = {
1607 .vidioc_g_frequency = si470x_vidioc_g_frequency, 1600 .vidioc_g_frequency = si470x_vidioc_g_frequency,
1608 .vidioc_s_frequency = si470x_vidioc_s_frequency, 1601 .vidioc_s_frequency = si470x_vidioc_s_frequency,
1609 .vidioc_s_hw_freq_seek = si470x_vidioc_s_hw_freq_seek, 1602 .vidioc_s_hw_freq_seek = si470x_vidioc_s_hw_freq_seek,
1610 .owner = THIS_MODULE, 1603};
1604
1605/*
1606 * si470x_viddev_tamples - video device interface
1607 */
1608static struct video_device si470x_viddev_template = {
1609 .fops = &si470x_fops,
1610 .ioctl_ops = &si470x_ioctl_ops,
1611 .name = DRIVER_NAME,
1612 .release = video_device_release,
1611}; 1613};
1612 1614
1613 1615
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c
index acc32080e9bd..cefa44fc5aed 100644
--- a/drivers/media/radio/radio-terratec.c
+++ b/drivers/media/radio/radio-terratec.c
@@ -32,6 +32,7 @@
32#include <asm/uaccess.h> /* copy to/from user */ 32#include <asm/uaccess.h> /* copy to/from user */
33#include <linux/videodev2.h> /* kernel radio structs */ 33#include <linux/videodev2.h> /* kernel radio structs */
34#include <media/v4l2-common.h> 34#include <media/v4l2-common.h>
35#include <media/v4l2-ioctl.h>
35#include <linux/spinlock.h> 36#include <linux/spinlock.h>
36 37
37#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 38#include <linux/version.h> /* for KERNEL_VERSION MACRO */
@@ -366,12 +367,7 @@ static const struct file_operations terratec_fops = {
366 .llseek = no_llseek, 367 .llseek = no_llseek,
367}; 368};
368 369
369static struct video_device terratec_radio= 370static const struct v4l2_ioctl_ops terratec_ioctl_ops = {
370{
371 .owner = THIS_MODULE,
372 .name = "TerraTec ActiveRadio",
373 .type = VID_TYPE_TUNER,
374 .fops = &terratec_fops,
375 .vidioc_querycap = vidioc_querycap, 371 .vidioc_querycap = vidioc_querycap,
376 .vidioc_g_tuner = vidioc_g_tuner, 372 .vidioc_g_tuner = vidioc_g_tuner,
377 .vidioc_s_tuner = vidioc_s_tuner, 373 .vidioc_s_tuner = vidioc_s_tuner,
@@ -386,6 +382,12 @@ static struct video_device terratec_radio=
386 .vidioc_s_input = vidioc_s_input, 382 .vidioc_s_input = vidioc_s_input,
387}; 383};
388 384
385static struct video_device terratec_radio = {
386 .name = "TerraTec ActiveRadio",
387 .fops = &terratec_fops,
388 .ioctl_ops = &terratec_ioctl_ops,
389};
390
389static int __init terratec_init(void) 391static int __init terratec_init(void)
390{ 392{
391 if(io==-1) 393 if(io==-1)
diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c
index 4ebdfbadeb9c..d70172d23edb 100644
--- a/drivers/media/radio/radio-trust.c
+++ b/drivers/media/radio/radio-trust.c
@@ -23,6 +23,7 @@
23#include <asm/uaccess.h> 23#include <asm/uaccess.h>
24#include <linux/videodev2.h> 24#include <linux/videodev2.h>
25#include <media/v4l2-common.h> 25#include <media/v4l2-common.h>
26#include <media/v4l2-ioctl.h>
26 27
27#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 28#include <linux/version.h> /* for KERNEL_VERSION MACRO */
28#define RADIO_VERSION KERNEL_VERSION(0,0,2) 29#define RADIO_VERSION KERNEL_VERSION(0,0,2)
@@ -346,12 +347,7 @@ static const struct file_operations trust_fops = {
346 .llseek = no_llseek, 347 .llseek = no_llseek,
347}; 348};
348 349
349static struct video_device trust_radio= 350static const struct v4l2_ioctl_ops trust_ioctl_ops = {
350{
351 .owner = THIS_MODULE,
352 .name = "Trust FM Radio",
353 .type = VID_TYPE_TUNER,
354 .fops = &trust_fops,
355 .vidioc_querycap = vidioc_querycap, 351 .vidioc_querycap = vidioc_querycap,
356 .vidioc_g_tuner = vidioc_g_tuner, 352 .vidioc_g_tuner = vidioc_g_tuner,
357 .vidioc_s_tuner = vidioc_s_tuner, 353 .vidioc_s_tuner = vidioc_s_tuner,
@@ -366,6 +362,12 @@ static struct video_device trust_radio=
366 .vidioc_s_input = vidioc_s_input, 362 .vidioc_s_input = vidioc_s_input,
367}; 363};
368 364
365static struct video_device trust_radio = {
366 .name = "Trust FM Radio",
367 .fops = &trust_fops,
368 .ioctl_ops = &trust_ioctl_ops,
369};
370
369static int __init trust_init(void) 371static int __init trust_init(void)
370{ 372{
371 if(io == -1) { 373 if(io == -1) {
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c
index 18f2abd7e255..f8d62cfea774 100644
--- a/drivers/media/radio/radio-typhoon.c
+++ b/drivers/media/radio/radio-typhoon.c
@@ -40,6 +40,7 @@
40#include <asm/uaccess.h> /* copy to/from user */ 40#include <asm/uaccess.h> /* copy to/from user */
41#include <linux/videodev2.h> /* kernel radio structs */ 41#include <linux/videodev2.h> /* kernel radio structs */
42#include <media/v4l2-common.h> 42#include <media/v4l2-common.h>
43#include <media/v4l2-ioctl.h>
43 44
44#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 45#include <linux/version.h> /* for KERNEL_VERSION MACRO */
45#define RADIO_VERSION KERNEL_VERSION(0,1,1) 46#define RADIO_VERSION KERNEL_VERSION(0,1,1)
@@ -344,12 +345,7 @@ static const struct file_operations typhoon_fops = {
344 .llseek = no_llseek, 345 .llseek = no_llseek,
345}; 346};
346 347
347static struct video_device typhoon_radio = 348static const struct v4l2_ioctl_ops typhoon_ioctl_ops = {
348{
349 .owner = THIS_MODULE,
350 .name = "Typhoon Radio",
351 .type = VID_TYPE_TUNER,
352 .fops = &typhoon_fops,
353 .vidioc_querycap = vidioc_querycap, 349 .vidioc_querycap = vidioc_querycap,
354 .vidioc_g_tuner = vidioc_g_tuner, 350 .vidioc_g_tuner = vidioc_g_tuner,
355 .vidioc_s_tuner = vidioc_s_tuner, 351 .vidioc_s_tuner = vidioc_s_tuner,
@@ -364,6 +360,12 @@ static struct video_device typhoon_radio =
364 .vidioc_s_ctrl = vidioc_s_ctrl, 360 .vidioc_s_ctrl = vidioc_s_ctrl,
365}; 361};
366 362
363static struct video_device typhoon_radio = {
364 .name = "Typhoon Radio",
365 .fops = &typhoon_fops,
366 .ioctl_ops = &typhoon_ioctl_ops,
367};
368
367#ifdef CONFIG_RADIO_TYPHOON_PROC_FS 369#ifdef CONFIG_RADIO_TYPHOON_PROC_FS
368 370
369static int typhoon_proc_show(struct seq_file *m, void *v) 371static int typhoon_proc_show(struct seq_file *m, void *v)
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c
index 43773c56c62f..9f17a332fa11 100644
--- a/drivers/media/radio/radio-zoltrix.c
+++ b/drivers/media/radio/radio-zoltrix.c
@@ -37,6 +37,7 @@
37#include <asm/uaccess.h> /* copy to/from user */ 37#include <asm/uaccess.h> /* copy to/from user */
38#include <linux/videodev2.h> /* kernel radio structs */ 38#include <linux/videodev2.h> /* kernel radio structs */
39#include <media/v4l2-common.h> 39#include <media/v4l2-common.h>
40#include <media/v4l2-ioctl.h>
40 41
41#include <linux/version.h> /* for KERNEL_VERSION MACRO */ 42#include <linux/version.h> /* for KERNEL_VERSION MACRO */
42#define RADIO_VERSION KERNEL_VERSION(0,0,2) 43#define RADIO_VERSION KERNEL_VERSION(0,0,2)
@@ -407,12 +408,7 @@ static const struct file_operations zoltrix_fops =
407 .llseek = no_llseek, 408 .llseek = no_llseek,
408}; 409};
409 410
410static struct video_device zoltrix_radio = 411static const struct v4l2_ioctl_ops zoltrix_ioctl_ops = {
411{
412 .owner = THIS_MODULE,
413 .name = "Zoltrix Radio Plus",
414 .type = VID_TYPE_TUNER,
415 .fops = &zoltrix_fops,
416 .vidioc_querycap = vidioc_querycap, 412 .vidioc_querycap = vidioc_querycap,
417 .vidioc_g_tuner = vidioc_g_tuner, 413 .vidioc_g_tuner = vidioc_g_tuner,
418 .vidioc_s_tuner = vidioc_s_tuner, 414 .vidioc_s_tuner = vidioc_s_tuner,
@@ -427,6 +423,12 @@ static struct video_device zoltrix_radio =
427 .vidioc_s_ctrl = vidioc_s_ctrl, 423 .vidioc_s_ctrl = vidioc_s_ctrl,
428}; 424};
429 425
426static struct video_device zoltrix_radio = {
427 .name = "Zoltrix Radio Plus",
428 .fops = &zoltrix_fops,
429 .ioctl_ops = &zoltrix_ioctl_ops,
430};
431
430static int __init zoltrix_init(void) 432static int __init zoltrix_init(void)
431{ 433{
432 if (io == -1) { 434 if (io == -1) {
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index f606d2951fde..d4a6e56a7135 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -487,17 +487,6 @@ config VIDEO_PMS
487 To compile this driver as a module, choose M here: the 487 To compile this driver as a module, choose M here: the
488 module will be called pms. 488 module will be called pms.
489 489
490config VIDEO_PLANB
491 tristate "PlanB Video-In on PowerMac"
492 depends on PPC_PMAC && VIDEO_V4L1 && BROKEN
493 help
494 PlanB is the V4L driver for the PowerMac 7x00/8x00 series video
495 input hardware. If you want to experiment with this, say Y.
496 Otherwise, or if you don't understand a word, say N. See
497 <http://www.cpu.lu/~mlan/linux/dev/planb.html> for more info.
498
499 Saying M will compile this driver as a module (planb).
500
501config VIDEO_BWQCAM 490config VIDEO_BWQCAM
502 tristate "Quickcam BW Video For Linux" 491 tristate "Quickcam BW Video For Linux"
503 depends on PARPORT && VIDEO_V4L1 492 depends on PARPORT && VIDEO_V4L1
@@ -806,13 +795,7 @@ menuconfig V4L_USB_DRIVERS
806 795
807if V4L_USB_DRIVERS && USB 796if V4L_USB_DRIVERS && USB
808 797
809config USB_VIDEO_CLASS 798source "drivers/media/video/uvc/Kconfig"
810 tristate "USB Video Class (UVC)"
811 ---help---
812 Support for the USB Video Class (UVC). Currently only video
813 input devices, such as webcams, are supported.
814
815 For more information see: <http://linux-uvc.berlios.de/>
816 799
817source "drivers/media/video/gspca/Kconfig" 800source "drivers/media/video/gspca/Kconfig"
818 801
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 45d5db5abb1e..bbc6f8b82297 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -10,6 +10,8 @@ msp3400-objs := msp3400-driver.o msp3400-kthreads.o
10 10
11stkwebcam-objs := stk-webcam.o stk-sensor.o 11stkwebcam-objs := stk-webcam.o stk-sensor.o
12 12
13videodev-objs := v4l2-dev.o v4l2-ioctl.o
14
13obj-$(CONFIG_VIDEO_DEV) += videodev.o compat_ioctl32.o v4l2-int-device.o 15obj-$(CONFIG_VIDEO_DEV) += videodev.o compat_ioctl32.o v4l2-int-device.o
14 16
15obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o 17obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o
@@ -55,7 +57,6 @@ obj-$(CONFIG_VIDEO_ZORAN_DC30) += zr36050.o zr36016.o
55obj-$(CONFIG_VIDEO_ZORAN_ZR36060) += zr36060.o 57obj-$(CONFIG_VIDEO_ZORAN_ZR36060) += zr36060.o
56 58
57obj-$(CONFIG_VIDEO_PMS) += pms.o 59obj-$(CONFIG_VIDEO_PMS) += pms.o
58obj-$(CONFIG_VIDEO_PLANB) += planb.o
59obj-$(CONFIG_VIDEO_VINO) += vino.o indycam.o 60obj-$(CONFIG_VIDEO_VINO) += vino.o indycam.o
60obj-$(CONFIG_VIDEO_STRADIS) += stradis.o 61obj-$(CONFIG_VIDEO_STRADIS) += stradis.o
61obj-$(CONFIG_VIDEO_CPIA) += cpia.o 62obj-$(CONFIG_VIDEO_CPIA) += cpia.o
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c
index 8c7d1958856b..56ebfd5ef6fa 100644
--- a/drivers/media/video/arv.c
+++ b/drivers/media/video/arv.c
@@ -754,7 +754,6 @@ static const struct file_operations ar_fops = {
754}; 754};
755 755
756static struct video_device ar_template = { 756static struct video_device ar_template = {
757 .owner = THIS_MODULE,
758 .name = "Colour AR VGA", 757 .name = "Colour AR VGA",
759 .type = VID_TYPE_CAPTURE, 758 .type = VID_TYPE_CAPTURE,
760 .fops = &ar_fops, 759 .fops = &ar_fops,
diff --git a/drivers/media/video/au0828/Kconfig b/drivers/media/video/au0828/Kconfig
index 52b2491581a8..ed9a50f189fc 100644
--- a/drivers/media/video/au0828/Kconfig
+++ b/drivers/media/video/au0828/Kconfig
@@ -6,6 +6,7 @@ config VIDEO_AU0828
6 select VIDEO_TVEEPROM 6 select VIDEO_TVEEPROM
7 select DVB_AU8522 if !DVB_FE_CUSTOMIZE 7 select DVB_AU8522 if !DVB_FE_CUSTOMIZE
8 select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMIZE 8 select MEDIA_TUNER_XC5000 if !DVB_FE_CUSTOMIZE
9 select MEDIA_TUNER_MXL5007T if !DVB_FE_CUSTOMIZE
9 ---help--- 10 ---help---
10 This is a video4linux driver for Auvitek's USB device. 11 This is a video4linux driver for Auvitek's USB device.
11 12
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c
index 898e12395e7c..443e59009762 100644
--- a/drivers/media/video/au0828/au0828-cards.c
+++ b/drivers/media/video/au0828/au0828-cards.c
@@ -32,6 +32,9 @@ struct au0828_board au0828_boards[] = {
32 [AU0828_BOARD_HAUPPAUGE_HVR950Q] = { 32 [AU0828_BOARD_HAUPPAUGE_HVR950Q] = {
33 .name = "Hauppauge HVR950Q", 33 .name = "Hauppauge HVR950Q",
34 }, 34 },
35 [AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL] = {
36 .name = "Hauppauge HVR950Q rev xxF8",
37 },
35 [AU0828_BOARD_DVICO_FUSIONHDTV7] = { 38 [AU0828_BOARD_DVICO_FUSIONHDTV7] = {
36 .name = "DViCO FusionHDTV USB", 39 .name = "DViCO FusionHDTV USB",
37 }, 40 },
@@ -49,6 +52,7 @@ int au0828_tuner_callback(void *priv, int command, int arg)
49 switch (dev->board) { 52 switch (dev->board) {
50 case AU0828_BOARD_HAUPPAUGE_HVR850: 53 case AU0828_BOARD_HAUPPAUGE_HVR850:
51 case AU0828_BOARD_HAUPPAUGE_HVR950Q: 54 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
55 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
52 case AU0828_BOARD_DVICO_FUSIONHDTV7: 56 case AU0828_BOARD_DVICO_FUSIONHDTV7:
53 if (command == 0) { 57 if (command == 0) {
54 /* Tuner Reset Command from xc5000 */ 58 /* Tuner Reset Command from xc5000 */
@@ -110,6 +114,7 @@ void au0828_card_setup(struct au0828_dev *dev)
110 switch (dev->board) { 114 switch (dev->board) {
111 case AU0828_BOARD_HAUPPAUGE_HVR850: 115 case AU0828_BOARD_HAUPPAUGE_HVR850:
112 case AU0828_BOARD_HAUPPAUGE_HVR950Q: 116 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
117 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
113 if (dev->i2c_rc == 0) 118 if (dev->i2c_rc == 0)
114 hauppauge_eeprom(dev, eeprom+0xa0); 119 hauppauge_eeprom(dev, eeprom+0xa0);
115 break; 120 break;
@@ -128,6 +133,7 @@ void au0828_gpio_setup(struct au0828_dev *dev)
128 switch (dev->board) { 133 switch (dev->board) {
129 case AU0828_BOARD_HAUPPAUGE_HVR850: 134 case AU0828_BOARD_HAUPPAUGE_HVR850:
130 case AU0828_BOARD_HAUPPAUGE_HVR950Q: 135 case AU0828_BOARD_HAUPPAUGE_HVR950Q:
136 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
131 /* GPIO's 137 /* GPIO's
132 * 4 - CS5340 138 * 4 - CS5340
133 * 5 - AU8522 Demodulator 139 * 5 - AU8522 Demodulator
@@ -193,6 +199,12 @@ struct usb_device_id au0828_usb_id_table [] = {
193 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q }, 199 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
194 { USB_DEVICE(0x0fd9, 0x0008), 200 { USB_DEVICE(0x0fd9, 0x0008),
195 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q }, 201 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q },
202 { USB_DEVICE(0x2040, 0x7201),
203 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
204 { USB_DEVICE(0x2040, 0x7211),
205 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
206 { USB_DEVICE(0x2040, 0x7281),
207 .driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
196 { }, 208 { },
197}; 209};
198 210
diff --git a/drivers/media/video/au0828/au0828-cards.h b/drivers/media/video/au0828/au0828-cards.h
index e26f54a961d0..c37f5fd0fa80 100644
--- a/drivers/media/video/au0828/au0828-cards.h
+++ b/drivers/media/video/au0828/au0828-cards.h
@@ -23,3 +23,4 @@
23#define AU0828_BOARD_HAUPPAUGE_HVR950Q 1 23#define AU0828_BOARD_HAUPPAUGE_HVR950Q 1
24#define AU0828_BOARD_HAUPPAUGE_HVR850 2 24#define AU0828_BOARD_HAUPPAUGE_HVR850 2
25#define AU0828_BOARD_DVICO_FUSIONHDTV7 3 25#define AU0828_BOARD_DVICO_FUSIONHDTV7 3
26#define AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL 4
diff --git a/drivers/media/video/au0828/au0828-dvb.c b/drivers/media/video/au0828/au0828-dvb.c
index c6d470590380..584a83a94a2a 100644
--- a/drivers/media/video/au0828/au0828-dvb.c
+++ b/drivers/media/video/au0828/au0828-dvb.c
@@ -28,6 +28,7 @@
28#include "au0828.h" 28#include "au0828.h"
29#include "au8522.h" 29#include "au8522.h"
30#include "xc5000.h" 30#include "xc5000.h"
31#include "mxl5007t.h"
31 32
32DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 33DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
33 34
@@ -45,6 +46,11 @@ static struct xc5000_config hauppauge_hvr950q_tunerconfig = {
45 .tuner_callback = au0828_tuner_callback 46 .tuner_callback = au0828_tuner_callback
46}; 47};
47 48
49static struct mxl5007t_config mxl5007t_hvr950q_config = {
50 .xtal_freq_hz = MxL_XTAL_24_MHZ,
51 .if_freq_hz = MxL_IF_6_MHZ,
52};
53
48/*-------------------------------------------------------------------*/ 54/*-------------------------------------------------------------------*/
49static void urb_completion(struct urb *purb) 55static void urb_completion(struct urb *purb)
50{ 56{
@@ -342,6 +348,15 @@ int au0828_dvb_register(struct au0828_dev *dev)
342 &dev->i2c_adap, 348 &dev->i2c_adap,
343 &hauppauge_hvr950q_tunerconfig, dev); 349 &hauppauge_hvr950q_tunerconfig, dev);
344 break; 350 break;
351 case AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL:
352 dvb->frontend = dvb_attach(au8522_attach,
353 &hauppauge_hvr950q_config,
354 &dev->i2c_adap);
355 if (dvb->frontend != NULL)
356 dvb_attach(mxl5007t_attach, dvb->frontend,
357 &dev->i2c_adap, 0x60,
358 &mxl5007t_hvr950q_config);
359 break;
345 default: 360 default:
346 printk(KERN_WARNING "The frontend of your DVB/ATSC card " 361 printk(KERN_WARNING "The frontend of your DVB/ATSC card "
347 "isn't supported yet\n"); 362 "isn't supported yet\n");
diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig
index 24a34fc1f2b3..ce71e8e7b835 100644
--- a/drivers/media/video/bt8xx/Kconfig
+++ b/drivers/media/video/bt8xx/Kconfig
@@ -1,9 +1,7 @@
1config VIDEO_BT848 1config VIDEO_BT848
2 tristate "BT848 Video For Linux" 2 tristate "BT848 Video For Linux"
3 depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2 && INPUT 3 depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2 && INPUT
4 depends on HOTPLUG # due to FW_LOADER
5 select I2C_ALGOBIT 4 select I2C_ALGOBIT
6 select FW_LOADER
7 select VIDEO_BTCX 5 select VIDEO_BTCX
8 select VIDEOBUF_DMA_SG 6 select VIDEOBUF_DMA_SG
9 select VIDEO_IR 7 select VIDEO_IR
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 0ea559a7fe59..85bf31ab8789 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -45,6 +45,7 @@
45#include <linux/kdev_t.h> 45#include <linux/kdev_t.h>
46#include "bttvp.h" 46#include "bttvp.h"
47#include <media/v4l2-common.h> 47#include <media/v4l2-common.h>
48#include <media/v4l2-ioctl.h>
48#include <media/tvaudio.h> 49#include <media/tvaudio.h>
49#include <media/msp3400.h> 50#include <media/msp3400.h>
50 51
@@ -163,8 +164,8 @@ MODULE_LICENSE("GPL");
163static ssize_t show_card(struct device *cd, 164static ssize_t show_card(struct device *cd,
164 struct device_attribute *attr, char *buf) 165 struct device_attribute *attr, char *buf)
165{ 166{
166 struct video_device *vfd = container_of(cd, struct video_device, class_dev); 167 struct video_device *vfd = container_of(cd, struct video_device, dev);
167 struct bttv *btv = dev_get_drvdata(vfd->dev); 168 struct bttv *btv = dev_get_drvdata(vfd->parent);
168 return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET); 169 return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET);
169} 170}
170static DEVICE_ATTR(card, S_IRUGO, show_card, NULL); 171static DEVICE_ATTR(card, S_IRUGO, show_card, NULL);
@@ -3357,10 +3358,7 @@ static const struct file_operations bttv_fops =
3357 .poll = bttv_poll, 3358 .poll = bttv_poll,
3358}; 3359};
3359 3360
3360static struct video_device bttv_video_template = 3361static const struct v4l2_ioctl_ops bttv_ioctl_ops = {
3361{
3362 .fops = &bttv_fops,
3363 .minor = -1,
3364 .vidioc_querycap = bttv_querycap, 3362 .vidioc_querycap = bttv_querycap,
3365 .vidioc_enum_fmt_vid_cap = bttv_enum_fmt_vid_cap, 3363 .vidioc_enum_fmt_vid_cap = bttv_enum_fmt_vid_cap,
3366 .vidioc_g_fmt_vid_cap = bttv_g_fmt_vid_cap, 3364 .vidioc_g_fmt_vid_cap = bttv_g_fmt_vid_cap,
@@ -3411,8 +3409,14 @@ static struct video_device bttv_video_template =
3411 .vidioc_g_register = bttv_g_register, 3409 .vidioc_g_register = bttv_g_register,
3412 .vidioc_s_register = bttv_s_register, 3410 .vidioc_s_register = bttv_s_register,
3413#endif 3411#endif
3414 .tvnorms = BTTV_NORMS, 3412};
3415 .current_norm = V4L2_STD_PAL, 3413
3414static struct video_device bttv_video_template = {
3415 .fops = &bttv_fops,
3416 .minor = -1,
3417 .ioctl_ops = &bttv_ioctl_ops,
3418 .tvnorms = BTTV_NORMS,
3419 .current_norm = V4L2_STD_PAL,
3416}; 3420};
3417 3421
3418/* ----------------------------------------------------------------------- */ 3422/* ----------------------------------------------------------------------- */
@@ -3635,10 +3639,7 @@ static const struct file_operations radio_fops =
3635 .poll = radio_poll, 3639 .poll = radio_poll,
3636}; 3640};
3637 3641
3638static struct video_device radio_template = 3642static const struct v4l2_ioctl_ops radio_ioctl_ops = {
3639{
3640 .fops = &radio_fops,
3641 .minor = -1,
3642 .vidioc_querycap = radio_querycap, 3643 .vidioc_querycap = radio_querycap,
3643 .vidioc_g_tuner = radio_g_tuner, 3644 .vidioc_g_tuner = radio_g_tuner,
3644 .vidioc_enum_input = radio_enum_input, 3645 .vidioc_enum_input = radio_enum_input,
@@ -3655,6 +3656,12 @@ static struct video_device radio_template =
3655 .vidioc_s_frequency = bttv_s_frequency, 3656 .vidioc_s_frequency = bttv_s_frequency,
3656}; 3657};
3657 3658
3659static struct video_device radio_template = {
3660 .fops = &radio_fops,
3661 .minor = -1,
3662 .ioctl_ops = &radio_ioctl_ops,
3663};
3664
3658/* ----------------------------------------------------------------------- */ 3665/* ----------------------------------------------------------------------- */
3659/* some debug code */ 3666/* some debug code */
3660 3667
@@ -4175,8 +4182,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id)
4175 4182
4176static struct video_device *vdev_init(struct bttv *btv, 4183static struct video_device *vdev_init(struct bttv *btv,
4177 const struct video_device *template, 4184 const struct video_device *template,
4178 const char *type_name, 4185 const char *type_name)
4179 const int type)
4180{ 4186{
4181 struct video_device *vfd; 4187 struct video_device *vfd;
4182 4188
@@ -4185,9 +4191,8 @@ static struct video_device *vdev_init(struct bttv *btv,
4185 return NULL; 4191 return NULL;
4186 *vfd = *template; 4192 *vfd = *template;
4187 vfd->minor = -1; 4193 vfd->minor = -1;
4188 vfd->dev = &btv->c.pci->dev; 4194 vfd->parent = &btv->c.pci->dev;
4189 vfd->release = video_device_release; 4195 vfd->release = video_device_release;
4190 vfd->type = type;
4191 vfd->debug = bttv_debug; 4196 vfd->debug = bttv_debug;
4192 snprintf(vfd->name, sizeof(vfd->name), "BT%d%s %s (%s)", 4197 snprintf(vfd->name, sizeof(vfd->name), "BT%d%s %s (%s)",
4193 btv->id, (btv->id==848 && btv->revision==0x12) ? "A" : "", 4198 btv->id, (btv->id==848 && btv->revision==0x12) ? "A" : "",
@@ -4223,20 +4228,11 @@ static void bttv_unregister_video(struct bttv *btv)
4223/* register video4linux devices */ 4228/* register video4linux devices */
4224static int __devinit bttv_register_video(struct bttv *btv) 4229static int __devinit bttv_register_video(struct bttv *btv)
4225{ 4230{
4226 int video_type = VID_TYPE_CAPTURE | 4231 if (no_overlay > 0)
4227 VID_TYPE_TUNER |
4228 VID_TYPE_CLIPPING|
4229 VID_TYPE_SCALES;
4230
4231 if (no_overlay <= 0) {
4232 bttv_video_template.type |= VID_TYPE_OVERLAY;
4233 } else {
4234 printk("bttv: Overlay support disabled.\n"); 4232 printk("bttv: Overlay support disabled.\n");
4235 }
4236 4233
4237 /* video */ 4234 /* video */
4238 btv->video_dev = vdev_init(btv, &bttv_video_template, 4235 btv->video_dev = vdev_init(btv, &bttv_video_template, "video");
4239 "video", video_type);
4240 4236
4241 if (NULL == btv->video_dev) 4237 if (NULL == btv->video_dev)
4242 goto err; 4238 goto err;
@@ -4244,7 +4240,7 @@ static int __devinit bttv_register_video(struct bttv *btv)
4244 goto err; 4240 goto err;
4245 printk(KERN_INFO "bttv%d: registered device video%d\n", 4241 printk(KERN_INFO "bttv%d: registered device video%d\n",
4246 btv->c.nr,btv->video_dev->minor & 0x1f); 4242 btv->c.nr,btv->video_dev->minor & 0x1f);
4247 if (device_create_file(&btv->video_dev->class_dev, 4243 if (device_create_file(&btv->video_dev->dev,
4248 &dev_attr_card)<0) { 4244 &dev_attr_card)<0) {
4249 printk(KERN_ERR "bttv%d: device_create_file 'card' " 4245 printk(KERN_ERR "bttv%d: device_create_file 'card' "
4250 "failed\n", btv->c.nr); 4246 "failed\n", btv->c.nr);
@@ -4252,8 +4248,7 @@ static int __devinit bttv_register_video(struct bttv *btv)
4252 } 4248 }
4253 4249
4254 /* vbi */ 4250 /* vbi */
4255 btv->vbi_dev = vdev_init(btv, &bttv_video_template, 4251 btv->vbi_dev = vdev_init(btv, &bttv_video_template, "vbi");
4256 "vbi", VID_TYPE_TUNER | VID_TYPE_TELETEXT);
4257 4252
4258 if (NULL == btv->vbi_dev) 4253 if (NULL == btv->vbi_dev)
4259 goto err; 4254 goto err;
@@ -4265,8 +4260,7 @@ static int __devinit bttv_register_video(struct bttv *btv)
4265 if (!btv->has_radio) 4260 if (!btv->has_radio)
4266 return 0; 4261 return 0;
4267 /* radio */ 4262 /* radio */
4268 btv->radio_dev = vdev_init(btv, &radio_template, 4263 btv->radio_dev = vdev_init(btv, &radio_template, "radio");
4269 "radio", VID_TYPE_TUNER);
4270 if (NULL == btv->radio_dev) 4264 if (NULL == btv->radio_dev)
4271 goto err; 4265 goto err;
4272 if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO,radio_nr)<0) 4266 if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO,radio_nr)<0)
diff --git a/drivers/media/video/bt8xx/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c
index 0af586876e72..649682aac1ac 100644
--- a/drivers/media/video/bt8xx/bttv-risc.c
+++ b/drivers/media/video/bt8xx/bttv-risc.c
@@ -31,6 +31,7 @@
31#include <linux/interrupt.h> 31#include <linux/interrupt.h>
32#include <asm/page.h> 32#include <asm/page.h>
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
34#include <media/v4l2-ioctl.h>
34 35
35#include "bttvp.h" 36#include "bttvp.h"
36 37
diff --git a/drivers/media/video/bt8xx/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c
index 68f28e5fa040..6819e21a3773 100644
--- a/drivers/media/video/bt8xx/bttv-vbi.c
+++ b/drivers/media/video/bt8xx/bttv-vbi.c
@@ -29,6 +29,7 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/kdev_t.h> 31#include <linux/kdev_t.h>
32#include <media/v4l2-ioctl.h>
32#include <asm/io.h> 33#include <asm/io.h>
33#include "bttvp.h" 34#include "bttvp.h"
34 35
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index b364adaae78d..d3b3268bace8 100644
--- a/drivers/media/video/bw-qcam.c
+++ b/drivers/media/video/bw-qcam.c
@@ -74,6 +74,7 @@ OTHER DEALINGS IN THE SOFTWARE.
74#include <linux/sched.h> 74#include <linux/sched.h>
75#include <linux/videodev.h> 75#include <linux/videodev.h>
76#include <media/v4l2-common.h> 76#include <media/v4l2-common.h>
77#include <media/v4l2-ioctl.h>
77#include <linux/mutex.h> 78#include <linux/mutex.h>
78#include <asm/uaccess.h> 79#include <asm/uaccess.h>
79 80
@@ -906,9 +907,7 @@ static const struct file_operations qcam_fops = {
906}; 907};
907static struct video_device qcam_template= 908static struct video_device qcam_template=
908{ 909{
909 .owner = THIS_MODULE,
910 .name = "Connectix Quickcam", 910 .name = "Connectix Quickcam",
911 .type = VID_TYPE_CAPTURE,
912 .fops = &qcam_fops, 911 .fops = &qcam_fops,
913}; 912};
914 913
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c
index fe1e67bb1ca8..fe9379b282d3 100644
--- a/drivers/media/video/c-qcam.c
+++ b/drivers/media/video/c-qcam.c
@@ -35,6 +35,7 @@
35#include <linux/sched.h> 35#include <linux/sched.h>
36#include <linux/videodev.h> 36#include <linux/videodev.h>
37#include <media/v4l2-common.h> 37#include <media/v4l2-common.h>
38#include <media/v4l2-ioctl.h>
38#include <linux/mutex.h> 39#include <linux/mutex.h>
39#include <linux/jiffies.h> 40#include <linux/jiffies.h>
40 41
@@ -701,9 +702,7 @@ static const struct file_operations qcam_fops = {
701 702
702static struct video_device qcam_template= 703static struct video_device qcam_template=
703{ 704{
704 .owner = THIS_MODULE,
705 .name = "Colour QuickCam", 705 .name = "Colour QuickCam",
706 .type = VID_TYPE_CAPTURE,
707 .fops = &qcam_fops, 706 .fops = &qcam_fops,
708}; 707};
709 708
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index d99453faaab7..c149b7d712e5 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -25,6 +25,7 @@
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/videodev2.h> 26#include <linux/videodev2.h>
27#include <media/v4l2-common.h> 27#include <media/v4l2-common.h>
28#include <media/v4l2-ioctl.h>
28#include <media/v4l2-chip-ident.h> 29#include <media/v4l2-chip-ident.h>
29#include <linux/device.h> 30#include <linux/device.h>
30#include <linux/wait.h> 31#include <linux/wait.h>
@@ -1768,17 +1769,7 @@ static const struct file_operations cafe_v4l_fops = {
1768 .llseek = no_llseek, 1769 .llseek = no_llseek,
1769}; 1770};
1770 1771
1771static struct video_device cafe_v4l_template = { 1772static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = {
1772 .name = "cafe",
1773 .type = VFL_TYPE_GRABBER,
1774 .type2 = VID_TYPE_CAPTURE,
1775 .minor = -1, /* Get one dynamically */
1776 .tvnorms = V4L2_STD_NTSC_M,
1777 .current_norm = V4L2_STD_NTSC_M, /* make mplayer happy */
1778
1779 .fops = &cafe_v4l_fops,
1780 .release = cafe_v4l_dev_release,
1781
1782 .vidioc_querycap = cafe_vidioc_querycap, 1773 .vidioc_querycap = cafe_vidioc_querycap,
1783 .vidioc_enum_fmt_vid_cap = cafe_vidioc_enum_fmt_vid_cap, 1774 .vidioc_enum_fmt_vid_cap = cafe_vidioc_enum_fmt_vid_cap,
1784 .vidioc_try_fmt_vid_cap = cafe_vidioc_try_fmt_vid_cap, 1775 .vidioc_try_fmt_vid_cap = cafe_vidioc_try_fmt_vid_cap,
@@ -1801,6 +1792,17 @@ static struct video_device cafe_v4l_template = {
1801 .vidioc_s_parm = cafe_vidioc_s_parm, 1792 .vidioc_s_parm = cafe_vidioc_s_parm,
1802}; 1793};
1803 1794
1795static struct video_device cafe_v4l_template = {
1796 .name = "cafe",
1797 .minor = -1, /* Get one dynamically */
1798 .tvnorms = V4L2_STD_NTSC_M,
1799 .current_norm = V4L2_STD_NTSC_M, /* make mplayer happy */
1800
1801 .fops = &cafe_v4l_fops,
1802 .ioctl_ops = &cafe_v4l_ioctl_ops,
1803 .release = cafe_v4l_dev_release,
1804};
1805
1804 1806
1805 1807
1806 1808
@@ -2157,7 +2159,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
2157 cam->v4ldev = cafe_v4l_template; 2159 cam->v4ldev = cafe_v4l_template;
2158 cam->v4ldev.debug = 0; 2160 cam->v4ldev.debug = 0;
2159// cam->v4ldev.debug = V4L2_DEBUG_IOCTL_ARG; 2161// cam->v4ldev.debug = V4L2_DEBUG_IOCTL_ARG;
2160 cam->v4ldev.dev = &pdev->dev; 2162 cam->v4ldev.parent = &pdev->dev;
2161 ret = video_register_device(&cam->v4ldev, VFL_TYPE_GRABBER, -1); 2163 ret = video_register_device(&cam->v4ldev, VFL_TYPE_GRABBER, -1);
2162 if (ret) 2164 if (ret)
2163 goto out_smbus; 2165 goto out_smbus;
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c
index 54de0cd482e9..bd5d9de5a008 100644
--- a/drivers/media/video/compat_ioctl32.c
+++ b/drivers/media/video/compat_ioctl32.c
@@ -17,7 +17,7 @@
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
20#include <media/v4l2-common.h> 20#include <media/v4l2-ioctl.h>
21 21
22#ifdef CONFIG_COMPAT 22#ifdef CONFIG_COMPAT
23 23
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index 2a81376ef503..dc8cc6115e2f 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -3799,9 +3799,7 @@ static const struct file_operations cpia_fops = {
3799}; 3799};
3800 3800
3801static struct video_device cpia_template = { 3801static struct video_device cpia_template = {
3802 .owner = THIS_MODULE,
3803 .name = "CPiA Camera", 3802 .name = "CPiA Camera",
3804 .type = VID_TYPE_CAPTURE,
3805 .fops = &cpia_fops, 3803 .fops = &cpia_fops,
3806}; 3804};
3807 3805
diff --git a/drivers/media/video/cpia.h b/drivers/media/video/cpia.h
index 5096058bf579..8f0cfee4b8a1 100644
--- a/drivers/media/video/cpia.h
+++ b/drivers/media/video/cpia.h
@@ -46,6 +46,7 @@
46#include <asm/uaccess.h> 46#include <asm/uaccess.h>
47#include <linux/videodev.h> 47#include <linux/videodev.h>
48#include <media/v4l2-common.h> 48#include <media/v4l2-common.h>
49#include <media/v4l2-ioctl.h>
49#include <linux/list.h> 50#include <linux/list.h>
50#include <linux/mutex.h> 51#include <linux/mutex.h>
51 52
diff --git a/drivers/media/video/cpia2/cpia2_core.c b/drivers/media/video/cpia2/cpia2_core.c
index f2e8b1c82c66..af8b9ec8e358 100644
--- a/drivers/media/video/cpia2/cpia2_core.c
+++ b/drivers/media/video/cpia2/cpia2_core.c
@@ -32,6 +32,7 @@
32#include "cpia2.h" 32#include "cpia2.h"
33 33
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/mm.h>
35#include <linux/vmalloc.h> 36#include <linux/vmalloc.h>
36#include <linux/firmware.h> 37#include <linux/firmware.h>
37 38
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c
index 7ce2789fa976..515c8b57a60d 100644
--- a/drivers/media/video/cpia2/cpia2_v4l.c
+++ b/drivers/media/video/cpia2/cpia2_v4l.c
@@ -37,6 +37,7 @@
37#include <linux/sched.h> 37#include <linux/sched.h>
38#include <linux/slab.h> 38#include <linux/slab.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <media/v4l2-ioctl.h>
40 41
41#include "cpia2.h" 42#include "cpia2.h"
42#include "cpia2dev.h" 43#include "cpia2dev.h"
@@ -1935,11 +1936,7 @@ static const struct file_operations fops_template = {
1935 1936
1936static struct video_device cpia2_template = { 1937static struct video_device cpia2_template = {
1937 /* I could not find any place for the old .initialize initializer?? */ 1938 /* I could not find any place for the old .initialize initializer?? */
1938 .owner= THIS_MODULE,
1939 .name= "CPiA2 Camera", 1939 .name= "CPiA2 Camera",
1940 .type= VID_TYPE_CAPTURE,
1941 .type2 = V4L2_CAP_VIDEO_CAPTURE |
1942 V4L2_CAP_STREAMING,
1943 .minor= -1, 1940 .minor= -1,
1944 .fops= &fops_template, 1941 .fops= &fops_template,
1945 .release= video_device_release, 1942 .release= video_device_release,
diff --git a/drivers/media/video/cs5345.c b/drivers/media/video/cs5345.c
index 1c3fa3a7470a..61d14d26686f 100644
--- a/drivers/media/video/cs5345.c
+++ b/drivers/media/video/cs5345.c
@@ -111,7 +111,7 @@ static int cs5345_command(struct i2c_client *client, unsigned cmd, void *arg)
111 if (cmd == VIDIOC_DBG_G_REGISTER) 111 if (cmd == VIDIOC_DBG_G_REGISTER)
112 reg->val = cs5345_read(client, reg->reg & 0x1f); 112 reg->val = cs5345_read(client, reg->reg & 0x1f);
113 else 113 else
114 cs5345_write(client, reg->reg & 0x1f, reg->val & 0x1f); 114 cs5345_write(client, reg->reg & 0x1f, reg->val & 0xff);
115 break; 115 break;
116 } 116 }
117#endif 117#endif
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c
index 645b339152d3..e30a589c0e18 100644
--- a/drivers/media/video/cs53l32a.c
+++ b/drivers/media/video/cs53l32a.c
@@ -26,7 +26,7 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/i2c-id.h> 28#include <linux/i2c-id.h>
29#include <linux/videodev.h> 29#include <linux/videodev2.h>
30#include <media/v4l2-common.h> 30#include <media/v4l2-common.h>
31#include <media/v4l2-chip-ident.h> 31#include <media/v4l2-chip-ident.h>
32#include <media/v4l2-i2c-drv-legacy.h> 32#include <media/v4l2-i2c-drv-legacy.h>
diff --git a/drivers/media/video/cx18/Kconfig b/drivers/media/video/cx18/Kconfig
index 9aefdc5ea79a..ef48565de7f1 100644
--- a/drivers/media/video/cx18/Kconfig
+++ b/drivers/media/video/cx18/Kconfig
@@ -2,9 +2,7 @@ config VIDEO_CX18
2 tristate "Conexant cx23418 MPEG encoder support" 2 tristate "Conexant cx23418 MPEG encoder support"
3 depends on VIDEO_V4L2 && DVB_CORE && PCI && I2C && EXPERIMENTAL 3 depends on VIDEO_V4L2 && DVB_CORE && PCI && I2C && EXPERIMENTAL
4 depends on INPUT # due to VIDEO_IR 4 depends on INPUT # due to VIDEO_IR
5 depends on HOTPLUG # due to FW_LOADER
6 select I2C_ALGOBIT 5 select I2C_ALGOBIT
7 select FW_LOADER
8 select VIDEO_IR 6 select VIDEO_IR
9 select VIDEO_TUNER 7 select VIDEO_TUNER
10 select VIDEO_TVEEPROM 8 select VIDEO_TVEEPROM
diff --git a/drivers/media/video/cx18/cx18-av-audio.c b/drivers/media/video/cx18/cx18-av-audio.c
index c40a286de1b9..0b55837880a7 100644
--- a/drivers/media/video/cx18/cx18-av-audio.c
+++ b/drivers/media/video/cx18/cx18-av-audio.c
@@ -30,7 +30,6 @@ static int set_audclk_freq(struct cx18 *cx, u32 freq)
30 if (freq != 32000 && freq != 44100 && freq != 48000) 30 if (freq != 32000 && freq != 44100 && freq != 48000)
31 return -EINVAL; 31 return -EINVAL;
32 32
33 /* common for all inputs and rates */
34 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x10 */ 33 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x10 */
35 cx18_av_write(cx, 0x127, 0x50); 34 cx18_av_write(cx, 0x127, 0x50);
36 35
@@ -38,15 +37,30 @@ static int set_audclk_freq(struct cx18 *cx, u32 freq)
38 switch (freq) { 37 switch (freq) {
39 case 32000: 38 case 32000:
40 /* VID_PLL and AUX_PLL */ 39 /* VID_PLL and AUX_PLL */
41 cx18_av_write4(cx, 0x108, 0x1006040f); 40 cx18_av_write4(cx, 0x108, 0x1408040f);
42 41
43 /* AUX_PLL_FRAC */ 42 /* AUX_PLL_FRAC */
44 cx18_av_write4(cx, 0x110, 0x01bb39ee); 43 /* 0x8.9504318a * 28,636,363.636 / 0x14 = 32000 * 384 */
44 cx18_av_write4(cx, 0x110, 0x012a0863);
45 45
46 /* src3/4/6_ctl = 0x0801f77f */ 46 /* src3/4/6_ctl */
47 /* 0x1.f77f = (4 * 15734.26) / 32000 */
47 cx18_av_write4(cx, 0x900, 0x0801f77f); 48 cx18_av_write4(cx, 0x900, 0x0801f77f);
48 cx18_av_write4(cx, 0x904, 0x0801f77f); 49 cx18_av_write4(cx, 0x904, 0x0801f77f);
49 cx18_av_write4(cx, 0x90c, 0x0801f77f); 50 cx18_av_write4(cx, 0x90c, 0x0801f77f);
51
52 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x14 */
53 cx18_av_write(cx, 0x127, 0x54);
54
55 /* AUD_COUNT = 0x2fff = 8 samples * 4 * 384 - 1 */
56 cx18_av_write4(cx, 0x12c, 0x11202fff);
57
58 /*
59 * EN_AV_LOCK = 1
60 * VID_COUNT = 0x0d2ef8 = 107999.000 * 8 =
61 * ((8 samples/32,000) * (13,500,000 * 8) * 4 - 1) * 8
62 */
63 cx18_av_write4(cx, 0x128, 0xa10d2ef8);
50 break; 64 break;
51 65
52 case 44100: 66 case 44100:
@@ -54,12 +68,24 @@ static int set_audclk_freq(struct cx18 *cx, u32 freq)
54 cx18_av_write4(cx, 0x108, 0x1009040f); 68 cx18_av_write4(cx, 0x108, 0x1009040f);
55 69
56 /* AUX_PLL_FRAC */ 70 /* AUX_PLL_FRAC */
57 cx18_av_write4(cx, 0x110, 0x00ec6bd6); 71 /* 0x9.7635e7 * 28,636,363.63 / 0x10 = 44100 * 384 */
72 cx18_av_write4(cx, 0x110, 0x00ec6bce);
58 73
59 /* src3/4/6_ctl = 0x08016d59 */ 74 /* src3/4/6_ctl */
75 /* 0x1.6d59 = (4 * 15734.26) / 44100 */
60 cx18_av_write4(cx, 0x900, 0x08016d59); 76 cx18_av_write4(cx, 0x900, 0x08016d59);
61 cx18_av_write4(cx, 0x904, 0x08016d59); 77 cx18_av_write4(cx, 0x904, 0x08016d59);
62 cx18_av_write4(cx, 0x90c, 0x08016d59); 78 cx18_av_write4(cx, 0x90c, 0x08016d59);
79
80 /* AUD_COUNT = 0x92ff = 49 samples * 2 * 384 - 1 */
81 cx18_av_write4(cx, 0x12c, 0x112092ff);
82
83 /*
84 * EN_AV_LOCK = 1
85 * VID_COUNT = 0x1d4bf8 = 239999.000 * 8 =
86 * ((49 samples/44,100) * (13,500,000 * 8) * 2 - 1) * 8
87 */
88 cx18_av_write4(cx, 0x128, 0xa11d4bf8);
63 break; 89 break;
64 90
65 case 48000: 91 case 48000:
@@ -67,12 +93,24 @@ static int set_audclk_freq(struct cx18 *cx, u32 freq)
67 cx18_av_write4(cx, 0x108, 0x100a040f); 93 cx18_av_write4(cx, 0x108, 0x100a040f);
68 94
69 /* AUX_PLL_FRAC */ 95 /* AUX_PLL_FRAC */
70 cx18_av_write4(cx, 0x110, 0x0098d6e5); 96 /* 0xa.4c6b6ea * 28,636,363.63 / 0x10 = 48000 * 384 */
97 cx18_av_write4(cx, 0x110, 0x0098d6dd);
71 98
72 /* src3/4/6_ctl = 0x08014faa */ 99 /* src3/4/6_ctl */
100 /* 0x1.4faa = (4 * 15734.26) / 48000 */
73 cx18_av_write4(cx, 0x900, 0x08014faa); 101 cx18_av_write4(cx, 0x900, 0x08014faa);
74 cx18_av_write4(cx, 0x904, 0x08014faa); 102 cx18_av_write4(cx, 0x904, 0x08014faa);
75 cx18_av_write4(cx, 0x90c, 0x08014faa); 103 cx18_av_write4(cx, 0x90c, 0x08014faa);
104
105 /* AUD_COUNT = 0x5fff = 4 samples * 16 * 384 - 1 */
106 cx18_av_write4(cx, 0x12c, 0x11205fff);
107
108 /*
109 * EN_AV_LOCK = 1
110 * VID_COUNT = 0x1193f8 = 143999.000 * 8 =
111 * ((4 samples/48,000) * (13,500,000 * 8) * 16 - 1) * 8
112 */
113 cx18_av_write4(cx, 0x128, 0xa11193f8);
76 break; 114 break;
77 } 115 }
78 } else { 116 } else {
@@ -82,18 +120,31 @@ static int set_audclk_freq(struct cx18 *cx, u32 freq)
82 cx18_av_write4(cx, 0x108, 0x1e08040f); 120 cx18_av_write4(cx, 0x108, 0x1e08040f);
83 121
84 /* AUX_PLL_FRAC */ 122 /* AUX_PLL_FRAC */
85 cx18_av_write4(cx, 0x110, 0x012a0869); 123 /* 0x8.9504318 * 28,636,363.63 / 0x1e = 32000 * 256 */
124 cx18_av_write4(cx, 0x110, 0x012a0863);
86 125
87 /* src1_ctl = 0x08010000 */ 126 /* src1_ctl */
127 /* 0x1.0000 = 32000/32000 */
88 cx18_av_write4(cx, 0x8f8, 0x08010000); 128 cx18_av_write4(cx, 0x8f8, 0x08010000);
89 129
90 /* src3/4/6_ctl = 0x08020000 */ 130 /* src3/4/6_ctl */
131 /* 0x2.0000 = 2 * (32000/32000) */
91 cx18_av_write4(cx, 0x900, 0x08020000); 132 cx18_av_write4(cx, 0x900, 0x08020000);
92 cx18_av_write4(cx, 0x904, 0x08020000); 133 cx18_av_write4(cx, 0x904, 0x08020000);
93 cx18_av_write4(cx, 0x90c, 0x08020000); 134 cx18_av_write4(cx, 0x90c, 0x08020000);
94 135
95 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x14 */ 136 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x14 */
96 cx18_av_write(cx, 0x127, 0x54); 137 cx18_av_write(cx, 0x127, 0x54);
138
139 /* AUD_COUNT = 0x1fff = 8 samples * 4 * 256 - 1 */
140 cx18_av_write4(cx, 0x12c, 0x11201fff);
141
142 /*
143 * EN_AV_LOCK = 1
144 * VID_COUNT = 0x0d2ef8 = 107999.000 * 8 =
145 * ((8 samples/32,000) * (13,500,000 * 8) * 4 - 1) * 8
146 */
147 cx18_av_write4(cx, 0x128, 0xa10d2ef8);
97 break; 148 break;
98 149
99 case 44100: 150 case 44100:
@@ -101,15 +152,28 @@ static int set_audclk_freq(struct cx18 *cx, u32 freq)
101 cx18_av_write4(cx, 0x108, 0x1809040f); 152 cx18_av_write4(cx, 0x108, 0x1809040f);
102 153
103 /* AUX_PLL_FRAC */ 154 /* AUX_PLL_FRAC */
104 cx18_av_write4(cx, 0x110, 0x00ec6bd6); 155 /* 0x9.7635e74 * 28,636,363.63 / 0x18 = 44100 * 256 */
156 cx18_av_write4(cx, 0x110, 0x00ec6bce);
105 157
106 /* src1_ctl = 0x08010000 */ 158 /* src1_ctl */
159 /* 0x1.60cd = 44100/32000 */
107 cx18_av_write4(cx, 0x8f8, 0x080160cd); 160 cx18_av_write4(cx, 0x8f8, 0x080160cd);
108 161
109 /* src3/4/6_ctl = 0x08020000 */ 162 /* src3/4/6_ctl */
163 /* 0x1.7385 = 2 * (32000/44100) */
110 cx18_av_write4(cx, 0x900, 0x08017385); 164 cx18_av_write4(cx, 0x900, 0x08017385);
111 cx18_av_write4(cx, 0x904, 0x08017385); 165 cx18_av_write4(cx, 0x904, 0x08017385);
112 cx18_av_write4(cx, 0x90c, 0x08017385); 166 cx18_av_write4(cx, 0x90c, 0x08017385);
167
168 /* AUD_COUNT = 0x61ff = 49 samples * 2 * 256 - 1 */
169 cx18_av_write4(cx, 0x12c, 0x112061ff);
170
171 /*
172 * EN_AV_LOCK = 1
173 * VID_COUNT = 0x1d4bf8 = 239999.000 * 8 =
174 * ((49 samples/44,100) * (13,500,000 * 8) * 2 - 1) * 8
175 */
176 cx18_av_write4(cx, 0x128, 0xa11d4bf8);
113 break; 177 break;
114 178
115 case 48000: 179 case 48000:
@@ -117,15 +181,28 @@ static int set_audclk_freq(struct cx18 *cx, u32 freq)
117 cx18_av_write4(cx, 0x108, 0x180a040f); 181 cx18_av_write4(cx, 0x108, 0x180a040f);
118 182
119 /* AUX_PLL_FRAC */ 183 /* AUX_PLL_FRAC */
120 cx18_av_write4(cx, 0x110, 0x0098d6e5); 184 /* 0xa.4c6b6ea * 28,636,363.63 / 0x18 = 48000 * 256 */
185 cx18_av_write4(cx, 0x110, 0x0098d6dd);
121 186
122 /* src1_ctl = 0x08010000 */ 187 /* src1_ctl */
188 /* 0x1.8000 = 48000/32000 */
123 cx18_av_write4(cx, 0x8f8, 0x08018000); 189 cx18_av_write4(cx, 0x8f8, 0x08018000);
124 190
125 /* src3/4/6_ctl = 0x08020000 */ 191 /* src3/4/6_ctl */
192 /* 0x1.5555 = 2 * (32000/48000) */
126 cx18_av_write4(cx, 0x900, 0x08015555); 193 cx18_av_write4(cx, 0x900, 0x08015555);
127 cx18_av_write4(cx, 0x904, 0x08015555); 194 cx18_av_write4(cx, 0x904, 0x08015555);
128 cx18_av_write4(cx, 0x90c, 0x08015555); 195 cx18_av_write4(cx, 0x90c, 0x08015555);
196
197 /* AUD_COUNT = 0x3fff = 4 samples * 16 * 256 - 1 */
198 cx18_av_write4(cx, 0x12c, 0x11203fff);
199
200 /*
201 * EN_AV_LOCK = 1
202 * VID_COUNT = 0x1193f8 = 143999.000 * 8 =
203 * ((4 samples/48,000) * (13,500,000 * 8) * 16 - 1) * 8
204 */
205 cx18_av_write4(cx, 0x128, 0xa11193f8);
129 break; 206 break;
130 } 207 }
131 } 208 }
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index 45e31b04730e..4801bc7fb5b2 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -46,6 +46,7 @@
46#include <linux/dvb/video.h> 46#include <linux/dvb/video.h>
47#include <linux/dvb/audio.h> 47#include <linux/dvb/audio.h>
48#include <media/v4l2-common.h> 48#include <media/v4l2-common.h>
49#include <media/v4l2-ioctl.h>
49#include <media/tuner.h> 50#include <media/tuner.h>
50#include "cx18-mailbox.h" 51#include "cx18-mailbox.h"
51#include "cx18-av-core.h" 52#include "cx18-av-core.h"
diff --git a/drivers/media/video/cx18/cx18-firmware.c b/drivers/media/video/cx18/cx18-firmware.c
index 2d630d9f7496..78fadd2ada5d 100644
--- a/drivers/media/video/cx18/cx18-firmware.c
+++ b/drivers/media/video/cx18/cx18-firmware.c
@@ -86,10 +86,6 @@
86 86
87#define CX18_DSP0_INTERRUPT_MASK 0xd0004C 87#define CX18_DSP0_INTERRUPT_MASK 0xd0004C
88 88
89/* Encoder/decoder firmware sizes */
90#define CX18_FW_CPU_SIZE (158332)
91#define CX18_FW_APU_SIZE (141200)
92
93#define APU_ROM_SYNC1 0x6D676553 /* "mgeS" */ 89#define APU_ROM_SYNC1 0x6D676553 /* "mgeS" */
94#define APU_ROM_SYNC2 0x72646548 /* "rdeH" */ 90#define APU_ROM_SYNC2 0x72646548 /* "rdeH" */
95 91
@@ -100,35 +96,22 @@ struct cx18_apu_rom_seghdr {
100 u32 size; 96 u32 size;
101}; 97};
102 98
103static int load_cpu_fw_direct(const char *fn, u8 __iomem *mem, struct cx18 *cx, long size) 99static int load_cpu_fw_direct(const char *fn, u8 __iomem *mem, struct cx18 *cx)
104{ 100{
105 const struct firmware *fw = NULL; 101 const struct firmware *fw = NULL;
106 int retries = 3;
107 int i, j; 102 int i, j;
103 unsigned size;
108 u32 __iomem *dst = (u32 __iomem *)mem; 104 u32 __iomem *dst = (u32 __iomem *)mem;
109 const u32 *src; 105 const u32 *src;
110 106
111retry: 107 if (request_firmware(&fw, fn, &cx->dev->dev)) {
112 if (!retries || request_firmware(&fw, fn, &cx->dev->dev)) { 108 CX18_ERR("Unable to open firmware %s\n", fn);
113 CX18_ERR("Unable to open firmware %s (must be %ld bytes)\n",
114 fn, size);
115 CX18_ERR("Did you put the firmware in the hotplug firmware directory?\n"); 109 CX18_ERR("Did you put the firmware in the hotplug firmware directory?\n");
116 return -ENOMEM; 110 return -ENOMEM;
117 } 111 }
118 112
119 src = (const u32 *)fw->data; 113 src = (const u32 *)fw->data;
120 114
121 if (fw->size != size) {
122 /* Due to race conditions in firmware loading (esp. with
123 udev <0.95) the wrong file was sometimes loaded. So we check
124 filesizes to see if at least the right-sized file was
125 loaded. If not, then we retry. */
126 CX18_INFO("retry: file loaded was not %s (expected size %ld, got %zd)\n",
127 fn, size, fw->size);
128 release_firmware(fw);
129 retries--;
130 goto retry;
131 }
132 for (i = 0; i < fw->size; i += 4096) { 115 for (i = 0; i < fw->size; i += 4096) {
133 setup_page(i); 116 setup_page(i);
134 for (j = i; j < fw->size && j < i + 4096; j += 4) { 117 for (j = i; j < fw->size && j < i + 4096; j += 4) {
@@ -145,15 +128,16 @@ retry:
145 } 128 }
146 if (!test_bit(CX18_F_I_LOADED_FW, &cx->i_flags)) 129 if (!test_bit(CX18_F_I_LOADED_FW, &cx->i_flags))
147 CX18_INFO("loaded %s firmware (%zd bytes)\n", fn, fw->size); 130 CX18_INFO("loaded %s firmware (%zd bytes)\n", fn, fw->size);
131 size = fw->size;
148 release_firmware(fw); 132 release_firmware(fw);
149 return size; 133 return size;
150} 134}
151 135
152static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx, long size) 136static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx)
153{ 137{
154 const struct firmware *fw = NULL; 138 const struct firmware *fw = NULL;
155 int retries = 3;
156 int i, j; 139 int i, j;
140 unsigned size;
157 const u32 *src; 141 const u32 *src;
158 struct cx18_apu_rom_seghdr seghdr; 142 struct cx18_apu_rom_seghdr seghdr;
159 const u8 *vers; 143 const u8 *vers;
@@ -161,10 +145,8 @@ static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx,
161 u32 apu_version = 0; 145 u32 apu_version = 0;
162 int sz; 146 int sz;
163 147
164retry: 148 if (request_firmware(&fw, fn, &cx->dev->dev)) {
165 if (!retries || request_firmware(&fw, fn, &cx->dev->dev)) { 149 CX18_ERR("unable to open firmware %s\n", fn);
166 CX18_ERR("unable to open firmware %s (must be %ld bytes)\n",
167 fn, size);
168 CX18_ERR("did you put the firmware in the hotplug firmware directory?\n"); 150 CX18_ERR("did you put the firmware in the hotplug firmware directory?\n");
169 return -ENOMEM; 151 return -ENOMEM;
170 } 152 }
@@ -173,19 +155,8 @@ retry:
173 vers = fw->data + sizeof(seghdr); 155 vers = fw->data + sizeof(seghdr);
174 sz = fw->size; 156 sz = fw->size;
175 157
176 if (fw->size != size) {
177 /* Due to race conditions in firmware loading (esp. with
178 udev <0.95) the wrong file was sometimes loaded. So we check
179 filesizes to see if at least the right-sized file was
180 loaded. If not, then we retry. */
181 CX18_INFO("retry: file loaded was not %s (expected size %ld, got %zd)\n",
182 fn, size, fw->size);
183 release_firmware(fw);
184 retries--;
185 goto retry;
186 }
187 apu_version = (vers[0] << 24) | (vers[4] << 16) | vers[32]; 158 apu_version = (vers[0] << 24) | (vers[4] << 16) | vers[32];
188 while (offset + sizeof(seghdr) < size) { 159 while (offset + sizeof(seghdr) < fw->size) {
189 /* TODO: byteswapping */ 160 /* TODO: byteswapping */
190 memcpy(&seghdr, src + offset / 4, sizeof(seghdr)); 161 memcpy(&seghdr, src + offset / 4, sizeof(seghdr));
191 offset += sizeof(seghdr); 162 offset += sizeof(seghdr);
@@ -215,6 +186,7 @@ retry:
215 if (!test_bit(CX18_F_I_LOADED_FW, &cx->i_flags)) 186 if (!test_bit(CX18_F_I_LOADED_FW, &cx->i_flags))
216 CX18_INFO("loaded %s firmware V%08x (%zd bytes)\n", 187 CX18_INFO("loaded %s firmware V%08x (%zd bytes)\n",
217 fn, apu_version, fw->size); 188 fn, apu_version, fw->size);
189 size = fw->size;
218 release_firmware(fw); 190 release_firmware(fw);
219 /* Clear bit0 for APU to start from 0 */ 191 /* Clear bit0 for APU to start from 0 */
220 write_reg(read_reg(0xc72030) & ~1, 0xc72030); 192 write_reg(read_reg(0xc72030) & ~1, 0xc72030);
@@ -340,7 +312,7 @@ int cx18_firmware_init(struct cx18 *cx)
340 /* Only if the processor is not running */ 312 /* Only if the processor is not running */
341 if (read_reg(CX18_PROC_SOFT_RESET) & 8) { 313 if (read_reg(CX18_PROC_SOFT_RESET) & 8) {
342 int sz = load_apu_fw_direct("v4l-cx23418-apu.fw", 314 int sz = load_apu_fw_direct("v4l-cx23418-apu.fw",
343 cx->enc_mem, cx, CX18_FW_APU_SIZE); 315 cx->enc_mem, cx);
344 316
345 write_enc(0xE51FF004, 0); 317 write_enc(0xE51FF004, 0);
346 write_enc(0xa00000, 4); /* todo: not hardcoded */ 318 write_enc(0xa00000, 4); /* todo: not hardcoded */
@@ -348,7 +320,7 @@ int cx18_firmware_init(struct cx18 *cx)
348 cx18_msleep_timeout(500, 0); 320 cx18_msleep_timeout(500, 0);
349 321
350 sz = sz <= 0 ? sz : load_cpu_fw_direct("v4l-cx23418-cpu.fw", 322 sz = sz <= 0 ? sz : load_cpu_fw_direct("v4l-cx23418-cpu.fw",
351 cx->enc_mem, cx, CX18_FW_CPU_SIZE); 323 cx->enc_mem, cx);
352 324
353 if (sz > 0) { 325 if (sz > 0) {
354 int retries = 0; 326 int retries = 0;
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index 0d74e59e503e..a7f839631d6a 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -787,50 +787,54 @@ int cx18_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
787 return res; 787 return res;
788} 788}
789 789
790void cx18_set_funcs(struct video_device *vdev) 790static const struct v4l2_ioctl_ops cx18_ioctl_ops = {
791{ 791 .vidioc_querycap = cx18_querycap,
792 vdev->vidioc_querycap = cx18_querycap; 792 .vidioc_g_priority = cx18_g_priority,
793 vdev->vidioc_g_priority = cx18_g_priority; 793 .vidioc_s_priority = cx18_s_priority,
794 vdev->vidioc_s_priority = cx18_s_priority; 794 .vidioc_s_audio = cx18_s_audio,
795 vdev->vidioc_s_audio = cx18_s_audio; 795 .vidioc_g_audio = cx18_g_audio,
796 vdev->vidioc_g_audio = cx18_g_audio; 796 .vidioc_enumaudio = cx18_enumaudio,
797 vdev->vidioc_enumaudio = cx18_enumaudio; 797 .vidioc_enum_input = cx18_enum_input,
798 vdev->vidioc_enum_input = cx18_enum_input; 798 .vidioc_cropcap = cx18_cropcap,
799 vdev->vidioc_cropcap = cx18_cropcap; 799 .vidioc_s_crop = cx18_s_crop,
800 vdev->vidioc_s_crop = cx18_s_crop; 800 .vidioc_g_crop = cx18_g_crop,
801 vdev->vidioc_g_crop = cx18_g_crop; 801 .vidioc_g_input = cx18_g_input,
802 vdev->vidioc_g_input = cx18_g_input; 802 .vidioc_s_input = cx18_s_input,
803 vdev->vidioc_s_input = cx18_s_input; 803 .vidioc_g_frequency = cx18_g_frequency,
804 vdev->vidioc_g_frequency = cx18_g_frequency; 804 .vidioc_s_frequency = cx18_s_frequency,
805 vdev->vidioc_s_frequency = cx18_s_frequency; 805 .vidioc_s_tuner = cx18_s_tuner,
806 vdev->vidioc_s_tuner = cx18_s_tuner; 806 .vidioc_g_tuner = cx18_g_tuner,
807 vdev->vidioc_g_tuner = cx18_g_tuner; 807 .vidioc_g_enc_index = cx18_g_enc_index,
808 vdev->vidioc_g_enc_index = cx18_g_enc_index; 808 .vidioc_g_std = cx18_g_std,
809 vdev->vidioc_g_std = cx18_g_std; 809 .vidioc_s_std = cx18_s_std,
810 vdev->vidioc_s_std = cx18_s_std; 810 .vidioc_log_status = cx18_log_status,
811 vdev->vidioc_log_status = cx18_log_status; 811 .vidioc_enum_fmt_vid_cap = cx18_enum_fmt_vid_cap,
812 vdev->vidioc_enum_fmt_vid_cap = cx18_enum_fmt_vid_cap; 812 .vidioc_encoder_cmd = cx18_encoder_cmd,
813 vdev->vidioc_encoder_cmd = cx18_encoder_cmd; 813 .vidioc_try_encoder_cmd = cx18_try_encoder_cmd,
814 vdev->vidioc_try_encoder_cmd = cx18_try_encoder_cmd; 814 .vidioc_g_fmt_vid_cap = cx18_g_fmt_vid_cap,
815 vdev->vidioc_g_fmt_vid_cap = cx18_g_fmt_vid_cap; 815 .vidioc_g_fmt_vbi_cap = cx18_g_fmt_vbi_cap,
816 vdev->vidioc_g_fmt_vbi_cap = cx18_g_fmt_vbi_cap; 816 .vidioc_g_fmt_sliced_vbi_cap = cx18_g_fmt_sliced_vbi_cap,
817 vdev->vidioc_g_fmt_sliced_vbi_cap = cx18_g_fmt_sliced_vbi_cap; 817 .vidioc_s_fmt_vid_cap = cx18_s_fmt_vid_cap,
818 vdev->vidioc_s_fmt_vid_cap = cx18_s_fmt_vid_cap; 818 .vidioc_s_fmt_vbi_cap = cx18_s_fmt_vbi_cap,
819 vdev->vidioc_s_fmt_vbi_cap = cx18_s_fmt_vbi_cap; 819 .vidioc_s_fmt_sliced_vbi_cap = cx18_s_fmt_sliced_vbi_cap,
820 vdev->vidioc_s_fmt_sliced_vbi_cap = cx18_s_fmt_sliced_vbi_cap; 820 .vidioc_try_fmt_vid_cap = cx18_try_fmt_vid_cap,
821 vdev->vidioc_try_fmt_vid_cap = cx18_try_fmt_vid_cap; 821 .vidioc_try_fmt_vbi_cap = cx18_try_fmt_vbi_cap,
822 vdev->vidioc_try_fmt_vbi_cap = cx18_try_fmt_vbi_cap; 822 .vidioc_try_fmt_sliced_vbi_cap = cx18_try_fmt_sliced_vbi_cap,
823 vdev->vidioc_try_fmt_sliced_vbi_cap = cx18_try_fmt_sliced_vbi_cap; 823 .vidioc_g_sliced_vbi_cap = cx18_g_sliced_vbi_cap,
824 vdev->vidioc_g_sliced_vbi_cap = cx18_g_sliced_vbi_cap; 824 .vidioc_g_chip_ident = cx18_g_chip_ident,
825 vdev->vidioc_g_chip_ident = cx18_g_chip_ident;
826#ifdef CONFIG_VIDEO_ADV_DEBUG 825#ifdef CONFIG_VIDEO_ADV_DEBUG
827 vdev->vidioc_g_register = cx18_g_register; 826 .vidioc_g_register = cx18_g_register,
828 vdev->vidioc_s_register = cx18_s_register; 827 .vidioc_s_register = cx18_s_register,
829#endif 828#endif
830 vdev->vidioc_default = cx18_default; 829 .vidioc_default = cx18_default,
831 vdev->vidioc_queryctrl = cx18_queryctrl; 830 .vidioc_queryctrl = cx18_queryctrl,
832 vdev->vidioc_querymenu = cx18_querymenu; 831 .vidioc_querymenu = cx18_querymenu,
833 vdev->vidioc_g_ext_ctrls = cx18_g_ext_ctrls; 832 .vidioc_g_ext_ctrls = cx18_g_ext_ctrls,
834 vdev->vidioc_s_ext_ctrls = cx18_s_ext_ctrls; 833 .vidioc_s_ext_ctrls = cx18_s_ext_ctrls,
835 vdev->vidioc_try_ext_ctrls = cx18_try_ext_ctrls; 834 .vidioc_try_ext_ctrls = cx18_try_ext_ctrls,
835};
836
837void cx18_set_funcs(struct video_device *vdev)
838{
839 vdev->ioctl_ops = &cx18_ioctl_ops;
836} 840}
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 1728b1d832a9..0da57f583bf7 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -187,14 +187,11 @@ static int cx18_prep_dev(struct cx18 *cx, int type)
187 return -ENOMEM; 187 return -ENOMEM;
188 } 188 }
189 189
190 s->v4l2dev->type =
191 VID_TYPE_CAPTURE | VID_TYPE_TUNER | VID_TYPE_TELETEXT |
192 VID_TYPE_CLIPPING | VID_TYPE_SCALES | VID_TYPE_MPEG_ENCODER;
193 snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "cx18-%d", 190 snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "cx18-%d",
194 cx->num); 191 cx->num);
195 192
196 s->v4l2dev->minor = minor; 193 s->v4l2dev->minor = minor;
197 s->v4l2dev->dev = &cx->dev->dev; 194 s->v4l2dev->parent = &cx->dev->dev;
198 s->v4l2dev->fops = cx18_stream_info[type].fops; 195 s->v4l2dev->fops = cx18_stream_info[type].fops;
199 s->v4l2dev->release = video_device_release; 196 s->v4l2dev->release = video_device_release;
200 s->v4l2dev->tvnorms = V4L2_STD_ALL; 197 s->v4l2dev->tvnorms = V4L2_STD_ALL;
diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig
index 5cfb46bbdaa9..e60bd31b51a3 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -1,9 +1,7 @@
1config VIDEO_CX23885 1config VIDEO_CX23885
2 tristate "Conexant cx23885 (2388x successor) support" 2 tristate "Conexant cx23885 (2388x successor) support"
3 depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT 3 depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT
4 depends on HOTPLUG # due to FW_LOADER
5 select I2C_ALGOBIT 4 select I2C_ALGOBIT
6 select FW_LOADER
7 select VIDEO_BTCX 5 select VIDEO_BTCX
8 select VIDEO_TUNER 6 select VIDEO_TUNER
9 select VIDEO_TVEEPROM 7 select VIDEO_TVEEPROM
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c
index e7ef093265af..8118091568fc 100644
--- a/drivers/media/video/cx23885/cx23885-417.c
+++ b/drivers/media/video/cx23885/cx23885-417.c
@@ -32,6 +32,7 @@
32#include <linux/device.h> 32#include <linux/device.h>
33#include <linux/firmware.h> 33#include <linux/firmware.h>
34#include <media/v4l2-common.h> 34#include <media/v4l2-common.h>
35#include <media/v4l2-ioctl.h>
35#include <media/cx2341x.h> 36#include <media/cx2341x.h>
36 37
37#include "cx23885.h" 38#include "cx23885.h"
@@ -1699,14 +1700,7 @@ static struct file_operations mpeg_fops = {
1699 .llseek = no_llseek, 1700 .llseek = no_llseek,
1700}; 1701};
1701 1702
1702static struct video_device cx23885_mpeg_template = { 1703static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
1703 .name = "cx23885",
1704 .type = VID_TYPE_CAPTURE |
1705 VID_TYPE_TUNER |
1706 VID_TYPE_SCALES |
1707 VID_TYPE_MPEG_ENCODER,
1708 .fops = &mpeg_fops,
1709 .minor = -1,
1710 .vidioc_s_std = vidioc_s_std, 1704 .vidioc_s_std = vidioc_s_std,
1711 .vidioc_enum_input = vidioc_enum_input, 1705 .vidioc_enum_input = vidioc_enum_input,
1712 .vidioc_g_input = vidioc_g_input, 1706 .vidioc_g_input = vidioc_g_input,
@@ -1735,6 +1729,13 @@ static struct video_device cx23885_mpeg_template = {
1735 .vidioc_queryctrl = vidioc_queryctrl, 1729 .vidioc_queryctrl = vidioc_queryctrl,
1736}; 1730};
1737 1731
1732static struct video_device cx23885_mpeg_template = {
1733 .name = "cx23885",
1734 .fops = &mpeg_fops,
1735 .ioctl_ops = &mpeg_ioctl_ops,
1736 .minor = -1,
1737};
1738
1738void cx23885_417_unregister(struct cx23885_dev *dev) 1739void cx23885_417_unregister(struct cx23885_dev *dev)
1739{ 1740{
1740 dprintk(1, "%s()\n", __func__); 1741 dprintk(1, "%s()\n", __func__);
@@ -1766,7 +1767,7 @@ static struct video_device *cx23885_video_dev_alloc(
1766 vfd->minor = -1; 1767 vfd->minor = -1;
1767 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name, 1768 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name,
1768 type, cx23885_boards[tsport->dev->board].name); 1769 type, cx23885_boards[tsport->dev->board].name);
1769 vfd->dev = &pci->dev; 1770 vfd->parent = &pci->dev;
1770 vfd->release = video_device_release; 1771 vfd->release = video_device_release;
1771 return vfd; 1772 return vfd;
1772} 1773}
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c
index fd7112c11d35..a19de850955d 100644
--- a/drivers/media/video/cx23885/cx23885-cards.c
+++ b/drivers/media/video/cx23885/cx23885-cards.c
@@ -145,6 +145,7 @@ struct cx23885_board cx23885_boards[] = {
145 }, 145 },
146 [CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP] = { 146 [CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP] = {
147 .name = "DViCO FusionHDTV7 Dual Express", 147 .name = "DViCO FusionHDTV7 Dual Express",
148 .portb = CX23885_MPEG_DVB,
148 .portc = CX23885_MPEG_DVB, 149 .portc = CX23885_MPEG_DVB,
149 }, 150 },
150}; 151};
@@ -325,25 +326,41 @@ int cx23885_tuner_callback(void *priv, int command, int arg)
325{ 326{
326 struct cx23885_i2c *bus = priv; 327 struct cx23885_i2c *bus = priv;
327 struct cx23885_dev *dev = bus->dev; 328 struct cx23885_dev *dev = bus->dev;
329 u32 bitmask = 0;
330
331 if (command != 0) {
332 printk(KERN_ERR "%s(): Unknown command 0x%x.\n",
333 __func__, command);
334 return -EINVAL;
335 }
328 336
329 switch(dev->board) { 337 switch(dev->board) {
330 case CX23885_BOARD_HAUPPAUGE_HVR1500Q: 338 case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
331 if(command == 0) { /* Tuner Reset Command from xc5000 */ 339 /* Tuner Reset Command from xc5000 */
332 /* Drive the tuner into reset and out */ 340 if (command == 0)
333 cx_clear(GP0_IO, 0x00000004); 341 bitmask = 0x04;
334 mdelay(200); 342 break;
335 cx_set(GP0_IO, 0x00000004); 343 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
336 return 0; 344 if (command == 0) {
337 } 345
338 else { 346 /* Two identical tuners on two different i2c buses,
339 printk(KERN_ERR 347 * we need to reset the correct gpio. */
340 "%s(): Unknow command.\n", __func__); 348 if (bus->nr == 0)
341 return -EINVAL; 349 bitmask = 0x01;
350 else if (bus->nr == 1)
351 bitmask = 0x04;
342 } 352 }
343 break; 353 break;
344 } 354 }
345 355
346 return 0; /* Should never be here */ 356 if (bitmask) {
357 /* Drive the tuner into reset and back out */
358 cx_clear(GP0_IO, bitmask);
359 mdelay(200);
360 cx_set(GP0_IO, bitmask);
361 }
362
363 return 0;
347} 364}
348 365
349void cx23885_gpio_setup(struct cx23885_dev *dev) 366void cx23885_gpio_setup(struct cx23885_dev *dev)
@@ -435,6 +452,19 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
435 mdelay(20); 452 mdelay(20);
436 cx_set(GP0_IO, 0x00050005); 453 cx_set(GP0_IO, 0x00050005);
437 break; 454 break;
455 case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP:
456 /* GPIO-0 xc5000 tuner reset i2c bus 0 */
457 /* GPIO-1 s5h1409 demod reset i2c bus 0 */
458 /* GPIO-2 xc5000 tuner reset i2c bus 1 */
459 /* GPIO-3 s5h1409 demod reset i2c bus 0 */
460
461 /* Put the parts into reset and back */
462 cx_set(GP0_IO, 0x000f0000);
463 mdelay(20);
464 cx_clear(GP0_IO, 0x0000000f);
465 mdelay(20);
466 cx_set(GP0_IO, 0x000f000f);
467 break;
438 } 468 }
439} 469}
440 470
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index d17343ea0d33..6286a9cf957e 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -76,6 +76,117 @@ LIST_HEAD(cx23885_devlist);
76 * 0x00010ea0 0x00010xxx Free 76 * 0x00010ea0 0x00010xxx Free
77 */ 77 */
78 78
79static struct sram_channel cx23885_sram_channels[] = {
80 [SRAM_CH01] = {
81 .name = "VID A",
82 .cmds_start = 0x10000,
83 .ctrl_start = 0x10380,
84 .cdt = 0x104c0,
85 .fifo_start = 0x40,
86 .fifo_size = 0x2800,
87 .ptr1_reg = DMA1_PTR1,
88 .ptr2_reg = DMA1_PTR2,
89 .cnt1_reg = DMA1_CNT1,
90 .cnt2_reg = DMA1_CNT2,
91 },
92 [SRAM_CH02] = {
93 .name = "ch2",
94 .cmds_start = 0x0,
95 .ctrl_start = 0x0,
96 .cdt = 0x0,
97 .fifo_start = 0x0,
98 .fifo_size = 0x0,
99 .ptr1_reg = DMA2_PTR1,
100 .ptr2_reg = DMA2_PTR2,
101 .cnt1_reg = DMA2_CNT1,
102 .cnt2_reg = DMA2_CNT2,
103 },
104 [SRAM_CH03] = {
105 .name = "TS1 B",
106 .cmds_start = 0x100A0,
107 .ctrl_start = 0x10400,
108 .cdt = 0x10580,
109 .fifo_start = 0x5000,
110 .fifo_size = 0x1000,
111 .ptr1_reg = DMA3_PTR1,
112 .ptr2_reg = DMA3_PTR2,
113 .cnt1_reg = DMA3_CNT1,
114 .cnt2_reg = DMA3_CNT2,
115 },
116 [SRAM_CH04] = {
117 .name = "ch4",
118 .cmds_start = 0x0,
119 .ctrl_start = 0x0,
120 .cdt = 0x0,
121 .fifo_start = 0x0,
122 .fifo_size = 0x0,
123 .ptr1_reg = DMA4_PTR1,
124 .ptr2_reg = DMA4_PTR2,
125 .cnt1_reg = DMA4_CNT1,
126 .cnt2_reg = DMA4_CNT2,
127 },
128 [SRAM_CH05] = {
129 .name = "ch5",
130 .cmds_start = 0x0,
131 .ctrl_start = 0x0,
132 .cdt = 0x0,
133 .fifo_start = 0x0,
134 .fifo_size = 0x0,
135 .ptr1_reg = DMA5_PTR1,
136 .ptr2_reg = DMA5_PTR2,
137 .cnt1_reg = DMA5_CNT1,
138 .cnt2_reg = DMA5_CNT2,
139 },
140 [SRAM_CH06] = {
141 .name = "TS2 C",
142 .cmds_start = 0x10140,
143 .ctrl_start = 0x10440,
144 .cdt = 0x105e0,
145 .fifo_start = 0x6000,
146 .fifo_size = 0x1000,
147 .ptr1_reg = DMA5_PTR1,
148 .ptr2_reg = DMA5_PTR2,
149 .cnt1_reg = DMA5_CNT1,
150 .cnt2_reg = DMA5_CNT2,
151 },
152 [SRAM_CH07] = {
153 .name = "ch7",
154 .cmds_start = 0x0,
155 .ctrl_start = 0x0,
156 .cdt = 0x0,
157 .fifo_start = 0x0,
158 .fifo_size = 0x0,
159 .ptr1_reg = DMA6_PTR1,
160 .ptr2_reg = DMA6_PTR2,
161 .cnt1_reg = DMA6_CNT1,
162 .cnt2_reg = DMA6_CNT2,
163 },
164 [SRAM_CH08] = {
165 .name = "ch8",
166 .cmds_start = 0x0,
167 .ctrl_start = 0x0,
168 .cdt = 0x0,
169 .fifo_start = 0x0,
170 .fifo_size = 0x0,
171 .ptr1_reg = DMA7_PTR1,
172 .ptr2_reg = DMA7_PTR2,
173 .cnt1_reg = DMA7_CNT1,
174 .cnt2_reg = DMA7_CNT2,
175 },
176 [SRAM_CH09] = {
177 .name = "ch9",
178 .cmds_start = 0x0,
179 .ctrl_start = 0x0,
180 .cdt = 0x0,
181 .fifo_start = 0x0,
182 .fifo_size = 0x0,
183 .ptr1_reg = DMA8_PTR1,
184 .ptr2_reg = DMA8_PTR2,
185 .cnt1_reg = DMA8_CNT1,
186 .cnt2_reg = DMA8_CNT2,
187 },
188};
189
79static struct sram_channel cx23887_sram_channels[] = { 190static struct sram_channel cx23887_sram_channels[] = {
80 [SRAM_CH01] = { 191 [SRAM_CH01] = {
81 .name = "VID A", 192 .name = "VID A",
@@ -104,8 +215,8 @@ static struct sram_channel cx23887_sram_channels[] = {
104 [SRAM_CH03] = { 215 [SRAM_CH03] = {
105 .name = "TS1 B", 216 .name = "TS1 B",
106 .cmds_start = 0x100A0, 217 .cmds_start = 0x100A0,
107 .ctrl_start = 0x10780, 218 .ctrl_start = 0x10630,
108 .cdt = 0x10400, 219 .cdt = 0x10870,
109 .fifo_start = 0x5000, 220 .fifo_start = 0x5000,
110 .fifo_size = 0x1000, 221 .fifo_size = 0x1000,
111 .ptr1_reg = DMA3_PTR1, 222 .ptr1_reg = DMA3_PTR1,
@@ -140,7 +251,7 @@ static struct sram_channel cx23887_sram_channels[] = {
140 [SRAM_CH06] = { 251 [SRAM_CH06] = {
141 .name = "TS2 C", 252 .name = "TS2 C",
142 .cmds_start = 0x10140, 253 .cmds_start = 0x10140,
143 .ctrl_start = 0x10680, 254 .ctrl_start = 0x10670,
144 .cdt = 0x108d0, 255 .cdt = 0x108d0,
145 .fifo_start = 0x6000, 256 .fifo_start = 0x6000,
146 .fifo_size = 0x1000, 257 .fifo_size = 0x1000,
@@ -460,6 +571,7 @@ static void cx23885_reset(struct cx23885_dev *dev)
460 cx_write(AUDIO_INT_INT_STAT, 0xffffffff); 571 cx_write(AUDIO_INT_INT_STAT, 0xffffffff);
461 cx_write(AUDIO_EXT_INT_STAT, 0xffffffff); 572 cx_write(AUDIO_EXT_INT_STAT, 0xffffffff);
462 cx_write(CLK_DELAY, cx_read(CLK_DELAY) & 0x80000000); 573 cx_write(CLK_DELAY, cx_read(CLK_DELAY) & 0x80000000);
574 cx_write(PAD_CTRL, 0x00500300);
463 575
464 mdelay(100); 576 mdelay(100);
465 577
@@ -625,7 +737,6 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
625 atomic_inc(&dev->refcount); 737 atomic_inc(&dev->refcount);
626 738
627 dev->nr = cx23885_devcount++; 739 dev->nr = cx23885_devcount++;
628 dev->sram_channels = cx23887_sram_channels;
629 sprintf(dev->name, "cx23885[%d]", dev->nr); 740 sprintf(dev->name, "cx23885[%d]", dev->nr);
630 741
631 mutex_lock(&devlist); 742 mutex_lock(&devlist);
@@ -637,11 +748,13 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
637 dev->bridge = CX23885_BRIDGE_887; 748 dev->bridge = CX23885_BRIDGE_887;
638 /* Apply a sensible clock frequency for the PCIe bridge */ 749 /* Apply a sensible clock frequency for the PCIe bridge */
639 dev->clk_freq = 25000000; 750 dev->clk_freq = 25000000;
751 dev->sram_channels = cx23887_sram_channels;
640 } else 752 } else
641 if(dev->pci->device == 0x8852) { 753 if(dev->pci->device == 0x8852) {
642 dev->bridge = CX23885_BRIDGE_885; 754 dev->bridge = CX23885_BRIDGE_885;
643 /* Apply a sensible clock frequency for the PCIe bridge */ 755 /* Apply a sensible clock frequency for the PCIe bridge */
644 dev->clk_freq = 28000000; 756 dev->clk_freq = 28000000;
757 dev->sram_channels = cx23885_sram_channels;
645 } else 758 } else
646 BUG(); 759 BUG();
647 760
@@ -1010,8 +1123,9 @@ static void cx23885_tsport_reg_dump(struct cx23885_tsport *port)
1010 port->reg_gpcnt_ctl, cx_read(port->reg_gpcnt_ctl)); 1123 port->reg_gpcnt_ctl, cx_read(port->reg_gpcnt_ctl));
1011 dprintk(1, "%s() dma_ctl(0x%08X) 0x%08x\n", __func__, 1124 dprintk(1, "%s() dma_ctl(0x%08X) 0x%08x\n", __func__,
1012 port->reg_dma_ctl, cx_read(port->reg_dma_ctl)); 1125 port->reg_dma_ctl, cx_read(port->reg_dma_ctl));
1013 dprintk(1, "%s() src_sel(0x%08X) 0x%08x\n", __func__, 1126 if (port->reg_src_sel)
1014 port->reg_src_sel, cx_read(port->reg_src_sel)); 1127 dprintk(1, "%s() src_sel(0x%08X) 0x%08x\n", __func__,
1128 port->reg_src_sel, cx_read(port->reg_src_sel));
1015 dprintk(1, "%s() lngth(0x%08X) 0x%08x\n", __func__, 1129 dprintk(1, "%s() lngth(0x%08X) 0x%08x\n", __func__,
1016 port->reg_lngth, cx_read(port->reg_lngth)); 1130 port->reg_lngth, cx_read(port->reg_lngth));
1017 dprintk(1, "%s() hw_sop_ctrl(0x%08X) 0x%08x\n", __func__, 1131 dprintk(1, "%s() hw_sop_ctrl(0x%08X) 0x%08x\n", __func__,
@@ -1042,6 +1156,9 @@ static int cx23885_start_dma(struct cx23885_tsport *port,
1042 dprintk(1, "%s() w: %d, h: %d, f: %d\n", __func__, 1156 dprintk(1, "%s() w: %d, h: %d, f: %d\n", __func__,
1043 buf->vb.width, buf->vb.height, buf->vb.field); 1157 buf->vb.width, buf->vb.height, buf->vb.field);
1044 1158
1159 /* Stop the fifo and risc engine for this port */
1160 cx_clear(port->reg_dma_ctl, port->dma_ctl_val);
1161
1045 /* setup fifo + format */ 1162 /* setup fifo + format */
1046 cx23885_sram_channel_setup(dev, 1163 cx23885_sram_channel_setup(dev,
1047 &dev->sram_channels[ port->sram_chno ], 1164 &dev->sram_channels[ port->sram_chno ],
@@ -1083,7 +1200,21 @@ static int cx23885_start_dma(struct cx23885_tsport *port,
1083 cx_write(port->reg_gpcnt_ctl, 3); 1200 cx_write(port->reg_gpcnt_ctl, 3);
1084 q->count = 1; 1201 q->count = 1;
1085 1202
1086 if (cx23885_boards[dev->board].portb & CX23885_MPEG_ENCODER) { 1203 /* Set VIDB pins to input */
1204 if (cx23885_boards[dev->board].portb == CX23885_MPEG_DVB) {
1205 reg = cx_read(PAD_CTRL);
1206 reg &= ~0x3; /* Clear TS1_OE & TS1_SOP_OE */
1207 cx_write(PAD_CTRL, reg);
1208 }
1209
1210 /* Set VIDC pins to input */
1211 if (cx23885_boards[dev->board].portc == CX23885_MPEG_DVB) {
1212 reg = cx_read(PAD_CTRL);
1213 reg &= ~0x4; /* Clear TS2_SOP_OE */
1214 cx_write(PAD_CTRL, reg);
1215 }
1216
1217 if (cx23885_boards[dev->board].portb == CX23885_MPEG_ENCODER) {
1087 1218
1088 reg = cx_read(PAD_CTRL); 1219 reg = cx_read(PAD_CTRL);
1089 reg = reg & ~0x1; /* Clear TS1_OE */ 1220 reg = reg & ~0x1; /* Clear TS1_OE */
@@ -1133,7 +1264,7 @@ static int cx23885_stop_dma(struct cx23885_tsport *port)
1133 cx_clear(port->reg_ts_int_msk, port->ts_int_msk_val); 1264 cx_clear(port->reg_ts_int_msk, port->ts_int_msk_val);
1134 cx_clear(port->reg_dma_ctl, port->dma_ctl_val); 1265 cx_clear(port->reg_dma_ctl, port->dma_ctl_val);
1135 1266
1136 if (cx23885_boards[dev->board].portb & CX23885_MPEG_ENCODER) { 1267 if (cx23885_boards[dev->board].portb == CX23885_MPEG_ENCODER) {
1137 1268
1138 reg = cx_read(PAD_CTRL); 1269 reg = cx_read(PAD_CTRL);
1139 1270
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c
index 043fc4e5c586..ad2235dab5b1 100644
--- a/drivers/media/video/cx23885/cx23885-video.c
+++ b/drivers/media/video/cx23885/cx23885-video.c
@@ -33,6 +33,7 @@
33 33
34#include "cx23885.h" 34#include "cx23885.h"
35#include <media/v4l2-common.h> 35#include <media/v4l2-common.h>
36#include <media/v4l2-ioctl.h>
36 37
37#ifdef CONFIG_VIDEO_V4L1_COMPAT 38#ifdef CONFIG_VIDEO_V4L1_COMPAT
38/* Include V4L1 specific functions. Should be removed soon */ 39/* Include V4L1 specific functions. Should be removed soon */
@@ -326,7 +327,7 @@ struct video_device *cx23885_vdev_init(struct cx23885_dev *dev,
326 return NULL; 327 return NULL;
327 *vfd = *template; 328 *vfd = *template;
328 vfd->minor = -1; 329 vfd->minor = -1;
329 vfd->dev = &pci->dev; 330 vfd->parent = &pci->dev;
330 vfd->release = video_device_release; 331 vfd->release = video_device_release;
331 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", 332 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
332 dev->name, type, cx23885_boards[dev->board].name); 333 dev->name, type, cx23885_boards[dev->board].name);
@@ -1433,12 +1434,7 @@ static const struct file_operations video_fops = {
1433 .llseek = no_llseek, 1434 .llseek = no_llseek,
1434}; 1435};
1435 1436
1436static struct video_device cx23885_vbi_template; 1437static const struct v4l2_ioctl_ops video_ioctl_ops = {
1437static struct video_device cx23885_video_template = {
1438 .name = "cx23885-video",
1439 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES,
1440 .fops = &video_fops,
1441 .minor = -1,
1442 .vidioc_querycap = vidioc_querycap, 1438 .vidioc_querycap = vidioc_querycap,
1443 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1439 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1444 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1440 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1471,6 +1467,14 @@ static struct video_device cx23885_video_template = {
1471 .vidioc_g_register = vidioc_g_register, 1467 .vidioc_g_register = vidioc_g_register,
1472 .vidioc_s_register = vidioc_s_register, 1468 .vidioc_s_register = vidioc_s_register,
1473#endif 1469#endif
1470};
1471
1472static struct video_device cx23885_vbi_template;
1473static struct video_device cx23885_video_template = {
1474 .name = "cx23885-video",
1475 .fops = &video_fops,
1476 .minor = -1,
1477 .ioctl_ops = &video_ioctl_ops,
1474 .tvnorms = CX23885_NORMS, 1478 .tvnorms = CX23885_NORMS,
1475 .current_norm = V4L2_STD_NTSC_M, 1479 .current_norm = V4L2_STD_NTSC_M,
1476}; 1480};
@@ -1512,7 +1516,6 @@ int cx23885_video_register(struct cx23885_dev *dev)
1512 memcpy(&cx23885_vbi_template, &cx23885_video_template, 1516 memcpy(&cx23885_vbi_template, &cx23885_video_template,
1513 sizeof(cx23885_vbi_template)); 1517 sizeof(cx23885_vbi_template));
1514 strcpy(cx23885_vbi_template.name, "cx23885-vbi"); 1518 strcpy(cx23885_vbi_template.name, "cx23885-vbi");
1515 cx23885_vbi_template.type = VID_TYPE_TELETEXT|VID_TYPE_TUNER;
1516 1519
1517 dev->tvnorm = cx23885_video_template.current_norm; 1520 dev->tvnorm = cx23885_video_template.current_norm;
1518 1521
diff --git a/drivers/media/video/cx25840/Kconfig b/drivers/media/video/cx25840/Kconfig
index 448f4cd0ce34..de515dadadc2 100644
--- a/drivers/media/video/cx25840/Kconfig
+++ b/drivers/media/video/cx25840/Kconfig
@@ -1,8 +1,6 @@
1config VIDEO_CX25840 1config VIDEO_CX25840
2 tristate "Conexant CX2584x audio/video decoders" 2 tristate "Conexant CX2584x audio/video decoders"
3 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL 3 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
4 depends on HOTPLUG # due to FW_LOADER
5 select FW_LOADER
6 ---help--- 4 ---help---
7 Support for the Conexant CX2584x audio/video decoders. 5 Support for the Conexant CX2584x audio/video decoders.
8 6
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index e7bf4f4c1319..209d3bcb5dbb 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -50,7 +50,7 @@ MODULE_LICENSE("GPL");
50 50
51static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; 51static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };
52 52
53int cx25840_debug; 53static int cx25840_debug;
54 54
55module_param_named(debug,cx25840_debug, int, 0644); 55module_param_named(debug,cx25840_debug, int, 0644);
56 56
diff --git a/drivers/media/video/cx25840/cx25840-core.h b/drivers/media/video/cx25840/cx25840-core.h
index 72916ba975a8..b87337e590b4 100644
--- a/drivers/media/video/cx25840/cx25840-core.h
+++ b/drivers/media/video/cx25840/cx25840-core.h
@@ -24,8 +24,6 @@
24#include <linux/videodev2.h> 24#include <linux/videodev2.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26 26
27extern int cx25840_debug;
28
29/* ENABLE_PVR150_WORKAROUND activates a workaround for a hardware bug that is 27/* ENABLE_PVR150_WORKAROUND activates a workaround for a hardware bug that is
30 present in Hauppauge PVR-150 (and possibly PVR-500) cards that have 28 present in Hauppauge PVR-150 (and possibly PVR-500) cards that have
31 certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The 29 certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index 10e20d8196dc..9dd7bdf659b9 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -33,9 +33,8 @@ config VIDEO_CX88_ALSA
33 33
34config VIDEO_CX88_BLACKBIRD 34config VIDEO_CX88_BLACKBIRD
35 tristate "Blackbird MPEG encoder support (cx2388x + cx23416)" 35 tristate "Blackbird MPEG encoder support (cx2388x + cx23416)"
36 depends on VIDEO_CX88 && HOTPLUG 36 depends on VIDEO_CX88
37 select VIDEO_CX2341X 37 select VIDEO_CX2341X
38 select FW_LOADER
39 ---help--- 38 ---help---
40 This adds support for MPEG encoder cards based on the 39 This adds support for MPEG encoder cards based on the
41 Blackbird reference design, using the Conexant 2388x 40 Blackbird reference design, using the Conexant 2388x
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index bfdca5847764..9a1374a38ec7 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -33,6 +33,7 @@
33#include <linux/device.h> 33#include <linux/device.h>
34#include <linux/firmware.h> 34#include <linux/firmware.h>
35#include <media/v4l2-common.h> 35#include <media/v4l2-common.h>
36#include <media/v4l2-ioctl.h>
36#include <media/cx2341x.h> 37#include <media/cx2341x.h>
37 38
38#include "cx88.h" 39#include "cx88.h"
@@ -1174,12 +1175,7 @@ static const struct file_operations mpeg_fops =
1174 .llseek = no_llseek, 1175 .llseek = no_llseek,
1175}; 1176};
1176 1177
1177static struct video_device cx8802_mpeg_template = 1178static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
1178{
1179 .name = "cx8802",
1180 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES|VID_TYPE_MPEG_ENCODER,
1181 .fops = &mpeg_fops,
1182 .minor = -1,
1183 .vidioc_querymenu = vidioc_querymenu, 1179 .vidioc_querymenu = vidioc_querymenu,
1184 .vidioc_querycap = vidioc_querycap, 1180 .vidioc_querycap = vidioc_querycap,
1185 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1181 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
@@ -1207,6 +1203,13 @@ static struct video_device cx8802_mpeg_template =
1207 .vidioc_g_tuner = vidioc_g_tuner, 1203 .vidioc_g_tuner = vidioc_g_tuner,
1208 .vidioc_s_tuner = vidioc_s_tuner, 1204 .vidioc_s_tuner = vidioc_s_tuner,
1209 .vidioc_s_std = vidioc_s_std, 1205 .vidioc_s_std = vidioc_s_std,
1206};
1207
1208static struct video_device cx8802_mpeg_template = {
1209 .name = "cx8802",
1210 .fops = &mpeg_fops,
1211 .ioctl_ops = &mpeg_ioctl_ops,
1212 .minor = -1,
1210 .tvnorms = CX88_NORMS, 1213 .tvnorms = CX88_NORMS,
1211 .current_norm = V4L2_STD_NTSC_M, 1214 .current_norm = V4L2_STD_NTSC_M,
1212}; 1215};
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index fa6d398e97b9..de199a206a15 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1348,7 +1348,7 @@ static const struct cx88_board cx88_boards[] = {
1348 .tuner_addr = ADDR_UNSET, 1348 .tuner_addr = ADDR_UNSET,
1349 .radio_addr = ADDR_UNSET, 1349 .radio_addr = ADDR_UNSET,
1350 .tda9887_conf = TDA9887_PRESENT, 1350 .tda9887_conf = TDA9887_PRESENT,
1351 .audio_chip = AUDIO_CHIP_WM8775, 1351 .audio_chip = V4L2_IDENT_WM8775,
1352 .input = {{ 1352 .input = {{
1353 .type = CX88_VMUX_TELEVISION, 1353 .type = CX88_VMUX_TELEVISION,
1354 .vmux = 0, 1354 .vmux = 0,
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 60eeda3057e9..d656fec59010 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -40,6 +40,7 @@
40 40
41#include "cx88.h" 41#include "cx88.h"
42#include <media/v4l2-common.h> 42#include <media/v4l2-common.h>
43#include <media/v4l2-ioctl.h>
43 44
44MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); 45MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
45MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 46MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -1006,7 +1007,7 @@ struct video_device *cx88_vdev_init(struct cx88_core *core,
1006 return NULL; 1007 return NULL;
1007 *vfd = *template; 1008 *vfd = *template;
1008 vfd->minor = -1; 1009 vfd->minor = -1;
1009 vfd->dev = &pci->dev; 1010 vfd->parent = &pci->dev;
1010 vfd->release = video_device_release; 1011 vfd->release = video_device_release;
1011 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", 1012 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
1012 core->name, type, core->board.name); 1013 core->name, type, core->board.name);
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 0fed5cd2ccea..ef4d56ea0027 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -39,6 +39,7 @@
39 39
40#include "cx88.h" 40#include "cx88.h"
41#include <media/v4l2-common.h> 41#include <media/v4l2-common.h>
42#include <media/v4l2-ioctl.h>
42 43
43#ifdef CONFIG_VIDEO_V4L1_COMPAT 44#ifdef CONFIG_VIDEO_V4L1_COMPAT
44/* Include V4L1 specific functions. Should be removed soon */ 45/* Include V4L1 specific functions. Should be removed soon */
@@ -447,7 +448,7 @@ int cx88_video_mux(struct cx88_core *core, unsigned int input)
447 the initialization. Some boards may use different 448 the initialization. Some boards may use different
448 routes for different inputs. HVR-1300 surely does */ 449 routes for different inputs. HVR-1300 surely does */
449 if (core->board.audio_chip && 450 if (core->board.audio_chip &&
450 core->board.audio_chip == AUDIO_CHIP_WM8775) { 451 core->board.audio_chip == V4L2_IDENT_WM8775) {
451 struct v4l2_routing route; 452 struct v4l2_routing route;
452 453
453 route.input = INPUT(input).audioroute; 454 route.input = INPUT(input).audioroute;
@@ -1682,13 +1683,7 @@ static const struct file_operations video_fops =
1682 .llseek = no_llseek, 1683 .llseek = no_llseek,
1683}; 1684};
1684 1685
1685static struct video_device cx8800_vbi_template; 1686static const struct v4l2_ioctl_ops video_ioctl_ops = {
1686static struct video_device cx8800_video_template =
1687{
1688 .name = "cx8800-video",
1689 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES,
1690 .fops = &video_fops,
1691 .minor = -1,
1692 .vidioc_querycap = vidioc_querycap, 1687 .vidioc_querycap = vidioc_querycap,
1693 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1688 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1694 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1689 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1721,6 +1716,15 @@ static struct video_device cx8800_video_template =
1721 .vidioc_g_register = vidioc_g_register, 1716 .vidioc_g_register = vidioc_g_register,
1722 .vidioc_s_register = vidioc_s_register, 1717 .vidioc_s_register = vidioc_s_register,
1723#endif 1718#endif
1719};
1720
1721static struct video_device cx8800_vbi_template;
1722
1723static struct video_device cx8800_video_template = {
1724 .name = "cx8800-video",
1725 .fops = &video_fops,
1726 .minor = -1,
1727 .ioctl_ops = &video_ioctl_ops,
1724 .tvnorms = CX88_NORMS, 1728 .tvnorms = CX88_NORMS,
1725 .current_norm = V4L2_STD_NTSC_M, 1729 .current_norm = V4L2_STD_NTSC_M,
1726}; 1730};
@@ -1735,12 +1739,7 @@ static const struct file_operations radio_fops =
1735 .llseek = no_llseek, 1739 .llseek = no_llseek,
1736}; 1740};
1737 1741
1738static struct video_device cx8800_radio_template = 1742static const struct v4l2_ioctl_ops radio_ioctl_ops = {
1739{
1740 .name = "cx8800-radio",
1741 .type = VID_TYPE_TUNER,
1742 .fops = &radio_fops,
1743 .minor = -1,
1744 .vidioc_querycap = radio_querycap, 1743 .vidioc_querycap = radio_querycap,
1745 .vidioc_g_tuner = radio_g_tuner, 1744 .vidioc_g_tuner = radio_g_tuner,
1746 .vidioc_enum_input = radio_enum_input, 1745 .vidioc_enum_input = radio_enum_input,
@@ -1759,6 +1758,13 @@ static struct video_device cx8800_radio_template =
1759#endif 1758#endif
1760}; 1759};
1761 1760
1761static struct video_device cx8800_radio_template = {
1762 .name = "cx8800-radio",
1763 .fops = &radio_fops,
1764 .minor = -1,
1765 .ioctl_ops = &radio_ioctl_ops,
1766};
1767
1762/* ----------------------------------------------------------- */ 1768/* ----------------------------------------------------------- */
1763 1769
1764static void cx8800_unregister_video(struct cx8800_dev *dev) 1770static void cx8800_unregister_video(struct cx8800_dev *dev)
@@ -1830,7 +1836,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1830 memcpy( &cx8800_vbi_template, &cx8800_video_template, 1836 memcpy( &cx8800_vbi_template, &cx8800_video_template,
1831 sizeof(cx8800_vbi_template) ); 1837 sizeof(cx8800_vbi_template) );
1832 strcpy(cx8800_vbi_template.name,"cx8800-vbi"); 1838 strcpy(cx8800_vbi_template.name,"cx8800-vbi");
1833 cx8800_vbi_template.type = VID_TYPE_TELETEXT|VID_TYPE_TUNER;
1834 1839
1835 /* initialize driver struct */ 1840 /* initialize driver struct */
1836 spin_lock_init(&dev->slock); 1841 spin_lock_init(&dev->slock);
@@ -1866,7 +1871,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1866 1871
1867 /* load and configure helper modules */ 1872 /* load and configure helper modules */
1868 1873
1869 if (core->board.audio_chip == AUDIO_CHIP_WM8775) 1874 if (core->board.audio_chip == V4L2_IDENT_WM8775)
1870 request_module("wm8775"); 1875 request_module("wm8775");
1871 1876
1872 switch (core->boardnr) { 1877 switch (core->boardnr) {
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 14ac173f4071..54fe65094711 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -29,8 +29,8 @@
29#include <media/tuner.h> 29#include <media/tuner.h>
30#include <media/tveeprom.h> 30#include <media/tveeprom.h>
31#include <media/videobuf-dma-sg.h> 31#include <media/videobuf-dma-sg.h>
32#include <media/v4l2-chip-ident.h>
32#include <media/cx2341x.h> 33#include <media/cx2341x.h>
33#include <media/audiochip.h>
34#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE) 34#if defined(CONFIG_VIDEO_CX88_DVB) || defined(CONFIG_VIDEO_CX88_DVB_MODULE)
35#include <media/videobuf-dvb.h> 35#include <media/videobuf-dvb.h>
36#endif 36#endif
@@ -252,7 +252,7 @@ struct cx88_board {
252 struct cx88_input input[MAX_CX88_INPUT]; 252 struct cx88_input input[MAX_CX88_INPUT];
253 struct cx88_input radio; 253 struct cx88_input radio;
254 enum cx88_board_type mpeg; 254 enum cx88_board_type mpeg;
255 enum audiochip audio_chip; 255 unsigned int audio_chip;
256}; 256};
257 257
258struct cx88_subid { 258struct cx88_subid {
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 05f0d5a15058..476ae44a62d2 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -32,8 +32,8 @@
32#include <media/saa7115.h> 32#include <media/saa7115.h>
33#include <media/tvp5150.h> 33#include <media/tvp5150.h>
34#include <media/tveeprom.h> 34#include <media/tveeprom.h>
35#include <media/audiochip.h>
36#include <media/v4l2-common.h> 35#include <media/v4l2-common.h>
36#include <media/v4l2-chip-ident.h>
37 37
38#include "em28xx.h" 38#include "em28xx.h"
39 39
@@ -52,6 +52,15 @@ struct em28xx_hash_table {
52}; 52};
53 53
54struct em28xx_board em28xx_boards[] = { 54struct em28xx_board em28xx_boards[] = {
55 [EM2750_BOARD_UNKNOWN] = {
56 .name = "Unknown EM2750/EM2751 webcam grabber",
57 .vchannels = 1,
58 .input = { {
59 .type = EM28XX_VMUX_COMPOSITE1,
60 .vmux = 0,
61 .amux = 0,
62 } },
63 },
55 [EM2800_BOARD_UNKNOWN] = { 64 [EM2800_BOARD_UNKNOWN] = {
56 .name = "Unknown EM2800 video grabber", 65 .name = "Unknown EM2800 video grabber",
57 .is_em2800 = 1, 66 .is_em2800 = 1,
@@ -73,6 +82,39 @@ struct em28xx_board em28xx_boards[] = {
73 .is_em2800 = 0, 82 .is_em2800 = 0,
74 .tuner_type = TUNER_ABSENT, 83 .tuner_type = TUNER_ABSENT,
75 }, 84 },
85 [EM2750_BOARD_DLCW_130] = {
86 /* Beijing Huaqi Information Digital Technology Co., Ltd */
87 .name = "Huaqi DLCW-130",
88 .valid = EM28XX_BOARD_NOT_VALIDATED,
89 .vchannels = 1,
90 .input = { {
91 .type = EM28XX_VMUX_COMPOSITE1,
92 .vmux = 0,
93 .amux = 0,
94 } },
95 },
96 [EM2800_BOARD_KWORLD_USB2800] = {
97 .name = "Kworld USB2800",
98 .valid = EM28XX_BOARD_NOT_VALIDATED,
99 .is_em2800 = 1,
100 .vchannels = 3,
101 .tuner_type = TUNER_PHILIPS_FCV1236D,
102 .tda9887_conf = TDA9887_PRESENT,
103 .decoder = EM28XX_SAA7113,
104 .input = { {
105 .type = EM28XX_VMUX_TELEVISION,
106 .vmux = SAA7115_COMPOSITE2,
107 .amux = 0,
108 }, {
109 .type = EM28XX_VMUX_COMPOSITE1,
110 .vmux = SAA7115_COMPOSITE0,
111 .amux = 1,
112 }, {
113 .type = EM28XX_VMUX_SVIDEO,
114 .vmux = SAA7115_SVIDEO3,
115 .amux = 1,
116 } },
117 },
76 [EM2820_BOARD_KWORLD_PVRTV2800RF] = { 118 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
77 .name = "Kworld PVR TV 2800 RF", 119 .name = "Kworld PVR TV 2800 RF",
78 .is_em2800 = 0, 120 .is_em2800 = 0,
@@ -151,6 +193,376 @@ struct em28xx_board em28xx_boards[] = {
151 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART), 193 MSP_DSP_IN_SCART, MSP_DSP_IN_SCART),
152 } }, 194 } },
153 }, 195 },
196 [EM2820_BOARD_DLINK_USB_TV] = {
197 .name = "D-Link DUB-T210 TV Tuner",
198 .valid = EM28XX_BOARD_NOT_VALIDATED,
199 .vchannels = 3,
200 .is_em2800 = 0,
201 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
202 .tda9887_conf = TDA9887_PRESENT,
203 .decoder = EM28XX_SAA7113,
204 .input = { {
205 .type = EM28XX_VMUX_TELEVISION,
206 .vmux = SAA7115_COMPOSITE2,
207 .amux = 1,
208 }, {
209 .type = EM28XX_VMUX_COMPOSITE1,
210 .vmux = SAA7115_COMPOSITE0,
211 .amux = 1,
212 }, {
213 .type = EM28XX_VMUX_SVIDEO,
214 .vmux = SAA7115_SVIDEO3,
215 .amux = 1,
216 } },
217 },
218 [EM2820_BOARD_HERCULES_SMART_TV_USB2] = {
219 .name = "Hercules Smart TV USB 2.0",
220 .valid = EM28XX_BOARD_NOT_VALIDATED,
221 .vchannels = 3,
222 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
223 .tda9887_conf = TDA9887_PRESENT,
224 .decoder = EM28XX_SAA7113,
225 .input = { {
226 .type = EM28XX_VMUX_TELEVISION,
227 .vmux = SAA7115_COMPOSITE2,
228 .amux = 1,
229 }, {
230 .type = EM28XX_VMUX_COMPOSITE1,
231 .vmux = SAA7115_COMPOSITE0,
232 .amux = 1,
233 }, {
234 .type = EM28XX_VMUX_SVIDEO,
235 .vmux = SAA7115_SVIDEO3,
236 .amux = 1,
237 } },
238 },
239 [EM2820_BOARD_PINNACLE_USB_2_FM1216ME] = {
240 .name = "Pinnacle PCTV USB 2 (Philips FM1216ME)",
241 .valid = EM28XX_BOARD_NOT_VALIDATED,
242 .vchannels = 3,
243 .is_em2800 = 0,
244 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
245 .tda9887_conf = TDA9887_PRESENT,
246 .decoder = EM28XX_SAA7113,
247 .input = { {
248 .type = EM28XX_VMUX_TELEVISION,
249 .vmux = SAA7115_COMPOSITE2,
250 .amux = 0,
251 }, {
252 .type = EM28XX_VMUX_COMPOSITE1,
253 .vmux = SAA7115_COMPOSITE0,
254 .amux = 1,
255 }, {
256 .type = EM28XX_VMUX_SVIDEO,
257 .vmux = SAA7115_SVIDEO3,
258 .amux = 1,
259 } },
260 },
261 [EM2820_BOARD_GADMEI_UTV310] = {
262 .name = "Gadmei UTV310",
263 .valid = EM28XX_BOARD_NOT_VALIDATED,
264 .vchannels = 3,
265 .tuner_type = TUNER_TNF_5335MF,
266 .tda9887_conf = TDA9887_PRESENT,
267 .decoder = EM28XX_SAA7113,
268 .input = { {
269 .type = EM28XX_VMUX_TELEVISION,
270 .vmux = SAA7115_COMPOSITE1,
271 .amux = 1,
272 }, {
273 .type = EM28XX_VMUX_COMPOSITE1,
274 .vmux = SAA7115_COMPOSITE0,
275 .amux = 1,
276 }, {
277 .type = EM28XX_VMUX_SVIDEO,
278 .vmux = SAA7115_SVIDEO3,
279 .amux = 1,
280 } },
281 },
282 [EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE] = {
283 .name = "Leadtek Winfast USB II Deluxe",
284 .valid = EM28XX_BOARD_NOT_VALIDATED,
285 .vchannels = 3,
286 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
287 .tda9887_conf = TDA9887_PRESENT,
288 .decoder = EM28XX_SAA7114,
289 .input = { {
290 .type = EM28XX_VMUX_TELEVISION,
291 .vmux = 2,
292 .amux = 0,
293 }, {
294 .type = EM28XX_VMUX_COMPOSITE1,
295 .vmux = 0,
296 .amux = 1,
297 }, {
298 .type = EM28XX_VMUX_SVIDEO,
299 .vmux = 9,
300 .amux = 1,
301 } },
302 },
303 [EM2820_BOARD_PINNACLE_DVC_100] = {
304 .name = "Pinnacle Dazzle DVC 100",
305 .valid = EM28XX_BOARD_NOT_VALIDATED,
306 .vchannels = 3,
307 .decoder = EM28XX_SAA7113,
308 .input = { {
309 .type = EM28XX_VMUX_COMPOSITE1,
310 .vmux = SAA7115_COMPOSITE0,
311 .amux = 1,
312 }, {
313 .type = EM28XX_VMUX_SVIDEO,
314 .vmux = SAA7115_SVIDEO3,
315 .amux = 1,
316 } },
317 },
318 [EM2820_BOARD_VIDEOLOGY_20K14XUSB] = {
319 .name = "Videology 20K14XUSB USB2.0",
320 .valid = EM28XX_BOARD_NOT_VALIDATED,
321 .vchannels = 1,
322 .input = { {
323 .type = EM28XX_VMUX_COMPOSITE1,
324 .vmux = 0,
325 .amux = 0,
326 } },
327 },
328 [EM2821_BOARD_PROLINK_PLAYTV_USB2] = {
329 .name = "SIIG AVTuner-PVR/Prolink PlayTV USB 2.0",
330 .valid = EM28XX_BOARD_NOT_VALIDATED,
331 .vchannels = 3,
332 .is_em2800 = 0,
333 .tuner_type = TUNER_LG_PAL_NEW_TAPC, /* unknown? */
334 .tda9887_conf = TDA9887_PRESENT, /* unknown? */
335 .decoder = EM28XX_SAA7113,
336 .input = { {
337 .type = EM28XX_VMUX_TELEVISION,
338 .vmux = SAA7115_COMPOSITE2,
339 .amux = 1,
340 }, {
341 .type = EM28XX_VMUX_COMPOSITE1,
342 .vmux = SAA7115_COMPOSITE0,
343 .amux = 1,
344 }, {
345 .type = EM28XX_VMUX_SVIDEO,
346 .vmux = SAA7115_SVIDEO3,
347 .amux = 1,
348 } },
349 },
350 [EM2821_BOARD_SUPERCOMP_USB_2] = {
351 .name = "Supercomp USB 2.0 TV",
352 .valid = EM28XX_BOARD_NOT_VALIDATED,
353 .vchannels = 3,
354 .is_em2800 = 0,
355 .tuner_type = TUNER_PHILIPS_FM1236_MK3,
356 .tda9887_conf = TDA9887_PRESENT |
357 TDA9887_PORT1_ACTIVE |
358 TDA9887_PORT2_ACTIVE,
359 .decoder = EM28XX_SAA7113,
360 .input = { {
361 .type = EM28XX_VMUX_TELEVISION,
362 .vmux = SAA7115_COMPOSITE2,
363 .amux = 1,
364 }, {
365 .type = EM28XX_VMUX_COMPOSITE1,
366 .vmux = SAA7115_COMPOSITE0,
367 .amux = 0,
368 }, {
369 .type = EM28XX_VMUX_SVIDEO,
370 .vmux = SAA7115_SVIDEO3,
371 .amux = 1,
372 } },
373 },
374 [EM2821_BOARD_USBGEAR_VD204] = {
375 .name = "Usbgear VD204v9",
376 .valid = EM28XX_BOARD_NOT_VALIDATED,
377 .vchannels = 2,
378 .decoder = EM28XX_SAA7113,
379 .input = { {
380 .type = EM28XX_VMUX_COMPOSITE1,
381 .vmux = SAA7115_COMPOSITE0,
382 .amux = 1,
383 }, {
384 .type = EM28XX_VMUX_SVIDEO,
385 .vmux = SAA7115_SVIDEO3,
386 .amux = 1,
387 } },
388 },
389 [EM2860_BOARD_NETGMBH_CAM] = {
390 /* Beijing Huaqi Information Digital Technology Co., Ltd */
391 .name = "NetGMBH Cam",
392 .valid = EM28XX_BOARD_NOT_VALIDATED,
393 .vchannels = 1,
394 .input = { {
395 .type = EM28XX_VMUX_COMPOSITE1,
396 .vmux = 0,
397 .amux = 0,
398 } },
399 },
400 [EM2860_BOARD_TYPHOON_DVD_MAKER] = {
401 .name = "Typhoon DVD Maker",
402 .valid = EM28XX_BOARD_NOT_VALIDATED,
403 .vchannels = 2,
404 .decoder = EM28XX_SAA7113,
405 .input = { {
406 .type = EM28XX_VMUX_COMPOSITE1,
407 .vmux = SAA7115_COMPOSITE0,
408 .amux = 1,
409 }, {
410 .type = EM28XX_VMUX_SVIDEO,
411 .vmux = SAA7115_SVIDEO3,
412 .amux = 1,
413 } },
414 },
415 [EM2860_BOARD_GADMEI_UTV330] = {
416 .name = "Gadmei UTV330",
417 .valid = EM28XX_BOARD_NOT_VALIDATED,
418 .vchannels = 3,
419 .tuner_type = TUNER_TNF_5335MF,
420 .tda9887_conf = TDA9887_PRESENT,
421 .decoder = EM28XX_SAA7113,
422 .input = { {
423 .type = EM28XX_VMUX_TELEVISION,
424 .vmux = SAA7115_COMPOSITE2,
425 .amux = 0,
426 }, {
427 .type = EM28XX_VMUX_COMPOSITE1,
428 .vmux = SAA7115_COMPOSITE0,
429 .amux = 1,
430 }, {
431 .type = EM28XX_VMUX_SVIDEO,
432 .vmux = SAA7115_SVIDEO3,
433 .amux = 1,
434 } },
435 },
436 [EM2860_BOARD_TERRATEC_HYBRID_XS] = {
437 .name = "Terratec Cinergy A Hybrid XS",
438 .valid = EM28XX_BOARD_NOT_VALIDATED,
439 .vchannels = 3,
440 .tuner_type = TUNER_XC2028,
441 .decoder = EM28XX_TVP5150,
442 .input = { {
443 .type = EM28XX_VMUX_TELEVISION,
444 .vmux = TVP5150_COMPOSITE0,
445 .amux = 0,
446 }, {
447 .type = EM28XX_VMUX_COMPOSITE1,
448 .vmux = TVP5150_COMPOSITE1,
449 .amux = 1,
450 }, {
451 .type = EM28XX_VMUX_SVIDEO,
452 .vmux = TVP5150_SVIDEO,
453 .amux = 1,
454 } },
455 },
456 [EM2861_BOARD_KWORLD_PVRTV_300U] = {
457 .name = "KWorld PVRTV 300U",
458 .valid = EM28XX_BOARD_NOT_VALIDATED,
459 .vchannels = 3,
460 .tuner_type = TUNER_XC2028,
461 .decoder = EM28XX_TVP5150,
462 .input = { {
463 .type = EM28XX_VMUX_TELEVISION,
464 .vmux = TVP5150_COMPOSITE0,
465 .amux = 0,
466 }, {
467 .type = EM28XX_VMUX_COMPOSITE1,
468 .vmux = TVP5150_COMPOSITE1,
469 .amux = 1,
470 }, {
471 .type = EM28XX_VMUX_SVIDEO,
472 .vmux = TVP5150_SVIDEO,
473 .amux = 1,
474 } },
475 },
476 [EM2861_BOARD_YAKUMO_MOVIE_MIXER] = {
477 .name = "Yakumo MovieMixer",
478 .valid = EM28XX_BOARD_NOT_VALIDATED,
479 .vchannels = 1,
480 .decoder = EM28XX_TVP5150,
481 .input = { {
482 .type = EM28XX_VMUX_TELEVISION,
483 .vmux = TVP5150_COMPOSITE0,
484 .amux = 0,
485 }, {
486 .type = EM28XX_VMUX_COMPOSITE1,
487 .vmux = TVP5150_COMPOSITE1,
488 .amux = 1,
489 }, {
490 .type = EM28XX_VMUX_SVIDEO,
491 .vmux = TVP5150_SVIDEO,
492 .amux = 1,
493 } },
494 },
495 [EM2861_BOARD_PLEXTOR_PX_TV100U] = {
496 .name = "Plextor ConvertX PX-TV100U",
497 .valid = EM28XX_BOARD_NOT_VALIDATED,
498 .vchannels = 3,
499 .tuner_type = TUNER_TNF_5335MF,
500 .tda9887_conf = TDA9887_PRESENT,
501 .decoder = EM28XX_TVP5150,
502 .input = { {
503 .type = EM28XX_VMUX_TELEVISION,
504 .vmux = TVP5150_COMPOSITE0,
505 .amux = 1,
506 }, {
507 .type = EM28XX_VMUX_COMPOSITE1,
508 .vmux = TVP5150_COMPOSITE1,
509 .amux = 1,
510 }, {
511 .type = EM28XX_VMUX_SVIDEO,
512 .vmux = TVP5150_SVIDEO,
513 .amux = 1,
514 } },
515 },
516 [EM2870_BOARD_TERRATEC_XS] = {
517 .name = "Terratec Cinergy T XS",
518 .valid = EM28XX_BOARD_NOT_VALIDATED,
519 .tuner_type = TUNER_XC2028,
520 },
521 [EM2870_BOARD_TERRATEC_XS_MT2060] = {
522 .name = "Terratec Cinergy T XS (MT2060)",
523 .valid = EM28XX_BOARD_NOT_VALIDATED,
524 .tuner_type = TUNER_ABSENT, /* MT2060 */
525 },
526 [EM2870_BOARD_KWORLD_350U] = {
527 .name = "Kworld 350 U DVB-T",
528 .valid = EM28XX_BOARD_NOT_VALIDATED,
529 .tuner_type = TUNER_XC2028,
530 },
531 [EM2870_BOARD_KWORLD_355U] = {
532 .name = "Kworld 355 U DVB-T",
533 .valid = EM28XX_BOARD_NOT_VALIDATED,
534 },
535 [EM2870_BOARD_PINNACLE_PCTV_DVB] = {
536 .name = "Pinnacle PCTV DVB-T",
537 .valid = EM28XX_BOARD_NOT_VALIDATED,
538 .tuner_type = TUNER_ABSENT, /* MT2060 */
539 },
540 [EM2870_BOARD_COMPRO_VIDEOMATE] = {
541 .name = "Compro, VideoMate U3",
542 .valid = EM28XX_BOARD_NOT_VALIDATED,
543 .tuner_type = TUNER_ABSENT, /* MT2060 */
544 },
545 [EM2880_BOARD_TERRATEC_HYBRID_XS_FR] = {
546 .name = "Terratec Hybrid XS Secam",
547 .valid = EM28XX_BOARD_NOT_VALIDATED,
548 .vchannels = 3,
549 .has_msp34xx = 1,
550 .tuner_type = TUNER_XC2028,
551 .decoder = EM28XX_TVP5150,
552 .input = { {
553 .type = EM28XX_VMUX_TELEVISION,
554 .vmux = TVP5150_COMPOSITE0,
555 .amux = 0,
556 }, {
557 .type = EM28XX_VMUX_COMPOSITE1,
558 .vmux = TVP5150_COMPOSITE1,
559 .amux = 1,
560 }, {
561 .type = EM28XX_VMUX_SVIDEO,
562 .vmux = TVP5150_SVIDEO,
563 .amux = 1,
564 } },
565 },
154 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = { 566 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900] = {
155 .name = "Hauppauge WinTV HVR 900", 567 .name = "Hauppauge WinTV HVR 900",
156 .vchannels = 3, 568 .vchannels = 3,
@@ -194,7 +606,7 @@ struct em28xx_board em28xx_boards[] = {
194 .amux = 1, 606 .amux = 1,
195 } }, 607 } },
196 }, 608 },
197 [EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950] = { 609 [EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950] = {
198 .name = "Hauppauge WinTV HVR 950", 610 .name = "Hauppauge WinTV HVR 950",
199 .vchannels = 3, 611 .vchannels = 3,
200 .tda9887_conf = TDA9887_PRESENT, 612 .tda9887_conf = TDA9887_PRESENT,
@@ -240,12 +652,36 @@ struct em28xx_board em28xx_boards[] = {
240 .amux = 1, 652 .amux = 1,
241 } }, 653 } },
242 }, 654 },
655 [EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600] = {
656 .name = "AMD ATI TV Wonder HD 600",
657 .vchannels = 3,
658 .tda9887_conf = TDA9887_PRESENT,
659 .tuner_type = TUNER_XC2028,
660 .mts_firmware = 1,
661 .has_12mhz_i2s = 1,
662 .has_dvb = 1,
663 .decoder = EM28XX_TVP5150,
664 .input = { {
665 .type = EM28XX_VMUX_TELEVISION,
666 .vmux = TVP5150_COMPOSITE0,
667 .amux = 0,
668 }, {
669 .type = EM28XX_VMUX_COMPOSITE1,
670 .vmux = TVP5150_COMPOSITE1,
671 .amux = 1,
672 }, {
673 .type = EM28XX_VMUX_SVIDEO,
674 .vmux = TVP5150_SVIDEO,
675 .amux = 1,
676 } },
677 },
243 [EM2880_BOARD_TERRATEC_HYBRID_XS] = { 678 [EM2880_BOARD_TERRATEC_HYBRID_XS] = {
244 .name = "Terratec Hybrid XS", 679 .name = "Terratec Hybrid XS",
245 .vchannels = 3, 680 .vchannels = 3,
246 .tda9887_conf = TDA9887_PRESENT, 681 .tda9887_conf = TDA9887_PRESENT,
247 .tuner_type = TUNER_XC2028, 682 .tuner_type = TUNER_XC2028,
248 .decoder = EM28XX_TVP5150, 683 .decoder = EM28XX_TVP5150,
684 .has_dvb = 1,
249 .input = { { 685 .input = { {
250 .type = EM28XX_VMUX_TELEVISION, 686 .type = EM28XX_VMUX_TELEVISION,
251 .vmux = TVP5150_COMPOSITE0, 687 .vmux = TVP5150_COMPOSITE0,
@@ -328,6 +764,21 @@ struct em28xx_board em28xx_boards[] = {
328 .amux = 1, 764 .amux = 1,
329 } }, 765 } },
330 }, 766 },
767 [EM2800_BOARD_GRABBEEX_USB2800] = {
768 .name = "eMPIA Technology, Inc. GrabBeeX+ Video Encoder",
769 .is_em2800 = 1,
770 .vchannels = 2,
771 .decoder = EM28XX_SAA7113,
772 .input = { {
773 .type = EM28XX_VMUX_COMPOSITE1,
774 .vmux = SAA7115_COMPOSITE0,
775 .amux = 1,
776 }, {
777 .type = EM28XX_VMUX_SVIDEO,
778 .vmux = SAA7115_SVIDEO3,
779 .amux = 1,
780 } },
781 },
331 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = { 782 [EM2800_BOARD_LEADTEK_WINFAST_USBII] = {
332 .name = "Leadtek Winfast USB II", 783 .name = "Leadtek Winfast USB II",
333 .is_em2800 = 1, 784 .is_em2800 = 1,
@@ -439,13 +890,232 @@ struct em28xx_board em28xx_boards[] = {
439 .amux = 0, 890 .amux = 0,
440 } }, 891 } },
441 }, 892 },
893 [EM2880_BOARD_MSI_DIGIVOX_AD] = {
894 .name = "MSI DigiVox A/D",
895 .valid = EM28XX_BOARD_NOT_VALIDATED,
896 .vchannels = 3,
897 .tuner_type = TUNER_XC2028,
898 .decoder = EM28XX_TVP5150,
899 .input = { {
900 .type = EM28XX_VMUX_TELEVISION,
901 .vmux = TVP5150_COMPOSITE0,
902 .amux = 0,
903 }, {
904 .type = EM28XX_VMUX_COMPOSITE1,
905 .vmux = TVP5150_COMPOSITE1,
906 .amux = 1,
907 }, {
908 .type = EM28XX_VMUX_SVIDEO,
909 .vmux = TVP5150_SVIDEO,
910 .amux = 1,
911 } },
912 },
913 [EM2880_BOARD_MSI_DIGIVOX_AD_II] = {
914 .name = "MSI DigiVox A/D II",
915 .valid = EM28XX_BOARD_NOT_VALIDATED,
916 .vchannels = 3,
917 .tuner_type = TUNER_XC2028,
918 .decoder = EM28XX_TVP5150,
919 .input = { {
920 .type = EM28XX_VMUX_TELEVISION,
921 .vmux = TVP5150_COMPOSITE0,
922 .amux = 0,
923 }, {
924 .type = EM28XX_VMUX_COMPOSITE1,
925 .vmux = TVP5150_COMPOSITE1,
926 .amux = 1,
927 }, {
928 .type = EM28XX_VMUX_SVIDEO,
929 .vmux = TVP5150_SVIDEO,
930 .amux = 1,
931 } },
932 },
933 [EM2880_BOARD_KWORLD_DVB_305U] = {
934 .name = "KWorld DVB-T 305U",
935 .valid = EM28XX_BOARD_NOT_VALIDATED,
936 .vchannels = 3,
937 .tuner_type = TUNER_XC2028,
938 .decoder = EM28XX_TVP5150,
939 .input = { {
940 .type = EM28XX_VMUX_TELEVISION,
941 .vmux = TVP5150_COMPOSITE0,
942 .amux = 0,
943 }, {
944 .type = EM28XX_VMUX_COMPOSITE1,
945 .vmux = TVP5150_COMPOSITE1,
946 .amux = 1,
947 }, {
948 .type = EM28XX_VMUX_SVIDEO,
949 .vmux = TVP5150_SVIDEO,
950 .amux = 1,
951 } },
952 },
953 [EM2880_BOARD_KWORLD_DVB_310U] = {
954 .name = "KWorld DVB-T 310U",
955 .valid = EM28XX_BOARD_NOT_VALIDATED,
956 .vchannels = 3,
957 .tuner_type = TUNER_XC2028,
958 .decoder = EM28XX_TVP5150,
959 .input = { {
960 .type = EM28XX_VMUX_TELEVISION,
961 .vmux = TVP5150_COMPOSITE0,
962 .amux = 0,
963 }, {
964 .type = EM28XX_VMUX_COMPOSITE1,
965 .vmux = TVP5150_COMPOSITE1,
966 .amux = 1,
967 }, {
968 .type = EM28XX_VMUX_SVIDEO,
969 .vmux = TVP5150_SVIDEO,
970 .amux = 1,
971 } },
972 },
973 [EM2881_BOARD_DNT_DA2_HYBRID] = {
974 .name = "DNT DA2 Hybrid",
975 .valid = EM28XX_BOARD_NOT_VALIDATED,
976 .vchannels = 3,
977 .tuner_type = TUNER_XC2028,
978 .decoder = EM28XX_TVP5150,
979 .input = { {
980 .type = EM28XX_VMUX_TELEVISION,
981 .vmux = TVP5150_COMPOSITE0,
982 .amux = 0,
983 }, {
984 .type = EM28XX_VMUX_COMPOSITE1,
985 .vmux = TVP5150_COMPOSITE1,
986 .amux = 1,
987 }, {
988 .type = EM28XX_VMUX_SVIDEO,
989 .vmux = TVP5150_SVIDEO,
990 .amux = 1,
991 } },
992 },
993 [EM2881_BOARD_PINNACLE_HYBRID_PRO] = {
994 .name = "Pinnacle Hybrid Pro",
995 .valid = EM28XX_BOARD_NOT_VALIDATED,
996 .vchannels = 3,
997 .tuner_type = TUNER_XC2028,
998 .decoder = EM28XX_TVP5150,
999 .input = { {
1000 .type = EM28XX_VMUX_TELEVISION,
1001 .vmux = TVP5150_COMPOSITE0,
1002 .amux = 0,
1003 }, {
1004 .type = EM28XX_VMUX_COMPOSITE1,
1005 .vmux = TVP5150_COMPOSITE1,
1006 .amux = 1,
1007 }, {
1008 .type = EM28XX_VMUX_SVIDEO,
1009 .vmux = TVP5150_SVIDEO,
1010 .amux = 1,
1011 } },
1012 },
1013 [EM2882_BOARD_PINNACLE_HYBRID_PRO] = {
1014 .name = "Pinnacle Hybrid Pro (2)",
1015 .valid = EM28XX_BOARD_NOT_VALIDATED,
1016 .vchannels = 3,
1017 .tuner_type = TUNER_XC2028,
1018 .decoder = EM28XX_TVP5150,
1019 .input = { {
1020 .type = EM28XX_VMUX_TELEVISION,
1021 .vmux = TVP5150_COMPOSITE0,
1022 .amux = 0,
1023 }, {
1024 .type = EM28XX_VMUX_COMPOSITE1,
1025 .vmux = TVP5150_COMPOSITE1,
1026 .amux = 1,
1027 }, {
1028 .type = EM28XX_VMUX_SVIDEO,
1029 .vmux = TVP5150_SVIDEO,
1030 .amux = 1,
1031 } },
1032 },
1033 [EM2882_BOARD_KWORLD_VS_DVBT] = {
1034 .name = "Kworld VS-DVB-T 323UR",
1035 .valid = EM28XX_BOARD_NOT_VALIDATED,
1036 .vchannels = 3,
1037 .tuner_type = TUNER_XC2028,
1038 .decoder = EM28XX_TVP5150,
1039 .input = { {
1040 .type = EM28XX_VMUX_TELEVISION,
1041 .vmux = TVP5150_COMPOSITE0,
1042 .amux = 0,
1043 }, {
1044 .type = EM28XX_VMUX_COMPOSITE1,
1045 .vmux = TVP5150_COMPOSITE1,
1046 .amux = 1,
1047 }, {
1048 .type = EM28XX_VMUX_SVIDEO,
1049 .vmux = TVP5150_SVIDEO,
1050 .amux = 1,
1051 } },
1052 },
1053 [EM2882_BOARD_TERRATEC_HYBRID_XS] = {
1054 .name = "Terratec Hybrid XS (em2882)",
1055 .valid = EM28XX_BOARD_NOT_VALIDATED,
1056 .vchannels = 3,
1057 .tuner_type = TUNER_XC2028,
1058 .decoder = EM28XX_TVP5150,
1059 .input = { {
1060 .type = EM28XX_VMUX_TELEVISION,
1061 .vmux = TVP5150_COMPOSITE0,
1062 .amux = 0,
1063 }, {
1064 .type = EM28XX_VMUX_COMPOSITE1,
1065 .vmux = TVP5150_COMPOSITE1,
1066 .amux = 1,
1067 }, {
1068 .type = EM28XX_VMUX_SVIDEO,
1069 .vmux = TVP5150_SVIDEO,
1070 .amux = 1,
1071 } },
1072 },
1073 [EM2883_BOARD_KWORLD_HYBRID_A316] = {
1074 .name = "Kworld PlusTV HD Hybrid 330",
1075 .valid = EM28XX_BOARD_NOT_VALIDATED,
1076 .vchannels = 3,
1077 .is_em2800 = 0,
1078 .tuner_type = TUNER_XC2028,
1079 .decoder = EM28XX_TVP5150,
1080 .input = { {
1081 .type = EM28XX_VMUX_TELEVISION,
1082 .vmux = TVP5150_COMPOSITE0,
1083 .amux = 0,
1084 }, {
1085 .type = EM28XX_VMUX_COMPOSITE1,
1086 .vmux = TVP5150_COMPOSITE1,
1087 .amux = 1,
1088 }, {
1089 .type = EM28XX_VMUX_SVIDEO,
1090 .vmux = TVP5150_SVIDEO,
1091 .amux = 1,
1092 } },
1093 },
1094 [EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU] = {
1095 .name = "Compro VideoMate ForYou/Stereo",
1096 .vchannels = 2,
1097 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1098 .tda9887_conf = TDA9887_PRESENT,
1099 .decoder = EM28XX_TVP5150,
1100 .input = { {
1101 .type = EM28XX_VMUX_TELEVISION,
1102 .vmux = TVP5150_COMPOSITE0,
1103 .amux = EM28XX_AMUX_LINE_IN,
1104 }, {
1105 .type = EM28XX_VMUX_SVIDEO,
1106 .vmux = TVP5150_SVIDEO,
1107 .amux = EM28XX_AMUX_LINE_IN,
1108 } },
1109 },
442}; 1110};
443const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards); 1111const unsigned int em28xx_bcount = ARRAY_SIZE(em28xx_boards);
444 1112
445/* table of devices that work with this driver */ 1113/* table of devices that work with this driver */
446struct usb_device_id em28xx_id_table [] = { 1114struct usb_device_id em28xx_id_table [] = {
447 { USB_DEVICE(0xeb1a, 0x2750), 1115 { USB_DEVICE(0xeb1a, 0x2750),
448 .driver_info = EM2820_BOARD_UNKNOWN }, 1116 .driver_info = EM2750_BOARD_UNKNOWN },
1117 { USB_DEVICE(0xeb1a, 0x2751),
1118 .driver_info = EM2750_BOARD_UNKNOWN },
449 { USB_DEVICE(0xeb1a, 0x2800), 1119 { USB_DEVICE(0xeb1a, 0x2800),
450 .driver_info = EM2800_BOARD_UNKNOWN }, 1120 .driver_info = EM2800_BOARD_UNKNOWN },
451 { USB_DEVICE(0xeb1a, 0x2820), 1121 { USB_DEVICE(0xeb1a, 0x2820),
@@ -462,36 +1132,78 @@ struct usb_device_id em28xx_id_table [] = {
462 .driver_info = EM2820_BOARD_UNKNOWN }, 1132 .driver_info = EM2820_BOARD_UNKNOWN },
463 { USB_DEVICE(0xeb1a, 0x2883), 1133 { USB_DEVICE(0xeb1a, 0x2883),
464 .driver_info = EM2820_BOARD_UNKNOWN }, 1134 .driver_info = EM2820_BOARD_UNKNOWN },
1135 { USB_DEVICE(0xeb1a, 0xe300),
1136 .driver_info = EM2861_BOARD_KWORLD_PVRTV_300U },
1137 { USB_DEVICE(0xeb1a, 0xe305),
1138 .driver_info = EM2880_BOARD_KWORLD_DVB_305U },
1139 { USB_DEVICE(0xeb1a, 0xe310),
1140 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD },
1141 { USB_DEVICE(0xeb1a, 0xa316),
1142 .driver_info = EM2883_BOARD_KWORLD_HYBRID_A316 },
1143 { USB_DEVICE(0xeb1a, 0xe320),
1144 .driver_info = EM2880_BOARD_MSI_DIGIVOX_AD_II },
1145 { USB_DEVICE(0xeb1a, 0xe323),
1146 .driver_info = EM2882_BOARD_KWORLD_VS_DVBT },
1147 { USB_DEVICE(0xeb1a, 0xe350),
1148 .driver_info = EM2870_BOARD_KWORLD_350U },
1149 { USB_DEVICE(0xeb1a, 0xe355),
1150 .driver_info = EM2870_BOARD_KWORLD_355U },
1151 { USB_DEVICE(0xeb1a, 0x2801),
1152 .driver_info = EM2800_BOARD_GRABBEEX_USB2800 },
1153 { USB_DEVICE(0xeb1a, 0xe357),
1154 .driver_info = EM2870_BOARD_KWORLD_355U },
465 { USB_DEVICE(0x0ccd, 0x0036), 1155 { USB_DEVICE(0x0ccd, 0x0036),
466 .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 }, 1156 .driver_info = EM2820_BOARD_TERRATEC_CINERGY_250 },
467 { USB_DEVICE(0x2304, 0x0208), 1157 { USB_DEVICE(0x0ccd, 0x004c),
468 .driver_info = EM2820_BOARD_PINNACLE_USB_2 }, 1158 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS_FR },
1159 { USB_DEVICE(0x0ccd, 0x004f),
1160 .driver_info = EM2860_BOARD_TERRATEC_HYBRID_XS },
1161 { USB_DEVICE(0x0ccd, 0x005e),
1162 .driver_info = EM2882_BOARD_TERRATEC_HYBRID_XS },
1163 { USB_DEVICE(0x0ccd, 0x0042),
1164 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS },
1165 { USB_DEVICE(0x0ccd, 0x0043),
1166 .driver_info = EM2870_BOARD_TERRATEC_XS },
1167 { USB_DEVICE(0x0ccd, 0x0047),
1168 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS },
1169 { USB_DEVICE(0x185b, 0x2870),
1170 .driver_info = EM2870_BOARD_COMPRO_VIDEOMATE },
1171 { USB_DEVICE(0x185b, 0x2041),
1172 .driver_info = EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU },
469 { USB_DEVICE(0x2040, 0x4200), 1173 { USB_DEVICE(0x2040, 0x4200),
470 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 }, 1174 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
471 { USB_DEVICE(0x2040, 0x4201), 1175 { USB_DEVICE(0x2040, 0x4201),
472 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 }, 1176 .driver_info = EM2820_BOARD_HAUPPAUGE_WINTV_USB_2 },
473 { USB_DEVICE(0x2304, 0x0207),
474 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
475 { USB_DEVICE(0x2304, 0x021a),
476 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
477 { USB_DEVICE(0x2304, 0x0227),
478 .driver_info = EM2880_BOARD_PINNACLE_PCTV_HD_PRO },
479 { USB_DEVICE(0x2040, 0x6500), 1177 { USB_DEVICE(0x2040, 0x6500),
480 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 }, 1178 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900 },
481 { USB_DEVICE(0x2040, 0x6502), 1179 { USB_DEVICE(0x2040, 0x6502),
482 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 }, 1180 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 },
483 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */ 1181 { USB_DEVICE(0x2040, 0x6513), /* HCW HVR-980 */
484 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 }, 1182 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
485 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */ 1183 { USB_DEVICE(0x2040, 0x6517), /* HP HVR-950 */
486 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 }, 1184 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
487 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */ 1185 { USB_DEVICE(0x2040, 0x651b), /* RP HVR-950 */
488 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 }, 1186 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
489 { USB_DEVICE(0x2040, 0x651f), /* HCW HVR-850 */ 1187 { USB_DEVICE(0x2040, 0x651f), /* HCW HVR-850 */
490 .driver_info = EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 }, 1188 .driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
491 { USB_DEVICE(0x0ccd, 0x0042), 1189 { USB_DEVICE(0x0438, 0xb002),
492 .driver_info = EM2880_BOARD_TERRATEC_HYBRID_XS }, 1190 .driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
493 { USB_DEVICE(0x0ccd, 0x0047), 1191 { USB_DEVICE(0x2001, 0xf112),
494 .driver_info = EM2880_BOARD_TERRATEC_PRODIGY_XS }, 1192 .driver_info = EM2820_BOARD_DLINK_USB_TV },
1193 { USB_DEVICE(0x2304, 0x0207),
1194 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1195 { USB_DEVICE(0x2304, 0x0208),
1196 .driver_info = EM2820_BOARD_PINNACLE_USB_2 },
1197 { USB_DEVICE(0x2304, 0x021a),
1198 .driver_info = EM2820_BOARD_PINNACLE_DVC_90 },
1199 { USB_DEVICE(0x2304, 0x0226),
1200 .driver_info = EM2882_BOARD_PINNACLE_HYBRID_PRO },
1201 { USB_DEVICE(0x2304, 0x0227),
1202 .driver_info = EM2880_BOARD_PINNACLE_PCTV_HD_PRO },
1203 { USB_DEVICE(0x0413, 0x6023),
1204 .driver_info = EM2800_BOARD_LEADTEK_WINFAST_USBII },
1205 { USB_DEVICE(0x093b, 0xa005),
1206 .driver_info = EM2861_BOARD_PLEXTOR_PX_TV100U },
495 { }, 1207 { },
496}; 1208};
497MODULE_DEVICE_TABLE(usb, em28xx_id_table); 1209MODULE_DEVICE_TABLE(usb, em28xx_id_table);
@@ -500,6 +1212,18 @@ MODULE_DEVICE_TABLE(usb, em28xx_id_table);
500 * Reset sequences for analog/digital modes 1212 * Reset sequences for analog/digital modes
501 */ 1213 */
502 1214
1215/* Reset for the most [analog] boards */
1216static struct em28xx_reg_seq default_analog[] = {
1217 {EM28XX_R08_GPIO, 0x6d, ~EM_GPIO_4, 10},
1218 { -1, -1, -1, -1},
1219};
1220
1221/* Reset for the most [digital] boards */
1222static struct em28xx_reg_seq default_digital[] = {
1223 {EM28XX_R08_GPIO, 0x6e, ~EM_GPIO_4, 10},
1224 { -1, -1, -1, -1},
1225};
1226
503/* Board Hauppauge WinTV HVR 900 analog */ 1227/* Board Hauppauge WinTV HVR 900 analog */
504static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = { 1228static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
505 {EM28XX_R08_GPIO, 0x2d, ~EM_GPIO_4, 10}, 1229 {EM28XX_R08_GPIO, 0x2d, ~EM_GPIO_4, 10},
@@ -515,14 +1239,42 @@ static struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
515 { -1, -1, -1, -1}, 1239 { -1, -1, -1, -1},
516}; 1240};
517 1241
518/* Board Hauppauge WinTV HVR 900 tuner_callback */ 1242/* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
519static struct em28xx_reg_seq hauppauge_wintv_hvr_900_tuner_callback[] = { 1243static struct em28xx_reg_seq em2880_msi_digivox_ad_analog[] = {
1244 {EM28XX_R08_GPIO, 0x69, ~EM_GPIO_4, 10},
1245 { -1, -1, -1, -1},
1246};
1247
1248/* Boards - EM2880 MSI DIGIVOX AD and EM2880_BOARD_MSI_DIGIVOX_AD_II */
1249static struct em28xx_reg_seq em2880_msi_digivox_ad_digital[] = {
1250 {EM28XX_R08_GPIO, 0x6a, ~EM_GPIO_4, 10},
1251 { -1, -1, -1, -1},
1252};
1253
1254/* Board - EM2870 Kworld 355u
1255 Analog - No input analog */
1256static struct em28xx_reg_seq em2870_kworld_355u_digital[] = {
1257 {EM2880_R04_GPO, 0x01, 0xff, 10},
1258 { -1, -1, -1, -1},
1259};
1260
1261/* Callback for the most boards */
1262static struct em28xx_reg_seq default_callback[] = {
520 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10}, 1263 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
521 {EM28XX_R08_GPIO, 0, EM_GPIO_4, 10}, 1264 {EM28XX_R08_GPIO, 0, EM_GPIO_4, 10},
522 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10}, 1265 {EM28XX_R08_GPIO, EM_GPIO_4, EM_GPIO_4, 10},
523 { -1, -1, -1, -1}, 1266 { -1, -1, -1, -1},
524}; 1267};
525 1268
1269/* Callback for EM2882 TERRATEC HYBRID XS */
1270static struct em28xx_reg_seq em2882_terratec_hybrid_xs_digital[] = {
1271 {EM28XX_R08_GPIO, 0x2e, 0xff, 6},
1272 {EM28XX_R08_GPIO, 0x3e, ~EM_GPIO_4, 6},
1273 {EM2880_R04_GPO, 0x04, 0xff, 10},
1274 {EM2880_R04_GPO, 0x0c, 0xff, 10},
1275 { -1, -1, -1, -1},
1276};
1277
526/* 1278/*
527 * EEPROM hash table for devices with generic USB IDs 1279 * EEPROM hash table for devices with generic USB IDs
528 */ 1280 */
@@ -569,6 +1321,7 @@ static void em28xx_set_model(struct em28xx *dev)
569 dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480; 1321 dev->max_range_640_480 = em28xx_boards[dev->model].max_range_640_480;
570 dev->has_dvb = em28xx_boards[dev->model].has_dvb; 1322 dev->has_dvb = em28xx_boards[dev->model].has_dvb;
571 dev->has_snapshot_button = em28xx_boards[dev->model].has_snapshot_button; 1323 dev->has_snapshot_button = em28xx_boards[dev->model].has_snapshot_button;
1324 dev->valid = em28xx_boards[dev->model].valid;
572} 1325}
573 1326
574/* Since em28xx_pre_card_setup() requires a proper dev->model, 1327/* Since em28xx_pre_card_setup() requires a proper dev->model,
@@ -604,19 +1357,171 @@ void em28xx_pre_card_setup(struct em28xx *dev)
604 case EM2880_BOARD_TERRATEC_PRODIGY_XS: 1357 case EM2880_BOARD_TERRATEC_PRODIGY_XS:
605 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: 1358 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
606 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2: 1359 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
607 case EM2880_BOARD_TERRATEC_HYBRID_XS: 1360 case EM2860_BOARD_TERRATEC_HYBRID_XS:
608 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: 1361 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
609 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO: 1362 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
1363 case EM2882_BOARD_PINNACLE_HYBRID_PRO:
1364 case EM2883_BOARD_KWORLD_HYBRID_A316:
1365 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
1366 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1367 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1368 msleep(50);
1369
1370 /* Sets GPO/GPIO sequences for this device */
1371 dev->analog_gpio = hauppauge_wintv_hvr_900_analog;
1372 dev->digital_gpio = hauppauge_wintv_hvr_900_digital;
1373 dev->tun_analog_gpio = default_callback;
1374 dev->tun_digital_gpio = default_callback;
1375 break;
1376
1377 case EM2882_BOARD_TERRATEC_HYBRID_XS:
610 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1); 1378 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
611 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1); 1379 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
612 msleep(50); 1380 msleep(50);
613 1381
1382 /* should be added ir_codes here */
1383
614 /* Sets GPO/GPIO sequences for this device */ 1384 /* Sets GPO/GPIO sequences for this device */
615 dev->analog_gpio = hauppauge_wintv_hvr_900_analog; 1385 dev->analog_gpio = hauppauge_wintv_hvr_900_analog;
616 dev->digital_gpio = hauppauge_wintv_hvr_900_digital; 1386 dev->digital_gpio = hauppauge_wintv_hvr_900_digital;
617 dev->tun_analog_gpio = hauppauge_wintv_hvr_900_tuner_callback; 1387 dev->tun_analog_gpio = default_callback;
618 dev->tun_digital_gpio = hauppauge_wintv_hvr_900_tuner_callback; 1388 dev->tun_digital_gpio = em2882_terratec_hybrid_xs_digital;
1389 break;
1390
1391 case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
1392 case EM2880_BOARD_TERRATEC_HYBRID_XS:
1393 case EM2870_BOARD_TERRATEC_XS:
1394 case EM2881_BOARD_PINNACLE_HYBRID_PRO:
1395 case EM2880_BOARD_KWORLD_DVB_310U:
1396 case EM2870_BOARD_KWORLD_350U:
1397 case EM2881_BOARD_DNT_DA2_HYBRID:
1398 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1399 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1400 msleep(50);
1401
1402 /* NOTE: EM2881_DNT_DA2_HYBRID spend 140 msleep for digital
1403 and analog commands. If this commands doesn't work,
1404 add this timer. */
619 1405
1406 /* Sets GPO/GPIO sequences for this device */
1407 dev->analog_gpio = default_analog;
1408 dev->digital_gpio = default_digital;
1409 dev->tun_analog_gpio = default_callback;
1410 dev->tun_digital_gpio = default_callback;
1411 break;
1412
1413 case EM2880_BOARD_MSI_DIGIVOX_AD:
1414 case EM2880_BOARD_MSI_DIGIVOX_AD_II:
1415 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1416 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1417 msleep(50);
1418
1419 /* Sets GPO/GPIO sequences for this device */
1420 dev->analog_gpio = em2880_msi_digivox_ad_analog;
1421 dev->digital_gpio = em2880_msi_digivox_ad_digital;
1422 dev->tun_analog_gpio = default_callback;
1423 dev->tun_digital_gpio = default_callback;
1424 break;
1425
1426 case EM2750_BOARD_UNKNOWN:
1427 case EM2750_BOARD_DLCW_130:
1428 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x0a", 1);
1429 break;
1430
1431 case EM2861_BOARD_PLEXTOR_PX_TV100U:
1432 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1433 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1434 /* FIXME guess */
1435 /* Turn on analog audio output */
1436 em28xx_write_regs_req(dev, 0x00, 0x08, "\xfd", 1);
1437 break;
1438
1439 case EM2861_BOARD_KWORLD_PVRTV_300U:
1440 case EM2880_BOARD_KWORLD_DVB_305U:
1441 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1442 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x4c", 1);
1443 msleep(10);
1444 em28xx_write_regs(dev, 0x08, "\x6d", 1);
1445 msleep(10);
1446 em28xx_write_regs(dev, 0x08, "\x7d", 1);
1447 msleep(10);
1448 break;
1449
1450 case EM2870_BOARD_KWORLD_355U:
1451 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1452 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1453 msleep(50);
1454
1455 /* Sets GPO/GPIO sequences for this device */
1456 dev->digital_gpio = em2870_kworld_355u_digital;
1457 break;
1458
1459 case EM2870_BOARD_COMPRO_VIDEOMATE:
1460 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1461 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1462 /* TODO: someone can do some cleanup here...
1463 not everything's needed */
1464 em28xx_write_regs(dev, 0x04, "\x00", 1);
1465 msleep(10);
1466 em28xx_write_regs(dev, 0x04, "\x01", 1);
1467 msleep(10);
1468 em28xx_write_regs(dev, 0x08, "\xfd", 1);
1469 mdelay(70);
1470 em28xx_write_regs(dev, 0x08, "\xfc", 1);
1471 mdelay(70);
1472 em28xx_write_regs(dev, 0x08, "\xdc", 1);
1473 mdelay(70);
1474 em28xx_write_regs(dev, 0x08, "\xfc", 1);
1475 mdelay(70);
1476 break;
1477
1478 case EM2870_BOARD_TERRATEC_XS_MT2060:
1479 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1480 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1481 /* this device needs some gpio writes to get the DVB-T
1482 demod work */
1483 em28xx_write_regs(dev, 0x08, "\xfe", 1);
1484 mdelay(70);
1485 em28xx_write_regs(dev, 0x08, "\xde", 1);
1486 mdelay(70);
1487 dev->em28xx_write_regs(dev, 0x08, "\xfe", 1);
1488 mdelay(70);
1489 break;
1490
1491 case EM2870_BOARD_PINNACLE_PCTV_DVB:
1492 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1493 /* this device needs some gpio writes to get the
1494 DVB-T demod work */
1495 em28xx_write_regs(dev, 0x08, "\xfe", 1);
1496 mdelay(70);
1497 em28xx_write_regs(dev, 0x08, "\xde", 1);
1498 mdelay(70);
1499 em28xx_write_regs(dev, 0x08, "\xfe", 1);
1500 mdelay(70);
1501 /* switch em2880 rc protocol */
1502 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x22", 1);
1503 /* should be added ir_codes here */
1504 break;
1505
1506 case EM2820_BOARD_GADMEI_UTV310:
1507 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1508 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1509 /* Turn on analog audio output */
1510 em28xx_write_regs_req(dev, 0x00, 0x08, "\xfd", 1);
1511 break;
1512
1513 case EM2860_BOARD_GADMEI_UTV330:
1514 /* Turn on IR */
1515 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x07", 1);
1516 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1517 /* should be added ir_codes here */
1518 break;
1519
1520 case EM2820_BOARD_MSI_VOX_USB_2:
1521 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
1522 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
1523 /* enables audio for that device */
1524 em28xx_write_regs_req(dev, 0x00, 0x08, "\xfd", 1);
620 break; 1525 break;
621 } 1526 }
622 1527
@@ -639,12 +1544,16 @@ static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
639 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: 1544 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
640 ctl->demod = XC3028_FE_ZARLINK456; 1545 ctl->demod = XC3028_FE_ZARLINK456;
641 break; 1546 break;
1547 case EM2880_BOARD_TERRATEC_HYBRID_XS:
1548 ctl->demod = XC3028_FE_ZARLINK456;
1549 break;
642 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2: 1550 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
643 /* djh - Not sure which demod we need here */ 1551 /* djh - Not sure which demod we need here */
644 ctl->demod = XC3028_FE_DEFAULT; 1552 ctl->demod = XC3028_FE_DEFAULT;
645 break; 1553 break;
646 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: 1554 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
647 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO: 1555 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
1556 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
648 /* FIXME: Better to specify the needed IF */ 1557 /* FIXME: Better to specify the needed IF */
649 ctl->demod = XC3028_FE_DEFAULT; 1558 ctl->demod = XC3028_FE_DEFAULT;
650 break; 1559 break;
@@ -809,6 +1718,8 @@ void em28xx_set_ir(struct em28xx *dev, struct IR_i2c *ir)
809 break; 1718 break;
810 case (EM2800_BOARD_KWORLD_USB2800): 1719 case (EM2800_BOARD_KWORLD_USB2800):
811 break; 1720 break;
1721 case (EM2800_BOARD_GRABBEEX_USB2800):
1722 break;
812 } 1723 }
813} 1724}
814 1725
@@ -823,7 +1734,7 @@ void em28xx_card_setup(struct em28xx *dev)
823 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2: 1734 case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
824 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: 1735 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
825 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2: 1736 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2:
826 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: 1737 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
827 { 1738 {
828 struct tveeprom tv; 1739 struct tveeprom tv;
829#ifdef CONFIG_MODULES 1740#ifdef CONFIG_MODULES
@@ -836,7 +1747,7 @@ void em28xx_card_setup(struct em28xx *dev)
836 1747
837 dev->tuner_type = tv.tuner_type; 1748 dev->tuner_type = tv.tuner_type;
838 1749
839 if (tv.audio_processor == AUDIO_CHIP_MSP34XX) { 1750 if (tv.audio_processor == V4L2_IDENT_MSPX4XX) {
840 dev->i2s_speed = 2048000; 1751 dev->i2s_speed = 2048000;
841 dev->has_msp34xx = 1; 1752 dev->has_msp34xx = 1;
842 } 1753 }
@@ -854,11 +1765,21 @@ void em28xx_card_setup(struct em28xx *dev)
854 case EM2800_BOARD_UNKNOWN: 1765 case EM2800_BOARD_UNKNOWN:
855 if (!em28xx_hint_board(dev)) 1766 if (!em28xx_hint_board(dev))
856 em28xx_set_model(dev); 1767 em28xx_set_model(dev);
1768 break;
857 } 1769 }
858 1770
859 if (dev->has_snapshot_button) 1771 if (dev->has_snapshot_button)
860 em28xx_register_snapshot_button(dev); 1772 em28xx_register_snapshot_button(dev);
861 1773
1774 if (dev->valid == EM28XX_BOARD_NOT_VALIDATED) {
1775 em28xx_errdev("\n\n");
1776 em28xx_errdev("The support for this board weren't "
1777 "valid yet.\n");
1778 em28xx_errdev("Please send a report of having this working\n");
1779 em28xx_errdev("not to V4L mailing list (and/or to other "
1780 "addresses)\n\n");
1781 }
1782
862 /* Allow override tuner type by a module parameter */ 1783 /* Allow override tuner type by a module parameter */
863 if (tuner >= 0) 1784 if (tuner >= 0)
864 dev->tuner_type = tuner; 1785 dev->tuner_type = tuner;
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index cc61cfb23a4a..4b992bc0083c 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -6,6 +6,7 @@
6 (c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com> 6 (c) 2008 Devin Heitmueller <devin.heitmueller@gmail.com>
7 - Fixes for the driver to properly work with HVR-950 7 - Fixes for the driver to properly work with HVR-950
8 - Fixes for the driver to properly work with Pinnacle PCTV HD Pro Stick 8 - Fixes for the driver to properly work with Pinnacle PCTV HD Pro Stick
9 - Fixes for the driver to properly work with AMD ATI TV Wonder HD 600
9 10
10 (c) 2008 Aidan Thornton <makosoft@googlemail.com> 11 (c) 2008 Aidan Thornton <makosoft@googlemail.com>
11 12
@@ -409,8 +410,9 @@ static int dvb_init(struct em28xx *dev)
409 em28xx_set_mode(dev, EM28XX_DIGITAL_MODE); 410 em28xx_set_mode(dev, EM28XX_DIGITAL_MODE);
410 /* init frontend */ 411 /* init frontend */
411 switch (dev->model) { 412 switch (dev->model) {
412 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: 413 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
413 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO: 414 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
415 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
414 dvb->frontend = dvb_attach(lgdt330x_attach, 416 dvb->frontend = dvb_attach(lgdt330x_attach,
415 &em2880_lgdt3303_dev, 417 &em2880_lgdt3303_dev,
416 &dev->i2c_adap); 418 &dev->i2c_adap);
@@ -441,6 +443,15 @@ static int dvb_init(struct em28xx *dev)
441 } 443 }
442 break; 444 break;
443#endif 445#endif
446 case EM2880_BOARD_TERRATEC_HYBRID_XS:
447 dvb->frontend = dvb_attach(zl10353_attach,
448 &em28xx_zl10353_with_xc3028,
449 &dev->i2c_adap);
450 if (attach_xc3028(0x61, dev) < 0) {
451 result = -EINVAL;
452 goto out_free;
453 }
454 break;
444 default: 455 default:
445 printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card" 456 printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card"
446 " isn't supported yet\n", 457 " isn't supported yet\n",
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 2d9f14d2a00b..49ab0629702e 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -38,6 +38,7 @@
38 38
39#include "em28xx.h" 39#include "em28xx.h"
40#include <media/v4l2-common.h> 40#include <media/v4l2-common.h>
41#include <media/v4l2-ioctl.h>
41#include <media/msp3400.h> 42#include <media/msp3400.h>
42#include <media/tuner.h> 43#include <media/tuner.h>
43 44
@@ -1763,20 +1764,7 @@ static const struct file_operations em28xx_v4l_fops = {
1763 .compat_ioctl = v4l_compat_ioctl32, 1764 .compat_ioctl = v4l_compat_ioctl32,
1764}; 1765};
1765 1766
1766static const struct file_operations radio_fops = { 1767static const struct v4l2_ioctl_ops video_ioctl_ops = {
1767 .owner = THIS_MODULE,
1768 .open = em28xx_v4l2_open,
1769 .release = em28xx_v4l2_close,
1770 .ioctl = video_ioctl2,
1771 .compat_ioctl = v4l_compat_ioctl32,
1772 .llseek = no_llseek,
1773};
1774
1775static const struct video_device em28xx_video_template = {
1776 .fops = &em28xx_v4l_fops,
1777 .release = video_device_release,
1778
1779 .minor = -1,
1780 .vidioc_querycap = vidioc_querycap, 1768 .vidioc_querycap = vidioc_querycap,
1781 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1769 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1782 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1770 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1814,16 +1802,29 @@ static const struct video_device em28xx_video_template = {
1814#ifdef CONFIG_VIDEO_V4L1_COMPAT 1802#ifdef CONFIG_VIDEO_V4L1_COMPAT
1815 .vidiocgmbuf = vidiocgmbuf, 1803 .vidiocgmbuf = vidiocgmbuf,
1816#endif 1804#endif
1805};
1806
1807static const struct video_device em28xx_video_template = {
1808 .fops = &em28xx_v4l_fops,
1809 .release = video_device_release,
1810 .ioctl_ops = &video_ioctl_ops,
1811
1812 .minor = -1,
1817 1813
1818 .tvnorms = V4L2_STD_ALL, 1814 .tvnorms = V4L2_STD_ALL,
1819 .current_norm = V4L2_STD_PAL, 1815 .current_norm = V4L2_STD_PAL,
1820}; 1816};
1821 1817
1822static struct video_device em28xx_radio_template = { 1818static const struct file_operations radio_fops = {
1823 .name = "em28xx-radio", 1819 .owner = THIS_MODULE,
1824 .type = VID_TYPE_TUNER, 1820 .open = em28xx_v4l2_open,
1825 .fops = &radio_fops, 1821 .release = em28xx_v4l2_close,
1826 .minor = -1, 1822 .ioctl = video_ioctl2,
1823 .compat_ioctl = v4l_compat_ioctl32,
1824 .llseek = no_llseek,
1825};
1826
1827static const struct v4l2_ioctl_ops radio_ioctl_ops = {
1827 .vidioc_querycap = radio_querycap, 1828 .vidioc_querycap = radio_querycap,
1828 .vidioc_g_tuner = radio_g_tuner, 1829 .vidioc_g_tuner = radio_g_tuner,
1829 .vidioc_enum_input = radio_enum_input, 1830 .vidioc_enum_input = radio_enum_input,
@@ -1842,6 +1843,13 @@ static struct video_device em28xx_radio_template = {
1842#endif 1843#endif
1843}; 1844};
1844 1845
1846static struct video_device em28xx_radio_template = {
1847 .name = "em28xx-radio",
1848 .fops = &radio_fops,
1849 .ioctl_ops = &radio_ioctl_ops,
1850 .minor = -1,
1851};
1852
1845/******************************** usb interface ******************************/ 1853/******************************** usb interface ******************************/
1846 1854
1847 1855
@@ -1882,7 +1890,6 @@ EXPORT_SYMBOL(em28xx_unregister_extension);
1882 1890
1883static struct video_device *em28xx_vdev_init(struct em28xx *dev, 1891static struct video_device *em28xx_vdev_init(struct em28xx *dev,
1884 const struct video_device *template, 1892 const struct video_device *template,
1885 const int type,
1886 const char *type_name) 1893 const char *type_name)
1887{ 1894{
1888 struct video_device *vfd; 1895 struct video_device *vfd;
@@ -1892,9 +1899,8 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev,
1892 return NULL; 1899 return NULL;
1893 *vfd = *template; 1900 *vfd = *template;
1894 vfd->minor = -1; 1901 vfd->minor = -1;
1895 vfd->dev = &dev->udev->dev; 1902 vfd->parent = &dev->udev->dev;
1896 vfd->release = video_device_release; 1903 vfd->release = video_device_release;
1897 vfd->type = type;
1898 vfd->debug = video_debug; 1904 vfd->debug = video_debug;
1899 1905
1900 snprintf(vfd->name, sizeof(vfd->name), "%s %s", 1906 snprintf(vfd->name, sizeof(vfd->name), "%s %s",
@@ -1972,14 +1978,11 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
1972 list_add_tail(&dev->devlist, &em28xx_devlist); 1978 list_add_tail(&dev->devlist, &em28xx_devlist);
1973 1979
1974 /* allocate and fill video video_device struct */ 1980 /* allocate and fill video video_device struct */
1975 dev->vdev = em28xx_vdev_init(dev, &em28xx_video_template, 1981 dev->vdev = em28xx_vdev_init(dev, &em28xx_video_template, "video");
1976 VID_TYPE_CAPTURE, "video");
1977 if (NULL == dev->vdev) { 1982 if (NULL == dev->vdev) {
1978 em28xx_errdev("cannot allocate video_device.\n"); 1983 em28xx_errdev("cannot allocate video_device.\n");
1979 goto fail_unreg; 1984 goto fail_unreg;
1980 } 1985 }
1981 if (dev->tuner_type != TUNER_ABSENT)
1982 dev->vdev->type |= VID_TYPE_TUNER;
1983 1986
1984 /* register v4l2 video video_device */ 1987 /* register v4l2 video video_device */
1985 retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, 1988 retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER,
@@ -1991,8 +1994,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
1991 } 1994 }
1992 1995
1993 /* Allocate and fill vbi video_device struct */ 1996 /* Allocate and fill vbi video_device struct */
1994 dev->vbi_dev = em28xx_vdev_init(dev, &em28xx_video_template, 1997 dev->vbi_dev = em28xx_vdev_init(dev, &em28xx_video_template, "vbi");
1995 VFL_TYPE_VBI, "vbi");
1996 /* register v4l2 vbi video_device */ 1998 /* register v4l2 vbi video_device */
1997 if (video_register_device(dev->vbi_dev, VFL_TYPE_VBI, 1999 if (video_register_device(dev->vbi_dev, VFL_TYPE_VBI,
1998 vbi_nr[dev->devno]) < 0) { 2000 vbi_nr[dev->devno]) < 0) {
@@ -2002,8 +2004,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
2002 } 2004 }
2003 2005
2004 if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) { 2006 if (em28xx_boards[dev->model].radio.type == EM28XX_RADIO) {
2005 dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template, 2007 dev->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template, "radio");
2006 VFL_TYPE_RADIO, "radio");
2007 if (NULL == dev->radio_dev) { 2008 if (NULL == dev->radio_dev) {
2008 em28xx_errdev("cannot allocate video_device.\n"); 2009 em28xx_errdev("cannot allocate video_device.\n");
2009 goto fail_unreg; 2010 goto fail_unreg;
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 89842c5d64a1..9a3310748685 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -54,15 +54,58 @@
54#define EM2880_BOARD_TERRATEC_PRODIGY_XS 13 54#define EM2880_BOARD_TERRATEC_PRODIGY_XS 13
55#define EM2820_BOARD_PROLINK_PLAYTV_USB2 14 55#define EM2820_BOARD_PROLINK_PLAYTV_USB2 14
56#define EM2800_BOARD_VGEAR_POCKETTV 15 56#define EM2800_BOARD_VGEAR_POCKETTV 15
57#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950 16 57#define EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 16
58#define EM2880_BOARD_PINNACLE_PCTV_HD_PRO 17 58#define EM2880_BOARD_PINNACLE_PCTV_HD_PRO 17
59#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 18 59#define EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2 18
60#define EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA 19 60#define EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA 19
61#define EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 20
62#define EM2800_BOARD_GRABBEEX_USB2800 21
63#define EM2750_BOARD_UNKNOWN 22
64#define EM2750_BOARD_DLCW_130 23
65#define EM2820_BOARD_DLINK_USB_TV 24
66#define EM2820_BOARD_GADMEI_UTV310 25
67#define EM2820_BOARD_HERCULES_SMART_TV_USB2 26
68#define EM2820_BOARD_PINNACLE_USB_2_FM1216ME 27
69#define EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE 28
70#define EM2820_BOARD_PINNACLE_DVC_100 29
71#define EM2820_BOARD_VIDEOLOGY_20K14XUSB 30
72#define EM2821_BOARD_USBGEAR_VD204 31
73#define EM2821_BOARD_SUPERCOMP_USB_2 32
74#define EM2821_BOARD_PROLINK_PLAYTV_USB2 33
75#define EM2860_BOARD_TERRATEC_HYBRID_XS 34
76#define EM2860_BOARD_TYPHOON_DVD_MAKER 35
77#define EM2860_BOARD_NETGMBH_CAM 36
78#define EM2860_BOARD_GADMEI_UTV330 37
79#define EM2861_BOARD_YAKUMO_MOVIE_MIXER 38
80#define EM2861_BOARD_KWORLD_PVRTV_300U 39
81#define EM2861_BOARD_PLEXTOR_PX_TV100U 40
82#define EM2870_BOARD_KWORLD_350U 41
83#define EM2870_BOARD_KWORLD_355U 42
84#define EM2870_BOARD_TERRATEC_XS 43
85#define EM2870_BOARD_TERRATEC_XS_MT2060 44
86#define EM2870_BOARD_PINNACLE_PCTV_DVB 45
87#define EM2870_BOARD_COMPRO_VIDEOMATE 46
88#define EM2880_BOARD_KWORLD_DVB_305U 47
89#define EM2880_BOARD_KWORLD_DVB_310U 48
90#define EM2880_BOARD_MSI_DIGIVOX_AD 49
91#define EM2880_BOARD_MSI_DIGIVOX_AD_II 50
92#define EM2880_BOARD_TERRATEC_HYBRID_XS_FR 51
93#define EM2881_BOARD_DNT_DA2_HYBRID 52
94#define EM2881_BOARD_PINNACLE_HYBRID_PRO 53
95#define EM2882_BOARD_KWORLD_VS_DVBT 54
96#define EM2882_BOARD_TERRATEC_HYBRID_XS 55
97#define EM2882_BOARD_PINNACLE_HYBRID_PRO 56
98#define EM2883_BOARD_KWORLD_HYBRID_A316 57
99#define EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU 58
61 100
62/* Limits minimum and default number of buffers */ 101/* Limits minimum and default number of buffers */
63#define EM28XX_MIN_BUF 4 102#define EM28XX_MIN_BUF 4
64#define EM28XX_DEF_BUF 8 103#define EM28XX_DEF_BUF 8
65 104
105/* Params for validated field */
106#define EM28XX_BOARD_NOT_VALIDATED 1
107#define EM28XX_BOARD_VALIDATED 0
108
66/* maximum number of em28xx boards */ 109/* maximum number of em28xx boards */
67#define EM28XX_MAXBOARDS 4 /*FIXME: should be bigger */ 110#define EM28XX_MAXBOARDS 4 /*FIXME: should be bigger */
68 111
@@ -251,6 +294,7 @@ struct em28xx_board {
251 unsigned int max_range_640_480:1; 294 unsigned int max_range_640_480:1;
252 unsigned int has_dvb:1; 295 unsigned int has_dvb:1;
253 unsigned int has_snapshot_button:1; 296 unsigned int has_snapshot_button:1;
297 unsigned int valid:1;
254 298
255 enum em28xx_decoder decoder; 299 enum em28xx_decoder decoder;
256 300
@@ -331,6 +375,7 @@ struct em28xx {
331 unsigned int max_range_640_480:1; 375 unsigned int max_range_640_480:1;
332 unsigned int has_dvb:1; 376 unsigned int has_dvb:1;
333 unsigned int has_snapshot_button:1; 377 unsigned int has_snapshot_button:1;
378 unsigned int valid:1; /* report for validated boards */
334 379
335 /* Some older em28xx chips needs a waiting time after writing */ 380 /* Some older em28xx chips needs a waiting time after writing */
336 unsigned int wait_after_write; 381 unsigned int wait_after_write;
@@ -360,7 +405,7 @@ struct em28xx {
360 v4l2_std_id norm; /* selected tv norm */ 405 v4l2_std_id norm; /* selected tv norm */
361 int ctl_freq; /* selected frequency */ 406 int ctl_freq; /* selected frequency */
362 unsigned int ctl_input; /* selected input */ 407 unsigned int ctl_input; /* selected input */
363 unsigned int ctl_ainput; /* slected audio input */ 408 unsigned int ctl_ainput;/* selected audio input */
364 int mute; 409 int mute;
365 int volume; 410 int volume;
366 /* frame properties */ 411 /* frame properties */
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c
index 15d037ae25c5..2d170d101c21 100644
--- a/drivers/media/video/et61x251/et61x251_core.c
+++ b/drivers/media/video/et61x251/et61x251_core.c
@@ -34,6 +34,7 @@
34#include <linux/mm.h> 34#include <linux/mm.h>
35#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
36#include <linux/page-flags.h> 36#include <linux/page-flags.h>
37#include <media/v4l2-ioctl.h>
37#include <asm/byteorder.h> 38#include <asm/byteorder.h>
38#include <asm/page.h> 39#include <asm/page.h>
39#include <asm/uaccess.h> 40#include <asm/uaccess.h>
@@ -985,7 +986,7 @@ static DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
985 986
986static int et61x251_create_sysfs(struct et61x251_device* cam) 987static int et61x251_create_sysfs(struct et61x251_device* cam)
987{ 988{
988 struct device *classdev = &(cam->v4ldev->class_dev); 989 struct device *classdev = &(cam->v4ldev->dev);
989 int err = 0; 990 int err = 0;
990 991
991 if ((err = device_create_file(classdev, &dev_attr_reg))) 992 if ((err = device_create_file(classdev, &dev_attr_reg)))
@@ -2584,8 +2585,6 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
2584 } 2585 }
2585 2586
2586 strcpy(cam->v4ldev->name, "ET61X[12]51 PC Camera"); 2587 strcpy(cam->v4ldev->name, "ET61X[12]51 PC Camera");
2587 cam->v4ldev->owner = THIS_MODULE;
2588 cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES;
2589 cam->v4ldev->fops = &et61x251_fops; 2588 cam->v4ldev->fops = &et61x251_fops;
2590 cam->v4ldev->minor = video_nr[dev_nr]; 2589 cam->v4ldev->minor = video_nr[dev_nr];
2591 cam->v4ldev->release = video_device_release; 2590 cam->v4ldev->release = video_device_release;
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index 013d593b0c67..44b0bffeb20e 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -25,9 +25,6 @@
25#define CONEX_CAM 1 /* special JPEG header */ 25#define CONEX_CAM 1 /* special JPEG header */
26#include "jpeg.h" 26#include "jpeg.h"
27 27
28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
29static const char version[] = "2.1.7";
30
31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
32MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); 29MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver");
33MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
@@ -818,7 +815,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
818 struct cam *cam; 815 struct cam *cam;
819 816
820 cam = &gspca_dev->cam; 817 cam = &gspca_dev->cam;
821 cam->dev_name = (char *) id->driver_info;
822 cam->epaddr = 0x01; 818 cam->epaddr = 0x01;
823 cam->cam_mode = vga_mode; 819 cam->cam_mode = vga_mode;
824 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 820 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
@@ -1011,9 +1007,8 @@ static struct sd_desc sd_desc = {
1011}; 1007};
1012 1008
1013/* -- module initialisation -- */ 1009/* -- module initialisation -- */
1014#define DVNM(name) .driver_info = (kernel_ulong_t) name
1015static __devinitdata struct usb_device_id device_table[] = { 1010static __devinitdata struct usb_device_id device_table[] = {
1016 {USB_DEVICE(0x0572, 0x0041), DVNM("Creative Notebook cx11646")}, 1011 {USB_DEVICE(0x0572, 0x0041)},
1017 {} 1012 {}
1018}; 1013};
1019MODULE_DEVICE_TABLE(usb, device_table); 1014MODULE_DEVICE_TABLE(usb, device_table);
@@ -1038,7 +1033,7 @@ static int __init sd_mod_init(void)
1038{ 1033{
1039 if (usb_register(&sd_driver) < 0) 1034 if (usb_register(&sd_driver) < 0)
1040 return -1; 1035 return -1;
1041 PDEBUG(D_PROBE, "v%s registered", version); 1036 PDEBUG(D_PROBE, "registered");
1042 return 0; 1037 return 0;
1043} 1038}
1044static void __exit sd_mod_exit(void) 1039static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c
index 8ab4ea7201a9..c8c2f02fcf00 100644
--- a/drivers/media/video/gspca/etoms.c
+++ b/drivers/media/video/gspca/etoms.c
@@ -22,9 +22,6 @@
22 22
23#include "gspca.h" 23#include "gspca.h"
24 24
25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
26static const char version[] = "2.1.7";
27
28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 25MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
29MODULE_DESCRIPTION("Etoms USB Camera Driver"); 26MODULE_DESCRIPTION("Etoms USB Camera Driver");
30MODULE_LICENSE("GPL"); 27MODULE_LICENSE("GPL");
@@ -602,26 +599,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
602{ 599{
603 struct sd *sd = (struct sd *) gspca_dev; 600 struct sd *sd = (struct sd *) gspca_dev;
604 struct cam *cam; 601 struct cam *cam;
605 __u16 vendor; 602
606 __u16 product;
607
608 vendor = id->idVendor;
609 product = id->idProduct;
610/* switch (vendor) { */
611/* case 0x102c: * Etoms */
612 switch (product) {
613 case 0x6151:
614 sd->sensor = SENSOR_PAS106; /* Etoms61x151 */
615 break;
616 case 0x6251:
617 sd->sensor = SENSOR_TAS5130CXX; /* Etoms61x251 */
618 break;
619/* } */
620/* break; */
621 }
622 cam = &gspca_dev->cam; 603 cam = &gspca_dev->cam;
623 cam->dev_name = (char *) id->driver_info;
624 cam->epaddr = 1; 604 cam->epaddr = 1;
605 sd->sensor = id->driver_info;
625 if (sd->sensor == SENSOR_PAS106) { 606 if (sd->sensor == SENSOR_PAS106) {
626 cam->cam_mode = sif_mode; 607 cam->cam_mode = sif_mode;
627 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; 608 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
@@ -911,12 +892,11 @@ static struct sd_desc sd_desc = {
911}; 892};
912 893
913/* -- module initialisation -- */ 894/* -- module initialisation -- */
914#define DVNM(name) .driver_info = (kernel_ulong_t) name
915static __devinitdata struct usb_device_id device_table[] = { 895static __devinitdata struct usb_device_id device_table[] = {
916#ifndef CONFIG_USB_ET61X251 896#ifndef CONFIG_USB_ET61X251
917 {USB_DEVICE(0x102c, 0x6151), DVNM("Qcam Sangha CIF")}, 897 {USB_DEVICE(0x102c, 0x6151), .driver_info = SENSOR_PAS106},
918#endif 898#endif
919 {USB_DEVICE(0x102c, 0x6251), DVNM("Qcam xxxxxx VGA")}, 899 {USB_DEVICE(0x102c, 0x6251), .driver_info = SENSOR_TAS5130CXX},
920 {} 900 {}
921}; 901};
922 902
@@ -942,7 +922,7 @@ static int __init sd_mod_init(void)
942{ 922{
943 if (usb_register(&sd_driver) < 0) 923 if (usb_register(&sd_driver) < 0)
944 return -1; 924 return -1;
945 PDEBUG(D_PROBE, "v%s registered", version); 925 PDEBUG(D_PROBE, "registered");
946 return 0; 926 return 0;
947} 927}
948 928
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 16e367cec760..3a051c925ff6 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -32,6 +32,7 @@
32#include <asm/page.h> 32#include <asm/page.h>
33#include <linux/uaccess.h> 33#include <linux/uaccess.h>
34#include <linux/jiffies.h> 34#include <linux/jiffies.h>
35#include <media/v4l2-ioctl.h>
35 36
36#include "gspca.h" 37#include "gspca.h"
37 38
@@ -42,8 +43,7 @@ MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
42MODULE_DESCRIPTION("GSPCA USB Camera Driver"); 43MODULE_DESCRIPTION("GSPCA USB Camera Driver");
43MODULE_LICENSE("GPL"); 44MODULE_LICENSE("GPL");
44 45
45#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) 46#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 2, 0)
46static const char version[] = "2.1.7";
47 47
48static int video_nr = -1; 48static int video_nr = -1;
49 49
@@ -209,6 +209,8 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
209 &frame->v4l2_buf.timestamp); 209 &frame->v4l2_buf.timestamp);
210 frame->v4l2_buf.sequence = ++gspca_dev->sequence; 210 frame->v4l2_buf.sequence = ++gspca_dev->sequence;
211 } else if (gspca_dev->last_packet_type == DISCARD_PACKET) { 211 } else if (gspca_dev->last_packet_type == DISCARD_PACKET) {
212 if (packet_type == LAST_PACKET)
213 gspca_dev->last_packet_type = packet_type;
212 return frame; 214 return frame;
213 } 215 }
214 216
@@ -399,7 +401,7 @@ static struct usb_host_endpoint *alt_isoc(struct usb_host_interface *alt,
399 * This routine may be called many times when the bandwidth is too small 401 * This routine may be called many times when the bandwidth is too small
400 * (the bandwidth is checked on urb submit). 402 * (the bandwidth is checked on urb submit).
401 */ 403 */
402struct usb_host_endpoint *get_isoc_ep(struct gspca_dev *gspca_dev) 404static struct usb_host_endpoint *get_isoc_ep(struct gspca_dev *gspca_dev)
403{ 405{
404 struct usb_interface *intf; 406 struct usb_interface *intf;
405 struct usb_host_endpoint *ep; 407 struct usb_host_endpoint *ep;
@@ -832,7 +834,16 @@ static int vidioc_querycap(struct file *file, void *priv,
832 834
833 memset(cap, 0, sizeof *cap); 835 memset(cap, 0, sizeof *cap);
834 strncpy(cap->driver, gspca_dev->sd_desc->name, sizeof cap->driver); 836 strncpy(cap->driver, gspca_dev->sd_desc->name, sizeof cap->driver);
835 strncpy(cap->card, gspca_dev->cam.dev_name, sizeof cap->card); 837/* strncpy(cap->card, gspca_dev->cam.dev_name, sizeof cap->card); */
838 if (gspca_dev->dev->product != NULL) {
839 strncpy(cap->card, gspca_dev->dev->product,
840 sizeof cap->card);
841 } else {
842 snprintf(cap->card, sizeof cap->card,
843 "USB Camera (%04x:%04x)",
844 le16_to_cpu(gspca_dev->dev->descriptor.idVendor),
845 le16_to_cpu(gspca_dev->dev->descriptor.idProduct));
846 }
836 strncpy(cap->bus_info, gspca_dev->dev->bus->bus_name, 847 strncpy(cap->bus_info, gspca_dev->dev->bus->bus_name,
837 sizeof cap->bus_info); 848 sizeof cap->bus_info);
838 cap->version = DRIVER_VERSION_NUMBER; 849 cap->version = DRIVER_VERSION_NUMBER;
@@ -1649,12 +1660,7 @@ static struct file_operations dev_fops = {
1649 .poll = dev_poll, 1660 .poll = dev_poll,
1650}; 1661};
1651 1662
1652static struct video_device gspca_template = { 1663static const struct v4l2_ioctl_ops dev_ioctl_ops = {
1653 .name = "gspca main driver",
1654 .type = VID_TYPE_CAPTURE,
1655 .fops = &dev_fops,
1656 .release = dev_release, /* mandatory */
1657 .minor = -1,
1658 .vidioc_querycap = vidioc_querycap, 1664 .vidioc_querycap = vidioc_querycap,
1659 .vidioc_dqbuf = vidioc_dqbuf, 1665 .vidioc_dqbuf = vidioc_dqbuf,
1660 .vidioc_qbuf = vidioc_qbuf, 1666 .vidioc_qbuf = vidioc_qbuf,
@@ -1683,6 +1689,14 @@ static struct video_device gspca_template = {
1683#endif 1689#endif
1684}; 1690};
1685 1691
1692static struct video_device gspca_template = {
1693 .name = "gspca main driver",
1694 .fops = &dev_fops,
1695 .ioctl_ops = &dev_ioctl_ops,
1696 .release = dev_release, /* mandatory */
1697 .minor = -1,
1698};
1699
1686/* 1700/*
1687 * probe and create a new gspca device 1701 * probe and create a new gspca device
1688 * 1702 *
@@ -1740,10 +1754,11 @@ int gspca_dev_probe(struct usb_interface *intf,
1740 1754
1741 /* init video stuff */ 1755 /* init video stuff */
1742 memcpy(&gspca_dev->vdev, &gspca_template, sizeof gspca_template); 1756 memcpy(&gspca_dev->vdev, &gspca_template, sizeof gspca_template);
1743 gspca_dev->vdev.dev = &dev->dev; 1757 gspca_dev->vdev.parent = &dev->dev;
1744 memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops); 1758 memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops);
1745 gspca_dev->vdev.fops = &gspca_dev->fops; 1759 gspca_dev->vdev.fops = &gspca_dev->fops;
1746 gspca_dev->fops.owner = module; /* module protection */ 1760 gspca_dev->fops.owner = module; /* module protection */
1761 gspca_dev->present = 1;
1747 ret = video_register_device(&gspca_dev->vdev, 1762 ret = video_register_device(&gspca_dev->vdev,
1748 VFL_TYPE_GRABBER, 1763 VFL_TYPE_GRABBER,
1749 video_nr); 1764 video_nr);
@@ -1752,7 +1767,6 @@ int gspca_dev_probe(struct usb_interface *intf,
1752 goto out; 1767 goto out;
1753 } 1768 }
1754 1769
1755 gspca_dev->present = 1;
1756 usb_set_intfdata(intf, gspca_dev); 1770 usb_set_intfdata(intf, gspca_dev);
1757 PDEBUG(D_PROBE, "probe ok"); 1771 PDEBUG(D_PROBE, "probe ok");
1758 return 0; 1772 return 0;
@@ -1885,7 +1899,10 @@ EXPORT_SYMBOL(gspca_auto_gain_n_exposure);
1885/* -- module insert / remove -- */ 1899/* -- module insert / remove -- */
1886static int __init gspca_init(void) 1900static int __init gspca_init(void)
1887{ 1901{
1888 info("main v%s registered", version); 1902 info("main v%d.%d.%d registered",
1903 (DRIVER_VERSION_NUMBER >> 16) & 0xff,
1904 (DRIVER_VERSION_NUMBER >> 8) & 0xff,
1905 DRIVER_VERSION_NUMBER & 0xff);
1889 return 0; 1906 return 0;
1890} 1907}
1891static void __exit gspca_exit(void) 1908static void __exit gspca_exit(void)
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index 88c2b02f380a..21c4ee56a10a 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -24,9 +24,6 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -140,7 +137,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
140 struct cam *cam; 137 struct cam *cam;
141 138
142 cam = &gspca_dev->cam; 139 cam = &gspca_dev->cam;
143 cam->dev_name = (char *) id->driver_info;
144 cam->epaddr = 0x01; 140 cam->epaddr = 0x01;
145 cam->cam_mode = vga_mode; 141 cam->cam_mode = vga_mode;
146 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 142 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
@@ -424,9 +420,8 @@ static const struct sd_desc sd_desc = {
424}; 420};
425 421
426/* -- module initialisation -- */ 422/* -- module initialisation -- */
427#define DVNM(name) .driver_info = (kernel_ulong_t) name
428static const __devinitdata struct usb_device_id device_table[] = { 423static const __devinitdata struct usb_device_id device_table[] = {
429 {USB_DEVICE(0x093a, 0x050f), DVNM("Mars-Semi Pc-Camera")}, 424 {USB_DEVICE(0x093a, 0x050f)},
430 {} 425 {}
431}; 426};
432MODULE_DEVICE_TABLE(usb, device_table); 427MODULE_DEVICE_TABLE(usb, device_table);
@@ -451,7 +446,7 @@ static int __init sd_mod_init(void)
451{ 446{
452 if (usb_register(&sd_driver) < 0) 447 if (usb_register(&sd_driver) < 0)
453 return -1; 448 return -1;
454 PDEBUG(D_PROBE, "v%s registered", version); 449 PDEBUG(D_PROBE, "registered");
455 return 0; 450 return 0;
456} 451}
457static void __exit sd_mod_exit(void) 452static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
index 08d99c3b78e2..83139efc4629 100644
--- a/drivers/media/video/gspca/ov519.c
+++ b/drivers/media/video/gspca/ov519.c
@@ -24,9 +24,6 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); 27MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
31MODULE_DESCRIPTION("OV519 USB Camera Driver"); 28MODULE_DESCRIPTION("OV519 USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -1375,7 +1372,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
1375 cam->cam_mode = sif_mode; 1372 cam->cam_mode = sif_mode;
1376 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; 1373 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
1377 } 1374 }
1378 cam->dev_name = (char *) id->driver_info;
1379 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; 1375 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
1380 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; 1376 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
1381 sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; 1377 sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
@@ -2129,21 +2125,20 @@ static const struct sd_desc sd_desc = {
2129}; 2125};
2130 2126
2131/* -- module initialisation -- */ 2127/* -- module initialisation -- */
2132#define DVNM(name) .driver_info = (kernel_ulong_t) name
2133static const __devinitdata struct usb_device_id device_table[] = { 2128static const __devinitdata struct usb_device_id device_table[] = {
2134 {USB_DEVICE(0x041e, 0x4052), DVNM("Creative Live! VISTA IM")}, 2129 {USB_DEVICE(0x041e, 0x4052)},
2135 {USB_DEVICE(0x041e, 0x405f), DVNM("Creative Live! VISTA VF0330")}, 2130 {USB_DEVICE(0x041e, 0x405f)},
2136 {USB_DEVICE(0x041e, 0x4060), DVNM("Creative Live! VISTA VF0350")}, 2131 {USB_DEVICE(0x041e, 0x4060)},
2137 {USB_DEVICE(0x041e, 0x4061), DVNM("Creative Live! VISTA VF0400")}, 2132 {USB_DEVICE(0x041e, 0x4061)},
2138 {USB_DEVICE(0x041e, 0x4064), DVNM("Creative Live! VISTA VF0420")}, 2133 {USB_DEVICE(0x041e, 0x4064)},
2139 {USB_DEVICE(0x041e, 0x4068), DVNM("Creative Live! VISTA VF0470")}, 2134 {USB_DEVICE(0x041e, 0x4068)},
2140 {USB_DEVICE(0x045e, 0x028c), DVNM("Microsoft xbox cam")}, 2135 {USB_DEVICE(0x045e, 0x028c)},
2141 {USB_DEVICE(0x054c, 0x0154), DVNM("Sonny toy4")}, 2136 {USB_DEVICE(0x054c, 0x0154)},
2142 {USB_DEVICE(0x054c, 0x0155), DVNM("Sonny toy5")}, 2137 {USB_DEVICE(0x054c, 0x0155)},
2143 {USB_DEVICE(0x05a9, 0x0519), DVNM("OmniVision")}, 2138 {USB_DEVICE(0x05a9, 0x0519)},
2144 {USB_DEVICE(0x05a9, 0x0530), DVNM("OmniVision")}, 2139 {USB_DEVICE(0x05a9, 0x0530)},
2145 {USB_DEVICE(0x05a9, 0x4519), DVNM("OmniVision")}, 2140 {USB_DEVICE(0x05a9, 0x4519)},
2146 {USB_DEVICE(0x05a9, 0x8519), DVNM("OmniVision")}, 2141 {USB_DEVICE(0x05a9, 0x8519)},
2147 {} 2142 {}
2148}; 2143};
2149#undef DVNAME 2144#undef DVNAME
@@ -2169,7 +2164,7 @@ static int __init sd_mod_init(void)
2169{ 2164{
2170 if (usb_register(&sd_driver) < 0) 2165 if (usb_register(&sd_driver) < 0)
2171 return -1; 2166 return -1;
2172 PDEBUG(D_PROBE, "v%s registered", version); 2167 PDEBUG(D_PROBE, "registered");
2173 return 0; 2168 return 0;
2174} 2169}
2175static void __exit sd_mod_exit(void) 2170static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c
index fa7abc411090..7ef18d578811 100644
--- a/drivers/media/video/gspca/pac207.c
+++ b/drivers/media/video/gspca/pac207.c
@@ -27,9 +27,6 @@
27 27
28#include "gspca.h" 28#include "gspca.h"
29 29
30#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
31static const char version[] = "2.1.7";
32
33MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); 30MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>");
34MODULE_DESCRIPTION("Pixart PAC207"); 31MODULE_DESCRIPTION("Pixart PAC207");
35MODULE_LICENSE("GPL"); 32MODULE_LICENSE("GPL");
@@ -208,7 +205,7 @@ static int pac207_write_regs(struct gspca_dev *gspca_dev, u16 index,
208} 205}
209 206
210 207
211int pac207_write_reg(struct gspca_dev *gspca_dev, u16 index, u16 value) 208static int pac207_write_reg(struct gspca_dev *gspca_dev, u16 index, u16 value)
212{ 209{
213 struct usb_device *udev = gspca_dev->dev; 210 struct usb_device *udev = gspca_dev->dev;
214 int err; 211 int err;
@@ -223,8 +220,7 @@ int pac207_write_reg(struct gspca_dev *gspca_dev, u16 index, u16 value)
223 return err; 220 return err;
224} 221}
225 222
226 223static int pac207_read_reg(struct gspca_dev *gspca_dev, u16 index)
227int pac207_read_reg(struct gspca_dev *gspca_dev, u16 index)
228{ 224{
229 struct usb_device *udev = gspca_dev->dev; 225 struct usb_device *udev = gspca_dev->dev;
230 int res; 226 int res;
@@ -574,17 +570,16 @@ static const struct sd_desc sd_desc = {
574}; 570};
575 571
576/* -- module initialisation -- */ 572/* -- module initialisation -- */
577#define DVNM(name) .driver_info = (kernel_ulong_t) name
578static const __devinitdata struct usb_device_id device_table[] = { 573static const __devinitdata struct usb_device_id device_table[] = {
579 {USB_DEVICE(0x041e, 0x4028), DVNM("Creative Webcam Vista Plus")}, 574 {USB_DEVICE(0x041e, 0x4028)},
580 {USB_DEVICE(0x093a, 0x2460), DVNM("Q-Tec Webcam 100")}, 575 {USB_DEVICE(0x093a, 0x2460)},
581 {USB_DEVICE(0x093a, 0x2463), DVNM("Philips spc200nc pac207")}, 576 {USB_DEVICE(0x093a, 0x2463)},
582 {USB_DEVICE(0x093a, 0x2464), DVNM("Labtec Webcam 1200")}, 577 {USB_DEVICE(0x093a, 0x2464)},
583 {USB_DEVICE(0x093a, 0x2468), DVNM("PAC207")}, 578 {USB_DEVICE(0x093a, 0x2468)},
584 {USB_DEVICE(0x093a, 0x2470), DVNM("Genius GF112")}, 579 {USB_DEVICE(0x093a, 0x2470)},
585 {USB_DEVICE(0x093a, 0x2471), DVNM("Genius VideoCam GE111")}, 580 {USB_DEVICE(0x093a, 0x2471)},
586 {USB_DEVICE(0x093a, 0x2472), DVNM("Genius VideoCam GE110")}, 581 {USB_DEVICE(0x093a, 0x2472)},
587 {USB_DEVICE(0x2001, 0xf115), DVNM("D-Link DSB-C120")}, 582 {USB_DEVICE(0x2001, 0xf115)},
588 {} 583 {}
589}; 584};
590MODULE_DEVICE_TABLE(usb, device_table); 585MODULE_DEVICE_TABLE(usb, device_table);
@@ -609,7 +604,7 @@ static int __init sd_mod_init(void)
609{ 604{
610 if (usb_register(&sd_driver) < 0) 605 if (usb_register(&sd_driver) < 0)
611 return -1; 606 return -1;
612 PDEBUG(D_PROBE, "v%s registered", version); 607 PDEBUG(D_PROBE, "registered");
613 return 0; 608 return 0;
614} 609}
615static void __exit sd_mod_exit(void) 610static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index 5c052e31be4a..ea3d7021f401 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -23,9 +23,6 @@
23 23
24#include "gspca.h" 24#include "gspca.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
27static const char version[] = "2.1.7";
28
29MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); 26MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li");
30MODULE_DESCRIPTION("Pixart PAC7311"); 27MODULE_DESCRIPTION("Pixart PAC7311");
31MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
@@ -266,7 +263,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
266 reg_w(gspca_dev, 0x3e, 0x20); 263 reg_w(gspca_dev, 0x3e, 0x20);
267 264
268 cam = &gspca_dev->cam; 265 cam = &gspca_dev->cam;
269 cam->dev_name = (char *) id->driver_info;
270 cam->epaddr = 0x05; 266 cam->epaddr = 0x05;
271 cam->cam_mode = vga_mode; 267 cam->cam_mode = vga_mode;
272 cam->nmodes = ARRAY_SIZE(vga_mode); 268 cam->nmodes = ARRAY_SIZE(vga_mode);
@@ -713,16 +709,14 @@ static struct sd_desc sd_desc = {
713}; 709};
714 710
715/* -- module initialisation -- */ 711/* -- module initialisation -- */
716#define DVNM(name) .driver_info = (kernel_ulong_t) name
717static __devinitdata struct usb_device_id device_table[] = { 712static __devinitdata struct usb_device_id device_table[] = {
718 {USB_DEVICE(0x093a, 0x2600), DVNM("Typhoon")}, 713 {USB_DEVICE(0x093a, 0x2600)},
719 {USB_DEVICE(0x093a, 0x2601), DVNM("Philips SPC610NC")}, 714 {USB_DEVICE(0x093a, 0x2601)},
720 {USB_DEVICE(0x093a, 0x2603), DVNM("PAC7312")}, 715 {USB_DEVICE(0x093a, 0x2603)},
721 {USB_DEVICE(0x093a, 0x2608), DVNM("Trust WB-3300p")}, 716 {USB_DEVICE(0x093a, 0x2608)},
722 {USB_DEVICE(0x093a, 0x260e), DVNM("Gigaware VGA PC Camera")}, 717 {USB_DEVICE(0x093a, 0x260e)},
723 /* and also ', Trust WB-3350p, SIGMA cam 2350' */ 718 {USB_DEVICE(0x093a, 0x260f)},
724 {USB_DEVICE(0x093a, 0x260f), DVNM("SnakeCam")}, 719 {USB_DEVICE(0x093a, 0x2621)},
725 {USB_DEVICE(0x093a, 0x2621), DVNM("PAC731x")},
726 {} 720 {}
727}; 721};
728MODULE_DEVICE_TABLE(usb, device_table); 722MODULE_DEVICE_TABLE(usb, device_table);
@@ -747,7 +741,7 @@ static int __init sd_mod_init(void)
747{ 741{
748 if (usb_register(&sd_driver) < 0) 742 if (usb_register(&sd_driver) < 0)
749 return -1; 743 return -1;
750 PDEBUG(D_PROBE, "v%s registered", version); 744 PDEBUG(D_PROBE, "registered");
751 return 0; 745 return 0;
752} 746}
753static void __exit sd_mod_exit(void) 747static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index dbeebe8625c5..e18748c5a14d 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -24,9 +24,6 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 8)
28static const char version[] = "2.1.8";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -44,25 +41,29 @@ struct sd {
44 unsigned char brightness; 41 unsigned char brightness;
45 unsigned char autogain; 42 unsigned char autogain;
46 unsigned char autogain_ignore_frames; 43 unsigned char autogain_ignore_frames;
44 unsigned char frames_to_drop;
47 unsigned char freq; /* light freq filter setting */ 45 unsigned char freq; /* light freq filter setting */
48 unsigned char saturation;
49 unsigned char hue;
50 unsigned char contrast;
51 46
52 unsigned char fr_h_sz; /* size of frame header */ 47 unsigned char fr_h_sz; /* size of frame header */
53 char sensor; /* Type of image sensor chip */ 48 char sensor; /* Type of image sensor chip */
54#define SENSOR_HV7131R 0 49#define SENSOR_HV7131R 0
55#define SENSOR_OV6650 1 50#define SENSOR_OV6650 1
56#define SENSOR_OV7630 2 51#define SENSOR_OV7630 2
57#define SENSOR_OV7630_3 3 52#define SENSOR_PAS106 3
58#define SENSOR_PAS106 4 53#define SENSOR_PAS202 4
59#define SENSOR_PAS202 5 54#define SENSOR_TAS5110 5
60#define SENSOR_TAS5110 6 55#define SENSOR_TAS5130CXX 6
61#define SENSOR_TAS5130CXX 7
62 char sensor_has_gain; 56 char sensor_has_gain;
63 __u8 sensor_addr; 57 __u8 sensor_addr;
58 __u8 reg11;
64}; 59};
65 60
61/* flags used in the device id table */
62#define F_GAIN 0x01 /* has gain */
63#define F_AUTO 0x02 /* has autogain */
64#define F_SIF 0x04 /* sif or vga */
65#define F_H18 0x08 /* long (18 b) or short (12 b) frame header */
66
66#define COMP2 0x8f 67#define COMP2 0x8f
67#define COMP 0xc7 /* 0x87 //0x07 */ 68#define COMP 0xc7 /* 0x87 //0x07 */
68#define COMP1 0xc9 /* 0x89 //0x09 */ 69#define COMP1 0xc9 /* 0x89 //0x09 */
@@ -92,12 +93,6 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
92static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); 93static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
93static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); 94static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
94static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); 95static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
95static int sd_setsaturation(struct gspca_dev *gspca_dev, __s32 val);
96static int sd_getsaturation(struct gspca_dev *gspca_dev, __s32 *val);
97static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val);
98static int sd_gethue(struct gspca_dev *gspca_dev, __s32 *val);
99static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
100static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
101 96
102static struct ctrl sd_ctrls[] = { 97static struct ctrl sd_ctrls[] = {
103 { 98 {
@@ -174,48 +169,6 @@ static struct ctrl sd_ctrls[] = {
174 .set = sd_setfreq, 169 .set = sd_setfreq,
175 .get = sd_getfreq, 170 .get = sd_getfreq,
176 }, 171 },
177 {
178 {
179 .id = V4L2_CID_SATURATION,
180 .type = V4L2_CTRL_TYPE_INTEGER,
181 .name = "Saturation",
182 .minimum = 0,
183 .maximum = 255,
184 .step = 1,
185#define SATURATION_DEF 127
186 .default_value = SATURATION_DEF,
187 },
188 .set = sd_setsaturation,
189 .get = sd_getsaturation,
190 },
191 {
192 {
193 .id = V4L2_CID_HUE,
194 .type = V4L2_CTRL_TYPE_INTEGER,
195 .name = "Hue",
196 .minimum = 0,
197 .maximum = 255,
198 .step = 1,
199#define HUE_DEF 127
200 .default_value = HUE_DEF,
201 },
202 .set = sd_sethue,
203 .get = sd_gethue,
204 },
205 {
206 {
207 .id = V4L2_CID_CONTRAST,
208 .type = V4L2_CTRL_TYPE_INTEGER,
209 .name = "Contrast",
210 .minimum = 0,
211 .maximum = 255,
212 .step = 1,
213#define CONTRAST_DEF 127
214 .default_value = CONTRAST_DEF,
215 },
216 .set = sd_setcontrast,
217 .get = sd_getcontrast,
218 },
219}; 172};
220 173
221static struct v4l2_pix_format vga_mode[] = { 174static struct v4l2_pix_format vga_mode[] = {
@@ -248,8 +201,6 @@ static struct v4l2_pix_format sif_mode[] = {
248 .priv = 0}, 201 .priv = 0},
249}; 202};
250 203
251static const __u8 probe_ov7630[] = {0x08, 0x44};
252
253static const __u8 initHv7131[] = { 204static const __u8 initHv7131[] = {
254 0x46, 0x77, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00, 205 0x46, 0x77, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00,
255 0x00, 0x00, 206 0x00, 0x00,
@@ -321,7 +272,7 @@ static const __u8 initOv7630_3[] = {
321 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, /* r21 .. r28 */ 272 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, /* r21 .. r28 */
322 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff /* r29 .. r30 */ 273 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff /* r29 .. r30 */
323}; 274};
324static const __u8 ov7630_sensor_init_com[][8] = { 275static const __u8 ov7630_sensor_init[][8] = {
325 {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, 276 {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
326 {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10}, 277 {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10},
327/* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */ 278/* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */
@@ -342,17 +293,6 @@ static const __u8 ov7630_sensor_init_com[][8] = {
342 {0xa0, 0x21, 0x7d, 0xf7, 0x8e, 0x00, 0x30, 0x10}, 293 {0xa0, 0x21, 0x7d, 0xf7, 0x8e, 0x00, 0x30, 0x10},
343 {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10}, 294 {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10},
344}; 295};
345static const __u8 ov7630_sensor_init[][8] = {
346 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 200ms */
347 {0xa0, 0x21, 0x11, 0x01, 0xbd, 0x06, 0xf6, 0x10}, /* jfm */
348 {0xa0, 0x21, 0x10, 0x57, 0xbd, 0x06, 0xf6, 0x16},
349 {0xa0, 0x21, 0x76, 0x02, 0xbd, 0x06, 0xf6, 0x16},
350 {0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */
351};
352static const __u8 ov7630_sensor_init_3[][8] = {
353 {0xa0, 0x21, 0x2a, 0xa0, 0x00, 0x00, 0x00, 0x10},
354 {0xa0, 0x21, 0x2a, 0x80, 0x00, 0x00, 0x00, 0x10},
355};
356 296
357static const __u8 initPas106[] = { 297static const __u8 initPas106[] = {
358 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00, 298 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00,
@@ -542,7 +482,6 @@ static void setbrightness(struct gspca_dev *gspca_dev)
542 482
543 switch (sd->sensor) { 483 switch (sd->sensor) {
544 case SENSOR_OV6650: 484 case SENSOR_OV6650:
545 case SENSOR_OV7630_3:
546 case SENSOR_OV7630: { 485 case SENSOR_OV7630: {
547 __u8 i2cOV[] = 486 __u8 i2cOV[] =
548 {0xa0, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}; 487 {0xa0, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10};
@@ -635,7 +574,7 @@ static void setsensorgain(struct gspca_dev *gspca_dev)
635 case SENSOR_OV6650: 574 case SENSOR_OV6650:
636 gain >>= 1; 575 gain >>= 1;
637 /* fall thru */ 576 /* fall thru */
638 case SENSOR_OV7630_3: { 577 case SENSOR_OV7630: {
639 __u8 i2c[] = {0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}; 578 __u8 i2c[] = {0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10};
640 579
641 i2c[1] = sd->sensor_addr; 580 i2c[1] = sd->sensor_addr;
@@ -690,7 +629,7 @@ static void setexposure(struct gspca_dev *gspca_dev)
690 break; 629 break;
691 } 630 }
692 case SENSOR_OV6650: 631 case SENSOR_OV6650:
693 case SENSOR_OV7630_3: { 632 case SENSOR_OV7630: {
694 /* The ov6650 / ov7630 have 2 registers which both influence 633 /* The ov6650 / ov7630 have 2 registers which both influence
695 exposure, register 11, whose low nibble sets the nr off fps 634 exposure, register 11, whose low nibble sets the nr off fps
696 according to: fps = 30 / (low_nibble + 1) 635 according to: fps = 30 / (low_nibble + 1)
@@ -705,16 +644,20 @@ static void setexposure(struct gspca_dev *gspca_dev)
705 The code maps our 0 - 510 ms exposure ctrl to these 2 644 The code maps our 0 - 510 ms exposure ctrl to these 2
706 registers, trying to keep fps as high as possible. 645 registers, trying to keep fps as high as possible.
707 */ 646 */
708 __u8 i2c[] = {0xb0, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x00, 0x10}; 647 __u8 i2c[] = {0xb0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10};
709 int reg10, reg11; 648 int reg10, reg11, reg10_max;
649
710 /* ov6645 datasheet says reg10_max is 9a, but that uses 650 /* ov6645 datasheet says reg10_max is 9a, but that uses
711 tline * 2 * reg10 as formula for calculating texpo, the 651 tline * 2 * reg10 as formula for calculating texpo, the
712 ov6650 probably uses the same formula as the 7730 which uses 652 ov6650 probably uses the same formula as the 7730 which uses
713 tline * 4 * reg10, which explains why the reg10max we've 653 tline * 4 * reg10, which explains why the reg10max we've
714 found experimentally for the ov6650 is exactly half that of 654 found experimentally for the ov6650 is exactly half that of
715 the ov6645. The ov7630 datasheet says the max is 0x41. */ 655 the ov6645. The ov7630 datasheet says the max is 0x41. */
716 const int reg10_max = (sd->sensor == SENSOR_OV6650) 656 if (sd->sensor == SENSOR_OV6650) {
717 ? 0x4d : 0x41; 657 reg10_max = 0x4d;
658 i2c[4] = 0xc0; /* OV6650 needs non default vsync pol */
659 } else
660 reg10_max = 0x41;
718 661
719 reg11 = (60 * sd->exposure + 999) / 1000; 662 reg11 = (60 * sd->exposure + 999) / 1000;
720 if (reg11 < 1) 663 if (reg11 < 1)
@@ -735,20 +678,23 @@ static void setexposure(struct gspca_dev *gspca_dev)
735 else if (reg10 > reg10_max) 678 else if (reg10 > reg10_max)
736 reg10 = reg10_max; 679 reg10 = reg10_max;
737 680
681 /* In 640x480, if the reg11 has less than 3, the image is
682 unstable (not enough bandwidth). */
683 if (gspca_dev->width == 640 && reg11 < 3)
684 reg11 = 3;
685
738 /* Write reg 10 and reg11 low nibble */ 686 /* Write reg 10 and reg11 low nibble */
739 i2c[1] = sd->sensor_addr; 687 i2c[1] = sd->sensor_addr;
740 i2c[3] = reg10; 688 i2c[3] = reg10;
741 i2c[4] |= reg11 - 1; 689 i2c[4] |= reg11 - 1;
742 if (sd->sensor == SENSOR_OV7630_3) { 690
743 __u8 reg76 = reg10 & 0x03; 691 /* If register 11 didn't change, don't change it */
744 __u8 i2c_reg76[] = {0xa0, 0x21, 0x76, 0x00, 692 if (sd->reg11 == reg11 )
745 0x00, 0x00, 0x00, 0x10}; 693 i2c[0] = 0xa0;
746 reg10 >>= 2; 694
747 i2c_reg76[3] = reg76; 695 if (i2c_w(gspca_dev, i2c) == 0)
748 if (i2c_w(gspca_dev, i2c_reg76) < 0) 696 sd->reg11 = reg11;
749 PDEBUG(D_ERR, "i2c error exposure"); 697 else
750 }
751 if (i2c_w(gspca_dev, i2c) < 0)
752 PDEBUG(D_ERR, "i2c error exposure"); 698 PDEBUG(D_ERR, "i2c error exposure");
753 break; 699 break;
754 } 700 }
@@ -761,11 +707,11 @@ static void setfreq(struct gspca_dev *gspca_dev)
761 707
762 switch (sd->sensor) { 708 switch (sd->sensor) {
763 case SENSOR_OV6650: 709 case SENSOR_OV6650:
764 case SENSOR_OV7630_3: { 710 case SENSOR_OV7630: {
765 /* Framerate adjust register for artificial light 50 hz flicker 711 /* Framerate adjust register for artificial light 50 hz flicker
766 compensation, identical to ov6630 0x2b register, see ov6630 712 compensation, for the ov6650 this is identical to ov6630
767 datasheet. 713 0x2b register, see ov6630 datasheet.
768 0x4f -> (30 fps -> 25 fps), 0x00 -> no adjustment */ 714 0x4f / 0x8a -> (30 fps -> 25 fps), 0x00 -> no adjustment */
769 __u8 i2c[] = {0xa0, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}; 715 __u8 i2c[] = {0xa0, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10};
770 switch (sd->freq) { 716 switch (sd->freq) {
771 default: 717 default:
@@ -786,69 +732,6 @@ static void setfreq(struct gspca_dev *gspca_dev)
786 } 732 }
787} 733}
788 734
789static void setsaturation(struct gspca_dev *gspca_dev)
790{
791 struct sd *sd = (struct sd *) gspca_dev;
792
793 switch (sd->sensor) {
794/* case SENSOR_OV6650: */
795 case SENSOR_OV7630_3:
796 case SENSOR_OV7630: {
797 __u8 i2c[] = {0xa0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10};
798 i2c[1] = sd->sensor_addr;
799 i2c[3] = sd->saturation & 0xf0;
800 if (i2c_w(gspca_dev, i2c) < 0)
801 PDEBUG(D_ERR, "i2c error setsaturation");
802 else
803 PDEBUG(D_CONF, "saturation set to: %d",
804 (int)sd->saturation);
805 break;
806 }
807 }
808}
809
810static void sethue(struct gspca_dev *gspca_dev)
811{
812 struct sd *sd = (struct sd *) gspca_dev;
813
814 switch (sd->sensor) {
815/* case SENSOR_OV6650: */
816 case SENSOR_OV7630_3:
817 case SENSOR_OV7630: {
818 __u8 i2c[] = {0xa0, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10};
819 i2c[1] = sd->sensor_addr;
820 i2c[3] = 0x20 | (sd->hue >> 3);
821 if (i2c_w(gspca_dev, i2c) < 0)
822 PDEBUG(D_ERR, "i2c error setsaturation");
823 else
824 PDEBUG(D_CONF, "hue set to: %d", (int)sd->hue);
825 break;
826 }
827 }
828}
829
830static void setcontrast(struct gspca_dev *gspca_dev)
831{
832 struct sd *sd = (struct sd *) gspca_dev;
833
834 switch (sd->sensor) {
835/* case SENSOR_OV6650: */
836 case SENSOR_OV7630_3:
837 case SENSOR_OV7630: {
838 __u8 i2c[] = {0xa0, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10};
839 i2c[1] = sd->sensor_addr;
840 i2c[3] = 0x20 | (sd->contrast >> 3);
841 if (i2c_w(gspca_dev, i2c) < 0)
842 PDEBUG(D_ERR, "i2c error setcontrast");
843 else
844 PDEBUG(D_CONF, "contrast set to: %d",
845 (int)sd->contrast);
846 break;
847 }
848 }
849}
850
851
852static void do_autogain(struct gspca_dev *gspca_dev) 735static void do_autogain(struct gspca_dev *gspca_dev)
853{ 736{
854 struct sd *sd = (struct sd *) gspca_dev; 737 struct sd *sd = (struct sd *) gspca_dev;
@@ -874,88 +757,32 @@ static int sd_config(struct gspca_dev *gspca_dev,
874{ 757{
875 struct sd *sd = (struct sd *) gspca_dev; 758 struct sd *sd = (struct sd *) gspca_dev;
876 struct cam *cam; 759 struct cam *cam;
877 __u16 product;
878 int sif = 0; 760 int sif = 0;
879 761
880 /* nctrls depends upon the sensor, so we use a per cam copy */ 762 /* nctrls depends upon the sensor, so we use a per cam copy */
881 memcpy(&sd->sd_desc, gspca_dev->sd_desc, sizeof(struct sd_desc)); 763 memcpy(&sd->sd_desc, gspca_dev->sd_desc, sizeof(struct sd_desc));
882 gspca_dev->sd_desc = &sd->sd_desc; 764 gspca_dev->sd_desc = &sd->sd_desc;
883 765
884 sd->fr_h_sz = 12; /* default size of the frame header */ 766 /* copy the webcam info from the device id */
885 sd->sd_desc.nctrls = 2; /* default nb of ctrls */ 767 sd->sensor = (id->driver_info >> 24) & 0xff;
886 sd->autogain = AUTOGAIN_DEF; /* default is autogain active */ 768 if (id->driver_info & (F_GAIN << 16))
887 769 sd->sensor_has_gain = 1;
888 product = id->idProduct; 770 if (id->driver_info & (F_AUTO << 16))
889/* switch (id->idVendor) { */ 771 sd->sd_desc.dq_callback = do_autogain;
890/* case 0x0c45: * Sonix */ 772 if (id->driver_info & (F_SIF << 16))
891 switch (product) { 773 sif = 1;
892 case 0x6001: /* SN9C102 */ 774 if (id->driver_info & (F_H18 << 16))
893 case 0x6005: /* SN9C101 */ 775 sd->fr_h_sz = 18; /* size of frame header */
894 case 0x6007: /* SN9C101 */ 776 else
895 sd->sensor = SENSOR_TAS5110; 777 sd->fr_h_sz = 12;
896 sd->sensor_has_gain = 1; 778 sd->sd_desc.nctrls = (id->driver_info >> 8) & 0xff;
897 sd->sd_desc.nctrls = 4; 779 sd->sensor_addr = id->driver_info & 0xff;
898 sd->sd_desc.dq_callback = do_autogain;
899 sif = 1;
900 break;
901 case 0x6009: /* SN9C101 */
902 case 0x600d: /* SN9C101 */
903 case 0x6029: /* SN9C101 */
904 sd->sensor = SENSOR_PAS106;
905 sif = 1;
906 break;
907 case 0x6011: /* SN9C101 - SN9C101G */
908 sd->sensor = SENSOR_OV6650;
909 sd->sensor_has_gain = 1;
910 sd->sensor_addr = 0x60;
911 sd->sd_desc.nctrls = 5;
912 sd->sd_desc.dq_callback = do_autogain;
913 sif = 1;
914 break;
915 case 0x6019: /* SN9C101 */
916 case 0x602c: /* SN9C102 */
917 case 0x602e: /* SN9C102 */
918 sd->sensor = SENSOR_OV7630;
919 sd->sensor_addr = 0x21;
920 break;
921 case 0x60b0: /* SN9C103 */
922 sd->sensor = SENSOR_OV7630_3;
923 sd->sensor_addr = 0x21;
924 sd->fr_h_sz = 18; /* size of frame header */
925 sd->sensor_has_gain = 1;
926 sd->sd_desc.nctrls = 8;
927 sd->sd_desc.dq_callback = do_autogain;
928 sd->autogain = 0;
929 break;
930 case 0x6024: /* SN9C102 */
931 case 0x6025: /* SN9C102 */
932 sd->sensor = SENSOR_TAS5130CXX;
933 break;
934 case 0x6028: /* SN9C102 */
935 sd->sensor = SENSOR_PAS202;
936 break;
937 case 0x602d: /* SN9C102 */
938 sd->sensor = SENSOR_HV7131R;
939 break;
940 case 0x60af: /* SN9C103 */
941 sd->sensor = SENSOR_PAS202;
942 sd->fr_h_sz = 18; /* size of frame header (?) */
943 break;
944 }
945/* break; */
946/* } */
947 780
948 cam = &gspca_dev->cam; 781 cam = &gspca_dev->cam;
949 cam->dev_name = (char *) id->driver_info;
950 cam->epaddr = 0x01; 782 cam->epaddr = 0x01;
951 if (!sif) { 783 if (!sif) {
952 cam->cam_mode = vga_mode; 784 cam->cam_mode = vga_mode;
953 cam->nmodes = ARRAY_SIZE(vga_mode); 785 cam->nmodes = ARRAY_SIZE(vga_mode);
954 if (sd->sensor == SENSOR_OV7630_3) {
955 /* We only have 320x240 & 640x480 */
956 cam->cam_mode++;
957 cam->nmodes--;
958 }
959 } else { 786 } else {
960 cam->cam_mode = sif_mode; 787 cam->cam_mode = sif_mode;
961 cam->nmodes = ARRAY_SIZE(sif_mode); 788 cam->nmodes = ARRAY_SIZE(sif_mode);
@@ -963,12 +790,9 @@ static int sd_config(struct gspca_dev *gspca_dev,
963 sd->brightness = BRIGHTNESS_DEF; 790 sd->brightness = BRIGHTNESS_DEF;
964 sd->gain = GAIN_DEF; 791 sd->gain = GAIN_DEF;
965 sd->exposure = EXPOSURE_DEF; 792 sd->exposure = EXPOSURE_DEF;
793 sd->autogain = AUTOGAIN_DEF;
966 sd->freq = FREQ_DEF; 794 sd->freq = FREQ_DEF;
967 sd->contrast = CONTRAST_DEF; 795
968 sd->saturation = SATURATION_DEF;
969 sd->hue = HUE_DEF;
970 if (sd->sensor == SENSOR_OV7630_3) /* jfm: from win trace */
971 reg_w(gspca_dev, 0x01, probe_ov7630, sizeof probe_ov7630);
972 return 0; 796 return 0;
973} 797}
974 798
@@ -1002,9 +826,8 @@ static void pas106_i2cinit(struct gspca_dev *gspca_dev)
1002static void sd_start(struct gspca_dev *gspca_dev) 826static void sd_start(struct gspca_dev *gspca_dev)
1003{ 827{
1004 struct sd *sd = (struct sd *) gspca_dev; 828 struct sd *sd = (struct sd *) gspca_dev;
1005 int mode, l; 829 int mode, l = 0x1f;
1006 const __u8 *sn9c10x; 830 const __u8 *sn9c10x;
1007 __u8 reg01, reg17;
1008 __u8 reg17_19[3]; 831 __u8 reg17_19[3];
1009 832
1010 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; 833 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
@@ -1022,13 +845,11 @@ static void sd_start(struct gspca_dev *gspca_dev)
1022 reg17_19[2] = 0x20; 845 reg17_19[2] = 0x20;
1023 break; 846 break;
1024 case SENSOR_OV7630: 847 case SENSOR_OV7630:
1025 sn9c10x = initOv7630; 848 if (sd->fr_h_sz == 18) { /* SN9C103 */
1026 reg17_19[0] = 0x68; 849 sn9c10x = initOv7630_3;
1027 reg17_19[1] = (mode << 4) | COMP2; 850 l = sizeof initOv7630_3;
1028 reg17_19[2] = MCK_INIT1; 851 } else
1029 break; 852 sn9c10x = initOv7630;
1030 case SENSOR_OV7630_3:
1031 sn9c10x = initOv7630_3;
1032 reg17_19[0] = 0x68; 853 reg17_19[0] = 0x68;
1033 reg17_19[1] = (mode << 4) | COMP2; 854 reg17_19[1] = (mode << 4) | COMP2;
1034 reg17_19[2] = MCK_INIT1; 855 reg17_19[2] = MCK_INIT1;
@@ -1059,30 +880,11 @@ static void sd_start(struct gspca_dev *gspca_dev)
1059 reg17_19[2] = mode ? 0x23 : 0x43; 880 reg17_19[2] = mode ? 0x23 : 0x43;
1060 break; 881 break;
1061 } 882 }
1062 switch (sd->sensor) {
1063 case SENSOR_OV7630:
1064 reg01 = 0x06;
1065 reg17 = 0x29;
1066 l = sizeof initOv7630;
1067 break;
1068 case SENSOR_OV7630_3:
1069 reg01 = 0x44;
1070 reg17 = 0x68;
1071 l = sizeof initOv7630_3;
1072 break;
1073 default:
1074 reg01 = sn9c10x[0];
1075 reg17 = sn9c10x[0x17 - 1];
1076 l = 0x1f;
1077 break;
1078 }
1079 883
1080 /* reg 0x01 bit 2 video transfert on */ 884 /* reg 0x01 bit 2 video transfert on */
1081 reg_w(gspca_dev, 0x01, &reg01, 1); 885 reg_w(gspca_dev, 0x01, &sn9c10x[0x01 - 1], 1);
1082 /* reg 0x17 SensorClk enable inv Clk 0x60 */ 886 /* reg 0x17 SensorClk enable inv Clk 0x60 */
1083 reg_w(gspca_dev, 0x17, &reg17, 1); 887 reg_w(gspca_dev, 0x17, &sn9c10x[0x17 - 1], 1);
1084/*fixme: for ov7630 102
1085 reg_w(gspca_dev, 0x01, {0x06, sn9c10x[1]}, 2); */
1086 /* Set the registers from the template */ 888 /* Set the registers from the template */
1087 reg_w_big(gspca_dev, 0x01, sn9c10x, l); 889 reg_w_big(gspca_dev, 0x01, sn9c10x, l);
1088 switch (sd->sensor) { 890 switch (sd->sensor) {
@@ -1095,17 +897,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
1095 sizeof ov6650_sensor_init); 897 sizeof ov6650_sensor_init);
1096 break; 898 break;
1097 case SENSOR_OV7630: 899 case SENSOR_OV7630:
1098 i2c_w_vector(gspca_dev, ov7630_sensor_init_com,
1099 sizeof ov7630_sensor_init_com);
1100 msleep(200);
1101 i2c_w_vector(gspca_dev, ov7630_sensor_init, 900 i2c_w_vector(gspca_dev, ov7630_sensor_init,
1102 sizeof ov7630_sensor_init); 901 sizeof ov7630_sensor_init);
1103 break; 902 if (sd->fr_h_sz == 18) { /* SN9C103 */
1104 case SENSOR_OV7630_3: 903 const __u8 i2c[] = { 0xa0, 0x21, 0x13, 0x80, 0x00,
1105 i2c_w_vector(gspca_dev, ov7630_sensor_init_com, 904 0x00, 0x00, 0x10 };
1106 sizeof ov7630_sensor_init_com); 905 i2c_w(gspca_dev, i2c);
1107 msleep(200); 906 }
1108 i2c_w(gspca_dev, ov7630_sensor_init_3[mode]);
1109 break; 907 break;
1110 case SENSOR_PAS106: 908 case SENSOR_PAS106:
1111 pas106_i2cinit(gspca_dev); 909 pas106_i2cinit(gspca_dev);
@@ -1145,14 +943,14 @@ static void sd_start(struct gspca_dev *gspca_dev)
1145 reg_w(gspca_dev, 0x18, &reg17_19[1], 2); 943 reg_w(gspca_dev, 0x18, &reg17_19[1], 2);
1146 msleep(20); 944 msleep(20);
1147 945
946 sd->reg11 = -1;
947
1148 setgain(gspca_dev); 948 setgain(gspca_dev);
1149 setbrightness(gspca_dev); 949 setbrightness(gspca_dev);
1150 setexposure(gspca_dev); 950 setexposure(gspca_dev);
1151 setfreq(gspca_dev); 951 setfreq(gspca_dev);
1152 setsaturation(gspca_dev);
1153 sethue(gspca_dev);
1154 setcontrast(gspca_dev);
1155 952
953 sd->frames_to_drop = 0;
1156 sd->autogain_ignore_frames = 0; 954 sd->autogain_ignore_frames = 0;
1157 atomic_set(&sd->avg_lum, -1); 955 atomic_set(&sd->avg_lum, -1);
1158} 956}
@@ -1198,21 +996,31 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1198 && data[3 + i] == 0xc4 996 && data[3 + i] == 0xc4
1199 && data[4 + i] == 0xc4 997 && data[4 + i] == 0xc4
1200 && data[5 + i] == 0x96) { /* start of frame */ 998 && data[5 + i] == 0x96) { /* start of frame */
1201 frame = gspca_frame_add(gspca_dev, LAST_PACKET, 999 int lum = -1;
1202 frame, data, 0); 1000 int pkt_type = LAST_PACKET;
1001
1203 if (len - i < sd->fr_h_sz) { 1002 if (len - i < sd->fr_h_sz) {
1204 atomic_set(&sd->avg_lum, -1);
1205 PDEBUG(D_STREAM, "packet too short to" 1003 PDEBUG(D_STREAM, "packet too short to"
1206 " get avg brightness"); 1004 " get avg brightness");
1207 } else if (sd->fr_h_sz == 12) { 1005 } else if (sd->fr_h_sz == 12) {
1208 atomic_set(&sd->avg_lum, 1006 lum = data[i + 8] + (data[i + 9] << 8);
1209 data[i + 8] +
1210 (data[i + 9] << 8));
1211 } else { 1007 } else {
1212 atomic_set(&sd->avg_lum, 1008 lum = data[i + 9] +
1213 data[i + 9] + 1009 (data[i + 10] << 8);
1214 (data[i + 10] << 8)); 1010 }
1011 if (lum == 0) {
1012 lum = -1;
1013 sd->frames_to_drop = 2;
1014 }
1015 atomic_set(&sd->avg_lum, lum);
1016
1017 if (sd->frames_to_drop) {
1018 sd->frames_to_drop--;
1019 pkt_type = DISCARD_PACKET;
1215 } 1020 }
1021
1022 frame = gspca_frame_add(gspca_dev, pkt_type,
1023 frame, data, 0);
1216 data += i + sd->fr_h_sz; 1024 data += i + sd->fr_h_sz;
1217 len -= i + sd->fr_h_sz; 1025 len -= i + sd->fr_h_sz;
1218 gspca_frame_add(gspca_dev, FIRST_PACKET, 1026 gspca_frame_add(gspca_dev, FIRST_PACKET,
@@ -1327,60 +1135,6 @@ static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
1327 return 0; 1135 return 0;
1328} 1136}
1329 1137
1330static int sd_setsaturation(struct gspca_dev *gspca_dev, __s32 val)
1331{
1332 struct sd *sd = (struct sd *) gspca_dev;
1333
1334 sd->saturation = val;
1335 if (gspca_dev->streaming)
1336 setsaturation(gspca_dev);
1337 return 0;
1338}
1339
1340static int sd_getsaturation(struct gspca_dev *gspca_dev, __s32 *val)
1341{
1342 struct sd *sd = (struct sd *) gspca_dev;
1343
1344 *val = sd->saturation;
1345 return 0;
1346}
1347
1348static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val)
1349{
1350 struct sd *sd = (struct sd *) gspca_dev;
1351
1352 sd->hue = val;
1353 if (gspca_dev->streaming)
1354 sethue(gspca_dev);
1355 return 0;
1356}
1357
1358static int sd_gethue(struct gspca_dev *gspca_dev, __s32 *val)
1359{
1360 struct sd *sd = (struct sd *) gspca_dev;
1361
1362 *val = sd->hue;
1363 return 0;
1364}
1365
1366static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
1367{
1368 struct sd *sd = (struct sd *) gspca_dev;
1369
1370 sd->contrast = val;
1371 if (gspca_dev->streaming)
1372 setcontrast(gspca_dev);
1373 return 0;
1374}
1375
1376static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
1377{
1378 struct sd *sd = (struct sd *) gspca_dev;
1379
1380 *val = sd->contrast;
1381 return 0;
1382}
1383
1384static int sd_querymenu(struct gspca_dev *gspca_dev, 1138static int sd_querymenu(struct gspca_dev *gspca_dev,
1385 struct v4l2_querymenu *menu) 1139 struct v4l2_querymenu *menu)
1386{ 1140{
@@ -1418,27 +1172,47 @@ static const struct sd_desc sd_desc = {
1418}; 1172};
1419 1173
1420/* -- module initialisation -- */ 1174/* -- module initialisation -- */
1421#define DVNM(name) .driver_info = (kernel_ulong_t) name 1175#define SFCI(sensor, flags, nctrls, i2c_addr) \
1176 .driver_info = (SENSOR_ ## sensor << 24) \
1177 | ((flags) << 16) \
1178 | ((nctrls) << 8) \
1179 | (i2c_addr)
1422static __devinitdata struct usb_device_id device_table[] = { 1180static __devinitdata struct usb_device_id device_table[] = {
1423#ifndef CONFIG_USB_SN9C102 1181#ifndef CONFIG_USB_SN9C102
1424 {USB_DEVICE(0x0c45, 0x6001), DVNM("Genius VideoCAM NB")}, 1182 {USB_DEVICE(0x0c45, 0x6001), /* SN9C102 */
1425 {USB_DEVICE(0x0c45, 0x6005), DVNM("Sweex Tas5110")}, 1183 SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)},
1426 {USB_DEVICE(0x0c45, 0x6007), DVNM("Sonix sn9c101 + Tas5110D")}, 1184 {USB_DEVICE(0x0c45, 0x6005), /* SN9C101 */
1427 {USB_DEVICE(0x0c45, 0x6009), DVNM("spcaCam@120")}, 1185 SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)},
1428 {USB_DEVICE(0x0c45, 0x600d), DVNM("spcaCam@120")}, 1186 {USB_DEVICE(0x0c45, 0x6007), /* SN9C101 */
1187 SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)},
1188 {USB_DEVICE(0x0c45, 0x6009), /* SN9C101 */
1189 SFCI(PAS106, F_SIF, 2, 0)},
1190 {USB_DEVICE(0x0c45, 0x600d), /* SN9C101 */
1191 SFCI(PAS106, F_SIF, 2, 0)},
1429#endif 1192#endif
1430 {USB_DEVICE(0x0c45, 0x6011), DVNM("MAX Webcam Microdia")}, 1193 {USB_DEVICE(0x0c45, 0x6011), /* SN9C101 - SN9C101G */
1194 SFCI(OV6650, F_GAIN|F_AUTO|F_SIF, 5, 0x60)},
1431#ifndef CONFIG_USB_SN9C102 1195#ifndef CONFIG_USB_SN9C102
1432 {USB_DEVICE(0x0c45, 0x6019), DVNM("Generic Sonix OV7630")}, 1196 {USB_DEVICE(0x0c45, 0x6019), /* SN9C101 */
1433 {USB_DEVICE(0x0c45, 0x6024), DVNM("Generic Sonix Tas5130c")}, 1197 SFCI(OV7630, F_GAIN|F_AUTO, 5, 0x21)},
1434 {USB_DEVICE(0x0c45, 0x6025), DVNM("Xcam Shanga")}, 1198 {USB_DEVICE(0x0c45, 0x6024), /* SN9C102 */
1435 {USB_DEVICE(0x0c45, 0x6028), DVNM("Sonix Btc Pc380")}, 1199 SFCI(TAS5130CXX, 0, 2, 0)},
1436 {USB_DEVICE(0x0c45, 0x6029), DVNM("spcaCam@150")}, 1200 {USB_DEVICE(0x0c45, 0x6025), /* SN9C102 */
1437 {USB_DEVICE(0x0c45, 0x602c), DVNM("Generic Sonix OV7630")}, 1201 SFCI(TAS5130CXX, 0, 2, 0)},
1438 {USB_DEVICE(0x0c45, 0x602d), DVNM("LIC-200 LG")}, 1202 {USB_DEVICE(0x0c45, 0x6028), /* SN9C102 */
1439 {USB_DEVICE(0x0c45, 0x602e), DVNM("Genius VideoCam Messenger")}, 1203 SFCI(PAS202, 0, 2, 0)},
1440 {USB_DEVICE(0x0c45, 0x60af), DVNM("Trust WB3100P")}, 1204 {USB_DEVICE(0x0c45, 0x6029), /* SN9C101 */
1441 {USB_DEVICE(0x0c45, 0x60b0), DVNM("Genius VideoCam Look")}, 1205 SFCI(PAS106, F_SIF, 2, 0)},
1206 {USB_DEVICE(0x0c45, 0x602c), /* SN9C102 */
1207 SFCI(OV7630, F_GAIN|F_AUTO, 5, 0x21)},
1208 {USB_DEVICE(0x0c45, 0x602d), /* SN9C102 */
1209 SFCI(HV7131R, 0, 2, 0)},
1210 {USB_DEVICE(0x0c45, 0x602e), /* SN9C102 */
1211 SFCI(OV7630, F_GAIN|F_AUTO, 5, 0x21)},
1212 {USB_DEVICE(0x0c45, 0x60af), /* SN9C103 */
1213 SFCI(PAS202, F_H18, 2, 0)},
1214 {USB_DEVICE(0x0c45, 0x60b0), /* SN9C103 */
1215 SFCI(OV7630, F_GAIN|F_AUTO|F_H18, 5, 0x21)},
1442#endif 1216#endif
1443 {} 1217 {}
1444}; 1218};
@@ -1464,7 +1238,7 @@ static int __init sd_mod_init(void)
1464{ 1238{
1465 if (usb_register(&sd_driver) < 0) 1239 if (usb_register(&sd_driver) < 0)
1466 return -1; 1240 return -1;
1467 PDEBUG(D_PROBE, "v%s registered", version); 1241 PDEBUG(D_PROBE, "registered");
1468 return 0; 1242 return 0;
1469} 1243}
1470static void __exit sd_mod_exit(void) 1244static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 3e68b9926956..33a3df1f6915 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -24,9 +24,6 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -361,6 +358,7 @@ static const __u8 mo4000_sensor_init[][8] = {
361}; 358};
362static const __u8 ov7660_sensor_init[][8] = { 359static const __u8 ov7660_sensor_init[][8] = {
363 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ 360 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */
361/* (delay 20ms) */
364 {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10}, 362 {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10},
365 /* Outformat ?? rawRGB */ 363 /* Outformat ?? rawRGB */
366 {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */ 364 {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */
@@ -539,13 +537,31 @@ static void reg_r(struct gspca_dev *gspca_dev,
539 value, 0, 537 value, 0,
540 gspca_dev->usb_buf, len, 538 gspca_dev->usb_buf, len,
541 500); 539 500);
540 PDEBUG(D_USBI, "reg_r [%02x] -> %02x", value, gspca_dev->usb_buf[0]);
542} 541}
543 542
543static void reg_w1(struct gspca_dev *gspca_dev,
544 __u16 value,
545 __u8 data)
546{
547 PDEBUG(D_USBO, "reg_w1 [%02x] = %02x", value, data);
548 gspca_dev->usb_buf[0] = data;
549 usb_control_msg(gspca_dev->dev,
550 usb_sndctrlpipe(gspca_dev->dev, 0),
551 0x08,
552 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
553 value,
554 0,
555 gspca_dev->usb_buf, 1,
556 500);
557}
544static void reg_w(struct gspca_dev *gspca_dev, 558static void reg_w(struct gspca_dev *gspca_dev,
545 __u16 value, 559 __u16 value,
546 const __u8 *buffer, 560 const __u8 *buffer,
547 int len) 561 int len)
548{ 562{
563 PDEBUG(D_USBO, "reg_w [%02x] = %02x %02x ..",
564 value, buffer[0], buffer[1]);
549 if (len <= sizeof gspca_dev->usb_buf) { 565 if (len <= sizeof gspca_dev->usb_buf) {
550 memcpy(gspca_dev->usb_buf, buffer, len); 566 memcpy(gspca_dev->usb_buf, buffer, len);
551 usb_control_msg(gspca_dev->dev, 567 usb_control_msg(gspca_dev->dev,
@@ -571,31 +587,42 @@ static void reg_w(struct gspca_dev *gspca_dev,
571 } 587 }
572} 588}
573 589
574/* I2C write 2 bytes */ 590/* I2C write 1 byte */
575static void i2c_w2(struct gspca_dev *gspca_dev, 591static void i2c_w1(struct gspca_dev *gspca_dev, __u8 reg, __u8 val)
576 const __u8 *buffer)
577{ 592{
578 struct sd *sd = (struct sd *) gspca_dev; 593 struct sd *sd = (struct sd *) gspca_dev;
579 __u8 mode[8];
580 594
581 /* is i2c ready */ 595 PDEBUG(D_USBO, "i2c_w2 [%02x] = %02x", reg, val);
582 mode[0] = 0x81 | (2 << 4); 596 gspca_dev->usb_buf[0] = 0x81 | (2 << 4); /* = a1 */
583 mode[1] = sd->i2c_base; 597 gspca_dev->usb_buf[1] = sd->i2c_base;
584 mode[2] = buffer[0]; 598 gspca_dev->usb_buf[2] = reg;
585 mode[3] = buffer[1]; 599 gspca_dev->usb_buf[3] = val;
586 mode[4] = 0; 600 gspca_dev->usb_buf[4] = 0;
587 mode[5] = 0; 601 gspca_dev->usb_buf[5] = 0;
588 mode[6] = 0; 602 gspca_dev->usb_buf[6] = 0;
589 mode[7] = 0x10; 603 gspca_dev->usb_buf[7] = 0x10;
590 reg_w(gspca_dev, 0x08, mode, 8); 604 usb_control_msg(gspca_dev->dev,
605 usb_sndctrlpipe(gspca_dev->dev, 0),
606 0x08,
607 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
608 0x08, /* value = i2c */
609 0,
610 gspca_dev->usb_buf, 8,
611 500);
591} 612}
592 613
593/* I2C write 8 bytes */ 614/* I2C write 8 bytes */
594static void i2c_w8(struct gspca_dev *gspca_dev, 615static void i2c_w8(struct gspca_dev *gspca_dev,
595 const __u8 *buffer) 616 const __u8 *buffer)
596{ 617{
597 reg_w(gspca_dev, 0x08, buffer, 8); 618 memcpy(gspca_dev->usb_buf, buffer, 8);
598 msleep(1); 619 usb_control_msg(gspca_dev->dev,
620 usb_sndctrlpipe(gspca_dev->dev, 0),
621 0x08,
622 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
623 0x08, 0, /* value, index */
624 gspca_dev->usb_buf, 8,
625 500);
599} 626}
600 627
601/* read 5 bytes in gspca_dev->usb_buf */ 628/* read 5 bytes in gspca_dev->usb_buf */
@@ -613,24 +640,21 @@ static void i2c_r5(struct gspca_dev *gspca_dev, __u8 reg)
613 mode[6] = 0; 640 mode[6] = 0;
614 mode[7] = 0x10; 641 mode[7] = 0x10;
615 i2c_w8(gspca_dev, mode); 642 i2c_w8(gspca_dev, mode);
643 msleep(2);
616 mode[0] = 0x81 | (5 << 4) | 0x02; 644 mode[0] = 0x81 | (5 << 4) | 0x02;
617 mode[2] = 0; 645 mode[2] = 0;
618 i2c_w8(gspca_dev, mode); 646 i2c_w8(gspca_dev, mode);
647 msleep(2);
619 reg_r(gspca_dev, 0x0a, 5); 648 reg_r(gspca_dev, 0x0a, 5);
620} 649}
621 650
622static int probesensor(struct gspca_dev *gspca_dev) 651static int probesensor(struct gspca_dev *gspca_dev)
623{ 652{
624 struct sd *sd = (struct sd *) gspca_dev; 653 struct sd *sd = (struct sd *) gspca_dev;
625 __u8 reg02;
626 static const __u8 datasend[] = { 2, 0 };
627 /* reg val1 val2 val3 val4 */
628 654
629 i2c_w2(gspca_dev, datasend); 655 i2c_w1(gspca_dev, 0x02, 0); /* sensor wakeup */
630/* should write 0xa1 0x11 0x02 0x00 0x00 0x00 0x00 the 0x10 is add by i2cw */
631 msleep(10); 656 msleep(10);
632 reg02 = 0x66; 657 reg_w1(gspca_dev, 0x02, 0x66); /* Gpio on */
633 reg_w(gspca_dev, 0x02, &reg02, 1); /* Gpio on */
634 msleep(10); 658 msleep(10);
635 i2c_r5(gspca_dev, 0); /* read sensor id */ 659 i2c_r5(gspca_dev, 0); /* read sensor id */
636 if (gspca_dev->usb_buf[0] == 0x02 660 if (gspca_dev->usb_buf[0] == 0x02
@@ -642,7 +666,7 @@ static int probesensor(struct gspca_dev *gspca_dev)
642 sd->sensor = SENSOR_HV7131R; 666 sd->sensor = SENSOR_HV7131R;
643 return SENSOR_HV7131R; 667 return SENSOR_HV7131R;
644 } 668 }
645 PDEBUG(D_PROBE, "Find Sensor %d %d %d", 669 PDEBUG(D_PROBE, "Find Sensor 0x%02x 0x%02x 0x%02x",
646 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1], 670 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1],
647 gspca_dev->usb_buf[2]); 671 gspca_dev->usb_buf[2]);
648 PDEBUG(D_PROBE, "Sensor sn9c102P Not found"); 672 PDEBUG(D_PROBE, "Sensor sn9c102P Not found");
@@ -653,8 +677,6 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
653 const __u8 *sn9c1xx) 677 const __u8 *sn9c1xx)
654{ 678{
655 struct sd *sd = (struct sd *) gspca_dev; 679 struct sd *sd = (struct sd *) gspca_dev;
656 __u8 data;
657 __u8 regF1;
658 const __u8 *reg9a; 680 const __u8 *reg9a;
659 static const __u8 reg9a_def[] = 681 static const __u8 reg9a_def[] =
660 {0x08, 0x40, 0x20, 0x10, 0x00, 0x04}; 682 {0x08, 0x40, 0x20, 0x10, 0x00, 0x04};
@@ -663,15 +685,13 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
663 static const __u8 reg9a_sn9c325[] = 685 static const __u8 reg9a_sn9c325[] =
664 {0x0a, 0x40, 0x38, 0x30, 0x00, 0x20}; 686 {0x0a, 0x40, 0x38, 0x30, 0x00, 0x20};
665 687
666 688 reg_w1(gspca_dev, 0xf1, 0x00);
667 regF1 = 0x00; 689 reg_w1(gspca_dev, 0x01, sn9c1xx[0]); /*fixme:jfm was [1] en v1*/
668 reg_w(gspca_dev, 0xf1, &regF1, 1);
669 reg_w(gspca_dev, 0x01, &sn9c1xx[0], 1); /*fixme:jfm was [1] en v1*/
670 690
671 /* configure gpio */ 691 /* configure gpio */
672 reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2); 692 reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2);
673 reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); 693 reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2);
674 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); /* jfm was 3 */ 694 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); /* jfm len was 3 */
675 switch (sd->bridge) { 695 switch (sd->bridge) {
676 case BRIDGE_SN9C325: 696 case BRIDGE_SN9C325:
677 reg9a = reg9a_sn9c325; 697 reg9a = reg9a_sn9c325;
@@ -685,35 +705,25 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
685 } 705 }
686 reg_w(gspca_dev, 0x9a, reg9a, 6); 706 reg_w(gspca_dev, 0x9a, reg9a, 6);
687 707
688 data = 0x60; /*fixme:jfm 60 00 00 (3) */ 708 reg_w1(gspca_dev, 0xd4, 0x60); /*fixme:jfm 60 00 00 (3) ? */
689 reg_w(gspca_dev, 0xd4, &data, 1);
690 709
691 reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); 710 reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f);
692 711
693 switch (sd->bridge) { 712 switch (sd->bridge) {
694 case BRIDGE_SN9C120: /* from win trace */ 713 case BRIDGE_SN9C120: /* from win trace */
695 data = 0x61; 714 reg_w1(gspca_dev, 0x01, 0x61);
696 reg_w(gspca_dev, 0x01, &data, 1); 715 reg_w1(gspca_dev, 0x17, 0x20);
697 data = 0x20; 716 reg_w1(gspca_dev, 0x01, 0x60);
698 reg_w(gspca_dev, 0x17, &data, 1);
699 data = 0x60;
700 reg_w(gspca_dev, 0x01, &data, 1);
701 break; 717 break;
702 case BRIDGE_SN9C325: 718 case BRIDGE_SN9C325:
703 data = 0x43; 719 reg_w1(gspca_dev, 0x01, 0x43);
704 reg_w(gspca_dev, 0x01, &data, 1); 720 reg_w1(gspca_dev, 0x17, 0xae);
705 data = 0xae; 721 reg_w1(gspca_dev, 0x01, 0x42);
706 reg_w(gspca_dev, 0x17, &data, 1);
707 data = 0x42;
708 reg_w(gspca_dev, 0x01, &data, 1);
709 break; 722 break;
710 default: 723 default:
711 data = 0x43; 724 reg_w1(gspca_dev, 0x01, 0x43);
712 reg_w(gspca_dev, 0x01, &data, 1); 725 reg_w1(gspca_dev, 0x17, 0x61);
713 data = 0x61; 726 reg_w1(gspca_dev, 0x01, 0x42);
714 reg_w(gspca_dev, 0x17, &data, 1);
715 data = 0x42;
716 reg_w(gspca_dev, 0x01, &data, 1);
717 } 727 }
718 728
719 if (sd->sensor == SENSOR_HV7131R) { 729 if (sd->sensor == SENSOR_HV7131R) {
@@ -770,6 +780,9 @@ static void ov7660_InitSensor(struct gspca_dev *gspca_dev)
770{ 780{
771 int i = 0; 781 int i = 0;
772 782
783 i2c_w8(gspca_dev, ov7660_sensor_init[i]); /* reset SCCB */
784 i++;
785 msleep(20);
773 while (ov7660_sensor_init[i][0]) { 786 while (ov7660_sensor_init[i][0]) {
774 i2c_w8(gspca_dev, ov7660_sensor_init[i]); 787 i2c_w8(gspca_dev, ov7660_sensor_init[i]);
775 i++; 788 i++;
@@ -782,194 +795,16 @@ static int sd_config(struct gspca_dev *gspca_dev,
782{ 795{
783 struct sd *sd = (struct sd *) gspca_dev; 796 struct sd *sd = (struct sd *) gspca_dev;
784 struct cam *cam; 797 struct cam *cam;
785 __u16 vendor;
786 __u16 product;
787
788 vendor = id->idVendor;
789 product = id->idProduct;
790 sd->sensor = -1;
791 switch (vendor) {
792 case 0x0458: /* Genius */
793/* switch (product) {
794 case 0x7025: */
795 sd->bridge = BRIDGE_SN9C120;
796 sd->sensor = SENSOR_MI0360;
797 sd->i2c_base = 0x5d;
798/* break;
799 } */
800 break;
801 case 0x045e:
802/* switch (product) {
803 case 0x00f5:
804 case 0x00f7: */
805 sd->bridge = BRIDGE_SN9C105;
806 sd->sensor = SENSOR_OV7660;
807 sd->i2c_base = 0x21;
808/* break;
809 } */
810 break;
811 case 0x0471: /* Philips */
812/* switch (product) {
813 case 0x0327:
814 case 0x0328:
815 case 0x0330: */
816 sd->bridge = BRIDGE_SN9C105;
817 sd->sensor = SENSOR_MI0360;
818 sd->i2c_base = 0x5d;
819/* break;
820 } */
821 break;
822 case 0x0c45: /* Sonix */
823 switch (product) {
824 case 0x6040:
825 sd->bridge = BRIDGE_SN9C102P;
826/* sd->sensor = SENSOR_MI0360; * from BW600.inf */
827/*fixme: MI0360 base=5d ? */
828 sd->sensor = SENSOR_HV7131R; /* gspcav1 value */
829 sd->i2c_base = 0x11;
830 break;
831/* case 0x607a: * from BW600.inf
832 sd->bridge = BRIDGE_SN9C102P;
833 sd->sensor = SENSOR_OV7648;
834 sd->i2c_base = 0x??;
835 break; */
836 case 0x607c:
837 sd->bridge = BRIDGE_SN9C102P;
838 sd->sensor = SENSOR_HV7131R;
839 sd->i2c_base = 0x11;
840 break;
841/* case 0x607e: * from BW600.inf
842 sd->bridge = BRIDGE_SN9C102P;
843 sd->sensor = SENSOR_OV7630;
844 sd->i2c_base = 0x??;
845 break; */
846 case 0x60c0:
847 sd->bridge = BRIDGE_SN9C105;
848 sd->sensor = SENSOR_MI0360;
849 sd->i2c_base = 0x5d;
850 break;
851/* case 0x60c8: * from BW600.inf
852 sd->bridge = BRIDGE_SN9C105;
853 sd->sensor = SENSOR_OM6801;
854 sd->i2c_base = 0x??;
855 break; */
856/* case 0x60cc: * from BW600.inf
857 sd->bridge = BRIDGE_SN9C105;
858 sd->sensor = SENSOR_HV7131GP;
859 sd->i2c_base = 0x??;
860 break; */
861 case 0x60ec:
862 sd->bridge = BRIDGE_SN9C105;
863 sd->sensor = SENSOR_MO4000;
864 sd->i2c_base = 0x21;
865 break;
866/* case 0x60ef: * from BW600.inf
867 sd->bridge = BRIDGE_SN9C105;
868 sd->sensor = SENSOR_ICM105C;
869 sd->i2c_base = 0x??;
870 break; */
871/* case 0x60fa: * from BW600.inf
872 sd->bridge = BRIDGE_SN9C105;
873 sd->sensor = SENSOR_OV7648;
874 sd->i2c_base = 0x??;
875 break; */
876 case 0x60fb:
877 sd->bridge = BRIDGE_SN9C105;
878 sd->sensor = SENSOR_OV7660;
879 sd->i2c_base = 0x21;
880 break;
881 case 0x60fc:
882 sd->bridge = BRIDGE_SN9C105;
883 sd->sensor = SENSOR_HV7131R;
884 sd->i2c_base = 0x11;
885 break;
886/* case 0x60fe: * from BW600.inf
887 sd->bridge = BRIDGE_SN9C105;
888 sd->sensor = SENSOR_OV7630;
889 sd->i2c_base = 0x??;
890 break; */
891/* case 0x6108: * from BW600.inf
892 sd->bridge = BRIDGE_SN9C120;
893 sd->sensor = SENSOR_OM6801;
894 sd->i2c_base = 0x??;
895 break; */
896/* case 0x6122: * from BW600.inf
897 sd->bridge = BRIDGE_SN9C110;
898 sd->sensor = SENSOR_ICM105C;
899 sd->i2c_base = 0x??;
900 break; */
901 case 0x612a:
902/* sd->bridge = BRIDGE_SN9C110; * in BW600.inf */
903 sd->bridge = BRIDGE_SN9C325;
904 sd->sensor = SENSOR_OV7648;
905 sd->i2c_base = 0x21;
906/*fixme: sensor_init has base = 00 et 6e!*/
907 break;
908/* case 0x6123: * from BW600.inf
909 sd->bridge = BRIDGE_SN9C110;
910 sd->sensor = SENSOR_SanyoCCD;
911 sd->i2c_base = 0x??;
912 break; */
913 case 0x612c:
914 sd->bridge = BRIDGE_SN9C110;
915 sd->sensor = SENSOR_MO4000;
916 sd->i2c_base = 0x21;
917 break;
918/* case 0x612e: * from BW600.inf
919 sd->bridge = BRIDGE_SN9C110;
920 sd->sensor = SENSOR_OV7630;
921 sd->i2c_base = 0x??;
922 break; */
923/* case 0x612f: * from BW600.inf
924 sd->bridge = BRIDGE_SN9C110;
925 sd->sensor = SENSOR_ICM105C;
926 sd->i2c_base = 0x??;
927 break; */
928 case 0x6130:
929 sd->bridge = BRIDGE_SN9C120;
930 sd->sensor = SENSOR_MI0360;
931 sd->i2c_base = 0x5d;
932 break;
933 case 0x6138:
934 sd->bridge = BRIDGE_SN9C120;
935 sd->sensor = SENSOR_MO4000;
936 sd->i2c_base = 0x21;
937 break;
938/* case 0x613a: * from BW600.inf
939 sd->bridge = BRIDGE_SN9C120;
940 sd->sensor = SENSOR_OV7648;
941 sd->i2c_base = 0x??;
942 break; */
943 case 0x613b:
944 sd->bridge = BRIDGE_SN9C120;
945 sd->sensor = SENSOR_OV7660;
946 sd->i2c_base = 0x21;
947 break;
948 case 0x613c:
949 sd->bridge = BRIDGE_SN9C120;
950 sd->sensor = SENSOR_HV7131R;
951 sd->i2c_base = 0x11;
952 break;
953/* case 0x613e: * from BW600.inf
954 sd->bridge = BRIDGE_SN9C120;
955 sd->sensor = SENSOR_OV7630;
956 sd->i2c_base = 0x??;
957 break; */
958 }
959 break;
960 }
961 if (sd->sensor < 0) {
962 PDEBUG(D_ERR, "Invalid vendor/product %04x:%04x",
963 vendor, product);
964 return -EINVAL;
965 }
966 798
967 cam = &gspca_dev->cam; 799 cam = &gspca_dev->cam;
968 cam->dev_name = (char *) id->driver_info;
969 cam->epaddr = 0x01; 800 cam->epaddr = 0x01;
970 cam->cam_mode = vga_mode; 801 cam->cam_mode = vga_mode;
971 cam->nmodes = ARRAY_SIZE(vga_mode); 802 cam->nmodes = ARRAY_SIZE(vga_mode);
972 803
804 sd->bridge = id->driver_info >> 16;
805 sd->sensor = id->driver_info >> 8;
806 sd->i2c_base = id->driver_info;
807
973 sd->qindex = 4; /* set the quantization table */ 808 sd->qindex = 4; /* set the quantization table */
974 sd->brightness = BRIGHTNESS_DEF; 809 sd->brightness = BRIGHTNESS_DEF;
975 sd->contrast = CONTRAST_DEF; 810 sd->contrast = CONTRAST_DEF;
@@ -983,34 +818,26 @@ static int sd_open(struct gspca_dev *gspca_dev)
983{ 818{
984 struct sd *sd = (struct sd *) gspca_dev; 819 struct sd *sd = (struct sd *) gspca_dev;
985/* const __u8 *sn9c1xx; */ 820/* const __u8 *sn9c1xx; */
986 __u8 regF1;
987 __u8 regGpio[] = { 0x29, 0x74 }; 821 __u8 regGpio[] = { 0x29, 0x74 };
822 __u8 regF1;
988 823
989 /* setup a selector by bridge */ 824 /* setup a selector by bridge */
990 regF1 = 0x01; 825 reg_w1(gspca_dev, 0xf1, 0x01);
991 reg_w(gspca_dev, 0xf1, &regF1, 1);
992 reg_r(gspca_dev, 0x00, 1); /* -> regF1 = 0x00 */ 826 reg_r(gspca_dev, 0x00, 1); /* -> regF1 = 0x00 */
993 regF1 = gspca_dev->usb_buf[0]; 827 reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]);
994 reg_w(gspca_dev, 0xf1, &regF1, 1);
995 reg_r(gspca_dev, 0x00, 1); 828 reg_r(gspca_dev, 0x00, 1);
996 regF1 = gspca_dev->usb_buf[0]; 829 regF1 = gspca_dev->usb_buf[0];
997 switch (sd->bridge) { 830 switch (sd->bridge) {
998 case BRIDGE_SN9C102P: 831 case BRIDGE_SN9C102P:
999 if (regF1 != 0x11) 832 if (regF1 != 0x11)
1000 return -ENODEV; 833 return -ENODEV;
1001 reg_w(gspca_dev, 0x02, &regGpio[1], 1); 834 reg_w1(gspca_dev, 0x02, regGpio[1]);
1002 break; 835 break;
1003 case BRIDGE_SN9C105: 836 case BRIDGE_SN9C105:
1004 if (regF1 != 0x11) 837 if (regF1 != 0x11)
1005 return -ENODEV; 838 return -ENODEV;
1006 reg_w(gspca_dev, 0x02, regGpio, 2); 839 reg_w(gspca_dev, 0x02, regGpio, 2);
1007 break; 840 break;
1008 case BRIDGE_SN9C110:
1009 if (regF1 != 0x12)
1010 return -ENODEV;
1011 regGpio[1] = 0x62;
1012 reg_w(gspca_dev, 0x02, &regGpio[1], 1);
1013 break;
1014 case BRIDGE_SN9C120: 841 case BRIDGE_SN9C120:
1015 if (regF1 != 0x12) 842 if (regF1 != 0x12)
1016 return -ENODEV; 843 return -ENODEV;
@@ -1018,16 +845,15 @@ static int sd_open(struct gspca_dev *gspca_dev)
1018 reg_w(gspca_dev, 0x02, regGpio, 2); 845 reg_w(gspca_dev, 0x02, regGpio, 2);
1019 break; 846 break;
1020 default: 847 default:
848/* case BRIDGE_SN9C110: */
1021/* case BRIDGE_SN9C325: */ 849/* case BRIDGE_SN9C325: */
1022 if (regF1 != 0x12) 850 if (regF1 != 0x12)
1023 return -ENODEV; 851 return -ENODEV;
1024 regGpio[1] = 0x62; 852 reg_w1(gspca_dev, 0x02, 0x62);
1025 reg_w(gspca_dev, 0x02, &regGpio[1], 1);
1026 break; 853 break;
1027 } 854 }
1028 855
1029 regF1 = 0x01; 856 reg_w1(gspca_dev, 0xf1, 0x01);
1030 reg_w(gspca_dev, 0xf1, &regF1, 1);
1031 857
1032 return 0; 858 return 0;
1033} 859}
@@ -1123,7 +949,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
1123 } 949 }
1124 950
1125 k2 = sd->brightness >> 10; 951 k2 = sd->brightness >> 10;
1126 reg_w(gspca_dev, 0x96, &k2, 1); 952 reg_w1(gspca_dev, 0x96, k2);
1127} 953}
1128 954
1129static void setcontrast(struct gspca_dev *gspca_dev) 955static void setcontrast(struct gspca_dev *gspca_dev)
@@ -1152,7 +978,7 @@ static void setcolors(struct gspca_dev *gspca_dev)
1152 data = (colour + 32) & 0x7f; /* blue */ 978 data = (colour + 32) & 0x7f; /* blue */
1153 else 979 else
1154 data = (-colour + 32) & 0x7f; /* red */ 980 data = (-colour + 32) & 0x7f; /* red */
1155 reg_w(gspca_dev, 0x05, &data, 1); 981 reg_w1(gspca_dev, 0x05, data);
1156} 982}
1157 983
1158/* -- start the camera -- */ 984/* -- start the camera -- */
@@ -1165,7 +991,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
1165 __u8 reg17; 991 __u8 reg17;
1166 const __u8 *sn9c1xx; 992 const __u8 *sn9c1xx;
1167 int mode; 993 int mode;
1168 static const __u8 DC29[] = { 0x6a, 0x50, 0x00, 0x00, 0x50, 0x3c };
1169 static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; 994 static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f };
1170 static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; 995 static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
1171 static const __u8 CA_sn9c120[] = 996 static const __u8 CA_sn9c120[] =
@@ -1179,21 +1004,20 @@ static void sd_start(struct gspca_dev *gspca_dev)
1179 1004
1180/*fixme:jfm this sequence should appear at end of sd_start */ 1005/*fixme:jfm this sequence should appear at end of sd_start */
1181/* with 1006/* with
1182 data = 0x44; 1007 reg_w1(gspca_dev, 0x01, 0x44); */
1183 reg_w(gspca_dev, 0x01, &data, 1); */ 1008 reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]);
1184 reg_w(gspca_dev, 0x15, &sn9c1xx[0x15], 1); 1009 reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]);
1185 reg_w(gspca_dev, 0x16, &sn9c1xx[0x16], 1); 1010 reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]);
1186 reg_w(gspca_dev, 0x12, &sn9c1xx[0x12], 1); 1011 reg_w1(gspca_dev, 0x13, sn9c1xx[0x13]);
1187 reg_w(gspca_dev, 0x13, &sn9c1xx[0x13], 1); 1012 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
1188 reg_w(gspca_dev, 0x18, &sn9c1xx[0x18], 1); 1013 reg_w1(gspca_dev, 0xd2, 0x6a); /* DC29 */
1189 reg_w(gspca_dev, 0xd2, &DC29[0], 1); 1014 reg_w1(gspca_dev, 0xd3, 0x50);
1190 reg_w(gspca_dev, 0xd3, &DC29[1], 1); 1015 reg_w1(gspca_dev, 0xc6, 0x00);
1191 reg_w(gspca_dev, 0xc6, &DC29[2], 1); 1016 reg_w1(gspca_dev, 0xc7, 0x00);
1192 reg_w(gspca_dev, 0xc7, &DC29[3], 1); 1017 reg_w1(gspca_dev, 0xc8, 0x50);
1193 reg_w(gspca_dev, 0xc8, &DC29[4], 1); 1018 reg_w1(gspca_dev, 0xc9, 0x3c);
1194 reg_w(gspca_dev, 0xc9, &DC29[5], 1);
1195/*fixme:jfm end of ending sequence */ 1019/*fixme:jfm end of ending sequence */
1196 reg_w(gspca_dev, 0x18, &sn9c1xx[0x18], 1); 1020 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
1197 switch (sd->bridge) { 1021 switch (sd->bridge) {
1198 case BRIDGE_SN9C325: 1022 case BRIDGE_SN9C325:
1199 data = 0xae; 1023 data = 0xae;
@@ -1205,11 +1029,11 @@ static void sd_start(struct gspca_dev *gspca_dev)
1205 data = 0x60; 1029 data = 0x60;
1206 break; 1030 break;
1207 } 1031 }
1208 reg_w(gspca_dev, 0x17, &data, 1); 1032 reg_w1(gspca_dev, 0x17, data);
1209 reg_w(gspca_dev, 0x05, &sn9c1xx[5], 1); 1033 reg_w1(gspca_dev, 0x05, sn9c1xx[5]);
1210 reg_w(gspca_dev, 0x07, &sn9c1xx[7], 1); 1034 reg_w1(gspca_dev, 0x07, sn9c1xx[7]);
1211 reg_w(gspca_dev, 0x06, &sn9c1xx[6], 1); 1035 reg_w1(gspca_dev, 0x06, sn9c1xx[6]);
1212 reg_w(gspca_dev, 0x14, &sn9c1xx[0x14], 1); 1036 reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]);
1213 switch (sd->bridge) { 1037 switch (sd->bridge) {
1214 case BRIDGE_SN9C325: 1038 case BRIDGE_SN9C325:
1215 reg_w(gspca_dev, 0x20, regsn20_sn9c325, 1039 reg_w(gspca_dev, 0x20, regsn20_sn9c325,
@@ -1217,10 +1041,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
1217 for (i = 0; i < 8; i++) 1041 for (i = 0; i < 8; i++)
1218 reg_w(gspca_dev, 0x84, reg84_sn9c325, 1042 reg_w(gspca_dev, 0x84, reg84_sn9c325,
1219 sizeof reg84_sn9c325); 1043 sizeof reg84_sn9c325);
1220 data = 0x0a; 1044 reg_w1(gspca_dev, 0x9a, 0x0a);
1221 reg_w(gspca_dev, 0x9a, &data, 1); 1045 reg_w1(gspca_dev, 0x99, 0x60);
1222 data = 0x60;
1223 reg_w(gspca_dev, 0x99, &data, 1);
1224 break; 1046 break;
1225 case BRIDGE_SN9C120: 1047 case BRIDGE_SN9C120:
1226 reg_w(gspca_dev, 0x20, regsn20_sn9c120, 1048 reg_w(gspca_dev, 0x20, regsn20_sn9c120,
@@ -1233,39 +1055,30 @@ static void sd_start(struct gspca_dev *gspca_dev)
1233 sizeof reg84_sn9c120_2); 1055 sizeof reg84_sn9c120_2);
1234 reg_w(gspca_dev, 0x84, reg84_sn9c120_3, 1056 reg_w(gspca_dev, 0x84, reg84_sn9c120_3,
1235 sizeof reg84_sn9c120_3); 1057 sizeof reg84_sn9c120_3);
1236 data = 0x05; 1058 reg_w1(gspca_dev, 0x9a, 0x05);
1237 reg_w(gspca_dev, 0x9a, &data, 1); 1059 reg_w1(gspca_dev, 0x99, 0x5b);
1238 data = 0x5b;
1239 reg_w(gspca_dev, 0x99, &data, 1);
1240 break; 1060 break;
1241 default: 1061 default:
1242 reg_w(gspca_dev, 0x20, regsn20, sizeof regsn20); 1062 reg_w(gspca_dev, 0x20, regsn20, sizeof regsn20);
1243 for (i = 0; i < 8; i++) 1063 for (i = 0; i < 8; i++)
1244 reg_w(gspca_dev, 0x84, reg84, sizeof reg84); 1064 reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
1245 data = 0x08; 1065 reg_w1(gspca_dev, 0x9a, 0x08);
1246 reg_w(gspca_dev, 0x9a, &data, 1); 1066 reg_w1(gspca_dev, 0x99, 0x59);
1247 data = 0x59;
1248 reg_w(gspca_dev, 0x99, &data, 1);
1249 break; 1067 break;
1250 } 1068 }
1251 1069
1252 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; 1070 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
1253 reg1 = 0x02; 1071 if (mode)
1072 reg1 = 0x46; /* 320 clk 48Mhz */
1073 else
1074 reg1 = 0x06; /* 640 clk 24Mz */
1254 reg17 = 0x61; 1075 reg17 = 0x61;
1255 switch (sd->sensor) { 1076 switch (sd->sensor) {
1256 case SENSOR_HV7131R: 1077 case SENSOR_HV7131R:
1257 hv7131R_InitSensor(gspca_dev); 1078 hv7131R_InitSensor(gspca_dev);
1258 if (mode)
1259 reg1 = 0x46; /* 320 clk 48Mhz */
1260 else
1261 reg1 = 0x06; /* 640 clk 24Mz */
1262 break; 1079 break;
1263 case SENSOR_MI0360: 1080 case SENSOR_MI0360:
1264 mi0360_InitSensor(gspca_dev); 1081 mi0360_InitSensor(gspca_dev);
1265 if (mode)
1266 reg1 = 0x46; /* 320 clk 48Mhz */
1267 else
1268 reg1 = 0x06; /* 640 clk 24Mz */
1269 break; 1082 break;
1270 case SENSOR_MO4000: 1083 case SENSOR_MO4000:
1271 mo4000_InitSensor(gspca_dev); 1084 mo4000_InitSensor(gspca_dev);
@@ -1274,13 +1087,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
1274 reg1 = 0x06; /* clk 24Mz */ 1087 reg1 = 0x06; /* clk 24Mz */
1275 } else { 1088 } else {
1276 reg17 = 0x22; /* 640 MCKSIZE */ 1089 reg17 = 0x22; /* 640 MCKSIZE */
1277 reg1 = 0x06; /* 640 clk 24Mz */ 1090/* reg1 = 0x06; * 640 clk 24Mz (done) */
1278 } 1091 }
1279 break; 1092 break;
1280 case SENSOR_OV7648: 1093 case SENSOR_OV7648:
1094 ov7648_InitSensor(gspca_dev);
1281 reg17 = 0xa2; 1095 reg17 = 0xa2;
1282 reg1 = 0x44; 1096 reg1 = 0x44;
1283 ov7648_InitSensor(gspca_dev);
1284/* if (mode) 1097/* if (mode)
1285 ; * 320x2... 1098 ; * 320x2...
1286 else 1099 else
@@ -1292,7 +1105,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
1292 if (mode) { 1105 if (mode) {
1293/* reg17 = 0x21; * 320 */ 1106/* reg17 = 0x21; * 320 */
1294/* reg1 = 0x44; */ 1107/* reg1 = 0x44; */
1295 reg1 = 0x46; 1108/* reg1 = 0x46; (done) */
1296 } else { 1109 } else {
1297 reg17 = 0xa2; /* 640 */ 1110 reg17 = 0xa2; /* 640 */
1298 reg1 = 0x40; 1111 reg1 = 0x40;
@@ -1321,16 +1134,16 @@ static void sd_start(struct gspca_dev *gspca_dev)
1321 1134
1322 /* here change size mode 0 -> VGA; 1 -> CIF */ 1135 /* here change size mode 0 -> VGA; 1 -> CIF */
1323 data = 0x40 | sn9c1xx[0x18] | (mode << 4); 1136 data = 0x40 | sn9c1xx[0x18] | (mode << 4);
1324 reg_w(gspca_dev, 0x18, &data, 1); 1137 reg_w1(gspca_dev, 0x18, data);
1325 1138
1326 reg_w(gspca_dev, 0x100, qtable4, 0x40); 1139 reg_w(gspca_dev, 0x100, qtable4, 0x40);
1327 reg_w(gspca_dev, 0x140, qtable4 + 0x40, 0x40); 1140 reg_w(gspca_dev, 0x140, qtable4 + 0x40, 0x40);
1328 1141
1329 data = sn9c1xx[0x18] | (mode << 4); 1142 data = sn9c1xx[0x18] | (mode << 4);
1330 reg_w(gspca_dev, 0x18, &data, 1); 1143 reg_w1(gspca_dev, 0x18, data);
1331 1144
1332 reg_w(gspca_dev, 0x17, &reg17, 1); 1145 reg_w1(gspca_dev, 0x17, reg17);
1333 reg_w(gspca_dev, 0x01, &reg1, 1); 1146 reg_w1(gspca_dev, 0x01, reg1);
1334 setbrightness(gspca_dev); 1147 setbrightness(gspca_dev);
1335 setcontrast(gspca_dev); 1148 setcontrast(gspca_dev);
1336} 1149}
@@ -1342,7 +1155,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
1342 { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 }; 1155 { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 };
1343 static const __u8 stopmi0360[] = 1156 static const __u8 stopmi0360[] =
1344 { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 }; 1157 { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 };
1345 __u8 regF1;
1346 __u8 data; 1158 __u8 data;
1347 const __u8 *sn9c1xx; 1159 const __u8 *sn9c1xx;
1348 1160
@@ -1366,12 +1178,11 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
1366 break; 1178 break;
1367 } 1179 }
1368 sn9c1xx = sn_tb[(int) sd->sensor]; 1180 sn9c1xx = sn_tb[(int) sd->sensor];
1369 reg_w(gspca_dev, 0x01, &sn9c1xx[1], 1); 1181 reg_w1(gspca_dev, 0x01, sn9c1xx[1]);
1370 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 1); 1182 reg_w1(gspca_dev, 0x17, sn9c1xx[0x17]);
1371 reg_w(gspca_dev, 0x01, &sn9c1xx[1], 1); 1183 reg_w1(gspca_dev, 0x01, sn9c1xx[1]);
1372 reg_w(gspca_dev, 0x01, &data, 1); 1184 reg_w1(gspca_dev, 0x01, data);
1373 regF1 = 0x01; 1185 reg_w1(gspca_dev, 0xf1, 0x01);
1374 reg_w(gspca_dev, 0xf1, &regF1, 1);
1375} 1186}
1376 1187
1377static void sd_stop0(struct gspca_dev *gspca_dev) 1188static void sd_stop0(struct gspca_dev *gspca_dev)
@@ -1610,30 +1421,53 @@ static const struct sd_desc sd_desc = {
1610}; 1421};
1611 1422
1612/* -- module initialisation -- */ 1423/* -- module initialisation -- */
1613#define DVNM(name) .driver_info = (kernel_ulong_t) name 1424#define BSI(bridge, sensor, i2c_addr) \
1425 .driver_info = (BRIDGE_ ## bridge << 16) \
1426 | (SENSOR_ ## sensor << 8) \
1427 | (i2c_addr)
1614static const __devinitdata struct usb_device_id device_table[] = { 1428static const __devinitdata struct usb_device_id device_table[] = {
1615#ifndef CONFIG_USB_SN9C102 1429#ifndef CONFIG_USB_SN9C102
1616 {USB_DEVICE(0x0458, 0x7025), DVNM("Genius Eye 311Q")}, 1430 {USB_DEVICE(0x0458, 0x7025), BSI(SN9C120, MI0360, 0x5d)},
1617 {USB_DEVICE(0x045e, 0x00f5), DVNM("MicroSoft VX3000")}, 1431 {USB_DEVICE(0x045e, 0x00f5), BSI(SN9C105, OV7660, 0x21)},
1618 {USB_DEVICE(0x045e, 0x00f7), DVNM("MicroSoft VX1000")}, 1432 {USB_DEVICE(0x045e, 0x00f7), BSI(SN9C105, OV7660, 0x21)},
1619 {USB_DEVICE(0x0471, 0x0327), DVNM("Philips SPC 600 NC")}, 1433 {USB_DEVICE(0x0471, 0x0327), BSI(SN9C105, MI0360, 0x5d)},
1620 {USB_DEVICE(0x0471, 0x0328), DVNM("Philips SPC 700 NC")}, 1434 {USB_DEVICE(0x0471, 0x0328), BSI(SN9C105, MI0360, 0x5d)},
1621#endif 1435#endif
1622 {USB_DEVICE(0x0471, 0x0330), DVNM("Philips SPC 710NC")}, 1436 {USB_DEVICE(0x0471, 0x0330), BSI(SN9C105, MI0360, 0x5d)},
1623 {USB_DEVICE(0x0c45, 0x6040), DVNM("Speed NVC 350K")}, 1437 {USB_DEVICE(0x0c45, 0x6040), BSI(SN9C102P, HV7131R, 0x11)},
1624 {USB_DEVICE(0x0c45, 0x607c), DVNM("Sonix sn9c102p Hv7131R")}, 1438/* bw600.inf:
1625 {USB_DEVICE(0x0c45, 0x60c0), DVNM("Sangha Sn535")}, 1439 {USB_DEVICE(0x0c45, 0x6040), BSI(SN9C102P, MI0360, 0x5d)}, */
1626 {USB_DEVICE(0x0c45, 0x60ec), DVNM("SN9C105+MO4000")}, 1440/* {USB_DEVICE(0x0c45, 0x603a), BSI(SN9C102P, OV7648, 0x??)}, */
1627 {USB_DEVICE(0x0c45, 0x60fb), DVNM("Surfer NoName")}, 1441/* {USB_DEVICE(0x0c45, 0x607a), BSI(SN9C102P, OV7648, 0x??)}, */
1628 {USB_DEVICE(0x0c45, 0x60fc), DVNM("LG-LIC300")}, 1442 {USB_DEVICE(0x0c45, 0x607c), BSI(SN9C102P, HV7131R, 0x11)},
1629 {USB_DEVICE(0x0c45, 0x612a), DVNM("Avant Camera")}, 1443/* {USB_DEVICE(0x0c45, 0x607e), BSI(SN9C102P, OV7630, 0x??)}, */
1630 {USB_DEVICE(0x0c45, 0x612c), DVNM("Typhoon Rasy Cam 1.3MPix")}, 1444 {USB_DEVICE(0x0c45, 0x60c0), BSI(SN9C105, MI0360, 0x5d)},
1445/* {USB_DEVICE(0x0c45, 0x60c8), BSI(SN9C105, OM6801, 0x??)}, */
1446/* {USB_DEVICE(0x0c45, 0x60cc), BSI(SN9C105, HV7131GP, 0x??)}, */
1447 {USB_DEVICE(0x0c45, 0x60ec), BSI(SN9C105, MO4000, 0x21)},
1448/* {USB_DEVICE(0x0c45, 0x60ef), BSI(SN9C105, ICM105C, 0x??)}, */
1449/* {USB_DEVICE(0x0c45, 0x60fa), BSI(SN9C105, OV7648, 0x??)}, */
1450 {USB_DEVICE(0x0c45, 0x60fb), BSI(SN9C105, OV7660, 0x21)},
1451 {USB_DEVICE(0x0c45, 0x60fc), BSI(SN9C105, HV7131R, 0x11)},
1452/* {USB_DEVICE(0x0c45, 0x60fe), BSI(SN9C105, OV7630, 0x??)}, */
1453/* {USB_DEVICE(0x0c45, 0x6108), BSI(SN9C120, OM6801, 0x??)}, */
1454/* {USB_DEVICE(0x0c45, 0x6122), BSI(SN9C110, ICM105C, 0x??)}, */
1455/* {USB_DEVICE(0x0c45, 0x6123), BSI(SN9C110, SanyoCCD, 0x??)}, */
1456 {USB_DEVICE(0x0c45, 0x612a), BSI(SN9C325, OV7648, 0x21)},
1457/* bw600.inf:
1458 {USB_DEVICE(0x0c45, 0x612a), BSI(SN9C110, OV7648, 0x21)}, */
1459 {USB_DEVICE(0x0c45, 0x612c), BSI(SN9C110, MO4000, 0x21)},
1460/* {USB_DEVICE(0x0c45, 0x612e), BSI(SN9C110, OV7630, 0x??)}, */
1461/* {USB_DEVICE(0x0c45, 0x612f), BSI(SN9C110, ICM105C, 0x??)}, */
1631#ifndef CONFIG_USB_SN9C102 1462#ifndef CONFIG_USB_SN9C102
1632 {USB_DEVICE(0x0c45, 0x6130), DVNM("Sonix Pccam")}, 1463 {USB_DEVICE(0x0c45, 0x6130), BSI(SN9C120, MI0360, 0x5d)},
1633 {USB_DEVICE(0x0c45, 0x6138), DVNM("Sn9c120 Mo4000")}, 1464 {USB_DEVICE(0x0c45, 0x6138), BSI(SN9C120, MO4000, 0x21)},
1634 {USB_DEVICE(0x0c45, 0x613b), DVNM("Surfer SN-206")}, 1465/* {USB_DEVICE(0x0c45, 0x613a), BSI(SN9C120, OV7648, 0x??)}, */
1635 {USB_DEVICE(0x0c45, 0x613c), DVNM("Sonix Pccam168")}, 1466 {USB_DEVICE(0x0c45, 0x613b), BSI(SN9C120, OV7660, 0x21)},
1467 {USB_DEVICE(0x0c45, 0x613c), BSI(SN9C120, HV7131R, 0x11)},
1468/* {USB_DEVICE(0x0c45, 0x613e), BSI(SN9C120, OV7630, 0x??)}, */
1636#endif 1469#endif
1470 {USB_DEVICE(0x0c45, 0x6143), BSI(SN9C120, MI0360, 0x5d)},
1637 {} 1471 {}
1638}; 1472};
1639MODULE_DEVICE_TABLE(usb, device_table); 1473MODULE_DEVICE_TABLE(usb, device_table);
@@ -1658,7 +1492,7 @@ static int __init sd_mod_init(void)
1658{ 1492{
1659 if (usb_register(&sd_driver) < 0) 1493 if (usb_register(&sd_driver) < 0)
1660 return -1; 1494 return -1;
1661 info("v%s registered", version); 1495 info("registered");
1662 return 0; 1496 return 0;
1663} 1497}
1664static void __exit sd_mod_exit(void) 1498static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c
index 156206118795..17fe2c2a440d 100644
--- a/drivers/media/video/gspca/spca500.c
+++ b/drivers/media/video/gspca/spca500.c
@@ -24,9 +24,6 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -630,109 +627,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
630{ 627{
631 struct sd *sd = (struct sd *) gspca_dev; 628 struct sd *sd = (struct sd *) gspca_dev;
632 struct cam *cam; 629 struct cam *cam;
633 __u16 vendor; 630
634 __u16 product;
635
636 vendor = id->idVendor;
637 product = id->idProduct;
638 switch (vendor) {
639 case 0x040a: /* Kodak cameras */
640/* switch (product) { */
641/* case 0x0300: */
642 sd->subtype = KodakEZ200;
643/* break; */
644/* } */
645 break;
646 case 0x041e: /* Creative cameras */
647/* switch (product) { */
648/* case 0x400a: */
649 sd->subtype = CreativePCCam300;
650/* break; */
651/* } */
652 break;
653 case 0x046d: /* Logitech Labtec */
654 switch (product) {
655 case 0x0890:
656 sd->subtype = LogitechTraveler;
657 break;
658 case 0x0900:
659 sd->subtype = LogitechClickSmart310;
660 break;
661 case 0x0901:
662 sd->subtype = LogitechClickSmart510;
663 break;
664 }
665 break;
666 case 0x04a5: /* Benq */
667/* switch (product) { */
668/* case 0x300c: */
669 sd->subtype = BenqDC1016;
670/* break; */
671/* } */
672 break;
673 case 0x04fc: /* SunPlus */
674/* switch (product) { */
675/* case 0x7333: */
676 sd->subtype = PalmPixDC85;
677/* break; */
678/* } */
679 break;
680 case 0x055f: /* Mustek cameras */
681 switch (product) {
682 case 0xc200:
683 sd->subtype = MustekGsmart300;
684 break;
685 case 0xc220:
686 sd->subtype = Gsmartmini;
687 break;
688 }
689 break;
690 case 0x06bd: /* Agfa Cl20 */
691/* switch (product) { */
692/* case 0x0404: */
693 sd->subtype = AgfaCl20;
694/* break; */
695/* } */
696 break;
697 case 0x06be: /* Optimedia */
698/* switch (product) { */
699/* case 0x0800: */
700 sd->subtype = Optimedia;
701/* break; */
702/* } */
703 break;
704 case 0x084d: /* D-Link / Minton */
705/* switch (product) { */
706/* case 0x0003: * DSC-350 / S-Cam F5 */
707 sd->subtype = DLinkDSC350;
708/* break; */
709/* } */
710 break;
711 case 0x08ca: /* Aiptek */
712/* switch (product) { */
713/* case 0x0103: */
714 sd->subtype = AiptekPocketDV;
715/* break; */
716/* } */
717 break;
718 case 0x2899: /* ToptroIndustrial */
719/* switch (product) { */
720/* case 0x012c: */
721 sd->subtype = ToptroIndus;
722/* break; */
723/* } */
724 break;
725 case 0x8086: /* Intel */
726/* switch (product) { */
727/* case 0x0630: * Pocket PC Camera */
728 sd->subtype = IntelPocketPCCamera;
729/* break; */
730/* } */
731 break;
732 }
733 cam = &gspca_dev->cam; 631 cam = &gspca_dev->cam;
734 cam->dev_name = (char *) id->driver_info;
735 cam->epaddr = 0x01; 632 cam->epaddr = 0x01;
633 sd->subtype = id->driver_info;
736 if (sd->subtype != LogitechClickSmart310) { 634 if (sd->subtype != LogitechClickSmart310) {
737 cam->cam_mode = vga_mode; 635 cam->cam_mode = vga_mode;
738 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 636 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
@@ -1162,23 +1060,22 @@ static struct sd_desc sd_desc = {
1162}; 1060};
1163 1061
1164/* -- module initialisation -- */ 1062/* -- module initialisation -- */
1165#define DVNM(name) .driver_info = (kernel_ulong_t) name
1166static const __devinitdata struct usb_device_id device_table[] = { 1063static const __devinitdata struct usb_device_id device_table[] = {
1167 {USB_DEVICE(0x040a, 0x0300), DVNM("Kodak EZ200")}, 1064 {USB_DEVICE(0x040a, 0x0300), .driver_info = KodakEZ200},
1168 {USB_DEVICE(0x041e, 0x400a), DVNM("Creative PC-CAM 300")}, 1065 {USB_DEVICE(0x041e, 0x400a), .driver_info = CreativePCCam300},
1169 {USB_DEVICE(0x046d, 0x0890), DVNM("Logitech QuickCam traveler")}, 1066 {USB_DEVICE(0x046d, 0x0890), .driver_info = LogitechTraveler},
1170 {USB_DEVICE(0x046d, 0x0900), DVNM("Logitech Inc. ClickSmart 310")}, 1067 {USB_DEVICE(0x046d, 0x0900), .driver_info = LogitechClickSmart310},
1171 {USB_DEVICE(0x046d, 0x0901), DVNM("Logitech Inc. ClickSmart 510")}, 1068 {USB_DEVICE(0x046d, 0x0901), .driver_info = LogitechClickSmart510},
1172 {USB_DEVICE(0x04a5, 0x300c), DVNM("Benq DC1016")}, 1069 {USB_DEVICE(0x04a5, 0x300c), .driver_info = BenqDC1016},
1173 {USB_DEVICE(0x04fc, 0x7333), DVNM("PalmPixDC85")}, 1070 {USB_DEVICE(0x04fc, 0x7333), .driver_info = PalmPixDC85},
1174 {USB_DEVICE(0x055f, 0xc200), DVNM("Mustek Gsmart 300")}, 1071 {USB_DEVICE(0x055f, 0xc200), .driver_info = MustekGsmart300},
1175 {USB_DEVICE(0x055f, 0xc220), DVNM("Gsmart Mini")}, 1072 {USB_DEVICE(0x055f, 0xc220), .driver_info = Gsmartmini},
1176 {USB_DEVICE(0x06bd, 0x0404), DVNM("Agfa CL20")}, 1073 {USB_DEVICE(0x06bd, 0x0404), .driver_info = AgfaCl20},
1177 {USB_DEVICE(0x06be, 0x0800), DVNM("Optimedia")}, 1074 {USB_DEVICE(0x06be, 0x0800), .driver_info = Optimedia},
1178 {USB_DEVICE(0x084d, 0x0003), DVNM("D-Link DSC-350")}, 1075 {USB_DEVICE(0x084d, 0x0003), .driver_info = DLinkDSC350},
1179 {USB_DEVICE(0x08ca, 0x0103), DVNM("Aiptek PocketDV")}, 1076 {USB_DEVICE(0x08ca, 0x0103), .driver_info = AiptekPocketDV},
1180 {USB_DEVICE(0x2899, 0x012c), DVNM("Toptro Industrial")}, 1077 {USB_DEVICE(0x2899, 0x012c), .driver_info = ToptroIndus},
1181 {USB_DEVICE(0x8086, 0x0630), DVNM("Intel Pocket PC Camera")}, 1078 {USB_DEVICE(0x8086, 0x0630), .driver_info = IntelPocketPCCamera},
1182 {} 1079 {}
1183}; 1080};
1184MODULE_DEVICE_TABLE(usb, device_table); 1081MODULE_DEVICE_TABLE(usb, device_table);
@@ -1203,7 +1100,7 @@ static int __init sd_mod_init(void)
1203{ 1100{
1204 if (usb_register(&sd_driver) < 0) 1101 if (usb_register(&sd_driver) < 0)
1205 return -1; 1102 return -1;
1206 PDEBUG(D_PROBE, "v%s registered", version); 1103 PDEBUG(D_PROBE, "registered");
1207 return 0; 1104 return 0;
1208} 1105}
1209static void __exit sd_mod_exit(void) 1106static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c
index 50e929de0203..51a3c3429ef0 100644
--- a/drivers/media/video/gspca/spca501.c
+++ b/drivers/media/video/gspca/spca501.c
@@ -23,9 +23,6 @@
23 23
24#include "gspca.h" 24#include "gspca.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
27static const char version[] = "2.1.7";
28
29MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 26MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
30MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver"); 27MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver");
31MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
@@ -1923,63 +1920,12 @@ static int sd_config(struct gspca_dev *gspca_dev,
1923{ 1920{
1924 struct sd *sd = (struct sd *) gspca_dev; 1921 struct sd *sd = (struct sd *) gspca_dev;
1925 struct cam *cam; 1922 struct cam *cam;
1926 __u16 vendor; 1923
1927 __u16 product;
1928
1929 vendor = id->idVendor;
1930 product = id->idProduct;
1931 switch (vendor) {
1932 case 0x0000: /* Unknow Camera */
1933/* switch (product) { */
1934/* case 0x0000: */
1935 sd->subtype = MystFromOriUnknownCamera;
1936/* break; */
1937/* } */
1938 break;
1939 case 0x040a: /* Kodak cameras */
1940/* switch (product) { */
1941/* case 0x0002: */
1942 sd->subtype = KodakDVC325;
1943/* break; */
1944/* } */
1945 break;
1946 case 0x0497: /* Smile International */
1947/* switch (product) { */
1948/* case 0xc001: */
1949 sd->subtype = SmileIntlCamera;
1950/* break; */
1951/* } */
1952 break;
1953 case 0x0506: /* 3COM cameras */
1954/* switch (product) { */
1955/* case 0x00df: */
1956 sd->subtype = ThreeComHomeConnectLite;
1957/* break; */
1958/* } */
1959 break;
1960 case 0x0733: /* Rebadged ViewQuest (Intel) and ViewQuest cameras */
1961 switch (product) {
1962 case 0x0401:
1963 sd->subtype = IntelCreateAndShare;
1964 break;
1965 case 0x0402:
1966 sd->subtype = ViewQuestM318B;
1967 break;
1968 }
1969 break;
1970 case 0x1776: /* Arowana */
1971/* switch (product) { */
1972/* case 0x501c: */
1973 sd->subtype = Arowana300KCMOSCamera;
1974/* break; */
1975/* } */
1976 break;
1977 }
1978 cam = &gspca_dev->cam; 1924 cam = &gspca_dev->cam;
1979 cam->dev_name = (char *) id->driver_info;
1980 cam->epaddr = 0x01; 1925 cam->epaddr = 0x01;
1981 cam->cam_mode = vga_mode; 1926 cam->cam_mode = vga_mode;
1982 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 1927 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
1928 sd->subtype = id->driver_info;
1983 sd->brightness = sd_ctrls[MY_BRIGHTNESS].qctrl.default_value; 1929 sd->brightness = sd_ctrls[MY_BRIGHTNESS].qctrl.default_value;
1984 sd->contrast = sd_ctrls[MY_CONTRAST].qctrl.default_value; 1930 sd->contrast = sd_ctrls[MY_CONTRAST].qctrl.default_value;
1985 sd->colors = sd_ctrls[MY_COLOR].qctrl.default_value; 1931 sd->colors = sd_ctrls[MY_COLOR].qctrl.default_value;
@@ -2183,15 +2129,14 @@ static const struct sd_desc sd_desc = {
2183}; 2129};
2184 2130
2185/* -- module initialisation -- */ 2131/* -- module initialisation -- */
2186#define DVNM(name) .driver_info = (kernel_ulong_t) name
2187static const __devinitdata struct usb_device_id device_table[] = { 2132static const __devinitdata struct usb_device_id device_table[] = {
2188 {USB_DEVICE(0x040a, 0x0002), DVNM("Kodak DVC-325")}, 2133 {USB_DEVICE(0x040a, 0x0002), .driver_info = KodakDVC325},
2189 {USB_DEVICE(0x0497, 0xc001), DVNM("Smile International")}, 2134 {USB_DEVICE(0x0497, 0xc001), .driver_info = SmileIntlCamera},
2190 {USB_DEVICE(0x0506, 0x00df), DVNM("3Com HomeConnect Lite")}, 2135 {USB_DEVICE(0x0506, 0x00df), .driver_info = ThreeComHomeConnectLite},
2191 {USB_DEVICE(0x0733, 0x0401), DVNM("Intel Create and Share")}, 2136 {USB_DEVICE(0x0733, 0x0401), .driver_info = IntelCreateAndShare},
2192 {USB_DEVICE(0x0733, 0x0402), DVNM("ViewQuest M318B")}, 2137 {USB_DEVICE(0x0733, 0x0402), .driver_info = ViewQuestM318B},
2193 {USB_DEVICE(0x1776, 0x501c), DVNM("Arowana 300K CMOS Camera")}, 2138 {USB_DEVICE(0x1776, 0x501c), .driver_info = Arowana300KCMOSCamera},
2194 {USB_DEVICE(0x0000, 0x0000), DVNM("MystFromOri Unknow Camera")}, 2139 {USB_DEVICE(0x0000, 0x0000), .driver_info = MystFromOriUnknownCamera},
2195 {} 2140 {}
2196}; 2141};
2197MODULE_DEVICE_TABLE(usb, device_table); 2142MODULE_DEVICE_TABLE(usb, device_table);
@@ -2216,7 +2161,7 @@ static int __init sd_mod_init(void)
2216{ 2161{
2217 if (usb_register(&sd_driver) < 0) 2162 if (usb_register(&sd_driver) < 0)
2218 return -1; 2163 return -1;
2219 PDEBUG(D_PROBE, "v%s registered", version); 2164 PDEBUG(D_PROBE, "registered");
2220 return 0; 2165 return 0;
2221} 2166}
2222static void __exit sd_mod_exit(void) 2167static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c
index ddea6e140aa8..3c2be80cbd65 100644
--- a/drivers/media/video/gspca/spca505.c
+++ b/drivers/media/video/gspca/spca505.c
@@ -23,9 +23,6 @@
23 23
24#include "gspca.h" 24#include "gspca.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
27static const char version[] = "2.1.7";
28
29MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 26MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
30MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver"); 27MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver");
31MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
@@ -34,10 +31,6 @@ MODULE_LICENSE("GPL");
34struct sd { 31struct sd {
35 struct gspca_dev gspca_dev; /* !! must be the first item */ 32 struct gspca_dev gspca_dev; /* !! must be the first item */
36 33
37 int buflen;
38 unsigned char tmpbuf[640 * 480 * 3 / 2]; /* YYUV per line */
39 unsigned char tmpbuf2[640 * 480 * 2]; /* YUYV */
40
41 unsigned char brightness; 34 unsigned char brightness;
42 35
43 char subtype; 36 char subtype;
@@ -67,29 +60,29 @@ static struct ctrl sd_ctrls[] = {
67}; 60};
68 61
69static struct v4l2_pix_format vga_mode[] = { 62static struct v4l2_pix_format vga_mode[] = {
70 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 63 {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
71 .bytesperline = 160 * 2, 64 .bytesperline = 160 * 3,
72 .sizeimage = 160 * 120 * 2, 65 .sizeimage = 160 * 120 * 3 / 2,
73 .colorspace = V4L2_COLORSPACE_SRGB, 66 .colorspace = V4L2_COLORSPACE_SRGB,
74 .priv = 5}, 67 .priv = 5},
75 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 68 {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
76 .bytesperline = 176 * 2, 69 .bytesperline = 176 * 3,
77 .sizeimage = 176 * 144 * 2, 70 .sizeimage = 176 * 144 * 3 / 2,
78 .colorspace = V4L2_COLORSPACE_SRGB, 71 .colorspace = V4L2_COLORSPACE_SRGB,
79 .priv = 4}, 72 .priv = 4},
80 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 73 {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
81 .bytesperline = 320 * 2, 74 .bytesperline = 320 * 3,
82 .sizeimage = 320 * 240 * 2, 75 .sizeimage = 320 * 240 * 3 / 2,
83 .colorspace = V4L2_COLORSPACE_SRGB, 76 .colorspace = V4L2_COLORSPACE_SRGB,
84 .priv = 2}, 77 .priv = 2},
85 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 78 {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
86 .bytesperline = 352 * 2, 79 .bytesperline = 352 * 3,
87 .sizeimage = 352 * 288 * 2, 80 .sizeimage = 352 * 288 * 3 / 2,
88 .colorspace = V4L2_COLORSPACE_SRGB, 81 .colorspace = V4L2_COLORSPACE_SRGB,
89 .priv = 1}, 82 .priv = 1},
90 {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 83 {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
91 .bytesperline = 640 * 2, 84 .bytesperline = 640 * 3,
92 .sizeimage = 640 * 480 * 2, 85 .sizeimage = 640 * 480 * 3 / 2,
93 .colorspace = V4L2_COLORSPACE_SRGB, 86 .colorspace = V4L2_COLORSPACE_SRGB,
94 .priv = 0}, 87 .priv = 0},
95}; 88};
@@ -641,33 +634,11 @@ static int sd_config(struct gspca_dev *gspca_dev,
641{ 634{
642 struct sd *sd = (struct sd *) gspca_dev; 635 struct sd *sd = (struct sd *) gspca_dev;
643 struct cam *cam; 636 struct cam *cam;
644 __u16 vendor;
645 __u16 product;
646
647 vendor = id->idVendor;
648 product = id->idProduct;
649 switch (vendor) {
650 case 0x041e: /* Creative cameras */
651/* switch (product) { */
652/* case 0x401d: * here505b */
653 sd->subtype = Nxultra;
654/* break; */
655/* } */
656 break;
657 case 0x0733: /* Rebadged ViewQuest (Intel) and ViewQuest cameras */
658/* switch (product) { */
659/* case 0x0430: */
660/* fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */
661 sd->subtype = IntelPCCameraPro;
662/* break; */
663/* } */
664 break;
665 }
666 637
667 cam = &gspca_dev->cam; 638 cam = &gspca_dev->cam;
668 cam->dev_name = (char *) id->driver_info;
669 cam->epaddr = 0x01; 639 cam->epaddr = 0x01;
670 cam->cam_mode = vga_mode; 640 cam->cam_mode = vga_mode;
641 sd->subtype = id->driver_info;
671 if (sd->subtype != IntelPCCameraPro) 642 if (sd->subtype != IntelPCCameraPro)
672 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 643 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
673 else /* no 640x480 for IntelPCCameraPro */ 644 else /* no 640x480 for IntelPCCameraPro */
@@ -785,77 +756,30 @@ static void sd_close(struct gspca_dev *gspca_dev)
785 reg_write(gspca_dev->dev, 0x05, 0x11, 0xf); 756 reg_write(gspca_dev->dev, 0x05, 0x11, 0xf);
786} 757}
787 758
788/* convert YYUV per line to YUYV (YUV 4:2:2) */
789static void yyuv_decode(unsigned char *out,
790 unsigned char *in,
791 int width,
792 int height)
793{
794 unsigned char *Ui, *Vi, *yi, *yi1;
795 unsigned char *out1;
796 int i, j;
797
798 yi = in;
799 for (i = height / 2; --i >= 0; ) {
800 out1 = out + width * 2; /* next line */
801 yi1 = yi + width;
802 Ui = yi1 + width;
803 Vi = Ui + width / 2;
804 for (j = width / 2; --j >= 0; ) {
805 *out++ = 128 + *yi++;
806 *out++ = 128 + *Ui;
807 *out++ = 128 + *yi++;
808 *out++ = 128 + *Vi;
809
810 *out1++ = 128 + *yi1++;
811 *out1++ = 128 + *Ui++;
812 *out1++ = 128 + *yi1++;
813 *out1++ = 128 + *Vi++;
814 }
815 yi += width * 2;
816 out = out1;
817 }
818}
819
820static void sd_pkt_scan(struct gspca_dev *gspca_dev, 759static void sd_pkt_scan(struct gspca_dev *gspca_dev,
821 struct gspca_frame *frame, /* target */ 760 struct gspca_frame *frame, /* target */
822 __u8 *data, /* isoc packet */ 761 __u8 *data, /* isoc packet */
823 int len) /* iso packet length */ 762 int len) /* iso packet length */
824{ 763{
825 struct sd *sd = (struct sd *) gspca_dev;
826
827 switch (data[0]) { 764 switch (data[0]) {
828 case 0: /* start of frame */ 765 case 0: /* start of frame */
829 if (gspca_dev->last_packet_type == FIRST_PACKET) { 766 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
830 yyuv_decode(sd->tmpbuf2, sd->tmpbuf, 767 data, 0);
831 gspca_dev->width,
832 gspca_dev->height);
833 frame = gspca_frame_add(gspca_dev,
834 LAST_PACKET,
835 frame,
836 sd->tmpbuf2,
837 gspca_dev->width
838 * gspca_dev->height
839 * 2);
840 }
841 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
842 data, 0);
843 data += SPCA50X_OFFSET_DATA; 768 data += SPCA50X_OFFSET_DATA;
844 len -= SPCA50X_OFFSET_DATA; 769 len -= SPCA50X_OFFSET_DATA;
845 if (len > 0) 770 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
846 memcpy(sd->tmpbuf, data, len); 771 data, len);
847 else 772 break;
848 len = 0;
849 sd->buflen = len;
850 return;
851 case 0xff: /* drop */ 773 case 0xff: /* drop */
852/* gspca_dev->last_packet_type = DISCARD_PACKET; */ 774/* gspca_dev->last_packet_type = DISCARD_PACKET; */
853 return; 775 break;
776 default:
777 data += 1;
778 len -= 1;
779 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
780 data, len);
781 break;
854 } 782 }
855 data += 1;
856 len -= 1;
857 memcpy(&sd->tmpbuf[sd->buflen], data, len);
858 sd->buflen += len;
859} 783}
860 784
861static void setbrightness(struct gspca_dev *gspca_dev) 785static void setbrightness(struct gspca_dev *gspca_dev)
@@ -910,10 +834,10 @@ static const struct sd_desc sd_desc = {
910}; 834};
911 835
912/* -- module initialisation -- */ 836/* -- module initialisation -- */
913#define DVNM(name) .driver_info = (kernel_ulong_t) name
914static const __devinitdata struct usb_device_id device_table[] = { 837static const __devinitdata struct usb_device_id device_table[] = {
915 {USB_DEVICE(0x041e, 0x401d), DVNM("Creative Webcam NX ULTRA")}, 838 {USB_DEVICE(0x041e, 0x401d), .driver_info = Nxultra},
916 {USB_DEVICE(0x0733, 0x0430), DVNM("Intel PC Camera Pro")}, 839 {USB_DEVICE(0x0733, 0x0430), .driver_info = IntelPCCameraPro},
840/*fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */
917 {} 841 {}
918}; 842};
919MODULE_DEVICE_TABLE(usb, device_table); 843MODULE_DEVICE_TABLE(usb, device_table);
@@ -938,7 +862,7 @@ static int __init sd_mod_init(void)
938{ 862{
939 if (usb_register(&sd_driver) < 0) 863 if (usb_register(&sd_driver) < 0)
940 return -1; 864 return -1;
941 PDEBUG(D_PROBE, "v%s registered", version); 865 PDEBUG(D_PROBE, "registered");
942 return 0; 866 return 0;
943} 867}
944static void __exit sd_mod_exit(void) 868static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca506.c b/drivers/media/video/gspca/spca506.c
index 143203c1fd9f..6fe715c80ad2 100644
--- a/drivers/media/video/gspca/spca506.c
+++ b/drivers/media/video/gspca/spca506.c
@@ -25,9 +25,6 @@
25 25
26#include "gspca.h" 26#include "gspca.h"
27 27
28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
29static const char version[] = "2.1.7";
30
31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
32MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver"); 29MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver");
33MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
@@ -36,10 +33,6 @@ MODULE_LICENSE("GPL");
36struct sd { 33struct sd {
37 struct gspca_dev gspca_dev; /* !! must be the first item */ 34 struct gspca_dev gspca_dev; /* !! must be the first item */
38 35
39 int buflen;
40 __u8 tmpbuf[640 * 480 * 3]; /* YYUV per line */
41 __u8 tmpbuf2[640 * 480 * 2]; /* YUYV */
42
43 unsigned char brightness; 36 unsigned char brightness;
44 unsigned char contrast; 37 unsigned char contrast;
45 unsigned char colors; 38 unsigned char colors;
@@ -118,29 +111,29 @@ static struct ctrl sd_ctrls[] = {
118}; 111};
119 112
120static struct v4l2_pix_format vga_mode[] = { 113static struct v4l2_pix_format vga_mode[] = {
121 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 114 {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
122 .bytesperline = 160 * 2, 115 .bytesperline = 160 * 3,
123 .sizeimage = 160 * 120 * 2, 116 .sizeimage = 160 * 120 * 3 / 2,
124 .colorspace = V4L2_COLORSPACE_SRGB, 117 .colorspace = V4L2_COLORSPACE_SRGB,
125 .priv = 5}, 118 .priv = 5},
126 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 119 {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
127 .bytesperline = 176 * 2, 120 .bytesperline = 176 * 3,
128 .sizeimage = 176 * 144 * 2, 121 .sizeimage = 176 * 144 * 3 / 2,
129 .colorspace = V4L2_COLORSPACE_SRGB, 122 .colorspace = V4L2_COLORSPACE_SRGB,
130 .priv = 4}, 123 .priv = 4},
131 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 124 {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
132 .bytesperline = 320 * 2, 125 .bytesperline = 320 * 3,
133 .sizeimage = 320 * 240 * 2, 126 .sizeimage = 320 * 240 * 3 / 2,
134 .colorspace = V4L2_COLORSPACE_SRGB, 127 .colorspace = V4L2_COLORSPACE_SRGB,
135 .priv = 2}, 128 .priv = 2},
136 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 129 {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
137 .bytesperline = 352 * 2, 130 .bytesperline = 352 * 3,
138 .sizeimage = 352 * 288 * 2, 131 .sizeimage = 352 * 288 * 3 / 2,
139 .colorspace = V4L2_COLORSPACE_SRGB, 132 .colorspace = V4L2_COLORSPACE_SRGB,
140 .priv = 1}, 133 .priv = 1},
141 {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 134 {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
142 .bytesperline = 640 * 2, 135 .bytesperline = 640 * 3,
143 .sizeimage = 640 * 480 * 2, 136 .sizeimage = 640 * 480 * 3 / 2,
144 .colorspace = V4L2_COLORSPACE_SRGB, 137 .colorspace = V4L2_COLORSPACE_SRGB,
145 .priv = 0}, 138 .priv = 0},
146}; 139};
@@ -310,7 +303,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
310 struct cam *cam; 303 struct cam *cam;
311 304
312 cam = &gspca_dev->cam; 305 cam = &gspca_dev->cam;
313 cam->dev_name = (char *) id->driver_info;
314 cam->epaddr = 0x01; 306 cam->epaddr = 0x01;
315 cam->cam_mode = vga_mode; 307 cam->cam_mode = vga_mode;
316 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 308 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
@@ -576,77 +568,30 @@ static void sd_close(struct gspca_dev *gspca_dev)
576{ 568{
577} 569}
578 570
579/* convert YYUV per line to YUYV (YUV 4:2:2) */
580static void yyuv_decode(unsigned char *out,
581 unsigned char *in,
582 int width,
583 int height)
584{
585 unsigned char *Ui, *Vi, *yi, *yi1;
586 unsigned char *out1;
587 int i, j;
588
589 yi = in;
590 for (i = height / 2; --i >= 0; ) {
591 out1 = out + width * 2; /* next line */
592 yi1 = yi + width;
593 Ui = yi1 + width;
594 Vi = Ui + width / 2;
595 for (j = width / 2; --j >= 0; ) {
596 *out++ = 128 + *yi++;
597 *out++ = 128 + *Ui;
598 *out++ = 128 + *yi++;
599 *out++ = 128 + *Vi;
600
601 *out1++ = 128 + *yi1++;
602 *out1++ = 128 + *Ui++;
603 *out1++ = 128 + *yi1++;
604 *out1++ = 128 + *Vi++;
605 }
606 yi += width * 2;
607 out = out1;
608 }
609}
610
611static void sd_pkt_scan(struct gspca_dev *gspca_dev, 571static void sd_pkt_scan(struct gspca_dev *gspca_dev,
612 struct gspca_frame *frame, /* target */ 572 struct gspca_frame *frame, /* target */
613 __u8 *data, /* isoc packet */ 573 __u8 *data, /* isoc packet */
614 int len) /* iso packet length */ 574 int len) /* iso packet length */
615{ 575{
616 struct sd *sd = (struct sd *) gspca_dev;
617
618 switch (data[0]) { 576 switch (data[0]) {
619 case 0: /* start of frame */ 577 case 0: /* start of frame */
620 if (gspca_dev->last_packet_type == FIRST_PACKET) { 578 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
621 yyuv_decode(sd->tmpbuf2, sd->tmpbuf, 579 data, 0);
622 gspca_dev->width,
623 gspca_dev->height);
624 frame = gspca_frame_add(gspca_dev,
625 LAST_PACKET,
626 frame,
627 sd->tmpbuf2,
628 gspca_dev->width
629 * gspca_dev->height
630 * 2);
631 }
632 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
633 data, 0);
634 data += SPCA50X_OFFSET_DATA; 580 data += SPCA50X_OFFSET_DATA;
635 len -= SPCA50X_OFFSET_DATA; 581 len -= SPCA50X_OFFSET_DATA;
636 if (len > 0) 582 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
637 memcpy(sd->tmpbuf, data, len); 583 data, len);
638 else 584 break;
639 len = 0;
640 sd->buflen = len;
641 return;
642 case 0xff: /* drop */ 585 case 0xff: /* drop */
643/* gspca_dev->last_packet_type = DISCARD_PACKET; */ 586/* gspca_dev->last_packet_type = DISCARD_PACKET; */
644 return; 587 break;
588 default:
589 data += 1;
590 len -= 1;
591 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
592 data, len);
593 break;
645 } 594 }
646 data += 1;
647 len -= 1;
648 memcpy(&sd->tmpbuf[sd->buflen], data, len);
649 sd->buflen += len;
650} 595}
651 596
652static void setbrightness(struct gspca_dev *gspca_dev) 597static void setbrightness(struct gspca_dev *gspca_dev)
@@ -804,12 +749,12 @@ static struct sd_desc sd_desc = {
804}; 749};
805 750
806/* -- module initialisation -- */ 751/* -- module initialisation -- */
807#define DVNM(name) .driver_info = (kernel_ulong_t) name
808static __devinitdata struct usb_device_id device_table[] = { 752static __devinitdata struct usb_device_id device_table[] = {
809 {USB_DEVICE(0x06e1, 0xa190), DVNM("ADS Instant VCD")}, 753 {USB_DEVICE(0x06e1, 0xa190)},
810/* {USB_DEVICE(0x0733, 0x0430), DVNM("UsbGrabber PV321c")}, */ 754/*fixme: may be IntelPCCameraPro BRIDGE_SPCA505
811 {USB_DEVICE(0x0734, 0x043b), DVNM("3DeMon USB Capture aka")}, 755 {USB_DEVICE(0x0733, 0x0430)}, */
812 {USB_DEVICE(0x99fa, 0x8988), DVNM("Grandtec V.cap")}, 756 {USB_DEVICE(0x0734, 0x043b)},
757 {USB_DEVICE(0x99fa, 0x8988)},
813 {} 758 {}
814}; 759};
815MODULE_DEVICE_TABLE(usb, device_table); 760MODULE_DEVICE_TABLE(usb, device_table);
@@ -834,7 +779,7 @@ static int __init sd_mod_init(void)
834{ 779{
835 if (usb_register(&sd_driver) < 0) 780 if (usb_register(&sd_driver) < 0)
836 return -1; 781 return -1;
837 PDEBUG(D_PROBE, "v%s registered", version); 782 PDEBUG(D_PROBE, "registered");
838 return 0; 783 return 0;
839} 784}
840static void __exit sd_mod_exit(void) 785static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c
index d8cd93866a4a..b608a27ad115 100644
--- a/drivers/media/video/gspca/spca508.c
+++ b/drivers/media/video/gspca/spca508.c
@@ -22,9 +22,6 @@
22 22
23#include "gspca.h" 23#include "gspca.h"
24 24
25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
26static const char version[] = "2.1.7";
27
28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 25MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
29MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver"); 26MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver");
30MODULE_LICENSE("GPL"); 27MODULE_LICENSE("GPL");
@@ -33,10 +30,6 @@ MODULE_LICENSE("GPL");
33struct sd { 30struct sd {
34 struct gspca_dev gspca_dev; /* !! must be the first item */ 31 struct gspca_dev gspca_dev; /* !! must be the first item */
35 32
36 int buflen;
37 unsigned char tmpbuf[352 * 288 * 3 / 2]; /* YUVY per line */
38 unsigned char tmpbuf2[352 * 288 * 2]; /* YUYV */
39
40 unsigned char brightness; 33 unsigned char brightness;
41 34
42 char subtype; 35 char subtype;
@@ -71,23 +64,23 @@ static struct ctrl sd_ctrls[] = {
71 64
72static struct v4l2_pix_format sif_mode[] = { 65static struct v4l2_pix_format sif_mode[] = {
73 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 66 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
74 .bytesperline = 160 * 2, 67 .bytesperline = 160 * 3,
75 .sizeimage = 160 * 120 * 2, 68 .sizeimage = 160 * 120 * 3 / 2,
76 .colorspace = V4L2_COLORSPACE_SRGB, 69 .colorspace = V4L2_COLORSPACE_SRGB,
77 .priv = 3}, 70 .priv = 3},
78 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 71 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
79 .bytesperline = 176 * 2, 72 .bytesperline = 176 * 3,
80 .sizeimage = 176 * 144 * 2, 73 .sizeimage = 176 * 144 * 3 / 2,
81 .colorspace = V4L2_COLORSPACE_SRGB, 74 .colorspace = V4L2_COLORSPACE_SRGB,
82 .priv = 2}, 75 .priv = 2},
83 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 76 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
84 .bytesperline = 320 * 2, 77 .bytesperline = 320 * 3,
85 .sizeimage = 320 * 240 * 2, 78 .sizeimage = 320 * 240 * 3 / 2,
86 .colorspace = V4L2_COLORSPACE_SRGB, 79 .colorspace = V4L2_COLORSPACE_SRGB,
87 .priv = 1}, 80 .priv = 1},
88 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 81 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
89 .bytesperline = 352 * 2, 82 .bytesperline = 352 * 3,
90 .sizeimage = 352 * 288 * 2, 83 .sizeimage = 352 * 288 * 3 / 2,
91 .colorspace = V4L2_COLORSPACE_SRGB, 84 .colorspace = V4L2_COLORSPACE_SRGB,
92 .priv = 0}, 85 .priv = 0},
93}; 86};
@@ -1476,58 +1469,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
1476{ 1469{
1477 struct sd *sd = (struct sd *) gspca_dev; 1470 struct sd *sd = (struct sd *) gspca_dev;
1478 struct cam *cam; 1471 struct cam *cam;
1479 __u16 product;
1480 int data1, data2; 1472 int data1, data2;
1481 1473
1482 product = id->idProduct;
1483 switch (id->idVendor) {
1484 case 0x0130: /* Clone webcam */
1485/* switch (product) { */
1486/* case 0x0130: */
1487 sd->subtype = HamaUSBSightcam; /* same as Hama 0010 */
1488/* break; */
1489/* } */
1490 break;
1491 case 0x041e: /* Creative cameras */
1492/* switch (product) { */
1493/* case 0x4018: */
1494 sd->subtype = CreativeVista;
1495/* break; */
1496/* } */
1497 break;
1498 case 0x0461: /* MicroInnovation */
1499/* switch (product) { */
1500/* case 0x0815: */
1501 sd->subtype = MicroInnovationIC200;
1502/* break; */
1503/* } */
1504 break;
1505 case 0x0733: /* Rebadged ViewQuest (Intel) and ViewQuest cameras */
1506/* switch (product) { */
1507/* case 0x110: */
1508 sd->subtype = ViewQuestVQ110;
1509/* break; */
1510/* } */
1511 break;
1512 case 0x0af9: /* Hama cameras */
1513 switch (product) {
1514 case 0x0010:
1515 sd->subtype = HamaUSBSightcam;
1516 break;
1517 case 0x0011:
1518 sd->subtype = HamaUSBSightcam2;
1519 break;
1520 }
1521 break;
1522 case 0x8086: /* Intel */
1523/* switch (product) { */
1524/* case 0x0110: */
1525 sd->subtype = IntelEasyPCCamera;
1526/* break; */
1527/* } */
1528 break;
1529 }
1530
1531 /* Read from global register the USB product and vendor IDs, just to 1474 /* Read from global register the USB product and vendor IDs, just to
1532 * prove that we can communicate with the device. This works, which 1475 * prove that we can communicate with the device. This works, which
1533 * confirms at we are communicating properly and that the device 1476 * confirms at we are communicating properly and that the device
@@ -1544,10 +1487,11 @@ static int sd_config(struct gspca_dev *gspca_dev,
1544 PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1); 1487 PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1);
1545 1488
1546 cam = &gspca_dev->cam; 1489 cam = &gspca_dev->cam;
1547 cam->dev_name = (char *) id->driver_info;
1548 cam->epaddr = 0x01; 1490 cam->epaddr = 0x01;
1549 cam->cam_mode = sif_mode; 1491 cam->cam_mode = sif_mode;
1550 cam->nmodes = ARRAY_SIZE(sif_mode); 1492 cam->nmodes = ARRAY_SIZE(sif_mode);
1493
1494 sd->subtype = id->driver_info;
1551 sd->brightness = BRIGHTNESS_DEF; 1495 sd->brightness = BRIGHTNESS_DEF;
1552 1496
1553 switch (sd->subtype) { 1497 switch (sd->subtype) {
@@ -1619,77 +1563,30 @@ static void sd_close(struct gspca_dev *gspca_dev)
1619{ 1563{
1620} 1564}
1621 1565
1622/* convert YUVY per line to YUYV (YUV 4:2:2) */
1623static void yuvy_decode(unsigned char *out,
1624 unsigned char *in,
1625 int width,
1626 int height)
1627{
1628 unsigned char *Ui, *Vi, *yi, *yi1;
1629 unsigned char *out1;
1630 int i, j;
1631
1632 yi = in;
1633 for (i = height / 2; --i >= 0; ) {
1634 out1 = out + width * 2; /* next line */
1635 Ui = yi + width;
1636 Vi = Ui + width / 2;
1637 yi1 = Vi + width / 2;
1638 for (j = width / 2; --j >= 0; ) {
1639 *out++ = 128 + *yi++;
1640 *out++ = 128 + *Ui;
1641 *out++ = 128 + *yi++;
1642 *out++ = 128 + *Vi;
1643
1644 *out1++ = 128 + *yi1++;
1645 *out1++ = 128 + *Ui++;
1646 *out1++ = 128 + *yi1++;
1647 *out1++ = 128 + *Vi++;
1648 }
1649 yi += width * 2;
1650 out = out1;
1651 }
1652}
1653
1654static void sd_pkt_scan(struct gspca_dev *gspca_dev, 1566static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1655 struct gspca_frame *frame, /* target */ 1567 struct gspca_frame *frame, /* target */
1656 __u8 *data, /* isoc packet */ 1568 __u8 *data, /* isoc packet */
1657 int len) /* iso packet length */ 1569 int len) /* iso packet length */
1658{ 1570{
1659 struct sd *sd = (struct sd *) gspca_dev;
1660
1661 switch (data[0]) { 1571 switch (data[0]) {
1662 case 0: /* start of frame */ 1572 case 0: /* start of frame */
1663 if (gspca_dev->last_packet_type == FIRST_PACKET) { 1573 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
1664 yuvy_decode(sd->tmpbuf2, sd->tmpbuf, 1574 data, 0);
1665 gspca_dev->width,
1666 gspca_dev->height);
1667 frame = gspca_frame_add(gspca_dev,
1668 LAST_PACKET,
1669 frame,
1670 sd->tmpbuf2,
1671 gspca_dev->width
1672 * gspca_dev->height
1673 * 2);
1674 }
1675 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
1676 data, 0);
1677 data += SPCA508_OFFSET_DATA; 1575 data += SPCA508_OFFSET_DATA;
1678 len -= SPCA508_OFFSET_DATA; 1576 len -= SPCA508_OFFSET_DATA;
1679 if (len > 0) 1577 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
1680 memcpy(sd->tmpbuf, data, len); 1578 data, len);
1681 else 1579 break;
1682 len = 0;
1683 sd->buflen = len;
1684 return;
1685 case 0xff: /* drop */ 1580 case 0xff: /* drop */
1686/* gspca_dev->last_packet_type = DISCARD_PACKET; */ 1581/* gspca_dev->last_packet_type = DISCARD_PACKET; */
1687 return; 1582 break;
1583 default:
1584 data += 1;
1585 len -= 1;
1586 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
1587 data, len);
1588 break;
1688 } 1589 }
1689 data += 1;
1690 len -= 1;
1691 memcpy(&sd->tmpbuf[sd->buflen], data, len);
1692 sd->buflen += len;
1693} 1590}
1694 1591
1695static void setbrightness(struct gspca_dev *gspca_dev) 1592static void setbrightness(struct gspca_dev *gspca_dev)
@@ -1745,15 +1642,14 @@ static const struct sd_desc sd_desc = {
1745}; 1642};
1746 1643
1747/* -- module initialisation -- */ 1644/* -- module initialisation -- */
1748#define DVNM(name) .driver_info = (kernel_ulong_t) name
1749static const __devinitdata struct usb_device_id device_table[] = { 1645static const __devinitdata struct usb_device_id device_table[] = {
1750 {USB_DEVICE(0x0130, 0x0130), DVNM("Clone Digital Webcam 11043")}, 1646 {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam},
1751 {USB_DEVICE(0x041e, 0x4018), DVNM("Creative Webcam Vista (PD1100)")}, 1647 {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista},
1752 {USB_DEVICE(0x0461, 0x0815), DVNM("Micro Innovation IC200")}, 1648 {USB_DEVICE(0x0461, 0x0815), .driver_info = MicroInnovationIC200},
1753 {USB_DEVICE(0x0733, 0x0110), DVNM("ViewQuest VQ110")}, 1649 {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110},
1754 {USB_DEVICE(0x0af9, 0x0010), DVNM("Hama USB Sightcam 100")}, 1650 {USB_DEVICE(0x0af9, 0x0010), .driver_info = HamaUSBSightcam},
1755 {USB_DEVICE(0x0af9, 0x0011), DVNM("Hama USB Sightcam 100")}, 1651 {USB_DEVICE(0x0af9, 0x0011), .driver_info = HamaUSBSightcam2},
1756 {USB_DEVICE(0x8086, 0x0110), DVNM("Intel Easy PC Camera")}, 1652 {USB_DEVICE(0x8086, 0x0110), .driver_info = IntelEasyPCCamera},
1757 {} 1653 {}
1758}; 1654};
1759MODULE_DEVICE_TABLE(usb, device_table); 1655MODULE_DEVICE_TABLE(usb, device_table);
@@ -1778,7 +1674,7 @@ static int __init sd_mod_init(void)
1778{ 1674{
1779 if (usb_register(&sd_driver) < 0) 1675 if (usb_register(&sd_driver) < 0)
1780 return -1; 1676 return -1;
1781 PDEBUG(D_PROBE, "v%s registered", version); 1677 PDEBUG(D_PROBE, "registered");
1782 return 0; 1678 return 0;
1783} 1679}
1784static void __exit sd_mod_exit(void) 1680static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index b659bd0f788d..a26174508cb9 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -24,9 +24,6 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -582,35 +579,15 @@ static int sd_config(struct gspca_dev *gspca_dev,
582 PDEBUG(D_PROBE, "Bad vendor / product from device"); 579 PDEBUG(D_PROBE, "Bad vendor / product from device");
583 return -EINVAL; 580 return -EINVAL;
584 } 581 }
585 switch (product) { 582
586 case 0x0928:
587 case 0x0929:
588 case 0x092a:
589 case 0x092b:
590 case 0x092c:
591 case 0x092d:
592 case 0x092e:
593 case 0x092f:
594 case 0x403b:
595 sd->chip_revision = Rev012A;
596 break;
597 default:
598/* case 0x0561:
599 case 0x0815: * ?? in spca508.c
600 case 0x401a:
601 case 0x7004:
602 case 0x7e50:
603 case 0xa001:
604 case 0xcdee: */
605 sd->chip_revision = Rev072A;
606 break;
607 }
608 cam = &gspca_dev->cam; 583 cam = &gspca_dev->cam;
609 cam->dev_name = (char *) id->driver_info; 584 cam->dev_name = (char *) id->driver_info;
610 cam->epaddr = 0x01; 585 cam->epaddr = 0x01;
611 gspca_dev->nbalt = 7 + 1; /* choose alternate 7 first */ 586 gspca_dev->nbalt = 7 + 1; /* choose alternate 7 first */
612 cam->cam_mode = sif_mode; 587 cam->cam_mode = sif_mode;
613 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; 588 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
589
590 sd->chip_revision = id->driver_info;
614 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; 591 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
615 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; 592 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
616 sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; 593 sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value;
@@ -997,23 +974,22 @@ static const struct sd_desc sd_desc = {
997}; 974};
998 975
999/* -- module initialisation -- */ 976/* -- module initialisation -- */
1000#define DVNM(name) .driver_info = (kernel_ulong_t) name
1001static const __devinitdata struct usb_device_id device_table[] = { 977static const __devinitdata struct usb_device_id device_table[] = {
1002 {USB_DEVICE(0x041e, 0x401a), DVNM("Creative Webcam Vista (PD1100)")}, 978 {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A},
1003 {USB_DEVICE(0x041e, 0x403b), DVNM("Creative Webcam Vista (VF0010)")}, 979 {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A},
1004 {USB_DEVICE(0x0458, 0x7004), DVNM("Genius VideoCAM Express V2")}, 980 {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A},
1005 {USB_DEVICE(0x046d, 0x0928), DVNM("Logitech QC Express Etch2")}, 981 {USB_DEVICE(0x046d, 0x0928), .driver_info = Rev012A},
1006 {USB_DEVICE(0x046d, 0x0929), DVNM("Labtec Webcam Elch2")}, 982 {USB_DEVICE(0x046d, 0x0929), .driver_info = Rev012A},
1007 {USB_DEVICE(0x046d, 0x092a), DVNM("Logitech QC for Notebook")}, 983 {USB_DEVICE(0x046d, 0x092a), .driver_info = Rev012A},
1008 {USB_DEVICE(0x046d, 0x092b), DVNM("Labtec Webcam Plus")}, 984 {USB_DEVICE(0x046d, 0x092b), .driver_info = Rev012A},
1009 {USB_DEVICE(0x046d, 0x092c), DVNM("Logitech QC chat Elch2")}, 985 {USB_DEVICE(0x046d, 0x092c), .driver_info = Rev012A},
1010 {USB_DEVICE(0x046d, 0x092d), DVNM("Logitech QC Elch2")}, 986 {USB_DEVICE(0x046d, 0x092d), .driver_info = Rev012A},
1011 {USB_DEVICE(0x046d, 0x092e), DVNM("Logitech QC Elch2")}, 987 {USB_DEVICE(0x046d, 0x092e), .driver_info = Rev012A},
1012 {USB_DEVICE(0x046d, 0x092f), DVNM("Logitech QC Elch2")}, 988 {USB_DEVICE(0x046d, 0x092f), .driver_info = Rev012A},
1013 {USB_DEVICE(0x04fc, 0x0561), DVNM("Flexcam 100")}, 989 {USB_DEVICE(0x04fc, 0x0561), .driver_info = Rev072A},
1014 {USB_DEVICE(0x060b, 0xa001), DVNM("Maxell Compact Pc PM3")}, 990 {USB_DEVICE(0x060b, 0xa001), .driver_info = Rev072A},
1015 {USB_DEVICE(0x10fd, 0x7e50), DVNM("FlyCam Usb 100")}, 991 {USB_DEVICE(0x10fd, 0x7e50), .driver_info = Rev072A},
1016 {USB_DEVICE(0xabcd, 0xcdee), DVNM("Petcam")}, 992 {USB_DEVICE(0xabcd, 0xcdee), .driver_info = Rev072A},
1017 {} 993 {}
1018}; 994};
1019 995
@@ -1039,7 +1015,7 @@ static int __init sd_mod_init(void)
1039{ 1015{
1040 if (usb_register(&sd_driver) < 0) 1016 if (usb_register(&sd_driver) < 0)
1041 return -1; 1017 return -1;
1042 PDEBUG(D_PROBE, "v%s registered", version); 1018 PDEBUG(D_PROBE, "registered");
1043 return 0; 1019 return 0;
1044} 1020}
1045static void __exit sd_mod_exit(void) 1021static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c
index c78ee0d3e59b..16219cf6a6d5 100644
--- a/drivers/media/video/gspca/stk014.c
+++ b/drivers/media/video/gspca/stk014.c
@@ -23,9 +23,6 @@
23#include "gspca.h" 23#include "gspca.h"
24#include "jpeg.h" 24#include "jpeg.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
27static const char version[] = "2.1.7";
28
29MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); 26MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
30MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); 27MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver");
31MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
@@ -299,7 +296,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
299 struct sd *sd = (struct sd *) gspca_dev; 296 struct sd *sd = (struct sd *) gspca_dev;
300 struct cam *cam = &gspca_dev->cam; 297 struct cam *cam = &gspca_dev->cam;
301 298
302 cam->dev_name = (char *) id->driver_info;
303 cam->epaddr = 0x02; 299 cam->epaddr = 0x02;
304 gspca_dev->cam.cam_mode = vga_mode; 300 gspca_dev->cam.cam_mode = vga_mode;
305 gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode); 301 gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode);
@@ -549,9 +545,8 @@ static const struct sd_desc sd_desc = {
549}; 545};
550 546
551/* -- module initialisation -- */ 547/* -- module initialisation -- */
552#define DVNM(name) .driver_info = (kernel_ulong_t) name
553static const __devinitdata struct usb_device_id device_table[] = { 548static const __devinitdata struct usb_device_id device_table[] = {
554 {USB_DEVICE(0x05e1, 0x0893), DVNM("Syntek DV4000")}, 549 {USB_DEVICE(0x05e1, 0x0893)},
555 {} 550 {}
556}; 551};
557MODULE_DEVICE_TABLE(usb, device_table); 552MODULE_DEVICE_TABLE(usb, device_table);
@@ -576,7 +571,7 @@ static int __init sd_mod_init(void)
576{ 571{
577 if (usb_register(&sd_driver) < 0) 572 if (usb_register(&sd_driver) < 0)
578 return -1; 573 return -1;
579 info("v%s registered", version); 574 info("registered");
580 return 0; 575 return 0;
581} 576}
582static void __exit sd_mod_exit(void) 577static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c
index abd7bef9b3d1..54efa48bee01 100644
--- a/drivers/media/video/gspca/sunplus.c
+++ b/drivers/media/video/gspca/sunplus.c
@@ -24,9 +24,6 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 8)
28static const char version[] = "2.1.8";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -804,229 +801,29 @@ static int sd_config(struct gspca_dev *gspca_dev,
804 struct sd *sd = (struct sd *) gspca_dev; 801 struct sd *sd = (struct sd *) gspca_dev;
805 struct usb_device *dev = gspca_dev->dev; 802 struct usb_device *dev = gspca_dev->dev;
806 struct cam *cam; 803 struct cam *cam;
807 __u16 vendor; 804
808 __u16 product; 805 cam = &gspca_dev->cam;
809 __u8 fw; 806 cam->epaddr = 0x01;
810 807
811 vendor = id->idVendor; 808 sd->bridge = id->driver_info >> 8;
812 product = id->idProduct; 809 sd->subtype = id->driver_info;
813 switch (vendor) { 810
814 case 0x041e: /* Creative cameras */ 811 if (sd->subtype == AiptekMiniPenCam13) {
815/* switch (product) { */
816/* case 0x400b: */
817/* case 0x4012: */
818/* case 0x4013: */
819/* sd->bridge = BRIDGE_SPCA504C; */
820/* break; */
821/* } */
822 break;
823 case 0x0458: /* Genius KYE cameras */
824/* switch (product) { */
825/* case 0x7006: */
826 sd->bridge = BRIDGE_SPCA504B;
827/* break; */
828/* } */
829 break;
830 case 0x0461: /* MicroInnovation */
831/* switch (product) { */
832/* case 0x0821: */
833 sd->bridge = BRIDGE_SPCA533;
834/* break; */
835/* } */
836 break;
837 case 0x046d: /* Logitech Labtec */
838 switch (product) {
839 case 0x0905:
840 sd->subtype = LogitechClickSmart820;
841 sd->bridge = BRIDGE_SPCA533;
842 break;
843 case 0x0960:
844 sd->subtype = LogitechClickSmart420;
845 sd->bridge = BRIDGE_SPCA504C;
846 break;
847 }
848 break;
849 case 0x0471: /* Philips */
850/* switch (product) { */
851/* case 0x0322: */
852 sd->bridge = BRIDGE_SPCA504B;
853/* break; */
854/* } */
855 break;
856 case 0x04a5: /* Benq */
857 switch (product) {
858 case 0x3003:
859 sd->bridge = BRIDGE_SPCA504B;
860 break;
861 case 0x3008:
862 case 0x300a:
863 sd->bridge = BRIDGE_SPCA533;
864 break;
865 }
866 break;
867 case 0x04f1: /* JVC */
868/* switch (product) { */
869/* case 0x1001: */
870 sd->bridge = BRIDGE_SPCA504B;
871/* break; */
872/* } */
873 break;
874 case 0x04fc: /* SunPlus */
875 switch (product) {
876 case 0x500c:
877 sd->bridge = BRIDGE_SPCA504B;
878 break;
879 case 0x504a:
880/* try to get the firmware as some cam answer 2.0.1.2.2 812/* try to get the firmware as some cam answer 2.0.1.2.2
881 * and should be a spca504b then overwrite that setting */ 813 * and should be a spca504b then overwrite that setting */
882 reg_r(dev, 0x20, 0, gspca_dev->usb_buf, 1); 814 reg_r(dev, 0x20, 0, gspca_dev->usb_buf, 1);
883 fw = gspca_dev->usb_buf[0]; 815 switch (gspca_dev->usb_buf[0]) {
884 if (fw == 1) { 816 case 1:
885 sd->subtype = AiptekMiniPenCam13; 817 break; /* (right bridge/subtype) */
886 sd->bridge = BRIDGE_SPCA504; 818 case 2:
887 } else if (fw == 2) {
888 sd->bridge = BRIDGE_SPCA504B;
889 } else
890 return -ENODEV;
891 break;
892 case 0x504b:
893 sd->bridge = BRIDGE_SPCA504B;
894 break;
895 case 0x5330:
896 sd->bridge = BRIDGE_SPCA533;
897 break;
898 case 0x5360:
899 sd->bridge = BRIDGE_SPCA536;
900 break;
901 case 0xffff:
902 sd->bridge = BRIDGE_SPCA504B;
903 break;
904 }
905 break;
906 case 0x052b: /* ?? Megapix */
907/* switch (product) { */
908/* case 0x1513: */
909 sd->subtype = MegapixV4;
910 sd->bridge = BRIDGE_SPCA533;
911/* break; */
912/* } */
913 break;
914 case 0x0546: /* Polaroid */
915 switch (product) {
916 case 0x3155:
917 sd->bridge = BRIDGE_SPCA533;
918 break;
919 case 0x3191:
920 case 0x3273:
921 sd->bridge = BRIDGE_SPCA504B;
922 break;
923 }
924 break;
925 case 0x055f: /* Mustek cameras */
926 switch (product) {
927 case 0xc211:
928 sd->bridge = BRIDGE_SPCA536;
929 break;
930 case 0xc230:
931 case 0xc232:
932 sd->bridge = BRIDGE_SPCA533;
933 break;
934 case 0xc360:
935 sd->bridge = BRIDGE_SPCA536;
936 break;
937 case 0xc420:
938 sd->bridge = BRIDGE_SPCA504;
939 break;
940 case 0xc430:
941 case 0xc440:
942 sd->bridge = BRIDGE_SPCA533;
943 break;
944 case 0xc520:
945 sd->bridge = BRIDGE_SPCA504;
946 break;
947 case 0xc530:
948 case 0xc540:
949 case 0xc630:
950 case 0xc650:
951 sd->bridge = BRIDGE_SPCA533;
952 break;
953 }
954 break;
955 case 0x05da: /* Digital Dream cameras */
956/* switch (product) { */
957/* case 0x1018: */
958 sd->bridge = BRIDGE_SPCA504B; 819 sd->bridge = BRIDGE_SPCA504B;
959/* break; */ 820 sd->subtype = 0;
960/* } */
961 break;
962 case 0x06d6: /* Trust */
963/* switch (product) { */
964/* case 0x0031: */
965 sd->bridge = BRIDGE_SPCA533; /* SPCA533A */
966/* break; */
967/* } */
968 break;
969 case 0x0733: /* Rebadged ViewQuest (Intel) and ViewQuest cameras */
970 switch (product) {
971 case 0x1311:
972 case 0x1314:
973 case 0x2211:
974 case 0x2221:
975 sd->bridge = BRIDGE_SPCA533;
976 break;
977 case 0x3261:
978 case 0x3281:
979 sd->bridge = BRIDGE_SPCA536;
980 break;
981 }
982 break;
983 case 0x08ca: /* Aiptek */
984 switch (product) {
985 case 0x0104:
986 case 0x0106:
987 sd->bridge = BRIDGE_SPCA533;
988 break;
989 case 0x2008:
990 sd->bridge = BRIDGE_SPCA504B;
991 break;
992 case 0x2010:
993 sd->bridge = BRIDGE_SPCA533;
994 break;
995 case 0x2016:
996 case 0x2018:
997 sd->bridge = BRIDGE_SPCA504B;
998 break;
999 case 0x2020:
1000 case 0x2022:
1001 sd->bridge = BRIDGE_SPCA533;
1002 break;
1003 case 0x2024:
1004 sd->bridge = BRIDGE_SPCA536;
1005 break;
1006 case 0x2028:
1007 sd->bridge = BRIDGE_SPCA533;
1008 break;
1009 case 0x2040:
1010 case 0x2042:
1011 case 0x2050:
1012 case 0x2060:
1013 sd->bridge = BRIDGE_SPCA536;
1014 break; 821 break;
822 default:
823 return -ENODEV;
1015 } 824 }
1016 break;
1017 case 0x0d64: /* SunPlus */
1018/* switch (product) { */
1019/* case 0x0303: */
1020 sd->bridge = BRIDGE_SPCA536;
1021/* break; */
1022/* } */
1023 break;
1024 } 825 }
1025 826
1026 cam = &gspca_dev->cam;
1027 cam->dev_name = (char *) id->driver_info;
1028 cam->epaddr = 0x01;
1029
1030 switch (sd->bridge) { 827 switch (sd->bridge) {
1031 default: 828 default:
1032/* case BRIDGE_SPCA504B: */ 829/* case BRIDGE_SPCA504B: */
@@ -1581,65 +1378,67 @@ static const struct sd_desc sd_desc = {
1581}; 1378};
1582 1379
1583/* -- module initialisation -- */ 1380/* -- module initialisation -- */
1584#define DVNM(name) .driver_info = (kernel_ulong_t) name 1381#define BS(bridge, subtype) \
1382 .driver_info = (BRIDGE_ ## bridge << 8) \
1383 | (subtype)
1585static const __devinitdata struct usb_device_id device_table[] = { 1384static const __devinitdata struct usb_device_id device_table[] = {
1586 {USB_DEVICE(0x041e, 0x400b), DVNM("Creative PC-CAM 600")}, 1385 {USB_DEVICE(0x041e, 0x400b), BS(SPCA504C, 0)},
1587 {USB_DEVICE(0x041e, 0x4012), DVNM("PC-Cam350")}, 1386 {USB_DEVICE(0x041e, 0x4012), BS(SPCA504C, 0)},
1588 {USB_DEVICE(0x041e, 0x4013), DVNM("Creative Pccam750")}, 1387 {USB_DEVICE(0x041e, 0x4013), BS(SPCA504C, 0)},
1589 {USB_DEVICE(0x0458, 0x7006), DVNM("Genius Dsc 1.3 Smart")}, 1388 {USB_DEVICE(0x0458, 0x7006), BS(SPCA504B, 0)},
1590 {USB_DEVICE(0x0461, 0x0821), DVNM("Fujifilm MV-1")}, 1389 {USB_DEVICE(0x0461, 0x0821), BS(SPCA533, 0)},
1591 {USB_DEVICE(0x046d, 0x0905), DVNM("Logitech ClickSmart 820")}, 1390 {USB_DEVICE(0x046d, 0x0905), BS(SPCA533, LogitechClickSmart820)},
1592 {USB_DEVICE(0x046d, 0x0960), DVNM("Logitech ClickSmart 420")}, 1391 {USB_DEVICE(0x046d, 0x0960), BS(SPCA504C, LogitechClickSmart420)},
1593 {USB_DEVICE(0x0471, 0x0322), DVNM("Philips DMVC1300K")}, 1392 {USB_DEVICE(0x0471, 0x0322), BS(SPCA504B, 0)},
1594 {USB_DEVICE(0x04a5, 0x3003), DVNM("Benq DC 1300")}, 1393 {USB_DEVICE(0x04a5, 0x3003), BS(SPCA504B, 0)},
1595 {USB_DEVICE(0x04a5, 0x3008), DVNM("Benq DC 1500")}, 1394 {USB_DEVICE(0x04a5, 0x3008), BS(SPCA533, 0)},
1596 {USB_DEVICE(0x04a5, 0x300a), DVNM("Benq DC3410")}, 1395 {USB_DEVICE(0x04a5, 0x300a), BS(SPCA533, 0)},
1597 {USB_DEVICE(0x04f1, 0x1001), DVNM("JVC GC A50")}, 1396 {USB_DEVICE(0x04f1, 0x1001), BS(SPCA504B, 0)},
1598 {USB_DEVICE(0x04fc, 0x500c), DVNM("Sunplus CA500C")}, 1397 {USB_DEVICE(0x04fc, 0x500c), BS(SPCA504B, 0)},
1599 {USB_DEVICE(0x04fc, 0x504a), DVNM("Aiptek Mini PenCam 1.3")}, 1398 {USB_DEVICE(0x04fc, 0x504a), BS(SPCA504, AiptekMiniPenCam13)},
1600 {USB_DEVICE(0x04fc, 0x504b), DVNM("Maxell MaxPocket LE 1.3")}, 1399 {USB_DEVICE(0x04fc, 0x504b), BS(SPCA504B, 0)},
1601 {USB_DEVICE(0x04fc, 0x5330), DVNM("Digitrex 2110")}, 1400 {USB_DEVICE(0x04fc, 0x5330), BS(SPCA533, 0)},
1602 {USB_DEVICE(0x04fc, 0x5360), DVNM("Sunplus Generic")}, 1401 {USB_DEVICE(0x04fc, 0x5360), BS(SPCA536, 0)},
1603 {USB_DEVICE(0x04fc, 0xffff), DVNM("Pure DigitalDakota")}, 1402 {USB_DEVICE(0x04fc, 0xffff), BS(SPCA504B, 0)},
1604 {USB_DEVICE(0x052b, 0x1513), DVNM("Megapix V4")}, 1403 {USB_DEVICE(0x052b, 0x1513), BS(SPCA533, MegapixV4)},
1605 {USB_DEVICE(0x0546, 0x3155), DVNM("Polaroid PDC3070")}, 1404 {USB_DEVICE(0x0546, 0x3155), BS(SPCA533, 0)},
1606 {USB_DEVICE(0x0546, 0x3191), DVNM("Polaroid Ion 80")}, 1405 {USB_DEVICE(0x0546, 0x3191), BS(SPCA504B, 0)},
1607 {USB_DEVICE(0x0546, 0x3273), DVNM("Polaroid PDC2030")}, 1406 {USB_DEVICE(0x0546, 0x3273), BS(SPCA504B, 0)},
1608 {USB_DEVICE(0x055f, 0xc211), DVNM("Kowa Bs888e Microcamera")}, 1407 {USB_DEVICE(0x055f, 0xc211), BS(SPCA536, 0)},
1609 {USB_DEVICE(0x055f, 0xc230), DVNM("Mustek Digicam 330K")}, 1408 {USB_DEVICE(0x055f, 0xc230), BS(SPCA533, 0)},
1610 {USB_DEVICE(0x055f, 0xc232), DVNM("Mustek MDC3500")}, 1409 {USB_DEVICE(0x055f, 0xc232), BS(SPCA533, 0)},
1611 {USB_DEVICE(0x055f, 0xc360), DVNM("Mustek DV4000 Mpeg4 ")}, 1410 {USB_DEVICE(0x055f, 0xc360), BS(SPCA536, 0)},
1612 {USB_DEVICE(0x055f, 0xc420), DVNM("Mustek gSmart Mini 2")}, 1411 {USB_DEVICE(0x055f, 0xc420), BS(SPCA504, 0)},
1613 {USB_DEVICE(0x055f, 0xc430), DVNM("Mustek Gsmart LCD 2")}, 1412 {USB_DEVICE(0x055f, 0xc430), BS(SPCA533, 0)},
1614 {USB_DEVICE(0x055f, 0xc440), DVNM("Mustek DV 3000")}, 1413 {USB_DEVICE(0x055f, 0xc440), BS(SPCA533, 0)},
1615 {USB_DEVICE(0x055f, 0xc520), DVNM("Mustek gSmart Mini 3")}, 1414 {USB_DEVICE(0x055f, 0xc520), BS(SPCA504, 0)},
1616 {USB_DEVICE(0x055f, 0xc530), DVNM("Mustek Gsmart LCD 3")}, 1415 {USB_DEVICE(0x055f, 0xc530), BS(SPCA533, 0)},
1617 {USB_DEVICE(0x055f, 0xc540), DVNM("Gsmart D30")}, 1416 {USB_DEVICE(0x055f, 0xc540), BS(SPCA533, 0)},
1618 {USB_DEVICE(0x055f, 0xc630), DVNM("Mustek MDC4000")}, 1417 {USB_DEVICE(0x055f, 0xc630), BS(SPCA533, 0)},
1619 {USB_DEVICE(0x055f, 0xc650), DVNM("Mustek MDC5500Z")}, 1418 {USB_DEVICE(0x055f, 0xc650), BS(SPCA533, 0)},
1620 {USB_DEVICE(0x05da, 0x1018), DVNM("Digital Dream Enigma 1.3")}, 1419 {USB_DEVICE(0x05da, 0x1018), BS(SPCA504B, 0)},
1621 {USB_DEVICE(0x06d6, 0x0031), DVNM("Trust 610 LCD PowerC@m Zoom")}, 1420 {USB_DEVICE(0x06d6, 0x0031), BS(SPCA533, 0)},
1622 {USB_DEVICE(0x0733, 0x1311), DVNM("Digital Dream Epsilon 1.3")}, 1421 {USB_DEVICE(0x0733, 0x1311), BS(SPCA533, 0)},
1623 {USB_DEVICE(0x0733, 0x1314), DVNM("Mercury 2.1MEG Deluxe Classic Cam")}, 1422 {USB_DEVICE(0x0733, 0x1314), BS(SPCA533, 0)},
1624 {USB_DEVICE(0x0733, 0x2211), DVNM("Jenoptik jdc 21 LCD")}, 1423 {USB_DEVICE(0x0733, 0x2211), BS(SPCA533, 0)},
1625 {USB_DEVICE(0x0733, 0x2221), DVNM("Mercury Digital Pro 3.1p")}, 1424 {USB_DEVICE(0x0733, 0x2221), BS(SPCA533, 0)},
1626 {USB_DEVICE(0x0733, 0x3261), DVNM("Concord 3045 spca536a")}, 1425 {USB_DEVICE(0x0733, 0x3261), BS(SPCA536, 0)},
1627 {USB_DEVICE(0x0733, 0x3281), DVNM("Cyberpix S550V")}, 1426 {USB_DEVICE(0x0733, 0x3281), BS(SPCA536, 0)},
1628 {USB_DEVICE(0x08ca, 0x0104), DVNM("Aiptek PocketDVII 1.3")}, 1427 {USB_DEVICE(0x08ca, 0x0104), BS(SPCA533, 0)},
1629 {USB_DEVICE(0x08ca, 0x0106), DVNM("Aiptek Pocket DV3100+")}, 1428 {USB_DEVICE(0x08ca, 0x0106), BS(SPCA533, 0)},
1630 {USB_DEVICE(0x08ca, 0x2008), DVNM("Aiptek Mini PenCam 2 M")}, 1429 {USB_DEVICE(0x08ca, 0x2008), BS(SPCA504B, 0)},
1631 {USB_DEVICE(0x08ca, 0x2010), DVNM("Aiptek PocketCam 3M")}, 1430 {USB_DEVICE(0x08ca, 0x2010), BS(SPCA533, 0)},
1632 {USB_DEVICE(0x08ca, 0x2016), DVNM("Aiptek PocketCam 2 Mega")}, 1431 {USB_DEVICE(0x08ca, 0x2016), BS(SPCA504B, 0)},
1633 {USB_DEVICE(0x08ca, 0x2018), DVNM("Aiptek Pencam SD 2M")}, 1432 {USB_DEVICE(0x08ca, 0x2018), BS(SPCA504B, 0)},
1634 {USB_DEVICE(0x08ca, 0x2020), DVNM("Aiptek Slim 3000F")}, 1433 {USB_DEVICE(0x08ca, 0x2020), BS(SPCA533, 0)},
1635 {USB_DEVICE(0x08ca, 0x2022), DVNM("Aiptek Slim 3200")}, 1434 {USB_DEVICE(0x08ca, 0x2022), BS(SPCA533, 0)},
1636 {USB_DEVICE(0x08ca, 0x2024), DVNM("Aiptek DV3500 Mpeg4 ")}, 1435 {USB_DEVICE(0x08ca, 0x2024), BS(SPCA536, 0)},
1637 {USB_DEVICE(0x08ca, 0x2028), DVNM("Aiptek PocketCam4M")}, 1436 {USB_DEVICE(0x08ca, 0x2028), BS(SPCA533, 0)},
1638 {USB_DEVICE(0x08ca, 0x2040), DVNM("Aiptek PocketDV4100M")}, 1437 {USB_DEVICE(0x08ca, 0x2040), BS(SPCA536, 0)},
1639 {USB_DEVICE(0x08ca, 0x2042), DVNM("Aiptek PocketDV5100")}, 1438 {USB_DEVICE(0x08ca, 0x2042), BS(SPCA536, 0)},
1640 {USB_DEVICE(0x08ca, 0x2050), DVNM("Medion MD 41437")}, 1439 {USB_DEVICE(0x08ca, 0x2050), BS(SPCA536, 0)},
1641 {USB_DEVICE(0x08ca, 0x2060), DVNM("Aiptek PocketDV5300")}, 1440 {USB_DEVICE(0x08ca, 0x2060), BS(SPCA536, 0)},
1642 {USB_DEVICE(0x0d64, 0x0303), DVNM("Sunplus FashionCam DXG")}, 1441 {USB_DEVICE(0x0d64, 0x0303), BS(SPCA536, 0)},
1643 {} 1442 {}
1644}; 1443};
1645MODULE_DEVICE_TABLE(usb, device_table); 1444MODULE_DEVICE_TABLE(usb, device_table);
@@ -1664,7 +1463,7 @@ static int __init sd_mod_init(void)
1664{ 1463{
1665 if (usb_register(&sd_driver) < 0) 1464 if (usb_register(&sd_driver) < 0)
1666 return -1; 1465 return -1;
1667 PDEBUG(D_PROBE, "v%s registered", version); 1466 PDEBUG(D_PROBE, "registered");
1668 return 0; 1467 return 0;
1669} 1468}
1670static void __exit sd_mod_exit(void) 1469static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index 00f47e463a05..91b555c34c68 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -1,12 +1,4 @@
1/* 1/*
2 *Notes: * t613 + tas5130A
3 * * Focus to light do not balance well as in win.
4 * Quality in win is not good, but its kinda better.
5 * * Fix some "extraneous bytes", most of apps will show the image anyway
6 * * Gamma table, is there, but its really doing something?
7 * * 7~8 Fps, its ok, max on win its 10.
8 * Costantino Leandro
9 *
10 * V4L2 by Jean-Francois Moine <http://moinejf.free.fr> 2 * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
11 * 3 *
12 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
@@ -22,16 +14,22 @@
22 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 *Notes: * t613 + tas5130A
19 * * Focus to light do not balance well as in win.
20 * Quality in win is not good, but its kinda better.
21 * * Fix some "extraneous bytes", most of apps will show the image anyway
22 * * Gamma table, is there, but its really doing something?
23 * * 7~8 Fps, its ok, max on win its 10.
24 * Costantino Leandro
25 */ 25 */
26 26
27#define MODULE_NAME "t613" 27#define MODULE_NAME "t613"
28
28#include "gspca.h" 29#include "gspca.h"
29#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
30static const char version[] = "2.1.7";
31 30
32#define MAX_GAMMA 0x10 /* 0 to 15 */ 31#define MAX_GAMMA 0x10 /* 0 to 15 */
33 32
34/* From LUVCVIEW */
35#define V4L2_CID_EFFECTS (V4L2_CID_PRIVATE_BASE + 3) 33#define V4L2_CID_EFFECTS (V4L2_CID_PRIVATE_BASE + 3)
36 34
37MODULE_AUTHOR("Leandro Costantino <le_costantino@pixartargentina.com.ar>"); 35MODULE_AUTHOR("Leandro Costantino <le_costantino@pixartargentina.com.ar>");
@@ -424,7 +422,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
424 struct cam *cam; 422 struct cam *cam;
425 423
426 cam = &gspca_dev->cam; 424 cam = &gspca_dev->cam;
427 cam->dev_name = (char *) id->driver_info;
428 cam->epaddr = 0x01; 425 cam->epaddr = 0x01;
429 426
430 cam->cam_mode = vga_mode_t16; 427 cam->cam_mode = vga_mode_t16;
@@ -998,9 +995,8 @@ static const struct sd_desc sd_desc = {
998}; 995};
999 996
1000/* -- module initialisation -- */ 997/* -- module initialisation -- */
1001#define DVNM(name) .driver_info = (kernel_ulong_t) name
1002static const __devinitdata struct usb_device_id device_table[] = { 998static const __devinitdata struct usb_device_id device_table[] = {
1003 {USB_DEVICE(0x17a1, 0x0128), DVNM("XPX Webcam")}, 999 {USB_DEVICE(0x17a1, 0x0128)},
1004 {} 1000 {}
1005}; 1001};
1006MODULE_DEVICE_TABLE(usb, device_table); 1002MODULE_DEVICE_TABLE(usb, device_table);
@@ -1025,7 +1021,7 @@ static int __init sd_mod_init(void)
1025{ 1021{
1026 if (usb_register(&sd_driver) < 0) 1022 if (usb_register(&sd_driver) < 0)
1027 return -1; 1023 return -1;
1028 PDEBUG(D_PROBE, "v%s registered", version); 1024 PDEBUG(D_PROBE, "registered");
1029 return 0; 1025 return 0;
1030} 1026}
1031static void __exit sd_mod_exit(void) 1027static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c
index 0b793899095f..1ff8ba2f7fe5 100644
--- a/drivers/media/video/gspca/tv8532.c
+++ b/drivers/media/video/gspca/tv8532.c
@@ -22,9 +22,6 @@
22 22
23#include "gspca.h" 23#include "gspca.h"
24 24
25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
26static const char version[] = "2.1.7";
27
28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 25MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
29MODULE_DESCRIPTION("TV8532 USB Camera Driver"); 26MODULE_DESCRIPTION("TV8532 USB Camera Driver");
30MODULE_LICENSE("GPL"); 27MODULE_LICENSE("GPL");
@@ -249,7 +246,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
249 tv_8532WriteEEprom(gspca_dev); 246 tv_8532WriteEEprom(gspca_dev);
250 247
251 cam = &gspca_dev->cam; 248 cam = &gspca_dev->cam;
252 cam->dev_name = (char *) id->driver_info;
253 cam->epaddr = 1; 249 cam->epaddr = 1;
254 cam->cam_mode = sif_mode; 250 cam->cam_mode = sif_mode;
255 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; 251 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
@@ -624,13 +620,12 @@ static const struct sd_desc sd_desc = {
624}; 620};
625 621
626/* -- module initialisation -- */ 622/* -- module initialisation -- */
627#define DVNM(name) .driver_info = (kernel_ulong_t) name
628static const __devinitdata struct usb_device_id device_table[] = { 623static const __devinitdata struct usb_device_id device_table[] = {
629 {USB_DEVICE(0x046d, 0x0920), DVNM("QC Express")}, 624 {USB_DEVICE(0x046d, 0x0920)},
630 {USB_DEVICE(0x046d, 0x0921), DVNM("Labtec Webcam")}, 625 {USB_DEVICE(0x046d, 0x0921)},
631 {USB_DEVICE(0x0545, 0x808b), DVNM("Veo Stingray")}, 626 {USB_DEVICE(0x0545, 0x808b)},
632 {USB_DEVICE(0x0545, 0x8333), DVNM("Veo Stingray")}, 627 {USB_DEVICE(0x0545, 0x8333)},
633 {USB_DEVICE(0x0923, 0x010f), DVNM("ICM532 cams")}, 628 {USB_DEVICE(0x0923, 0x010f)},
634 {} 629 {}
635}; 630};
636 631
@@ -656,7 +651,7 @@ static int __init sd_mod_init(void)
656{ 651{
657 if (usb_register(&sd_driver) < 0) 652 if (usb_register(&sd_driver) < 0)
658 return -1; 653 return -1;
659 PDEBUG(D_PROBE, "v%s registered", version); 654 PDEBUG(D_PROBE, "registered");
660 return 0; 655 return 0;
661} 656}
662 657
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c
index fcf2c9e32573..a4221753e1bf 100644
--- a/drivers/media/video/gspca/vc032x.c
+++ b/drivers/media/video/gspca/vc032x.c
@@ -24,9 +24,6 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -1419,30 +1416,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
1419 struct usb_device *dev = gspca_dev->dev; 1416 struct usb_device *dev = gspca_dev->dev;
1420 struct cam *cam; 1417 struct cam *cam;
1421 int sensor; 1418 int sensor;
1422 __u16 product;
1423
1424 product = id->idProduct;
1425 sd->bridge = BRIDGE_VC0321;
1426 switch (id->idVendor) {
1427 case 0x0ac8: /* Vimicro z-star */
1428 switch (product) {
1429 case 0x0323:
1430 sd->bridge = BRIDGE_VC0323;
1431 break;
1432 }
1433 break;
1434 case 0x17ef: /* Lenovo */
1435/* switch (product) { */
1436/* case 0x4802: * Lenovo MI1310_SOC */
1437 sd->bridge = BRIDGE_VC0323;
1438/* break; */
1439/* } */
1440 break;
1441 }
1442 1419
1443 cam = &gspca_dev->cam; 1420 cam = &gspca_dev->cam;
1444 cam->dev_name = (char *) id->driver_info;
1445 cam->epaddr = 0x02; 1421 cam->epaddr = 0x02;
1422 sd->bridge = id->driver_info;
1446 if (sd->bridge == BRIDGE_VC0321) { 1423 if (sd->bridge == BRIDGE_VC0321) {
1447 cam->cam_mode = vc0321_mode; 1424 cam->cam_mode = vc0321_mode;
1448 cam->nmodes = ARRAY_SIZE(vc0321_mode); 1425 cam->nmodes = ARRAY_SIZE(vc0321_mode);
@@ -1771,16 +1748,15 @@ static const struct sd_desc sd_desc = {
1771}; 1748};
1772 1749
1773/* -- module initialisation -- */ 1750/* -- module initialisation -- */
1774#define DVNM(name) .driver_info = (kernel_ulong_t) name
1775static const __devinitdata struct usb_device_id device_table[] = { 1751static const __devinitdata struct usb_device_id device_table[] = {
1776 {USB_DEVICE(0x046d, 0x0892), DVNM("Logitech Orbicam")}, 1752 {USB_DEVICE(0x046d, 0x0892), .driver_info = BRIDGE_VC0321},
1777 {USB_DEVICE(0x046d, 0x0896), DVNM("Logitech Orbicam")}, 1753 {USB_DEVICE(0x046d, 0x0896), .driver_info = BRIDGE_VC0321},
1778 {USB_DEVICE(0x0ac8, 0x0321), DVNM("Vimicro generic vc0321")}, 1754 {USB_DEVICE(0x0ac8, 0x0321), .driver_info = BRIDGE_VC0321},
1779 {USB_DEVICE(0x0ac8, 0x0323), DVNM("Vimicro Vc0323")}, 1755 {USB_DEVICE(0x0ac8, 0x0323), .driver_info = BRIDGE_VC0323},
1780 {USB_DEVICE(0x0ac8, 0x0328), DVNM("A4Tech PK-130MG")}, 1756 {USB_DEVICE(0x0ac8, 0x0328), .driver_info = BRIDGE_VC0321},
1781 {USB_DEVICE(0x0ac8, 0xc001), DVNM("Sony embedded vimicro")}, 1757 {USB_DEVICE(0x0ac8, 0xc001), .driver_info = BRIDGE_VC0321},
1782 {USB_DEVICE(0x0ac8, 0xc002), DVNM("Sony embedded vimicro")}, 1758 {USB_DEVICE(0x0ac8, 0xc002), .driver_info = BRIDGE_VC0321},
1783 {USB_DEVICE(0x17ef, 0x4802), DVNM("Lenovo Vc0323+MI1310_SOC")}, 1759 {USB_DEVICE(0x17ef, 0x4802), .driver_info = BRIDGE_VC0323},
1784 {} 1760 {}
1785}; 1761};
1786MODULE_DEVICE_TABLE(usb, device_table); 1762MODULE_DEVICE_TABLE(usb, device_table);
@@ -1805,7 +1781,7 @@ static int __init sd_mod_init(void)
1805{ 1781{
1806 if (usb_register(&sd_driver) < 0) 1782 if (usb_register(&sd_driver) < 0)
1807 return -1; 1783 return -1;
1808 PDEBUG(D_PROBE, "v%s registered", version); 1784 PDEBUG(D_PROBE, "registered");
1809 return 0; 1785 return 0;
1810} 1786}
1811static void __exit sd_mod_exit(void) 1787static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c
index b761b11c5c6a..22a994ccb1d5 100644
--- a/drivers/media/video/gspca/zc3xx.c
+++ b/drivers/media/video/gspca/zc3xx.c
@@ -24,9 +24,6 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, " 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, "
31 "Serge A. Suchkov <Serge.A.S@tochka.ru>"); 28 "Serge A. Suchkov <Serge.A.S@tochka.ru>");
32MODULE_DESCRIPTION("GSPCA ZC03xx/VC3xx USB Camera Driver"); 29MODULE_DESCRIPTION("GSPCA ZC03xx/VC3xx USB Camera Driver");
@@ -49,7 +46,7 @@ struct sd {
49 __u8 sharpness; 46 __u8 sharpness;
50 47
51 char qindex; 48 char qindex;
52 char sensor; /* Type of image sensor chip */ 49 signed char sensor; /* Type of image sensor chip */
53/* !! values used in different tables */ 50/* !! values used in different tables */
54#define SENSOR_CS2102 0 51#define SENSOR_CS2102 0
55#define SENSOR_CS2102K 1 52#define SENSOR_CS2102K 1
@@ -2205,10 +2202,10 @@ static const struct usb_action hdcs2020xb_InitialScale[] = {
2205}; 2202};
2206static const struct usb_action hdcs2020b_50HZ[] = { 2203static const struct usb_action hdcs2020b_50HZ[] = {
2207 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ 2204 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2208 {0xaa, 0x13, 0x0018}, /* 00,13,18,aa */ 2205 {0xaa, 0x13, 0x0018}, /* 00,13,18,aa */
2209 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ 2206 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
2210 {0xaa, 0x0e, 0x0005}, /* 00,0e,05,aa */ 2207 {0xaa, 0x0e, 0x0005}, /* 00,0e,05,aa */
2211 {0xaa, 0x19, 0x001f}, /* 00,19,1f,aa */ 2208 {0xaa, 0x19, 0x001f}, /* 00,19,1f,aa */
2212 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ 2209 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2213 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */ 2210 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */
2214 {0xa0, 0x76, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,76,cc */ 2211 {0xa0, 0x76, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,76,cc */
@@ -2226,10 +2223,10 @@ static const struct usb_action hdcs2020b_50HZ[] = {
2226}; 2223};
2227static const struct usb_action hdcs2020b_60HZ[] = { 2224static const struct usb_action hdcs2020b_60HZ[] = {
2228 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ 2225 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2229 {0xaa, 0x13, 0x0031}, /* 00,13,31,aa */ 2226 {0xaa, 0x13, 0x0031}, /* 00,13,31,aa */
2230 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ 2227 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
2231 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */ 2228 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */
2232 {0xaa, 0x19, 0x00cd}, /* 00,19,cd,aa */ 2229 {0xaa, 0x19, 0x00cd}, /* 00,19,cd,aa */
2233 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ 2230 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2234 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */ 2231 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */
2235 {0xa0, 0x62, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,62,cc */ 2232 {0xa0, 0x62, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,62,cc */
@@ -2247,10 +2244,10 @@ static const struct usb_action hdcs2020b_60HZ[] = {
2247}; 2244};
2248static const struct usb_action hdcs2020b_NoFliker[] = { 2245static const struct usb_action hdcs2020b_NoFliker[] = {
2249 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ 2246 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2250 {0xaa, 0x13, 0x0010}, /* 00,13,10,aa */ 2247 {0xaa, 0x13, 0x0010}, /* 00,13,10,aa */
2251 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ 2248 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
2252 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */ 2249 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */
2253 {0xaa, 0x19, 0x0000}, /* 00,19,00,aa */ 2250 {0xaa, 0x19, 0x0000}, /* 00,19,00,aa */
2254 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ 2251 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2255 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */ 2252 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */
2256 {0xa0, 0x70, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,70,cc */ 2253 {0xa0, 0x70, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,70,cc */
@@ -4102,27 +4099,27 @@ static const struct usb_action pas106b_Initial_com[] = {
4102 4099
4103static const struct usb_action pas106b_Initial[] = { /* 176x144 */ 4100static const struct usb_action pas106b_Initial[] = { /* 176x144 */
4104/* JPEG control */ 4101/* JPEG control */
4105 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4102 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4106/* Sream and Sensor specific */ 4103/* Sream and Sensor specific */
4107 {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT}, /* CMOSSensorSelect */ 4104 {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT},
4108/* Picture size */ 4105/* Picture size */
4109 {0xa0, 0x00, ZC3XX_R003_FRAMEWIDTHHIGH}, /* FrameWidthHigh 00 */ 4106 {0xa0, 0x00, ZC3XX_R003_FRAMEWIDTHHIGH},
4110 {0xa0, 0xb0, ZC3XX_R004_FRAMEWIDTHLOW}, /* FrameWidthLow B0 */ 4107 {0xa0, 0xb0, ZC3XX_R004_FRAMEWIDTHLOW},
4111 {0xa0, 0x00, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* FrameHeightHigh 00 */ 4108 {0xa0, 0x00, ZC3XX_R005_FRAMEHEIGHTHIGH},
4112 {0xa0, 0x90, ZC3XX_R006_FRAMEHEIGHTLOW}, /* FrameHightLow 90 */ 4109 {0xa0, 0x90, ZC3XX_R006_FRAMEHEIGHTLOW},
4113/* System */ 4110/* System */
4114 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* SystemOperating */ 4111 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
4115/* Sream and Sensor specific */ 4112/* Sream and Sensor specific */
4116 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ 4113 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
4117 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ 4114 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
4118/* Sensor Interface */ 4115/* Sensor Interface */
4119 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* Compatibily Mode */ 4116 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE},
4120/* Window inside sensor array */ 4117/* Window inside sensor array */
4121 {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW}, /* WinXStartLow */ 4118 {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW},
4122 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* FirstYLow */ 4119 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
4123 {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW}, /* FirstxLow */ 4120 {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW},
4124 {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW}, /* WinHeightLow */ 4121 {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW},
4125 {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW}, /* WinWidthLow */ 4122 {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW},
4126/* Init the sensor */ 4123/* Init the sensor */
4127 {0xaa, 0x02, 0x0004}, 4124 {0xaa, 0x02, 0x0004},
4128 {0xaa, 0x08, 0x0000}, 4125 {0xaa, 0x08, 0x0000},
@@ -4135,40 +4132,40 @@ static const struct usb_action pas106b_Initial[] = { /* 176x144 */
4135 {0xaa, 0x14, 0x0081}, 4132 {0xaa, 0x14, 0x0081},
4136 4133
4137/* Other registors */ 4134/* Other registors */
4138 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* SensorCorrection */ 4135 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
4139/* Frame retreiving */ 4136/* Frame retreiving */
4140 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* AutoAdjustFPS */ 4137 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4141/* Gains */ 4138/* Gains */
4142 {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN}, /* DigitalGain */ 4139 {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN},
4143/* Unknown */ 4140/* Unknown */
4144 {0xa0, 0x00, 0x01ad}, 4141 {0xa0, 0x00, 0x01ad},
4145/* Sharpness */ 4142/* Sharpness */
4146 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* SharpnessMode */ 4143 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
4147 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* Sharpness05 */ 4144 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
4148/* Other registors */ 4145/* Other registors */
4149 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ 4146 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4150/* Auto exposure and white balance */ 4147/* Auto exposure and white balance */
4151 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ 4148 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4152/*Dead pixels */ 4149/*Dead pixels */
4153 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ 4150 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4154/* EEPROM */ 4151/* EEPROM */
4155 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ 4152 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4156/* JPEG control */ 4153/* JPEG control */
4157 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4154 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4158 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ 4155 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
4159 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ 4156 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
4160/* Other registers */ 4157/* Other registers */
4161 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ 4158 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4162/* Auto exposure and white balance */ 4159/* Auto exposure and white balance */
4163 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ 4160 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4164/*Dead pixels */ 4161/*Dead pixels */
4165 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ 4162 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4166/* EEPROM */ 4163/* EEPROM */
4167 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ 4164 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4168/* JPEG control */ 4165/* JPEG control */
4169 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4166 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4170 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ 4167 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
4171 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ 4168 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
4172 4169
4173 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */ 4170 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */
4174 {0xa0, 0xf4, ZC3XX_R10B_RGB01}, 4171 {0xa0, 0xf4, ZC3XX_R10B_RGB01},
@@ -4180,67 +4177,67 @@ static const struct usb_action pas106b_Initial[] = { /* 176x144 */
4180 {0xa0, 0xf4, ZC3XX_R111_RGB21}, 4177 {0xa0, 0xf4, ZC3XX_R111_RGB21},
4181 {0xa0, 0x58, ZC3XX_R112_RGB22}, 4178 {0xa0, 0x58, ZC3XX_R112_RGB22},
4182/* Auto correction */ 4179/* Auto correction */
4183 {0xa0, 0x03, ZC3XX_R181_WINXSTART}, /* WinXstart */ 4180 {0xa0, 0x03, ZC3XX_R181_WINXSTART},
4184 {0xa0, 0x08, ZC3XX_R182_WINXWIDTH}, /* WinXWidth */ 4181 {0xa0, 0x08, ZC3XX_R182_WINXWIDTH},
4185 {0xa0, 0x16, ZC3XX_R183_WINXCENTER}, /* WinXCenter */ 4182 {0xa0, 0x16, ZC3XX_R183_WINXCENTER},
4186 {0xa0, 0x03, ZC3XX_R184_WINYSTART}, /* WinYStart */ 4183 {0xa0, 0x03, ZC3XX_R184_WINYSTART},
4187 {0xa0, 0x05, ZC3XX_R185_WINYWIDTH}, /* WinYWidth */ 4184 {0xa0, 0x05, ZC3XX_R185_WINYWIDTH},
4188 {0xa0, 0x14, ZC3XX_R186_WINYCENTER}, /* WinYCenter */ 4185 {0xa0, 0x14, ZC3XX_R186_WINYCENTER},
4189 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4186 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4190 4187
4191/* Auto exposure and white balance */ 4188/* Auto exposure and white balance */
4192 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* ExposureLimitHigh */ 4189 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4193 {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, /* ExposureLimitMid */ 4190 {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID},
4194 {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW}, /* ExposureLimitLow */ 4191 {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW},
4195 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* AntiFlickerHigh */ 4192 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4196 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* AntiFlickerLow */ 4193 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4197 {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW}, /* AntiFlickerLow */ 4194 {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW},
4198 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, /* AEBFreeze */ 4195 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE},
4199 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, /* AEBUnfreeze */ 4196 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE},
4200/* sensor on */ 4197/* sensor on */
4201 {0xaa, 0x07, 0x00b1}, 4198 {0xaa, 0x07, 0x00b1},
4202 {0xaa, 0x05, 0x0003}, 4199 {0xaa, 0x05, 0x0003},
4203 {0xaa, 0x04, 0x0001}, 4200 {0xaa, 0x04, 0x0001},
4204 {0xaa, 0x03, 0x003b}, 4201 {0xaa, 0x03, 0x003b},
4205/* Gains */ 4202/* Gains */
4206 {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* DigitalLimitDiff */ 4203 {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF},
4207 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* DigitalGainStep */ 4204 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP},
4208 {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ 4205 {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN},
4209 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ 4206 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4210/* Auto correction */ 4207/* Auto correction */
4211 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4208 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE},
4212 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ 4209 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */
4213 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4210 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4214/* Gains */ 4211/* Gains */
4215 {0xa0, 0x40, ZC3XX_R116_RGAIN}, /* RGain */ 4212 {0xa0, 0x40, ZC3XX_R116_RGAIN},
4216 {0xa0, 0x40, ZC3XX_R117_GGAIN}, /* GGain */ 4213 {0xa0, 0x40, ZC3XX_R117_GGAIN},
4217 {0xa0, 0x40, ZC3XX_R118_BGAIN}, /* BGain */ 4214 {0xa0, 0x40, ZC3XX_R118_BGAIN},
4218 {} 4215 {}
4219}; 4216};
4220 4217
4221static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */ 4218static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */
4222/* JPEG control */ 4219/* JPEG control */
4223 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4220 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4224/* Sream and Sensor specific */ 4221/* Sream and Sensor specific */
4225 {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT}, /* CMOSSensorSelect */ 4222 {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT},
4226/* Picture size */ 4223/* Picture size */
4227 {0xa0, 0x01, ZC3XX_R003_FRAMEWIDTHHIGH}, /* FrameWidthHigh */ 4224 {0xa0, 0x01, ZC3XX_R003_FRAMEWIDTHHIGH},
4228 {0xa0, 0x60, ZC3XX_R004_FRAMEWIDTHLOW}, /* FrameWidthLow */ 4225 {0xa0, 0x60, ZC3XX_R004_FRAMEWIDTHLOW},
4229 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* FrameHeightHigh */ 4226 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
4230 {0xa0, 0x20, ZC3XX_R006_FRAMEHEIGHTLOW}, /* FrameHightLow */ 4227 {0xa0, 0x20, ZC3XX_R006_FRAMEHEIGHTLOW},
4231/* System */ 4228/* System */
4232 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* SystemOperating */ 4229 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
4233/* Sream and Sensor specific */ 4230/* Sream and Sensor specific */
4234 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ 4231 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
4235 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ 4232 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
4236/* Sensor Interface */ 4233/* Sensor Interface */
4237 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* Compatibily Mode */ 4234 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE},
4238/* Window inside sensor array */ 4235/* Window inside sensor array */
4239 {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW}, /* WinXStartLow */ 4236 {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW},
4240 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* FirstYLow */ 4237 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
4241 {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW}, /* FirstxLow */ 4238 {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW},
4242 {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW}, /* WinHeightLow */ 4239 {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW},
4243 {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW}, /* WinWidthLow */ 4240 {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW},
4244/* Init the sensor */ 4241/* Init the sensor */
4245 {0xaa, 0x02, 0x0004}, 4242 {0xaa, 0x02, 0x0004},
4246 {0xaa, 0x08, 0x0000}, 4243 {0xaa, 0x08, 0x0000},
@@ -4253,41 +4250,41 @@ static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */
4253 {0xaa, 0x14, 0x0081}, 4250 {0xaa, 0x14, 0x0081},
4254 4251
4255/* Other registors */ 4252/* Other registors */
4256 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* SensorCorrection */ 4253 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
4257/* Frame retreiving */ 4254/* Frame retreiving */
4258 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* AutoAdjustFPS */ 4255 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4259/* Gains */ 4256/* Gains */
4260 {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN}, /* DigitalGain */ 4257 {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN},
4261/* Unknown */ 4258/* Unknown */
4262 {0xa0, 0x00, 0x01ad}, 4259 {0xa0, 0x00, 0x01ad},
4263/* Sharpness */ 4260/* Sharpness */
4264 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* SharpnessMode */ 4261 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
4265 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* Sharpness05 */ 4262 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
4266/* Other registors */ 4263/* Other registors */
4267 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ 4264 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4268/* Auto exposure and white balance */ 4265/* Auto exposure and white balance */
4269 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ 4266 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4270 {0xa0, 0x80, ZC3XX_R18D_YTARGET}, /* ????????? */ 4267 {0xa0, 0x80, ZC3XX_R18D_YTARGET},
4271/*Dead pixels */ 4268/*Dead pixels */
4272 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ 4269 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4273/* EEPROM */ 4270/* EEPROM */
4274 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ 4271 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4275/* JPEG control */ 4272/* JPEG control */
4276 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4273 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4277 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ 4274 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
4278 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ 4275 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
4279/* Other registers */ 4276/* Other registers */
4280 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ 4277 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4281/* Auto exposure and white balance */ 4278/* Auto exposure and white balance */
4282 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ 4279 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4283/*Dead pixels */ 4280/*Dead pixels */
4284 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ 4281 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4285/* EEPROM */ 4282/* EEPROM */
4286 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ 4283 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4287/* JPEG control */ 4284/* JPEG control */
4288 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4285 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4289 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ 4286 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
4290 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ 4287 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
4291 4288
4292 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */ 4289 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */
4293 {0xa0, 0xf4, ZC3XX_R10B_RGB01}, 4290 {0xa0, 0xf4, ZC3XX_R10B_RGB01},
@@ -4299,43 +4296,43 @@ static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */
4299 {0xa0, 0xf4, ZC3XX_R111_RGB21}, 4296 {0xa0, 0xf4, ZC3XX_R111_RGB21},
4300 {0xa0, 0x58, ZC3XX_R112_RGB22}, 4297 {0xa0, 0x58, ZC3XX_R112_RGB22},
4301/* Auto correction */ 4298/* Auto correction */
4302 {0xa0, 0x03, ZC3XX_R181_WINXSTART}, /* WinXstart */ 4299 {0xa0, 0x03, ZC3XX_R181_WINXSTART},
4303 {0xa0, 0x08, ZC3XX_R182_WINXWIDTH}, /* WinXWidth */ 4300 {0xa0, 0x08, ZC3XX_R182_WINXWIDTH},
4304 {0xa0, 0x16, ZC3XX_R183_WINXCENTER}, /* WinXCenter */ 4301 {0xa0, 0x16, ZC3XX_R183_WINXCENTER},
4305 {0xa0, 0x03, ZC3XX_R184_WINYSTART}, /* WinYStart */ 4302 {0xa0, 0x03, ZC3XX_R184_WINYSTART},
4306 {0xa0, 0x05, ZC3XX_R185_WINYWIDTH}, /* WinYWidth */ 4303 {0xa0, 0x05, ZC3XX_R185_WINYWIDTH},
4307 {0xa0, 0x14, ZC3XX_R186_WINYCENTER}, /* WinYCenter */ 4304 {0xa0, 0x14, ZC3XX_R186_WINYCENTER},
4308 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4305 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4309 4306
4310/* Auto exposure and white balance */ 4307/* Auto exposure and white balance */
4311 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* ExposureLimitHigh 0 */ 4308 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4312 {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, /* ExposureLimitMid */ 4309 {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID},
4313 {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW}, /* ExposureLimitLow 0xb1 */ 4310 {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW},
4314 4311
4315 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* AntiFlickerHigh 0x00 */ 4312 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4316 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* AntiFlickerLow 0x00 */ 4313 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4317 {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW}, /* AntiFlickerLow 0x87 */ 4314 {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW},
4318 4315
4319 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* AEBFreeze 0x10 0x0c */ 4316 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
4320 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* AEBUnfreeze 0x30 0x18 */ 4317 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
4321/* sensor on */ 4318/* sensor on */
4322 {0xaa, 0x07, 0x00b1}, 4319 {0xaa, 0x07, 0x00b1},
4323 {0xaa, 0x05, 0x0003}, 4320 {0xaa, 0x05, 0x0003},
4324 {0xaa, 0x04, 0x0001}, 4321 {0xaa, 0x04, 0x0001},
4325 {0xaa, 0x03, 0x003b}, 4322 {0xaa, 0x03, 0x003b},
4326/* Gains */ 4323/* Gains */
4327 {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* DigitalLimitDiff */ 4324 {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF},
4328 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* DigitalGainStep */ 4325 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP},
4329 {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ 4326 {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN},
4330 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ 4327 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4331/* Auto correction */ 4328/* Auto correction */
4332 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4329 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE},
4333 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ 4330 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */
4334 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4331 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4335/* Gains */ 4332/* Gains */
4336 {0xa0, 0x40, ZC3XX_R116_RGAIN}, /* RGain */ 4333 {0xa0, 0x40, ZC3XX_R116_RGAIN},
4337 {0xa0, 0x40, ZC3XX_R117_GGAIN}, /* GGain */ 4334 {0xa0, 0x40, ZC3XX_R117_GGAIN},
4338 {0xa0, 0x40, ZC3XX_R118_BGAIN}, /* BGain */ 4335 {0xa0, 0x40, ZC3XX_R118_BGAIN},
4339 4336
4340 {0xa0, 0x00, 0x0007}, /* AutoCorrectEnable */ 4337 {0xa0, 0x00, 0x0007}, /* AutoCorrectEnable */
4341 {0xa0, 0xff, ZC3XX_R018_FRAMELOST}, /* Frame adjust */ 4338 {0xa0, 0xff, ZC3XX_R018_FRAMELOST}, /* Frame adjust */
@@ -4459,8 +4456,8 @@ static const struct usb_action pb03303x_Initial[] = {
4459 {0xa0, 0x50, ZC3XX_R112_RGB22}, 4456 {0xa0, 0x50, ZC3XX_R112_RGB22},
4460 4457
4461 {0xa1, 0x01, 0x0008}, 4458 {0xa1, 0x01, 0x0008},
4462 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ 4459 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4463 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ 4460 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
4464 {0xa1, 0x01, 0x01c8}, 4461 {0xa1, 0x01, 0x01c8},
4465 {0xa1, 0x01, 0x01c9}, 4462 {0xa1, 0x01, 0x01c9},
4466 {0xa1, 0x01, 0x01ca}, 4463 {0xa1, 0x01, 0x01ca},
@@ -5984,7 +5981,7 @@ static const struct usb_action tas5130c_vf0250_Initial[] = {
5984 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa, */ 5981 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa, */
5985 {0xaa, 0x13, 0x0002}, /* 00,13,02,aa, */ 5982 {0xaa, 0x13, 0x0002}, /* 00,13,02,aa, */
5986 {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */ 5983 {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */
5987 {0xaa, 0x01, 0x0000}, 5984/*?? {0xaa, 0x01, 0x0000}, */
5988 {0xaa, 0x01, 0x0000}, 5985 {0xaa, 0x01, 0x0000},
5989 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa, */ 5986 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa, */
5990 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa, */ 5987 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa, */
@@ -6000,8 +5997,8 @@ static const struct usb_action tas5130c_vf0250_Initial[] = {
6000 {0xaa, 0x0f, 0x00a0}, /* 00,0f,a0,aa, */ 5997 {0xaa, 0x0f, 0x00a0}, /* 00,0f,a0,aa, */
6001 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa, */ 5998 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa, */
6002 {0xaa, 0x11, 0x00a0}, /* 00,11,a0,aa, */ 5999 {0xaa, 0x11, 0x00a0}, /* 00,11,a0,aa, */
6003 {0xa0, 0x00, 0x0039}, 6000/*?? {0xa0, 0x00, 0x0039},
6004 {0xa1, 0x01, 0x0037}, 6001 {0xa1, 0x01, 0x0037}, */
6005 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa, */ 6002 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa, */
6006 {0xaa, 0x17, 0x00e8}, /* 00,17,e6,aa, (e6 -> e8) */ 6003 {0xaa, 0x17, 0x00e8}, /* 00,17,e6,aa, (e6 -> e8) */
6007 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa, */ 6004 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa, */
@@ -6272,7 +6269,7 @@ static void reg_w(struct usb_device *dev,
6272 __u8 value, 6269 __u8 value,
6273 __u16 index) 6270 __u16 index)
6274{ 6271{
6275 PDEBUG(D_USBO, "reg w %02x -> [%04x]", value, index); 6272 PDEBUG(D_USBO, "reg w [%04x] = %02x", index, value);
6276 reg_w_i(dev, value, index); 6273 reg_w_i(dev, value, index);
6277} 6274}
6278 6275
@@ -6280,17 +6277,17 @@ static __u16 i2c_read(struct gspca_dev *gspca_dev,
6280 __u8 reg) 6277 __u8 reg)
6281{ 6278{
6282 __u8 retbyte; 6279 __u8 retbyte;
6283 __u8 retval[2]; 6280 __u16 retval;
6284 6281
6285 reg_w_i(gspca_dev->dev, reg, 0x92); 6282 reg_w_i(gspca_dev->dev, reg, 0x92);
6286 reg_w_i(gspca_dev->dev, 0x02, 0x90); /* <- read command */ 6283 reg_w_i(gspca_dev->dev, 0x02, 0x90); /* <- read command */
6287 msleep(25); 6284 msleep(25);
6288 retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */ 6285 retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */
6289 retval[0] = reg_r_i(gspca_dev, 0x0095); /* read Lowbyte */ 6286 retval = reg_r_i(gspca_dev, 0x0095); /* read Lowbyte */
6290 retval[1] = reg_r_i(gspca_dev, 0x0096); /* read Hightbyte */ 6287 retval |= reg_r_i(gspca_dev, 0x0096) << 8; /* read Hightbyte */
6291 PDEBUG(D_USBO, "i2c r [%02x] -> (%02x) %02x%02x", 6288 PDEBUG(D_USBO, "i2c r [%02x] -> %04x (%02x)",
6292 reg, retbyte, retval[1], retval[0]); 6289 reg, retval, retbyte);
6293 return (retval[1] << 8) | retval[0]; 6290 return retval;
6294} 6291}
6295 6292
6296static __u8 i2c_write(struct gspca_dev *gspca_dev, 6293static __u8 i2c_write(struct gspca_dev *gspca_dev,
@@ -6306,7 +6303,7 @@ static __u8 i2c_write(struct gspca_dev *gspca_dev,
6306 reg_w_i(gspca_dev->dev, 0x01, 0x90); /* <- write command */ 6303 reg_w_i(gspca_dev->dev, 0x01, 0x90); /* <- write command */
6307 msleep(5); 6304 msleep(5);
6308 retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */ 6305 retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */
6309 PDEBUG(D_USBO, "i2c w [%02x] %02x%02x (%02x)", 6306 PDEBUG(D_USBO, "i2c w [%02x] = %02x%02x (%02x)",
6310 reg, valH, valL, retbyte); 6307 reg, valH, valL, retbyte);
6311 return retbyte; 6308 return retbyte;
6312} 6309}
@@ -6349,6 +6346,8 @@ static void setmatrix(struct gspca_dev *gspca_dev)
6349 {0x58, 0xf4, 0xf4, 0xf4, 0x58, 0xf4, 0xf4, 0xf4, 0x58}; 6346 {0x58, 0xf4, 0xf4, 0xf4, 0x58, 0xf4, 0xf4, 0xf4, 0x58};
6350 static const __u8 po2030_matrix[9] = 6347 static const __u8 po2030_matrix[9] =
6351 {0x60, 0xf0, 0xf0, 0xf0, 0x60, 0xf0, 0xf0, 0xf0, 0x60}; 6348 {0x60, 0xf0, 0xf0, 0xf0, 0x60, 0xf0, 0xf0, 0xf0, 0x60};
6349 static const __u8 vf0250_matrix[9] =
6350 {0x7b, 0xea, 0xea, 0xea, 0x7b, 0xea, 0xea, 0xea, 0x7b};
6352 6351
6353 switch (sd->sensor) { 6352 switch (sd->sensor) {
6354 case SENSOR_GC0305: 6353 case SENSOR_GC0305:
@@ -6363,8 +6362,9 @@ static void setmatrix(struct gspca_dev *gspca_dev)
6363 case SENSOR_PO2030: 6362 case SENSOR_PO2030:
6364 matrix = po2030_matrix; 6363 matrix = po2030_matrix;
6365 break; 6364 break;
6366 case SENSOR_TAS5130C_VF0250: /* no matrix? */ 6365 case SENSOR_TAS5130C_VF0250:
6367 return; 6366 matrix = vf0250_matrix;
6367 break;
6368 default: /* matrix already loaded */ 6368 default: /* matrix already loaded */
6369 return; 6369 return;
6370 } 6370 }
@@ -6744,7 +6744,7 @@ static int vga_2wr_probe(struct gspca_dev *gspca_dev)
6744 return 0x04; /* CS2102 */ 6744 return 0x04; /* CS2102 */
6745 6745
6746 start_2wr_probe(dev, 0x06); /* OmniVision */ 6746 start_2wr_probe(dev, 0x06); /* OmniVision */
6747 reg_w(dev, 0x08, 0x8d); 6747 reg_w(dev, 0x08, 0x008d);
6748 i2c_write(gspca_dev, 0x11, 0xaa, 0x00); 6748 i2c_write(gspca_dev, 0x11, 0xaa, 0x00);
6749 retbyte = i2c_read(gspca_dev, 0x11); 6749 retbyte = i2c_read(gspca_dev, 0x11);
6750 if (retbyte != 0) { 6750 if (retbyte != 0) {
@@ -6778,7 +6778,7 @@ static int vga_2wr_probe(struct gspca_dev *gspca_dev)
6778 return 0x0c; /* ICM105A */ 6778 return 0x0c; /* ICM105A */
6779 6779
6780 start_2wr_probe(dev, 0x0e); /* PAS202BCB */ 6780 start_2wr_probe(dev, 0x0e); /* PAS202BCB */
6781 reg_w(dev, 0x08, 0x8d); 6781 reg_w(dev, 0x08, 0x008d);
6782 i2c_write(gspca_dev, 0x03, 0xaa, 0x00); 6782 i2c_write(gspca_dev, 0x03, 0xaa, 0x00);
6783 msleep(500); 6783 msleep(500);
6784 retbyte = i2c_read(gspca_dev, 0x03); 6784 retbyte = i2c_read(gspca_dev, 0x03);
@@ -6830,7 +6830,6 @@ static const struct sensor_by_chipset_revision chipset_revision_sensor[] = {
6830 {0x8001, 0x13}, 6830 {0x8001, 0x13},
6831 {0x8000, 0x14}, /* CS2102K */ 6831 {0x8000, 0x14}, /* CS2102K */
6832 {0x8400, 0x15}, /* TAS5130K */ 6832 {0x8400, 0x15}, /* TAS5130K */
6833 {0, 0}
6834}; 6833};
6835 6834
6836static int vga_3wr_probe(struct gspca_dev *gspca_dev) 6835static int vga_3wr_probe(struct gspca_dev *gspca_dev)
@@ -6843,7 +6842,7 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6843 6842
6844/*fixme: lack of 8b=b3 (11,12)-> 10, 8b=e0 (14,15,16)-> 12 found in gspcav1*/ 6843/*fixme: lack of 8b=b3 (11,12)-> 10, 8b=e0 (14,15,16)-> 12 found in gspcav1*/
6845 reg_w(dev, 0x02, 0x0010); 6844 reg_w(dev, 0x02, 0x0010);
6846 reg_r(gspca_dev, 0x10); 6845 reg_r(gspca_dev, 0x0010);
6847 reg_w(dev, 0x01, 0x0000); 6846 reg_w(dev, 0x01, 0x0000);
6848 reg_w(dev, 0x00, 0x0010); 6847 reg_w(dev, 0x00, 0x0010);
6849 reg_w(dev, 0x01, 0x0001); 6848 reg_w(dev, 0x01, 0x0001);
@@ -6869,17 +6868,15 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6869 PDEBUG(D_PROBE, "probe 3wr vga 1 0x%04x", checkword); 6868 PDEBUG(D_PROBE, "probe 3wr vga 1 0x%04x", checkword);
6870 reg_r(gspca_dev, 0x0010); 6869 reg_r(gspca_dev, 0x0010);
6871 /* this is tested only once anyway */ 6870 /* this is tested only once anyway */
6872 i = 0; 6871 for (i = 0; i < ARRAY_SIZE(chipset_revision_sensor); i++) {
6873 while (chipset_revision_sensor[i].revision) {
6874 if (chipset_revision_sensor[i].revision == checkword) { 6872 if (chipset_revision_sensor[i].revision == checkword) {
6875 sd->chip_revision = checkword; 6873 sd->chip_revision = checkword;
6876 send_unknown(dev, SENSOR_PB0330); 6874 send_unknown(dev, SENSOR_PB0330);
6877 return chipset_revision_sensor[i].internal_sensor_id; 6875 return chipset_revision_sensor[i].internal_sensor_id;
6878 } 6876 }
6879 i++;
6880 } 6877 }
6881 6878
6882 reg_w(dev, 0x01, 0x0000); 6879 reg_w(dev, 0x01, 0x0000); /* check ?? */
6883 reg_w(dev, 0x01, 0x0001); 6880 reg_w(dev, 0x01, 0x0001);
6884 reg_w(dev, 0xdd, 0x008b); 6881 reg_w(dev, 0xdd, 0x008b);
6885 reg_w(dev, 0x0a, 0x0010); 6882 reg_w(dev, 0x0a, 0x0010);
@@ -6901,8 +6898,11 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6901 retbyte = i2c_read(gspca_dev, 0x00); 6898 retbyte = i2c_read(gspca_dev, 0x00);
6902 if (retbyte != 0) { 6899 if (retbyte != 0) {
6903 PDEBUG(D_PROBE, "probe 3wr vga type %02x", retbyte); 6900 PDEBUG(D_PROBE, "probe 3wr vga type %02x", retbyte);
6904 send_unknown(dev, SENSOR_GC0305); 6901 if (retbyte == 0x11) /* VF0250 */
6905 return retbyte; /* 0x29 = gc0305 - should continue? */ 6902 return 0x0250;
6903 if (retbyte == 0x29) /* gc0305 */
6904 send_unknown(dev, SENSOR_GC0305);
6905 return retbyte;
6906 } 6906 }
6907 6907
6908 reg_w(dev, 0x01, 0x0000); /* check OmniVision */ 6908 reg_w(dev, 0x01, 0x0000); /* check OmniVision */
@@ -6918,18 +6918,18 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6918 return 0x06; /* OmniVision confirm ? */ 6918 return 0x06; /* OmniVision confirm ? */
6919 } 6919 }
6920 6920
6921 reg_w(dev, 0x01, 0x00); 6921 reg_w(dev, 0x01, 0x0000);
6922 reg_w(dev, 0x00, 0x02); 6922 reg_w(dev, 0x00, 0x0002);
6923 reg_w(dev, 0x01, 0x10); 6923 reg_w(dev, 0x01, 0x0010);
6924 reg_w(dev, 0x01, 0x01); 6924 reg_w(dev, 0x01, 0x0001);
6925 reg_w(dev, 0xee, 0x8b); 6925 reg_w(dev, 0xee, 0x008b);
6926 reg_w(dev, 0x03, 0x12); 6926 reg_w(dev, 0x03, 0x0012);
6927/* msleep(150); */ 6927/* msleep(150); */
6928 reg_w(dev, 0x01, 0x12); 6928 reg_w(dev, 0x01, 0x0012);
6929 reg_w(dev, 0x05, 0x12); 6929 reg_w(dev, 0x05, 0x0012);
6930 retbyte = i2c_read(gspca_dev, 0x00); /* ID 0 */ 6930 retbyte = i2c_read(gspca_dev, 0x0000); /* ID 0 */
6931 checkword = retbyte << 8; 6931 checkword = retbyte << 8;
6932 retbyte = i2c_read(gspca_dev, 0x01); /* ID 1 */ 6932 retbyte = i2c_read(gspca_dev, 0x0001); /* ID 1 */
6933 checkword |= retbyte; 6933 checkword |= retbyte;
6934 PDEBUG(D_PROBE, "probe 3wr vga 2 0x%04x", checkword); 6934 PDEBUG(D_PROBE, "probe 3wr vga 2 0x%04x", checkword);
6935 if (checkword == 0x2030) { 6935 if (checkword == 0x2030) {
@@ -6939,14 +6939,14 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6939 return checkword; 6939 return checkword;
6940 } 6940 }
6941 6941
6942 reg_w(dev, 0x01, 0x00); 6942 reg_w(dev, 0x01, 0x0000);
6943 reg_w(dev, 0x0a, 0x10); 6943 reg_w(dev, 0x0a, 0x0010);
6944 reg_w(dev, 0xd3, 0x8b); 6944 reg_w(dev, 0xd3, 0x008b);
6945 reg_w(dev, 0x01, 0x01); 6945 reg_w(dev, 0x01, 0x0001);
6946 reg_w(dev, 0x03, 0x12); 6946 reg_w(dev, 0x03, 0x0012);
6947 reg_w(dev, 0x01, 0x12); 6947 reg_w(dev, 0x01, 0x0012);
6948 reg_w(dev, 0x05, 0x01); 6948 reg_w(dev, 0x05, 0x0001);
6949 reg_w(dev, 0xd3, 0x8b); 6949 reg_w(dev, 0xd3, 0x008b);
6950 retbyte = i2c_read(gspca_dev, 0x01); 6950 retbyte = i2c_read(gspca_dev, 0x01);
6951 if (retbyte != 0) { 6951 if (retbyte != 0) {
6952 PDEBUG(D_PROBE, "probe 3wr vga type 0a ?"); 6952 PDEBUG(D_PROBE, "probe 3wr vga type 0a ?");
@@ -6962,7 +6962,9 @@ static int zcxx_probeSensor(struct gspca_dev *gspca_dev)
6962 6962
6963 switch (sd->sensor) { 6963 switch (sd->sensor) {
6964 case SENSOR_MC501CB: 6964 case SENSOR_MC501CB:
6965 return -1; /* don't probe */
6965 case SENSOR_TAS5130C_VF0250: 6966 case SENSOR_TAS5130C_VF0250:
6967 /* may probe but with write in reg 0x0010 */
6966 return -1; /* don't probe */ 6968 return -1; /* don't probe */
6967 } 6969 }
6968 sensor = vga_2wr_probe(gspca_dev); 6970 sensor = vga_2wr_probe(gspca_dev);
@@ -7010,30 +7012,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
7010 7012
7011 /* define some sensors from the vendor/product */ 7013 /* define some sensors from the vendor/product */
7012 sd->sharpness = 2; 7014 sd->sharpness = 2;
7013 switch (id->idVendor) { 7015 sd->sensor = id->driver_info;
7014 case 0x041e: /* Creative */
7015 switch (id->idProduct) {
7016 case 0x4051: /* zc301 chips */
7017 case 0x4053:
7018 sd->sensor = SENSOR_TAS5130C_VF0250;
7019 break;
7020 }
7021 break;
7022 case 0x046d: /* Logitech Labtec */
7023 switch (id->idProduct) {
7024 case 0x08dd:
7025 sd->sensor = SENSOR_MC501CB;
7026 break;
7027 }
7028 break;
7029 case 0x0ac8: /* Vimicro z-star */
7030 switch (id->idProduct) {
7031 case 0x305b:
7032 sd->sensor = SENSOR_TAS5130C_VF0250;
7033 break;
7034 }
7035 break;
7036 }
7037 sensor = zcxx_probeSensor(gspca_dev); 7016 sensor = zcxx_probeSensor(gspca_dev);
7038 if (sensor >= 0) 7017 if (sensor >= 0)
7039 PDEBUG(D_PROBE, "probe sensor -> %02x", sensor); 7018 PDEBUG(D_PROBE, "probe sensor -> %02x", sensor);
@@ -7119,6 +7098,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
7119 PDEBUG(D_PROBE, "Find Sensor GC0305"); 7098 PDEBUG(D_PROBE, "Find Sensor GC0305");
7120 sd->sensor = SENSOR_GC0305; 7099 sd->sensor = SENSOR_GC0305;
7121 break; 7100 break;
7101 case 0x0250:
7102 PDEBUG(D_PROBE, "Sensor Tas5130 (VF0250)");
7103 sd->sensor = SENSOR_TAS5130C_VF0250;
7104 break;
7122 case 0x2030: 7105 case 0x2030:
7123 PDEBUG(D_PROBE, "Find Sensor PO2030"); 7106 PDEBUG(D_PROBE, "Find Sensor PO2030");
7124 sd->sensor = SENSOR_PO2030; 7107 sd->sensor = SENSOR_PO2030;
@@ -7146,7 +7129,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
7146 } 7129 }
7147 7130
7148 cam = &gspca_dev->cam; 7131 cam = &gspca_dev->cam;
7149 cam->dev_name = (char *) id->driver_info;
7150 cam->epaddr = 0x01; 7132 cam->epaddr = 0x01;
7151/*fixme:test*/ 7133/*fixme:test*/
7152 gspca_dev->nbalt--; 7134 gspca_dev->nbalt--;
@@ -7235,6 +7217,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
7235 case SENSOR_GC0305: 7217 case SENSOR_GC0305:
7236 case SENSOR_OV7620: 7218 case SENSOR_OV7620:
7237 case SENSOR_PO2030: 7219 case SENSOR_PO2030:
7220 case SENSOR_TAS5130C_VF0250:
7238 msleep(100); /* ?? */ 7221 msleep(100); /* ?? */
7239 reg_r(gspca_dev, 0x0002); /* --> 0x40 */ 7222 reg_r(gspca_dev, 0x0002); /* --> 0x40 */
7240 reg_w(dev, 0x09, 0x01ad); /* (from win traces) */ 7223 reg_w(dev, 0x09, 0x01ad); /* (from win traces) */
@@ -7515,70 +7498,69 @@ static const struct sd_desc sd_desc = {
7515 .querymenu = sd_querymenu, 7498 .querymenu = sd_querymenu,
7516}; 7499};
7517 7500
7518#define DVNM(name) .driver_info = (kernel_ulong_t) name
7519static const __devinitdata struct usb_device_id device_table[] = { 7501static const __devinitdata struct usb_device_id device_table[] = {
7520 {USB_DEVICE(0x041e, 0x041e), DVNM("Creative WebCam Live!")}, 7502 {USB_DEVICE(0x041e, 0x041e)},
7521#ifndef CONFIG_USB_ZC0301 7503#ifndef CONFIG_USB_ZC0301
7522 {USB_DEVICE(0x041e, 0x4017), DVNM("Creative Webcam Mobile PD1090")}, 7504 {USB_DEVICE(0x041e, 0x4017)},
7523 {USB_DEVICE(0x041e, 0x401c), DVNM("Creative NX")}, 7505 {USB_DEVICE(0x041e, 0x401c)},
7524 {USB_DEVICE(0x041e, 0x401e), DVNM("Creative Nx Pro")}, 7506 {USB_DEVICE(0x041e, 0x401e)},
7525 {USB_DEVICE(0x041e, 0x401f), DVNM("Creative Webcam Notebook PD1171")}, 7507 {USB_DEVICE(0x041e, 0x401f)},
7526#endif 7508#endif
7527 {USB_DEVICE(0x041e, 0x4029), DVNM("Creative WebCam Vista Pro")}, 7509 {USB_DEVICE(0x041e, 0x4029)},
7528#ifndef CONFIG_USB_ZC0301 7510#ifndef CONFIG_USB_ZC0301
7529 {USB_DEVICE(0x041e, 0x4034), DVNM("Creative Instant P0620")}, 7511 {USB_DEVICE(0x041e, 0x4034)},
7530 {USB_DEVICE(0x041e, 0x4035), DVNM("Creative Instant P0620D")}, 7512 {USB_DEVICE(0x041e, 0x4035)},
7531 {USB_DEVICE(0x041e, 0x4036), DVNM("Creative Live !")}, 7513 {USB_DEVICE(0x041e, 0x4036)},
7532 {USB_DEVICE(0x041e, 0x403a), DVNM("Creative Nx Pro 2")}, 7514 {USB_DEVICE(0x041e, 0x403a)},
7533#endif 7515#endif
7534 {USB_DEVICE(0x041e, 0x4051), DVNM("Creative Notebook Pro (VF0250)")}, 7516 {USB_DEVICE(0x041e, 0x4051), .driver_info = SENSOR_TAS5130C_VF0250},
7535 {USB_DEVICE(0x041e, 0x4053), DVNM("Creative Live!Cam Video IM")}, 7517 {USB_DEVICE(0x041e, 0x4053), .driver_info = SENSOR_TAS5130C_VF0250},
7536#ifndef CONFIG_USB_ZC0301 7518#ifndef CONFIG_USB_ZC0301
7537 {USB_DEVICE(0x0458, 0x7007), DVNM("Genius VideoCam V2")}, 7519 {USB_DEVICE(0x0458, 0x7007)},
7538 {USB_DEVICE(0x0458, 0x700c), DVNM("Genius VideoCam V3")}, 7520 {USB_DEVICE(0x0458, 0x700c)},
7539 {USB_DEVICE(0x0458, 0x700f), DVNM("Genius VideoCam Web V2")}, 7521 {USB_DEVICE(0x0458, 0x700f)},
7540#endif 7522#endif
7541 {USB_DEVICE(0x0461, 0x0a00), DVNM("MicroInnovation WebCam320")}, 7523 {USB_DEVICE(0x0461, 0x0a00)},
7542 {USB_DEVICE(0x046d, 0x08a0), DVNM("Logitech QC IM")}, 7524 {USB_DEVICE(0x046d, 0x08a0)},
7543 {USB_DEVICE(0x046d, 0x08a1), DVNM("Logitech QC IM 0x08A1 +sound")}, 7525 {USB_DEVICE(0x046d, 0x08a1)},
7544 {USB_DEVICE(0x046d, 0x08a2), DVNM("Labtec Webcam Pro")}, 7526 {USB_DEVICE(0x046d, 0x08a2)},
7545 {USB_DEVICE(0x046d, 0x08a3), DVNM("Logitech QC Chat")}, 7527 {USB_DEVICE(0x046d, 0x08a3)},
7546 {USB_DEVICE(0x046d, 0x08a6), DVNM("Logitech QCim")}, 7528 {USB_DEVICE(0x046d, 0x08a6)},
7547 {USB_DEVICE(0x046d, 0x08a7), DVNM("Logitech QuickCam Image")}, 7529 {USB_DEVICE(0x046d, 0x08a7)},
7548 {USB_DEVICE(0x046d, 0x08a9), DVNM("Logitech Notebook Deluxe")}, 7530 {USB_DEVICE(0x046d, 0x08a9)},
7549 {USB_DEVICE(0x046d, 0x08aa), DVNM("Labtec Webcam Notebook")}, 7531 {USB_DEVICE(0x046d, 0x08aa)},
7550 {USB_DEVICE(0x046d, 0x08ac), DVNM("Logitech QuickCam Cool")}, 7532 {USB_DEVICE(0x046d, 0x08ac)},
7551 {USB_DEVICE(0x046d, 0x08ad), DVNM("Logitech QCCommunicate STX")}, 7533 {USB_DEVICE(0x046d, 0x08ad)},
7552#ifndef CONFIG_USB_ZC0301 7534#ifndef CONFIG_USB_ZC0301
7553 {USB_DEVICE(0x046d, 0x08ae), DVNM("Logitech QuickCam for Notebooks")}, 7535 {USB_DEVICE(0x046d, 0x08ae)},
7554#endif 7536#endif
7555 {USB_DEVICE(0x046d, 0x08af), DVNM("Logitech QuickCam Cool")}, 7537 {USB_DEVICE(0x046d, 0x08af)},
7556 {USB_DEVICE(0x046d, 0x08b9), DVNM("Logitech QC IM ???")}, 7538 {USB_DEVICE(0x046d, 0x08b9)},
7557 {USB_DEVICE(0x046d, 0x08d7), DVNM("Logitech QCam STX")}, 7539 {USB_DEVICE(0x046d, 0x08d7)},
7558 {USB_DEVICE(0x046d, 0x08d9), DVNM("Logitech QuickCam IM/Connect")}, 7540 {USB_DEVICE(0x046d, 0x08d9)},
7559 {USB_DEVICE(0x046d, 0x08d8), DVNM("Logitech Notebook Deluxe")}, 7541 {USB_DEVICE(0x046d, 0x08d8)},
7560 {USB_DEVICE(0x046d, 0x08da), DVNM("Logitech QuickCam Messenger")}, 7542 {USB_DEVICE(0x046d, 0x08da)},
7561 {USB_DEVICE(0x046d, 0x08dd), DVNM("Logitech QuickCam for Notebooks")}, 7543 {USB_DEVICE(0x046d, 0x08dd), .driver_info = SENSOR_MC501CB},
7562 {USB_DEVICE(0x0471, 0x0325), DVNM("Philips SPC 200 NC")}, 7544 {USB_DEVICE(0x0471, 0x0325)},
7563 {USB_DEVICE(0x0471, 0x0326), DVNM("Philips SPC 300 NC")}, 7545 {USB_DEVICE(0x0471, 0x0326)},
7564 {USB_DEVICE(0x0471, 0x032d), DVNM("Philips spc210nc")}, 7546 {USB_DEVICE(0x0471, 0x032d)},
7565 {USB_DEVICE(0x0471, 0x032e), DVNM("Philips spc315nc")}, 7547 {USB_DEVICE(0x0471, 0x032e)},
7566 {USB_DEVICE(0x055f, 0xc005), DVNM("Mustek Wcam300A")}, 7548 {USB_DEVICE(0x055f, 0xc005)},
7567#ifndef CONFIG_USB_ZC0301 7549#ifndef CONFIG_USB_ZC0301
7568 {USB_DEVICE(0x055f, 0xd003), DVNM("Mustek WCam300A")}, 7550 {USB_DEVICE(0x055f, 0xd003)},
7569 {USB_DEVICE(0x055f, 0xd004), DVNM("Mustek WCam300 AN")}, 7551 {USB_DEVICE(0x055f, 0xd004)},
7570#endif 7552#endif
7571 {USB_DEVICE(0x0698, 0x2003), DVNM("CTX M730V built in")}, 7553 {USB_DEVICE(0x0698, 0x2003)},
7572 {USB_DEVICE(0x0ac8, 0x0302), DVNM("Z-star Vimicro zc0302")}, 7554 {USB_DEVICE(0x0ac8, 0x0302)},
7573#ifndef CONFIG_USB_ZC0301 7555#ifndef CONFIG_USB_ZC0301
7574 {USB_DEVICE(0x0ac8, 0x301b), DVNM("Z-Star zc301b")}, 7556 {USB_DEVICE(0x0ac8, 0x301b)},
7575 {USB_DEVICE(0x0ac8, 0x303b), DVNM("Vimicro 0x303b")}, 7557 {USB_DEVICE(0x0ac8, 0x303b)},
7576#endif 7558#endif
7577 {USB_DEVICE(0x0ac8, 0x305b), DVNM("Z-star Vimicro zc0305b")}, 7559 {USB_DEVICE(0x0ac8, 0x305b), .driver_info = SENSOR_TAS5130C_VF0250},
7578#ifndef CONFIG_USB_ZC0301 7560#ifndef CONFIG_USB_ZC0301
7579 {USB_DEVICE(0x0ac8, 0x307b), DVNM("Z-Star 307b")}, 7561 {USB_DEVICE(0x0ac8, 0x307b)},
7580 {USB_DEVICE(0x10fd, 0x0128), DVNM("Typhoon Webshot II 300k 0x0128")}, 7562 {USB_DEVICE(0x10fd, 0x0128)},
7581 {USB_DEVICE(0x10fd, 0x8050), DVNM("Typhoon Webshot II USB 300k")}, 7563 {USB_DEVICE(0x10fd, 0x8050)},
7582#endif 7564#endif
7583 {} /* end of entry */ 7565 {} /* end of entry */
7584}; 7566};
@@ -7605,7 +7587,7 @@ static int __init sd_mod_init(void)
7605{ 7587{
7606 if (usb_register(&sd_driver) < 0) 7588 if (usb_register(&sd_driver) < 0)
7607 return -1; 7589 return -1;
7608 PDEBUG(D_PROBE, "v%s registered", version); 7590 PDEBUG(D_PROBE, "registered");
7609 return 0; 7591 return 0;
7610} 7592}
7611 7593
diff --git a/drivers/media/video/ivtv/Kconfig b/drivers/media/video/ivtv/Kconfig
index 5d7ee8fcdd50..0069898bddab 100644
--- a/drivers/media/video/ivtv/Kconfig
+++ b/drivers/media/video/ivtv/Kconfig
@@ -2,9 +2,7 @@ config VIDEO_IVTV
2 tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support" 2 tristate "Conexant cx23416/cx23415 MPEG encoder/decoder support"
3 depends on VIDEO_V4L1 && VIDEO_V4L2 && PCI && I2C && EXPERIMENTAL 3 depends on VIDEO_V4L1 && VIDEO_V4L2 && PCI && I2C && EXPERIMENTAL
4 depends on INPUT # due to VIDEO_IR 4 depends on INPUT # due to VIDEO_IR
5 depends on HOTPLUG # due to FW_LOADER
6 select I2C_ALGOBIT 5 select I2C_ALGOBIT
7 select FW_LOADER
8 select VIDEO_IR 6 select VIDEO_IR
9 select VIDEO_TUNER 7 select VIDEO_TUNER
10 select VIDEO_TVEEPROM 8 select VIDEO_TVEEPROM
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 41fd79279bb5..aea1664948ce 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -465,9 +465,8 @@ static void ivtv_process_eeprom(struct ivtv *itv)
465 if (itv->options.radio == -1) 465 if (itv->options.radio == -1)
466 itv->options.radio = (tv.has_radio != 0); 466 itv->options.radio = (tv.has_radio != 0);
467 /* only enable newi2c if an IR blaster is present */ 467 /* only enable newi2c if an IR blaster is present */
468 /* FIXME: for 2.6.20 the test against 2 should be removed */ 468 if (itv->options.newi2c == -1 && tv.has_ir) {
469 if (itv->options.newi2c == -1 && tv.has_ir != -1 && tv.has_ir != 2) { 469 itv->options.newi2c = (tv.has_ir & 4) ? 1 : 0;
470 itv->options.newi2c = (tv.has_ir & 2) ? 1 : 0;
471 if (itv->options.newi2c) { 470 if (itv->options.newi2c) {
472 IVTV_INFO("Reopen i2c bus for IR-blaster support\n"); 471 IVTV_INFO("Reopen i2c bus for IR-blaster support\n");
473 exit_ivtv_i2c(itv); 472 exit_ivtv_i2c(itv);
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index a08bb3331cfb..ab287b48fc2b 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -60,6 +60,7 @@
60#include <linux/dvb/video.h> 60#include <linux/dvb/video.h>
61#include <linux/dvb/audio.h> 61#include <linux/dvb/audio.h>
62#include <media/v4l2-common.h> 62#include <media/v4l2-common.h>
63#include <media/v4l2-ioctl.h>
63#include <media/tuner.h> 64#include <media/tuner.h>
64#include <media/cx2341x.h> 65#include <media/cx2341x.h>
65 66
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index 52e00a7f3110..61030309d0ad 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -1842,69 +1842,73 @@ int ivtv_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
1842 return res; 1842 return res;
1843} 1843}
1844 1844
1845void ivtv_set_funcs(struct video_device *vdev) 1845static const struct v4l2_ioctl_ops ivtv_ioctl_ops = {
1846{ 1846 .vidioc_querycap = ivtv_querycap,
1847 vdev->vidioc_querycap = ivtv_querycap; 1847 .vidioc_g_priority = ivtv_g_priority,
1848 vdev->vidioc_g_priority = ivtv_g_priority; 1848 .vidioc_s_priority = ivtv_s_priority,
1849 vdev->vidioc_s_priority = ivtv_s_priority; 1849 .vidioc_s_audio = ivtv_s_audio,
1850 vdev->vidioc_s_audio = ivtv_s_audio; 1850 .vidioc_g_audio = ivtv_g_audio,
1851 vdev->vidioc_g_audio = ivtv_g_audio; 1851 .vidioc_enumaudio = ivtv_enumaudio,
1852 vdev->vidioc_enumaudio = ivtv_enumaudio; 1852 .vidioc_s_audout = ivtv_s_audout,
1853 vdev->vidioc_s_audout = ivtv_s_audout; 1853 .vidioc_g_audout = ivtv_g_audout,
1854 vdev->vidioc_g_audout = ivtv_g_audout; 1854 .vidioc_enum_input = ivtv_enum_input,
1855 vdev->vidioc_enum_input = ivtv_enum_input; 1855 .vidioc_enum_output = ivtv_enum_output,
1856 vdev->vidioc_enum_output = ivtv_enum_output; 1856 .vidioc_enumaudout = ivtv_enumaudout,
1857 vdev->vidioc_enumaudout = ivtv_enumaudout; 1857 .vidioc_cropcap = ivtv_cropcap,
1858 vdev->vidioc_cropcap = ivtv_cropcap; 1858 .vidioc_s_crop = ivtv_s_crop,
1859 vdev->vidioc_s_crop = ivtv_s_crop; 1859 .vidioc_g_crop = ivtv_g_crop,
1860 vdev->vidioc_g_crop = ivtv_g_crop; 1860 .vidioc_g_input = ivtv_g_input,
1861 vdev->vidioc_g_input = ivtv_g_input; 1861 .vidioc_s_input = ivtv_s_input,
1862 vdev->vidioc_s_input = ivtv_s_input; 1862 .vidioc_g_output = ivtv_g_output,
1863 vdev->vidioc_g_output = ivtv_g_output; 1863 .vidioc_s_output = ivtv_s_output,
1864 vdev->vidioc_s_output = ivtv_s_output; 1864 .vidioc_g_frequency = ivtv_g_frequency,
1865 vdev->vidioc_g_frequency = ivtv_g_frequency; 1865 .vidioc_s_frequency = ivtv_s_frequency,
1866 vdev->vidioc_s_frequency = ivtv_s_frequency; 1866 .vidioc_s_tuner = ivtv_s_tuner,
1867 vdev->vidioc_s_tuner = ivtv_s_tuner; 1867 .vidioc_g_tuner = ivtv_g_tuner,
1868 vdev->vidioc_g_tuner = ivtv_g_tuner; 1868 .vidioc_g_enc_index = ivtv_g_enc_index,
1869 vdev->vidioc_g_enc_index = ivtv_g_enc_index; 1869 .vidioc_g_fbuf = ivtv_g_fbuf,
1870 vdev->vidioc_g_fbuf = ivtv_g_fbuf; 1870 .vidioc_s_fbuf = ivtv_s_fbuf,
1871 vdev->vidioc_s_fbuf = ivtv_s_fbuf; 1871 .vidioc_g_std = ivtv_g_std,
1872 vdev->vidioc_g_std = ivtv_g_std; 1872 .vidioc_s_std = ivtv_s_std,
1873 vdev->vidioc_s_std = ivtv_s_std; 1873 .vidioc_overlay = ivtv_overlay,
1874 vdev->vidioc_overlay = ivtv_overlay; 1874 .vidioc_log_status = ivtv_log_status,
1875 vdev->vidioc_log_status = ivtv_log_status; 1875 .vidioc_enum_fmt_vid_cap = ivtv_enum_fmt_vid_cap,
1876 vdev->vidioc_enum_fmt_vid_cap = ivtv_enum_fmt_vid_cap; 1876 .vidioc_encoder_cmd = ivtv_encoder_cmd,
1877 vdev->vidioc_encoder_cmd = ivtv_encoder_cmd; 1877 .vidioc_try_encoder_cmd = ivtv_try_encoder_cmd,
1878 vdev->vidioc_try_encoder_cmd = ivtv_try_encoder_cmd; 1878 .vidioc_enum_fmt_vid_out = ivtv_enum_fmt_vid_out,
1879 vdev->vidioc_enum_fmt_vid_out = ivtv_enum_fmt_vid_out; 1879 .vidioc_g_fmt_vid_cap = ivtv_g_fmt_vid_cap,
1880 vdev->vidioc_g_fmt_vid_cap = ivtv_g_fmt_vid_cap; 1880 .vidioc_g_fmt_vbi_cap = ivtv_g_fmt_vbi_cap,
1881 vdev->vidioc_g_fmt_vbi_cap = ivtv_g_fmt_vbi_cap; 1881 .vidioc_g_fmt_sliced_vbi_cap = ivtv_g_fmt_sliced_vbi_cap,
1882 vdev->vidioc_g_fmt_sliced_vbi_cap = ivtv_g_fmt_sliced_vbi_cap; 1882 .vidioc_g_fmt_vid_out = ivtv_g_fmt_vid_out,
1883 vdev->vidioc_g_fmt_vid_out = ivtv_g_fmt_vid_out; 1883 .vidioc_g_fmt_vid_out_overlay = ivtv_g_fmt_vid_out_overlay,
1884 vdev->vidioc_g_fmt_vid_out_overlay = ivtv_g_fmt_vid_out_overlay; 1884 .vidioc_g_fmt_sliced_vbi_out = ivtv_g_fmt_sliced_vbi_out,
1885 vdev->vidioc_g_fmt_sliced_vbi_out = ivtv_g_fmt_sliced_vbi_out; 1885 .vidioc_s_fmt_vid_cap = ivtv_s_fmt_vid_cap,
1886 vdev->vidioc_s_fmt_vid_cap = ivtv_s_fmt_vid_cap; 1886 .vidioc_s_fmt_vbi_cap = ivtv_s_fmt_vbi_cap,
1887 vdev->vidioc_s_fmt_vbi_cap = ivtv_s_fmt_vbi_cap; 1887 .vidioc_s_fmt_sliced_vbi_cap = ivtv_s_fmt_sliced_vbi_cap,
1888 vdev->vidioc_s_fmt_sliced_vbi_cap = ivtv_s_fmt_sliced_vbi_cap; 1888 .vidioc_s_fmt_vid_out = ivtv_s_fmt_vid_out,
1889 vdev->vidioc_s_fmt_vid_out = ivtv_s_fmt_vid_out; 1889 .vidioc_s_fmt_vid_out_overlay = ivtv_s_fmt_vid_out_overlay,
1890 vdev->vidioc_s_fmt_vid_out_overlay = ivtv_s_fmt_vid_out_overlay; 1890 .vidioc_s_fmt_sliced_vbi_out = ivtv_s_fmt_sliced_vbi_out,
1891 vdev->vidioc_s_fmt_sliced_vbi_out = ivtv_s_fmt_sliced_vbi_out; 1891 .vidioc_try_fmt_vid_cap = ivtv_try_fmt_vid_cap,
1892 vdev->vidioc_try_fmt_vid_cap = ivtv_try_fmt_vid_cap; 1892 .vidioc_try_fmt_vbi_cap = ivtv_try_fmt_vbi_cap,
1893 vdev->vidioc_try_fmt_vbi_cap = ivtv_try_fmt_vbi_cap; 1893 .vidioc_try_fmt_sliced_vbi_cap = ivtv_try_fmt_sliced_vbi_cap,
1894 vdev->vidioc_try_fmt_sliced_vbi_cap = ivtv_try_fmt_sliced_vbi_cap; 1894 .vidioc_try_fmt_vid_out = ivtv_try_fmt_vid_out,
1895 vdev->vidioc_try_fmt_vid_out = ivtv_try_fmt_vid_out; 1895 .vidioc_try_fmt_vid_out_overlay = ivtv_try_fmt_vid_out_overlay,
1896 vdev->vidioc_try_fmt_vid_out_overlay = ivtv_try_fmt_vid_out_overlay; 1896 .vidioc_try_fmt_sliced_vbi_out = ivtv_try_fmt_sliced_vbi_out,
1897 vdev->vidioc_try_fmt_sliced_vbi_out = ivtv_try_fmt_sliced_vbi_out; 1897 .vidioc_g_sliced_vbi_cap = ivtv_g_sliced_vbi_cap,
1898 vdev->vidioc_g_sliced_vbi_cap = ivtv_g_sliced_vbi_cap; 1898 .vidioc_g_chip_ident = ivtv_g_chip_ident,
1899 vdev->vidioc_g_chip_ident = ivtv_g_chip_ident;
1900#ifdef CONFIG_VIDEO_ADV_DEBUG 1899#ifdef CONFIG_VIDEO_ADV_DEBUG
1901 vdev->vidioc_g_register = ivtv_g_register; 1900 .vidioc_g_register = ivtv_g_register,
1902 vdev->vidioc_s_register = ivtv_s_register; 1901 .vidioc_s_register = ivtv_s_register,
1903#endif 1902#endif
1904 vdev->vidioc_default = ivtv_default; 1903 .vidioc_default = ivtv_default,
1905 vdev->vidioc_queryctrl = ivtv_queryctrl; 1904 .vidioc_queryctrl = ivtv_queryctrl,
1906 vdev->vidioc_querymenu = ivtv_querymenu; 1905 .vidioc_querymenu = ivtv_querymenu,
1907 vdev->vidioc_g_ext_ctrls = ivtv_g_ext_ctrls; 1906 .vidioc_g_ext_ctrls = ivtv_g_ext_ctrls,
1908 vdev->vidioc_s_ext_ctrls = ivtv_s_ext_ctrls; 1907 .vidioc_s_ext_ctrls = ivtv_s_ext_ctrls,
1909 vdev->vidioc_try_ext_ctrls = ivtv_try_ext_ctrls; 1908 .vidioc_try_ext_ctrls = ivtv_try_ext_ctrls,
1909};
1910
1911void ivtv_set_funcs(struct video_device *vdev)
1912{
1913 vdev->ioctl_ops = &ivtv_ioctl_ops;
1910} 1914}
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index f8883b487f4a..54d2023b26c4 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -208,16 +208,11 @@ static int ivtv_prep_dev(struct ivtv *itv, int type)
208 return -ENOMEM; 208 return -ENOMEM;
209 } 209 }
210 210
211 s->v4l2dev->type = VID_TYPE_CAPTURE | VID_TYPE_TUNER | VID_TYPE_TELETEXT |
212 VID_TYPE_CLIPPING | VID_TYPE_SCALES | VID_TYPE_MPEG_ENCODER;
213 if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) {
214 s->v4l2dev->type |= VID_TYPE_MPEG_DECODER;
215 }
216 snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "ivtv%d %s", 211 snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "ivtv%d %s",
217 itv->num, s->name); 212 itv->num, s->name);
218 213
219 s->v4l2dev->minor = minor; 214 s->v4l2dev->minor = minor;
220 s->v4l2dev->dev = &itv->dev->dev; 215 s->v4l2dev->parent = &itv->dev->dev;
221 s->v4l2dev->fops = ivtv_stream_info[type].fops; 216 s->v4l2dev->fops = ivtv_stream_info[type].fops;
222 s->v4l2dev->release = video_device_release; 217 s->v4l2dev->release = video_device_release;
223 s->v4l2dev->tvnorms = V4L2_STD_ALL; 218 s->v4l2dev->tvnorms = V4L2_STD_ALL;
diff --git a/drivers/media/video/m52790.c b/drivers/media/video/m52790.c
index 39bf6b114d50..89a781c6929d 100644
--- a/drivers/media/video/m52790.c
+++ b/drivers/media/video/m52790.c
@@ -26,7 +26,7 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/i2c-id.h> 28#include <linux/i2c-id.h>
29#include <linux/videodev.h> 29#include <linux/videodev2.h>
30#include <media/m52790.h> 30#include <media/m52790.h>
31#include <media/v4l2-common.h> 31#include <media/v4l2-common.h>
32#include <media/v4l2-chip-ident.h> 32#include <media/v4l2-chip-ident.h>
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index 2fb5854cf6f0..7c8ef6ac6c39 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -31,6 +31,7 @@
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/videodev.h> 32#include <linux/videodev.h>
33#include <media/v4l2-common.h> 33#include <media/v4l2-common.h>
34#include <media/v4l2-ioctl.h>
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
35#include <asm/io.h> 36#include <asm/io.h>
36#include <linux/delay.h> 37#include <linux/delay.h>
@@ -1697,13 +1698,7 @@ static const struct file_operations meye_fops = {
1697 .llseek = no_llseek, 1698 .llseek = no_llseek,
1698}; 1699};
1699 1700
1700static struct video_device meye_template = { 1701static const struct v4l2_ioctl_ops meye_ioctl_ops = {
1701 .owner = THIS_MODULE,
1702 .name = "meye",
1703 .type = VID_TYPE_CAPTURE,
1704 .fops = &meye_fops,
1705 .release = video_device_release,
1706 .minor = -1,
1707 .vidioc_querycap = vidioc_querycap, 1702 .vidioc_querycap = vidioc_querycap,
1708 .vidioc_enum_input = vidioc_enum_input, 1703 .vidioc_enum_input = vidioc_enum_input,
1709 .vidioc_g_input = vidioc_g_input, 1704 .vidioc_g_input = vidioc_g_input,
@@ -1724,6 +1719,14 @@ static struct video_device meye_template = {
1724 .vidioc_default = vidioc_default, 1719 .vidioc_default = vidioc_default,
1725}; 1720};
1726 1721
1722static struct video_device meye_template = {
1723 .name = "meye",
1724 .fops = &meye_fops,
1725 .ioctl_ops = &meye_ioctl_ops,
1726 .release = video_device_release,
1727 .minor = -1,
1728};
1729
1727#ifdef CONFIG_PM 1730#ifdef CONFIG_PM
1728static int meye_suspend(struct pci_dev *pdev, pm_message_t state) 1731static int meye_suspend(struct pci_dev *pdev, pm_message_t state)
1729{ 1732{
@@ -1801,7 +1804,7 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
1801 } 1804 }
1802 1805
1803 memcpy(meye.video_dev, &meye_template, sizeof(meye_template)); 1806 memcpy(meye.video_dev, &meye_template, sizeof(meye_template));
1804 meye.video_dev->dev = &meye.mchip_dev->dev; 1807 meye.video_dev->parent = &meye.mchip_dev->dev;
1805 1808
1806 if ((ret = sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 1))) { 1809 if ((ret = sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 1))) {
1807 printk(KERN_ERR "meye: unable to power on the camera\n"); 1810 printk(KERN_ERR "meye: unable to power on the camera\n");
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 5691e019d195..3da74dcee902 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -51,9 +51,9 @@
51#include <linux/module.h> 51#include <linux/module.h>
52#include <linux/slab.h> 52#include <linux/slab.h>
53#include <linux/i2c.h> 53#include <linux/i2c.h>
54#include <linux/videodev.h>
55#include <linux/videodev2.h> 54#include <linux/videodev2.h>
56#include <media/v4l2-common.h> 55#include <media/v4l2-common.h>
56#include <media/v4l2-ioctl.h>
57#include <media/v4l2-i2c-drv-legacy.h> 57#include <media/v4l2-i2c-drv-legacy.h>
58#include <media/tvaudio.h> 58#include <media/tvaudio.h>
59#include <media/msp3400.h> 59#include <media/msp3400.h>
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c
index 1622f70e4dd0..846a14a61fd1 100644
--- a/drivers/media/video/msp3400-kthreads.c
+++ b/drivers/media/video/msp3400-kthreads.c
@@ -25,7 +25,6 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/freezer.h> 27#include <linux/freezer.h>
28#include <linux/videodev.h>
29#include <linux/videodev2.h> 28#include <linux/videodev2.h>
30#include <media/v4l2-common.h> 29#include <media/v4l2-common.h>
31#include <media/msp3400.h> 30#include <media/msp3400.h>
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index ee43499544c1..554d2295484e 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -120,7 +120,7 @@ static int mt9m001_init(struct soc_camera_device *icd)
120 int ret; 120 int ret;
121 121
122 /* Disable chip, synchronous option update */ 122 /* Disable chip, synchronous option update */
123 dev_dbg(icd->vdev->dev, "%s\n", __func__); 123 dev_dbg(icd->vdev->parent, "%s\n", __func__);
124 124
125 ret = reg_write(icd, MT9M001_RESET, 1); 125 ret = reg_write(icd, MT9M001_RESET, 1);
126 if (ret >= 0) 126 if (ret >= 0)
diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c
index eafb0c7736e6..9edaca4371d7 100644
--- a/drivers/media/video/ov511.c
+++ b/drivers/media/video/ov511.c
@@ -4666,9 +4666,7 @@ static const struct file_operations ov511_fops = {
4666}; 4666};
4667 4667
4668static struct video_device vdev_template = { 4668static struct video_device vdev_template = {
4669 .owner = THIS_MODULE,
4670 .name = "OV511 USB Camera", 4669 .name = "OV511 USB Camera",
4671 .type = VID_TYPE_CAPTURE,
4672 .fops = &ov511_fops, 4670 .fops = &ov511_fops,
4673 .release = video_device_release, 4671 .release = video_device_release,
4674 .minor = -1, 4672 .minor = -1,
@@ -5661,43 +5659,43 @@ static int ov_create_sysfs(struct video_device *vdev)
5661{ 5659{
5662 int rc; 5660 int rc;
5663 5661
5664 rc = video_device_create_file(vdev, &dev_attr_custom_id); 5662 rc = device_create_file(&vdev->dev, &dev_attr_custom_id);
5665 if (rc) goto err; 5663 if (rc) goto err;
5666 rc = video_device_create_file(vdev, &dev_attr_model); 5664 rc = device_create_file(&vdev->dev, &dev_attr_model);
5667 if (rc) goto err_id; 5665 if (rc) goto err_id;
5668 rc = video_device_create_file(vdev, &dev_attr_bridge); 5666 rc = device_create_file(&vdev->dev, &dev_attr_bridge);
5669 if (rc) goto err_model; 5667 if (rc) goto err_model;
5670 rc = video_device_create_file(vdev, &dev_attr_sensor); 5668 rc = device_create_file(&vdev->dev, &dev_attr_sensor);
5671 if (rc) goto err_bridge; 5669 if (rc) goto err_bridge;
5672 rc = video_device_create_file(vdev, &dev_attr_brightness); 5670 rc = device_create_file(&vdev->dev, &dev_attr_brightness);
5673 if (rc) goto err_sensor; 5671 if (rc) goto err_sensor;
5674 rc = video_device_create_file(vdev, &dev_attr_saturation); 5672 rc = device_create_file(&vdev->dev, &dev_attr_saturation);
5675 if (rc) goto err_bright; 5673 if (rc) goto err_bright;
5676 rc = video_device_create_file(vdev, &dev_attr_contrast); 5674 rc = device_create_file(&vdev->dev, &dev_attr_contrast);
5677 if (rc) goto err_sat; 5675 if (rc) goto err_sat;
5678 rc = video_device_create_file(vdev, &dev_attr_hue); 5676 rc = device_create_file(&vdev->dev, &dev_attr_hue);
5679 if (rc) goto err_contrast; 5677 if (rc) goto err_contrast;
5680 rc = video_device_create_file(vdev, &dev_attr_exposure); 5678 rc = device_create_file(&vdev->dev, &dev_attr_exposure);
5681 if (rc) goto err_hue; 5679 if (rc) goto err_hue;
5682 5680
5683 return 0; 5681 return 0;
5684 5682
5685err_hue: 5683err_hue:
5686 video_device_remove_file(vdev, &dev_attr_hue); 5684 device_remove_file(&vdev->dev, &dev_attr_hue);
5687err_contrast: 5685err_contrast:
5688 video_device_remove_file(vdev, &dev_attr_contrast); 5686 device_remove_file(&vdev->dev, &dev_attr_contrast);
5689err_sat: 5687err_sat:
5690 video_device_remove_file(vdev, &dev_attr_saturation); 5688 device_remove_file(&vdev->dev, &dev_attr_saturation);
5691err_bright: 5689err_bright:
5692 video_device_remove_file(vdev, &dev_attr_brightness); 5690 device_remove_file(&vdev->dev, &dev_attr_brightness);
5693err_sensor: 5691err_sensor:
5694 video_device_remove_file(vdev, &dev_attr_sensor); 5692 device_remove_file(&vdev->dev, &dev_attr_sensor);
5695err_bridge: 5693err_bridge:
5696 video_device_remove_file(vdev, &dev_attr_bridge); 5694 device_remove_file(&vdev->dev, &dev_attr_bridge);
5697err_model: 5695err_model:
5698 video_device_remove_file(vdev, &dev_attr_model); 5696 device_remove_file(&vdev->dev, &dev_attr_model);
5699err_id: 5697err_id:
5700 video_device_remove_file(vdev, &dev_attr_custom_id); 5698 device_remove_file(&vdev->dev, &dev_attr_custom_id);
5701err: 5699err:
5702 return rc; 5700 return rc;
5703} 5701}
@@ -5833,7 +5831,7 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id)
5833 goto error; 5831 goto error;
5834 5832
5835 memcpy(ov->vdev, &vdev_template, sizeof(*ov->vdev)); 5833 memcpy(ov->vdev, &vdev_template, sizeof(*ov->vdev));
5836 ov->vdev->dev = &intf->dev; 5834 ov->vdev->parent = &intf->dev;
5837 video_set_drvdata(ov->vdev, ov); 5835 video_set_drvdata(ov->vdev, ov);
5838 5836
5839 for (i = 0; i < OV511_MAX_UNIT_VIDEO; i++) { 5837 for (i = 0; i < OV511_MAX_UNIT_VIDEO; i++) {
diff --git a/drivers/media/video/ov511.h b/drivers/media/video/ov511.h
index 1010e51189b7..baded1262ca9 100644
--- a/drivers/media/video/ov511.h
+++ b/drivers/media/video/ov511.h
@@ -4,6 +4,7 @@
4#include <asm/uaccess.h> 4#include <asm/uaccess.h>
5#include <linux/videodev.h> 5#include <linux/videodev.h>
6#include <media/v4l2-common.h> 6#include <media/v4l2-common.h>
7#include <media/v4l2-ioctl.h>
7#include <linux/usb.h> 8#include <linux/usb.h>
8#include <linux/mutex.h> 9#include <linux/mutex.h>
9 10
diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c
index 36047d4e70f6..e69de29bb2d1 100644
--- a/drivers/media/video/planb.c
+++ b/drivers/media/video/planb.c
@@ -1,2309 +0,0 @@
1/*
2 planb - PlanB frame grabber driver
3
4 PlanB is used in the 7x00/8x00 series of PowerMacintosh
5 Computers as video input DMA controller.
6
7 Copyright (C) 1998 Michel Lanners (mlan@cpu.lu)
8
9 Based largely on the bttv driver by Ralph Metzler (rjkm@thp.uni-koeln.de)
10
11 Additional debugging and coding by Takashi Oe (toe@unlserve.unl.edu)
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 as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26*/
27
28/* $Id: planb.c,v 1.18 1999/05/02 17:36:34 mlan Exp $ */
29
30#include <linux/init.h>
31#include <linux/errno.h>
32#include <linux/module.h>
33#include <linux/kernel.h>
34#include <linux/major.h>
35#include <linux/slab.h>
36#include <linux/types.h>
37#include <linux/pci.h>
38#include <linux/delay.h>
39#include <linux/vmalloc.h>
40#include <linux/mm.h>
41#include <linux/sched.h>
42#include <linux/videodev.h>
43#include <media/v4l2-common.h>
44#include <linux/wait.h>
45#include <asm/uaccess.h>
46#include <asm/io.h>
47#include <asm/prom.h>
48#include <asm/dbdma.h>
49#include <asm/pgtable.h>
50#include <asm/page.h>
51#include <asm/irq.h>
52#include <linux/mutex.h>
53
54#include "planb.h"
55#include "saa7196.h"
56
57/* Would you mind for some ugly debugging? */
58#if 0
59#define DEBUG(x...) printk(KERN_DEBUG ## x) /* Debug driver */
60#else
61#define DEBUG(x...) /* Don't debug driver */
62#endif
63
64#if 0
65#define IDEBUG(x...) printk(KERN_DEBUG ## x) /* Debug interrupt part */
66#else
67#define IDEBUG(x...) /* Don't debug interrupt part */
68#endif
69
70/* Ever seen a Mac with more than 1 of these? */
71#define PLANB_MAX 1
72
73static int planb_num;
74static struct planb planbs[PLANB_MAX];
75static volatile struct planb_registers *planb_regs;
76
77static int def_norm = PLANB_DEF_NORM; /* default norm */
78static int video_nr = -1;
79
80module_param(def_norm, int, 0);
81MODULE_PARM_DESC(def_norm, "Default startup norm (0=PAL, 1=NTSC, 2=SECAM)");
82module_param(video_nr, int, 0);
83MODULE_LICENSE("GPL");
84
85
86/* ------------------ PlanB Exported Functions ------------------ */
87static long planb_write(struct video_device *, const char *, unsigned long, int);
88static long planb_read(struct video_device *, char *, unsigned long, int);
89static int planb_open(struct video_device *, int);
90static void planb_close(struct video_device *);
91static int planb_ioctl(struct video_device *, unsigned int, void *);
92static int planb_init_done(struct video_device *);
93static int planb_mmap(struct video_device *, const char *, unsigned long);
94static void release_planb(void);
95int init_planbs(struct video_init *);
96
97/* ------------------ PlanB Internal Functions ------------------ */
98static int planb_prepare_open(struct planb *);
99static void planb_prepare_close(struct planb *);
100static void saa_write_reg(unsigned char, unsigned char);
101static unsigned char saa_status(int, struct planb *);
102static void saa_set(unsigned char, unsigned char, struct planb *);
103static void saa_init_regs(struct planb *);
104static int grabbuf_alloc(struct planb *);
105static int vgrab(struct planb *, struct video_mmap *);
106static void add_clip(struct planb *, struct video_clip *);
107static void fill_cmd_buff(struct planb *);
108static void cmd_buff(struct planb *);
109static volatile struct dbdma_cmd *setup_grab_cmd(int, struct planb *);
110static void overlay_start(struct planb *);
111static void overlay_stop(struct planb *);
112static inline void tab_cmd_dbdma(volatile struct dbdma_cmd *, unsigned short,
113 unsigned int);
114static inline void tab_cmd_store(volatile struct dbdma_cmd *, unsigned int,
115 unsigned int);
116static inline void tab_cmd_gen(volatile struct dbdma_cmd *, unsigned short,
117 unsigned short, unsigned int, unsigned int);
118static int init_planb(struct planb *);
119static int find_planb(void);
120static void planb_pre_capture(int, int, struct planb *);
121static volatile struct dbdma_cmd *cmd_geo_setup(volatile struct dbdma_cmd *,
122 int, int, int, int, int, struct planb *);
123static inline void planb_dbdma_stop(volatile struct dbdma_regs *);
124static unsigned int saa_geo_setup(int, int, int, int, struct planb *);
125static inline int overlay_is_active(struct planb *);
126
127/*******************************/
128/* Memory management functions */
129/*******************************/
130
131static int grabbuf_alloc(struct planb *pb)
132{
133 int i, npage;
134
135 npage = MAX_GBUFFERS * ((PLANB_MAX_FBUF / PAGE_SIZE + 1)
136#ifndef PLANB_GSCANLINE
137 + MAX_LNUM
138#endif /* PLANB_GSCANLINE */
139 );
140 if ((pb->rawbuf = kmalloc(npage
141 * sizeof(unsigned long), GFP_KERNEL)) == 0)
142 return -ENOMEM;
143 for (i = 0; i < npage; i++) {
144 pb->rawbuf[i] = (unsigned char *)__get_free_pages(GFP_KERNEL
145 |GFP_DMA, 0);
146 if (!pb->rawbuf[i])
147 break;
148 SetPageReserved(virt_to_page(pb->rawbuf[i]));
149 }
150 if (i-- < npage) {
151 printk(KERN_DEBUG "PlanB: init_grab: grab buffer not allocated\n");
152 for (; i > 0; i--) {
153 ClearPageReserved(virt_to_page(pb->rawbuf[i]));
154 free_pages((unsigned long)pb->rawbuf[i], 0);
155 }
156 kfree(pb->rawbuf);
157 return -ENOBUFS;
158 }
159 pb->rawbuf_size = npage;
160 return 0;
161}
162
163/*****************************/
164/* Hardware access functions */
165/*****************************/
166
167static void saa_write_reg(unsigned char addr, unsigned char val)
168{
169 planb_regs->saa_addr = addr; eieio();
170 planb_regs->saa_regval = val; eieio();
171 return;
172}
173
174/* return status byte 0 or 1: */
175static unsigned char saa_status(int byte, struct planb *pb)
176{
177 saa_regs[pb->win.norm][SAA7196_STDC] =
178 (saa_regs[pb->win.norm][SAA7196_STDC] & ~2) | ((byte & 1) << 1);
179 saa_write_reg (SAA7196_STDC, saa_regs[pb->win.norm][SAA7196_STDC]);
180
181 /* Let's wait 30msec for this one */
182 msleep_interruptible(30);
183
184 return (unsigned char)in_8 (&planb_regs->saa_status);
185}
186
187static void saa_set(unsigned char addr, unsigned char val, struct planb *pb)
188{
189 if(saa_regs[pb->win.norm][addr] != val) {
190 saa_regs[pb->win.norm][addr] = val;
191 saa_write_reg (addr, val);
192 }
193 return;
194}
195
196static void saa_init_regs(struct planb *pb)
197{
198 int i;
199
200 for (i = 0; i < SAA7196_NUMREGS; i++)
201 saa_write_reg (i, saa_regs[pb->win.norm][i]);
202}
203
204static unsigned int saa_geo_setup(int width, int height, int interlace, int bpp,
205 struct planb *pb)
206{
207 int ht, norm = pb->win.norm;
208
209 switch(bpp) {
210 case 2:
211 /* RGB555+a 1x16-bit + 16-bit transparent */
212 saa_regs[norm][SAA7196_FMTS] &= ~0x3;
213 break;
214 case 1:
215 case 4:
216 /* RGB888 1x24-bit + 8-bit transparent */
217 saa_regs[norm][SAA7196_FMTS] &= ~0x1;
218 saa_regs[norm][SAA7196_FMTS] |= 0x2;
219 break;
220 default:
221 return -EINVAL;
222 }
223 ht = (interlace ? height / 2 : height);
224 saa_regs[norm][SAA7196_OUTPIX] = (unsigned char) (width & 0x00ff);
225 saa_regs[norm][SAA7196_HFILT] = (saa_regs[norm][SAA7196_HFILT] & ~0x3)
226 | (width >> 8 & 0x3);
227 saa_regs[norm][SAA7196_OUTLINE] = (unsigned char) (ht & 0xff);
228 saa_regs[norm][SAA7196_VYP] = (saa_regs[norm][SAA7196_VYP] & ~0x3)
229 | (ht >> 8 & 0x3);
230 /* feed both fields if interlaced, or else feed only even fields */
231 saa_regs[norm][SAA7196_FMTS] = (interlace) ?
232 (saa_regs[norm][SAA7196_FMTS] & ~0x60)
233 : (saa_regs[norm][SAA7196_FMTS] | 0x60);
234 /* transparent mode; extended format enabled */
235 saa_regs[norm][SAA7196_DPATH] |= 0x3;
236
237 return 0;
238}
239
240/***************************/
241/* DBDMA support functions */
242/***************************/
243
244static inline void planb_dbdma_restart(volatile struct dbdma_regs *ch)
245{
246 out_le32(&ch->control, PLANB_CLR(RUN));
247 out_le32(&ch->control, PLANB_SET(RUN|WAKE) | PLANB_CLR(PAUSE));
248}
249
250static inline void planb_dbdma_stop(volatile struct dbdma_regs *ch)
251{
252 int i = 0;
253
254 out_le32(&ch->control, PLANB_CLR(RUN) | PLANB_SET(FLUSH));
255 while((in_le32(&ch->status) == (ACTIVE | FLUSH)) && (i < 999)) {
256 IDEBUG("PlanB: waiting for DMA to stop\n");
257 i++;
258 }
259}
260
261static inline void tab_cmd_dbdma(volatile struct dbdma_cmd *ch,
262 unsigned short command, unsigned int cmd_dep)
263{
264 st_le16(&ch->command, command);
265 st_le32(&ch->cmd_dep, cmd_dep);
266}
267
268static inline void tab_cmd_store(volatile struct dbdma_cmd *ch,
269 unsigned int phy_addr, unsigned int cmd_dep)
270{
271 st_le16(&ch->command, STORE_WORD | KEY_SYSTEM);
272 st_le16(&ch->req_count, 4);
273 st_le32(&ch->phy_addr, phy_addr);
274 st_le32(&ch->cmd_dep, cmd_dep);
275}
276
277static inline void tab_cmd_gen(volatile struct dbdma_cmd *ch,
278 unsigned short command, unsigned short req_count,
279 unsigned int phy_addr, unsigned int cmd_dep)
280{
281 st_le16(&ch->command, command);
282 st_le16(&ch->req_count, req_count);
283 st_le32(&ch->phy_addr, phy_addr);
284 st_le32(&ch->cmd_dep, cmd_dep);
285}
286
287static volatile struct dbdma_cmd *cmd_geo_setup(
288 volatile struct dbdma_cmd *c1, int width, int height, int interlace,
289 int bpp, int clip, struct planb *pb)
290{
291 int norm = pb->win.norm;
292
293 if((saa_geo_setup(width, height, interlace, bpp, pb)) != 0)
294 return (volatile struct dbdma_cmd *)NULL;
295 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_addr),
296 SAA7196_FMTS);
297 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_regval),
298 saa_regs[norm][SAA7196_FMTS]);
299 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_addr),
300 SAA7196_DPATH);
301 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_regval),
302 saa_regs[norm][SAA7196_DPATH]);
303 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->even),
304 bpp | ((clip)? PLANB_CLIPMASK: 0));
305 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->odd),
306 bpp | ((clip)? PLANB_CLIPMASK: 0));
307 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_addr),
308 SAA7196_OUTPIX);
309 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_regval),
310 saa_regs[norm][SAA7196_OUTPIX]);
311 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_addr),
312 SAA7196_HFILT);
313 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_regval),
314 saa_regs[norm][SAA7196_HFILT]);
315 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_addr),
316 SAA7196_OUTLINE);
317 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_regval),
318 saa_regs[norm][SAA7196_OUTLINE]);
319 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_addr),
320 SAA7196_VYP);
321 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->saa_regval),
322 saa_regs[norm][SAA7196_VYP]);
323 return c1;
324}
325
326/******************************/
327/* misc. supporting functions */
328/******************************/
329
330static inline void planb_lock(struct planb *pb)
331{
332 mutex_lock(&pb->lock);
333}
334
335static inline void planb_unlock(struct planb *pb)
336{
337 mutex_unlock(&pb->lock);
338}
339
340/***************/
341/* Driver Core */
342/***************/
343
344static int planb_prepare_open(struct planb *pb)
345{
346 int i, size;
347
348 /* allocate memory for two plus alpha command buffers (size: max lines,
349 plus 40 commands handling, plus 1 alignment), plus dummy command buf,
350 plus clipmask buffer, plus frame grabbing status */
351 size = (pb->tab_size*(2+MAX_GBUFFERS*TAB_FACTOR)+1+MAX_GBUFFERS
352 * PLANB_DUMMY)*sizeof(struct dbdma_cmd)
353 +(PLANB_MAXLINES*((PLANB_MAXPIXELS+7)& ~7))/8
354 +MAX_GBUFFERS*sizeof(unsigned int);
355 if ((pb->priv_space = kzalloc (size, GFP_KERNEL)) == 0)
356 return -ENOMEM;
357 pb->overlay_last1 = pb->ch1_cmd = (volatile struct dbdma_cmd *)
358 DBDMA_ALIGN (pb->priv_space);
359 pb->overlay_last2 = pb->ch2_cmd = pb->ch1_cmd + pb->tab_size;
360 pb->ch1_cmd_phys = virt_to_bus(pb->ch1_cmd);
361 pb->cap_cmd[0] = pb->ch2_cmd + pb->tab_size;
362 pb->pre_cmd[0] = pb->cap_cmd[0] + pb->tab_size * TAB_FACTOR;
363 for (i = 1; i < MAX_GBUFFERS; i++) {
364 pb->cap_cmd[i] = pb->pre_cmd[i-1] + PLANB_DUMMY;
365 pb->pre_cmd[i] = pb->cap_cmd[i] + pb->tab_size * TAB_FACTOR;
366 }
367 pb->frame_stat=(volatile unsigned int *)(pb->pre_cmd[MAX_GBUFFERS-1]
368 + PLANB_DUMMY);
369 pb->mask = (unsigned char *)(pb->frame_stat+MAX_GBUFFERS);
370
371 pb->rawbuf = NULL;
372 pb->rawbuf_size = 0;
373 pb->grabbing = 0;
374 for (i = 0; i < MAX_GBUFFERS; i++) {
375 pb->frame_stat[i] = GBUFFER_UNUSED;
376 pb->gwidth[i] = 0;
377 pb->gheight[i] = 0;
378 pb->gfmt[i] = 0;
379 pb->gnorm_switch[i] = 0;
380#ifndef PLANB_GSCANLINE
381 pb->lsize[i] = 0;
382 pb->lnum[i] = 0;
383#endif /* PLANB_GSCANLINE */
384 }
385 pb->gcount = 0;
386 pb->suspend = 0;
387 pb->last_fr = -999;
388 pb->prev_last_fr = -999;
389
390 /* Reset DMA controllers */
391 planb_dbdma_stop(&pb->planb_base->ch2);
392 planb_dbdma_stop(&pb->planb_base->ch1);
393
394 return 0;
395}
396
397static void planb_prepare_close(struct planb *pb)
398{
399 int i;
400
401 /* make sure the dma's are idle */
402 planb_dbdma_stop(&pb->planb_base->ch2);
403 planb_dbdma_stop(&pb->planb_base->ch1);
404 /* free kernel memory of command buffers */
405 if(pb->priv_space != 0) {
406 kfree (pb->priv_space);
407 pb->priv_space = 0;
408 pb->cmd_buff_inited = 0;
409 }
410 if(pb->rawbuf) {
411 for (i = 0; i < pb->rawbuf_size; i++) {
412 ClearPageReserved(virt_to_page(pb->rawbuf[i]));
413 free_pages((unsigned long)pb->rawbuf[i], 0);
414 }
415 kfree(pb->rawbuf);
416 }
417 pb->rawbuf = NULL;
418}
419
420/*****************************/
421/* overlay support functions */
422/*****************************/
423
424static inline int overlay_is_active(struct planb *pb)
425{
426 unsigned int size = pb->tab_size * sizeof(struct dbdma_cmd);
427 unsigned int caddr = (unsigned)in_le32(&pb->planb_base->ch1.cmdptr);
428
429 return (in_le32(&pb->overlay_last1->cmd_dep) == pb->ch1_cmd_phys)
430 && (caddr < (pb->ch1_cmd_phys + size))
431 && (caddr >= (unsigned)pb->ch1_cmd_phys);
432}
433
434static void overlay_start(struct planb *pb)
435{
436
437 DEBUG("PlanB: overlay_start()\n");
438
439 if(ACTIVE & in_le32(&pb->planb_base->ch1.status)) {
440
441 DEBUG("PlanB: presumably, grabbing is in progress...\n");
442
443 planb_dbdma_stop(&pb->planb_base->ch2);
444 out_le32 (&pb->planb_base->ch2.cmdptr,
445 virt_to_bus(pb->ch2_cmd));
446 planb_dbdma_restart(&pb->planb_base->ch2);
447 st_le16 (&pb->ch1_cmd->command, DBDMA_NOP);
448 tab_cmd_dbdma(pb->last_cmd[pb->last_fr],
449 DBDMA_NOP | BR_ALWAYS,
450 virt_to_bus(pb->ch1_cmd));
451 eieio();
452 pb->prev_last_fr = pb->last_fr;
453 pb->last_fr = -2;
454 if(!(ACTIVE & in_le32(&pb->planb_base->ch1.status))) {
455 IDEBUG("PlanB: became inactive "
456 "in the mean time... reactivating\n");
457 planb_dbdma_stop(&pb->planb_base->ch1);
458 out_le32 (&pb->planb_base->ch1.cmdptr,
459 virt_to_bus(pb->ch1_cmd));
460 planb_dbdma_restart(&pb->planb_base->ch1);
461 }
462 } else {
463
464 DEBUG("PlanB: currently idle, so can do whatever\n");
465
466 planb_dbdma_stop(&pb->planb_base->ch2);
467 planb_dbdma_stop(&pb->planb_base->ch1);
468 st_le32 (&pb->planb_base->ch2.cmdptr,
469 virt_to_bus(pb->ch2_cmd));
470 st_le32 (&pb->planb_base->ch1.cmdptr,
471 virt_to_bus(pb->ch1_cmd));
472 out_le16 (&pb->ch1_cmd->command, DBDMA_NOP);
473 planb_dbdma_restart(&pb->planb_base->ch2);
474 planb_dbdma_restart(&pb->planb_base->ch1);
475 pb->last_fr = -1;
476 }
477 return;
478}
479
480static void overlay_stop(struct planb *pb)
481{
482 DEBUG("PlanB: overlay_stop()\n");
483
484 if(pb->last_fr == -1) {
485
486 DEBUG("PlanB: no grabbing, it seems...\n");
487
488 planb_dbdma_stop(&pb->planb_base->ch2);
489 planb_dbdma_stop(&pb->planb_base->ch1);
490 pb->last_fr = -999;
491 } else if(pb->last_fr == -2) {
492 unsigned int cmd_dep;
493 tab_cmd_dbdma(pb->cap_cmd[pb->prev_last_fr], DBDMA_STOP, 0);
494 eieio();
495 cmd_dep = (unsigned int)in_le32(&pb->overlay_last1->cmd_dep);
496 if(overlay_is_active(pb)) {
497
498 DEBUG("PlanB: overlay is currently active\n");
499
500 planb_dbdma_stop(&pb->planb_base->ch2);
501 planb_dbdma_stop(&pb->planb_base->ch1);
502 if(cmd_dep != pb->ch1_cmd_phys) {
503 out_le32(&pb->planb_base->ch1.cmdptr,
504 virt_to_bus(pb->overlay_last1));
505 planb_dbdma_restart(&pb->planb_base->ch1);
506 }
507 }
508 pb->last_fr = pb->prev_last_fr;
509 pb->prev_last_fr = -999;
510 }
511 return;
512}
513
514static void suspend_overlay(struct planb *pb)
515{
516 int fr = -1;
517 struct dbdma_cmd last;
518
519 DEBUG("PlanB: suspend_overlay: %d\n", pb->suspend);
520
521 if(pb->suspend++)
522 return;
523 if(ACTIVE & in_le32(&pb->planb_base->ch1.status)) {
524 if(pb->last_fr == -2) {
525 fr = pb->prev_last_fr;
526 memcpy(&last, (void*)pb->last_cmd[fr], sizeof(last));
527 tab_cmd_dbdma(pb->last_cmd[fr], DBDMA_STOP, 0);
528 }
529 if(overlay_is_active(pb)) {
530 planb_dbdma_stop(&pb->planb_base->ch2);
531 planb_dbdma_stop(&pb->planb_base->ch1);
532 pb->suspended.overlay = 1;
533 pb->suspended.frame = fr;
534 memcpy(&pb->suspended.cmd, &last, sizeof(last));
535 return;
536 }
537 }
538 pb->suspended.overlay = 0;
539 pb->suspended.frame = fr;
540 memcpy(&pb->suspended.cmd, &last, sizeof(last));
541 return;
542}
543
544static void resume_overlay(struct planb *pb)
545{
546
547 DEBUG("PlanB: resume_overlay: %d\n", pb->suspend);
548
549 if(pb->suspend > 1)
550 return;
551 if(pb->suspended.frame != -1) {
552 memcpy((void*)pb->last_cmd[pb->suspended.frame],
553 &pb->suspended.cmd, sizeof(pb->suspended.cmd));
554 }
555 if(ACTIVE & in_le32(&pb->planb_base->ch1.status)) {
556 goto finish;
557 }
558 if(pb->suspended.overlay) {
559
560 DEBUG("PlanB: overlay being resumed\n");
561
562 st_le16 (&pb->ch1_cmd->command, DBDMA_NOP);
563 st_le16 (&pb->ch2_cmd->command, DBDMA_NOP);
564 /* Set command buffer addresses */
565 st_le32(&pb->planb_base->ch1.cmdptr,
566 virt_to_bus(pb->overlay_last1));
567 out_le32(&pb->planb_base->ch2.cmdptr,
568 virt_to_bus(pb->overlay_last2));
569 /* Start the DMA controller */
570 out_le32 (&pb->planb_base->ch2.control,
571 PLANB_CLR(PAUSE) | PLANB_SET(RUN|WAKE));
572 out_le32 (&pb->planb_base->ch1.control,
573 PLANB_CLR(PAUSE) | PLANB_SET(RUN|WAKE));
574 } else if(pb->suspended.frame != -1) {
575 out_le32(&pb->planb_base->ch1.cmdptr,
576 virt_to_bus(pb->last_cmd[pb->suspended.frame]));
577 out_le32 (&pb->planb_base->ch1.control,
578 PLANB_CLR(PAUSE) | PLANB_SET(RUN|WAKE));
579 }
580
581finish:
582 pb->suspend--;
583 wake_up_interruptible(&pb->suspendq);
584}
585
586static void add_clip(struct planb *pb, struct video_clip *clip)
587{
588 volatile unsigned char *base;
589 int xc = clip->x, yc = clip->y;
590 int wc = clip->width, hc = clip->height;
591 int ww = pb->win.width, hw = pb->win.height;
592 int x, y, xtmp1, xtmp2;
593
594 DEBUG("PlanB: clip %dx%d+%d+%d\n", wc, hc, xc, yc);
595
596 if(xc < 0) {
597 wc += xc;
598 xc = 0;
599 }
600 if(yc < 0) {
601 hc += yc;
602 yc = 0;
603 }
604 if(xc + wc > ww)
605 wc = ww - xc;
606 if(wc <= 0) /* Nothing to do */
607 return;
608 if(yc + hc > hw)
609 hc = hw - yc;
610
611 for (y = yc; y < yc+hc; y++) {
612 xtmp1=xc>>3;
613 xtmp2=(xc+wc)>>3;
614 base = pb->mask + y*96;
615 if(xc != 0 || wc >= 8)
616 *(base + xtmp1) &= (unsigned char)(0x00ff &
617 (0xff00 >> (xc&7)));
618 for (x = xtmp1 + 1; x < xtmp2; x++) {
619 *(base + x) = 0;
620 }
621 if(xc < (ww & ~0x7))
622 *(base + xtmp2) &= (unsigned char)(0x00ff >>
623 ((xc+wc) & 7));
624 }
625
626 return;
627}
628
629static void fill_cmd_buff(struct planb *pb)
630{
631 int restore = 0;
632 volatile struct dbdma_cmd last;
633
634 DEBUG("PlanB: fill_cmd_buff()\n");
635
636 if(pb->overlay_last1 != pb->ch1_cmd) {
637 restore = 1;
638 last = *(pb->overlay_last1);
639 }
640 memset ((void *) pb->ch1_cmd, 0, 2 * pb->tab_size
641 * sizeof(struct dbdma_cmd));
642 cmd_buff (pb);
643 if(restore)
644 *(pb->overlay_last1) = last;
645 if(pb->suspended.overlay) {
646 unsigned long jump_addr = in_le32(&pb->overlay_last1->cmd_dep);
647 if(jump_addr != pb->ch1_cmd_phys) {
648 int i;
649
650 DEBUG("PlanB: adjusting ch1's jump address\n");
651
652 for(i = 0; i < MAX_GBUFFERS; i++) {
653 if(pb->need_pre_capture[i]) {
654 if(jump_addr == virt_to_bus(pb->pre_cmd[i]))
655 goto found;
656 } else {
657 if(jump_addr == virt_to_bus(pb->cap_cmd[i]))
658 goto found;
659 }
660 }
661
662 DEBUG("PlanB: not found...\n");
663
664 goto out;
665found:
666 if(pb->need_pre_capture[i])
667 out_le32(&pb->pre_cmd[i]->phy_addr,
668 virt_to_bus(pb->overlay_last1));
669 else
670 out_le32(&pb->cap_cmd[i]->phy_addr,
671 virt_to_bus(pb->overlay_last1));
672 }
673 }
674out:
675 pb->cmd_buff_inited = 1;
676
677 return;
678}
679
680static void cmd_buff(struct planb *pb)
681{
682 int i, bpp, count, nlines, stepsize, interlace;
683 unsigned long base, jump, addr_com, addr_dep;
684 volatile struct dbdma_cmd *c1 = pb->ch1_cmd;
685 volatile struct dbdma_cmd *c2 = pb->ch2_cmd;
686
687 interlace = pb->win.interlace;
688 bpp = pb->win.bpp;
689 count = (bpp * ((pb->win.x + pb->win.width > pb->win.swidth) ?
690 (pb->win.swidth - pb->win.x) : pb->win.width));
691 nlines = ((pb->win.y + pb->win.height > pb->win.sheight) ?
692 (pb->win.sheight - pb->win.y) : pb->win.height);
693
694 /* Do video in: */
695
696 /* Preamble commands: */
697 addr_com = virt_to_bus(c1);
698 addr_dep = virt_to_bus(&c1->cmd_dep);
699 tab_cmd_dbdma(c1++, DBDMA_NOP, 0);
700 jump = virt_to_bus(c1+16); /* 14 by cmd_geo_setup() and 2 for padding */
701 if((c1 = cmd_geo_setup(c1, pb->win.width, pb->win.height, interlace,
702 bpp, 1, pb)) == NULL) {
703 printk(KERN_WARNING "PlanB: encountered serious problems\n");
704 tab_cmd_dbdma(pb->ch1_cmd + 1, DBDMA_STOP, 0);
705 tab_cmd_dbdma(pb->ch2_cmd + 1, DBDMA_STOP, 0);
706 return;
707 }
708 tab_cmd_store(c1++, addr_com, (unsigned)(DBDMA_NOP | BR_ALWAYS) << 16);
709 tab_cmd_store(c1++, addr_dep, jump);
710 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.wait_sel),
711 PLANB_SET(FIELD_SYNC));
712 /* (1) wait for field sync to be set */
713 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFCLR, 0);
714 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
715 PLANB_SET(ODD_FIELD));
716 /* wait for field sync to be cleared */
717 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFSET, 0);
718 /* if not odd field, wait until field sync is set again */
719 tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFSET, virt_to_bus(c1-3)); c1++;
720 /* assert ch_sync to ch2 */
721 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch2.control),
722 PLANB_SET(CH_SYNC));
723 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
724 PLANB_SET(DMA_ABORT));
725
726 base = (pb->frame_buffer_phys + pb->offset + pb->win.y * (pb->win.bpl
727 + pb->win.pad) + pb->win.x * bpp);
728
729 if (interlace) {
730 stepsize = 2;
731 jump = virt_to_bus(c1 + (nlines + 1) / 2);
732 } else {
733 stepsize = 1;
734 jump = virt_to_bus(c1 + nlines);
735 }
736
737 /* even field data: */
738 for (i=0; i < nlines; i += stepsize, c1++)
739 tab_cmd_gen(c1, INPUT_MORE | KEY_STREAM0 | BR_IFSET,
740 count, base + i * (pb->win.bpl + pb->win.pad), jump);
741
742 /* For non-interlaced, we use even fields only */
743 if (!interlace)
744 goto cmd_tab_data_end;
745
746 /* Resync to odd field */
747 /* (2) wait for field sync to be set */
748 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFCLR, 0);
749 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
750 PLANB_SET(ODD_FIELD));
751 /* wait for field sync to be cleared */
752 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFSET, 0);
753 /* if not odd field, wait until field sync is set again */
754 tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++;
755 /* assert ch_sync to ch2 */
756 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch2.control),
757 PLANB_SET(CH_SYNC));
758 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
759 PLANB_SET(DMA_ABORT));
760
761 /* odd field data: */
762 jump = virt_to_bus(c1 + nlines / 2);
763 for (i=1; i < nlines; i += stepsize, c1++)
764 tab_cmd_gen(c1, INPUT_MORE | KEY_STREAM0 | BR_IFSET, count,
765 base + i * (pb->win.bpl + pb->win.pad), jump);
766
767 /* And jump back to the start */
768cmd_tab_data_end:
769 pb->overlay_last1 = c1; /* keep a pointer to the last command */
770 tab_cmd_dbdma(c1, DBDMA_NOP | BR_ALWAYS, virt_to_bus(pb->ch1_cmd));
771
772 /* Clipmask command buffer */
773
774 /* Preamble commands: */
775 tab_cmd_dbdma(c2++, DBDMA_NOP, 0);
776 tab_cmd_store(c2++, (unsigned)(&pb->planb_base_phys->ch2.wait_sel),
777 PLANB_SET(CH_SYNC));
778 /* wait until ch1 asserts ch_sync */
779 tab_cmd_dbdma(c2++, DBDMA_NOP | WAIT_IFCLR, 0);
780 /* clear ch_sync asserted by ch1 */
781 tab_cmd_store(c2++, (unsigned)(&pb->planb_base_phys->ch2.control),
782 PLANB_CLR(CH_SYNC));
783 tab_cmd_store(c2++, (unsigned)(&pb->planb_base_phys->ch2.wait_sel),
784 PLANB_SET(FIELD_SYNC));
785 tab_cmd_store(c2++, (unsigned)(&pb->planb_base_phys->ch2.br_sel),
786 PLANB_SET(ODD_FIELD));
787
788 /* jump to end of even field if appropriate */
789 /* this points to (interlace)? pos. C: pos. B */
790 jump = (interlace) ? virt_to_bus(c2 + (nlines + 1) / 2 + 2):
791 virt_to_bus(c2 + nlines + 2);
792 /* if odd field, skip over to odd field clipmasking */
793 tab_cmd_dbdma(c2++, DBDMA_NOP | BR_IFSET, jump);
794
795 /* even field mask: */
796 tab_cmd_store(c2++, (unsigned)(&pb->planb_base_phys->ch2.br_sel),
797 PLANB_SET(DMA_ABORT));
798 /* this points to pos. B */
799 jump = (interlace) ? virt_to_bus(c2 + nlines + 1):
800 virt_to_bus(c2 + nlines);
801 base = virt_to_bus(pb->mask);
802 for (i=0; i < nlines; i += stepsize, c2++)
803 tab_cmd_gen(c2, OUTPUT_MORE | KEY_STREAM0 | BR_IFSET, 96,
804 base + i * 96, jump);
805
806 /* For non-interlaced, we use only even fields */
807 if(!interlace)
808 goto cmd_tab_mask_end;
809
810 /* odd field mask: */
811/* C */ tab_cmd_store(c2++, (unsigned)(&pb->planb_base_phys->ch2.br_sel),
812 PLANB_SET(DMA_ABORT));
813 /* this points to pos. B */
814 jump = virt_to_bus(c2 + nlines / 2);
815 base = virt_to_bus(pb->mask);
816 for (i=1; i < nlines; i += 2, c2++) /* abort if set */
817 tab_cmd_gen(c2, OUTPUT_MORE | KEY_STREAM0 | BR_IFSET, 96,
818 base + i * 96, jump);
819
820 /* Inform channel 1 and jump back to start */
821cmd_tab_mask_end:
822 /* ok, I just realized this is kind of flawed. */
823 /* this part is reached only after odd field clipmasking. */
824 /* wanna clean up? */
825 /* wait for field sync to be set */
826 /* corresponds to fsync (1) of ch1 */
827/* B */ tab_cmd_dbdma(c2++, DBDMA_NOP | WAIT_IFCLR, 0);
828 /* restart ch1, meant to clear any dead bit or something */
829 tab_cmd_store(c2++, (unsigned)(&pb->planb_base_phys->ch1.control),
830 PLANB_CLR(RUN));
831 tab_cmd_store(c2++, (unsigned)(&pb->planb_base_phys->ch1.control),
832 PLANB_SET(RUN));
833 pb->overlay_last2 = c2; /* keep a pointer to the last command */
834 /* start over even field clipmasking */
835 tab_cmd_dbdma(c2, DBDMA_NOP | BR_ALWAYS, virt_to_bus(pb->ch2_cmd));
836
837 eieio();
838 return;
839}
840
841/*********************************/
842/* grabdisplay support functions */
843/*********************************/
844
845static int palette2fmt[] = {
846 0,
847 PLANB_GRAY,
848 0,
849 0,
850 0,
851 PLANB_COLOUR32,
852 PLANB_COLOUR15,
853 0,
854 0,
855 0,
856 0,
857 0,
858 0,
859 0,
860 0,
861};
862
863#define PLANB_PALETTE_MAX 15
864
865static int vgrab(struct planb *pb, struct video_mmap *mp)
866{
867 unsigned int fr = mp->frame;
868 unsigned int format;
869
870 if(pb->rawbuf==NULL) {
871 int err;
872 if((err=grabbuf_alloc(pb)))
873 return err;
874 }
875
876 IDEBUG("PlanB: grab %d: %dx%d(%u)\n", pb->grabbing,
877 mp->width, mp->height, fr);
878
879 if(pb->grabbing >= MAX_GBUFFERS)
880 return -ENOBUFS;
881 if(fr > (MAX_GBUFFERS - 1) || fr < 0)
882 return -EINVAL;
883 if(mp->height <= 0 || mp->width <= 0)
884 return -EINVAL;
885 if(mp->format < 0 || mp->format >= PLANB_PALETTE_MAX)
886 return -EINVAL;
887 if((format = palette2fmt[mp->format]) == 0)
888 return -EINVAL;
889 if (mp->height * mp->width * format > PLANB_MAX_FBUF) /* format = bpp */
890 return -EINVAL;
891
892 planb_lock(pb);
893 if(mp->width != pb->gwidth[fr] || mp->height != pb->gheight[fr] ||
894 format != pb->gfmt[fr] || (pb->gnorm_switch[fr])) {
895 int i;
896#ifndef PLANB_GSCANLINE
897 unsigned int osize = pb->gwidth[fr] * pb->gheight[fr]
898 * pb->gfmt[fr];
899 unsigned int nsize = mp->width * mp->height * format;
900#endif
901
902 IDEBUG("PlanB: gwidth = %d, gheight = %d, mp->format = %u\n",
903 mp->width, mp->height, mp->format);
904
905#ifndef PLANB_GSCANLINE
906 if(pb->gnorm_switch[fr])
907 nsize = 0;
908 if (nsize < osize) {
909 for(i = pb->gbuf_idx[fr]; osize > 0; i++) {
910 memset((void *)pb->rawbuf[i], 0, PAGE_SIZE);
911 osize -= PAGE_SIZE;
912 }
913 }
914 for(i = pb->l_fr_addr_idx[fr]; i < pb->l_fr_addr_idx[fr]
915 + pb->lnum[fr]; i++)
916 memset((void *)pb->rawbuf[i], 0, PAGE_SIZE);
917#else
918/* XXX TODO */
919/*
920 if(pb->gnorm_switch[fr])
921 memset((void *)pb->gbuffer[fr], 0,
922 pb->gbytes_per_line * pb->gheight[fr]);
923 else {
924 if(mp->
925 for(i = 0; i < pb->gheight[fr]; i++) {
926 memset((void *)(pb->gbuffer[fr]
927 + pb->gbytes_per_line * i
928 }
929 }
930*/
931#endif
932 pb->gwidth[fr] = mp->width;
933 pb->gheight[fr] = mp->height;
934 pb->gfmt[fr] = format;
935 pb->last_cmd[fr] = setup_grab_cmd(fr, pb);
936 planb_pre_capture(fr, pb->gfmt[fr], pb); /* gfmt = bpp */
937 pb->need_pre_capture[fr] = 1;
938 pb->gnorm_switch[fr] = 0;
939 } else
940 pb->need_pre_capture[fr] = 0;
941 pb->frame_stat[fr] = GBUFFER_GRABBING;
942 if(!(ACTIVE & in_le32(&pb->planb_base->ch1.status))) {
943
944 IDEBUG("PlanB: ch1 inactive, initiating grabbing\n");
945
946 planb_dbdma_stop(&pb->planb_base->ch1);
947 if(pb->need_pre_capture[fr]) {
948
949 IDEBUG("PlanB: padding pre-capture sequence\n");
950
951 out_le32 (&pb->planb_base->ch1.cmdptr,
952 virt_to_bus(pb->pre_cmd[fr]));
953 } else {
954 tab_cmd_dbdma(pb->last_cmd[fr], DBDMA_STOP, 0);
955 tab_cmd_dbdma(pb->cap_cmd[fr], DBDMA_NOP, 0);
956 /* let's be on the safe side. here is not timing critical. */
957 tab_cmd_dbdma((pb->cap_cmd[fr] + 1), DBDMA_NOP, 0);
958 out_le32 (&pb->planb_base->ch1.cmdptr,
959 virt_to_bus(pb->cap_cmd[fr]));
960 }
961 planb_dbdma_restart(&pb->planb_base->ch1);
962 pb->last_fr = fr;
963 } else {
964 int i;
965
966 IDEBUG("PlanB: ch1 active, grabbing being queued\n");
967
968 if((pb->last_fr == -1) || ((pb->last_fr == -2) &&
969 overlay_is_active(pb))) {
970
971 IDEBUG("PlanB: overlay is active, grabbing defered\n");
972
973 tab_cmd_dbdma(pb->last_cmd[fr],
974 DBDMA_NOP | BR_ALWAYS,
975 virt_to_bus(pb->ch1_cmd));
976 if(pb->need_pre_capture[fr]) {
977
978 IDEBUG("PlanB: padding pre-capture sequence\n");
979
980 tab_cmd_store(pb->pre_cmd[fr],
981 virt_to_bus(&pb->overlay_last1->cmd_dep),
982 virt_to_bus(pb->ch1_cmd));
983 eieio();
984 out_le32 (&pb->overlay_last1->cmd_dep,
985 virt_to_bus(pb->pre_cmd[fr]));
986 } else {
987 tab_cmd_store(pb->cap_cmd[fr],
988 virt_to_bus(&pb->overlay_last1->cmd_dep),
989 virt_to_bus(pb->ch1_cmd));
990 tab_cmd_dbdma((pb->cap_cmd[fr] + 1),
991 DBDMA_NOP, 0);
992 eieio();
993 out_le32 (&pb->overlay_last1->cmd_dep,
994 virt_to_bus(pb->cap_cmd[fr]));
995 }
996 for(i = 0; overlay_is_active(pb) && i < 999; i++)
997 IDEBUG("PlanB: waiting for overlay done\n");
998 tab_cmd_dbdma(pb->ch1_cmd, DBDMA_NOP, 0);
999 pb->prev_last_fr = fr;
1000 pb->last_fr = -2;
1001 } else if(pb->last_fr == -2) {
1002
1003 IDEBUG("PlanB: mixed mode detected, grabbing"
1004 " will be done before activating overlay\n");
1005
1006 tab_cmd_dbdma(pb->ch1_cmd, DBDMA_NOP, 0);
1007 if(pb->need_pre_capture[fr]) {
1008
1009 IDEBUG("PlanB: padding pre-capture sequence\n");
1010
1011 tab_cmd_dbdma(pb->last_cmd[pb->prev_last_fr],
1012 DBDMA_NOP | BR_ALWAYS,
1013 virt_to_bus(pb->pre_cmd[fr]));
1014 eieio();
1015 } else {
1016 tab_cmd_dbdma(pb->cap_cmd[fr], DBDMA_NOP, 0);
1017 if(pb->gwidth[pb->prev_last_fr] !=
1018 pb->gwidth[fr]
1019 || pb->gheight[pb->prev_last_fr] !=
1020 pb->gheight[fr]
1021 || pb->gfmt[pb->prev_last_fr] !=
1022 pb->gfmt[fr])
1023 tab_cmd_dbdma((pb->cap_cmd[fr] + 1),
1024 DBDMA_NOP, 0);
1025 else
1026 tab_cmd_dbdma((pb->cap_cmd[fr] + 1),
1027 DBDMA_NOP | BR_ALWAYS,
1028 virt_to_bus(pb->cap_cmd[fr] + 16));
1029 tab_cmd_dbdma(pb->last_cmd[pb->prev_last_fr],
1030 DBDMA_NOP | BR_ALWAYS,
1031 virt_to_bus(pb->cap_cmd[fr]));
1032 eieio();
1033 }
1034 tab_cmd_dbdma(pb->last_cmd[fr],
1035 DBDMA_NOP | BR_ALWAYS,
1036 virt_to_bus(pb->ch1_cmd));
1037 eieio();
1038 pb->prev_last_fr = fr;
1039 pb->last_fr = -2;
1040 } else {
1041
1042 IDEBUG("PlanB: active grabbing session detected\n");
1043
1044 if(pb->need_pre_capture[fr]) {
1045
1046 IDEBUG("PlanB: padding pre-capture sequence\n");
1047
1048 tab_cmd_dbdma(pb->last_cmd[pb->last_fr],
1049 DBDMA_NOP | BR_ALWAYS,
1050 virt_to_bus(pb->pre_cmd[fr]));
1051 eieio();
1052 } else {
1053 tab_cmd_dbdma(pb->last_cmd[fr], DBDMA_STOP, 0);
1054 tab_cmd_dbdma(pb->cap_cmd[fr], DBDMA_NOP, 0);
1055 if(pb->gwidth[pb->last_fr] != pb->gwidth[fr]
1056 || pb->gheight[pb->last_fr] !=
1057 pb->gheight[fr]
1058 || pb->gfmt[pb->last_fr] !=
1059 pb->gfmt[fr])
1060 tab_cmd_dbdma((pb->cap_cmd[fr] + 1),
1061 DBDMA_NOP, 0);
1062 else
1063 tab_cmd_dbdma((pb->cap_cmd[fr] + 1),
1064 DBDMA_NOP | BR_ALWAYS,
1065 virt_to_bus(pb->cap_cmd[fr] + 16));
1066 tab_cmd_dbdma(pb->last_cmd[pb->last_fr],
1067 DBDMA_NOP | BR_ALWAYS,
1068 virt_to_bus(pb->cap_cmd[fr]));
1069 eieio();
1070 }
1071 pb->last_fr = fr;
1072 }
1073 if(!(ACTIVE & in_le32(&pb->planb_base->ch1.status))) {
1074
1075 IDEBUG("PlanB: became inactive in the mean time..."
1076 "reactivating\n");
1077
1078 planb_dbdma_stop(&pb->planb_base->ch1);
1079 out_le32 (&pb->planb_base->ch1.cmdptr,
1080 virt_to_bus(pb->cap_cmd[fr]));
1081 planb_dbdma_restart(&pb->planb_base->ch1);
1082 }
1083 }
1084 pb->grabbing++;
1085 planb_unlock(pb);
1086
1087 return 0;
1088}
1089
1090static void planb_pre_capture(int fr, int bpp, struct planb *pb)
1091{
1092 volatile struct dbdma_cmd *c1 = pb->pre_cmd[fr];
1093 int interlace = (pb->gheight[fr] > pb->maxlines/2)? 1: 0;
1094
1095 tab_cmd_dbdma(c1++, DBDMA_NOP, 0);
1096 if((c1 = cmd_geo_setup(c1, pb->gwidth[fr], pb->gheight[fr], interlace,
1097 bpp, 0, pb)) == NULL) {
1098 printk(KERN_WARNING "PlanB: encountered some problems\n");
1099 tab_cmd_dbdma(pb->pre_cmd[fr] + 1, DBDMA_STOP, 0);
1100 return;
1101 }
1102 /* Sync to even field */
1103 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.wait_sel),
1104 PLANB_SET(FIELD_SYNC));
1105 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFCLR, 0);
1106 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
1107 PLANB_SET(ODD_FIELD));
1108 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFSET, 0);
1109 tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFSET, virt_to_bus(c1-3)); c1++;
1110 tab_cmd_dbdma(c1++, DBDMA_NOP | INTR_ALWAYS, 0);
1111 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
1112 PLANB_SET(DMA_ABORT));
1113 /* For non-interlaced, we use even fields only */
1114 if (pb->gheight[fr] <= pb->maxlines/2)
1115 goto cmd_tab_data_end;
1116 /* Sync to odd field */
1117 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFCLR, 0);
1118 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
1119 PLANB_SET(ODD_FIELD));
1120 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFSET, 0);
1121 tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++;
1122 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
1123 PLANB_SET(DMA_ABORT));
1124cmd_tab_data_end:
1125 tab_cmd_dbdma(c1, DBDMA_NOP | BR_ALWAYS, virt_to_bus(pb->cap_cmd[fr]));
1126
1127 eieio();
1128}
1129
1130static volatile struct dbdma_cmd *setup_grab_cmd(int fr, struct planb *pb)
1131{
1132 int i, bpp, count, nlines, stepsize, interlace;
1133#ifdef PLANB_GSCANLINE
1134 int scanline;
1135#else
1136 int nlpp, leftover1;
1137 unsigned long base;
1138#endif
1139 unsigned long jump;
1140 int pagei;
1141 volatile struct dbdma_cmd *c1;
1142 volatile struct dbdma_cmd *jump_addr;
1143
1144 c1 = pb->cap_cmd[fr];
1145 interlace = (pb->gheight[fr] > pb->maxlines/2)? 1: 0;
1146 bpp = pb->gfmt[fr]; /* gfmt = bpp */
1147 count = bpp * pb->gwidth[fr];
1148 nlines = pb->gheight[fr];
1149#ifdef PLANB_GSCANLINE
1150 scanline = pb->gbytes_per_line;
1151#else
1152 pb->lsize[fr] = count;
1153 pb->lnum[fr] = 0;
1154#endif
1155
1156 /* Do video in: */
1157
1158 /* Preamble commands: */
1159 tab_cmd_dbdma(c1++, DBDMA_NOP, 0);
1160 tab_cmd_dbdma(c1, DBDMA_NOP | BR_ALWAYS, virt_to_bus(c1 + 16)); c1++;
1161 if((c1 = cmd_geo_setup(c1, pb->gwidth[fr], pb->gheight[fr], interlace,
1162 bpp, 0, pb)) == NULL) {
1163 printk(KERN_WARNING "PlanB: encountered serious problems\n");
1164 tab_cmd_dbdma(pb->cap_cmd[fr] + 1, DBDMA_STOP, 0);
1165 return (pb->cap_cmd[fr] + 2);
1166 }
1167 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.wait_sel),
1168 PLANB_SET(FIELD_SYNC));
1169 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFCLR, 0);
1170 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
1171 PLANB_SET(ODD_FIELD));
1172 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFSET, 0);
1173 tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFSET, virt_to_bus(c1-3)); c1++;
1174 tab_cmd_dbdma(c1++, DBDMA_NOP | INTR_ALWAYS, 0);
1175 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
1176 PLANB_SET(DMA_ABORT));
1177
1178 if (interlace) {
1179 stepsize = 2;
1180 jump_addr = c1 + TAB_FACTOR * (nlines + 1) / 2;
1181 } else {
1182 stepsize = 1;
1183 jump_addr = c1 + TAB_FACTOR * nlines;
1184 }
1185 jump = virt_to_bus(jump_addr);
1186
1187 /* even field data: */
1188
1189 pagei = pb->gbuf_idx[fr];
1190#ifdef PLANB_GSCANLINE
1191 for (i = 0; i < nlines; i += stepsize) {
1192 tab_cmd_gen(c1++, INPUT_MORE | BR_IFSET, count,
1193 virt_to_bus(pb->rawbuf[pagei
1194 + i * scanline / PAGE_SIZE]), jump);
1195 }
1196#else
1197 i = 0;
1198 leftover1 = 0;
1199 do {
1200 int j;
1201
1202 base = virt_to_bus(pb->rawbuf[pagei]);
1203 nlpp = (PAGE_SIZE - leftover1) / count / stepsize;
1204 for(j = 0; j < nlpp && i < nlines; j++, i += stepsize, c1++)
1205 tab_cmd_gen(c1, INPUT_MORE | KEY_STREAM0 | BR_IFSET,
1206 count, base + count * j * stepsize + leftover1, jump);
1207 if(i < nlines) {
1208 int lov0 = PAGE_SIZE - count * nlpp * stepsize - leftover1;
1209
1210 if(lov0 == 0)
1211 leftover1 = 0;
1212 else {
1213 if(lov0 >= count) {
1214 tab_cmd_gen(c1++, INPUT_MORE | BR_IFSET, count, base
1215 + count * nlpp * stepsize + leftover1, jump);
1216 } else {
1217 pb->l_to_addr[fr][pb->lnum[fr]] = pb->rawbuf[pagei]
1218 + count * nlpp * stepsize + leftover1;
1219 pb->l_to_next_idx[fr][pb->lnum[fr]] = pagei + 1;
1220 pb->l_to_next_size[fr][pb->lnum[fr]] = count - lov0;
1221 tab_cmd_gen(c1++, INPUT_MORE | BR_IFSET, count,
1222 virt_to_bus(pb->rawbuf[pb->l_fr_addr_idx[fr]
1223 + pb->lnum[fr]]), jump);
1224 if(++pb->lnum[fr] > MAX_LNUM)
1225 pb->lnum[fr]--;
1226 }
1227 leftover1 = count * stepsize - lov0;
1228 i += stepsize;
1229 }
1230 }
1231 pagei++;
1232 } while(i < nlines);
1233 tab_cmd_dbdma(c1, DBDMA_NOP | BR_ALWAYS, jump);
1234 c1 = jump_addr;
1235#endif /* PLANB_GSCANLINE */
1236
1237 /* For non-interlaced, we use even fields only */
1238 if (!interlace)
1239 goto cmd_tab_data_end;
1240
1241 /* Sync to odd field */
1242 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFCLR, 0);
1243 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
1244 PLANB_SET(ODD_FIELD));
1245 tab_cmd_dbdma(c1++, DBDMA_NOP | WAIT_IFSET, 0);
1246 tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++;
1247 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel),
1248 PLANB_SET(DMA_ABORT));
1249
1250 /* odd field data: */
1251 jump_addr = c1 + TAB_FACTOR * nlines / 2;
1252 jump = virt_to_bus(jump_addr);
1253#ifdef PLANB_GSCANLINE
1254 for (i = 1; i < nlines; i += stepsize) {
1255 tab_cmd_gen(c1++, INPUT_MORE | BR_IFSET, count,
1256 virt_to_bus(pb->rawbuf[pagei
1257 + i * scanline / PAGE_SIZE]), jump);
1258 }
1259#else
1260 i = 1;
1261 leftover1 = 0;
1262 pagei = pb->gbuf_idx[fr];
1263 if(nlines <= 1)
1264 goto skip;
1265 do {
1266 int j;
1267
1268 base = virt_to_bus(pb->rawbuf[pagei]);
1269 nlpp = (PAGE_SIZE - leftover1) / count / stepsize;
1270 if(leftover1 >= count) {
1271 tab_cmd_gen(c1++, INPUT_MORE | KEY_STREAM0 | BR_IFSET, count,
1272 base + leftover1 - count, jump);
1273 i += stepsize;
1274 }
1275 for(j = 0; j < nlpp && i < nlines; j++, i += stepsize, c1++)
1276 tab_cmd_gen(c1, INPUT_MORE | KEY_STREAM0 | BR_IFSET, count,
1277 base + count * (j * stepsize + 1) + leftover1, jump);
1278 if(i < nlines) {
1279 int lov0 = PAGE_SIZE - count * nlpp * stepsize - leftover1;
1280
1281 if(lov0 == 0)
1282 leftover1 = 0;
1283 else {
1284 if(lov0 > count) {
1285 pb->l_to_addr[fr][pb->lnum[fr]] = pb->rawbuf[pagei]
1286 + count * (nlpp * stepsize + 1) + leftover1;
1287 pb->l_to_next_idx[fr][pb->lnum[fr]] = pagei + 1;
1288 pb->l_to_next_size[fr][pb->lnum[fr]] = count * stepsize
1289 - lov0;
1290 tab_cmd_gen(c1++, INPUT_MORE | BR_IFSET, count,
1291 virt_to_bus(pb->rawbuf[pb->l_fr_addr_idx[fr]
1292 + pb->lnum[fr]]), jump);
1293 if(++pb->lnum[fr] > MAX_LNUM)
1294 pb->lnum[fr]--;
1295 i += stepsize;
1296 }
1297 leftover1 = count * stepsize - lov0;
1298 }
1299 }
1300 pagei++;
1301 } while(i < nlines);
1302skip:
1303 tab_cmd_dbdma(c1, DBDMA_NOP | BR_ALWAYS, jump);
1304 c1 = jump_addr;
1305#endif /* PLANB_GSCANLINE */
1306
1307cmd_tab_data_end:
1308 tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->intr_stat),
1309 (fr << 9) | PLANB_FRM_IRQ | PLANB_GEN_IRQ);
1310 /* stop it */
1311 tab_cmd_dbdma(c1, DBDMA_STOP, 0);
1312
1313 eieio();
1314 return c1;
1315}
1316
1317static irqreturn_t planb_irq(int irq, void *dev_id)
1318{
1319 unsigned int stat, astat;
1320 struct planb *pb = (struct planb *)dev_id;
1321
1322 IDEBUG("PlanB: planb_irq()\n");
1323
1324 /* get/clear interrupt status bits */
1325 eieio();
1326 stat = in_le32(&pb->planb_base->intr_stat);
1327 astat = stat & pb->intr_mask;
1328 out_le32(&pb->planb_base->intr_stat, PLANB_FRM_IRQ
1329 & ~astat & stat & ~PLANB_GEN_IRQ);
1330 IDEBUG("PlanB: stat = %X, astat = %X\n", stat, astat);
1331
1332 if(astat & PLANB_FRM_IRQ) {
1333 unsigned int fr = stat >> 9;
1334#ifndef PLANB_GSCANLINE
1335 int i;
1336#endif
1337 IDEBUG("PlanB: PLANB_FRM_IRQ\n");
1338
1339 pb->gcount++;
1340
1341 IDEBUG("PlanB: grab %d: fr = %d, gcount = %d\n",
1342 pb->grabbing, fr, pb->gcount);
1343#ifndef PLANB_GSCANLINE
1344 IDEBUG("PlanB: %d * %d bytes are being copied over\n",
1345 pb->lnum[fr], pb->lsize[fr]);
1346 for(i = 0; i < pb->lnum[fr]; i++) {
1347 int first = pb->lsize[fr] - pb->l_to_next_size[fr][i];
1348
1349 memcpy(pb->l_to_addr[fr][i],
1350 pb->rawbuf[pb->l_fr_addr_idx[fr] + i],
1351 first);
1352 memcpy(pb->rawbuf[pb->l_to_next_idx[fr][i]],
1353 pb->rawbuf[pb->l_fr_addr_idx[fr] + i] + first,
1354 pb->l_to_next_size[fr][i]);
1355 }
1356#endif
1357 pb->frame_stat[fr] = GBUFFER_DONE;
1358 pb->grabbing--;
1359 wake_up_interruptible(&pb->capq);
1360 return IRQ_HANDLED;
1361 }
1362 /* incorrect interrupts? */
1363 pb->intr_mask = PLANB_CLR_IRQ;
1364 out_le32(&pb->planb_base->intr_stat, PLANB_CLR_IRQ);
1365 printk(KERN_ERR "PlanB: IRQ lockup, cleared intrrupts"
1366 " unconditionally\n");
1367 return IRQ_HANDLED;
1368}
1369
1370/*******************************
1371 * Device Operations functions *
1372 *******************************/
1373
1374static int planb_open(struct video_device *dev, int mode)
1375{
1376 struct planb *pb = (struct planb *)dev;
1377
1378 if (pb->user == 0) {
1379 int err;
1380 if((err = planb_prepare_open(pb)) != 0)
1381 return err;
1382 }
1383 pb->user++;
1384
1385 DEBUG("PlanB: device opened\n");
1386 return 0;
1387}
1388
1389static void planb_close(struct video_device *dev)
1390{
1391 struct planb *pb = (struct planb *)dev;
1392
1393 if(pb->user < 1) /* ??? */
1394 return;
1395 planb_lock(pb);
1396 if (pb->user == 1) {
1397 if (pb->overlay) {
1398 planb_dbdma_stop(&pb->planb_base->ch2);
1399 planb_dbdma_stop(&pb->planb_base->ch1);
1400 pb->overlay = 0;
1401 }
1402 planb_prepare_close(pb);
1403 }
1404 pb->user--;
1405 planb_unlock(pb);
1406
1407 DEBUG("PlanB: device closed\n");
1408}
1409
1410static long planb_read(struct video_device *v, char *buf, unsigned long count,
1411 int nonblock)
1412{
1413 DEBUG("planb: read request\n");
1414 return -EINVAL;
1415}
1416
1417static long planb_write(struct video_device *v, const char *buf,
1418 unsigned long count, int nonblock)
1419{
1420 DEBUG("planb: write request\n");
1421 return -EINVAL;
1422}
1423
1424static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
1425{
1426 struct planb *pb=(struct planb *)dev;
1427
1428 switch (cmd)
1429 {
1430 case VIDIOCGCAP:
1431 {
1432 struct video_capability b;
1433
1434 DEBUG("PlanB: IOCTL VIDIOCGCAP\n");
1435
1436 strcpy (b.name, pb->video_dev.name);
1437 b.type = VID_TYPE_OVERLAY | VID_TYPE_CLIPPING |
1438 VID_TYPE_FRAMERAM | VID_TYPE_SCALES |
1439 VID_TYPE_CAPTURE;
1440 b.channels = 2; /* composite & svhs */
1441 b.audios = 0;
1442 b.maxwidth = PLANB_MAXPIXELS;
1443 b.maxheight = PLANB_MAXLINES;
1444 b.minwidth = 32; /* wild guess */
1445 b.minheight = 32;
1446 if (copy_to_user(arg,&b,sizeof(b)))
1447 return -EFAULT;
1448 return 0;
1449 }
1450 case VIDIOCSFBUF:
1451 {
1452 struct video_buffer v;
1453 unsigned short bpp;
1454 unsigned int fmt;
1455
1456 DEBUG("PlanB: IOCTL VIDIOCSFBUF\n");
1457
1458 if (!capable(CAP_SYS_ADMIN)
1459 || !capable(CAP_SYS_RAWIO))
1460 return -EPERM;
1461 if (copy_from_user(&v, arg,sizeof(v)))
1462 return -EFAULT;
1463 planb_lock(pb);
1464 switch(v.depth) {
1465 case 8:
1466 bpp = 1;
1467 fmt = PLANB_GRAY;
1468 break;
1469 case 15:
1470 case 16:
1471 bpp = 2;
1472 fmt = PLANB_COLOUR15;
1473 break;
1474 case 24:
1475 case 32:
1476 bpp = 4;
1477 fmt = PLANB_COLOUR32;
1478 break;
1479 default:
1480 planb_unlock(pb);
1481 return -EINVAL;
1482 }
1483 if (bpp * v.width > v.bytesperline) {
1484 planb_unlock(pb);
1485 return -EINVAL;
1486 }
1487 pb->win.bpp = bpp;
1488 pb->win.color_fmt = fmt;
1489 pb->frame_buffer_phys = (unsigned long) v.base;
1490 pb->win.sheight = v.height;
1491 pb->win.swidth = v.width;
1492 pb->picture.depth = pb->win.depth = v.depth;
1493 pb->win.bpl = pb->win.bpp * pb->win.swidth;
1494 pb->win.pad = v.bytesperline - pb->win.bpl;
1495
1496 DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d,"
1497 " bpl %d (+ %d)\n", v.base, v.width,v.height,
1498 pb->win.bpp, pb->win.bpl, pb->win.pad);
1499
1500 pb->cmd_buff_inited = 0;
1501 if(pb->overlay) {
1502 suspend_overlay(pb);
1503 fill_cmd_buff(pb);
1504 resume_overlay(pb);
1505 }
1506 planb_unlock(pb);
1507 return 0;
1508 }
1509 case VIDIOCGFBUF:
1510 {
1511 struct video_buffer v;
1512
1513 DEBUG("PlanB: IOCTL VIDIOCGFBUF\n");
1514
1515 v.base = (void *)pb->frame_buffer_phys;
1516 v.height = pb->win.sheight;
1517 v.width = pb->win.swidth;
1518 v.depth = pb->win.depth;
1519 v.bytesperline = pb->win.bpl + pb->win.pad;
1520 if (copy_to_user(arg, &v, sizeof(v)))
1521 return -EFAULT;
1522 return 0;
1523 }
1524 case VIDIOCCAPTURE:
1525 {
1526 int i;
1527
1528 if(copy_from_user(&i, arg, sizeof(i)))
1529 return -EFAULT;
1530 if(i==0) {
1531 DEBUG("PlanB: IOCTL VIDIOCCAPTURE Stop\n");
1532
1533 if (!(pb->overlay))
1534 return 0;
1535 planb_lock(pb);
1536 pb->overlay = 0;
1537 overlay_stop(pb);
1538 planb_unlock(pb);
1539 } else {
1540 DEBUG("PlanB: IOCTL VIDIOCCAPTURE Start\n");
1541
1542 if (pb->frame_buffer_phys == 0 ||
1543 pb->win.width == 0 ||
1544 pb->win.height == 0)
1545 return -EINVAL;
1546 if (pb->overlay)
1547 return 0;
1548 planb_lock(pb);
1549 pb->overlay = 1;
1550 if(!(pb->cmd_buff_inited))
1551 fill_cmd_buff(pb);
1552 overlay_start(pb);
1553 planb_unlock(pb);
1554 }
1555 return 0;
1556 }
1557 case VIDIOCGCHAN:
1558 {
1559 struct video_channel v;
1560
1561 DEBUG("PlanB: IOCTL VIDIOCGCHAN\n");
1562
1563 if(copy_from_user(&v, arg,sizeof(v)))
1564 return -EFAULT;
1565 v.flags = 0;
1566 v.tuners = 0;
1567 v.type = VIDEO_TYPE_CAMERA;
1568 v.norm = pb->win.norm;
1569 switch(v.channel)
1570 {
1571 case 0:
1572 strcpy(v.name,"Composite");
1573 break;
1574 case 1:
1575 strcpy(v.name,"SVHS");
1576 break;
1577 default:
1578 return -EINVAL;
1579 break;
1580 }
1581 if(copy_to_user(arg,&v,sizeof(v)))
1582 return -EFAULT;
1583
1584 return 0;
1585 }
1586 case VIDIOCSCHAN:
1587 {
1588 struct video_channel v;
1589
1590 DEBUG("PlanB: IOCTL VIDIOCSCHAN\n");
1591
1592 if(copy_from_user(&v, arg, sizeof(v)))
1593 return -EFAULT;
1594
1595 if (v.norm != pb->win.norm) {
1596 int i, maxlines;
1597
1598 switch (v.norm)
1599 {
1600 case VIDEO_MODE_PAL:
1601 case VIDEO_MODE_SECAM:
1602 maxlines = PLANB_MAXLINES;
1603 break;
1604 case VIDEO_MODE_NTSC:
1605 maxlines = PLANB_NTSC_MAXLINES;
1606 break;
1607 default:
1608 return -EINVAL;
1609 break;
1610 }
1611 planb_lock(pb);
1612 /* empty the grabbing queue */
1613 wait_event(pb->capq, !pb->grabbing);
1614 pb->maxlines = maxlines;
1615 pb->win.norm = v.norm;
1616 /* Stop overlay if running */
1617 suspend_overlay(pb);
1618 for(i = 0; i < MAX_GBUFFERS; i++)
1619 pb->gnorm_switch[i] = 1;
1620 /* I know it's an overkill, but.... */
1621 fill_cmd_buff(pb);
1622 /* ok, now init it accordingly */
1623 saa_init_regs (pb);
1624 /* restart overlay if it was running */
1625 resume_overlay(pb);
1626 planb_unlock(pb);
1627 }
1628
1629 switch(v.channel)
1630 {
1631 case 0: /* Composite */
1632 saa_set (SAA7196_IOCC,
1633 ((saa_regs[pb->win.norm][SAA7196_IOCC] &
1634 ~7) | 3), pb);
1635 break;
1636 case 1: /* SVHS */
1637 saa_set (SAA7196_IOCC,
1638 ((saa_regs[pb->win.norm][SAA7196_IOCC] &
1639 ~7) | 4), pb);
1640 break;
1641 default:
1642 return -EINVAL;
1643 break;
1644 }
1645
1646 return 0;
1647 }
1648 case VIDIOCGPICT:
1649 {
1650 struct video_picture vp = pb->picture;
1651
1652 DEBUG("PlanB: IOCTL VIDIOCGPICT\n");
1653
1654 switch(pb->win.color_fmt) {
1655 case PLANB_GRAY:
1656 vp.palette = VIDEO_PALETTE_GREY;
1657 case PLANB_COLOUR15:
1658 vp.palette = VIDEO_PALETTE_RGB555;
1659 break;
1660 case PLANB_COLOUR32:
1661 vp.palette = VIDEO_PALETTE_RGB32;
1662 break;
1663 default:
1664 vp.palette = 0;
1665 break;
1666 }
1667
1668 if(copy_to_user(arg,&vp,sizeof(vp)))
1669 return -EFAULT;
1670 return 0;
1671 }
1672 case VIDIOCSPICT:
1673 {
1674 struct video_picture vp;
1675
1676 DEBUG("PlanB: IOCTL VIDIOCSPICT\n");
1677
1678 if(copy_from_user(&vp,arg,sizeof(vp)))
1679 return -EFAULT;
1680 pb->picture = vp;
1681 /* Should we do sanity checks here? */
1682 saa_set (SAA7196_BRIG, (unsigned char)
1683 ((pb->picture.brightness) >> 8), pb);
1684 saa_set (SAA7196_HUEC, (unsigned char)
1685 ((pb->picture.hue) >> 8) ^ 0x80, pb);
1686 saa_set (SAA7196_CSAT, (unsigned char)
1687 ((pb->picture.colour) >> 9), pb);
1688 saa_set (SAA7196_CONT, (unsigned char)
1689 ((pb->picture.contrast) >> 9), pb);
1690
1691 return 0;
1692 }
1693 case VIDIOCSWIN:
1694 {
1695 struct video_window vw;
1696 struct video_clip clip;
1697 int i;
1698
1699 DEBUG("PlanB: IOCTL VIDIOCSWIN\n");
1700
1701 if(copy_from_user(&vw,arg,sizeof(vw)))
1702 return -EFAULT;
1703
1704 planb_lock(pb);
1705 /* Stop overlay if running */
1706 suspend_overlay(pb);
1707 pb->win.interlace = (vw.height > pb->maxlines/2)? 1: 0;
1708 if (pb->win.x != vw.x ||
1709 pb->win.y != vw.y ||
1710 pb->win.width != vw.width ||
1711 pb->win.height != vw.height ||
1712 !pb->cmd_buff_inited) {
1713 pb->win.x = vw.x;
1714 pb->win.y = vw.y;
1715 pb->win.width = vw.width;
1716 pb->win.height = vw.height;
1717 fill_cmd_buff(pb);
1718 }
1719 /* Reset clip mask */
1720 memset ((void *) pb->mask, 0xff, (pb->maxlines
1721 * ((PLANB_MAXPIXELS + 7) & ~7)) / 8);
1722 /* Add any clip rects */
1723 for (i = 0; i < vw.clipcount; i++) {
1724 if (copy_from_user(&clip, vw.clips + i,
1725 sizeof(struct video_clip)))
1726 return -EFAULT;
1727 add_clip(pb, &clip);
1728 }
1729 /* restart overlay if it was running */
1730 resume_overlay(pb);
1731 planb_unlock(pb);
1732 return 0;
1733 }
1734 case VIDIOCGWIN:
1735 {
1736 struct video_window vw;
1737
1738 DEBUG("PlanB: IOCTL VIDIOCGWIN\n");
1739
1740 vw.x=pb->win.x;
1741 vw.y=pb->win.y;
1742 vw.width=pb->win.width;
1743 vw.height=pb->win.height;
1744 vw.chromakey=0;
1745 vw.flags=0;
1746 if(pb->win.interlace)
1747 vw.flags|=VIDEO_WINDOW_INTERLACE;
1748 if(copy_to_user(arg,&vw,sizeof(vw)))
1749 return -EFAULT;
1750 return 0;
1751 }
1752 case VIDIOCSYNC: {
1753 int i;
1754
1755 IDEBUG("PlanB: IOCTL VIDIOCSYNC\n");
1756
1757 if(copy_from_user((void *)&i,arg,sizeof(int)))
1758 return -EFAULT;
1759
1760 IDEBUG("PlanB: sync to frame %d\n", i);
1761
1762 if(i > (MAX_GBUFFERS - 1) || i < 0)
1763 return -EINVAL;
1764chk_grab:
1765 switch (pb->frame_stat[i]) {
1766 case GBUFFER_UNUSED:
1767 return -EINVAL;
1768 case GBUFFER_GRABBING:
1769 IDEBUG("PlanB: waiting for grab"
1770 " done (%d)\n", i);
1771 interruptible_sleep_on(&pb->capq);
1772 if(signal_pending(current))
1773 return -EINTR;
1774 goto chk_grab;
1775 case GBUFFER_DONE:
1776 pb->frame_stat[i] = GBUFFER_UNUSED;
1777 break;
1778 }
1779 return 0;
1780 }
1781
1782 case VIDIOCMCAPTURE:
1783 {
1784 struct video_mmap vm;
1785 volatile unsigned int status;
1786
1787 IDEBUG("PlanB: IOCTL VIDIOCMCAPTURE\n");
1788
1789 if(copy_from_user((void *) &vm,(void *)arg,sizeof(vm)))
1790 return -EFAULT;
1791 status = pb->frame_stat[vm.frame];
1792 if (status != GBUFFER_UNUSED)
1793 return -EBUSY;
1794
1795 return vgrab(pb, &vm);
1796 }
1797
1798 case VIDIOCGMBUF:
1799 {
1800 int i;
1801 struct video_mbuf vm;
1802
1803 DEBUG("PlanB: IOCTL VIDIOCGMBUF\n");
1804
1805 memset(&vm, 0 , sizeof(vm));
1806 vm.size = PLANB_MAX_FBUF * MAX_GBUFFERS;
1807 vm.frames = MAX_GBUFFERS;
1808 for(i = 0; i<MAX_GBUFFERS; i++)
1809 vm.offsets[i] = PLANB_MAX_FBUF * i;
1810 if(copy_to_user((void *)arg, (void *)&vm, sizeof(vm)))
1811 return -EFAULT;
1812 return 0;
1813 }
1814
1815 case PLANBIOCGSAAREGS:
1816 {
1817 struct planb_saa_regs preg;
1818
1819 DEBUG("PlanB: IOCTL PLANBIOCGSAAREGS\n");
1820
1821 if(copy_from_user(&preg, arg, sizeof(preg)))
1822 return -EFAULT;
1823 if(preg.addr >= SAA7196_NUMREGS)
1824 return -EINVAL;
1825 preg.val = saa_regs[pb->win.norm][preg.addr];
1826 if(copy_to_user((void *)arg, (void *)&preg,
1827 sizeof(preg)))
1828 return -EFAULT;
1829 return 0;
1830 }
1831
1832 case PLANBIOCSSAAREGS:
1833 {
1834 struct planb_saa_regs preg;
1835
1836 DEBUG("PlanB: IOCTL PLANBIOCSSAAREGS\n");
1837
1838 if(copy_from_user(&preg, arg, sizeof(preg)))
1839 return -EFAULT;
1840 if(preg.addr >= SAA7196_NUMREGS)
1841 return -EINVAL;
1842 saa_set (preg.addr, preg.val, pb);
1843 return 0;
1844 }
1845
1846 case PLANBIOCGSTAT:
1847 {
1848 struct planb_stat_regs pstat;
1849
1850 DEBUG("PlanB: IOCTL PLANBIOCGSTAT\n");
1851
1852 pstat.ch1_stat = in_le32(&pb->planb_base->ch1.status);
1853 pstat.ch2_stat = in_le32(&pb->planb_base->ch2.status);
1854 pstat.saa_stat0 = saa_status(0, pb);
1855 pstat.saa_stat1 = saa_status(1, pb);
1856
1857 if(copy_to_user((void *)arg, (void *)&pstat,
1858 sizeof(pstat)))
1859 return -EFAULT;
1860 return 0;
1861 }
1862
1863 case PLANBIOCSMODE: {
1864 int v;
1865
1866 DEBUG("PlanB: IOCTL PLANBIOCSMODE\n");
1867
1868 if(copy_from_user(&v, arg, sizeof(v)))
1869 return -EFAULT;
1870
1871 switch(v)
1872 {
1873 case PLANB_TV_MODE:
1874 saa_set (SAA7196_STDC,
1875 (saa_regs[pb->win.norm][SAA7196_STDC] &
1876 0x7f), pb);
1877 break;
1878 case PLANB_VTR_MODE:
1879 saa_set (SAA7196_STDC,
1880 (saa_regs[pb->win.norm][SAA7196_STDC] |
1881 0x80), pb);
1882 break;
1883 default:
1884 return -EINVAL;
1885 break;
1886 }
1887 pb->win.mode = v;
1888 return 0;
1889 }
1890 case PLANBIOCGMODE: {
1891 int v=pb->win.mode;
1892
1893 DEBUG("PlanB: IOCTL PLANBIOCGMODE\n");
1894
1895 if(copy_to_user(arg,&v,sizeof(v)))
1896 return -EFAULT;
1897 return 0;
1898 }
1899#ifdef PLANB_GSCANLINE
1900 case PLANBG_GRAB_BPL: {
1901 int v=pb->gbytes_per_line;
1902
1903 DEBUG("PlanB: IOCTL PLANBG_GRAB_BPL\n");
1904
1905 if(copy_to_user(arg,&v,sizeof(v)))
1906 return -EFAULT;
1907 return 0;
1908 }
1909#endif /* PLANB_GSCANLINE */
1910 case PLANB_INTR_DEBUG: {
1911 int i;
1912
1913 DEBUG("PlanB: IOCTL PLANB_INTR_DEBUG\n");
1914
1915 if(copy_from_user(&i, arg, sizeof(i)))
1916 return -EFAULT;
1917
1918 /* avoid hang ups all together */
1919 for (i = 0; i < MAX_GBUFFERS; i++) {
1920 if(pb->frame_stat[i] == GBUFFER_GRABBING) {
1921 pb->frame_stat[i] = GBUFFER_DONE;
1922 }
1923 }
1924 if(pb->grabbing)
1925 pb->grabbing--;
1926 wake_up_interruptible(&pb->capq);
1927 return 0;
1928 }
1929 case PLANB_INV_REGS: {
1930 int i;
1931 struct planb_any_regs any;
1932
1933 DEBUG("PlanB: IOCTL PLANB_INV_REGS\n");
1934
1935 if(copy_from_user(&any, arg, sizeof(any)))
1936 return -EFAULT;
1937 if(any.offset < 0 || any.offset + any.bytes > 0x400)
1938 return -EINVAL;
1939 if(any.bytes > 128)
1940 return -EINVAL;
1941 for (i = 0; i < any.bytes; i++) {
1942 any.data[i] =
1943 in_8((unsigned char *)pb->planb_base
1944 + any.offset + i);
1945 }
1946 if(copy_to_user(arg,&any,sizeof(any)))
1947 return -EFAULT;
1948 return 0;
1949 }
1950 default:
1951 {
1952 DEBUG("PlanB: Unimplemented IOCTL\n");
1953 return -ENOIOCTLCMD;
1954 }
1955 /* Some IOCTLs are currently unsupported on PlanB */
1956 case VIDIOCGTUNER: {
1957 DEBUG("PlanB: IOCTL VIDIOCGTUNER\n");
1958 goto unimplemented; }
1959 case VIDIOCSTUNER: {
1960 DEBUG("PlanB: IOCTL VIDIOCSTUNER\n");
1961 goto unimplemented; }
1962 case VIDIOCSFREQ: {
1963 DEBUG("PlanB: IOCTL VIDIOCSFREQ\n");
1964 goto unimplemented; }
1965 case VIDIOCGFREQ: {
1966 DEBUG("PlanB: IOCTL VIDIOCGFREQ\n");
1967 goto unimplemented; }
1968 case VIDIOCKEY: {
1969 DEBUG("PlanB: IOCTL VIDIOCKEY\n");
1970 goto unimplemented; }
1971 case VIDIOCSAUDIO: {
1972 DEBUG("PlanB: IOCTL VIDIOCSAUDIO\n");
1973 goto unimplemented; }
1974 case VIDIOCGAUDIO: {
1975 DEBUG("PlanB: IOCTL VIDIOCGAUDIO\n");
1976 goto unimplemented; }
1977unimplemented:
1978 DEBUG(" Unimplemented\n");
1979 return -ENOIOCTLCMD;
1980 }
1981 return 0;
1982}
1983
1984static int planb_mmap(struct vm_area_struct *vma, struct video_device *dev, const char *adr, unsigned long size)
1985{
1986 int i;
1987 struct planb *pb = (struct planb *)dev;
1988 unsigned long start = (unsigned long)adr;
1989
1990 if (size > MAX_GBUFFERS * PLANB_MAX_FBUF)
1991 return -EINVAL;
1992 if (!pb->rawbuf) {
1993 int err;
1994 if((err=grabbuf_alloc(pb)))
1995 return err;
1996 }
1997 for (i = 0; i < pb->rawbuf_size; i++) {
1998 unsigned long pfn;
1999
2000 pfn = virt_to_phys((void *)pb->rawbuf[i]) >> PAGE_SHIFT;
2001 if (remap_pfn_range(vma, start, pfn, PAGE_SIZE, PAGE_SHARED))
2002 return -EAGAIN;
2003 start += PAGE_SIZE;
2004 if (size <= PAGE_SIZE)
2005 break;
2006 size -= PAGE_SIZE;
2007 }
2008 return 0;
2009}
2010
2011static struct video_device planb_template=
2012{
2013 .owner = THIS_MODULE,
2014 .name = PLANB_DEVICE_NAME,
2015 .type = VID_TYPE_OVERLAY,
2016 .open = planb_open,
2017 .close = planb_close,
2018 .read = planb_read,
2019 .write = planb_write,
2020 .ioctl = planb_ioctl,
2021 .mmap = planb_mmap, /* mmap? */
2022};
2023
2024static int init_planb(struct planb *pb)
2025{
2026 unsigned char saa_rev;
2027 int i, result;
2028
2029 memset ((void *) &pb->win, 0, sizeof (struct planb_window));
2030 /* Simple sanity check */
2031 if(def_norm >= NUM_SUPPORTED_NORM || def_norm < 0) {
2032 printk(KERN_ERR "PlanB: Option(s) invalid\n");
2033 return -2;
2034 }
2035 pb->win.norm = def_norm;
2036 pb->win.mode = PLANB_TV_MODE; /* TV mode */
2037 pb->win.interlace=1;
2038 pb->win.x=0;
2039 pb->win.y=0;
2040 pb->win.width=768; /* 640 */
2041 pb->win.height=576; /* 480 */
2042 pb->maxlines=576;
2043#if 0
2044 btv->win.cropwidth=768; /* 640 */
2045 btv->win.cropheight=576; /* 480 */
2046 btv->win.cropx=0;
2047 btv->win.cropy=0;
2048#endif
2049 pb->win.pad=0;
2050 pb->win.bpp=4;
2051 pb->win.depth=32;
2052 pb->win.color_fmt=PLANB_COLOUR32;
2053 pb->win.bpl=1024*pb->win.bpp;
2054 pb->win.swidth=1024;
2055 pb->win.sheight=768;
2056#ifdef PLANB_GSCANLINE
2057 if((pb->gbytes_per_line = PLANB_MAXPIXELS * 4) > PAGE_SIZE
2058 || (pb->gbytes_per_line <= 0))
2059 return -3;
2060 else {
2061 /* page align pb->gbytes_per_line for DMA purpose */
2062 for(i = PAGE_SIZE; pb->gbytes_per_line < (i>>1);)
2063 i>>=1;
2064 pb->gbytes_per_line = i;
2065 }
2066#endif
2067 pb->tab_size = PLANB_MAXLINES + 40;
2068 pb->suspend = 0;
2069 mutex_init(&pb->lock);
2070 pb->ch1_cmd = 0;
2071 pb->ch2_cmd = 0;
2072 pb->mask = 0;
2073 pb->priv_space = 0;
2074 pb->offset = 0;
2075 pb->user = 0;
2076 pb->overlay = 0;
2077 init_waitqueue_head(&pb->suspendq);
2078 pb->cmd_buff_inited = 0;
2079 pb->frame_buffer_phys = 0;
2080
2081 /* Reset DMA controllers */
2082 planb_dbdma_stop(&pb->planb_base->ch2);
2083 planb_dbdma_stop(&pb->planb_base->ch1);
2084
2085 saa_rev = (saa_status(0, pb) & 0xf0) >> 4;
2086 printk(KERN_INFO "PlanB: SAA7196 video processor rev. %d\n", saa_rev);
2087 /* Initialize the SAA registers in memory and on chip */
2088 saa_init_regs (pb);
2089
2090 /* clear interrupt mask */
2091 pb->intr_mask = PLANB_CLR_IRQ;
2092
2093 result = request_irq(pb->irq, planb_irq, 0, "PlanB", pb);
2094 if (result < 0) {
2095 if (result==-EINVAL)
2096 printk(KERN_ERR "PlanB: Bad irq number (%d) "
2097 "or handler\n", (int)pb->irq);
2098 else if (result==-EBUSY)
2099 printk(KERN_ERR "PlanB: I don't know why, "
2100 "but IRQ %d is busy\n", (int)pb->irq);
2101 return result;
2102 }
2103 disable_irq(pb->irq);
2104
2105 /* Now add the template and register the device unit. */
2106 memcpy(&pb->video_dev,&planb_template,sizeof(planb_template));
2107
2108 pb->picture.brightness=0x90<<8;
2109 pb->picture.contrast = 0x70 << 8;
2110 pb->picture.colour = 0x70<<8;
2111 pb->picture.hue = 0x8000;
2112 pb->picture.whiteness = 0;
2113 pb->picture.depth = pb->win.depth;
2114
2115 pb->frame_stat=NULL;
2116 init_waitqueue_head(&pb->capq);
2117 for(i=0; i<MAX_GBUFFERS; i++) {
2118 pb->gbuf_idx[i] = PLANB_MAX_FBUF * i / PAGE_SIZE;
2119 pb->gwidth[i]=0;
2120 pb->gheight[i]=0;
2121 pb->gfmt[i]=0;
2122 pb->cap_cmd[i]=NULL;
2123#ifndef PLANB_GSCANLINE
2124 pb->l_fr_addr_idx[i] = MAX_GBUFFERS * (PLANB_MAX_FBUF
2125 / PAGE_SIZE + 1) + MAX_LNUM * i;
2126 pb->lsize[i] = 0;
2127 pb->lnum[i] = 0;
2128#endif
2129 }
2130 pb->rawbuf=NULL;
2131 pb->grabbing=0;
2132
2133 /* enable interrupts */
2134 out_le32(&pb->planb_base->intr_stat, PLANB_CLR_IRQ);
2135 pb->intr_mask = PLANB_FRM_IRQ;
2136 enable_irq(pb->irq);
2137
2138 if(video_register_device(&pb->video_dev, VFL_TYPE_GRABBER, video_nr)<0)
2139 return -1;
2140
2141 return 0;
2142}
2143
2144/*
2145 * Scan for a PlanB controller, request the irq and map the io memory
2146 */
2147
2148static int find_planb(void)
2149{
2150 struct planb *pb;
2151 struct device_node *planb_devices;
2152 unsigned char dev_fn, confreg, bus;
2153 unsigned int old_base, new_base;
2154 unsigned int irq;
2155 struct pci_dev *pdev;
2156 int rc;
2157
2158 if (!machine_is(powermac))
2159 return 0;
2160
2161 planb_devices = of_find_node_by_name(NULL, "planb");
2162 if (planb_devices == 0) {
2163 planb_num=0;
2164 printk(KERN_WARNING "PlanB: no device found!\n");
2165 return planb_num;
2166 }
2167
2168 if (planb_devices->next != NULL)
2169 printk(KERN_ERR "Warning: only using first PlanB device!\n");
2170 pb = &planbs[0];
2171 planb_num = 1;
2172
2173 if (planb_devices->n_addrs != 1) {
2174 printk (KERN_WARNING "PlanB: expecting 1 address for planb "
2175 "(got %d)", planb_devices->n_addrs);
2176 of_node_put(planb_devices);
2177 return 0;
2178 }
2179
2180 if (planb_devices->n_intrs == 0) {
2181 printk(KERN_WARNING "PlanB: no intrs for device %s\n",
2182 planb_devices->full_name);
2183 of_node_put(planb_devices);
2184 return 0;
2185 } else {
2186 irq = planb_devices->intrs[0].line;
2187 }
2188
2189 /* Initialize PlanB's PCI registers */
2190
2191 /* There is a bug with the way OF assigns addresses
2192 to the devices behind the chaos bridge.
2193 control needs only 0x1000 of space, but decodes only
2194 the upper 16 bits. It therefore occupies a full 64K.
2195 OF assigns the planb controller memory within this space;
2196 so we need to change that here in order to access planb. */
2197
2198 /* We remap to 0xf1000000 in hope that nobody uses it ! */
2199
2200 bus = (planb_devices->addrs[0].space >> 16) & 0xff;
2201 dev_fn = (planb_devices->addrs[0].space >> 8) & 0xff;
2202 confreg = planb_devices->addrs[0].space & 0xff;
2203 old_base = planb_devices->addrs[0].address;
2204 new_base = 0xf1000000;
2205 of_node_put(planb_devices);
2206
2207 DEBUG("PlanB: Found on bus %d, dev %d, func %d, "
2208 "membase 0x%x (base reg. 0x%x)\n",
2209 bus, PCI_SLOT(dev_fn), PCI_FUNC(dev_fn), old_base, confreg);
2210
2211 pdev = pci_get_bus_and_slot(bus, dev_fn);
2212 if (!pdev) {
2213 printk(KERN_ERR "planb: cannot find slot\n");
2214 goto err_out;
2215 }
2216
2217 /* Enable response in memory space, bus mastering,
2218 use memory write and invalidate */
2219 rc = pci_enable_device(pdev);
2220 if (rc) {
2221 printk(KERN_ERR "planb: cannot enable PCI device %s\n",
2222 pci_name(pdev));
2223 goto err_out;
2224 }
2225 rc = pci_set_mwi(pdev);
2226 if (rc) {
2227 printk(KERN_ERR "planb: cannot enable MWI on PCI device %s\n",
2228 pci_name(pdev));
2229 goto err_out_disable;
2230 }
2231 pci_set_master(pdev);
2232
2233 /* Set the new base address */
2234 pci_write_config_dword (pdev, confreg, new_base);
2235
2236 planb_regs = (volatile struct planb_registers *)
2237 ioremap (new_base, 0x400);
2238 pb->planb_base = planb_regs;
2239 pb->planb_base_phys = (struct planb_registers *)new_base;
2240 pb->irq = irq;
2241 pb->dev = pdev;
2242
2243 return planb_num;
2244
2245err_out_disable:
2246 pci_disable_device(pdev);
2247err_out:
2248 /* FIXME handle error */ /* comment moved from pci_find_slot, above */
2249 pci_dev_put(pdev);
2250 return 0;
2251}
2252
2253static void release_planb(void)
2254{
2255 int i;
2256 struct planb *pb;
2257
2258 for (i=0;i<planb_num; i++)
2259 {
2260 pb=&planbs[i];
2261
2262 /* stop and flash DMAs unconditionally */
2263 planb_dbdma_stop(&pb->planb_base->ch2);
2264 planb_dbdma_stop(&pb->planb_base->ch1);
2265
2266 /* clear and free interrupts */
2267 pb->intr_mask = PLANB_CLR_IRQ;
2268 out_le32 (&pb->planb_base->intr_stat, PLANB_CLR_IRQ);
2269 free_irq(pb->irq, pb);
2270
2271 /* make sure all allocated memory are freed */
2272 planb_prepare_close(pb);
2273
2274 printk(KERN_INFO "PlanB: unregistering with v4l\n");
2275 video_unregister_device(&pb->video_dev);
2276
2277 pci_dev_put(pb->dev);
2278
2279 /* note that iounmap() does nothing on the PPC right now */
2280 iounmap ((void *)pb->planb_base);
2281 }
2282}
2283
2284static int __init init_planbs(void)
2285{
2286 int i;
2287
2288 if (find_planb()<=0)
2289 return -EIO;
2290
2291 for (i=0; i<planb_num; i++) {
2292 if (init_planb(&planbs[i])<0) {
2293 printk(KERN_ERR "PlanB: error registering device %d"
2294 " with v4l\n", i);
2295 release_planb();
2296 return -EIO;
2297 }
2298 printk(KERN_INFO "PlanB: registered device %d with v4l\n", i);
2299 }
2300 return 0;
2301}
2302
2303static void __exit exit_planbs(void)
2304{
2305 release_planb();
2306}
2307
2308module_init(init_planbs);
2309module_exit(exit_planbs);
diff --git a/drivers/media/video/planb.h b/drivers/media/video/planb.h
index e21b5735c103..e69de29bb2d1 100644
--- a/drivers/media/video/planb.h
+++ b/drivers/media/video/planb.h
@@ -1,232 +0,0 @@
1/*
2 planb - PlanB frame grabber driver
3
4 PlanB is used in the 7x00/8x00 series of PowerMacintosh
5 Computers as video input DMA controller.
6
7 Copyright (C) 1998 Michel Lanners (mlan@cpu.lu)
8
9 Based largely on the bttv driver by Ralph Metzler (rjkm@thp.uni-koeln.de)
10
11 Additional debugging and coding by Takashi Oe (toe@unlserve.unl.edu)
12
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27*/
28
29/* $Id: planb.h,v 1.13 1999/05/03 19:28:56 mlan Exp $ */
30
31#ifndef _PLANB_H_
32#define _PLANB_H_
33
34#ifdef __KERNEL__
35#include <asm/dbdma.h>
36#include "saa7196.h"
37#endif /* __KERNEL__ */
38
39#define PLANB_DEVICE_NAME "Apple PlanB Video-In"
40#define PLANB_REV "1.0"
41
42#ifdef __KERNEL__
43//#define PLANB_GSCANLINE /* use this if apps have the notion of */
44 /* grab buffer scanline */
45/* This should be safe for both PAL and NTSC */
46#define PLANB_MAXPIXELS 768
47#define PLANB_MAXLINES 576
48#define PLANB_NTSC_MAXLINES 480
49
50/* Uncomment your preferred norm ;-) */
51#define PLANB_DEF_NORM VIDEO_MODE_PAL
52//#define PLANB_DEF_NORM VIDEO_MODE_NTSC
53//#define PLANB_DEF_NORM VIDEO_MODE_SECAM
54
55/* fields settings */
56#define PLANB_GRAY 0x1 /* 8-bit mono? */
57#define PLANB_COLOUR15 0x2 /* 16-bit mode */
58#define PLANB_COLOUR32 0x4 /* 32-bit mode */
59#define PLANB_CLIPMASK 0x8 /* hardware clipmasking */
60
61/* misc. flags for PlanB DMA operation */
62#define CH_SYNC 0x1 /* synchronize channels (set by ch1;
63 cleared by ch2) */
64#define FIELD_SYNC 0x2 /* used for the start of each field
65 (0 -> 1 -> 0 for ch1; 0 -> 1 for ch2) */
66#define EVEN_FIELD 0x0 /* even field is detected if unset */
67#define DMA_ABORT 0x2 /* error or just out of sync if set */
68#define ODD_FIELD 0x4 /* odd field is detected if set */
69
70/* for capture operations */
71#define MAX_GBUFFERS 2
72/* note PLANB_MAX_FBUF must be divisible by PAGE_SIZE */
73#ifdef PLANB_GSCANLINE
74#define PLANB_MAX_FBUF 0x240000 /* 576 * 1024 * 4 */
75#define TAB_FACTOR (1)
76#else
77#define PLANB_MAX_FBUF 0x1b0000 /* 576 * 768 * 4 */
78#define TAB_FACTOR (2)
79#endif
80#endif /* __KERNEL__ */
81
82struct planb_saa_regs {
83 unsigned char addr;
84 unsigned char val;
85};
86
87struct planb_stat_regs {
88 unsigned int ch1_stat;
89 unsigned int ch2_stat;
90 unsigned char saa_stat0;
91 unsigned char saa_stat1;
92};
93
94struct planb_any_regs {
95 unsigned int offset;
96 unsigned int bytes;
97 unsigned char data[128];
98};
99
100/* planb private ioctls */
101#define PLANBIOCGSAAREGS _IOWR('v', BASE_VIDIOCPRIVATE, struct planb_saa_regs) /* Read a saa7196 reg value */
102#define PLANBIOCSSAAREGS _IOW('v', BASE_VIDIOCPRIVATE + 1, struct planb_saa_regs) /* Set a saa7196 reg value */
103#define PLANBIOCGSTAT _IOR('v', BASE_VIDIOCPRIVATE + 2, struct planb_stat_regs) /* Read planb status */
104#define PLANB_TV_MODE 1
105#define PLANB_VTR_MODE 2
106#define PLANBIOCGMODE _IOR('v', BASE_VIDIOCPRIVATE + 3, int) /* Get TV/VTR mode */
107#define PLANBIOCSMODE _IOW('v', BASE_VIDIOCPRIVATE + 4, int) /* Set TV/VTR mode */
108
109#ifdef PLANB_GSCANLINE
110#define PLANBG_GRAB_BPL _IOR('v', BASE_VIDIOCPRIVATE + 5, int) /* # of bytes per scanline in grab buffer */
111#endif
112
113/* call wake_up_interruptible() with appropriate actions */
114#define PLANB_INTR_DEBUG _IOW('v', BASE_VIDIOCPRIVATE + 20, int)
115/* investigate which reg does what */
116#define PLANB_INV_REGS _IOWR('v', BASE_VIDIOCPRIVATE + 21, struct planb_any_regs)
117
118#ifdef __KERNEL__
119
120/* Potentially useful macros */
121#define PLANB_SET(x) ((x) << 16 | (x))
122#define PLANB_CLR(x) ((x) << 16)
123
124/* This represents the physical register layout */
125struct planb_registers {
126 volatile struct dbdma_regs ch1; /* 0x00: video in */
127 volatile unsigned int even; /* 0x40: even field setting */
128 volatile unsigned int odd; /* 0x44; odd field setting */
129 unsigned int pad1[14]; /* empty? */
130 volatile struct dbdma_regs ch2; /* 0x80: clipmask out */
131 unsigned int pad2[16]; /* 0xc0: empty? */
132 volatile unsigned int reg3; /* 0x100: ???? */
133 volatile unsigned int intr_stat; /* 0x104: irq status */
134#define PLANB_CLR_IRQ 0x00 /* clear Plan B interrupt */
135#define PLANB_GEN_IRQ 0x01 /* assert Plan B interrupt */
136#define PLANB_FRM_IRQ 0x0100 /* end of frame */
137 unsigned int pad3[1]; /* empty? */
138 volatile unsigned int reg5; /* 0x10c: ??? */
139 unsigned int pad4[60]; /* empty? */
140 volatile unsigned char saa_addr; /* 0x200: SAA subadr */
141 char pad5[3];
142 volatile unsigned char saa_regval; /* SAA7196 write reg. val */
143 char pad6[3];
144 volatile unsigned char saa_status; /* SAA7196 status byte */
145 /* There is more unused stuff here */
146};
147
148struct planb_window {
149 int x, y;
150 ushort width, height;
151 ushort bpp, bpl, depth, pad;
152 ushort swidth, sheight;
153 int norm;
154 int interlace;
155 u32 color_fmt;
156 int chromakey;
157 int mode; /* used to switch between TV/VTR modes */
158};
159
160struct planb_suspend {
161 int overlay;
162 int frame;
163 struct dbdma_cmd cmd;
164};
165
166struct planb {
167 struct video_device video_dev;
168 struct video_picture picture; /* Current picture params */
169 struct video_audio audio_dev; /* Current audio params */
170
171 volatile struct planb_registers *planb_base; /* virt base of planb */
172 struct planb_registers *planb_base_phys; /* phys base of planb */
173 void *priv_space; /* Org. alloc. mem for kfree */
174 int user;
175 unsigned int tab_size;
176 int maxlines;
177 struct mutex lock;
178 unsigned int irq; /* interrupt number */
179 volatile unsigned int intr_mask;
180 struct pci_dev *dev; /* Our PCI device */
181
182 int overlay; /* overlay running? */
183 struct planb_window win;
184 unsigned long frame_buffer_phys; /* We need phys for DMA */
185 int offset; /* offset of pixel 1 */
186 volatile struct dbdma_cmd *ch1_cmd; /* Video In DMA cmd buffer */
187 volatile struct dbdma_cmd *ch2_cmd; /* Clip Out DMA cmd buffer */
188 volatile struct dbdma_cmd *overlay_last1;
189 volatile struct dbdma_cmd *overlay_last2;
190 unsigned long ch1_cmd_phys;
191 volatile unsigned char *mask; /* Clipmask buffer */
192 int suspend;
193 wait_queue_head_t suspendq;
194 struct planb_suspend suspended;
195 int cmd_buff_inited; /* cmd buffer inited? */
196
197 int grabbing;
198 unsigned int gcount;
199 wait_queue_head_t capq;
200 int last_fr;
201 int prev_last_fr;
202 unsigned char **rawbuf;
203 int rawbuf_size;
204 int gbuf_idx[MAX_GBUFFERS];
205 volatile struct dbdma_cmd *cap_cmd[MAX_GBUFFERS];
206 volatile struct dbdma_cmd *last_cmd[MAX_GBUFFERS];
207 volatile struct dbdma_cmd *pre_cmd[MAX_GBUFFERS];
208 int need_pre_capture[MAX_GBUFFERS];
209#define PLANB_DUMMY 40 /* # of command buf's allocated for pre-capture seq. */
210 int gwidth[MAX_GBUFFERS], gheight[MAX_GBUFFERS];
211 unsigned int gfmt[MAX_GBUFFERS];
212 int gnorm_switch[MAX_GBUFFERS];
213 volatile unsigned int *frame_stat;
214#define GBUFFER_UNUSED 0x00U
215#define GBUFFER_GRABBING 0x01U
216#define GBUFFER_DONE 0x02U
217#ifdef PLANB_GSCANLINE
218 int gbytes_per_line;
219#else
220#define MAX_LNUM 431 /* change this if PLANB_MAXLINES or */
221 /* PLANB_MAXPIXELS changes */
222 int l_fr_addr_idx[MAX_GBUFFERS];
223 unsigned char *l_to_addr[MAX_GBUFFERS][MAX_LNUM];
224 int l_to_next_idx[MAX_GBUFFERS][MAX_LNUM];
225 int l_to_next_size[MAX_GBUFFERS][MAX_LNUM];
226 int lsize[MAX_GBUFFERS], lnum[MAX_GBUFFERS];
227#endif
228};
229
230#endif /* __KERNEL__ */
231
232#endif /* _PLANB_H_ */
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c
index 51b1461d8fb6..00425d743656 100644
--- a/drivers/media/video/pms.c
+++ b/drivers/media/video/pms.c
@@ -30,6 +30,7 @@
30#include <asm/io.h> 30#include <asm/io.h>
31#include <linux/videodev.h> 31#include <linux/videodev.h>
32#include <media/v4l2-common.h> 32#include <media/v4l2-common.h>
33#include <media/v4l2-ioctl.h>
33#include <linux/mutex.h> 34#include <linux/mutex.h>
34 35
35#include <asm/uaccess.h> 36#include <asm/uaccess.h>
@@ -894,9 +895,7 @@ static const struct file_operations pms_fops = {
894 895
895static struct video_device pms_template= 896static struct video_device pms_template=
896{ 897{
897 .owner = THIS_MODULE,
898 .name = "Mediavision PMS", 898 .name = "Mediavision PMS",
899 .type = VID_TYPE_CAPTURE,
900 .fops = &pms_fops, 899 .fops = &pms_fops,
901}; 900};
902 901
diff --git a/drivers/media/video/pvrusb2/Kconfig b/drivers/media/video/pvrusb2/Kconfig
index 4482b2c72ced..19eb274c9cd0 100644
--- a/drivers/media/video/pvrusb2/Kconfig
+++ b/drivers/media/video/pvrusb2/Kconfig
@@ -2,8 +2,6 @@ config VIDEO_PVRUSB2
2 tristate "Hauppauge WinTV-PVR USB2 support" 2 tristate "Hauppauge WinTV-PVR USB2 support"
3 depends on VIDEO_V4L2 && I2C 3 depends on VIDEO_V4L2 && I2C
4 depends on VIDEO_MEDIA # Avoids pvrusb = Y / DVB = M 4 depends on VIDEO_MEDIA # Avoids pvrusb = Y / DVB = M
5 depends on HOTPLUG # due to FW_LOADER
6 select FW_LOADER
7 select VIDEO_TUNER 5 select VIDEO_TUNER
8 select VIDEO_TVEEPROM 6 select VIDEO_TVEEPROM
9 select VIDEO_CX2341X 7 select VIDEO_CX2341X
diff --git a/drivers/media/video/pvrusb2/pvrusb2-context.h b/drivers/media/video/pvrusb2/pvrusb2-context.h
index 61801291c2af..d657e53bbfa3 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-context.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-context.h
@@ -16,8 +16,8 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 * 17 *
18 */ 18 */
19#ifndef __PVRUSB2_BASE_H 19#ifndef __PVRUSB2_CONTEXT_H
20#define __PVRUSB2_BASE_H 20#define __PVRUSB2_CONTEXT_H
21 21
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/usb.h> 23#include <linux/usb.h>
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.c b/drivers/media/video/pvrusb2/pvrusb2-devattr.c
index 5d036e7e3f07..88e175168438 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-devattr.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.c
@@ -97,13 +97,13 @@ static const struct pvr2_device_desc pvr2_device_24xxx = {
97 .flag_has_cx25840 = !0, 97 .flag_has_cx25840 = !0,
98 .flag_has_wm8775 = !0, 98 .flag_has_wm8775 = !0,
99 .flag_has_hauppauge_rom = !0, 99 .flag_has_hauppauge_rom = !0,
100 .flag_has_hauppauge_custom_ir = !0,
101 .flag_has_analogtuner = !0, 100 .flag_has_analogtuner = !0,
102 .flag_has_fmradio = !0, 101 .flag_has_fmradio = !0,
103 .flag_has_composite = !0, 102 .flag_has_composite = !0,
104 .flag_has_svideo = !0, 103 .flag_has_svideo = !0,
105 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, 104 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
106 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE, 105 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
106 .ir_scheme = PVR2_IR_SCHEME_24XXX,
107}; 107};
108 108
109 109
@@ -330,7 +330,7 @@ static const char *pvr2_fw1_names_73xxx[] = {
330}; 330};
331 331
332static const struct pvr2_device_desc pvr2_device_73xxx = { 332static const struct pvr2_device_desc pvr2_device_73xxx = {
333 .description = "WinTV PVR USB2 Model Category 73xxx", 333 .description = "WinTV HVR-1900 Model Category 73xxx",
334 .shortname = "73xxx", 334 .shortname = "73xxx",
335 .client_modules.lst = pvr2_client_73xxx, 335 .client_modules.lst = pvr2_client_73xxx,
336 .client_modules.cnt = ARRAY_SIZE(pvr2_client_73xxx), 336 .client_modules.cnt = ARRAY_SIZE(pvr2_client_73xxx),
@@ -344,6 +344,7 @@ static const struct pvr2_device_desc pvr2_device_73xxx = {
344 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE, 344 .signal_routing_scheme = PVR2_ROUTING_SCHEME_HAUPPAUGE,
345 .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE, 345 .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
346 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE, 346 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
347 .ir_scheme = PVR2_IR_SCHEME_ZILOG,
347#ifdef CONFIG_VIDEO_PVRUSB2_DVB 348#ifdef CONFIG_VIDEO_PVRUSB2_DVB
348 .dvb_props = &pvr2_73xxx_dvb_props, 349 .dvb_props = &pvr2_73xxx_dvb_props,
349#endif 350#endif
@@ -438,7 +439,7 @@ static const char *pvr2_fw1_names_75xxx[] = {
438}; 439};
439 440
440static const struct pvr2_device_desc pvr2_device_750xx = { 441static const struct pvr2_device_desc pvr2_device_750xx = {
441 .description = "WinTV PVR USB2 Model Category 750xx", 442 .description = "WinTV HVR-1950 Model Category 750xx",
442 .shortname = "750xx", 443 .shortname = "750xx",
443 .client_modules.lst = pvr2_client_75xxx, 444 .client_modules.lst = pvr2_client_75xxx,
444 .client_modules.cnt = ARRAY_SIZE(pvr2_client_75xxx), 445 .client_modules.cnt = ARRAY_SIZE(pvr2_client_75xxx),
@@ -453,13 +454,14 @@ static const struct pvr2_device_desc pvr2_device_750xx = {
453 .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE, 454 .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
454 .default_std_mask = V4L2_STD_NTSC_M, 455 .default_std_mask = V4L2_STD_NTSC_M,
455 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE, 456 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
457 .ir_scheme = PVR2_IR_SCHEME_ZILOG,
456#ifdef CONFIG_VIDEO_PVRUSB2_DVB 458#ifdef CONFIG_VIDEO_PVRUSB2_DVB
457 .dvb_props = &pvr2_750xx_dvb_props, 459 .dvb_props = &pvr2_750xx_dvb_props,
458#endif 460#endif
459}; 461};
460 462
461static const struct pvr2_device_desc pvr2_device_751xx = { 463static const struct pvr2_device_desc pvr2_device_751xx = {
462 .description = "WinTV PVR USB2 Model Category 751xx", 464 .description = "WinTV HVR-1950 Model Category 751xx",
463 .shortname = "751xx", 465 .shortname = "751xx",
464 .client_modules.lst = pvr2_client_75xxx, 466 .client_modules.lst = pvr2_client_75xxx,
465 .client_modules.cnt = ARRAY_SIZE(pvr2_client_75xxx), 467 .client_modules.cnt = ARRAY_SIZE(pvr2_client_75xxx),
@@ -474,6 +476,7 @@ static const struct pvr2_device_desc pvr2_device_751xx = {
474 .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE, 476 .digital_control_scheme = PVR2_DIGITAL_SCHEME_HAUPPAUGE,
475 .default_std_mask = V4L2_STD_NTSC_M, 477 .default_std_mask = V4L2_STD_NTSC_M,
476 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE, 478 .led_scheme = PVR2_LED_SCHEME_HAUPPAUGE,
479 .ir_scheme = PVR2_IR_SCHEME_ZILOG,
477#ifdef CONFIG_VIDEO_PVRUSB2_DVB 480#ifdef CONFIG_VIDEO_PVRUSB2_DVB
478 .dvb_props = &pvr2_751xx_dvb_props, 481 .dvb_props = &pvr2_751xx_dvb_props,
479#endif 482#endif
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.h b/drivers/media/video/pvrusb2/pvrusb2-devattr.h
index e23ce1d2edd7..cb3a33eb0276 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-devattr.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.h
@@ -48,6 +48,10 @@ struct pvr2_string_table {
48#define PVR2_LED_SCHEME_NONE 0 48#define PVR2_LED_SCHEME_NONE 0
49#define PVR2_LED_SCHEME_HAUPPAUGE 1 49#define PVR2_LED_SCHEME_HAUPPAUGE 1
50 50
51#define PVR2_IR_SCHEME_NONE 0
52#define PVR2_IR_SCHEME_24XXX 1
53#define PVR2_IR_SCHEME_ZILOG 2
54
51/* This describes a particular hardware type (except for the USB device ID 55/* This describes a particular hardware type (except for the USB device ID
52 which must live in a separate structure due to environmental 56 which must live in a separate structure due to environmental
53 constraints). See the top of pvrusb2-hdw.c for where this is 57 constraints). See the top of pvrusb2-hdw.c for where this is
@@ -126,15 +130,19 @@ struct pvr2_device_desc {
126 ensure that it is found. */ 130 ensure that it is found. */
127 unsigned int flag_has_wm8775:1; 131 unsigned int flag_has_wm8775:1;
128 132
129 /* Device has IR hardware that can be faked into looking like a 133 /* Indicate any specialized IR scheme that might need to be
130 normal Hauppauge i2c IR receiver. This is currently very 134 supported by this driver. If not set, then it is assumed that
131 specific to the 24xxx device, where Hauppauge had replaced their 135 IR can work without help from the driver (which is frequently
132 'standard' I2C IR receiver with a bunch of FPGA logic controlled 136 the case). This is otherwise set to one of
133 directly via the FX2. Turning this on tells the pvrusb2 driver 137 PVR2_IR_SCHEME_xxxx. For "xxxx", the value "24XXX" indicates a
134 to virtualize the presence of the non-existant IR receiver chip and 138 Hauppauge 24xxx class device which has an FPGA-hosted IR
135 implement the virtual receiver in terms of appropriate FX2 139 receiver that can only be reached via FX2 command codes. In
136 commands. */ 140 that case the pvrusb2 driver will emulate the behavior of the
137 unsigned int flag_has_hauppauge_custom_ir:1; 141 older 29xxx device's IR receiver (a "virtual" I2C chip) in terms
142 of those command codes. For the value "ZILOG", we're dealing
143 with an IR chip that must be taken out of reset via another FX2
144 command code (which is the case for HVR-1950 devices). */
145 unsigned int ir_scheme:2;
138 146
139 /* These bits define which kinds of sources the device can handle. 147 /* These bits define which kinds of sources the device can handle.
140 Note: Digital tuner presence is inferred by the 148 Note: Digital tuner presence is inferred by the
diff --git a/drivers/media/video/pvrusb2/pvrusb2-fx2-cmd.h b/drivers/media/video/pvrusb2/pvrusb2-fx2-cmd.h
index b58369e7f30b..614755ea2ea3 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-fx2-cmd.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-fx2-cmd.h
@@ -24,6 +24,8 @@
24#define FX2CMD_MEM_WRITE_DWORD 0x01u 24#define FX2CMD_MEM_WRITE_DWORD 0x01u
25#define FX2CMD_MEM_READ_DWORD 0x02u 25#define FX2CMD_MEM_READ_DWORD 0x02u
26 26
27#define FX2CMD_HCW_ZILOG_RESET 0x10u /* 1=reset 0=release */
28
27#define FX2CMD_MEM_READ_64BYTES 0x28u 29#define FX2CMD_MEM_READ_64BYTES 0x28u
28 30
29#define FX2CMD_REG_WRITE 0x04u 31#define FX2CMD_REG_WRITE 0x04u
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index a5217a2cf4c0..f051c6aa7f1f 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -250,6 +250,7 @@ struct pvr2_fx2cmd_descdef {
250static const struct pvr2_fx2cmd_descdef pvr2_fx2cmd_desc[] = { 250static const struct pvr2_fx2cmd_descdef pvr2_fx2cmd_desc[] = {
251 {FX2CMD_MEM_WRITE_DWORD, "write encoder dword"}, 251 {FX2CMD_MEM_WRITE_DWORD, "write encoder dword"},
252 {FX2CMD_MEM_READ_DWORD, "read encoder dword"}, 252 {FX2CMD_MEM_READ_DWORD, "read encoder dword"},
253 {FX2CMD_HCW_ZILOG_RESET, "zilog IR reset control"},
253 {FX2CMD_MEM_READ_64BYTES, "read encoder 64bytes"}, 254 {FX2CMD_MEM_READ_64BYTES, "read encoder 64bytes"},
254 {FX2CMD_REG_WRITE, "write encoder register"}, 255 {FX2CMD_REG_WRITE, "write encoder register"},
255 {FX2CMD_REG_READ, "read encoder register"}, 256 {FX2CMD_REG_READ, "read encoder register"},
@@ -1711,6 +1712,14 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
1711 if (!pvr2_hdw_dev_ok(hdw)) return; 1712 if (!pvr2_hdw_dev_ok(hdw)) return;
1712 } 1713 }
1713 1714
1715 /* Take the IR chip out of reset, if appropriate */
1716 if (hdw->hdw_desc->ir_scheme == PVR2_IR_SCHEME_ZILOG) {
1717 pvr2_issue_simple_cmd(hdw,
1718 FX2CMD_HCW_ZILOG_RESET |
1719 (1 << 8) |
1720 ((0) << 16));
1721 }
1722
1714 // This step MUST happen after the earlier powerup step. 1723 // This step MUST happen after the earlier powerup step.
1715 pvr2_i2c_core_init(hdw); 1724 pvr2_i2c_core_init(hdw);
1716 if (!pvr2_hdw_dev_ok(hdw)) return; 1725 if (!pvr2_hdw_dev_ok(hdw)) return;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
index 9d3c18b24744..e600576a6c4b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
@@ -979,7 +979,9 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw)
979 printk(KERN_INFO "%s: IR disabled\n",hdw->name); 979 printk(KERN_INFO "%s: IR disabled\n",hdw->name);
980 hdw->i2c_func[0x18] = i2c_black_hole; 980 hdw->i2c_func[0x18] = i2c_black_hole;
981 } else if (ir_mode[hdw->unit_number] == 1) { 981 } else if (ir_mode[hdw->unit_number] == 1) {
982 if (hdw->hdw_desc->flag_has_hauppauge_custom_ir) { 982 if (hdw->hdw_desc->ir_scheme == PVR2_IR_SCHEME_24XXX) {
983 /* This comment is present PURELY to get
984 checkpatch.pl to STFU. Lovely, eh? */
983 hdw->i2c_func[0x18] = i2c_24xxx_ir; 985 hdw->i2c_func[0x18] = i2c_24xxx_ir;
984 } 986 }
985 } 987 }
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 0d72dc470fef..00306faeac01 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -30,6 +30,7 @@
30#include <linux/videodev2.h> 30#include <linux/videodev2.h>
31#include <media/v4l2-dev.h> 31#include <media/v4l2-dev.h>
32#include <media/v4l2-common.h> 32#include <media/v4l2-common.h>
33#include <media/v4l2-ioctl.h>
33 34
34struct pvr2_v4l2_dev; 35struct pvr2_v4l2_dev;
35struct pvr2_v4l2_fh; 36struct pvr2_v4l2_fh;
@@ -1160,11 +1161,6 @@ static const struct file_operations vdev_fops = {
1160 1161
1161 1162
1162static struct video_device vdev_template = { 1163static struct video_device vdev_template = {
1163 .owner = THIS_MODULE,
1164 .type = VID_TYPE_CAPTURE | VID_TYPE_TUNER,
1165 .type2 = (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE
1166 | V4L2_CAP_TUNER | V4L2_CAP_AUDIO
1167 | V4L2_CAP_READWRITE),
1168 .fops = &vdev_fops, 1164 .fops = &vdev_fops,
1169}; 1165};
1170 1166
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c
index 423fa7c2d0c9..9aee7cb6f79a 100644
--- a/drivers/media/video/pwc/pwc-if.c
+++ b/drivers/media/video/pwc/pwc-if.c
@@ -165,9 +165,7 @@ static const struct file_operations pwc_fops = {
165 .llseek = no_llseek, 165 .llseek = no_llseek,
166}; 166};
167static struct video_device pwc_template = { 167static struct video_device pwc_template = {
168 .owner = THIS_MODULE,
169 .name = "Philips Webcam", /* Filled in later */ 168 .name = "Philips Webcam", /* Filled in later */
170 .type = VID_TYPE_CAPTURE,
171 .release = video_device_release, 169 .release = video_device_release,
172 .fops = &pwc_fops, 170 .fops = &pwc_fops,
173 .minor = -1, 171 .minor = -1,
@@ -1048,19 +1046,20 @@ static int pwc_create_sysfs_files(struct video_device *vdev)
1048 struct pwc_device *pdev = video_get_drvdata(vdev); 1046 struct pwc_device *pdev = video_get_drvdata(vdev);
1049 int rc; 1047 int rc;
1050 1048
1051 rc = video_device_create_file(vdev, &dev_attr_button); 1049 rc = device_create_file(&vdev->dev, &dev_attr_button);
1052 if (rc) 1050 if (rc)
1053 goto err; 1051 goto err;
1054 if (pdev->features & FEATURE_MOTOR_PANTILT) { 1052 if (pdev->features & FEATURE_MOTOR_PANTILT) {
1055 rc = video_device_create_file(vdev, &dev_attr_pan_tilt); 1053 rc = device_create_file(&vdev->dev, &dev_attr_pan_tilt);
1056 if (rc) goto err_button; 1054 if (rc) goto err_button;
1057 } 1055 }
1058 1056
1059 return 0; 1057 return 0;
1060 1058
1061err_button: 1059err_button:
1062 video_device_remove_file(vdev, &dev_attr_button); 1060 device_remove_file(&vdev->dev, &dev_attr_button);
1063err: 1061err:
1062 PWC_ERROR("Could not create sysfs files.\n");
1064 return rc; 1063 return rc;
1065} 1064}
1066 1065
@@ -1068,8 +1067,8 @@ static void pwc_remove_sysfs_files(struct video_device *vdev)
1068{ 1067{
1069 struct pwc_device *pdev = video_get_drvdata(vdev); 1068 struct pwc_device *pdev = video_get_drvdata(vdev);
1070 if (pdev->features & FEATURE_MOTOR_PANTILT) 1069 if (pdev->features & FEATURE_MOTOR_PANTILT)
1071 video_device_remove_file(vdev, &dev_attr_pan_tilt); 1070 device_remove_file(&vdev->dev, &dev_attr_pan_tilt);
1072 video_device_remove_file(vdev, &dev_attr_button); 1071 device_remove_file(&vdev->dev, &dev_attr_button);
1073} 1072}
1074 1073
1075#ifdef CONFIG_USB_PWC_DEBUG 1074#ifdef CONFIG_USB_PWC_DEBUG
@@ -1767,9 +1766,8 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
1767 return -ENOMEM; 1766 return -ENOMEM;
1768 } 1767 }
1769 memcpy(pdev->vdev, &pwc_template, sizeof(pwc_template)); 1768 memcpy(pdev->vdev, &pwc_template, sizeof(pwc_template));
1770 pdev->vdev->dev = &(udev->dev); 1769 pdev->vdev->parent = &(udev->dev);
1771 strcpy(pdev->vdev->name, name); 1770 strcpy(pdev->vdev->name, name);
1772 pdev->vdev->owner = THIS_MODULE;
1773 video_set_drvdata(pdev->vdev, pdev); 1771 video_set_drvdata(pdev->vdev, pdev);
1774 1772
1775 pdev->release = le16_to_cpu(udev->descriptor.bcdDevice); 1773 pdev->release = le16_to_cpu(udev->descriptor.bcdDevice);
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h
index 8e8e5b27e77e..74178754b39b 100644
--- a/drivers/media/video/pwc/pwc.h
+++ b/drivers/media/video/pwc/pwc.h
@@ -32,9 +32,11 @@
32#include <linux/smp_lock.h> 32#include <linux/smp_lock.h>
33#include <linux/version.h> 33#include <linux/version.h>
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <linux/mm.h>
35#include <asm/errno.h> 36#include <asm/errno.h>
36#include <linux/videodev.h> 37#include <linux/videodev.h>
37#include <media/v4l2-common.h> 38#include <media/v4l2-common.h>
39#include <media/v4l2-ioctl.h>
38 40
39#include "pwc-uncompress.h" 41#include "pwc-uncompress.h"
40#include <media/pwc-ioctl.h> 42#include <media/pwc-ioctl.h>
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index 04eb2c3fabd8..b1d09d8e2b85 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -47,8 +47,10 @@
47#include <linux/mutex.h> 47#include <linux/mutex.h>
48#include <linux/videodev2.h> 48#include <linux/videodev2.h>
49#include <linux/version.h> 49#include <linux/version.h>
50#include <linux/mm.h>
50#include <media/videobuf-vmalloc.h> 51#include <media/videobuf-vmalloc.h>
51#include <media/v4l2-common.h> 52#include <media/v4l2-common.h>
53#include <media/v4l2-ioctl.h>
52#include <linux/vmalloc.h> 54#include <linux/vmalloc.h>
53#include <linux/usb.h> 55#include <linux/usb.h>
54 56
@@ -184,6 +186,7 @@ struct s2255_dmaqueue {
184#define S2255_FW_LOADED_DSPWAIT 1 186#define S2255_FW_LOADED_DSPWAIT 1
185#define S2255_FW_SUCCESS 2 187#define S2255_FW_SUCCESS 2
186#define S2255_FW_FAILED 3 188#define S2255_FW_FAILED 3
189#define S2255_FW_DISCONNECTING 4
187 190
188struct s2255_fw { 191struct s2255_fw {
189 int fw_loaded; 192 int fw_loaded;
@@ -263,7 +266,6 @@ struct s2255_buffer {
263 266
264struct s2255_fh { 267struct s2255_fh {
265 struct s2255_dev *dev; 268 struct s2255_dev *dev;
266 unsigned int resources;
267 const struct s2255_fmt *fmt; 269 const struct s2255_fmt *fmt;
268 unsigned int width; 270 unsigned int width;
269 unsigned int height; 271 unsigned int height;
@@ -273,14 +275,9 @@ struct s2255_fh {
273 /* mode below is the desired mode. 275 /* mode below is the desired mode.
274 mode in s2255_dev is the current mode that was last set */ 276 mode in s2255_dev is the current mode that was last set */
275 struct s2255_mode mode; 277 struct s2255_mode mode;
278 int resources[MAX_CHANNELS];
276}; 279};
277 280
278/*
279 * TODO: fixme S2255_MAX_USERS. Do not limit open driver handles.
280 * Limit V4L to one stream at a time.
281 */
282#define S2255_MAX_USERS 1
283
284#define CUR_USB_FWVER 774 /* current cypress EEPROM firmware version */ 281#define CUR_USB_FWVER 774 /* current cypress EEPROM firmware version */
285#define S2255_MAJOR_VERSION 1 282#define S2255_MAJOR_VERSION 1
286#define S2255_MINOR_VERSION 13 283#define S2255_MINOR_VERSION 13
@@ -476,10 +473,9 @@ static void s2255_timer(unsigned long user_data)
476 dprintk(100, "s2255 timer\n"); 473 dprintk(100, "s2255 timer\n");
477 if (usb_submit_urb(data->fw_urb, GFP_ATOMIC) < 0) { 474 if (usb_submit_urb(data->fw_urb, GFP_ATOMIC) < 0) {
478 printk(KERN_ERR "s2255: can't submit urb\n"); 475 printk(KERN_ERR "s2255: can't submit urb\n");
479 if (data->fw) { 476 atomic_set(&data->fw_state, S2255_FW_FAILED);
480 release_firmware(data->fw); 477 /* wake up anything waiting for the firmware */
481 data->fw = NULL; 478 wake_up(&data->wait_fw);
482 }
483 return; 479 return;
484 } 480 }
485} 481}
@@ -509,13 +505,18 @@ static void s2255_fwchunk_complete(struct urb *urb)
509 struct usb_device *udev = urb->dev; 505 struct usb_device *udev = urb->dev;
510 int len; 506 int len;
511 dprintk(100, "udev %p urb %p", udev, urb); 507 dprintk(100, "udev %p urb %p", udev, urb);
512 /* TODO: fixme. reflect change in status */
513 if (urb->status) { 508 if (urb->status) {
514 dev_err(&udev->dev, "URB failed with status %d", urb->status); 509 dev_err(&udev->dev, "URB failed with status %d", urb->status);
510 atomic_set(&data->fw_state, S2255_FW_FAILED);
511 /* wake up anything waiting for the firmware */
512 wake_up(&data->wait_fw);
515 return; 513 return;
516 } 514 }
517 if (data->fw_urb == NULL) { 515 if (data->fw_urb == NULL) {
518 dev_err(&udev->dev, "early disconncect\n"); 516 dev_err(&udev->dev, "s2255 disconnected\n");
517 atomic_set(&data->fw_state, S2255_FW_FAILED);
518 /* wake up anything waiting for the firmware */
519 wake_up(&data->wait_fw);
519 return; 520 return;
520 } 521 }
521#define CHUNK_SIZE 512 522#define CHUNK_SIZE 512
@@ -789,7 +790,8 @@ static int res_get(struct s2255_dev *dev, struct s2255_fh *fh)
789 } 790 }
790 /* it's free, grab it */ 791 /* it's free, grab it */
791 dev->resources[fh->channel] = 1; 792 dev->resources[fh->channel] = 1;
792 dprintk(1, "res: get\n"); 793 fh->resources[fh->channel] = 1;
794 dprintk(1, "s2255: res: get\n");
793 mutex_unlock(&dev->lock); 795 mutex_unlock(&dev->lock);
794 return 1; 796 return 1;
795} 797}
@@ -799,9 +801,18 @@ static int res_locked(struct s2255_dev *dev, struct s2255_fh *fh)
799 return dev->resources[fh->channel]; 801 return dev->resources[fh->channel];
800} 802}
801 803
804static int res_check(struct s2255_fh *fh)
805{
806 return fh->resources[fh->channel];
807}
808
809
802static void res_free(struct s2255_dev *dev, struct s2255_fh *fh) 810static void res_free(struct s2255_dev *dev, struct s2255_fh *fh)
803{ 811{
812 mutex_lock(&dev->lock);
804 dev->resources[fh->channel] = 0; 813 dev->resources[fh->channel] = 0;
814 fh->resources[fh->channel] = 0;
815 mutex_unlock(&dev->lock);
805 dprintk(1, "res: put\n"); 816 dprintk(1, "res: put\n");
806} 817}
807 818
@@ -1232,7 +1243,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
1232 } 1243 }
1233 1244
1234 if (!res_get(dev, fh)) { 1245 if (!res_get(dev, fh)) {
1235 dev_err(&dev->udev->dev, "res get busy\n"); 1246 dev_err(&dev->udev->dev, "s2255: stream busy\n");
1236 return -EBUSY; 1247 return -EBUSY;
1237 } 1248 }
1238 1249
@@ -1288,8 +1299,10 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
1288 } 1299 }
1289 s2255_stop_acquire(dev, fh->channel); 1300 s2255_stop_acquire(dev, fh->channel);
1290 res = videobuf_streamoff(&fh->vb_vidq); 1301 res = videobuf_streamoff(&fh->vb_vidq);
1302 if (res < 0)
1303 return res;
1291 res_free(dev, fh); 1304 res_free(dev, fh);
1292 return res; 1305 return 0;
1293} 1306}
1294 1307
1295static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *i) 1308static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *i)
@@ -1462,12 +1475,7 @@ static int s2255_open(struct inode *inode, struct file *file)
1462 mutex_lock(&dev->open_lock); 1475 mutex_lock(&dev->open_lock);
1463 1476
1464 dev->users[cur_channel]++; 1477 dev->users[cur_channel]++;
1465 if (dev->users[cur_channel] > S2255_MAX_USERS) { 1478 dprintk(4, "s2255: open_handles %d\n", dev->users[cur_channel]);
1466 dev->users[cur_channel]--;
1467 mutex_unlock(&dev->open_lock);
1468 printk(KERN_INFO "s2255drv: too many open handles!\n");
1469 return -EBUSY;
1470 }
1471 1479
1472 if (atomic_read(&dev->fw_data->fw_state) == S2255_FW_FAILED) { 1480 if (atomic_read(&dev->fw_data->fw_state) == S2255_FW_FAILED) {
1473 err("2255 firmware load failed. retrying.\n"); 1481 err("2255 firmware load failed. retrying.\n");
@@ -1478,7 +1486,8 @@ static int s2255_open(struct inode *inode, struct file *file)
1478 msecs_to_jiffies(S2255_LOAD_TIMEOUT)); 1486 msecs_to_jiffies(S2255_LOAD_TIMEOUT));
1479 if (atomic_read(&dev->fw_data->fw_state) 1487 if (atomic_read(&dev->fw_data->fw_state)
1480 != S2255_FW_SUCCESS) { 1488 != S2255_FW_SUCCESS) {
1481 printk(KERN_INFO "2255 FW load failed after 2 tries\n"); 1489 printk(KERN_INFO "2255 FW load failed.\n");
1490 dev->users[cur_channel]--;
1482 mutex_unlock(&dev->open_lock); 1491 mutex_unlock(&dev->open_lock);
1483 return -EFAULT; 1492 return -EFAULT;
1484 } 1493 }
@@ -1494,6 +1503,7 @@ static int s2255_open(struct inode *inode, struct file *file)
1494 != S2255_FW_SUCCESS) { 1503 != S2255_FW_SUCCESS) {
1495 printk(KERN_INFO "2255 firmware not loaded" 1504 printk(KERN_INFO "2255 firmware not loaded"
1496 "try again\n"); 1505 "try again\n");
1506 dev->users[cur_channel]--;
1497 mutex_unlock(&dev->open_lock); 1507 mutex_unlock(&dev->open_lock);
1498 return -EBUSY; 1508 return -EBUSY;
1499 } 1509 }
@@ -1502,6 +1512,7 @@ static int s2255_open(struct inode *inode, struct file *file)
1502 /* allocate + initialize per filehandle data */ 1512 /* allocate + initialize per filehandle data */
1503 fh = kzalloc(sizeof(*fh), GFP_KERNEL); 1513 fh = kzalloc(sizeof(*fh), GFP_KERNEL);
1504 if (NULL == fh) { 1514 if (NULL == fh) {
1515 dev->users[cur_channel]--;
1505 mutex_unlock(&dev->open_lock); 1516 mutex_unlock(&dev->open_lock);
1506 return -ENOMEM; 1517 return -ENOMEM;
1507 } 1518 }
@@ -1561,44 +1572,48 @@ static void s2255_destroy(struct kref *kref)
1561 printk(KERN_ERR "s2255drv: kref problem\n"); 1572 printk(KERN_ERR "s2255drv: kref problem\n");
1562 return; 1573 return;
1563 } 1574 }
1575
1576 /*
1577 * Wake up any firmware load waiting (only done in .open,
1578 * which holds the open_lock mutex)
1579 */
1580 atomic_set(&dev->fw_data->fw_state, S2255_FW_DISCONNECTING);
1581 wake_up(&dev->fw_data->wait_fw);
1582
1564 /* prevent s2255_disconnect from racing s2255_open */ 1583 /* prevent s2255_disconnect from racing s2255_open */
1565 mutex_lock(&dev->open_lock); 1584 mutex_lock(&dev->open_lock);
1566 s2255_exit_v4l(dev); 1585 s2255_exit_v4l(dev);
1567 /* device unregistered so no longer possible to open. open_mutex 1586 /*
1568 can be unlocked */ 1587 * device unregistered so no longer possible to open. open_mutex
1588 * can be unlocked and timers deleted afterwards.
1589 */
1569 mutex_unlock(&dev->open_lock); 1590 mutex_unlock(&dev->open_lock);
1570 1591
1571 /* board shutdown stops the read pipe if it is running */ 1592 /* board shutdown stops the read pipe if it is running */
1572 s2255_board_shutdown(dev); 1593 s2255_board_shutdown(dev);
1573 1594
1574 /* make sure firmware still not trying to load */ 1595 /* make sure firmware still not trying to load */
1596 del_timer(&dev->timer); /* only started in .probe and .open */
1597
1575 if (dev->fw_data->fw_urb) { 1598 if (dev->fw_data->fw_urb) {
1576 dprintk(2, "kill fw_urb\n"); 1599 dprintk(2, "kill fw_urb\n");
1577 usb_kill_urb(dev->fw_data->fw_urb); 1600 usb_kill_urb(dev->fw_data->fw_urb);
1578 usb_free_urb(dev->fw_data->fw_urb); 1601 usb_free_urb(dev->fw_data->fw_urb);
1579 dev->fw_data->fw_urb = NULL; 1602 dev->fw_data->fw_urb = NULL;
1580 } 1603 }
1604
1581 /* 1605 /*
1582 * TODO: fixme(above, below): potentially leaving timers alive. 1606 * delete the dsp_wait timer, which sets the firmware
1583 * do not ignore timeout below if 1607 * state on completion. This is done before fw_data
1584 * it occurs. 1608 * is freed below.
1585 */ 1609 */
1586 1610
1587 /* make sure we aren't waiting for the DSP */ 1611 del_timer(&dev->fw_data->dsp_wait); /* only started in .open */
1588 if (atomic_read(&dev->fw_data->fw_state) == S2255_FW_LOADED_DSPWAIT) {
1589 /* if we are, wait for the wakeup for fw_success or timeout */
1590 wait_event_timeout(dev->fw_data->wait_fw,
1591 (atomic_read(&dev->fw_data->fw_state)
1592 == S2255_FW_SUCCESS),
1593 msecs_to_jiffies(S2255_LOAD_TIMEOUT));
1594 }
1595 1612
1596 if (dev->fw_data) { 1613 if (dev->fw_data->fw)
1597 if (dev->fw_data->fw) 1614 release_firmware(dev->fw_data->fw);
1598 release_firmware(dev->fw_data->fw); 1615 kfree(dev->fw_data->pfw_data);
1599 kfree(dev->fw_data->pfw_data); 1616 kfree(dev->fw_data);
1600 kfree(dev->fw_data);
1601 }
1602 1617
1603 usb_put_dev(dev->udev); 1618 usb_put_dev(dev->udev);
1604 dprintk(1, "%s", __func__); 1619 dprintk(1, "%s", __func__);
@@ -1615,17 +1630,23 @@ static int s2255_close(struct inode *inode, struct file *file)
1615 1630
1616 mutex_lock(&dev->open_lock); 1631 mutex_lock(&dev->open_lock);
1617 1632
1618 if (dev->b_acquire[fh->channel]) 1633 /* turn off stream */
1619 s2255_stop_acquire(dev, fh->channel); 1634 if (res_check(fh)) {
1620 res_free(dev, fh); 1635 if (dev->b_acquire[fh->channel])
1636 s2255_stop_acquire(dev, fh->channel);
1637 videobuf_streamoff(&fh->vb_vidq);
1638 res_free(dev, fh);
1639 }
1640
1621 videobuf_mmap_free(&fh->vb_vidq); 1641 videobuf_mmap_free(&fh->vb_vidq);
1622 kfree(fh);
1623 dev->users[fh->channel]--; 1642 dev->users[fh->channel]--;
1643
1624 mutex_unlock(&dev->open_lock); 1644 mutex_unlock(&dev->open_lock);
1625 1645
1626 kref_put(&dev->kref, s2255_destroy); 1646 kref_put(&dev->kref, s2255_destroy);
1627 dprintk(1, "s2255: close called (minor=%d, users=%d)\n", 1647 dprintk(1, "s2255: close called (minor=%d, users=%d)\n",
1628 minor, dev->users[fh->channel]); 1648 minor, dev->users[fh->channel]);
1649 kfree(fh);
1629 return 0; 1650 return 0;
1630} 1651}
1631 1652
@@ -1658,12 +1679,7 @@ static const struct file_operations s2255_fops_v4l = {
1658 .llseek = no_llseek, 1679 .llseek = no_llseek,
1659}; 1680};
1660 1681
1661static struct video_device template = { 1682static const struct v4l2_ioctl_ops s2255_ioctl_ops = {
1662 .name = "s2255v",
1663 .type = VID_TYPE_CAPTURE,
1664 .fops = &s2255_fops_v4l,
1665 .minor = -1,
1666 .release = video_device_release,
1667 .vidioc_querycap = vidioc_querycap, 1683 .vidioc_querycap = vidioc_querycap,
1668 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1684 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1669 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1685 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1685,6 +1701,14 @@ static struct video_device template = {
1685#ifdef CONFIG_VIDEO_V4L1_COMPAT 1701#ifdef CONFIG_VIDEO_V4L1_COMPAT
1686 .vidiocgmbuf = vidioc_cgmbuf, 1702 .vidiocgmbuf = vidioc_cgmbuf,
1687#endif 1703#endif
1704};
1705
1706static struct video_device template = {
1707 .name = "s2255v",
1708 .fops = &s2255_fops_v4l,
1709 .ioctl_ops = &s2255_ioctl_ops,
1710 .minor = -1,
1711 .release = video_device_release,
1688 .tvnorms = S2255_NORMS, 1712 .tvnorms = S2255_NORMS,
1689 .current_norm = V4L2_STD_NTSC_M, 1713 .current_norm = V4L2_STD_NTSC_M,
1690}; 1714};
@@ -1706,7 +1730,7 @@ static int s2255_probe_v4l(struct s2255_dev *dev)
1706 /* register 4 video devices */ 1730 /* register 4 video devices */
1707 dev->vdev[i] = video_device_alloc(); 1731 dev->vdev[i] = video_device_alloc();
1708 memcpy(dev->vdev[i], &template, sizeof(struct video_device)); 1732 memcpy(dev->vdev[i], &template, sizeof(struct video_device));
1709 dev->vdev[i]->dev = &dev->interface->dev; 1733 dev->vdev[i]->parent = &dev->interface->dev;
1710 if (video_nr == -1) 1734 if (video_nr == -1)
1711 ret = video_register_device(dev->vdev[i], 1735 ret = video_register_device(dev->vdev[i],
1712 VFL_TYPE_GRABBER, 1736 VFL_TYPE_GRABBER,
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
index 03e772130b55..6ee63e69b36c 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -46,6 +46,7 @@
46#include <linux/videotext.h> 46#include <linux/videotext.h>
47#include <linux/videodev.h> 47#include <linux/videodev.h>
48#include <media/v4l2-common.h> 48#include <media/v4l2-common.h>
49#include <media/v4l2-ioctl.h>
49#include <linux/mutex.h> 50#include <linux/mutex.h>
50 51
51#include "saa5246a.h" 52#include "saa5246a.h"
@@ -829,9 +830,7 @@ static const struct file_operations saa_fops = {
829 830
830static struct video_device saa_template = 831static struct video_device saa_template =
831{ 832{
832 .owner = THIS_MODULE,
833 .name = IF_NAME, 833 .name = IF_NAME,
834 .type = VID_TYPE_TELETEXT,
835 .fops = &saa_fops, 834 .fops = &saa_fops,
836 .release = video_device_release, 835 .release = video_device_release,
837 .minor = -1, 836 .minor = -1,
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
index fde99d9ee71f..0d639738d4e6 100644
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -57,6 +57,7 @@
57#include <linux/videotext.h> 57#include <linux/videotext.h>
58#include <linux/videodev.h> 58#include <linux/videodev.h>
59#include <media/v4l2-common.h> 59#include <media/v4l2-common.h>
60#include <media/v4l2-ioctl.h>
60#include <linux/mutex.h> 61#include <linux/mutex.h>
61 62
62 63
@@ -710,9 +711,7 @@ static const struct file_operations saa_fops = {
710 711
711static struct video_device saa_template = 712static struct video_device saa_template =
712{ 713{
713 .owner = THIS_MODULE,
714 .name = IF_NAME, 714 .name = IF_NAME,
715 .type = VID_TYPE_TELETEXT, /*| VID_TYPE_TUNER ?? */
716 .fops = &saa_fops, 715 .fops = &saa_fops,
717}; 716};
718 717
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index 83f076abce35..7021bbf5897b 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -27,9 +27,7 @@ config VIDEO_SAA7134_ALSA
27config VIDEO_SAA7134_DVB 27config VIDEO_SAA7134_DVB
28 tristate "DVB/ATSC Support for saa7134 based TV cards" 28 tristate "DVB/ATSC Support for saa7134 based TV cards"
29 depends on VIDEO_SAA7134 && DVB_CORE 29 depends on VIDEO_SAA7134 && DVB_CORE
30 depends on HOTPLUG # due to FW_LOADER
31 select VIDEOBUF_DVB 30 select VIDEOBUF_DVB
32 select FW_LOADER
33 select DVB_PLL if !DVB_FE_CUSTOMISE 31 select DVB_PLL if !DVB_FE_CUSTOMISE
34 select DVB_MT352 if !DVB_FE_CUSTOMISE 32 select DVB_MT352 if !DVB_FE_CUSTOMISE
35 select DVB_TDA1004X if !DVB_FE_CUSTOMISE 33 select DVB_TDA1004X if !DVB_FE_CUSTOMISE
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 6893f998d292..98364d171def 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -5853,9 +5853,6 @@ int saa7134_board_init2(struct saa7134_dev *dev)
5853 unsigned char buf; 5853 unsigned char buf;
5854 int board; 5854 int board;
5855 5855
5856 dev->tuner_type = saa7134_boards[dev->board].tuner_type;
5857 dev->tuner_addr = saa7134_boards[dev->board].tuner_addr;
5858
5859 switch (dev->board) { 5856 switch (dev->board) {
5860 case SAA7134_BOARD_BMK_MPEX_NOTUNER: 5857 case SAA7134_BOARD_BMK_MPEX_NOTUNER:
5861 case SAA7134_BOARD_BMK_MPEX_TUNER: 5858 case SAA7134_BOARD_BMK_MPEX_TUNER:
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index cfee84ee7a88..75d618415f4f 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -798,7 +798,7 @@ static struct video_device *vdev_init(struct saa7134_dev *dev,
798 return NULL; 798 return NULL;
799 *vfd = *template; 799 *vfd = *template;
800 vfd->minor = -1; 800 vfd->minor = -1;
801 vfd->dev = &dev->pci->dev; 801 vfd->parent = &dev->pci->dev;
802 vfd->release = video_device_release; 802 vfd->release = video_device_release;
803 vfd->debug = video_debug; 803 vfd->debug = video_debug;
804 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", 804 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
@@ -945,11 +945,12 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
945 dev->board = SAA7134_BOARD_UNKNOWN; 945 dev->board = SAA7134_BOARD_UNKNOWN;
946 } 946 }
947 dev->autodetected = card[dev->nr] != dev->board; 947 dev->autodetected = card[dev->nr] != dev->board;
948 dev->tuner_type = saa7134_boards[dev->board].tuner_type; 948 dev->tuner_type = saa7134_boards[dev->board].tuner_type;
949 dev->tuner_addr = saa7134_boards[dev->board].tuner_addr;
949 dev->tda9887_conf = saa7134_boards[dev->board].tda9887_conf; 950 dev->tda9887_conf = saa7134_boards[dev->board].tda9887_conf;
950 if (UNSET != tuner[dev->nr]) 951 if (UNSET != tuner[dev->nr])
951 dev->tuner_type = tuner[dev->nr]; 952 dev->tuner_type = tuner[dev->nr];
952 printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", 953 printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n",
953 dev->name,pci_dev->subsystem_vendor, 954 dev->name,pci_dev->subsystem_vendor,
954 pci_dev->subsystem_device,saa7134_boards[dev->board].name, 955 pci_dev->subsystem_device,saa7134_boards[dev->board].name,
955 dev->board, dev->autodetected ? 956 dev->board, dev->autodetected ?
@@ -1007,11 +1008,9 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
1007 v4l2_prio_init(&dev->prio); 1008 v4l2_prio_init(&dev->prio);
1008 1009
1009 /* register v4l devices */ 1010 /* register v4l devices */
1010 if (saa7134_no_overlay <= 0) { 1011 if (saa7134_no_overlay > 0)
1011 saa7134_video_template.type |= VID_TYPE_OVERLAY; 1012 printk(KERN_INFO "%s: Overlay support disabled.\n", dev->name);
1012 } else { 1013
1013 printk("%s: Overlay support disabled.\n",dev->name);
1014 }
1015 dev->video_dev = vdev_init(dev,&saa7134_video_template,"video"); 1014 dev->video_dev = vdev_init(dev,&saa7134_video_template,"video");
1016 err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, 1015 err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER,
1017 video_nr[dev->nr]); 1016 video_nr[dev->nr]);
@@ -1024,7 +1023,6 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
1024 dev->name,dev->video_dev->minor & 0x1f); 1023 dev->name,dev->video_dev->minor & 0x1f);
1025 1024
1026 dev->vbi_dev = vdev_init(dev, &saa7134_video_template, "vbi"); 1025 dev->vbi_dev = vdev_init(dev, &saa7134_video_template, "vbi");
1027 dev->vbi_dev->type = VID_TYPE_TUNER | VID_TYPE_TELETEXT;
1028 1026
1029 err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI, 1027 err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI,
1030 vbi_nr[dev->nr]); 1028 vbi_nr[dev->nr]);
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 2a5ab957542d..c0c5d7509c25 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -89,14 +89,14 @@ static int ts_open(struct inode *inode, struct file *file)
89 err = -EBUSY; 89 err = -EBUSY;
90 if (!mutex_trylock(&dev->empress_tsq.vb_lock)) 90 if (!mutex_trylock(&dev->empress_tsq.vb_lock))
91 goto done; 91 goto done;
92 if (dev->empress_users) 92 if (atomic_read(&dev->empress_users))
93 goto done_up; 93 goto done_up;
94 94
95 /* Unmute audio */ 95 /* Unmute audio */
96 saa_writeb(SAA7134_AUDIO_MUTE_CTRL, 96 saa_writeb(SAA7134_AUDIO_MUTE_CTRL,
97 saa_readb(SAA7134_AUDIO_MUTE_CTRL) & ~(1 << 6)); 97 saa_readb(SAA7134_AUDIO_MUTE_CTRL) & ~(1 << 6));
98 98
99 dev->empress_users++; 99 atomic_inc(&dev->empress_users);
100 file->private_data = dev; 100 file->private_data = dev;
101 err = 0; 101 err = 0;
102 102
@@ -110,8 +110,6 @@ 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
115 videobuf_stop(&dev->empress_tsq); 113 videobuf_stop(&dev->empress_tsq);
116 videobuf_mmap_free(&dev->empress_tsq); 114 videobuf_mmap_free(&dev->empress_tsq);
117 115
@@ -122,9 +120,7 @@ static int ts_release(struct inode *inode, struct file *file)
122 saa_writeb(SAA7134_AUDIO_MUTE_CTRL, 120 saa_writeb(SAA7134_AUDIO_MUTE_CTRL,
123 saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6)); 121 saa_readb(SAA7134_AUDIO_MUTE_CTRL) | (1 << 6));
124 122
125 dev->empress_users--; 123 atomic_dec(&dev->empress_users);
126
127 mutex_unlock(&dev->empress_tsq.vb_lock);
128 124
129 return 0; 125 return 0;
130} 126}
@@ -333,6 +329,22 @@ static int empress_g_ext_ctrls(struct file *file, void *priv,
333 return saa7134_i2c_call_saa6752(dev, VIDIOC_G_EXT_CTRLS, ctrls); 329 return saa7134_i2c_call_saa6752(dev, VIDIOC_G_EXT_CTRLS, ctrls);
334} 330}
335 331
332static int empress_g_ctrl(struct file *file, void *priv,
333 struct v4l2_control *c)
334{
335 struct saa7134_dev *dev = file->private_data;
336
337 return saa7134_g_ctrl_internal(dev, NULL, c);
338}
339
340static int empress_s_ctrl(struct file *file, void *priv,
341 struct v4l2_control *c)
342{
343 struct saa7134_dev *dev = file->private_data;
344
345 return saa7134_s_ctrl_internal(dev, NULL, c);
346}
347
336static int empress_queryctrl(struct file *file, void *priv, 348static int empress_queryctrl(struct file *file, void *priv,
337 struct v4l2_queryctrl *c) 349 struct v4l2_queryctrl *c)
338{ 350{
@@ -400,16 +412,7 @@ static const struct file_operations ts_fops =
400 .llseek = no_llseek, 412 .llseek = no_llseek,
401}; 413};
402 414
403/* ----------------------------------------------------------- */ 415static const struct v4l2_ioctl_ops ts_ioctl_ops = {
404
405static struct video_device saa7134_empress_template =
406{
407 .name = "saa7134-empress",
408 .type = 0 /* FIXME */,
409 .type2 = 0 /* FIXME */,
410 .fops = &ts_fops,
411 .minor = -1,
412
413 .vidioc_querycap = empress_querycap, 416 .vidioc_querycap = empress_querycap,
414 .vidioc_enum_fmt_vid_cap = empress_enum_fmt_vid_cap, 417 .vidioc_enum_fmt_vid_cap = empress_enum_fmt_vid_cap,
415 .vidioc_s_fmt_vid_cap = empress_s_fmt_vid_cap, 418 .vidioc_s_fmt_vid_cap = empress_s_fmt_vid_cap,
@@ -428,8 +431,17 @@ static struct video_device saa7134_empress_template =
428 431
429 .vidioc_queryctrl = empress_queryctrl, 432 .vidioc_queryctrl = empress_queryctrl,
430 .vidioc_querymenu = empress_querymenu, 433 .vidioc_querymenu = empress_querymenu,
431 .vidioc_g_ctrl = saa7134_g_ctrl, 434 .vidioc_g_ctrl = empress_g_ctrl,
432 .vidioc_s_ctrl = saa7134_s_ctrl, 435 .vidioc_s_ctrl = empress_s_ctrl,
436};
437
438/* ----------------------------------------------------------- */
439
440static struct video_device saa7134_empress_template = {
441 .name = "saa7134-empress",
442 .fops = &ts_fops,
443 .minor = -1,
444 .ioctl_ops = &ts_ioctl_ops,
433 445
434 .tvnorms = SAA7134_NORMS, 446 .tvnorms = SAA7134_NORMS,
435 .current_norm = V4L2_STD_PAL, 447 .current_norm = V4L2_STD_PAL,
@@ -445,7 +457,7 @@ static void empress_signal_update(struct work_struct *work)
445 ts_reset_encoder(dev); 457 ts_reset_encoder(dev);
446 } else { 458 } else {
447 dprintk("video signal acquired\n"); 459 dprintk("video signal acquired\n");
448 if (dev->empress_users) 460 if (atomic_read(&dev->empress_users))
449 ts_init_encoder(dev); 461 ts_init_encoder(dev);
450 } 462 }
451} 463}
@@ -465,7 +477,7 @@ static int empress_init(struct saa7134_dev *dev)
465 if (NULL == dev->empress_dev) 477 if (NULL == dev->empress_dev)
466 return -ENOMEM; 478 return -ENOMEM;
467 *(dev->empress_dev) = saa7134_empress_template; 479 *(dev->empress_dev) = saa7134_empress_template;
468 dev->empress_dev->dev = &dev->pci->dev; 480 dev->empress_dev->parent = &dev->pci->dev;
469 dev->empress_dev->release = video_device_release; 481 dev->empress_dev->release = video_device_release;
470 snprintf(dev->empress_dev->name, sizeof(dev->empress_dev->name), 482 snprintf(dev->empress_dev->name, sizeof(dev->empress_dev->name),
471 "%s empress (%s)", dev->name, 483 "%s empress (%s)", dev->name,
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 1a5137550e7a..68c268981861 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1112,10 +1112,8 @@ static struct videobuf_queue_ops video_qops = {
1112 1112
1113/* ------------------------------------------------------------------ */ 1113/* ------------------------------------------------------------------ */
1114 1114
1115int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c) 1115int saa7134_g_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c)
1116{ 1116{
1117 struct saa7134_fh *fh = priv;
1118 struct saa7134_dev *dev = fh->dev;
1119 const struct v4l2_queryctrl* ctrl; 1117 const struct v4l2_queryctrl* ctrl;
1120 1118
1121 ctrl = ctrl_by_id(c->id); 1119 ctrl = ctrl_by_id(c->id);
@@ -1160,20 +1158,31 @@ int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c)
1160 } 1158 }
1161 return 0; 1159 return 0;
1162} 1160}
1163EXPORT_SYMBOL_GPL(saa7134_g_ctrl); 1161EXPORT_SYMBOL_GPL(saa7134_g_ctrl_internal);
1162
1163static int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c)
1164{
1165 struct saa7134_fh *fh = priv;
1166
1167 return saa7134_g_ctrl_internal(fh->dev, fh, c);
1168}
1164 1169
1165int saa7134_s_ctrl(struct file *file, void *f, struct v4l2_control *c) 1170int saa7134_s_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c)
1166{ 1171{
1167 const struct v4l2_queryctrl* ctrl; 1172 const struct v4l2_queryctrl* ctrl;
1168 struct saa7134_fh *fh = f;
1169 struct saa7134_dev *dev = fh->dev;
1170 unsigned long flags; 1173 unsigned long flags;
1171 int restart_overlay = 0; 1174 int restart_overlay = 0;
1172 int err = -EINVAL; 1175 int err;
1173 1176
1174 err = v4l2_prio_check(&dev->prio, &fh->prio); 1177 /* When called from the empress code fh == NULL.
1175 if (0 != err) 1178 That needs to be fixed somehow, but for now this is
1176 return err; 1179 good enough. */
1180 if (fh) {
1181 err = v4l2_prio_check(&dev->prio, &fh->prio);
1182 if (0 != err)
1183 return err;
1184 }
1185 err = -EINVAL;
1177 1186
1178 mutex_lock(&dev->lock); 1187 mutex_lock(&dev->lock);
1179 1188
@@ -1274,7 +1283,14 @@ error:
1274 mutex_unlock(&dev->lock); 1283 mutex_unlock(&dev->lock);
1275 return err; 1284 return err;
1276} 1285}
1277EXPORT_SYMBOL_GPL(saa7134_s_ctrl); 1286EXPORT_SYMBOL_GPL(saa7134_s_ctrl_internal);
1287
1288static int saa7134_s_ctrl(struct file *file, void *f, struct v4l2_control *c)
1289{
1290 struct saa7134_fh *fh = f;
1291
1292 return saa7134_s_ctrl_internal(fh->dev, fh, c);
1293}
1278 1294
1279/* ------------------------------------------------------------------ */ 1295/* ------------------------------------------------------------------ */
1280 1296
@@ -2353,26 +2369,7 @@ static const struct file_operations video_fops =
2353 .llseek = no_llseek, 2369 .llseek = no_llseek,
2354}; 2370};
2355 2371
2356static const struct file_operations radio_fops = 2372static const struct v4l2_ioctl_ops video_ioctl_ops = {
2357{
2358 .owner = THIS_MODULE,
2359 .open = video_open,
2360 .release = video_release,
2361 .ioctl = video_ioctl2,
2362 .compat_ioctl = v4l_compat_ioctl32,
2363 .llseek = no_llseek,
2364};
2365
2366/* ----------------------------------------------------------- */
2367/* exported stuff */
2368
2369struct video_device saa7134_video_template =
2370{
2371 .name = "saa7134-video",
2372 .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER |
2373 VID_TYPE_CLIPPING|VID_TYPE_SCALES,
2374 .fops = &video_fops,
2375 .minor = -1,
2376 .vidioc_querycap = saa7134_querycap, 2373 .vidioc_querycap = saa7134_querycap,
2377 .vidioc_enum_fmt_vid_cap = saa7134_enum_fmt_vid_cap, 2374 .vidioc_enum_fmt_vid_cap = saa7134_enum_fmt_vid_cap,
2378 .vidioc_g_fmt_vid_cap = saa7134_g_fmt_vid_cap, 2375 .vidioc_g_fmt_vid_cap = saa7134_g_fmt_vid_cap,
@@ -2421,16 +2418,18 @@ struct video_device saa7134_video_template =
2421 .vidioc_g_register = vidioc_g_register, 2418 .vidioc_g_register = vidioc_g_register,
2422 .vidioc_s_register = vidioc_s_register, 2419 .vidioc_s_register = vidioc_s_register,
2423#endif 2420#endif
2424 .tvnorms = SAA7134_NORMS,
2425 .current_norm = V4L2_STD_PAL,
2426}; 2421};
2427 2422
2428struct video_device saa7134_radio_template = 2423static const struct file_operations radio_fops = {
2429{ 2424 .owner = THIS_MODULE,
2430 .name = "saa7134-radio", 2425 .open = video_open,
2431 .type = VID_TYPE_TUNER, 2426 .release = video_release,
2432 .fops = &radio_fops, 2427 .ioctl = video_ioctl2,
2433 .minor = -1, 2428 .compat_ioctl = v4l_compat_ioctl32,
2429 .llseek = no_llseek,
2430};
2431
2432static const struct v4l2_ioctl_ops radio_ioctl_ops = {
2434 .vidioc_querycap = radio_querycap, 2433 .vidioc_querycap = radio_querycap,
2435 .vidioc_g_tuner = radio_g_tuner, 2434 .vidioc_g_tuner = radio_g_tuner,
2436 .vidioc_enum_input = radio_enum_input, 2435 .vidioc_enum_input = radio_enum_input,
@@ -2447,6 +2446,25 @@ struct video_device saa7134_radio_template =
2447 .vidioc_s_frequency = saa7134_s_frequency, 2446 .vidioc_s_frequency = saa7134_s_frequency,
2448}; 2447};
2449 2448
2449/* ----------------------------------------------------------- */
2450/* exported stuff */
2451
2452struct video_device saa7134_video_template = {
2453 .name = "saa7134-video",
2454 .fops = &video_fops,
2455 .ioctl_ops = &video_ioctl_ops,
2456 .minor = -1,
2457 .tvnorms = SAA7134_NORMS,
2458 .current_norm = V4L2_STD_PAL,
2459};
2460
2461struct video_device saa7134_radio_template = {
2462 .name = "saa7134-radio",
2463 .fops = &radio_fops,
2464 .ioctl_ops = &radio_ioctl_ops,
2465 .minor = -1,
2466};
2467
2450int saa7134_video_init1(struct saa7134_dev *dev) 2468int saa7134_video_init1(struct saa7134_dev *dev)
2451{ 2469{
2452 /* sanitycheck insmod options */ 2470 /* sanitycheck insmod options */
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 6927cbea8624..a0884f639f65 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -34,6 +34,7 @@
34#include <asm/io.h> 34#include <asm/io.h>
35 35
36#include <media/v4l2-common.h> 36#include <media/v4l2-common.h>
37#include <media/v4l2-ioctl.h>
37#include <media/tuner.h> 38#include <media/tuner.h>
38#include <media/ir-common.h> 39#include <media/ir-common.h>
39#include <media/ir-kbd-i2c.h> 40#include <media/ir-kbd-i2c.h>
@@ -560,7 +561,7 @@ struct saa7134_dev {
560 /* SAA7134_MPEG_EMPRESS only */ 561 /* SAA7134_MPEG_EMPRESS only */
561 struct video_device *empress_dev; 562 struct video_device *empress_dev;
562 struct videobuf_queue empress_tsq; 563 struct videobuf_queue empress_tsq;
563 unsigned int empress_users; 564 atomic_t empress_users;
564 struct work_struct empress_workqueue; 565 struct work_struct empress_workqueue;
565 int empress_started; 566 int empress_started;
566 567
@@ -662,8 +663,8 @@ extern unsigned int video_debug;
662extern struct video_device saa7134_video_template; 663extern struct video_device saa7134_video_template;
663extern struct video_device saa7134_radio_template; 664extern struct video_device saa7134_radio_template;
664 665
665int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c); 666int saa7134_s_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c);
666int saa7134_s_ctrl(struct file *file, void *f, struct v4l2_control *c); 667int saa7134_g_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c);
667int saa7134_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *c); 668int saa7134_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *c);
668 669
669int saa7134_videoport_init(struct saa7134_dev *dev); 670int saa7134_videoport_init(struct saa7134_dev *dev);
diff --git a/drivers/media/video/saa717x.c b/drivers/media/video/saa717x.c
index 2220f9569941..af60ede5310d 100644
--- a/drivers/media/video/saa717x.c
+++ b/drivers/media/video/saa717x.c
@@ -35,7 +35,6 @@
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/sched.h> 36#include <linux/sched.h>
37 37
38#include <linux/videodev.h>
39#include <linux/videodev2.h> 38#include <linux/videodev2.h>
40#include <linux/i2c.h> 39#include <linux/i2c.h>
41#include <media/v4l2-common.h> 40#include <media/v4l2-common.h>
diff --git a/drivers/media/video/saa7196.h b/drivers/media/video/saa7196.h
index cd4b6354a7b3..e69de29bb2d1 100644
--- a/drivers/media/video/saa7196.h
+++ b/drivers/media/video/saa7196.h
@@ -1,117 +0,0 @@
1/*
2 Definitions for the Philips SAA7196 digital video decoder,
3 scaler, and clock generator circuit (DESCpro), as used in
4 the PlanB video input of the Powermac 7x00/8x00 series.
5
6 Copyright (C) 1998 Michel Lanners (mlan@cpu.lu)
7
8 The register defines are shamelessly copied from the meteor
9 driver out of NetBSD (with permission),
10 and are copyrighted (c) 1995 Mark Tinguely and Jim Lowe
11 (Thanks !)
12
13 Additional debugging and coding by Takashi Oe (toe@unlinfo.unl.edu)
14
15 The default values used for PlanB are my mistakes.
16*/
17
18/* $Id: saa7196.h,v 1.5 1999/03/26 23:28:47 mlan Exp $ */
19
20#ifndef _SAA7196_H_
21#define _SAA7196_H_
22
23#define SAA7196_NUMREGS 0x31 /* Number of registers (used)*/
24#define NUM_SUPPORTED_NORM 3 /* Number of supported norms by PlanB */
25
26/* Decoder part: */
27#define SAA7196_IDEL 0x00 /* Increment delay */
28#define SAA7196_HSB5 0x01 /* H-sync begin; 50 hz */
29#define SAA7196_HSS5 0x02 /* H-sync stop; 50 hz */
30#define SAA7196_HCB5 0x03 /* H-clamp begin; 50 hz */
31#define SAA7196_HCS5 0x04 /* H-clamp stop; 50 hz */
32#define SAA7196_HSP5 0x05 /* H-sync after PHI1; 50 hz */
33#define SAA7196_LUMC 0x06 /* Luminance control */
34#define SAA7196_HUEC 0x07 /* Hue control */
35#define SAA7196_CKTQ 0x08 /* Colour Killer Threshold QAM (PAL, NTSC) */
36#define SAA7196_CKTS 0x09 /* Colour Killer Threshold SECAM */
37#define SAA7196_PALS 0x0a /* PAL switch sensitivity */
38#define SAA7196_SECAMS 0x0b /* SECAM switch sensitivity */
39#define SAA7196_CGAINC 0x0c /* Chroma gain control */
40#define SAA7196_STDC 0x0d /* Standard/Mode control */
41#define SAA7196_IOCC 0x0e /* I/O and Clock Control */
42#define SAA7196_CTRL1 0x0f /* Control #1 */
43#define SAA7196_CTRL2 0x10 /* Control #2 */
44#define SAA7196_CGAINR 0x11 /* Chroma Gain Reference */
45#define SAA7196_CSAT 0x12 /* Chroma Saturation */
46#define SAA7196_CONT 0x13 /* Luminance Contrast */
47#define SAA7196_HSB6 0x14 /* H-sync begin; 60 hz */
48#define SAA7196_HSS6 0x15 /* H-sync stop; 60 hz */
49#define SAA7196_HCB6 0x16 /* H-clamp begin; 60 hz */
50#define SAA7196_HCS6 0x17 /* H-clamp stop; 60 hz */
51#define SAA7196_HSP6 0x18 /* H-sync after PHI1; 60 hz */
52#define SAA7196_BRIG 0x19 /* Luminance Brightness */
53
54/* Scaler part: */
55#define SAA7196_FMTS 0x20 /* Formats and sequence */
56#define SAA7196_OUTPIX 0x21 /* Output data pixel/line */
57#define SAA7196_INPIX 0x22 /* Input data pixel/line */
58#define SAA7196_HWS 0x23 /* Horiz. window start */
59#define SAA7196_HFILT 0x24 /* Horiz. filter */
60#define SAA7196_OUTLINE 0x25 /* Output data lines/field */
61#define SAA7196_INLINE 0x26 /* Input data lines/field */
62#define SAA7196_VWS 0x27 /* Vertical window start */
63#define SAA7196_VYP 0x28 /* AFS/vertical Y processing */
64#define SAA7196_VBS 0x29 /* Vertical Bypass start */
65#define SAA7196_VBCNT 0x2a /* Vertical Bypass count */
66#define SAA7196_VBP 0x2b /* veritcal Bypass Polarity */
67#define SAA7196_VLOW 0x2c /* Colour-keying lower V limit */
68#define SAA7196_VHIGH 0x2d /* Colour-keying upper V limit */
69#define SAA7196_ULOW 0x2e /* Colour-keying lower U limit */
70#define SAA7196_UHIGH 0x2f /* Colour-keying upper U limit */
71#define SAA7196_DPATH 0x30 /* Data path setting */
72
73/* Initialization default values: */
74
75unsigned char saa_regs[NUM_SUPPORTED_NORM][SAA7196_NUMREGS] = {
76
77/* PAL, 768x576 (no scaling), composite video-in */
78/* Decoder: */
79 { 0x50, 0x30, 0x00, 0xe8, 0xb6, 0xe5, 0x63, 0xff,
80 0xfe, 0xf0, 0xfe, 0xe0, 0x20, 0x06, 0x3b, 0x98,
81 0x00, 0x59, 0x41, 0x45, 0x34, 0x0a, 0xf4, 0xd2,
82 0xe9, 0xa2,
83/* Padding */
84 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
85/* Scaler: */
86 0x72, 0x80, 0x00, 0x03, 0x8d, 0x20, 0x20, 0x12,
87 0xa5, 0x12, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00,
88 0x87 },
89
90/* NTSC, 640x480? (no scaling), composite video-in */
91/* Decoder: */
92 { 0x50, 0x30, 0x00, 0xe8, 0xb6, 0xe5, 0x50, 0x00,
93 0xf8, 0xf0, 0xfe, 0xe0, 0x00, 0x06, 0x3b, 0x98,
94 0x00, 0x2c, 0x3d, 0x40, 0x34, 0x0a, 0xf4, 0xd2,
95 0xe9, 0x98,
96/* Padding */
97 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
98/* Scaler: */
99 0x72, 0x80, 0x80, 0x03, 0x89, 0xf0, 0xf0, 0x0d,
100 0xa0, 0x0d, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00,
101 0x87 },
102
103/* SECAM, 768x576 (no scaling), composite video-in */
104/* Decoder: */
105 { 0x50, 0x30, 0x00, 0xe8, 0xb6, 0xe5, 0x63, 0xff,
106 0xfe, 0xf0, 0xfe, 0xe0, 0x20, 0x07, 0x3b, 0x98,
107 0x00, 0x59, 0x41, 0x45, 0x34, 0x0a, 0xf4, 0xd2,
108 0xe9, 0xa2,
109/* Padding */
110 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
111/* Scaler: */
112 0x72, 0x80, 0x00, 0x03, 0x8d, 0x20, 0x20, 0x12,
113 0xa5, 0x12, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00,
114 0x87 }
115 };
116
117#endif /* _SAA7196_H_ */
diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c
index 1cd629380f71..f481277892da 100644
--- a/drivers/media/video/se401.c
+++ b/drivers/media/video/se401.c
@@ -1230,9 +1230,7 @@ static const struct file_operations se401_fops = {
1230 .llseek = no_llseek, 1230 .llseek = no_llseek,
1231}; 1231};
1232static struct video_device se401_template = { 1232static struct video_device se401_template = {
1233 .owner = THIS_MODULE,
1234 .name = "se401 USB camera", 1233 .name = "se401 USB camera",
1235 .type = VID_TYPE_CAPTURE,
1236 .fops = &se401_fops, 1234 .fops = &se401_fops,
1237}; 1235};
1238 1236
diff --git a/drivers/media/video/se401.h b/drivers/media/video/se401.h
index 835ef872e803..2ce685db5d8b 100644
--- a/drivers/media/video/se401.h
+++ b/drivers/media/video/se401.h
@@ -5,6 +5,7 @@
5#include <asm/uaccess.h> 5#include <asm/uaccess.h>
6#include <linux/videodev.h> 6#include <linux/videodev.h>
7#include <media/v4l2-common.h> 7#include <media/v4l2-common.h>
8#include <media/v4l2-ioctl.h>
8#include <linux/mutex.h> 9#include <linux/mutex.h>
9 10
10#define se401_DEBUG /* Turn on debug messages */ 11#define se401_DEBUG /* Turn on debug messages */
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index 012005e1a77b..f7ca3cb9340a 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -91,6 +91,7 @@ struct sh_mobile_ceu_dev {
91 void __iomem *base; 91 void __iomem *base;
92 unsigned long video_limit; 92 unsigned long video_limit;
93 93
94 /* lock used to protect videobuf */
94 spinlock_t lock; 95 spinlock_t lock;
95 struct list_head capture; 96 struct list_head capture;
96 struct videobuf_buffer *active; 97 struct videobuf_buffer *active;
diff --git a/drivers/media/video/sn9c102/sn9c102.h b/drivers/media/video/sn9c102/sn9c102.h
index 0c8d87d8d18d..cbfc44433b99 100644
--- a/drivers/media/video/sn9c102/sn9c102.h
+++ b/drivers/media/video/sn9c102/sn9c102.h
@@ -25,6 +25,7 @@
25#include <linux/usb.h> 25#include <linux/usb.h>
26#include <linux/videodev2.h> 26#include <linux/videodev2.h>
27#include <media/v4l2-common.h> 27#include <media/v4l2-common.h>
28#include <media/v4l2-ioctl.h>
28#include <linux/device.h> 29#include <linux/device.h>
29#include <linux/list.h> 30#include <linux/list.h>
30#include <linux/spinlock.h> 31#include <linux/spinlock.h>
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c
index 7f9c7bcf3c85..23408764d0ef 100644
--- a/drivers/media/video/sn9c102/sn9c102_core.c
+++ b/drivers/media/video/sn9c102/sn9c102_core.c
@@ -1038,8 +1038,7 @@ static ssize_t sn9c102_show_reg(struct device* cd,
1038 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1038 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1039 return -ERESTARTSYS; 1039 return -ERESTARTSYS;
1040 1040
1041 cam = video_get_drvdata(container_of(cd, struct video_device, 1041 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1042 class_dev));
1043 if (!cam) { 1042 if (!cam) {
1044 mutex_unlock(&sn9c102_sysfs_lock); 1043 mutex_unlock(&sn9c102_sysfs_lock);
1045 return -ENODEV; 1044 return -ENODEV;
@@ -1064,8 +1063,7 @@ sn9c102_store_reg(struct device* cd, struct device_attribute *attr,
1064 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1063 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1065 return -ERESTARTSYS; 1064 return -ERESTARTSYS;
1066 1065
1067 cam = video_get_drvdata(container_of(cd, struct video_device, 1066 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1068 class_dev));
1069 if (!cam) { 1067 if (!cam) {
1070 mutex_unlock(&sn9c102_sysfs_lock); 1068 mutex_unlock(&sn9c102_sysfs_lock);
1071 return -ENODEV; 1069 return -ENODEV;
@@ -1098,8 +1096,7 @@ static ssize_t sn9c102_show_val(struct device* cd,
1098 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1096 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1099 return -ERESTARTSYS; 1097 return -ERESTARTSYS;
1100 1098
1101 cam = video_get_drvdata(container_of(cd, struct video_device, 1099 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1102 class_dev));
1103 if (!cam) { 1100 if (!cam) {
1104 mutex_unlock(&sn9c102_sysfs_lock); 1101 mutex_unlock(&sn9c102_sysfs_lock);
1105 return -ENODEV; 1102 return -ENODEV;
@@ -1132,8 +1129,7 @@ sn9c102_store_val(struct device* cd, struct device_attribute *attr,
1132 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1129 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1133 return -ERESTARTSYS; 1130 return -ERESTARTSYS;
1134 1131
1135 cam = video_get_drvdata(container_of(cd, struct video_device, 1132 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1136 class_dev));
1137 if (!cam) { 1133 if (!cam) {
1138 mutex_unlock(&sn9c102_sysfs_lock); 1134 mutex_unlock(&sn9c102_sysfs_lock);
1139 return -ENODEV; 1135 return -ENODEV;
@@ -1170,8 +1166,7 @@ static ssize_t sn9c102_show_i2c_reg(struct device* cd,
1170 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1166 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1171 return -ERESTARTSYS; 1167 return -ERESTARTSYS;
1172 1168
1173 cam = video_get_drvdata(container_of(cd, struct video_device, 1169 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1174 class_dev));
1175 if (!cam) { 1170 if (!cam) {
1176 mutex_unlock(&sn9c102_sysfs_lock); 1171 mutex_unlock(&sn9c102_sysfs_lock);
1177 return -ENODEV; 1172 return -ENODEV;
@@ -1198,8 +1193,7 @@ sn9c102_store_i2c_reg(struct device* cd, struct device_attribute *attr,
1198 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1193 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1199 return -ERESTARTSYS; 1194 return -ERESTARTSYS;
1200 1195
1201 cam = video_get_drvdata(container_of(cd, struct video_device, 1196 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1202 class_dev));
1203 if (!cam) { 1197 if (!cam) {
1204 mutex_unlock(&sn9c102_sysfs_lock); 1198 mutex_unlock(&sn9c102_sysfs_lock);
1205 return -ENODEV; 1199 return -ENODEV;
@@ -1232,8 +1226,7 @@ static ssize_t sn9c102_show_i2c_val(struct device* cd,
1232 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1226 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1233 return -ERESTARTSYS; 1227 return -ERESTARTSYS;
1234 1228
1235 cam = video_get_drvdata(container_of(cd, struct video_device, 1229 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1236 class_dev));
1237 if (!cam) { 1230 if (!cam) {
1238 mutex_unlock(&sn9c102_sysfs_lock); 1231 mutex_unlock(&sn9c102_sysfs_lock);
1239 return -ENODEV; 1232 return -ENODEV;
@@ -1271,8 +1264,7 @@ sn9c102_store_i2c_val(struct device* cd, struct device_attribute *attr,
1271 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1264 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1272 return -ERESTARTSYS; 1265 return -ERESTARTSYS;
1273 1266
1274 cam = video_get_drvdata(container_of(cd, struct video_device, 1267 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1275 class_dev));
1276 if (!cam) { 1268 if (!cam) {
1277 mutex_unlock(&sn9c102_sysfs_lock); 1269 mutex_unlock(&sn9c102_sysfs_lock);
1278 return -ENODEV; 1270 return -ENODEV;
@@ -1318,8 +1310,7 @@ sn9c102_store_green(struct device* cd, struct device_attribute *attr,
1318 if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) 1310 if (mutex_lock_interruptible(&sn9c102_sysfs_lock))
1319 return -ERESTARTSYS; 1311 return -ERESTARTSYS;
1320 1312
1321 cam = video_get_drvdata(container_of(cd, struct video_device, 1313 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1322 class_dev));
1323 if (!cam) { 1314 if (!cam) {
1324 mutex_unlock(&sn9c102_sysfs_lock); 1315 mutex_unlock(&sn9c102_sysfs_lock);
1325 return -ENODEV; 1316 return -ENODEV;
@@ -1400,8 +1391,7 @@ static ssize_t sn9c102_show_frame_header(struct device* cd,
1400 struct sn9c102_device* cam; 1391 struct sn9c102_device* cam;
1401 ssize_t count; 1392 ssize_t count;
1402 1393
1403 cam = video_get_drvdata(container_of(cd, struct video_device, 1394 cam = video_get_drvdata(container_of(cd, struct video_device, dev));
1404 class_dev));
1405 if (!cam) 1395 if (!cam)
1406 return -ENODEV; 1396 return -ENODEV;
1407 1397
@@ -1428,49 +1418,49 @@ static DEVICE_ATTR(frame_header, S_IRUGO, sn9c102_show_frame_header, NULL);
1428 1418
1429static int sn9c102_create_sysfs(struct sn9c102_device* cam) 1419static int sn9c102_create_sysfs(struct sn9c102_device* cam)
1430{ 1420{
1431 struct device *classdev = &(cam->v4ldev->class_dev); 1421 struct device *dev = &(cam->v4ldev->dev);
1432 int err = 0; 1422 int err = 0;
1433 1423
1434 if ((err = device_create_file(classdev, &dev_attr_reg))) 1424 if ((err = device_create_file(dev, &dev_attr_reg)))
1435 goto err_out; 1425 goto err_out;
1436 if ((err = device_create_file(classdev, &dev_attr_val))) 1426 if ((err = device_create_file(dev, &dev_attr_val)))
1437 goto err_reg; 1427 goto err_reg;
1438 if ((err = device_create_file(classdev, &dev_attr_frame_header))) 1428 if ((err = device_create_file(dev, &dev_attr_frame_header)))
1439 goto err_val; 1429 goto err_val;
1440 1430
1441 if (cam->sensor.sysfs_ops) { 1431 if (cam->sensor.sysfs_ops) {
1442 if ((err = device_create_file(classdev, &dev_attr_i2c_reg))) 1432 if ((err = device_create_file(dev, &dev_attr_i2c_reg)))
1443 goto err_frame_header; 1433 goto err_frame_header;
1444 if ((err = device_create_file(classdev, &dev_attr_i2c_val))) 1434 if ((err = device_create_file(dev, &dev_attr_i2c_val)))
1445 goto err_i2c_reg; 1435 goto err_i2c_reg;
1446 } 1436 }
1447 1437
1448 if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) { 1438 if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) {
1449 if ((err = device_create_file(classdev, &dev_attr_green))) 1439 if ((err = device_create_file(dev, &dev_attr_green)))
1450 goto err_i2c_val; 1440 goto err_i2c_val;
1451 } else { 1441 } else {
1452 if ((err = device_create_file(classdev, &dev_attr_blue))) 1442 if ((err = device_create_file(dev, &dev_attr_blue)))
1453 goto err_i2c_val; 1443 goto err_i2c_val;
1454 if ((err = device_create_file(classdev, &dev_attr_red))) 1444 if ((err = device_create_file(dev, &dev_attr_red)))
1455 goto err_blue; 1445 goto err_blue;
1456 } 1446 }
1457 1447
1458 return 0; 1448 return 0;
1459 1449
1460err_blue: 1450err_blue:
1461 device_remove_file(classdev, &dev_attr_blue); 1451 device_remove_file(dev, &dev_attr_blue);
1462err_i2c_val: 1452err_i2c_val:
1463 if (cam->sensor.sysfs_ops) 1453 if (cam->sensor.sysfs_ops)
1464 device_remove_file(classdev, &dev_attr_i2c_val); 1454 device_remove_file(dev, &dev_attr_i2c_val);
1465err_i2c_reg: 1455err_i2c_reg:
1466 if (cam->sensor.sysfs_ops) 1456 if (cam->sensor.sysfs_ops)
1467 device_remove_file(classdev, &dev_attr_i2c_reg); 1457 device_remove_file(dev, &dev_attr_i2c_reg);
1468err_frame_header: 1458err_frame_header:
1469 device_remove_file(classdev, &dev_attr_frame_header); 1459 device_remove_file(dev, &dev_attr_frame_header);
1470err_val: 1460err_val:
1471 device_remove_file(classdev, &dev_attr_val); 1461 device_remove_file(dev, &dev_attr_val);
1472err_reg: 1462err_reg:
1473 device_remove_file(classdev, &dev_attr_reg); 1463 device_remove_file(dev, &dev_attr_reg);
1474err_out: 1464err_out:
1475 return err; 1465 return err;
1476} 1466}
@@ -3319,8 +3309,6 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
3319 } 3309 }
3320 3310
3321 strcpy(cam->v4ldev->name, "SN9C1xx PC Camera"); 3311 strcpy(cam->v4ldev->name, "SN9C1xx PC Camera");
3322 cam->v4ldev->owner = THIS_MODULE;
3323 cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES;
3324 cam->v4ldev->fops = &sn9c102_fops; 3312 cam->v4ldev->fops = &sn9c102_fops;
3325 cam->v4ldev->minor = video_nr[dev_nr]; 3313 cam->v4ldev->minor = video_nr[dev_nr];
3326 cam->v4ldev->release = video_device_release; 3314 cam->v4ldev->release = video_device_release;
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index e39b98f1eca4..b6be5ee678b6 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -25,6 +25,7 @@
25#include <linux/vmalloc.h> 25#include <linux/vmalloc.h>
26 26
27#include <media/v4l2-common.h> 27#include <media/v4l2-common.h>
28#include <media/v4l2-ioctl.h>
28#include <media/v4l2-dev.h> 29#include <media/v4l2-dev.h>
29#include <media/videobuf-core.h> 30#include <media/videobuf-core.h>
30#include <media/soc_camera.h> 31#include <media/soc_camera.h>
@@ -193,7 +194,7 @@ static int soc_camera_open(struct inode *inode, struct file *file)
193 mutex_lock(&video_lock); 194 mutex_lock(&video_lock);
194 195
195 vdev = video_devdata(file); 196 vdev = video_devdata(file);
196 icd = container_of(vdev->dev, struct soc_camera_device, dev); 197 icd = container_of(vdev->parent, struct soc_camera_device, dev);
197 ici = to_soc_camera_host(icd->dev.parent); 198 ici = to_soc_camera_host(icd->dev.parent);
198 199
199 if (!try_module_get(icd->ops->owner)) { 200 if (!try_module_get(icd->ops->owner)) {
@@ -258,7 +259,7 @@ static int soc_camera_close(struct inode *inode, struct file *file)
258 259
259 vfree(icf); 260 vfree(icf);
260 261
261 dev_dbg(vdev->dev, "camera device close\n"); 262 dev_dbg(vdev->parent, "camera device close\n");
262 263
263 return 0; 264 return 0;
264} 265}
@@ -271,7 +272,7 @@ static ssize_t soc_camera_read(struct file *file, char __user *buf,
271 struct video_device *vdev = icd->vdev; 272 struct video_device *vdev = icd->vdev;
272 int err = -EINVAL; 273 int err = -EINVAL;
273 274
274 dev_err(vdev->dev, "camera device read not implemented\n"); 275 dev_err(vdev->parent, "camera device read not implemented\n");
275 276
276 return err; 277 return err;
277} 278}
@@ -861,6 +862,35 @@ void soc_camera_device_unregister(struct soc_camera_device *icd)
861} 862}
862EXPORT_SYMBOL(soc_camera_device_unregister); 863EXPORT_SYMBOL(soc_camera_device_unregister);
863 864
865static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = {
866 .vidioc_querycap = soc_camera_querycap,
867 .vidioc_g_fmt_vid_cap = soc_camera_g_fmt_vid_cap,
868 .vidioc_enum_fmt_vid_cap = soc_camera_enum_fmt_vid_cap,
869 .vidioc_s_fmt_vid_cap = soc_camera_s_fmt_vid_cap,
870 .vidioc_enum_input = soc_camera_enum_input,
871 .vidioc_g_input = soc_camera_g_input,
872 .vidioc_s_input = soc_camera_s_input,
873 .vidioc_s_std = soc_camera_s_std,
874 .vidioc_reqbufs = soc_camera_reqbufs,
875 .vidioc_try_fmt_vid_cap = soc_camera_try_fmt_vid_cap,
876 .vidioc_querybuf = soc_camera_querybuf,
877 .vidioc_qbuf = soc_camera_qbuf,
878 .vidioc_dqbuf = soc_camera_dqbuf,
879 .vidioc_streamon = soc_camera_streamon,
880 .vidioc_streamoff = soc_camera_streamoff,
881 .vidioc_queryctrl = soc_camera_queryctrl,
882 .vidioc_g_ctrl = soc_camera_g_ctrl,
883 .vidioc_s_ctrl = soc_camera_s_ctrl,
884 .vidioc_cropcap = soc_camera_cropcap,
885 .vidioc_g_crop = soc_camera_g_crop,
886 .vidioc_s_crop = soc_camera_s_crop,
887 .vidioc_g_chip_ident = soc_camera_g_chip_ident,
888#ifdef CONFIG_VIDEO_ADV_DEBUG
889 .vidioc_g_register = soc_camera_g_register,
890 .vidioc_s_register = soc_camera_s_register,
891#endif
892};
893
864int soc_camera_video_start(struct soc_camera_device *icd) 894int soc_camera_video_start(struct soc_camera_device *icd)
865{ 895{
866 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 896 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
@@ -877,45 +907,19 @@ int soc_camera_video_start(struct soc_camera_device *icd)
877 907
878 strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name)); 908 strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name));
879 /* Maybe better &ici->dev */ 909 /* Maybe better &ici->dev */
880 vdev->dev = &icd->dev; 910 vdev->parent = &icd->dev;
881 vdev->type = VID_TYPE_CAPTURE;
882 vdev->current_norm = V4L2_STD_UNKNOWN; 911 vdev->current_norm = V4L2_STD_UNKNOWN;
883 vdev->fops = &soc_camera_fops; 912 vdev->fops = &soc_camera_fops;
913 vdev->ioctl_ops = &soc_camera_ioctl_ops;
884 vdev->release = video_device_release; 914 vdev->release = video_device_release;
885 vdev->minor = -1; 915 vdev->minor = -1;
886 vdev->tvnorms = V4L2_STD_UNKNOWN, 916 vdev->tvnorms = V4L2_STD_UNKNOWN,
887 vdev->vidioc_querycap = soc_camera_querycap;
888 vdev->vidioc_g_fmt_vid_cap = soc_camera_g_fmt_vid_cap;
889 vdev->vidioc_enum_fmt_vid_cap = soc_camera_enum_fmt_vid_cap;
890 vdev->vidioc_s_fmt_vid_cap = soc_camera_s_fmt_vid_cap;
891 vdev->vidioc_enum_input = soc_camera_enum_input;
892 vdev->vidioc_g_input = soc_camera_g_input;
893 vdev->vidioc_s_input = soc_camera_s_input;
894 vdev->vidioc_s_std = soc_camera_s_std;
895 vdev->vidioc_reqbufs = soc_camera_reqbufs;
896 vdev->vidioc_try_fmt_vid_cap = soc_camera_try_fmt_vid_cap;
897 vdev->vidioc_querybuf = soc_camera_querybuf;
898 vdev->vidioc_qbuf = soc_camera_qbuf;
899 vdev->vidioc_dqbuf = soc_camera_dqbuf;
900 vdev->vidioc_streamon = soc_camera_streamon;
901 vdev->vidioc_streamoff = soc_camera_streamoff;
902 vdev->vidioc_queryctrl = soc_camera_queryctrl;
903 vdev->vidioc_g_ctrl = soc_camera_g_ctrl;
904 vdev->vidioc_s_ctrl = soc_camera_s_ctrl;
905 vdev->vidioc_cropcap = soc_camera_cropcap;
906 vdev->vidioc_g_crop = soc_camera_g_crop;
907 vdev->vidioc_s_crop = soc_camera_s_crop;
908 vdev->vidioc_g_chip_ident = soc_camera_g_chip_ident;
909#ifdef CONFIG_VIDEO_ADV_DEBUG
910 vdev->vidioc_g_register = soc_camera_g_register;
911 vdev->vidioc_s_register = soc_camera_s_register;
912#endif
913 917
914 icd->current_fmt = &icd->formats[0]; 918 icd->current_fmt = &icd->formats[0];
915 919
916 err = video_register_device(vdev, VFL_TYPE_GRABBER, vdev->minor); 920 err = video_register_device(vdev, VFL_TYPE_GRABBER, vdev->minor);
917 if (err < 0) { 921 if (err < 0) {
918 dev_err(vdev->dev, "video_register_device failed\n"); 922 dev_err(vdev->parent, "video_register_device failed\n");
919 goto evidregd; 923 goto evidregd;
920 } 924 }
921 icd->vdev = vdev; 925 icd->vdev = vdev;
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c
index f308c38d744f..ad36af30e099 100644
--- a/drivers/media/video/stk-webcam.c
+++ b/drivers/media/video/stk-webcam.c
@@ -34,6 +34,7 @@
34#include <linux/vmalloc.h> 34#include <linux/vmalloc.h>
35#include <linux/videodev2.h> 35#include <linux/videodev2.h>
36#include <media/v4l2-common.h> 36#include <media/v4l2-common.h>
37#include <media/v4l2-ioctl.h>
37 38
38#include "stk-webcam.h" 39#include "stk-webcam.h"
39 40
@@ -340,17 +341,19 @@ static int stk_create_sysfs_files(struct video_device *vdev)
340{ 341{
341 int ret; 342 int ret;
342 343
343 ret = video_device_create_file(vdev, &dev_attr_brightness); 344 ret = device_create_file(&vdev->dev, &dev_attr_brightness);
344 ret += video_device_create_file(vdev, &dev_attr_hflip); 345 ret += device_create_file(&vdev->dev, &dev_attr_hflip);
345 ret += video_device_create_file(vdev, &dev_attr_vflip); 346 ret += device_create_file(&vdev->dev, &dev_attr_vflip);
347 if (ret)
348 STK_WARNING("Could not create sysfs files\n");
346 return ret; 349 return ret;
347} 350}
348 351
349static void stk_remove_sysfs_files(struct video_device *vdev) 352static void stk_remove_sysfs_files(struct video_device *vdev)
350{ 353{
351 video_device_remove_file(vdev, &dev_attr_brightness); 354 device_remove_file(&vdev->dev, &dev_attr_brightness);
352 video_device_remove_file(vdev, &dev_attr_hflip); 355 device_remove_file(&vdev->dev, &dev_attr_hflip);
353 video_device_remove_file(vdev, &dev_attr_vflip); 356 device_remove_file(&vdev->dev, &dev_attr_vflip);
354} 357}
355 358
356#else 359#else
@@ -442,18 +445,19 @@ static void stk_isoc_handler(struct urb *urb)
442 fb->v4lbuf.bytesused = 0; 445 fb->v4lbuf.bytesused = 0;
443 fill = fb->buffer; 446 fill = fb->buffer;
444 } else if (fb->v4lbuf.bytesused == dev->frame_size) { 447 } else if (fb->v4lbuf.bytesused == dev->frame_size) {
445 list_move_tail(dev->sio_avail.next, 448 if (list_is_singular(&dev->sio_avail)) {
446 &dev->sio_full); 449 /* Always reuse the last buffer */
447 wake_up(&dev->wait_frame); 450 fb->v4lbuf.bytesused = 0;
448 if (list_empty(&dev->sio_avail)) { 451 fill = fb->buffer;
449 (void) (printk_ratelimit() && 452 } else {
450 STK_ERROR("No buffer available\n")); 453 list_move_tail(dev->sio_avail.next,
451 goto resubmit; 454 &dev->sio_full);
455 wake_up(&dev->wait_frame);
456 fb = list_first_entry(&dev->sio_avail,
457 struct stk_sio_buffer, list);
458 fb->v4lbuf.bytesused = 0;
459 fill = fb->buffer;
452 } 460 }
453 fb = list_first_entry(&dev->sio_avail,
454 struct stk_sio_buffer, list);
455 fb->v4lbuf.bytesused = 0;
456 fill = fb->buffer;
457 } 461 }
458 } else { 462 } else {
459 framelen -= 4; 463 framelen -= 4;
@@ -1327,20 +1331,7 @@ static struct file_operations v4l_stk_fops = {
1327 .llseek = no_llseek 1331 .llseek = no_llseek
1328}; 1332};
1329 1333
1330static void stk_v4l_dev_release(struct video_device *vd) 1334static const struct v4l2_ioctl_ops v4l_stk_ioctl_ops = {
1331{
1332}
1333
1334static struct video_device stk_v4l_data = {
1335 .name = "stkwebcam",
1336 .type = VFL_TYPE_GRABBER,
1337 .type2 = VID_TYPE_CAPTURE,
1338 .minor = -1,
1339 .tvnorms = V4L2_STD_UNKNOWN,
1340 .current_norm = V4L2_STD_UNKNOWN,
1341 .fops = &v4l_stk_fops,
1342 .release = stk_v4l_dev_release,
1343
1344 .vidioc_querycap = stk_vidioc_querycap, 1335 .vidioc_querycap = stk_vidioc_querycap,
1345 .vidioc_enum_fmt_vid_cap = stk_vidioc_enum_fmt_vid_cap, 1336 .vidioc_enum_fmt_vid_cap = stk_vidioc_enum_fmt_vid_cap,
1346 .vidioc_try_fmt_vid_cap = stk_vidioc_try_fmt_vid_cap, 1337 .vidioc_try_fmt_vid_cap = stk_vidioc_try_fmt_vid_cap,
@@ -1362,6 +1353,20 @@ static struct video_device stk_v4l_data = {
1362 .vidioc_g_parm = stk_vidioc_g_parm, 1353 .vidioc_g_parm = stk_vidioc_g_parm,
1363}; 1354};
1364 1355
1356static void stk_v4l_dev_release(struct video_device *vd)
1357{
1358}
1359
1360static struct video_device stk_v4l_data = {
1361 .name = "stkwebcam",
1362 .minor = -1,
1363 .tvnorms = V4L2_STD_UNKNOWN,
1364 .current_norm = V4L2_STD_UNKNOWN,
1365 .fops = &v4l_stk_fops,
1366 .ioctl_ops = &v4l_stk_ioctl_ops,
1367 .release = stk_v4l_dev_release,
1368};
1369
1365 1370
1366static int stk_register_video_device(struct stk_camera *dev) 1371static int stk_register_video_device(struct stk_camera *dev)
1367{ 1372{
@@ -1369,7 +1374,7 @@ static int stk_register_video_device(struct stk_camera *dev)
1369 1374
1370 dev->vdev = stk_v4l_data; 1375 dev->vdev = stk_v4l_data;
1371 dev->vdev.debug = debug; 1376 dev->vdev.debug = debug;
1372 dev->vdev.dev = &dev->interface->dev; 1377 dev->vdev.parent = &dev->interface->dev;
1373 dev->vdev.priv = dev; 1378 dev->vdev.priv = dev;
1374 err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1); 1379 err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1);
1375 if (err) 1380 if (err)
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
index c109511f21ea..276bded06ab3 100644
--- a/drivers/media/video/stradis.c
+++ b/drivers/media/video/stradis.c
@@ -43,6 +43,7 @@
43#include <linux/vmalloc.h> 43#include <linux/vmalloc.h>
44#include <linux/videodev.h> 44#include <linux/videodev.h>
45#include <media/v4l2-common.h> 45#include <media/v4l2-common.h>
46#include <media/v4l2-ioctl.h>
46 47
47#include "saa7146.h" 48#include "saa7146.h"
48#include "saa7146reg.h" 49#include "saa7146reg.h"
@@ -1918,7 +1919,6 @@ static const struct file_operations saa_fops = {
1918/* template for video_device-structure */ 1919/* template for video_device-structure */
1919static struct video_device saa_template = { 1920static struct video_device saa_template = {
1920 .name = "SAA7146A", 1921 .name = "SAA7146A",
1921 .type = VID_TYPE_CAPTURE | VID_TYPE_OVERLAY,
1922 .fops = &saa_fops, 1922 .fops = &saa_fops,
1923 .minor = -1, 1923 .minor = -1,
1924}; 1924};
diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c
index d7f130bedb5f..56dc3d6b5b29 100644
--- a/drivers/media/video/stv680.c
+++ b/drivers/media/video/stv680.c
@@ -66,6 +66,7 @@
66#include <linux/errno.h> 66#include <linux/errno.h>
67#include <linux/videodev.h> 67#include <linux/videodev.h>
68#include <media/v4l2-common.h> 68#include <media/v4l2-common.h>
69#include <media/v4l2-ioctl.h>
69#include <linux/usb.h> 70#include <linux/usb.h>
70#include <linux/mutex.h> 71#include <linux/mutex.h>
71 72
@@ -524,53 +525,54 @@ static int stv680_create_sysfs_files(struct video_device *vdev)
524{ 525{
525 int rc; 526 int rc;
526 527
527 rc = video_device_create_file(vdev, &dev_attr_model); 528 rc = device_create_file(&vdev->dev, &dev_attr_model);
528 if (rc) goto err; 529 if (rc) goto err;
529 rc = video_device_create_file(vdev, &dev_attr_in_use); 530 rc = device_create_file(&vdev->dev, &dev_attr_in_use);
530 if (rc) goto err_model; 531 if (rc) goto err_model;
531 rc = video_device_create_file(vdev, &dev_attr_streaming); 532 rc = device_create_file(&vdev->dev, &dev_attr_streaming);
532 if (rc) goto err_inuse; 533 if (rc) goto err_inuse;
533 rc = video_device_create_file(vdev, &dev_attr_palette); 534 rc = device_create_file(&vdev->dev, &dev_attr_palette);
534 if (rc) goto err_stream; 535 if (rc) goto err_stream;
535 rc = video_device_create_file(vdev, &dev_attr_frames_total); 536 rc = device_create_file(&vdev->dev, &dev_attr_frames_total);
536 if (rc) goto err_pal; 537 if (rc) goto err_pal;
537 rc = video_device_create_file(vdev, &dev_attr_frames_read); 538 rc = device_create_file(&vdev->dev, &dev_attr_frames_read);
538 if (rc) goto err_framtot; 539 if (rc) goto err_framtot;
539 rc = video_device_create_file(vdev, &dev_attr_packets_dropped); 540 rc = device_create_file(&vdev->dev, &dev_attr_packets_dropped);
540 if (rc) goto err_framread; 541 if (rc) goto err_framread;
541 rc = video_device_create_file(vdev, &dev_attr_decoding_errors); 542 rc = device_create_file(&vdev->dev, &dev_attr_decoding_errors);
542 if (rc) goto err_dropped; 543 if (rc) goto err_dropped;
543 544
544 return 0; 545 return 0;
545 546
546err_dropped: 547err_dropped:
547 video_device_remove_file(vdev, &dev_attr_packets_dropped); 548 device_remove_file(&vdev->dev, &dev_attr_packets_dropped);
548err_framread: 549err_framread:
549 video_device_remove_file(vdev, &dev_attr_frames_read); 550 device_remove_file(&vdev->dev, &dev_attr_frames_read);
550err_framtot: 551err_framtot:
551 video_device_remove_file(vdev, &dev_attr_frames_total); 552 device_remove_file(&vdev->dev, &dev_attr_frames_total);
552err_pal: 553err_pal:
553 video_device_remove_file(vdev, &dev_attr_palette); 554 device_remove_file(&vdev->dev, &dev_attr_palette);
554err_stream: 555err_stream:
555 video_device_remove_file(vdev, &dev_attr_streaming); 556 device_remove_file(&vdev->dev, &dev_attr_streaming);
556err_inuse: 557err_inuse:
557 video_device_remove_file(vdev, &dev_attr_in_use); 558 device_remove_file(&vdev->dev, &dev_attr_in_use);
558err_model: 559err_model:
559 video_device_remove_file(vdev, &dev_attr_model); 560 device_remove_file(&vdev->dev, &dev_attr_model);
560err: 561err:
562 PDEBUG(0, "STV(e): Could not create sysfs files");
561 return rc; 563 return rc;
562} 564}
563 565
564static void stv680_remove_sysfs_files(struct video_device *vdev) 566static void stv680_remove_sysfs_files(struct video_device *vdev)
565{ 567{
566 video_device_remove_file(vdev, &dev_attr_model); 568 device_remove_file(&vdev->dev, &dev_attr_model);
567 video_device_remove_file(vdev, &dev_attr_in_use); 569 device_remove_file(&vdev->dev, &dev_attr_in_use);
568 video_device_remove_file(vdev, &dev_attr_streaming); 570 device_remove_file(&vdev->dev, &dev_attr_streaming);
569 video_device_remove_file(vdev, &dev_attr_palette); 571 device_remove_file(&vdev->dev, &dev_attr_palette);
570 video_device_remove_file(vdev, &dev_attr_frames_total); 572 device_remove_file(&vdev->dev, &dev_attr_frames_total);
571 video_device_remove_file(vdev, &dev_attr_frames_read); 573 device_remove_file(&vdev->dev, &dev_attr_frames_read);
572 video_device_remove_file(vdev, &dev_attr_packets_dropped); 574 device_remove_file(&vdev->dev, &dev_attr_packets_dropped);
573 video_device_remove_file(vdev, &dev_attr_decoding_errors); 575 device_remove_file(&vdev->dev, &dev_attr_decoding_errors);
574} 576}
575 577
576/******************************************************************** 578/********************************************************************
@@ -1400,9 +1402,7 @@ static const struct file_operations stv680_fops = {
1400 .llseek = no_llseek, 1402 .llseek = no_llseek,
1401}; 1403};
1402static struct video_device stv680_template = { 1404static struct video_device stv680_template = {
1403 .owner = THIS_MODULE,
1404 .name = "STV0680 USB camera", 1405 .name = "STV0680 USB camera",
1405 .type = VID_TYPE_CAPTURE,
1406 .fops = &stv680_fops, 1406 .fops = &stv680_fops,
1407 .release = video_device_release, 1407 .release = video_device_release,
1408 .minor = -1, 1408 .minor = -1,
@@ -1454,7 +1454,7 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id
1454 goto error; 1454 goto error;
1455 } 1455 }
1456 memcpy(stv680->vdev, &stv680_template, sizeof(stv680_template)); 1456 memcpy(stv680->vdev, &stv680_template, sizeof(stv680_template));
1457 stv680->vdev->dev = &intf->dev; 1457 stv680->vdev->parent = &intf->dev;
1458 video_set_drvdata(stv680->vdev, stv680); 1458 video_set_drvdata(stv680->vdev, stv680);
1459 1459
1460 memcpy (stv680->vdev->name, stv680->camera_name, strlen (stv680->camera_name)); 1460 memcpy (stv680->vdev->name, stv680->camera_name, strlen (stv680->camera_name));
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c
index ae75c187da79..4963d4264880 100644
--- a/drivers/media/video/tda7432.c
+++ b/drivers/media/video/tda7432.c
@@ -44,10 +44,11 @@
44#include <linux/delay.h> 44#include <linux/delay.h>
45#include <linux/errno.h> 45#include <linux/errno.h>
46#include <linux/slab.h> 46#include <linux/slab.h>
47#include <linux/videodev.h> 47#include <linux/videodev2.h>
48#include <linux/i2c.h> 48#include <linux/i2c.h>
49 49
50#include <media/v4l2-common.h> 50#include <media/v4l2-common.h>
51#include <media/v4l2-ioctl.h>
51#include <media/i2c-addr.h> 52#include <media/i2c-addr.h>
52 53
53#ifndef VIDEO_AUDIO_BALANCE 54#ifndef VIDEO_AUDIO_BALANCE
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c
index 7a8ce8fb46dc..792f0b079909 100644
--- a/drivers/media/video/tda9875.c
+++ b/drivers/media/video/tda9875.c
@@ -25,7 +25,7 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/errno.h> 26#include <linux/errno.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/videodev.h> 28#include <linux/videodev2.h>
29#include <media/v4l2-common.h> 29#include <media/v4l2-common.h>
30#include <linux/i2c.h> 30#include <linux/i2c.h>
31#include <linux/init.h> 31#include <linux/init.h>
diff --git a/drivers/media/video/tlv320aic23b.c b/drivers/media/video/tlv320aic23b.c
index 9220378a5637..281065b9dd2d 100644
--- a/drivers/media/video/tlv320aic23b.c
+++ b/drivers/media/video/tlv320aic23b.c
@@ -29,7 +29,7 @@
29#include <asm/uaccess.h> 29#include <asm/uaccess.h>
30#include <linux/i2c.h> 30#include <linux/i2c.h>
31#include <linux/i2c-id.h> 31#include <linux/i2c-id.h>
32#include <linux/videodev.h> 32#include <linux/videodev2.h>
33#include <media/v4l2-common.h> 33#include <media/v4l2-common.h>
34#include <media/v4l2-i2c-drv-legacy.h> 34#include <media/v4l2-i2c-drv-legacy.h>
35 35
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 93d879dc510f..d806a3556eed 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -19,6 +19,7 @@
19#include <media/tuner.h> 19#include <media/tuner.h>
20#include <media/tuner-types.h> 20#include <media/tuner-types.h>
21#include <media/v4l2-common.h> 21#include <media/v4l2-common.h>
22#include <media/v4l2-ioctl.h>
22#include <media/v4l2-i2c-drv-legacy.h> 23#include <media/v4l2-i2c-drv-legacy.h>
23#include "mt20xx.h" 24#include "mt20xx.h"
24#include "tda8290.h" 25#include "tda8290.h"
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 9da0e1807ffb..bcc32fa92a81 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -34,13 +34,13 @@
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/videodev.h> 37#include <linux/videodev2.h>
38#include <linux/i2c.h> 38#include <linux/i2c.h>
39 39
40#include <media/tuner.h> 40#include <media/tuner.h>
41#include <media/tveeprom.h> 41#include <media/tveeprom.h>
42#include <media/v4l2-common.h> 42#include <media/v4l2-common.h>
43#include <media/audiochip.h> 43#include <media/v4l2-chip-ident.h>
44 44
45MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver"); 45MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver");
46MODULE_AUTHOR("John Klar"); 46MODULE_AUTHOR("John Klar");
@@ -261,70 +261,72 @@ hauppauge_tuner[] =
261 { TUNER_ABSENT, "MaxLinear MXL5005_v2"}, 261 { TUNER_ABSENT, "MaxLinear MXL5005_v2"},
262 { TUNER_PHILIPS_TDA8290, "Philips 18271_8295"}, 262 { TUNER_PHILIPS_TDA8290, "Philips 18271_8295"},
263 /* 150-159 */ 263 /* 150-159 */
264 { TUNER_ABSENT, "Xceive XC5000"}, 264 { TUNER_ABSENT, "Xceive XC5000"},
265}; 265};
266 266
267/* Use V4L2_IDENT_AMBIGUOUS for those audio 'chips' that are
268 * internal to a video chip, i.e. not a separate audio chip. */
267static struct HAUPPAUGE_AUDIOIC 269static struct HAUPPAUGE_AUDIOIC
268{ 270{
269 enum audiochip id; 271 u32 id;
270 char *name; 272 char *name;
271} 273}
272audioIC[] = 274audioIC[] =
273{ 275{
274 /* 0-4 */ 276 /* 0-4 */
275 {AUDIO_CHIP_NONE, "None"}, 277 { V4L2_IDENT_NONE, "None" },
276 {AUDIO_CHIP_TEA6300, "TEA6300"}, 278 { V4L2_IDENT_UNKNOWN, "TEA6300" },
277 {AUDIO_CHIP_TEA6300, "TEA6320"}, 279 { V4L2_IDENT_UNKNOWN, "TEA6320" },
278 {AUDIO_CHIP_TDA985X, "TDA9850"}, 280 { V4L2_IDENT_UNKNOWN, "TDA9850" },
279 {AUDIO_CHIP_MSP34XX, "MSP3400C"}, 281 { V4L2_IDENT_MSPX4XX, "MSP3400C" },
280 /* 5-9 */ 282 /* 5-9 */
281 {AUDIO_CHIP_MSP34XX, "MSP3410D"}, 283 { V4L2_IDENT_MSPX4XX, "MSP3410D" },
282 {AUDIO_CHIP_MSP34XX, "MSP3415"}, 284 { V4L2_IDENT_MSPX4XX, "MSP3415" },
283 {AUDIO_CHIP_MSP34XX, "MSP3430"}, 285 { V4L2_IDENT_MSPX4XX, "MSP3430" },
284 {AUDIO_CHIP_MSP34XX, "MSP3438"}, 286 { V4L2_IDENT_MSPX4XX, "MSP3438" },
285 {AUDIO_CHIP_UNKNOWN, "CS5331"}, 287 { V4L2_IDENT_UNKNOWN, "CS5331" },
286 /* 10-14 */ 288 /* 10-14 */
287 {AUDIO_CHIP_MSP34XX, "MSP3435"}, 289 { V4L2_IDENT_MSPX4XX, "MSP3435" },
288 {AUDIO_CHIP_MSP34XX, "MSP3440"}, 290 { V4L2_IDENT_MSPX4XX, "MSP3440" },
289 {AUDIO_CHIP_MSP34XX, "MSP3445"}, 291 { V4L2_IDENT_MSPX4XX, "MSP3445" },
290 {AUDIO_CHIP_MSP34XX, "MSP3411"}, 292 { V4L2_IDENT_MSPX4XX, "MSP3411" },
291 {AUDIO_CHIP_MSP34XX, "MSP3416"}, 293 { V4L2_IDENT_MSPX4XX, "MSP3416" },
292 /* 15-19 */ 294 /* 15-19 */
293 {AUDIO_CHIP_MSP34XX, "MSP3425"}, 295 { V4L2_IDENT_MSPX4XX, "MSP3425" },
294 {AUDIO_CHIP_MSP34XX, "MSP3451"}, 296 { V4L2_IDENT_MSPX4XX, "MSP3451" },
295 {AUDIO_CHIP_MSP34XX, "MSP3418"}, 297 { V4L2_IDENT_MSPX4XX, "MSP3418" },
296 {AUDIO_CHIP_UNKNOWN, "Type 0x12"}, 298 { V4L2_IDENT_UNKNOWN, "Type 0x12" },
297 {AUDIO_CHIP_UNKNOWN, "OKI7716"}, 299 { V4L2_IDENT_UNKNOWN, "OKI7716" },
298 /* 20-24 */ 300 /* 20-24 */
299 {AUDIO_CHIP_MSP34XX, "MSP4410"}, 301 { V4L2_IDENT_MSPX4XX, "MSP4410" },
300 {AUDIO_CHIP_MSP34XX, "MSP4420"}, 302 { V4L2_IDENT_MSPX4XX, "MSP4420" },
301 {AUDIO_CHIP_MSP34XX, "MSP4440"}, 303 { V4L2_IDENT_MSPX4XX, "MSP4440" },
302 {AUDIO_CHIP_MSP34XX, "MSP4450"}, 304 { V4L2_IDENT_MSPX4XX, "MSP4450" },
303 {AUDIO_CHIP_MSP34XX, "MSP4408"}, 305 { V4L2_IDENT_MSPX4XX, "MSP4408" },
304 /* 25-29 */ 306 /* 25-29 */
305 {AUDIO_CHIP_MSP34XX, "MSP4418"}, 307 { V4L2_IDENT_MSPX4XX, "MSP4418" },
306 {AUDIO_CHIP_MSP34XX, "MSP4428"}, 308 { V4L2_IDENT_MSPX4XX, "MSP4428" },
307 {AUDIO_CHIP_MSP34XX, "MSP4448"}, 309 { V4L2_IDENT_MSPX4XX, "MSP4448" },
308 {AUDIO_CHIP_MSP34XX, "MSP4458"}, 310 { V4L2_IDENT_MSPX4XX, "MSP4458" },
309 {AUDIO_CHIP_MSP34XX, "Type 0x1d"}, 311 { V4L2_IDENT_MSPX4XX, "Type 0x1d" },
310 /* 30-34 */ 312 /* 30-34 */
311 {AUDIO_CHIP_INTERNAL, "CX880"}, 313 { V4L2_IDENT_AMBIGUOUS, "CX880" },
312 {AUDIO_CHIP_INTERNAL, "CX881"}, 314 { V4L2_IDENT_AMBIGUOUS, "CX881" },
313 {AUDIO_CHIP_INTERNAL, "CX883"}, 315 { V4L2_IDENT_AMBIGUOUS, "CX883" },
314 {AUDIO_CHIP_INTERNAL, "CX882"}, 316 { V4L2_IDENT_AMBIGUOUS, "CX882" },
315 {AUDIO_CHIP_INTERNAL, "CX25840"}, 317 { V4L2_IDENT_AMBIGUOUS, "CX25840" },
316 /* 35-39 */ 318 /* 35-39 */
317 {AUDIO_CHIP_INTERNAL, "CX25841"}, 319 { V4L2_IDENT_AMBIGUOUS, "CX25841" },
318 {AUDIO_CHIP_INTERNAL, "CX25842"}, 320 { V4L2_IDENT_AMBIGUOUS, "CX25842" },
319 {AUDIO_CHIP_INTERNAL, "CX25843"}, 321 { V4L2_IDENT_AMBIGUOUS, "CX25843" },
320 {AUDIO_CHIP_INTERNAL, "CX23418"}, 322 { V4L2_IDENT_AMBIGUOUS, "CX23418" },
321 {AUDIO_CHIP_INTERNAL, "CX23885"}, 323 { V4L2_IDENT_AMBIGUOUS, "CX23885" },
322 /* 40-44 */ 324 /* 40-44 */
323 {AUDIO_CHIP_INTERNAL, "CX23888"}, 325 { V4L2_IDENT_AMBIGUOUS, "CX23888" },
324 {AUDIO_CHIP_INTERNAL, "SAA7131"}, 326 { V4L2_IDENT_AMBIGUOUS, "SAA7131" },
325 {AUDIO_CHIP_INTERNAL, "CX23887"}, 327 { V4L2_IDENT_AMBIGUOUS, "CX23887" },
326 {AUDIO_CHIP_INTERNAL, "SAA7164"}, 328 { V4L2_IDENT_AMBIGUOUS, "SAA7164" },
327 {AUDIO_CHIP_INTERNAL, "AU8522"}, 329 { V4L2_IDENT_AMBIGUOUS, "AU8522" },
328}; 330};
329 331
330/* This list is supplied by Hauppauge. Thanks! */ 332/* This list is supplied by Hauppauge. Thanks! */
@@ -483,7 +485,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
483 tvee->has_radio = eeprom_data[i+len-1]; 485 tvee->has_radio = eeprom_data[i+len-1];
484 /* old style tag, don't know how to detect 486 /* old style tag, don't know how to detect
485 IR presence, mark as unknown. */ 487 IR presence, mark as unknown. */
486 tvee->has_ir = -1; 488 tvee->has_ir = 0;
487 tvee->model = 489 tvee->model =
488 eeprom_data[i+8] + 490 eeprom_data[i+8] +
489 (eeprom_data[i+9] << 8); 491 (eeprom_data[i+9] << 8);
@@ -509,7 +511,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
509 if (audioic < ARRAY_SIZE(audioIC)) 511 if (audioic < ARRAY_SIZE(audioIC))
510 tvee->audio_processor = audioIC[audioic].id; 512 tvee->audio_processor = audioIC[audioic].id;
511 else 513 else
512 tvee->audio_processor = AUDIO_CHIP_UNKNOWN; 514 tvee->audio_processor = V4L2_IDENT_UNKNOWN;
513 break; 515 break;
514 516
515 /* case 0x03: tag 'EEInfo' */ 517 /* case 0x03: tag 'EEInfo' */
@@ -542,7 +544,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
542 if (audioic < ARRAY_SIZE(audioIC)) 544 if (audioic < ARRAY_SIZE(audioIC))
543 tvee->audio_processor = audioIC[audioic].id; 545 tvee->audio_processor = audioIC[audioic].id;
544 else 546 else
545 tvee->audio_processor = AUDIO_CHIP_UNKNOWN; 547 tvee->audio_processor = V4L2_IDENT_UNKNOWN;
546 548
547 break; 549 break;
548 550
@@ -603,7 +605,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
603 605
604 case 0x0f: 606 case 0x0f:
605 /* tag 'IRInfo' */ 607 /* tag 'IRInfo' */
606 tvee->has_ir = eeprom_data[i+1]; 608 tvee->has_ir = 1 | (eeprom_data[i+1] << 1);
607 break; 609 break;
608 610
609 /* case 0x10: tag 'VBIInfo' */ 611 /* case 0x10: tag 'VBIInfo' */
@@ -690,7 +692,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
690 t_fmt_name2[6], t_fmt_name2[7], t_format2); 692 t_fmt_name2[6], t_fmt_name2[7], t_format2);
691 if (audioic < 0) { 693 if (audioic < 0) {
692 tveeprom_info("audio processor is unknown (no idx)\n"); 694 tveeprom_info("audio processor is unknown (no idx)\n");
693 tvee->audio_processor = AUDIO_CHIP_UNKNOWN; 695 tvee->audio_processor = V4L2_IDENT_UNKNOWN;
694 } else { 696 } else {
695 if (audioic < ARRAY_SIZE(audioIC)) 697 if (audioic < ARRAY_SIZE(audioIC))
696 tveeprom_info("audio processor is %s (idx %d)\n", 698 tveeprom_info("audio processor is %s (idx %d)\n",
@@ -703,14 +705,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
703 tveeprom_info("decoder processor is %s (idx %d)\n", 705 tveeprom_info("decoder processor is %s (idx %d)\n",
704 STRM(decoderIC, tvee->decoder_processor), 706 STRM(decoderIC, tvee->decoder_processor),
705 tvee->decoder_processor); 707 tvee->decoder_processor);
706 if (tvee->has_ir == -1) 708 if (tvee->has_ir)
707 tveeprom_info("has %sradio\n",
708 tvee->has_radio ? "" : "no ");
709 else
710 tveeprom_info("has %sradio, has %sIR receiver, has %sIR transmitter\n", 709 tveeprom_info("has %sradio, has %sIR receiver, has %sIR transmitter\n",
711 tvee->has_radio ? "" : "no ", 710 tvee->has_radio ? "" : "no ",
712 (tvee->has_ir & 1) ? "" : "no ", 711 (tvee->has_ir & 2) ? "" : "no ",
713 (tvee->has_ir & 2) ? "" : "no "); 712 (tvee->has_ir & 4) ? "" : "no ");
713 else
714 tveeprom_info("has %sradio\n",
715 tvee->has_radio ? "" : "no ");
714} 716}
715EXPORT_SYMBOL(tveeprom_hauppauge_analog); 717EXPORT_SYMBOL(tveeprom_hauppauge_analog);
716 718
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 6a3af1005f03..28af5ce5560d 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -6,7 +6,7 @@
6 */ 6 */
7 7
8#include <linux/i2c.h> 8#include <linux/i2c.h>
9#include <linux/videodev.h> 9#include <linux/videodev2.h>
10#include <linux/delay.h> 10#include <linux/delay.h>
11#include <linux/video_decoder.h> 11#include <linux/video_decoder.h>
12#include <media/v4l2-common.h> 12#include <media/v4l2-common.h>
diff --git a/drivers/media/video/usbvideo/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c
index 4128ee20b64e..bf1bc2f69b02 100644
--- a/drivers/media/video/usbvideo/usbvideo.c
+++ b/drivers/media/video/usbvideo/usbvideo.c
@@ -952,8 +952,6 @@ static const struct file_operations usbvideo_fops = {
952 .llseek = no_llseek, 952 .llseek = no_llseek,
953}; 953};
954static const struct video_device usbvideo_template = { 954static const struct video_device usbvideo_template = {
955 .owner = THIS_MODULE,
956 .type = VID_TYPE_CAPTURE,
957 .fops = &usbvideo_fops, 955 .fops = &usbvideo_fops,
958}; 956};
959 957
@@ -1040,7 +1038,7 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd)
1040 err("%s: uvd->dev == NULL", __func__); 1038 err("%s: uvd->dev == NULL", __func__);
1041 return -EINVAL; 1039 return -EINVAL;
1042 } 1040 }
1043 uvd->vdev.dev = &uvd->dev->dev; 1041 uvd->vdev.parent = &uvd->dev->dev;
1044 if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { 1042 if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) {
1045 err("%s: video_register_device failed", __func__); 1043 err("%s: video_register_device failed", __func__);
1046 return -EPIPE; 1044 return -EPIPE;
diff --git a/drivers/media/video/usbvideo/usbvideo.h b/drivers/media/video/usbvideo/usbvideo.h
index 051775d4c726..c66985beb8c9 100644
--- a/drivers/media/video/usbvideo/usbvideo.h
+++ b/drivers/media/video/usbvideo/usbvideo.h
@@ -18,6 +18,7 @@
18 18
19#include <linux/videodev.h> 19#include <linux/videodev.h>
20#include <media/v4l2-common.h> 20#include <media/v4l2-common.h>
21#include <media/v4l2-ioctl.h>
21#include <linux/usb.h> 22#include <linux/usb.h>
22#include <linux/mutex.h> 23#include <linux/mutex.h>
23 24
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c
index 40d053e0d5bf..b7792451a299 100644
--- a/drivers/media/video/usbvideo/vicam.c
+++ b/drivers/media/video/usbvideo/vicam.c
@@ -41,6 +41,7 @@
41#include <linux/videodev.h> 41#include <linux/videodev.h>
42#include <linux/usb.h> 42#include <linux/usb.h>
43#include <linux/vmalloc.h> 43#include <linux/vmalloc.h>
44#include <linux/mm.h>
44#include <linux/slab.h> 45#include <linux/slab.h>
45#include <linux/mutex.h> 46#include <linux/mutex.h>
46#include <linux/firmware.h> 47#include <linux/firmware.h>
@@ -791,9 +792,7 @@ static const struct file_operations vicam_fops = {
791}; 792};
792 793
793static struct video_device vicam_template = { 794static struct video_device vicam_template = {
794 .owner = THIS_MODULE,
795 .name = "ViCam-based USB Camera", 795 .name = "ViCam-based USB Camera",
796 .type = VID_TYPE_CAPTURE,
797 .fops = &vicam_fops, 796 .fops = &vicam_fops,
798 .minor = -1, 797 .minor = -1,
799}; 798};
diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c
index abf685464b7c..c317ed7a8482 100644
--- a/drivers/media/video/usbvision/usbvision-core.c
+++ b/drivers/media/video/usbvision/usbvision-core.c
@@ -30,7 +30,6 @@
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/utsname.h> 31#include <linux/utsname.h>
32#include <linux/highmem.h> 32#include <linux/highmem.h>
33#include <linux/videodev.h>
34#include <linux/vmalloc.h> 33#include <linux/vmalloc.h>
35#include <linux/module.h> 34#include <linux/module.h>
36#include <linux/init.h> 35#include <linux/init.h>
@@ -43,7 +42,6 @@
43#include <media/saa7115.h> 42#include <media/saa7115.h>
44#include <media/v4l2-common.h> 43#include <media/v4l2-common.h>
45#include <media/tuner.h> 44#include <media/tuner.h>
46#include <media/audiochip.h>
47 45
48#include <linux/workqueue.h> 46#include <linux/workqueue.h>
49 47
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index cd6c41d67899..b977116a0dd9 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -53,7 +53,6 @@
53#include <linux/mm.h> 53#include <linux/mm.h>
54#include <linux/utsname.h> 54#include <linux/utsname.h>
55#include <linux/highmem.h> 55#include <linux/highmem.h>
56#include <linux/videodev.h>
57#include <linux/vmalloc.h> 56#include <linux/vmalloc.h>
58#include <linux/module.h> 57#include <linux/module.h>
59#include <linux/init.h> 58#include <linux/init.h>
@@ -65,8 +64,8 @@
65 64
66#include <media/saa7115.h> 65#include <media/saa7115.h>
67#include <media/v4l2-common.h> 66#include <media/v4l2-common.h>
67#include <media/v4l2-ioctl.h>
68#include <media/tuner.h> 68#include <media/tuner.h>
69#include <media/audiochip.h>
70 69
71#include <linux/workqueue.h> 70#include <linux/workqueue.h>
72 71
@@ -184,7 +183,7 @@ MODULE_ALIAS(DRIVER_ALIAS);
184static inline struct usb_usbvision *cd_to_usbvision(struct device *cd) 183static inline struct usb_usbvision *cd_to_usbvision(struct device *cd)
185{ 184{
186 struct video_device *vdev = 185 struct video_device *vdev =
187 container_of(cd, struct video_device, class_dev); 186 container_of(cd, struct video_device, dev);
188 return video_get_drvdata(vdev); 187 return video_get_drvdata(vdev);
189} 188}
190 189
@@ -199,7 +198,7 @@ static ssize_t show_model(struct device *cd,
199 struct device_attribute *attr, char *buf) 198 struct device_attribute *attr, char *buf)
200{ 199{
201 struct video_device *vdev = 200 struct video_device *vdev =
202 container_of(cd, struct video_device, class_dev); 201 container_of(cd, struct video_device, dev);
203 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 202 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
204 return sprintf(buf, "%s\n", 203 return sprintf(buf, "%s\n",
205 usbvision_device_data[usbvision->DevModel].ModelString); 204 usbvision_device_data[usbvision->DevModel].ModelString);
@@ -210,7 +209,7 @@ static ssize_t show_hue(struct device *cd,
210 struct device_attribute *attr, char *buf) 209 struct device_attribute *attr, char *buf)
211{ 210{
212 struct video_device *vdev = 211 struct video_device *vdev =
213 container_of(cd, struct video_device, class_dev); 212 container_of(cd, struct video_device, dev);
214 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 213 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
215 struct v4l2_control ctrl; 214 struct v4l2_control ctrl;
216 ctrl.id = V4L2_CID_HUE; 215 ctrl.id = V4L2_CID_HUE;
@@ -225,7 +224,7 @@ static ssize_t show_contrast(struct device *cd,
225 struct device_attribute *attr, char *buf) 224 struct device_attribute *attr, char *buf)
226{ 225{
227 struct video_device *vdev = 226 struct video_device *vdev =
228 container_of(cd, struct video_device, class_dev); 227 container_of(cd, struct video_device, dev);
229 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 228 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
230 struct v4l2_control ctrl; 229 struct v4l2_control ctrl;
231 ctrl.id = V4L2_CID_CONTRAST; 230 ctrl.id = V4L2_CID_CONTRAST;
@@ -240,7 +239,7 @@ static ssize_t show_brightness(struct device *cd,
240 struct device_attribute *attr, char *buf) 239 struct device_attribute *attr, char *buf)
241{ 240{
242 struct video_device *vdev = 241 struct video_device *vdev =
243 container_of(cd, struct video_device, class_dev); 242 container_of(cd, struct video_device, dev);
244 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 243 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
245 struct v4l2_control ctrl; 244 struct v4l2_control ctrl;
246 ctrl.id = V4L2_CID_BRIGHTNESS; 245 ctrl.id = V4L2_CID_BRIGHTNESS;
@@ -255,7 +254,7 @@ static ssize_t show_saturation(struct device *cd,
255 struct device_attribute *attr, char *buf) 254 struct device_attribute *attr, char *buf)
256{ 255{
257 struct video_device *vdev = 256 struct video_device *vdev =
258 container_of(cd, struct video_device, class_dev); 257 container_of(cd, struct video_device, dev);
259 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 258 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
260 struct v4l2_control ctrl; 259 struct v4l2_control ctrl;
261 ctrl.id = V4L2_CID_SATURATION; 260 ctrl.id = V4L2_CID_SATURATION;
@@ -270,7 +269,7 @@ static ssize_t show_streaming(struct device *cd,
270 struct device_attribute *attr, char *buf) 269 struct device_attribute *attr, char *buf)
271{ 270{
272 struct video_device *vdev = 271 struct video_device *vdev =
273 container_of(cd, struct video_device, class_dev); 272 container_of(cd, struct video_device, dev);
274 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 273 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
275 return sprintf(buf, "%s\n", 274 return sprintf(buf, "%s\n",
276 YES_NO(usbvision->streaming==Stream_On?1:0)); 275 YES_NO(usbvision->streaming==Stream_On?1:0));
@@ -281,7 +280,7 @@ static ssize_t show_compression(struct device *cd,
281 struct device_attribute *attr, char *buf) 280 struct device_attribute *attr, char *buf)
282{ 281{
283 struct video_device *vdev = 282 struct video_device *vdev =
284 container_of(cd, struct video_device, class_dev); 283 container_of(cd, struct video_device, dev);
285 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 284 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
286 return sprintf(buf, "%s\n", 285 return sprintf(buf, "%s\n",
287 YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); 286 YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS));
@@ -292,7 +291,7 @@ static ssize_t show_device_bridge(struct device *cd,
292 struct device_attribute *attr, char *buf) 291 struct device_attribute *attr, char *buf)
293{ 292{
294 struct video_device *vdev = 293 struct video_device *vdev =
295 container_of(cd, struct video_device, class_dev); 294 container_of(cd, struct video_device, dev);
296 struct usb_usbvision *usbvision = video_get_drvdata(vdev); 295 struct usb_usbvision *usbvision = video_get_drvdata(vdev);
297 return sprintf(buf, "%d\n", usbvision->bridgeType); 296 return sprintf(buf, "%d\n", usbvision->bridgeType);
298} 297}
@@ -304,40 +303,31 @@ static void usbvision_create_sysfs(struct video_device *vdev)
304 if (!vdev) 303 if (!vdev)
305 return; 304 return;
306 do { 305 do {
307 res = device_create_file(&vdev->class_dev, 306 res = device_create_file(&vdev->dev, &dev_attr_version);
308 &dev_attr_version);
309 if (res<0) 307 if (res<0)
310 break; 308 break;
311 res = device_create_file(&vdev->class_dev, 309 res = device_create_file(&vdev->dev, &dev_attr_model);
312 &dev_attr_model);
313 if (res<0) 310 if (res<0)
314 break; 311 break;
315 res = device_create_file(&vdev->class_dev, 312 res = device_create_file(&vdev->dev, &dev_attr_hue);
316 &dev_attr_hue);
317 if (res<0) 313 if (res<0)
318 break; 314 break;
319 res = device_create_file(&vdev->class_dev, 315 res = device_create_file(&vdev->dev, &dev_attr_contrast);
320 &dev_attr_contrast);
321 if (res<0) 316 if (res<0)
322 break; 317 break;
323 res = device_create_file(&vdev->class_dev, 318 res = device_create_file(&vdev->dev, &dev_attr_brightness);
324 &dev_attr_brightness);
325 if (res<0) 319 if (res<0)
326 break; 320 break;
327 res = device_create_file(&vdev->class_dev, 321 res = device_create_file(&vdev->dev, &dev_attr_saturation);
328 &dev_attr_saturation);
329 if (res<0) 322 if (res<0)
330 break; 323 break;
331 res = device_create_file(&vdev->class_dev, 324 res = device_create_file(&vdev->dev, &dev_attr_streaming);
332 &dev_attr_streaming);
333 if (res<0) 325 if (res<0)
334 break; 326 break;
335 res = device_create_file(&vdev->class_dev, 327 res = device_create_file(&vdev->dev, &dev_attr_compression);
336 &dev_attr_compression);
337 if (res<0) 328 if (res<0)
338 break; 329 break;
339 res = device_create_file(&vdev->class_dev, 330 res = device_create_file(&vdev->dev, &dev_attr_bridge);
340 &dev_attr_bridge);
341 if (res>=0) 331 if (res>=0)
342 return; 332 return;
343 } while (0); 333 } while (0);
@@ -348,24 +338,15 @@ static void usbvision_create_sysfs(struct video_device *vdev)
348static void usbvision_remove_sysfs(struct video_device *vdev) 338static void usbvision_remove_sysfs(struct video_device *vdev)
349{ 339{
350 if (vdev) { 340 if (vdev) {
351 device_remove_file(&vdev->class_dev, 341 device_remove_file(&vdev->dev, &dev_attr_version);
352 &dev_attr_version); 342 device_remove_file(&vdev->dev, &dev_attr_model);
353 device_remove_file(&vdev->class_dev, 343 device_remove_file(&vdev->dev, &dev_attr_hue);
354 &dev_attr_model); 344 device_remove_file(&vdev->dev, &dev_attr_contrast);
355 device_remove_file(&vdev->class_dev, 345 device_remove_file(&vdev->dev, &dev_attr_brightness);
356 &dev_attr_hue); 346 device_remove_file(&vdev->dev, &dev_attr_saturation);
357 device_remove_file(&vdev->class_dev, 347 device_remove_file(&vdev->dev, &dev_attr_streaming);
358 &dev_attr_contrast); 348 device_remove_file(&vdev->dev, &dev_attr_compression);
359 device_remove_file(&vdev->class_dev, 349 device_remove_file(&vdev->dev, &dev_attr_bridge);
360 &dev_attr_brightness);
361 device_remove_file(&vdev->class_dev,
362 &dev_attr_saturation);
363 device_remove_file(&vdev->class_dev,
364 &dev_attr_streaming);
365 device_remove_file(&vdev->class_dev,
366 &dev_attr_compression);
367 device_remove_file(&vdev->class_dev,
368 &dev_attr_bridge);
369 } 350 }
370} 351}
371 352
@@ -1388,13 +1369,8 @@ static const struct file_operations usbvision_fops = {
1388/* .poll = video_poll, */ 1369/* .poll = video_poll, */
1389 .compat_ioctl = v4l_compat_ioctl32, 1370 .compat_ioctl = v4l_compat_ioctl32,
1390}; 1371};
1391static struct video_device usbvision_video_template = { 1372
1392 .owner = THIS_MODULE, 1373static const struct v4l2_ioctl_ops usbvision_ioctl_ops = {
1393 .type = VID_TYPE_TUNER | VID_TYPE_CAPTURE,
1394 .fops = &usbvision_fops,
1395 .name = "usbvision-video",
1396 .release = video_device_release,
1397 .minor = -1,
1398 .vidioc_querycap = vidioc_querycap, 1374 .vidioc_querycap = vidioc_querycap,
1399 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1375 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1400 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1376 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1426,6 +1402,14 @@ static struct video_device usbvision_video_template = {
1426 .vidioc_g_register = vidioc_g_register, 1402 .vidioc_g_register = vidioc_g_register,
1427 .vidioc_s_register = vidioc_s_register, 1403 .vidioc_s_register = vidioc_s_register,
1428#endif 1404#endif
1405};
1406
1407static struct video_device usbvision_video_template = {
1408 .fops = &usbvision_fops,
1409 .ioctl_ops = &usbvision_ioctl_ops,
1410 .name = "usbvision-video",
1411 .release = video_device_release,
1412 .minor = -1,
1429 .tvnorms = USBVISION_NORMS, 1413 .tvnorms = USBVISION_NORMS,
1430 .current_norm = V4L2_STD_PAL 1414 .current_norm = V4L2_STD_PAL
1431}; 1415};
@@ -1441,14 +1425,7 @@ static const struct file_operations usbvision_radio_fops = {
1441 .compat_ioctl = v4l_compat_ioctl32, 1425 .compat_ioctl = v4l_compat_ioctl32,
1442}; 1426};
1443 1427
1444static struct video_device usbvision_radio_template= 1428static const struct v4l2_ioctl_ops usbvision_radio_ioctl_ops = {
1445{
1446 .owner = THIS_MODULE,
1447 .type = VID_TYPE_TUNER,
1448 .fops = &usbvision_radio_fops,
1449 .name = "usbvision-radio",
1450 .release = video_device_release,
1451 .minor = -1,
1452 .vidioc_querycap = vidioc_querycap, 1429 .vidioc_querycap = vidioc_querycap,
1453 .vidioc_enum_input = vidioc_enum_input, 1430 .vidioc_enum_input = vidioc_enum_input,
1454 .vidioc_g_input = vidioc_g_input, 1431 .vidioc_g_input = vidioc_g_input,
@@ -1462,6 +1439,14 @@ static struct video_device usbvision_radio_template=
1462 .vidioc_s_tuner = vidioc_s_tuner, 1439 .vidioc_s_tuner = vidioc_s_tuner,
1463 .vidioc_g_frequency = vidioc_g_frequency, 1440 .vidioc_g_frequency = vidioc_g_frequency,
1464 .vidioc_s_frequency = vidioc_s_frequency, 1441 .vidioc_s_frequency = vidioc_s_frequency,
1442};
1443
1444static struct video_device usbvision_radio_template = {
1445 .fops = &usbvision_radio_fops,
1446 .name = "usbvision-radio",
1447 .release = video_device_release,
1448 .minor = -1,
1449 .ioctl_ops = &usbvision_radio_ioctl_ops,
1465 1450
1466 .tvnorms = USBVISION_NORMS, 1451 .tvnorms = USBVISION_NORMS,
1467 .current_norm = V4L2_STD_PAL 1452 .current_norm = V4L2_STD_PAL
@@ -1479,8 +1464,6 @@ static const struct file_operations usbvision_vbi_fops = {
1479 1464
1480static struct video_device usbvision_vbi_template= 1465static struct video_device usbvision_vbi_template=
1481{ 1466{
1482 .owner = THIS_MODULE,
1483 .type = VID_TYPE_TUNER,
1484 .fops = &usbvision_vbi_fops, 1467 .fops = &usbvision_vbi_fops,
1485 .release = video_device_release, 1468 .release = video_device_release,
1486 .name = "usbvision-vbi", 1469 .name = "usbvision-vbi",
@@ -1506,7 +1489,7 @@ static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision,
1506 } 1489 }
1507 *vdev = *vdev_template; 1490 *vdev = *vdev_template;
1508// vdev->minor = -1; 1491// vdev->minor = -1;
1509 vdev->dev = &usb_dev->dev; 1492 vdev->parent = &usb_dev->dev;
1510 snprintf(vdev->name, sizeof(vdev->name), "%s", name); 1493 snprintf(vdev->name, sizeof(vdev->name), "%s", name);
1511 video_set_drvdata(vdev, usbvision); 1494 video_set_drvdata(vdev, usbvision);
1512 return vdev; 1495 return vdev;
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c
index 3ae95512666f..626f4ad7e876 100644
--- a/drivers/media/video/uvc/uvc_ctrl.c
+++ b/drivers/media/video/uvc/uvc_ctrl.c
@@ -195,8 +195,8 @@ static struct uvc_menu_info power_line_frequency_controls[] = {
195}; 195};
196 196
197static struct uvc_menu_info exposure_auto_controls[] = { 197static struct uvc_menu_info exposure_auto_controls[] = {
198 { 1, "Manual Mode" },
199 { 2, "Auto Mode" }, 198 { 2, "Auto Mode" },
199 { 1, "Manual Mode" },
200 { 4, "Shutter Priority Mode" }, 200 { 4, "Shutter Priority Mode" },
201 { 8, "Aperture Priority Mode" }, 201 { 8, "Aperture Priority Mode" },
202}; 202};
@@ -592,6 +592,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
592 if (ctrl == NULL) 592 if (ctrl == NULL)
593 return -EINVAL; 593 return -EINVAL;
594 594
595 memset(v4l2_ctrl, 0, sizeof *v4l2_ctrl);
595 v4l2_ctrl->id = mapping->id; 596 v4l2_ctrl->id = mapping->id;
596 v4l2_ctrl->type = mapping->v4l2_type; 597 v4l2_ctrl->type = mapping->v4l2_type;
597 strncpy(v4l2_ctrl->name, mapping->name, sizeof v4l2_ctrl->name); 598 strncpy(v4l2_ctrl->name, mapping->name, sizeof v4l2_ctrl->name);
@@ -608,7 +609,8 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
608 v4l2_ctrl->default_value = uvc_get_le_value(data, mapping); 609 v4l2_ctrl->default_value = uvc_get_le_value(data, mapping);
609 } 610 }
610 611
611 if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) { 612 switch (mapping->v4l2_type) {
613 case V4L2_CTRL_TYPE_MENU:
612 v4l2_ctrl->minimum = 0; 614 v4l2_ctrl->minimum = 0;
613 v4l2_ctrl->maximum = mapping->menu_count - 1; 615 v4l2_ctrl->maximum = mapping->menu_count - 1;
614 v4l2_ctrl->step = 1; 616 v4l2_ctrl->step = 1;
@@ -622,6 +624,15 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
622 } 624 }
623 625
624 return 0; 626 return 0;
627
628 case V4L2_CTRL_TYPE_BOOLEAN:
629 v4l2_ctrl->minimum = 0;
630 v4l2_ctrl->maximum = 1;
631 v4l2_ctrl->step = 1;
632 return 0;
633
634 default:
635 break;
625 } 636 }
626 637
627 if (ctrl->info->flags & UVC_CONTROL_GET_MIN) { 638 if (ctrl->info->flags & UVC_CONTROL_GET_MIN) {
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c
index f2b2983fe062..b3c4d75e8490 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -1458,9 +1458,7 @@ static int uvc_register_video(struct uvc_device *dev)
1458 * unregistered before the reference is released, so we don't need to 1458 * unregistered before the reference is released, so we don't need to
1459 * get another one. 1459 * get another one.
1460 */ 1460 */
1461 vdev->dev = &dev->intf->dev; 1461 vdev->parent = &dev->intf->dev;
1462 vdev->type = 0;
1463 vdev->type2 = 0;
1464 vdev->minor = -1; 1462 vdev->minor = -1;
1465 vdev->fops = &uvc_fops; 1463 vdev->fops = &uvc_fops;
1466 vdev->release = video_device_release; 1464 vdev->release = video_device_release;
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
index b5a11eb8f9fa..d7bd71be40a9 100644
--- a/drivers/media/video/uvc/uvc_v4l2.c
+++ b/drivers/media/video/uvc/uvc_v4l2.c
@@ -23,6 +23,7 @@
23#include <asm/atomic.h> 23#include <asm/atomic.h>
24 24
25#include <media/v4l2-common.h> 25#include <media/v4l2-common.h>
26#include <media/v4l2-ioctl.h>
26 27
27#include "uvcvideo.h" 28#include "uvcvideo.h"
28 29
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c
index a0f6c60279ec..79937d1031fc 100644
--- a/drivers/media/video/v4l1-compat.c
+++ b/drivers/media/video/v4l1-compat.c
@@ -30,6 +30,7 @@
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/videodev.h> 31#include <linux/videodev.h>
32#include <media/v4l2-common.h> 32#include <media/v4l2-common.h>
33#include <media/v4l2-ioctl.h>
33 34
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
35#include <asm/system.h> 36#include <asm/system.h>
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index e9dd996fd5df..88ca13104417 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -64,7 +64,7 @@
64#include <linux/kmod.h> 64#include <linux/kmod.h>
65#endif 65#endif
66 66
67#include <linux/videodev.h> 67#include <linux/videodev2.h>
68 68
69MODULE_AUTHOR("Bill Dirks, Justin Schoeman, Gerd Knorr"); 69MODULE_AUTHOR("Bill Dirks, Justin Schoeman, Gerd Knorr");
70MODULE_DESCRIPTION("misc helper functions for v4l2 device drivers"); 70MODULE_DESCRIPTION("misc helper functions for v4l2 device drivers");
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
new file mode 100644
index 000000000000..556615fe93de
--- /dev/null
+++ b/drivers/media/video/v4l2-dev.c
@@ -0,0 +1,422 @@
1/*
2 * Video capture interface for Linux version 2
3 *
4 * A generic video device interface for the LINUX operating system
5 * using a set of device structures/vectors for low level operations.
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 * Authors: Alan Cox, <alan@redhat.com> (version 1)
13 * Mauro Carvalho Chehab <mchehab@infradead.org> (version 2)
14 *
15 * Fixes: 20000516 Claudio Matsuoka <claudio@conectiva.com>
16 * - Added procfs support
17 */
18
19#include <linux/module.h>
20#include <linux/types.h>
21#include <linux/kernel.h>
22#include <linux/mm.h>
23#include <linux/string.h>
24#include <linux/errno.h>
25#include <linux/init.h>
26#include <linux/kmod.h>
27#include <linux/slab.h>
28#include <linux/smp_lock.h>
29#include <asm/uaccess.h>
30#include <asm/system.h>
31
32#include <media/v4l2-common.h>
33
34#define VIDEO_NUM_DEVICES 256
35#define VIDEO_NAME "video4linux"
36
37/*
38 * sysfs stuff
39 */
40
41static ssize_t show_index(struct device *cd,
42 struct device_attribute *attr, char *buf)
43{
44 struct video_device *vfd = container_of(cd, struct video_device, dev);
45 return sprintf(buf, "%i\n", vfd->index);
46}
47
48static ssize_t show_name(struct device *cd,
49 struct device_attribute *attr, char *buf)
50{
51 struct video_device *vfd = container_of(cd, struct video_device, dev);
52 return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name);
53}
54
55static struct device_attribute video_device_attrs[] = {
56 __ATTR(name, S_IRUGO, show_name, NULL),
57 __ATTR(index, S_IRUGO, show_index, NULL),
58 __ATTR_NULL
59};
60
61struct video_device *video_device_alloc(void)
62{
63 struct video_device *vfd;
64
65 vfd = kzalloc(sizeof(*vfd), GFP_KERNEL);
66 return vfd;
67}
68EXPORT_SYMBOL(video_device_alloc);
69
70void video_device_release(struct video_device *vfd)
71{
72 kfree(vfd);
73}
74EXPORT_SYMBOL(video_device_release);
75
76static void video_release(struct device *cd)
77{
78 struct video_device *vfd = container_of(cd, struct video_device, dev);
79
80#if 1
81 /* needed until all drivers are fixed */
82 if (!vfd->release)
83 return;
84#endif
85 vfd->release(vfd);
86}
87
88static struct class video_class = {
89 .name = VIDEO_NAME,
90 .dev_attrs = video_device_attrs,
91 .dev_release = video_release,
92};
93
94/*
95 * Active devices
96 */
97
98static struct video_device *video_device[VIDEO_NUM_DEVICES];
99static DEFINE_MUTEX(videodev_lock);
100
101struct video_device *video_devdata(struct file *file)
102{
103 return video_device[iminor(file->f_path.dentry->d_inode)];
104}
105EXPORT_SYMBOL(video_devdata);
106
107/*
108 * Open a video device - FIXME: Obsoleted
109 */
110static int video_open(struct inode *inode, struct file *file)
111{
112 unsigned int minor = iminor(inode);
113 int err = 0;
114 struct video_device *vfl;
115 const struct file_operations *old_fops;
116
117 if (minor >= VIDEO_NUM_DEVICES)
118 return -ENODEV;
119 lock_kernel();
120 mutex_lock(&videodev_lock);
121 vfl = video_device[minor];
122 if (vfl == NULL) {
123 mutex_unlock(&videodev_lock);
124 request_module("char-major-%d-%d", VIDEO_MAJOR, minor);
125 mutex_lock(&videodev_lock);
126 vfl = video_device[minor];
127 if (vfl == NULL) {
128 mutex_unlock(&videodev_lock);
129 unlock_kernel();
130 return -ENODEV;
131 }
132 }
133 old_fops = file->f_op;
134 file->f_op = fops_get(vfl->fops);
135 if (file->f_op->open)
136 err = file->f_op->open(inode, file);
137 if (err) {
138 fops_put(file->f_op);
139 file->f_op = fops_get(old_fops);
140 }
141 fops_put(old_fops);
142 mutex_unlock(&videodev_lock);
143 unlock_kernel();
144 return err;
145}
146
147/*
148 * open/release helper functions -- handle exclusive opens
149 * Should be removed soon
150 */
151int video_exclusive_open(struct inode *inode, struct file *file)
152{
153 struct video_device *vfl = video_devdata(file);
154 int retval = 0;
155
156 mutex_lock(&vfl->lock);
157 if (vfl->users)
158 retval = -EBUSY;
159 else
160 vfl->users++;
161 mutex_unlock(&vfl->lock);
162 return retval;
163}
164EXPORT_SYMBOL(video_exclusive_open);
165
166int video_exclusive_release(struct inode *inode, struct file *file)
167{
168 struct video_device *vfl = video_devdata(file);
169
170 vfl->users--;
171 return 0;
172}
173EXPORT_SYMBOL(video_exclusive_release);
174
175/**
176 * get_index - assign stream number based on parent device
177 * @vdev: video_device to assign index number to, vdev->dev should be assigned
178 * @num: -1 if auto assign, requested number otherwise
179 *
180 *
181 * returns -ENFILE if num is already in use, a free index number if
182 * successful.
183 */
184static int get_index(struct video_device *vdev, int num)
185{
186 u32 used = 0;
187 const int max_index = sizeof(used) * 8 - 1;
188 int i;
189
190 /* Currently a single v4l driver instance cannot create more than
191 32 devices.
192 Increase to u64 or an array of u32 if more are needed. */
193 if (num > max_index) {
194 printk(KERN_ERR "videodev: %s num is too large\n", __func__);
195 return -EINVAL;
196 }
197
198 for (i = 0; i < VIDEO_NUM_DEVICES; i++) {
199 if (video_device[i] != NULL &&
200 video_device[i] != vdev &&
201 video_device[i]->parent == vdev->parent) {
202 used |= 1 << video_device[i]->index;
203 }
204 }
205
206 if (num >= 0) {
207 if (used & (1 << num))
208 return -ENFILE;
209 return num;
210 }
211
212 i = ffz(used);
213 return i > max_index ? -ENFILE : i;
214}
215
216static const struct file_operations video_fops;
217
218int video_register_device(struct video_device *vfd, int type, int nr)
219{
220 return video_register_device_index(vfd, type, nr, -1);
221}
222EXPORT_SYMBOL(video_register_device);
223
224/**
225 * video_register_device - register video4linux devices
226 * @vfd: video device structure we want to register
227 * @type: type of device to register
228 * @nr: which device number (0 == /dev/video0, 1 == /dev/video1, ...
229 * -1 == first free)
230 *
231 * The registration code assigns minor numbers based on the type
232 * requested. -ENFILE is returned in all the device slots for this
233 * category are full. If not then the minor field is set and the
234 * driver initialize function is called (if non %NULL).
235 *
236 * Zero is returned on success.
237 *
238 * Valid types are
239 *
240 * %VFL_TYPE_GRABBER - A frame grabber
241 *
242 * %VFL_TYPE_VTX - A teletext device
243 *
244 * %VFL_TYPE_VBI - Vertical blank data (undecoded)
245 *
246 * %VFL_TYPE_RADIO - A radio card
247 */
248
249int video_register_device_index(struct video_device *vfd, int type, int nr,
250 int index)
251{
252 int i = 0;
253 int base;
254 int end;
255 int ret;
256 char *name_base;
257
258 switch (type) {
259 case VFL_TYPE_GRABBER:
260 base = MINOR_VFL_TYPE_GRABBER_MIN;
261 end = MINOR_VFL_TYPE_GRABBER_MAX+1;
262 name_base = "video";
263 break;
264 case VFL_TYPE_VTX:
265 base = MINOR_VFL_TYPE_VTX_MIN;
266 end = MINOR_VFL_TYPE_VTX_MAX+1;
267 name_base = "vtx";
268 break;
269 case VFL_TYPE_VBI:
270 base = MINOR_VFL_TYPE_VBI_MIN;
271 end = MINOR_VFL_TYPE_VBI_MAX+1;
272 name_base = "vbi";
273 break;
274 case VFL_TYPE_RADIO:
275 base = MINOR_VFL_TYPE_RADIO_MIN;
276 end = MINOR_VFL_TYPE_RADIO_MAX+1;
277 name_base = "radio";
278 break;
279 default:
280 printk(KERN_ERR "%s called with unknown type: %d\n",
281 __func__, type);
282 return -1;
283 }
284
285 /* pick a minor number */
286 mutex_lock(&videodev_lock);
287 if (nr >= 0 && nr < end-base) {
288 /* use the one the driver asked for */
289 i = base + nr;
290 if (NULL != video_device[i]) {
291 mutex_unlock(&videodev_lock);
292 return -ENFILE;
293 }
294 } else {
295 /* use first free */
296 for (i = base; i < end; i++)
297 if (NULL == video_device[i])
298 break;
299 if (i == end) {
300 mutex_unlock(&videodev_lock);
301 return -ENFILE;
302 }
303 }
304 video_device[i] = vfd;
305 vfd->vfl_type = type;
306 vfd->minor = i;
307
308 ret = get_index(vfd, index);
309 vfd->index = ret;
310
311 mutex_unlock(&videodev_lock);
312
313 if (ret < 0) {
314 printk(KERN_ERR "%s: get_index failed\n", __func__);
315 goto fail_minor;
316 }
317
318 mutex_init(&vfd->lock);
319
320 /* sysfs class */
321 memset(&vfd->dev, 0x00, sizeof(vfd->dev));
322 vfd->dev.class = &video_class;
323 vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
324 if (vfd->parent)
325 vfd->dev.parent = vfd->parent;
326 sprintf(vfd->dev.bus_id, "%s%d", name_base, i - base);
327 ret = device_register(&vfd->dev);
328 if (ret < 0) {
329 printk(KERN_ERR "%s: device_register failed\n", __func__);
330 goto fail_minor;
331 }
332
333#if 1
334 /* needed until all drivers are fixed */
335 if (!vfd->release)
336 printk(KERN_WARNING "videodev: \"%s\" has no release callback. "
337 "Please fix your driver for proper sysfs support, see "
338 "http://lwn.net/Articles/36850/\n", vfd->name);
339#endif
340 return 0;
341
342fail_minor:
343 mutex_lock(&videodev_lock);
344 video_device[vfd->minor] = NULL;
345 vfd->minor = -1;
346 mutex_unlock(&videodev_lock);
347 return ret;
348}
349EXPORT_SYMBOL(video_register_device_index);
350
351/**
352 * video_unregister_device - unregister a video4linux device
353 * @vfd: the device to unregister
354 *
355 * This unregisters the passed device and deassigns the minor
356 * number. Future open calls will be met with errors.
357 */
358
359void video_unregister_device(struct video_device *vfd)
360{
361 mutex_lock(&videodev_lock);
362 if (video_device[vfd->minor] != vfd)
363 panic("videodev: bad unregister");
364
365 video_device[vfd->minor] = NULL;
366 device_unregister(&vfd->dev);
367 mutex_unlock(&videodev_lock);
368}
369EXPORT_SYMBOL(video_unregister_device);
370
371/*
372 * Video fs operations
373 */
374static const struct file_operations video_fops = {
375 .owner = THIS_MODULE,
376 .llseek = no_llseek,
377 .open = video_open,
378};
379
380/*
381 * Initialise video for linux
382 */
383
384static int __init videodev_init(void)
385{
386 int ret;
387
388 printk(KERN_INFO "Linux video capture interface: v2.00\n");
389 if (register_chrdev(VIDEO_MAJOR, VIDEO_NAME, &video_fops)) {
390 printk(KERN_WARNING "video_dev: unable to get major %d\n", VIDEO_MAJOR);
391 return -EIO;
392 }
393
394 ret = class_register(&video_class);
395 if (ret < 0) {
396 unregister_chrdev(VIDEO_MAJOR, VIDEO_NAME);
397 printk(KERN_WARNING "video_dev: class_register failed\n");
398 return -EIO;
399 }
400
401 return 0;
402}
403
404static void __exit videodev_exit(void)
405{
406 class_unregister(&video_class);
407 unregister_chrdev(VIDEO_MAJOR, VIDEO_NAME);
408}
409
410module_init(videodev_init)
411module_exit(videodev_exit)
412
413MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>");
414MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2");
415MODULE_LICENSE("GPL");
416
417
418/*
419 * Local variables:
420 * c-basic-offset: 8
421 * End:
422 */
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
new file mode 100644
index 000000000000..fdfe7739c96e
--- /dev/null
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -0,0 +1,1875 @@
1/*
2 * Video capture interface for Linux version 2
3 *
4 * A generic framework to process V4L2 ioctl commands.
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 * Authors: Alan Cox, <alan@redhat.com> (version 1)
12 * Mauro Carvalho Chehab <mchehab@infradead.org> (version 2)
13 */
14
15#include <linux/module.h>
16#include <linux/types.h>
17#include <linux/kernel.h>
18
19#define __OLD_VIDIOC_ /* To allow fixing old calls */
20#include <linux/videodev2.h>
21
22#ifdef CONFIG_VIDEO_V4L1
23#include <linux/videodev.h>
24#endif
25#include <media/v4l2-common.h>
26#include <media/v4l2-ioctl.h>
27#include <linux/video_decoder.h>
28
29#define dbgarg(cmd, fmt, arg...) \
30 do { \
31 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { \
32 printk(KERN_DEBUG "%s: ", vfd->name); \
33 v4l_printk_ioctl(cmd); \
34 printk(" " fmt, ## arg); \
35 } \
36 } while (0)
37
38#define dbgarg2(fmt, arg...) \
39 do { \
40 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) \
41 printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);\
42 } while (0)
43
44struct std_descr {
45 v4l2_std_id std;
46 const char *descr;
47};
48
49static const struct std_descr standards[] = {
50 { V4L2_STD_NTSC, "NTSC" },
51 { V4L2_STD_NTSC_M, "NTSC-M" },
52 { V4L2_STD_NTSC_M_JP, "NTSC-M-JP" },
53 { V4L2_STD_NTSC_M_KR, "NTSC-M-KR" },
54 { V4L2_STD_NTSC_443, "NTSC-443" },
55 { V4L2_STD_PAL, "PAL" },
56 { V4L2_STD_PAL_BG, "PAL-BG" },
57 { V4L2_STD_PAL_B, "PAL-B" },
58 { V4L2_STD_PAL_B1, "PAL-B1" },
59 { V4L2_STD_PAL_G, "PAL-G" },
60 { V4L2_STD_PAL_H, "PAL-H" },
61 { V4L2_STD_PAL_I, "PAL-I" },
62 { V4L2_STD_PAL_DK, "PAL-DK" },
63 { V4L2_STD_PAL_D, "PAL-D" },
64 { V4L2_STD_PAL_D1, "PAL-D1" },
65 { V4L2_STD_PAL_K, "PAL-K" },
66 { V4L2_STD_PAL_M, "PAL-M" },
67 { V4L2_STD_PAL_N, "PAL-N" },
68 { V4L2_STD_PAL_Nc, "PAL-Nc" },
69 { V4L2_STD_PAL_60, "PAL-60" },
70 { V4L2_STD_SECAM, "SECAM" },
71 { V4L2_STD_SECAM_B, "SECAM-B" },
72 { V4L2_STD_SECAM_G, "SECAM-G" },
73 { V4L2_STD_SECAM_H, "SECAM-H" },
74 { V4L2_STD_SECAM_DK, "SECAM-DK" },
75 { V4L2_STD_SECAM_D, "SECAM-D" },
76 { V4L2_STD_SECAM_K, "SECAM-K" },
77 { V4L2_STD_SECAM_K1, "SECAM-K1" },
78 { V4L2_STD_SECAM_L, "SECAM-L" },
79 { V4L2_STD_SECAM_LC, "SECAM-Lc" },
80 { 0, "Unknown" }
81};
82
83/* video4linux standard ID conversion to standard name
84 */
85const char *v4l2_norm_to_name(v4l2_std_id id)
86{
87 u32 myid = id;
88 int i;
89
90 /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle
91 64 bit comparations. So, on that architecture, with some gcc
92 variants, compilation fails. Currently, the max value is 30bit wide.
93 */
94 BUG_ON(myid != id);
95
96 for (i = 0; standards[i].std; i++)
97 if (myid == standards[i].std)
98 break;
99 return standards[i].descr;
100}
101EXPORT_SYMBOL(v4l2_norm_to_name);
102
103/* Fill in the fields of a v4l2_standard structure according to the
104 'id' and 'transmission' parameters. Returns negative on error. */
105int v4l2_video_std_construct(struct v4l2_standard *vs,
106 int id, const char *name)
107{
108 u32 index = vs->index;
109
110 memset(vs, 0, sizeof(struct v4l2_standard));
111 vs->index = index;
112 vs->id = id;
113 if (id & V4L2_STD_525_60) {
114 vs->frameperiod.numerator = 1001;
115 vs->frameperiod.denominator = 30000;
116 vs->framelines = 525;
117 } else {
118 vs->frameperiod.numerator = 1;
119 vs->frameperiod.denominator = 25;
120 vs->framelines = 625;
121 }
122 strlcpy(vs->name, name, sizeof(vs->name));
123 return 0;
124}
125EXPORT_SYMBOL(v4l2_video_std_construct);
126
127/* ----------------------------------------------------------------- */
128/* some arrays for pretty-printing debug messages of enum types */
129
130const char *v4l2_field_names[] = {
131 [V4L2_FIELD_ANY] = "any",
132 [V4L2_FIELD_NONE] = "none",
133 [V4L2_FIELD_TOP] = "top",
134 [V4L2_FIELD_BOTTOM] = "bottom",
135 [V4L2_FIELD_INTERLACED] = "interlaced",
136 [V4L2_FIELD_SEQ_TB] = "seq-tb",
137 [V4L2_FIELD_SEQ_BT] = "seq-bt",
138 [V4L2_FIELD_ALTERNATE] = "alternate",
139 [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
140 [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
141};
142EXPORT_SYMBOL(v4l2_field_names);
143
144const char *v4l2_type_names[] = {
145 [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "vid-cap",
146 [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "vid-overlay",
147 [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "vid-out",
148 [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap",
149 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
150 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
151 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out",
152 [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "vid-out-overlay",
153};
154EXPORT_SYMBOL(v4l2_type_names);
155
156static const char *v4l2_memory_names[] = {
157 [V4L2_MEMORY_MMAP] = "mmap",
158 [V4L2_MEMORY_USERPTR] = "userptr",
159 [V4L2_MEMORY_OVERLAY] = "overlay",
160};
161
162#define prt_names(a, arr) ((((a) >= 0) && ((a) < ARRAY_SIZE(arr))) ? \
163 arr[a] : "unknown")
164
165/* ------------------------------------------------------------------ */
166/* debug help functions */
167
168#ifdef CONFIG_VIDEO_V4L1_COMPAT
169static const char *v4l1_ioctls[] = {
170 [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP",
171 [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN",
172 [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN",
173 [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER",
174 [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER",
175 [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT",
176 [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT",
177 [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE",
178 [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN",
179 [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN",
180 [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF",
181 [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF",
182 [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY",
183 [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ",
184 [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ",
185 [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO",
186 [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO",
187 [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC",
188 [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE",
189 [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF",
190 [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT",
191 [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE",
192 [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE",
193 [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE",
194 [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE",
195 [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO",
196 [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE",
197 [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT",
198 [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT"
199};
200#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
201#endif
202
203static const char *v4l2_ioctls[] = {
204 [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP",
205 [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED",
206 [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT",
207 [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT",
208 [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT",
209 [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS",
210 [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF",
211 [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF",
212 [_IOC_NR(VIDIOC_S_FBUF)] = "VIDIOC_S_FBUF",
213 [_IOC_NR(VIDIOC_OVERLAY)] = "VIDIOC_OVERLAY",
214 [_IOC_NR(VIDIOC_QBUF)] = "VIDIOC_QBUF",
215 [_IOC_NR(VIDIOC_DQBUF)] = "VIDIOC_DQBUF",
216 [_IOC_NR(VIDIOC_STREAMON)] = "VIDIOC_STREAMON",
217 [_IOC_NR(VIDIOC_STREAMOFF)] = "VIDIOC_STREAMOFF",
218 [_IOC_NR(VIDIOC_G_PARM)] = "VIDIOC_G_PARM",
219 [_IOC_NR(VIDIOC_S_PARM)] = "VIDIOC_S_PARM",
220 [_IOC_NR(VIDIOC_G_STD)] = "VIDIOC_G_STD",
221 [_IOC_NR(VIDIOC_S_STD)] = "VIDIOC_S_STD",
222 [_IOC_NR(VIDIOC_ENUMSTD)] = "VIDIOC_ENUMSTD",
223 [_IOC_NR(VIDIOC_ENUMINPUT)] = "VIDIOC_ENUMINPUT",
224 [_IOC_NR(VIDIOC_G_CTRL)] = "VIDIOC_G_CTRL",
225 [_IOC_NR(VIDIOC_S_CTRL)] = "VIDIOC_S_CTRL",
226 [_IOC_NR(VIDIOC_G_TUNER)] = "VIDIOC_G_TUNER",
227 [_IOC_NR(VIDIOC_S_TUNER)] = "VIDIOC_S_TUNER",
228 [_IOC_NR(VIDIOC_G_AUDIO)] = "VIDIOC_G_AUDIO",
229 [_IOC_NR(VIDIOC_S_AUDIO)] = "VIDIOC_S_AUDIO",
230 [_IOC_NR(VIDIOC_QUERYCTRL)] = "VIDIOC_QUERYCTRL",
231 [_IOC_NR(VIDIOC_QUERYMENU)] = "VIDIOC_QUERYMENU",
232 [_IOC_NR(VIDIOC_G_INPUT)] = "VIDIOC_G_INPUT",
233 [_IOC_NR(VIDIOC_S_INPUT)] = "VIDIOC_S_INPUT",
234 [_IOC_NR(VIDIOC_G_OUTPUT)] = "VIDIOC_G_OUTPUT",
235 [_IOC_NR(VIDIOC_S_OUTPUT)] = "VIDIOC_S_OUTPUT",
236 [_IOC_NR(VIDIOC_ENUMOUTPUT)] = "VIDIOC_ENUMOUTPUT",
237 [_IOC_NR(VIDIOC_G_AUDOUT)] = "VIDIOC_G_AUDOUT",
238 [_IOC_NR(VIDIOC_S_AUDOUT)] = "VIDIOC_S_AUDOUT",
239 [_IOC_NR(VIDIOC_G_MODULATOR)] = "VIDIOC_G_MODULATOR",
240 [_IOC_NR(VIDIOC_S_MODULATOR)] = "VIDIOC_S_MODULATOR",
241 [_IOC_NR(VIDIOC_G_FREQUENCY)] = "VIDIOC_G_FREQUENCY",
242 [_IOC_NR(VIDIOC_S_FREQUENCY)] = "VIDIOC_S_FREQUENCY",
243 [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP",
244 [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP",
245 [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP",
246 [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP",
247 [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP",
248 [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD",
249 [_IOC_NR(VIDIOC_TRY_FMT)] = "VIDIOC_TRY_FMT",
250 [_IOC_NR(VIDIOC_ENUMAUDIO)] = "VIDIOC_ENUMAUDIO",
251 [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT",
252 [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY",
253 [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY",
254 [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP",
255 [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS",
256 [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS",
257 [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS",
258 [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS",
259#if 1
260 [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES",
261 [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS",
262 [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX",
263 [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD",
264 [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD",
265
266 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
267 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
268
269 [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT",
270 [_IOC_NR(VIDIOC_S_HW_FREQ_SEEK)] = "VIDIOC_S_HW_FREQ_SEEK",
271#endif
272};
273#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
274
275static const char *v4l2_int_ioctls[] = {
276#ifdef CONFIG_VIDEO_V4L1_COMPAT
277 [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES",
278 [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS",
279 [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM",
280 [_IOC_NR(DECODER_SET_INPUT)] = "DECODER_SET_INPUT",
281 [_IOC_NR(DECODER_SET_OUTPUT)] = "DECODER_SET_OUTPUT",
282 [_IOC_NR(DECODER_ENABLE_OUTPUT)] = "DECODER_ENABLE_OUTPUT",
283 [_IOC_NR(DECODER_SET_PICTURE)] = "DECODER_SET_PICTURE",
284 [_IOC_NR(DECODER_SET_GPIO)] = "DECODER_SET_GPIO",
285 [_IOC_NR(DECODER_INIT)] = "DECODER_INIT",
286 [_IOC_NR(DECODER_SET_VBI_BYPASS)] = "DECODER_SET_VBI_BYPASS",
287 [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP",
288#endif
289 [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO",
290
291 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR",
292 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY",
293 [_IOC_NR(TUNER_SET_CONFIG)] = "TUNER_SET_CONFIG",
294
295 [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE",
296 [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET",
297 [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ",
298 [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE",
299 [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA",
300 [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA",
301 [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ",
302 [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY",
303 [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING",
304 [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)] = "VIDIOC_INT_G_AUDIO_ROUTING",
305 [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)] = "VIDIOC_INT_S_VIDEO_ROUTING",
306 [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)] = "VIDIOC_INT_G_VIDEO_ROUTING",
307 [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)] = "VIDIOC_INT_S_CRYSTAL_FREQ",
308 [_IOC_NR(VIDIOC_INT_INIT)] = "VIDIOC_INT_INIT",
309 [_IOC_NR(VIDIOC_INT_G_STD_OUTPUT)] = "VIDIOC_INT_G_STD_OUTPUT",
310 [_IOC_NR(VIDIOC_INT_S_STD_OUTPUT)] = "VIDIOC_INT_S_STD_OUTPUT",
311};
312#define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls)
313
314/* Common ioctl debug function. This function can be used by
315 external ioctl messages as well as internal V4L ioctl */
316void v4l_printk_ioctl(unsigned int cmd)
317{
318 char *dir, *type;
319
320 switch (_IOC_TYPE(cmd)) {
321 case 'd':
322 if (_IOC_NR(cmd) >= V4L2_INT_IOCTLS) {
323 type = "v4l2_int";
324 break;
325 }
326 printk("%s", v4l2_int_ioctls[_IOC_NR(cmd)]);
327 return;
328#ifdef CONFIG_VIDEO_V4L1_COMPAT
329 case 'v':
330 if (_IOC_NR(cmd) >= V4L1_IOCTLS) {
331 type = "v4l1";
332 break;
333 }
334 printk("%s", v4l1_ioctls[_IOC_NR(cmd)]);
335 return;
336#endif
337 case 'V':
338 if (_IOC_NR(cmd) >= V4L2_IOCTLS) {
339 type = "v4l2";
340 break;
341 }
342 printk("%s", v4l2_ioctls[_IOC_NR(cmd)]);
343 return;
344 default:
345 type = "unknown";
346 }
347
348 switch (_IOC_DIR(cmd)) {
349 case _IOC_NONE: dir = "--"; break;
350 case _IOC_READ: dir = "r-"; break;
351 case _IOC_WRITE: dir = "-w"; break;
352 case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
353 default: dir = "*ERR*"; break;
354 }
355 printk("%s ioctl '%c', dir=%s, #%d (0x%08x)",
356 type, _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd);
357}
358EXPORT_SYMBOL(v4l_printk_ioctl);
359
360/*
361 * helper function -- handles userspace copying for ioctl arguments
362 */
363
364#ifdef __OLD_VIDIOC_
365static unsigned int
366video_fix_command(unsigned int cmd)
367{
368 switch (cmd) {
369 case VIDIOC_OVERLAY_OLD:
370 cmd = VIDIOC_OVERLAY;
371 break;
372 case VIDIOC_S_PARM_OLD:
373 cmd = VIDIOC_S_PARM;
374 break;
375 case VIDIOC_S_CTRL_OLD:
376 cmd = VIDIOC_S_CTRL;
377 break;
378 case VIDIOC_G_AUDIO_OLD:
379 cmd = VIDIOC_G_AUDIO;
380 break;
381 case VIDIOC_G_AUDOUT_OLD:
382 cmd = VIDIOC_G_AUDOUT;
383 break;
384 case VIDIOC_CROPCAP_OLD:
385 cmd = VIDIOC_CROPCAP;
386 break;
387 }
388 return cmd;
389}
390#endif
391
392/*
393 * Obsolete usercopy function - Should be removed soon
394 */
395int
396video_usercopy(struct inode *inode, struct file *file,
397 unsigned int cmd, unsigned long arg,
398 int (*func)(struct inode *inode, struct file *file,
399 unsigned int cmd, void *arg))
400{
401 char sbuf[128];
402 void *mbuf = NULL;
403 void *parg = NULL;
404 int err = -EINVAL;
405 int is_ext_ctrl;
406 size_t ctrls_size = 0;
407 void __user *user_ptr = NULL;
408
409#ifdef __OLD_VIDIOC_
410 cmd = video_fix_command(cmd);
411#endif
412 is_ext_ctrl = (cmd == VIDIOC_S_EXT_CTRLS || cmd == VIDIOC_G_EXT_CTRLS ||
413 cmd == VIDIOC_TRY_EXT_CTRLS);
414
415 /* Copy arguments into temp kernel buffer */
416 switch (_IOC_DIR(cmd)) {
417 case _IOC_NONE:
418 parg = NULL;
419 break;
420 case _IOC_READ:
421 case _IOC_WRITE:
422 case (_IOC_WRITE | _IOC_READ):
423 if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
424 parg = sbuf;
425 } else {
426 /* too big to allocate from stack */
427 mbuf = kmalloc(_IOC_SIZE(cmd), GFP_KERNEL);
428 if (NULL == mbuf)
429 return -ENOMEM;
430 parg = mbuf;
431 }
432
433 err = -EFAULT;
434 if (_IOC_DIR(cmd) & _IOC_WRITE)
435 if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
436 goto out;
437 break;
438 }
439 if (is_ext_ctrl) {
440 struct v4l2_ext_controls *p = parg;
441
442 /* In case of an error, tell the caller that it wasn't
443 a specific control that caused it. */
444 p->error_idx = p->count;
445 user_ptr = (void __user *)p->controls;
446 if (p->count) {
447 ctrls_size = sizeof(struct v4l2_ext_control) * p->count;
448 /* Note: v4l2_ext_controls fits in sbuf[] so mbuf is still NULL. */
449 mbuf = kmalloc(ctrls_size, GFP_KERNEL);
450 err = -ENOMEM;
451 if (NULL == mbuf)
452 goto out_ext_ctrl;
453 err = -EFAULT;
454 if (copy_from_user(mbuf, user_ptr, ctrls_size))
455 goto out_ext_ctrl;
456 p->controls = mbuf;
457 }
458 }
459
460 /* call driver */
461 err = func(inode, file, cmd, parg);
462 if (err == -ENOIOCTLCMD)
463 err = -EINVAL;
464 if (is_ext_ctrl) {
465 struct v4l2_ext_controls *p = parg;
466
467 p->controls = (void *)user_ptr;
468 if (p->count && err == 0 && copy_to_user(user_ptr, mbuf, ctrls_size))
469 err = -EFAULT;
470 goto out_ext_ctrl;
471 }
472 if (err < 0)
473 goto out;
474
475out_ext_ctrl:
476 /* Copy results into user buffer */
477 switch (_IOC_DIR(cmd)) {
478 case _IOC_READ:
479 case (_IOC_WRITE | _IOC_READ):
480 if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
481 err = -EFAULT;
482 break;
483 }
484
485out:
486 kfree(mbuf);
487 return err;
488}
489EXPORT_SYMBOL(video_usercopy);
490
491static void dbgbuf(unsigned int cmd, struct video_device *vfd,
492 struct v4l2_buffer *p)
493{
494 struct v4l2_timecode *tc = &p->timecode;
495
496 dbgarg(cmd, "%02ld:%02d:%02d.%08ld index=%d, type=%s, "
497 "bytesused=%d, flags=0x%08d, "
498 "field=%0d, sequence=%d, memory=%s, offset/userptr=0x%08lx, length=%d\n",
499 p->timestamp.tv_sec / 3600,
500 (int)(p->timestamp.tv_sec / 60) % 60,
501 (int)(p->timestamp.tv_sec % 60),
502 p->timestamp.tv_usec,
503 p->index,
504 prt_names(p->type, v4l2_type_names),
505 p->bytesused, p->flags,
506 p->field, p->sequence,
507 prt_names(p->memory, v4l2_memory_names),
508 p->m.userptr, p->length);
509 dbgarg2("timecode=%02d:%02d:%02d type=%d, "
510 "flags=0x%08d, frames=%d, userbits=0x%08x\n",
511 tc->hours, tc->minutes, tc->seconds,
512 tc->type, tc->flags, tc->frames, *(__u32 *)tc->userbits);
513}
514
515static inline void dbgrect(struct video_device *vfd, char *s,
516 struct v4l2_rect *r)
517{
518 dbgarg2("%sRect start at %dx%d, size=%dx%d\n", s, r->left, r->top,
519 r->width, r->height);
520};
521
522static inline void v4l_print_pix_fmt(struct video_device *vfd,
523 struct v4l2_pix_format *fmt)
524{
525 dbgarg2("width=%d, height=%d, format=%c%c%c%c, field=%s, "
526 "bytesperline=%d sizeimage=%d, colorspace=%d\n",
527 fmt->width, fmt->height,
528 (fmt->pixelformat & 0xff),
529 (fmt->pixelformat >> 8) & 0xff,
530 (fmt->pixelformat >> 16) & 0xff,
531 (fmt->pixelformat >> 24) & 0xff,
532 prt_names(fmt->field, v4l2_field_names),
533 fmt->bytesperline, fmt->sizeimage, fmt->colorspace);
534};
535
536static inline void v4l_print_ext_ctrls(unsigned int cmd,
537 struct video_device *vfd, struct v4l2_ext_controls *c, int show_vals)
538{
539 __u32 i;
540
541 if (!(vfd->debug & V4L2_DEBUG_IOCTL_ARG))
542 return;
543 dbgarg(cmd, "");
544 printk(KERN_CONT "class=0x%x", c->ctrl_class);
545 for (i = 0; i < c->count; i++) {
546 if (show_vals)
547 printk(KERN_CONT " id/val=0x%x/0x%x",
548 c->controls[i].id, c->controls[i].value);
549 else
550 printk(KERN_CONT " id=0x%x", c->controls[i].id);
551 }
552 printk(KERN_CONT "\n");
553};
554
555static inline int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv)
556{
557 __u32 i;
558
559 /* zero the reserved fields */
560 c->reserved[0] = c->reserved[1] = 0;
561 for (i = 0; i < c->count; i++) {
562 c->controls[i].reserved2[0] = 0;
563 c->controls[i].reserved2[1] = 0;
564 }
565 /* V4L2_CID_PRIVATE_BASE cannot be used as control class
566 when using extended controls.
567 Only when passed in through VIDIOC_G_CTRL and VIDIOC_S_CTRL
568 is it allowed for backwards compatibility.
569 */
570 if (!allow_priv && c->ctrl_class == V4L2_CID_PRIVATE_BASE)
571 return 0;
572 /* Check that all controls are from the same control class. */
573 for (i = 0; i < c->count; i++) {
574 if (V4L2_CTRL_ID2CLASS(c->controls[i].id) != c->ctrl_class) {
575 c->error_idx = i;
576 return 0;
577 }
578 }
579 return 1;
580}
581
582static int check_fmt(const struct v4l2_ioctl_ops *ops, enum v4l2_buf_type type)
583{
584 if (ops == NULL)
585 return -EINVAL;
586
587 switch (type) {
588 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
589 if (ops->vidioc_try_fmt_vid_cap)
590 return 0;
591 break;
592 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
593 if (ops->vidioc_try_fmt_vid_overlay)
594 return 0;
595 break;
596 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
597 if (ops->vidioc_try_fmt_vid_out)
598 return 0;
599 break;
600 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
601 if (ops->vidioc_try_fmt_vid_out_overlay)
602 return 0;
603 break;
604 case V4L2_BUF_TYPE_VBI_CAPTURE:
605 if (ops->vidioc_try_fmt_vbi_cap)
606 return 0;
607 break;
608 case V4L2_BUF_TYPE_VBI_OUTPUT:
609 if (ops->vidioc_try_fmt_vbi_out)
610 return 0;
611 break;
612 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
613 if (ops->vidioc_try_fmt_sliced_vbi_cap)
614 return 0;
615 break;
616 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
617 if (ops->vidioc_try_fmt_sliced_vbi_out)
618 return 0;
619 break;
620 case V4L2_BUF_TYPE_PRIVATE:
621 if (ops->vidioc_try_fmt_type_private)
622 return 0;
623 break;
624 }
625 return -EINVAL;
626}
627
628static int __video_do_ioctl(struct inode *inode, struct file *file,
629 unsigned int cmd, void *arg)
630{
631 struct video_device *vfd = video_devdata(file);
632 const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops;
633 void *fh = file->private_data;
634 int ret = -EINVAL;
635
636 if ((vfd->debug & V4L2_DEBUG_IOCTL) &&
637 !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) {
638 v4l_print_ioctl(vfd->name, cmd);
639 printk(KERN_CONT "\n");
640 }
641
642 if (ops == NULL) {
643 printk(KERN_WARNING "videodev: \"%s\" has no ioctl_ops.\n",
644 vfd->name);
645 return -EINVAL;
646 }
647
648#ifdef CONFIG_VIDEO_V4L1_COMPAT
649 /***********************************************************
650 Handles calls to the obsoleted V4L1 API
651 Due to the nature of VIDIOCGMBUF, each driver that supports
652 V4L1 should implement its own handler for this ioctl.
653 ***********************************************************/
654
655 /* --- streaming capture ------------------------------------- */
656 if (cmd == VIDIOCGMBUF) {
657 struct video_mbuf *p = arg;
658
659 memset(p, 0, sizeof(*p));
660
661 if (!ops->vidiocgmbuf)
662 return ret;
663 ret = ops->vidiocgmbuf(file, fh, p);
664 if (!ret)
665 dbgarg(cmd, "size=%d, frames=%d, offsets=0x%08lx\n",
666 p->size, p->frames,
667 (unsigned long)p->offsets);
668 return ret;
669 }
670
671 /********************************************************
672 All other V4L1 calls are handled by v4l1_compat module.
673 Those calls will be translated into V4L2 calls, and
674 __video_do_ioctl will be called again, with one or more
675 V4L2 ioctls.
676 ********************************************************/
677 if (_IOC_TYPE(cmd) == 'v')
678 return v4l_compat_translate_ioctl(inode, file, cmd, arg,
679 __video_do_ioctl);
680#endif
681
682 switch (cmd) {
683 /* --- capabilities ------------------------------------------ */
684 case VIDIOC_QUERYCAP:
685 {
686 struct v4l2_capability *cap = (struct v4l2_capability *)arg;
687 memset(cap, 0, sizeof(*cap));
688
689 if (!ops->vidioc_querycap)
690 break;
691
692 ret = ops->vidioc_querycap(file, fh, cap);
693 if (!ret)
694 dbgarg(cmd, "driver=%s, card=%s, bus=%s, "
695 "version=0x%08x, "
696 "capabilities=0x%08x\n",
697 cap->driver, cap->card, cap->bus_info,
698 cap->version,
699 cap->capabilities);
700 break;
701 }
702
703 /* --- priority ------------------------------------------ */
704 case VIDIOC_G_PRIORITY:
705 {
706 enum v4l2_priority *p = arg;
707
708 if (!ops->vidioc_g_priority)
709 break;
710 ret = ops->vidioc_g_priority(file, fh, p);
711 if (!ret)
712 dbgarg(cmd, "priority is %d\n", *p);
713 break;
714 }
715 case VIDIOC_S_PRIORITY:
716 {
717 enum v4l2_priority *p = arg;
718
719 if (!ops->vidioc_s_priority)
720 break;
721 dbgarg(cmd, "setting priority to %d\n", *p);
722 ret = ops->vidioc_s_priority(file, fh, *p);
723 break;
724 }
725
726 /* --- capture ioctls ---------------------------------------- */
727 case VIDIOC_ENUM_FMT:
728 {
729 struct v4l2_fmtdesc *f = arg;
730 enum v4l2_buf_type type;
731 unsigned int index;
732
733 index = f->index;
734 type = f->type;
735 memset(f, 0, sizeof(*f));
736 f->index = index;
737 f->type = type;
738
739 switch (type) {
740 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
741 if (ops->vidioc_enum_fmt_vid_cap)
742 ret = ops->vidioc_enum_fmt_vid_cap(file, fh, f);
743 break;
744 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
745 if (ops->vidioc_enum_fmt_vid_overlay)
746 ret = ops->vidioc_enum_fmt_vid_overlay(file,
747 fh, f);
748 break;
749#if 1
750 /* V4L2_BUF_TYPE_VBI_CAPTURE should not support VIDIOC_ENUM_FMT
751 * according to the spec. The bttv and saa7134 drivers support
752 * it though, so just warn that this is deprecated and will be
753 * removed in the near future. */
754 case V4L2_BUF_TYPE_VBI_CAPTURE:
755 if (ops->vidioc_enum_fmt_vbi_cap) {
756 printk(KERN_WARNING "vidioc_enum_fmt_vbi_cap will be removed in 2.6.28!\n");
757 ret = ops->vidioc_enum_fmt_vbi_cap(file, fh, f);
758 }
759 break;
760#endif
761 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
762 if (ops->vidioc_enum_fmt_vid_out)
763 ret = ops->vidioc_enum_fmt_vid_out(file, fh, f);
764 break;
765 case V4L2_BUF_TYPE_PRIVATE:
766 if (ops->vidioc_enum_fmt_type_private)
767 ret = ops->vidioc_enum_fmt_type_private(file,
768 fh, f);
769 break;
770 default:
771 break;
772 }
773 if (!ret)
774 dbgarg(cmd, "index=%d, type=%d, flags=%d, "
775 "pixelformat=%c%c%c%c, description='%s'\n",
776 f->index, f->type, f->flags,
777 (f->pixelformat & 0xff),
778 (f->pixelformat >> 8) & 0xff,
779 (f->pixelformat >> 16) & 0xff,
780 (f->pixelformat >> 24) & 0xff,
781 f->description);
782 break;
783 }
784 case VIDIOC_G_FMT:
785 {
786 struct v4l2_format *f = (struct v4l2_format *)arg;
787
788 memset(f->fmt.raw_data, 0, sizeof(f->fmt.raw_data));
789
790 /* FIXME: Should be one dump per type */
791 dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
792
793 switch (f->type) {
794 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
795 if (ops->vidioc_g_fmt_vid_cap)
796 ret = ops->vidioc_g_fmt_vid_cap(file, fh, f);
797 if (!ret)
798 v4l_print_pix_fmt(vfd, &f->fmt.pix);
799 break;
800 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
801 if (ops->vidioc_g_fmt_vid_overlay)
802 ret = ops->vidioc_g_fmt_vid_overlay(file,
803 fh, f);
804 break;
805 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
806 if (ops->vidioc_g_fmt_vid_out)
807 ret = ops->vidioc_g_fmt_vid_out(file, fh, f);
808 if (!ret)
809 v4l_print_pix_fmt(vfd, &f->fmt.pix);
810 break;
811 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
812 if (ops->vidioc_g_fmt_vid_out_overlay)
813 ret = ops->vidioc_g_fmt_vid_out_overlay(file,
814 fh, f);
815 break;
816 case V4L2_BUF_TYPE_VBI_CAPTURE:
817 if (ops->vidioc_g_fmt_vbi_cap)
818 ret = ops->vidioc_g_fmt_vbi_cap(file, fh, f);
819 break;
820 case V4L2_BUF_TYPE_VBI_OUTPUT:
821 if (ops->vidioc_g_fmt_vbi_out)
822 ret = ops->vidioc_g_fmt_vbi_out(file, fh, f);
823 break;
824 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
825 if (ops->vidioc_g_fmt_sliced_vbi_cap)
826 ret = ops->vidioc_g_fmt_sliced_vbi_cap(file,
827 fh, f);
828 break;
829 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
830 if (ops->vidioc_g_fmt_sliced_vbi_out)
831 ret = ops->vidioc_g_fmt_sliced_vbi_out(file,
832 fh, f);
833 break;
834 case V4L2_BUF_TYPE_PRIVATE:
835 if (ops->vidioc_g_fmt_type_private)
836 ret = ops->vidioc_g_fmt_type_private(file,
837 fh, f);
838 break;
839 }
840
841 break;
842 }
843 case VIDIOC_S_FMT:
844 {
845 struct v4l2_format *f = (struct v4l2_format *)arg;
846
847 /* FIXME: Should be one dump per type */
848 dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
849
850 switch (f->type) {
851 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
852 v4l_print_pix_fmt(vfd, &f->fmt.pix);
853 if (ops->vidioc_s_fmt_vid_cap)
854 ret = ops->vidioc_s_fmt_vid_cap(file, fh, f);
855 break;
856 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
857 if (ops->vidioc_s_fmt_vid_overlay)
858 ret = ops->vidioc_s_fmt_vid_overlay(file,
859 fh, f);
860 break;
861 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
862 v4l_print_pix_fmt(vfd, &f->fmt.pix);
863 if (ops->vidioc_s_fmt_vid_out)
864 ret = ops->vidioc_s_fmt_vid_out(file, fh, f);
865 break;
866 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
867 if (ops->vidioc_s_fmt_vid_out_overlay)
868 ret = ops->vidioc_s_fmt_vid_out_overlay(file,
869 fh, f);
870 break;
871 case V4L2_BUF_TYPE_VBI_CAPTURE:
872 if (ops->vidioc_s_fmt_vbi_cap)
873 ret = ops->vidioc_s_fmt_vbi_cap(file, fh, f);
874 break;
875 case V4L2_BUF_TYPE_VBI_OUTPUT:
876 if (ops->vidioc_s_fmt_vbi_out)
877 ret = ops->vidioc_s_fmt_vbi_out(file, fh, f);
878 break;
879 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
880 if (ops->vidioc_s_fmt_sliced_vbi_cap)
881 ret = ops->vidioc_s_fmt_sliced_vbi_cap(file,
882 fh, f);
883 break;
884 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
885 if (ops->vidioc_s_fmt_sliced_vbi_out)
886 ret = ops->vidioc_s_fmt_sliced_vbi_out(file,
887 fh, f);
888 break;
889 case V4L2_BUF_TYPE_PRIVATE:
890 if (ops->vidioc_s_fmt_type_private)
891 ret = ops->vidioc_s_fmt_type_private(file,
892 fh, f);
893 break;
894 }
895 break;
896 }
897 case VIDIOC_TRY_FMT:
898 {
899 struct v4l2_format *f = (struct v4l2_format *)arg;
900
901 /* FIXME: Should be one dump per type */
902 dbgarg(cmd, "type=%s\n", prt_names(f->type,
903 v4l2_type_names));
904 switch (f->type) {
905 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
906 if (ops->vidioc_try_fmt_vid_cap)
907 ret = ops->vidioc_try_fmt_vid_cap(file, fh, f);
908 if (!ret)
909 v4l_print_pix_fmt(vfd, &f->fmt.pix);
910 break;
911 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
912 if (ops->vidioc_try_fmt_vid_overlay)
913 ret = ops->vidioc_try_fmt_vid_overlay(file,
914 fh, f);
915 break;
916 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
917 if (ops->vidioc_try_fmt_vid_out)
918 ret = ops->vidioc_try_fmt_vid_out(file, fh, f);
919 if (!ret)
920 v4l_print_pix_fmt(vfd, &f->fmt.pix);
921 break;
922 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
923 if (ops->vidioc_try_fmt_vid_out_overlay)
924 ret = ops->vidioc_try_fmt_vid_out_overlay(file,
925 fh, f);
926 break;
927 case V4L2_BUF_TYPE_VBI_CAPTURE:
928 if (ops->vidioc_try_fmt_vbi_cap)
929 ret = ops->vidioc_try_fmt_vbi_cap(file, fh, f);
930 break;
931 case V4L2_BUF_TYPE_VBI_OUTPUT:
932 if (ops->vidioc_try_fmt_vbi_out)
933 ret = ops->vidioc_try_fmt_vbi_out(file, fh, f);
934 break;
935 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
936 if (ops->vidioc_try_fmt_sliced_vbi_cap)
937 ret = ops->vidioc_try_fmt_sliced_vbi_cap(file,
938 fh, f);
939 break;
940 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
941 if (ops->vidioc_try_fmt_sliced_vbi_out)
942 ret = ops->vidioc_try_fmt_sliced_vbi_out(file,
943 fh, f);
944 break;
945 case V4L2_BUF_TYPE_PRIVATE:
946 if (ops->vidioc_try_fmt_type_private)
947 ret = ops->vidioc_try_fmt_type_private(file,
948 fh, f);
949 break;
950 }
951
952 break;
953 }
954 /* FIXME: Those buf reqs could be handled here,
955 with some changes on videobuf to allow its header to be included at
956 videodev2.h or being merged at videodev2.
957 */
958 case VIDIOC_REQBUFS:
959 {
960 struct v4l2_requestbuffers *p = arg;
961
962 if (!ops->vidioc_reqbufs)
963 break;
964 ret = check_fmt(ops, p->type);
965 if (ret)
966 break;
967
968 ret = ops->vidioc_reqbufs(file, fh, p);
969 dbgarg(cmd, "count=%d, type=%s, memory=%s\n",
970 p->count,
971 prt_names(p->type, v4l2_type_names),
972 prt_names(p->memory, v4l2_memory_names));
973 break;
974 }
975 case VIDIOC_QUERYBUF:
976 {
977 struct v4l2_buffer *p = arg;
978
979 if (!ops->vidioc_querybuf)
980 break;
981 ret = check_fmt(ops, p->type);
982 if (ret)
983 break;
984
985 ret = ops->vidioc_querybuf(file, fh, p);
986 if (!ret)
987 dbgbuf(cmd, vfd, p);
988 break;
989 }
990 case VIDIOC_QBUF:
991 {
992 struct v4l2_buffer *p = arg;
993
994 if (!ops->vidioc_qbuf)
995 break;
996 ret = check_fmt(ops, p->type);
997 if (ret)
998 break;
999
1000 ret = ops->vidioc_qbuf(file, fh, p);
1001 if (!ret)
1002 dbgbuf(cmd, vfd, p);
1003 break;
1004 }
1005 case VIDIOC_DQBUF:
1006 {
1007 struct v4l2_buffer *p = arg;
1008
1009 if (!ops->vidioc_dqbuf)
1010 break;
1011 ret = check_fmt(ops, p->type);
1012 if (ret)
1013 break;
1014
1015 ret = ops->vidioc_dqbuf(file, fh, p);
1016 if (!ret)
1017 dbgbuf(cmd, vfd, p);
1018 break;
1019 }
1020 case VIDIOC_OVERLAY:
1021 {
1022 int *i = arg;
1023
1024 if (!ops->vidioc_overlay)
1025 break;
1026 dbgarg(cmd, "value=%d\n", *i);
1027 ret = ops->vidioc_overlay(file, fh, *i);
1028 break;
1029 }
1030 case VIDIOC_G_FBUF:
1031 {
1032 struct v4l2_framebuffer *p = arg;
1033
1034 if (!ops->vidioc_g_fbuf)
1035 break;
1036 ret = ops->vidioc_g_fbuf(file, fh, arg);
1037 if (!ret) {
1038 dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
1039 p->capability, p->flags,
1040 (unsigned long)p->base);
1041 v4l_print_pix_fmt(vfd, &p->fmt);
1042 }
1043 break;
1044 }
1045 case VIDIOC_S_FBUF:
1046 {
1047 struct v4l2_framebuffer *p = arg;
1048
1049 if (!ops->vidioc_s_fbuf)
1050 break;
1051 dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
1052 p->capability, p->flags, (unsigned long)p->base);
1053 v4l_print_pix_fmt(vfd, &p->fmt);
1054 ret = ops->vidioc_s_fbuf(file, fh, arg);
1055 break;
1056 }
1057 case VIDIOC_STREAMON:
1058 {
1059 enum v4l2_buf_type i = *(int *)arg;
1060
1061 if (!ops->vidioc_streamon)
1062 break;
1063 dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
1064 ret = ops->vidioc_streamon(file, fh, i);
1065 break;
1066 }
1067 case VIDIOC_STREAMOFF:
1068 {
1069 enum v4l2_buf_type i = *(int *)arg;
1070
1071 if (!ops->vidioc_streamoff)
1072 break;
1073 dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
1074 ret = ops->vidioc_streamoff(file, fh, i);
1075 break;
1076 }
1077 /* ---------- tv norms ---------- */
1078 case VIDIOC_ENUMSTD:
1079 {
1080 struct v4l2_standard *p = arg;
1081 v4l2_std_id id = vfd->tvnorms, curr_id = 0;
1082 unsigned int index = p->index, i, j = 0;
1083 const char *descr = "";
1084
1085 /* Return norm array in a canonical way */
1086 for (i = 0; i <= index && id; i++) {
1087 /* last std value in the standards array is 0, so this
1088 while always ends there since (id & 0) == 0. */
1089 while ((id & standards[j].std) != standards[j].std)
1090 j++;
1091 curr_id = standards[j].std;
1092 descr = standards[j].descr;
1093 j++;
1094 if (curr_id == 0)
1095 break;
1096 if (curr_id != V4L2_STD_PAL &&
1097 curr_id != V4L2_STD_SECAM &&
1098 curr_id != V4L2_STD_NTSC)
1099 id &= ~curr_id;
1100 }
1101 if (i <= index)
1102 return -EINVAL;
1103
1104 v4l2_video_std_construct(p, curr_id, descr);
1105 p->index = index;
1106
1107 dbgarg(cmd, "index=%d, id=0x%Lx, name=%s, fps=%d/%d, "
1108 "framelines=%d\n", p->index,
1109 (unsigned long long)p->id, p->name,
1110 p->frameperiod.numerator,
1111 p->frameperiod.denominator,
1112 p->framelines);
1113
1114 ret = 0;
1115 break;
1116 }
1117 case VIDIOC_G_STD:
1118 {
1119 v4l2_std_id *id = arg;
1120
1121 ret = 0;
1122 /* Calls the specific handler */
1123 if (ops->vidioc_g_std)
1124 ret = ops->vidioc_g_std(file, fh, id);
1125 else
1126 *id = vfd->current_norm;
1127
1128 if (!ret)
1129 dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id);
1130 break;
1131 }
1132 case VIDIOC_S_STD:
1133 {
1134 v4l2_std_id *id = arg, norm;
1135
1136 dbgarg(cmd, "std=%08Lx\n", (long long unsigned)*id);
1137
1138 norm = (*id) & vfd->tvnorms;
1139 if (vfd->tvnorms && !norm) /* Check if std is supported */
1140 break;
1141
1142 /* Calls the specific handler */
1143 if (ops->vidioc_s_std)
1144 ret = ops->vidioc_s_std(file, fh, &norm);
1145 else
1146 ret = -EINVAL;
1147
1148 /* Updates standard information */
1149 if (ret >= 0)
1150 vfd->current_norm = norm;
1151 break;
1152 }
1153 case VIDIOC_QUERYSTD:
1154 {
1155 v4l2_std_id *p = arg;
1156
1157 if (!ops->vidioc_querystd)
1158 break;
1159 ret = ops->vidioc_querystd(file, fh, arg);
1160 if (!ret)
1161 dbgarg(cmd, "detected std=%08Lx\n",
1162 (unsigned long long)*p);
1163 break;
1164 }
1165 /* ------ input switching ---------- */
1166 /* FIXME: Inputs can be handled inside videodev2 */
1167 case VIDIOC_ENUMINPUT:
1168 {
1169 struct v4l2_input *p = arg;
1170 int i = p->index;
1171
1172 if (!ops->vidioc_enum_input)
1173 break;
1174 memset(p, 0, sizeof(*p));
1175 p->index = i;
1176
1177 ret = ops->vidioc_enum_input(file, fh, p);
1178 if (!ret)
1179 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1180 "audioset=%d, "
1181 "tuner=%d, std=%08Lx, status=%d\n",
1182 p->index, p->name, p->type, p->audioset,
1183 p->tuner,
1184 (unsigned long long)p->std,
1185 p->status);
1186 break;
1187 }
1188 case VIDIOC_G_INPUT:
1189 {
1190 unsigned int *i = arg;
1191
1192 if (!ops->vidioc_g_input)
1193 break;
1194 ret = ops->vidioc_g_input(file, fh, i);
1195 if (!ret)
1196 dbgarg(cmd, "value=%d\n", *i);
1197 break;
1198 }
1199 case VIDIOC_S_INPUT:
1200 {
1201 unsigned int *i = arg;
1202
1203 if (!ops->vidioc_s_input)
1204 break;
1205 dbgarg(cmd, "value=%d\n", *i);
1206 ret = ops->vidioc_s_input(file, fh, *i);
1207 break;
1208 }
1209
1210 /* ------ output switching ---------- */
1211 case VIDIOC_ENUMOUTPUT:
1212 {
1213 struct v4l2_output *p = arg;
1214 int i = p->index;
1215
1216 if (!ops->vidioc_enum_output)
1217 break;
1218 memset(p, 0, sizeof(*p));
1219 p->index = i;
1220
1221 ret = ops->vidioc_enum_output(file, fh, p);
1222 if (!ret)
1223 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1224 "audioset=0x%x, "
1225 "modulator=%d, std=0x%08Lx\n",
1226 p->index, p->name, p->type, p->audioset,
1227 p->modulator, (unsigned long long)p->std);
1228 break;
1229 }
1230 case VIDIOC_G_OUTPUT:
1231 {
1232 unsigned int *i = arg;
1233
1234 if (!ops->vidioc_g_output)
1235 break;
1236 ret = ops->vidioc_g_output(file, fh, i);
1237 if (!ret)
1238 dbgarg(cmd, "value=%d\n", *i);
1239 break;
1240 }
1241 case VIDIOC_S_OUTPUT:
1242 {
1243 unsigned int *i = arg;
1244
1245 if (!ops->vidioc_s_output)
1246 break;
1247 dbgarg(cmd, "value=%d\n", *i);
1248 ret = ops->vidioc_s_output(file, fh, *i);
1249 break;
1250 }
1251
1252 /* --- controls ---------------------------------------------- */
1253 case VIDIOC_QUERYCTRL:
1254 {
1255 struct v4l2_queryctrl *p = arg;
1256
1257 if (!ops->vidioc_queryctrl)
1258 break;
1259 ret = ops->vidioc_queryctrl(file, fh, p);
1260 if (!ret)
1261 dbgarg(cmd, "id=0x%x, type=%d, name=%s, min/max=%d/%d, "
1262 "step=%d, default=%d, flags=0x%08x\n",
1263 p->id, p->type, p->name,
1264 p->minimum, p->maximum,
1265 p->step, p->default_value, p->flags);
1266 else
1267 dbgarg(cmd, "id=0x%x\n", p->id);
1268 break;
1269 }
1270 case VIDIOC_G_CTRL:
1271 {
1272 struct v4l2_control *p = arg;
1273
1274 if (ops->vidioc_g_ctrl)
1275 ret = ops->vidioc_g_ctrl(file, fh, p);
1276 else if (ops->vidioc_g_ext_ctrls) {
1277 struct v4l2_ext_controls ctrls;
1278 struct v4l2_ext_control ctrl;
1279
1280 ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id);
1281 ctrls.count = 1;
1282 ctrls.controls = &ctrl;
1283 ctrl.id = p->id;
1284 ctrl.value = p->value;
1285 if (check_ext_ctrls(&ctrls, 1)) {
1286 ret = ops->vidioc_g_ext_ctrls(file, fh, &ctrls);
1287 if (ret == 0)
1288 p->value = ctrl.value;
1289 }
1290 } else
1291 break;
1292 if (!ret)
1293 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
1294 else
1295 dbgarg(cmd, "id=0x%x\n", p->id);
1296 break;
1297 }
1298 case VIDIOC_S_CTRL:
1299 {
1300 struct v4l2_control *p = arg;
1301 struct v4l2_ext_controls ctrls;
1302 struct v4l2_ext_control ctrl;
1303
1304 if (!ops->vidioc_s_ctrl && !ops->vidioc_s_ext_ctrls)
1305 break;
1306
1307 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
1308
1309 if (ops->vidioc_s_ctrl) {
1310 ret = ops->vidioc_s_ctrl(file, fh, p);
1311 break;
1312 }
1313 if (!ops->vidioc_s_ext_ctrls)
1314 break;
1315
1316 ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id);
1317 ctrls.count = 1;
1318 ctrls.controls = &ctrl;
1319 ctrl.id = p->id;
1320 ctrl.value = p->value;
1321 if (check_ext_ctrls(&ctrls, 1))
1322 ret = ops->vidioc_s_ext_ctrls(file, fh, &ctrls);
1323 break;
1324 }
1325 case VIDIOC_G_EXT_CTRLS:
1326 {
1327 struct v4l2_ext_controls *p = arg;
1328
1329 p->error_idx = p->count;
1330 if (!ops->vidioc_g_ext_ctrls)
1331 break;
1332 if (check_ext_ctrls(p, 0))
1333 ret = ops->vidioc_g_ext_ctrls(file, fh, p);
1334 v4l_print_ext_ctrls(cmd, vfd, p, !ret);
1335 break;
1336 }
1337 case VIDIOC_S_EXT_CTRLS:
1338 {
1339 struct v4l2_ext_controls *p = arg;
1340
1341 p->error_idx = p->count;
1342 if (!ops->vidioc_s_ext_ctrls)
1343 break;
1344 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1345 if (check_ext_ctrls(p, 0))
1346 ret = ops->vidioc_s_ext_ctrls(file, fh, p);
1347 break;
1348 }
1349 case VIDIOC_TRY_EXT_CTRLS:
1350 {
1351 struct v4l2_ext_controls *p = arg;
1352
1353 p->error_idx = p->count;
1354 if (!ops->vidioc_try_ext_ctrls)
1355 break;
1356 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1357 if (check_ext_ctrls(p, 0))
1358 ret = ops->vidioc_try_ext_ctrls(file, fh, p);
1359 break;
1360 }
1361 case VIDIOC_QUERYMENU:
1362 {
1363 struct v4l2_querymenu *p = arg;
1364
1365 if (!ops->vidioc_querymenu)
1366 break;
1367 ret = ops->vidioc_querymenu(file, fh, p);
1368 if (!ret)
1369 dbgarg(cmd, "id=0x%x, index=%d, name=%s\n",
1370 p->id, p->index, p->name);
1371 else
1372 dbgarg(cmd, "id=0x%x, index=%d\n",
1373 p->id, p->index);
1374 break;
1375 }
1376 /* --- audio ---------------------------------------------- */
1377 case VIDIOC_ENUMAUDIO:
1378 {
1379 struct v4l2_audio *p = arg;
1380
1381 if (!ops->vidioc_enumaudio)
1382 break;
1383 ret = ops->vidioc_enumaudio(file, fh, p);
1384 if (!ret)
1385 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1386 "mode=0x%x\n", p->index, p->name,
1387 p->capability, p->mode);
1388 else
1389 dbgarg(cmd, "index=%d\n", p->index);
1390 break;
1391 }
1392 case VIDIOC_G_AUDIO:
1393 {
1394 struct v4l2_audio *p = arg;
1395 __u32 index = p->index;
1396
1397 if (!ops->vidioc_g_audio)
1398 break;
1399
1400 memset(p, 0, sizeof(*p));
1401 p->index = index;
1402 ret = ops->vidioc_g_audio(file, fh, p);
1403 if (!ret)
1404 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1405 "mode=0x%x\n", p->index,
1406 p->name, p->capability, p->mode);
1407 else
1408 dbgarg(cmd, "index=%d\n", p->index);
1409 break;
1410 }
1411 case VIDIOC_S_AUDIO:
1412 {
1413 struct v4l2_audio *p = arg;
1414
1415 if (!ops->vidioc_s_audio)
1416 break;
1417 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1418 "mode=0x%x\n", p->index, p->name,
1419 p->capability, p->mode);
1420 ret = ops->vidioc_s_audio(file, fh, p);
1421 break;
1422 }
1423 case VIDIOC_ENUMAUDOUT:
1424 {
1425 struct v4l2_audioout *p = arg;
1426
1427 if (!ops->vidioc_enumaudout)
1428 break;
1429 dbgarg(cmd, "Enum for index=%d\n", p->index);
1430 ret = ops->vidioc_enumaudout(file, fh, p);
1431 if (!ret)
1432 dbgarg2("index=%d, name=%s, capability=%d, "
1433 "mode=%d\n", p->index, p->name,
1434 p->capability, p->mode);
1435 break;
1436 }
1437 case VIDIOC_G_AUDOUT:
1438 {
1439 struct v4l2_audioout *p = arg;
1440
1441 if (!ops->vidioc_g_audout)
1442 break;
1443 dbgarg(cmd, "Enum for index=%d\n", p->index);
1444 ret = ops->vidioc_g_audout(file, fh, p);
1445 if (!ret)
1446 dbgarg2("index=%d, name=%s, capability=%d, "
1447 "mode=%d\n", p->index, p->name,
1448 p->capability, p->mode);
1449 break;
1450 }
1451 case VIDIOC_S_AUDOUT:
1452 {
1453 struct v4l2_audioout *p = arg;
1454
1455 if (!ops->vidioc_s_audout)
1456 break;
1457 dbgarg(cmd, "index=%d, name=%s, capability=%d, "
1458 "mode=%d\n", p->index, p->name,
1459 p->capability, p->mode);
1460
1461 ret = ops->vidioc_s_audout(file, fh, p);
1462 break;
1463 }
1464 case VIDIOC_G_MODULATOR:
1465 {
1466 struct v4l2_modulator *p = arg;
1467
1468 if (!ops->vidioc_g_modulator)
1469 break;
1470 ret = ops->vidioc_g_modulator(file, fh, p);
1471 if (!ret)
1472 dbgarg(cmd, "index=%d, name=%s, "
1473 "capability=%d, rangelow=%d,"
1474 " rangehigh=%d, txsubchans=%d\n",
1475 p->index, p->name, p->capability,
1476 p->rangelow, p->rangehigh,
1477 p->txsubchans);
1478 break;
1479 }
1480 case VIDIOC_S_MODULATOR:
1481 {
1482 struct v4l2_modulator *p = arg;
1483
1484 if (!ops->vidioc_s_modulator)
1485 break;
1486 dbgarg(cmd, "index=%d, name=%s, capability=%d, "
1487 "rangelow=%d, rangehigh=%d, txsubchans=%d\n",
1488 p->index, p->name, p->capability, p->rangelow,
1489 p->rangehigh, p->txsubchans);
1490 ret = ops->vidioc_s_modulator(file, fh, p);
1491 break;
1492 }
1493 case VIDIOC_G_CROP:
1494 {
1495 struct v4l2_crop *p = arg;
1496
1497 if (!ops->vidioc_g_crop)
1498 break;
1499 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1500 ret = ops->vidioc_g_crop(file, fh, p);
1501 if (!ret)
1502 dbgrect(vfd, "", &p->c);
1503 break;
1504 }
1505 case VIDIOC_S_CROP:
1506 {
1507 struct v4l2_crop *p = arg;
1508
1509 if (!ops->vidioc_s_crop)
1510 break;
1511 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1512 dbgrect(vfd, "", &p->c);
1513 ret = ops->vidioc_s_crop(file, fh, p);
1514 break;
1515 }
1516 case VIDIOC_CROPCAP:
1517 {
1518 struct v4l2_cropcap *p = arg;
1519
1520 /*FIXME: Should also show v4l2_fract pixelaspect */
1521 if (!ops->vidioc_cropcap)
1522 break;
1523 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1524 ret = ops->vidioc_cropcap(file, fh, p);
1525 if (!ret) {
1526 dbgrect(vfd, "bounds ", &p->bounds);
1527 dbgrect(vfd, "defrect ", &p->defrect);
1528 }
1529 break;
1530 }
1531 case VIDIOC_G_JPEGCOMP:
1532 {
1533 struct v4l2_jpegcompression *p = arg;
1534
1535 if (!ops->vidioc_g_jpegcomp)
1536 break;
1537 ret = ops->vidioc_g_jpegcomp(file, fh, p);
1538 if (!ret)
1539 dbgarg(cmd, "quality=%d, APPn=%d, "
1540 "APP_len=%d, COM_len=%d, "
1541 "jpeg_markers=%d\n",
1542 p->quality, p->APPn, p->APP_len,
1543 p->COM_len, p->jpeg_markers);
1544 break;
1545 }
1546 case VIDIOC_S_JPEGCOMP:
1547 {
1548 struct v4l2_jpegcompression *p = arg;
1549
1550 if (!ops->vidioc_g_jpegcomp)
1551 break;
1552 dbgarg(cmd, "quality=%d, APPn=%d, APP_len=%d, "
1553 "COM_len=%d, jpeg_markers=%d\n",
1554 p->quality, p->APPn, p->APP_len,
1555 p->COM_len, p->jpeg_markers);
1556 ret = ops->vidioc_s_jpegcomp(file, fh, p);
1557 break;
1558 }
1559 case VIDIOC_G_ENC_INDEX:
1560 {
1561 struct v4l2_enc_idx *p = arg;
1562
1563 if (!ops->vidioc_g_enc_index)
1564 break;
1565 ret = ops->vidioc_g_enc_index(file, fh, p);
1566 if (!ret)
1567 dbgarg(cmd, "entries=%d, entries_cap=%d\n",
1568 p->entries, p->entries_cap);
1569 break;
1570 }
1571 case VIDIOC_ENCODER_CMD:
1572 {
1573 struct v4l2_encoder_cmd *p = arg;
1574
1575 if (!ops->vidioc_encoder_cmd)
1576 break;
1577 memset(&p->raw, 0, sizeof(p->raw));
1578 ret = ops->vidioc_encoder_cmd(file, fh, p);
1579 if (!ret)
1580 dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
1581 break;
1582 }
1583 case VIDIOC_TRY_ENCODER_CMD:
1584 {
1585 struct v4l2_encoder_cmd *p = arg;
1586
1587 if (!ops->vidioc_try_encoder_cmd)
1588 break;
1589 memset(&p->raw, 0, sizeof(p->raw));
1590 ret = ops->vidioc_try_encoder_cmd(file, fh, p);
1591 if (!ret)
1592 dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
1593 break;
1594 }
1595 case VIDIOC_G_PARM:
1596 {
1597 struct v4l2_streamparm *p = arg;
1598 __u32 type = p->type;
1599
1600 memset(p, 0, sizeof(*p));
1601 p->type = type;
1602
1603 if (ops->vidioc_g_parm) {
1604 ret = ops->vidioc_g_parm(file, fh, p);
1605 } else {
1606 struct v4l2_standard s;
1607
1608 if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1609 return -EINVAL;
1610
1611 v4l2_video_std_construct(&s, vfd->current_norm,
1612 v4l2_norm_to_name(vfd->current_norm));
1613
1614 p->parm.capture.timeperframe = s.frameperiod;
1615 ret = 0;
1616 }
1617
1618 dbgarg(cmd, "type=%d\n", p->type);
1619 break;
1620 }
1621 case VIDIOC_S_PARM:
1622 {
1623 struct v4l2_streamparm *p = arg;
1624
1625 if (!ops->vidioc_s_parm)
1626 break;
1627 dbgarg(cmd, "type=%d\n", p->type);
1628 ret = ops->vidioc_s_parm(file, fh, p);
1629 break;
1630 }
1631 case VIDIOC_G_TUNER:
1632 {
1633 struct v4l2_tuner *p = arg;
1634 __u32 index = p->index;
1635
1636 if (!ops->vidioc_g_tuner)
1637 break;
1638
1639 memset(p, 0, sizeof(*p));
1640 p->index = index;
1641
1642 ret = ops->vidioc_g_tuner(file, fh, p);
1643 if (!ret)
1644 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1645 "capability=0x%x, rangelow=%d, "
1646 "rangehigh=%d, signal=%d, afc=%d, "
1647 "rxsubchans=0x%x, audmode=%d\n",
1648 p->index, p->name, p->type,
1649 p->capability, p->rangelow,
1650 p->rangehigh, p->signal, p->afc,
1651 p->rxsubchans, p->audmode);
1652 break;
1653 }
1654 case VIDIOC_S_TUNER:
1655 {
1656 struct v4l2_tuner *p = arg;
1657
1658 if (!ops->vidioc_s_tuner)
1659 break;
1660 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1661 "capability=0x%x, rangelow=%d, "
1662 "rangehigh=%d, signal=%d, afc=%d, "
1663 "rxsubchans=0x%x, audmode=%d\n",
1664 p->index, p->name, p->type,
1665 p->capability, p->rangelow,
1666 p->rangehigh, p->signal, p->afc,
1667 p->rxsubchans, p->audmode);
1668 ret = ops->vidioc_s_tuner(file, fh, p);
1669 break;
1670 }
1671 case VIDIOC_G_FREQUENCY:
1672 {
1673 struct v4l2_frequency *p = arg;
1674
1675 if (!ops->vidioc_g_frequency)
1676 break;
1677
1678 memset(p->reserved, 0, sizeof(p->reserved));
1679
1680 ret = ops->vidioc_g_frequency(file, fh, p);
1681 if (!ret)
1682 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
1683 p->tuner, p->type, p->frequency);
1684 break;
1685 }
1686 case VIDIOC_S_FREQUENCY:
1687 {
1688 struct v4l2_frequency *p = arg;
1689
1690 if (!ops->vidioc_s_frequency)
1691 break;
1692 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
1693 p->tuner, p->type, p->frequency);
1694 ret = ops->vidioc_s_frequency(file, fh, p);
1695 break;
1696 }
1697 case VIDIOC_G_SLICED_VBI_CAP:
1698 {
1699 struct v4l2_sliced_vbi_cap *p = arg;
1700 __u32 type = p->type;
1701
1702 if (!ops->vidioc_g_sliced_vbi_cap)
1703 break;
1704 memset(p, 0, sizeof(*p));
1705 p->type = type;
1706 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1707 ret = ops->vidioc_g_sliced_vbi_cap(file, fh, p);
1708 if (!ret)
1709 dbgarg2("service_set=%d\n", p->service_set);
1710 break;
1711 }
1712 case VIDIOC_LOG_STATUS:
1713 {
1714 if (!ops->vidioc_log_status)
1715 break;
1716 ret = ops->vidioc_log_status(file, fh);
1717 break;
1718 }
1719#ifdef CONFIG_VIDEO_ADV_DEBUG
1720 case VIDIOC_DBG_G_REGISTER:
1721 {
1722 struct v4l2_register *p = arg;
1723
1724 if (!capable(CAP_SYS_ADMIN))
1725 ret = -EPERM;
1726 else if (ops->vidioc_g_register)
1727 ret = ops->vidioc_g_register(file, fh, p);
1728 break;
1729 }
1730 case VIDIOC_DBG_S_REGISTER:
1731 {
1732 struct v4l2_register *p = arg;
1733
1734 if (!capable(CAP_SYS_ADMIN))
1735 ret = -EPERM;
1736 else if (ops->vidioc_s_register)
1737 ret = ops->vidioc_s_register(file, fh, p);
1738 break;
1739 }
1740#endif
1741 case VIDIOC_G_CHIP_IDENT:
1742 {
1743 struct v4l2_chip_ident *p = arg;
1744
1745 if (!ops->vidioc_g_chip_ident)
1746 break;
1747 ret = ops->vidioc_g_chip_ident(file, fh, p);
1748 if (!ret)
1749 dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision);
1750 break;
1751 }
1752 case VIDIOC_S_HW_FREQ_SEEK:
1753 {
1754 struct v4l2_hw_freq_seek *p = arg;
1755
1756 if (!ops->vidioc_s_hw_freq_seek)
1757 break;
1758 dbgarg(cmd,
1759 "tuner=%d, type=%d, seek_upward=%d, wrap_around=%d\n",
1760 p->tuner, p->type, p->seek_upward, p->wrap_around);
1761 ret = ops->vidioc_s_hw_freq_seek(file, fh, p);
1762 break;
1763 }
1764 default:
1765 {
1766 if (!ops->vidioc_default)
1767 break;
1768 ret = ops->vidioc_default(file, fh, cmd, arg);
1769 break;
1770 }
1771 } /* switch */
1772
1773 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {
1774 if (ret < 0) {
1775 v4l_print_ioctl(vfd->name, cmd);
1776 printk(KERN_CONT " error %d\n", ret);
1777 }
1778 }
1779
1780 return ret;
1781}
1782
1783int video_ioctl2(struct inode *inode, struct file *file,
1784 unsigned int cmd, unsigned long arg)
1785{
1786 char sbuf[128];
1787 void *mbuf = NULL;
1788 void *parg = NULL;
1789 int err = -EINVAL;
1790 int is_ext_ctrl;
1791 size_t ctrls_size = 0;
1792 void __user *user_ptr = NULL;
1793
1794#ifdef __OLD_VIDIOC_
1795 cmd = video_fix_command(cmd);
1796#endif
1797 is_ext_ctrl = (cmd == VIDIOC_S_EXT_CTRLS || cmd == VIDIOC_G_EXT_CTRLS ||
1798 cmd == VIDIOC_TRY_EXT_CTRLS);
1799
1800 /* Copy arguments into temp kernel buffer */
1801 switch (_IOC_DIR(cmd)) {
1802 case _IOC_NONE:
1803 parg = NULL;
1804 break;
1805 case _IOC_READ:
1806 case _IOC_WRITE:
1807 case (_IOC_WRITE | _IOC_READ):
1808 if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
1809 parg = sbuf;
1810 } else {
1811 /* too big to allocate from stack */
1812 mbuf = kmalloc(_IOC_SIZE(cmd), GFP_KERNEL);
1813 if (NULL == mbuf)
1814 return -ENOMEM;
1815 parg = mbuf;
1816 }
1817
1818 err = -EFAULT;
1819 if (_IOC_DIR(cmd) & _IOC_WRITE)
1820 if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
1821 goto out;
1822 break;
1823 }
1824
1825 if (is_ext_ctrl) {
1826 struct v4l2_ext_controls *p = parg;
1827
1828 /* In case of an error, tell the caller that it wasn't
1829 a specific control that caused it. */
1830 p->error_idx = p->count;
1831 user_ptr = (void __user *)p->controls;
1832 if (p->count) {
1833 ctrls_size = sizeof(struct v4l2_ext_control) * p->count;
1834 /* Note: v4l2_ext_controls fits in sbuf[] so mbuf is still NULL. */
1835 mbuf = kmalloc(ctrls_size, GFP_KERNEL);
1836 err = -ENOMEM;
1837 if (NULL == mbuf)
1838 goto out_ext_ctrl;
1839 err = -EFAULT;
1840 if (copy_from_user(mbuf, user_ptr, ctrls_size))
1841 goto out_ext_ctrl;
1842 p->controls = mbuf;
1843 }
1844 }
1845
1846 /* Handles IOCTL */
1847 err = __video_do_ioctl(inode, file, cmd, parg);
1848 if (err == -ENOIOCTLCMD)
1849 err = -EINVAL;
1850 if (is_ext_ctrl) {
1851 struct v4l2_ext_controls *p = parg;
1852
1853 p->controls = (void *)user_ptr;
1854 if (p->count && err == 0 && copy_to_user(user_ptr, mbuf, ctrls_size))
1855 err = -EFAULT;
1856 goto out_ext_ctrl;
1857 }
1858 if (err < 0)
1859 goto out;
1860
1861out_ext_ctrl:
1862 /* Copy results into user buffer */
1863 switch (_IOC_DIR(cmd)) {
1864 case _IOC_READ:
1865 case (_IOC_WRITE | _IOC_READ):
1866 if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
1867 err = -EFAULT;
1868 break;
1869 }
1870
1871out:
1872 kfree(mbuf);
1873 return err;
1874}
1875EXPORT_SYMBOL(video_ioctl2);
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c
index 03f20acb668c..31944b11e6ea 100644
--- a/drivers/media/video/videobuf-dma-contig.c
+++ b/drivers/media/video/videobuf-dma-contig.c
@@ -28,10 +28,10 @@ struct videobuf_dma_contig_memory {
28}; 28};
29 29
30#define MAGIC_DC_MEM 0x0733ac61 30#define MAGIC_DC_MEM 0x0733ac61
31#define MAGIC_CHECK(is, should) \ 31#define MAGIC_CHECK(is, should) \
32 if (unlikely((is) != (should))) { \ 32 if (unlikely((is) != (should))) { \
33 pr_err("magic mismatch: %x expected %x\n", is, should); \ 33 pr_err("magic mismatch: %x expected %x\n", (is), (should)); \
34 BUG(); \ 34 BUG(); \
35 } 35 }
36 36
37static void 37static void
diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c
index a868b7ed75ff..be65a2fb3976 100644
--- a/drivers/media/video/videobuf-vmalloc.c
+++ b/drivers/media/video/videobuf-vmalloc.c
@@ -203,7 +203,7 @@ static int __videobuf_iolock (struct videobuf_queue* q,
203 return 0; 203 return 0;
204 204
205 /* FIXME: to properly support USERPTR, remap should occur. 205 /* FIXME: to properly support USERPTR, remap should occur.
206 The code bellow won't work, since mem->vma = NULL 206 The code below won't work, since mem->vma = NULL
207 */ 207 */
208 /* Try to remap memory */ 208 /* Try to remap memory */
209 rc = remap_vmalloc_range(mem->vma, (void *)vb->baddr, 0); 209 rc = remap_vmalloc_range(mem->vma, (void *)vb->baddr, 0);
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 6616e6570557..e69de29bb2d1 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -1,2262 +0,0 @@
1/*
2 * Video capture interface for Linux version 2
3 *
4 * A generic video device interface for the LINUX operating system
5 * using a set of device structures/vectors for low level operations.
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 * Authors: Alan Cox, <alan@redhat.com> (version 1)
13 * Mauro Carvalho Chehab <mchehab@infradead.org> (version 2)
14 *
15 * Fixes: 20000516 Claudio Matsuoka <claudio@conectiva.com>
16 * - Added procfs support
17 */
18
19#define dbgarg(cmd, fmt, arg...) \
20 do { \
21 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { \
22 printk(KERN_DEBUG "%s: ", vfd->name); \
23 v4l_printk_ioctl(cmd); \
24 printk(" " fmt, ## arg); \
25 } \
26 } while (0)
27
28#define dbgarg2(fmt, arg...) \
29 do { \
30 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) \
31 printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);\
32 } while (0)
33
34#include <linux/module.h>
35#include <linux/types.h>
36#include <linux/kernel.h>
37#include <linux/mm.h>
38#include <linux/string.h>
39#include <linux/errno.h>
40#include <linux/init.h>
41#include <linux/kmod.h>
42#include <linux/slab.h>
43#include <linux/smp_lock.h>
44#include <asm/uaccess.h>
45#include <asm/system.h>
46
47#define __OLD_VIDIOC_ /* To allow fixing old calls*/
48#include <linux/videodev2.h>
49
50#ifdef CONFIG_VIDEO_V4L1
51#include <linux/videodev.h>
52#endif
53#include <media/v4l2-common.h>
54#include <linux/video_decoder.h>
55
56#define VIDEO_NUM_DEVICES 256
57#define VIDEO_NAME "video4linux"
58
59struct std_descr {
60 v4l2_std_id std;
61 const char *descr;
62};
63
64static const struct std_descr standards[] = {
65 { V4L2_STD_NTSC, "NTSC" },
66 { V4L2_STD_NTSC_M, "NTSC-M" },
67 { V4L2_STD_NTSC_M_JP, "NTSC-M-JP" },
68 { V4L2_STD_NTSC_M_KR, "NTSC-M-KR" },
69 { V4L2_STD_NTSC_443, "NTSC-443" },
70 { V4L2_STD_PAL, "PAL" },
71 { V4L2_STD_PAL_BG, "PAL-BG" },
72 { V4L2_STD_PAL_B, "PAL-B" },
73 { V4L2_STD_PAL_B1, "PAL-B1" },
74 { V4L2_STD_PAL_G, "PAL-G" },
75 { V4L2_STD_PAL_H, "PAL-H" },
76 { V4L2_STD_PAL_I, "PAL-I" },
77 { V4L2_STD_PAL_DK, "PAL-DK" },
78 { V4L2_STD_PAL_D, "PAL-D" },
79 { V4L2_STD_PAL_D1, "PAL-D1" },
80 { V4L2_STD_PAL_K, "PAL-K" },
81 { V4L2_STD_PAL_M, "PAL-M" },
82 { V4L2_STD_PAL_N, "PAL-N" },
83 { V4L2_STD_PAL_Nc, "PAL-Nc" },
84 { V4L2_STD_PAL_60, "PAL-60" },
85 { V4L2_STD_SECAM, "SECAM" },
86 { V4L2_STD_SECAM_B, "SECAM-B" },
87 { V4L2_STD_SECAM_G, "SECAM-G" },
88 { V4L2_STD_SECAM_H, "SECAM-H" },
89 { V4L2_STD_SECAM_DK, "SECAM-DK" },
90 { V4L2_STD_SECAM_D, "SECAM-D" },
91 { V4L2_STD_SECAM_K, "SECAM-K" },
92 { V4L2_STD_SECAM_K1, "SECAM-K1" },
93 { V4L2_STD_SECAM_L, "SECAM-L" },
94 { V4L2_STD_SECAM_LC, "SECAM-Lc" },
95 { 0, "Unknown" }
96};
97
98/* video4linux standard ID conversion to standard name
99 */
100const char *v4l2_norm_to_name(v4l2_std_id id)
101{
102 u32 myid = id;
103 int i;
104
105 /* HACK: ppc32 architecture doesn't have __ucmpdi2 function to handle
106 64 bit comparations. So, on that architecture, with some gcc
107 variants, compilation fails. Currently, the max value is 30bit wide.
108 */
109 BUG_ON(myid != id);
110
111 for (i = 0; standards[i].std; i++)
112 if (myid == standards[i].std)
113 break;
114 return standards[i].descr;
115}
116EXPORT_SYMBOL(v4l2_norm_to_name);
117
118/* Fill in the fields of a v4l2_standard structure according to the
119 'id' and 'transmission' parameters. Returns negative on error. */
120int v4l2_video_std_construct(struct v4l2_standard *vs,
121 int id, const char *name)
122{
123 u32 index = vs->index;
124
125 memset(vs, 0, sizeof(struct v4l2_standard));
126 vs->index = index;
127 vs->id = id;
128 if (id & V4L2_STD_525_60) {
129 vs->frameperiod.numerator = 1001;
130 vs->frameperiod.denominator = 30000;
131 vs->framelines = 525;
132 } else {
133 vs->frameperiod.numerator = 1;
134 vs->frameperiod.denominator = 25;
135 vs->framelines = 625;
136 }
137 strlcpy(vs->name, name, sizeof(vs->name));
138 return 0;
139}
140EXPORT_SYMBOL(v4l2_video_std_construct);
141
142/* ----------------------------------------------------------------- */
143/* some arrays for pretty-printing debug messages of enum types */
144
145const char *v4l2_field_names[] = {
146 [V4L2_FIELD_ANY] = "any",
147 [V4L2_FIELD_NONE] = "none",
148 [V4L2_FIELD_TOP] = "top",
149 [V4L2_FIELD_BOTTOM] = "bottom",
150 [V4L2_FIELD_INTERLACED] = "interlaced",
151 [V4L2_FIELD_SEQ_TB] = "seq-tb",
152 [V4L2_FIELD_SEQ_BT] = "seq-bt",
153 [V4L2_FIELD_ALTERNATE] = "alternate",
154 [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb",
155 [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt",
156};
157EXPORT_SYMBOL(v4l2_field_names);
158
159const char *v4l2_type_names[] = {
160 [V4L2_BUF_TYPE_VIDEO_CAPTURE] = "vid-cap",
161 [V4L2_BUF_TYPE_VIDEO_OVERLAY] = "vid-overlay",
162 [V4L2_BUF_TYPE_VIDEO_OUTPUT] = "vid-out",
163 [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap",
164 [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out",
165 [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap",
166 [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out",
167 [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "vid-out-overlay",
168};
169EXPORT_SYMBOL(v4l2_type_names);
170
171static const char *v4l2_memory_names[] = {
172 [V4L2_MEMORY_MMAP] = "mmap",
173 [V4L2_MEMORY_USERPTR] = "userptr",
174 [V4L2_MEMORY_OVERLAY] = "overlay",
175};
176
177#define prt_names(a, arr) ((((a) >= 0) && ((a) < ARRAY_SIZE(arr))) ? \
178 arr[a] : "unknown")
179
180/* ------------------------------------------------------------------ */
181/* debug help functions */
182
183#ifdef CONFIG_VIDEO_V4L1_COMPAT
184static const char *v4l1_ioctls[] = {
185 [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP",
186 [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN",
187 [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN",
188 [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER",
189 [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER",
190 [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT",
191 [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT",
192 [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE",
193 [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN",
194 [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN",
195 [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF",
196 [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF",
197 [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY",
198 [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ",
199 [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ",
200 [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO",
201 [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO",
202 [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC",
203 [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE",
204 [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF",
205 [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT",
206 [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE",
207 [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE",
208 [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE",
209 [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE",
210 [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO",
211 [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE",
212 [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT",
213 [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT"
214};
215#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls)
216#endif
217
218static const char *v4l2_ioctls[] = {
219 [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP",
220 [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED",
221 [_IOC_NR(VIDIOC_ENUM_FMT)] = "VIDIOC_ENUM_FMT",
222 [_IOC_NR(VIDIOC_G_FMT)] = "VIDIOC_G_FMT",
223 [_IOC_NR(VIDIOC_S_FMT)] = "VIDIOC_S_FMT",
224 [_IOC_NR(VIDIOC_REQBUFS)] = "VIDIOC_REQBUFS",
225 [_IOC_NR(VIDIOC_QUERYBUF)] = "VIDIOC_QUERYBUF",
226 [_IOC_NR(VIDIOC_G_FBUF)] = "VIDIOC_G_FBUF",
227 [_IOC_NR(VIDIOC_S_FBUF)] = "VIDIOC_S_FBUF",
228 [_IOC_NR(VIDIOC_OVERLAY)] = "VIDIOC_OVERLAY",
229 [_IOC_NR(VIDIOC_QBUF)] = "VIDIOC_QBUF",
230 [_IOC_NR(VIDIOC_DQBUF)] = "VIDIOC_DQBUF",
231 [_IOC_NR(VIDIOC_STREAMON)] = "VIDIOC_STREAMON",
232 [_IOC_NR(VIDIOC_STREAMOFF)] = "VIDIOC_STREAMOFF",
233 [_IOC_NR(VIDIOC_G_PARM)] = "VIDIOC_G_PARM",
234 [_IOC_NR(VIDIOC_S_PARM)] = "VIDIOC_S_PARM",
235 [_IOC_NR(VIDIOC_G_STD)] = "VIDIOC_G_STD",
236 [_IOC_NR(VIDIOC_S_STD)] = "VIDIOC_S_STD",
237 [_IOC_NR(VIDIOC_ENUMSTD)] = "VIDIOC_ENUMSTD",
238 [_IOC_NR(VIDIOC_ENUMINPUT)] = "VIDIOC_ENUMINPUT",
239 [_IOC_NR(VIDIOC_G_CTRL)] = "VIDIOC_G_CTRL",
240 [_IOC_NR(VIDIOC_S_CTRL)] = "VIDIOC_S_CTRL",
241 [_IOC_NR(VIDIOC_G_TUNER)] = "VIDIOC_G_TUNER",
242 [_IOC_NR(VIDIOC_S_TUNER)] = "VIDIOC_S_TUNER",
243 [_IOC_NR(VIDIOC_G_AUDIO)] = "VIDIOC_G_AUDIO",
244 [_IOC_NR(VIDIOC_S_AUDIO)] = "VIDIOC_S_AUDIO",
245 [_IOC_NR(VIDIOC_QUERYCTRL)] = "VIDIOC_QUERYCTRL",
246 [_IOC_NR(VIDIOC_QUERYMENU)] = "VIDIOC_QUERYMENU",
247 [_IOC_NR(VIDIOC_G_INPUT)] = "VIDIOC_G_INPUT",
248 [_IOC_NR(VIDIOC_S_INPUT)] = "VIDIOC_S_INPUT",
249 [_IOC_NR(VIDIOC_G_OUTPUT)] = "VIDIOC_G_OUTPUT",
250 [_IOC_NR(VIDIOC_S_OUTPUT)] = "VIDIOC_S_OUTPUT",
251 [_IOC_NR(VIDIOC_ENUMOUTPUT)] = "VIDIOC_ENUMOUTPUT",
252 [_IOC_NR(VIDIOC_G_AUDOUT)] = "VIDIOC_G_AUDOUT",
253 [_IOC_NR(VIDIOC_S_AUDOUT)] = "VIDIOC_S_AUDOUT",
254 [_IOC_NR(VIDIOC_G_MODULATOR)] = "VIDIOC_G_MODULATOR",
255 [_IOC_NR(VIDIOC_S_MODULATOR)] = "VIDIOC_S_MODULATOR",
256 [_IOC_NR(VIDIOC_G_FREQUENCY)] = "VIDIOC_G_FREQUENCY",
257 [_IOC_NR(VIDIOC_S_FREQUENCY)] = "VIDIOC_S_FREQUENCY",
258 [_IOC_NR(VIDIOC_CROPCAP)] = "VIDIOC_CROPCAP",
259 [_IOC_NR(VIDIOC_G_CROP)] = "VIDIOC_G_CROP",
260 [_IOC_NR(VIDIOC_S_CROP)] = "VIDIOC_S_CROP",
261 [_IOC_NR(VIDIOC_G_JPEGCOMP)] = "VIDIOC_G_JPEGCOMP",
262 [_IOC_NR(VIDIOC_S_JPEGCOMP)] = "VIDIOC_S_JPEGCOMP",
263 [_IOC_NR(VIDIOC_QUERYSTD)] = "VIDIOC_QUERYSTD",
264 [_IOC_NR(VIDIOC_TRY_FMT)] = "VIDIOC_TRY_FMT",
265 [_IOC_NR(VIDIOC_ENUMAUDIO)] = "VIDIOC_ENUMAUDIO",
266 [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT",
267 [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY",
268 [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY",
269 [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP",
270 [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS",
271 [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS",
272 [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS",
273 [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS",
274#if 1
275 [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES",
276 [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS",
277 [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX",
278 [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD",
279 [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD",
280
281 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER",
282 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER",
283
284 [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT",
285 [_IOC_NR(VIDIOC_S_HW_FREQ_SEEK)] = "VIDIOC_S_HW_FREQ_SEEK",
286#endif
287};
288#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
289
290static const char *v4l2_int_ioctls[] = {
291#ifdef CONFIG_VIDEO_V4L1_COMPAT
292 [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES",
293 [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS",
294 [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM",
295 [_IOC_NR(DECODER_SET_INPUT)] = "DECODER_SET_INPUT",
296 [_IOC_NR(DECODER_SET_OUTPUT)] = "DECODER_SET_OUTPUT",
297 [_IOC_NR(DECODER_ENABLE_OUTPUT)] = "DECODER_ENABLE_OUTPUT",
298 [_IOC_NR(DECODER_SET_PICTURE)] = "DECODER_SET_PICTURE",
299 [_IOC_NR(DECODER_SET_GPIO)] = "DECODER_SET_GPIO",
300 [_IOC_NR(DECODER_INIT)] = "DECODER_INIT",
301 [_IOC_NR(DECODER_SET_VBI_BYPASS)] = "DECODER_SET_VBI_BYPASS",
302 [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP",
303#endif
304 [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO",
305
306 [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR",
307 [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY",
308 [_IOC_NR(TUNER_SET_CONFIG)] = "TUNER_SET_CONFIG",
309
310 [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE",
311 [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET",
312 [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ",
313 [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE",
314 [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA",
315 [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA",
316 [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ",
317 [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY",
318 [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING",
319 [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)] = "VIDIOC_INT_G_AUDIO_ROUTING",
320 [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)] = "VIDIOC_INT_S_VIDEO_ROUTING",
321 [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)] = "VIDIOC_INT_G_VIDEO_ROUTING",
322 [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)] = "VIDIOC_INT_S_CRYSTAL_FREQ",
323 [_IOC_NR(VIDIOC_INT_INIT)] = "VIDIOC_INT_INIT",
324 [_IOC_NR(VIDIOC_INT_G_STD_OUTPUT)] = "VIDIOC_INT_G_STD_OUTPUT",
325 [_IOC_NR(VIDIOC_INT_S_STD_OUTPUT)] = "VIDIOC_INT_S_STD_OUTPUT",
326};
327#define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls)
328
329/* Common ioctl debug function. This function can be used by
330 external ioctl messages as well as internal V4L ioctl */
331void v4l_printk_ioctl(unsigned int cmd)
332{
333 char *dir, *type;
334
335 switch (_IOC_TYPE(cmd)) {
336 case 'd':
337 if (_IOC_NR(cmd) >= V4L2_INT_IOCTLS) {
338 type = "v4l2_int";
339 break;
340 }
341 printk("%s", v4l2_int_ioctls[_IOC_NR(cmd)]);
342 return;
343#ifdef CONFIG_VIDEO_V4L1_COMPAT
344 case 'v':
345 if (_IOC_NR(cmd) >= V4L1_IOCTLS) {
346 type = "v4l1";
347 break;
348 }
349 printk("%s", v4l1_ioctls[_IOC_NR(cmd)]);
350 return;
351#endif
352 case 'V':
353 if (_IOC_NR(cmd) >= V4L2_IOCTLS) {
354 type = "v4l2";
355 break;
356 }
357 printk("%s", v4l2_ioctls[_IOC_NR(cmd)]);
358 return;
359 default:
360 type = "unknown";
361 }
362
363 switch (_IOC_DIR(cmd)) {
364 case _IOC_NONE: dir = "--"; break;
365 case _IOC_READ: dir = "r-"; break;
366 case _IOC_WRITE: dir = "-w"; break;
367 case _IOC_READ | _IOC_WRITE: dir = "rw"; break;
368 default: dir = "*ERR*"; break;
369 }
370 printk("%s ioctl '%c', dir=%s, #%d (0x%08x)",
371 type, _IOC_TYPE(cmd), dir, _IOC_NR(cmd), cmd);
372}
373EXPORT_SYMBOL(v4l_printk_ioctl);
374
375/*
376 * sysfs stuff
377 */
378
379static ssize_t show_index(struct device *cd,
380 struct device_attribute *attr, char *buf)
381{
382 struct video_device *vfd = container_of(cd, struct video_device,
383 class_dev);
384 return sprintf(buf, "%i\n", vfd->index);
385}
386
387static ssize_t show_name(struct device *cd,
388 struct device_attribute *attr, char *buf)
389{
390 struct video_device *vfd = container_of(cd, struct video_device,
391 class_dev);
392 return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name);
393}
394
395static struct device_attribute video_device_attrs[] = {
396 __ATTR(name, S_IRUGO, show_name, NULL),
397 __ATTR(index, S_IRUGO, show_index, NULL),
398 __ATTR_NULL
399};
400
401struct video_device *video_device_alloc(void)
402{
403 struct video_device *vfd;
404
405 vfd = kzalloc(sizeof(*vfd),GFP_KERNEL);
406 return vfd;
407}
408EXPORT_SYMBOL(video_device_alloc);
409
410void video_device_release(struct video_device *vfd)
411{
412 kfree(vfd);
413}
414EXPORT_SYMBOL(video_device_release);
415
416static void video_release(struct device *cd)
417{
418 struct video_device *vfd = container_of(cd, struct video_device,
419 class_dev);
420
421#if 1
422 /* needed until all drivers are fixed */
423 if (!vfd->release)
424 return;
425#endif
426 vfd->release(vfd);
427}
428
429static struct class video_class = {
430 .name = VIDEO_NAME,
431 .dev_attrs = video_device_attrs,
432 .dev_release = video_release,
433};
434
435/*
436 * Active devices
437 */
438
439static struct video_device *video_device[VIDEO_NUM_DEVICES];
440static DEFINE_MUTEX(videodev_lock);
441
442struct video_device* video_devdata(struct file *file)
443{
444 return video_device[iminor(file->f_path.dentry->d_inode)];
445}
446EXPORT_SYMBOL(video_devdata);
447
448/*
449 * Open a video device - FIXME: Obsoleted
450 */
451static int video_open(struct inode *inode, struct file *file)
452{
453 unsigned int minor = iminor(inode);
454 int err = 0;
455 struct video_device *vfl;
456 const struct file_operations *old_fops;
457
458 if(minor>=VIDEO_NUM_DEVICES)
459 return -ENODEV;
460 lock_kernel();
461 mutex_lock(&videodev_lock);
462 vfl=video_device[minor];
463 if(vfl==NULL) {
464 mutex_unlock(&videodev_lock);
465 request_module("char-major-%d-%d", VIDEO_MAJOR, minor);
466 mutex_lock(&videodev_lock);
467 vfl=video_device[minor];
468 if (vfl==NULL) {
469 mutex_unlock(&videodev_lock);
470 unlock_kernel();
471 return -ENODEV;
472 }
473 }
474 old_fops = file->f_op;
475 file->f_op = fops_get(vfl->fops);
476 if(file->f_op->open)
477 err = file->f_op->open(inode,file);
478 if (err) {
479 fops_put(file->f_op);
480 file->f_op = fops_get(old_fops);
481 }
482 fops_put(old_fops);
483 mutex_unlock(&videodev_lock);
484 unlock_kernel();
485 return err;
486}
487
488/*
489 * helper function -- handles userspace copying for ioctl arguments
490 */
491
492#ifdef __OLD_VIDIOC_
493static unsigned int
494video_fix_command(unsigned int cmd)
495{
496 switch (cmd) {
497 case VIDIOC_OVERLAY_OLD:
498 cmd = VIDIOC_OVERLAY;
499 break;
500 case VIDIOC_S_PARM_OLD:
501 cmd = VIDIOC_S_PARM;
502 break;
503 case VIDIOC_S_CTRL_OLD:
504 cmd = VIDIOC_S_CTRL;
505 break;
506 case VIDIOC_G_AUDIO_OLD:
507 cmd = VIDIOC_G_AUDIO;
508 break;
509 case VIDIOC_G_AUDOUT_OLD:
510 cmd = VIDIOC_G_AUDOUT;
511 break;
512 case VIDIOC_CROPCAP_OLD:
513 cmd = VIDIOC_CROPCAP;
514 break;
515 }
516 return cmd;
517}
518#endif
519
520/*
521 * Obsolete usercopy function - Should be removed soon
522 */
523int
524video_usercopy(struct inode *inode, struct file *file,
525 unsigned int cmd, unsigned long arg,
526 int (*func)(struct inode *inode, struct file *file,
527 unsigned int cmd, void *arg))
528{
529 char sbuf[128];
530 void *mbuf = NULL;
531 void *parg = NULL;
532 int err = -EINVAL;
533 int is_ext_ctrl;
534 size_t ctrls_size = 0;
535 void __user *user_ptr = NULL;
536
537#ifdef __OLD_VIDIOC_
538 cmd = video_fix_command(cmd);
539#endif
540 is_ext_ctrl = (cmd == VIDIOC_S_EXT_CTRLS || cmd == VIDIOC_G_EXT_CTRLS ||
541 cmd == VIDIOC_TRY_EXT_CTRLS);
542
543 /* Copy arguments into temp kernel buffer */
544 switch (_IOC_DIR(cmd)) {
545 case _IOC_NONE:
546 parg = NULL;
547 break;
548 case _IOC_READ:
549 case _IOC_WRITE:
550 case (_IOC_WRITE | _IOC_READ):
551 if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
552 parg = sbuf;
553 } else {
554 /* too big to allocate from stack */
555 mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
556 if (NULL == mbuf)
557 return -ENOMEM;
558 parg = mbuf;
559 }
560
561 err = -EFAULT;
562 if (_IOC_DIR(cmd) & _IOC_WRITE)
563 if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
564 goto out;
565 break;
566 }
567 if (is_ext_ctrl) {
568 struct v4l2_ext_controls *p = parg;
569
570 /* In case of an error, tell the caller that it wasn't
571 a specific control that caused it. */
572 p->error_idx = p->count;
573 user_ptr = (void __user *)p->controls;
574 if (p->count) {
575 ctrls_size = sizeof(struct v4l2_ext_control) * p->count;
576 /* Note: v4l2_ext_controls fits in sbuf[] so mbuf is still NULL. */
577 mbuf = kmalloc(ctrls_size, GFP_KERNEL);
578 err = -ENOMEM;
579 if (NULL == mbuf)
580 goto out_ext_ctrl;
581 err = -EFAULT;
582 if (copy_from_user(mbuf, user_ptr, ctrls_size))
583 goto out_ext_ctrl;
584 p->controls = mbuf;
585 }
586 }
587
588 /* call driver */
589 err = func(inode, file, cmd, parg);
590 if (err == -ENOIOCTLCMD)
591 err = -EINVAL;
592 if (is_ext_ctrl) {
593 struct v4l2_ext_controls *p = parg;
594
595 p->controls = (void *)user_ptr;
596 if (p->count && err == 0 && copy_to_user(user_ptr, mbuf, ctrls_size))
597 err = -EFAULT;
598 goto out_ext_ctrl;
599 }
600 if (err < 0)
601 goto out;
602
603out_ext_ctrl:
604 /* Copy results into user buffer */
605 switch (_IOC_DIR(cmd))
606 {
607 case _IOC_READ:
608 case (_IOC_WRITE | _IOC_READ):
609 if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
610 err = -EFAULT;
611 break;
612 }
613
614out:
615 kfree(mbuf);
616 return err;
617}
618EXPORT_SYMBOL(video_usercopy);
619
620/*
621 * open/release helper functions -- handle exclusive opens
622 * Should be removed soon
623 */
624int video_exclusive_open(struct inode *inode, struct file *file)
625{
626 struct video_device *vfl = video_devdata(file);
627 int retval = 0;
628
629 mutex_lock(&vfl->lock);
630 if (vfl->users) {
631 retval = -EBUSY;
632 } else {
633 vfl->users++;
634 }
635 mutex_unlock(&vfl->lock);
636 return retval;
637}
638EXPORT_SYMBOL(video_exclusive_open);
639
640int video_exclusive_release(struct inode *inode, struct file *file)
641{
642 struct video_device *vfl = video_devdata(file);
643
644 vfl->users--;
645 return 0;
646}
647EXPORT_SYMBOL(video_exclusive_release);
648
649static void dbgbuf(unsigned int cmd, struct video_device *vfd,
650 struct v4l2_buffer *p)
651{
652 struct v4l2_timecode *tc=&p->timecode;
653
654 dbgarg (cmd, "%02ld:%02d:%02d.%08ld index=%d, type=%s, "
655 "bytesused=%d, flags=0x%08d, "
656 "field=%0d, sequence=%d, memory=%s, offset/userptr=0x%08lx, length=%d\n",
657 (p->timestamp.tv_sec/3600),
658 (int)(p->timestamp.tv_sec/60)%60,
659 (int)(p->timestamp.tv_sec%60),
660 p->timestamp.tv_usec,
661 p->index,
662 prt_names(p->type, v4l2_type_names),
663 p->bytesused, p->flags,
664 p->field, p->sequence,
665 prt_names(p->memory, v4l2_memory_names),
666 p->m.userptr, p->length);
667 dbgarg2("timecode=%02d:%02d:%02d type=%d, "
668 "flags=0x%08d, frames=%d, userbits=0x%08x\n",
669 tc->hours,tc->minutes,tc->seconds,
670 tc->type, tc->flags, tc->frames, *(__u32 *) tc->userbits);
671}
672
673static inline void dbgrect(struct video_device *vfd, char *s,
674 struct v4l2_rect *r)
675{
676 dbgarg2("%sRect start at %dx%d, size=%dx%d\n", s, r->left, r->top,
677 r->width, r->height);
678};
679
680static inline void v4l_print_pix_fmt (struct video_device *vfd,
681 struct v4l2_pix_format *fmt)
682{
683 dbgarg2 ("width=%d, height=%d, format=%c%c%c%c, field=%s, "
684 "bytesperline=%d sizeimage=%d, colorspace=%d\n",
685 fmt->width,fmt->height,
686 (fmt->pixelformat & 0xff),
687 (fmt->pixelformat >> 8) & 0xff,
688 (fmt->pixelformat >> 16) & 0xff,
689 (fmt->pixelformat >> 24) & 0xff,
690 prt_names(fmt->field, v4l2_field_names),
691 fmt->bytesperline, fmt->sizeimage, fmt->colorspace);
692};
693
694static inline void v4l_print_ext_ctrls(unsigned int cmd,
695 struct video_device *vfd, struct v4l2_ext_controls *c, int show_vals)
696{
697 __u32 i;
698
699 if (!(vfd->debug & V4L2_DEBUG_IOCTL_ARG))
700 return;
701 dbgarg(cmd, "");
702 printk(KERN_CONT "class=0x%x", c->ctrl_class);
703 for (i = 0; i < c->count; i++) {
704 if (show_vals)
705 printk(KERN_CONT " id/val=0x%x/0x%x",
706 c->controls[i].id, c->controls[i].value);
707 else
708 printk(KERN_CONT " id=0x%x", c->controls[i].id);
709 }
710 printk(KERN_CONT "\n");
711};
712
713static inline int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv)
714{
715 __u32 i;
716
717 /* zero the reserved fields */
718 c->reserved[0] = c->reserved[1] = 0;
719 for (i = 0; i < c->count; i++) {
720 c->controls[i].reserved2[0] = 0;
721 c->controls[i].reserved2[1] = 0;
722 }
723 /* V4L2_CID_PRIVATE_BASE cannot be used as control class
724 when using extended controls.
725 Only when passed in through VIDIOC_G_CTRL and VIDIOC_S_CTRL
726 is it allowed for backwards compatibility.
727 */
728 if (!allow_priv && c->ctrl_class == V4L2_CID_PRIVATE_BASE)
729 return 0;
730 /* Check that all controls are from the same control class. */
731 for (i = 0; i < c->count; i++) {
732 if (V4L2_CTRL_ID2CLASS(c->controls[i].id) != c->ctrl_class) {
733 c->error_idx = i;
734 return 0;
735 }
736 }
737 return 1;
738}
739
740static int check_fmt (struct video_device *vfd, enum v4l2_buf_type type)
741{
742 switch (type) {
743 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
744 if (vfd->vidioc_try_fmt_vid_cap)
745 return (0);
746 break;
747 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
748 if (vfd->vidioc_try_fmt_vid_overlay)
749 return (0);
750 break;
751 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
752 if (vfd->vidioc_try_fmt_vid_out)
753 return (0);
754 break;
755 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
756 if (vfd->vidioc_try_fmt_vid_out_overlay)
757 return (0);
758 break;
759 case V4L2_BUF_TYPE_VBI_CAPTURE:
760 if (vfd->vidioc_try_fmt_vbi_cap)
761 return (0);
762 break;
763 case V4L2_BUF_TYPE_VBI_OUTPUT:
764 if (vfd->vidioc_try_fmt_vbi_out)
765 return (0);
766 break;
767 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
768 if (vfd->vidioc_try_fmt_sliced_vbi_cap)
769 return (0);
770 break;
771 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
772 if (vfd->vidioc_try_fmt_sliced_vbi_out)
773 return (0);
774 break;
775 case V4L2_BUF_TYPE_PRIVATE:
776 if (vfd->vidioc_try_fmt_type_private)
777 return (0);
778 break;
779 }
780 return (-EINVAL);
781}
782
783static int __video_do_ioctl(struct inode *inode, struct file *file,
784 unsigned int cmd, void *arg)
785{
786 struct video_device *vfd = video_devdata(file);
787 void *fh = file->private_data;
788 int ret = -EINVAL;
789
790 if ( (vfd->debug & V4L2_DEBUG_IOCTL) &&
791 !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) {
792 v4l_print_ioctl(vfd->name, cmd);
793 printk("\n");
794 }
795
796#ifdef CONFIG_VIDEO_V4L1_COMPAT
797 /***********************************************************
798 Handles calls to the obsoleted V4L1 API
799 Due to the nature of VIDIOCGMBUF, each driver that supports
800 V4L1 should implement its own handler for this ioctl.
801 ***********************************************************/
802
803 /* --- streaming capture ------------------------------------- */
804 if (cmd == VIDIOCGMBUF) {
805 struct video_mbuf *p=arg;
806
807 memset(p, 0, sizeof(*p));
808
809 if (!vfd->vidiocgmbuf)
810 return ret;
811 ret=vfd->vidiocgmbuf(file, fh, p);
812 if (!ret)
813 dbgarg (cmd, "size=%d, frames=%d, offsets=0x%08lx\n",
814 p->size, p->frames,
815 (unsigned long)p->offsets);
816 return ret;
817 }
818
819 /********************************************************
820 All other V4L1 calls are handled by v4l1_compat module.
821 Those calls will be translated into V4L2 calls, and
822 __video_do_ioctl will be called again, with one or more
823 V4L2 ioctls.
824 ********************************************************/
825 if (_IOC_TYPE(cmd)=='v')
826 return v4l_compat_translate_ioctl(inode,file,cmd,arg,
827 __video_do_ioctl);
828#endif
829
830 switch(cmd) {
831 /* --- capabilities ------------------------------------------ */
832 case VIDIOC_QUERYCAP:
833 {
834 struct v4l2_capability *cap = (struct v4l2_capability*)arg;
835 memset(cap, 0, sizeof(*cap));
836
837 if (!vfd->vidioc_querycap)
838 break;
839
840 ret=vfd->vidioc_querycap(file, fh, cap);
841 if (!ret)
842 dbgarg (cmd, "driver=%s, card=%s, bus=%s, "
843 "version=0x%08x, "
844 "capabilities=0x%08x\n",
845 cap->driver,cap->card,cap->bus_info,
846 cap->version,
847 cap->capabilities);
848 break;
849 }
850
851 /* --- priority ------------------------------------------ */
852 case VIDIOC_G_PRIORITY:
853 {
854 enum v4l2_priority *p=arg;
855
856 if (!vfd->vidioc_g_priority)
857 break;
858 ret=vfd->vidioc_g_priority(file, fh, p);
859 if (!ret)
860 dbgarg(cmd, "priority is %d\n", *p);
861 break;
862 }
863 case VIDIOC_S_PRIORITY:
864 {
865 enum v4l2_priority *p=arg;
866
867 if (!vfd->vidioc_s_priority)
868 break;
869 dbgarg(cmd, "setting priority to %d\n", *p);
870 ret=vfd->vidioc_s_priority(file, fh, *p);
871 break;
872 }
873
874 /* --- capture ioctls ---------------------------------------- */
875 case VIDIOC_ENUM_FMT:
876 {
877 struct v4l2_fmtdesc *f = arg;
878 enum v4l2_buf_type type;
879 unsigned int index;
880
881 index = f->index;
882 type = f->type;
883 memset(f,0,sizeof(*f));
884 f->index = index;
885 f->type = type;
886
887 switch (type) {
888 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
889 if (vfd->vidioc_enum_fmt_vid_cap)
890 ret = vfd->vidioc_enum_fmt_vid_cap(file, fh, f);
891 break;
892 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
893 if (vfd->vidioc_enum_fmt_vid_overlay)
894 ret = vfd->vidioc_enum_fmt_vid_overlay(file,
895 fh, f);
896 break;
897#if 1
898 /* V4L2_BUF_TYPE_VBI_CAPTURE should not support VIDIOC_ENUM_FMT
899 * according to the spec. The bttv and saa7134 drivers support
900 * it though, so just warn that this is deprecated and will be
901 * removed in the near future. */
902 case V4L2_BUF_TYPE_VBI_CAPTURE:
903 if (vfd->vidioc_enum_fmt_vbi_cap) {
904 printk(KERN_WARNING "vidioc_enum_fmt_vbi_cap will be removed in 2.6.28!\n");
905 ret = vfd->vidioc_enum_fmt_vbi_cap(file, fh, f);
906 }
907 break;
908#endif
909 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
910 if (vfd->vidioc_enum_fmt_vid_out)
911 ret = vfd->vidioc_enum_fmt_vid_out(file, fh, f);
912 break;
913 case V4L2_BUF_TYPE_PRIVATE:
914 if (vfd->vidioc_enum_fmt_type_private)
915 ret = vfd->vidioc_enum_fmt_type_private(file,
916 fh, f);
917 break;
918 default:
919 break;
920 }
921 if (!ret)
922 dbgarg (cmd, "index=%d, type=%d, flags=%d, "
923 "pixelformat=%c%c%c%c, description='%s'\n",
924 f->index, f->type, f->flags,
925 (f->pixelformat & 0xff),
926 (f->pixelformat >> 8) & 0xff,
927 (f->pixelformat >> 16) & 0xff,
928 (f->pixelformat >> 24) & 0xff,
929 f->description);
930 break;
931 }
932 case VIDIOC_G_FMT:
933 {
934 struct v4l2_format *f = (struct v4l2_format *)arg;
935
936 memset(f->fmt.raw_data, 0, sizeof(f->fmt.raw_data));
937
938 /* FIXME: Should be one dump per type */
939 dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
940
941 switch (f->type) {
942 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
943 if (vfd->vidioc_g_fmt_vid_cap)
944 ret = vfd->vidioc_g_fmt_vid_cap(file, fh, f);
945 if (!ret)
946 v4l_print_pix_fmt(vfd, &f->fmt.pix);
947 break;
948 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
949 if (vfd->vidioc_g_fmt_vid_overlay)
950 ret = vfd->vidioc_g_fmt_vid_overlay(file,
951 fh, f);
952 break;
953 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
954 if (vfd->vidioc_g_fmt_vid_out)
955 ret = vfd->vidioc_g_fmt_vid_out(file, fh, f);
956 if (!ret)
957 v4l_print_pix_fmt(vfd, &f->fmt.pix);
958 break;
959 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
960 if (vfd->vidioc_g_fmt_vid_out_overlay)
961 ret = vfd->vidioc_g_fmt_vid_out_overlay(file,
962 fh, f);
963 break;
964 case V4L2_BUF_TYPE_VBI_CAPTURE:
965 if (vfd->vidioc_g_fmt_vbi_cap)
966 ret = vfd->vidioc_g_fmt_vbi_cap(file, fh, f);
967 break;
968 case V4L2_BUF_TYPE_VBI_OUTPUT:
969 if (vfd->vidioc_g_fmt_vbi_out)
970 ret = vfd->vidioc_g_fmt_vbi_out(file, fh, f);
971 break;
972 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
973 if (vfd->vidioc_g_fmt_sliced_vbi_cap)
974 ret = vfd->vidioc_g_fmt_sliced_vbi_cap(file,
975 fh, f);
976 break;
977 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
978 if (vfd->vidioc_g_fmt_sliced_vbi_out)
979 ret = vfd->vidioc_g_fmt_sliced_vbi_out(file,
980 fh, f);
981 break;
982 case V4L2_BUF_TYPE_PRIVATE:
983 if (vfd->vidioc_g_fmt_type_private)
984 ret = vfd->vidioc_g_fmt_type_private(file,
985 fh, f);
986 break;
987 }
988
989 break;
990 }
991 case VIDIOC_S_FMT:
992 {
993 struct v4l2_format *f = (struct v4l2_format *)arg;
994
995 /* FIXME: Should be one dump per type */
996 dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names));
997
998 switch (f->type) {
999 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
1000 v4l_print_pix_fmt(vfd, &f->fmt.pix);
1001 if (vfd->vidioc_s_fmt_vid_cap)
1002 ret = vfd->vidioc_s_fmt_vid_cap(file, fh, f);
1003 break;
1004 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
1005 if (vfd->vidioc_s_fmt_vid_overlay)
1006 ret = vfd->vidioc_s_fmt_vid_overlay(file,
1007 fh, f);
1008 break;
1009 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
1010 v4l_print_pix_fmt(vfd, &f->fmt.pix);
1011 if (vfd->vidioc_s_fmt_vid_out)
1012 ret = vfd->vidioc_s_fmt_vid_out(file, fh, f);
1013 break;
1014 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
1015 if (vfd->vidioc_s_fmt_vid_out_overlay)
1016 ret = vfd->vidioc_s_fmt_vid_out_overlay(file,
1017 fh, f);
1018 break;
1019 case V4L2_BUF_TYPE_VBI_CAPTURE:
1020 if (vfd->vidioc_s_fmt_vbi_cap)
1021 ret = vfd->vidioc_s_fmt_vbi_cap(file, fh, f);
1022 break;
1023 case V4L2_BUF_TYPE_VBI_OUTPUT:
1024 if (vfd->vidioc_s_fmt_vbi_out)
1025 ret = vfd->vidioc_s_fmt_vbi_out(file, fh, f);
1026 break;
1027 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
1028 if (vfd->vidioc_s_fmt_sliced_vbi_cap)
1029 ret = vfd->vidioc_s_fmt_sliced_vbi_cap(file,
1030 fh, f);
1031 break;
1032 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
1033 if (vfd->vidioc_s_fmt_sliced_vbi_out)
1034 ret = vfd->vidioc_s_fmt_sliced_vbi_out(file,
1035 fh, f);
1036 break;
1037 case V4L2_BUF_TYPE_PRIVATE:
1038 if (vfd->vidioc_s_fmt_type_private)
1039 ret = vfd->vidioc_s_fmt_type_private(file,
1040 fh, f);
1041 break;
1042 }
1043 break;
1044 }
1045 case VIDIOC_TRY_FMT:
1046 {
1047 struct v4l2_format *f = (struct v4l2_format *)arg;
1048
1049 /* FIXME: Should be one dump per type */
1050 dbgarg (cmd, "type=%s\n", prt_names(f->type,
1051 v4l2_type_names));
1052 switch (f->type) {
1053 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
1054 if (vfd->vidioc_try_fmt_vid_cap)
1055 ret = vfd->vidioc_try_fmt_vid_cap(file, fh, f);
1056 if (!ret)
1057 v4l_print_pix_fmt(vfd, &f->fmt.pix);
1058 break;
1059 case V4L2_BUF_TYPE_VIDEO_OVERLAY:
1060 if (vfd->vidioc_try_fmt_vid_overlay)
1061 ret = vfd->vidioc_try_fmt_vid_overlay(file,
1062 fh, f);
1063 break;
1064 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
1065 if (vfd->vidioc_try_fmt_vid_out)
1066 ret = vfd->vidioc_try_fmt_vid_out(file, fh, f);
1067 if (!ret)
1068 v4l_print_pix_fmt(vfd, &f->fmt.pix);
1069 break;
1070 case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
1071 if (vfd->vidioc_try_fmt_vid_out_overlay)
1072 ret = vfd->vidioc_try_fmt_vid_out_overlay(file,
1073 fh, f);
1074 break;
1075 case V4L2_BUF_TYPE_VBI_CAPTURE:
1076 if (vfd->vidioc_try_fmt_vbi_cap)
1077 ret = vfd->vidioc_try_fmt_vbi_cap(file, fh, f);
1078 break;
1079 case V4L2_BUF_TYPE_VBI_OUTPUT:
1080 if (vfd->vidioc_try_fmt_vbi_out)
1081 ret = vfd->vidioc_try_fmt_vbi_out(file, fh, f);
1082 break;
1083 case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
1084 if (vfd->vidioc_try_fmt_sliced_vbi_cap)
1085 ret = vfd->vidioc_try_fmt_sliced_vbi_cap(file,
1086 fh, f);
1087 break;
1088 case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
1089 if (vfd->vidioc_try_fmt_sliced_vbi_out)
1090 ret = vfd->vidioc_try_fmt_sliced_vbi_out(file,
1091 fh, f);
1092 break;
1093 case V4L2_BUF_TYPE_PRIVATE:
1094 if (vfd->vidioc_try_fmt_type_private)
1095 ret = vfd->vidioc_try_fmt_type_private(file,
1096 fh, f);
1097 break;
1098 }
1099
1100 break;
1101 }
1102 /* FIXME: Those buf reqs could be handled here,
1103 with some changes on videobuf to allow its header to be included at
1104 videodev2.h or being merged at videodev2.
1105 */
1106 case VIDIOC_REQBUFS:
1107 {
1108 struct v4l2_requestbuffers *p=arg;
1109
1110 if (!vfd->vidioc_reqbufs)
1111 break;
1112 ret = check_fmt (vfd, p->type);
1113 if (ret)
1114 break;
1115
1116 ret=vfd->vidioc_reqbufs(file, fh, p);
1117 dbgarg (cmd, "count=%d, type=%s, memory=%s\n",
1118 p->count,
1119 prt_names(p->type, v4l2_type_names),
1120 prt_names(p->memory, v4l2_memory_names));
1121 break;
1122 }
1123 case VIDIOC_QUERYBUF:
1124 {
1125 struct v4l2_buffer *p=arg;
1126
1127 if (!vfd->vidioc_querybuf)
1128 break;
1129 ret = check_fmt (vfd, p->type);
1130 if (ret)
1131 break;
1132
1133 ret=vfd->vidioc_querybuf(file, fh, p);
1134 if (!ret)
1135 dbgbuf(cmd,vfd,p);
1136 break;
1137 }
1138 case VIDIOC_QBUF:
1139 {
1140 struct v4l2_buffer *p=arg;
1141
1142 if (!vfd->vidioc_qbuf)
1143 break;
1144 ret = check_fmt (vfd, p->type);
1145 if (ret)
1146 break;
1147
1148 ret=vfd->vidioc_qbuf(file, fh, p);
1149 if (!ret)
1150 dbgbuf(cmd,vfd,p);
1151 break;
1152 }
1153 case VIDIOC_DQBUF:
1154 {
1155 struct v4l2_buffer *p=arg;
1156 if (!vfd->vidioc_dqbuf)
1157 break;
1158 ret = check_fmt (vfd, p->type);
1159 if (ret)
1160 break;
1161
1162 ret=vfd->vidioc_dqbuf(file, fh, p);
1163 if (!ret)
1164 dbgbuf(cmd,vfd,p);
1165 break;
1166 }
1167 case VIDIOC_OVERLAY:
1168 {
1169 int *i = arg;
1170
1171 if (!vfd->vidioc_overlay)
1172 break;
1173 dbgarg (cmd, "value=%d\n",*i);
1174 ret=vfd->vidioc_overlay(file, fh, *i);
1175 break;
1176 }
1177 case VIDIOC_G_FBUF:
1178 {
1179 struct v4l2_framebuffer *p = arg;
1180
1181 if (!vfd->vidioc_g_fbuf)
1182 break;
1183 ret = vfd->vidioc_g_fbuf(file, fh, arg);
1184 if (!ret) {
1185 dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
1186 p->capability, p->flags,
1187 (unsigned long)p->base);
1188 v4l_print_pix_fmt(vfd, &p->fmt);
1189 }
1190 break;
1191 }
1192 case VIDIOC_S_FBUF:
1193 {
1194 struct v4l2_framebuffer *p = arg;
1195
1196 if (!vfd->vidioc_s_fbuf)
1197 break;
1198 dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
1199 p->capability, p->flags, (unsigned long)p->base);
1200 v4l_print_pix_fmt(vfd, &p->fmt);
1201 ret = vfd->vidioc_s_fbuf(file, fh, arg);
1202 break;
1203 }
1204 case VIDIOC_STREAMON:
1205 {
1206 enum v4l2_buf_type i = *(int *)arg;
1207 if (!vfd->vidioc_streamon)
1208 break;
1209 dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
1210 ret=vfd->vidioc_streamon(file, fh,i);
1211 break;
1212 }
1213 case VIDIOC_STREAMOFF:
1214 {
1215 enum v4l2_buf_type i = *(int *)arg;
1216
1217 if (!vfd->vidioc_streamoff)
1218 break;
1219 dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
1220 ret=vfd->vidioc_streamoff(file, fh, i);
1221 break;
1222 }
1223 /* ---------- tv norms ---------- */
1224 case VIDIOC_ENUMSTD:
1225 {
1226 struct v4l2_standard *p = arg;
1227 v4l2_std_id id = vfd->tvnorms, curr_id = 0;
1228 unsigned int index = p->index, i, j = 0;
1229 const char *descr = "";
1230
1231 /* Return norm array in a canonical way */
1232 for (i = 0; i <= index && id; i++) {
1233 /* last std value in the standards array is 0, so this
1234 while always ends there since (id & 0) == 0. */
1235 while ((id & standards[j].std) != standards[j].std)
1236 j++;
1237 curr_id = standards[j].std;
1238 descr = standards[j].descr;
1239 j++;
1240 if (curr_id == 0)
1241 break;
1242 if (curr_id != V4L2_STD_PAL &&
1243 curr_id != V4L2_STD_SECAM &&
1244 curr_id != V4L2_STD_NTSC)
1245 id &= ~curr_id;
1246 }
1247 if (i <= index)
1248 return -EINVAL;
1249
1250 v4l2_video_std_construct(p, curr_id, descr);
1251 p->index = index;
1252
1253 dbgarg(cmd, "index=%d, id=0x%Lx, name=%s, fps=%d/%d, "
1254 "framelines=%d\n", p->index,
1255 (unsigned long long)p->id, p->name,
1256 p->frameperiod.numerator,
1257 p->frameperiod.denominator,
1258 p->framelines);
1259
1260 ret = 0;
1261 break;
1262 }
1263 case VIDIOC_G_STD:
1264 {
1265 v4l2_std_id *id = arg;
1266
1267 ret = 0;
1268 /* Calls the specific handler */
1269 if (vfd->vidioc_g_std)
1270 ret = vfd->vidioc_g_std(file, fh, id);
1271 else
1272 *id = vfd->current_norm;
1273
1274 if (!ret)
1275 dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id);
1276 break;
1277 }
1278 case VIDIOC_S_STD:
1279 {
1280 v4l2_std_id *id = arg,norm;
1281
1282 dbgarg(cmd, "std=%08Lx\n", (long long unsigned)*id);
1283
1284 norm = (*id) & vfd->tvnorms;
1285 if ( vfd->tvnorms && !norm) /* Check if std is supported */
1286 break;
1287
1288 /* Calls the specific handler */
1289 if (vfd->vidioc_s_std)
1290 ret=vfd->vidioc_s_std(file, fh, &norm);
1291 else
1292 ret=-EINVAL;
1293
1294 /* Updates standard information */
1295 if (ret>=0)
1296 vfd->current_norm=norm;
1297
1298 break;
1299 }
1300 case VIDIOC_QUERYSTD:
1301 {
1302 v4l2_std_id *p=arg;
1303
1304 if (!vfd->vidioc_querystd)
1305 break;
1306 ret=vfd->vidioc_querystd(file, fh, arg);
1307 if (!ret)
1308 dbgarg (cmd, "detected std=%08Lx\n",
1309 (unsigned long long)*p);
1310 break;
1311 }
1312 /* ------ input switching ---------- */
1313 /* FIXME: Inputs can be handled inside videodev2 */
1314 case VIDIOC_ENUMINPUT:
1315 {
1316 struct v4l2_input *p=arg;
1317 int i=p->index;
1318
1319 if (!vfd->vidioc_enum_input)
1320 break;
1321 memset(p, 0, sizeof(*p));
1322 p->index=i;
1323
1324 ret=vfd->vidioc_enum_input(file, fh, p);
1325 if (!ret)
1326 dbgarg (cmd, "index=%d, name=%s, type=%d, "
1327 "audioset=%d, "
1328 "tuner=%d, std=%08Lx, status=%d\n",
1329 p->index,p->name,p->type,p->audioset,
1330 p->tuner,
1331 (unsigned long long)p->std,
1332 p->status);
1333 break;
1334 }
1335 case VIDIOC_G_INPUT:
1336 {
1337 unsigned int *i = arg;
1338
1339 if (!vfd->vidioc_g_input)
1340 break;
1341 ret=vfd->vidioc_g_input(file, fh, i);
1342 if (!ret)
1343 dbgarg (cmd, "value=%d\n",*i);
1344 break;
1345 }
1346 case VIDIOC_S_INPUT:
1347 {
1348 unsigned int *i = arg;
1349
1350 if (!vfd->vidioc_s_input)
1351 break;
1352 dbgarg (cmd, "value=%d\n",*i);
1353 ret=vfd->vidioc_s_input(file, fh, *i);
1354 break;
1355 }
1356
1357 /* ------ output switching ---------- */
1358 case VIDIOC_ENUMOUTPUT:
1359 {
1360 struct v4l2_output *p = arg;
1361 int i = p->index;
1362
1363 if (!vfd->vidioc_enum_output)
1364 break;
1365 memset(p, 0, sizeof(*p));
1366 p->index = i;
1367
1368 ret = vfd->vidioc_enum_output(file, fh, p);
1369 if (!ret)
1370 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1371 "audioset=0x%x, "
1372 "modulator=%d, std=0x%08Lx\n",
1373 p->index, p->name, p->type, p->audioset,
1374 p->modulator, (unsigned long long)p->std);
1375 break;
1376 }
1377 case VIDIOC_G_OUTPUT:
1378 {
1379 unsigned int *i = arg;
1380
1381 if (!vfd->vidioc_g_output)
1382 break;
1383 ret=vfd->vidioc_g_output(file, fh, i);
1384 if (!ret)
1385 dbgarg (cmd, "value=%d\n",*i);
1386 break;
1387 }
1388 case VIDIOC_S_OUTPUT:
1389 {
1390 unsigned int *i = arg;
1391
1392 if (!vfd->vidioc_s_output)
1393 break;
1394 dbgarg (cmd, "value=%d\n",*i);
1395 ret=vfd->vidioc_s_output(file, fh, *i);
1396 break;
1397 }
1398
1399 /* --- controls ---------------------------------------------- */
1400 case VIDIOC_QUERYCTRL:
1401 {
1402 struct v4l2_queryctrl *p = arg;
1403
1404 if (!vfd->vidioc_queryctrl)
1405 break;
1406 ret = vfd->vidioc_queryctrl(file, fh, p);
1407 if (!ret)
1408 dbgarg(cmd, "id=0x%x, type=%d, name=%s, min/max=%d/%d, "
1409 "step=%d, default=%d, flags=0x%08x\n",
1410 p->id, p->type, p->name,
1411 p->minimum, p->maximum,
1412 p->step, p->default_value, p->flags);
1413 else
1414 dbgarg(cmd, "id=0x%x\n", p->id);
1415 break;
1416 }
1417 case VIDIOC_G_CTRL:
1418 {
1419 struct v4l2_control *p = arg;
1420
1421 if (vfd->vidioc_g_ctrl)
1422 ret = vfd->vidioc_g_ctrl(file, fh, p);
1423 else if (vfd->vidioc_g_ext_ctrls) {
1424 struct v4l2_ext_controls ctrls;
1425 struct v4l2_ext_control ctrl;
1426
1427 ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id);
1428 ctrls.count = 1;
1429 ctrls.controls = &ctrl;
1430 ctrl.id = p->id;
1431 ctrl.value = p->value;
1432 if (check_ext_ctrls(&ctrls, 1)) {
1433 ret = vfd->vidioc_g_ext_ctrls(file, fh, &ctrls);
1434 if (ret == 0)
1435 p->value = ctrl.value;
1436 }
1437 } else
1438 break;
1439 if (!ret)
1440 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
1441 else
1442 dbgarg(cmd, "id=0x%x\n", p->id);
1443 break;
1444 }
1445 case VIDIOC_S_CTRL:
1446 {
1447 struct v4l2_control *p = arg;
1448 struct v4l2_ext_controls ctrls;
1449 struct v4l2_ext_control ctrl;
1450
1451 if (!vfd->vidioc_s_ctrl && !vfd->vidioc_s_ext_ctrls)
1452 break;
1453
1454 dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
1455
1456 if (vfd->vidioc_s_ctrl) {
1457 ret = vfd->vidioc_s_ctrl(file, fh, p);
1458 break;
1459 }
1460 if (!vfd->vidioc_s_ext_ctrls)
1461 break;
1462
1463 ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(p->id);
1464 ctrls.count = 1;
1465 ctrls.controls = &ctrl;
1466 ctrl.id = p->id;
1467 ctrl.value = p->value;
1468 if (check_ext_ctrls(&ctrls, 1))
1469 ret = vfd->vidioc_s_ext_ctrls(file, fh, &ctrls);
1470 break;
1471 }
1472 case VIDIOC_G_EXT_CTRLS:
1473 {
1474 struct v4l2_ext_controls *p = arg;
1475
1476 p->error_idx = p->count;
1477 if (!vfd->vidioc_g_ext_ctrls)
1478 break;
1479 if (check_ext_ctrls(p, 0))
1480 ret = vfd->vidioc_g_ext_ctrls(file, fh, p);
1481 v4l_print_ext_ctrls(cmd, vfd, p, !ret);
1482 break;
1483 }
1484 case VIDIOC_S_EXT_CTRLS:
1485 {
1486 struct v4l2_ext_controls *p = arg;
1487
1488 p->error_idx = p->count;
1489 if (!vfd->vidioc_s_ext_ctrls)
1490 break;
1491 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1492 if (check_ext_ctrls(p, 0))
1493 ret = vfd->vidioc_s_ext_ctrls(file, fh, p);
1494 break;
1495 }
1496 case VIDIOC_TRY_EXT_CTRLS:
1497 {
1498 struct v4l2_ext_controls *p = arg;
1499
1500 p->error_idx = p->count;
1501 if (!vfd->vidioc_try_ext_ctrls)
1502 break;
1503 v4l_print_ext_ctrls(cmd, vfd, p, 1);
1504 if (check_ext_ctrls(p, 0))
1505 ret = vfd->vidioc_try_ext_ctrls(file, fh, p);
1506 break;
1507 }
1508 case VIDIOC_QUERYMENU:
1509 {
1510 struct v4l2_querymenu *p = arg;
1511
1512 if (!vfd->vidioc_querymenu)
1513 break;
1514 ret = vfd->vidioc_querymenu(file, fh, p);
1515 if (!ret)
1516 dbgarg(cmd, "id=0x%x, index=%d, name=%s\n",
1517 p->id, p->index, p->name);
1518 else
1519 dbgarg(cmd, "id=0x%x, index=%d\n",
1520 p->id, p->index);
1521 break;
1522 }
1523 /* --- audio ---------------------------------------------- */
1524 case VIDIOC_ENUMAUDIO:
1525 {
1526 struct v4l2_audio *p = arg;
1527
1528 if (!vfd->vidioc_enumaudio)
1529 break;
1530 ret = vfd->vidioc_enumaudio(file, fh, p);
1531 if (!ret)
1532 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1533 "mode=0x%x\n", p->index, p->name,
1534 p->capability, p->mode);
1535 else
1536 dbgarg(cmd, "index=%d\n", p->index);
1537 break;
1538 }
1539 case VIDIOC_G_AUDIO:
1540 {
1541 struct v4l2_audio *p = arg;
1542 __u32 index = p->index;
1543
1544 if (!vfd->vidioc_g_audio)
1545 break;
1546
1547 memset(p, 0, sizeof(*p));
1548 p->index = index;
1549 ret = vfd->vidioc_g_audio(file, fh, p);
1550 if (!ret)
1551 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1552 "mode=0x%x\n", p->index,
1553 p->name, p->capability, p->mode);
1554 else
1555 dbgarg(cmd, "index=%d\n", p->index);
1556 break;
1557 }
1558 case VIDIOC_S_AUDIO:
1559 {
1560 struct v4l2_audio *p = arg;
1561
1562 if (!vfd->vidioc_s_audio)
1563 break;
1564 dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
1565 "mode=0x%x\n", p->index, p->name,
1566 p->capability, p->mode);
1567 ret = vfd->vidioc_s_audio(file, fh, p);
1568 break;
1569 }
1570 case VIDIOC_ENUMAUDOUT:
1571 {
1572 struct v4l2_audioout *p=arg;
1573
1574 if (!vfd->vidioc_enumaudout)
1575 break;
1576 dbgarg(cmd, "Enum for index=%d\n", p->index);
1577 ret=vfd->vidioc_enumaudout(file, fh, p);
1578 if (!ret)
1579 dbgarg2("index=%d, name=%s, capability=%d, "
1580 "mode=%d\n", p->index, p->name,
1581 p->capability,p->mode);
1582 break;
1583 }
1584 case VIDIOC_G_AUDOUT:
1585 {
1586 struct v4l2_audioout *p=arg;
1587
1588 if (!vfd->vidioc_g_audout)
1589 break;
1590 dbgarg(cmd, "Enum for index=%d\n", p->index);
1591 ret=vfd->vidioc_g_audout(file, fh, p);
1592 if (!ret)
1593 dbgarg2("index=%d, name=%s, capability=%d, "
1594 "mode=%d\n", p->index, p->name,
1595 p->capability,p->mode);
1596 break;
1597 }
1598 case VIDIOC_S_AUDOUT:
1599 {
1600 struct v4l2_audioout *p=arg;
1601
1602 if (!vfd->vidioc_s_audout)
1603 break;
1604 dbgarg(cmd, "index=%d, name=%s, capability=%d, "
1605 "mode=%d\n", p->index, p->name,
1606 p->capability,p->mode);
1607
1608 ret=vfd->vidioc_s_audout(file, fh, p);
1609 break;
1610 }
1611 case VIDIOC_G_MODULATOR:
1612 {
1613 struct v4l2_modulator *p=arg;
1614 if (!vfd->vidioc_g_modulator)
1615 break;
1616 ret=vfd->vidioc_g_modulator(file, fh, p);
1617 if (!ret)
1618 dbgarg(cmd, "index=%d, name=%s, "
1619 "capability=%d, rangelow=%d,"
1620 " rangehigh=%d, txsubchans=%d\n",
1621 p->index, p->name,p->capability,
1622 p->rangelow, p->rangehigh,
1623 p->txsubchans);
1624 break;
1625 }
1626 case VIDIOC_S_MODULATOR:
1627 {
1628 struct v4l2_modulator *p=arg;
1629 if (!vfd->vidioc_s_modulator)
1630 break;
1631 dbgarg(cmd, "index=%d, name=%s, capability=%d, "
1632 "rangelow=%d, rangehigh=%d, txsubchans=%d\n",
1633 p->index, p->name,p->capability,p->rangelow,
1634 p->rangehigh,p->txsubchans);
1635 ret=vfd->vidioc_s_modulator(file, fh, p);
1636 break;
1637 }
1638 case VIDIOC_G_CROP:
1639 {
1640 struct v4l2_crop *p=arg;
1641 if (!vfd->vidioc_g_crop)
1642 break;
1643 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1644 ret=vfd->vidioc_g_crop(file, fh, p);
1645 if (!ret) {
1646 dbgrect(vfd, "", &p->c);
1647 }
1648 break;
1649 }
1650 case VIDIOC_S_CROP:
1651 {
1652 struct v4l2_crop *p=arg;
1653 if (!vfd->vidioc_s_crop)
1654 break;
1655 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1656 dbgrect(vfd, "", &p->c);
1657 ret=vfd->vidioc_s_crop(file, fh, p);
1658 break;
1659 }
1660 case VIDIOC_CROPCAP:
1661 {
1662 struct v4l2_cropcap *p = arg;
1663
1664 /*FIXME: Should also show v4l2_fract pixelaspect */
1665 if (!vfd->vidioc_cropcap)
1666 break;
1667 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1668 ret = vfd->vidioc_cropcap(file, fh, p);
1669 if (!ret) {
1670 dbgrect(vfd, "bounds ", &p->bounds);
1671 dbgrect(vfd, "defrect ", &p->defrect);
1672 }
1673 break;
1674 }
1675 case VIDIOC_G_JPEGCOMP:
1676 {
1677 struct v4l2_jpegcompression *p=arg;
1678 if (!vfd->vidioc_g_jpegcomp)
1679 break;
1680 ret=vfd->vidioc_g_jpegcomp(file, fh, p);
1681 if (!ret)
1682 dbgarg (cmd, "quality=%d, APPn=%d, "
1683 "APP_len=%d, COM_len=%d, "
1684 "jpeg_markers=%d\n",
1685 p->quality,p->APPn,p->APP_len,
1686 p->COM_len,p->jpeg_markers);
1687 break;
1688 }
1689 case VIDIOC_S_JPEGCOMP:
1690 {
1691 struct v4l2_jpegcompression *p=arg;
1692 if (!vfd->vidioc_g_jpegcomp)
1693 break;
1694 dbgarg (cmd, "quality=%d, APPn=%d, APP_len=%d, "
1695 "COM_len=%d, jpeg_markers=%d\n",
1696 p->quality,p->APPn,p->APP_len,
1697 p->COM_len,p->jpeg_markers);
1698 ret=vfd->vidioc_s_jpegcomp(file, fh, p);
1699 break;
1700 }
1701 case VIDIOC_G_ENC_INDEX:
1702 {
1703 struct v4l2_enc_idx *p=arg;
1704
1705 if (!vfd->vidioc_g_enc_index)
1706 break;
1707 ret=vfd->vidioc_g_enc_index(file, fh, p);
1708 if (!ret)
1709 dbgarg (cmd, "entries=%d, entries_cap=%d\n",
1710 p->entries,p->entries_cap);
1711 break;
1712 }
1713 case VIDIOC_ENCODER_CMD:
1714 {
1715 struct v4l2_encoder_cmd *p = arg;
1716
1717 if (!vfd->vidioc_encoder_cmd)
1718 break;
1719 memset(&p->raw, 0, sizeof(p->raw));
1720 ret = vfd->vidioc_encoder_cmd(file, fh, p);
1721 if (!ret)
1722 dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
1723 break;
1724 }
1725 case VIDIOC_TRY_ENCODER_CMD:
1726 {
1727 struct v4l2_encoder_cmd *p = arg;
1728
1729 if (!vfd->vidioc_try_encoder_cmd)
1730 break;
1731 memset(&p->raw, 0, sizeof(p->raw));
1732 ret = vfd->vidioc_try_encoder_cmd(file, fh, p);
1733 if (!ret)
1734 dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
1735 break;
1736 }
1737 case VIDIOC_G_PARM:
1738 {
1739 struct v4l2_streamparm *p=arg;
1740 __u32 type=p->type;
1741
1742 memset(p,0,sizeof(*p));
1743 p->type=type;
1744
1745 if (vfd->vidioc_g_parm) {
1746 ret=vfd->vidioc_g_parm(file, fh, p);
1747 } else {
1748 struct v4l2_standard s;
1749
1750 if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1751 return -EINVAL;
1752
1753 v4l2_video_std_construct(&s, vfd->current_norm,
1754 v4l2_norm_to_name(vfd->current_norm));
1755
1756 p->parm.capture.timeperframe = s.frameperiod;
1757 ret=0;
1758 }
1759
1760 dbgarg (cmd, "type=%d\n", p->type);
1761 break;
1762 }
1763 case VIDIOC_S_PARM:
1764 {
1765 struct v4l2_streamparm *p=arg;
1766 if (!vfd->vidioc_s_parm)
1767 break;
1768 dbgarg (cmd, "type=%d\n", p->type);
1769 ret=vfd->vidioc_s_parm(file, fh, p);
1770 break;
1771 }
1772 case VIDIOC_G_TUNER:
1773 {
1774 struct v4l2_tuner *p = arg;
1775 __u32 index = p->index;
1776
1777 if (!vfd->vidioc_g_tuner)
1778 break;
1779
1780 memset(p, 0, sizeof(*p));
1781 p->index = index;
1782
1783 ret = vfd->vidioc_g_tuner(file, fh, p);
1784 if (!ret)
1785 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1786 "capability=0x%x, rangelow=%d, "
1787 "rangehigh=%d, signal=%d, afc=%d, "
1788 "rxsubchans=0x%x, audmode=%d\n",
1789 p->index, p->name, p->type,
1790 p->capability, p->rangelow,
1791 p->rangehigh, p->signal, p->afc,
1792 p->rxsubchans, p->audmode);
1793 break;
1794 }
1795 case VIDIOC_S_TUNER:
1796 {
1797 struct v4l2_tuner *p = arg;
1798
1799 if (!vfd->vidioc_s_tuner)
1800 break;
1801 dbgarg(cmd, "index=%d, name=%s, type=%d, "
1802 "capability=0x%x, rangelow=%d, "
1803 "rangehigh=%d, signal=%d, afc=%d, "
1804 "rxsubchans=0x%x, audmode=%d\n",
1805 p->index, p->name, p->type,
1806 p->capability, p->rangelow,
1807 p->rangehigh, p->signal, p->afc,
1808 p->rxsubchans, p->audmode);
1809 ret = vfd->vidioc_s_tuner(file, fh, p);
1810 break;
1811 }
1812 case VIDIOC_G_FREQUENCY:
1813 {
1814 struct v4l2_frequency *p = arg;
1815
1816 if (!vfd->vidioc_g_frequency)
1817 break;
1818
1819 memset(p->reserved, 0, sizeof(p->reserved));
1820
1821 ret = vfd->vidioc_g_frequency(file, fh, p);
1822 if (!ret)
1823 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
1824 p->tuner, p->type, p->frequency);
1825 break;
1826 }
1827 case VIDIOC_S_FREQUENCY:
1828 {
1829 struct v4l2_frequency *p=arg;
1830 if (!vfd->vidioc_s_frequency)
1831 break;
1832 dbgarg (cmd, "tuner=%d, type=%d, frequency=%d\n",
1833 p->tuner,p->type,p->frequency);
1834 ret=vfd->vidioc_s_frequency(file, fh, p);
1835 break;
1836 }
1837 case VIDIOC_G_SLICED_VBI_CAP:
1838 {
1839 struct v4l2_sliced_vbi_cap *p = arg;
1840 __u32 type = p->type;
1841
1842 if (!vfd->vidioc_g_sliced_vbi_cap)
1843 break;
1844 memset(p, 0, sizeof(*p));
1845 p->type = type;
1846 dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
1847 ret = vfd->vidioc_g_sliced_vbi_cap(file, fh, p);
1848 if (!ret)
1849 dbgarg2("service_set=%d\n", p->service_set);
1850 break;
1851 }
1852 case VIDIOC_LOG_STATUS:
1853 {
1854 if (!vfd->vidioc_log_status)
1855 break;
1856 ret=vfd->vidioc_log_status(file, fh);
1857 break;
1858 }
1859#ifdef CONFIG_VIDEO_ADV_DEBUG
1860 case VIDIOC_DBG_G_REGISTER:
1861 {
1862 struct v4l2_register *p=arg;
1863 if (!capable(CAP_SYS_ADMIN))
1864 ret=-EPERM;
1865 else if (vfd->vidioc_g_register)
1866 ret=vfd->vidioc_g_register(file, fh, p);
1867 break;
1868 }
1869 case VIDIOC_DBG_S_REGISTER:
1870 {
1871 struct v4l2_register *p=arg;
1872 if (!capable(CAP_SYS_ADMIN))
1873 ret=-EPERM;
1874 else if (vfd->vidioc_s_register)
1875 ret=vfd->vidioc_s_register(file, fh, p);
1876 break;
1877 }
1878#endif
1879 case VIDIOC_G_CHIP_IDENT:
1880 {
1881 struct v4l2_chip_ident *p=arg;
1882 if (!vfd->vidioc_g_chip_ident)
1883 break;
1884 ret=vfd->vidioc_g_chip_ident(file, fh, p);
1885 if (!ret)
1886 dbgarg (cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision);
1887 break;
1888 }
1889 default:
1890 {
1891 if (!vfd->vidioc_default)
1892 break;
1893 ret = vfd->vidioc_default(file, fh, cmd, arg);
1894 break;
1895 }
1896 case VIDIOC_S_HW_FREQ_SEEK:
1897 {
1898 struct v4l2_hw_freq_seek *p = arg;
1899 if (!vfd->vidioc_s_hw_freq_seek)
1900 break;
1901 dbgarg(cmd,
1902 "tuner=%d, type=%d, seek_upward=%d, wrap_around=%d\n",
1903 p->tuner, p->type, p->seek_upward, p->wrap_around);
1904 ret = vfd->vidioc_s_hw_freq_seek(file, fh, p);
1905 break;
1906 }
1907 } /* switch */
1908
1909 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) {
1910 if (ret < 0) {
1911 v4l_print_ioctl(vfd->name, cmd);
1912 printk(KERN_CONT " error %d\n", ret);
1913 }
1914 }
1915
1916 return ret;
1917}
1918
1919int video_ioctl2 (struct inode *inode, struct file *file,
1920 unsigned int cmd, unsigned long arg)
1921{
1922 char sbuf[128];
1923 void *mbuf = NULL;
1924 void *parg = NULL;
1925 int err = -EINVAL;
1926 int is_ext_ctrl;
1927 size_t ctrls_size = 0;
1928 void __user *user_ptr = NULL;
1929
1930#ifdef __OLD_VIDIOC_
1931 cmd = video_fix_command(cmd);
1932#endif
1933 is_ext_ctrl = (cmd == VIDIOC_S_EXT_CTRLS || cmd == VIDIOC_G_EXT_CTRLS ||
1934 cmd == VIDIOC_TRY_EXT_CTRLS);
1935
1936 /* Copy arguments into temp kernel buffer */
1937 switch (_IOC_DIR(cmd)) {
1938 case _IOC_NONE:
1939 parg = NULL;
1940 break;
1941 case _IOC_READ:
1942 case _IOC_WRITE:
1943 case (_IOC_WRITE | _IOC_READ):
1944 if (_IOC_SIZE(cmd) <= sizeof(sbuf)) {
1945 parg = sbuf;
1946 } else {
1947 /* too big to allocate from stack */
1948 mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL);
1949 if (NULL == mbuf)
1950 return -ENOMEM;
1951 parg = mbuf;
1952 }
1953
1954 err = -EFAULT;
1955 if (_IOC_DIR(cmd) & _IOC_WRITE)
1956 if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
1957 goto out;
1958 break;
1959 }
1960
1961 if (is_ext_ctrl) {
1962 struct v4l2_ext_controls *p = parg;
1963
1964 /* In case of an error, tell the caller that it wasn't
1965 a specific control that caused it. */
1966 p->error_idx = p->count;
1967 user_ptr = (void __user *)p->controls;
1968 if (p->count) {
1969 ctrls_size = sizeof(struct v4l2_ext_control) * p->count;
1970 /* Note: v4l2_ext_controls fits in sbuf[] so mbuf is still NULL. */
1971 mbuf = kmalloc(ctrls_size, GFP_KERNEL);
1972 err = -ENOMEM;
1973 if (NULL == mbuf)
1974 goto out_ext_ctrl;
1975 err = -EFAULT;
1976 if (copy_from_user(mbuf, user_ptr, ctrls_size))
1977 goto out_ext_ctrl;
1978 p->controls = mbuf;
1979 }
1980 }
1981
1982 /* Handles IOCTL */
1983 err = __video_do_ioctl(inode, file, cmd, parg);
1984 if (err == -ENOIOCTLCMD)
1985 err = -EINVAL;
1986 if (is_ext_ctrl) {
1987 struct v4l2_ext_controls *p = parg;
1988
1989 p->controls = (void *)user_ptr;
1990 if (p->count && err == 0 && copy_to_user(user_ptr, mbuf, ctrls_size))
1991 err = -EFAULT;
1992 goto out_ext_ctrl;
1993 }
1994 if (err < 0)
1995 goto out;
1996
1997out_ext_ctrl:
1998 /* Copy results into user buffer */
1999 switch (_IOC_DIR(cmd))
2000 {
2001 case _IOC_READ:
2002 case (_IOC_WRITE | _IOC_READ):
2003 if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
2004 err = -EFAULT;
2005 break;
2006 }
2007
2008out:
2009 kfree(mbuf);
2010 return err;
2011}
2012EXPORT_SYMBOL(video_ioctl2);
2013
2014/**
2015 * get_index - assign stream number based on parent device
2016 * @vdev: video_device to assign index number to, vdev->dev should be assigned
2017 * @num: -1 if auto assign, requested number otherwise
2018 *
2019 *
2020 * returns -ENFILE if num is already in use, a free index number if
2021 * successful.
2022 */
2023static int get_index(struct video_device *vdev, int num)
2024{
2025 u32 used = 0;
2026 const int max_index = sizeof(used) * 8 - 1;
2027 int i;
2028
2029 /* Currently a single v4l driver instance cannot create more than
2030 32 devices.
2031 Increase to u64 or an array of u32 if more are needed. */
2032 if (num > max_index) {
2033 printk(KERN_ERR "videodev: %s num is too large\n", __func__);
2034 return -EINVAL;
2035 }
2036
2037 for (i = 0; i < VIDEO_NUM_DEVICES; i++) {
2038 if (video_device[i] != NULL &&
2039 video_device[i] != vdev &&
2040 video_device[i]->dev == vdev->dev) {
2041 used |= 1 << video_device[i]->index;
2042 }
2043 }
2044
2045 if (num >= 0) {
2046 if (used & (1 << num))
2047 return -ENFILE;
2048 return num;
2049 }
2050
2051 i = ffz(used);
2052 return i > max_index ? -ENFILE : i;
2053}
2054
2055static const struct file_operations video_fops;
2056
2057int video_register_device(struct video_device *vfd, int type, int nr)
2058{
2059 return video_register_device_index(vfd, type, nr, -1);
2060}
2061EXPORT_SYMBOL(video_register_device);
2062
2063/**
2064 * video_register_device - register video4linux devices
2065 * @vfd: video device structure we want to register
2066 * @type: type of device to register
2067 * @nr: which device number (0 == /dev/video0, 1 == /dev/video1, ...
2068 * -1 == first free)
2069 *
2070 * The registration code assigns minor numbers based on the type
2071 * requested. -ENFILE is returned in all the device slots for this
2072 * category are full. If not then the minor field is set and the
2073 * driver initialize function is called (if non %NULL).
2074 *
2075 * Zero is returned on success.
2076 *
2077 * Valid types are
2078 *
2079 * %VFL_TYPE_GRABBER - A frame grabber
2080 *
2081 * %VFL_TYPE_VTX - A teletext device
2082 *
2083 * %VFL_TYPE_VBI - Vertical blank data (undecoded)
2084 *
2085 * %VFL_TYPE_RADIO - A radio card
2086 */
2087
2088int video_register_device_index(struct video_device *vfd, int type, int nr,
2089 int index)
2090{
2091 int i=0;
2092 int base;
2093 int end;
2094 int ret;
2095 char *name_base;
2096
2097 switch(type)
2098 {
2099 case VFL_TYPE_GRABBER:
2100 base=MINOR_VFL_TYPE_GRABBER_MIN;
2101 end=MINOR_VFL_TYPE_GRABBER_MAX+1;
2102 name_base = "video";
2103 break;
2104 case VFL_TYPE_VTX:
2105 base=MINOR_VFL_TYPE_VTX_MIN;
2106 end=MINOR_VFL_TYPE_VTX_MAX+1;
2107 name_base = "vtx";
2108 break;
2109 case VFL_TYPE_VBI:
2110 base=MINOR_VFL_TYPE_VBI_MIN;
2111 end=MINOR_VFL_TYPE_VBI_MAX+1;
2112 name_base = "vbi";
2113 break;
2114 case VFL_TYPE_RADIO:
2115 base=MINOR_VFL_TYPE_RADIO_MIN;
2116 end=MINOR_VFL_TYPE_RADIO_MAX+1;
2117 name_base = "radio";
2118 break;
2119 default:
2120 printk(KERN_ERR "%s called with unknown type: %d\n",
2121 __func__, type);
2122 return -1;
2123 }
2124
2125 /* pick a minor number */
2126 mutex_lock(&videodev_lock);
2127 if (nr >= 0 && nr < end-base) {
2128 /* use the one the driver asked for */
2129 i = base+nr;
2130 if (NULL != video_device[i]) {
2131 mutex_unlock(&videodev_lock);
2132 return -ENFILE;
2133 }
2134 } else {
2135 /* use first free */
2136 for(i=base;i<end;i++)
2137 if (NULL == video_device[i])
2138 break;
2139 if (i == end) {
2140 mutex_unlock(&videodev_lock);
2141 return -ENFILE;
2142 }
2143 }
2144 video_device[i]=vfd;
2145 vfd->minor=i;
2146
2147 ret = get_index(vfd, index);
2148 vfd->index = ret;
2149
2150 mutex_unlock(&videodev_lock);
2151
2152 if (ret < 0) {
2153 printk(KERN_ERR "%s: get_index failed\n", __func__);
2154 goto fail_minor;
2155 }
2156
2157 mutex_init(&vfd->lock);
2158
2159 /* sysfs class */
2160 memset(&vfd->class_dev, 0x00, sizeof(vfd->class_dev));
2161 vfd->class_dev.class = &video_class;
2162 vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
2163 if (vfd->dev)
2164 vfd->class_dev.parent = vfd->dev;
2165 sprintf(vfd->class_dev.bus_id, "%s%d", name_base, i - base);
2166 ret = device_register(&vfd->class_dev);
2167 if (ret < 0) {
2168 printk(KERN_ERR "%s: device_register failed\n", __func__);
2169 goto fail_minor;
2170 }
2171
2172#if 1
2173 /* needed until all drivers are fixed */
2174 if (!vfd->release)
2175 printk(KERN_WARNING "videodev: \"%s\" has no release callback. "
2176 "Please fix your driver for proper sysfs support, see "
2177 "http://lwn.net/Articles/36850/\n", vfd->name);
2178#endif
2179 return 0;
2180
2181fail_minor:
2182 mutex_lock(&videodev_lock);
2183 video_device[vfd->minor] = NULL;
2184 vfd->minor = -1;
2185 mutex_unlock(&videodev_lock);
2186 return ret;
2187}
2188EXPORT_SYMBOL(video_register_device_index);
2189
2190/**
2191 * video_unregister_device - unregister a video4linux device
2192 * @vfd: the device to unregister
2193 *
2194 * This unregisters the passed device and deassigns the minor
2195 * number. Future open calls will be met with errors.
2196 */
2197
2198void video_unregister_device(struct video_device *vfd)
2199{
2200 mutex_lock(&videodev_lock);
2201 if(video_device[vfd->minor]!=vfd)
2202 panic("videodev: bad unregister");
2203
2204 video_device[vfd->minor]=NULL;
2205 device_unregister(&vfd->class_dev);
2206 mutex_unlock(&videodev_lock);
2207}
2208EXPORT_SYMBOL(video_unregister_device);
2209
2210/*
2211 * Video fs operations
2212 */
2213static const struct file_operations video_fops=
2214{
2215 .owner = THIS_MODULE,
2216 .llseek = no_llseek,
2217 .open = video_open,
2218};
2219
2220/*
2221 * Initialise video for linux
2222 */
2223
2224static int __init videodev_init(void)
2225{
2226 int ret;
2227
2228 printk(KERN_INFO "Linux video capture interface: v2.00\n");
2229 if (register_chrdev(VIDEO_MAJOR, VIDEO_NAME, &video_fops)) {
2230 printk(KERN_WARNING "video_dev: unable to get major %d\n", VIDEO_MAJOR);
2231 return -EIO;
2232 }
2233
2234 ret = class_register(&video_class);
2235 if (ret < 0) {
2236 unregister_chrdev(VIDEO_MAJOR, VIDEO_NAME);
2237 printk(KERN_WARNING "video_dev: class_register failed\n");
2238 return -EIO;
2239 }
2240
2241 return 0;
2242}
2243
2244static void __exit videodev_exit(void)
2245{
2246 class_unregister(&video_class);
2247 unregister_chrdev(VIDEO_MAJOR, VIDEO_NAME);
2248}
2249
2250module_init(videodev_init)
2251module_exit(videodev_exit)
2252
2253MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>");
2254MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2");
2255MODULE_LICENSE("GPL");
2256
2257
2258/*
2259 * Local variables:
2260 * c-basic-offset: 8
2261 * End:
2262 */
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c
index 01ea99c9bc1a..3989b0eded28 100644
--- a/drivers/media/video/vino.c
+++ b/drivers/media/video/vino.c
@@ -38,7 +38,7 @@
38#include <linux/i2c.h> 38#include <linux/i2c.h>
39#include <linux/i2c-algo-sgi.h> 39#include <linux/i2c-algo-sgi.h>
40 40
41#include <linux/videodev.h> 41#include <linux/videodev2.h>
42#include <media/v4l2-common.h> 42#include <media/v4l2-common.h>
43#include <linux/video_decoder.h> 43#include <linux/video_decoder.h>
44#include <linux/mutex.h> 44#include <linux/mutex.h>
@@ -4385,8 +4385,6 @@ static const struct file_operations vino_fops = {
4385 4385
4386static struct video_device v4l_device_template = { 4386static struct video_device v4l_device_template = {
4387 .name = "NOT SET", 4387 .name = "NOT SET",
4388 /*.type = VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE | */
4389 /* VID_TYPE_CLIPPING | VID_TYPE_SCALES, VID_TYPE_OVERLAY */
4390 .fops = &vino_fops, 4388 .fops = &vino_fops,
4391 .minor = -1, 4389 .minor = -1,
4392}; 4390};
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index 059b01c11dc1..3518af071a2e 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -35,6 +35,7 @@
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <media/videobuf-vmalloc.h> 36#include <media/videobuf-vmalloc.h>
37#include <media/v4l2-common.h> 37#include <media/v4l2-common.h>
38#include <media/v4l2-ioctl.h>
38#include <linux/kthread.h> 39#include <linux/kthread.h>
39#include <linux/highmem.h> 40#include <linux/highmem.h>
40#include <linux/freezer.h> 41#include <linux/freezer.h>
@@ -1065,13 +1066,7 @@ static const struct file_operations vivi_fops = {
1065 .llseek = no_llseek, 1066 .llseek = no_llseek,
1066}; 1067};
1067 1068
1068static struct video_device vivi_template = { 1069static const struct v4l2_ioctl_ops vivi_ioctl_ops = {
1069 .name = "vivi",
1070 .type = VID_TYPE_CAPTURE,
1071 .fops = &vivi_fops,
1072 .minor = -1,
1073 .release = video_device_release,
1074
1075 .vidioc_querycap = vidioc_querycap, 1070 .vidioc_querycap = vidioc_querycap,
1076 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 1071 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
1077 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 1072 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap,
@@ -1093,6 +1088,15 @@ static struct video_device vivi_template = {
1093#ifdef CONFIG_VIDEO_V4L1_COMPAT 1088#ifdef CONFIG_VIDEO_V4L1_COMPAT
1094 .vidiocgmbuf = vidiocgmbuf, 1089 .vidiocgmbuf = vidiocgmbuf,
1095#endif 1090#endif
1091};
1092
1093static struct video_device vivi_template = {
1094 .name = "vivi",
1095 .fops = &vivi_fops,
1096 .ioctl_ops = &vivi_ioctl_ops,
1097 .minor = -1,
1098 .release = video_device_release,
1099
1096 .tvnorms = V4L2_STD_525_60, 1100 .tvnorms = V4L2_STD_525_60,
1097 .current_norm = V4L2_STD_NTSC_M, 1101 .current_norm = V4L2_STD_NTSC_M,
1098}; 1102};
diff --git a/drivers/media/video/vp27smpx.c b/drivers/media/video/vp27smpx.c
index cbecb3cbbbaa..577956c5410b 100644
--- a/drivers/media/video/vp27smpx.c
+++ b/drivers/media/video/vp27smpx.c
@@ -27,7 +27,7 @@
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <linux/i2c-id.h> 29#include <linux/i2c-id.h>
30#include <linux/videodev.h> 30#include <linux/videodev2.h>
31#include <media/v4l2-common.h> 31#include <media/v4l2-common.h>
32#include <media/v4l2-chip-ident.h> 32#include <media/v4l2-chip-ident.h>
33#include <media/v4l2-i2c-drv.h> 33#include <media/v4l2-i2c-drv.h>
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c
index 33f702698a56..9402f40095b4 100644
--- a/drivers/media/video/w9966.c
+++ b/drivers/media/video/w9966.c
@@ -57,8 +57,9 @@
57#include <linux/module.h> 57#include <linux/module.h>
58#include <linux/init.h> 58#include <linux/init.h>
59#include <linux/delay.h> 59#include <linux/delay.h>
60#include <linux/videodev.h> 60#include <linux/videodev2.h>
61#include <media/v4l2-common.h> 61#include <media/v4l2-common.h>
62#include <media/v4l2-ioctl.h>
62#include <linux/parport.h> 63#include <linux/parport.h>
63 64
64/*#define DEBUG*/ /* Undef me for production */ 65/*#define DEBUG*/ /* Undef me for production */
@@ -195,9 +196,7 @@ static const struct file_operations w9966_fops = {
195 .llseek = no_llseek, 196 .llseek = no_llseek,
196}; 197};
197static struct video_device w9966_template = { 198static struct video_device w9966_template = {
198 .owner = THIS_MODULE,
199 .name = W9966_DRIVERNAME, 199 .name = W9966_DRIVERNAME,
200 .type = VID_TYPE_CAPTURE | VID_TYPE_SCALES,
201 .fops = &w9966_fops, 200 .fops = &w9966_fops,
202}; 201};
203 202
diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c
index 840522442d07..168baabe4659 100644
--- a/drivers/media/video/w9968cf.c
+++ b/drivers/media/video/w9968cf.c
@@ -42,6 +42,7 @@
42#include <asm/page.h> 42#include <asm/page.h>
43#include <asm/uaccess.h> 43#include <asm/uaccess.h>
44#include <linux/page-flags.h> 44#include <linux/page-flags.h>
45#include <media/v4l2-ioctl.h>
45 46
46#include "w9968cf.h" 47#include "w9968cf.h"
47#include "w9968cf_decoder.h" 48#include "w9968cf_decoder.h"
@@ -3549,13 +3550,11 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
3549 } 3550 }
3550 3551
3551 strcpy(cam->v4ldev->name, symbolic(camlist, mod_id)); 3552 strcpy(cam->v4ldev->name, symbolic(camlist, mod_id));
3552 cam->v4ldev->owner = THIS_MODULE;
3553 cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES;
3554 cam->v4ldev->fops = &w9968cf_fops; 3553 cam->v4ldev->fops = &w9968cf_fops;
3555 cam->v4ldev->minor = video_nr[dev_nr]; 3554 cam->v4ldev->minor = video_nr[dev_nr];
3556 cam->v4ldev->release = video_device_release; 3555 cam->v4ldev->release = video_device_release;
3557 video_set_drvdata(cam->v4ldev, cam); 3556 video_set_drvdata(cam->v4ldev, cam);
3558 cam->v4ldev->dev = &cam->dev; 3557 cam->v4ldev->parent = &cam->dev;
3559 3558
3560 err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, 3559 err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER,
3561 video_nr[dev_nr]); 3560 video_nr[dev_nr]);
diff --git a/drivers/media/video/w9968cf.h b/drivers/media/video/w9968cf.h
index 3c95316bc030..30032e15e23c 100644
--- a/drivers/media/video/w9968cf.h
+++ b/drivers/media/video/w9968cf.h
@@ -21,7 +21,7 @@
21#ifndef _W9968CF_H_ 21#ifndef _W9968CF_H_
22#define _W9968CF_H_ 22#define _W9968CF_H_
23 23
24#include <linux/videodev.h> 24#include <linux/videodev2.h>
25#include <linux/usb.h> 25#include <linux/usb.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/device.h> 27#include <linux/device.h>
diff --git a/drivers/media/video/wm8739.c b/drivers/media/video/wm8739.c
index 7be47a255853..95c79ad80487 100644
--- a/drivers/media/video/wm8739.c
+++ b/drivers/media/video/wm8739.c
@@ -27,7 +27,7 @@
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28#include <linux/i2c.h> 28#include <linux/i2c.h>
29#include <linux/i2c-id.h> 29#include <linux/i2c-id.h>
30#include <linux/videodev.h> 30#include <linux/videodev2.h>
31#include <media/v4l2-common.h> 31#include <media/v4l2-common.h>
32#include <media/v4l2-chip-ident.h> 32#include <media/v4l2-chip-ident.h>
33#include <media/v4l2-i2c-drv.h> 33#include <media/v4l2-i2c-drv.h>
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c
index c2ab70a04a74..48df661d4fc3 100644
--- a/drivers/media/video/wm8775.c
+++ b/drivers/media/video/wm8775.c
@@ -31,7 +31,7 @@
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32#include <linux/i2c.h> 32#include <linux/i2c.h>
33#include <linux/i2c-id.h> 33#include <linux/i2c-id.h>
34#include <linux/videodev.h> 34#include <linux/videodev2.h>
35#include <media/v4l2-common.h> 35#include <media/v4l2-common.h>
36#include <media/v4l2-chip-ident.h> 36#include <media/v4l2-chip-ident.h>
37#include <media/v4l2-i2c-drv-legacy.h> 37#include <media/v4l2-i2c-drv-legacy.h>
diff --git a/drivers/media/video/zc0301/zc0301.h b/drivers/media/video/zc0301/zc0301.h
index 7bbab541a309..b1b5cceb4baa 100644
--- a/drivers/media/video/zc0301/zc0301.h
+++ b/drivers/media/video/zc0301/zc0301.h
@@ -25,6 +25,7 @@
25#include <linux/usb.h> 25#include <linux/usb.h>
26#include <linux/videodev2.h> 26#include <linux/videodev2.h>
27#include <media/v4l2-common.h> 27#include <media/v4l2-common.h>
28#include <media/v4l2-ioctl.h>
28#include <linux/device.h> 29#include <linux/device.h>
29#include <linux/list.h> 30#include <linux/list.h>
30#include <linux/spinlock.h> 31#include <linux/spinlock.h>
diff --git a/drivers/media/video/zc0301/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c
index e5c4e9f5193f..550ce7bd5c87 100644
--- a/drivers/media/video/zc0301/zc0301_core.c
+++ b/drivers/media/video/zc0301/zc0301_core.c
@@ -1985,8 +1985,6 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id)
1985 } 1985 }
1986 1986
1987 strcpy(cam->v4ldev->name, "ZC0301[P] PC Camera"); 1987 strcpy(cam->v4ldev->name, "ZC0301[P] PC Camera");
1988 cam->v4ldev->owner = THIS_MODULE;
1989 cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES;
1990 cam->v4ldev->fops = &zc0301_fops; 1988 cam->v4ldev->fops = &zc0301_fops;
1991 cam->v4ldev->minor = video_nr[dev_nr]; 1989 cam->v4ldev->minor = video_nr[dev_nr];
1992 cam->v4ldev->release = video_device_release; 1990 cam->v4ldev->release = video_device_release;
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c
index 0929edb2d4f1..d842a7cb99d2 100644
--- a/drivers/media/video/zoran_card.c
+++ b/drivers/media/video/zoran_card.c
@@ -161,7 +161,7 @@ static struct pci_device_id zr36067_pci_tbl[] = {
161MODULE_DEVICE_TABLE(pci, zr36067_pci_tbl); 161MODULE_DEVICE_TABLE(pci, zr36067_pci_tbl);
162 162
163int zoran_num; /* number of Buzs in use */ 163int zoran_num; /* number of Buzs in use */
164struct zoran zoran[BUZ_MAX]; 164struct zoran *zoran[BUZ_MAX];
165 165
166/* videocodec bus functions ZR36060 */ 166/* videocodec bus functions ZR36060 */
167static u32 167static u32
@@ -355,9 +355,15 @@ i2cid_to_modulename (u16 i2c_id)
355 case I2C_DRIVERID_BT856: 355 case I2C_DRIVERID_BT856:
356 name = "bt856"; 356 name = "bt856";
357 break; 357 break;
358 case I2C_DRIVERID_BT866:
359 name = "bt866";
360 break;
358 case I2C_DRIVERID_VPX3220: 361 case I2C_DRIVERID_VPX3220:
359 name = "vpx3220"; 362 name = "vpx3220";
360 break; 363 break;
364 case I2C_DRIVERID_KS0127:
365 name = "ks0127";
366 break;
361 } 367 }
362 368
363 return name; 369 return name;
@@ -1164,7 +1170,7 @@ static void
1164zoran_release (struct zoran *zr) 1170zoran_release (struct zoran *zr)
1165{ 1171{
1166 if (!zr->initialized) 1172 if (!zr->initialized)
1167 return; 1173 goto exit_free;
1168 /* unregister videocodec bus */ 1174 /* unregister videocodec bus */
1169 if (zr->codec) { 1175 if (zr->codec) {
1170 struct videocodec_master *master = zr->codec->master_data; 1176 struct videocodec_master *master = zr->codec->master_data;
@@ -1192,6 +1198,8 @@ zoran_release (struct zoran *zr)
1192 iounmap(zr->zr36057_mem); 1198 iounmap(zr->zr36057_mem);
1193 pci_disable_device(zr->pci_dev); 1199 pci_disable_device(zr->pci_dev);
1194 video_unregister_device(zr->video_dev); 1200 video_unregister_device(zr->video_dev);
1201exit_free:
1202 kfree(zr);
1195} 1203}
1196 1204
1197void 1205void
@@ -1269,8 +1277,14 @@ find_zr36057 (void)
1269 while (zoran_num < BUZ_MAX && 1277 while (zoran_num < BUZ_MAX &&
1270 (dev = pci_get_device(PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36057, dev)) != NULL) { 1278 (dev = pci_get_device(PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36057, dev)) != NULL) {
1271 card_num = card[zoran_num]; 1279 card_num = card[zoran_num];
1272 zr = &zoran[zoran_num]; 1280 zr = kzalloc(sizeof(struct zoran), GFP_KERNEL);
1273 memset(zr, 0, sizeof(struct zoran)); // Just in case if previous cycle failed 1281 if (!zr) {
1282 dprintk(1,
1283 KERN_ERR
1284 "%s: find_zr36057() - kzalloc failed\n",
1285 ZORAN_NAME);
1286 continue;
1287 }
1274 zr->pci_dev = dev; 1288 zr->pci_dev = dev;
1275 //zr->zr36057_mem = NULL; 1289 //zr->zr36057_mem = NULL;
1276 zr->id = zoran_num; 1290 zr->id = zoran_num;
@@ -1278,7 +1292,7 @@ find_zr36057 (void)
1278 spin_lock_init(&zr->spinlock); 1292 spin_lock_init(&zr->spinlock);
1279 mutex_init(&zr->resource_lock); 1293 mutex_init(&zr->resource_lock);
1280 if (pci_enable_device(dev)) 1294 if (pci_enable_device(dev))
1281 continue; 1295 goto zr_free_mem;
1282 zr->zr36057_adr = pci_resource_start(zr->pci_dev, 0); 1296 zr->zr36057_adr = pci_resource_start(zr->pci_dev, 0);
1283 pci_read_config_byte(zr->pci_dev, PCI_CLASS_REVISION, 1297 pci_read_config_byte(zr->pci_dev, PCI_CLASS_REVISION,
1284 &zr->revision); 1298 &zr->revision);
@@ -1294,7 +1308,7 @@ find_zr36057 (void)
1294 KERN_ERR 1308 KERN_ERR
1295 "%s: find_zr36057() - no card specified, please use the card=X insmod option\n", 1309 "%s: find_zr36057() - no card specified, please use the card=X insmod option\n",
1296 ZR_DEVNAME(zr)); 1310 ZR_DEVNAME(zr));
1297 continue; 1311 goto zr_free_mem;
1298 } 1312 }
1299 } else { 1313 } else {
1300 int i; 1314 int i;
@@ -1333,7 +1347,7 @@ find_zr36057 (void)
1333 KERN_ERR 1347 KERN_ERR
1334 "%s: find_zr36057() - unknown card\n", 1348 "%s: find_zr36057() - unknown card\n",
1335 ZR_DEVNAME(zr)); 1349 ZR_DEVNAME(zr));
1336 continue; 1350 goto zr_free_mem;
1337 } 1351 }
1338 } 1352 }
1339 } 1353 }
@@ -1343,7 +1357,7 @@ find_zr36057 (void)
1343 KERN_ERR 1357 KERN_ERR
1344 "%s: find_zr36057() - invalid cardnum %d\n", 1358 "%s: find_zr36057() - invalid cardnum %d\n",
1345 ZR_DEVNAME(zr), card_num); 1359 ZR_DEVNAME(zr), card_num);
1346 continue; 1360 goto zr_free_mem;
1347 } 1361 }
1348 1362
1349 /* even though we make this a non pointer and thus 1363 /* even though we make this a non pointer and thus
@@ -1361,7 +1375,7 @@ find_zr36057 (void)
1361 KERN_ERR 1375 KERN_ERR
1362 "%s: find_zr36057() - ioremap failed\n", 1376 "%s: find_zr36057() - ioremap failed\n",
1363 ZR_DEVNAME(zr)); 1377 ZR_DEVNAME(zr));
1364 continue; 1378 goto zr_free_mem;
1365 } 1379 }
1366 1380
1367 result = request_irq(zr->pci_dev->irq, 1381 result = request_irq(zr->pci_dev->irq,
@@ -1530,7 +1544,7 @@ find_zr36057 (void)
1530 } 1544 }
1531 /* Success so keep the pci_dev referenced */ 1545 /* Success so keep the pci_dev referenced */
1532 pci_dev_get(zr->pci_dev); 1546 pci_dev_get(zr->pci_dev);
1533 zoran_num++; 1547 zoran[zoran_num++] = zr;
1534 continue; 1548 continue;
1535 1549
1536 // Init errors 1550 // Init errors
@@ -1549,6 +1563,8 @@ find_zr36057 (void)
1549 free_irq(zr->pci_dev->irq, zr); 1563 free_irq(zr->pci_dev->irq, zr);
1550 zr_unmap: 1564 zr_unmap:
1551 iounmap(zr->zr36057_mem); 1565 iounmap(zr->zr36057_mem);
1566 zr_free_mem:
1567 kfree(zr);
1552 continue; 1568 continue;
1553 } 1569 }
1554 if (dev) /* Clean up ref count on early exit */ 1570 if (dev) /* Clean up ref count on early exit */
@@ -1620,7 +1636,7 @@ init_dc10_cards (void)
1620 1636
1621 /* take care of Natoma chipset and a revision 1 zr36057 */ 1637 /* take care of Natoma chipset and a revision 1 zr36057 */
1622 for (i = 0; i < zoran_num; i++) { 1638 for (i = 0; i < zoran_num; i++) {
1623 struct zoran *zr = &zoran[i]; 1639 struct zoran *zr = zoran[i];
1624 1640
1625 if ((pci_pci_problems & PCIPCI_NATOMA) && zr->revision <= 1) { 1641 if ((pci_pci_problems & PCIPCI_NATOMA) && zr->revision <= 1) {
1626 zr->jpg_buffers.need_contiguous = 1; 1642 zr->jpg_buffers.need_contiguous = 1;
@@ -1632,7 +1648,7 @@ init_dc10_cards (void)
1632 1648
1633 if (zr36057_init(zr) < 0) { 1649 if (zr36057_init(zr) < 0) {
1634 for (i = 0; i < zoran_num; i++) 1650 for (i = 0; i < zoran_num; i++)
1635 zoran_release(&zoran[i]); 1651 zoran_release(zoran[i]);
1636 return -EIO; 1652 return -EIO;
1637 } 1653 }
1638 zoran_proc_init(zr); 1654 zoran_proc_init(zr);
@@ -1647,7 +1663,7 @@ unload_dc10_cards (void)
1647 int i; 1663 int i;
1648 1664
1649 for (i = 0; i < zoran_num; i++) 1665 for (i = 0; i < zoran_num; i++)
1650 zoran_release(&zoran[i]); 1666 zoran_release(zoran[i]);
1651} 1667}
1652 1668
1653module_init(init_dc10_cards); 1669module_init(init_dc10_cards);
diff --git a/drivers/media/video/zoran_card.h b/drivers/media/video/zoran_card.h
index 1b5c4171cf9c..e4dc9d29b404 100644
--- a/drivers/media/video/zoran_card.h
+++ b/drivers/media/video/zoran_card.h
@@ -41,7 +41,7 @@ extern int zr36067_debug;
41/* Anybody who uses more than four? */ 41/* Anybody who uses more than four? */
42#define BUZ_MAX 4 42#define BUZ_MAX 4
43extern int zoran_num; 43extern int zoran_num;
44extern struct zoran zoran[BUZ_MAX]; 44extern struct zoran *zoran[BUZ_MAX];
45 45
46extern struct video_device zoran_template; 46extern struct video_device zoran_template;
47 47
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
index c0675921fe20..ec6f59674b10 100644
--- a/drivers/media/video/zoran_driver.c
+++ b/drivers/media/video/zoran_driver.c
@@ -71,6 +71,7 @@
71 71
72#include <linux/videodev.h> 72#include <linux/videodev.h>
73#include <media/v4l2-common.h> 73#include <media/v4l2-common.h>
74#include <media/v4l2-ioctl.h>
74#include "videocodec.h" 75#include "videocodec.h"
75 76
76#include <asm/byteorder.h> 77#include <asm/byteorder.h>
@@ -1212,8 +1213,8 @@ zoran_open (struct inode *inode,
1212 1213
1213 /* find the device */ 1214 /* find the device */
1214 for (i = 0; i < zoran_num; i++) { 1215 for (i = 0; i < zoran_num; i++) {
1215 if (zoran[i].video_dev->minor == minor) { 1216 if (zoran[i]->video_dev->minor == minor) {
1216 zr = &zoran[i]; 1217 zr = zoran[i];
1217 break; 1218 break;
1218 } 1219 }
1219 } 1220 }
@@ -4643,8 +4644,6 @@ static const struct file_operations zoran_fops = {
4643 4644
4644struct video_device zoran_template __devinitdata = { 4645struct video_device zoran_template __devinitdata = {
4645 .name = ZORAN_NAME, 4646 .name = ZORAN_NAME,
4646 .type = ZORAN_VID_TYPE,
4647 .type2 = ZORAN_V4L2_VID_FLAGS,
4648 .fops = &zoran_fops, 4647 .fops = &zoran_fops,
4649 .release = &zoran_vdev_release, 4648 .release = &zoran_vdev_release,
4650 .minor = -1 4649 .minor = -1
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c
index 485df2e36132..18d1c4ba79fb 100644
--- a/drivers/media/video/zr364xx.c
+++ b/drivers/media/video/zr364xx.c
@@ -35,6 +35,7 @@
35#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
36#include <linux/highmem.h> 36#include <linux/highmem.h>
37#include <media/v4l2-common.h> 37#include <media/v4l2-common.h>
38#include <media/v4l2-ioctl.h>
38 39
39 40
40/* Version Information */ 41/* Version Information */
@@ -761,14 +762,7 @@ static const struct file_operations zr364xx_fops = {
761 .llseek = no_llseek, 762 .llseek = no_llseek,
762}; 763};
763 764
764static struct video_device zr364xx_template = { 765static const struct v4l2_ioctl_ops zr364xx_ioctl_ops = {
765 .owner = THIS_MODULE,
766 .name = DRIVER_DESC,
767 .type = VID_TYPE_CAPTURE,
768 .fops = &zr364xx_fops,
769 .release = video_device_release,
770 .minor = -1,
771
772 .vidioc_querycap = zr364xx_vidioc_querycap, 766 .vidioc_querycap = zr364xx_vidioc_querycap,
773 .vidioc_enum_fmt_vid_cap = zr364xx_vidioc_enum_fmt_vid_cap, 767 .vidioc_enum_fmt_vid_cap = zr364xx_vidioc_enum_fmt_vid_cap,
774 .vidioc_try_fmt_vid_cap = zr364xx_vidioc_try_fmt_vid_cap, 768 .vidioc_try_fmt_vid_cap = zr364xx_vidioc_try_fmt_vid_cap,
@@ -784,6 +778,14 @@ static struct video_device zr364xx_template = {
784 .vidioc_s_ctrl = zr364xx_vidioc_s_ctrl, 778 .vidioc_s_ctrl = zr364xx_vidioc_s_ctrl,
785}; 779};
786 780
781static struct video_device zr364xx_template = {
782 .name = DRIVER_DESC,
783 .fops = &zr364xx_fops,
784 .ioctl_ops = &zr364xx_ioctl_ops,
785 .release = video_device_release,
786 .minor = -1,
787};
788
787 789
788 790
789/*******************/ 791/*******************/
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 0454be4266c1..9c9c126ed334 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -15,24 +15,24 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/mfd/core.h> 16#include <linux/mfd/core.h>
17 17
18static int mfd_add_device(struct platform_device *parent, 18static int mfd_add_device(struct device *parent, int id,
19 const struct mfd_cell *cell, 19 const struct mfd_cell *cell,
20 struct resource *mem_base, 20 struct resource *mem_base,
21 int irq_base) 21 int irq_base)
22{ 22{
23 struct resource res[cell->num_resources]; 23 struct resource res[cell->num_resources];
24 struct platform_device *pdev; 24 struct platform_device *pdev;
25 int ret = -ENOMEM; 25 int ret = -ENOMEM;
26 int r; 26 int r;
27 27
28 pdev = platform_device_alloc(cell->name, parent->id); 28 pdev = platform_device_alloc(cell->name, id);
29 if (!pdev) 29 if (!pdev)
30 goto fail_alloc; 30 goto fail_alloc;
31 31
32 pdev->dev.parent = &parent->dev; 32 pdev->dev.parent = parent;
33 33
34 ret = platform_device_add_data(pdev, 34 ret = platform_device_add_data(pdev,
35 cell, sizeof(struct mfd_cell)); 35 cell->platform_data, cell->data_size);
36 if (ret) 36 if (ret)
37 goto fail_device; 37 goto fail_device;
38 38
@@ -75,17 +75,16 @@ fail_alloc:
75 return ret; 75 return ret;
76} 76}
77 77
78int mfd_add_devices( 78int mfd_add_devices(struct device *parent, int id,
79 struct platform_device *parent, 79 const struct mfd_cell *cells, int n_devs,
80 const struct mfd_cell *cells, int n_devs, 80 struct resource *mem_base,
81 struct resource *mem_base, 81 int irq_base)
82 int irq_base)
83{ 82{
84 int i; 83 int i;
85 int ret = 0; 84 int ret = 0;
86 85
87 for (i = 0; i < n_devs; i++) { 86 for (i = 0; i < n_devs; i++) {
88 ret = mfd_add_device(parent, cells + i, mem_base, irq_base); 87 ret = mfd_add_device(parent, id, cells + i, mem_base, irq_base);
89 if (ret) 88 if (ret)
90 break; 89 break;
91 } 90 }
@@ -99,14 +98,13 @@ EXPORT_SYMBOL(mfd_add_devices);
99 98
100static int mfd_remove_devices_fn(struct device *dev, void *unused) 99static int mfd_remove_devices_fn(struct device *dev, void *unused)
101{ 100{
102 platform_device_unregister( 101 platform_device_unregister(to_platform_device(dev));
103 container_of(dev, struct platform_device, dev));
104 return 0; 102 return 0;
105} 103}
106 104
107void mfd_remove_devices(struct platform_device *parent) 105void mfd_remove_devices(struct device *parent)
108{ 106{
109 device_for_each_child(&parent->dev, NULL, mfd_remove_devices_fn); 107 device_for_each_child(parent, NULL, mfd_remove_devices_fn);
110} 108}
111EXPORT_SYMBOL(mfd_remove_devices); 109EXPORT_SYMBOL(mfd_remove_devices);
112 110
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 94e55e8e7ce6..f4fd797c1590 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -466,8 +466,12 @@ static int __devinit tc6393xb_probe(struct platform_device *dev)
466 tc6393xb_attach_irq(dev); 466 tc6393xb_attach_irq(dev);
467 467
468 tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data; 468 tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data;
469 tc6393xb_cells[TC6393XB_CELL_NAND].platform_data =
470 &tc6393xb_cells[TC6393XB_CELL_NAND];
471 tc6393xb_cells[TC6393XB_CELL_NAND].data_size =
472 sizeof(tc6393xb_cells[TC6393XB_CELL_NAND]);
469 473
470 retval = mfd_add_devices(dev, 474 retval = mfd_add_devices(&dev->dev, dev->id,
471 tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), 475 tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells),
472 iomem, tcpd->irq_base); 476 iomem, tcpd->irq_base);
473 477
@@ -501,7 +505,7 @@ static int __devexit tc6393xb_remove(struct platform_device *dev)
501 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); 505 struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
502 int ret; 506 int ret;
503 507
504 mfd_remove_devices(dev); 508 mfd_remove_devices(&dev->dev);
505 509
506 if (tc6393xb->irq) 510 if (tc6393xb->irq)
507 tc6393xb_detach_irq(dev); 511 tc6393xb_detach_irq(dev);
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index f5ade1904aad..fa50e9ede0e6 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -426,7 +426,7 @@ config ENCLOSURE_SERVICES
426 426
427config SGI_XP 427config SGI_XP
428 tristate "Support communication between SGI SSIs" 428 tristate "Support communication between SGI SSIs"
429 depends on IA64_GENERIC || IA64_SGI_SN2 429 depends on IA64_GENERIC || IA64_SGI_SN2 || IA64_SGI_UV || (X86_64 && SMP)
430 select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2 430 select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
431 select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2 431 select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
432 ---help--- 432 ---help---
@@ -450,4 +450,27 @@ config HP_ILO
450 To compile this driver as a module, choose M here: the 450 To compile this driver as a module, choose M here: the
451 module will be called hpilo. 451 module will be called hpilo.
452 452
453config SGI_GRU
454 tristate "SGI GRU driver"
455 depends on (X86_64 || IA64_SGI_UV || IA64_GENERIC) && SMP
456 default n
457 select MMU_NOTIFIER
458 ---help---
459 The GRU is a hardware resource located in the system chipset. The GRU
460 contains memory that can be mmapped into the user address space. This memory is
461 used to communicate with the GRU to perform functions such as load/store,
462 scatter/gather, bcopy, AMOs, etc. The GRU is directly accessed by user
463 instructions using user virtual addresses. GRU instructions (ex., bcopy) use
464 user virtual addresses for operands.
465
466 If you are not running on a SGI UV system, say N.
467
468config SGI_GRU_DEBUG
469 bool "SGI GRU driver debug"
470 depends on SGI_GRU
471 default n
472 ---help---
473 This option enables addition debugging code for the SGI GRU driver. If
474 you are unsure, say N.
475
453endif # MISC_DEVICES 476endif # MISC_DEVICES
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index f5e273420c09..c6c13f60b452 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -28,4 +28,5 @@ obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o
28obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o 28obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
29obj-$(CONFIG_KGDB_TESTS) += kgdbts.o 29obj-$(CONFIG_KGDB_TESTS) += kgdbts.o
30obj-$(CONFIG_SGI_XP) += sgi-xp/ 30obj-$(CONFIG_SGI_XP) += sgi-xp/
31obj-$(CONFIG_SGI_GRU) += sgi-gru/
31obj-$(CONFIG_HP_ILO) += hpilo.o 32obj-$(CONFIG_HP_ILO) += hpilo.o
diff --git a/drivers/misc/sgi-gru/Makefile b/drivers/misc/sgi-gru/Makefile
new file mode 100644
index 000000000000..d03597a521b0
--- /dev/null
+++ b/drivers/misc/sgi-gru/Makefile
@@ -0,0 +1,3 @@
1obj-$(CONFIG_SGI_GRU) := gru.o
2gru-y := grufile.o grumain.o grufault.o grutlbpurge.o gruprocfs.o grukservices.o
3
diff --git a/drivers/misc/sgi-gru/gru.h b/drivers/misc/sgi-gru/gru.h
new file mode 100644
index 000000000000..40df7cb3f0a5
--- /dev/null
+++ b/drivers/misc/sgi-gru/gru.h
@@ -0,0 +1,67 @@
1/*
2 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __GRU_H__
20#define __GRU_H__
21
22/*
23 * GRU architectural definitions
24 */
25#define GRU_CACHE_LINE_BYTES 64
26#define GRU_HANDLE_STRIDE 256
27#define GRU_CB_BASE 0
28#define GRU_DS_BASE 0x20000
29
30/*
31 * Size used to map GRU GSeg
32 */
33#if defined CONFIG_IA64
34#define GRU_GSEG_PAGESIZE (256 * 1024UL)
35#elif defined CONFIG_X86_64
36#define GRU_GSEG_PAGESIZE (256 * 1024UL) /* ZZZ 2MB ??? */
37#else
38#error "Unsupported architecture"
39#endif
40
41/*
42 * Structure for obtaining GRU resource information
43 */
44struct gru_chiplet_info {
45 int node;
46 int chiplet;
47 int blade;
48 int total_dsr_bytes;
49 int total_cbr;
50 int total_user_dsr_bytes;
51 int total_user_cbr;
52 int free_user_dsr_bytes;
53 int free_user_cbr;
54};
55
56/* Flags for GRU options on the gru_create_context() call */
57/* Select one of the follow 4 options to specify how TLB misses are handled */
58#define GRU_OPT_MISS_DEFAULT 0x0000 /* Use default mode */
59#define GRU_OPT_MISS_USER_POLL 0x0001 /* User will poll CB for faults */
60#define GRU_OPT_MISS_FMM_INTR 0x0002 /* Send interrupt to cpu to
61 handle fault */
62#define GRU_OPT_MISS_FMM_POLL 0x0003 /* Use system polling thread */
63#define GRU_OPT_MISS_MASK 0x0003 /* Mask for TLB MISS option */
64
65
66
67#endif /* __GRU_H__ */
diff --git a/drivers/misc/sgi-gru/gru_instructions.h b/drivers/misc/sgi-gru/gru_instructions.h
new file mode 100644
index 000000000000..0dc36225c7c6
--- /dev/null
+++ b/drivers/misc/sgi-gru/gru_instructions.h
@@ -0,0 +1,669 @@
1/*
2 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __GRU_INSTRUCTIONS_H__
20#define __GRU_INSTRUCTIONS_H__
21
22#define gru_flush_cache_hook(p)
23#define gru_emulator_wait_hook(p, w)
24
25/*
26 * Architecture dependent functions
27 */
28
29#if defined CONFIG_IA64
30#include <linux/compiler.h>
31#include <asm/intrinsics.h>
32#define __flush_cache(p) ia64_fc(p)
33/* Use volatile on IA64 to ensure ordering via st4.rel */
34#define gru_ordered_store_int(p,v) \
35 do { \
36 barrier(); \
37 *((volatile int *)(p)) = v; /* force st.rel */ \
38 } while (0)
39#elif defined CONFIG_X86_64
40#define __flush_cache(p) clflush(p)
41#define gru_ordered_store_int(p,v) \
42 do { \
43 barrier(); \
44 *(int *)p = v; \
45 } while (0)
46#else
47#error "Unsupported architecture"
48#endif
49
50/*
51 * Control block status and exception codes
52 */
53#define CBS_IDLE 0
54#define CBS_EXCEPTION 1
55#define CBS_ACTIVE 2
56#define CBS_CALL_OS 3
57
58/* CB substatus bitmasks */
59#define CBSS_MSG_QUEUE_MASK 7
60#define CBSS_IMPLICIT_ABORT_ACTIVE_MASK 8
61
62/* CB substatus message queue values (low 3 bits of substatus) */
63#define CBSS_NO_ERROR 0
64#define CBSS_LB_OVERFLOWED 1
65#define CBSS_QLIMIT_REACHED 2
66#define CBSS_PAGE_OVERFLOW 3
67#define CBSS_AMO_NACKED 4
68#define CBSS_PUT_NACKED 5
69
70/*
71 * Structure used to fetch exception detail for CBs that terminate with
72 * CBS_EXCEPTION
73 */
74struct control_block_extended_exc_detail {
75 unsigned long cb;
76 int opc;
77 int ecause;
78 int exopc;
79 long exceptdet0;
80 int exceptdet1;
81};
82
83/*
84 * Instruction formats
85 */
86
87/*
88 * Generic instruction format.
89 * This definition has precise bit field definitions.
90 */
91struct gru_instruction_bits {
92 /* DW 0 - low */
93 unsigned int icmd: 1;
94 unsigned char ima: 3; /* CB_DelRep, unmapped mode */
95 unsigned char reserved0: 4;
96 unsigned int xtype: 3;
97 unsigned int iaa0: 2;
98 unsigned int iaa1: 2;
99 unsigned char reserved1: 1;
100 unsigned char opc: 8; /* opcode */
101 unsigned char exopc: 8; /* extended opcode */
102 /* DW 0 - high */
103 unsigned int idef2: 22; /* TRi0 */
104 unsigned char reserved2: 2;
105 unsigned char istatus: 2;
106 unsigned char isubstatus:4;
107 unsigned char reserved3: 2;
108 /* DW 1 */
109 unsigned long idef4; /* 42 bits: TRi1, BufSize */
110 /* DW 2-6 */
111 unsigned long idef1; /* BAddr0 */
112 unsigned long idef5; /* Nelem */
113 unsigned long idef6; /* Stride, Operand1 */
114 unsigned long idef3; /* BAddr1, Value, Operand2 */
115 unsigned long reserved4;
116 /* DW 7 */
117 unsigned long avalue; /* AValue */
118};
119
120/*
121 * Generic instruction with friendlier names. This format is used
122 * for inline instructions.
123 */
124struct gru_instruction {
125 /* DW 0 */
126 unsigned int op32; /* icmd,xtype,iaa0,ima,opc */
127 unsigned int tri0;
128 unsigned long tri1_bufsize; /* DW 1 */
129 unsigned long baddr0; /* DW 2 */
130 unsigned long nelem; /* DW 3 */
131 unsigned long op1_stride; /* DW 4 */
132 unsigned long op2_value_baddr1; /* DW 5 */
133 unsigned long reserved0; /* DW 6 */
134 unsigned long avalue; /* DW 7 */
135};
136
137/* Some shifts and masks for the low 32 bits of a GRU command */
138#define GRU_CB_ICMD_SHFT 0
139#define GRU_CB_ICMD_MASK 0x1
140#define GRU_CB_XTYPE_SHFT 8
141#define GRU_CB_XTYPE_MASK 0x7
142#define GRU_CB_IAA0_SHFT 11
143#define GRU_CB_IAA0_MASK 0x3
144#define GRU_CB_IAA1_SHFT 13
145#define GRU_CB_IAA1_MASK 0x3
146#define GRU_CB_IMA_SHFT 1
147#define GRU_CB_IMA_MASK 0x3
148#define GRU_CB_OPC_SHFT 16
149#define GRU_CB_OPC_MASK 0xff
150#define GRU_CB_EXOPC_SHFT 24
151#define GRU_CB_EXOPC_MASK 0xff
152
153/* GRU instruction opcodes (opc field) */
154#define OP_NOP 0x00
155#define OP_BCOPY 0x01
156#define OP_VLOAD 0x02
157#define OP_IVLOAD 0x03
158#define OP_VSTORE 0x04
159#define OP_IVSTORE 0x05
160#define OP_VSET 0x06
161#define OP_IVSET 0x07
162#define OP_MESQ 0x08
163#define OP_GAMXR 0x09
164#define OP_GAMIR 0x0a
165#define OP_GAMIRR 0x0b
166#define OP_GAMER 0x0c
167#define OP_GAMERR 0x0d
168#define OP_BSTORE 0x0e
169#define OP_VFLUSH 0x0f
170
171
172/* Extended opcodes values (exopc field) */
173
174/* GAMIR - AMOs with implicit operands */
175#define EOP_IR_FETCH 0x01 /* Plain fetch of memory */
176#define EOP_IR_CLR 0x02 /* Fetch and clear */
177#define EOP_IR_INC 0x05 /* Fetch and increment */
178#define EOP_IR_DEC 0x07 /* Fetch and decrement */
179#define EOP_IR_QCHK1 0x0d /* Queue check, 64 byte msg */
180#define EOP_IR_QCHK2 0x0e /* Queue check, 128 byte msg */
181
182/* GAMIRR - Registered AMOs with implicit operands */
183#define EOP_IRR_FETCH 0x01 /* Registered fetch of memory */
184#define EOP_IRR_CLR 0x02 /* Registered fetch and clear */
185#define EOP_IRR_INC 0x05 /* Registered fetch and increment */
186#define EOP_IRR_DEC 0x07 /* Registered fetch and decrement */
187#define EOP_IRR_DECZ 0x0f /* Registered fetch and decrement, update on zero*/
188
189/* GAMER - AMOs with explicit operands */
190#define EOP_ER_SWAP 0x00 /* Exchange argument and memory */
191#define EOP_ER_OR 0x01 /* Logical OR with memory */
192#define EOP_ER_AND 0x02 /* Logical AND with memory */
193#define EOP_ER_XOR 0x03 /* Logical XOR with memory */
194#define EOP_ER_ADD 0x04 /* Add value to memory */
195#define EOP_ER_CSWAP 0x08 /* Compare with operand2, write operand1 if match*/
196#define EOP_ER_CADD 0x0c /* Queue check, operand1*64 byte msg */
197
198/* GAMERR - Registered AMOs with explicit operands */
199#define EOP_ERR_SWAP 0x00 /* Exchange argument and memory */
200#define EOP_ERR_OR 0x01 /* Logical OR with memory */
201#define EOP_ERR_AND 0x02 /* Logical AND with memory */
202#define EOP_ERR_XOR 0x03 /* Logical XOR with memory */
203#define EOP_ERR_ADD 0x04 /* Add value to memory */
204#define EOP_ERR_CSWAP 0x08 /* Compare with operand2, write operand1 if match*/
205#define EOP_ERR_EPOLL 0x09 /* Poll for equality */
206#define EOP_ERR_NPOLL 0x0a /* Poll for inequality */
207
208/* GAMXR - SGI Arithmetic unit */
209#define EOP_XR_CSWAP 0x0b /* Masked compare exchange */
210
211
212/* Transfer types (xtype field) */
213#define XTYPE_B 0x0 /* byte */
214#define XTYPE_S 0x1 /* short (2-byte) */
215#define XTYPE_W 0x2 /* word (4-byte) */
216#define XTYPE_DW 0x3 /* doubleword (8-byte) */
217#define XTYPE_CL 0x6 /* cacheline (64-byte) */
218
219
220/* Instruction access attributes (iaa0, iaa1 fields) */
221#define IAA_RAM 0x0 /* normal cached RAM access */
222#define IAA_NCRAM 0x2 /* noncoherent RAM access */
223#define IAA_MMIO 0x1 /* noncoherent memory-mapped I/O space */
224#define IAA_REGISTER 0x3 /* memory-mapped registers, etc. */
225
226
227/* Instruction mode attributes (ima field) */
228#define IMA_MAPPED 0x0 /* Virtual mode */
229#define IMA_CB_DELAY 0x1 /* hold read responses until status changes */
230#define IMA_UNMAPPED 0x2 /* bypass the TLBs (OS only) */
231#define IMA_INTERRUPT 0x4 /* Interrupt when instruction completes */
232
233/* CBE ecause bits */
234#define CBE_CAUSE_RI (1 << 0)
235#define CBE_CAUSE_INVALID_INSTRUCTION (1 << 1)
236#define CBE_CAUSE_UNMAPPED_MODE_FORBIDDEN (1 << 2)
237#define CBE_CAUSE_PE_CHECK_DATA_ERROR (1 << 3)
238#define CBE_CAUSE_IAA_GAA_MISMATCH (1 << 4)
239#define CBE_CAUSE_DATA_SEGMENT_LIMIT_EXCEPTION (1 << 5)
240#define CBE_CAUSE_OS_FATAL_TLB_FAULT (1 << 6)
241#define CBE_CAUSE_EXECUTION_HW_ERROR (1 << 7)
242#define CBE_CAUSE_TLBHW_ERROR (1 << 8)
243#define CBE_CAUSE_RA_REQUEST_TIMEOUT (1 << 9)
244#define CBE_CAUSE_HA_REQUEST_TIMEOUT (1 << 10)
245#define CBE_CAUSE_RA_RESPONSE_FATAL (1 << 11)
246#define CBE_CAUSE_RA_RESPONSE_NON_FATAL (1 << 12)
247#define CBE_CAUSE_HA_RESPONSE_FATAL (1 << 13)
248#define CBE_CAUSE_HA_RESPONSE_NON_FATAL (1 << 14)
249#define CBE_CAUSE_ADDRESS_SPACE_DECODE_ERROR (1 << 15)
250#define CBE_CAUSE_RESPONSE_DATA_ERROR (1 << 16)
251#define CBE_CAUSE_PROTOCOL_STATE_DATA_ERROR (1 << 17)
252
253/*
254 * Exceptions are retried for the following cases. If any OTHER bits are set
255 * in ecause, the exception is not retryable.
256 */
257#define EXCEPTION_RETRY_BITS (CBE_CAUSE_RESPONSE_DATA_ERROR | \
258 CBE_CAUSE_RA_REQUEST_TIMEOUT | \
259 CBE_CAUSE_TLBHW_ERROR | \
260 CBE_CAUSE_HA_REQUEST_TIMEOUT)
261
262/* Message queue head structure */
263union gru_mesqhead {
264 unsigned long val;
265 struct {
266 unsigned int head;
267 unsigned int limit;
268 };
269};
270
271
272/* Generate the low word of a GRU instruction */
273static inline unsigned int
274__opword(unsigned char opcode, unsigned char exopc, unsigned char xtype,
275 unsigned char iaa0, unsigned char iaa1,
276 unsigned char ima)
277{
278 return (1 << GRU_CB_ICMD_SHFT) |
279 (iaa0 << GRU_CB_IAA0_SHFT) |
280 (iaa1 << GRU_CB_IAA1_SHFT) |
281 (ima << GRU_CB_IMA_SHFT) |
282 (xtype << GRU_CB_XTYPE_SHFT) |
283 (opcode << GRU_CB_OPC_SHFT) |
284 (exopc << GRU_CB_EXOPC_SHFT);
285}
286
287/*
288 * Architecture specific intrinsics
289 */
290static inline void gru_flush_cache(void *p)
291{
292 __flush_cache(p);
293}
294
295/*
296 * Store the lower 32 bits of the command including the "start" bit. Then
297 * start the instruction executing.
298 */
299static inline void gru_start_instruction(struct gru_instruction *ins, int op32)
300{
301 gru_ordered_store_int(ins, op32);
302}
303
304
305/* Convert "hints" to IMA */
306#define CB_IMA(h) ((h) | IMA_UNMAPPED)
307
308/* Convert data segment cache line index into TRI0 / TRI1 value */
309#define GRU_DINDEX(i) ((i) * GRU_CACHE_LINE_BYTES)
310
311/* Inline functions for GRU instructions.
312 * Note:
313 * - nelem and stride are in elements
314 * - tri0/tri1 is in bytes for the beginning of the data segment.
315 */
316static inline void gru_vload(void *cb, unsigned long mem_addr,
317 unsigned int tri0, unsigned char xtype, unsigned long nelem,
318 unsigned long stride, unsigned long hints)
319{
320 struct gru_instruction *ins = (struct gru_instruction *)cb;
321
322 ins->baddr0 = (long)mem_addr;
323 ins->nelem = nelem;
324 ins->tri0 = tri0;
325 ins->op1_stride = stride;
326 gru_start_instruction(ins, __opword(OP_VLOAD, 0, xtype, IAA_RAM, 0,
327 CB_IMA(hints)));
328}
329
330static inline void gru_vstore(void *cb, unsigned long mem_addr,
331 unsigned int tri0, unsigned char xtype, unsigned long nelem,
332 unsigned long stride, unsigned long hints)
333{
334 struct gru_instruction *ins = (void *)cb;
335
336 ins->baddr0 = (long)mem_addr;
337 ins->nelem = nelem;
338 ins->tri0 = tri0;
339 ins->op1_stride = stride;
340 gru_start_instruction(ins, __opword(OP_VSTORE, 0, xtype, IAA_RAM, 0,
341 CB_IMA(hints)));
342}
343
344static inline void gru_ivload(void *cb, unsigned long mem_addr,
345 unsigned int tri0, unsigned int tri1, unsigned char xtype,
346 unsigned long nelem, unsigned long hints)
347{
348 struct gru_instruction *ins = (void *)cb;
349
350 ins->baddr0 = (long)mem_addr;
351 ins->nelem = nelem;
352 ins->tri0 = tri0;
353 ins->tri1_bufsize = tri1;
354 gru_start_instruction(ins, __opword(OP_IVLOAD, 0, xtype, IAA_RAM, 0,
355 CB_IMA(hints)));
356}
357
358static inline void gru_ivstore(void *cb, unsigned long mem_addr,
359 unsigned int tri0, unsigned int tri1,
360 unsigned char xtype, unsigned long nelem, unsigned long hints)
361{
362 struct gru_instruction *ins = (void *)cb;
363
364 ins->baddr0 = (long)mem_addr;
365 ins->nelem = nelem;
366 ins->tri0 = tri0;
367 ins->tri1_bufsize = tri1;
368 gru_start_instruction(ins, __opword(OP_IVSTORE, 0, xtype, IAA_RAM, 0,
369 CB_IMA(hints)));
370}
371
372static inline void gru_vset(void *cb, unsigned long mem_addr,
373 unsigned long value, unsigned char xtype, unsigned long nelem,
374 unsigned long stride, unsigned long hints)
375{
376 struct gru_instruction *ins = (void *)cb;
377
378 ins->baddr0 = (long)mem_addr;
379 ins->op2_value_baddr1 = value;
380 ins->nelem = nelem;
381 ins->op1_stride = stride;
382 gru_start_instruction(ins, __opword(OP_VSET, 0, xtype, IAA_RAM, 0,
383 CB_IMA(hints)));
384}
385
386static inline void gru_ivset(void *cb, unsigned long mem_addr,
387 unsigned int tri1, unsigned long value, unsigned char xtype,
388 unsigned long nelem, unsigned long hints)
389{
390 struct gru_instruction *ins = (void *)cb;
391
392 ins->baddr0 = (long)mem_addr;
393 ins->op2_value_baddr1 = value;
394 ins->nelem = nelem;
395 ins->tri1_bufsize = tri1;
396 gru_start_instruction(ins, __opword(OP_IVSET, 0, xtype, IAA_RAM, 0,
397 CB_IMA(hints)));
398}
399
400static inline void gru_vflush(void *cb, unsigned long mem_addr,
401 unsigned long nelem, unsigned char xtype, unsigned long stride,
402 unsigned long hints)
403{
404 struct gru_instruction *ins = (void *)cb;
405
406 ins->baddr0 = (long)mem_addr;
407 ins->op1_stride = stride;
408 ins->nelem = nelem;
409 gru_start_instruction(ins, __opword(OP_VFLUSH, 0, xtype, IAA_RAM, 0,
410 CB_IMA(hints)));
411}
412
413static inline void gru_nop(void *cb, int hints)
414{
415 struct gru_instruction *ins = (void *)cb;
416
417 gru_start_instruction(ins, __opword(OP_NOP, 0, 0, 0, 0, CB_IMA(hints)));
418}
419
420
421static inline void gru_bcopy(void *cb, const unsigned long src,
422 unsigned long dest,
423 unsigned int tri0, unsigned int xtype, unsigned long nelem,
424 unsigned int bufsize, unsigned long hints)
425{
426 struct gru_instruction *ins = (void *)cb;
427
428 ins->baddr0 = (long)src;
429 ins->op2_value_baddr1 = (long)dest;
430 ins->nelem = nelem;
431 ins->tri0 = tri0;
432 ins->tri1_bufsize = bufsize;
433 gru_start_instruction(ins, __opword(OP_BCOPY, 0, xtype, IAA_RAM,
434 IAA_RAM, CB_IMA(hints)));
435}
436
437static inline void gru_bstore(void *cb, const unsigned long src,
438 unsigned long dest, unsigned int tri0, unsigned int xtype,
439 unsigned long nelem, unsigned long hints)
440{
441 struct gru_instruction *ins = (void *)cb;
442
443 ins->baddr0 = (long)src;
444 ins->op2_value_baddr1 = (long)dest;
445 ins->nelem = nelem;
446 ins->tri0 = tri0;
447 gru_start_instruction(ins, __opword(OP_BSTORE, 0, xtype, 0, IAA_RAM,
448 CB_IMA(hints)));
449}
450
451static inline void gru_gamir(void *cb, int exopc, unsigned long src,
452 unsigned int xtype, unsigned long hints)
453{
454 struct gru_instruction *ins = (void *)cb;
455
456 ins->baddr0 = (long)src;
457 gru_start_instruction(ins, __opword(OP_GAMIR, exopc, xtype, IAA_RAM, 0,
458 CB_IMA(hints)));
459}
460
461static inline void gru_gamirr(void *cb, int exopc, unsigned long src,
462 unsigned int xtype, unsigned long hints)
463{
464 struct gru_instruction *ins = (void *)cb;
465
466 ins->baddr0 = (long)src;
467 gru_start_instruction(ins, __opword(OP_GAMIRR, exopc, xtype, IAA_RAM, 0,
468 CB_IMA(hints)));
469}
470
471static inline void gru_gamer(void *cb, int exopc, unsigned long src,
472 unsigned int xtype,
473 unsigned long operand1, unsigned long operand2,
474 unsigned long hints)
475{
476 struct gru_instruction *ins = (void *)cb;
477
478 ins->baddr0 = (long)src;
479 ins->op1_stride = operand1;
480 ins->op2_value_baddr1 = operand2;
481 gru_start_instruction(ins, __opword(OP_GAMER, exopc, xtype, IAA_RAM, 0,
482 CB_IMA(hints)));
483}
484
485static inline void gru_gamerr(void *cb, int exopc, unsigned long src,
486 unsigned int xtype, unsigned long operand1,
487 unsigned long operand2, unsigned long hints)
488{
489 struct gru_instruction *ins = (void *)cb;
490
491 ins->baddr0 = (long)src;
492 ins->op1_stride = operand1;
493 ins->op2_value_baddr1 = operand2;
494 gru_start_instruction(ins, __opword(OP_GAMERR, exopc, xtype, IAA_RAM, 0,
495 CB_IMA(hints)));
496}
497
498static inline void gru_gamxr(void *cb, unsigned long src,
499 unsigned int tri0, unsigned long hints)
500{
501 struct gru_instruction *ins = (void *)cb;
502
503 ins->baddr0 = (long)src;
504 ins->nelem = 4;
505 gru_start_instruction(ins, __opword(OP_GAMXR, EOP_XR_CSWAP, XTYPE_DW,
506 IAA_RAM, 0, CB_IMA(hints)));
507}
508
509static inline void gru_mesq(void *cb, unsigned long queue,
510 unsigned long tri0, unsigned long nelem,
511 unsigned long hints)
512{
513 struct gru_instruction *ins = (void *)cb;
514
515 ins->baddr0 = (long)queue;
516 ins->nelem = nelem;
517 ins->tri0 = tri0;
518 gru_start_instruction(ins, __opword(OP_MESQ, 0, XTYPE_CL, IAA_RAM, 0,
519 CB_IMA(hints)));
520}
521
522static inline unsigned long gru_get_amo_value(void *cb)
523{
524 struct gru_instruction *ins = (void *)cb;
525
526 return ins->avalue;
527}
528
529static inline int gru_get_amo_value_head(void *cb)
530{
531 struct gru_instruction *ins = (void *)cb;
532
533 return ins->avalue & 0xffffffff;
534}
535
536static inline int gru_get_amo_value_limit(void *cb)
537{
538 struct gru_instruction *ins = (void *)cb;
539
540 return ins->avalue >> 32;
541}
542
543static inline union gru_mesqhead gru_mesq_head(int head, int limit)
544{
545 union gru_mesqhead mqh;
546
547 mqh.head = head;
548 mqh.limit = limit;
549 return mqh;
550}
551
552/*
553 * Get struct control_block_extended_exc_detail for CB.
554 */
555extern int gru_get_cb_exception_detail(void *cb,
556 struct control_block_extended_exc_detail *excdet);
557
558#define GRU_EXC_STR_SIZE 256
559
560extern int gru_check_status_proc(void *cb);
561extern int gru_wait_proc(void *cb);
562extern void gru_wait_abort_proc(void *cb);
563
564/*
565 * Control block definition for checking status
566 */
567struct gru_control_block_status {
568 unsigned int icmd :1;
569 unsigned int unused1 :31;
570 unsigned int unused2 :24;
571 unsigned int istatus :2;
572 unsigned int isubstatus :4;
573 unsigned int inused3 :2;
574};
575
576/* Get CB status */
577static inline int gru_get_cb_status(void *cb)
578{
579 struct gru_control_block_status *cbs = (void *)cb;
580
581 return cbs->istatus;
582}
583
584/* Get CB message queue substatus */
585static inline int gru_get_cb_message_queue_substatus(void *cb)
586{
587 struct gru_control_block_status *cbs = (void *)cb;
588
589 return cbs->isubstatus & CBSS_MSG_QUEUE_MASK;
590}
591
592/* Get CB substatus */
593static inline int gru_get_cb_substatus(void *cb)
594{
595 struct gru_control_block_status *cbs = (void *)cb;
596
597 return cbs->isubstatus;
598}
599
600/* Check the status of a CB. If the CB is in UPM mode, call the
601 * OS to handle the UPM status.
602 * Returns the CB status field value (0 for normal completion)
603 */
604static inline int gru_check_status(void *cb)
605{
606 struct gru_control_block_status *cbs = (void *)cb;
607 int ret = cbs->istatus;
608
609 if (ret == CBS_CALL_OS)
610 ret = gru_check_status_proc(cb);
611 return ret;
612}
613
614/* Wait for CB to complete.
615 * Returns the CB status field value (0 for normal completion)
616 */
617static inline int gru_wait(void *cb)
618{
619 struct gru_control_block_status *cbs = (void *)cb;
620 int ret = cbs->istatus;;
621
622 if (ret != CBS_IDLE)
623 ret = gru_wait_proc(cb);
624 return ret;
625}
626
627/* Wait for CB to complete. Aborts program if error. (Note: error does NOT
628 * mean TLB mis - only fatal errors such as memory parity error or user
629 * bugs will cause termination.
630 */
631static inline void gru_wait_abort(void *cb)
632{
633 struct gru_control_block_status *cbs = (void *)cb;
634
635 if (cbs->istatus != CBS_IDLE)
636 gru_wait_abort_proc(cb);
637}
638
639
640/*
641 * Get a pointer to a control block
642 * gseg - GSeg address returned from gru_get_thread_gru_segment()
643 * index - index of desired CB
644 */
645static inline void *gru_get_cb_pointer(void *gseg,
646 int index)
647{
648 return gseg + GRU_CB_BASE + index * GRU_HANDLE_STRIDE;
649}
650
651/*
652 * Get a pointer to a cacheline in the data segment portion of a GSeg
653 * gseg - GSeg address returned from gru_get_thread_gru_segment()
654 * index - index of desired cache line
655 */
656static inline void *gru_get_data_pointer(void *gseg, int index)
657{
658 return gseg + GRU_DS_BASE + index * GRU_CACHE_LINE_BYTES;
659}
660
661/*
662 * Convert a vaddr into the tri index within the GSEG
663 * vaddr - virtual address of within gseg
664 */
665static inline int gru_get_tri(void *vaddr)
666{
667 return ((unsigned long)vaddr & (GRU_GSEG_PAGESIZE - 1)) - GRU_DS_BASE;
668}
669#endif /* __GRU_INSTRUCTIONS_H__ */
diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c
new file mode 100644
index 000000000000..3d33015bbf31
--- /dev/null
+++ b/drivers/misc/sgi-gru/grufault.c
@@ -0,0 +1,633 @@
1/*
2 * SN Platform GRU Driver
3 *
4 * FAULT HANDLER FOR GRU DETECTED TLB MISSES
5 *
6 * This file contains code that handles TLB misses within the GRU.
7 * These misses are reported either via interrupts or user polling of
8 * the user CB.
9 *
10 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27#include <linux/kernel.h>
28#include <linux/errno.h>
29#include <linux/spinlock.h>
30#include <linux/mm.h>
31#include <linux/hugetlb.h>
32#include <linux/device.h>
33#include <linux/io.h>
34#include <linux/uaccess.h>
35#include <asm/pgtable.h>
36#include "gru.h"
37#include "grutables.h"
38#include "grulib.h"
39#include "gru_instructions.h"
40#include <asm/uv/uv_hub.h>
41
42/*
43 * Test if a physical address is a valid GRU GSEG address
44 */
45static inline int is_gru_paddr(unsigned long paddr)
46{
47 return paddr >= gru_start_paddr && paddr < gru_end_paddr;
48}
49
50/*
51 * Find the vma of a GRU segment. Caller must hold mmap_sem.
52 */
53struct vm_area_struct *gru_find_vma(unsigned long vaddr)
54{
55 struct vm_area_struct *vma;
56
57 vma = find_vma(current->mm, vaddr);
58 if (vma && vma->vm_start <= vaddr && vma->vm_ops == &gru_vm_ops)
59 return vma;
60 return NULL;
61}
62
63/*
64 * Find and lock the gts that contains the specified user vaddr.
65 *
66 * Returns:
67 * - *gts with the mmap_sem locked for read and the GTS locked.
68 * - NULL if vaddr invalid OR is not a valid GSEG vaddr.
69 */
70
71static struct gru_thread_state *gru_find_lock_gts(unsigned long vaddr)
72{
73 struct mm_struct *mm = current->mm;
74 struct vm_area_struct *vma;
75 struct gru_thread_state *gts = NULL;
76
77 down_read(&mm->mmap_sem);
78 vma = gru_find_vma(vaddr);
79 if (vma)
80 gts = gru_find_thread_state(vma, TSID(vaddr, vma));
81 if (gts)
82 mutex_lock(&gts->ts_ctxlock);
83 else
84 up_read(&mm->mmap_sem);
85 return gts;
86}
87
88static struct gru_thread_state *gru_alloc_locked_gts(unsigned long vaddr)
89{
90 struct mm_struct *mm = current->mm;
91 struct vm_area_struct *vma;
92 struct gru_thread_state *gts = NULL;
93
94 down_write(&mm->mmap_sem);
95 vma = gru_find_vma(vaddr);
96 if (vma)
97 gts = gru_alloc_thread_state(vma, TSID(vaddr, vma));
98 if (gts) {
99 mutex_lock(&gts->ts_ctxlock);
100 downgrade_write(&mm->mmap_sem);
101 } else {
102 up_write(&mm->mmap_sem);
103 }
104
105 return gts;
106}
107
108/*
109 * Unlock a GTS that was previously locked with gru_find_lock_gts().
110 */
111static void gru_unlock_gts(struct gru_thread_state *gts)
112{
113 mutex_unlock(&gts->ts_ctxlock);
114 up_read(&current->mm->mmap_sem);
115}
116
117/*
118 * Set a CB.istatus to active using a user virtual address. This must be done
119 * just prior to a TFH RESTART. The new cb.istatus is an in-cache status ONLY.
120 * If the line is evicted, the status may be lost. The in-cache update
121 * is necessary to prevent the user from seeing a stale cb.istatus that will
122 * change as soon as the TFH restart is complete. Races may cause an
123 * occasional failure to clear the cb.istatus, but that is ok.
124 *
125 * If the cb address is not valid (should not happen, but...), nothing
126 * bad will happen.. The get_user()/put_user() will fail but there
127 * are no bad side-effects.
128 */
129static void gru_cb_set_istatus_active(unsigned long __user *cb)
130{
131 union {
132 struct gru_instruction_bits bits;
133 unsigned long dw;
134 } u;
135
136 if (cb) {
137 get_user(u.dw, cb);
138 u.bits.istatus = CBS_ACTIVE;
139 put_user(u.dw, cb);
140 }
141}
142
143/*
144 * Convert a interrupt IRQ to a pointer to the GRU GTS that caused the
145 * interrupt. Interrupts are always sent to a cpu on the blade that contains the
146 * GRU (except for headless blades which are not currently supported). A blade
147 * has N grus; a block of N consecutive IRQs is assigned to the GRUs. The IRQ
148 * number uniquely identifies the GRU chiplet on the local blade that caused the
149 * interrupt. Always called in interrupt context.
150 */
151static inline struct gru_state *irq_to_gru(int irq)
152{
153 return &gru_base[uv_numa_blade_id()]->bs_grus[irq - IRQ_GRU];
154}
155
156/*
157 * Read & clear a TFM
158 *
159 * The GRU has an array of fault maps. A map is private to a cpu
160 * Only one cpu will be accessing a cpu's fault map.
161 *
162 * This function scans the cpu-private fault map & clears all bits that
163 * are set. The function returns a bitmap that indicates the bits that
164 * were cleared. Note that sense the maps may be updated asynchronously by
165 * the GRU, atomic operations must be used to clear bits.
166 */
167static void get_clear_fault_map(struct gru_state *gru,
168 struct gru_tlb_fault_map *map)
169{
170 unsigned long i, k;
171 struct gru_tlb_fault_map *tfm;
172
173 tfm = get_tfm_for_cpu(gru, gru_cpu_fault_map_id());
174 prefetchw(tfm); /* Helps on hardware, required for emulator */
175 for (i = 0; i < BITS_TO_LONGS(GRU_NUM_CBE); i++) {
176 k = tfm->fault_bits[i];
177 if (k)
178 k = xchg(&tfm->fault_bits[i], 0UL);
179 map->fault_bits[i] = k;
180 }
181
182 /*
183 * Not functionally required but helps performance. (Required
184 * on emulator)
185 */
186 gru_flush_cache(tfm);
187}
188
189/*
190 * Atomic (interrupt context) & non-atomic (user context) functions to
191 * convert a vaddr into a physical address. The size of the page
192 * is returned in pageshift.
193 * returns:
194 * 0 - successful
195 * < 0 - error code
196 * 1 - (atomic only) try again in non-atomic context
197 */
198static int non_atomic_pte_lookup(struct vm_area_struct *vma,
199 unsigned long vaddr, int write,
200 unsigned long *paddr, int *pageshift)
201{
202 struct page *page;
203
204 /* ZZZ Need to handle HUGE pages */
205 if (is_vm_hugetlb_page(vma))
206 return -EFAULT;
207 *pageshift = PAGE_SHIFT;
208 if (get_user_pages
209 (current, current->mm, vaddr, 1, write, 0, &page, NULL) <= 0)
210 return -EFAULT;
211 *paddr = page_to_phys(page);
212 put_page(page);
213 return 0;
214}
215
216/*
217 *
218 * atomic_pte_lookup
219 *
220 * Convert a user virtual address to a physical address
221 * Only supports Intel large pages (2MB only) on x86_64.
222 * ZZZ - hugepage support is incomplete
223 */
224static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr,
225 int write, unsigned long *paddr, int *pageshift)
226{
227 pgd_t *pgdp;
228 pmd_t *pmdp;
229 pud_t *pudp;
230 pte_t pte;
231
232 WARN_ON(irqs_disabled()); /* ZZZ debug */
233
234 local_irq_disable();
235 pgdp = pgd_offset(vma->vm_mm, vaddr);
236 if (unlikely(pgd_none(*pgdp)))
237 goto err;
238
239 pudp = pud_offset(pgdp, vaddr);
240 if (unlikely(pud_none(*pudp)))
241 goto err;
242
243 pmdp = pmd_offset(pudp, vaddr);
244 if (unlikely(pmd_none(*pmdp)))
245 goto err;
246#ifdef CONFIG_X86_64
247 if (unlikely(pmd_large(*pmdp)))
248 pte = *(pte_t *) pmdp;
249 else
250#endif
251 pte = *pte_offset_kernel(pmdp, vaddr);
252
253 local_irq_enable();
254
255 if (unlikely(!pte_present(pte) ||
256 (write && (!pte_write(pte) || !pte_dirty(pte)))))
257 return 1;
258
259 *paddr = pte_pfn(pte) << PAGE_SHIFT;
260 *pageshift = is_vm_hugetlb_page(vma) ? HPAGE_SHIFT : PAGE_SHIFT;
261 return 0;
262
263err:
264 local_irq_enable();
265 return 1;
266}
267
268/*
269 * Drop a TLB entry into the GRU. The fault is described by info in an TFH.
270 * Input:
271 * cb Address of user CBR. Null if not running in user context
272 * Return:
273 * 0 = dropin, exception, or switch to UPM successful
274 * 1 = range invalidate active
275 * < 0 = error code
276 *
277 */
278static int gru_try_dropin(struct gru_thread_state *gts,
279 struct gru_tlb_fault_handle *tfh,
280 unsigned long __user *cb)
281{
282 struct mm_struct *mm = gts->ts_mm;
283 struct vm_area_struct *vma;
284 int pageshift, asid, write, ret;
285 unsigned long paddr, gpa, vaddr;
286
287 /*
288 * NOTE: The GRU contains magic hardware that eliminates races between
289 * TLB invalidates and TLB dropins. If an invalidate occurs
290 * in the window between reading the TFH and the subsequent TLB dropin,
291 * the dropin is ignored. This eliminates the need for additional locks.
292 */
293
294 /*
295 * Error if TFH state is IDLE or FMM mode & the user issuing a UPM call.
296 * Might be a hardware race OR a stupid user. Ignore FMM because FMM
297 * is a transient state.
298 */
299 if (tfh->state == TFHSTATE_IDLE)
300 goto failidle;
301 if (tfh->state == TFHSTATE_MISS_FMM && cb)
302 goto failfmm;
303
304 write = (tfh->cause & TFHCAUSE_TLB_MOD) != 0;
305 vaddr = tfh->missvaddr;
306 asid = tfh->missasid;
307 if (asid == 0)
308 goto failnoasid;
309
310 rmb(); /* TFH must be cache resident before reading ms_range_active */
311
312 /*
313 * TFH is cache resident - at least briefly. Fail the dropin
314 * if a range invalidate is active.
315 */
316 if (atomic_read(&gts->ts_gms->ms_range_active))
317 goto failactive;
318
319 vma = find_vma(mm, vaddr);
320 if (!vma)
321 goto failinval;
322
323 /*
324 * Atomic lookup is faster & usually works even if called in non-atomic
325 * context.
326 */
327 ret = atomic_pte_lookup(vma, vaddr, write, &paddr, &pageshift);
328 if (ret) {
329 if (!cb)
330 goto failupm;
331 if (non_atomic_pte_lookup(vma, vaddr, write, &paddr,
332 &pageshift))
333 goto failinval;
334 }
335 if (is_gru_paddr(paddr))
336 goto failinval;
337
338 paddr = paddr & ~((1UL << pageshift) - 1);
339 gpa = uv_soc_phys_ram_to_gpa(paddr);
340 gru_cb_set_istatus_active(cb);
341 tfh_write_restart(tfh, gpa, GAA_RAM, vaddr, asid, write,
342 GRU_PAGESIZE(pageshift));
343 STAT(tlb_dropin);
344 gru_dbg(grudev,
345 "%s: tfh 0x%p, vaddr 0x%lx, asid 0x%x, ps %d, gpa 0x%lx\n",
346 ret ? "non-atomic" : "atomic", tfh, vaddr, asid,
347 pageshift, gpa);
348 return 0;
349
350failnoasid:
351 /* No asid (delayed unload). */
352 STAT(tlb_dropin_fail_no_asid);
353 gru_dbg(grudev, "FAILED no_asid tfh: 0x%p, vaddr 0x%lx\n", tfh, vaddr);
354 if (!cb)
355 tfh_user_polling_mode(tfh);
356 else
357 gru_flush_cache(tfh);
358 return -EAGAIN;
359
360failupm:
361 /* Atomic failure switch CBR to UPM */
362 tfh_user_polling_mode(tfh);
363 STAT(tlb_dropin_fail_upm);
364 gru_dbg(grudev, "FAILED upm tfh: 0x%p, vaddr 0x%lx\n", tfh, vaddr);
365 return 1;
366
367failfmm:
368 /* FMM state on UPM call */
369 STAT(tlb_dropin_fail_fmm);
370 gru_dbg(grudev, "FAILED fmm tfh: 0x%p, state %d\n", tfh, tfh->state);
371 return 0;
372
373failidle:
374 /* TFH was idle - no miss pending */
375 gru_flush_cache(tfh);
376 if (cb)
377 gru_flush_cache(cb);
378 STAT(tlb_dropin_fail_idle);
379 gru_dbg(grudev, "FAILED idle tfh: 0x%p, state %d\n", tfh, tfh->state);
380 return 0;
381
382failinval:
383 /* All errors (atomic & non-atomic) switch CBR to EXCEPTION state */
384 tfh_exception(tfh);
385 STAT(tlb_dropin_fail_invalid);
386 gru_dbg(grudev, "FAILED inval tfh: 0x%p, vaddr 0x%lx\n", tfh, vaddr);
387 return -EFAULT;
388
389failactive:
390 /* Range invalidate active. Switch to UPM iff atomic */
391 if (!cb)
392 tfh_user_polling_mode(tfh);
393 else
394 gru_flush_cache(tfh);
395 STAT(tlb_dropin_fail_range_active);
396 gru_dbg(grudev, "FAILED range active: tfh 0x%p, vaddr 0x%lx\n",
397 tfh, vaddr);
398 return 1;
399}
400
401/*
402 * Process an external interrupt from the GRU. This interrupt is
403 * caused by a TLB miss.
404 * Note that this is the interrupt handler that is registered with linux
405 * interrupt handlers.
406 */
407irqreturn_t gru_intr(int irq, void *dev_id)
408{
409 struct gru_state *gru;
410 struct gru_tlb_fault_map map;
411 struct gru_thread_state *gts;
412 struct gru_tlb_fault_handle *tfh = NULL;
413 int cbrnum, ctxnum;
414
415 STAT(intr);
416
417 gru = irq_to_gru(irq);
418 if (!gru) {
419 dev_err(grudev, "GRU: invalid interrupt: cpu %d, irq %d\n",
420 raw_smp_processor_id(), irq);
421 return IRQ_NONE;
422 }
423 get_clear_fault_map(gru, &map);
424 gru_dbg(grudev, "irq %d, gru %x, map 0x%lx\n", irq, gru->gs_gid,
425 map.fault_bits[0]);
426
427 for_each_cbr_in_tfm(cbrnum, map.fault_bits) {
428 tfh = get_tfh_by_index(gru, cbrnum);
429 prefetchw(tfh); /* Helps on hdw, required for emulator */
430
431 /*
432 * When hardware sets a bit in the faultmap, it implicitly
433 * locks the GRU context so that it cannot be unloaded.
434 * The gts cannot change until a TFH start/writestart command
435 * is issued.
436 */
437 ctxnum = tfh->ctxnum;
438 gts = gru->gs_gts[ctxnum];
439
440 /*
441 * This is running in interrupt context. Trylock the mmap_sem.
442 * If it fails, retry the fault in user context.
443 */
444 if (down_read_trylock(&gts->ts_mm->mmap_sem)) {
445 gru_try_dropin(gts, tfh, NULL);
446 up_read(&gts->ts_mm->mmap_sem);
447 } else {
448 tfh_user_polling_mode(tfh);
449 }
450 }
451 return IRQ_HANDLED;
452}
453
454
455static int gru_user_dropin(struct gru_thread_state *gts,
456 struct gru_tlb_fault_handle *tfh,
457 unsigned long __user *cb)
458{
459 struct gru_mm_struct *gms = gts->ts_gms;
460 int ret;
461
462 while (1) {
463 wait_event(gms->ms_wait_queue,
464 atomic_read(&gms->ms_range_active) == 0);
465 prefetchw(tfh); /* Helps on hdw, required for emulator */
466 ret = gru_try_dropin(gts, tfh, cb);
467 if (ret <= 0)
468 return ret;
469 STAT(call_os_wait_queue);
470 }
471}
472
473/*
474 * This interface is called as a result of a user detecting a "call OS" bit
475 * in a user CB. Normally means that a TLB fault has occurred.
476 * cb - user virtual address of the CB
477 */
478int gru_handle_user_call_os(unsigned long cb)
479{
480 struct gru_tlb_fault_handle *tfh;
481 struct gru_thread_state *gts;
482 unsigned long __user *cbp;
483 int ucbnum, cbrnum, ret = -EINVAL;
484
485 STAT(call_os);
486 gru_dbg(grudev, "address 0x%lx\n", cb);
487
488 /* sanity check the cb pointer */
489 ucbnum = get_cb_number((void *)cb);
490 if ((cb & (GRU_HANDLE_STRIDE - 1)) || ucbnum >= GRU_NUM_CB)
491 return -EINVAL;
492 cbp = (unsigned long *)cb;
493
494 gts = gru_find_lock_gts(cb);
495 if (!gts)
496 return -EINVAL;
497
498 if (ucbnum >= gts->ts_cbr_au_count * GRU_CBR_AU_SIZE) {
499 ret = -EINVAL;
500 goto exit;
501 }
502
503 /*
504 * If force_unload is set, the UPM TLB fault is phony. The task
505 * has migrated to another node and the GSEG must be moved. Just
506 * unload the context. The task will page fault and assign a new
507 * context.
508 */
509 ret = -EAGAIN;
510 cbrnum = thread_cbr_number(gts, ucbnum);
511 if (gts->ts_force_unload) {
512 gru_unload_context(gts, 1);
513 } else if (gts->ts_gru) {
514 tfh = get_tfh_by_index(gts->ts_gru, cbrnum);
515 ret = gru_user_dropin(gts, tfh, cbp);
516 }
517exit:
518 gru_unlock_gts(gts);
519 return ret;
520}
521
522/*
523 * Fetch the exception detail information for a CB that terminated with
524 * an exception.
525 */
526int gru_get_exception_detail(unsigned long arg)
527{
528 struct control_block_extended_exc_detail excdet;
529 struct gru_control_block_extended *cbe;
530 struct gru_thread_state *gts;
531 int ucbnum, cbrnum, ret;
532
533 STAT(user_exception);
534 if (copy_from_user(&excdet, (void __user *)arg, sizeof(excdet)))
535 return -EFAULT;
536
537 gru_dbg(grudev, "address 0x%lx\n", excdet.cb);
538 gts = gru_find_lock_gts(excdet.cb);
539 if (!gts)
540 return -EINVAL;
541
542 if (gts->ts_gru) {
543 ucbnum = get_cb_number((void *)excdet.cb);
544 cbrnum = thread_cbr_number(gts, ucbnum);
545 cbe = get_cbe_by_index(gts->ts_gru, cbrnum);
546 excdet.opc = cbe->opccpy;
547 excdet.exopc = cbe->exopccpy;
548 excdet.ecause = cbe->ecause;
549 excdet.exceptdet0 = cbe->idef1upd;
550 excdet.exceptdet1 = cbe->idef3upd;
551 ret = 0;
552 } else {
553 ret = -EAGAIN;
554 }
555 gru_unlock_gts(gts);
556
557 gru_dbg(grudev, "address 0x%lx, ecause 0x%x\n", excdet.cb,
558 excdet.ecause);
559 if (!ret && copy_to_user((void __user *)arg, &excdet, sizeof(excdet)))
560 ret = -EFAULT;
561 return ret;
562}
563
564/*
565 * User request to unload a context. Content is saved for possible reload.
566 */
567int gru_user_unload_context(unsigned long arg)
568{
569 struct gru_thread_state *gts;
570 struct gru_unload_context_req req;
571
572 STAT(user_unload_context);
573 if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
574 return -EFAULT;
575
576 gru_dbg(grudev, "gseg 0x%lx\n", req.gseg);
577
578 gts = gru_find_lock_gts(req.gseg);
579 if (!gts)
580 return -EINVAL;
581
582 if (gts->ts_gru)
583 gru_unload_context(gts, 1);
584 gru_unlock_gts(gts);
585
586 return 0;
587}
588
589/*
590 * User request to flush a range of virtual addresses from the GRU TLB
591 * (Mainly for testing).
592 */
593int gru_user_flush_tlb(unsigned long arg)
594{
595 struct gru_thread_state *gts;
596 struct gru_flush_tlb_req req;
597
598 STAT(user_flush_tlb);
599 if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
600 return -EFAULT;
601
602 gru_dbg(grudev, "gseg 0x%lx, vaddr 0x%lx, len 0x%lx\n", req.gseg,
603 req.vaddr, req.len);
604
605 gts = gru_find_lock_gts(req.gseg);
606 if (!gts)
607 return -EINVAL;
608
609 gru_flush_tlb_range(gts->ts_gms, req.vaddr, req.vaddr + req.len);
610 gru_unlock_gts(gts);
611
612 return 0;
613}
614
615/*
616 * Register the current task as the user of the GSEG slice.
617 * Needed for TLB fault interrupt targeting.
618 */
619int gru_set_task_slice(long address)
620{
621 struct gru_thread_state *gts;
622
623 STAT(set_task_slice);
624 gru_dbg(grudev, "address 0x%lx\n", address);
625 gts = gru_alloc_locked_gts(address);
626 if (!gts)
627 return -EINVAL;
628
629 gts->ts_tgid_owner = current->tgid;
630 gru_unlock_gts(gts);
631
632 return 0;
633}
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c
new file mode 100644
index 000000000000..23c91f5f6b61
--- /dev/null
+++ b/drivers/misc/sgi-gru/grufile.c
@@ -0,0 +1,485 @@
1/*
2 * SN Platform GRU Driver
3 *
4 * FILE OPERATIONS & DRIVER INITIALIZATION
5 *
6 * This file supports the user system call for file open, close, mmap, etc.
7 * This also incudes the driver initialization code.
8 *
9 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26#include <linux/module.h>
27#include <linux/kernel.h>
28#include <linux/errno.h>
29#include <linux/slab.h>
30#include <linux/mm.h>
31#include <linux/io.h>
32#include <linux/smp_lock.h>
33#include <linux/spinlock.h>
34#include <linux/device.h>
35#include <linux/miscdevice.h>
36#include <linux/interrupt.h>
37#include <linux/proc_fs.h>
38#include <linux/uaccess.h>
39#include "gru.h"
40#include "grulib.h"
41#include "grutables.h"
42
43#if defined CONFIG_X86_64
44#include <asm/genapic.h>
45#include <asm/irq.h>
46#define IS_UV() is_uv_system()
47#elif defined CONFIG_IA64
48#include <asm/system.h>
49#include <asm/sn/simulator.h>
50/* temp support for running on hardware simulator */
51#define IS_UV() IS_MEDUSA() || ia64_platform_is("uv")
52#else
53#define IS_UV() 0
54#endif
55
56#include <asm/uv/uv_hub.h>
57#include <asm/uv/uv_mmrs.h>
58
59struct gru_blade_state *gru_base[GRU_MAX_BLADES] __read_mostly;
60unsigned long gru_start_paddr, gru_end_paddr __read_mostly;
61struct gru_stats_s gru_stats;
62
63/* Guaranteed user available resources on each node */
64static int max_user_cbrs, max_user_dsr_bytes;
65
66static struct file_operations gru_fops;
67static struct miscdevice gru_miscdev;
68
69
70/*
71 * gru_vma_close
72 *
73 * Called when unmapping a device mapping. Frees all gru resources
74 * and tables belonging to the vma.
75 */
76static void gru_vma_close(struct vm_area_struct *vma)
77{
78 struct gru_vma_data *vdata;
79 struct gru_thread_state *gts;
80 struct list_head *entry, *next;
81
82 if (!vma->vm_private_data)
83 return;
84
85 vdata = vma->vm_private_data;
86 vma->vm_private_data = NULL;
87 gru_dbg(grudev, "vma %p, file %p, vdata %p\n", vma, vma->vm_file,
88 vdata);
89 list_for_each_safe(entry, next, &vdata->vd_head) {
90 gts =
91 list_entry(entry, struct gru_thread_state, ts_next);
92 list_del(&gts->ts_next);
93 mutex_lock(&gts->ts_ctxlock);
94 if (gts->ts_gru)
95 gru_unload_context(gts, 0);
96 mutex_unlock(&gts->ts_ctxlock);
97 gts_drop(gts);
98 }
99 kfree(vdata);
100 STAT(vdata_free);
101}
102
103/*
104 * gru_file_mmap
105 *
106 * Called when mmaping the device. Initializes the vma with a fault handler
107 * and private data structure necessary to allocate, track, and free the
108 * underlying pages.
109 */
110static int gru_file_mmap(struct file *file, struct vm_area_struct *vma)
111{
112 if ((vma->vm_flags & (VM_SHARED | VM_WRITE)) != (VM_SHARED | VM_WRITE))
113 return -EPERM;
114
115 if (vma->vm_start & (GRU_GSEG_PAGESIZE - 1) ||
116 vma->vm_end & (GRU_GSEG_PAGESIZE - 1))
117 return -EINVAL;
118
119 vma->vm_flags |=
120 (VM_IO | VM_DONTCOPY | VM_LOCKED | VM_DONTEXPAND | VM_PFNMAP |
121 VM_RESERVED);
122 vma->vm_page_prot = PAGE_SHARED;
123 vma->vm_ops = &gru_vm_ops;
124
125 vma->vm_private_data = gru_alloc_vma_data(vma, 0);
126 if (!vma->vm_private_data)
127 return -ENOMEM;
128
129 gru_dbg(grudev, "file %p, vaddr 0x%lx, vma %p, vdata %p\n",
130 file, vma->vm_start, vma, vma->vm_private_data);
131 return 0;
132}
133
134/*
135 * Create a new GRU context
136 */
137static int gru_create_new_context(unsigned long arg)
138{
139 struct gru_create_context_req req;
140 struct vm_area_struct *vma;
141 struct gru_vma_data *vdata;
142 int ret = -EINVAL;
143
144
145 if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
146 return -EFAULT;
147
148 if (req.data_segment_bytes == 0 ||
149 req.data_segment_bytes > max_user_dsr_bytes)
150 return -EINVAL;
151 if (!req.control_blocks || !req.maximum_thread_count ||
152 req.control_blocks > max_user_cbrs)
153 return -EINVAL;
154
155 if (!(req.options & GRU_OPT_MISS_MASK))
156 req.options |= GRU_OPT_MISS_FMM_INTR;
157
158 down_write(&current->mm->mmap_sem);
159 vma = gru_find_vma(req.gseg);
160 if (vma) {
161 vdata = vma->vm_private_data;
162 vdata->vd_user_options = req.options;
163 vdata->vd_dsr_au_count =
164 GRU_DS_BYTES_TO_AU(req.data_segment_bytes);
165 vdata->vd_cbr_au_count = GRU_CB_COUNT_TO_AU(req.control_blocks);
166 ret = 0;
167 }
168 up_write(&current->mm->mmap_sem);
169
170 return ret;
171}
172
173/*
174 * Get GRU configuration info (temp - for emulator testing)
175 */
176static long gru_get_config_info(unsigned long arg)
177{
178 struct gru_config_info info;
179 int nodesperblade;
180
181 if (num_online_nodes() > 1 &&
182 (uv_node_to_blade_id(1) == uv_node_to_blade_id(0)))
183 nodesperblade = 2;
184 else
185 nodesperblade = 1;
186 info.cpus = num_online_cpus();
187 info.nodes = num_online_nodes();
188 info.blades = info.nodes / nodesperblade;
189 info.chiplets = GRU_CHIPLETS_PER_BLADE * info.blades;
190
191 if (copy_to_user((void __user *)arg, &info, sizeof(info)))
192 return -EFAULT;
193 return 0;
194}
195
196/*
197 * Get GRU chiplet status
198 */
199static long gru_get_chiplet_status(unsigned long arg)
200{
201 struct gru_state *gru;
202 struct gru_chiplet_info info;
203
204 if (copy_from_user(&info, (void __user *)arg, sizeof(info)))
205 return -EFAULT;
206
207 if (info.node == -1)
208 info.node = numa_node_id();
209 if (info.node >= num_possible_nodes() ||
210 info.chiplet >= GRU_CHIPLETS_PER_HUB ||
211 info.node < 0 || info.chiplet < 0)
212 return -EINVAL;
213
214 info.blade = uv_node_to_blade_id(info.node);
215 gru = get_gru(info.blade, info.chiplet);
216
217 info.total_dsr_bytes = GRU_NUM_DSR_BYTES;
218 info.total_cbr = GRU_NUM_CB;
219 info.total_user_dsr_bytes = GRU_NUM_DSR_BYTES -
220 gru->gs_reserved_dsr_bytes;
221 info.total_user_cbr = GRU_NUM_CB - gru->gs_reserved_cbrs;
222 info.free_user_dsr_bytes = hweight64(gru->gs_dsr_map) *
223 GRU_DSR_AU_BYTES;
224 info.free_user_cbr = hweight64(gru->gs_cbr_map) * GRU_CBR_AU_SIZE;
225
226 if (copy_to_user((void __user *)arg, &info, sizeof(info)))
227 return -EFAULT;
228 return 0;
229}
230
231/*
232 * gru_file_unlocked_ioctl
233 *
234 * Called to update file attributes via IOCTL calls.
235 */
236static long gru_file_unlocked_ioctl(struct file *file, unsigned int req,
237 unsigned long arg)
238{
239 int err = -EBADRQC;
240
241 gru_dbg(grudev, "file %p\n", file);
242
243 switch (req) {
244 case GRU_CREATE_CONTEXT:
245 err = gru_create_new_context(arg);
246 break;
247 case GRU_SET_TASK_SLICE:
248 err = gru_set_task_slice(arg);
249 break;
250 case GRU_USER_GET_EXCEPTION_DETAIL:
251 err = gru_get_exception_detail(arg);
252 break;
253 case GRU_USER_UNLOAD_CONTEXT:
254 err = gru_user_unload_context(arg);
255 break;
256 case GRU_GET_CHIPLET_STATUS:
257 err = gru_get_chiplet_status(arg);
258 break;
259 case GRU_USER_FLUSH_TLB:
260 err = gru_user_flush_tlb(arg);
261 break;
262 case GRU_USER_CALL_OS:
263 err = gru_handle_user_call_os(arg);
264 break;
265 case GRU_GET_CONFIG_INFO:
266 err = gru_get_config_info(arg);
267 break;
268 }
269 return err;
270}
271
272/*
273 * Called at init time to build tables for all GRUs that are present in the
274 * system.
275 */
276static void gru_init_chiplet(struct gru_state *gru, unsigned long paddr,
277 void *vaddr, int nid, int bid, int grunum)
278{
279 spin_lock_init(&gru->gs_lock);
280 spin_lock_init(&gru->gs_asid_lock);
281 gru->gs_gru_base_paddr = paddr;
282 gru->gs_gru_base_vaddr = vaddr;
283 gru->gs_gid = bid * GRU_CHIPLETS_PER_BLADE + grunum;
284 gru->gs_blade = gru_base[bid];
285 gru->gs_blade_id = bid;
286 gru->gs_cbr_map = (GRU_CBR_AU == 64) ? ~0 : (1UL << GRU_CBR_AU) - 1;
287 gru->gs_dsr_map = (1UL << GRU_DSR_AU) - 1;
288 gru_tgh_flush_init(gru);
289 gru_dbg(grudev, "bid %d, nid %d, gru %x, vaddr %p (0x%lx)\n",
290 bid, nid, gru->gs_gid, gru->gs_gru_base_vaddr,
291 gru->gs_gru_base_paddr);
292 gru_kservices_init(gru);
293}
294
295static int gru_init_tables(unsigned long gru_base_paddr, void *gru_base_vaddr)
296{
297 int pnode, nid, bid, chip;
298 int cbrs, dsrbytes, n;
299 int order = get_order(sizeof(struct gru_blade_state));
300 struct page *page;
301 struct gru_state *gru;
302 unsigned long paddr;
303 void *vaddr;
304
305 max_user_cbrs = GRU_NUM_CB;
306 max_user_dsr_bytes = GRU_NUM_DSR_BYTES;
307 for_each_online_node(nid) {
308 bid = uv_node_to_blade_id(nid);
309 pnode = uv_node_to_pnode(nid);
310 if (gru_base[bid])
311 continue;
312 page = alloc_pages_node(nid, GFP_KERNEL, order);
313 if (!page)
314 goto fail;
315 gru_base[bid] = page_address(page);
316 memset(gru_base[bid], 0, sizeof(struct gru_blade_state));
317 gru_base[bid]->bs_lru_gru = &gru_base[bid]->bs_grus[0];
318 spin_lock_init(&gru_base[bid]->bs_lock);
319
320 dsrbytes = 0;
321 cbrs = 0;
322 for (gru = gru_base[bid]->bs_grus, chip = 0;
323 chip < GRU_CHIPLETS_PER_BLADE;
324 chip++, gru++) {
325 paddr = gru_chiplet_paddr(gru_base_paddr, pnode, chip);
326 vaddr = gru_chiplet_vaddr(gru_base_vaddr, pnode, chip);
327 gru_init_chiplet(gru, paddr, vaddr, bid, nid, chip);
328 n = hweight64(gru->gs_cbr_map) * GRU_CBR_AU_SIZE;
329 cbrs = max(cbrs, n);
330 n = hweight64(gru->gs_dsr_map) * GRU_DSR_AU_BYTES;
331 dsrbytes = max(dsrbytes, n);
332 }
333 max_user_cbrs = min(max_user_cbrs, cbrs);
334 max_user_dsr_bytes = min(max_user_dsr_bytes, dsrbytes);
335 }
336
337 return 0;
338
339fail:
340 for (nid--; nid >= 0; nid--)
341 free_pages((unsigned long)gru_base[nid], order);
342 return -ENOMEM;
343}
344
345#ifdef CONFIG_IA64
346
347static int get_base_irq(void)
348{
349 return IRQ_GRU;
350}
351
352#elif defined CONFIG_X86_64
353
354static void noop(unsigned int irq)
355{
356}
357
358static struct irq_chip gru_chip = {
359 .name = "gru",
360 .mask = noop,
361 .unmask = noop,
362 .ack = noop,
363};
364
365static int get_base_irq(void)
366{
367 set_irq_chip(IRQ_GRU, &gru_chip);
368 set_irq_chip(IRQ_GRU + 1, &gru_chip);
369 return IRQ_GRU;
370}
371#endif
372
373/*
374 * gru_init
375 *
376 * Called at boot or module load time to initialize the GRUs.
377 */
378static int __init gru_init(void)
379{
380 int ret, irq, chip;
381 char id[10];
382 void *gru_start_vaddr;
383
384 if (!IS_UV())
385 return 0;
386
387#if defined CONFIG_IA64
388 gru_start_paddr = 0xd000000000UL; /* ZZZZZZZZZZZZZZZZZZZ fixme */
389#else
390 gru_start_paddr = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR) &
391 0x7fffffffffffUL;
392
393#endif
394 gru_start_vaddr = __va(gru_start_paddr);
395 gru_end_paddr = gru_start_paddr + MAX_NUMNODES * GRU_SIZE;
396 printk(KERN_INFO "GRU space: 0x%lx - 0x%lx\n",
397 gru_start_paddr, gru_end_paddr);
398 irq = get_base_irq();
399 for (chip = 0; chip < GRU_CHIPLETS_PER_BLADE; chip++) {
400 ret = request_irq(irq + chip, gru_intr, 0, id, NULL);
401 if (ret) {
402 printk(KERN_ERR "%s: request_irq failed\n",
403 GRU_DRIVER_ID_STR);
404 goto exit1;
405 }
406 }
407
408 ret = misc_register(&gru_miscdev);
409 if (ret) {
410 printk(KERN_ERR "%s: misc_register failed\n",
411 GRU_DRIVER_ID_STR);
412 goto exit1;
413 }
414
415 ret = gru_proc_init();
416 if (ret) {
417 printk(KERN_ERR "%s: proc init failed\n", GRU_DRIVER_ID_STR);
418 goto exit2;
419 }
420
421 ret = gru_init_tables(gru_start_paddr, gru_start_vaddr);
422 if (ret) {
423 printk(KERN_ERR "%s: init tables failed\n", GRU_DRIVER_ID_STR);
424 goto exit3;
425 }
426
427 printk(KERN_INFO "%s: v%s\n", GRU_DRIVER_ID_STR,
428 GRU_DRIVER_VERSION_STR);
429 return 0;
430
431exit3:
432 gru_proc_exit();
433exit2:
434 misc_deregister(&gru_miscdev);
435exit1:
436 for (--chip; chip >= 0; chip--)
437 free_irq(irq + chip, NULL);
438 return ret;
439
440}
441
442static void __exit gru_exit(void)
443{
444 int i, bid;
445 int order = get_order(sizeof(struct gru_state) *
446 GRU_CHIPLETS_PER_BLADE);
447
448 for (i = 0; i < GRU_CHIPLETS_PER_BLADE; i++)
449 free_irq(IRQ_GRU + i, NULL);
450
451 for (bid = 0; bid < GRU_MAX_BLADES; bid++)
452 free_pages((unsigned long)gru_base[bid], order);
453
454 misc_deregister(&gru_miscdev);
455 gru_proc_exit();
456}
457
458static struct file_operations gru_fops = {
459 .owner = THIS_MODULE,
460 .unlocked_ioctl = gru_file_unlocked_ioctl,
461 .mmap = gru_file_mmap,
462};
463
464static struct miscdevice gru_miscdev = {
465 .minor = MISC_DYNAMIC_MINOR,
466 .name = "gru",
467 .fops = &gru_fops,
468};
469
470struct vm_operations_struct gru_vm_ops = {
471 .close = gru_vma_close,
472 .fault = gru_fault,
473};
474
475module_init(gru_init);
476module_exit(gru_exit);
477
478module_param(gru_options, ulong, 0644);
479MODULE_PARM_DESC(gru_options, "Various debug options");
480
481MODULE_AUTHOR("Silicon Graphics, Inc.");
482MODULE_LICENSE("GPL");
483MODULE_DESCRIPTION(GRU_DRIVER_ID_STR GRU_DRIVER_VERSION_STR);
484MODULE_VERSION(GRU_DRIVER_VERSION_STR);
485
diff --git a/drivers/misc/sgi-gru/gruhandles.h b/drivers/misc/sgi-gru/gruhandles.h
new file mode 100644
index 000000000000..d16031d62673
--- /dev/null
+++ b/drivers/misc/sgi-gru/gruhandles.h
@@ -0,0 +1,663 @@
1/*
2 * SN Platform GRU Driver
3 *
4 * GRU HANDLE DEFINITION
5 *
6 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
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#ifndef __GRUHANDLES_H__
24#define __GRUHANDLES_H__
25#include "gru_instructions.h"
26
27/*
28 * Manifest constants for GRU Memory Map
29 */
30#define GRU_GSEG0_BASE 0
31#define GRU_MCS_BASE (64 * 1024 * 1024)
32#define GRU_SIZE (128UL * 1024 * 1024)
33
34/* Handle & resource counts */
35#define GRU_NUM_CB 128
36#define GRU_NUM_DSR_BYTES (32 * 1024)
37#define GRU_NUM_TFM 16
38#define GRU_NUM_TGH 24
39#define GRU_NUM_CBE 128
40#define GRU_NUM_TFH 128
41#define GRU_NUM_CCH 16
42#define GRU_NUM_GSH 1
43
44/* Maximum resource counts that can be reserved by user programs */
45#define GRU_NUM_USER_CBR GRU_NUM_CBE
46#define GRU_NUM_USER_DSR_BYTES GRU_NUM_DSR_BYTES
47
48/* Bytes per handle & handle stride. Code assumes all cb, tfh, cbe handles
49 * are the same */
50#define GRU_HANDLE_BYTES 64
51#define GRU_HANDLE_STRIDE 256
52
53/* Base addresses of handles */
54#define GRU_TFM_BASE (GRU_MCS_BASE + 0x00000)
55#define GRU_TGH_BASE (GRU_MCS_BASE + 0x08000)
56#define GRU_CBE_BASE (GRU_MCS_BASE + 0x10000)
57#define GRU_TFH_BASE (GRU_MCS_BASE + 0x18000)
58#define GRU_CCH_BASE (GRU_MCS_BASE + 0x20000)
59#define GRU_GSH_BASE (GRU_MCS_BASE + 0x30000)
60
61/* User gseg constants */
62#define GRU_GSEG_STRIDE (4 * 1024 * 1024)
63#define GSEG_BASE(a) ((a) & ~(GRU_GSEG_PAGESIZE - 1))
64
65/* Data segment constants */
66#define GRU_DSR_AU_BYTES 1024
67#define GRU_DSR_CL (GRU_NUM_DSR_BYTES / GRU_CACHE_LINE_BYTES)
68#define GRU_DSR_AU_CL (GRU_DSR_AU_BYTES / GRU_CACHE_LINE_BYTES)
69#define GRU_DSR_AU (GRU_NUM_DSR_BYTES / GRU_DSR_AU_BYTES)
70
71/* Control block constants */
72#define GRU_CBR_AU_SIZE 2
73#define GRU_CBR_AU (GRU_NUM_CBE / GRU_CBR_AU_SIZE)
74
75/* Convert resource counts to the number of AU */
76#define GRU_DS_BYTES_TO_AU(n) DIV_ROUND_UP(n, GRU_DSR_AU_BYTES)
77#define GRU_CB_COUNT_TO_AU(n) DIV_ROUND_UP(n, GRU_CBR_AU_SIZE)
78
79/* UV limits */
80#define GRU_CHIPLETS_PER_HUB 2
81#define GRU_HUBS_PER_BLADE 1
82#define GRU_CHIPLETS_PER_BLADE (GRU_HUBS_PER_BLADE * GRU_CHIPLETS_PER_HUB)
83
84/* User GRU Gseg offsets */
85#define GRU_CB_BASE 0
86#define GRU_CB_LIMIT (GRU_CB_BASE + GRU_HANDLE_STRIDE * GRU_NUM_CBE)
87#define GRU_DS_BASE 0x20000
88#define GRU_DS_LIMIT (GRU_DS_BASE + GRU_NUM_DSR_BYTES)
89
90/* Convert a GRU physical address to the chiplet offset */
91#define GSEGPOFF(h) ((h) & (GRU_SIZE - 1))
92
93/* Convert an arbitrary handle address to the beginning of the GRU segment */
94#ifndef __PLUGIN__
95#define GRUBASE(h) ((void *)((unsigned long)(h) & ~(GRU_SIZE - 1)))
96#else
97extern void *gmu_grubase(void *h);
98#define GRUBASE(h) gmu_grubase(h)
99#endif
100
101/* General addressing macros. */
102static inline void *get_gseg_base_address(void *base, int ctxnum)
103{
104 return (void *)(base + GRU_GSEG0_BASE + GRU_GSEG_STRIDE * ctxnum);
105}
106
107static inline void *get_gseg_base_address_cb(void *base, int ctxnum, int line)
108{
109 return (void *)(get_gseg_base_address(base, ctxnum) +
110 GRU_CB_BASE + GRU_HANDLE_STRIDE * line);
111}
112
113static inline void *get_gseg_base_address_ds(void *base, int ctxnum, int line)
114{
115 return (void *)(get_gseg_base_address(base, ctxnum) + GRU_DS_BASE +
116 GRU_CACHE_LINE_BYTES * line);
117}
118
119static inline struct gru_tlb_fault_map *get_tfm(void *base, int ctxnum)
120{
121 return (struct gru_tlb_fault_map *)(base + GRU_TFM_BASE +
122 ctxnum * GRU_HANDLE_STRIDE);
123}
124
125static inline struct gru_tlb_global_handle *get_tgh(void *base, int ctxnum)
126{
127 return (struct gru_tlb_global_handle *)(base + GRU_TGH_BASE +
128 ctxnum * GRU_HANDLE_STRIDE);
129}
130
131static inline struct gru_control_block_extended *get_cbe(void *base, int ctxnum)
132{
133 return (struct gru_control_block_extended *)(base + GRU_CBE_BASE +
134 ctxnum * GRU_HANDLE_STRIDE);
135}
136
137static inline struct gru_tlb_fault_handle *get_tfh(void *base, int ctxnum)
138{
139 return (struct gru_tlb_fault_handle *)(base + GRU_TFH_BASE +
140 ctxnum * GRU_HANDLE_STRIDE);
141}
142
143static inline struct gru_context_configuration_handle *get_cch(void *base,
144 int ctxnum)
145{
146 return (struct gru_context_configuration_handle *)(base +
147 GRU_CCH_BASE + ctxnum * GRU_HANDLE_STRIDE);
148}
149
150static inline unsigned long get_cb_number(void *cb)
151{
152 return (((unsigned long)cb - GRU_CB_BASE) % GRU_GSEG_PAGESIZE) /
153 GRU_HANDLE_STRIDE;
154}
155
156/* byte offset to a specific GRU chiplet. (p=pnode, c=chiplet (0 or 1)*/
157static inline unsigned long gru_chiplet_paddr(unsigned long paddr, int pnode,
158 int chiplet)
159{
160 return paddr + GRU_SIZE * (2 * pnode + chiplet);
161}
162
163static inline void *gru_chiplet_vaddr(void *vaddr, int pnode, int chiplet)
164{
165 return vaddr + GRU_SIZE * (2 * pnode + chiplet);
166}
167
168
169
170/*
171 * Global TLB Fault Map
172 * Bitmap of outstanding TLB misses needing interrupt/polling service.
173 *
174 */
175struct gru_tlb_fault_map {
176 unsigned long fault_bits[BITS_TO_LONGS(GRU_NUM_CBE)];
177 unsigned long fill0[2];
178 unsigned long done_bits[BITS_TO_LONGS(GRU_NUM_CBE)];
179 unsigned long fill1[2];
180};
181
182/*
183 * TGH - TLB Global Handle
184 * Used for TLB flushing.
185 *
186 */
187struct gru_tlb_global_handle {
188 unsigned int cmd:1; /* DW 0 */
189 unsigned int delresp:1;
190 unsigned int opc:1;
191 unsigned int fill1:5;
192
193 unsigned int fill2:8;
194
195 unsigned int status:2;
196 unsigned long fill3:2;
197 unsigned int state:3;
198 unsigned long fill4:1;
199
200 unsigned int cause:3;
201 unsigned long fill5:37;
202
203 unsigned long vaddr:64; /* DW 1 */
204
205 unsigned int asid:24; /* DW 2 */
206 unsigned int fill6:8;
207
208 unsigned int pagesize:5;
209 unsigned int fill7:11;
210
211 unsigned int global:1;
212 unsigned int fill8:15;
213
214 unsigned long vaddrmask:39; /* DW 3 */
215 unsigned int fill9:9;
216 unsigned int n:10;
217 unsigned int fill10:6;
218
219 unsigned int ctxbitmap:16; /* DW4 */
220 unsigned long fill11[3];
221};
222
223enum gru_tgh_cmd {
224 TGHCMD_START
225};
226
227enum gru_tgh_opc {
228 TGHOP_TLBNOP,
229 TGHOP_TLBINV
230};
231
232enum gru_tgh_status {
233 TGHSTATUS_IDLE,
234 TGHSTATUS_EXCEPTION,
235 TGHSTATUS_ACTIVE
236};
237
238enum gru_tgh_state {
239 TGHSTATE_IDLE,
240 TGHSTATE_PE_INVAL,
241 TGHSTATE_INTERRUPT_INVAL,
242 TGHSTATE_WAITDONE,
243 TGHSTATE_RESTART_CTX,
244};
245
246/*
247 * TFH - TLB Global Handle
248 * Used for TLB dropins into the GRU TLB.
249 *
250 */
251struct gru_tlb_fault_handle {
252 unsigned int cmd:1; /* DW 0 - low 32*/
253 unsigned int delresp:1;
254 unsigned int fill0:2;
255 unsigned int opc:3;
256 unsigned int fill1:9;
257
258 unsigned int status:2;
259 unsigned int fill2:1;
260 unsigned int color:1;
261 unsigned int state:3;
262 unsigned int fill3:1;
263
264 unsigned int cause:7; /* DW 0 - high 32 */
265 unsigned int fill4:1;
266
267 unsigned int indexway:12;
268 unsigned int fill5:4;
269
270 unsigned int ctxnum:4;
271 unsigned int fill6:12;
272
273 unsigned long missvaddr:64; /* DW 1 */
274
275 unsigned int missasid:24; /* DW 2 */
276 unsigned int fill7:8;
277 unsigned int fillasid:24;
278 unsigned int dirty:1;
279 unsigned int gaa:2;
280 unsigned long fill8:5;
281
282 unsigned long pfn:41; /* DW 3 */
283 unsigned int fill9:7;
284 unsigned int pagesize:5;
285 unsigned int fill10:11;
286
287 unsigned long fillvaddr:64; /* DW 4 */
288
289 unsigned long fill11[3];
290};
291
292enum gru_tfh_opc {
293 TFHOP_NOOP,
294 TFHOP_RESTART,
295 TFHOP_WRITE_ONLY,
296 TFHOP_WRITE_RESTART,
297 TFHOP_EXCEPTION,
298 TFHOP_USER_POLLING_MODE = 7,
299};
300
301enum tfh_status {
302 TFHSTATUS_IDLE,
303 TFHSTATUS_EXCEPTION,
304 TFHSTATUS_ACTIVE,
305};
306
307enum tfh_state {
308 TFHSTATE_INACTIVE,
309 TFHSTATE_IDLE,
310 TFHSTATE_MISS_UPM,
311 TFHSTATE_MISS_FMM,
312 TFHSTATE_HW_ERR,
313 TFHSTATE_WRITE_TLB,
314 TFHSTATE_RESTART_CBR,
315};
316
317/* TFH cause bits */
318enum tfh_cause {
319 TFHCAUSE_NONE,
320 TFHCAUSE_TLB_MISS,
321 TFHCAUSE_TLB_MOD,
322 TFHCAUSE_HW_ERROR_RR,
323 TFHCAUSE_HW_ERROR_MAIN_ARRAY,
324 TFHCAUSE_HW_ERROR_VALID,
325 TFHCAUSE_HW_ERROR_PAGESIZE,
326 TFHCAUSE_INSTRUCTION_EXCEPTION,
327 TFHCAUSE_UNCORRECTIBLE_ERROR,
328};
329
330/* GAA values */
331#define GAA_RAM 0x0
332#define GAA_NCRAM 0x2
333#define GAA_MMIO 0x1
334#define GAA_REGISTER 0x3
335
336/* GRU paddr shift for pfn. (NOTE: shift is NOT by actual pagesize) */
337#define GRU_PADDR_SHIFT 12
338
339/*
340 * Context Configuration handle
341 * Used to allocate resources to a GSEG context.
342 *
343 */
344struct gru_context_configuration_handle {
345 unsigned int cmd:1; /* DW0 */
346 unsigned int delresp:1;
347 unsigned int opc:3;
348 unsigned int unmap_enable:1;
349 unsigned int req_slice_set_enable:1;
350 unsigned int req_slice:2;
351 unsigned int cb_int_enable:1;
352 unsigned int tlb_int_enable:1;
353 unsigned int tfm_fault_bit_enable:1;
354 unsigned int tlb_int_select:4;
355
356 unsigned int status:2;
357 unsigned int state:2;
358 unsigned int reserved2:4;
359
360 unsigned int cause:4;
361 unsigned int tfm_done_bit_enable:1;
362 unsigned int unused:3;
363
364 unsigned int dsr_allocation_map;
365
366 unsigned long cbr_allocation_map; /* DW1 */
367
368 unsigned int asid[8]; /* DW 2 - 5 */
369 unsigned short sizeavail[8]; /* DW 6 - 7 */
370} __attribute__ ((packed));
371
372enum gru_cch_opc {
373 CCHOP_START = 1,
374 CCHOP_ALLOCATE,
375 CCHOP_INTERRUPT,
376 CCHOP_DEALLOCATE,
377 CCHOP_INTERRUPT_SYNC,
378};
379
380enum gru_cch_status {
381 CCHSTATUS_IDLE,
382 CCHSTATUS_EXCEPTION,
383 CCHSTATUS_ACTIVE,
384};
385
386enum gru_cch_state {
387 CCHSTATE_INACTIVE,
388 CCHSTATE_MAPPED,
389 CCHSTATE_ACTIVE,
390 CCHSTATE_INTERRUPTED,
391};
392
393/* CCH Exception cause */
394enum gru_cch_cause {
395 CCHCAUSE_REGION_REGISTER_WRITE_ERROR = 1,
396 CCHCAUSE_ILLEGAL_OPCODE = 2,
397 CCHCAUSE_INVALID_START_REQUEST = 3,
398 CCHCAUSE_INVALID_ALLOCATION_REQUEST = 4,
399 CCHCAUSE_INVALID_DEALLOCATION_REQUEST = 5,
400 CCHCAUSE_INVALID_INTERRUPT_REQUEST = 6,
401 CCHCAUSE_CCH_BUSY = 7,
402 CCHCAUSE_NO_CBRS_TO_ALLOCATE = 8,
403 CCHCAUSE_BAD_TFM_CONFIG = 9,
404 CCHCAUSE_CBR_RESOURCES_OVERSUBSCRIPED = 10,
405 CCHCAUSE_DSR_RESOURCES_OVERSUBSCRIPED = 11,
406 CCHCAUSE_CBR_DEALLOCATION_ERROR = 12,
407};
408/*
409 * CBE - Control Block Extended
410 * Maintains internal GRU state for active CBs.
411 *
412 */
413struct gru_control_block_extended {
414 unsigned int reserved0:1; /* DW 0 - low */
415 unsigned int imacpy:3;
416 unsigned int reserved1:4;
417 unsigned int xtypecpy:3;
418 unsigned int iaa0cpy:2;
419 unsigned int iaa1cpy:2;
420 unsigned int reserved2:1;
421 unsigned int opccpy:8;
422 unsigned int exopccpy:8;
423
424 unsigned int idef2cpy:22; /* DW 0 - high */
425 unsigned int reserved3:10;
426
427 unsigned int idef4cpy:22; /* DW 1 */
428 unsigned int reserved4:10;
429 unsigned int idef4upd:22;
430 unsigned int reserved5:10;
431
432 unsigned long idef1upd:64; /* DW 2 */
433
434 unsigned long idef5cpy:64; /* DW 3 */
435
436 unsigned long idef6cpy:64; /* DW 4 */
437
438 unsigned long idef3upd:64; /* DW 5 */
439
440 unsigned long idef5upd:64; /* DW 6 */
441
442 unsigned int idef2upd:22; /* DW 7 */
443 unsigned int reserved6:10;
444
445 unsigned int ecause:20;
446 unsigned int cbrstate:4;
447 unsigned int cbrexecstatus:8;
448};
449
450enum gru_cbr_state {
451 CBRSTATE_INACTIVE,
452 CBRSTATE_IDLE,
453 CBRSTATE_PE_CHECK,
454 CBRSTATE_QUEUED,
455 CBRSTATE_WAIT_RESPONSE,
456 CBRSTATE_INTERRUPTED,
457 CBRSTATE_INTERRUPTED_MISS_FMM,
458 CBRSTATE_BUSY_INTERRUPT_MISS_FMM,
459 CBRSTATE_INTERRUPTED_MISS_UPM,
460 CBRSTATE_BUSY_INTERRUPTED_MISS_UPM,
461 CBRSTATE_REQUEST_ISSUE,
462 CBRSTATE_BUSY_INTERRUPT,
463};
464
465/* CBE cbrexecstatus bits */
466#define CBR_EXS_ABORT_OCC_BIT 0
467#define CBR_EXS_INT_OCC_BIT 1
468#define CBR_EXS_PENDING_BIT 2
469#define CBR_EXS_QUEUED_BIT 3
470#define CBR_EXS_TLBHW_BIT 4
471#define CBR_EXS_EXCEPTION_BIT 5
472
473#define CBR_EXS_ABORT_OCC (1 << CBR_EXS_ABORT_OCC_BIT)
474#define CBR_EXS_INT_OCC (1 << CBR_EXS_INT_OCC_BIT)
475#define CBR_EXS_PENDING (1 << CBR_EXS_PENDING_BIT)
476#define CBR_EXS_QUEUED (1 << CBR_EXS_QUEUED_BIT)
477#define CBR_EXS_TLBHW (1 << CBR_EXS_TLBHW_BIT)
478#define CBR_EXS_EXCEPTION (1 << CBR_EXS_EXCEPTION_BIT)
479
480/* CBE ecause bits - defined in gru_instructions.h */
481
482/*
483 * Convert a processor pagesize into the strange encoded pagesize used by the
484 * GRU. Processor pagesize is encoded as log of bytes per page. (or PAGE_SHIFT)
485 * pagesize log pagesize grupagesize
486 * 4k 12 0
487 * 16k 14 1
488 * 64k 16 2
489 * 256k 18 3
490 * 1m 20 4
491 * 2m 21 5
492 * 4m 22 6
493 * 16m 24 7
494 * 64m 26 8
495 * ...
496 */
497#define GRU_PAGESIZE(sh) ((((sh) > 20 ? (sh) + 2: (sh)) >> 1) - 6)
498#define GRU_SIZEAVAIL(sh) (1UL << GRU_PAGESIZE(sh))
499
500/* minimum TLB purge count to ensure a full purge */
501#define GRUMAXINVAL 1024UL
502
503
504/* Extract the status field from a kernel handle */
505#define GET_MSEG_HANDLE_STATUS(h) (((*(unsigned long *)(h)) >> 16) & 3)
506
507static inline void start_instruction(void *h)
508{
509 unsigned long *w0 = h;
510
511 wmb(); /* setting CMD bit must be last */
512 *w0 = *w0 | 1;
513 gru_flush_cache(h);
514}
515
516static inline int wait_instruction_complete(void *h)
517{
518 int status;
519
520 do {
521 cpu_relax();
522 barrier();
523 status = GET_MSEG_HANDLE_STATUS(h);
524 } while (status == CCHSTATUS_ACTIVE);
525 return status;
526}
527
528#if defined CONFIG_IA64
529static inline void cch_allocate_set_asids(
530 struct gru_context_configuration_handle *cch, int asidval)
531{
532 int i;
533
534 for (i = 0; i <= RGN_HPAGE; i++) { /* assume HPAGE is last region */
535 cch->asid[i] = (asidval++);
536#if 0
537 /* ZZZ hugepages not supported yet */
538 if (i == RGN_HPAGE)
539 cch->sizeavail[i] = GRU_SIZEAVAIL(hpage_shift);
540 else
541#endif
542 cch->sizeavail[i] = GRU_SIZEAVAIL(PAGE_SHIFT);
543 }
544}
545#elif defined CONFIG_X86_64
546static inline void cch_allocate_set_asids(
547 struct gru_context_configuration_handle *cch, int asidval)
548{
549 int i;
550
551 for (i = 0; i < 8; i++) {
552 cch->asid[i] = asidval++;
553 cch->sizeavail[i] = GRU_SIZEAVAIL(PAGE_SHIFT) |
554 GRU_SIZEAVAIL(21);
555 }
556}
557#endif
558
559static inline int cch_allocate(struct gru_context_configuration_handle *cch,
560 int asidval, unsigned long cbrmap,
561 unsigned long dsrmap)
562{
563 cch_allocate_set_asids(cch, asidval);
564 cch->dsr_allocation_map = dsrmap;
565 cch->cbr_allocation_map = cbrmap;
566 cch->opc = CCHOP_ALLOCATE;
567 start_instruction(cch);
568 return wait_instruction_complete(cch);
569}
570
571static inline int cch_start(struct gru_context_configuration_handle *cch)
572{
573 cch->opc = CCHOP_START;
574 start_instruction(cch);
575 return wait_instruction_complete(cch);
576}
577
578static inline int cch_interrupt(struct gru_context_configuration_handle *cch)
579{
580 cch->opc = CCHOP_INTERRUPT;
581 start_instruction(cch);
582 return wait_instruction_complete(cch);
583}
584
585static inline int cch_deallocate(struct gru_context_configuration_handle *cch)
586{
587 cch->opc = CCHOP_DEALLOCATE;
588 start_instruction(cch);
589 return wait_instruction_complete(cch);
590}
591
592static inline int cch_interrupt_sync(struct gru_context_configuration_handle
593 *cch)
594{
595 cch->opc = CCHOP_INTERRUPT_SYNC;
596 start_instruction(cch);
597 return wait_instruction_complete(cch);
598}
599
600static inline int tgh_invalidate(struct gru_tlb_global_handle *tgh,
601 unsigned long vaddr, unsigned long vaddrmask,
602 int asid, int pagesize, int global, int n,
603 unsigned short ctxbitmap)
604{
605 tgh->vaddr = vaddr;
606 tgh->asid = asid;
607 tgh->pagesize = pagesize;
608 tgh->n = n;
609 tgh->global = global;
610 tgh->vaddrmask = vaddrmask;
611 tgh->ctxbitmap = ctxbitmap;
612 tgh->opc = TGHOP_TLBINV;
613 start_instruction(tgh);
614 return wait_instruction_complete(tgh);
615}
616
617static inline void tfh_write_only(struct gru_tlb_fault_handle *tfh,
618 unsigned long pfn, unsigned long vaddr,
619 int asid, int dirty, int pagesize)
620{
621 tfh->fillasid = asid;
622 tfh->fillvaddr = vaddr;
623 tfh->pfn = pfn;
624 tfh->dirty = dirty;
625 tfh->pagesize = pagesize;
626 tfh->opc = TFHOP_WRITE_ONLY;
627 start_instruction(tfh);
628}
629
630static inline void tfh_write_restart(struct gru_tlb_fault_handle *tfh,
631 unsigned long paddr, int gaa,
632 unsigned long vaddr, int asid, int dirty,
633 int pagesize)
634{
635 tfh->fillasid = asid;
636 tfh->fillvaddr = vaddr;
637 tfh->pfn = paddr >> GRU_PADDR_SHIFT;
638 tfh->gaa = gaa;
639 tfh->dirty = dirty;
640 tfh->pagesize = pagesize;
641 tfh->opc = TFHOP_WRITE_RESTART;
642 start_instruction(tfh);
643}
644
645static inline void tfh_restart(struct gru_tlb_fault_handle *tfh)
646{
647 tfh->opc = TFHOP_RESTART;
648 start_instruction(tfh);
649}
650
651static inline void tfh_user_polling_mode(struct gru_tlb_fault_handle *tfh)
652{
653 tfh->opc = TFHOP_USER_POLLING_MODE;
654 start_instruction(tfh);
655}
656
657static inline void tfh_exception(struct gru_tlb_fault_handle *tfh)
658{
659 tfh->opc = TFHOP_EXCEPTION;
660 start_instruction(tfh);
661}
662
663#endif /* __GRUHANDLES_H__ */
diff --git a/drivers/misc/sgi-gru/grukservices.c b/drivers/misc/sgi-gru/grukservices.c
new file mode 100644
index 000000000000..dfd49af0fe18
--- /dev/null
+++ b/drivers/misc/sgi-gru/grukservices.c
@@ -0,0 +1,679 @@
1/*
2 * SN Platform GRU Driver
3 *
4 * KERNEL SERVICES THAT USE THE GRU
5 *
6 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
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/kernel.h>
24#include <linux/errno.h>
25#include <linux/slab.h>
26#include <linux/mm.h>
27#include <linux/smp_lock.h>
28#include <linux/spinlock.h>
29#include <linux/device.h>
30#include <linux/miscdevice.h>
31#include <linux/proc_fs.h>
32#include <linux/interrupt.h>
33#include <linux/uaccess.h>
34#include "gru.h"
35#include "grulib.h"
36#include "grutables.h"
37#include "grukservices.h"
38#include "gru_instructions.h"
39#include <asm/uv/uv_hub.h>
40
41/*
42 * Kernel GRU Usage
43 *
44 * The following is an interim algorithm for management of kernel GRU
45 * resources. This will likely be replaced when we better understand the
46 * kernel/user requirements.
47 *
48 * At boot time, the kernel permanently reserves a fixed number of
49 * CBRs/DSRs for each cpu to use. The resources are all taken from
50 * the GRU chiplet 1 on the blade. This leaves the full set of resources
51 * of chiplet 0 available to be allocated to a single user.
52 */
53
54/* Blade percpu resources PERMANENTLY reserved for kernel use */
55#define GRU_NUM_KERNEL_CBR 1
56#define GRU_NUM_KERNEL_DSR_BYTES 256
57#define KERNEL_CTXNUM 15
58
59/* GRU instruction attributes for all instructions */
60#define IMA IMA_CB_DELAY
61
62/* GRU cacheline size is always 64 bytes - even on arches with 128 byte lines */
63#define __gru_cacheline_aligned__ \
64 __attribute__((__aligned__(GRU_CACHE_LINE_BYTES)))
65
66#define MAGIC 0x1234567887654321UL
67
68/* Default retry count for GRU errors on kernel instructions */
69#define EXCEPTION_RETRY_LIMIT 3
70
71/* Status of message queue sections */
72#define MQS_EMPTY 0
73#define MQS_FULL 1
74#define MQS_NOOP 2
75
76/*----------------- RESOURCE MANAGEMENT -------------------------------------*/
77/* optimized for x86_64 */
78struct message_queue {
79 union gru_mesqhead head __gru_cacheline_aligned__; /* CL 0 */
80 int qlines; /* DW 1 */
81 long hstatus[2];
82 void *next __gru_cacheline_aligned__;/* CL 1 */
83 void *limit;
84 void *start;
85 void *start2;
86 char data ____cacheline_aligned; /* CL 2 */
87};
88
89/* First word in every message - used by mesq interface */
90struct message_header {
91 char present;
92 char present2;
93 char lines;
94 char fill;
95};
96
97#define QLINES(mq) ((mq) + offsetof(struct message_queue, qlines))
98#define HSTATUS(mq, h) ((mq) + offsetof(struct message_queue, hstatus[h]))
99
100static int gru_get_cpu_resources(int dsr_bytes, void **cb, void **dsr)
101{
102 struct gru_blade_state *bs;
103 int lcpu;
104
105 BUG_ON(dsr_bytes > GRU_NUM_KERNEL_DSR_BYTES);
106 preempt_disable();
107 bs = gru_base[uv_numa_blade_id()];
108 lcpu = uv_blade_processor_id();
109 *cb = bs->kernel_cb + lcpu * GRU_HANDLE_STRIDE;
110 *dsr = bs->kernel_dsr + lcpu * GRU_NUM_KERNEL_DSR_BYTES;
111 return 0;
112}
113
114static void gru_free_cpu_resources(void *cb, void *dsr)
115{
116 preempt_enable();
117}
118
119int gru_get_cb_exception_detail(void *cb,
120 struct control_block_extended_exc_detail *excdet)
121{
122 struct gru_control_block_extended *cbe;
123
124 cbe = get_cbe(GRUBASE(cb), get_cb_number(cb));
125 excdet->opc = cbe->opccpy;
126 excdet->exopc = cbe->exopccpy;
127 excdet->ecause = cbe->ecause;
128 excdet->exceptdet0 = cbe->idef1upd;
129 excdet->exceptdet1 = cbe->idef3upd;
130 return 0;
131}
132
133char *gru_get_cb_exception_detail_str(int ret, void *cb,
134 char *buf, int size)
135{
136 struct gru_control_block_status *gen = (void *)cb;
137 struct control_block_extended_exc_detail excdet;
138
139 if (ret > 0 && gen->istatus == CBS_EXCEPTION) {
140 gru_get_cb_exception_detail(cb, &excdet);
141 snprintf(buf, size,
142 "GRU exception: cb %p, opc %d, exopc %d, ecause 0x%x,"
143 "excdet0 0x%lx, excdet1 0x%x",
144 gen, excdet.opc, excdet.exopc, excdet.ecause,
145 excdet.exceptdet0, excdet.exceptdet1);
146 } else {
147 snprintf(buf, size, "No exception");
148 }
149 return buf;
150}
151
152static int gru_wait_idle_or_exception(struct gru_control_block_status *gen)
153{
154 while (gen->istatus >= CBS_ACTIVE) {
155 cpu_relax();
156 barrier();
157 }
158 return gen->istatus;
159}
160
161static int gru_retry_exception(void *cb)
162{
163 struct gru_control_block_status *gen = (void *)cb;
164 struct control_block_extended_exc_detail excdet;
165 int retry = EXCEPTION_RETRY_LIMIT;
166
167 while (1) {
168 if (gru_get_cb_message_queue_substatus(cb))
169 break;
170 if (gru_wait_idle_or_exception(gen) == CBS_IDLE)
171 return CBS_IDLE;
172
173 gru_get_cb_exception_detail(cb, &excdet);
174 if (excdet.ecause & ~EXCEPTION_RETRY_BITS)
175 break;
176 if (retry-- == 0)
177 break;
178 gen->icmd = 1;
179 gru_flush_cache(gen);
180 }
181 return CBS_EXCEPTION;
182}
183
184int gru_check_status_proc(void *cb)
185{
186 struct gru_control_block_status *gen = (void *)cb;
187 int ret;
188
189 ret = gen->istatus;
190 if (ret != CBS_EXCEPTION)
191 return ret;
192 return gru_retry_exception(cb);
193
194}
195
196int gru_wait_proc(void *cb)
197{
198 struct gru_control_block_status *gen = (void *)cb;
199 int ret;
200
201 ret = gru_wait_idle_or_exception(gen);
202 if (ret == CBS_EXCEPTION)
203 ret = gru_retry_exception(cb);
204
205 return ret;
206}
207
208void gru_abort(int ret, void *cb, char *str)
209{
210 char buf[GRU_EXC_STR_SIZE];
211
212 panic("GRU FATAL ERROR: %s - %s\n", str,
213 gru_get_cb_exception_detail_str(ret, cb, buf, sizeof(buf)));
214}
215
216void gru_wait_abort_proc(void *cb)
217{
218 int ret;
219
220 ret = gru_wait_proc(cb);
221 if (ret)
222 gru_abort(ret, cb, "gru_wait_abort");
223}
224
225
226/*------------------------------ MESSAGE QUEUES -----------------------------*/
227
228/* Internal status . These are NOT returned to the user. */
229#define MQIE_AGAIN -1 /* try again */
230
231
232/*
233 * Save/restore the "present" flag that is in the second line of 2-line
234 * messages
235 */
236static inline int get_present2(void *p)
237{
238 struct message_header *mhdr = p + GRU_CACHE_LINE_BYTES;
239 return mhdr->present;
240}
241
242static inline void restore_present2(void *p, int val)
243{
244 struct message_header *mhdr = p + GRU_CACHE_LINE_BYTES;
245 mhdr->present = val;
246}
247
248/*
249 * Create a message queue.
250 * qlines - message queue size in cache lines. Includes 2-line header.
251 */
252int gru_create_message_queue(void *p, unsigned int bytes)
253{
254 struct message_queue *mq = p;
255 unsigned int qlines;
256
257 qlines = bytes / GRU_CACHE_LINE_BYTES - 2;
258 memset(mq, 0, bytes);
259 mq->start = &mq->data;
260 mq->start2 = &mq->data + (qlines / 2 - 1) * GRU_CACHE_LINE_BYTES;
261 mq->next = &mq->data;
262 mq->limit = &mq->data + (qlines - 2) * GRU_CACHE_LINE_BYTES;
263 mq->qlines = qlines;
264 mq->hstatus[0] = 0;
265 mq->hstatus[1] = 1;
266 mq->head = gru_mesq_head(2, qlines / 2 + 1);
267 return 0;
268}
269EXPORT_SYMBOL_GPL(gru_create_message_queue);
270
271/*
272 * Send a NOOP message to a message queue
273 * Returns:
274 * 0 - if queue is full after the send. This is the normal case
275 * but various races can change this.
276 * -1 - if mesq sent successfully but queue not full
277 * >0 - unexpected error. MQE_xxx returned
278 */
279static int send_noop_message(void *cb,
280 unsigned long mq, void *mesg)
281{
282 const struct message_header noop_header = {
283 .present = MQS_NOOP, .lines = 1};
284 unsigned long m;
285 int substatus, ret;
286 struct message_header save_mhdr, *mhdr = mesg;
287
288 STAT(mesq_noop);
289 save_mhdr = *mhdr;
290 *mhdr = noop_header;
291 gru_mesq(cb, mq, gru_get_tri(mhdr), 1, IMA);
292 ret = gru_wait(cb);
293
294 if (ret) {
295 substatus = gru_get_cb_message_queue_substatus(cb);
296 switch (substatus) {
297 case CBSS_NO_ERROR:
298 STAT(mesq_noop_unexpected_error);
299 ret = MQE_UNEXPECTED_CB_ERR;
300 break;
301 case CBSS_LB_OVERFLOWED:
302 STAT(mesq_noop_lb_overflow);
303 ret = MQE_CONGESTION;
304 break;
305 case CBSS_QLIMIT_REACHED:
306 STAT(mesq_noop_qlimit_reached);
307 ret = 0;
308 break;
309 case CBSS_AMO_NACKED:
310 STAT(mesq_noop_amo_nacked);
311 ret = MQE_CONGESTION;
312 break;
313 case CBSS_PUT_NACKED:
314 STAT(mesq_noop_put_nacked);
315 m = mq + (gru_get_amo_value_head(cb) << 6);
316 gru_vstore(cb, m, gru_get_tri(mesg), XTYPE_CL, 1, 1,
317 IMA);
318 if (gru_wait(cb) == CBS_IDLE)
319 ret = MQIE_AGAIN;
320 else
321 ret = MQE_UNEXPECTED_CB_ERR;
322 break;
323 case CBSS_PAGE_OVERFLOW:
324 default:
325 BUG();
326 }
327 }
328 *mhdr = save_mhdr;
329 return ret;
330}
331
332/*
333 * Handle a gru_mesq full.
334 */
335static int send_message_queue_full(void *cb,
336 unsigned long mq, void *mesg, int lines)
337{
338 union gru_mesqhead mqh;
339 unsigned int limit, head;
340 unsigned long avalue;
341 int half, qlines, save;
342
343 /* Determine if switching to first/second half of q */
344 avalue = gru_get_amo_value(cb);
345 head = gru_get_amo_value_head(cb);
346 limit = gru_get_amo_value_limit(cb);
347
348 /*
349 * Fetch "qlines" from the queue header. Since the queue may be
350 * in memory that can't be accessed using socket addresses, use
351 * the GRU to access the data. Use DSR space from the message.
352 */
353 save = *(int *)mesg;
354 gru_vload(cb, QLINES(mq), gru_get_tri(mesg), XTYPE_W, 1, 1, IMA);
355 if (gru_wait(cb) != CBS_IDLE)
356 goto cberr;
357 qlines = *(int *)mesg;
358 *(int *)mesg = save;
359 half = (limit != qlines);
360
361 if (half)
362 mqh = gru_mesq_head(qlines / 2 + 1, qlines);
363 else
364 mqh = gru_mesq_head(2, qlines / 2 + 1);
365
366 /* Try to get lock for switching head pointer */
367 gru_gamir(cb, EOP_IR_CLR, HSTATUS(mq, half), XTYPE_DW, IMA);
368 if (gru_wait(cb) != CBS_IDLE)
369 goto cberr;
370 if (!gru_get_amo_value(cb)) {
371 STAT(mesq_qf_locked);
372 return MQE_QUEUE_FULL;
373 }
374
375 /* Got the lock. Send optional NOP if queue not full, */
376 if (head != limit) {
377 if (send_noop_message(cb, mq, mesg)) {
378 gru_gamir(cb, EOP_IR_INC, HSTATUS(mq, half),
379 XTYPE_DW, IMA);
380 if (gru_wait(cb) != CBS_IDLE)
381 goto cberr;
382 STAT(mesq_qf_noop_not_full);
383 return MQIE_AGAIN;
384 }
385 avalue++;
386 }
387
388 /* Then flip queuehead to other half of queue. */
389 gru_gamer(cb, EOP_ERR_CSWAP, mq, XTYPE_DW, mqh.val, avalue, IMA);
390 if (gru_wait(cb) != CBS_IDLE)
391 goto cberr;
392
393 /* If not successfully in swapping queue head, clear the hstatus lock */
394 if (gru_get_amo_value(cb) != avalue) {
395 STAT(mesq_qf_switch_head_failed);
396 gru_gamir(cb, EOP_IR_INC, HSTATUS(mq, half), XTYPE_DW, IMA);
397 if (gru_wait(cb) != CBS_IDLE)
398 goto cberr;
399 }
400 return MQIE_AGAIN;
401cberr:
402 STAT(mesq_qf_unexpected_error);
403 return MQE_UNEXPECTED_CB_ERR;
404}
405
406
407/*
408 * Handle a gru_mesq failure. Some of these failures are software recoverable
409 * or retryable.
410 */
411static int send_message_failure(void *cb,
412 unsigned long mq,
413 void *mesg,
414 int lines)
415{
416 int substatus, ret = 0;
417 unsigned long m;
418
419 substatus = gru_get_cb_message_queue_substatus(cb);
420 switch (substatus) {
421 case CBSS_NO_ERROR:
422 STAT(mesq_send_unexpected_error);
423 ret = MQE_UNEXPECTED_CB_ERR;
424 break;
425 case CBSS_LB_OVERFLOWED:
426 STAT(mesq_send_lb_overflow);
427 ret = MQE_CONGESTION;
428 break;
429 case CBSS_QLIMIT_REACHED:
430 STAT(mesq_send_qlimit_reached);
431 ret = send_message_queue_full(cb, mq, mesg, lines);
432 break;
433 case CBSS_AMO_NACKED:
434 STAT(mesq_send_amo_nacked);
435 ret = MQE_CONGESTION;
436 break;
437 case CBSS_PUT_NACKED:
438 STAT(mesq_send_put_nacked);
439 m =mq + (gru_get_amo_value_head(cb) << 6);
440 gru_vstore(cb, m, gru_get_tri(mesg), XTYPE_CL, lines, 1, IMA);
441 if (gru_wait(cb) == CBS_IDLE)
442 ret = MQE_OK;
443 else
444 ret = MQE_UNEXPECTED_CB_ERR;
445 break;
446 default:
447 BUG();
448 }
449 return ret;
450}
451
452/*
453 * Send a message to a message queue
454 * cb GRU control block to use to send message
455 * mq message queue
456 * mesg message. ust be vaddr within a GSEG
457 * bytes message size (<= 2 CL)
458 */
459int gru_send_message_gpa(unsigned long mq, void *mesg, unsigned int bytes)
460{
461 struct message_header *mhdr;
462 void *cb;
463 void *dsr;
464 int istatus, clines, ret;
465
466 STAT(mesq_send);
467 BUG_ON(bytes < sizeof(int) || bytes > 2 * GRU_CACHE_LINE_BYTES);
468
469 clines = (bytes + GRU_CACHE_LINE_BYTES - 1) / GRU_CACHE_LINE_BYTES;
470 if (gru_get_cpu_resources(bytes, &cb, &dsr))
471 return MQE_BUG_NO_RESOURCES;
472 memcpy(dsr, mesg, bytes);
473 mhdr = dsr;
474 mhdr->present = MQS_FULL;
475 mhdr->lines = clines;
476 if (clines == 2) {
477 mhdr->present2 = get_present2(mhdr);
478 restore_present2(mhdr, MQS_FULL);
479 }
480
481 do {
482 ret = MQE_OK;
483 gru_mesq(cb, mq, gru_get_tri(mhdr), clines, IMA);
484 istatus = gru_wait(cb);
485 if (istatus != CBS_IDLE)
486 ret = send_message_failure(cb, mq, dsr, clines);
487 } while (ret == MQIE_AGAIN);
488 gru_free_cpu_resources(cb, dsr);
489
490 if (ret)
491 STAT(mesq_send_failed);
492 return ret;
493}
494EXPORT_SYMBOL_GPL(gru_send_message_gpa);
495
496/*
497 * Advance the receive pointer for the queue to the next message.
498 */
499void gru_free_message(void *rmq, void *mesg)
500{
501 struct message_queue *mq = rmq;
502 struct message_header *mhdr = mq->next;
503 void *next, *pnext;
504 int half = -1;
505 int lines = mhdr->lines;
506
507 if (lines == 2)
508 restore_present2(mhdr, MQS_EMPTY);
509 mhdr->present = MQS_EMPTY;
510
511 pnext = mq->next;
512 next = pnext + GRU_CACHE_LINE_BYTES * lines;
513 if (next == mq->limit) {
514 next = mq->start;
515 half = 1;
516 } else if (pnext < mq->start2 && next >= mq->start2) {
517 half = 0;
518 }
519
520 if (half >= 0)
521 mq->hstatus[half] = 1;
522 mq->next = next;
523}
524EXPORT_SYMBOL_GPL(gru_free_message);
525
526/*
527 * Get next message from message queue. Return NULL if no message
528 * present. User must call next_message() to move to next message.
529 * rmq message queue
530 */
531void *gru_get_next_message(void *rmq)
532{
533 struct message_queue *mq = rmq;
534 struct message_header *mhdr = mq->next;
535 int present = mhdr->present;
536
537 /* skip NOOP messages */
538 STAT(mesq_receive);
539 while (present == MQS_NOOP) {
540 gru_free_message(rmq, mhdr);
541 mhdr = mq->next;
542 present = mhdr->present;
543 }
544
545 /* Wait for both halves of 2 line messages */
546 if (present == MQS_FULL && mhdr->lines == 2 &&
547 get_present2(mhdr) == MQS_EMPTY)
548 present = MQS_EMPTY;
549
550 if (!present) {
551 STAT(mesq_receive_none);
552 return NULL;
553 }
554
555 if (mhdr->lines == 2)
556 restore_present2(mhdr, mhdr->present2);
557
558 return mhdr;
559}
560EXPORT_SYMBOL_GPL(gru_get_next_message);
561
562/* ---------------------- GRU DATA COPY FUNCTIONS ---------------------------*/
563
564/*
565 * Copy a block of data using the GRU resources
566 */
567int gru_copy_gpa(unsigned long dest_gpa, unsigned long src_gpa,
568 unsigned int bytes)
569{
570 void *cb;
571 void *dsr;
572 int ret;
573
574 STAT(copy_gpa);
575 if (gru_get_cpu_resources(GRU_NUM_KERNEL_DSR_BYTES, &cb, &dsr))
576 return MQE_BUG_NO_RESOURCES;
577 gru_bcopy(cb, src_gpa, dest_gpa, gru_get_tri(dsr),
578 XTYPE_B, bytes, GRU_NUM_KERNEL_DSR_BYTES, IMA);
579 ret = gru_wait(cb);
580 gru_free_cpu_resources(cb, dsr);
581 return ret;
582}
583EXPORT_SYMBOL_GPL(gru_copy_gpa);
584
585/* ------------------- KERNEL QUICKTESTS RUN AT STARTUP ----------------*/
586/* Temp - will delete after we gain confidence in the GRU */
587static __cacheline_aligned unsigned long word0;
588static __cacheline_aligned unsigned long word1;
589
590static int quicktest(struct gru_state *gru)
591{
592 void *cb;
593 void *ds;
594 unsigned long *p;
595
596 cb = get_gseg_base_address_cb(gru->gs_gru_base_vaddr, KERNEL_CTXNUM, 0);
597 ds = get_gseg_base_address_ds(gru->gs_gru_base_vaddr, KERNEL_CTXNUM, 0);
598 p = ds;
599 word0 = MAGIC;
600
601 gru_vload(cb, uv_gpa(&word0), 0, XTYPE_DW, 1, 1, IMA);
602 if (gru_wait(cb) != CBS_IDLE)
603 BUG();
604
605 if (*(unsigned long *)ds != MAGIC)
606 BUG();
607 gru_vstore(cb, uv_gpa(&word1), 0, XTYPE_DW, 1, 1, IMA);
608 if (gru_wait(cb) != CBS_IDLE)
609 BUG();
610
611 if (word0 != word1 || word0 != MAGIC) {
612 printk
613 ("GRU quicktest err: gru %d, found 0x%lx, expected 0x%lx\n",
614 gru->gs_gid, word1, MAGIC);
615 BUG(); /* ZZZ should not be fatal */
616 }
617
618 return 0;
619}
620
621
622int gru_kservices_init(struct gru_state *gru)
623{
624 struct gru_blade_state *bs;
625 struct gru_context_configuration_handle *cch;
626 unsigned long cbr_map, dsr_map;
627 int err, num, cpus_possible;
628
629 /*
630 * Currently, resources are reserved ONLY on the second chiplet
631 * on each blade. This leaves ALL resources on chiplet 0 available
632 * for user code.
633 */
634 bs = gru->gs_blade;
635 if (gru != &bs->bs_grus[1])
636 return 0;
637
638 cpus_possible = uv_blade_nr_possible_cpus(gru->gs_blade_id);
639
640 num = GRU_NUM_KERNEL_CBR * cpus_possible;
641 cbr_map = gru_reserve_cb_resources(gru, GRU_CB_COUNT_TO_AU(num), NULL);
642 gru->gs_reserved_cbrs += num;
643
644 num = GRU_NUM_KERNEL_DSR_BYTES * cpus_possible;
645 dsr_map = gru_reserve_ds_resources(gru, GRU_DS_BYTES_TO_AU(num), NULL);
646 gru->gs_reserved_dsr_bytes += num;
647
648 gru->gs_active_contexts++;
649 __set_bit(KERNEL_CTXNUM, &gru->gs_context_map);
650 cch = get_cch(gru->gs_gru_base_vaddr, KERNEL_CTXNUM);
651
652 bs->kernel_cb = get_gseg_base_address_cb(gru->gs_gru_base_vaddr,
653 KERNEL_CTXNUM, 0);
654 bs->kernel_dsr = get_gseg_base_address_ds(gru->gs_gru_base_vaddr,
655 KERNEL_CTXNUM, 0);
656
657 lock_cch_handle(cch);
658 cch->tfm_fault_bit_enable = 0;
659 cch->tlb_int_enable = 0;
660 cch->tfm_done_bit_enable = 0;
661 cch->unmap_enable = 1;
662 err = cch_allocate(cch, 0, cbr_map, dsr_map);
663 if (err) {
664 gru_dbg(grudev,
665 "Unable to allocate kernel CCH: gru %d, err %d\n",
666 gru->gs_gid, err);
667 BUG();
668 }
669 if (cch_start(cch)) {
670 gru_dbg(grudev, "Unable to start kernel CCH: gru %d, err %d\n",
671 gru->gs_gid, err);
672 BUG();
673 }
674 unlock_cch_handle(cch);
675
676 if (gru_options & GRU_QUICKLOOK)
677 quicktest(gru);
678 return 0;
679}
diff --git a/drivers/misc/sgi-gru/grukservices.h b/drivers/misc/sgi-gru/grukservices.h
new file mode 100644
index 000000000000..eb17e0a3ac61
--- /dev/null
+++ b/drivers/misc/sgi-gru/grukservices.h
@@ -0,0 +1,134 @@
1
2/*
3 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
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#ifndef __GRU_KSERVICES_H_
20#define __GRU_KSERVICES_H_
21
22
23/*
24 * Message queues using the GRU to send/receive messages.
25 *
26 * These function allow the user to create a message queue for
27 * sending/receiving 1 or 2 cacheline messages using the GRU.
28 *
29 * Processes SENDING messages will use a kernel CBR/DSR to send
30 * the message. This is transparent to the caller.
31 *
32 * The receiver does not use any GRU resources.
33 *
34 * The functions support:
35 * - single receiver
36 * - multiple senders
37 * - cross partition message
38 *
39 * Missing features ZZZ:
40 * - user options for dealing with timeouts, queue full, etc.
41 * - gru_create_message_queue() needs interrupt vector info
42 */
43
44/*
45 * Initialize a user allocated chunk of memory to be used as
46 * a message queue. The caller must ensure that the queue is
47 * in contiguous physical memory and is cacheline aligned.
48 *
49 * Message queue size is the total number of bytes allocated
50 * to the queue including a 2 cacheline header that is used
51 * to manage the queue.
52 *
53 * Input:
54 * p pointer to user allocated memory.
55 * bytes size of message queue in bytes
56 *
57 * Errors:
58 * 0 OK
59 * >0 error
60 */
61extern int gru_create_message_queue(void *p, unsigned int bytes);
62
63/*
64 * Send a message to a message queue.
65 *
66 * Note: The message queue transport mechanism uses the first 32
67 * bits of the message. Users should avoid using these bits.
68 *
69 *
70 * Input:
71 * xmq message queue - must be a UV global physical address
72 * mesg pointer to message. Must be 64-bit aligned
73 * bytes size of message in bytes
74 *
75 * Output:
76 * 0 message sent
77 * >0 Send failure - see error codes below
78 *
79 */
80extern int gru_send_message_gpa(unsigned long mq_gpa, void *mesg,
81 unsigned int bytes);
82
83/* Status values for gru_send_message() */
84#define MQE_OK 0 /* message sent successfully */
85#define MQE_CONGESTION 1 /* temporary congestion, try again */
86#define MQE_QUEUE_FULL 2 /* queue is full */
87#define MQE_UNEXPECTED_CB_ERR 3 /* unexpected CB error */
88#define MQE_PAGE_OVERFLOW 10 /* BUG - queue overflowed a page */
89#define MQE_BUG_NO_RESOURCES 11 /* BUG - could not alloc GRU cb/dsr */
90
91/*
92 * Advance the receive pointer for the message queue to the next message.
93 * Note: current API requires messages to be gotten & freed in order. Future
94 * API extensions may allow for out-of-order freeing.
95 *
96 * Input
97 * mq message queue
98 * mesq message being freed
99 */
100extern void gru_free_message(void *mq, void *mesq);
101
102/*
103 * Get next message from message queue. Returns pointer to
104 * message OR NULL if no message present.
105 * User must call gru_free_message() after message is processed
106 * in order to move the queue pointers to next message.
107 *
108 * Input
109 * mq message queue
110 *
111 * Output:
112 * p pointer to message
113 * NULL no message available
114 */
115extern void *gru_get_next_message(void *mq);
116
117
118/*
119 * Copy data using the GRU. Source or destination can be located in a remote
120 * partition.
121 *
122 * Input:
123 * dest_gpa destination global physical address
124 * src_gpa source global physical address
125 * bytes number of bytes to copy
126 *
127 * Output:
128 * 0 OK
129 * >0 error
130 */
131extern int gru_copy_gpa(unsigned long dest_gpa, unsigned long src_gpa,
132 unsigned int bytes);
133
134#endif /* __GRU_KSERVICES_H_ */
diff --git a/drivers/misc/sgi-gru/grulib.h b/drivers/misc/sgi-gru/grulib.h
new file mode 100644
index 000000000000..e56e196a6998
--- /dev/null
+++ b/drivers/misc/sgi-gru/grulib.h
@@ -0,0 +1,97 @@
1/*
2 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __GRULIB_H__
20#define __GRULIB_H__
21
22#define GRU_BASENAME "gru"
23#define GRU_FULLNAME "/dev/gru"
24#define GRU_IOCTL_NUM 'G'
25
26/*
27 * Maximum number of GRU segments that a user can have open
28 * ZZZ temp - set high for testing. Revisit.
29 */
30#define GRU_MAX_OPEN_CONTEXTS 32
31
32/* Set Number of Request Blocks */
33#define GRU_CREATE_CONTEXT _IOWR(GRU_IOCTL_NUM, 1, void *)
34
35/* Register task as using the slice */
36#define GRU_SET_TASK_SLICE _IOWR(GRU_IOCTL_NUM, 5, void *)
37
38/* Fetch exception detail */
39#define GRU_USER_GET_EXCEPTION_DETAIL _IOWR(GRU_IOCTL_NUM, 6, void *)
40
41/* For user call_os handling - normally a TLB fault */
42#define GRU_USER_CALL_OS _IOWR(GRU_IOCTL_NUM, 8, void *)
43
44/* For user unload context */
45#define GRU_USER_UNLOAD_CONTEXT _IOWR(GRU_IOCTL_NUM, 9, void *)
46
47/* For fetching GRU chiplet status */
48#define GRU_GET_CHIPLET_STATUS _IOWR(GRU_IOCTL_NUM, 10, void *)
49
50/* For user TLB flushing (primarily for tests) */
51#define GRU_USER_FLUSH_TLB _IOWR(GRU_IOCTL_NUM, 50, void *)
52
53/* Get some config options (primarily for tests & emulator) */
54#define GRU_GET_CONFIG_INFO _IOWR(GRU_IOCTL_NUM, 51, void *)
55
56#define CONTEXT_WINDOW_BYTES(th) (GRU_GSEG_PAGESIZE * (th))
57#define THREAD_POINTER(p, th) (p + GRU_GSEG_PAGESIZE * (th))
58
59/*
60 * Structure used to pass TLB flush parameters to the driver
61 */
62struct gru_create_context_req {
63 unsigned long gseg;
64 unsigned int data_segment_bytes;
65 unsigned int control_blocks;
66 unsigned int maximum_thread_count;
67 unsigned int options;
68};
69
70/*
71 * Structure used to pass unload context parameters to the driver
72 */
73struct gru_unload_context_req {
74 unsigned long gseg;
75};
76
77/*
78 * Structure used to pass TLB flush parameters to the driver
79 */
80struct gru_flush_tlb_req {
81 unsigned long gseg;
82 unsigned long vaddr;
83 size_t len;
84};
85
86/*
87 * GRU configuration info (temp - for testing)
88 */
89struct gru_config_info {
90 int cpus;
91 int blades;
92 int nodes;
93 int chiplets;
94 int fill[16];
95};
96
97#endif /* __GRULIB_H__ */
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c
new file mode 100644
index 000000000000..0eeb8dddd2f5
--- /dev/null
+++ b/drivers/misc/sgi-gru/grumain.c
@@ -0,0 +1,802 @@
1/*
2 * SN Platform GRU Driver
3 *
4 * DRIVER TABLE MANAGER + GRU CONTEXT LOAD/UNLOAD
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 *
10 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
11 */
12
13#include <linux/kernel.h>
14#include <linux/slab.h>
15#include <linux/mm.h>
16#include <linux/spinlock.h>
17#include <linux/sched.h>
18#include <linux/device.h>
19#include <linux/list.h>
20#include <asm/uv/uv_hub.h>
21#include "gru.h"
22#include "grutables.h"
23#include "gruhandles.h"
24
25unsigned long gru_options __read_mostly;
26
27static struct device_driver gru_driver = {
28 .name = "gru"
29};
30
31static struct device gru_device = {
32 .bus_id = {0},
33 .driver = &gru_driver,
34};
35
36struct device *grudev = &gru_device;
37
38/*
39 * Select a gru fault map to be used by the current cpu. Note that
40 * multiple cpus may be using the same map.
41 * ZZZ should "shift" be used?? Depends on HT cpu numbering
42 * ZZZ should be inline but did not work on emulator
43 */
44int gru_cpu_fault_map_id(void)
45{
46 return uv_blade_processor_id() % GRU_NUM_TFM;
47}
48
49/*--------- ASID Management -------------------------------------------
50 *
51 * Initially, assign asids sequentially from MIN_ASID .. MAX_ASID.
52 * Once MAX is reached, flush the TLB & start over. However,
53 * some asids may still be in use. There won't be many (percentage wise) still
54 * in use. Search active contexts & determine the value of the first
55 * asid in use ("x"s below). Set "limit" to this value.
56 * This defines a block of assignable asids.
57 *
58 * When "limit" is reached, search forward from limit+1 and determine the
59 * next block of assignable asids.
60 *
61 * Repeat until MAX_ASID is reached, then start over again.
62 *
63 * Each time MAX_ASID is reached, increment the asid generation. Since
64 * the search for in-use asids only checks contexts with GRUs currently
65 * assigned, asids in some contexts will be missed. Prior to loading
66 * a context, the asid generation of the GTS asid is rechecked. If it
67 * doesn't match the current generation, a new asid will be assigned.
68 *
69 * 0---------------x------------x---------------------x----|
70 * ^-next ^-limit ^-MAX_ASID
71 *
72 * All asid manipulation & context loading/unloading is protected by the
73 * gs_lock.
74 */
75
76/* Hit the asid limit. Start over */
77static int gru_wrap_asid(struct gru_state *gru)
78{
79 gru_dbg(grudev, "gru %p\n", gru);
80 STAT(asid_wrap);
81 gru->gs_asid_gen++;
82 gru_flush_all_tlb(gru);
83 return MIN_ASID;
84}
85
86/* Find the next chunk of unused asids */
87static int gru_reset_asid_limit(struct gru_state *gru, int asid)
88{
89 int i, gid, inuse_asid, limit;
90
91 gru_dbg(grudev, "gru %p, asid 0x%x\n", gru, asid);
92 STAT(asid_next);
93 limit = MAX_ASID;
94 if (asid >= limit)
95 asid = gru_wrap_asid(gru);
96 gid = gru->gs_gid;
97again:
98 for (i = 0; i < GRU_NUM_CCH; i++) {
99 if (!gru->gs_gts[i])
100 continue;
101 inuse_asid = gru->gs_gts[i]->ts_gms->ms_asids[gid].mt_asid;
102 gru_dbg(grudev, "gru %p, inuse_asid 0x%x, cxtnum %d, gts %p\n",
103 gru, inuse_asid, i, gru->gs_gts[i]);
104 if (inuse_asid == asid) {
105 asid += ASID_INC;
106 if (asid >= limit) {
107 /*
108 * empty range: reset the range limit and
109 * start over
110 */
111 limit = MAX_ASID;
112 if (asid >= MAX_ASID)
113 asid = gru_wrap_asid(gru);
114 goto again;
115 }
116 }
117
118 if ((inuse_asid > asid) && (inuse_asid < limit))
119 limit = inuse_asid;
120 }
121 gru->gs_asid_limit = limit;
122 gru->gs_asid = asid;
123 gru_dbg(grudev, "gru %p, new asid 0x%x, new_limit 0x%x\n", gru, asid,
124 limit);
125 return asid;
126}
127
128/* Assign a new ASID to a thread context. */
129static int gru_assign_asid(struct gru_state *gru)
130{
131 int asid;
132
133 spin_lock(&gru->gs_asid_lock);
134 gru->gs_asid += ASID_INC;
135 asid = gru->gs_asid;
136 if (asid >= gru->gs_asid_limit)
137 asid = gru_reset_asid_limit(gru, asid);
138 spin_unlock(&gru->gs_asid_lock);
139
140 gru_dbg(grudev, "gru %p, asid 0x%x\n", gru, asid);
141 return asid;
142}
143
144/*
145 * Clear n bits in a word. Return a word indicating the bits that were cleared.
146 * Optionally, build an array of chars that contain the bit numbers allocated.
147 */
148static unsigned long reserve_resources(unsigned long *p, int n, int mmax,
149 char *idx)
150{
151 unsigned long bits = 0;
152 int i;
153
154 do {
155 i = find_first_bit(p, mmax);
156 if (i == mmax)
157 BUG();
158 __clear_bit(i, p);
159 __set_bit(i, &bits);
160 if (idx)
161 *idx++ = i;
162 } while (--n);
163 return bits;
164}
165
166unsigned long gru_reserve_cb_resources(struct gru_state *gru, int cbr_au_count,
167 char *cbmap)
168{
169 return reserve_resources(&gru->gs_cbr_map, cbr_au_count, GRU_CBR_AU,
170 cbmap);
171}
172
173unsigned long gru_reserve_ds_resources(struct gru_state *gru, int dsr_au_count,
174 char *dsmap)
175{
176 return reserve_resources(&gru->gs_dsr_map, dsr_au_count, GRU_DSR_AU,
177 dsmap);
178}
179
180static void reserve_gru_resources(struct gru_state *gru,
181 struct gru_thread_state *gts)
182{
183 gru->gs_active_contexts++;
184 gts->ts_cbr_map =
185 gru_reserve_cb_resources(gru, gts->ts_cbr_au_count,
186 gts->ts_cbr_idx);
187 gts->ts_dsr_map =
188 gru_reserve_ds_resources(gru, gts->ts_dsr_au_count, NULL);
189}
190
191static void free_gru_resources(struct gru_state *gru,
192 struct gru_thread_state *gts)
193{
194 gru->gs_active_contexts--;
195 gru->gs_cbr_map |= gts->ts_cbr_map;
196 gru->gs_dsr_map |= gts->ts_dsr_map;
197}
198
199/*
200 * Check if a GRU has sufficient free resources to satisfy an allocation
201 * request. Note: GRU locks may or may not be held when this is called. If
202 * not held, recheck after acquiring the appropriate locks.
203 *
204 * Returns 1 if sufficient resources, 0 if not
205 */
206static int check_gru_resources(struct gru_state *gru, int cbr_au_count,
207 int dsr_au_count, int max_active_contexts)
208{
209 return hweight64(gru->gs_cbr_map) >= cbr_au_count
210 && hweight64(gru->gs_dsr_map) >= dsr_au_count
211 && gru->gs_active_contexts < max_active_contexts;
212}
213
214/*
215 * TLB manangment requires tracking all GRU chiplets that have loaded a GSEG
216 * context.
217 */
218static int gru_load_mm_tracker(struct gru_state *gru, struct gru_mm_struct *gms,
219 int ctxnum)
220{
221 struct gru_mm_tracker *asids = &gms->ms_asids[gru->gs_gid];
222 unsigned short ctxbitmap = (1 << ctxnum);
223 int asid;
224
225 spin_lock(&gms->ms_asid_lock);
226 asid = asids->mt_asid;
227
228 if (asid == 0 || asids->mt_asid_gen != gru->gs_asid_gen) {
229 asid = gru_assign_asid(gru);
230 asids->mt_asid = asid;
231 asids->mt_asid_gen = gru->gs_asid_gen;
232 STAT(asid_new);
233 } else {
234 STAT(asid_reuse);
235 }
236
237 BUG_ON(asids->mt_ctxbitmap & ctxbitmap);
238 asids->mt_ctxbitmap |= ctxbitmap;
239 if (!test_bit(gru->gs_gid, gms->ms_asidmap))
240 __set_bit(gru->gs_gid, gms->ms_asidmap);
241 spin_unlock(&gms->ms_asid_lock);
242
243 gru_dbg(grudev,
244 "gru %x, gms %p, ctxnum 0x%d, asid 0x%x, asidmap 0x%lx\n",
245 gru->gs_gid, gms, ctxnum, asid, gms->ms_asidmap[0]);
246 return asid;
247}
248
249static void gru_unload_mm_tracker(struct gru_state *gru,
250 struct gru_mm_struct *gms, int ctxnum)
251{
252 struct gru_mm_tracker *asids;
253 unsigned short ctxbitmap;
254
255 asids = &gms->ms_asids[gru->gs_gid];
256 ctxbitmap = (1 << ctxnum);
257 spin_lock(&gms->ms_asid_lock);
258 BUG_ON((asids->mt_ctxbitmap & ctxbitmap) != ctxbitmap);
259 asids->mt_ctxbitmap ^= ctxbitmap;
260 gru_dbg(grudev, "gru %x, gms %p, ctxnum 0x%d, asidmap 0x%lx\n",
261 gru->gs_gid, gms, ctxnum, gms->ms_asidmap[0]);
262 spin_unlock(&gms->ms_asid_lock);
263}
264
265/*
266 * Decrement the reference count on a GTS structure. Free the structure
267 * if the reference count goes to zero.
268 */
269void gts_drop(struct gru_thread_state *gts)
270{
271 if (gts && atomic_dec_return(&gts->ts_refcnt) == 0) {
272 gru_drop_mmu_notifier(gts->ts_gms);
273 kfree(gts);
274 STAT(gts_free);
275 }
276}
277
278/*
279 * Locate the GTS structure for the current thread.
280 */
281static struct gru_thread_state *gru_find_current_gts_nolock(struct gru_vma_data
282 *vdata, int tsid)
283{
284 struct gru_thread_state *gts;
285
286 list_for_each_entry(gts, &vdata->vd_head, ts_next)
287 if (gts->ts_tsid == tsid)
288 return gts;
289 return NULL;
290}
291
292/*
293 * Allocate a thread state structure.
294 */
295static struct gru_thread_state *gru_alloc_gts(struct vm_area_struct *vma,
296 struct gru_vma_data *vdata,
297 int tsid)
298{
299 struct gru_thread_state *gts;
300 int bytes;
301
302 bytes = DSR_BYTES(vdata->vd_dsr_au_count) +
303 CBR_BYTES(vdata->vd_cbr_au_count);
304 bytes += sizeof(struct gru_thread_state);
305 gts = kzalloc(bytes, GFP_KERNEL);
306 if (!gts)
307 return NULL;
308
309 STAT(gts_alloc);
310 atomic_set(&gts->ts_refcnt, 1);
311 mutex_init(&gts->ts_ctxlock);
312 gts->ts_cbr_au_count = vdata->vd_cbr_au_count;
313 gts->ts_dsr_au_count = vdata->vd_dsr_au_count;
314 gts->ts_user_options = vdata->vd_user_options;
315 gts->ts_tsid = tsid;
316 gts->ts_user_options = vdata->vd_user_options;
317 gts->ts_ctxnum = NULLCTX;
318 gts->ts_mm = current->mm;
319 gts->ts_vma = vma;
320 gts->ts_tlb_int_select = -1;
321 gts->ts_gms = gru_register_mmu_notifier();
322 if (!gts->ts_gms)
323 goto err;
324
325 gru_dbg(grudev, "alloc vdata %p, new gts %p\n", vdata, gts);
326 return gts;
327
328err:
329 gts_drop(gts);
330 return NULL;
331}
332
333/*
334 * Allocate a vma private data structure.
335 */
336struct gru_vma_data *gru_alloc_vma_data(struct vm_area_struct *vma, int tsid)
337{
338 struct gru_vma_data *vdata = NULL;
339
340 vdata = kmalloc(sizeof(*vdata), GFP_KERNEL);
341 if (!vdata)
342 return NULL;
343
344 INIT_LIST_HEAD(&vdata->vd_head);
345 spin_lock_init(&vdata->vd_lock);
346 gru_dbg(grudev, "alloc vdata %p\n", vdata);
347 return vdata;
348}
349
350/*
351 * Find the thread state structure for the current thread.
352 */
353struct gru_thread_state *gru_find_thread_state(struct vm_area_struct *vma,
354 int tsid)
355{
356 struct gru_vma_data *vdata = vma->vm_private_data;
357 struct gru_thread_state *gts;
358
359 spin_lock(&vdata->vd_lock);
360 gts = gru_find_current_gts_nolock(vdata, tsid);
361 spin_unlock(&vdata->vd_lock);
362 gru_dbg(grudev, "vma %p, gts %p\n", vma, gts);
363 return gts;
364}
365
366/*
367 * Allocate a new thread state for a GSEG. Note that races may allow
368 * another thread to race to create a gts.
369 */
370struct gru_thread_state *gru_alloc_thread_state(struct vm_area_struct *vma,
371 int tsid)
372{
373 struct gru_vma_data *vdata = vma->vm_private_data;
374 struct gru_thread_state *gts, *ngts;
375
376 gts = gru_alloc_gts(vma, vdata, tsid);
377 if (!gts)
378 return NULL;
379
380 spin_lock(&vdata->vd_lock);
381 ngts = gru_find_current_gts_nolock(vdata, tsid);
382 if (ngts) {
383 gts_drop(gts);
384 gts = ngts;
385 STAT(gts_double_allocate);
386 } else {
387 list_add(&gts->ts_next, &vdata->vd_head);
388 }
389 spin_unlock(&vdata->vd_lock);
390 gru_dbg(grudev, "vma %p, gts %p\n", vma, gts);
391 return gts;
392}
393
394/*
395 * Free the GRU context assigned to the thread state.
396 */
397static void gru_free_gru_context(struct gru_thread_state *gts)
398{
399 struct gru_state *gru;
400
401 gru = gts->ts_gru;
402 gru_dbg(grudev, "gts %p, gru %p\n", gts, gru);
403
404 spin_lock(&gru->gs_lock);
405 gru->gs_gts[gts->ts_ctxnum] = NULL;
406 free_gru_resources(gru, gts);
407 BUG_ON(test_bit(gts->ts_ctxnum, &gru->gs_context_map) == 0);
408 __clear_bit(gts->ts_ctxnum, &gru->gs_context_map);
409 gts->ts_ctxnum = NULLCTX;
410 gts->ts_gru = NULL;
411 spin_unlock(&gru->gs_lock);
412
413 gts_drop(gts);
414 STAT(free_context);
415}
416
417/*
418 * Prefetching cachelines help hardware performance.
419 * (Strictly a performance enhancement. Not functionally required).
420 */
421static void prefetch_data(void *p, int num, int stride)
422{
423 while (num-- > 0) {
424 prefetchw(p);
425 p += stride;
426 }
427}
428
429static inline long gru_copy_handle(void *d, void *s)
430{
431 memcpy(d, s, GRU_HANDLE_BYTES);
432 return GRU_HANDLE_BYTES;
433}
434
435/* rewrite in assembly & use lots of prefetch */
436static void gru_load_context_data(void *save, void *grubase, int ctxnum,
437 unsigned long cbrmap, unsigned long dsrmap)
438{
439 void *gseg, *cb, *cbe;
440 unsigned long length;
441 int i, scr;
442
443 gseg = grubase + ctxnum * GRU_GSEG_STRIDE;
444 length = hweight64(dsrmap) * GRU_DSR_AU_BYTES;
445 prefetch_data(gseg + GRU_DS_BASE, length / GRU_CACHE_LINE_BYTES,
446 GRU_CACHE_LINE_BYTES);
447
448 cb = gseg + GRU_CB_BASE;
449 cbe = grubase + GRU_CBE_BASE;
450 for_each_cbr_in_allocation_map(i, &cbrmap, scr) {
451 prefetch_data(cb, 1, GRU_CACHE_LINE_BYTES);
452 prefetch_data(cbe + i * GRU_HANDLE_STRIDE, 1,
453 GRU_CACHE_LINE_BYTES);
454 cb += GRU_HANDLE_STRIDE;
455 }
456
457 cb = gseg + GRU_CB_BASE;
458 for_each_cbr_in_allocation_map(i, &cbrmap, scr) {
459 save += gru_copy_handle(cb, save);
460 save += gru_copy_handle(cbe + i * GRU_HANDLE_STRIDE, save);
461 cb += GRU_HANDLE_STRIDE;
462 }
463
464 memcpy(gseg + GRU_DS_BASE, save, length);
465}
466
467static void gru_unload_context_data(void *save, void *grubase, int ctxnum,
468 unsigned long cbrmap, unsigned long dsrmap)
469{
470 void *gseg, *cb, *cbe;
471 unsigned long length;
472 int i, scr;
473
474 gseg = grubase + ctxnum * GRU_GSEG_STRIDE;
475
476 cb = gseg + GRU_CB_BASE;
477 cbe = grubase + GRU_CBE_BASE;
478 for_each_cbr_in_allocation_map(i, &cbrmap, scr) {
479 save += gru_copy_handle(save, cb);
480 save += gru_copy_handle(save, cbe + i * GRU_HANDLE_STRIDE);
481 cb += GRU_HANDLE_STRIDE;
482 }
483 length = hweight64(dsrmap) * GRU_DSR_AU_BYTES;
484 memcpy(save, gseg + GRU_DS_BASE, length);
485}
486
487void gru_unload_context(struct gru_thread_state *gts, int savestate)
488{
489 struct gru_state *gru = gts->ts_gru;
490 struct gru_context_configuration_handle *cch;
491 int ctxnum = gts->ts_ctxnum;
492
493 zap_vma_ptes(gts->ts_vma, UGRUADDR(gts), GRU_GSEG_PAGESIZE);
494 cch = get_cch(gru->gs_gru_base_vaddr, ctxnum);
495
496 lock_cch_handle(cch);
497 if (cch_interrupt_sync(cch))
498 BUG();
499 gru_dbg(grudev, "gts %p\n", gts);
500
501 gru_unload_mm_tracker(gru, gts->ts_gms, gts->ts_ctxnum);
502 if (savestate)
503 gru_unload_context_data(gts->ts_gdata, gru->gs_gru_base_vaddr,
504 ctxnum, gts->ts_cbr_map,
505 gts->ts_dsr_map);
506
507 if (cch_deallocate(cch))
508 BUG();
509 gts->ts_force_unload = 0; /* ts_force_unload locked by CCH lock */
510 unlock_cch_handle(cch);
511
512 gru_free_gru_context(gts);
513 STAT(unload_context);
514}
515
516/*
517 * Load a GRU context by copying it from the thread data structure in memory
518 * to the GRU.
519 */
520static void gru_load_context(struct gru_thread_state *gts)
521{
522 struct gru_state *gru = gts->ts_gru;
523 struct gru_context_configuration_handle *cch;
524 int err, asid, ctxnum = gts->ts_ctxnum;
525
526 gru_dbg(grudev, "gts %p\n", gts);
527 cch = get_cch(gru->gs_gru_base_vaddr, ctxnum);
528
529 lock_cch_handle(cch);
530 asid = gru_load_mm_tracker(gru, gts->ts_gms, gts->ts_ctxnum);
531 cch->tfm_fault_bit_enable =
532 (gts->ts_user_options == GRU_OPT_MISS_FMM_POLL
533 || gts->ts_user_options == GRU_OPT_MISS_FMM_INTR);
534 cch->tlb_int_enable = (gts->ts_user_options == GRU_OPT_MISS_FMM_INTR);
535 if (cch->tlb_int_enable) {
536 gts->ts_tlb_int_select = gru_cpu_fault_map_id();
537 cch->tlb_int_select = gts->ts_tlb_int_select;
538 }
539 cch->tfm_done_bit_enable = 0;
540 err = cch_allocate(cch, asid, gts->ts_cbr_map, gts->ts_dsr_map);
541 if (err) {
542 gru_dbg(grudev,
543 "err %d: cch %p, gts %p, cbr 0x%lx, dsr 0x%lx\n",
544 err, cch, gts, gts->ts_cbr_map, gts->ts_dsr_map);
545 BUG();
546 }
547
548 gru_load_context_data(gts->ts_gdata, gru->gs_gru_base_vaddr, ctxnum,
549 gts->ts_cbr_map, gts->ts_dsr_map);
550
551 if (cch_start(cch))
552 BUG();
553 unlock_cch_handle(cch);
554
555 STAT(load_context);
556}
557
558/*
559 * Update fields in an active CCH:
560 * - retarget interrupts on local blade
561 * - force a delayed context unload by clearing the CCH asids. This
562 * forces TLB misses for new GRU instructions. The context is unloaded
563 * when the next TLB miss occurs.
564 */
565static int gru_update_cch(struct gru_thread_state *gts, int int_select)
566{
567 struct gru_context_configuration_handle *cch;
568 struct gru_state *gru = gts->ts_gru;
569 int i, ctxnum = gts->ts_ctxnum, ret = 0;
570
571 cch = get_cch(gru->gs_gru_base_vaddr, ctxnum);
572
573 lock_cch_handle(cch);
574 if (cch->state == CCHSTATE_ACTIVE) {
575 if (gru->gs_gts[gts->ts_ctxnum] != gts)
576 goto exit;
577 if (cch_interrupt(cch))
578 BUG();
579 if (int_select >= 0) {
580 gts->ts_tlb_int_select = int_select;
581 cch->tlb_int_select = int_select;
582 } else {
583 for (i = 0; i < 8; i++)
584 cch->asid[i] = 0;
585 cch->tfm_fault_bit_enable = 0;
586 cch->tlb_int_enable = 0;
587 gts->ts_force_unload = 1;
588 }
589 if (cch_start(cch))
590 BUG();
591 ret = 1;
592 }
593exit:
594 unlock_cch_handle(cch);
595 return ret;
596}
597
598/*
599 * Update CCH tlb interrupt select. Required when all the following is true:
600 * - task's GRU context is loaded into a GRU
601 * - task is using interrupt notification for TLB faults
602 * - task has migrated to a different cpu on the same blade where
603 * it was previously running.
604 */
605static int gru_retarget_intr(struct gru_thread_state *gts)
606{
607 if (gts->ts_tlb_int_select < 0
608 || gts->ts_tlb_int_select == gru_cpu_fault_map_id())
609 return 0;
610
611 gru_dbg(grudev, "retarget from %d to %d\n", gts->ts_tlb_int_select,
612 gru_cpu_fault_map_id());
613 return gru_update_cch(gts, gru_cpu_fault_map_id());
614}
615
616
617/*
618 * Insufficient GRU resources available on the local blade. Steal a context from
619 * a process. This is a hack until a _real_ resource scheduler is written....
620 */
621#define next_ctxnum(n) ((n) < GRU_NUM_CCH - 2 ? (n) + 1 : 0)
622#define next_gru(b, g) (((g) < &(b)->bs_grus[GRU_CHIPLETS_PER_BLADE - 1]) ? \
623 ((g)+1) : &(b)->bs_grus[0])
624
625static void gru_steal_context(struct gru_thread_state *gts)
626{
627 struct gru_blade_state *blade;
628 struct gru_state *gru, *gru0;
629 struct gru_thread_state *ngts = NULL;
630 int ctxnum, ctxnum0, flag = 0, cbr, dsr;
631
632 cbr = gts->ts_cbr_au_count;
633 dsr = gts->ts_dsr_au_count;
634
635 preempt_disable();
636 blade = gru_base[uv_numa_blade_id()];
637 spin_lock(&blade->bs_lock);
638
639 ctxnum = next_ctxnum(blade->bs_lru_ctxnum);
640 gru = blade->bs_lru_gru;
641 if (ctxnum == 0)
642 gru = next_gru(blade, gru);
643 ctxnum0 = ctxnum;
644 gru0 = gru;
645 while (1) {
646 if (check_gru_resources(gru, cbr, dsr, GRU_NUM_CCH))
647 break;
648 spin_lock(&gru->gs_lock);
649 for (; ctxnum < GRU_NUM_CCH; ctxnum++) {
650 if (flag && gru == gru0 && ctxnum == ctxnum0)
651 break;
652 ngts = gru->gs_gts[ctxnum];
653 /*
654 * We are grabbing locks out of order, so trylock is
655 * needed. GTSs are usually not locked, so the odds of
656 * success are high. If trylock fails, try to steal a
657 * different GSEG.
658 */
659 if (ngts && mutex_trylock(&ngts->ts_ctxlock))
660 break;
661 ngts = NULL;
662 flag = 1;
663 }
664 spin_unlock(&gru->gs_lock);
665 if (ngts || (flag && gru == gru0 && ctxnum == ctxnum0))
666 break;
667 ctxnum = 0;
668 gru = next_gru(blade, gru);
669 }
670 blade->bs_lru_gru = gru;
671 blade->bs_lru_ctxnum = ctxnum;
672 spin_unlock(&blade->bs_lock);
673 preempt_enable();
674
675 if (ngts) {
676 STAT(steal_context);
677 ngts->ts_steal_jiffies = jiffies;
678 gru_unload_context(ngts, 1);
679 mutex_unlock(&ngts->ts_ctxlock);
680 } else {
681 STAT(steal_context_failed);
682 }
683 gru_dbg(grudev,
684 "stole gru %x, ctxnum %d from gts %p. Need cb %d, ds %d;"
685 " avail cb %ld, ds %ld\n",
686 gru->gs_gid, ctxnum, ngts, cbr, dsr, hweight64(gru->gs_cbr_map),
687 hweight64(gru->gs_dsr_map));
688}
689
690/*
691 * Scan the GRUs on the local blade & assign a GRU context.
692 */
693static struct gru_state *gru_assign_gru_context(struct gru_thread_state *gts)
694{
695 struct gru_state *gru, *grux;
696 int i, max_active_contexts;
697
698 preempt_disable();
699
700again:
701 gru = NULL;
702 max_active_contexts = GRU_NUM_CCH;
703 for_each_gru_on_blade(grux, uv_numa_blade_id(), i) {
704 if (check_gru_resources(grux, gts->ts_cbr_au_count,
705 gts->ts_dsr_au_count,
706 max_active_contexts)) {
707 gru = grux;
708 max_active_contexts = grux->gs_active_contexts;
709 if (max_active_contexts == 0)
710 break;
711 }
712 }
713
714 if (gru) {
715 spin_lock(&gru->gs_lock);
716 if (!check_gru_resources(gru, gts->ts_cbr_au_count,
717 gts->ts_dsr_au_count, GRU_NUM_CCH)) {
718 spin_unlock(&gru->gs_lock);
719 goto again;
720 }
721 reserve_gru_resources(gru, gts);
722 gts->ts_gru = gru;
723 gts->ts_ctxnum =
724 find_first_zero_bit(&gru->gs_context_map, GRU_NUM_CCH);
725 BUG_ON(gts->ts_ctxnum == GRU_NUM_CCH);
726 atomic_inc(&gts->ts_refcnt);
727 gru->gs_gts[gts->ts_ctxnum] = gts;
728 __set_bit(gts->ts_ctxnum, &gru->gs_context_map);
729 spin_unlock(&gru->gs_lock);
730
731 STAT(assign_context);
732 gru_dbg(grudev,
733 "gseg %p, gts %p, gru %x, ctx %d, cbr %d, dsr %d\n",
734 gseg_virtual_address(gts->ts_gru, gts->ts_ctxnum), gts,
735 gts->ts_gru->gs_gid, gts->ts_ctxnum,
736 gts->ts_cbr_au_count, gts->ts_dsr_au_count);
737 } else {
738 gru_dbg(grudev, "failed to allocate a GTS %s\n", "");
739 STAT(assign_context_failed);
740 }
741
742 preempt_enable();
743 return gru;
744}
745
746/*
747 * gru_nopage
748 *
749 * Map the user's GRU segment
750 *
751 * Note: gru segments alway mmaped on GRU_GSEG_PAGESIZE boundaries.
752 */
753int gru_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
754{
755 struct gru_thread_state *gts;
756 unsigned long paddr, vaddr;
757
758 vaddr = (unsigned long)vmf->virtual_address;
759 gru_dbg(grudev, "vma %p, vaddr 0x%lx (0x%lx)\n",
760 vma, vaddr, GSEG_BASE(vaddr));
761 STAT(nopfn);
762
763 /* The following check ensures vaddr is a valid address in the VMA */
764 gts = gru_find_thread_state(vma, TSID(vaddr, vma));
765 if (!gts)
766 return VM_FAULT_SIGBUS;
767
768again:
769 preempt_disable();
770 mutex_lock(&gts->ts_ctxlock);
771 if (gts->ts_gru) {
772 if (gts->ts_gru->gs_blade_id != uv_numa_blade_id()) {
773 STAT(migrated_nopfn_unload);
774 gru_unload_context(gts, 1);
775 } else {
776 if (gru_retarget_intr(gts))
777 STAT(migrated_nopfn_retarget);
778 }
779 }
780
781 if (!gts->ts_gru) {
782 if (!gru_assign_gru_context(gts)) {
783 mutex_unlock(&gts->ts_ctxlock);
784 preempt_enable();
785 schedule_timeout(GRU_ASSIGN_DELAY); /* true hack ZZZ */
786 if (gts->ts_steal_jiffies + GRU_STEAL_DELAY < jiffies)
787 gru_steal_context(gts);
788 goto again;
789 }
790 gru_load_context(gts);
791 paddr = gseg_physical_address(gts->ts_gru, gts->ts_ctxnum);
792 remap_pfn_range(vma, vaddr & ~(GRU_GSEG_PAGESIZE - 1),
793 paddr >> PAGE_SHIFT, GRU_GSEG_PAGESIZE,
794 vma->vm_page_prot);
795 }
796
797 mutex_unlock(&gts->ts_ctxlock);
798 preempt_enable();
799
800 return VM_FAULT_NOPAGE;
801}
802
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c
new file mode 100644
index 000000000000..533923f83f1a
--- /dev/null
+++ b/drivers/misc/sgi-gru/gruprocfs.c
@@ -0,0 +1,336 @@
1/*
2 * SN Platform GRU Driver
3 *
4 * PROC INTERFACES
5 *
6 * This file supports the /proc interfaces for the GRU driver
7 *
8 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#include <linux/proc_fs.h>
26#include <linux/device.h>
27#include <linux/seq_file.h>
28#include <linux/uaccess.h>
29#include "gru.h"
30#include "grulib.h"
31#include "grutables.h"
32
33#define printstat(s, f) printstat_val(s, &gru_stats.f, #f)
34
35static void printstat_val(struct seq_file *s, atomic_long_t *v, char *id)
36{
37 unsigned long val = atomic_long_read(v);
38
39 if (val)
40 seq_printf(s, "%16lu %s\n", val, id);
41}
42
43static int statistics_show(struct seq_file *s, void *p)
44{
45 printstat(s, vdata_alloc);
46 printstat(s, vdata_free);
47 printstat(s, gts_alloc);
48 printstat(s, gts_free);
49 printstat(s, vdata_double_alloc);
50 printstat(s, gts_double_allocate);
51 printstat(s, assign_context);
52 printstat(s, assign_context_failed);
53 printstat(s, free_context);
54 printstat(s, load_context);
55 printstat(s, unload_context);
56 printstat(s, steal_context);
57 printstat(s, steal_context_failed);
58 printstat(s, nopfn);
59 printstat(s, break_cow);
60 printstat(s, asid_new);
61 printstat(s, asid_next);
62 printstat(s, asid_wrap);
63 printstat(s, asid_reuse);
64 printstat(s, intr);
65 printstat(s, call_os);
66 printstat(s, call_os_check_for_bug);
67 printstat(s, call_os_wait_queue);
68 printstat(s, user_flush_tlb);
69 printstat(s, user_unload_context);
70 printstat(s, user_exception);
71 printstat(s, set_task_slice);
72 printstat(s, migrate_check);
73 printstat(s, migrated_retarget);
74 printstat(s, migrated_unload);
75 printstat(s, migrated_unload_delay);
76 printstat(s, migrated_nopfn_retarget);
77 printstat(s, migrated_nopfn_unload);
78 printstat(s, tlb_dropin);
79 printstat(s, tlb_dropin_fail_no_asid);
80 printstat(s, tlb_dropin_fail_upm);
81 printstat(s, tlb_dropin_fail_invalid);
82 printstat(s, tlb_dropin_fail_range_active);
83 printstat(s, tlb_dropin_fail_idle);
84 printstat(s, tlb_dropin_fail_fmm);
85 printstat(s, mmu_invalidate_range);
86 printstat(s, mmu_invalidate_page);
87 printstat(s, mmu_clear_flush_young);
88 printstat(s, flush_tlb);
89 printstat(s, flush_tlb_gru);
90 printstat(s, flush_tlb_gru_tgh);
91 printstat(s, flush_tlb_gru_zero_asid);
92 printstat(s, copy_gpa);
93 printstat(s, mesq_receive);
94 printstat(s, mesq_receive_none);
95 printstat(s, mesq_send);
96 printstat(s, mesq_send_failed);
97 printstat(s, mesq_noop);
98 printstat(s, mesq_send_unexpected_error);
99 printstat(s, mesq_send_lb_overflow);
100 printstat(s, mesq_send_qlimit_reached);
101 printstat(s, mesq_send_amo_nacked);
102 printstat(s, mesq_send_put_nacked);
103 printstat(s, mesq_qf_not_full);
104 printstat(s, mesq_qf_locked);
105 printstat(s, mesq_qf_noop_not_full);
106 printstat(s, mesq_qf_switch_head_failed);
107 printstat(s, mesq_qf_unexpected_error);
108 printstat(s, mesq_noop_unexpected_error);
109 printstat(s, mesq_noop_lb_overflow);
110 printstat(s, mesq_noop_qlimit_reached);
111 printstat(s, mesq_noop_amo_nacked);
112 printstat(s, mesq_noop_put_nacked);
113 return 0;
114}
115
116static ssize_t statistics_write(struct file *file, const char __user *userbuf,
117 size_t count, loff_t *data)
118{
119 memset(&gru_stats, 0, sizeof(gru_stats));
120 return count;
121}
122
123static int options_show(struct seq_file *s, void *p)
124{
125 seq_printf(s, "0x%lx\n", gru_options);
126 return 0;
127}
128
129static ssize_t options_write(struct file *file, const char __user *userbuf,
130 size_t count, loff_t *data)
131{
132 unsigned long val;
133 char buf[80];
134
135 if (copy_from_user
136 (buf, userbuf, count < sizeof(buf) ? count : sizeof(buf)))
137 return -EFAULT;
138 if (!strict_strtoul(buf, 10, &val))
139 gru_options = val;
140
141 return count;
142}
143
144static int cch_seq_show(struct seq_file *file, void *data)
145{
146 long gid = *(long *)data;
147 int i;
148 struct gru_state *gru = GID_TO_GRU(gid);
149 struct gru_thread_state *ts;
150 const char *mode[] = { "??", "UPM", "INTR", "OS_POLL" };
151
152 if (gid == 0)
153 seq_printf(file, "#%5s%5s%6s%9s%6s%8s%8s\n", "gid", "bid",
154 "ctx#", "pid", "cbrs", "dsbytes", "mode");
155 if (gru)
156 for (i = 0; i < GRU_NUM_CCH; i++) {
157 ts = gru->gs_gts[i];
158 if (!ts)
159 continue;
160 seq_printf(file, " %5d%5d%6d%9d%6d%8d%8s\n",
161 gru->gs_gid, gru->gs_blade_id, i,
162 ts->ts_tgid_owner,
163 ts->ts_cbr_au_count * GRU_CBR_AU_SIZE,
164 ts->ts_cbr_au_count * GRU_DSR_AU_BYTES,
165 mode[ts->ts_user_options &
166 GRU_OPT_MISS_MASK]);
167 }
168
169 return 0;
170}
171
172static int gru_seq_show(struct seq_file *file, void *data)
173{
174 long gid = *(long *)data, ctxfree, cbrfree, dsrfree;
175 struct gru_state *gru = GID_TO_GRU(gid);
176
177 if (gid == 0) {
178 seq_printf(file, "#%5s%5s%7s%6s%6s%8s%6s%6s\n", "gid", "nid",
179 "ctx", "cbr", "dsr", "ctx", "cbr", "dsr");
180 seq_printf(file, "#%5s%5s%7s%6s%6s%8s%6s%6s\n", "", "", "busy",
181 "busy", "busy", "free", "free", "free");
182 }
183 if (gru) {
184 ctxfree = GRU_NUM_CCH - gru->gs_active_contexts;
185 cbrfree = hweight64(gru->gs_cbr_map) * GRU_CBR_AU_SIZE;
186 dsrfree = hweight64(gru->gs_dsr_map) * GRU_DSR_AU_BYTES;
187 seq_printf(file, " %5d%5d%7ld%6ld%6ld%8ld%6ld%6ld\n",
188 gru->gs_gid, gru->gs_blade_id, GRU_NUM_CCH - ctxfree,
189 GRU_NUM_CBE - cbrfree, GRU_NUM_DSR_BYTES - dsrfree,
190 ctxfree, cbrfree, dsrfree);
191 }
192
193 return 0;
194}
195
196static void seq_stop(struct seq_file *file, void *data)
197{
198}
199
200static void *seq_start(struct seq_file *file, loff_t *gid)
201{
202 if (*gid < GRU_MAX_GRUS)
203 return gid;
204 return NULL;
205}
206
207static void *seq_next(struct seq_file *file, void *data, loff_t *gid)
208{
209 (*gid)++;
210 if (*gid < GRU_MAX_GRUS)
211 return gid;
212 return NULL;
213}
214
215static const struct seq_operations cch_seq_ops = {
216 .start = seq_start,
217 .next = seq_next,
218 .stop = seq_stop,
219 .show = cch_seq_show
220};
221
222static const struct seq_operations gru_seq_ops = {
223 .start = seq_start,
224 .next = seq_next,
225 .stop = seq_stop,
226 .show = gru_seq_show
227};
228
229static int statistics_open(struct inode *inode, struct file *file)
230{
231 return single_open(file, statistics_show, NULL);
232}
233
234static int options_open(struct inode *inode, struct file *file)
235{
236 return single_open(file, options_show, NULL);
237}
238
239static int cch_open(struct inode *inode, struct file *file)
240{
241 return seq_open(file, &cch_seq_ops);
242}
243
244static int gru_open(struct inode *inode, struct file *file)
245{
246 return seq_open(file, &gru_seq_ops);
247}
248
249/* *INDENT-OFF* */
250static const struct file_operations statistics_fops = {
251 .open = statistics_open,
252 .read = seq_read,
253 .write = statistics_write,
254 .llseek = seq_lseek,
255 .release = single_release,
256};
257
258static const struct file_operations options_fops = {
259 .open = options_open,
260 .read = seq_read,
261 .write = options_write,
262 .llseek = seq_lseek,
263 .release = single_release,
264};
265
266static const struct file_operations cch_fops = {
267 .open = cch_open,
268 .read = seq_read,
269 .llseek = seq_lseek,
270 .release = seq_release,
271};
272static const struct file_operations gru_fops = {
273 .open = gru_open,
274 .read = seq_read,
275 .llseek = seq_lseek,
276 .release = seq_release,
277};
278
279static struct proc_entry {
280 char *name;
281 int mode;
282 const struct file_operations *fops;
283 struct proc_dir_entry *entry;
284} proc_files[] = {
285 {"statistics", 0644, &statistics_fops},
286 {"debug_options", 0644, &options_fops},
287 {"cch_status", 0444, &cch_fops},
288 {"gru_status", 0444, &gru_fops},
289 {NULL}
290};
291/* *INDENT-ON* */
292
293static struct proc_dir_entry *proc_gru __read_mostly;
294
295static int create_proc_file(struct proc_entry *p)
296{
297 p->entry = create_proc_entry(p->name, p->mode, proc_gru);
298 if (!p->entry)
299 return -1;
300 p->entry->proc_fops = p->fops;
301 return 0;
302}
303
304static void delete_proc_files(void)
305{
306 struct proc_entry *p;
307
308 if (proc_gru) {
309 for (p = proc_files; p->name; p++)
310 if (p->entry)
311 remove_proc_entry(p->name, proc_gru);
312 remove_proc_entry("gru", NULL);
313 }
314}
315
316int gru_proc_init(void)
317{
318 struct proc_entry *p;
319
320 proc_mkdir("sgi_uv", NULL);
321 proc_gru = proc_mkdir("sgi_uv/gru", NULL);
322
323 for (p = proc_files; p->name; p++)
324 if (create_proc_file(p))
325 goto err;
326 return 0;
327
328err:
329 delete_proc_files();
330 return -1;
331}
332
333void gru_proc_exit(void)
334{
335 delete_proc_files();
336}
diff --git a/drivers/misc/sgi-gru/grutables.h b/drivers/misc/sgi-gru/grutables.h
new file mode 100644
index 000000000000..4251018f70ff
--- /dev/null
+++ b/drivers/misc/sgi-gru/grutables.h
@@ -0,0 +1,609 @@
1/*
2 * SN Platform GRU Driver
3 *
4 * GRU DRIVER TABLES, MACROS, externs, etc
5 *
6 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
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#ifndef __GRUTABLES_H__
24#define __GRUTABLES_H__
25
26/*
27 * GRU Chiplet:
28 * The GRU is a user addressible memory accelerator. It provides
29 * several forms of load, store, memset, bcopy instructions. In addition, it
30 * contains special instructions for AMOs, sending messages to message
31 * queues, etc.
32 *
33 * The GRU is an integral part of the node controller. It connects
34 * directly to the cpu socket. In its current implementation, there are 2
35 * GRU chiplets in the node controller on each blade (~node).
36 *
37 * The entire GRU memory space is fully coherent and cacheable by the cpus.
38 *
39 * Each GRU chiplet has a physical memory map that looks like the following:
40 *
41 * +-----------------+
42 * |/////////////////|
43 * |/////////////////|
44 * |/////////////////|
45 * |/////////////////|
46 * |/////////////////|
47 * |/////////////////|
48 * |/////////////////|
49 * |/////////////////|
50 * +-----------------+
51 * | system control |
52 * +-----------------+ _______ +-------------+
53 * |/////////////////| / | |
54 * |/////////////////| / | |
55 * |/////////////////| / | instructions|
56 * |/////////////////| / | |
57 * |/////////////////| / | |
58 * |/////////////////| / |-------------|
59 * |/////////////////| / | |
60 * +-----------------+ | |
61 * | context 15 | | data |
62 * +-----------------+ | |
63 * | ...... | \ | |
64 * +-----------------+ \____________ +-------------+
65 * | context 1 |
66 * +-----------------+
67 * | context 0 |
68 * +-----------------+
69 *
70 * Each of the "contexts" is a chunk of memory that can be mmaped into user
71 * space. The context consists of 2 parts:
72 *
73 * - an instruction space that can be directly accessed by the user
74 * to issue GRU instructions and to check instruction status.
75 *
76 * - a data area that acts as normal RAM.
77 *
78 * User instructions contain virtual addresses of data to be accessed by the
79 * GRU. The GRU contains a TLB that is used to convert these user virtual
80 * addresses to physical addresses.
81 *
82 * The "system control" area of the GRU chiplet is used by the kernel driver
83 * to manage user contexts and to perform functions such as TLB dropin and
84 * purging.
85 *
86 * One context may be reserved for the kernel and used for cross-partition
87 * communication. The GRU will also be used to asynchronously zero out
88 * large blocks of memory (not currently implemented).
89 *
90 *
91 * Tables:
92 *
93 * VDATA-VMA Data - Holds a few parameters. Head of linked list of
94 * GTS tables for threads using the GSEG
95 * GTS - Gru Thread State - contains info for managing a GSEG context. A
96 * GTS is allocated for each thread accessing a
97 * GSEG.
98 * GTD - GRU Thread Data - contains shadow copy of GRU data when GSEG is
99 * not loaded into a GRU
100 * GMS - GRU Memory Struct - Used to manage TLB shootdowns. Tracks GRUs
101 * where a GSEG has been loaded. Similar to
102 * an mm_struct but for GRU.
103 *
104 * GS - GRU State - Used to manage the state of a GRU chiplet
105 * BS - Blade State - Used to manage state of all GRU chiplets
106 * on a blade
107 *
108 *
109 * Normal task tables for task using GRU.
110 * - 2 threads in process
111 * - 2 GSEGs open in process
112 * - GSEG1 is being used by both threads
113 * - GSEG2 is used only by thread 2
114 *
115 * task -->|
116 * task ---+---> mm ->------ (notifier) -------+-> gms
117 * | |
118 * |--> vma -> vdata ---> gts--->| GSEG1 (thread1)
119 * | | |
120 * | +-> gts--->| GSEG1 (thread2)
121 * | |
122 * |--> vma -> vdata ---> gts--->| GSEG2 (thread2)
123 * .
124 * .
125 *
126 * GSEGs are marked DONTCOPY on fork
127 *
128 * At open
129 * file.private_data -> NULL
130 *
131 * At mmap,
132 * vma -> vdata
133 *
134 * After gseg reference
135 * vma -> vdata ->gts
136 *
137 * After fork
138 * parent
139 * vma -> vdata -> gts
140 * child
141 * (vma is not copied)
142 *
143 */
144
145#include <linux/rmap.h>
146#include <linux/interrupt.h>
147#include <linux/mutex.h>
148#include <linux/wait.h>
149#include <linux/mmu_notifier.h>
150#include "gru.h"
151#include "gruhandles.h"
152
153extern struct gru_stats_s gru_stats;
154extern struct gru_blade_state *gru_base[];
155extern unsigned long gru_start_paddr, gru_end_paddr;
156
157#define GRU_MAX_BLADES MAX_NUMNODES
158#define GRU_MAX_GRUS (GRU_MAX_BLADES * GRU_CHIPLETS_PER_BLADE)
159
160#define GRU_DRIVER_ID_STR "SGI GRU Device Driver"
161#define GRU_DRIVER_VERSION_STR "0.80"
162
163/*
164 * GRU statistics.
165 */
166struct gru_stats_s {
167 atomic_long_t vdata_alloc;
168 atomic_long_t vdata_free;
169 atomic_long_t gts_alloc;
170 atomic_long_t gts_free;
171 atomic_long_t vdata_double_alloc;
172 atomic_long_t gts_double_allocate;
173 atomic_long_t assign_context;
174 atomic_long_t assign_context_failed;
175 atomic_long_t free_context;
176 atomic_long_t load_context;
177 atomic_long_t unload_context;
178 atomic_long_t steal_context;
179 atomic_long_t steal_context_failed;
180 atomic_long_t nopfn;
181 atomic_long_t break_cow;
182 atomic_long_t asid_new;
183 atomic_long_t asid_next;
184 atomic_long_t asid_wrap;
185 atomic_long_t asid_reuse;
186 atomic_long_t intr;
187 atomic_long_t call_os;
188 atomic_long_t call_os_check_for_bug;
189 atomic_long_t call_os_wait_queue;
190 atomic_long_t user_flush_tlb;
191 atomic_long_t user_unload_context;
192 atomic_long_t user_exception;
193 atomic_long_t set_task_slice;
194 atomic_long_t migrate_check;
195 atomic_long_t migrated_retarget;
196 atomic_long_t migrated_unload;
197 atomic_long_t migrated_unload_delay;
198 atomic_long_t migrated_nopfn_retarget;
199 atomic_long_t migrated_nopfn_unload;
200 atomic_long_t tlb_dropin;
201 atomic_long_t tlb_dropin_fail_no_asid;
202 atomic_long_t tlb_dropin_fail_upm;
203 atomic_long_t tlb_dropin_fail_invalid;
204 atomic_long_t tlb_dropin_fail_range_active;
205 atomic_long_t tlb_dropin_fail_idle;
206 atomic_long_t tlb_dropin_fail_fmm;
207 atomic_long_t mmu_invalidate_range;
208 atomic_long_t mmu_invalidate_page;
209 atomic_long_t mmu_clear_flush_young;
210 atomic_long_t flush_tlb;
211 atomic_long_t flush_tlb_gru;
212 atomic_long_t flush_tlb_gru_tgh;
213 atomic_long_t flush_tlb_gru_zero_asid;
214
215 atomic_long_t copy_gpa;
216
217 atomic_long_t mesq_receive;
218 atomic_long_t mesq_receive_none;
219 atomic_long_t mesq_send;
220 atomic_long_t mesq_send_failed;
221 atomic_long_t mesq_noop;
222 atomic_long_t mesq_send_unexpected_error;
223 atomic_long_t mesq_send_lb_overflow;
224 atomic_long_t mesq_send_qlimit_reached;
225 atomic_long_t mesq_send_amo_nacked;
226 atomic_long_t mesq_send_put_nacked;
227 atomic_long_t mesq_qf_not_full;
228 atomic_long_t mesq_qf_locked;
229 atomic_long_t mesq_qf_noop_not_full;
230 atomic_long_t mesq_qf_switch_head_failed;
231 atomic_long_t mesq_qf_unexpected_error;
232 atomic_long_t mesq_noop_unexpected_error;
233 atomic_long_t mesq_noop_lb_overflow;
234 atomic_long_t mesq_noop_qlimit_reached;
235 atomic_long_t mesq_noop_amo_nacked;
236 atomic_long_t mesq_noop_put_nacked;
237
238};
239
240#define OPT_DPRINT 1
241#define OPT_STATS 2
242#define GRU_QUICKLOOK 4
243
244
245#define IRQ_GRU 110 /* Starting IRQ number for interrupts */
246
247/* Delay in jiffies between attempts to assign a GRU context */
248#define GRU_ASSIGN_DELAY ((HZ * 20) / 1000)
249
250/*
251 * If a process has it's context stolen, min delay in jiffies before trying to
252 * steal a context from another process.
253 */
254#define GRU_STEAL_DELAY ((HZ * 200) / 1000)
255
256#define STAT(id) do { \
257 if (gru_options & OPT_STATS) \
258 atomic_long_inc(&gru_stats.id); \
259 } while (0)
260
261#ifdef CONFIG_SGI_GRU_DEBUG
262#define gru_dbg(dev, fmt, x...) \
263 do { \
264 if (gru_options & OPT_DPRINT) \
265 dev_dbg(dev, "%s: " fmt, __func__, x); \
266 } while (0)
267#else
268#define gru_dbg(x...)
269#endif
270
271/*-----------------------------------------------------------------------------
272 * ASID management
273 */
274#define MAX_ASID 0xfffff0
275#define MIN_ASID 8
276#define ASID_INC 8 /* number of regions */
277
278/* Generate a GRU asid value from a GRU base asid & a virtual address. */
279#if defined CONFIG_IA64
280#define VADDR_HI_BIT 64
281#define GRUREGION(addr) ((addr) >> (VADDR_HI_BIT - 3) & 3)
282#elif defined __x86_64
283#define VADDR_HI_BIT 48
284#define GRUREGION(addr) (0) /* ZZZ could do better */
285#else
286#error "Unsupported architecture"
287#endif
288#define GRUASID(asid, addr) ((asid) + GRUREGION(addr))
289
290/*------------------------------------------------------------------------------
291 * File & VMS Tables
292 */
293
294struct gru_state;
295
296/*
297 * This structure is pointed to from the mmstruct via the notifier pointer.
298 * There is one of these per address space.
299 */
300struct gru_mm_tracker {
301 unsigned int mt_asid_gen; /* ASID wrap count */
302 int mt_asid; /* current base ASID for gru */
303 unsigned short mt_ctxbitmap; /* bitmap of contexts using
304 asid */
305};
306
307struct gru_mm_struct {
308 struct mmu_notifier ms_notifier;
309 atomic_t ms_refcnt;
310 spinlock_t ms_asid_lock; /* protects ASID assignment */
311 atomic_t ms_range_active;/* num range_invals active */
312 char ms_released;
313 wait_queue_head_t ms_wait_queue;
314 DECLARE_BITMAP(ms_asidmap, GRU_MAX_GRUS);
315 struct gru_mm_tracker ms_asids[GRU_MAX_GRUS];
316};
317
318/*
319 * One of these structures is allocated when a GSEG is mmaped. The
320 * structure is pointed to by the vma->vm_private_data field in the vma struct.
321 */
322struct gru_vma_data {
323 spinlock_t vd_lock; /* Serialize access to vma */
324 struct list_head vd_head; /* head of linked list of gts */
325 long vd_user_options;/* misc user option flags */
326 int vd_cbr_au_count;
327 int vd_dsr_au_count;
328};
329
330/*
331 * One of these is allocated for each thread accessing a mmaped GRU. A linked
332 * list of these structure is hung off the struct gru_vma_data in the mm_struct.
333 */
334struct gru_thread_state {
335 struct list_head ts_next; /* list - head at vma-private */
336 struct mutex ts_ctxlock; /* load/unload CTX lock */
337 struct mm_struct *ts_mm; /* mm currently mapped to
338 context */
339 struct vm_area_struct *ts_vma; /* vma of GRU context */
340 struct gru_state *ts_gru; /* GRU where the context is
341 loaded */
342 struct gru_mm_struct *ts_gms; /* asid & ioproc struct */
343 unsigned long ts_cbr_map; /* map of allocated CBRs */
344 unsigned long ts_dsr_map; /* map of allocated DATA
345 resources */
346 unsigned long ts_steal_jiffies;/* jiffies when context last
347 stolen */
348 long ts_user_options;/* misc user option flags */
349 pid_t ts_tgid_owner; /* task that is using the
350 context - for migration */
351 int ts_tsid; /* thread that owns the
352 structure */
353 int ts_tlb_int_select;/* target cpu if interrupts
354 enabled */
355 int ts_ctxnum; /* context number where the
356 context is loaded */
357 atomic_t ts_refcnt; /* reference count GTS */
358 unsigned char ts_dsr_au_count;/* Number of DSR resources
359 required for contest */
360 unsigned char ts_cbr_au_count;/* Number of CBR resources
361 required for contest */
362 char ts_force_unload;/* force context to be unloaded
363 after migration */
364 char ts_cbr_idx[GRU_CBR_AU];/* CBR numbers of each
365 allocated CB */
366 unsigned long ts_gdata[0]; /* save area for GRU data (CB,
367 DS, CBE) */
368};
369
370/*
371 * Threaded programs actually allocate an array of GSEGs when a context is
372 * created. Each thread uses a separate GSEG. TSID is the index into the GSEG
373 * array.
374 */
375#define TSID(a, v) (((a) - (v)->vm_start) / GRU_GSEG_PAGESIZE)
376#define UGRUADDR(gts) ((gts)->ts_vma->vm_start + \
377 (gts)->ts_tsid * GRU_GSEG_PAGESIZE)
378
379#define NULLCTX (-1) /* if context not loaded into GRU */
380
381/*-----------------------------------------------------------------------------
382 * GRU State Tables
383 */
384
385/*
386 * One of these exists for each GRU chiplet.
387 */
388struct gru_state {
389 struct gru_blade_state *gs_blade; /* GRU state for entire
390 blade */
391 unsigned long gs_gru_base_paddr; /* Physical address of
392 gru segments (64) */
393 void *gs_gru_base_vaddr; /* Virtual address of
394 gru segments (64) */
395 unsigned char gs_gid; /* unique GRU number */
396 unsigned char gs_tgh_local_shift; /* used to pick TGH for
397 local flush */
398 unsigned char gs_tgh_first_remote; /* starting TGH# for
399 remote flush */
400 unsigned short gs_blade_id; /* blade of GRU */
401 spinlock_t gs_asid_lock; /* lock used for
402 assigning asids */
403 spinlock_t gs_lock; /* lock used for
404 assigning contexts */
405
406 /* -- the following are protected by the gs_asid_lock spinlock ---- */
407 unsigned int gs_asid; /* Next availe ASID */
408 unsigned int gs_asid_limit; /* Limit of available
409 ASIDs */
410 unsigned int gs_asid_gen; /* asid generation.
411 Inc on wrap */
412
413 /* --- the following fields are protected by the gs_lock spinlock --- */
414 unsigned long gs_context_map; /* bitmap to manage
415 contexts in use */
416 unsigned long gs_cbr_map; /* bitmap to manage CB
417 resources */
418 unsigned long gs_dsr_map; /* bitmap used to manage
419 DATA resources */
420 unsigned int gs_reserved_cbrs; /* Number of kernel-
421 reserved cbrs */
422 unsigned int gs_reserved_dsr_bytes; /* Bytes of kernel-
423 reserved dsrs */
424 unsigned short gs_active_contexts; /* number of contexts
425 in use */
426 struct gru_thread_state *gs_gts[GRU_NUM_CCH]; /* GTS currently using
427 the context */
428};
429
430/*
431 * This structure contains the GRU state for all the GRUs on a blade.
432 */
433struct gru_blade_state {
434 void *kernel_cb; /* First kernel
435 reserved cb */
436 void *kernel_dsr; /* First kernel
437 reserved DSR */
438 /* ---- the following are protected by the bs_lock spinlock ---- */
439 spinlock_t bs_lock; /* lock used for
440 stealing contexts */
441 int bs_lru_ctxnum; /* STEAL - last context
442 stolen */
443 struct gru_state *bs_lru_gru; /* STEAL - last gru
444 stolen */
445
446 struct gru_state bs_grus[GRU_CHIPLETS_PER_BLADE];
447};
448
449/*-----------------------------------------------------------------------------
450 * Address Primitives
451 */
452#define get_tfm_for_cpu(g, c) \
453 ((struct gru_tlb_fault_map *)get_tfm((g)->gs_gru_base_vaddr, (c)))
454#define get_tfh_by_index(g, i) \
455 ((struct gru_tlb_fault_handle *)get_tfh((g)->gs_gru_base_vaddr, (i)))
456#define get_tgh_by_index(g, i) \
457 ((struct gru_tlb_global_handle *)get_tgh((g)->gs_gru_base_vaddr, (i)))
458#define get_cbe_by_index(g, i) \
459 ((struct gru_control_block_extended *)get_cbe((g)->gs_gru_base_vaddr,\
460 (i)))
461
462/*-----------------------------------------------------------------------------
463 * Useful Macros
464 */
465
466/* Given a blade# & chiplet#, get a pointer to the GRU */
467#define get_gru(b, c) (&gru_base[b]->bs_grus[c])
468
469/* Number of bytes to save/restore when unloading/loading GRU contexts */
470#define DSR_BYTES(dsr) ((dsr) * GRU_DSR_AU_BYTES)
471#define CBR_BYTES(cbr) ((cbr) * GRU_HANDLE_BYTES * GRU_CBR_AU_SIZE * 2)
472
473/* Convert a user CB number to the actual CBRNUM */
474#define thread_cbr_number(gts, n) ((gts)->ts_cbr_idx[(n) / GRU_CBR_AU_SIZE] \
475 * GRU_CBR_AU_SIZE + (n) % GRU_CBR_AU_SIZE)
476
477/* Convert a gid to a pointer to the GRU */
478#define GID_TO_GRU(gid) \
479 (gru_base[(gid) / GRU_CHIPLETS_PER_BLADE] ? \
480 (&gru_base[(gid) / GRU_CHIPLETS_PER_BLADE]-> \
481 bs_grus[(gid) % GRU_CHIPLETS_PER_BLADE]) : \
482 NULL)
483
484/* Scan all active GRUs in a GRU bitmap */
485#define for_each_gru_in_bitmap(gid, map) \
486 for ((gid) = find_first_bit((map), GRU_MAX_GRUS); (gid) < GRU_MAX_GRUS;\
487 (gid)++, (gid) = find_next_bit((map), GRU_MAX_GRUS, (gid)))
488
489/* Scan all active GRUs on a specific blade */
490#define for_each_gru_on_blade(gru, nid, i) \
491 for ((gru) = gru_base[nid]->bs_grus, (i) = 0; \
492 (i) < GRU_CHIPLETS_PER_BLADE; \
493 (i)++, (gru)++)
494
495/* Scan all active GTSs on a gru. Note: must hold ss_lock to use this macro. */
496#define for_each_gts_on_gru(gts, gru, ctxnum) \
497 for ((ctxnum) = 0; (ctxnum) < GRU_NUM_CCH; (ctxnum)++) \
498 if (((gts) = (gru)->gs_gts[ctxnum]))
499
500/* Scan each CBR whose bit is set in a TFM (or copy of) */
501#define for_each_cbr_in_tfm(i, map) \
502 for ((i) = find_first_bit(map, GRU_NUM_CBE); \
503 (i) < GRU_NUM_CBE; \
504 (i)++, (i) = find_next_bit(map, GRU_NUM_CBE, i))
505
506/* Scan each CBR in a CBR bitmap. Note: multiple CBRs in an allocation unit */
507#define for_each_cbr_in_allocation_map(i, map, k) \
508 for ((k) = find_first_bit(map, GRU_CBR_AU); (k) < GRU_CBR_AU; \
509 (k) = find_next_bit(map, GRU_CBR_AU, (k) + 1)) \
510 for ((i) = (k)*GRU_CBR_AU_SIZE; \
511 (i) < ((k) + 1) * GRU_CBR_AU_SIZE; (i)++)
512
513/* Scan each DSR in a DSR bitmap. Note: multiple DSRs in an allocation unit */
514#define for_each_dsr_in_allocation_map(i, map, k) \
515 for ((k) = find_first_bit((const unsigned long *)map, GRU_DSR_AU);\
516 (k) < GRU_DSR_AU; \
517 (k) = find_next_bit((const unsigned long *)map, \
518 GRU_DSR_AU, (k) + 1)) \
519 for ((i) = (k) * GRU_DSR_AU_CL; \
520 (i) < ((k) + 1) * GRU_DSR_AU_CL; (i)++)
521
522#define gseg_physical_address(gru, ctxnum) \
523 ((gru)->gs_gru_base_paddr + ctxnum * GRU_GSEG_STRIDE)
524#define gseg_virtual_address(gru, ctxnum) \
525 ((gru)->gs_gru_base_vaddr + ctxnum * GRU_GSEG_STRIDE)
526
527/*-----------------------------------------------------------------------------
528 * Lock / Unlock GRU handles
529 * Use the "delresp" bit in the handle as a "lock" bit.
530 */
531
532/* Lock hierarchy checking enabled only in emulator */
533
534static inline void __lock_handle(void *h)
535{
536 while (test_and_set_bit(1, h))
537 cpu_relax();
538}
539
540static inline void __unlock_handle(void *h)
541{
542 clear_bit(1, h);
543}
544
545static inline void lock_cch_handle(struct gru_context_configuration_handle *cch)
546{
547 __lock_handle(cch);
548}
549
550static inline void unlock_cch_handle(struct gru_context_configuration_handle
551 *cch)
552{
553 __unlock_handle(cch);
554}
555
556static inline void lock_tgh_handle(struct gru_tlb_global_handle *tgh)
557{
558 __lock_handle(tgh);
559}
560
561static inline void unlock_tgh_handle(struct gru_tlb_global_handle *tgh)
562{
563 __unlock_handle(tgh);
564}
565
566/*-----------------------------------------------------------------------------
567 * Function prototypes & externs
568 */
569struct gru_unload_context_req;
570
571extern struct vm_operations_struct gru_vm_ops;
572extern struct device *grudev;
573
574extern struct gru_vma_data *gru_alloc_vma_data(struct vm_area_struct *vma,
575 int tsid);
576extern struct gru_thread_state *gru_find_thread_state(struct vm_area_struct
577 *vma, int tsid);
578extern struct gru_thread_state *gru_alloc_thread_state(struct vm_area_struct
579 *vma, int tsid);
580extern void gru_unload_context(struct gru_thread_state *gts, int savestate);
581extern void gts_drop(struct gru_thread_state *gts);
582extern void gru_tgh_flush_init(struct gru_state *gru);
583extern int gru_kservices_init(struct gru_state *gru);
584extern irqreturn_t gru_intr(int irq, void *dev_id);
585extern int gru_handle_user_call_os(unsigned long address);
586extern int gru_user_flush_tlb(unsigned long arg);
587extern int gru_user_unload_context(unsigned long arg);
588extern int gru_get_exception_detail(unsigned long arg);
589extern int gru_set_task_slice(long address);
590extern int gru_cpu_fault_map_id(void);
591extern struct vm_area_struct *gru_find_vma(unsigned long vaddr);
592extern void gru_flush_all_tlb(struct gru_state *gru);
593extern int gru_proc_init(void);
594extern void gru_proc_exit(void);
595
596extern unsigned long gru_reserve_cb_resources(struct gru_state *gru,
597 int cbr_au_count, char *cbmap);
598extern unsigned long gru_reserve_ds_resources(struct gru_state *gru,
599 int dsr_au_count, char *dsmap);
600extern int gru_fault(struct vm_area_struct *, struct vm_fault *vmf);
601extern struct gru_mm_struct *gru_register_mmu_notifier(void);
602extern void gru_drop_mmu_notifier(struct gru_mm_struct *gms);
603
604extern void gru_flush_tlb_range(struct gru_mm_struct *gms, unsigned long start,
605 unsigned long len);
606
607extern unsigned long gru_options;
608
609#endif /* __GRUTABLES_H__ */
diff --git a/drivers/misc/sgi-gru/grutlbpurge.c b/drivers/misc/sgi-gru/grutlbpurge.c
new file mode 100644
index 000000000000..bcfd5425e2e6
--- /dev/null
+++ b/drivers/misc/sgi-gru/grutlbpurge.c
@@ -0,0 +1,372 @@
1/*
2 * SN Platform GRU Driver
3 *
4 * MMUOPS callbacks + TLB flushing
5 *
6 * This file handles emu notifier callbacks from the core kernel. The callbacks
7 * are used to update the TLB in the GRU as a result of changes in the
8 * state of a process address space. This file also handles TLB invalidates
9 * from the GRU driver.
10 *
11 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
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 as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 */
27
28#include <linux/kernel.h>
29#include <linux/list.h>
30#include <linux/spinlock.h>
31#include <linux/mm.h>
32#include <linux/slab.h>
33#include <linux/device.h>
34#include <linux/hugetlb.h>
35#include <linux/delay.h>
36#include <linux/timex.h>
37#include <linux/delay.h>
38#include <linux/srcu.h>
39#include <asm/processor.h>
40#include "gru.h"
41#include "grutables.h"
42#include <asm/uv/uv_hub.h>
43
44#define gru_random() get_cycles()
45
46/* ---------------------------------- TLB Invalidation functions --------
47 * get_tgh_handle
48 *
49 * Find a TGH to use for issuing a TLB invalidate. For GRUs that are on the
50 * local blade, use a fixed TGH that is a function of the blade-local cpu
51 * number. Normally, this TGH is private to the cpu & no contention occurs for
52 * the TGH. For offblade GRUs, select a random TGH in the range above the
53 * private TGHs. A spinlock is required to access this TGH & the lock must be
54 * released when the invalidate is completes. This sucks, but it is the best we
55 * can do.
56 *
57 * Note that the spinlock is IN the TGH handle so locking does not involve
58 * additional cache lines.
59 *
60 */
61static inline int get_off_blade_tgh(struct gru_state *gru)
62{
63 int n;
64
65 n = GRU_NUM_TGH - gru->gs_tgh_first_remote;
66 n = gru_random() % n;
67 n += gru->gs_tgh_first_remote;
68 return n;
69}
70
71static inline int get_on_blade_tgh(struct gru_state *gru)
72{
73 return uv_blade_processor_id() >> gru->gs_tgh_local_shift;
74}
75
76static struct gru_tlb_global_handle *get_lock_tgh_handle(struct gru_state
77 *gru)
78{
79 struct gru_tlb_global_handle *tgh;
80 int n;
81
82 preempt_disable();
83 if (uv_numa_blade_id() == gru->gs_blade_id)
84 n = get_on_blade_tgh(gru);
85 else
86 n = get_off_blade_tgh(gru);
87 tgh = get_tgh_by_index(gru, n);
88 lock_tgh_handle(tgh);
89
90 return tgh;
91}
92
93static void get_unlock_tgh_handle(struct gru_tlb_global_handle *tgh)
94{
95 unlock_tgh_handle(tgh);
96 preempt_enable();
97}
98
99/*
100 * gru_flush_tlb_range
101 *
102 * General purpose TLB invalidation function. This function scans every GRU in
103 * the ENTIRE system (partition) looking for GRUs where the specified MM has
104 * been accessed by the GRU. For each GRU found, the TLB must be invalidated OR
105 * the ASID invalidated. Invalidating an ASID causes a new ASID to be assigned
106 * on the next fault. This effectively flushes the ENTIRE TLB for the MM at the
107 * cost of (possibly) a large number of future TLBmisses.
108 *
109 * The current algorithm is optimized based on the following (somewhat true)
110 * assumptions:
111 * - GRU contexts are not loaded into a GRU unless a reference is made to
112 * the data segment or control block (this is true, not an assumption).
113 * If a DS/CB is referenced, the user will also issue instructions that
114 * cause TLBmisses. It is not necessary to optimize for the case where
115 * contexts are loaded but no instructions cause TLB misses. (I know
116 * this will happen but I'm not optimizing for it).
117 * - GRU instructions to invalidate TLB entries are SLOOOOWWW - normally
118 * a few usec but in unusual cases, it could be longer. Avoid if
119 * possible.
120 * - intrablade process migration between cpus is not frequent but is
121 * common.
122 * - a GRU context is not typically migrated to a different GRU on the
123 * blade because of intrablade migration
124 * - interblade migration is rare. Processes migrate their GRU context to
125 * the new blade.
126 * - if interblade migration occurs, migration back to the original blade
127 * is very very rare (ie., no optimization for this case)
128 * - most GRU instruction operate on a subset of the user REGIONS. Code
129 * & shared library regions are not likely targets of GRU instructions.
130 *
131 * To help improve the efficiency of TLB invalidation, the GMS data
132 * structure is maintained for EACH address space (MM struct). The GMS is
133 * also the structure that contains the pointer to the mmu callout
134 * functions. This structure is linked to the mm_struct for the address space
135 * using the mmu "register" function. The mmu interfaces are used to
136 * provide the callbacks for TLB invalidation. The GMS contains:
137 *
138 * - asid[maxgrus] array. ASIDs are assigned to a GRU when a context is
139 * loaded into the GRU.
140 * - asidmap[maxgrus]. bitmap to make it easier to find non-zero asids in
141 * the above array
142 * - ctxbitmap[maxgrus]. Indicates the contexts that are currently active
143 * in the GRU for the address space. This bitmap must be passed to the
144 * GRU to do an invalidate.
145 *
146 * The current algorithm for invalidating TLBs is:
147 * - scan the asidmap for GRUs where the context has been loaded, ie,
148 * asid is non-zero.
149 * - for each gru found:
150 * - if the ctxtmap is non-zero, there are active contexts in the
151 * GRU. TLB invalidate instructions must be issued to the GRU.
152 * - if the ctxtmap is zero, no context is active. Set the ASID to
153 * zero to force a full TLB invalidation. This is fast but will
154 * cause a lot of TLB misses if the context is reloaded onto the
155 * GRU
156 *
157 */
158
159void gru_flush_tlb_range(struct gru_mm_struct *gms, unsigned long start,
160 unsigned long len)
161{
162 struct gru_state *gru;
163 struct gru_mm_tracker *asids;
164 struct gru_tlb_global_handle *tgh;
165 unsigned long num;
166 int grupagesize, pagesize, pageshift, gid, asid;
167
168 /* ZZZ TODO - handle huge pages */
169 pageshift = PAGE_SHIFT;
170 pagesize = (1UL << pageshift);
171 grupagesize = GRU_PAGESIZE(pageshift);
172 num = min(((len + pagesize - 1) >> pageshift), GRUMAXINVAL);
173
174 STAT(flush_tlb);
175 gru_dbg(grudev, "gms %p, start 0x%lx, len 0x%lx, asidmap 0x%lx\n", gms,
176 start, len, gms->ms_asidmap[0]);
177
178 spin_lock(&gms->ms_asid_lock);
179 for_each_gru_in_bitmap(gid, gms->ms_asidmap) {
180 STAT(flush_tlb_gru);
181 gru = GID_TO_GRU(gid);
182 asids = gms->ms_asids + gid;
183 asid = asids->mt_asid;
184 if (asids->mt_ctxbitmap && asid) {
185 STAT(flush_tlb_gru_tgh);
186 asid = GRUASID(asid, start);
187 gru_dbg(grudev,
188 " FLUSH gruid %d, asid 0x%x, num %ld, cbmap 0x%x\n",
189 gid, asid, num, asids->mt_ctxbitmap);
190 tgh = get_lock_tgh_handle(gru);
191 tgh_invalidate(tgh, start, 0, asid, grupagesize, 0,
192 num - 1, asids->mt_ctxbitmap);
193 get_unlock_tgh_handle(tgh);
194 } else {
195 STAT(flush_tlb_gru_zero_asid);
196 asids->mt_asid = 0;
197 __clear_bit(gru->gs_gid, gms->ms_asidmap);
198 gru_dbg(grudev,
199 " CLEARASID gruid %d, asid 0x%x, cbtmap 0x%x, asidmap 0x%lx\n",
200 gid, asid, asids->mt_ctxbitmap,
201 gms->ms_asidmap[0]);
202 }
203 }
204 spin_unlock(&gms->ms_asid_lock);
205}
206
207/*
208 * Flush the entire TLB on a chiplet.
209 */
210void gru_flush_all_tlb(struct gru_state *gru)
211{
212 struct gru_tlb_global_handle *tgh;
213
214 gru_dbg(grudev, "gru %p, gid %d\n", gru, gru->gs_gid);
215 tgh = get_lock_tgh_handle(gru);
216 tgh_invalidate(tgh, 0, ~0, 0, 1, 1, GRUMAXINVAL - 1, 0);
217 get_unlock_tgh_handle(tgh);
218 preempt_enable();
219}
220
221/*
222 * MMUOPS notifier callout functions
223 */
224static void gru_invalidate_range_start(struct mmu_notifier *mn,
225 struct mm_struct *mm,
226 unsigned long start, unsigned long end)
227{
228 struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
229 ms_notifier);
230
231 STAT(mmu_invalidate_range);
232 atomic_inc(&gms->ms_range_active);
233 gru_dbg(grudev, "gms %p, start 0x%lx, end 0x%lx, act %d\n", gms,
234 start, end, atomic_read(&gms->ms_range_active));
235 gru_flush_tlb_range(gms, start, end - start);
236}
237
238static void gru_invalidate_range_end(struct mmu_notifier *mn,
239 struct mm_struct *mm, unsigned long start,
240 unsigned long end)
241{
242 struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
243 ms_notifier);
244
245 /* ..._and_test() provides needed barrier */
246 (void)atomic_dec_and_test(&gms->ms_range_active);
247
248 wake_up_all(&gms->ms_wait_queue);
249 gru_dbg(grudev, "gms %p, start 0x%lx, end 0x%lx\n", gms, start, end);
250}
251
252static void gru_invalidate_page(struct mmu_notifier *mn, struct mm_struct *mm,
253 unsigned long address)
254{
255 struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
256 ms_notifier);
257
258 STAT(mmu_invalidate_page);
259 gru_flush_tlb_range(gms, address, PAGE_SIZE);
260 gru_dbg(grudev, "gms %p, address 0x%lx\n", gms, address);
261}
262
263static void gru_release(struct mmu_notifier *mn, struct mm_struct *mm)
264{
265 struct gru_mm_struct *gms = container_of(mn, struct gru_mm_struct,
266 ms_notifier);
267
268 gms->ms_released = 1;
269 gru_dbg(grudev, "gms %p\n", gms);
270}
271
272
273static const struct mmu_notifier_ops gru_mmuops = {
274 .invalidate_page = gru_invalidate_page,
275 .invalidate_range_start = gru_invalidate_range_start,
276 .invalidate_range_end = gru_invalidate_range_end,
277 .release = gru_release,
278};
279
280/* Move this to the basic mmu_notifier file. But for now... */
281static struct mmu_notifier *mmu_find_ops(struct mm_struct *mm,
282 const struct mmu_notifier_ops *ops)
283{
284 struct mmu_notifier *mn, *gru_mn = NULL;
285 struct hlist_node *n;
286
287 if (mm->mmu_notifier_mm) {
288 rcu_read_lock();
289 hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_mm->list,
290 hlist)
291 if (mn->ops == ops) {
292 gru_mn = mn;
293 break;
294 }
295 rcu_read_unlock();
296 }
297 return gru_mn;
298}
299
300struct gru_mm_struct *gru_register_mmu_notifier(void)
301{
302 struct gru_mm_struct *gms;
303 struct mmu_notifier *mn;
304
305 mn = mmu_find_ops(current->mm, &gru_mmuops);
306 if (mn) {
307 gms = container_of(mn, struct gru_mm_struct, ms_notifier);
308 atomic_inc(&gms->ms_refcnt);
309 } else {
310 gms = kzalloc(sizeof(*gms), GFP_KERNEL);
311 if (gms) {
312 spin_lock_init(&gms->ms_asid_lock);
313 gms->ms_notifier.ops = &gru_mmuops;
314 atomic_set(&gms->ms_refcnt, 1);
315 init_waitqueue_head(&gms->ms_wait_queue);
316 __mmu_notifier_register(&gms->ms_notifier, current->mm);
317 }
318 }
319 gru_dbg(grudev, "gms %p, refcnt %d\n", gms,
320 atomic_read(&gms->ms_refcnt));
321 return gms;
322}
323
324void gru_drop_mmu_notifier(struct gru_mm_struct *gms)
325{
326 gru_dbg(grudev, "gms %p, refcnt %d, released %d\n", gms,
327 atomic_read(&gms->ms_refcnt), gms->ms_released);
328 if (atomic_dec_return(&gms->ms_refcnt) == 0) {
329 if (!gms->ms_released)
330 mmu_notifier_unregister(&gms->ms_notifier, current->mm);
331 kfree(gms);
332 }
333}
334
335/*
336 * Setup TGH parameters. There are:
337 * - 24 TGH handles per GRU chiplet
338 * - a portion (MAX_LOCAL_TGH) of the handles are reserved for
339 * use by blade-local cpus
340 * - the rest are used by off-blade cpus. This usage is
341 * less frequent than blade-local usage.
342 *
343 * For now, use 16 handles for local flushes, 8 for remote flushes. If the blade
344 * has less tan or equal to 16 cpus, each cpu has a unique handle that it can
345 * use.
346 */
347#define MAX_LOCAL_TGH 16
348
349void gru_tgh_flush_init(struct gru_state *gru)
350{
351 int cpus, shift = 0, n;
352
353 cpus = uv_blade_nr_possible_cpus(gru->gs_blade_id);
354
355 /* n = cpus rounded up to next power of 2 */
356 if (cpus) {
357 n = 1 << fls(cpus - 1);
358
359 /*
360 * shift count for converting local cpu# to TGH index
361 * 0 if cpus <= MAX_LOCAL_TGH,
362 * 1 if cpus <= 2*MAX_LOCAL_TGH,
363 * etc
364 */
365 shift = max(0, fls(n - 1) - fls(MAX_LOCAL_TGH - 1));
366 }
367 gru->gs_tgh_local_shift = shift;
368
369 /* first starting TGH index to use for remote purges */
370 gru->gs_tgh_first_remote = (cpus + (1 << shift) - 1) >> shift;
371
372}
diff --git a/drivers/misc/sgi-xp/Makefile b/drivers/misc/sgi-xp/Makefile
index b6e40a7958ce..35ce28578075 100644
--- a/drivers/misc/sgi-xp/Makefile
+++ b/drivers/misc/sgi-xp/Makefile
@@ -3,9 +3,17 @@
3# 3#
4 4
5obj-$(CONFIG_SGI_XP) += xp.o 5obj-$(CONFIG_SGI_XP) += xp.o
6xp-y := xp_main.o xp_nofault.o 6xp-y := xp_main.o
7xp-$(CONFIG_IA64_SGI_SN2) += xp_sn2.o xp_nofault.o
8xp-$(CONFIG_IA64_GENERIC) += xp_sn2.o xp_nofault.o xp_uv.o
9xp-$(CONFIG_IA64_SGI_UV) += xp_uv.o
10xp-$(CONFIG_X86_64) += xp_uv.o
7 11
8obj-$(CONFIG_SGI_XP) += xpc.o 12obj-$(CONFIG_SGI_XP) += xpc.o
9xpc-y := xpc_main.o xpc_channel.o xpc_partition.o 13xpc-y := xpc_main.o xpc_channel.o xpc_partition.o
14xpc-$(CONFIG_IA64_SGI_SN2) += xpc_sn2.o
15xpc-$(CONFIG_IA64_GENERIC) += xpc_sn2.o xpc_uv.o
16xpc-$(CONFIG_IA64_SGI_UV) += xpc_uv.o
17xpc-$(CONFIG_X86_64) += xpc_uv.o
10 18
11obj-$(CONFIG_SGI_XP) += xpnet.o 19obj-$(CONFIG_SGI_XP) += xpnet.o
diff --git a/drivers/misc/sgi-xp/xp.h b/drivers/misc/sgi-xp/xp.h
index 03a87a307e32..859a5281c61b 100644
--- a/drivers/misc/sgi-xp/xp.h
+++ b/drivers/misc/sgi-xp/xp.h
@@ -13,11 +13,34 @@
13#ifndef _DRIVERS_MISC_SGIXP_XP_H 13#ifndef _DRIVERS_MISC_SGIXP_XP_H
14#define _DRIVERS_MISC_SGIXP_XP_H 14#define _DRIVERS_MISC_SGIXP_XP_H
15 15
16#include <linux/cache.h>
17#include <linux/hardirq.h>
18#include <linux/mutex.h> 16#include <linux/mutex.h>
19#include <asm/sn/types.h> 17
20#include <asm/sn/bte.h> 18#ifdef CONFIG_IA64
19#include <asm/system.h>
20#include <asm/sn/arch.h> /* defines is_shub1() and is_shub2() */
21#define is_shub() ia64_platform_is("sn2")
22#define is_uv() ia64_platform_is("uv")
23#endif
24#ifdef CONFIG_X86_64
25#include <asm/genapic.h>
26#define is_uv() is_uv_system()
27#endif
28
29#ifndef is_shub1
30#define is_shub1() 0
31#endif
32
33#ifndef is_shub2
34#define is_shub2() 0
35#endif
36
37#ifndef is_shub
38#define is_shub() 0
39#endif
40
41#ifndef is_uv
42#define is_uv() 0
43#endif
21 44
22#ifdef USE_DBUG_ON 45#ifdef USE_DBUG_ON
23#define DBUG_ON(condition) BUG_ON(condition) 46#define DBUG_ON(condition) BUG_ON(condition)
@@ -26,133 +49,56 @@
26#endif 49#endif
27 50
28/* 51/*
29 * Define the maximum number of logically defined partitions the system 52 * Define the maximum number of partitions the system can possibly support.
30 * can support. It is constrained by the maximum number of hardware 53 * It is based on the maximum number of hardware partitionable regions. The
31 * partitionable regions. The term 'region' in this context refers to the 54 * term 'region' in this context refers to the minimum number of nodes that
32 * minimum number of nodes that can comprise an access protection grouping. 55 * can comprise an access protection grouping. The access protection is in
33 * The access protection is in regards to memory, IPI and IOI. 56 * regards to memory, IPI and IOI.
34 * 57 *
35 * The maximum number of hardware partitionable regions is equal to the 58 * The maximum number of hardware partitionable regions is equal to the
36 * maximum number of nodes in the entire system divided by the minimum number 59 * maximum number of nodes in the entire system divided by the minimum number
37 * of nodes that comprise an access protection grouping. 60 * of nodes that comprise an access protection grouping.
38 */ 61 */
39#define XP_MAX_PARTITIONS 64 62#define XP_MAX_NPARTITIONS_SN2 64
40 63#define XP_MAX_NPARTITIONS_UV 256
41/*
42 * Define the number of u64s required to represent all the C-brick nasids
43 * as a bitmap. The cross-partition kernel modules deal only with
44 * C-brick nasids, thus the need for bitmaps which don't account for
45 * odd-numbered (non C-brick) nasids.
46 */
47#define XP_MAX_PHYSNODE_ID (MAX_NUMALINK_NODES / 2)
48#define XP_NASID_MASK_BYTES ((XP_MAX_PHYSNODE_ID + 7) / 8)
49#define XP_NASID_MASK_WORDS ((XP_MAX_PHYSNODE_ID + 63) / 64)
50
51/*
52 * Wrapper for bte_copy() that should it return a failure status will retry
53 * the bte_copy() once in the hope that the failure was due to a temporary
54 * aberration (i.e., the link going down temporarily).
55 *
56 * src - physical address of the source of the transfer.
57 * vdst - virtual address of the destination of the transfer.
58 * len - number of bytes to transfer from source to destination.
59 * mode - see bte_copy() for definition.
60 * notification - see bte_copy() for definition.
61 *
62 * Note: xp_bte_copy() should never be called while holding a spinlock.
63 */
64static inline bte_result_t
65xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification)
66{
67 bte_result_t ret;
68 u64 pdst = ia64_tpa(vdst);
69
70 /*
71 * Ensure that the physically mapped memory is contiguous.
72 *
73 * We do this by ensuring that the memory is from region 7 only.
74 * If the need should arise to use memory from one of the other
75 * regions, then modify the BUG_ON() statement to ensure that the
76 * memory from that region is always physically contiguous.
77 */
78 BUG_ON(REGION_NUMBER(vdst) != RGN_KERNEL);
79
80 ret = bte_copy(src, pdst, len, mode, notification);
81 if ((ret != BTE_SUCCESS) && BTE_ERROR_RETRY(ret)) {
82 if (!in_interrupt())
83 cond_resched();
84
85 ret = bte_copy(src, pdst, len, mode, notification);
86 }
87
88 return ret;
89}
90 64
91/* 65/*
92 * XPC establishes channel connections between the local partition and any 66 * XPC establishes channel connections between the local partition and any
93 * other partition that is currently up. Over these channels, kernel-level 67 * other partition that is currently up. Over these channels, kernel-level
94 * `users' can communicate with their counterparts on the other partitions. 68 * `users' can communicate with their counterparts on the other partitions.
95 * 69 *
96 * The maxinum number of channels is limited to eight. For performance reasons,
97 * the internal cross partition structures require sixteen bytes per channel,
98 * and eight allows all of this interface-shared info to fit in one cache line.
99 *
100 * XPC_NCHANNELS reflects the total number of channels currently defined.
101 * If the need for additional channels arises, one can simply increase 70 * If the need for additional channels arises, one can simply increase
102 * XPC_NCHANNELS accordingly. If the day should come where that number 71 * XPC_MAX_NCHANNELS accordingly. If the day should come where that number
103 * exceeds the MAXIMUM number of channels allowed (eight), then one will need 72 * exceeds the absolute MAXIMUM number of channels possible (eight), then one
104 * to make changes to the XPC code to allow for this. 73 * will need to make changes to the XPC code to accommodate for this.
74 *
75 * The absolute maximum number of channels possible is limited to eight for
76 * performance reasons on sn2 hardware. The internal cross partition structures
77 * require sixteen bytes per channel, and eight allows all of this
78 * interface-shared info to fit in one 128-byte cacheline.
105 */ 79 */
106#define XPC_MEM_CHANNEL 0 /* memory channel number */ 80#define XPC_MEM_CHANNEL 0 /* memory channel number */
107#define XPC_NET_CHANNEL 1 /* network channel number */ 81#define XPC_NET_CHANNEL 1 /* network channel number */
108 82
109#define XPC_NCHANNELS 2 /* #of defined channels */ 83#define XPC_MAX_NCHANNELS 2 /* max #of channels allowed */
110#define XPC_MAX_NCHANNELS 8 /* max #of channels allowed */
111 84
112#if XPC_NCHANNELS > XPC_MAX_NCHANNELS 85#if XPC_MAX_NCHANNELS > 8
113#error XPC_NCHANNELS exceeds MAXIMUM allowed. 86#error XPC_MAX_NCHANNELS exceeds absolute MAXIMUM possible.
114#endif 87#endif
115 88
116/* 89/*
117 * The format of an XPC message is as follows: 90 * Define macro, XPC_MSG_SIZE(), is provided for the user
118 *
119 * +-------+--------------------------------+
120 * | flags |////////////////////////////////|
121 * +-------+--------------------------------+
122 * | message # |
123 * +----------------------------------------+
124 * | payload (user-defined message) |
125 * | |
126 * :
127 * | |
128 * +----------------------------------------+
129 *
130 * The size of the payload is defined by the user via xpc_connect(). A user-
131 * defined message resides in the payload area.
132 *
133 * The user should have no dealings with the message header, but only the
134 * message's payload. When a message entry is allocated (via xpc_allocate())
135 * a pointer to the payload area is returned and not the actual beginning of
136 * the XPC message. The user then constructs a message in the payload area
137 * and passes that pointer as an argument on xpc_send() or xpc_send_notify().
138 *
139 * The size of a message entry (within a message queue) must be a cacheline
140 * sized multiple in order to facilitate the BTE transfer of messages from one
141 * message queue to another. A macro, XPC_MSG_SIZE(), is provided for the user
142 * that wants to fit as many msg entries as possible in a given memory size 91 * that wants to fit as many msg entries as possible in a given memory size
143 * (e.g. a memory page). 92 * (e.g. a memory page).
144 */ 93 */
145struct xpc_msg { 94#define XPC_MSG_MAX_SIZE 128
146 u8 flags; /* FOR XPC INTERNAL USE ONLY */ 95#define XPC_MSG_HDR_MAX_SIZE 16
147 u8 reserved[7]; /* FOR XPC INTERNAL USE ONLY */ 96#define XPC_MSG_PAYLOAD_MAX_SIZE (XPC_MSG_MAX_SIZE - XPC_MSG_HDR_MAX_SIZE)
148 s64 number; /* FOR XPC INTERNAL USE ONLY */
149
150 u64 payload; /* user defined portion of message */
151};
152 97
153#define XPC_MSG_PAYLOAD_OFFSET (u64) (&((struct xpc_msg *)0)->payload)
154#define XPC_MSG_SIZE(_payload_size) \ 98#define XPC_MSG_SIZE(_payload_size) \
155 L1_CACHE_ALIGN(XPC_MSG_PAYLOAD_OFFSET + (_payload_size)) 99 ALIGN(XPC_MSG_HDR_MAX_SIZE + (_payload_size), \
100 is_uv() ? 64 : 128)
101
156 102
157/* 103/*
158 * Define the return values and values passed to user's callout functions. 104 * Define the return values and values passed to user's callout functions.
@@ -233,8 +179,20 @@ enum xp_retval {
233 xpDisconnected, /* 51: channel disconnected (closed) */ 179 xpDisconnected, /* 51: channel disconnected (closed) */
234 180
235 xpBteCopyError, /* 52: bte_copy() returned error */ 181 xpBteCopyError, /* 52: bte_copy() returned error */
182 xpSalError, /* 53: sn SAL error */
183 xpRsvdPageNotSet, /* 54: the reserved page is not set up */
184 xpPayloadTooBig, /* 55: payload too large for message slot */
185
186 xpUnsupported, /* 56: unsupported functionality or resource */
187 xpNeedMoreInfo, /* 57: more info is needed by SAL */
236 188
237 xpUnknownReason /* 53: unknown reason - must be last in enum */ 189 xpGruCopyError, /* 58: gru_copy_gru() returned error */
190 xpGruSendMqError, /* 59: gru send message queue related error */
191
192 xpBadChannelNumber, /* 60: invalid channel number */
193 xpBadMsgType, /* 60: invalid message type */
194
195 xpUnknownReason /* 61: unknown reason - must be last in enum */
238}; 196};
239 197
240/* 198/*
@@ -285,6 +243,9 @@ typedef void (*xpc_channel_func) (enum xp_retval reason, short partid,
285 * calling xpc_received(). 243 * calling xpc_received().
286 * 244 *
287 * All other reason codes indicate failure. 245 * All other reason codes indicate failure.
246 *
247 * NOTE: The user defined function must be callable by an interrupt handler
248 * and thus cannot block.
288 */ 249 */
289typedef void (*xpc_notify_func) (enum xp_retval reason, short partid, 250typedef void (*xpc_notify_func) (enum xp_retval reason, short partid,
290 int ch_number, void *key); 251 int ch_number, void *key);
@@ -308,23 +269,22 @@ struct xpc_registration {
308 xpc_channel_func func; /* function to call */ 269 xpc_channel_func func; /* function to call */
309 void *key; /* pointer to user's key */ 270 void *key; /* pointer to user's key */
310 u16 nentries; /* #of msg entries in local msg queue */ 271 u16 nentries; /* #of msg entries in local msg queue */
311 u16 msg_size; /* message queue's message size */ 272 u16 entry_size; /* message queue's message entry size */
312 u32 assigned_limit; /* limit on #of assigned kthreads */ 273 u32 assigned_limit; /* limit on #of assigned kthreads */
313 u32 idle_limit; /* limit on #of idle kthreads */ 274 u32 idle_limit; /* limit on #of idle kthreads */
314} ____cacheline_aligned; 275} ____cacheline_aligned;
315 276
316#define XPC_CHANNEL_REGISTERED(_c) (xpc_registrations[_c].func != NULL) 277#define XPC_CHANNEL_REGISTERED(_c) (xpc_registrations[_c].func != NULL)
317 278
318/* the following are valid xpc_allocate() flags */ 279/* the following are valid xpc_send() or xpc_send_notify() flags */
319#define XPC_WAIT 0 /* wait flag */ 280#define XPC_WAIT 0 /* wait flag */
320#define XPC_NOWAIT 1 /* no wait flag */ 281#define XPC_NOWAIT 1 /* no wait flag */
321 282
322struct xpc_interface { 283struct xpc_interface {
323 void (*connect) (int); 284 void (*connect) (int);
324 void (*disconnect) (int); 285 void (*disconnect) (int);
325 enum xp_retval (*allocate) (short, int, u32, void **); 286 enum xp_retval (*send) (short, int, u32, void *, u16);
326 enum xp_retval (*send) (short, int, void *); 287 enum xp_retval (*send_notify) (short, int, u32, void *, u16,
327 enum xp_retval (*send_notify) (short, int, void *,
328 xpc_notify_func, void *); 288 xpc_notify_func, void *);
329 void (*received) (short, int, void *); 289 void (*received) (short, int, void *);
330 enum xp_retval (*partid_to_nasids) (short, void *); 290 enum xp_retval (*partid_to_nasids) (short, void *);
@@ -334,10 +294,9 @@ extern struct xpc_interface xpc_interface;
334 294
335extern void xpc_set_interface(void (*)(int), 295extern void xpc_set_interface(void (*)(int),
336 void (*)(int), 296 void (*)(int),
337 enum xp_retval (*)(short, int, u32, void **), 297 enum xp_retval (*)(short, int, u32, void *, u16),
338 enum xp_retval (*)(short, int, void *), 298 enum xp_retval (*)(short, int, u32, void *, u16,
339 enum xp_retval (*)(short, int, void *, 299 xpc_notify_func, void *),
340 xpc_notify_func, void *),
341 void (*)(short, int, void *), 300 void (*)(short, int, void *),
342 enum xp_retval (*)(short, void *)); 301 enum xp_retval (*)(short, void *));
343extern void xpc_clear_interface(void); 302extern void xpc_clear_interface(void);
@@ -347,22 +306,19 @@ extern enum xp_retval xpc_connect(int, xpc_channel_func, void *, u16,
347extern void xpc_disconnect(int); 306extern void xpc_disconnect(int);
348 307
349static inline enum xp_retval 308static inline enum xp_retval
350xpc_allocate(short partid, int ch_number, u32 flags, void **payload) 309xpc_send(short partid, int ch_number, u32 flags, void *payload,
351{ 310 u16 payload_size)
352 return xpc_interface.allocate(partid, ch_number, flags, payload);
353}
354
355static inline enum xp_retval
356xpc_send(short partid, int ch_number, void *payload)
357{ 311{
358 return xpc_interface.send(partid, ch_number, payload); 312 return xpc_interface.send(partid, ch_number, flags, payload,
313 payload_size);
359} 314}
360 315
361static inline enum xp_retval 316static inline enum xp_retval
362xpc_send_notify(short partid, int ch_number, void *payload, 317xpc_send_notify(short partid, int ch_number, u32 flags, void *payload,
363 xpc_notify_func func, void *key) 318 u16 payload_size, xpc_notify_func func, void *key)
364{ 319{
365 return xpc_interface.send_notify(partid, ch_number, payload, func, key); 320 return xpc_interface.send_notify(partid, ch_number, flags, payload,
321 payload_size, func, key);
366} 322}
367 323
368static inline void 324static inline void
@@ -377,8 +333,23 @@ xpc_partid_to_nasids(short partid, void *nasids)
377 return xpc_interface.partid_to_nasids(partid, nasids); 333 return xpc_interface.partid_to_nasids(partid, nasids);
378} 334}
379 335
336extern short xp_max_npartitions;
337extern short xp_partition_id;
338extern u8 xp_region_size;
339
340extern unsigned long (*xp_pa) (void *);
341extern enum xp_retval (*xp_remote_memcpy) (unsigned long, const unsigned long,
342 size_t);
343extern int (*xp_cpu_to_nasid) (int);
344
380extern u64 xp_nofault_PIOR_target; 345extern u64 xp_nofault_PIOR_target;
381extern int xp_nofault_PIOR(void *); 346extern int xp_nofault_PIOR(void *);
382extern int xp_error_PIOR(void); 347extern int xp_error_PIOR(void);
383 348
349extern struct device *xp;
350extern enum xp_retval xp_init_sn2(void);
351extern enum xp_retval xp_init_uv(void);
352extern void xp_exit_sn2(void);
353extern void xp_exit_uv(void);
354
384#endif /* _DRIVERS_MISC_SGIXP_XP_H */ 355#endif /* _DRIVERS_MISC_SGIXP_XP_H */
diff --git a/drivers/misc/sgi-xp/xp_main.c b/drivers/misc/sgi-xp/xp_main.c
index 196480b691a1..66a1d19e08ad 100644
--- a/drivers/misc/sgi-xp/xp_main.c
+++ b/drivers/misc/sgi-xp/xp_main.c
@@ -14,29 +14,48 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/kernel.h>
18#include <linux/interrupt.h>
19#include <linux/module.h> 17#include <linux/module.h>
20#include <linux/mutex.h> 18#include <linux/device.h>
21#include <asm/sn/intr.h>
22#include <asm/sn/sn_sal.h>
23#include "xp.h" 19#include "xp.h"
24 20
25/* 21/* define the XP debug device structures to be used with dev_dbg() et al */
26 * The export of xp_nofault_PIOR needs to happen here since it is defined 22
27 * in drivers/misc/sgi-xp/xp_nofault.S. The target of the nofault read is 23struct device_driver xp_dbg_name = {
28 * defined here. 24 .name = "xp"
29 */ 25};
30EXPORT_SYMBOL_GPL(xp_nofault_PIOR); 26
27struct device xp_dbg_subname = {
28 .bus_id = {0}, /* set to "" */
29 .driver = &xp_dbg_name
30};
31
32struct device *xp = &xp_dbg_subname;
33
34/* max #of partitions possible */
35short xp_max_npartitions;
36EXPORT_SYMBOL_GPL(xp_max_npartitions);
37
38short xp_partition_id;
39EXPORT_SYMBOL_GPL(xp_partition_id);
40
41u8 xp_region_size;
42EXPORT_SYMBOL_GPL(xp_region_size);
43
44unsigned long (*xp_pa) (void *addr);
45EXPORT_SYMBOL_GPL(xp_pa);
46
47enum xp_retval (*xp_remote_memcpy) (unsigned long dst_gpa,
48 const unsigned long src_gpa, size_t len);
49EXPORT_SYMBOL_GPL(xp_remote_memcpy);
31 50
32u64 xp_nofault_PIOR_target; 51int (*xp_cpu_to_nasid) (int cpuid);
33EXPORT_SYMBOL_GPL(xp_nofault_PIOR_target); 52EXPORT_SYMBOL_GPL(xp_cpu_to_nasid);
34 53
35/* 54/*
36 * xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level 55 * xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level
37 * users of XPC. 56 * users of XPC.
38 */ 57 */
39struct xpc_registration xpc_registrations[XPC_NCHANNELS]; 58struct xpc_registration xpc_registrations[XPC_MAX_NCHANNELS];
40EXPORT_SYMBOL_GPL(xpc_registrations); 59EXPORT_SYMBOL_GPL(xpc_registrations);
41 60
42/* 61/*
@@ -51,10 +70,9 @@ xpc_notloaded(void)
51struct xpc_interface xpc_interface = { 70struct xpc_interface xpc_interface = {
52 (void (*)(int))xpc_notloaded, 71 (void (*)(int))xpc_notloaded,
53 (void (*)(int))xpc_notloaded, 72 (void (*)(int))xpc_notloaded,
54 (enum xp_retval(*)(short, int, u32, void **))xpc_notloaded, 73 (enum xp_retval(*)(short, int, u32, void *, u16))xpc_notloaded,
55 (enum xp_retval(*)(short, int, void *))xpc_notloaded, 74 (enum xp_retval(*)(short, int, u32, void *, u16, xpc_notify_func,
56 (enum xp_retval(*)(short, int, void *, xpc_notify_func, void *)) 75 void *))xpc_notloaded,
57 xpc_notloaded,
58 (void (*)(short, int, void *))xpc_notloaded, 76 (void (*)(short, int, void *))xpc_notloaded,
59 (enum xp_retval(*)(short, void *))xpc_notloaded 77 (enum xp_retval(*)(short, void *))xpc_notloaded
60}; 78};
@@ -66,16 +84,14 @@ EXPORT_SYMBOL_GPL(xpc_interface);
66void 84void
67xpc_set_interface(void (*connect) (int), 85xpc_set_interface(void (*connect) (int),
68 void (*disconnect) (int), 86 void (*disconnect) (int),
69 enum xp_retval (*allocate) (short, int, u32, void **), 87 enum xp_retval (*send) (short, int, u32, void *, u16),
70 enum xp_retval (*send) (short, int, void *), 88 enum xp_retval (*send_notify) (short, int, u32, void *, u16,
71 enum xp_retval (*send_notify) (short, int, void *,
72 xpc_notify_func, void *), 89 xpc_notify_func, void *),
73 void (*received) (short, int, void *), 90 void (*received) (short, int, void *),
74 enum xp_retval (*partid_to_nasids) (short, void *)) 91 enum xp_retval (*partid_to_nasids) (short, void *))
75{ 92{
76 xpc_interface.connect = connect; 93 xpc_interface.connect = connect;
77 xpc_interface.disconnect = disconnect; 94 xpc_interface.disconnect = disconnect;
78 xpc_interface.allocate = allocate;
79 xpc_interface.send = send; 95 xpc_interface.send = send;
80 xpc_interface.send_notify = send_notify; 96 xpc_interface.send_notify = send_notify;
81 xpc_interface.received = received; 97 xpc_interface.received = received;
@@ -91,13 +107,11 @@ xpc_clear_interface(void)
91{ 107{
92 xpc_interface.connect = (void (*)(int))xpc_notloaded; 108 xpc_interface.connect = (void (*)(int))xpc_notloaded;
93 xpc_interface.disconnect = (void (*)(int))xpc_notloaded; 109 xpc_interface.disconnect = (void (*)(int))xpc_notloaded;
94 xpc_interface.allocate = (enum xp_retval(*)(short, int, u32, 110 xpc_interface.send = (enum xp_retval(*)(short, int, u32, void *, u16))
95 void **))xpc_notloaded;
96 xpc_interface.send = (enum xp_retval(*)(short, int, void *))
97 xpc_notloaded; 111 xpc_notloaded;
98 xpc_interface.send_notify = (enum xp_retval(*)(short, int, void *, 112 xpc_interface.send_notify = (enum xp_retval(*)(short, int, u32, void *,
99 xpc_notify_func, 113 u16, xpc_notify_func,
100 void *))xpc_notloaded; 114 void *))xpc_notloaded;
101 xpc_interface.received = (void (*)(short, int, void *)) 115 xpc_interface.received = (void (*)(short, int, void *))
102 xpc_notloaded; 116 xpc_notloaded;
103 xpc_interface.partid_to_nasids = (enum xp_retval(*)(short, void *)) 117 xpc_interface.partid_to_nasids = (enum xp_retval(*)(short, void *))
@@ -135,11 +149,14 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
135{ 149{
136 struct xpc_registration *registration; 150 struct xpc_registration *registration;
137 151
138 DBUG_ON(ch_number < 0 || ch_number >= XPC_NCHANNELS); 152 DBUG_ON(ch_number < 0 || ch_number >= XPC_MAX_NCHANNELS);
139 DBUG_ON(payload_size == 0 || nentries == 0); 153 DBUG_ON(payload_size == 0 || nentries == 0);
140 DBUG_ON(func == NULL); 154 DBUG_ON(func == NULL);
141 DBUG_ON(assigned_limit == 0 || idle_limit > assigned_limit); 155 DBUG_ON(assigned_limit == 0 || idle_limit > assigned_limit);
142 156
157 if (XPC_MSG_SIZE(payload_size) > XPC_MSG_MAX_SIZE)
158 return xpPayloadTooBig;
159
143 registration = &xpc_registrations[ch_number]; 160 registration = &xpc_registrations[ch_number];
144 161
145 if (mutex_lock_interruptible(&registration->mutex) != 0) 162 if (mutex_lock_interruptible(&registration->mutex) != 0)
@@ -152,7 +169,7 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
152 } 169 }
153 170
154 /* register the channel for connection */ 171 /* register the channel for connection */
155 registration->msg_size = XPC_MSG_SIZE(payload_size); 172 registration->entry_size = XPC_MSG_SIZE(payload_size);
156 registration->nentries = nentries; 173 registration->nentries = nentries;
157 registration->assigned_limit = assigned_limit; 174 registration->assigned_limit = assigned_limit;
158 registration->idle_limit = idle_limit; 175 registration->idle_limit = idle_limit;
@@ -185,7 +202,7 @@ xpc_disconnect(int ch_number)
185{ 202{
186 struct xpc_registration *registration; 203 struct xpc_registration *registration;
187 204
188 DBUG_ON(ch_number < 0 || ch_number >= XPC_NCHANNELS); 205 DBUG_ON(ch_number < 0 || ch_number >= XPC_MAX_NCHANNELS);
189 206
190 registration = &xpc_registrations[ch_number]; 207 registration = &xpc_registrations[ch_number];
191 208
@@ -206,7 +223,7 @@ xpc_disconnect(int ch_number)
206 registration->func = NULL; 223 registration->func = NULL;
207 registration->key = NULL; 224 registration->key = NULL;
208 registration->nentries = 0; 225 registration->nentries = 0;
209 registration->msg_size = 0; 226 registration->entry_size = 0;
210 registration->assigned_limit = 0; 227 registration->assigned_limit = 0;
211 registration->idle_limit = 0; 228 registration->idle_limit = 0;
212 229
@@ -221,39 +238,21 @@ EXPORT_SYMBOL_GPL(xpc_disconnect);
221int __init 238int __init
222xp_init(void) 239xp_init(void)
223{ 240{
224 int ret, ch_number; 241 enum xp_retval ret;
225 u64 func_addr = *(u64 *)xp_nofault_PIOR; 242 int ch_number;
226 u64 err_func_addr = *(u64 *)xp_error_PIOR;
227
228 if (!ia64_platform_is("sn2"))
229 return -ENODEV;
230 243
231 /* 244 if (is_shub())
232 * Register a nofault code region which performs a cross-partition 245 ret = xp_init_sn2();
233 * PIO read. If the PIO read times out, the MCA handler will consume 246 else if (is_uv())
234 * the error and return to a kernel-provided instruction to indicate 247 ret = xp_init_uv();
235 * an error. This PIO read exists because it is guaranteed to timeout
236 * if the destination is down (AMO operations do not timeout on at
237 * least some CPUs on Shubs <= v1.2, which unfortunately we have to
238 * work around).
239 */
240 ret = sn_register_nofault_code(func_addr, err_func_addr, err_func_addr,
241 1, 1);
242 if (ret != 0) {
243 printk(KERN_ERR "XP: can't register nofault code, error=%d\n",
244 ret);
245 }
246 /*
247 * Setup the nofault PIO read target. (There is no special reason why
248 * SH_IPI_ACCESS was selected.)
249 */
250 if (is_shub2())
251 xp_nofault_PIOR_target = SH2_IPI_ACCESS0;
252 else 248 else
253 xp_nofault_PIOR_target = SH1_IPI_ACCESS; 249 ret = xpUnsupported;
250
251 if (ret != xpSuccess)
252 return -ENODEV;
254 253
255 /* initialize the connection registration mutex */ 254 /* initialize the connection registration mutex */
256 for (ch_number = 0; ch_number < XPC_NCHANNELS; ch_number++) 255 for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++)
257 mutex_init(&xpc_registrations[ch_number].mutex); 256 mutex_init(&xpc_registrations[ch_number].mutex);
258 257
259 return 0; 258 return 0;
@@ -264,12 +263,10 @@ module_init(xp_init);
264void __exit 263void __exit
265xp_exit(void) 264xp_exit(void)
266{ 265{
267 u64 func_addr = *(u64 *)xp_nofault_PIOR; 266 if (is_shub())
268 u64 err_func_addr = *(u64 *)xp_error_PIOR; 267 xp_exit_sn2();
269 268 else if (is_uv())
270 /* unregister the PIO read nofault code region */ 269 xp_exit_uv();
271 (void)sn_register_nofault_code(func_addr, err_func_addr,
272 err_func_addr, 1, 0);
273} 270}
274 271
275module_exit(xp_exit); 272module_exit(xp_exit);
diff --git a/drivers/misc/sgi-xp/xp_sn2.c b/drivers/misc/sgi-xp/xp_sn2.c
new file mode 100644
index 000000000000..1440134caf31
--- /dev/null
+++ b/drivers/misc/sgi-xp/xp_sn2.c
@@ -0,0 +1,146 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9/*
10 * Cross Partition (XP) sn2-based functions.
11 *
12 * Architecture specific implementation of common functions.
13 */
14
15#include <linux/module.h>
16#include <linux/device.h>
17#include <asm/sn/bte.h>
18#include <asm/sn/sn_sal.h>
19#include "xp.h"
20
21/*
22 * The export of xp_nofault_PIOR needs to happen here since it is defined
23 * in drivers/misc/sgi-xp/xp_nofault.S. The target of the nofault read is
24 * defined here.
25 */
26EXPORT_SYMBOL_GPL(xp_nofault_PIOR);
27
28u64 xp_nofault_PIOR_target;
29EXPORT_SYMBOL_GPL(xp_nofault_PIOR_target);
30
31/*
32 * Register a nofault code region which performs a cross-partition PIO read.
33 * If the PIO read times out, the MCA handler will consume the error and
34 * return to a kernel-provided instruction to indicate an error. This PIO read
35 * exists because it is guaranteed to timeout if the destination is down
36 * (amo operations do not timeout on at least some CPUs on Shubs <= v1.2,
37 * which unfortunately we have to work around).
38 */
39static enum xp_retval
40xp_register_nofault_code_sn2(void)
41{
42 int ret;
43 u64 func_addr;
44 u64 err_func_addr;
45
46 func_addr = *(u64 *)xp_nofault_PIOR;
47 err_func_addr = *(u64 *)xp_error_PIOR;
48 ret = sn_register_nofault_code(func_addr, err_func_addr, err_func_addr,
49 1, 1);
50 if (ret != 0) {
51 dev_err(xp, "can't register nofault code, error=%d\n", ret);
52 return xpSalError;
53 }
54 /*
55 * Setup the nofault PIO read target. (There is no special reason why
56 * SH_IPI_ACCESS was selected.)
57 */
58 if (is_shub1())
59 xp_nofault_PIOR_target = SH1_IPI_ACCESS;
60 else if (is_shub2())
61 xp_nofault_PIOR_target = SH2_IPI_ACCESS0;
62
63 return xpSuccess;
64}
65
66static void
67xp_unregister_nofault_code_sn2(void)
68{
69 u64 func_addr = *(u64 *)xp_nofault_PIOR;
70 u64 err_func_addr = *(u64 *)xp_error_PIOR;
71
72 /* unregister the PIO read nofault code region */
73 (void)sn_register_nofault_code(func_addr, err_func_addr,
74 err_func_addr, 1, 0);
75}
76
77/*
78 * Convert a virtual memory address to a physical memory address.
79 */
80static unsigned long
81xp_pa_sn2(void *addr)
82{
83 return __pa(addr);
84}
85
86/*
87 * Wrapper for bte_copy().
88 *
89 * dst_pa - physical address of the destination of the transfer.
90 * src_pa - physical address of the source of the transfer.
91 * len - number of bytes to transfer from source to destination.
92 *
93 * Note: xp_remote_memcpy_sn2() should never be called while holding a spinlock.
94 */
95static enum xp_retval
96xp_remote_memcpy_sn2(unsigned long dst_pa, const unsigned long src_pa,
97 size_t len)
98{
99 bte_result_t ret;
100
101 ret = bte_copy(src_pa, dst_pa, len, (BTE_NOTIFY | BTE_WACQUIRE), NULL);
102 if (ret == BTE_SUCCESS)
103 return xpSuccess;
104
105 if (is_shub2()) {
106 dev_err(xp, "bte_copy() on shub2 failed, error=0x%x dst_pa="
107 "0x%016lx src_pa=0x%016lx len=%ld\\n", ret, dst_pa,
108 src_pa, len);
109 } else {
110 dev_err(xp, "bte_copy() failed, error=%d dst_pa=0x%016lx "
111 "src_pa=0x%016lx len=%ld\\n", ret, dst_pa, src_pa, len);
112 }
113
114 return xpBteCopyError;
115}
116
117static int
118xp_cpu_to_nasid_sn2(int cpuid)
119{
120 return cpuid_to_nasid(cpuid);
121}
122
123enum xp_retval
124xp_init_sn2(void)
125{
126 BUG_ON(!is_shub());
127
128 xp_max_npartitions = XP_MAX_NPARTITIONS_SN2;
129 xp_partition_id = sn_partition_id;
130 xp_region_size = sn_region_size;
131
132 xp_pa = xp_pa_sn2;
133 xp_remote_memcpy = xp_remote_memcpy_sn2;
134 xp_cpu_to_nasid = xp_cpu_to_nasid_sn2;
135
136 return xp_register_nofault_code_sn2();
137}
138
139void
140xp_exit_sn2(void)
141{
142 BUG_ON(!is_shub());
143
144 xp_unregister_nofault_code_sn2();
145}
146
diff --git a/drivers/misc/sgi-xp/xp_uv.c b/drivers/misc/sgi-xp/xp_uv.c
new file mode 100644
index 000000000000..d9f7ce2510bc
--- /dev/null
+++ b/drivers/misc/sgi-xp/xp_uv.c
@@ -0,0 +1,72 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9/*
10 * Cross Partition (XP) uv-based functions.
11 *
12 * Architecture specific implementation of common functions.
13 *
14 */
15
16#include <linux/device.h>
17#include <asm/uv/uv_hub.h>
18#include "../sgi-gru/grukservices.h"
19#include "xp.h"
20
21/*
22 * Convert a virtual memory address to a physical memory address.
23 */
24static unsigned long
25xp_pa_uv(void *addr)
26{
27 return uv_gpa(addr);
28}
29
30static enum xp_retval
31xp_remote_memcpy_uv(unsigned long dst_gpa, const unsigned long src_gpa,
32 size_t len)
33{
34 int ret;
35
36 ret = gru_copy_gpa(dst_gpa, src_gpa, len);
37 if (ret == 0)
38 return xpSuccess;
39
40 dev_err(xp, "gru_copy_gpa() failed, dst_gpa=0x%016lx src_gpa=0x%016lx "
41 "len=%ld\n", dst_gpa, src_gpa, len);
42 return xpGruCopyError;
43}
44
45static int
46xp_cpu_to_nasid_uv(int cpuid)
47{
48 /* ??? Is this same as sn2 nasid in mach/part bitmaps set up by SAL? */
49 return UV_PNODE_TO_NASID(uv_cpu_to_pnode(cpuid));
50}
51
52enum xp_retval
53xp_init_uv(void)
54{
55 BUG_ON(!is_uv());
56
57 xp_max_npartitions = XP_MAX_NPARTITIONS_UV;
58 xp_partition_id = 0; /* !!! not correct value */
59 xp_region_size = 0; /* !!! not correct value */
60
61 xp_pa = xp_pa_uv;
62 xp_remote_memcpy = xp_remote_memcpy_uv;
63 xp_cpu_to_nasid = xp_cpu_to_nasid_uv;
64
65 return xpSuccess;
66}
67
68void
69xp_exit_uv(void)
70{
71 BUG_ON(!is_uv());
72}
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h
index 11ac267ed68f..619208d61862 100644
--- a/drivers/misc/sgi-xp/xpc.h
+++ b/drivers/misc/sgi-xp/xpc.h
@@ -13,18 +13,10 @@
13#ifndef _DRIVERS_MISC_SGIXP_XPC_H 13#ifndef _DRIVERS_MISC_SGIXP_XPC_H
14#define _DRIVERS_MISC_SGIXP_XPC_H 14#define _DRIVERS_MISC_SGIXP_XPC_H
15 15
16#include <linux/interrupt.h> 16#include <linux/wait.h>
17#include <linux/sysctl.h>
18#include <linux/device.h>
19#include <linux/mutex.h>
20#include <linux/completion.h> 17#include <linux/completion.h>
21#include <asm/pgtable.h> 18#include <linux/timer.h>
22#include <asm/processor.h> 19#include <linux/sched.h>
23#include <asm/sn/bte.h>
24#include <asm/sn/clksupport.h>
25#include <asm/sn/addrs.h>
26#include <asm/sn/mspec.h>
27#include <asm/sn/shub_mmr.h>
28#include "xp.h" 20#include "xp.h"
29 21
30/* 22/*
@@ -36,23 +28,7 @@
36#define XPC_VERSION_MAJOR(_v) ((_v) >> 4) 28#define XPC_VERSION_MAJOR(_v) ((_v) >> 4)
37#define XPC_VERSION_MINOR(_v) ((_v) & 0xf) 29#define XPC_VERSION_MINOR(_v) ((_v) & 0xf)
38 30
39/* 31/* define frequency of the heartbeat and frequency how often it's checked */
40 * The next macros define word or bit representations for given
41 * C-brick nasid in either the SAL provided bit array representing
42 * nasids in the partition/machine or the AMO_t array used for
43 * inter-partition initiation communications.
44 *
45 * For SN2 machines, C-Bricks are alway even numbered NASIDs. As
46 * such, some space will be saved by insisting that nasid information
47 * passed from SAL always be packed for C-Bricks and the
48 * cross-partition interrupts use the same packing scheme.
49 */
50#define XPC_NASID_W_INDEX(_n) (((_n) / 64) / 2)
51#define XPC_NASID_B_INDEX(_n) (((_n) / 2) & (64 - 1))
52#define XPC_NASID_IN_ARRAY(_n, _p) ((_p)[XPC_NASID_W_INDEX(_n)] & \
53 (1UL << XPC_NASID_B_INDEX(_n)))
54#define XPC_NASID_FROM_W_B(_w, _b) (((_w) * 64 + (_b)) * 2)
55
56#define XPC_HB_DEFAULT_INTERVAL 5 /* incr HB every x secs */ 32#define XPC_HB_DEFAULT_INTERVAL 5 /* incr HB every x secs */
57#define XPC_HB_CHECK_DEFAULT_INTERVAL 20 /* check HB every x secs */ 33#define XPC_HB_CHECK_DEFAULT_INTERVAL 20 /* check HB every x secs */
58 34
@@ -72,11 +48,11 @@
72 * 48 *
73 * reserved page header 49 * reserved page header
74 * 50 *
75 * The first cacheline of the reserved page contains the header 51 * The first two 64-byte cachelines of the reserved page contain the
76 * (struct xpc_rsvd_page). Before SAL initialization has completed, 52 * header (struct xpc_rsvd_page). Before SAL initialization has completed,
77 * SAL has set up the following fields of the reserved page header: 53 * SAL has set up the following fields of the reserved page header:
78 * SAL_signature, SAL_version, partid, and nasids_size. The other 54 * SAL_signature, SAL_version, SAL_partid, and SAL_nasids_size. The
79 * fields are set up by XPC. (xpc_rsvd_page points to the local 55 * other fields are set up by XPC. (xpc_rsvd_page points to the local
80 * partition's reserved page.) 56 * partition's reserved page.)
81 * 57 *
82 * part_nasids mask 58 * part_nasids mask
@@ -87,14 +63,16 @@
87 * the actual nasids in the entire machine (mach_nasids). We're only 63 * the actual nasids in the entire machine (mach_nasids). We're only
88 * interested in the even numbered nasids (which contain the processors 64 * interested in the even numbered nasids (which contain the processors
89 * and/or memory), so we only need half as many bits to represent the 65 * and/or memory), so we only need half as many bits to represent the
90 * nasids. The part_nasids mask is located starting at the first cacheline 66 * nasids. When mapping nasid to bit in a mask (or bit to nasid) be sure
91 * following the reserved page header. The mach_nasids mask follows right 67 * to either divide or multiply by 2. The part_nasids mask is located
92 * after the part_nasids mask. The size in bytes of each mask is reflected 68 * starting at the first cacheline following the reserved page header. The
93 * by the reserved page header field 'nasids_size'. (Local partition's 69 * mach_nasids mask follows right after the part_nasids mask. The size in
94 * mask pointers are xpc_part_nasids and xpc_mach_nasids.) 70 * bytes of each mask is reflected by the reserved page header field
71 * 'SAL_nasids_size'. (Local partition's mask pointers are xpc_part_nasids
72 * and xpc_mach_nasids.)
95 * 73 *
96 * vars 74 * vars (ia64-sn2 only)
97 * vars part 75 * vars part (ia64-sn2 only)
98 * 76 *
99 * Immediately following the mach_nasids mask are the XPC variables 77 * Immediately following the mach_nasids mask are the XPC variables
100 * required by other partitions. First are those that are generic to all 78 * required by other partitions. First are those that are generic to all
@@ -102,43 +80,26 @@
102 * which are partition specific (vars part). These are setup by XPC. 80 * which are partition specific (vars part). These are setup by XPC.
103 * (Local partition's vars pointers are xpc_vars and xpc_vars_part.) 81 * (Local partition's vars pointers are xpc_vars and xpc_vars_part.)
104 * 82 *
105 * Note: Until vars_pa is set, the partition XPC code has not been initialized. 83 * Note: Until 'ts_jiffies' is set non-zero, the partition XPC code has not been
84 * initialized.
106 */ 85 */
107struct xpc_rsvd_page { 86struct xpc_rsvd_page {
108 u64 SAL_signature; /* SAL: unique signature */ 87 u64 SAL_signature; /* SAL: unique signature */
109 u64 SAL_version; /* SAL: version */ 88 u64 SAL_version; /* SAL: version */
110 u8 partid; /* SAL: partition ID */ 89 short SAL_partid; /* SAL: partition ID */
90 short max_npartitions; /* value of XPC_MAX_PARTITIONS */
111 u8 version; 91 u8 version;
112 u8 pad1[6]; /* align to next u64 in cacheline */ 92 u8 pad1[3]; /* align to next u64 in 1st 64-byte cacheline */
113 u64 vars_pa; /* physical address of struct xpc_vars */ 93 union {
114 struct timespec stamp; /* time when reserved page was setup by XPC */ 94 unsigned long vars_pa; /* phys address of struct xpc_vars */
115 u64 pad2[9]; /* align to last u64 in cacheline */ 95 unsigned long activate_mq_gpa; /* gru phy addr of activate_mq */
116 u64 nasids_size; /* SAL: size of each nasid mask in bytes */ 96 } sn;
97 unsigned long ts_jiffies; /* timestamp when rsvd pg was setup by XPC */
98 u64 pad2[10]; /* align to last u64 in 2nd 64-byte cacheline */
99 u64 SAL_nasids_size; /* SAL: size of each nasid mask in bytes */
117}; 100};
118 101
119#define XPC_RP_VERSION _XPC_VERSION(1, 1) /* version 1.1 of the reserved page */ 102#define XPC_RP_VERSION _XPC_VERSION(2, 0) /* version 2.0 of the reserved page */
120
121#define XPC_SUPPORTS_RP_STAMP(_version) \
122 (_version >= _XPC_VERSION(1, 1))
123
124/*
125 * compare stamps - the return value is:
126 *
127 * < 0, if stamp1 < stamp2
128 * = 0, if stamp1 == stamp2
129 * > 0, if stamp1 > stamp2
130 */
131static inline int
132xpc_compare_stamps(struct timespec *stamp1, struct timespec *stamp2)
133{
134 int ret;
135
136 ret = stamp1->tv_sec - stamp2->tv_sec;
137 if (ret == 0)
138 ret = stamp1->tv_nsec - stamp2->tv_nsec;
139
140 return ret;
141}
142 103
143/* 104/*
144 * Define the structures by which XPC variables can be exported to other 105 * Define the structures by which XPC variables can be exported to other
@@ -154,85 +115,40 @@ xpc_compare_stamps(struct timespec *stamp1, struct timespec *stamp2)
154 * reflected by incrementing either the major or minor version numbers 115 * reflected by incrementing either the major or minor version numbers
155 * of struct xpc_vars. 116 * of struct xpc_vars.
156 */ 117 */
157struct xpc_vars { 118struct xpc_vars_sn2 {
158 u8 version; 119 u8 version;
159 u64 heartbeat; 120 u64 heartbeat;
160 u64 heartbeating_to_mask; 121 DECLARE_BITMAP(heartbeating_to_mask, XP_MAX_NPARTITIONS_SN2);
161 u64 heartbeat_offline; /* if 0, heartbeat should be changing */ 122 u64 heartbeat_offline; /* if 0, heartbeat should be changing */
162 int act_nasid; 123 int activate_IRQ_nasid;
163 int act_phys_cpuid; 124 int activate_IRQ_phys_cpuid;
164 u64 vars_part_pa; 125 unsigned long vars_part_pa;
165 u64 amos_page_pa; /* paddr of page of AMOs from MSPEC driver */ 126 unsigned long amos_page_pa;/* paddr of page of amos from MSPEC driver */
166 AMO_t *amos_page; /* vaddr of page of AMOs from MSPEC driver */ 127 struct amo *amos_page; /* vaddr of page of amos from MSPEC driver */
167}; 128};
168 129
169#define XPC_V_VERSION _XPC_VERSION(3, 1) /* version 3.1 of the cross vars */ 130#define XPC_V_VERSION _XPC_VERSION(3, 1) /* version 3.1 of the cross vars */
170 131
171#define XPC_SUPPORTS_DISENGAGE_REQUEST(_version) \
172 (_version >= _XPC_VERSION(3, 1))
173
174static inline int
175xpc_hb_allowed(short partid, struct xpc_vars *vars)
176{
177 return ((vars->heartbeating_to_mask & (1UL << partid)) != 0);
178}
179
180static inline void
181xpc_allow_hb(short partid, struct xpc_vars *vars)
182{
183 u64 old_mask, new_mask;
184
185 do {
186 old_mask = vars->heartbeating_to_mask;
187 new_mask = (old_mask | (1UL << partid));
188 } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
189 old_mask);
190}
191
192static inline void
193xpc_disallow_hb(short partid, struct xpc_vars *vars)
194{
195 u64 old_mask, new_mask;
196
197 do {
198 old_mask = vars->heartbeating_to_mask;
199 new_mask = (old_mask & ~(1UL << partid));
200 } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
201 old_mask);
202}
203
204/*
205 * The AMOs page consists of a number of AMO variables which are divided into
206 * four groups, The first two groups are used to identify an IRQ's sender.
207 * These two groups consist of 64 and 128 AMO variables respectively. The last
208 * two groups, consisting of just one AMO variable each, are used to identify
209 * the remote partitions that are currently engaged (from the viewpoint of
210 * the XPC running on the remote partition).
211 */
212#define XPC_NOTIFY_IRQ_AMOS 0
213#define XPC_ACTIVATE_IRQ_AMOS (XPC_NOTIFY_IRQ_AMOS + XP_MAX_PARTITIONS)
214#define XPC_ENGAGED_PARTITIONS_AMO (XPC_ACTIVATE_IRQ_AMOS + XP_NASID_MASK_WORDS)
215#define XPC_DISENGAGE_REQUEST_AMO (XPC_ENGAGED_PARTITIONS_AMO + 1)
216
217/* 132/*
218 * The following structure describes the per partition specific variables. 133 * The following structure describes the per partition specific variables.
219 * 134 *
220 * An array of these structures, one per partition, will be defined. As a 135 * An array of these structures, one per partition, will be defined. As a
221 * partition becomes active XPC will copy the array entry corresponding to 136 * partition becomes active XPC will copy the array entry corresponding to
222 * itself from that partition. It is desirable that the size of this 137 * itself from that partition. It is desirable that the size of this structure
223 * structure evenly divide into a cacheline, such that none of the entries 138 * evenly divides into a 128-byte cacheline, such that none of the entries in
224 * in this array crosses a cacheline boundary. As it is now, each entry 139 * this array crosses a 128-byte cacheline boundary. As it is now, each entry
225 * occupies half a cacheline. 140 * occupies 64-bytes.
226 */ 141 */
227struct xpc_vars_part { 142struct xpc_vars_part_sn2 {
228 u64 magic; 143 u64 magic;
229 144
230 u64 openclose_args_pa; /* physical address of open and close args */ 145 unsigned long openclose_args_pa; /* phys addr of open and close args */
231 u64 GPs_pa; /* physical address of Get/Put values */ 146 unsigned long GPs_pa; /* physical address of Get/Put values */
147
148 unsigned long chctl_amo_pa; /* physical address of chctl flags' amo */
232 149
233 u64 IPI_amo_pa; /* physical address of IPI AMO_t structure */ 150 int notify_IRQ_nasid; /* nasid of where to send notify IRQs */
234 int IPI_nasid; /* nasid of where to send IPIs */ 151 int notify_IRQ_phys_cpuid; /* CPUID of where to send notify IRQs */
235 int IPI_phys_cpuid; /* physical CPU ID of where to send IPIs */
236 152
237 u8 nchannels; /* #of defined channels supported */ 153 u8 nchannels; /* #of defined channels supported */
238 154
@@ -248,20 +164,95 @@ struct xpc_vars_part {
248 * MAGIC2 indicates that this partition has pulled the remote partititions 164 * MAGIC2 indicates that this partition has pulled the remote partititions
249 * per partition variables that pertain to this partition. 165 * per partition variables that pertain to this partition.
250 */ 166 */
251#define XPC_VP_MAGIC1 0x0053524156435058L /* 'XPCVARS\0'L (little endian) */ 167#define XPC_VP_MAGIC1_SN2 0x0053524156435058L /* 'XPCVARS\0'L (little endian) */
252#define XPC_VP_MAGIC2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */ 168#define XPC_VP_MAGIC2_SN2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */
253 169
254/* the reserved page sizes and offsets */ 170/* the reserved page sizes and offsets */
255 171
256#define XPC_RP_HEADER_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page)) 172#define XPC_RP_HEADER_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page))
257#define XPC_RP_VARS_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_vars)) 173#define XPC_RP_VARS_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_vars_sn2))
258 174
259#define XPC_RP_PART_NASIDS(_rp) ((u64 *)((u8 *)(_rp) + XPC_RP_HEADER_SIZE)) 175#define XPC_RP_PART_NASIDS(_rp) ((unsigned long *)((u8 *)(_rp) + \
260#define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + xp_nasid_mask_words) 176 XPC_RP_HEADER_SIZE))
261#define XPC_RP_VARS(_rp) ((struct xpc_vars *)(XPC_RP_MACH_NASIDS(_rp) + \ 177#define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + \
262 xp_nasid_mask_words)) 178 xpc_nasid_mask_nlongs)
263#define XPC_RP_VARS_PART(_rp) ((struct xpc_vars_part *) \ 179#define XPC_RP_VARS(_rp) ((struct xpc_vars_sn2 *) \
264 ((u8 *)XPC_RP_VARS(_rp) + XPC_RP_VARS_SIZE)) 180 (XPC_RP_MACH_NASIDS(_rp) + \
181 xpc_nasid_mask_nlongs))
182
183/*
184 * The activate_mq is used to send/receive GRU messages that affect XPC's
185 * heartbeat, partition active state, and channel state. This is UV only.
186 */
187struct xpc_activate_mq_msghdr_uv {
188 short partid; /* sender's partid */
189 u8 act_state; /* sender's act_state at time msg sent */
190 u8 type; /* message's type */
191 unsigned long rp_ts_jiffies; /* timestamp of sender's rp setup by XPC */
192};
193
194/* activate_mq defined message types */
195#define XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV 0
196#define XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV 1
197#define XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV 2
198#define XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV 3
199
200#define XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV 4
201#define XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV 5
202
203#define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV 6
204#define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV 7
205#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV 8
206#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV 9
207
208#define XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV 10
209#define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV 11
210
211struct xpc_activate_mq_msg_uv {
212 struct xpc_activate_mq_msghdr_uv hdr;
213};
214
215struct xpc_activate_mq_msg_heartbeat_req_uv {
216 struct xpc_activate_mq_msghdr_uv hdr;
217 u64 heartbeat;
218};
219
220struct xpc_activate_mq_msg_activate_req_uv {
221 struct xpc_activate_mq_msghdr_uv hdr;
222 unsigned long rp_gpa;
223 unsigned long activate_mq_gpa;
224};
225
226struct xpc_activate_mq_msg_deactivate_req_uv {
227 struct xpc_activate_mq_msghdr_uv hdr;
228 enum xp_retval reason;
229};
230
231struct xpc_activate_mq_msg_chctl_closerequest_uv {
232 struct xpc_activate_mq_msghdr_uv hdr;
233 short ch_number;
234 enum xp_retval reason;
235};
236
237struct xpc_activate_mq_msg_chctl_closereply_uv {
238 struct xpc_activate_mq_msghdr_uv hdr;
239 short ch_number;
240};
241
242struct xpc_activate_mq_msg_chctl_openrequest_uv {
243 struct xpc_activate_mq_msghdr_uv hdr;
244 short ch_number;
245 short entry_size; /* size of notify_mq's GRU messages */
246 short local_nentries; /* ??? Is this needed? What is? */
247};
248
249struct xpc_activate_mq_msg_chctl_openreply_uv {
250 struct xpc_activate_mq_msghdr_uv hdr;
251 short ch_number;
252 short remote_nentries; /* ??? Is this needed? What is? */
253 short local_nentries; /* ??? Is this needed? What is? */
254 unsigned long local_notify_mq_gpa;
255};
265 256
266/* 257/*
267 * Functions registered by add_timer() or called by kernel_thread() only 258 * Functions registered by add_timer() or called by kernel_thread() only
@@ -270,22 +261,22 @@ struct xpc_vars_part {
270 * the passed argument. 261 * the passed argument.
271 */ 262 */
272#define XPC_PACK_ARGS(_arg1, _arg2) \ 263#define XPC_PACK_ARGS(_arg1, _arg2) \
273 ((((u64) _arg1) & 0xffffffff) | \ 264 ((((u64)_arg1) & 0xffffffff) | \
274 ((((u64) _arg2) & 0xffffffff) << 32)) 265 ((((u64)_arg2) & 0xffffffff) << 32))
275 266
276#define XPC_UNPACK_ARG1(_args) (((u64) _args) & 0xffffffff) 267#define XPC_UNPACK_ARG1(_args) (((u64)_args) & 0xffffffff)
277#define XPC_UNPACK_ARG2(_args) ((((u64) _args) >> 32) & 0xffffffff) 268#define XPC_UNPACK_ARG2(_args) ((((u64)_args) >> 32) & 0xffffffff)
278 269
279/* 270/*
280 * Define a Get/Put value pair (pointers) used with a message queue. 271 * Define a Get/Put value pair (pointers) used with a message queue.
281 */ 272 */
282struct xpc_gp { 273struct xpc_gp_sn2 {
283 s64 get; /* Get value */ 274 s64 get; /* Get value */
284 s64 put; /* Put value */ 275 s64 put; /* Put value */
285}; 276};
286 277
287#define XPC_GP_SIZE \ 278#define XPC_GP_SIZE \
288 L1_CACHE_ALIGN(sizeof(struct xpc_gp) * XPC_NCHANNELS) 279 L1_CACHE_ALIGN(sizeof(struct xpc_gp_sn2) * XPC_MAX_NCHANNELS)
289 280
290/* 281/*
291 * Define a structure that contains arguments associated with opening and 282 * Define a structure that contains arguments associated with opening and
@@ -293,31 +284,89 @@ struct xpc_gp {
293 */ 284 */
294struct xpc_openclose_args { 285struct xpc_openclose_args {
295 u16 reason; /* reason why channel is closing */ 286 u16 reason; /* reason why channel is closing */
296 u16 msg_size; /* sizeof each message entry */ 287 u16 entry_size; /* sizeof each message entry */
297 u16 remote_nentries; /* #of message entries in remote msg queue */ 288 u16 remote_nentries; /* #of message entries in remote msg queue */
298 u16 local_nentries; /* #of message entries in local msg queue */ 289 u16 local_nentries; /* #of message entries in local msg queue */
299 u64 local_msgqueue_pa; /* physical address of local message queue */ 290 unsigned long local_msgqueue_pa; /* phys addr of local message queue */
300}; 291};
301 292
302#define XPC_OPENCLOSE_ARGS_SIZE \ 293#define XPC_OPENCLOSE_ARGS_SIZE \
303 L1_CACHE_ALIGN(sizeof(struct xpc_openclose_args) * XPC_NCHANNELS) 294 L1_CACHE_ALIGN(sizeof(struct xpc_openclose_args) * \
295 XPC_MAX_NCHANNELS)
304 296
305/* struct xpc_msg flags */
306 297
307#define XPC_M_DONE 0x01 /* msg has been received/consumed */ 298/*
308#define XPC_M_READY 0x02 /* msg is ready to be sent */ 299 * Structures to define a fifo singly-linked list.
309#define XPC_M_INTERRUPT 0x04 /* send interrupt when msg consumed */ 300 */
310 301
311#define XPC_MSG_ADDRESS(_payload) \ 302struct xpc_fifo_entry_uv {
312 ((struct xpc_msg *)((u8 *)(_payload) - XPC_MSG_PAYLOAD_OFFSET)) 303 struct xpc_fifo_entry_uv *next;
304};
305
306struct xpc_fifo_head_uv {
307 struct xpc_fifo_entry_uv *first;
308 struct xpc_fifo_entry_uv *last;
309 spinlock_t lock;
310 int n_entries;
311};
313 312
314/* 313/*
315 * Defines notify entry. 314 * Define a sn2 styled message.
315 *
316 * A user-defined message resides in the payload area. The max size of the
317 * payload is defined by the user via xpc_connect().
318 *
319 * The size of a message entry (within a message queue) must be a 128-byte
320 * cacheline sized multiple in order to facilitate the BTE transfer of messages
321 * from one message queue to another.
322 */
323struct xpc_msg_sn2 {
324 u8 flags; /* FOR XPC INTERNAL USE ONLY */
325 u8 reserved[7]; /* FOR XPC INTERNAL USE ONLY */
326 s64 number; /* FOR XPC INTERNAL USE ONLY */
327
328 u64 payload; /* user defined portion of message */
329};
330
331/* struct xpc_msg_sn2 flags */
332
333#define XPC_M_SN2_DONE 0x01 /* msg has been received/consumed */
334#define XPC_M_SN2_READY 0x02 /* msg is ready to be sent */
335#define XPC_M_SN2_INTERRUPT 0x04 /* send interrupt when msg consumed */
336
337/*
338 * The format of a uv XPC notify_mq GRU message is as follows:
339 *
340 * A user-defined message resides in the payload area. The max size of the
341 * payload is defined by the user via xpc_connect().
342 *
343 * The size of a message (payload and header) sent via the GRU must be either 1
344 * or 2 GRU_CACHE_LINE_BYTES in length.
345 */
346
347struct xpc_notify_mq_msghdr_uv {
348 union {
349 unsigned int gru_msg_hdr; /* FOR GRU INTERNAL USE ONLY */
350 struct xpc_fifo_entry_uv next; /* FOR XPC INTERNAL USE ONLY */
351 } u;
352 short partid; /* FOR XPC INTERNAL USE ONLY */
353 u8 ch_number; /* FOR XPC INTERNAL USE ONLY */
354 u8 size; /* FOR XPC INTERNAL USE ONLY */
355 unsigned int msg_slot_number; /* FOR XPC INTERNAL USE ONLY */
356};
357
358struct xpc_notify_mq_msg_uv {
359 struct xpc_notify_mq_msghdr_uv hdr;
360 unsigned long payload;
361};
362
363/*
364 * Define sn2's notify entry.
316 * 365 *
317 * This is used to notify a message's sender that their message was received 366 * This is used to notify a message's sender that their message was received
318 * and consumed by the intended recipient. 367 * and consumed by the intended recipient.
319 */ 368 */
320struct xpc_notify { 369struct xpc_notify_sn2 {
321 u8 type; /* type of notification */ 370 u8 type; /* type of notification */
322 371
323 /* the following two fields are only used if type == XPC_N_CALL */ 372 /* the following two fields are only used if type == XPC_N_CALL */
@@ -325,9 +374,20 @@ struct xpc_notify {
325 void *key; /* pointer to user's key */ 374 void *key; /* pointer to user's key */
326}; 375};
327 376
328/* struct xpc_notify type of notification */ 377/* struct xpc_notify_sn2 type of notification */
378
379#define XPC_N_CALL 0x01 /* notify function provided by user */
329 380
330#define XPC_N_CALL 0x01 /* notify function provided by user */ 381/*
382 * Define uv's version of the notify entry. It additionally is used to allocate
383 * a msg slot on the remote partition into which is copied a sent message.
384 */
385struct xpc_send_msg_slot_uv {
386 struct xpc_fifo_entry_uv next;
387 unsigned int msg_slot_number;
388 xpc_notify_func func; /* user's notify function */
389 void *key; /* pointer to user's key */
390};
331 391
332/* 392/*
333 * Define the structure that manages all the stuff required by a channel. In 393 * Define the structure that manages all the stuff required by a channel. In
@@ -339,8 +399,12 @@ struct xpc_notify {
339 * There is an array of these structures for each remote partition. It is 399 * There is an array of these structures for each remote partition. It is
340 * allocated at the time a partition becomes active. The array contains one 400 * allocated at the time a partition becomes active. The array contains one
341 * of these structures for each potential channel connection to that partition. 401 * of these structures for each potential channel connection to that partition.
402 */
403
404/*
405 * The following is sn2 only.
342 * 406 *
343 * Each of these structures manages two message queues (circular buffers). 407 * Each channel structure manages two message queues (circular buffers).
344 * They are allocated at the time a channel connection is made. One of 408 * They are allocated at the time a channel connection is made. One of
345 * these message queues (local_msgqueue) holds the locally created messages 409 * these message queues (local_msgqueue) holds the locally created messages
346 * that are destined for the remote partition. The other of these message 410 * that are destined for the remote partition. The other of these message
@@ -407,58 +471,72 @@ struct xpc_notify {
407 * new messages, by the clearing of the message flags of the acknowledged 471 * new messages, by the clearing of the message flags of the acknowledged
408 * messages. 472 * messages.
409 */ 473 */
474
475struct xpc_channel_sn2 {
476 struct xpc_openclose_args *local_openclose_args; /* args passed on */
477 /* opening or closing of channel */
478
479 void *local_msgqueue_base; /* base address of kmalloc'd space */
480 struct xpc_msg_sn2 *local_msgqueue; /* local message queue */
481 void *remote_msgqueue_base; /* base address of kmalloc'd space */
482 struct xpc_msg_sn2 *remote_msgqueue; /* cached copy of remote */
483 /* partition's local message queue */
484 unsigned long remote_msgqueue_pa; /* phys addr of remote partition's */
485 /* local message queue */
486
487 struct xpc_notify_sn2 *notify_queue;/* notify queue for messages sent */
488
489 /* various flavors of local and remote Get/Put values */
490
491 struct xpc_gp_sn2 *local_GP; /* local Get/Put values */
492 struct xpc_gp_sn2 remote_GP; /* remote Get/Put values */
493 struct xpc_gp_sn2 w_local_GP; /* working local Get/Put values */
494 struct xpc_gp_sn2 w_remote_GP; /* working remote Get/Put values */
495 s64 next_msg_to_pull; /* Put value of next msg to pull */
496
497 struct mutex msg_to_pull_mutex; /* next msg to pull serialization */
498};
499
500struct xpc_channel_uv {
501 unsigned long remote_notify_mq_gpa; /* gru phys address of remote */
502 /* partition's notify mq */
503
504 struct xpc_send_msg_slot_uv *send_msg_slots;
505 struct xpc_notify_mq_msg_uv *recv_msg_slots;
506
507 struct xpc_fifo_head_uv msg_slot_free_list;
508 struct xpc_fifo_head_uv recv_msg_list; /* deliverable payloads */
509};
510
410struct xpc_channel { 511struct xpc_channel {
411 short partid; /* ID of remote partition connected */ 512 short partid; /* ID of remote partition connected */
412 spinlock_t lock; /* lock for updating this structure */ 513 spinlock_t lock; /* lock for updating this structure */
413 u32 flags; /* general flags */ 514 unsigned int flags; /* general flags */
414 515
415 enum xp_retval reason; /* reason why channel is disconnect'g */ 516 enum xp_retval reason; /* reason why channel is disconnect'g */
416 int reason_line; /* line# disconnect initiated from */ 517 int reason_line; /* line# disconnect initiated from */
417 518
418 u16 number; /* channel # */ 519 u16 number; /* channel # */
419 520
420 u16 msg_size; /* sizeof each msg entry */ 521 u16 entry_size; /* sizeof each msg entry */
421 u16 local_nentries; /* #of msg entries in local msg queue */ 522 u16 local_nentries; /* #of msg entries in local msg queue */
422 u16 remote_nentries; /* #of msg entries in remote msg queue */ 523 u16 remote_nentries; /* #of msg entries in remote msg queue */
423 524
424 void *local_msgqueue_base; /* base address of kmalloc'd space */
425 struct xpc_msg *local_msgqueue; /* local message queue */
426 void *remote_msgqueue_base; /* base address of kmalloc'd space */
427 struct xpc_msg *remote_msgqueue; /* cached copy of remote partition's */
428 /* local message queue */
429 u64 remote_msgqueue_pa; /* phys addr of remote partition's */
430 /* local message queue */
431
432 atomic_t references; /* #of external references to queues */ 525 atomic_t references; /* #of external references to queues */
433 526
434 atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */ 527 atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */
435 wait_queue_head_t msg_allocate_wq; /* msg allocation wait queue */ 528 wait_queue_head_t msg_allocate_wq; /* msg allocation wait queue */
436 529
437 u8 delayed_IPI_flags; /* IPI flags received, but delayed */ 530 u8 delayed_chctl_flags; /* chctl flags received, but delayed */
438 /* action until channel disconnected */ 531 /* action until channel disconnected */
439 532
440 /* queue of msg senders who want to be notified when msg received */
441
442 atomic_t n_to_notify; /* #of msg senders to notify */ 533 atomic_t n_to_notify; /* #of msg senders to notify */
443 struct xpc_notify *notify_queue; /* notify queue for messages sent */
444 534
445 xpc_channel_func func; /* user's channel function */ 535 xpc_channel_func func; /* user's channel function */
446 void *key; /* pointer to user's key */ 536 void *key; /* pointer to user's key */
447 537
448 struct mutex msg_to_pull_mutex; /* next msg to pull serialization */
449 struct completion wdisconnect_wait; /* wait for channel disconnect */ 538 struct completion wdisconnect_wait; /* wait for channel disconnect */
450 539
451 struct xpc_openclose_args *local_openclose_args; /* args passed on */
452 /* opening or closing of channel */
453
454 /* various flavors of local and remote Get/Put values */
455
456 struct xpc_gp *local_GP; /* local Get/Put values */
457 struct xpc_gp remote_GP; /* remote Get/Put values */
458 struct xpc_gp w_local_GP; /* working local Get/Put values */
459 struct xpc_gp w_remote_GP; /* working remote Get/Put values */
460 s64 next_msg_to_pull; /* Put value of next msg to pull */
461
462 /* kthread management related fields */ 540 /* kthread management related fields */
463 541
464 atomic_t kthreads_assigned; /* #of kthreads assigned to channel */ 542 atomic_t kthreads_assigned; /* #of kthreads assigned to channel */
@@ -469,6 +547,11 @@ struct xpc_channel {
469 547
470 wait_queue_head_t idle_wq; /* idle kthread wait queue */ 548 wait_queue_head_t idle_wq; /* idle kthread wait queue */
471 549
550 union {
551 struct xpc_channel_sn2 sn2;
552 struct xpc_channel_uv uv;
553 } sn;
554
472} ____cacheline_aligned; 555} ____cacheline_aligned;
473 556
474/* struct xpc_channel flags */ 557/* struct xpc_channel flags */
@@ -501,33 +584,128 @@ struct xpc_channel {
501#define XPC_C_WDISCONNECT 0x00040000 /* waiting for channel disconnect */ 584#define XPC_C_WDISCONNECT 0x00040000 /* waiting for channel disconnect */
502 585
503/* 586/*
504 * Manages channels on a partition basis. There is one of these structures 587 * The channel control flags (chctl) union consists of a 64-bit variable which
588 * is divided up into eight bytes, ordered from right to left. Byte zero
589 * pertains to channel 0, byte one to channel 1, and so on. Each channel's byte
590 * can have one or more of the chctl flags set in it.
591 */
592
593union xpc_channel_ctl_flags {
594 u64 all_flags;
595 u8 flags[XPC_MAX_NCHANNELS];
596};
597
598/* chctl flags */
599#define XPC_CHCTL_CLOSEREQUEST 0x01
600#define XPC_CHCTL_CLOSEREPLY 0x02
601#define XPC_CHCTL_OPENREQUEST 0x04
602#define XPC_CHCTL_OPENREPLY 0x08
603#define XPC_CHCTL_MSGREQUEST 0x10
604
605#define XPC_OPENCLOSE_CHCTL_FLAGS \
606 (XPC_CHCTL_CLOSEREQUEST | XPC_CHCTL_CLOSEREPLY | \
607 XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY)
608#define XPC_MSG_CHCTL_FLAGS XPC_CHCTL_MSGREQUEST
609
610static inline int
611xpc_any_openclose_chctl_flags_set(union xpc_channel_ctl_flags *chctl)
612{
613 int ch_number;
614
615 for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) {
616 if (chctl->flags[ch_number] & XPC_OPENCLOSE_CHCTL_FLAGS)
617 return 1;
618 }
619 return 0;
620}
621
622static inline int
623xpc_any_msg_chctl_flags_set(union xpc_channel_ctl_flags *chctl)
624{
625 int ch_number;
626
627 for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) {
628 if (chctl->flags[ch_number] & XPC_MSG_CHCTL_FLAGS)
629 return 1;
630 }
631 return 0;
632}
633
634/*
635 * Manage channels on a partition basis. There is one of these structures
505 * for each partition (a partition will never utilize the structure that 636 * for each partition (a partition will never utilize the structure that
506 * represents itself). 637 * represents itself).
507 */ 638 */
639
640struct xpc_partition_sn2 {
641 unsigned long remote_amos_page_pa; /* paddr of partition's amos page */
642 int activate_IRQ_nasid; /* active partition's act/deact nasid */
643 int activate_IRQ_phys_cpuid; /* active part's act/deact phys cpuid */
644
645 unsigned long remote_vars_pa; /* phys addr of partition's vars */
646 unsigned long remote_vars_part_pa; /* paddr of partition's vars part */
647 u8 remote_vars_version; /* version# of partition's vars */
648
649 void *local_GPs_base; /* base address of kmalloc'd space */
650 struct xpc_gp_sn2 *local_GPs; /* local Get/Put values */
651 void *remote_GPs_base; /* base address of kmalloc'd space */
652 struct xpc_gp_sn2 *remote_GPs; /* copy of remote partition's local */
653 /* Get/Put values */
654 unsigned long remote_GPs_pa; /* phys addr of remote partition's local */
655 /* Get/Put values */
656
657 void *local_openclose_args_base; /* base address of kmalloc'd space */
658 struct xpc_openclose_args *local_openclose_args; /* local's args */
659 unsigned long remote_openclose_args_pa; /* phys addr of remote's args */
660
661 int notify_IRQ_nasid; /* nasid of where to send notify IRQs */
662 int notify_IRQ_phys_cpuid; /* CPUID of where to send notify IRQs */
663 char notify_IRQ_owner[8]; /* notify IRQ's owner's name */
664
665 struct amo *remote_chctl_amo_va; /* addr of remote chctl flags' amo */
666 struct amo *local_chctl_amo_va; /* address of chctl flags' amo */
667
668 struct timer_list dropped_notify_IRQ_timer; /* dropped IRQ timer */
669};
670
671struct xpc_partition_uv {
672 unsigned long remote_activate_mq_gpa; /* gru phys address of remote */
673 /* partition's activate mq */
674 spinlock_t flags_lock; /* protect updating of flags */
675 unsigned int flags; /* general flags */
676 u8 remote_act_state; /* remote partition's act_state */
677 u8 act_state_req; /* act_state request from remote partition */
678 enum xp_retval reason; /* reason for deactivate act_state request */
679 u64 heartbeat; /* incremented by remote partition */
680};
681
682/* struct xpc_partition_uv flags */
683
684#define XPC_P_HEARTBEAT_OFFLINE_UV 0x00000001
685#define XPC_P_ENGAGED_UV 0x00000002
686
687/* struct xpc_partition_uv act_state change requests */
688
689#define XPC_P_ASR_ACTIVATE_UV 0x01
690#define XPC_P_ASR_REACTIVATE_UV 0x02
691#define XPC_P_ASR_DEACTIVATE_UV 0x03
692
508struct xpc_partition { 693struct xpc_partition {
509 694
510 /* XPC HB infrastructure */ 695 /* XPC HB infrastructure */
511 696
512 u8 remote_rp_version; /* version# of partition's rsvd pg */ 697 u8 remote_rp_version; /* version# of partition's rsvd pg */
513 struct timespec remote_rp_stamp; /* time when rsvd pg was initialized */ 698 unsigned long remote_rp_ts_jiffies; /* timestamp when rsvd pg setup */
514 u64 remote_rp_pa; /* phys addr of partition's rsvd pg */ 699 unsigned long remote_rp_pa; /* phys addr of partition's rsvd pg */
515 u64 remote_vars_pa; /* phys addr of partition's vars */
516 u64 remote_vars_part_pa; /* phys addr of partition's vars part */
517 u64 last_heartbeat; /* HB at last read */ 700 u64 last_heartbeat; /* HB at last read */
518 u64 remote_amos_page_pa; /* phys addr of partition's amos page */ 701 u32 activate_IRQ_rcvd; /* IRQs since activation */
519 int remote_act_nasid; /* active part's act/deact nasid */
520 int remote_act_phys_cpuid; /* active part's act/deact phys cpuid */
521 u32 act_IRQ_rcvd; /* IRQs since activation */
522 spinlock_t act_lock; /* protect updating of act_state */ 702 spinlock_t act_lock; /* protect updating of act_state */
523 u8 act_state; /* from XPC HB viewpoint */ 703 u8 act_state; /* from XPC HB viewpoint */
524 u8 remote_vars_version; /* version# of partition's vars */
525 enum xp_retval reason; /* reason partition is deactivating */ 704 enum xp_retval reason; /* reason partition is deactivating */
526 int reason_line; /* line# deactivation initiated from */ 705 int reason_line; /* line# deactivation initiated from */
527 int reactivate_nasid; /* nasid in partition to reactivate */
528 706
529 unsigned long disengage_request_timeout; /* timeout in jiffies */ 707 unsigned long disengage_timeout; /* timeout in jiffies */
530 struct timer_list disengage_request_timer; 708 struct timer_list disengage_timer;
531 709
532 /* XPC infrastructure referencing and teardown control */ 710 /* XPC infrastructure referencing and teardown control */
533 711
@@ -535,85 +713,63 @@ struct xpc_partition {
535 wait_queue_head_t teardown_wq; /* kthread waiting to teardown infra */ 713 wait_queue_head_t teardown_wq; /* kthread waiting to teardown infra */
536 atomic_t references; /* #of references to infrastructure */ 714 atomic_t references; /* #of references to infrastructure */
537 715
538 /*
539 * NONE OF THE PRECEDING FIELDS OF THIS STRUCTURE WILL BE CLEARED WHEN
540 * XPC SETS UP THE NECESSARY INFRASTRUCTURE TO SUPPORT CROSS PARTITION
541 * COMMUNICATION. ALL OF THE FOLLOWING FIELDS WILL BE CLEARED. (THE
542 * 'nchannels' FIELD MUST BE THE FIRST OF THE FIELDS TO BE CLEARED.)
543 */
544
545 u8 nchannels; /* #of defined channels supported */ 716 u8 nchannels; /* #of defined channels supported */
546 atomic_t nchannels_active; /* #of channels that are not DISCONNECTED */ 717 atomic_t nchannels_active; /* #of channels that are not DISCONNECTED */
547 atomic_t nchannels_engaged; /* #of channels engaged with remote part */ 718 atomic_t nchannels_engaged; /* #of channels engaged with remote part */
548 struct xpc_channel *channels; /* array of channel structures */ 719 struct xpc_channel *channels; /* array of channel structures */
549 720
550 void *local_GPs_base; /* base address of kmalloc'd space */ 721 /* fields used for managing channel avialability and activity */
551 struct xpc_gp *local_GPs; /* local Get/Put values */
552 void *remote_GPs_base; /* base address of kmalloc'd space */
553 struct xpc_gp *remote_GPs; /* copy of remote partition's local */
554 /* Get/Put values */
555 u64 remote_GPs_pa; /* phys address of remote partition's local */
556 /* Get/Put values */
557 722
558 /* fields used to pass args when opening or closing a channel */ 723 union xpc_channel_ctl_flags chctl; /* chctl flags yet to be processed */
724 spinlock_t chctl_lock; /* chctl flags lock */
559 725
560 void *local_openclose_args_base; /* base address of kmalloc'd space */
561 struct xpc_openclose_args *local_openclose_args; /* local's args */
562 void *remote_openclose_args_base; /* base address of kmalloc'd space */ 726 void *remote_openclose_args_base; /* base address of kmalloc'd space */
563 struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */ 727 struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */
564 /* args */ 728 /* args */
565 u64 remote_openclose_args_pa; /* phys addr of remote's args */
566
567 /* IPI sending, receiving and handling related fields */
568
569 int remote_IPI_nasid; /* nasid of where to send IPIs */
570 int remote_IPI_phys_cpuid; /* phys CPU ID of where to send IPIs */
571 AMO_t *remote_IPI_amo_va; /* address of remote IPI AMO_t structure */
572
573 AMO_t *local_IPI_amo_va; /* address of IPI AMO_t structure */
574 u64 local_IPI_amo; /* IPI amo flags yet to be handled */
575 char IPI_owner[8]; /* IPI owner's name */
576 struct timer_list dropped_IPI_timer; /* dropped IPI timer */
577
578 spinlock_t IPI_lock; /* IPI handler lock */
579 729
580 /* channel manager related fields */ 730 /* channel manager related fields */
581 731
582 atomic_t channel_mgr_requests; /* #of requests to activate chan mgr */ 732 atomic_t channel_mgr_requests; /* #of requests to activate chan mgr */
583 wait_queue_head_t channel_mgr_wq; /* channel mgr's wait queue */ 733 wait_queue_head_t channel_mgr_wq; /* channel mgr's wait queue */
584 734
735 union {
736 struct xpc_partition_sn2 sn2;
737 struct xpc_partition_uv uv;
738 } sn;
739
585} ____cacheline_aligned; 740} ____cacheline_aligned;
586 741
587/* struct xpc_partition act_state values (for XPC HB) */ 742/* struct xpc_partition act_state values (for XPC HB) */
588 743
589#define XPC_P_INACTIVE 0x00 /* partition is not active */ 744#define XPC_P_AS_INACTIVE 0x00 /* partition is not active */
590#define XPC_P_ACTIVATION_REQ 0x01 /* created thread to activate */ 745#define XPC_P_AS_ACTIVATION_REQ 0x01 /* created thread to activate */
591#define XPC_P_ACTIVATING 0x02 /* activation thread started */ 746#define XPC_P_AS_ACTIVATING 0x02 /* activation thread started */
592#define XPC_P_ACTIVE 0x03 /* xpc_partition_up() was called */ 747#define XPC_P_AS_ACTIVE 0x03 /* xpc_partition_up() was called */
593#define XPC_P_DEACTIVATING 0x04 /* partition deactivation initiated */ 748#define XPC_P_AS_DEACTIVATING 0x04 /* partition deactivation initiated */
594 749
595#define XPC_DEACTIVATE_PARTITION(_p, _reason) \ 750#define XPC_DEACTIVATE_PARTITION(_p, _reason) \
596 xpc_deactivate_partition(__LINE__, (_p), (_reason)) 751 xpc_deactivate_partition(__LINE__, (_p), (_reason))
597 752
598/* struct xpc_partition setup_state values */ 753/* struct xpc_partition setup_state values */
599 754
600#define XPC_P_UNSET 0x00 /* infrastructure was never setup */ 755#define XPC_P_SS_UNSET 0x00 /* infrastructure was never setup */
601#define XPC_P_SETUP 0x01 /* infrastructure is setup */ 756#define XPC_P_SS_SETUP 0x01 /* infrastructure is setup */
602#define XPC_P_WTEARDOWN 0x02 /* waiting to teardown infrastructure */ 757#define XPC_P_SS_WTEARDOWN 0x02 /* waiting to teardown infrastructure */
603#define XPC_P_TORNDOWN 0x03 /* infrastructure is torndown */ 758#define XPC_P_SS_TORNDOWN 0x03 /* infrastructure is torndown */
604 759
605/* 760/*
606 * struct xpc_partition IPI_timer #of seconds to wait before checking for 761 * struct xpc_partition_sn2's dropped notify IRQ timer is set to wait the
607 * dropped IPIs. These occur whenever an IPI amo write doesn't complete until 762 * following interval #of seconds before checking for dropped notify IRQs.
608 * after the IPI was received. 763 * These can occur whenever an IRQ's associated amo write doesn't complete
764 * until after the IRQ was received.
609 */ 765 */
610#define XPC_P_DROPPED_IPI_WAIT (0.25 * HZ) 766#define XPC_DROPPED_NOTIFY_IRQ_WAIT_INTERVAL (0.25 * HZ)
611 767
612/* number of seconds to wait for other partitions to disengage */ 768/* number of seconds to wait for other partitions to disengage */
613#define XPC_DISENGAGE_REQUEST_DEFAULT_TIMELIMIT 90 769#define XPC_DISENGAGE_DEFAULT_TIMELIMIT 90
614 770
615/* interval in seconds to print 'waiting disengagement' messages */ 771/* interval in seconds to print 'waiting deactivation' messages */
616#define XPC_DISENGAGE_PRINTMSG_INTERVAL 10 772#define XPC_DEACTIVATE_PRINTMSG_INTERVAL 10
617 773
618#define XPC_PARTID(_p) ((short)((_p) - &xpc_partitions[0])) 774#define XPC_PARTID(_p) ((short)((_p) - &xpc_partitions[0]))
619 775
@@ -623,33 +779,92 @@ extern struct xpc_registration xpc_registrations[];
623/* found in xpc_main.c */ 779/* found in xpc_main.c */
624extern struct device *xpc_part; 780extern struct device *xpc_part;
625extern struct device *xpc_chan; 781extern struct device *xpc_chan;
626extern int xpc_disengage_request_timelimit; 782extern int xpc_disengage_timelimit;
627extern int xpc_disengage_request_timedout; 783extern int xpc_disengage_timedout;
628extern irqreturn_t xpc_notify_IRQ_handler(int, void *); 784extern int xpc_activate_IRQ_rcvd;
629extern void xpc_dropped_IPI_check(struct xpc_partition *); 785extern spinlock_t xpc_activate_IRQ_rcvd_lock;
786extern wait_queue_head_t xpc_activate_IRQ_wq;
787extern void *xpc_heartbeating_to_mask;
788extern void *xpc_kzalloc_cacheline_aligned(size_t, gfp_t, void **);
630extern void xpc_activate_partition(struct xpc_partition *); 789extern void xpc_activate_partition(struct xpc_partition *);
631extern void xpc_activate_kthreads(struct xpc_channel *, int); 790extern void xpc_activate_kthreads(struct xpc_channel *, int);
632extern void xpc_create_kthreads(struct xpc_channel *, int, int); 791extern void xpc_create_kthreads(struct xpc_channel *, int, int);
633extern void xpc_disconnect_wait(int); 792extern void xpc_disconnect_wait(int);
793extern int (*xpc_setup_partitions_sn) (void);
794extern enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *, u64 *,
795 unsigned long *,
796 size_t *);
797extern int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *);
798extern void (*xpc_heartbeat_init) (void);
799extern void (*xpc_heartbeat_exit) (void);
800extern void (*xpc_increment_heartbeat) (void);
801extern void (*xpc_offline_heartbeat) (void);
802extern void (*xpc_online_heartbeat) (void);
803extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *);
804extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *);
805extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *);
806extern enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *);
807extern void (*xpc_teardown_msg_structures) (struct xpc_channel *);
808extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *);
809extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int);
810extern int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *);
811extern void *(*xpc_get_deliverable_payload) (struct xpc_channel *);
812extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *,
813 unsigned long, int);
814extern void (*xpc_request_partition_reactivation) (struct xpc_partition *);
815extern void (*xpc_request_partition_deactivation) (struct xpc_partition *);
816extern void (*xpc_cancel_partition_deactivation_request) (
817 struct xpc_partition *);
818extern void (*xpc_process_activate_IRQ_rcvd) (void);
819extern enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *);
820extern void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *);
821
822extern void (*xpc_indicate_partition_engaged) (struct xpc_partition *);
823extern int (*xpc_partition_engaged) (short);
824extern int (*xpc_any_partition_engaged) (void);
825extern void (*xpc_indicate_partition_disengaged) (struct xpc_partition *);
826extern void (*xpc_assume_partition_disengaged) (short);
827
828extern void (*xpc_send_chctl_closerequest) (struct xpc_channel *,
829 unsigned long *);
830extern void (*xpc_send_chctl_closereply) (struct xpc_channel *,
831 unsigned long *);
832extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *,
833 unsigned long *);
834extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *);
835
836extern void (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *,
837 unsigned long);
838
839extern enum xp_retval (*xpc_send_payload) (struct xpc_channel *, u32, void *,
840 u16, u8, xpc_notify_func, void *);
841extern void (*xpc_received_payload) (struct xpc_channel *, void *);
842
843/* found in xpc_sn2.c */
844extern int xpc_init_sn2(void);
845extern void xpc_exit_sn2(void);
846
847/* found in xpc_uv.c */
848extern int xpc_init_uv(void);
849extern void xpc_exit_uv(void);
634 850
635/* found in xpc_partition.c */ 851/* found in xpc_partition.c */
636extern int xpc_exiting; 852extern int xpc_exiting;
637extern struct xpc_vars *xpc_vars; 853extern int xpc_nasid_mask_nlongs;
638extern struct xpc_rsvd_page *xpc_rsvd_page; 854extern struct xpc_rsvd_page *xpc_rsvd_page;
639extern struct xpc_vars_part *xpc_vars_part; 855extern unsigned long *xpc_mach_nasids;
640extern struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1]; 856extern struct xpc_partition *xpc_partitions;
641extern char *xpc_remote_copy_buffer;
642extern void *xpc_remote_copy_buffer_base;
643extern void *xpc_kmalloc_cacheline_aligned(size_t, gfp_t, void **); 857extern void *xpc_kmalloc_cacheline_aligned(size_t, gfp_t, void **);
644extern struct xpc_rsvd_page *xpc_rsvd_page_init(void); 858extern int xpc_setup_rsvd_page(void);
645extern void xpc_allow_IPI_ops(void); 859extern void xpc_teardown_rsvd_page(void);
646extern void xpc_restrict_IPI_ops(void); 860extern int xpc_identify_activate_IRQ_sender(void);
647extern int xpc_identify_act_IRQ_sender(void);
648extern int xpc_partition_disengaged(struct xpc_partition *); 861extern int xpc_partition_disengaged(struct xpc_partition *);
649extern enum xp_retval xpc_mark_partition_active(struct xpc_partition *); 862extern enum xp_retval xpc_mark_partition_active(struct xpc_partition *);
650extern void xpc_mark_partition_inactive(struct xpc_partition *); 863extern void xpc_mark_partition_inactive(struct xpc_partition *);
651extern void xpc_discovery(void); 864extern void xpc_discovery(void);
652extern void xpc_check_remote_hb(void); 865extern enum xp_retval xpc_get_remote_rp(int, unsigned long *,
866 struct xpc_rsvd_page *,
867 unsigned long *);
653extern void xpc_deactivate_partition(const int, struct xpc_partition *, 868extern void xpc_deactivate_partition(const int, struct xpc_partition *,
654 enum xp_retval); 869 enum xp_retval);
655extern enum xp_retval xpc_initiate_partid_to_nasids(short, void *); 870extern enum xp_retval xpc_initiate_partid_to_nasids(short, void *);
@@ -657,21 +872,52 @@ extern enum xp_retval xpc_initiate_partid_to_nasids(short, void *);
657/* found in xpc_channel.c */ 872/* found in xpc_channel.c */
658extern void xpc_initiate_connect(int); 873extern void xpc_initiate_connect(int);
659extern void xpc_initiate_disconnect(int); 874extern void xpc_initiate_disconnect(int);
660extern enum xp_retval xpc_initiate_allocate(short, int, u32, void **); 875extern enum xp_retval xpc_allocate_msg_wait(struct xpc_channel *);
661extern enum xp_retval xpc_initiate_send(short, int, void *); 876extern enum xp_retval xpc_initiate_send(short, int, u32, void *, u16);
662extern enum xp_retval xpc_initiate_send_notify(short, int, void *, 877extern enum xp_retval xpc_initiate_send_notify(short, int, u32, void *, u16,
663 xpc_notify_func, void *); 878 xpc_notify_func, void *);
664extern void xpc_initiate_received(short, int, void *); 879extern void xpc_initiate_received(short, int, void *);
665extern enum xp_retval xpc_setup_infrastructure(struct xpc_partition *); 880extern void xpc_process_sent_chctl_flags(struct xpc_partition *);
666extern enum xp_retval xpc_pull_remote_vars_part(struct xpc_partition *);
667extern void xpc_process_channel_activity(struct xpc_partition *);
668extern void xpc_connected_callout(struct xpc_channel *); 881extern void xpc_connected_callout(struct xpc_channel *);
669extern void xpc_deliver_msg(struct xpc_channel *); 882extern void xpc_deliver_payload(struct xpc_channel *);
670extern void xpc_disconnect_channel(const int, struct xpc_channel *, 883extern void xpc_disconnect_channel(const int, struct xpc_channel *,
671 enum xp_retval, unsigned long *); 884 enum xp_retval, unsigned long *);
672extern void xpc_disconnect_callout(struct xpc_channel *, enum xp_retval); 885extern void xpc_disconnect_callout(struct xpc_channel *, enum xp_retval);
673extern void xpc_partition_going_down(struct xpc_partition *, enum xp_retval); 886extern void xpc_partition_going_down(struct xpc_partition *, enum xp_retval);
674extern void xpc_teardown_infrastructure(struct xpc_partition *); 887
888static inline int
889xpc_hb_allowed(short partid, void *heartbeating_to_mask)
890{
891 return test_bit(partid, heartbeating_to_mask);
892}
893
894static inline int
895xpc_any_hbs_allowed(void)
896{
897 DBUG_ON(xpc_heartbeating_to_mask == NULL);
898 return !bitmap_empty(xpc_heartbeating_to_mask, xp_max_npartitions);
899}
900
901static inline void
902xpc_allow_hb(short partid)
903{
904 DBUG_ON(xpc_heartbeating_to_mask == NULL);
905 set_bit(partid, xpc_heartbeating_to_mask);
906}
907
908static inline void
909xpc_disallow_hb(short partid)
910{
911 DBUG_ON(xpc_heartbeating_to_mask == NULL);
912 clear_bit(partid, xpc_heartbeating_to_mask);
913}
914
915static inline void
916xpc_disallow_all_hbs(void)
917{
918 DBUG_ON(xpc_heartbeating_to_mask == NULL);
919 bitmap_zero(xpc_heartbeating_to_mask, xp_max_npartitions);
920}
675 921
676static inline void 922static inline void
677xpc_wakeup_channel_mgr(struct xpc_partition *part) 923xpc_wakeup_channel_mgr(struct xpc_partition *part)
@@ -713,7 +959,7 @@ xpc_part_deref(struct xpc_partition *part)
713 s32 refs = atomic_dec_return(&part->references); 959 s32 refs = atomic_dec_return(&part->references);
714 960
715 DBUG_ON(refs < 0); 961 DBUG_ON(refs < 0);
716 if (refs == 0 && part->setup_state == XPC_P_WTEARDOWN) 962 if (refs == 0 && part->setup_state == XPC_P_SS_WTEARDOWN)
717 wake_up(&part->teardown_wq); 963 wake_up(&part->teardown_wq);
718} 964}
719 965
@@ -723,7 +969,7 @@ xpc_part_ref(struct xpc_partition *part)
723 int setup; 969 int setup;
724 970
725 atomic_inc(&part->references); 971 atomic_inc(&part->references);
726 setup = (part->setup_state == XPC_P_SETUP); 972 setup = (part->setup_state == XPC_P_SS_SETUP);
727 if (!setup) 973 if (!setup)
728 xpc_part_deref(part); 974 xpc_part_deref(part);
729 975
@@ -741,416 +987,4 @@ xpc_part_ref(struct xpc_partition *part)
741 (_p)->reason_line = _line; \ 987 (_p)->reason_line = _line; \
742 } 988 }
743 989
744/*
745 * This next set of inlines are used to keep track of when a partition is
746 * potentially engaged in accessing memory belonging to another partition.
747 */
748
749static inline void
750xpc_mark_partition_engaged(struct xpc_partition *part)
751{
752 unsigned long irq_flags;
753 AMO_t *amo = (AMO_t *)__va(part->remote_amos_page_pa +
754 (XPC_ENGAGED_PARTITIONS_AMO *
755 sizeof(AMO_t)));
756
757 local_irq_save(irq_flags);
758
759 /* set bit corresponding to our partid in remote partition's AMO */
760 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR,
761 (1UL << sn_partition_id));
762 /*
763 * We must always use the nofault function regardless of whether we
764 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
765 * didn't, we'd never know that the other partition is down and would
766 * keep sending IPIs and AMOs to it until the heartbeat times out.
767 */
768 (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
769 variable),
770 xp_nofault_PIOR_target));
771
772 local_irq_restore(irq_flags);
773}
774
775static inline void
776xpc_mark_partition_disengaged(struct xpc_partition *part)
777{
778 unsigned long irq_flags;
779 AMO_t *amo = (AMO_t *)__va(part->remote_amos_page_pa +
780 (XPC_ENGAGED_PARTITIONS_AMO *
781 sizeof(AMO_t)));
782
783 local_irq_save(irq_flags);
784
785 /* clear bit corresponding to our partid in remote partition's AMO */
786 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
787 ~(1UL << sn_partition_id));
788 /*
789 * We must always use the nofault function regardless of whether we
790 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
791 * didn't, we'd never know that the other partition is down and would
792 * keep sending IPIs and AMOs to it until the heartbeat times out.
793 */
794 (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
795 variable),
796 xp_nofault_PIOR_target));
797
798 local_irq_restore(irq_flags);
799}
800
801static inline void
802xpc_request_partition_disengage(struct xpc_partition *part)
803{
804 unsigned long irq_flags;
805 AMO_t *amo = (AMO_t *)__va(part->remote_amos_page_pa +
806 (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
807
808 local_irq_save(irq_flags);
809
810 /* set bit corresponding to our partid in remote partition's AMO */
811 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR,
812 (1UL << sn_partition_id));
813 /*
814 * We must always use the nofault function regardless of whether we
815 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
816 * didn't, we'd never know that the other partition is down and would
817 * keep sending IPIs and AMOs to it until the heartbeat times out.
818 */
819 (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
820 variable),
821 xp_nofault_PIOR_target));
822
823 local_irq_restore(irq_flags);
824}
825
826static inline void
827xpc_cancel_partition_disengage_request(struct xpc_partition *part)
828{
829 unsigned long irq_flags;
830 AMO_t *amo = (AMO_t *)__va(part->remote_amos_page_pa +
831 (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
832
833 local_irq_save(irq_flags);
834
835 /* clear bit corresponding to our partid in remote partition's AMO */
836 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
837 ~(1UL << sn_partition_id));
838 /*
839 * We must always use the nofault function regardless of whether we
840 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
841 * didn't, we'd never know that the other partition is down and would
842 * keep sending IPIs and AMOs to it until the heartbeat times out.
843 */
844 (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
845 variable),
846 xp_nofault_PIOR_target));
847
848 local_irq_restore(irq_flags);
849}
850
851static inline u64
852xpc_partition_engaged(u64 partid_mask)
853{
854 AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
855
856 /* return our partition's AMO variable ANDed with partid_mask */
857 return (FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_LOAD) &
858 partid_mask);
859}
860
861static inline u64
862xpc_partition_disengage_requested(u64 partid_mask)
863{
864 AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
865
866 /* return our partition's AMO variable ANDed with partid_mask */
867 return (FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_LOAD) &
868 partid_mask);
869}
870
871static inline void
872xpc_clear_partition_engaged(u64 partid_mask)
873{
874 AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
875
876 /* clear bit(s) based on partid_mask in our partition's AMO */
877 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
878 ~partid_mask);
879}
880
881static inline void
882xpc_clear_partition_disengage_request(u64 partid_mask)
883{
884 AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
885
886 /* clear bit(s) based on partid_mask in our partition's AMO */
887 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
888 ~partid_mask);
889}
890
891/*
892 * The following set of macros and inlines are used for the sending and
893 * receiving of IPIs (also known as IRQs). There are two flavors of IPIs,
894 * one that is associated with partition activity (SGI_XPC_ACTIVATE) and
895 * the other that is associated with channel activity (SGI_XPC_NOTIFY).
896 */
897
898static inline u64
899xpc_IPI_receive(AMO_t *amo)
900{
901 return FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_CLEAR);
902}
903
904static inline enum xp_retval
905xpc_IPI_send(AMO_t *amo, u64 flag, int nasid, int phys_cpuid, int vector)
906{
907 int ret = 0;
908 unsigned long irq_flags;
909
910 local_irq_save(irq_flags);
911
912 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR, flag);
913 sn_send_IPI_phys(nasid, phys_cpuid, vector, 0);
914
915 /*
916 * We must always use the nofault function regardless of whether we
917 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
918 * didn't, we'd never know that the other partition is down and would
919 * keep sending IPIs and AMOs to it until the heartbeat times out.
920 */
921 ret = xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->variable),
922 xp_nofault_PIOR_target));
923
924 local_irq_restore(irq_flags);
925
926 return ((ret == 0) ? xpSuccess : xpPioReadError);
927}
928
929/*
930 * IPIs associated with SGI_XPC_ACTIVATE IRQ.
931 */
932
933/*
934 * Flag the appropriate AMO variable and send an IPI to the specified node.
935 */
936static inline void
937xpc_activate_IRQ_send(u64 amos_page_pa, int from_nasid, int to_nasid,
938 int to_phys_cpuid)
939{
940 int w_index = XPC_NASID_W_INDEX(from_nasid);
941 int b_index = XPC_NASID_B_INDEX(from_nasid);
942 AMO_t *amos = (AMO_t *)__va(amos_page_pa +
943 (XPC_ACTIVATE_IRQ_AMOS * sizeof(AMO_t)));
944
945 (void)xpc_IPI_send(&amos[w_index], (1UL << b_index), to_nasid,
946 to_phys_cpuid, SGI_XPC_ACTIVATE);
947}
948
949static inline void
950xpc_IPI_send_activate(struct xpc_vars *vars)
951{
952 xpc_activate_IRQ_send(vars->amos_page_pa, cnodeid_to_nasid(0),
953 vars->act_nasid, vars->act_phys_cpuid);
954}
955
956static inline void
957xpc_IPI_send_activated(struct xpc_partition *part)
958{
959 xpc_activate_IRQ_send(part->remote_amos_page_pa, cnodeid_to_nasid(0),
960 part->remote_act_nasid,
961 part->remote_act_phys_cpuid);
962}
963
964static inline void
965xpc_IPI_send_reactivate(struct xpc_partition *part)
966{
967 xpc_activate_IRQ_send(xpc_vars->amos_page_pa, part->reactivate_nasid,
968 xpc_vars->act_nasid, xpc_vars->act_phys_cpuid);
969}
970
971static inline void
972xpc_IPI_send_disengage(struct xpc_partition *part)
973{
974 xpc_activate_IRQ_send(part->remote_amos_page_pa, cnodeid_to_nasid(0),
975 part->remote_act_nasid,
976 part->remote_act_phys_cpuid);
977}
978
979/*
980 * IPIs associated with SGI_XPC_NOTIFY IRQ.
981 */
982
983/*
984 * Send an IPI to the remote partition that is associated with the
985 * specified channel.
986 */
987#define XPC_NOTIFY_IRQ_SEND(_ch, _ipi_f, _irq_f) \
988 xpc_notify_IRQ_send(_ch, _ipi_f, #_ipi_f, _irq_f)
989
990static inline void
991xpc_notify_IRQ_send(struct xpc_channel *ch, u8 ipi_flag, char *ipi_flag_string,
992 unsigned long *irq_flags)
993{
994 struct xpc_partition *part = &xpc_partitions[ch->partid];
995 enum xp_retval ret;
996
997 if (likely(part->act_state != XPC_P_DEACTIVATING)) {
998 ret = xpc_IPI_send(part->remote_IPI_amo_va,
999 (u64)ipi_flag << (ch->number * 8),
1000 part->remote_IPI_nasid,
1001 part->remote_IPI_phys_cpuid, SGI_XPC_NOTIFY);
1002 dev_dbg(xpc_chan, "%s sent to partid=%d, channel=%d, ret=%d\n",
1003 ipi_flag_string, ch->partid, ch->number, ret);
1004 if (unlikely(ret != xpSuccess)) {
1005 if (irq_flags != NULL)
1006 spin_unlock_irqrestore(&ch->lock, *irq_flags);
1007 XPC_DEACTIVATE_PARTITION(part, ret);
1008 if (irq_flags != NULL)
1009 spin_lock_irqsave(&ch->lock, *irq_flags);
1010 }
1011 }
1012}
1013
1014/*
1015 * Make it look like the remote partition, which is associated with the
1016 * specified channel, sent us an IPI. This faked IPI will be handled
1017 * by xpc_dropped_IPI_check().
1018 */
1019#define XPC_NOTIFY_IRQ_SEND_LOCAL(_ch, _ipi_f) \
1020 xpc_notify_IRQ_send_local(_ch, _ipi_f, #_ipi_f)
1021
1022static inline void
1023xpc_notify_IRQ_send_local(struct xpc_channel *ch, u8 ipi_flag,
1024 char *ipi_flag_string)
1025{
1026 struct xpc_partition *part = &xpc_partitions[ch->partid];
1027
1028 FETCHOP_STORE_OP(TO_AMO((u64)&part->local_IPI_amo_va->variable),
1029 FETCHOP_OR, ((u64)ipi_flag << (ch->number * 8)));
1030 dev_dbg(xpc_chan, "%s sent local from partid=%d, channel=%d\n",
1031 ipi_flag_string, ch->partid, ch->number);
1032}
1033
1034/*
1035 * The sending and receiving of IPIs includes the setting of an AMO variable
1036 * to indicate the reason the IPI was sent. The 64-bit variable is divided
1037 * up into eight bytes, ordered from right to left. Byte zero pertains to
1038 * channel 0, byte one to channel 1, and so on. Each byte is described by
1039 * the following IPI flags.
1040 */
1041
1042#define XPC_IPI_CLOSEREQUEST 0x01
1043#define XPC_IPI_CLOSEREPLY 0x02
1044#define XPC_IPI_OPENREQUEST 0x04
1045#define XPC_IPI_OPENREPLY 0x08
1046#define XPC_IPI_MSGREQUEST 0x10
1047
1048/* given an AMO variable and a channel#, get its associated IPI flags */
1049#define XPC_GET_IPI_FLAGS(_amo, _c) ((u8) (((_amo) >> ((_c) * 8)) & 0xff))
1050#define XPC_SET_IPI_FLAGS(_amo, _c, _f) (_amo) |= ((u64) (_f) << ((_c) * 8))
1051
1052#define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0fUL)
1053#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & 0x1010101010101010UL)
1054
1055static inline void
1056xpc_IPI_send_closerequest(struct xpc_channel *ch, unsigned long *irq_flags)
1057{
1058 struct xpc_openclose_args *args = ch->local_openclose_args;
1059
1060 args->reason = ch->reason;
1061
1062 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_CLOSEREQUEST, irq_flags);
1063}
1064
1065static inline void
1066xpc_IPI_send_closereply(struct xpc_channel *ch, unsigned long *irq_flags)
1067{
1068 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_CLOSEREPLY, irq_flags);
1069}
1070
1071static inline void
1072xpc_IPI_send_openrequest(struct xpc_channel *ch, unsigned long *irq_flags)
1073{
1074 struct xpc_openclose_args *args = ch->local_openclose_args;
1075
1076 args->msg_size = ch->msg_size;
1077 args->local_nentries = ch->local_nentries;
1078
1079 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_OPENREQUEST, irq_flags);
1080}
1081
1082static inline void
1083xpc_IPI_send_openreply(struct xpc_channel *ch, unsigned long *irq_flags)
1084{
1085 struct xpc_openclose_args *args = ch->local_openclose_args;
1086
1087 args->remote_nentries = ch->remote_nentries;
1088 args->local_nentries = ch->local_nentries;
1089 args->local_msgqueue_pa = __pa(ch->local_msgqueue);
1090
1091 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_OPENREPLY, irq_flags);
1092}
1093
1094static inline void
1095xpc_IPI_send_msgrequest(struct xpc_channel *ch)
1096{
1097 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_MSGREQUEST, NULL);
1098}
1099
1100static inline void
1101xpc_IPI_send_local_msgrequest(struct xpc_channel *ch)
1102{
1103 XPC_NOTIFY_IRQ_SEND_LOCAL(ch, XPC_IPI_MSGREQUEST);
1104}
1105
1106/*
1107 * Memory for XPC's AMO variables is allocated by the MSPEC driver. These
1108 * pages are located in the lowest granule. The lowest granule uses 4k pages
1109 * for cached references and an alternate TLB handler to never provide a
1110 * cacheable mapping for the entire region. This will prevent speculative
1111 * reading of cached copies of our lines from being issued which will cause
1112 * a PI FSB Protocol error to be generated by the SHUB. For XPC, we need 64
1113 * AMO variables (based on XP_MAX_PARTITIONS) for message notification and an
1114 * additional 128 AMO variables (based on XP_NASID_MASK_WORDS) for partition
1115 * activation and 2 AMO variables for partition deactivation.
1116 */
1117static inline AMO_t *
1118xpc_IPI_init(int index)
1119{
1120 AMO_t *amo = xpc_vars->amos_page + index;
1121
1122 (void)xpc_IPI_receive(amo); /* clear AMO variable */
1123 return amo;
1124}
1125
1126static inline enum xp_retval
1127xpc_map_bte_errors(bte_result_t error)
1128{
1129 return ((error == BTE_SUCCESS) ? xpSuccess : xpBteCopyError);
1130}
1131
1132/*
1133 * Check to see if there is any channel activity to/from the specified
1134 * partition.
1135 */
1136static inline void
1137xpc_check_for_channel_activity(struct xpc_partition *part)
1138{
1139 u64 IPI_amo;
1140 unsigned long irq_flags;
1141
1142 IPI_amo = xpc_IPI_receive(part->local_IPI_amo_va);
1143 if (IPI_amo == 0)
1144 return;
1145
1146 spin_lock_irqsave(&part->IPI_lock, irq_flags);
1147 part->local_IPI_amo |= IPI_amo;
1148 spin_unlock_irqrestore(&part->IPI_lock, irq_flags);
1149
1150 dev_dbg(xpc_chan, "received IPI from partid=%d, IPI_amo=0x%lx\n",
1151 XPC_PARTID(part), IPI_amo);
1152
1153 xpc_wakeup_channel_mgr(part);
1154}
1155
1156#endif /* _DRIVERS_MISC_SGIXP_XPC_H */ 990#endif /* _DRIVERS_MISC_SGIXP_XPC_H */
diff --git a/drivers/misc/sgi-xp/xpc_channel.c b/drivers/misc/sgi-xp/xpc_channel.c
index 9c90c2d55c08..9cd2ebe2a3b6 100644
--- a/drivers/misc/sgi-xp/xpc_channel.c
+++ b/drivers/misc/sgi-xp/xpc_channel.c
@@ -14,536 +14,10 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/device.h>
18#include <linux/init.h>
19#include <linux/sched.h>
20#include <linux/cache.h>
21#include <linux/interrupt.h>
22#include <linux/mutex.h>
23#include <linux/completion.h>
24#include <asm/sn/bte.h>
25#include <asm/sn/sn_sal.h>
26#include "xpc.h" 18#include "xpc.h"
27 19
28/* 20/*
29 * Guarantee that the kzalloc'd memory is cacheline aligned.
30 */
31static void *
32xpc_kzalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
33{
34 /* see if kzalloc will give us cachline aligned memory by default */
35 *base = kzalloc(size, flags);
36 if (*base == NULL)
37 return NULL;
38
39 if ((u64)*base == L1_CACHE_ALIGN((u64)*base))
40 return *base;
41
42 kfree(*base);
43
44 /* nope, we'll have to do it ourselves */
45 *base = kzalloc(size + L1_CACHE_BYTES, flags);
46 if (*base == NULL)
47 return NULL;
48
49 return (void *)L1_CACHE_ALIGN((u64)*base);
50}
51
52/*
53 * Set up the initial values for the XPartition Communication channels.
54 */
55static void
56xpc_initialize_channels(struct xpc_partition *part, short partid)
57{
58 int ch_number;
59 struct xpc_channel *ch;
60
61 for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
62 ch = &part->channels[ch_number];
63
64 ch->partid = partid;
65 ch->number = ch_number;
66 ch->flags = XPC_C_DISCONNECTED;
67
68 ch->local_GP = &part->local_GPs[ch_number];
69 ch->local_openclose_args =
70 &part->local_openclose_args[ch_number];
71
72 atomic_set(&ch->kthreads_assigned, 0);
73 atomic_set(&ch->kthreads_idle, 0);
74 atomic_set(&ch->kthreads_active, 0);
75
76 atomic_set(&ch->references, 0);
77 atomic_set(&ch->n_to_notify, 0);
78
79 spin_lock_init(&ch->lock);
80 mutex_init(&ch->msg_to_pull_mutex);
81 init_completion(&ch->wdisconnect_wait);
82
83 atomic_set(&ch->n_on_msg_allocate_wq, 0);
84 init_waitqueue_head(&ch->msg_allocate_wq);
85 init_waitqueue_head(&ch->idle_wq);
86 }
87}
88
89/*
90 * Setup the infrastructure necessary to support XPartition Communication
91 * between the specified remote partition and the local one.
92 */
93enum xp_retval
94xpc_setup_infrastructure(struct xpc_partition *part)
95{
96 int ret, cpuid;
97 struct timer_list *timer;
98 short partid = XPC_PARTID(part);
99
100 /*
101 * Zero out MOST of the entry for this partition. Only the fields
102 * starting with `nchannels' will be zeroed. The preceding fields must
103 * remain `viable' across partition ups and downs, since they may be
104 * referenced during this memset() operation.
105 */
106 memset(&part->nchannels, 0, sizeof(struct xpc_partition) -
107 offsetof(struct xpc_partition, nchannels));
108
109 /*
110 * Allocate all of the channel structures as a contiguous chunk of
111 * memory.
112 */
113 part->channels = kzalloc(sizeof(struct xpc_channel) * XPC_NCHANNELS,
114 GFP_KERNEL);
115 if (part->channels == NULL) {
116 dev_err(xpc_chan, "can't get memory for channels\n");
117 return xpNoMemory;
118 }
119
120 part->nchannels = XPC_NCHANNELS;
121
122 /* allocate all the required GET/PUT values */
123
124 part->local_GPs = xpc_kzalloc_cacheline_aligned(XPC_GP_SIZE,
125 GFP_KERNEL,
126 &part->local_GPs_base);
127 if (part->local_GPs == NULL) {
128 kfree(part->channels);
129 part->channels = NULL;
130 dev_err(xpc_chan, "can't get memory for local get/put "
131 "values\n");
132 return xpNoMemory;
133 }
134
135 part->remote_GPs = xpc_kzalloc_cacheline_aligned(XPC_GP_SIZE,
136 GFP_KERNEL,
137 &part->
138 remote_GPs_base);
139 if (part->remote_GPs == NULL) {
140 dev_err(xpc_chan, "can't get memory for remote get/put "
141 "values\n");
142 kfree(part->local_GPs_base);
143 part->local_GPs = NULL;
144 kfree(part->channels);
145 part->channels = NULL;
146 return xpNoMemory;
147 }
148
149 /* allocate all the required open and close args */
150
151 part->local_openclose_args =
152 xpc_kzalloc_cacheline_aligned(XPC_OPENCLOSE_ARGS_SIZE, GFP_KERNEL,
153 &part->local_openclose_args_base);
154 if (part->local_openclose_args == NULL) {
155 dev_err(xpc_chan, "can't get memory for local connect args\n");
156 kfree(part->remote_GPs_base);
157 part->remote_GPs = NULL;
158 kfree(part->local_GPs_base);
159 part->local_GPs = NULL;
160 kfree(part->channels);
161 part->channels = NULL;
162 return xpNoMemory;
163 }
164
165 part->remote_openclose_args =
166 xpc_kzalloc_cacheline_aligned(XPC_OPENCLOSE_ARGS_SIZE, GFP_KERNEL,
167 &part->remote_openclose_args_base);
168 if (part->remote_openclose_args == NULL) {
169 dev_err(xpc_chan, "can't get memory for remote connect args\n");
170 kfree(part->local_openclose_args_base);
171 part->local_openclose_args = NULL;
172 kfree(part->remote_GPs_base);
173 part->remote_GPs = NULL;
174 kfree(part->local_GPs_base);
175 part->local_GPs = NULL;
176 kfree(part->channels);
177 part->channels = NULL;
178 return xpNoMemory;
179 }
180
181 xpc_initialize_channels(part, partid);
182
183 atomic_set(&part->nchannels_active, 0);
184 atomic_set(&part->nchannels_engaged, 0);
185
186 /* local_IPI_amo were set to 0 by an earlier memset() */
187
188 /* Initialize this partitions AMO_t structure */
189 part->local_IPI_amo_va = xpc_IPI_init(partid);
190
191 spin_lock_init(&part->IPI_lock);
192
193 atomic_set(&part->channel_mgr_requests, 1);
194 init_waitqueue_head(&part->channel_mgr_wq);
195
196 sprintf(part->IPI_owner, "xpc%02d", partid);
197 ret = request_irq(SGI_XPC_NOTIFY, xpc_notify_IRQ_handler, IRQF_SHARED,
198 part->IPI_owner, (void *)(u64)partid);
199 if (ret != 0) {
200 dev_err(xpc_chan, "can't register NOTIFY IRQ handler, "
201 "errno=%d\n", -ret);
202 kfree(part->remote_openclose_args_base);
203 part->remote_openclose_args = NULL;
204 kfree(part->local_openclose_args_base);
205 part->local_openclose_args = NULL;
206 kfree(part->remote_GPs_base);
207 part->remote_GPs = NULL;
208 kfree(part->local_GPs_base);
209 part->local_GPs = NULL;
210 kfree(part->channels);
211 part->channels = NULL;
212 return xpLackOfResources;
213 }
214
215 /* Setup a timer to check for dropped IPIs */
216 timer = &part->dropped_IPI_timer;
217 init_timer(timer);
218 timer->function = (void (*)(unsigned long))xpc_dropped_IPI_check;
219 timer->data = (unsigned long)part;
220 timer->expires = jiffies + XPC_P_DROPPED_IPI_WAIT;
221 add_timer(timer);
222
223 /*
224 * With the setting of the partition setup_state to XPC_P_SETUP, we're
225 * declaring that this partition is ready to go.
226 */
227 part->setup_state = XPC_P_SETUP;
228
229 /*
230 * Setup the per partition specific variables required by the
231 * remote partition to establish channel connections with us.
232 *
233 * The setting of the magic # indicates that these per partition
234 * specific variables are ready to be used.
235 */
236 xpc_vars_part[partid].GPs_pa = __pa(part->local_GPs);
237 xpc_vars_part[partid].openclose_args_pa =
238 __pa(part->local_openclose_args);
239 xpc_vars_part[partid].IPI_amo_pa = __pa(part->local_IPI_amo_va);
240 cpuid = raw_smp_processor_id(); /* any CPU in this partition will do */
241 xpc_vars_part[partid].IPI_nasid = cpuid_to_nasid(cpuid);
242 xpc_vars_part[partid].IPI_phys_cpuid = cpu_physical_id(cpuid);
243 xpc_vars_part[partid].nchannels = part->nchannels;
244 xpc_vars_part[partid].magic = XPC_VP_MAGIC1;
245
246 return xpSuccess;
247}
248
249/*
250 * Create a wrapper that hides the underlying mechanism for pulling a cacheline
251 * (or multiple cachelines) from a remote partition.
252 *
253 * src must be a cacheline aligned physical address on the remote partition.
254 * dst must be a cacheline aligned virtual address on this partition.
255 * cnt must be an cacheline sized
256 */
257static enum xp_retval
258xpc_pull_remote_cachelines(struct xpc_partition *part, void *dst,
259 const void *src, size_t cnt)
260{
261 bte_result_t bte_ret;
262
263 DBUG_ON((u64)src != L1_CACHE_ALIGN((u64)src));
264 DBUG_ON((u64)dst != L1_CACHE_ALIGN((u64)dst));
265 DBUG_ON(cnt != L1_CACHE_ALIGN(cnt));
266
267 if (part->act_state == XPC_P_DEACTIVATING)
268 return part->reason;
269
270 bte_ret = xp_bte_copy((u64)src, (u64)dst, (u64)cnt,
271 (BTE_NORMAL | BTE_WACQUIRE), NULL);
272 if (bte_ret == BTE_SUCCESS)
273 return xpSuccess;
274
275 dev_dbg(xpc_chan, "xp_bte_copy() from partition %d failed, ret=%d\n",
276 XPC_PARTID(part), bte_ret);
277
278 return xpc_map_bte_errors(bte_ret);
279}
280
281/*
282 * Pull the remote per partition specific variables from the specified
283 * partition.
284 */
285enum xp_retval
286xpc_pull_remote_vars_part(struct xpc_partition *part)
287{
288 u8 buffer[L1_CACHE_BYTES * 2];
289 struct xpc_vars_part *pulled_entry_cacheline =
290 (struct xpc_vars_part *)L1_CACHE_ALIGN((u64)buffer);
291 struct xpc_vars_part *pulled_entry;
292 u64 remote_entry_cacheline_pa, remote_entry_pa;
293 short partid = XPC_PARTID(part);
294 enum xp_retval ret;
295
296 /* pull the cacheline that contains the variables we're interested in */
297
298 DBUG_ON(part->remote_vars_part_pa !=
299 L1_CACHE_ALIGN(part->remote_vars_part_pa));
300 DBUG_ON(sizeof(struct xpc_vars_part) != L1_CACHE_BYTES / 2);
301
302 remote_entry_pa = part->remote_vars_part_pa +
303 sn_partition_id * sizeof(struct xpc_vars_part);
304
305 remote_entry_cacheline_pa = (remote_entry_pa & ~(L1_CACHE_BYTES - 1));
306
307 pulled_entry = (struct xpc_vars_part *)((u64)pulled_entry_cacheline +
308 (remote_entry_pa &
309 (L1_CACHE_BYTES - 1)));
310
311 ret = xpc_pull_remote_cachelines(part, pulled_entry_cacheline,
312 (void *)remote_entry_cacheline_pa,
313 L1_CACHE_BYTES);
314 if (ret != xpSuccess) {
315 dev_dbg(xpc_chan, "failed to pull XPC vars_part from "
316 "partition %d, ret=%d\n", partid, ret);
317 return ret;
318 }
319
320 /* see if they've been set up yet */
321
322 if (pulled_entry->magic != XPC_VP_MAGIC1 &&
323 pulled_entry->magic != XPC_VP_MAGIC2) {
324
325 if (pulled_entry->magic != 0) {
326 dev_dbg(xpc_chan, "partition %d's XPC vars_part for "
327 "partition %d has bad magic value (=0x%lx)\n",
328 partid, sn_partition_id, pulled_entry->magic);
329 return xpBadMagic;
330 }
331
332 /* they've not been initialized yet */
333 return xpRetry;
334 }
335
336 if (xpc_vars_part[partid].magic == XPC_VP_MAGIC1) {
337
338 /* validate the variables */
339
340 if (pulled_entry->GPs_pa == 0 ||
341 pulled_entry->openclose_args_pa == 0 ||
342 pulled_entry->IPI_amo_pa == 0) {
343
344 dev_err(xpc_chan, "partition %d's XPC vars_part for "
345 "partition %d are not valid\n", partid,
346 sn_partition_id);
347 return xpInvalidAddress;
348 }
349
350 /* the variables we imported look to be valid */
351
352 part->remote_GPs_pa = pulled_entry->GPs_pa;
353 part->remote_openclose_args_pa =
354 pulled_entry->openclose_args_pa;
355 part->remote_IPI_amo_va =
356 (AMO_t *)__va(pulled_entry->IPI_amo_pa);
357 part->remote_IPI_nasid = pulled_entry->IPI_nasid;
358 part->remote_IPI_phys_cpuid = pulled_entry->IPI_phys_cpuid;
359
360 if (part->nchannels > pulled_entry->nchannels)
361 part->nchannels = pulled_entry->nchannels;
362
363 /* let the other side know that we've pulled their variables */
364
365 xpc_vars_part[partid].magic = XPC_VP_MAGIC2;
366 }
367
368 if (pulled_entry->magic == XPC_VP_MAGIC1)
369 return xpRetry;
370
371 return xpSuccess;
372}
373
374/*
375 * Get the IPI flags and pull the openclose args and/or remote GPs as needed.
376 */
377static u64
378xpc_get_IPI_flags(struct xpc_partition *part)
379{
380 unsigned long irq_flags;
381 u64 IPI_amo;
382 enum xp_retval ret;
383
384 /*
385 * See if there are any IPI flags to be handled.
386 */
387
388 spin_lock_irqsave(&part->IPI_lock, irq_flags);
389 IPI_amo = part->local_IPI_amo;
390 if (IPI_amo != 0)
391 part->local_IPI_amo = 0;
392
393 spin_unlock_irqrestore(&part->IPI_lock, irq_flags);
394
395 if (XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(IPI_amo)) {
396 ret = xpc_pull_remote_cachelines(part,
397 part->remote_openclose_args,
398 (void *)part->
399 remote_openclose_args_pa,
400 XPC_OPENCLOSE_ARGS_SIZE);
401 if (ret != xpSuccess) {
402 XPC_DEACTIVATE_PARTITION(part, ret);
403
404 dev_dbg(xpc_chan, "failed to pull openclose args from "
405 "partition %d, ret=%d\n", XPC_PARTID(part),
406 ret);
407
408 /* don't bother processing IPIs anymore */
409 IPI_amo = 0;
410 }
411 }
412
413 if (XPC_ANY_MSG_IPI_FLAGS_SET(IPI_amo)) {
414 ret = xpc_pull_remote_cachelines(part, part->remote_GPs,
415 (void *)part->remote_GPs_pa,
416 XPC_GP_SIZE);
417 if (ret != xpSuccess) {
418 XPC_DEACTIVATE_PARTITION(part, ret);
419
420 dev_dbg(xpc_chan, "failed to pull GPs from partition "
421 "%d, ret=%d\n", XPC_PARTID(part), ret);
422
423 /* don't bother processing IPIs anymore */
424 IPI_amo = 0;
425 }
426 }
427
428 return IPI_amo;
429}
430
431/*
432 * Allocate the local message queue and the notify queue.
433 */
434static enum xp_retval
435xpc_allocate_local_msgqueue(struct xpc_channel *ch)
436{
437 unsigned long irq_flags;
438 int nentries;
439 size_t nbytes;
440
441 for (nentries = ch->local_nentries; nentries > 0; nentries--) {
442
443 nbytes = nentries * ch->msg_size;
444 ch->local_msgqueue = xpc_kzalloc_cacheline_aligned(nbytes,
445 GFP_KERNEL,
446 &ch->local_msgqueue_base);
447 if (ch->local_msgqueue == NULL)
448 continue;
449
450 nbytes = nentries * sizeof(struct xpc_notify);
451 ch->notify_queue = kzalloc(nbytes, GFP_KERNEL);
452 if (ch->notify_queue == NULL) {
453 kfree(ch->local_msgqueue_base);
454 ch->local_msgqueue = NULL;
455 continue;
456 }
457
458 spin_lock_irqsave(&ch->lock, irq_flags);
459 if (nentries < ch->local_nentries) {
460 dev_dbg(xpc_chan, "nentries=%d local_nentries=%d, "
461 "partid=%d, channel=%d\n", nentries,
462 ch->local_nentries, ch->partid, ch->number);
463
464 ch->local_nentries = nentries;
465 }
466 spin_unlock_irqrestore(&ch->lock, irq_flags);
467 return xpSuccess;
468 }
469
470 dev_dbg(xpc_chan, "can't get memory for local message queue and notify "
471 "queue, partid=%d, channel=%d\n", ch->partid, ch->number);
472 return xpNoMemory;
473}
474
475/*
476 * Allocate the cached remote message queue.
477 */
478static enum xp_retval
479xpc_allocate_remote_msgqueue(struct xpc_channel *ch)
480{
481 unsigned long irq_flags;
482 int nentries;
483 size_t nbytes;
484
485 DBUG_ON(ch->remote_nentries <= 0);
486
487 for (nentries = ch->remote_nentries; nentries > 0; nentries--) {
488
489 nbytes = nentries * ch->msg_size;
490 ch->remote_msgqueue = xpc_kzalloc_cacheline_aligned(nbytes,
491 GFP_KERNEL,
492 &ch->remote_msgqueue_base);
493 if (ch->remote_msgqueue == NULL)
494 continue;
495
496 spin_lock_irqsave(&ch->lock, irq_flags);
497 if (nentries < ch->remote_nentries) {
498 dev_dbg(xpc_chan, "nentries=%d remote_nentries=%d, "
499 "partid=%d, channel=%d\n", nentries,
500 ch->remote_nentries, ch->partid, ch->number);
501
502 ch->remote_nentries = nentries;
503 }
504 spin_unlock_irqrestore(&ch->lock, irq_flags);
505 return xpSuccess;
506 }
507
508 dev_dbg(xpc_chan, "can't get memory for cached remote message queue, "
509 "partid=%d, channel=%d\n", ch->partid, ch->number);
510 return xpNoMemory;
511}
512
513/*
514 * Allocate message queues and other stuff associated with a channel.
515 *
516 * Note: Assumes all of the channel sizes are filled in.
517 */
518static enum xp_retval
519xpc_allocate_msgqueues(struct xpc_channel *ch)
520{
521 unsigned long irq_flags;
522 enum xp_retval ret;
523
524 DBUG_ON(ch->flags & XPC_C_SETUP);
525
526 ret = xpc_allocate_local_msgqueue(ch);
527 if (ret != xpSuccess)
528 return ret;
529
530 ret = xpc_allocate_remote_msgqueue(ch);
531 if (ret != xpSuccess) {
532 kfree(ch->local_msgqueue_base);
533 ch->local_msgqueue = NULL;
534 kfree(ch->notify_queue);
535 ch->notify_queue = NULL;
536 return ret;
537 }
538
539 spin_lock_irqsave(&ch->lock, irq_flags);
540 ch->flags |= XPC_C_SETUP;
541 spin_unlock_irqrestore(&ch->lock, irq_flags);
542
543 return xpSuccess;
544}
545
546/*
547 * Process a connect message from a remote partition. 21 * Process a connect message from a remote partition.
548 * 22 *
549 * Note: xpc_process_connect() is expecting to be called with the 23 * Note: xpc_process_connect() is expecting to be called with the
@@ -565,30 +39,29 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
565 39
566 if (!(ch->flags & XPC_C_SETUP)) { 40 if (!(ch->flags & XPC_C_SETUP)) {
567 spin_unlock_irqrestore(&ch->lock, *irq_flags); 41 spin_unlock_irqrestore(&ch->lock, *irq_flags);
568 ret = xpc_allocate_msgqueues(ch); 42 ret = xpc_setup_msg_structures(ch);
569 spin_lock_irqsave(&ch->lock, *irq_flags); 43 spin_lock_irqsave(&ch->lock, *irq_flags);
570 44
571 if (ret != xpSuccess) 45 if (ret != xpSuccess)
572 XPC_DISCONNECT_CHANNEL(ch, ret, irq_flags); 46 XPC_DISCONNECT_CHANNEL(ch, ret, irq_flags);
573 47
48 ch->flags |= XPC_C_SETUP;
49
574 if (ch->flags & (XPC_C_CONNECTED | XPC_C_DISCONNECTING)) 50 if (ch->flags & (XPC_C_CONNECTED | XPC_C_DISCONNECTING))
575 return; 51 return;
576 52
577 DBUG_ON(!(ch->flags & XPC_C_SETUP));
578 DBUG_ON(ch->local_msgqueue == NULL); 53 DBUG_ON(ch->local_msgqueue == NULL);
579 DBUG_ON(ch->remote_msgqueue == NULL); 54 DBUG_ON(ch->remote_msgqueue == NULL);
580 } 55 }
581 56
582 if (!(ch->flags & XPC_C_OPENREPLY)) { 57 if (!(ch->flags & XPC_C_OPENREPLY)) {
583 ch->flags |= XPC_C_OPENREPLY; 58 ch->flags |= XPC_C_OPENREPLY;
584 xpc_IPI_send_openreply(ch, irq_flags); 59 xpc_send_chctl_openreply(ch, irq_flags);
585 } 60 }
586 61
587 if (!(ch->flags & XPC_C_ROPENREPLY)) 62 if (!(ch->flags & XPC_C_ROPENREPLY))
588 return; 63 return;
589 64
590 DBUG_ON(ch->remote_msgqueue_pa == 0);
591
592 ch->flags = (XPC_C_CONNECTED | XPC_C_SETUP); /* clear all else */ 65 ch->flags = (XPC_C_CONNECTED | XPC_C_SETUP); /* clear all else */
593 66
594 dev_info(xpc_chan, "channel %d to partition %d connected\n", 67 dev_info(xpc_chan, "channel %d to partition %d connected\n",
@@ -600,99 +73,6 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags)
600} 73}
601 74
602/* 75/*
603 * Notify those who wanted to be notified upon delivery of their message.
604 */
605static void
606xpc_notify_senders(struct xpc_channel *ch, enum xp_retval reason, s64 put)
607{
608 struct xpc_notify *notify;
609 u8 notify_type;
610 s64 get = ch->w_remote_GP.get - 1;
611
612 while (++get < put && atomic_read(&ch->n_to_notify) > 0) {
613
614 notify = &ch->notify_queue[get % ch->local_nentries];
615
616 /*
617 * See if the notify entry indicates it was associated with
618 * a message who's sender wants to be notified. It is possible
619 * that it is, but someone else is doing or has done the
620 * notification.
621 */
622 notify_type = notify->type;
623 if (notify_type == 0 ||
624 cmpxchg(&notify->type, notify_type, 0) != notify_type) {
625 continue;
626 }
627
628 DBUG_ON(notify_type != XPC_N_CALL);
629
630 atomic_dec(&ch->n_to_notify);
631
632 if (notify->func != NULL) {
633 dev_dbg(xpc_chan, "notify->func() called, notify=0x%p, "
634 "msg_number=%ld, partid=%d, channel=%d\n",
635 (void *)notify, get, ch->partid, ch->number);
636
637 notify->func(reason, ch->partid, ch->number,
638 notify->key);
639
640 dev_dbg(xpc_chan, "notify->func() returned, "
641 "notify=0x%p, msg_number=%ld, partid=%d, "
642 "channel=%d\n", (void *)notify, get,
643 ch->partid, ch->number);
644 }
645 }
646}
647
648/*
649 * Free up message queues and other stuff that were allocated for the specified
650 * channel.
651 *
652 * Note: ch->reason and ch->reason_line are left set for debugging purposes,
653 * they're cleared when XPC_C_DISCONNECTED is cleared.
654 */
655static void
656xpc_free_msgqueues(struct xpc_channel *ch)
657{
658 DBUG_ON(!spin_is_locked(&ch->lock));
659 DBUG_ON(atomic_read(&ch->n_to_notify) != 0);
660
661 ch->remote_msgqueue_pa = 0;
662 ch->func = NULL;
663 ch->key = NULL;
664 ch->msg_size = 0;
665 ch->local_nentries = 0;
666 ch->remote_nentries = 0;
667 ch->kthreads_assigned_limit = 0;
668 ch->kthreads_idle_limit = 0;
669
670 ch->local_GP->get = 0;
671 ch->local_GP->put = 0;
672 ch->remote_GP.get = 0;
673 ch->remote_GP.put = 0;
674 ch->w_local_GP.get = 0;
675 ch->w_local_GP.put = 0;
676 ch->w_remote_GP.get = 0;
677 ch->w_remote_GP.put = 0;
678 ch->next_msg_to_pull = 0;
679
680 if (ch->flags & XPC_C_SETUP) {
681 ch->flags &= ~XPC_C_SETUP;
682
683 dev_dbg(xpc_chan, "ch->flags=0x%x, partid=%d, channel=%d\n",
684 ch->flags, ch->partid, ch->number);
685
686 kfree(ch->local_msgqueue_base);
687 ch->local_msgqueue = NULL;
688 kfree(ch->remote_msgqueue_base);
689 ch->remote_msgqueue = NULL;
690 kfree(ch->notify_queue);
691 ch->notify_queue = NULL;
692 }
693}
694
695/*
696 * spin_lock_irqsave() is expected to be held on entry. 76 * spin_lock_irqsave() is expected to be held on entry.
697 */ 77 */
698static void 78static void
@@ -717,9 +97,9 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
717 DBUG_ON((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) && 97 DBUG_ON((ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) &&
718 !(ch->flags & XPC_C_DISCONNECTINGCALLOUT_MADE)); 98 !(ch->flags & XPC_C_DISCONNECTINGCALLOUT_MADE));
719 99
720 if (part->act_state == XPC_P_DEACTIVATING) { 100 if (part->act_state == XPC_P_AS_DEACTIVATING) {
721 /* can't proceed until the other side disengages from us */ 101 /* can't proceed until the other side disengages from us */
722 if (xpc_partition_engaged(1UL << ch->partid)) 102 if (xpc_partition_engaged(ch->partid))
723 return; 103 return;
724 104
725 } else { 105 } else {
@@ -731,7 +111,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
731 111
732 if (!(ch->flags & XPC_C_CLOSEREPLY)) { 112 if (!(ch->flags & XPC_C_CLOSEREPLY)) {
733 ch->flags |= XPC_C_CLOSEREPLY; 113 ch->flags |= XPC_C_CLOSEREPLY;
734 xpc_IPI_send_closereply(ch, irq_flags); 114 xpc_send_chctl_closereply(ch, irq_flags);
735 } 115 }
736 116
737 if (!(ch->flags & XPC_C_RCLOSEREPLY)) 117 if (!(ch->flags & XPC_C_RCLOSEREPLY))
@@ -740,8 +120,8 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
740 120
741 /* wake those waiting for notify completion */ 121 /* wake those waiting for notify completion */
742 if (atomic_read(&ch->n_to_notify) > 0) { 122 if (atomic_read(&ch->n_to_notify) > 0) {
743 /* >>> we do callout while holding ch->lock */ 123 /* we do callout while holding ch->lock, callout can't block */
744 xpc_notify_senders(ch, ch->reason, ch->w_local_GP.put); 124 xpc_notify_senders_of_disconnect(ch);
745 } 125 }
746 126
747 /* both sides are disconnected now */ 127 /* both sides are disconnected now */
@@ -752,10 +132,24 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
752 spin_lock_irqsave(&ch->lock, *irq_flags); 132 spin_lock_irqsave(&ch->lock, *irq_flags);
753 } 133 }
754 134
135 DBUG_ON(atomic_read(&ch->n_to_notify) != 0);
136
755 /* it's now safe to free the channel's message queues */ 137 /* it's now safe to free the channel's message queues */
756 xpc_free_msgqueues(ch); 138 xpc_teardown_msg_structures(ch);
757 139
758 /* mark disconnected, clear all other flags except XPC_C_WDISCONNECT */ 140 ch->func = NULL;
141 ch->key = NULL;
142 ch->entry_size = 0;
143 ch->local_nentries = 0;
144 ch->remote_nentries = 0;
145 ch->kthreads_assigned_limit = 0;
146 ch->kthreads_idle_limit = 0;
147
148 /*
149 * Mark the channel disconnected and clear all other flags, including
150 * XPC_C_SETUP (because of call to xpc_teardown_msg_structures()) but
151 * not including XPC_C_WDISCONNECT (if it was set).
152 */
759 ch->flags = (XPC_C_DISCONNECTED | (ch->flags & XPC_C_WDISCONNECT)); 153 ch->flags = (XPC_C_DISCONNECTED | (ch->flags & XPC_C_WDISCONNECT));
760 154
761 atomic_dec(&part->nchannels_active); 155 atomic_dec(&part->nchannels_active);
@@ -768,15 +162,15 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
768 if (ch->flags & XPC_C_WDISCONNECT) { 162 if (ch->flags & XPC_C_WDISCONNECT) {
769 /* we won't lose the CPU since we're holding ch->lock */ 163 /* we won't lose the CPU since we're holding ch->lock */
770 complete(&ch->wdisconnect_wait); 164 complete(&ch->wdisconnect_wait);
771 } else if (ch->delayed_IPI_flags) { 165 } else if (ch->delayed_chctl_flags) {
772 if (part->act_state != XPC_P_DEACTIVATING) { 166 if (part->act_state != XPC_P_AS_DEACTIVATING) {
773 /* time to take action on any delayed IPI flags */ 167 /* time to take action on any delayed chctl flags */
774 spin_lock(&part->IPI_lock); 168 spin_lock(&part->chctl_lock);
775 XPC_SET_IPI_FLAGS(part->local_IPI_amo, ch->number, 169 part->chctl.flags[ch->number] |=
776 ch->delayed_IPI_flags); 170 ch->delayed_chctl_flags;
777 spin_unlock(&part->IPI_lock); 171 spin_unlock(&part->chctl_lock);
778 } 172 }
779 ch->delayed_IPI_flags = 0; 173 ch->delayed_chctl_flags = 0;
780 } 174 }
781} 175}
782 176
@@ -784,8 +178,8 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
784 * Process a change in the channel's remote connection state. 178 * Process a change in the channel's remote connection state.
785 */ 179 */
786static void 180static void
787xpc_process_openclose_IPI(struct xpc_partition *part, int ch_number, 181xpc_process_openclose_chctl_flags(struct xpc_partition *part, int ch_number,
788 u8 IPI_flags) 182 u8 chctl_flags)
789{ 183{
790 unsigned long irq_flags; 184 unsigned long irq_flags;
791 struct xpc_openclose_args *args = 185 struct xpc_openclose_args *args =
@@ -800,24 +194,24 @@ again:
800 if ((ch->flags & XPC_C_DISCONNECTED) && 194 if ((ch->flags & XPC_C_DISCONNECTED) &&
801 (ch->flags & XPC_C_WDISCONNECT)) { 195 (ch->flags & XPC_C_WDISCONNECT)) {
802 /* 196 /*
803 * Delay processing IPI flags until thread waiting disconnect 197 * Delay processing chctl flags until thread waiting disconnect
804 * has had a chance to see that the channel is disconnected. 198 * has had a chance to see that the channel is disconnected.
805 */ 199 */
806 ch->delayed_IPI_flags |= IPI_flags; 200 ch->delayed_chctl_flags |= chctl_flags;
807 spin_unlock_irqrestore(&ch->lock, irq_flags); 201 spin_unlock_irqrestore(&ch->lock, irq_flags);
808 return; 202 return;
809 } 203 }
810 204
811 if (IPI_flags & XPC_IPI_CLOSEREQUEST) { 205 if (chctl_flags & XPC_CHCTL_CLOSEREQUEST) {
812 206
813 dev_dbg(xpc_chan, "XPC_IPI_CLOSEREQUEST (reason=%d) received " 207 dev_dbg(xpc_chan, "XPC_CHCTL_CLOSEREQUEST (reason=%d) received "
814 "from partid=%d, channel=%d\n", args->reason, 208 "from partid=%d, channel=%d\n", args->reason,
815 ch->partid, ch->number); 209 ch->partid, ch->number);
816 210
817 /* 211 /*
818 * If RCLOSEREQUEST is set, we're probably waiting for 212 * If RCLOSEREQUEST is set, we're probably waiting for
819 * RCLOSEREPLY. We should find it and a ROPENREQUEST packed 213 * RCLOSEREPLY. We should find it and a ROPENREQUEST packed
820 * with this RCLOSEREQUEST in the IPI_flags. 214 * with this RCLOSEREQUEST in the chctl_flags.
821 */ 215 */
822 216
823 if (ch->flags & XPC_C_RCLOSEREQUEST) { 217 if (ch->flags & XPC_C_RCLOSEREQUEST) {
@@ -826,8 +220,8 @@ again:
826 DBUG_ON(!(ch->flags & XPC_C_CLOSEREPLY)); 220 DBUG_ON(!(ch->flags & XPC_C_CLOSEREPLY));
827 DBUG_ON(ch->flags & XPC_C_RCLOSEREPLY); 221 DBUG_ON(ch->flags & XPC_C_RCLOSEREPLY);
828 222
829 DBUG_ON(!(IPI_flags & XPC_IPI_CLOSEREPLY)); 223 DBUG_ON(!(chctl_flags & XPC_CHCTL_CLOSEREPLY));
830 IPI_flags &= ~XPC_IPI_CLOSEREPLY; 224 chctl_flags &= ~XPC_CHCTL_CLOSEREPLY;
831 ch->flags |= XPC_C_RCLOSEREPLY; 225 ch->flags |= XPC_C_RCLOSEREPLY;
832 226
833 /* both sides have finished disconnecting */ 227 /* both sides have finished disconnecting */
@@ -837,17 +231,15 @@ again:
837 } 231 }
838 232
839 if (ch->flags & XPC_C_DISCONNECTED) { 233 if (ch->flags & XPC_C_DISCONNECTED) {
840 if (!(IPI_flags & XPC_IPI_OPENREQUEST)) { 234 if (!(chctl_flags & XPC_CHCTL_OPENREQUEST)) {
841 if ((XPC_GET_IPI_FLAGS(part->local_IPI_amo, 235 if (part->chctl.flags[ch_number] &
842 ch_number) & 236 XPC_CHCTL_OPENREQUEST) {
843 XPC_IPI_OPENREQUEST)) { 237
844 238 DBUG_ON(ch->delayed_chctl_flags != 0);
845 DBUG_ON(ch->delayed_IPI_flags != 0); 239 spin_lock(&part->chctl_lock);
846 spin_lock(&part->IPI_lock); 240 part->chctl.flags[ch_number] |=
847 XPC_SET_IPI_FLAGS(part->local_IPI_amo, 241 XPC_CHCTL_CLOSEREQUEST;
848 ch_number, 242 spin_unlock(&part->chctl_lock);
849 XPC_IPI_CLOSEREQUEST);
850 spin_unlock(&part->IPI_lock);
851 } 243 }
852 spin_unlock_irqrestore(&ch->lock, irq_flags); 244 spin_unlock_irqrestore(&ch->lock, irq_flags);
853 return; 245 return;
@@ -860,7 +252,7 @@ again:
860 ch->flags |= (XPC_C_CONNECTING | XPC_C_ROPENREQUEST); 252 ch->flags |= (XPC_C_CONNECTING | XPC_C_ROPENREQUEST);
861 } 253 }
862 254
863 IPI_flags &= ~(XPC_IPI_OPENREQUEST | XPC_IPI_OPENREPLY); 255 chctl_flags &= ~(XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY);
864 256
865 /* 257 /*
866 * The meaningful CLOSEREQUEST connection state fields are: 258 * The meaningful CLOSEREQUEST connection state fields are:
@@ -878,7 +270,7 @@ again:
878 270
879 XPC_DISCONNECT_CHANNEL(ch, reason, &irq_flags); 271 XPC_DISCONNECT_CHANNEL(ch, reason, &irq_flags);
880 272
881 DBUG_ON(IPI_flags & XPC_IPI_CLOSEREPLY); 273 DBUG_ON(chctl_flags & XPC_CHCTL_CLOSEREPLY);
882 spin_unlock_irqrestore(&ch->lock, irq_flags); 274 spin_unlock_irqrestore(&ch->lock, irq_flags);
883 return; 275 return;
884 } 276 }
@@ -886,13 +278,13 @@ again:
886 xpc_process_disconnect(ch, &irq_flags); 278 xpc_process_disconnect(ch, &irq_flags);
887 } 279 }
888 280
889 if (IPI_flags & XPC_IPI_CLOSEREPLY) { 281 if (chctl_flags & XPC_CHCTL_CLOSEREPLY) {
890 282
891 dev_dbg(xpc_chan, "XPC_IPI_CLOSEREPLY received from partid=%d," 283 dev_dbg(xpc_chan, "XPC_CHCTL_CLOSEREPLY received from partid="
892 " channel=%d\n", ch->partid, ch->number); 284 "%d, channel=%d\n", ch->partid, ch->number);
893 285
894 if (ch->flags & XPC_C_DISCONNECTED) { 286 if (ch->flags & XPC_C_DISCONNECTED) {
895 DBUG_ON(part->act_state != XPC_P_DEACTIVATING); 287 DBUG_ON(part->act_state != XPC_P_AS_DEACTIVATING);
896 spin_unlock_irqrestore(&ch->lock, irq_flags); 288 spin_unlock_irqrestore(&ch->lock, irq_flags);
897 return; 289 return;
898 } 290 }
@@ -900,15 +292,14 @@ again:
900 DBUG_ON(!(ch->flags & XPC_C_CLOSEREQUEST)); 292 DBUG_ON(!(ch->flags & XPC_C_CLOSEREQUEST));
901 293
902 if (!(ch->flags & XPC_C_RCLOSEREQUEST)) { 294 if (!(ch->flags & XPC_C_RCLOSEREQUEST)) {
903 if ((XPC_GET_IPI_FLAGS(part->local_IPI_amo, ch_number) 295 if (part->chctl.flags[ch_number] &
904 & XPC_IPI_CLOSEREQUEST)) { 296 XPC_CHCTL_CLOSEREQUEST) {
905 297
906 DBUG_ON(ch->delayed_IPI_flags != 0); 298 DBUG_ON(ch->delayed_chctl_flags != 0);
907 spin_lock(&part->IPI_lock); 299 spin_lock(&part->chctl_lock);
908 XPC_SET_IPI_FLAGS(part->local_IPI_amo, 300 part->chctl.flags[ch_number] |=
909 ch_number, 301 XPC_CHCTL_CLOSEREPLY;
910 XPC_IPI_CLOSEREPLY); 302 spin_unlock(&part->chctl_lock);
911 spin_unlock(&part->IPI_lock);
912 } 303 }
913 spin_unlock_irqrestore(&ch->lock, irq_flags); 304 spin_unlock_irqrestore(&ch->lock, irq_flags);
914 return; 305 return;
@@ -922,21 +313,21 @@ again:
922 } 313 }
923 } 314 }
924 315
925 if (IPI_flags & XPC_IPI_OPENREQUEST) { 316 if (chctl_flags & XPC_CHCTL_OPENREQUEST) {
926 317
927 dev_dbg(xpc_chan, "XPC_IPI_OPENREQUEST (msg_size=%d, " 318 dev_dbg(xpc_chan, "XPC_CHCTL_OPENREQUEST (entry_size=%d, "
928 "local_nentries=%d) received from partid=%d, " 319 "local_nentries=%d) received from partid=%d, "
929 "channel=%d\n", args->msg_size, args->local_nentries, 320 "channel=%d\n", args->entry_size, args->local_nentries,
930 ch->partid, ch->number); 321 ch->partid, ch->number);
931 322
932 if (part->act_state == XPC_P_DEACTIVATING || 323 if (part->act_state == XPC_P_AS_DEACTIVATING ||
933 (ch->flags & XPC_C_ROPENREQUEST)) { 324 (ch->flags & XPC_C_ROPENREQUEST)) {
934 spin_unlock_irqrestore(&ch->lock, irq_flags); 325 spin_unlock_irqrestore(&ch->lock, irq_flags);
935 return; 326 return;
936 } 327 }
937 328
938 if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_WDISCONNECT)) { 329 if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_WDISCONNECT)) {
939 ch->delayed_IPI_flags |= XPC_IPI_OPENREQUEST; 330 ch->delayed_chctl_flags |= XPC_CHCTL_OPENREQUEST;
940 spin_unlock_irqrestore(&ch->lock, irq_flags); 331 spin_unlock_irqrestore(&ch->lock, irq_flags);
941 return; 332 return;
942 } 333 }
@@ -947,10 +338,10 @@ again:
947 338
948 /* 339 /*
949 * The meaningful OPENREQUEST connection state fields are: 340 * The meaningful OPENREQUEST connection state fields are:
950 * msg_size = size of channel's messages in bytes 341 * entry_size = size of channel's messages in bytes
951 * local_nentries = remote partition's local_nentries 342 * local_nentries = remote partition's local_nentries
952 */ 343 */
953 if (args->msg_size == 0 || args->local_nentries == 0) { 344 if (args->entry_size == 0 || args->local_nentries == 0) {
954 /* assume OPENREQUEST was delayed by mistake */ 345 /* assume OPENREQUEST was delayed by mistake */
955 spin_unlock_irqrestore(&ch->lock, irq_flags); 346 spin_unlock_irqrestore(&ch->lock, irq_flags);
956 return; 347 return;
@@ -960,14 +351,14 @@ again:
960 ch->remote_nentries = args->local_nentries; 351 ch->remote_nentries = args->local_nentries;
961 352
962 if (ch->flags & XPC_C_OPENREQUEST) { 353 if (ch->flags & XPC_C_OPENREQUEST) {
963 if (args->msg_size != ch->msg_size) { 354 if (args->entry_size != ch->entry_size) {
964 XPC_DISCONNECT_CHANNEL(ch, xpUnequalMsgSizes, 355 XPC_DISCONNECT_CHANNEL(ch, xpUnequalMsgSizes,
965 &irq_flags); 356 &irq_flags);
966 spin_unlock_irqrestore(&ch->lock, irq_flags); 357 spin_unlock_irqrestore(&ch->lock, irq_flags);
967 return; 358 return;
968 } 359 }
969 } else { 360 } else {
970 ch->msg_size = args->msg_size; 361 ch->entry_size = args->entry_size;
971 362
972 XPC_SET_REASON(ch, 0, 0); 363 XPC_SET_REASON(ch, 0, 0);
973 ch->flags &= ~XPC_C_DISCONNECTED; 364 ch->flags &= ~XPC_C_DISCONNECTED;
@@ -978,13 +369,13 @@ again:
978 xpc_process_connect(ch, &irq_flags); 369 xpc_process_connect(ch, &irq_flags);
979 } 370 }
980 371
981 if (IPI_flags & XPC_IPI_OPENREPLY) { 372 if (chctl_flags & XPC_CHCTL_OPENREPLY) {
982 373
983 dev_dbg(xpc_chan, "XPC_IPI_OPENREPLY (local_msgqueue_pa=0x%lx, " 374 dev_dbg(xpc_chan, "XPC_CHCTL_OPENREPLY (local_msgqueue_pa="
984 "local_nentries=%d, remote_nentries=%d) received from " 375 "0x%lx, local_nentries=%d, remote_nentries=%d) "
985 "partid=%d, channel=%d\n", args->local_msgqueue_pa, 376 "received from partid=%d, channel=%d\n",
986 args->local_nentries, args->remote_nentries, 377 args->local_msgqueue_pa, args->local_nentries,
987 ch->partid, ch->number); 378 args->remote_nentries, ch->partid, ch->number);
988 379
989 if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_DISCONNECTED)) { 380 if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_DISCONNECTED)) {
990 spin_unlock_irqrestore(&ch->lock, irq_flags); 381 spin_unlock_irqrestore(&ch->lock, irq_flags);
@@ -1012,10 +403,10 @@ again:
1012 DBUG_ON(args->remote_nentries == 0); 403 DBUG_ON(args->remote_nentries == 0);
1013 404
1014 ch->flags |= XPC_C_ROPENREPLY; 405 ch->flags |= XPC_C_ROPENREPLY;
1015 ch->remote_msgqueue_pa = args->local_msgqueue_pa; 406 xpc_save_remote_msgqueue_pa(ch, args->local_msgqueue_pa);
1016 407
1017 if (args->local_nentries < ch->remote_nentries) { 408 if (args->local_nentries < ch->remote_nentries) {
1018 dev_dbg(xpc_chan, "XPC_IPI_OPENREPLY: new " 409 dev_dbg(xpc_chan, "XPC_CHCTL_OPENREPLY: new "
1019 "remote_nentries=%d, old remote_nentries=%d, " 410 "remote_nentries=%d, old remote_nentries=%d, "
1020 "partid=%d, channel=%d\n", 411 "partid=%d, channel=%d\n",
1021 args->local_nentries, ch->remote_nentries, 412 args->local_nentries, ch->remote_nentries,
@@ -1024,7 +415,7 @@ again:
1024 ch->remote_nentries = args->local_nentries; 415 ch->remote_nentries = args->local_nentries;
1025 } 416 }
1026 if (args->remote_nentries < ch->local_nentries) { 417 if (args->remote_nentries < ch->local_nentries) {
1027 dev_dbg(xpc_chan, "XPC_IPI_OPENREPLY: new " 418 dev_dbg(xpc_chan, "XPC_CHCTL_OPENREPLY: new "
1028 "local_nentries=%d, old local_nentries=%d, " 419 "local_nentries=%d, old local_nentries=%d, "
1029 "partid=%d, channel=%d\n", 420 "partid=%d, channel=%d\n",
1030 args->remote_nentries, ch->local_nentries, 421 args->remote_nentries, ch->local_nentries,
@@ -1082,7 +473,7 @@ xpc_connect_channel(struct xpc_channel *ch)
1082 ch->local_nentries = registration->nentries; 473 ch->local_nentries = registration->nentries;
1083 474
1084 if (ch->flags & XPC_C_ROPENREQUEST) { 475 if (ch->flags & XPC_C_ROPENREQUEST) {
1085 if (registration->msg_size != ch->msg_size) { 476 if (registration->entry_size != ch->entry_size) {
1086 /* the local and remote sides aren't the same */ 477 /* the local and remote sides aren't the same */
1087 478
1088 /* 479 /*
@@ -1101,7 +492,7 @@ xpc_connect_channel(struct xpc_channel *ch)
1101 return xpUnequalMsgSizes; 492 return xpUnequalMsgSizes;
1102 } 493 }
1103 } else { 494 } else {
1104 ch->msg_size = registration->msg_size; 495 ch->entry_size = registration->entry_size;
1105 496
1106 XPC_SET_REASON(ch, 0, 0); 497 XPC_SET_REASON(ch, 0, 0);
1107 ch->flags &= ~XPC_C_DISCONNECTED; 498 ch->flags &= ~XPC_C_DISCONNECTED;
@@ -1114,7 +505,7 @@ xpc_connect_channel(struct xpc_channel *ch)
1114 /* initiate the connection */ 505 /* initiate the connection */
1115 506
1116 ch->flags |= (XPC_C_OPENREQUEST | XPC_C_CONNECTING); 507 ch->flags |= (XPC_C_OPENREQUEST | XPC_C_CONNECTING);
1117 xpc_IPI_send_openrequest(ch, &irq_flags); 508 xpc_send_chctl_openrequest(ch, &irq_flags);
1118 509
1119 xpc_process_connect(ch, &irq_flags); 510 xpc_process_connect(ch, &irq_flags);
1120 511
@@ -1123,152 +514,16 @@ xpc_connect_channel(struct xpc_channel *ch)
1123 return xpSuccess; 514 return xpSuccess;
1124} 515}
1125 516
1126/*
1127 * Clear some of the msg flags in the local message queue.
1128 */
1129static inline void
1130xpc_clear_local_msgqueue_flags(struct xpc_channel *ch)
1131{
1132 struct xpc_msg *msg;
1133 s64 get;
1134
1135 get = ch->w_remote_GP.get;
1136 do {
1137 msg = (struct xpc_msg *)((u64)ch->local_msgqueue +
1138 (get % ch->local_nentries) *
1139 ch->msg_size);
1140 msg->flags = 0;
1141 } while (++get < ch->remote_GP.get);
1142}
1143
1144/*
1145 * Clear some of the msg flags in the remote message queue.
1146 */
1147static inline void
1148xpc_clear_remote_msgqueue_flags(struct xpc_channel *ch)
1149{
1150 struct xpc_msg *msg;
1151 s64 put;
1152
1153 put = ch->w_remote_GP.put;
1154 do {
1155 msg = (struct xpc_msg *)((u64)ch->remote_msgqueue +
1156 (put % ch->remote_nentries) *
1157 ch->msg_size);
1158 msg->flags = 0;
1159 } while (++put < ch->remote_GP.put);
1160}
1161
1162static void
1163xpc_process_msg_IPI(struct xpc_partition *part, int ch_number)
1164{
1165 struct xpc_channel *ch = &part->channels[ch_number];
1166 int nmsgs_sent;
1167
1168 ch->remote_GP = part->remote_GPs[ch_number];
1169
1170 /* See what, if anything, has changed for each connected channel */
1171
1172 xpc_msgqueue_ref(ch);
1173
1174 if (ch->w_remote_GP.get == ch->remote_GP.get &&
1175 ch->w_remote_GP.put == ch->remote_GP.put) {
1176 /* nothing changed since GPs were last pulled */
1177 xpc_msgqueue_deref(ch);
1178 return;
1179 }
1180
1181 if (!(ch->flags & XPC_C_CONNECTED)) {
1182 xpc_msgqueue_deref(ch);
1183 return;
1184 }
1185
1186 /*
1187 * First check to see if messages recently sent by us have been
1188 * received by the other side. (The remote GET value will have
1189 * changed since we last looked at it.)
1190 */
1191
1192 if (ch->w_remote_GP.get != ch->remote_GP.get) {
1193
1194 /*
1195 * We need to notify any senders that want to be notified
1196 * that their sent messages have been received by their
1197 * intended recipients. We need to do this before updating
1198 * w_remote_GP.get so that we don't allocate the same message
1199 * queue entries prematurely (see xpc_allocate_msg()).
1200 */
1201 if (atomic_read(&ch->n_to_notify) > 0) {
1202 /*
1203 * Notify senders that messages sent have been
1204 * received and delivered by the other side.
1205 */
1206 xpc_notify_senders(ch, xpMsgDelivered,
1207 ch->remote_GP.get);
1208 }
1209
1210 /*
1211 * Clear msg->flags in previously sent messages, so that
1212 * they're ready for xpc_allocate_msg().
1213 */
1214 xpc_clear_local_msgqueue_flags(ch);
1215
1216 ch->w_remote_GP.get = ch->remote_GP.get;
1217
1218 dev_dbg(xpc_chan, "w_remote_GP.get changed to %ld, partid=%d, "
1219 "channel=%d\n", ch->w_remote_GP.get, ch->partid,
1220 ch->number);
1221
1222 /*
1223 * If anyone was waiting for message queue entries to become
1224 * available, wake them up.
1225 */
1226 if (atomic_read(&ch->n_on_msg_allocate_wq) > 0)
1227 wake_up(&ch->msg_allocate_wq);
1228 }
1229
1230 /*
1231 * Now check for newly sent messages by the other side. (The remote
1232 * PUT value will have changed since we last looked at it.)
1233 */
1234
1235 if (ch->w_remote_GP.put != ch->remote_GP.put) {
1236 /*
1237 * Clear msg->flags in previously received messages, so that
1238 * they're ready for xpc_get_deliverable_msg().
1239 */
1240 xpc_clear_remote_msgqueue_flags(ch);
1241
1242 ch->w_remote_GP.put = ch->remote_GP.put;
1243
1244 dev_dbg(xpc_chan, "w_remote_GP.put changed to %ld, partid=%d, "
1245 "channel=%d\n", ch->w_remote_GP.put, ch->partid,
1246 ch->number);
1247
1248 nmsgs_sent = ch->w_remote_GP.put - ch->w_local_GP.get;
1249 if (nmsgs_sent > 0) {
1250 dev_dbg(xpc_chan, "msgs waiting to be copied and "
1251 "delivered=%d, partid=%d, channel=%d\n",
1252 nmsgs_sent, ch->partid, ch->number);
1253
1254 if (ch->flags & XPC_C_CONNECTEDCALLOUT_MADE)
1255 xpc_activate_kthreads(ch, nmsgs_sent);
1256 }
1257 }
1258
1259 xpc_msgqueue_deref(ch);
1260}
1261
1262void 517void
1263xpc_process_channel_activity(struct xpc_partition *part) 518xpc_process_sent_chctl_flags(struct xpc_partition *part)
1264{ 519{
1265 unsigned long irq_flags; 520 unsigned long irq_flags;
1266 u64 IPI_amo, IPI_flags; 521 union xpc_channel_ctl_flags chctl;
1267 struct xpc_channel *ch; 522 struct xpc_channel *ch;
1268 int ch_number; 523 int ch_number;
1269 u32 ch_flags; 524 u32 ch_flags;
1270 525
1271 IPI_amo = xpc_get_IPI_flags(part); 526 chctl.all_flags = xpc_get_chctl_all_flags(part);
1272 527
1273 /* 528 /*
1274 * Initiate channel connections for registered channels. 529 * Initiate channel connections for registered channels.
@@ -1281,14 +536,14 @@ xpc_process_channel_activity(struct xpc_partition *part)
1281 ch = &part->channels[ch_number]; 536 ch = &part->channels[ch_number];
1282 537
1283 /* 538 /*
1284 * Process any open or close related IPI flags, and then deal 539 * Process any open or close related chctl flags, and then deal
1285 * with connecting or disconnecting the channel as required. 540 * with connecting or disconnecting the channel as required.
1286 */ 541 */
1287 542
1288 IPI_flags = XPC_GET_IPI_FLAGS(IPI_amo, ch_number); 543 if (chctl.flags[ch_number] & XPC_OPENCLOSE_CHCTL_FLAGS) {
1289 544 xpc_process_openclose_chctl_flags(part, ch_number,
1290 if (XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(IPI_flags)) 545 chctl.flags[ch_number]);
1291 xpc_process_openclose_IPI(part, ch_number, IPI_flags); 546 }
1292 547
1293 ch_flags = ch->flags; /* need an atomic snapshot of flags */ 548 ch_flags = ch->flags; /* need an atomic snapshot of flags */
1294 549
@@ -1299,7 +554,7 @@ xpc_process_channel_activity(struct xpc_partition *part)
1299 continue; 554 continue;
1300 } 555 }
1301 556
1302 if (part->act_state == XPC_P_DEACTIVATING) 557 if (part->act_state == XPC_P_AS_DEACTIVATING)
1303 continue; 558 continue;
1304 559
1305 if (!(ch_flags & XPC_C_CONNECTED)) { 560 if (!(ch_flags & XPC_C_CONNECTED)) {
@@ -1315,13 +570,13 @@ xpc_process_channel_activity(struct xpc_partition *part)
1315 } 570 }
1316 571
1317 /* 572 /*
1318 * Process any message related IPI flags, this may involve the 573 * Process any message related chctl flags, this may involve
1319 * activation of kthreads to deliver any pending messages sent 574 * the activation of kthreads to deliver any pending messages
1320 * from the other partition. 575 * sent from the other partition.
1321 */ 576 */
1322 577
1323 if (XPC_ANY_MSG_IPI_FLAGS_SET(IPI_flags)) 578 if (chctl.flags[ch_number] & XPC_MSG_CHCTL_FLAGS)
1324 xpc_process_msg_IPI(part, ch_number); 579 xpc_process_msg_chctl_flags(part, ch_number);
1325 } 580 }
1326} 581}
1327 582
@@ -1369,59 +624,6 @@ xpc_partition_going_down(struct xpc_partition *part, enum xp_retval reason)
1369} 624}
1370 625
1371/* 626/*
1372 * Teardown the infrastructure necessary to support XPartition Communication
1373 * between the specified remote partition and the local one.
1374 */
1375void
1376xpc_teardown_infrastructure(struct xpc_partition *part)
1377{
1378 short partid = XPC_PARTID(part);
1379
1380 /*
1381 * We start off by making this partition inaccessible to local
1382 * processes by marking it as no longer setup. Then we make it
1383 * inaccessible to remote processes by clearing the XPC per partition
1384 * specific variable's magic # (which indicates that these variables
1385 * are no longer valid) and by ignoring all XPC notify IPIs sent to
1386 * this partition.
1387 */
1388
1389 DBUG_ON(atomic_read(&part->nchannels_engaged) != 0);
1390 DBUG_ON(atomic_read(&part->nchannels_active) != 0);
1391 DBUG_ON(part->setup_state != XPC_P_SETUP);
1392 part->setup_state = XPC_P_WTEARDOWN;
1393
1394 xpc_vars_part[partid].magic = 0;
1395
1396 free_irq(SGI_XPC_NOTIFY, (void *)(u64)partid);
1397
1398 /*
1399 * Before proceeding with the teardown we have to wait until all
1400 * existing references cease.
1401 */
1402 wait_event(part->teardown_wq, (atomic_read(&part->references) == 0));
1403
1404 /* now we can begin tearing down the infrastructure */
1405
1406 part->setup_state = XPC_P_TORNDOWN;
1407
1408 /* in case we've still got outstanding timers registered... */
1409 del_timer_sync(&part->dropped_IPI_timer);
1410
1411 kfree(part->remote_openclose_args_base);
1412 part->remote_openclose_args = NULL;
1413 kfree(part->local_openclose_args_base);
1414 part->local_openclose_args = NULL;
1415 kfree(part->remote_GPs_base);
1416 part->remote_GPs = NULL;
1417 kfree(part->local_GPs_base);
1418 part->local_GPs = NULL;
1419 kfree(part->channels);
1420 part->channels = NULL;
1421 part->local_IPI_amo_va = NULL;
1422}
1423
1424/*
1425 * Called by XP at the time of channel connection registration to cause 627 * Called by XP at the time of channel connection registration to cause
1426 * XPC to establish connections to all currently active partitions. 628 * XPC to establish connections to all currently active partitions.
1427 */ 629 */
@@ -1432,9 +634,9 @@ xpc_initiate_connect(int ch_number)
1432 struct xpc_partition *part; 634 struct xpc_partition *part;
1433 struct xpc_channel *ch; 635 struct xpc_channel *ch;
1434 636
1435 DBUG_ON(ch_number < 0 || ch_number >= XPC_NCHANNELS); 637 DBUG_ON(ch_number < 0 || ch_number >= XPC_MAX_NCHANNELS);
1436 638
1437 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) { 639 for (partid = 0; partid < xp_max_npartitions; partid++) {
1438 part = &xpc_partitions[partid]; 640 part = &xpc_partitions[partid];
1439 641
1440 if (xpc_part_ref(part)) { 642 if (xpc_part_ref(part)) {
@@ -1488,10 +690,10 @@ xpc_initiate_disconnect(int ch_number)
1488 struct xpc_partition *part; 690 struct xpc_partition *part;
1489 struct xpc_channel *ch; 691 struct xpc_channel *ch;
1490 692
1491 DBUG_ON(ch_number < 0 || ch_number >= XPC_NCHANNELS); 693 DBUG_ON(ch_number < 0 || ch_number >= XPC_MAX_NCHANNELS);
1492 694
1493 /* initiate the channel disconnect for every active partition */ 695 /* initiate the channel disconnect for every active partition */
1494 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) { 696 for (partid = 0; partid < xp_max_npartitions; partid++) {
1495 part = &xpc_partitions[partid]; 697 part = &xpc_partitions[partid];
1496 698
1497 if (xpc_part_ref(part)) { 699 if (xpc_part_ref(part)) {
@@ -1550,7 +752,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
1550 XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY | 752 XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY |
1551 XPC_C_CONNECTING | XPC_C_CONNECTED); 753 XPC_C_CONNECTING | XPC_C_CONNECTED);
1552 754
1553 xpc_IPI_send_closerequest(ch, irq_flags); 755 xpc_send_chctl_closerequest(ch, irq_flags);
1554 756
1555 if (channel_was_connected) 757 if (channel_was_connected)
1556 ch->flags |= XPC_C_WASCONNECTED; 758 ch->flags |= XPC_C_WASCONNECTED;
@@ -1598,7 +800,7 @@ xpc_disconnect_callout(struct xpc_channel *ch, enum xp_retval reason)
1598 * Wait for a message entry to become available for the specified channel, 800 * Wait for a message entry to become available for the specified channel,
1599 * but don't wait any longer than 1 jiffy. 801 * but don't wait any longer than 1 jiffy.
1600 */ 802 */
1601static enum xp_retval 803enum xp_retval
1602xpc_allocate_msg_wait(struct xpc_channel *ch) 804xpc_allocate_msg_wait(struct xpc_channel *ch)
1603{ 805{
1604 enum xp_retval ret; 806 enum xp_retval ret;
@@ -1625,315 +827,54 @@ xpc_allocate_msg_wait(struct xpc_channel *ch)
1625} 827}
1626 828
1627/* 829/*
1628 * Allocate an entry for a message from the message queue associated with the 830 * Send a message that contains the user's payload on the specified channel
1629 * specified channel. 831 * connected to the specified partition.
1630 */
1631static enum xp_retval
1632xpc_allocate_msg(struct xpc_channel *ch, u32 flags,
1633 struct xpc_msg **address_of_msg)
1634{
1635 struct xpc_msg *msg;
1636 enum xp_retval ret;
1637 s64 put;
1638
1639 /* this reference will be dropped in xpc_send_msg() */
1640 xpc_msgqueue_ref(ch);
1641
1642 if (ch->flags & XPC_C_DISCONNECTING) {
1643 xpc_msgqueue_deref(ch);
1644 return ch->reason;
1645 }
1646 if (!(ch->flags & XPC_C_CONNECTED)) {
1647 xpc_msgqueue_deref(ch);
1648 return xpNotConnected;
1649 }
1650
1651 /*
1652 * Get the next available message entry from the local message queue.
1653 * If none are available, we'll make sure that we grab the latest
1654 * GP values.
1655 */
1656 ret = xpTimeout;
1657
1658 while (1) {
1659
1660 put = ch->w_local_GP.put;
1661 rmb(); /* guarantee that .put loads before .get */
1662 if (put - ch->w_remote_GP.get < ch->local_nentries) {
1663
1664 /* There are available message entries. We need to try
1665 * to secure one for ourselves. We'll do this by trying
1666 * to increment w_local_GP.put as long as someone else
1667 * doesn't beat us to it. If they do, we'll have to
1668 * try again.
1669 */
1670 if (cmpxchg(&ch->w_local_GP.put, put, put + 1) == put) {
1671 /* we got the entry referenced by put */
1672 break;
1673 }
1674 continue; /* try again */
1675 }
1676
1677 /*
1678 * There aren't any available msg entries at this time.
1679 *
1680 * In waiting for a message entry to become available,
1681 * we set a timeout in case the other side is not
1682 * sending completion IPIs. This lets us fake an IPI
1683 * that will cause the IPI handler to fetch the latest
1684 * GP values as if an IPI was sent by the other side.
1685 */
1686 if (ret == xpTimeout)
1687 xpc_IPI_send_local_msgrequest(ch);
1688
1689 if (flags & XPC_NOWAIT) {
1690 xpc_msgqueue_deref(ch);
1691 return xpNoWait;
1692 }
1693
1694 ret = xpc_allocate_msg_wait(ch);
1695 if (ret != xpInterrupted && ret != xpTimeout) {
1696 xpc_msgqueue_deref(ch);
1697 return ret;
1698 }
1699 }
1700
1701 /* get the message's address and initialize it */
1702 msg = (struct xpc_msg *)((u64)ch->local_msgqueue +
1703 (put % ch->local_nentries) * ch->msg_size);
1704
1705 DBUG_ON(msg->flags != 0);
1706 msg->number = put;
1707
1708 dev_dbg(xpc_chan, "w_local_GP.put changed to %ld; msg=0x%p, "
1709 "msg_number=%ld, partid=%d, channel=%d\n", put + 1,
1710 (void *)msg, msg->number, ch->partid, ch->number);
1711
1712 *address_of_msg = msg;
1713
1714 return xpSuccess;
1715}
1716
1717/*
1718 * Allocate an entry for a message from the message queue associated with the
1719 * specified channel. NOTE that this routine can sleep waiting for a message
1720 * entry to become available. To not sleep, pass in the XPC_NOWAIT flag.
1721 * 832 *
1722 * Arguments: 833 * NOTE that this routine can sleep waiting for a message entry to become
834 * available. To not sleep, pass in the XPC_NOWAIT flag.
1723 * 835 *
1724 * partid - ID of partition to which the channel is connected. 836 * Once sent, this routine will not wait for the message to be received, nor
1725 * ch_number - channel #. 837 * will notification be given when it does happen.
1726 * flags - see xpc.h for valid flags.
1727 * payload - address of the allocated payload area pointer (filled in on
1728 * return) in which the user-defined message is constructed.
1729 */
1730enum xp_retval
1731xpc_initiate_allocate(short partid, int ch_number, u32 flags, void **payload)
1732{
1733 struct xpc_partition *part = &xpc_partitions[partid];
1734 enum xp_retval ret = xpUnknownReason;
1735 struct xpc_msg *msg = NULL;
1736
1737 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
1738 DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);
1739
1740 *payload = NULL;
1741
1742 if (xpc_part_ref(part)) {
1743 ret = xpc_allocate_msg(&part->channels[ch_number], flags, &msg);
1744 xpc_part_deref(part);
1745
1746 if (msg != NULL)
1747 *payload = &msg->payload;
1748 }
1749
1750 return ret;
1751}
1752
1753/*
1754 * Now we actually send the messages that are ready to be sent by advancing
1755 * the local message queue's Put value and then send an IPI to the recipient
1756 * partition.
1757 */
1758static void
1759xpc_send_msgs(struct xpc_channel *ch, s64 initial_put)
1760{
1761 struct xpc_msg *msg;
1762 s64 put = initial_put + 1;
1763 int send_IPI = 0;
1764
1765 while (1) {
1766
1767 while (1) {
1768 if (put == ch->w_local_GP.put)
1769 break;
1770
1771 msg = (struct xpc_msg *)((u64)ch->local_msgqueue +
1772 (put % ch->local_nentries) *
1773 ch->msg_size);
1774
1775 if (!(msg->flags & XPC_M_READY))
1776 break;
1777
1778 put++;
1779 }
1780
1781 if (put == initial_put) {
1782 /* nothing's changed */
1783 break;
1784 }
1785
1786 if (cmpxchg_rel(&ch->local_GP->put, initial_put, put) !=
1787 initial_put) {
1788 /* someone else beat us to it */
1789 DBUG_ON(ch->local_GP->put < initial_put);
1790 break;
1791 }
1792
1793 /* we just set the new value of local_GP->put */
1794
1795 dev_dbg(xpc_chan, "local_GP->put changed to %ld, partid=%d, "
1796 "channel=%d\n", put, ch->partid, ch->number);
1797
1798 send_IPI = 1;
1799
1800 /*
1801 * We need to ensure that the message referenced by
1802 * local_GP->put is not XPC_M_READY or that local_GP->put
1803 * equals w_local_GP.put, so we'll go have a look.
1804 */
1805 initial_put = put;
1806 }
1807
1808 if (send_IPI)
1809 xpc_IPI_send_msgrequest(ch);
1810}
1811
1812/*
1813 * Common code that does the actual sending of the message by advancing the
1814 * local message queue's Put value and sends an IPI to the partition the
1815 * message is being sent to.
1816 */
1817static enum xp_retval
1818xpc_send_msg(struct xpc_channel *ch, struct xpc_msg *msg, u8 notify_type,
1819 xpc_notify_func func, void *key)
1820{
1821 enum xp_retval ret = xpSuccess;
1822 struct xpc_notify *notify = notify;
1823 s64 put, msg_number = msg->number;
1824
1825 DBUG_ON(notify_type == XPC_N_CALL && func == NULL);
1826 DBUG_ON((((u64)msg - (u64)ch->local_msgqueue) / ch->msg_size) !=
1827 msg_number % ch->local_nentries);
1828 DBUG_ON(msg->flags & XPC_M_READY);
1829
1830 if (ch->flags & XPC_C_DISCONNECTING) {
1831 /* drop the reference grabbed in xpc_allocate_msg() */
1832 xpc_msgqueue_deref(ch);
1833 return ch->reason;
1834 }
1835
1836 if (notify_type != 0) {
1837 /*
1838 * Tell the remote side to send an ACK interrupt when the
1839 * message has been delivered.
1840 */
1841 msg->flags |= XPC_M_INTERRUPT;
1842
1843 atomic_inc(&ch->n_to_notify);
1844
1845 notify = &ch->notify_queue[msg_number % ch->local_nentries];
1846 notify->func = func;
1847 notify->key = key;
1848 notify->type = notify_type;
1849
1850 /* >>> is a mb() needed here? */
1851
1852 if (ch->flags & XPC_C_DISCONNECTING) {
1853 /*
1854 * An error occurred between our last error check and
1855 * this one. We will try to clear the type field from
1856 * the notify entry. If we succeed then
1857 * xpc_disconnect_channel() didn't already process
1858 * the notify entry.
1859 */
1860 if (cmpxchg(&notify->type, notify_type, 0) ==
1861 notify_type) {
1862 atomic_dec(&ch->n_to_notify);
1863 ret = ch->reason;
1864 }
1865
1866 /* drop the reference grabbed in xpc_allocate_msg() */
1867 xpc_msgqueue_deref(ch);
1868 return ret;
1869 }
1870 }
1871
1872 msg->flags |= XPC_M_READY;
1873
1874 /*
1875 * The preceding store of msg->flags must occur before the following
1876 * load of ch->local_GP->put.
1877 */
1878 mb();
1879
1880 /* see if the message is next in line to be sent, if so send it */
1881
1882 put = ch->local_GP->put;
1883 if (put == msg_number)
1884 xpc_send_msgs(ch, put);
1885
1886 /* drop the reference grabbed in xpc_allocate_msg() */
1887 xpc_msgqueue_deref(ch);
1888 return ret;
1889}
1890
1891/*
1892 * Send a message previously allocated using xpc_initiate_allocate() on the
1893 * specified channel connected to the specified partition.
1894 *
1895 * This routine will not wait for the message to be received, nor will
1896 * notification be given when it does happen. Once this routine has returned
1897 * the message entry allocated via xpc_initiate_allocate() is no longer
1898 * accessable to the caller.
1899 *
1900 * This routine, although called by users, does not call xpc_part_ref() to
1901 * ensure that the partition infrastructure is in place. It relies on the
1902 * fact that we called xpc_msgqueue_ref() in xpc_allocate_msg().
1903 * 838 *
1904 * Arguments: 839 * Arguments:
1905 * 840 *
1906 * partid - ID of partition to which the channel is connected. 841 * partid - ID of partition to which the channel is connected.
1907 * ch_number - channel # to send message on. 842 * ch_number - channel # to send message on.
1908 * payload - pointer to the payload area allocated via 843 * flags - see xp.h for valid flags.
1909 * xpc_initiate_allocate(). 844 * payload - pointer to the payload which is to be sent.
845 * payload_size - size of the payload in bytes.
1910 */ 846 */
1911enum xp_retval 847enum xp_retval
1912xpc_initiate_send(short partid, int ch_number, void *payload) 848xpc_initiate_send(short partid, int ch_number, u32 flags, void *payload,
849 u16 payload_size)
1913{ 850{
1914 struct xpc_partition *part = &xpc_partitions[partid]; 851 struct xpc_partition *part = &xpc_partitions[partid];
1915 struct xpc_msg *msg = XPC_MSG_ADDRESS(payload); 852 enum xp_retval ret = xpUnknownReason;
1916 enum xp_retval ret;
1917 853
1918 dev_dbg(xpc_chan, "msg=0x%p, partid=%d, channel=%d\n", (void *)msg, 854 dev_dbg(xpc_chan, "payload=0x%p, partid=%d, channel=%d\n", payload,
1919 partid, ch_number); 855 partid, ch_number);
1920 856
1921 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS); 857 DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
1922 DBUG_ON(ch_number < 0 || ch_number >= part->nchannels); 858 DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);
1923 DBUG_ON(msg == NULL); 859 DBUG_ON(payload == NULL);
1924 860
1925 ret = xpc_send_msg(&part->channels[ch_number], msg, 0, NULL, NULL); 861 if (xpc_part_ref(part)) {
862 ret = xpc_send_payload(&part->channels[ch_number], flags,
863 payload, payload_size, 0, NULL, NULL);
864 xpc_part_deref(part);
865 }
1926 866
1927 return ret; 867 return ret;
1928} 868}
1929 869
1930/* 870/*
1931 * Send a message previously allocated using xpc_initiate_allocate on the 871 * Send a message that contains the user's payload on the specified channel
1932 * specified channel connected to the specified partition. 872 * connected to the specified partition.
1933 * 873 *
1934 * This routine will not wait for the message to be sent. Once this routine 874 * NOTE that this routine can sleep waiting for a message entry to become
1935 * has returned the message entry allocated via xpc_initiate_allocate() is no 875 * available. To not sleep, pass in the XPC_NOWAIT flag.
1936 * longer accessable to the caller. 876 *
877 * This routine will not wait for the message to be sent or received.
1937 * 878 *
1938 * Once the remote end of the channel has received the message, the function 879 * Once the remote end of the channel has received the message, the function
1939 * passed as an argument to xpc_initiate_send_notify() will be called. This 880 * passed as an argument to xpc_initiate_send_notify() will be called. This
@@ -1943,158 +884,51 @@ xpc_initiate_send(short partid, int ch_number, void *payload)
1943 * 884 *
1944 * If this routine returns an error, the caller's function will NOT be called. 885 * If this routine returns an error, the caller's function will NOT be called.
1945 * 886 *
1946 * This routine, although called by users, does not call xpc_part_ref() to
1947 * ensure that the partition infrastructure is in place. It relies on the
1948 * fact that we called xpc_msgqueue_ref() in xpc_allocate_msg().
1949 *
1950 * Arguments: 887 * Arguments:
1951 * 888 *
1952 * partid - ID of partition to which the channel is connected. 889 * partid - ID of partition to which the channel is connected.
1953 * ch_number - channel # to send message on. 890 * ch_number - channel # to send message on.
1954 * payload - pointer to the payload area allocated via 891 * flags - see xp.h for valid flags.
1955 * xpc_initiate_allocate(). 892 * payload - pointer to the payload which is to be sent.
893 * payload_size - size of the payload in bytes.
1956 * func - function to call with asynchronous notification of message 894 * func - function to call with asynchronous notification of message
1957 * receipt. THIS FUNCTION MUST BE NON-BLOCKING. 895 * receipt. THIS FUNCTION MUST BE NON-BLOCKING.
1958 * key - user-defined key to be passed to the function when it's called. 896 * key - user-defined key to be passed to the function when it's called.
1959 */ 897 */
1960enum xp_retval 898enum xp_retval
1961xpc_initiate_send_notify(short partid, int ch_number, void *payload, 899xpc_initiate_send_notify(short partid, int ch_number, u32 flags, void *payload,
1962 xpc_notify_func func, void *key) 900 u16 payload_size, xpc_notify_func func, void *key)
1963{ 901{
1964 struct xpc_partition *part = &xpc_partitions[partid]; 902 struct xpc_partition *part = &xpc_partitions[partid];
1965 struct xpc_msg *msg = XPC_MSG_ADDRESS(payload); 903 enum xp_retval ret = xpUnknownReason;
1966 enum xp_retval ret;
1967 904
1968 dev_dbg(xpc_chan, "msg=0x%p, partid=%d, channel=%d\n", (void *)msg, 905 dev_dbg(xpc_chan, "payload=0x%p, partid=%d, channel=%d\n", payload,
1969 partid, ch_number); 906 partid, ch_number);
1970 907
1971 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS); 908 DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
1972 DBUG_ON(ch_number < 0 || ch_number >= part->nchannels); 909 DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);
1973 DBUG_ON(msg == NULL); 910 DBUG_ON(payload == NULL);
1974 DBUG_ON(func == NULL); 911 DBUG_ON(func == NULL);
1975 912
1976 ret = xpc_send_msg(&part->channels[ch_number], msg, XPC_N_CALL, 913 if (xpc_part_ref(part)) {
1977 func, key); 914 ret = xpc_send_payload(&part->channels[ch_number], flags,
1978 return ret; 915 payload, payload_size, XPC_N_CALL, func,
1979} 916 key);
1980 917 xpc_part_deref(part);
1981static struct xpc_msg *
1982xpc_pull_remote_msg(struct xpc_channel *ch, s64 get)
1983{
1984 struct xpc_partition *part = &xpc_partitions[ch->partid];
1985 struct xpc_msg *remote_msg, *msg;
1986 u32 msg_index, nmsgs;
1987 u64 msg_offset;
1988 enum xp_retval ret;
1989
1990 if (mutex_lock_interruptible(&ch->msg_to_pull_mutex) != 0) {
1991 /* we were interrupted by a signal */
1992 return NULL;
1993 }
1994
1995 while (get >= ch->next_msg_to_pull) {
1996
1997 /* pull as many messages as are ready and able to be pulled */
1998
1999 msg_index = ch->next_msg_to_pull % ch->remote_nentries;
2000
2001 DBUG_ON(ch->next_msg_to_pull >= ch->w_remote_GP.put);
2002 nmsgs = ch->w_remote_GP.put - ch->next_msg_to_pull;
2003 if (msg_index + nmsgs > ch->remote_nentries) {
2004 /* ignore the ones that wrap the msg queue for now */
2005 nmsgs = ch->remote_nentries - msg_index;
2006 }
2007
2008 msg_offset = msg_index * ch->msg_size;
2009 msg = (struct xpc_msg *)((u64)ch->remote_msgqueue + msg_offset);
2010 remote_msg = (struct xpc_msg *)(ch->remote_msgqueue_pa +
2011 msg_offset);
2012
2013 ret = xpc_pull_remote_cachelines(part, msg, remote_msg,
2014 nmsgs * ch->msg_size);
2015 if (ret != xpSuccess) {
2016
2017 dev_dbg(xpc_chan, "failed to pull %d msgs starting with"
2018 " msg %ld from partition %d, channel=%d, "
2019 "ret=%d\n", nmsgs, ch->next_msg_to_pull,
2020 ch->partid, ch->number, ret);
2021
2022 XPC_DEACTIVATE_PARTITION(part, ret);
2023
2024 mutex_unlock(&ch->msg_to_pull_mutex);
2025 return NULL;
2026 }
2027
2028 ch->next_msg_to_pull += nmsgs;
2029 } 918 }
2030 919 return ret;
2031 mutex_unlock(&ch->msg_to_pull_mutex);
2032
2033 /* return the message we were looking for */
2034 msg_offset = (get % ch->remote_nentries) * ch->msg_size;
2035 msg = (struct xpc_msg *)((u64)ch->remote_msgqueue + msg_offset);
2036
2037 return msg;
2038}
2039
2040/*
2041 * Get a message to be delivered.
2042 */
2043static struct xpc_msg *
2044xpc_get_deliverable_msg(struct xpc_channel *ch)
2045{
2046 struct xpc_msg *msg = NULL;
2047 s64 get;
2048
2049 do {
2050 if (ch->flags & XPC_C_DISCONNECTING)
2051 break;
2052
2053 get = ch->w_local_GP.get;
2054 rmb(); /* guarantee that .get loads before .put */
2055 if (get == ch->w_remote_GP.put)
2056 break;
2057
2058 /* There are messages waiting to be pulled and delivered.
2059 * We need to try to secure one for ourselves. We'll do this
2060 * by trying to increment w_local_GP.get and hope that no one
2061 * else beats us to it. If they do, we'll we'll simply have
2062 * to try again for the next one.
2063 */
2064
2065 if (cmpxchg(&ch->w_local_GP.get, get, get + 1) == get) {
2066 /* we got the entry referenced by get */
2067
2068 dev_dbg(xpc_chan, "w_local_GP.get changed to %ld, "
2069 "partid=%d, channel=%d\n", get + 1,
2070 ch->partid, ch->number);
2071
2072 /* pull the message from the remote partition */
2073
2074 msg = xpc_pull_remote_msg(ch, get);
2075
2076 DBUG_ON(msg != NULL && msg->number != get);
2077 DBUG_ON(msg != NULL && (msg->flags & XPC_M_DONE));
2078 DBUG_ON(msg != NULL && !(msg->flags & XPC_M_READY));
2079
2080 break;
2081 }
2082
2083 } while (1);
2084
2085 return msg;
2086} 920}
2087 921
2088/* 922/*
2089 * Deliver a message to its intended recipient. 923 * Deliver a message's payload to its intended recipient.
2090 */ 924 */
2091void 925void
2092xpc_deliver_msg(struct xpc_channel *ch) 926xpc_deliver_payload(struct xpc_channel *ch)
2093{ 927{
2094 struct xpc_msg *msg; 928 void *payload;
2095 929
2096 msg = xpc_get_deliverable_msg(ch); 930 payload = xpc_get_deliverable_payload(ch);
2097 if (msg != NULL) { 931 if (payload != NULL) {
2098 932
2099 /* 933 /*
2100 * This ref is taken to protect the payload itself from being 934 * This ref is taken to protect the payload itself from being
@@ -2106,18 +940,16 @@ xpc_deliver_msg(struct xpc_channel *ch)
2106 atomic_inc(&ch->kthreads_active); 940 atomic_inc(&ch->kthreads_active);
2107 941
2108 if (ch->func != NULL) { 942 if (ch->func != NULL) {
2109 dev_dbg(xpc_chan, "ch->func() called, msg=0x%p, " 943 dev_dbg(xpc_chan, "ch->func() called, payload=0x%p "
2110 "msg_number=%ld, partid=%d, channel=%d\n", 944 "partid=%d channel=%d\n", payload, ch->partid,
2111 (void *)msg, msg->number, ch->partid,
2112 ch->number); 945 ch->number);
2113 946
2114 /* deliver the message to its intended recipient */ 947 /* deliver the message to its intended recipient */
2115 ch->func(xpMsgReceived, ch->partid, ch->number, 948 ch->func(xpMsgReceived, ch->partid, ch->number, payload,
2116 &msg->payload, ch->key); 949 ch->key);
2117 950
2118 dev_dbg(xpc_chan, "ch->func() returned, msg=0x%p, " 951 dev_dbg(xpc_chan, "ch->func() returned, payload=0x%p "
2119 "msg_number=%ld, partid=%d, channel=%d\n", 952 "partid=%d channel=%d\n", payload, ch->partid,
2120 (void *)msg, msg->number, ch->partid,
2121 ch->number); 953 ch->number);
2122 } 954 }
2123 955
@@ -2126,118 +958,31 @@ xpc_deliver_msg(struct xpc_channel *ch)
2126} 958}
2127 959
2128/* 960/*
2129 * Now we actually acknowledge the messages that have been delivered and ack'd 961 * Acknowledge receipt of a delivered message's payload.
2130 * by advancing the cached remote message queue's Get value and if requested
2131 * send an IPI to the message sender's partition.
2132 */
2133static void
2134xpc_acknowledge_msgs(struct xpc_channel *ch, s64 initial_get, u8 msg_flags)
2135{
2136 struct xpc_msg *msg;
2137 s64 get = initial_get + 1;
2138 int send_IPI = 0;
2139
2140 while (1) {
2141
2142 while (1) {
2143 if (get == ch->w_local_GP.get)
2144 break;
2145
2146 msg = (struct xpc_msg *)((u64)ch->remote_msgqueue +
2147 (get % ch->remote_nentries) *
2148 ch->msg_size);
2149
2150 if (!(msg->flags & XPC_M_DONE))
2151 break;
2152
2153 msg_flags |= msg->flags;
2154 get++;
2155 }
2156
2157 if (get == initial_get) {
2158 /* nothing's changed */
2159 break;
2160 }
2161
2162 if (cmpxchg_rel(&ch->local_GP->get, initial_get, get) !=
2163 initial_get) {
2164 /* someone else beat us to it */
2165 DBUG_ON(ch->local_GP->get <= initial_get);
2166 break;
2167 }
2168
2169 /* we just set the new value of local_GP->get */
2170
2171 dev_dbg(xpc_chan, "local_GP->get changed to %ld, partid=%d, "
2172 "channel=%d\n", get, ch->partid, ch->number);
2173
2174 send_IPI = (msg_flags & XPC_M_INTERRUPT);
2175
2176 /*
2177 * We need to ensure that the message referenced by
2178 * local_GP->get is not XPC_M_DONE or that local_GP->get
2179 * equals w_local_GP.get, so we'll go have a look.
2180 */
2181 initial_get = get;
2182 }
2183
2184 if (send_IPI)
2185 xpc_IPI_send_msgrequest(ch);
2186}
2187
2188/*
2189 * Acknowledge receipt of a delivered message.
2190 *
2191 * If a message has XPC_M_INTERRUPT set, send an interrupt to the partition
2192 * that sent the message.
2193 * 962 *
2194 * This function, although called by users, does not call xpc_part_ref() to 963 * This function, although called by users, does not call xpc_part_ref() to
2195 * ensure that the partition infrastructure is in place. It relies on the 964 * ensure that the partition infrastructure is in place. It relies on the
2196 * fact that we called xpc_msgqueue_ref() in xpc_deliver_msg(). 965 * fact that we called xpc_msgqueue_ref() in xpc_deliver_payload().
2197 * 966 *
2198 * Arguments: 967 * Arguments:
2199 * 968 *
2200 * partid - ID of partition to which the channel is connected. 969 * partid - ID of partition to which the channel is connected.
2201 * ch_number - channel # message received on. 970 * ch_number - channel # message received on.
2202 * payload - pointer to the payload area allocated via 971 * payload - pointer to the payload area allocated via
2203 * xpc_initiate_allocate(). 972 * xpc_initiate_send() or xpc_initiate_send_notify().
2204 */ 973 */
2205void 974void
2206xpc_initiate_received(short partid, int ch_number, void *payload) 975xpc_initiate_received(short partid, int ch_number, void *payload)
2207{ 976{
2208 struct xpc_partition *part = &xpc_partitions[partid]; 977 struct xpc_partition *part = &xpc_partitions[partid];
2209 struct xpc_channel *ch; 978 struct xpc_channel *ch;
2210 struct xpc_msg *msg = XPC_MSG_ADDRESS(payload);
2211 s64 get, msg_number = msg->number;
2212 979
2213 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS); 980 DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
2214 DBUG_ON(ch_number < 0 || ch_number >= part->nchannels); 981 DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);
2215 982
2216 ch = &part->channels[ch_number]; 983 ch = &part->channels[ch_number];
984 xpc_received_payload(ch, payload);
2217 985
2218 dev_dbg(xpc_chan, "msg=0x%p, msg_number=%ld, partid=%d, channel=%d\n", 986 /* the call to xpc_msgqueue_ref() was done by xpc_deliver_payload() */
2219 (void *)msg, msg_number, ch->partid, ch->number);
2220
2221 DBUG_ON((((u64)msg - (u64)ch->remote_msgqueue) / ch->msg_size) !=
2222 msg_number % ch->remote_nentries);
2223 DBUG_ON(msg->flags & XPC_M_DONE);
2224
2225 msg->flags |= XPC_M_DONE;
2226
2227 /*
2228 * The preceding store of msg->flags must occur before the following
2229 * load of ch->local_GP->get.
2230 */
2231 mb();
2232
2233 /*
2234 * See if this message is next in line to be acknowledged as having
2235 * been delivered.
2236 */
2237 get = ch->local_GP->get;
2238 if (get == msg_number)
2239 xpc_acknowledge_msgs(ch, get, msg->flags);
2240
2241 /* the call to xpc_msgqueue_ref() was done by xpc_deliver_msg() */
2242 xpc_msgqueue_deref(ch); 987 xpc_msgqueue_deref(ch);
2243} 988}
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index 579b01ff82d4..46325fc84811 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -25,37 +25,31 @@
25 * 25 *
26 * Caveats: 26 * Caveats:
27 * 27 *
28 * . We currently have no way to determine which nasid an IPI came 28 * . Currently on sn2, we have no way to determine which nasid an IRQ
29 * from. Thus, xpc_IPI_send() does a remote AMO write followed by 29 * came from. Thus, xpc_send_IRQ_sn2() does a remote amo write
30 * an IPI. The AMO indicates where data is to be pulled from, so 30 * followed by an IPI. The amo indicates where data is to be pulled
31 * after the IPI arrives, the remote partition checks the AMO word. 31 * from, so after the IPI arrives, the remote partition checks the amo
32 * The IPI can actually arrive before the AMO however, so other code 32 * word. The IPI can actually arrive before the amo however, so other
33 * must periodically check for this case. Also, remote AMO operations 33 * code must periodically check for this case. Also, remote amo
34 * do not reliably time out. Thus we do a remote PIO read solely to 34 * operations do not reliably time out. Thus we do a remote PIO read
35 * know whether the remote partition is down and whether we should 35 * solely to know whether the remote partition is down and whether we
36 * stop sending IPIs to it. This remote PIO read operation is set up 36 * should stop sending IPIs to it. This remote PIO read operation is
37 * in a special nofault region so SAL knows to ignore (and cleanup) 37 * set up in a special nofault region so SAL knows to ignore (and
38 * any errors due to the remote AMO write, PIO read, and/or PIO 38 * cleanup) any errors due to the remote amo write, PIO read, and/or
39 * write operations. 39 * PIO write operations.
40 * 40 *
41 * If/when new hardware solves this IPI problem, we should abandon 41 * If/when new hardware solves this IPI problem, we should abandon
42 * the current approach. 42 * the current approach.
43 * 43 *
44 */ 44 */
45 45
46#include <linux/kernel.h>
47#include <linux/module.h> 46#include <linux/module.h>
48#include <linux/init.h> 47#include <linux/sysctl.h>
49#include <linux/cache.h> 48#include <linux/device.h>
50#include <linux/interrupt.h>
51#include <linux/delay.h> 49#include <linux/delay.h>
52#include <linux/reboot.h> 50#include <linux/reboot.h>
53#include <linux/completion.h>
54#include <linux/kdebug.h> 51#include <linux/kdebug.h>
55#include <linux/kthread.h> 52#include <linux/kthread.h>
56#include <linux/uaccess.h>
57#include <asm/sn/intr.h>
58#include <asm/sn/sn_sal.h>
59#include "xpc.h" 53#include "xpc.h"
60 54
61/* define two XPC debug device structures to be used with dev_dbg() et al */ 55/* define two XPC debug device structures to be used with dev_dbg() et al */
@@ -89,9 +83,9 @@ static int xpc_hb_check_interval = XPC_HB_CHECK_DEFAULT_INTERVAL;
89static int xpc_hb_check_min_interval = 10; 83static int xpc_hb_check_min_interval = 10;
90static int xpc_hb_check_max_interval = 120; 84static int xpc_hb_check_max_interval = 120;
91 85
92int xpc_disengage_request_timelimit = XPC_DISENGAGE_REQUEST_DEFAULT_TIMELIMIT; 86int xpc_disengage_timelimit = XPC_DISENGAGE_DEFAULT_TIMELIMIT;
93static int xpc_disengage_request_min_timelimit; /* = 0 */ 87static int xpc_disengage_min_timelimit; /* = 0 */
94static int xpc_disengage_request_max_timelimit = 120; 88static int xpc_disengage_max_timelimit = 120;
95 89
96static ctl_table xpc_sys_xpc_hb_dir[] = { 90static ctl_table xpc_sys_xpc_hb_dir[] = {
97 { 91 {
@@ -124,14 +118,14 @@ static ctl_table xpc_sys_xpc_dir[] = {
124 .child = xpc_sys_xpc_hb_dir}, 118 .child = xpc_sys_xpc_hb_dir},
125 { 119 {
126 .ctl_name = CTL_UNNUMBERED, 120 .ctl_name = CTL_UNNUMBERED,
127 .procname = "disengage_request_timelimit", 121 .procname = "disengage_timelimit",
128 .data = &xpc_disengage_request_timelimit, 122 .data = &xpc_disengage_timelimit,
129 .maxlen = sizeof(int), 123 .maxlen = sizeof(int),
130 .mode = 0644, 124 .mode = 0644,
131 .proc_handler = &proc_dointvec_minmax, 125 .proc_handler = &proc_dointvec_minmax,
132 .strategy = &sysctl_intvec, 126 .strategy = &sysctl_intvec,
133 .extra1 = &xpc_disengage_request_min_timelimit, 127 .extra1 = &xpc_disengage_min_timelimit,
134 .extra2 = &xpc_disengage_request_max_timelimit}, 128 .extra2 = &xpc_disengage_max_timelimit},
135 {} 129 {}
136}; 130};
137static ctl_table xpc_sys_dir[] = { 131static ctl_table xpc_sys_dir[] = {
@@ -144,16 +138,19 @@ static ctl_table xpc_sys_dir[] = {
144}; 138};
145static struct ctl_table_header *xpc_sysctl; 139static struct ctl_table_header *xpc_sysctl;
146 140
147/* non-zero if any remote partition disengage request was timed out */ 141/* non-zero if any remote partition disengage was timed out */
148int xpc_disengage_request_timedout; 142int xpc_disengage_timedout;
149 143
150/* #of IRQs received */ 144/* #of activate IRQs received and not yet processed */
151static atomic_t xpc_act_IRQ_rcvd; 145int xpc_activate_IRQ_rcvd;
146DEFINE_SPINLOCK(xpc_activate_IRQ_rcvd_lock);
152 147
153/* IRQ handler notifies this wait queue on receipt of an IRQ */ 148/* IRQ handler notifies this wait queue on receipt of an IRQ */
154static DECLARE_WAIT_QUEUE_HEAD(xpc_act_IRQ_wq); 149DECLARE_WAIT_QUEUE_HEAD(xpc_activate_IRQ_wq);
155 150
156static unsigned long xpc_hb_check_timeout; 151static unsigned long xpc_hb_check_timeout;
152static struct timer_list xpc_hb_timer;
153void *xpc_heartbeating_to_mask;
157 154
158/* notification that the xpc_hb_checker thread has exited */ 155/* notification that the xpc_hb_checker thread has exited */
159static DECLARE_COMPLETION(xpc_hb_checker_exited); 156static DECLARE_COMPLETION(xpc_hb_checker_exited);
@@ -161,8 +158,6 @@ static DECLARE_COMPLETION(xpc_hb_checker_exited);
161/* notification that the xpc_discovery thread has exited */ 158/* notification that the xpc_discovery thread has exited */
162static DECLARE_COMPLETION(xpc_discovery_exited); 159static DECLARE_COMPLETION(xpc_discovery_exited);
163 160
164static struct timer_list xpc_hb_timer;
165
166static void xpc_kthread_waitmsgs(struct xpc_partition *, struct xpc_channel *); 161static void xpc_kthread_waitmsgs(struct xpc_partition *, struct xpc_channel *);
167 162
168static int xpc_system_reboot(struct notifier_block *, unsigned long, void *); 163static int xpc_system_reboot(struct notifier_block *, unsigned long, void *);
@@ -175,31 +170,76 @@ static struct notifier_block xpc_die_notifier = {
175 .notifier_call = xpc_system_die, 170 .notifier_call = xpc_system_die,
176}; 171};
177 172
173int (*xpc_setup_partitions_sn) (void);
174enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *buf, u64 *cookie,
175 unsigned long *rp_pa,
176 size_t *len);
177int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *rp);
178void (*xpc_heartbeat_init) (void);
179void (*xpc_heartbeat_exit) (void);
180void (*xpc_increment_heartbeat) (void);
181void (*xpc_offline_heartbeat) (void);
182void (*xpc_online_heartbeat) (void);
183enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *part);
184
185enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *part);
186void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *ch);
187u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *part);
188enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *ch);
189void (*xpc_teardown_msg_structures) (struct xpc_channel *ch);
190void (*xpc_process_msg_chctl_flags) (struct xpc_partition *part, int ch_number);
191int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *ch);
192void *(*xpc_get_deliverable_payload) (struct xpc_channel *ch);
193
194void (*xpc_request_partition_activation) (struct xpc_rsvd_page *remote_rp,
195 unsigned long remote_rp_pa,
196 int nasid);
197void (*xpc_request_partition_reactivation) (struct xpc_partition *part);
198void (*xpc_request_partition_deactivation) (struct xpc_partition *part);
199void (*xpc_cancel_partition_deactivation_request) (struct xpc_partition *part);
200
201void (*xpc_process_activate_IRQ_rcvd) (void);
202enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *part);
203void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *part);
204
205void (*xpc_indicate_partition_engaged) (struct xpc_partition *part);
206int (*xpc_partition_engaged) (short partid);
207int (*xpc_any_partition_engaged) (void);
208void (*xpc_indicate_partition_disengaged) (struct xpc_partition *part);
209void (*xpc_assume_partition_disengaged) (short partid);
210
211void (*xpc_send_chctl_closerequest) (struct xpc_channel *ch,
212 unsigned long *irq_flags);
213void (*xpc_send_chctl_closereply) (struct xpc_channel *ch,
214 unsigned long *irq_flags);
215void (*xpc_send_chctl_openrequest) (struct xpc_channel *ch,
216 unsigned long *irq_flags);
217void (*xpc_send_chctl_openreply) (struct xpc_channel *ch,
218 unsigned long *irq_flags);
219
220void (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *ch,
221 unsigned long msgqueue_pa);
222
223enum xp_retval (*xpc_send_payload) (struct xpc_channel *ch, u32 flags,
224 void *payload, u16 payload_size,
225 u8 notify_type, xpc_notify_func func,
226 void *key);
227void (*xpc_received_payload) (struct xpc_channel *ch, void *payload);
228
178/* 229/*
179 * Timer function to enforce the timelimit on the partition disengage request. 230 * Timer function to enforce the timelimit on the partition disengage.
180 */ 231 */
181static void 232static void
182xpc_timeout_partition_disengage_request(unsigned long data) 233xpc_timeout_partition_disengage(unsigned long data)
183{ 234{
184 struct xpc_partition *part = (struct xpc_partition *)data; 235 struct xpc_partition *part = (struct xpc_partition *)data;
185 236
186 DBUG_ON(time_before(jiffies, part->disengage_request_timeout)); 237 DBUG_ON(time_is_after_jiffies(part->disengage_timeout));
187 238
188 (void)xpc_partition_disengaged(part); 239 (void)xpc_partition_disengaged(part);
189 240
190 DBUG_ON(part->disengage_request_timeout != 0); 241 DBUG_ON(part->disengage_timeout != 0);
191 DBUG_ON(xpc_partition_engaged(1UL << XPC_PARTID(part)) != 0); 242 DBUG_ON(xpc_partition_engaged(XPC_PARTID(part)));
192}
193
194/*
195 * Notify the heartbeat check thread that an IRQ has been received.
196 */
197static irqreturn_t
198xpc_act_IRQ_handler(int irq, void *dev_id)
199{
200 atomic_inc(&xpc_act_IRQ_rcvd);
201 wake_up_interruptible(&xpc_act_IRQ_wq);
202 return IRQ_HANDLED;
203} 243}
204 244
205/* 245/*
@@ -210,15 +250,63 @@ xpc_act_IRQ_handler(int irq, void *dev_id)
210static void 250static void
211xpc_hb_beater(unsigned long dummy) 251xpc_hb_beater(unsigned long dummy)
212{ 252{
213 xpc_vars->heartbeat++; 253 xpc_increment_heartbeat();
214 254
215 if (time_after_eq(jiffies, xpc_hb_check_timeout)) 255 if (time_is_before_eq_jiffies(xpc_hb_check_timeout))
216 wake_up_interruptible(&xpc_act_IRQ_wq); 256 wake_up_interruptible(&xpc_activate_IRQ_wq);
217 257
218 xpc_hb_timer.expires = jiffies + (xpc_hb_interval * HZ); 258 xpc_hb_timer.expires = jiffies + (xpc_hb_interval * HZ);
219 add_timer(&xpc_hb_timer); 259 add_timer(&xpc_hb_timer);
220} 260}
221 261
262static void
263xpc_start_hb_beater(void)
264{
265 xpc_heartbeat_init();
266 init_timer(&xpc_hb_timer);
267 xpc_hb_timer.function = xpc_hb_beater;
268 xpc_hb_beater(0);
269}
270
271static void
272xpc_stop_hb_beater(void)
273{
274 del_timer_sync(&xpc_hb_timer);
275 xpc_heartbeat_exit();
276}
277
278/*
279 * At periodic intervals, scan through all active partitions and ensure
280 * their heartbeat is still active. If not, the partition is deactivated.
281 */
282static void
283xpc_check_remote_hb(void)
284{
285 struct xpc_partition *part;
286 short partid;
287 enum xp_retval ret;
288
289 for (partid = 0; partid < xp_max_npartitions; partid++) {
290
291 if (xpc_exiting)
292 break;
293
294 if (partid == xp_partition_id)
295 continue;
296
297 part = &xpc_partitions[partid];
298
299 if (part->act_state == XPC_P_AS_INACTIVE ||
300 part->act_state == XPC_P_AS_DEACTIVATING) {
301 continue;
302 }
303
304 ret = xpc_get_remote_heartbeat(part);
305 if (ret != xpSuccess)
306 XPC_DEACTIVATE_PARTITION(part, ret);
307 }
308}
309
222/* 310/*
223 * This thread is responsible for nearly all of the partition 311 * This thread is responsible for nearly all of the partition
224 * activation/deactivation. 312 * activation/deactivation.
@@ -226,67 +314,57 @@ xpc_hb_beater(unsigned long dummy)
226static int 314static int
227xpc_hb_checker(void *ignore) 315xpc_hb_checker(void *ignore)
228{ 316{
229 int last_IRQ_count = 0;
230 int new_IRQ_count;
231 int force_IRQ = 0; 317 int force_IRQ = 0;
232 cpumask_of_cpu_ptr(cpumask, XPC_HB_CHECK_CPU);
233 318
234 /* this thread was marked active by xpc_hb_init() */ 319 /* this thread was marked active by xpc_hb_init() */
235 320
236 set_cpus_allowed_ptr(current, cpumask); 321 set_cpus_allowed_ptr(current, &cpumask_of_cpu(XPC_HB_CHECK_CPU));
237 322
238 /* set our heartbeating to other partitions into motion */ 323 /* set our heartbeating to other partitions into motion */
239 xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ); 324 xpc_hb_check_timeout = jiffies + (xpc_hb_check_interval * HZ);
240 xpc_hb_beater(0); 325 xpc_start_hb_beater();
241 326
242 while (!xpc_exiting) { 327 while (!xpc_exiting) {
243 328
244 dev_dbg(xpc_part, "woke up with %d ticks rem; %d IRQs have " 329 dev_dbg(xpc_part, "woke up with %d ticks rem; %d IRQs have "
245 "been received\n", 330 "been received\n",
246 (int)(xpc_hb_check_timeout - jiffies), 331 (int)(xpc_hb_check_timeout - jiffies),
247 atomic_read(&xpc_act_IRQ_rcvd) - last_IRQ_count); 332 xpc_activate_IRQ_rcvd);
248 333
249 /* checking of remote heartbeats is skewed by IRQ handling */ 334 /* checking of remote heartbeats is skewed by IRQ handling */
250 if (time_after_eq(jiffies, xpc_hb_check_timeout)) { 335 if (time_is_before_eq_jiffies(xpc_hb_check_timeout)) {
336 xpc_hb_check_timeout = jiffies +
337 (xpc_hb_check_interval * HZ);
338
251 dev_dbg(xpc_part, "checking remote heartbeats\n"); 339 dev_dbg(xpc_part, "checking remote heartbeats\n");
252 xpc_check_remote_hb(); 340 xpc_check_remote_hb();
253 341
254 /* 342 /*
255 * We need to periodically recheck to ensure no 343 * On sn2 we need to periodically recheck to ensure no
256 * IPI/AMO pairs have been missed. That check 344 * IRQ/amo pairs have been missed.
257 * must always reset xpc_hb_check_timeout.
258 */ 345 */
259 force_IRQ = 1; 346 if (is_shub())
347 force_IRQ = 1;
260 } 348 }
261 349
262 /* check for outstanding IRQs */ 350 /* check for outstanding IRQs */
263 new_IRQ_count = atomic_read(&xpc_act_IRQ_rcvd); 351 if (xpc_activate_IRQ_rcvd > 0 || force_IRQ != 0) {
264 if (last_IRQ_count < new_IRQ_count || force_IRQ != 0) {
265 force_IRQ = 0; 352 force_IRQ = 0;
266 353 dev_dbg(xpc_part, "processing activate IRQs "
267 dev_dbg(xpc_part, "found an IRQ to process; will be " 354 "received\n");
268 "resetting xpc_hb_check_timeout\n"); 355 xpc_process_activate_IRQ_rcvd();
269
270 last_IRQ_count += xpc_identify_act_IRQ_sender();
271 if (last_IRQ_count < new_IRQ_count) {
272 /* retry once to help avoid missing AMO */
273 (void)xpc_identify_act_IRQ_sender();
274 }
275 last_IRQ_count = new_IRQ_count;
276
277 xpc_hb_check_timeout = jiffies +
278 (xpc_hb_check_interval * HZ);
279 } 356 }
280 357
281 /* wait for IRQ or timeout */ 358 /* wait for IRQ or timeout */
282 (void)wait_event_interruptible(xpc_act_IRQ_wq, 359 (void)wait_event_interruptible(xpc_activate_IRQ_wq,
283 (last_IRQ_count < 360 (time_is_before_eq_jiffies(
284 atomic_read(&xpc_act_IRQ_rcvd) 361 xpc_hb_check_timeout) ||
285 || time_after_eq(jiffies, 362 xpc_activate_IRQ_rcvd > 0 ||
286 xpc_hb_check_timeout) ||
287 xpc_exiting)); 363 xpc_exiting));
288 } 364 }
289 365
366 xpc_stop_hb_beater();
367
290 dev_dbg(xpc_part, "heartbeat checker is exiting\n"); 368 dev_dbg(xpc_part, "heartbeat checker is exiting\n");
291 369
292 /* mark this thread as having exited */ 370 /* mark this thread as having exited */
@@ -312,37 +390,8 @@ xpc_initiate_discovery(void *ignore)
312} 390}
313 391
314/* 392/*
315 * Establish first contact with the remote partititon. This involves pulling
316 * the XPC per partition variables from the remote partition and waiting for
317 * the remote partition to pull ours.
318 */
319static enum xp_retval
320xpc_make_first_contact(struct xpc_partition *part)
321{
322 enum xp_retval ret;
323
324 while ((ret = xpc_pull_remote_vars_part(part)) != xpSuccess) {
325 if (ret != xpRetry) {
326 XPC_DEACTIVATE_PARTITION(part, ret);
327 return ret;
328 }
329
330 dev_dbg(xpc_chan, "waiting to make first contact with "
331 "partition %d\n", XPC_PARTID(part));
332
333 /* wait a 1/4 of a second or so */
334 (void)msleep_interruptible(250);
335
336 if (part->act_state == XPC_P_DEACTIVATING)
337 return part->reason;
338 }
339
340 return xpc_mark_partition_active(part);
341}
342
343/*
344 * The first kthread assigned to a newly activated partition is the one 393 * The first kthread assigned to a newly activated partition is the one
345 * created by XPC HB with which it calls xpc_partition_up(). XPC hangs on to 394 * created by XPC HB with which it calls xpc_activating(). XPC hangs on to
346 * that kthread until the partition is brought down, at which time that kthread 395 * that kthread until the partition is brought down, at which time that kthread
347 * returns back to XPC HB. (The return of that kthread will signify to XPC HB 396 * returns back to XPC HB. (The return of that kthread will signify to XPC HB
348 * that XPC has dismantled all communication infrastructure for the associated 397 * that XPC has dismantled all communication infrastructure for the associated
@@ -355,11 +404,11 @@ xpc_make_first_contact(struct xpc_partition *part)
355static void 404static void
356xpc_channel_mgr(struct xpc_partition *part) 405xpc_channel_mgr(struct xpc_partition *part)
357{ 406{
358 while (part->act_state != XPC_P_DEACTIVATING || 407 while (part->act_state != XPC_P_AS_DEACTIVATING ||
359 atomic_read(&part->nchannels_active) > 0 || 408 atomic_read(&part->nchannels_active) > 0 ||
360 !xpc_partition_disengaged(part)) { 409 !xpc_partition_disengaged(part)) {
361 410
362 xpc_process_channel_activity(part); 411 xpc_process_sent_chctl_flags(part);
363 412
364 /* 413 /*
365 * Wait until we've been requested to activate kthreads or 414 * Wait until we've been requested to activate kthreads or
@@ -377,8 +426,8 @@ xpc_channel_mgr(struct xpc_partition *part)
377 atomic_dec(&part->channel_mgr_requests); 426 atomic_dec(&part->channel_mgr_requests);
378 (void)wait_event_interruptible(part->channel_mgr_wq, 427 (void)wait_event_interruptible(part->channel_mgr_wq,
379 (atomic_read(&part->channel_mgr_requests) > 0 || 428 (atomic_read(&part->channel_mgr_requests) > 0 ||
380 part->local_IPI_amo != 0 || 429 part->chctl.all_flags != 0 ||
381 (part->act_state == XPC_P_DEACTIVATING && 430 (part->act_state == XPC_P_AS_DEACTIVATING &&
382 atomic_read(&part->nchannels_active) == 0 && 431 atomic_read(&part->nchannels_active) == 0 &&
383 xpc_partition_disengaged(part)))); 432 xpc_partition_disengaged(part))));
384 atomic_set(&part->channel_mgr_requests, 1); 433 atomic_set(&part->channel_mgr_requests, 1);
@@ -386,47 +435,163 @@ xpc_channel_mgr(struct xpc_partition *part)
386} 435}
387 436
388/* 437/*
389 * When XPC HB determines that a partition has come up, it will create a new 438 * Guarantee that the kzalloc'd memory is cacheline aligned.
390 * kthread and that kthread will call this function to attempt to set up the
391 * basic infrastructure used for Cross Partition Communication with the newly
392 * upped partition.
393 *
394 * The kthread that was created by XPC HB and which setup the XPC
395 * infrastructure will remain assigned to the partition until the partition
396 * goes down. At which time the kthread will teardown the XPC infrastructure
397 * and then exit.
398 *
399 * XPC HB will put the remote partition's XPC per partition specific variables
400 * physical address into xpc_partitions[partid].remote_vars_part_pa prior to
401 * calling xpc_partition_up().
402 */ 439 */
403static void 440void *
404xpc_partition_up(struct xpc_partition *part) 441xpc_kzalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
442{
443 /* see if kzalloc will give us cachline aligned memory by default */
444 *base = kzalloc(size, flags);
445 if (*base == NULL)
446 return NULL;
447
448 if ((u64)*base == L1_CACHE_ALIGN((u64)*base))
449 return *base;
450
451 kfree(*base);
452
453 /* nope, we'll have to do it ourselves */
454 *base = kzalloc(size + L1_CACHE_BYTES, flags);
455 if (*base == NULL)
456 return NULL;
457
458 return (void *)L1_CACHE_ALIGN((u64)*base);
459}
460
461/*
462 * Setup the channel structures necessary to support XPartition Communication
463 * between the specified remote partition and the local one.
464 */
465static enum xp_retval
466xpc_setup_ch_structures(struct xpc_partition *part)
405{ 467{
468 enum xp_retval ret;
469 int ch_number;
470 struct xpc_channel *ch;
471 short partid = XPC_PARTID(part);
472
473 /*
474 * Allocate all of the channel structures as a contiguous chunk of
475 * memory.
476 */
406 DBUG_ON(part->channels != NULL); 477 DBUG_ON(part->channels != NULL);
478 part->channels = kzalloc(sizeof(struct xpc_channel) * XPC_MAX_NCHANNELS,
479 GFP_KERNEL);
480 if (part->channels == NULL) {
481 dev_err(xpc_chan, "can't get memory for channels\n");
482 return xpNoMemory;
483 }
407 484
408 dev_dbg(xpc_chan, "activating partition %d\n", XPC_PARTID(part)); 485 /* allocate the remote open and close args */
409 486
410 if (xpc_setup_infrastructure(part) != xpSuccess) 487 part->remote_openclose_args =
411 return; 488 xpc_kzalloc_cacheline_aligned(XPC_OPENCLOSE_ARGS_SIZE,
489 GFP_KERNEL, &part->
490 remote_openclose_args_base);
491 if (part->remote_openclose_args == NULL) {
492 dev_err(xpc_chan, "can't get memory for remote connect args\n");
493 ret = xpNoMemory;
494 goto out_1;
495 }
496
497 part->chctl.all_flags = 0;
498 spin_lock_init(&part->chctl_lock);
499
500 atomic_set(&part->channel_mgr_requests, 1);
501 init_waitqueue_head(&part->channel_mgr_wq);
502
503 part->nchannels = XPC_MAX_NCHANNELS;
504
505 atomic_set(&part->nchannels_active, 0);
506 atomic_set(&part->nchannels_engaged, 0);
507
508 for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
509 ch = &part->channels[ch_number];
510
511 ch->partid = partid;
512 ch->number = ch_number;
513 ch->flags = XPC_C_DISCONNECTED;
514
515 atomic_set(&ch->kthreads_assigned, 0);
516 atomic_set(&ch->kthreads_idle, 0);
517 atomic_set(&ch->kthreads_active, 0);
518
519 atomic_set(&ch->references, 0);
520 atomic_set(&ch->n_to_notify, 0);
521
522 spin_lock_init(&ch->lock);
523 init_completion(&ch->wdisconnect_wait);
524
525 atomic_set(&ch->n_on_msg_allocate_wq, 0);
526 init_waitqueue_head(&ch->msg_allocate_wq);
527 init_waitqueue_head(&ch->idle_wq);
528 }
529
530 ret = xpc_setup_ch_structures_sn(part);
531 if (ret != xpSuccess)
532 goto out_2;
533
534 /*
535 * With the setting of the partition setup_state to XPC_P_SS_SETUP,
536 * we're declaring that this partition is ready to go.
537 */
538 part->setup_state = XPC_P_SS_SETUP;
539
540 return xpSuccess;
541
542 /* setup of ch structures failed */
543out_2:
544 kfree(part->remote_openclose_args_base);
545 part->remote_openclose_args = NULL;
546out_1:
547 kfree(part->channels);
548 part->channels = NULL;
549 return ret;
550}
551
552/*
553 * Teardown the channel structures necessary to support XPartition Communication
554 * between the specified remote partition and the local one.
555 */
556static void
557xpc_teardown_ch_structures(struct xpc_partition *part)
558{
559 DBUG_ON(atomic_read(&part->nchannels_engaged) != 0);
560 DBUG_ON(atomic_read(&part->nchannels_active) != 0);
412 561
413 /* 562 /*
414 * The kthread that XPC HB called us with will become the 563 * Make this partition inaccessible to local processes by marking it
415 * channel manager for this partition. It will not return 564 * as no longer setup. Then wait before proceeding with the teardown
416 * back to XPC HB until the partition's XPC infrastructure 565 * until all existing references cease.
417 * has been dismantled.
418 */ 566 */
567 DBUG_ON(part->setup_state != XPC_P_SS_SETUP);
568 part->setup_state = XPC_P_SS_WTEARDOWN;
419 569
420 (void)xpc_part_ref(part); /* this will always succeed */ 570 wait_event(part->teardown_wq, (atomic_read(&part->references) == 0));
421 571
422 if (xpc_make_first_contact(part) == xpSuccess) 572 /* now we can begin tearing down the infrastructure */
423 xpc_channel_mgr(part);
424 573
425 xpc_part_deref(part); 574 xpc_teardown_ch_structures_sn(part);
426 575
427 xpc_teardown_infrastructure(part); 576 kfree(part->remote_openclose_args_base);
577 part->remote_openclose_args = NULL;
578 kfree(part->channels);
579 part->channels = NULL;
580
581 part->setup_state = XPC_P_SS_TORNDOWN;
428} 582}
429 583
584/*
585 * When XPC HB determines that a partition has come up, it will create a new
586 * kthread and that kthread will call this function to attempt to set up the
587 * basic infrastructure used for Cross Partition Communication with the newly
588 * upped partition.
589 *
590 * The kthread that was created by XPC HB and which setup the XPC
591 * infrastructure will remain assigned to the partition becoming the channel
592 * manager for that partition until the partition is deactivating, at which
593 * time the kthread will teardown the XPC infrastructure and then exit.
594 */
430static int 595static int
431xpc_activating(void *__partid) 596xpc_activating(void *__partid)
432{ 597{
@@ -434,64 +599,47 @@ xpc_activating(void *__partid)
434 struct xpc_partition *part = &xpc_partitions[partid]; 599 struct xpc_partition *part = &xpc_partitions[partid];
435 unsigned long irq_flags; 600 unsigned long irq_flags;
436 601
437 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS); 602 DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
438 603
439 spin_lock_irqsave(&part->act_lock, irq_flags); 604 spin_lock_irqsave(&part->act_lock, irq_flags);
440 605
441 if (part->act_state == XPC_P_DEACTIVATING) { 606 if (part->act_state == XPC_P_AS_DEACTIVATING) {
442 part->act_state = XPC_P_INACTIVE; 607 part->act_state = XPC_P_AS_INACTIVE;
443 spin_unlock_irqrestore(&part->act_lock, irq_flags); 608 spin_unlock_irqrestore(&part->act_lock, irq_flags);
444 part->remote_rp_pa = 0; 609 part->remote_rp_pa = 0;
445 return 0; 610 return 0;
446 } 611 }
447 612
448 /* indicate the thread is activating */ 613 /* indicate the thread is activating */
449 DBUG_ON(part->act_state != XPC_P_ACTIVATION_REQ); 614 DBUG_ON(part->act_state != XPC_P_AS_ACTIVATION_REQ);
450 part->act_state = XPC_P_ACTIVATING; 615 part->act_state = XPC_P_AS_ACTIVATING;
451 616
452 XPC_SET_REASON(part, 0, 0); 617 XPC_SET_REASON(part, 0, 0);
453 spin_unlock_irqrestore(&part->act_lock, irq_flags); 618 spin_unlock_irqrestore(&part->act_lock, irq_flags);
454 619
455 dev_dbg(xpc_part, "bringing partition %d up\n", partid); 620 dev_dbg(xpc_part, "activating partition %d\n", partid);
456 621
457 /* 622 xpc_allow_hb(partid);
458 * Register the remote partition's AMOs with SAL so it can handle
459 * and cleanup errors within that address range should the remote
460 * partition go down. We don't unregister this range because it is
461 * difficult to tell when outstanding writes to the remote partition
462 * are finished and thus when it is safe to unregister. This should
463 * not result in wasted space in the SAL xp_addr_region table because
464 * we should get the same page for remote_amos_page_pa after module
465 * reloads and system reboots.
466 */
467 if (sn_register_xp_addr_region(part->remote_amos_page_pa,
468 PAGE_SIZE, 1) < 0) {
469 dev_warn(xpc_part, "xpc_partition_up(%d) failed to register "
470 "xp_addr region\n", partid);
471 623
472 spin_lock_irqsave(&part->act_lock, irq_flags); 624 if (xpc_setup_ch_structures(part) == xpSuccess) {
473 part->act_state = XPC_P_INACTIVE; 625 (void)xpc_part_ref(part); /* this will always succeed */
474 XPC_SET_REASON(part, xpPhysAddrRegFailed, __LINE__);
475 spin_unlock_irqrestore(&part->act_lock, irq_flags);
476 part->remote_rp_pa = 0;
477 return 0;
478 }
479 626
480 xpc_allow_hb(partid, xpc_vars); 627 if (xpc_make_first_contact(part) == xpSuccess) {
481 xpc_IPI_send_activated(part); 628 xpc_mark_partition_active(part);
629 xpc_channel_mgr(part);
630 /* won't return until partition is deactivating */
631 }
482 632
483 /* 633 xpc_part_deref(part);
484 * xpc_partition_up() holds this thread and marks this partition as 634 xpc_teardown_ch_structures(part);
485 * XPC_P_ACTIVE by calling xpc_hb_mark_active(). 635 }
486 */
487 (void)xpc_partition_up(part);
488 636
489 xpc_disallow_hb(partid, xpc_vars); 637 xpc_disallow_hb(partid);
490 xpc_mark_partition_inactive(part); 638 xpc_mark_partition_inactive(part);
491 639
492 if (part->reason == xpReactivating) { 640 if (part->reason == xpReactivating) {
493 /* interrupting ourselves results in activating partition */ 641 /* interrupting ourselves results in activating partition */
494 xpc_IPI_send_reactivate(part); 642 xpc_request_partition_reactivation(part);
495 } 643 }
496 644
497 return 0; 645 return 0;
@@ -506,9 +654,9 @@ xpc_activate_partition(struct xpc_partition *part)
506 654
507 spin_lock_irqsave(&part->act_lock, irq_flags); 655 spin_lock_irqsave(&part->act_lock, irq_flags);
508 656
509 DBUG_ON(part->act_state != XPC_P_INACTIVE); 657 DBUG_ON(part->act_state != XPC_P_AS_INACTIVE);
510 658
511 part->act_state = XPC_P_ACTIVATION_REQ; 659 part->act_state = XPC_P_AS_ACTIVATION_REQ;
512 XPC_SET_REASON(part, xpCloneKThread, __LINE__); 660 XPC_SET_REASON(part, xpCloneKThread, __LINE__);
513 661
514 spin_unlock_irqrestore(&part->act_lock, irq_flags); 662 spin_unlock_irqrestore(&part->act_lock, irq_flags);
@@ -517,62 +665,12 @@ xpc_activate_partition(struct xpc_partition *part)
517 partid); 665 partid);
518 if (IS_ERR(kthread)) { 666 if (IS_ERR(kthread)) {
519 spin_lock_irqsave(&part->act_lock, irq_flags); 667 spin_lock_irqsave(&part->act_lock, irq_flags);
520 part->act_state = XPC_P_INACTIVE; 668 part->act_state = XPC_P_AS_INACTIVE;
521 XPC_SET_REASON(part, xpCloneKThreadFailed, __LINE__); 669 XPC_SET_REASON(part, xpCloneKThreadFailed, __LINE__);
522 spin_unlock_irqrestore(&part->act_lock, irq_flags); 670 spin_unlock_irqrestore(&part->act_lock, irq_flags);
523 } 671 }
524} 672}
525 673
526/*
527 * Handle the receipt of a SGI_XPC_NOTIFY IRQ by seeing whether the specified
528 * partition actually sent it. Since SGI_XPC_NOTIFY IRQs may be shared by more
529 * than one partition, we use an AMO_t structure per partition to indicate
530 * whether a partition has sent an IPI or not. If it has, then wake up the
531 * associated kthread to handle it.
532 *
533 * All SGI_XPC_NOTIFY IRQs received by XPC are the result of IPIs sent by XPC
534 * running on other partitions.
535 *
536 * Noteworthy Arguments:
537 *
538 * irq - Interrupt ReQuest number. NOT USED.
539 *
540 * dev_id - partid of IPI's potential sender.
541 */
542irqreturn_t
543xpc_notify_IRQ_handler(int irq, void *dev_id)
544{
545 short partid = (short)(u64)dev_id;
546 struct xpc_partition *part = &xpc_partitions[partid];
547
548 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
549
550 if (xpc_part_ref(part)) {
551 xpc_check_for_channel_activity(part);
552
553 xpc_part_deref(part);
554 }
555 return IRQ_HANDLED;
556}
557
558/*
559 * Check to see if xpc_notify_IRQ_handler() dropped any IPIs on the floor
560 * because the write to their associated IPI amo completed after the IRQ/IPI
561 * was received.
562 */
563void
564xpc_dropped_IPI_check(struct xpc_partition *part)
565{
566 if (xpc_part_ref(part)) {
567 xpc_check_for_channel_activity(part);
568
569 part->dropped_IPI_timer.expires = jiffies +
570 XPC_P_DROPPED_IPI_WAIT;
571 add_timer(&part->dropped_IPI_timer);
572 xpc_part_deref(part);
573 }
574}
575
576void 674void
577xpc_activate_kthreads(struct xpc_channel *ch, int needed) 675xpc_activate_kthreads(struct xpc_channel *ch, int needed)
578{ 676{
@@ -617,9 +715,9 @@ xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch)
617 do { 715 do {
618 /* deliver messages to their intended recipients */ 716 /* deliver messages to their intended recipients */
619 717
620 while (ch->w_local_GP.get < ch->w_remote_GP.put && 718 while (xpc_n_of_deliverable_payloads(ch) > 0 &&
621 !(ch->flags & XPC_C_DISCONNECTING)) { 719 !(ch->flags & XPC_C_DISCONNECTING)) {
622 xpc_deliver_msg(ch); 720 xpc_deliver_payload(ch);
623 } 721 }
624 722
625 if (atomic_inc_return(&ch->kthreads_idle) > 723 if (atomic_inc_return(&ch->kthreads_idle) >
@@ -633,7 +731,7 @@ xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch)
633 "wait_event_interruptible_exclusive()\n"); 731 "wait_event_interruptible_exclusive()\n");
634 732
635 (void)wait_event_interruptible_exclusive(ch->idle_wq, 733 (void)wait_event_interruptible_exclusive(ch->idle_wq,
636 (ch->w_local_GP.get < ch->w_remote_GP.put || 734 (xpc_n_of_deliverable_payloads(ch) > 0 ||
637 (ch->flags & XPC_C_DISCONNECTING))); 735 (ch->flags & XPC_C_DISCONNECTING)));
638 736
639 atomic_dec(&ch->kthreads_idle); 737 atomic_dec(&ch->kthreads_idle);
@@ -678,7 +776,7 @@ xpc_kthread_start(void *args)
678 * additional kthreads to help deliver them. We only 776 * additional kthreads to help deliver them. We only
679 * need one less than total #of messages to deliver. 777 * need one less than total #of messages to deliver.
680 */ 778 */
681 n_needed = ch->w_remote_GP.put - ch->w_local_GP.get - 1; 779 n_needed = xpc_n_of_deliverable_payloads(ch) - 1;
682 if (n_needed > 0 && !(ch->flags & XPC_C_DISCONNECTING)) 780 if (n_needed > 0 && !(ch->flags & XPC_C_DISCONNECTING))
683 xpc_activate_kthreads(ch, n_needed); 781 xpc_activate_kthreads(ch, n_needed);
684 782
@@ -704,11 +802,9 @@ xpc_kthread_start(void *args)
704 } 802 }
705 spin_unlock_irqrestore(&ch->lock, irq_flags); 803 spin_unlock_irqrestore(&ch->lock, irq_flags);
706 804
707 if (atomic_dec_return(&ch->kthreads_assigned) == 0) { 805 if (atomic_dec_return(&ch->kthreads_assigned) == 0 &&
708 if (atomic_dec_return(&part->nchannels_engaged) == 0) { 806 atomic_dec_return(&part->nchannels_engaged) == 0) {
709 xpc_mark_partition_disengaged(part); 807 xpc_indicate_partition_disengaged(part);
710 xpc_IPI_send_disengage(part);
711 }
712 } 808 }
713 809
714 xpc_msgqueue_deref(ch); 810 xpc_msgqueue_deref(ch);
@@ -759,9 +855,9 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed,
759 } else if (ch->flags & XPC_C_DISCONNECTING) { 855 } else if (ch->flags & XPC_C_DISCONNECTING) {
760 break; 856 break;
761 857
762 } else if (atomic_inc_return(&ch->kthreads_assigned) == 1) { 858 } else if (atomic_inc_return(&ch->kthreads_assigned) == 1 &&
763 if (atomic_inc_return(&part->nchannels_engaged) == 1) 859 atomic_inc_return(&part->nchannels_engaged) == 1) {
764 xpc_mark_partition_engaged(part); 860 xpc_indicate_partition_engaged(part);
765 } 861 }
766 (void)xpc_part_ref(part); 862 (void)xpc_part_ref(part);
767 xpc_msgqueue_ref(ch); 863 xpc_msgqueue_ref(ch);
@@ -783,8 +879,7 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed,
783 879
784 if (atomic_dec_return(&ch->kthreads_assigned) == 0 && 880 if (atomic_dec_return(&ch->kthreads_assigned) == 0 &&
785 atomic_dec_return(&part->nchannels_engaged) == 0) { 881 atomic_dec_return(&part->nchannels_engaged) == 0) {
786 xpc_mark_partition_disengaged(part); 882 xpc_indicate_partition_disengaged(part);
787 xpc_IPI_send_disengage(part);
788 } 883 }
789 xpc_msgqueue_deref(ch); 884 xpc_msgqueue_deref(ch);
790 xpc_part_deref(part); 885 xpc_part_deref(part);
@@ -816,7 +911,7 @@ xpc_disconnect_wait(int ch_number)
816 int wakeup_channel_mgr; 911 int wakeup_channel_mgr;
817 912
818 /* now wait for all callouts to the caller's function to cease */ 913 /* now wait for all callouts to the caller's function to cease */
819 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) { 914 for (partid = 0; partid < xp_max_npartitions; partid++) {
820 part = &xpc_partitions[partid]; 915 part = &xpc_partitions[partid];
821 916
822 if (!xpc_part_ref(part)) 917 if (!xpc_part_ref(part))
@@ -835,16 +930,15 @@ xpc_disconnect_wait(int ch_number)
835 DBUG_ON(!(ch->flags & XPC_C_DISCONNECTED)); 930 DBUG_ON(!(ch->flags & XPC_C_DISCONNECTED));
836 wakeup_channel_mgr = 0; 931 wakeup_channel_mgr = 0;
837 932
838 if (ch->delayed_IPI_flags) { 933 if (ch->delayed_chctl_flags) {
839 if (part->act_state != XPC_P_DEACTIVATING) { 934 if (part->act_state != XPC_P_AS_DEACTIVATING) {
840 spin_lock(&part->IPI_lock); 935 spin_lock(&part->chctl_lock);
841 XPC_SET_IPI_FLAGS(part->local_IPI_amo, 936 part->chctl.flags[ch->number] |=
842 ch->number, 937 ch->delayed_chctl_flags;
843 ch->delayed_IPI_flags); 938 spin_unlock(&part->chctl_lock);
844 spin_unlock(&part->IPI_lock);
845 wakeup_channel_mgr = 1; 939 wakeup_channel_mgr = 1;
846 } 940 }
847 ch->delayed_IPI_flags = 0; 941 ch->delayed_chctl_flags = 0;
848 } 942 }
849 943
850 ch->flags &= ~XPC_C_WDISCONNECT; 944 ch->flags &= ~XPC_C_WDISCONNECT;
@@ -857,13 +951,63 @@ xpc_disconnect_wait(int ch_number)
857 } 951 }
858} 952}
859 953
954static int
955xpc_setup_partitions(void)
956{
957 short partid;
958 struct xpc_partition *part;
959
960 xpc_partitions = kzalloc(sizeof(struct xpc_partition) *
961 xp_max_npartitions, GFP_KERNEL);
962 if (xpc_partitions == NULL) {
963 dev_err(xpc_part, "can't get memory for partition structure\n");
964 return -ENOMEM;
965 }
966
967 /*
968 * The first few fields of each entry of xpc_partitions[] need to
969 * be initialized now so that calls to xpc_connect() and
970 * xpc_disconnect() can be made prior to the activation of any remote
971 * partition. NOTE THAT NONE OF THE OTHER FIELDS BELONGING TO THESE
972 * ENTRIES ARE MEANINGFUL UNTIL AFTER AN ENTRY'S CORRESPONDING
973 * PARTITION HAS BEEN ACTIVATED.
974 */
975 for (partid = 0; partid < xp_max_npartitions; partid++) {
976 part = &xpc_partitions[partid];
977
978 DBUG_ON((u64)part != L1_CACHE_ALIGN((u64)part));
979
980 part->activate_IRQ_rcvd = 0;
981 spin_lock_init(&part->act_lock);
982 part->act_state = XPC_P_AS_INACTIVE;
983 XPC_SET_REASON(part, 0, 0);
984
985 init_timer(&part->disengage_timer);
986 part->disengage_timer.function =
987 xpc_timeout_partition_disengage;
988 part->disengage_timer.data = (unsigned long)part;
989
990 part->setup_state = XPC_P_SS_UNSET;
991 init_waitqueue_head(&part->teardown_wq);
992 atomic_set(&part->references, 0);
993 }
994
995 return xpc_setup_partitions_sn();
996}
997
998static void
999xpc_teardown_partitions(void)
1000{
1001 kfree(xpc_partitions);
1002}
1003
860static void 1004static void
861xpc_do_exit(enum xp_retval reason) 1005xpc_do_exit(enum xp_retval reason)
862{ 1006{
863 short partid; 1007 short partid;
864 int active_part_count, printed_waiting_msg = 0; 1008 int active_part_count, printed_waiting_msg = 0;
865 struct xpc_partition *part; 1009 struct xpc_partition *part;
866 unsigned long printmsg_time, disengage_request_timeout = 0; 1010 unsigned long printmsg_time, disengage_timeout = 0;
867 1011
868 /* a 'rmmod XPC' and a 'reboot' cannot both end up here together */ 1012 /* a 'rmmod XPC' and a 'reboot' cannot both end up here together */
869 DBUG_ON(xpc_exiting == 1); 1013 DBUG_ON(xpc_exiting == 1);
@@ -874,10 +1018,7 @@ xpc_do_exit(enum xp_retval reason)
874 * the heartbeat checker thread in case it's sleeping. 1018 * the heartbeat checker thread in case it's sleeping.
875 */ 1019 */
876 xpc_exiting = 1; 1020 xpc_exiting = 1;
877 wake_up_interruptible(&xpc_act_IRQ_wq); 1021 wake_up_interruptible(&xpc_activate_IRQ_wq);
878
879 /* ignore all incoming interrupts */
880 free_irq(SGI_XPC_ACTIVATE, NULL);
881 1022
882 /* wait for the discovery thread to exit */ 1023 /* wait for the discovery thread to exit */
883 wait_for_completion(&xpc_discovery_exited); 1024 wait_for_completion(&xpc_discovery_exited);
@@ -890,17 +1031,17 @@ xpc_do_exit(enum xp_retval reason)
890 1031
891 /* wait for all partitions to become inactive */ 1032 /* wait for all partitions to become inactive */
892 1033
893 printmsg_time = jiffies + (XPC_DISENGAGE_PRINTMSG_INTERVAL * HZ); 1034 printmsg_time = jiffies + (XPC_DEACTIVATE_PRINTMSG_INTERVAL * HZ);
894 xpc_disengage_request_timedout = 0; 1035 xpc_disengage_timedout = 0;
895 1036
896 do { 1037 do {
897 active_part_count = 0; 1038 active_part_count = 0;
898 1039
899 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) { 1040 for (partid = 0; partid < xp_max_npartitions; partid++) {
900 part = &xpc_partitions[partid]; 1041 part = &xpc_partitions[partid];
901 1042
902 if (xpc_partition_disengaged(part) && 1043 if (xpc_partition_disengaged(part) &&
903 part->act_state == XPC_P_INACTIVE) { 1044 part->act_state == XPC_P_AS_INACTIVE) {
904 continue; 1045 continue;
905 } 1046 }
906 1047
@@ -908,36 +1049,32 @@ xpc_do_exit(enum xp_retval reason)
908 1049
909 XPC_DEACTIVATE_PARTITION(part, reason); 1050 XPC_DEACTIVATE_PARTITION(part, reason);
910 1051
911 if (part->disengage_request_timeout > 1052 if (part->disengage_timeout > disengage_timeout)
912 disengage_request_timeout) { 1053 disengage_timeout = part->disengage_timeout;
913 disengage_request_timeout =
914 part->disengage_request_timeout;
915 }
916 } 1054 }
917 1055
918 if (xpc_partition_engaged(-1UL)) { 1056 if (xpc_any_partition_engaged()) {
919 if (time_after(jiffies, printmsg_time)) { 1057 if (time_is_before_jiffies(printmsg_time)) {
920 dev_info(xpc_part, "waiting for remote " 1058 dev_info(xpc_part, "waiting for remote "
921 "partitions to disengage, timeout in " 1059 "partitions to deactivate, timeout in "
922 "%ld seconds\n", 1060 "%ld seconds\n", (disengage_timeout -
923 (disengage_request_timeout - jiffies) 1061 jiffies) / HZ);
924 / HZ);
925 printmsg_time = jiffies + 1062 printmsg_time = jiffies +
926 (XPC_DISENGAGE_PRINTMSG_INTERVAL * HZ); 1063 (XPC_DEACTIVATE_PRINTMSG_INTERVAL * HZ);
927 printed_waiting_msg = 1; 1064 printed_waiting_msg = 1;
928 } 1065 }
929 1066
930 } else if (active_part_count > 0) { 1067 } else if (active_part_count > 0) {
931 if (printed_waiting_msg) { 1068 if (printed_waiting_msg) {
932 dev_info(xpc_part, "waiting for local partition" 1069 dev_info(xpc_part, "waiting for local partition"
933 " to disengage\n"); 1070 " to deactivate\n");
934 printed_waiting_msg = 0; 1071 printed_waiting_msg = 0;
935 } 1072 }
936 1073
937 } else { 1074 } else {
938 if (!xpc_disengage_request_timedout) { 1075 if (!xpc_disengage_timedout) {
939 dev_info(xpc_part, "all partitions have " 1076 dev_info(xpc_part, "all partitions have "
940 "disengaged\n"); 1077 "deactivated\n");
941 } 1078 }
942 break; 1079 break;
943 } 1080 }
@@ -947,33 +1084,28 @@ xpc_do_exit(enum xp_retval reason)
947 1084
948 } while (1); 1085 } while (1);
949 1086
950 DBUG_ON(xpc_partition_engaged(-1UL)); 1087 DBUG_ON(xpc_any_partition_engaged());
1088 DBUG_ON(xpc_any_hbs_allowed() != 0);
951 1089
952 /* indicate to others that our reserved page is uninitialized */ 1090 xpc_teardown_rsvd_page();
953 xpc_rsvd_page->vars_pa = 0;
954
955 /* now it's time to eliminate our heartbeat */
956 del_timer_sync(&xpc_hb_timer);
957 DBUG_ON(xpc_vars->heartbeating_to_mask != 0);
958 1091
959 if (reason == xpUnloading) { 1092 if (reason == xpUnloading) {
960 /* take ourselves off of the reboot_notifier_list */
961 (void)unregister_reboot_notifier(&xpc_reboot_notifier);
962
963 /* take ourselves off of the die_notifier list */
964 (void)unregister_die_notifier(&xpc_die_notifier); 1093 (void)unregister_die_notifier(&xpc_die_notifier);
1094 (void)unregister_reboot_notifier(&xpc_reboot_notifier);
965 } 1095 }
966 1096
967 /* close down protections for IPI operations */
968 xpc_restrict_IPI_ops();
969
970 /* clear the interface to XPC's functions */ 1097 /* clear the interface to XPC's functions */
971 xpc_clear_interface(); 1098 xpc_clear_interface();
972 1099
973 if (xpc_sysctl) 1100 if (xpc_sysctl)
974 unregister_sysctl_table(xpc_sysctl); 1101 unregister_sysctl_table(xpc_sysctl);
975 1102
976 kfree(xpc_remote_copy_buffer_base); 1103 xpc_teardown_partitions();
1104
1105 if (is_shub())
1106 xpc_exit_sn2();
1107 else
1108 xpc_exit_uv();
977} 1109}
978 1110
979/* 1111/*
@@ -1003,60 +1135,57 @@ xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused)
1003} 1135}
1004 1136
1005/* 1137/*
1006 * Notify other partitions to disengage from all references to our memory. 1138 * Notify other partitions to deactivate from us by first disengaging from all
1139 * references to our memory.
1007 */ 1140 */
1008static void 1141static void
1009xpc_die_disengage(void) 1142xpc_die_deactivate(void)
1010{ 1143{
1011 struct xpc_partition *part; 1144 struct xpc_partition *part;
1012 short partid; 1145 short partid;
1013 unsigned long engaged; 1146 int any_engaged;
1014 long time, printmsg_time, disengage_request_timeout; 1147 long keep_waiting;
1148 long wait_to_print;
1015 1149
1016 /* keep xpc_hb_checker thread from doing anything (just in case) */ 1150 /* keep xpc_hb_checker thread from doing anything (just in case) */
1017 xpc_exiting = 1; 1151 xpc_exiting = 1;
1018 1152
1019 xpc_vars->heartbeating_to_mask = 0; /* indicate we're deactivated */ 1153 xpc_disallow_all_hbs(); /*indicate we're deactivated */
1020 1154
1021 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) { 1155 for (partid = 0; partid < xp_max_npartitions; partid++) {
1022 part = &xpc_partitions[partid]; 1156 part = &xpc_partitions[partid];
1023 1157
1024 if (!XPC_SUPPORTS_DISENGAGE_REQUEST(part-> 1158 if (xpc_partition_engaged(partid) ||
1025 remote_vars_version)) { 1159 part->act_state != XPC_P_AS_INACTIVE) {
1026 1160 xpc_request_partition_deactivation(part);
1027 /* just in case it was left set by an earlier XPC */ 1161 xpc_indicate_partition_disengaged(part);
1028 xpc_clear_partition_engaged(1UL << partid);
1029 continue;
1030 }
1031
1032 if (xpc_partition_engaged(1UL << partid) ||
1033 part->act_state != XPC_P_INACTIVE) {
1034 xpc_request_partition_disengage(part);
1035 xpc_mark_partition_disengaged(part);
1036 xpc_IPI_send_disengage(part);
1037 } 1162 }
1038 } 1163 }
1039 1164
1040 time = rtc_time(); 1165 /*
1041 printmsg_time = time + 1166 * Though we requested that all other partitions deactivate from us,
1042 (XPC_DISENGAGE_PRINTMSG_INTERVAL * sn_rtc_cycles_per_second); 1167 * we only wait until they've all disengaged or we've reached the
1043 disengage_request_timeout = time + 1168 * defined timelimit.
1044 (xpc_disengage_request_timelimit * sn_rtc_cycles_per_second); 1169 *
1045 1170 * Given that one iteration through the following while-loop takes
1046 /* wait for all other partitions to disengage from us */ 1171 * approximately 200 microseconds, calculate the #of loops to take
1172 * before bailing and the #of loops before printing a waiting message.
1173 */
1174 keep_waiting = xpc_disengage_timelimit * 1000 * 5;
1175 wait_to_print = XPC_DEACTIVATE_PRINTMSG_INTERVAL * 1000 * 5;
1047 1176
1048 while (1) { 1177 while (1) {
1049 engaged = xpc_partition_engaged(-1UL); 1178 any_engaged = xpc_any_partition_engaged();
1050 if (!engaged) { 1179 if (!any_engaged) {
1051 dev_info(xpc_part, "all partitions have disengaged\n"); 1180 dev_info(xpc_part, "all partitions have deactivated\n");
1052 break; 1181 break;
1053 } 1182 }
1054 1183
1055 time = rtc_time(); 1184 if (!keep_waiting--) {
1056 if (time >= disengage_request_timeout) { 1185 for (partid = 0; partid < xp_max_npartitions;
1057 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) { 1186 partid++) {
1058 if (engaged & (1UL << partid)) { 1187 if (xpc_partition_engaged(partid)) {
1059 dev_info(xpc_part, "disengage from " 1188 dev_info(xpc_part, "deactivate from "
1060 "remote partition %d timed " 1189 "remote partition %d timed "
1061 "out\n", partid); 1190 "out\n", partid);
1062 } 1191 }
@@ -1064,15 +1193,15 @@ xpc_die_disengage(void)
1064 break; 1193 break;
1065 } 1194 }
1066 1195
1067 if (time >= printmsg_time) { 1196 if (!wait_to_print--) {
1068 dev_info(xpc_part, "waiting for remote partitions to " 1197 dev_info(xpc_part, "waiting for remote partitions to "
1069 "disengage, timeout in %ld seconds\n", 1198 "deactivate, timeout in %ld seconds\n",
1070 (disengage_request_timeout - time) / 1199 keep_waiting / (1000 * 5));
1071 sn_rtc_cycles_per_second); 1200 wait_to_print = XPC_DEACTIVATE_PRINTMSG_INTERVAL *
1072 printmsg_time = time + 1201 1000 * 5;
1073 (XPC_DISENGAGE_PRINTMSG_INTERVAL *
1074 sn_rtc_cycles_per_second);
1075 } 1202 }
1203
1204 udelay(200);
1076 } 1205 }
1077} 1206}
1078 1207
@@ -1087,10 +1216,11 @@ xpc_die_disengage(void)
1087static int 1216static int
1088xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused) 1217xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
1089{ 1218{
1219#ifdef CONFIG_IA64 /* !!! temporary kludge */
1090 switch (event) { 1220 switch (event) {
1091 case DIE_MACHINE_RESTART: 1221 case DIE_MACHINE_RESTART:
1092 case DIE_MACHINE_HALT: 1222 case DIE_MACHINE_HALT:
1093 xpc_die_disengage(); 1223 xpc_die_deactivate();
1094 break; 1224 break;
1095 1225
1096 case DIE_KDEBUG_ENTER: 1226 case DIE_KDEBUG_ENTER:
@@ -1101,8 +1231,7 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
1101 /* fall through */ 1231 /* fall through */
1102 case DIE_MCA_MONARCH_ENTER: 1232 case DIE_MCA_MONARCH_ENTER:
1103 case DIE_INIT_MONARCH_ENTER: 1233 case DIE_INIT_MONARCH_ENTER:
1104 xpc_vars->heartbeat++; 1234 xpc_offline_heartbeat();
1105 xpc_vars->heartbeat_offline = 1;
1106 break; 1235 break;
1107 1236
1108 case DIE_KDEBUG_LEAVE: 1237 case DIE_KDEBUG_LEAVE:
@@ -1113,10 +1242,12 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
1113 /* fall through */ 1242 /* fall through */
1114 case DIE_MCA_MONARCH_LEAVE: 1243 case DIE_MCA_MONARCH_LEAVE:
1115 case DIE_INIT_MONARCH_LEAVE: 1244 case DIE_INIT_MONARCH_LEAVE:
1116 xpc_vars->heartbeat++; 1245 xpc_online_heartbeat();
1117 xpc_vars->heartbeat_offline = 0;
1118 break; 1246 break;
1119 } 1247 }
1248#else
1249 xpc_die_deactivate();
1250#endif
1120 1251
1121 return NOTIFY_DONE; 1252 return NOTIFY_DONE;
1122} 1253}
@@ -1125,105 +1256,52 @@ int __init
1125xpc_init(void) 1256xpc_init(void)
1126{ 1257{
1127 int ret; 1258 int ret;
1128 short partid;
1129 struct xpc_partition *part;
1130 struct task_struct *kthread; 1259 struct task_struct *kthread;
1131 size_t buf_size;
1132
1133 if (!ia64_platform_is("sn2"))
1134 return -ENODEV;
1135
1136 buf_size = max(XPC_RP_VARS_SIZE,
1137 XPC_RP_HEADER_SIZE + XP_NASID_MASK_BYTES);
1138 xpc_remote_copy_buffer = xpc_kmalloc_cacheline_aligned(buf_size,
1139 GFP_KERNEL,
1140 &xpc_remote_copy_buffer_base);
1141 if (xpc_remote_copy_buffer == NULL)
1142 return -ENOMEM;
1143 1260
1144 snprintf(xpc_part->bus_id, BUS_ID_SIZE, "part"); 1261 snprintf(xpc_part->bus_id, BUS_ID_SIZE, "part");
1145 snprintf(xpc_chan->bus_id, BUS_ID_SIZE, "chan"); 1262 snprintf(xpc_chan->bus_id, BUS_ID_SIZE, "chan");
1146 1263
1147 xpc_sysctl = register_sysctl_table(xpc_sys_dir); 1264 if (is_shub()) {
1148 1265 /*
1149 /* 1266 * The ia64-sn2 architecture supports at most 64 partitions.
1150 * The first few fields of each entry of xpc_partitions[] need to 1267 * And the inability to unregister remote amos restricts us
1151 * be initialized now so that calls to xpc_connect() and 1268 * further to only support exactly 64 partitions on this
1152 * xpc_disconnect() can be made prior to the activation of any remote 1269 * architecture, no less.
1153 * partition. NOTE THAT NONE OF THE OTHER FIELDS BELONGING TO THESE 1270 */
1154 * ENTRIES ARE MEANINGFUL UNTIL AFTER AN ENTRY'S CORRESPONDING 1271 if (xp_max_npartitions != 64) {
1155 * PARTITION HAS BEEN ACTIVATED. 1272 dev_err(xpc_part, "max #of partitions not set to 64\n");
1156 */ 1273 ret = -EINVAL;
1157 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) { 1274 } else {
1158 part = &xpc_partitions[partid]; 1275 ret = xpc_init_sn2();
1159 1276 }
1160 DBUG_ON((u64)part != L1_CACHE_ALIGN((u64)part));
1161
1162 part->act_IRQ_rcvd = 0;
1163 spin_lock_init(&part->act_lock);
1164 part->act_state = XPC_P_INACTIVE;
1165 XPC_SET_REASON(part, 0, 0);
1166 1277
1167 init_timer(&part->disengage_request_timer); 1278 } else if (is_uv()) {
1168 part->disengage_request_timer.function = 1279 ret = xpc_init_uv();
1169 xpc_timeout_partition_disengage_request;
1170 part->disengage_request_timer.data = (unsigned long)part;
1171 1280
1172 part->setup_state = XPC_P_UNSET; 1281 } else {
1173 init_waitqueue_head(&part->teardown_wq); 1282 ret = -ENODEV;
1174 atomic_set(&part->references, 0);
1175 } 1283 }
1176 1284
1177 /* 1285 if (ret != 0)
1178 * Open up protections for IPI operations (and AMO operations on 1286 return ret;
1179 * Shub 1.1 systems).
1180 */
1181 xpc_allow_IPI_ops();
1182
1183 /*
1184 * Interrupts being processed will increment this atomic variable and
1185 * awaken the heartbeat thread which will process the interrupts.
1186 */
1187 atomic_set(&xpc_act_IRQ_rcvd, 0);
1188 1287
1189 /* 1288 ret = xpc_setup_partitions();
1190 * This is safe to do before the xpc_hb_checker thread has started
1191 * because the handler releases a wait queue. If an interrupt is
1192 * received before the thread is waiting, it will not go to sleep,
1193 * but rather immediately process the interrupt.
1194 */
1195 ret = request_irq(SGI_XPC_ACTIVATE, xpc_act_IRQ_handler, 0,
1196 "xpc hb", NULL);
1197 if (ret != 0) { 1289 if (ret != 0) {
1198 dev_err(xpc_part, "can't register ACTIVATE IRQ handler, " 1290 dev_err(xpc_part, "can't get memory for partition structure\n");
1199 "errno=%d\n", -ret); 1291 goto out_1;
1200
1201 xpc_restrict_IPI_ops();
1202
1203 if (xpc_sysctl)
1204 unregister_sysctl_table(xpc_sysctl);
1205
1206 kfree(xpc_remote_copy_buffer_base);
1207 return -EBUSY;
1208 } 1292 }
1209 1293
1294 xpc_sysctl = register_sysctl_table(xpc_sys_dir);
1295
1210 /* 1296 /*
1211 * Fill the partition reserved page with the information needed by 1297 * Fill the partition reserved page with the information needed by
1212 * other partitions to discover we are alive and establish initial 1298 * other partitions to discover we are alive and establish initial
1213 * communications. 1299 * communications.
1214 */ 1300 */
1215 xpc_rsvd_page = xpc_rsvd_page_init(); 1301 ret = xpc_setup_rsvd_page();
1216 if (xpc_rsvd_page == NULL) { 1302 if (ret != 0) {
1217 dev_err(xpc_part, "could not setup our reserved page\n"); 1303 dev_err(xpc_part, "can't setup our reserved page\n");
1218 1304 goto out_2;
1219 free_irq(SGI_XPC_ACTIVATE, NULL);
1220 xpc_restrict_IPI_ops();
1221
1222 if (xpc_sysctl)
1223 unregister_sysctl_table(xpc_sysctl);
1224
1225 kfree(xpc_remote_copy_buffer_base);
1226 return -EBUSY;
1227 } 1305 }
1228 1306
1229 /* add ourselves to the reboot_notifier_list */ 1307 /* add ourselves to the reboot_notifier_list */
@@ -1236,9 +1314,6 @@ xpc_init(void)
1236 if (ret != 0) 1314 if (ret != 0)
1237 dev_warn(xpc_part, "can't register die notifier\n"); 1315 dev_warn(xpc_part, "can't register die notifier\n");
1238 1316
1239 init_timer(&xpc_hb_timer);
1240 xpc_hb_timer.function = xpc_hb_beater;
1241
1242 /* 1317 /*
1243 * The real work-horse behind xpc. This processes incoming 1318 * The real work-horse behind xpc. This processes incoming
1244 * interrupts and monitors remote heartbeats. 1319 * interrupts and monitors remote heartbeats.
@@ -1246,25 +1321,8 @@ xpc_init(void)
1246 kthread = kthread_run(xpc_hb_checker, NULL, XPC_HB_CHECK_THREAD_NAME); 1321 kthread = kthread_run(xpc_hb_checker, NULL, XPC_HB_CHECK_THREAD_NAME);
1247 if (IS_ERR(kthread)) { 1322 if (IS_ERR(kthread)) {
1248 dev_err(xpc_part, "failed while forking hb check thread\n"); 1323 dev_err(xpc_part, "failed while forking hb check thread\n");
1249 1324 ret = -EBUSY;
1250 /* indicate to others that our reserved page is uninitialized */ 1325 goto out_3;
1251 xpc_rsvd_page->vars_pa = 0;
1252
1253 /* take ourselves off of the reboot_notifier_list */
1254 (void)unregister_reboot_notifier(&xpc_reboot_notifier);
1255
1256 /* take ourselves off of the die_notifier list */
1257 (void)unregister_die_notifier(&xpc_die_notifier);
1258
1259 del_timer_sync(&xpc_hb_timer);
1260 free_irq(SGI_XPC_ACTIVATE, NULL);
1261 xpc_restrict_IPI_ops();
1262
1263 if (xpc_sysctl)
1264 unregister_sysctl_table(xpc_sysctl);
1265
1266 kfree(xpc_remote_copy_buffer_base);
1267 return -EBUSY;
1268 } 1326 }
1269 1327
1270 /* 1328 /*
@@ -1286,11 +1344,28 @@ xpc_init(void)
1286 1344
1287 /* set the interface to point at XPC's functions */ 1345 /* set the interface to point at XPC's functions */
1288 xpc_set_interface(xpc_initiate_connect, xpc_initiate_disconnect, 1346 xpc_set_interface(xpc_initiate_connect, xpc_initiate_disconnect,
1289 xpc_initiate_allocate, xpc_initiate_send, 1347 xpc_initiate_send, xpc_initiate_send_notify,
1290 xpc_initiate_send_notify, xpc_initiate_received, 1348 xpc_initiate_received, xpc_initiate_partid_to_nasids);
1291 xpc_initiate_partid_to_nasids);
1292 1349
1293 return 0; 1350 return 0;
1351
1352 /* initialization was not successful */
1353out_3:
1354 xpc_teardown_rsvd_page();
1355
1356 (void)unregister_die_notifier(&xpc_die_notifier);
1357 (void)unregister_reboot_notifier(&xpc_reboot_notifier);
1358out_2:
1359 if (xpc_sysctl)
1360 unregister_sysctl_table(xpc_sysctl);
1361
1362 xpc_teardown_partitions();
1363out_1:
1364 if (is_shub())
1365 xpc_exit_sn2();
1366 else
1367 xpc_exit_uv();
1368 return ret;
1294} 1369}
1295 1370
1296module_init(xpc_init); 1371module_init(xpc_init);
@@ -1315,9 +1390,9 @@ module_param(xpc_hb_check_interval, int, 0);
1315MODULE_PARM_DESC(xpc_hb_check_interval, "Number of seconds between " 1390MODULE_PARM_DESC(xpc_hb_check_interval, "Number of seconds between "
1316 "heartbeat checks."); 1391 "heartbeat checks.");
1317 1392
1318module_param(xpc_disengage_request_timelimit, int, 0); 1393module_param(xpc_disengage_timelimit, int, 0);
1319MODULE_PARM_DESC(xpc_disengage_request_timelimit, "Number of seconds to wait " 1394MODULE_PARM_DESC(xpc_disengage_timelimit, "Number of seconds to wait "
1320 "for disengage request to complete."); 1395 "for disengage to complete.");
1321 1396
1322module_param(xpc_kdebug_ignore, int, 0); 1397module_param(xpc_kdebug_ignore, int, 0);
1323MODULE_PARM_DESC(xpc_kdebug_ignore, "Should lack of heartbeat be ignored by " 1398MODULE_PARM_DESC(xpc_kdebug_ignore, "Should lack of heartbeat be ignored by "
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index 7dd4b5812c42..6722f6fe4dc7 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -15,57 +15,22 @@
15 * 15 *
16 */ 16 */
17 17
18#include <linux/kernel.h> 18#include <linux/device.h>
19#include <linux/sysctl.h> 19#include <linux/hardirq.h>
20#include <linux/cache.h>
21#include <linux/mmzone.h>
22#include <linux/nodemask.h>
23#include <asm/uncached.h>
24#include <asm/sn/bte.h>
25#include <asm/sn/intr.h>
26#include <asm/sn/sn_sal.h>
27#include <asm/sn/nodepda.h>
28#include <asm/sn/addrs.h>
29#include "xpc.h" 20#include "xpc.h"
30 21
31/* XPC is exiting flag */ 22/* XPC is exiting flag */
32int xpc_exiting; 23int xpc_exiting;
33 24
34/* SH_IPI_ACCESS shub register value on startup */
35static u64 xpc_sh1_IPI_access;
36static u64 xpc_sh2_IPI_access0;
37static u64 xpc_sh2_IPI_access1;
38static u64 xpc_sh2_IPI_access2;
39static u64 xpc_sh2_IPI_access3;
40
41/* original protection values for each node */
42u64 xpc_prot_vec[MAX_NUMNODES];
43
44/* this partition's reserved page pointers */ 25/* this partition's reserved page pointers */
45struct xpc_rsvd_page *xpc_rsvd_page; 26struct xpc_rsvd_page *xpc_rsvd_page;
46static u64 *xpc_part_nasids; 27static unsigned long *xpc_part_nasids;
47static u64 *xpc_mach_nasids; 28unsigned long *xpc_mach_nasids;
48struct xpc_vars *xpc_vars;
49struct xpc_vars_part *xpc_vars_part;
50 29
51static int xp_nasid_mask_bytes; /* actual size in bytes of nasid mask */ 30static int xpc_nasid_mask_nbytes; /* #of bytes in nasid mask */
52static int xp_nasid_mask_words; /* actual size in words of nasid mask */ 31int xpc_nasid_mask_nlongs; /* #of longs in nasid mask */
53
54/*
55 * For performance reasons, each entry of xpc_partitions[] is cacheline
56 * aligned. And xpc_partitions[] is padded with an additional entry at the
57 * end so that the last legitimate entry doesn't share its cacheline with
58 * another variable.
59 */
60struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1];
61 32
62/* 33struct xpc_partition *xpc_partitions;
63 * Generic buffer used to store a local copy of portions of a remote
64 * partition's reserved page (either its header and part_nasids mask,
65 * or its vars).
66 */
67char *xpc_remote_copy_buffer;
68void *xpc_remote_copy_buffer_base;
69 34
70/* 35/*
71 * Guarantee that the kmalloc'd memory is cacheline aligned. 36 * Guarantee that the kmalloc'd memory is cacheline aligned.
@@ -95,56 +60,59 @@ xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
95 * Given a nasid, get the physical address of the partition's reserved page 60 * Given a nasid, get the physical address of the partition's reserved page
96 * for that nasid. This function returns 0 on any error. 61 * for that nasid. This function returns 0 on any error.
97 */ 62 */
98static u64 63static unsigned long
99xpc_get_rsvd_page_pa(int nasid) 64xpc_get_rsvd_page_pa(int nasid)
100{ 65{
101 bte_result_t bte_res; 66 enum xp_retval ret;
102 s64 status;
103 u64 cookie = 0; 67 u64 cookie = 0;
104 u64 rp_pa = nasid; /* seed with nasid */ 68 unsigned long rp_pa = nasid; /* seed with nasid */
105 u64 len = 0; 69 size_t len = 0;
106 u64 buf = buf; 70 size_t buf_len = 0;
107 u64 buf_len = 0; 71 void *buf = buf;
108 void *buf_base = NULL; 72 void *buf_base = NULL;
109 73
110 while (1) { 74 while (1) {
111 75
112 status = sn_partition_reserved_page_pa(buf, &cookie, &rp_pa, 76 /* !!! rp_pa will need to be _gpa on UV.
113 &len); 77 * ??? So do we save it into the architecture specific parts
78 * ??? of the xpc_partition structure? Do we rename this
79 * ??? function or have two versions? Rename rp_pa for UV to
80 * ??? rp_gpa?
81 */
82 ret = xpc_get_partition_rsvd_page_pa(buf, &cookie, &rp_pa,
83 &len);
114 84
115 dev_dbg(xpc_part, "SAL returned with status=%li, cookie=" 85 dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, "
116 "0x%016lx, address=0x%016lx, len=0x%016lx\n", 86 "address=0x%016lx, len=0x%016lx\n", ret,
117 status, cookie, rp_pa, len); 87 (unsigned long)cookie, rp_pa, len);
118 88
119 if (status != SALRET_MORE_PASSES) 89 if (ret != xpNeedMoreInfo)
120 break; 90 break;
121 91
92 /* !!! L1_CACHE_ALIGN() is only a sn2-bte_copy requirement */
122 if (L1_CACHE_ALIGN(len) > buf_len) { 93 if (L1_CACHE_ALIGN(len) > buf_len) {
123 kfree(buf_base); 94 kfree(buf_base);
124 buf_len = L1_CACHE_ALIGN(len); 95 buf_len = L1_CACHE_ALIGN(len);
125 buf = (u64)xpc_kmalloc_cacheline_aligned(buf_len, 96 buf = xpc_kmalloc_cacheline_aligned(buf_len, GFP_KERNEL,
126 GFP_KERNEL, 97 &buf_base);
127 &buf_base);
128 if (buf_base == NULL) { 98 if (buf_base == NULL) {
129 dev_err(xpc_part, "unable to kmalloc " 99 dev_err(xpc_part, "unable to kmalloc "
130 "len=0x%016lx\n", buf_len); 100 "len=0x%016lx\n", buf_len);
131 status = SALRET_ERROR; 101 ret = xpNoMemory;
132 break; 102 break;
133 } 103 }
134 } 104 }
135 105
136 bte_res = xp_bte_copy(rp_pa, buf, buf_len, 106 ret = xp_remote_memcpy(xp_pa(buf), rp_pa, buf_len);
137 (BTE_NOTIFY | BTE_WACQUIRE), NULL); 107 if (ret != xpSuccess) {
138 if (bte_res != BTE_SUCCESS) { 108 dev_dbg(xpc_part, "xp_remote_memcpy failed %d\n", ret);
139 dev_dbg(xpc_part, "xp_bte_copy failed %i\n", bte_res);
140 status = SALRET_ERROR;
141 break; 109 break;
142 } 110 }
143 } 111 }
144 112
145 kfree(buf_base); 113 kfree(buf_base);
146 114
147 if (status != SALRET_OK) 115 if (ret != xpSuccess)
148 rp_pa = 0; 116 rp_pa = 0;
149 117
150 dev_dbg(xpc_part, "reserved page at phys address 0x%016lx\n", rp_pa); 118 dev_dbg(xpc_part, "reserved page at phys address 0x%016lx\n", rp_pa);
@@ -156,300 +124,77 @@ xpc_get_rsvd_page_pa(int nasid)
156 * other partitions to discover we are alive and establish initial 124 * other partitions to discover we are alive and establish initial
157 * communications. 125 * communications.
158 */ 126 */
159struct xpc_rsvd_page * 127int
160xpc_rsvd_page_init(void) 128xpc_setup_rsvd_page(void)
161{ 129{
130 int ret;
162 struct xpc_rsvd_page *rp; 131 struct xpc_rsvd_page *rp;
163 AMO_t *amos_page; 132 unsigned long rp_pa;
164 u64 rp_pa, nasid_array = 0; 133 unsigned long new_ts_jiffies;
165 int i, ret;
166 134
167 /* get the local reserved page's address */ 135 /* get the local reserved page's address */
168 136
169 preempt_disable(); 137 preempt_disable();
170 rp_pa = xpc_get_rsvd_page_pa(cpuid_to_nasid(smp_processor_id())); 138 rp_pa = xpc_get_rsvd_page_pa(xp_cpu_to_nasid(smp_processor_id()));
171 preempt_enable(); 139 preempt_enable();
172 if (rp_pa == 0) { 140 if (rp_pa == 0) {
173 dev_err(xpc_part, "SAL failed to locate the reserved page\n"); 141 dev_err(xpc_part, "SAL failed to locate the reserved page\n");
174 return NULL; 142 return -ESRCH;
175 } 143 }
176 rp = (struct xpc_rsvd_page *)__va(rp_pa); 144 rp = (struct xpc_rsvd_page *)__va(rp_pa);
177 145
178 if (rp->partid != sn_partition_id) { 146 if (rp->SAL_version < 3) {
179 dev_err(xpc_part, "the reserved page's partid of %d should be " 147 /* SAL_versions < 3 had a SAL_partid defined as a u8 */
180 "%d\n", rp->partid, sn_partition_id); 148 rp->SAL_partid &= 0xff;
181 return NULL; 149 }
150 BUG_ON(rp->SAL_partid != xp_partition_id);
151
152 if (rp->SAL_partid < 0 || rp->SAL_partid >= xp_max_npartitions) {
153 dev_err(xpc_part, "the reserved page's partid of %d is outside "
154 "supported range (< 0 || >= %d)\n", rp->SAL_partid,
155 xp_max_npartitions);
156 return -EINVAL;
182 } 157 }
183 158
184 rp->version = XPC_RP_VERSION; 159 rp->version = XPC_RP_VERSION;
160 rp->max_npartitions = xp_max_npartitions;
185 161
186 /* establish the actual sizes of the nasid masks */ 162 /* establish the actual sizes of the nasid masks */
187 if (rp->SAL_version == 1) { 163 if (rp->SAL_version == 1) {
188 /* SAL_version 1 didn't set the nasids_size field */ 164 /* SAL_version 1 didn't set the nasids_size field */
189 rp->nasids_size = 128; 165 rp->SAL_nasids_size = 128;
190 } 166 }
191 xp_nasid_mask_bytes = rp->nasids_size; 167 xpc_nasid_mask_nbytes = rp->SAL_nasids_size;
192 xp_nasid_mask_words = xp_nasid_mask_bytes / 8; 168 xpc_nasid_mask_nlongs = BITS_TO_LONGS(rp->SAL_nasids_size *
169 BITS_PER_BYTE);
193 170
194 /* setup the pointers to the various items in the reserved page */ 171 /* setup the pointers to the various items in the reserved page */
195 xpc_part_nasids = XPC_RP_PART_NASIDS(rp); 172 xpc_part_nasids = XPC_RP_PART_NASIDS(rp);
196 xpc_mach_nasids = XPC_RP_MACH_NASIDS(rp); 173 xpc_mach_nasids = XPC_RP_MACH_NASIDS(rp);
197 xpc_vars = XPC_RP_VARS(rp);
198 xpc_vars_part = XPC_RP_VARS_PART(rp);
199
200 /*
201 * Before clearing xpc_vars, see if a page of AMOs had been previously
202 * allocated. If not we'll need to allocate one and set permissions
203 * so that cross-partition AMOs are allowed.
204 *
205 * The allocated AMO page needs MCA reporting to remain disabled after
206 * XPC has unloaded. To make this work, we keep a copy of the pointer
207 * to this page (i.e., amos_page) in the struct xpc_vars structure,
208 * which is pointed to by the reserved page, and re-use that saved copy
209 * on subsequent loads of XPC. This AMO page is never freed, and its
210 * memory protections are never restricted.
211 */
212 amos_page = xpc_vars->amos_page;
213 if (amos_page == NULL) {
214 amos_page = (AMO_t *)TO_AMO(uncached_alloc_page(0, 1));
215 if (amos_page == NULL) {
216 dev_err(xpc_part, "can't allocate page of AMOs\n");
217 return NULL;
218 }
219
220 /*
221 * Open up AMO-R/W to cpu. This is done for Shub 1.1 systems
222 * when xpc_allow_IPI_ops() is called via xpc_hb_init().
223 */
224 if (!enable_shub_wars_1_1()) {
225 ret = sn_change_memprotect(ia64_tpa((u64)amos_page),
226 PAGE_SIZE,
227 SN_MEMPROT_ACCESS_CLASS_1,
228 &nasid_array);
229 if (ret != 0) {
230 dev_err(xpc_part, "can't change memory "
231 "protections\n");
232 uncached_free_page(__IA64_UNCACHED_OFFSET |
233 TO_PHYS((u64)amos_page), 1);
234 return NULL;
235 }
236 }
237 } else if (!IS_AMO_ADDRESS((u64)amos_page)) {
238 /*
239 * EFI's XPBOOT can also set amos_page in the reserved page,
240 * but it happens to leave it as an uncached physical address
241 * and we need it to be an uncached virtual, so we'll have to
242 * convert it.
243 */
244 if (!IS_AMO_PHYS_ADDRESS((u64)amos_page)) {
245 dev_err(xpc_part, "previously used amos_page address "
246 "is bad = 0x%p\n", (void *)amos_page);
247 return NULL;
248 }
249 amos_page = (AMO_t *)TO_AMO((u64)amos_page);
250 }
251
252 /* clear xpc_vars */
253 memset(xpc_vars, 0, sizeof(struct xpc_vars));
254
255 xpc_vars->version = XPC_V_VERSION;
256 xpc_vars->act_nasid = cpuid_to_nasid(0);
257 xpc_vars->act_phys_cpuid = cpu_physical_id(0);
258 xpc_vars->vars_part_pa = __pa(xpc_vars_part);
259 xpc_vars->amos_page_pa = ia64_tpa((u64)amos_page);
260 xpc_vars->amos_page = amos_page; /* save for next load of XPC */
261
262 /* clear xpc_vars_part */
263 memset((u64 *)xpc_vars_part, 0, sizeof(struct xpc_vars_part) *
264 XP_MAX_PARTITIONS);
265
266 /* initialize the activate IRQ related AMO variables */
267 for (i = 0; i < xp_nasid_mask_words; i++)
268 (void)xpc_IPI_init(XPC_ACTIVATE_IRQ_AMOS + i);
269
270 /* initialize the engaged remote partitions related AMO variables */
271 (void)xpc_IPI_init(XPC_ENGAGED_PARTITIONS_AMO);
272 (void)xpc_IPI_init(XPC_DISENGAGE_REQUEST_AMO);
273 174
274 /* timestamp of when reserved page was setup by XPC */ 175 ret = xpc_setup_rsvd_page_sn(rp);
275 rp->stamp = CURRENT_TIME; 176 if (ret != 0)
177 return ret;
276 178
277 /* 179 /*
180 * Set timestamp of when reserved page was setup by XPC.
278 * This signifies to the remote partition that our reserved 181 * This signifies to the remote partition that our reserved
279 * page is initialized. 182 * page is initialized.
280 */ 183 */
281 rp->vars_pa = __pa(xpc_vars); 184 new_ts_jiffies = jiffies;
185 if (new_ts_jiffies == 0 || new_ts_jiffies == rp->ts_jiffies)
186 new_ts_jiffies++;
187 rp->ts_jiffies = new_ts_jiffies;
282 188
283 return rp; 189 xpc_rsvd_page = rp;
190 return 0;
284} 191}
285 192
286/*
287 * Change protections to allow IPI operations (and AMO operations on
288 * Shub 1.1 systems).
289 */
290void 193void
291xpc_allow_IPI_ops(void) 194xpc_teardown_rsvd_page(void)
292{ 195{
293 int node; 196 /* a zero timestamp indicates our rsvd page is not initialized */
294 int nasid; 197 xpc_rsvd_page->ts_jiffies = 0;
295
296 /* >>> Change SH_IPI_ACCESS code to use SAL call once it is available */
297
298 if (is_shub2()) {
299 xpc_sh2_IPI_access0 =
300 (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS0));
301 xpc_sh2_IPI_access1 =
302 (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS1));
303 xpc_sh2_IPI_access2 =
304 (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS2));
305 xpc_sh2_IPI_access3 =
306 (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS3));
307
308 for_each_online_node(node) {
309 nasid = cnodeid_to_nasid(node);
310 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
311 -1UL);
312 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
313 -1UL);
314 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
315 -1UL);
316 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
317 -1UL);
318 }
319
320 } else {
321 xpc_sh1_IPI_access =
322 (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH1_IPI_ACCESS));
323
324 for_each_online_node(node) {
325 nasid = cnodeid_to_nasid(node);
326 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
327 -1UL);
328
329 /*
330 * Since the BIST collides with memory operations on
331 * SHUB 1.1 sn_change_memprotect() cannot be used.
332 */
333 if (enable_shub_wars_1_1()) {
334 /* open up everything */
335 xpc_prot_vec[node] = (u64)HUB_L((u64 *)
336 GLOBAL_MMR_ADDR
337 (nasid,
338 SH1_MD_DQLP_MMR_DIR_PRIVEC0));
339 HUB_S((u64 *)
340 GLOBAL_MMR_ADDR(nasid,
341 SH1_MD_DQLP_MMR_DIR_PRIVEC0),
342 -1UL);
343 HUB_S((u64 *)
344 GLOBAL_MMR_ADDR(nasid,
345 SH1_MD_DQRP_MMR_DIR_PRIVEC0),
346 -1UL);
347 }
348 }
349 }
350}
351
352/*
353 * Restrict protections to disallow IPI operations (and AMO operations on
354 * Shub 1.1 systems).
355 */
356void
357xpc_restrict_IPI_ops(void)
358{
359 int node;
360 int nasid;
361
362 /* >>> Change SH_IPI_ACCESS code to use SAL call once it is available */
363
364 if (is_shub2()) {
365
366 for_each_online_node(node) {
367 nasid = cnodeid_to_nasid(node);
368 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
369 xpc_sh2_IPI_access0);
370 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
371 xpc_sh2_IPI_access1);
372 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
373 xpc_sh2_IPI_access2);
374 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
375 xpc_sh2_IPI_access3);
376 }
377
378 } else {
379
380 for_each_online_node(node) {
381 nasid = cnodeid_to_nasid(node);
382 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
383 xpc_sh1_IPI_access);
384
385 if (enable_shub_wars_1_1()) {
386 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
387 SH1_MD_DQLP_MMR_DIR_PRIVEC0),
388 xpc_prot_vec[node]);
389 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
390 SH1_MD_DQRP_MMR_DIR_PRIVEC0),
391 xpc_prot_vec[node]);
392 }
393 }
394 }
395}
396
397/*
398 * At periodic intervals, scan through all active partitions and ensure
399 * their heartbeat is still active. If not, the partition is deactivated.
400 */
401void
402xpc_check_remote_hb(void)
403{
404 struct xpc_vars *remote_vars;
405 struct xpc_partition *part;
406 short partid;
407 bte_result_t bres;
408
409 remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer;
410
411 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
412
413 if (xpc_exiting)
414 break;
415
416 if (partid == sn_partition_id)
417 continue;
418
419 part = &xpc_partitions[partid];
420
421 if (part->act_state == XPC_P_INACTIVE ||
422 part->act_state == XPC_P_DEACTIVATING) {
423 continue;
424 }
425
426 /* pull the remote_hb cache line */
427 bres = xp_bte_copy(part->remote_vars_pa,
428 (u64)remote_vars,
429 XPC_RP_VARS_SIZE,
430 (BTE_NOTIFY | BTE_WACQUIRE), NULL);
431 if (bres != BTE_SUCCESS) {
432 XPC_DEACTIVATE_PARTITION(part,
433 xpc_map_bte_errors(bres));
434 continue;
435 }
436
437 dev_dbg(xpc_part, "partid = %d, heartbeat = %ld, last_heartbeat"
438 " = %ld, heartbeat_offline = %ld, HB_mask = 0x%lx\n",
439 partid, remote_vars->heartbeat, part->last_heartbeat,
440 remote_vars->heartbeat_offline,
441 remote_vars->heartbeating_to_mask);
442
443 if (((remote_vars->heartbeat == part->last_heartbeat) &&
444 (remote_vars->heartbeat_offline == 0)) ||
445 !xpc_hb_allowed(sn_partition_id, remote_vars)) {
446
447 XPC_DEACTIVATE_PARTITION(part, xpNoHeartbeat);
448 continue;
449 }
450
451 part->last_heartbeat = remote_vars->heartbeat;
452 }
453} 198}
454 199
455/* 200/*
@@ -459,11 +204,12 @@ xpc_check_remote_hb(void)
459 * is large enough to contain a copy of their reserved page header and 204 * is large enough to contain a copy of their reserved page header and
460 * part_nasids mask. 205 * part_nasids mask.
461 */ 206 */
462static enum xp_retval 207enum xp_retval
463xpc_get_remote_rp(int nasid, u64 *discovered_nasids, 208xpc_get_remote_rp(int nasid, unsigned long *discovered_nasids,
464 struct xpc_rsvd_page *remote_rp, u64 *remote_rp_pa) 209 struct xpc_rsvd_page *remote_rp, unsigned long *remote_rp_pa)
465{ 210{
466 int bres, i; 211 int l;
212 enum xp_retval ret;
467 213
468 /* get the reserved page's physical address */ 214 /* get the reserved page's physical address */
469 215
@@ -472,355 +218,45 @@ xpc_get_remote_rp(int nasid, u64 *discovered_nasids,
472 return xpNoRsvdPageAddr; 218 return xpNoRsvdPageAddr;
473 219
474 /* pull over the reserved page header and part_nasids mask */ 220 /* pull over the reserved page header and part_nasids mask */
475 bres = xp_bte_copy(*remote_rp_pa, (u64)remote_rp, 221 ret = xp_remote_memcpy(xp_pa(remote_rp), *remote_rp_pa,
476 XPC_RP_HEADER_SIZE + xp_nasid_mask_bytes, 222 XPC_RP_HEADER_SIZE + xpc_nasid_mask_nbytes);
477 (BTE_NOTIFY | BTE_WACQUIRE), NULL); 223 if (ret != xpSuccess)
478 if (bres != BTE_SUCCESS) 224 return ret;
479 return xpc_map_bte_errors(bres);
480 225
481 if (discovered_nasids != NULL) { 226 if (discovered_nasids != NULL) {
482 u64 *remote_part_nasids = XPC_RP_PART_NASIDS(remote_rp); 227 unsigned long *remote_part_nasids =
483 228 XPC_RP_PART_NASIDS(remote_rp);
484 for (i = 0; i < xp_nasid_mask_words; i++)
485 discovered_nasids[i] |= remote_part_nasids[i];
486 }
487
488 /* check that the partid is for another partition */
489 229
490 if (remote_rp->partid < 1 || 230 for (l = 0; l < xpc_nasid_mask_nlongs; l++)
491 remote_rp->partid > (XP_MAX_PARTITIONS - 1)) { 231 discovered_nasids[l] |= remote_part_nasids[l];
492 return xpInvalidPartid;
493 } 232 }
494 233
495 if (remote_rp->partid == sn_partition_id) 234 /* zero timestamp indicates the reserved page has not been setup */
496 return xpLocalPartid; 235 if (remote_rp->ts_jiffies == 0)
236 return xpRsvdPageNotSet;
497 237
498 if (XPC_VERSION_MAJOR(remote_rp->version) != 238 if (XPC_VERSION_MAJOR(remote_rp->version) !=
499 XPC_VERSION_MAJOR(XPC_RP_VERSION)) { 239 XPC_VERSION_MAJOR(XPC_RP_VERSION)) {
500 return xpBadVersion; 240 return xpBadVersion;
501 } 241 }
502 242
503 return xpSuccess; 243 /* check that both remote and local partids are valid for each side */
504} 244 if (remote_rp->SAL_partid < 0 ||
505 245 remote_rp->SAL_partid >= xp_max_npartitions ||
506/* 246 remote_rp->max_npartitions <= xp_partition_id) {
507 * Get a copy of the remote partition's XPC variables from the reserved page. 247 return xpInvalidPartid;
508 *
509 * remote_vars points to a buffer that is cacheline aligned for BTE copies and
510 * assumed to be of size XPC_RP_VARS_SIZE.
511 */
512static enum xp_retval
513xpc_get_remote_vars(u64 remote_vars_pa, struct xpc_vars *remote_vars)
514{
515 int bres;
516
517 if (remote_vars_pa == 0)
518 return xpVarsNotSet;
519
520 /* pull over the cross partition variables */
521 bres = xp_bte_copy(remote_vars_pa, (u64)remote_vars, XPC_RP_VARS_SIZE,
522 (BTE_NOTIFY | BTE_WACQUIRE), NULL);
523 if (bres != BTE_SUCCESS)
524 return xpc_map_bte_errors(bres);
525
526 if (XPC_VERSION_MAJOR(remote_vars->version) !=
527 XPC_VERSION_MAJOR(XPC_V_VERSION)) {
528 return xpBadVersion;
529 }
530
531 return xpSuccess;
532}
533
534/*
535 * Update the remote partition's info.
536 */
537static void
538xpc_update_partition_info(struct xpc_partition *part, u8 remote_rp_version,
539 struct timespec *remote_rp_stamp, u64 remote_rp_pa,
540 u64 remote_vars_pa, struct xpc_vars *remote_vars)
541{
542 part->remote_rp_version = remote_rp_version;
543 dev_dbg(xpc_part, " remote_rp_version = 0x%016x\n",
544 part->remote_rp_version);
545
546 part->remote_rp_stamp = *remote_rp_stamp;
547 dev_dbg(xpc_part, " remote_rp_stamp (tv_sec = 0x%lx tv_nsec = 0x%lx\n",
548 part->remote_rp_stamp.tv_sec, part->remote_rp_stamp.tv_nsec);
549
550 part->remote_rp_pa = remote_rp_pa;
551 dev_dbg(xpc_part, " remote_rp_pa = 0x%016lx\n", part->remote_rp_pa);
552
553 part->remote_vars_pa = remote_vars_pa;
554 dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n",
555 part->remote_vars_pa);
556
557 part->last_heartbeat = remote_vars->heartbeat;
558 dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n",
559 part->last_heartbeat);
560
561 part->remote_vars_part_pa = remote_vars->vars_part_pa;
562 dev_dbg(xpc_part, " remote_vars_part_pa = 0x%016lx\n",
563 part->remote_vars_part_pa);
564
565 part->remote_act_nasid = remote_vars->act_nasid;
566 dev_dbg(xpc_part, " remote_act_nasid = 0x%x\n",
567 part->remote_act_nasid);
568
569 part->remote_act_phys_cpuid = remote_vars->act_phys_cpuid;
570 dev_dbg(xpc_part, " remote_act_phys_cpuid = 0x%x\n",
571 part->remote_act_phys_cpuid);
572
573 part->remote_amos_page_pa = remote_vars->amos_page_pa;
574 dev_dbg(xpc_part, " remote_amos_page_pa = 0x%lx\n",
575 part->remote_amos_page_pa);
576
577 part->remote_vars_version = remote_vars->version;
578 dev_dbg(xpc_part, " remote_vars_version = 0x%x\n",
579 part->remote_vars_version);
580}
581
582/*
583 * Prior code has determined the nasid which generated an IPI. Inspect
584 * that nasid to determine if its partition needs to be activated or
585 * deactivated.
586 *
587 * A partition is consider "awaiting activation" if our partition
588 * flags indicate it is not active and it has a heartbeat. A
589 * partition is considered "awaiting deactivation" if our partition
590 * flags indicate it is active but it has no heartbeat or it is not
591 * sending its heartbeat to us.
592 *
593 * To determine the heartbeat, the remote nasid must have a properly
594 * initialized reserved page.
595 */
596static void
597xpc_identify_act_IRQ_req(int nasid)
598{
599 struct xpc_rsvd_page *remote_rp;
600 struct xpc_vars *remote_vars;
601 u64 remote_rp_pa;
602 u64 remote_vars_pa;
603 int remote_rp_version;
604 int reactivate = 0;
605 int stamp_diff;
606 struct timespec remote_rp_stamp = { 0, 0 };
607 short partid;
608 struct xpc_partition *part;
609 enum xp_retval ret;
610
611 /* pull over the reserved page structure */
612
613 remote_rp = (struct xpc_rsvd_page *)xpc_remote_copy_buffer;
614
615 ret = xpc_get_remote_rp(nasid, NULL, remote_rp, &remote_rp_pa);
616 if (ret != xpSuccess) {
617 dev_warn(xpc_part, "unable to get reserved page from nasid %d, "
618 "which sent interrupt, reason=%d\n", nasid, ret);
619 return;
620 }
621
622 remote_vars_pa = remote_rp->vars_pa;
623 remote_rp_version = remote_rp->version;
624 if (XPC_SUPPORTS_RP_STAMP(remote_rp_version))
625 remote_rp_stamp = remote_rp->stamp;
626
627 partid = remote_rp->partid;
628 part = &xpc_partitions[partid];
629
630 /* pull over the cross partition variables */
631
632 remote_vars = (struct xpc_vars *)xpc_remote_copy_buffer;
633
634 ret = xpc_get_remote_vars(remote_vars_pa, remote_vars);
635 if (ret != xpSuccess) {
636
637 dev_warn(xpc_part, "unable to get XPC variables from nasid %d, "
638 "which sent interrupt, reason=%d\n", nasid, ret);
639
640 XPC_DEACTIVATE_PARTITION(part, ret);
641 return;
642 }
643
644 part->act_IRQ_rcvd++;
645
646 dev_dbg(xpc_part, "partid for nasid %d is %d; IRQs = %d; HB = "
647 "%ld:0x%lx\n", (int)nasid, (int)partid, part->act_IRQ_rcvd,
648 remote_vars->heartbeat, remote_vars->heartbeating_to_mask);
649
650 if (xpc_partition_disengaged(part) &&
651 part->act_state == XPC_P_INACTIVE) {
652
653 xpc_update_partition_info(part, remote_rp_version,
654 &remote_rp_stamp, remote_rp_pa,
655 remote_vars_pa, remote_vars);
656
657 if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version)) {
658 if (xpc_partition_disengage_requested(1UL << partid)) {
659 /*
660 * Other side is waiting on us to disengage,
661 * even though we already have.
662 */
663 return;
664 }
665 } else {
666 /* other side doesn't support disengage requests */
667 xpc_clear_partition_disengage_request(1UL << partid);
668 }
669
670 xpc_activate_partition(part);
671 return;
672 }
673
674 DBUG_ON(part->remote_rp_version == 0);
675 DBUG_ON(part->remote_vars_version == 0);
676
677 if (!XPC_SUPPORTS_RP_STAMP(part->remote_rp_version)) {
678 DBUG_ON(XPC_SUPPORTS_DISENGAGE_REQUEST(part->
679 remote_vars_version));
680
681 if (!XPC_SUPPORTS_RP_STAMP(remote_rp_version)) {
682 DBUG_ON(XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->
683 version));
684 /* see if the other side rebooted */
685 if (part->remote_amos_page_pa ==
686 remote_vars->amos_page_pa &&
687 xpc_hb_allowed(sn_partition_id, remote_vars)) {
688 /* doesn't look that way, so ignore the IPI */
689 return;
690 }
691 }
692
693 /*
694 * Other side rebooted and previous XPC didn't support the
695 * disengage request, so we don't need to do anything special.
696 */
697
698 xpc_update_partition_info(part, remote_rp_version,
699 &remote_rp_stamp, remote_rp_pa,
700 remote_vars_pa, remote_vars);
701 part->reactivate_nasid = nasid;
702 XPC_DEACTIVATE_PARTITION(part, xpReactivating);
703 return;
704 }
705
706 DBUG_ON(!XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version));
707
708 if (!XPC_SUPPORTS_RP_STAMP(remote_rp_version)) {
709 DBUG_ON(!XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->version));
710
711 /*
712 * Other side rebooted and previous XPC did support the
713 * disengage request, but the new one doesn't.
714 */
715
716 xpc_clear_partition_engaged(1UL << partid);
717 xpc_clear_partition_disengage_request(1UL << partid);
718
719 xpc_update_partition_info(part, remote_rp_version,
720 &remote_rp_stamp, remote_rp_pa,
721 remote_vars_pa, remote_vars);
722 reactivate = 1;
723
724 } else {
725 DBUG_ON(!XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->version));
726
727 stamp_diff = xpc_compare_stamps(&part->remote_rp_stamp,
728 &remote_rp_stamp);
729 if (stamp_diff != 0) {
730 DBUG_ON(stamp_diff >= 0);
731
732 /*
733 * Other side rebooted and the previous XPC did support
734 * the disengage request, as does the new one.
735 */
736
737 DBUG_ON(xpc_partition_engaged(1UL << partid));
738 DBUG_ON(xpc_partition_disengage_requested(1UL <<
739 partid));
740
741 xpc_update_partition_info(part, remote_rp_version,
742 &remote_rp_stamp,
743 remote_rp_pa, remote_vars_pa,
744 remote_vars);
745 reactivate = 1;
746 }
747 }
748
749 if (part->disengage_request_timeout > 0 &&
750 !xpc_partition_disengaged(part)) {
751 /* still waiting on other side to disengage from us */
752 return;
753 }
754
755 if (reactivate) {
756 part->reactivate_nasid = nasid;
757 XPC_DEACTIVATE_PARTITION(part, xpReactivating);
758
759 } else if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version) &&
760 xpc_partition_disengage_requested(1UL << partid)) {
761 XPC_DEACTIVATE_PARTITION(part, xpOtherGoingDown);
762 } 248 }
763}
764 249
765/* 250 if (remote_rp->SAL_partid == xp_partition_id)
766 * Loop through the activation AMO variables and process any bits 251 return xpLocalPartid;
767 * which are set. Each bit indicates a nasid sending a partition
768 * activation or deactivation request.
769 *
770 * Return #of IRQs detected.
771 */
772int
773xpc_identify_act_IRQ_sender(void)
774{
775 int word, bit;
776 u64 nasid_mask;
777 u64 nasid; /* remote nasid */
778 int n_IRQs_detected = 0;
779 AMO_t *act_amos;
780
781 act_amos = xpc_vars->amos_page + XPC_ACTIVATE_IRQ_AMOS;
782
783 /* scan through act AMO variable looking for non-zero entries */
784 for (word = 0; word < xp_nasid_mask_words; word++) {
785
786 if (xpc_exiting)
787 break;
788
789 nasid_mask = xpc_IPI_receive(&act_amos[word]);
790 if (nasid_mask == 0) {
791 /* no IRQs from nasids in this variable */
792 continue;
793 }
794
795 dev_dbg(xpc_part, "AMO[%d] gave back 0x%lx\n", word,
796 nasid_mask);
797
798 /*
799 * If this nasid has been added to the machine since
800 * our partition was reset, this will retain the
801 * remote nasid in our reserved pages machine mask.
802 * This is used in the event of module reload.
803 */
804 xpc_mach_nasids[word] |= nasid_mask;
805
806 /* locate the nasid(s) which sent interrupts */
807 252
808 for (bit = 0; bit < (8 * sizeof(u64)); bit++) { 253 return xpSuccess;
809 if (nasid_mask & (1UL << bit)) {
810 n_IRQs_detected++;
811 nasid = XPC_NASID_FROM_W_B(word, bit);
812 dev_dbg(xpc_part, "interrupt from nasid %ld\n",
813 nasid);
814 xpc_identify_act_IRQ_req(nasid);
815 }
816 }
817 }
818 return n_IRQs_detected;
819} 254}
820 255
821/* 256/*
822 * See if the other side has responded to a partition disengage request 257 * See if the other side has responded to a partition deactivate request
823 * from us. 258 * from us. Though we requested the remote partition to deactivate with regard
259 * to us, we really only need to wait for the other side to disengage from us.
824 */ 260 */
825int 261int
826xpc_partition_disengaged(struct xpc_partition *part) 262xpc_partition_disengaged(struct xpc_partition *part)
@@ -828,41 +264,37 @@ xpc_partition_disengaged(struct xpc_partition *part)
828 short partid = XPC_PARTID(part); 264 short partid = XPC_PARTID(part);
829 int disengaged; 265 int disengaged;
830 266
831 disengaged = (xpc_partition_engaged(1UL << partid) == 0); 267 disengaged = !xpc_partition_engaged(partid);
832 if (part->disengage_request_timeout) { 268 if (part->disengage_timeout) {
833 if (!disengaged) { 269 if (!disengaged) {
834 if (time_before(jiffies, 270 if (time_is_after_jiffies(part->disengage_timeout)) {
835 part->disengage_request_timeout)) {
836 /* timelimit hasn't been reached yet */ 271 /* timelimit hasn't been reached yet */
837 return 0; 272 return 0;
838 } 273 }
839 274
840 /* 275 /*
841 * Other side hasn't responded to our disengage 276 * Other side hasn't responded to our deactivate
842 * request in a timely fashion, so assume it's dead. 277 * request in a timely fashion, so assume it's dead.
843 */ 278 */
844 279
845 dev_info(xpc_part, "disengage from remote partition %d " 280 dev_info(xpc_part, "deactivate request to remote "
846 "timed out\n", partid); 281 "partition %d timed out\n", partid);
847 xpc_disengage_request_timedout = 1; 282 xpc_disengage_timedout = 1;
848 xpc_clear_partition_engaged(1UL << partid); 283 xpc_assume_partition_disengaged(partid);
849 disengaged = 1; 284 disengaged = 1;
850 } 285 }
851 part->disengage_request_timeout = 0; 286 part->disengage_timeout = 0;
852 287
853 /* cancel the timer function, provided it's not us */ 288 /* cancel the timer function, provided it's not us */
854 if (!in_interrupt()) { 289 if (!in_interrupt())
855 del_singleshot_timer_sync(&part-> 290 del_singleshot_timer_sync(&part->disengage_timer);
856 disengage_request_timer);
857 }
858 291
859 DBUG_ON(part->act_state != XPC_P_DEACTIVATING && 292 DBUG_ON(part->act_state != XPC_P_AS_DEACTIVATING &&
860 part->act_state != XPC_P_INACTIVE); 293 part->act_state != XPC_P_AS_INACTIVE);
861 if (part->act_state != XPC_P_INACTIVE) 294 if (part->act_state != XPC_P_AS_INACTIVE)
862 xpc_wakeup_channel_mgr(part); 295 xpc_wakeup_channel_mgr(part);
863 296
864 if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version)) 297 xpc_cancel_partition_deactivation_request(part);
865 xpc_cancel_partition_disengage_request(part);
866 } 298 }
867 return disengaged; 299 return disengaged;
868} 300}
@@ -879,8 +311,8 @@ xpc_mark_partition_active(struct xpc_partition *part)
879 dev_dbg(xpc_part, "setting partition %d to ACTIVE\n", XPC_PARTID(part)); 311 dev_dbg(xpc_part, "setting partition %d to ACTIVE\n", XPC_PARTID(part));
880 312
881 spin_lock_irqsave(&part->act_lock, irq_flags); 313 spin_lock_irqsave(&part->act_lock, irq_flags);
882 if (part->act_state == XPC_P_ACTIVATING) { 314 if (part->act_state == XPC_P_AS_ACTIVATING) {
883 part->act_state = XPC_P_ACTIVE; 315 part->act_state = XPC_P_AS_ACTIVE;
884 ret = xpSuccess; 316 ret = xpSuccess;
885 } else { 317 } else {
886 DBUG_ON(part->reason == xpSuccess); 318 DBUG_ON(part->reason == xpSuccess);
@@ -892,7 +324,7 @@ xpc_mark_partition_active(struct xpc_partition *part)
892} 324}
893 325
894/* 326/*
895 * Notify XPC that the partition is down. 327 * Start the process of deactivating the specified partition.
896 */ 328 */
897void 329void
898xpc_deactivate_partition(const int line, struct xpc_partition *part, 330xpc_deactivate_partition(const int line, struct xpc_partition *part,
@@ -902,16 +334,16 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
902 334
903 spin_lock_irqsave(&part->act_lock, irq_flags); 335 spin_lock_irqsave(&part->act_lock, irq_flags);
904 336
905 if (part->act_state == XPC_P_INACTIVE) { 337 if (part->act_state == XPC_P_AS_INACTIVE) {
906 XPC_SET_REASON(part, reason, line); 338 XPC_SET_REASON(part, reason, line);
907 spin_unlock_irqrestore(&part->act_lock, irq_flags); 339 spin_unlock_irqrestore(&part->act_lock, irq_flags);
908 if (reason == xpReactivating) { 340 if (reason == xpReactivating) {
909 /* we interrupt ourselves to reactivate partition */ 341 /* we interrupt ourselves to reactivate partition */
910 xpc_IPI_send_reactivate(part); 342 xpc_request_partition_reactivation(part);
911 } 343 }
912 return; 344 return;
913 } 345 }
914 if (part->act_state == XPC_P_DEACTIVATING) { 346 if (part->act_state == XPC_P_AS_DEACTIVATING) {
915 if ((part->reason == xpUnloading && reason != xpUnloading) || 347 if ((part->reason == xpUnloading && reason != xpUnloading) ||
916 reason == xpReactivating) { 348 reason == xpReactivating) {
917 XPC_SET_REASON(part, reason, line); 349 XPC_SET_REASON(part, reason, line);
@@ -920,22 +352,18 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part,
920 return; 352 return;
921 } 353 }
922 354
923 part->act_state = XPC_P_DEACTIVATING; 355 part->act_state = XPC_P_AS_DEACTIVATING;
924 XPC_SET_REASON(part, reason, line); 356 XPC_SET_REASON(part, reason, line);
925 357
926 spin_unlock_irqrestore(&part->act_lock, irq_flags); 358 spin_unlock_irqrestore(&part->act_lock, irq_flags);
927 359
928 if (XPC_SUPPORTS_DISENGAGE_REQUEST(part->remote_vars_version)) { 360 /* ask remote partition to deactivate with regard to us */
929 xpc_request_partition_disengage(part); 361 xpc_request_partition_deactivation(part);
930 xpc_IPI_send_disengage(part);
931 362
932 /* set a timelimit on the disengage request */ 363 /* set a timelimit on the disengage phase of the deactivation request */
933 part->disengage_request_timeout = jiffies + 364 part->disengage_timeout = jiffies + (xpc_disengage_timelimit * HZ);
934 (xpc_disengage_request_timelimit * HZ); 365 part->disengage_timer.expires = part->disengage_timeout;
935 part->disengage_request_timer.expires = 366 add_timer(&part->disengage_timer);
936 part->disengage_request_timeout;
937 add_timer(&part->disengage_request_timer);
938 }
939 367
940 dev_dbg(xpc_part, "bringing partition %d down, reason = %d\n", 368 dev_dbg(xpc_part, "bringing partition %d down, reason = %d\n",
941 XPC_PARTID(part), reason); 369 XPC_PARTID(part), reason);
@@ -955,7 +383,7 @@ xpc_mark_partition_inactive(struct xpc_partition *part)
955 XPC_PARTID(part)); 383 XPC_PARTID(part));
956 384
957 spin_lock_irqsave(&part->act_lock, irq_flags); 385 spin_lock_irqsave(&part->act_lock, irq_flags);
958 part->act_state = XPC_P_INACTIVE; 386 part->act_state = XPC_P_AS_INACTIVE;
959 spin_unlock_irqrestore(&part->act_lock, irq_flags); 387 spin_unlock_irqrestore(&part->act_lock, irq_flags);
960 part->remote_rp_pa = 0; 388 part->remote_rp_pa = 0;
961} 389}
@@ -974,28 +402,22 @@ xpc_discovery(void)
974{ 402{
975 void *remote_rp_base; 403 void *remote_rp_base;
976 struct xpc_rsvd_page *remote_rp; 404 struct xpc_rsvd_page *remote_rp;
977 struct xpc_vars *remote_vars; 405 unsigned long remote_rp_pa;
978 u64 remote_rp_pa;
979 u64 remote_vars_pa;
980 int region; 406 int region;
981 int region_size; 407 int region_size;
982 int max_regions; 408 int max_regions;
983 int nasid; 409 int nasid;
984 struct xpc_rsvd_page *rp; 410 struct xpc_rsvd_page *rp;
985 short partid; 411 unsigned long *discovered_nasids;
986 struct xpc_partition *part;
987 u64 *discovered_nasids;
988 enum xp_retval ret; 412 enum xp_retval ret;
989 413
990 remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE + 414 remote_rp = xpc_kmalloc_cacheline_aligned(XPC_RP_HEADER_SIZE +
991 xp_nasid_mask_bytes, 415 xpc_nasid_mask_nbytes,
992 GFP_KERNEL, &remote_rp_base); 416 GFP_KERNEL, &remote_rp_base);
993 if (remote_rp == NULL) 417 if (remote_rp == NULL)
994 return; 418 return;
995 419
996 remote_vars = (struct xpc_vars *)remote_rp; 420 discovered_nasids = kzalloc(sizeof(long) * xpc_nasid_mask_nlongs,
997
998 discovered_nasids = kzalloc(sizeof(u64) * xp_nasid_mask_words,
999 GFP_KERNEL); 421 GFP_KERNEL);
1000 if (discovered_nasids == NULL) { 422 if (discovered_nasids == NULL) {
1001 kfree(remote_rp_base); 423 kfree(remote_rp_base);
@@ -1010,7 +432,7 @@ xpc_discovery(void)
1010 * protection is in regards to memory, IOI and IPI. 432 * protection is in regards to memory, IOI and IPI.
1011 */ 433 */
1012 max_regions = 64; 434 max_regions = 64;
1013 region_size = sn_region_size; 435 region_size = xp_region_size;
1014 436
1015 switch (region_size) { 437 switch (region_size) {
1016 case 128: 438 case 128:
@@ -1038,28 +460,28 @@ xpc_discovery(void)
1038 460
1039 dev_dbg(xpc_part, "checking nasid %d\n", nasid); 461 dev_dbg(xpc_part, "checking nasid %d\n", nasid);
1040 462
1041 if (XPC_NASID_IN_ARRAY(nasid, xpc_part_nasids)) { 463 if (test_bit(nasid / 2, xpc_part_nasids)) {
1042 dev_dbg(xpc_part, "PROM indicates Nasid %d is " 464 dev_dbg(xpc_part, "PROM indicates Nasid %d is "
1043 "part of the local partition; skipping " 465 "part of the local partition; skipping "
1044 "region\n", nasid); 466 "region\n", nasid);
1045 break; 467 break;
1046 } 468 }
1047 469
1048 if (!(XPC_NASID_IN_ARRAY(nasid, xpc_mach_nasids))) { 470 if (!(test_bit(nasid / 2, xpc_mach_nasids))) {
1049 dev_dbg(xpc_part, "PROM indicates Nasid %d was " 471 dev_dbg(xpc_part, "PROM indicates Nasid %d was "
1050 "not on Numa-Link network at reset\n", 472 "not on Numa-Link network at reset\n",
1051 nasid); 473 nasid);
1052 continue; 474 continue;
1053 } 475 }
1054 476
1055 if (XPC_NASID_IN_ARRAY(nasid, discovered_nasids)) { 477 if (test_bit(nasid / 2, discovered_nasids)) {
1056 dev_dbg(xpc_part, "Nasid %d is part of a " 478 dev_dbg(xpc_part, "Nasid %d is part of a "
1057 "partition which was previously " 479 "partition which was previously "
1058 "discovered\n", nasid); 480 "discovered\n", nasid);
1059 continue; 481 continue;
1060 } 482 }
1061 483
1062 /* pull over the reserved page structure */ 484 /* pull over the rsvd page header & part_nasids mask */
1063 485
1064 ret = xpc_get_remote_rp(nasid, discovered_nasids, 486 ret = xpc_get_remote_rp(nasid, discovered_nasids,
1065 remote_rp, &remote_rp_pa); 487 remote_rp, &remote_rp_pa);
@@ -1074,72 +496,8 @@ xpc_discovery(void)
1074 continue; 496 continue;
1075 } 497 }
1076 498
1077 remote_vars_pa = remote_rp->vars_pa; 499 xpc_request_partition_activation(remote_rp,
1078 500 remote_rp_pa, nasid);
1079 partid = remote_rp->partid;
1080 part = &xpc_partitions[partid];
1081
1082 /* pull over the cross partition variables */
1083
1084 ret = xpc_get_remote_vars(remote_vars_pa, remote_vars);
1085 if (ret != xpSuccess) {
1086 dev_dbg(xpc_part, "unable to get XPC variables "
1087 "from nasid %d, reason=%d\n", nasid,
1088 ret);
1089
1090 XPC_DEACTIVATE_PARTITION(part, ret);
1091 continue;
1092 }
1093
1094 if (part->act_state != XPC_P_INACTIVE) {
1095 dev_dbg(xpc_part, "partition %d on nasid %d is "
1096 "already activating\n", partid, nasid);
1097 break;
1098 }
1099
1100 /*
1101 * Register the remote partition's AMOs with SAL so it
1102 * can handle and cleanup errors within that address
1103 * range should the remote partition go down. We don't
1104 * unregister this range because it is difficult to
1105 * tell when outstanding writes to the remote partition
1106 * are finished and thus when it is thus safe to
1107 * unregister. This should not result in wasted space
1108 * in the SAL xp_addr_region table because we should
1109 * get the same page for remote_act_amos_pa after
1110 * module reloads and system reboots.
1111 */
1112 if (sn_register_xp_addr_region
1113 (remote_vars->amos_page_pa, PAGE_SIZE, 1) < 0) {
1114 dev_dbg(xpc_part,
1115 "partition %d failed to "
1116 "register xp_addr region 0x%016lx\n",
1117 partid, remote_vars->amos_page_pa);
1118
1119 XPC_SET_REASON(part, xpPhysAddrRegFailed,
1120 __LINE__);
1121 break;
1122 }
1123
1124 /*
1125 * The remote nasid is valid and available.
1126 * Send an interrupt to that nasid to notify
1127 * it that we are ready to begin activation.
1128 */
1129 dev_dbg(xpc_part, "sending an interrupt to AMO 0x%lx, "
1130 "nasid %d, phys_cpuid 0x%x\n",
1131 remote_vars->amos_page_pa,
1132 remote_vars->act_nasid,
1133 remote_vars->act_phys_cpuid);
1134
1135 if (XPC_SUPPORTS_DISENGAGE_REQUEST(remote_vars->
1136 version)) {
1137 part->remote_amos_page_pa =
1138 remote_vars->amos_page_pa;
1139 xpc_mark_partition_disengaged(part);
1140 xpc_cancel_partition_disengage_request(part);
1141 }
1142 xpc_IPI_send_activate(remote_vars);
1143 } 501 }
1144 } 502 }
1145 503
@@ -1155,20 +513,16 @@ enum xp_retval
1155xpc_initiate_partid_to_nasids(short partid, void *nasid_mask) 513xpc_initiate_partid_to_nasids(short partid, void *nasid_mask)
1156{ 514{
1157 struct xpc_partition *part; 515 struct xpc_partition *part;
1158 u64 part_nasid_pa; 516 unsigned long part_nasid_pa;
1159 int bte_res;
1160 517
1161 part = &xpc_partitions[partid]; 518 part = &xpc_partitions[partid];
1162 if (part->remote_rp_pa == 0) 519 if (part->remote_rp_pa == 0)
1163 return xpPartitionDown; 520 return xpPartitionDown;
1164 521
1165 memset(nasid_mask, 0, XP_NASID_MASK_BYTES); 522 memset(nasid_mask, 0, xpc_nasid_mask_nbytes);
1166
1167 part_nasid_pa = (u64)XPC_RP_PART_NASIDS(part->remote_rp_pa);
1168 523
1169 bte_res = xp_bte_copy(part_nasid_pa, (u64)nasid_mask, 524 part_nasid_pa = (unsigned long)XPC_RP_PART_NASIDS(part->remote_rp_pa);
1170 xp_nasid_mask_bytes, (BTE_NOTIFY | BTE_WACQUIRE),
1171 NULL);
1172 525
1173 return xpc_map_bte_errors(bte_res); 526 return xp_remote_memcpy(xp_pa(nasid_mask), part_nasid_pa,
527 xpc_nasid_mask_nbytes);
1174} 528}
diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c
new file mode 100644
index 000000000000..b4882ccf6344
--- /dev/null
+++ b/drivers/misc/sgi-xp/xpc_sn2.c
@@ -0,0 +1,2404 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9/*
10 * Cross Partition Communication (XPC) sn2-based functions.
11 *
12 * Architecture specific implementation of common functions.
13 *
14 */
15
16#include <linux/delay.h>
17#include <asm/uncached.h>
18#include <asm/sn/mspec.h>
19#include <asm/sn/sn_sal.h>
20#include "xpc.h"
21
22/*
23 * Define the number of u64s required to represent all the C-brick nasids
24 * as a bitmap. The cross-partition kernel modules deal only with
25 * C-brick nasids, thus the need for bitmaps which don't account for
26 * odd-numbered (non C-brick) nasids.
27 */
28#define XPC_MAX_PHYSNODES_SN2 (MAX_NUMALINK_NODES / 2)
29#define XP_NASID_MASK_BYTES_SN2 ((XPC_MAX_PHYSNODES_SN2 + 7) / 8)
30#define XP_NASID_MASK_WORDS_SN2 ((XPC_MAX_PHYSNODES_SN2 + 63) / 64)
31
32/*
33 * Memory for XPC's amo variables is allocated by the MSPEC driver. These
34 * pages are located in the lowest granule. The lowest granule uses 4k pages
35 * for cached references and an alternate TLB handler to never provide a
36 * cacheable mapping for the entire region. This will prevent speculative
37 * reading of cached copies of our lines from being issued which will cause
38 * a PI FSB Protocol error to be generated by the SHUB. For XPC, we need 64
39 * amo variables (based on XP_MAX_NPARTITIONS_SN2) to identify the senders of
40 * NOTIFY IRQs, 128 amo variables (based on XP_NASID_MASK_WORDS_SN2) to identify
41 * the senders of ACTIVATE IRQs, 1 amo variable to identify which remote
42 * partitions (i.e., XPCs) consider themselves currently engaged with the
43 * local XPC and 1 amo variable to request partition deactivation.
44 */
45#define XPC_NOTIFY_IRQ_AMOS_SN2 0
46#define XPC_ACTIVATE_IRQ_AMOS_SN2 (XPC_NOTIFY_IRQ_AMOS_SN2 + \
47 XP_MAX_NPARTITIONS_SN2)
48#define XPC_ENGAGED_PARTITIONS_AMO_SN2 (XPC_ACTIVATE_IRQ_AMOS_SN2 + \
49 XP_NASID_MASK_WORDS_SN2)
50#define XPC_DEACTIVATE_REQUEST_AMO_SN2 (XPC_ENGAGED_PARTITIONS_AMO_SN2 + 1)
51
52/*
53 * Buffer used to store a local copy of portions of a remote partition's
54 * reserved page (either its header and part_nasids mask, or its vars).
55 */
56static void *xpc_remote_copy_buffer_base_sn2;
57static char *xpc_remote_copy_buffer_sn2;
58
59static struct xpc_vars_sn2 *xpc_vars_sn2;
60static struct xpc_vars_part_sn2 *xpc_vars_part_sn2;
61
62static int
63xpc_setup_partitions_sn_sn2(void)
64{
65 /* nothing needs to be done */
66 return 0;
67}
68
69/* SH_IPI_ACCESS shub register value on startup */
70static u64 xpc_sh1_IPI_access_sn2;
71static u64 xpc_sh2_IPI_access0_sn2;
72static u64 xpc_sh2_IPI_access1_sn2;
73static u64 xpc_sh2_IPI_access2_sn2;
74static u64 xpc_sh2_IPI_access3_sn2;
75
76/*
77 * Change protections to allow IPI operations.
78 */
79static void
80xpc_allow_IPI_ops_sn2(void)
81{
82 int node;
83 int nasid;
84
85 /* !!! The following should get moved into SAL. */
86 if (is_shub2()) {
87 xpc_sh2_IPI_access0_sn2 =
88 (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS0));
89 xpc_sh2_IPI_access1_sn2 =
90 (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS1));
91 xpc_sh2_IPI_access2_sn2 =
92 (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS2));
93 xpc_sh2_IPI_access3_sn2 =
94 (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH2_IPI_ACCESS3));
95
96 for_each_online_node(node) {
97 nasid = cnodeid_to_nasid(node);
98 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
99 -1UL);
100 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
101 -1UL);
102 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
103 -1UL);
104 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
105 -1UL);
106 }
107 } else {
108 xpc_sh1_IPI_access_sn2 =
109 (u64)HUB_L((u64 *)LOCAL_MMR_ADDR(SH1_IPI_ACCESS));
110
111 for_each_online_node(node) {
112 nasid = cnodeid_to_nasid(node);
113 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
114 -1UL);
115 }
116 }
117}
118
119/*
120 * Restrict protections to disallow IPI operations.
121 */
122static void
123xpc_disallow_IPI_ops_sn2(void)
124{
125 int node;
126 int nasid;
127
128 /* !!! The following should get moved into SAL. */
129 if (is_shub2()) {
130 for_each_online_node(node) {
131 nasid = cnodeid_to_nasid(node);
132 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS0),
133 xpc_sh2_IPI_access0_sn2);
134 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS1),
135 xpc_sh2_IPI_access1_sn2);
136 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS2),
137 xpc_sh2_IPI_access2_sn2);
138 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH2_IPI_ACCESS3),
139 xpc_sh2_IPI_access3_sn2);
140 }
141 } else {
142 for_each_online_node(node) {
143 nasid = cnodeid_to_nasid(node);
144 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid, SH1_IPI_ACCESS),
145 xpc_sh1_IPI_access_sn2);
146 }
147 }
148}
149
150/*
151 * The following set of functions are used for the sending and receiving of
152 * IRQs (also known as IPIs). There are two flavors of IRQs, one that is
153 * associated with partition activity (SGI_XPC_ACTIVATE) and the other that
154 * is associated with channel activity (SGI_XPC_NOTIFY).
155 */
156
157static u64
158xpc_receive_IRQ_amo_sn2(struct amo *amo)
159{
160 return FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_CLEAR);
161}
162
163static enum xp_retval
164xpc_send_IRQ_sn2(struct amo *amo, u64 flag, int nasid, int phys_cpuid,
165 int vector)
166{
167 int ret = 0;
168 unsigned long irq_flags;
169
170 local_irq_save(irq_flags);
171
172 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR, flag);
173 sn_send_IPI_phys(nasid, phys_cpuid, vector, 0);
174
175 /*
176 * We must always use the nofault function regardless of whether we
177 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
178 * didn't, we'd never know that the other partition is down and would
179 * keep sending IRQs and amos to it until the heartbeat times out.
180 */
181 ret = xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->variable),
182 xp_nofault_PIOR_target));
183
184 local_irq_restore(irq_flags);
185
186 return (ret == 0) ? xpSuccess : xpPioReadError;
187}
188
189static struct amo *
190xpc_init_IRQ_amo_sn2(int index)
191{
192 struct amo *amo = xpc_vars_sn2->amos_page + index;
193
194 (void)xpc_receive_IRQ_amo_sn2(amo); /* clear amo variable */
195 return amo;
196}
197
198/*
199 * Functions associated with SGI_XPC_ACTIVATE IRQ.
200 */
201
202/*
203 * Notify the heartbeat check thread that an activate IRQ has been received.
204 */
205static irqreturn_t
206xpc_handle_activate_IRQ_sn2(int irq, void *dev_id)
207{
208 unsigned long irq_flags;
209
210 spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
211 xpc_activate_IRQ_rcvd++;
212 spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
213
214 wake_up_interruptible(&xpc_activate_IRQ_wq);
215 return IRQ_HANDLED;
216}
217
218/*
219 * Flag the appropriate amo variable and send an IRQ to the specified node.
220 */
221static void
222xpc_send_activate_IRQ_sn2(unsigned long amos_page_pa, int from_nasid,
223 int to_nasid, int to_phys_cpuid)
224{
225 struct amo *amos = (struct amo *)__va(amos_page_pa +
226 (XPC_ACTIVATE_IRQ_AMOS_SN2 *
227 sizeof(struct amo)));
228
229 (void)xpc_send_IRQ_sn2(&amos[BIT_WORD(from_nasid / 2)],
230 BIT_MASK(from_nasid / 2), to_nasid,
231 to_phys_cpuid, SGI_XPC_ACTIVATE);
232}
233
234static void
235xpc_send_local_activate_IRQ_sn2(int from_nasid)
236{
237 unsigned long irq_flags;
238 struct amo *amos = (struct amo *)__va(xpc_vars_sn2->amos_page_pa +
239 (XPC_ACTIVATE_IRQ_AMOS_SN2 *
240 sizeof(struct amo)));
241
242 /* fake the sending and receipt of an activate IRQ from remote nasid */
243 FETCHOP_STORE_OP(TO_AMO((u64)&amos[BIT_WORD(from_nasid / 2)].variable),
244 FETCHOP_OR, BIT_MASK(from_nasid / 2));
245
246 spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
247 xpc_activate_IRQ_rcvd++;
248 spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
249
250 wake_up_interruptible(&xpc_activate_IRQ_wq);
251}
252
253/*
254 * Functions associated with SGI_XPC_NOTIFY IRQ.
255 */
256
257/*
258 * Check to see if any chctl flags were sent from the specified partition.
259 */
260static void
261xpc_check_for_sent_chctl_flags_sn2(struct xpc_partition *part)
262{
263 union xpc_channel_ctl_flags chctl;
264 unsigned long irq_flags;
265
266 chctl.all_flags = xpc_receive_IRQ_amo_sn2(part->sn.sn2.
267 local_chctl_amo_va);
268 if (chctl.all_flags == 0)
269 return;
270
271 spin_lock_irqsave(&part->chctl_lock, irq_flags);
272 part->chctl.all_flags |= chctl.all_flags;
273 spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
274
275 dev_dbg(xpc_chan, "received notify IRQ from partid=%d, chctl.all_flags="
276 "0x%lx\n", XPC_PARTID(part), chctl.all_flags);
277
278 xpc_wakeup_channel_mgr(part);
279}
280
281/*
282 * Handle the receipt of a SGI_XPC_NOTIFY IRQ by seeing whether the specified
283 * partition actually sent it. Since SGI_XPC_NOTIFY IRQs may be shared by more
284 * than one partition, we use an amo structure per partition to indicate
285 * whether a partition has sent an IRQ or not. If it has, then wake up the
286 * associated kthread to handle it.
287 *
288 * All SGI_XPC_NOTIFY IRQs received by XPC are the result of IRQs sent by XPC
289 * running on other partitions.
290 *
291 * Noteworthy Arguments:
292 *
293 * irq - Interrupt ReQuest number. NOT USED.
294 *
295 * dev_id - partid of IRQ's potential sender.
296 */
297static irqreturn_t
298xpc_handle_notify_IRQ_sn2(int irq, void *dev_id)
299{
300 short partid = (short)(u64)dev_id;
301 struct xpc_partition *part = &xpc_partitions[partid];
302
303 DBUG_ON(partid < 0 || partid >= XP_MAX_NPARTITIONS_SN2);
304
305 if (xpc_part_ref(part)) {
306 xpc_check_for_sent_chctl_flags_sn2(part);
307
308 xpc_part_deref(part);
309 }
310 return IRQ_HANDLED;
311}
312
313/*
314 * Check to see if xpc_handle_notify_IRQ_sn2() dropped any IRQs on the floor
315 * because the write to their associated amo variable completed after the IRQ
316 * was received.
317 */
318static void
319xpc_check_for_dropped_notify_IRQ_sn2(struct xpc_partition *part)
320{
321 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
322
323 if (xpc_part_ref(part)) {
324 xpc_check_for_sent_chctl_flags_sn2(part);
325
326 part_sn2->dropped_notify_IRQ_timer.expires = jiffies +
327 XPC_DROPPED_NOTIFY_IRQ_WAIT_INTERVAL;
328 add_timer(&part_sn2->dropped_notify_IRQ_timer);
329 xpc_part_deref(part);
330 }
331}
332
333/*
334 * Send a notify IRQ to the remote partition that is associated with the
335 * specified channel.
336 */
337static void
338xpc_send_notify_IRQ_sn2(struct xpc_channel *ch, u8 chctl_flag,
339 char *chctl_flag_string, unsigned long *irq_flags)
340{
341 struct xpc_partition *part = &xpc_partitions[ch->partid];
342 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
343 union xpc_channel_ctl_flags chctl = { 0 };
344 enum xp_retval ret;
345
346 if (likely(part->act_state != XPC_P_AS_DEACTIVATING)) {
347 chctl.flags[ch->number] = chctl_flag;
348 ret = xpc_send_IRQ_sn2(part_sn2->remote_chctl_amo_va,
349 chctl.all_flags,
350 part_sn2->notify_IRQ_nasid,
351 part_sn2->notify_IRQ_phys_cpuid,
352 SGI_XPC_NOTIFY);
353 dev_dbg(xpc_chan, "%s sent to partid=%d, channel=%d, ret=%d\n",
354 chctl_flag_string, ch->partid, ch->number, ret);
355 if (unlikely(ret != xpSuccess)) {
356 if (irq_flags != NULL)
357 spin_unlock_irqrestore(&ch->lock, *irq_flags);
358 XPC_DEACTIVATE_PARTITION(part, ret);
359 if (irq_flags != NULL)
360 spin_lock_irqsave(&ch->lock, *irq_flags);
361 }
362 }
363}
364
365#define XPC_SEND_NOTIFY_IRQ_SN2(_ch, _ipi_f, _irq_f) \
366 xpc_send_notify_IRQ_sn2(_ch, _ipi_f, #_ipi_f, _irq_f)
367
368/*
369 * Make it look like the remote partition, which is associated with the
370 * specified channel, sent us a notify IRQ. This faked IRQ will be handled
371 * by xpc_check_for_dropped_notify_IRQ_sn2().
372 */
373static void
374xpc_send_local_notify_IRQ_sn2(struct xpc_channel *ch, u8 chctl_flag,
375 char *chctl_flag_string)
376{
377 struct xpc_partition *part = &xpc_partitions[ch->partid];
378 union xpc_channel_ctl_flags chctl = { 0 };
379
380 chctl.flags[ch->number] = chctl_flag;
381 FETCHOP_STORE_OP(TO_AMO((u64)&part->sn.sn2.local_chctl_amo_va->
382 variable), FETCHOP_OR, chctl.all_flags);
383 dev_dbg(xpc_chan, "%s sent local from partid=%d, channel=%d\n",
384 chctl_flag_string, ch->partid, ch->number);
385}
386
387#define XPC_SEND_LOCAL_NOTIFY_IRQ_SN2(_ch, _ipi_f) \
388 xpc_send_local_notify_IRQ_sn2(_ch, _ipi_f, #_ipi_f)
389
390static void
391xpc_send_chctl_closerequest_sn2(struct xpc_channel *ch,
392 unsigned long *irq_flags)
393{
394 struct xpc_openclose_args *args = ch->sn.sn2.local_openclose_args;
395
396 args->reason = ch->reason;
397 XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_CLOSEREQUEST, irq_flags);
398}
399
400static void
401xpc_send_chctl_closereply_sn2(struct xpc_channel *ch, unsigned long *irq_flags)
402{
403 XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_CLOSEREPLY, irq_flags);
404}
405
406static void
407xpc_send_chctl_openrequest_sn2(struct xpc_channel *ch, unsigned long *irq_flags)
408{
409 struct xpc_openclose_args *args = ch->sn.sn2.local_openclose_args;
410
411 args->entry_size = ch->entry_size;
412 args->local_nentries = ch->local_nentries;
413 XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_OPENREQUEST, irq_flags);
414}
415
416static void
417xpc_send_chctl_openreply_sn2(struct xpc_channel *ch, unsigned long *irq_flags)
418{
419 struct xpc_openclose_args *args = ch->sn.sn2.local_openclose_args;
420
421 args->remote_nentries = ch->remote_nentries;
422 args->local_nentries = ch->local_nentries;
423 args->local_msgqueue_pa = xp_pa(ch->sn.sn2.local_msgqueue);
424 XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_OPENREPLY, irq_flags);
425}
426
427static void
428xpc_send_chctl_msgrequest_sn2(struct xpc_channel *ch)
429{
430 XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_MSGREQUEST, NULL);
431}
432
433static void
434xpc_send_chctl_local_msgrequest_sn2(struct xpc_channel *ch)
435{
436 XPC_SEND_LOCAL_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_MSGREQUEST);
437}
438
439static void
440xpc_save_remote_msgqueue_pa_sn2(struct xpc_channel *ch,
441 unsigned long msgqueue_pa)
442{
443 ch->sn.sn2.remote_msgqueue_pa = msgqueue_pa;
444}
445
446/*
447 * This next set of functions are used to keep track of when a partition is
448 * potentially engaged in accessing memory belonging to another partition.
449 */
450
451static void
452xpc_indicate_partition_engaged_sn2(struct xpc_partition *part)
453{
454 unsigned long irq_flags;
455 struct amo *amo = (struct amo *)__va(part->sn.sn2.remote_amos_page_pa +
456 (XPC_ENGAGED_PARTITIONS_AMO_SN2 *
457 sizeof(struct amo)));
458
459 local_irq_save(irq_flags);
460
461 /* set bit corresponding to our partid in remote partition's amo */
462 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR,
463 BIT(sn_partition_id));
464
465 /*
466 * We must always use the nofault function regardless of whether we
467 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
468 * didn't, we'd never know that the other partition is down and would
469 * keep sending IRQs and amos to it until the heartbeat times out.
470 */
471 (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
472 variable),
473 xp_nofault_PIOR_target));
474
475 local_irq_restore(irq_flags);
476}
477
478static void
479xpc_indicate_partition_disengaged_sn2(struct xpc_partition *part)
480{
481 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
482 unsigned long irq_flags;
483 struct amo *amo = (struct amo *)__va(part_sn2->remote_amos_page_pa +
484 (XPC_ENGAGED_PARTITIONS_AMO_SN2 *
485 sizeof(struct amo)));
486
487 local_irq_save(irq_flags);
488
489 /* clear bit corresponding to our partid in remote partition's amo */
490 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
491 ~BIT(sn_partition_id));
492
493 /*
494 * We must always use the nofault function regardless of whether we
495 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
496 * didn't, we'd never know that the other partition is down and would
497 * keep sending IRQs and amos to it until the heartbeat times out.
498 */
499 (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
500 variable),
501 xp_nofault_PIOR_target));
502
503 local_irq_restore(irq_flags);
504
505 /*
506 * Send activate IRQ to get other side to see that we've cleared our
507 * bit in their engaged partitions amo.
508 */
509 xpc_send_activate_IRQ_sn2(part_sn2->remote_amos_page_pa,
510 cnodeid_to_nasid(0),
511 part_sn2->activate_IRQ_nasid,
512 part_sn2->activate_IRQ_phys_cpuid);
513}
514
515static void
516xpc_assume_partition_disengaged_sn2(short partid)
517{
518 struct amo *amo = xpc_vars_sn2->amos_page +
519 XPC_ENGAGED_PARTITIONS_AMO_SN2;
520
521 /* clear bit(s) based on partid mask in our partition's amo */
522 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
523 ~BIT(partid));
524}
525
526static int
527xpc_partition_engaged_sn2(short partid)
528{
529 struct amo *amo = xpc_vars_sn2->amos_page +
530 XPC_ENGAGED_PARTITIONS_AMO_SN2;
531
532 /* our partition's amo variable ANDed with partid mask */
533 return (FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_LOAD) &
534 BIT(partid)) != 0;
535}
536
537static int
538xpc_any_partition_engaged_sn2(void)
539{
540 struct amo *amo = xpc_vars_sn2->amos_page +
541 XPC_ENGAGED_PARTITIONS_AMO_SN2;
542
543 /* our partition's amo variable */
544 return FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_LOAD) != 0;
545}
546
547/* original protection values for each node */
548static u64 xpc_prot_vec_sn2[MAX_NUMNODES];
549
550/*
551 * Change protections to allow amo operations on non-Shub 1.1 systems.
552 */
553static enum xp_retval
554xpc_allow_amo_ops_sn2(struct amo *amos_page)
555{
556 u64 nasid_array = 0;
557 int ret;
558
559 /*
560 * On SHUB 1.1, we cannot call sn_change_memprotect() since the BIST
561 * collides with memory operations. On those systems we call
562 * xpc_allow_amo_ops_shub_wars_1_1_sn2() instead.
563 */
564 if (!enable_shub_wars_1_1()) {
565 ret = sn_change_memprotect(ia64_tpa((u64)amos_page), PAGE_SIZE,
566 SN_MEMPROT_ACCESS_CLASS_1,
567 &nasid_array);
568 if (ret != 0)
569 return xpSalError;
570 }
571 return xpSuccess;
572}
573
574/*
575 * Change protections to allow amo operations on Shub 1.1 systems.
576 */
577static void
578xpc_allow_amo_ops_shub_wars_1_1_sn2(void)
579{
580 int node;
581 int nasid;
582
583 if (!enable_shub_wars_1_1())
584 return;
585
586 for_each_online_node(node) {
587 nasid = cnodeid_to_nasid(node);
588 /* save current protection values */
589 xpc_prot_vec_sn2[node] =
590 (u64)HUB_L((u64 *)GLOBAL_MMR_ADDR(nasid,
591 SH1_MD_DQLP_MMR_DIR_PRIVEC0));
592 /* open up everything */
593 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
594 SH1_MD_DQLP_MMR_DIR_PRIVEC0),
595 -1UL);
596 HUB_S((u64 *)GLOBAL_MMR_ADDR(nasid,
597 SH1_MD_DQRP_MMR_DIR_PRIVEC0),
598 -1UL);
599 }
600}
601
602static enum xp_retval
603xpc_get_partition_rsvd_page_pa_sn2(void *buf, u64 *cookie, unsigned long *rp_pa,
604 size_t *len)
605{
606 s64 status;
607 enum xp_retval ret;
608
609 status = sn_partition_reserved_page_pa((u64)buf, cookie, rp_pa, len);
610 if (status == SALRET_OK)
611 ret = xpSuccess;
612 else if (status == SALRET_MORE_PASSES)
613 ret = xpNeedMoreInfo;
614 else
615 ret = xpSalError;
616
617 return ret;
618}
619
620
621static int
622xpc_setup_rsvd_page_sn_sn2(struct xpc_rsvd_page *rp)
623{
624 struct amo *amos_page;
625 int i;
626 int ret;
627
628 xpc_vars_sn2 = XPC_RP_VARS(rp);
629
630 rp->sn.vars_pa = xp_pa(xpc_vars_sn2);
631
632 /* vars_part array follows immediately after vars */
633 xpc_vars_part_sn2 = (struct xpc_vars_part_sn2 *)((u8 *)XPC_RP_VARS(rp) +
634 XPC_RP_VARS_SIZE);
635
636 /*
637 * Before clearing xpc_vars_sn2, see if a page of amos had been
638 * previously allocated. If not we'll need to allocate one and set
639 * permissions so that cross-partition amos are allowed.
640 *
641 * The allocated amo page needs MCA reporting to remain disabled after
642 * XPC has unloaded. To make this work, we keep a copy of the pointer
643 * to this page (i.e., amos_page) in the struct xpc_vars_sn2 structure,
644 * which is pointed to by the reserved page, and re-use that saved copy
645 * on subsequent loads of XPC. This amo page is never freed, and its
646 * memory protections are never restricted.
647 */
648 amos_page = xpc_vars_sn2->amos_page;
649 if (amos_page == NULL) {
650 amos_page = (struct amo *)TO_AMO(uncached_alloc_page(0, 1));
651 if (amos_page == NULL) {
652 dev_err(xpc_part, "can't allocate page of amos\n");
653 return -ENOMEM;
654 }
655
656 /*
657 * Open up amo-R/W to cpu. This is done on Shub 1.1 systems
658 * when xpc_allow_amo_ops_shub_wars_1_1_sn2() is called.
659 */
660 ret = xpc_allow_amo_ops_sn2(amos_page);
661 if (ret != xpSuccess) {
662 dev_err(xpc_part, "can't allow amo operations\n");
663 uncached_free_page(__IA64_UNCACHED_OFFSET |
664 TO_PHYS((u64)amos_page), 1);
665 return -EPERM;
666 }
667 }
668
669 /* clear xpc_vars_sn2 */
670 memset(xpc_vars_sn2, 0, sizeof(struct xpc_vars_sn2));
671
672 xpc_vars_sn2->version = XPC_V_VERSION;
673 xpc_vars_sn2->activate_IRQ_nasid = cpuid_to_nasid(0);
674 xpc_vars_sn2->activate_IRQ_phys_cpuid = cpu_physical_id(0);
675 xpc_vars_sn2->vars_part_pa = xp_pa(xpc_vars_part_sn2);
676 xpc_vars_sn2->amos_page_pa = ia64_tpa((u64)amos_page);
677 xpc_vars_sn2->amos_page = amos_page; /* save for next load of XPC */
678
679 /* clear xpc_vars_part_sn2 */
680 memset((u64 *)xpc_vars_part_sn2, 0, sizeof(struct xpc_vars_part_sn2) *
681 XP_MAX_NPARTITIONS_SN2);
682
683 /* initialize the activate IRQ related amo variables */
684 for (i = 0; i < xpc_nasid_mask_nlongs; i++)
685 (void)xpc_init_IRQ_amo_sn2(XPC_ACTIVATE_IRQ_AMOS_SN2 + i);
686
687 /* initialize the engaged remote partitions related amo variables */
688 (void)xpc_init_IRQ_amo_sn2(XPC_ENGAGED_PARTITIONS_AMO_SN2);
689 (void)xpc_init_IRQ_amo_sn2(XPC_DEACTIVATE_REQUEST_AMO_SN2);
690
691 return 0;
692}
693
694static void
695xpc_increment_heartbeat_sn2(void)
696{
697 xpc_vars_sn2->heartbeat++;
698}
699
700static void
701xpc_offline_heartbeat_sn2(void)
702{
703 xpc_increment_heartbeat_sn2();
704 xpc_vars_sn2->heartbeat_offline = 1;
705}
706
707static void
708xpc_online_heartbeat_sn2(void)
709{
710 xpc_increment_heartbeat_sn2();
711 xpc_vars_sn2->heartbeat_offline = 0;
712}
713
714static void
715xpc_heartbeat_init_sn2(void)
716{
717 DBUG_ON(xpc_vars_sn2 == NULL);
718
719 bitmap_zero(xpc_vars_sn2->heartbeating_to_mask, XP_MAX_NPARTITIONS_SN2);
720 xpc_heartbeating_to_mask = &xpc_vars_sn2->heartbeating_to_mask[0];
721 xpc_online_heartbeat_sn2();
722}
723
724static void
725xpc_heartbeat_exit_sn2(void)
726{
727 xpc_offline_heartbeat_sn2();
728}
729
730static enum xp_retval
731xpc_get_remote_heartbeat_sn2(struct xpc_partition *part)
732{
733 struct xpc_vars_sn2 *remote_vars;
734 enum xp_retval ret;
735
736 remote_vars = (struct xpc_vars_sn2 *)xpc_remote_copy_buffer_sn2;
737
738 /* pull the remote vars structure that contains the heartbeat */
739 ret = xp_remote_memcpy(xp_pa(remote_vars),
740 part->sn.sn2.remote_vars_pa,
741 XPC_RP_VARS_SIZE);
742 if (ret != xpSuccess)
743 return ret;
744
745 dev_dbg(xpc_part, "partid=%d, heartbeat=%ld, last_heartbeat=%ld, "
746 "heartbeat_offline=%ld, HB_mask[0]=0x%lx\n", XPC_PARTID(part),
747 remote_vars->heartbeat, part->last_heartbeat,
748 remote_vars->heartbeat_offline,
749 remote_vars->heartbeating_to_mask[0]);
750
751 if ((remote_vars->heartbeat == part->last_heartbeat &&
752 remote_vars->heartbeat_offline == 0) ||
753 !xpc_hb_allowed(sn_partition_id,
754 &remote_vars->heartbeating_to_mask)) {
755 ret = xpNoHeartbeat;
756 } else {
757 part->last_heartbeat = remote_vars->heartbeat;
758 }
759
760 return ret;
761}
762
763/*
764 * Get a copy of the remote partition's XPC variables from the reserved page.
765 *
766 * remote_vars points to a buffer that is cacheline aligned for BTE copies and
767 * assumed to be of size XPC_RP_VARS_SIZE.
768 */
769static enum xp_retval
770xpc_get_remote_vars_sn2(unsigned long remote_vars_pa,
771 struct xpc_vars_sn2 *remote_vars)
772{
773 enum xp_retval ret;
774
775 if (remote_vars_pa == 0)
776 return xpVarsNotSet;
777
778 /* pull over the cross partition variables */
779 ret = xp_remote_memcpy(xp_pa(remote_vars), remote_vars_pa,
780 XPC_RP_VARS_SIZE);
781 if (ret != xpSuccess)
782 return ret;
783
784 if (XPC_VERSION_MAJOR(remote_vars->version) !=
785 XPC_VERSION_MAJOR(XPC_V_VERSION)) {
786 return xpBadVersion;
787 }
788
789 return xpSuccess;
790}
791
792static void
793xpc_request_partition_activation_sn2(struct xpc_rsvd_page *remote_rp,
794 unsigned long remote_rp_pa, int nasid)
795{
796 xpc_send_local_activate_IRQ_sn2(nasid);
797}
798
799static void
800xpc_request_partition_reactivation_sn2(struct xpc_partition *part)
801{
802 xpc_send_local_activate_IRQ_sn2(part->sn.sn2.activate_IRQ_nasid);
803}
804
805static void
806xpc_request_partition_deactivation_sn2(struct xpc_partition *part)
807{
808 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
809 unsigned long irq_flags;
810 struct amo *amo = (struct amo *)__va(part_sn2->remote_amos_page_pa +
811 (XPC_DEACTIVATE_REQUEST_AMO_SN2 *
812 sizeof(struct amo)));
813
814 local_irq_save(irq_flags);
815
816 /* set bit corresponding to our partid in remote partition's amo */
817 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_OR,
818 BIT(sn_partition_id));
819
820 /*
821 * We must always use the nofault function regardless of whether we
822 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
823 * didn't, we'd never know that the other partition is down and would
824 * keep sending IRQs and amos to it until the heartbeat times out.
825 */
826 (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
827 variable),
828 xp_nofault_PIOR_target));
829
830 local_irq_restore(irq_flags);
831
832 /*
833 * Send activate IRQ to get other side to see that we've set our
834 * bit in their deactivate request amo.
835 */
836 xpc_send_activate_IRQ_sn2(part_sn2->remote_amos_page_pa,
837 cnodeid_to_nasid(0),
838 part_sn2->activate_IRQ_nasid,
839 part_sn2->activate_IRQ_phys_cpuid);
840}
841
842static void
843xpc_cancel_partition_deactivation_request_sn2(struct xpc_partition *part)
844{
845 unsigned long irq_flags;
846 struct amo *amo = (struct amo *)__va(part->sn.sn2.remote_amos_page_pa +
847 (XPC_DEACTIVATE_REQUEST_AMO_SN2 *
848 sizeof(struct amo)));
849
850 local_irq_save(irq_flags);
851
852 /* clear bit corresponding to our partid in remote partition's amo */
853 FETCHOP_STORE_OP(TO_AMO((u64)&amo->variable), FETCHOP_AND,
854 ~BIT(sn_partition_id));
855
856 /*
857 * We must always use the nofault function regardless of whether we
858 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
859 * didn't, we'd never know that the other partition is down and would
860 * keep sending IRQs and amos to it until the heartbeat times out.
861 */
862 (void)xp_nofault_PIOR((u64 *)GLOBAL_MMR_ADDR(NASID_GET(&amo->
863 variable),
864 xp_nofault_PIOR_target));
865
866 local_irq_restore(irq_flags);
867}
868
869static int
870xpc_partition_deactivation_requested_sn2(short partid)
871{
872 struct amo *amo = xpc_vars_sn2->amos_page +
873 XPC_DEACTIVATE_REQUEST_AMO_SN2;
874
875 /* our partition's amo variable ANDed with partid mask */
876 return (FETCHOP_LOAD_OP(TO_AMO((u64)&amo->variable), FETCHOP_LOAD) &
877 BIT(partid)) != 0;
878}
879
880/*
881 * Update the remote partition's info.
882 */
883static void
884xpc_update_partition_info_sn2(struct xpc_partition *part, u8 remote_rp_version,
885 unsigned long *remote_rp_ts_jiffies,
886 unsigned long remote_rp_pa,
887 unsigned long remote_vars_pa,
888 struct xpc_vars_sn2 *remote_vars)
889{
890 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
891
892 part->remote_rp_version = remote_rp_version;
893 dev_dbg(xpc_part, " remote_rp_version = 0x%016x\n",
894 part->remote_rp_version);
895
896 part->remote_rp_ts_jiffies = *remote_rp_ts_jiffies;
897 dev_dbg(xpc_part, " remote_rp_ts_jiffies = 0x%016lx\n",
898 part->remote_rp_ts_jiffies);
899
900 part->remote_rp_pa = remote_rp_pa;
901 dev_dbg(xpc_part, " remote_rp_pa = 0x%016lx\n", part->remote_rp_pa);
902
903 part_sn2->remote_vars_pa = remote_vars_pa;
904 dev_dbg(xpc_part, " remote_vars_pa = 0x%016lx\n",
905 part_sn2->remote_vars_pa);
906
907 part->last_heartbeat = remote_vars->heartbeat;
908 dev_dbg(xpc_part, " last_heartbeat = 0x%016lx\n",
909 part->last_heartbeat);
910
911 part_sn2->remote_vars_part_pa = remote_vars->vars_part_pa;
912 dev_dbg(xpc_part, " remote_vars_part_pa = 0x%016lx\n",
913 part_sn2->remote_vars_part_pa);
914
915 part_sn2->activate_IRQ_nasid = remote_vars->activate_IRQ_nasid;
916 dev_dbg(xpc_part, " activate_IRQ_nasid = 0x%x\n",
917 part_sn2->activate_IRQ_nasid);
918
919 part_sn2->activate_IRQ_phys_cpuid =
920 remote_vars->activate_IRQ_phys_cpuid;
921 dev_dbg(xpc_part, " activate_IRQ_phys_cpuid = 0x%x\n",
922 part_sn2->activate_IRQ_phys_cpuid);
923
924 part_sn2->remote_amos_page_pa = remote_vars->amos_page_pa;
925 dev_dbg(xpc_part, " remote_amos_page_pa = 0x%lx\n",
926 part_sn2->remote_amos_page_pa);
927
928 part_sn2->remote_vars_version = remote_vars->version;
929 dev_dbg(xpc_part, " remote_vars_version = 0x%x\n",
930 part_sn2->remote_vars_version);
931}
932
933/*
934 * Prior code has determined the nasid which generated a activate IRQ.
935 * Inspect that nasid to determine if its partition needs to be activated
936 * or deactivated.
937 *
938 * A partition is considered "awaiting activation" if our partition
939 * flags indicate it is not active and it has a heartbeat. A
940 * partition is considered "awaiting deactivation" if our partition
941 * flags indicate it is active but it has no heartbeat or it is not
942 * sending its heartbeat to us.
943 *
944 * To determine the heartbeat, the remote nasid must have a properly
945 * initialized reserved page.
946 */
947static void
948xpc_identify_activate_IRQ_req_sn2(int nasid)
949{
950 struct xpc_rsvd_page *remote_rp;
951 struct xpc_vars_sn2 *remote_vars;
952 unsigned long remote_rp_pa;
953 unsigned long remote_vars_pa;
954 int remote_rp_version;
955 int reactivate = 0;
956 unsigned long remote_rp_ts_jiffies = 0;
957 short partid;
958 struct xpc_partition *part;
959 struct xpc_partition_sn2 *part_sn2;
960 enum xp_retval ret;
961
962 /* pull over the reserved page structure */
963
964 remote_rp = (struct xpc_rsvd_page *)xpc_remote_copy_buffer_sn2;
965
966 ret = xpc_get_remote_rp(nasid, NULL, remote_rp, &remote_rp_pa);
967 if (ret != xpSuccess) {
968 dev_warn(xpc_part, "unable to get reserved page from nasid %d, "
969 "which sent interrupt, reason=%d\n", nasid, ret);
970 return;
971 }
972
973 remote_vars_pa = remote_rp->sn.vars_pa;
974 remote_rp_version = remote_rp->version;
975 remote_rp_ts_jiffies = remote_rp->ts_jiffies;
976
977 partid = remote_rp->SAL_partid;
978 part = &xpc_partitions[partid];
979 part_sn2 = &part->sn.sn2;
980
981 /* pull over the cross partition variables */
982
983 remote_vars = (struct xpc_vars_sn2 *)xpc_remote_copy_buffer_sn2;
984
985 ret = xpc_get_remote_vars_sn2(remote_vars_pa, remote_vars);
986 if (ret != xpSuccess) {
987 dev_warn(xpc_part, "unable to get XPC variables from nasid %d, "
988 "which sent interrupt, reason=%d\n", nasid, ret);
989
990 XPC_DEACTIVATE_PARTITION(part, ret);
991 return;
992 }
993
994 part->activate_IRQ_rcvd++;
995
996 dev_dbg(xpc_part, "partid for nasid %d is %d; IRQs = %d; HB = "
997 "%ld:0x%lx\n", (int)nasid, (int)partid, part->activate_IRQ_rcvd,
998 remote_vars->heartbeat, remote_vars->heartbeating_to_mask[0]);
999
1000 if (xpc_partition_disengaged(part) &&
1001 part->act_state == XPC_P_AS_INACTIVE) {
1002
1003 xpc_update_partition_info_sn2(part, remote_rp_version,
1004 &remote_rp_ts_jiffies,
1005 remote_rp_pa, remote_vars_pa,
1006 remote_vars);
1007
1008 if (xpc_partition_deactivation_requested_sn2(partid)) {
1009 /*
1010 * Other side is waiting on us to deactivate even though
1011 * we already have.
1012 */
1013 return;
1014 }
1015
1016 xpc_activate_partition(part);
1017 return;
1018 }
1019
1020 DBUG_ON(part->remote_rp_version == 0);
1021 DBUG_ON(part_sn2->remote_vars_version == 0);
1022
1023 if (remote_rp_ts_jiffies != part->remote_rp_ts_jiffies) {
1024
1025 /* the other side rebooted */
1026
1027 DBUG_ON(xpc_partition_engaged_sn2(partid));
1028 DBUG_ON(xpc_partition_deactivation_requested_sn2(partid));
1029
1030 xpc_update_partition_info_sn2(part, remote_rp_version,
1031 &remote_rp_ts_jiffies,
1032 remote_rp_pa, remote_vars_pa,
1033 remote_vars);
1034 reactivate = 1;
1035 }
1036
1037 if (part->disengage_timeout > 0 && !xpc_partition_disengaged(part)) {
1038 /* still waiting on other side to disengage from us */
1039 return;
1040 }
1041
1042 if (reactivate)
1043 XPC_DEACTIVATE_PARTITION(part, xpReactivating);
1044 else if (xpc_partition_deactivation_requested_sn2(partid))
1045 XPC_DEACTIVATE_PARTITION(part, xpOtherGoingDown);
1046}
1047
1048/*
1049 * Loop through the activation amo variables and process any bits
1050 * which are set. Each bit indicates a nasid sending a partition
1051 * activation or deactivation request.
1052 *
1053 * Return #of IRQs detected.
1054 */
1055int
1056xpc_identify_activate_IRQ_sender_sn2(void)
1057{
1058 int l;
1059 int b;
1060 unsigned long nasid_mask_long;
1061 u64 nasid; /* remote nasid */
1062 int n_IRQs_detected = 0;
1063 struct amo *act_amos;
1064
1065 act_amos = xpc_vars_sn2->amos_page + XPC_ACTIVATE_IRQ_AMOS_SN2;
1066
1067 /* scan through activate amo variables looking for non-zero entries */
1068 for (l = 0; l < xpc_nasid_mask_nlongs; l++) {
1069
1070 if (xpc_exiting)
1071 break;
1072
1073 nasid_mask_long = xpc_receive_IRQ_amo_sn2(&act_amos[l]);
1074
1075 b = find_first_bit(&nasid_mask_long, BITS_PER_LONG);
1076 if (b >= BITS_PER_LONG) {
1077 /* no IRQs from nasids in this amo variable */
1078 continue;
1079 }
1080
1081 dev_dbg(xpc_part, "amo[%d] gave back 0x%lx\n", l,
1082 nasid_mask_long);
1083
1084 /*
1085 * If this nasid has been added to the machine since
1086 * our partition was reset, this will retain the
1087 * remote nasid in our reserved pages machine mask.
1088 * This is used in the event of module reload.
1089 */
1090 xpc_mach_nasids[l] |= nasid_mask_long;
1091
1092 /* locate the nasid(s) which sent interrupts */
1093
1094 do {
1095 n_IRQs_detected++;
1096 nasid = (l * BITS_PER_LONG + b) * 2;
1097 dev_dbg(xpc_part, "interrupt from nasid %ld\n", nasid);
1098 xpc_identify_activate_IRQ_req_sn2(nasid);
1099
1100 b = find_next_bit(&nasid_mask_long, BITS_PER_LONG,
1101 b + 1);
1102 } while (b < BITS_PER_LONG);
1103 }
1104 return n_IRQs_detected;
1105}
1106
1107static void
1108xpc_process_activate_IRQ_rcvd_sn2(void)
1109{
1110 unsigned long irq_flags;
1111 int n_IRQs_expected;
1112 int n_IRQs_detected;
1113
1114 DBUG_ON(xpc_activate_IRQ_rcvd == 0);
1115
1116 spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
1117 n_IRQs_expected = xpc_activate_IRQ_rcvd;
1118 xpc_activate_IRQ_rcvd = 0;
1119 spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
1120
1121 n_IRQs_detected = xpc_identify_activate_IRQ_sender_sn2();
1122 if (n_IRQs_detected < n_IRQs_expected) {
1123 /* retry once to help avoid missing amo */
1124 (void)xpc_identify_activate_IRQ_sender_sn2();
1125 }
1126}
1127
1128/*
1129 * Setup the channel structures that are sn2 specific.
1130 */
1131static enum xp_retval
1132xpc_setup_ch_structures_sn_sn2(struct xpc_partition *part)
1133{
1134 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
1135 struct xpc_channel_sn2 *ch_sn2;
1136 enum xp_retval retval;
1137 int ret;
1138 int cpuid;
1139 int ch_number;
1140 struct timer_list *timer;
1141 short partid = XPC_PARTID(part);
1142
1143 /* allocate all the required GET/PUT values */
1144
1145 part_sn2->local_GPs =
1146 xpc_kzalloc_cacheline_aligned(XPC_GP_SIZE, GFP_KERNEL,
1147 &part_sn2->local_GPs_base);
1148 if (part_sn2->local_GPs == NULL) {
1149 dev_err(xpc_chan, "can't get memory for local get/put "
1150 "values\n");
1151 return xpNoMemory;
1152 }
1153
1154 part_sn2->remote_GPs =
1155 xpc_kzalloc_cacheline_aligned(XPC_GP_SIZE, GFP_KERNEL,
1156 &part_sn2->remote_GPs_base);
1157 if (part_sn2->remote_GPs == NULL) {
1158 dev_err(xpc_chan, "can't get memory for remote get/put "
1159 "values\n");
1160 retval = xpNoMemory;
1161 goto out_1;
1162 }
1163
1164 part_sn2->remote_GPs_pa = 0;
1165
1166 /* allocate all the required open and close args */
1167
1168 part_sn2->local_openclose_args =
1169 xpc_kzalloc_cacheline_aligned(XPC_OPENCLOSE_ARGS_SIZE,
1170 GFP_KERNEL, &part_sn2->
1171 local_openclose_args_base);
1172 if (part_sn2->local_openclose_args == NULL) {
1173 dev_err(xpc_chan, "can't get memory for local connect args\n");
1174 retval = xpNoMemory;
1175 goto out_2;
1176 }
1177
1178 part_sn2->remote_openclose_args_pa = 0;
1179
1180 part_sn2->local_chctl_amo_va = xpc_init_IRQ_amo_sn2(partid);
1181
1182 part_sn2->notify_IRQ_nasid = 0;
1183 part_sn2->notify_IRQ_phys_cpuid = 0;
1184 part_sn2->remote_chctl_amo_va = NULL;
1185
1186 sprintf(part_sn2->notify_IRQ_owner, "xpc%02d", partid);
1187 ret = request_irq(SGI_XPC_NOTIFY, xpc_handle_notify_IRQ_sn2,
1188 IRQF_SHARED, part_sn2->notify_IRQ_owner,
1189 (void *)(u64)partid);
1190 if (ret != 0) {
1191 dev_err(xpc_chan, "can't register NOTIFY IRQ handler, "
1192 "errno=%d\n", -ret);
1193 retval = xpLackOfResources;
1194 goto out_3;
1195 }
1196
1197 /* Setup a timer to check for dropped notify IRQs */
1198 timer = &part_sn2->dropped_notify_IRQ_timer;
1199 init_timer(timer);
1200 timer->function =
1201 (void (*)(unsigned long))xpc_check_for_dropped_notify_IRQ_sn2;
1202 timer->data = (unsigned long)part;
1203 timer->expires = jiffies + XPC_DROPPED_NOTIFY_IRQ_WAIT_INTERVAL;
1204 add_timer(timer);
1205
1206 for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
1207 ch_sn2 = &part->channels[ch_number].sn.sn2;
1208
1209 ch_sn2->local_GP = &part_sn2->local_GPs[ch_number];
1210 ch_sn2->local_openclose_args =
1211 &part_sn2->local_openclose_args[ch_number];
1212
1213 mutex_init(&ch_sn2->msg_to_pull_mutex);
1214 }
1215
1216 /*
1217 * Setup the per partition specific variables required by the
1218 * remote partition to establish channel connections with us.
1219 *
1220 * The setting of the magic # indicates that these per partition
1221 * specific variables are ready to be used.
1222 */
1223 xpc_vars_part_sn2[partid].GPs_pa = xp_pa(part_sn2->local_GPs);
1224 xpc_vars_part_sn2[partid].openclose_args_pa =
1225 xp_pa(part_sn2->local_openclose_args);
1226 xpc_vars_part_sn2[partid].chctl_amo_pa =
1227 xp_pa(part_sn2->local_chctl_amo_va);
1228 cpuid = raw_smp_processor_id(); /* any CPU in this partition will do */
1229 xpc_vars_part_sn2[partid].notify_IRQ_nasid = cpuid_to_nasid(cpuid);
1230 xpc_vars_part_sn2[partid].notify_IRQ_phys_cpuid =
1231 cpu_physical_id(cpuid);
1232 xpc_vars_part_sn2[partid].nchannels = part->nchannels;
1233 xpc_vars_part_sn2[partid].magic = XPC_VP_MAGIC1_SN2;
1234
1235 return xpSuccess;
1236
1237 /* setup of ch structures failed */
1238out_3:
1239 kfree(part_sn2->local_openclose_args_base);
1240 part_sn2->local_openclose_args = NULL;
1241out_2:
1242 kfree(part_sn2->remote_GPs_base);
1243 part_sn2->remote_GPs = NULL;
1244out_1:
1245 kfree(part_sn2->local_GPs_base);
1246 part_sn2->local_GPs = NULL;
1247 return retval;
1248}
1249
1250/*
1251 * Teardown the channel structures that are sn2 specific.
1252 */
1253static void
1254xpc_teardown_ch_structures_sn_sn2(struct xpc_partition *part)
1255{
1256 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
1257 short partid = XPC_PARTID(part);
1258
1259 /*
1260 * Indicate that the variables specific to the remote partition are no
1261 * longer available for its use.
1262 */
1263 xpc_vars_part_sn2[partid].magic = 0;
1264
1265 /* in case we've still got outstanding timers registered... */
1266 del_timer_sync(&part_sn2->dropped_notify_IRQ_timer);
1267 free_irq(SGI_XPC_NOTIFY, (void *)(u64)partid);
1268
1269 kfree(part_sn2->local_openclose_args_base);
1270 part_sn2->local_openclose_args = NULL;
1271 kfree(part_sn2->remote_GPs_base);
1272 part_sn2->remote_GPs = NULL;
1273 kfree(part_sn2->local_GPs_base);
1274 part_sn2->local_GPs = NULL;
1275 part_sn2->local_chctl_amo_va = NULL;
1276}
1277
1278/*
1279 * Create a wrapper that hides the underlying mechanism for pulling a cacheline
1280 * (or multiple cachelines) from a remote partition.
1281 *
1282 * src_pa must be a cacheline aligned physical address on the remote partition.
1283 * dst must be a cacheline aligned virtual address on this partition.
1284 * cnt must be cacheline sized
1285 */
1286/* ??? Replace this function by call to xp_remote_memcpy() or bte_copy()? */
1287static enum xp_retval
1288xpc_pull_remote_cachelines_sn2(struct xpc_partition *part, void *dst,
1289 const unsigned long src_pa, size_t cnt)
1290{
1291 enum xp_retval ret;
1292
1293 DBUG_ON(src_pa != L1_CACHE_ALIGN(src_pa));
1294 DBUG_ON((unsigned long)dst != L1_CACHE_ALIGN((unsigned long)dst));
1295 DBUG_ON(cnt != L1_CACHE_ALIGN(cnt));
1296
1297 if (part->act_state == XPC_P_AS_DEACTIVATING)
1298 return part->reason;
1299
1300 ret = xp_remote_memcpy(xp_pa(dst), src_pa, cnt);
1301 if (ret != xpSuccess) {
1302 dev_dbg(xpc_chan, "xp_remote_memcpy() from partition %d failed,"
1303 " ret=%d\n", XPC_PARTID(part), ret);
1304 }
1305 return ret;
1306}
1307
1308/*
1309 * Pull the remote per partition specific variables from the specified
1310 * partition.
1311 */
1312static enum xp_retval
1313xpc_pull_remote_vars_part_sn2(struct xpc_partition *part)
1314{
1315 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
1316 u8 buffer[L1_CACHE_BYTES * 2];
1317 struct xpc_vars_part_sn2 *pulled_entry_cacheline =
1318 (struct xpc_vars_part_sn2 *)L1_CACHE_ALIGN((u64)buffer);
1319 struct xpc_vars_part_sn2 *pulled_entry;
1320 unsigned long remote_entry_cacheline_pa;
1321 unsigned long remote_entry_pa;
1322 short partid = XPC_PARTID(part);
1323 enum xp_retval ret;
1324
1325 /* pull the cacheline that contains the variables we're interested in */
1326
1327 DBUG_ON(part_sn2->remote_vars_part_pa !=
1328 L1_CACHE_ALIGN(part_sn2->remote_vars_part_pa));
1329 DBUG_ON(sizeof(struct xpc_vars_part_sn2) != L1_CACHE_BYTES / 2);
1330
1331 remote_entry_pa = part_sn2->remote_vars_part_pa +
1332 sn_partition_id * sizeof(struct xpc_vars_part_sn2);
1333
1334 remote_entry_cacheline_pa = (remote_entry_pa & ~(L1_CACHE_BYTES - 1));
1335
1336 pulled_entry = (struct xpc_vars_part_sn2 *)((u64)pulled_entry_cacheline
1337 + (remote_entry_pa &
1338 (L1_CACHE_BYTES - 1)));
1339
1340 ret = xpc_pull_remote_cachelines_sn2(part, pulled_entry_cacheline,
1341 remote_entry_cacheline_pa,
1342 L1_CACHE_BYTES);
1343 if (ret != xpSuccess) {
1344 dev_dbg(xpc_chan, "failed to pull XPC vars_part from "
1345 "partition %d, ret=%d\n", partid, ret);
1346 return ret;
1347 }
1348
1349 /* see if they've been set up yet */
1350
1351 if (pulled_entry->magic != XPC_VP_MAGIC1_SN2 &&
1352 pulled_entry->magic != XPC_VP_MAGIC2_SN2) {
1353
1354 if (pulled_entry->magic != 0) {
1355 dev_dbg(xpc_chan, "partition %d's XPC vars_part for "
1356 "partition %d has bad magic value (=0x%lx)\n",
1357 partid, sn_partition_id, pulled_entry->magic);
1358 return xpBadMagic;
1359 }
1360
1361 /* they've not been initialized yet */
1362 return xpRetry;
1363 }
1364
1365 if (xpc_vars_part_sn2[partid].magic == XPC_VP_MAGIC1_SN2) {
1366
1367 /* validate the variables */
1368
1369 if (pulled_entry->GPs_pa == 0 ||
1370 pulled_entry->openclose_args_pa == 0 ||
1371 pulled_entry->chctl_amo_pa == 0) {
1372
1373 dev_err(xpc_chan, "partition %d's XPC vars_part for "
1374 "partition %d are not valid\n", partid,
1375 sn_partition_id);
1376 return xpInvalidAddress;
1377 }
1378
1379 /* the variables we imported look to be valid */
1380
1381 part_sn2->remote_GPs_pa = pulled_entry->GPs_pa;
1382 part_sn2->remote_openclose_args_pa =
1383 pulled_entry->openclose_args_pa;
1384 part_sn2->remote_chctl_amo_va =
1385 (struct amo *)__va(pulled_entry->chctl_amo_pa);
1386 part_sn2->notify_IRQ_nasid = pulled_entry->notify_IRQ_nasid;
1387 part_sn2->notify_IRQ_phys_cpuid =
1388 pulled_entry->notify_IRQ_phys_cpuid;
1389
1390 if (part->nchannels > pulled_entry->nchannels)
1391 part->nchannels = pulled_entry->nchannels;
1392
1393 /* let the other side know that we've pulled their variables */
1394
1395 xpc_vars_part_sn2[partid].magic = XPC_VP_MAGIC2_SN2;
1396 }
1397
1398 if (pulled_entry->magic == XPC_VP_MAGIC1_SN2)
1399 return xpRetry;
1400
1401 return xpSuccess;
1402}
1403
1404/*
1405 * Establish first contact with the remote partititon. This involves pulling
1406 * the XPC per partition variables from the remote partition and waiting for
1407 * the remote partition to pull ours.
1408 */
1409static enum xp_retval
1410xpc_make_first_contact_sn2(struct xpc_partition *part)
1411{
1412 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
1413 enum xp_retval ret;
1414
1415 /*
1416 * Register the remote partition's amos with SAL so it can handle
1417 * and cleanup errors within that address range should the remote
1418 * partition go down. We don't unregister this range because it is
1419 * difficult to tell when outstanding writes to the remote partition
1420 * are finished and thus when it is safe to unregister. This should
1421 * not result in wasted space in the SAL xp_addr_region table because
1422 * we should get the same page for remote_amos_page_pa after module
1423 * reloads and system reboots.
1424 */
1425 if (sn_register_xp_addr_region(part_sn2->remote_amos_page_pa,
1426 PAGE_SIZE, 1) < 0) {
1427 dev_warn(xpc_part, "xpc_activating(%d) failed to register "
1428 "xp_addr region\n", XPC_PARTID(part));
1429
1430 ret = xpPhysAddrRegFailed;
1431 XPC_DEACTIVATE_PARTITION(part, ret);
1432 return ret;
1433 }
1434
1435 /*
1436 * Send activate IRQ to get other side to activate if they've not
1437 * already begun to do so.
1438 */
1439 xpc_send_activate_IRQ_sn2(part_sn2->remote_amos_page_pa,
1440 cnodeid_to_nasid(0),
1441 part_sn2->activate_IRQ_nasid,
1442 part_sn2->activate_IRQ_phys_cpuid);
1443
1444 while ((ret = xpc_pull_remote_vars_part_sn2(part)) != xpSuccess) {
1445 if (ret != xpRetry) {
1446 XPC_DEACTIVATE_PARTITION(part, ret);
1447 return ret;
1448 }
1449
1450 dev_dbg(xpc_part, "waiting to make first contact with "
1451 "partition %d\n", XPC_PARTID(part));
1452
1453 /* wait a 1/4 of a second or so */
1454 (void)msleep_interruptible(250);
1455
1456 if (part->act_state == XPC_P_AS_DEACTIVATING)
1457 return part->reason;
1458 }
1459
1460 return xpSuccess;
1461}
1462
1463/*
1464 * Get the chctl flags and pull the openclose args and/or remote GPs as needed.
1465 */
1466static u64
1467xpc_get_chctl_all_flags_sn2(struct xpc_partition *part)
1468{
1469 struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2;
1470 unsigned long irq_flags;
1471 union xpc_channel_ctl_flags chctl;
1472 enum xp_retval ret;
1473
1474 /*
1475 * See if there are any chctl flags to be handled.
1476 */
1477
1478 spin_lock_irqsave(&part->chctl_lock, irq_flags);
1479 chctl = part->chctl;
1480 if (chctl.all_flags != 0)
1481 part->chctl.all_flags = 0;
1482
1483 spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
1484
1485 if (xpc_any_openclose_chctl_flags_set(&chctl)) {
1486 ret = xpc_pull_remote_cachelines_sn2(part, part->
1487 remote_openclose_args,
1488 part_sn2->
1489 remote_openclose_args_pa,
1490 XPC_OPENCLOSE_ARGS_SIZE);
1491 if (ret != xpSuccess) {
1492 XPC_DEACTIVATE_PARTITION(part, ret);
1493
1494 dev_dbg(xpc_chan, "failed to pull openclose args from "
1495 "partition %d, ret=%d\n", XPC_PARTID(part),
1496 ret);
1497
1498 /* don't bother processing chctl flags anymore */
1499 chctl.all_flags = 0;
1500 }
1501 }
1502
1503 if (xpc_any_msg_chctl_flags_set(&chctl)) {
1504 ret = xpc_pull_remote_cachelines_sn2(part, part_sn2->remote_GPs,
1505 part_sn2->remote_GPs_pa,
1506 XPC_GP_SIZE);
1507 if (ret != xpSuccess) {
1508 XPC_DEACTIVATE_PARTITION(part, ret);
1509
1510 dev_dbg(xpc_chan, "failed to pull GPs from partition "
1511 "%d, ret=%d\n", XPC_PARTID(part), ret);
1512
1513 /* don't bother processing chctl flags anymore */
1514 chctl.all_flags = 0;
1515 }
1516 }
1517
1518 return chctl.all_flags;
1519}
1520
1521/*
1522 * Allocate the local message queue and the notify queue.
1523 */
1524static enum xp_retval
1525xpc_allocate_local_msgqueue_sn2(struct xpc_channel *ch)
1526{
1527 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
1528 unsigned long irq_flags;
1529 int nentries;
1530 size_t nbytes;
1531
1532 for (nentries = ch->local_nentries; nentries > 0; nentries--) {
1533
1534 nbytes = nentries * ch->entry_size;
1535 ch_sn2->local_msgqueue =
1536 xpc_kzalloc_cacheline_aligned(nbytes, GFP_KERNEL,
1537 &ch_sn2->local_msgqueue_base);
1538 if (ch_sn2->local_msgqueue == NULL)
1539 continue;
1540
1541 nbytes = nentries * sizeof(struct xpc_notify_sn2);
1542 ch_sn2->notify_queue = kzalloc(nbytes, GFP_KERNEL);
1543 if (ch_sn2->notify_queue == NULL) {
1544 kfree(ch_sn2->local_msgqueue_base);
1545 ch_sn2->local_msgqueue = NULL;
1546 continue;
1547 }
1548
1549 spin_lock_irqsave(&ch->lock, irq_flags);
1550 if (nentries < ch->local_nentries) {
1551 dev_dbg(xpc_chan, "nentries=%d local_nentries=%d, "
1552 "partid=%d, channel=%d\n", nentries,
1553 ch->local_nentries, ch->partid, ch->number);
1554
1555 ch->local_nentries = nentries;
1556 }
1557 spin_unlock_irqrestore(&ch->lock, irq_flags);
1558 return xpSuccess;
1559 }
1560
1561 dev_dbg(xpc_chan, "can't get memory for local message queue and notify "
1562 "queue, partid=%d, channel=%d\n", ch->partid, ch->number);
1563 return xpNoMemory;
1564}
1565
1566/*
1567 * Allocate the cached remote message queue.
1568 */
1569static enum xp_retval
1570xpc_allocate_remote_msgqueue_sn2(struct xpc_channel *ch)
1571{
1572 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
1573 unsigned long irq_flags;
1574 int nentries;
1575 size_t nbytes;
1576
1577 DBUG_ON(ch->remote_nentries <= 0);
1578
1579 for (nentries = ch->remote_nentries; nentries > 0; nentries--) {
1580
1581 nbytes = nentries * ch->entry_size;
1582 ch_sn2->remote_msgqueue =
1583 xpc_kzalloc_cacheline_aligned(nbytes, GFP_KERNEL, &ch_sn2->
1584 remote_msgqueue_base);
1585 if (ch_sn2->remote_msgqueue == NULL)
1586 continue;
1587
1588 spin_lock_irqsave(&ch->lock, irq_flags);
1589 if (nentries < ch->remote_nentries) {
1590 dev_dbg(xpc_chan, "nentries=%d remote_nentries=%d, "
1591 "partid=%d, channel=%d\n", nentries,
1592 ch->remote_nentries, ch->partid, ch->number);
1593
1594 ch->remote_nentries = nentries;
1595 }
1596 spin_unlock_irqrestore(&ch->lock, irq_flags);
1597 return xpSuccess;
1598 }
1599
1600 dev_dbg(xpc_chan, "can't get memory for cached remote message queue, "
1601 "partid=%d, channel=%d\n", ch->partid, ch->number);
1602 return xpNoMemory;
1603}
1604
1605/*
1606 * Allocate message queues and other stuff associated with a channel.
1607 *
1608 * Note: Assumes all of the channel sizes are filled in.
1609 */
1610static enum xp_retval
1611xpc_setup_msg_structures_sn2(struct xpc_channel *ch)
1612{
1613 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
1614 enum xp_retval ret;
1615
1616 DBUG_ON(ch->flags & XPC_C_SETUP);
1617
1618 ret = xpc_allocate_local_msgqueue_sn2(ch);
1619 if (ret == xpSuccess) {
1620
1621 ret = xpc_allocate_remote_msgqueue_sn2(ch);
1622 if (ret != xpSuccess) {
1623 kfree(ch_sn2->local_msgqueue_base);
1624 ch_sn2->local_msgqueue = NULL;
1625 kfree(ch_sn2->notify_queue);
1626 ch_sn2->notify_queue = NULL;
1627 }
1628 }
1629 return ret;
1630}
1631
1632/*
1633 * Free up message queues and other stuff that were allocated for the specified
1634 * channel.
1635 */
1636static void
1637xpc_teardown_msg_structures_sn2(struct xpc_channel *ch)
1638{
1639 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
1640
1641 DBUG_ON(!spin_is_locked(&ch->lock));
1642
1643 ch_sn2->remote_msgqueue_pa = 0;
1644
1645 ch_sn2->local_GP->get = 0;
1646 ch_sn2->local_GP->put = 0;
1647 ch_sn2->remote_GP.get = 0;
1648 ch_sn2->remote_GP.put = 0;
1649 ch_sn2->w_local_GP.get = 0;
1650 ch_sn2->w_local_GP.put = 0;
1651 ch_sn2->w_remote_GP.get = 0;
1652 ch_sn2->w_remote_GP.put = 0;
1653 ch_sn2->next_msg_to_pull = 0;
1654
1655 if (ch->flags & XPC_C_SETUP) {
1656 dev_dbg(xpc_chan, "ch->flags=0x%x, partid=%d, channel=%d\n",
1657 ch->flags, ch->partid, ch->number);
1658
1659 kfree(ch_sn2->local_msgqueue_base);
1660 ch_sn2->local_msgqueue = NULL;
1661 kfree(ch_sn2->remote_msgqueue_base);
1662 ch_sn2->remote_msgqueue = NULL;
1663 kfree(ch_sn2->notify_queue);
1664 ch_sn2->notify_queue = NULL;
1665 }
1666}
1667
1668/*
1669 * Notify those who wanted to be notified upon delivery of their message.
1670 */
1671static void
1672xpc_notify_senders_sn2(struct xpc_channel *ch, enum xp_retval reason, s64 put)
1673{
1674 struct xpc_notify_sn2 *notify;
1675 u8 notify_type;
1676 s64 get = ch->sn.sn2.w_remote_GP.get - 1;
1677
1678 while (++get < put && atomic_read(&ch->n_to_notify) > 0) {
1679
1680 notify = &ch->sn.sn2.notify_queue[get % ch->local_nentries];
1681
1682 /*
1683 * See if the notify entry indicates it was associated with
1684 * a message who's sender wants to be notified. It is possible
1685 * that it is, but someone else is doing or has done the
1686 * notification.
1687 */
1688 notify_type = notify->type;
1689 if (notify_type == 0 ||
1690 cmpxchg(&notify->type, notify_type, 0) != notify_type) {
1691 continue;
1692 }
1693
1694 DBUG_ON(notify_type != XPC_N_CALL);
1695
1696 atomic_dec(&ch->n_to_notify);
1697
1698 if (notify->func != NULL) {
1699 dev_dbg(xpc_chan, "notify->func() called, notify=0x%p "
1700 "msg_number=%ld partid=%d channel=%d\n",
1701 (void *)notify, get, ch->partid, ch->number);
1702
1703 notify->func(reason, ch->partid, ch->number,
1704 notify->key);
1705
1706 dev_dbg(xpc_chan, "notify->func() returned, notify=0x%p"
1707 " msg_number=%ld partid=%d channel=%d\n",
1708 (void *)notify, get, ch->partid, ch->number);
1709 }
1710 }
1711}
1712
1713static void
1714xpc_notify_senders_of_disconnect_sn2(struct xpc_channel *ch)
1715{
1716 xpc_notify_senders_sn2(ch, ch->reason, ch->sn.sn2.w_local_GP.put);
1717}
1718
1719/*
1720 * Clear some of the msg flags in the local message queue.
1721 */
1722static inline void
1723xpc_clear_local_msgqueue_flags_sn2(struct xpc_channel *ch)
1724{
1725 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
1726 struct xpc_msg_sn2 *msg;
1727 s64 get;
1728
1729 get = ch_sn2->w_remote_GP.get;
1730 do {
1731 msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->local_msgqueue +
1732 (get % ch->local_nentries) *
1733 ch->entry_size);
1734 msg->flags = 0;
1735 } while (++get < ch_sn2->remote_GP.get);
1736}
1737
1738/*
1739 * Clear some of the msg flags in the remote message queue.
1740 */
1741static inline void
1742xpc_clear_remote_msgqueue_flags_sn2(struct xpc_channel *ch)
1743{
1744 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
1745 struct xpc_msg_sn2 *msg;
1746 s64 put;
1747
1748 put = ch_sn2->w_remote_GP.put;
1749 do {
1750 msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->remote_msgqueue +
1751 (put % ch->remote_nentries) *
1752 ch->entry_size);
1753 msg->flags = 0;
1754 } while (++put < ch_sn2->remote_GP.put);
1755}
1756
1757static int
1758xpc_n_of_deliverable_payloads_sn2(struct xpc_channel *ch)
1759{
1760 return ch->sn.sn2.w_remote_GP.put - ch->sn.sn2.w_local_GP.get;
1761}
1762
1763static void
1764xpc_process_msg_chctl_flags_sn2(struct xpc_partition *part, int ch_number)
1765{
1766 struct xpc_channel *ch = &part->channels[ch_number];
1767 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
1768 int npayloads_sent;
1769
1770 ch_sn2->remote_GP = part->sn.sn2.remote_GPs[ch_number];
1771
1772 /* See what, if anything, has changed for each connected channel */
1773
1774 xpc_msgqueue_ref(ch);
1775
1776 if (ch_sn2->w_remote_GP.get == ch_sn2->remote_GP.get &&
1777 ch_sn2->w_remote_GP.put == ch_sn2->remote_GP.put) {
1778 /* nothing changed since GPs were last pulled */
1779 xpc_msgqueue_deref(ch);
1780 return;
1781 }
1782
1783 if (!(ch->flags & XPC_C_CONNECTED)) {
1784 xpc_msgqueue_deref(ch);
1785 return;
1786 }
1787
1788 /*
1789 * First check to see if messages recently sent by us have been
1790 * received by the other side. (The remote GET value will have
1791 * changed since we last looked at it.)
1792 */
1793
1794 if (ch_sn2->w_remote_GP.get != ch_sn2->remote_GP.get) {
1795
1796 /*
1797 * We need to notify any senders that want to be notified
1798 * that their sent messages have been received by their
1799 * intended recipients. We need to do this before updating
1800 * w_remote_GP.get so that we don't allocate the same message
1801 * queue entries prematurely (see xpc_allocate_msg()).
1802 */
1803 if (atomic_read(&ch->n_to_notify) > 0) {
1804 /*
1805 * Notify senders that messages sent have been
1806 * received and delivered by the other side.
1807 */
1808 xpc_notify_senders_sn2(ch, xpMsgDelivered,
1809 ch_sn2->remote_GP.get);
1810 }
1811
1812 /*
1813 * Clear msg->flags in previously sent messages, so that
1814 * they're ready for xpc_allocate_msg().
1815 */
1816 xpc_clear_local_msgqueue_flags_sn2(ch);
1817
1818 ch_sn2->w_remote_GP.get = ch_sn2->remote_GP.get;
1819
1820 dev_dbg(xpc_chan, "w_remote_GP.get changed to %ld, partid=%d, "
1821 "channel=%d\n", ch_sn2->w_remote_GP.get, ch->partid,
1822 ch->number);
1823
1824 /*
1825 * If anyone was waiting for message queue entries to become
1826 * available, wake them up.
1827 */
1828 if (atomic_read(&ch->n_on_msg_allocate_wq) > 0)
1829 wake_up(&ch->msg_allocate_wq);
1830 }
1831
1832 /*
1833 * Now check for newly sent messages by the other side. (The remote
1834 * PUT value will have changed since we last looked at it.)
1835 */
1836
1837 if (ch_sn2->w_remote_GP.put != ch_sn2->remote_GP.put) {
1838 /*
1839 * Clear msg->flags in previously received messages, so that
1840 * they're ready for xpc_get_deliverable_payload_sn2().
1841 */
1842 xpc_clear_remote_msgqueue_flags_sn2(ch);
1843
1844 ch_sn2->w_remote_GP.put = ch_sn2->remote_GP.put;
1845
1846 dev_dbg(xpc_chan, "w_remote_GP.put changed to %ld, partid=%d, "
1847 "channel=%d\n", ch_sn2->w_remote_GP.put, ch->partid,
1848 ch->number);
1849
1850 npayloads_sent = xpc_n_of_deliverable_payloads_sn2(ch);
1851 if (npayloads_sent > 0) {
1852 dev_dbg(xpc_chan, "msgs waiting to be copied and "
1853 "delivered=%d, partid=%d, channel=%d\n",
1854 npayloads_sent, ch->partid, ch->number);
1855
1856 if (ch->flags & XPC_C_CONNECTEDCALLOUT_MADE)
1857 xpc_activate_kthreads(ch, npayloads_sent);
1858 }
1859 }
1860
1861 xpc_msgqueue_deref(ch);
1862}
1863
1864static struct xpc_msg_sn2 *
1865xpc_pull_remote_msg_sn2(struct xpc_channel *ch, s64 get)
1866{
1867 struct xpc_partition *part = &xpc_partitions[ch->partid];
1868 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
1869 unsigned long remote_msg_pa;
1870 struct xpc_msg_sn2 *msg;
1871 u32 msg_index;
1872 u32 nmsgs;
1873 u64 msg_offset;
1874 enum xp_retval ret;
1875
1876 if (mutex_lock_interruptible(&ch_sn2->msg_to_pull_mutex) != 0) {
1877 /* we were interrupted by a signal */
1878 return NULL;
1879 }
1880
1881 while (get >= ch_sn2->next_msg_to_pull) {
1882
1883 /* pull as many messages as are ready and able to be pulled */
1884
1885 msg_index = ch_sn2->next_msg_to_pull % ch->remote_nentries;
1886
1887 DBUG_ON(ch_sn2->next_msg_to_pull >= ch_sn2->w_remote_GP.put);
1888 nmsgs = ch_sn2->w_remote_GP.put - ch_sn2->next_msg_to_pull;
1889 if (msg_index + nmsgs > ch->remote_nentries) {
1890 /* ignore the ones that wrap the msg queue for now */
1891 nmsgs = ch->remote_nentries - msg_index;
1892 }
1893
1894 msg_offset = msg_index * ch->entry_size;
1895 msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->remote_msgqueue +
1896 msg_offset);
1897 remote_msg_pa = ch_sn2->remote_msgqueue_pa + msg_offset;
1898
1899 ret = xpc_pull_remote_cachelines_sn2(part, msg, remote_msg_pa,
1900 nmsgs * ch->entry_size);
1901 if (ret != xpSuccess) {
1902
1903 dev_dbg(xpc_chan, "failed to pull %d msgs starting with"
1904 " msg %ld from partition %d, channel=%d, "
1905 "ret=%d\n", nmsgs, ch_sn2->next_msg_to_pull,
1906 ch->partid, ch->number, ret);
1907
1908 XPC_DEACTIVATE_PARTITION(part, ret);
1909
1910 mutex_unlock(&ch_sn2->msg_to_pull_mutex);
1911 return NULL;
1912 }
1913
1914 ch_sn2->next_msg_to_pull += nmsgs;
1915 }
1916
1917 mutex_unlock(&ch_sn2->msg_to_pull_mutex);
1918
1919 /* return the message we were looking for */
1920 msg_offset = (get % ch->remote_nentries) * ch->entry_size;
1921 msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->remote_msgqueue + msg_offset);
1922
1923 return msg;
1924}
1925
1926/*
1927 * Get the next deliverable message's payload.
1928 */
1929static void *
1930xpc_get_deliverable_payload_sn2(struct xpc_channel *ch)
1931{
1932 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
1933 struct xpc_msg_sn2 *msg;
1934 void *payload = NULL;
1935 s64 get;
1936
1937 do {
1938 if (ch->flags & XPC_C_DISCONNECTING)
1939 break;
1940
1941 get = ch_sn2->w_local_GP.get;
1942 rmb(); /* guarantee that .get loads before .put */
1943 if (get == ch_sn2->w_remote_GP.put)
1944 break;
1945
1946 /* There are messages waiting to be pulled and delivered.
1947 * We need to try to secure one for ourselves. We'll do this
1948 * by trying to increment w_local_GP.get and hope that no one
1949 * else beats us to it. If they do, we'll we'll simply have
1950 * to try again for the next one.
1951 */
1952
1953 if (cmpxchg(&ch_sn2->w_local_GP.get, get, get + 1) == get) {
1954 /* we got the entry referenced by get */
1955
1956 dev_dbg(xpc_chan, "w_local_GP.get changed to %ld, "
1957 "partid=%d, channel=%d\n", get + 1,
1958 ch->partid, ch->number);
1959
1960 /* pull the message from the remote partition */
1961
1962 msg = xpc_pull_remote_msg_sn2(ch, get);
1963
1964 DBUG_ON(msg != NULL && msg->number != get);
1965 DBUG_ON(msg != NULL && (msg->flags & XPC_M_SN2_DONE));
1966 DBUG_ON(msg != NULL && !(msg->flags & XPC_M_SN2_READY));
1967
1968 payload = &msg->payload;
1969 break;
1970 }
1971
1972 } while (1);
1973
1974 return payload;
1975}
1976
1977/*
1978 * Now we actually send the messages that are ready to be sent by advancing
1979 * the local message queue's Put value and then send a chctl msgrequest to the
1980 * recipient partition.
1981 */
1982static void
1983xpc_send_msgs_sn2(struct xpc_channel *ch, s64 initial_put)
1984{
1985 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
1986 struct xpc_msg_sn2 *msg;
1987 s64 put = initial_put + 1;
1988 int send_msgrequest = 0;
1989
1990 while (1) {
1991
1992 while (1) {
1993 if (put == ch_sn2->w_local_GP.put)
1994 break;
1995
1996 msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->
1997 local_msgqueue + (put %
1998 ch->local_nentries) *
1999 ch->entry_size);
2000
2001 if (!(msg->flags & XPC_M_SN2_READY))
2002 break;
2003
2004 put++;
2005 }
2006
2007 if (put == initial_put) {
2008 /* nothing's changed */
2009 break;
2010 }
2011
2012 if (cmpxchg_rel(&ch_sn2->local_GP->put, initial_put, put) !=
2013 initial_put) {
2014 /* someone else beat us to it */
2015 DBUG_ON(ch_sn2->local_GP->put < initial_put);
2016 break;
2017 }
2018
2019 /* we just set the new value of local_GP->put */
2020
2021 dev_dbg(xpc_chan, "local_GP->put changed to %ld, partid=%d, "
2022 "channel=%d\n", put, ch->partid, ch->number);
2023
2024 send_msgrequest = 1;
2025
2026 /*
2027 * We need to ensure that the message referenced by
2028 * local_GP->put is not XPC_M_SN2_READY or that local_GP->put
2029 * equals w_local_GP.put, so we'll go have a look.
2030 */
2031 initial_put = put;
2032 }
2033
2034 if (send_msgrequest)
2035 xpc_send_chctl_msgrequest_sn2(ch);
2036}
2037
2038/*
2039 * Allocate an entry for a message from the message queue associated with the
2040 * specified channel.
2041 */
2042static enum xp_retval
2043xpc_allocate_msg_sn2(struct xpc_channel *ch, u32 flags,
2044 struct xpc_msg_sn2 **address_of_msg)
2045{
2046 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
2047 struct xpc_msg_sn2 *msg;
2048 enum xp_retval ret;
2049 s64 put;
2050
2051 /*
2052 * Get the next available message entry from the local message queue.
2053 * If none are available, we'll make sure that we grab the latest
2054 * GP values.
2055 */
2056 ret = xpTimeout;
2057
2058 while (1) {
2059
2060 put = ch_sn2->w_local_GP.put;
2061 rmb(); /* guarantee that .put loads before .get */
2062 if (put - ch_sn2->w_remote_GP.get < ch->local_nentries) {
2063
2064 /* There are available message entries. We need to try
2065 * to secure one for ourselves. We'll do this by trying
2066 * to increment w_local_GP.put as long as someone else
2067 * doesn't beat us to it. If they do, we'll have to
2068 * try again.
2069 */
2070 if (cmpxchg(&ch_sn2->w_local_GP.put, put, put + 1) ==
2071 put) {
2072 /* we got the entry referenced by put */
2073 break;
2074 }
2075 continue; /* try again */
2076 }
2077
2078 /*
2079 * There aren't any available msg entries at this time.
2080 *
2081 * In waiting for a message entry to become available,
2082 * we set a timeout in case the other side is not sending
2083 * completion interrupts. This lets us fake a notify IRQ
2084 * that will cause the notify IRQ handler to fetch the latest
2085 * GP values as if an interrupt was sent by the other side.
2086 */
2087 if (ret == xpTimeout)
2088 xpc_send_chctl_local_msgrequest_sn2(ch);
2089
2090 if (flags & XPC_NOWAIT)
2091 return xpNoWait;
2092
2093 ret = xpc_allocate_msg_wait(ch);
2094 if (ret != xpInterrupted && ret != xpTimeout)
2095 return ret;
2096 }
2097
2098 /* get the message's address and initialize it */
2099 msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->local_msgqueue +
2100 (put % ch->local_nentries) *
2101 ch->entry_size);
2102
2103 DBUG_ON(msg->flags != 0);
2104 msg->number = put;
2105
2106 dev_dbg(xpc_chan, "w_local_GP.put changed to %ld; msg=0x%p, "
2107 "msg_number=%ld, partid=%d, channel=%d\n", put + 1,
2108 (void *)msg, msg->number, ch->partid, ch->number);
2109
2110 *address_of_msg = msg;
2111 return xpSuccess;
2112}
2113
2114/*
2115 * Common code that does the actual sending of the message by advancing the
2116 * local message queue's Put value and sends a chctl msgrequest to the
2117 * partition the message is being sent to.
2118 */
2119static enum xp_retval
2120xpc_send_payload_sn2(struct xpc_channel *ch, u32 flags, void *payload,
2121 u16 payload_size, u8 notify_type, xpc_notify_func func,
2122 void *key)
2123{
2124 enum xp_retval ret = xpSuccess;
2125 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
2126 struct xpc_msg_sn2 *msg = msg;
2127 struct xpc_notify_sn2 *notify = notify;
2128 s64 msg_number;
2129 s64 put;
2130
2131 DBUG_ON(notify_type == XPC_N_CALL && func == NULL);
2132
2133 if (XPC_MSG_SIZE(payload_size) > ch->entry_size)
2134 return xpPayloadTooBig;
2135
2136 xpc_msgqueue_ref(ch);
2137
2138 if (ch->flags & XPC_C_DISCONNECTING) {
2139 ret = ch->reason;
2140 goto out_1;
2141 }
2142 if (!(ch->flags & XPC_C_CONNECTED)) {
2143 ret = xpNotConnected;
2144 goto out_1;
2145 }
2146
2147 ret = xpc_allocate_msg_sn2(ch, flags, &msg);
2148 if (ret != xpSuccess)
2149 goto out_1;
2150
2151 msg_number = msg->number;
2152
2153 if (notify_type != 0) {
2154 /*
2155 * Tell the remote side to send an ACK interrupt when the
2156 * message has been delivered.
2157 */
2158 msg->flags |= XPC_M_SN2_INTERRUPT;
2159
2160 atomic_inc(&ch->n_to_notify);
2161
2162 notify = &ch_sn2->notify_queue[msg_number % ch->local_nentries];
2163 notify->func = func;
2164 notify->key = key;
2165 notify->type = notify_type;
2166
2167 /* ??? Is a mb() needed here? */
2168
2169 if (ch->flags & XPC_C_DISCONNECTING) {
2170 /*
2171 * An error occurred between our last error check and
2172 * this one. We will try to clear the type field from
2173 * the notify entry. If we succeed then
2174 * xpc_disconnect_channel() didn't already process
2175 * the notify entry.
2176 */
2177 if (cmpxchg(&notify->type, notify_type, 0) ==
2178 notify_type) {
2179 atomic_dec(&ch->n_to_notify);
2180 ret = ch->reason;
2181 }
2182 goto out_1;
2183 }
2184 }
2185
2186 memcpy(&msg->payload, payload, payload_size);
2187
2188 msg->flags |= XPC_M_SN2_READY;
2189
2190 /*
2191 * The preceding store of msg->flags must occur before the following
2192 * load of local_GP->put.
2193 */
2194 mb();
2195
2196 /* see if the message is next in line to be sent, if so send it */
2197
2198 put = ch_sn2->local_GP->put;
2199 if (put == msg_number)
2200 xpc_send_msgs_sn2(ch, put);
2201
2202out_1:
2203 xpc_msgqueue_deref(ch);
2204 return ret;
2205}
2206
2207/*
2208 * Now we actually acknowledge the messages that have been delivered and ack'd
2209 * by advancing the cached remote message queue's Get value and if requested
2210 * send a chctl msgrequest to the message sender's partition.
2211 *
2212 * If a message has XPC_M_SN2_INTERRUPT set, send an interrupt to the partition
2213 * that sent the message.
2214 */
2215static void
2216xpc_acknowledge_msgs_sn2(struct xpc_channel *ch, s64 initial_get, u8 msg_flags)
2217{
2218 struct xpc_channel_sn2 *ch_sn2 = &ch->sn.sn2;
2219 struct xpc_msg_sn2 *msg;
2220 s64 get = initial_get + 1;
2221 int send_msgrequest = 0;
2222
2223 while (1) {
2224
2225 while (1) {
2226 if (get == ch_sn2->w_local_GP.get)
2227 break;
2228
2229 msg = (struct xpc_msg_sn2 *)((u64)ch_sn2->
2230 remote_msgqueue + (get %
2231 ch->remote_nentries) *
2232 ch->entry_size);
2233
2234 if (!(msg->flags & XPC_M_SN2_DONE))
2235 break;
2236
2237 msg_flags |= msg->flags;
2238 get++;
2239 }
2240
2241 if (get == initial_get) {
2242 /* nothing's changed */
2243 break;
2244 }
2245
2246 if (cmpxchg_rel(&ch_sn2->local_GP->get, initial_get, get) !=
2247 initial_get) {
2248 /* someone else beat us to it */
2249 DBUG_ON(ch_sn2->local_GP->get <= initial_get);
2250 break;
2251 }
2252
2253 /* we just set the new value of local_GP->get */
2254
2255 dev_dbg(xpc_chan, "local_GP->get changed to %ld, partid=%d, "
2256 "channel=%d\n", get, ch->partid, ch->number);
2257
2258 send_msgrequest = (msg_flags & XPC_M_SN2_INTERRUPT);
2259
2260 /*
2261 * We need to ensure that the message referenced by
2262 * local_GP->get is not XPC_M_SN2_DONE or that local_GP->get
2263 * equals w_local_GP.get, so we'll go have a look.
2264 */
2265 initial_get = get;
2266 }
2267
2268 if (send_msgrequest)
2269 xpc_send_chctl_msgrequest_sn2(ch);
2270}
2271
2272static void
2273xpc_received_payload_sn2(struct xpc_channel *ch, void *payload)
2274{
2275 struct xpc_msg_sn2 *msg;
2276 s64 msg_number;
2277 s64 get;
2278
2279 msg = container_of(payload, struct xpc_msg_sn2, payload);
2280 msg_number = msg->number;
2281
2282 dev_dbg(xpc_chan, "msg=0x%p, msg_number=%ld, partid=%d, channel=%d\n",
2283 (void *)msg, msg_number, ch->partid, ch->number);
2284
2285 DBUG_ON((((u64)msg - (u64)ch->remote_msgqueue) / ch->entry_size) !=
2286 msg_number % ch->remote_nentries);
2287 DBUG_ON(msg->flags & XPC_M_SN2_DONE);
2288
2289 msg->flags |= XPC_M_SN2_DONE;
2290
2291 /*
2292 * The preceding store of msg->flags must occur before the following
2293 * load of local_GP->get.
2294 */
2295 mb();
2296
2297 /*
2298 * See if this message is next in line to be acknowledged as having
2299 * been delivered.
2300 */
2301 get = ch->sn.sn2.local_GP->get;
2302 if (get == msg_number)
2303 xpc_acknowledge_msgs_sn2(ch, get, msg->flags);
2304}
2305
2306int
2307xpc_init_sn2(void)
2308{
2309 int ret;
2310 size_t buf_size;
2311
2312 xpc_setup_partitions_sn = xpc_setup_partitions_sn_sn2;
2313 xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2;
2314 xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_sn2;
2315 xpc_increment_heartbeat = xpc_increment_heartbeat_sn2;
2316 xpc_offline_heartbeat = xpc_offline_heartbeat_sn2;
2317 xpc_online_heartbeat = xpc_online_heartbeat_sn2;
2318 xpc_heartbeat_init = xpc_heartbeat_init_sn2;
2319 xpc_heartbeat_exit = xpc_heartbeat_exit_sn2;
2320 xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_sn2;
2321
2322 xpc_request_partition_activation = xpc_request_partition_activation_sn2;
2323 xpc_request_partition_reactivation =
2324 xpc_request_partition_reactivation_sn2;
2325 xpc_request_partition_deactivation =
2326 xpc_request_partition_deactivation_sn2;
2327 xpc_cancel_partition_deactivation_request =
2328 xpc_cancel_partition_deactivation_request_sn2;
2329
2330 xpc_process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_sn2;
2331 xpc_setup_ch_structures_sn = xpc_setup_ch_structures_sn_sn2;
2332 xpc_teardown_ch_structures_sn = xpc_teardown_ch_structures_sn_sn2;
2333 xpc_make_first_contact = xpc_make_first_contact_sn2;
2334
2335 xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_sn2;
2336 xpc_send_chctl_closerequest = xpc_send_chctl_closerequest_sn2;
2337 xpc_send_chctl_closereply = xpc_send_chctl_closereply_sn2;
2338 xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_sn2;
2339 xpc_send_chctl_openreply = xpc_send_chctl_openreply_sn2;
2340
2341 xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_sn2;
2342
2343 xpc_setup_msg_structures = xpc_setup_msg_structures_sn2;
2344 xpc_teardown_msg_structures = xpc_teardown_msg_structures_sn2;
2345
2346 xpc_notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_sn2;
2347 xpc_process_msg_chctl_flags = xpc_process_msg_chctl_flags_sn2;
2348 xpc_n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_sn2;
2349 xpc_get_deliverable_payload = xpc_get_deliverable_payload_sn2;
2350
2351 xpc_indicate_partition_engaged = xpc_indicate_partition_engaged_sn2;
2352 xpc_indicate_partition_disengaged =
2353 xpc_indicate_partition_disengaged_sn2;
2354 xpc_partition_engaged = xpc_partition_engaged_sn2;
2355 xpc_any_partition_engaged = xpc_any_partition_engaged_sn2;
2356 xpc_assume_partition_disengaged = xpc_assume_partition_disengaged_sn2;
2357
2358 xpc_send_payload = xpc_send_payload_sn2;
2359 xpc_received_payload = xpc_received_payload_sn2;
2360
2361 if (offsetof(struct xpc_msg_sn2, payload) > XPC_MSG_HDR_MAX_SIZE) {
2362 dev_err(xpc_part, "header portion of struct xpc_msg_sn2 is "
2363 "larger than %d\n", XPC_MSG_HDR_MAX_SIZE);
2364 return -E2BIG;
2365 }
2366
2367 buf_size = max(XPC_RP_VARS_SIZE,
2368 XPC_RP_HEADER_SIZE + XP_NASID_MASK_BYTES_SN2);
2369 xpc_remote_copy_buffer_sn2 = xpc_kmalloc_cacheline_aligned(buf_size,
2370 GFP_KERNEL,
2371 &xpc_remote_copy_buffer_base_sn2);
2372 if (xpc_remote_copy_buffer_sn2 == NULL) {
2373 dev_err(xpc_part, "can't get memory for remote copy buffer\n");
2374 return -ENOMEM;
2375 }
2376
2377 /* open up protections for IPI and [potentially] amo operations */
2378 xpc_allow_IPI_ops_sn2();
2379 xpc_allow_amo_ops_shub_wars_1_1_sn2();
2380
2381 /*
2382 * This is safe to do before the xpc_hb_checker thread has started
2383 * because the handler releases a wait queue. If an interrupt is
2384 * received before the thread is waiting, it will not go to sleep,
2385 * but rather immediately process the interrupt.
2386 */
2387 ret = request_irq(SGI_XPC_ACTIVATE, xpc_handle_activate_IRQ_sn2, 0,
2388 "xpc hb", NULL);
2389 if (ret != 0) {
2390 dev_err(xpc_part, "can't register ACTIVATE IRQ handler, "
2391 "errno=%d\n", -ret);
2392 xpc_disallow_IPI_ops_sn2();
2393 kfree(xpc_remote_copy_buffer_base_sn2);
2394 }
2395 return ret;
2396}
2397
2398void
2399xpc_exit_sn2(void)
2400{
2401 free_irq(SGI_XPC_ACTIVATE, NULL);
2402 xpc_disallow_IPI_ops_sn2();
2403 kfree(xpc_remote_copy_buffer_base_sn2);
2404}
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
new file mode 100644
index 000000000000..1ac694c01623
--- /dev/null
+++ b/drivers/misc/sgi-xp/xpc_uv.c
@@ -0,0 +1,1443 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9/*
10 * Cross Partition Communication (XPC) uv-based functions.
11 *
12 * Architecture specific implementation of common functions.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/mm.h>
18#include <linux/interrupt.h>
19#include <linux/delay.h>
20#include <linux/device.h>
21#include <asm/uv/uv_hub.h>
22#include "../sgi-gru/gru.h"
23#include "../sgi-gru/grukservices.h"
24#include "xpc.h"
25
26static atomic64_t xpc_heartbeat_uv;
27static DECLARE_BITMAP(xpc_heartbeating_to_mask_uv, XP_MAX_NPARTITIONS_UV);
28
29#define XPC_ACTIVATE_MSG_SIZE_UV (1 * GRU_CACHE_LINE_BYTES)
30#define XPC_NOTIFY_MSG_SIZE_UV (2 * GRU_CACHE_LINE_BYTES)
31
32#define XPC_ACTIVATE_MQ_SIZE_UV (4 * XP_MAX_NPARTITIONS_UV * \
33 XPC_ACTIVATE_MSG_SIZE_UV)
34#define XPC_NOTIFY_MQ_SIZE_UV (4 * XP_MAX_NPARTITIONS_UV * \
35 XPC_NOTIFY_MSG_SIZE_UV)
36
37static void *xpc_activate_mq_uv;
38static void *xpc_notify_mq_uv;
39
40static int
41xpc_setup_partitions_sn_uv(void)
42{
43 short partid;
44 struct xpc_partition_uv *part_uv;
45
46 for (partid = 0; partid < XP_MAX_NPARTITIONS_UV; partid++) {
47 part_uv = &xpc_partitions[partid].sn.uv;
48
49 spin_lock_init(&part_uv->flags_lock);
50 part_uv->remote_act_state = XPC_P_AS_INACTIVE;
51 }
52 return 0;
53}
54
55static void *
56xpc_create_gru_mq_uv(unsigned int mq_size, int cpuid, unsigned int irq,
57 irq_handler_t irq_handler)
58{
59 int ret;
60 int nid;
61 int mq_order;
62 struct page *page;
63 void *mq;
64
65 nid = cpu_to_node(cpuid);
66 mq_order = get_order(mq_size);
67 page = alloc_pages_node(nid, GFP_KERNEL | __GFP_ZERO | GFP_THISNODE,
68 mq_order);
69 if (page == NULL) {
70 dev_err(xpc_part, "xpc_create_gru_mq_uv() failed to alloc %d "
71 "bytes of memory on nid=%d for GRU mq\n", mq_size, nid);
72 return NULL;
73 }
74
75 mq = page_address(page);
76 ret = gru_create_message_queue(mq, mq_size);
77 if (ret != 0) {
78 dev_err(xpc_part, "gru_create_message_queue() returned "
79 "error=%d\n", ret);
80 free_pages((unsigned long)mq, mq_order);
81 return NULL;
82 }
83
84 /* !!! Need to do some other things to set up IRQ */
85
86 ret = request_irq(irq, irq_handler, 0, "xpc", NULL);
87 if (ret != 0) {
88 dev_err(xpc_part, "request_irq(irq=%d) returned error=%d\n",
89 irq, ret);
90 free_pages((unsigned long)mq, mq_order);
91 return NULL;
92 }
93
94 /* !!! enable generation of irq when GRU mq op occurs to this mq */
95
96 /* ??? allow other partitions to access GRU mq? */
97
98 return mq;
99}
100
101static void
102xpc_destroy_gru_mq_uv(void *mq, unsigned int mq_size, unsigned int irq)
103{
104 /* ??? disallow other partitions to access GRU mq? */
105
106 /* !!! disable generation of irq when GRU mq op occurs to this mq */
107
108 free_irq(irq, NULL);
109
110 free_pages((unsigned long)mq, get_order(mq_size));
111}
112
113static enum xp_retval
114xpc_send_gru_msg(unsigned long mq_gpa, void *msg, size_t msg_size)
115{
116 enum xp_retval xp_ret;
117 int ret;
118
119 while (1) {
120 ret = gru_send_message_gpa(mq_gpa, msg, msg_size);
121 if (ret == MQE_OK) {
122 xp_ret = xpSuccess;
123 break;
124 }
125
126 if (ret == MQE_QUEUE_FULL) {
127 dev_dbg(xpc_chan, "gru_send_message_gpa() returned "
128 "error=MQE_QUEUE_FULL\n");
129 /* !!! handle QLimit reached; delay & try again */
130 /* ??? Do we add a limit to the number of retries? */
131 (void)msleep_interruptible(10);
132 } else if (ret == MQE_CONGESTION) {
133 dev_dbg(xpc_chan, "gru_send_message_gpa() returned "
134 "error=MQE_CONGESTION\n");
135 /* !!! handle LB Overflow; simply try again */
136 /* ??? Do we add a limit to the number of retries? */
137 } else {
138 /* !!! Currently this is MQE_UNEXPECTED_CB_ERR */
139 dev_err(xpc_chan, "gru_send_message_gpa() returned "
140 "error=%d\n", ret);
141 xp_ret = xpGruSendMqError;
142 break;
143 }
144 }
145 return xp_ret;
146}
147
148static void
149xpc_process_activate_IRQ_rcvd_uv(void)
150{
151 unsigned long irq_flags;
152 short partid;
153 struct xpc_partition *part;
154 u8 act_state_req;
155
156 DBUG_ON(xpc_activate_IRQ_rcvd == 0);
157
158 spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
159 for (partid = 0; partid < XP_MAX_NPARTITIONS_UV; partid++) {
160 part = &xpc_partitions[partid];
161
162 if (part->sn.uv.act_state_req == 0)
163 continue;
164
165 xpc_activate_IRQ_rcvd--;
166 BUG_ON(xpc_activate_IRQ_rcvd < 0);
167
168 act_state_req = part->sn.uv.act_state_req;
169 part->sn.uv.act_state_req = 0;
170 spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
171
172 if (act_state_req == XPC_P_ASR_ACTIVATE_UV) {
173 if (part->act_state == XPC_P_AS_INACTIVE)
174 xpc_activate_partition(part);
175 else if (part->act_state == XPC_P_AS_DEACTIVATING)
176 XPC_DEACTIVATE_PARTITION(part, xpReactivating);
177
178 } else if (act_state_req == XPC_P_ASR_REACTIVATE_UV) {
179 if (part->act_state == XPC_P_AS_INACTIVE)
180 xpc_activate_partition(part);
181 else
182 XPC_DEACTIVATE_PARTITION(part, xpReactivating);
183
184 } else if (act_state_req == XPC_P_ASR_DEACTIVATE_UV) {
185 XPC_DEACTIVATE_PARTITION(part, part->sn.uv.reason);
186
187 } else {
188 BUG();
189 }
190
191 spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
192 if (xpc_activate_IRQ_rcvd == 0)
193 break;
194 }
195 spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
196
197}
198
199static void
200xpc_handle_activate_mq_msg_uv(struct xpc_partition *part,
201 struct xpc_activate_mq_msghdr_uv *msg_hdr,
202 int *wakeup_hb_checker)
203{
204 unsigned long irq_flags;
205 struct xpc_partition_uv *part_uv = &part->sn.uv;
206 struct xpc_openclose_args *args;
207
208 part_uv->remote_act_state = msg_hdr->act_state;
209
210 switch (msg_hdr->type) {
211 case XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV:
212 /* syncing of remote_act_state was just done above */
213 break;
214
215 case XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV: {
216 struct xpc_activate_mq_msg_heartbeat_req_uv *msg;
217
218 msg = container_of(msg_hdr,
219 struct xpc_activate_mq_msg_heartbeat_req_uv,
220 hdr);
221 part_uv->heartbeat = msg->heartbeat;
222 break;
223 }
224 case XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV: {
225 struct xpc_activate_mq_msg_heartbeat_req_uv *msg;
226
227 msg = container_of(msg_hdr,
228 struct xpc_activate_mq_msg_heartbeat_req_uv,
229 hdr);
230 part_uv->heartbeat = msg->heartbeat;
231
232 spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
233 part_uv->flags |= XPC_P_HEARTBEAT_OFFLINE_UV;
234 spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
235 break;
236 }
237 case XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV: {
238 struct xpc_activate_mq_msg_heartbeat_req_uv *msg;
239
240 msg = container_of(msg_hdr,
241 struct xpc_activate_mq_msg_heartbeat_req_uv,
242 hdr);
243 part_uv->heartbeat = msg->heartbeat;
244
245 spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
246 part_uv->flags &= ~XPC_P_HEARTBEAT_OFFLINE_UV;
247 spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
248 break;
249 }
250 case XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV: {
251 struct xpc_activate_mq_msg_activate_req_uv *msg;
252
253 /*
254 * ??? Do we deal here with ts_jiffies being different
255 * ??? if act_state != XPC_P_AS_INACTIVE instead of
256 * ??? below?
257 */
258 msg = container_of(msg_hdr, struct
259 xpc_activate_mq_msg_activate_req_uv, hdr);
260
261 spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
262 if (part_uv->act_state_req == 0)
263 xpc_activate_IRQ_rcvd++;
264 part_uv->act_state_req = XPC_P_ASR_ACTIVATE_UV;
265 part->remote_rp_pa = msg->rp_gpa; /* !!! _pa is _gpa */
266 part->remote_rp_ts_jiffies = msg_hdr->rp_ts_jiffies;
267 part_uv->remote_activate_mq_gpa = msg->activate_mq_gpa;
268 spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
269
270 (*wakeup_hb_checker)++;
271 break;
272 }
273 case XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV: {
274 struct xpc_activate_mq_msg_deactivate_req_uv *msg;
275
276 msg = container_of(msg_hdr, struct
277 xpc_activate_mq_msg_deactivate_req_uv, hdr);
278
279 spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
280 if (part_uv->act_state_req == 0)
281 xpc_activate_IRQ_rcvd++;
282 part_uv->act_state_req = XPC_P_ASR_DEACTIVATE_UV;
283 part_uv->reason = msg->reason;
284 spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
285
286 (*wakeup_hb_checker)++;
287 return;
288 }
289 case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV: {
290 struct xpc_activate_mq_msg_chctl_closerequest_uv *msg;
291
292 msg = container_of(msg_hdr, struct
293 xpc_activate_mq_msg_chctl_closerequest_uv,
294 hdr);
295 args = &part->remote_openclose_args[msg->ch_number];
296 args->reason = msg->reason;
297
298 spin_lock_irqsave(&part->chctl_lock, irq_flags);
299 part->chctl.flags[msg->ch_number] |= XPC_CHCTL_CLOSEREQUEST;
300 spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
301
302 xpc_wakeup_channel_mgr(part);
303 break;
304 }
305 case XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV: {
306 struct xpc_activate_mq_msg_chctl_closereply_uv *msg;
307
308 msg = container_of(msg_hdr, struct
309 xpc_activate_mq_msg_chctl_closereply_uv,
310 hdr);
311
312 spin_lock_irqsave(&part->chctl_lock, irq_flags);
313 part->chctl.flags[msg->ch_number] |= XPC_CHCTL_CLOSEREPLY;
314 spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
315
316 xpc_wakeup_channel_mgr(part);
317 break;
318 }
319 case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV: {
320 struct xpc_activate_mq_msg_chctl_openrequest_uv *msg;
321
322 msg = container_of(msg_hdr, struct
323 xpc_activate_mq_msg_chctl_openrequest_uv,
324 hdr);
325 args = &part->remote_openclose_args[msg->ch_number];
326 args->entry_size = msg->entry_size;
327 args->local_nentries = msg->local_nentries;
328
329 spin_lock_irqsave(&part->chctl_lock, irq_flags);
330 part->chctl.flags[msg->ch_number] |= XPC_CHCTL_OPENREQUEST;
331 spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
332
333 xpc_wakeup_channel_mgr(part);
334 break;
335 }
336 case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV: {
337 struct xpc_activate_mq_msg_chctl_openreply_uv *msg;
338
339 msg = container_of(msg_hdr, struct
340 xpc_activate_mq_msg_chctl_openreply_uv, hdr);
341 args = &part->remote_openclose_args[msg->ch_number];
342 args->remote_nentries = msg->remote_nentries;
343 args->local_nentries = msg->local_nentries;
344 args->local_msgqueue_pa = msg->local_notify_mq_gpa;
345
346 spin_lock_irqsave(&part->chctl_lock, irq_flags);
347 part->chctl.flags[msg->ch_number] |= XPC_CHCTL_OPENREPLY;
348 spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
349
350 xpc_wakeup_channel_mgr(part);
351 break;
352 }
353 case XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV:
354 spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
355 part_uv->flags |= XPC_P_ENGAGED_UV;
356 spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
357 break;
358
359 case XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV:
360 spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
361 part_uv->flags &= ~XPC_P_ENGAGED_UV;
362 spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
363 break;
364
365 default:
366 dev_err(xpc_part, "received unknown activate_mq msg type=%d "
367 "from partition=%d\n", msg_hdr->type, XPC_PARTID(part));
368
369 /* get hb checker to deactivate from the remote partition */
370 spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
371 if (part_uv->act_state_req == 0)
372 xpc_activate_IRQ_rcvd++;
373 part_uv->act_state_req = XPC_P_ASR_DEACTIVATE_UV;
374 part_uv->reason = xpBadMsgType;
375 spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
376
377 (*wakeup_hb_checker)++;
378 return;
379 }
380
381 if (msg_hdr->rp_ts_jiffies != part->remote_rp_ts_jiffies &&
382 part->remote_rp_ts_jiffies != 0) {
383 /*
384 * ??? Does what we do here need to be sensitive to
385 * ??? act_state or remote_act_state?
386 */
387 spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
388 if (part_uv->act_state_req == 0)
389 xpc_activate_IRQ_rcvd++;
390 part_uv->act_state_req = XPC_P_ASR_REACTIVATE_UV;
391 spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
392
393 (*wakeup_hb_checker)++;
394 }
395}
396
397static irqreturn_t
398xpc_handle_activate_IRQ_uv(int irq, void *dev_id)
399{
400 struct xpc_activate_mq_msghdr_uv *msg_hdr;
401 short partid;
402 struct xpc_partition *part;
403 int wakeup_hb_checker = 0;
404
405 while ((msg_hdr = gru_get_next_message(xpc_activate_mq_uv)) != NULL) {
406
407 partid = msg_hdr->partid;
408 if (partid < 0 || partid >= XP_MAX_NPARTITIONS_UV) {
409 dev_err(xpc_part, "xpc_handle_activate_IRQ_uv() "
410 "received invalid partid=0x%x in message\n",
411 partid);
412 } else {
413 part = &xpc_partitions[partid];
414 if (xpc_part_ref(part)) {
415 xpc_handle_activate_mq_msg_uv(part, msg_hdr,
416 &wakeup_hb_checker);
417 xpc_part_deref(part);
418 }
419 }
420
421 gru_free_message(xpc_activate_mq_uv, msg_hdr);
422 }
423
424 if (wakeup_hb_checker)
425 wake_up_interruptible(&xpc_activate_IRQ_wq);
426
427 return IRQ_HANDLED;
428}
429
430static enum xp_retval
431xpc_send_activate_IRQ_uv(struct xpc_partition *part, void *msg, size_t msg_size,
432 int msg_type)
433{
434 struct xpc_activate_mq_msghdr_uv *msg_hdr = msg;
435
436 DBUG_ON(msg_size > XPC_ACTIVATE_MSG_SIZE_UV);
437
438 msg_hdr->type = msg_type;
439 msg_hdr->partid = XPC_PARTID(part);
440 msg_hdr->act_state = part->act_state;
441 msg_hdr->rp_ts_jiffies = xpc_rsvd_page->ts_jiffies;
442
443 /* ??? Is holding a spin_lock (ch->lock) during this call a bad idea? */
444 return xpc_send_gru_msg(part->sn.uv.remote_activate_mq_gpa, msg,
445 msg_size);
446}
447
448static void
449xpc_send_activate_IRQ_part_uv(struct xpc_partition *part, void *msg,
450 size_t msg_size, int msg_type)
451{
452 enum xp_retval ret;
453
454 ret = xpc_send_activate_IRQ_uv(part, msg, msg_size, msg_type);
455 if (unlikely(ret != xpSuccess))
456 XPC_DEACTIVATE_PARTITION(part, ret);
457}
458
459static void
460xpc_send_activate_IRQ_ch_uv(struct xpc_channel *ch, unsigned long *irq_flags,
461 void *msg, size_t msg_size, int msg_type)
462{
463 struct xpc_partition *part = &xpc_partitions[ch->number];
464 enum xp_retval ret;
465
466 ret = xpc_send_activate_IRQ_uv(part, msg, msg_size, msg_type);
467 if (unlikely(ret != xpSuccess)) {
468 if (irq_flags != NULL)
469 spin_unlock_irqrestore(&ch->lock, *irq_flags);
470
471 XPC_DEACTIVATE_PARTITION(part, ret);
472
473 if (irq_flags != NULL)
474 spin_lock_irqsave(&ch->lock, *irq_flags);
475 }
476}
477
478static void
479xpc_send_local_activate_IRQ_uv(struct xpc_partition *part, int act_state_req)
480{
481 unsigned long irq_flags;
482 struct xpc_partition_uv *part_uv = &part->sn.uv;
483
484 /*
485 * !!! Make our side think that the remote parition sent an activate
486 * !!! message our way by doing what the activate IRQ handler would
487 * !!! do had one really been sent.
488 */
489
490 spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
491 if (part_uv->act_state_req == 0)
492 xpc_activate_IRQ_rcvd++;
493 part_uv->act_state_req = act_state_req;
494 spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
495
496 wake_up_interruptible(&xpc_activate_IRQ_wq);
497}
498
499static enum xp_retval
500xpc_get_partition_rsvd_page_pa_uv(void *buf, u64 *cookie, unsigned long *rp_pa,
501 size_t *len)
502{
503 /* !!! call the UV version of sn_partition_reserved_page_pa() */
504 return xpUnsupported;
505}
506
507static int
508xpc_setup_rsvd_page_sn_uv(struct xpc_rsvd_page *rp)
509{
510 rp->sn.activate_mq_gpa = uv_gpa(xpc_activate_mq_uv);
511 return 0;
512}
513
514static void
515xpc_send_heartbeat_uv(int msg_type)
516{
517 short partid;
518 struct xpc_partition *part;
519 struct xpc_activate_mq_msg_heartbeat_req_uv msg;
520
521 /*
522 * !!! On uv we're broadcasting a heartbeat message every 5 seconds.
523 * !!! Whereas on sn2 we're bte_copy'ng the heartbeat info every 20
524 * !!! seconds. This is an increase in numalink traffic.
525 * ??? Is this good?
526 */
527
528 msg.heartbeat = atomic64_inc_return(&xpc_heartbeat_uv);
529
530 partid = find_first_bit(xpc_heartbeating_to_mask_uv,
531 XP_MAX_NPARTITIONS_UV);
532
533 while (partid < XP_MAX_NPARTITIONS_UV) {
534 part = &xpc_partitions[partid];
535
536 xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
537 msg_type);
538
539 partid = find_next_bit(xpc_heartbeating_to_mask_uv,
540 XP_MAX_NPARTITIONS_UV, partid + 1);
541 }
542}
543
544static void
545xpc_increment_heartbeat_uv(void)
546{
547 xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV);
548}
549
550static void
551xpc_offline_heartbeat_uv(void)
552{
553 xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV);
554}
555
556static void
557xpc_online_heartbeat_uv(void)
558{
559 xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV);
560}
561
562static void
563xpc_heartbeat_init_uv(void)
564{
565 atomic64_set(&xpc_heartbeat_uv, 0);
566 bitmap_zero(xpc_heartbeating_to_mask_uv, XP_MAX_NPARTITIONS_UV);
567 xpc_heartbeating_to_mask = &xpc_heartbeating_to_mask_uv[0];
568}
569
570static void
571xpc_heartbeat_exit_uv(void)
572{
573 xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV);
574}
575
576static enum xp_retval
577xpc_get_remote_heartbeat_uv(struct xpc_partition *part)
578{
579 struct xpc_partition_uv *part_uv = &part->sn.uv;
580 enum xp_retval ret = xpNoHeartbeat;
581
582 if (part_uv->remote_act_state != XPC_P_AS_INACTIVE &&
583 part_uv->remote_act_state != XPC_P_AS_DEACTIVATING) {
584
585 if (part_uv->heartbeat != part->last_heartbeat ||
586 (part_uv->flags & XPC_P_HEARTBEAT_OFFLINE_UV)) {
587
588 part->last_heartbeat = part_uv->heartbeat;
589 ret = xpSuccess;
590 }
591 }
592 return ret;
593}
594
595static void
596xpc_request_partition_activation_uv(struct xpc_rsvd_page *remote_rp,
597 unsigned long remote_rp_gpa, int nasid)
598{
599 short partid = remote_rp->SAL_partid;
600 struct xpc_partition *part = &xpc_partitions[partid];
601 struct xpc_activate_mq_msg_activate_req_uv msg;
602
603 part->remote_rp_pa = remote_rp_gpa; /* !!! _pa here is really _gpa */
604 part->remote_rp_ts_jiffies = remote_rp->ts_jiffies;
605 part->sn.uv.remote_activate_mq_gpa = remote_rp->sn.activate_mq_gpa;
606
607 /*
608 * ??? Is it a good idea to make this conditional on what is
609 * ??? potentially stale state information?
610 */
611 if (part->sn.uv.remote_act_state == XPC_P_AS_INACTIVE) {
612 msg.rp_gpa = uv_gpa(xpc_rsvd_page);
613 msg.activate_mq_gpa = xpc_rsvd_page->sn.activate_mq_gpa;
614 xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
615 XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV);
616 }
617
618 if (part->act_state == XPC_P_AS_INACTIVE)
619 xpc_send_local_activate_IRQ_uv(part, XPC_P_ASR_ACTIVATE_UV);
620}
621
622static void
623xpc_request_partition_reactivation_uv(struct xpc_partition *part)
624{
625 xpc_send_local_activate_IRQ_uv(part, XPC_P_ASR_ACTIVATE_UV);
626}
627
628static void
629xpc_request_partition_deactivation_uv(struct xpc_partition *part)
630{
631 struct xpc_activate_mq_msg_deactivate_req_uv msg;
632
633 /*
634 * ??? Is it a good idea to make this conditional on what is
635 * ??? potentially stale state information?
636 */
637 if (part->sn.uv.remote_act_state != XPC_P_AS_DEACTIVATING &&
638 part->sn.uv.remote_act_state != XPC_P_AS_INACTIVE) {
639
640 msg.reason = part->reason;
641 xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
642 XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV);
643 }
644}
645
646static void
647xpc_cancel_partition_deactivation_request_uv(struct xpc_partition *part)
648{
649 /* nothing needs to be done */
650 return;
651}
652
653static void
654xpc_init_fifo_uv(struct xpc_fifo_head_uv *head)
655{
656 head->first = NULL;
657 head->last = NULL;
658 spin_lock_init(&head->lock);
659 head->n_entries = 0;
660}
661
662static void *
663xpc_get_fifo_entry_uv(struct xpc_fifo_head_uv *head)
664{
665 unsigned long irq_flags;
666 struct xpc_fifo_entry_uv *first;
667
668 spin_lock_irqsave(&head->lock, irq_flags);
669 first = head->first;
670 if (head->first != NULL) {
671 head->first = first->next;
672 if (head->first == NULL)
673 head->last = NULL;
674 }
675 head->n_entries++;
676 spin_unlock_irqrestore(&head->lock, irq_flags);
677 first->next = NULL;
678 return first;
679}
680
681static void
682xpc_put_fifo_entry_uv(struct xpc_fifo_head_uv *head,
683 struct xpc_fifo_entry_uv *last)
684{
685 unsigned long irq_flags;
686
687 last->next = NULL;
688 spin_lock_irqsave(&head->lock, irq_flags);
689 if (head->last != NULL)
690 head->last->next = last;
691 else
692 head->first = last;
693 head->last = last;
694 head->n_entries--;
695 BUG_ON(head->n_entries < 0);
696 spin_unlock_irqrestore(&head->lock, irq_flags);
697}
698
699static int
700xpc_n_of_fifo_entries_uv(struct xpc_fifo_head_uv *head)
701{
702 return head->n_entries;
703}
704
705/*
706 * Setup the channel structures that are uv specific.
707 */
708static enum xp_retval
709xpc_setup_ch_structures_sn_uv(struct xpc_partition *part)
710{
711 struct xpc_channel_uv *ch_uv;
712 int ch_number;
713
714 for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
715 ch_uv = &part->channels[ch_number].sn.uv;
716
717 xpc_init_fifo_uv(&ch_uv->msg_slot_free_list);
718 xpc_init_fifo_uv(&ch_uv->recv_msg_list);
719 }
720
721 return xpSuccess;
722}
723
724/*
725 * Teardown the channel structures that are uv specific.
726 */
727static void
728xpc_teardown_ch_structures_sn_uv(struct xpc_partition *part)
729{
730 /* nothing needs to be done */
731 return;
732}
733
734static enum xp_retval
735xpc_make_first_contact_uv(struct xpc_partition *part)
736{
737 struct xpc_activate_mq_msg_uv msg;
738
739 /*
740 * We send a sync msg to get the remote partition's remote_act_state
741 * updated to our current act_state which at this point should
742 * be XPC_P_AS_ACTIVATING.
743 */
744 xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
745 XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV);
746
747 while (part->sn.uv.remote_act_state != XPC_P_AS_ACTIVATING) {
748
749 dev_dbg(xpc_part, "waiting to make first contact with "
750 "partition %d\n", XPC_PARTID(part));
751
752 /* wait a 1/4 of a second or so */
753 (void)msleep_interruptible(250);
754
755 if (part->act_state == XPC_P_AS_DEACTIVATING)
756 return part->reason;
757 }
758
759 return xpSuccess;
760}
761
762static u64
763xpc_get_chctl_all_flags_uv(struct xpc_partition *part)
764{
765 unsigned long irq_flags;
766 union xpc_channel_ctl_flags chctl;
767
768 spin_lock_irqsave(&part->chctl_lock, irq_flags);
769 chctl = part->chctl;
770 if (chctl.all_flags != 0)
771 part->chctl.all_flags = 0;
772
773 spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
774 return chctl.all_flags;
775}
776
777static enum xp_retval
778xpc_allocate_send_msg_slot_uv(struct xpc_channel *ch)
779{
780 struct xpc_channel_uv *ch_uv = &ch->sn.uv;
781 struct xpc_send_msg_slot_uv *msg_slot;
782 unsigned long irq_flags;
783 int nentries;
784 int entry;
785 size_t nbytes;
786
787 for (nentries = ch->local_nentries; nentries > 0; nentries--) {
788 nbytes = nentries * sizeof(struct xpc_send_msg_slot_uv);
789 ch_uv->send_msg_slots = kzalloc(nbytes, GFP_KERNEL);
790 if (ch_uv->send_msg_slots == NULL)
791 continue;
792
793 for (entry = 0; entry < nentries; entry++) {
794 msg_slot = &ch_uv->send_msg_slots[entry];
795
796 msg_slot->msg_slot_number = entry;
797 xpc_put_fifo_entry_uv(&ch_uv->msg_slot_free_list,
798 &msg_slot->next);
799 }
800
801 spin_lock_irqsave(&ch->lock, irq_flags);
802 if (nentries < ch->local_nentries)
803 ch->local_nentries = nentries;
804 spin_unlock_irqrestore(&ch->lock, irq_flags);
805 return xpSuccess;
806 }
807
808 return xpNoMemory;
809}
810
811static enum xp_retval
812xpc_allocate_recv_msg_slot_uv(struct xpc_channel *ch)
813{
814 struct xpc_channel_uv *ch_uv = &ch->sn.uv;
815 struct xpc_notify_mq_msg_uv *msg_slot;
816 unsigned long irq_flags;
817 int nentries;
818 int entry;
819 size_t nbytes;
820
821 for (nentries = ch->remote_nentries; nentries > 0; nentries--) {
822 nbytes = nentries * ch->entry_size;
823 ch_uv->recv_msg_slots = kzalloc(nbytes, GFP_KERNEL);
824 if (ch_uv->recv_msg_slots == NULL)
825 continue;
826
827 for (entry = 0; entry < nentries; entry++) {
828 msg_slot = ch_uv->recv_msg_slots + entry *
829 ch->entry_size;
830
831 msg_slot->hdr.msg_slot_number = entry;
832 }
833
834 spin_lock_irqsave(&ch->lock, irq_flags);
835 if (nentries < ch->remote_nentries)
836 ch->remote_nentries = nentries;
837 spin_unlock_irqrestore(&ch->lock, irq_flags);
838 return xpSuccess;
839 }
840
841 return xpNoMemory;
842}
843
844/*
845 * Allocate msg_slots associated with the channel.
846 */
847static enum xp_retval
848xpc_setup_msg_structures_uv(struct xpc_channel *ch)
849{
850 static enum xp_retval ret;
851 struct xpc_channel_uv *ch_uv = &ch->sn.uv;
852
853 DBUG_ON(ch->flags & XPC_C_SETUP);
854
855 ret = xpc_allocate_send_msg_slot_uv(ch);
856 if (ret == xpSuccess) {
857
858 ret = xpc_allocate_recv_msg_slot_uv(ch);
859 if (ret != xpSuccess) {
860 kfree(ch_uv->send_msg_slots);
861 xpc_init_fifo_uv(&ch_uv->msg_slot_free_list);
862 }
863 }
864 return ret;
865}
866
867/*
868 * Free up msg_slots and clear other stuff that were setup for the specified
869 * channel.
870 */
871static void
872xpc_teardown_msg_structures_uv(struct xpc_channel *ch)
873{
874 struct xpc_channel_uv *ch_uv = &ch->sn.uv;
875
876 DBUG_ON(!spin_is_locked(&ch->lock));
877
878 ch_uv->remote_notify_mq_gpa = 0;
879
880 if (ch->flags & XPC_C_SETUP) {
881 xpc_init_fifo_uv(&ch_uv->msg_slot_free_list);
882 kfree(ch_uv->send_msg_slots);
883 xpc_init_fifo_uv(&ch_uv->recv_msg_list);
884 kfree(ch_uv->recv_msg_slots);
885 }
886}
887
888static void
889xpc_send_chctl_closerequest_uv(struct xpc_channel *ch, unsigned long *irq_flags)
890{
891 struct xpc_activate_mq_msg_chctl_closerequest_uv msg;
892
893 msg.ch_number = ch->number;
894 msg.reason = ch->reason;
895 xpc_send_activate_IRQ_ch_uv(ch, irq_flags, &msg, sizeof(msg),
896 XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV);
897}
898
899static void
900xpc_send_chctl_closereply_uv(struct xpc_channel *ch, unsigned long *irq_flags)
901{
902 struct xpc_activate_mq_msg_chctl_closereply_uv msg;
903
904 msg.ch_number = ch->number;
905 xpc_send_activate_IRQ_ch_uv(ch, irq_flags, &msg, sizeof(msg),
906 XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV);
907}
908
909static void
910xpc_send_chctl_openrequest_uv(struct xpc_channel *ch, unsigned long *irq_flags)
911{
912 struct xpc_activate_mq_msg_chctl_openrequest_uv msg;
913
914 msg.ch_number = ch->number;
915 msg.entry_size = ch->entry_size;
916 msg.local_nentries = ch->local_nentries;
917 xpc_send_activate_IRQ_ch_uv(ch, irq_flags, &msg, sizeof(msg),
918 XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV);
919}
920
921static void
922xpc_send_chctl_openreply_uv(struct xpc_channel *ch, unsigned long *irq_flags)
923{
924 struct xpc_activate_mq_msg_chctl_openreply_uv msg;
925
926 msg.ch_number = ch->number;
927 msg.local_nentries = ch->local_nentries;
928 msg.remote_nentries = ch->remote_nentries;
929 msg.local_notify_mq_gpa = uv_gpa(xpc_notify_mq_uv);
930 xpc_send_activate_IRQ_ch_uv(ch, irq_flags, &msg, sizeof(msg),
931 XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV);
932}
933
934static void
935xpc_send_chctl_local_msgrequest_uv(struct xpc_partition *part, int ch_number)
936{
937 unsigned long irq_flags;
938
939 spin_lock_irqsave(&part->chctl_lock, irq_flags);
940 part->chctl.flags[ch_number] |= XPC_CHCTL_MSGREQUEST;
941 spin_unlock_irqrestore(&part->chctl_lock, irq_flags);
942
943 xpc_wakeup_channel_mgr(part);
944}
945
946static void
947xpc_save_remote_msgqueue_pa_uv(struct xpc_channel *ch,
948 unsigned long msgqueue_pa)
949{
950 ch->sn.uv.remote_notify_mq_gpa = msgqueue_pa;
951}
952
953static void
954xpc_indicate_partition_engaged_uv(struct xpc_partition *part)
955{
956 struct xpc_activate_mq_msg_uv msg;
957
958 xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
959 XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV);
960}
961
962static void
963xpc_indicate_partition_disengaged_uv(struct xpc_partition *part)
964{
965 struct xpc_activate_mq_msg_uv msg;
966
967 xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg),
968 XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV);
969}
970
971static void
972xpc_assume_partition_disengaged_uv(short partid)
973{
974 struct xpc_partition_uv *part_uv = &xpc_partitions[partid].sn.uv;
975 unsigned long irq_flags;
976
977 spin_lock_irqsave(&part_uv->flags_lock, irq_flags);
978 part_uv->flags &= ~XPC_P_ENGAGED_UV;
979 spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags);
980}
981
982static int
983xpc_partition_engaged_uv(short partid)
984{
985 return (xpc_partitions[partid].sn.uv.flags & XPC_P_ENGAGED_UV) != 0;
986}
987
988static int
989xpc_any_partition_engaged_uv(void)
990{
991 struct xpc_partition_uv *part_uv;
992 short partid;
993
994 for (partid = 0; partid < XP_MAX_NPARTITIONS_UV; partid++) {
995 part_uv = &xpc_partitions[partid].sn.uv;
996 if ((part_uv->flags & XPC_P_ENGAGED_UV) != 0)
997 return 1;
998 }
999 return 0;
1000}
1001
1002static enum xp_retval
1003xpc_allocate_msg_slot_uv(struct xpc_channel *ch, u32 flags,
1004 struct xpc_send_msg_slot_uv **address_of_msg_slot)
1005{
1006 enum xp_retval ret;
1007 struct xpc_send_msg_slot_uv *msg_slot;
1008 struct xpc_fifo_entry_uv *entry;
1009
1010 while (1) {
1011 entry = xpc_get_fifo_entry_uv(&ch->sn.uv.msg_slot_free_list);
1012 if (entry != NULL)
1013 break;
1014
1015 if (flags & XPC_NOWAIT)
1016 return xpNoWait;
1017
1018 ret = xpc_allocate_msg_wait(ch);
1019 if (ret != xpInterrupted && ret != xpTimeout)
1020 return ret;
1021 }
1022
1023 msg_slot = container_of(entry, struct xpc_send_msg_slot_uv, next);
1024 *address_of_msg_slot = msg_slot;
1025 return xpSuccess;
1026}
1027
1028static void
1029xpc_free_msg_slot_uv(struct xpc_channel *ch,
1030 struct xpc_send_msg_slot_uv *msg_slot)
1031{
1032 xpc_put_fifo_entry_uv(&ch->sn.uv.msg_slot_free_list, &msg_slot->next);
1033
1034 /* wakeup anyone waiting for a free msg slot */
1035 if (atomic_read(&ch->n_on_msg_allocate_wq) > 0)
1036 wake_up(&ch->msg_allocate_wq);
1037}
1038
1039static void
1040xpc_notify_sender_uv(struct xpc_channel *ch,
1041 struct xpc_send_msg_slot_uv *msg_slot,
1042 enum xp_retval reason)
1043{
1044 xpc_notify_func func = msg_slot->func;
1045
1046 if (func != NULL && cmpxchg(&msg_slot->func, func, NULL) == func) {
1047
1048 atomic_dec(&ch->n_to_notify);
1049
1050 dev_dbg(xpc_chan, "msg_slot->func() called, msg_slot=0x%p "
1051 "msg_slot_number=%d partid=%d channel=%d\n", msg_slot,
1052 msg_slot->msg_slot_number, ch->partid, ch->number);
1053
1054 func(reason, ch->partid, ch->number, msg_slot->key);
1055
1056 dev_dbg(xpc_chan, "msg_slot->func() returned, msg_slot=0x%p "
1057 "msg_slot_number=%d partid=%d channel=%d\n", msg_slot,
1058 msg_slot->msg_slot_number, ch->partid, ch->number);
1059 }
1060}
1061
1062static void
1063xpc_handle_notify_mq_ack_uv(struct xpc_channel *ch,
1064 struct xpc_notify_mq_msg_uv *msg)
1065{
1066 struct xpc_send_msg_slot_uv *msg_slot;
1067 int entry = msg->hdr.msg_slot_number % ch->local_nentries;
1068
1069 msg_slot = &ch->sn.uv.send_msg_slots[entry];
1070
1071 BUG_ON(msg_slot->msg_slot_number != msg->hdr.msg_slot_number);
1072 msg_slot->msg_slot_number += ch->local_nentries;
1073
1074 if (msg_slot->func != NULL)
1075 xpc_notify_sender_uv(ch, msg_slot, xpMsgDelivered);
1076
1077 xpc_free_msg_slot_uv(ch, msg_slot);
1078}
1079
1080static void
1081xpc_handle_notify_mq_msg_uv(struct xpc_partition *part,
1082 struct xpc_notify_mq_msg_uv *msg)
1083{
1084 struct xpc_partition_uv *part_uv = &part->sn.uv;
1085 struct xpc_channel *ch;
1086 struct xpc_channel_uv *ch_uv;
1087 struct xpc_notify_mq_msg_uv *msg_slot;
1088 unsigned long irq_flags;
1089 int ch_number = msg->hdr.ch_number;
1090
1091 if (unlikely(ch_number >= part->nchannels)) {
1092 dev_err(xpc_part, "xpc_handle_notify_IRQ_uv() received invalid "
1093 "channel number=0x%x in message from partid=%d\n",
1094 ch_number, XPC_PARTID(part));
1095
1096 /* get hb checker to deactivate from the remote partition */
1097 spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags);
1098 if (part_uv->act_state_req == 0)
1099 xpc_activate_IRQ_rcvd++;
1100 part_uv->act_state_req = XPC_P_ASR_DEACTIVATE_UV;
1101 part_uv->reason = xpBadChannelNumber;
1102 spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags);
1103
1104 wake_up_interruptible(&xpc_activate_IRQ_wq);
1105 return;
1106 }
1107
1108 ch = &part->channels[ch_number];
1109 xpc_msgqueue_ref(ch);
1110
1111 if (!(ch->flags & XPC_C_CONNECTED)) {
1112 xpc_msgqueue_deref(ch);
1113 return;
1114 }
1115
1116 /* see if we're really dealing with an ACK for a previously sent msg */
1117 if (msg->hdr.size == 0) {
1118 xpc_handle_notify_mq_ack_uv(ch, msg);
1119 xpc_msgqueue_deref(ch);
1120 return;
1121 }
1122
1123 /* we're dealing with a normal message sent via the notify_mq */
1124 ch_uv = &ch->sn.uv;
1125
1126 msg_slot = (struct xpc_notify_mq_msg_uv *)((u64)ch_uv->recv_msg_slots +
1127 (msg->hdr.msg_slot_number % ch->remote_nentries) *
1128 ch->entry_size);
1129
1130 BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number);
1131 BUG_ON(msg_slot->hdr.size != 0);
1132
1133 memcpy(msg_slot, msg, msg->hdr.size);
1134
1135 xpc_put_fifo_entry_uv(&ch_uv->recv_msg_list, &msg_slot->hdr.u.next);
1136
1137 if (ch->flags & XPC_C_CONNECTEDCALLOUT_MADE) {
1138 /*
1139 * If there is an existing idle kthread get it to deliver
1140 * the payload, otherwise we'll have to get the channel mgr
1141 * for this partition to create a kthread to do the delivery.
1142 */
1143 if (atomic_read(&ch->kthreads_idle) > 0)
1144 wake_up_nr(&ch->idle_wq, 1);
1145 else
1146 xpc_send_chctl_local_msgrequest_uv(part, ch->number);
1147 }
1148 xpc_msgqueue_deref(ch);
1149}
1150
1151static irqreturn_t
1152xpc_handle_notify_IRQ_uv(int irq, void *dev_id)
1153{
1154 struct xpc_notify_mq_msg_uv *msg;
1155 short partid;
1156 struct xpc_partition *part;
1157
1158 while ((msg = gru_get_next_message(xpc_notify_mq_uv)) != NULL) {
1159
1160 partid = msg->hdr.partid;
1161 if (partid < 0 || partid >= XP_MAX_NPARTITIONS_UV) {
1162 dev_err(xpc_part, "xpc_handle_notify_IRQ_uv() received "
1163 "invalid partid=0x%x in message\n", partid);
1164 } else {
1165 part = &xpc_partitions[partid];
1166
1167 if (xpc_part_ref(part)) {
1168 xpc_handle_notify_mq_msg_uv(part, msg);
1169 xpc_part_deref(part);
1170 }
1171 }
1172
1173 gru_free_message(xpc_notify_mq_uv, msg);
1174 }
1175
1176 return IRQ_HANDLED;
1177}
1178
1179static int
1180xpc_n_of_deliverable_payloads_uv(struct xpc_channel *ch)
1181{
1182 return xpc_n_of_fifo_entries_uv(&ch->sn.uv.recv_msg_list);
1183}
1184
1185static void
1186xpc_process_msg_chctl_flags_uv(struct xpc_partition *part, int ch_number)
1187{
1188 struct xpc_channel *ch = &part->channels[ch_number];
1189 int ndeliverable_payloads;
1190
1191 xpc_msgqueue_ref(ch);
1192
1193 ndeliverable_payloads = xpc_n_of_deliverable_payloads_uv(ch);
1194
1195 if (ndeliverable_payloads > 0 &&
1196 (ch->flags & XPC_C_CONNECTED) &&
1197 (ch->flags & XPC_C_CONNECTEDCALLOUT_MADE)) {
1198
1199 xpc_activate_kthreads(ch, ndeliverable_payloads);
1200 }
1201
1202 xpc_msgqueue_deref(ch);
1203}
1204
1205static enum xp_retval
1206xpc_send_payload_uv(struct xpc_channel *ch, u32 flags, void *payload,
1207 u16 payload_size, u8 notify_type, xpc_notify_func func,
1208 void *key)
1209{
1210 enum xp_retval ret = xpSuccess;
1211 struct xpc_send_msg_slot_uv *msg_slot = NULL;
1212 struct xpc_notify_mq_msg_uv *msg;
1213 u8 msg_buffer[XPC_NOTIFY_MSG_SIZE_UV];
1214 size_t msg_size;
1215
1216 DBUG_ON(notify_type != XPC_N_CALL);
1217
1218 msg_size = sizeof(struct xpc_notify_mq_msghdr_uv) + payload_size;
1219 if (msg_size > ch->entry_size)
1220 return xpPayloadTooBig;
1221
1222 xpc_msgqueue_ref(ch);
1223
1224 if (ch->flags & XPC_C_DISCONNECTING) {
1225 ret = ch->reason;
1226 goto out_1;
1227 }
1228 if (!(ch->flags & XPC_C_CONNECTED)) {
1229 ret = xpNotConnected;
1230 goto out_1;
1231 }
1232
1233 ret = xpc_allocate_msg_slot_uv(ch, flags, &msg_slot);
1234 if (ret != xpSuccess)
1235 goto out_1;
1236
1237 if (func != NULL) {
1238 atomic_inc(&ch->n_to_notify);
1239
1240 msg_slot->key = key;
1241 wmb(); /* a non-NULL func must hit memory after the key */
1242 msg_slot->func = func;
1243
1244 if (ch->flags & XPC_C_DISCONNECTING) {
1245 ret = ch->reason;
1246 goto out_2;
1247 }
1248 }
1249
1250 msg = (struct xpc_notify_mq_msg_uv *)&msg_buffer;
1251 msg->hdr.partid = xp_partition_id;
1252 msg->hdr.ch_number = ch->number;
1253 msg->hdr.size = msg_size;
1254 msg->hdr.msg_slot_number = msg_slot->msg_slot_number;
1255 memcpy(&msg->payload, payload, payload_size);
1256
1257 ret = xpc_send_gru_msg(ch->sn.uv.remote_notify_mq_gpa, msg, msg_size);
1258 if (ret == xpSuccess)
1259 goto out_1;
1260
1261 XPC_DEACTIVATE_PARTITION(&xpc_partitions[ch->partid], ret);
1262out_2:
1263 if (func != NULL) {
1264 /*
1265 * Try to NULL the msg_slot's func field. If we fail, then
1266 * xpc_notify_senders_of_disconnect_uv() beat us to it, in which
1267 * case we need to pretend we succeeded to send the message
1268 * since the user will get a callout for the disconnect error
1269 * by xpc_notify_senders_of_disconnect_uv(), and to also get an
1270 * error returned here will confuse them. Additionally, since
1271 * in this case the channel is being disconnected we don't need
1272 * to put the the msg_slot back on the free list.
1273 */
1274 if (cmpxchg(&msg_slot->func, func, NULL) != func) {
1275 ret = xpSuccess;
1276 goto out_1;
1277 }
1278
1279 msg_slot->key = NULL;
1280 atomic_dec(&ch->n_to_notify);
1281 }
1282 xpc_free_msg_slot_uv(ch, msg_slot);
1283out_1:
1284 xpc_msgqueue_deref(ch);
1285 return ret;
1286}
1287
1288/*
1289 * Tell the callers of xpc_send_notify() that the status of their payloads
1290 * is unknown because the channel is now disconnecting.
1291 *
1292 * We don't worry about putting these msg_slots on the free list since the
1293 * msg_slots themselves are about to be kfree'd.
1294 */
1295static void
1296xpc_notify_senders_of_disconnect_uv(struct xpc_channel *ch)
1297{
1298 struct xpc_send_msg_slot_uv *msg_slot;
1299 int entry;
1300
1301 DBUG_ON(!(ch->flags & XPC_C_DISCONNECTING));
1302
1303 for (entry = 0; entry < ch->local_nentries; entry++) {
1304
1305 if (atomic_read(&ch->n_to_notify) == 0)
1306 break;
1307
1308 msg_slot = &ch->sn.uv.send_msg_slots[entry];
1309 if (msg_slot->func != NULL)
1310 xpc_notify_sender_uv(ch, msg_slot, ch->reason);
1311 }
1312}
1313
1314/*
1315 * Get the next deliverable message's payload.
1316 */
1317static void *
1318xpc_get_deliverable_payload_uv(struct xpc_channel *ch)
1319{
1320 struct xpc_fifo_entry_uv *entry;
1321 struct xpc_notify_mq_msg_uv *msg;
1322 void *payload = NULL;
1323
1324 if (!(ch->flags & XPC_C_DISCONNECTING)) {
1325 entry = xpc_get_fifo_entry_uv(&ch->sn.uv.recv_msg_list);
1326 if (entry != NULL) {
1327 msg = container_of(entry, struct xpc_notify_mq_msg_uv,
1328 hdr.u.next);
1329 payload = &msg->payload;
1330 }
1331 }
1332 return payload;
1333}
1334
1335static void
1336xpc_received_payload_uv(struct xpc_channel *ch, void *payload)
1337{
1338 struct xpc_notify_mq_msg_uv *msg;
1339 enum xp_retval ret;
1340
1341 msg = container_of(payload, struct xpc_notify_mq_msg_uv, payload);
1342
1343 /* return an ACK to the sender of this message */
1344
1345 msg->hdr.partid = xp_partition_id;
1346 msg->hdr.size = 0; /* size of zero indicates this is an ACK */
1347
1348 ret = xpc_send_gru_msg(ch->sn.uv.remote_notify_mq_gpa, msg,
1349 sizeof(struct xpc_notify_mq_msghdr_uv));
1350 if (ret != xpSuccess)
1351 XPC_DEACTIVATE_PARTITION(&xpc_partitions[ch->partid], ret);
1352
1353 msg->hdr.msg_slot_number += ch->remote_nentries;
1354}
1355
1356int
1357xpc_init_uv(void)
1358{
1359 xpc_setup_partitions_sn = xpc_setup_partitions_sn_uv;
1360 xpc_process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_uv;
1361 xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_uv;
1362 xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_uv;
1363 xpc_increment_heartbeat = xpc_increment_heartbeat_uv;
1364 xpc_offline_heartbeat = xpc_offline_heartbeat_uv;
1365 xpc_online_heartbeat = xpc_online_heartbeat_uv;
1366 xpc_heartbeat_init = xpc_heartbeat_init_uv;
1367 xpc_heartbeat_exit = xpc_heartbeat_exit_uv;
1368 xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_uv;
1369
1370 xpc_request_partition_activation = xpc_request_partition_activation_uv;
1371 xpc_request_partition_reactivation =
1372 xpc_request_partition_reactivation_uv;
1373 xpc_request_partition_deactivation =
1374 xpc_request_partition_deactivation_uv;
1375 xpc_cancel_partition_deactivation_request =
1376 xpc_cancel_partition_deactivation_request_uv;
1377
1378 xpc_setup_ch_structures_sn = xpc_setup_ch_structures_sn_uv;
1379 xpc_teardown_ch_structures_sn = xpc_teardown_ch_structures_sn_uv;
1380
1381 xpc_make_first_contact = xpc_make_first_contact_uv;
1382
1383 xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_uv;
1384 xpc_send_chctl_closerequest = xpc_send_chctl_closerequest_uv;
1385 xpc_send_chctl_closereply = xpc_send_chctl_closereply_uv;
1386 xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_uv;
1387 xpc_send_chctl_openreply = xpc_send_chctl_openreply_uv;
1388
1389 xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_uv;
1390
1391 xpc_setup_msg_structures = xpc_setup_msg_structures_uv;
1392 xpc_teardown_msg_structures = xpc_teardown_msg_structures_uv;
1393
1394 xpc_indicate_partition_engaged = xpc_indicate_partition_engaged_uv;
1395 xpc_indicate_partition_disengaged =
1396 xpc_indicate_partition_disengaged_uv;
1397 xpc_assume_partition_disengaged = xpc_assume_partition_disengaged_uv;
1398 xpc_partition_engaged = xpc_partition_engaged_uv;
1399 xpc_any_partition_engaged = xpc_any_partition_engaged_uv;
1400
1401 xpc_n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_uv;
1402 xpc_process_msg_chctl_flags = xpc_process_msg_chctl_flags_uv;
1403 xpc_send_payload = xpc_send_payload_uv;
1404 xpc_notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv;
1405 xpc_get_deliverable_payload = xpc_get_deliverable_payload_uv;
1406 xpc_received_payload = xpc_received_payload_uv;
1407
1408 if (sizeof(struct xpc_notify_mq_msghdr_uv) > XPC_MSG_HDR_MAX_SIZE) {
1409 dev_err(xpc_part, "xpc_notify_mq_msghdr_uv is larger than %d\n",
1410 XPC_MSG_HDR_MAX_SIZE);
1411 return -E2BIG;
1412 }
1413
1414 /* ??? The cpuid argument's value is 0, is that what we want? */
1415 /* !!! The irq argument's value isn't correct. */
1416 xpc_activate_mq_uv = xpc_create_gru_mq_uv(XPC_ACTIVATE_MQ_SIZE_UV, 0, 0,
1417 xpc_handle_activate_IRQ_uv);
1418 if (xpc_activate_mq_uv == NULL)
1419 return -ENOMEM;
1420
1421 /* ??? The cpuid argument's value is 0, is that what we want? */
1422 /* !!! The irq argument's value isn't correct. */
1423 xpc_notify_mq_uv = xpc_create_gru_mq_uv(XPC_NOTIFY_MQ_SIZE_UV, 0, 0,
1424 xpc_handle_notify_IRQ_uv);
1425 if (xpc_notify_mq_uv == NULL) {
1426 /* !!! The irq argument's value isn't correct. */
1427 xpc_destroy_gru_mq_uv(xpc_activate_mq_uv,
1428 XPC_ACTIVATE_MQ_SIZE_UV, 0);
1429 return -ENOMEM;
1430 }
1431
1432 return 0;
1433}
1434
1435void
1436xpc_exit_uv(void)
1437{
1438 /* !!! The irq argument's value isn't correct. */
1439 xpc_destroy_gru_mq_uv(xpc_notify_mq_uv, XPC_NOTIFY_MQ_SIZE_UV, 0);
1440
1441 /* !!! The irq argument's value isn't correct. */
1442 xpc_destroy_gru_mq_uv(xpc_activate_mq_uv, XPC_ACTIVATE_MQ_SIZE_UV, 0);
1443}
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c
index 822dc8e8d7f0..71513b3af708 100644
--- a/drivers/misc/sgi-xp/xpnet.c
+++ b/drivers/misc/sgi-xp/xpnet.c
@@ -21,21 +21,8 @@
21 */ 21 */
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/types.h>
25#include <linux/kernel.h>
26#include <linux/init.h>
27#include <linux/ioport.h>
28#include <linux/netdevice.h> 24#include <linux/netdevice.h>
29#include <linux/etherdevice.h> 25#include <linux/etherdevice.h>
30#include <linux/delay.h>
31#include <linux/ethtool.h>
32#include <linux/mii.h>
33#include <linux/smp.h>
34#include <linux/string.h>
35#include <asm/sn/bte.h>
36#include <asm/sn/io.h>
37#include <asm/sn/sn_sal.h>
38#include <asm/atomic.h>
39#include "xp.h" 26#include "xp.h"
40 27
41/* 28/*
@@ -57,7 +44,7 @@ struct xpnet_message {
57 u16 version; /* Version for this message */ 44 u16 version; /* Version for this message */
58 u16 embedded_bytes; /* #of bytes embedded in XPC message */ 45 u16 embedded_bytes; /* #of bytes embedded in XPC message */
59 u32 magic; /* Special number indicating this is xpnet */ 46 u32 magic; /* Special number indicating this is xpnet */
60 u64 buf_pa; /* phys address of buffer to retrieve */ 47 unsigned long buf_pa; /* phys address of buffer to retrieve */
61 u32 size; /* #of bytes in buffer */ 48 u32 size; /* #of bytes in buffer */
62 u8 leadin_ignore; /* #of bytes to ignore at the beginning */ 49 u8 leadin_ignore; /* #of bytes to ignore at the beginning */
63 u8 tailout_ignore; /* #of bytes to ignore at the end */ 50 u8 tailout_ignore; /* #of bytes to ignore at the end */
@@ -70,11 +57,10 @@ struct xpnet_message {
70 * 57 *
71 * XPC expects each message to exist in an individual cacheline. 58 * XPC expects each message to exist in an individual cacheline.
72 */ 59 */
73#define XPNET_MSG_SIZE (L1_CACHE_BYTES - XPC_MSG_PAYLOAD_OFFSET) 60#define XPNET_MSG_SIZE XPC_MSG_PAYLOAD_MAX_SIZE
74#define XPNET_MSG_DATA_MAX \ 61#define XPNET_MSG_DATA_MAX \
75 (XPNET_MSG_SIZE - (u64)(&((struct xpnet_message *)0)->data)) 62 (XPNET_MSG_SIZE - offsetof(struct xpnet_message, data))
76#define XPNET_MSG_ALIGNED_SIZE (L1_CACHE_ALIGN(XPNET_MSG_SIZE)) 63#define XPNET_MSG_NENTRIES (PAGE_SIZE / XPC_MSG_MAX_SIZE)
77#define XPNET_MSG_NENTRIES (PAGE_SIZE / XPNET_MSG_ALIGNED_SIZE)
78 64
79#define XPNET_MAX_KTHREADS (XPNET_MSG_NENTRIES + 1) 65#define XPNET_MAX_KTHREADS (XPNET_MSG_NENTRIES + 1)
80#define XPNET_MAX_IDLE_KTHREADS (XPNET_MSG_NENTRIES + 1) 66#define XPNET_MAX_IDLE_KTHREADS (XPNET_MSG_NENTRIES + 1)
@@ -105,7 +91,6 @@ struct xpnet_message {
105 * then be released. 91 * then be released.
106 */ 92 */
107struct xpnet_pending_msg { 93struct xpnet_pending_msg {
108 struct list_head free_list;
109 struct sk_buff *skb; 94 struct sk_buff *skb;
110 atomic_t use_count; 95 atomic_t use_count;
111}; 96};
@@ -121,7 +106,7 @@ struct net_device *xpnet_device;
121 * When we are notified of other partitions activating, we add them to 106 * When we are notified of other partitions activating, we add them to
122 * our bitmask of partitions to which we broadcast. 107 * our bitmask of partitions to which we broadcast.
123 */ 108 */
124static u64 xpnet_broadcast_partitions; 109static unsigned long *xpnet_broadcast_partitions;
125/* protect above */ 110/* protect above */
126static DEFINE_SPINLOCK(xpnet_broadcast_lock); 111static DEFINE_SPINLOCK(xpnet_broadcast_lock);
127 112
@@ -141,16 +126,13 @@ static DEFINE_SPINLOCK(xpnet_broadcast_lock);
141#define XPNET_DEF_MTU (0x8000UL) 126#define XPNET_DEF_MTU (0x8000UL)
142 127
143/* 128/*
144 * The partition id is encapsulated in the MAC address. The following 129 * The partid is encapsulated in the MAC address beginning in the following
145 * define locates the octet the partid is in. 130 * octet and it consists of two octets.
146 */ 131 */
147#define XPNET_PARTID_OCTET 1 132#define XPNET_PARTID_OCTET 2
148#define XPNET_LICENSE_OCTET 2 133
134/* Define the XPNET debug device structures to be used with dev_dbg() et al */
149 135
150/*
151 * Define the XPNET debug device structure that is to be used with dev_dbg(),
152 * dev_err(), dev_warn(), and dev_info().
153 */
154struct device_driver xpnet_dbg_name = { 136struct device_driver xpnet_dbg_name = {
155 .name = "xpnet" 137 .name = "xpnet"
156}; 138};
@@ -169,7 +151,8 @@ static void
169xpnet_receive(short partid, int channel, struct xpnet_message *msg) 151xpnet_receive(short partid, int channel, struct xpnet_message *msg)
170{ 152{
171 struct sk_buff *skb; 153 struct sk_buff *skb;
172 bte_result_t bret; 154 void *dst;
155 enum xp_retval ret;
173 struct xpnet_dev_private *priv = 156 struct xpnet_dev_private *priv =
174 (struct xpnet_dev_private *)xpnet_device->priv; 157 (struct xpnet_dev_private *)xpnet_device->priv;
175 158
@@ -201,7 +184,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
201 184
202 /* 185 /*
203 * The allocated skb has some reserved space. 186 * The allocated skb has some reserved space.
204 * In order to use bte_copy, we need to get the 187 * In order to use xp_remote_memcpy(), we need to get the
205 * skb->data pointer moved forward. 188 * skb->data pointer moved forward.
206 */ 189 */
207 skb_reserve(skb, (L1_CACHE_BYTES - ((u64)skb->data & 190 skb_reserve(skb, (L1_CACHE_BYTES - ((u64)skb->data &
@@ -226,26 +209,21 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg)
226 skb_copy_to_linear_data(skb, &msg->data, 209 skb_copy_to_linear_data(skb, &msg->data,
227 (size_t)msg->embedded_bytes); 210 (size_t)msg->embedded_bytes);
228 } else { 211 } else {
212 dst = (void *)((u64)skb->data & ~(L1_CACHE_BYTES - 1));
229 dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t" 213 dev_dbg(xpnet, "transferring buffer to the skb->data area;\n\t"
230 "bte_copy(0x%p, 0x%p, %hu)\n", (void *)msg->buf_pa, 214 "xp_remote_memcpy(0x%p, 0x%p, %hu)\n", dst,
231 (void *)__pa((u64)skb->data & ~(L1_CACHE_BYTES - 1)), 215 (void *)msg->buf_pa, msg->size);
232 msg->size);
233
234 bret = bte_copy(msg->buf_pa,
235 __pa((u64)skb->data & ~(L1_CACHE_BYTES - 1)),
236 msg->size, (BTE_NOTIFY | BTE_WACQUIRE), NULL);
237 216
238 if (bret != BTE_SUCCESS) { 217 ret = xp_remote_memcpy(xp_pa(dst), msg->buf_pa, msg->size);
218 if (ret != xpSuccess) {
239 /* 219 /*
240 * >>> Need better way of cleaning skb. Currently skb 220 * !!! Need better way of cleaning skb. Currently skb
241 * >>> appears in_use and we can't just call 221 * !!! appears in_use and we can't just call
242 * >>> dev_kfree_skb. 222 * !!! dev_kfree_skb.
243 */ 223 */
244 dev_err(xpnet, "bte_copy(0x%p, 0x%p, 0x%hx) returned " 224 dev_err(xpnet, "xp_remote_memcpy(0x%p, 0x%p, 0x%hx) "
245 "error=0x%x\n", (void *)msg->buf_pa, 225 "returned error=0x%x\n", dst,
246 (void *)__pa((u64)skb->data & 226 (void *)msg->buf_pa, msg->size, ret);
247 ~(L1_CACHE_BYTES - 1)),
248 msg->size, bret);
249 227
250 xpc_received(partid, channel, (void *)msg); 228 xpc_received(partid, channel, (void *)msg);
251 229
@@ -285,9 +263,7 @@ static void
285xpnet_connection_activity(enum xp_retval reason, short partid, int channel, 263xpnet_connection_activity(enum xp_retval reason, short partid, int channel,
286 void *data, void *key) 264 void *data, void *key)
287{ 265{
288 long bp; 266 DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
289
290 DBUG_ON(partid <= 0 || partid >= XP_MAX_PARTITIONS);
291 DBUG_ON(channel != XPC_NET_CHANNEL); 267 DBUG_ON(channel != XPC_NET_CHANNEL);
292 268
293 switch (reason) { 269 switch (reason) {
@@ -299,31 +275,28 @@ xpnet_connection_activity(enum xp_retval reason, short partid, int channel,
299 275
300 case xpConnected: /* connection completed to a partition */ 276 case xpConnected: /* connection completed to a partition */
301 spin_lock_bh(&xpnet_broadcast_lock); 277 spin_lock_bh(&xpnet_broadcast_lock);
302 xpnet_broadcast_partitions |= 1UL << (partid - 1); 278 __set_bit(partid, xpnet_broadcast_partitions);
303 bp = xpnet_broadcast_partitions;
304 spin_unlock_bh(&xpnet_broadcast_lock); 279 spin_unlock_bh(&xpnet_broadcast_lock);
305 280
306 netif_carrier_on(xpnet_device); 281 netif_carrier_on(xpnet_device);
307 282
308 dev_dbg(xpnet, "%s connection created to partition %d; " 283 dev_dbg(xpnet, "%s connected to partition %d\n",
309 "xpnet_broadcast_partitions=0x%lx\n", 284 xpnet_device->name, partid);
310 xpnet_device->name, partid, bp);
311 break; 285 break;
312 286
313 default: 287 default:
314 spin_lock_bh(&xpnet_broadcast_lock); 288 spin_lock_bh(&xpnet_broadcast_lock);
315 xpnet_broadcast_partitions &= ~(1UL << (partid - 1)); 289 __clear_bit(partid, xpnet_broadcast_partitions);
316 bp = xpnet_broadcast_partitions;
317 spin_unlock_bh(&xpnet_broadcast_lock); 290 spin_unlock_bh(&xpnet_broadcast_lock);
318 291
319 if (bp == 0) 292 if (bitmap_empty((unsigned long *)xpnet_broadcast_partitions,
293 xp_max_npartitions)) {
320 netif_carrier_off(xpnet_device); 294 netif_carrier_off(xpnet_device);
295 }
321 296
322 dev_dbg(xpnet, "%s disconnected from partition %d; " 297 dev_dbg(xpnet, "%s disconnected from partition %d\n",
323 "xpnet_broadcast_partitions=0x%lx\n", 298 xpnet_device->name, partid);
324 xpnet_device->name, partid, bp);
325 break; 299 break;
326
327 } 300 }
328} 301}
329 302
@@ -334,8 +307,10 @@ xpnet_dev_open(struct net_device *dev)
334 307
335 dev_dbg(xpnet, "calling xpc_connect(%d, 0x%p, NULL, %ld, %ld, %ld, " 308 dev_dbg(xpnet, "calling xpc_connect(%d, 0x%p, NULL, %ld, %ld, %ld, "
336 "%ld)\n", XPC_NET_CHANNEL, xpnet_connection_activity, 309 "%ld)\n", XPC_NET_CHANNEL, xpnet_connection_activity,
337 XPNET_MSG_SIZE, XPNET_MSG_NENTRIES, XPNET_MAX_KTHREADS, 310 (unsigned long)XPNET_MSG_SIZE,
338 XPNET_MAX_IDLE_KTHREADS); 311 (unsigned long)XPNET_MSG_NENTRIES,
312 (unsigned long)XPNET_MAX_KTHREADS,
313 (unsigned long)XPNET_MAX_IDLE_KTHREADS);
339 314
340 ret = xpc_connect(XPC_NET_CHANNEL, xpnet_connection_activity, NULL, 315 ret = xpc_connect(XPC_NET_CHANNEL, xpnet_connection_activity, NULL,
341 XPNET_MSG_SIZE, XPNET_MSG_NENTRIES, 316 XPNET_MSG_SIZE, XPNET_MSG_NENTRIES,
@@ -426,35 +401,74 @@ xpnet_send_completed(enum xp_retval reason, short partid, int channel,
426 } 401 }
427} 402}
428 403
404static void
405xpnet_send(struct sk_buff *skb, struct xpnet_pending_msg *queued_msg,
406 u64 start_addr, u64 end_addr, u16 embedded_bytes, int dest_partid)
407{
408 u8 msg_buffer[XPNET_MSG_SIZE];
409 struct xpnet_message *msg = (struct xpnet_message *)&msg_buffer;
410 u16 msg_size = sizeof(struct xpnet_message);
411 enum xp_retval ret;
412
413 msg->embedded_bytes = embedded_bytes;
414 if (unlikely(embedded_bytes != 0)) {
415 msg->version = XPNET_VERSION_EMBED;
416 dev_dbg(xpnet, "calling memcpy(0x%p, 0x%p, 0x%lx)\n",
417 &msg->data, skb->data, (size_t)embedded_bytes);
418 skb_copy_from_linear_data(skb, &msg->data,
419 (size_t)embedded_bytes);
420 msg_size += embedded_bytes - 1;
421 } else {
422 msg->version = XPNET_VERSION;
423 }
424 msg->magic = XPNET_MAGIC;
425 msg->size = end_addr - start_addr;
426 msg->leadin_ignore = (u64)skb->data - start_addr;
427 msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb);
428 msg->buf_pa = xp_pa((void *)start_addr);
429
430 dev_dbg(xpnet, "sending XPC message to %d:%d\n"
431 KERN_DEBUG "msg->buf_pa=0x%lx, msg->size=%u, "
432 "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n",
433 dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size,
434 msg->leadin_ignore, msg->tailout_ignore);
435
436 atomic_inc(&queued_msg->use_count);
437
438 ret = xpc_send_notify(dest_partid, XPC_NET_CHANNEL, XPC_NOWAIT, msg,
439 msg_size, xpnet_send_completed, queued_msg);
440 if (unlikely(ret != xpSuccess))
441 atomic_dec(&queued_msg->use_count);
442}
443
429/* 444/*
430 * Network layer has formatted a packet (skb) and is ready to place it 445 * Network layer has formatted a packet (skb) and is ready to place it
431 * "on the wire". Prepare and send an xpnet_message to all partitions 446 * "on the wire". Prepare and send an xpnet_message to all partitions
432 * which have connected with us and are targets of this packet. 447 * which have connected with us and are targets of this packet.
433 * 448 *
434 * MAC-NOTE: For the XPNET driver, the MAC address contains the 449 * MAC-NOTE: For the XPNET driver, the MAC address contains the
435 * destination partition_id. If the destination partition id word 450 * destination partid. If the destination partid octets are 0xffff,
436 * is 0xff, this packet is to broadcast to all partitions. 451 * this packet is to be broadcast to all connected partitions.
437 */ 452 */
438static int 453static int
439xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) 454xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
440{ 455{
441 struct xpnet_pending_msg *queued_msg; 456 struct xpnet_pending_msg *queued_msg;
442 enum xp_retval ret;
443 struct xpnet_message *msg;
444 u64 start_addr, end_addr; 457 u64 start_addr, end_addr;
445 long dp;
446 u8 second_mac_octet;
447 short dest_partid; 458 short dest_partid;
448 struct xpnet_dev_private *priv; 459 struct xpnet_dev_private *priv = (struct xpnet_dev_private *)dev->priv;
449 u16 embedded_bytes; 460 u16 embedded_bytes = 0;
450
451 priv = (struct xpnet_dev_private *)dev->priv;
452 461
453 dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p " 462 dev_dbg(xpnet, ">skb->head=0x%p skb->data=0x%p skb->tail=0x%p "
454 "skb->end=0x%p skb->len=%d\n", (void *)skb->head, 463 "skb->end=0x%p skb->len=%d\n", (void *)skb->head,
455 (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb), 464 (void *)skb->data, skb_tail_pointer(skb), skb_end_pointer(skb),
456 skb->len); 465 skb->len);
457 466
467 if (skb->data[0] == 0x33) {
468 dev_kfree_skb(skb);
469 return 0; /* nothing needed to be done */
470 }
471
458 /* 472 /*
459 * The xpnet_pending_msg tracks how many outstanding 473 * The xpnet_pending_msg tracks how many outstanding
460 * xpc_send_notifies are relying on this skb. When none 474 * xpc_send_notifies are relying on this skb. When none
@@ -466,7 +480,6 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
466 "packet\n", sizeof(struct xpnet_pending_msg)); 480 "packet\n", sizeof(struct xpnet_pending_msg));
467 481
468 priv->stats.tx_errors++; 482 priv->stats.tx_errors++;
469
470 return -ENOMEM; 483 return -ENOMEM;
471 } 484 }
472 485
@@ -475,7 +488,6 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
475 end_addr = L1_CACHE_ALIGN((u64)skb_tail_pointer(skb)); 488 end_addr = L1_CACHE_ALIGN((u64)skb_tail_pointer(skb));
476 489
477 /* calculate how many bytes to embed in the XPC message */ 490 /* calculate how many bytes to embed in the XPC message */
478 embedded_bytes = 0;
479 if (unlikely(skb->len <= XPNET_MSG_DATA_MAX)) { 491 if (unlikely(skb->len <= XPNET_MSG_DATA_MAX)) {
480 /* skb->data does fit so embed */ 492 /* skb->data does fit so embed */
481 embedded_bytes = skb->len; 493 embedded_bytes = skb->len;
@@ -491,82 +503,28 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
491 atomic_set(&queued_msg->use_count, 1); 503 atomic_set(&queued_msg->use_count, 1);
492 queued_msg->skb = skb; 504 queued_msg->skb = skb;
493 505
494 second_mac_octet = skb->data[XPNET_PARTID_OCTET]; 506 if (skb->data[0] == 0xff) {
495 if (second_mac_octet == 0xff) {
496 /* we are being asked to broadcast to all partitions */ 507 /* we are being asked to broadcast to all partitions */
497 dp = xpnet_broadcast_partitions; 508 for_each_bit(dest_partid, xpnet_broadcast_partitions,
498 } else if (second_mac_octet != 0) { 509 xp_max_npartitions) {
499 dp = xpnet_broadcast_partitions &
500 (1UL << (second_mac_octet - 1));
501 } else {
502 /* 0 is an invalid partid. Ignore */
503 dp = 0;
504 }
505 dev_dbg(xpnet, "destination Partitions mask (dp) = 0x%lx\n", dp);
506
507 /*
508 * If we wanted to allow promiscuous mode to work like an
509 * unswitched network, this would be a good point to OR in a
510 * mask of partitions which should be receiving all packets.
511 */
512
513 /*
514 * Main send loop.
515 */
516 for (dest_partid = 1; dp && dest_partid < XP_MAX_PARTITIONS;
517 dest_partid++) {
518 510
519 if (!(dp & (1UL << (dest_partid - 1)))) { 511 xpnet_send(skb, queued_msg, start_addr, end_addr,
520 /* not destined for this partition */ 512 embedded_bytes, dest_partid);
521 continue;
522 } 513 }
514 } else {
515 dest_partid = (short)skb->data[XPNET_PARTID_OCTET + 1];
516 dest_partid |= (short)skb->data[XPNET_PARTID_OCTET + 0] << 8;
523 517
524 /* remove this partition from the destinations mask */ 518 if (dest_partid >= 0 &&
525 dp &= ~(1UL << (dest_partid - 1)); 519 dest_partid < xp_max_npartitions &&
526 520 test_bit(dest_partid, xpnet_broadcast_partitions) != 0) {
527 /* found a partition to send to */ 521
528 522 xpnet_send(skb, queued_msg, start_addr, end_addr,
529 ret = xpc_allocate(dest_partid, XPC_NET_CHANNEL, 523 embedded_bytes, dest_partid);
530 XPC_NOWAIT, (void **)&msg);
531 if (unlikely(ret != xpSuccess))
532 continue;
533
534 msg->embedded_bytes = embedded_bytes;
535 if (unlikely(embedded_bytes != 0)) {
536 msg->version = XPNET_VERSION_EMBED;
537 dev_dbg(xpnet, "calling memcpy(0x%p, 0x%p, 0x%lx)\n",
538 &msg->data, skb->data, (size_t)embedded_bytes);
539 skb_copy_from_linear_data(skb, &msg->data,
540 (size_t)embedded_bytes);
541 } else {
542 msg->version = XPNET_VERSION;
543 }
544 msg->magic = XPNET_MAGIC;
545 msg->size = end_addr - start_addr;
546 msg->leadin_ignore = (u64)skb->data - start_addr;
547 msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb);
548 msg->buf_pa = __pa(start_addr);
549
550 dev_dbg(xpnet, "sending XPC message to %d:%d\n"
551 KERN_DEBUG "msg->buf_pa=0x%lx, msg->size=%u, "
552 "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n",
553 dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size,
554 msg->leadin_ignore, msg->tailout_ignore);
555
556 atomic_inc(&queued_msg->use_count);
557
558 ret = xpc_send_notify(dest_partid, XPC_NET_CHANNEL, msg,
559 xpnet_send_completed, queued_msg);
560 if (unlikely(ret != xpSuccess)) {
561 atomic_dec(&queued_msg->use_count);
562 continue;
563 } 524 }
564 } 525 }
565 526
566 if (atomic_dec_return(&queued_msg->use_count) == 0) { 527 if (atomic_dec_return(&queued_msg->use_count) == 0) {
567 dev_dbg(xpnet, "no partitions to receive packet destined for "
568 "%d\n", dest_partid);
569
570 dev_kfree_skb(skb); 528 dev_kfree_skb(skb);
571 kfree(queued_msg); 529 kfree(queued_msg);
572 } 530 }
@@ -594,23 +552,28 @@ xpnet_dev_tx_timeout(struct net_device *dev)
594static int __init 552static int __init
595xpnet_init(void) 553xpnet_init(void)
596{ 554{
597 int i; 555 int result;
598 u32 license_num;
599 int result = -ENOMEM;
600 556
601 if (!ia64_platform_is("sn2")) 557 if (!is_shub() && !is_uv())
602 return -ENODEV; 558 return -ENODEV;
603 559
604 dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME); 560 dev_info(xpnet, "registering network device %s\n", XPNET_DEVICE_NAME);
605 561
562 xpnet_broadcast_partitions = kzalloc(BITS_TO_LONGS(xp_max_npartitions) *
563 sizeof(long), GFP_KERNEL);
564 if (xpnet_broadcast_partitions == NULL)
565 return -ENOMEM;
566
606 /* 567 /*
607 * use ether_setup() to init the majority of our device 568 * use ether_setup() to init the majority of our device
608 * structure and then override the necessary pieces. 569 * structure and then override the necessary pieces.
609 */ 570 */
610 xpnet_device = alloc_netdev(sizeof(struct xpnet_dev_private), 571 xpnet_device = alloc_netdev(sizeof(struct xpnet_dev_private),
611 XPNET_DEVICE_NAME, ether_setup); 572 XPNET_DEVICE_NAME, ether_setup);
612 if (xpnet_device == NULL) 573 if (xpnet_device == NULL) {
574 kfree(xpnet_broadcast_partitions);
613 return -ENOMEM; 575 return -ENOMEM;
576 }
614 577
615 netif_carrier_off(xpnet_device); 578 netif_carrier_off(xpnet_device);
616 579
@@ -628,14 +591,10 @@ xpnet_init(void)
628 * MAC addresses. We chose the first octet of the MAC to be unlikely 591 * MAC addresses. We chose the first octet of the MAC to be unlikely
629 * to collide with any vendor's officially issued MAC. 592 * to collide with any vendor's officially issued MAC.
630 */ 593 */
631 xpnet_device->dev_addr[0] = 0xfe; 594 xpnet_device->dev_addr[0] = 0x02; /* locally administered, no OUI */
632 xpnet_device->dev_addr[XPNET_PARTID_OCTET] = sn_partition_id; 595
633 license_num = sn_partition_serial_number_val(); 596 xpnet_device->dev_addr[XPNET_PARTID_OCTET + 1] = xp_partition_id;
634 for (i = 3; i >= 0; i--) { 597 xpnet_device->dev_addr[XPNET_PARTID_OCTET + 0] = (xp_partition_id >> 8);
635 xpnet_device->dev_addr[XPNET_LICENSE_OCTET + i] =
636 license_num & 0xff;
637 license_num = license_num >> 8;
638 }
639 598
640 /* 599 /*
641 * ether_setup() sets this to a multicast device. We are 600 * ether_setup() sets this to a multicast device. We are
@@ -651,8 +610,10 @@ xpnet_init(void)
651 xpnet_device->features = NETIF_F_NO_CSUM; 610 xpnet_device->features = NETIF_F_NO_CSUM;
652 611
653 result = register_netdev(xpnet_device); 612 result = register_netdev(xpnet_device);
654 if (result != 0) 613 if (result != 0) {
655 free_netdev(xpnet_device); 614 free_netdev(xpnet_device);
615 kfree(xpnet_broadcast_partitions);
616 }
656 617
657 return result; 618 return result;
658} 619}
@@ -666,8 +627,8 @@ xpnet_exit(void)
666 xpnet_device[0].name); 627 xpnet_device[0].name);
667 628
668 unregister_netdev(xpnet_device); 629 unregister_netdev(xpnet_device);
669
670 free_netdev(xpnet_device); 630 free_netdev(xpnet_device);
631 kfree(xpnet_broadcast_partitions);
671} 632}
672 633
673module_exit(xpnet_exit); 634module_exit(xpnet_exit);
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 66e5a5487c20..86dbb366415a 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -213,7 +213,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
213 struct mmc_blk_data *md = mq->data; 213 struct mmc_blk_data *md = mq->data;
214 struct mmc_card *card = md->queue.card; 214 struct mmc_card *card = md->queue.card;
215 struct mmc_blk_request brq; 215 struct mmc_blk_request brq;
216 int ret = 1, sg_pos, data_size; 216 int ret = 1, data_size, i;
217 struct scatterlist *sg;
217 218
218 mmc_claim_host(card->host); 219 mmc_claim_host(card->host);
219 220
@@ -267,18 +268,22 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
267 268
268 mmc_queue_bounce_pre(mq); 269 mmc_queue_bounce_pre(mq);
269 270
271 /*
272 * Adjust the sg list so it is the same size as the
273 * request.
274 */
270 if (brq.data.blocks != 275 if (brq.data.blocks !=
271 (req->nr_sectors >> (md->block_bits - 9))) { 276 (req->nr_sectors >> (md->block_bits - 9))) {
272 data_size = brq.data.blocks * brq.data.blksz; 277 data_size = brq.data.blocks * brq.data.blksz;
273 for (sg_pos = 0; sg_pos < brq.data.sg_len; sg_pos++) { 278 for_each_sg(brq.data.sg, sg, brq.data.sg_len, i) {
274 data_size -= mq->sg[sg_pos].length; 279 data_size -= sg->length;
275 if (data_size <= 0) { 280 if (data_size <= 0) {
276 mq->sg[sg_pos].length += data_size; 281 sg->length += data_size;
277 sg_pos++; 282 i++;
278 break; 283 break;
279 } 284 }
280 } 285 }
281 brq.data.sg_len = sg_pos; 286 brq.data.sg_len = i;
282 } 287 }
283 288
284 mmc_wait_for_req(card->host, &brq.mrq); 289 mmc_wait_for_req(card->host, &brq.mrq);
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index a067fe436301..f26b01d811ae 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -388,16 +388,14 @@ static int mmc_test_transfer(struct mmc_test_card *test,
388 int ret, i; 388 int ret, i;
389 unsigned long flags; 389 unsigned long flags;
390 390
391 BUG_ON(blocks * blksz > BUFFER_SIZE);
392
393 if (write) { 391 if (write) {
394 for (i = 0;i < blocks * blksz;i++) 392 for (i = 0;i < blocks * blksz;i++)
395 test->scratch[i] = i; 393 test->scratch[i] = i;
396 } else { 394 } else {
397 memset(test->scratch, 0, blocks * blksz); 395 memset(test->scratch, 0, BUFFER_SIZE);
398 } 396 }
399 local_irq_save(flags); 397 local_irq_save(flags);
400 sg_copy_from_buffer(sg, sg_len, test->scratch, blocks * blksz); 398 sg_copy_from_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
401 local_irq_restore(flags); 399 local_irq_restore(flags);
402 400
403 ret = mmc_test_set_blksize(test, blksz); 401 ret = mmc_test_set_blksize(test, blksz);
@@ -444,7 +442,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
444 } 442 }
445 } else { 443 } else {
446 local_irq_save(flags); 444 local_irq_save(flags);
447 sg_copy_to_buffer(sg, sg_len, test->scratch, blocks * blksz); 445 sg_copy_to_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
448 local_irq_restore(flags); 446 local_irq_restore(flags);
449 for (i = 0;i < blocks * blksz;i++) { 447 for (i = 0;i < blocks * blksz;i++) {
450 if (test->scratch[i] != (u8)i) 448 if (test->scratch[i] != (u8)i)
@@ -805,69 +803,6 @@ static int mmc_test_multi_xfersize_read(struct mmc_test_card *test)
805 return 0; 803 return 0;
806} 804}
807 805
808static int mmc_test_bigsg_write(struct mmc_test_card *test)
809{
810 int ret;
811 unsigned int size;
812 struct scatterlist sg;
813
814 if (test->card->host->max_blk_count == 1)
815 return RESULT_UNSUP_HOST;
816
817 size = PAGE_SIZE * 2;
818 size = min(size, test->card->host->max_req_size);
819 size = min(size, test->card->host->max_seg_size);
820 size = min(size, test->card->host->max_blk_count * 512);
821
822 memset(test->buffer, 0, BUFFER_SIZE);
823
824 if (size < 1024)
825 return RESULT_UNSUP_HOST;
826
827 sg_init_table(&sg, 1);
828 sg_init_one(&sg, test->buffer, BUFFER_SIZE);
829
830 ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
831 if (ret)
832 return ret;
833
834 return 0;
835}
836
837static int mmc_test_bigsg_read(struct mmc_test_card *test)
838{
839 int ret, i;
840 unsigned int size;
841 struct scatterlist sg;
842
843 if (test->card->host->max_blk_count == 1)
844 return RESULT_UNSUP_HOST;
845
846 size = PAGE_SIZE * 2;
847 size = min(size, test->card->host->max_req_size);
848 size = min(size, test->card->host->max_seg_size);
849 size = min(size, test->card->host->max_blk_count * 512);
850
851 if (size < 1024)
852 return RESULT_UNSUP_HOST;
853
854 memset(test->buffer, 0xCD, BUFFER_SIZE);
855
856 sg_init_table(&sg, 1);
857 sg_init_one(&sg, test->buffer, BUFFER_SIZE);
858 ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
859 if (ret)
860 return ret;
861
862 /* mmc_test_transfer() doesn't check for read overflows */
863 for (i = size;i < BUFFER_SIZE;i++) {
864 if (test->buffer[i] != 0xCD)
865 return RESULT_FAIL;
866 }
867
868 return 0;
869}
870
871#ifdef CONFIG_HIGHMEM 806#ifdef CONFIG_HIGHMEM
872 807
873static int mmc_test_write_high(struct mmc_test_card *test) 808static int mmc_test_write_high(struct mmc_test_card *test)
@@ -1071,20 +1006,6 @@ static const struct mmc_test_case mmc_test_cases[] = {
1071 .run = mmc_test_multi_xfersize_read, 1006 .run = mmc_test_multi_xfersize_read,
1072 }, 1007 },
1073 1008
1074 {
1075 .name = "Over-sized SG list write",
1076 .prepare = mmc_test_prepare_write,
1077 .run = mmc_test_bigsg_write,
1078 .cleanup = mmc_test_cleanup,
1079 },
1080
1081 {
1082 .name = "Over-sized SG list read",
1083 .prepare = mmc_test_prepare_read,
1084 .run = mmc_test_bigsg_read,
1085 .cleanup = mmc_test_cleanup,
1086 },
1087
1088#ifdef CONFIG_HIGHMEM 1009#ifdef CONFIG_HIGHMEM
1089 1010
1090 { 1011 {
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 3ee5b8c3b5ce..044d84eeed7c 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -121,6 +121,7 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
121{ 121{
122#ifdef CONFIG_MMC_DEBUG 122#ifdef CONFIG_MMC_DEBUG
123 unsigned int i, sz; 123 unsigned int i, sz;
124 struct scatterlist *sg;
124#endif 125#endif
125 126
126 pr_debug("%s: starting CMD%u arg %08x flags %08x\n", 127 pr_debug("%s: starting CMD%u arg %08x flags %08x\n",
@@ -156,8 +157,8 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
156 157
157#ifdef CONFIG_MMC_DEBUG 158#ifdef CONFIG_MMC_DEBUG
158 sz = 0; 159 sz = 0;
159 for (i = 0;i < mrq->data->sg_len;i++) 160 for_each_sg(mrq->data->sg, sg, mrq->data->sg_len, i)
160 sz += mrq->data->sg[i].length; 161 sz += sg->length;
161 BUG_ON(sz != mrq->data->blocks * mrq->data->blksz); 162 BUG_ON(sz != mrq->data->blocks * mrq->data->blksz);
162#endif 163#endif
163 164
diff --git a/drivers/mmc/host/au1xmmc.c b/drivers/mmc/host/au1xmmc.c
index 99b20917cc0f..d3f55615c099 100644
--- a/drivers/mmc/host/au1xmmc.c
+++ b/drivers/mmc/host/au1xmmc.c
@@ -61,7 +61,13 @@
61 61
62/* Hardware definitions */ 62/* Hardware definitions */
63#define AU1XMMC_DESCRIPTOR_COUNT 1 63#define AU1XMMC_DESCRIPTOR_COUNT 1
64#define AU1XMMC_DESCRIPTOR_SIZE 2048 64
65/* max DMA seg size: 64KB on Au1100, 4MB on Au1200 */
66#ifdef CONFIG_SOC_AU1100
67#define AU1XMMC_DESCRIPTOR_SIZE 0x0000ffff
68#else /* Au1200 */
69#define AU1XMMC_DESCRIPTOR_SIZE 0x003fffff
70#endif
65 71
66#define AU1XMMC_OCR (MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 | \ 72#define AU1XMMC_OCR (MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 | \
67 MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 | \ 73 MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 | \
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index deb607c52c0d..fcb14c2346cc 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -143,7 +143,8 @@ static int jmicron_probe(struct sdhci_pci_chip *chip)
143 chip->quirks |= SDHCI_QUIRK_32BIT_DMA_ADDR | 143 chip->quirks |= SDHCI_QUIRK_32BIT_DMA_ADDR |
144 SDHCI_QUIRK_32BIT_DMA_SIZE | 144 SDHCI_QUIRK_32BIT_DMA_SIZE |
145 SDHCI_QUIRK_32BIT_ADMA_SIZE | 145 SDHCI_QUIRK_32BIT_ADMA_SIZE |
146 SDHCI_QUIRK_RESET_AFTER_REQUEST; 146 SDHCI_QUIRK_RESET_AFTER_REQUEST |
147 SDHCI_QUIRK_BROKEN_SMALL_PIO;
147 } 148 }
148 149
149 /* 150 /*
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 5f95e10229b5..e3a8133560a2 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -278,6 +278,15 @@ static void sdhci_transfer_pio(struct sdhci_host *host)
278 else 278 else
279 mask = SDHCI_SPACE_AVAILABLE; 279 mask = SDHCI_SPACE_AVAILABLE;
280 280
281 /*
282 * Some controllers (JMicron JMB38x) mess up the buffer bits
283 * for transfers < 4 bytes. As long as it is just one block,
284 * we can ignore the bits.
285 */
286 if ((host->quirks & SDHCI_QUIRK_BROKEN_SMALL_PIO) &&
287 (host->data->blocks == 1))
288 mask = ~0;
289
281 while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask) { 290 while (readl(host->ioaddr + SDHCI_PRESENT_STATE) & mask) {
282 if (host->data->flags & MMC_DATA_READ) 291 if (host->data->flags & MMC_DATA_READ)
283 sdhci_read_block_pio(host); 292 sdhci_read_block_pio(host);
@@ -439,7 +448,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host,
439 448
440 host->adma_addr = dma_map_single(mmc_dev(host->mmc), 449 host->adma_addr = dma_map_single(mmc_dev(host->mmc),
441 host->adma_desc, (128 * 2 + 1) * 4, DMA_TO_DEVICE); 450 host->adma_desc, (128 * 2 + 1) * 4, DMA_TO_DEVICE);
442 if (dma_mapping_error(mmc_dev(host->mmc), host->align_addr)) 451 if (dma_mapping_error(mmc_dev(host->mmc), host->adma_addr))
443 goto unmap_entries; 452 goto unmap_entries;
444 BUG_ON(host->adma_addr & 0x3); 453 BUG_ON(host->adma_addr & 0x3);
445 454
@@ -645,7 +654,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
645 * us an invalid request. 654 * us an invalid request.
646 */ 655 */
647 WARN_ON(1); 656 WARN_ON(1);
648 host->flags &= ~SDHCI_USE_DMA; 657 host->flags &= ~SDHCI_REQ_USE_DMA;
649 } else { 658 } else {
650 writel(host->adma_addr, 659 writel(host->adma_addr,
651 host->ioaddr + SDHCI_ADMA_ADDRESS); 660 host->ioaddr + SDHCI_ADMA_ADDRESS);
@@ -664,7 +673,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
664 * us an invalid request. 673 * us an invalid request.
665 */ 674 */
666 WARN_ON(1); 675 WARN_ON(1);
667 host->flags &= ~SDHCI_USE_DMA; 676 host->flags &= ~SDHCI_REQ_USE_DMA;
668 } else { 677 } else {
669 WARN_ON(sg_cnt != 1); 678 WARN_ON(sg_cnt != 1);
670 writel(sg_dma_address(data->sg), 679 writel(sg_dma_address(data->sg),
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index e354faee5df0..197d4a05f4ae 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -206,6 +206,8 @@ struct sdhci_host {
206#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1<<11) 206#define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1<<11)
207/* Controller provides an incorrect timeout value for transfers */ 207/* Controller provides an incorrect timeout value for transfers */
208#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12) 208#define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12)
209/* Controller has an issue with buffer bits for small transfers */
210#define SDHCI_QUIRK_BROKEN_SMALL_PIO (1<<13)
209 211
210 int irq; /* Device IRQ */ 212 int irq; /* Device IRQ */
211 void __iomem * ioaddr; /* Mapped address */ 213 void __iomem * ioaddr; /* Mapped address */
diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c
index dbba5abf0db8..f84ab6182148 100644
--- a/drivers/mtd/chips/jedec_probe.c
+++ b/drivers/mtd/chips/jedec_probe.c
@@ -41,7 +41,7 @@
41 41
42 42
43/* AMD */ 43/* AMD */
44#define AM29DL800BB 0x22C8 44#define AM29DL800BB 0x22CB
45#define AM29DL800BT 0x224A 45#define AM29DL800BT 0x224A
46 46
47#define AM29F800BB 0x2258 47#define AM29F800BB 0x2258
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 54e36bfc2c3b..8bd0dea6885f 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -15,6 +15,8 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/err.h>
19
18#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
19#include <linux/spi/flash.h> 21#include <linux/spi/flash.h>
20 22
@@ -487,9 +489,8 @@ add_dataflash(struct spi_device *spi, char *name,
487 device->write = dataflash_write; 489 device->write = dataflash_write;
488 device->priv = priv; 490 device->priv = priv;
489 491
490 dev_info(&spi->dev, "%s (%d KBytes) pagesize %d bytes, " 492 dev_info(&spi->dev, "%s (%d KBytes) pagesize %d bytes\n",
491 "erasesize %d bytes\n", name, device->size/1024, 493 name, DIV_ROUND_UP(device->size, 1024), pagesize);
492 pagesize, pagesize * 8); /* 8 pages = 1 block */
493 dev_set_drvdata(&spi->dev, priv); 494 dev_set_drvdata(&spi->dev, priv);
494 495
495 if (mtd_has_partitions()) { 496 if (mtd_has_partitions()) {
@@ -518,65 +519,57 @@ add_dataflash(struct spi_device *spi, char *name,
518 return add_mtd_device(device) == 1 ? -ENODEV : 0; 519 return add_mtd_device(device) == 1 ? -ENODEV : 0;
519} 520}
520 521
521/*
522 * Detect and initialize DataFlash device:
523 *
524 * Device Density ID code #Pages PageSize Offset
525 * AT45DB011B 1Mbit (128K) xx0011xx (0x0c) 512 264 9
526 * AT45DB021B 2Mbit (256K) xx0101xx (0x14) 1024 264 9
527 * AT45DB041B 4Mbit (512K) xx0111xx (0x1c) 2048 264 9
528 * AT45DB081B 8Mbit (1M) xx1001xx (0x24) 4096 264 9
529 * AT45DB0161B 16Mbit (2M) xx1011xx (0x2c) 4096 528 10
530 * AT45DB0321B 32Mbit (4M) xx1101xx (0x34) 8192 528 10
531 * AT45DB0642 64Mbit (8M) xx111xxx (0x3c) 8192 1056 11
532 * AT45DB1282 128Mbit (16M) xx0100xx (0x10) 16384 1056 11
533 */
534
535struct flash_info { 522struct flash_info {
536 char *name; 523 char *name;
537 524
538 /* JEDEC id zero means "no ID" (most older chips); otherwise it has 525 /* JEDEC id has a high byte of zero plus three data bytes:
539 * a high byte of zero plus three data bytes: the manufacturer id, 526 * the manufacturer id, then a two byte device id.
540 * then a two byte device id.
541 */ 527 */
542 uint32_t jedec_id; 528 uint32_t jedec_id;
543 529
544 /* The size listed here is what works with OPCODE_SE, which isn't 530 /* The size listed here is what works with OP_ERASE_PAGE. */
545 * necessarily called a "sector" by the vendor.
546 */
547 unsigned nr_pages; 531 unsigned nr_pages;
548 uint16_t pagesize; 532 uint16_t pagesize;
549 uint16_t pageoffset; 533 uint16_t pageoffset;
550 534
551 uint16_t flags; 535 uint16_t flags;
552#define SUP_POW2PS 0x02 536#define SUP_POW2PS 0x0002 /* supports 2^N byte pages */
553#define IS_POW2PS 0x01 537#define IS_POW2PS 0x0001 /* uses 2^N byte pages */
554}; 538};
555 539
556static struct flash_info __devinitdata dataflash_data [] = { 540static struct flash_info __devinitdata dataflash_data [] = {
557 541
558 { "at45db011d", 0x1f2200, 512, 264, 9, SUP_POW2PS}, 542 /*
543 * NOTE: chips with SUP_POW2PS (rev D and up) need two entries,
544 * one with IS_POW2PS and the other without. The entry with the
545 * non-2^N byte page size can't name exact chip revisions without
546 * losing backwards compatibility for cmdlinepart.
547 *
548 * These newer chips also support 128-byte security registers (with
549 * 64 bytes one-time-programmable) and software write-protection.
550 */
551 { "AT45DB011B", 0x1f2200, 512, 264, 9, SUP_POW2PS},
559 { "at45db011d", 0x1f2200, 512, 256, 8, SUP_POW2PS | IS_POW2PS}, 552 { "at45db011d", 0x1f2200, 512, 256, 8, SUP_POW2PS | IS_POW2PS},
560 553
561 { "at45db021d", 0x1f2300, 1024, 264, 9, SUP_POW2PS}, 554 { "AT45DB021B", 0x1f2300, 1024, 264, 9, SUP_POW2PS},
562 { "at45db021d", 0x1f2300, 1024, 256, 8, SUP_POW2PS | IS_POW2PS}, 555 { "at45db021d", 0x1f2300, 1024, 256, 8, SUP_POW2PS | IS_POW2PS},
563 556
564 { "at45db041d", 0x1f2400, 2048, 264, 9, SUP_POW2PS}, 557 { "AT45DB041x", 0x1f2400, 2048, 264, 9, SUP_POW2PS},
565 { "at45db041d", 0x1f2400, 2048, 256, 8, SUP_POW2PS | IS_POW2PS}, 558 { "at45db041d", 0x1f2400, 2048, 256, 8, SUP_POW2PS | IS_POW2PS},
566 559
567 { "at45db081d", 0x1f2500, 4096, 264, 9, SUP_POW2PS}, 560 { "AT45DB081B", 0x1f2500, 4096, 264, 9, SUP_POW2PS},
568 { "at45db081d", 0x1f2500, 4096, 256, 8, SUP_POW2PS | IS_POW2PS}, 561 { "at45db081d", 0x1f2500, 4096, 256, 8, SUP_POW2PS | IS_POW2PS},
569 562
570 { "at45db161d", 0x1f2600, 4096, 528, 10, SUP_POW2PS}, 563 { "AT45DB161x", 0x1f2600, 4096, 528, 10, SUP_POW2PS},
571 { "at45db161d", 0x1f2600, 4096, 512, 9, SUP_POW2PS | IS_POW2PS}, 564 { "at45db161d", 0x1f2600, 4096, 512, 9, SUP_POW2PS | IS_POW2PS},
572 565
573 { "at45db321c", 0x1f2700, 8192, 528, 10, }, 566 { "AT45DB321x", 0x1f2700, 8192, 528, 10, 0}, /* rev C */
574 567
575 { "at45db321d", 0x1f2701, 8192, 528, 10, SUP_POW2PS}, 568 { "AT45DB321x", 0x1f2701, 8192, 528, 10, SUP_POW2PS},
576 { "at45db321d", 0x1f2701, 8192, 512, 9, SUP_POW2PS | IS_POW2PS}, 569 { "at45db321d", 0x1f2701, 8192, 512, 9, SUP_POW2PS | IS_POW2PS},
577 570
578 { "at45db641d", 0x1f2800, 8192, 1056, 11, SUP_POW2PS}, 571 { "AT45DB642x", 0x1f2800, 8192, 1056, 11, SUP_POW2PS},
579 { "at45db641d", 0x1f2800, 8192, 1024, 10, SUP_POW2PS | IS_POW2PS}, 572 { "at45db642d", 0x1f2800, 8192, 1024, 10, SUP_POW2PS | IS_POW2PS},
580}; 573};
581 574
582static struct flash_info *__devinit jedec_probe(struct spi_device *spi) 575static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
@@ -588,17 +581,23 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
588 struct flash_info *info; 581 struct flash_info *info;
589 int status; 582 int status;
590 583
591
592 /* JEDEC also defines an optional "extended device information" 584 /* JEDEC also defines an optional "extended device information"
593 * string for after vendor-specific data, after the three bytes 585 * string for after vendor-specific data, after the three bytes
594 * we use here. Supporting some chips might require using it. 586 * we use here. Supporting some chips might require using it.
587 *
588 * If the vendor ID isn't Atmel's (0x1f), assume this call failed.
589 * That's not an error; only rev C and newer chips handle it, and
590 * only Atmel sells these chips.
595 */ 591 */
596 tmp = spi_write_then_read(spi, &code, 1, id, 3); 592 tmp = spi_write_then_read(spi, &code, 1, id, 3);
597 if (tmp < 0) { 593 if (tmp < 0) {
598 DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n", 594 DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n",
599 spi->dev.bus_id, tmp); 595 spi->dev.bus_id, tmp);
600 return NULL; 596 return ERR_PTR(tmp);
601 } 597 }
598 if (id[0] != 0x1f)
599 return NULL;
600
602 jedec = id[0]; 601 jedec = id[0];
603 jedec = jedec << 8; 602 jedec = jedec << 8;
604 jedec |= id[1]; 603 jedec |= id[1];
@@ -609,19 +608,53 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
609 tmp < ARRAY_SIZE(dataflash_data); 608 tmp < ARRAY_SIZE(dataflash_data);
610 tmp++, info++) { 609 tmp++, info++) {
611 if (info->jedec_id == jedec) { 610 if (info->jedec_id == jedec) {
611 DEBUG(MTD_DEBUG_LEVEL1, "%s: OTP, sector protect%s\n",
612 dev_name(&spi->dev),
613 (info->flags & SUP_POW2PS)
614 ? ", binary pagesize" : ""
615 );
612 if (info->flags & SUP_POW2PS) { 616 if (info->flags & SUP_POW2PS) {
613 status = dataflash_status(spi); 617 status = dataflash_status(spi);
614 if (status & 0x1) 618 if (status < 0) {
615 /* return power of 2 pagesize */ 619 DEBUG(MTD_DEBUG_LEVEL1,
616 return ++info; 620 "%s: status error %d\n",
617 else 621 dev_name(&spi->dev), status);
618 return info; 622 return ERR_PTR(status);
623 }
624 if (status & 0x1) {
625 if (info->flags & IS_POW2PS)
626 return info;
627 } else {
628 if (!(info->flags & IS_POW2PS))
629 return info;
630 }
619 } 631 }
620 } 632 }
621 } 633 }
622 return NULL; 634
635 /*
636 * Treat other chips as errors ... we won't know the right page
637 * size (it might be binary) even when we can tell which density
638 * class is involved (legacy chip id scheme).
639 */
640 dev_warn(&spi->dev, "JEDEC id %06x not handled\n", jedec);
641 return ERR_PTR(-ENODEV);
623} 642}
624 643
644/*
645 * Detect and initialize DataFlash device, using JEDEC IDs on newer chips
646 * or else the ID code embedded in the status bits:
647 *
648 * Device Density ID code #Pages PageSize Offset
649 * AT45DB011B 1Mbit (128K) xx0011xx (0x0c) 512 264 9
650 * AT45DB021B 2Mbit (256K) xx0101xx (0x14) 1024 264 9
651 * AT45DB041B 4Mbit (512K) xx0111xx (0x1c) 2048 264 9
652 * AT45DB081B 8Mbit (1M) xx1001xx (0x24) 4096 264 9
653 * AT45DB0161B 16Mbit (2M) xx1011xx (0x2c) 4096 528 10
654 * AT45DB0321B 32Mbit (4M) xx1101xx (0x34) 8192 528 10
655 * AT45DB0642 64Mbit (8M) xx111xxx (0x3c) 8192 1056 11
656 * AT45DB1282 128Mbit (16M) xx0100xx (0x10) 16384 1056 11
657 */
625static int __devinit dataflash_probe(struct spi_device *spi) 658static int __devinit dataflash_probe(struct spi_device *spi)
626{ 659{
627 int status; 660 int status;
@@ -632,14 +665,17 @@ static int __devinit dataflash_probe(struct spi_device *spi)
632 * If it succeeds we know we have either a C or D part. 665 * If it succeeds we know we have either a C or D part.
633 * D will support power of 2 pagesize option. 666 * D will support power of 2 pagesize option.
634 */ 667 */
635
636 info = jedec_probe(spi); 668 info = jedec_probe(spi);
637 669 if (IS_ERR(info))
670 return PTR_ERR(info);
638 if (info != NULL) 671 if (info != NULL)
639 return add_dataflash(spi, info->name, info->nr_pages, 672 return add_dataflash(spi, info->name, info->nr_pages,
640 info->pagesize, info->pageoffset); 673 info->pagesize, info->pageoffset);
641 674
642 675 /*
676 * Older chips support only legacy commands, identifing
677 * capacity using bits in the status byte.
678 */
643 status = dataflash_status(spi); 679 status = dataflash_status(spi);
644 if (status <= 0 || status == 0xff) { 680 if (status <= 0 || status == 0xff) {
645 DEBUG(MTD_DEBUG_LEVEL1, "%s: status error %d\n", 681 DEBUG(MTD_DEBUG_LEVEL1, "%s: status error %d\n",
@@ -661,13 +697,13 @@ static int __devinit dataflash_probe(struct spi_device *spi)
661 status = add_dataflash(spi, "AT45DB021B", 1024, 264, 9); 697 status = add_dataflash(spi, "AT45DB021B", 1024, 264, 9);
662 break; 698 break;
663 case 0x1c: /* 0 1 1 1 x x */ 699 case 0x1c: /* 0 1 1 1 x x */
664 status = add_dataflash(spi, "AT45DB041B", 2048, 264, 9); 700 status = add_dataflash(spi, "AT45DB041x", 2048, 264, 9);
665 break; 701 break;
666 case 0x24: /* 1 0 0 1 x x */ 702 case 0x24: /* 1 0 0 1 x x */
667 status = add_dataflash(spi, "AT45DB081B", 4096, 264, 9); 703 status = add_dataflash(spi, "AT45DB081B", 4096, 264, 9);
668 break; 704 break;
669 case 0x2c: /* 1 0 1 1 x x */ 705 case 0x2c: /* 1 0 1 1 x x */
670 status = add_dataflash(spi, "AT45DB161B", 4096, 528, 10); 706 status = add_dataflash(spi, "AT45DB161x", 4096, 528, 10);
671 break; 707 break;
672 case 0x34: /* 1 1 0 1 x x */ 708 case 0x34: /* 1 1 0 1 x x */
673 status = add_dataflash(spi, "AT45DB321x", 8192, 528, 10); 709 status = add_dataflash(spi, "AT45DB321x", 8192, 528, 10);
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index 28cc6787a800..9b6af7e74a65 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -125,7 +125,7 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
125 int (*fill_super)(struct super_block *, void *, int), 125 int (*fill_super)(struct super_block *, void *, int),
126 struct vfsmount *mnt) 126 struct vfsmount *mnt)
127{ 127{
128 struct nameidata nd; 128 struct block_device *bdev;
129 int mtdnr, ret; 129 int mtdnr, ret;
130 130
131 if (!dev_name) 131 if (!dev_name)
@@ -181,29 +181,20 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
181 /* try the old way - the hack where we allowed users to mount 181 /* try the old way - the hack where we allowed users to mount
182 * /dev/mtdblock$(n) but didn't actually _use_ the blockdev 182 * /dev/mtdblock$(n) but didn't actually _use_ the blockdev
183 */ 183 */
184 ret = path_lookup(dev_name, LOOKUP_FOLLOW, &nd); 184 bdev = lookup_bdev(dev_name);
185 185 if (IS_ERR(bdev)) {
186 DEBUG(1, "MTDSB: path_lookup() returned %d, inode %p\n", 186 ret = PTR_ERR(bdev);
187 ret, nd.path.dentry ? nd.path.dentry->d_inode : NULL); 187 DEBUG(1, "MTDSB: lookup_bdev() returned %d\n", ret);
188
189 if (ret)
190 return ret; 188 return ret;
191
192 ret = -EINVAL;
193
194 if (!S_ISBLK(nd.path.dentry->d_inode->i_mode))
195 goto out;
196
197 if (nd.path.mnt->mnt_flags & MNT_NODEV) {
198 ret = -EACCES;
199 goto out;
200 } 189 }
190 DEBUG(1, "MTDSB: lookup_bdev() returned 0\n");
201 191
202 if (imajor(nd.path.dentry->d_inode) != MTD_BLOCK_MAJOR) 192 ret = -EINVAL;
193 if (MAJOR(bdev->bd_dev) != MTD_BLOCK_MAJOR)
203 goto not_an_MTD_device; 194 goto not_an_MTD_device;
204 195
205 mtdnr = iminor(nd.path.dentry->d_inode); 196 mtdnr = MINOR(bdev->bd_dev);
206 path_put(&nd.path); 197 bdput(bdev);
207 198
208 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super, 199 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
209 mnt); 200 mnt);
@@ -213,10 +204,8 @@ not_an_MTD_device:
213 printk(KERN_NOTICE 204 printk(KERN_NOTICE
214 "MTD: Attempt to mount non-MTD device \"%s\"\n", 205 "MTD: Attempt to mount non-MTD device \"%s\"\n",
215 dev_name); 206 dev_name);
216out: 207 bdput(bdev);
217 path_put(&nd.path);
218 return ret; 208 return ret;
219
220} 209}
221 210
222EXPORT_SYMBOL_GPL(get_sb_mtd); 211EXPORT_SYMBOL_GPL(get_sb_mtd);
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 71406e517857..02f9cc30d77b 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -104,11 +104,24 @@ config MTD_NAND_BF5XX
104 104
105config MTD_NAND_BF5XX_HWECC 105config MTD_NAND_BF5XX_HWECC
106 bool "BF5XX NAND Hardware ECC" 106 bool "BF5XX NAND Hardware ECC"
107 default y
107 depends on MTD_NAND_BF5XX 108 depends on MTD_NAND_BF5XX
108 help 109 help
109 Enable the use of the BF5XX's internal ECC generator when 110 Enable the use of the BF5XX's internal ECC generator when
110 using NAND. 111 using NAND.
111 112
113config MTD_NAND_BF5XX_BOOTROM_ECC
114 bool "Use Blackfin BootROM ECC Layout"
115 default n
116 depends on MTD_NAND_BF5XX_HWECC
117 help
118 If you wish to modify NAND pages and allow the Blackfin on-chip
119 BootROM to boot from them, say Y here. This is only necessary
120 if you are booting U-Boot out of NAND and you wish to update
121 U-Boot from Linux' userspace. Otherwise, you should say N here.
122
123 If unsure, say N.
124
112config MTD_NAND_RTC_FROM4 125config MTD_NAND_RTC_FROM4
113 tristate "Renesas Flash ROM 4-slot interface board (FROM_BOARD4)" 126 tristate "Renesas Flash ROM 4-slot interface board (FROM_BOARD4)"
114 depends on SH_SOLUTION_ENGINE 127 depends on SH_SOLUTION_ENGINE
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index e87a57297328..9af2a2cc1153 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -91,6 +91,41 @@ static const unsigned short bfin_nfc_pin_req[] =
91 P_NAND_ALE, 91 P_NAND_ALE,
92 0}; 92 0};
93 93
94#ifdef CONFIG_MTD_NAND_BF5XX_BOOTROM_ECC
95static uint8_t bbt_pattern[] = { 0xff };
96
97static struct nand_bbt_descr bootrom_bbt = {
98 .options = 0,
99 .offs = 63,
100 .len = 1,
101 .pattern = bbt_pattern,
102};
103
104static struct nand_ecclayout bootrom_ecclayout = {
105 .eccbytes = 24,
106 .eccpos = {
107 0x8 * 0, 0x8 * 0 + 1, 0x8 * 0 + 2,
108 0x8 * 1, 0x8 * 1 + 1, 0x8 * 1 + 2,
109 0x8 * 2, 0x8 * 2 + 1, 0x8 * 2 + 2,
110 0x8 * 3, 0x8 * 3 + 1, 0x8 * 3 + 2,
111 0x8 * 4, 0x8 * 4 + 1, 0x8 * 4 + 2,
112 0x8 * 5, 0x8 * 5 + 1, 0x8 * 5 + 2,
113 0x8 * 6, 0x8 * 6 + 1, 0x8 * 6 + 2,
114 0x8 * 7, 0x8 * 7 + 1, 0x8 * 7 + 2
115 },
116 .oobfree = {
117 { 0x8 * 0 + 3, 5 },
118 { 0x8 * 1 + 3, 5 },
119 { 0x8 * 2 + 3, 5 },
120 { 0x8 * 3 + 3, 5 },
121 { 0x8 * 4 + 3, 5 },
122 { 0x8 * 5 + 3, 5 },
123 { 0x8 * 6 + 3, 5 },
124 { 0x8 * 7 + 3, 5 },
125 }
126};
127#endif
128
94/* 129/*
95 * Data structures for bf5xx nand flash controller driver 130 * Data structures for bf5xx nand flash controller driver
96 */ 131 */
@@ -273,7 +308,7 @@ static int bf5xx_nand_correct_data(struct mtd_info *mtd, u_char *dat,
273 dat += 256; 308 dat += 256;
274 read_ecc += 8; 309 read_ecc += 8;
275 calc_ecc += 8; 310 calc_ecc += 8;
276 ret = bf5xx_nand_correct_data_256(mtd, dat, read_ecc, calc_ecc); 311 ret |= bf5xx_nand_correct_data_256(mtd, dat, read_ecc, calc_ecc);
277 } 312 }
278 313
279 return ret; 314 return ret;
@@ -298,7 +333,7 @@ static int bf5xx_nand_calculate_ecc(struct mtd_info *mtd,
298 ecc0 = bfin_read_NFC_ECC0(); 333 ecc0 = bfin_read_NFC_ECC0();
299 ecc1 = bfin_read_NFC_ECC1(); 334 ecc1 = bfin_read_NFC_ECC1();
300 335
301 code[0] = (ecc0 & 0x3FF) | ((ecc1 & 0x3FF) << 11); 336 code[0] = (ecc0 & 0x7ff) | ((ecc1 & 0x7ff) << 11);
302 337
303 dev_dbg(info->device, "returning ecc 0x%08x\n", code[0]); 338 dev_dbg(info->device, "returning ecc 0x%08x\n", code[0]);
304 339
@@ -310,7 +345,7 @@ static int bf5xx_nand_calculate_ecc(struct mtd_info *mtd,
310 if (page_size == 512) { 345 if (page_size == 512) {
311 ecc0 = bfin_read_NFC_ECC2(); 346 ecc0 = bfin_read_NFC_ECC2();
312 ecc1 = bfin_read_NFC_ECC3(); 347 ecc1 = bfin_read_NFC_ECC3();
313 code[1] = (ecc0 & 0x3FF) | ((ecc1 & 0x3FF) << 11); 348 code[1] = (ecc0 & 0x7ff) | ((ecc1 & 0x7ff) << 11);
314 349
315 /* second 3 bytes in ecc_code for second 256 350 /* second 3 bytes in ecc_code for second 256
316 * bytes of 512 page size 351 * bytes of 512 page size
@@ -514,7 +549,6 @@ static void bf5xx_nand_dma_write_buf(struct mtd_info *mtd,
514/* 549/*
515 * System initialization functions 550 * System initialization functions
516 */ 551 */
517
518static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info) 552static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info)
519{ 553{
520 int ret; 554 int ret;
@@ -547,6 +581,13 @@ static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info)
547 return 0; 581 return 0;
548} 582}
549 583
584static void bf5xx_nand_dma_remove(struct bf5xx_nand_info *info)
585{
586 /* Free NFC DMA channel */
587 if (hardware_ecc)
588 free_dma(CH_NFC);
589}
590
550/* 591/*
551 * BF5XX NFC hardware initialization 592 * BF5XX NFC hardware initialization
552 * - pin mux setup 593 * - pin mux setup
@@ -605,7 +646,7 @@ static int bf5xx_nand_add_partition(struct bf5xx_nand_info *info)
605#endif 646#endif
606} 647}
607 648
608static int bf5xx_nand_remove(struct platform_device *pdev) 649static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
609{ 650{
610 struct bf5xx_nand_info *info = to_nand_info(pdev); 651 struct bf5xx_nand_info *info = to_nand_info(pdev);
611 struct mtd_info *mtd = NULL; 652 struct mtd_info *mtd = NULL;
@@ -623,6 +664,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev)
623 } 664 }
624 665
625 peripheral_free_list(bfin_nfc_pin_req); 666 peripheral_free_list(bfin_nfc_pin_req);
667 bf5xx_nand_dma_remove(info);
626 668
627 /* free the common resources */ 669 /* free the common resources */
628 kfree(info); 670 kfree(info);
@@ -638,7 +680,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev)
638 * it can allocate all necessary resources then calls the 680 * it can allocate all necessary resources then calls the
639 * nand layer to look for devices 681 * nand layer to look for devices
640 */ 682 */
641static int bf5xx_nand_probe(struct platform_device *pdev) 683static int __devinit bf5xx_nand_probe(struct platform_device *pdev)
642{ 684{
643 struct bf5xx_nand_platform *plat = to_nand_plat(pdev); 685 struct bf5xx_nand_platform *plat = to_nand_plat(pdev);
644 struct bf5xx_nand_info *info = NULL; 686 struct bf5xx_nand_info *info = NULL;
@@ -648,22 +690,21 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
648 690
649 dev_dbg(&pdev->dev, "(%p)\n", pdev); 691 dev_dbg(&pdev->dev, "(%p)\n", pdev);
650 692
651 if (peripheral_request_list(bfin_nfc_pin_req, DRV_NAME)) {
652 printk(KERN_ERR DRV_NAME
653 ": Requesting Peripherals failed\n");
654 return -EFAULT;
655 }
656
657 if (!plat) { 693 if (!plat) {
658 dev_err(&pdev->dev, "no platform specific information\n"); 694 dev_err(&pdev->dev, "no platform specific information\n");
659 goto exit_error; 695 return -EINVAL;
696 }
697
698 if (peripheral_request_list(bfin_nfc_pin_req, DRV_NAME)) {
699 dev_err(&pdev->dev, "requesting Peripherals failed\n");
700 return -EFAULT;
660 } 701 }
661 702
662 info = kzalloc(sizeof(*info), GFP_KERNEL); 703 info = kzalloc(sizeof(*info), GFP_KERNEL);
663 if (info == NULL) { 704 if (info == NULL) {
664 dev_err(&pdev->dev, "no memory for flash info\n"); 705 dev_err(&pdev->dev, "no memory for flash info\n");
665 err = -ENOMEM; 706 err = -ENOMEM;
666 goto exit_error; 707 goto out_err_kzalloc;
667 } 708 }
668 709
669 platform_set_drvdata(pdev, info); 710 platform_set_drvdata(pdev, info);
@@ -707,11 +748,16 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
707 748
708 /* initialise the hardware */ 749 /* initialise the hardware */
709 err = bf5xx_nand_hw_init(info); 750 err = bf5xx_nand_hw_init(info);
710 if (err != 0) 751 if (err)
711 goto exit_error; 752 goto out_err_hw_init;
712 753
713 /* setup hardware ECC data struct */ 754 /* setup hardware ECC data struct */
714 if (hardware_ecc) { 755 if (hardware_ecc) {
756#ifdef CONFIG_MTD_NAND_BF5XX_BOOTROM_ECC
757 chip->badblock_pattern = &bootrom_bbt;
758 chip->ecc.layout = &bootrom_ecclayout;
759#endif
760
715 if (plat->page_size == NFC_PG_SIZE_256) { 761 if (plat->page_size == NFC_PG_SIZE_256) {
716 chip->ecc.bytes = 3; 762 chip->ecc.bytes = 3;
717 chip->ecc.size = 256; 763 chip->ecc.size = 256;
@@ -733,7 +779,7 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
733 /* scan hardware nand chip and setup mtd info data struct */ 779 /* scan hardware nand chip and setup mtd info data struct */
734 if (nand_scan(mtd, 1)) { 780 if (nand_scan(mtd, 1)) {
735 err = -ENXIO; 781 err = -ENXIO;
736 goto exit_error; 782 goto out_err_nand_scan;
737 } 783 }
738 784
739 /* add NAND partition */ 785 /* add NAND partition */
@@ -742,11 +788,14 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
742 dev_dbg(&pdev->dev, "initialised ok\n"); 788 dev_dbg(&pdev->dev, "initialised ok\n");
743 return 0; 789 return 0;
744 790
745exit_error: 791out_err_nand_scan:
746 bf5xx_nand_remove(pdev); 792 bf5xx_nand_dma_remove(info);
793out_err_hw_init:
794 platform_set_drvdata(pdev, NULL);
795 kfree(info);
796out_err_kzalloc:
797 peripheral_free_list(bfin_nfc_pin_req);
747 798
748 if (err == 0)
749 err = -EINVAL;
750 return err; 799 return err;
751} 800}
752 801
@@ -775,7 +824,7 @@ static int bf5xx_nand_resume(struct platform_device *dev)
775/* driver device registration */ 824/* driver device registration */
776static struct platform_driver bf5xx_nand_driver = { 825static struct platform_driver bf5xx_nand_driver = {
777 .probe = bf5xx_nand_probe, 826 .probe = bf5xx_nand_probe,
778 .remove = bf5xx_nand_remove, 827 .remove = __devexit_p(bf5xx_nand_remove),
779 .suspend = bf5xx_nand_suspend, 828 .suspend = bf5xx_nand_suspend,
780 .resume = bf5xx_nand_resume, 829 .resume = bf5xx_nand_resume,
781 .driver = { 830 .driver = {
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index 765d4f0f7c86..e4226e02d63e 100644
--- a/drivers/mtd/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
@@ -1125,9 +1125,9 @@ static inline int __init nftl_partscan(struct mtd_info *mtd, struct mtd_partitio
1125 goto out; 1125 goto out;
1126 mh = (struct NFTLMediaHeader *)buf; 1126 mh = (struct NFTLMediaHeader *)buf;
1127 1127
1128 mh->NumEraseUnits = le16_to_cpu(mh->NumEraseUnits); 1128 le16_to_cpus(&mh->NumEraseUnits);
1129 mh->FirstPhysicalEUN = le16_to_cpu(mh->FirstPhysicalEUN); 1129 le16_to_cpus(&mh->FirstPhysicalEUN);
1130 mh->FormattedSize = le32_to_cpu(mh->FormattedSize); 1130 le32_to_cpus(&mh->FormattedSize);
1131 1131
1132 printk(KERN_INFO " DataOrgID = %s\n" 1132 printk(KERN_INFO " DataOrgID = %s\n"
1133 " NumEraseUnits = %d\n" 1133 " NumEraseUnits = %d\n"
@@ -1235,12 +1235,12 @@ static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partiti
1235 doc->mh1_page = doc->mh0_page + (4096 >> this->page_shift); 1235 doc->mh1_page = doc->mh0_page + (4096 >> this->page_shift);
1236 mh = (struct INFTLMediaHeader *)buf; 1236 mh = (struct INFTLMediaHeader *)buf;
1237 1237
1238 mh->NoOfBootImageBlocks = le32_to_cpu(mh->NoOfBootImageBlocks); 1238 le32_to_cpus(&mh->NoOfBootImageBlocks);
1239 mh->NoOfBinaryPartitions = le32_to_cpu(mh->NoOfBinaryPartitions); 1239 le32_to_cpus(&mh->NoOfBinaryPartitions);
1240 mh->NoOfBDTLPartitions = le32_to_cpu(mh->NoOfBDTLPartitions); 1240 le32_to_cpus(&mh->NoOfBDTLPartitions);
1241 mh->BlockMultiplierBits = le32_to_cpu(mh->BlockMultiplierBits); 1241 le32_to_cpus(&mh->BlockMultiplierBits);
1242 mh->FormatFlags = le32_to_cpu(mh->FormatFlags); 1242 le32_to_cpus(&mh->FormatFlags);
1243 mh->PercentUsed = le32_to_cpu(mh->PercentUsed); 1243 le32_to_cpus(&mh->PercentUsed);
1244 1244
1245 printk(KERN_INFO " bootRecordID = %s\n" 1245 printk(KERN_INFO " bootRecordID = %s\n"
1246 " NoOfBootImageBlocks = %d\n" 1246 " NoOfBootImageBlocks = %d\n"
@@ -1277,12 +1277,12 @@ static inline int __init inftl_partscan(struct mtd_info *mtd, struct mtd_partiti
1277 /* Scan the partitions */ 1277 /* Scan the partitions */
1278 for (i = 0; (i < 4); i++) { 1278 for (i = 0; (i < 4); i++) {
1279 ip = &(mh->Partitions[i]); 1279 ip = &(mh->Partitions[i]);
1280 ip->virtualUnits = le32_to_cpu(ip->virtualUnits); 1280 le32_to_cpus(&ip->virtualUnits);
1281 ip->firstUnit = le32_to_cpu(ip->firstUnit); 1281 le32_to_cpus(&ip->firstUnit);
1282 ip->lastUnit = le32_to_cpu(ip->lastUnit); 1282 le32_to_cpus(&ip->lastUnit);
1283 ip->flags = le32_to_cpu(ip->flags); 1283 le32_to_cpus(&ip->flags);
1284 ip->spareUnits = le32_to_cpu(ip->spareUnits); 1284 le32_to_cpus(&ip->spareUnits);
1285 ip->Reserved0 = le32_to_cpu(ip->Reserved0); 1285 le32_to_cpus(&ip->Reserved0);
1286 1286
1287 printk(KERN_INFO " PARTITION[%d] ->\n" 1287 printk(KERN_INFO " PARTITION[%d] ->\n"
1288 " virtualUnits = %d\n" 1288 " virtualUnits = %d\n"
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 9dff51351f4f..98ad3cefcaf4 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -887,7 +887,7 @@ static int __devinit fsl_elbc_chip_probe(struct fsl_elbc_ctrl *ctrl,
887 goto err; 887 goto err;
888 } 888 }
889 889
890 priv->mtd.name = kasprintf(GFP_KERNEL, "%x.flash", res.start); 890 priv->mtd.name = kasprintf(GFP_KERNEL, "%x.flash", (unsigned)res.start);
891 if (!priv->mtd.name) { 891 if (!priv->mtd.name) {
892 ret = -ENOMEM; 892 ret = -ENOMEM;
893 goto err; 893 goto err;
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index ecd70e2504f6..556e8131ecdc 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -28,6 +28,7 @@
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/moduleparam.h> 29#include <linux/moduleparam.h>
30#include <linux/vmalloc.h> 30#include <linux/vmalloc.h>
31#include <asm/div64.h>
31#include <linux/slab.h> 32#include <linux/slab.h>
32#include <linux/errno.h> 33#include <linux/errno.h>
33#include <linux/string.h> 34#include <linux/string.h>
@@ -207,13 +208,16 @@ MODULE_PARM_DESC(overridesize, "Specifies the NAND Flash size overriding the I
207#define STATE_CMD_READID 0x0000000A /* read ID */ 208#define STATE_CMD_READID 0x0000000A /* read ID */
208#define STATE_CMD_ERASE2 0x0000000B /* sector erase second command */ 209#define STATE_CMD_ERASE2 0x0000000B /* sector erase second command */
209#define STATE_CMD_RESET 0x0000000C /* reset */ 210#define STATE_CMD_RESET 0x0000000C /* reset */
211#define STATE_CMD_RNDOUT 0x0000000D /* random output command */
212#define STATE_CMD_RNDOUTSTART 0x0000000E /* random output start command */
210#define STATE_CMD_MASK 0x0000000F /* command states mask */ 213#define STATE_CMD_MASK 0x0000000F /* command states mask */
211 214
212/* After an address is input, the simulator goes to one of these states */ 215/* After an address is input, the simulator goes to one of these states */
213#define STATE_ADDR_PAGE 0x00000010 /* full (row, column) address is accepted */ 216#define STATE_ADDR_PAGE 0x00000010 /* full (row, column) address is accepted */
214#define STATE_ADDR_SEC 0x00000020 /* sector address was accepted */ 217#define STATE_ADDR_SEC 0x00000020 /* sector address was accepted */
215#define STATE_ADDR_ZERO 0x00000030 /* one byte zero address was accepted */ 218#define STATE_ADDR_COLUMN 0x00000030 /* column address was accepted */
216#define STATE_ADDR_MASK 0x00000030 /* address states mask */ 219#define STATE_ADDR_ZERO 0x00000040 /* one byte zero address was accepted */
220#define STATE_ADDR_MASK 0x00000070 /* address states mask */
217 221
218/* Durind data input/output the simulator is in these states */ 222/* Durind data input/output the simulator is in these states */
219#define STATE_DATAIN 0x00000100 /* waiting for data input */ 223#define STATE_DATAIN 0x00000100 /* waiting for data input */
@@ -240,7 +244,7 @@ MODULE_PARM_DESC(overridesize, "Specifies the NAND Flash size overriding the I
240#define ACTION_OOBOFF 0x00600000 /* add to address OOB offset */ 244#define ACTION_OOBOFF 0x00600000 /* add to address OOB offset */
241#define ACTION_MASK 0x00700000 /* action mask */ 245#define ACTION_MASK 0x00700000 /* action mask */
242 246
243#define NS_OPER_NUM 12 /* Number of operations supported by the simulator */ 247#define NS_OPER_NUM 13 /* Number of operations supported by the simulator */
244#define NS_OPER_STATES 6 /* Maximum number of states in operation */ 248#define NS_OPER_STATES 6 /* Maximum number of states in operation */
245 249
246#define OPT_ANY 0xFFFFFFFF /* any chip supports this operation */ 250#define OPT_ANY 0xFFFFFFFF /* any chip supports this operation */
@@ -373,7 +377,10 @@ static struct nandsim_operations {
373 {OPT_ANY, {STATE_CMD_READID, STATE_ADDR_ZERO, STATE_DATAOUT_ID, STATE_READY}}, 377 {OPT_ANY, {STATE_CMD_READID, STATE_ADDR_ZERO, STATE_DATAOUT_ID, STATE_READY}},
374 /* Large page devices read page */ 378 /* Large page devices read page */
375 {OPT_LARGEPAGE, {STATE_CMD_READ0, STATE_ADDR_PAGE, STATE_CMD_READSTART | ACTION_CPY, 379 {OPT_LARGEPAGE, {STATE_CMD_READ0, STATE_ADDR_PAGE, STATE_CMD_READSTART | ACTION_CPY,
376 STATE_DATAOUT, STATE_READY}} 380 STATE_DATAOUT, STATE_READY}},
381 /* Large page devices random page read */
382 {OPT_LARGEPAGE, {STATE_CMD_RNDOUT, STATE_ADDR_COLUMN, STATE_CMD_RNDOUTSTART | ACTION_CPY,
383 STATE_DATAOUT, STATE_READY}},
377}; 384};
378 385
379struct weak_block { 386struct weak_block {
@@ -579,7 +586,8 @@ static int init_nandsim(struct mtd_info *mtd)
579 if (ns->busw == 16) 586 if (ns->busw == 16)
580 NS_WARN("16-bit flashes support wasn't tested\n"); 587 NS_WARN("16-bit flashes support wasn't tested\n");
581 588
582 printk("flash size: %llu MiB\n", ns->geom.totsz >> 20); 589 printk("flash size: %llu MiB\n",
590 (unsigned long long)ns->geom.totsz >> 20);
583 printk("page size: %u bytes\n", ns->geom.pgsz); 591 printk("page size: %u bytes\n", ns->geom.pgsz);
584 printk("OOB area size: %u bytes\n", ns->geom.oobsz); 592 printk("OOB area size: %u bytes\n", ns->geom.oobsz);
585 printk("sector size: %u KiB\n", ns->geom.secsz >> 10); 593 printk("sector size: %u KiB\n", ns->geom.secsz >> 10);
@@ -588,8 +596,9 @@ static int init_nandsim(struct mtd_info *mtd)
588 printk("bus width: %u\n", ns->busw); 596 printk("bus width: %u\n", ns->busw);
589 printk("bits in sector size: %u\n", ns->geom.secshift); 597 printk("bits in sector size: %u\n", ns->geom.secshift);
590 printk("bits in page size: %u\n", ns->geom.pgshift); 598 printk("bits in page size: %u\n", ns->geom.pgshift);
591 printk("bits in OOB size: %u\n", ns->geom.oobshift); 599 printk("bits in OOB size: %u\n", ns->geom.oobshift);
592 printk("flash size with OOB: %llu KiB\n", ns->geom.totszoob >> 10); 600 printk("flash size with OOB: %llu KiB\n",
601 (unsigned long long)ns->geom.totszoob >> 10);
593 printk("page address bytes: %u\n", ns->geom.pgaddrbytes); 602 printk("page address bytes: %u\n", ns->geom.pgaddrbytes);
594 printk("sector address bytes: %u\n", ns->geom.secaddrbytes); 603 printk("sector address bytes: %u\n", ns->geom.secaddrbytes);
595 printk("options: %#x\n", ns->options); 604 printk("options: %#x\n", ns->options);
@@ -937,12 +946,18 @@ static char *get_state_name(uint32_t state)
937 return "STATE_CMD_ERASE2"; 946 return "STATE_CMD_ERASE2";
938 case STATE_CMD_RESET: 947 case STATE_CMD_RESET:
939 return "STATE_CMD_RESET"; 948 return "STATE_CMD_RESET";
949 case STATE_CMD_RNDOUT:
950 return "STATE_CMD_RNDOUT";
951 case STATE_CMD_RNDOUTSTART:
952 return "STATE_CMD_RNDOUTSTART";
940 case STATE_ADDR_PAGE: 953 case STATE_ADDR_PAGE:
941 return "STATE_ADDR_PAGE"; 954 return "STATE_ADDR_PAGE";
942 case STATE_ADDR_SEC: 955 case STATE_ADDR_SEC:
943 return "STATE_ADDR_SEC"; 956 return "STATE_ADDR_SEC";
944 case STATE_ADDR_ZERO: 957 case STATE_ADDR_ZERO:
945 return "STATE_ADDR_ZERO"; 958 return "STATE_ADDR_ZERO";
959 case STATE_ADDR_COLUMN:
960 return "STATE_ADDR_COLUMN";
946 case STATE_DATAIN: 961 case STATE_DATAIN:
947 return "STATE_DATAIN"; 962 return "STATE_DATAIN";
948 case STATE_DATAOUT: 963 case STATE_DATAOUT:
@@ -973,6 +988,7 @@ static int check_command(int cmd)
973 switch (cmd) { 988 switch (cmd) {
974 989
975 case NAND_CMD_READ0: 990 case NAND_CMD_READ0:
991 case NAND_CMD_READ1:
976 case NAND_CMD_READSTART: 992 case NAND_CMD_READSTART:
977 case NAND_CMD_PAGEPROG: 993 case NAND_CMD_PAGEPROG:
978 case NAND_CMD_READOOB: 994 case NAND_CMD_READOOB:
@@ -982,7 +998,8 @@ static int check_command(int cmd)
982 case NAND_CMD_READID: 998 case NAND_CMD_READID:
983 case NAND_CMD_ERASE2: 999 case NAND_CMD_ERASE2:
984 case NAND_CMD_RESET: 1000 case NAND_CMD_RESET:
985 case NAND_CMD_READ1: 1001 case NAND_CMD_RNDOUT:
1002 case NAND_CMD_RNDOUTSTART:
986 return 0; 1003 return 0;
987 1004
988 case NAND_CMD_STATUS_MULTI: 1005 case NAND_CMD_STATUS_MULTI:
@@ -1021,6 +1038,10 @@ static uint32_t get_state_by_command(unsigned command)
1021 return STATE_CMD_ERASE2; 1038 return STATE_CMD_ERASE2;
1022 case NAND_CMD_RESET: 1039 case NAND_CMD_RESET:
1023 return STATE_CMD_RESET; 1040 return STATE_CMD_RESET;
1041 case NAND_CMD_RNDOUT:
1042 return STATE_CMD_RNDOUT;
1043 case NAND_CMD_RNDOUTSTART:
1044 return STATE_CMD_RNDOUTSTART;
1024 } 1045 }
1025 1046
1026 NS_ERR("get_state_by_command: unknown command, BUG\n"); 1047 NS_ERR("get_state_by_command: unknown command, BUG\n");
@@ -1582,6 +1603,11 @@ static void switch_state(struct nandsim *ns)
1582 ns->regs.num = 1; 1603 ns->regs.num = 1;
1583 break; 1604 break;
1584 1605
1606 case STATE_ADDR_COLUMN:
1607 /* Column address is always 2 bytes */
1608 ns->regs.num = ns->geom.pgaddrbytes - ns->geom.secaddrbytes;
1609 break;
1610
1585 default: 1611 default:
1586 NS_ERR("switch_state: BUG! unknown address state\n"); 1612 NS_ERR("switch_state: BUG! unknown address state\n");
1587 } 1613 }
@@ -1693,15 +1719,21 @@ static void ns_nand_write_byte(struct mtd_info *mtd, u_char byte)
1693 return; 1719 return;
1694 } 1720 }
1695 1721
1696 /* 1722 /* Check that the command byte is correct */
1697 * Chip might still be in STATE_DATAOUT 1723 if (check_command(byte)) {
1698 * (if OPT_AUTOINCR feature is supported), STATE_DATAOUT_STATUS or 1724 NS_ERR("write_byte: unknown command %#x\n", (uint)byte);
1699 * STATE_DATAOUT_STATUS_M state. If so, switch state. 1725 return;
1700 */ 1726 }
1727
1701 if (NS_STATE(ns->state) == STATE_DATAOUT_STATUS 1728 if (NS_STATE(ns->state) == STATE_DATAOUT_STATUS
1702 || NS_STATE(ns->state) == STATE_DATAOUT_STATUS_M 1729 || NS_STATE(ns->state) == STATE_DATAOUT_STATUS_M
1703 || ((ns->options & OPT_AUTOINCR) && NS_STATE(ns->state) == STATE_DATAOUT)) 1730 || NS_STATE(ns->state) == STATE_DATAOUT) {
1731 int row = ns->regs.row;
1732
1704 switch_state(ns); 1733 switch_state(ns);
1734 if (byte == NAND_CMD_RNDOUT)
1735 ns->regs.row = row;
1736 }
1705 1737
1706 /* Check if chip is expecting command */ 1738 /* Check if chip is expecting command */
1707 if (NS_STATE(ns->nxstate) != STATE_UNKNOWN && !(ns->nxstate & STATE_CMD_MASK)) { 1739 if (NS_STATE(ns->nxstate) != STATE_UNKNOWN && !(ns->nxstate & STATE_CMD_MASK)) {
@@ -1715,12 +1747,6 @@ static void ns_nand_write_byte(struct mtd_info *mtd, u_char byte)
1715 switch_to_ready_state(ns, NS_STATUS_FAILED(ns)); 1747 switch_to_ready_state(ns, NS_STATUS_FAILED(ns));
1716 } 1748 }
1717 1749
1718 /* Check that the command byte is correct */
1719 if (check_command(byte)) {
1720 NS_ERR("write_byte: unknown command %#x\n", (uint)byte);
1721 return;
1722 }
1723
1724 NS_DBG("command byte corresponding to %s state accepted\n", 1750 NS_DBG("command byte corresponding to %s state accepted\n",
1725 get_state_name(get_state_by_command(byte))); 1751 get_state_name(get_state_by_command(byte)));
1726 ns->regs.command = byte; 1752 ns->regs.command = byte;
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index fa533c27052a..8a03875ec877 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -510,14 +510,14 @@ config STNIC
510config SH_ETH 510config SH_ETH
511 tristate "Renesas SuperH Ethernet support" 511 tristate "Renesas SuperH Ethernet support"
512 depends on SUPERH && \ 512 depends on SUPERH && \
513 (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712) 513 (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || CPU_SUBTYPE_SH7763)
514 select CRC32 514 select CRC32
515 select MII 515 select MII
516 select MDIO_BITBANG 516 select MDIO_BITBANG
517 select PHYLIB 517 select PHYLIB
518 help 518 help
519 Renesas SuperH Ethernet device driver. 519 Renesas SuperH Ethernet device driver.
520 This driver support SH7710 and SH7712. 520 This driver support SH7710, SH7712 and SH7763.
521 521
522config SUNLANCE 522config SUNLANCE
523 tristate "Sun LANCE support" 523 tristate "Sun LANCE support"
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index a8ec60e1ed75..3db7db1828e7 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -605,36 +605,87 @@ adjust_head:
605static int bfin_mac_hard_start_xmit(struct sk_buff *skb, 605static int bfin_mac_hard_start_xmit(struct sk_buff *skb,
606 struct net_device *dev) 606 struct net_device *dev)
607{ 607{
608 unsigned int data; 608 u16 *data;
609 609
610 current_tx_ptr->skb = skb; 610 current_tx_ptr->skb = skb;
611 611
612 /* 612 if (ANOMALY_05000285) {
613 * Is skb->data always 16-bit aligned? 613 /*
614 * Do we need to memcpy((char *)(tail->packet + 2), skb->data, len)? 614 * TXDWA feature is not avaible to older revision < 0.3 silicon
615 */ 615 * of BF537
616 if ((((unsigned int)(skb->data)) & 0x02) == 2) { 616 *
617 /* move skb->data to current_tx_ptr payload */ 617 * Only if data buffer is ODD WORD alignment, we do not
618 data = (unsigned int)(skb->data) - 2; 618 * need to memcpy
619 *((unsigned short *)data) = (unsigned short)(skb->len); 619 */
620 current_tx_ptr->desc_a.start_addr = (unsigned long)data; 620 u32 data_align = (u32)(skb->data) & 0x3;
621 /* this is important! */ 621 if (data_align == 0x2) {
622 blackfin_dcache_flush_range(data, (data + (skb->len)) + 2); 622 /* move skb->data to current_tx_ptr payload */
623 623 data = (u16 *)(skb->data) - 1;
624 *data = (u16)(skb->len);
625 current_tx_ptr->desc_a.start_addr = (u32)data;
626 /* this is important! */
627 blackfin_dcache_flush_range((u32)data,
628 (u32)((u8 *)data + skb->len + 4));
629 } else {
630 *((u16 *)(current_tx_ptr->packet)) = (u16)(skb->len);
631 memcpy((u8 *)(current_tx_ptr->packet + 2), skb->data,
632 skb->len);
633 current_tx_ptr->desc_a.start_addr =
634 (u32)current_tx_ptr->packet;
635 if (current_tx_ptr->status.status_word != 0)
636 current_tx_ptr->status.status_word = 0;
637 blackfin_dcache_flush_range(
638 (u32)current_tx_ptr->packet,
639 (u32)(current_tx_ptr->packet + skb->len + 2));
640 }
624 } else { 641 } else {
625 *((unsigned short *)(current_tx_ptr->packet)) = 642 /*
626 (unsigned short)(skb->len); 643 * TXDWA feature is avaible to revision < 0.3 silicon of
627 memcpy((char *)(current_tx_ptr->packet + 2), skb->data, 644 * BF537 and always avaible to BF52x
628 (skb->len)); 645 */
629 current_tx_ptr->desc_a.start_addr = 646 u32 data_align = (u32)(skb->data) & 0x3;
630 (unsigned long)current_tx_ptr->packet; 647 if (data_align == 0x0) {
631 if (current_tx_ptr->status.status_word != 0) 648 u16 sysctl = bfin_read_EMAC_SYSCTL();
632 current_tx_ptr->status.status_word = 0; 649 sysctl |= TXDWA;
633 blackfin_dcache_flush_range((unsigned int)current_tx_ptr-> 650 bfin_write_EMAC_SYSCTL(sysctl);
634 packet, 651
635 (unsigned int)(current_tx_ptr-> 652 /* move skb->data to current_tx_ptr payload */
636 packet + skb->len) + 653 data = (u16 *)(skb->data) - 2;
637 2); 654 *data = (u16)(skb->len);
655 current_tx_ptr->desc_a.start_addr = (u32)data;
656 /* this is important! */
657 blackfin_dcache_flush_range(
658 (u32)data,
659 (u32)((u8 *)data + skb->len + 4));
660 } else if (data_align == 0x2) {
661 u16 sysctl = bfin_read_EMAC_SYSCTL();
662 sysctl &= ~TXDWA;
663 bfin_write_EMAC_SYSCTL(sysctl);
664
665 /* move skb->data to current_tx_ptr payload */
666 data = (u16 *)(skb->data) - 1;
667 *data = (u16)(skb->len);
668 current_tx_ptr->desc_a.start_addr = (u32)data;
669 /* this is important! */
670 blackfin_dcache_flush_range(
671 (u32)data,
672 (u32)((u8 *)data + skb->len + 4));
673 } else {
674 u16 sysctl = bfin_read_EMAC_SYSCTL();
675 sysctl &= ~TXDWA;
676 bfin_write_EMAC_SYSCTL(sysctl);
677
678 *((u16 *)(current_tx_ptr->packet)) = (u16)(skb->len);
679 memcpy((u8 *)(current_tx_ptr->packet + 2), skb->data,
680 skb->len);
681 current_tx_ptr->desc_a.start_addr =
682 (u32)current_tx_ptr->packet;
683 if (current_tx_ptr->status.status_word != 0)
684 current_tx_ptr->status.status_word = 0;
685 blackfin_dcache_flush_range(
686 (u32)current_tx_ptr->packet,
687 (u32)(current_tx_ptr->packet + skb->len + 2));
688 }
638 } 689 }
639 690
640 /* enable this packet's dma */ 691 /* enable this packet's dma */
@@ -691,7 +742,6 @@ static void bfin_mac_rx(struct net_device *dev)
691 (unsigned long)skb->tail); 742 (unsigned long)skb->tail);
692 743
693 dev->last_rx = jiffies; 744 dev->last_rx = jiffies;
694 skb->dev = dev;
695 skb->protocol = eth_type_trans(skb, dev); 745 skb->protocol = eth_type_trans(skb, dev);
696#if defined(BFIN_MAC_CSUM_OFFLOAD) 746#if defined(BFIN_MAC_CSUM_OFFLOAD)
697 skb->csum = current_rx_ptr->status.ip_payload_csum; 747 skb->csum = current_rx_ptr->status.ip_payload_csum;
@@ -920,6 +970,7 @@ static int bfin_mac_open(struct net_device *dev)
920 phy_start(lp->phydev); 970 phy_start(lp->phydev);
921 phy_write(lp->phydev, MII_BMCR, BMCR_RESET); 971 phy_write(lp->phydev, MII_BMCR, BMCR_RESET);
922 setup_system_regs(dev); 972 setup_system_regs(dev);
973 setup_mac_addr(dev->dev_addr);
923 bfin_mac_disable(); 974 bfin_mac_disable();
924 bfin_mac_enable(); 975 bfin_mac_enable();
925 pr_debug("hardware init finished\n"); 976 pr_debug("hardware init finished\n");
@@ -955,7 +1006,7 @@ static int bfin_mac_close(struct net_device *dev)
955 return 0; 1006 return 0;
956} 1007}
957 1008
958static int __init bfin_mac_probe(struct platform_device *pdev) 1009static int __devinit bfin_mac_probe(struct platform_device *pdev)
959{ 1010{
960 struct net_device *ndev; 1011 struct net_device *ndev;
961 struct bfin_mac_local *lp; 1012 struct bfin_mac_local *lp;
@@ -1081,7 +1132,7 @@ out_err_probe_mac:
1081 return rc; 1132 return rc;
1082} 1133}
1083 1134
1084static int bfin_mac_remove(struct platform_device *pdev) 1135static int __devexit bfin_mac_remove(struct platform_device *pdev)
1085{ 1136{
1086 struct net_device *ndev = platform_get_drvdata(pdev); 1137 struct net_device *ndev = platform_get_drvdata(pdev);
1087 struct bfin_mac_local *lp = netdev_priv(ndev); 1138 struct bfin_mac_local *lp = netdev_priv(ndev);
@@ -1128,7 +1179,7 @@ static int bfin_mac_resume(struct platform_device *pdev)
1128 1179
1129static struct platform_driver bfin_mac_driver = { 1180static struct platform_driver bfin_mac_driver = {
1130 .probe = bfin_mac_probe, 1181 .probe = bfin_mac_probe,
1131 .remove = bfin_mac_remove, 1182 .remove = __devexit_p(bfin_mac_remove),
1132 .resume = bfin_mac_resume, 1183 .resume = bfin_mac_resume,
1133 .suspend = bfin_mac_suspend, 1184 .suspend = bfin_mac_suspend,
1134 .driver = { 1185 .driver = {
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 47d51788a462..04c0e90119af 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -683,7 +683,7 @@ enum {
683 SF_ERASE_SECTOR = 0xd8, /* erase sector */ 683 SF_ERASE_SECTOR = 0xd8, /* erase sector */
684 684
685 FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */ 685 FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */
686 FW_VERS_ADDR = 0x77ffc, /* flash address holding FW version */ 686 FW_VERS_ADDR = 0x7fffc, /* flash address holding FW version */
687 FW_MIN_SIZE = 8 /* at least version and csum */ 687 FW_MIN_SIZE = 8 /* at least version and csum */
688}; 688};
689 689
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 0920b796bd78..b70c5314f537 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -2937,9 +2937,9 @@ static void ehea_rereg_mrs(struct work_struct *work)
2937 } 2937 }
2938 } 2938 }
2939 } 2939 }
2940 mutex_unlock(&dlpar_mem_lock); 2940 ehea_info("re-initializing driver complete");
2941 ehea_info("re-initializing driver complete");
2942out: 2941out:
2942 mutex_unlock(&dlpar_mem_lock);
2943 return; 2943 return;
2944} 2944}
2945 2945
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index c05cb159c772..aa0bf6e1c694 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1547,8 +1547,10 @@ static int __devinit enc28j60_probe(struct spi_device *spi)
1547 random_ether_addr(dev->dev_addr); 1547 random_ether_addr(dev->dev_addr);
1548 enc28j60_set_hw_macaddr(dev); 1548 enc28j60_set_hw_macaddr(dev);
1549 1549
1550 ret = request_irq(spi->irq, enc28j60_irq, IRQF_TRIGGER_FALLING, 1550 /* Board setup must set the relevant edge trigger type;
1551 DRV_NAME, priv); 1551 * level triggers won't currently work.
1552 */
1553 ret = request_irq(spi->irq, enc28j60_irq, 0, DRV_NAME, priv);
1552 if (ret < 0) { 1554 if (ret < 0) {
1553 if (netif_msg_probe(priv)) 1555 if (netif_msg_probe(priv))
1554 dev_err(&spi->dev, DRV_NAME ": request irq %d failed " 1556 dev_err(&spi->dev, DRV_NAME ": request irq %d failed "
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 4ed89fa9ae46..01b38b092c76 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -333,6 +333,7 @@ enum {
333 NvRegPowerState2 = 0x600, 333 NvRegPowerState2 = 0x600,
334#define NVREG_POWERSTATE2_POWERUP_MASK 0x0F11 334#define NVREG_POWERSTATE2_POWERUP_MASK 0x0F11
335#define NVREG_POWERSTATE2_POWERUP_REV_A3 0x0001 335#define NVREG_POWERSTATE2_POWERUP_REV_A3 0x0001
336#define NVREG_POWERSTATE2_PHY_RESET 0x0004
336}; 337};
337 338
338/* Big endian: should work, but is untested */ 339/* Big endian: should work, but is untested */
@@ -529,6 +530,7 @@ union ring_type {
529#define PHY_REALTEK_INIT_REG4 0x14 530#define PHY_REALTEK_INIT_REG4 0x14
530#define PHY_REALTEK_INIT_REG5 0x18 531#define PHY_REALTEK_INIT_REG5 0x18
531#define PHY_REALTEK_INIT_REG6 0x11 532#define PHY_REALTEK_INIT_REG6 0x11
533#define PHY_REALTEK_INIT_REG7 0x01
532#define PHY_REALTEK_INIT1 0x0000 534#define PHY_REALTEK_INIT1 0x0000
533#define PHY_REALTEK_INIT2 0x8e00 535#define PHY_REALTEK_INIT2 0x8e00
534#define PHY_REALTEK_INIT3 0x0001 536#define PHY_REALTEK_INIT3 0x0001
@@ -537,6 +539,9 @@ union ring_type {
537#define PHY_REALTEK_INIT6 0xf5c7 539#define PHY_REALTEK_INIT6 0xf5c7
538#define PHY_REALTEK_INIT7 0x1000 540#define PHY_REALTEK_INIT7 0x1000
539#define PHY_REALTEK_INIT8 0x0003 541#define PHY_REALTEK_INIT8 0x0003
542#define PHY_REALTEK_INIT9 0x0008
543#define PHY_REALTEK_INIT10 0x0005
544#define PHY_REALTEK_INIT11 0x0200
540#define PHY_REALTEK_INIT_MSK1 0x0003 545#define PHY_REALTEK_INIT_MSK1 0x0003
541 546
542#define PHY_GIGABIT 0x0100 547#define PHY_GIGABIT 0x0100
@@ -1149,6 +1154,42 @@ static int phy_init(struct net_device *dev)
1149 return PHY_ERROR; 1154 return PHY_ERROR;
1150 } 1155 }
1151 } 1156 }
1157 if (np->phy_model == PHY_MODEL_REALTEK_8211 &&
1158 np->phy_rev == PHY_REV_REALTEK_8211C) {
1159 u32 powerstate = readl(base + NvRegPowerState2);
1160
1161 /* need to perform hw phy reset */
1162 powerstate |= NVREG_POWERSTATE2_PHY_RESET;
1163 writel(powerstate, base + NvRegPowerState2);
1164 msleep(25);
1165
1166 powerstate &= ~NVREG_POWERSTATE2_PHY_RESET;
1167 writel(powerstate, base + NvRegPowerState2);
1168 msleep(25);
1169
1170 reg = mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG6, MII_READ);
1171 reg |= PHY_REALTEK_INIT9;
1172 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG6, reg)) {
1173 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1174 return PHY_ERROR;
1175 }
1176 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT10)) {
1177 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1178 return PHY_ERROR;
1179 }
1180 reg = mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG7, MII_READ);
1181 if (!(reg & PHY_REALTEK_INIT11)) {
1182 reg |= PHY_REALTEK_INIT11;
1183 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG7, reg)) {
1184 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1185 return PHY_ERROR;
1186 }
1187 }
1188 if (mii_rw(dev, np->phyaddr, PHY_REALTEK_INIT_REG1, PHY_REALTEK_INIT1)) {
1189 printk(KERN_INFO "%s: phy init failed.\n", pci_name(np->pci_dev));
1190 return PHY_ERROR;
1191 }
1192 }
1152 if (np->phy_model == PHY_MODEL_REALTEK_8201) { 1193 if (np->phy_model == PHY_MODEL_REALTEK_8201) {
1153 if (np->device_id == PCI_DEVICE_ID_NVIDIA_NVENET_32 || 1194 if (np->device_id == PCI_DEVICE_ID_NVIDIA_NVENET_32 ||
1154 np->device_id == PCI_DEVICE_ID_NVIDIA_NVENET_33 || 1195 np->device_id == PCI_DEVICE_ID_NVIDIA_NVENET_33 ||
@@ -1201,12 +1242,23 @@ static int phy_init(struct net_device *dev)
1201 mii_control = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ); 1242 mii_control = mii_rw(dev, np->phyaddr, MII_BMCR, MII_READ);
1202 mii_control |= BMCR_ANENABLE; 1243 mii_control |= BMCR_ANENABLE;
1203 1244
1204 /* reset the phy 1245 if (np->phy_oui == PHY_OUI_REALTEK &&
1205 * (certain phys need bmcr to be setup with reset) 1246 np->phy_model == PHY_MODEL_REALTEK_8211 &&
1206 */ 1247 np->phy_rev == PHY_REV_REALTEK_8211C) {
1207 if (phy_reset(dev, mii_control)) { 1248 /* start autoneg since we already performed hw reset above */
1208 printk(KERN_INFO "%s: phy reset failed\n", pci_name(np->pci_dev)); 1249 mii_control |= BMCR_ANRESTART;
1209 return PHY_ERROR; 1250 if (mii_rw(dev, np->phyaddr, MII_BMCR, mii_control)) {
1251 printk(KERN_INFO "%s: phy init failed\n", pci_name(np->pci_dev));
1252 return PHY_ERROR;
1253 }
1254 } else {
1255 /* reset the phy
1256 * (certain phys need bmcr to be setup with reset)
1257 */
1258 if (phy_reset(dev, mii_control)) {
1259 printk(KERN_INFO "%s: phy reset failed\n", pci_name(np->pci_dev));
1260 return PHY_ERROR;
1261 }
1210 } 1262 }
1211 1263
1212 /* phy vendor specific configuration */ 1264 /* phy vendor specific configuration */
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 91ec9fdc7184..a03fe1fb61ca 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -260,7 +260,7 @@ static void ibmveth_replenish_buffer_pool(struct ibmveth_adapter *adapter, struc
260 dma_addr = dma_map_single(&adapter->vdev->dev, skb->data, 260 dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
261 pool->buff_size, DMA_FROM_DEVICE); 261 pool->buff_size, DMA_FROM_DEVICE);
262 262
263 if (dma_mapping_error((&adapter->vdev->dev, dma_addr)) 263 if (dma_mapping_error(&adapter->vdev->dev, dma_addr))
264 goto failure; 264 goto failure;
265 265
266 pool->free_map[free_index] = IBM_VETH_INVALID_MAP; 266 pool->free_map[free_index] = IBM_VETH_INVALID_MAP;
@@ -294,7 +294,7 @@ failure:
294 pool->consumer_index = pool->size - 1; 294 pool->consumer_index = pool->size - 1;
295 else 295 else
296 pool->consumer_index--; 296 pool->consumer_index--;
297 if (!dma_mapping_error((&adapter->vdev->dev, dma_addr)) 297 if (!dma_mapping_error(&adapter->vdev->dev, dma_addr))
298 dma_unmap_single(&adapter->vdev->dev, 298 dma_unmap_single(&adapter->vdev->dev,
299 pool->dma_addr[index], pool->buff_size, 299 pool->dma_addr[index], pool->buff_size,
300 DMA_FROM_DEVICE); 300 DMA_FROM_DEVICE);
@@ -488,7 +488,7 @@ static void ibmveth_cleanup(struct ibmveth_adapter *adapter)
488 &adapter->rx_buff_pool[i]); 488 &adapter->rx_buff_pool[i]);
489 489
490 if (adapter->bounce_buffer != NULL) { 490 if (adapter->bounce_buffer != NULL) {
491 if (!dma_mapping_error(adapter->bounce_buffer_dma)) { 491 if (!dma_mapping_error(dev, adapter->bounce_buffer_dma)) {
492 dma_unmap_single(&adapter->vdev->dev, 492 dma_unmap_single(&adapter->vdev->dev,
493 adapter->bounce_buffer_dma, 493 adapter->bounce_buffer_dma,
494 adapter->netdev->mtu + IBMVETH_BUFF_OH, 494 adapter->netdev->mtu + IBMVETH_BUFF_OH,
@@ -924,7 +924,7 @@ static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev)
924 buf[1] = 0; 924 buf[1] = 0;
925 } 925 }
926 926
927 if (dma_mapping_error((&adapter->vdev->dev, data_dma_addr)) { 927 if (dma_mapping_error(&adapter->vdev->dev, data_dma_addr)) {
928 if (!firmware_has_feature(FW_FEATURE_CMO)) 928 if (!firmware_has_feature(FW_FEATURE_CMO))
929 ibmveth_error_printk("tx: unable to map xmit buffer\n"); 929 ibmveth_error_printk("tx: unable to map xmit buffer\n");
930 skb_copy_from_linear_data(skb, adapter->bounce_buffer, 930 skb_copy_from_linear_data(skb, adapter->bounce_buffer,
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index 0960e69b2da4..e4fbefc8c82f 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -69,18 +69,20 @@ static void ri_tasklet(unsigned long dev)
69 struct net_device *_dev = (struct net_device *)dev; 69 struct net_device *_dev = (struct net_device *)dev;
70 struct ifb_private *dp = netdev_priv(_dev); 70 struct ifb_private *dp = netdev_priv(_dev);
71 struct net_device_stats *stats = &_dev->stats; 71 struct net_device_stats *stats = &_dev->stats;
72 struct netdev_queue *txq;
72 struct sk_buff *skb; 73 struct sk_buff *skb;
73 74
75 txq = netdev_get_tx_queue(_dev, 0);
74 dp->st_task_enter++; 76 dp->st_task_enter++;
75 if ((skb = skb_peek(&dp->tq)) == NULL) { 77 if ((skb = skb_peek(&dp->tq)) == NULL) {
76 dp->st_txq_refl_try++; 78 dp->st_txq_refl_try++;
77 if (netif_tx_trylock(_dev)) { 79 if (__netif_tx_trylock(txq)) {
78 dp->st_rxq_enter++; 80 dp->st_rxq_enter++;
79 while ((skb = skb_dequeue(&dp->rq)) != NULL) { 81 while ((skb = skb_dequeue(&dp->rq)) != NULL) {
80 skb_queue_tail(&dp->tq, skb); 82 skb_queue_tail(&dp->tq, skb);
81 dp->st_rx2tx_tran++; 83 dp->st_rx2tx_tran++;
82 } 84 }
83 netif_tx_unlock(_dev); 85 __netif_tx_unlock(txq);
84 } else { 86 } else {
85 /* reschedule */ 87 /* reschedule */
86 dp->st_rxq_notenter++; 88 dp->st_rxq_notenter++;
@@ -115,7 +117,7 @@ static void ri_tasklet(unsigned long dev)
115 BUG(); 117 BUG();
116 } 118 }
117 119
118 if (netif_tx_trylock(_dev)) { 120 if (__netif_tx_trylock(txq)) {
119 dp->st_rxq_check++; 121 dp->st_rxq_check++;
120 if ((skb = skb_peek(&dp->rq)) == NULL) { 122 if ((skb = skb_peek(&dp->rq)) == NULL) {
121 dp->tasklet_pending = 0; 123 dp->tasklet_pending = 0;
@@ -123,10 +125,10 @@ static void ri_tasklet(unsigned long dev)
123 netif_wake_queue(_dev); 125 netif_wake_queue(_dev);
124 } else { 126 } else {
125 dp->st_rxq_rsch++; 127 dp->st_rxq_rsch++;
126 netif_tx_unlock(_dev); 128 __netif_tx_unlock(txq);
127 goto resched; 129 goto resched;
128 } 130 }
129 netif_tx_unlock(_dev); 131 __netif_tx_unlock(txq);
130 } else { 132 } else {
131resched: 133resched:
132 dp->tasklet_pending = 1; 134 dp->tasklet_pending = 1;
diff --git a/drivers/net/irda/act200l-sir.c b/drivers/net/irda/act200l-sir.c
index d8b89c74aabd..37ab8c855719 100644
--- a/drivers/net/irda/act200l-sir.c
+++ b/drivers/net/irda/act200l-sir.c
@@ -107,7 +107,7 @@ static int act200l_open(struct sir_dev *dev)
107{ 107{
108 struct qos_info *qos = &dev->qos; 108 struct qos_info *qos = &dev->qos;
109 109
110 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 110 IRDA_DEBUG(2, "%s()\n", __func__ );
111 111
112 /* Power on the dongle */ 112 /* Power on the dongle */
113 sirdev_set_dtr_rts(dev, TRUE, TRUE); 113 sirdev_set_dtr_rts(dev, TRUE, TRUE);
@@ -124,7 +124,7 @@ static int act200l_open(struct sir_dev *dev)
124 124
125static int act200l_close(struct sir_dev *dev) 125static int act200l_close(struct sir_dev *dev)
126{ 126{
127 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 127 IRDA_DEBUG(2, "%s()\n", __func__ );
128 128
129 /* Power off the dongle */ 129 /* Power off the dongle */
130 sirdev_set_dtr_rts(dev, FALSE, FALSE); 130 sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -143,7 +143,7 @@ static int act200l_change_speed(struct sir_dev *dev, unsigned speed)
143 u8 control[3]; 143 u8 control[3];
144 int ret = 0; 144 int ret = 0;
145 145
146 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 146 IRDA_DEBUG(2, "%s()\n", __func__ );
147 147
148 /* Clear DTR and set RTS to enter command mode */ 148 /* Clear DTR and set RTS to enter command mode */
149 sirdev_set_dtr_rts(dev, FALSE, TRUE); 149 sirdev_set_dtr_rts(dev, FALSE, TRUE);
@@ -212,7 +212,7 @@ static int act200l_reset(struct sir_dev *dev)
212 }; 212 };
213 int ret = 0; 213 int ret = 0;
214 214
215 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); 215 IRDA_DEBUG(2, "%s()\n", __func__ );
216 216
217 switch (state) { 217 switch (state) {
218 case SIRDEV_STATE_DONGLE_RESET: 218 case SIRDEV_STATE_DONGLE_RESET:
@@ -240,7 +240,7 @@ static int act200l_reset(struct sir_dev *dev)
240 dev->speed = 9600; 240 dev->speed = 9600;
241 break; 241 break;
242 default: 242 default:
243 IRDA_ERROR("%s(), unknown state %d\n", __FUNCTION__, state); 243 IRDA_ERROR("%s(), unknown state %d\n", __func__, state);
244 ret = -1; 244 ret = -1;
245 break; 245 break;
246 } 246 }
diff --git a/drivers/net/irda/actisys-sir.c b/drivers/net/irda/actisys-sir.c
index 736d2473b7e1..50b2141a6103 100644
--- a/drivers/net/irda/actisys-sir.c
+++ b/drivers/net/irda/actisys-sir.c
@@ -165,7 +165,7 @@ static int actisys_change_speed(struct sir_dev *dev, unsigned speed)
165 int ret = 0; 165 int ret = 0;
166 int i = 0; 166 int i = 0;
167 167
168 IRDA_DEBUG(4, "%s(), speed=%d (was %d)\n", __FUNCTION__, 168 IRDA_DEBUG(4, "%s(), speed=%d (was %d)\n", __func__,
169 speed, dev->speed); 169 speed, dev->speed);
170 170
171 /* dongle was already resetted from irda_request state machine, 171 /* dongle was already resetted from irda_request state machine,
diff --git a/drivers/net/irda/ali-ircc.c b/drivers/net/irda/ali-ircc.c
index 083b0dd70fef..2ff181861d2d 100644
--- a/drivers/net/irda/ali-ircc.c
+++ b/drivers/net/irda/ali-ircc.c
@@ -152,7 +152,7 @@ static int __init ali_ircc_init(void)
152 int reg, revision; 152 int reg, revision;
153 int i = 0; 153 int i = 0;
154 154
155 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 155 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
156 156
157 ret = platform_driver_register(&ali_ircc_driver); 157 ret = platform_driver_register(&ali_ircc_driver);
158 if (ret) { 158 if (ret) {
@@ -166,7 +166,7 @@ static int __init ali_ircc_init(void)
166 /* Probe for all the ALi chipsets we know about */ 166 /* Probe for all the ALi chipsets we know about */
167 for (chip= chips; chip->name; chip++, i++) 167 for (chip= chips; chip->name; chip++, i++)
168 { 168 {
169 IRDA_DEBUG(2, "%s(), Probing for %s ...\n", __FUNCTION__, chip->name); 169 IRDA_DEBUG(2, "%s(), Probing for %s ...\n", __func__, chip->name);
170 170
171 /* Try all config registers for this chip */ 171 /* Try all config registers for this chip */
172 for (cfg=0; cfg<2; cfg++) 172 for (cfg=0; cfg<2; cfg++)
@@ -196,11 +196,11 @@ static int __init ali_ircc_init(void)
196 196
197 if (reg == chip->cid_value) 197 if (reg == chip->cid_value)
198 { 198 {
199 IRDA_DEBUG(2, "%s(), Chip found at 0x%03x\n", __FUNCTION__, cfg_base); 199 IRDA_DEBUG(2, "%s(), Chip found at 0x%03x\n", __func__, cfg_base);
200 200
201 outb(0x1F, cfg_base); 201 outb(0x1F, cfg_base);
202 revision = inb(cfg_base+1); 202 revision = inb(cfg_base+1);
203 IRDA_DEBUG(2, "%s(), Found %s chip, revision=%d\n", __FUNCTION__, 203 IRDA_DEBUG(2, "%s(), Found %s chip, revision=%d\n", __func__,
204 chip->name, revision); 204 chip->name, revision);
205 205
206 /* 206 /*
@@ -223,14 +223,14 @@ static int __init ali_ircc_init(void)
223 } 223 }
224 else 224 else
225 { 225 {
226 IRDA_DEBUG(2, "%s(), No %s chip at 0x%03x\n", __FUNCTION__, chip->name, cfg_base); 226 IRDA_DEBUG(2, "%s(), No %s chip at 0x%03x\n", __func__, chip->name, cfg_base);
227 } 227 }
228 /* Exit configuration */ 228 /* Exit configuration */
229 outb(0xbb, cfg_base); 229 outb(0xbb, cfg_base);
230 } 230 }
231 } 231 }
232 232
233 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__); 233 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __func__);
234 234
235 if (ret) 235 if (ret)
236 platform_driver_unregister(&ali_ircc_driver); 236 platform_driver_unregister(&ali_ircc_driver);
@@ -248,7 +248,7 @@ static void __exit ali_ircc_cleanup(void)
248{ 248{
249 int i; 249 int i;
250 250
251 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 251 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
252 252
253 for (i=0; i < ARRAY_SIZE(dev_self); i++) { 253 for (i=0; i < ARRAY_SIZE(dev_self); i++) {
254 if (dev_self[i]) 254 if (dev_self[i])
@@ -257,7 +257,7 @@ static void __exit ali_ircc_cleanup(void)
257 257
258 platform_driver_unregister(&ali_ircc_driver); 258 platform_driver_unregister(&ali_ircc_driver);
259 259
260 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__); 260 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __func__);
261} 261}
262 262
263/* 263/*
@@ -273,11 +273,11 @@ static int ali_ircc_open(int i, chipio_t *info)
273 int dongle_id; 273 int dongle_id;
274 int err; 274 int err;
275 275
276 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 276 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
277 277
278 if (i >= ARRAY_SIZE(dev_self)) { 278 if (i >= ARRAY_SIZE(dev_self)) {
279 IRDA_ERROR("%s(), maximum number of supported chips reached!\n", 279 IRDA_ERROR("%s(), maximum number of supported chips reached!\n",
280 __FUNCTION__); 280 __func__);
281 return -ENOMEM; 281 return -ENOMEM;
282 } 282 }
283 283
@@ -288,7 +288,7 @@ static int ali_ircc_open(int i, chipio_t *info)
288 dev = alloc_irdadev(sizeof(*self)); 288 dev = alloc_irdadev(sizeof(*self));
289 if (dev == NULL) { 289 if (dev == NULL) {
290 IRDA_ERROR("%s(), can't allocate memory for control block!\n", 290 IRDA_ERROR("%s(), can't allocate memory for control block!\n",
291 __FUNCTION__); 291 __func__);
292 return -ENOMEM; 292 return -ENOMEM;
293 } 293 }
294 294
@@ -312,7 +312,7 @@ static int ali_ircc_open(int i, chipio_t *info)
312 /* Reserve the ioports that we need */ 312 /* Reserve the ioports that we need */
313 if (!request_region(self->io.fir_base, self->io.fir_ext, 313 if (!request_region(self->io.fir_base, self->io.fir_ext,
314 ALI_IRCC_DRIVER_NAME)) { 314 ALI_IRCC_DRIVER_NAME)) {
315 IRDA_WARNING("%s(), can't get iobase of 0x%03x\n", __FUNCTION__, 315 IRDA_WARNING("%s(), can't get iobase of 0x%03x\n", __func__,
316 self->io.fir_base); 316 self->io.fir_base);
317 err = -ENODEV; 317 err = -ENODEV;
318 goto err_out1; 318 goto err_out1;
@@ -370,19 +370,19 @@ static int ali_ircc_open(int i, chipio_t *info)
370 370
371 err = register_netdev(dev); 371 err = register_netdev(dev);
372 if (err) { 372 if (err) {
373 IRDA_ERROR("%s(), register_netdev() failed!\n", __FUNCTION__); 373 IRDA_ERROR("%s(), register_netdev() failed!\n", __func__);
374 goto err_out4; 374 goto err_out4;
375 } 375 }
376 IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); 376 IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name);
377 377
378 /* Check dongle id */ 378 /* Check dongle id */
379 dongle_id = ali_ircc_read_dongle_id(i, info); 379 dongle_id = ali_ircc_read_dongle_id(i, info);
380 IRDA_MESSAGE("%s(), %s, Found dongle: %s\n", __FUNCTION__, 380 IRDA_MESSAGE("%s(), %s, Found dongle: %s\n", __func__,
381 ALI_IRCC_DRIVER_NAME, dongle_types[dongle_id]); 381 ALI_IRCC_DRIVER_NAME, dongle_types[dongle_id]);
382 382
383 self->io.dongle_id = dongle_id; 383 self->io.dongle_id = dongle_id;
384 384
385 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__); 385 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __func__);
386 386
387 return 0; 387 return 0;
388 388
@@ -411,7 +411,7 @@ static int __exit ali_ircc_close(struct ali_ircc_cb *self)
411{ 411{
412 int iobase; 412 int iobase;
413 413
414 IRDA_DEBUG(4, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 414 IRDA_DEBUG(4, "%s(), ---------------- Start ----------------\n", __func__);
415 415
416 IRDA_ASSERT(self != NULL, return -1;); 416 IRDA_ASSERT(self != NULL, return -1;);
417 417
@@ -421,7 +421,7 @@ static int __exit ali_ircc_close(struct ali_ircc_cb *self)
421 unregister_netdev(self->netdev); 421 unregister_netdev(self->netdev);
422 422
423 /* Release the PORT that this driver is using */ 423 /* Release the PORT that this driver is using */
424 IRDA_DEBUG(4, "%s(), Releasing Region %03x\n", __FUNCTION__, self->io.fir_base); 424 IRDA_DEBUG(4, "%s(), Releasing Region %03x\n", __func__, self->io.fir_base);
425 release_region(self->io.fir_base, self->io.fir_ext); 425 release_region(self->io.fir_base, self->io.fir_ext);
426 426
427 if (self->tx_buff.head) 427 if (self->tx_buff.head)
@@ -435,7 +435,7 @@ static int __exit ali_ircc_close(struct ali_ircc_cb *self)
435 dev_self[self->index] = NULL; 435 dev_self[self->index] = NULL;
436 free_netdev(self->netdev); 436 free_netdev(self->netdev);
437 437
438 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__); 438 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __func__);
439 439
440 return 0; 440 return 0;
441} 441}
@@ -478,7 +478,7 @@ static int ali_ircc_probe_53(ali_chip_t *chip, chipio_t *info)
478 int cfg_base = info->cfg_base; 478 int cfg_base = info->cfg_base;
479 int hi, low, reg; 479 int hi, low, reg;
480 480
481 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 481 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
482 482
483 /* Enter Configuration */ 483 /* Enter Configuration */
484 outb(chip->entr1, cfg_base); 484 outb(chip->entr1, cfg_base);
@@ -497,13 +497,13 @@ static int ali_ircc_probe_53(ali_chip_t *chip, chipio_t *info)
497 497
498 info->sir_base = info->fir_base; 498 info->sir_base = info->fir_base;
499 499
500 IRDA_DEBUG(2, "%s(), probing fir_base=0x%03x\n", __FUNCTION__, info->fir_base); 500 IRDA_DEBUG(2, "%s(), probing fir_base=0x%03x\n", __func__, info->fir_base);
501 501
502 /* Read IRQ control register */ 502 /* Read IRQ control register */
503 outb(0x70, cfg_base); 503 outb(0x70, cfg_base);
504 reg = inb(cfg_base+1); 504 reg = inb(cfg_base+1);
505 info->irq = reg & 0x0f; 505 info->irq = reg & 0x0f;
506 IRDA_DEBUG(2, "%s(), probing irq=%d\n", __FUNCTION__, info->irq); 506 IRDA_DEBUG(2, "%s(), probing irq=%d\n", __func__, info->irq);
507 507
508 /* Read DMA channel */ 508 /* Read DMA channel */
509 outb(0x74, cfg_base); 509 outb(0x74, cfg_base);
@@ -511,26 +511,26 @@ static int ali_ircc_probe_53(ali_chip_t *chip, chipio_t *info)
511 info->dma = reg & 0x07; 511 info->dma = reg & 0x07;
512 512
513 if(info->dma == 0x04) 513 if(info->dma == 0x04)
514 IRDA_WARNING("%s(), No DMA channel assigned !\n", __FUNCTION__); 514 IRDA_WARNING("%s(), No DMA channel assigned !\n", __func__);
515 else 515 else
516 IRDA_DEBUG(2, "%s(), probing dma=%d\n", __FUNCTION__, info->dma); 516 IRDA_DEBUG(2, "%s(), probing dma=%d\n", __func__, info->dma);
517 517
518 /* Read Enabled Status */ 518 /* Read Enabled Status */
519 outb(0x30, cfg_base); 519 outb(0x30, cfg_base);
520 reg = inb(cfg_base+1); 520 reg = inb(cfg_base+1);
521 info->enabled = (reg & 0x80) && (reg & 0x01); 521 info->enabled = (reg & 0x80) && (reg & 0x01);
522 IRDA_DEBUG(2, "%s(), probing enabled=%d\n", __FUNCTION__, info->enabled); 522 IRDA_DEBUG(2, "%s(), probing enabled=%d\n", __func__, info->enabled);
523 523
524 /* Read Power Status */ 524 /* Read Power Status */
525 outb(0x22, cfg_base); 525 outb(0x22, cfg_base);
526 reg = inb(cfg_base+1); 526 reg = inb(cfg_base+1);
527 info->suspended = (reg & 0x20); 527 info->suspended = (reg & 0x20);
528 IRDA_DEBUG(2, "%s(), probing suspended=%d\n", __FUNCTION__, info->suspended); 528 IRDA_DEBUG(2, "%s(), probing suspended=%d\n", __func__, info->suspended);
529 529
530 /* Exit configuration */ 530 /* Exit configuration */
531 outb(0xbb, cfg_base); 531 outb(0xbb, cfg_base);
532 532
533 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __FUNCTION__); 533 IRDA_DEBUG(2, "%s(), ----------------- End -----------------\n", __func__);
534 534
535 return 0; 535 return 0;
536} 536}
@@ -548,7 +548,7 @@ static int ali_ircc_setup(chipio_t *info)
548 int version; 548 int version;
549 int iobase = info->fir_base; 549 int iobase = info->fir_base;
550 550
551 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 551 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
552 552
553 /* Locking comments : 553 /* Locking comments :
554 * Most operations here need to be protected. We are called before 554 * Most operations here need to be protected. We are called before
@@ -609,7 +609,7 @@ static int ali_ircc_setup(chipio_t *info)
609 // outb(UART_IER_RDI, iobase+UART_IER); //benjamin 2000/11/23 01:25PM 609 // outb(UART_IER_RDI, iobase+UART_IER); //benjamin 2000/11/23 01:25PM
610 // Turn on the interrupts in ali_ircc_net_open 610 // Turn on the interrupts in ali_ircc_net_open
611 611
612 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__); 612 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__);
613 613
614 return 0; 614 return 0;
615} 615}
@@ -626,7 +626,7 @@ static int ali_ircc_read_dongle_id (int i, chipio_t *info)
626 int dongle_id, reg; 626 int dongle_id, reg;
627 int cfg_base = info->cfg_base; 627 int cfg_base = info->cfg_base;
628 628
629 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 629 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
630 630
631 /* Enter Configuration */ 631 /* Enter Configuration */
632 outb(chips[i].entr1, cfg_base); 632 outb(chips[i].entr1, cfg_base);
@@ -640,13 +640,13 @@ static int ali_ircc_read_dongle_id (int i, chipio_t *info)
640 outb(0xf0, cfg_base); 640 outb(0xf0, cfg_base);
641 reg = inb(cfg_base+1); 641 reg = inb(cfg_base+1);
642 dongle_id = ((reg>>6)&0x02) | ((reg>>5)&0x01); 642 dongle_id = ((reg>>6)&0x02) | ((reg>>5)&0x01);
643 IRDA_DEBUG(2, "%s(), probing dongle_id=%d, dongle_types=%s\n", __FUNCTION__, 643 IRDA_DEBUG(2, "%s(), probing dongle_id=%d, dongle_types=%s\n", __func__,
644 dongle_id, dongle_types[dongle_id]); 644 dongle_id, dongle_types[dongle_id]);
645 645
646 /* Exit configuration */ 646 /* Exit configuration */
647 outb(0xbb, cfg_base); 647 outb(0xbb, cfg_base);
648 648
649 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__); 649 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__);
650 650
651 return dongle_id; 651 return dongle_id;
652} 652}
@@ -663,7 +663,7 @@ static irqreturn_t ali_ircc_interrupt(int irq, void *dev_id)
663 struct ali_ircc_cb *self; 663 struct ali_ircc_cb *self;
664 int ret; 664 int ret;
665 665
666 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 666 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
667 667
668 self = dev->priv; 668 self = dev->priv;
669 669
@@ -677,7 +677,7 @@ static irqreturn_t ali_ircc_interrupt(int irq, void *dev_id)
677 677
678 spin_unlock(&self->lock); 678 spin_unlock(&self->lock);
679 679
680 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__); 680 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__);
681 return ret; 681 return ret;
682} 682}
683/* 683/*
@@ -691,7 +691,7 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
691 __u8 eir, OldMessageCount; 691 __u8 eir, OldMessageCount;
692 int iobase, tmp; 692 int iobase, tmp;
693 693
694 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 694 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__);
695 695
696 iobase = self->io.fir_base; 696 iobase = self->io.fir_base;
697 697
@@ -704,10 +704,10 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
704 //self->ier = inb(iobase+FIR_IER); 2000/12/1 04:32PM 704 //self->ier = inb(iobase+FIR_IER); 2000/12/1 04:32PM
705 eir = self->InterruptID & self->ier; /* Mask out the interesting ones */ 705 eir = self->InterruptID & self->ier; /* Mask out the interesting ones */
706 706
707 IRDA_DEBUG(1, "%s(), self->InterruptID = %x\n", __FUNCTION__,self->InterruptID); 707 IRDA_DEBUG(1, "%s(), self->InterruptID = %x\n", __func__,self->InterruptID);
708 IRDA_DEBUG(1, "%s(), self->LineStatus = %x\n", __FUNCTION__,self->LineStatus); 708 IRDA_DEBUG(1, "%s(), self->LineStatus = %x\n", __func__,self->LineStatus);
709 IRDA_DEBUG(1, "%s(), self->ier = %x\n", __FUNCTION__,self->ier); 709 IRDA_DEBUG(1, "%s(), self->ier = %x\n", __func__,self->ier);
710 IRDA_DEBUG(1, "%s(), eir = %x\n", __FUNCTION__,eir); 710 IRDA_DEBUG(1, "%s(), eir = %x\n", __func__,eir);
711 711
712 /* Disable interrupts */ 712 /* Disable interrupts */
713 SetCOMInterrupts(self, FALSE); 713 SetCOMInterrupts(self, FALSE);
@@ -718,7 +718,7 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
718 { 718 {
719 if (self->io.direction == IO_XMIT) /* TX */ 719 if (self->io.direction == IO_XMIT) /* TX */
720 { 720 {
721 IRDA_DEBUG(1, "%s(), ******* IIR_EOM (Tx) *******\n", __FUNCTION__); 721 IRDA_DEBUG(1, "%s(), ******* IIR_EOM (Tx) *******\n", __func__);
722 722
723 if(ali_ircc_dma_xmit_complete(self)) 723 if(ali_ircc_dma_xmit_complete(self))
724 { 724 {
@@ -737,23 +737,23 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
737 } 737 }
738 else /* RX */ 738 else /* RX */
739 { 739 {
740 IRDA_DEBUG(1, "%s(), ******* IIR_EOM (Rx) *******\n", __FUNCTION__); 740 IRDA_DEBUG(1, "%s(), ******* IIR_EOM (Rx) *******\n", __func__);
741 741
742 if(OldMessageCount > ((self->LineStatus+1) & 0x07)) 742 if(OldMessageCount > ((self->LineStatus+1) & 0x07))
743 { 743 {
744 self->rcvFramesOverflow = TRUE; 744 self->rcvFramesOverflow = TRUE;
745 IRDA_DEBUG(1, "%s(), ******* self->rcvFramesOverflow = TRUE ******** \n", __FUNCTION__); 745 IRDA_DEBUG(1, "%s(), ******* self->rcvFramesOverflow = TRUE ******** \n", __func__);
746 } 746 }
747 747
748 if (ali_ircc_dma_receive_complete(self)) 748 if (ali_ircc_dma_receive_complete(self))
749 { 749 {
750 IRDA_DEBUG(1, "%s(), ******* receive complete ******** \n", __FUNCTION__); 750 IRDA_DEBUG(1, "%s(), ******* receive complete ******** \n", __func__);
751 751
752 self->ier = IER_EOM; 752 self->ier = IER_EOM;
753 } 753 }
754 else 754 else
755 { 755 {
756 IRDA_DEBUG(1, "%s(), ******* Not receive complete ******** \n", __FUNCTION__); 756 IRDA_DEBUG(1, "%s(), ******* Not receive complete ******** \n", __func__);
757 757
758 self->ier = IER_EOM | IER_TIMER; 758 self->ier = IER_EOM | IER_TIMER;
759 } 759 }
@@ -766,7 +766,7 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
766 if(OldMessageCount > ((self->LineStatus+1) & 0x07)) 766 if(OldMessageCount > ((self->LineStatus+1) & 0x07))
767 { 767 {
768 self->rcvFramesOverflow = TRUE; 768 self->rcvFramesOverflow = TRUE;
769 IRDA_DEBUG(1, "%s(), ******* self->rcvFramesOverflow = TRUE ******* \n", __FUNCTION__); 769 IRDA_DEBUG(1, "%s(), ******* self->rcvFramesOverflow = TRUE ******* \n", __func__);
770 } 770 }
771 /* Disable Timer */ 771 /* Disable Timer */
772 switch_bank(iobase, BANK1); 772 switch_bank(iobase, BANK1);
@@ -798,7 +798,7 @@ static irqreturn_t ali_ircc_fir_interrupt(struct ali_ircc_cb *self)
798 /* Restore Interrupt */ 798 /* Restore Interrupt */
799 SetCOMInterrupts(self, TRUE); 799 SetCOMInterrupts(self, TRUE);
800 800
801 IRDA_DEBUG(1, "%s(), ----------------- End ---------------\n", __FUNCTION__); 801 IRDA_DEBUG(1, "%s(), ----------------- End ---------------\n", __func__);
802 return IRQ_RETVAL(eir); 802 return IRQ_RETVAL(eir);
803} 803}
804 804
@@ -813,7 +813,7 @@ static irqreturn_t ali_ircc_sir_interrupt(struct ali_ircc_cb *self)
813 int iobase; 813 int iobase;
814 int iir, lsr; 814 int iir, lsr;
815 815
816 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 816 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
817 817
818 iobase = self->io.sir_base; 818 iobase = self->io.sir_base;
819 819
@@ -822,13 +822,13 @@ static irqreturn_t ali_ircc_sir_interrupt(struct ali_ircc_cb *self)
822 /* Clear interrupt */ 822 /* Clear interrupt */
823 lsr = inb(iobase+UART_LSR); 823 lsr = inb(iobase+UART_LSR);
824 824
825 IRDA_DEBUG(4, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n", __FUNCTION__, 825 IRDA_DEBUG(4, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n", __func__,
826 iir, lsr, iobase); 826 iir, lsr, iobase);
827 827
828 switch (iir) 828 switch (iir)
829 { 829 {
830 case UART_IIR_RLSI: 830 case UART_IIR_RLSI:
831 IRDA_DEBUG(2, "%s(), RLSI\n", __FUNCTION__); 831 IRDA_DEBUG(2, "%s(), RLSI\n", __func__);
832 break; 832 break;
833 case UART_IIR_RDI: 833 case UART_IIR_RDI:
834 /* Receive interrupt */ 834 /* Receive interrupt */
@@ -842,14 +842,14 @@ static irqreturn_t ali_ircc_sir_interrupt(struct ali_ircc_cb *self)
842 } 842 }
843 break; 843 break;
844 default: 844 default:
845 IRDA_DEBUG(0, "%s(), unhandled IIR=%#x\n", __FUNCTION__, iir); 845 IRDA_DEBUG(0, "%s(), unhandled IIR=%#x\n", __func__, iir);
846 break; 846 break;
847 } 847 }
848 848
849 } 849 }
850 850
851 851
852 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__); 852 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__);
853 853
854 return IRQ_RETVAL(iir); 854 return IRQ_RETVAL(iir);
855} 855}
@@ -866,7 +866,7 @@ static void ali_ircc_sir_receive(struct ali_ircc_cb *self)
866 int boguscount = 0; 866 int boguscount = 0;
867 int iobase; 867 int iobase;
868 868
869 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__); 869 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__);
870 IRDA_ASSERT(self != NULL, return;); 870 IRDA_ASSERT(self != NULL, return;);
871 871
872 iobase = self->io.sir_base; 872 iobase = self->io.sir_base;
@@ -881,12 +881,12 @@ static void ali_ircc_sir_receive(struct ali_ircc_cb *self)
881 881
882 /* Make sure we don't stay here too long */ 882 /* Make sure we don't stay here too long */
883 if (boguscount++ > 32) { 883 if (boguscount++ > 32) {
884 IRDA_DEBUG(2,"%s(), breaking!\n", __FUNCTION__); 884 IRDA_DEBUG(2,"%s(), breaking!\n", __func__);
885 break; 885 break;
886 } 886 }
887 } while (inb(iobase+UART_LSR) & UART_LSR_DR); 887 } while (inb(iobase+UART_LSR) & UART_LSR_DR);
888 888
889 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 889 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
890} 890}
891 891
892/* 892/*
@@ -903,7 +903,7 @@ static void ali_ircc_sir_write_wakeup(struct ali_ircc_cb *self)
903 903
904 IRDA_ASSERT(self != NULL, return;); 904 IRDA_ASSERT(self != NULL, return;);
905 905
906 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 906 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
907 907
908 iobase = self->io.sir_base; 908 iobase = self->io.sir_base;
909 909
@@ -922,16 +922,16 @@ static void ali_ircc_sir_write_wakeup(struct ali_ircc_cb *self)
922 { 922 {
923 /* We must wait until all data are gone */ 923 /* We must wait until all data are gone */
924 while(!(inb(iobase+UART_LSR) & UART_LSR_TEMT)) 924 while(!(inb(iobase+UART_LSR) & UART_LSR_TEMT))
925 IRDA_DEBUG(1, "%s(), UART_LSR_THRE\n", __FUNCTION__ ); 925 IRDA_DEBUG(1, "%s(), UART_LSR_THRE\n", __func__ );
926 926
927 IRDA_DEBUG(1, "%s(), Changing speed! self->new_speed = %d\n", __FUNCTION__ , self->new_speed); 927 IRDA_DEBUG(1, "%s(), Changing speed! self->new_speed = %d\n", __func__ , self->new_speed);
928 ali_ircc_change_speed(self, self->new_speed); 928 ali_ircc_change_speed(self, self->new_speed);
929 self->new_speed = 0; 929 self->new_speed = 0;
930 930
931 // benjamin 2000/11/10 06:32PM 931 // benjamin 2000/11/10 06:32PM
932 if (self->io.speed > 115200) 932 if (self->io.speed > 115200)
933 { 933 {
934 IRDA_DEBUG(2, "%s(), ali_ircc_change_speed from UART_LSR_TEMT \n", __FUNCTION__ ); 934 IRDA_DEBUG(2, "%s(), ali_ircc_change_speed from UART_LSR_TEMT \n", __func__ );
935 935
936 self->ier = IER_EOM; 936 self->ier = IER_EOM;
937 // SetCOMInterrupts(self, TRUE); 937 // SetCOMInterrupts(self, TRUE);
@@ -949,7 +949,7 @@ static void ali_ircc_sir_write_wakeup(struct ali_ircc_cb *self)
949 outb(UART_IER_RDI, iobase+UART_IER); 949 outb(UART_IER_RDI, iobase+UART_IER);
950 } 950 }
951 951
952 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 952 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
953} 953}
954 954
955static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud) 955static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
@@ -957,9 +957,9 @@ static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
957 struct net_device *dev = self->netdev; 957 struct net_device *dev = self->netdev;
958 int iobase; 958 int iobase;
959 959
960 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 960 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
961 961
962 IRDA_DEBUG(2, "%s(), setting speed = %d \n", __FUNCTION__ , baud); 962 IRDA_DEBUG(2, "%s(), setting speed = %d \n", __func__ , baud);
963 963
964 /* This function *must* be called with irq off and spin-lock. 964 /* This function *must* be called with irq off and spin-lock.
965 * - Jean II */ 965 * - Jean II */
@@ -998,7 +998,7 @@ static void ali_ircc_change_speed(struct ali_ircc_cb *self, __u32 baud)
998 998
999 netif_wake_queue(self->netdev); 999 netif_wake_queue(self->netdev);
1000 1000
1001 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1001 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
1002} 1002}
1003 1003
1004static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 baud) 1004static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 baud)
@@ -1008,14 +1008,14 @@ static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 baud)
1008 struct ali_ircc_cb *self = (struct ali_ircc_cb *) priv; 1008 struct ali_ircc_cb *self = (struct ali_ircc_cb *) priv;
1009 struct net_device *dev; 1009 struct net_device *dev;
1010 1010
1011 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 1011 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
1012 1012
1013 IRDA_ASSERT(self != NULL, return;); 1013 IRDA_ASSERT(self != NULL, return;);
1014 1014
1015 dev = self->netdev; 1015 dev = self->netdev;
1016 iobase = self->io.fir_base; 1016 iobase = self->io.fir_base;
1017 1017
1018 IRDA_DEBUG(1, "%s(), self->io.speed = %d, change to speed = %d\n", __FUNCTION__ ,self->io.speed,baud); 1018 IRDA_DEBUG(1, "%s(), self->io.speed = %d, change to speed = %d\n", __func__ ,self->io.speed,baud);
1019 1019
1020 /* Come from SIR speed */ 1020 /* Come from SIR speed */
1021 if(self->io.speed <=115200) 1021 if(self->io.speed <=115200)
@@ -1029,7 +1029,7 @@ static void ali_ircc_fir_change_speed(struct ali_ircc_cb *priv, __u32 baud)
1029 // Set Dongle Speed mode 1029 // Set Dongle Speed mode
1030 ali_ircc_change_dongle_speed(self, baud); 1030 ali_ircc_change_dongle_speed(self, baud);
1031 1031
1032 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1032 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
1033} 1033}
1034 1034
1035/* 1035/*
@@ -1047,9 +1047,9 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
1047 int lcr; /* Line control reg */ 1047 int lcr; /* Line control reg */
1048 int divisor; 1048 int divisor;
1049 1049
1050 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 1050 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
1051 1051
1052 IRDA_DEBUG(1, "%s(), Setting speed to: %d\n", __FUNCTION__ , speed); 1052 IRDA_DEBUG(1, "%s(), Setting speed to: %d\n", __func__ , speed);
1053 1053
1054 IRDA_ASSERT(self != NULL, return;); 1054 IRDA_ASSERT(self != NULL, return;);
1055 1055
@@ -1103,7 +1103,7 @@ static void ali_ircc_sir_change_speed(struct ali_ircc_cb *priv, __u32 speed)
1103 1103
1104 spin_unlock_irqrestore(&self->lock, flags); 1104 spin_unlock_irqrestore(&self->lock, flags);
1105 1105
1106 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1106 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
1107} 1107}
1108 1108
1109static void ali_ircc_change_dongle_speed(struct ali_ircc_cb *priv, int speed) 1109static void ali_ircc_change_dongle_speed(struct ali_ircc_cb *priv, int speed)
@@ -1113,14 +1113,14 @@ static void ali_ircc_change_dongle_speed(struct ali_ircc_cb *priv, int speed)
1113 int iobase,dongle_id; 1113 int iobase,dongle_id;
1114 int tmp = 0; 1114 int tmp = 0;
1115 1115
1116 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 1116 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
1117 1117
1118 iobase = self->io.fir_base; /* or iobase = self->io.sir_base; */ 1118 iobase = self->io.fir_base; /* or iobase = self->io.sir_base; */
1119 dongle_id = self->io.dongle_id; 1119 dongle_id = self->io.dongle_id;
1120 1120
1121 /* We are already locked, no need to do it again */ 1121 /* We are already locked, no need to do it again */
1122 1122
1123 IRDA_DEBUG(1, "%s(), Set Speed for %s , Speed = %d\n", __FUNCTION__ , dongle_types[dongle_id], speed); 1123 IRDA_DEBUG(1, "%s(), Set Speed for %s , Speed = %d\n", __func__ , dongle_types[dongle_id], speed);
1124 1124
1125 switch_bank(iobase, BANK2); 1125 switch_bank(iobase, BANK2);
1126 tmp = inb(iobase+FIR_IRDA_CR); 1126 tmp = inb(iobase+FIR_IRDA_CR);
@@ -1284,7 +1284,7 @@ static void ali_ircc_change_dongle_speed(struct ali_ircc_cb *priv, int speed)
1284 1284
1285 switch_bank(iobase, BANK0); 1285 switch_bank(iobase, BANK0);
1286 1286
1287 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1287 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
1288} 1288}
1289 1289
1290/* 1290/*
@@ -1297,11 +1297,11 @@ static int ali_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len)
1297{ 1297{
1298 int actual = 0; 1298 int actual = 0;
1299 1299
1300 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 1300 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
1301 1301
1302 /* Tx FIFO should be empty! */ 1302 /* Tx FIFO should be empty! */
1303 if (!(inb(iobase+UART_LSR) & UART_LSR_THRE)) { 1303 if (!(inb(iobase+UART_LSR) & UART_LSR_THRE)) {
1304 IRDA_DEBUG(0, "%s(), failed, fifo not empty!\n", __FUNCTION__ ); 1304 IRDA_DEBUG(0, "%s(), failed, fifo not empty!\n", __func__ );
1305 return 0; 1305 return 0;
1306 } 1306 }
1307 1307
@@ -1313,7 +1313,7 @@ static int ali_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len)
1313 actual++; 1313 actual++;
1314 } 1314 }
1315 1315
1316 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1316 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
1317 return actual; 1317 return actual;
1318} 1318}
1319 1319
@@ -1329,7 +1329,7 @@ static int ali_ircc_net_open(struct net_device *dev)
1329 int iobase; 1329 int iobase;
1330 char hwname[32]; 1330 char hwname[32];
1331 1331
1332 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 1332 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
1333 1333
1334 IRDA_ASSERT(dev != NULL, return -1;); 1334 IRDA_ASSERT(dev != NULL, return -1;);
1335 1335
@@ -1375,7 +1375,7 @@ static int ali_ircc_net_open(struct net_device *dev)
1375 */ 1375 */
1376 self->irlap = irlap_open(dev, &self->qos, hwname); 1376 self->irlap = irlap_open(dev, &self->qos, hwname);
1377 1377
1378 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1378 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
1379 1379
1380 return 0; 1380 return 0;
1381} 1381}
@@ -1392,7 +1392,7 @@ static int ali_ircc_net_close(struct net_device *dev)
1392 struct ali_ircc_cb *self; 1392 struct ali_ircc_cb *self;
1393 //int iobase; 1393 //int iobase;
1394 1394
1395 IRDA_DEBUG(4, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 1395 IRDA_DEBUG(4, "%s(), ---------------- Start ----------------\n", __func__ );
1396 1396
1397 IRDA_ASSERT(dev != NULL, return -1;); 1397 IRDA_ASSERT(dev != NULL, return -1;);
1398 1398
@@ -1415,7 +1415,7 @@ static int ali_ircc_net_close(struct net_device *dev)
1415 free_irq(self->io.irq, dev); 1415 free_irq(self->io.irq, dev);
1416 free_dma(self->io.dma); 1416 free_dma(self->io.dma);
1417 1417
1418 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1418 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
1419 1419
1420 return 0; 1420 return 0;
1421} 1421}
@@ -1434,7 +1434,7 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
1434 __u32 speed; 1434 __u32 speed;
1435 int mtt, diff; 1435 int mtt, diff;
1436 1436
1437 IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __FUNCTION__ ); 1437 IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __func__ );
1438 1438
1439 self = (struct ali_ircc_cb *) dev->priv; 1439 self = (struct ali_ircc_cb *) dev->priv;
1440 iobase = self->io.fir_base; 1440 iobase = self->io.fir_base;
@@ -1488,7 +1488,7 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
1488 diff = self->now.tv_usec - self->stamp.tv_usec; 1488 diff = self->now.tv_usec - self->stamp.tv_usec;
1489 /* self->stamp is set from ali_ircc_dma_receive_complete() */ 1489 /* self->stamp is set from ali_ircc_dma_receive_complete() */
1490 1490
1491 IRDA_DEBUG(1, "%s(), ******* diff = %d ******* \n", __FUNCTION__ , diff); 1491 IRDA_DEBUG(1, "%s(), ******* diff = %d ******* \n", __func__ , diff);
1492 1492
1493 if (diff < 0) 1493 if (diff < 0)
1494 diff += 1000000; 1494 diff += 1000000;
@@ -1510,7 +1510,7 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
1510 /* Adjust for timer resolution */ 1510 /* Adjust for timer resolution */
1511 mtt = (mtt+250) / 500; /* 4 discard, 5 get advanced, Let's round off */ 1511 mtt = (mtt+250) / 500; /* 4 discard, 5 get advanced, Let's round off */
1512 1512
1513 IRDA_DEBUG(1, "%s(), ************** mtt = %d ***********\n", __FUNCTION__ , mtt); 1513 IRDA_DEBUG(1, "%s(), ************** mtt = %d ***********\n", __func__ , mtt);
1514 1514
1515 /* Setup timer */ 1515 /* Setup timer */
1516 if (mtt == 1) /* 500 us */ 1516 if (mtt == 1) /* 500 us */
@@ -1567,7 +1567,7 @@ static int ali_ircc_fir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
1567 spin_unlock_irqrestore(&self->lock, flags); 1567 spin_unlock_irqrestore(&self->lock, flags);
1568 dev_kfree_skb(skb); 1568 dev_kfree_skb(skb);
1569 1569
1570 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1570 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
1571 return 0; 1571 return 0;
1572} 1572}
1573 1573
@@ -1578,7 +1578,7 @@ static void ali_ircc_dma_xmit(struct ali_ircc_cb *self)
1578 unsigned char FIFO_OPTI, Hi, Lo; 1578 unsigned char FIFO_OPTI, Hi, Lo;
1579 1579
1580 1580
1581 IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __FUNCTION__ ); 1581 IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __func__ );
1582 1582
1583 iobase = self->io.fir_base; 1583 iobase = self->io.fir_base;
1584 1584
@@ -1629,7 +1629,7 @@ static void ali_ircc_dma_xmit(struct ali_ircc_cb *self)
1629 tmp = inb(iobase+FIR_LCR_B); 1629 tmp = inb(iobase+FIR_LCR_B);
1630 tmp &= ~0x20; // Disable SIP 1630 tmp &= ~0x20; // Disable SIP
1631 outb(((unsigned char)(tmp & 0x3f) | LCR_B_TX_MODE) & ~LCR_B_BW, iobase+FIR_LCR_B); 1631 outb(((unsigned char)(tmp & 0x3f) | LCR_B_TX_MODE) & ~LCR_B_BW, iobase+FIR_LCR_B);
1632 IRDA_DEBUG(1, "%s(), ******* Change to TX mode: FIR_LCR_B = 0x%x ******* \n", __FUNCTION__ , inb(iobase+FIR_LCR_B)); 1632 IRDA_DEBUG(1, "%s(), ******* Change to TX mode: FIR_LCR_B = 0x%x ******* \n", __func__ , inb(iobase+FIR_LCR_B));
1633 1633
1634 outb(0, iobase+FIR_LSR); 1634 outb(0, iobase+FIR_LSR);
1635 1635
@@ -1639,7 +1639,7 @@ static void ali_ircc_dma_xmit(struct ali_ircc_cb *self)
1639 1639
1640 switch_bank(iobase, BANK0); 1640 switch_bank(iobase, BANK0);
1641 1641
1642 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1642 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
1643} 1643}
1644 1644
1645static int ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self) 1645static int ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self)
@@ -1647,7 +1647,7 @@ static int ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self)
1647 int iobase; 1647 int iobase;
1648 int ret = TRUE; 1648 int ret = TRUE;
1649 1649
1650 IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __FUNCTION__ ); 1650 IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __func__ );
1651 1651
1652 iobase = self->io.fir_base; 1652 iobase = self->io.fir_base;
1653 1653
@@ -1660,7 +1660,7 @@ static int ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self)
1660 if((inb(iobase+FIR_LSR) & LSR_FRAME_ABORT) == LSR_FRAME_ABORT) 1660 if((inb(iobase+FIR_LSR) & LSR_FRAME_ABORT) == LSR_FRAME_ABORT)
1661 1661
1662 { 1662 {
1663 IRDA_ERROR("%s(), ********* LSR_FRAME_ABORT *********\n", __FUNCTION__); 1663 IRDA_ERROR("%s(), ********* LSR_FRAME_ABORT *********\n", __func__);
1664 self->stats.tx_errors++; 1664 self->stats.tx_errors++;
1665 self->stats.tx_fifo_errors++; 1665 self->stats.tx_fifo_errors++;
1666 } 1666 }
@@ -1703,7 +1703,7 @@ static int ali_ircc_dma_xmit_complete(struct ali_ircc_cb *self)
1703 1703
1704 switch_bank(iobase, BANK0); 1704 switch_bank(iobase, BANK0);
1705 1705
1706 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1706 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
1707 return ret; 1707 return ret;
1708} 1708}
1709 1709
@@ -1718,7 +1718,7 @@ static int ali_ircc_dma_receive(struct ali_ircc_cb *self)
1718{ 1718{
1719 int iobase, tmp; 1719 int iobase, tmp;
1720 1720
1721 IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __FUNCTION__ ); 1721 IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __func__ );
1722 1722
1723 iobase = self->io.fir_base; 1723 iobase = self->io.fir_base;
1724 1724
@@ -1756,7 +1756,7 @@ static int ali_ircc_dma_receive(struct ali_ircc_cb *self)
1756 //switch_bank(iobase, BANK0); 1756 //switch_bank(iobase, BANK0);
1757 tmp = inb(iobase+FIR_LCR_B); 1757 tmp = inb(iobase+FIR_LCR_B);
1758 outb((unsigned char)(tmp &0x3f) | LCR_B_RX_MODE | LCR_B_BW , iobase + FIR_LCR_B); // 2000/12/1 05:16PM 1758 outb((unsigned char)(tmp &0x3f) | LCR_B_RX_MODE | LCR_B_BW , iobase + FIR_LCR_B); // 2000/12/1 05:16PM
1759 IRDA_DEBUG(1, "%s(), *** Change To RX mode: FIR_LCR_B = 0x%x *** \n", __FUNCTION__ , inb(iobase+FIR_LCR_B)); 1759 IRDA_DEBUG(1, "%s(), *** Change To RX mode: FIR_LCR_B = 0x%x *** \n", __func__ , inb(iobase+FIR_LCR_B));
1760 1760
1761 /* Set Rx Threshold */ 1761 /* Set Rx Threshold */
1762 switch_bank(iobase, BANK1); 1762 switch_bank(iobase, BANK1);
@@ -1768,7 +1768,7 @@ static int ali_ircc_dma_receive(struct ali_ircc_cb *self)
1768 outb(CR_DMA_EN | CR_DMA_BURST, iobase+FIR_CR); 1768 outb(CR_DMA_EN | CR_DMA_BURST, iobase+FIR_CR);
1769 1769
1770 switch_bank(iobase, BANK0); 1770 switch_bank(iobase, BANK0);
1771 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1771 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
1772 return 0; 1772 return 0;
1773} 1773}
1774 1774
@@ -1779,7 +1779,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1779 __u8 status, MessageCount; 1779 __u8 status, MessageCount;
1780 int len, i, iobase, val; 1780 int len, i, iobase, val;
1781 1781
1782 IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __FUNCTION__ ); 1782 IRDA_DEBUG(1, "%s(), ---------------- Start -----------------\n", __func__ );
1783 1783
1784 st_fifo = &self->st_fifo; 1784 st_fifo = &self->st_fifo;
1785 iobase = self->io.fir_base; 1785 iobase = self->io.fir_base;
@@ -1788,7 +1788,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1788 MessageCount = inb(iobase+ FIR_LSR)&0x07; 1788 MessageCount = inb(iobase+ FIR_LSR)&0x07;
1789 1789
1790 if (MessageCount > 0) 1790 if (MessageCount > 0)
1791 IRDA_DEBUG(0, "%s(), Messsage count = %d,\n", __FUNCTION__ , MessageCount); 1791 IRDA_DEBUG(0, "%s(), Messsage count = %d,\n", __func__ , MessageCount);
1792 1792
1793 for (i=0; i<=MessageCount; i++) 1793 for (i=0; i<=MessageCount; i++)
1794 { 1794 {
@@ -1801,11 +1801,11 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1801 len = len << 8; 1801 len = len << 8;
1802 len |= inb(iobase+FIR_RX_DSR_LO); 1802 len |= inb(iobase+FIR_RX_DSR_LO);
1803 1803
1804 IRDA_DEBUG(1, "%s(), RX Length = 0x%.2x,\n", __FUNCTION__ , len); 1804 IRDA_DEBUG(1, "%s(), RX Length = 0x%.2x,\n", __func__ , len);
1805 IRDA_DEBUG(1, "%s(), RX Status = 0x%.2x,\n", __FUNCTION__ , status); 1805 IRDA_DEBUG(1, "%s(), RX Status = 0x%.2x,\n", __func__ , status);
1806 1806
1807 if (st_fifo->tail >= MAX_RX_WINDOW) { 1807 if (st_fifo->tail >= MAX_RX_WINDOW) {
1808 IRDA_DEBUG(0, "%s(), window is full!\n", __FUNCTION__ ); 1808 IRDA_DEBUG(0, "%s(), window is full!\n", __func__ );
1809 continue; 1809 continue;
1810 } 1810 }
1811 1811
@@ -1828,7 +1828,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1828 /* Check for errors */ 1828 /* Check for errors */
1829 if ((status & 0xd8) || self->rcvFramesOverflow || (len==0)) 1829 if ((status & 0xd8) || self->rcvFramesOverflow || (len==0))
1830 { 1830 {
1831 IRDA_DEBUG(0,"%s(), ************* RX Errors ************ \n", __FUNCTION__ ); 1831 IRDA_DEBUG(0,"%s(), ************* RX Errors ************ \n", __func__ );
1832 1832
1833 /* Skip frame */ 1833 /* Skip frame */
1834 self->stats.rx_errors++; 1834 self->stats.rx_errors++;
@@ -1838,29 +1838,29 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1838 if (status & LSR_FIFO_UR) 1838 if (status & LSR_FIFO_UR)
1839 { 1839 {
1840 self->stats.rx_frame_errors++; 1840 self->stats.rx_frame_errors++;
1841 IRDA_DEBUG(0,"%s(), ************* FIFO Errors ************ \n", __FUNCTION__ ); 1841 IRDA_DEBUG(0,"%s(), ************* FIFO Errors ************ \n", __func__ );
1842 } 1842 }
1843 if (status & LSR_FRAME_ERROR) 1843 if (status & LSR_FRAME_ERROR)
1844 { 1844 {
1845 self->stats.rx_frame_errors++; 1845 self->stats.rx_frame_errors++;
1846 IRDA_DEBUG(0,"%s(), ************* FRAME Errors ************ \n", __FUNCTION__ ); 1846 IRDA_DEBUG(0,"%s(), ************* FRAME Errors ************ \n", __func__ );
1847 } 1847 }
1848 1848
1849 if (status & LSR_CRC_ERROR) 1849 if (status & LSR_CRC_ERROR)
1850 { 1850 {
1851 self->stats.rx_crc_errors++; 1851 self->stats.rx_crc_errors++;
1852 IRDA_DEBUG(0,"%s(), ************* CRC Errors ************ \n", __FUNCTION__ ); 1852 IRDA_DEBUG(0,"%s(), ************* CRC Errors ************ \n", __func__ );
1853 } 1853 }
1854 1854
1855 if(self->rcvFramesOverflow) 1855 if(self->rcvFramesOverflow)
1856 { 1856 {
1857 self->stats.rx_frame_errors++; 1857 self->stats.rx_frame_errors++;
1858 IRDA_DEBUG(0,"%s(), ************* Overran DMA buffer ************ \n", __FUNCTION__ ); 1858 IRDA_DEBUG(0,"%s(), ************* Overran DMA buffer ************ \n", __func__ );
1859 } 1859 }
1860 if(len == 0) 1860 if(len == 0)
1861 { 1861 {
1862 self->stats.rx_frame_errors++; 1862 self->stats.rx_frame_errors++;
1863 IRDA_DEBUG(0,"%s(), ********** Receive Frame Size = 0 ********* \n", __FUNCTION__ ); 1863 IRDA_DEBUG(0,"%s(), ********** Receive Frame Size = 0 ********* \n", __func__ );
1864 } 1864 }
1865 } 1865 }
1866 else 1866 else
@@ -1872,7 +1872,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1872 val = inb(iobase+FIR_BSR); 1872 val = inb(iobase+FIR_BSR);
1873 if ((val& BSR_FIFO_NOT_EMPTY)== 0x80) 1873 if ((val& BSR_FIFO_NOT_EMPTY)== 0x80)
1874 { 1874 {
1875 IRDA_DEBUG(0, "%s(), ************* BSR_FIFO_NOT_EMPTY ************ \n", __FUNCTION__ ); 1875 IRDA_DEBUG(0, "%s(), ************* BSR_FIFO_NOT_EMPTY ************ \n", __func__ );
1876 1876
1877 /* Put this entry back in fifo */ 1877 /* Put this entry back in fifo */
1878 st_fifo->head--; 1878 st_fifo->head--;
@@ -1909,7 +1909,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1909 { 1909 {
1910 IRDA_WARNING("%s(), memory squeeze, " 1910 IRDA_WARNING("%s(), memory squeeze, "
1911 "dropping frame.\n", 1911 "dropping frame.\n",
1912 __FUNCTION__); 1912 __func__);
1913 self->stats.rx_dropped++; 1913 self->stats.rx_dropped++;
1914 1914
1915 return FALSE; 1915 return FALSE;
@@ -1937,7 +1937,7 @@ static int ali_ircc_dma_receive_complete(struct ali_ircc_cb *self)
1937 1937
1938 switch_bank(iobase, BANK0); 1938 switch_bank(iobase, BANK0);
1939 1939
1940 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 1940 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
1941 return TRUE; 1941 return TRUE;
1942} 1942}
1943 1943
@@ -1956,7 +1956,7 @@ static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
1956 int iobase; 1956 int iobase;
1957 __u32 speed; 1957 __u32 speed;
1958 1958
1959 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 1959 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
1960 1960
1961 IRDA_ASSERT(dev != NULL, return 0;); 1961 IRDA_ASSERT(dev != NULL, return 0;);
1962 1962
@@ -2005,7 +2005,7 @@ static int ali_ircc_sir_hard_xmit(struct sk_buff *skb, struct net_device *dev)
2005 2005
2006 dev_kfree_skb(skb); 2006 dev_kfree_skb(skb);
2007 2007
2008 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 2008 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
2009 2009
2010 return 0; 2010 return 0;
2011} 2011}
@@ -2024,7 +2024,7 @@ static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2024 unsigned long flags; 2024 unsigned long flags;
2025 int ret = 0; 2025 int ret = 0;
2026 2026
2027 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 2027 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
2028 2028
2029 IRDA_ASSERT(dev != NULL, return -1;); 2029 IRDA_ASSERT(dev != NULL, return -1;);
2030 2030
@@ -2032,11 +2032,11 @@ static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2032 2032
2033 IRDA_ASSERT(self != NULL, return -1;); 2033 IRDA_ASSERT(self != NULL, return -1;);
2034 2034
2035 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__ , dev->name, cmd); 2035 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__ , dev->name, cmd);
2036 2036
2037 switch (cmd) { 2037 switch (cmd) {
2038 case SIOCSBANDWIDTH: /* Set bandwidth */ 2038 case SIOCSBANDWIDTH: /* Set bandwidth */
2039 IRDA_DEBUG(1, "%s(), SIOCSBANDWIDTH\n", __FUNCTION__ ); 2039 IRDA_DEBUG(1, "%s(), SIOCSBANDWIDTH\n", __func__ );
2040 /* 2040 /*
2041 * This function will also be used by IrLAP to change the 2041 * This function will also be used by IrLAP to change the
2042 * speed, so we still must allow for speed change within 2042 * speed, so we still must allow for speed change within
@@ -2050,13 +2050,13 @@ static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2050 spin_unlock_irqrestore(&self->lock, flags); 2050 spin_unlock_irqrestore(&self->lock, flags);
2051 break; 2051 break;
2052 case SIOCSMEDIABUSY: /* Set media busy */ 2052 case SIOCSMEDIABUSY: /* Set media busy */
2053 IRDA_DEBUG(1, "%s(), SIOCSMEDIABUSY\n", __FUNCTION__ ); 2053 IRDA_DEBUG(1, "%s(), SIOCSMEDIABUSY\n", __func__ );
2054 if (!capable(CAP_NET_ADMIN)) 2054 if (!capable(CAP_NET_ADMIN))
2055 return -EPERM; 2055 return -EPERM;
2056 irda_device_set_media_busy(self->netdev, TRUE); 2056 irda_device_set_media_busy(self->netdev, TRUE);
2057 break; 2057 break;
2058 case SIOCGRECEIVING: /* Check if we are receiving right now */ 2058 case SIOCGRECEIVING: /* Check if we are receiving right now */
2059 IRDA_DEBUG(2, "%s(), SIOCGRECEIVING\n", __FUNCTION__ ); 2059 IRDA_DEBUG(2, "%s(), SIOCGRECEIVING\n", __func__ );
2060 /* This is protected */ 2060 /* This is protected */
2061 irq->ifr_receiving = ali_ircc_is_receiving(self); 2061 irq->ifr_receiving = ali_ircc_is_receiving(self);
2062 break; 2062 break;
@@ -2064,7 +2064,7 @@ static int ali_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2064 ret = -EOPNOTSUPP; 2064 ret = -EOPNOTSUPP;
2065 } 2065 }
2066 2066
2067 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 2067 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
2068 2068
2069 return ret; 2069 return ret;
2070} 2070}
@@ -2081,7 +2081,7 @@ static int ali_ircc_is_receiving(struct ali_ircc_cb *self)
2081 int status = FALSE; 2081 int status = FALSE;
2082 int iobase; 2082 int iobase;
2083 2083
2084 IRDA_DEBUG(2, "%s(), ---------------- Start -----------------\n", __FUNCTION__ ); 2084 IRDA_DEBUG(2, "%s(), ---------------- Start -----------------\n", __func__ );
2085 2085
2086 IRDA_ASSERT(self != NULL, return FALSE;); 2086 IRDA_ASSERT(self != NULL, return FALSE;);
2087 2087
@@ -2095,7 +2095,7 @@ static int ali_ircc_is_receiving(struct ali_ircc_cb *self)
2095 if((inb(iobase+FIR_FIFO_FR) & 0x3f) != 0) 2095 if((inb(iobase+FIR_FIFO_FR) & 0x3f) != 0)
2096 { 2096 {
2097 /* We are receiving something */ 2097 /* We are receiving something */
2098 IRDA_DEBUG(1, "%s(), We are receiving something\n", __FUNCTION__ ); 2098 IRDA_DEBUG(1, "%s(), We are receiving something\n", __func__ );
2099 status = TRUE; 2099 status = TRUE;
2100 } 2100 }
2101 switch_bank(iobase, BANK0); 2101 switch_bank(iobase, BANK0);
@@ -2107,7 +2107,7 @@ static int ali_ircc_is_receiving(struct ali_ircc_cb *self)
2107 2107
2108 spin_unlock_irqrestore(&self->lock, flags); 2108 spin_unlock_irqrestore(&self->lock, flags);
2109 2109
2110 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 2110 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
2111 2111
2112 return status; 2112 return status;
2113} 2113}
@@ -2116,9 +2116,9 @@ static struct net_device_stats *ali_ircc_net_get_stats(struct net_device *dev)
2116{ 2116{
2117 struct ali_ircc_cb *self = (struct ali_ircc_cb *) dev->priv; 2117 struct ali_ircc_cb *self = (struct ali_ircc_cb *) dev->priv;
2118 2118
2119 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 2119 IRDA_DEBUG(2, "%s(), ---------------- Start ----------------\n", __func__ );
2120 2120
2121 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 2121 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
2122 2122
2123 return &self->stats; 2123 return &self->stats;
2124} 2124}
@@ -2164,7 +2164,7 @@ static void SetCOMInterrupts(struct ali_ircc_cb *self , unsigned char enable)
2164 2164
2165 int iobase = self->io.fir_base; /* or sir_base */ 2165 int iobase = self->io.fir_base; /* or sir_base */
2166 2166
2167 IRDA_DEBUG(2, "%s(), -------- Start -------- ( Enable = %d )\n", __FUNCTION__ , enable); 2167 IRDA_DEBUG(2, "%s(), -------- Start -------- ( Enable = %d )\n", __func__ , enable);
2168 2168
2169 /* Enable the interrupt which we wish to */ 2169 /* Enable the interrupt which we wish to */
2170 if (enable){ 2170 if (enable){
@@ -2205,14 +2205,14 @@ static void SetCOMInterrupts(struct ali_ircc_cb *self , unsigned char enable)
2205 else 2205 else
2206 outb(newMask, iobase+UART_IER); 2206 outb(newMask, iobase+UART_IER);
2207 2207
2208 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 2208 IRDA_DEBUG(2, "%s(), ----------------- End ------------------\n", __func__ );
2209} 2209}
2210 2210
2211static void SIR2FIR(int iobase) 2211static void SIR2FIR(int iobase)
2212{ 2212{
2213 //unsigned char tmp; 2213 //unsigned char tmp;
2214 2214
2215 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 2215 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
2216 2216
2217 /* Already protected (change_speed() or setup()), no need to lock. 2217 /* Already protected (change_speed() or setup()), no need to lock.
2218 * Jean II */ 2218 * Jean II */
@@ -2228,14 +2228,14 @@ static void SIR2FIR(int iobase)
2228 //tmp |= 0x20; 2228 //tmp |= 0x20;
2229 //outb(tmp, iobase+FIR_LCR_B); 2229 //outb(tmp, iobase+FIR_LCR_B);
2230 2230
2231 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 2231 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
2232} 2232}
2233 2233
2234static void FIR2SIR(int iobase) 2234static void FIR2SIR(int iobase)
2235{ 2235{
2236 unsigned char val; 2236 unsigned char val;
2237 2237
2238 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __FUNCTION__ ); 2238 IRDA_DEBUG(1, "%s(), ---------------- Start ----------------\n", __func__ );
2239 2239
2240 /* Already protected (change_speed() or setup()), no need to lock. 2240 /* Already protected (change_speed() or setup()), no need to lock.
2241 * Jean II */ 2241 * Jean II */
@@ -2251,7 +2251,7 @@ static void FIR2SIR(int iobase)
2251 val = inb(iobase+UART_LSR); 2251 val = inb(iobase+UART_LSR);
2252 val = inb(iobase+UART_MSR); 2252 val = inb(iobase+UART_MSR);
2253 2253
2254 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __FUNCTION__ ); 2254 IRDA_DEBUG(1, "%s(), ----------------- End ------------------\n", __func__ );
2255} 2255}
2256 2256
2257MODULE_AUTHOR("Benjamin Kong <benjamin_kong@ali.com.tw>"); 2257MODULE_AUTHOR("Benjamin Kong <benjamin_kong@ali.com.tw>");
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
index 34ad189fff67..69d16b30323b 100644
--- a/drivers/net/irda/donauboe.c
+++ b/drivers/net/irda/donauboe.c
@@ -245,7 +245,7 @@ toshoboe_dumpregs (struct toshoboe_cb *self)
245{ 245{
246 __u32 ringbase; 246 __u32 ringbase;
247 247
248 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 248 IRDA_DEBUG (4, "%s()\n", __func__);
249 249
250 ringbase = INB (OBOE_RING_BASE0) << 10; 250 ringbase = INB (OBOE_RING_BASE0) << 10;
251 ringbase |= INB (OBOE_RING_BASE1) << 18; 251 ringbase |= INB (OBOE_RING_BASE1) << 18;
@@ -293,7 +293,7 @@ static void
293toshoboe_disablebm (struct toshoboe_cb *self) 293toshoboe_disablebm (struct toshoboe_cb *self)
294{ 294{
295 __u8 command; 295 __u8 command;
296 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 296 IRDA_DEBUG (4, "%s()\n", __func__);
297 297
298 pci_read_config_byte (self->pdev, PCI_COMMAND, &command); 298 pci_read_config_byte (self->pdev, PCI_COMMAND, &command);
299 command &= ~PCI_COMMAND_MASTER; 299 command &= ~PCI_COMMAND_MASTER;
@@ -305,7 +305,7 @@ toshoboe_disablebm (struct toshoboe_cb *self)
305static void 305static void
306toshoboe_stopchip (struct toshoboe_cb *self) 306toshoboe_stopchip (struct toshoboe_cb *self)
307{ 307{
308 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 308 IRDA_DEBUG (4, "%s()\n", __func__);
309 309
310 /*Disable interrupts */ 310 /*Disable interrupts */
311 OUTB (0x0, OBOE_IER); 311 OUTB (0x0, OBOE_IER);
@@ -350,7 +350,7 @@ toshoboe_setbaud (struct toshoboe_cb *self)
350 __u16 pconfig = 0; 350 __u16 pconfig = 0;
351 __u8 config0l = 0; 351 __u8 config0l = 0;
352 352
353 IRDA_DEBUG (2, "%s(%d/%d)\n", __FUNCTION__, self->speed, self->io.speed); 353 IRDA_DEBUG (2, "%s(%d/%d)\n", __func__, self->speed, self->io.speed);
354 354
355 switch (self->speed) 355 switch (self->speed)
356 { 356 {
@@ -482,7 +482,7 @@ toshoboe_setbaud (struct toshoboe_cb *self)
482static void 482static void
483toshoboe_enablebm (struct toshoboe_cb *self) 483toshoboe_enablebm (struct toshoboe_cb *self)
484{ 484{
485 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 485 IRDA_DEBUG (4, "%s()\n", __func__);
486 pci_set_master (self->pdev); 486 pci_set_master (self->pdev);
487} 487}
488 488
@@ -492,7 +492,7 @@ toshoboe_initring (struct toshoboe_cb *self)
492{ 492{
493 int i; 493 int i;
494 494
495 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 495 IRDA_DEBUG (4, "%s()\n", __func__);
496 496
497 for (i = 0; i < TX_SLOTS; ++i) 497 for (i = 0; i < TX_SLOTS; ++i)
498 { 498 {
@@ -550,7 +550,7 @@ toshoboe_startchip (struct toshoboe_cb *self)
550{ 550{
551 __u32 physaddr; 551 __u32 physaddr;
552 552
553 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 553 IRDA_DEBUG (4, "%s()\n", __func__);
554 554
555 toshoboe_initring (self); 555 toshoboe_initring (self);
556 toshoboe_enablebm (self); 556 toshoboe_enablebm (self);
@@ -824,7 +824,7 @@ toshoboe_probe (struct toshoboe_cb *self)
824#endif 824#endif
825 unsigned long flags; 825 unsigned long flags;
826 826
827 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 827 IRDA_DEBUG (4, "%s()\n", __func__);
828 828
829 if (request_irq (self->io.irq, toshoboe_probeinterrupt, 829 if (request_irq (self->io.irq, toshoboe_probeinterrupt,
830 self->io.irqflags, "toshoboe", (void *) self)) 830 self->io.irqflags, "toshoboe", (void *) self))
@@ -983,10 +983,10 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
983 983
984 IRDA_ASSERT (self != NULL, return 0; ); 984 IRDA_ASSERT (self != NULL, return 0; );
985 985
986 IRDA_DEBUG (1, "%s.tx:%x(%x)%x\n", __FUNCTION__ 986 IRDA_DEBUG (1, "%s.tx:%x(%x)%x\n", __func__
987 ,skb->len,self->txpending,INB (OBOE_ENABLEH)); 987 ,skb->len,self->txpending,INB (OBOE_ENABLEH));
988 if (!cb->magic) { 988 if (!cb->magic) {
989 IRDA_DEBUG (2, "%s.Not IrLAP:%x\n", __FUNCTION__, cb->magic); 989 IRDA_DEBUG (2, "%s.Not IrLAP:%x\n", __func__, cb->magic);
990#ifdef DUMP_PACKETS 990#ifdef DUMP_PACKETS
991 _dumpbufs(skb->data,skb->len,'>'); 991 _dumpbufs(skb->data,skb->len,'>');
992#endif 992#endif
@@ -1015,7 +1015,7 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
1015 { 1015 {
1016 self->new_speed = speed; 1016 self->new_speed = speed;
1017 IRDA_DEBUG (1, "%s: Queued TxDone scheduled speed change %d\n" , 1017 IRDA_DEBUG (1, "%s: Queued TxDone scheduled speed change %d\n" ,
1018 __FUNCTION__, speed); 1018 __func__, speed);
1019 /* if no data, that's all! */ 1019 /* if no data, that's all! */
1020 if (!skb->len) 1020 if (!skb->len)
1021 { 1021 {
@@ -1057,7 +1057,7 @@ toshoboe_hard_xmit (struct sk_buff *skb, struct net_device *dev)
1057 /* which we will add a wrong checksum to */ 1057 /* which we will add a wrong checksum to */
1058 1058
1059 mtt = toshoboe_makemttpacket (self, self->tx_bufs[self->txs], mtt); 1059 mtt = toshoboe_makemttpacket (self, self->tx_bufs[self->txs], mtt);
1060 IRDA_DEBUG (1, "%s.mtt:%x(%x)%d\n", __FUNCTION__ 1060 IRDA_DEBUG (1, "%s.mtt:%x(%x)%d\n", __func__
1061 ,skb->len,mtt,self->txpending); 1061 ,skb->len,mtt,self->txpending);
1062 if (mtt) 1062 if (mtt)
1063 { 1063 {
@@ -1101,7 +1101,7 @@ dumpbufs(skb->data,skb->len,'>');
1101 1101
1102 if (self->ring->tx[self->txs].control & OBOE_CTL_TX_HW_OWNS) 1102 if (self->ring->tx[self->txs].control & OBOE_CTL_TX_HW_OWNS)
1103 { 1103 {
1104 IRDA_DEBUG (0, "%s.ful:%x(%x)%x\n", __FUNCTION__ 1104 IRDA_DEBUG (0, "%s.ful:%x(%x)%x\n", __func__
1105 ,skb->len, self->ring->tx[self->txs].control, self->txpending); 1105 ,skb->len, self->ring->tx[self->txs].control, self->txpending);
1106 toshoboe_start_DMA(self, OBOE_CONFIG0H_ENTX); 1106 toshoboe_start_DMA(self, OBOE_CONFIG0H_ENTX);
1107 spin_unlock_irqrestore(&self->spinlock, flags); 1107 spin_unlock_irqrestore(&self->spinlock, flags);
@@ -1179,7 +1179,7 @@ toshoboe_interrupt (int irq, void *dev_id)
1179 if (self->ring->tx[i].control & OBOE_CTL_TX_HW_OWNS) 1179 if (self->ring->tx[i].control & OBOE_CTL_TX_HW_OWNS)
1180 self->txpending++; 1180 self->txpending++;
1181 } 1181 }
1182 IRDA_DEBUG (1, "%s.txd(%x)%x/%x\n", __FUNCTION__ 1182 IRDA_DEBUG (1, "%s.txd(%x)%x/%x\n", __func__
1183 ,irqstat,txp,self->txpending); 1183 ,irqstat,txp,self->txpending);
1184 1184
1185 txp = INB (OBOE_TXSLOT) & OBOE_SLOT_MASK; 1185 txp = INB (OBOE_TXSLOT) & OBOE_SLOT_MASK;
@@ -1209,7 +1209,7 @@ toshoboe_interrupt (int irq, void *dev_id)
1209 { 1209 {
1210 self->speed = self->new_speed; 1210 self->speed = self->new_speed;
1211 IRDA_DEBUG (1, "%s: Executed TxDone scheduled speed change %d\n", 1211 IRDA_DEBUG (1, "%s: Executed TxDone scheduled speed change %d\n",
1212 __FUNCTION__, self->speed); 1212 __func__, self->speed);
1213 toshoboe_setbaud (self); 1213 toshoboe_setbaud (self);
1214 } 1214 }
1215 1215
@@ -1224,7 +1224,7 @@ toshoboe_interrupt (int irq, void *dev_id)
1224 { 1224 {
1225 int len = self->ring->rx[self->rxs].len; 1225 int len = self->ring->rx[self->rxs].len;
1226 skb = NULL; 1226 skb = NULL;
1227 IRDA_DEBUG (3, "%s.rcv:%x(%x)\n", __FUNCTION__ 1227 IRDA_DEBUG (3, "%s.rcv:%x(%x)\n", __func__
1228 ,len,self->ring->rx[self->rxs].control); 1228 ,len,self->ring->rx[self->rxs].control);
1229 1229
1230#ifdef DUMP_PACKETS 1230#ifdef DUMP_PACKETS
@@ -1246,7 +1246,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
1246 len -= 2; 1246 len -= 2;
1247 else 1247 else
1248 len = 0; 1248 len = 0;
1249 IRDA_DEBUG (1, "%s.SIR:%x(%x)\n", __FUNCTION__, len,enable); 1249 IRDA_DEBUG (1, "%s.SIR:%x(%x)\n", __func__, len,enable);
1250 } 1250 }
1251 1251
1252#ifdef USE_MIR 1252#ifdef USE_MIR
@@ -1256,7 +1256,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
1256 len -= 2; 1256 len -= 2;
1257 else 1257 else
1258 len = 0; 1258 len = 0;
1259 IRDA_DEBUG (2, "%s.MIR:%x(%x)\n", __FUNCTION__, len,enable); 1259 IRDA_DEBUG (2, "%s.MIR:%x(%x)\n", __func__, len,enable);
1260 } 1260 }
1261#endif 1261#endif
1262 else if (enable & OBOE_ENABLEH_FIRON) 1262 else if (enable & OBOE_ENABLEH_FIRON)
@@ -1265,10 +1265,10 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
1265 len -= 4; /*FIXME: check this */ 1265 len -= 4; /*FIXME: check this */
1266 else 1266 else
1267 len = 0; 1267 len = 0;
1268 IRDA_DEBUG (1, "%s.FIR:%x(%x)\n", __FUNCTION__, len,enable); 1268 IRDA_DEBUG (1, "%s.FIR:%x(%x)\n", __func__, len,enable);
1269 } 1269 }
1270 else 1270 else
1271 IRDA_DEBUG (0, "%s.?IR:%x(%x)\n", __FUNCTION__, len,enable); 1271 IRDA_DEBUG (0, "%s.?IR:%x(%x)\n", __func__, len,enable);
1272 1272
1273 if (len) 1273 if (len)
1274 { 1274 {
@@ -1289,7 +1289,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
1289 { 1289 {
1290 printk (KERN_INFO 1290 printk (KERN_INFO
1291 "%s(), memory squeeze, dropping frame.\n", 1291 "%s(), memory squeeze, dropping frame.\n",
1292 __FUNCTION__); 1292 __func__);
1293 } 1293 }
1294 } 1294 }
1295 } 1295 }
@@ -1301,7 +1301,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
1301 /* (SIR) data is splitted in several slots. */ 1301 /* (SIR) data is splitted in several slots. */
1302 /* we have to join all the received buffers received */ 1302 /* we have to join all the received buffers received */
1303 /*in a large buffer before checking CRC. */ 1303 /*in a large buffer before checking CRC. */
1304 IRDA_DEBUG (0, "%s.err:%x(%x)\n", __FUNCTION__ 1304 IRDA_DEBUG (0, "%s.err:%x(%x)\n", __func__
1305 ,len,self->ring->rx[self->rxs].control); 1305 ,len,self->ring->rx[self->rxs].control);
1306 } 1306 }
1307 1307
@@ -1329,7 +1329,7 @@ dumpbufs(self->rx_bufs[self->rxs],len,'<');
1329 if (irqstat & OBOE_INT_SIP) 1329 if (irqstat & OBOE_INT_SIP)
1330 { 1330 {
1331 self->int_sip++; 1331 self->int_sip++;
1332 IRDA_DEBUG (1, "%s.sip:%x(%x)%x\n", __FUNCTION__ 1332 IRDA_DEBUG (1, "%s.sip:%x(%x)%x\n", __func__
1333 ,self->int_sip,irqstat,self->txpending); 1333 ,self->int_sip,irqstat,self->txpending);
1334 } 1334 }
1335 return IRQ_HANDLED; 1335 return IRQ_HANDLED;
@@ -1343,7 +1343,7 @@ toshoboe_net_open (struct net_device *dev)
1343 unsigned long flags; 1343 unsigned long flags;
1344 int rc; 1344 int rc;
1345 1345
1346 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 1346 IRDA_DEBUG (4, "%s()\n", __func__);
1347 1347
1348 self = netdev_priv(dev); 1348 self = netdev_priv(dev);
1349 1349
@@ -1381,7 +1381,7 @@ toshoboe_net_close (struct net_device *dev)
1381{ 1381{
1382 struct toshoboe_cb *self; 1382 struct toshoboe_cb *self;
1383 1383
1384 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 1384 IRDA_DEBUG (4, "%s()\n", __func__);
1385 1385
1386 IRDA_ASSERT (dev != NULL, return -1; ); 1386 IRDA_ASSERT (dev != NULL, return -1; );
1387 self = (struct toshoboe_cb *) dev->priv; 1387 self = (struct toshoboe_cb *) dev->priv;
@@ -1426,7 +1426,7 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1426 1426
1427 IRDA_ASSERT (self != NULL, return -1; ); 1427 IRDA_ASSERT (self != NULL, return -1; );
1428 1428
1429 IRDA_DEBUG (5, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd); 1429 IRDA_DEBUG (5, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
1430 1430
1431 /* Disable interrupts & save flags */ 1431 /* Disable interrupts & save flags */
1432 spin_lock_irqsave(&self->spinlock, flags); 1432 spin_lock_irqsave(&self->spinlock, flags);
@@ -1438,7 +1438,7 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1438 * speed, so we still must allow for speed change within 1438 * speed, so we still must allow for speed change within
1439 * interrupt context. 1439 * interrupt context.
1440 */ 1440 */
1441 IRDA_DEBUG (1, "%s(BANDWIDTH), %s, (%X/%ld\n", __FUNCTION__ 1441 IRDA_DEBUG (1, "%s(BANDWIDTH), %s, (%X/%ld\n", __func__
1442 ,dev->name, INB (OBOE_STATUS), irq->ifr_baudrate ); 1442 ,dev->name, INB (OBOE_STATUS), irq->ifr_baudrate );
1443 if (!in_interrupt () && !capable (CAP_NET_ADMIN)) { 1443 if (!in_interrupt () && !capable (CAP_NET_ADMIN)) {
1444 ret = -EPERM; 1444 ret = -EPERM;
@@ -1451,7 +1451,7 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1451 self->new_speed = irq->ifr_baudrate; 1451 self->new_speed = irq->ifr_baudrate;
1452 break; 1452 break;
1453 case SIOCSMEDIABUSY: /* Set media busy */ 1453 case SIOCSMEDIABUSY: /* Set media busy */
1454 IRDA_DEBUG (1, "%s(MEDIABUSY), %s, (%X/%x)\n", __FUNCTION__ 1454 IRDA_DEBUG (1, "%s(MEDIABUSY), %s, (%X/%x)\n", __func__
1455 ,dev->name, INB (OBOE_STATUS), capable (CAP_NET_ADMIN) ); 1455 ,dev->name, INB (OBOE_STATUS), capable (CAP_NET_ADMIN) );
1456 if (!capable (CAP_NET_ADMIN)) { 1456 if (!capable (CAP_NET_ADMIN)) {
1457 ret = -EPERM; 1457 ret = -EPERM;
@@ -1461,11 +1461,11 @@ toshoboe_net_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1461 break; 1461 break;
1462 case SIOCGRECEIVING: /* Check if we are receiving right now */ 1462 case SIOCGRECEIVING: /* Check if we are receiving right now */
1463 irq->ifr_receiving = (INB (OBOE_STATUS) & OBOE_STATUS_RXBUSY) ? 1 : 0; 1463 irq->ifr_receiving = (INB (OBOE_STATUS) & OBOE_STATUS_RXBUSY) ? 1 : 0;
1464 IRDA_DEBUG (3, "%s(RECEIVING), %s, (%X/%x)\n", __FUNCTION__ 1464 IRDA_DEBUG (3, "%s(RECEIVING), %s, (%X/%x)\n", __func__
1465 ,dev->name, INB (OBOE_STATUS), irq->ifr_receiving ); 1465 ,dev->name, INB (OBOE_STATUS), irq->ifr_receiving );
1466 break; 1466 break;
1467 default: 1467 default:
1468 IRDA_DEBUG (1, "%s(?), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd); 1468 IRDA_DEBUG (1, "%s(?), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
1469 ret = -EOPNOTSUPP; 1469 ret = -EOPNOTSUPP;
1470 } 1470 }
1471out: 1471out:
@@ -1492,7 +1492,7 @@ toshoboe_close (struct pci_dev *pci_dev)
1492 int i; 1492 int i;
1493 struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev); 1493 struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev);
1494 1494
1495 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 1495 IRDA_DEBUG (4, "%s()\n", __func__);
1496 1496
1497 IRDA_ASSERT (self != NULL, return; ); 1497 IRDA_ASSERT (self != NULL, return; );
1498 1498
@@ -1533,7 +1533,7 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid)
1533 int ok = 0; 1533 int ok = 0;
1534 int err; 1534 int err;
1535 1535
1536 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 1536 IRDA_DEBUG (4, "%s()\n", __func__);
1537 1537
1538 if ((err=pci_enable_device(pci_dev))) 1538 if ((err=pci_enable_device(pci_dev)))
1539 return err; 1539 return err;
@@ -1700,7 +1700,7 @@ toshoboe_gotosleep (struct pci_dev *pci_dev, pm_message_t crap)
1700 unsigned long flags; 1700 unsigned long flags;
1701 int i = 10; 1701 int i = 10;
1702 1702
1703 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 1703 IRDA_DEBUG (4, "%s()\n", __func__);
1704 1704
1705 if (!self || self->stopped) 1705 if (!self || self->stopped)
1706 return 0; 1706 return 0;
@@ -1728,7 +1728,7 @@ toshoboe_wakeup (struct pci_dev *pci_dev)
1728 struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev); 1728 struct toshoboe_cb *self = (struct toshoboe_cb*)pci_get_drvdata(pci_dev);
1729 unsigned long flags; 1729 unsigned long flags;
1730 1730
1731 IRDA_DEBUG (4, "%s()\n", __FUNCTION__); 1731 IRDA_DEBUG (4, "%s()\n", __func__);
1732 1732
1733 if (!self || !self->stopped) 1733 if (!self || !self->stopped)
1734 return 0; 1734 return 0;
diff --git a/drivers/net/irda/girbil-sir.c b/drivers/net/irda/girbil-sir.c
index 738531b16bd3..a31b8fa8aaa9 100644
--- a/drivers/net/irda/girbil-sir.c
+++ b/drivers/net/irda/girbil-sir.c
@@ -86,7 +86,7 @@ static int girbil_open(struct sir_dev *dev)
86{ 86{
87 struct qos_info *qos = &dev->qos; 87 struct qos_info *qos = &dev->qos;
88 88
89 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 89 IRDA_DEBUG(2, "%s()\n", __func__);
90 90
91 /* Power on dongle */ 91 /* Power on dongle */
92 sirdev_set_dtr_rts(dev, TRUE, TRUE); 92 sirdev_set_dtr_rts(dev, TRUE, TRUE);
@@ -102,7 +102,7 @@ static int girbil_open(struct sir_dev *dev)
102 102
103static int girbil_close(struct sir_dev *dev) 103static int girbil_close(struct sir_dev *dev)
104{ 104{
105 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 105 IRDA_DEBUG(2, "%s()\n", __func__);
106 106
107 /* Power off dongle */ 107 /* Power off dongle */
108 sirdev_set_dtr_rts(dev, FALSE, FALSE); 108 sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -126,7 +126,7 @@ static int girbil_change_speed(struct sir_dev *dev, unsigned speed)
126 u8 control[2]; 126 u8 control[2];
127 static int ret = 0; 127 static int ret = 0;
128 128
129 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 129 IRDA_DEBUG(2, "%s()\n", __func__);
130 130
131 /* dongle alread reset - port and dongle at default speed */ 131 /* dongle alread reset - port and dongle at default speed */
132 132
@@ -179,7 +179,7 @@ static int girbil_change_speed(struct sir_dev *dev, unsigned speed)
179 break; 179 break;
180 180
181 default: 181 default:
182 IRDA_ERROR("%s - undefined state %d\n", __FUNCTION__, state); 182 IRDA_ERROR("%s - undefined state %d\n", __func__, state);
183 ret = -EINVAL; 183 ret = -EINVAL;
184 break; 184 break;
185 } 185 }
@@ -209,7 +209,7 @@ static int girbil_reset(struct sir_dev *dev)
209 u8 control = GIRBIL_TXEN | GIRBIL_RXEN; 209 u8 control = GIRBIL_TXEN | GIRBIL_RXEN;
210 int ret = 0; 210 int ret = 0;
211 211
212 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 212 IRDA_DEBUG(2, "%s()\n", __func__);
213 213
214 switch (state) { 214 switch (state) {
215 case SIRDEV_STATE_DONGLE_RESET: 215 case SIRDEV_STATE_DONGLE_RESET:
@@ -241,7 +241,7 @@ static int girbil_reset(struct sir_dev *dev)
241 break; 241 break;
242 242
243 default: 243 default:
244 IRDA_ERROR("%s(), undefined state %d\n", __FUNCTION__, state); 244 IRDA_ERROR("%s(), undefined state %d\n", __func__, state);
245 ret = -1; 245 ret = -1;
246 break; 246 break;
247 } 247 }
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 18b471cd1447..b5d6b9ac162a 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -177,12 +177,12 @@ static void irda_usb_build_header(struct irda_usb_cb *self,
177 (!force) && (self->speed != -1)) { 177 (!force) && (self->speed != -1)) {
178 /* No speed and xbofs change here 178 /* No speed and xbofs change here
179 * (we'll do it later in the write callback) */ 179 * (we'll do it later in the write callback) */
180 IRDA_DEBUG(2, "%s(), not changing speed yet\n", __FUNCTION__); 180 IRDA_DEBUG(2, "%s(), not changing speed yet\n", __func__);
181 *header = 0; 181 *header = 0;
182 return; 182 return;
183 } 183 }
184 184
185 IRDA_DEBUG(2, "%s(), changing speed to %d\n", __FUNCTION__, self->new_speed); 185 IRDA_DEBUG(2, "%s(), changing speed to %d\n", __func__, self->new_speed);
186 self->speed = self->new_speed; 186 self->speed = self->new_speed;
187 /* We will do ` self->new_speed = -1; ' in the completion 187 /* We will do ` self->new_speed = -1; ' in the completion
188 * handler just in case the current URB fail - Jean II */ 188 * handler just in case the current URB fail - Jean II */
@@ -228,7 +228,7 @@ static void irda_usb_build_header(struct irda_usb_cb *self,
228 228
229 /* Set the negotiated additional XBOFS */ 229 /* Set the negotiated additional XBOFS */
230 if (self->new_xbofs != -1) { 230 if (self->new_xbofs != -1) {
231 IRDA_DEBUG(2, "%s(), changing xbofs to %d\n", __FUNCTION__, self->new_xbofs); 231 IRDA_DEBUG(2, "%s(), changing xbofs to %d\n", __func__, self->new_xbofs);
232 self->xbofs = self->new_xbofs; 232 self->xbofs = self->new_xbofs;
233 /* We will do ` self->new_xbofs = -1; ' in the completion 233 /* We will do ` self->new_xbofs = -1; ' in the completion
234 * handler just in case the current URB fail - Jean II */ 234 * handler just in case the current URB fail - Jean II */
@@ -302,13 +302,13 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
302 struct urb *urb; 302 struct urb *urb;
303 int ret; 303 int ret;
304 304
305 IRDA_DEBUG(2, "%s(), speed=%d, xbofs=%d\n", __FUNCTION__, 305 IRDA_DEBUG(2, "%s(), speed=%d, xbofs=%d\n", __func__,
306 self->new_speed, self->new_xbofs); 306 self->new_speed, self->new_xbofs);
307 307
308 /* Grab the speed URB */ 308 /* Grab the speed URB */
309 urb = self->speed_urb; 309 urb = self->speed_urb;
310 if (urb->status != 0) { 310 if (urb->status != 0) {
311 IRDA_WARNING("%s(), URB still in use!\n", __FUNCTION__); 311 IRDA_WARNING("%s(), URB still in use!\n", __func__);
312 return; 312 return;
313 } 313 }
314 314
@@ -334,7 +334,7 @@ static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self)
334 334
335 /* Irq disabled -> GFP_ATOMIC */ 335 /* Irq disabled -> GFP_ATOMIC */
336 if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) { 336 if ((ret = usb_submit_urb(urb, GFP_ATOMIC))) {
337 IRDA_WARNING("%s(), failed Speed URB\n", __FUNCTION__); 337 IRDA_WARNING("%s(), failed Speed URB\n", __func__);
338 } 338 }
339} 339}
340 340
@@ -347,7 +347,7 @@ static void speed_bulk_callback(struct urb *urb)
347{ 347{
348 struct irda_usb_cb *self = urb->context; 348 struct irda_usb_cb *self = urb->context;
349 349
350 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 350 IRDA_DEBUG(2, "%s()\n", __func__);
351 351
352 /* We should always have a context */ 352 /* We should always have a context */
353 IRDA_ASSERT(self != NULL, return;); 353 IRDA_ASSERT(self != NULL, return;);
@@ -357,7 +357,7 @@ static void speed_bulk_callback(struct urb *urb)
357 /* Check for timeout and other USB nasties */ 357 /* Check for timeout and other USB nasties */
358 if (urb->status != 0) { 358 if (urb->status != 0) {
359 /* I get a lot of -ECONNABORTED = -103 here - Jean II */ 359 /* I get a lot of -ECONNABORTED = -103 here - Jean II */
360 IRDA_DEBUG(0, "%s(), URB complete status %d, transfer_flags 0x%04X\n", __FUNCTION__, urb->status, urb->transfer_flags); 360 IRDA_DEBUG(0, "%s(), URB complete status %d, transfer_flags 0x%04X\n", __func__, urb->status, urb->transfer_flags);
361 361
362 /* Don't do anything here, that might confuse the USB layer. 362 /* Don't do anything here, that might confuse the USB layer.
363 * Instead, we will wait for irda_usb_net_timeout(), the 363 * Instead, we will wait for irda_usb_net_timeout(), the
@@ -392,7 +392,7 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
392 int res, mtt; 392 int res, mtt;
393 int err = 1; /* Failed */ 393 int err = 1; /* Failed */
394 394
395 IRDA_DEBUG(4, "%s() on %s\n", __FUNCTION__, netdev->name); 395 IRDA_DEBUG(4, "%s() on %s\n", __func__, netdev->name);
396 396
397 netif_stop_queue(netdev); 397 netif_stop_queue(netdev);
398 398
@@ -403,7 +403,7 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
403 * We need to check self->present under the spinlock because 403 * We need to check self->present under the spinlock because
404 * of irda_usb_disconnect() is synchronous - Jean II */ 404 * of irda_usb_disconnect() is synchronous - Jean II */
405 if (!self->present) { 405 if (!self->present) {
406 IRDA_DEBUG(0, "%s(), Device is gone...\n", __FUNCTION__); 406 IRDA_DEBUG(0, "%s(), Device is gone...\n", __func__);
407 goto drop; 407 goto drop;
408 } 408 }
409 409
@@ -437,7 +437,7 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
437 } 437 }
438 438
439 if (urb->status != 0) { 439 if (urb->status != 0) {
440 IRDA_WARNING("%s(), URB still in use!\n", __FUNCTION__); 440 IRDA_WARNING("%s(), URB still in use!\n", __func__);
441 goto drop; 441 goto drop;
442 } 442 }
443 443
@@ -524,7 +524,7 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
524 524
525 /* Ask USB to send the packet - Irq disabled -> GFP_ATOMIC */ 525 /* Ask USB to send the packet - Irq disabled -> GFP_ATOMIC */
526 if ((res = usb_submit_urb(urb, GFP_ATOMIC))) { 526 if ((res = usb_submit_urb(urb, GFP_ATOMIC))) {
527 IRDA_WARNING("%s(), failed Tx URB\n", __FUNCTION__); 527 IRDA_WARNING("%s(), failed Tx URB\n", __func__);
528 self->stats.tx_errors++; 528 self->stats.tx_errors++;
529 /* Let USB recover : We will catch that in the watchdog */ 529 /* Let USB recover : We will catch that in the watchdog */
530 /*netif_start_queue(netdev);*/ 530 /*netif_start_queue(netdev);*/
@@ -556,7 +556,7 @@ static void write_bulk_callback(struct urb *urb)
556 struct sk_buff *skb = urb->context; 556 struct sk_buff *skb = urb->context;
557 struct irda_usb_cb *self = ((struct irda_skb_cb *) skb->cb)->context; 557 struct irda_usb_cb *self = ((struct irda_skb_cb *) skb->cb)->context;
558 558
559 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 559 IRDA_DEBUG(2, "%s()\n", __func__);
560 560
561 /* We should always have a context */ 561 /* We should always have a context */
562 IRDA_ASSERT(self != NULL, return;); 562 IRDA_ASSERT(self != NULL, return;);
@@ -570,7 +570,7 @@ static void write_bulk_callback(struct urb *urb)
570 /* Check for timeout and other USB nasties */ 570 /* Check for timeout and other USB nasties */
571 if (urb->status != 0) { 571 if (urb->status != 0) {
572 /* I get a lot of -ECONNABORTED = -103 here - Jean II */ 572 /* I get a lot of -ECONNABORTED = -103 here - Jean II */
573 IRDA_DEBUG(0, "%s(), URB complete status %d, transfer_flags 0x%04X\n", __FUNCTION__, urb->status, urb->transfer_flags); 573 IRDA_DEBUG(0, "%s(), URB complete status %d, transfer_flags 0x%04X\n", __func__, urb->status, urb->transfer_flags);
574 574
575 /* Don't do anything here, that might confuse the USB layer, 575 /* Don't do anything here, that might confuse the USB layer,
576 * and we could go in recursion and blow the kernel stack... 576 * and we could go in recursion and blow the kernel stack...
@@ -589,7 +589,7 @@ static void write_bulk_callback(struct urb *urb)
589 589
590 /* If the network is closed, stop everything */ 590 /* If the network is closed, stop everything */
591 if ((!self->netopen) || (!self->present)) { 591 if ((!self->netopen) || (!self->present)) {
592 IRDA_DEBUG(0, "%s(), Network is gone...\n", __FUNCTION__); 592 IRDA_DEBUG(0, "%s(), Network is gone...\n", __func__);
593 spin_unlock_irqrestore(&self->lock, flags); 593 spin_unlock_irqrestore(&self->lock, flags);
594 return; 594 return;
595 } 595 }
@@ -600,7 +600,7 @@ static void write_bulk_callback(struct urb *urb)
600 (self->new_xbofs != self->xbofs)) { 600 (self->new_xbofs != self->xbofs)) {
601 /* We haven't changed speed yet (because of 601 /* We haven't changed speed yet (because of
602 * IUC_SPEED_BUG), so do it now - Jean II */ 602 * IUC_SPEED_BUG), so do it now - Jean II */
603 IRDA_DEBUG(1, "%s(), Changing speed now...\n", __FUNCTION__); 603 IRDA_DEBUG(1, "%s(), Changing speed now...\n", __func__);
604 irda_usb_change_speed_xbofs(self); 604 irda_usb_change_speed_xbofs(self);
605 } else { 605 } else {
606 /* New speed and xbof is now commited in hardware */ 606 /* New speed and xbof is now commited in hardware */
@@ -632,7 +632,7 @@ static void irda_usb_net_timeout(struct net_device *netdev)
632 struct urb *urb; 632 struct urb *urb;
633 int done = 0; /* If we have made any progress */ 633 int done = 0; /* If we have made any progress */
634 634
635 IRDA_DEBUG(0, "%s(), Network layer thinks we timed out!\n", __FUNCTION__); 635 IRDA_DEBUG(0, "%s(), Network layer thinks we timed out!\n", __func__);
636 IRDA_ASSERT(self != NULL, return;); 636 IRDA_ASSERT(self != NULL, return;);
637 637
638 /* Protect us from USB callbacks, net Tx and else. */ 638 /* Protect us from USB callbacks, net Tx and else. */
@@ -640,7 +640,7 @@ static void irda_usb_net_timeout(struct net_device *netdev)
640 640
641 /* self->present *MUST* be read under spinlock */ 641 /* self->present *MUST* be read under spinlock */
642 if (!self->present) { 642 if (!self->present) {
643 IRDA_WARNING("%s(), device not present!\n", __FUNCTION__); 643 IRDA_WARNING("%s(), device not present!\n", __func__);
644 netif_stop_queue(netdev); 644 netif_stop_queue(netdev);
645 spin_unlock_irqrestore(&self->lock, flags); 645 spin_unlock_irqrestore(&self->lock, flags);
646 return; 646 return;
@@ -763,7 +763,7 @@ static void irda_usb_submit(struct irda_usb_cb *self, struct sk_buff *skb, struc
763 struct irda_skb_cb *cb; 763 struct irda_skb_cb *cb;
764 int ret; 764 int ret;
765 765
766 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 766 IRDA_DEBUG(2, "%s()\n", __func__);
767 767
768 /* This should never happen */ 768 /* This should never happen */
769 IRDA_ASSERT(skb != NULL, return;); 769 IRDA_ASSERT(skb != NULL, return;);
@@ -786,7 +786,7 @@ static void irda_usb_submit(struct irda_usb_cb *self, struct sk_buff *skb, struc
786 /* If this ever happen, we are in deep s***. 786 /* If this ever happen, we are in deep s***.
787 * Basically, the Rx path will stop... */ 787 * Basically, the Rx path will stop... */
788 IRDA_WARNING("%s(), Failed to submit Rx URB %d\n", 788 IRDA_WARNING("%s(), Failed to submit Rx URB %d\n",
789 __FUNCTION__, ret); 789 __func__, ret);
790 } 790 }
791} 791}
792 792
@@ -807,7 +807,7 @@ static void irda_usb_receive(struct urb *urb)
807 struct urb *next_urb; 807 struct urb *next_urb;
808 unsigned int len, docopy; 808 unsigned int len, docopy;
809 809
810 IRDA_DEBUG(2, "%s(), len=%d\n", __FUNCTION__, urb->actual_length); 810 IRDA_DEBUG(2, "%s(), len=%d\n", __func__, urb->actual_length);
811 811
812 /* Find ourselves */ 812 /* Find ourselves */
813 cb = (struct irda_skb_cb *) skb->cb; 813 cb = (struct irda_skb_cb *) skb->cb;
@@ -817,7 +817,7 @@ static void irda_usb_receive(struct urb *urb)
817 817
818 /* If the network is closed or the device gone, stop everything */ 818 /* If the network is closed or the device gone, stop everything */
819 if ((!self->netopen) || (!self->present)) { 819 if ((!self->netopen) || (!self->present)) {
820 IRDA_DEBUG(0, "%s(), Network is gone!\n", __FUNCTION__); 820 IRDA_DEBUG(0, "%s(), Network is gone!\n", __func__);
821 /* Don't re-submit the URB : will stall the Rx path */ 821 /* Don't re-submit the URB : will stall the Rx path */
822 return; 822 return;
823 } 823 }
@@ -840,7 +840,7 @@ static void irda_usb_receive(struct urb *urb)
840 /* Usually precursor to a hot-unplug on OHCI. */ 840 /* Usually precursor to a hot-unplug on OHCI. */
841 default: 841 default:
842 self->stats.rx_errors++; 842 self->stats.rx_errors++;
843 IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X \n", __FUNCTION__, urb->status, urb->transfer_flags); 843 IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X \n", __func__, urb->status, urb->transfer_flags);
844 break; 844 break;
845 } 845 }
846 /* If we received an error, we don't want to resubmit the 846 /* If we received an error, we don't want to resubmit the
@@ -861,7 +861,7 @@ static void irda_usb_receive(struct urb *urb)
861 861
862 /* Check for empty frames */ 862 /* Check for empty frames */
863 if (urb->actual_length <= self->header_length) { 863 if (urb->actual_length <= self->header_length) {
864 IRDA_WARNING("%s(), empty frame!\n", __FUNCTION__); 864 IRDA_WARNING("%s(), empty frame!\n", __func__);
865 goto done; 865 goto done;
866 } 866 }
867 867
@@ -967,7 +967,7 @@ static void irda_usb_rx_defer_expired(unsigned long data)
967 struct irda_skb_cb *cb; 967 struct irda_skb_cb *cb;
968 struct urb *next_urb; 968 struct urb *next_urb;
969 969
970 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 970 IRDA_DEBUG(2, "%s()\n", __func__);
971 971
972 /* Find ourselves */ 972 /* Find ourselves */
973 cb = (struct irda_skb_cb *) skb->cb; 973 cb = (struct irda_skb_cb *) skb->cb;
@@ -1053,7 +1053,7 @@ static int stir421x_fw_upload(struct irda_usb_cb *self,
1053 patch_block, block_size, 1053 patch_block, block_size,
1054 &actual_len, msecs_to_jiffies(500)); 1054 &actual_len, msecs_to_jiffies(500));
1055 IRDA_DEBUG(3,"%s(): Bulk send %u bytes, ret=%d\n", 1055 IRDA_DEBUG(3,"%s(): Bulk send %u bytes, ret=%d\n",
1056 __FUNCTION__, actual_len, ret); 1056 __func__, actual_len, ret);
1057 1057
1058 if (ret < 0) 1058 if (ret < 0)
1059 break; 1059 break;
@@ -1092,7 +1092,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
1092 1092
1093 /* We get a patch from userspace */ 1093 /* We get a patch from userspace */
1094 IRDA_MESSAGE("%s(): Received firmware %s (%zu bytes)\n", 1094 IRDA_MESSAGE("%s(): Received firmware %s (%zu bytes)\n",
1095 __FUNCTION__, stir421x_fw_name, fw->size); 1095 __func__, stir421x_fw_name, fw->size);
1096 1096
1097 ret = -EINVAL; 1097 ret = -EINVAL;
1098 1098
@@ -1116,7 +1116,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
1116 + (build % 10); 1116 + (build % 10);
1117 1117
1118 IRDA_DEBUG(3, "%s(): Firmware Product version %ld\n", 1118 IRDA_DEBUG(3, "%s(): Firmware Product version %ld\n",
1119 __FUNCTION__, fw_version); 1119 __func__, fw_version);
1120 } 1120 }
1121 } 1121 }
1122 1122
@@ -1172,7 +1172,7 @@ static int irda_usb_net_open(struct net_device *netdev)
1172 char hwname[16]; 1172 char hwname[16];
1173 int i; 1173 int i;
1174 1174
1175 IRDA_DEBUG(1, "%s()\n", __FUNCTION__); 1175 IRDA_DEBUG(1, "%s()\n", __func__);
1176 1176
1177 IRDA_ASSERT(netdev != NULL, return -1;); 1177 IRDA_ASSERT(netdev != NULL, return -1;);
1178 self = (struct irda_usb_cb *) netdev->priv; 1178 self = (struct irda_usb_cb *) netdev->priv;
@@ -1182,13 +1182,13 @@ static int irda_usb_net_open(struct net_device *netdev)
1182 /* Can only open the device if it's there */ 1182 /* Can only open the device if it's there */
1183 if(!self->present) { 1183 if(!self->present) {
1184 spin_unlock_irqrestore(&self->lock, flags); 1184 spin_unlock_irqrestore(&self->lock, flags);
1185 IRDA_WARNING("%s(), device not present!\n", __FUNCTION__); 1185 IRDA_WARNING("%s(), device not present!\n", __func__);
1186 return -1; 1186 return -1;
1187 } 1187 }
1188 1188
1189 if(self->needspatch) { 1189 if(self->needspatch) {
1190 spin_unlock_irqrestore(&self->lock, flags); 1190 spin_unlock_irqrestore(&self->lock, flags);
1191 IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ; 1191 IRDA_WARNING("%s(), device needs patch\n", __func__) ;
1192 return -EIO ; 1192 return -EIO ;
1193 } 1193 }
1194 1194
@@ -1231,7 +1231,7 @@ static int irda_usb_net_open(struct net_device *netdev)
1231 /* If this ever happen, we are in deep s***. 1231 /* If this ever happen, we are in deep s***.
1232 * Basically, we can't start the Rx path... */ 1232 * Basically, we can't start the Rx path... */
1233 IRDA_WARNING("%s(), Failed to allocate Rx skb\n", 1233 IRDA_WARNING("%s(), Failed to allocate Rx skb\n",
1234 __FUNCTION__); 1234 __func__);
1235 return -1; 1235 return -1;
1236 } 1236 }
1237 //skb_reserve(newskb, USB_IRDA_HEADER - 1); 1237 //skb_reserve(newskb, USB_IRDA_HEADER - 1);
@@ -1254,7 +1254,7 @@ static int irda_usb_net_close(struct net_device *netdev)
1254 struct irda_usb_cb *self; 1254 struct irda_usb_cb *self;
1255 int i; 1255 int i;
1256 1256
1257 IRDA_DEBUG(1, "%s()\n", __FUNCTION__); 1257 IRDA_DEBUG(1, "%s()\n", __func__);
1258 1258
1259 IRDA_ASSERT(netdev != NULL, return -1;); 1259 IRDA_ASSERT(netdev != NULL, return -1;);
1260 self = (struct irda_usb_cb *) netdev->priv; 1260 self = (struct irda_usb_cb *) netdev->priv;
@@ -1309,7 +1309,7 @@ static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1309 self = dev->priv; 1309 self = dev->priv;
1310 IRDA_ASSERT(self != NULL, return -1;); 1310 IRDA_ASSERT(self != NULL, return -1;);
1311 1311
1312 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd); 1312 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
1313 1313
1314 switch (cmd) { 1314 switch (cmd) {
1315 case SIOCSBANDWIDTH: /* Set bandwidth */ 1315 case SIOCSBANDWIDTH: /* Set bandwidth */
@@ -1367,7 +1367,7 @@ static inline void irda_usb_init_qos(struct irda_usb_cb *self)
1367{ 1367{
1368 struct irda_class_desc *desc; 1368 struct irda_class_desc *desc;
1369 1369
1370 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 1370 IRDA_DEBUG(3, "%s()\n", __func__);
1371 1371
1372 desc = self->irda_desc; 1372 desc = self->irda_desc;
1373 1373
@@ -1384,7 +1384,7 @@ static inline void irda_usb_init_qos(struct irda_usb_cb *self)
1384 self->qos.data_size.bits = desc->bmDataSize; 1384 self->qos.data_size.bits = desc->bmDataSize;
1385 1385
1386 IRDA_DEBUG(0, "%s(), dongle says speed=0x%X, size=0x%X, window=0x%X, bofs=0x%X, turn=0x%X\n", 1386 IRDA_DEBUG(0, "%s(), dongle says speed=0x%X, size=0x%X, window=0x%X, bofs=0x%X, turn=0x%X\n",
1387 __FUNCTION__, self->qos.baud_rate.bits, self->qos.data_size.bits, self->qos.window_size.bits, self->qos.additional_bofs.bits, self->qos.min_turn_time.bits); 1387 __func__, self->qos.baud_rate.bits, self->qos.data_size.bits, self->qos.window_size.bits, self->qos.additional_bofs.bits, self->qos.min_turn_time.bits);
1388 1388
1389 /* Don't always trust what the dongle tell us */ 1389 /* Don't always trust what the dongle tell us */
1390 if(self->capability & IUC_SIR_ONLY) 1390 if(self->capability & IUC_SIR_ONLY)
@@ -1419,7 +1419,7 @@ static inline int irda_usb_open(struct irda_usb_cb *self)
1419{ 1419{
1420 struct net_device *netdev = self->netdev; 1420 struct net_device *netdev = self->netdev;
1421 1421
1422 IRDA_DEBUG(1, "%s()\n", __FUNCTION__); 1422 IRDA_DEBUG(1, "%s()\n", __func__);
1423 1423
1424 irda_usb_init_qos(self); 1424 irda_usb_init_qos(self);
1425 1425
@@ -1442,7 +1442,7 @@ static inline int irda_usb_open(struct irda_usb_cb *self)
1442 */ 1442 */
1443static inline void irda_usb_close(struct irda_usb_cb *self) 1443static inline void irda_usb_close(struct irda_usb_cb *self)
1444{ 1444{
1445 IRDA_DEBUG(1, "%s()\n", __FUNCTION__); 1445 IRDA_DEBUG(1, "%s()\n", __func__);
1446 1446
1447 /* Remove netdevice */ 1447 /* Remove netdevice */
1448 unregister_netdev(self->netdev); 1448 unregister_netdev(self->netdev);
@@ -1515,13 +1515,13 @@ static inline int irda_usb_parse_endpoints(struct irda_usb_cb *self, struct usb_
1515 /* This is our interrupt endpoint */ 1515 /* This is our interrupt endpoint */
1516 self->bulk_int_ep = ep; 1516 self->bulk_int_ep = ep;
1517 } else { 1517 } else {
1518 IRDA_ERROR("%s(), Unrecognised endpoint %02X.\n", __FUNCTION__, ep); 1518 IRDA_ERROR("%s(), Unrecognised endpoint %02X.\n", __func__, ep);
1519 } 1519 }
1520 } 1520 }
1521 } 1521 }
1522 1522
1523 IRDA_DEBUG(0, "%s(), And our endpoints are : in=%02X, out=%02X (%d), int=%02X\n", 1523 IRDA_DEBUG(0, "%s(), And our endpoints are : in=%02X, out=%02X (%d), int=%02X\n",
1524 __FUNCTION__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep); 1524 __func__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep);
1525 1525
1526 return((self->bulk_in_ep != 0) && (self->bulk_out_ep != 0)); 1526 return((self->bulk_in_ep != 0) && (self->bulk_out_ep != 0));
1527} 1527}
@@ -1583,7 +1583,7 @@ static inline struct irda_class_desc *irda_usb_find_class_desc(struct usb_interf
1583 0, intf->altsetting->desc.bInterfaceNumber, desc, 1583 0, intf->altsetting->desc.bInterfaceNumber, desc,
1584 sizeof(*desc), 500); 1584 sizeof(*desc), 500);
1585 1585
1586 IRDA_DEBUG(1, "%s(), ret=%d\n", __FUNCTION__, ret); 1586 IRDA_DEBUG(1, "%s(), ret=%d\n", __func__, ret);
1587 if (ret < sizeof(*desc)) { 1587 if (ret < sizeof(*desc)) {
1588 IRDA_WARNING("usb-irda: class_descriptor read %s (%d)\n", 1588 IRDA_WARNING("usb-irda: class_descriptor read %s (%d)\n",
1589 (ret<0) ? "failed" : "too short", ret); 1589 (ret<0) ? "failed" : "too short", ret);
@@ -1696,10 +1696,10 @@ static int irda_usb_probe(struct usb_interface *intf,
1696 /* Martin Diehl says if we get a -EPIPE we should 1696 /* Martin Diehl says if we get a -EPIPE we should
1697 * be fine and we don't need to do a usb_clear_halt(). 1697 * be fine and we don't need to do a usb_clear_halt().
1698 * - Jean II */ 1698 * - Jean II */
1699 IRDA_DEBUG(0, "%s(), Received -EPIPE, ignoring...\n", __FUNCTION__); 1699 IRDA_DEBUG(0, "%s(), Received -EPIPE, ignoring...\n", __func__);
1700 break; 1700 break;
1701 default: 1701 default:
1702 IRDA_DEBUG(0, "%s(), Unknown error %d\n", __FUNCTION__, ret); 1702 IRDA_DEBUG(0, "%s(), Unknown error %d\n", __func__, ret);
1703 ret = -EIO; 1703 ret = -EIO;
1704 goto err_out_3; 1704 goto err_out_3;
1705 } 1705 }
@@ -1708,7 +1708,7 @@ static int irda_usb_probe(struct usb_interface *intf,
1708 interface = intf->cur_altsetting; 1708 interface = intf->cur_altsetting;
1709 if(!irda_usb_parse_endpoints(self, interface->endpoint, 1709 if(!irda_usb_parse_endpoints(self, interface->endpoint,
1710 interface->desc.bNumEndpoints)) { 1710 interface->desc.bNumEndpoints)) {
1711 IRDA_ERROR("%s(), Bogus endpoints...\n", __FUNCTION__); 1711 IRDA_ERROR("%s(), Bogus endpoints...\n", __func__);
1712 ret = -EIO; 1712 ret = -EIO;
1713 goto err_out_3; 1713 goto err_out_3;
1714 } 1714 }
@@ -1815,7 +1815,7 @@ static void irda_usb_disconnect(struct usb_interface *intf)
1815 struct irda_usb_cb *self = usb_get_intfdata(intf); 1815 struct irda_usb_cb *self = usb_get_intfdata(intf);
1816 int i; 1816 int i;
1817 1817
1818 IRDA_DEBUG(1, "%s()\n", __FUNCTION__); 1818 IRDA_DEBUG(1, "%s()\n", __func__);
1819 1819
1820 usb_set_intfdata(intf, NULL); 1820 usb_set_intfdata(intf, NULL);
1821 if (!self) 1821 if (!self)
@@ -1865,7 +1865,7 @@ static void irda_usb_disconnect(struct usb_interface *intf)
1865 1865
1866 /* Free self and network device */ 1866 /* Free self and network device */
1867 free_netdev(self->netdev); 1867 free_netdev(self->netdev);
1868 IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __FUNCTION__); 1868 IRDA_DEBUG(0, "%s(), USB IrDA Disconnected\n", __func__);
1869} 1869}
1870 1870
1871/*------------------------------------------------------------------*/ 1871/*------------------------------------------------------------------*/
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index 9e33196f9459..6bcee01c684c 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -231,7 +231,7 @@ static void irtty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
231 231
232 dev = priv->dev; 232 dev = priv->dev;
233 if (!dev) { 233 if (!dev) {
234 IRDA_WARNING("%s(), not ready yet!\n", __FUNCTION__); 234 IRDA_WARNING("%s(), not ready yet!\n", __func__);
235 return; 235 return;
236 } 236 }
237 237
@@ -388,7 +388,7 @@ static int irtty_ioctl(struct tty_struct *tty, struct file *file, unsigned int c
388 IRDA_ASSERT(priv != NULL, return -ENODEV;); 388 IRDA_ASSERT(priv != NULL, return -ENODEV;);
389 IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return -EBADR;); 389 IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return -EBADR;);
390 390
391 IRDA_DEBUG(3, "%s(cmd=0x%X)\n", __FUNCTION__, cmd); 391 IRDA_DEBUG(3, "%s(cmd=0x%X)\n", __func__, cmd);
392 392
393 dev = priv->dev; 393 dev = priv->dev;
394 IRDA_ASSERT(dev != NULL, return -1;); 394 IRDA_ASSERT(dev != NULL, return -1;);
@@ -476,7 +476,7 @@ static int irtty_open(struct tty_struct *tty)
476 476
477 mutex_unlock(&irtty_mutex); 477 mutex_unlock(&irtty_mutex);
478 478
479 IRDA_DEBUG(0, "%s - %s: irda line discipline opened\n", __FUNCTION__, tty->name); 479 IRDA_DEBUG(0, "%s - %s: irda line discipline opened\n", __func__, tty->name);
480 480
481 return 0; 481 return 0;
482 482
@@ -528,7 +528,7 @@ static void irtty_close(struct tty_struct *tty)
528 528
529 kfree(priv); 529 kfree(priv);
530 530
531 IRDA_DEBUG(0, "%s - %s: irda line discipline closed\n", __FUNCTION__, tty->name); 531 IRDA_DEBUG(0, "%s - %s: irda line discipline closed\n", __func__, tty->name);
532} 532}
533 533
534/* ------------------------------------------------------- */ 534/* ------------------------------------------------------- */
@@ -566,7 +566,7 @@ static void __exit irtty_sir_cleanup(void)
566 566
567 if ((err = tty_unregister_ldisc(N_IRDA))) { 567 if ((err = tty_unregister_ldisc(N_IRDA))) {
568 IRDA_ERROR("%s(), can't unregister line discipline (err = %d)\n", 568 IRDA_ERROR("%s(), can't unregister line discipline (err = %d)\n",
569 __FUNCTION__, err); 569 __func__, err);
570 } 570 }
571} 571}
572 572
diff --git a/drivers/net/irda/kingsun-sir.c b/drivers/net/irda/kingsun-sir.c
index 648e54b3f00e..73fe83be34fe 100644
--- a/drivers/net/irda/kingsun-sir.c
+++ b/drivers/net/irda/kingsun-sir.c
@@ -243,7 +243,7 @@ static void kingsun_rcv_irq(struct urb *urb)
243 } 243 }
244 } else if (urb->actual_length > 0) { 244 } else if (urb->actual_length > 0) {
245 err("%s(): Unexpected response length, expected %d got %d", 245 err("%s(): Unexpected response length, expected %d got %d",
246 __FUNCTION__, kingsun->max_rx, urb->actual_length); 246 __func__, kingsun->max_rx, urb->actual_length);
247 } 247 }
248 /* This urb has already been filled in kingsun_net_open */ 248 /* This urb has already been filled in kingsun_net_open */
249 ret = usb_submit_urb(urb, GFP_ATOMIC); 249 ret = usb_submit_urb(urb, GFP_ATOMIC);
diff --git a/drivers/net/irda/litelink-sir.c b/drivers/net/irda/litelink-sir.c
index 73261c54bbfd..d6d9d2e5ad49 100644
--- a/drivers/net/irda/litelink-sir.c
+++ b/drivers/net/irda/litelink-sir.c
@@ -78,7 +78,7 @@ static int litelink_open(struct sir_dev *dev)
78{ 78{
79 struct qos_info *qos = &dev->qos; 79 struct qos_info *qos = &dev->qos;
80 80
81 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 81 IRDA_DEBUG(2, "%s()\n", __func__);
82 82
83 /* Power up dongle */ 83 /* Power up dongle */
84 sirdev_set_dtr_rts(dev, TRUE, TRUE); 84 sirdev_set_dtr_rts(dev, TRUE, TRUE);
@@ -95,7 +95,7 @@ static int litelink_open(struct sir_dev *dev)
95 95
96static int litelink_close(struct sir_dev *dev) 96static int litelink_close(struct sir_dev *dev)
97{ 97{
98 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 98 IRDA_DEBUG(2, "%s()\n", __func__);
99 99
100 /* Power off dongle */ 100 /* Power off dongle */
101 sirdev_set_dtr_rts(dev, FALSE, FALSE); 101 sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -113,7 +113,7 @@ static int litelink_change_speed(struct sir_dev *dev, unsigned speed)
113{ 113{
114 int i; 114 int i;
115 115
116 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 116 IRDA_DEBUG(2, "%s()\n", __func__);
117 117
118 /* dongle already reset by irda-thread - current speed (dongle and 118 /* dongle already reset by irda-thread - current speed (dongle and
119 * port) is the default speed (115200 for litelink!) 119 * port) is the default speed (115200 for litelink!)
@@ -156,7 +156,7 @@ static int litelink_change_speed(struct sir_dev *dev, unsigned speed)
156 */ 156 */
157static int litelink_reset(struct sir_dev *dev) 157static int litelink_reset(struct sir_dev *dev)
158{ 158{
159 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 159 IRDA_DEBUG(2, "%s()\n", __func__);
160 160
161 /* probably the power-up can be dropped here, but with only 161 /* probably the power-up can be dropped here, but with only
162 * 15 usec delay it's not worth the risk unless somebody with 162 * 15 usec delay it's not worth the risk unless somebody with
diff --git a/drivers/net/irda/ma600-sir.c b/drivers/net/irda/ma600-sir.c
index 809906d94762..1ceed9cfb7c4 100644
--- a/drivers/net/irda/ma600-sir.c
+++ b/drivers/net/irda/ma600-sir.c
@@ -67,13 +67,13 @@ static struct dongle_driver ma600 = {
67 67
68static int __init ma600_sir_init(void) 68static int __init ma600_sir_init(void)
69{ 69{
70 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 70 IRDA_DEBUG(2, "%s()\n", __func__);
71 return irda_register_dongle(&ma600); 71 return irda_register_dongle(&ma600);
72} 72}
73 73
74static void __exit ma600_sir_cleanup(void) 74static void __exit ma600_sir_cleanup(void)
75{ 75{
76 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 76 IRDA_DEBUG(2, "%s()\n", __func__);
77 irda_unregister_dongle(&ma600); 77 irda_unregister_dongle(&ma600);
78} 78}
79 79
@@ -88,7 +88,7 @@ static int ma600_open(struct sir_dev *dev)
88{ 88{
89 struct qos_info *qos = &dev->qos; 89 struct qos_info *qos = &dev->qos;
90 90
91 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 91 IRDA_DEBUG(2, "%s()\n", __func__);
92 92
93 sirdev_set_dtr_rts(dev, TRUE, TRUE); 93 sirdev_set_dtr_rts(dev, TRUE, TRUE);
94 94
@@ -106,7 +106,7 @@ static int ma600_open(struct sir_dev *dev)
106 106
107static int ma600_close(struct sir_dev *dev) 107static int ma600_close(struct sir_dev *dev)
108{ 108{
109 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 109 IRDA_DEBUG(2, "%s()\n", __func__);
110 110
111 /* Power off dongle */ 111 /* Power off dongle */
112 sirdev_set_dtr_rts(dev, FALSE, FALSE); 112 sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -176,7 +176,7 @@ static int ma600_change_speed(struct sir_dev *dev, unsigned speed)
176{ 176{
177 u8 byte; 177 u8 byte;
178 178
179 IRDA_DEBUG(2, "%s(), speed=%d (was %d)\n", __FUNCTION__, 179 IRDA_DEBUG(2, "%s(), speed=%d (was %d)\n", __func__,
180 speed, dev->speed); 180 speed, dev->speed);
181 181
182 /* dongle already reset, dongle and port at default speed (9600) */ 182 /* dongle already reset, dongle and port at default speed (9600) */
@@ -201,12 +201,12 @@ static int ma600_change_speed(struct sir_dev *dev, unsigned speed)
201 sirdev_raw_read(dev, &byte, sizeof(byte)); 201 sirdev_raw_read(dev, &byte, sizeof(byte));
202 if (byte != get_control_byte(speed)) { 202 if (byte != get_control_byte(speed)) {
203 IRDA_WARNING("%s(): bad control byte read-back %02x != %02x\n", 203 IRDA_WARNING("%s(): bad control byte read-back %02x != %02x\n",
204 __FUNCTION__, (unsigned) byte, 204 __func__, (unsigned) byte,
205 (unsigned) get_control_byte(speed)); 205 (unsigned) get_control_byte(speed));
206 return -1; 206 return -1;
207 } 207 }
208 else 208 else
209 IRDA_DEBUG(2, "%s() control byte write read OK\n", __FUNCTION__); 209 IRDA_DEBUG(2, "%s() control byte write read OK\n", __func__);
210#endif 210#endif
211 211
212 /* Set DTR, Set RTS */ 212 /* Set DTR, Set RTS */
@@ -238,7 +238,7 @@ static int ma600_change_speed(struct sir_dev *dev, unsigned speed)
238 238
239int ma600_reset(struct sir_dev *dev) 239int ma600_reset(struct sir_dev *dev)
240{ 240{
241 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 241 IRDA_DEBUG(2, "%s()\n", __func__);
242 242
243 /* Reset the dongle : set DTR low for 10 ms */ 243 /* Reset the dongle : set DTR low for 10 ms */
244 sirdev_set_dtr_rts(dev, FALSE, TRUE); 244 sirdev_set_dtr_rts(dev, FALSE, TRUE);
diff --git a/drivers/net/irda/mcp2120-sir.c b/drivers/net/irda/mcp2120-sir.c
index 67bd016e4df8..5e2f4859cee7 100644
--- a/drivers/net/irda/mcp2120-sir.c
+++ b/drivers/net/irda/mcp2120-sir.c
@@ -63,7 +63,7 @@ static int mcp2120_open(struct sir_dev *dev)
63{ 63{
64 struct qos_info *qos = &dev->qos; 64 struct qos_info *qos = &dev->qos;
65 65
66 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 66 IRDA_DEBUG(2, "%s()\n", __func__);
67 67
68 /* seems no explicit power-on required here and reset switching it on anyway */ 68 /* seems no explicit power-on required here and reset switching it on anyway */
69 69
@@ -76,7 +76,7 @@ static int mcp2120_open(struct sir_dev *dev)
76 76
77static int mcp2120_close(struct sir_dev *dev) 77static int mcp2120_close(struct sir_dev *dev)
78{ 78{
79 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 79 IRDA_DEBUG(2, "%s()\n", __func__);
80 80
81 /* Power off dongle */ 81 /* Power off dongle */
82 /* reset and inhibit mcp2120 */ 82 /* reset and inhibit mcp2120 */
@@ -102,7 +102,7 @@ static int mcp2120_change_speed(struct sir_dev *dev, unsigned speed)
102 u8 control[2]; 102 u8 control[2];
103 static int ret = 0; 103 static int ret = 0;
104 104
105 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 105 IRDA_DEBUG(2, "%s()\n", __func__);
106 106
107 switch (state) { 107 switch (state) {
108 case SIRDEV_STATE_DONGLE_SPEED: 108 case SIRDEV_STATE_DONGLE_SPEED:
@@ -155,7 +155,7 @@ static int mcp2120_change_speed(struct sir_dev *dev, unsigned speed)
155 break; 155 break;
156 156
157 default: 157 default:
158 IRDA_ERROR("%s(), undefine state %d\n", __FUNCTION__, state); 158 IRDA_ERROR("%s(), undefine state %d\n", __func__, state);
159 ret = -EINVAL; 159 ret = -EINVAL;
160 break; 160 break;
161 } 161 }
@@ -187,7 +187,7 @@ static int mcp2120_reset(struct sir_dev *dev)
187 unsigned delay = 0; 187 unsigned delay = 0;
188 int ret = 0; 188 int ret = 0;
189 189
190 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 190 IRDA_DEBUG(2, "%s()\n", __func__);
191 191
192 switch (state) { 192 switch (state) {
193 case SIRDEV_STATE_DONGLE_RESET: 193 case SIRDEV_STATE_DONGLE_RESET:
@@ -213,7 +213,7 @@ static int mcp2120_reset(struct sir_dev *dev)
213 break; 213 break;
214 214
215 default: 215 default:
216 IRDA_ERROR("%s(), undefined state %d\n", __FUNCTION__, state); 216 IRDA_ERROR("%s(), undefined state %d\n", __func__, state);
217 ret = -EINVAL; 217 ret = -EINVAL;
218 break; 218 break;
219 } 219 }
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index effc1ce8179a..8583d951a6ad 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -151,8 +151,8 @@ static char *dongle_types[] = {
151static chipio_t pnp_info; 151static chipio_t pnp_info;
152static const struct pnp_device_id nsc_ircc_pnp_table[] = { 152static const struct pnp_device_id nsc_ircc_pnp_table[] = {
153 { .id = "NSC6001", .driver_data = 0 }, 153 { .id = "NSC6001", .driver_data = 0 },
154 { .id = "IBM0071", .driver_data = 0 },
155 { .id = "HWPC224", .driver_data = 0 }, 154 { .id = "HWPC224", .driver_data = 0 },
155 { .id = "IBM0071", .driver_data = NSC_FORCE_DONGLE_TYPE9 },
156 { } 156 { }
157}; 157};
158 158
@@ -223,7 +223,7 @@ static int __init nsc_ircc_init(void)
223 223
224 /* Probe for all the NSC chipsets we know about */ 224 /* Probe for all the NSC chipsets we know about */
225 for (chip = chips; chip->name ; chip++) { 225 for (chip = chips; chip->name ; chip++) {
226 IRDA_DEBUG(2, "%s(), Probing for %s ...\n", __FUNCTION__, 226 IRDA_DEBUG(2, "%s(), Probing for %s ...\n", __func__,
227 chip->name); 227 chip->name);
228 228
229 /* Try all config registers for this chip */ 229 /* Try all config registers for this chip */
@@ -235,7 +235,7 @@ static int __init nsc_ircc_init(void)
235 /* Read index register */ 235 /* Read index register */
236 reg = inb(cfg_base); 236 reg = inb(cfg_base);
237 if (reg == 0xff) { 237 if (reg == 0xff) {
238 IRDA_DEBUG(2, "%s() no chip at 0x%03x\n", __FUNCTION__, cfg_base); 238 IRDA_DEBUG(2, "%s() no chip at 0x%03x\n", __func__, cfg_base);
239 continue; 239 continue;
240 } 240 }
241 241
@@ -244,7 +244,7 @@ static int __init nsc_ircc_init(void)
244 id = inb(cfg_base+1); 244 id = inb(cfg_base+1);
245 if ((id & chip->cid_mask) == chip->cid_value) { 245 if ((id & chip->cid_mask) == chip->cid_value) {
246 IRDA_DEBUG(2, "%s() Found %s chip, revision=%d\n", 246 IRDA_DEBUG(2, "%s() Found %s chip, revision=%d\n",
247 __FUNCTION__, chip->name, id & ~chip->cid_mask); 247 __func__, chip->name, id & ~chip->cid_mask);
248 248
249 /* 249 /*
250 * If we found a correct PnP setting, 250 * If we found a correct PnP setting,
@@ -295,7 +295,7 @@ static int __init nsc_ircc_init(void)
295 } 295 }
296 i++; 296 i++;
297 } else { 297 } else {
298 IRDA_DEBUG(2, "%s(), Wrong chip id=0x%02x\n", __FUNCTION__, id); 298 IRDA_DEBUG(2, "%s(), Wrong chip id=0x%02x\n", __func__, id);
299 } 299 }
300 } 300 }
301 } 301 }
@@ -345,7 +345,7 @@ static int __init nsc_ircc_open(chipio_t *info)
345 void *ret; 345 void *ret;
346 int err, chip_index; 346 int err, chip_index;
347 347
348 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 348 IRDA_DEBUG(2, "%s()\n", __func__);
349 349
350 350
351 for (chip_index = 0; chip_index < ARRAY_SIZE(dev_self); chip_index++) { 351 for (chip_index = 0; chip_index < ARRAY_SIZE(dev_self); chip_index++) {
@@ -354,7 +354,7 @@ static int __init nsc_ircc_open(chipio_t *info)
354 } 354 }
355 355
356 if (chip_index == ARRAY_SIZE(dev_self)) { 356 if (chip_index == ARRAY_SIZE(dev_self)) {
357 IRDA_ERROR("%s(), maximum number of supported chips reached!\n", __FUNCTION__); 357 IRDA_ERROR("%s(), maximum number of supported chips reached!\n", __func__);
358 return -ENOMEM; 358 return -ENOMEM;
359 } 359 }
360 360
@@ -369,7 +369,7 @@ static int __init nsc_ircc_open(chipio_t *info)
369 dev = alloc_irdadev(sizeof(struct nsc_ircc_cb)); 369 dev = alloc_irdadev(sizeof(struct nsc_ircc_cb));
370 if (dev == NULL) { 370 if (dev == NULL) {
371 IRDA_ERROR("%s(), can't allocate memory for " 371 IRDA_ERROR("%s(), can't allocate memory for "
372 "control block!\n", __FUNCTION__); 372 "control block!\n", __func__);
373 return -ENOMEM; 373 return -ENOMEM;
374 } 374 }
375 375
@@ -393,7 +393,7 @@ static int __init nsc_ircc_open(chipio_t *info)
393 ret = request_region(self->io.fir_base, self->io.fir_ext, driver_name); 393 ret = request_region(self->io.fir_base, self->io.fir_ext, driver_name);
394 if (!ret) { 394 if (!ret) {
395 IRDA_WARNING("%s(), can't get iobase of 0x%03x\n", 395 IRDA_WARNING("%s(), can't get iobase of 0x%03x\n",
396 __FUNCTION__, self->io.fir_base); 396 __func__, self->io.fir_base);
397 err = -ENODEV; 397 err = -ENODEV;
398 goto out1; 398 goto out1;
399 } 399 }
@@ -450,7 +450,7 @@ static int __init nsc_ircc_open(chipio_t *info)
450 450
451 err = register_netdev(dev); 451 err = register_netdev(dev);
452 if (err) { 452 if (err) {
453 IRDA_ERROR("%s(), register_netdev() failed!\n", __FUNCTION__); 453 IRDA_ERROR("%s(), register_netdev() failed!\n", __func__);
454 goto out4; 454 goto out4;
455 } 455 }
456 IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); 456 IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name);
@@ -506,7 +506,7 @@ static int __exit nsc_ircc_close(struct nsc_ircc_cb *self)
506{ 506{
507 int iobase; 507 int iobase;
508 508
509 IRDA_DEBUG(4, "%s()\n", __FUNCTION__); 509 IRDA_DEBUG(4, "%s()\n", __func__);
510 510
511 IRDA_ASSERT(self != NULL, return -1;); 511 IRDA_ASSERT(self != NULL, return -1;);
512 512
@@ -519,7 +519,7 @@ static int __exit nsc_ircc_close(struct nsc_ircc_cb *self)
519 519
520 /* Release the PORT that this driver is using */ 520 /* Release the PORT that this driver is using */
521 IRDA_DEBUG(4, "%s(), Releasing Region %03x\n", 521 IRDA_DEBUG(4, "%s(), Releasing Region %03x\n",
522 __FUNCTION__, self->io.fir_base); 522 __func__, self->io.fir_base);
523 release_region(self->io.fir_base, self->io.fir_ext); 523 release_region(self->io.fir_base, self->io.fir_ext);
524 524
525 if (self->tx_buff.head) 525 if (self->tx_buff.head)
@@ -557,7 +557,7 @@ static int nsc_ircc_init_108(nsc_chip_t *chip, chipio_t *info)
557 case 0x2e8: outb(0x15, cfg_base+1); break; 557 case 0x2e8: outb(0x15, cfg_base+1); break;
558 case 0x3f8: outb(0x16, cfg_base+1); break; 558 case 0x3f8: outb(0x16, cfg_base+1); break;
559 case 0x2f8: outb(0x17, cfg_base+1); break; 559 case 0x2f8: outb(0x17, cfg_base+1); break;
560 default: IRDA_ERROR("%s(), invalid base_address", __FUNCTION__); 560 default: IRDA_ERROR("%s(), invalid base_address", __func__);
561 } 561 }
562 562
563 /* Control Signal Routing Register (CSRT) */ 563 /* Control Signal Routing Register (CSRT) */
@@ -569,7 +569,7 @@ static int nsc_ircc_init_108(nsc_chip_t *chip, chipio_t *info)
569 case 9: temp = 0x05; break; 569 case 9: temp = 0x05; break;
570 case 11: temp = 0x06; break; 570 case 11: temp = 0x06; break;
571 case 15: temp = 0x07; break; 571 case 15: temp = 0x07; break;
572 default: IRDA_ERROR("%s(), invalid irq", __FUNCTION__); 572 default: IRDA_ERROR("%s(), invalid irq", __func__);
573 } 573 }
574 outb(CFG_108_CSRT, cfg_base); 574 outb(CFG_108_CSRT, cfg_base);
575 575
@@ -577,7 +577,7 @@ static int nsc_ircc_init_108(nsc_chip_t *chip, chipio_t *info)
577 case 0: outb(0x08+temp, cfg_base+1); break; 577 case 0: outb(0x08+temp, cfg_base+1); break;
578 case 1: outb(0x10+temp, cfg_base+1); break; 578 case 1: outb(0x10+temp, cfg_base+1); break;
579 case 3: outb(0x18+temp, cfg_base+1); break; 579 case 3: outb(0x18+temp, cfg_base+1); break;
580 default: IRDA_ERROR("%s(), invalid dma", __FUNCTION__); 580 default: IRDA_ERROR("%s(), invalid dma", __func__);
581 } 581 }
582 582
583 outb(CFG_108_MCTL, cfg_base); /* Mode Control Register (MCTL) */ 583 outb(CFG_108_MCTL, cfg_base); /* Mode Control Register (MCTL) */
@@ -616,7 +616,7 @@ static int nsc_ircc_probe_108(nsc_chip_t *chip, chipio_t *info)
616 break; 616 break;
617 } 617 }
618 info->sir_base = info->fir_base; 618 info->sir_base = info->fir_base;
619 IRDA_DEBUG(2, "%s(), probing fir_base=0x%03x\n", __FUNCTION__, 619 IRDA_DEBUG(2, "%s(), probing fir_base=0x%03x\n", __func__,
620 info->fir_base); 620 info->fir_base);
621 621
622 /* Read control signals routing register (CSRT) */ 622 /* Read control signals routing register (CSRT) */
@@ -649,7 +649,7 @@ static int nsc_ircc_probe_108(nsc_chip_t *chip, chipio_t *info)
649 info->irq = 15; 649 info->irq = 15;
650 break; 650 break;
651 } 651 }
652 IRDA_DEBUG(2, "%s(), probing irq=%d\n", __FUNCTION__, info->irq); 652 IRDA_DEBUG(2, "%s(), probing irq=%d\n", __func__, info->irq);
653 653
654 /* Currently we only read Rx DMA but it will also be used for Tx */ 654 /* Currently we only read Rx DMA but it will also be used for Tx */
655 switch ((reg >> 3) & 0x03) { 655 switch ((reg >> 3) & 0x03) {
@@ -666,7 +666,7 @@ static int nsc_ircc_probe_108(nsc_chip_t *chip, chipio_t *info)
666 info->dma = 3; 666 info->dma = 3;
667 break; 667 break;
668 } 668 }
669 IRDA_DEBUG(2, "%s(), probing dma=%d\n", __FUNCTION__, info->dma); 669 IRDA_DEBUG(2, "%s(), probing dma=%d\n", __func__, info->dma);
670 670
671 /* Read mode control register (MCTL) */ 671 /* Read mode control register (MCTL) */
672 outb(CFG_108_MCTL, cfg_base); 672 outb(CFG_108_MCTL, cfg_base);
@@ -823,7 +823,7 @@ static int nsc_ircc_init_39x(nsc_chip_t *chip, chipio_t *info)
823 /* User is sure about his config... accept it. */ 823 /* User is sure about his config... accept it. */
824 IRDA_DEBUG(2, "%s(): nsc_ircc_init_39x (user settings): " 824 IRDA_DEBUG(2, "%s(): nsc_ircc_init_39x (user settings): "
825 "io=0x%04x, irq=%d, dma=%d\n", 825 "io=0x%04x, irq=%d, dma=%d\n",
826 __FUNCTION__, info->fir_base, info->irq, info->dma); 826 __func__, info->fir_base, info->irq, info->dma);
827 827
828 /* Access bank for SP2 */ 828 /* Access bank for SP2 */
829 outb(CFG_39X_LDN, cfg_base); 829 outb(CFG_39X_LDN, cfg_base);
@@ -864,7 +864,7 @@ static int nsc_ircc_probe_39x(nsc_chip_t *chip, chipio_t *info)
864 int enabled, susp; 864 int enabled, susp;
865 865
866 IRDA_DEBUG(2, "%s(), nsc_ircc_probe_39x, base=%d\n", 866 IRDA_DEBUG(2, "%s(), nsc_ircc_probe_39x, base=%d\n",
867 __FUNCTION__, cfg_base); 867 __func__, cfg_base);
868 868
869 /* This function should be executed with irq off to avoid 869 /* This function should be executed with irq off to avoid
870 * another driver messing with the Super I/O bank - Jean II */ 870 * another driver messing with the Super I/O bank - Jean II */
@@ -898,7 +898,7 @@ static int nsc_ircc_probe_39x(nsc_chip_t *chip, chipio_t *info)
898 outb(CFG_39X_SPC, cfg_base); 898 outb(CFG_39X_SPC, cfg_base);
899 susp = 1 - ((inb(cfg_base+1) & 0x02) >> 1); 899 susp = 1 - ((inb(cfg_base+1) & 0x02) >> 1);
900 900
901 IRDA_DEBUG(2, "%s(): io=0x%02x%02x, irq=%d (type %d), rxdma=%d, txdma=%d, enabled=%d (suspended=%d)\n", __FUNCTION__, reg1,reg2,irq,irqt,dma1,dma2,enabled,susp); 901 IRDA_DEBUG(2, "%s(): io=0x%02x%02x, irq=%d (type %d), rxdma=%d, txdma=%d, enabled=%d (suspended=%d)\n", __func__, reg1,reg2,irq,irqt,dma1,dma2,enabled,susp);
902 902
903 /* Configure SP2 */ 903 /* Configure SP2 */
904 904
@@ -930,7 +930,10 @@ static int nsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *i
930 pnp_info.dma = -1; 930 pnp_info.dma = -1;
931 pnp_succeeded = 1; 931 pnp_succeeded = 1;
932 932
933 /* There don't seem to be any way to get the cfg_base. 933 if (id->driver_data & NSC_FORCE_DONGLE_TYPE9)
934 dongle_id = 0x9;
935
936 /* There doesn't seem to be any way of getting the cfg_base.
934 * On my box, cfg_base is in the PnP descriptor of the 937 * On my box, cfg_base is in the PnP descriptor of the
935 * motherboard. Oh well... Jean II */ 938 * motherboard. Oh well... Jean II */
936 939
@@ -947,7 +950,7 @@ static int nsc_ircc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *i
947 pnp_info.dma = pnp_dma(dev, 0); 950 pnp_info.dma = pnp_dma(dev, 0);
948 951
949 IRDA_DEBUG(0, "%s() : From PnP, found firbase 0x%03X ; irq %d ; dma %d.\n", 952 IRDA_DEBUG(0, "%s() : From PnP, found firbase 0x%03X ; irq %d ; dma %d.\n",
950 __FUNCTION__, pnp_info.fir_base, pnp_info.irq, pnp_info.dma); 953 __func__, pnp_info.fir_base, pnp_info.irq, pnp_info.dma);
951 954
952 if((pnp_info.fir_base == 0) || 955 if((pnp_info.fir_base == 0) ||
953 (pnp_info.irq == -1) || (pnp_info.dma == -1)) { 956 (pnp_info.irq == -1) || (pnp_info.dma == -1)) {
@@ -976,7 +979,7 @@ static int nsc_ircc_setup(chipio_t *info)
976 version = inb(iobase+MID); 979 version = inb(iobase+MID);
977 980
978 IRDA_DEBUG(2, "%s() Driver %s Found chip version %02x\n", 981 IRDA_DEBUG(2, "%s() Driver %s Found chip version %02x\n",
979 __FUNCTION__, driver_name, version); 982 __func__, driver_name, version);
980 983
981 /* Should be 0x2? */ 984 /* Should be 0x2? */
982 if (0x20 != (version & 0xf0)) { 985 if (0x20 != (version & 0xf0)) {
@@ -1080,30 +1083,30 @@ static void nsc_ircc_init_dongle_interface (int iobase, int dongle_id)
1080 case 0x00: /* same as */ 1083 case 0x00: /* same as */
1081 case 0x01: /* Differential serial interface */ 1084 case 0x01: /* Differential serial interface */
1082 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n", 1085 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
1083 __FUNCTION__, dongle_types[dongle_id]); 1086 __func__, dongle_types[dongle_id]);
1084 break; 1087 break;
1085 case 0x02: /* same as */ 1088 case 0x02: /* same as */
1086 case 0x03: /* Reserved */ 1089 case 0x03: /* Reserved */
1087 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n", 1090 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
1088 __FUNCTION__, dongle_types[dongle_id]); 1091 __func__, dongle_types[dongle_id]);
1089 break; 1092 break;
1090 case 0x04: /* Sharp RY5HD01 */ 1093 case 0x04: /* Sharp RY5HD01 */
1091 break; 1094 break;
1092 case 0x05: /* Reserved, but this is what the Thinkpad reports */ 1095 case 0x05: /* Reserved, but this is what the Thinkpad reports */
1093 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n", 1096 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
1094 __FUNCTION__, dongle_types[dongle_id]); 1097 __func__, dongle_types[dongle_id]);
1095 break; 1098 break;
1096 case 0x06: /* Single-ended serial interface */ 1099 case 0x06: /* Single-ended serial interface */
1097 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n", 1100 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
1098 __FUNCTION__, dongle_types[dongle_id]); 1101 __func__, dongle_types[dongle_id]);
1099 break; 1102 break;
1100 case 0x07: /* Consumer-IR only */ 1103 case 0x07: /* Consumer-IR only */
1101 IRDA_DEBUG(0, "%s(), %s is not for IrDA mode\n", 1104 IRDA_DEBUG(0, "%s(), %s is not for IrDA mode\n",
1102 __FUNCTION__, dongle_types[dongle_id]); 1105 __func__, dongle_types[dongle_id]);
1103 break; 1106 break;
1104 case 0x08: /* HP HSDL-2300, HP HSDL-3600/HSDL-3610 */ 1107 case 0x08: /* HP HSDL-2300, HP HSDL-3600/HSDL-3610 */
1105 IRDA_DEBUG(0, "%s(), %s\n", 1108 IRDA_DEBUG(0, "%s(), %s\n",
1106 __FUNCTION__, dongle_types[dongle_id]); 1109 __func__, dongle_types[dongle_id]);
1107 break; 1110 break;
1108 case 0x09: /* IBM31T1100 or Temic TFDS6000/TFDS6500 */ 1111 case 0x09: /* IBM31T1100 or Temic TFDS6000/TFDS6500 */
1109 outb(0x28, iobase+7); /* Set irsl[0-2] as output */ 1112 outb(0x28, iobase+7); /* Set irsl[0-2] as output */
@@ -1111,7 +1114,7 @@ static void nsc_ircc_init_dongle_interface (int iobase, int dongle_id)
1111 case 0x0A: /* same as */ 1114 case 0x0A: /* same as */
1112 case 0x0B: /* Reserved */ 1115 case 0x0B: /* Reserved */
1113 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n", 1116 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
1114 __FUNCTION__, dongle_types[dongle_id]); 1117 __func__, dongle_types[dongle_id]);
1115 break; 1118 break;
1116 case 0x0C: /* same as */ 1119 case 0x0C: /* same as */
1117 case 0x0D: /* HP HSDL-1100/HSDL-2100 */ 1120 case 0x0D: /* HP HSDL-1100/HSDL-2100 */
@@ -1126,14 +1129,14 @@ static void nsc_ircc_init_dongle_interface (int iobase, int dongle_id)
1126 break; 1129 break;
1127 case 0x0F: /* No dongle connected */ 1130 case 0x0F: /* No dongle connected */
1128 IRDA_DEBUG(0, "%s(), %s\n", 1131 IRDA_DEBUG(0, "%s(), %s\n",
1129 __FUNCTION__, dongle_types[dongle_id]); 1132 __func__, dongle_types[dongle_id]);
1130 1133
1131 switch_bank(iobase, BANK0); 1134 switch_bank(iobase, BANK0);
1132 outb(0x62, iobase+MCR); 1135 outb(0x62, iobase+MCR);
1133 break; 1136 break;
1134 default: 1137 default:
1135 IRDA_DEBUG(0, "%s(), invalid dongle_id %#x", 1138 IRDA_DEBUG(0, "%s(), invalid dongle_id %#x",
1136 __FUNCTION__, dongle_id); 1139 __func__, dongle_id);
1137 } 1140 }
1138 1141
1139 /* IRCFG1: IRSL1 and 2 are set to IrDA mode */ 1142 /* IRCFG1: IRSL1 and 2 are set to IrDA mode */
@@ -1165,30 +1168,30 @@ static void nsc_ircc_change_dongle_speed(int iobase, int speed, int dongle_id)
1165 case 0x00: /* same as */ 1168 case 0x00: /* same as */
1166 case 0x01: /* Differential serial interface */ 1169 case 0x01: /* Differential serial interface */
1167 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n", 1170 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
1168 __FUNCTION__, dongle_types[dongle_id]); 1171 __func__, dongle_types[dongle_id]);
1169 break; 1172 break;
1170 case 0x02: /* same as */ 1173 case 0x02: /* same as */
1171 case 0x03: /* Reserved */ 1174 case 0x03: /* Reserved */
1172 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n", 1175 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
1173 __FUNCTION__, dongle_types[dongle_id]); 1176 __func__, dongle_types[dongle_id]);
1174 break; 1177 break;
1175 case 0x04: /* Sharp RY5HD01 */ 1178 case 0x04: /* Sharp RY5HD01 */
1176 break; 1179 break;
1177 case 0x05: /* Reserved */ 1180 case 0x05: /* Reserved */
1178 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n", 1181 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
1179 __FUNCTION__, dongle_types[dongle_id]); 1182 __func__, dongle_types[dongle_id]);
1180 break; 1183 break;
1181 case 0x06: /* Single-ended serial interface */ 1184 case 0x06: /* Single-ended serial interface */
1182 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n", 1185 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
1183 __FUNCTION__, dongle_types[dongle_id]); 1186 __func__, dongle_types[dongle_id]);
1184 break; 1187 break;
1185 case 0x07: /* Consumer-IR only */ 1188 case 0x07: /* Consumer-IR only */
1186 IRDA_DEBUG(0, "%s(), %s is not for IrDA mode\n", 1189 IRDA_DEBUG(0, "%s(), %s is not for IrDA mode\n",
1187 __FUNCTION__, dongle_types[dongle_id]); 1190 __func__, dongle_types[dongle_id]);
1188 break; 1191 break;
1189 case 0x08: /* HP HSDL-2300, HP HSDL-3600/HSDL-3610 */ 1192 case 0x08: /* HP HSDL-2300, HP HSDL-3600/HSDL-3610 */
1190 IRDA_DEBUG(0, "%s(), %s\n", 1193 IRDA_DEBUG(0, "%s(), %s\n",
1191 __FUNCTION__, dongle_types[dongle_id]); 1194 __func__, dongle_types[dongle_id]);
1192 outb(0x00, iobase+4); 1195 outb(0x00, iobase+4);
1193 if (speed > 115200) 1196 if (speed > 115200)
1194 outb(0x01, iobase+4); 1197 outb(0x01, iobase+4);
@@ -1207,7 +1210,7 @@ static void nsc_ircc_change_dongle_speed(int iobase, int speed, int dongle_id)
1207 case 0x0A: /* same as */ 1210 case 0x0A: /* same as */
1208 case 0x0B: /* Reserved */ 1211 case 0x0B: /* Reserved */
1209 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n", 1212 IRDA_DEBUG(0, "%s(), %s not defined by irda yet\n",
1210 __FUNCTION__, dongle_types[dongle_id]); 1213 __func__, dongle_types[dongle_id]);
1211 break; 1214 break;
1212 case 0x0C: /* same as */ 1215 case 0x0C: /* same as */
1213 case 0x0D: /* HP HSDL-1100/HSDL-2100 */ 1216 case 0x0D: /* HP HSDL-1100/HSDL-2100 */
@@ -1216,13 +1219,13 @@ static void nsc_ircc_change_dongle_speed(int iobase, int speed, int dongle_id)
1216 break; 1219 break;
1217 case 0x0F: /* No dongle connected */ 1220 case 0x0F: /* No dongle connected */
1218 IRDA_DEBUG(0, "%s(), %s is not for IrDA mode\n", 1221 IRDA_DEBUG(0, "%s(), %s is not for IrDA mode\n",
1219 __FUNCTION__, dongle_types[dongle_id]); 1222 __func__, dongle_types[dongle_id]);
1220 1223
1221 switch_bank(iobase, BANK0); 1224 switch_bank(iobase, BANK0);
1222 outb(0x62, iobase+MCR); 1225 outb(0x62, iobase+MCR);
1223 break; 1226 break;
1224 default: 1227 default:
1225 IRDA_DEBUG(0, "%s(), invalid data_rate\n", __FUNCTION__); 1228 IRDA_DEBUG(0, "%s(), invalid data_rate\n", __func__);
1226 } 1229 }
1227 /* Restore bank register */ 1230 /* Restore bank register */
1228 outb(bank, iobase+BSR); 1231 outb(bank, iobase+BSR);
@@ -1243,7 +1246,7 @@ static __u8 nsc_ircc_change_speed(struct nsc_ircc_cb *self, __u32 speed)
1243 __u8 bank; 1246 __u8 bank;
1244 __u8 ier; /* Interrupt enable register */ 1247 __u8 ier; /* Interrupt enable register */
1245 1248
1246 IRDA_DEBUG(2, "%s(), speed=%d\n", __FUNCTION__, speed); 1249 IRDA_DEBUG(2, "%s(), speed=%d\n", __func__, speed);
1247 1250
1248 IRDA_ASSERT(self != NULL, return 0;); 1251 IRDA_ASSERT(self != NULL, return 0;);
1249 1252
@@ -1276,20 +1279,20 @@ static __u8 nsc_ircc_change_speed(struct nsc_ircc_cb *self, __u32 speed)
1276 outb(inb(iobase+4) | 0x04, iobase+4); 1279 outb(inb(iobase+4) | 0x04, iobase+4);
1277 1280
1278 mcr = MCR_MIR; 1281 mcr = MCR_MIR;
1279 IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __FUNCTION__); 1282 IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __func__);
1280 break; 1283 break;
1281 case 1152000: 1284 case 1152000:
1282 mcr = MCR_MIR; 1285 mcr = MCR_MIR;
1283 IRDA_DEBUG(0, "%s(), handling baud of 1152000\n", __FUNCTION__); 1286 IRDA_DEBUG(0, "%s(), handling baud of 1152000\n", __func__);
1284 break; 1287 break;
1285 case 4000000: 1288 case 4000000:
1286 mcr = MCR_FIR; 1289 mcr = MCR_FIR;
1287 IRDA_DEBUG(0, "%s(), handling baud of 4000000\n", __FUNCTION__); 1290 IRDA_DEBUG(0, "%s(), handling baud of 4000000\n", __func__);
1288 break; 1291 break;
1289 default: 1292 default:
1290 mcr = MCR_FIR; 1293 mcr = MCR_FIR;
1291 IRDA_DEBUG(0, "%s(), unknown baud rate of %d\n", 1294 IRDA_DEBUG(0, "%s(), unknown baud rate of %d\n",
1292 __FUNCTION__, speed); 1295 __func__, speed);
1293 break; 1296 break;
1294 } 1297 }
1295 1298
@@ -1594,7 +1597,7 @@ static int nsc_ircc_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
1594 int actual = 0; 1597 int actual = 0;
1595 __u8 bank; 1598 __u8 bank;
1596 1599
1597 IRDA_DEBUG(4, "%s()\n", __FUNCTION__); 1600 IRDA_DEBUG(4, "%s()\n", __func__);
1598 1601
1599 /* Save current bank */ 1602 /* Save current bank */
1600 bank = inb(iobase+BSR); 1603 bank = inb(iobase+BSR);
@@ -1602,7 +1605,7 @@ static int nsc_ircc_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
1602 switch_bank(iobase, BANK0); 1605 switch_bank(iobase, BANK0);
1603 if (!(inb_p(iobase+LSR) & LSR_TXEMP)) { 1606 if (!(inb_p(iobase+LSR) & LSR_TXEMP)) {
1604 IRDA_DEBUG(4, "%s(), warning, FIFO not empty yet!\n", 1607 IRDA_DEBUG(4, "%s(), warning, FIFO not empty yet!\n",
1605 __FUNCTION__); 1608 __func__);
1606 1609
1607 /* FIFO may still be filled to the Tx interrupt threshold */ 1610 /* FIFO may still be filled to the Tx interrupt threshold */
1608 fifo_size -= 17; 1611 fifo_size -= 17;
@@ -1615,7 +1618,7 @@ static int nsc_ircc_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
1615 } 1618 }
1616 1619
1617 IRDA_DEBUG(4, "%s(), fifo_size %d ; %d sent of %d\n", 1620 IRDA_DEBUG(4, "%s(), fifo_size %d ; %d sent of %d\n",
1618 __FUNCTION__, fifo_size, actual, len); 1621 __func__, fifo_size, actual, len);
1619 1622
1620 /* Restore bank */ 1623 /* Restore bank */
1621 outb(bank, iobase+BSR); 1624 outb(bank, iobase+BSR);
@@ -1636,7 +1639,7 @@ static int nsc_ircc_dma_xmit_complete(struct nsc_ircc_cb *self)
1636 __u8 bank; 1639 __u8 bank;
1637 int ret = TRUE; 1640 int ret = TRUE;
1638 1641
1639 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 1642 IRDA_DEBUG(2, "%s()\n", __func__);
1640 1643
1641 iobase = self->io.fir_base; 1644 iobase = self->io.fir_base;
1642 1645
@@ -1767,7 +1770,7 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase)
1767 len = inb(iobase+RFLFL) | ((inb(iobase+RFLFH) & 0x1f) << 8); 1770 len = inb(iobase+RFLFL) | ((inb(iobase+RFLFH) & 0x1f) << 8);
1768 1771
1769 if (st_fifo->tail >= MAX_RX_WINDOW) { 1772 if (st_fifo->tail >= MAX_RX_WINDOW) {
1770 IRDA_DEBUG(0, "%s(), window is full!\n", __FUNCTION__); 1773 IRDA_DEBUG(0, "%s(), window is full!\n", __func__);
1771 continue; 1774 continue;
1772 } 1775 }
1773 1776
@@ -1859,7 +1862,7 @@ static int nsc_ircc_dma_receive_complete(struct nsc_ircc_cb *self, int iobase)
1859 if (skb == NULL) { 1862 if (skb == NULL) {
1860 IRDA_WARNING("%s(), memory squeeze, " 1863 IRDA_WARNING("%s(), memory squeeze, "
1861 "dropping frame.\n", 1864 "dropping frame.\n",
1862 __FUNCTION__); 1865 __func__);
1863 self->stats.rx_dropped++; 1866 self->stats.rx_dropped++;
1864 1867
1865 /* Restore bank register */ 1868 /* Restore bank register */
@@ -1965,7 +1968,7 @@ static void nsc_ircc_sir_interrupt(struct nsc_ircc_cb *self, int eir)
1965 * Need to be after self->io.direction to avoid race with 1968 * Need to be after self->io.direction to avoid race with
1966 * nsc_ircc_hard_xmit_sir() - Jean II */ 1969 * nsc_ircc_hard_xmit_sir() - Jean II */
1967 if (self->new_speed) { 1970 if (self->new_speed) {
1968 IRDA_DEBUG(2, "%s(), Changing speed!\n", __FUNCTION__); 1971 IRDA_DEBUG(2, "%s(), Changing speed!\n", __func__);
1969 self->ier = nsc_ircc_change_speed(self, 1972 self->ier = nsc_ircc_change_speed(self,
1970 self->new_speed); 1973 self->new_speed);
1971 self->new_speed = 0; 1974 self->new_speed = 0;
@@ -2051,7 +2054,7 @@ static void nsc_ircc_fir_interrupt(struct nsc_ircc_cb *self, int iobase,
2051 } else 2054 } else
2052 IRDA_WARNING("%s(), potential " 2055 IRDA_WARNING("%s(), potential "
2053 "Tx queue lockup !\n", 2056 "Tx queue lockup !\n",
2054 __FUNCTION__); 2057 __func__);
2055 } 2058 }
2056 } else { 2059 } else {
2057 /* Not finished yet, so interrupt on DMA again */ 2060 /* Not finished yet, so interrupt on DMA again */
@@ -2160,7 +2163,7 @@ static int nsc_ircc_net_open(struct net_device *dev)
2160 char hwname[32]; 2163 char hwname[32];
2161 __u8 bank; 2164 __u8 bank;
2162 2165
2163 IRDA_DEBUG(4, "%s()\n", __FUNCTION__); 2166 IRDA_DEBUG(4, "%s()\n", __func__);
2164 2167
2165 IRDA_ASSERT(dev != NULL, return -1;); 2168 IRDA_ASSERT(dev != NULL, return -1;);
2166 self = (struct nsc_ircc_cb *) dev->priv; 2169 self = (struct nsc_ircc_cb *) dev->priv;
@@ -2222,7 +2225,7 @@ static int nsc_ircc_net_close(struct net_device *dev)
2222 int iobase; 2225 int iobase;
2223 __u8 bank; 2226 __u8 bank;
2224 2227
2225 IRDA_DEBUG(4, "%s()\n", __FUNCTION__); 2228 IRDA_DEBUG(4, "%s()\n", __func__);
2226 2229
2227 IRDA_ASSERT(dev != NULL, return -1;); 2230 IRDA_ASSERT(dev != NULL, return -1;);
2228 2231
@@ -2276,7 +2279,7 @@ static int nsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
2276 2279
2277 IRDA_ASSERT(self != NULL, return -1;); 2280 IRDA_ASSERT(self != NULL, return -1;);
2278 2281
2279 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd); 2282 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
2280 2283
2281 switch (cmd) { 2284 switch (cmd) {
2282 case SIOCSBANDWIDTH: /* Set bandwidth */ 2285 case SIOCSBANDWIDTH: /* Set bandwidth */
diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h
index 29398a4f73fd..71cd3c5a0762 100644
--- a/drivers/net/irda/nsc-ircc.h
+++ b/drivers/net/irda/nsc-ircc.h
@@ -35,6 +35,9 @@
35#include <linux/types.h> 35#include <linux/types.h>
36#include <asm/io.h> 36#include <asm/io.h>
37 37
38/* Features for chips (set in driver_data) */
39#define NSC_FORCE_DONGLE_TYPE9 0x00000001
40
38/* DMA modes needed */ 41/* DMA modes needed */
39#define DMA_TX_MODE 0x08 /* Mem to I/O, ++, demand. */ 42#define DMA_TX_MODE 0x08 /* Mem to I/O, ++, demand. */
40#define DMA_RX_MODE 0x04 /* I/O to mem, ++, demand. */ 43#define DMA_RX_MODE 0x04 /* I/O to mem, ++, demand. */
diff --git a/drivers/net/irda/old_belkin-sir.c b/drivers/net/irda/old_belkin-sir.c
index 8c22c7374a23..75714bc71030 100644
--- a/drivers/net/irda/old_belkin-sir.c
+++ b/drivers/net/irda/old_belkin-sir.c
@@ -92,7 +92,7 @@ static int old_belkin_open(struct sir_dev *dev)
92{ 92{
93 struct qos_info *qos = &dev->qos; 93 struct qos_info *qos = &dev->qos;
94 94
95 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 95 IRDA_DEBUG(2, "%s()\n", __func__);
96 96
97 /* Power on dongle */ 97 /* Power on dongle */
98 sirdev_set_dtr_rts(dev, TRUE, TRUE); 98 sirdev_set_dtr_rts(dev, TRUE, TRUE);
@@ -110,7 +110,7 @@ static int old_belkin_open(struct sir_dev *dev)
110 110
111static int old_belkin_close(struct sir_dev *dev) 111static int old_belkin_close(struct sir_dev *dev)
112{ 112{
113 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 113 IRDA_DEBUG(2, "%s()\n", __func__);
114 114
115 /* Power off dongle */ 115 /* Power off dongle */
116 sirdev_set_dtr_rts(dev, FALSE, FALSE); 116 sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -125,7 +125,7 @@ static int old_belkin_close(struct sir_dev *dev)
125 */ 125 */
126static int old_belkin_change_speed(struct sir_dev *dev, unsigned speed) 126static int old_belkin_change_speed(struct sir_dev *dev, unsigned speed)
127{ 127{
128 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 128 IRDA_DEBUG(2, "%s()\n", __func__);
129 129
130 dev->speed = 9600; 130 dev->speed = 9600;
131 return (speed==dev->speed) ? 0 : -EINVAL; 131 return (speed==dev->speed) ? 0 : -EINVAL;
@@ -139,7 +139,7 @@ static int old_belkin_change_speed(struct sir_dev *dev, unsigned speed)
139 */ 139 */
140static int old_belkin_reset(struct sir_dev *dev) 140static int old_belkin_reset(struct sir_dev *dev)
141{ 141{
142 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 142 IRDA_DEBUG(2, "%s()\n", __func__);
143 143
144 /* This dongles speed "defaults" to 9600 bps ;-) */ 144 /* This dongles speed "defaults" to 9600 bps ;-) */
145 dev->speed = 9600; 145 dev->speed = 9600;
diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
index 6078e03de9a8..3f32909c24c8 100644
--- a/drivers/net/irda/sir_dev.c
+++ b/drivers/net/irda/sir_dev.c
@@ -80,7 +80,7 @@ static int sirdev_tx_complete_fsm(struct sir_dev *dev)
80 return 0; 80 return 0;
81 81
82 default: 82 default:
83 IRDA_ERROR("%s - undefined state\n", __FUNCTION__); 83 IRDA_ERROR("%s - undefined state\n", __func__);
84 return -EINVAL; 84 return -EINVAL;
85 } 85 }
86 fsm->substate = next_state; 86 fsm->substate = next_state;
@@ -107,11 +107,11 @@ static void sirdev_config_fsm(struct work_struct *work)
107 int ret = -1; 107 int ret = -1;
108 unsigned delay; 108 unsigned delay;
109 109
110 IRDA_DEBUG(2, "%s(), <%ld>\n", __FUNCTION__, jiffies); 110 IRDA_DEBUG(2, "%s(), <%ld>\n", __func__, jiffies);
111 111
112 do { 112 do {
113 IRDA_DEBUG(3, "%s - state=0x%04x / substate=0x%04x\n", 113 IRDA_DEBUG(3, "%s - state=0x%04x / substate=0x%04x\n",
114 __FUNCTION__, fsm->state, fsm->substate); 114 __func__, fsm->state, fsm->substate);
115 115
116 next_state = fsm->state; 116 next_state = fsm->state;
117 delay = 0; 117 delay = 0;
@@ -249,12 +249,12 @@ static void sirdev_config_fsm(struct work_struct *work)
249 break; 249 break;
250 250
251 default: 251 default:
252 IRDA_ERROR("%s - undefined state\n", __FUNCTION__); 252 IRDA_ERROR("%s - undefined state\n", __func__);
253 fsm->result = -EINVAL; 253 fsm->result = -EINVAL;
254 /* fall thru */ 254 /* fall thru */
255 255
256 case SIRDEV_STATE_ERROR: 256 case SIRDEV_STATE_ERROR:
257 IRDA_ERROR("%s - error: %d\n", __FUNCTION__, fsm->result); 257 IRDA_ERROR("%s - error: %d\n", __func__, fsm->result);
258 258
259#if 0 /* don't enable this before we have netdev->tx_timeout to recover */ 259#if 0 /* don't enable this before we have netdev->tx_timeout to recover */
260 netif_stop_queue(dev->netdev); 260 netif_stop_queue(dev->netdev);
@@ -284,11 +284,12 @@ int sirdev_schedule_request(struct sir_dev *dev, int initial_state, unsigned par
284{ 284{
285 struct sir_fsm *fsm = &dev->fsm; 285 struct sir_fsm *fsm = &dev->fsm;
286 286
287 IRDA_DEBUG(2, "%s - state=0x%04x / param=%u\n", __FUNCTION__, initial_state, param); 287 IRDA_DEBUG(2, "%s - state=0x%04x / param=%u\n", __func__,
288 initial_state, param);
288 289
289 if (down_trylock(&fsm->sem)) { 290 if (down_trylock(&fsm->sem)) {
290 if (in_interrupt() || in_atomic() || irqs_disabled()) { 291 if (in_interrupt() || in_atomic() || irqs_disabled()) {
291 IRDA_DEBUG(1, "%s(), state machine busy!\n", __FUNCTION__); 292 IRDA_DEBUG(1, "%s(), state machine busy!\n", __func__);
292 return -EWOULDBLOCK; 293 return -EWOULDBLOCK;
293 } else 294 } else
294 down(&fsm->sem); 295 down(&fsm->sem);
@@ -296,7 +297,7 @@ int sirdev_schedule_request(struct sir_dev *dev, int initial_state, unsigned par
296 297
297 if (fsm->state == SIRDEV_STATE_DEAD) { 298 if (fsm->state == SIRDEV_STATE_DEAD) {
298 /* race with sirdev_close should never happen */ 299 /* race with sirdev_close should never happen */
299 IRDA_ERROR("%s(), instance staled!\n", __FUNCTION__); 300 IRDA_ERROR("%s(), instance staled!\n", __func__);
300 up(&fsm->sem); 301 up(&fsm->sem);
301 return -ESTALE; /* or better EPIPE? */ 302 return -ESTALE; /* or better EPIPE? */
302 } 303 }
@@ -341,7 +342,7 @@ int sirdev_set_dongle(struct sir_dev *dev, IRDA_DONGLE type)
341{ 342{
342 int err; 343 int err;
343 344
344 IRDA_DEBUG(3, "%s : requesting dongle %d.\n", __FUNCTION__, type); 345 IRDA_DEBUG(3, "%s : requesting dongle %d.\n", __func__, type);
345 346
346 err = sirdev_schedule_dongle_open(dev, type); 347 err = sirdev_schedule_dongle_open(dev, type);
347 if (unlikely(err)) 348 if (unlikely(err))
@@ -376,7 +377,7 @@ int sirdev_raw_write(struct sir_dev *dev, const char *buf, int len)
376 377
377 ret = dev->drv->do_write(dev, dev->tx_buff.data, dev->tx_buff.len); 378 ret = dev->drv->do_write(dev, dev->tx_buff.data, dev->tx_buff.len);
378 if (ret > 0) { 379 if (ret > 0) {
379 IRDA_DEBUG(3, "%s(), raw-tx started\n", __FUNCTION__); 380 IRDA_DEBUG(3, "%s(), raw-tx started\n", __func__);
380 381
381 dev->tx_buff.data += ret; 382 dev->tx_buff.data += ret;
382 dev->tx_buff.len -= ret; 383 dev->tx_buff.len -= ret;
@@ -437,7 +438,7 @@ void sirdev_write_complete(struct sir_dev *dev)
437 spin_lock_irqsave(&dev->tx_lock, flags); 438 spin_lock_irqsave(&dev->tx_lock, flags);
438 439
439 IRDA_DEBUG(3, "%s() - dev->tx_buff.len = %d\n", 440 IRDA_DEBUG(3, "%s() - dev->tx_buff.len = %d\n",
440 __FUNCTION__, dev->tx_buff.len); 441 __func__, dev->tx_buff.len);
441 442
442 if (likely(dev->tx_buff.len > 0)) { 443 if (likely(dev->tx_buff.len > 0)) {
443 /* Write data left in transmit buffer */ 444 /* Write data left in transmit buffer */
@@ -450,7 +451,7 @@ void sirdev_write_complete(struct sir_dev *dev)
450 else if (unlikely(actual<0)) { 451 else if (unlikely(actual<0)) {
451 /* could be dropped later when we have tx_timeout to recover */ 452 /* could be dropped later when we have tx_timeout to recover */
452 IRDA_ERROR("%s: drv->do_write failed (%d)\n", 453 IRDA_ERROR("%s: drv->do_write failed (%d)\n",
453 __FUNCTION__, actual); 454 __func__, actual);
454 if ((skb=dev->tx_skb) != NULL) { 455 if ((skb=dev->tx_skb) != NULL) {
455 dev->tx_skb = NULL; 456 dev->tx_skb = NULL;
456 dev_kfree_skb_any(skb); 457 dev_kfree_skb_any(skb);
@@ -471,7 +472,7 @@ void sirdev_write_complete(struct sir_dev *dev)
471 * restarted when the irda-thread has completed the request. 472 * restarted when the irda-thread has completed the request.
472 */ 473 */
473 474
474 IRDA_DEBUG(3, "%s(), raw-tx done\n", __FUNCTION__); 475 IRDA_DEBUG(3, "%s(), raw-tx done\n", __func__);
475 dev->raw_tx = 0; 476 dev->raw_tx = 0;
476 goto done; /* no post-frame handling in raw mode */ 477 goto done; /* no post-frame handling in raw mode */
477 } 478 }
@@ -488,7 +489,7 @@ void sirdev_write_complete(struct sir_dev *dev)
488 * re-activated. 489 * re-activated.
489 */ 490 */
490 491
491 IRDA_DEBUG(5, "%s(), finished with frame!\n", __FUNCTION__); 492 IRDA_DEBUG(5, "%s(), finished with frame!\n", __func__);
492 493
493 if ((skb=dev->tx_skb) != NULL) { 494 if ((skb=dev->tx_skb) != NULL) {
494 dev->tx_skb = NULL; 495 dev->tx_skb = NULL;
@@ -498,14 +499,14 @@ void sirdev_write_complete(struct sir_dev *dev)
498 } 499 }
499 500
500 if (unlikely(dev->new_speed > 0)) { 501 if (unlikely(dev->new_speed > 0)) {
501 IRDA_DEBUG(5, "%s(), Changing speed!\n", __FUNCTION__); 502 IRDA_DEBUG(5, "%s(), Changing speed!\n", __func__);
502 err = sirdev_schedule_speed(dev, dev->new_speed); 503 err = sirdev_schedule_speed(dev, dev->new_speed);
503 if (unlikely(err)) { 504 if (unlikely(err)) {
504 /* should never happen 505 /* should never happen
505 * forget the speed change and hope the stack recovers 506 * forget the speed change and hope the stack recovers
506 */ 507 */
507 IRDA_ERROR("%s - schedule speed change failed: %d\n", 508 IRDA_ERROR("%s - schedule speed change failed: %d\n",
508 __FUNCTION__, err); 509 __func__, err);
509 netif_wake_queue(dev->netdev); 510 netif_wake_queue(dev->netdev);
510 } 511 }
511 /* else: success 512 /* else: success
@@ -532,13 +533,13 @@ EXPORT_SYMBOL(sirdev_write_complete);
532int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count) 533int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count)
533{ 534{
534 if (!dev || !dev->netdev) { 535 if (!dev || !dev->netdev) {
535 IRDA_WARNING("%s(), not ready yet!\n", __FUNCTION__); 536 IRDA_WARNING("%s(), not ready yet!\n", __func__);
536 return -1; 537 return -1;
537 } 538 }
538 539
539 if (!dev->irlap) { 540 if (!dev->irlap) {
540 IRDA_WARNING("%s - too early: %p / %zd!\n", 541 IRDA_WARNING("%s - too early: %p / %zd!\n",
541 __FUNCTION__, cp, count); 542 __func__, cp, count);
542 return -1; 543 return -1;
543 } 544 }
544 545
@@ -548,7 +549,7 @@ int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count)
548 */ 549 */
549 irda_device_set_media_busy(dev->netdev, TRUE); 550 irda_device_set_media_busy(dev->netdev, TRUE);
550 dev->stats.rx_dropped++; 551 dev->stats.rx_dropped++;
551 IRDA_DEBUG(0, "%s; rx-drop: %zd\n", __FUNCTION__, count); 552 IRDA_DEBUG(0, "%s; rx-drop: %zd\n", __func__, count);
552 return 0; 553 return 0;
553 } 554 }
554 555
@@ -600,7 +601,7 @@ static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
600 601
601 netif_stop_queue(ndev); 602 netif_stop_queue(ndev);
602 603
603 IRDA_DEBUG(3, "%s(), skb->len = %d\n", __FUNCTION__, skb->len); 604 IRDA_DEBUG(3, "%s(), skb->len = %d\n", __func__, skb->len);
604 605
605 speed = irda_get_next_speed(skb); 606 speed = irda_get_next_speed(skb);
606 if ((speed != dev->speed) && (speed != -1)) { 607 if ((speed != dev->speed) && (speed != -1)) {
@@ -637,7 +638,7 @@ static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
637 638
638 /* Check problems */ 639 /* Check problems */
639 if(spin_is_locked(&dev->tx_lock)) { 640 if(spin_is_locked(&dev->tx_lock)) {
640 IRDA_DEBUG(3, "%s(), write not completed\n", __FUNCTION__); 641 IRDA_DEBUG(3, "%s(), write not completed\n", __func__);
641 } 642 }
642 643
643 /* serialize with write completion */ 644 /* serialize with write completion */
@@ -666,7 +667,7 @@ static int sirdev_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
666 else if (unlikely(actual < 0)) { 667 else if (unlikely(actual < 0)) {
667 /* could be dropped later when we have tx_timeout to recover */ 668 /* could be dropped later when we have tx_timeout to recover */
668 IRDA_ERROR("%s: drv->do_write failed (%d)\n", 669 IRDA_ERROR("%s: drv->do_write failed (%d)\n",
669 __FUNCTION__, actual); 670 __func__, actual);
670 dev_kfree_skb_any(skb); 671 dev_kfree_skb_any(skb);
671 dev->stats.tx_errors++; 672 dev->stats.tx_errors++;
672 dev->stats.tx_dropped++; 673 dev->stats.tx_dropped++;
@@ -687,7 +688,7 @@ static int sirdev_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
687 688
688 IRDA_ASSERT(dev != NULL, return -1;); 689 IRDA_ASSERT(dev != NULL, return -1;);
689 690
690 IRDA_DEBUG(3, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, ndev->name, cmd); 691 IRDA_DEBUG(3, "%s(), %s, (cmd=0x%X)\n", __func__, ndev->name, cmd);
691 692
692 switch (cmd) { 693 switch (cmd) {
693 case SIOCSBANDWIDTH: /* Set bandwidth */ 694 case SIOCSBANDWIDTH: /* Set bandwidth */
@@ -804,7 +805,7 @@ static int sirdev_open(struct net_device *ndev)
804 if (!try_module_get(drv->owner)) 805 if (!try_module_get(drv->owner))
805 return -ESTALE; 806 return -ESTALE;
806 807
807 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 808 IRDA_DEBUG(2, "%s()\n", __func__);
808 809
809 if (sirdev_alloc_buffers(dev)) 810 if (sirdev_alloc_buffers(dev))
810 goto errout_dec; 811 goto errout_dec;
@@ -822,7 +823,7 @@ static int sirdev_open(struct net_device *ndev)
822 823
823 netif_wake_queue(ndev); 824 netif_wake_queue(ndev);
824 825
825 IRDA_DEBUG(2, "%s - done, speed = %d\n", __FUNCTION__, dev->speed); 826 IRDA_DEBUG(2, "%s - done, speed = %d\n", __func__, dev->speed);
826 827
827 return 0; 828 return 0;
828 829
@@ -842,7 +843,7 @@ static int sirdev_close(struct net_device *ndev)
842 struct sir_dev *dev = ndev->priv; 843 struct sir_dev *dev = ndev->priv;
843 const struct sir_driver *drv; 844 const struct sir_driver *drv;
844 845
845// IRDA_DEBUG(0, "%s\n", __FUNCTION__); 846// IRDA_DEBUG(0, "%s\n", __func__);
846 847
847 netif_stop_queue(ndev); 848 netif_stop_queue(ndev);
848 849
@@ -878,7 +879,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
878 struct net_device *ndev; 879 struct net_device *ndev;
879 struct sir_dev *dev; 880 struct sir_dev *dev;
880 881
881 IRDA_DEBUG(0, "%s - %s\n", __FUNCTION__, name); 882 IRDA_DEBUG(0, "%s - %s\n", __func__, name);
882 883
883 /* instead of adding tests to protect against drv->do_write==NULL 884 /* instead of adding tests to protect against drv->do_write==NULL
884 * at several places we refuse to create a sir_dev instance for 885 * at several places we refuse to create a sir_dev instance for
@@ -892,7 +893,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
892 */ 893 */
893 ndev = alloc_irdadev(sizeof(*dev)); 894 ndev = alloc_irdadev(sizeof(*dev));
894 if (ndev == NULL) { 895 if (ndev == NULL) {
895 IRDA_ERROR("%s - Can't allocate memory for IrDA control block!\n", __FUNCTION__); 896 IRDA_ERROR("%s - Can't allocate memory for IrDA control block!\n", __func__);
896 goto out; 897 goto out;
897 } 898 }
898 dev = ndev->priv; 899 dev = ndev->priv;
@@ -921,7 +922,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
921 ndev->do_ioctl = sirdev_ioctl; 922 ndev->do_ioctl = sirdev_ioctl;
922 923
923 if (register_netdev(ndev)) { 924 if (register_netdev(ndev)) {
924 IRDA_ERROR("%s(), register_netdev() failed!\n", __FUNCTION__); 925 IRDA_ERROR("%s(), register_netdev() failed!\n", __func__);
925 goto out_freenetdev; 926 goto out_freenetdev;
926 } 927 }
927 928
@@ -938,7 +939,7 @@ int sirdev_put_instance(struct sir_dev *dev)
938{ 939{
939 int err = 0; 940 int err = 0;
940 941
941 IRDA_DEBUG(0, "%s\n", __FUNCTION__); 942 IRDA_DEBUG(0, "%s\n", __func__);
942 943
943 atomic_set(&dev->enable_rx, 0); 944 atomic_set(&dev->enable_rx, 0);
944 945
@@ -948,7 +949,7 @@ int sirdev_put_instance(struct sir_dev *dev)
948 if (dev->dongle_drv) 949 if (dev->dongle_drv)
949 err = sirdev_schedule_dongle_close(dev); 950 err = sirdev_schedule_dongle_close(dev);
950 if (err) 951 if (err)
951 IRDA_ERROR("%s - error %d\n", __FUNCTION__, err); 952 IRDA_ERROR("%s - error %d\n", __func__, err);
952 953
953 sirdev_close(dev->netdev); 954 sirdev_close(dev->netdev);
954 955
diff --git a/drivers/net/irda/sir_dongle.c b/drivers/net/irda/sir_dongle.c
index 25d5b8a96bdc..36030241f7a9 100644
--- a/drivers/net/irda/sir_dongle.c
+++ b/drivers/net/irda/sir_dongle.c
@@ -36,7 +36,7 @@ int irda_register_dongle(struct dongle_driver *new)
36 struct dongle_driver *drv; 36 struct dongle_driver *drv;
37 37
38 IRDA_DEBUG(0, "%s : registering dongle \"%s\" (%d).\n", 38 IRDA_DEBUG(0, "%s : registering dongle \"%s\" (%d).\n",
39 __FUNCTION__, new->driver_name, new->type); 39 __func__, new->driver_name, new->type);
40 40
41 mutex_lock(&dongle_list_lock); 41 mutex_lock(&dongle_list_lock);
42 list_for_each(entry, &dongle_list) { 42 list_for_each(entry, &dongle_list) {
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 78dc8e7837f0..b5360fe99d3a 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -460,7 +460,7 @@ static int __init smsc_ircc_init(void)
460{ 460{
461 int ret; 461 int ret;
462 462
463 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 463 IRDA_DEBUG(1, "%s\n", __func__);
464 464
465 ret = platform_driver_register(&smsc_ircc_driver); 465 ret = platform_driver_register(&smsc_ircc_driver);
466 if (ret) { 466 if (ret) {
@@ -500,7 +500,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
500 struct net_device *dev; 500 struct net_device *dev;
501 int err; 501 int err;
502 502
503 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 503 IRDA_DEBUG(1, "%s\n", __func__);
504 504
505 err = smsc_ircc_present(fir_base, sir_base); 505 err = smsc_ircc_present(fir_base, sir_base);
506 if (err) 506 if (err)
@@ -508,7 +508,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
508 508
509 err = -ENOMEM; 509 err = -ENOMEM;
510 if (dev_count >= ARRAY_SIZE(dev_self)) { 510 if (dev_count >= ARRAY_SIZE(dev_self)) {
511 IRDA_WARNING("%s(), too many devices!\n", __FUNCTION__); 511 IRDA_WARNING("%s(), too many devices!\n", __func__);
512 goto err_out1; 512 goto err_out1;
513 } 513 }
514 514
@@ -517,7 +517,7 @@ static int __init smsc_ircc_open(unsigned int fir_base, unsigned int sir_base, u
517 */ 517 */
518 dev = alloc_irdadev(sizeof(struct smsc_ircc_cb)); 518 dev = alloc_irdadev(sizeof(struct smsc_ircc_cb));
519 if (!dev) { 519 if (!dev) {
520 IRDA_WARNING("%s() can't allocate net device\n", __FUNCTION__); 520 IRDA_WARNING("%s() can't allocate net device\n", __func__);
521 goto err_out1; 521 goto err_out1;
522 } 522 }
523 523
@@ -633,14 +633,14 @@ static int smsc_ircc_present(unsigned int fir_base, unsigned int sir_base)
633 if (!request_region(fir_base, SMSC_IRCC2_FIR_CHIP_IO_EXTENT, 633 if (!request_region(fir_base, SMSC_IRCC2_FIR_CHIP_IO_EXTENT,
634 driver_name)) { 634 driver_name)) {
635 IRDA_WARNING("%s: can't get fir_base of 0x%03x\n", 635 IRDA_WARNING("%s: can't get fir_base of 0x%03x\n",
636 __FUNCTION__, fir_base); 636 __func__, fir_base);
637 goto out1; 637 goto out1;
638 } 638 }
639 639
640 if (!request_region(sir_base, SMSC_IRCC2_SIR_CHIP_IO_EXTENT, 640 if (!request_region(sir_base, SMSC_IRCC2_SIR_CHIP_IO_EXTENT,
641 driver_name)) { 641 driver_name)) {
642 IRDA_WARNING("%s: can't get sir_base of 0x%03x\n", 642 IRDA_WARNING("%s: can't get sir_base of 0x%03x\n",
643 __FUNCTION__, sir_base); 643 __func__, sir_base);
644 goto out2; 644 goto out2;
645 } 645 }
646 646
@@ -656,7 +656,7 @@ static int smsc_ircc_present(unsigned int fir_base, unsigned int sir_base)
656 656
657 if (high != 0x10 || low != 0xb8 || (chip != 0xf1 && chip != 0xf2)) { 657 if (high != 0x10 || low != 0xb8 || (chip != 0xf1 && chip != 0xf2)) {
658 IRDA_WARNING("%s(), addr 0x%04x - no device found!\n", 658 IRDA_WARNING("%s(), addr 0x%04x - no device found!\n",
659 __FUNCTION__, fir_base); 659 __func__, fir_base);
660 goto out3; 660 goto out3;
661 } 661 }
662 IRDA_MESSAGE("SMsC IrDA Controller found\n IrCC version %d.%d, " 662 IRDA_MESSAGE("SMsC IrDA Controller found\n IrCC version %d.%d, "
@@ -793,7 +793,7 @@ static int smsc_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd
793 793
794 IRDA_ASSERT(self != NULL, return -1;); 794 IRDA_ASSERT(self != NULL, return -1;);
795 795
796 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd); 796 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name, cmd);
797 797
798 switch (cmd) { 798 switch (cmd) {
799 case SIOCSBANDWIDTH: /* Set bandwidth */ 799 case SIOCSBANDWIDTH: /* Set bandwidth */
@@ -878,7 +878,7 @@ int smsc_ircc_hard_xmit_sir(struct sk_buff *skb, struct net_device *dev)
878 unsigned long flags; 878 unsigned long flags;
879 s32 speed; 879 s32 speed;
880 880
881 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 881 IRDA_DEBUG(1, "%s\n", __func__);
882 882
883 IRDA_ASSERT(dev != NULL, return 0;); 883 IRDA_ASSERT(dev != NULL, return 0;);
884 884
@@ -953,21 +953,21 @@ static void smsc_ircc_set_fir_speed(struct smsc_ircc_cb *self, u32 speed)
953 ir_mode = IRCC_CFGA_IRDA_HDLC; 953 ir_mode = IRCC_CFGA_IRDA_HDLC;
954 ctrl = IRCC_CRC; 954 ctrl = IRCC_CRC;
955 fast = 0; 955 fast = 0;
956 IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __FUNCTION__); 956 IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __func__);
957 break; 957 break;
958 case 1152000: 958 case 1152000:
959 ir_mode = IRCC_CFGA_IRDA_HDLC; 959 ir_mode = IRCC_CFGA_IRDA_HDLC;
960 ctrl = IRCC_1152 | IRCC_CRC; 960 ctrl = IRCC_1152 | IRCC_CRC;
961 fast = IRCC_LCR_A_FAST | IRCC_LCR_A_GP_DATA; 961 fast = IRCC_LCR_A_FAST | IRCC_LCR_A_GP_DATA;
962 IRDA_DEBUG(0, "%s(), handling baud of 1152000\n", 962 IRDA_DEBUG(0, "%s(), handling baud of 1152000\n",
963 __FUNCTION__); 963 __func__);
964 break; 964 break;
965 case 4000000: 965 case 4000000:
966 ir_mode = IRCC_CFGA_IRDA_4PPM; 966 ir_mode = IRCC_CFGA_IRDA_4PPM;
967 ctrl = IRCC_CRC; 967 ctrl = IRCC_CRC;
968 fast = IRCC_LCR_A_FAST; 968 fast = IRCC_LCR_A_FAST;
969 IRDA_DEBUG(0, "%s(), handling baud of 4000000\n", 969 IRDA_DEBUG(0, "%s(), handling baud of 4000000\n",
970 __FUNCTION__); 970 __func__);
971 break; 971 break;
972 } 972 }
973 #if 0 973 #if 0
@@ -995,7 +995,7 @@ static void smsc_ircc_fir_start(struct smsc_ircc_cb *self)
995 struct net_device *dev; 995 struct net_device *dev;
996 int fir_base; 996 int fir_base;
997 997
998 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 998 IRDA_DEBUG(1, "%s\n", __func__);
999 999
1000 IRDA_ASSERT(self != NULL, return;); 1000 IRDA_ASSERT(self != NULL, return;);
1001 dev = self->netdev; 1001 dev = self->netdev;
@@ -1043,7 +1043,7 @@ static void smsc_ircc_fir_stop(struct smsc_ircc_cb *self)
1043{ 1043{
1044 int fir_base; 1044 int fir_base;
1045 1045
1046 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 1046 IRDA_DEBUG(1, "%s\n", __func__);
1047 1047
1048 IRDA_ASSERT(self != NULL, return;); 1048 IRDA_ASSERT(self != NULL, return;);
1049 1049
@@ -1067,7 +1067,7 @@ static void smsc_ircc_change_speed(struct smsc_ircc_cb *self, u32 speed)
1067 struct net_device *dev; 1067 struct net_device *dev;
1068 int last_speed_was_sir; 1068 int last_speed_was_sir;
1069 1069
1070 IRDA_DEBUG(0, "%s() changing speed to: %d\n", __FUNCTION__, speed); 1070 IRDA_DEBUG(0, "%s() changing speed to: %d\n", __func__, speed);
1071 1071
1072 IRDA_ASSERT(self != NULL, return;); 1072 IRDA_ASSERT(self != NULL, return;);
1073 dev = self->netdev; 1073 dev = self->netdev;
@@ -1135,7 +1135,7 @@ void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
1135 int lcr; /* Line control reg */ 1135 int lcr; /* Line control reg */
1136 int divisor; 1136 int divisor;
1137 1137
1138 IRDA_DEBUG(0, "%s(), Setting speed to: %d\n", __FUNCTION__, speed); 1138 IRDA_DEBUG(0, "%s(), Setting speed to: %d\n", __func__, speed);
1139 1139
1140 IRDA_ASSERT(self != NULL, return;); 1140 IRDA_ASSERT(self != NULL, return;);
1141 iobase = self->io.sir_base; 1141 iobase = self->io.sir_base;
@@ -1170,7 +1170,7 @@ void smsc_ircc_set_sir_speed(struct smsc_ircc_cb *self, __u32 speed)
1170 /* Turn on interrups */ 1170 /* Turn on interrups */
1171 outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER); 1171 outb(UART_IER_RLSI | UART_IER_RDI | UART_IER_THRI, iobase + UART_IER);
1172 1172
1173 IRDA_DEBUG(2, "%s() speed changed to: %d\n", __FUNCTION__, speed); 1173 IRDA_DEBUG(2, "%s() speed changed to: %d\n", __func__, speed);
1174} 1174}
1175 1175
1176 1176
@@ -1253,7 +1253,7 @@ static void smsc_ircc_dma_xmit(struct smsc_ircc_cb *self, int bofs)
1253 int iobase = self->io.fir_base; 1253 int iobase = self->io.fir_base;
1254 u8 ctrl; 1254 u8 ctrl;
1255 1255
1256 IRDA_DEBUG(3, "%s\n", __FUNCTION__); 1256 IRDA_DEBUG(3, "%s\n", __func__);
1257#if 1 1257#if 1
1258 /* Disable Rx */ 1258 /* Disable Rx */
1259 register_bank(iobase, 0); 1259 register_bank(iobase, 0);
@@ -1307,7 +1307,7 @@ static void smsc_ircc_dma_xmit_complete(struct smsc_ircc_cb *self)
1307{ 1307{
1308 int iobase = self->io.fir_base; 1308 int iobase = self->io.fir_base;
1309 1309
1310 IRDA_DEBUG(3, "%s\n", __FUNCTION__); 1310 IRDA_DEBUG(3, "%s\n", __func__);
1311#if 0 1311#if 0
1312 /* Disable Tx */ 1312 /* Disable Tx */
1313 register_bank(iobase, 0); 1313 register_bank(iobase, 0);
@@ -1411,7 +1411,7 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
1411 1411
1412 register_bank(iobase, 0); 1412 register_bank(iobase, 0);
1413 1413
1414 IRDA_DEBUG(3, "%s\n", __FUNCTION__); 1414 IRDA_DEBUG(3, "%s\n", __func__);
1415#if 0 1415#if 0
1416 /* Disable Rx */ 1416 /* Disable Rx */
1417 register_bank(iobase, 0); 1417 register_bank(iobase, 0);
@@ -1422,7 +1422,7 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
1422 lsr= inb(iobase + IRCC_LSR); 1422 lsr= inb(iobase + IRCC_LSR);
1423 msgcnt = inb(iobase + IRCC_LCR_B) & 0x08; 1423 msgcnt = inb(iobase + IRCC_LCR_B) & 0x08;
1424 1424
1425 IRDA_DEBUG(2, "%s: dma count = %d\n", __FUNCTION__, 1425 IRDA_DEBUG(2, "%s: dma count = %d\n", __func__,
1426 get_dma_residue(self->io.dma)); 1426 get_dma_residue(self->io.dma));
1427 1427
1428 len = self->rx_buff.truesize - get_dma_residue(self->io.dma); 1428 len = self->rx_buff.truesize - get_dma_residue(self->io.dma);
@@ -1445,15 +1445,15 @@ static void smsc_ircc_dma_receive_complete(struct smsc_ircc_cb *self)
1445 len -= self->io.speed < 4000000 ? 2 : 4; 1445 len -= self->io.speed < 4000000 ? 2 : 4;
1446 1446
1447 if (len < 2 || len > 2050) { 1447 if (len < 2 || len > 2050) {
1448 IRDA_WARNING("%s(), bogus len=%d\n", __FUNCTION__, len); 1448 IRDA_WARNING("%s(), bogus len=%d\n", __func__, len);
1449 return; 1449 return;
1450 } 1450 }
1451 IRDA_DEBUG(2, "%s: msgcnt = %d, len=%d\n", __FUNCTION__, msgcnt, len); 1451 IRDA_DEBUG(2, "%s: msgcnt = %d, len=%d\n", __func__, msgcnt, len);
1452 1452
1453 skb = dev_alloc_skb(len + 1); 1453 skb = dev_alloc_skb(len + 1);
1454 if (!skb) { 1454 if (!skb) {
1455 IRDA_WARNING("%s(), memory squeeze, dropping frame.\n", 1455 IRDA_WARNING("%s(), memory squeeze, dropping frame.\n",
1456 __FUNCTION__); 1456 __func__);
1457 return; 1457 return;
1458 } 1458 }
1459 /* Make sure IP header gets aligned */ 1459 /* Make sure IP header gets aligned */
@@ -1494,7 +1494,7 @@ static void smsc_ircc_sir_receive(struct smsc_ircc_cb *self)
1494 1494
1495 /* Make sure we don't stay here to long */ 1495 /* Make sure we don't stay here to long */
1496 if (boguscount++ > 32) { 1496 if (boguscount++ > 32) {
1497 IRDA_DEBUG(2, "%s(), breaking!\n", __FUNCTION__); 1497 IRDA_DEBUG(2, "%s(), breaking!\n", __func__);
1498 break; 1498 break;
1499 } 1499 }
1500 } while (inb(iobase + UART_LSR) & UART_LSR_DR); 1500 } while (inb(iobase + UART_LSR) & UART_LSR_DR);
@@ -1536,7 +1536,7 @@ static irqreturn_t smsc_ircc_interrupt(int dummy, void *dev_id)
1536 lcra = inb(iobase + IRCC_LCR_A); 1536 lcra = inb(iobase + IRCC_LCR_A);
1537 lsr = inb(iobase + IRCC_LSR); 1537 lsr = inb(iobase + IRCC_LSR);
1538 1538
1539 IRDA_DEBUG(2, "%s(), iir = 0x%02x\n", __FUNCTION__, iir); 1539 IRDA_DEBUG(2, "%s(), iir = 0x%02x\n", __func__, iir);
1540 1540
1541 if (iir & IRCC_IIR_EOM) { 1541 if (iir & IRCC_IIR_EOM) {
1542 if (self->io.direction == IO_RECV) 1542 if (self->io.direction == IO_RECV)
@@ -1548,7 +1548,7 @@ static irqreturn_t smsc_ircc_interrupt(int dummy, void *dev_id)
1548 } 1548 }
1549 1549
1550 if (iir & IRCC_IIR_ACTIVE_FRAME) { 1550 if (iir & IRCC_IIR_ACTIVE_FRAME) {
1551 /*printk(KERN_WARNING "%s(): Active Frame\n", __FUNCTION__);*/ 1551 /*printk(KERN_WARNING "%s(): Active Frame\n", __func__);*/
1552 } 1552 }
1553 1553
1554 /* Enable interrupts again */ 1554 /* Enable interrupts again */
@@ -1587,11 +1587,11 @@ static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev)
1587 lsr = inb(iobase + UART_LSR); 1587 lsr = inb(iobase + UART_LSR);
1588 1588
1589 IRDA_DEBUG(4, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n", 1589 IRDA_DEBUG(4, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n",
1590 __FUNCTION__, iir, lsr, iobase); 1590 __func__, iir, lsr, iobase);
1591 1591
1592 switch (iir) { 1592 switch (iir) {
1593 case UART_IIR_RLSI: 1593 case UART_IIR_RLSI:
1594 IRDA_DEBUG(2, "%s(), RLSI\n", __FUNCTION__); 1594 IRDA_DEBUG(2, "%s(), RLSI\n", __func__);
1595 break; 1595 break;
1596 case UART_IIR_RDI: 1596 case UART_IIR_RDI:
1597 /* Receive interrupt */ 1597 /* Receive interrupt */
@@ -1604,7 +1604,7 @@ static irqreturn_t smsc_ircc_interrupt_sir(struct net_device *dev)
1604 break; 1604 break;
1605 default: 1605 default:
1606 IRDA_DEBUG(0, "%s(), unhandled IIR=%#x\n", 1606 IRDA_DEBUG(0, "%s(), unhandled IIR=%#x\n",
1607 __FUNCTION__, iir); 1607 __func__, iir);
1608 break; 1608 break;
1609 } 1609 }
1610 1610
@@ -1631,11 +1631,11 @@ static int ircc_is_receiving(struct smsc_ircc_cb *self)
1631 int status = FALSE; 1631 int status = FALSE;
1632 /* int iobase; */ 1632 /* int iobase; */
1633 1633
1634 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 1634 IRDA_DEBUG(1, "%s\n", __func__);
1635 1635
1636 IRDA_ASSERT(self != NULL, return FALSE;); 1636 IRDA_ASSERT(self != NULL, return FALSE;);
1637 1637
1638 IRDA_DEBUG(0, "%s: dma count = %d\n", __FUNCTION__, 1638 IRDA_DEBUG(0, "%s: dma count = %d\n", __func__,
1639 get_dma_residue(self->io.dma)); 1639 get_dma_residue(self->io.dma));
1640 1640
1641 status = (self->rx_buff.state != OUTSIDE_FRAME); 1641 status = (self->rx_buff.state != OUTSIDE_FRAME);
@@ -1652,7 +1652,7 @@ static int smsc_ircc_request_irq(struct smsc_ircc_cb *self)
1652 self->netdev->name, self->netdev); 1652 self->netdev->name, self->netdev);
1653 if (error) 1653 if (error)
1654 IRDA_DEBUG(0, "%s(), unable to allocate irq=%d, err=%d\n", 1654 IRDA_DEBUG(0, "%s(), unable to allocate irq=%d, err=%d\n",
1655 __FUNCTION__, self->io.irq, error); 1655 __func__, self->io.irq, error);
1656 1656
1657 return error; 1657 return error;
1658} 1658}
@@ -1696,21 +1696,21 @@ static int smsc_ircc_net_open(struct net_device *dev)
1696 struct smsc_ircc_cb *self; 1696 struct smsc_ircc_cb *self;
1697 char hwname[16]; 1697 char hwname[16];
1698 1698
1699 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 1699 IRDA_DEBUG(1, "%s\n", __func__);
1700 1700
1701 IRDA_ASSERT(dev != NULL, return -1;); 1701 IRDA_ASSERT(dev != NULL, return -1;);
1702 self = netdev_priv(dev); 1702 self = netdev_priv(dev);
1703 IRDA_ASSERT(self != NULL, return 0;); 1703 IRDA_ASSERT(self != NULL, return 0;);
1704 1704
1705 if (self->io.suspended) { 1705 if (self->io.suspended) {
1706 IRDA_DEBUG(0, "%s(), device is suspended\n", __FUNCTION__); 1706 IRDA_DEBUG(0, "%s(), device is suspended\n", __func__);
1707 return -EAGAIN; 1707 return -EAGAIN;
1708 } 1708 }
1709 1709
1710 if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name, 1710 if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name,
1711 (void *) dev)) { 1711 (void *) dev)) {
1712 IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n", 1712 IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n",
1713 __FUNCTION__, self->io.irq); 1713 __func__, self->io.irq);
1714 return -EAGAIN; 1714 return -EAGAIN;
1715 } 1715 }
1716 1716
@@ -1734,7 +1734,7 @@ static int smsc_ircc_net_open(struct net_device *dev)
1734 smsc_ircc_net_close(dev); 1734 smsc_ircc_net_close(dev);
1735 1735
1736 IRDA_WARNING("%s(), unable to allocate DMA=%d\n", 1736 IRDA_WARNING("%s(), unable to allocate DMA=%d\n",
1737 __FUNCTION__, self->io.dma); 1737 __func__, self->io.dma);
1738 return -EAGAIN; 1738 return -EAGAIN;
1739 } 1739 }
1740 1740
@@ -1753,7 +1753,7 @@ static int smsc_ircc_net_close(struct net_device *dev)
1753{ 1753{
1754 struct smsc_ircc_cb *self; 1754 struct smsc_ircc_cb *self;
1755 1755
1756 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 1756 IRDA_DEBUG(1, "%s\n", __func__);
1757 1757
1758 IRDA_ASSERT(dev != NULL, return -1;); 1758 IRDA_ASSERT(dev != NULL, return -1;);
1759 self = netdev_priv(dev); 1759 self = netdev_priv(dev);
@@ -1836,7 +1836,7 @@ static int smsc_ircc_resume(struct platform_device *dev)
1836 */ 1836 */
1837static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) 1837static int __exit smsc_ircc_close(struct smsc_ircc_cb *self)
1838{ 1838{
1839 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 1839 IRDA_DEBUG(1, "%s\n", __func__);
1840 1840
1841 IRDA_ASSERT(self != NULL, return -1;); 1841 IRDA_ASSERT(self != NULL, return -1;);
1842 1842
@@ -1848,12 +1848,12 @@ static int __exit smsc_ircc_close(struct smsc_ircc_cb *self)
1848 smsc_ircc_stop_interrupts(self); 1848 smsc_ircc_stop_interrupts(self);
1849 1849
1850 /* Release the PORTS that this driver is using */ 1850 /* Release the PORTS that this driver is using */
1851 IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __FUNCTION__, 1851 IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __func__,
1852 self->io.fir_base); 1852 self->io.fir_base);
1853 1853
1854 release_region(self->io.fir_base, self->io.fir_ext); 1854 release_region(self->io.fir_base, self->io.fir_ext);
1855 1855
1856 IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __FUNCTION__, 1856 IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __func__,
1857 self->io.sir_base); 1857 self->io.sir_base);
1858 1858
1859 release_region(self->io.sir_base, self->io.sir_ext); 1859 release_region(self->io.sir_base, self->io.sir_ext);
@@ -1875,7 +1875,7 @@ static void __exit smsc_ircc_cleanup(void)
1875{ 1875{
1876 int i; 1876 int i;
1877 1877
1878 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 1878 IRDA_DEBUG(1, "%s\n", __func__);
1879 1879
1880 for (i = 0; i < 2; i++) { 1880 for (i = 0; i < 2; i++) {
1881 if (dev_self[i]) 1881 if (dev_self[i])
@@ -1899,7 +1899,7 @@ void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
1899 struct net_device *dev; 1899 struct net_device *dev;
1900 int fir_base, sir_base; 1900 int fir_base, sir_base;
1901 1901
1902 IRDA_DEBUG(3, "%s\n", __FUNCTION__); 1902 IRDA_DEBUG(3, "%s\n", __func__);
1903 1903
1904 IRDA_ASSERT(self != NULL, return;); 1904 IRDA_ASSERT(self != NULL, return;);
1905 dev = self->netdev; 1905 dev = self->netdev;
@@ -1926,7 +1926,7 @@ void smsc_ircc_sir_start(struct smsc_ircc_cb *self)
1926 /* Turn on interrups */ 1926 /* Turn on interrups */
1927 outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, sir_base + UART_IER); 1927 outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, sir_base + UART_IER);
1928 1928
1929 IRDA_DEBUG(3, "%s() - exit\n", __FUNCTION__); 1929 IRDA_DEBUG(3, "%s() - exit\n", __func__);
1930 1930
1931 outb(0x00, fir_base + IRCC_MASTER); 1931 outb(0x00, fir_base + IRCC_MASTER);
1932} 1932}
@@ -1936,7 +1936,7 @@ void smsc_ircc_sir_stop(struct smsc_ircc_cb *self)
1936{ 1936{
1937 int iobase; 1937 int iobase;
1938 1938
1939 IRDA_DEBUG(3, "%s\n", __FUNCTION__); 1939 IRDA_DEBUG(3, "%s\n", __func__);
1940 iobase = self->io.sir_base; 1940 iobase = self->io.sir_base;
1941 1941
1942 /* Reset UART */ 1942 /* Reset UART */
@@ -1962,7 +1962,7 @@ static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self)
1962 1962
1963 IRDA_ASSERT(self != NULL, return;); 1963 IRDA_ASSERT(self != NULL, return;);
1964 1964
1965 IRDA_DEBUG(4, "%s\n", __FUNCTION__); 1965 IRDA_DEBUG(4, "%s\n", __func__);
1966 1966
1967 iobase = self->io.sir_base; 1967 iobase = self->io.sir_base;
1968 1968
@@ -1984,7 +1984,7 @@ static void smsc_ircc_sir_write_wakeup(struct smsc_ircc_cb *self)
1984 */ 1984 */
1985 if (self->new_speed) { 1985 if (self->new_speed) {
1986 IRDA_DEBUG(5, "%s(), Changing speed to %d.\n", 1986 IRDA_DEBUG(5, "%s(), Changing speed to %d.\n",
1987 __FUNCTION__, self->new_speed); 1987 __func__, self->new_speed);
1988 smsc_ircc_sir_wait_hw_transmitter_finish(self); 1988 smsc_ircc_sir_wait_hw_transmitter_finish(self);
1989 smsc_ircc_change_speed(self, self->new_speed); 1989 smsc_ircc_change_speed(self, self->new_speed);
1990 self->new_speed = 0; 1990 self->new_speed = 0;
@@ -2023,7 +2023,7 @@ static int smsc_ircc_sir_write(int iobase, int fifo_size, __u8 *buf, int len)
2023 2023
2024 /* Tx FIFO should be empty! */ 2024 /* Tx FIFO should be empty! */
2025 if (!(inb(iobase + UART_LSR) & UART_LSR_THRE)) { 2025 if (!(inb(iobase + UART_LSR) & UART_LSR_THRE)) {
2026 IRDA_WARNING("%s(), failed, fifo not empty!\n", __FUNCTION__); 2026 IRDA_WARNING("%s(), failed, fifo not empty!\n", __func__);
2027 return 0; 2027 return 0;
2028 } 2028 }
2029 2029
@@ -2123,7 +2123,7 @@ static void smsc_ircc_sir_wait_hw_transmitter_finish(struct smsc_ircc_cb *self)
2123 udelay(1); 2123 udelay(1);
2124 2124
2125 if (count == 0) 2125 if (count == 0)
2126 IRDA_DEBUG(0, "%s(): stuck transmitter\n", __FUNCTION__); 2126 IRDA_DEBUG(0, "%s(): stuck transmitter\n", __func__);
2127} 2127}
2128 2128
2129 2129
@@ -2145,7 +2145,7 @@ static int __init smsc_ircc_look_for_chips(void)
2145 while (address->cfg_base) { 2145 while (address->cfg_base) {
2146 cfg_base = address->cfg_base; 2146 cfg_base = address->cfg_base;
2147 2147
2148 /*printk(KERN_WARNING "%s(): probing: 0x%02x for: 0x%02x\n", __FUNCTION__, cfg_base, address->type);*/ 2148 /*printk(KERN_WARNING "%s(): probing: 0x%02x for: 0x%02x\n", __func__, cfg_base, address->type);*/
2149 2149
2150 if (address->type & SMSCSIO_TYPE_FDC) { 2150 if (address->type & SMSCSIO_TYPE_FDC) {
2151 type = "FDC"; 2151 type = "FDC";
@@ -2184,7 +2184,7 @@ static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned shor
2184 u8 mode, dma, irq; 2184 u8 mode, dma, irq;
2185 int ret = -ENODEV; 2185 int ret = -ENODEV;
2186 2186
2187 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 2187 IRDA_DEBUG(1, "%s\n", __func__);
2188 2188
2189 if (smsc_ircc_probe(cfgbase, SMSCSIOFLAT_DEVICEID_REG, chips, type) == NULL) 2189 if (smsc_ircc_probe(cfgbase, SMSCSIOFLAT_DEVICEID_REG, chips, type) == NULL)
2190 return ret; 2190 return ret;
@@ -2192,10 +2192,10 @@ static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned shor
2192 outb(SMSCSIOFLAT_UARTMODE0C_REG, cfgbase); 2192 outb(SMSCSIOFLAT_UARTMODE0C_REG, cfgbase);
2193 mode = inb(cfgbase + 1); 2193 mode = inb(cfgbase + 1);
2194 2194
2195 /*printk(KERN_WARNING "%s(): mode: 0x%02x\n", __FUNCTION__, mode);*/ 2195 /*printk(KERN_WARNING "%s(): mode: 0x%02x\n", __func__, mode);*/
2196 2196
2197 if (!(mode & SMSCSIOFLAT_UART2MODE_VAL_IRDA)) 2197 if (!(mode & SMSCSIOFLAT_UART2MODE_VAL_IRDA))
2198 IRDA_WARNING("%s(): IrDA not enabled\n", __FUNCTION__); 2198 IRDA_WARNING("%s(): IrDA not enabled\n", __func__);
2199 2199
2200 outb(SMSCSIOFLAT_UART2BASEADDR_REG, cfgbase); 2200 outb(SMSCSIOFLAT_UART2BASEADDR_REG, cfgbase);
2201 sirbase = inb(cfgbase + 1) << 2; 2201 sirbase = inb(cfgbase + 1) << 2;
@@ -2212,7 +2212,7 @@ static int __init smsc_superio_flat(const struct smsc_chip *chips, unsigned shor
2212 outb(SMSCSIOFLAT_UARTIRQSELECT_REG, cfgbase); 2212 outb(SMSCSIOFLAT_UARTIRQSELECT_REG, cfgbase);
2213 irq = inb(cfgbase + 1) & SMSCSIOFLAT_UART2IRQSELECT_MASK; 2213 irq = inb(cfgbase + 1) & SMSCSIOFLAT_UART2IRQSELECT_MASK;
2214 2214
2215 IRDA_MESSAGE("%s(): fir: 0x%02x, sir: 0x%02x, dma: %02d, irq: %d, mode: 0x%02x\n", __FUNCTION__, firbase, sirbase, dma, irq, mode); 2215 IRDA_MESSAGE("%s(): fir: 0x%02x, sir: 0x%02x, dma: %02d, irq: %d, mode: 0x%02x\n", __func__, firbase, sirbase, dma, irq, mode);
2216 2216
2217 if (firbase && smsc_ircc_open(firbase, sirbase, dma, irq) == 0) 2217 if (firbase && smsc_ircc_open(firbase, sirbase, dma, irq) == 0)
2218 ret = 0; 2218 ret = 0;
@@ -2234,7 +2234,7 @@ static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned sho
2234 unsigned short fir_io, sir_io; 2234 unsigned short fir_io, sir_io;
2235 int ret = -ENODEV; 2235 int ret = -ENODEV;
2236 2236
2237 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 2237 IRDA_DEBUG(1, "%s\n", __func__);
2238 2238
2239 if (smsc_ircc_probe(cfg_base, 0x20, chips, type) == NULL) 2239 if (smsc_ircc_probe(cfg_base, 0x20, chips, type) == NULL)
2240 return ret; 2240 return ret;
@@ -2268,7 +2268,7 @@ static int __init smsc_superio_paged(const struct smsc_chip *chips, unsigned sho
2268 2268
2269static int __init smsc_access(unsigned short cfg_base, unsigned char reg) 2269static int __init smsc_access(unsigned short cfg_base, unsigned char reg)
2270{ 2270{
2271 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 2271 IRDA_DEBUG(1, "%s\n", __func__);
2272 2272
2273 outb(reg, cfg_base); 2273 outb(reg, cfg_base);
2274 return inb(cfg_base) != reg ? -1 : 0; 2274 return inb(cfg_base) != reg ? -1 : 0;
@@ -2278,7 +2278,7 @@ static const struct smsc_chip * __init smsc_ircc_probe(unsigned short cfg_base,
2278{ 2278{
2279 u8 devid, xdevid, rev; 2279 u8 devid, xdevid, rev;
2280 2280
2281 IRDA_DEBUG(1, "%s\n", __FUNCTION__); 2281 IRDA_DEBUG(1, "%s\n", __func__);
2282 2282
2283 /* Leave configuration */ 2283 /* Leave configuration */
2284 2284
@@ -2353,7 +2353,7 @@ static int __init smsc_superio_fdc(unsigned short cfg_base)
2353 2353
2354 if (!request_region(cfg_base, 2, driver_name)) { 2354 if (!request_region(cfg_base, 2, driver_name)) {
2355 IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n", 2355 IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n",
2356 __FUNCTION__, cfg_base); 2356 __func__, cfg_base);
2357 } else { 2357 } else {
2358 if (!smsc_superio_flat(fdc_chips_flat, cfg_base, "FDC") || 2358 if (!smsc_superio_flat(fdc_chips_flat, cfg_base, "FDC") ||
2359 !smsc_superio_paged(fdc_chips_paged, cfg_base, "FDC")) 2359 !smsc_superio_paged(fdc_chips_paged, cfg_base, "FDC"))
@@ -2371,7 +2371,7 @@ static int __init smsc_superio_lpc(unsigned short cfg_base)
2371 2371
2372 if (!request_region(cfg_base, 2, driver_name)) { 2372 if (!request_region(cfg_base, 2, driver_name)) {
2373 IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n", 2373 IRDA_WARNING("%s: can't get cfg_base of 0x%03x\n",
2374 __FUNCTION__, cfg_base); 2374 __func__, cfg_base);
2375 } else { 2375 } else {
2376 if (!smsc_superio_flat(lpc_chips_flat, cfg_base, "LPC") || 2376 if (!smsc_superio_flat(lpc_chips_flat, cfg_base, "LPC") ||
2377 !smsc_superio_paged(lpc_chips_paged, cfg_base, "LPC")) 2377 !smsc_superio_paged(lpc_chips_paged, cfg_base, "LPC"))
@@ -2932,7 +2932,7 @@ static void smsc_ircc_set_transceiver_smsc_ircc_atc(int fir_base, u32 speed)
2932 /* empty */; 2932 /* empty */;
2933 2933
2934 if (val) 2934 if (val)
2935 IRDA_WARNING("%s(): ATC: 0x%02x\n", __FUNCTION__, 2935 IRDA_WARNING("%s(): ATC: 0x%02x\n", __func__,
2936 inb(fir_base + IRCC_ATC)); 2936 inb(fir_base + IRCC_ATC));
2937} 2937}
2938 2938
diff --git a/drivers/net/irda/tekram-sir.c b/drivers/net/irda/tekram-sir.c
index d1ce5ae6a172..048a15422844 100644
--- a/drivers/net/irda/tekram-sir.c
+++ b/drivers/net/irda/tekram-sir.c
@@ -77,7 +77,7 @@ static int tekram_open(struct sir_dev *dev)
77{ 77{
78 struct qos_info *qos = &dev->qos; 78 struct qos_info *qos = &dev->qos;
79 79
80 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 80 IRDA_DEBUG(2, "%s()\n", __func__);
81 81
82 sirdev_set_dtr_rts(dev, TRUE, TRUE); 82 sirdev_set_dtr_rts(dev, TRUE, TRUE);
83 83
@@ -92,7 +92,7 @@ static int tekram_open(struct sir_dev *dev)
92 92
93static int tekram_close(struct sir_dev *dev) 93static int tekram_close(struct sir_dev *dev)
94{ 94{
95 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 95 IRDA_DEBUG(2, "%s()\n", __func__);
96 96
97 /* Power off dongle */ 97 /* Power off dongle */
98 sirdev_set_dtr_rts(dev, FALSE, FALSE); 98 sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -130,7 +130,7 @@ static int tekram_change_speed(struct sir_dev *dev, unsigned speed)
130 u8 byte; 130 u8 byte;
131 static int ret = 0; 131 static int ret = 0;
132 132
133 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 133 IRDA_DEBUG(2, "%s()\n", __func__);
134 134
135 switch(state) { 135 switch(state) {
136 case SIRDEV_STATE_DONGLE_SPEED: 136 case SIRDEV_STATE_DONGLE_SPEED:
@@ -179,7 +179,7 @@ static int tekram_change_speed(struct sir_dev *dev, unsigned speed)
179 break; 179 break;
180 180
181 default: 181 default:
182 IRDA_ERROR("%s - undefined state %d\n", __FUNCTION__, state); 182 IRDA_ERROR("%s - undefined state %d\n", __func__, state);
183 ret = -EINVAL; 183 ret = -EINVAL;
184 break; 184 break;
185 } 185 }
@@ -204,7 +204,7 @@ static int tekram_change_speed(struct sir_dev *dev, unsigned speed)
204 204
205static int tekram_reset(struct sir_dev *dev) 205static int tekram_reset(struct sir_dev *dev)
206{ 206{
207 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 207 IRDA_DEBUG(2, "%s()\n", __func__);
208 208
209 /* Clear DTR, Set RTS */ 209 /* Clear DTR, Set RTS */
210 sirdev_set_dtr_rts(dev, FALSE, TRUE); 210 sirdev_set_dtr_rts(dev, FALSE, TRUE);
diff --git a/drivers/net/irda/toim3232-sir.c b/drivers/net/irda/toim3232-sir.c
index aa1a9b0ed83e..fcf287b749db 100644
--- a/drivers/net/irda/toim3232-sir.c
+++ b/drivers/net/irda/toim3232-sir.c
@@ -181,7 +181,7 @@ static int toim3232_open(struct sir_dev *dev)
181{ 181{
182 struct qos_info *qos = &dev->qos; 182 struct qos_info *qos = &dev->qos;
183 183
184 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 184 IRDA_DEBUG(2, "%s()\n", __func__);
185 185
186 /* Pull the lines high to start with. 186 /* Pull the lines high to start with.
187 * 187 *
@@ -209,7 +209,7 @@ static int toim3232_open(struct sir_dev *dev)
209 209
210static int toim3232_close(struct sir_dev *dev) 210static int toim3232_close(struct sir_dev *dev)
211{ 211{
212 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 212 IRDA_DEBUG(2, "%s()\n", __func__);
213 213
214 /* Power off dongle */ 214 /* Power off dongle */
215 sirdev_set_dtr_rts(dev, FALSE, FALSE); 215 sirdev_set_dtr_rts(dev, FALSE, FALSE);
@@ -241,7 +241,7 @@ static int toim3232_change_speed(struct sir_dev *dev, unsigned speed)
241 u8 byte; 241 u8 byte;
242 static int ret = 0; 242 static int ret = 0;
243 243
244 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 244 IRDA_DEBUG(2, "%s()\n", __func__);
245 245
246 switch(state) { 246 switch(state) {
247 case SIRDEV_STATE_DONGLE_SPEED: 247 case SIRDEV_STATE_DONGLE_SPEED:
@@ -299,7 +299,7 @@ static int toim3232_change_speed(struct sir_dev *dev, unsigned speed)
299 break; 299 break;
300 300
301 default: 301 default:
302 printk(KERN_ERR "%s - undefined state %d\n", __FUNCTION__, state); 302 printk(KERN_ERR "%s - undefined state %d\n", __func__, state);
303 ret = -EINVAL; 303 ret = -EINVAL;
304 break; 304 break;
305 } 305 }
@@ -344,7 +344,7 @@ static int toim3232_change_speed(struct sir_dev *dev, unsigned speed)
344 344
345static int toim3232_reset(struct sir_dev *dev) 345static int toim3232_reset(struct sir_dev *dev)
346{ 346{
347 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 347 IRDA_DEBUG(2, "%s()\n", __func__);
348 348
349 /* Switch off both DTR and RTS to switch off dongle */ 349 /* Switch off both DTR and RTS to switch off dongle */
350 sirdev_set_dtr_rts(dev, FALSE, FALSE); 350 sirdev_set_dtr_rts(dev, FALSE, FALSE);
diff --git a/drivers/net/irda/via-ircc.c b/drivers/net/irda/via-ircc.c
index 04ad3573b159..84e609ea5fbb 100644
--- a/drivers/net/irda/via-ircc.c
+++ b/drivers/net/irda/via-ircc.c
@@ -152,12 +152,12 @@ static int __init via_ircc_init(void)
152{ 152{
153 int rc; 153 int rc;
154 154
155 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 155 IRDA_DEBUG(3, "%s()\n", __func__);
156 156
157 rc = pci_register_driver(&via_driver); 157 rc = pci_register_driver(&via_driver);
158 if (rc < 0) { 158 if (rc < 0) {
159 IRDA_DEBUG(0, "%s(): error rc = %d, returning -ENODEV...\n", 159 IRDA_DEBUG(0, "%s(): error rc = %d, returning -ENODEV...\n",
160 __FUNCTION__, rc); 160 __func__, rc);
161 return -ENODEV; 161 return -ENODEV;
162 } 162 }
163 return 0; 163 return 0;
@@ -170,11 +170,11 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
170 u16 Chipset,FirDRQ1,FirDRQ0,FirIRQ,FirIOBase; 170 u16 Chipset,FirDRQ1,FirDRQ0,FirIRQ,FirIOBase;
171 chipio_t info; 171 chipio_t info;
172 172
173 IRDA_DEBUG(2, "%s(): Device ID=(0X%X)\n", __FUNCTION__, id->device); 173 IRDA_DEBUG(2, "%s(): Device ID=(0X%X)\n", __func__, id->device);
174 174
175 rc = pci_enable_device (pcidev); 175 rc = pci_enable_device (pcidev);
176 if (rc) { 176 if (rc) {
177 IRDA_DEBUG(0, "%s(): error rc = %d\n", __FUNCTION__, rc); 177 IRDA_DEBUG(0, "%s(): error rc = %d\n", __func__, rc);
178 return -ENODEV; 178 return -ENODEV;
179 } 179 }
180 180
@@ -185,7 +185,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
185 Chipset=0x3076; 185 Chipset=0x3076;
186 186
187 if (Chipset==0x3076) { 187 if (Chipset==0x3076) {
188 IRDA_DEBUG(2, "%s(): Chipset = 3076\n", __FUNCTION__); 188 IRDA_DEBUG(2, "%s(): Chipset = 3076\n", __func__);
189 189
190 WriteLPCReg(7,0x0c ); 190 WriteLPCReg(7,0x0c );
191 temp=ReadLPCReg(0x30);//check if BIOS Enable Fir 191 temp=ReadLPCReg(0x30);//check if BIOS Enable Fir
@@ -222,7 +222,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
222 } else 222 } else
223 rc = -ENODEV; //IR not turn on 223 rc = -ENODEV; //IR not turn on
224 } else { //Not VT1211 224 } else { //Not VT1211
225 IRDA_DEBUG(2, "%s(): Chipset = 3096\n", __FUNCTION__); 225 IRDA_DEBUG(2, "%s(): Chipset = 3096\n", __func__);
226 226
227 pci_read_config_byte(pcidev,0x67,&bTmp);//check if BIOS Enable Fir 227 pci_read_config_byte(pcidev,0x67,&bTmp);//check if BIOS Enable Fir
228 if((bTmp&0x01)==1) { // BIOS enable FIR 228 if((bTmp&0x01)==1) { // BIOS enable FIR
@@ -262,7 +262,7 @@ static int __devinit via_init_one (struct pci_dev *pcidev, const struct pci_devi
262 rc = -ENODEV; //IR not turn on !!!!! 262 rc = -ENODEV; //IR not turn on !!!!!
263 }//Not VT1211 263 }//Not VT1211
264 264
265 IRDA_DEBUG(2, "%s(): End - rc = %d\n", __FUNCTION__, rc); 265 IRDA_DEBUG(2, "%s(): End - rc = %d\n", __func__, rc);
266 return rc; 266 return rc;
267} 267}
268 268
@@ -276,7 +276,7 @@ static void via_ircc_clean(void)
276{ 276{
277 int i; 277 int i;
278 278
279 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 279 IRDA_DEBUG(3, "%s()\n", __func__);
280 280
281 for (i=0; i < ARRAY_SIZE(dev_self); i++) { 281 for (i=0; i < ARRAY_SIZE(dev_self); i++) {
282 if (dev_self[i]) 282 if (dev_self[i])
@@ -286,7 +286,7 @@ static void via_ircc_clean(void)
286 286
287static void __devexit via_remove_one (struct pci_dev *pdev) 287static void __devexit via_remove_one (struct pci_dev *pdev)
288{ 288{
289 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 289 IRDA_DEBUG(3, "%s()\n", __func__);
290 290
291 /* FIXME : This is ugly. We should use pci_get_drvdata(pdev); 291 /* FIXME : This is ugly. We should use pci_get_drvdata(pdev);
292 * to get our driver instance and call directly via_ircc_close(). 292 * to get our driver instance and call directly via_ircc_close().
@@ -301,7 +301,7 @@ static void __devexit via_remove_one (struct pci_dev *pdev)
301 301
302static void __exit via_ircc_cleanup(void) 302static void __exit via_ircc_cleanup(void)
303{ 303{
304 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 304 IRDA_DEBUG(3, "%s()\n", __func__);
305 305
306 /* FIXME : This should be redundant, as pci_unregister_driver() 306 /* FIXME : This should be redundant, as pci_unregister_driver()
307 * should call via_remove_one() on each device. 307 * should call via_remove_one() on each device.
@@ -324,7 +324,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
324 struct via_ircc_cb *self; 324 struct via_ircc_cb *self;
325 int err; 325 int err;
326 326
327 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 327 IRDA_DEBUG(3, "%s()\n", __func__);
328 328
329 if (i >= ARRAY_SIZE(dev_self)) 329 if (i >= ARRAY_SIZE(dev_self))
330 return -ENOMEM; 330 return -ENOMEM;
@@ -360,7 +360,7 @@ static __devinit int via_ircc_open(int i, chipio_t * info, unsigned int id)
360 /* Reserve the ioports that we need */ 360 /* Reserve the ioports that we need */
361 if (!request_region(self->io.fir_base, self->io.fir_ext, driver_name)) { 361 if (!request_region(self->io.fir_base, self->io.fir_ext, driver_name)) {
362 IRDA_DEBUG(0, "%s(), can't get iobase of 0x%03x\n", 362 IRDA_DEBUG(0, "%s(), can't get iobase of 0x%03x\n",
363 __FUNCTION__, self->io.fir_base); 363 __func__, self->io.fir_base);
364 err = -ENODEV; 364 err = -ENODEV;
365 goto err_out1; 365 goto err_out1;
366 } 366 }
@@ -471,7 +471,7 @@ static int via_ircc_close(struct via_ircc_cb *self)
471{ 471{
472 int iobase; 472 int iobase;
473 473
474 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 474 IRDA_DEBUG(3, "%s()\n", __func__);
475 475
476 IRDA_ASSERT(self != NULL, return -1;); 476 IRDA_ASSERT(self != NULL, return -1;);
477 477
@@ -483,7 +483,7 @@ static int via_ircc_close(struct via_ircc_cb *self)
483 483
484 /* Release the PORT that this driver is using */ 484 /* Release the PORT that this driver is using */
485 IRDA_DEBUG(2, "%s(), Releasing Region %03x\n", 485 IRDA_DEBUG(2, "%s(), Releasing Region %03x\n",
486 __FUNCTION__, self->io.fir_base); 486 __func__, self->io.fir_base);
487 release_region(self->io.fir_base, self->io.fir_ext); 487 release_region(self->io.fir_base, self->io.fir_ext);
488 if (self->tx_buff.head) 488 if (self->tx_buff.head)
489 dma_free_coherent(NULL, self->tx_buff.truesize, 489 dma_free_coherent(NULL, self->tx_buff.truesize,
@@ -509,7 +509,7 @@ static void via_hw_init(struct via_ircc_cb *self)
509{ 509{
510 int iobase = self->io.fir_base; 510 int iobase = self->io.fir_base;
511 511
512 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 512 IRDA_DEBUG(3, "%s()\n", __func__);
513 513
514 SetMaxRxPacketSize(iobase, 0x0fff); //set to max:4095 514 SetMaxRxPacketSize(iobase, 0x0fff); //set to max:4095
515 // FIFO Init 515 // FIFO Init
@@ -582,7 +582,7 @@ static void via_ircc_change_dongle_speed(int iobase, int speed,
582 speed = speed; 582 speed = speed;
583 583
584 IRDA_DEBUG(1, "%s(): change_dongle_speed to %d for 0x%x, %d\n", 584 IRDA_DEBUG(1, "%s(): change_dongle_speed to %d for 0x%x, %d\n",
585 __FUNCTION__, speed, iobase, dongle_id); 585 __func__, speed, iobase, dongle_id);
586 586
587 switch (dongle_id) { 587 switch (dongle_id) {
588 588
@@ -671,7 +671,7 @@ static void via_ircc_change_dongle_speed(int iobase, int speed,
671 671
672 case 0x11: /* Temic TFDS4500 */ 672 case 0x11: /* Temic TFDS4500 */
673 673
674 IRDA_DEBUG(2, "%s: Temic TFDS4500: One RX pin, TX normal, RX inverted.\n", __FUNCTION__); 674 IRDA_DEBUG(2, "%s: Temic TFDS4500: One RX pin, TX normal, RX inverted.\n", __func__);
675 675
676 UseOneRX(iobase, ON); //use ONE RX....RX1 676 UseOneRX(iobase, ON); //use ONE RX....RX1
677 InvertTX(iobase, OFF); 677 InvertTX(iobase, OFF);
@@ -689,7 +689,7 @@ static void via_ircc_change_dongle_speed(int iobase, int speed,
689 SlowIRRXLowActive(iobase, OFF); 689 SlowIRRXLowActive(iobase, OFF);
690 690
691 } else{ 691 } else{
692 IRDA_DEBUG(0, "%s: Warning: TFDS4500 not running in SIR mode !\n", __FUNCTION__); 692 IRDA_DEBUG(0, "%s: Warning: TFDS4500 not running in SIR mode !\n", __func__);
693 } 693 }
694 break; 694 break;
695 695
@@ -707,7 +707,7 @@ static void via_ircc_change_dongle_speed(int iobase, int speed,
707 707
708 default: 708 default:
709 IRDA_ERROR("%s: Error: dongle_id %d unsupported !\n", 709 IRDA_ERROR("%s: Error: dongle_id %d unsupported !\n",
710 __FUNCTION__, dongle_id); 710 __func__, dongle_id);
711 } 711 }
712} 712}
713 713
@@ -726,7 +726,7 @@ static void via_ircc_change_speed(struct via_ircc_cb *self, __u32 speed)
726 iobase = self->io.fir_base; 726 iobase = self->io.fir_base;
727 /* Update accounting for new speed */ 727 /* Update accounting for new speed */
728 self->io.speed = speed; 728 self->io.speed = speed;
729 IRDA_DEBUG(1, "%s: change_speed to %d bps.\n", __FUNCTION__, speed); 729 IRDA_DEBUG(1, "%s: change_speed to %d bps.\n", __func__, speed);
730 730
731 WriteReg(iobase, I_ST_CT_0, 0x0); 731 WriteReg(iobase, I_ST_CT_0, 0x0);
732 732
@@ -957,7 +957,7 @@ static int via_ircc_dma_xmit(struct via_ircc_cb *self, u16 iobase)
957 self->tx_buff.head) + self->tx_buff_dma, 957 self->tx_buff.head) + self->tx_buff_dma,
958 self->tx_fifo.queue[self->tx_fifo.ptr].len, DMA_TX_MODE); 958 self->tx_fifo.queue[self->tx_fifo.ptr].len, DMA_TX_MODE);
959 IRDA_DEBUG(1, "%s: tx_fifo.ptr=%x,len=%x,tx_fifo.len=%x..\n", 959 IRDA_DEBUG(1, "%s: tx_fifo.ptr=%x,len=%x,tx_fifo.len=%x..\n",
960 __FUNCTION__, self->tx_fifo.ptr, 960 __func__, self->tx_fifo.ptr,
961 self->tx_fifo.queue[self->tx_fifo.ptr].len, 961 self->tx_fifo.queue[self->tx_fifo.ptr].len,
962 self->tx_fifo.len); 962 self->tx_fifo.len);
963 963
@@ -981,7 +981,7 @@ static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self)
981 int ret = TRUE; 981 int ret = TRUE;
982 u8 Tx_status; 982 u8 Tx_status;
983 983
984 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 984 IRDA_DEBUG(3, "%s()\n", __func__);
985 985
986 iobase = self->io.fir_base; 986 iobase = self->io.fir_base;
987 /* Disable DMA */ 987 /* Disable DMA */
@@ -1014,7 +1014,7 @@ static int via_ircc_dma_xmit_complete(struct via_ircc_cb *self)
1014 } 1014 }
1015 IRDA_DEBUG(1, 1015 IRDA_DEBUG(1,
1016 "%s: tx_fifo.len=%x ,tx_fifo.ptr=%x,tx_fifo.free=%x...\n", 1016 "%s: tx_fifo.len=%x ,tx_fifo.ptr=%x,tx_fifo.free=%x...\n",
1017 __FUNCTION__, 1017 __func__,
1018 self->tx_fifo.len, self->tx_fifo.ptr, self->tx_fifo.free); 1018 self->tx_fifo.len, self->tx_fifo.ptr, self->tx_fifo.free);
1019/* F01_S 1019/* F01_S
1020 // Any frames to be sent back-to-back? 1020 // Any frames to be sent back-to-back?
@@ -1050,7 +1050,7 @@ static int via_ircc_dma_receive(struct via_ircc_cb *self)
1050 1050
1051 iobase = self->io.fir_base; 1051 iobase = self->io.fir_base;
1052 1052
1053 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 1053 IRDA_DEBUG(3, "%s()\n", __func__);
1054 1054
1055 self->tx_fifo.len = self->tx_fifo.ptr = self->tx_fifo.free = 0; 1055 self->tx_fifo.len = self->tx_fifo.ptr = self->tx_fifo.free = 0;
1056 self->tx_fifo.tail = self->tx_buff.head; 1056 self->tx_fifo.tail = self->tx_buff.head;
@@ -1134,13 +1134,13 @@ static int via_ircc_dma_receive_complete(struct via_ircc_cb *self,
1134 return TRUE; //interrupt only, data maybe move by RxT 1134 return TRUE; //interrupt only, data maybe move by RxT
1135 if (((len - 4) < 2) || ((len - 4) > 2048)) { 1135 if (((len - 4) < 2) || ((len - 4) > 2048)) {
1136 IRDA_DEBUG(1, "%s(): Trouble:len=%x,CurCount=%x,LastCount=%x..\n", 1136 IRDA_DEBUG(1, "%s(): Trouble:len=%x,CurCount=%x,LastCount=%x..\n",
1137 __FUNCTION__, len, RxCurCount(iobase, self), 1137 __func__, len, RxCurCount(iobase, self),
1138 self->RxLastCount); 1138 self->RxLastCount);
1139 hwreset(self); 1139 hwreset(self);
1140 return FALSE; 1140 return FALSE;
1141 } 1141 }
1142 IRDA_DEBUG(2, "%s(): fifo.len=%x,len=%x,CurCount=%x..\n", 1142 IRDA_DEBUG(2, "%s(): fifo.len=%x,len=%x,CurCount=%x..\n",
1143 __FUNCTION__, 1143 __func__,
1144 st_fifo->len, len - 4, RxCurCount(iobase, self)); 1144 st_fifo->len, len - 4, RxCurCount(iobase, self));
1145 1145
1146 st_fifo->entries[st_fifo->tail].status = status; 1146 st_fifo->entries[st_fifo->tail].status = status;
@@ -1187,7 +1187,7 @@ F01_E */
1187 skb_put(skb, len - 4); 1187 skb_put(skb, len - 4);
1188 1188
1189 skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4); 1189 skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4);
1190 IRDA_DEBUG(2, "%s(): len=%x.rx_buff=%p\n", __FUNCTION__, 1190 IRDA_DEBUG(2, "%s(): len=%x.rx_buff=%p\n", __func__,
1191 len - 4, self->rx_buff.data); 1191 len - 4, self->rx_buff.data);
1192 1192
1193 // Move to next frame 1193 // Move to next frame
@@ -1217,7 +1217,7 @@ static int upload_rxdata(struct via_ircc_cb *self, int iobase)
1217 1217
1218 len = GetRecvByte(iobase, self); 1218 len = GetRecvByte(iobase, self);
1219 1219
1220 IRDA_DEBUG(2, "%s(): len=%x\n", __FUNCTION__, len); 1220 IRDA_DEBUG(2, "%s(): len=%x\n", __func__, len);
1221 1221
1222 if ((len - 4) < 2) { 1222 if ((len - 4) < 2) {
1223 self->stats.rx_dropped++; 1223 self->stats.rx_dropped++;
@@ -1302,7 +1302,7 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
1302 skb_put(skb, len - 4); 1302 skb_put(skb, len - 4);
1303 skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4); 1303 skb_copy_to_linear_data(skb, self->rx_buff.data, len - 4);
1304 1304
1305 IRDA_DEBUG(2, "%s(): len=%x.head=%x\n", __FUNCTION__, 1305 IRDA_DEBUG(2, "%s(): len=%x.head=%x\n", __func__,
1306 len - 4, st_fifo->head); 1306 len - 4, st_fifo->head);
1307 1307
1308 // Move to next frame 1308 // Move to next frame
@@ -1318,7 +1318,7 @@ static int RxTimerHandler(struct via_ircc_cb *self, int iobase)
1318 1318
1319 IRDA_DEBUG(2, 1319 IRDA_DEBUG(2,
1320 "%s(): End of upload HostStatus=%x,RxStatus=%x\n", 1320 "%s(): End of upload HostStatus=%x,RxStatus=%x\n",
1321 __FUNCTION__, 1321 __func__,
1322 GetHostStatus(iobase), GetRXStatus(iobase)); 1322 GetHostStatus(iobase), GetRXStatus(iobase));
1323 1323
1324 /* 1324 /*
@@ -1358,7 +1358,7 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
1358 iHostIntType = GetHostStatus(iobase); 1358 iHostIntType = GetHostStatus(iobase);
1359 1359
1360 IRDA_DEBUG(4, "%s(): iHostIntType %02x: %s %s %s %02x\n", 1360 IRDA_DEBUG(4, "%s(): iHostIntType %02x: %s %s %s %02x\n",
1361 __FUNCTION__, iHostIntType, 1361 __func__, iHostIntType,
1362 (iHostIntType & 0x40) ? "Timer" : "", 1362 (iHostIntType & 0x40) ? "Timer" : "",
1363 (iHostIntType & 0x20) ? "Tx" : "", 1363 (iHostIntType & 0x20) ? "Tx" : "",
1364 (iHostIntType & 0x10) ? "Rx" : "", 1364 (iHostIntType & 0x10) ? "Rx" : "",
@@ -1388,7 +1388,7 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
1388 iTxIntType = GetTXStatus(iobase); 1388 iTxIntType = GetTXStatus(iobase);
1389 1389
1390 IRDA_DEBUG(4, "%s(): iTxIntType %02x: %s %s %s %s\n", 1390 IRDA_DEBUG(4, "%s(): iTxIntType %02x: %s %s %s %s\n",
1391 __FUNCTION__, iTxIntType, 1391 __func__, iTxIntType,
1392 (iTxIntType & 0x08) ? "FIFO underr." : "", 1392 (iTxIntType & 0x08) ? "FIFO underr." : "",
1393 (iTxIntType & 0x04) ? "EOM" : "", 1393 (iTxIntType & 0x04) ? "EOM" : "",
1394 (iTxIntType & 0x02) ? "FIFO ready" : "", 1394 (iTxIntType & 0x02) ? "FIFO ready" : "",
@@ -1412,7 +1412,7 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
1412 iRxIntType = GetRXStatus(iobase); 1412 iRxIntType = GetRXStatus(iobase);
1413 1413
1414 IRDA_DEBUG(4, "%s(): iRxIntType %02x: %s %s %s %s %s %s %s\n", 1414 IRDA_DEBUG(4, "%s(): iRxIntType %02x: %s %s %s %s %s %s %s\n",
1415 __FUNCTION__, iRxIntType, 1415 __func__, iRxIntType,
1416 (iRxIntType & 0x80) ? "PHY err." : "", 1416 (iRxIntType & 0x80) ? "PHY err." : "",
1417 (iRxIntType & 0x40) ? "CRC err" : "", 1417 (iRxIntType & 0x40) ? "CRC err" : "",
1418 (iRxIntType & 0x20) ? "FIFO overr." : "", 1418 (iRxIntType & 0x20) ? "FIFO overr." : "",
@@ -1421,7 +1421,7 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
1421 (iRxIntType & 0x02) ? "RxMaxLen" : "", 1421 (iRxIntType & 0x02) ? "RxMaxLen" : "",
1422 (iRxIntType & 0x01) ? "SIR bad" : ""); 1422 (iRxIntType & 0x01) ? "SIR bad" : "");
1423 if (!iRxIntType) 1423 if (!iRxIntType)
1424 IRDA_DEBUG(3, "%s(): RxIRQ =0\n", __FUNCTION__); 1424 IRDA_DEBUG(3, "%s(): RxIRQ =0\n", __func__);
1425 1425
1426 if (iRxIntType & 0x10) { 1426 if (iRxIntType & 0x10) {
1427 if (via_ircc_dma_receive_complete(self, iobase)) { 1427 if (via_ircc_dma_receive_complete(self, iobase)) {
@@ -1431,7 +1431,7 @@ static irqreturn_t via_ircc_interrupt(int dummy, void *dev_id)
1431 } // No ERR 1431 } // No ERR
1432 else { //ERR 1432 else { //ERR
1433 IRDA_DEBUG(4, "%s(): RxIRQ ERR:iRxIntType=%x,HostIntType=%x,CurCount=%x,RxLastCount=%x_____\n", 1433 IRDA_DEBUG(4, "%s(): RxIRQ ERR:iRxIntType=%x,HostIntType=%x,CurCount=%x,RxLastCount=%x_____\n",
1434 __FUNCTION__, iRxIntType, iHostIntType, 1434 __func__, iRxIntType, iHostIntType,
1435 RxCurCount(iobase, self), 1435 RxCurCount(iobase, self),
1436 self->RxLastCount); 1436 self->RxLastCount);
1437 1437
@@ -1456,7 +1456,7 @@ static void hwreset(struct via_ircc_cb *self)
1456 int iobase; 1456 int iobase;
1457 iobase = self->io.fir_base; 1457 iobase = self->io.fir_base;
1458 1458
1459 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 1459 IRDA_DEBUG(3, "%s()\n", __func__);
1460 1460
1461 ResetChip(iobase, 5); 1461 ResetChip(iobase, 5);
1462 EnableDMA(iobase, OFF); 1462 EnableDMA(iobase, OFF);
@@ -1501,7 +1501,7 @@ static int via_ircc_is_receiving(struct via_ircc_cb *self)
1501 if (CkRxRecv(iobase, self)) 1501 if (CkRxRecv(iobase, self))
1502 status = TRUE; 1502 status = TRUE;
1503 1503
1504 IRDA_DEBUG(2, "%s(): status=%x....\n", __FUNCTION__, status); 1504 IRDA_DEBUG(2, "%s(): status=%x....\n", __func__, status);
1505 1505
1506 return status; 1506 return status;
1507} 1507}
@@ -1519,7 +1519,7 @@ static int via_ircc_net_open(struct net_device *dev)
1519 int iobase; 1519 int iobase;
1520 char hwname[32]; 1520 char hwname[32];
1521 1521
1522 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 1522 IRDA_DEBUG(3, "%s()\n", __func__);
1523 1523
1524 IRDA_ASSERT(dev != NULL, return -1;); 1524 IRDA_ASSERT(dev != NULL, return -1;);
1525 self = (struct via_ircc_cb *) dev->priv; 1525 self = (struct via_ircc_cb *) dev->priv;
@@ -1586,7 +1586,7 @@ static int via_ircc_net_close(struct net_device *dev)
1586 struct via_ircc_cb *self; 1586 struct via_ircc_cb *self;
1587 int iobase; 1587 int iobase;
1588 1588
1589 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 1589 IRDA_DEBUG(3, "%s()\n", __func__);
1590 1590
1591 IRDA_ASSERT(dev != NULL, return -1;); 1591 IRDA_ASSERT(dev != NULL, return -1;);
1592 self = (struct via_ircc_cb *) dev->priv; 1592 self = (struct via_ircc_cb *) dev->priv;
@@ -1630,7 +1630,7 @@ static int via_ircc_net_ioctl(struct net_device *dev, struct ifreq *rq,
1630 IRDA_ASSERT(dev != NULL, return -1;); 1630 IRDA_ASSERT(dev != NULL, return -1;);
1631 self = dev->priv; 1631 self = dev->priv;
1632 IRDA_ASSERT(self != NULL, return -1;); 1632 IRDA_ASSERT(self != NULL, return -1;);
1633 IRDA_DEBUG(1, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, 1633 IRDA_DEBUG(1, "%s(), %s, (cmd=0x%X)\n", __func__, dev->name,
1634 cmd); 1634 cmd);
1635 /* Disable interrupts & save flags */ 1635 /* Disable interrupts & save flags */
1636 spin_lock_irqsave(&self->lock, flags); 1636 spin_lock_irqsave(&self->lock, flags);
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index d15e00b8591e..18f4b3a96aed 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -140,15 +140,15 @@ static void vlsi_ring_debug(struct vlsi_ring *r)
140 unsigned i; 140 unsigned i;
141 141
142 printk(KERN_DEBUG "%s - ring %p / size %u / mask 0x%04x / len %u / dir %d / hw %p\n", 142 printk(KERN_DEBUG "%s - ring %p / size %u / mask 0x%04x / len %u / dir %d / hw %p\n",
143 __FUNCTION__, r, r->size, r->mask, r->len, r->dir, r->rd[0].hw); 143 __func__, r, r->size, r->mask, r->len, r->dir, r->rd[0].hw);
144 printk(KERN_DEBUG "%s - head = %d / tail = %d\n", __FUNCTION__, 144 printk(KERN_DEBUG "%s - head = %d / tail = %d\n", __func__,
145 atomic_read(&r->head) & r->mask, atomic_read(&r->tail) & r->mask); 145 atomic_read(&r->head) & r->mask, atomic_read(&r->tail) & r->mask);
146 for (i = 0; i < r->size; i++) { 146 for (i = 0; i < r->size; i++) {
147 rd = &r->rd[i]; 147 rd = &r->rd[i];
148 printk(KERN_DEBUG "%s - ring descr %u: ", __FUNCTION__, i); 148 printk(KERN_DEBUG "%s - ring descr %u: ", __func__, i);
149 printk("skb=%p data=%p hw=%p\n", rd->skb, rd->buf, rd->hw); 149 printk("skb=%p data=%p hw=%p\n", rd->skb, rd->buf, rd->hw);
150 printk(KERN_DEBUG "%s - hw: status=%02x count=%u addr=0x%08x\n", 150 printk(KERN_DEBUG "%s - hw: status=%02x count=%u addr=0x%08x\n",
151 __FUNCTION__, (unsigned) rd_get_status(rd), 151 __func__, (unsigned) rd_get_status(rd),
152 (unsigned) rd_get_count(rd), (unsigned) rd_get_addr(rd)); 152 (unsigned) rd_get_count(rd), (unsigned) rd_get_addr(rd));
153 } 153 }
154} 154}
@@ -435,7 +435,7 @@ static struct vlsi_ring *vlsi_alloc_ring(struct pci_dev *pdev, struct ring_descr
435 || !(busaddr = pci_map_single(pdev, rd->buf, len, dir))) { 435 || !(busaddr = pci_map_single(pdev, rd->buf, len, dir))) {
436 if (rd->buf) { 436 if (rd->buf) {
437 IRDA_ERROR("%s: failed to create PCI-MAP for %p", 437 IRDA_ERROR("%s: failed to create PCI-MAP for %p",
438 __FUNCTION__, rd->buf); 438 __func__, rd->buf);
439 kfree(rd->buf); 439 kfree(rd->buf);
440 rd->buf = NULL; 440 rd->buf = NULL;
441 } 441 }
@@ -489,7 +489,7 @@ static int vlsi_create_hwif(vlsi_irda_dev_t *idev)
489 ringarea = pci_alloc_consistent(idev->pdev, HW_RING_AREA_SIZE, &idev->busaddr); 489 ringarea = pci_alloc_consistent(idev->pdev, HW_RING_AREA_SIZE, &idev->busaddr);
490 if (!ringarea) { 490 if (!ringarea) {
491 IRDA_ERROR("%s: insufficient memory for descriptor rings\n", 491 IRDA_ERROR("%s: insufficient memory for descriptor rings\n",
492 __FUNCTION__); 492 __func__);
493 goto out; 493 goto out;
494 } 494 }
495 memset(ringarea, 0, HW_RING_AREA_SIZE); 495 memset(ringarea, 0, HW_RING_AREA_SIZE);
@@ -564,7 +564,7 @@ static int vlsi_process_rx(struct vlsi_ring *r, struct ring_descr *rd)
564 crclen = (idev->mode==IFF_FIR) ? sizeof(u32) : sizeof(u16); 564 crclen = (idev->mode==IFF_FIR) ? sizeof(u32) : sizeof(u16);
565 len -= crclen; /* remove trailing CRC */ 565 len -= crclen; /* remove trailing CRC */
566 if (len <= 0) { 566 if (len <= 0) {
567 IRDA_DEBUG(0, "%s: strange frame (len=%d)\n", __FUNCTION__, len); 567 IRDA_DEBUG(0, "%s: strange frame (len=%d)\n", __func__, len);
568 ret |= VLSI_RX_DROP; 568 ret |= VLSI_RX_DROP;
569 goto done; 569 goto done;
570 } 570 }
@@ -579,14 +579,14 @@ static int vlsi_process_rx(struct vlsi_ring *r, struct ring_descr *rd)
579 */ 579 */
580 le16_to_cpus(rd->buf+len); 580 le16_to_cpus(rd->buf+len);
581 if (irda_calc_crc16(INIT_FCS,rd->buf,len+crclen) != GOOD_FCS) { 581 if (irda_calc_crc16(INIT_FCS,rd->buf,len+crclen) != GOOD_FCS) {
582 IRDA_DEBUG(0, "%s: crc error\n", __FUNCTION__); 582 IRDA_DEBUG(0, "%s: crc error\n", __func__);
583 ret |= VLSI_RX_CRC; 583 ret |= VLSI_RX_CRC;
584 goto done; 584 goto done;
585 } 585 }
586 } 586 }
587 587
588 if (!rd->skb) { 588 if (!rd->skb) {
589 IRDA_WARNING("%s: rx packet lost\n", __FUNCTION__); 589 IRDA_WARNING("%s: rx packet lost\n", __func__);
590 ret |= VLSI_RX_DROP; 590 ret |= VLSI_RX_DROP;
591 goto done; 591 goto done;
592 } 592 }
@@ -617,7 +617,7 @@ static void vlsi_fill_rx(struct vlsi_ring *r)
617 for (rd = ring_last(r); rd != NULL; rd = ring_put(r)) { 617 for (rd = ring_last(r); rd != NULL; rd = ring_put(r)) {
618 if (rd_is_active(rd)) { 618 if (rd_is_active(rd)) {
619 IRDA_WARNING("%s: driver bug: rx descr race with hw\n", 619 IRDA_WARNING("%s: driver bug: rx descr race with hw\n",
620 __FUNCTION__); 620 __func__);
621 vlsi_ring_debug(r); 621 vlsi_ring_debug(r);
622 break; 622 break;
623 } 623 }
@@ -676,7 +676,7 @@ static void vlsi_rx_interrupt(struct net_device *ndev)
676 676
677 if (ring_first(r) == NULL) { 677 if (ring_first(r) == NULL) {
678 /* we are in big trouble, if this should ever happen */ 678 /* we are in big trouble, if this should ever happen */
679 IRDA_ERROR("%s: rx ring exhausted!\n", __FUNCTION__); 679 IRDA_ERROR("%s: rx ring exhausted!\n", __func__);
680 vlsi_ring_debug(r); 680 vlsi_ring_debug(r);
681 } 681 }
682 else 682 else
@@ -697,7 +697,7 @@ static void vlsi_unarm_rx(vlsi_irda_dev_t *idev)
697 if (rd_is_active(rd)) { 697 if (rd_is_active(rd)) {
698 rd_set_status(rd, 0); 698 rd_set_status(rd, 0);
699 if (rd_get_count(rd)) { 699 if (rd_get_count(rd)) {
700 IRDA_DEBUG(0, "%s - dropping rx packet\n", __FUNCTION__); 700 IRDA_DEBUG(0, "%s - dropping rx packet\n", __func__);
701 ret = -VLSI_RX_DROP; 701 ret = -VLSI_RX_DROP;
702 } 702 }
703 rd_set_count(rd, 0); 703 rd_set_count(rd, 0);
@@ -772,7 +772,7 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
772 int fifocnt; 772 int fifocnt;
773 773
774 baudrate = idev->new_baud; 774 baudrate = idev->new_baud;
775 IRDA_DEBUG(2, "%s: %d -> %d\n", __FUNCTION__, idev->baud, idev->new_baud); 775 IRDA_DEBUG(2, "%s: %d -> %d\n", __func__, idev->baud, idev->new_baud);
776 if (baudrate == 4000000) { 776 if (baudrate == 4000000) {
777 mode = IFF_FIR; 777 mode = IFF_FIR;
778 config = IRCFG_FIR; 778 config = IRCFG_FIR;
@@ -789,7 +789,7 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
789 switch(baudrate) { 789 switch(baudrate) {
790 default: 790 default:
791 IRDA_WARNING("%s: undefined baudrate %d - fallback to 9600!\n", 791 IRDA_WARNING("%s: undefined baudrate %d - fallback to 9600!\n",
792 __FUNCTION__, baudrate); 792 __func__, baudrate);
793 baudrate = 9600; 793 baudrate = 9600;
794 /* fallthru */ 794 /* fallthru */
795 case 2400: 795 case 2400:
@@ -806,7 +806,7 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
806 806
807 fifocnt = inw(iobase+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK; 807 fifocnt = inw(iobase+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
808 if (fifocnt != 0) { 808 if (fifocnt != 0) {
809 IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __FUNCTION__, fifocnt); 809 IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __func__, fifocnt);
810 } 810 }
811 811
812 outw(0, iobase+VLSI_PIO_IRENABLE); 812 outw(0, iobase+VLSI_PIO_IRENABLE);
@@ -830,14 +830,14 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
830 config ^= IRENABLE_SIR_ON; 830 config ^= IRENABLE_SIR_ON;
831 831
832 if (config != (IRENABLE_PHYANDCLOCK|IRENABLE_ENRXST)) { 832 if (config != (IRENABLE_PHYANDCLOCK|IRENABLE_ENRXST)) {
833 IRDA_WARNING("%s: failed to set %s mode!\n", __FUNCTION__, 833 IRDA_WARNING("%s: failed to set %s mode!\n", __func__,
834 (mode==IFF_SIR)?"SIR":((mode==IFF_MIR)?"MIR":"FIR")); 834 (mode==IFF_SIR)?"SIR":((mode==IFF_MIR)?"MIR":"FIR"));
835 ret = -1; 835 ret = -1;
836 } 836 }
837 else { 837 else {
838 if (inw(iobase+VLSI_PIO_PHYCTL) != nphyctl) { 838 if (inw(iobase+VLSI_PIO_PHYCTL) != nphyctl) {
839 IRDA_WARNING("%s: failed to apply baudrate %d\n", 839 IRDA_WARNING("%s: failed to apply baudrate %d\n",
840 __FUNCTION__, baudrate); 840 __func__, baudrate);
841 ret = -1; 841 ret = -1;
842 } 842 }
843 else { 843 else {
@@ -849,7 +849,7 @@ static int vlsi_set_baud(vlsi_irda_dev_t *idev, unsigned iobase)
849 } 849 }
850 850
851 if (ret) 851 if (ret)
852 vlsi_reg_debug(iobase,__FUNCTION__); 852 vlsi_reg_debug(iobase,__func__);
853 853
854 return ret; 854 return ret;
855} 855}
@@ -982,7 +982,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
982 982
983 if (len >= r->len-5) 983 if (len >= r->len-5)
984 IRDA_WARNING("%s: possible buffer overflow with SIR wrapping!\n", 984 IRDA_WARNING("%s: possible buffer overflow with SIR wrapping!\n",
985 __FUNCTION__); 985 __func__);
986 } 986 }
987 else { 987 else {
988 /* hw deals with MIR/FIR mode wrapping */ 988 /* hw deals with MIR/FIR mode wrapping */
@@ -1027,7 +1027,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1027 1027
1028 fifocnt = inw(ndev->base_addr+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK; 1028 fifocnt = inw(ndev->base_addr+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
1029 if (fifocnt != 0) { 1029 if (fifocnt != 0) {
1030 IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __FUNCTION__, fifocnt); 1030 IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", __func__, fifocnt);
1031 } 1031 }
1032 1032
1033 config = inw(iobase+VLSI_PIO_IRCFG); 1033 config = inw(iobase+VLSI_PIO_IRCFG);
@@ -1040,7 +1040,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1040 1040
1041 if (ring_put(r) == NULL) { 1041 if (ring_put(r) == NULL) {
1042 netif_stop_queue(ndev); 1042 netif_stop_queue(ndev);
1043 IRDA_DEBUG(3, "%s: tx ring full - queue stopped\n", __FUNCTION__); 1043 IRDA_DEBUG(3, "%s: tx ring full - queue stopped\n", __func__);
1044 } 1044 }
1045 spin_unlock_irqrestore(&idev->lock, flags); 1045 spin_unlock_irqrestore(&idev->lock, flags);
1046 1046
@@ -1049,7 +1049,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1049drop_unlock: 1049drop_unlock:
1050 spin_unlock_irqrestore(&idev->lock, flags); 1050 spin_unlock_irqrestore(&idev->lock, flags);
1051drop: 1051drop:
1052 IRDA_WARNING("%s: dropping packet - %s\n", __FUNCTION__, msg); 1052 IRDA_WARNING("%s: dropping packet - %s\n", __func__, msg);
1053 dev_kfree_skb_any(skb); 1053 dev_kfree_skb_any(skb);
1054 idev->stats.tx_errors++; 1054 idev->stats.tx_errors++;
1055 idev->stats.tx_dropped++; 1055 idev->stats.tx_dropped++;
@@ -1106,7 +1106,7 @@ static void vlsi_tx_interrupt(struct net_device *ndev)
1106 fifocnt = inw(iobase+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK; 1106 fifocnt = inw(iobase+VLSI_PIO_RCVBCNT) & RCVBCNT_MASK;
1107 if (fifocnt != 0) { 1107 if (fifocnt != 0) {
1108 IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n", 1108 IRDA_DEBUG(0, "%s: rx fifo not empty(%d)\n",
1109 __FUNCTION__, fifocnt); 1109 __func__, fifocnt);
1110 } 1110 }
1111 outw(config | IRCFG_ENTX, iobase+VLSI_PIO_IRCFG); 1111 outw(config | IRCFG_ENTX, iobase+VLSI_PIO_IRCFG);
1112 } 1112 }
@@ -1115,7 +1115,7 @@ static void vlsi_tx_interrupt(struct net_device *ndev)
1115 1115
1116 if (netif_queue_stopped(ndev) && !idev->new_baud) { 1116 if (netif_queue_stopped(ndev) && !idev->new_baud) {
1117 netif_wake_queue(ndev); 1117 netif_wake_queue(ndev);
1118 IRDA_DEBUG(3, "%s: queue awoken\n", __FUNCTION__); 1118 IRDA_DEBUG(3, "%s: queue awoken\n", __func__);
1119 } 1119 }
1120} 1120}
1121 1121
@@ -1138,7 +1138,7 @@ static void vlsi_unarm_tx(vlsi_irda_dev_t *idev)
1138 dev_kfree_skb_any(rd->skb); 1138 dev_kfree_skb_any(rd->skb);
1139 rd->skb = NULL; 1139 rd->skb = NULL;
1140 } 1140 }
1141 IRDA_DEBUG(0, "%s - dropping tx packet\n", __FUNCTION__); 1141 IRDA_DEBUG(0, "%s - dropping tx packet\n", __func__);
1142 ret = -VLSI_TX_DROP; 1142 ret = -VLSI_TX_DROP;
1143 } 1143 }
1144 else 1144 else
@@ -1188,7 +1188,7 @@ static int vlsi_start_clock(struct pci_dev *pdev)
1188 if (count < 3) { 1188 if (count < 3) {
1189 if (clksrc == 1) { /* explicitly asked for PLL hence bail out */ 1189 if (clksrc == 1) { /* explicitly asked for PLL hence bail out */
1190 IRDA_ERROR("%s: no PLL or failed to lock!\n", 1190 IRDA_ERROR("%s: no PLL or failed to lock!\n",
1191 __FUNCTION__); 1191 __func__);
1192 clkctl = CLKCTL_CLKSTP; 1192 clkctl = CLKCTL_CLKSTP;
1193 pci_write_config_byte(pdev, VLSI_PCI_CLKCTL, clkctl); 1193 pci_write_config_byte(pdev, VLSI_PCI_CLKCTL, clkctl);
1194 return -1; 1194 return -1;
@@ -1197,7 +1197,7 @@ static int vlsi_start_clock(struct pci_dev *pdev)
1197 clksrc = 3; /* fallback to 40MHz XCLK (OB800) */ 1197 clksrc = 3; /* fallback to 40MHz XCLK (OB800) */
1198 1198
1199 IRDA_DEBUG(0, "%s: PLL not locked, fallback to clksrc=%d\n", 1199 IRDA_DEBUG(0, "%s: PLL not locked, fallback to clksrc=%d\n",
1200 __FUNCTION__, clksrc); 1200 __func__, clksrc);
1201 } 1201 }
1202 else 1202 else
1203 clksrc = 1; /* got successful PLL lock */ 1203 clksrc = 1; /* got successful PLL lock */
@@ -1269,7 +1269,7 @@ static int vlsi_init_chip(struct pci_dev *pdev)
1269 /* start the clock and clean the registers */ 1269 /* start the clock and clean the registers */
1270 1270
1271 if (vlsi_start_clock(pdev)) { 1271 if (vlsi_start_clock(pdev)) {
1272 IRDA_ERROR("%s: no valid clock source\n", __FUNCTION__); 1272 IRDA_ERROR("%s: no valid clock source\n", __func__);
1273 return -1; 1273 return -1;
1274 } 1274 }
1275 iobase = ndev->base_addr; 1275 iobase = ndev->base_addr;
@@ -1386,7 +1386,7 @@ static void vlsi_tx_timeout(struct net_device *ndev)
1386 vlsi_irda_dev_t *idev = ndev->priv; 1386 vlsi_irda_dev_t *idev = ndev->priv;
1387 1387
1388 1388
1389 vlsi_reg_debug(ndev->base_addr, __FUNCTION__); 1389 vlsi_reg_debug(ndev->base_addr, __func__);
1390 vlsi_ring_debug(idev->tx_ring); 1390 vlsi_ring_debug(idev->tx_ring);
1391 1391
1392 if (netif_running(ndev)) 1392 if (netif_running(ndev))
@@ -1401,7 +1401,7 @@ static void vlsi_tx_timeout(struct net_device *ndev)
1401 1401
1402 if (vlsi_start_hw(idev)) 1402 if (vlsi_start_hw(idev))
1403 IRDA_ERROR("%s: failed to restart hw - %s(%s) unusable!\n", 1403 IRDA_ERROR("%s: failed to restart hw - %s(%s) unusable!\n",
1404 __FUNCTION__, pci_name(idev->pdev), ndev->name); 1404 __func__, pci_name(idev->pdev), ndev->name);
1405 else 1405 else
1406 netif_start_queue(ndev); 1406 netif_start_queue(ndev);
1407} 1407}
@@ -1446,7 +1446,7 @@ static int vlsi_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
1446 break; 1446 break;
1447 default: 1447 default:
1448 IRDA_WARNING("%s: notsupp - cmd=%04x\n", 1448 IRDA_WARNING("%s: notsupp - cmd=%04x\n",
1449 __FUNCTION__, cmd); 1449 __func__, cmd);
1450 ret = -EOPNOTSUPP; 1450 ret = -EOPNOTSUPP;
1451 } 1451 }
1452 1452
@@ -1491,7 +1491,7 @@ static irqreturn_t vlsi_interrupt(int irq, void *dev_instance)
1491 1491
1492 if (boguscount <= 0) 1492 if (boguscount <= 0)
1493 IRDA_MESSAGE("%s: too much work in interrupt!\n", 1493 IRDA_MESSAGE("%s: too much work in interrupt!\n",
1494 __FUNCTION__); 1494 __func__);
1495 return IRQ_RETVAL(handled); 1495 return IRQ_RETVAL(handled);
1496} 1496}
1497 1497
@@ -1504,7 +1504,7 @@ static int vlsi_open(struct net_device *ndev)
1504 char hwname[32]; 1504 char hwname[32];
1505 1505
1506 if (pci_request_regions(idev->pdev, drivername)) { 1506 if (pci_request_regions(idev->pdev, drivername)) {
1507 IRDA_WARNING("%s: io resource busy\n", __FUNCTION__); 1507 IRDA_WARNING("%s: io resource busy\n", __func__);
1508 goto errout; 1508 goto errout;
1509 } 1509 }
1510 ndev->base_addr = pci_resource_start(idev->pdev,0); 1510 ndev->base_addr = pci_resource_start(idev->pdev,0);
@@ -1519,7 +1519,7 @@ static int vlsi_open(struct net_device *ndev)
1519 if (request_irq(ndev->irq, vlsi_interrupt, IRQF_SHARED, 1519 if (request_irq(ndev->irq, vlsi_interrupt, IRQF_SHARED,
1520 drivername, ndev)) { 1520 drivername, ndev)) {
1521 IRDA_WARNING("%s: couldn't get IRQ: %d\n", 1521 IRDA_WARNING("%s: couldn't get IRQ: %d\n",
1522 __FUNCTION__, ndev->irq); 1522 __func__, ndev->irq);
1523 goto errout_io; 1523 goto errout_io;
1524 } 1524 }
1525 1525
@@ -1540,7 +1540,7 @@ static int vlsi_open(struct net_device *ndev)
1540 1540
1541 netif_start_queue(ndev); 1541 netif_start_queue(ndev);
1542 1542
1543 IRDA_MESSAGE("%s: device %s operational\n", __FUNCTION__, ndev->name); 1543 IRDA_MESSAGE("%s: device %s operational\n", __func__, ndev->name);
1544 1544
1545 return 0; 1545 return 0;
1546 1546
@@ -1574,7 +1574,7 @@ static int vlsi_close(struct net_device *ndev)
1574 1574
1575 pci_release_regions(idev->pdev); 1575 pci_release_regions(idev->pdev);
1576 1576
1577 IRDA_MESSAGE("%s: device %s stopped\n", __FUNCTION__, ndev->name); 1577 IRDA_MESSAGE("%s: device %s stopped\n", __func__, ndev->name);
1578 1578
1579 return 0; 1579 return 0;
1580} 1580}
@@ -1593,7 +1593,7 @@ static int vlsi_irda_init(struct net_device *ndev)
1593 1593
1594 if (pci_set_dma_mask(pdev,DMA_MASK_USED_BY_HW) 1594 if (pci_set_dma_mask(pdev,DMA_MASK_USED_BY_HW)
1595 || pci_set_dma_mask(pdev,DMA_MASK_MSTRPAGE)) { 1595 || pci_set_dma_mask(pdev,DMA_MASK_MSTRPAGE)) {
1596 IRDA_ERROR("%s: aborting due to PCI BM-DMA address limitations\n", __FUNCTION__); 1596 IRDA_ERROR("%s: aborting due to PCI BM-DMA address limitations\n", __func__);
1597 return -1; 1597 return -1;
1598 } 1598 }
1599 1599
@@ -1645,14 +1645,14 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1645 1645
1646 if ( !pci_resource_start(pdev,0) 1646 if ( !pci_resource_start(pdev,0)
1647 || !(pci_resource_flags(pdev,0) & IORESOURCE_IO) ) { 1647 || !(pci_resource_flags(pdev,0) & IORESOURCE_IO) ) {
1648 IRDA_ERROR("%s: bar 0 invalid", __FUNCTION__); 1648 IRDA_ERROR("%s: bar 0 invalid", __func__);
1649 goto out_disable; 1649 goto out_disable;
1650 } 1650 }
1651 1651
1652 ndev = alloc_irdadev(sizeof(*idev)); 1652 ndev = alloc_irdadev(sizeof(*idev));
1653 if (ndev==NULL) { 1653 if (ndev==NULL) {
1654 IRDA_ERROR("%s: Unable to allocate device memory.\n", 1654 IRDA_ERROR("%s: Unable to allocate device memory.\n",
1655 __FUNCTION__); 1655 __func__);
1656 goto out_disable; 1656 goto out_disable;
1657 } 1657 }
1658 1658
@@ -1667,7 +1667,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1667 goto out_freedev; 1667 goto out_freedev;
1668 1668
1669 if (register_netdev(ndev) < 0) { 1669 if (register_netdev(ndev) < 0) {
1670 IRDA_ERROR("%s: register_netdev failed\n", __FUNCTION__); 1670 IRDA_ERROR("%s: register_netdev failed\n", __func__);
1671 goto out_freedev; 1671 goto out_freedev;
1672 } 1672 }
1673 1673
@@ -1678,7 +1678,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1678 vlsi_proc_root, VLSI_PROC_FOPS, ndev); 1678 vlsi_proc_root, VLSI_PROC_FOPS, ndev);
1679 if (!ent) { 1679 if (!ent) {
1680 IRDA_WARNING("%s: failed to create proc entry\n", 1680 IRDA_WARNING("%s: failed to create proc entry\n",
1681 __FUNCTION__); 1681 __func__);
1682 } else { 1682 } else {
1683 ent->size = 0; 1683 ent->size = 0;
1684 } 1684 }
@@ -1745,7 +1745,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
1745 1745
1746 if (!ndev) { 1746 if (!ndev) {
1747 IRDA_ERROR("%s - %s: no netdevice \n", 1747 IRDA_ERROR("%s - %s: no netdevice \n",
1748 __FUNCTION__, pci_name(pdev)); 1748 __func__, pci_name(pdev));
1749 return 0; 1749 return 0;
1750 } 1750 }
1751 idev = ndev->priv; 1751 idev = ndev->priv;
@@ -1756,7 +1756,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
1756 pdev->current_state = state.event; 1756 pdev->current_state = state.event;
1757 } 1757 }
1758 else 1758 else
1759 IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, pci_name(pdev), pdev->current_state, state.event); 1759 IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __func__, pci_name(pdev), pdev->current_state, state.event);
1760 mutex_unlock(&idev->mtx); 1760 mutex_unlock(&idev->mtx);
1761 return 0; 1761 return 0;
1762 } 1762 }
@@ -1784,7 +1784,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
1784 1784
1785 if (!ndev) { 1785 if (!ndev) {
1786 IRDA_ERROR("%s - %s: no netdevice \n", 1786 IRDA_ERROR("%s - %s: no netdevice \n",
1787 __FUNCTION__, pci_name(pdev)); 1787 __func__, pci_name(pdev));
1788 return 0; 1788 return 0;
1789 } 1789 }
1790 idev = ndev->priv; 1790 idev = ndev->priv;
@@ -1792,7 +1792,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
1792 if (pdev->current_state == 0) { 1792 if (pdev->current_state == 0) {
1793 mutex_unlock(&idev->mtx); 1793 mutex_unlock(&idev->mtx);
1794 IRDA_WARNING("%s - %s: already resumed\n", 1794 IRDA_WARNING("%s - %s: already resumed\n",
1795 __FUNCTION__, pci_name(pdev)); 1795 __func__, pci_name(pdev));
1796 return 0; 1796 return 0;
1797 } 1797 }
1798 1798
@@ -1811,7 +1811,7 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
1811 * now we explicitly set pdev->current_state = 0 after enabling the 1811 * now we explicitly set pdev->current_state = 0 after enabling the
1812 * device and independently resume_ok should catch any garbage config. 1812 * device and independently resume_ok should catch any garbage config.
1813 */ 1813 */
1814 IRDA_WARNING("%s - hm, nothing to resume?\n", __FUNCTION__); 1814 IRDA_WARNING("%s - hm, nothing to resume?\n", __func__);
1815 mutex_unlock(&idev->mtx); 1815 mutex_unlock(&idev->mtx);
1816 return 0; 1816 return 0;
1817 } 1817 }
diff --git a/drivers/net/irda/vlsi_ir.h b/drivers/net/irda/vlsi_ir.h
index c8b9c74eea52..9b1884329fba 100644
--- a/drivers/net/irda/vlsi_ir.h
+++ b/drivers/net/irda/vlsi_ir.h
@@ -617,7 +617,7 @@ static inline void rd_set_addr_status(struct ring_descr *rd, dma_addr_t a, u8 s)
617 */ 617 */
618 618
619 if ((a & ~DMA_MASK_MSTRPAGE)>>24 != MSTRPAGE_VALUE) { 619 if ((a & ~DMA_MASK_MSTRPAGE)>>24 != MSTRPAGE_VALUE) {
620 IRDA_ERROR("%s: pci busaddr inconsistency!\n", __FUNCTION__); 620 IRDA_ERROR("%s: pci busaddr inconsistency!\n", __func__);
621 dump_stack(); 621 dump_stack();
622 return; 622 return;
623 } 623 }
diff --git a/drivers/net/irda/w83977af_ir.c b/drivers/net/irda/w83977af_ir.c
index 9fd2451b0fb2..002a6d769f21 100644
--- a/drivers/net/irda/w83977af_ir.c
+++ b/drivers/net/irda/w83977af_ir.c
@@ -114,7 +114,7 @@ static int __init w83977af_init(void)
114{ 114{
115 int i; 115 int i;
116 116
117 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); 117 IRDA_DEBUG(0, "%s()\n", __func__ );
118 118
119 for (i=0; (io[i] < 2000) && (i < ARRAY_SIZE(dev_self)); i++) { 119 for (i=0; (io[i] < 2000) && (i < ARRAY_SIZE(dev_self)); i++) {
120 if (w83977af_open(i, io[i], irq[i], dma[i]) == 0) 120 if (w83977af_open(i, io[i], irq[i], dma[i]) == 0)
@@ -133,7 +133,7 @@ static void __exit w83977af_cleanup(void)
133{ 133{
134 int i; 134 int i;
135 135
136 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 136 IRDA_DEBUG(4, "%s()\n", __func__ );
137 137
138 for (i=0; i < ARRAY_SIZE(dev_self); i++) { 138 for (i=0; i < ARRAY_SIZE(dev_self); i++) {
139 if (dev_self[i]) 139 if (dev_self[i])
@@ -154,12 +154,12 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq,
154 struct w83977af_ir *self; 154 struct w83977af_ir *self;
155 int err; 155 int err;
156 156
157 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); 157 IRDA_DEBUG(0, "%s()\n", __func__ );
158 158
159 /* Lock the port that we need */ 159 /* Lock the port that we need */
160 if (!request_region(iobase, CHIP_IO_EXTENT, driver_name)) { 160 if (!request_region(iobase, CHIP_IO_EXTENT, driver_name)) {
161 IRDA_DEBUG(0, "%s(), can't get iobase of 0x%03x\n", 161 IRDA_DEBUG(0, "%s(), can't get iobase of 0x%03x\n",
162 __FUNCTION__ , iobase); 162 __func__ , iobase);
163 return -ENODEV; 163 return -ENODEV;
164 } 164 }
165 165
@@ -241,7 +241,7 @@ int w83977af_open(int i, unsigned int iobase, unsigned int irq,
241 241
242 err = register_netdev(dev); 242 err = register_netdev(dev);
243 if (err) { 243 if (err) {
244 IRDA_ERROR("%s(), register_netdevice() failed!\n", __FUNCTION__); 244 IRDA_ERROR("%s(), register_netdevice() failed!\n", __func__);
245 goto err_out3; 245 goto err_out3;
246 } 246 }
247 IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name); 247 IRDA_MESSAGE("IrDA: Registered device %s\n", dev->name);
@@ -273,7 +273,7 @@ static int w83977af_close(struct w83977af_ir *self)
273{ 273{
274 int iobase; 274 int iobase;
275 275
276 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); 276 IRDA_DEBUG(0, "%s()\n", __func__ );
277 277
278 iobase = self->io.fir_base; 278 iobase = self->io.fir_base;
279 279
@@ -294,7 +294,7 @@ static int w83977af_close(struct w83977af_ir *self)
294 294
295 /* Release the PORT that this driver is using */ 295 /* Release the PORT that this driver is using */
296 IRDA_DEBUG(0 , "%s(), Releasing Region %03x\n", 296 IRDA_DEBUG(0 , "%s(), Releasing Region %03x\n",
297 __FUNCTION__ , self->io.fir_base); 297 __func__ , self->io.fir_base);
298 release_region(self->io.fir_base, self->io.fir_ext); 298 release_region(self->io.fir_base, self->io.fir_ext);
299 299
300 if (self->tx_buff.head) 300 if (self->tx_buff.head)
@@ -316,7 +316,7 @@ int w83977af_probe( int iobase, int irq, int dma)
316 int i; 316 int i;
317 317
318 for (i=0; i < 2; i++) { 318 for (i=0; i < 2; i++) {
319 IRDA_DEBUG( 0, "%s()\n", __FUNCTION__ ); 319 IRDA_DEBUG( 0, "%s()\n", __func__ );
320#ifdef CONFIG_USE_W977_PNP 320#ifdef CONFIG_USE_W977_PNP
321 /* Enter PnP configuration mode */ 321 /* Enter PnP configuration mode */
322 w977_efm_enter(efbase[i]); 322 w977_efm_enter(efbase[i]);
@@ -403,7 +403,7 @@ int w83977af_probe( int iobase, int irq, int dma)
403 return 0; 403 return 0;
404 } else { 404 } else {
405 /* Try next extented function register address */ 405 /* Try next extented function register address */
406 IRDA_DEBUG( 0, "%s(), Wrong chip version", __FUNCTION__ ); 406 IRDA_DEBUG( 0, "%s(), Wrong chip version", __func__ );
407 } 407 }
408 } 408 }
409 return -1; 409 return -1;
@@ -439,19 +439,19 @@ void w83977af_change_speed(struct w83977af_ir *self, __u32 speed)
439 case 115200: outb(0x01, iobase+ABLL); break; 439 case 115200: outb(0x01, iobase+ABLL); break;
440 case 576000: 440 case 576000:
441 ir_mode = HCR_MIR_576; 441 ir_mode = HCR_MIR_576;
442 IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __FUNCTION__ ); 442 IRDA_DEBUG(0, "%s(), handling baud of 576000\n", __func__ );
443 break; 443 break;
444 case 1152000: 444 case 1152000:
445 ir_mode = HCR_MIR_1152; 445 ir_mode = HCR_MIR_1152;
446 IRDA_DEBUG(0, "%s(), handling baud of 1152000\n", __FUNCTION__ ); 446 IRDA_DEBUG(0, "%s(), handling baud of 1152000\n", __func__ );
447 break; 447 break;
448 case 4000000: 448 case 4000000:
449 ir_mode = HCR_FIR; 449 ir_mode = HCR_FIR;
450 IRDA_DEBUG(0, "%s(), handling baud of 4000000\n", __FUNCTION__ ); 450 IRDA_DEBUG(0, "%s(), handling baud of 4000000\n", __func__ );
451 break; 451 break;
452 default: 452 default:
453 ir_mode = HCR_FIR; 453 ir_mode = HCR_FIR;
454 IRDA_DEBUG(0, "%s(), unknown baud rate of %d\n", __FUNCTION__ , speed); 454 IRDA_DEBUG(0, "%s(), unknown baud rate of %d\n", __func__ , speed);
455 break; 455 break;
456 } 456 }
457 457
@@ -501,7 +501,7 @@ int w83977af_hard_xmit(struct sk_buff *skb, struct net_device *dev)
501 501
502 iobase = self->io.fir_base; 502 iobase = self->io.fir_base;
503 503
504 IRDA_DEBUG(4, "%s(%ld), skb->len=%d\n", __FUNCTION__ , jiffies, 504 IRDA_DEBUG(4, "%s(%ld), skb->len=%d\n", __func__ , jiffies,
505 (int) skb->len); 505 (int) skb->len);
506 506
507 /* Lock transmit buffer */ 507 /* Lock transmit buffer */
@@ -549,7 +549,7 @@ int w83977af_hard_xmit(struct sk_buff *skb, struct net_device *dev)
549 outb(ICR_ETMRI, iobase+ICR); 549 outb(ICR_ETMRI, iobase+ICR);
550 } else { 550 } else {
551#endif 551#endif
552 IRDA_DEBUG(4, "%s(%ld), mtt=%d\n", __FUNCTION__ , jiffies, mtt); 552 IRDA_DEBUG(4, "%s(%ld), mtt=%d\n", __func__ , jiffies, mtt);
553 if (mtt) 553 if (mtt)
554 udelay(mtt); 554 udelay(mtt);
555 555
@@ -591,7 +591,7 @@ static void w83977af_dma_write(struct w83977af_ir *self, int iobase)
591 unsigned long flags; 591 unsigned long flags;
592 __u8 hcr; 592 __u8 hcr;
593#endif 593#endif
594 IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__ , self->tx_buff.len); 594 IRDA_DEBUG(4, "%s(), len=%d\n", __func__ , self->tx_buff.len);
595 595
596 /* Save current set */ 596 /* Save current set */
597 set = inb(iobase+SSR); 597 set = inb(iobase+SSR);
@@ -643,7 +643,7 @@ static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
643 int actual = 0; 643 int actual = 0;
644 __u8 set; 644 __u8 set;
645 645
646 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 646 IRDA_DEBUG(4, "%s()\n", __func__ );
647 647
648 /* Save current bank */ 648 /* Save current bank */
649 set = inb(iobase+SSR); 649 set = inb(iobase+SSR);
@@ -651,11 +651,11 @@ static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
651 switch_bank(iobase, SET0); 651 switch_bank(iobase, SET0);
652 if (!(inb_p(iobase+USR) & USR_TSRE)) { 652 if (!(inb_p(iobase+USR) & USR_TSRE)) {
653 IRDA_DEBUG(4, 653 IRDA_DEBUG(4,
654 "%s(), warning, FIFO not empty yet!\n", __FUNCTION__ ); 654 "%s(), warning, FIFO not empty yet!\n", __func__ );
655 655
656 fifo_size -= 17; 656 fifo_size -= 17;
657 IRDA_DEBUG(4, "%s(), %d bytes left in tx fifo\n", 657 IRDA_DEBUG(4, "%s(), %d bytes left in tx fifo\n",
658 __FUNCTION__ , fifo_size); 658 __func__ , fifo_size);
659 } 659 }
660 660
661 /* Fill FIFO with current frame */ 661 /* Fill FIFO with current frame */
@@ -665,7 +665,7 @@ static int w83977af_pio_write(int iobase, __u8 *buf, int len, int fifo_size)
665 } 665 }
666 666
667 IRDA_DEBUG(4, "%s(), fifo_size %d ; %d sent of %d\n", 667 IRDA_DEBUG(4, "%s(), fifo_size %d ; %d sent of %d\n",
668 __FUNCTION__ , fifo_size, actual, len); 668 __func__ , fifo_size, actual, len);
669 669
670 /* Restore bank */ 670 /* Restore bank */
671 outb(set, iobase+SSR); 671 outb(set, iobase+SSR);
@@ -685,7 +685,7 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
685 int iobase; 685 int iobase;
686 __u8 set; 686 __u8 set;
687 687
688 IRDA_DEBUG(4, "%s(%ld)\n", __FUNCTION__ , jiffies); 688 IRDA_DEBUG(4, "%s(%ld)\n", __func__ , jiffies);
689 689
690 IRDA_ASSERT(self != NULL, return;); 690 IRDA_ASSERT(self != NULL, return;);
691 691
@@ -700,7 +700,7 @@ static void w83977af_dma_xmit_complete(struct w83977af_ir *self)
700 700
701 /* Check for underrrun! */ 701 /* Check for underrrun! */
702 if (inb(iobase+AUDR) & AUDR_UNDR) { 702 if (inb(iobase+AUDR) & AUDR_UNDR) {
703 IRDA_DEBUG(0, "%s(), Transmit underrun!\n", __FUNCTION__ ); 703 IRDA_DEBUG(0, "%s(), Transmit underrun!\n", __func__ );
704 704
705 self->stats.tx_errors++; 705 self->stats.tx_errors++;
706 self->stats.tx_fifo_errors++; 706 self->stats.tx_fifo_errors++;
@@ -741,7 +741,7 @@ int w83977af_dma_receive(struct w83977af_ir *self)
741#endif 741#endif
742 IRDA_ASSERT(self != NULL, return -1;); 742 IRDA_ASSERT(self != NULL, return -1;);
743 743
744 IRDA_DEBUG(4, "%s\n", __FUNCTION__ ); 744 IRDA_DEBUG(4, "%s\n", __func__ );
745 745
746 iobase= self->io.fir_base; 746 iobase= self->io.fir_base;
747 747
@@ -812,7 +812,7 @@ int w83977af_dma_receive_complete(struct w83977af_ir *self)
812 __u8 set; 812 __u8 set;
813 __u8 status; 813 __u8 status;
814 814
815 IRDA_DEBUG(4, "%s\n", __FUNCTION__ ); 815 IRDA_DEBUG(4, "%s\n", __func__ );
816 816
817 st_fifo = &self->st_fifo; 817 st_fifo = &self->st_fifo;
818 818
@@ -892,7 +892,7 @@ int w83977af_dma_receive_complete(struct w83977af_ir *self)
892 skb = dev_alloc_skb(len+1); 892 skb = dev_alloc_skb(len+1);
893 if (skb == NULL) { 893 if (skb == NULL) {
894 printk(KERN_INFO 894 printk(KERN_INFO
895 "%s(), memory squeeze, dropping frame.\n", __FUNCTION__); 895 "%s(), memory squeeze, dropping frame.\n", __func__);
896 /* Restore set register */ 896 /* Restore set register */
897 outb(set, iobase+SSR); 897 outb(set, iobase+SSR);
898 898
@@ -943,7 +943,7 @@ static void w83977af_pio_receive(struct w83977af_ir *self)
943 __u8 byte = 0x00; 943 __u8 byte = 0x00;
944 int iobase; 944 int iobase;
945 945
946 IRDA_DEBUG(4, "%s()\n", __FUNCTION__ ); 946 IRDA_DEBUG(4, "%s()\n", __func__ );
947 947
948 IRDA_ASSERT(self != NULL, return;); 948 IRDA_ASSERT(self != NULL, return;);
949 949
@@ -970,7 +970,7 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr)
970 __u8 set; 970 __u8 set;
971 int iobase; 971 int iobase;
972 972
973 IRDA_DEBUG(4, "%s(), isr=%#x\n", __FUNCTION__ , isr); 973 IRDA_DEBUG(4, "%s(), isr=%#x\n", __func__ , isr);
974 974
975 iobase = self->io.fir_base; 975 iobase = self->io.fir_base;
976 /* Transmit FIFO low on data */ 976 /* Transmit FIFO low on data */
@@ -1007,7 +1007,7 @@ static __u8 w83977af_sir_interrupt(struct w83977af_ir *self, int isr)
1007 /* Check if we need to change the speed? */ 1007 /* Check if we need to change the speed? */
1008 if (self->new_speed) { 1008 if (self->new_speed) {
1009 IRDA_DEBUG(2, 1009 IRDA_DEBUG(2,
1010 "%s(), Changing speed!\n", __FUNCTION__ ); 1010 "%s(), Changing speed!\n", __func__ );
1011 w83977af_change_speed(self, self->new_speed); 1011 w83977af_change_speed(self, self->new_speed);
1012 self->new_speed = 0; 1012 self->new_speed = 0;
1013 } 1013 }
@@ -1189,7 +1189,7 @@ static int w83977af_net_open(struct net_device *dev)
1189 char hwname[32]; 1189 char hwname[32];
1190 __u8 set; 1190 __u8 set;
1191 1191
1192 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); 1192 IRDA_DEBUG(0, "%s()\n", __func__ );
1193 1193
1194 IRDA_ASSERT(dev != NULL, return -1;); 1194 IRDA_ASSERT(dev != NULL, return -1;);
1195 self = (struct w83977af_ir *) dev->priv; 1195 self = (struct w83977af_ir *) dev->priv;
@@ -1252,7 +1252,7 @@ static int w83977af_net_close(struct net_device *dev)
1252 int iobase; 1252 int iobase;
1253 __u8 set; 1253 __u8 set;
1254 1254
1255 IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); 1255 IRDA_DEBUG(0, "%s()\n", __func__ );
1256 1256
1257 IRDA_ASSERT(dev != NULL, return -1;); 1257 IRDA_ASSERT(dev != NULL, return -1;);
1258 1258
@@ -1307,7 +1307,7 @@ static int w83977af_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1307 1307
1308 IRDA_ASSERT(self != NULL, return -1;); 1308 IRDA_ASSERT(self != NULL, return -1;);
1309 1309
1310 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__ , dev->name, cmd); 1310 IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __func__ , dev->name, cmd);
1311 1311
1312 spin_lock_irqsave(&self->lock, flags); 1312 spin_lock_irqsave(&self->lock, flags);
1313 1313
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 8a97a0066a88..46819af3b062 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -55,7 +55,7 @@
55#include <asm/system.h> 55#include <asm/system.h>
56 56
57static char mv643xx_eth_driver_name[] = "mv643xx_eth"; 57static char mv643xx_eth_driver_name[] = "mv643xx_eth";
58static char mv643xx_eth_driver_version[] = "1.1"; 58static char mv643xx_eth_driver_version[] = "1.2";
59 59
60#define MV643XX_ETH_CHECKSUM_OFFLOAD_TX 60#define MV643XX_ETH_CHECKSUM_OFFLOAD_TX
61#define MV643XX_ETH_NAPI 61#define MV643XX_ETH_NAPI
@@ -90,12 +90,21 @@ static char mv643xx_eth_driver_version[] = "1.1";
90#define PORT_SERIAL_CONTROL(p) (0x043c + ((p) << 10)) 90#define PORT_SERIAL_CONTROL(p) (0x043c + ((p) << 10))
91#define PORT_STATUS(p) (0x0444 + ((p) << 10)) 91#define PORT_STATUS(p) (0x0444 + ((p) << 10))
92#define TX_FIFO_EMPTY 0x00000400 92#define TX_FIFO_EMPTY 0x00000400
93#define TX_IN_PROGRESS 0x00000080
94#define PORT_SPEED_MASK 0x00000030
95#define PORT_SPEED_1000 0x00000010
96#define PORT_SPEED_100 0x00000020
97#define PORT_SPEED_10 0x00000000
98#define FLOW_CONTROL_ENABLED 0x00000008
99#define FULL_DUPLEX 0x00000004
100#define LINK_UP 0x00000002
93#define TXQ_COMMAND(p) (0x0448 + ((p) << 10)) 101#define TXQ_COMMAND(p) (0x0448 + ((p) << 10))
94#define TXQ_FIX_PRIO_CONF(p) (0x044c + ((p) << 10)) 102#define TXQ_FIX_PRIO_CONF(p) (0x044c + ((p) << 10))
95#define TX_BW_RATE(p) (0x0450 + ((p) << 10)) 103#define TX_BW_RATE(p) (0x0450 + ((p) << 10))
96#define TX_BW_MTU(p) (0x0458 + ((p) << 10)) 104#define TX_BW_MTU(p) (0x0458 + ((p) << 10))
97#define TX_BW_BURST(p) (0x045c + ((p) << 10)) 105#define TX_BW_BURST(p) (0x045c + ((p) << 10))
98#define INT_CAUSE(p) (0x0460 + ((p) << 10)) 106#define INT_CAUSE(p) (0x0460 + ((p) << 10))
107#define INT_TX_END_0 0x00080000
99#define INT_TX_END 0x07f80000 108#define INT_TX_END 0x07f80000
100#define INT_RX 0x0007fbfc 109#define INT_RX 0x0007fbfc
101#define INT_EXT 0x00000002 110#define INT_EXT 0x00000002
@@ -127,21 +136,21 @@ static char mv643xx_eth_driver_version[] = "1.1";
127/* 136/*
128 * SDMA configuration register. 137 * SDMA configuration register.
129 */ 138 */
130#define RX_BURST_SIZE_4_64BIT (2 << 1) 139#define RX_BURST_SIZE_16_64BIT (4 << 1)
131#define BLM_RX_NO_SWAP (1 << 4) 140#define BLM_RX_NO_SWAP (1 << 4)
132#define BLM_TX_NO_SWAP (1 << 5) 141#define BLM_TX_NO_SWAP (1 << 5)
133#define TX_BURST_SIZE_4_64BIT (2 << 22) 142#define TX_BURST_SIZE_16_64BIT (4 << 22)
134 143
135#if defined(__BIG_ENDIAN) 144#if defined(__BIG_ENDIAN)
136#define PORT_SDMA_CONFIG_DEFAULT_VALUE \ 145#define PORT_SDMA_CONFIG_DEFAULT_VALUE \
137 RX_BURST_SIZE_4_64BIT | \ 146 RX_BURST_SIZE_16_64BIT | \
138 TX_BURST_SIZE_4_64BIT 147 TX_BURST_SIZE_16_64BIT
139#elif defined(__LITTLE_ENDIAN) 148#elif defined(__LITTLE_ENDIAN)
140#define PORT_SDMA_CONFIG_DEFAULT_VALUE \ 149#define PORT_SDMA_CONFIG_DEFAULT_VALUE \
141 RX_BURST_SIZE_4_64BIT | \ 150 RX_BURST_SIZE_16_64BIT | \
142 BLM_RX_NO_SWAP | \ 151 BLM_RX_NO_SWAP | \
143 BLM_TX_NO_SWAP | \ 152 BLM_TX_NO_SWAP | \
144 TX_BURST_SIZE_4_64BIT 153 TX_BURST_SIZE_16_64BIT
145#else 154#else
146#error One of __BIG_ENDIAN or __LITTLE_ENDIAN must be defined 155#error One of __BIG_ENDIAN or __LITTLE_ENDIAN must be defined
147#endif 156#endif
@@ -153,9 +162,7 @@ static char mv643xx_eth_driver_version[] = "1.1";
153#define SET_MII_SPEED_TO_100 (1 << 24) 162#define SET_MII_SPEED_TO_100 (1 << 24)
154#define SET_GMII_SPEED_TO_1000 (1 << 23) 163#define SET_GMII_SPEED_TO_1000 (1 << 23)
155#define SET_FULL_DUPLEX_MODE (1 << 21) 164#define SET_FULL_DUPLEX_MODE (1 << 21)
156#define MAX_RX_PACKET_1522BYTE (1 << 17)
157#define MAX_RX_PACKET_9700BYTE (5 << 17) 165#define MAX_RX_PACKET_9700BYTE (5 << 17)
158#define MAX_RX_PACKET_MASK (7 << 17)
159#define DISABLE_AUTO_NEG_SPEED_GMII (1 << 13) 166#define DISABLE_AUTO_NEG_SPEED_GMII (1 << 13)
160#define DO_NOT_FORCE_LINK_FAIL (1 << 10) 167#define DO_NOT_FORCE_LINK_FAIL (1 << 10)
161#define SERIAL_PORT_CONTROL_RESERVED (1 << 9) 168#define SERIAL_PORT_CONTROL_RESERVED (1 << 9)
@@ -228,6 +235,8 @@ struct tx_desc {
228#define GEN_IP_V4_CHECKSUM 0x00040000 235#define GEN_IP_V4_CHECKSUM 0x00040000
229#define GEN_TCP_UDP_CHECKSUM 0x00020000 236#define GEN_TCP_UDP_CHECKSUM 0x00020000
230#define UDP_FRAME 0x00010000 237#define UDP_FRAME 0x00010000
238#define MAC_HDR_EXTRA_4_BYTES 0x00008000
239#define MAC_HDR_EXTRA_8_BYTES 0x00000200
231 240
232#define TX_IHL_SHIFT 11 241#define TX_IHL_SHIFT 11
233 242
@@ -404,6 +413,17 @@ static void rxq_disable(struct rx_queue *rxq)
404 udelay(10); 413 udelay(10);
405} 414}
406 415
416static void txq_reset_hw_ptr(struct tx_queue *txq)
417{
418 struct mv643xx_eth_private *mp = txq_to_mp(txq);
419 int off = TXQ_CURRENT_DESC_PTR(mp->port_num, txq->index);
420 u32 addr;
421
422 addr = (u32)txq->tx_desc_dma;
423 addr += txq->tx_curr_desc * sizeof(struct tx_desc);
424 wrl(mp, off, addr);
425}
426
407static void txq_enable(struct tx_queue *txq) 427static void txq_enable(struct tx_queue *txq)
408{ 428{
409 struct mv643xx_eth_private *mp = txq_to_mp(txq); 429 struct mv643xx_eth_private *mp = txq_to_mp(txq);
@@ -614,6 +634,12 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
614 for (i = 0; i < 8; i++) 634 for (i = 0; i < 8; i++)
615 if (mp->txq_mask & (1 << i)) 635 if (mp->txq_mask & (1 << i))
616 txq_reclaim(mp->txq + i, 0); 636 txq_reclaim(mp->txq + i, 0);
637
638 if (netif_carrier_ok(mp->dev)) {
639 spin_lock(&mp->lock);
640 __txq_maybe_wake(mp->txq + mp->txq_primary);
641 spin_unlock(&mp->lock);
642 }
617 } 643 }
618#endif 644#endif
619 645
@@ -706,6 +732,7 @@ static inline __be16 sum16_as_be(__sum16 sum)
706 732
707static void txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb) 733static void txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb)
708{ 734{
735 struct mv643xx_eth_private *mp = txq_to_mp(txq);
709 int nr_frags = skb_shinfo(skb)->nr_frags; 736 int nr_frags = skb_shinfo(skb)->nr_frags;
710 int tx_index; 737 int tx_index;
711 struct tx_desc *desc; 738 struct tx_desc *desc;
@@ -732,12 +759,36 @@ static void txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb)
732 desc->buf_ptr = dma_map_single(NULL, skb->data, length, DMA_TO_DEVICE); 759 desc->buf_ptr = dma_map_single(NULL, skb->data, length, DMA_TO_DEVICE);
733 760
734 if (skb->ip_summed == CHECKSUM_PARTIAL) { 761 if (skb->ip_summed == CHECKSUM_PARTIAL) {
735 BUG_ON(skb->protocol != htons(ETH_P_IP)); 762 int mac_hdr_len;
763
764 BUG_ON(skb->protocol != htons(ETH_P_IP) &&
765 skb->protocol != htons(ETH_P_8021Q));
736 766
737 cmd_sts |= GEN_TCP_UDP_CHECKSUM | 767 cmd_sts |= GEN_TCP_UDP_CHECKSUM |
738 GEN_IP_V4_CHECKSUM | 768 GEN_IP_V4_CHECKSUM |
739 ip_hdr(skb)->ihl << TX_IHL_SHIFT; 769 ip_hdr(skb)->ihl << TX_IHL_SHIFT;
740 770
771 mac_hdr_len = (void *)ip_hdr(skb) - (void *)skb->data;
772 switch (mac_hdr_len - ETH_HLEN) {
773 case 0:
774 break;
775 case 4:
776 cmd_sts |= MAC_HDR_EXTRA_4_BYTES;
777 break;
778 case 8:
779 cmd_sts |= MAC_HDR_EXTRA_8_BYTES;
780 break;
781 case 12:
782 cmd_sts |= MAC_HDR_EXTRA_4_BYTES;
783 cmd_sts |= MAC_HDR_EXTRA_8_BYTES;
784 break;
785 default:
786 if (net_ratelimit())
787 dev_printk(KERN_ERR, &txq_to_mp(txq)->dev->dev,
788 "mac header length is %d?!\n", mac_hdr_len);
789 break;
790 }
791
741 switch (ip_hdr(skb)->protocol) { 792 switch (ip_hdr(skb)->protocol) {
742 case IPPROTO_UDP: 793 case IPPROTO_UDP:
743 cmd_sts |= UDP_FRAME; 794 cmd_sts |= UDP_FRAME;
@@ -759,6 +810,10 @@ static void txq_submit_skb(struct tx_queue *txq, struct sk_buff *skb)
759 wmb(); 810 wmb();
760 desc->cmd_sts = cmd_sts; 811 desc->cmd_sts = cmd_sts;
761 812
813 /* clear TX_END interrupt status */
814 wrl(mp, INT_CAUSE(mp->port_num), ~(INT_TX_END_0 << txq->index));
815 rdl(mp, INT_CAUSE(mp->port_num));
816
762 /* ensure all descriptors are written before poking hardware */ 817 /* ensure all descriptors are written before poking hardware */
763 wmb(); 818 wmb();
764 txq_enable(txq); 819 txq_enable(txq);
@@ -1112,10 +1167,28 @@ static int mv643xx_eth_get_settings(struct net_device *dev, struct ethtool_cmd *
1112 1167
1113static int mv643xx_eth_get_settings_phyless(struct net_device *dev, struct ethtool_cmd *cmd) 1168static int mv643xx_eth_get_settings_phyless(struct net_device *dev, struct ethtool_cmd *cmd)
1114{ 1169{
1170 struct mv643xx_eth_private *mp = netdev_priv(dev);
1171 u32 port_status;
1172
1173 port_status = rdl(mp, PORT_STATUS(mp->port_num));
1174
1115 cmd->supported = SUPPORTED_MII; 1175 cmd->supported = SUPPORTED_MII;
1116 cmd->advertising = ADVERTISED_MII; 1176 cmd->advertising = ADVERTISED_MII;
1117 cmd->speed = SPEED_1000; 1177 switch (port_status & PORT_SPEED_MASK) {
1118 cmd->duplex = DUPLEX_FULL; 1178 case PORT_SPEED_10:
1179 cmd->speed = SPEED_10;
1180 break;
1181 case PORT_SPEED_100:
1182 cmd->speed = SPEED_100;
1183 break;
1184 case PORT_SPEED_1000:
1185 cmd->speed = SPEED_1000;
1186 break;
1187 default:
1188 cmd->speed = -1;
1189 break;
1190 }
1191 cmd->duplex = (port_status & FULL_DUPLEX) ? DUPLEX_FULL : DUPLEX_HALF;
1119 cmd->port = PORT_MII; 1192 cmd->port = PORT_MII;
1120 cmd->phy_address = 0; 1193 cmd->phy_address = 0;
1121 cmd->transceiver = XCVR_INTERNAL; 1194 cmd->transceiver = XCVR_INTERNAL;
@@ -1539,8 +1612,11 @@ static int txq_init(struct mv643xx_eth_private *mp, int index)
1539 1612
1540 tx_desc = (struct tx_desc *)txq->tx_desc_area; 1613 tx_desc = (struct tx_desc *)txq->tx_desc_area;
1541 for (i = 0; i < txq->tx_ring_size; i++) { 1614 for (i = 0; i < txq->tx_ring_size; i++) {
1615 struct tx_desc *txd = tx_desc + i;
1542 int nexti = (i + 1) % txq->tx_ring_size; 1616 int nexti = (i + 1) % txq->tx_ring_size;
1543 tx_desc[i].next_desc_ptr = txq->tx_desc_dma + 1617
1618 txd->cmd_sts = 0;
1619 txd->next_desc_ptr = txq->tx_desc_dma +
1544 nexti * sizeof(struct tx_desc); 1620 nexti * sizeof(struct tx_desc);
1545 } 1621 }
1546 1622
@@ -1577,8 +1653,11 @@ static void txq_reclaim(struct tx_queue *txq, int force)
1577 desc = &txq->tx_desc_area[tx_index]; 1653 desc = &txq->tx_desc_area[tx_index];
1578 cmd_sts = desc->cmd_sts; 1654 cmd_sts = desc->cmd_sts;
1579 1655
1580 if (!force && (cmd_sts & BUFFER_OWNED_BY_DMA)) 1656 if (cmd_sts & BUFFER_OWNED_BY_DMA) {
1581 break; 1657 if (!force)
1658 break;
1659 desc->cmd_sts = cmd_sts & ~BUFFER_OWNED_BY_DMA;
1660 }
1582 1661
1583 txq->tx_used_desc = (tx_index + 1) % txq->tx_ring_size; 1662 txq->tx_used_desc = (tx_index + 1) % txq->tx_ring_size;
1584 txq->tx_desc_count--; 1663 txq->tx_desc_count--;
@@ -1632,49 +1711,61 @@ static void txq_deinit(struct tx_queue *txq)
1632 1711
1633 1712
1634/* netdev ops and related ***************************************************/ 1713/* netdev ops and related ***************************************************/
1635static void update_pscr(struct mv643xx_eth_private *mp, int speed, int duplex) 1714static void handle_link_event(struct mv643xx_eth_private *mp)
1636{ 1715{
1637 u32 pscr_o; 1716 struct net_device *dev = mp->dev;
1638 u32 pscr_n; 1717 u32 port_status;
1639 1718 int speed;
1640 pscr_o = rdl(mp, PORT_SERIAL_CONTROL(mp->port_num)); 1719 int duplex;
1720 int fc;
1721
1722 port_status = rdl(mp, PORT_STATUS(mp->port_num));
1723 if (!(port_status & LINK_UP)) {
1724 if (netif_carrier_ok(dev)) {
1725 int i;
1641 1726
1642 /* clear speed, duplex and rx buffer size fields */ 1727 printk(KERN_INFO "%s: link down\n", dev->name);
1643 pscr_n = pscr_o & ~(SET_MII_SPEED_TO_100 |
1644 SET_GMII_SPEED_TO_1000 |
1645 SET_FULL_DUPLEX_MODE |
1646 MAX_RX_PACKET_MASK);
1647 1728
1648 if (speed == SPEED_1000) { 1729 netif_carrier_off(dev);
1649 pscr_n |= SET_GMII_SPEED_TO_1000 | MAX_RX_PACKET_9700BYTE; 1730 netif_stop_queue(dev);
1650 } else {
1651 if (speed == SPEED_100)
1652 pscr_n |= SET_MII_SPEED_TO_100;
1653 pscr_n |= MAX_RX_PACKET_1522BYTE;
1654 }
1655 1731
1656 if (duplex == DUPLEX_FULL) 1732 for (i = 0; i < 8; i++) {
1657 pscr_n |= SET_FULL_DUPLEX_MODE; 1733 struct tx_queue *txq = mp->txq + i;
1658 1734
1659 if (pscr_n != pscr_o) { 1735 if (mp->txq_mask & (1 << i)) {
1660 if ((pscr_o & SERIAL_PORT_ENABLE) == 0) 1736 txq_reclaim(txq, 1);
1661 wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr_n); 1737 txq_reset_hw_ptr(txq);
1662 else { 1738 }
1663 int i; 1739 }
1740 }
1741 return;
1742 }
1664 1743
1665 for (i = 0; i < 8; i++) 1744 switch (port_status & PORT_SPEED_MASK) {
1666 if (mp->txq_mask & (1 << i)) 1745 case PORT_SPEED_10:
1667 txq_disable(mp->txq + i); 1746 speed = 10;
1747 break;
1748 case PORT_SPEED_100:
1749 speed = 100;
1750 break;
1751 case PORT_SPEED_1000:
1752 speed = 1000;
1753 break;
1754 default:
1755 speed = -1;
1756 break;
1757 }
1758 duplex = (port_status & FULL_DUPLEX) ? 1 : 0;
1759 fc = (port_status & FLOW_CONTROL_ENABLED) ? 1 : 0;
1668 1760
1669 pscr_o &= ~SERIAL_PORT_ENABLE; 1761 printk(KERN_INFO "%s: link up, %d Mb/s, %s duplex, "
1670 wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr_o); 1762 "flow control %sabled\n", dev->name,
1671 wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr_n); 1763 speed, duplex ? "full" : "half",
1672 wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr_n); 1764 fc ? "en" : "dis");
1673 1765
1674 for (i = 0; i < 8; i++) 1766 if (!netif_carrier_ok(dev)) {
1675 if (mp->txq_mask & (1 << i)) 1767 netif_carrier_on(dev);
1676 txq_enable(mp->txq + i); 1768 netif_wake_queue(dev);
1677 }
1678 } 1769 }
1679} 1770}
1680 1771
@@ -1684,7 +1775,6 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id)
1684 struct mv643xx_eth_private *mp = netdev_priv(dev); 1775 struct mv643xx_eth_private *mp = netdev_priv(dev);
1685 u32 int_cause; 1776 u32 int_cause;
1686 u32 int_cause_ext; 1777 u32 int_cause_ext;
1687 u32 txq_active;
1688 1778
1689 int_cause = rdl(mp, INT_CAUSE(mp->port_num)) & 1779 int_cause = rdl(mp, INT_CAUSE(mp->port_num)) &
1690 (INT_TX_END | INT_RX | INT_EXT); 1780 (INT_TX_END | INT_RX | INT_EXT);
@@ -1698,30 +1788,8 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id)
1698 wrl(mp, INT_CAUSE_EXT(mp->port_num), ~int_cause_ext); 1788 wrl(mp, INT_CAUSE_EXT(mp->port_num), ~int_cause_ext);
1699 } 1789 }
1700 1790
1701 if (int_cause_ext & (INT_EXT_PHY | INT_EXT_LINK)) { 1791 if (int_cause_ext & (INT_EXT_PHY | INT_EXT_LINK))
1702 if (mp->phy_addr == -1 || mii_link_ok(&mp->mii)) { 1792 handle_link_event(mp);
1703 int i;
1704
1705 if (mp->phy_addr != -1) {
1706 struct ethtool_cmd cmd;
1707
1708 mii_ethtool_gset(&mp->mii, &cmd);
1709 update_pscr(mp, cmd.speed, cmd.duplex);
1710 }
1711
1712 for (i = 0; i < 8; i++)
1713 if (mp->txq_mask & (1 << i))
1714 txq_enable(mp->txq + i);
1715
1716 if (!netif_carrier_ok(dev)) {
1717 netif_carrier_on(dev);
1718 __txq_maybe_wake(mp->txq + mp->txq_primary);
1719 }
1720 } else if (netif_carrier_ok(dev)) {
1721 netif_stop_queue(dev);
1722 netif_carrier_off(dev);
1723 }
1724 }
1725 1793
1726 /* 1794 /*
1727 * RxBuffer or RxError set for any of the 8 queues? 1795 * RxBuffer or RxError set for any of the 8 queues?
@@ -1743,8 +1811,6 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id)
1743 } 1811 }
1744#endif 1812#endif
1745 1813
1746 txq_active = rdl(mp, TXQ_COMMAND(mp->port_num));
1747
1748 /* 1814 /*
1749 * TxBuffer or TxError set for any of the 8 queues? 1815 * TxBuffer or TxError set for any of the 8 queues?
1750 */ 1816 */
@@ -1754,6 +1820,16 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id)
1754 for (i = 0; i < 8; i++) 1820 for (i = 0; i < 8; i++)
1755 if (mp->txq_mask & (1 << i)) 1821 if (mp->txq_mask & (1 << i))
1756 txq_reclaim(mp->txq + i, 0); 1822 txq_reclaim(mp->txq + i, 0);
1823
1824 /*
1825 * Enough space again in the primary TX queue for a
1826 * full packet?
1827 */
1828 if (netif_carrier_ok(dev)) {
1829 spin_lock(&mp->lock);
1830 __txq_maybe_wake(mp->txq + mp->txq_primary);
1831 spin_unlock(&mp->lock);
1832 }
1757 } 1833 }
1758 1834
1759 /* 1835 /*
@@ -1763,19 +1839,25 @@ static irqreturn_t mv643xx_eth_irq(int irq, void *dev_id)
1763 int i; 1839 int i;
1764 1840
1765 wrl(mp, INT_CAUSE(mp->port_num), ~(int_cause & INT_TX_END)); 1841 wrl(mp, INT_CAUSE(mp->port_num), ~(int_cause & INT_TX_END));
1842
1843 spin_lock(&mp->lock);
1766 for (i = 0; i < 8; i++) { 1844 for (i = 0; i < 8; i++) {
1767 struct tx_queue *txq = mp->txq + i; 1845 struct tx_queue *txq = mp->txq + i;
1768 if (txq->tx_desc_count && !((txq_active >> i) & 1)) 1846 u32 hw_desc_ptr;
1847 u32 expected_ptr;
1848
1849 if ((int_cause & (INT_TX_END_0 << i)) == 0)
1850 continue;
1851
1852 hw_desc_ptr =
1853 rdl(mp, TXQ_CURRENT_DESC_PTR(mp->port_num, i));
1854 expected_ptr = (u32)txq->tx_desc_dma +
1855 txq->tx_curr_desc * sizeof(struct tx_desc);
1856
1857 if (hw_desc_ptr != expected_ptr)
1769 txq_enable(txq); 1858 txq_enable(txq);
1770 } 1859 }
1771 } 1860 spin_unlock(&mp->lock);
1772
1773 /*
1774 * Enough space again in the primary TX queue for a full packet?
1775 */
1776 if (int_cause_ext & INT_EXT_TX) {
1777 struct tx_queue *txq = mp->txq + mp->txq_primary;
1778 __txq_maybe_wake(txq);
1779 } 1861 }
1780 1862
1781 return IRQ_HANDLED; 1863 return IRQ_HANDLED;
@@ -1785,14 +1867,14 @@ static void phy_reset(struct mv643xx_eth_private *mp)
1785{ 1867{
1786 unsigned int data; 1868 unsigned int data;
1787 1869
1788 smi_reg_read(mp, mp->phy_addr, 0, &data); 1870 smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
1789 data |= 0x8000; 1871 data |= BMCR_RESET;
1790 smi_reg_write(mp, mp->phy_addr, 0, data); 1872 smi_reg_write(mp, mp->phy_addr, MII_BMCR, data);
1791 1873
1792 do { 1874 do {
1793 udelay(1); 1875 udelay(1);
1794 smi_reg_read(mp, mp->phy_addr, 0, &data); 1876 smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
1795 } while (data & 0x8000); 1877 } while (data & BMCR_RESET);
1796} 1878}
1797 1879
1798static void port_start(struct mv643xx_eth_private *mp) 1880static void port_start(struct mv643xx_eth_private *mp)
@@ -1801,23 +1883,6 @@ static void port_start(struct mv643xx_eth_private *mp)
1801 int i; 1883 int i;
1802 1884
1803 /* 1885 /*
1804 * Configure basic link parameters.
1805 */
1806 pscr = rdl(mp, PORT_SERIAL_CONTROL(mp->port_num));
1807 pscr &= ~(SERIAL_PORT_ENABLE | FORCE_LINK_PASS);
1808 wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
1809 pscr |= DISABLE_AUTO_NEG_FOR_FLOW_CTRL |
1810 DISABLE_AUTO_NEG_SPEED_GMII |
1811 DISABLE_AUTO_NEG_FOR_DUPLEX |
1812 DO_NOT_FORCE_LINK_FAIL |
1813 SERIAL_PORT_CONTROL_RESERVED;
1814 wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
1815 pscr |= SERIAL_PORT_ENABLE;
1816 wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
1817
1818 wrl(mp, SDMA_CONFIG(mp->port_num), PORT_SDMA_CONFIG_DEFAULT_VALUE);
1819
1820 /*
1821 * Perform PHY reset, if there is a PHY. 1886 * Perform PHY reset, if there is a PHY.
1822 */ 1887 */
1823 if (mp->phy_addr != -1) { 1888 if (mp->phy_addr != -1) {
@@ -1829,21 +1894,31 @@ static void port_start(struct mv643xx_eth_private *mp)
1829 } 1894 }
1830 1895
1831 /* 1896 /*
1897 * Configure basic link parameters.
1898 */
1899 pscr = rdl(mp, PORT_SERIAL_CONTROL(mp->port_num));
1900
1901 pscr |= SERIAL_PORT_ENABLE;
1902 wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
1903
1904 pscr |= DO_NOT_FORCE_LINK_FAIL;
1905 if (mp->phy_addr == -1)
1906 pscr |= FORCE_LINK_PASS;
1907 wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
1908
1909 wrl(mp, SDMA_CONFIG(mp->port_num), PORT_SDMA_CONFIG_DEFAULT_VALUE);
1910
1911 /*
1832 * Configure TX path and queues. 1912 * Configure TX path and queues.
1833 */ 1913 */
1834 tx_set_rate(mp, 1000000000, 16777216); 1914 tx_set_rate(mp, 1000000000, 16777216);
1835 for (i = 0; i < 8; i++) { 1915 for (i = 0; i < 8; i++) {
1836 struct tx_queue *txq = mp->txq + i; 1916 struct tx_queue *txq = mp->txq + i;
1837 int off = TXQ_CURRENT_DESC_PTR(mp->port_num, i);
1838 u32 addr;
1839 1917
1840 if ((mp->txq_mask & (1 << i)) == 0) 1918 if ((mp->txq_mask & (1 << i)) == 0)
1841 continue; 1919 continue;
1842 1920
1843 addr = (u32)txq->tx_desc_dma; 1921 txq_reset_hw_ptr(txq);
1844 addr += txq->tx_curr_desc * sizeof(struct tx_desc);
1845 wrl(mp, off, addr);
1846
1847 txq_set_rate(txq, 1000000000, 16777216); 1922 txq_set_rate(txq, 1000000000, 16777216);
1848 txq_set_fixed_prio_mode(txq); 1923 txq_set_fixed_prio_mode(txq);
1849 } 1924 }
@@ -1965,6 +2040,9 @@ static int mv643xx_eth_open(struct net_device *dev)
1965 napi_enable(&mp->napi); 2040 napi_enable(&mp->napi);
1966#endif 2041#endif
1967 2042
2043 netif_carrier_off(dev);
2044 netif_stop_queue(dev);
2045
1968 port_start(mp); 2046 port_start(mp);
1969 2047
1970 set_rx_coal(mp, 0); 2048 set_rx_coal(mp, 0);
@@ -1999,8 +2077,14 @@ static void port_reset(struct mv643xx_eth_private *mp)
1999 if (mp->txq_mask & (1 << i)) 2077 if (mp->txq_mask & (1 << i))
2000 txq_disable(mp->txq + i); 2078 txq_disable(mp->txq + i);
2001 } 2079 }
2002 while (!(rdl(mp, PORT_STATUS(mp->port_num)) & TX_FIFO_EMPTY)) 2080
2081 while (1) {
2082 u32 ps = rdl(mp, PORT_STATUS(mp->port_num));
2083
2084 if ((ps & (TX_IN_PROGRESS | TX_FIFO_EMPTY)) == TX_FIFO_EMPTY)
2085 break;
2003 udelay(10); 2086 udelay(10);
2087 }
2004 2088
2005 /* Reset the Enable bit in the Configuration Register */ 2089 /* Reset the Enable bit in the Configuration Register */
2006 data = rdl(mp, PORT_SERIAL_CONTROL(mp->port_num)); 2090 data = rdl(mp, PORT_SERIAL_CONTROL(mp->port_num));
@@ -2202,7 +2286,8 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
2202 int ret; 2286 int ret;
2203 2287
2204 if (!mv643xx_eth_version_printed++) 2288 if (!mv643xx_eth_version_printed++)
2205 printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); 2289 printk(KERN_NOTICE "MV-643xx 10/100/1000 ethernet "
2290 "driver version %s\n", mv643xx_eth_driver_version);
2206 2291
2207 ret = -EINVAL; 2292 ret = -EINVAL;
2208 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2293 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -2338,14 +2423,14 @@ static int phy_detect(struct mv643xx_eth_private *mp)
2338 unsigned int data; 2423 unsigned int data;
2339 unsigned int data2; 2424 unsigned int data2;
2340 2425
2341 smi_reg_read(mp, mp->phy_addr, 0, &data); 2426 smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data);
2342 smi_reg_write(mp, mp->phy_addr, 0, data ^ 0x1000); 2427 smi_reg_write(mp, mp->phy_addr, MII_BMCR, data ^ BMCR_ANENABLE);
2343 2428
2344 smi_reg_read(mp, mp->phy_addr, 0, &data2); 2429 smi_reg_read(mp, mp->phy_addr, MII_BMCR, &data2);
2345 if (((data ^ data2) & 0x1000) == 0) 2430 if (((data ^ data2) & BMCR_ANENABLE) == 0)
2346 return -ENODEV; 2431 return -ENODEV;
2347 2432
2348 smi_reg_write(mp, mp->phy_addr, 0, data); 2433 smi_reg_write(mp, mp->phy_addr, MII_BMCR, data);
2349 2434
2350 return 0; 2435 return 0;
2351} 2436}
@@ -2393,12 +2478,39 @@ static int phy_init(struct mv643xx_eth_private *mp,
2393 cmd.duplex = pd->duplex; 2478 cmd.duplex = pd->duplex;
2394 } 2479 }
2395 2480
2396 update_pscr(mp, cmd.speed, cmd.duplex);
2397 mv643xx_eth_set_settings(mp->dev, &cmd); 2481 mv643xx_eth_set_settings(mp->dev, &cmd);
2398 2482
2399 return 0; 2483 return 0;
2400} 2484}
2401 2485
2486static void init_pscr(struct mv643xx_eth_private *mp, int speed, int duplex)
2487{
2488 u32 pscr;
2489
2490 pscr = rdl(mp, PORT_SERIAL_CONTROL(mp->port_num));
2491 if (pscr & SERIAL_PORT_ENABLE) {
2492 pscr &= ~SERIAL_PORT_ENABLE;
2493 wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
2494 }
2495
2496 pscr = MAX_RX_PACKET_9700BYTE | SERIAL_PORT_CONTROL_RESERVED;
2497 if (mp->phy_addr == -1) {
2498 pscr |= DISABLE_AUTO_NEG_SPEED_GMII;
2499 if (speed == SPEED_1000)
2500 pscr |= SET_GMII_SPEED_TO_1000;
2501 else if (speed == SPEED_100)
2502 pscr |= SET_MII_SPEED_TO_100;
2503
2504 pscr |= DISABLE_AUTO_NEG_FOR_FLOW_CTRL;
2505
2506 pscr |= DISABLE_AUTO_NEG_FOR_DUPLEX;
2507 if (duplex == DUPLEX_FULL)
2508 pscr |= SET_FULL_DUPLEX_MODE;
2509 }
2510
2511 wrl(mp, PORT_SERIAL_CONTROL(mp->port_num), pscr);
2512}
2513
2402static int mv643xx_eth_probe(struct platform_device *pdev) 2514static int mv643xx_eth_probe(struct platform_device *pdev)
2403{ 2515{
2404 struct mv643xx_eth_platform_data *pd; 2516 struct mv643xx_eth_platform_data *pd;
@@ -2452,6 +2564,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
2452 } else { 2564 } else {
2453 SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops_phyless); 2565 SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops_phyless);
2454 } 2566 }
2567 init_pscr(mp, pd->speed, pd->duplex);
2455 2568
2456 2569
2457 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 2570 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -2478,6 +2591,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
2478 * have to map the buffers to ISA memory which is only 16 MB 2591 * have to map the buffers to ISA memory which is only 16 MB
2479 */ 2592 */
2480 dev->features = NETIF_F_SG | NETIF_F_IP_CSUM; 2593 dev->features = NETIF_F_SG | NETIF_F_IP_CSUM;
2594 dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM;
2481#endif 2595#endif
2482 2596
2483 SET_NETDEV_DEV(dev, &pdev->dev); 2597 SET_NETDEV_DEV(dev, &pdev->dev);
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index 2fec6122c7fa..42443d697423 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -536,7 +536,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr)
536#ifdef CONFIG_NET_POLL_CONTROLLER 536#ifdef CONFIG_NET_POLL_CONTROLLER
537 dev->poll_controller = eip_poll; 537 dev->poll_controller = eip_poll;
538#endif 538#endif
539 NS8390_init(dev, 0); 539 NS8390p_init(dev, 0);
540 540
541 ret = register_netdev(dev); 541 ret = register_netdev(dev);
542 if (ret) 542 if (ret)
@@ -794,7 +794,7 @@ retry:
794 if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ 794 if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */
795 printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name); 795 printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
796 ne_reset_8390(dev); 796 ne_reset_8390(dev);
797 NS8390_init(dev,1); 797 NS8390p_init(dev, 1);
798 break; 798 break;
799 } 799 }
800 800
@@ -855,7 +855,7 @@ static int ne_drv_resume(struct platform_device *pdev)
855 855
856 if (netif_running(dev)) { 856 if (netif_running(dev)) {
857 ne_reset_8390(dev); 857 ne_reset_8390(dev);
858 NS8390_init(dev, 1); 858 NS8390p_init(dev, 1);
859 netif_device_attach(dev); 859 netif_device_attach(dev);
860 } 860 }
861 return 0; 861 return 0;
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 8ee7d7bb951b..e4765b713aba 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -6417,7 +6417,7 @@ static int niu_ethflow_to_class(int flow_type, u64 *class)
6417 *class = CLASS_CODE_SCTP_IPV6; 6417 *class = CLASS_CODE_SCTP_IPV6;
6418 break; 6418 break;
6419 default: 6419 default:
6420 return -1; 6420 return 0;
6421 } 6421 }
6422 6422
6423 return 1; 6423 return 1;
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c
index 6b2dee0cf3a9..a834b52a6a2c 100644
--- a/drivers/net/ps3_gelic_wireless.c
+++ b/drivers/net/ps3_gelic_wireless.c
@@ -1024,7 +1024,7 @@ static int gelic_wl_set_encode(struct net_device *netdev,
1024 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); 1024 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev));
1025 struct iw_point *enc = &data->encoding; 1025 struct iw_point *enc = &data->encoding;
1026 __u16 flags; 1026 __u16 flags;
1027 unsigned int irqflag; 1027 unsigned long irqflag;
1028 int key_index, index_specified; 1028 int key_index, index_specified;
1029 int ret = 0; 1029 int ret = 0;
1030 1030
@@ -1097,7 +1097,7 @@ static int gelic_wl_get_encode(struct net_device *netdev,
1097{ 1097{
1098 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); 1098 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev));
1099 struct iw_point *enc = &data->encoding; 1099 struct iw_point *enc = &data->encoding;
1100 unsigned int irqflag; 1100 unsigned long irqflag;
1101 unsigned int key_index, index_specified; 1101 unsigned int key_index, index_specified;
1102 int ret = 0; 1102 int ret = 0;
1103 1103
@@ -1215,7 +1215,7 @@ static int gelic_wl_set_encodeext(struct net_device *netdev,
1215 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1215 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1216 __u16 alg; 1216 __u16 alg;
1217 __u16 flags; 1217 __u16 flags;
1218 unsigned int irqflag; 1218 unsigned long irqflag;
1219 int key_index; 1219 int key_index;
1220 int ret = 0; 1220 int ret = 0;
1221 1221
@@ -1303,7 +1303,7 @@ static int gelic_wl_get_encodeext(struct net_device *netdev,
1303 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev)); 1303 struct gelic_wl_info *wl = port_wl(netdev_priv(netdev));
1304 struct iw_point *enc = &data->encoding; 1304 struct iw_point *enc = &data->encoding;
1305 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1305 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1306 unsigned int irqflag; 1306 unsigned long irqflag;
1307 int key_index; 1307 int key_index;
1308 int ret = 0; 1308 int ret = 0;
1309 int max_key_len; 1309 int max_key_len;
@@ -1426,7 +1426,7 @@ static int gelic_wl_priv_set_psk(struct net_device *net_dev,
1426{ 1426{
1427 struct gelic_wl_info *wl = port_wl(netdev_priv(net_dev)); 1427 struct gelic_wl_info *wl = port_wl(netdev_priv(net_dev));
1428 unsigned int len; 1428 unsigned int len;
1429 unsigned int irqflag; 1429 unsigned long irqflag;
1430 int ret = 0; 1430 int ret = 0;
1431 1431
1432 pr_debug("%s:<- len=%d\n", __func__, data->data.length); 1432 pr_debug("%s:<- len=%d\n", __func__, data->data.length);
@@ -1467,7 +1467,7 @@ static int gelic_wl_priv_get_psk(struct net_device *net_dev,
1467{ 1467{
1468 struct gelic_wl_info *wl = port_wl(netdev_priv(net_dev)); 1468 struct gelic_wl_info *wl = port_wl(netdev_priv(net_dev));
1469 char *p; 1469 char *p;
1470 unsigned int irqflag; 1470 unsigned long irqflag;
1471 unsigned int i; 1471 unsigned int i;
1472 1472
1473 pr_debug("%s:<-\n", __func__); 1473 pr_debug("%s:<-\n", __func__);
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 86d77d05190a..a2b073097e5c 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -3143,7 +3143,7 @@ static void tx_intr_handler(struct fifo_info *fifo_data)
3143 pkt_cnt++; 3143 pkt_cnt++;
3144 3144
3145 /* Updating the statistics block */ 3145 /* Updating the statistics block */
3146 nic->stats.tx_bytes += skb->len; 3146 nic->dev->stats.tx_bytes += skb->len;
3147 nic->mac_control.stats_info->sw_stat.mem_freed += skb->truesize; 3147 nic->mac_control.stats_info->sw_stat.mem_freed += skb->truesize;
3148 dev_kfree_skb_irq(skb); 3148 dev_kfree_skb_irq(skb);
3149 3149
@@ -4896,25 +4896,42 @@ static struct net_device_stats *s2io_get_stats(struct net_device *dev)
4896 /* Configure Stats for immediate updt */ 4896 /* Configure Stats for immediate updt */
4897 s2io_updt_stats(sp); 4897 s2io_updt_stats(sp);
4898 4898
4899 /* Using sp->stats as a staging area, because reset (due to mtu
4900 change, for example) will clear some hardware counters */
4901 dev->stats.tx_packets +=
4902 le32_to_cpu(mac_control->stats_info->tmac_frms) -
4903 sp->stats.tx_packets;
4899 sp->stats.tx_packets = 4904 sp->stats.tx_packets =
4900 le32_to_cpu(mac_control->stats_info->tmac_frms); 4905 le32_to_cpu(mac_control->stats_info->tmac_frms);
4906 dev->stats.tx_errors +=
4907 le32_to_cpu(mac_control->stats_info->tmac_any_err_frms) -
4908 sp->stats.tx_errors;
4901 sp->stats.tx_errors = 4909 sp->stats.tx_errors =
4902 le32_to_cpu(mac_control->stats_info->tmac_any_err_frms); 4910 le32_to_cpu(mac_control->stats_info->tmac_any_err_frms);
4911 dev->stats.rx_errors +=
4912 le64_to_cpu(mac_control->stats_info->rmac_drop_frms) -
4913 sp->stats.rx_errors;
4903 sp->stats.rx_errors = 4914 sp->stats.rx_errors =
4904 le64_to_cpu(mac_control->stats_info->rmac_drop_frms); 4915 le64_to_cpu(mac_control->stats_info->rmac_drop_frms);
4916 dev->stats.multicast =
4917 le32_to_cpu(mac_control->stats_info->rmac_vld_mcst_frms) -
4918 sp->stats.multicast;
4905 sp->stats.multicast = 4919 sp->stats.multicast =
4906 le32_to_cpu(mac_control->stats_info->rmac_vld_mcst_frms); 4920 le32_to_cpu(mac_control->stats_info->rmac_vld_mcst_frms);
4921 dev->stats.rx_length_errors =
4922 le64_to_cpu(mac_control->stats_info->rmac_long_frms) -
4923 sp->stats.rx_length_errors;
4907 sp->stats.rx_length_errors = 4924 sp->stats.rx_length_errors =
4908 le64_to_cpu(mac_control->stats_info->rmac_long_frms); 4925 le64_to_cpu(mac_control->stats_info->rmac_long_frms);
4909 4926
4910 /* collect per-ring rx_packets and rx_bytes */ 4927 /* collect per-ring rx_packets and rx_bytes */
4911 sp->stats.rx_packets = sp->stats.rx_bytes = 0; 4928 dev->stats.rx_packets = dev->stats.rx_bytes = 0;
4912 for (i = 0; i < config->rx_ring_num; i++) { 4929 for (i = 0; i < config->rx_ring_num; i++) {
4913 sp->stats.rx_packets += mac_control->rings[i].rx_packets; 4930 dev->stats.rx_packets += mac_control->rings[i].rx_packets;
4914 sp->stats.rx_bytes += mac_control->rings[i].rx_bytes; 4931 dev->stats.rx_bytes += mac_control->rings[i].rx_bytes;
4915 } 4932 }
4916 4933
4917 return (&sp->stats); 4934 return (&dev->stats);
4918} 4935}
4919 4936
4920/** 4937/**
@@ -7419,7 +7436,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
7419 if (err_mask != 0x5) { 7436 if (err_mask != 0x5) {
7420 DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%x\n", 7437 DBG_PRINT(ERR_DBG, "%s: Rx error Value: 0x%x\n",
7421 dev->name, err_mask); 7438 dev->name, err_mask);
7422 sp->stats.rx_crc_errors++; 7439 dev->stats.rx_crc_errors++;
7423 sp->mac_control.stats_info->sw_stat.mem_freed 7440 sp->mac_control.stats_info->sw_stat.mem_freed
7424 += skb->truesize; 7441 += skb->truesize;
7425 dev_kfree_skb(skb); 7442 dev_kfree_skb(skb);
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index c69ba1395fa9..6a06b9503e4f 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * SuperH Ethernet device driver 2 * SuperH Ethernet device driver
3 * 3 *
4 * Copyright (C) 2006,2007 Nobuhiro Iwamatsu 4 * Copyright (C) 2006-2008 Nobuhiro Iwamatsu
5 * Copyright (C) 2008 Renesas Solutions Corp. 5 * Copyright (C) 2008 Renesas Solutions Corp.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
@@ -143,13 +143,39 @@ static struct mdiobb_ops bb_ops = {
143 .get_mdio_data = sh_get_mdio, 143 .get_mdio_data = sh_get_mdio,
144}; 144};
145 145
146/* Chip Reset */
146static void sh_eth_reset(struct net_device *ndev) 147static void sh_eth_reset(struct net_device *ndev)
147{ 148{
148 u32 ioaddr = ndev->base_addr; 149 u32 ioaddr = ndev->base_addr;
149 150
151#if defined(CONFIG_CPU_SUBTYPE_SH7763)
152 int cnt = 100;
153
154 ctrl_outl(EDSR_ENALL, ioaddr + EDSR);
155 ctrl_outl(ctrl_inl(ioaddr + EDMR) | EDMR_SRST, ioaddr + EDMR);
156 while (cnt > 0) {
157 if (!(ctrl_inl(ioaddr + EDMR) & 0x3))
158 break;
159 mdelay(1);
160 cnt--;
161 }
162 if (cnt < 0)
163 printk(KERN_ERR "Device reset fail\n");
164
165 /* Table Init */
166 ctrl_outl(0x0, ioaddr + TDLAR);
167 ctrl_outl(0x0, ioaddr + TDFAR);
168 ctrl_outl(0x0, ioaddr + TDFXR);
169 ctrl_outl(0x0, ioaddr + TDFFR);
170 ctrl_outl(0x0, ioaddr + RDLAR);
171 ctrl_outl(0x0, ioaddr + RDFAR);
172 ctrl_outl(0x0, ioaddr + RDFXR);
173 ctrl_outl(0x0, ioaddr + RDFFR);
174#else
150 ctrl_outl(ctrl_inl(ioaddr + EDMR) | EDMR_SRST, ioaddr + EDMR); 175 ctrl_outl(ctrl_inl(ioaddr + EDMR) | EDMR_SRST, ioaddr + EDMR);
151 mdelay(3); 176 mdelay(3);
152 ctrl_outl(ctrl_inl(ioaddr + EDMR) & ~EDMR_SRST, ioaddr + EDMR); 177 ctrl_outl(ctrl_inl(ioaddr + EDMR) & ~EDMR_SRST, ioaddr + EDMR);
178#endif
153} 179}
154 180
155/* free skb and descriptor buffer */ 181/* free skb and descriptor buffer */
@@ -180,6 +206,7 @@ static void sh_eth_ring_free(struct net_device *ndev)
180/* format skb and descriptor buffer */ 206/* format skb and descriptor buffer */
181static void sh_eth_ring_format(struct net_device *ndev) 207static void sh_eth_ring_format(struct net_device *ndev)
182{ 208{
209 u32 ioaddr = ndev->base_addr, reserve = 0;
183 struct sh_eth_private *mdp = netdev_priv(ndev); 210 struct sh_eth_private *mdp = netdev_priv(ndev);
184 int i; 211 int i;
185 struct sk_buff *skb; 212 struct sk_buff *skb;
@@ -201,9 +228,15 @@ static void sh_eth_ring_format(struct net_device *ndev)
201 mdp->rx_skbuff[i] = skb; 228 mdp->rx_skbuff[i] = skb;
202 if (skb == NULL) 229 if (skb == NULL)
203 break; 230 break;
204 skb->dev = ndev; /* Mark as being used by this device. */ 231 skb->dev = ndev; /* Mark as being used by this device. */
232#if defined(CONFIG_CPU_SUBTYPE_SH7763)
233 reserve = SH7763_SKB_ALIGN
234 - ((uint32_t)skb->data & (SH7763_SKB_ALIGN-1));
235 if (reserve)
236 skb_reserve(skb, reserve);
237#else
205 skb_reserve(skb, RX_OFFSET); 238 skb_reserve(skb, RX_OFFSET);
206 239#endif
207 /* RX descriptor */ 240 /* RX descriptor */
208 rxdesc = &mdp->rx_ring[i]; 241 rxdesc = &mdp->rx_ring[i];
209 rxdesc->addr = (u32)skb->data & ~0x3UL; 242 rxdesc->addr = (u32)skb->data & ~0x3UL;
@@ -211,12 +244,25 @@ static void sh_eth_ring_format(struct net_device *ndev)
211 244
212 /* The size of the buffer is 16 byte boundary. */ 245 /* The size of the buffer is 16 byte boundary. */
213 rxdesc->buffer_length = (mdp->rx_buf_sz + 16) & ~0x0F; 246 rxdesc->buffer_length = (mdp->rx_buf_sz + 16) & ~0x0F;
247 /* Rx descriptor address set */
248 if (i == 0) {
249 ctrl_outl((u32)rxdesc, ioaddr + RDLAR);
250#if defined(CONFIG_CPU_SUBTYPE_SH7763)
251 ctrl_outl((u32)rxdesc, ioaddr + RDFAR);
252#endif
253 }
214 } 254 }
215 255
256 /* Rx descriptor address set */
257#if defined(CONFIG_CPU_SUBTYPE_SH7763)
258 ctrl_outl((u32)rxdesc, ioaddr + RDFXR);
259 ctrl_outl(0x1, ioaddr + RDFFR);
260#endif
261
216 mdp->dirty_rx = (u32) (i - RX_RING_SIZE); 262 mdp->dirty_rx = (u32) (i - RX_RING_SIZE);
217 263
218 /* Mark the last entry as wrapping the ring. */ 264 /* Mark the last entry as wrapping the ring. */
219 rxdesc->status |= cpu_to_le32(RC_RDEL); 265 rxdesc->status |= cpu_to_le32(RD_RDEL);
220 266
221 memset(mdp->tx_ring, 0, tx_ringsize); 267 memset(mdp->tx_ring, 0, tx_ringsize);
222 268
@@ -226,8 +272,21 @@ static void sh_eth_ring_format(struct net_device *ndev)
226 txdesc = &mdp->tx_ring[i]; 272 txdesc = &mdp->tx_ring[i];
227 txdesc->status = cpu_to_le32(TD_TFP); 273 txdesc->status = cpu_to_le32(TD_TFP);
228 txdesc->buffer_length = 0; 274 txdesc->buffer_length = 0;
275 if (i == 0) {
276 /* Rx descriptor address set */
277 ctrl_outl((u32)txdesc, ioaddr + TDLAR);
278#if defined(CONFIG_CPU_SUBTYPE_SH7763)
279 ctrl_outl((u32)txdesc, ioaddr + TDFAR);
280#endif
281 }
229 } 282 }
230 283
284 /* Rx descriptor address set */
285#if defined(CONFIG_CPU_SUBTYPE_SH7763)
286 ctrl_outl((u32)txdesc, ioaddr + TDFXR);
287 ctrl_outl(0x1, ioaddr + TDFFR);
288#endif
289
231 txdesc->status |= cpu_to_le32(TD_TDLE); 290 txdesc->status |= cpu_to_le32(TD_TDLE);
232} 291}
233 292
@@ -311,31 +370,43 @@ static int sh_eth_dev_init(struct net_device *ndev)
311 /* Soft Reset */ 370 /* Soft Reset */
312 sh_eth_reset(ndev); 371 sh_eth_reset(ndev);
313 372
314 ctrl_outl(RPADIR_PADS1, ioaddr + RPADIR); /* SH7712-DMA-RX-PAD2 */ 373 /* Descriptor format */
374 sh_eth_ring_format(ndev);
375 ctrl_outl(RPADIR_INIT, ioaddr + RPADIR);
315 376
316 /* all sh_eth int mask */ 377 /* all sh_eth int mask */
317 ctrl_outl(0, ioaddr + EESIPR); 378 ctrl_outl(0, ioaddr + EESIPR);
318 379
319 /* FIFO size set */ 380#if defined(CONFIG_CPU_SUBTYPE_SH7763)
381 ctrl_outl(EDMR_EL, ioaddr + EDMR);
382#else
320 ctrl_outl(0, ioaddr + EDMR); /* Endian change */ 383 ctrl_outl(0, ioaddr + EDMR); /* Endian change */
384#endif
321 385
386 /* FIFO size set */
322 ctrl_outl((FIFO_SIZE_T | FIFO_SIZE_R), ioaddr + FDR); 387 ctrl_outl((FIFO_SIZE_T | FIFO_SIZE_R), ioaddr + FDR);
323 ctrl_outl(0, ioaddr + TFTR); 388 ctrl_outl(0, ioaddr + TFTR);
324 389
390 /* Frame recv control */
325 ctrl_outl(0, ioaddr + RMCR); 391 ctrl_outl(0, ioaddr + RMCR);
326 392
327 rx_int_var = mdp->rx_int_var = DESC_I_RINT8 | DESC_I_RINT5; 393 rx_int_var = mdp->rx_int_var = DESC_I_RINT8 | DESC_I_RINT5;
328 tx_int_var = mdp->tx_int_var = DESC_I_TINT2; 394 tx_int_var = mdp->tx_int_var = DESC_I_TINT2;
329 ctrl_outl(rx_int_var | tx_int_var, ioaddr + TRSCER); 395 ctrl_outl(rx_int_var | tx_int_var, ioaddr + TRSCER);
330 396
397#if defined(CONFIG_CPU_SUBTYPE_SH7763)
398 /* Burst sycle set */
399 ctrl_outl(0x800, ioaddr + BCULR);
400#endif
401
331 ctrl_outl((FIFO_F_D_RFF | FIFO_F_D_RFD), ioaddr + FCFTR); 402 ctrl_outl((FIFO_F_D_RFF | FIFO_F_D_RFD), ioaddr + FCFTR);
332 ctrl_outl(0, ioaddr + TRIMD);
333 403
334 /* Descriptor format */ 404#if !defined(CONFIG_CPU_SUBTYPE_SH7763)
335 sh_eth_ring_format(ndev); 405 ctrl_outl(0, ioaddr + TRIMD);
406#endif
336 407
337 ctrl_outl((u32)mdp->rx_ring, ioaddr + RDLAR); 408 /* Recv frame limit set register */
338 ctrl_outl((u32)mdp->tx_ring, ioaddr + TDLAR); 409 ctrl_outl(RFLR_VALUE, ioaddr + RFLR);
339 410
340 ctrl_outl(ctrl_inl(ioaddr + EESR), ioaddr + EESR); 411 ctrl_outl(ctrl_inl(ioaddr + EESR), ioaddr + EESR);
341 ctrl_outl((DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff), ioaddr + EESIPR); 412 ctrl_outl((DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff), ioaddr + EESIPR);
@@ -345,21 +416,26 @@ static int sh_eth_dev_init(struct net_device *ndev)
345 ECMR_ZPF | (mdp->duplex ? ECMR_DM : 0) | ECMR_TE | ECMR_RE; 416 ECMR_ZPF | (mdp->duplex ? ECMR_DM : 0) | ECMR_TE | ECMR_RE;
346 417
347 ctrl_outl(val, ioaddr + ECMR); 418 ctrl_outl(val, ioaddr + ECMR);
348 ctrl_outl(ECSR_BRCRX | ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD | 419
349 ECSIPR_MPDIP, ioaddr + ECSR); 420 /* E-MAC Status Register clear */
350 ctrl_outl(ECSIPR_BRCRXIP | ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | 421 ctrl_outl(ECSR_INIT, ioaddr + ECSR);
351 ECSIPR_ICDIP | ECSIPR_MPDIP, ioaddr + ECSIPR); 422
423 /* E-MAC Interrupt Enable register */
424 ctrl_outl(ECSIPR_INIT, ioaddr + ECSIPR);
352 425
353 /* Set MAC address */ 426 /* Set MAC address */
354 update_mac_address(ndev); 427 update_mac_address(ndev);
355 428
356 /* mask reset */ 429 /* mask reset */
357#if defined(CONFIG_CPU_SUBTYPE_SH7710) 430#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7763)
358 ctrl_outl(APR_AP, ioaddr + APR); 431 ctrl_outl(APR_AP, ioaddr + APR);
359 ctrl_outl(MPR_MP, ioaddr + MPR); 432 ctrl_outl(MPR_MP, ioaddr + MPR);
360 ctrl_outl(TPAUSER_UNLIMITED, ioaddr + TPAUSER); 433 ctrl_outl(TPAUSER_UNLIMITED, ioaddr + TPAUSER);
434#endif
435#if defined(CONFIG_CPU_SUBTYPE_SH7710)
361 ctrl_outl(BCFR_UNLIMITED, ioaddr + BCFR); 436 ctrl_outl(BCFR_UNLIMITED, ioaddr + BCFR);
362#endif 437#endif
438
363 /* Setting the Rx mode will start the Rx process. */ 439 /* Setting the Rx mode will start the Rx process. */
364 ctrl_outl(EDRRR_R, ioaddr + EDRRR); 440 ctrl_outl(EDRRR_R, ioaddr + EDRRR);
365 441
@@ -407,7 +483,7 @@ static int sh_eth_rx(struct net_device *ndev)
407 int boguscnt = (mdp->dirty_rx + RX_RING_SIZE) - mdp->cur_rx; 483 int boguscnt = (mdp->dirty_rx + RX_RING_SIZE) - mdp->cur_rx;
408 struct sk_buff *skb; 484 struct sk_buff *skb;
409 u16 pkt_len = 0; 485 u16 pkt_len = 0;
410 u32 desc_status; 486 u32 desc_status, reserve = 0;
411 487
412 rxdesc = &mdp->rx_ring[entry]; 488 rxdesc = &mdp->rx_ring[entry];
413 while (!(rxdesc->status & cpu_to_le32(RD_RACT))) { 489 while (!(rxdesc->status & cpu_to_le32(RD_RACT))) {
@@ -454,28 +530,38 @@ static int sh_eth_rx(struct net_device *ndev)
454 for (; mdp->cur_rx - mdp->dirty_rx > 0; mdp->dirty_rx++) { 530 for (; mdp->cur_rx - mdp->dirty_rx > 0; mdp->dirty_rx++) {
455 entry = mdp->dirty_rx % RX_RING_SIZE; 531 entry = mdp->dirty_rx % RX_RING_SIZE;
456 rxdesc = &mdp->rx_ring[entry]; 532 rxdesc = &mdp->rx_ring[entry];
533 /* The size of the buffer is 16 byte boundary. */
534 rxdesc->buffer_length = (mdp->rx_buf_sz + 16) & ~0x0F;
535
457 if (mdp->rx_skbuff[entry] == NULL) { 536 if (mdp->rx_skbuff[entry] == NULL) {
458 skb = dev_alloc_skb(mdp->rx_buf_sz); 537 skb = dev_alloc_skb(mdp->rx_buf_sz);
459 mdp->rx_skbuff[entry] = skb; 538 mdp->rx_skbuff[entry] = skb;
460 if (skb == NULL) 539 if (skb == NULL)
461 break; /* Better luck next round. */ 540 break; /* Better luck next round. */
462 skb->dev = ndev; 541 skb->dev = ndev;
542#if defined(CONFIG_CPU_SUBTYPE_SH7763)
543 reserve = SH7763_SKB_ALIGN
544 - ((uint32_t)skb->data & (SH7763_SKB_ALIGN-1));
545 if (reserve)
546 skb_reserve(skb, reserve);
547#else
463 skb_reserve(skb, RX_OFFSET); 548 skb_reserve(skb, RX_OFFSET);
549#endif
550 skb->ip_summed = CHECKSUM_NONE;
464 rxdesc->addr = (u32)skb->data & ~0x3UL; 551 rxdesc->addr = (u32)skb->data & ~0x3UL;
465 } 552 }
466 /* The size of the buffer is 16 byte boundary. */
467 rxdesc->buffer_length = (mdp->rx_buf_sz + 16) & ~0x0F;
468 if (entry >= RX_RING_SIZE - 1) 553 if (entry >= RX_RING_SIZE - 1)
469 rxdesc->status |= 554 rxdesc->status |=
470 cpu_to_le32(RD_RACT | RD_RFP | RC_RDEL); 555 cpu_to_le32(RD_RACT | RD_RFP | RD_RDEL);
471 else 556 else
472 rxdesc->status |= 557 rxdesc->status |=
473 cpu_to_le32(RD_RACT | RD_RFP); 558 cpu_to_le32(RD_RACT | RD_RFP);
474 } 559 }
475 560
476 /* Restart Rx engine if stopped. */ 561 /* Restart Rx engine if stopped. */
477 /* If we don't need to check status, don't. -KDU */ 562 /* If we don't need to check status, don't. -KDU */
478 ctrl_outl(EDRRR_R, ndev->base_addr + EDRRR); 563 if (!(ctrl_inl(ndev->base_addr + EDRRR) & EDRRR_R))
564 ctrl_outl(EDRRR_R, ndev->base_addr + EDRRR);
479 565
480 return 0; 566 return 0;
481} 567}
@@ -529,13 +615,14 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
529 printk(KERN_ERR "Receive Frame Overflow\n"); 615 printk(KERN_ERR "Receive Frame Overflow\n");
530 } 616 }
531 } 617 }
532 618#if !defined(CONFIG_CPU_SUBTYPE_SH7763)
533 if (intr_status & EESR_ADE) { 619 if (intr_status & EESR_ADE) {
534 if (intr_status & EESR_TDE) { 620 if (intr_status & EESR_TDE) {
535 if (intr_status & EESR_TFE) 621 if (intr_status & EESR_TFE)
536 mdp->stats.tx_fifo_errors++; 622 mdp->stats.tx_fifo_errors++;
537 } 623 }
538 } 624 }
625#endif
539 626
540 if (intr_status & EESR_RDE) { 627 if (intr_status & EESR_RDE) {
541 /* Receive Descriptor Empty int */ 628 /* Receive Descriptor Empty int */
@@ -550,8 +637,11 @@ static void sh_eth_error(struct net_device *ndev, int intr_status)
550 mdp->stats.rx_fifo_errors++; 637 mdp->stats.rx_fifo_errors++;
551 printk(KERN_ERR "Receive FIFO Overflow\n"); 638 printk(KERN_ERR "Receive FIFO Overflow\n");
552 } 639 }
553 if (intr_status & 640 if (intr_status & (EESR_TWB | EESR_TABT |
554 (EESR_TWB | EESR_TABT | EESR_ADE | EESR_TDE | EESR_TFE)) { 641#if !defined(CONFIG_CPU_SUBTYPE_SH7763)
642 EESR_ADE |
643#endif
644 EESR_TDE | EESR_TFE)) {
555 /* Tx error */ 645 /* Tx error */
556 u32 edtrr = ctrl_inl(ndev->base_addr + EDTRR); 646 u32 edtrr = ctrl_inl(ndev->base_addr + EDTRR);
557 /* dmesg */ 647 /* dmesg */
@@ -582,17 +672,23 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev)
582 ioaddr = ndev->base_addr; 672 ioaddr = ndev->base_addr;
583 spin_lock(&mdp->lock); 673 spin_lock(&mdp->lock);
584 674
675 /* Get interrpt stat */
585 intr_status = ctrl_inl(ioaddr + EESR); 676 intr_status = ctrl_inl(ioaddr + EESR);
586 /* Clear interrupt */ 677 /* Clear interrupt */
587 ctrl_outl(intr_status, ioaddr + EESR); 678 ctrl_outl(intr_status, ioaddr + EESR);
588 679
589 if (intr_status & (EESR_FRC | EESR_RINT8 | 680 if (intr_status & (EESR_FRC | /* Frame recv*/
590 EESR_RINT5 | EESR_RINT4 | EESR_RINT3 | EESR_RINT2 | 681 EESR_RMAF | /* Multi cast address recv*/
591 EESR_RINT1)) 682 EESR_RRF | /* Bit frame recv */
683 EESR_RTLF | /* Long frame recv*/
684 EESR_RTSF | /* short frame recv */
685 EESR_PRE | /* PHY-LSI recv error */
686 EESR_CERF)){ /* recv frame CRC error */
592 sh_eth_rx(ndev); 687 sh_eth_rx(ndev);
593 if (intr_status & (EESR_FTC | 688 }
594 EESR_TINT4 | EESR_TINT3 | EESR_TINT2 | EESR_TINT1)) {
595 689
690 /* Tx Check */
691 if (intr_status & TX_CHECK) {
596 sh_eth_txfree(ndev); 692 sh_eth_txfree(ndev);
597 netif_wake_queue(ndev); 693 netif_wake_queue(ndev);
598 } 694 }
@@ -631,11 +727,32 @@ static void sh_eth_adjust_link(struct net_device *ndev)
631 if (phydev->duplex != mdp->duplex) { 727 if (phydev->duplex != mdp->duplex) {
632 new_state = 1; 728 new_state = 1;
633 mdp->duplex = phydev->duplex; 729 mdp->duplex = phydev->duplex;
730#if defined(CONFIG_CPU_SUBTYPE_SH7763)
731 if (mdp->duplex) { /* FULL */
732 ctrl_outl(ctrl_inl(ioaddr + ECMR) | ECMR_DM,
733 ioaddr + ECMR);
734 } else { /* Half */
735 ctrl_outl(ctrl_inl(ioaddr + ECMR) & ~ECMR_DM,
736 ioaddr + ECMR);
737 }
738#endif
634 } 739 }
635 740
636 if (phydev->speed != mdp->speed) { 741 if (phydev->speed != mdp->speed) {
637 new_state = 1; 742 new_state = 1;
638 mdp->speed = phydev->speed; 743 mdp->speed = phydev->speed;
744#if defined(CONFIG_CPU_SUBTYPE_SH7763)
745 switch (mdp->speed) {
746 case 10: /* 10BASE */
747 ctrl_outl(GECMR_10, ioaddr + GECMR); break;
748 case 100:/* 100BASE */
749 ctrl_outl(GECMR_100, ioaddr + GECMR); break;
750 case 1000: /* 1000BASE */
751 ctrl_outl(GECMR_1000, ioaddr + GECMR); break;
752 default:
753 break;
754 }
755#endif
639 } 756 }
640 if (mdp->link == PHY_DOWN) { 757 if (mdp->link == PHY_DOWN) {
641 ctrl_outl((ctrl_inl(ioaddr + ECMR) & ~ECMR_TXF) 758 ctrl_outl((ctrl_inl(ioaddr + ECMR) & ~ECMR_TXF)
@@ -730,7 +847,7 @@ static int sh_eth_open(struct net_device *ndev)
730 /* Set the timer to check for link beat. */ 847 /* Set the timer to check for link beat. */
731 init_timer(&mdp->timer); 848 init_timer(&mdp->timer);
732 mdp->timer.expires = (jiffies + (24 * HZ)) / 10;/* 2.4 sec. */ 849 mdp->timer.expires = (jiffies + (24 * HZ)) / 10;/* 2.4 sec. */
733 setup_timer(&mdp->timer, sh_eth_timer, ndev); 850 setup_timer(&mdp->timer, sh_eth_timer, (unsigned long)ndev);
734 851
735 return ret; 852 return ret;
736 853
@@ -820,7 +937,9 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
820 937
821 mdp->cur_tx++; 938 mdp->cur_tx++;
822 939
823 ctrl_outl(EDTRR_TRNS, ndev->base_addr + EDTRR); 940 if (!(ctrl_inl(ndev->base_addr + EDTRR) & EDTRR_TRNS))
941 ctrl_outl(EDTRR_TRNS, ndev->base_addr + EDTRR);
942
824 ndev->trans_start = jiffies; 943 ndev->trans_start = jiffies;
825 944
826 return 0; 945 return 0;
@@ -877,9 +996,15 @@ static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev)
877 ctrl_outl(0, ioaddr + CDCR); /* (write clear) */ 996 ctrl_outl(0, ioaddr + CDCR); /* (write clear) */
878 mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + LCCR); 997 mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + LCCR);
879 ctrl_outl(0, ioaddr + LCCR); /* (write clear) */ 998 ctrl_outl(0, ioaddr + LCCR); /* (write clear) */
999#if defined(CONFIG_CPU_SUBTYPE_SH7763)
1000 mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + CERCR);/* CERCR */
1001 ctrl_outl(0, ioaddr + CERCR); /* (write clear) */
1002 mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + CEECR);/* CEECR */
1003 ctrl_outl(0, ioaddr + CEECR); /* (write clear) */
1004#else
880 mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + CNDCR); 1005 mdp->stats.tx_carrier_errors += ctrl_inl(ioaddr + CNDCR);
881 ctrl_outl(0, ioaddr + CNDCR); /* (write clear) */ 1006 ctrl_outl(0, ioaddr + CNDCR); /* (write clear) */
882 1007#endif
883 return &mdp->stats; 1008 return &mdp->stats;
884} 1009}
885 1010
@@ -929,8 +1054,13 @@ static void sh_eth_tsu_init(u32 ioaddr)
929 ctrl_outl(0, ioaddr + TSU_FWSL0); 1054 ctrl_outl(0, ioaddr + TSU_FWSL0);
930 ctrl_outl(0, ioaddr + TSU_FWSL1); 1055 ctrl_outl(0, ioaddr + TSU_FWSL1);
931 ctrl_outl(TSU_FWSLC_POSTENU | TSU_FWSLC_POSTENL, ioaddr + TSU_FWSLC); 1056 ctrl_outl(TSU_FWSLC_POSTENU | TSU_FWSLC_POSTENL, ioaddr + TSU_FWSLC);
1057#if defined(CONFIG_CPU_SUBTYPE_SH7763)
1058 ctrl_outl(0, ioaddr + TSU_QTAG0); /* Disable QTAG(0->1) */
1059 ctrl_outl(0, ioaddr + TSU_QTAG1); /* Disable QTAG(1->0) */
1060#else
932 ctrl_outl(0, ioaddr + TSU_QTAGM0); /* Disable QTAG(0->1) */ 1061 ctrl_outl(0, ioaddr + TSU_QTAGM0); /* Disable QTAG(0->1) */
933 ctrl_outl(0, ioaddr + TSU_QTAGM1); /* Disable QTAG(1->0) */ 1062 ctrl_outl(0, ioaddr + TSU_QTAGM1); /* Disable QTAG(1->0) */
1063#endif
934 ctrl_outl(0, ioaddr + TSU_FWSR); /* all interrupt status clear */ 1064 ctrl_outl(0, ioaddr + TSU_FWSR); /* all interrupt status clear */
935 ctrl_outl(0, ioaddr + TSU_FWINMK); /* Disable all interrupt */ 1065 ctrl_outl(0, ioaddr + TSU_FWINMK); /* Disable all interrupt */
936 ctrl_outl(0, ioaddr + TSU_TEN); /* Disable all CAM entry */ 1066 ctrl_outl(0, ioaddr + TSU_TEN); /* Disable all CAM entry */
@@ -1088,7 +1218,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
1088 /* First device only init */ 1218 /* First device only init */
1089 if (!devno) { 1219 if (!devno) {
1090 /* reset device */ 1220 /* reset device */
1091 ctrl_outl(ARSTR_ARSTR, ndev->base_addr + ARSTR); 1221 ctrl_outl(ARSTR_ARSTR, ARSTR);
1092 mdelay(1); 1222 mdelay(1);
1093 1223
1094 /* TSU init (Init only)*/ 1224 /* TSU init (Init only)*/
@@ -1110,8 +1240,8 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
1110 ndev->name, CARDNAME, (u32) ndev->base_addr); 1240 ndev->name, CARDNAME, (u32) ndev->base_addr);
1111 1241
1112 for (i = 0; i < 5; i++) 1242 for (i = 0; i < 5; i++)
1113 printk(KERN_INFO "%2.2x:", ndev->dev_addr[i]); 1243 printk(KERN_INFO "%02X:", ndev->dev_addr[i]);
1114 printk(KERN_INFO "%2.2x, IRQ %d.\n", ndev->dev_addr[i], ndev->irq); 1244 printk(KERN_INFO "%02X, IRQ %d.\n", ndev->dev_addr[i], ndev->irq);
1115 1245
1116 platform_set_drvdata(pdev, ndev); 1246 platform_set_drvdata(pdev, ndev);
1117 1247
diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h
index e01e1c347715..45ad1b09ca5a 100644
--- a/drivers/net/sh_eth.h
+++ b/drivers/net/sh_eth.h
@@ -32,118 +32,249 @@
32 32
33#define CARDNAME "sh-eth" 33#define CARDNAME "sh-eth"
34#define TX_TIMEOUT (5*HZ) 34#define TX_TIMEOUT (5*HZ)
35 35#define TX_RING_SIZE 64 /* Tx ring size */
36#define TX_RING_SIZE 128 /* Tx ring size */ 36#define RX_RING_SIZE 64 /* Rx ring size */
37#define RX_RING_SIZE 128 /* Rx ring size */
38#define RX_OFFSET 2 /* skb offset */
39#define ETHERSMALL 60 37#define ETHERSMALL 60
40#define PKT_BUF_SZ 1538 38#define PKT_BUF_SZ 1538
41 39
40#ifdef CONFIG_CPU_SUBTYPE_SH7763
41
42#define SH7763_SKB_ALIGN 32
42/* Chip Base Address */ 43/* Chip Base Address */
43#define SH_TSU_ADDR 0xA7000804 44# define SH_TSU_ADDR 0xFFE01800
45# define ARSTR 0xFFE01800
46
47/* Chip Registers */
48/* E-DMAC */
49# define EDSR 0x000
50# define EDMR 0x400
51# define EDTRR 0x408
52# define EDRRR 0x410
53# define EESR 0x428
54# define EESIPR 0x430
55# define TDLAR 0x010
56# define TDFAR 0x014
57# define TDFXR 0x018
58# define TDFFR 0x01C
59# define RDLAR 0x030
60# define RDFAR 0x034
61# define RDFXR 0x038
62# define RDFFR 0x03C
63# define TRSCER 0x438
64# define RMFCR 0x440
65# define TFTR 0x448
66# define FDR 0x450
67# define RMCR 0x458
68# define RPADIR 0x460
69# define FCFTR 0x468
70
71/* Ether Register */
72# define ECMR 0x500
73# define ECSR 0x510
74# define ECSIPR 0x518
75# define PIR 0x520
76# define PSR 0x528
77# define PIPR 0x52C
78# define RFLR 0x508
79# define APR 0x554
80# define MPR 0x558
81# define PFTCR 0x55C
82# define PFRCR 0x560
83# define TPAUSER 0x564
84# define GECMR 0x5B0
85# define BCULR 0x5B4
86# define MAHR 0x5C0
87# define MALR 0x5C8
88# define TROCR 0x700
89# define CDCR 0x708
90# define LCCR 0x710
91# define CEFCR 0x740
92# define FRECR 0x748
93# define TSFRCR 0x750
94# define TLFRCR 0x758
95# define RFCR 0x760
96# define CERCR 0x768
97# define CEECR 0x770
98# define MAFCR 0x778
99
100/* TSU Absolute Address */
101# define TSU_CTRST 0x004
102# define TSU_FWEN0 0x010
103# define TSU_FWEN1 0x014
104# define TSU_FCM 0x18
105# define TSU_BSYSL0 0x20
106# define TSU_BSYSL1 0x24
107# define TSU_PRISL0 0x28
108# define TSU_PRISL1 0x2C
109# define TSU_FWSL0 0x30
110# define TSU_FWSL1 0x34
111# define TSU_FWSLC 0x38
112# define TSU_QTAG0 0x40
113# define TSU_QTAG1 0x44
114# define TSU_FWSR 0x50
115# define TSU_FWINMK 0x54
116# define TSU_ADQT0 0x48
117# define TSU_ADQT1 0x4C
118# define TSU_VTAG0 0x58
119# define TSU_VTAG1 0x5C
120# define TSU_ADSBSY 0x60
121# define TSU_TEN 0x64
122# define TSU_POST1 0x70
123# define TSU_POST2 0x74
124# define TSU_POST3 0x78
125# define TSU_POST4 0x7C
126# define TSU_ADRH0 0x100
127# define TSU_ADRL0 0x104
128# define TSU_ADRH31 0x1F8
129# define TSU_ADRL31 0x1FC
130
131# define TXNLCR0 0x80
132# define TXALCR0 0x84
133# define RXNLCR0 0x88
134# define RXALCR0 0x8C
135# define FWNLCR0 0x90
136# define FWALCR0 0x94
137# define TXNLCR1 0xA0
138# define TXALCR1 0xA4
139# define RXNLCR1 0xA8
140# define RXALCR1 0xAC
141# define FWNLCR1 0xB0
142# define FWALCR1 0x40
143
144#else /* CONFIG_CPU_SUBTYPE_SH7763 */
145# define RX_OFFSET 2 /* skb offset */
146/* Chip base address */
147# define SH_TSU_ADDR 0xA7000804
148# define ARSTR 0xA7000800
44 149
45/* Chip Registers */ 150/* Chip Registers */
46/* E-DMAC */ 151/* E-DMAC */
47#define EDMR 0x0000 152# define EDMR 0x0000
48#define EDTRR 0x0004 153# define EDTRR 0x0004
49#define EDRRR 0x0008 154# define EDRRR 0x0008
50#define TDLAR 0x000C 155# define TDLAR 0x000C
51#define RDLAR 0x0010 156# define RDLAR 0x0010
52#define EESR 0x0014 157# define EESR 0x0014
53#define EESIPR 0x0018 158# define EESIPR 0x0018
54#define TRSCER 0x001C 159# define TRSCER 0x001C
55#define RMFCR 0x0020 160# define RMFCR 0x0020
56#define TFTR 0x0024 161# define TFTR 0x0024
57#define FDR 0x0028 162# define FDR 0x0028
58#define RMCR 0x002C 163# define RMCR 0x002C
59#define EDOCR 0x0030 164# define EDOCR 0x0030
60#define FCFTR 0x0034 165# define FCFTR 0x0034
61#define RPADIR 0x0038 166# define RPADIR 0x0038
62#define TRIMD 0x003C 167# define TRIMD 0x003C
63#define RBWAR 0x0040 168# define RBWAR 0x0040
64#define RDFAR 0x0044 169# define RDFAR 0x0044
65#define TBRAR 0x004C 170# define TBRAR 0x004C
66#define TDFAR 0x0050 171# define TDFAR 0x0050
172
67/* Ether Register */ 173/* Ether Register */
68#define ECMR 0x0160 174# define ECMR 0x0160
69#define ECSR 0x0164 175# define ECSR 0x0164
70#define ECSIPR 0x0168 176# define ECSIPR 0x0168
71#define PIR 0x016C 177# define PIR 0x016C
72#define MAHR 0x0170 178# define MAHR 0x0170
73#define MALR 0x0174 179# define MALR 0x0174
74#define RFLR 0x0178 180# define RFLR 0x0178
75#define PSR 0x017C 181# define PSR 0x017C
76#define TROCR 0x0180 182# define TROCR 0x0180
77#define CDCR 0x0184 183# define CDCR 0x0184
78#define LCCR 0x0188 184# define LCCR 0x0188
79#define CNDCR 0x018C 185# define CNDCR 0x018C
80#define CEFCR 0x0194 186# define CEFCR 0x0194
81#define FRECR 0x0198 187# define FRECR 0x0198
82#define TSFRCR 0x019C 188# define TSFRCR 0x019C
83#define TLFRCR 0x01A0 189# define TLFRCR 0x01A0
84#define RFCR 0x01A4 190# define RFCR 0x01A4
85#define MAFCR 0x01A8 191# define MAFCR 0x01A8
86#define IPGR 0x01B4 192# define IPGR 0x01B4
87#if defined(CONFIG_CPU_SUBTYPE_SH7710) 193# if defined(CONFIG_CPU_SUBTYPE_SH7710)
88#define APR 0x01B8 194# define APR 0x01B8
89#define MPR 0x01BC 195# define MPR 0x01BC
90#define TPAUSER 0x1C4 196# define TPAUSER 0x1C4
91#define BCFR 0x1CC 197# define BCFR 0x1CC
92#endif /* CONFIG_CPU_SH7710 */ 198# endif /* CONFIG_CPU_SH7710 */
93
94#define ARSTR 0x0800
95 199
96/* TSU */ 200/* TSU */
97#define TSU_CTRST 0x004 201# define TSU_CTRST 0x004
98#define TSU_FWEN0 0x010 202# define TSU_FWEN0 0x010
99#define TSU_FWEN1 0x014 203# define TSU_FWEN1 0x014
100#define TSU_FCM 0x018 204# define TSU_FCM 0x018
101#define TSU_BSYSL0 0x020 205# define TSU_BSYSL0 0x020
102#define TSU_BSYSL1 0x024 206# define TSU_BSYSL1 0x024
103#define TSU_PRISL0 0x028 207# define TSU_PRISL0 0x028
104#define TSU_PRISL1 0x02C 208# define TSU_PRISL1 0x02C
105#define TSU_FWSL0 0x030 209# define TSU_FWSL0 0x030
106#define TSU_FWSL1 0x034 210# define TSU_FWSL1 0x034
107#define TSU_FWSLC 0x038 211# define TSU_FWSLC 0x038
108#define TSU_QTAGM0 0x040 212# define TSU_QTAGM0 0x040
109#define TSU_QTAGM1 0x044 213# define TSU_QTAGM1 0x044
110#define TSU_ADQT0 0x048 214# define TSU_ADQT0 0x048
111#define TSU_ADQT1 0x04C 215# define TSU_ADQT1 0x04C
112#define TSU_FWSR 0x050 216# define TSU_FWSR 0x050
113#define TSU_FWINMK 0x054 217# define TSU_FWINMK 0x054
114#define TSU_ADSBSY 0x060 218# define TSU_ADSBSY 0x060
115#define TSU_TEN 0x064 219# define TSU_TEN 0x064
116#define TSU_POST1 0x070 220# define TSU_POST1 0x070
117#define TSU_POST2 0x074 221# define TSU_POST2 0x074
118#define TSU_POST3 0x078 222# define TSU_POST3 0x078
119#define TSU_POST4 0x07C 223# define TSU_POST4 0x07C
120#define TXNLCR0 0x080 224# define TXNLCR0 0x080
121#define TXALCR0 0x084 225# define TXALCR0 0x084
122#define RXNLCR0 0x088 226# define RXNLCR0 0x088
123#define RXALCR0 0x08C 227# define RXALCR0 0x08C
124#define FWNLCR0 0x090 228# define FWNLCR0 0x090
125#define FWALCR0 0x094 229# define FWALCR0 0x094
126#define TXNLCR1 0x0A0 230# define TXNLCR1 0x0A0
127#define TXALCR1 0x0A4 231# define TXALCR1 0x0A4
128#define RXNLCR1 0x0A8 232# define RXNLCR1 0x0A8
129#define RXALCR1 0x0AC 233# define RXALCR1 0x0AC
130#define FWNLCR1 0x0B0 234# define FWNLCR1 0x0B0
131#define FWALCR1 0x0B4 235# define FWALCR1 0x0B4
132 236
133#define TSU_ADRH0 0x0100 237#define TSU_ADRH0 0x0100
134#define TSU_ADRL0 0x0104 238#define TSU_ADRL0 0x0104
135#define TSU_ADRL31 0x01FC 239#define TSU_ADRL31 0x01FC
136 240
137/* Register's bits */ 241#endif /* CONFIG_CPU_SUBTYPE_SH7763 */
242
243/*
244 * Register's bits
245 */
246#ifdef CONFIG_CPU_SUBTYPE_SH7763
247/* EDSR */
248enum EDSR_BIT {
249 EDSR_ENT = 0x01, EDSR_ENR = 0x02,
250};
251#define EDSR_ENALL (EDSR_ENT|EDSR_ENR)
252
253/* GECMR */
254enum GECMR_BIT {
255 GECMR_10 = 0x0, GECMR_100 = 0x04, GECMR_1000 = 0x01,
256};
257#endif
138 258
139/* EDMR */ 259/* EDMR */
140enum DMAC_M_BIT { 260enum DMAC_M_BIT {
141 EDMR_DL1 = 0x20, EDMR_DL0 = 0x10, EDMR_SRST = 0x01, 261 EDMR_DL1 = 0x20, EDMR_DL0 = 0x10,
262#ifdef CONFIG_CPU_SUBTYPE_SH7763
263 EDMR_SRST = 0x03,
264 EMDR_DESC_R = 0x30, /* Descriptor reserve size */
265 EDMR_EL = 0x40, /* Litte endian */
266#else /* CONFIG_CPU_SUBTYPE_SH7763 */
267 EDMR_SRST = 0x01,
268#endif
142}; 269};
143 270
144/* EDTRR */ 271/* EDTRR */
145enum DMAC_T_BIT { 272enum DMAC_T_BIT {
273#ifdef CONFIG_CPU_SUBTYPE_SH7763
274 EDTRR_TRNS = 0x03,
275#else
146 EDTRR_TRNS = 0x01, 276 EDTRR_TRNS = 0x01,
277#endif
147}; 278};
148 279
149/* EDRRR*/ 280/* EDRRR*/
@@ -173,21 +304,47 @@ enum PHY_STATUS_BIT { PHY_ST_LINK = 0x01, };
173 304
174/* EESR */ 305/* EESR */
175enum EESR_BIT { 306enum EESR_BIT {
176 EESR_TWB = 0x40000000, EESR_TABT = 0x04000000, 307#ifndef CONFIG_CPU_SUBTYPE_SH7763
308 EESR_TWB = 0x40000000,
309#else
310 EESR_TWB = 0xC0000000,
311 EESR_TC1 = 0x20000000,
312 EESR_TUC = 0x10000000,
313 EESR_ROC = 0x80000000,
314#endif
315 EESR_TABT = 0x04000000,
177 EESR_RABT = 0x02000000, EESR_RFRMER = 0x01000000, 316 EESR_RABT = 0x02000000, EESR_RFRMER = 0x01000000,
178 EESR_ADE = 0x00800000, EESR_ECI = 0x00400000, 317#ifndef CONFIG_CPU_SUBTYPE_SH7763
179 EESR_FTC = 0x00200000, EESR_TDE = 0x00100000, 318 EESR_ADE = 0x00800000,
180 EESR_TFE = 0x00080000, EESR_FRC = 0x00040000, 319#endif
181 EESR_RDE = 0x00020000, EESR_RFE = 0x00010000, 320 EESR_ECI = 0x00400000,
182 EESR_TINT4 = 0x00000800, EESR_TINT3 = 0x00000400, 321 EESR_FTC = 0x00200000, EESR_TDE = 0x00100000,
183 EESR_TINT2 = 0x00000200, EESR_TINT1 = 0x00000100, 322 EESR_TFE = 0x00080000, EESR_FRC = 0x00040000,
184 EESR_RINT8 = 0x00000080, EESR_RINT5 = 0x00000010, 323 EESR_RDE = 0x00020000, EESR_RFE = 0x00010000,
185 EESR_RINT4 = 0x00000008, EESR_RINT3 = 0x00000004, 324#ifndef CONFIG_CPU_SUBTYPE_SH7763
186 EESR_RINT2 = 0x00000002, EESR_RINT1 = 0x00000001, 325 EESR_CND = 0x00000800,
187}; 326#endif
188 327 EESR_DLC = 0x00000400,
189#define EESR_ERR_CHECK (EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE \ 328 EESR_CD = 0x00000200, EESR_RTO = 0x00000100,
329 EESR_RMAF = 0x00000080, EESR_CEEF = 0x00000040,
330 EESR_CELF = 0x00000020, EESR_RRF = 0x00000010,
331 EESR_RTLF = 0x00000008, EESR_RTSF = 0x00000004,
332 EESR_PRE = 0x00000002, EESR_CERF = 0x00000001,
333};
334
335
336#ifdef CONFIG_CPU_SUBTYPE_SH7763
337# define TX_CHECK (EESR_TC1 | EESR_FTC)
338# define EESR_ERR_CHECK (EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE \
339 | EESR_RFRMER | EESR_TFE | EESR_TDE | EESR_ECI)
340# define TX_ERROR_CEHCK (EESR_TWB | EESR_TABT | EESR_TDE | EESR_TFE)
341
342#else
343# define TX_CHECK (EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO)
344# define EESR_ERR_CHECK (EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE \
190 | EESR_RFRMER | EESR_ADE | EESR_TFE | EESR_TDE | EESR_ECI) 345 | EESR_RFRMER | EESR_ADE | EESR_TFE | EESR_TDE | EESR_ECI)
346# define TX_ERROR_CEHCK (EESR_TWB | EESR_TABT | EESR_ADE | EESR_TDE | EESR_TFE)
347#endif
191 348
192/* EESIPR */ 349/* EESIPR */
193enum DMAC_IM_BIT { 350enum DMAC_IM_BIT {
@@ -207,8 +364,8 @@ enum DMAC_IM_BIT {
207 364
208/* Receive descriptor bit */ 365/* Receive descriptor bit */
209enum RD_STS_BIT { 366enum RD_STS_BIT {
210 RD_RACT = 0x80000000, RC_RDEL = 0x40000000, 367 RD_RACT = 0x80000000, RD_RDEL = 0x40000000,
211 RC_RFP1 = 0x20000000, RC_RFP0 = 0x10000000, 368 RD_RFP1 = 0x20000000, RD_RFP0 = 0x10000000,
212 RD_RFE = 0x08000000, RD_RFS10 = 0x00000200, 369 RD_RFE = 0x08000000, RD_RFS10 = 0x00000200,
213 RD_RFS9 = 0x00000100, RD_RFS8 = 0x00000080, 370 RD_RFS9 = 0x00000100, RD_RFS8 = 0x00000080,
214 RD_RFS7 = 0x00000040, RD_RFS6 = 0x00000020, 371 RD_RFS7 = 0x00000040, RD_RFS6 = 0x00000020,
@@ -216,9 +373,9 @@ enum RD_STS_BIT {
216 RD_RFS3 = 0x00000004, RD_RFS2 = 0x00000002, 373 RD_RFS3 = 0x00000004, RD_RFS2 = 0x00000002,
217 RD_RFS1 = 0x00000001, 374 RD_RFS1 = 0x00000001,
218}; 375};
219#define RDF1ST RC_RFP1 376#define RDF1ST RD_RFP1
220#define RDFEND RC_RFP0 377#define RDFEND RD_RFP0
221#define RD_RFP (RC_RFP1|RC_RFP0) 378#define RD_RFP (RD_RFP1|RD_RFP0)
222 379
223/* FCFTR */ 380/* FCFTR */
224enum FCFTR_BIT { 381enum FCFTR_BIT {
@@ -231,7 +388,8 @@ enum FCFTR_BIT {
231 388
232/* Transfer descriptor bit */ 389/* Transfer descriptor bit */
233enum TD_STS_BIT { 390enum TD_STS_BIT {
234 TD_TACT = 0x80000000, TD_TDLE = 0x40000000, TD_TFP1 = 0x20000000, 391 TD_TACT = 0x80000000,
392 TD_TDLE = 0x40000000, TD_TFP1 = 0x20000000,
235 TD_TFP0 = 0x10000000, 393 TD_TFP0 = 0x10000000,
236}; 394};
237#define TDF1ST TD_TFP1 395#define TDF1ST TD_TFP1
@@ -242,6 +400,10 @@ enum TD_STS_BIT {
242enum RECV_RST_BIT { RMCR_RST = 0x01, }; 400enum RECV_RST_BIT { RMCR_RST = 0x01, };
243/* ECMR */ 401/* ECMR */
244enum FELIC_MODE_BIT { 402enum FELIC_MODE_BIT {
403#ifdef CONFIG_CPU_SUBTYPE_SH7763
404 ECMR_TRCCM = 0x04000000, ECMR_RCSC = 0x00800000,
405 ECMR_DPAD = 0x00200000, ECMR_RZPF = 0x00100000,
406#endif
245 ECMR_ZPF = 0x00080000, ECMR_PFR = 0x00040000, ECMR_RXF = 0x00020000, 407 ECMR_ZPF = 0x00080000, ECMR_PFR = 0x00040000, ECMR_RXF = 0x00020000,
246 ECMR_TXF = 0x00010000, ECMR_MCT = 0x00002000, ECMR_PRCEF = 0x00001000, 408 ECMR_TXF = 0x00010000, ECMR_MCT = 0x00002000, ECMR_PRCEF = 0x00001000,
247 ECMR_PMDE = 0x00000200, ECMR_RE = 0x00000040, ECMR_TE = 0x00000020, 409 ECMR_PMDE = 0x00000200, ECMR_RE = 0x00000040, ECMR_TE = 0x00000020,
@@ -249,18 +411,45 @@ enum FELIC_MODE_BIT {
249 ECMR_PRM = 0x00000001, 411 ECMR_PRM = 0x00000001,
250}; 412};
251 413
414#ifdef CONFIG_CPU_SUBTYPE_SH7763
415#define ECMR_CHG_DM (ECMR_TRCCM | ECMR_RZPF | ECMR_ZPF |\
416 ECMR_PFR | ECMR_RXF | ECMR_TXF | ECMR_MCT)
417#else
418#define ECMR_CHG_DM (ECMR_ZPF | ECMR_PFR ECMR_RXF | ECMR_TXF | ECMR_MCT)
419#endif
420
252/* ECSR */ 421/* ECSR */
253enum ECSR_STATUS_BIT { 422enum ECSR_STATUS_BIT {
254 ECSR_BRCRX = 0x20, ECSR_PSRTO = 0x10, ECSR_LCHNG = 0x04, 423#ifndef CONFIG_CPU_SUBTYPE_SH7763
424 ECSR_BRCRX = 0x20, ECSR_PSRTO = 0x10,
425#endif
426 ECSR_LCHNG = 0x04,
255 ECSR_MPD = 0x02, ECSR_ICD = 0x01, 427 ECSR_MPD = 0x02, ECSR_ICD = 0x01,
256}; 428};
257 429
430#ifdef CONFIG_CPU_SUBTYPE_SH7763
431# define ECSR_INIT (ECSR_ICD | ECSIPR_MPDIP)
432#else
433# define ECSR_INIT (ECSR_BRCRX | ECSR_PSRTO | \
434 ECSR_LCHNG | ECSR_ICD | ECSIPR_MPDIP)
435#endif
436
258/* ECSIPR */ 437/* ECSIPR */
259enum ECSIPR_STATUS_MASK_BIT { 438enum ECSIPR_STATUS_MASK_BIT {
260 ECSIPR_BRCRXIP = 0x20, ECSIPR_PSRTOIP = 0x10, ECSIPR_LCHNGIP = 0x04, 439#ifndef CONFIG_CPU_SUBTYPE_SH7763
440 ECSIPR_BRCRXIP = 0x20, ECSIPR_PSRTOIP = 0x10,
441#endif
442 ECSIPR_LCHNGIP = 0x04,
261 ECSIPR_MPDIP = 0x02, ECSIPR_ICDIP = 0x01, 443 ECSIPR_MPDIP = 0x02, ECSIPR_ICDIP = 0x01,
262}; 444};
263 445
446#ifdef CONFIG_CPU_SUBTYPE_SH7763
447# define ECSIPR_INIT (ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP)
448#else
449# define ECSIPR_INIT (ECSIPR_BRCRXIP | ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | \
450 ECSIPR_ICDIP | ECSIPR_MPDIP)
451#endif
452
264/* APR */ 453/* APR */
265enum APR_BIT { 454enum APR_BIT {
266 APR_AP = 0x00000001, 455 APR_AP = 0x00000001,
@@ -285,6 +474,15 @@ enum RPADIR_BIT {
285 RPADIR_PADR = 0x0003f, 474 RPADIR_PADR = 0x0003f,
286}; 475};
287 476
477#if defined(CONFIG_CPU_SUBTYPE_SH7763)
478# define RPADIR_INIT (0x00)
479#else
480# define RPADIR_INIT (RPADIR_PADS1)
481#endif
482
483/* RFLR */
484#define RFLR_VALUE 0x1000
485
288/* FDR */ 486/* FDR */
289enum FIFO_SIZE_BIT { 487enum FIFO_SIZE_BIT {
290 FIFO_SIZE_T = 0x00000700, FIFO_SIZE_R = 0x00000007, 488 FIFO_SIZE_T = 0x00000700, FIFO_SIZE_R = 0x00000007,
@@ -316,7 +514,7 @@ enum PHY_ANA_BIT {
316 PHY_A_NP = 0x8000, PHY_A_ACK = 0x4000, PHY_A_RF = 0x2000, 514 PHY_A_NP = 0x8000, PHY_A_ACK = 0x4000, PHY_A_RF = 0x2000,
317 PHY_A_FCS = 0x0400, PHY_A_T4 = 0x0200, PHY_A_FDX = 0x0100, 515 PHY_A_FCS = 0x0400, PHY_A_T4 = 0x0200, PHY_A_FDX = 0x0100,
318 PHY_A_HDX = 0x0080, PHY_A_10FDX = 0x0040, PHY_A_10HDX = 0x0020, 516 PHY_A_HDX = 0x0080, PHY_A_10FDX = 0x0040, PHY_A_10HDX = 0x0020,
319 PHY_A_SEL = 0x001f, 517 PHY_A_SEL = 0x001e,
320}; 518};
321/* PHY_ANL */ 519/* PHY_ANL */
322enum PHY_ANL_BIT { 520enum PHY_ANL_BIT {
@@ -449,6 +647,10 @@ struct sh_eth_private {
449 struct net_device_stats tsu_stats; /* TSU forward status */ 647 struct net_device_stats tsu_stats; /* TSU forward status */
450}; 648};
451 649
650#ifdef CONFIG_CPU_SUBTYPE_SH7763
651/* SH7763 has endian control register */
652#define swaps(x, y)
653#else
452static void swaps(char *src, int len) 654static void swaps(char *src, int len)
453{ 655{
454#ifdef __LITTLE_ENDIAN__ 656#ifdef __LITTLE_ENDIAN__
@@ -460,5 +662,5 @@ static void swaps(char *src, int len)
460 *p = swab32(*p); 662 *p = swab32(*p);
461#endif 663#endif
462} 664}
463 665#endif /* CONFIG_CPU_SUBTYPE_SH7763 */
464#endif 666#endif
diff --git a/drivers/net/skfp/smt.c b/drivers/net/skfp/smt.c
index ffbfb1b79f97..805383b33d3c 100644
--- a/drivers/net/skfp/smt.c
+++ b/drivers/net/skfp/smt.c
@@ -19,6 +19,7 @@
19#include "h/smc.h" 19#include "h/smc.h"
20#include "h/smt_p.h" 20#include "h/smt_p.h"
21#include <linux/bitrev.h> 21#include <linux/bitrev.h>
22#include <linux/kernel.h>
22 23
23#define KERNEL 24#define KERNEL
24#include "h/smtstate.h" 25#include "h/smtstate.h"
@@ -1730,20 +1731,18 @@ void fddi_send_antc(struct s_smc *smc, struct fddi_addr *dest)
1730#endif 1731#endif
1731 1732
1732#ifdef DEBUG 1733#ifdef DEBUG
1733#define hextoasc(x) "0123456789abcdef"[x]
1734
1735char *addr_to_string(struct fddi_addr *addr) 1734char *addr_to_string(struct fddi_addr *addr)
1736{ 1735{
1737 int i ; 1736 int i ;
1738 static char string[6*3] = "****" ; 1737 static char string[6*3] = "****" ;
1739 1738
1740 for (i = 0 ; i < 6 ; i++) { 1739 for (i = 0 ; i < 6 ; i++) {
1741 string[i*3] = hextoasc((addr->a[i]>>4)&0xf) ; 1740 string[i * 3] = hex_asc_hi(addr->a[i]);
1742 string[i*3+1] = hextoasc((addr->a[i])&0xf) ; 1741 string[i * 3 + 1] = hex_asc_lo(addr->a[i]);
1743 string[i*3+2] = ':' ; 1742 string[i * 3 + 2] = ':';
1744 } 1743 }
1745 string[5*3+2] = 0 ; 1744 string[5 * 3 + 2] = 0;
1746 return(string) ; 1745 return(string);
1747} 1746}
1748#endif 1747#endif
1749 1748
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 633c128a6228..26aa37aa531f 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -1982,8 +1982,6 @@ static void tg3_power_down_phy(struct tg3 *tp)
1982static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) 1982static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
1983{ 1983{
1984 u32 misc_host_ctrl; 1984 u32 misc_host_ctrl;
1985 u16 power_control, power_caps;
1986 int pm = tp->pm_cap;
1987 1985
1988 /* Make sure register accesses (indirect or otherwise) 1986 /* Make sure register accesses (indirect or otherwise)
1989 * will function correctly. 1987 * will function correctly.
@@ -1992,18 +1990,10 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
1992 TG3PCI_MISC_HOST_CTRL, 1990 TG3PCI_MISC_HOST_CTRL,
1993 tp->misc_host_ctrl); 1991 tp->misc_host_ctrl);
1994 1992
1995 pci_read_config_word(tp->pdev,
1996 pm + PCI_PM_CTRL,
1997 &power_control);
1998 power_control |= PCI_PM_CTRL_PME_STATUS;
1999 power_control &= ~(PCI_PM_CTRL_STATE_MASK);
2000 switch (state) { 1993 switch (state) {
2001 case PCI_D0: 1994 case PCI_D0:
2002 power_control |= 0; 1995 pci_enable_wake(tp->pdev, state, false);
2003 pci_write_config_word(tp->pdev, 1996 pci_set_power_state(tp->pdev, PCI_D0);
2004 pm + PCI_PM_CTRL,
2005 power_control);
2006 udelay(100); /* Delay after power state change */
2007 1997
2008 /* Switch out of Vaux if it is a NIC */ 1998 /* Switch out of Vaux if it is a NIC */
2009 if (tp->tg3_flags2 & TG3_FLG2_IS_NIC) 1999 if (tp->tg3_flags2 & TG3_FLG2_IS_NIC)
@@ -2012,26 +2002,15 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2012 return 0; 2002 return 0;
2013 2003
2014 case PCI_D1: 2004 case PCI_D1:
2015 power_control |= 1;
2016 break;
2017
2018 case PCI_D2: 2005 case PCI_D2:
2019 power_control |= 2;
2020 break;
2021
2022 case PCI_D3hot: 2006 case PCI_D3hot:
2023 power_control |= 3;
2024 break; 2007 break;
2025 2008
2026 default: 2009 default:
2027 printk(KERN_WARNING PFX "%s: Invalid power state (%d) " 2010 printk(KERN_ERR PFX "%s: Invalid power state (D%d) requested\n",
2028 "requested.\n", 2011 tp->dev->name, state);
2029 tp->dev->name, state);
2030 return -EINVAL; 2012 return -EINVAL;
2031 } 2013 }
2032
2033 power_control |= PCI_PM_CTRL_PME_ENABLE;
2034
2035 misc_host_ctrl = tr32(TG3PCI_MISC_HOST_CTRL); 2014 misc_host_ctrl = tr32(TG3PCI_MISC_HOST_CTRL);
2036 tw32(TG3PCI_MISC_HOST_CTRL, 2015 tw32(TG3PCI_MISC_HOST_CTRL,
2037 misc_host_ctrl | MISC_HOST_CTRL_MASK_PCI_INT); 2016 misc_host_ctrl | MISC_HOST_CTRL_MASK_PCI_INT);
@@ -2109,8 +2088,6 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2109 WOL_DRV_WOL | 2088 WOL_DRV_WOL |
2110 WOL_SET_MAGIC_PKT); 2089 WOL_SET_MAGIC_PKT);
2111 2090
2112 pci_read_config_word(tp->pdev, pm + PCI_PM_PMC, &power_caps);
2113
2114 if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) { 2091 if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE) {
2115 u32 mac_mode; 2092 u32 mac_mode;
2116 2093
@@ -2143,8 +2120,8 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2143 if (!(tp->tg3_flags2 & TG3_FLG2_5750_PLUS)) 2120 if (!(tp->tg3_flags2 & TG3_FLG2_5750_PLUS))
2144 tw32(MAC_LED_CTRL, tp->led_ctrl); 2121 tw32(MAC_LED_CTRL, tp->led_ctrl);
2145 2122
2146 if (((power_caps & PCI_PM_CAP_PME_D3cold) && 2123 if (pci_pme_capable(tp->pdev, state) &&
2147 (tp->tg3_flags & TG3_FLAG_WOL_ENABLE))) 2124 (tp->tg3_flags & TG3_FLAG_WOL_ENABLE))
2148 mac_mode |= MAC_MODE_MAGIC_PKT_ENABLE; 2125 mac_mode |= MAC_MODE_MAGIC_PKT_ENABLE;
2149 2126
2150 tw32_f(MAC_MODE, mac_mode); 2127 tw32_f(MAC_MODE, mac_mode);
@@ -2236,9 +2213,11 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state)
2236 2213
2237 tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN); 2214 tg3_write_sig_post_reset(tp, RESET_KIND_SHUTDOWN);
2238 2215
2216 if (tp->tg3_flags & TG3_FLAG_WOL_ENABLE)
2217 pci_enable_wake(tp->pdev, state, true);
2218
2239 /* Finally, set the new power state. */ 2219 /* Finally, set the new power state. */
2240 pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control); 2220 pci_set_power_state(tp->pdev, state);
2241 udelay(100); /* Delay after power state change */
2242 2221
2243 return 0; 2222 return 0;
2244} 2223}
@@ -9065,7 +9044,8 @@ static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
9065{ 9044{
9066 struct tg3 *tp = netdev_priv(dev); 9045 struct tg3 *tp = netdev_priv(dev);
9067 9046
9068 if (tp->tg3_flags & TG3_FLAG_WOL_CAP) 9047 if ((tp->tg3_flags & TG3_FLAG_WOL_CAP) &&
9048 device_can_wakeup(&tp->pdev->dev))
9069 wol->supported = WAKE_MAGIC; 9049 wol->supported = WAKE_MAGIC;
9070 else 9050 else
9071 wol->supported = 0; 9051 wol->supported = 0;
@@ -9078,18 +9058,22 @@ static void tg3_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
9078static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) 9058static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
9079{ 9059{
9080 struct tg3 *tp = netdev_priv(dev); 9060 struct tg3 *tp = netdev_priv(dev);
9061 struct device *dp = &tp->pdev->dev;
9081 9062
9082 if (wol->wolopts & ~WAKE_MAGIC) 9063 if (wol->wolopts & ~WAKE_MAGIC)
9083 return -EINVAL; 9064 return -EINVAL;
9084 if ((wol->wolopts & WAKE_MAGIC) && 9065 if ((wol->wolopts & WAKE_MAGIC) &&
9085 !(tp->tg3_flags & TG3_FLAG_WOL_CAP)) 9066 !((tp->tg3_flags & TG3_FLAG_WOL_CAP) && device_can_wakeup(dp)))
9086 return -EINVAL; 9067 return -EINVAL;
9087 9068
9088 spin_lock_bh(&tp->lock); 9069 spin_lock_bh(&tp->lock);
9089 if (wol->wolopts & WAKE_MAGIC) 9070 if (wol->wolopts & WAKE_MAGIC) {
9090 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 9071 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
9091 else 9072 device_set_wakeup_enable(dp, true);
9073 } else {
9092 tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE; 9074 tp->tg3_flags &= ~TG3_FLAG_WOL_ENABLE;
9075 device_set_wakeup_enable(dp, false);
9076 }
9093 spin_unlock_bh(&tp->lock); 9077 spin_unlock_bh(&tp->lock);
9094 9078
9095 return 0; 9079 return 0;
@@ -11296,7 +11280,8 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
11296 if (val & VCPU_CFGSHDW_ASPM_DBNC) 11280 if (val & VCPU_CFGSHDW_ASPM_DBNC)
11297 tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND; 11281 tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
11298 if ((val & VCPU_CFGSHDW_WOL_ENABLE) && 11282 if ((val & VCPU_CFGSHDW_WOL_ENABLE) &&
11299 (val & VCPU_CFGSHDW_WOL_MAGPKT)) 11283 (val & VCPU_CFGSHDW_WOL_MAGPKT) &&
11284 device_may_wakeup(&tp->pdev->dev))
11300 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 11285 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
11301 return; 11286 return;
11302 } 11287 }
@@ -11426,8 +11411,9 @@ static void __devinit tg3_get_eeprom_hw_cfg(struct tg3 *tp)
11426 !(nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL)) 11411 !(nic_cfg & NIC_SRAM_DATA_CFG_FIBER_WOL))
11427 tp->tg3_flags &= ~TG3_FLAG_WOL_CAP; 11412 tp->tg3_flags &= ~TG3_FLAG_WOL_CAP;
11428 11413
11429 if (tp->tg3_flags & TG3_FLAG_WOL_CAP && 11414 if ((tp->tg3_flags & TG3_FLAG_WOL_CAP) &&
11430 nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE) 11415 (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE) &&
11416 device_may_wakeup(&tp->pdev->dev))
11431 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE; 11417 tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
11432 11418
11433 if (cfg2 & (1 << 17)) 11419 if (cfg2 & (1 << 17))
@@ -13613,6 +13599,7 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
13613{ 13599{
13614 struct net_device *dev = pci_get_drvdata(pdev); 13600 struct net_device *dev = pci_get_drvdata(pdev);
13615 struct tg3 *tp = netdev_priv(dev); 13601 struct tg3 *tp = netdev_priv(dev);
13602 pci_power_t target_state;
13616 int err; 13603 int err;
13617 13604
13618 /* PCI register 4 needs to be saved whether netif_running() or not. 13605 /* PCI register 4 needs to be saved whether netif_running() or not.
@@ -13641,7 +13628,9 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
13641 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; 13628 tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
13642 tg3_full_unlock(tp); 13629 tg3_full_unlock(tp);
13643 13630
13644 err = tg3_set_power_state(tp, pci_choose_state(pdev, state)); 13631 target_state = pdev->pm_cap ? pci_target_state(pdev) : PCI_D3hot;
13632
13633 err = tg3_set_power_state(tp, target_state);
13645 if (err) { 13634 if (err) {
13646 int err2; 13635 int err2;
13647 13636
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index f7319d326912..78df2be8a728 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -55,12 +55,28 @@
55 55
56static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data) 56static int dm_read(struct usbnet *dev, u8 reg, u16 length, void *data)
57{ 57{
58 void *buf;
59 int err = -ENOMEM;
60
58 devdbg(dev, "dm_read() reg=0x%02x length=%d", reg, length); 61 devdbg(dev, "dm_read() reg=0x%02x length=%d", reg, length);
59 return usb_control_msg(dev->udev, 62
60 usb_rcvctrlpipe(dev->udev, 0), 63 buf = kmalloc(length, GFP_KERNEL);
61 DM_READ_REGS, 64 if (!buf)
62 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 65 goto out;
63 0, reg, data, length, USB_CTRL_SET_TIMEOUT); 66
67 err = usb_control_msg(dev->udev,
68 usb_rcvctrlpipe(dev->udev, 0),
69 DM_READ_REGS,
70 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
71 0, reg, buf, length, USB_CTRL_SET_TIMEOUT);
72 if (err == length)
73 memcpy(data, buf, length);
74 else if (err >= 0)
75 err = -EINVAL;
76 kfree(buf);
77
78 out:
79 return err;
64} 80}
65 81
66static int dm_read_reg(struct usbnet *dev, u8 reg, u8 *value) 82static int dm_read_reg(struct usbnet *dev, u8 reg, u8 *value)
@@ -70,12 +86,28 @@ static int dm_read_reg(struct usbnet *dev, u8 reg, u8 *value)
70 86
71static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data) 87static int dm_write(struct usbnet *dev, u8 reg, u16 length, void *data)
72{ 88{
89 void *buf = NULL;
90 int err = -ENOMEM;
91
73 devdbg(dev, "dm_write() reg=0x%02x, length=%d", reg, length); 92 devdbg(dev, "dm_write() reg=0x%02x, length=%d", reg, length);
74 return usb_control_msg(dev->udev, 93
75 usb_sndctrlpipe(dev->udev, 0), 94 if (data) {
76 DM_WRITE_REGS, 95 buf = kmalloc(length, GFP_KERNEL);
77 USB_DIR_OUT | USB_TYPE_VENDOR |USB_RECIP_DEVICE, 96 if (!buf)
78 0, reg, data, length, USB_CTRL_SET_TIMEOUT); 97 goto out;
98 memcpy(buf, data, length);
99 }
100
101 err = usb_control_msg(dev->udev,
102 usb_sndctrlpipe(dev->udev, 0),
103 DM_WRITE_REGS,
104 USB_DIR_OUT | USB_TYPE_VENDOR |USB_RECIP_DEVICE,
105 0, reg, buf, length, USB_CTRL_SET_TIMEOUT);
106 kfree(buf);
107 if (err >= 0 && err < length)
108 err = -EINVAL;
109 out:
110 return err;
79} 111}
80 112
81static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value) 113static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value)
diff --git a/drivers/net/wd.c b/drivers/net/wd.c
index fa14255282af..6f9aa1643743 100644
--- a/drivers/net/wd.c
+++ b/drivers/net/wd.c
@@ -337,7 +337,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
337#ifdef CONFIG_NET_POLL_CONTROLLER 337#ifdef CONFIG_NET_POLL_CONTROLLER
338 dev->poll_controller = ei_poll; 338 dev->poll_controller = ei_poll;
339#endif 339#endif
340 NS8390_init(dev, 0); 340 NS8390p_init(dev, 0);
341 341
342#if 1 342#if 1
343 /* Enable interrupt generation on softconfig cards -- M.U */ 343 /* Enable interrupt generation on softconfig cards -- M.U */
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index d9769c527346..ff3fad794b61 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -43,7 +43,9 @@
43#include <linux/version.h> 43#include <linux/version.h>
44#include <linux/module.h> 44#include <linux/module.h>
45#include <linux/delay.h> 45#include <linux/delay.h>
46#include <linux/hardirq.h>
46#include <linux/if.h> 47#include <linux/if.h>
48#include <linux/io.h>
47#include <linux/netdevice.h> 49#include <linux/netdevice.h>
48#include <linux/cache.h> 50#include <linux/cache.h>
49#include <linux/pci.h> 51#include <linux/pci.h>
@@ -471,9 +473,6 @@ ath5k_pci_probe(struct pci_dev *pdev,
471 /* Set private data */ 473 /* Set private data */
472 pci_set_drvdata(pdev, hw); 474 pci_set_drvdata(pdev, hw);
473 475
474 /* Enable msi for devices that support it */
475 pci_enable_msi(pdev);
476
477 /* Setup interrupt handler */ 476 /* Setup interrupt handler */
478 ret = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc); 477 ret = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
479 if (ret) { 478 if (ret) {
@@ -551,7 +550,6 @@ err_ah:
551err_irq: 550err_irq:
552 free_irq(pdev->irq, sc); 551 free_irq(pdev->irq, sc);
553err_free: 552err_free:
554 pci_disable_msi(pdev);
555 ieee80211_free_hw(hw); 553 ieee80211_free_hw(hw);
556err_map: 554err_map:
557 pci_iounmap(pdev, mem); 555 pci_iounmap(pdev, mem);
@@ -573,7 +571,6 @@ ath5k_pci_remove(struct pci_dev *pdev)
573 ath5k_detach(pdev, hw); 571 ath5k_detach(pdev, hw);
574 ath5k_hw_detach(sc->ah); 572 ath5k_hw_detach(sc->ah);
575 free_irq(pdev->irq, sc); 573 free_irq(pdev->irq, sc);
576 pci_disable_msi(pdev);
577 pci_iounmap(pdev, sc->iobase); 574 pci_iounmap(pdev, sc->iobase);
578 pci_release_region(pdev, 0); 575 pci_release_region(pdev, 0);
579 pci_disable_device(pdev); 576 pci_disable_device(pdev);
@@ -590,6 +587,9 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
590 ath5k_led_off(sc); 587 ath5k_led_off(sc);
591 588
592 ath5k_stop_hw(sc); 589 ath5k_stop_hw(sc);
590
591 free_irq(pdev->irq, sc);
592 pci_disable_msi(pdev);
593 pci_save_state(pdev); 593 pci_save_state(pdev);
594 pci_disable_device(pdev); 594 pci_disable_device(pdev);
595 pci_set_power_state(pdev, PCI_D3hot); 595 pci_set_power_state(pdev, PCI_D3hot);
@@ -605,15 +605,12 @@ ath5k_pci_resume(struct pci_dev *pdev)
605 struct ath5k_hw *ah = sc->ah; 605 struct ath5k_hw *ah = sc->ah;
606 int i, err; 606 int i, err;
607 607
608 err = pci_set_power_state(pdev, PCI_D0); 608 pci_restore_state(pdev);
609 if (err)
610 return err;
611 609
612 err = pci_enable_device(pdev); 610 err = pci_enable_device(pdev);
613 if (err) 611 if (err)
614 return err; 612 return err;
615 613
616 pci_restore_state(pdev);
617 /* 614 /*
618 * Suspend/Resume resets the PCI configuration space, so we have to 615 * Suspend/Resume resets the PCI configuration space, so we have to
619 * re-disable the RETRY_TIMEOUT register (0x41) to keep 616 * re-disable the RETRY_TIMEOUT register (0x41) to keep
@@ -621,7 +618,17 @@ ath5k_pci_resume(struct pci_dev *pdev)
621 */ 618 */
622 pci_write_config_byte(pdev, 0x41, 0); 619 pci_write_config_byte(pdev, 0x41, 0);
623 620
624 ath5k_init(sc); 621 pci_enable_msi(pdev);
622
623 err = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
624 if (err) {
625 ATH5K_ERR(sc, "request_irq failed\n");
626 goto err_msi;
627 }
628
629 err = ath5k_init(sc);
630 if (err)
631 goto err_irq;
625 ath5k_led_enable(sc); 632 ath5k_led_enable(sc);
626 633
627 /* 634 /*
@@ -635,6 +642,12 @@ ath5k_pci_resume(struct pci_dev *pdev)
635 ath5k_hw_reset_key(ah, i); 642 ath5k_hw_reset_key(ah, i);
636 643
637 return 0; 644 return 0;
645err_irq:
646 free_irq(pdev->irq, sc);
647err_msi:
648 pci_disable_msi(pdev);
649 pci_disable_device(pdev);
650 return err;
638} 651}
639#endif /* CONFIG_PM */ 652#endif /* CONFIG_PM */
640 653
@@ -1224,7 +1237,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1224 1237
1225 pktlen = skb->len; 1238 pktlen = skb->len;
1226 1239
1227 if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)) { 1240 if (info->control.hw_key) {
1228 keyidx = info->control.hw_key->hw_key_idx; 1241 keyidx = info->control.hw_key->hw_key_idx;
1229 pktlen += info->control.icv_len; 1242 pktlen += info->control.icv_len;
1230 } 1243 }
@@ -1249,6 +1262,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1249 1262
1250 txq->link = &ds->ds_link; 1263 txq->link = &ds->ds_link;
1251 ath5k_hw_tx_start(ah, txq->qnum); 1264 ath5k_hw_tx_start(ah, txq->qnum);
1265 mmiowb();
1252 spin_unlock_bh(&txq->lock); 1266 spin_unlock_bh(&txq->lock);
1253 1267
1254 return 0; 1268 return 0;
@@ -1583,7 +1597,6 @@ ath5k_rx_stop(struct ath5k_softc *sc)
1583 ath5k_hw_stop_pcu_recv(ah); /* disable PCU */ 1597 ath5k_hw_stop_pcu_recv(ah); /* disable PCU */
1584 ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */ 1598 ath5k_hw_set_rx_filter(ah, 0); /* clear recv filter */
1585 ath5k_hw_stop_rx_dma(ah); /* disable DMA engine */ 1599 ath5k_hw_stop_rx_dma(ah); /* disable DMA engine */
1586 mdelay(3); /* 3ms is long enough for 1 frame */
1587 1600
1588 ath5k_debug_printrxbuffs(sc, ah); 1601 ath5k_debug_printrxbuffs(sc, ah);
1589 1602
@@ -1682,31 +1695,44 @@ ath5k_tasklet_rx(unsigned long data)
1682 struct ath5k_rx_status rs = {}; 1695 struct ath5k_rx_status rs = {};
1683 struct sk_buff *skb; 1696 struct sk_buff *skb;
1684 struct ath5k_softc *sc = (void *)data; 1697 struct ath5k_softc *sc = (void *)data;
1685 struct ath5k_buf *bf; 1698 struct ath5k_buf *bf, *bf_last;
1686 struct ath5k_desc *ds; 1699 struct ath5k_desc *ds;
1687 int ret; 1700 int ret;
1688 int hdrlen; 1701 int hdrlen;
1689 int pad; 1702 int pad;
1690 1703
1691 spin_lock(&sc->rxbuflock); 1704 spin_lock(&sc->rxbuflock);
1705 if (list_empty(&sc->rxbuf)) {
1706 ATH5K_WARN(sc, "empty rx buf pool\n");
1707 goto unlock;
1708 }
1709 bf_last = list_entry(sc->rxbuf.prev, struct ath5k_buf, list);
1692 do { 1710 do {
1693 rxs.flag = 0; 1711 rxs.flag = 0;
1694 1712
1695 if (unlikely(list_empty(&sc->rxbuf))) {
1696 ATH5K_WARN(sc, "empty rx buf pool\n");
1697 break;
1698 }
1699 bf = list_first_entry(&sc->rxbuf, struct ath5k_buf, list); 1713 bf = list_first_entry(&sc->rxbuf, struct ath5k_buf, list);
1700 BUG_ON(bf->skb == NULL); 1714 BUG_ON(bf->skb == NULL);
1701 skb = bf->skb; 1715 skb = bf->skb;
1702 ds = bf->desc; 1716 ds = bf->desc;
1703 1717
1704 /* TODO only one segment */ 1718 /*
1705 pci_dma_sync_single_for_cpu(sc->pdev, sc->desc_daddr, 1719 * last buffer must not be freed to ensure proper hardware
1706 sc->desc_len, PCI_DMA_FROMDEVICE); 1720 * function. When the hardware finishes also a packet next to
1707 1721 * it, we are sure, it doesn't use it anymore and we can go on.
1708 if (unlikely(ds->ds_link == bf->daddr)) /* this is the end */ 1722 */
1709 break; 1723 if (bf_last == bf)
1724 bf->flags |= 1;
1725 if (bf->flags) {
1726 struct ath5k_buf *bf_next = list_entry(bf->list.next,
1727 struct ath5k_buf, list);
1728 ret = sc->ah->ah_proc_rx_desc(sc->ah, bf_next->desc,
1729 &rs);
1730 if (ret)
1731 break;
1732 bf->flags &= ~1;
1733 /* skip the overwritten one (even status is martian) */
1734 goto next;
1735 }
1710 1736
1711 ret = sc->ah->ah_proc_rx_desc(sc->ah, ds, &rs); 1737 ret = sc->ah->ah_proc_rx_desc(sc->ah, ds, &rs);
1712 if (unlikely(ret == -EINPROGRESS)) 1738 if (unlikely(ret == -EINPROGRESS))
@@ -1752,8 +1778,6 @@ ath5k_tasklet_rx(unsigned long data)
1752 goto next; 1778 goto next;
1753 } 1779 }
1754accept: 1780accept:
1755 pci_dma_sync_single_for_cpu(sc->pdev, bf->skbaddr,
1756 rs.rs_datalen, PCI_DMA_FROMDEVICE);
1757 pci_unmap_single(sc->pdev, bf->skbaddr, sc->rxbufsize, 1781 pci_unmap_single(sc->pdev, bf->skbaddr, sc->rxbufsize,
1758 PCI_DMA_FROMDEVICE); 1782 PCI_DMA_FROMDEVICE);
1759 bf->skb = NULL; 1783 bf->skb = NULL;
@@ -1816,6 +1840,7 @@ accept:
1816next: 1840next:
1817 list_move_tail(&bf->list, &sc->rxbuf); 1841 list_move_tail(&bf->list, &sc->rxbuf);
1818 } while (ath5k_rxbuf_setup(sc, bf) == 0); 1842 } while (ath5k_rxbuf_setup(sc, bf) == 0);
1843unlock:
1819 spin_unlock(&sc->rxbuflock); 1844 spin_unlock(&sc->rxbuflock);
1820} 1845}
1821 1846
@@ -1840,9 +1865,6 @@ ath5k_tx_processq(struct ath5k_softc *sc, struct ath5k_txq *txq)
1840 list_for_each_entry_safe(bf, bf0, &txq->q, list) { 1865 list_for_each_entry_safe(bf, bf0, &txq->q, list) {
1841 ds = bf->desc; 1866 ds = bf->desc;
1842 1867
1843 /* TODO only one segment */
1844 pci_dma_sync_single_for_cpu(sc->pdev, sc->desc_daddr,
1845 sc->desc_len, PCI_DMA_FROMDEVICE);
1846 ret = sc->ah->ah_proc_tx_desc(sc->ah, ds, &ts); 1868 ret = sc->ah->ah_proc_tx_desc(sc->ah, ds, &ts);
1847 if (unlikely(ret == -EINPROGRESS)) 1869 if (unlikely(ret == -EINPROGRESS))
1848 break; 1870 break;
@@ -2015,8 +2037,6 @@ ath5k_beacon_send(struct ath5k_softc *sc)
2015 ATH5K_WARN(sc, "beacon queue %u didn't stop?\n", sc->bhalq); 2037 ATH5K_WARN(sc, "beacon queue %u didn't stop?\n", sc->bhalq);
2016 /* NB: hw still stops DMA, so proceed */ 2038 /* NB: hw still stops DMA, so proceed */
2017 } 2039 }
2018 pci_dma_sync_single_for_cpu(sc->pdev, bf->skbaddr, bf->skb->len,
2019 PCI_DMA_TODEVICE);
2020 2040
2021 ath5k_hw_put_tx_buf(ah, sc->bhalq, bf->daddr); 2041 ath5k_hw_put_tx_buf(ah, sc->bhalq, bf->daddr);
2022 ath5k_hw_tx_start(ah, sc->bhalq); 2042 ath5k_hw_tx_start(ah, sc->bhalq);
@@ -2240,6 +2260,7 @@ ath5k_init(struct ath5k_softc *sc)
2240 2260
2241 ret = 0; 2261 ret = 0;
2242done: 2262done:
2263 mmiowb();
2243 mutex_unlock(&sc->lock); 2264 mutex_unlock(&sc->lock);
2244 return ret; 2265 return ret;
2245} 2266}
@@ -2272,6 +2293,7 @@ ath5k_stop_locked(struct ath5k_softc *sc)
2272 if (!test_bit(ATH_STAT_INVALID, sc->status)) { 2293 if (!test_bit(ATH_STAT_INVALID, sc->status)) {
2273 ath5k_led_off(sc); 2294 ath5k_led_off(sc);
2274 ath5k_hw_set_intr(ah, 0); 2295 ath5k_hw_set_intr(ah, 0);
2296 synchronize_irq(sc->pdev->irq);
2275 } 2297 }
2276 ath5k_txq_cleanup(sc); 2298 ath5k_txq_cleanup(sc);
2277 if (!test_bit(ATH_STAT_INVALID, sc->status)) { 2299 if (!test_bit(ATH_STAT_INVALID, sc->status)) {
@@ -2321,9 +2343,13 @@ ath5k_stop_hw(struct ath5k_softc *sc)
2321 } 2343 }
2322 } 2344 }
2323 ath5k_txbuf_free(sc, sc->bbuf); 2345 ath5k_txbuf_free(sc, sc->bbuf);
2346 mmiowb();
2324 mutex_unlock(&sc->lock); 2347 mutex_unlock(&sc->lock);
2325 2348
2326 del_timer_sync(&sc->calib_tim); 2349 del_timer_sync(&sc->calib_tim);
2350 tasklet_kill(&sc->rxtq);
2351 tasklet_kill(&sc->txtq);
2352 tasklet_kill(&sc->restq);
2327 2353
2328 return ret; 2354 return ret;
2329} 2355}
@@ -2550,8 +2576,6 @@ ath5k_init_leds(struct ath5k_softc *sc)
2550 struct pci_dev *pdev = sc->pdev; 2576 struct pci_dev *pdev = sc->pdev;
2551 char name[ATH5K_LED_MAX_NAME_LEN + 1]; 2577 char name[ATH5K_LED_MAX_NAME_LEN + 1];
2552 2578
2553 sc->led_on = 0; /* active low */
2554
2555 /* 2579 /*
2556 * Auto-enable soft led processing for IBM cards and for 2580 * Auto-enable soft led processing for IBM cards and for
2557 * 5211 minipci cards. 2581 * 5211 minipci cards.
@@ -2560,11 +2584,13 @@ ath5k_init_leds(struct ath5k_softc *sc)
2560 pdev->device == PCI_DEVICE_ID_ATHEROS_AR5211) { 2584 pdev->device == PCI_DEVICE_ID_ATHEROS_AR5211) {
2561 __set_bit(ATH_STAT_LEDSOFT, sc->status); 2585 __set_bit(ATH_STAT_LEDSOFT, sc->status);
2562 sc->led_pin = 0; 2586 sc->led_pin = 0;
2587 sc->led_on = 0; /* active low */
2563 } 2588 }
2564 /* Enable softled on PIN1 on HP Compaq nc6xx, nc4000 & nx5000 laptops */ 2589 /* Enable softled on PIN1 on HP Compaq nc6xx, nc4000 & nx5000 laptops */
2565 if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ) { 2590 if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ) {
2566 __set_bit(ATH_STAT_LEDSOFT, sc->status); 2591 __set_bit(ATH_STAT_LEDSOFT, sc->status);
2567 sc->led_pin = 1; 2592 sc->led_pin = 1;
2593 sc->led_on = 1; /* active high */
2568 } 2594 }
2569 if (!test_bit(ATH_STAT_LEDSOFT, sc->status)) 2595 if (!test_bit(ATH_STAT_LEDSOFT, sc->status))
2570 goto out; 2596 goto out;
@@ -2783,6 +2809,7 @@ ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2783 /* XXX: assoc id is set to 0 for now, mac80211 doesn't have 2809 /* XXX: assoc id is set to 0 for now, mac80211 doesn't have
2784 * a clean way of letting us retrieve this yet. */ 2810 * a clean way of letting us retrieve this yet. */
2785 ath5k_hw_set_associd(ah, ah->ah_bssid, 0); 2811 ath5k_hw_set_associd(ah, ah->ah_bssid, 0);
2812 mmiowb();
2786 } 2813 }
2787 2814
2788 if (conf->changed & IEEE80211_IFCC_BEACON && 2815 if (conf->changed & IEEE80211_IFCC_BEACON &&
@@ -2971,6 +2998,7 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2971 } 2998 }
2972 2999
2973unlock: 3000unlock:
3001 mmiowb();
2974 mutex_unlock(&sc->lock); 3002 mutex_unlock(&sc->lock);
2975 return ret; 3003 return ret;
2976} 3004}
@@ -3032,8 +3060,6 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
3032 3060
3033 ath5k_debug_dump_skb(sc, skb, "BC ", 1); 3061 ath5k_debug_dump_skb(sc, skb, "BC ", 1);
3034 3062
3035 mutex_lock(&sc->lock);
3036
3037 if (sc->opmode != IEEE80211_IF_TYPE_IBSS) { 3063 if (sc->opmode != IEEE80211_IF_TYPE_IBSS) {
3038 ret = -EIO; 3064 ret = -EIO;
3039 goto end; 3065 goto end;
@@ -3044,11 +3070,12 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
3044 ret = ath5k_beacon_setup(sc, sc->bbuf); 3070 ret = ath5k_beacon_setup(sc, sc->bbuf);
3045 if (ret) 3071 if (ret)
3046 sc->bbuf->skb = NULL; 3072 sc->bbuf->skb = NULL;
3047 else 3073 else {
3048 ath5k_beacon_config(sc); 3074 ath5k_beacon_config(sc);
3075 mmiowb();
3076 }
3049 3077
3050end: 3078end:
3051 mutex_unlock(&sc->lock);
3052 return ret; 3079 return ret;
3053} 3080}
3054 3081
diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h
index 47f414b09e67..d7e03e6b8271 100644
--- a/drivers/net/wireless/ath5k/base.h
+++ b/drivers/net/wireless/ath5k/base.h
@@ -56,7 +56,7 @@
56 56
57struct ath5k_buf { 57struct ath5k_buf {
58 struct list_head list; 58 struct list_head list;
59 unsigned int flags; /* tx descriptor flags */ 59 unsigned int flags; /* rx descriptor flags */
60 struct ath5k_desc *desc; /* virtual addr of desc */ 60 struct ath5k_desc *desc; /* virtual addr of desc */
61 dma_addr_t daddr; /* physical addr of desc */ 61 dma_addr_t daddr; /* physical addr of desc */
62 struct sk_buff *skb; /* skbuff for buf */ 62 struct sk_buff *skb; /* skbuff for buf */
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c
index c6d12c53bda4..7ca87a557312 100644
--- a/drivers/net/wireless/ath5k/hw.c
+++ b/drivers/net/wireless/ath5k/hw.c
@@ -1440,6 +1440,7 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
1440 1440
1441 /* Stop queue */ 1441 /* Stop queue */
1442 ath5k_hw_reg_write(ah, tx_queue, AR5K_CR); 1442 ath5k_hw_reg_write(ah, tx_queue, AR5K_CR);
1443 ath5k_hw_reg_read(ah, AR5K_CR);
1443 } else { 1444 } else {
1444 /* 1445 /*
1445 * Schedule TX disable and wait until queue is empty 1446 * Schedule TX disable and wait until queue is empty
@@ -1456,6 +1457,8 @@ int ath5k_hw_stop_tx_dma(struct ath5k_hw *ah, unsigned int queue)
1456 1457
1457 /* Clear register */ 1458 /* Clear register */
1458 ath5k_hw_reg_write(ah, 0, AR5K_QCU_TXD); 1459 ath5k_hw_reg_write(ah, 0, AR5K_QCU_TXD);
1460 if (pending)
1461 return -EBUSY;
1459 } 1462 }
1460 1463
1461 /* TODO: Check for success else return error */ 1464 /* TODO: Check for success else return error */
@@ -1716,6 +1719,7 @@ enum ath5k_int ath5k_hw_set_intr(struct ath5k_hw *ah, enum ath5k_int new_mask)
1716 1719
1717 /* ..re-enable interrupts */ 1720 /* ..re-enable interrupts */
1718 ath5k_hw_reg_write(ah, AR5K_IER_ENABLE, AR5K_IER); 1721 ath5k_hw_reg_write(ah, AR5K_IER_ENABLE, AR5K_IER);
1722 ath5k_hw_reg_read(ah, AR5K_IER);
1719 1723
1720 return old_mask; 1724 return old_mask;
1721} 1725}
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index e78319aa47c1..3bf3a869361f 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -4645,8 +4645,7 @@ static int b43_wireless_init(struct ssb_device *dev)
4645 } 4645 }
4646 4646
4647 /* fill hw info */ 4647 /* fill hw info */
4648 hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | 4648 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
4649 IEEE80211_HW_RX_INCLUDES_FCS |
4650 IEEE80211_HW_SIGNAL_DBM | 4649 IEEE80211_HW_SIGNAL_DBM |
4651 IEEE80211_HW_NOISE_DBM; 4650 IEEE80211_HW_NOISE_DBM;
4652 4651
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 8d54502222a6..9dda8169f7cc 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -192,7 +192,7 @@ int b43_generate_txhdr(struct b43_wldev *dev,
192 const struct b43_phy *phy = &dev->phy; 192 const struct b43_phy *phy = &dev->phy;
193 const struct ieee80211_hdr *wlhdr = 193 const struct ieee80211_hdr *wlhdr =
194 (const struct ieee80211_hdr *)fragment_data; 194 (const struct ieee80211_hdr *)fragment_data;
195 int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)); 195 int use_encryption = !!info->control.hw_key;
196 __le16 fctl = wlhdr->frame_control; 196 __le16 fctl = wlhdr->frame_control;
197 struct ieee80211_rate *fbrate; 197 struct ieee80211_rate *fbrate;
198 u8 rate, rate_fb; 198 u8 rate, rate_fb;
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index a1b8bf3ee732..2541c81932f0 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -3702,8 +3702,7 @@ static int b43legacy_wireless_init(struct ssb_device *dev)
3702 } 3702 }
3703 3703
3704 /* fill hw info */ 3704 /* fill hw info */
3705 hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | 3705 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
3706 IEEE80211_HW_RX_INCLUDES_FCS |
3707 IEEE80211_HW_SIGNAL_DBM | 3706 IEEE80211_HW_SIGNAL_DBM |
3708 IEEE80211_HW_NOISE_DBM; 3707 IEEE80211_HW_NOISE_DBM;
3709 hw->queues = 1; /* FIXME: hardware has more queues */ 3708 hw->queues = 1; /* FIXME: hardware has more queues */
@@ -3846,10 +3845,10 @@ static int b43legacy_resume(struct ssb_device *dev)
3846 goto out; 3845 goto out;
3847 } 3846 }
3848 } 3847 }
3849 mutex_unlock(&wl->mutex);
3850 3848
3851 b43legacydbg(wl, "Device resumed.\n"); 3849 b43legacydbg(wl, "Device resumed.\n");
3852out: 3850out:
3851 mutex_unlock(&wl->mutex);
3853 return err; 3852 return err;
3854} 3853}
3855 3854
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c
index e969ed8d412d..68e1f8c78727 100644
--- a/drivers/net/wireless/b43legacy/xmit.c
+++ b/drivers/net/wireless/b43legacy/xmit.c
@@ -192,7 +192,7 @@ static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
192 u16 cookie) 192 u16 cookie)
193{ 193{
194 const struct ieee80211_hdr *wlhdr; 194 const struct ieee80211_hdr *wlhdr;
195 int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)); 195 int use_encryption = !!info->control.hw_key;
196 u16 fctl; 196 u16 fctl;
197 u8 rate; 197 u8 rate;
198 struct ieee80211_rate *rate_fb; 198 struct ieee80211_rate *rate_fb;
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index 5bf9e00b070c..c6f886ec08a3 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -6442,6 +6442,7 @@ static int ipw2100_resume(struct pci_dev *pci_dev)
6442 if (err) { 6442 if (err) {
6443 printk(KERN_ERR "%s: pci_enable_device failed on resume\n", 6443 printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
6444 dev->name); 6444 dev->name);
6445 mutex_unlock(&priv->action_mutex);
6445 return err; 6446 return err;
6446 } 6447 }
6447 pci_restore_state(pci_dev); 6448 pci_restore_state(pci_dev);
@@ -7146,7 +7147,7 @@ static int ipw2100_wx_get_rate(struct net_device *dev,
7146 err = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &val, &len); 7147 err = ipw2100_get_ordinal(priv, IPW_ORD_CURRENT_TX_RATE, &val, &len);
7147 if (err) { 7148 if (err) {
7148 IPW_DEBUG_WX("failed querying ordinals.\n"); 7149 IPW_DEBUG_WX("failed querying ordinals.\n");
7149 return err; 7150 goto done;
7150 } 7151 }
7151 7152
7152 switch (val & TX_RATE_MASK) { 7153 switch (val & TX_RATE_MASK) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index c2a76785b665..a51e0eaa1334 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -630,7 +630,9 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv,
630 struct ieee80211_rx_status *stats) 630 struct ieee80211_rx_status *stats)
631{ 631{
632 struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data; 632 struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
633#ifdef CONFIG_IWL3945_LEDS
633 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); 634 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
635#endif
634 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); 636 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
635 struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); 637 struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
636 short len = le16_to_cpu(rx_hdr->len); 638 short len = le16_to_cpu(rx_hdr->len);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index a44188bf4459..e3427c205ccf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -818,8 +818,7 @@ int iwl_setup_mac(struct iwl_priv *priv)
818 hw->rate_control_algorithm = "iwl-4965-rs"; 818 hw->rate_control_algorithm = "iwl-4965-rs";
819 819
820 /* Tell mac80211 our characteristics */ 820 /* Tell mac80211 our characteristics */
821 hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | 821 hw->flags = IEEE80211_HW_SIGNAL_DBM |
822 IEEE80211_HW_SIGNAL_DBM |
823 IEEE80211_HW_NOISE_DBM; 822 IEEE80211_HW_NOISE_DBM;
824 /* Default value; 4 EDCA QOS priorities */ 823 /* Default value; 4 EDCA QOS priorities */
825 hw->queues = 4; 824 hw->queues = 4;
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 58384805a494..d6d729e86bdb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -68,12 +68,8 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv);
68#endif 68#endif
69 69
70#else 70#else
71static inline void IWL_DEBUG(int level, const char *fmt, ...) 71#define IWL_DEBUG(level, fmt, args...)
72{ 72#define IWL_DEBUG_LIMIT(level, fmt, args...)
73}
74static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
75{
76}
77#endif /* CONFIG_IWLWIFI_DEBUG */ 73#endif /* CONFIG_IWLWIFI_DEBUG */
78 74
79 75
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index 899d7a2567a8..61250e6a7d1b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-led.c
@@ -268,7 +268,9 @@ static int iwl_get_blink_rate(struct iwl_priv *priv)
268 if (tpt < 0) /* wrapparound */ 268 if (tpt < 0) /* wrapparound */
269 tpt = -tpt; 269 tpt = -tpt;
270 270
271 IWL_DEBUG_LED("tpt %lld current_tpt %lld\n", tpt, current_tpt); 271 IWL_DEBUG_LED("tpt %lld current_tpt %llu\n",
272 (long long)tpt,
273 (unsigned long long)current_tpt);
272 priv->led_tpt = current_tpt; 274 priv->led_tpt = current_tpt;
273 275
274 if (!priv->allow_blinking) 276 if (!priv->allow_blinking)
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index efc750d2fc5c..5a00ac23e2d0 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -270,6 +270,7 @@ static void iwl_rx_scan_results_notif(struct iwl_priv *priv,
270static void iwl_rx_scan_complete_notif(struct iwl_priv *priv, 270static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
271 struct iwl_rx_mem_buffer *rxb) 271 struct iwl_rx_mem_buffer *rxb)
272{ 272{
273#ifdef CONFIG_IWLWIFI_DEBUG
273 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 274 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
274 struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; 275 struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
275 276
@@ -277,6 +278,7 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
277 scan_notif->scanned_channels, 278 scan_notif->scanned_channels,
278 scan_notif->tsf_low, 279 scan_notif->tsf_low,
279 scan_notif->tsf_high, scan_notif->status); 280 scan_notif->tsf_high, scan_notif->status);
281#endif
280 282
281 /* The HW is no longer scanning */ 283 /* The HW is no longer scanning */
282 clear_bit(STATUS_SCAN_HW, &priv->status); 284 clear_bit(STATUS_SCAN_HW, &priv->status);
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 9b50b1052b09..f72cd0bf6aa3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -906,7 +906,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
906 * first entry */ 906 * first entry */
907 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); 907 iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
908 908
909 if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)) 909 if (info->control.hw_key)
910 iwl_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id); 910 iwl_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id);
911 911
912 /* Set up TFD's 2nd entry to point directly to remainder of skb, 912 /* Set up TFD's 2nd entry to point directly to remainder of skb,
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 4a22d3fba75b..7c82ecfa30a4 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2667,7 +2667,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
2667 * first entry */ 2667 * first entry */
2668 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len); 2668 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
2669 2669
2670 if (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)) 2670 if (info->control.hw_key)
2671 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, 0); 2671 iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, 0);
2672 2672
2673 /* Set up TFD's 2nd entry to point directly to remainder of skb, 2673 /* Set up TFD's 2nd entry to point directly to remainder of skb,
@@ -7899,8 +7899,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
7899 priv->ibss_beacon = NULL; 7899 priv->ibss_beacon = NULL;
7900 7900
7901 /* Tell mac80211 our characteristics */ 7901 /* Tell mac80211 our characteristics */
7902 hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | 7902 hw->flags = IEEE80211_HW_SIGNAL_DBM |
7903 IEEE80211_HW_SIGNAL_DBM |
7904 IEEE80211_HW_NOISE_DBM; 7903 IEEE80211_HW_NOISE_DBM;
7905 7904
7906 /* 4 EDCA QOS priorities */ 7905 /* 4 EDCA QOS priorities */
diff --git a/drivers/net/wireless/libertas/persistcfg.c b/drivers/net/wireless/libertas/persistcfg.c
index 6d0ff8decaf7..3309a9c3cfef 100644
--- a/drivers/net/wireless/libertas/persistcfg.c
+++ b/drivers/net/wireless/libertas/persistcfg.c
@@ -48,7 +48,7 @@ static ssize_t bootflag_get(struct device *dev,
48 if (ret) 48 if (ret)
49 return ret; 49 return ret;
50 50
51 return snprintf(buf, 12, "0x%x\n", le32_to_cpu(defs.bootflag)); 51 return snprintf(buf, 12, "%d\n", le32_to_cpu(defs.bootflag));
52} 52}
53 53
54/** 54/**
@@ -63,8 +63,8 @@ static ssize_t bootflag_set(struct device *dev, struct device_attribute *attr,
63 int ret; 63 int ret;
64 64
65 memset(&cmd, 0, sizeof(cmd)); 65 memset(&cmd, 0, sizeof(cmd));
66 ret = sscanf(buf, "%x", &datum); 66 ret = sscanf(buf, "%d", &datum);
67 if (ret != 1) 67 if ((ret != 1) || (datum > 1))
68 return -EINVAL; 68 return -EINVAL;
69 69
70 *((__le32 *)&cmd.data[0]) = cpu_to_le32(!!datum); 70 *((__le32 *)&cmd.data[0]) = cpu_to_le32(!!datum);
@@ -91,7 +91,7 @@ static ssize_t boottime_get(struct device *dev,
91 if (ret) 91 if (ret)
92 return ret; 92 return ret;
93 93
94 return snprintf(buf, 12, "0x%x\n", defs.boottime); 94 return snprintf(buf, 12, "%d\n", defs.boottime);
95} 95}
96 96
97/** 97/**
@@ -106,8 +106,8 @@ static ssize_t boottime_set(struct device *dev,
106 int ret; 106 int ret;
107 107
108 memset(&cmd, 0, sizeof(cmd)); 108 memset(&cmd, 0, sizeof(cmd));
109 ret = sscanf(buf, "%x", &datum); 109 ret = sscanf(buf, "%d", &datum);
110 if (ret != 1) 110 if ((ret != 1) || (datum > 255))
111 return -EINVAL; 111 return -EINVAL;
112 112
113 /* A too small boot time will result in the device booting into 113 /* A too small boot time will result in the device booting into
@@ -143,7 +143,7 @@ static ssize_t channel_get(struct device *dev,
143 if (ret) 143 if (ret)
144 return ret; 144 return ret;
145 145
146 return snprintf(buf, 12, "0x%x\n", le16_to_cpu(defs.channel)); 146 return snprintf(buf, 12, "%d\n", le16_to_cpu(defs.channel));
147} 147}
148 148
149/** 149/**
@@ -154,11 +154,11 @@ static ssize_t channel_set(struct device *dev, struct device_attribute *attr,
154{ 154{
155 struct lbs_private *priv = to_net_dev(dev)->priv; 155 struct lbs_private *priv = to_net_dev(dev)->priv;
156 struct cmd_ds_mesh_config cmd; 156 struct cmd_ds_mesh_config cmd;
157 uint16_t datum; 157 uint32_t datum;
158 int ret; 158 int ret;
159 159
160 memset(&cmd, 0, sizeof(cmd)); 160 memset(&cmd, 0, sizeof(cmd));
161 ret = sscanf(buf, "%hx", &datum); 161 ret = sscanf(buf, "%d", &datum);
162 if (ret != 1 || datum < 1 || datum > 11) 162 if (ret != 1 || datum < 1 || datum > 11)
163 return -EINVAL; 163 return -EINVAL;
164 164
@@ -274,8 +274,8 @@ static ssize_t protocol_id_set(struct device *dev,
274 int ret; 274 int ret;
275 275
276 memset(&cmd, 0, sizeof(cmd)); 276 memset(&cmd, 0, sizeof(cmd));
277 ret = sscanf(buf, "%x", &datum); 277 ret = sscanf(buf, "%d", &datum);
278 if (ret != 1) 278 if ((ret != 1) || (datum > 255))
279 return -EINVAL; 279 return -EINVAL;
280 280
281 /* fetch all other Information Element parameters */ 281 /* fetch all other Information Element parameters */
@@ -328,8 +328,8 @@ static ssize_t metric_id_set(struct device *dev, struct device_attribute *attr,
328 int ret; 328 int ret;
329 329
330 memset(&cmd, 0, sizeof(cmd)); 330 memset(&cmd, 0, sizeof(cmd));
331 ret = sscanf(buf, "%x", &datum); 331 ret = sscanf(buf, "%d", &datum);
332 if (ret != 1) 332 if ((ret != 1) || (datum > 255))
333 return -EINVAL; 333 return -EINVAL;
334 334
335 /* fetch all other Information Element parameters */ 335 /* fetch all other Information Element parameters */
@@ -382,8 +382,8 @@ static ssize_t capability_set(struct device *dev, struct device_attribute *attr,
382 int ret; 382 int ret;
383 383
384 memset(&cmd, 0, sizeof(cmd)); 384 memset(&cmd, 0, sizeof(cmd));
385 ret = sscanf(buf, "%x", &datum); 385 ret = sscanf(buf, "%d", &datum);
386 if (ret != 1) 386 if ((ret != 1) || (datum > 255))
387 return -EINVAL; 387 return -EINVAL;
388 388
389 /* fetch all other Information Element parameters */ 389 /* fetch all other Information Element parameters */
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 5816230d58f8..248d31a7aa33 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -500,7 +500,7 @@ failed_hw:
500 device_unregister(data->dev); 500 device_unregister(data->dev);
501failed_drvdata: 501failed_drvdata:
502 ieee80211_free_hw(hw); 502 ieee80211_free_hw(hw);
503 hwsim_radios[i] = 0; 503 hwsim_radios[i] = NULL;
504failed: 504failed:
505 mac80211_hwsim_free(); 505 mac80211_hwsim_free();
506 return err; 506 return err;
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 3558cb210747..3078417b326b 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1121,6 +1121,7 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)
1121 int pipe = usb_sndbulkpipe(usb_dev, 1); 1121 int pipe = usb_sndbulkpipe(usb_dev, 1);
1122 int length; 1122 int length;
1123 u16 reg; 1123 u16 reg;
1124 u32 word, len;
1124 1125
1125 /* 1126 /*
1126 * Add the descriptor in front of the skb. 1127 * Add the descriptor in front of the skb.
@@ -1130,6 +1131,17 @@ static void rt2500usb_write_beacon(struct queue_entry *entry)
1130 skbdesc->desc = entry->skb->data; 1131 skbdesc->desc = entry->skb->data;
1131 1132
1132 /* 1133 /*
1134 * Adjust the beacon databyte count. The current number is
1135 * calculated before this function gets called, but falsely
1136 * assumes that the descriptor was already present in the SKB.
1137 */
1138 rt2x00_desc_read(skbdesc->desc, 0, &word);
1139 len = rt2x00_get_field32(word, TXD_W0_DATABYTE_COUNT);
1140 len += skbdesc->desc_len;
1141 rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, len);
1142 rt2x00_desc_write(skbdesc->desc, 0, word);
1143
1144 /*
1133 * Disable beaconing while we are reloading the beacon data, 1145 * Disable beaconing while we are reloading the beacon data,
1134 * otherwise we might be sending out invalid data. 1146 * otherwise we might be sending out invalid data.
1135 */ 1147 */
@@ -1650,7 +1662,6 @@ static void rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1650 * Initialize all hw fields. 1662 * Initialize all hw fields.
1651 */ 1663 */
1652 rt2x00dev->hw->flags = 1664 rt2x00dev->hw->flags =
1653 IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
1654 IEEE80211_HW_RX_INCLUDES_FCS | 1665 IEEE80211_HW_RX_INCLUDES_FCS |
1655 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 1666 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
1656 IEEE80211_HW_SIGNAL_DBM; 1667 IEEE80211_HW_SIGNAL_DBM;
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 07b03b3c7ef1..db2dc976d831 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -108,7 +108,10 @@
108#define SHORT_PIFS ( SIFS + SHORT_SLOT_TIME ) 108#define SHORT_PIFS ( SIFS + SHORT_SLOT_TIME )
109#define DIFS ( PIFS + SLOT_TIME ) 109#define DIFS ( PIFS + SLOT_TIME )
110#define SHORT_DIFS ( SHORT_PIFS + SHORT_SLOT_TIME ) 110#define SHORT_DIFS ( SHORT_PIFS + SHORT_SLOT_TIME )
111#define EIFS ( SIFS + (8 * (IEEE80211_HEADER + ACK_SIZE)) ) 111#define EIFS ( SIFS + DIFS + \
112 (8 * (IEEE80211_HEADER + ACK_SIZE)) )
113#define SHORT_EIFS ( SIFS + SHORT_DIFS + \
114 (8 * (IEEE80211_HEADER + ACK_SIZE)) )
112 115
113/* 116/*
114 * Chipset identification 117 * Chipset identification
@@ -597,6 +600,7 @@ enum rt2x00_flags {
597 DEVICE_STARTED_SUSPEND, 600 DEVICE_STARTED_SUSPEND,
598 DEVICE_ENABLED_RADIO, 601 DEVICE_ENABLED_RADIO,
599 DEVICE_DISABLED_RADIO_HW, 602 DEVICE_DISABLED_RADIO_HW,
603 DEVICE_DIRTY_CONFIG,
600 604
601 /* 605 /*
602 * Driver features 606 * Driver features
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index f20ca712504f..3f89516e8332 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -271,7 +271,7 @@ config:
271 libconf.sifs = SIFS; 271 libconf.sifs = SIFS;
272 libconf.pifs = short_slot_time ? SHORT_PIFS : PIFS; 272 libconf.pifs = short_slot_time ? SHORT_PIFS : PIFS;
273 libconf.difs = short_slot_time ? SHORT_DIFS : DIFS; 273 libconf.difs = short_slot_time ? SHORT_DIFS : DIFS;
274 libconf.eifs = EIFS; 274 libconf.eifs = short_slot_time ? SHORT_EIFS : EIFS;
275 } 275 }
276 276
277 libconf.conf = conf; 277 libconf.conf = conf;
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 8c93eb8353b0..f42283ad7b02 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -1013,6 +1013,7 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
1013 rt2x00dev->intf_associated = 0; 1013 rt2x00dev->intf_associated = 0;
1014 1014
1015 __set_bit(DEVICE_STARTED, &rt2x00dev->flags); 1015 __set_bit(DEVICE_STARTED, &rt2x00dev->flags);
1016 __set_bit(DEVICE_DIRTY_CONFIG, &rt2x00dev->flags);
1016 1017
1017 return 0; 1018 return 0;
1018} 1019}
@@ -1237,9 +1238,9 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
1237 /* 1238 /*
1238 * Reconfigure device. 1239 * Reconfigure device.
1239 */ 1240 */
1240 rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, 1); 1241 retval = rt2x00mac_config(rt2x00dev->hw, &rt2x00dev->hw->conf);
1241 if (!rt2x00dev->hw->conf.radio_enabled) 1242 if (retval)
1242 rt2x00lib_disable_radio(rt2x00dev); 1243 goto exit;
1243 1244
1244 /* 1245 /*
1245 * Iterator over each active interface to 1246 * Iterator over each active interface to
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h
index f2c9b0e79b5f..c5fb3a72cf37 100644
--- a/drivers/net/wireless/rt2x00/rt2x00lib.h
+++ b/drivers/net/wireless/rt2x00/rt2x00lib.h
@@ -125,13 +125,6 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
125void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); 125void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
126 126
127/** 127/**
128 * rt2x00queue_free_skb - free a skb
129 * @rt2x00dev: Pointer to &struct rt2x00_dev.
130 * @skb: The skb to free.
131 */
132void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb);
133
134/**
135 * rt2x00queue_write_tx_frame - Write TX frame to hardware 128 * rt2x00queue_write_tx_frame - Write TX frame to hardware
136 * @queue: Queue over which the frame should be send 129 * @queue: Queue over which the frame should be send
137 * @skb: The skb to send 130 * @skb: The skb to send
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index f1dcbaa80c3c..c3ee4ecba792 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -63,7 +63,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
63 */ 63 */
64 memcpy(skb->cb, frag_skb->cb, sizeof(skb->cb)); 64 memcpy(skb->cb, frag_skb->cb, sizeof(skb->cb));
65 rts_info = IEEE80211_SKB_CB(skb); 65 rts_info = IEEE80211_SKB_CB(skb);
66 rts_info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; 66 rts_info->control.hw_key = NULL;
67 rts_info->flags &= ~IEEE80211_TX_CTL_USE_RTS_CTS; 67 rts_info->flags &= ~IEEE80211_TX_CTL_USE_RTS_CTS;
68 rts_info->flags &= ~IEEE80211_TX_CTL_USE_CTS_PROTECT; 68 rts_info->flags &= ~IEEE80211_TX_CTL_USE_CTS_PROTECT;
69 rts_info->flags &= ~IEEE80211_TX_CTL_REQ_TX_STATUS; 69 rts_info->flags &= ~IEEE80211_TX_CTL_REQ_TX_STATUS;
@@ -83,6 +83,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
83 (struct ieee80211_rts *)(skb->data)); 83 (struct ieee80211_rts *)(skb->data));
84 84
85 if (rt2x00queue_write_tx_frame(queue, skb)) { 85 if (rt2x00queue_write_tx_frame(queue, skb)) {
86 dev_kfree_skb_any(skb);
86 WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n"); 87 WARNING(rt2x00dev, "Failed to send RTS/CTS frame.\n");
87 return NETDEV_TX_BUSY; 88 return NETDEV_TX_BUSY;
88 } 89 }
@@ -96,7 +97,6 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
96 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 97 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
97 struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data; 98 struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
98 enum data_queue_qid qid = skb_get_queue_mapping(skb); 99 enum data_queue_qid qid = skb_get_queue_mapping(skb);
99 struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
100 struct data_queue *queue; 100 struct data_queue *queue;
101 u16 frame_control; 101 u16 frame_control;
102 102
@@ -152,18 +152,6 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
152 } 152 }
153 } 153 }
154 154
155 /*
156 * XXX: This is as wrong as the old mac80211 code was,
157 * due to beacons not getting sequence numbers assigned
158 * properly.
159 */
160 if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
161 if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
162 intf->seqno += 0x10;
163 ieee80211hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
164 ieee80211hdr->seq_ctrl |= cpu_to_le16(intf->seqno);
165 }
166
167 if (rt2x00queue_write_tx_frame(queue, skb)) { 155 if (rt2x00queue_write_tx_frame(queue, skb)) {
168 ieee80211_stop_queue(rt2x00dev->hw, qid); 156 ieee80211_stop_queue(rt2x00dev->hw, qid);
169 return NETDEV_TX_BUSY; 157 return NETDEV_TX_BUSY;
@@ -322,6 +310,7 @@ EXPORT_SYMBOL_GPL(rt2x00mac_remove_interface);
322int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) 310int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
323{ 311{
324 struct rt2x00_dev *rt2x00dev = hw->priv; 312 struct rt2x00_dev *rt2x00dev = hw->priv;
313 int force_reconfig;
325 314
326 /* 315 /*
327 * Mac80211 might be calling this function while we are trying 316 * Mac80211 might be calling this function while we are trying
@@ -341,7 +330,17 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
341 rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF); 330 rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
342 } 331 }
343 332
344 rt2x00lib_config(rt2x00dev, conf, 0); 333 /*
334 * When the DEVICE_DIRTY_CONFIG flag is set, the device has recently
335 * been started and the configuration must be forced upon the hardware.
336 * Otherwise registers will not be intialized correctly and could
337 * result in non-working hardware because essential registers aren't
338 * initialized.
339 */
340 force_reconfig =
341 __test_and_clear_bit(DEVICE_DIRTY_CONFIG, &rt2x00dev->flags);
342
343 rt2x00lib_config(rt2x00dev, conf, force_reconfig);
345 344
346 /* 345 /*
347 * Reenable RX only if the radio should be on. 346 * Reenable RX only if the radio should be on.
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index 7f442030f5ad..3b27f6aa860c 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -120,6 +120,7 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
120{ 120{
121 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; 121 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
122 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb); 122 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
123 struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
123 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data; 124 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data;
124 struct ieee80211_rate *rate = 125 struct ieee80211_rate *rate =
125 ieee80211_get_tx_rate(rt2x00dev->hw, tx_info); 126 ieee80211_get_tx_rate(rt2x00dev->hw, tx_info);
@@ -200,6 +201,31 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
200 } 201 }
201 202
202 /* 203 /*
204 * Hardware should insert sequence counter.
205 * FIXME: We insert a software sequence counter first for
206 * hardware that doesn't support hardware sequence counting.
207 *
208 * This is wrong because beacons are not getting sequence
209 * numbers assigned properly.
210 *
211 * A secondary problem exists for drivers that cannot toggle
212 * sequence counting per-frame, since those will override the
213 * sequence counter given by mac80211.
214 */
215 if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
216 spin_lock(&intf->lock);
217
218 if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
219 intf->seqno += 0x10;
220 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
221 hdr->seq_ctrl |= cpu_to_le16(intf->seqno);
222
223 spin_unlock(&intf->lock);
224
225 __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
226 }
227
228 /*
203 * PLCP setup 229 * PLCP setup
204 * Length calculation depends on OFDM/CCK rate. 230 * Length calculation depends on OFDM/CCK rate.
205 */ 231 */
@@ -466,9 +492,12 @@ void rt2x00queue_init_rx(struct rt2x00_dev *rt2x00dev)
466 if (!rt2x00dev->ops->lib->init_rxentry) 492 if (!rt2x00dev->ops->lib->init_rxentry)
467 return; 493 return;
468 494
469 for (i = 0; i < queue->limit; i++) 495 for (i = 0; i < queue->limit; i++) {
496 queue->entries[i].flags = 0;
497
470 rt2x00dev->ops->lib->init_rxentry(rt2x00dev, 498 rt2x00dev->ops->lib->init_rxentry(rt2x00dev,
471 &queue->entries[i]); 499 &queue->entries[i]);
500 }
472} 501}
473 502
474void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev) 503void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev)
@@ -482,9 +511,12 @@ void rt2x00queue_init_tx(struct rt2x00_dev *rt2x00dev)
482 if (!rt2x00dev->ops->lib->init_txentry) 511 if (!rt2x00dev->ops->lib->init_txentry)
483 continue; 512 continue;
484 513
485 for (i = 0; i < queue->limit; i++) 514 for (i = 0; i < queue->limit; i++) {
515 queue->entries[i].flags = 0;
516
486 rt2x00dev->ops->lib->init_txentry(rt2x00dev, 517 rt2x00dev->ops->lib->init_txentry(rt2x00dev,
487 &queue->entries[i]); 518 &queue->entries[i]);
519 }
488 } 520 }
489} 521}
490 522
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index 8945945c892e..a4a8c57004db 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -199,6 +199,7 @@ struct txdone_entry_desc {
199 * @ENTRY_TXD_RTS_FRAME: This frame is a RTS frame. 199 * @ENTRY_TXD_RTS_FRAME: This frame is a RTS frame.
200 * @ENTRY_TXD_CTS_FRAME: This frame is a CTS-to-self frame. 200 * @ENTRY_TXD_CTS_FRAME: This frame is a CTS-to-self frame.
201 * @ENTRY_TXD_OFDM_RATE: This frame is send out with an OFDM rate. 201 * @ENTRY_TXD_OFDM_RATE: This frame is send out with an OFDM rate.
202 * @ENTRY_TXD_GENERATE_SEQ: This frame requires sequence counter.
202 * @ENTRY_TXD_FIRST_FRAGMENT: This is the first frame. 203 * @ENTRY_TXD_FIRST_FRAGMENT: This is the first frame.
203 * @ENTRY_TXD_MORE_FRAG: This frame is followed by another fragment. 204 * @ENTRY_TXD_MORE_FRAG: This frame is followed by another fragment.
204 * @ENTRY_TXD_REQ_TIMESTAMP: Require timestamp to be inserted. 205 * @ENTRY_TXD_REQ_TIMESTAMP: Require timestamp to be inserted.
@@ -210,6 +211,7 @@ enum txentry_desc_flags {
210 ENTRY_TXD_RTS_FRAME, 211 ENTRY_TXD_RTS_FRAME,
211 ENTRY_TXD_CTS_FRAME, 212 ENTRY_TXD_CTS_FRAME,
212 ENTRY_TXD_OFDM_RATE, 213 ENTRY_TXD_OFDM_RATE,
214 ENTRY_TXD_GENERATE_SEQ,
213 ENTRY_TXD_FIRST_FRAGMENT, 215 ENTRY_TXD_FIRST_FRAGMENT,
214 ENTRY_TXD_MORE_FRAG, 216 ENTRY_TXD_MORE_FRAG,
215 ENTRY_TXD_REQ_TIMESTAMP, 217 ENTRY_TXD_REQ_TIMESTAMP,
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 83862e7f7aec..933e6cc9359d 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -122,6 +122,38 @@ int rt2x00usb_vendor_request_buff(struct rt2x00_dev *rt2x00dev,
122} 122}
123EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff); 123EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_buff);
124 124
125int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
126 const u8 request, const u8 requesttype,
127 const u16 offset, void *buffer,
128 const u16 buffer_length,
129 const int timeout)
130{
131 int status = 0;
132 unsigned char *tb;
133 u16 off, len, bsize;
134
135 mutex_lock(&rt2x00dev->usb_cache_mutex);
136
137 tb = buffer;
138 off = offset;
139 len = buffer_length;
140 while (len && !status) {
141 bsize = min_t(u16, CSR_CACHE_SIZE, len);
142 status = rt2x00usb_vendor_req_buff_lock(rt2x00dev, request,
143 requesttype, off, tb,
144 bsize, timeout);
145
146 tb += bsize;
147 len -= bsize;
148 off += bsize;
149 }
150
151 mutex_unlock(&rt2x00dev->usb_cache_mutex);
152
153 return status;
154}
155EXPORT_SYMBOL_GPL(rt2x00usb_vendor_request_large_buff);
156
125/* 157/*
126 * TX data handlers. 158 * TX data handlers.
127 */ 159 */
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.h b/drivers/net/wireless/rt2x00/rt2x00usb.h
index aad794adf52c..ee3875f894aa 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.h
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.h
@@ -70,8 +70,7 @@
70/* 70/*
71 * Cache size 71 * Cache size
72 */ 72 */
73#define CSR_CACHE_SIZE 8 73#define CSR_CACHE_SIZE 64
74#define CSR_CACHE_SIZE_FIRMWARE 64
75 74
76/* 75/*
77 * USB request types. 76 * USB request types.
@@ -172,6 +171,25 @@ int rt2x00usb_vendor_req_buff_lock(struct rt2x00_dev *rt2x00dev,
172 const u16 buffer_length, const int timeout); 171 const u16 buffer_length, const int timeout);
173 172
174/** 173/**
174 * rt2x00usb_vendor_request_large_buff - Send register command to device (buffered)
175 * @rt2x00dev: Pointer to &struct rt2x00_dev
176 * @request: USB vendor command (See &enum rt2x00usb_vendor_request)
177 * @requesttype: Request type &USB_VENDOR_REQUEST_*
178 * @offset: Register start offset to perform action on
179 * @buffer: Buffer where information will be read/written to by device
180 * @buffer_length: Size of &buffer
181 * @timeout: Operation timeout
182 *
183 * This function is used to transfer register data in blocks larger
184 * then CSR_CACHE_SIZE. Use for firmware upload, keys and beacons.
185 */
186int rt2x00usb_vendor_request_large_buff(struct rt2x00_dev *rt2x00dev,
187 const u8 request, const u8 requesttype,
188 const u16 offset, void *buffer,
189 const u16 buffer_length,
190 const int timeout);
191
192/**
175 * rt2x00usb_vendor_request_sw - Send single register command to device 193 * rt2x00usb_vendor_request_sw - Send single register command to device
176 * @rt2x00dev: Pointer to &struct rt2x00_dev 194 * @rt2x00dev: Pointer to &struct rt2x00_dev
177 * @request: USB vendor command (See &enum rt2x00usb_vendor_request) 195 * @request: USB vendor command (See &enum rt2x00usb_vendor_request)
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index f7c1f92c1448..fbe2a652e014 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1544,7 +1544,8 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1544 rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min); 1544 rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min);
1545 rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); 1545 rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max);
1546 rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER); 1546 rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER);
1547 rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, 1); 1547 rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE,
1548 test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
1548 rt2x00_set_field32(&word, TXD_W1_BUFFER_COUNT, 1); 1549 rt2x00_set_field32(&word, TXD_W1_BUFFER_COUNT, 1);
1549 rt2x00_desc_write(txd, 1, word); 1550 rt2x00_desc_write(txd, 1, word);
1550 1551
@@ -2278,7 +2279,6 @@ static void rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
2278 * Initialize all hw fields. 2279 * Initialize all hw fields.
2279 */ 2280 */
2280 rt2x00dev->hw->flags = 2281 rt2x00dev->hw->flags =
2281 IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
2282 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 2282 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
2283 IEEE80211_HW_SIGNAL_DBM; 2283 IEEE80211_HW_SIGNAL_DBM;
2284 rt2x00dev->hw->extra_tx_headroom = 0; 2284 rt2x00dev->hw->extra_tx_headroom = 0;
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index d383735ab8f2..9761eaaa08be 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -890,9 +890,6 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
890 unsigned int i; 890 unsigned int i;
891 int status; 891 int status;
892 u32 reg; 892 u32 reg;
893 const char *ptr = data;
894 char *cache;
895 int buflen;
896 893
897 /* 894 /*
898 * Wait for stable hardware. 895 * Wait for stable hardware.
@@ -911,31 +908,12 @@ static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
911 908
912 /* 909 /*
913 * Write firmware to device. 910 * Write firmware to device.
914 * We setup a seperate cache for this action,
915 * since we are going to write larger chunks of data
916 * then normally used cache size.
917 */ 911 */
918 cache = kmalloc(CSR_CACHE_SIZE_FIRMWARE, GFP_KERNEL); 912 rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
919 if (!cache) { 913 USB_VENDOR_REQUEST_OUT,
920 ERROR(rt2x00dev, "Failed to allocate firmware cache.\n"); 914 FIRMWARE_IMAGE_BASE,
921 return -ENOMEM; 915 data, len,
922 } 916 REGISTER_TIMEOUT32(len));
923
924 for (i = 0; i < len; i += CSR_CACHE_SIZE_FIRMWARE) {
925 buflen = min_t(int, len - i, CSR_CACHE_SIZE_FIRMWARE);
926
927 memcpy(cache, ptr, buflen);
928
929 rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE,
930 USB_VENDOR_REQUEST_OUT,
931 FIRMWARE_IMAGE_BASE + i, 0,
932 cache, buflen,
933 REGISTER_TIMEOUT32(buflen));
934
935 ptr += buflen;
936 }
937
938 kfree(cache);
939 917
940 /* 918 /*
941 * Send firmware request to device to load firmware, 919 * Send firmware request to device to load firmware,
@@ -1303,7 +1281,8 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1303 rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min); 1281 rt2x00_set_field32(&word, TXD_W1_CWMIN, txdesc->cw_min);
1304 rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max); 1282 rt2x00_set_field32(&word, TXD_W1_CWMAX, txdesc->cw_max);
1305 rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER); 1283 rt2x00_set_field32(&word, TXD_W1_IV_OFFSET, IEEE80211_HEADER);
1306 rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE, 1); 1284 rt2x00_set_field32(&word, TXD_W1_HW_SEQUENCE,
1285 test_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags));
1307 rt2x00_desc_write(txd, 1, word); 1286 rt2x00_desc_write(txd, 1, word);
1308 1287
1309 rt2x00_desc_read(txd, 2, &word); 1288 rt2x00_desc_read(txd, 2, &word);
@@ -1352,6 +1331,7 @@ static void rt73usb_write_beacon(struct queue_entry *entry)
1352 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); 1331 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1353 unsigned int beacon_base; 1332 unsigned int beacon_base;
1354 u32 reg; 1333 u32 reg;
1334 u32 word, len;
1355 1335
1356 /* 1336 /*
1357 * Add the descriptor in front of the skb. 1337 * Add the descriptor in front of the skb.
@@ -1361,6 +1341,17 @@ static void rt73usb_write_beacon(struct queue_entry *entry)
1361 skbdesc->desc = entry->skb->data; 1341 skbdesc->desc = entry->skb->data;
1362 1342
1363 /* 1343 /*
1344 * Adjust the beacon databyte count. The current number is
1345 * calculated before this function gets called, but falsely
1346 * assumes that the descriptor was already present in the SKB.
1347 */
1348 rt2x00_desc_read(skbdesc->desc, 0, &word);
1349 len = rt2x00_get_field32(word, TXD_W0_DATABYTE_COUNT);
1350 len += skbdesc->desc_len;
1351 rt2x00_set_field32(&word, TXD_W0_DATABYTE_COUNT, len);
1352 rt2x00_desc_write(skbdesc->desc, 0, word);
1353
1354 /*
1364 * Disable beaconing while we are reloading the beacon data, 1355 * Disable beaconing while we are reloading the beacon data,
1365 * otherwise we might be sending out invalid data. 1356 * otherwise we might be sending out invalid data.
1366 */ 1357 */
@@ -1374,10 +1365,10 @@ static void rt73usb_write_beacon(struct queue_entry *entry)
1374 * Write entire beacon with descriptor to register. 1365 * Write entire beacon with descriptor to register.
1375 */ 1366 */
1376 beacon_base = HW_BEACON_OFFSET(entry->entry_idx); 1367 beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
1377 rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE, 1368 rt2x00usb_vendor_request_large_buff(rt2x00dev, USB_MULTI_WRITE,
1378 USB_VENDOR_REQUEST_OUT, beacon_base, 0, 1369 USB_VENDOR_REQUEST_OUT, beacon_base,
1379 entry->skb->data, entry->skb->len, 1370 entry->skb->data, entry->skb->len,
1380 REGISTER_TIMEOUT32(entry->skb->len)); 1371 REGISTER_TIMEOUT32(entry->skb->len));
1381 1372
1382 /* 1373 /*
1383 * Clean up the beacon skb. 1374 * Clean up the beacon skb.
@@ -1871,7 +1862,6 @@ static void rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
1871 * Initialize all hw fields. 1862 * Initialize all hw fields.
1872 */ 1863 */
1873 rt2x00dev->hw->flags = 1864 rt2x00dev->hw->flags =
1874 IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
1875 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 1865 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
1876 IEEE80211_HW_SIGNAL_DBM; 1866 IEEE80211_HW_SIGNAL_DBM;
1877 rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE; 1867 rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
diff --git a/drivers/net/wireless/rtl8187.h b/drivers/net/wireless/rtl8187.h
index 3afb49f8866a..1b0d750f6623 100644
--- a/drivers/net/wireless/rtl8187.h
+++ b/drivers/net/wireless/rtl8187.h
@@ -47,11 +47,13 @@ struct rtl8187_rx_hdr {
47struct rtl8187b_rx_hdr { 47struct rtl8187b_rx_hdr {
48 __le32 flags; 48 __le32 flags;
49 __le64 mac_time; 49 __le64 mac_time;
50 u8 noise; 50 u8 sq;
51 u8 signal; 51 u8 rssi;
52 u8 agc; 52 u8 agc;
53 u8 reserved; 53 u8 flags2;
54 __le32 unused; 54 __le16 snr_long2end;
55 s8 pwdb_g12;
56 u8 fot;
55} __attribute__((packed)); 57} __attribute__((packed));
56 58
57/* {rtl8187,rtl8187b}_tx_info is in skb */ 59/* {rtl8187,rtl8187b}_tx_info is in skb */
@@ -100,6 +102,7 @@ struct rtl8187_priv {
100 struct usb_device *udev; 102 struct usb_device *udev;
101 u32 rx_conf; 103 u32 rx_conf;
102 u16 txpwr_base; 104 u16 txpwr_base;
105 u16 seqno;
103 u8 asic_rev; 106 u8 asic_rev;
104 u8 is_rtl8187b; 107 u8 is_rtl8187b;
105 enum { 108 enum {
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index d3067b1216ca..177988efd660 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -169,6 +169,7 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
169{ 169{
170 struct rtl8187_priv *priv = dev->priv; 170 struct rtl8187_priv *priv = dev->priv;
171 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 171 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
172 struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
172 unsigned int ep; 173 unsigned int ep;
173 void *buf; 174 void *buf;
174 struct urb *urb; 175 struct urb *urb;
@@ -234,6 +235,20 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
234 ep = epmap[skb_get_queue_mapping(skb)]; 235 ep = epmap[skb_get_queue_mapping(skb)];
235 } 236 }
236 237
238 /* FIXME: The sequence that follows is needed for this driver to
239 * work with mac80211 since "mac80211: fix TX sequence numbers".
240 * As with the temporary code in rt2x00, changes will be needed
241 * to get proper sequence numbers on beacons. In addition, this
242 * patch places the sequence number in the hardware state, which
243 * limits us to a single virtual state.
244 */
245 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
246 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
247 priv->seqno += 0x10;
248 ieee80211hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
249 ieee80211hdr->seq_ctrl |= cpu_to_le16(priv->seqno);
250 }
251
237 info->driver_data[0] = dev; 252 info->driver_data[0] = dev;
238 info->driver_data[1] = urb; 253 info->driver_data[1] = urb;
239 254
@@ -257,6 +272,7 @@ static void rtl8187_rx_cb(struct urb *urb)
257 struct ieee80211_rx_status rx_status = { 0 }; 272 struct ieee80211_rx_status rx_status = { 0 };
258 int rate, signal; 273 int rate, signal;
259 u32 flags; 274 u32 flags;
275 u32 quality;
260 276
261 spin_lock(&priv->rx_queue.lock); 277 spin_lock(&priv->rx_queue.lock);
262 if (skb->next) 278 if (skb->next)
@@ -280,44 +296,57 @@ static void rtl8187_rx_cb(struct urb *urb)
280 flags = le32_to_cpu(hdr->flags); 296 flags = le32_to_cpu(hdr->flags);
281 signal = hdr->signal & 0x7f; 297 signal = hdr->signal & 0x7f;
282 rx_status.antenna = (hdr->signal >> 7) & 1; 298 rx_status.antenna = (hdr->signal >> 7) & 1;
283 rx_status.signal = signal;
284 rx_status.noise = hdr->noise; 299 rx_status.noise = hdr->noise;
285 rx_status.mactime = le64_to_cpu(hdr->mac_time); 300 rx_status.mactime = le64_to_cpu(hdr->mac_time);
286 priv->signal = signal;
287 priv->quality = signal; 301 priv->quality = signal;
302 rx_status.qual = priv->quality;
288 priv->noise = hdr->noise; 303 priv->noise = hdr->noise;
304 rate = (flags >> 20) & 0xF;
305 if (rate > 3) { /* OFDM rate */
306 if (signal > 90)
307 signal = 90;
308 else if (signal < 25)
309 signal = 25;
310 signal = 90 - signal;
311 } else { /* CCK rate */
312 if (signal > 95)
313 signal = 95;
314 else if (signal < 30)
315 signal = 30;
316 signal = 95 - signal;
317 }
318 rx_status.signal = signal;
319 priv->signal = signal;
289 } else { 320 } else {
290 struct rtl8187b_rx_hdr *hdr = 321 struct rtl8187b_rx_hdr *hdr =
291 (typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr)); 322 (typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr));
323 /* The Realtek datasheet for the RTL8187B shows that the RX
324 * header contains the following quantities: signal quality,
325 * RSSI, AGC, the received power in dB, and the measured SNR.
326 * In testing, none of these quantities show qualitative
327 * agreement with AP signal strength, except for the AGC,
328 * which is inversely proportional to the strength of the
329 * signal. In the following, the quality and signal strength
330 * are derived from the AGC. The arbitrary scaling constants
331 * are chosen to make the results close to the values obtained
332 * for a BCM4312 using b43 as the driver. The noise is ignored
333 * for now.
334 */
292 flags = le32_to_cpu(hdr->flags); 335 flags = le32_to_cpu(hdr->flags);
293 signal = hdr->agc >> 1; 336 quality = 170 - hdr->agc;
294 rx_status.antenna = (hdr->signal >> 7) & 1; 337 if (quality > 100)
295 rx_status.signal = 64 - min(hdr->noise, (u8)64); 338 quality = 100;
296 rx_status.noise = hdr->noise; 339 signal = 14 - hdr->agc / 2;
340 rx_status.qual = quality;
341 priv->quality = quality;
342 rx_status.signal = signal;
343 priv->signal = signal;
344 rx_status.antenna = (hdr->rssi >> 7) & 1;
297 rx_status.mactime = le64_to_cpu(hdr->mac_time); 345 rx_status.mactime = le64_to_cpu(hdr->mac_time);
298 priv->signal = hdr->signal; 346 rate = (flags >> 20) & 0xF;
299 priv->quality = hdr->agc >> 1;
300 priv->noise = hdr->noise;
301 } 347 }
302 348
303 skb_trim(skb, flags & 0x0FFF); 349 skb_trim(skb, flags & 0x0FFF);
304 rate = (flags >> 20) & 0xF;
305 if (rate > 3) { /* OFDM rate */
306 if (signal > 90)
307 signal = 90;
308 else if (signal < 25)
309 signal = 25;
310 signal = 90 - signal;
311 } else { /* CCK rate */
312 if (signal > 95)
313 signal = 95;
314 else if (signal < 30)
315 signal = 30;
316 signal = 95 - signal;
317 }
318
319 rx_status.qual = priv->quality;
320 rx_status.signal = signal;
321 rx_status.rate_idx = rate; 350 rx_status.rate_idx = rate;
322 rx_status.freq = dev->conf.channel->center_freq; 351 rx_status.freq = dev->conf.channel->center_freq;
323 rx_status.band = dev->conf.channel->band; 352 rx_status.band = dev->conf.channel->band;
@@ -1015,9 +1044,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1015 1044
1016 priv->mode = IEEE80211_IF_TYPE_MNTR; 1045 priv->mode = IEEE80211_IF_TYPE_MNTR;
1017 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING | 1046 dev->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
1018 IEEE80211_HW_RX_INCLUDES_FCS | 1047 IEEE80211_HW_RX_INCLUDES_FCS;
1019 IEEE80211_HW_SIGNAL_UNSPEC;
1020 dev->max_signal = 65;
1021 1048
1022 eeprom.data = dev; 1049 eeprom.data = dev;
1023 eeprom.register_read = rtl8187_eeprom_register_read; 1050 eeprom.register_read = rtl8187_eeprom_register_read;
@@ -1132,10 +1159,16 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1132 (*channel++).hw_value = txpwr >> 8; 1159 (*channel++).hw_value = txpwr >> 8;
1133 } 1160 }
1134 1161
1135 if (priv->is_rtl8187b) 1162 if (priv->is_rtl8187b) {
1136 printk(KERN_WARNING "rtl8187: 8187B chip detected. Support " 1163 printk(KERN_WARNING "rtl8187: 8187B chip detected. Support "
1137 "is EXPERIMENTAL, and could damage your\n" 1164 "is EXPERIMENTAL, and could damage your\n"
1138 " hardware, use at your own risk\n"); 1165 " hardware, use at your own risk\n");
1166 dev->flags |= IEEE80211_HW_SIGNAL_DBM;
1167 } else {
1168 dev->flags |= IEEE80211_HW_SIGNAL_UNSPEC;
1169 dev->max_signal = 65;
1170 }
1171
1139 if ((id->driver_info == DEVICE_RTL8187) && priv->is_rtl8187b) 1172 if ((id->driver_info == DEVICE_RTL8187) && priv->is_rtl8187b)
1140 printk(KERN_INFO "rtl8187: inconsistency between id with OEM" 1173 printk(KERN_INFO "rtl8187: inconsistency between id with OEM"
1141 " info!\n"); 1174 " info!\n");
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index fcc532bb6a7e..4d7b98b05030 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -935,7 +935,6 @@ struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf)
935 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &mac->band; 935 hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &mac->band;
936 936
937 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | 937 hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
938 IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE |
939 IEEE80211_HW_SIGNAL_DB; 938 IEEE80211_HW_SIGNAL_DB;
940 939
941 hw->max_signal = 100; 940 hw->max_signal = 100;
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 1d7ec3129349..f821dbc952a4 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -13,3 +13,9 @@ config OF_I2C
13 depends on PPC_OF && I2C 13 depends on PPC_OF && I2C
14 help 14 help
15 OpenFirmware I2C accessors 15 OpenFirmware I2C accessors
16
17config OF_SPI
18 def_tristate SPI
19 depends on OF && PPC_OF && SPI
20 help
21 OpenFirmware SPI accessors
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index 548772e871fd..4c3c6f8e36f5 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -2,3 +2,4 @@ obj-y = base.o
2obj-$(CONFIG_OF_DEVICE) += device.o platform.o 2obj-$(CONFIG_OF_DEVICE) += device.o platform.o
3obj-$(CONFIG_OF_GPIO) += gpio.o 3obj-$(CONFIG_OF_GPIO) += gpio.o
4obj-$(CONFIG_OF_I2C) += of_i2c.o 4obj-$(CONFIG_OF_I2C) += of_i2c.o
5obj-$(CONFIG_OF_SPI) += of_spi.o
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 23ffb7c0caf2..ad8ac1a8af28 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -385,3 +385,91 @@ struct device_node *of_find_matching_node(struct device_node *from,
385 return np; 385 return np;
386} 386}
387EXPORT_SYMBOL(of_find_matching_node); 387EXPORT_SYMBOL(of_find_matching_node);
388
389/**
390 * of_modalias_table: Table of explicit compatible ==> modalias mappings
391 *
392 * This table allows particulare compatible property values to be mapped
393 * to modalias strings. This is useful for busses which do not directly
394 * understand the OF device tree but are populated based on data contained
395 * within the device tree. SPI and I2C are the two current users of this
396 * table.
397 *
398 * In most cases, devices do not need to be listed in this table because
399 * the modalias value can be derived directly from the compatible table.
400 * However, if for any reason a value cannot be derived, then this table
401 * provides a method to override the implicit derivation.
402 *
403 * At the moment, a single table is used for all bus types because it is
404 * assumed that the data size is small and that the compatible values
405 * should already be distinct enough to differentiate between SPI, I2C
406 * and other devices.
407 */
408struct of_modalias_table {
409 char *of_device;
410 char *modalias;
411};
412static struct of_modalias_table of_modalias_table[] = {
413 /* Empty for now; add entries as needed */
414};
415
416/**
417 * of_modalias_node - Lookup appropriate modalias for a device node
418 * @node: pointer to a device tree node
419 * @modalias: Pointer to buffer that modalias value will be copied into
420 * @len: Length of modalias value
421 *
422 * Based on the value of the compatible property, this routine will determine
423 * an appropriate modalias value for a particular device tree node. Three
424 * separate methods are used to derive a modalias value.
425 *
426 * First method is to lookup the compatible value in of_modalias_table.
427 * Second is to look for a "linux,<modalias>" entry in the compatible list
428 * and used that for modalias. Third is to strip off the manufacturer
429 * prefix from the first compatible entry and use the remainder as modalias
430 *
431 * This routine returns 0 on success
432 */
433int of_modalias_node(struct device_node *node, char *modalias, int len)
434{
435 int i, cplen;
436 const char *compatible;
437 const char *p;
438
439 /* 1. search for exception list entry */
440 for (i = 0; i < ARRAY_SIZE(of_modalias_table); i++) {
441 compatible = of_modalias_table[i].of_device;
442 if (!of_device_is_compatible(node, compatible))
443 continue;
444 strlcpy(modalias, of_modalias_table[i].modalias, len);
445 return 0;
446 }
447
448 compatible = of_get_property(node, "compatible", &cplen);
449 if (!compatible)
450 return -ENODEV;
451
452 /* 2. search for linux,<modalias> entry */
453 p = compatible;
454 while (cplen > 0) {
455 if (!strncmp(p, "linux,", 6)) {
456 p += 6;
457 strlcpy(modalias, p, len);
458 return 0;
459 }
460
461 i = strlen(p) + 1;
462 p += i;
463 cplen -= i;
464 }
465
466 /* 3. take first compatible entry and strip manufacturer */
467 p = strchr(compatible, ',');
468 if (!p)
469 return -ENODEV;
470 p++;
471 strlcpy(modalias, p, len);
472 return 0;
473}
474EXPORT_SYMBOL_GPL(of_modalias_node);
475
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index 344e1b03dd8b..6a98dc8aa30b 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -16,62 +16,6 @@
16#include <linux/of_i2c.h> 16#include <linux/of_i2c.h>
17#include <linux/module.h> 17#include <linux/module.h>
18 18
19struct i2c_driver_device {
20 char *of_device;
21 char *i2c_type;
22};
23
24static struct i2c_driver_device i2c_devices[] = {
25};
26
27static int of_find_i2c_driver(struct device_node *node,
28 struct i2c_board_info *info)
29{
30 int i, cplen;
31 const char *compatible;
32 const char *p;
33
34 /* 1. search for exception list entry */
35 for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
36 if (!of_device_is_compatible(node, i2c_devices[i].of_device))
37 continue;
38 if (strlcpy(info->type, i2c_devices[i].i2c_type,
39 I2C_NAME_SIZE) >= I2C_NAME_SIZE)
40 return -ENOMEM;
41
42 return 0;
43 }
44
45 compatible = of_get_property(node, "compatible", &cplen);
46 if (!compatible)
47 return -ENODEV;
48
49 /* 2. search for linux,<i2c-type> entry */
50 p = compatible;
51 while (cplen > 0) {
52 if (!strncmp(p, "linux,", 6)) {
53 p += 6;
54 if (strlcpy(info->type, p,
55 I2C_NAME_SIZE) >= I2C_NAME_SIZE)
56 return -ENOMEM;
57 return 0;
58 }
59
60 i = strlen(p) + 1;
61 p += i;
62 cplen -= i;
63 }
64
65 /* 3. take fist compatible entry and strip manufacturer */
66 p = strchr(compatible, ',');
67 if (!p)
68 return -ENODEV;
69 p++;
70 if (strlcpy(info->type, p, I2C_NAME_SIZE) >= I2C_NAME_SIZE)
71 return -ENOMEM;
72 return 0;
73}
74
75void of_register_i2c_devices(struct i2c_adapter *adap, 19void of_register_i2c_devices(struct i2c_adapter *adap,
76 struct device_node *adap_node) 20 struct device_node *adap_node)
77{ 21{
@@ -83,6 +27,9 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
83 const u32 *addr; 27 const u32 *addr;
84 int len; 28 int len;
85 29
30 if (of_modalias_node(node, info.type, sizeof(info.type)) < 0)
31 continue;
32
86 addr = of_get_property(node, "reg", &len); 33 addr = of_get_property(node, "reg", &len);
87 if (!addr || len < sizeof(int) || *addr > (1 << 10) - 1) { 34 if (!addr || len < sizeof(int) || *addr > (1 << 10) - 1) {
88 printk(KERN_ERR 35 printk(KERN_ERR
@@ -92,11 +39,6 @@ void of_register_i2c_devices(struct i2c_adapter *adap,
92 39
93 info.irq = irq_of_parse_and_map(node, 0); 40 info.irq = irq_of_parse_and_map(node, 0);
94 41
95 if (of_find_i2c_driver(node, &info) < 0) {
96 irq_dispose_mapping(info.irq);
97 continue;
98 }
99
100 info.addr = *addr; 42 info.addr = *addr;
101 43
102 request_module(info.type); 44 request_module(info.type);
diff --git a/drivers/of/of_spi.c b/drivers/of/of_spi.c
new file mode 100644
index 000000000000..b01eec026f68
--- /dev/null
+++ b/drivers/of/of_spi.c
@@ -0,0 +1,93 @@
1/*
2 * SPI OF support routines
3 * Copyright (C) 2008 Secret Lab Technologies Ltd.
4 *
5 * Support routines for deriving SPI device attachments from the device
6 * tree.
7 */
8
9#include <linux/of.h>
10#include <linux/device.h>
11#include <linux/spi/spi.h>
12#include <linux/of_spi.h>
13
14/**
15 * of_register_spi_devices - Register child devices onto the SPI bus
16 * @master: Pointer to spi_master device
17 * @np: parent node of SPI device nodes
18 *
19 * Registers an spi_device for each child node of 'np' which has a 'reg'
20 * property.
21 */
22void of_register_spi_devices(struct spi_master *master, struct device_node *np)
23{
24 struct spi_device *spi;
25 struct device_node *nc;
26 const u32 *prop;
27 int rc;
28 int len;
29
30 for_each_child_of_node(np, nc) {
31 /* Alloc an spi_device */
32 spi = spi_alloc_device(master);
33 if (!spi) {
34 dev_err(&master->dev, "spi_device alloc error for %s\n",
35 nc->full_name);
36 spi_dev_put(spi);
37 continue;
38 }
39
40 /* Select device driver */
41 if (of_modalias_node(nc, spi->modalias,
42 sizeof(spi->modalias)) < 0) {
43 dev_err(&master->dev, "cannot find modalias for %s\n",
44 nc->full_name);
45 spi_dev_put(spi);
46 continue;
47 }
48
49 /* Device address */
50 prop = of_get_property(nc, "reg", &len);
51 if (!prop || len < sizeof(*prop)) {
52 dev_err(&master->dev, "%s has no 'reg' property\n",
53 nc->full_name);
54 spi_dev_put(spi);
55 continue;
56 }
57 spi->chip_select = *prop;
58
59 /* Mode (clock phase/polarity/etc.) */
60 if (of_find_property(nc, "spi-cpha", NULL))
61 spi->mode |= SPI_CPHA;
62 if (of_find_property(nc, "spi-cpol", NULL))
63 spi->mode |= SPI_CPOL;
64
65 /* Device speed */
66 prop = of_get_property(nc, "spi-max-frequency", &len);
67 if (!prop || len < sizeof(*prop)) {
68 dev_err(&master->dev, "%s has no 'spi-max-frequency' property\n",
69 nc->full_name);
70 spi_dev_put(spi);
71 continue;
72 }
73 spi->max_speed_hz = *prop;
74
75 /* IRQ */
76 spi->irq = irq_of_parse_and_map(nc, 0);
77
78 /* Store a pointer to the node in the device structure */
79 of_node_get(nc);
80 spi->dev.archdata.of_node = nc;
81
82 /* Register the new device */
83 request_module(spi->modalias);
84 rc = spi_add_device(spi);
85 if (rc) {
86 dev_err(&master->dev, "spi_device register error %s\n",
87 nc->full_name);
88 spi_dev_put(spi);
89 }
90
91 }
92}
93EXPORT_SYMBOL(of_register_spi_devices);
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 1323a43285d7..ad27e9e225a6 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -1103,7 +1103,7 @@ static inline void dbg_ctrl(struct controller *ctrl)
1103 dbg(" Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no"); 1103 dbg(" Power Indicator : %3s\n", PWR_LED(ctrl) ? "yes" : "no");
1104 dbg(" Hot-Plug Surprise : %3s\n", HP_SUPR_RM(ctrl) ? "yes" : "no"); 1104 dbg(" Hot-Plug Surprise : %3s\n", HP_SUPR_RM(ctrl) ? "yes" : "no");
1105 dbg(" EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no"); 1105 dbg(" EMI Present : %3s\n", EMI(ctrl) ? "yes" : "no");
1106 dbg(" Comamnd Completed : %3s\n", NO_CMD_CMPL(ctrl)? "no" : "yes"); 1106 dbg(" Command Completed : %3s\n", NO_CMD_CMPL(ctrl)? "no" : "yes");
1107 pciehp_readw(ctrl, SLOTSTATUS, &reg16); 1107 pciehp_readw(ctrl, SLOTSTATUS, &reg16);
1108 dbg("Slot Status : 0x%04x\n", reg16); 1108 dbg("Slot Status : 0x%04x\n", reg16);
1109 pciehp_readw(ctrl, SLOTCTRL, &reg16); 1109 pciehp_readw(ctrl, SLOTCTRL, &reg16);
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 15af618d36e2..18354817173c 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -126,7 +126,16 @@ static void msix_flush_writes(unsigned int irq)
126 } 126 }
127} 127}
128 128
129static void msi_set_mask_bits(unsigned int irq, u32 mask, u32 flag) 129/*
130 * PCI 2.3 does not specify mask bits for each MSI interrupt. Attempting to
131 * mask all MSI interrupts by clearing the MSI enable bit does not work
132 * reliably as devices without an INTx disable bit will then generate a
133 * level IRQ which will never be cleared.
134 *
135 * Returns 1 if it succeeded in masking the interrupt and 0 if the device
136 * doesn't support MSI masking.
137 */
138static int msi_set_mask_bits(unsigned int irq, u32 mask, u32 flag)
130{ 139{
131 struct msi_desc *entry; 140 struct msi_desc *entry;
132 141
@@ -144,8 +153,7 @@ static void msi_set_mask_bits(unsigned int irq, u32 mask, u32 flag)
144 mask_bits |= flag & mask; 153 mask_bits |= flag & mask;
145 pci_write_config_dword(entry->dev, pos, mask_bits); 154 pci_write_config_dword(entry->dev, pos, mask_bits);
146 } else { 155 } else {
147 __msi_set_enable(entry->dev, entry->msi_attrib.pos, 156 return 0;
148 !flag);
149 } 157 }
150 break; 158 break;
151 case PCI_CAP_ID_MSIX: 159 case PCI_CAP_ID_MSIX:
@@ -161,6 +169,7 @@ static void msi_set_mask_bits(unsigned int irq, u32 mask, u32 flag)
161 break; 169 break;
162 } 170 }
163 entry->msi_attrib.masked = !!flag; 171 entry->msi_attrib.masked = !!flag;
172 return 1;
164} 173}
165 174
166void read_msi_msg(unsigned int irq, struct msi_msg *msg) 175void read_msi_msg(unsigned int irq, struct msi_msg *msg)
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 7764768b6a0e..89a2f0fa10f9 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/pci-aspm.h>
14#include <acpi/acpi.h> 15#include <acpi/acpi.h>
15#include <acpi/acnamesp.h> 16#include <acpi/acnamesp.h>
16#include <acpi/acresrc.h> 17#include <acpi/acresrc.h>
@@ -372,6 +373,12 @@ static int __init acpi_pci_init(void)
372 printk(KERN_INFO"ACPI FADT declares the system doesn't support MSI, so disable it\n"); 373 printk(KERN_INFO"ACPI FADT declares the system doesn't support MSI, so disable it\n");
373 pci_no_msi(); 374 pci_no_msi();
374 } 375 }
376
377 if (acpi_gbl_FADT.boot_flags & BAF_PCIE_ASPM_CONTROL) {
378 printk(KERN_INFO"ACPI FADT declares the system doesn't support PCIe ASPM, so disable it\n");
379 pcie_no_aspm();
380 }
381
375 ret = register_acpi_bus_type(&acpi_pci_bus); 382 ret = register_acpi_bus_type(&acpi_pci_bus);
376 if (ret) 383 if (ret)
377 return 0; 384 return 0;
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e9c356236d27..0a3d856833fc 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -572,6 +572,10 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
572 if (!ret) 572 if (!ret)
573 pci_update_current_state(dev); 573 pci_update_current_state(dev);
574 } 574 }
575 /* This device is quirked not to be put into D3, so
576 don't put it in D3 */
577 if (state == PCI_D3hot && (dev->dev_flags & PCI_DEV_FLAGS_NO_D3))
578 return 0;
575 579
576 error = pci_raw_set_power_state(dev, state); 580 error = pci_raw_set_power_state(dev, state);
577 581
@@ -1123,6 +1127,12 @@ int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable)
1123} 1127}
1124 1128
1125/** 1129/**
1130 * pci_target_state - find an appropriate low power state for a given PCI dev
1131 * @dev: PCI device
1132 *
1133 * Use underlying platform code to find a supported low power state for @dev.
1134 * If the platform can't manage @dev, return the deepest state from which it
1135 * can generate wake events, based on any available PME info.
1126 */ 1136 */
1127pci_power_t pci_target_state(struct pci_dev *dev) 1137pci_power_t pci_target_state(struct pci_dev *dev)
1128{ 1138{
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index f82495583e63..9a7c9e1408a4 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -55,7 +55,7 @@ struct pcie_link_state {
55 struct endpoint_state endpoints[8]; 55 struct endpoint_state endpoints[8];
56}; 56};
57 57
58static int aspm_disabled; 58static int aspm_disabled, aspm_force;
59static DEFINE_MUTEX(aspm_lock); 59static DEFINE_MUTEX(aspm_lock);
60static LIST_HEAD(link_list); 60static LIST_HEAD(link_list);
61 61
@@ -510,6 +510,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
510{ 510{
511 struct pci_dev *child_dev; 511 struct pci_dev *child_dev;
512 int child_pos; 512 int child_pos;
513 u32 reg32;
513 514
514 /* 515 /*
515 * Some functions in a slot might not all be PCIE functions, very 516 * Some functions in a slot might not all be PCIE functions, very
@@ -519,6 +520,19 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
519 child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP); 520 child_pos = pci_find_capability(child_dev, PCI_CAP_ID_EXP);
520 if (!child_pos) 521 if (!child_pos)
521 return -EINVAL; 522 return -EINVAL;
523
524 /*
525 * Disable ASPM for pre-1.1 PCIe device, we follow MS to use
526 * RBER bit to determine if a function is 1.1 version device
527 */
528 pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP,
529 &reg32);
530 if (!(reg32 & PCI_EXP_DEVCAP_RBER && !aspm_force)) {
531 printk("Pre-1.1 PCIe device detected, "
532 "disable ASPM for %s. It can be enabled forcedly"
533 " with 'pcie_aspm=force'\n", pci_name(pdev));
534 return -EINVAL;
535 }
522 } 536 }
523 return 0; 537 return 0;
524} 538}
@@ -802,11 +816,23 @@ void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev)
802 816
803static int __init pcie_aspm_disable(char *str) 817static int __init pcie_aspm_disable(char *str)
804{ 818{
805 aspm_disabled = 1; 819 if (!strcmp(str, "off")) {
820 aspm_disabled = 1;
821 printk(KERN_INFO "PCIe ASPM is disabled\n");
822 } else if (!strcmp(str, "force")) {
823 aspm_force = 1;
824 printk(KERN_INFO "PCIe ASPM is forcedly enabled\n");
825 }
806 return 1; 826 return 1;
807} 827}
808 828
809__setup("pcie_noaspm", pcie_aspm_disable); 829__setup("pcie_aspm=", pcie_aspm_disable);
830
831void pcie_no_aspm(void)
832{
833 if (!aspm_force)
834 aspm_disabled = 1;
835}
810 836
811#ifdef CONFIG_ACPI 837#ifdef CONFIG_ACPI
812#include <acpi/acpi_bus.h> 838#include <acpi/acpi_bus.h>
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index b1724cf31b66..7098dfb07449 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -163,12 +163,9 @@ static inline unsigned int pci_calc_resource_flags(unsigned int flags)
163 return IORESOURCE_MEM; 163 return IORESOURCE_MEM;
164} 164}
165 165
166/* 166static u64 pci_size(u64 base, u64 maxbase, u64 mask)
167 * Find the extent of a PCI decode..
168 */
169static u32 pci_size(u32 base, u32 maxbase, u32 mask)
170{ 167{
171 u32 size = mask & maxbase; /* Find the significant bits */ 168 u64 size = mask & maxbase; /* Find the significant bits */
172 if (!size) 169 if (!size)
173 return 0; 170 return 0;
174 171
@@ -184,135 +181,142 @@ static u32 pci_size(u32 base, u32 maxbase, u32 mask)
184 return size; 181 return size;
185} 182}
186 183
187static u64 pci_size64(u64 base, u64 maxbase, u64 mask) 184enum pci_bar_type {
188{ 185 pci_bar_unknown, /* Standard PCI BAR probe */
189 u64 size = mask & maxbase; /* Find the significant bits */ 186 pci_bar_io, /* An io port BAR */
190 if (!size) 187 pci_bar_mem32, /* A 32-bit memory BAR */
191 return 0; 188 pci_bar_mem64, /* A 64-bit memory BAR */
189};
192 190
193 /* Get the lowest of them to find the decode size, and 191static inline enum pci_bar_type decode_bar(struct resource *res, u32 bar)
194 from that the extent. */ 192{
195 size = (size & ~(size-1)) - 1; 193 if ((bar & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) {
194 res->flags = bar & ~PCI_BASE_ADDRESS_IO_MASK;
195 return pci_bar_io;
196 }
196 197
197 /* base == maxbase can be valid only if the BAR has 198 res->flags = bar & ~PCI_BASE_ADDRESS_MEM_MASK;
198 already been programmed with all 1s. */
199 if (base == maxbase && ((base | size) & mask) != mask)
200 return 0;
201 199
202 return size; 200 if (res->flags == PCI_BASE_ADDRESS_MEM_TYPE_64)
201 return pci_bar_mem64;
202 return pci_bar_mem32;
203} 203}
204 204
205static inline int is_64bit_memory(u32 mask) 205/*
206 * If the type is not unknown, we assume that the lowest bit is 'enable'.
207 * Returns 1 if the BAR was 64-bit and 0 if it was 32-bit.
208 */
209static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
210 struct resource *res, unsigned int pos)
206{ 211{
207 if ((mask & (PCI_BASE_ADDRESS_SPACE|PCI_BASE_ADDRESS_MEM_TYPE_MASK)) == 212 u32 l, sz, mask;
208 (PCI_BASE_ADDRESS_SPACE_MEMORY|PCI_BASE_ADDRESS_MEM_TYPE_64))
209 return 1;
210 return 0;
211}
212 213
213static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) 214 mask = type ? ~PCI_ROM_ADDRESS_ENABLE : ~0;
214{
215 unsigned int pos, reg, next;
216 u32 l, sz;
217 struct resource *res;
218 215
219 for(pos=0; pos<howmany; pos = next) { 216 res->name = pci_name(dev);
220 u64 l64;
221 u64 sz64;
222 u32 raw_sz;
223 217
224 next = pos+1; 218 pci_read_config_dword(dev, pos, &l);
225 res = &dev->resource[pos]; 219 pci_write_config_dword(dev, pos, mask);
226 res->name = pci_name(dev); 220 pci_read_config_dword(dev, pos, &sz);
227 reg = PCI_BASE_ADDRESS_0 + (pos << 2); 221 pci_write_config_dword(dev, pos, l);
228 pci_read_config_dword(dev, reg, &l); 222
229 pci_write_config_dword(dev, reg, ~0); 223 /*
230 pci_read_config_dword(dev, reg, &sz); 224 * All bits set in sz means the device isn't working properly.
231 pci_write_config_dword(dev, reg, l); 225 * If the BAR isn't implemented, all bits must be 0. If it's a
232 if (!sz || sz == 0xffffffff) 226 * memory BAR or a ROM, bit 0 must be clear; if it's an io BAR, bit
233 continue; 227 * 1 must be clear.
234 if (l == 0xffffffff) 228 */
235 l = 0; 229 if (!sz || sz == 0xffffffff)
236 raw_sz = sz; 230 goto fail;
237 if ((l & PCI_BASE_ADDRESS_SPACE) == 231
238 PCI_BASE_ADDRESS_SPACE_MEMORY) { 232 /*
239 sz = pci_size(l, sz, (u32)PCI_BASE_ADDRESS_MEM_MASK); 233 * I don't know how l can have all bits set. Copied from old code.
240 /* 234 * Maybe it fixes a bug on some ancient platform.
241 * For 64bit prefetchable memory sz could be 0, if the 235 */
242 * real size is bigger than 4G, so we need to check 236 if (l == 0xffffffff)
243 * szhi for that. 237 l = 0;
244 */ 238
245 if (!is_64bit_memory(l) && !sz) 239 if (type == pci_bar_unknown) {
246 continue; 240 type = decode_bar(res, l);
247 res->start = l & PCI_BASE_ADDRESS_MEM_MASK; 241 res->flags |= pci_calc_resource_flags(l) | IORESOURCE_SIZEALIGN;
248 res->flags |= l & ~PCI_BASE_ADDRESS_MEM_MASK; 242 if (type == pci_bar_io) {
243 l &= PCI_BASE_ADDRESS_IO_MASK;
244 mask = PCI_BASE_ADDRESS_IO_MASK & 0xffff;
249 } else { 245 } else {
250 sz = pci_size(l, sz, PCI_BASE_ADDRESS_IO_MASK & 0xffff); 246 l &= PCI_BASE_ADDRESS_MEM_MASK;
251 if (!sz) 247 mask = (u32)PCI_BASE_ADDRESS_MEM_MASK;
252 continue;
253 res->start = l & PCI_BASE_ADDRESS_IO_MASK;
254 res->flags |= l & ~PCI_BASE_ADDRESS_IO_MASK;
255 } 248 }
256 res->end = res->start + (unsigned long) sz; 249 } else {
257 res->flags |= pci_calc_resource_flags(l) | IORESOURCE_SIZEALIGN; 250 res->flags |= (l & IORESOURCE_ROM_ENABLE);
258 if (is_64bit_memory(l)) { 251 l &= PCI_ROM_ADDRESS_MASK;
259 u32 szhi, lhi; 252 mask = (u32)PCI_ROM_ADDRESS_MASK;
260 253 }
261 pci_read_config_dword(dev, reg+4, &lhi); 254
262 pci_write_config_dword(dev, reg+4, ~0); 255 if (type == pci_bar_mem64) {
263 pci_read_config_dword(dev, reg+4, &szhi); 256 u64 l64 = l;
264 pci_write_config_dword(dev, reg+4, lhi); 257 u64 sz64 = sz;
265 sz64 = ((u64)szhi << 32) | raw_sz; 258 u64 mask64 = mask | (u64)~0 << 32;
266 l64 = ((u64)lhi << 32) | l; 259
267 sz64 = pci_size64(l64, sz64, PCI_BASE_ADDRESS_MEM_MASK); 260 pci_read_config_dword(dev, pos + 4, &l);
268 next++; 261 pci_write_config_dword(dev, pos + 4, ~0);
269#if BITS_PER_LONG == 64 262 pci_read_config_dword(dev, pos + 4, &sz);
270 if (!sz64) { 263 pci_write_config_dword(dev, pos + 4, l);
271 res->start = 0; 264
272 res->end = 0; 265 l64 |= ((u64)l << 32);
273 res->flags = 0; 266 sz64 |= ((u64)sz << 32);
274 continue; 267
275 } 268 sz64 = pci_size(l64, sz64, mask64);
276 res->start = l64 & PCI_BASE_ADDRESS_MEM_MASK; 269
277 res->end = res->start + sz64; 270 if (!sz64)
278#else 271 goto fail;
279 if (sz64 > 0x100000000ULL) { 272
280 dev_err(&dev->dev, "BAR %d: can't handle 64-bit" 273 if ((sizeof(resource_size_t) < 8) && (sz64 > 0x100000000ULL)) {
281 " BAR\n", pos); 274 dev_err(&dev->dev, "can't handle 64-bit BAR\n");
282 res->start = 0; 275 goto fail;
283 res->flags = 0; 276 } else if ((sizeof(resource_size_t) < 8) && l) {
284 } else if (lhi) { 277 /* Address above 32-bit boundary; disable the BAR */
285 /* 64-bit wide address, treat as disabled */ 278 pci_write_config_dword(dev, pos, 0);
286 pci_write_config_dword(dev, reg, 279 pci_write_config_dword(dev, pos + 4, 0);
287 l & ~(u32)PCI_BASE_ADDRESS_MEM_MASK); 280 res->start = 0;
288 pci_write_config_dword(dev, reg+4, 0); 281 res->end = sz64;
289 res->start = 0; 282 } else {
290 res->end = sz; 283 res->start = l64;
291 } 284 res->end = l64 + sz64;
292#endif
293 } 285 }
286 } else {
287 sz = pci_size(l, sz, mask);
288
289 if (!sz)
290 goto fail;
291
292 res->start = l;
293 res->end = l + sz;
294 } 294 }
295
296 out:
297 return (type == pci_bar_mem64) ? 1 : 0;
298 fail:
299 res->flags = 0;
300 goto out;
301}
302
303static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
304{
305 unsigned int pos, reg;
306
307 for (pos = 0; pos < howmany; pos++) {
308 struct resource *res = &dev->resource[pos];
309 reg = PCI_BASE_ADDRESS_0 + (pos << 2);
310 pos += __pci_read_base(dev, pci_bar_unknown, res, reg);
311 }
312
295 if (rom) { 313 if (rom) {
314 struct resource *res = &dev->resource[PCI_ROM_RESOURCE];
296 dev->rom_base_reg = rom; 315 dev->rom_base_reg = rom;
297 res = &dev->resource[PCI_ROM_RESOURCE]; 316 res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH |
298 res->name = pci_name(dev); 317 IORESOURCE_READONLY | IORESOURCE_CACHEABLE |
299 pci_read_config_dword(dev, rom, &l); 318 IORESOURCE_SIZEALIGN;
300 pci_write_config_dword(dev, rom, ~PCI_ROM_ADDRESS_ENABLE); 319 __pci_read_base(dev, pci_bar_mem32, res, rom);
301 pci_read_config_dword(dev, rom, &sz);
302 pci_write_config_dword(dev, rom, l);
303 if (l == 0xffffffff)
304 l = 0;
305 if (sz && sz != 0xffffffff) {
306 sz = pci_size(l, sz, (u32)PCI_ROM_ADDRESS_MASK);
307 if (sz) {
308 res->flags = (l & IORESOURCE_ROM_ENABLE) |
309 IORESOURCE_MEM | IORESOURCE_PREFETCH |
310 IORESOURCE_READONLY | IORESOURCE_CACHEABLE |
311 IORESOURCE_SIZEALIGN;
312 res->start = l & PCI_ROM_ADDRESS_MASK;
313 res->end = res->start + (unsigned long) sz;
314 }
315 }
316 } 320 }
317} 321}
318 322
@@ -1053,7 +1057,8 @@ int pci_scan_slot(struct pci_bus *bus, int devfn)
1053 } 1057 }
1054 } 1058 }
1055 1059
1056 if (bus->self) 1060 /* only one slot has pcie device */
1061 if (bus->self && nr)
1057 pcie_aspm_init_link_state(bus->self); 1062 pcie_aspm_init_link_state(bus->self);
1058 1063
1059 return nr; 1064 return nr;
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 12d489395fad..0fb365074288 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -923,6 +923,19 @@ static void __init quirk_ide_samemode(struct pci_dev *pdev)
923} 923}
924DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_10, quirk_ide_samemode); 924DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_10, quirk_ide_samemode);
925 925
926/*
927 * Some ATA devices break if put into D3
928 */
929
930static void __devinit quirk_no_ata_d3(struct pci_dev *pdev)
931{
932 /* Quirk the legacy ATA devices only. The AHCI ones are ok */
933 if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE)
934 pdev->dev_flags |= PCI_DEV_FLAGS_NO_D3;
935}
936DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_ANY_ID, quirk_no_ata_d3);
937DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, PCI_ANY_ID, quirk_no_ata_d3);
938
926/* This was originally an Alpha specific thing, but it really fits here. 939/* This was originally an Alpha specific thing, but it really fits here.
927 * The i82375 PCI/EISA bridge appears as non-classified. Fix that. 940 * The i82375 PCI/EISA bridge appears as non-classified. Fix that.
928 */ 941 */
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 4d17d384578d..9ce55850271a 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -49,6 +49,13 @@ config BATTERY_OLPC
49 help 49 help
50 Say Y to enable support for the battery on the OLPC laptop. 50 Say Y to enable support for the battery on the OLPC laptop.
51 51
52config BATTERY_TOSA
53 tristate "Sharp SL-6000 (tosa) battery"
54 depends on MACH_TOSA && MFD_TC6393XB
55 help
56 Say Y to enable support for the battery on the Sharp Zaurus
57 SL-6000 (tosa) models.
58
52config BATTERY_PALMTX 59config BATTERY_PALMTX
53 tristate "Palm T|X battery" 60 tristate "Palm T|X battery"
54 depends on MACH_PALMTX 61 depends on MACH_PALMTX
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 6f43a54ee420..4706bf8ff459 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -20,4 +20,5 @@ obj-$(CONFIG_APM_POWER) += apm_power.o
20obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o 20obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o
21obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o 21obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
22obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o 22obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
23obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o
23obj-$(CONFIG_BATTERY_PALMTX) += palmtx_battery.o 24obj-$(CONFIG_BATTERY_PALMTX) += palmtx_battery.o
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c
index ab1e8289f07f..32570af3c5c9 100644
--- a/drivers/power/olpc_battery.c
+++ b/drivers/power/olpc_battery.c
@@ -19,7 +19,7 @@
19 19
20#define EC_BAT_VOLTAGE 0x10 /* uint16_t, *9.76/32, mV */ 20#define EC_BAT_VOLTAGE 0x10 /* uint16_t, *9.76/32, mV */
21#define EC_BAT_CURRENT 0x11 /* int16_t, *15.625/120, mA */ 21#define EC_BAT_CURRENT 0x11 /* int16_t, *15.625/120, mA */
22#define EC_BAT_ACR 0x12 22#define EC_BAT_ACR 0x12 /* int16_t, *6250/15, µAh */
23#define EC_BAT_TEMP 0x13 /* uint16_t, *100/256, °C */ 23#define EC_BAT_TEMP 0x13 /* uint16_t, *100/256, °C */
24#define EC_AMB_TEMP 0x14 /* uint16_t, *100/256, °C */ 24#define EC_AMB_TEMP 0x14 /* uint16_t, *100/256, °C */
25#define EC_BAT_STATUS 0x15 /* uint8_t, bitmask */ 25#define EC_BAT_STATUS 0x15 /* uint8_t, bitmask */
@@ -84,6 +84,119 @@ static struct power_supply olpc_ac = {
84 .get_property = olpc_ac_get_prop, 84 .get_property = olpc_ac_get_prop,
85}; 85};
86 86
87static char bat_serial[17]; /* Ick */
88
89static int olpc_bat_get_status(union power_supply_propval *val, uint8_t ec_byte)
90{
91 if (olpc_platform_info.ecver > 0x44) {
92 if (ec_byte & BAT_STAT_CHARGING)
93 val->intval = POWER_SUPPLY_STATUS_CHARGING;
94 else if (ec_byte & BAT_STAT_DISCHARGING)
95 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
96 else if (ec_byte & BAT_STAT_FULL)
97 val->intval = POWER_SUPPLY_STATUS_FULL;
98 else /* er,... */
99 val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
100 } else {
101 /* Older EC didn't report charge/discharge bits */
102 if (!(ec_byte & BAT_STAT_AC)) /* No AC means discharging */
103 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
104 else if (ec_byte & BAT_STAT_FULL)
105 val->intval = POWER_SUPPLY_STATUS_FULL;
106 else /* Not _necessarily_ true but EC doesn't tell all yet */
107 val->intval = POWER_SUPPLY_STATUS_CHARGING;
108 }
109
110 return 0;
111}
112
113static int olpc_bat_get_health(union power_supply_propval *val)
114{
115 uint8_t ec_byte;
116 int ret;
117
118 ret = olpc_ec_cmd(EC_BAT_ERRCODE, NULL, 0, &ec_byte, 1);
119 if (ret)
120 return ret;
121
122 switch (ec_byte) {
123 case 0:
124 val->intval = POWER_SUPPLY_HEALTH_GOOD;
125 break;
126
127 case BAT_ERR_OVERTEMP:
128 val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
129 break;
130
131 case BAT_ERR_OVERVOLTAGE:
132 val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
133 break;
134
135 case BAT_ERR_INFOFAIL:
136 case BAT_ERR_OUT_OF_CONTROL:
137 case BAT_ERR_ID_FAIL:
138 case BAT_ERR_ACR_FAIL:
139 val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
140 break;
141
142 default:
143 /* Eep. We don't know this failure code */
144 ret = -EIO;
145 }
146
147 return ret;
148}
149
150static int olpc_bat_get_mfr(union power_supply_propval *val)
151{
152 uint8_t ec_byte;
153 int ret;
154
155 ec_byte = BAT_ADDR_MFR_TYPE;
156 ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &ec_byte, 1);
157 if (ret)
158 return ret;
159
160 switch (ec_byte >> 4) {
161 case 1:
162 val->strval = "Gold Peak";
163 break;
164 case 2:
165 val->strval = "BYD";
166 break;
167 default:
168 val->strval = "Unknown";
169 break;
170 }
171
172 return ret;
173}
174
175static int olpc_bat_get_tech(union power_supply_propval *val)
176{
177 uint8_t ec_byte;
178 int ret;
179
180 ec_byte = BAT_ADDR_MFR_TYPE;
181 ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &ec_byte, 1);
182 if (ret)
183 return ret;
184
185 switch (ec_byte & 0xf) {
186 case 1:
187 val->intval = POWER_SUPPLY_TECHNOLOGY_NiMH;
188 break;
189 case 2:
190 val->intval = POWER_SUPPLY_TECHNOLOGY_LiFe;
191 break;
192 default:
193 val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
194 break;
195 }
196
197 return ret;
198}
199
87/********************************************************************* 200/*********************************************************************
88 * Battery properties 201 * Battery properties
89 *********************************************************************/ 202 *********************************************************************/
@@ -94,6 +207,7 @@ static int olpc_bat_get_property(struct power_supply *psy,
94 int ret = 0; 207 int ret = 0;
95 int16_t ec_word; 208 int16_t ec_word;
96 uint8_t ec_byte; 209 uint8_t ec_byte;
210 uint64_t ser_buf;
97 211
98 ret = olpc_ec_cmd(EC_BAT_STATUS, NULL, 0, &ec_byte, 1); 212 ret = olpc_ec_cmd(EC_BAT_STATUS, NULL, 0, &ec_byte, 1);
99 if (ret) 213 if (ret)
@@ -110,25 +224,10 @@ static int olpc_bat_get_property(struct power_supply *psy,
110 224
111 switch (psp) { 225 switch (psp) {
112 case POWER_SUPPLY_PROP_STATUS: 226 case POWER_SUPPLY_PROP_STATUS:
113 if (olpc_platform_info.ecver > 0x44) { 227 ret = olpc_bat_get_status(val, ec_byte);
114 if (ec_byte & BAT_STAT_CHARGING) 228 if (ret)
115 val->intval = POWER_SUPPLY_STATUS_CHARGING; 229 return ret;
116 else if (ec_byte & BAT_STAT_DISCHARGING) 230 break;
117 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
118 else if (ec_byte & BAT_STAT_FULL)
119 val->intval = POWER_SUPPLY_STATUS_FULL;
120 else /* er,... */
121 val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
122 } else {
123 /* Older EC didn't report charge/discharge bits */
124 if (!(ec_byte & BAT_STAT_AC)) /* No AC means discharging */
125 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
126 else if (ec_byte & BAT_STAT_FULL)
127 val->intval = POWER_SUPPLY_STATUS_FULL;
128 else /* Not _necessarily_ true but EC doesn't tell all yet */
129 val->intval = POWER_SUPPLY_STATUS_CHARGING;
130 break;
131 }
132 case POWER_SUPPLY_PROP_PRESENT: 231 case POWER_SUPPLY_PROP_PRESENT:
133 val->intval = !!(ec_byte & BAT_STAT_PRESENT); 232 val->intval = !!(ec_byte & BAT_STAT_PRESENT);
134 break; 233 break;
@@ -137,72 +236,21 @@ static int olpc_bat_get_property(struct power_supply *psy,
137 if (ec_byte & BAT_STAT_DESTROY) 236 if (ec_byte & BAT_STAT_DESTROY)
138 val->intval = POWER_SUPPLY_HEALTH_DEAD; 237 val->intval = POWER_SUPPLY_HEALTH_DEAD;
139 else { 238 else {
140 ret = olpc_ec_cmd(EC_BAT_ERRCODE, NULL, 0, &ec_byte, 1); 239 ret = olpc_bat_get_health(val);
141 if (ret) 240 if (ret)
142 return ret; 241 return ret;
143
144 switch (ec_byte) {
145 case 0:
146 val->intval = POWER_SUPPLY_HEALTH_GOOD;
147 break;
148
149 case BAT_ERR_OVERTEMP:
150 val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
151 break;
152
153 case BAT_ERR_OVERVOLTAGE:
154 val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
155 break;
156
157 case BAT_ERR_INFOFAIL:
158 case BAT_ERR_OUT_OF_CONTROL:
159 case BAT_ERR_ID_FAIL:
160 case BAT_ERR_ACR_FAIL:
161 val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
162 break;
163
164 default:
165 /* Eep. We don't know this failure code */
166 return -EIO;
167 }
168 } 242 }
169 break; 243 break;
170 244
171 case POWER_SUPPLY_PROP_MANUFACTURER: 245 case POWER_SUPPLY_PROP_MANUFACTURER:
172 ec_byte = BAT_ADDR_MFR_TYPE; 246 ret = olpc_bat_get_mfr(val);
173 ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &ec_byte, 1);
174 if (ret) 247 if (ret)
175 return ret; 248 return ret;
176
177 switch (ec_byte >> 4) {
178 case 1:
179 val->strval = "Gold Peak";
180 break;
181 case 2:
182 val->strval = "BYD";
183 break;
184 default:
185 val->strval = "Unknown";
186 break;
187 }
188 break; 249 break;
189 case POWER_SUPPLY_PROP_TECHNOLOGY: 250 case POWER_SUPPLY_PROP_TECHNOLOGY:
190 ec_byte = BAT_ADDR_MFR_TYPE; 251 ret = olpc_bat_get_tech(val);
191 ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1, &ec_byte, 1);
192 if (ret) 252 if (ret)
193 return ret; 253 return ret;
194
195 switch (ec_byte & 0xf) {
196 case 1:
197 val->intval = POWER_SUPPLY_TECHNOLOGY_NiMH;
198 break;
199 case 2:
200 val->intval = POWER_SUPPLY_TECHNOLOGY_LiFe;
201 break;
202 default:
203 val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
204 break;
205 }
206 break; 254 break;
207 case POWER_SUPPLY_PROP_VOLTAGE_AVG: 255 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
208 ret = olpc_ec_cmd(EC_BAT_VOLTAGE, NULL, 0, (void *)&ec_word, 2); 256 ret = olpc_ec_cmd(EC_BAT_VOLTAGE, NULL, 0, (void *)&ec_word, 2);
@@ -241,6 +289,22 @@ static int olpc_bat_get_property(struct power_supply *psy,
241 ec_word = be16_to_cpu(ec_word); 289 ec_word = be16_to_cpu(ec_word);
242 val->intval = ec_word * 100 / 256; 290 val->intval = ec_word * 100 / 256;
243 break; 291 break;
292 case POWER_SUPPLY_PROP_CHARGE_COUNTER:
293 ret = olpc_ec_cmd(EC_BAT_ACR, NULL, 0, (void *)&ec_word, 2);
294 if (ret)
295 return ret;
296
297 ec_word = be16_to_cpu(ec_word);
298 val->intval = ec_word * 6250 / 15;
299 break;
300 case POWER_SUPPLY_PROP_SERIAL_NUMBER:
301 ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8);
302 if (ret)
303 return ret;
304
305 sprintf(bat_serial, "%016llx", (long long)be64_to_cpu(ser_buf));
306 val->strval = bat_serial;
307 break;
244 default: 308 default:
245 ret = -EINVAL; 309 ret = -EINVAL;
246 break; 310 break;
@@ -260,6 +324,50 @@ static enum power_supply_property olpc_bat_props[] = {
260 POWER_SUPPLY_PROP_TEMP, 324 POWER_SUPPLY_PROP_TEMP,
261 POWER_SUPPLY_PROP_TEMP_AMBIENT, 325 POWER_SUPPLY_PROP_TEMP_AMBIENT,
262 POWER_SUPPLY_PROP_MANUFACTURER, 326 POWER_SUPPLY_PROP_MANUFACTURER,
327 POWER_SUPPLY_PROP_SERIAL_NUMBER,
328 POWER_SUPPLY_PROP_CHARGE_COUNTER,
329};
330
331/* EEPROM reading goes completely around the power_supply API, sadly */
332
333#define EEPROM_START 0x20
334#define EEPROM_END 0x80
335#define EEPROM_SIZE (EEPROM_END - EEPROM_START)
336
337static ssize_t olpc_bat_eeprom_read(struct kobject *kobj,
338 struct bin_attribute *attr, char *buf, loff_t off, size_t count)
339{
340 uint8_t ec_byte;
341 int ret, end;
342
343 if (off >= EEPROM_SIZE)
344 return 0;
345 if (off + count > EEPROM_SIZE)
346 count = EEPROM_SIZE - off;
347
348 end = EEPROM_START + off + count;
349 for (ec_byte = EEPROM_START + off; ec_byte < end; ec_byte++) {
350 ret = olpc_ec_cmd(EC_BAT_EEPROM, &ec_byte, 1,
351 &buf[ec_byte - EEPROM_START], 1);
352 if (ret) {
353 printk(KERN_ERR "olpc-battery: EC command "
354 "EC_BAT_EEPROM @ 0x%x failed -"
355 " %d!\n", ec_byte, ret);
356 return -EIO;
357 }
358 }
359
360 return count;
361}
362
363static struct bin_attribute olpc_bat_eeprom = {
364 .attr = {
365 .name = "eeprom",
366 .mode = S_IRUGO,
367 .owner = THIS_MODULE,
368 },
369 .size = 0,
370 .read = olpc_bat_eeprom_read,
263}; 371};
264 372
265/********************************************************************* 373/*********************************************************************
@@ -290,8 +398,14 @@ static int __init olpc_bat_init(void)
290 398
291 if (!olpc_platform_info.ecver) 399 if (!olpc_platform_info.ecver)
292 return -ENXIO; 400 return -ENXIO;
293 if (olpc_platform_info.ecver < 0x43) { 401
294 printk(KERN_NOTICE "OLPC EC version 0x%02x too old for battery driver.\n", olpc_platform_info.ecver); 402 /*
403 * We've seen a number of EC protocol changes; this driver requires
404 * the latest EC protocol, supported by 0x44 and above.
405 */
406 if (olpc_platform_info.ecver < 0x44) {
407 printk(KERN_NOTICE "OLPC EC version 0x%02x too old for "
408 "battery driver.\n", olpc_platform_info.ecver);
295 return -ENXIO; 409 return -ENXIO;
296 } 410 }
297 411
@@ -315,8 +429,14 @@ static int __init olpc_bat_init(void)
315 if (ret) 429 if (ret)
316 goto battery_failed; 430 goto battery_failed;
317 431
432 ret = device_create_bin_file(olpc_bat.dev, &olpc_bat_eeprom);
433 if (ret)
434 goto eeprom_failed;
435
318 goto success; 436 goto success;
319 437
438eeprom_failed:
439 power_supply_unregister(&olpc_bat);
320battery_failed: 440battery_failed:
321 power_supply_unregister(&olpc_ac); 441 power_supply_unregister(&olpc_ac);
322ac_failed: 442ac_failed:
@@ -327,6 +447,7 @@ success:
327 447
328static void __exit olpc_bat_exit(void) 448static void __exit olpc_bat_exit(void)
329{ 449{
450 device_remove_bin_file(olpc_bat.dev, &olpc_bat_eeprom);
330 power_supply_unregister(&olpc_bat); 451 power_supply_unregister(&olpc_bat);
331 power_supply_unregister(&olpc_ac); 452 power_supply_unregister(&olpc_ac);
332 platform_device_unregister(bat_pdev); 453 platform_device_unregister(bat_pdev);
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index 49215da5249b..fe2aeb11939b 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -99,6 +99,7 @@ static struct device_attribute power_supply_attrs[] = {
99 POWER_SUPPLY_ATTR(charge_empty), 99 POWER_SUPPLY_ATTR(charge_empty),
100 POWER_SUPPLY_ATTR(charge_now), 100 POWER_SUPPLY_ATTR(charge_now),
101 POWER_SUPPLY_ATTR(charge_avg), 101 POWER_SUPPLY_ATTR(charge_avg),
102 POWER_SUPPLY_ATTR(charge_counter),
102 POWER_SUPPLY_ATTR(energy_full_design), 103 POWER_SUPPLY_ATTR(energy_full_design),
103 POWER_SUPPLY_ATTR(energy_empty_design), 104 POWER_SUPPLY_ATTR(energy_empty_design),
104 POWER_SUPPLY_ATTR(energy_full), 105 POWER_SUPPLY_ATTR(energy_full),
diff --git a/drivers/power/tosa_battery.c b/drivers/power/tosa_battery.c
new file mode 100644
index 000000000000..bf664fbd6610
--- /dev/null
+++ b/drivers/power/tosa_battery.c
@@ -0,0 +1,486 @@
1/*
2 * Battery and Power Management code for the Sharp SL-6000x
3 *
4 * Copyright (c) 2005 Dirk Opfer
5 * Copyright (c) 2008 Dmitry Baryshkov
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 */
12#include <linux/kernel.h>
13#include <linux/module.h>
14#include <linux/power_supply.h>
15#include <linux/wm97xx.h>
16#include <linux/delay.h>
17#include <linux/spinlock.h>
18#include <linux/interrupt.h>
19#include <linux/gpio.h>
20
21#include <asm/mach-types.h>
22#include <asm/arch/tosa.h>
23
24static DEFINE_MUTEX(bat_lock); /* protects gpio pins */
25static struct work_struct bat_work;
26
27struct tosa_bat {
28 int status;
29 struct power_supply psy;
30 int full_chrg;
31
32 struct mutex work_lock; /* protects data */
33
34 bool (*is_present)(struct tosa_bat *bat);
35 int gpio_full;
36 int gpio_charge_off;
37
38 int technology;
39
40 int gpio_bat;
41 int adc_bat;
42 int adc_bat_divider;
43 int bat_max;
44 int bat_min;
45
46 int gpio_temp;
47 int adc_temp;
48 int adc_temp_divider;
49};
50
51static struct tosa_bat tosa_bat_main;
52static struct tosa_bat tosa_bat_jacket;
53
54static unsigned long tosa_read_bat(struct tosa_bat *bat)
55{
56 unsigned long value = 0;
57
58 if (bat->gpio_bat < 0 || bat->adc_bat < 0)
59 return 0;
60
61 mutex_lock(&bat_lock);
62 gpio_set_value(bat->gpio_bat, 1);
63 msleep(5);
64 value = wm97xx_read_aux_adc(bat->psy.dev->parent->driver_data,
65 bat->adc_bat);
66 gpio_set_value(bat->gpio_bat, 0);
67 mutex_unlock(&bat_lock);
68
69 value = value * 1000000 / bat->adc_bat_divider;
70
71 return value;
72}
73
74static unsigned long tosa_read_temp(struct tosa_bat *bat)
75{
76 unsigned long value = 0;
77
78 if (bat->gpio_temp < 0 || bat->adc_temp < 0)
79 return 0;
80
81 mutex_lock(&bat_lock);
82 gpio_set_value(bat->gpio_temp, 1);
83 msleep(5);
84 value = wm97xx_read_aux_adc(bat->psy.dev->parent->driver_data,
85 bat->adc_temp);
86 gpio_set_value(bat->gpio_temp, 0);
87 mutex_unlock(&bat_lock);
88
89 value = value * 10000 / bat->adc_temp_divider;
90
91 return value;
92}
93
94static int tosa_bat_get_property(struct power_supply *psy,
95 enum power_supply_property psp,
96 union power_supply_propval *val)
97{
98 int ret = 0;
99 struct tosa_bat *bat = container_of(psy, struct tosa_bat, psy);
100
101 if (bat->is_present && !bat->is_present(bat)
102 && psp != POWER_SUPPLY_PROP_PRESENT) {
103 return -ENODEV;
104 }
105
106 switch (psp) {
107 case POWER_SUPPLY_PROP_STATUS:
108 val->intval = bat->status;
109 break;
110 case POWER_SUPPLY_PROP_TECHNOLOGY:
111 val->intval = bat->technology;
112 break;
113 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
114 val->intval = tosa_read_bat(bat);
115 break;
116 case POWER_SUPPLY_PROP_VOLTAGE_MAX:
117 if (bat->full_chrg == -1)
118 val->intval = bat->bat_max;
119 else
120 val->intval = bat->full_chrg;
121 break;
122 case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
123 val->intval = bat->bat_max;
124 break;
125 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
126 val->intval = bat->bat_min;
127 break;
128 case POWER_SUPPLY_PROP_TEMP:
129 val->intval = tosa_read_temp(bat);
130 break;
131 case POWER_SUPPLY_PROP_PRESENT:
132 val->intval = bat->is_present ? bat->is_present(bat) : 1;
133 break;
134 default:
135 ret = -EINVAL;
136 break;
137 }
138 return ret;
139}
140
141static bool tosa_jacket_bat_is_present(struct tosa_bat *bat)
142{
143 return gpio_get_value(TOSA_GPIO_JACKET_DETECT) == 0;
144}
145
146static void tosa_bat_external_power_changed(struct power_supply *psy)
147{
148 schedule_work(&bat_work);
149}
150
151static irqreturn_t tosa_bat_gpio_isr(int irq, void *data)
152{
153 pr_info("tosa_bat_gpio irq: %d\n", gpio_get_value(irq_to_gpio(irq)));
154 schedule_work(&bat_work);
155 return IRQ_HANDLED;
156}
157
158static void tosa_bat_update(struct tosa_bat *bat)
159{
160 int old;
161 struct power_supply *psy = &bat->psy;
162
163 mutex_lock(&bat->work_lock);
164
165 old = bat->status;
166
167 if (bat->is_present && !bat->is_present(bat)) {
168 printk(KERN_NOTICE "%s not present\n", psy->name);
169 bat->status = POWER_SUPPLY_STATUS_UNKNOWN;
170 bat->full_chrg = -1;
171 } else if (power_supply_am_i_supplied(psy)) {
172 if (bat->status == POWER_SUPPLY_STATUS_DISCHARGING) {
173 gpio_set_value(bat->gpio_charge_off, 0);
174 mdelay(15);
175 }
176
177 if (gpio_get_value(bat->gpio_full)) {
178 if (old == POWER_SUPPLY_STATUS_CHARGING ||
179 bat->full_chrg == -1)
180 bat->full_chrg = tosa_read_bat(bat);
181
182 gpio_set_value(bat->gpio_charge_off, 1);
183 bat->status = POWER_SUPPLY_STATUS_FULL;
184 } else {
185 gpio_set_value(bat->gpio_charge_off, 0);
186 bat->status = POWER_SUPPLY_STATUS_CHARGING;
187 }
188 } else {
189 gpio_set_value(bat->gpio_charge_off, 1);
190 bat->status = POWER_SUPPLY_STATUS_DISCHARGING;
191 }
192
193 if (old != bat->status)
194 power_supply_changed(psy);
195
196 mutex_unlock(&bat->work_lock);
197}
198
199static void tosa_bat_work(struct work_struct *work)
200{
201 tosa_bat_update(&tosa_bat_main);
202 tosa_bat_update(&tosa_bat_jacket);
203}
204
205
206static enum power_supply_property tosa_bat_main_props[] = {
207 POWER_SUPPLY_PROP_STATUS,
208 POWER_SUPPLY_PROP_TECHNOLOGY,
209 POWER_SUPPLY_PROP_VOLTAGE_NOW,
210 POWER_SUPPLY_PROP_VOLTAGE_MAX,
211 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
212 POWER_SUPPLY_PROP_TEMP,
213 POWER_SUPPLY_PROP_PRESENT,
214};
215
216static enum power_supply_property tosa_bat_bu_props[] = {
217 POWER_SUPPLY_PROP_STATUS,
218 POWER_SUPPLY_PROP_TECHNOLOGY,
219 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
220 POWER_SUPPLY_PROP_VOLTAGE_NOW,
221 POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
222 POWER_SUPPLY_PROP_PRESENT,
223};
224
225static struct tosa_bat tosa_bat_main = {
226 .status = POWER_SUPPLY_STATUS_DISCHARGING,
227 .full_chrg = -1,
228 .psy = {
229 .name = "main-battery",
230 .type = POWER_SUPPLY_TYPE_BATTERY,
231 .properties = tosa_bat_main_props,
232 .num_properties = ARRAY_SIZE(tosa_bat_main_props),
233 .get_property = tosa_bat_get_property,
234 .external_power_changed = tosa_bat_external_power_changed,
235 .use_for_apm = 1,
236 },
237
238 .gpio_full = TOSA_GPIO_BAT0_CRG,
239 .gpio_charge_off = TOSA_GPIO_CHARGE_OFF,
240
241 .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
242
243 .gpio_bat = TOSA_GPIO_BAT0_V_ON,
244 .adc_bat = WM97XX_AUX_ID3,
245 .adc_bat_divider = 414,
246 .bat_max = 4310000,
247 .bat_min = 1551 * 1000000 / 414,
248
249 .gpio_temp = TOSA_GPIO_BAT1_TH_ON,
250 .adc_temp = WM97XX_AUX_ID2,
251 .adc_temp_divider = 10000,
252};
253
254static struct tosa_bat tosa_bat_jacket = {
255 .status = POWER_SUPPLY_STATUS_DISCHARGING,
256 .full_chrg = -1,
257 .psy = {
258 .name = "jacket-battery",
259 .type = POWER_SUPPLY_TYPE_BATTERY,
260 .properties = tosa_bat_main_props,
261 .num_properties = ARRAY_SIZE(tosa_bat_main_props),
262 .get_property = tosa_bat_get_property,
263 .external_power_changed = tosa_bat_external_power_changed,
264 },
265
266 .is_present = tosa_jacket_bat_is_present,
267 .gpio_full = TOSA_GPIO_BAT1_CRG,
268 .gpio_charge_off = TOSA_GPIO_CHARGE_OFF_JC,
269
270 .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
271
272 .gpio_bat = TOSA_GPIO_BAT1_V_ON,
273 .adc_bat = WM97XX_AUX_ID3,
274 .adc_bat_divider = 414,
275 .bat_max = 4310000,
276 .bat_min = 1551 * 1000000 / 414,
277
278 .gpio_temp = TOSA_GPIO_BAT0_TH_ON,
279 .adc_temp = WM97XX_AUX_ID2,
280 .adc_temp_divider = 10000,
281};
282
283static struct tosa_bat tosa_bat_bu = {
284 .status = POWER_SUPPLY_STATUS_UNKNOWN,
285 .full_chrg = -1,
286
287 .psy = {
288 .name = "backup-battery",
289 .type = POWER_SUPPLY_TYPE_BATTERY,
290 .properties = tosa_bat_bu_props,
291 .num_properties = ARRAY_SIZE(tosa_bat_bu_props),
292 .get_property = tosa_bat_get_property,
293 .external_power_changed = tosa_bat_external_power_changed,
294 },
295
296 .gpio_full = -1,
297 .gpio_charge_off = -1,
298
299 .technology = POWER_SUPPLY_TECHNOLOGY_LiMn,
300
301 .gpio_bat = TOSA_GPIO_BU_CHRG_ON,
302 .adc_bat = WM97XX_AUX_ID4,
303 .adc_bat_divider = 1266,
304
305 .gpio_temp = -1,
306 .adc_temp = -1,
307 .adc_temp_divider = -1,
308};
309
310static struct {
311 int gpio;
312 char *name;
313 bool output;
314 int value;
315} gpios[] = {
316 { TOSA_GPIO_CHARGE_OFF, "main charge off", 1, 1 },
317 { TOSA_GPIO_CHARGE_OFF_JC, "jacket charge off", 1, 1 },
318 { TOSA_GPIO_BAT_SW_ON, "battery switch", 1, 0 },
319 { TOSA_GPIO_BAT0_V_ON, "main battery", 1, 0 },
320 { TOSA_GPIO_BAT1_V_ON, "jacket battery", 1, 0 },
321 { TOSA_GPIO_BAT1_TH_ON, "main battery temp", 1, 0 },
322 { TOSA_GPIO_BAT0_TH_ON, "jacket battery temp", 1, 0 },
323 { TOSA_GPIO_BU_CHRG_ON, "backup battery", 1, 0 },
324 { TOSA_GPIO_BAT0_CRG, "main battery full", 0, 0 },
325 { TOSA_GPIO_BAT1_CRG, "jacket battery full", 0, 0 },
326 { TOSA_GPIO_BAT0_LOW, "main battery low", 0, 0 },
327 { TOSA_GPIO_BAT1_LOW, "jacket battery low", 0, 0 },
328 { TOSA_GPIO_JACKET_DETECT, "jacket detect", 0, 0 },
329};
330
331#ifdef CONFIG_PM
332static int tosa_bat_suspend(struct platform_device *dev, pm_message_t state)
333{
334 /* flush all pending status updates */
335 flush_scheduled_work();
336 return 0;
337}
338
339static int tosa_bat_resume(struct platform_device *dev)
340{
341 /* things may have changed while we were away */
342 schedule_work(&bat_work);
343 return 0;
344}
345#else
346#define tosa_bat_suspend NULL
347#define tosa_bat_resume NULL
348#endif
349
350static int __devinit tosa_bat_probe(struct platform_device *dev)
351{
352 int ret;
353 int i;
354
355 if (!machine_is_tosa())
356 return -ENODEV;
357
358 for (i = 0; i < ARRAY_SIZE(gpios); i++) {
359 ret = gpio_request(gpios[i].gpio, gpios[i].name);
360 if (ret) {
361 i--;
362 goto err_gpio;
363 }
364
365 if (gpios[i].output)
366 ret = gpio_direction_output(gpios[i].gpio,
367 gpios[i].value);
368 else
369 ret = gpio_direction_input(gpios[i].gpio);
370
371 if (ret)
372 goto err_gpio;
373 }
374
375 mutex_init(&tosa_bat_main.work_lock);
376 mutex_init(&tosa_bat_jacket.work_lock);
377
378 INIT_WORK(&bat_work, tosa_bat_work);
379
380 ret = power_supply_register(&dev->dev, &tosa_bat_main.psy);
381 if (ret)
382 goto err_psy_reg_main;
383 ret = power_supply_register(&dev->dev, &tosa_bat_jacket.psy);
384 if (ret)
385 goto err_psy_reg_jacket;
386 ret = power_supply_register(&dev->dev, &tosa_bat_bu.psy);
387 if (ret)
388 goto err_psy_reg_bu;
389
390 ret = request_irq(gpio_to_irq(TOSA_GPIO_BAT0_CRG),
391 tosa_bat_gpio_isr,
392 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
393 "main full", &tosa_bat_main);
394 if (ret)
395 goto err_req_main;
396
397 ret = request_irq(gpio_to_irq(TOSA_GPIO_BAT1_CRG),
398 tosa_bat_gpio_isr,
399 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
400 "jacket full", &tosa_bat_jacket);
401 if (ret)
402 goto err_req_jacket;
403
404 ret = request_irq(gpio_to_irq(TOSA_GPIO_JACKET_DETECT),
405 tosa_bat_gpio_isr,
406 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
407 "jacket detect", &tosa_bat_jacket);
408 if (!ret) {
409 schedule_work(&bat_work);
410 return 0;
411 }
412
413 free_irq(gpio_to_irq(TOSA_GPIO_BAT1_CRG), &tosa_bat_jacket);
414err_req_jacket:
415 free_irq(gpio_to_irq(TOSA_GPIO_BAT0_CRG), &tosa_bat_main);
416err_req_main:
417 power_supply_unregister(&tosa_bat_bu.psy);
418err_psy_reg_bu:
419 power_supply_unregister(&tosa_bat_jacket.psy);
420err_psy_reg_jacket:
421 power_supply_unregister(&tosa_bat_main.psy);
422err_psy_reg_main:
423
424 /* see comment in tosa_bat_remove */
425 flush_scheduled_work();
426
427 i--;
428err_gpio:
429 for (; i >= 0; i--)
430 gpio_free(gpios[i].gpio);
431
432 return ret;
433}
434
435static int __devexit tosa_bat_remove(struct platform_device *dev)
436{
437 int i;
438
439 free_irq(gpio_to_irq(TOSA_GPIO_JACKET_DETECT), &tosa_bat_jacket);
440 free_irq(gpio_to_irq(TOSA_GPIO_BAT1_CRG), &tosa_bat_jacket);
441 free_irq(gpio_to_irq(TOSA_GPIO_BAT0_CRG), &tosa_bat_main);
442
443 power_supply_unregister(&tosa_bat_bu.psy);
444 power_supply_unregister(&tosa_bat_jacket.psy);
445 power_supply_unregister(&tosa_bat_main.psy);
446
447 /*
448 * now flush all pending work.
449 * we won't get any more schedules, since all
450 * sources (isr and external_power_changed)
451 * are unregistered now.
452 */
453 flush_scheduled_work();
454
455 for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--)
456 gpio_free(gpios[i].gpio);
457
458 return 0;
459}
460
461static struct platform_driver tosa_bat_driver = {
462 .driver.name = "wm97xx-battery",
463 .driver.owner = THIS_MODULE,
464 .probe = tosa_bat_probe,
465 .remove = __devexit_p(tosa_bat_remove),
466 .suspend = tosa_bat_suspend,
467 .resume = tosa_bat_resume,
468};
469
470static int __init tosa_bat_init(void)
471{
472 return platform_driver_register(&tosa_bat_driver);
473}
474
475static void __exit tosa_bat_exit(void)
476{
477 platform_driver_unregister(&tosa_bat_driver);
478}
479
480module_init(tosa_bat_init);
481module_exit(tosa_bat_exit);
482
483MODULE_LICENSE("GPL");
484MODULE_AUTHOR("Dmitry Baryshkov");
485MODULE_DESCRIPTION("Tosa battery driver");
486MODULE_ALIAS("platform:wm97xx-battery");
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
new file mode 100644
index 000000000000..a656128f1fdd
--- /dev/null
+++ b/drivers/regulator/Kconfig
@@ -0,0 +1,59 @@
1menu "Voltage and Current regulators"
2
3config REGULATOR
4 bool "Voltage and Current Regulator Support"
5 default n
6 help
7 Generic Voltage and Current Regulator support.
8
9 This framework is designed to provide a generic interface to voltage
10 and current regulators within the Linux kernel. It's intended to
11 provide voltage and current control to client or consumer drivers and
12 also provide status information to user space applications through a
13 sysfs interface.
14
15 The intention is to allow systems to dynamically control regulator
16 output in order to save power and prolong battery life. This applies
17 to both voltage regulators (where voltage output is controllable) and
18 current sinks (where current output is controllable).
19
20 This framework safely compiles out if not selected so that client
21 drivers can still be used in systems with no software controllable
22 regulators.
23
24 If unsure, say no.
25
26config REGULATOR_DEBUG
27 bool "Regulator debug support"
28 depends on REGULATOR
29 help
30 Say yes here to enable debugging support.
31
32config REGULATOR_FIXED_VOLTAGE
33 tristate
34 default n
35 select REGULATOR
36
37config REGULATOR_VIRTUAL_CONSUMER
38 tristate "Virtual regulator consumer support"
39 default n
40 select REGULATOR
41 help
42 This driver provides a virtual consumer for the voltage and
43 current regulator API which provides sysfs controls for
44 configuring the supplies requested. This is mainly useful
45 for test purposes.
46
47 If unsure, say no.
48
49config REGULATOR_BQ24022
50 tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC"
51 default n
52 select REGULATOR
53 help
54 This driver controls a TI bq24022 Charger attached via
55 GPIOs. The provided current regulator can enable/disable
56 charging select between 100 mA and 500 mA charging current
57 limit.
58
59endmenu
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
new file mode 100644
index 000000000000..ac2c64efe65c
--- /dev/null
+++ b/drivers/regulator/Makefile
@@ -0,0 +1,12 @@
1#
2# Makefile for regulator drivers.
3#
4
5
6obj-$(CONFIG_REGULATOR) += core.o
7obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o
8obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o
9
10obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
11
12ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
diff --git a/drivers/regulator/bq24022.c b/drivers/regulator/bq24022.c
new file mode 100644
index 000000000000..263699d6152d
--- /dev/null
+++ b/drivers/regulator/bq24022.c
@@ -0,0 +1,167 @@
1/*
2 * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater)
3 * 1-Cell Li-Ion Charger connected via GPIOs.
4 *
5 * Copyright (c) 2008 Philipp Zabel
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 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/err.h>
17#include <linux/gpio.h>
18#include <linux/regulator/bq24022.h>
19#include <linux/regulator/driver.h>
20
21static int bq24022_set_current_limit(struct regulator_dev *rdev,
22 int min_uA, int max_uA)
23{
24 struct platform_device *pdev = rdev_get_drvdata(rdev);
25 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
26
27 dev_dbg(&pdev->dev, "setting current limit to %s mA\n",
28 max_uA >= 500000 ? "500" : "100");
29
30 /* REVISIT: maybe return error if min_uA != 0 ? */
31 gpio_set_value(pdata->gpio_iset2, max_uA >= 500000);
32 return 0;
33}
34
35static int bq24022_get_current_limit(struct regulator_dev *rdev)
36{
37 struct platform_device *pdev = rdev_get_drvdata(rdev);
38 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
39
40 return gpio_get_value(pdata->gpio_iset2) ? 500000 : 100000;
41}
42
43static int bq24022_enable(struct regulator_dev *rdev)
44{
45 struct platform_device *pdev = rdev_get_drvdata(rdev);
46 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
47
48 dev_dbg(&pdev->dev, "enabling charger\n");
49
50 gpio_set_value(pdata->gpio_nce, 0);
51 return 0;
52}
53
54static int bq24022_disable(struct regulator_dev *rdev)
55{
56 struct platform_device *pdev = rdev_get_drvdata(rdev);
57 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
58
59 dev_dbg(&pdev->dev, "disabling charger\n");
60
61 gpio_set_value(pdata->gpio_nce, 1);
62 return 0;
63}
64
65static int bq24022_is_enabled(struct regulator_dev *rdev)
66{
67 struct platform_device *pdev = rdev_get_drvdata(rdev);
68 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
69
70 return !gpio_get_value(pdata->gpio_nce);
71}
72
73static struct regulator_ops bq24022_ops = {
74 .set_current_limit = bq24022_set_current_limit,
75 .get_current_limit = bq24022_get_current_limit,
76 .enable = bq24022_enable,
77 .disable = bq24022_disable,
78 .is_enabled = bq24022_is_enabled,
79};
80
81static struct regulator_desc bq24022_desc = {
82 .name = "bq24022",
83 .ops = &bq24022_ops,
84 .type = REGULATOR_CURRENT,
85};
86
87static int __init bq24022_probe(struct platform_device *pdev)
88{
89 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
90 struct regulator_dev *bq24022;
91 int ret;
92
93 if (!pdata || !pdata->gpio_nce || !pdata->gpio_iset2)
94 return -EINVAL;
95
96 ret = gpio_request(pdata->gpio_nce, "ncharge_en");
97 if (ret) {
98 dev_dbg(&pdev->dev, "couldn't request nCE GPIO: %d\n",
99 pdata->gpio_nce);
100 goto err_ce;
101 }
102 ret = gpio_request(pdata->gpio_iset2, "charge_mode");
103 if (ret) {
104 dev_dbg(&pdev->dev, "couldn't request ISET2 GPIO: %d\n",
105 pdata->gpio_iset2);
106 goto err_iset2;
107 }
108 ret = gpio_direction_output(pdata->gpio_iset2, 0);
109 ret = gpio_direction_output(pdata->gpio_nce, 1);
110
111 bq24022 = regulator_register(&bq24022_desc, pdev);
112 if (IS_ERR(bq24022)) {
113 dev_dbg(&pdev->dev, "couldn't register regulator\n");
114 ret = PTR_ERR(bq24022);
115 goto err_reg;
116 }
117 platform_set_drvdata(pdev, bq24022);
118 dev_dbg(&pdev->dev, "registered regulator\n");
119
120 return 0;
121err_reg:
122 gpio_free(pdata->gpio_iset2);
123err_iset2:
124 gpio_free(pdata->gpio_nce);
125err_ce:
126 return ret;
127}
128
129static int __devexit bq24022_remove(struct platform_device *pdev)
130{
131 struct bq24022_mach_info *pdata = pdev->dev.platform_data;
132 struct regulator_dev *bq24022 = platform_get_drvdata(pdev);
133
134 regulator_unregister(bq24022);
135 gpio_free(pdata->gpio_iset2);
136 gpio_free(pdata->gpio_nce);
137
138 return 0;
139}
140
141static struct platform_driver bq24022_driver = {
142 .driver = {
143 .name = "bq24022",
144 },
145 .remove = __devexit_p(bq24022_remove),
146};
147
148static int __init bq24022_init(void)
149{
150 return platform_driver_probe(&bq24022_driver, bq24022_probe);
151}
152
153static void __exit bq24022_exit(void)
154{
155 platform_driver_unregister(&bq24022_driver);
156}
157
158/*
159 * make sure this is probed before gpio_vbus and pda_power,
160 * but after asic3 or other GPIO expander drivers.
161 */
162subsys_initcall(bq24022_init);
163module_exit(bq24022_exit);
164
165MODULE_AUTHOR("Philipp Zabel");
166MODULE_DESCRIPTION("TI bq24022 Li-Ion Charger driver");
167MODULE_LICENSE("GPL");
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
new file mode 100644
index 000000000000..9c7986261568
--- /dev/null
+++ b/drivers/regulator/core.c
@@ -0,0 +1,1903 @@
1/*
2 * core.c -- Voltage/Current Regulator framework.
3 *
4 * Copyright 2007, 2008 Wolfson Microelectronics PLC.
5 *
6 * Author: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/device.h>
18#include <linux/err.h>
19#include <linux/mutex.h>
20#include <linux/suspend.h>
21#include <linux/regulator/consumer.h>
22#include <linux/regulator/driver.h>
23#include <linux/regulator/machine.h>
24
25#define REGULATOR_VERSION "0.5"
26
27static DEFINE_MUTEX(regulator_list_mutex);
28static LIST_HEAD(regulator_list);
29static LIST_HEAD(regulator_map_list);
30
31/**
32 * struct regulator_dev
33 *
34 * Voltage / Current regulator class device. One for each regulator.
35 */
36struct regulator_dev {
37 struct regulator_desc *desc;
38 int use_count;
39
40 /* lists we belong to */
41 struct list_head list; /* list of all regulators */
42 struct list_head slist; /* list of supplied regulators */
43
44 /* lists we own */
45 struct list_head consumer_list; /* consumers we supply */
46 struct list_head supply_list; /* regulators we supply */
47
48 struct blocking_notifier_head notifier;
49 struct mutex mutex; /* consumer lock */
50 struct module *owner;
51 struct device dev;
52 struct regulation_constraints *constraints;
53 struct regulator_dev *supply; /* for tree */
54
55 void *reg_data; /* regulator_dev data */
56};
57
58/**
59 * struct regulator_map
60 *
61 * Used to provide symbolic supply names to devices.
62 */
63struct regulator_map {
64 struct list_head list;
65 struct device *dev;
66 const char *supply;
67 const char *regulator;
68};
69
70static inline struct regulator_dev *to_rdev(struct device *d)
71{
72 return container_of(d, struct regulator_dev, dev);
73}
74
75/*
76 * struct regulator
77 *
78 * One for each consumer device.
79 */
80struct regulator {
81 struct device *dev;
82 struct list_head list;
83 int uA_load;
84 int min_uV;
85 int max_uV;
86 int enabled; /* client has called enabled */
87 char *supply_name;
88 struct device_attribute dev_attr;
89 struct regulator_dev *rdev;
90};
91
92static int _regulator_is_enabled(struct regulator_dev *rdev);
93static int _regulator_disable(struct regulator_dev *rdev);
94static int _regulator_get_voltage(struct regulator_dev *rdev);
95static int _regulator_get_current_limit(struct regulator_dev *rdev);
96static unsigned int _regulator_get_mode(struct regulator_dev *rdev);
97static void _notifier_call_chain(struct regulator_dev *rdev,
98 unsigned long event, void *data);
99
100/* gets the regulator for a given consumer device */
101static struct regulator *get_device_regulator(struct device *dev)
102{
103 struct regulator *regulator = NULL;
104 struct regulator_dev *rdev;
105
106 mutex_lock(&regulator_list_mutex);
107 list_for_each_entry(rdev, &regulator_list, list) {
108 mutex_lock(&rdev->mutex);
109 list_for_each_entry(regulator, &rdev->consumer_list, list) {
110 if (regulator->dev == dev) {
111 mutex_unlock(&rdev->mutex);
112 mutex_unlock(&regulator_list_mutex);
113 return regulator;
114 }
115 }
116 mutex_unlock(&rdev->mutex);
117 }
118 mutex_unlock(&regulator_list_mutex);
119 return NULL;
120}
121
122/* Platform voltage constraint check */
123static int regulator_check_voltage(struct regulator_dev *rdev,
124 int *min_uV, int *max_uV)
125{
126 BUG_ON(*min_uV > *max_uV);
127
128 if (!rdev->constraints) {
129 printk(KERN_ERR "%s: no constraints for %s\n", __func__,
130 rdev->desc->name);
131 return -ENODEV;
132 }
133 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
134 printk(KERN_ERR "%s: operation not allowed for %s\n",
135 __func__, rdev->desc->name);
136 return -EPERM;
137 }
138
139 if (*max_uV > rdev->constraints->max_uV)
140 *max_uV = rdev->constraints->max_uV;
141 if (*min_uV < rdev->constraints->min_uV)
142 *min_uV = rdev->constraints->min_uV;
143
144 if (*min_uV > *max_uV)
145 return -EINVAL;
146
147 return 0;
148}
149
150/* current constraint check */
151static int regulator_check_current_limit(struct regulator_dev *rdev,
152 int *min_uA, int *max_uA)
153{
154 BUG_ON(*min_uA > *max_uA);
155
156 if (!rdev->constraints) {
157 printk(KERN_ERR "%s: no constraints for %s\n", __func__,
158 rdev->desc->name);
159 return -ENODEV;
160 }
161 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_CURRENT)) {
162 printk(KERN_ERR "%s: operation not allowed for %s\n",
163 __func__, rdev->desc->name);
164 return -EPERM;
165 }
166
167 if (*max_uA > rdev->constraints->max_uA)
168 *max_uA = rdev->constraints->max_uA;
169 if (*min_uA < rdev->constraints->min_uA)
170 *min_uA = rdev->constraints->min_uA;
171
172 if (*min_uA > *max_uA)
173 return -EINVAL;
174
175 return 0;
176}
177
178/* operating mode constraint check */
179static int regulator_check_mode(struct regulator_dev *rdev, int mode)
180{
181 if (!rdev->constraints) {
182 printk(KERN_ERR "%s: no constraints for %s\n", __func__,
183 rdev->desc->name);
184 return -ENODEV;
185 }
186 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_MODE)) {
187 printk(KERN_ERR "%s: operation not allowed for %s\n",
188 __func__, rdev->desc->name);
189 return -EPERM;
190 }
191 if (!(rdev->constraints->valid_modes_mask & mode)) {
192 printk(KERN_ERR "%s: invalid mode %x for %s\n",
193 __func__, mode, rdev->desc->name);
194 return -EINVAL;
195 }
196 return 0;
197}
198
199/* dynamic regulator mode switching constraint check */
200static int regulator_check_drms(struct regulator_dev *rdev)
201{
202 if (!rdev->constraints) {
203 printk(KERN_ERR "%s: no constraints for %s\n", __func__,
204 rdev->desc->name);
205 return -ENODEV;
206 }
207 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) {
208 printk(KERN_ERR "%s: operation not allowed for %s\n",
209 __func__, rdev->desc->name);
210 return -EPERM;
211 }
212 return 0;
213}
214
215static ssize_t device_requested_uA_show(struct device *dev,
216 struct device_attribute *attr, char *buf)
217{
218 struct regulator *regulator;
219
220 regulator = get_device_regulator(dev);
221 if (regulator == NULL)
222 return 0;
223
224 return sprintf(buf, "%d\n", regulator->uA_load);
225}
226
227static ssize_t regulator_uV_show(struct device *dev,
228 struct device_attribute *attr, char *buf)
229{
230 struct regulator_dev *rdev = to_rdev(dev);
231 ssize_t ret;
232
233 mutex_lock(&rdev->mutex);
234 ret = sprintf(buf, "%d\n", _regulator_get_voltage(rdev));
235 mutex_unlock(&rdev->mutex);
236
237 return ret;
238}
239
240static ssize_t regulator_uA_show(struct device *dev,
241 struct device_attribute *attr, char *buf)
242{
243 struct regulator_dev *rdev = to_rdev(dev);
244
245 return sprintf(buf, "%d\n", _regulator_get_current_limit(rdev));
246}
247
248static ssize_t regulator_opmode_show(struct device *dev,
249 struct device_attribute *attr, char *buf)
250{
251 struct regulator_dev *rdev = to_rdev(dev);
252 int mode = _regulator_get_mode(rdev);
253
254 switch (mode) {
255 case REGULATOR_MODE_FAST:
256 return sprintf(buf, "fast\n");
257 case REGULATOR_MODE_NORMAL:
258 return sprintf(buf, "normal\n");
259 case REGULATOR_MODE_IDLE:
260 return sprintf(buf, "idle\n");
261 case REGULATOR_MODE_STANDBY:
262 return sprintf(buf, "standby\n");
263 }
264 return sprintf(buf, "unknown\n");
265}
266
267static ssize_t regulator_state_show(struct device *dev,
268 struct device_attribute *attr, char *buf)
269{
270 struct regulator_dev *rdev = to_rdev(dev);
271 int state = _regulator_is_enabled(rdev);
272
273 if (state > 0)
274 return sprintf(buf, "enabled\n");
275 else if (state == 0)
276 return sprintf(buf, "disabled\n");
277 else
278 return sprintf(buf, "unknown\n");
279}
280
281static ssize_t regulator_min_uA_show(struct device *dev,
282 struct device_attribute *attr, char *buf)
283{
284 struct regulator_dev *rdev = to_rdev(dev);
285
286 if (!rdev->constraints)
287 return sprintf(buf, "constraint not defined\n");
288
289 return sprintf(buf, "%d\n", rdev->constraints->min_uA);
290}
291
292static ssize_t regulator_max_uA_show(struct device *dev,
293 struct device_attribute *attr, char *buf)
294{
295 struct regulator_dev *rdev = to_rdev(dev);
296
297 if (!rdev->constraints)
298 return sprintf(buf, "constraint not defined\n");
299
300 return sprintf(buf, "%d\n", rdev->constraints->max_uA);
301}
302
303static ssize_t regulator_min_uV_show(struct device *dev,
304 struct device_attribute *attr, char *buf)
305{
306 struct regulator_dev *rdev = to_rdev(dev);
307
308 if (!rdev->constraints)
309 return sprintf(buf, "constraint not defined\n");
310
311 return sprintf(buf, "%d\n", rdev->constraints->min_uV);
312}
313
314static ssize_t regulator_max_uV_show(struct device *dev,
315 struct device_attribute *attr, char *buf)
316{
317 struct regulator_dev *rdev = to_rdev(dev);
318
319 if (!rdev->constraints)
320 return sprintf(buf, "constraint not defined\n");
321
322 return sprintf(buf, "%d\n", rdev->constraints->max_uV);
323}
324
325static ssize_t regulator_total_uA_show(struct device *dev,
326 struct device_attribute *attr, char *buf)
327{
328 struct regulator_dev *rdev = to_rdev(dev);
329 struct regulator *regulator;
330 int uA = 0;
331
332 mutex_lock(&rdev->mutex);
333 list_for_each_entry(regulator, &rdev->consumer_list, list)
334 uA += regulator->uA_load;
335 mutex_unlock(&rdev->mutex);
336 return sprintf(buf, "%d\n", uA);
337}
338
339static ssize_t regulator_num_users_show(struct device *dev,
340 struct device_attribute *attr, char *buf)
341{
342 struct regulator_dev *rdev = to_rdev(dev);
343 return sprintf(buf, "%d\n", rdev->use_count);
344}
345
346static ssize_t regulator_type_show(struct device *dev,
347 struct device_attribute *attr, char *buf)
348{
349 struct regulator_dev *rdev = to_rdev(dev);
350
351 switch (rdev->desc->type) {
352 case REGULATOR_VOLTAGE:
353 return sprintf(buf, "voltage\n");
354 case REGULATOR_CURRENT:
355 return sprintf(buf, "current\n");
356 }
357 return sprintf(buf, "unknown\n");
358}
359
360static ssize_t regulator_suspend_mem_uV_show(struct device *dev,
361 struct device_attribute *attr, char *buf)
362{
363 struct regulator_dev *rdev = to_rdev(dev);
364
365 if (!rdev->constraints)
366 return sprintf(buf, "not defined\n");
367 return sprintf(buf, "%d\n", rdev->constraints->state_mem.uV);
368}
369
370static ssize_t regulator_suspend_disk_uV_show(struct device *dev,
371 struct device_attribute *attr, char *buf)
372{
373 struct regulator_dev *rdev = to_rdev(dev);
374
375 if (!rdev->constraints)
376 return sprintf(buf, "not defined\n");
377 return sprintf(buf, "%d\n", rdev->constraints->state_disk.uV);
378}
379
380static ssize_t regulator_suspend_standby_uV_show(struct device *dev,
381 struct device_attribute *attr, char *buf)
382{
383 struct regulator_dev *rdev = to_rdev(dev);
384
385 if (!rdev->constraints)
386 return sprintf(buf, "not defined\n");
387 return sprintf(buf, "%d\n", rdev->constraints->state_standby.uV);
388}
389
390static ssize_t suspend_opmode_show(struct regulator_dev *rdev,
391 unsigned int mode, char *buf)
392{
393 switch (mode) {
394 case REGULATOR_MODE_FAST:
395 return sprintf(buf, "fast\n");
396 case REGULATOR_MODE_NORMAL:
397 return sprintf(buf, "normal\n");
398 case REGULATOR_MODE_IDLE:
399 return sprintf(buf, "idle\n");
400 case REGULATOR_MODE_STANDBY:
401 return sprintf(buf, "standby\n");
402 }
403 return sprintf(buf, "unknown\n");
404}
405
406static ssize_t regulator_suspend_mem_mode_show(struct device *dev,
407 struct device_attribute *attr, char *buf)
408{
409 struct regulator_dev *rdev = to_rdev(dev);
410
411 if (!rdev->constraints)
412 return sprintf(buf, "not defined\n");
413 return suspend_opmode_show(rdev,
414 rdev->constraints->state_mem.mode, buf);
415}
416
417static ssize_t regulator_suspend_disk_mode_show(struct device *dev,
418 struct device_attribute *attr, char *buf)
419{
420 struct regulator_dev *rdev = to_rdev(dev);
421
422 if (!rdev->constraints)
423 return sprintf(buf, "not defined\n");
424 return suspend_opmode_show(rdev,
425 rdev->constraints->state_disk.mode, buf);
426}
427
428static ssize_t regulator_suspend_standby_mode_show(struct device *dev,
429 struct device_attribute *attr, char *buf)
430{
431 struct regulator_dev *rdev = to_rdev(dev);
432
433 if (!rdev->constraints)
434 return sprintf(buf, "not defined\n");
435 return suspend_opmode_show(rdev,
436 rdev->constraints->state_standby.mode, buf);
437}
438
439static ssize_t regulator_suspend_mem_state_show(struct device *dev,
440 struct device_attribute *attr, char *buf)
441{
442 struct regulator_dev *rdev = to_rdev(dev);
443
444 if (!rdev->constraints)
445 return sprintf(buf, "not defined\n");
446
447 if (rdev->constraints->state_mem.enabled)
448 return sprintf(buf, "enabled\n");
449 else
450 return sprintf(buf, "disabled\n");
451}
452
453static ssize_t regulator_suspend_disk_state_show(struct device *dev,
454 struct device_attribute *attr, char *buf)
455{
456 struct regulator_dev *rdev = to_rdev(dev);
457
458 if (!rdev->constraints)
459 return sprintf(buf, "not defined\n");
460
461 if (rdev->constraints->state_disk.enabled)
462 return sprintf(buf, "enabled\n");
463 else
464 return sprintf(buf, "disabled\n");
465}
466
467static ssize_t regulator_suspend_standby_state_show(struct device *dev,
468 struct device_attribute *attr, char *buf)
469{
470 struct regulator_dev *rdev = to_rdev(dev);
471
472 if (!rdev->constraints)
473 return sprintf(buf, "not defined\n");
474
475 if (rdev->constraints->state_standby.enabled)
476 return sprintf(buf, "enabled\n");
477 else
478 return sprintf(buf, "disabled\n");
479}
480static struct device_attribute regulator_dev_attrs[] = {
481 __ATTR(microvolts, 0444, regulator_uV_show, NULL),
482 __ATTR(microamps, 0444, regulator_uA_show, NULL),
483 __ATTR(opmode, 0444, regulator_opmode_show, NULL),
484 __ATTR(state, 0444, regulator_state_show, NULL),
485 __ATTR(min_microvolts, 0444, regulator_min_uV_show, NULL),
486 __ATTR(min_microamps, 0444, regulator_min_uA_show, NULL),
487 __ATTR(max_microvolts, 0444, regulator_max_uV_show, NULL),
488 __ATTR(max_microamps, 0444, regulator_max_uA_show, NULL),
489 __ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL),
490 __ATTR(num_users, 0444, regulator_num_users_show, NULL),
491 __ATTR(type, 0444, regulator_type_show, NULL),
492 __ATTR(suspend_mem_microvolts, 0444,
493 regulator_suspend_mem_uV_show, NULL),
494 __ATTR(suspend_disk_microvolts, 0444,
495 regulator_suspend_disk_uV_show, NULL),
496 __ATTR(suspend_standby_microvolts, 0444,
497 regulator_suspend_standby_uV_show, NULL),
498 __ATTR(suspend_mem_mode, 0444,
499 regulator_suspend_mem_mode_show, NULL),
500 __ATTR(suspend_disk_mode, 0444,
501 regulator_suspend_disk_mode_show, NULL),
502 __ATTR(suspend_standby_mode, 0444,
503 regulator_suspend_standby_mode_show, NULL),
504 __ATTR(suspend_mem_state, 0444,
505 regulator_suspend_mem_state_show, NULL),
506 __ATTR(suspend_disk_state, 0444,
507 regulator_suspend_disk_state_show, NULL),
508 __ATTR(suspend_standby_state, 0444,
509 regulator_suspend_standby_state_show, NULL),
510 __ATTR_NULL,
511};
512
513static void regulator_dev_release(struct device *dev)
514{
515 struct regulator_dev *rdev = to_rdev(dev);
516 kfree(rdev);
517}
518
519static struct class regulator_class = {
520 .name = "regulator",
521 .dev_release = regulator_dev_release,
522 .dev_attrs = regulator_dev_attrs,
523};
524
525/* Calculate the new optimum regulator operating mode based on the new total
526 * consumer load. All locks held by caller */
527static void drms_uA_update(struct regulator_dev *rdev)
528{
529 struct regulator *sibling;
530 int current_uA = 0, output_uV, input_uV, err;
531 unsigned int mode;
532
533 err = regulator_check_drms(rdev);
534 if (err < 0 || !rdev->desc->ops->get_optimum_mode ||
535 !rdev->desc->ops->get_voltage || !rdev->desc->ops->set_mode);
536 return;
537
538 /* get output voltage */
539 output_uV = rdev->desc->ops->get_voltage(rdev);
540 if (output_uV <= 0)
541 return;
542
543 /* get input voltage */
544 if (rdev->supply && rdev->supply->desc->ops->get_voltage)
545 input_uV = rdev->supply->desc->ops->get_voltage(rdev->supply);
546 else
547 input_uV = rdev->constraints->input_uV;
548 if (input_uV <= 0)
549 return;
550
551 /* calc total requested load */
552 list_for_each_entry(sibling, &rdev->consumer_list, list)
553 current_uA += sibling->uA_load;
554
555 /* now get the optimum mode for our new total regulator load */
556 mode = rdev->desc->ops->get_optimum_mode(rdev, input_uV,
557 output_uV, current_uA);
558
559 /* check the new mode is allowed */
560 err = regulator_check_mode(rdev, mode);
561 if (err == 0)
562 rdev->desc->ops->set_mode(rdev, mode);
563}
564
565static int suspend_set_state(struct regulator_dev *rdev,
566 struct regulator_state *rstate)
567{
568 int ret = 0;
569
570 /* enable & disable are mandatory for suspend control */
571 if (!rdev->desc->ops->set_suspend_enable ||
572 !rdev->desc->ops->set_suspend_disable)
573 return -EINVAL;
574
575 if (rstate->enabled)
576 ret = rdev->desc->ops->set_suspend_enable(rdev);
577 else
578 ret = rdev->desc->ops->set_suspend_disable(rdev);
579 if (ret < 0) {
580 printk(KERN_ERR "%s: failed to enabled/disable\n", __func__);
581 return ret;
582 }
583
584 if (rdev->desc->ops->set_suspend_voltage && rstate->uV > 0) {
585 ret = rdev->desc->ops->set_suspend_voltage(rdev, rstate->uV);
586 if (ret < 0) {
587 printk(KERN_ERR "%s: failed to set voltage\n",
588 __func__);
589 return ret;
590 }
591 }
592
593 if (rdev->desc->ops->set_suspend_mode && rstate->mode > 0) {
594 ret = rdev->desc->ops->set_suspend_mode(rdev, rstate->mode);
595 if (ret < 0) {
596 printk(KERN_ERR "%s: failed to set mode\n", __func__);
597 return ret;
598 }
599 }
600 return ret;
601}
602
603/* locks held by caller */
604static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state)
605{
606 if (!rdev->constraints)
607 return -EINVAL;
608
609 switch (state) {
610 case PM_SUSPEND_STANDBY:
611 return suspend_set_state(rdev,
612 &rdev->constraints->state_standby);
613 case PM_SUSPEND_MEM:
614 return suspend_set_state(rdev,
615 &rdev->constraints->state_mem);
616 case PM_SUSPEND_MAX:
617 return suspend_set_state(rdev,
618 &rdev->constraints->state_disk);
619 default:
620 return -EINVAL;
621 }
622}
623
624static void print_constraints(struct regulator_dev *rdev)
625{
626 struct regulation_constraints *constraints = rdev->constraints;
627 char buf[80];
628 int count;
629
630 if (rdev->desc->type == REGULATOR_VOLTAGE) {
631 if (constraints->min_uV == constraints->max_uV)
632 count = sprintf(buf, "%d mV ",
633 constraints->min_uV / 1000);
634 else
635 count = sprintf(buf, "%d <--> %d mV ",
636 constraints->min_uV / 1000,
637 constraints->max_uV / 1000);
638 } else {
639 if (constraints->min_uA == constraints->max_uA)
640 count = sprintf(buf, "%d mA ",
641 constraints->min_uA / 1000);
642 else
643 count = sprintf(buf, "%d <--> %d mA ",
644 constraints->min_uA / 1000,
645 constraints->max_uA / 1000);
646 }
647 if (constraints->valid_modes_mask & REGULATOR_MODE_FAST)
648 count += sprintf(buf + count, "fast ");
649 if (constraints->valid_modes_mask & REGULATOR_MODE_NORMAL)
650 count += sprintf(buf + count, "normal ");
651 if (constraints->valid_modes_mask & REGULATOR_MODE_IDLE)
652 count += sprintf(buf + count, "idle ");
653 if (constraints->valid_modes_mask & REGULATOR_MODE_STANDBY)
654 count += sprintf(buf + count, "standby");
655
656 printk(KERN_INFO "regulator: %s: %s\n", rdev->desc->name, buf);
657}
658
659#define REG_STR_SIZE 32
660
661static struct regulator *create_regulator(struct regulator_dev *rdev,
662 struct device *dev,
663 const char *supply_name)
664{
665 struct regulator *regulator;
666 char buf[REG_STR_SIZE];
667 int err, size;
668
669 regulator = kzalloc(sizeof(*regulator), GFP_KERNEL);
670 if (regulator == NULL)
671 return NULL;
672
673 mutex_lock(&rdev->mutex);
674 regulator->rdev = rdev;
675 list_add(&regulator->list, &rdev->consumer_list);
676
677 if (dev) {
678 /* create a 'requested_microamps_name' sysfs entry */
679 size = scnprintf(buf, REG_STR_SIZE, "microamps_requested_%s",
680 supply_name);
681 if (size >= REG_STR_SIZE)
682 goto overflow_err;
683
684 regulator->dev = dev;
685 regulator->dev_attr.attr.name = kstrdup(buf, GFP_KERNEL);
686 if (regulator->dev_attr.attr.name == NULL)
687 goto attr_name_err;
688
689 regulator->dev_attr.attr.owner = THIS_MODULE;
690 regulator->dev_attr.attr.mode = 0444;
691 regulator->dev_attr.show = device_requested_uA_show;
692 err = device_create_file(dev, &regulator->dev_attr);
693 if (err < 0) {
694 printk(KERN_WARNING "%s: could not add regulator_dev"
695 " load sysfs\n", __func__);
696 goto attr_name_err;
697 }
698
699 /* also add a link to the device sysfs entry */
700 size = scnprintf(buf, REG_STR_SIZE, "%s-%s",
701 dev->kobj.name, supply_name);
702 if (size >= REG_STR_SIZE)
703 goto attr_err;
704
705 regulator->supply_name = kstrdup(buf, GFP_KERNEL);
706 if (regulator->supply_name == NULL)
707 goto attr_err;
708
709 err = sysfs_create_link(&rdev->dev.kobj, &dev->kobj,
710 buf);
711 if (err) {
712 printk(KERN_WARNING
713 "%s: could not add device link %s err %d\n",
714 __func__, dev->kobj.name, err);
715 device_remove_file(dev, &regulator->dev_attr);
716 goto link_name_err;
717 }
718 }
719 mutex_unlock(&rdev->mutex);
720 return regulator;
721link_name_err:
722 kfree(regulator->supply_name);
723attr_err:
724 device_remove_file(regulator->dev, &regulator->dev_attr);
725attr_name_err:
726 kfree(regulator->dev_attr.attr.name);
727overflow_err:
728 list_del(&regulator->list);
729 kfree(regulator);
730 mutex_unlock(&rdev->mutex);
731 return NULL;
732}
733
734/**
735 * regulator_get - lookup and obtain a reference to a regulator.
736 * @dev: device for regulator "consumer"
737 * @id: Supply name or regulator ID.
738 *
739 * Returns a struct regulator corresponding to the regulator producer,
740 * or IS_ERR() condition containing errno. Use of supply names
741 * configured via regulator_set_device_supply() is strongly
742 * encouraged.
743 */
744struct regulator *regulator_get(struct device *dev, const char *id)
745{
746 struct regulator_dev *rdev;
747 struct regulator_map *map;
748 struct regulator *regulator = ERR_PTR(-ENODEV);
749 const char *supply = id;
750
751 if (id == NULL) {
752 printk(KERN_ERR "regulator: get() with no identifier\n");
753 return regulator;
754 }
755
756 mutex_lock(&regulator_list_mutex);
757
758 list_for_each_entry(map, &regulator_map_list, list) {
759 if (dev == map->dev &&
760 strcmp(map->supply, id) == 0) {
761 supply = map->regulator;
762 break;
763 }
764 }
765
766 list_for_each_entry(rdev, &regulator_list, list) {
767 if (strcmp(supply, rdev->desc->name) == 0 &&
768 try_module_get(rdev->owner))
769 goto found;
770 }
771 printk(KERN_ERR "regulator: Unable to get requested regulator: %s\n",
772 id);
773 mutex_unlock(&regulator_list_mutex);
774 return regulator;
775
776found:
777 regulator = create_regulator(rdev, dev, id);
778 if (regulator == NULL) {
779 regulator = ERR_PTR(-ENOMEM);
780 module_put(rdev->owner);
781 }
782
783 mutex_unlock(&regulator_list_mutex);
784 return regulator;
785}
786EXPORT_SYMBOL_GPL(regulator_get);
787
788/**
789 * regulator_put - "free" the regulator source
790 * @regulator: regulator source
791 *
792 * Note: drivers must ensure that all regulator_enable calls made on this
793 * regulator source are balanced by regulator_disable calls prior to calling
794 * this function.
795 */
796void regulator_put(struct regulator *regulator)
797{
798 struct regulator_dev *rdev;
799
800 if (regulator == NULL || IS_ERR(regulator))
801 return;
802
803 if (regulator->enabled) {
804 printk(KERN_WARNING "Releasing supply %s while enabled\n",
805 regulator->supply_name);
806 WARN_ON(regulator->enabled);
807 regulator_disable(regulator);
808 }
809
810 mutex_lock(&regulator_list_mutex);
811 rdev = regulator->rdev;
812
813 /* remove any sysfs entries */
814 if (regulator->dev) {
815 sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
816 kfree(regulator->supply_name);
817 device_remove_file(regulator->dev, &regulator->dev_attr);
818 kfree(regulator->dev_attr.attr.name);
819 }
820 list_del(&regulator->list);
821 kfree(regulator);
822
823 module_put(rdev->owner);
824 mutex_unlock(&regulator_list_mutex);
825}
826EXPORT_SYMBOL_GPL(regulator_put);
827
828/* locks held by regulator_enable() */
829static int _regulator_enable(struct regulator_dev *rdev)
830{
831 int ret = -EINVAL;
832
833 if (!rdev->constraints) {
834 printk(KERN_ERR "%s: %s has no constraints\n",
835 __func__, rdev->desc->name);
836 return ret;
837 }
838
839 /* do we need to enable the supply regulator first */
840 if (rdev->supply) {
841 ret = _regulator_enable(rdev->supply);
842 if (ret < 0) {
843 printk(KERN_ERR "%s: failed to enable %s: %d\n",
844 __func__, rdev->desc->name, ret);
845 return ret;
846 }
847 }
848
849 /* check voltage and requested load before enabling */
850 if (rdev->desc->ops->enable) {
851
852 if (rdev->constraints &&
853 (rdev->constraints->valid_ops_mask &
854 REGULATOR_CHANGE_DRMS))
855 drms_uA_update(rdev);
856
857 ret = rdev->desc->ops->enable(rdev);
858 if (ret < 0) {
859 printk(KERN_ERR "%s: failed to enable %s: %d\n",
860 __func__, rdev->desc->name, ret);
861 return ret;
862 }
863 rdev->use_count++;
864 return ret;
865 }
866
867 return ret;
868}
869
870/**
871 * regulator_enable - enable regulator output
872 * @regulator: regulator source
873 *
874 * Enable the regulator output at the predefined voltage or current value.
875 * NOTE: the output value can be set by other drivers, boot loader or may be
876 * hardwired in the regulator.
877 * NOTE: calls to regulator_enable() must be balanced with calls to
878 * regulator_disable().
879 */
880int regulator_enable(struct regulator *regulator)
881{
882 int ret;
883
884 if (regulator->enabled) {
885 printk(KERN_CRIT "Regulator %s already enabled\n",
886 regulator->supply_name);
887 WARN_ON(regulator->enabled);
888 return 0;
889 }
890
891 mutex_lock(&regulator->rdev->mutex);
892 regulator->enabled = 1;
893 ret = _regulator_enable(regulator->rdev);
894 if (ret != 0)
895 regulator->enabled = 0;
896 mutex_unlock(&regulator->rdev->mutex);
897 return ret;
898}
899EXPORT_SYMBOL_GPL(regulator_enable);
900
901/* locks held by regulator_disable() */
902static int _regulator_disable(struct regulator_dev *rdev)
903{
904 int ret = 0;
905
906 /* are we the last user and permitted to disable ? */
907 if (rdev->use_count == 1 && !rdev->constraints->always_on) {
908
909 /* we are last user */
910 if (rdev->desc->ops->disable) {
911 ret = rdev->desc->ops->disable(rdev);
912 if (ret < 0) {
913 printk(KERN_ERR "%s: failed to disable %s\n",
914 __func__, rdev->desc->name);
915 return ret;
916 }
917 }
918
919 /* decrease our supplies ref count and disable if required */
920 if (rdev->supply)
921 _regulator_disable(rdev->supply);
922
923 rdev->use_count = 0;
924 } else if (rdev->use_count > 1) {
925
926 if (rdev->constraints &&
927 (rdev->constraints->valid_ops_mask &
928 REGULATOR_CHANGE_DRMS))
929 drms_uA_update(rdev);
930
931 rdev->use_count--;
932 }
933 return ret;
934}
935
936/**
937 * regulator_disable - disable regulator output
938 * @regulator: regulator source
939 *
940 * Disable the regulator output voltage or current.
941 * NOTE: this will only disable the regulator output if no other consumer
942 * devices have it enabled.
943 * NOTE: calls to regulator_enable() must be balanced with calls to
944 * regulator_disable().
945 */
946int regulator_disable(struct regulator *regulator)
947{
948 int ret;
949
950 if (!regulator->enabled) {
951 printk(KERN_ERR "%s: not in use by this consumer\n",
952 __func__);
953 return 0;
954 }
955
956 mutex_lock(&regulator->rdev->mutex);
957 regulator->enabled = 0;
958 regulator->uA_load = 0;
959 ret = _regulator_disable(regulator->rdev);
960 mutex_unlock(&regulator->rdev->mutex);
961 return ret;
962}
963EXPORT_SYMBOL_GPL(regulator_disable);
964
965/* locks held by regulator_force_disable() */
966static int _regulator_force_disable(struct regulator_dev *rdev)
967{
968 int ret = 0;
969
970 /* force disable */
971 if (rdev->desc->ops->disable) {
972 /* ah well, who wants to live forever... */
973 ret = rdev->desc->ops->disable(rdev);
974 if (ret < 0) {
975 printk(KERN_ERR "%s: failed to force disable %s\n",
976 __func__, rdev->desc->name);
977 return ret;
978 }
979 /* notify other consumers that power has been forced off */
980 _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE,
981 NULL);
982 }
983
984 /* decrease our supplies ref count and disable if required */
985 if (rdev->supply)
986 _regulator_disable(rdev->supply);
987
988 rdev->use_count = 0;
989 return ret;
990}
991
992/**
993 * regulator_force_disable - force disable regulator output
994 * @regulator: regulator source
995 *
996 * Forcibly disable the regulator output voltage or current.
997 * NOTE: this *will* disable the regulator output even if other consumer
998 * devices have it enabled. This should be used for situations when device
999 * damage will likely occur if the regulator is not disabled (e.g. over temp).
1000 */
1001int regulator_force_disable(struct regulator *regulator)
1002{
1003 int ret;
1004
1005 mutex_lock(&regulator->rdev->mutex);
1006 regulator->enabled = 0;
1007 regulator->uA_load = 0;
1008 ret = _regulator_force_disable(regulator->rdev);
1009 mutex_unlock(&regulator->rdev->mutex);
1010 return ret;
1011}
1012EXPORT_SYMBOL_GPL(regulator_force_disable);
1013
1014static int _regulator_is_enabled(struct regulator_dev *rdev)
1015{
1016 int ret;
1017
1018 mutex_lock(&rdev->mutex);
1019
1020 /* sanity check */
1021 if (!rdev->desc->ops->is_enabled) {
1022 ret = -EINVAL;
1023 goto out;
1024 }
1025
1026 ret = rdev->desc->ops->is_enabled(rdev);
1027out:
1028 mutex_unlock(&rdev->mutex);
1029 return ret;
1030}
1031
1032/**
1033 * regulator_is_enabled - is the regulator output enabled
1034 * @regulator: regulator source
1035 *
1036 * Returns zero for disabled otherwise return number of enable requests.
1037 */
1038int regulator_is_enabled(struct regulator *regulator)
1039{
1040 return _regulator_is_enabled(regulator->rdev);
1041}
1042EXPORT_SYMBOL_GPL(regulator_is_enabled);
1043
1044/**
1045 * regulator_set_voltage - set regulator output voltage
1046 * @regulator: regulator source
1047 * @min_uV: Minimum required voltage in uV
1048 * @max_uV: Maximum acceptable voltage in uV
1049 *
1050 * Sets a voltage regulator to the desired output voltage. This can be set
1051 * during any regulator state. IOW, regulator can be disabled or enabled.
1052 *
1053 * If the regulator is enabled then the voltage will change to the new value
1054 * immediately otherwise if the regulator is disabled the regulator will
1055 * output at the new voltage when enabled.
1056 *
1057 * NOTE: If the regulator is shared between several devices then the lowest
1058 * request voltage that meets the system constraints will be used.
1059 * NOTE: Regulator system constraints must be set for this regulator before
1060 * calling this function otherwise this call will fail.
1061 */
1062int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV)
1063{
1064 struct regulator_dev *rdev = regulator->rdev;
1065 int ret;
1066
1067 mutex_lock(&rdev->mutex);
1068
1069 /* sanity check */
1070 if (!rdev->desc->ops->set_voltage) {
1071 ret = -EINVAL;
1072 goto out;
1073 }
1074
1075 /* constraints check */
1076 ret = regulator_check_voltage(rdev, &min_uV, &max_uV);
1077 if (ret < 0)
1078 goto out;
1079 regulator->min_uV = min_uV;
1080 regulator->max_uV = max_uV;
1081 ret = rdev->desc->ops->set_voltage(rdev, min_uV, max_uV);
1082
1083out:
1084 mutex_unlock(&rdev->mutex);
1085 return ret;
1086}
1087EXPORT_SYMBOL_GPL(regulator_set_voltage);
1088
1089static int _regulator_get_voltage(struct regulator_dev *rdev)
1090{
1091 /* sanity check */
1092 if (rdev->desc->ops->get_voltage)
1093 return rdev->desc->ops->get_voltage(rdev);
1094 else
1095 return -EINVAL;
1096}
1097
1098/**
1099 * regulator_get_voltage - get regulator output voltage
1100 * @regulator: regulator source
1101 *
1102 * This returns the current regulator voltage in uV.
1103 *
1104 * NOTE: If the regulator is disabled it will return the voltage value. This
1105 * function should not be used to determine regulator state.
1106 */
1107int regulator_get_voltage(struct regulator *regulator)
1108{
1109 int ret;
1110
1111 mutex_lock(&regulator->rdev->mutex);
1112
1113 ret = _regulator_get_voltage(regulator->rdev);
1114
1115 mutex_unlock(&regulator->rdev->mutex);
1116
1117 return ret;
1118}
1119EXPORT_SYMBOL_GPL(regulator_get_voltage);
1120
1121/**
1122 * regulator_set_current_limit - set regulator output current limit
1123 * @regulator: regulator source
1124 * @min_uA: Minimuum supported current in uA
1125 * @max_uA: Maximum supported current in uA
1126 *
1127 * Sets current sink to the desired output current. This can be set during
1128 * any regulator state. IOW, regulator can be disabled or enabled.
1129 *
1130 * If the regulator is enabled then the current will change to the new value
1131 * immediately otherwise if the regulator is disabled the regulator will
1132 * output at the new current when enabled.
1133 *
1134 * NOTE: Regulator system constraints must be set for this regulator before
1135 * calling this function otherwise this call will fail.
1136 */
1137int regulator_set_current_limit(struct regulator *regulator,
1138 int min_uA, int max_uA)
1139{
1140 struct regulator_dev *rdev = regulator->rdev;
1141 int ret;
1142
1143 mutex_lock(&rdev->mutex);
1144
1145 /* sanity check */
1146 if (!rdev->desc->ops->set_current_limit) {
1147 ret = -EINVAL;
1148 goto out;
1149 }
1150
1151 /* constraints check */
1152 ret = regulator_check_current_limit(rdev, &min_uA, &max_uA);
1153 if (ret < 0)
1154 goto out;
1155
1156 ret = rdev->desc->ops->set_current_limit(rdev, min_uA, max_uA);
1157out:
1158 mutex_unlock(&rdev->mutex);
1159 return ret;
1160}
1161EXPORT_SYMBOL_GPL(regulator_set_current_limit);
1162
1163static int _regulator_get_current_limit(struct regulator_dev *rdev)
1164{
1165 int ret;
1166
1167 mutex_lock(&rdev->mutex);
1168
1169 /* sanity check */
1170 if (!rdev->desc->ops->get_current_limit) {
1171 ret = -EINVAL;
1172 goto out;
1173 }
1174
1175 ret = rdev->desc->ops->get_current_limit(rdev);
1176out:
1177 mutex_unlock(&rdev->mutex);
1178 return ret;
1179}
1180
1181/**
1182 * regulator_get_current_limit - get regulator output current
1183 * @regulator: regulator source
1184 *
1185 * This returns the current supplied by the specified current sink in uA.
1186 *
1187 * NOTE: If the regulator is disabled it will return the current value. This
1188 * function should not be used to determine regulator state.
1189 */
1190int regulator_get_current_limit(struct regulator *regulator)
1191{
1192 return _regulator_get_current_limit(regulator->rdev);
1193}
1194EXPORT_SYMBOL_GPL(regulator_get_current_limit);
1195
1196/**
1197 * regulator_set_mode - set regulator operating mode
1198 * @regulator: regulator source
1199 * @mode: operating mode - one of the REGULATOR_MODE constants
1200 *
1201 * Set regulator operating mode to increase regulator efficiency or improve
1202 * regulation performance.
1203 *
1204 * NOTE: Regulator system constraints must be set for this regulator before
1205 * calling this function otherwise this call will fail.
1206 */
1207int regulator_set_mode(struct regulator *regulator, unsigned int mode)
1208{
1209 struct regulator_dev *rdev = regulator->rdev;
1210 int ret;
1211
1212 mutex_lock(&rdev->mutex);
1213
1214 /* sanity check */
1215 if (!rdev->desc->ops->set_mode) {
1216 ret = -EINVAL;
1217 goto out;
1218 }
1219
1220 /* constraints check */
1221 ret = regulator_check_mode(rdev, mode);
1222 if (ret < 0)
1223 goto out;
1224
1225 ret = rdev->desc->ops->set_mode(rdev, mode);
1226out:
1227 mutex_unlock(&rdev->mutex);
1228 return ret;
1229}
1230EXPORT_SYMBOL_GPL(regulator_set_mode);
1231
1232static unsigned int _regulator_get_mode(struct regulator_dev *rdev)
1233{
1234 int ret;
1235
1236 mutex_lock(&rdev->mutex);
1237
1238 /* sanity check */
1239 if (!rdev->desc->ops->get_mode) {
1240 ret = -EINVAL;
1241 goto out;
1242 }
1243
1244 ret = rdev->desc->ops->get_mode(rdev);
1245out:
1246 mutex_unlock(&rdev->mutex);
1247 return ret;
1248}
1249
1250/**
1251 * regulator_get_mode - get regulator operating mode
1252 * @regulator: regulator source
1253 *
1254 * Get the current regulator operating mode.
1255 */
1256unsigned int regulator_get_mode(struct regulator *regulator)
1257{
1258 return _regulator_get_mode(regulator->rdev);
1259}
1260EXPORT_SYMBOL_GPL(regulator_get_mode);
1261
1262/**
1263 * regulator_set_optimum_mode - set regulator optimum operating mode
1264 * @regulator: regulator source
1265 * @uA_load: load current
1266 *
1267 * Notifies the regulator core of a new device load. This is then used by
1268 * DRMS (if enabled by constraints) to set the most efficient regulator
1269 * operating mode for the new regulator loading.
1270 *
1271 * Consumer devices notify their supply regulator of the maximum power
1272 * they will require (can be taken from device datasheet in the power
1273 * consumption tables) when they change operational status and hence power
1274 * state. Examples of operational state changes that can affect power
1275 * consumption are :-
1276 *
1277 * o Device is opened / closed.
1278 * o Device I/O is about to begin or has just finished.
1279 * o Device is idling in between work.
1280 *
1281 * This information is also exported via sysfs to userspace.
1282 *
1283 * DRMS will sum the total requested load on the regulator and change
1284 * to the most efficient operating mode if platform constraints allow.
1285 *
1286 * Returns the new regulator mode or error.
1287 */
1288int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
1289{
1290 struct regulator_dev *rdev = regulator->rdev;
1291 struct regulator *consumer;
1292 int ret, output_uV, input_uV, total_uA_load = 0;
1293 unsigned int mode;
1294
1295 mutex_lock(&rdev->mutex);
1296
1297 regulator->uA_load = uA_load;
1298 ret = regulator_check_drms(rdev);
1299 if (ret < 0)
1300 goto out;
1301 ret = -EINVAL;
1302
1303 /* sanity check */
1304 if (!rdev->desc->ops->get_optimum_mode)
1305 goto out;
1306
1307 /* get output voltage */
1308 output_uV = rdev->desc->ops->get_voltage(rdev);
1309 if (output_uV <= 0) {
1310 printk(KERN_ERR "%s: invalid output voltage found for %s\n",
1311 __func__, rdev->desc->name);
1312 goto out;
1313 }
1314
1315 /* get input voltage */
1316 if (rdev->supply && rdev->supply->desc->ops->get_voltage)
1317 input_uV = rdev->supply->desc->ops->get_voltage(rdev->supply);
1318 else
1319 input_uV = rdev->constraints->input_uV;
1320 if (input_uV <= 0) {
1321 printk(KERN_ERR "%s: invalid input voltage found for %s\n",
1322 __func__, rdev->desc->name);
1323 goto out;
1324 }
1325
1326 /* calc total requested load for this regulator */
1327 list_for_each_entry(consumer, &rdev->consumer_list, list)
1328 total_uA_load += consumer->uA_load;
1329
1330 mode = rdev->desc->ops->get_optimum_mode(rdev,
1331 input_uV, output_uV,
1332 total_uA_load);
1333 if (ret <= 0) {
1334 printk(KERN_ERR "%s: failed to get optimum mode for %s @"
1335 " %d uA %d -> %d uV\n", __func__, rdev->desc->name,
1336 total_uA_load, input_uV, output_uV);
1337 goto out;
1338 }
1339
1340 ret = rdev->desc->ops->set_mode(rdev, mode);
1341 if (ret <= 0) {
1342 printk(KERN_ERR "%s: failed to set optimum mode %x for %s\n",
1343 __func__, mode, rdev->desc->name);
1344 goto out;
1345 }
1346 ret = mode;
1347out:
1348 mutex_unlock(&rdev->mutex);
1349 return ret;
1350}
1351EXPORT_SYMBOL_GPL(regulator_set_optimum_mode);
1352
1353/**
1354 * regulator_register_notifier - register regulator event notifier
1355 * @regulator: regulator source
1356 * @notifier_block: notifier block
1357 *
1358 * Register notifier block to receive regulator events.
1359 */
1360int regulator_register_notifier(struct regulator *regulator,
1361 struct notifier_block *nb)
1362{
1363 return blocking_notifier_chain_register(&regulator->rdev->notifier,
1364 nb);
1365}
1366EXPORT_SYMBOL_GPL(regulator_register_notifier);
1367
1368/**
1369 * regulator_unregister_notifier - unregister regulator event notifier
1370 * @regulator: regulator source
1371 * @notifier_block: notifier block
1372 *
1373 * Unregister regulator event notifier block.
1374 */
1375int regulator_unregister_notifier(struct regulator *regulator,
1376 struct notifier_block *nb)
1377{
1378 return blocking_notifier_chain_unregister(&regulator->rdev->notifier,
1379 nb);
1380}
1381EXPORT_SYMBOL_GPL(regulator_unregister_notifier);
1382
1383/* notify regulator consumers and downstream regulator consumers */
1384static void _notifier_call_chain(struct regulator_dev *rdev,
1385 unsigned long event, void *data)
1386{
1387 struct regulator_dev *_rdev;
1388
1389 /* call rdev chain first */
1390 mutex_lock(&rdev->mutex);
1391 blocking_notifier_call_chain(&rdev->notifier, event, NULL);
1392 mutex_unlock(&rdev->mutex);
1393
1394 /* now notify regulator we supply */
1395 list_for_each_entry(_rdev, &rdev->supply_list, slist)
1396 _notifier_call_chain(_rdev, event, data);
1397}
1398
1399/**
1400 * regulator_bulk_get - get multiple regulator consumers
1401 *
1402 * @dev: Device to supply
1403 * @num_consumers: Number of consumers to register
1404 * @consumers: Configuration of consumers; clients are stored here.
1405 *
1406 * @return 0 on success, an errno on failure.
1407 *
1408 * This helper function allows drivers to get several regulator
1409 * consumers in one operation. If any of the regulators cannot be
1410 * acquired then any regulators that were allocated will be freed
1411 * before returning to the caller.
1412 */
1413int regulator_bulk_get(struct device *dev, int num_consumers,
1414 struct regulator_bulk_data *consumers)
1415{
1416 int i;
1417 int ret;
1418
1419 for (i = 0; i < num_consumers; i++)
1420 consumers[i].consumer = NULL;
1421
1422 for (i = 0; i < num_consumers; i++) {
1423 consumers[i].consumer = regulator_get(dev,
1424 consumers[i].supply);
1425 if (IS_ERR(consumers[i].consumer)) {
1426 dev_err(dev, "Failed to get supply '%s'\n",
1427 consumers[i].supply);
1428 ret = PTR_ERR(consumers[i].consumer);
1429 consumers[i].consumer = NULL;
1430 goto err;
1431 }
1432 }
1433
1434 return 0;
1435
1436err:
1437 for (i = 0; i < num_consumers && consumers[i].consumer; i++)
1438 regulator_put(consumers[i].consumer);
1439
1440 return ret;
1441}
1442EXPORT_SYMBOL_GPL(regulator_bulk_get);
1443
1444/**
1445 * regulator_bulk_enable - enable multiple regulator consumers
1446 *
1447 * @num_consumers: Number of consumers
1448 * @consumers: Consumer data; clients are stored here.
1449 * @return 0 on success, an errno on failure
1450 *
1451 * This convenience API allows consumers to enable multiple regulator
1452 * clients in a single API call. If any consumers cannot be enabled
1453 * then any others that were enabled will be disabled again prior to
1454 * return.
1455 */
1456int regulator_bulk_enable(int num_consumers,
1457 struct regulator_bulk_data *consumers)
1458{
1459 int i;
1460 int ret;
1461
1462 for (i = 0; i < num_consumers; i++) {
1463 ret = regulator_enable(consumers[i].consumer);
1464 if (ret != 0)
1465 goto err;
1466 }
1467
1468 return 0;
1469
1470err:
1471 printk(KERN_ERR "Failed to enable %s\n", consumers[i].supply);
1472 for (i = 0; i < num_consumers; i++)
1473 regulator_disable(consumers[i].consumer);
1474
1475 return ret;
1476}
1477EXPORT_SYMBOL_GPL(regulator_bulk_enable);
1478
1479/**
1480 * regulator_bulk_disable - disable multiple regulator consumers
1481 *
1482 * @num_consumers: Number of consumers
1483 * @consumers: Consumer data; clients are stored here.
1484 * @return 0 on success, an errno on failure
1485 *
1486 * This convenience API allows consumers to disable multiple regulator
1487 * clients in a single API call. If any consumers cannot be enabled
1488 * then any others that were disabled will be disabled again prior to
1489 * return.
1490 */
1491int regulator_bulk_disable(int num_consumers,
1492 struct regulator_bulk_data *consumers)
1493{
1494 int i;
1495 int ret;
1496
1497 for (i = 0; i < num_consumers; i++) {
1498 ret = regulator_disable(consumers[i].consumer);
1499 if (ret != 0)
1500 goto err;
1501 }
1502
1503 return 0;
1504
1505err:
1506 printk(KERN_ERR "Failed to disable %s\n", consumers[i].supply);
1507 for (i = 0; i < num_consumers; i++)
1508 regulator_enable(consumers[i].consumer);
1509
1510 return ret;
1511}
1512EXPORT_SYMBOL_GPL(regulator_bulk_disable);
1513
1514/**
1515 * regulator_bulk_free - free multiple regulator consumers
1516 *
1517 * @num_consumers: Number of consumers
1518 * @consumers: Consumer data; clients are stored here.
1519 *
1520 * This convenience API allows consumers to free multiple regulator
1521 * clients in a single API call.
1522 */
1523void regulator_bulk_free(int num_consumers,
1524 struct regulator_bulk_data *consumers)
1525{
1526 int i;
1527
1528 for (i = 0; i < num_consumers; i++) {
1529 regulator_put(consumers[i].consumer);
1530 consumers[i].consumer = NULL;
1531 }
1532}
1533EXPORT_SYMBOL_GPL(regulator_bulk_free);
1534
1535/**
1536 * regulator_notifier_call_chain - call regulator event notifier
1537 * @regulator: regulator source
1538 * @event: notifier block
1539 * @data:
1540 *
1541 * Called by regulator drivers to notify clients a regulator event has
1542 * occurred. We also notify regulator clients downstream.
1543 */
1544int regulator_notifier_call_chain(struct regulator_dev *rdev,
1545 unsigned long event, void *data)
1546{
1547 _notifier_call_chain(rdev, event, data);
1548 return NOTIFY_DONE;
1549
1550}
1551EXPORT_SYMBOL_GPL(regulator_notifier_call_chain);
1552
1553/**
1554 * regulator_register - register regulator
1555 * @regulator: regulator source
1556 * @reg_data: private regulator data
1557 *
1558 * Called by regulator drivers to register a regulator.
1559 * Returns 0 on success.
1560 */
1561struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
1562 void *reg_data)
1563{
1564 static atomic_t regulator_no = ATOMIC_INIT(0);
1565 struct regulator_dev *rdev;
1566 int ret;
1567
1568 if (regulator_desc == NULL)
1569 return ERR_PTR(-EINVAL);
1570
1571 if (regulator_desc->name == NULL || regulator_desc->ops == NULL)
1572 return ERR_PTR(-EINVAL);
1573
1574 if (!regulator_desc->type == REGULATOR_VOLTAGE &&
1575 !regulator_desc->type == REGULATOR_CURRENT)
1576 return ERR_PTR(-EINVAL);
1577
1578 rdev = kzalloc(sizeof(struct regulator_dev), GFP_KERNEL);
1579 if (rdev == NULL)
1580 return ERR_PTR(-ENOMEM);
1581
1582 mutex_lock(&regulator_list_mutex);
1583
1584 mutex_init(&rdev->mutex);
1585 rdev->reg_data = reg_data;
1586 rdev->owner = regulator_desc->owner;
1587 rdev->desc = regulator_desc;
1588 INIT_LIST_HEAD(&rdev->consumer_list);
1589 INIT_LIST_HEAD(&rdev->supply_list);
1590 INIT_LIST_HEAD(&rdev->list);
1591 INIT_LIST_HEAD(&rdev->slist);
1592 BLOCKING_INIT_NOTIFIER_HEAD(&rdev->notifier);
1593
1594 rdev->dev.class = &regulator_class;
1595 device_initialize(&rdev->dev);
1596 snprintf(rdev->dev.bus_id, sizeof(rdev->dev.bus_id),
1597 "regulator_%ld_%s",
1598 (unsigned long)atomic_inc_return(&regulator_no) - 1,
1599 regulator_desc->name);
1600
1601 ret = device_add(&rdev->dev);
1602 if (ret == 0)
1603 list_add(&rdev->list, &regulator_list);
1604 else {
1605 kfree(rdev);
1606 rdev = ERR_PTR(ret);
1607 }
1608 mutex_unlock(&regulator_list_mutex);
1609 return rdev;
1610}
1611EXPORT_SYMBOL_GPL(regulator_register);
1612
1613/**
1614 * regulator_unregister - unregister regulator
1615 * @regulator: regulator source
1616 *
1617 * Called by regulator drivers to unregister a regulator.
1618 */
1619void regulator_unregister(struct regulator_dev *rdev)
1620{
1621 if (rdev == NULL)
1622 return;
1623
1624 mutex_lock(&regulator_list_mutex);
1625 list_del(&rdev->list);
1626 if (rdev->supply)
1627 sysfs_remove_link(&rdev->dev.kobj, "supply");
1628 device_unregister(&rdev->dev);
1629 mutex_unlock(&regulator_list_mutex);
1630}
1631EXPORT_SYMBOL_GPL(regulator_unregister);
1632
1633/**
1634 * regulator_set_supply - set regulator supply regulator
1635 * @regulator: regulator name
1636 * @supply: supply regulator name
1637 *
1638 * Called by platform initialisation code to set the supply regulator for this
1639 * regulator. This ensures that a regulators supply will also be enabled by the
1640 * core if it's child is enabled.
1641 */
1642int regulator_set_supply(const char *regulator, const char *supply)
1643{
1644 struct regulator_dev *rdev, *supply_rdev;
1645 int err;
1646
1647 if (regulator == NULL || supply == NULL)
1648 return -EINVAL;
1649
1650 mutex_lock(&regulator_list_mutex);
1651
1652 list_for_each_entry(rdev, &regulator_list, list) {
1653 if (!strcmp(rdev->desc->name, regulator))
1654 goto found_regulator;
1655 }
1656 mutex_unlock(&regulator_list_mutex);
1657 return -ENODEV;
1658
1659found_regulator:
1660 list_for_each_entry(supply_rdev, &regulator_list, list) {
1661 if (!strcmp(supply_rdev->desc->name, supply))
1662 goto found_supply;
1663 }
1664 mutex_unlock(&regulator_list_mutex);
1665 return -ENODEV;
1666
1667found_supply:
1668 err = sysfs_create_link(&rdev->dev.kobj, &supply_rdev->dev.kobj,
1669 "supply");
1670 if (err) {
1671 printk(KERN_ERR
1672 "%s: could not add device link %s err %d\n",
1673 __func__, supply_rdev->dev.kobj.name, err);
1674 goto out;
1675 }
1676 rdev->supply = supply_rdev;
1677 list_add(&rdev->slist, &supply_rdev->supply_list);
1678out:
1679 mutex_unlock(&regulator_list_mutex);
1680 return err;
1681}
1682EXPORT_SYMBOL_GPL(regulator_set_supply);
1683
1684/**
1685 * regulator_get_supply - get regulator supply regulator
1686 * @regulator: regulator name
1687 *
1688 * Returns the supply supply regulator name or NULL if no supply regulator
1689 * exists (i.e the regulator is supplied directly from USB, Line, Battery, etc)
1690 */
1691const char *regulator_get_supply(const char *regulator)
1692{
1693 struct regulator_dev *rdev;
1694
1695 if (regulator == NULL)
1696 return NULL;
1697
1698 mutex_lock(&regulator_list_mutex);
1699 list_for_each_entry(rdev, &regulator_list, list) {
1700 if (!strcmp(rdev->desc->name, regulator))
1701 goto found;
1702 }
1703 mutex_unlock(&regulator_list_mutex);
1704 return NULL;
1705
1706found:
1707 mutex_unlock(&regulator_list_mutex);
1708 if (rdev->supply)
1709 return rdev->supply->desc->name;
1710 else
1711 return NULL;
1712}
1713EXPORT_SYMBOL_GPL(regulator_get_supply);
1714
1715/**
1716 * regulator_set_machine_constraints - sets regulator constraints
1717 * @regulator: regulator source
1718 *
1719 * Allows platform initialisation code to define and constrain
1720 * regulator circuits e.g. valid voltage/current ranges, etc. NOTE:
1721 * Constraints *must* be set by platform code in order for some
1722 * regulator operations to proceed i.e. set_voltage, set_current_limit,
1723 * set_mode.
1724 */
1725int regulator_set_machine_constraints(const char *regulator_name,
1726 struct regulation_constraints *constraints)
1727{
1728 struct regulator_dev *rdev;
1729 int ret = 0;
1730
1731 if (regulator_name == NULL)
1732 return -EINVAL;
1733
1734 mutex_lock(&regulator_list_mutex);
1735
1736 list_for_each_entry(rdev, &regulator_list, list) {
1737 if (!strcmp(regulator_name, rdev->desc->name))
1738 goto found;
1739 }
1740 ret = -ENODEV;
1741 goto out;
1742
1743found:
1744 mutex_lock(&rdev->mutex);
1745 rdev->constraints = constraints;
1746
1747 /* do we need to apply the constraint voltage */
1748 if (rdev->constraints->apply_uV &&
1749 rdev->constraints->min_uV == rdev->constraints->max_uV &&
1750 rdev->desc->ops->set_voltage) {
1751 ret = rdev->desc->ops->set_voltage(rdev,
1752 rdev->constraints->min_uV, rdev->constraints->max_uV);
1753 if (ret < 0) {
1754 printk(KERN_ERR "%s: failed to apply %duV"
1755 " constraint\n", __func__,
1756 rdev->constraints->min_uV);
1757 rdev->constraints = NULL;
1758 goto out;
1759 }
1760 }
1761
1762 /* are we enabled at boot time by firmware / bootloader */
1763 if (rdev->constraints->boot_on)
1764 rdev->use_count = 1;
1765
1766 /* do we need to setup our suspend state */
1767 if (constraints->initial_state)
1768 ret = suspend_prepare(rdev, constraints->initial_state);
1769
1770 print_constraints(rdev);
1771 mutex_unlock(&rdev->mutex);
1772
1773out:
1774 mutex_unlock(&regulator_list_mutex);
1775 return ret;
1776}
1777EXPORT_SYMBOL_GPL(regulator_set_machine_constraints);
1778
1779
1780/**
1781 * regulator_set_device_supply: Bind a regulator to a symbolic supply
1782 * @regulator: regulator source
1783 * @dev: device the supply applies to
1784 * @supply: symbolic name for supply
1785 *
1786 * Allows platform initialisation code to map physical regulator
1787 * sources to symbolic names for supplies for use by devices. Devices
1788 * should use these symbolic names to request regulators, avoiding the
1789 * need to provide board-specific regulator names as platform data.
1790 */
1791int regulator_set_device_supply(const char *regulator, struct device *dev,
1792 const char *supply)
1793{
1794 struct regulator_map *node;
1795
1796 if (regulator == NULL || supply == NULL)
1797 return -EINVAL;
1798
1799 node = kmalloc(sizeof(struct regulator_map), GFP_KERNEL);
1800 if (node == NULL)
1801 return -ENOMEM;
1802
1803 node->regulator = regulator;
1804 node->dev = dev;
1805 node->supply = supply;
1806
1807 mutex_lock(&regulator_list_mutex);
1808 list_add(&node->list, &regulator_map_list);
1809 mutex_unlock(&regulator_list_mutex);
1810 return 0;
1811}
1812EXPORT_SYMBOL_GPL(regulator_set_device_supply);
1813
1814/**
1815 * regulator_suspend_prepare: prepare regulators for system wide suspend
1816 * @state: system suspend state
1817 *
1818 * Configure each regulator with it's suspend operating parameters for state.
1819 * This will usually be called by machine suspend code prior to supending.
1820 */
1821int regulator_suspend_prepare(suspend_state_t state)
1822{
1823 struct regulator_dev *rdev;
1824 int ret = 0;
1825
1826 /* ON is handled by regulator active state */
1827 if (state == PM_SUSPEND_ON)
1828 return -EINVAL;
1829
1830 mutex_lock(&regulator_list_mutex);
1831 list_for_each_entry(rdev, &regulator_list, list) {
1832
1833 mutex_lock(&rdev->mutex);
1834 ret = suspend_prepare(rdev, state);
1835 mutex_unlock(&rdev->mutex);
1836
1837 if (ret < 0) {
1838 printk(KERN_ERR "%s: failed to prepare %s\n",
1839 __func__, rdev->desc->name);
1840 goto out;
1841 }
1842 }
1843out:
1844 mutex_unlock(&regulator_list_mutex);
1845 return ret;
1846}
1847EXPORT_SYMBOL_GPL(regulator_suspend_prepare);
1848
1849/**
1850 * rdev_get_drvdata - get rdev regulator driver data
1851 * @regulator: regulator
1852 *
1853 * Get rdev regulator driver private data. This call can be used in the
1854 * regulator driver context.
1855 */
1856void *rdev_get_drvdata(struct regulator_dev *rdev)
1857{
1858 return rdev->reg_data;
1859}
1860EXPORT_SYMBOL_GPL(rdev_get_drvdata);
1861
1862/**
1863 * regulator_get_drvdata - get regulator driver data
1864 * @regulator: regulator
1865 *
1866 * Get regulator driver private data. This call can be used in the consumer
1867 * driver context when non API regulator specific functions need to be called.
1868 */
1869void *regulator_get_drvdata(struct regulator *regulator)
1870{
1871 return regulator->rdev->reg_data;
1872}
1873EXPORT_SYMBOL_GPL(regulator_get_drvdata);
1874
1875/**
1876 * regulator_set_drvdata - set regulator driver data
1877 * @regulator: regulator
1878 * @data: data
1879 */
1880void regulator_set_drvdata(struct regulator *regulator, void *data)
1881{
1882 regulator->rdev->reg_data = data;
1883}
1884EXPORT_SYMBOL_GPL(regulator_set_drvdata);
1885
1886/**
1887 * regulator_get_id - get regulator ID
1888 * @regulator: regulator
1889 */
1890int rdev_get_id(struct regulator_dev *rdev)
1891{
1892 return rdev->desc->id;
1893}
1894EXPORT_SYMBOL_GPL(rdev_get_id);
1895
1896static int __init regulator_init(void)
1897{
1898 printk(KERN_INFO "regulator: core version %s\n", REGULATOR_VERSION);
1899 return class_register(&regulator_class);
1900}
1901
1902/* init early to allow our consumers to complete system booting */
1903core_initcall(regulator_init);
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
new file mode 100644
index 000000000000..d31db3e14913
--- /dev/null
+++ b/drivers/regulator/fixed.c
@@ -0,0 +1,129 @@
1/*
2 * fixed.c
3 *
4 * Copyright 2008 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
12 *
13 * This is useful for systems with mixed controllable and
14 * non-controllable regulators, as well as for allowing testing on
15 * systems with no controllable regulators.
16 */
17
18#include <linux/err.h>
19#include <linux/mutex.h>
20#include <linux/platform_device.h>
21#include <linux/regulator/driver.h>
22#include <linux/regulator/fixed.h>
23
24struct fixed_voltage_data {
25 struct regulator_desc desc;
26 struct regulator_dev *dev;
27 int microvolts;
28};
29
30static int fixed_voltage_is_enabled(struct regulator_dev *dev)
31{
32 return 1;
33}
34
35static int fixed_voltage_enable(struct regulator_dev *dev)
36{
37 return 0;
38}
39
40static int fixed_voltage_get_voltage(struct regulator_dev *dev)
41{
42 struct fixed_voltage_data *data = rdev_get_drvdata(dev);
43
44 return data->microvolts;
45}
46
47static struct regulator_ops fixed_voltage_ops = {
48 .is_enabled = fixed_voltage_is_enabled,
49 .enable = fixed_voltage_enable,
50 .get_voltage = fixed_voltage_get_voltage,
51};
52
53static int regulator_fixed_voltage_probe(struct platform_device *pdev)
54{
55 struct fixed_voltage_config *config = pdev->dev.platform_data;
56 struct fixed_voltage_data *drvdata;
57 int ret;
58
59 drvdata = kzalloc(sizeof(struct fixed_voltage_data), GFP_KERNEL);
60 if (drvdata == NULL) {
61 ret = -ENOMEM;
62 goto err;
63 }
64
65 drvdata->desc.name = kstrdup(config->supply_name, GFP_KERNEL);
66 if (drvdata->desc.name == NULL) {
67 ret = -ENOMEM;
68 goto err;
69 }
70 drvdata->desc.type = REGULATOR_VOLTAGE;
71 drvdata->desc.owner = THIS_MODULE;
72 drvdata->desc.ops = &fixed_voltage_ops,
73
74 drvdata->microvolts = config->microvolts;
75
76 drvdata->dev = regulator_register(&drvdata->desc, drvdata);
77 if (IS_ERR(drvdata->dev)) {
78 ret = PTR_ERR(drvdata->dev);
79 goto err_name;
80 }
81
82 platform_set_drvdata(pdev, drvdata);
83
84 dev_dbg(&pdev->dev, "%s supplying %duV\n", drvdata->desc.name,
85 drvdata->microvolts);
86
87 return 0;
88
89err_name:
90 kfree(drvdata->desc.name);
91err:
92 kfree(drvdata);
93 return ret;
94}
95
96static int regulator_fixed_voltage_remove(struct platform_device *pdev)
97{
98 struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
99
100 regulator_unregister(drvdata->dev);
101 kfree(drvdata->desc.name);
102 kfree(drvdata);
103
104 return 0;
105}
106
107static struct platform_driver regulator_fixed_voltage_driver = {
108 .probe = regulator_fixed_voltage_probe,
109 .remove = regulator_fixed_voltage_remove,
110 .driver = {
111 .name = "reg-fixed-voltage",
112 },
113};
114
115static int __init regulator_fixed_voltage_init(void)
116{
117 return platform_driver_register(&regulator_fixed_voltage_driver);
118}
119module_init(regulator_fixed_voltage_init);
120
121static void __exit regulator_fixed_voltage_exit(void)
122{
123 platform_driver_unregister(&regulator_fixed_voltage_driver);
124}
125module_exit(regulator_fixed_voltage_exit);
126
127MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
128MODULE_DESCRIPTION("Fixed voltage regulator");
129MODULE_LICENSE("GPL");
diff --git a/drivers/regulator/virtual.c b/drivers/regulator/virtual.c
new file mode 100644
index 000000000000..5ddb464b1c3f
--- /dev/null
+++ b/drivers/regulator/virtual.c
@@ -0,0 +1,345 @@
1/*
2 * reg-virtual-consumer.c
3 *
4 * Copyright 2008 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
12 */
13
14#include <linux/err.h>
15#include <linux/mutex.h>
16#include <linux/platform_device.h>
17#include <linux/regulator/consumer.h>
18
19struct virtual_consumer_data {
20 struct mutex lock;
21 struct regulator *regulator;
22 int enabled;
23 int min_uV;
24 int max_uV;
25 int min_uA;
26 int max_uA;
27 unsigned int mode;
28};
29
30static void update_voltage_constraints(struct virtual_consumer_data *data)
31{
32 int ret;
33
34 if (data->min_uV && data->max_uV
35 && data->min_uV <= data->max_uV) {
36 ret = regulator_set_voltage(data->regulator,
37 data->min_uV, data->max_uV);
38 if (ret != 0) {
39 printk(KERN_ERR "regulator_set_voltage() failed: %d\n",
40 ret);
41 return;
42 }
43 }
44
45 if (data->min_uV && data->max_uV && !data->enabled) {
46 ret = regulator_enable(data->regulator);
47 if (ret == 0)
48 data->enabled = 1;
49 else
50 printk(KERN_ERR "regulator_enable() failed: %d\n",
51 ret);
52 }
53
54 if (!(data->min_uV && data->max_uV) && data->enabled) {
55 ret = regulator_disable(data->regulator);
56 if (ret == 0)
57 data->enabled = 0;
58 else
59 printk(KERN_ERR "regulator_disable() failed: %d\n",
60 ret);
61 }
62}
63
64static void update_current_limit_constraints(struct virtual_consumer_data
65 *data)
66{
67 int ret;
68
69 if (data->max_uA
70 && data->min_uA <= data->max_uA) {
71 ret = regulator_set_current_limit(data->regulator,
72 data->min_uA, data->max_uA);
73 if (ret != 0) {
74 pr_err("regulator_set_current_limit() failed: %d\n",
75 ret);
76 return;
77 }
78 }
79
80 if (data->max_uA && !data->enabled) {
81 ret = regulator_enable(data->regulator);
82 if (ret == 0)
83 data->enabled = 1;
84 else
85 printk(KERN_ERR "regulator_enable() failed: %d\n",
86 ret);
87 }
88
89 if (!(data->min_uA && data->max_uA) && data->enabled) {
90 ret = regulator_disable(data->regulator);
91 if (ret == 0)
92 data->enabled = 0;
93 else
94 printk(KERN_ERR "regulator_disable() failed: %d\n",
95 ret);
96 }
97}
98
99static ssize_t show_min_uV(struct device *dev,
100 struct device_attribute *attr, char *buf)
101{
102 struct virtual_consumer_data *data = dev_get_drvdata(dev);
103 return sprintf(buf, "%d\n", data->min_uV);
104}
105
106static ssize_t set_min_uV(struct device *dev, struct device_attribute *attr,
107 const char *buf, size_t count)
108{
109 struct virtual_consumer_data *data = dev_get_drvdata(dev);
110 long val;
111
112 if (strict_strtol(buf, 10, &val) != 0)
113 return count;
114
115 mutex_lock(&data->lock);
116
117 data->min_uV = val;
118 update_voltage_constraints(data);
119
120 mutex_unlock(&data->lock);
121
122 return count;
123}
124
125static ssize_t show_max_uV(struct device *dev,
126 struct device_attribute *attr, char *buf)
127{
128 struct virtual_consumer_data *data = dev_get_drvdata(dev);
129 return sprintf(buf, "%d\n", data->max_uV);
130}
131
132static ssize_t set_max_uV(struct device *dev, struct device_attribute *attr,
133 const char *buf, size_t count)
134{
135 struct virtual_consumer_data *data = dev_get_drvdata(dev);
136 long val;
137
138 if (strict_strtol(buf, 10, &val) != 0)
139 return count;
140
141 mutex_lock(&data->lock);
142
143 data->max_uV = val;
144 update_voltage_constraints(data);
145
146 mutex_unlock(&data->lock);
147
148 return count;
149}
150
151static ssize_t show_min_uA(struct device *dev,
152 struct device_attribute *attr, char *buf)
153{
154 struct virtual_consumer_data *data = dev_get_drvdata(dev);
155 return sprintf(buf, "%d\n", data->min_uA);
156}
157
158static ssize_t set_min_uA(struct device *dev, struct device_attribute *attr,
159 const char *buf, size_t count)
160{
161 struct virtual_consumer_data *data = dev_get_drvdata(dev);
162 long val;
163
164 if (strict_strtol(buf, 10, &val) != 0)
165 return count;
166
167 mutex_lock(&data->lock);
168
169 data->min_uA = val;
170 update_current_limit_constraints(data);
171
172 mutex_unlock(&data->lock);
173
174 return count;
175}
176
177static ssize_t show_max_uA(struct device *dev,
178 struct device_attribute *attr, char *buf)
179{
180 struct virtual_consumer_data *data = dev_get_drvdata(dev);
181 return sprintf(buf, "%d\n", data->max_uA);
182}
183
184static ssize_t set_max_uA(struct device *dev, struct device_attribute *attr,
185 const char *buf, size_t count)
186{
187 struct virtual_consumer_data *data = dev_get_drvdata(dev);
188 long val;
189
190 if (strict_strtol(buf, 10, &val) != 0)
191 return count;
192
193 mutex_lock(&data->lock);
194
195 data->max_uA = val;
196 update_current_limit_constraints(data);
197
198 mutex_unlock(&data->lock);
199
200 return count;
201}
202
203static ssize_t show_mode(struct device *dev,
204 struct device_attribute *attr, char *buf)
205{
206 struct virtual_consumer_data *data = dev_get_drvdata(dev);
207
208 switch (data->mode) {
209 case REGULATOR_MODE_FAST:
210 return sprintf(buf, "fast\n");
211 case REGULATOR_MODE_NORMAL:
212 return sprintf(buf, "normal\n");
213 case REGULATOR_MODE_IDLE:
214 return sprintf(buf, "idle\n");
215 case REGULATOR_MODE_STANDBY:
216 return sprintf(buf, "standby\n");
217 default:
218 return sprintf(buf, "unknown\n");
219 }
220}
221
222static ssize_t set_mode(struct device *dev, struct device_attribute *attr,
223 const char *buf, size_t count)
224{
225 struct virtual_consumer_data *data = dev_get_drvdata(dev);
226 unsigned int mode;
227 int ret;
228
229 if (strncmp(buf, "fast", strlen("fast")) == 0)
230 mode = REGULATOR_MODE_FAST;
231 else if (strncmp(buf, "normal", strlen("normal")) == 0)
232 mode = REGULATOR_MODE_NORMAL;
233 else if (strncmp(buf, "idle", strlen("idle")) == 0)
234 mode = REGULATOR_MODE_IDLE;
235 else if (strncmp(buf, "standby", strlen("standby")) == 0)
236 mode = REGULATOR_MODE_STANDBY;
237 else {
238 dev_err(dev, "Configuring invalid mode\n");
239 return count;
240 }
241
242 mutex_lock(&data->lock);
243 ret = regulator_set_mode(data->regulator, mode);
244 if (ret == 0)
245 data->mode = mode;
246 else
247 dev_err(dev, "Failed to configure mode: %d\n", ret);
248 mutex_unlock(&data->lock);
249
250 return count;
251}
252
253static DEVICE_ATTR(min_microvolts, 0666, show_min_uV, set_min_uV);
254static DEVICE_ATTR(max_microvolts, 0666, show_max_uV, set_max_uV);
255static DEVICE_ATTR(min_microamps, 0666, show_min_uA, set_min_uA);
256static DEVICE_ATTR(max_microamps, 0666, show_max_uA, set_max_uA);
257static DEVICE_ATTR(mode, 0666, show_mode, set_mode);
258
259struct device_attribute *attributes[] = {
260 &dev_attr_min_microvolts,
261 &dev_attr_max_microvolts,
262 &dev_attr_min_microamps,
263 &dev_attr_max_microamps,
264 &dev_attr_mode,
265};
266
267static int regulator_virtual_consumer_probe(struct platform_device *pdev)
268{
269 char *reg_id = pdev->dev.platform_data;
270 struct virtual_consumer_data *drvdata;
271 int ret, i;
272
273 drvdata = kzalloc(sizeof(struct virtual_consumer_data), GFP_KERNEL);
274 if (drvdata == NULL) {
275 ret = -ENOMEM;
276 goto err;
277 }
278
279 mutex_init(&drvdata->lock);
280
281 drvdata->regulator = regulator_get(&pdev->dev, reg_id);
282 if (IS_ERR(drvdata->regulator)) {
283 ret = PTR_ERR(drvdata->regulator);
284 goto err;
285 }
286
287 for (i = 0; i < ARRAY_SIZE(attributes); i++) {
288 ret = device_create_file(&pdev->dev, attributes[i]);
289 if (ret != 0)
290 goto err;
291 }
292
293 drvdata->mode = regulator_get_mode(drvdata->regulator);
294
295 platform_set_drvdata(pdev, drvdata);
296
297 return 0;
298
299err:
300 for (i = 0; i < ARRAY_SIZE(attributes); i++)
301 device_remove_file(&pdev->dev, attributes[i]);
302 kfree(drvdata);
303 return ret;
304}
305
306static int regulator_virtual_consumer_remove(struct platform_device *pdev)
307{
308 struct virtual_consumer_data *drvdata = platform_get_drvdata(pdev);
309 int i;
310
311 for (i = 0; i < ARRAY_SIZE(attributes); i++)
312 device_remove_file(&pdev->dev, attributes[i]);
313 if (drvdata->enabled)
314 regulator_disable(drvdata->regulator);
315 regulator_put(drvdata->regulator);
316
317 kfree(drvdata);
318
319 return 0;
320}
321
322static struct platform_driver regulator_virtual_consumer_driver = {
323 .probe = regulator_virtual_consumer_probe,
324 .remove = regulator_virtual_consumer_remove,
325 .driver = {
326 .name = "reg-virt-consumer",
327 },
328};
329
330
331static int __init regulator_virtual_consumer_init(void)
332{
333 return platform_driver_register(&regulator_virtual_consumer_driver);
334}
335module_init(regulator_virtual_consumer_init);
336
337static void __exit regulator_virtual_consumer_exit(void)
338{
339 platform_driver_unregister(&regulator_virtual_consumer_driver);
340}
341module_exit(regulator_virtual_consumer_exit);
342
343MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
344MODULE_DESCRIPTION("Virtual regulator consumer");
345MODULE_LICENSE("GPL");
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index d397fa5f3a91..7af60b98d8a4 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -20,7 +20,7 @@ int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm)
20 20
21 err = mutex_lock_interruptible(&rtc->ops_lock); 21 err = mutex_lock_interruptible(&rtc->ops_lock);
22 if (err) 22 if (err)
23 return -EBUSY; 23 return err;
24 24
25 if (!rtc->ops) 25 if (!rtc->ops)
26 err = -ENODEV; 26 err = -ENODEV;
@@ -46,7 +46,7 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
46 46
47 err = mutex_lock_interruptible(&rtc->ops_lock); 47 err = mutex_lock_interruptible(&rtc->ops_lock);
48 if (err) 48 if (err)
49 return -EBUSY; 49 return err;
50 50
51 if (!rtc->ops) 51 if (!rtc->ops)
52 err = -ENODEV; 52 err = -ENODEV;
@@ -66,7 +66,7 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs)
66 66
67 err = mutex_lock_interruptible(&rtc->ops_lock); 67 err = mutex_lock_interruptible(&rtc->ops_lock);
68 if (err) 68 if (err)
69 return -EBUSY; 69 return err;
70 70
71 if (!rtc->ops) 71 if (!rtc->ops)
72 err = -ENODEV; 72 err = -ENODEV;
@@ -106,7 +106,7 @@ static int rtc_read_alarm_internal(struct rtc_device *rtc, struct rtc_wkalrm *al
106 106
107 err = mutex_lock_interruptible(&rtc->ops_lock); 107 err = mutex_lock_interruptible(&rtc->ops_lock);
108 if (err) 108 if (err)
109 return -EBUSY; 109 return err;
110 110
111 if (rtc->ops == NULL) 111 if (rtc->ops == NULL)
112 err = -ENODEV; 112 err = -ENODEV;
@@ -293,7 +293,7 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
293 293
294 err = mutex_lock_interruptible(&rtc->ops_lock); 294 err = mutex_lock_interruptible(&rtc->ops_lock);
295 if (err) 295 if (err)
296 return -EBUSY; 296 return err;
297 297
298 if (!rtc->ops) 298 if (!rtc->ops)
299 err = -ENODEV; 299 err = -ENODEV;
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index 0a870b7e5c32..856cc1af40df 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -221,7 +221,7 @@ static long rtc_dev_ioctl(struct file *file,
221 221
222 err = mutex_lock_interruptible(&rtc->ops_lock); 222 err = mutex_lock_interruptible(&rtc->ops_lock);
223 if (err) 223 if (err)
224 return -EBUSY; 224 return err;
225 225
226 /* check that the calling task has appropriate permissions 226 /* check that the calling task has appropriate permissions
227 * for certain ioctls. doing this check here is useful 227 * for certain ioctls. doing this check here is useful
@@ -432,6 +432,8 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
432#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL 432#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
433 clear_uie(rtc); 433 clear_uie(rtc);
434#endif 434#endif
435 rtc_irq_set_state(rtc, NULL, 0);
436
435 if (rtc->ops->release) 437 if (rtc->ops->release)
436 rtc->ops->release(rtc->dev.parent); 438 rtc->ops->release(rtc->dev.parent);
437 439
diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c
index 2d8df0b30538..20676cdef4a5 100644
--- a/drivers/s390/block/dasd_alias.c
+++ b/drivers/s390/block/dasd_alias.c
@@ -91,7 +91,8 @@ static struct alias_pav_group *_find_group(struct alias_lcu *lcu,
91 else 91 else
92 search_unit_addr = uid->base_unit_addr; 92 search_unit_addr = uid->base_unit_addr;
93 list_for_each_entry(pos, &lcu->grouplist, group) { 93 list_for_each_entry(pos, &lcu->grouplist, group) {
94 if (pos->uid.base_unit_addr == search_unit_addr) 94 if (pos->uid.base_unit_addr == search_unit_addr &&
95 !strncmp(pos->uid.vduit, uid->vduit, sizeof(uid->vduit)))
95 return pos; 96 return pos;
96 }; 97 };
97 return NULL; 98 return NULL;
@@ -332,6 +333,7 @@ static int _add_device_to_lcu(struct alias_lcu *lcu,
332 group->uid.base_unit_addr = uid->real_unit_addr; 333 group->uid.base_unit_addr = uid->real_unit_addr;
333 else 334 else
334 group->uid.base_unit_addr = uid->base_unit_addr; 335 group->uid.base_unit_addr = uid->base_unit_addr;
336 memcpy(group->uid.vduit, uid->vduit, sizeof(uid->vduit));
335 INIT_LIST_HEAD(&group->group); 337 INIT_LIST_HEAD(&group->group);
336 INIT_LIST_HEAD(&group->baselist); 338 INIT_LIST_HEAD(&group->baselist);
337 INIT_LIST_HEAD(&group->aliaslist); 339 INIT_LIST_HEAD(&group->aliaslist);
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c
index d774e79476fe..cd3335c1c307 100644
--- a/drivers/s390/block/dasd_devmap.c
+++ b/drivers/s390/block/dasd_devmap.c
@@ -913,7 +913,8 @@ dasd_vendor_show(struct device *dev, struct device_attribute *attr, char *buf)
913static DEVICE_ATTR(vendor, 0444, dasd_vendor_show, NULL); 913static DEVICE_ATTR(vendor, 0444, dasd_vendor_show, NULL);
914 914
915#define UID_STRLEN ( /* vendor */ 3 + 1 + /* serial */ 14 + 1 +\ 915#define UID_STRLEN ( /* vendor */ 3 + 1 + /* serial */ 14 + 1 +\
916 /* SSID */ 4 + 1 + /* unit addr */ 2 + 1) 916 /* SSID */ 4 + 1 + /* unit addr */ 2 + 1 +\
917 /* vduit */ 32 + 1)
917 918
918static ssize_t 919static ssize_t
919dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) 920dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -945,8 +946,17 @@ dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf)
945 sprintf(ua_string, "%02x", uid->real_unit_addr); 946 sprintf(ua_string, "%02x", uid->real_unit_addr);
946 break; 947 break;
947 } 948 }
948 snprintf(uid_string, sizeof(uid_string), "%s.%s.%04x.%s", 949 if (strlen(uid->vduit) > 0)
949 uid->vendor, uid->serial, uid->ssid, ua_string); 950 snprintf(uid_string, sizeof(uid_string),
951 "%s.%s.%04x.%s.%s",
952 uid->vendor, uid->serial,
953 uid->ssid, ua_string,
954 uid->vduit);
955 else
956 snprintf(uid_string, sizeof(uid_string),
957 "%s.%s.%04x.%s",
958 uid->vendor, uid->serial,
959 uid->ssid, ua_string);
950 spin_unlock(&dasd_devmap_lock); 960 spin_unlock(&dasd_devmap_lock);
951 return snprintf(buf, PAGE_SIZE, "%s\n", uid_string); 961 return snprintf(buf, PAGE_SIZE, "%s\n", uid_string);
952} 962}
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 3590fdb5b2fd..773b3fe275b2 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -313,8 +313,8 @@ static int prefix(struct ccw1 *ccw, struct PFX_eckd_data *pfxdata, int trk,
313 memset(pfxdata, 0, sizeof(*pfxdata)); 313 memset(pfxdata, 0, sizeof(*pfxdata));
314 /* prefix data */ 314 /* prefix data */
315 pfxdata->format = 0; 315 pfxdata->format = 0;
316 pfxdata->base_address = basepriv->conf_data.ned1.unit_addr; 316 pfxdata->base_address = basepriv->ned->unit_addr;
317 pfxdata->base_lss = basepriv->conf_data.ned1.ID; 317 pfxdata->base_lss = basepriv->ned->ID;
318 pfxdata->validity.define_extend = 1; 318 pfxdata->validity.define_extend = 1;
319 319
320 /* private uid is kept up to date, conf_data may be outdated */ 320 /* private uid is kept up to date, conf_data may be outdated */
@@ -536,36 +536,40 @@ dasd_eckd_cdl_reclen(int recid)
536/* 536/*
537 * Generate device unique id that specifies the physical device. 537 * Generate device unique id that specifies the physical device.
538 */ 538 */
539static int 539static int dasd_eckd_generate_uid(struct dasd_device *device,
540dasd_eckd_generate_uid(struct dasd_device *device, struct dasd_uid *uid) 540 struct dasd_uid *uid)
541{ 541{
542 struct dasd_eckd_private *private; 542 struct dasd_eckd_private *private;
543 struct dasd_eckd_confdata *confdata; 543 int count;
544 544
545 private = (struct dasd_eckd_private *) device->private; 545 private = (struct dasd_eckd_private *) device->private;
546 if (!private) 546 if (!private)
547 return -ENODEV; 547 return -ENODEV;
548 confdata = &private->conf_data; 548 if (!private->ned || !private->gneq)
549 if (!confdata)
550 return -ENODEV; 549 return -ENODEV;
551 550
552 memset(uid, 0, sizeof(struct dasd_uid)); 551 memset(uid, 0, sizeof(struct dasd_uid));
553 memcpy(uid->vendor, confdata->ned1.HDA_manufacturer, 552 memcpy(uid->vendor, private->ned->HDA_manufacturer,
554 sizeof(uid->vendor) - 1); 553 sizeof(uid->vendor) - 1);
555 EBCASC(uid->vendor, sizeof(uid->vendor) - 1); 554 EBCASC(uid->vendor, sizeof(uid->vendor) - 1);
556 memcpy(uid->serial, confdata->ned1.HDA_location, 555 memcpy(uid->serial, private->ned->HDA_location,
557 sizeof(uid->serial) - 1); 556 sizeof(uid->serial) - 1);
558 EBCASC(uid->serial, sizeof(uid->serial) - 1); 557 EBCASC(uid->serial, sizeof(uid->serial) - 1);
559 uid->ssid = confdata->neq.subsystemID; 558 uid->ssid = private->gneq->subsystemID;
560 uid->real_unit_addr = confdata->ned1.unit_addr; 559 uid->real_unit_addr = private->ned->unit_addr;;
561 if (confdata->ned2.sneq.flags == 0x40 && 560 if (private->sneq) {
562 confdata->ned2.sneq.format == 0x0001) { 561 uid->type = private->sneq->sua_flags;
563 uid->type = confdata->ned2.sneq.sua_flags;
564 if (uid->type == UA_BASE_PAV_ALIAS) 562 if (uid->type == UA_BASE_PAV_ALIAS)
565 uid->base_unit_addr = confdata->ned2.sneq.base_unit_addr; 563 uid->base_unit_addr = private->sneq->base_unit_addr;
566 } else { 564 } else {
567 uid->type = UA_BASE_DEVICE; 565 uid->type = UA_BASE_DEVICE;
568 } 566 }
567 if (private->vdsneq) {
568 for (count = 0; count < 16; count++) {
569 sprintf(uid->vduit+2*count, "%02x",
570 private->vdsneq->uit[count]);
571 }
572 }
569 return 0; 573 return 0;
570} 574}
571 575
@@ -623,6 +627,15 @@ static int dasd_eckd_read_conf_lpm(struct dasd_device *device,
623 ret = -ENOMEM; 627 ret = -ENOMEM;
624 goto out_error; 628 goto out_error;
625 } 629 }
630
631 /*
632 * buffer has to start with EBCDIC "V1.0" to show
633 * support for virtual device SNEQ
634 */
635 rcd_buf[0] = 0xE5;
636 rcd_buf[1] = 0xF1;
637 rcd_buf[2] = 0x4B;
638 rcd_buf[3] = 0xF0;
626 cqr = dasd_eckd_build_rcd_lpm(device, rcd_buf, ciw, lpm); 639 cqr = dasd_eckd_build_rcd_lpm(device, rcd_buf, ciw, lpm);
627 if (IS_ERR(cqr)) { 640 if (IS_ERR(cqr)) {
628 ret = PTR_ERR(cqr); 641 ret = PTR_ERR(cqr);
@@ -646,8 +659,62 @@ out_error:
646 return ret; 659 return ret;
647} 660}
648 661
649static int 662static int dasd_eckd_identify_conf_parts(struct dasd_eckd_private *private)
650dasd_eckd_read_conf(struct dasd_device *device) 663{
664
665 struct dasd_sneq *sneq;
666 int i, count;
667
668 private->ned = NULL;
669 private->sneq = NULL;
670 private->vdsneq = NULL;
671 private->gneq = NULL;
672 count = private->conf_len / sizeof(struct dasd_sneq);
673 sneq = (struct dasd_sneq *)private->conf_data;
674 for (i = 0; i < count; ++i) {
675 if (sneq->flags.identifier == 1 && sneq->format == 1)
676 private->sneq = sneq;
677 else if (sneq->flags.identifier == 1 && sneq->format == 4)
678 private->vdsneq = (struct vd_sneq *)sneq;
679 else if (sneq->flags.identifier == 2)
680 private->gneq = (struct dasd_gneq *)sneq;
681 else if (sneq->flags.identifier == 3 && sneq->res1 == 1)
682 private->ned = (struct dasd_ned *)sneq;
683 sneq++;
684 }
685 if (!private->ned || !private->gneq) {
686 private->ned = NULL;
687 private->sneq = NULL;
688 private->vdsneq = NULL;
689 private->gneq = NULL;
690 return -EINVAL;
691 }
692 return 0;
693
694};
695
696static unsigned char dasd_eckd_path_access(void *conf_data, int conf_len)
697{
698 struct dasd_gneq *gneq;
699 int i, count, found;
700
701 count = conf_len / sizeof(*gneq);
702 gneq = (struct dasd_gneq *)conf_data;
703 found = 0;
704 for (i = 0; i < count; ++i) {
705 if (gneq->flags.identifier == 2) {
706 found = 1;
707 break;
708 }
709 gneq++;
710 }
711 if (found)
712 return ((char *)gneq)[18] & 0x07;
713 else
714 return 0;
715}
716
717static int dasd_eckd_read_conf(struct dasd_device *device)
651{ 718{
652 void *conf_data; 719 void *conf_data;
653 int conf_len, conf_data_saved; 720 int conf_len, conf_data_saved;
@@ -661,7 +728,6 @@ dasd_eckd_read_conf(struct dasd_device *device)
661 path_data->opm = ccw_device_get_path_mask(device->cdev); 728 path_data->opm = ccw_device_get_path_mask(device->cdev);
662 lpm = 0x80; 729 lpm = 0x80;
663 conf_data_saved = 0; 730 conf_data_saved = 0;
664
665 /* get configuration data per operational path */ 731 /* get configuration data per operational path */
666 for (lpm = 0x80; lpm; lpm>>= 1) { 732 for (lpm = 0x80; lpm; lpm>>= 1) {
667 if (lpm & path_data->opm){ 733 if (lpm & path_data->opm){
@@ -678,22 +744,20 @@ dasd_eckd_read_conf(struct dasd_device *device)
678 "data retrieved"); 744 "data retrieved");
679 continue; /* no error */ 745 continue; /* no error */
680 } 746 }
681 if (conf_len != sizeof(struct dasd_eckd_confdata)) {
682 MESSAGE(KERN_WARNING,
683 "sizes of configuration data mismatch"
684 "%d (read) vs %ld (expected)",
685 conf_len,
686 sizeof(struct dasd_eckd_confdata));
687 kfree(conf_data);
688 continue; /* no error */
689 }
690 /* save first valid configuration data */ 747 /* save first valid configuration data */
691 if (!conf_data_saved){ 748 if (!conf_data_saved) {
692 memcpy(&private->conf_data, conf_data, 749 kfree(private->conf_data);
693 sizeof(struct dasd_eckd_confdata)); 750 private->conf_data = conf_data;
751 private->conf_len = conf_len;
752 if (dasd_eckd_identify_conf_parts(private)) {
753 private->conf_data = NULL;
754 private->conf_len = 0;
755 kfree(conf_data);
756 continue;
757 }
694 conf_data_saved++; 758 conf_data_saved++;
695 } 759 }
696 switch (((char *)conf_data)[242] & 0x07){ 760 switch (dasd_eckd_path_access(conf_data, conf_len)) {
697 case 0x02: 761 case 0x02:
698 path_data->npm |= lpm; 762 path_data->npm |= lpm;
699 break; 763 break;
@@ -701,7 +765,8 @@ dasd_eckd_read_conf(struct dasd_device *device)
701 path_data->ppm |= lpm; 765 path_data->ppm |= lpm;
702 break; 766 break;
703 } 767 }
704 kfree(conf_data); 768 if (conf_data != private->conf_data)
769 kfree(conf_data);
705 } 770 }
706 } 771 }
707 return 0; 772 return 0;
@@ -952,6 +1017,7 @@ out_err2:
952 dasd_free_block(device->block); 1017 dasd_free_block(device->block);
953 device->block = NULL; 1018 device->block = NULL;
954out_err1: 1019out_err1:
1020 kfree(private->conf_data);
955 kfree(device->private); 1021 kfree(device->private);
956 device->private = NULL; 1022 device->private = NULL;
957 return rc; 1023 return rc;
@@ -959,7 +1025,17 @@ out_err1:
959 1025
960static void dasd_eckd_uncheck_device(struct dasd_device *device) 1026static void dasd_eckd_uncheck_device(struct dasd_device *device)
961{ 1027{
1028 struct dasd_eckd_private *private;
1029
1030 private = (struct dasd_eckd_private *) device->private;
962 dasd_alias_disconnect_device_from_lcu(device); 1031 dasd_alias_disconnect_device_from_lcu(device);
1032 private->ned = NULL;
1033 private->sneq = NULL;
1034 private->vdsneq = NULL;
1035 private->gneq = NULL;
1036 private->conf_len = 0;
1037 kfree(private->conf_data);
1038 private->conf_data = NULL;
963} 1039}
964 1040
965static struct dasd_ccw_req * 1041static struct dasd_ccw_req *
@@ -1746,9 +1822,10 @@ dasd_eckd_fill_info(struct dasd_device * device,
1746 info->characteristics_size = sizeof(struct dasd_eckd_characteristics); 1822 info->characteristics_size = sizeof(struct dasd_eckd_characteristics);
1747 memcpy(info->characteristics, &private->rdc_data, 1823 memcpy(info->characteristics, &private->rdc_data,
1748 sizeof(struct dasd_eckd_characteristics)); 1824 sizeof(struct dasd_eckd_characteristics));
1749 info->confdata_size = sizeof(struct dasd_eckd_confdata); 1825 info->confdata_size = min((unsigned long)private->conf_len,
1750 memcpy(info->configuration_data, &private->conf_data, 1826 sizeof(info->configuration_data));
1751 sizeof(struct dasd_eckd_confdata)); 1827 memcpy(info->configuration_data, private->conf_data,
1828 info->confdata_size);
1752 return 0; 1829 return 0;
1753} 1830}
1754 1831
diff --git a/drivers/s390/block/dasd_eckd.h b/drivers/s390/block/dasd_eckd.h
index fc2509c939bc..4bf0aa5112c1 100644
--- a/drivers/s390/block/dasd_eckd.h
+++ b/drivers/s390/block/dasd_eckd.h
@@ -231,133 +231,62 @@ struct dasd_eckd_characteristics {
231 __u8 reserved3[10]; 231 __u8 reserved3[10];
232} __attribute__ ((packed)); 232} __attribute__ ((packed));
233 233
234struct dasd_eckd_confdata { 234/* elements of the configuration data */
235struct dasd_ned {
235 struct { 236 struct {
236 struct { 237 __u8 identifier:2;
237 unsigned char identifier:2; 238 __u8 token_id:1;
238 unsigned char token_id:1; 239 __u8 sno_valid:1;
239 unsigned char sno_valid:1; 240 __u8 subst_sno:1;
240 unsigned char subst_sno:1; 241 __u8 recNED:1;
241 unsigned char recNED:1; 242 __u8 emuNED:1;
242 unsigned char emuNED:1; 243 __u8 reserved:1;
243 unsigned char reserved:1; 244 } __attribute__ ((packed)) flags;
244 } __attribute__ ((packed)) flags; 245 __u8 descriptor;
245 __u8 descriptor; 246 __u8 dev_class;
246 __u8 dev_class; 247 __u8 reserved;
247 __u8 reserved; 248 __u8 dev_type[6];
248 unsigned char dev_type[6]; 249 __u8 dev_model[3];
249 unsigned char dev_model[3]; 250 __u8 HDA_manufacturer[3];
250 unsigned char HDA_manufacturer[3]; 251 __u8 HDA_location[2];
251 unsigned char HDA_location[2]; 252 __u8 HDA_seqno[12];
252 unsigned char HDA_seqno[12]; 253 __u8 ID;
253 __u8 ID; 254 __u8 unit_addr;
254 __u8 unit_addr; 255} __attribute__ ((packed));
255 } __attribute__ ((packed)) ned1; 256
256 union { 257struct dasd_sneq {
257 struct {
258 struct {
259 unsigned char identifier:2;
260 unsigned char token_id:1;
261 unsigned char sno_valid:1;
262 unsigned char subst_sno:1;
263 unsigned char recNED:1;
264 unsigned char emuNED:1;
265 unsigned char reserved:1;
266 } __attribute__ ((packed)) flags;
267 __u8 descriptor;
268 __u8 reserved[2];
269 unsigned char dev_type[6];
270 unsigned char dev_model[3];
271 unsigned char DASD_manufacturer[3];
272 unsigned char DASD_location[2];
273 unsigned char DASD_seqno[12];
274 __u16 ID;
275 } __attribute__ ((packed)) ned;
276 struct {
277 unsigned char flags; /* byte 0 */
278 unsigned char res1; /* byte 1 */
279 __u16 format; /* byte 2-3 */
280 unsigned char res2[4]; /* byte 4-7 */
281 unsigned char sua_flags; /* byte 8 */
282 __u8 base_unit_addr; /* byte 9 */
283 unsigned char res3[22]; /* byte 10-31 */
284 } __attribute__ ((packed)) sneq;
285 } __attribute__ ((packed)) ned2;
286 struct { 258 struct {
287 struct { 259 __u8 identifier:2;
288 unsigned char identifier:2; 260 __u8 reserved:6;
289 unsigned char token_id:1; 261 } __attribute__ ((packed)) flags;
290 unsigned char sno_valid:1; 262 __u8 res1;
291 unsigned char subst_sno:1; 263 __u16 format;
292 unsigned char recNED:1; 264 __u8 res2[4]; /* byte 4- 7 */
293 unsigned char emuNED:1; 265 __u8 sua_flags; /* byte 8 */
294 unsigned char reserved:1; 266 __u8 base_unit_addr; /* byte 9 */
295 } __attribute__ ((packed)) flags; 267 __u8 res3[22]; /* byte 10-31 */
296 __u8 descriptor; 268} __attribute__ ((packed));
297 __u8 reserved[2]; 269
298 unsigned char cont_type[6]; 270struct vd_sneq {
299 unsigned char cont_model[3];
300 unsigned char cont_manufacturer[3];
301 unsigned char cont_location[2];
302 unsigned char cont_seqno[12];
303 __u16 ID;
304 } __attribute__ ((packed)) ned3;
305 struct { 271 struct {
306 struct { 272 __u8 identifier:2;
307 unsigned char identifier:2; 273 __u8 reserved:6;
308 unsigned char token_id:1; 274 } __attribute__ ((packed)) flags;
309 unsigned char sno_valid:1; 275 __u8 res1;
310 unsigned char subst_sno:1; 276 __u16 format;
311 unsigned char recNED:1; 277 __u8 res2[4]; /* byte 4- 7 */
312 unsigned char emuNED:1; 278 __u8 uit[16]; /* byte 8-23 */
313 unsigned char reserved:1; 279 __u8 res3[8]; /* byte 24-31 */
314 } __attribute__ ((packed)) flags; 280} __attribute__ ((packed));
315 __u8 descriptor; 281
316 __u8 reserved[2]; 282struct dasd_gneq {
317 unsigned char cont_type[6];
318 unsigned char empty[3];
319 unsigned char cont_manufacturer[3];
320 unsigned char cont_location[2];
321 unsigned char cont_seqno[12];
322 __u16 ID;
323 } __attribute__ ((packed)) ned4;
324 unsigned char ned5[32];
325 unsigned char ned6[32];
326 unsigned char ned7[32];
327 struct { 283 struct {
328 struct { 284 __u8 identifier:2;
329 unsigned char identifier:2; 285 __u8 reserved:6;
330 unsigned char reserved:6; 286 } __attribute__ ((packed)) flags;
331 } __attribute__ ((packed)) flags; 287 __u8 reserved[7];
332 __u8 selector; 288 __u16 subsystemID;
333 __u16 interfaceID; 289 __u8 reserved2[22];
334 __u32 reserved;
335 __u16 subsystemID;
336 struct {
337 unsigned char sp0:1;
338 unsigned char sp1:1;
339 unsigned char reserved:5;
340 unsigned char scluster:1;
341 } __attribute__ ((packed)) spathID;
342 __u8 unit_address;
343 __u8 dev_ID;
344 __u8 dev_address;
345 __u8 adapterID;
346 __u16 link_address;
347 struct {
348 unsigned char parallel:1;
349 unsigned char escon:1;
350 unsigned char reserved:1;
351 unsigned char ficon:1;
352 unsigned char reserved2:4;
353 } __attribute__ ((packed)) protocol_type;
354 struct {
355 unsigned char PID_in_236:1;
356 unsigned char reserved:7;
357 } __attribute__ ((packed)) format_flags;
358 __u8 log_dev_address;
359 unsigned char reserved2[12];
360 } __attribute__ ((packed)) neq;
361} __attribute__ ((packed)); 290} __attribute__ ((packed));
362 291
363struct dasd_eckd_path { 292struct dasd_eckd_path {
@@ -463,7 +392,14 @@ struct alias_pav_group {
463 392
464struct dasd_eckd_private { 393struct dasd_eckd_private {
465 struct dasd_eckd_characteristics rdc_data; 394 struct dasd_eckd_characteristics rdc_data;
466 struct dasd_eckd_confdata conf_data; 395 u8 *conf_data;
396 int conf_len;
397 /* pointers to specific parts in the conf_data */
398 struct dasd_ned *ned;
399 struct dasd_sneq *sneq;
400 struct vd_sneq *vdsneq;
401 struct dasd_gneq *gneq;
402
467 struct dasd_eckd_path path_data; 403 struct dasd_eckd_path path_data;
468 struct eckd_count count_area[5]; 404 struct eckd_count count_area[5];
469 int init_cqr_status; 405 int init_cqr_status;
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index fb2f931cf844..31ecaa4a40e4 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -307,6 +307,7 @@ struct dasd_uid {
307 __u16 ssid; 307 __u16 ssid;
308 __u8 real_unit_addr; 308 __u8 real_unit_addr;
309 __u8 base_unit_addr; 309 __u8 base_unit_addr;
310 char vduit[33];
310}; 311};
311 312
312/* 313/*
diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c
index 3c8b25e6c345..1fd8f2193ed8 100644
--- a/drivers/s390/char/sclp.c
+++ b/drivers/s390/char/sclp.c
@@ -399,6 +399,7 @@ sclp_tod_from_jiffies(unsigned long jiffies)
399void 399void
400sclp_sync_wait(void) 400sclp_sync_wait(void)
401{ 401{
402 unsigned long long old_tick;
402 unsigned long flags; 403 unsigned long flags;
403 unsigned long cr0, cr0_sync; 404 unsigned long cr0, cr0_sync;
404 u64 timeout; 405 u64 timeout;
@@ -419,11 +420,12 @@ sclp_sync_wait(void)
419 if (!irq_context) 420 if (!irq_context)
420 local_bh_disable(); 421 local_bh_disable();
421 /* Enable service-signal interruption, disable timer interrupts */ 422 /* Enable service-signal interruption, disable timer interrupts */
423 old_tick = local_tick_disable();
422 trace_hardirqs_on(); 424 trace_hardirqs_on();
423 __ctl_store(cr0, 0, 0); 425 __ctl_store(cr0, 0, 0);
424 cr0_sync = cr0; 426 cr0_sync = cr0;
427 cr0_sync &= 0xffff00a0;
425 cr0_sync |= 0x00000200; 428 cr0_sync |= 0x00000200;
426 cr0_sync &= 0xFFFFF3AC;
427 __ctl_load(cr0_sync, 0, 0); 429 __ctl_load(cr0_sync, 0, 0);
428 __raw_local_irq_stosm(0x01); 430 __raw_local_irq_stosm(0x01);
429 /* Loop until driver state indicates finished request */ 431 /* Loop until driver state indicates finished request */
@@ -439,9 +441,9 @@ sclp_sync_wait(void)
439 __ctl_load(cr0, 0, 0); 441 __ctl_load(cr0, 0, 0);
440 if (!irq_context) 442 if (!irq_context)
441 _local_bh_enable(); 443 _local_bh_enable();
444 local_tick_enable(old_tick);
442 local_irq_restore(flags); 445 local_irq_restore(flags);
443} 446}
444
445EXPORT_SYMBOL(sclp_sync_wait); 447EXPORT_SYMBOL(sclp_sync_wait);
446 448
447/* Dispatch changes in send and receive mask to registered listeners. */ 449/* Dispatch changes in send and receive mask to registered listeners. */
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index 0c2b77493db4..eb5f1b8bc57f 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -427,6 +427,8 @@ static int sclp_mem_notifier(struct notifier_block *nb,
427 sclp_attach_storage(id); 427 sclp_attach_storage(id);
428 switch (action) { 428 switch (action) {
429 case MEM_ONLINE: 429 case MEM_ONLINE:
430 case MEM_GOING_OFFLINE:
431 case MEM_CANCEL_OFFLINE:
430 break; 432 break;
431 case MEM_GOING_ONLINE: 433 case MEM_GOING_ONLINE:
432 rc = sclp_mem_change_state(start, size, 1); 434 rc = sclp_mem_change_state(start, size, 1);
@@ -434,6 +436,9 @@ static int sclp_mem_notifier(struct notifier_block *nb,
434 case MEM_CANCEL_ONLINE: 436 case MEM_CANCEL_ONLINE:
435 sclp_mem_change_state(start, size, 0); 437 sclp_mem_change_state(start, size, 0);
436 break; 438 break;
439 case MEM_OFFLINE:
440 sclp_mem_change_state(start, size, 0);
441 break;
437 default: 442 default:
438 rc = -EINVAL; 443 rc = -EINVAL;
439 break; 444 break;
diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c
index fff4ff485d9b..4cebd6ee6d27 100644
--- a/drivers/s390/char/sclp_config.c
+++ b/drivers/s390/char/sclp_config.c
@@ -8,7 +8,6 @@
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/errno.h> 9#include <linux/errno.h>
10#include <linux/cpu.h> 10#include <linux/cpu.h>
11#include <linux/kthread.h>
12#include <linux/sysdev.h> 11#include <linux/sysdev.h>
13#include <linux/workqueue.h> 12#include <linux/workqueue.h>
14#include <asm/smp.h> 13#include <asm/smp.h>
@@ -41,19 +40,9 @@ static void sclp_cpu_capability_notify(struct work_struct *work)
41 put_online_cpus(); 40 put_online_cpus();
42} 41}
43 42
44static int sclp_cpu_kthread(void *data)
45{
46 smp_rescan_cpus();
47 return 0;
48}
49
50static void __ref sclp_cpu_change_notify(struct work_struct *work) 43static void __ref sclp_cpu_change_notify(struct work_struct *work)
51{ 44{
52 /* Can't call smp_rescan_cpus() from workqueue context since it may 45 smp_rescan_cpus();
53 * deadlock in case of cpu hotplug. So we have to create a kernel
54 * thread in order to call it.
55 */
56 kthread_run(sclp_cpu_kthread, NULL, "cpu_rescan");
57} 46}
58 47
59static void sclp_conf_receiver_fn(struct evbuf_header *evbuf) 48static void sclp_conf_receiver_fn(struct evbuf_header *evbuf)
diff --git a/drivers/s390/cio/idset.c b/drivers/s390/cio/idset.c
index ef7bc0a125ef..cf8f24a4b5eb 100644
--- a/drivers/s390/cio/idset.c
+++ b/drivers/s390/cio/idset.c
@@ -5,7 +5,7 @@
5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> 5 * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
6 */ 6 */
7 7
8#include <linux/slab.h> 8#include <linux/vmalloc.h>
9#include <linux/bitops.h> 9#include <linux/bitops.h>
10#include "idset.h" 10#include "idset.h"
11#include "css.h" 11#include "css.h"
@@ -25,18 +25,18 @@ static struct idset *idset_new(int num_ssid, int num_id)
25{ 25{
26 struct idset *set; 26 struct idset *set;
27 27
28 set = kzalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id), 28 set = vmalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id));
29 GFP_KERNEL);
30 if (set) { 29 if (set) {
31 set->num_ssid = num_ssid; 30 set->num_ssid = num_ssid;
32 set->num_id = num_id; 31 set->num_id = num_id;
32 memset(set->bitmap, 0, bitmap_size(num_ssid, num_id));
33 } 33 }
34 return set; 34 return set;
35} 35}
36 36
37void idset_free(struct idset *set) 37void idset_free(struct idset *set)
38{ 38{
39 kfree(set); 39 vfree(set);
40} 40}
41 41
42void idset_clear(struct idset *set) 42void idset_clear(struct idset *set)
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index d10c73cc1688..d15648514a0f 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -1355,7 +1355,7 @@ int qdio_allocate(struct qdio_initialize *init_data)
1355 goto out_rel; 1355 goto out_rel;
1356 1356
1357 /* qdr is used in ccw1.cda which is u32 */ 1357 /* qdr is used in ccw1.cda which is u32 */
1358 irq_ptr->qdr = kzalloc(sizeof(struct qdr), GFP_KERNEL | GFP_DMA); 1358 irq_ptr->qdr = (struct qdr *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
1359 if (!irq_ptr->qdr) 1359 if (!irq_ptr->qdr)
1360 goto out_rel; 1360 goto out_rel;
1361 WARN_ON((unsigned long)irq_ptr->qdr & 0xfff); 1361 WARN_ON((unsigned long)irq_ptr->qdr & 0xfff);
diff --git a/drivers/s390/cio/qdio_perf.c b/drivers/s390/cio/qdio_perf.c
index ea01b85b1cc9..ec5c4a414235 100644
--- a/drivers/s390/cio/qdio_perf.c
+++ b/drivers/s390/cio/qdio_perf.c
@@ -142,7 +142,7 @@ int __init qdio_setup_perf_stats(void)
142 return 0; 142 return 0;
143} 143}
144 144
145void __exit qdio_remove_perf_stats(void) 145void qdio_remove_perf_stats(void)
146{ 146{
147#ifdef CONFIG_PROC_FS 147#ifdef CONFIG_PROC_FS
148 remove_proc_entry("qdio_perf", NULL); 148 remove_proc_entry("qdio_perf", NULL);
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index f0923a8aceda..1bd2a208db28 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -325,7 +325,7 @@ void qdio_release_memory(struct qdio_irq *irq_ptr)
325 kmem_cache_free(qdio_q_cache, q); 325 kmem_cache_free(qdio_q_cache, q);
326 } 326 }
327 } 327 }
328 kfree(irq_ptr->qdr); 328 free_page((unsigned long) irq_ptr->qdr);
329 free_page(irq_ptr->chsc_page); 329 free_page(irq_ptr->chsc_page);
330 free_page((unsigned long) irq_ptr); 330 free_page((unsigned long) irq_ptr);
331} 331}
@@ -515,7 +515,7 @@ int __init qdio_setup_init(void)
515 return 0; 515 return 0;
516} 516}
517 517
518void __exit qdio_setup_exit(void) 518void qdio_setup_exit(void)
519{ 519{
520 kmem_cache_destroy(qdio_q_cache); 520 kmem_cache_destroy(qdio_q_cache);
521} 521}
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 79954bd6bfa5..292b60da6dc7 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -352,7 +352,7 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count)
352 return len; 352 return len;
353} 353}
354 354
355void s390_virtio_console_init(void) 355void __init s390_virtio_console_init(void)
356{ 356{
357 virtio_cons_early_init(early_put_chars); 357 virtio_cons_early_init(early_put_chars);
358} 358}
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index 1895dbb553cd..80971c21ea1a 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -419,6 +419,7 @@ struct qeth_qdio_out_buffer {
419 int next_element_to_fill; 419 int next_element_to_fill;
420 struct sk_buff_head skb_list; 420 struct sk_buff_head skb_list;
421 struct list_head ctx_list; 421 struct list_head ctx_list;
422 int is_header[16];
422}; 423};
423 424
424struct qeth_card; 425struct qeth_card;
@@ -785,7 +786,7 @@ void qeth_core_remove_osn_attributes(struct device *);
785 786
786/* exports for qeth discipline device drivers */ 787/* exports for qeth discipline device drivers */
787extern struct qeth_card_list_struct qeth_core_card_list; 788extern struct qeth_card_list_struct qeth_core_card_list;
788 789extern struct kmem_cache *qeth_core_header_cache;
789extern struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS]; 790extern struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS];
790 791
791void qeth_set_allowed_threads(struct qeth_card *, unsigned long , int); 792void qeth_set_allowed_threads(struct qeth_card *, unsigned long , int);
@@ -843,7 +844,7 @@ int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int);
843int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int); 844int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int);
844int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *, 845int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *,
845 struct sk_buff *, struct qeth_hdr *, int, 846 struct sk_buff *, struct qeth_hdr *, int,
846 struct qeth_eddp_context *); 847 struct qeth_eddp_context *, int, int);
847int qeth_do_send_packet(struct qeth_card *, struct qeth_qdio_out_q *, 848int qeth_do_send_packet(struct qeth_card *, struct qeth_qdio_out_q *,
848 struct sk_buff *, struct qeth_hdr *, 849 struct sk_buff *, struct qeth_hdr *,
849 int, struct qeth_eddp_context *); 850 int, struct qeth_eddp_context *);
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index cebb25e36e82..bd420d1b9a0d 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -19,8 +19,8 @@
19#include <linux/mii.h> 19#include <linux/mii.h>
20#include <linux/kthread.h> 20#include <linux/kthread.h>
21 21
22#include <asm-s390/ebcdic.h> 22#include <asm/ebcdic.h>
23#include <asm-s390/io.h> 23#include <asm/io.h>
24#include <asm/s390_rdev.h> 24#include <asm/s390_rdev.h>
25 25
26#include "qeth_core.h" 26#include "qeth_core.h"
@@ -48,6 +48,8 @@ EXPORT_SYMBOL_GPL(qeth_dbf);
48 48
49struct qeth_card_list_struct qeth_core_card_list; 49struct qeth_card_list_struct qeth_core_card_list;
50EXPORT_SYMBOL_GPL(qeth_core_card_list); 50EXPORT_SYMBOL_GPL(qeth_core_card_list);
51struct kmem_cache *qeth_core_header_cache;
52EXPORT_SYMBOL_GPL(qeth_core_header_cache);
51 53
52static struct device *qeth_core_root_dev; 54static struct device *qeth_core_root_dev;
53static unsigned int known_devices[][10] = QETH_MODELLIST_ARRAY; 55static unsigned int known_devices[][10] = QETH_MODELLIST_ARRAY;
@@ -933,6 +935,10 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,
933 } 935 }
934 qeth_eddp_buf_release_contexts(buf); 936 qeth_eddp_buf_release_contexts(buf);
935 for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(queue->card); ++i) { 937 for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(queue->card); ++i) {
938 if (buf->buffer->element[i].addr && buf->is_header[i])
939 kmem_cache_free(qeth_core_header_cache,
940 buf->buffer->element[i].addr);
941 buf->is_header[i] = 0;
936 buf->buffer->element[i].length = 0; 942 buf->buffer->element[i].length = 0;
937 buf->buffer->element[i].addr = NULL; 943 buf->buffer->element[i].addr = NULL;
938 buf->buffer->element[i].flags = 0; 944 buf->buffer->element[i].flags = 0;
@@ -3002,8 +3008,8 @@ int qeth_get_elements_no(struct qeth_card *card, void *hdr,
3002 if (skb_shinfo(skb)->nr_frags > 0) 3008 if (skb_shinfo(skb)->nr_frags > 0)
3003 elements_needed = (skb_shinfo(skb)->nr_frags + 1); 3009 elements_needed = (skb_shinfo(skb)->nr_frags + 1);
3004 if (elements_needed == 0) 3010 if (elements_needed == 0)
3005 elements_needed = 1 + (((((unsigned long) hdr) % PAGE_SIZE) 3011 elements_needed = 1 + (((((unsigned long) skb->data) %
3006 + skb->len) >> PAGE_SHIFT); 3012 PAGE_SIZE) + skb->len) >> PAGE_SHIFT);
3007 if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) { 3013 if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) {
3008 QETH_DBF_MESSAGE(2, "Invalid size of IP packet " 3014 QETH_DBF_MESSAGE(2, "Invalid size of IP packet "
3009 "(Number=%d / Length=%d). Discarded.\n", 3015 "(Number=%d / Length=%d). Discarded.\n",
@@ -3015,7 +3021,8 @@ int qeth_get_elements_no(struct qeth_card *card, void *hdr,
3015EXPORT_SYMBOL_GPL(qeth_get_elements_no); 3021EXPORT_SYMBOL_GPL(qeth_get_elements_no);
3016 3022
3017static inline void __qeth_fill_buffer(struct sk_buff *skb, 3023static inline void __qeth_fill_buffer(struct sk_buff *skb,
3018 struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill) 3024 struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill,
3025 int offset)
3019{ 3026{
3020 int length = skb->len; 3027 int length = skb->len;
3021 int length_here; 3028 int length_here;
@@ -3027,6 +3034,11 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
3027 data = skb->data; 3034 data = skb->data;
3028 first_lap = (is_tso == 0 ? 1 : 0); 3035 first_lap = (is_tso == 0 ? 1 : 0);
3029 3036
3037 if (offset >= 0) {
3038 data = skb->data + offset;
3039 first_lap = 0;
3040 }
3041
3030 while (length > 0) { 3042 while (length > 0) {
3031 /* length_here is the remaining amount of data in this page */ 3043 /* length_here is the remaining amount of data in this page */
3032 length_here = PAGE_SIZE - ((unsigned long) data % PAGE_SIZE); 3044 length_here = PAGE_SIZE - ((unsigned long) data % PAGE_SIZE);
@@ -3058,22 +3070,22 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb,
3058} 3070}
3059 3071
3060static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue, 3072static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
3061 struct qeth_qdio_out_buffer *buf, struct sk_buff *skb) 3073 struct qeth_qdio_out_buffer *buf, struct sk_buff *skb,
3074 struct qeth_hdr *hdr, int offset, int hd_len)
3062{ 3075{
3063 struct qdio_buffer *buffer; 3076 struct qdio_buffer *buffer;
3064 struct qeth_hdr_tso *hdr;
3065 int flush_cnt = 0, hdr_len, large_send = 0; 3077 int flush_cnt = 0, hdr_len, large_send = 0;
3066 3078
3067 buffer = buf->buffer; 3079 buffer = buf->buffer;
3068 atomic_inc(&skb->users); 3080 atomic_inc(&skb->users);
3069 skb_queue_tail(&buf->skb_list, skb); 3081 skb_queue_tail(&buf->skb_list, skb);
3070 3082
3071 hdr = (struct qeth_hdr_tso *) skb->data;
3072 /*check first on TSO ....*/ 3083 /*check first on TSO ....*/
3073 if (hdr->hdr.hdr.l3.id == QETH_HEADER_TYPE_TSO) { 3084 if (hdr->hdr.l3.id == QETH_HEADER_TYPE_TSO) {
3074 int element = buf->next_element_to_fill; 3085 int element = buf->next_element_to_fill;
3075 3086
3076 hdr_len = sizeof(struct qeth_hdr_tso) + hdr->ext.dg_hdr_len; 3087 hdr_len = sizeof(struct qeth_hdr_tso) +
3088 ((struct qeth_hdr_tso *)hdr)->ext.dg_hdr_len;
3077 /*fill first buffer entry only with header information */ 3089 /*fill first buffer entry only with header information */
3078 buffer->element[element].addr = skb->data; 3090 buffer->element[element].addr = skb->data;
3079 buffer->element[element].length = hdr_len; 3091 buffer->element[element].length = hdr_len;
@@ -3083,9 +3095,20 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
3083 skb->len -= hdr_len; 3095 skb->len -= hdr_len;
3084 large_send = 1; 3096 large_send = 1;
3085 } 3097 }
3098
3099 if (offset >= 0) {
3100 int element = buf->next_element_to_fill;
3101 buffer->element[element].addr = hdr;
3102 buffer->element[element].length = sizeof(struct qeth_hdr) +
3103 hd_len;
3104 buffer->element[element].flags = SBAL_FLAGS_FIRST_FRAG;
3105 buf->is_header[element] = 1;
3106 buf->next_element_to_fill++;
3107 }
3108
3086 if (skb_shinfo(skb)->nr_frags == 0) 3109 if (skb_shinfo(skb)->nr_frags == 0)
3087 __qeth_fill_buffer(skb, buffer, large_send, 3110 __qeth_fill_buffer(skb, buffer, large_send,
3088 (int *)&buf->next_element_to_fill); 3111 (int *)&buf->next_element_to_fill, offset);
3089 else 3112 else
3090 __qeth_fill_buffer_frag(skb, buffer, large_send, 3113 __qeth_fill_buffer_frag(skb, buffer, large_send,
3091 (int *)&buf->next_element_to_fill); 3114 (int *)&buf->next_element_to_fill);
@@ -3115,7 +3138,7 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue,
3115int qeth_do_send_packet_fast(struct qeth_card *card, 3138int qeth_do_send_packet_fast(struct qeth_card *card,
3116 struct qeth_qdio_out_q *queue, struct sk_buff *skb, 3139 struct qeth_qdio_out_q *queue, struct sk_buff *skb,
3117 struct qeth_hdr *hdr, int elements_needed, 3140 struct qeth_hdr *hdr, int elements_needed,
3118 struct qeth_eddp_context *ctx) 3141 struct qeth_eddp_context *ctx, int offset, int hd_len)
3119{ 3142{
3120 struct qeth_qdio_out_buffer *buffer; 3143 struct qeth_qdio_out_buffer *buffer;
3121 int buffers_needed = 0; 3144 int buffers_needed = 0;
@@ -3148,7 +3171,7 @@ int qeth_do_send_packet_fast(struct qeth_card *card,
3148 } 3171 }
3149 atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED); 3172 atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED);
3150 if (ctx == NULL) { 3173 if (ctx == NULL) {
3151 qeth_fill_buffer(queue, buffer, skb); 3174 qeth_fill_buffer(queue, buffer, skb, hdr, offset, hd_len);
3152 qeth_flush_buffers(queue, index, 1); 3175 qeth_flush_buffers(queue, index, 1);
3153 } else { 3176 } else {
3154 flush_cnt = qeth_eddp_fill_buffer(queue, ctx, index); 3177 flush_cnt = qeth_eddp_fill_buffer(queue, ctx, index);
@@ -3224,7 +3247,7 @@ int qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
3224 } 3247 }
3225 } 3248 }
3226 if (ctx == NULL) 3249 if (ctx == NULL)
3227 tmp = qeth_fill_buffer(queue, buffer, skb); 3250 tmp = qeth_fill_buffer(queue, buffer, skb, hdr, -1, 0);
3228 else { 3251 else {
3229 tmp = qeth_eddp_fill_buffer(queue, ctx, 3252 tmp = qeth_eddp_fill_buffer(queue, ctx,
3230 queue->next_buf_to_fill); 3253 queue->next_buf_to_fill);
@@ -4443,8 +4466,17 @@ static int __init qeth_core_init(void)
4443 rc = IS_ERR(qeth_core_root_dev) ? PTR_ERR(qeth_core_root_dev) : 0; 4466 rc = IS_ERR(qeth_core_root_dev) ? PTR_ERR(qeth_core_root_dev) : 0;
4444 if (rc) 4467 if (rc)
4445 goto register_err; 4468 goto register_err;
4446 return 0;
4447 4469
4470 qeth_core_header_cache = kmem_cache_create("qeth_hdr",
4471 sizeof(struct qeth_hdr) + ETH_HLEN, 64, 0, NULL);
4472 if (!qeth_core_header_cache) {
4473 rc = -ENOMEM;
4474 goto slab_err;
4475 }
4476
4477 return 0;
4478slab_err:
4479 s390_root_dev_unregister(qeth_core_root_dev);
4448register_err: 4480register_err:
4449 driver_remove_file(&qeth_core_ccwgroup_driver.driver, 4481 driver_remove_file(&qeth_core_ccwgroup_driver.driver,
4450 &driver_attr_group); 4482 &driver_attr_group);
@@ -4466,6 +4498,7 @@ static void __exit qeth_core_exit(void)
4466 &driver_attr_group); 4498 &driver_attr_group);
4467 ccwgroup_driver_unregister(&qeth_core_ccwgroup_driver); 4499 ccwgroup_driver_unregister(&qeth_core_ccwgroup_driver);
4468 ccw_driver_unregister(&qeth_ccw_driver); 4500 ccw_driver_unregister(&qeth_ccw_driver);
4501 kmem_cache_destroy(qeth_core_header_cache);
4469 qeth_unregister_dbf_views(); 4502 qeth_unregister_dbf_views();
4470 PRINT_INFO("core functions removed\n"); 4503 PRINT_INFO("core functions removed\n");
4471} 4504}
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index a8b069cd9a4c..b3cee032f578 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -243,8 +243,7 @@ static void qeth_l2_get_packet_type(struct qeth_card *card,
243static void qeth_l2_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, 243static void qeth_l2_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
244 struct sk_buff *skb, int ipv, int cast_type) 244 struct sk_buff *skb, int ipv, int cast_type)
245{ 245{
246 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)((skb->data) + 246 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb_mac_header(skb);
247 QETH_HEADER_SIZE);
248 247
249 memset(hdr, 0, sizeof(struct qeth_hdr)); 248 memset(hdr, 0, sizeof(struct qeth_hdr));
250 hdr->hdr.l2.id = QETH_HEADER_TYPE_LAYER2; 249 hdr->hdr.l2.id = QETH_HEADER_TYPE_LAYER2;
@@ -621,6 +620,9 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
621 int tx_bytes = skb->len; 620 int tx_bytes = skb->len;
622 enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; 621 enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO;
623 struct qeth_eddp_context *ctx = NULL; 622 struct qeth_eddp_context *ctx = NULL;
623 int data_offset = -1;
624 int elements_needed = 0;
625 int hd_len = 0;
624 626
625 if ((card->state != CARD_STATE_UP) || !card->lan_online) { 627 if ((card->state != CARD_STATE_UP) || !card->lan_online) {
626 card->stats.tx_carrier_errors++; 628 card->stats.tx_carrier_errors++;
@@ -643,13 +645,32 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
643 if (card->info.type == QETH_CARD_TYPE_OSN) 645 if (card->info.type == QETH_CARD_TYPE_OSN)
644 hdr = (struct qeth_hdr *)skb->data; 646 hdr = (struct qeth_hdr *)skb->data;
645 else { 647 else {
646 /* create a clone with writeable headroom */ 648 if ((card->info.type == QETH_CARD_TYPE_IQD) && (!large_send) &&
647 new_skb = skb_realloc_headroom(skb, sizeof(struct qeth_hdr)); 649 (skb_shinfo(skb)->nr_frags == 0)) {
648 if (!new_skb) 650 new_skb = skb;
649 goto tx_drop; 651 data_offset = ETH_HLEN;
650 hdr = (struct qeth_hdr *)skb_push(new_skb, 652 hd_len = ETH_HLEN;
653 hdr = kmem_cache_alloc(qeth_core_header_cache,
654 GFP_ATOMIC);
655 if (!hdr)
656 goto tx_drop;
657 elements_needed++;
658 skb_reset_mac_header(new_skb);
659 qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type);
660 hdr->hdr.l2.pkt_length = new_skb->len;
661 memcpy(((char *)hdr) + sizeof(struct qeth_hdr),
662 skb_mac_header(new_skb), ETH_HLEN);
663 } else {
664 /* create a clone with writeable headroom */
665 new_skb = skb_realloc_headroom(skb,
666 sizeof(struct qeth_hdr));
667 if (!new_skb)
668 goto tx_drop;
669 hdr = (struct qeth_hdr *)skb_push(new_skb,
651 sizeof(struct qeth_hdr)); 670 sizeof(struct qeth_hdr));
652 qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type); 671 skb_set_mac_header(new_skb, sizeof(struct qeth_hdr));
672 qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type);
673 }
653 } 674 }
654 675
655 if (large_send == QETH_LARGE_SEND_EDDP) { 676 if (large_send == QETH_LARGE_SEND_EDDP) {
@@ -660,9 +681,13 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
660 goto tx_drop; 681 goto tx_drop;
661 } 682 }
662 } else { 683 } else {
663 elements = qeth_get_elements_no(card, (void *)hdr, new_skb, 0); 684 elements = qeth_get_elements_no(card, (void *)hdr, new_skb,
664 if (!elements) 685 elements_needed);
686 if (!elements) {
687 if (data_offset >= 0)
688 kmem_cache_free(qeth_core_header_cache, hdr);
665 goto tx_drop; 689 goto tx_drop;
690 }
666 } 691 }
667 692
668 if ((large_send == QETH_LARGE_SEND_NO) && 693 if ((large_send == QETH_LARGE_SEND_NO) &&
@@ -674,7 +699,7 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
674 elements, ctx); 699 elements, ctx);
675 else 700 else
676 rc = qeth_do_send_packet_fast(card, queue, new_skb, hdr, 701 rc = qeth_do_send_packet_fast(card, queue, new_skb, hdr,
677 elements, ctx); 702 elements, ctx, data_offset, hd_len);
678 if (!rc) { 703 if (!rc) {
679 card->stats.tx_packets++; 704 card->stats.tx_packets++;
680 card->stats.tx_bytes += tx_bytes; 705 card->stats.tx_bytes += tx_bytes;
@@ -701,6 +726,9 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
701 if (ctx != NULL) 726 if (ctx != NULL)
702 qeth_eddp_put_context(ctx); 727 qeth_eddp_put_context(ctx);
703 728
729 if (data_offset >= 0)
730 kmem_cache_free(qeth_core_header_cache, hdr);
731
704 if (rc == -EBUSY) { 732 if (rc == -EBUSY) {
705 if (new_skb != skb) 733 if (new_skb != skb)
706 dev_kfree_skb_any(new_skb); 734 dev_kfree_skb_any(new_skb);
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index 3e1d13857350..dd72c3c20165 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -2604,6 +2604,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2604 int tx_bytes = skb->len; 2604 int tx_bytes = skb->len;
2605 enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; 2605 enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO;
2606 struct qeth_eddp_context *ctx = NULL; 2606 struct qeth_eddp_context *ctx = NULL;
2607 int data_offset = -1;
2607 2608
2608 if ((card->info.type == QETH_CARD_TYPE_IQD) && 2609 if ((card->info.type == QETH_CARD_TYPE_IQD) &&
2609 (skb->protocol != htons(ETH_P_IPV6)) && 2610 (skb->protocol != htons(ETH_P_IPV6)) &&
@@ -2624,14 +2625,28 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2624 card->perf_stats.outbound_start_time = qeth_get_micros(); 2625 card->perf_stats.outbound_start_time = qeth_get_micros();
2625 } 2626 }
2626 2627
2627 /* create a clone with writeable headroom */ 2628 if (skb_is_gso(skb))
2628 new_skb = skb_realloc_headroom(skb, sizeof(struct qeth_hdr_tso) + 2629 large_send = card->options.large_send;
2629 VLAN_HLEN); 2630
2630 if (!new_skb) 2631 if ((card->info.type == QETH_CARD_TYPE_IQD) && (!large_send) &&
2631 goto tx_drop; 2632 (skb_shinfo(skb)->nr_frags == 0)) {
2633 new_skb = skb;
2634 data_offset = ETH_HLEN;
2635 hdr = kmem_cache_alloc(qeth_core_header_cache, GFP_ATOMIC);
2636 if (!hdr)
2637 goto tx_drop;
2638 elements_needed++;
2639 } else {
2640 /* create a clone with writeable headroom */
2641 new_skb = skb_realloc_headroom(skb, sizeof(struct qeth_hdr_tso)
2642 + VLAN_HLEN);
2643 if (!new_skb)
2644 goto tx_drop;
2645 }
2632 2646
2633 if (card->info.type == QETH_CARD_TYPE_IQD) { 2647 if (card->info.type == QETH_CARD_TYPE_IQD) {
2634 skb_pull(new_skb, ETH_HLEN); 2648 if (data_offset < 0)
2649 skb_pull(new_skb, ETH_HLEN);
2635 } else { 2650 } else {
2636 if (new_skb->protocol == htons(ETH_P_IP)) { 2651 if (new_skb->protocol == htons(ETH_P_IP)) {
2637 if (card->dev->type == ARPHRD_IEEE802_TR) 2652 if (card->dev->type == ARPHRD_IEEE802_TR)
@@ -2657,9 +2672,6 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2657 2672
2658 netif_stop_queue(dev); 2673 netif_stop_queue(dev);
2659 2674
2660 if (skb_is_gso(new_skb))
2661 large_send = card->options.large_send;
2662
2663 /* fix hardware limitation: as long as we do not have sbal 2675 /* fix hardware limitation: as long as we do not have sbal
2664 * chaining we can not send long frag lists so we temporary 2676 * chaining we can not send long frag lists so we temporary
2665 * switch to EDDP 2677 * switch to EDDP
@@ -2677,9 +2689,16 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2677 qeth_tso_fill_header(card, hdr, new_skb); 2689 qeth_tso_fill_header(card, hdr, new_skb);
2678 elements_needed++; 2690 elements_needed++;
2679 } else { 2691 } else {
2680 hdr = (struct qeth_hdr *)skb_push(new_skb, 2692 if (data_offset < 0) {
2693 hdr = (struct qeth_hdr *)skb_push(new_skb,
2681 sizeof(struct qeth_hdr)); 2694 sizeof(struct qeth_hdr));
2682 qeth_l3_fill_header(card, hdr, new_skb, ipv, cast_type); 2695 qeth_l3_fill_header(card, hdr, new_skb, ipv,
2696 cast_type);
2697 } else {
2698 qeth_l3_fill_header(card, hdr, new_skb, ipv,
2699 cast_type);
2700 hdr->hdr.l3.length = new_skb->len - data_offset;
2701 }
2683 } 2702 }
2684 2703
2685 if (large_send == QETH_LARGE_SEND_EDDP) { 2704 if (large_send == QETH_LARGE_SEND_EDDP) {
@@ -2695,8 +2714,11 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2695 } else { 2714 } else {
2696 int elems = qeth_get_elements_no(card, (void *)hdr, new_skb, 2715 int elems = qeth_get_elements_no(card, (void *)hdr, new_skb,
2697 elements_needed); 2716 elements_needed);
2698 if (!elems) 2717 if (!elems) {
2718 if (data_offset >= 0)
2719 kmem_cache_free(qeth_core_header_cache, hdr);
2699 goto tx_drop; 2720 goto tx_drop;
2721 }
2700 elements_needed += elems; 2722 elements_needed += elems;
2701 } 2723 }
2702 2724
@@ -2709,7 +2731,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2709 elements_needed, ctx); 2731 elements_needed, ctx);
2710 else 2732 else
2711 rc = qeth_do_send_packet_fast(card, queue, new_skb, hdr, 2733 rc = qeth_do_send_packet_fast(card, queue, new_skb, hdr,
2712 elements_needed, ctx); 2734 elements_needed, ctx, data_offset, 0);
2713 2735
2714 if (!rc) { 2736 if (!rc) {
2715 card->stats.tx_packets++; 2737 card->stats.tx_packets++;
@@ -2737,6 +2759,9 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2737 if (ctx != NULL) 2759 if (ctx != NULL)
2738 qeth_eddp_put_context(ctx); 2760 qeth_eddp_put_context(ctx);
2739 2761
2762 if (data_offset >= 0)
2763 kmem_cache_free(qeth_core_header_cache, hdr);
2764
2740 if (rc == -EBUSY) { 2765 if (rc == -EBUSY) {
2741 if (new_skb != skb) 2766 if (new_skb != skb)
2742 dev_kfree_skb_any(new_skb); 2767 dev_kfree_skb_any(new_skb);
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 7a4409ab30ea..a319a20ed440 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/kthread.h> 9#include <linux/kthread.h>
10#include <linux/vmalloc.h> 10#include <linux/vmalloc.h>
11#include <linux/delay.h>
11 12
12static int qla24xx_vport_disable(struct fc_vport *, bool); 13static int qla24xx_vport_disable(struct fc_vport *, bool);
13 14
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index a97f1ae11f78..342e12fb1c25 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1885,7 +1885,7 @@ static int serial8250_startup(struct uart_port *port)
1885 * the interrupt is enabled. Delays are necessary to 1885 * the interrupt is enabled. Delays are necessary to
1886 * allow register changes to become visible. 1886 * allow register changes to become visible.
1887 */ 1887 */
1888 spin_lock(&up->port.lock); 1888 spin_lock_irqsave(&up->port.lock, flags);
1889 if (up->port.flags & UPF_SHARE_IRQ) 1889 if (up->port.flags & UPF_SHARE_IRQ)
1890 disable_irq_nosync(up->port.irq); 1890 disable_irq_nosync(up->port.irq);
1891 1891
@@ -1901,7 +1901,7 @@ static int serial8250_startup(struct uart_port *port)
1901 1901
1902 if (up->port.flags & UPF_SHARE_IRQ) 1902 if (up->port.flags & UPF_SHARE_IRQ)
1903 enable_irq(up->port.irq); 1903 enable_irq(up->port.irq);
1904 spin_unlock(&up->port.lock); 1904 spin_unlock_irqrestore(&up->port.lock, flags);
1905 1905
1906 /* 1906 /*
1907 * If the interrupt is not reasserted, setup a timer to 1907 * If the interrupt is not reasserted, setup a timer to
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 3a0bbbe17aa3..7e7383e890d8 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -42,7 +42,6 @@ obj-$(CONFIG_SERIAL_68328) += 68328serial.o
42obj-$(CONFIG_SERIAL_68360) += 68360serial.o 42obj-$(CONFIG_SERIAL_68360) += 68360serial.o
43obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o 43obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o
44obj-$(CONFIG_SERIAL_MCF) += mcf.o 44obj-$(CONFIG_SERIAL_MCF) += mcf.o
45obj-$(CONFIG_V850E_UART) += v850e_uart.o
46obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o 45obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o
47obj-$(CONFIG_SERIAL_LH7A40X) += serial_lh7a40x.o 46obj-$(CONFIG_SERIAL_LH7A40X) += serial_lh7a40x.o
48obj-$(CONFIG_SERIAL_DZ) += dz.o 47obj-$(CONFIG_SERIAL_DZ) += dz.o
diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h
index 5c76e0ae0582..7274b527a3c1 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -50,6 +50,15 @@
50 50
51#define SCC_WAIT_CLOSING 100 51#define SCC_WAIT_CLOSING 100
52 52
53#define GPIO_CTS 0
54#define GPIO_RTS 1
55#define GPIO_DCD 2
56#define GPIO_DSR 3
57#define GPIO_DTR 4
58#define GPIO_RI 5
59
60#define NUM_GPIOS (GPIO_RI+1)
61
53struct uart_cpm_port { 62struct uart_cpm_port {
54 struct uart_port port; 63 struct uart_port port;
55 u16 rx_nrfifos; 64 u16 rx_nrfifos;
@@ -68,6 +77,7 @@ struct uart_cpm_port {
68 unsigned char *rx_buf; 77 unsigned char *rx_buf;
69 u32 flags; 78 u32 flags;
70 void (*set_lineif)(struct uart_cpm_port *); 79 void (*set_lineif)(struct uart_cpm_port *);
80 struct clk *clk;
71 u8 brg; 81 u8 brg;
72 uint dp_addr; 82 uint dp_addr;
73 void *mem_addr; 83 void *mem_addr;
@@ -82,6 +92,7 @@ struct uart_cpm_port {
82 int wait_closing; 92 int wait_closing;
83 /* value to combine with opcode to form cpm command */ 93 /* value to combine with opcode to form cpm command */
84 u32 command; 94 u32 command;
95 int gpios[NUM_GPIOS];
85}; 96};
86 97
87extern int cpm_uart_nr; 98extern int cpm_uart_nr;
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index a4f86927a74b..25efca5a7a1f 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -43,6 +43,9 @@
43#include <linux/dma-mapping.h> 43#include <linux/dma-mapping.h>
44#include <linux/fs_uart_pd.h> 44#include <linux/fs_uart_pd.h>
45#include <linux/of_platform.h> 45#include <linux/of_platform.h>
46#include <linux/gpio.h>
47#include <linux/of_gpio.h>
48#include <linux/clk.h>
46 49
47#include <asm/io.h> 50#include <asm/io.h>
48#include <asm/irq.h> 51#include <asm/irq.h>
@@ -96,13 +99,41 @@ static unsigned int cpm_uart_tx_empty(struct uart_port *port)
96 99
97static void cpm_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) 100static void cpm_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
98{ 101{
99 /* Whee. Do nothing. */ 102 struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
103
104 if (pinfo->gpios[GPIO_RTS] >= 0)
105 gpio_set_value(pinfo->gpios[GPIO_RTS], !(mctrl & TIOCM_RTS));
106
107 if (pinfo->gpios[GPIO_DTR] >= 0)
108 gpio_set_value(pinfo->gpios[GPIO_DTR], !(mctrl & TIOCM_DTR));
100} 109}
101 110
102static unsigned int cpm_uart_get_mctrl(struct uart_port *port) 111static unsigned int cpm_uart_get_mctrl(struct uart_port *port)
103{ 112{
104 /* Whee. Do nothing. */ 113 struct uart_cpm_port *pinfo = (struct uart_cpm_port *)port;
105 return TIOCM_CAR | TIOCM_DSR | TIOCM_CTS; 114 unsigned int mctrl = TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
115
116 if (pinfo->gpios[GPIO_CTS] >= 0) {
117 if (gpio_get_value(pinfo->gpios[GPIO_CTS]))
118 mctrl &= ~TIOCM_CTS;
119 }
120
121 if (pinfo->gpios[GPIO_DSR] >= 0) {
122 if (gpio_get_value(pinfo->gpios[GPIO_DSR]))
123 mctrl &= ~TIOCM_DSR;
124 }
125
126 if (pinfo->gpios[GPIO_DCD] >= 0) {
127 if (gpio_get_value(pinfo->gpios[GPIO_DCD]))
128 mctrl &= ~TIOCM_CAR;
129 }
130
131 if (pinfo->gpios[GPIO_RI] >= 0) {
132 if (!gpio_get_value(pinfo->gpios[GPIO_RI]))
133 mctrl |= TIOCM_RNG;
134 }
135
136 return mctrl;
106} 137}
107 138
108/* 139/*
@@ -566,7 +597,10 @@ static void cpm_uart_set_termios(struct uart_port *port,
566 out_be16(&sccp->scc_psmr, (sbits << 12) | scval); 597 out_be16(&sccp->scc_psmr, (sbits << 12) | scval);
567 } 598 }
568 599
569 cpm_set_brg(pinfo->brg - 1, baud); 600 if (pinfo->clk)
601 clk_set_rate(pinfo->clk, baud);
602 else
603 cpm_set_brg(pinfo->brg - 1, baud);
570 spin_unlock_irqrestore(&port->lock, flags); 604 spin_unlock_irqrestore(&port->lock, flags);
571} 605}
572 606
@@ -991,14 +1025,23 @@ static int cpm_uart_init_port(struct device_node *np,
991 void __iomem *mem, *pram; 1025 void __iomem *mem, *pram;
992 int len; 1026 int len;
993 int ret; 1027 int ret;
1028 int i;
994 1029
995 data = of_get_property(np, "fsl,cpm-brg", &len); 1030 data = of_get_property(np, "clock", NULL);
996 if (!data || len != 4) { 1031 if (data) {
997 printk(KERN_ERR "CPM UART %s has no/invalid " 1032 struct clk *clk = clk_get(NULL, (const char*)data);
998 "fsl,cpm-brg property.\n", np->name); 1033 if (!IS_ERR(clk))
999 return -EINVAL; 1034 pinfo->clk = clk;
1035 }
1036 if (!pinfo->clk) {
1037 data = of_get_property(np, "fsl,cpm-brg", &len);
1038 if (!data || len != 4) {
1039 printk(KERN_ERR "CPM UART %s has no/invalid "
1040 "fsl,cpm-brg property.\n", np->name);
1041 return -EINVAL;
1042 }
1043 pinfo->brg = *data;
1000 } 1044 }
1001 pinfo->brg = *data;
1002 1045
1003 data = of_get_property(np, "fsl,cpm-command", &len); 1046 data = of_get_property(np, "fsl,cpm-command", &len);
1004 if (!data || len != 4) { 1047 if (!data || len != 4) {
@@ -1050,6 +1093,9 @@ static int cpm_uart_init_port(struct device_node *np,
1050 goto out_pram; 1093 goto out_pram;
1051 } 1094 }
1052 1095
1096 for (i = 0; i < NUM_GPIOS; i++)
1097 pinfo->gpios[i] = of_get_gpio(np, i);
1098
1053 return cpm_uart_request_port(&pinfo->port); 1099 return cpm_uart_request_port(&pinfo->port);
1054 1100
1055out_pram: 1101out_pram:
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 208e42ba9455..3df2aaec829f 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -410,7 +410,6 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
410#endif 410#endif
411 411
412#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \ 412#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
413 defined(CONFIG_CPU_SUBTYPE_SH7763) || \
414 defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 413 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
415 defined(CONFIG_CPU_SUBTYPE_SH7785) 414 defined(CONFIG_CPU_SUBTYPE_SH7785)
416static inline int scif_txroom(struct uart_port *port) 415static inline int scif_txroom(struct uart_port *port)
@@ -422,6 +421,22 @@ static inline int scif_rxroom(struct uart_port *port)
422{ 421{
423 return sci_in(port, SCRFDR) & 0xff; 422 return sci_in(port, SCRFDR) & 0xff;
424} 423}
424#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
425static inline int scif_txroom(struct uart_port *port)
426{
427 if((port->mapbase == 0xffe00000) || (port->mapbase == 0xffe08000)) /* SCIF0/1*/
428 return SCIF_TXROOM_MAX - (sci_in(port, SCTFDR) & 0xff);
429 else /* SCIF2 */
430 return SCIF2_TXROOM_MAX - (sci_in(port, SCFDR) >> 8);
431}
432
433static inline int scif_rxroom(struct uart_port *port)
434{
435 if((port->mapbase == 0xffe00000) || (port->mapbase == 0xffe08000)) /* SCIF0/1*/
436 return sci_in(port, SCRFDR) & 0xff;
437 else /* SCIF2 */
438 return sci_in(port, SCFDR) & SCIF2_RFDC_MASK;
439}
425#else 440#else
426static inline int scif_txroom(struct uart_port *port) 441static inline int scif_txroom(struct uart_port *port)
427{ 442{
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index eb84833233fd..8a0749e34ca3 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -123,8 +123,9 @@
123#elif defined(CONFIG_CPU_SUBTYPE_SH7763) 123#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
124# define SCSPTR0 0xffe00024 /* 16 bit SCIF */ 124# define SCSPTR0 0xffe00024 /* 16 bit SCIF */
125# define SCSPTR1 0xffe08024 /* 16 bit SCIF */ 125# define SCSPTR1 0xffe08024 /* 16 bit SCIF */
126# define SCSPTR2 0xffe10020 /* 16 bit SCIF/IRDA */
126# define SCIF_ORER 0x0001 /* overrun error bit */ 127# define SCIF_ORER 0x0001 /* overrun error bit */
127# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 128# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
128# define SCIF_ONLY 129# define SCIF_ONLY
129#elif defined(CONFIG_CPU_SUBTYPE_SH7770) 130#elif defined(CONFIG_CPU_SUBTYPE_SH7770)
130# define SCSPTR0 0xff923020 /* 16 bit SCIF */ 131# define SCSPTR0 0xff923020 /* 16 bit SCIF */
@@ -188,6 +189,7 @@
188 defined(CONFIG_CPU_SUBTYPE_SH7750S) || \ 189 defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
189 defined(CONFIG_CPU_SUBTYPE_SH7751) || \ 190 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
190 defined(CONFIG_CPU_SUBTYPE_SH7751R) || \ 191 defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
192 defined(CONFIG_CPU_SUBTYPE_SH7763) || \
191 defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 193 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
192 defined(CONFIG_CPU_SUBTYPE_SH7785) || \ 194 defined(CONFIG_CPU_SUBTYPE_SH7785) || \
193 defined(CONFIG_CPU_SUBTYPE_SHX3) 195 defined(CONFIG_CPU_SUBTYPE_SHX3)
@@ -225,14 +227,21 @@
225#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 227#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
226 defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 228 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
227 defined(CONFIG_CPU_SUBTYPE_SH7721) 229 defined(CONFIG_CPU_SUBTYPE_SH7721)
228#define SCIF_ORER 0x0200 230# define SCIF_ORER 0x0200
229#define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER) 231# define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER)
230#define SCIF_RFDC_MASK 0x007f 232# define SCIF_RFDC_MASK 0x007f
231#define SCIF_TXROOM_MAX 64 233# define SCIF_TXROOM_MAX 64
234#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
235# define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK )
236# define SCIF_RFDC_MASK 0x007f
237# define SCIF_TXROOM_MAX 64
238/* SH7763 SCIF2 support */
239# define SCIF2_RFDC_MASK 0x001f
240# define SCIF2_TXROOM_MAX 16
232#else 241#else
233#define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) 242# define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
234#define SCIF_RFDC_MASK 0x001f 243# define SCIF_RFDC_MASK 0x001f
235#define SCIF_TXROOM_MAX 16 244# define SCIF_TXROOM_MAX 16
236#endif 245#endif
237 246
238#if defined(SCI_ONLY) 247#if defined(SCI_ONLY)
@@ -442,7 +451,6 @@ SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16, 0x04, 8)
442SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8) 451SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8)
443SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16) 452SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16)
444#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \ 453#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
445 defined(CONFIG_CPU_SUBTYPE_SH7763) || \
446 defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 454 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
447 defined(CONFIG_CPU_SUBTYPE_SH7785) 455 defined(CONFIG_CPU_SUBTYPE_SH7785)
448SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) 456SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
@@ -450,6 +458,14 @@ SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16)
450SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16) 458SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16)
451SCIF_FNS(SCSPTR, 0, 0, 0x24, 16) 459SCIF_FNS(SCSPTR, 0, 0, 0x24, 16)
452SCIF_FNS(SCLSR, 0, 0, 0x28, 16) 460SCIF_FNS(SCLSR, 0, 0, 0x28, 16)
461#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
462SCIF_FNS(SCFDR, 0, 0, 0x1C, 16)
463SCIF_FNS(SCSPTR2, 0, 0, 0x20, 16)
464SCIF_FNS(SCLSR2, 0, 0, 0x24, 16)
465SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16)
466SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16)
467SCIF_FNS(SCSPTR, 0, 0, 0x24, 16)
468SCIF_FNS(SCLSR, 0, 0, 0x28, 16)
453#else 469#else
454SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) 470SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
455#if defined(CONFIG_CPU_SUBTYPE_SH7722) 471#if defined(CONFIG_CPU_SUBTYPE_SH7722)
@@ -652,6 +668,9 @@ static inline int sci_rxd_in(struct uart_port *port)
652 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */ 668 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
653 if (port->mapbase == 0xffe08000) 669 if (port->mapbase == 0xffe08000)
654 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */ 670 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
671 if (port->mapbase == 0xffe10000)
672 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF/IRDA */
673
655 return 1; 674 return 1;
656} 675}
657#elif defined(CONFIG_CPU_SUBTYPE_SH7770) 676#elif defined(CONFIG_CPU_SUBTYPE_SH7770)
@@ -764,8 +783,7 @@ static inline int sci_rxd_in(struct uart_port *port)
764 * -- Mitch Davis - 15 Jul 2000 783 * -- Mitch Davis - 15 Jul 2000
765 */ 784 */
766 785
767#if defined(CONFIG_CPU_SUBTYPE_SH7763) || \ 786#if defined(CONFIG_CPU_SUBTYPE_SH7780) || \
768 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
769 defined(CONFIG_CPU_SUBTYPE_SH7785) 787 defined(CONFIG_CPU_SUBTYPE_SH7785)
770#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1) 788#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
771#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 789#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
diff --git a/drivers/serial/v850e_uart.c b/drivers/serial/v850e_uart.c
deleted file mode 100644
index 5acf061b6cd2..000000000000
--- a/drivers/serial/v850e_uart.c
+++ /dev/null
@@ -1,548 +0,0 @@
1/*
2 * drivers/serial/v850e_uart.c -- Serial I/O using V850E on-chip UART or UARTB
3 *
4 * Copyright (C) 2001,02,03 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
6 *
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
10 *
11 * Written by Miles Bader <miles@gnu.org>
12 */
13
14/* This driver supports both the original V850E UART interface (called
15 merely `UART' in the docs) and the newer `UARTB' interface, which is
16 roughly a superset of the first one. The selection is made at
17 configure time -- if CONFIG_V850E_UARTB is defined, then UARTB is
18 presumed, otherwise the old UART -- as these are on-CPU UARTS, a system
19 can never have both.
20
21 The UARTB interface also has a 16-entry FIFO mode, which is not
22 yet supported by this driver. */
23
24#include <linux/kernel.h>
25#include <linux/init.h>
26#include <linux/module.h>
27#include <linux/console.h>
28#include <linux/tty.h>
29#include <linux/tty_flip.h>
30#include <linux/serial.h>
31#include <linux/serial_core.h>
32
33#include <asm/v850e_uart.h>
34
35/* Initial UART state. This may be overridden by machine-dependent headers. */
36#ifndef V850E_UART_INIT_BAUD
37#define V850E_UART_INIT_BAUD 115200
38#endif
39#ifndef V850E_UART_INIT_CFLAGS
40#define V850E_UART_INIT_CFLAGS (B115200 | CS8 | CREAD)
41#endif
42
43/* A string used for prefixing printed descriptions; since the same UART
44 macro is actually used on other chips than the V850E. This must be a
45 constant string. */
46#ifndef V850E_UART_CHIP_NAME
47#define V850E_UART_CHIP_NAME "V850E"
48#endif
49
50#define V850E_UART_MINOR_BASE 64 /* First tty minor number */
51
52
53/* Low-level UART functions. */
54
55/* Configure and turn on uart channel CHAN, using the termios `control
56 modes' bits in CFLAGS, and a baud-rate of BAUD. */
57void v850e_uart_configure (unsigned chan, unsigned cflags, unsigned baud)
58{
59 int flags;
60 v850e_uart_speed_t old_speed;
61 v850e_uart_config_t old_config;
62 v850e_uart_speed_t new_speed = v850e_uart_calc_speed (baud);
63 v850e_uart_config_t new_config = v850e_uart_calc_config (cflags);
64
65 /* Disable interrupts while we're twiddling the hardware. */
66 local_irq_save (flags);
67
68#ifdef V850E_UART_PRE_CONFIGURE
69 V850E_UART_PRE_CONFIGURE (chan, cflags, baud);
70#endif
71
72 old_config = V850E_UART_CONFIG (chan);
73 old_speed = v850e_uart_speed (chan);
74
75 if (! v850e_uart_speed_eq (old_speed, new_speed)) {
76 /* The baud rate has changed. First, disable the UART. */
77 V850E_UART_CONFIG (chan) = V850E_UART_CONFIG_FINI;
78 old_config = 0; /* Force the uart to be re-initialized. */
79
80 /* Reprogram the baud-rate generator. */
81 v850e_uart_set_speed (chan, new_speed);
82 }
83
84 if (! (old_config & V850E_UART_CONFIG_ENABLED)) {
85 /* If we are using the uart for the first time, start by
86 enabling it, which must be done before turning on any
87 other bits. */
88 V850E_UART_CONFIG (chan) = V850E_UART_CONFIG_INIT;
89 /* See the initial state. */
90 old_config = V850E_UART_CONFIG (chan);
91 }
92
93 if (new_config != old_config) {
94 /* Which of the TXE/RXE bits we'll temporarily turn off
95 before changing other control bits. */
96 unsigned temp_disable = 0;
97 /* Which of the TXE/RXE bits will be enabled. */
98 unsigned enable = 0;
99 unsigned changed_bits = new_config ^ old_config;
100
101 /* Which of RX/TX will be enabled in the new configuration. */
102 if (new_config & V850E_UART_CONFIG_RX_BITS)
103 enable |= (new_config & V850E_UART_CONFIG_RX_ENABLE);
104 if (new_config & V850E_UART_CONFIG_TX_BITS)
105 enable |= (new_config & V850E_UART_CONFIG_TX_ENABLE);
106
107 /* Figure out which of RX/TX needs to be disabled; note
108 that this will only happen if they're not already
109 disabled. */
110 if (changed_bits & V850E_UART_CONFIG_RX_BITS)
111 temp_disable
112 |= (old_config & V850E_UART_CONFIG_RX_ENABLE);
113 if (changed_bits & V850E_UART_CONFIG_TX_BITS)
114 temp_disable
115 |= (old_config & V850E_UART_CONFIG_TX_ENABLE);
116
117 /* We have to turn off RX and/or TX mode before changing
118 any associated control bits. */
119 if (temp_disable)
120 V850E_UART_CONFIG (chan) = old_config & ~temp_disable;
121
122 /* Write the new control bits, while RX/TX are disabled. */
123 if (changed_bits & ~enable)
124 V850E_UART_CONFIG (chan) = new_config & ~enable;
125
126 v850e_uart_config_delay (new_config, new_speed);
127
128 /* Write the final version, with enable bits turned on. */
129 V850E_UART_CONFIG (chan) = new_config;
130 }
131
132 local_irq_restore (flags);
133}
134
135
136/* Low-level console. */
137
138#ifdef CONFIG_V850E_UART_CONSOLE
139
140static void v850e_uart_cons_write (struct console *co,
141 const char *s, unsigned count)
142{
143 if (count > 0) {
144 unsigned chan = co->index;
145 unsigned irq = V850E_UART_TX_IRQ (chan);
146 int irq_was_enabled, irq_was_pending, flags;
147
148 /* We don't want to get `transmission completed'
149 interrupts, since we're busy-waiting, so we disable them
150 while sending (we don't disable interrupts entirely
151 because sending over a serial line is really slow). We
152 save the status of the tx interrupt and restore it when
153 we're done so that using printk doesn't interfere with
154 normal serial transmission (other than interleaving the
155 output, of course!). This should work correctly even if
156 this function is interrupted and the interrupt printks
157 something. */
158
159 /* Disable interrupts while fiddling with tx interrupt. */
160 local_irq_save (flags);
161 /* Get current tx interrupt status. */
162 irq_was_enabled = v850e_intc_irq_enabled (irq);
163 irq_was_pending = v850e_intc_irq_pending (irq);
164 /* Disable tx interrupt if necessary. */
165 if (irq_was_enabled)
166 v850e_intc_disable_irq (irq);
167 /* Turn interrupts back on. */
168 local_irq_restore (flags);
169
170 /* Send characters. */
171 while (count > 0) {
172 int ch = *s++;
173
174 if (ch == '\n') {
175 /* We don't have the benefit of a tty
176 driver, so translate NL into CR LF. */
177 v850e_uart_wait_for_xmit_ok (chan);
178 v850e_uart_putc (chan, '\r');
179 }
180
181 v850e_uart_wait_for_xmit_ok (chan);
182 v850e_uart_putc (chan, ch);
183
184 count--;
185 }
186
187 /* Restore saved tx interrupt status. */
188 if (irq_was_enabled) {
189 /* Wait for the last character we sent to be
190 completely transmitted (as we'll get an
191 interrupt interrupt at that point). */
192 v850e_uart_wait_for_xmit_done (chan);
193 /* Clear pending interrupts received due
194 to our transmission, unless there was already
195 one pending, in which case we want the
196 handler to be called. */
197 if (! irq_was_pending)
198 v850e_intc_clear_pending_irq (irq);
199 /* ... and then turn back on handling. */
200 v850e_intc_enable_irq (irq);
201 }
202 }
203}
204
205extern struct uart_driver v850e_uart_driver;
206static struct console v850e_uart_cons =
207{
208 .name = "ttyS",
209 .write = v850e_uart_cons_write,
210 .device = uart_console_device,
211 .flags = CON_PRINTBUFFER,
212 .cflag = V850E_UART_INIT_CFLAGS,
213 .index = -1,
214 .data = &v850e_uart_driver,
215};
216
217void v850e_uart_cons_init (unsigned chan)
218{
219 v850e_uart_configure (chan, V850E_UART_INIT_CFLAGS,
220 V850E_UART_INIT_BAUD);
221 v850e_uart_cons.index = chan;
222 register_console (&v850e_uart_cons);
223 printk ("Console: %s on-chip UART channel %d\n",
224 V850E_UART_CHIP_NAME, chan);
225}
226
227/* This is what the init code actually calls. */
228static int v850e_uart_console_init (void)
229{
230 v850e_uart_cons_init (V850E_UART_CONSOLE_CHANNEL);
231 return 0;
232}
233console_initcall(v850e_uart_console_init);
234
235#define V850E_UART_CONSOLE &v850e_uart_cons
236
237#else /* !CONFIG_V850E_UART_CONSOLE */
238#define V850E_UART_CONSOLE 0
239#endif /* CONFIG_V850E_UART_CONSOLE */
240
241/* TX/RX interrupt handlers. */
242
243static void v850e_uart_stop_tx (struct uart_port *port);
244
245void v850e_uart_tx (struct uart_port *port)
246{
247 struct circ_buf *xmit = &port->info->xmit;
248 int stopped = uart_tx_stopped (port);
249
250 if (v850e_uart_xmit_ok (port->line)) {
251 int tx_ch;
252
253 if (port->x_char) {
254 tx_ch = port->x_char;
255 port->x_char = 0;
256 } else if (!uart_circ_empty (xmit) && !stopped) {
257 tx_ch = xmit->buf[xmit->tail];
258 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
259 } else
260 goto no_xmit;
261
262 v850e_uart_putc (port->line, tx_ch);
263 port->icount.tx++;
264
265 if (uart_circ_chars_pending (xmit) < WAKEUP_CHARS)
266 uart_write_wakeup (port);
267 }
268
269 no_xmit:
270 if (uart_circ_empty (xmit) || stopped)
271 v850e_uart_stop_tx (port, stopped);
272}
273
274static irqreturn_t v850e_uart_tx_irq(int irq, void *data)
275{
276 struct uart_port *port = data;
277 v850e_uart_tx (port);
278 return IRQ_HANDLED;
279}
280
281static irqreturn_t v850e_uart_rx_irq(int irq, void *data)
282{
283 struct uart_port *port = data;
284 unsigned ch_stat = TTY_NORMAL;
285 unsigned ch = v850e_uart_getc (port->line);
286 unsigned err = v850e_uart_err (port->line);
287
288 if (err) {
289 if (err & V850E_UART_ERR_OVERRUN) {
290 ch_stat = TTY_OVERRUN;
291 port->icount.overrun++;
292 } else if (err & V850E_UART_ERR_FRAME) {
293 ch_stat = TTY_FRAME;
294 port->icount.frame++;
295 } else if (err & V850E_UART_ERR_PARITY) {
296 ch_stat = TTY_PARITY;
297 port->icount.parity++;
298 }
299 }
300
301 port->icount.rx++;
302
303 tty_insert_flip_char (port->info->port.tty, ch, ch_stat);
304 tty_schedule_flip (port->info->port.tty);
305
306 return IRQ_HANDLED;
307}
308
309
310/* Control functions for the serial framework. */
311
312static void v850e_uart_nop (struct uart_port *port) { }
313static int v850e_uart_success (struct uart_port *port) { return 0; }
314
315static unsigned v850e_uart_tx_empty (struct uart_port *port)
316{
317 return TIOCSER_TEMT; /* Can't detect. */
318}
319
320static void v850e_uart_set_mctrl (struct uart_port *port, unsigned mctrl)
321{
322#ifdef V850E_UART_SET_RTS
323 V850E_UART_SET_RTS (port->line, (mctrl & TIOCM_RTS));
324#endif
325}
326
327static unsigned v850e_uart_get_mctrl (struct uart_port *port)
328{
329 /* We don't support DCD or DSR, so consider them permanently active. */
330 int mctrl = TIOCM_CAR | TIOCM_DSR;
331
332 /* We may support CTS. */
333#ifdef V850E_UART_CTS
334 mctrl |= V850E_UART_CTS(port->line) ? TIOCM_CTS : 0;
335#else
336 mctrl |= TIOCM_CTS;
337#endif
338
339 return mctrl;
340}
341
342static void v850e_uart_start_tx (struct uart_port *port)
343{
344 v850e_intc_disable_irq (V850E_UART_TX_IRQ (port->line));
345 v850e_uart_tx (port);
346 v850e_intc_enable_irq (V850E_UART_TX_IRQ (port->line));
347}
348
349static void v850e_uart_stop_tx (struct uart_port *port)
350{
351 v850e_intc_disable_irq (V850E_UART_TX_IRQ (port->line));
352}
353
354static void v850e_uart_start_rx (struct uart_port *port)
355{
356 v850e_intc_enable_irq (V850E_UART_RX_IRQ (port->line));
357}
358
359static void v850e_uart_stop_rx (struct uart_port *port)
360{
361 v850e_intc_disable_irq (V850E_UART_RX_IRQ (port->line));
362}
363
364static void v850e_uart_break_ctl (struct uart_port *port, int break_ctl)
365{
366 /* Umm, do this later. */
367}
368
369static int v850e_uart_startup (struct uart_port *port)
370{
371 int err;
372
373 /* Alloc RX irq. */
374 err = request_irq (V850E_UART_RX_IRQ (port->line), v850e_uart_rx_irq,
375 IRQF_DISABLED, "v850e_uart", port);
376 if (err)
377 return err;
378
379 /* Alloc TX irq. */
380 err = request_irq (V850E_UART_TX_IRQ (port->line), v850e_uart_tx_irq,
381 IRQF_DISABLED, "v850e_uart", port);
382 if (err) {
383 free_irq (V850E_UART_RX_IRQ (port->line), port);
384 return err;
385 }
386
387 v850e_uart_start_rx (port);
388
389 return 0;
390}
391
392static void v850e_uart_shutdown (struct uart_port *port)
393{
394 /* Disable port interrupts. */
395 free_irq (V850E_UART_TX_IRQ (port->line), port);
396 free_irq (V850E_UART_RX_IRQ (port->line), port);
397
398 /* Turn off xmit/recv enable bits. */
399 V850E_UART_CONFIG (port->line)
400 &= ~(V850E_UART_CONFIG_TX_ENABLE
401 | V850E_UART_CONFIG_RX_ENABLE);
402 /* Then reset the channel. */
403 V850E_UART_CONFIG (port->line) = 0;
404}
405
406static void
407v850e_uart_set_termios (struct uart_port *port, struct ktermios *termios,
408 struct ktermios *old)
409{
410 unsigned cflags = termios->c_cflag;
411
412 /* Restrict flags to legal values. */
413 if ((cflags & CSIZE) != CS7 && (cflags & CSIZE) != CS8)
414 /* The new value of CSIZE is invalid, use the old value. */
415 cflags = (cflags & ~CSIZE)
416 | (old ? (old->c_cflag & CSIZE) : CS8);
417
418 termios->c_cflag = cflags;
419
420 v850e_uart_configure (port->line, cflags,
421 uart_get_baud_rate (port, termios, old,
422 v850e_uart_min_baud(),
423 v850e_uart_max_baud()));
424}
425
426static const char *v850e_uart_type (struct uart_port *port)
427{
428 return port->type == PORT_V850E_UART ? "v850e_uart" : 0;
429}
430
431static void v850e_uart_config_port (struct uart_port *port, int flags)
432{
433 if (flags & UART_CONFIG_TYPE)
434 port->type = PORT_V850E_UART;
435}
436
437static int
438v850e_uart_verify_port (struct uart_port *port, struct serial_struct *ser)
439{
440 if (ser->type != PORT_UNKNOWN && ser->type != PORT_V850E_UART)
441 return -EINVAL;
442 if (ser->irq != V850E_UART_TX_IRQ (port->line))
443 return -EINVAL;
444 return 0;
445}
446
447static struct uart_ops v850e_uart_ops = {
448 .tx_empty = v850e_uart_tx_empty,
449 .get_mctrl = v850e_uart_get_mctrl,
450 .set_mctrl = v850e_uart_set_mctrl,
451 .start_tx = v850e_uart_start_tx,
452 .stop_tx = v850e_uart_stop_tx,
453 .stop_rx = v850e_uart_stop_rx,
454 .enable_ms = v850e_uart_nop,
455 .break_ctl = v850e_uart_break_ctl,
456 .startup = v850e_uart_startup,
457 .shutdown = v850e_uart_shutdown,
458 .set_termios = v850e_uart_set_termios,
459 .type = v850e_uart_type,
460 .release_port = v850e_uart_nop,
461 .request_port = v850e_uart_success,
462 .config_port = v850e_uart_config_port,
463 .verify_port = v850e_uart_verify_port,
464};
465
466/* Initialization and cleanup. */
467
468static struct uart_driver v850e_uart_driver = {
469 .owner = THIS_MODULE,
470 .driver_name = "v850e_uart",
471 .dev_name = "ttyS",
472 .major = TTY_MAJOR,
473 .minor = V850E_UART_MINOR_BASE,
474 .nr = V850E_UART_NUM_CHANNELS,
475 .cons = V850E_UART_CONSOLE,
476};
477
478
479static struct uart_port v850e_uart_ports[V850E_UART_NUM_CHANNELS];
480
481static int __init v850e_uart_init (void)
482{
483 int rval;
484
485 printk (KERN_INFO "%s on-chip UART\n", V850E_UART_CHIP_NAME);
486
487 rval = uart_register_driver (&v850e_uart_driver);
488 if (rval == 0) {
489 unsigned chan;
490
491 for (chan = 0; chan < V850E_UART_NUM_CHANNELS; chan++) {
492 struct uart_port *port = &v850e_uart_ports[chan];
493
494 memset (port, 0, sizeof *port);
495
496 port->ops = &v850e_uart_ops;
497 port->line = chan;
498 port->iotype = UPIO_MEM;
499 port->flags = UPF_BOOT_AUTOCONF;
500
501 /* We actually use multiple IRQs, but the serial
502 framework seems to mainly use this for
503 informational purposes anyway. Here we use the TX
504 irq. */
505 port->irq = V850E_UART_TX_IRQ (chan);
506
507 /* The serial framework doesn't really use these
508 membase/mapbase fields for anything useful, but
509 it requires that they be something non-zero to
510 consider the port `valid', and also uses them
511 for informational purposes. */
512 port->membase = (void *)V850E_UART_BASE_ADDR (chan);
513 port->mapbase = V850E_UART_BASE_ADDR (chan);
514
515 /* The framework insists on knowing the uart's master
516 clock freq, though it doesn't seem to do anything
517 useful for us with it. We must make it at least
518 higher than (the maximum baud rate * 16), otherwise
519 the framework will puke during its internal
520 calculations, and force the baud rate to be 9600.
521 To be accurate though, just repeat the calculation
522 we use when actually setting the speed. */
523 port->uartclk = v850e_uart_max_clock() * 16;
524
525 uart_add_one_port (&v850e_uart_driver, port);
526 }
527 }
528
529 return rval;
530}
531
532static void __exit v850e_uart_exit (void)
533{
534 unsigned chan;
535
536 for (chan = 0; chan < V850E_UART_NUM_CHANNELS; chan++)
537 uart_remove_one_port (&v850e_uart_driver,
538 &v850e_uart_ports[chan]);
539
540 uart_unregister_driver (&v850e_uart_driver);
541}
542
543module_init (v850e_uart_init);
544module_exit (v850e_uart_exit);
545
546MODULE_AUTHOR ("Miles Bader");
547MODULE_DESCRIPTION ("NEC " V850E_UART_CHIP_NAME " on-chip UART");
548MODULE_LICENSE ("GPL");
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 617efb1640b1..be97789fa5fd 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -24,13 +24,12 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/maple.h> 25#include <linux/maple.h>
26#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
27#include <linux/delay.h>
27#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
28#include <asm/dma.h> 29#include <asm/dma.h>
29#include <asm/io.h> 30#include <asm/io.h>
30#include <asm/mach/dma.h> 31#include <mach/dma.h>
31#include <asm/mach/sysasic.h> 32#include <mach/sysasic.h>
32#include <asm/mach/maple.h>
33#include <linux/delay.h>
34 33
35MODULE_AUTHOR("Yaegshi Takeshi, Paul Mundt, M.R. Brown, Adrian McMenamin"); 34MODULE_AUTHOR("Yaegshi Takeshi, Paul Mundt, M.R. Brown, Adrian McMenamin");
36MODULE_DESCRIPTION("Maple bus driver for Dreamcast"); 35MODULE_DESCRIPTION("Maple bus driver for Dreamcast");
@@ -46,14 +45,15 @@ static DECLARE_WORK(maple_vblank_process, maple_vblank_handler);
46static LIST_HEAD(maple_waitq); 45static LIST_HEAD(maple_waitq);
47static LIST_HEAD(maple_sentq); 46static LIST_HEAD(maple_sentq);
48 47
49static DEFINE_MUTEX(maple_list_lock); 48/* mutex to protect queue of waiting packets */
49static DEFINE_MUTEX(maple_wlist_lock);
50 50
51static struct maple_driver maple_dummy_driver; 51static struct maple_driver maple_dummy_driver;
52static struct device maple_bus; 52static struct device maple_bus;
53static int subdevice_map[MAPLE_PORTS]; 53static int subdevice_map[MAPLE_PORTS];
54static unsigned long *maple_sendbuf, *maple_sendptr, *maple_lastptr; 54static unsigned long *maple_sendbuf, *maple_sendptr, *maple_lastptr;
55static unsigned long maple_pnp_time; 55static unsigned long maple_pnp_time;
56static int started, scanning, liststatus, fullscan; 56static int started, scanning, fullscan;
57static struct kmem_cache *maple_queue_cache; 57static struct kmem_cache *maple_queue_cache;
58 58
59struct maple_device_specify { 59struct maple_device_specify {
@@ -129,35 +129,124 @@ static void maple_release_device(struct device *dev)
129 kfree(mdev); 129 kfree(mdev);
130} 130}
131 131
132/** 132/*
133 * maple_add_packet - add a single instruction to the queue 133 * maple_add_packet - add a single instruction to the queue
134 * @mq: instruction to add to waiting queue 134 * @mdev - maple device
135 * @function - function on device being queried
136 * @command - maple command to add
137 * @length - length of command string (in 32 bit words)
138 * @data - remainder of command string
135 */ 139 */
136void maple_add_packet(struct mapleq *mq) 140int maple_add_packet(struct maple_device *mdev, u32 function, u32 command,
141 size_t length, void *data)
137{ 142{
138 mutex_lock(&maple_list_lock); 143 int locking, ret = 0;
139 list_add(&mq->list, &maple_waitq); 144 void *sendbuf = NULL;
140 mutex_unlock(&maple_list_lock); 145
146 mutex_lock(&maple_wlist_lock);
147 /* bounce if device already locked */
148 locking = mutex_is_locked(&mdev->mq->mutex);
149 if (locking) {
150 ret = -EBUSY;
151 goto out;
152 }
153
154 mutex_lock(&mdev->mq->mutex);
155
156 if (length) {
157 sendbuf = kmalloc(length * 4, GFP_KERNEL);
158 if (!sendbuf) {
159 mutex_unlock(&mdev->mq->mutex);
160 ret = -ENOMEM;
161 goto out;
162 }
163 ((__be32 *)sendbuf)[0] = cpu_to_be32(function);
164 }
165
166 mdev->mq->command = command;
167 mdev->mq->length = length;
168 if (length > 1)
169 memcpy(sendbuf + 4, data, (length - 1) * 4);
170 mdev->mq->sendbuf = sendbuf;
171
172 list_add(&mdev->mq->list, &maple_waitq);
173out:
174 mutex_unlock(&maple_wlist_lock);
175 return ret;
141} 176}
142EXPORT_SYMBOL_GPL(maple_add_packet); 177EXPORT_SYMBOL_GPL(maple_add_packet);
143 178
179/*
180 * maple_add_packet_sleeps - add a single instruction to the queue
181 * - waits for lock to be free
182 * @mdev - maple device
183 * @function - function on device being queried
184 * @command - maple command to add
185 * @length - length of command string (in 32 bit words)
186 * @data - remainder of command string
187 */
188int maple_add_packet_sleeps(struct maple_device *mdev, u32 function,
189 u32 command, size_t length, void *data)
190{
191 int locking, ret = 0;
192 void *sendbuf = NULL;
193
194 locking = mutex_lock_interruptible(&mdev->mq->mutex);
195 if (locking) {
196 ret = -EIO;
197 goto out;
198 }
199
200 if (length) {
201 sendbuf = kmalloc(length * 4, GFP_KERNEL);
202 if (!sendbuf) {
203 mutex_unlock(&mdev->mq->mutex);
204 ret = -ENOMEM;
205 goto out;
206 }
207 ((__be32 *)sendbuf)[0] = cpu_to_be32(function);
208 }
209
210 mdev->mq->command = command;
211 mdev->mq->length = length;
212 if (length > 1)
213 memcpy(sendbuf + 4, data, (length - 1) * 4);
214 mdev->mq->sendbuf = sendbuf;
215
216 mutex_lock(&maple_wlist_lock);
217 list_add(&mdev->mq->list, &maple_waitq);
218 mutex_unlock(&maple_wlist_lock);
219out:
220 return ret;
221}
222EXPORT_SYMBOL_GPL(maple_add_packet_sleeps);
223
144static struct mapleq *maple_allocq(struct maple_device *mdev) 224static struct mapleq *maple_allocq(struct maple_device *mdev)
145{ 225{
146 struct mapleq *mq; 226 struct mapleq *mq;
147 227
148 mq = kmalloc(sizeof(*mq), GFP_KERNEL); 228 mq = kmalloc(sizeof(*mq), GFP_KERNEL);
149 if (!mq) 229 if (!mq)
150 return NULL; 230 goto failed_nomem;
151 231
152 mq->dev = mdev; 232 mq->dev = mdev;
153 mq->recvbufdcsp = kmem_cache_zalloc(maple_queue_cache, GFP_KERNEL); 233 mq->recvbufdcsp = kmem_cache_zalloc(maple_queue_cache, GFP_KERNEL);
154 mq->recvbuf = (void *) P2SEGADDR(mq->recvbufdcsp); 234 mq->recvbuf = (void *) P2SEGADDR(mq->recvbufdcsp);
155 if (!mq->recvbuf) { 235 if (!mq->recvbuf)
156 kfree(mq); 236 goto failed_p2;
157 return NULL; 237 /*
158 } 238 * most devices do not need the mutex - but
239 * anything that injects block reads or writes
240 * will rely on it
241 */
242 mutex_init(&mq->mutex);
159 243
160 return mq; 244 return mq;
245
246failed_p2:
247 kfree(mq);
248failed_nomem:
249 return NULL;
161} 250}
162 251
163static struct maple_device *maple_alloc_dev(int port, int unit) 252static struct maple_device *maple_alloc_dev(int port, int unit)
@@ -178,7 +267,6 @@ static struct maple_device *maple_alloc_dev(int port, int unit)
178 } 267 }
179 mdev->dev.bus = &maple_bus_type; 268 mdev->dev.bus = &maple_bus_type;
180 mdev->dev.parent = &maple_bus; 269 mdev->dev.parent = &maple_bus;
181 mdev->function = 0;
182 return mdev; 270 return mdev;
183} 271}
184 272
@@ -216,7 +304,6 @@ static void maple_build_block(struct mapleq *mq)
216 *maple_sendptr++ = PHYSADDR(mq->recvbuf); 304 *maple_sendptr++ = PHYSADDR(mq->recvbuf);
217 *maple_sendptr++ = 305 *maple_sendptr++ =
218 mq->command | (to << 8) | (from << 16) | (len << 24); 306 mq->command | (to << 8) | (from << 16) | (len << 24);
219
220 while (len-- > 0) 307 while (len-- > 0)
221 *maple_sendptr++ = *lsendbuf++; 308 *maple_sendptr++ = *lsendbuf++;
222} 309}
@@ -224,22 +311,27 @@ static void maple_build_block(struct mapleq *mq)
224/* build up command queue */ 311/* build up command queue */
225static void maple_send(void) 312static void maple_send(void)
226{ 313{
227 int i; 314 int i, maple_packets = 0;
228 int maple_packets;
229 struct mapleq *mq, *nmq; 315 struct mapleq *mq, *nmq;
230 316
231 if (!list_empty(&maple_sentq)) 317 if (!list_empty(&maple_sentq))
232 return; 318 return;
233 if (list_empty(&maple_waitq) || !maple_dma_done()) 319 mutex_lock(&maple_wlist_lock);
320 if (list_empty(&maple_waitq) || !maple_dma_done()) {
321 mutex_unlock(&maple_wlist_lock);
234 return; 322 return;
235 maple_packets = 0; 323 }
236 maple_sendptr = maple_lastptr = maple_sendbuf; 324 mutex_unlock(&maple_wlist_lock);
325 maple_lastptr = maple_sendbuf;
326 maple_sendptr = maple_sendbuf;
327 mutex_lock(&maple_wlist_lock);
237 list_for_each_entry_safe(mq, nmq, &maple_waitq, list) { 328 list_for_each_entry_safe(mq, nmq, &maple_waitq, list) {
238 maple_build_block(mq); 329 maple_build_block(mq);
239 list_move(&mq->list, &maple_sentq); 330 list_move(&mq->list, &maple_sentq);
240 if (maple_packets++ > MAPLE_MAXPACKETS) 331 if (maple_packets++ > MAPLE_MAXPACKETS)
241 break; 332 break;
242 } 333 }
334 mutex_unlock(&maple_wlist_lock);
243 if (maple_packets > 0) { 335 if (maple_packets > 0) {
244 for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++) 336 for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++)
245 dma_cache_sync(0, maple_sendbuf + i * PAGE_SIZE, 337 dma_cache_sync(0, maple_sendbuf + i * PAGE_SIZE,
@@ -247,7 +339,8 @@ static void maple_send(void)
247 } 339 }
248} 340}
249 341
250static int attach_matching_maple_driver(struct device_driver *driver, 342/* check if there is a driver registered likely to match this device */
343static int check_matching_maple_driver(struct device_driver *driver,
251 void *devptr) 344 void *devptr)
252{ 345{
253 struct maple_driver *maple_drv; 346 struct maple_driver *maple_drv;
@@ -255,12 +348,8 @@ static int attach_matching_maple_driver(struct device_driver *driver,
255 348
256 mdev = devptr; 349 mdev = devptr;
257 maple_drv = to_maple_driver(driver); 350 maple_drv = to_maple_driver(driver);
258 if (mdev->devinfo.function & be32_to_cpu(maple_drv->function)) { 351 if (mdev->devinfo.function & cpu_to_be32(maple_drv->function))
259 if (maple_drv->connect(mdev) == 0) { 352 return 1;
260 mdev->driver = maple_drv;
261 return 1;
262 }
263 }
264 return 0; 353 return 0;
265} 354}
266 355
@@ -268,11 +357,6 @@ static void maple_detach_driver(struct maple_device *mdev)
268{ 357{
269 if (!mdev) 358 if (!mdev)
270 return; 359 return;
271 if (mdev->driver) {
272 if (mdev->driver->disconnect)
273 mdev->driver->disconnect(mdev);
274 }
275 mdev->driver = NULL;
276 device_unregister(&mdev->dev); 360 device_unregister(&mdev->dev);
277 mdev = NULL; 361 mdev = NULL;
278} 362}
@@ -328,8 +412,8 @@ static void maple_attach_driver(struct maple_device *mdev)
328 mdev->port, mdev->unit, function); 412 mdev->port, mdev->unit, function);
329 413
330 matched = 414 matched =
331 bus_for_each_drv(&maple_bus_type, NULL, mdev, 415 bus_for_each_drv(&maple_bus_type, NULL, mdev,
332 attach_matching_maple_driver); 416 check_matching_maple_driver);
333 417
334 if (matched == 0) { 418 if (matched == 0) {
335 /* Driver does not exist yet */ 419 /* Driver does not exist yet */
@@ -373,45 +457,48 @@ static int detach_maple_device(struct device *device, void *portptr)
373 457
374static int setup_maple_commands(struct device *device, void *ignored) 458static int setup_maple_commands(struct device *device, void *ignored)
375{ 459{
460 int add;
376 struct maple_device *maple_dev = to_maple_dev(device); 461 struct maple_device *maple_dev = to_maple_dev(device);
377 462
378 if ((maple_dev->interval > 0) 463 if ((maple_dev->interval > 0)
379 && time_after(jiffies, maple_dev->when)) { 464 && time_after(jiffies, maple_dev->when)) {
380 maple_dev->when = jiffies + maple_dev->interval; 465 /* bounce if we cannot lock */
381 maple_dev->mq->command = MAPLE_COMMAND_GETCOND; 466 add = maple_add_packet(maple_dev,
382 maple_dev->mq->sendbuf = &maple_dev->function; 467 be32_to_cpu(maple_dev->devinfo.function),
383 maple_dev->mq->length = 1; 468 MAPLE_COMMAND_GETCOND, 1, NULL);
384 maple_add_packet(maple_dev->mq); 469 if (!add)
385 liststatus++; 470 maple_dev->when = jiffies + maple_dev->interval;
386 } else { 471 } else {
387 if (time_after(jiffies, maple_pnp_time)) { 472 if (time_after(jiffies, maple_pnp_time))
388 maple_dev->mq->command = MAPLE_COMMAND_DEVINFO; 473 /* This will also bounce */
389 maple_dev->mq->length = 0; 474 maple_add_packet(maple_dev, 0,
390 maple_add_packet(maple_dev->mq); 475 MAPLE_COMMAND_DEVINFO, 0, NULL);
391 liststatus++;
392 }
393 } 476 }
394
395 return 0; 477 return 0;
396} 478}
397 479
398/* VBLANK bottom half - implemented via workqueue */ 480/* VBLANK bottom half - implemented via workqueue */
399static void maple_vblank_handler(struct work_struct *work) 481static void maple_vblank_handler(struct work_struct *work)
400{ 482{
401 if (!maple_dma_done()) 483 if (!list_empty(&maple_sentq) || !maple_dma_done())
402 return;
403 if (!list_empty(&maple_sentq))
404 return; 484 return;
485
405 ctrl_outl(0, MAPLE_ENABLE); 486 ctrl_outl(0, MAPLE_ENABLE);
406 liststatus = 0; 487
407 bus_for_each_dev(&maple_bus_type, NULL, NULL, 488 bus_for_each_dev(&maple_bus_type, NULL, NULL,
408 setup_maple_commands); 489 setup_maple_commands);
490
409 if (time_after(jiffies, maple_pnp_time)) 491 if (time_after(jiffies, maple_pnp_time))
410 maple_pnp_time = jiffies + MAPLE_PNP_INTERVAL; 492 maple_pnp_time = jiffies + MAPLE_PNP_INTERVAL;
411 if (liststatus && list_empty(&maple_sentq)) { 493
412 INIT_LIST_HEAD(&maple_sentq); 494 mutex_lock(&maple_wlist_lock);
495 if (!list_empty(&maple_waitq) && list_empty(&maple_sentq)) {
496 mutex_unlock(&maple_wlist_lock);
413 maple_send(); 497 maple_send();
498 } else {
499 mutex_unlock(&maple_wlist_lock);
414 } 500 }
501
415 maplebus_dma_reset(); 502 maplebus_dma_reset();
416} 503}
417 504
@@ -422,8 +509,8 @@ static void maple_map_subunits(struct maple_device *mdev, int submask)
422 struct maple_device *mdev_add; 509 struct maple_device *mdev_add;
423 struct maple_device_specify ds; 510 struct maple_device_specify ds;
424 511
512 ds.port = mdev->port;
425 for (k = 0; k < 5; k++) { 513 for (k = 0; k < 5; k++) {
426 ds.port = mdev->port;
427 ds.unit = k + 1; 514 ds.unit = k + 1;
428 retval = 515 retval =
429 bus_for_each_dev(&maple_bus_type, NULL, &ds, 516 bus_for_each_dev(&maple_bus_type, NULL, &ds,
@@ -437,9 +524,9 @@ static void maple_map_subunits(struct maple_device *mdev, int submask)
437 mdev_add = maple_alloc_dev(mdev->port, k + 1); 524 mdev_add = maple_alloc_dev(mdev->port, k + 1);
438 if (!mdev_add) 525 if (!mdev_add)
439 return; 526 return;
440 mdev_add->mq->command = MAPLE_COMMAND_DEVINFO; 527 maple_add_packet(mdev_add, 0, MAPLE_COMMAND_DEVINFO,
441 mdev_add->mq->length = 0; 528 0, NULL);
442 maple_add_packet(mdev_add->mq); 529 /* mark that we are checking sub devices */
443 scanning = 1; 530 scanning = 1;
444 } 531 }
445 submask = submask >> 1; 532 submask = submask >> 1;
@@ -505,6 +592,28 @@ static void maple_response_devinfo(struct maple_device *mdev,
505 } 592 }
506} 593}
507 594
595static void maple_port_rescan(void)
596{
597 int i;
598 struct maple_device *mdev;
599
600 fullscan = 1;
601 for (i = 0; i < MAPLE_PORTS; i++) {
602 if (checked[i] == false) {
603 fullscan = 0;
604 mdev = baseunits[i];
605 /*
606 * test lock in case scan has failed
607 * but device is still locked
608 */
609 if (mutex_is_locked(&mdev->mq->mutex))
610 mutex_unlock(&mdev->mq->mutex);
611 maple_add_packet(mdev, 0, MAPLE_COMMAND_DEVINFO,
612 0, NULL);
613 }
614 }
615}
616
508/* maple dma end bottom half - implemented via workqueue */ 617/* maple dma end bottom half - implemented via workqueue */
509static void maple_dma_handler(struct work_struct *work) 618static void maple_dma_handler(struct work_struct *work)
510{ 619{
@@ -512,7 +621,6 @@ static void maple_dma_handler(struct work_struct *work)
512 struct maple_device *dev; 621 struct maple_device *dev;
513 char *recvbuf; 622 char *recvbuf;
514 enum maple_code code; 623 enum maple_code code;
515 int i;
516 624
517 if (!maple_dma_done()) 625 if (!maple_dma_done())
518 return; 626 return;
@@ -522,6 +630,10 @@ static void maple_dma_handler(struct work_struct *work)
522 recvbuf = mq->recvbuf; 630 recvbuf = mq->recvbuf;
523 code = recvbuf[0]; 631 code = recvbuf[0];
524 dev = mq->dev; 632 dev = mq->dev;
633 kfree(mq->sendbuf);
634 mutex_unlock(&mq->mutex);
635 list_del_init(&mq->list);
636
525 switch (code) { 637 switch (code) {
526 case MAPLE_RESPONSE_NONE: 638 case MAPLE_RESPONSE_NONE:
527 maple_response_none(dev, mq); 639 maple_response_none(dev, mq);
@@ -558,26 +670,16 @@ static void maple_dma_handler(struct work_struct *work)
558 break; 670 break;
559 } 671 }
560 } 672 }
561 INIT_LIST_HEAD(&maple_sentq); 673 /* if scanning is 1 then we have subdevices to check */
562 if (scanning == 1) { 674 if (scanning == 1) {
563 maple_send(); 675 maple_send();
564 scanning = 2; 676 scanning = 2;
565 } else 677 } else
566 scanning = 0; 678 scanning = 0;
567 679 /*check if we have actually tested all ports yet */
568 if (!fullscan) { 680 if (!fullscan)
569 fullscan = 1; 681 maple_port_rescan();
570 for (i = 0; i < MAPLE_PORTS; i++) { 682 /* mark that we have been through the first scan */
571 if (checked[i] == false) {
572 fullscan = 0;
573 dev = baseunits[i];
574 dev->mq->command =
575 MAPLE_COMMAND_DEVINFO;
576 dev->mq->length = 0;
577 maple_add_packet(dev->mq);
578 }
579 }
580 }
581 if (started == 0) 683 if (started == 0)
582 started = 1; 684 started = 1;
583 } 685 }
@@ -631,7 +733,7 @@ static int match_maple_bus_driver(struct device *devptr,
631 if (maple_dev->devinfo.function == 0xFFFFFFFF) 733 if (maple_dev->devinfo.function == 0xFFFFFFFF)
632 return 0; 734 return 0;
633 else if (maple_dev->devinfo.function & 735 else if (maple_dev->devinfo.function &
634 be32_to_cpu(maple_drv->function)) 736 cpu_to_be32(maple_drv->function))
635 return 1; 737 return 1;
636 return 0; 738 return 0;
637} 739}
@@ -713,6 +815,9 @@ static int __init maple_bus_init(void)
713 if (!maple_queue_cache) 815 if (!maple_queue_cache)
714 goto cleanup_bothirqs; 816 goto cleanup_bothirqs;
715 817
818 INIT_LIST_HEAD(&maple_waitq);
819 INIT_LIST_HEAD(&maple_sentq);
820
716 /* setup maple ports */ 821 /* setup maple ports */
717 for (i = 0; i < MAPLE_PORTS; i++) { 822 for (i = 0; i < MAPLE_PORTS; i++) {
718 checked[i] = false; 823 checked[i] = false;
@@ -723,9 +828,7 @@ static int __init maple_bus_init(void)
723 maple_free_dev(mdev[i]); 828 maple_free_dev(mdev[i]);
724 goto cleanup_cache; 829 goto cleanup_cache;
725 } 830 }
726 mdev[i]->mq->command = MAPLE_COMMAND_DEVINFO; 831 maple_add_packet(mdev[i], 0, MAPLE_COMMAND_DEVINFO, 0, NULL);
727 mdev[i]->mq->length = 0;
728 maple_add_packet(mdev[i]->mq);
729 subdevice_map[i] = 0; 832 subdevice_map[i] = 0;
730 } 833 }
731 834
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 604e5f0a2d95..25eda71f4bf4 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -148,7 +148,6 @@ static int mpc52xx_psc_spi_transfer_rxtx(struct spi_device *spi,
148 unsigned rfalarm; 148 unsigned rfalarm;
149 unsigned send_at_once = MPC52xx_PSC_BUFSIZE; 149 unsigned send_at_once = MPC52xx_PSC_BUFSIZE;
150 unsigned recv_at_once; 150 unsigned recv_at_once;
151 unsigned bpw = mps->bits_per_word / 8;
152 151
153 if (!t->tx_buf && !t->rx_buf && t->len) 152 if (!t->tx_buf && !t->rx_buf && t->len)
154 return -EINVAL; 153 return -EINVAL;
@@ -164,22 +163,15 @@ static int mpc52xx_psc_spi_transfer_rxtx(struct spi_device *spi,
164 } 163 }
165 164
166 dev_dbg(&spi->dev, "send %d bytes...\n", send_at_once); 165 dev_dbg(&spi->dev, "send %d bytes...\n", send_at_once);
167 if (tx_buf) { 166 for (; send_at_once; sb++, send_at_once--) {
168 for (; send_at_once; sb++, send_at_once--) { 167 /* set EOF flag before the last word is sent */
169 /* set EOF flag */ 168 if (send_at_once == 1)
170 if (mps->bits_per_word 169 out_8(&psc->ircr2, 0x01);
171 && (sb + 1) % bpw == 0) 170
172 out_8(&psc->ircr2, 0x01); 171 if (tx_buf)
173 out_8(&psc->mpc52xx_psc_buffer_8, tx_buf[sb]); 172 out_8(&psc->mpc52xx_psc_buffer_8, tx_buf[sb]);
174 } 173 else
175 } else {
176 for (; send_at_once; sb++, send_at_once--) {
177 /* set EOF flag */
178 if (mps->bits_per_word
179 && ((sb + 1) % bpw) == 0)
180 out_8(&psc->ircr2, 0x01);
181 out_8(&psc->mpc52xx_psc_buffer_8, 0); 174 out_8(&psc->mpc52xx_psc_buffer_8, 0);
182 }
183 } 175 }
184 176
185 177
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index ecca4a6a6f94..964124b60db2 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -178,6 +178,96 @@ struct boardinfo {
178static LIST_HEAD(board_list); 178static LIST_HEAD(board_list);
179static DEFINE_MUTEX(board_lock); 179static DEFINE_MUTEX(board_lock);
180 180
181/**
182 * spi_alloc_device - Allocate a new SPI device
183 * @master: Controller to which device is connected
184 * Context: can sleep
185 *
186 * Allows a driver to allocate and initialize a spi_device without
187 * registering it immediately. This allows a driver to directly
188 * fill the spi_device with device parameters before calling
189 * spi_add_device() on it.
190 *
191 * Caller is responsible to call spi_add_device() on the returned
192 * spi_device structure to add it to the SPI master. If the caller
193 * needs to discard the spi_device without adding it, then it should
194 * call spi_dev_put() on it.
195 *
196 * Returns a pointer to the new device, or NULL.
197 */
198struct spi_device *spi_alloc_device(struct spi_master *master)
199{
200 struct spi_device *spi;
201 struct device *dev = master->dev.parent;
202
203 if (!spi_master_get(master))
204 return NULL;
205
206 spi = kzalloc(sizeof *spi, GFP_KERNEL);
207 if (!spi) {
208 dev_err(dev, "cannot alloc spi_device\n");
209 spi_master_put(master);
210 return NULL;
211 }
212
213 spi->master = master;
214 spi->dev.parent = dev;
215 spi->dev.bus = &spi_bus_type;
216 spi->dev.release = spidev_release;
217 device_initialize(&spi->dev);
218 return spi;
219}
220EXPORT_SYMBOL_GPL(spi_alloc_device);
221
222/**
223 * spi_add_device - Add spi_device allocated with spi_alloc_device
224 * @spi: spi_device to register
225 *
226 * Companion function to spi_alloc_device. Devices allocated with
227 * spi_alloc_device can be added onto the spi bus with this function.
228 *
229 * Returns 0 on success; non-zero on failure
230 */
231int spi_add_device(struct spi_device *spi)
232{
233 struct device *dev = spi->master->dev.parent;
234 int status;
235
236 /* Chipselects are numbered 0..max; validate. */
237 if (spi->chip_select >= spi->master->num_chipselect) {
238 dev_err(dev, "cs%d >= max %d\n",
239 spi->chip_select,
240 spi->master->num_chipselect);
241 return -EINVAL;
242 }
243
244 /* Set the bus ID string */
245 snprintf(spi->dev.bus_id, sizeof spi->dev.bus_id,
246 "%s.%u", spi->master->dev.bus_id,
247 spi->chip_select);
248
249 /* drivers may modify this initial i/o setup */
250 status = spi->master->setup(spi);
251 if (status < 0) {
252 dev_err(dev, "can't %s %s, status %d\n",
253 "setup", spi->dev.bus_id, status);
254 return status;
255 }
256
257 /* driver core catches callers that misbehave by defining
258 * devices that already exist.
259 */
260 status = device_add(&spi->dev);
261 if (status < 0) {
262 dev_err(dev, "can't %s %s, status %d\n",
263 "add", spi->dev.bus_id, status);
264 return status;
265 }
266
267 dev_dbg(dev, "registered child %s\n", spi->dev.bus_id);
268 return 0;
269}
270EXPORT_SYMBOL_GPL(spi_add_device);
181 271
182/** 272/**
183 * spi_new_device - instantiate one new SPI device 273 * spi_new_device - instantiate one new SPI device
@@ -197,7 +287,6 @@ struct spi_device *spi_new_device(struct spi_master *master,
197 struct spi_board_info *chip) 287 struct spi_board_info *chip)
198{ 288{
199 struct spi_device *proxy; 289 struct spi_device *proxy;
200 struct device *dev = master->dev.parent;
201 int status; 290 int status;
202 291
203 /* NOTE: caller did any chip->bus_num checks necessary. 292 /* NOTE: caller did any chip->bus_num checks necessary.
@@ -207,66 +296,28 @@ struct spi_device *spi_new_device(struct spi_master *master,
207 * suggests syslogged diagnostics are best here (ugh). 296 * suggests syslogged diagnostics are best here (ugh).
208 */ 297 */
209 298
210 /* Chipselects are numbered 0..max; validate. */ 299 proxy = spi_alloc_device(master);
211 if (chip->chip_select >= master->num_chipselect) { 300 if (!proxy)
212 dev_err(dev, "cs%d > max %d\n",
213 chip->chip_select,
214 master->num_chipselect);
215 return NULL;
216 }
217
218 if (!spi_master_get(master))
219 return NULL; 301 return NULL;
220 302
221 WARN_ON(strlen(chip->modalias) >= sizeof(proxy->modalias)); 303 WARN_ON(strlen(chip->modalias) >= sizeof(proxy->modalias));
222 304
223 proxy = kzalloc(sizeof *proxy, GFP_KERNEL);
224 if (!proxy) {
225 dev_err(dev, "can't alloc dev for cs%d\n",
226 chip->chip_select);
227 goto fail;
228 }
229 proxy->master = master;
230 proxy->chip_select = chip->chip_select; 305 proxy->chip_select = chip->chip_select;
231 proxy->max_speed_hz = chip->max_speed_hz; 306 proxy->max_speed_hz = chip->max_speed_hz;
232 proxy->mode = chip->mode; 307 proxy->mode = chip->mode;
233 proxy->irq = chip->irq; 308 proxy->irq = chip->irq;
234 strlcpy(proxy->modalias, chip->modalias, sizeof(proxy->modalias)); 309 strlcpy(proxy->modalias, chip->modalias, sizeof(proxy->modalias));
235
236 snprintf(proxy->dev.bus_id, sizeof proxy->dev.bus_id,
237 "%s.%u", master->dev.bus_id,
238 chip->chip_select);
239 proxy->dev.parent = dev;
240 proxy->dev.bus = &spi_bus_type;
241 proxy->dev.platform_data = (void *) chip->platform_data; 310 proxy->dev.platform_data = (void *) chip->platform_data;
242 proxy->controller_data = chip->controller_data; 311 proxy->controller_data = chip->controller_data;
243 proxy->controller_state = NULL; 312 proxy->controller_state = NULL;
244 proxy->dev.release = spidev_release;
245 313
246 /* drivers may modify this initial i/o setup */ 314 status = spi_add_device(proxy);
247 status = master->setup(proxy);
248 if (status < 0) { 315 if (status < 0) {
249 dev_err(dev, "can't %s %s, status %d\n", 316 spi_dev_put(proxy);
250 "setup", proxy->dev.bus_id, status); 317 return NULL;
251 goto fail;
252 } 318 }
253 319
254 /* driver core catches callers that misbehave by defining
255 * devices that already exist.
256 */
257 status = device_register(&proxy->dev);
258 if (status < 0) {
259 dev_err(dev, "can't %s %s, status %d\n",
260 "add", proxy->dev.bus_id, status);
261 goto fail;
262 }
263 dev_dbg(dev, "registered child %s\n", proxy->dev.bus_id);
264 return proxy; 320 return proxy;
265
266fail:
267 spi_master_put(master);
268 kfree(proxy);
269 return NULL;
270} 321}
271EXPORT_SYMBOL_GPL(spi_new_device); 322EXPORT_SYMBOL_GPL(spi_new_device);
272 323
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 0885cc357a37..1c643c9e1f15 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -270,6 +270,7 @@ static int __init s3c24xx_spi_probe(struct platform_device *pdev)
270 /* setup the master state. */ 270 /* setup the master state. */
271 271
272 master->num_chipselect = hw->pdata->num_cs; 272 master->num_chipselect = hw->pdata->num_cs;
273 master->bus_num = pdata->bus_num;
273 274
274 /* setup the state for the bitbang driver */ 275 /* setup the state for the bitbang driver */
275 276
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 8da7535c0c70..77b44fb48f0a 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1593,7 +1593,7 @@ static int __init m66592_probe(struct platform_device *pdev)
1593 1593
1594 m66592->gadget.ops = &m66592_gadget_ops; 1594 m66592->gadget.ops = &m66592_gadget_ops;
1595 device_initialize(&m66592->gadget.dev); 1595 device_initialize(&m66592->gadget.dev);
1596 dev_set_name(&m66592->gadget, "gadget"); 1596 dev_set_name(&m66592->gadget.dev, "gadget");
1597 m66592->gadget.is_dualspeed = 1; 1597 m66592->gadget.is_dualspeed = 1;
1598 m66592->gadget.dev.parent = &pdev->dev; 1598 m66592->gadget.dev.parent = &pdev->dev;
1599 m66592->gadget.dev.dma_mask = pdev->dev.dma_mask; 1599 m66592->gadget.dev.dma_mask = pdev->dev.dma_mask;
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 0ebc1bfd2514..a6b55297a7fb 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -118,7 +118,6 @@ obj-$(CONFIG_FB_PS3) += ps3fb.o
118obj-$(CONFIG_FB_SM501) += sm501fb.o 118obj-$(CONFIG_FB_SM501) += sm501fb.o
119obj-$(CONFIG_FB_XILINX) += xilinxfb.o 119obj-$(CONFIG_FB_XILINX) += xilinxfb.o
120obj-$(CONFIG_FB_SH_MOBILE_LCDC) += sh_mobile_lcdcfb.o 120obj-$(CONFIG_FB_SH_MOBILE_LCDC) += sh_mobile_lcdcfb.o
121obj-$(CONFIG_FB_SH7343VOU) += sh7343_voufb.o
122obj-$(CONFIG_FB_OMAP) += omap/ 121obj-$(CONFIG_FB_OMAP) += omap/
123obj-$(CONFIG_XEN_FBDEV_FRONTEND) += xen-fbfront.o 122obj-$(CONFIG_XEN_FBDEV_FRONTEND) += xen-fbfront.o
124obj-$(CONFIG_FB_CARMINE) += carminefb.o 123obj-$(CONFIG_FB_CARMINE) += carminefb.o
diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
index 5001bd4ef466..38a1e8308c83 100644
--- a/drivers/video/arkfb.c
+++ b/drivers/video/arkfb.c
@@ -1126,11 +1126,8 @@ static int ark_pci_resume (struct pci_dev* dev)
1126 acquire_console_sem(); 1126 acquire_console_sem();
1127 mutex_lock(&(par->open_lock)); 1127 mutex_lock(&(par->open_lock));
1128 1128
1129 if (par->ref_count == 0) { 1129 if (par->ref_count == 0)
1130 mutex_unlock(&(par->open_lock)); 1130 goto fail;
1131 release_console_sem();
1132 return 0;
1133 }
1134 1131
1135 pci_set_power_state(dev, PCI_D0); 1132 pci_set_power_state(dev, PCI_D0);
1136 pci_restore_state(dev); 1133 pci_restore_state(dev);
@@ -1143,8 +1140,8 @@ static int ark_pci_resume (struct pci_dev* dev)
1143 arkfb_set_par(info); 1140 arkfb_set_par(info);
1144 fb_set_suspend(info, 0); 1141 fb_set_suspend(info, 0);
1145 1142
1146 mutex_unlock(&(par->open_lock));
1147fail: 1143fail:
1144 mutex_unlock(&(par->open_lock));
1148 release_console_sem(); 1145 release_console_sem();
1149 return 0; 1146 return 0;
1150} 1147}
diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c
index fbea2bd129c7..6fa0b9d5559a 100644
--- a/drivers/video/backlight/hp680_bl.c
+++ b/drivers/video/backlight/hp680_bl.c
@@ -18,7 +18,7 @@
18#include <linux/fb.h> 18#include <linux/fb.h>
19#include <linux/backlight.h> 19#include <linux/backlight.h>
20 20
21#include <asm/cpu/dac.h> 21#include <cpu/dac.h>
22#include <asm/hp6xx.h> 22#include <asm/hp6xx.h>
23#include <asm/hd64461.h> 23#include <asm/hd64461.h>
24 24
diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c
index 72d44dbfce82..738694d23889 100644
--- a/drivers/video/backlight/platform_lcd.c
+++ b/drivers/video/backlight/platform_lcd.c
@@ -92,7 +92,7 @@ static int __devinit platform_lcd_probe(struct platform_device *pdev)
92 92
93 plcd->us = dev; 93 plcd->us = dev;
94 plcd->pdata = pdata; 94 plcd->pdata = pdata;
95 plcd->lcd = lcd_device_register("platform-lcd", dev, 95 plcd->lcd = lcd_device_register(dev_name(dev), dev,
96 plcd, &platform_lcd_ops); 96 plcd, &platform_lcd_ops);
97 if (IS_ERR(plcd->lcd)) { 97 if (IS_ERR(plcd->lcd)) {
98 dev_err(dev, "cannot register lcd device\n"); 98 dev_err(dev, "cannot register lcd device\n");
@@ -101,6 +101,8 @@ static int __devinit platform_lcd_probe(struct platform_device *pdev)
101 } 101 }
102 102
103 platform_set_drvdata(pdev, plcd); 103 platform_set_drvdata(pdev, plcd);
104 platform_lcd_set_power(plcd->lcd, FB_BLANK_NORMAL);
105
104 return 0; 106 return 0;
105 107
106 err_mem: 108 err_mem:
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index d7822af0e00a..ef7870f5ea08 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -24,6 +24,7 @@
24#include <asm/hardware.h> 24#include <asm/hardware.h>
25#include <asm/parisc-device.h> 25#include <asm/parisc-device.h>
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/grfioctl.h>
27 28
28#include "../sticore.h" 29#include "../sticore.h"
29 30
@@ -725,6 +726,7 @@ static int __devinit sti_read_rom(int wordmode, struct sti_struct *sti,
725{ 726{
726 struct sti_cooked_rom *cooked; 727 struct sti_cooked_rom *cooked;
727 struct sti_rom *raw = NULL; 728 struct sti_rom *raw = NULL;
729 unsigned long revno;
728 730
729 cooked = kmalloc(sizeof *cooked, GFP_KERNEL); 731 cooked = kmalloc(sizeof *cooked, GFP_KERNEL);
730 if (!cooked) 732 if (!cooked)
@@ -767,9 +769,35 @@ static int __devinit sti_read_rom(int wordmode, struct sti_struct *sti,
767 sti->graphics_id[1] = raw->graphics_id[1]; 769 sti->graphics_id[1] = raw->graphics_id[1];
768 770
769 sti_dump_rom(raw); 771 sti_dump_rom(raw);
770 772
773 /* check if the ROM routines in this card are compatible */
774 if (wordmode || sti->graphics_id[1] != 0x09A02587)
775 goto ok;
776
777 revno = (raw->revno[0] << 8) | raw->revno[1];
778
779 switch (sti->graphics_id[0]) {
780 case S9000_ID_HCRX:
781 /* HyperA or HyperB ? */
782 if (revno == 0x8408 || revno == 0x840b)
783 goto msg_not_supported;
784 break;
785 case CRT_ID_THUNDER:
786 if (revno == 0x8509)
787 goto msg_not_supported;
788 break;
789 case CRT_ID_THUNDER2:
790 if (revno == 0x850c)
791 goto msg_not_supported;
792 }
793ok:
771 return 1; 794 return 1;
772 795
796msg_not_supported:
797 printk(KERN_ERR "Sorry, this GSC/STI card is not yet supported.\n");
798 printk(KERN_ERR "Please see http://parisc-linux.org/faq/"
799 "graphics-howto.html for more info.\n");
800 /* fall through */
773out_err: 801out_err:
774 kfree(raw); 802 kfree(raw);
775 kfree(cooked); 803 kfree(cooked);
diff --git a/drivers/video/gbefb.c b/drivers/video/gbefb.c
index 2e552d5bbb5d..f89c3cce1e0c 100644
--- a/drivers/video/gbefb.c
+++ b/drivers/video/gbefb.c
@@ -87,6 +87,8 @@ static int gbe_revision;
87static int ypan, ywrap; 87static int ypan, ywrap;
88 88
89static uint32_t pseudo_palette[16]; 89static uint32_t pseudo_palette[16];
90static uint32_t gbe_cmap[256];
91static int gbe_turned_on; /* 0 turned off, 1 turned on */
90 92
91static char *mode_option __initdata = NULL; 93static char *mode_option __initdata = NULL;
92 94
@@ -208,6 +210,8 @@ void gbe_turn_off(void)
208 int i; 210 int i;
209 unsigned int val, x, y, vpixen_off; 211 unsigned int val, x, y, vpixen_off;
210 212
213 gbe_turned_on = 0;
214
211 /* check if pixel counter is on */ 215 /* check if pixel counter is on */
212 val = gbe->vt_xy; 216 val = gbe->vt_xy;
213 if (GET_GBE_FIELD(VT_XY, FREEZE, val) == 1) 217 if (GET_GBE_FIELD(VT_XY, FREEZE, val) == 1)
@@ -371,6 +375,22 @@ static void gbe_turn_on(void)
371 } 375 }
372 if (i == 10000) 376 if (i == 10000)
373 printk(KERN_ERR "gbefb: turn on DMA timed out\n"); 377 printk(KERN_ERR "gbefb: turn on DMA timed out\n");
378
379 gbe_turned_on = 1;
380}
381
382static void gbe_loadcmap(void)
383{
384 int i, j;
385
386 for (i = 0; i < 256; i++) {
387 for (j = 0; j < 1000 && gbe->cm_fifo >= 63; j++)
388 udelay(10);
389 if (j == 1000)
390 printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
391
392 gbe->cmap[i] = gbe_cmap[i];
393 }
374} 394}
375 395
376/* 396/*
@@ -382,6 +402,7 @@ static int gbefb_blank(int blank, struct fb_info *info)
382 switch (blank) { 402 switch (blank) {
383 case FB_BLANK_UNBLANK: /* unblank */ 403 case FB_BLANK_UNBLANK: /* unblank */
384 gbe_turn_on(); 404 gbe_turn_on();
405 gbe_loadcmap();
385 break; 406 break;
386 407
387 case FB_BLANK_NORMAL: /* blank */ 408 case FB_BLANK_NORMAL: /* blank */
@@ -796,16 +817,10 @@ static int gbefb_set_par(struct fb_info *info)
796 gbe->gmap[i] = (i << 24) | (i << 16) | (i << 8); 817 gbe->gmap[i] = (i << 24) | (i << 16) | (i << 8);
797 818
798 /* Initialize the color map */ 819 /* Initialize the color map */
799 for (i = 0; i < 256; i++) { 820 for (i = 0; i < 256; i++)
800 int j; 821 gbe_cmap[i] = (i << 8) | (i << 16) | (i << 24);
801
802 for (j = 0; j < 1000 && gbe->cm_fifo >= 63; j++)
803 udelay(10);
804 if (j == 1000)
805 printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
806 822
807 gbe->cmap[i] = (i << 8) | (i << 16) | (i << 24); 823 gbe_loadcmap();
808 }
809 824
810 return 0; 825 return 0;
811} 826}
@@ -855,14 +870,17 @@ static int gbefb_setcolreg(unsigned regno, unsigned red, unsigned green,
855 blue >>= 8; 870 blue >>= 8;
856 871
857 if (info->var.bits_per_pixel <= 8) { 872 if (info->var.bits_per_pixel <= 8) {
858 /* wait for the color map FIFO to have a free entry */ 873 gbe_cmap[regno] = (red << 24) | (green << 16) | (blue << 8);
859 for (i = 0; i < 1000 && gbe->cm_fifo >= 63; i++) 874 if (gbe_turned_on) {
860 udelay(10); 875 /* wait for the color map FIFO to have a free entry */
861 if (i == 1000) { 876 for (i = 0; i < 1000 && gbe->cm_fifo >= 63; i++)
862 printk(KERN_ERR "gbefb: cmap FIFO timeout\n"); 877 udelay(10);
863 return 1; 878 if (i == 1000) {
879 printk(KERN_ERR "gbefb: cmap FIFO timeout\n");
880 return 1;
881 }
882 gbe->cmap[regno] = gbe_cmap[regno];
864 } 883 }
865 gbe->cmap[regno] = (red << 24) | (green << 16) | (blue << 8);
866 } else if (regno < 16) { 884 } else if (regno < 16) {
867 switch (info->var.bits_per_pixel) { 885 switch (info->var.bits_per_pixel) {
868 case 15: 886 case 15:
diff --git a/drivers/video/hitfb.c b/drivers/video/hitfb.c
index 392a8be6aa76..e6467cf9f19f 100644
--- a/drivers/video/hitfb.c
+++ b/drivers/video/hitfb.c
@@ -27,7 +27,7 @@
27#include <asm/pgtable.h> 27#include <asm/pgtable.h>
28#include <asm/io.h> 28#include <asm/io.h>
29#include <asm/hd64461.h> 29#include <asm/hd64461.h>
30#include <asm/cpu/dac.h> 30#include <cpu/dac.h>
31 31
32#define WIDTH 640 32#define WIDTH 640
33 33
diff --git a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c
index 8c863a7f654b..0a0fd48a8566 100644
--- a/drivers/video/pvr2fb.c
+++ b/drivers/video/pvr2fb.c
@@ -58,18 +58,18 @@
58 58
59#ifdef CONFIG_SH_DREAMCAST 59#ifdef CONFIG_SH_DREAMCAST
60#include <asm/machvec.h> 60#include <asm/machvec.h>
61#include <asm/mach/sysasic.h> 61#include <mach-dreamcast/mach/sysasic.h>
62#endif 62#endif
63 63
64#ifdef CONFIG_SH_DMA 64#ifdef CONFIG_SH_DMA
65#include <linux/pagemap.h> 65#include <linux/pagemap.h>
66#include <asm/mach/dma.h> 66#include <mach/dma.h>
67#include <asm/dma.h> 67#include <asm/dma.h>
68#endif 68#endif
69 69
70#ifdef CONFIG_SH_STORE_QUEUES 70#ifdef CONFIG_SH_STORE_QUEUES
71#include <linux/uaccess.h> 71#include <linux/uaccess.h>
72#include <asm/cpu/sq.h> 72#include <cpu/sq.h>
73#endif 73#endif
74 74
75#ifndef PCI_DEVICE_ID_NEC_NEON250 75#ifndef PCI_DEVICE_ID_NEC_NEON250
diff --git a/drivers/video/sh7760fb.c b/drivers/video/sh7760fb.c
index 4d0e28c5790b..8d0212da4514 100644
--- a/drivers/video/sh7760fb.c
+++ b/drivers/video/sh7760fb.c
@@ -152,6 +152,7 @@ static int sh7760fb_setcmap(struct fb_cmap *cmap, struct fb_info *info)
152 col |= ((*g) & 0xff) << 8; 152 col |= ((*g) & 0xff) << 8;
153 col |= ((*b) & 0xff); 153 col |= ((*b) & 0xff);
154 col &= SH7760FB_PALETTE_MASK; 154 col &= SH7760FB_PALETTE_MASK;
155 iowrite32(col, par->base + LDPR(s));
155 156
156 if (s < 16) 157 if (s < 16)
157 ((u32 *) (info->pseudo_palette))[s] = s; 158 ((u32 *) (info->pseudo_palette))[s] = s;
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
index 536ab11623f0..4a484ee98f8a 100644
--- a/drivers/video/vt8623fb.c
+++ b/drivers/video/vt8623fb.c
@@ -853,11 +853,8 @@ static int vt8623_pci_resume(struct pci_dev* dev)
853 acquire_console_sem(); 853 acquire_console_sem();
854 mutex_lock(&(par->open_lock)); 854 mutex_lock(&(par->open_lock));
855 855
856 if (par->ref_count == 0) { 856 if (par->ref_count == 0)
857 mutex_unlock(&(par->open_lock)); 857 goto fail;
858 release_console_sem();
859 return 0;
860 }
861 858
862 pci_set_power_state(dev, PCI_D0); 859 pci_set_power_state(dev, PCI_D0);
863 pci_restore_state(dev); 860 pci_restore_state(dev);
@@ -870,8 +867,8 @@ static int vt8623_pci_resume(struct pci_dev* dev)
870 vt8623fb_set_par(info); 867 vt8623fb_set_par(info);
871 fb_set_suspend(info, 0); 868 fb_set_suspend(info, 0);
872 869
873 mutex_unlock(&(par->open_lock));
874fail: 870fail:
871 mutex_unlock(&(par->open_lock));
875 release_console_sem(); 872 release_console_sem();
876 873
877 return 0; 874 return 0;
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index eaa3f2a79ff5..ccd6c530782d 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -420,7 +420,7 @@ static int __devinit detect_cru_service(void)
420static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason, 420static int hpwdt_pretimeout(struct notifier_block *nb, unsigned long ulReason,
421 void *data) 421 void *data)
422{ 422{
423 static unsigned long rom_pl; 423 unsigned long rom_pl;
424 static int die_nmi_called; 424 static int die_nmi_called;
425 425
426 if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI) 426 if (ulReason != DIE_NMI && ulReason != DIE_NMI_IPI)
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 3263084eef9e..4a551af6f3fc 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -30,7 +30,7 @@ config COMPAT_BINFMT_ELF
30config BINFMT_ELF_FDPIC 30config BINFMT_ELF_FDPIC
31 bool "Kernel support for FDPIC ELF binaries" 31 bool "Kernel support for FDPIC ELF binaries"
32 default y 32 default y
33 depends on (FRV || BLACKFIN) 33 depends on (FRV || BLACKFIN || (SUPERH32 && !MMU))
34 help 34 help
35 ELF FDPIC binaries are based on ELF, but allow the individual load 35 ELF FDPIC binaries are based on ELF, but allow the individual load
36 segments of a binary to be located in memory independently of each 36 segments of a binary to be located in memory independently of each
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 2f5503902c37..78db4953a800 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -232,7 +232,7 @@ static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd)
232 } 232 }
233 233
234 mntget(newmnt); 234 mntget(newmnt);
235 err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts); 235 err = do_add_mount(newmnt, &nd->path, MNT_SHRINKABLE, &afs_vfsmounts);
236 switch (err) { 236 switch (err) {
237 case 0: 237 case 0:
238 path_put(&nd->path); 238 path_put(&nd->path);
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index fdeadab2f18b..80c1f952ef78 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -470,6 +470,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
470 char __user *u_platform, *p; 470 char __user *u_platform, *p;
471 long hwcap; 471 long hwcap;
472 int loop; 472 int loop;
473 int nr; /* reset for each csp adjustment */
473 474
474 /* we're going to shovel a whole load of stuff onto the stack */ 475 /* we're going to shovel a whole load of stuff onto the stack */
475#ifdef CONFIG_MMU 476#ifdef CONFIG_MMU
@@ -542,10 +543,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
542 /* force 16 byte _final_ alignment here for generality */ 543 /* force 16 byte _final_ alignment here for generality */
543#define DLINFO_ITEMS 13 544#define DLINFO_ITEMS 13
544 545
545 nitems = 1 + DLINFO_ITEMS + (k_platform ? 1 : 0); 546 nitems = 1 + DLINFO_ITEMS + (k_platform ? 1 : 0) + AT_VECTOR_SIZE_ARCH;
546#ifdef DLINFO_ARCH_ITEMS
547 nitems += DLINFO_ARCH_ITEMS;
548#endif
549 547
550 csp = sp; 548 csp = sp;
551 sp -= nitems * 2 * sizeof(unsigned long); 549 sp -= nitems * 2 * sizeof(unsigned long);
@@ -557,39 +555,46 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
557 sp -= sp & 15UL; 555 sp -= sp & 15UL;
558 556
559 /* put the ELF interpreter info on the stack */ 557 /* put the ELF interpreter info on the stack */
560#define NEW_AUX_ENT(nr, id, val) \ 558#define NEW_AUX_ENT(id, val) \
561 do { \ 559 do { \
562 struct { unsigned long _id, _val; } __user *ent; \ 560 struct { unsigned long _id, _val; } __user *ent; \
563 \ 561 \
564 ent = (void __user *) csp; \ 562 ent = (void __user *) csp; \
565 __put_user((id), &ent[nr]._id); \ 563 __put_user((id), &ent[nr]._id); \
566 __put_user((val), &ent[nr]._val); \ 564 __put_user((val), &ent[nr]._val); \
565 nr++; \
567 } while (0) 566 } while (0)
568 567
568 nr = 0;
569 csp -= 2 * sizeof(unsigned long); 569 csp -= 2 * sizeof(unsigned long);
570 NEW_AUX_ENT(0, AT_NULL, 0); 570 NEW_AUX_ENT(AT_NULL, 0);
571 if (k_platform) { 571 if (k_platform) {
572 nr = 0;
572 csp -= 2 * sizeof(unsigned long); 573 csp -= 2 * sizeof(unsigned long);
573 NEW_AUX_ENT(0, AT_PLATFORM, 574 NEW_AUX_ENT(AT_PLATFORM,
574 (elf_addr_t) (unsigned long) u_platform); 575 (elf_addr_t) (unsigned long) u_platform);
575 } 576 }
576 577
578 nr = 0;
577 csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long); 579 csp -= DLINFO_ITEMS * 2 * sizeof(unsigned long);
578 NEW_AUX_ENT( 0, AT_HWCAP, hwcap); 580 NEW_AUX_ENT(AT_HWCAP, hwcap);
579 NEW_AUX_ENT( 1, AT_PAGESZ, PAGE_SIZE); 581 NEW_AUX_ENT(AT_PAGESZ, PAGE_SIZE);
580 NEW_AUX_ENT( 2, AT_CLKTCK, CLOCKS_PER_SEC); 582 NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC);
581 NEW_AUX_ENT( 3, AT_PHDR, exec_params->ph_addr); 583 NEW_AUX_ENT(AT_PHDR, exec_params->ph_addr);
582 NEW_AUX_ENT( 4, AT_PHENT, sizeof(struct elf_phdr)); 584 NEW_AUX_ENT(AT_PHENT, sizeof(struct elf_phdr));
583 NEW_AUX_ENT( 5, AT_PHNUM, exec_params->hdr.e_phnum); 585 NEW_AUX_ENT(AT_PHNUM, exec_params->hdr.e_phnum);
584 NEW_AUX_ENT( 6, AT_BASE, interp_params->elfhdr_addr); 586 NEW_AUX_ENT(AT_BASE, interp_params->elfhdr_addr);
585 NEW_AUX_ENT( 7, AT_FLAGS, 0); 587 NEW_AUX_ENT(AT_FLAGS, 0);
586 NEW_AUX_ENT( 8, AT_ENTRY, exec_params->entry_addr); 588 NEW_AUX_ENT(AT_ENTRY, exec_params->entry_addr);
587 NEW_AUX_ENT( 9, AT_UID, (elf_addr_t) current->uid); 589 NEW_AUX_ENT(AT_UID, (elf_addr_t) current->uid);
588 NEW_AUX_ENT(10, AT_EUID, (elf_addr_t) current->euid); 590 NEW_AUX_ENT(AT_EUID, (elf_addr_t) current->euid);
589 NEW_AUX_ENT(11, AT_GID, (elf_addr_t) current->gid); 591 NEW_AUX_ENT(AT_GID, (elf_addr_t) current->gid);
590 NEW_AUX_ENT(12, AT_EGID, (elf_addr_t) current->egid); 592 NEW_AUX_ENT(AT_EGID, (elf_addr_t) current->egid);
591 593
592#ifdef ARCH_DLINFO 594#ifdef ARCH_DLINFO
595 nr = 0;
596 csp -= AT_VECTOR_SIZE_ARCH * 2 * sizeof(unsigned long);
597
593 /* ARCH_DLINFO must come last so platform specific code can enforce 598 /* ARCH_DLINFO must come last so platform specific code can enforce
594 * special alignment requirements on the AUXV if necessary (eg. PPC). 599 * special alignment requirements on the AUXV if necessary (eg. PPC).
595 */ 600 */
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
index 63e2ee63058d..c3e174b35fe6 100644
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -705,7 +705,6 @@ void __init bio_integrity_init_slab(void)
705 bio_integrity_slab = KMEM_CACHE(bio_integrity_payload, 705 bio_integrity_slab = KMEM_CACHE(bio_integrity_payload,
706 SLAB_HWCACHE_ALIGN|SLAB_PANIC); 706 SLAB_HWCACHE_ALIGN|SLAB_PANIC);
707} 707}
708EXPORT_SYMBOL(bio_integrity_init_slab);
709 708
710static int __init integrity_init(void) 709static int __init integrity_init(void)
711{ 710{
diff --git a/fs/block_dev.c b/fs/block_dev.c
index dcf37cada369..aff54219e049 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -941,8 +941,10 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
941 * hooks: /n/, see "layering violations". 941 * hooks: /n/, see "layering violations".
942 */ 942 */
943 ret = devcgroup_inode_permission(bdev->bd_inode, perm); 943 ret = devcgroup_inode_permission(bdev->bd_inode, perm);
944 if (ret != 0) 944 if (ret != 0) {
945 bdput(bdev);
945 return ret; 946 return ret;
947 }
946 948
947 ret = -ENXIO; 949 ret = -ENXIO;
948 file->f_mapping = bdev->bd_inode->i_mapping; 950 file->f_mapping = bdev->bd_inode->i_mapping;
@@ -1234,6 +1236,7 @@ fail:
1234 bdev = ERR_PTR(error); 1236 bdev = ERR_PTR(error);
1235 goto out; 1237 goto out;
1236} 1238}
1239EXPORT_SYMBOL(lookup_bdev);
1237 1240
1238/** 1241/**
1239 * open_bdev_excl - open a block device by name and set it up for use 1242 * open_bdev_excl - open a block device by name and set it up for use
diff --git a/fs/buffer.c b/fs/buffer.c
index f95805019639..4dbe52948e8f 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -580,7 +580,7 @@ EXPORT_SYMBOL(mark_buffer_async_write);
580/* 580/*
581 * The buffer's backing address_space's private_lock must be held 581 * The buffer's backing address_space's private_lock must be held
582 */ 582 */
583static inline void __remove_assoc_queue(struct buffer_head *bh) 583static void __remove_assoc_queue(struct buffer_head *bh)
584{ 584{
585 list_del_init(&bh->b_assoc_buffers); 585 list_del_init(&bh->b_assoc_buffers);
586 WARN_ON(!bh->b_assoc_map); 586 WARN_ON(!bh->b_assoc_map);
@@ -2096,6 +2096,52 @@ int generic_write_end(struct file *file, struct address_space *mapping,
2096EXPORT_SYMBOL(generic_write_end); 2096EXPORT_SYMBOL(generic_write_end);
2097 2097
2098/* 2098/*
2099 * block_is_partially_uptodate checks whether buffers within a page are
2100 * uptodate or not.
2101 *
2102 * Returns true if all buffers which correspond to a file portion
2103 * we want to read are uptodate.
2104 */
2105int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc,
2106 unsigned long from)
2107{
2108 struct inode *inode = page->mapping->host;
2109 unsigned block_start, block_end, blocksize;
2110 unsigned to;
2111 struct buffer_head *bh, *head;
2112 int ret = 1;
2113
2114 if (!page_has_buffers(page))
2115 return 0;
2116
2117 blocksize = 1 << inode->i_blkbits;
2118 to = min_t(unsigned, PAGE_CACHE_SIZE - from, desc->count);
2119 to = from + to;
2120 if (from < blocksize && to > PAGE_CACHE_SIZE - blocksize)
2121 return 0;
2122
2123 head = page_buffers(page);
2124 bh = head;
2125 block_start = 0;
2126 do {
2127 block_end = block_start + blocksize;
2128 if (block_end > from && block_start < to) {
2129 if (!buffer_uptodate(bh)) {
2130 ret = 0;
2131 break;
2132 }
2133 if (block_end >= to)
2134 break;
2135 }
2136 block_start = block_end;
2137 bh = bh->b_this_page;
2138 } while (bh != head);
2139
2140 return ret;
2141}
2142EXPORT_SYMBOL(block_is_partially_uptodate);
2143
2144/*
2099 * Generic "read page" function for block devices that have the normal 2145 * Generic "read page" function for block devices that have the normal
2100 * get_block functionality. This is most of the block device filesystems. 2146 * get_block functionality. This is most of the block device filesystems.
2101 * Reads the page asynchronously --- the unlock_buffer() and 2147 * Reads the page asynchronously --- the unlock_buffer() and
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index d82374c9e329..d2c8eef84f3c 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -226,7 +226,7 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
226 int err; 226 int err;
227 227
228 mntget(newmnt); 228 mntget(newmnt);
229 err = do_add_mount(newmnt, nd, nd->path.mnt->mnt_flags, mntlist); 229 err = do_add_mount(newmnt, &nd->path, nd->path.mnt->mnt_flags, mntlist);
230 switch (err) { 230 switch (err) {
231 case 0: 231 case 0:
232 path_put(&nd->path); 232 path_put(&nd->path);
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 285b64a8b06e..488eb424f662 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -29,7 +29,7 @@
29#define DEVPTS_DEFAULT_MODE 0600 29#define DEVPTS_DEFAULT_MODE 0600
30 30
31extern int pty_limit; /* Config limit on Unix98 ptys */ 31extern int pty_limit; /* Config limit on Unix98 ptys */
32static DEFINE_IDR(allocated_ptys); 32static DEFINE_IDA(allocated_ptys);
33static DEFINE_MUTEX(allocated_ptys_lock); 33static DEFINE_MUTEX(allocated_ptys_lock);
34 34
35static struct vfsmount *devpts_mnt; 35static struct vfsmount *devpts_mnt;
@@ -180,24 +180,24 @@ static struct dentry *get_node(int num)
180int devpts_new_index(void) 180int devpts_new_index(void)
181{ 181{
182 int index; 182 int index;
183 int idr_ret; 183 int ida_ret;
184 184
185retry: 185retry:
186 if (!idr_pre_get(&allocated_ptys, GFP_KERNEL)) { 186 if (!ida_pre_get(&allocated_ptys, GFP_KERNEL)) {
187 return -ENOMEM; 187 return -ENOMEM;
188 } 188 }
189 189
190 mutex_lock(&allocated_ptys_lock); 190 mutex_lock(&allocated_ptys_lock);
191 idr_ret = idr_get_new(&allocated_ptys, NULL, &index); 191 ida_ret = ida_get_new(&allocated_ptys, &index);
192 if (idr_ret < 0) { 192 if (ida_ret < 0) {
193 mutex_unlock(&allocated_ptys_lock); 193 mutex_unlock(&allocated_ptys_lock);
194 if (idr_ret == -EAGAIN) 194 if (ida_ret == -EAGAIN)
195 goto retry; 195 goto retry;
196 return -EIO; 196 return -EIO;
197 } 197 }
198 198
199 if (index >= pty_limit) { 199 if (index >= pty_limit) {
200 idr_remove(&allocated_ptys, index); 200 ida_remove(&allocated_ptys, index);
201 mutex_unlock(&allocated_ptys_lock); 201 mutex_unlock(&allocated_ptys_lock);
202 return -EIO; 202 return -EIO;
203 } 203 }
@@ -208,7 +208,7 @@ retry:
208void devpts_kill_index(int idx) 208void devpts_kill_index(int idx)
209{ 209{
210 mutex_lock(&allocated_ptys_lock); 210 mutex_lock(&allocated_ptys_lock);
211 idr_remove(&allocated_ptys, idx); 211 ida_remove(&allocated_ptys, idx);
212 mutex_unlock(&allocated_ptys_lock); 212 mutex_unlock(&allocated_ptys_lock);
213} 213}
214 214
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 2d3d1027ce2b..724ddac91538 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -363,6 +363,7 @@ static int search_rsb_list(struct list_head *head, char *name, int len,
363 if (len == r->res_length && !memcmp(name, r->res_name, len)) 363 if (len == r->res_length && !memcmp(name, r->res_name, len))
364 goto found; 364 goto found;
365 } 365 }
366 *r_ret = NULL;
366 return -EBADR; 367 return -EBADR;
367 368
368 found: 369 found:
@@ -1782,7 +1783,8 @@ static void grant_pending_locks(struct dlm_rsb *r)
1782 1783
1783 list_for_each_entry_safe(lkb, s, &r->res_grantqueue, lkb_statequeue) { 1784 list_for_each_entry_safe(lkb, s, &r->res_grantqueue, lkb_statequeue) {
1784 if (lkb->lkb_bastfn && lock_requires_bast(lkb, high, cw)) { 1785 if (lkb->lkb_bastfn && lock_requires_bast(lkb, high, cw)) {
1785 if (cw && high == DLM_LOCK_PR) 1786 if (cw && high == DLM_LOCK_PR &&
1787 lkb->lkb_grmode == DLM_LOCK_PR)
1786 queue_bast(r, lkb, DLM_LOCK_CW); 1788 queue_bast(r, lkb, DLM_LOCK_CW);
1787 else 1789 else
1788 queue_bast(r, lkb, high); 1790 queue_bast(r, lkb, high);
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 637018c891ef..3962262f991a 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -891,8 +891,10 @@ static void tcp_connect_to_sock(struct connection *con)
891 goto out_err; 891 goto out_err;
892 892
893 memset(&saddr, 0, sizeof(saddr)); 893 memset(&saddr, 0, sizeof(saddr));
894 if (dlm_nodeid_to_addr(con->nodeid, &saddr)) 894 if (dlm_nodeid_to_addr(con->nodeid, &saddr)) {
895 sock_release(sock);
895 goto out_err; 896 goto out_err;
897 }
896 898
897 sock->sk->sk_user_data = con; 899 sock->sk->sk_user_data = con;
898 con->rx_action = receive_from_sock; 900 con->rx_action = receive_from_sock;
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
index f976f303c196..929e48ae7591 100644
--- a/fs/dlm/user.c
+++ b/fs/dlm/user.c
@@ -539,7 +539,7 @@ static ssize_t device_write(struct file *file, const char __user *buf,
539 539
540 /* do we really need this? can a write happen after a close? */ 540 /* do we really need this? can a write happen after a close? */
541 if ((kbuf->cmd == DLM_USER_LOCK || kbuf->cmd == DLM_USER_UNLOCK) && 541 if ((kbuf->cmd == DLM_USER_LOCK || kbuf->cmd == DLM_USER_UNLOCK) &&
542 test_bit(DLM_PROC_FLAGS_CLOSING, &proc->flags)) 542 (proc && test_bit(DLM_PROC_FLAGS_CLOSING, &proc->flags)))
543 return -EINVAL; 543 return -EINVAL;
544 544
545 sigfillset(&allsigs); 545 sigfillset(&allsigs);
diff --git a/fs/dquot.c b/fs/dquot.c
index 1346eebe74ce..8ec4d6cc7633 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1793,6 +1793,21 @@ static int vfs_quota_on_remount(struct super_block *sb, int type)
1793 return ret; 1793 return ret;
1794} 1794}
1795 1795
1796int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
1797 struct path *path)
1798{
1799 int error = security_quota_on(path->dentry);
1800 if (error)
1801 return error;
1802 /* Quota file not on the same filesystem? */
1803 if (path->mnt->mnt_sb != sb)
1804 error = -EXDEV;
1805 else
1806 error = vfs_quota_on_inode(path->dentry->d_inode, type,
1807 format_id);
1808 return error;
1809}
1810
1796/* Actual function called from quotactl() */ 1811/* Actual function called from quotactl() */
1797int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path, 1812int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path,
1798 int remount) 1813 int remount)
@@ -1804,19 +1819,10 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path,
1804 return vfs_quota_on_remount(sb, type); 1819 return vfs_quota_on_remount(sb, type);
1805 1820
1806 error = path_lookup(path, LOOKUP_FOLLOW, &nd); 1821 error = path_lookup(path, LOOKUP_FOLLOW, &nd);
1807 if (error < 0) 1822 if (!error) {
1808 return error; 1823 error = vfs_quota_on_path(sb, type, format_id, &nd.path);
1809 error = security_quota_on(nd.path.dentry); 1824 path_put(&nd.path);
1810 if (error) 1825 }
1811 goto out_path;
1812 /* Quota file not on the same filesystem? */
1813 if (nd.path.mnt->mnt_sb != sb)
1814 error = -EXDEV;
1815 else
1816 error = vfs_quota_on_inode(nd.path.dentry->d_inode, type,
1817 format_id);
1818out_path:
1819 path_put(&nd.path);
1820 return error; 1826 return error;
1821} 1827}
1822 1828
@@ -2185,6 +2191,7 @@ EXPORT_SYMBOL(unregister_quota_format);
2185EXPORT_SYMBOL(dqstats); 2191EXPORT_SYMBOL(dqstats);
2186EXPORT_SYMBOL(dq_data_lock); 2192EXPORT_SYMBOL(dq_data_lock);
2187EXPORT_SYMBOL(vfs_quota_on); 2193EXPORT_SYMBOL(vfs_quota_on);
2194EXPORT_SYMBOL(vfs_quota_on_path);
2188EXPORT_SYMBOL(vfs_quota_on_mount); 2195EXPORT_SYMBOL(vfs_quota_on_mount);
2189EXPORT_SYMBOL(vfs_quota_off); 2196EXPORT_SYMBOL(vfs_quota_off);
2190EXPORT_SYMBOL(vfs_quota_sync); 2197EXPORT_SYMBOL(vfs_quota_sync);
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 7b99917ffadc..06db79d05c12 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -475,8 +475,8 @@ int ecryptfs_encrypt_page(struct page *page)
475{ 475{
476 struct inode *ecryptfs_inode; 476 struct inode *ecryptfs_inode;
477 struct ecryptfs_crypt_stat *crypt_stat; 477 struct ecryptfs_crypt_stat *crypt_stat;
478 char *enc_extent_virt = NULL; 478 char *enc_extent_virt;
479 struct page *enc_extent_page; 479 struct page *enc_extent_page = NULL;
480 loff_t extent_offset; 480 loff_t extent_offset;
481 int rc = 0; 481 int rc = 0;
482 482
@@ -492,14 +492,14 @@ int ecryptfs_encrypt_page(struct page *page)
492 page->index); 492 page->index);
493 goto out; 493 goto out;
494 } 494 }
495 enc_extent_virt = kmalloc(PAGE_CACHE_SIZE, GFP_USER); 495 enc_extent_page = alloc_page(GFP_USER);
496 if (!enc_extent_virt) { 496 if (!enc_extent_page) {
497 rc = -ENOMEM; 497 rc = -ENOMEM;
498 ecryptfs_printk(KERN_ERR, "Error allocating memory for " 498 ecryptfs_printk(KERN_ERR, "Error allocating memory for "
499 "encrypted extent\n"); 499 "encrypted extent\n");
500 goto out; 500 goto out;
501 } 501 }
502 enc_extent_page = virt_to_page(enc_extent_virt); 502 enc_extent_virt = kmap(enc_extent_page);
503 for (extent_offset = 0; 503 for (extent_offset = 0;
504 extent_offset < (PAGE_CACHE_SIZE / crypt_stat->extent_size); 504 extent_offset < (PAGE_CACHE_SIZE / crypt_stat->extent_size);
505 extent_offset++) { 505 extent_offset++) {
@@ -527,7 +527,10 @@ int ecryptfs_encrypt_page(struct page *page)
527 } 527 }
528 } 528 }
529out: 529out:
530 kfree(enc_extent_virt); 530 if (enc_extent_page) {
531 kunmap(enc_extent_page);
532 __free_page(enc_extent_page);
533 }
531 return rc; 534 return rc;
532} 535}
533 536
@@ -609,8 +612,8 @@ int ecryptfs_decrypt_page(struct page *page)
609{ 612{
610 struct inode *ecryptfs_inode; 613 struct inode *ecryptfs_inode;
611 struct ecryptfs_crypt_stat *crypt_stat; 614 struct ecryptfs_crypt_stat *crypt_stat;
612 char *enc_extent_virt = NULL; 615 char *enc_extent_virt;
613 struct page *enc_extent_page; 616 struct page *enc_extent_page = NULL;
614 unsigned long extent_offset; 617 unsigned long extent_offset;
615 int rc = 0; 618 int rc = 0;
616 619
@@ -627,14 +630,14 @@ int ecryptfs_decrypt_page(struct page *page)
627 page->index); 630 page->index);
628 goto out; 631 goto out;
629 } 632 }
630 enc_extent_virt = kmalloc(PAGE_CACHE_SIZE, GFP_USER); 633 enc_extent_page = alloc_page(GFP_USER);
631 if (!enc_extent_virt) { 634 if (!enc_extent_page) {
632 rc = -ENOMEM; 635 rc = -ENOMEM;
633 ecryptfs_printk(KERN_ERR, "Error allocating memory for " 636 ecryptfs_printk(KERN_ERR, "Error allocating memory for "
634 "encrypted extent\n"); 637 "encrypted extent\n");
635 goto out; 638 goto out;
636 } 639 }
637 enc_extent_page = virt_to_page(enc_extent_virt); 640 enc_extent_virt = kmap(enc_extent_page);
638 for (extent_offset = 0; 641 for (extent_offset = 0;
639 extent_offset < (PAGE_CACHE_SIZE / crypt_stat->extent_size); 642 extent_offset < (PAGE_CACHE_SIZE / crypt_stat->extent_size);
640 extent_offset++) { 643 extent_offset++) {
@@ -662,7 +665,10 @@ int ecryptfs_decrypt_page(struct page *page)
662 } 665 }
663 } 666 }
664out: 667out:
665 kfree(enc_extent_virt); 668 if (enc_extent_page) {
669 kunmap(enc_extent_page);
670 __free_page(enc_extent_page);
671 }
666 return rc; 672 return rc;
667} 673}
668 674
diff --git a/fs/exec.c b/fs/exec.c
index 9696bbf0f0b1..32993beecbe9 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -32,6 +32,7 @@
32#include <linux/swap.h> 32#include <linux/swap.h>
33#include <linux/string.h> 33#include <linux/string.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/pagemap.h>
35#include <linux/highmem.h> 36#include <linux/highmem.h>
36#include <linux/spinlock.h> 37#include <linux/spinlock.h>
37#include <linux/key.h> 38#include <linux/key.h>
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 384fc0d1dd74..991d6dfeb51f 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -791,6 +791,7 @@ const struct address_space_operations ext2_aops = {
791 .direct_IO = ext2_direct_IO, 791 .direct_IO = ext2_direct_IO,
792 .writepages = ext2_writepages, 792 .writepages = ext2_writepages,
793 .migratepage = buffer_migrate_page, 793 .migratepage = buffer_migrate_page,
794 .is_partially_uptodate = block_is_partially_uptodate,
794}; 795};
795 796
796const struct address_space_operations ext2_aops_xip = { 797const struct address_space_operations ext2_aops_xip = {
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 3bf07d70b914..507d8689b111 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1767,44 +1767,47 @@ static int ext3_journalled_set_page_dirty(struct page *page)
1767} 1767}
1768 1768
1769static const struct address_space_operations ext3_ordered_aops = { 1769static const struct address_space_operations ext3_ordered_aops = {
1770 .readpage = ext3_readpage, 1770 .readpage = ext3_readpage,
1771 .readpages = ext3_readpages, 1771 .readpages = ext3_readpages,
1772 .writepage = ext3_ordered_writepage, 1772 .writepage = ext3_ordered_writepage,
1773 .sync_page = block_sync_page, 1773 .sync_page = block_sync_page,
1774 .write_begin = ext3_write_begin, 1774 .write_begin = ext3_write_begin,
1775 .write_end = ext3_ordered_write_end, 1775 .write_end = ext3_ordered_write_end,
1776 .bmap = ext3_bmap, 1776 .bmap = ext3_bmap,
1777 .invalidatepage = ext3_invalidatepage, 1777 .invalidatepage = ext3_invalidatepage,
1778 .releasepage = ext3_releasepage, 1778 .releasepage = ext3_releasepage,
1779 .direct_IO = ext3_direct_IO, 1779 .direct_IO = ext3_direct_IO,
1780 .migratepage = buffer_migrate_page, 1780 .migratepage = buffer_migrate_page,
1781 .is_partially_uptodate = block_is_partially_uptodate,
1781}; 1782};
1782 1783
1783static const struct address_space_operations ext3_writeback_aops = { 1784static const struct address_space_operations ext3_writeback_aops = {
1784 .readpage = ext3_readpage, 1785 .readpage = ext3_readpage,
1785 .readpages = ext3_readpages, 1786 .readpages = ext3_readpages,
1786 .writepage = ext3_writeback_writepage, 1787 .writepage = ext3_writeback_writepage,
1787 .sync_page = block_sync_page, 1788 .sync_page = block_sync_page,
1788 .write_begin = ext3_write_begin, 1789 .write_begin = ext3_write_begin,
1789 .write_end = ext3_writeback_write_end, 1790 .write_end = ext3_writeback_write_end,
1790 .bmap = ext3_bmap, 1791 .bmap = ext3_bmap,
1791 .invalidatepage = ext3_invalidatepage, 1792 .invalidatepage = ext3_invalidatepage,
1792 .releasepage = ext3_releasepage, 1793 .releasepage = ext3_releasepage,
1793 .direct_IO = ext3_direct_IO, 1794 .direct_IO = ext3_direct_IO,
1794 .migratepage = buffer_migrate_page, 1795 .migratepage = buffer_migrate_page,
1796 .is_partially_uptodate = block_is_partially_uptodate,
1795}; 1797};
1796 1798
1797static const struct address_space_operations ext3_journalled_aops = { 1799static const struct address_space_operations ext3_journalled_aops = {
1798 .readpage = ext3_readpage, 1800 .readpage = ext3_readpage,
1799 .readpages = ext3_readpages, 1801 .readpages = ext3_readpages,
1800 .writepage = ext3_journalled_writepage, 1802 .writepage = ext3_journalled_writepage,
1801 .sync_page = block_sync_page, 1803 .sync_page = block_sync_page,
1802 .write_begin = ext3_write_begin, 1804 .write_begin = ext3_write_begin,
1803 .write_end = ext3_journalled_write_end, 1805 .write_end = ext3_journalled_write_end,
1804 .set_page_dirty = ext3_journalled_set_page_dirty, 1806 .set_page_dirty = ext3_journalled_set_page_dirty,
1805 .bmap = ext3_bmap, 1807 .bmap = ext3_bmap,
1806 .invalidatepage = ext3_invalidatepage, 1808 .invalidatepage = ext3_invalidatepage,
1807 .releasepage = ext3_releasepage, 1809 .releasepage = ext3_releasepage,
1810 .is_partially_uptodate = block_is_partially_uptodate,
1808}; 1811};
1809 1812
1810void ext3_set_aops(struct inode *inode) 1813void ext3_set_aops(struct inode *inode)
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 8ddced384674..f38a5afc39a1 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2810,8 +2810,9 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id,
2810 journal_unlock_updates(EXT3_SB(sb)->s_journal); 2810 journal_unlock_updates(EXT3_SB(sb)->s_journal);
2811 } 2811 }
2812 2812
2813 err = vfs_quota_on_path(sb, type, format_id, &nd.path);
2813 path_put(&nd.path); 2814 path_put(&nd.path);
2814 return vfs_quota_on(sb, type, format_id, path, remount); 2815 return err;
2815} 2816}
2816 2817
2817/* Read data from quotafile - avoid pagecache and such because we cannot afford 2818/* Read data from quotafile - avoid pagecache and such because we cannot afford
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 8ca2763df091..9843b046c235 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2806,59 +2806,63 @@ static int ext4_journalled_set_page_dirty(struct page *page)
2806} 2806}
2807 2807
2808static const struct address_space_operations ext4_ordered_aops = { 2808static const struct address_space_operations ext4_ordered_aops = {
2809 .readpage = ext4_readpage, 2809 .readpage = ext4_readpage,
2810 .readpages = ext4_readpages, 2810 .readpages = ext4_readpages,
2811 .writepage = ext4_normal_writepage, 2811 .writepage = ext4_normal_writepage,
2812 .sync_page = block_sync_page, 2812 .sync_page = block_sync_page,
2813 .write_begin = ext4_write_begin, 2813 .write_begin = ext4_write_begin,
2814 .write_end = ext4_ordered_write_end, 2814 .write_end = ext4_ordered_write_end,
2815 .bmap = ext4_bmap, 2815 .bmap = ext4_bmap,
2816 .invalidatepage = ext4_invalidatepage, 2816 .invalidatepage = ext4_invalidatepage,
2817 .releasepage = ext4_releasepage, 2817 .releasepage = ext4_releasepage,
2818 .direct_IO = ext4_direct_IO, 2818 .direct_IO = ext4_direct_IO,
2819 .migratepage = buffer_migrate_page, 2819 .migratepage = buffer_migrate_page,
2820 .is_partially_uptodate = block_is_partially_uptodate,
2820}; 2821};
2821 2822
2822static const struct address_space_operations ext4_writeback_aops = { 2823static const struct address_space_operations ext4_writeback_aops = {
2823 .readpage = ext4_readpage, 2824 .readpage = ext4_readpage,
2824 .readpages = ext4_readpages, 2825 .readpages = ext4_readpages,
2825 .writepage = ext4_normal_writepage, 2826 .writepage = ext4_normal_writepage,
2826 .sync_page = block_sync_page, 2827 .sync_page = block_sync_page,
2827 .write_begin = ext4_write_begin, 2828 .write_begin = ext4_write_begin,
2828 .write_end = ext4_writeback_write_end, 2829 .write_end = ext4_writeback_write_end,
2829 .bmap = ext4_bmap, 2830 .bmap = ext4_bmap,
2830 .invalidatepage = ext4_invalidatepage, 2831 .invalidatepage = ext4_invalidatepage,
2831 .releasepage = ext4_releasepage, 2832 .releasepage = ext4_releasepage,
2832 .direct_IO = ext4_direct_IO, 2833 .direct_IO = ext4_direct_IO,
2833 .migratepage = buffer_migrate_page, 2834 .migratepage = buffer_migrate_page,
2835 .is_partially_uptodate = block_is_partially_uptodate,
2834}; 2836};
2835 2837
2836static const struct address_space_operations ext4_journalled_aops = { 2838static const struct address_space_operations ext4_journalled_aops = {
2837 .readpage = ext4_readpage, 2839 .readpage = ext4_readpage,
2838 .readpages = ext4_readpages, 2840 .readpages = ext4_readpages,
2839 .writepage = ext4_journalled_writepage, 2841 .writepage = ext4_journalled_writepage,
2840 .sync_page = block_sync_page, 2842 .sync_page = block_sync_page,
2841 .write_begin = ext4_write_begin, 2843 .write_begin = ext4_write_begin,
2842 .write_end = ext4_journalled_write_end, 2844 .write_end = ext4_journalled_write_end,
2843 .set_page_dirty = ext4_journalled_set_page_dirty, 2845 .set_page_dirty = ext4_journalled_set_page_dirty,
2844 .bmap = ext4_bmap, 2846 .bmap = ext4_bmap,
2845 .invalidatepage = ext4_invalidatepage, 2847 .invalidatepage = ext4_invalidatepage,
2846 .releasepage = ext4_releasepage, 2848 .releasepage = ext4_releasepage,
2849 .is_partially_uptodate = block_is_partially_uptodate,
2847}; 2850};
2848 2851
2849static const struct address_space_operations ext4_da_aops = { 2852static const struct address_space_operations ext4_da_aops = {
2850 .readpage = ext4_readpage, 2853 .readpage = ext4_readpage,
2851 .readpages = ext4_readpages, 2854 .readpages = ext4_readpages,
2852 .writepage = ext4_da_writepage, 2855 .writepage = ext4_da_writepage,
2853 .writepages = ext4_da_writepages, 2856 .writepages = ext4_da_writepages,
2854 .sync_page = block_sync_page, 2857 .sync_page = block_sync_page,
2855 .write_begin = ext4_da_write_begin, 2858 .write_begin = ext4_da_write_begin,
2856 .write_end = ext4_da_write_end, 2859 .write_end = ext4_da_write_end,
2857 .bmap = ext4_bmap, 2860 .bmap = ext4_bmap,
2858 .invalidatepage = ext4_da_invalidatepage, 2861 .invalidatepage = ext4_da_invalidatepage,
2859 .releasepage = ext4_releasepage, 2862 .releasepage = ext4_releasepage,
2860 .direct_IO = ext4_direct_IO, 2863 .direct_IO = ext4_direct_IO,
2861 .migratepage = buffer_migrate_page, 2864 .migratepage = buffer_migrate_page,
2865 .is_partially_uptodate = block_is_partially_uptodate,
2862}; 2866};
2863 2867
2864void ext4_set_aops(struct inode *inode) 2868void ext4_set_aops(struct inode *inode)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index b5479b1dff14..1e69f29a8c55 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3352,8 +3352,9 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
3352 jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); 3352 jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
3353 } 3353 }
3354 3354
3355 err = vfs_quota_on_path(sb, type, format_id, &nd.path);
3355 path_put(&nd.path); 3356 path_put(&nd.path);
3356 return vfs_quota_on(sb, type, format_id, path, remount); 3357 return err;
3357} 3358}
3358 3359
3359/* Read data from quotafile - avoid pagecache and such because we cannot afford 3360/* Read data from quotafile - avoid pagecache and such because we cannot afford
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 61d625136813..ac4f7db9f134 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -49,73 +49,6 @@ static int get_close_on_exec(unsigned int fd)
49 return res; 49 return res;
50} 50}
51 51
52/*
53 * locate_fd finds a free file descriptor in the open_fds fdset,
54 * expanding the fd arrays if necessary. Must be called with the
55 * file_lock held for write.
56 */
57
58static int locate_fd(unsigned int orig_start, int cloexec)
59{
60 struct files_struct *files = current->files;
61 unsigned int newfd;
62 unsigned int start;
63 int error;
64 struct fdtable *fdt;
65
66 spin_lock(&files->file_lock);
67repeat:
68 fdt = files_fdtable(files);
69 /*
70 * Someone might have closed fd's in the range
71 * orig_start..fdt->next_fd
72 */
73 start = orig_start;
74 if (start < files->next_fd)
75 start = files->next_fd;
76
77 newfd = start;
78 if (start < fdt->max_fds)
79 newfd = find_next_zero_bit(fdt->open_fds->fds_bits,
80 fdt->max_fds, start);
81
82 error = expand_files(files, newfd);
83 if (error < 0)
84 goto out;
85
86 /*
87 * If we needed to expand the fs array we
88 * might have blocked - try again.
89 */
90 if (error)
91 goto repeat;
92
93 if (start <= files->next_fd)
94 files->next_fd = newfd + 1;
95
96 FD_SET(newfd, fdt->open_fds);
97 if (cloexec)
98 FD_SET(newfd, fdt->close_on_exec);
99 else
100 FD_CLR(newfd, fdt->close_on_exec);
101 error = newfd;
102
103out:
104 spin_unlock(&files->file_lock);
105 return error;
106}
107
108static int dupfd(struct file *file, unsigned int start, int cloexec)
109{
110 int fd = locate_fd(start, cloexec);
111 if (fd >= 0)
112 fd_install(fd, file);
113 else
114 fput(file);
115
116 return fd;
117}
118
119asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags) 52asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags)
120{ 53{
121 int err = -EBADF; 54 int err = -EBADF;
@@ -130,31 +63,35 @@ asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags)
130 return -EINVAL; 63 return -EINVAL;
131 64
132 spin_lock(&files->file_lock); 65 spin_lock(&files->file_lock);
133 if (!(file = fcheck(oldfd)))
134 goto out_unlock;
135 get_file(file); /* We are now finished with oldfd */
136
137 err = expand_files(files, newfd); 66 err = expand_files(files, newfd);
67 file = fcheck(oldfd);
68 if (unlikely(!file))
69 goto Ebadf;
138 if (unlikely(err < 0)) { 70 if (unlikely(err < 0)) {
139 if (err == -EMFILE) 71 if (err == -EMFILE)
140 err = -EBADF; 72 goto Ebadf;
141 goto out_fput; 73 goto out_unlock;
142 } 74 }
143 75 /*
144 /* To avoid races with open() and dup(), we will mark the fd as 76 * We need to detect attempts to do dup2() over allocated but still
145 * in-use in the open-file bitmap throughout the entire dup2() 77 * not finished descriptor. NB: OpenBSD avoids that at the price of
146 * process. This is quite safe: do_close() uses the fd array 78 * extra work in their equivalent of fget() - they insert struct
147 * entry, not the bitmap, to decide what work needs to be 79 * file immediately after grabbing descriptor, mark it larval if
148 * done. --sct */ 80 * more work (e.g. actual opening) is needed and make sure that
149 /* Doesn't work. open() might be there first. --AV */ 81 * fget() treats larval files as absent. Potentially interesting,
150 82 * but while extra work in fget() is trivial, locking implications
151 /* Yes. It's a race. In user space. Nothing sane to do */ 83 * and amount of surgery on open()-related paths in VFS are not.
84 * FreeBSD fails with -EBADF in the same situation, NetBSD "solution"
85 * deadlocks in rather amusing ways, AFAICS. All of that is out of
86 * scope of POSIX or SUS, since neither considers shared descriptor
87 * tables and this condition does not arise without those.
88 */
152 err = -EBUSY; 89 err = -EBUSY;
153 fdt = files_fdtable(files); 90 fdt = files_fdtable(files);
154 tofree = fdt->fd[newfd]; 91 tofree = fdt->fd[newfd];
155 if (!tofree && FD_ISSET(newfd, fdt->open_fds)) 92 if (!tofree && FD_ISSET(newfd, fdt->open_fds))
156 goto out_fput; 93 goto out_unlock;
157 94 get_file(file);
158 rcu_assign_pointer(fdt->fd[newfd], file); 95 rcu_assign_pointer(fdt->fd[newfd], file);
159 FD_SET(newfd, fdt->open_fds); 96 FD_SET(newfd, fdt->open_fds);
160 if (flags & O_CLOEXEC) 97 if (flags & O_CLOEXEC)
@@ -165,17 +102,14 @@ asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags)
165 102
166 if (tofree) 103 if (tofree)
167 filp_close(tofree, files); 104 filp_close(tofree, files);
168 err = newfd;
169out:
170 return err;
171out_unlock:
172 spin_unlock(&files->file_lock);
173 goto out;
174 105
175out_fput: 106 return newfd;
107
108Ebadf:
109 err = -EBADF;
110out_unlock:
176 spin_unlock(&files->file_lock); 111 spin_unlock(&files->file_lock);
177 fput(file); 112 return err;
178 goto out;
179} 113}
180 114
181asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd) 115asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd)
@@ -194,10 +128,15 @@ asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd)
194asmlinkage long sys_dup(unsigned int fildes) 128asmlinkage long sys_dup(unsigned int fildes)
195{ 129{
196 int ret = -EBADF; 130 int ret = -EBADF;
197 struct file * file = fget(fildes); 131 struct file *file = fget(fildes);
198 132
199 if (file) 133 if (file) {
200 ret = dupfd(file, 0, 0); 134 ret = get_unused_fd();
135 if (ret >= 0)
136 fd_install(ret, file);
137 else
138 fput(file);
139 }
201 return ret; 140 return ret;
202} 141}
203 142
@@ -322,8 +261,11 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
322 case F_DUPFD_CLOEXEC: 261 case F_DUPFD_CLOEXEC:
323 if (arg >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur) 262 if (arg >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
324 break; 263 break;
325 get_file(filp); 264 err = alloc_fd(arg, cmd == F_DUPFD_CLOEXEC ? O_CLOEXEC : 0);
326 err = dupfd(filp, arg, cmd == F_DUPFD_CLOEXEC); 265 if (err >= 0) {
266 get_file(filp);
267 fd_install(err, filp);
268 }
327 break; 269 break;
328 case F_GETFD: 270 case F_GETFD:
329 err = get_close_on_exec(fd) ? FD_CLOEXEC : 0; 271 err = get_close_on_exec(fd) ? FD_CLOEXEC : 0;
diff --git a/fs/file.c b/fs/file.c
index d8773b19fe47..f313314f996f 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -6,6 +6,7 @@
6 * Manage the dynamic fd arrays in the process files_struct. 6 * Manage the dynamic fd arrays in the process files_struct.
7 */ 7 */
8 8
9#include <linux/module.h>
9#include <linux/fs.h> 10#include <linux/fs.h>
10#include <linux/mm.h> 11#include <linux/mm.h>
11#include <linux/time.h> 12#include <linux/time.h>
@@ -432,3 +433,63 @@ struct files_struct init_files = {
432 }, 433 },
433 .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock), 434 .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock),
434}; 435};
436
437/*
438 * allocate a file descriptor, mark it busy.
439 */
440int alloc_fd(unsigned start, unsigned flags)
441{
442 struct files_struct *files = current->files;
443 unsigned int fd;
444 int error;
445 struct fdtable *fdt;
446
447 spin_lock(&files->file_lock);
448repeat:
449 fdt = files_fdtable(files);
450 fd = start;
451 if (fd < files->next_fd)
452 fd = files->next_fd;
453
454 if (fd < fdt->max_fds)
455 fd = find_next_zero_bit(fdt->open_fds->fds_bits,
456 fdt->max_fds, fd);
457
458 error = expand_files(files, fd);
459 if (error < 0)
460 goto out;
461
462 /*
463 * If we needed to expand the fs array we
464 * might have blocked - try again.
465 */
466 if (error)
467 goto repeat;
468
469 if (start <= files->next_fd)
470 files->next_fd = fd + 1;
471
472 FD_SET(fd, fdt->open_fds);
473 if (flags & O_CLOEXEC)
474 FD_SET(fd, fdt->close_on_exec);
475 else
476 FD_CLR(fd, fdt->close_on_exec);
477 error = fd;
478#if 1
479 /* Sanity check */
480 if (rcu_dereference(fdt->fd[fd]) != NULL) {
481 printk(KERN_WARNING "alloc_fd: slot %d not NULL!\n", fd);
482 rcu_assign_pointer(fdt->fd[fd], NULL);
483 }
484#endif
485
486out:
487 spin_unlock(&files->file_lock);
488 return error;
489}
490
491int get_unused_fd(void)
492{
493 return alloc_fd(0, 0);
494}
495EXPORT_SYMBOL(get_unused_fd);
diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c
index 629af01e5ade..6caf1e1ee26d 100644
--- a/fs/jffs2/summary.c
+++ b/fs/jffs2/summary.c
@@ -23,6 +23,8 @@
23 23
24int jffs2_sum_init(struct jffs2_sb_info *c) 24int jffs2_sum_init(struct jffs2_sb_info *c)
25{ 25{
26 uint32_t sum_size = max_t(uint32_t, c->sector_size, MAX_SUMMARY_SIZE);
27
26 c->summary = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL); 28 c->summary = kzalloc(sizeof(struct jffs2_summary), GFP_KERNEL);
27 29
28 if (!c->summary) { 30 if (!c->summary) {
@@ -30,7 +32,7 @@ int jffs2_sum_init(struct jffs2_sb_info *c)
30 return -ENOMEM; 32 return -ENOMEM;
31 } 33 }
32 34
33 c->summary->sum_buf = vmalloc(c->sector_size); 35 c->summary->sum_buf = kmalloc(sum_size, GFP_KERNEL);
34 36
35 if (!c->summary->sum_buf) { 37 if (!c->summary->sum_buf) {
36 JFFS2_WARNING("Can't allocate buffer for writing out summary information!\n"); 38 JFFS2_WARNING("Can't allocate buffer for writing out summary information!\n");
@@ -49,7 +51,7 @@ void jffs2_sum_exit(struct jffs2_sb_info *c)
49 51
50 jffs2_sum_disable_collecting(c->summary); 52 jffs2_sum_disable_collecting(c->summary);
51 53
52 vfree(c->summary->sum_buf); 54 kfree(c->summary->sum_buf);
53 c->summary->sum_buf = NULL; 55 c->summary->sum_buf = NULL;
54 56
55 kfree(c->summary); 57 kfree(c->summary);
@@ -665,7 +667,7 @@ crc_err:
665/* Write summary data to flash - helper function for jffs2_sum_write_sumnode() */ 667/* Write summary data to flash - helper function for jffs2_sum_write_sumnode() */
666 668
667static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, 669static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
668 uint32_t infosize, uint32_t datasize, int padsize) 670 uint32_t infosize, uint32_t datasize, int padsize)
669{ 671{
670 struct jffs2_raw_summary isum; 672 struct jffs2_raw_summary isum;
671 union jffs2_sum_mem *temp; 673 union jffs2_sum_mem *temp;
@@ -676,6 +678,26 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
676 int ret; 678 int ret;
677 size_t retlen; 679 size_t retlen;
678 680
681 if (padsize + datasize > MAX_SUMMARY_SIZE) {
682 /* It won't fit in the buffer. Abort summary for this jeb */
683 jffs2_sum_disable_collecting(c->summary);
684
685 JFFS2_WARNING("Summary too big (%d data, %d pad) in eraseblock at %08x\n",
686 datasize, padsize, jeb->offset);
687 /* Non-fatal */
688 return 0;
689 }
690 /* Is there enough space for summary? */
691 if (padsize < 0) {
692 /* don't try to write out summary for this jeb */
693 jffs2_sum_disable_collecting(c->summary);
694
695 JFFS2_WARNING("Not enough space for summary, padsize = %d\n",
696 padsize);
697 /* Non-fatal */
698 return 0;
699 }
700
679 memset(c->summary->sum_buf, 0xff, datasize); 701 memset(c->summary->sum_buf, 0xff, datasize);
680 memset(&isum, 0, sizeof(isum)); 702 memset(&isum, 0, sizeof(isum));
681 703
@@ -821,7 +843,7 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c)
821{ 843{
822 int datasize, infosize, padsize; 844 int datasize, infosize, padsize;
823 struct jffs2_eraseblock *jeb; 845 struct jffs2_eraseblock *jeb;
824 int ret; 846 int ret = 0;
825 847
826 dbg_summary("called\n"); 848 dbg_summary("called\n");
827 849
@@ -841,16 +863,6 @@ int jffs2_sum_write_sumnode(struct jffs2_sb_info *c)
841 infosize += padsize; 863 infosize += padsize;
842 datasize += padsize; 864 datasize += padsize;
843 865
844 /* Is there enough space for summary? */
845 if (padsize < 0) {
846 /* don't try to write out summary for this jeb */
847 jffs2_sum_disable_collecting(c->summary);
848
849 JFFS2_WARNING("Not enough space for summary, padsize = %d\n", padsize);
850 spin_lock(&c->erase_completion_lock);
851 return 0;
852 }
853
854 ret = jffs2_sum_write_data(c, jeb, infosize, datasize, padsize); 866 ret = jffs2_sum_write_data(c, jeb, infosize, datasize, padsize);
855 spin_lock(&c->erase_completion_lock); 867 spin_lock(&c->erase_completion_lock);
856 return ret; 868 return ret;
diff --git a/fs/jffs2/summary.h b/fs/jffs2/summary.h
index 8bf34f2fa5ce..60207a2ae952 100644
--- a/fs/jffs2/summary.h
+++ b/fs/jffs2/summary.h
@@ -13,6 +13,12 @@
13#ifndef JFFS2_SUMMARY_H 13#ifndef JFFS2_SUMMARY_H
14#define JFFS2_SUMMARY_H 14#define JFFS2_SUMMARY_H
15 15
16/* Limit summary size to 64KiB so that we can kmalloc it. If the summary
17 is larger than that, we have to just ditch it and avoid using summary
18 for the eraseblock in question... and it probably doesn't hurt us much
19 anyway. */
20#define MAX_SUMMARY_SIZE 65536
21
16#include <linux/uio.h> 22#include <linux/uio.h>
17#include <linux/jffs2.h> 23#include <linux/jffs2.h>
18 24
diff --git a/fs/libfs.c b/fs/libfs.c
index baeb71ee1cde..1add676a19df 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -216,8 +216,8 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name,
216 216
217 s->s_flags = MS_NOUSER; 217 s->s_flags = MS_NOUSER;
218 s->s_maxbytes = ~0ULL; 218 s->s_maxbytes = ~0ULL;
219 s->s_blocksize = 1024; 219 s->s_blocksize = PAGE_SIZE;
220 s->s_blocksize_bits = 10; 220 s->s_blocksize_bits = PAGE_SHIFT;
221 s->s_magic = magic; 221 s->s_magic = magic;
222 s->s_op = ops ? ops : &simple_super_operations; 222 s->s_op = ops ? ops : &simple_super_operations;
223 s->s_time_gran = 1; 223 s->s_time_gran = 1;
diff --git a/fs/namei.c b/fs/namei.c
index a7b0a0b80128..4ea63ed5e791 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -274,7 +274,7 @@ int inode_permission(struct inode *inode, int mask)
274 return retval; 274 return retval;
275 275
276 return security_inode_permission(inode, 276 return security_inode_permission(inode,
277 mask & (MAY_READ|MAY_WRITE|MAY_EXEC)); 277 mask & (MAY_READ|MAY_WRITE|MAY_EXEC|MAY_APPEND));
278} 278}
279 279
280/** 280/**
@@ -1431,8 +1431,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
1431 * 3. We should have write and exec permissions on dir 1431 * 3. We should have write and exec permissions on dir
1432 * 4. We can't do it if dir is immutable (done in permission()) 1432 * 4. We can't do it if dir is immutable (done in permission())
1433 */ 1433 */
1434static inline int may_create(struct inode *dir, struct dentry *child, 1434static inline int may_create(struct inode *dir, struct dentry *child)
1435 struct nameidata *nd)
1436{ 1435{
1437 if (child->d_inode) 1436 if (child->d_inode)
1438 return -EEXIST; 1437 return -EEXIST;
@@ -1504,7 +1503,7 @@ void unlock_rename(struct dentry *p1, struct dentry *p2)
1504int vfs_create(struct inode *dir, struct dentry *dentry, int mode, 1503int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
1505 struct nameidata *nd) 1504 struct nameidata *nd)
1506{ 1505{
1507 int error = may_create(dir, dentry, nd); 1506 int error = may_create(dir, dentry);
1508 1507
1509 if (error) 1508 if (error)
1510 return error; 1509 return error;
@@ -1948,7 +1947,7 @@ EXPORT_SYMBOL_GPL(lookup_create);
1948 1947
1949int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) 1948int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
1950{ 1949{
1951 int error = may_create(dir, dentry, NULL); 1950 int error = may_create(dir, dentry);
1952 1951
1953 if (error) 1952 if (error)
1954 return error; 1953 return error;
@@ -2049,7 +2048,7 @@ asmlinkage long sys_mknod(const char __user *filename, int mode, unsigned dev)
2049 2048
2050int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) 2049int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2051{ 2050{
2052 int error = may_create(dir, dentry, NULL); 2051 int error = may_create(dir, dentry);
2053 2052
2054 if (error) 2053 if (error)
2055 return error; 2054 return error;
@@ -2316,7 +2315,7 @@ asmlinkage long sys_unlink(const char __user *pathname)
2316 2315
2317int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) 2316int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
2318{ 2317{
2319 int error = may_create(dir, dentry, NULL); 2318 int error = may_create(dir, dentry);
2320 2319
2321 if (error) 2320 if (error)
2322 return error; 2321 return error;
@@ -2386,7 +2385,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2386 if (!inode) 2385 if (!inode)
2387 return -ENOENT; 2386 return -ENOENT;
2388 2387
2389 error = may_create(dir, new_dentry, NULL); 2388 error = may_create(dir, new_dentry);
2390 if (error) 2389 if (error)
2391 return error; 2390 return error;
2392 2391
@@ -2595,7 +2594,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2595 return error; 2594 return error;
2596 2595
2597 if (!new_dentry->d_inode) 2596 if (!new_dentry->d_inode)
2598 error = may_create(new_dir, new_dentry, NULL); 2597 error = may_create(new_dir, new_dentry);
2599 else 2598 else
2600 error = may_delete(new_dir, new_dentry, is_dir); 2599 error = may_delete(new_dir, new_dentry, is_dir);
2601 if (error) 2600 if (error)
diff --git a/fs/namespace.c b/fs/namespace.c
index 411728c0c8bb..6e283c93b50d 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1667,31 +1667,31 @@ static noinline int do_new_mount(struct nameidata *nd, char *type, int flags,
1667 if (IS_ERR(mnt)) 1667 if (IS_ERR(mnt))
1668 return PTR_ERR(mnt); 1668 return PTR_ERR(mnt);
1669 1669
1670 return do_add_mount(mnt, nd, mnt_flags, NULL); 1670 return do_add_mount(mnt, &nd->path, mnt_flags, NULL);
1671} 1671}
1672 1672
1673/* 1673/*
1674 * add a mount into a namespace's mount tree 1674 * add a mount into a namespace's mount tree
1675 * - provide the option of adding the new mount to an expiration list 1675 * - provide the option of adding the new mount to an expiration list
1676 */ 1676 */
1677int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, 1677int do_add_mount(struct vfsmount *newmnt, struct path *path,
1678 int mnt_flags, struct list_head *fslist) 1678 int mnt_flags, struct list_head *fslist)
1679{ 1679{
1680 int err; 1680 int err;
1681 1681
1682 down_write(&namespace_sem); 1682 down_write(&namespace_sem);
1683 /* Something was mounted here while we slept */ 1683 /* Something was mounted here while we slept */
1684 while (d_mountpoint(nd->path.dentry) && 1684 while (d_mountpoint(path->dentry) &&
1685 follow_down(&nd->path.mnt, &nd->path.dentry)) 1685 follow_down(&path->mnt, &path->dentry))
1686 ; 1686 ;
1687 err = -EINVAL; 1687 err = -EINVAL;
1688 if (!check_mnt(nd->path.mnt)) 1688 if (!check_mnt(path->mnt))
1689 goto unlock; 1689 goto unlock;
1690 1690
1691 /* Refuse the same filesystem on the same mount point */ 1691 /* Refuse the same filesystem on the same mount point */
1692 err = -EBUSY; 1692 err = -EBUSY;
1693 if (nd->path.mnt->mnt_sb == newmnt->mnt_sb && 1693 if (path->mnt->mnt_sb == newmnt->mnt_sb &&
1694 nd->path.mnt->mnt_root == nd->path.dentry) 1694 path->mnt->mnt_root == path->dentry)
1695 goto unlock; 1695 goto unlock;
1696 1696
1697 err = -EINVAL; 1697 err = -EINVAL;
@@ -1699,7 +1699,7 @@ int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
1699 goto unlock; 1699 goto unlock;
1700 1700
1701 newmnt->mnt_flags = mnt_flags; 1701 newmnt->mnt_flags = mnt_flags;
1702 if ((err = graft_tree(newmnt, &nd->path))) 1702 if ((err = graft_tree(newmnt, path)))
1703 goto unlock; 1703 goto unlock;
1704 1704
1705 if (fslist) /* add to the specified expiration list */ 1705 if (fslist) /* add to the specified expiration list */
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index 2f285ef76399..66df08dd1caf 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -129,7 +129,7 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
129 goto out_err; 129 goto out_err;
130 130
131 mntget(mnt); 131 mntget(mnt);
132 err = do_add_mount(mnt, nd, nd->path.mnt->mnt_flags|MNT_SHRINKABLE, 132 err = do_add_mount(mnt, &nd->path, nd->path.mnt->mnt_flags|MNT_SHRINKABLE,
133 &nfs_automount_list); 133 &nfs_automount_list);
134 if (err < 0) { 134 if (err < 0) {
135 mntput(mnt); 135 mntput(mnt);
diff --git a/fs/omfs/bitmap.c b/fs/omfs/bitmap.c
index dc75f22be3f2..697663b01bae 100644
--- a/fs/omfs/bitmap.c
+++ b/fs/omfs/bitmap.c
@@ -71,10 +71,10 @@ static int set_run(struct super_block *sb, int map,
71 } 71 }
72 if (set) { 72 if (set) {
73 set_bit(bit, sbi->s_imap[map]); 73 set_bit(bit, sbi->s_imap[map]);
74 set_bit(bit, (long *) bh->b_data); 74 set_bit(bit, (unsigned long *)bh->b_data);
75 } else { 75 } else {
76 clear_bit(bit, sbi->s_imap[map]); 76 clear_bit(bit, sbi->s_imap[map]);
77 clear_bit(bit, (long *) bh->b_data); 77 clear_bit(bit, (unsigned long *)bh->b_data);
78 } 78 }
79 } 79 }
80 mark_buffer_dirty(bh); 80 mark_buffer_dirty(bh);
@@ -109,7 +109,7 @@ int omfs_allocate_block(struct super_block *sb, u64 block)
109 if (!bh) 109 if (!bh)
110 goto out; 110 goto out;
111 111
112 set_bit(bit, (long *) bh->b_data); 112 set_bit(bit, (unsigned long *)bh->b_data);
113 mark_buffer_dirty(bh); 113 mark_buffer_dirty(bh);
114 brelse(bh); 114 brelse(bh);
115 } 115 }
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c
index 05a5bc31e4bd..c0757e998876 100644
--- a/fs/omfs/dir.c
+++ b/fs/omfs/dir.c
@@ -104,7 +104,7 @@ int omfs_make_empty(struct inode *inode, struct super_block *sb)
104 104
105 oi = (struct omfs_inode *) bh->b_data; 105 oi = (struct omfs_inode *) bh->b_data;
106 oi->i_head.h_self = cpu_to_be64(inode->i_ino); 106 oi->i_head.h_self = cpu_to_be64(inode->i_ino);
107 oi->i_sibling = ~0ULL; 107 oi->i_sibling = ~cpu_to_be64(0ULL);
108 108
109 mark_buffer_dirty(bh); 109 mark_buffer_dirty(bh);
110 brelse(bh); 110 brelse(bh);
diff --git a/fs/omfs/file.c b/fs/omfs/file.c
index 66e01fae4384..7e2499053e4d 100644
--- a/fs/omfs/file.c
+++ b/fs/omfs/file.c
@@ -30,11 +30,11 @@ void omfs_make_empty_table(struct buffer_head *bh, int offset)
30{ 30{
31 struct omfs_extent *oe = (struct omfs_extent *) &bh->b_data[offset]; 31 struct omfs_extent *oe = (struct omfs_extent *) &bh->b_data[offset];
32 32
33 oe->e_next = ~0ULL; 33 oe->e_next = ~cpu_to_be64(0ULL);
34 oe->e_extent_count = cpu_to_be32(1), 34 oe->e_extent_count = cpu_to_be32(1),
35 oe->e_fill = cpu_to_be32(0x22), 35 oe->e_fill = cpu_to_be32(0x22),
36 oe->e_entry.e_cluster = ~0ULL; 36 oe->e_entry.e_cluster = ~cpu_to_be64(0ULL);
37 oe->e_entry.e_blocks = ~0ULL; 37 oe->e_entry.e_blocks = ~cpu_to_be64(0ULL);
38} 38}
39 39
40int omfs_shrink_inode(struct inode *inode) 40int omfs_shrink_inode(struct inode *inode)
diff --git a/fs/open.c b/fs/open.c
index 52647be277a2..07da9359481c 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -963,62 +963,6 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
963} 963}
964EXPORT_SYMBOL(dentry_open); 964EXPORT_SYMBOL(dentry_open);
965 965
966/*
967 * Find an empty file descriptor entry, and mark it busy.
968 */
969int get_unused_fd_flags(int flags)
970{
971 struct files_struct * files = current->files;
972 int fd, error;
973 struct fdtable *fdt;
974
975 spin_lock(&files->file_lock);
976
977repeat:
978 fdt = files_fdtable(files);
979 fd = find_next_zero_bit(fdt->open_fds->fds_bits, fdt->max_fds,
980 files->next_fd);
981
982 /* Do we need to expand the fd array or fd set? */
983 error = expand_files(files, fd);
984 if (error < 0)
985 goto out;
986
987 if (error) {
988 /*
989 * If we needed to expand the fs array we
990 * might have blocked - try again.
991 */
992 goto repeat;
993 }
994
995 FD_SET(fd, fdt->open_fds);
996 if (flags & O_CLOEXEC)
997 FD_SET(fd, fdt->close_on_exec);
998 else
999 FD_CLR(fd, fdt->close_on_exec);
1000 files->next_fd = fd + 1;
1001#if 1
1002 /* Sanity check */
1003 if (fdt->fd[fd] != NULL) {
1004 printk(KERN_WARNING "get_unused_fd: slot %d not NULL!\n", fd);
1005 fdt->fd[fd] = NULL;
1006 }
1007#endif
1008 error = fd;
1009
1010out:
1011 spin_unlock(&files->file_lock);
1012 return error;
1013}
1014
1015int get_unused_fd(void)
1016{
1017 return get_unused_fd_flags(0);
1018}
1019
1020EXPORT_SYMBOL(get_unused_fd);
1021
1022static void __put_unused_fd(struct files_struct *files, unsigned int fd) 966static void __put_unused_fd(struct files_struct *files, unsigned int fd)
1023{ 967{
1024 struct fdtable *fdt = files_fdtable(files); 968 struct fdtable *fdt = files_fdtable(files);
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index cb4096cc3fb7..4fb81e9c94e3 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -300,10 +300,10 @@ out:
300 return rtn; 300 return rtn;
301} 301}
302 302
303static DEFINE_IDR(proc_inum_idr); 303static DEFINE_IDA(proc_inum_ida);
304static DEFINE_SPINLOCK(proc_inum_lock); /* protects the above */ 304static DEFINE_SPINLOCK(proc_inum_lock); /* protects the above */
305 305
306#define PROC_DYNAMIC_FIRST 0xF0000000UL 306#define PROC_DYNAMIC_FIRST 0xF0000000U
307 307
308/* 308/*
309 * Return an inode number between PROC_DYNAMIC_FIRST and 309 * Return an inode number between PROC_DYNAMIC_FIRST and
@@ -311,36 +311,33 @@ static DEFINE_SPINLOCK(proc_inum_lock); /* protects the above */
311 */ 311 */
312static unsigned int get_inode_number(void) 312static unsigned int get_inode_number(void)
313{ 313{
314 int i, inum = 0; 314 unsigned int i;
315 int error; 315 int error;
316 316
317retry: 317retry:
318 if (idr_pre_get(&proc_inum_idr, GFP_KERNEL) == 0) 318 if (ida_pre_get(&proc_inum_ida, GFP_KERNEL) == 0)
319 return 0; 319 return 0;
320 320
321 spin_lock(&proc_inum_lock); 321 spin_lock(&proc_inum_lock);
322 error = idr_get_new(&proc_inum_idr, NULL, &i); 322 error = ida_get_new(&proc_inum_ida, &i);
323 spin_unlock(&proc_inum_lock); 323 spin_unlock(&proc_inum_lock);
324 if (error == -EAGAIN) 324 if (error == -EAGAIN)
325 goto retry; 325 goto retry;
326 else if (error) 326 else if (error)
327 return 0; 327 return 0;
328 328
329 inum = (i & MAX_ID_MASK) + PROC_DYNAMIC_FIRST; 329 if (i > UINT_MAX - PROC_DYNAMIC_FIRST) {
330 330 spin_lock(&proc_inum_lock);
331 /* inum will never be more than 0xf0ffffff, so no check 331 ida_remove(&proc_inum_ida, i);
332 * for overflow. 332 spin_unlock(&proc_inum_lock);
333 */ 333 }
334 334 return PROC_DYNAMIC_FIRST + i;
335 return inum;
336} 335}
337 336
338static void release_inode_number(unsigned int inum) 337static void release_inode_number(unsigned int inum)
339{ 338{
340 int id = (inum - PROC_DYNAMIC_FIRST) | ~MAX_ID_MASK;
341
342 spin_lock(&proc_inum_lock); 339 spin_lock(&proc_inum_lock);
343 idr_remove(&proc_inum_idr, id); 340 ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST);
344 spin_unlock(&proc_inum_lock); 341 spin_unlock(&proc_inum_lock);
345} 342}
346 343
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 879e54d35c2d..282a13596c70 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -2076,8 +2076,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2076 return err; 2076 return err;
2077 /* Quotafile not on the same filesystem? */ 2077 /* Quotafile not on the same filesystem? */
2078 if (nd.path.mnt->mnt_sb != sb) { 2078 if (nd.path.mnt->mnt_sb != sb) {
2079 path_put(&nd.path); 2079 err = -EXDEV;
2080 return -EXDEV; 2080 goto out;
2081 } 2081 }
2082 inode = nd.path.dentry->d_inode; 2082 inode = nd.path.dentry->d_inode;
2083 /* We must not pack tails for quota files on reiserfs for quota IO to work */ 2083 /* We must not pack tails for quota files on reiserfs for quota IO to work */
@@ -2087,8 +2087,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2087 reiserfs_warning(sb, 2087 reiserfs_warning(sb,
2088 "reiserfs: Unpacking tail of quota file failed" 2088 "reiserfs: Unpacking tail of quota file failed"
2089 " (%d). Cannot turn on quotas.", err); 2089 " (%d). Cannot turn on quotas.", err);
2090 path_put(&nd.path); 2090 err = -EINVAL;
2091 return -EINVAL; 2091 goto out;
2092 } 2092 }
2093 mark_inode_dirty(inode); 2093 mark_inode_dirty(inode);
2094 } 2094 }
@@ -2109,13 +2109,15 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
2109 /* Just start temporary transaction and finish it */ 2109 /* Just start temporary transaction and finish it */
2110 err = journal_begin(&th, sb, 1); 2110 err = journal_begin(&th, sb, 1);
2111 if (err) 2111 if (err)
2112 return err; 2112 goto out;
2113 err = journal_end_sync(&th, sb, 1); 2113 err = journal_end_sync(&th, sb, 1);
2114 if (err) 2114 if (err)
2115 return err; 2115 goto out;
2116 } 2116 }
2117 err = vfs_quota_on_path(sb, type, format_id, &nd.path);
2118out:
2117 path_put(&nd.path); 2119 path_put(&nd.path);
2118 return vfs_quota_on(sb, type, format_id, path, 0); 2120 return err;
2119} 2121}
2120 2122
2121/* Read data from quotafile - avoid pagecache and such because we cannot afford 2123/* Read data from quotafile - avoid pagecache and such because we cannot afford
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index 8e51a2aaa977..60d2f822e87b 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -418,7 +418,8 @@ static int
418romfs_readpage(struct file *file, struct page * page) 418romfs_readpage(struct file *file, struct page * page)
419{ 419{
420 struct inode *inode = page->mapping->host; 420 struct inode *inode = page->mapping->host;
421 loff_t offset, avail, readlen; 421 loff_t offset, size;
422 unsigned long filled;
422 void *buf; 423 void *buf;
423 int result = -EIO; 424 int result = -EIO;
424 425
@@ -430,21 +431,29 @@ romfs_readpage(struct file *file, struct page * page)
430 431
431 /* 32 bit warning -- but not for us :) */ 432 /* 32 bit warning -- but not for us :) */
432 offset = page_offset(page); 433 offset = page_offset(page);
433 if (offset < i_size_read(inode)) { 434 size = i_size_read(inode);
434 avail = inode->i_size-offset; 435 filled = 0;
435 readlen = min_t(unsigned long, avail, PAGE_SIZE); 436 result = 0;
436 if (romfs_copyfrom(inode, buf, ROMFS_I(inode)->i_dataoffset+offset, readlen) == readlen) { 437 if (offset < size) {
437 if (readlen < PAGE_SIZE) { 438 unsigned long readlen;
438 memset(buf + readlen,0,PAGE_SIZE-readlen); 439
439 } 440 size -= offset;
440 SetPageUptodate(page); 441 readlen = size > PAGE_SIZE ? PAGE_SIZE : size;
441 result = 0; 442
443 filled = romfs_copyfrom(inode, buf, ROMFS_I(inode)->i_dataoffset+offset, readlen);
444
445 if (filled != readlen) {
446 SetPageError(page);
447 filled = 0;
448 result = -EIO;
442 } 449 }
443 } 450 }
444 if (result) { 451
445 memset(buf, 0, PAGE_SIZE); 452 if (filled < PAGE_SIZE)
446 SetPageError(page); 453 memset(buf + filled, 0, PAGE_SIZE-filled);
447 } 454
455 if (!result)
456 SetPageUptodate(page);
448 flush_dcache_page(page); 457 flush_dcache_page(page);
449 458
450 unlock_page(page); 459 unlock_page(page);
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 1ebbe883f786..13a3d9ad92db 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -277,6 +277,7 @@ enum acpi_prefered_pm_profiles {
277#define BAF_LEGACY_DEVICES 0x0001 277#define BAF_LEGACY_DEVICES 0x0001
278#define BAF_8042_KEYBOARD_CONTROLLER 0x0002 278#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
279#define BAF_MSI_NOT_SUPPORTED 0x0008 279#define BAF_MSI_NOT_SUPPORTED 0x0008
280#define BAF_PCIE_ASPM_CONTROL 0x0010
280 281
281#define FADT2_REVISION_ID 3 282#define FADT2_REVISION_ID 3
282#define FADT2_MINUS_REVISION_ID 2 283#define FADT2_MINUS_REVISION_ID 2
diff --git a/include/asm-arm/arch-s3c2410/spi.h b/include/asm-arm/arch-s3c2410/spi.h
index 352d33860b63..442169887d3b 100644
--- a/include/asm-arm/arch-s3c2410/spi.h
+++ b/include/asm-arm/arch-s3c2410/spi.h
@@ -16,6 +16,7 @@
16struct s3c2410_spi_info { 16struct s3c2410_spi_info {
17 unsigned long pin_cs; /* simple gpio cs */ 17 unsigned long pin_cs; /* simple gpio cs */
18 unsigned int num_cs; /* total chipselects */ 18 unsigned int num_cs; /* total chipselects */
19 int bus_num; /* bus number to use. */
19 20
20 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol); 21 void (*set_cs)(struct s3c2410_spi_info *spi, int cs, int pol);
21}; 22};
diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
index f41335ba6337..45329fca1b64 100644
--- a/include/asm-arm/dma-mapping.h
+++ b/include/asm-arm/dma-mapping.h
@@ -7,6 +7,8 @@
7 7
8#include <linux/scatterlist.h> 8#include <linux/scatterlist.h>
9 9
10#include <asm-generic/dma-coherent.h>
11
10/* 12/*
11 * DMA-consistent mapping functions. These allocate/free a region of 13 * DMA-consistent mapping functions. These allocate/free a region of
12 * uncached, unwrite-buffered mapped memory space for use with DMA 14 * uncached, unwrite-buffered mapped memory space for use with DMA
diff --git a/include/asm-arm/plat-s3c/iic.h b/include/asm-arm/plat-s3c/iic.h
index 71211c8b5384..d08a1f2863e4 100644
--- a/include/asm-arm/plat-s3c/iic.h
+++ b/include/asm-arm/plat-s3c/iic.h
@@ -21,6 +21,7 @@
21*/ 21*/
22 22
23struct s3c2410_platform_i2c { 23struct s3c2410_platform_i2c {
24 int bus_num; /* bus number to use */
24 unsigned int flags; 25 unsigned int flags;
25 unsigned int slave_addr; /* slave address for controller */ 26 unsigned int slave_addr; /* slave address for controller */
26 unsigned long bus_freq; /* standard bus frequency */ 27 unsigned long bus_freq; /* standard bus frequency */
diff --git a/include/asm-cris/dma-mapping.h b/include/asm-cris/dma-mapping.h
index cb2fb25ff8d9..da8ef8e8f842 100644
--- a/include/asm-cris/dma-mapping.h
+++ b/include/asm-cris/dma-mapping.h
@@ -14,6 +14,8 @@
14#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 14#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
15 15
16#ifdef CONFIG_PCI 16#ifdef CONFIG_PCI
17#include <asm-generic/dma-coherent.h>
18
17void *dma_alloc_coherent(struct device *dev, size_t size, 19void *dma_alloc_coherent(struct device *dev, size_t size,
18 dma_addr_t *dma_handle, gfp_t flag); 20 dma_addr_t *dma_handle, gfp_t flag);
19 21
diff --git a/include/asm-generic/dma-coherent.h b/include/asm-generic/dma-coherent.h
new file mode 100644
index 000000000000..85a3ffaa0242
--- /dev/null
+++ b/include/asm-generic/dma-coherent.h
@@ -0,0 +1,32 @@
1#ifndef DMA_COHERENT_H
2#define DMA_COHERENT_H
3
4#ifdef CONFIG_HAVE_GENERIC_DMA_COHERENT
5/*
6 * These two functions are only for dma allocator.
7 * Don't use them in device drivers.
8 */
9int dma_alloc_from_coherent(struct device *dev, ssize_t size,
10 dma_addr_t *dma_handle, void **ret);
11int dma_release_from_coherent(struct device *dev, int order, void *vaddr);
12
13/*
14 * Standard interface
15 */
16#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
17extern int
18dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
19 dma_addr_t device_addr, size_t size, int flags);
20
21extern void
22dma_release_declared_memory(struct device *dev);
23
24extern void *
25dma_mark_declared_memory_occupied(struct device *dev,
26 dma_addr_t device_addr, size_t size);
27#else
28#define dma_alloc_from_coherent(dev, size, handle, ret) (0)
29#define dma_release_from_coherent(dev, order, vaddr) (0)
30#endif
31
32#endif
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index c764a8fcb058..0f99ad38b012 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -2,6 +2,7 @@
2#define _ASM_GENERIC_GPIO_H 2#define _ASM_GENERIC_GPIO_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/errno.h>
5 6
6#ifdef CONFIG_GPIOLIB 7#ifdef CONFIG_GPIOLIB
7 8
diff --git a/include/asm-generic/pgtable-nopmd.h b/include/asm-generic/pgtable-nopmd.h
index 087325ede76c..a7cdc48e8b78 100644
--- a/include/asm-generic/pgtable-nopmd.h
+++ b/include/asm-generic/pgtable-nopmd.h
@@ -5,6 +5,8 @@
5 5
6#include <asm-generic/pgtable-nopud.h> 6#include <asm-generic/pgtable-nopud.h>
7 7
8struct mm_struct;
9
8#define __PAGETABLE_PMD_FOLDED 10#define __PAGETABLE_PMD_FOLDED
9 11
10/* 12/*
@@ -54,7 +56,9 @@ static inline pmd_t * pmd_offset(pud_t * pud, unsigned long address)
54 * inside the pud, so has no extra memory associated with it. 56 * inside the pud, so has no extra memory associated with it.
55 */ 57 */
56#define pmd_alloc_one(mm, address) NULL 58#define pmd_alloc_one(mm, address) NULL
57#define pmd_free(mm, x) do { } while (0) 59static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
60{
61}
58#define __pmd_free_tlb(tlb, x) do { } while (0) 62#define __pmd_free_tlb(tlb, x) do { } while (0)
59 63
60#undef pmd_addr_end 64#undef pmd_addr_end
diff --git a/include/asm-ia64/sn/mspec.h b/include/asm-ia64/sn/mspec.h
index dbe13c6121a8..c1d3c50c3223 100644
--- a/include/asm-ia64/sn/mspec.h
+++ b/include/asm-ia64/sn/mspec.h
@@ -4,7 +4,7 @@
4 * License. See the file "COPYING" in the main directory of this archive 4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details. 5 * for more details.
6 * 6 *
7 * Copyright (c) 2001-2004 Silicon Graphics, Inc. All rights reserved. 7 * Copyright (c) 2001-2008 Silicon Graphics, Inc. All rights reserved.
8 */ 8 */
9 9
10#ifndef _ASM_IA64_SN_MSPEC_H 10#ifndef _ASM_IA64_SN_MSPEC_H
@@ -32,26 +32,26 @@
32#ifdef __KERNEL__ 32#ifdef __KERNEL__
33 33
34/* 34/*
35 * Each Atomic Memory Operation (AMO formerly known as fetchop) 35 * Each Atomic Memory Operation (amo, formerly known as fetchop)
36 * variable is 64 bytes long. The first 8 bytes are used. The 36 * variable is 64 bytes long. The first 8 bytes are used. The
37 * remaining 56 bytes are unaddressable due to the operation taking 37 * remaining 56 bytes are unaddressable due to the operation taking
38 * that portion of the address. 38 * that portion of the address.
39 * 39 *
40 * NOTE: The AMO_t _MUST_ be placed in either the first or second half 40 * NOTE: The amo structure _MUST_ be placed in either the first or second
41 * of the cache line. The cache line _MUST NOT_ be used for anything 41 * half of the cache line. The cache line _MUST NOT_ be used for anything
42 * other than additional AMO_t entries. This is because there are two 42 * other than additional amo entries. This is because there are two
43 * addresses which reference the same physical cache line. One will 43 * addresses which reference the same physical cache line. One will
44 * be a cached entry with the memory type bits all set. This address 44 * be a cached entry with the memory type bits all set. This address
45 * may be loaded into processor cache. The AMO_t will be referenced 45 * may be loaded into processor cache. The amo will be referenced
46 * uncached via the memory special memory type. If any portion of the 46 * uncached via the memory special memory type. If any portion of the
47 * cached cache-line is modified, when that line is flushed, it will 47 * cached cache-line is modified, when that line is flushed, it will
48 * overwrite the uncached value in physical memory and lead to 48 * overwrite the uncached value in physical memory and lead to
49 * inconsistency. 49 * inconsistency.
50 */ 50 */
51typedef struct { 51struct amo {
52 u64 variable; 52 u64 variable;
53 u64 unused[7]; 53 u64 unused[7];
54} AMO_t; 54};
55 55
56 56
57#endif /* __KERNEL__ */ 57#endif /* __KERNEL__ */
diff --git a/include/asm-mips/gdb-stub.h b/include/asm-mips/gdb-stub.h
deleted file mode 100644
index 22f67d4a71ab..000000000000
--- a/include/asm-mips/gdb-stub.h
+++ /dev/null
@@ -1,215 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995 Andreas Busse
7 * Copyright (C) 2003 Ralf Baechle
8 */
9#ifndef _ASM_GDB_STUB_H
10#define _ASM_GDB_STUB_H
11
12
13/*
14 * important register numbers
15 */
16
17#define REG_EPC 37
18#define REG_FP 72
19#define REG_SP 29
20
21/*
22 * Stack layout for the GDB exception handler
23 * Derived from the stack layout described in asm-mips/stackframe.h
24 *
25 * The first PTRSIZE*6 bytes are argument save space for C subroutines.
26 */
27#define NUMREGS 90
28
29#define GDB_FR_REG0 (PTRSIZE*6) /* 0 */
30#define GDB_FR_REG1 ((GDB_FR_REG0) + LONGSIZE) /* 1 */
31#define GDB_FR_REG2 ((GDB_FR_REG1) + LONGSIZE) /* 2 */
32#define GDB_FR_REG3 ((GDB_FR_REG2) + LONGSIZE) /* 3 */
33#define GDB_FR_REG4 ((GDB_FR_REG3) + LONGSIZE) /* 4 */
34#define GDB_FR_REG5 ((GDB_FR_REG4) + LONGSIZE) /* 5 */
35#define GDB_FR_REG6 ((GDB_FR_REG5) + LONGSIZE) /* 6 */
36#define GDB_FR_REG7 ((GDB_FR_REG6) + LONGSIZE) /* 7 */
37#define GDB_FR_REG8 ((GDB_FR_REG7) + LONGSIZE) /* 8 */
38#define GDB_FR_REG9 ((GDB_FR_REG8) + LONGSIZE) /* 9 */
39#define GDB_FR_REG10 ((GDB_FR_REG9) + LONGSIZE) /* 10 */
40#define GDB_FR_REG11 ((GDB_FR_REG10) + LONGSIZE) /* 11 */
41#define GDB_FR_REG12 ((GDB_FR_REG11) + LONGSIZE) /* 12 */
42#define GDB_FR_REG13 ((GDB_FR_REG12) + LONGSIZE) /* 13 */
43#define GDB_FR_REG14 ((GDB_FR_REG13) + LONGSIZE) /* 14 */
44#define GDB_FR_REG15 ((GDB_FR_REG14) + LONGSIZE) /* 15 */
45#define GDB_FR_REG16 ((GDB_FR_REG15) + LONGSIZE) /* 16 */
46#define GDB_FR_REG17 ((GDB_FR_REG16) + LONGSIZE) /* 17 */
47#define GDB_FR_REG18 ((GDB_FR_REG17) + LONGSIZE) /* 18 */
48#define GDB_FR_REG19 ((GDB_FR_REG18) + LONGSIZE) /* 19 */
49#define GDB_FR_REG20 ((GDB_FR_REG19) + LONGSIZE) /* 20 */
50#define GDB_FR_REG21 ((GDB_FR_REG20) + LONGSIZE) /* 21 */
51#define GDB_FR_REG22 ((GDB_FR_REG21) + LONGSIZE) /* 22 */
52#define GDB_FR_REG23 ((GDB_FR_REG22) + LONGSIZE) /* 23 */
53#define GDB_FR_REG24 ((GDB_FR_REG23) + LONGSIZE) /* 24 */
54#define GDB_FR_REG25 ((GDB_FR_REG24) + LONGSIZE) /* 25 */
55#define GDB_FR_REG26 ((GDB_FR_REG25) + LONGSIZE) /* 26 */
56#define GDB_FR_REG27 ((GDB_FR_REG26) + LONGSIZE) /* 27 */
57#define GDB_FR_REG28 ((GDB_FR_REG27) + LONGSIZE) /* 28 */
58#define GDB_FR_REG29 ((GDB_FR_REG28) + LONGSIZE) /* 29 */
59#define GDB_FR_REG30 ((GDB_FR_REG29) + LONGSIZE) /* 30 */
60#define GDB_FR_REG31 ((GDB_FR_REG30) + LONGSIZE) /* 31 */
61
62/*
63 * Saved special registers
64 */
65#define GDB_FR_STATUS ((GDB_FR_REG31) + LONGSIZE) /* 32 */
66#define GDB_FR_LO ((GDB_FR_STATUS) + LONGSIZE) /* 33 */
67#define GDB_FR_HI ((GDB_FR_LO) + LONGSIZE) /* 34 */
68#define GDB_FR_BADVADDR ((GDB_FR_HI) + LONGSIZE) /* 35 */
69#define GDB_FR_CAUSE ((GDB_FR_BADVADDR) + LONGSIZE) /* 36 */
70#define GDB_FR_EPC ((GDB_FR_CAUSE) + LONGSIZE) /* 37 */
71
72/*
73 * Saved floating point registers
74 */
75#define GDB_FR_FPR0 ((GDB_FR_EPC) + LONGSIZE) /* 38 */
76#define GDB_FR_FPR1 ((GDB_FR_FPR0) + LONGSIZE) /* 39 */
77#define GDB_FR_FPR2 ((GDB_FR_FPR1) + LONGSIZE) /* 40 */
78#define GDB_FR_FPR3 ((GDB_FR_FPR2) + LONGSIZE) /* 41 */
79#define GDB_FR_FPR4 ((GDB_FR_FPR3) + LONGSIZE) /* 42 */
80#define GDB_FR_FPR5 ((GDB_FR_FPR4) + LONGSIZE) /* 43 */
81#define GDB_FR_FPR6 ((GDB_FR_FPR5) + LONGSIZE) /* 44 */
82#define GDB_FR_FPR7 ((GDB_FR_FPR6) + LONGSIZE) /* 45 */
83#define GDB_FR_FPR8 ((GDB_FR_FPR7) + LONGSIZE) /* 46 */
84#define GDB_FR_FPR9 ((GDB_FR_FPR8) + LONGSIZE) /* 47 */
85#define GDB_FR_FPR10 ((GDB_FR_FPR9) + LONGSIZE) /* 48 */
86#define GDB_FR_FPR11 ((GDB_FR_FPR10) + LONGSIZE) /* 49 */
87#define GDB_FR_FPR12 ((GDB_FR_FPR11) + LONGSIZE) /* 50 */
88#define GDB_FR_FPR13 ((GDB_FR_FPR12) + LONGSIZE) /* 51 */
89#define GDB_FR_FPR14 ((GDB_FR_FPR13) + LONGSIZE) /* 52 */
90#define GDB_FR_FPR15 ((GDB_FR_FPR14) + LONGSIZE) /* 53 */
91#define GDB_FR_FPR16 ((GDB_FR_FPR15) + LONGSIZE) /* 54 */
92#define GDB_FR_FPR17 ((GDB_FR_FPR16) + LONGSIZE) /* 55 */
93#define GDB_FR_FPR18 ((GDB_FR_FPR17) + LONGSIZE) /* 56 */
94#define GDB_FR_FPR19 ((GDB_FR_FPR18) + LONGSIZE) /* 57 */
95#define GDB_FR_FPR20 ((GDB_FR_FPR19) + LONGSIZE) /* 58 */
96#define GDB_FR_FPR21 ((GDB_FR_FPR20) + LONGSIZE) /* 59 */
97#define GDB_FR_FPR22 ((GDB_FR_FPR21) + LONGSIZE) /* 60 */
98#define GDB_FR_FPR23 ((GDB_FR_FPR22) + LONGSIZE) /* 61 */
99#define GDB_FR_FPR24 ((GDB_FR_FPR23) + LONGSIZE) /* 62 */
100#define GDB_FR_FPR25 ((GDB_FR_FPR24) + LONGSIZE) /* 63 */
101#define GDB_FR_FPR26 ((GDB_FR_FPR25) + LONGSIZE) /* 64 */
102#define GDB_FR_FPR27 ((GDB_FR_FPR26) + LONGSIZE) /* 65 */
103#define GDB_FR_FPR28 ((GDB_FR_FPR27) + LONGSIZE) /* 66 */
104#define GDB_FR_FPR29 ((GDB_FR_FPR28) + LONGSIZE) /* 67 */
105#define GDB_FR_FPR30 ((GDB_FR_FPR29) + LONGSIZE) /* 68 */
106#define GDB_FR_FPR31 ((GDB_FR_FPR30) + LONGSIZE) /* 69 */
107
108#define GDB_FR_FSR ((GDB_FR_FPR31) + LONGSIZE) /* 70 */
109#define GDB_FR_FIR ((GDB_FR_FSR) + LONGSIZE) /* 71 */
110#define GDB_FR_FRP ((GDB_FR_FIR) + LONGSIZE) /* 72 */
111
112#define GDB_FR_DUMMY ((GDB_FR_FRP) + LONGSIZE) /* 73, unused ??? */
113
114/*
115 * Again, CP0 registers
116 */
117#define GDB_FR_CP0_INDEX ((GDB_FR_DUMMY) + LONGSIZE) /* 74 */
118#define GDB_FR_CP0_RANDOM ((GDB_FR_CP0_INDEX) + LONGSIZE) /* 75 */
119#define GDB_FR_CP0_ENTRYLO0 ((GDB_FR_CP0_RANDOM) + LONGSIZE)/* 76 */
120#define GDB_FR_CP0_ENTRYLO1 ((GDB_FR_CP0_ENTRYLO0) + LONGSIZE)/* 77 */
121#define GDB_FR_CP0_CONTEXT ((GDB_FR_CP0_ENTRYLO1) + LONGSIZE)/* 78 */
122#define GDB_FR_CP0_PAGEMASK ((GDB_FR_CP0_CONTEXT) + LONGSIZE)/* 79 */
123#define GDB_FR_CP0_WIRED ((GDB_FR_CP0_PAGEMASK) + LONGSIZE)/* 80 */
124#define GDB_FR_CP0_REG7 ((GDB_FR_CP0_WIRED) + LONGSIZE) /* 81 */
125#define GDB_FR_CP0_REG8 ((GDB_FR_CP0_REG7) + LONGSIZE) /* 82 */
126#define GDB_FR_CP0_REG9 ((GDB_FR_CP0_REG8) + LONGSIZE) /* 83 */
127#define GDB_FR_CP0_ENTRYHI ((GDB_FR_CP0_REG9) + LONGSIZE) /* 84 */
128#define GDB_FR_CP0_REG11 ((GDB_FR_CP0_ENTRYHI) + LONGSIZE)/* 85 */
129#define GDB_FR_CP0_REG12 ((GDB_FR_CP0_REG11) + LONGSIZE) /* 86 */
130#define GDB_FR_CP0_REG13 ((GDB_FR_CP0_REG12) + LONGSIZE) /* 87 */
131#define GDB_FR_CP0_REG14 ((GDB_FR_CP0_REG13) + LONGSIZE) /* 88 */
132#define GDB_FR_CP0_PRID ((GDB_FR_CP0_REG14) + LONGSIZE) /* 89 */
133
134#define GDB_FR_SIZE ((((GDB_FR_CP0_PRID) + LONGSIZE) + (PTRSIZE-1)) & ~(PTRSIZE-1))
135
136#ifndef __ASSEMBLY__
137
138/*
139 * This is the same as above, but for the high-level
140 * part of the GDB stub.
141 */
142
143struct gdb_regs {
144 /*
145 * Pad bytes for argument save space on the stack
146 * 24/48 Bytes for 32/64 bit code
147 */
148 unsigned long pad0[6];
149
150 /*
151 * saved main processor registers
152 */
153 long reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7;
154 long reg8, reg9, reg10, reg11, reg12, reg13, reg14, reg15;
155 long reg16, reg17, reg18, reg19, reg20, reg21, reg22, reg23;
156 long reg24, reg25, reg26, reg27, reg28, reg29, reg30, reg31;
157
158 /*
159 * Saved special registers
160 */
161 long cp0_status;
162 long lo;
163 long hi;
164 long cp0_badvaddr;
165 long cp0_cause;
166 long cp0_epc;
167
168 /*
169 * Saved floating point registers
170 */
171 long fpr0, fpr1, fpr2, fpr3, fpr4, fpr5, fpr6, fpr7;
172 long fpr8, fpr9, fpr10, fpr11, fpr12, fpr13, fpr14, fpr15;
173 long fpr16, fpr17, fpr18, fpr19, fpr20, fpr21, fpr22, fpr23;
174 long fpr24, fpr25, fpr26, fpr27, fpr28, fpr29, fpr30, fpr31;
175
176 long cp1_fsr;
177 long cp1_fir;
178
179 /*
180 * Frame pointer
181 */
182 long frame_ptr;
183 long dummy; /* unused */
184
185 /*
186 * saved cp0 registers
187 */
188 long cp0_index;
189 long cp0_random;
190 long cp0_entrylo0;
191 long cp0_entrylo1;
192 long cp0_context;
193 long cp0_pagemask;
194 long cp0_wired;
195 long cp0_reg7;
196 long cp0_reg8;
197 long cp0_reg9;
198 long cp0_entryhi;
199 long cp0_reg11;
200 long cp0_reg12;
201 long cp0_reg13;
202 long cp0_reg14;
203 long cp0_prid;
204};
205
206/*
207 * Prototypes
208 */
209
210extern int kgdb_enabled;
211void set_debug_traps(void);
212void set_async_breakpoint(unsigned long *epc);
213
214#endif /* !__ASSEMBLY__ */
215#endif /* _ASM_GDB_STUB_H */
diff --git a/include/asm-mips/kdebug.h b/include/asm-mips/kdebug.h
index 6ece1b037665..5bf62aafc890 100644
--- a/include/asm-mips/kdebug.h
+++ b/include/asm-mips/kdebug.h
@@ -1 +1,13 @@
1#include <asm-generic/kdebug.h> 1#ifndef _ASM_MIPS_KDEBUG_H
2#define _ASM_MIPS_KDEBUG_H
3
4#include <linux/notifier.h>
5
6enum die_val {
7 DIE_OOPS = 1,
8 DIE_FP,
9 DIE_TRAP,
10 DIE_RI,
11};
12
13#endif /* _ASM_MIPS_KDEBUG_H */
diff --git a/include/asm-mips/kgdb.h b/include/asm-mips/kgdb.h
new file mode 100644
index 000000000000..48223b09396c
--- /dev/null
+++ b/include/asm-mips/kgdb.h
@@ -0,0 +1,44 @@
1#ifndef __ASM_KGDB_H_
2#define __ASM_KGDB_H_
3
4#ifdef __KERNEL__
5
6#include <asm/sgidefs.h>
7
8#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \
9 (_MIPS_ISA == _MIPS_ISA_MIPS32)
10
11#define KGDB_GDB_REG_SIZE 32
12
13#elif (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
14 (_MIPS_ISA == _MIPS_ISA_MIPS64)
15
16#ifdef CONFIG_32BIT
17#define KGDB_GDB_REG_SIZE 32
18#else /* CONFIG_CPU_32BIT */
19#define KGDB_GDB_REG_SIZE 64
20#endif
21#else
22#error "Need to set KGDB_GDB_REG_SIZE for MIPS ISA"
23#endif /* _MIPS_ISA */
24
25#define BUFMAX 2048
26#if (KGDB_GDB_REG_SIZE == 32)
27#define NUMREGBYTES (90*sizeof(u32))
28#define NUMCRITREGBYTES (12*sizeof(u32))
29#else
30#define NUMREGBYTES (90*sizeof(u64))
31#define NUMCRITREGBYTES (12*sizeof(u64))
32#endif
33#define BREAK_INSTR_SIZE 4
34#define CACHE_FLUSH_IS_SAFE 0
35
36extern void arch_kgdb_breakpoint(void);
37extern int kgdb_early_setup;
38extern void *saved_vectors[32];
39extern void handle_exception(struct pt_regs *regs);
40extern void breakinst(void);
41
42#endif /* __KERNEL__ */
43
44#endif /* __ASM_KGDB_H_ */
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
index c205875d7f31..5510c53b7feb 100644
--- a/include/asm-mips/pci.h
+++ b/include/asm-mips/pci.h
@@ -174,4 +174,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
174 174
175extern int pci_probe_only; 175extern int pci_probe_only;
176 176
177extern char * (*pcibios_plat_setup)(char *str);
178
177#endif /* _ASM_PCI_H */ 179#endif /* _ASM_PCI_H */
diff --git a/include/asm-mips/txx9/generic.h b/include/asm-mips/txx9/generic.h
index cbae37ec3d88..5b1ccf901c62 100644
--- a/include/asm-mips/txx9/generic.h
+++ b/include/asm-mips/txx9/generic.h
@@ -44,5 +44,19 @@ extern struct txx9_board_vec *txx9_board_vec;
44extern int (*txx9_irq_dispatch)(int pending); 44extern int (*txx9_irq_dispatch)(int pending);
45void prom_init_cmdline(void); 45void prom_init_cmdline(void);
46char *prom_getcmdline(void); 46char *prom_getcmdline(void);
47void txx9_wdt_init(unsigned long base);
48void txx9_spi_init(int busid, unsigned long base, int irq);
49void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
50void txx9_sio_init(unsigned long baseaddr, int irq,
51 unsigned int line, unsigned int sclk, int nocts);
52void prom_putchar(char c);
53#ifdef CONFIG_EARLY_PRINTK
54extern void (*txx9_prom_putchar)(char c);
55void txx9_sio_putchar_init(unsigned long baseaddr);
56#else
57static inline void txx9_sio_putchar_init(unsigned long baseaddr)
58{
59}
60#endif
47 61
48#endif /* __ASM_TXX9_GENERIC_H */ 62#endif /* __ASM_TXX9_GENERIC_H */
diff --git a/include/asm-mips/txx9/jmr3927.h b/include/asm-mips/txx9/jmr3927.h
index d6eb1b6a54eb..a409c446bf18 100644
--- a/include/asm-mips/txx9/jmr3927.h
+++ b/include/asm-mips/txx9/jmr3927.h
@@ -149,8 +149,6 @@
149 149
150/* Clocks */ 150/* Clocks */
151#define JMR3927_CORECLK 132710400 /* 132.7MHz */ 151#define JMR3927_CORECLK 132710400 /* 132.7MHz */
152#define JMR3927_GBUSCLK (JMR3927_CORECLK / 2) /* 66.35MHz */
153#define JMR3927_IMCLK (JMR3927_CORECLK / 4) /* 33.17MHz */
154 152
155/* 153/*
156 * TX3927 Pin Configuration: 154 * TX3927 Pin Configuration:
diff --git a/include/asm-mips/txx9/pci.h b/include/asm-mips/txx9/pci.h
index d89a45091e24..3d32529060aa 100644
--- a/include/asm-mips/txx9/pci.h
+++ b/include/asm-mips/txx9/pci.h
@@ -33,4 +33,7 @@ enum txx9_pci_err_action {
33}; 33};
34extern enum txx9_pci_err_action txx9_pci_err_action; 34extern enum txx9_pci_err_action txx9_pci_err_action;
35 35
36extern char * (*txx9_board_pcibios_setup)(char *str);
37char *txx9_pcibios_setup(char *str);
38
36#endif /* __ASM_TXX9_PCI_H */ 39#endif /* __ASM_TXX9_PCI_H */
diff --git a/include/asm-mips/txx9/smsc_fdc37m81x.h b/include/asm-mips/txx9/smsc_fdc37m81x.h
index 9375e4fc2289..02e161d0755d 100644
--- a/include/asm-mips/txx9/smsc_fdc37m81x.h
+++ b/include/asm-mips/txx9/smsc_fdc37m81x.h
@@ -56,7 +56,7 @@
56#define SMSC_FDC37M81X_CONFIG_EXIT 0xaa 56#define SMSC_FDC37M81X_CONFIG_EXIT 0xaa
57#define SMSC_FDC37M81X_CHIP_ID 0x4d 57#define SMSC_FDC37M81X_CHIP_ID 0x4d
58 58
59unsigned long __init smsc_fdc37m81x_init(unsigned long port); 59unsigned long smsc_fdc37m81x_init(unsigned long port);
60 60
61void smsc_fdc37m81x_config_beg(void); 61void smsc_fdc37m81x_config_beg(void);
62 62
diff --git a/include/asm-mips/txx9/tx3927.h b/include/asm-mips/txx9/tx3927.h
index ea79e1b16e71..587deb9592d2 100644
--- a/include/asm-mips/txx9/tx3927.h
+++ b/include/asm-mips/txx9/tx3927.h
@@ -8,9 +8,8 @@
8#ifndef __ASM_TXX9_TX3927_H 8#ifndef __ASM_TXX9_TX3927_H
9#define __ASM_TXX9_TX3927_H 9#define __ASM_TXX9_TX3927_H
10 10
11#include <asm/txx9/txx927.h>
12
13#define TX3927_REG_BASE 0xfffe0000UL 11#define TX3927_REG_BASE 0xfffe0000UL
12#define TX3927_REG_SIZE 0x00010000
14#define TX3927_SDRAMC_REG (TX3927_REG_BASE + 0x8000) 13#define TX3927_SDRAMC_REG (TX3927_REG_BASE + 0x8000)
15#define TX3927_ROMC_REG (TX3927_REG_BASE + 0x9000) 14#define TX3927_ROMC_REG (TX3927_REG_BASE + 0x9000)
16#define TX3927_DMA_REG (TX3927_REG_BASE + 0xb000) 15#define TX3927_DMA_REG (TX3927_REG_BASE + 0xb000)
@@ -236,11 +235,17 @@ struct tx3927_ccfg_reg {
236/* see PCI_STATUS_XXX in linux/pci.h */ 235/* see PCI_STATUS_XXX in linux/pci.h */
237#define PCI_STATUS_NEW_CAP 0x0010 236#define PCI_STATUS_NEW_CAP 0x0010
238 237
238/* bits for ISTAT/IIM */
239#define TX3927_PCIC_IIM_ALL 0x00001600
240
239/* bits for TC */ 241/* bits for TC */
240#define TX3927_PCIC_TC_OF16E 0x00000020 242#define TX3927_PCIC_TC_OF16E 0x00000020
241#define TX3927_PCIC_TC_IF8E 0x00000010 243#define TX3927_PCIC_TC_IF8E 0x00000010
242#define TX3927_PCIC_TC_OF8E 0x00000008 244#define TX3927_PCIC_TC_OF8E 0x00000008
243 245
246/* bits for TSTAT/TIM */
247#define TX3927_PCIC_TIM_ALL 0x0003ffff
248
244/* bits for IOBA/MBA */ 249/* bits for IOBA/MBA */
245/* see PCI_BASE_ADDRESS_XXX in linux/pci.h */ 250/* see PCI_BASE_ADDRESS_XXX in linux/pci.h */
246 251
@@ -313,12 +318,22 @@ struct tx3927_ccfg_reg {
313#define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG) 318#define tx3927_dmaptr ((struct tx3927_dma_reg *)TX3927_DMA_REG)
314#define tx3927_pcicptr ((struct tx3927_pcic_reg *)TX3927_PCIC_REG) 319#define tx3927_pcicptr ((struct tx3927_pcic_reg *)TX3927_PCIC_REG)
315#define tx3927_ccfgptr ((struct tx3927_ccfg_reg *)TX3927_CCFG_REG) 320#define tx3927_ccfgptr ((struct tx3927_ccfg_reg *)TX3927_CCFG_REG)
316#define tx3927_tmrptr(ch) ((struct txx927_tmr_reg *)TX3927_TMR_REG(ch))
317#define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch)) 321#define tx3927_sioptr(ch) ((struct txx927_sio_reg *)TX3927_SIO_REG(ch))
318#define tx3927_pioptr ((struct txx9_pio_reg __iomem *)TX3927_PIO_REG) 322#define tx3927_pioptr ((struct txx9_pio_reg __iomem *)TX3927_PIO_REG)
319 323
324#define TX3927_REV_PCODE() (tx3927_ccfgptr->crir >> 16)
325#define TX3927_ROMC_BA(ch) (tx3927_romcptr->cr[(ch)] & 0xfff00000)
326#define TX3927_ROMC_SIZE(ch) \
327 (0x00100000 << ((tx3927_romcptr->cr[(ch)] >> 8) & 0xf))
328
329void tx3927_wdt_init(void);
330void tx3927_setup(void);
331void tx3927_time_init(unsigned int evt_tmrnr, unsigned int src_tmrnr);
332void tx3927_sio_init(unsigned int sclk, unsigned int cts_mask);
320struct pci_controller; 333struct pci_controller;
321void __init tx3927_pcic_setup(struct pci_controller *channel, 334void tx3927_pcic_setup(struct pci_controller *channel,
322 unsigned long sdram_size, int extarb); 335 unsigned long sdram_size, int extarb);
336void tx3927_setup_pcierr_irq(void);
337void tx3927_irq_init(void);
323 338
324#endif /* __ASM_TXX9_TX3927_H */ 339#endif /* __ASM_TXX9_TX3927_H */
diff --git a/include/asm-mips/txx9/tx4927.h b/include/asm-mips/txx9/tx4927.h
index ceb4b79ff4e3..195f6515db9a 100644
--- a/include/asm-mips/txx9/tx4927.h
+++ b/include/asm-mips/txx9/tx4927.h
@@ -243,12 +243,13 @@ static inline void tx4927_ccfg_change(__u64 change, __u64 new)
243} 243}
244 244
245unsigned int tx4927_get_mem_size(void); 245unsigned int tx4927_get_mem_size(void);
246void tx4927_wdr_init(void); 246void tx4927_wdt_init(void);
247void tx4927_setup(void); 247void tx4927_setup(void);
248void tx4927_time_init(unsigned int tmrnr); 248void tx4927_time_init(unsigned int tmrnr);
249void tx4927_setup_serial(void); 249void tx4927_sio_init(unsigned int sclk, unsigned int cts_mask);
250int tx4927_report_pciclk(void); 250int tx4927_report_pciclk(void);
251int tx4927_pciclk66_setup(void); 251int tx4927_pciclk66_setup(void);
252void tx4927_setup_pcierr_irq(void);
252void tx4927_irq_init(void); 253void tx4927_irq_init(void);
253 254
254#endif /* __ASM_TXX9_TX4927_H */ 255#endif /* __ASM_TXX9_TX4927_H */
diff --git a/include/asm-mips/txx9/tx4927pcic.h b/include/asm-mips/txx9/tx4927pcic.h
index d61c3d09c4a2..c470b8a5fe57 100644
--- a/include/asm-mips/txx9/tx4927pcic.h
+++ b/include/asm-mips/txx9/tx4927pcic.h
@@ -10,6 +10,7 @@
10#define __ASM_TXX9_TX4927PCIC_H 10#define __ASM_TXX9_TX4927PCIC_H
11 11
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/irqreturn.h>
13 14
14struct tx4927_pcic_reg { 15struct tx4927_pcic_reg {
15 u32 pciid; 16 u32 pciid;
@@ -192,8 +193,11 @@ struct tx4927_pcic_reg {
192 193
193struct tx4927_pcic_reg __iomem *get_tx4927_pcicptr( 194struct tx4927_pcic_reg __iomem *get_tx4927_pcicptr(
194 struct pci_controller *channel); 195 struct pci_controller *channel);
195void __init tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr, 196void tx4927_pcic_setup(struct tx4927_pcic_reg __iomem *pcicptr,
196 struct pci_controller *channel, int extarb); 197 struct pci_controller *channel, int extarb);
197void tx4927_report_pcic_status(void); 198void tx4927_report_pcic_status(void);
199char *tx4927_pcibios_setup(char *str);
200void tx4927_dump_pcic_settings(void);
201irqreturn_t tx4927_pcierr_interrupt(int irq, void *dev_id);
198 202
199#endif /* __ASM_TXX9_TX4927PCIC_H */ 203#endif /* __ASM_TXX9_TX4927PCIC_H */
diff --git a/include/asm-mips/txx9/tx4938.h b/include/asm-mips/txx9/tx4938.h
index 1ed969d381d6..8175d4ccbc39 100644
--- a/include/asm-mips/txx9/tx4938.h
+++ b/include/asm-mips/txx9/tx4938.h
@@ -276,15 +276,18 @@ struct tx4938_ccfg_reg {
276#define TX4938_EBUSC_SIZE(ch) TX4927_EBUSC_SIZE(ch) 276#define TX4938_EBUSC_SIZE(ch) TX4927_EBUSC_SIZE(ch)
277 277
278#define tx4938_get_mem_size() tx4927_get_mem_size() 278#define tx4938_get_mem_size() tx4927_get_mem_size()
279void tx4938_wdr_init(void); 279void tx4938_wdt_init(void);
280void tx4938_setup(void); 280void tx4938_setup(void);
281void tx4938_time_init(unsigned int tmrnr); 281void tx4938_time_init(unsigned int tmrnr);
282void tx4938_setup_serial(void); 282void tx4938_sio_init(unsigned int sclk, unsigned int cts_mask);
283void tx4938_spi_init(int busid);
284void tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1);
283int tx4938_report_pciclk(void); 285int tx4938_report_pciclk(void);
284void tx4938_report_pci1clk(void); 286void tx4938_report_pci1clk(void);
285int tx4938_pciclk66_setup(void); 287int tx4938_pciclk66_setup(void);
286struct pci_dev; 288struct pci_dev;
287int tx4938_pcic1_map_irq(const struct pci_dev *dev, u8 slot); 289int tx4938_pcic1_map_irq(const struct pci_dev *dev, u8 slot);
290void tx4938_setup_pcierr_irq(void);
288void tx4938_irq_init(void); 291void tx4938_irq_init(void);
289 292
290#endif 293#endif
diff --git a/include/asm-mips/txx9/txx927.h b/include/asm-mips/txx9/txx927.h
deleted file mode 100644
index 97dd7ad1a890..000000000000
--- a/include/asm-mips/txx9/txx927.h
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 * Common definitions for TX3927/TX4927
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2000 Toshiba Corporation
9 */
10#ifndef __ASM_TXX9_TXX927_H
11#define __ASM_TXX9_TXX927_H
12
13struct txx927_sio_reg {
14 volatile unsigned long lcr;
15 volatile unsigned long dicr;
16 volatile unsigned long disr;
17 volatile unsigned long cisr;
18 volatile unsigned long fcr;
19 volatile unsigned long flcr;
20 volatile unsigned long bgr;
21 volatile unsigned long tfifo;
22 volatile unsigned long rfifo;
23};
24
25/*
26 * SIO
27 */
28/* SILCR : Line Control */
29#define TXx927_SILCR_SCS_MASK 0x00000060
30#define TXx927_SILCR_SCS_IMCLK 0x00000000
31#define TXx927_SILCR_SCS_IMCLK_BG 0x00000020
32#define TXx927_SILCR_SCS_SCLK 0x00000040
33#define TXx927_SILCR_SCS_SCLK_BG 0x00000060
34#define TXx927_SILCR_UEPS 0x00000010
35#define TXx927_SILCR_UPEN 0x00000008
36#define TXx927_SILCR_USBL_MASK 0x00000004
37#define TXx927_SILCR_USBL_1BIT 0x00000004
38#define TXx927_SILCR_USBL_2BIT 0x00000000
39#define TXx927_SILCR_UMODE_MASK 0x00000003
40#define TXx927_SILCR_UMODE_8BIT 0x00000000
41#define TXx927_SILCR_UMODE_7BIT 0x00000001
42
43/* SIDICR : DMA/Int. Control */
44#define TXx927_SIDICR_TDE 0x00008000
45#define TXx927_SIDICR_RDE 0x00004000
46#define TXx927_SIDICR_TIE 0x00002000
47#define TXx927_SIDICR_RIE 0x00001000
48#define TXx927_SIDICR_SPIE 0x00000800
49#define TXx927_SIDICR_CTSAC 0x00000600
50#define TXx927_SIDICR_STIE_MASK 0x0000003f
51#define TXx927_SIDICR_STIE_OERS 0x00000020
52#define TXx927_SIDICR_STIE_CTSS 0x00000010
53#define TXx927_SIDICR_STIE_RBRKD 0x00000008
54#define TXx927_SIDICR_STIE_TRDY 0x00000004
55#define TXx927_SIDICR_STIE_TXALS 0x00000002
56#define TXx927_SIDICR_STIE_UBRKD 0x00000001
57
58/* SIDISR : DMA/Int. Status */
59#define TXx927_SIDISR_UBRK 0x00008000
60#define TXx927_SIDISR_UVALID 0x00004000
61#define TXx927_SIDISR_UFER 0x00002000
62#define TXx927_SIDISR_UPER 0x00001000
63#define TXx927_SIDISR_UOER 0x00000800
64#define TXx927_SIDISR_ERI 0x00000400
65#define TXx927_SIDISR_TOUT 0x00000200
66#define TXx927_SIDISR_TDIS 0x00000100
67#define TXx927_SIDISR_RDIS 0x00000080
68#define TXx927_SIDISR_STIS 0x00000040
69#define TXx927_SIDISR_RFDN_MASK 0x0000001f
70
71/* SICISR : Change Int. Status */
72#define TXx927_SICISR_OERS 0x00000020
73#define TXx927_SICISR_CTSS 0x00000010
74#define TXx927_SICISR_RBRKD 0x00000008
75#define TXx927_SICISR_TRDY 0x00000004
76#define TXx927_SICISR_TXALS 0x00000002
77#define TXx927_SICISR_UBRKD 0x00000001
78
79/* SIFCR : FIFO Control */
80#define TXx927_SIFCR_SWRST 0x00008000
81#define TXx927_SIFCR_RDIL_MASK 0x00000180
82#define TXx927_SIFCR_RDIL_1 0x00000000
83#define TXx927_SIFCR_RDIL_4 0x00000080
84#define TXx927_SIFCR_RDIL_8 0x00000100
85#define TXx927_SIFCR_RDIL_12 0x00000180
86#define TXx927_SIFCR_RDIL_MAX 0x00000180
87#define TXx927_SIFCR_TDIL_MASK 0x00000018
88#define TXx927_SIFCR_TDIL_MASK 0x00000018
89#define TXx927_SIFCR_TDIL_1 0x00000000
90#define TXx927_SIFCR_TDIL_4 0x00000001
91#define TXx927_SIFCR_TDIL_8 0x00000010
92#define TXx927_SIFCR_TDIL_MAX 0x00000010
93#define TXx927_SIFCR_TFRST 0x00000004
94#define TXx927_SIFCR_RFRST 0x00000002
95#define TXx927_SIFCR_FRSTE 0x00000001
96#define TXx927_SIO_TX_FIFO 8
97#define TXx927_SIO_RX_FIFO 16
98
99/* SIFLCR : Flow Control */
100#define TXx927_SIFLCR_RCS 0x00001000
101#define TXx927_SIFLCR_TES 0x00000800
102#define TXx927_SIFLCR_RTSSC 0x00000200
103#define TXx927_SIFLCR_RSDE 0x00000100
104#define TXx927_SIFLCR_TSDE 0x00000080
105#define TXx927_SIFLCR_RTSTL_MASK 0x0000001e
106#define TXx927_SIFLCR_RTSTL_MAX 0x0000001e
107#define TXx927_SIFLCR_TBRK 0x00000001
108
109/* SIBGR : Baudrate Control */
110#define TXx927_SIBGR_BCLK_MASK 0x00000300
111#define TXx927_SIBGR_BCLK_T0 0x00000000
112#define TXx927_SIBGR_BCLK_T2 0x00000100
113#define TXx927_SIBGR_BCLK_T4 0x00000200
114#define TXx927_SIBGR_BCLK_T6 0x00000300
115#define TXx927_SIBGR_BRD_MASK 0x000000ff
116
117/*
118 * PIO
119 */
120
121#endif /* __ASM_TXX9_TXX927_H */
diff --git a/include/asm-mips/txx9irq.h b/include/asm-mips/txx9irq.h
index 1c439e51b875..5620879be37f 100644
--- a/include/asm-mips/txx9irq.h
+++ b/include/asm-mips/txx9irq.h
@@ -14,8 +14,12 @@
14#ifdef CONFIG_IRQ_CPU 14#ifdef CONFIG_IRQ_CPU
15#define TXX9_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8) 15#define TXX9_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)
16#else 16#else
17#ifdef CONFIG_I8259
18#define TXX9_IRQ_BASE (I8259A_IRQ_BASE + 16)
19#else
17#define TXX9_IRQ_BASE 0 20#define TXX9_IRQ_BASE 0
18#endif 21#endif
22#endif
19 23
20#ifdef CONFIG_CPU_TX39XX 24#ifdef CONFIG_CPU_TX39XX
21#define TXx9_MAX_IR 16 25#define TXx9_MAX_IR 16
diff --git a/include/asm-powerpc/cpm.h b/include/asm-powerpc/cpm.h
index 63a55337c2de..24d79e3abd8e 100644
--- a/include/asm-powerpc/cpm.h
+++ b/include/asm-powerpc/cpm.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/of.h>
6 7
7/* Opcodes common to CPM1 and CPM2 8/* Opcodes common to CPM1 and CPM2
8*/ 9*/
@@ -100,4 +101,6 @@ unsigned long cpm_muram_offset(void __iomem *addr);
100dma_addr_t cpm_muram_dma(void __iomem *addr); 101dma_addr_t cpm_muram_dma(void __iomem *addr);
101int cpm_command(u32 command, u8 opcode); 102int cpm_command(u32 command, u8 opcode);
102 103
104int cpm2_gpiochip_add32(struct device_node *np);
105
103#endif 106#endif
diff --git a/include/asm-powerpc/cpm2.h b/include/asm-powerpc/cpm2.h
index 2c7fd9cee291..2a6fa0183ac9 100644
--- a/include/asm-powerpc/cpm2.h
+++ b/include/asm-powerpc/cpm2.h
@@ -12,6 +12,7 @@
12 12
13#include <asm/immap_cpm2.h> 13#include <asm/immap_cpm2.h>
14#include <asm/cpm.h> 14#include <asm/cpm.h>
15#include <sysdev/fsl_soc.h>
15 16
16#ifdef CONFIG_PPC_85xx 17#ifdef CONFIG_PPC_85xx
17#define CPM_MAP_ADDR (get_immrbase() + 0x80000) 18#define CPM_MAP_ADDR (get_immrbase() + 0x80000)
@@ -93,10 +94,40 @@ extern cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor */
93#define cpm_dpfree cpm_muram_free 94#define cpm_dpfree cpm_muram_free
94#define cpm_dpram_addr cpm_muram_addr 95#define cpm_dpram_addr cpm_muram_addr
95 96
96extern void cpm_setbrg(uint brg, uint rate);
97extern void cpm2_fastbrg(uint brg, uint rate, int div16);
98extern void cpm2_reset(void); 97extern void cpm2_reset(void);
99 98
99/* Baud rate generators.
100*/
101#define CPM_BRG_RST ((uint)0x00020000)
102#define CPM_BRG_EN ((uint)0x00010000)
103#define CPM_BRG_EXTC_INT ((uint)0x00000000)
104#define CPM_BRG_EXTC_CLK3_9 ((uint)0x00004000)
105#define CPM_BRG_EXTC_CLK5_15 ((uint)0x00008000)
106#define CPM_BRG_ATB ((uint)0x00002000)
107#define CPM_BRG_CD_MASK ((uint)0x00001ffe)
108#define CPM_BRG_DIV16 ((uint)0x00000001)
109
110#define CPM2_BRG_INT_CLK (get_brgfreq())
111#define CPM2_BRG_UART_CLK (CPM2_BRG_INT_CLK/16)
112
113extern void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src);
114
115/* This function is used by UARTS, or anything else that uses a 16x
116 * oversampled clock.
117 */
118static inline void cpm_setbrg(uint brg, uint rate)
119{
120 __cpm2_setbrg(brg, rate, CPM2_BRG_UART_CLK, 0, CPM_BRG_EXTC_INT);
121}
122
123/* This function is used to set high speed synchronous baud rate
124 * clocks.
125 */
126static inline void cpm2_fastbrg(uint brg, uint rate, int div16)
127{
128 __cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT);
129}
130
100/* Function code bits, usually generic to devices. 131/* Function code bits, usually generic to devices.
101*/ 132*/
102#define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */ 133#define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */
@@ -195,17 +226,6 @@ typedef struct smc_uart {
195#define SMCM_TX ((unsigned char)0x02) 226#define SMCM_TX ((unsigned char)0x02)
196#define SMCM_RX ((unsigned char)0x01) 227#define SMCM_RX ((unsigned char)0x01)
197 228
198/* Baud rate generators.
199*/
200#define CPM_BRG_RST ((uint)0x00020000)
201#define CPM_BRG_EN ((uint)0x00010000)
202#define CPM_BRG_EXTC_INT ((uint)0x00000000)
203#define CPM_BRG_EXTC_CLK3_9 ((uint)0x00004000)
204#define CPM_BRG_EXTC_CLK5_15 ((uint)0x00008000)
205#define CPM_BRG_ATB ((uint)0x00002000)
206#define CPM_BRG_CD_MASK ((uint)0x00001ffe)
207#define CPM_BRG_DIV16 ((uint)0x00000001)
208
209/* SCCs. 229/* SCCs.
210*/ 230*/
211#define SCC_GSMRH_IRP ((uint)0x00040000) 231#define SCC_GSMRH_IRP ((uint)0x00040000)
diff --git a/include/asm-powerpc/pgtable-4k.h b/include/asm-powerpc/pgtable-4k.h
index c9601dfb4a1e..6b18ba9d2d85 100644
--- a/include/asm-powerpc/pgtable-4k.h
+++ b/include/asm-powerpc/pgtable-4k.h
@@ -46,6 +46,8 @@
46#define _PAGE_GROUP_IX 0x7000 /* software: HPTE index within group */ 46#define _PAGE_GROUP_IX 0x7000 /* software: HPTE index within group */
47#define _PAGE_F_SECOND _PAGE_SECONDARY 47#define _PAGE_F_SECOND _PAGE_SECONDARY
48#define _PAGE_F_GIX _PAGE_GROUP_IX 48#define _PAGE_F_GIX _PAGE_GROUP_IX
49#define _PAGE_SPECIAL 0x10000 /* software: special page */
50#define __HAVE_ARCH_PTE_SPECIAL
49 51
50/* PTE flags to conserve for HPTE identification */ 52/* PTE flags to conserve for HPTE identification */
51#define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | \ 53#define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | \
diff --git a/include/asm-powerpc/pgtable-64k.h b/include/asm-powerpc/pgtable-64k.h
index 7e54adb35596..07b0d8f09cb6 100644
--- a/include/asm-powerpc/pgtable-64k.h
+++ b/include/asm-powerpc/pgtable-64k.h
@@ -70,6 +70,8 @@ static inline struct subpage_prot_table *pgd_subpage_prot(pgd_t *pgd)
70#define PGDIR_MASK (~(PGDIR_SIZE-1)) 70#define PGDIR_MASK (~(PGDIR_SIZE-1))
71 71
72/* Additional PTE bits (don't change without checking asm in hash_low.S) */ 72/* Additional PTE bits (don't change without checking asm in hash_low.S) */
73#define __HAVE_ARCH_PTE_SPECIAL
74#define _PAGE_SPECIAL 0x00000400 /* software: special page */
73#define _PAGE_HPTE_SUB 0x0ffff000 /* combo only: sub pages HPTE bits */ 75#define _PAGE_HPTE_SUB 0x0ffff000 /* combo only: sub pages HPTE bits */
74#define _PAGE_HPTE_SUB0 0x08000000 /* combo only: first sub page */ 76#define _PAGE_HPTE_SUB0 0x08000000 /* combo only: first sub page */
75#define _PAGE_COMBO 0x10000000 /* this is a combo 4k page */ 77#define _PAGE_COMBO 0x10000000 /* this is a combo 4k page */
diff --git a/include/asm-powerpc/pgtable-ppc32.h b/include/asm-powerpc/pgtable-ppc32.h
index bdbab72f3ebc..6fe39e327047 100644
--- a/include/asm-powerpc/pgtable-ppc32.h
+++ b/include/asm-powerpc/pgtable-ppc32.h
@@ -401,6 +401,9 @@ extern int icache_44x_need_flush;
401#ifndef _PAGE_COHERENT 401#ifndef _PAGE_COHERENT
402#define _PAGE_COHERENT 0 402#define _PAGE_COHERENT 0
403#endif 403#endif
404#ifndef _PAGE_WRITETHRU
405#define _PAGE_WRITETHRU 0
406#endif
404#ifndef _PMD_PRESENT_MASK 407#ifndef _PMD_PRESENT_MASK
405#define _PMD_PRESENT_MASK _PMD_PRESENT 408#define _PMD_PRESENT_MASK _PMD_PRESENT
406#endif 409#endif
diff --git a/include/asm-powerpc/pgtable-ppc64.h b/include/asm-powerpc/pgtable-ppc64.h
index ba8000352b9a..74c6f380b805 100644
--- a/include/asm-powerpc/pgtable-ppc64.h
+++ b/include/asm-powerpc/pgtable-ppc64.h
@@ -245,7 +245,7 @@ static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW;}
245static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} 245static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;}
246static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} 246static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;}
247static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} 247static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;}
248static inline int pte_special(pte_t pte) { return 0; } 248static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; }
249 249
250static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 250static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
251static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 251static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
@@ -265,7 +265,7 @@ static inline pte_t pte_mkyoung(pte_t pte) {
265static inline pte_t pte_mkhuge(pte_t pte) { 265static inline pte_t pte_mkhuge(pte_t pte) {
266 return pte; } 266 return pte; }
267static inline pte_t pte_mkspecial(pte_t pte) { 267static inline pte_t pte_mkspecial(pte_t pte) {
268 return pte; } 268 pte_val(pte) |= _PAGE_SPECIAL; return pte; }
269static inline unsigned long pte_pgprot(pte_t pte) 269static inline unsigned long pte_pgprot(pte_t pte)
270{ 270{
271 return __pgprot(pte_val(pte)) & PAGE_PROT_BITS; 271 return __pgprot(pte_val(pte)) & PAGE_PROT_BITS;
@@ -461,6 +461,8 @@ void pgtable_cache_init(void);
461 return pt; 461 return pt;
462} 462}
463 463
464pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long address);
465
464#endif /* __ASSEMBLY__ */ 466#endif /* __ASSEMBLY__ */
465 467
466#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */ 468#endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */
diff --git a/include/asm-powerpc/ptrace.h b/include/asm-powerpc/ptrace.h
index 3d6e31024e56..734e0754fb9b 100644
--- a/include/asm-powerpc/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -84,6 +84,7 @@ struct pt_regs {
84#ifndef __ASSEMBLY__ 84#ifndef __ASSEMBLY__
85 85
86#define instruction_pointer(regs) ((regs)->nip) 86#define instruction_pointer(regs) ((regs)->nip)
87#define user_stack_pointer(regs) ((regs)->gpr[1])
87#define regs_return_value(regs) ((regs)->gpr[3]) 88#define regs_return_value(regs) ((regs)->gpr[3])
88 89
89#ifdef CONFIG_SMP 90#ifdef CONFIG_SMP
diff --git a/include/asm-powerpc/signal.h b/include/asm-powerpc/signal.h
index a8c7babf4950..a7360cdd99eb 100644
--- a/include/asm-powerpc/signal.h
+++ b/include/asm-powerpc/signal.h
@@ -122,8 +122,7 @@ typedef struct sigaltstack {
122 122
123#ifdef __KERNEL__ 123#ifdef __KERNEL__
124struct pt_regs; 124struct pt_regs;
125extern int do_signal(sigset_t *oldset, struct pt_regs *regs); 125extern void do_signal(struct pt_regs *regs, unsigned long thread_info_flags);
126extern int do_signal32(sigset_t *oldset, struct pt_regs *regs);
127#define ptrace_signal_deliver(regs, cookie) do { } while (0) 126#define ptrace_signal_deliver(regs, cookie) do { } while (0)
128#endif /* __KERNEL__ */ 127#endif /* __KERNEL__ */
129 128
diff --git a/include/asm-powerpc/smp.h b/include/asm-powerpc/smp.h
index 416d4c288cea..4d28e1e4521b 100644
--- a/include/asm-powerpc/smp.h
+++ b/include/asm-powerpc/smp.h
@@ -62,6 +62,8 @@ extern int smp_hw_index[];
62#endif 62#endif
63 63
64DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 64DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
65DECLARE_PER_CPU(cpumask_t, cpu_core_map);
66extern int cpu_to_core_id(int cpu);
65 67
66/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers. 68/* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
67 * 69 *
diff --git a/include/asm-powerpc/syscall.h b/include/asm-powerpc/syscall.h
new file mode 100644
index 000000000000..efa7f0b879f3
--- /dev/null
+++ b/include/asm-powerpc/syscall.h
@@ -0,0 +1,84 @@
1/*
2 * Access to user system call parameters and results
3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * See asm-generic/syscall.h for descriptions of what we must do here.
11 */
12
13#ifndef _ASM_SYSCALL_H
14#define _ASM_SYSCALL_H 1
15
16#include <linux/sched.h>
17
18static inline long syscall_get_nr(struct task_struct *task,
19 struct pt_regs *regs)
20{
21 return TRAP(regs) == 0xc00 ? regs->gpr[0] : -1L;
22}
23
24static inline void syscall_rollback(struct task_struct *task,
25 struct pt_regs *regs)
26{
27 regs->gpr[3] = regs->orig_gpr3;
28}
29
30static inline long syscall_get_error(struct task_struct *task,
31 struct pt_regs *regs)
32{
33 return (regs->ccr & 0x1000) ? -regs->gpr[3] : 0;
34}
35
36static inline long syscall_get_return_value(struct task_struct *task,
37 struct pt_regs *regs)
38{
39 return regs->gpr[3];
40}
41
42static inline void syscall_set_return_value(struct task_struct *task,
43 struct pt_regs *regs,
44 int error, long val)
45{
46 if (error) {
47 regs->ccr |= 0x1000L;
48 regs->gpr[3] = -error;
49 } else {
50 regs->ccr &= ~0x1000L;
51 regs->gpr[3] = val;
52 }
53}
54
55static inline void syscall_get_arguments(struct task_struct *task,
56 struct pt_regs *regs,
57 unsigned int i, unsigned int n,
58 unsigned long *args)
59{
60 BUG_ON(i + n > 6);
61#ifdef CONFIG_PPC64
62 if (test_tsk_thread_flag(task, TIF_32BIT)) {
63 /*
64 * Zero-extend 32-bit argument values. The high bits are
65 * garbage ignored by the actual syscall dispatch.
66 */
67 while (n-- > 0)
68 args[n] = (u32) regs->gpr[3 + i + n];
69 return;
70 }
71#endif
72 memcpy(args, &regs->gpr[3 + i], n * sizeof(args[0]));
73}
74
75static inline void syscall_set_arguments(struct task_struct *task,
76 struct pt_regs *regs,
77 unsigned int i, unsigned int n,
78 const unsigned long *args)
79{
80 BUG_ON(i + n > 6);
81 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
82}
83
84#endif /* _ASM_SYSCALL_H */
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index a9db562df69a..9665a26a253a 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -108,6 +108,7 @@ static inline struct thread_info *current_thread_info(void)
108#define TIF_SECCOMP 10 /* secure computing */ 108#define TIF_SECCOMP 10 /* secure computing */
109#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */ 109#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */
110#define TIF_NOERROR 12 /* Force successful syscall return */ 110#define TIF_NOERROR 12 /* Force successful syscall return */
111#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */
111#define TIF_FREEZE 14 /* Freezing for suspend */ 112#define TIF_FREEZE 14 /* Freezing for suspend */
112#define TIF_RUNLATCH 15 /* Is the runlatch enabled? */ 113#define TIF_RUNLATCH 15 /* Is the runlatch enabled? */
113#define TIF_ABI_PENDING 16 /* 32/64 bit switch needed */ 114#define TIF_ABI_PENDING 16 /* 32/64 bit switch needed */
@@ -125,12 +126,14 @@ static inline struct thread_info *current_thread_info(void)
125#define _TIF_SECCOMP (1<<TIF_SECCOMP) 126#define _TIF_SECCOMP (1<<TIF_SECCOMP)
126#define _TIF_RESTOREALL (1<<TIF_RESTOREALL) 127#define _TIF_RESTOREALL (1<<TIF_RESTOREALL)
127#define _TIF_NOERROR (1<<TIF_NOERROR) 128#define _TIF_NOERROR (1<<TIF_NOERROR)
129#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
128#define _TIF_FREEZE (1<<TIF_FREEZE) 130#define _TIF_FREEZE (1<<TIF_FREEZE)
129#define _TIF_RUNLATCH (1<<TIF_RUNLATCH) 131#define _TIF_RUNLATCH (1<<TIF_RUNLATCH)
130#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING) 132#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
131#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) 133#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
132 134
133#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED) 135#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
136 _TIF_NOTIFY_RESUME)
134#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR) 137#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR)
135 138
136/* Bits in local_flags */ 139/* Bits in local_flags */
diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h
index 100c6fbfc587..c32da6f97999 100644
--- a/include/asm-powerpc/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -108,6 +108,8 @@ static inline void sysfs_remove_device_from_node(struct sys_device *dev,
108#include <asm/smp.h> 108#include <asm/smp.h>
109 109
110#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) 110#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
111#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu))
112#define topology_core_id(cpu) (cpu_to_core_id(cpu))
111#endif 113#endif
112#endif 114#endif
113 115
diff --git a/include/asm-s390/hardirq.h b/include/asm-s390/hardirq.h
index 4b7cb964ff35..89ec7056da28 100644
--- a/include/asm-s390/hardirq.h
+++ b/include/asm-s390/hardirq.h
@@ -34,4 +34,18 @@ typedef struct {
34 34
35void clock_comparator_work(void); 35void clock_comparator_work(void);
36 36
37static inline unsigned long long local_tick_disable(void)
38{
39 unsigned long long old;
40
41 old = S390_lowcore.clock_comparator;
42 S390_lowcore.clock_comparator = -1ULL;
43 return old;
44}
45
46static inline void local_tick_enable(unsigned long long comp)
47{
48 S390_lowcore.clock_comparator = comp;
49}
50
37#endif /* __ASM_HARDIRQ_H */ 51#endif /* __ASM_HARDIRQ_H */
diff --git a/include/asm-s390/ipl.h b/include/asm-s390/ipl.h
index eaca6dff5405..1171e6d144a3 100644
--- a/include/asm-s390/ipl.h
+++ b/include/asm-s390/ipl.h
@@ -159,7 +159,8 @@ enum diag308_vm_flags {
159}; 159};
160 160
161enum diag308_rc { 161enum diag308_rc {
162 DIAG308_RC_OK = 1, 162 DIAG308_RC_OK = 0x0001,
163 DIAG308_RC_NOCONFIG = 0x0102,
163}; 164};
164 165
165extern int diag308(unsigned long subcode, void *addr); 166extern int diag308(unsigned long subcode, void *addr);
diff --git a/include/asm-s390/schid.h b/include/asm-s390/schid.h
index 7bdc0fe15691..825503cf3dc2 100644
--- a/include/asm-s390/schid.h
+++ b/include/asm-s390/schid.h
@@ -11,6 +11,7 @@ struct subchannel_id {
11} __attribute__ ((packed, aligned(4))); 11} __attribute__ ((packed, aligned(4)));
12 12
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14#include <linux/string.h>
14 15
15/* Helper function for sane state of pre-allocated subchannel_id. */ 16/* Helper function for sane state of pre-allocated subchannel_id. */
16static inline void 17static inline void
diff --git a/include/asm-s390/setup.h b/include/asm-s390/setup.h
index 4ba14e463e83..2bd9faeb3919 100644
--- a/include/asm-s390/setup.h
+++ b/include/asm-s390/setup.h
@@ -65,7 +65,6 @@ extern unsigned long machine_flags;
65 65
66#define MACHINE_FLAG_VM (1UL << 0) 66#define MACHINE_FLAG_VM (1UL << 0)
67#define MACHINE_FLAG_IEEE (1UL << 1) 67#define MACHINE_FLAG_IEEE (1UL << 1)
68#define MACHINE_FLAG_P390 (1UL << 2)
69#define MACHINE_FLAG_CSP (1UL << 3) 68#define MACHINE_FLAG_CSP (1UL << 3)
70#define MACHINE_FLAG_MVPG (1UL << 4) 69#define MACHINE_FLAG_MVPG (1UL << 4)
71#define MACHINE_FLAG_DIAG44 (1UL << 5) 70#define MACHINE_FLAG_DIAG44 (1UL << 5)
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index 583da807ea97..c8ad350d1444 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -259,7 +259,13 @@
259#define __NR_timerfd_create 319 259#define __NR_timerfd_create 319
260#define __NR_timerfd_settime 320 260#define __NR_timerfd_settime 320
261#define __NR_timerfd_gettime 321 261#define __NR_timerfd_gettime 321
262#define NR_syscalls 322 262#define __NR_signalfd4 322
263#define __NR_eventfd2 323
264#define __NR_inotify_init1 324
265#define __NR_pipe2 325
266#define __NR_dup3 326
267#define __NR_epoll_create1 327
268#define NR_syscalls 328
263 269
264/* 270/*
265 * There are some system calls that are not present on 64 bit, some 271 * There are some system calls that are not present on 64 bit, some
diff --git a/include/asm-sh/.gitignore b/include/asm-sh/.gitignore
deleted file mode 100644
index 9218ef82b698..000000000000
--- a/include/asm-sh/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
1cpu
2mach
3machtypes.h
diff --git a/include/asm-sh/adc.h b/include/asm-sh/adc.h
deleted file mode 100644
index 5f85cf74d59d..000000000000
--- a/include/asm-sh/adc.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __ASM_ADC_H
2#define __ASM_ADC_H
3#ifdef __KERNEL__
4/*
5 * Copyright (C) 2004 Andriy Skulysh
6 */
7
8#include <asm/cpu/adc.h>
9
10int adc_single(unsigned int channel);
11
12#endif /* __KERNEL__ */
13#endif /* __ASM_ADC_H */
diff --git a/include/asm-sh/addrspace.h b/include/asm-sh/addrspace.h
deleted file mode 100644
index fa544fc38c23..000000000000
--- a/include/asm-sh/addrspace.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999 by Kaz Kojima
7 *
8 * Defitions for the address spaces of the SH CPUs.
9 */
10#ifndef __ASM_SH_ADDRSPACE_H
11#define __ASM_SH_ADDRSPACE_H
12
13#ifdef __KERNEL__
14
15#include <asm/cpu/addrspace.h>
16
17/* If this CPU supports segmentation, hook up the helpers */
18#ifdef P1SEG
19
20/*
21 [ P0/U0 (virtual) ] 0x00000000 <------ User space
22 [ P1 (fixed) cached ] 0x80000000 <------ Kernel space
23 [ P2 (fixed) non-cachable] 0xA0000000 <------ Physical access
24 [ P3 (virtual) cached] 0xC0000000 <------ vmalloced area
25 [ P4 control ] 0xE0000000
26 */
27
28/* Returns the privileged segment base of a given address */
29#define PXSEG(a) (((unsigned long)(a)) & 0xe0000000)
30
31/* Returns the physical address of a PnSEG (n=1,2) address */
32#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
33
34#ifdef CONFIG_29BIT
35/*
36 * Map an address to a certain privileged segment
37 */
38#define P1SEGADDR(a) \
39 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P1SEG))
40#define P2SEGADDR(a) \
41 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P2SEG))
42#define P3SEGADDR(a) \
43 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P3SEG))
44#define P4SEGADDR(a) \
45 ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P4SEG))
46#endif /* 29BIT */
47#endif /* P1SEG */
48
49/* Check if an address can be reached in 29 bits */
50#define IS_29BIT(a) (((unsigned long)(a)) < 0x20000000)
51
52#endif /* __KERNEL__ */
53#endif /* __ASM_SH_ADDRSPACE_H */
diff --git a/include/asm-sh/auxvec.h b/include/asm-sh/auxvec.h
deleted file mode 100644
index a6b9d4f4859e..000000000000
--- a/include/asm-sh/auxvec.h
+++ /dev/null
@@ -1,36 +0,0 @@
1#ifndef __ASM_SH_AUXVEC_H
2#define __ASM_SH_AUXVEC_H
3
4/*
5 * Architecture-neutral AT_ values in 0-17, leave some room
6 * for more of them.
7 */
8
9/*
10 * This entry gives some information about the FPU initialization
11 * performed by the kernel.
12 */
13#define AT_FPUCW 18 /* Used FPU control word. */
14
15#ifdef CONFIG_VSYSCALL
16/*
17 * Only define this in the vsyscall case, the entry point to
18 * the vsyscall page gets placed here. The kernel will attempt
19 * to build a gate VMA we don't care about otherwise..
20 */
21#define AT_SYSINFO_EHDR 33
22#endif
23
24/*
25 * More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the
26 * value is -1, then the cache doesn't exist. Otherwise:
27 *
28 * bit 0-3: Cache set-associativity; 0 means fully associative.
29 * bit 4-7: Log2 of cacheline size.
30 * bit 8-31: Size of the entire cache >> 8.
31 */
32#define AT_L1I_CACHESHAPE 34
33#define AT_L1D_CACHESHAPE 35
34#define AT_L2_CACHESHAPE 36
35
36#endif /* __ASM_SH_AUXVEC_H */
diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h
deleted file mode 100644
index 083419f47c65..000000000000
--- a/include/asm-sh/cache.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/* $Id: cache.h,v 1.6 2004/03/11 18:08:05 lethal Exp $
2 *
3 * include/asm-sh/cache.h
4 *
5 * Copyright 1999 (C) Niibe Yutaka
6 * Copyright 2002, 2003 (C) Paul Mundt
7 */
8#ifndef __ASM_SH_CACHE_H
9#define __ASM_SH_CACHE_H
10#ifdef __KERNEL__
11
12#include <linux/init.h>
13#include <asm/cpu/cache.h>
14
15#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
16
17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
18
19#ifndef __ASSEMBLY__
20struct cache_info {
21 unsigned int ways; /* Number of cache ways */
22 unsigned int sets; /* Number of cache sets */
23 unsigned int linesz; /* Cache line size (bytes) */
24
25 unsigned int way_size; /* sets * line size */
26
27 /*
28 * way_incr is the address offset for accessing the next way
29 * in memory mapped cache array ops.
30 */
31 unsigned int way_incr;
32 unsigned int entry_shift;
33 unsigned int entry_mask;
34
35 /*
36 * Compute a mask which selects the address bits which overlap between
37 * 1. those used to select the cache set during indexing
38 * 2. those in the physical page number.
39 */
40 unsigned int alias_mask;
41
42 unsigned int n_aliases; /* Number of aliases */
43
44 unsigned long flags;
45};
46
47int __init detect_cpu_and_cache_system(void);
48
49#endif /* __ASSEMBLY__ */
50#endif /* __KERNEL__ */
51#endif /* __ASM_SH_CACHE_H */
diff --git a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h
deleted file mode 100644
index e034c3604111..000000000000
--- a/include/asm-sh/cacheflush.h
+++ /dev/null
@@ -1,81 +0,0 @@
1#ifndef __ASM_SH_CACHEFLUSH_H
2#define __ASM_SH_CACHEFLUSH_H
3
4#ifdef __KERNEL__
5
6#ifdef CONFIG_CACHE_OFF
7/*
8 * Nothing to do when the cache is disabled, initial flush and explicit
9 * disabling is handled at CPU init time.
10 *
11 * See arch/sh/kernel/cpu/init.c:cache_init().
12 */
13#define p3_cache_init() do { } while (0)
14#define flush_cache_all() do { } while (0)
15#define flush_cache_mm(mm) do { } while (0)
16#define flush_cache_dup_mm(mm) do { } while (0)
17#define flush_cache_range(vma, start, end) do { } while (0)
18#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
19#define flush_dcache_page(page) do { } while (0)
20#define flush_icache_range(start, end) do { } while (0)
21#define flush_icache_page(vma,pg) do { } while (0)
22#define flush_dcache_mmap_lock(mapping) do { } while (0)
23#define flush_dcache_mmap_unlock(mapping) do { } while (0)
24#define flush_cache_sigtramp(vaddr) do { } while (0)
25#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
26#define __flush_wback_region(start, size) do { (void)(start); } while (0)
27#define __flush_purge_region(start, size) do { (void)(start); } while (0)
28#define __flush_invalidate_region(start, size) do { (void)(start); } while (0)
29#else
30#include <asm/cpu/cacheflush.h>
31
32/*
33 * Consistent DMA requires that the __flush_xxx() primitives must be set
34 * for any of the enabled non-coherent caches (most of the UP CPUs),
35 * regardless of PIPT or VIPT cache configurations.
36 */
37
38/* Flush (write-back only) a region (smaller than a page) */
39extern void __flush_wback_region(void *start, int size);
40/* Flush (write-back & invalidate) a region (smaller than a page) */
41extern void __flush_purge_region(void *start, int size);
42/* Flush (invalidate only) a region (smaller than a page) */
43extern void __flush_invalidate_region(void *start, int size);
44#endif
45
46#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
47static inline void flush_kernel_dcache_page(struct page *page)
48{
49 flush_dcache_page(page);
50}
51
52#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF)
53extern void copy_to_user_page(struct vm_area_struct *vma,
54 struct page *page, unsigned long vaddr, void *dst, const void *src,
55 unsigned long len);
56
57extern void copy_from_user_page(struct vm_area_struct *vma,
58 struct page *page, unsigned long vaddr, void *dst, const void *src,
59 unsigned long len);
60#else
61#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
62 do { \
63 flush_cache_page(vma, vaddr, page_to_pfn(page));\
64 memcpy(dst, src, len); \
65 flush_icache_user_range(vma, page, vaddr, len); \
66 } while (0)
67
68#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
69 do { \
70 flush_cache_page(vma, vaddr, page_to_pfn(page));\
71 memcpy(dst, src, len); \
72 } while (0)
73#endif
74
75#define flush_cache_vmap(start, end) flush_cache_all()
76#define flush_cache_vunmap(start, end) flush_cache_all()
77
78#define HAVE_ARCH_UNMAPPED_AREA
79
80#endif /* __KERNEL__ */
81#endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/include/asm-sh/clock.h b/include/asm-sh/clock.h
deleted file mode 100644
index b550a27a7042..000000000000
--- a/include/asm-sh/clock.h
+++ /dev/null
@@ -1,82 +0,0 @@
1#ifndef __ASM_SH_CLOCK_H
2#define __ASM_SH_CLOCK_H
3
4#include <linux/kref.h>
5#include <linux/list.h>
6#include <linux/seq_file.h>
7#include <linux/clk.h>
8
9struct clk;
10
11struct clk_ops {
12 void (*init)(struct clk *clk);
13 void (*enable)(struct clk *clk);
14 void (*disable)(struct clk *clk);
15 void (*recalc)(struct clk *clk);
16 int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
17 long (*round_rate)(struct clk *clk, unsigned long rate);
18};
19
20struct clk {
21 struct list_head node;
22 const char *name;
23 int id;
24 struct module *owner;
25
26 struct clk *parent;
27 struct clk_ops *ops;
28
29 struct kref kref;
30
31 unsigned long rate;
32 unsigned long flags;
33};
34
35#define CLK_ALWAYS_ENABLED (1 << 0)
36#define CLK_RATE_PROPAGATES (1 << 1)
37
38/* Should be defined by processor-specific code */
39void arch_init_clk_ops(struct clk_ops **, int type);
40
41/* arch/sh/kernel/cpu/clock.c */
42int clk_init(void);
43
44int __clk_enable(struct clk *);
45void __clk_disable(struct clk *);
46
47void clk_recalc_rate(struct clk *);
48
49int clk_register(struct clk *);
50void clk_unregister(struct clk *);
51
52/* the exported API, in addition to clk_set_rate */
53/**
54 * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
55 * @clk: clock source
56 * @rate: desired clock rate in Hz
57 * @algo_id: algorithm id to be passed down to ops->set_rate
58 *
59 * Returns success (0) or negative errno.
60 */
61int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
62
63enum clk_sh_algo_id {
64 NO_CHANGE = 0,
65
66 IUS_N1_N1,
67 IUS_322,
68 IUS_522,
69 IUS_N11,
70
71 SB_N1,
72
73 SB3_N1,
74 SB3_32,
75 SB3_43,
76 SB3_54,
77
78 BP_N1,
79
80 IP_N1,
81};
82#endif /* __ASM_SH_CLOCK_H */
diff --git a/include/asm-sh/cpu-sh2/cacheflush.h b/include/asm-sh/cpu-sh2/cacheflush.h
deleted file mode 100644
index 2979efb26de3..000000000000
--- a/include/asm-sh/cpu-sh2/cacheflush.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * include/asm-sh/cpu-sh2/cacheflush.h
3 *
4 * Copyright (C) 2003 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH2_CACHEFLUSH_H
11#define __ASM_CPU_SH2_CACHEFLUSH_H
12
13/*
14 * Cache flushing:
15 *
16 * - flush_cache_all() flushes entire cache
17 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
18 * - flush_cache_dup mm(mm) handles cache flushing when forking
19 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
20 * - flush_cache_range(vma, start, end) flushes a range of pages
21 *
22 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
23 * - flush_icache_range(start, end) flushes(invalidates) a range for icache
24 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
25 *
26 * Caches are indexed (effectively) by physical address on SH-2, so
27 * we don't need them.
28 */
29#define flush_cache_all() do { } while (0)
30#define flush_cache_mm(mm) do { } while (0)
31#define flush_cache_dup_mm(mm) do { } while (0)
32#define flush_cache_range(vma, start, end) do { } while (0)
33#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
34#define flush_dcache_page(page) do { } while (0)
35#define flush_dcache_mmap_lock(mapping) do { } while (0)
36#define flush_dcache_mmap_unlock(mapping) do { } while (0)
37#define flush_icache_range(start, end) do { } while (0)
38#define flush_icache_page(vma,pg) do { } while (0)
39#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
40#define flush_cache_sigtramp(vaddr) do { } while (0)
41
42#define p3_cache_init() do { } while (0)
43#endif /* __ASM_CPU_SH2_CACHEFLUSH_H */
44
diff --git a/include/asm-sh/cpu-sh2a/addrspace.h b/include/asm-sh/cpu-sh2a/addrspace.h
deleted file mode 100644
index 795ddd6856a3..000000000000
--- a/include/asm-sh/cpu-sh2a/addrspace.h
+++ /dev/null
@@ -1,10 +0,0 @@
1#ifndef __ASM_SH_CPU_SH2A_ADDRSPACE_H
2#define __ASM_SH_CPU_SH2A_ADDRSPACE_H
3
4#define P0SEG 0x00000000
5#define P1SEG 0x00000000
6#define P2SEG 0x20000000
7#define P3SEG 0x00000000
8#define P4SEG 0x80000000
9
10#endif /* __ASM_SH_CPU_SH2A_ADDRSPACE_H */
diff --git a/include/asm-sh/cpu-sh2a/cacheflush.h b/include/asm-sh/cpu-sh2a/cacheflush.h
deleted file mode 100644
index fa3186c73350..000000000000
--- a/include/asm-sh/cpu-sh2a/cacheflush.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm/cpu-sh2/cacheflush.h>
diff --git a/include/asm-sh/cpu-sh2a/dma.h b/include/asm-sh/cpu-sh2a/dma.h
deleted file mode 100644
index 0d5ad85c1de8..000000000000
--- a/include/asm-sh/cpu-sh2a/dma.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm/cpu-sh2/dma.h>
diff --git a/include/asm-sh/cpu-sh2a/mmu_context.h b/include/asm-sh/cpu-sh2a/mmu_context.h
deleted file mode 100644
index cd2387f7db9e..000000000000
--- a/include/asm-sh/cpu-sh2a/mmu_context.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm/cpu-sh2/mmu_context.h>
diff --git a/include/asm-sh/cpu-sh2a/timer.h b/include/asm-sh/cpu-sh2a/timer.h
deleted file mode 100644
index fee504adf11e..000000000000
--- a/include/asm-sh/cpu-sh2a/timer.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm/cpu-sh2/timer.h>
diff --git a/include/asm-sh/cpu-sh2a/ubc.h b/include/asm-sh/cpu-sh2a/ubc.h
deleted file mode 100644
index cf28062b96a2..000000000000
--- a/include/asm-sh/cpu-sh2a/ubc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm/cpu-sh2/ubc.h>
diff --git a/include/asm-sh/cpu-sh2a/watchdog.h b/include/asm-sh/cpu-sh2a/watchdog.h
deleted file mode 100644
index c1b3e2488478..000000000000
--- a/include/asm-sh/cpu-sh2a/watchdog.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm/cpu-sh2/watchdog.h>
diff --git a/include/asm-sh/cpu-sh3/addrspace.h b/include/asm-sh/cpu-sh3/addrspace.h
deleted file mode 100644
index 0f94726c7d62..000000000000
--- a/include/asm-sh/cpu-sh3/addrspace.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1999 by Kaz Kojima
7 *
8 * Defitions for the address spaces of the SH-3 CPUs.
9 */
10#ifndef __ASM_CPU_SH3_ADDRSPACE_H
11#define __ASM_CPU_SH3_ADDRSPACE_H
12
13#define P0SEG 0x00000000
14#define P1SEG 0x80000000
15#define P2SEG 0xa0000000
16#define P3SEG 0xc0000000
17#define P4SEG 0xe0000000
18
19#endif /* __ASM_CPU_SH3_ADDRSPACE_H */
diff --git a/include/asm-sh/cpu-sh3/cacheflush.h b/include/asm-sh/cpu-sh3/cacheflush.h
deleted file mode 100644
index f70d8ef76a15..000000000000
--- a/include/asm-sh/cpu-sh3/cacheflush.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * include/asm-sh/cpu-sh3/cacheflush.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH3_CACHEFLUSH_H
11#define __ASM_CPU_SH3_CACHEFLUSH_H
12
13/*
14 * Cache flushing:
15 *
16 * - flush_cache_all() flushes entire cache
17 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
18 * - flush_cache_dup mm(mm) handles cache flushing when forking
19 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
20 * - flush_cache_range(vma, start, end) flushes a range of pages
21 *
22 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
23 * - flush_icache_range(start, end) flushes(invalidates) a range for icache
24 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
25 *
26 * Caches are indexed (effectively) by physical address on SH-3, so
27 * we don't need them.
28 */
29
30#if defined(CONFIG_SH7705_CACHE_32KB)
31
32/* SH7705 is an SH3 processor with 32KB cache. This has alias issues like the
33 * SH4. Unlike the SH4 this is a unified cache so we need to do some work
34 * in mmap when 'exec'ing a new binary
35 */
36 /* 32KB cache, 4kb PAGE sizes need to check bit 12 */
37#define CACHE_ALIAS 0x00001000
38
39#define PG_mapped PG_arch_1
40
41void flush_cache_all(void);
42void flush_cache_mm(struct mm_struct *mm);
43#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
44void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
45 unsigned long end);
46void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
47void flush_dcache_page(struct page *pg);
48void flush_icache_range(unsigned long start, unsigned long end);
49void flush_icache_page(struct vm_area_struct *vma, struct page *page);
50#else
51#define flush_cache_all() do { } while (0)
52#define flush_cache_mm(mm) do { } while (0)
53#define flush_cache_dup_mm(mm) do { } while (0)
54#define flush_cache_range(vma, start, end) do { } while (0)
55#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
56#define flush_dcache_page(page) do { } while (0)
57#define flush_icache_range(start, end) do { } while (0)
58#define flush_icache_page(vma,pg) do { } while (0)
59#endif
60
61#define flush_dcache_mmap_lock(mapping) do { } while (0)
62#define flush_dcache_mmap_unlock(mapping) do { } while (0)
63
64/* SH3 has unified cache so no special action needed here */
65#define flush_cache_sigtramp(vaddr) do { } while (0)
66#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
67
68#define p3_cache_init() do { } while (0)
69
70#endif /* __ASM_CPU_SH3_CACHEFLUSH_H */
diff --git a/include/asm-sh/cpu-sh3/rtc.h b/include/asm-sh/cpu-sh3/rtc.h
deleted file mode 100644
index 319404aaee37..000000000000
--- a/include/asm-sh/cpu-sh3/rtc.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_SH_CPU_SH3_RTC_H
2#define __ASM_SH_CPU_SH3_RTC_H
3
4#define rtc_reg_size sizeof(u16)
5#define RTC_BIT_INVERTED 0 /* No bug on SH7708, SH7709A */
6#define RTC_DEF_CAPABILITIES 0UL
7
8#endif /* __ASM_SH_CPU_SH3_RTC_H */
diff --git a/include/asm-sh/cpu-sh3/sigcontext.h b/include/asm-sh/cpu-sh3/sigcontext.h
deleted file mode 100644
index 17310dc03dcd..000000000000
--- a/include/asm-sh/cpu-sh3/sigcontext.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __ASM_CPU_SH3_SIGCONTEXT_H
2#define __ASM_CPU_SH3_SIGCONTEXT_H
3
4struct sigcontext {
5 unsigned long oldmask;
6
7 /* CPU registers */
8 unsigned long sc_regs[16];
9 unsigned long sc_pc;
10 unsigned long sc_pr;
11 unsigned long sc_sr;
12 unsigned long sc_gbr;
13 unsigned long sc_mach;
14 unsigned long sc_macl;
15};
16
17#endif /* __ASM_CPU_SH3_SIGCONTEXT_H */
diff --git a/include/asm-sh/cpu-sh4/cacheflush.h b/include/asm-sh/cpu-sh4/cacheflush.h
deleted file mode 100644
index 5fd5c89ef86a..000000000000
--- a/include/asm-sh/cpu-sh4/cacheflush.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * include/asm-sh/cpu-sh4/cacheflush.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2003 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#ifndef __ASM_CPU_SH4_CACHEFLUSH_H
12#define __ASM_CPU_SH4_CACHEFLUSH_H
13
14/*
15 * Caches are broken on SH-4 (unless we use write-through
16 * caching; in which case they're only semi-broken),
17 * so we need them.
18 */
19void flush_cache_all(void);
20void flush_dcache_all(void);
21void flush_cache_mm(struct mm_struct *mm);
22#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
23void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
24 unsigned long end);
25void flush_cache_page(struct vm_area_struct *vma, unsigned long addr,
26 unsigned long pfn);
27void flush_dcache_page(struct page *pg);
28
29#define flush_dcache_mmap_lock(mapping) do { } while (0)
30#define flush_dcache_mmap_unlock(mapping) do { } while (0)
31
32void flush_icache_range(unsigned long start, unsigned long end);
33void flush_cache_sigtramp(unsigned long addr);
34void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
35 unsigned long addr, int len);
36
37#define flush_icache_page(vma,pg) do { } while (0)
38
39/* Initialization of P3 area for copy_user_page */
40void p3_cache_init(void);
41
42#define PG_mapped PG_arch_1
43
44#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */
diff --git a/include/asm-sh/cpu-sh4/dma.h b/include/asm-sh/cpu-sh4/dma.h
deleted file mode 100644
index aaf71b018c28..000000000000
--- a/include/asm-sh/cpu-sh4/dma.h
+++ /dev/null
@@ -1,65 +0,0 @@
1#ifndef __ASM_CPU_SH4_DMA_H
2#define __ASM_CPU_SH4_DMA_H
3
4#define DMAOR_INIT ( 0x8000 | DMAOR_DME )
5
6/* SH7751/7760/7780 DMA IRQ sources */
7#define DMTE0_IRQ 34
8#define DMTE1_IRQ 35
9#define DMTE2_IRQ 36
10#define DMTE3_IRQ 37
11#define DMTE4_IRQ 44
12#define DMTE5_IRQ 45
13#define DMTE6_IRQ 46
14#define DMTE7_IRQ 47
15#define DMAE_IRQ 38
16
17#ifdef CONFIG_CPU_SH4A
18#define SH_DMAC_BASE 0xfc808020
19
20#define CHCR_TS_MASK 0x18
21#define CHCR_TS_SHIFT 3
22
23#include <asm/cpu/dma-sh7780.h>
24#else
25#define SH_DMAC_BASE 0xffa00000
26
27/* Definitions for the SuperH DMAC */
28#define TM_BURST 0x0000080
29#define TS_8 0x00000010
30#define TS_16 0x00000020
31#define TS_32 0x00000030
32#define TS_64 0x00000000
33
34#define CHCR_TS_MASK 0x70
35#define CHCR_TS_SHIFT 4
36
37#define DMAOR_COD 0x00000008
38
39/*
40 * The SuperH DMAC supports a number of transmit sizes, we list them here,
41 * with their respective values as they appear in the CHCR registers.
42 *
43 * Defaults to a 64-bit transfer size.
44 */
45enum {
46 XMIT_SZ_64BIT,
47 XMIT_SZ_8BIT,
48 XMIT_SZ_16BIT,
49 XMIT_SZ_32BIT,
50 XMIT_SZ_256BIT,
51};
52
53/*
54 * The DMA count is defined as the number of bytes to transfer.
55 */
56static unsigned int ts_shift[] __maybe_unused = {
57 [XMIT_SZ_64BIT] = 3,
58 [XMIT_SZ_8BIT] = 0,
59 [XMIT_SZ_16BIT] = 1,
60 [XMIT_SZ_32BIT] = 2,
61 [XMIT_SZ_256BIT] = 5,
62};
63#endif
64
65#endif /* __ASM_CPU_SH4_DMA_H */
diff --git a/include/asm-sh/cpu-sh4/freq.h b/include/asm-sh/cpu-sh4/freq.h
deleted file mode 100644
index da46e67ae26d..000000000000
--- a/include/asm-sh/cpu-sh4/freq.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * include/asm-sh/cpu-sh4/freq.h
3 *
4 * Copyright (C) 2002, 2003 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH4_FREQ_H
11#define __ASM_CPU_SH4_FREQ_H
12
13#if defined(CONFIG_CPU_SUBTYPE_SH7722) || \
14 defined(CONFIG_CPU_SUBTYPE_SH7723) || \
15 defined(CONFIG_CPU_SUBTYPE_SH7366)
16#define FRQCR 0xa4150000
17#define VCLKCR 0xa4150004
18#define SCLKACR 0xa4150008
19#define SCLKBCR 0xa415000c
20#define IrDACLKCR 0xa4150010
21#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
22 defined(CONFIG_CPU_SUBTYPE_SH7780)
23#define FRQCR 0xffc80000
24#elif defined(CONFIG_CPU_SUBTYPE_SH7785)
25#define FRQCR0 0xffc80000
26#define FRQCR1 0xffc80004
27#define FRQMR1 0xffc80014
28#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
29#define FRQCR 0xffc00014
30#else
31#define FRQCR 0xffc00000
32#define FRQCR_PSTBY 0x0200
33#define FRQCR_PLLEN 0x0400
34#define FRQCR_CKOEN 0x0800
35#endif
36#define MIN_DIVISOR_NR 0
37#define MAX_DIVISOR_NR 3
38
39#endif /* __ASM_CPU_SH4_FREQ_H */
40
diff --git a/include/asm-sh/cpu-sh5/timer.h b/include/asm-sh/cpu-sh5/timer.h
deleted file mode 100644
index 88da9b341a36..000000000000
--- a/include/asm-sh/cpu-sh5/timer.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __ASM_SH_CPU_SH5_TIMER_H
2#define __ASM_SH_CPU_SH5_TIMER_H
3
4#endif /* __ASM_SH_CPU_SH5_TIMER_H */
diff --git a/include/asm-sh/device.h b/include/asm-sh/device.h
deleted file mode 100644
index d8f9872b0e2d..000000000000
--- a/include/asm-sh/device.h
+++ /dev/null
@@ -1,7 +0,0 @@
1/*
2 * Arch specific extensions to struct device
3 *
4 * This file is released under the GPLv2
5 */
6#include <asm-generic/device.h>
7
diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h
deleted file mode 100644
index 6c0b8a2de143..000000000000
--- a/include/asm-sh/dma-mapping.h
+++ /dev/null
@@ -1,192 +0,0 @@
1#ifndef __ASM_SH_DMA_MAPPING_H
2#define __ASM_SH_DMA_MAPPING_H
3
4#include <linux/mm.h>
5#include <linux/scatterlist.h>
6#include <asm/cacheflush.h>
7#include <asm/io.h>
8
9extern struct bus_type pci_bus_type;
10
11#define dma_supported(dev, mask) (1)
12
13static inline int dma_set_mask(struct device *dev, u64 mask)
14{
15 if (!dev->dma_mask || !dma_supported(dev, mask))
16 return -EIO;
17
18 *dev->dma_mask = mask;
19
20 return 0;
21}
22
23void *dma_alloc_coherent(struct device *dev, size_t size,
24 dma_addr_t *dma_handle, gfp_t flag);
25
26void dma_free_coherent(struct device *dev, size_t size,
27 void *vaddr, dma_addr_t dma_handle);
28
29void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
30 enum dma_data_direction dir);
31
32#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
33#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
34#define dma_is_consistent(d, h) (1)
35
36static inline dma_addr_t dma_map_single(struct device *dev,
37 void *ptr, size_t size,
38 enum dma_data_direction dir)
39{
40#if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
41 if (dev->bus == &pci_bus_type)
42 return virt_to_phys(ptr);
43#endif
44 dma_cache_sync(dev, ptr, size, dir);
45
46 return virt_to_phys(ptr);
47}
48
49#define dma_unmap_single(dev, addr, size, dir) do { } while (0)
50
51static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
52 int nents, enum dma_data_direction dir)
53{
54 int i;
55
56 for (i = 0; i < nents; i++) {
57#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
58 dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
59#endif
60 sg[i].dma_address = sg_phys(&sg[i]);
61 }
62
63 return nents;
64}
65
66#define dma_unmap_sg(dev, sg, nents, dir) do { } while (0)
67
68static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
69 unsigned long offset, size_t size,
70 enum dma_data_direction dir)
71{
72 return dma_map_single(dev, page_address(page) + offset, size, dir);
73}
74
75static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
76 size_t size, enum dma_data_direction dir)
77{
78 dma_unmap_single(dev, dma_address, size, dir);
79}
80
81static inline void dma_sync_single(struct device *dev, dma_addr_t dma_handle,
82 size_t size, enum dma_data_direction dir)
83{
84#if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
85 if (dev->bus == &pci_bus_type)
86 return;
87#endif
88 dma_cache_sync(dev, phys_to_virt(dma_handle), size, dir);
89}
90
91static inline void dma_sync_single_range(struct device *dev,
92 dma_addr_t dma_handle,
93 unsigned long offset, size_t size,
94 enum dma_data_direction dir)
95{
96#if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
97 if (dev->bus == &pci_bus_type)
98 return;
99#endif
100 dma_cache_sync(dev, phys_to_virt(dma_handle) + offset, size, dir);
101}
102
103static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
104 int nelems, enum dma_data_direction dir)
105{
106 int i;
107
108 for (i = 0; i < nelems; i++) {
109#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
110 dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, dir);
111#endif
112 sg[i].dma_address = sg_phys(&sg[i]);
113 }
114}
115
116static inline void dma_sync_single_for_cpu(struct device *dev,
117 dma_addr_t dma_handle, size_t size,
118 enum dma_data_direction dir)
119{
120 dma_sync_single(dev, dma_handle, size, dir);
121}
122
123static inline void dma_sync_single_for_device(struct device *dev,
124 dma_addr_t dma_handle,
125 size_t size,
126 enum dma_data_direction dir)
127{
128 dma_sync_single(dev, dma_handle, size, dir);
129}
130
131static inline void dma_sync_single_range_for_cpu(struct device *dev,
132 dma_addr_t dma_handle,
133 unsigned long offset,
134 size_t size,
135 enum dma_data_direction direction)
136{
137 dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction);
138}
139
140static inline void dma_sync_single_range_for_device(struct device *dev,
141 dma_addr_t dma_handle,
142 unsigned long offset,
143 size_t size,
144 enum dma_data_direction direction)
145{
146 dma_sync_single_for_device(dev, dma_handle+offset, size, direction);
147}
148
149
150static inline void dma_sync_sg_for_cpu(struct device *dev,
151 struct scatterlist *sg, int nelems,
152 enum dma_data_direction dir)
153{
154 dma_sync_sg(dev, sg, nelems, dir);
155}
156
157static inline void dma_sync_sg_for_device(struct device *dev,
158 struct scatterlist *sg, int nelems,
159 enum dma_data_direction dir)
160{
161 dma_sync_sg(dev, sg, nelems, dir);
162}
163
164
165static inline int dma_get_cache_alignment(void)
166{
167 /*
168 * Each processor family will define its own L1_CACHE_SHIFT,
169 * L1_CACHE_BYTES wraps to this, so this is always safe.
170 */
171 return L1_CACHE_BYTES;
172}
173
174static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
175{
176 return dma_addr == 0;
177}
178
179#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
180
181extern int
182dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
183 dma_addr_t device_addr, size_t size, int flags);
184
185extern void
186dma_release_declared_memory(struct device *dev);
187
188extern void *
189dma_mark_declared_memory_occupied(struct device *dev,
190 dma_addr_t device_addr, size_t size);
191
192#endif /* __ASM_SH_DMA_MAPPING_H */
diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h
deleted file mode 100644
index a65b02fd186e..000000000000
--- a/include/asm-sh/dma.h
+++ /dev/null
@@ -1,166 +0,0 @@
1/*
2 * include/asm-sh/dma.h
3 *
4 * Copyright (C) 2003, 2004 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_SH_DMA_H
11#define __ASM_SH_DMA_H
12#ifdef __KERNEL__
13
14#include <linux/spinlock.h>
15#include <linux/wait.h>
16#include <linux/sched.h>
17#include <linux/sysdev.h>
18#include <asm/cpu/dma.h>
19
20/* The maximum address that we can perform a DMA transfer to on this platform */
21/* Don't define MAX_DMA_ADDRESS; it's useless on the SuperH and any
22 occurrence should be flagged as an error. */
23/* But... */
24/* XXX: This is not applicable to SuperH, just needed for alloc_bootmem */
25#define MAX_DMA_ADDRESS (PAGE_OFFSET+0x10000000)
26
27#ifdef CONFIG_NR_DMA_CHANNELS
28# define MAX_DMA_CHANNELS (CONFIG_NR_DMA_CHANNELS)
29#else
30# define MAX_DMA_CHANNELS (CONFIG_NR_ONCHIP_DMA_CHANNELS)
31#endif
32
33/*
34 * Read and write modes can mean drastically different things depending on the
35 * channel configuration. Consult your DMAC documentation and module
36 * implementation for further clues.
37 */
38#define DMA_MODE_READ 0x00
39#define DMA_MODE_WRITE 0x01
40#define DMA_MODE_MASK 0x01
41
42#define DMA_AUTOINIT 0x10
43
44/*
45 * DMAC (dma_info) flags
46 */
47enum {
48 DMAC_CHANNELS_CONFIGURED = 0x01,
49 DMAC_CHANNELS_TEI_CAPABLE = 0x02, /* Transfer end interrupt */
50};
51
52/*
53 * DMA channel capabilities / flags
54 */
55enum {
56 DMA_CONFIGURED = 0x01,
57
58 /*
59 * Transfer end interrupt, inherited from DMAC.
60 * wait_queue used in dma_wait_for_completion.
61 */
62 DMA_TEI_CAPABLE = 0x02,
63};
64
65extern spinlock_t dma_spin_lock;
66
67struct dma_channel;
68
69struct dma_ops {
70 int (*request)(struct dma_channel *chan);
71 void (*free)(struct dma_channel *chan);
72
73 int (*get_residue)(struct dma_channel *chan);
74 int (*xfer)(struct dma_channel *chan);
75 int (*configure)(struct dma_channel *chan, unsigned long flags);
76 int (*extend)(struct dma_channel *chan, unsigned long op, void *param);
77};
78
79struct dma_channel {
80 char dev_id[16]; /* unique name per DMAC of channel */
81
82 unsigned int chan; /* DMAC channel number */
83 unsigned int vchan; /* Virtual channel number */
84
85 unsigned int mode;
86 unsigned int count;
87
88 unsigned long sar;
89 unsigned long dar;
90
91 const char **caps;
92
93 unsigned long flags;
94 atomic_t busy;
95
96 wait_queue_head_t wait_queue;
97
98 struct sys_device dev;
99 void *priv_data;
100};
101
102struct dma_info {
103 struct platform_device *pdev;
104
105 const char *name;
106 unsigned int nr_channels;
107 unsigned long flags;
108
109 struct dma_ops *ops;
110 struct dma_channel *channels;
111
112 struct list_head list;
113 int first_channel_nr;
114 int first_vchannel_nr;
115};
116
117struct dma_chan_caps {
118 int ch_num;
119 const char **caplist;
120};
121
122#define to_dma_channel(channel) container_of(channel, struct dma_channel, dev)
123
124/* arch/sh/drivers/dma/dma-api.c */
125extern int dma_xfer(unsigned int chan, unsigned long from,
126 unsigned long to, size_t size, unsigned int mode);
127
128#define dma_write(chan, from, to, size) \
129 dma_xfer(chan, from, to, size, DMA_MODE_WRITE)
130#define dma_write_page(chan, from, to) \
131 dma_write(chan, from, to, PAGE_SIZE)
132
133#define dma_read(chan, from, to, size) \
134 dma_xfer(chan, from, to, size, DMA_MODE_READ)
135#define dma_read_page(chan, from, to) \
136 dma_read(chan, from, to, PAGE_SIZE)
137
138extern int request_dma_bycap(const char **dmac, const char **caps,
139 const char *dev_id);
140extern int request_dma(unsigned int chan, const char *dev_id);
141extern void free_dma(unsigned int chan);
142extern int get_dma_residue(unsigned int chan);
143extern struct dma_info *get_dma_info(unsigned int chan);
144extern struct dma_channel *get_dma_channel(unsigned int chan);
145extern void dma_wait_for_completion(unsigned int chan);
146extern void dma_configure_channel(unsigned int chan, unsigned long flags);
147
148extern int register_dmac(struct dma_info *info);
149extern void unregister_dmac(struct dma_info *info);
150extern struct dma_info *get_dma_info_by_name(const char *dmac_name);
151
152extern int dma_extend(unsigned int chan, unsigned long op, void *param);
153extern int register_chan_caps(const char *dmac, struct dma_chan_caps *capslist);
154
155/* arch/sh/drivers/dma/dma-sysfs.c */
156extern int dma_create_sysfs_files(struct dma_channel *, struct dma_info *);
157extern void dma_remove_sysfs_files(struct dma_channel *, struct dma_info *);
158
159#ifdef CONFIG_PCI
160extern int isa_dma_bridge_buggy;
161#else
162#define isa_dma_bridge_buggy (0)
163#endif
164
165#endif /* __KERNEL__ */
166#endif /* __ASM_SH_DMA_H */
diff --git a/include/asm-sh/dreamcast/pci.h b/include/asm-sh/dreamcast/pci.h
deleted file mode 100644
index e401b24b0d8e..000000000000
--- a/include/asm-sh/dreamcast/pci.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * include/asm-sh/dreamcast/pci.h
3 *
4 * Copyright (C) 2001, 2002 M. R. Brown
5 * Copyright (C) 2002, 2003 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#ifndef __ASM_SH_DREAMCAST_PCI_H
12#define __ASM_SH_DREAMCAST_PCI_H
13
14#include <asm/mach/sysasic.h>
15
16#define GAPSPCI_REGS 0x01001400
17#define GAPSPCI_DMA_BASE 0x01840000
18#define GAPSPCI_DMA_SIZE 32768
19#define GAPSPCI_BBA_CONFIG 0x01001600
20#define GAPSPCI_BBA_CONFIG_SIZE 0x2000
21
22#define GAPSPCI_IRQ HW_EVENT_EXTERNAL
23
24#endif /* __ASM_SH_DREAMCAST_PCI_H */
25
diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h
deleted file mode 100644
index 05092da1aa59..000000000000
--- a/include/asm-sh/elf.h
+++ /dev/null
@@ -1,193 +0,0 @@
1#ifndef __ASM_SH_ELF_H
2#define __ASM_SH_ELF_H
3
4#include <asm/auxvec.h>
5#include <asm/ptrace.h>
6#include <asm/user.h>
7
8/* SH (particularly SHcompact) relocation types */
9#define R_SH_NONE 0
10#define R_SH_DIR32 1
11#define R_SH_REL32 2
12#define R_SH_DIR8WPN 3
13#define R_SH_IND12W 4
14#define R_SH_DIR8WPL 5
15#define R_SH_DIR8WPZ 6
16#define R_SH_DIR8BP 7
17#define R_SH_DIR8W 8
18#define R_SH_DIR8L 9
19#define R_SH_SWITCH16 25
20#define R_SH_SWITCH32 26
21#define R_SH_USES 27
22#define R_SH_COUNT 28
23#define R_SH_ALIGN 29
24#define R_SH_CODE 30
25#define R_SH_DATA 31
26#define R_SH_LABEL 32
27#define R_SH_SWITCH8 33
28#define R_SH_GNU_VTINHERIT 34
29#define R_SH_GNU_VTENTRY 35
30#define R_SH_TLS_GD_32 144
31#define R_SH_TLS_LD_32 145
32#define R_SH_TLS_LDO_32 146
33#define R_SH_TLS_IE_32 147
34#define R_SH_TLS_LE_32 148
35#define R_SH_TLS_DTPMOD32 149
36#define R_SH_TLS_DTPOFF32 150
37#define R_SH_TLS_TPOFF32 151
38#define R_SH_GOT32 160
39#define R_SH_PLT32 161
40#define R_SH_COPY 162
41#define R_SH_GLOB_DAT 163
42#define R_SH_JMP_SLOT 164
43#define R_SH_RELATIVE 165
44#define R_SH_GOTOFF 166
45#define R_SH_GOTPC 167
46/* SHmedia relocs */
47#define R_SH_IMM_LOW16 246
48#define R_SH_IMM_LOW16_PCREL 247
49#define R_SH_IMM_MEDLOW16 248
50#define R_SH_IMM_MEDLOW16_PCREL 249
51/* Keep this the last entry. */
52#define R_SH_NUM 256
53
54/*
55 * ELF register definitions..
56 */
57
58typedef unsigned long elf_greg_t;
59
60#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
61typedef elf_greg_t elf_gregset_t[ELF_NGREG];
62
63typedef struct user_fpu_struct elf_fpregset_t;
64
65/*
66 * These are used to set parameters in the core dumps.
67 */
68#define ELF_CLASS ELFCLASS32
69#ifdef __LITTLE_ENDIAN__
70#define ELF_DATA ELFDATA2LSB
71#else
72#define ELF_DATA ELFDATA2MSB
73#endif
74#define ELF_ARCH EM_SH
75
76#ifdef __KERNEL__
77/*
78 * This is used to ensure we don't load something for the wrong architecture.
79 */
80#define elf_check_arch(x) ( (x)->e_machine == EM_SH )
81
82#define USE_ELF_CORE_DUMP
83#define ELF_EXEC_PAGESIZE PAGE_SIZE
84
85/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
86 use of this is to invoke "./ld.so someprog" to test out a new version of
87 the loader. We need to make sure that it is out of the way of the program
88 that it will "exec", and that there is sufficient room for the brk. */
89
90#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
91
92#define ELF_CORE_COPY_REGS(_dest,_regs) \
93 memcpy((char *) &_dest, (char *) _regs, \
94 sizeof(struct pt_regs));
95
96/* This yields a mask that user programs can use to figure out what
97 instruction set this CPU supports. This could be done in user space,
98 but it's not easy, and we've already done it here. */
99
100#define ELF_HWCAP (boot_cpu_data.flags)
101
102/* This yields a string that ld.so will use to load implementation
103 specific libraries for optimization. This is more specific in
104 intent than poking at uname or /proc/cpuinfo.
105
106 For the moment, we have only optimizations for the Intel generations,
107 but that could change... */
108
109#define ELF_PLATFORM (utsname()->machine)
110
111#ifdef __SH5__
112#define ELF_PLAT_INIT(_r, load_addr) \
113 do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0; \
114 _r->regs[4]=0; _r->regs[5]=0; _r->regs[6]=0; _r->regs[7]=0; \
115 _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \
116 _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; _r->regs[15]=0; \
117 _r->regs[16]=0; _r->regs[17]=0; _r->regs[18]=0; _r->regs[19]=0; \
118 _r->regs[20]=0; _r->regs[21]=0; _r->regs[22]=0; _r->regs[23]=0; \
119 _r->regs[24]=0; _r->regs[25]=0; _r->regs[26]=0; _r->regs[27]=0; \
120 _r->regs[28]=0; _r->regs[29]=0; _r->regs[30]=0; _r->regs[31]=0; \
121 _r->regs[32]=0; _r->regs[33]=0; _r->regs[34]=0; _r->regs[35]=0; \
122 _r->regs[36]=0; _r->regs[37]=0; _r->regs[38]=0; _r->regs[39]=0; \
123 _r->regs[40]=0; _r->regs[41]=0; _r->regs[42]=0; _r->regs[43]=0; \
124 _r->regs[44]=0; _r->regs[45]=0; _r->regs[46]=0; _r->regs[47]=0; \
125 _r->regs[48]=0; _r->regs[49]=0; _r->regs[50]=0; _r->regs[51]=0; \
126 _r->regs[52]=0; _r->regs[53]=0; _r->regs[54]=0; _r->regs[55]=0; \
127 _r->regs[56]=0; _r->regs[57]=0; _r->regs[58]=0; _r->regs[59]=0; \
128 _r->regs[60]=0; _r->regs[61]=0; _r->regs[62]=0; \
129 _r->tregs[0]=0; _r->tregs[1]=0; _r->tregs[2]=0; _r->tregs[3]=0; \
130 _r->tregs[4]=0; _r->tregs[5]=0; _r->tregs[6]=0; _r->tregs[7]=0; \
131 _r->sr = SR_FD | SR_MMU; } while (0)
132#else
133#define ELF_PLAT_INIT(_r, load_addr) \
134 do { _r->regs[0]=0; _r->regs[1]=0; _r->regs[2]=0; _r->regs[3]=0; \
135 _r->regs[4]=0; _r->regs[5]=0; _r->regs[6]=0; _r->regs[7]=0; \
136 _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \
137 _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; \
138 _r->sr = SR_FD; } while (0)
139#endif
140
141#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
142struct task_struct;
143extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
144extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
145
146#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
147#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
148
149#ifdef CONFIG_VSYSCALL
150/* vDSO has arch_setup_additional_pages */
151#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
152struct linux_binprm;
153extern int arch_setup_additional_pages(struct linux_binprm *bprm,
154 int executable_stack);
155
156extern unsigned int vdso_enabled;
157extern void __kernel_vsyscall;
158
159#define VDSO_BASE ((unsigned long)current->mm->context.vdso)
160#define VDSO_SYM(x) (VDSO_BASE + (unsigned long)(x))
161
162#define VSYSCALL_AUX_ENT \
163 if (vdso_enabled) \
164 NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE);
165#else
166#define VSYSCALL_AUX_ENT
167#endif /* CONFIG_VSYSCALL */
168
169#ifdef CONFIG_SH_FPU
170#define FPU_AUX_ENT NEW_AUX_ENT(AT_FPUCW, FPSCR_INIT)
171#else
172#define FPU_AUX_ENT
173#endif
174
175extern int l1i_cache_shape, l1d_cache_shape, l2_cache_shape;
176
177/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
178#define ARCH_DLINFO \
179do { \
180 /* Optional FPU initialization */ \
181 FPU_AUX_ENT; \
182 \
183 /* Optional vsyscall entry */ \
184 VSYSCALL_AUX_ENT; \
185 \
186 /* Cache desc */ \
187 NEW_AUX_ENT(AT_L1I_CACHESHAPE, l1i_cache_shape); \
188 NEW_AUX_ENT(AT_L1D_CACHESHAPE, l1d_cache_shape); \
189 NEW_AUX_ENT(AT_L2_CACHESHAPE, l2_cache_shape); \
190} while (0)
191
192#endif /* __KERNEL__ */
193#endif /* __ASM_SH_ELF_H */
diff --git a/include/asm-sh/freq.h b/include/asm-sh/freq.h
deleted file mode 100644
index 39c0e091cf58..000000000000
--- a/include/asm-sh/freq.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * include/asm-sh/freq.h
3 *
4 * Copyright (C) 2002, 2003 Paul Mundt
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11#ifndef __ASM_SH_FREQ_H
12#define __ASM_SH_FREQ_H
13#ifdef __KERNEL__
14
15#include <asm/cpu/freq.h>
16
17#endif /* __KERNEL__ */
18#endif /* __ASM_SH_FREQ_H */
diff --git a/include/asm-sh/gpio.h b/include/asm-sh/gpio.h
deleted file mode 100644
index 9bb27e0f11a4..000000000000
--- a/include/asm-sh/gpio.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * include/asm-sh/gpio.h
3 *
4 * Copyright (C) 2007 Markus Brunner, Mark Jonas
5 *
6 * Addresses for the Pin Function Controller
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#ifndef __ASM_SH_GPIO_H
13#define __ASM_SH_GPIO_H
14
15#if defined(CONFIG_CPU_SH3)
16#include <asm/cpu/gpio.h>
17#endif
18
19#endif /* __ASM_SH_GPIO_H */
diff --git a/include/asm-sh/hw_irq.h b/include/asm-sh/hw_irq.h
deleted file mode 100644
index 7438d1e21bc9..000000000000
--- a/include/asm-sh/hw_irq.h
+++ /dev/null
@@ -1,123 +0,0 @@
1#ifndef __ASM_SH_HW_IRQ_H
2#define __ASM_SH_HW_IRQ_H
3
4#include <linux/init.h>
5#include <asm/atomic.h>
6
7extern atomic_t irq_err_count;
8
9struct ipr_data {
10 unsigned char irq;
11 unsigned char ipr_idx; /* Index for the IPR registered */
12 unsigned char shift; /* Number of bits to shift the data */
13 unsigned char priority; /* The priority */
14};
15
16struct ipr_desc {
17 unsigned long *ipr_offsets;
18 unsigned int nr_offsets;
19 struct ipr_data *ipr_data;
20 unsigned int nr_irqs;
21 struct irq_chip chip;
22};
23
24void register_ipr_controller(struct ipr_desc *);
25
26typedef unsigned char intc_enum;
27
28struct intc_vect {
29 intc_enum enum_id;
30 unsigned short vect;
31};
32
33#define INTC_VECT(enum_id, vect) { enum_id, vect }
34#define INTC_IRQ(enum_id, irq) INTC_VECT(enum_id, irq2evt(irq))
35
36struct intc_group {
37 intc_enum enum_id;
38 intc_enum enum_ids[32];
39};
40
41#define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
42
43struct intc_mask_reg {
44 unsigned long set_reg, clr_reg, reg_width;
45 intc_enum enum_ids[32];
46#ifdef CONFIG_SMP
47 unsigned long smp;
48#endif
49};
50
51struct intc_prio_reg {
52 unsigned long set_reg, clr_reg, reg_width, field_width;
53 intc_enum enum_ids[16];
54#ifdef CONFIG_SMP
55 unsigned long smp;
56#endif
57};
58
59struct intc_sense_reg {
60 unsigned long reg, reg_width, field_width;
61 intc_enum enum_ids[16];
62};
63
64#ifdef CONFIG_SMP
65#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
66#else
67#define INTC_SMP(stride, nr)
68#endif
69
70struct intc_desc {
71 struct intc_vect *vectors;
72 unsigned int nr_vectors;
73 struct intc_group *groups;
74 unsigned int nr_groups;
75 struct intc_mask_reg *mask_regs;
76 unsigned int nr_mask_regs;
77 struct intc_prio_reg *prio_regs;
78 unsigned int nr_prio_regs;
79 struct intc_sense_reg *sense_regs;
80 unsigned int nr_sense_regs;
81 char *name;
82#ifdef CONFIG_CPU_SH3
83 struct intc_mask_reg *ack_regs;
84 unsigned int nr_ack_regs;
85#endif
86};
87
88#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
89#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
90 mask_regs, prio_regs, sense_regs) \
91struct intc_desc symbol __initdata = { \
92 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
93 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
94 _INTC_ARRAY(sense_regs), \
95 chipname, \
96}
97
98#ifdef CONFIG_CPU_SH3
99#define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \
100 mask_regs, prio_regs, sense_regs, ack_regs) \
101struct intc_desc symbol __initdata = { \
102 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
103 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
104 _INTC_ARRAY(sense_regs), \
105 chipname, \
106 _INTC_ARRAY(ack_regs), \
107}
108#endif
109
110void __init register_intc_controller(struct intc_desc *desc);
111int intc_set_priority(unsigned int irq, unsigned int prio);
112
113void __init plat_irq_setup(void);
114#ifdef CONFIG_CPU_SH3
115void __init plat_irq_setup_sh3(void);
116#endif
117
118enum { IRQ_MODE_IRQ, IRQ_MODE_IRQ7654, IRQ_MODE_IRQ3210,
119 IRQ_MODE_IRL7654_MASK, IRQ_MODE_IRL3210_MASK,
120 IRQ_MODE_IRL7654, IRQ_MODE_IRL3210 };
121void __init plat_irq_setup_pins(int mode);
122
123#endif /* __ASM_SH_HW_IRQ_H */
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
deleted file mode 100644
index ca66e5df69dc..000000000000
--- a/include/asm-sh/irq.h
+++ /dev/null
@@ -1,57 +0,0 @@
1#ifndef __ASM_SH_IRQ_H
2#define __ASM_SH_IRQ_H
3
4#include <asm/machvec.h>
5
6/*
7 * A sane default based on a reasonable vector table size, platforms are
8 * advised to cap this at the hard limit that they're interested in
9 * through the machvec.
10 */
11#define NR_IRQS 256
12
13/*
14 * Convert back and forth between INTEVT and IRQ values.
15 */
16#ifdef CONFIG_CPU_HAS_INTEVT
17#define evt2irq(evt) (((evt) >> 5) - 16)
18#define irq2evt(irq) (((irq) + 16) << 5)
19#else
20#define evt2irq(evt) (evt)
21#define irq2evt(irq) (irq)
22#endif
23
24/*
25 * Simple Mask Register Support
26 */
27extern void make_maskreg_irq(unsigned int irq);
28extern unsigned short *irq_mask_register;
29
30/*
31 * PINT IRQs
32 */
33void init_IRQ_pint(void);
34void make_imask_irq(unsigned int irq);
35
36static inline int generic_irq_demux(int irq)
37{
38 return irq;
39}
40
41#define irq_canonicalize(irq) (irq)
42#define irq_demux(irq) sh_mv.mv_irq_demux(irq)
43
44#ifdef CONFIG_IRQSTACKS
45extern void irq_ctx_init(int cpu);
46extern void irq_ctx_exit(int cpu);
47# define __ARCH_HAS_DO_SOFTIRQ
48#else
49# define irq_ctx_init(cpu) do { } while (0)
50# define irq_ctx_exit(cpu) do { } while (0)
51#endif
52
53#ifdef CONFIG_CPU_SH5
54#include <asm/cpu/irq.h>
55#endif
56
57#endif /* __ASM_SH_IRQ_H */
diff --git a/include/asm-sh/irqflags_64.h b/include/asm-sh/irqflags_64.h
deleted file mode 100644
index 4f6b8a56e7bd..000000000000
--- a/include/asm-sh/irqflags_64.h
+++ /dev/null
@@ -1,85 +0,0 @@
1#ifndef __ASM_SH_IRQFLAGS_64_H
2#define __ASM_SH_IRQFLAGS_64_H
3
4#include <asm/cpu/registers.h>
5
6#define SR_MASK_LL 0x00000000000000f0LL
7#define SR_BL_LL 0x0000000010000000LL
8
9static inline void raw_local_irq_enable(void)
10{
11 unsigned long long __dummy0, __dummy1 = ~SR_MASK_LL;
12
13 __asm__ __volatile__("getcon " __SR ", %0\n\t"
14 "and %0, %1, %0\n\t"
15 "putcon %0, " __SR "\n\t"
16 : "=&r" (__dummy0)
17 : "r" (__dummy1));
18}
19
20static inline void raw_local_irq_disable(void)
21{
22 unsigned long long __dummy0, __dummy1 = SR_MASK_LL;
23
24 __asm__ __volatile__("getcon " __SR ", %0\n\t"
25 "or %0, %1, %0\n\t"
26 "putcon %0, " __SR "\n\t"
27 : "=&r" (__dummy0)
28 : "r" (__dummy1));
29}
30
31static inline void set_bl_bit(void)
32{
33 unsigned long long __dummy0, __dummy1 = SR_BL_LL;
34
35 __asm__ __volatile__("getcon " __SR ", %0\n\t"
36 "or %0, %1, %0\n\t"
37 "putcon %0, " __SR "\n\t"
38 : "=&r" (__dummy0)
39 : "r" (__dummy1));
40
41}
42
43static inline void clear_bl_bit(void)
44{
45 unsigned long long __dummy0, __dummy1 = ~SR_BL_LL;
46
47 __asm__ __volatile__("getcon " __SR ", %0\n\t"
48 "and %0, %1, %0\n\t"
49 "putcon %0, " __SR "\n\t"
50 : "=&r" (__dummy0)
51 : "r" (__dummy1));
52}
53
54static inline unsigned long __raw_local_save_flags(void)
55{
56 unsigned long long __dummy = SR_MASK_LL;
57 unsigned long flags;
58
59 __asm__ __volatile__ (
60 "getcon " __SR ", %0\n\t"
61 "and %0, %1, %0"
62 : "=&r" (flags)
63 : "r" (__dummy));
64
65 return flags;
66}
67
68static inline unsigned long __raw_local_irq_save(void)
69{
70 unsigned long long __dummy0, __dummy1 = SR_MASK_LL;
71 unsigned long flags;
72
73 __asm__ __volatile__ (
74 "getcon " __SR ", %1\n\t"
75 "or %1, r63, %0\n\t"
76 "or %1, %2, %1\n\t"
77 "putcon %1, " __SR "\n\t"
78 "and %0, %2, %0"
79 : "=&r" (flags), "=&r" (__dummy0)
80 : "r" (__dummy1));
81
82 return flags;
83}
84
85#endif /* __ASM_SH_IRQFLAGS_64_H */
diff --git a/include/asm-sh/migor.h b/include/asm-sh/migor.h
deleted file mode 100644
index 2329363afdc3..000000000000
--- a/include/asm-sh/migor.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef __ASM_SH_MIGOR_H
2#define __ASM_SH_MIGOR_H
3
4/*
5 * linux/include/asm-sh/migor.h
6 *
7 * Copyright (C) 2008 Renesas Solutions
8 *
9 * Portions Copyright (C) 2007 Nobuhiro Iwamatsu
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 *
15 */
16#include <asm/addrspace.h>
17
18/* GPIO */
19#define MSTPCR0 0xa4150030
20#define MSTPCR1 0xa4150034
21#define MSTPCR2 0xa4150038
22
23#define PORT_PACR 0xa4050100
24#define PORT_PDCR 0xa4050106
25#define PORT_PECR 0xa4050108
26#define PORT_PHCR 0xa405010e
27#define PORT_PJCR 0xa4050110
28#define PORT_PKCR 0xa4050112
29#define PORT_PLCR 0xa4050114
30#define PORT_PMCR 0xa4050116
31#define PORT_PRCR 0xa405011c
32#define PORT_PWCR 0xa4050146
33#define PORT_PXCR 0xa4050148
34#define PORT_PYCR 0xa405014a
35#define PORT_PZCR 0xa405014c
36#define PORT_PADR 0xa4050120
37#define PORT_PWDR 0xa4050166
38
39#define PORT_HIZCRA 0xa4050158
40#define PORT_HIZCRC 0xa405015c
41
42#define PORT_MSELCRB 0xa4050182
43
44#define MSTPCR1 0xa4150034
45#define MSTPCR2 0xa4150038
46
47#define PORT_PSELA 0xa405014e
48#define PORT_PSELB 0xa4050150
49#define PORT_PSELC 0xa4050152
50#define PORT_PSELD 0xa4050154
51
52#define PORT_HIZCRA 0xa4050158
53#define PORT_HIZCRB 0xa405015a
54#define PORT_HIZCRC 0xa405015c
55
56#define BSC_CS6ABCR 0xfec1001c
57
58#endif /* __ASM_SH_MIGOR_H */
diff --git a/include/asm-sh/mmu.h b/include/asm-sh/mmu.h
deleted file mode 100644
index eb0358c097d0..000000000000
--- a/include/asm-sh/mmu.h
+++ /dev/null
@@ -1,72 +0,0 @@
1#ifndef __MMU_H
2#define __MMU_H
3
4/* Default "unsigned long" context */
5typedef unsigned long mm_context_id_t[NR_CPUS];
6
7typedef struct {
8#ifdef CONFIG_MMU
9 mm_context_id_t id;
10 void *vdso;
11#else
12 struct vm_list_struct *vmlist;
13 unsigned long end_brk;
14#endif
15} mm_context_t;
16
17/*
18 * Privileged Space Mapping Buffer (PMB) definitions
19 */
20#define PMB_PASCR 0xff000070
21#define PMB_IRMCR 0xff000078
22
23#define PMB_ADDR 0xf6100000
24#define PMB_DATA 0xf7100000
25#define PMB_ENTRY_MAX 16
26#define PMB_E_MASK 0x0000000f
27#define PMB_E_SHIFT 8
28
29#define PMB_SZ_16M 0x00000000
30#define PMB_SZ_64M 0x00000010
31#define PMB_SZ_128M 0x00000080
32#define PMB_SZ_512M 0x00000090
33#define PMB_SZ_MASK PMB_SZ_512M
34#define PMB_C 0x00000008
35#define PMB_WT 0x00000001
36#define PMB_UB 0x00000200
37#define PMB_V 0x00000100
38
39#define PMB_NO_ENTRY (-1)
40
41struct pmb_entry;
42
43struct pmb_entry {
44 unsigned long vpn;
45 unsigned long ppn;
46 unsigned long flags;
47
48 /*
49 * 0 .. NR_PMB_ENTRIES for specific entry selection, or
50 * PMB_NO_ENTRY to search for a free one
51 */
52 int entry;
53
54 struct pmb_entry *next;
55 /* Adjacent entry link for contiguous multi-entry mappings */
56 struct pmb_entry *link;
57};
58
59/* arch/sh/mm/pmb.c */
60int __set_pmb_entry(unsigned long vpn, unsigned long ppn,
61 unsigned long flags, int *entry);
62int set_pmb_entry(struct pmb_entry *pmbe);
63void clear_pmb_entry(struct pmb_entry *pmbe);
64struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
65 unsigned long flags);
66void pmb_free(struct pmb_entry *pmbe);
67long pmb_remap(unsigned long virt, unsigned long phys,
68 unsigned long size, unsigned long flags);
69void pmb_unmap(unsigned long addr);
70
71#endif /* __MMU_H */
72
diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h
deleted file mode 100644
index 87e812f68bb0..000000000000
--- a/include/asm-sh/mmu_context.h
+++ /dev/null
@@ -1,184 +0,0 @@
1/*
2 * Copyright (C) 1999 Niibe Yutaka
3 * Copyright (C) 2003 - 2007 Paul Mundt
4 *
5 * ASID handling idea taken from MIPS implementation.
6 */
7#ifndef __ASM_SH_MMU_CONTEXT_H
8#define __ASM_SH_MMU_CONTEXT_H
9
10#ifdef __KERNEL__
11#include <asm/cpu/mmu_context.h>
12#include <asm/tlbflush.h>
13#include <asm/uaccess.h>
14#include <asm/io.h>
15#include <asm-generic/mm_hooks.h>
16
17/*
18 * The MMU "context" consists of two things:
19 * (a) TLB cache version (or round, cycle whatever expression you like)
20 * (b) ASID (Address Space IDentifier)
21 */
22#define MMU_CONTEXT_ASID_MASK 0x000000ff
23#define MMU_CONTEXT_VERSION_MASK 0xffffff00
24#define MMU_CONTEXT_FIRST_VERSION 0x00000100
25#define NO_CONTEXT 0
26
27/* ASID is 8-bit value, so it can't be 0x100 */
28#define MMU_NO_ASID 0x100
29
30#ifdef CONFIG_MMU
31#define asid_cache(cpu) (cpu_data[cpu].asid_cache)
32#define cpu_context(cpu, mm) ((mm)->context.id[cpu])
33
34#define cpu_asid(cpu, mm) \
35 (cpu_context((cpu), (mm)) & MMU_CONTEXT_ASID_MASK)
36
37/*
38 * Virtual Page Number mask
39 */
40#define MMU_VPN_MASK 0xfffff000
41
42#if defined(CONFIG_SUPERH32)
43#include "mmu_context_32.h"
44#else
45#include "mmu_context_64.h"
46#endif
47
48/*
49 * Get MMU context if needed.
50 */
51static inline void get_mmu_context(struct mm_struct *mm, unsigned int cpu)
52{
53 unsigned long asid = asid_cache(cpu);
54
55 /* Check if we have old version of context. */
56 if (((cpu_context(cpu, mm) ^ asid) & MMU_CONTEXT_VERSION_MASK) == 0)
57 /* It's up to date, do nothing */
58 return;
59
60 /* It's old, we need to get new context with new version. */
61 if (!(++asid & MMU_CONTEXT_ASID_MASK)) {
62 /*
63 * We exhaust ASID of this version.
64 * Flush all TLB and start new cycle.
65 */
66 flush_tlb_all();
67
68#ifdef CONFIG_SUPERH64
69 /*
70 * The SH-5 cache uses the ASIDs, requiring both the I and D
71 * cache to be flushed when the ASID is exhausted. Weak.
72 */
73 flush_cache_all();
74#endif
75
76 /*
77 * Fix version; Note that we avoid version #0
78 * to distingush NO_CONTEXT.
79 */
80 if (!asid)
81 asid = MMU_CONTEXT_FIRST_VERSION;
82 }
83
84 cpu_context(cpu, mm) = asid_cache(cpu) = asid;
85}
86
87/*
88 * Initialize the context related info for a new mm_struct
89 * instance.
90 */
91static inline int init_new_context(struct task_struct *tsk,
92 struct mm_struct *mm)
93{
94 int i;
95
96 for (i = 0; i < num_online_cpus(); i++)
97 cpu_context(i, mm) = NO_CONTEXT;
98
99 return 0;
100}
101
102/*
103 * After we have set current->mm to a new value, this activates
104 * the context for the new mm so we see the new mappings.
105 */
106static inline void activate_context(struct mm_struct *mm, unsigned int cpu)
107{
108 get_mmu_context(mm, cpu);
109 set_asid(cpu_asid(cpu, mm));
110}
111
112static inline void switch_mm(struct mm_struct *prev,
113 struct mm_struct *next,
114 struct task_struct *tsk)
115{
116 unsigned int cpu = smp_processor_id();
117
118 if (likely(prev != next)) {
119 cpu_set(cpu, next->cpu_vm_mask);
120 set_TTB(next->pgd);
121 activate_context(next, cpu);
122 } else
123 if (!cpu_test_and_set(cpu, next->cpu_vm_mask))
124 activate_context(next, cpu);
125}
126#else
127#define get_mmu_context(mm) do { } while (0)
128#define init_new_context(tsk,mm) (0)
129#define destroy_context(mm) do { } while (0)
130#define set_asid(asid) do { } while (0)
131#define get_asid() (0)
132#define cpu_asid(cpu, mm) ({ (void)cpu; 0; })
133#define switch_and_save_asid(asid) (0)
134#define set_TTB(pgd) do { } while (0)
135#define get_TTB() (0)
136#define activate_context(mm,cpu) do { } while (0)
137#define switch_mm(prev,next,tsk) do { } while (0)
138#endif /* CONFIG_MMU */
139
140#define activate_mm(prev, next) switch_mm((prev),(next),NULL)
141#define deactivate_mm(tsk,mm) do { } while (0)
142#define enter_lazy_tlb(mm,tsk) do { } while (0)
143
144#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4)
145/*
146 * If this processor has an MMU, we need methods to turn it off/on ..
147 * paging_init() will also have to be updated for the processor in
148 * question.
149 */
150static inline void enable_mmu(void)
151{
152 unsigned int cpu = smp_processor_id();
153
154 /* Enable MMU */
155 ctrl_outl(MMU_CONTROL_INIT, MMUCR);
156 ctrl_barrier();
157
158 if (asid_cache(cpu) == NO_CONTEXT)
159 asid_cache(cpu) = MMU_CONTEXT_FIRST_VERSION;
160
161 set_asid(asid_cache(cpu) & MMU_CONTEXT_ASID_MASK);
162}
163
164static inline void disable_mmu(void)
165{
166 unsigned long cr;
167
168 cr = ctrl_inl(MMUCR);
169 cr &= ~MMU_CONTROL_INIT;
170 ctrl_outl(cr, MMUCR);
171
172 ctrl_barrier();
173}
174#else
175/*
176 * MMU control handlers for processors lacking memory
177 * management hardware.
178 */
179#define enable_mmu() do { } while (0)
180#define disable_mmu() do { } while (0)
181#endif
182
183#endif /* __KERNEL__ */
184#endif /* __ASM_SH_MMU_CONTEXT_H */
diff --git a/include/asm-sh/mmu_context_64.h b/include/asm-sh/mmu_context_64.h
deleted file mode 100644
index 9649f1c07caf..000000000000
--- a/include/asm-sh/mmu_context_64.h
+++ /dev/null
@@ -1,78 +0,0 @@
1#ifndef __ASM_SH_MMU_CONTEXT_64_H
2#define __ASM_SH_MMU_CONTEXT_64_H
3
4/*
5 * sh64-specific mmu_context interface.
6 *
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 * Copyright (C) 2003 - 2007 Paul Mundt
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 */
14#include <asm/cpu/registers.h>
15#include <asm/cacheflush.h>
16
17#define SR_ASID_MASK 0xffffffffff00ffffULL
18#define SR_ASID_SHIFT 16
19
20/*
21 * Destroy context related info for an mm_struct that is about
22 * to be put to rest.
23 */
24static inline void destroy_context(struct mm_struct *mm)
25{
26 /* Well, at least free TLB entries */
27 flush_tlb_mm(mm);
28}
29
30static inline unsigned long get_asid(void)
31{
32 unsigned long long sr;
33
34 asm volatile ("getcon " __SR ", %0\n\t"
35 : "=r" (sr));
36
37 sr = (sr >> SR_ASID_SHIFT) & MMU_CONTEXT_ASID_MASK;
38 return (unsigned long) sr;
39}
40
41/* Set ASID into SR */
42static inline void set_asid(unsigned long asid)
43{
44 unsigned long long sr, pc;
45
46 asm volatile ("getcon " __SR ", %0" : "=r" (sr));
47
48 sr = (sr & SR_ASID_MASK) | (asid << SR_ASID_SHIFT);
49
50 /*
51 * It is possible that this function may be inlined and so to avoid
52 * the assembler reporting duplicate symbols we make use of the
53 * gas trick of generating symbols using numerics and forward
54 * reference.
55 */
56 asm volatile ("movi 1, %1\n\t"
57 "shlli %1, 28, %1\n\t"
58 "or %0, %1, %1\n\t"
59 "putcon %1, " __SR "\n\t"
60 "putcon %0, " __SSR "\n\t"
61 "movi 1f, %1\n\t"
62 "ori %1, 1 , %1\n\t"
63 "putcon %1, " __SPC "\n\t"
64 "rte\n"
65 "1:\n\t"
66 : "=r" (sr), "=r" (pc) : "0" (sr));
67}
68
69/* arch/sh/kernel/cpu/sh5/entry.S */
70extern unsigned long switch_and_save_asid(unsigned long new_asid);
71
72/* No spare register to twiddle, so use a software cache */
73extern pgd_t *mmu_pdtp_cache;
74
75#define set_TTB(pgd) (mmu_pdtp_cache = (pgd))
76#define get_TTB() (mmu_pdtp_cache)
77
78#endif /* __ASM_SH_MMU_CONTEXT_64_H */
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
deleted file mode 100644
index 5dc01d2fcc4c..000000000000
--- a/include/asm-sh/page.h
+++ /dev/null
@@ -1,181 +0,0 @@
1#ifndef __ASM_SH_PAGE_H
2#define __ASM_SH_PAGE_H
3
4/*
5 * Copyright (C) 1999 Niibe Yutaka
6 */
7
8#include <linux/const.h>
9
10/* PAGE_SHIFT determines the page size */
11#if defined(CONFIG_PAGE_SIZE_4KB)
12# define PAGE_SHIFT 12
13#elif defined(CONFIG_PAGE_SIZE_8KB)
14# define PAGE_SHIFT 13
15#elif defined(CONFIG_PAGE_SIZE_64KB)
16# define PAGE_SHIFT 16
17#else
18# error "Bogus kernel page size?"
19#endif
20
21#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
22#define PAGE_MASK (~(PAGE_SIZE-1))
23#define PTE_MASK PAGE_MASK
24
25#if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
26#define HPAGE_SHIFT 16
27#elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)
28#define HPAGE_SHIFT 18
29#elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
30#define HPAGE_SHIFT 20
31#elif defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
32#define HPAGE_SHIFT 22
33#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB)
34#define HPAGE_SHIFT 26
35#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512MB)
36#define HPAGE_SHIFT 29
37#endif
38
39#ifdef CONFIG_HUGETLB_PAGE
40#define HPAGE_SIZE (1UL << HPAGE_SHIFT)
41#define HPAGE_MASK (~(HPAGE_SIZE-1))
42#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT)
43#endif
44
45#ifndef __ASSEMBLY__
46
47extern unsigned long shm_align_mask;
48extern unsigned long max_low_pfn, min_low_pfn;
49extern unsigned long memory_start, memory_end;
50
51extern void clear_page(void *to);
52extern void copy_page(void *to, void *from);
53
54#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
55 (defined(CONFIG_CPU_SH5) || defined(CONFIG_CPU_SH4) || \
56 defined(CONFIG_SH7705_CACHE_32KB))
57struct page;
58struct vm_area_struct;
59extern void clear_user_page(void *to, unsigned long address, struct page *page);
60extern void copy_user_page(void *to, void *from, unsigned long address,
61 struct page *page);
62#if defined(CONFIG_CPU_SH4)
63extern void copy_user_highpage(struct page *to, struct page *from,
64 unsigned long vaddr, struct vm_area_struct *vma);
65#define __HAVE_ARCH_COPY_USER_HIGHPAGE
66#endif
67#else
68#define clear_user_page(page, vaddr, pg) clear_page(page)
69#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
70#endif
71
72/*
73 * These are used to make use of C type-checking..
74 */
75#ifdef CONFIG_X2TLB
76typedef struct { unsigned long pte_low, pte_high; } pte_t;
77typedef struct { unsigned long long pgprot; } pgprot_t;
78typedef struct { unsigned long long pgd; } pgd_t;
79#define pte_val(x) \
80 ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
81#define __pte(x) \
82 ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; })
83#elif defined(CONFIG_SUPERH32)
84typedef struct { unsigned long pte_low; } pte_t;
85typedef struct { unsigned long pgprot; } pgprot_t;
86typedef struct { unsigned long pgd; } pgd_t;
87#define pte_val(x) ((x).pte_low)
88#define __pte(x) ((pte_t) { (x) } )
89#else
90typedef struct { unsigned long long pte_low; } pte_t;
91typedef struct { unsigned long pgprot; } pgprot_t;
92typedef struct { unsigned long pgd; } pgd_t;
93#define pte_val(x) ((x).pte_low)
94#define __pte(x) ((pte_t) { (x) } )
95#endif
96
97#define pgd_val(x) ((x).pgd)
98#define pgprot_val(x) ((x).pgprot)
99
100#define __pgd(x) ((pgd_t) { (x) } )
101#define __pgprot(x) ((pgprot_t) { (x) } )
102
103typedef struct page *pgtable_t;
104
105#endif /* !__ASSEMBLY__ */
106
107/*
108 * __MEMORY_START and SIZE are the physical addresses and size of RAM.
109 */
110#define __MEMORY_START CONFIG_MEMORY_START
111#define __MEMORY_SIZE CONFIG_MEMORY_SIZE
112
113/*
114 * PAGE_OFFSET is the virtual address of the start of kernel address
115 * space.
116 */
117#define PAGE_OFFSET CONFIG_PAGE_OFFSET
118
119/*
120 * Virtual to physical RAM address translation.
121 *
122 * In 29 bit mode, the physical offset of RAM from address 0 is visible in
123 * the kernel virtual address space, and thus we don't have to take
124 * this into account when translating. However in 32 bit mode this offset
125 * is not visible (it is part of the PMB mapping) and so needs to be
126 * added or subtracted as required.
127 */
128#ifdef CONFIG_32BIT
129#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET+__MEMORY_START)
130#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET-__MEMORY_START))
131#else
132#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
133#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
134#endif
135
136#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
137#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
138
139/*
140 * PFN = physical frame number (ie PFN 0 == physical address 0)
141 * PFN_START is the PFN of the first page of RAM. By defining this we
142 * don't have struct page entries for the portion of address space
143 * between physical address 0 and the start of RAM.
144 */
145#define PFN_START (__MEMORY_START >> PAGE_SHIFT)
146#define ARCH_PFN_OFFSET (PFN_START)
147#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
148#ifdef CONFIG_FLATMEM
149#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn)
150#endif
151#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
152
153#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
154 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
155
156#include <asm-generic/memory_model.h>
157#include <asm-generic/page.h>
158
159/* vDSO support */
160#ifdef CONFIG_VSYSCALL
161#define __HAVE_ARCH_GATE_AREA
162#endif
163
164/*
165 * Some drivers need to perform DMA into kmalloc'ed buffers
166 * and so we have to increase the kmalloc minalign for this.
167 */
168#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
169
170#ifdef CONFIG_SUPERH64
171/*
172 * While BYTES_PER_WORD == 4 on the current sh64 ABI, GCC will still
173 * happily generate {ld/st}.q pairs, requiring us to have 8-byte
174 * alignment to avoid traps. The kmalloc alignment is gauranteed by
175 * virtue of L1_CACHE_BYTES, requiring this to only be special cased
176 * for slab caches.
177 */
178#define ARCH_SLAB_MINALIGN 8
179#endif
180
181#endif /* __ASM_SH_PAGE_H */
diff --git a/include/asm-sh/pgtable_32.h b/include/asm-sh/pgtable_32.h
deleted file mode 100644
index cbc731d35c25..000000000000
--- a/include/asm-sh/pgtable_32.h
+++ /dev/null
@@ -1,477 +0,0 @@
1#ifndef __ASM_SH_PGTABLE_32_H
2#define __ASM_SH_PGTABLE_32_H
3
4/*
5 * Linux PTEL encoding.
6 *
7 * Hardware and software bit definitions for the PTEL value (see below for
8 * notes on SH-X2 MMUs and 64-bit PTEs):
9 *
10 * - Bits 0 and 7 are reserved on SH-3 (_PAGE_WT and _PAGE_SZ1 on SH-4).
11 *
12 * - Bit 1 is the SH-bit, but is unused on SH-3 due to an MMU bug (the
13 * hardware PTEL value can't have the SH-bit set when MMUCR.IX is set,
14 * which is the default in cpu-sh3/mmu_context.h:MMU_CONTROL_INIT).
15 *
16 * In order to keep this relatively clean, do not use these for defining
17 * SH-3 specific flags until all of the other unused bits have been
18 * exhausted.
19 *
20 * - Bit 9 is reserved by everyone and used by _PAGE_PROTNONE.
21 *
22 * - Bits 10 and 11 are low bits of the PPN that are reserved on >= 4K pages.
23 * Bit 10 is used for _PAGE_ACCESSED, bit 11 remains unused.
24 *
25 * - On 29 bit platforms, bits 31 to 29 are used for the space attributes
26 * and timing control which (together with bit 0) are moved into the
27 * old-style PTEA on the parts that support it.
28 *
29 * XXX: Leave the _PAGE_FILE and _PAGE_WT overhaul for a rainy day.
30 *
31 * SH-X2 MMUs and extended PTEs
32 *
33 * SH-X2 supports an extended mode TLB with split data arrays due to the
34 * number of bits needed for PR and SZ (now EPR and ESZ) encodings. The PR and
35 * SZ bit placeholders still exist in data array 1, but are implemented as
36 * reserved bits, with the real logic existing in data array 2.
37 *
38 * The downside to this is that we can no longer fit everything in to a 32-bit
39 * PTE encoding, so a 64-bit pte_t is necessary for these parts. On the plus
40 * side, this gives us quite a few spare bits to play with for future usage.
41 */
42/* Legacy and compat mode bits */
43#define _PAGE_WT 0x001 /* WT-bit on SH-4, 0 on SH-3 */
44#define _PAGE_HW_SHARED 0x002 /* SH-bit : shared among processes */
45#define _PAGE_DIRTY 0x004 /* D-bit : page changed */
46#define _PAGE_CACHABLE 0x008 /* C-bit : cachable */
47#define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */
48#define _PAGE_RW 0x020 /* PR0-bit : write access allowed */
49#define _PAGE_USER 0x040 /* PR1-bit : user space access allowed*/
50#define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */
51#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */
52#define _PAGE_PROTNONE 0x200 /* software: if not present */
53#define _PAGE_ACCESSED 0x400 /* software: page referenced */
54#define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */
55
56#define _PAGE_SZ_MASK (_PAGE_SZ0 | _PAGE_SZ1)
57#define _PAGE_PR_MASK (_PAGE_RW | _PAGE_USER)
58
59/* Extended mode bits */
60#define _PAGE_EXT_ESZ0 0x0010 /* ESZ0-bit: Size of page */
61#define _PAGE_EXT_ESZ1 0x0020 /* ESZ1-bit: Size of page */
62#define _PAGE_EXT_ESZ2 0x0040 /* ESZ2-bit: Size of page */
63#define _PAGE_EXT_ESZ3 0x0080 /* ESZ3-bit: Size of page */
64
65#define _PAGE_EXT_USER_EXEC 0x0100 /* EPR0-bit: User space executable */
66#define _PAGE_EXT_USER_WRITE 0x0200 /* EPR1-bit: User space writable */
67#define _PAGE_EXT_USER_READ 0x0400 /* EPR2-bit: User space readable */
68
69#define _PAGE_EXT_KERN_EXEC 0x0800 /* EPR3-bit: Kernel space executable */
70#define _PAGE_EXT_KERN_WRITE 0x1000 /* EPR4-bit: Kernel space writable */
71#define _PAGE_EXT_KERN_READ 0x2000 /* EPR5-bit: Kernel space readable */
72
73/* Wrapper for extended mode pgprot twiddling */
74#define _PAGE_EXT(x) ((unsigned long long)(x) << 32)
75
76/* software: moves to PTEA.TC (Timing Control) */
77#define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */
78#define _PAGE_PCC_AREA6 0x80000000 /* use BSC registers for area6 */
79
80/* software: moves to PTEA.SA[2:0] (Space Attributes) */
81#define _PAGE_PCC_IODYN 0x00000001 /* IO space, dynamically sized bus */
82#define _PAGE_PCC_IO8 0x20000000 /* IO space, 8 bit bus */
83#define _PAGE_PCC_IO16 0x20000001 /* IO space, 16 bit bus */
84#define _PAGE_PCC_COM8 0x40000000 /* Common Memory space, 8 bit bus */
85#define _PAGE_PCC_COM16 0x40000001 /* Common Memory space, 16 bit bus */
86#define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */
87#define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */
88
89/* Mask which drops unused bits from the PTEL value */
90#if defined(CONFIG_CPU_SH3)
91#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \
92 _PAGE_FILE | _PAGE_SZ1 | \
93 _PAGE_HW_SHARED)
94#elif defined(CONFIG_X2TLB)
95/* Get rid of the legacy PR/SZ bits when using extended mode */
96#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | \
97 _PAGE_FILE | _PAGE_PR_MASK | _PAGE_SZ_MASK)
98#else
99#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_FILE)
100#endif
101
102#define _PAGE_FLAGS_HARDWARE_MASK (PHYS_ADDR_MASK & ~(_PAGE_CLEAR_FLAGS))
103
104/* Hardware flags, page size encoding */
105#if defined(CONFIG_X2TLB)
106# if defined(CONFIG_PAGE_SIZE_4KB)
107# define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ0)
108# elif defined(CONFIG_PAGE_SIZE_8KB)
109# define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ1)
110# elif defined(CONFIG_PAGE_SIZE_64KB)
111# define _PAGE_FLAGS_HARD _PAGE_EXT(_PAGE_EXT_ESZ2)
112# endif
113#else
114# if defined(CONFIG_PAGE_SIZE_4KB)
115# define _PAGE_FLAGS_HARD _PAGE_SZ0
116# elif defined(CONFIG_PAGE_SIZE_64KB)
117# define _PAGE_FLAGS_HARD _PAGE_SZ1
118# endif
119#endif
120
121#if defined(CONFIG_X2TLB)
122# if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
123# define _PAGE_SZHUGE (_PAGE_EXT_ESZ2)
124# elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K)
125# define _PAGE_SZHUGE (_PAGE_EXT_ESZ0 | _PAGE_EXT_ESZ2)
126# elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
127# define _PAGE_SZHUGE (_PAGE_EXT_ESZ0 | _PAGE_EXT_ESZ1 | _PAGE_EXT_ESZ2)
128# elif defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
129# define _PAGE_SZHUGE (_PAGE_EXT_ESZ3)
130# elif defined(CONFIG_HUGETLB_PAGE_SIZE_64MB)
131# define _PAGE_SZHUGE (_PAGE_EXT_ESZ2 | _PAGE_EXT_ESZ3)
132# endif
133#else
134# if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
135# define _PAGE_SZHUGE (_PAGE_SZ1)
136# elif defined(CONFIG_HUGETLB_PAGE_SIZE_1MB)
137# define _PAGE_SZHUGE (_PAGE_SZ0 | _PAGE_SZ1)
138# endif
139#endif
140
141/*
142 * Stub out _PAGE_SZHUGE if we don't have a good definition for it,
143 * to make pte_mkhuge() happy.
144 */
145#ifndef _PAGE_SZHUGE
146# define _PAGE_SZHUGE (_PAGE_FLAGS_HARD)
147#endif
148
149#define _PAGE_CHG_MASK \
150 (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY)
151
152#ifndef __ASSEMBLY__
153
154#if defined(CONFIG_X2TLB) /* SH-X2 TLB */
155#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE | \
156 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
157
158#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
159 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
160 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
161 _PAGE_EXT_KERN_WRITE | \
162 _PAGE_EXT_USER_READ | \
163 _PAGE_EXT_USER_WRITE))
164
165#define PAGE_EXECREAD __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
166 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
167 _PAGE_EXT(_PAGE_EXT_KERN_EXEC | \
168 _PAGE_EXT_KERN_READ | \
169 _PAGE_EXT_USER_EXEC | \
170 _PAGE_EXT_USER_READ))
171
172#define PAGE_COPY PAGE_EXECREAD
173
174#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
175 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
176 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
177 _PAGE_EXT_USER_READ))
178
179#define PAGE_WRITEONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
180 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
181 _PAGE_EXT(_PAGE_EXT_KERN_WRITE | \
182 _PAGE_EXT_USER_WRITE))
183
184#define PAGE_RWX __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
185 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
186 _PAGE_EXT(_PAGE_EXT_KERN_WRITE | \
187 _PAGE_EXT_KERN_READ | \
188 _PAGE_EXT_KERN_EXEC | \
189 _PAGE_EXT_USER_WRITE | \
190 _PAGE_EXT_USER_READ | \
191 _PAGE_EXT_USER_EXEC))
192
193#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
194 _PAGE_DIRTY | _PAGE_ACCESSED | \
195 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD | \
196 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
197 _PAGE_EXT_KERN_WRITE | \
198 _PAGE_EXT_KERN_EXEC))
199
200#define PAGE_KERNEL_NOCACHE \
201 __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | \
202 _PAGE_ACCESSED | _PAGE_HW_SHARED | \
203 _PAGE_FLAGS_HARD | \
204 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
205 _PAGE_EXT_KERN_WRITE | \
206 _PAGE_EXT_KERN_EXEC))
207
208#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
209 _PAGE_DIRTY | _PAGE_ACCESSED | \
210 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD | \
211 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
212 _PAGE_EXT_KERN_EXEC))
213
214#define PAGE_KERNEL_PCC(slot, type) \
215 __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | \
216 _PAGE_ACCESSED | _PAGE_FLAGS_HARD | \
217 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
218 _PAGE_EXT_KERN_WRITE | \
219 _PAGE_EXT_KERN_EXEC) \
220 (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | \
221 (type))
222
223#elif defined(CONFIG_MMU) /* SH-X TLB */
224#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_CACHABLE | \
225 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
226
227#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
228 _PAGE_CACHABLE | _PAGE_ACCESSED | \
229 _PAGE_FLAGS_HARD)
230
231#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | \
232 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
233
234#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_CACHABLE | \
235 _PAGE_ACCESSED | _PAGE_FLAGS_HARD)
236
237#define PAGE_EXECREAD PAGE_READONLY
238#define PAGE_RWX PAGE_SHARED
239#define PAGE_WRITEONLY PAGE_SHARED
240
241#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_CACHABLE | \
242 _PAGE_DIRTY | _PAGE_ACCESSED | \
243 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
244
245#define PAGE_KERNEL_NOCACHE \
246 __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \
247 _PAGE_ACCESSED | _PAGE_HW_SHARED | \
248 _PAGE_FLAGS_HARD)
249
250#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_CACHABLE | \
251 _PAGE_DIRTY | _PAGE_ACCESSED | \
252 _PAGE_HW_SHARED | _PAGE_FLAGS_HARD)
253
254#define PAGE_KERNEL_PCC(slot, type) \
255 __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | \
256 _PAGE_ACCESSED | _PAGE_FLAGS_HARD | \
257 (slot ? _PAGE_PCC_AREA5 : _PAGE_PCC_AREA6) | \
258 (type))
259#else /* no mmu */
260#define PAGE_NONE __pgprot(0)
261#define PAGE_SHARED __pgprot(0)
262#define PAGE_COPY __pgprot(0)
263#define PAGE_EXECREAD __pgprot(0)
264#define PAGE_RWX __pgprot(0)
265#define PAGE_READONLY __pgprot(0)
266#define PAGE_WRITEONLY __pgprot(0)
267#define PAGE_KERNEL __pgprot(0)
268#define PAGE_KERNEL_NOCACHE __pgprot(0)
269#define PAGE_KERNEL_RO __pgprot(0)
270
271#define PAGE_KERNEL_PCC(slot, type) \
272 __pgprot(0)
273#endif
274
275#endif /* __ASSEMBLY__ */
276
277#ifndef __ASSEMBLY__
278
279/*
280 * Certain architectures need to do special things when PTEs
281 * within a page table are directly modified. Thus, the following
282 * hook is made available.
283 */
284#ifdef CONFIG_X2TLB
285static inline void set_pte(pte_t *ptep, pte_t pte)
286{
287 ptep->pte_high = pte.pte_high;
288 smp_wmb();
289 ptep->pte_low = pte.pte_low;
290}
291#else
292#define set_pte(pteptr, pteval) (*(pteptr) = pteval)
293#endif
294
295#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
296
297/*
298 * (pmds are folded into pgds so this doesn't get actually called,
299 * but the define is needed for a generic inline function.)
300 */
301#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
302
303#define pfn_pte(pfn, prot) \
304 __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
305#define pfn_pmd(pfn, prot) \
306 __pmd(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
307
308#define pte_none(x) (!pte_val(x))
309#define pte_present(x) ((x).pte_low & (_PAGE_PRESENT | _PAGE_PROTNONE))
310
311#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
312
313#define pmd_none(x) (!pmd_val(x))
314#define pmd_present(x) (pmd_val(x))
315#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0)
316#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
317
318#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
319#define pte_page(x) pfn_to_page(pte_pfn(x))
320
321/*
322 * The following only work if pte_present() is true.
323 * Undefined behaviour if not..
324 */
325#define pte_not_present(pte) (!((pte).pte_low & _PAGE_PRESENT))
326#define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY)
327#define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED)
328#define pte_file(pte) ((pte).pte_low & _PAGE_FILE)
329#define pte_special(pte) (0)
330
331#ifdef CONFIG_X2TLB
332#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE)
333#else
334#define pte_write(pte) ((pte).pte_low & _PAGE_RW)
335#endif
336
337#define PTE_BIT_FUNC(h,fn,op) \
338static inline pte_t pte_##fn(pte_t pte) { pte.pte_##h op; return pte; }
339
340#ifdef CONFIG_X2TLB
341/*
342 * We cheat a bit in the SH-X2 TLB case. As the permission bits are
343 * individually toggled (and user permissions are entirely decoupled from
344 * kernel permissions), we attempt to couple them a bit more sanely here.
345 */
346PTE_BIT_FUNC(high, wrprotect, &= ~_PAGE_EXT_USER_WRITE);
347PTE_BIT_FUNC(high, mkwrite, |= _PAGE_EXT_USER_WRITE | _PAGE_EXT_KERN_WRITE);
348PTE_BIT_FUNC(high, mkhuge, |= _PAGE_SZHUGE);
349#else
350PTE_BIT_FUNC(low, wrprotect, &= ~_PAGE_RW);
351PTE_BIT_FUNC(low, mkwrite, |= _PAGE_RW);
352PTE_BIT_FUNC(low, mkhuge, |= _PAGE_SZHUGE);
353#endif
354
355PTE_BIT_FUNC(low, mkclean, &= ~_PAGE_DIRTY);
356PTE_BIT_FUNC(low, mkdirty, |= _PAGE_DIRTY);
357PTE_BIT_FUNC(low, mkold, &= ~_PAGE_ACCESSED);
358PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED);
359
360static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
361
362/*
363 * Macro and implementation to make a page protection as uncachable.
364 */
365#define pgprot_writecombine(prot) \
366 __pgprot(pgprot_val(prot) & ~_PAGE_CACHABLE)
367
368#define pgprot_noncached pgprot_writecombine
369
370/*
371 * Conversion functions: convert a page and protection to a page entry,
372 * and a page entry and page directory to the page they refer to.
373 *
374 * extern pte_t mk_pte(struct page *page, pgprot_t pgprot)
375 */
376#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
377
378static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
379{
380 pte.pte_low &= _PAGE_CHG_MASK;
381 pte.pte_low |= pgprot_val(newprot);
382
383#ifdef CONFIG_X2TLB
384 pte.pte_high |= pgprot_val(newprot) >> 32;
385#endif
386
387 return pte;
388}
389
390#define pmd_page_vaddr(pmd) ((unsigned long)pmd_val(pmd))
391#define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
392
393/* to find an entry in a page-table-directory. */
394#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
395#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
396
397/* to find an entry in a kernel page-table-directory */
398#define pgd_offset_k(address) pgd_offset(&init_mm, address)
399
400/* Find an entry in the third-level page table.. */
401#define pte_index(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
402#define pte_offset_kernel(dir, address) \
403 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
404#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
405#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address)
406
407#define pte_unmap(pte) do { } while (0)
408#define pte_unmap_nested(pte) do { } while (0)
409
410#ifdef CONFIG_X2TLB
411#define pte_ERROR(e) \
412 printk("%s:%d: bad pte %p(%08lx%08lx).\n", __FILE__, __LINE__, \
413 &(e), (e).pte_high, (e).pte_low)
414#define pgd_ERROR(e) \
415 printk("%s:%d: bad pgd %016llx.\n", __FILE__, __LINE__, pgd_val(e))
416#else
417#define pte_ERROR(e) \
418 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
419#define pgd_ERROR(e) \
420 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
421#endif
422
423/*
424 * Encode and de-code a swap entry
425 *
426 * Constraints:
427 * _PAGE_FILE at bit 0
428 * _PAGE_PRESENT at bit 8
429 * _PAGE_PROTNONE at bit 9
430 *
431 * For the normal case, we encode the swap type into bits 0:7 and the
432 * swap offset into bits 10:30. For the 64-bit PTE case, we keep the
433 * preserved bits in the low 32-bits and use the upper 32 as the swap
434 * offset (along with a 5-bit type), following the same approach as x86
435 * PAE. This keeps the logic quite simple, and allows for a full 32
436 * PTE_FILE_MAX_BITS, as opposed to the 29-bits we're constrained with
437 * in the pte_low case.
438 *
439 * As is evident by the Alpha code, if we ever get a 64-bit unsigned
440 * long (swp_entry_t) to match up with the 64-bit PTEs, this all becomes
441 * much cleaner..
442 *
443 * NOTE: We should set ZEROs at the position of _PAGE_PRESENT
444 * and _PAGE_PROTNONE bits
445 */
446#ifdef CONFIG_X2TLB
447#define __swp_type(x) ((x).val & 0x1f)
448#define __swp_offset(x) ((x).val >> 5)
449#define __swp_entry(type, offset) ((swp_entry_t){ (type) | (offset) << 5})
450#define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high })
451#define __swp_entry_to_pte(x) ((pte_t){ 0, (x).val })
452
453/*
454 * Encode and decode a nonlinear file mapping entry
455 */
456#define pte_to_pgoff(pte) ((pte).pte_high)
457#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) })
458
459#define PTE_FILE_MAX_BITS 32
460#else
461#define __swp_type(x) ((x).val & 0xff)
462#define __swp_offset(x) ((x).val >> 10)
463#define __swp_entry(type, offset) ((swp_entry_t){(type) | (offset) <<10})
464
465#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> 1 })
466#define __swp_entry_to_pte(x) ((pte_t) { (x).val << 1 })
467
468/*
469 * Encode and decode a nonlinear file mapping entry
470 */
471#define PTE_FILE_MAX_BITS 29
472#define pte_to_pgoff(pte) (pte_val(pte) >> 1)
473#define pgoff_to_pte(off) ((pte_t) { ((off) << 1) | _PAGE_FILE })
474#endif
475
476#endif /* __ASSEMBLY__ */
477#endif /* __ASM_SH_PGTABLE_32_H */
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
deleted file mode 100644
index b7c7ce80f03e..000000000000
--- a/include/asm-sh/processor.h
+++ /dev/null
@@ -1,65 +0,0 @@
1#ifndef __ASM_SH_PROCESSOR_H
2#define __ASM_SH_PROCESSOR_H
3
4#include <asm/cpu-features.h>
5
6#ifndef __ASSEMBLY__
7/*
8 * CPU type and hardware bug flags. Kept separately for each CPU.
9 *
10 * Each one of these also needs a CONFIG_CPU_SUBTYPE_xxx entry
11 * in arch/sh/mm/Kconfig, as well as an entry in arch/sh/kernel/setup.c
12 * for parsing the subtype in get_cpu_subtype().
13 */
14enum cpu_type {
15 /* SH-2 types */
16 CPU_SH7619,
17
18 /* SH-2A types */
19 CPU_SH7203, CPU_SH7206, CPU_SH7263, CPU_MXG,
20
21 /* SH-3 types */
22 CPU_SH7705, CPU_SH7706, CPU_SH7707,
23 CPU_SH7708, CPU_SH7708S, CPU_SH7708R,
24 CPU_SH7709, CPU_SH7709A, CPU_SH7710, CPU_SH7712,
25 CPU_SH7720, CPU_SH7721, CPU_SH7729,
26
27 /* SH-4 types */
28 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
29 CPU_SH7760, CPU_SH4_202, CPU_SH4_501,
30
31 /* SH-4A types */
32 CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785,
33 CPU_SH7723, CPU_SHX3,
34
35 /* SH4AL-DSP types */
36 CPU_SH7343, CPU_SH7722, CPU_SH7366,
37
38 /* SH-5 types */
39 CPU_SH5_101, CPU_SH5_103,
40
41 /* Unknown subtype */
42 CPU_SH_NONE
43};
44
45/* Forward decl */
46struct sh_cpuinfo;
47
48/* arch/sh/kernel/setup.c */
49const char *get_cpu_subtype(struct sh_cpuinfo *c);
50
51#ifdef CONFIG_VSYSCALL
52int vsyscall_init(void);
53#else
54#define vsyscall_init() do { } while (0)
55#endif
56
57#endif /* __ASSEMBLY__ */
58
59#ifdef CONFIG_SUPERH32
60# include "processor_32.h"
61#else
62# include "processor_64.h"
63#endif
64
65#endif /* __ASM_SH_PROCESSOR_H */
diff --git a/include/asm-sh/processor_32.h b/include/asm-sh/processor_32.h
deleted file mode 100644
index c09305d6a9d9..000000000000
--- a/include/asm-sh/processor_32.h
+++ /dev/null
@@ -1,219 +0,0 @@
1/*
2 * include/asm-sh/processor.h
3 *
4 * Copyright (C) 1999, 2000 Niibe Yutaka
5 * Copyright (C) 2002, 2003 Paul Mundt
6 */
7
8#ifndef __ASM_SH_PROCESSOR_32_H
9#define __ASM_SH_PROCESSOR_32_H
10#ifdef __KERNEL__
11
12#include <linux/compiler.h>
13#include <asm/page.h>
14#include <asm/types.h>
15#include <asm/cache.h>
16#include <asm/ptrace.h>
17
18/*
19 * Default implementation of macro that returns current
20 * instruction pointer ("program counter").
21 */
22#define current_text_addr() ({ void *pc; __asm__("mova 1f, %0\n1:":"=z" (pc)); pc; })
23
24/* Core Processor Version Register */
25#define CCN_PVR 0xff000030
26#define CCN_CVR 0xff000040
27#define CCN_PRR 0xff000044
28
29struct sh_cpuinfo {
30 unsigned int type;
31 unsigned long loops_per_jiffy;
32 unsigned long asid_cache;
33
34 struct cache_info icache; /* Primary I-cache */
35 struct cache_info dcache; /* Primary D-cache */
36 struct cache_info scache; /* Secondary cache */
37
38 unsigned long flags;
39} __attribute__ ((aligned(L1_CACHE_BYTES)));
40
41extern struct sh_cpuinfo cpu_data[];
42#define boot_cpu_data cpu_data[0]
43#define current_cpu_data cpu_data[smp_processor_id()]
44#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
45
46/*
47 * User space process size: 2GB.
48 *
49 * Since SH7709 and SH7750 have "area 7", we can't use 0x7c000000--0x7fffffff
50 */
51#define TASK_SIZE 0x7c000000UL
52
53#define STACK_TOP TASK_SIZE
54#define STACK_TOP_MAX STACK_TOP
55
56/* This decides where the kernel will search for a free chunk of vm
57 * space during mmap's.
58 */
59#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
60
61/*
62 * Bit of SR register
63 *
64 * FD-bit:
65 * When it's set, it means the processor doesn't have right to use FPU,
66 * and it results exception when the floating operation is executed.
67 *
68 * IMASK-bit:
69 * Interrupt level mask
70 */
71#define SR_DSP 0x00001000
72#define SR_IMASK 0x000000f0
73#define SR_FD 0x00008000
74
75/*
76 * FPU structure and data
77 */
78
79struct sh_fpu_hard_struct {
80 unsigned long fp_regs[16];
81 unsigned long xfp_regs[16];
82 unsigned long fpscr;
83 unsigned long fpul;
84
85 long status; /* software status information */
86};
87
88/* Dummy fpu emulator */
89struct sh_fpu_soft_struct {
90 unsigned long fp_regs[16];
91 unsigned long xfp_regs[16];
92 unsigned long fpscr;
93 unsigned long fpul;
94
95 unsigned char lookahead;
96 unsigned long entry_pc;
97};
98
99union sh_fpu_union {
100 struct sh_fpu_hard_struct hard;
101 struct sh_fpu_soft_struct soft;
102};
103
104struct thread_struct {
105 /* Saved registers when thread is descheduled */
106 unsigned long sp;
107 unsigned long pc;
108
109 /* Hardware debugging registers */
110 unsigned long ubc_pc;
111
112 /* floating point info */
113 union sh_fpu_union fpu;
114};
115
116typedef struct {
117 unsigned long seg;
118} mm_segment_t;
119
120/* Count of active tasks with UBC settings */
121extern int ubc_usercnt;
122
123#define INIT_THREAD { \
124 .sp = sizeof(init_stack) + (long) &init_stack, \
125}
126
127/*
128 * Do necessary setup to start up a newly executed thread.
129 */
130#define start_thread(regs, new_pc, new_sp) \
131 set_fs(USER_DS); \
132 regs->pr = 0; \
133 regs->sr = SR_FD; /* User mode. */ \
134 regs->pc = new_pc; \
135 regs->regs[15] = new_sp
136
137/* Forward declaration, a strange C thing */
138struct task_struct;
139struct mm_struct;
140
141/* Free all resources held by a thread. */
142extern void release_thread(struct task_struct *);
143
144/* Prepare to copy thread state - unlazy all lazy status */
145#define prepare_to_copy(tsk) do { } while (0)
146
147/*
148 * create a kernel thread without removing it from tasklists
149 */
150extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
151
152/* Copy and release all segment info associated with a VM */
153#define copy_segments(p, mm) do { } while(0)
154#define release_segments(mm) do { } while(0)
155
156/*
157 * FPU lazy state save handling.
158 */
159
160static __inline__ void disable_fpu(void)
161{
162 unsigned long __dummy;
163
164 /* Set FD flag in SR */
165 __asm__ __volatile__("stc sr, %0\n\t"
166 "or %1, %0\n\t"
167 "ldc %0, sr"
168 : "=&r" (__dummy)
169 : "r" (SR_FD));
170}
171
172static __inline__ void enable_fpu(void)
173{
174 unsigned long __dummy;
175
176 /* Clear out FD flag in SR */
177 __asm__ __volatile__("stc sr, %0\n\t"
178 "and %1, %0\n\t"
179 "ldc %0, sr"
180 : "=&r" (__dummy)
181 : "r" (~SR_FD));
182}
183
184/* Double presision, NANS as NANS, rounding to nearest, no exceptions */
185#define FPSCR_INIT 0x00080000
186
187#define FPSCR_CAUSE_MASK 0x0001f000 /* Cause bits */
188#define FPSCR_FLAG_MASK 0x0000007c /* Flag bits */
189
190/*
191 * Return saved PC of a blocked thread.
192 */
193#define thread_saved_pc(tsk) (tsk->thread.pc)
194
195void show_trace(struct task_struct *tsk, unsigned long *sp,
196 struct pt_regs *regs);
197extern unsigned long get_wchan(struct task_struct *p);
198
199#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
200#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[15])
201
202#define cpu_sleep() __asm__ __volatile__ ("sleep" : : : "memory")
203#define cpu_relax() barrier()
204
205#if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH3) || \
206 defined(CONFIG_CPU_SH4)
207#define PREFETCH_STRIDE L1_CACHE_BYTES
208#define ARCH_HAS_PREFETCH
209#define ARCH_HAS_PREFETCHW
210static inline void prefetch(void *x)
211{
212 __asm__ __volatile__ ("pref @%0\n\t" : : "r" (x) : "memory");
213}
214
215#define prefetchw(x) prefetch(x)
216#endif
217
218#endif /* __KERNEL__ */
219#endif /* __ASM_SH_PROCESSOR_32_H */
diff --git a/include/asm-sh/processor_64.h b/include/asm-sh/processor_64.h
deleted file mode 100644
index 88a2edf8fa5d..000000000000
--- a/include/asm-sh/processor_64.h
+++ /dev/null
@@ -1,279 +0,0 @@
1#ifndef __ASM_SH_PROCESSOR_64_H
2#define __ASM_SH_PROCESSOR_64_H
3
4/*
5 * include/asm-sh/processor_64.h
6 *
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 * Copyright (C) 2003 Paul Mundt
9 * Copyright (C) 2004 Richard Curnow
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#ifndef __ASSEMBLY__
16
17#include <linux/compiler.h>
18#include <asm/page.h>
19#include <asm/types.h>
20#include <asm/cache.h>
21#include <asm/ptrace.h>
22#include <asm/cpu/registers.h>
23
24/*
25 * Default implementation of macro that returns current
26 * instruction pointer ("program counter").
27 */
28#define current_text_addr() ({ \
29void *pc; \
30unsigned long long __dummy = 0; \
31__asm__("gettr tr0, %1\n\t" \
32 "pta 4, tr0\n\t" \
33 "gettr tr0, %0\n\t" \
34 "ptabs %1, tr0\n\t" \
35 :"=r" (pc), "=r" (__dummy) \
36 : "1" (__dummy)); \
37pc; })
38
39/*
40 * TLB information structure
41 *
42 * Defined for both I and D tlb, per-processor.
43 */
44struct tlb_info {
45 unsigned long long next;
46 unsigned long long first;
47 unsigned long long last;
48
49 unsigned int entries;
50 unsigned int step;
51
52 unsigned long flags;
53};
54
55struct sh_cpuinfo {
56 enum cpu_type type;
57 unsigned long loops_per_jiffy;
58 unsigned long asid_cache;
59
60 unsigned int cpu_clock, master_clock, bus_clock, module_clock;
61
62 /* Cache info */
63 struct cache_info icache;
64 struct cache_info dcache;
65 struct cache_info scache;
66
67 /* TLB info */
68 struct tlb_info itlb;
69 struct tlb_info dtlb;
70
71 unsigned long flags;
72};
73
74extern struct sh_cpuinfo cpu_data[];
75#define boot_cpu_data cpu_data[0]
76#define current_cpu_data cpu_data[smp_processor_id()]
77#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
78
79#endif
80
81/*
82 * User space process size: 2GB - 4k.
83 */
84#define TASK_SIZE 0x7ffff000UL
85
86#define STACK_TOP TASK_SIZE
87#define STACK_TOP_MAX STACK_TOP
88
89/* This decides where the kernel will search for a free chunk of vm
90 * space during mmap's.
91 */
92#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
93
94/*
95 * Bit of SR register
96 *
97 * FD-bit:
98 * When it's set, it means the processor doesn't have right to use FPU,
99 * and it results exception when the floating operation is executed.
100 *
101 * IMASK-bit:
102 * Interrupt level mask
103 *
104 * STEP-bit:
105 * Single step bit
106 *
107 */
108#if defined(CONFIG_SH64_SR_WATCH)
109#define SR_MMU 0x84000000
110#else
111#define SR_MMU 0x80000000
112#endif
113
114#define SR_IMASK 0x000000f0
115#define SR_FD 0x00008000
116#define SR_SSTEP 0x08000000
117
118#ifndef __ASSEMBLY__
119
120/*
121 * FPU structure and data : require 8-byte alignment as we need to access it
122 with fld.p, fst.p
123 */
124
125struct sh_fpu_hard_struct {
126 unsigned long fp_regs[64];
127 unsigned int fpscr;
128 /* long status; * software status information */
129};
130
131#if 0
132/* Dummy fpu emulator */
133struct sh_fpu_soft_struct {
134 unsigned long long fp_regs[32];
135 unsigned int fpscr;
136 unsigned char lookahead;
137 unsigned long entry_pc;
138};
139#endif
140
141union sh_fpu_union {
142 struct sh_fpu_hard_struct hard;
143 /* 'hard' itself only produces 32 bit alignment, yet we need
144 to access it using 64 bit load/store as well. */
145 unsigned long long alignment_dummy;
146};
147
148struct thread_struct {
149 unsigned long sp;
150 unsigned long pc;
151 /* This stores the address of the pt_regs built during a context
152 switch, or of the register save area built for a kernel mode
153 exception. It is used for backtracing the stack of a sleeping task
154 or one that traps in kernel mode. */
155 struct pt_regs *kregs;
156 /* This stores the address of the pt_regs constructed on entry from
157 user mode. It is a fixed value over the lifetime of a process, or
158 NULL for a kernel thread. */
159 struct pt_regs *uregs;
160
161 unsigned long trap_no, error_code;
162 unsigned long address;
163 /* Hardware debugging registers may come here */
164
165 /* floating point info */
166 union sh_fpu_union fpu;
167};
168
169typedef struct {
170 unsigned long seg;
171} mm_segment_t;
172
173#define INIT_MMAP \
174{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
175
176extern struct pt_regs fake_swapper_regs;
177
178#define INIT_THREAD { \
179 .sp = sizeof(init_stack) + \
180 (long) &init_stack, \
181 .pc = 0, \
182 .kregs = &fake_swapper_regs, \
183 .uregs = NULL, \
184 .trap_no = 0, \
185 .error_code = 0, \
186 .address = 0, \
187 .fpu = { { { 0, } }, } \
188}
189
190/*
191 * Do necessary setup to start up a newly executed thread.
192 */
193#define SR_USER (SR_MMU | SR_FD)
194
195#define start_thread(regs, new_pc, new_sp) \
196 set_fs(USER_DS); \
197 regs->sr = SR_USER; /* User mode. */ \
198 regs->pc = new_pc - 4; /* Compensate syscall exit */ \
199 regs->pc |= 1; /* Set SHmedia ! */ \
200 regs->regs[18] = 0; \
201 regs->regs[15] = new_sp
202
203/* Forward declaration, a strange C thing */
204struct task_struct;
205struct mm_struct;
206
207/* Free all resources held by a thread. */
208extern void release_thread(struct task_struct *);
209/*
210 * create a kernel thread without removing it from tasklists
211 */
212extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
213
214
215/* Copy and release all segment info associated with a VM */
216#define copy_segments(p, mm) do { } while (0)
217#define release_segments(mm) do { } while (0)
218#define forget_segments() do { } while (0)
219#define prepare_to_copy(tsk) do { } while (0)
220/*
221 * FPU lazy state save handling.
222 */
223
224static inline void disable_fpu(void)
225{
226 unsigned long long __dummy;
227
228 /* Set FD flag in SR */
229 __asm__ __volatile__("getcon " __SR ", %0\n\t"
230 "or %0, %1, %0\n\t"
231 "putcon %0, " __SR "\n\t"
232 : "=&r" (__dummy)
233 : "r" (SR_FD));
234}
235
236static inline void enable_fpu(void)
237{
238 unsigned long long __dummy;
239
240 /* Clear out FD flag in SR */
241 __asm__ __volatile__("getcon " __SR ", %0\n\t"
242 "and %0, %1, %0\n\t"
243 "putcon %0, " __SR "\n\t"
244 : "=&r" (__dummy)
245 : "r" (~SR_FD));
246}
247
248/* Round to nearest, no exceptions on inexact, overflow, underflow,
249 zero-divide, invalid. Configure option for whether to flush denorms to
250 zero, or except if a denorm is encountered. */
251#if defined(CONFIG_SH64_FPU_DENORM_FLUSH)
252#define FPSCR_INIT 0x00040000
253#else
254#define FPSCR_INIT 0x00000000
255#endif
256
257#ifdef CONFIG_SH_FPU
258/* Initialise the FP state of a task */
259void fpinit(struct sh_fpu_hard_struct *fpregs);
260#else
261#define fpinit(fpregs) do { } while (0)
262#endif
263
264extern struct task_struct *last_task_used_math;
265
266/*
267 * Return saved PC of a blocked thread.
268 */
269#define thread_saved_pc(tsk) (tsk->thread.pc)
270
271extern unsigned long get_wchan(struct task_struct *p);
272
273#define KSTK_EIP(tsk) ((tsk)->thread.pc)
274#define KSTK_ESP(tsk) ((tsk)->thread.sp)
275
276#define cpu_relax() barrier()
277
278#endif /* __ASSEMBLY__ */
279#endif /* __ASM_SH_PROCESSOR_64_H */
diff --git a/include/asm-sh/ptrace.h b/include/asm-sh/ptrace.h
deleted file mode 100644
index 7d36dc3bee69..000000000000
--- a/include/asm-sh/ptrace.h
+++ /dev/null
@@ -1,125 +0,0 @@
1#ifndef __ASM_SH_PTRACE_H
2#define __ASM_SH_PTRACE_H
3
4/*
5 * Copyright (C) 1999, 2000 Niibe Yutaka
6 *
7 */
8#if defined(__SH5__)
9struct pt_regs {
10 unsigned long long pc;
11 unsigned long long sr;
12 unsigned long long syscall_nr;
13 unsigned long long regs[63];
14 unsigned long long tregs[8];
15 unsigned long long pad[2];
16};
17#else
18/*
19 * GCC defines register number like this:
20 * -----------------------------
21 * 0 - 15 are integer registers
22 * 17 - 22 are control/special registers
23 * 24 - 39 fp registers
24 * 40 - 47 xd registers
25 * 48 - fpscr register
26 * -----------------------------
27 *
28 * We follows above, except:
29 * 16 --- program counter (PC)
30 * 22 --- syscall #
31 * 23 --- floating point communication register
32 */
33#define REG_REG0 0
34#define REG_REG15 15
35
36#define REG_PC 16
37
38#define REG_PR 17
39#define REG_SR 18
40#define REG_GBR 19
41#define REG_MACH 20
42#define REG_MACL 21
43
44#define REG_SYSCALL 22
45
46#define REG_FPREG0 23
47#define REG_FPREG15 38
48#define REG_XFREG0 39
49#define REG_XFREG15 54
50
51#define REG_FPSCR 55
52#define REG_FPUL 56
53
54/*
55 * This struct defines the way the registers are stored on the
56 * kernel stack during a system call or other kernel entry.
57 */
58struct pt_regs {
59 unsigned long regs[16];
60 unsigned long pc;
61 unsigned long pr;
62 unsigned long sr;
63 unsigned long gbr;
64 unsigned long mach;
65 unsigned long macl;
66 long tra;
67};
68
69/*
70 * This struct defines the way the DSP registers are stored on the
71 * kernel stack during a system call or other kernel entry.
72 */
73struct pt_dspregs {
74 unsigned long a1;
75 unsigned long a0g;
76 unsigned long a1g;
77 unsigned long m0;
78 unsigned long m1;
79 unsigned long a0;
80 unsigned long x0;
81 unsigned long x1;
82 unsigned long y0;
83 unsigned long y1;
84 unsigned long dsr;
85 unsigned long rs;
86 unsigned long re;
87 unsigned long mod;
88};
89
90#define PTRACE_GETDSPREGS 55
91#define PTRACE_SETDSPREGS 56
92#endif
93
94#ifdef __KERNEL__
95#include <asm/addrspace.h>
96
97#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
98#define instruction_pointer(regs) ((unsigned long)(regs)->pc)
99
100extern void show_regs(struct pt_regs *);
101
102#ifdef CONFIG_SH_DSP
103#define task_pt_regs(task) \
104 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
105 - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
106#else
107#define task_pt_regs(task) \
108 ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
109 - sizeof(unsigned long)) - 1)
110#endif
111
112static inline unsigned long profile_pc(struct pt_regs *regs)
113{
114 unsigned long pc = instruction_pointer(regs);
115
116#ifdef P2SEG
117 if (pc >= P2SEG && pc < P3SEG)
118 pc -= 0x20000000;
119#endif
120
121 return pc;
122}
123#endif /* __KERNEL__ */
124
125#endif /* __ASM_SH_PTRACE_H */
diff --git a/include/asm-sh/rtc.h b/include/asm-sh/rtc.h
deleted file mode 100644
index ec45ba8e11d9..000000000000
--- a/include/asm-sh/rtc.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _ASM_RTC_H
2#define _ASM_RTC_H
3
4extern void (*board_time_init)(void);
5extern void (*rtc_sh_get_time)(struct timespec *);
6extern int (*rtc_sh_set_time)(const time_t);
7
8#define RTC_CAP_4_DIGIT_YEAR (1 << 0)
9
10struct sh_rtc_platform_info {
11 unsigned long capabilities;
12};
13
14#include <asm/cpu/rtc.h>
15
16#endif /* _ASM_RTC_H */
diff --git a/include/asm-sh/se.h b/include/asm-sh/se.h
deleted file mode 100644
index bd2596c014a9..000000000000
--- a/include/asm-sh/se.h
+++ /dev/null
@@ -1,82 +0,0 @@
1#ifndef __ASM_SH_HITACHI_SE_H
2#define __ASM_SH_HITACHI_SE_H
3
4/*
5 * linux/include/asm-sh/hitachi_se.h
6 *
7 * Copyright (C) 2000 Kazumoto Kojima
8 *
9 * Hitachi SolutionEngine support
10 */
11
12/* Box specific addresses. */
13
14#define PA_ROM 0x00000000 /* EPROM */
15#define PA_ROM_SIZE 0x00400000 /* EPROM size 4M byte */
16#define PA_FROM 0x01000000 /* EPROM */
17#define PA_FROM_SIZE 0x00400000 /* EPROM size 4M byte */
18#define PA_EXT1 0x04000000
19#define PA_EXT1_SIZE 0x04000000
20#define PA_EXT2 0x08000000
21#define PA_EXT2_SIZE 0x04000000
22#define PA_SDRAM 0x0c000000
23#define PA_SDRAM_SIZE 0x04000000
24
25#define PA_EXT4 0x12000000
26#define PA_EXT4_SIZE 0x02000000
27#define PA_EXT5 0x14000000
28#define PA_EXT5_SIZE 0x04000000
29#define PA_PCIC 0x18000000 /* MR-SHPC-01 PCMCIA */
30
31#define PA_83902 0xb0000000 /* DP83902A */
32#define PA_83902_IF 0xb0040000 /* DP83902A remote io port */
33#define PA_83902_RST 0xb0080000 /* DP83902A reset port */
34
35#define PA_SUPERIO 0xb0400000 /* SMC37C935A super io chip */
36#define PA_DIPSW0 0xb0800000 /* Dip switch 5,6 */
37#define PA_DIPSW1 0xb0800002 /* Dip switch 7,8 */
38#define PA_LED 0xb0c00000 /* LED */
39#if defined(CONFIG_CPU_SUBTYPE_SH7705)
40#define PA_BCR 0xb0e00000
41#else
42#define PA_BCR 0xb1400000 /* FPGA */
43#endif
44
45#define PA_MRSHPC 0xb83fffe0 /* MR-SHPC-01 PCMCIA controller */
46#define PA_MRSHPC_MW1 0xb8400000 /* MR-SHPC-01 memory window base */
47#define PA_MRSHPC_MW2 0xb8500000 /* MR-SHPC-01 attribute window base */
48#define PA_MRSHPC_IO 0xb8600000 /* MR-SHPC-01 I/O window base */
49#define MRSHPC_OPTION (PA_MRSHPC + 6)
50#define MRSHPC_CSR (PA_MRSHPC + 8)
51#define MRSHPC_ISR (PA_MRSHPC + 10)
52#define MRSHPC_ICR (PA_MRSHPC + 12)
53#define MRSHPC_CPWCR (PA_MRSHPC + 14)
54#define MRSHPC_MW0CR1 (PA_MRSHPC + 16)
55#define MRSHPC_MW1CR1 (PA_MRSHPC + 18)
56#define MRSHPC_IOWCR1 (PA_MRSHPC + 20)
57#define MRSHPC_MW0CR2 (PA_MRSHPC + 22)
58#define MRSHPC_MW1CR2 (PA_MRSHPC + 24)
59#define MRSHPC_IOWCR2 (PA_MRSHPC + 26)
60#define MRSHPC_CDCR (PA_MRSHPC + 28)
61#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30)
62
63#define BCR_ILCRA (PA_BCR + 0)
64#define BCR_ILCRB (PA_BCR + 2)
65#define BCR_ILCRC (PA_BCR + 4)
66#define BCR_ILCRD (PA_BCR + 6)
67#define BCR_ILCRE (PA_BCR + 8)
68#define BCR_ILCRF (PA_BCR + 10)
69#define BCR_ILCRG (PA_BCR + 12)
70
71#if defined(CONFIG_CPU_SUBTYPE_SH7705)
72#define IRQ_STNIC 12
73#define IRQ_CFCARD 14
74#else
75#define IRQ_STNIC 10
76#define IRQ_CFCARD 7
77#endif
78
79#define __IO_PREFIX se
80#include <asm/io_generic.h>
81
82#endif /* __ASM_SH_HITACHI_SE_H */
diff --git a/include/asm-sh/se7343.h b/include/asm-sh/se7343.h
deleted file mode 100644
index e7914a54aa96..000000000000
--- a/include/asm-sh/se7343.h
+++ /dev/null
@@ -1,82 +0,0 @@
1#ifndef __ASM_SH_HITACHI_SE7343_H
2#define __ASM_SH_HITACHI_SE7343_H
3
4/*
5 * include/asm-sh/se/se7343.h
6 *
7 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
8 *
9 * SH-Mobile SolutionEngine 7343 support
10 */
11
12/* Box specific addresses. */
13
14/* Area 0 */
15#define PA_ROM 0x00000000 /* EPROM */
16#define PA_ROM_SIZE 0x00400000 /* EPROM size 4M byte(Actually 2MB) */
17#define PA_FROM 0x00400000 /* Flash ROM */
18#define PA_FROM_SIZE 0x00400000 /* Flash size 4M byte */
19#define PA_SRAM 0x00800000 /* SRAM */
20#define PA_FROM_SIZE 0x00400000 /* SRAM size 4M byte */
21/* Area 1 */
22#define PA_EXT1 0x04000000
23#define PA_EXT1_SIZE 0x04000000
24/* Area 2 */
25#define PA_EXT2 0x08000000
26#define PA_EXT2_SIZE 0x04000000
27/* Area 3 */
28#define PA_SDRAM 0x0c000000
29#define PA_SDRAM_SIZE 0x04000000
30/* Area 4 */
31#define PA_PCIC 0x10000000 /* MR-SHPC-01 PCMCIA */
32#define PA_MRSHPC 0xb03fffe0 /* MR-SHPC-01 PCMCIA controller */
33#define PA_MRSHPC_MW1 0xb0400000 /* MR-SHPC-01 memory window base */
34#define PA_MRSHPC_MW2 0xb0500000 /* MR-SHPC-01 attribute window base */
35#define PA_MRSHPC_IO 0xb0600000 /* MR-SHPC-01 I/O window base */
36#define MRSHPC_OPTION (PA_MRSHPC + 6)
37#define MRSHPC_CSR (PA_MRSHPC + 8)
38#define MRSHPC_ISR (PA_MRSHPC + 10)
39#define MRSHPC_ICR (PA_MRSHPC + 12)
40#define MRSHPC_CPWCR (PA_MRSHPC + 14)
41#define MRSHPC_MW0CR1 (PA_MRSHPC + 16)
42#define MRSHPC_MW1CR1 (PA_MRSHPC + 18)
43#define MRSHPC_IOWCR1 (PA_MRSHPC + 20)
44#define MRSHPC_MW0CR2 (PA_MRSHPC + 22)
45#define MRSHPC_MW1CR2 (PA_MRSHPC + 24)
46#define MRSHPC_IOWCR2 (PA_MRSHPC + 26)
47#define MRSHPC_CDCR (PA_MRSHPC + 28)
48#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30)
49#define PA_LED 0xb0C00000 /* LED */
50#define LED_SHIFT 0
51#define PA_DIPSW 0xb0900000 /* Dip switch 31 */
52#define PA_CPLD_MODESET 0xb1400004 /* CPLD Mode set register */
53#define PA_CPLD_ST 0xb1400008 /* CPLD Interrupt status register */
54#define PA_CPLD_IMSK 0xb140000a /* CPLD Interrupt mask register */
55/* Area 5 */
56#define PA_EXT5 0x14000000
57#define PA_EXT5_SIZE 0x04000000
58/* Area 6 */
59#define PA_LCD1 0xb8000000
60#define PA_LCD2 0xb8800000
61
62#define __IO_PREFIX sh7343se
63#include <asm/io_generic.h>
64
65/* External Multiplexed interrupts */
66#define PC_IRQ0 OFFCHIP_IRQ_BASE
67#define PC_IRQ1 (PC_IRQ0 + 1)
68#define PC_IRQ2 (PC_IRQ1 + 1)
69#define PC_IRQ3 (PC_IRQ2 + 1)
70
71#define EXT_IRQ0 (PC_IRQ3 + 1)
72#define EXT_IRQ1 (EXT_IRQ0 + 1)
73#define EXT_IRQ2 (EXT_IRQ1 + 1)
74#define EXT_IRQ3 (EXT_IRQ2 + 1)
75
76#define USB_IRQ0 (EXT_IRQ3 + 1)
77#define USB_IRQ1 (USB_IRQ0 + 1)
78
79#define UART_IRQ0 (USB_IRQ1 + 1)
80#define UART_IRQ1 (UART_IRQ0 + 1)
81
82#endif /* __ASM_SH_HITACHI_SE7343_H */
diff --git a/include/asm-sh/se7722.h b/include/asm-sh/se7722.h
deleted file mode 100644
index 3690fe5857a4..000000000000
--- a/include/asm-sh/se7722.h
+++ /dev/null
@@ -1,116 +0,0 @@
1#ifndef __ASM_SH_SE7722_H
2#define __ASM_SH_SE7722_H
3
4/*
5 * linux/include/asm-sh/se7722.h
6 *
7 * Copyright (C) 2007 Nobuhiro Iwamatsu
8 *
9 * Hitachi UL SolutionEngine 7722 Support.
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 *
15 */
16#include <asm/addrspace.h>
17
18/* Box specific addresses. */
19#define SE_AREA0_WIDTH 4 /* Area0: 32bit */
20#define PA_ROM 0xa0000000 /* EPROM */
21#define PA_ROM_SIZE 0x00200000 /* EPROM size 2M byte */
22#define PA_FROM 0xa1000000 /* Flash-ROM */
23#define PA_FROM_SIZE 0x01000000 /* Flash-ROM size 16M byte */
24#define PA_EXT1 0xa4000000
25#define PA_EXT1_SIZE 0x04000000
26#define PA_SDRAM 0xaC000000 /* DDR-SDRAM(Area3) 64MB */
27#define PA_SDRAM_SIZE 0x04000000
28
29#define PA_EXT4 0xb0000000
30#define PA_EXT4_SIZE 0x04000000
31
32#define PA_PERIPHERAL 0xB0000000
33
34#define PA_PCIC PA_PERIPHERAL /* MR-SHPC-01 PCMCIA */
35#define PA_MRSHPC (PA_PERIPHERAL + 0x003fffe0) /* MR-SHPC-01 PCMCIA controller */
36#define PA_MRSHPC_MW1 (PA_PERIPHERAL + 0x00400000) /* MR-SHPC-01 memory window base */
37#define PA_MRSHPC_MW2 (PA_PERIPHERAL + 0x00500000) /* MR-SHPC-01 attribute window base */
38#define PA_MRSHPC_IO (PA_PERIPHERAL + 0x00600000) /* MR-SHPC-01 I/O window base */
39#define MRSHPC_OPTION (PA_MRSHPC + 6)
40#define MRSHPC_CSR (PA_MRSHPC + 8)
41#define MRSHPC_ISR (PA_MRSHPC + 10)
42#define MRSHPC_ICR (PA_MRSHPC + 12)
43#define MRSHPC_CPWCR (PA_MRSHPC + 14)
44#define MRSHPC_MW0CR1 (PA_MRSHPC + 16)
45#define MRSHPC_MW1CR1 (PA_MRSHPC + 18)
46#define MRSHPC_IOWCR1 (PA_MRSHPC + 20)
47#define MRSHPC_MW0CR2 (PA_MRSHPC + 22)
48#define MRSHPC_MW1CR2 (PA_MRSHPC + 24)
49#define MRSHPC_IOWCR2 (PA_MRSHPC + 26)
50#define MRSHPC_CDCR (PA_MRSHPC + 28)
51#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30)
52
53#define PA_LED (PA_PERIPHERAL + 0x00800000) /* 8bit LED */
54#define PA_FPGA (PA_PERIPHERAL + 0x01800000) /* FPGA base address */
55
56#define PA_LAN (PA_AREA6_IO + 0) /* SMC LAN91C111 */
57/* GPIO */
58#define MSTPCR0 0xA4150030UL
59#define MSTPCR1 0xA4150034UL
60#define MSTPCR2 0xA4150038UL
61
62#define FPGA_IN 0xb1840000UL
63#define FPGA_OUT 0xb1840004UL
64
65#define PORT_PECR 0xA4050108UL
66#define PORT_PJCR 0xA4050110UL
67#define PORT_PSELD 0xA4050154UL
68#define PORT_PSELB 0xA4050150UL
69
70#define PORT_PSELC 0xA4050152UL
71#define PORT_PKCR 0xA4050112UL
72#define PORT_PHCR 0xA405010EUL
73#define PORT_PLCR 0xA4050114UL
74#define PORT_PMCR 0xA4050116UL
75#define PORT_PRCR 0xA405011CUL
76#define PORT_PXCR 0xA4050148UL
77#define PORT_PSELA 0xA405014EUL
78#define PORT_PYCR 0xA405014AUL
79#define PORT_PZCR 0xA405014CUL
80#define PORT_HIZCRA 0xA4050158UL
81#define PORT_HIZCRC 0xA405015CUL
82
83/* IRQ */
84#define IRQ0_IRQ 32
85#define IRQ1_IRQ 33
86
87#define IRQ01_MODE 0xb1800000
88#define IRQ01_STS 0xb1800004
89#define IRQ01_MASK 0xb1800008
90
91/* Bits in IRQ01_* registers */
92
93#define SE7722_FPGA_IRQ_USB 0 /* IRQ0 */
94#define SE7722_FPGA_IRQ_SMC 1 /* IRQ0 */
95#define SE7722_FPGA_IRQ_MRSHPC0 2 /* IRQ1 */
96#define SE7722_FPGA_IRQ_MRSHPC1 3 /* IRQ1 */
97#define SE7722_FPGA_IRQ_MRSHPC2 4 /* IRQ1 */
98#define SE7722_FPGA_IRQ_MRSHPC3 5 /* IRQ1 */
99
100#define SE7722_FPGA_IRQ_NR 6
101#define SE7722_FPGA_IRQ_BASE 110
102
103#define MRSHPC_IRQ3 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC3)
104#define MRSHPC_IRQ2 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC2)
105#define MRSHPC_IRQ1 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC1)
106#define MRSHPC_IRQ0 (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_MRSHPC0)
107#define SMC_IRQ (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_SMC)
108#define USB_IRQ (SE7722_FPGA_IRQ_BASE + SE7722_FPGA_IRQ_USB)
109
110/* arch/sh/boards/se/7722/irq.c */
111void init_se7722_IRQ(void);
112
113#define __IO_PREFIX se7722
114#include <asm/io_generic.h>
115
116#endif /* __ASM_SH_SE7722_H */
diff --git a/include/asm-sh/segment.h b/include/asm-sh/segment.h
deleted file mode 100644
index e417eab4c7d7..000000000000
--- a/include/asm-sh/segment.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_SH_SEGMENT_H
2#define __ASM_SH_SEGMENT_H
3
4/* Only here because we have some old header files that expect it.. */
5
6#endif /* __ASM_SH_SEGMENT_H */
diff --git a/include/asm-sh/serial.h b/include/asm-sh/serial.h
deleted file mode 100644
index 21f6d330f189..000000000000
--- a/include/asm-sh/serial.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * include/asm-sh/serial.h
3 *
4 * Configuration details for 8250, 16450, 16550, etc. serial ports
5 */
6
7#ifndef _ASM_SERIAL_H
8#define _ASM_SERIAL_H
9
10#include <linux/kernel.h>
11
12/*
13 * This assumes you have a 1.8432 MHz clock for your UART.
14 *
15 * It'd be nice if someone built a serial card with a 24.576 MHz
16 * clock, since the 16550A is capable of handling a top speed of 1.5
17 * megabits/second; but this requires the faster clock.
18 */
19#define BASE_BAUD ( 1843200 / 16 )
20
21#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
22
23#ifdef CONFIG_HD64465
24#include <asm/hd64465.h>
25
26#define SERIAL_PORT_DFNS \
27 /* UART CLK PORT IRQ FLAGS */ \
28 { 0, BASE_BAUD, 0x3F8, HD64465_IRQ_UART, STD_COM_FLAGS } /* ttyS0 */
29
30#else
31
32#define SERIAL_PORT_DFNS
33
34#endif
35
36#endif /* _ASM_SERIAL_H */
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
deleted file mode 100644
index e65b6b822cb3..000000000000
--- a/include/asm-sh/system.h
+++ /dev/null
@@ -1,198 +0,0 @@
1#ifndef __ASM_SH_SYSTEM_H
2#define __ASM_SH_SYSTEM_H
3
4/*
5 * Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima
6 * Copyright (C) 2002 Paul Mundt
7 */
8
9#include <linux/irqflags.h>
10#include <linux/compiler.h>
11#include <linux/linkage.h>
12#include <asm/types.h>
13#include <asm/ptrace.h>
14
15#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */
16
17#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5)
18#define __icbi() \
19{ \
20 unsigned long __addr; \
21 __addr = 0xa8000000; \
22 __asm__ __volatile__( \
23 "icbi %0\n\t" \
24 : /* no output */ \
25 : "m" (__m(__addr))); \
26}
27#endif
28
29/*
30 * A brief note on ctrl_barrier(), the control register write barrier.
31 *
32 * Legacy SH cores typically require a sequence of 8 nops after
33 * modification of a control register in order for the changes to take
34 * effect. On newer cores (like the sh4a and sh5) this is accomplished
35 * with icbi.
36 *
37 * Also note that on sh4a in the icbi case we can forego a synco for the
38 * write barrier, as it's not necessary for control registers.
39 *
40 * Historically we have only done this type of barrier for the MMUCR, but
41 * it's also necessary for the CCR, so we make it generic here instead.
42 */
43#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5)
44#define mb() __asm__ __volatile__ ("synco": : :"memory")
45#define rmb() mb()
46#define wmb() __asm__ __volatile__ ("synco": : :"memory")
47#define ctrl_barrier() __icbi()
48#define read_barrier_depends() do { } while(0)
49#else
50#define mb() __asm__ __volatile__ ("": : :"memory")
51#define rmb() mb()
52#define wmb() __asm__ __volatile__ ("": : :"memory")
53#define ctrl_barrier() __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop")
54#define read_barrier_depends() do { } while(0)
55#endif
56
57#ifdef CONFIG_SMP
58#define smp_mb() mb()
59#define smp_rmb() rmb()
60#define smp_wmb() wmb()
61#define smp_read_barrier_depends() read_barrier_depends()
62#else
63#define smp_mb() barrier()
64#define smp_rmb() barrier()
65#define smp_wmb() barrier()
66#define smp_read_barrier_depends() do { } while(0)
67#endif
68
69#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
70
71#ifdef CONFIG_GUSA_RB
72#include <asm/cmpxchg-grb.h>
73#else
74#include <asm/cmpxchg-irq.h>
75#endif
76
77extern void __xchg_called_with_bad_pointer(void);
78
79#define __xchg(ptr, x, size) \
80({ \
81 unsigned long __xchg__res; \
82 volatile void *__xchg_ptr = (ptr); \
83 switch (size) { \
84 case 4: \
85 __xchg__res = xchg_u32(__xchg_ptr, x); \
86 break; \
87 case 1: \
88 __xchg__res = xchg_u8(__xchg_ptr, x); \
89 break; \
90 default: \
91 __xchg_called_with_bad_pointer(); \
92 __xchg__res = x; \
93 break; \
94 } \
95 \
96 __xchg__res; \
97})
98
99#define xchg(ptr,x) \
100 ((__typeof__(*(ptr)))__xchg((ptr),(unsigned long)(x), sizeof(*(ptr))))
101
102/* This function doesn't exist, so you'll get a linker error
103 * if something tries to do an invalid cmpxchg(). */
104extern void __cmpxchg_called_with_bad_pointer(void);
105
106#define __HAVE_ARCH_CMPXCHG 1
107
108static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
109 unsigned long new, int size)
110{
111 switch (size) {
112 case 4:
113 return __cmpxchg_u32(ptr, old, new);
114 }
115 __cmpxchg_called_with_bad_pointer();
116 return old;
117}
118
119#define cmpxchg(ptr,o,n) \
120 ({ \
121 __typeof__(*(ptr)) _o_ = (o); \
122 __typeof__(*(ptr)) _n_ = (n); \
123 (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
124 (unsigned long)_n_, sizeof(*(ptr))); \
125 })
126
127extern void die(const char *str, struct pt_regs *regs, long err) __attribute__ ((noreturn));
128
129extern void *set_exception_table_vec(unsigned int vec, void *handler);
130
131static inline void *set_exception_table_evt(unsigned int evt, void *handler)
132{
133 return set_exception_table_vec(evt >> 5, handler);
134}
135
136/*
137 * SH-2A has both 16 and 32-bit opcodes, do lame encoding checks.
138 */
139#ifdef CONFIG_CPU_SH2A
140extern unsigned int instruction_size(unsigned int insn);
141#elif defined(CONFIG_SUPERH32)
142#define instruction_size(insn) (2)
143#else
144#define instruction_size(insn) (4)
145#endif
146
147extern unsigned long cached_to_uncached;
148
149extern struct dentry *sh_debugfs_root;
150
151/* XXX
152 * disable hlt during certain critical i/o operations
153 */
154#define HAVE_DISABLE_HLT
155void disable_hlt(void);
156void enable_hlt(void);
157
158void default_idle(void);
159void per_cpu_trap_init(void);
160
161asmlinkage void break_point_trap(void);
162
163#ifdef CONFIG_SUPERH32
164#define BUILD_TRAP_HANDLER(name) \
165asmlinkage void name##_trap_handler(unsigned long r4, unsigned long r5, \
166 unsigned long r6, unsigned long r7, \
167 struct pt_regs __regs)
168
169#define TRAP_HANDLER_DECL \
170 struct pt_regs *regs = RELOC_HIDE(&__regs, 0); \
171 unsigned int vec = regs->tra; \
172 (void)vec;
173#else
174#define BUILD_TRAP_HANDLER(name) \
175asmlinkage void name##_trap_handler(unsigned int vec, struct pt_regs *regs)
176#define TRAP_HANDLER_DECL
177#endif
178
179BUILD_TRAP_HANDLER(address_error);
180BUILD_TRAP_HANDLER(debug);
181BUILD_TRAP_HANDLER(bug);
182BUILD_TRAP_HANDLER(fpu_error);
183BUILD_TRAP_HANDLER(fpu_state_restore);
184
185#define arch_align_stack(x) (x)
186
187struct mem_access {
188 unsigned long (*from)(void *dst, const void *src, unsigned long cnt);
189 unsigned long (*to)(void *dst, const void *src, unsigned long cnt);
190};
191
192#ifdef CONFIG_SUPERH32
193# include "system_32.h"
194#else
195# include "system_64.h"
196#endif
197
198#endif
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
deleted file mode 100644
index 5131e3907525..000000000000
--- a/include/asm-sh/thread_info.h
+++ /dev/null
@@ -1,139 +0,0 @@
1#ifndef __ASM_SH_THREAD_INFO_H
2#define __ASM_SH_THREAD_INFO_H
3
4/* SuperH version
5 * Copyright (C) 2002 Niibe Yutaka
6 *
7 * The copyright of original i386 version is:
8 *
9 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
10 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
11 */
12#ifdef __KERNEL__
13#include <asm/page.h>
14
15#ifndef __ASSEMBLY__
16#include <asm/processor.h>
17
18struct thread_info {
19 struct task_struct *task; /* main task structure */
20 struct exec_domain *exec_domain; /* execution domain */
21 unsigned long flags; /* low level flags */
22 __u32 cpu;
23 int preempt_count; /* 0 => preemptable, <0 => BUG */
24 mm_segment_t addr_limit; /* thread address space */
25 struct restart_block restart_block;
26 unsigned long previous_sp; /* sp of previous stack in case
27 of nested IRQ stacks */
28 __u8 supervisor_stack[0];
29};
30
31#endif
32
33#define PREEMPT_ACTIVE 0x10000000
34
35#if defined(CONFIG_4KSTACKS)
36#define THREAD_SIZE_ORDER (0)
37#elif defined(CONFIG_PAGE_SIZE_4KB)
38#define THREAD_SIZE_ORDER (1)
39#elif defined(CONFIG_PAGE_SIZE_8KB)
40#define THREAD_SIZE_ORDER (1)
41#elif defined(CONFIG_PAGE_SIZE_64KB)
42#define THREAD_SIZE_ORDER (0)
43#else
44#error "Unknown thread size"
45#endif
46
47#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
48#define STACK_WARN (THREAD_SIZE >> 3)
49
50/*
51 * macros/functions for gaining access to the thread information structure
52 */
53#ifndef __ASSEMBLY__
54#define INIT_THREAD_INFO(tsk) \
55{ \
56 .task = &tsk, \
57 .exec_domain = &default_exec_domain, \
58 .flags = 0, \
59 .cpu = 0, \
60 .preempt_count = 1, \
61 .addr_limit = KERNEL_DS, \
62 .restart_block = { \
63 .fn = do_no_restart_syscall, \
64 }, \
65}
66
67#define init_thread_info (init_thread_union.thread_info)
68#define init_stack (init_thread_union.stack)
69
70/* how to get the current stack pointer from C */
71register unsigned long current_stack_pointer asm("r15") __used;
72
73/* how to get the thread information struct from C */
74static inline struct thread_info *current_thread_info(void)
75{
76 struct thread_info *ti;
77#if defined(CONFIG_SUPERH64)
78 __asm__ __volatile__ ("getcon cr17, %0" : "=r" (ti));
79#elif defined(CONFIG_CPU_HAS_SR_RB)
80 __asm__ __volatile__ ("stc r7_bank, %0" : "=r" (ti));
81#else
82 unsigned long __dummy;
83
84 __asm__ __volatile__ (
85 "mov r15, %0\n\t"
86 "and %1, %0\n\t"
87 : "=&r" (ti), "=r" (__dummy)
88 : "1" (~(THREAD_SIZE - 1))
89 : "memory");
90#endif
91
92 return ti;
93}
94
95#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
96
97/* thread information allocation */
98#ifdef CONFIG_DEBUG_STACK_USAGE
99#define alloc_thread_info(ti) kzalloc(THREAD_SIZE, GFP_KERNEL)
100#else
101#define alloc_thread_info(ti) kmalloc(THREAD_SIZE, GFP_KERNEL)
102#endif
103#define free_thread_info(ti) kfree(ti)
104
105#endif /* __ASSEMBLY__ */
106
107/*
108 * thread information flags
109 * - these are process state flags that various assembly files may need to access
110 * - pending work-to-be-done flags are in LSW
111 * - other flags in MSW
112 */
113#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
114#define TIF_SIGPENDING 1 /* signal pending */
115#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
116#define TIF_RESTORE_SIGMASK 3 /* restore signal mask in do_signal() */
117#define TIF_SINGLESTEP 4 /* singlestepping active */
118#define TIF_SYSCALL_AUDIT 5
119#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
120#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
121#define TIF_MEMDIE 18
122#define TIF_FREEZE 19
123
124#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
125#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
126#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
127#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
128#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
129#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
130#define _TIF_USEDFPU (1<<TIF_USEDFPU)
131#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
132#define _TIF_FREEZE (1<<TIF_FREEZE)
133
134#define _TIF_WORK_MASK 0x000000FE /* work to do on interrupt/exception return */
135#define _TIF_ALLWORK_MASK 0x000000FF /* work to do on any return to u-space */
136
137#endif /* __KERNEL__ */
138
139#endif /* __ASM_SH_THREAD_INFO_H */
diff --git a/include/asm-sh/timer.h b/include/asm-sh/timer.h
deleted file mode 100644
index 701ba84c7049..000000000000
--- a/include/asm-sh/timer.h
+++ /dev/null
@@ -1,45 +0,0 @@
1#ifndef __ASM_SH_TIMER_H
2#define __ASM_SH_TIMER_H
3
4#include <linux/sysdev.h>
5#include <linux/clocksource.h>
6#include <asm/cpu/timer.h>
7
8struct sys_timer_ops {
9 int (*init)(void);
10 int (*start)(void);
11 int (*stop)(void);
12 cycle_t (*read)(void);
13#ifndef CONFIG_GENERIC_TIME
14 unsigned long (*get_offset)(void);
15#endif
16};
17
18struct sys_timer {
19 const char *name;
20
21 struct sys_device dev;
22 struct sys_timer_ops *ops;
23};
24
25#define TICK_SIZE (tick_nsec / 1000)
26
27extern struct sys_timer tmu_timer, cmt_timer, mtu2_timer;
28extern struct sys_timer *sys_timer;
29
30#ifndef CONFIG_GENERIC_TIME
31static inline unsigned long get_timer_offset(void)
32{
33 return sys_timer->ops->get_offset();
34}
35#endif
36
37/* arch/sh/kernel/timers/timer.c */
38struct sys_timer *get_sys_timer(void);
39
40/* arch/sh/kernel/time.c */
41void handle_timer_tick(void);
42extern unsigned long sh_hpt_frequency;
43extern struct clocksource clocksource_sh;
44
45#endif /* __ASM_SH_TIMER_H */
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h
deleted file mode 100644
index b3440c305b5d..000000000000
--- a/include/asm-sh/uaccess.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef __ASM_SH_UACCESS_H
2#define __ASM_SH_UACCESS_H
3
4#ifdef CONFIG_SUPERH32
5# include "uaccess_32.h"
6#else
7# include "uaccess_64.h"
8#endif
9
10static inline unsigned long
11copy_from_user(void *to, const void __user *from, unsigned long n)
12{
13 unsigned long __copy_from = (unsigned long) from;
14 __kernel_size_t __copy_size = (__kernel_size_t) n;
15
16 if (__copy_size && __access_ok(__copy_from, __copy_size))
17 return __copy_user(to, from, __copy_size);
18
19 return __copy_size;
20}
21
22static inline unsigned long
23copy_to_user(void __user *to, const void *from, unsigned long n)
24{
25 unsigned long __copy_to = (unsigned long) to;
26 __kernel_size_t __copy_size = (__kernel_size_t) n;
27
28 if (__copy_size && __access_ok(__copy_to, __copy_size))
29 return __copy_user(to, from, __copy_size);
30
31 return __copy_size;
32}
33
34#endif /* __ASM_SH_UACCESS_H */
diff --git a/include/asm-sh/uaccess_32.h b/include/asm-sh/uaccess_32.h
deleted file mode 100644
index 1e41fda74bd3..000000000000
--- a/include/asm-sh/uaccess_32.h
+++ /dev/null
@@ -1,489 +0,0 @@
1/* $Id: uaccess.h,v 1.11 2003/10/13 07:21:20 lethal Exp $
2 *
3 * User space memory access functions
4 *
5 * Copyright (C) 1999, 2002 Niibe Yutaka
6 * Copyright (C) 2003 Paul Mundt
7 *
8 * Based on:
9 * MIPS implementation version 1.15 by
10 * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
11 * and i386 version.
12 */
13#ifndef __ASM_SH_UACCESS_32_H
14#define __ASM_SH_UACCESS_32_H
15
16#include <linux/errno.h>
17#include <linux/sched.h>
18
19#define VERIFY_READ 0
20#define VERIFY_WRITE 1
21
22/*
23 * The fs value determines whether argument validity checking should be
24 * performed or not. If get_fs() == USER_DS, checking is performed, with
25 * get_fs() == KERNEL_DS, checking is bypassed.
26 *
27 * For historical reasons (Data Segment Register?), these macros are misnamed.
28 */
29
30#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
31
32#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFFUL)
33#define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
34
35#define segment_eq(a,b) ((a).seg == (b).seg)
36
37#define get_ds() (KERNEL_DS)
38
39#if !defined(CONFIG_MMU)
40/* NOMMU is always true */
41#define __addr_ok(addr) (1)
42
43static inline mm_segment_t get_fs(void)
44{
45 return USER_DS;
46}
47
48static inline void set_fs(mm_segment_t s)
49{
50}
51
52/*
53 * __access_ok: Check if address with size is OK or not.
54 *
55 * If we don't have an MMU (or if its disabled) the only thing we really have
56 * to look out for is if the address resides somewhere outside of what
57 * available RAM we have.
58 */
59static inline int __access_ok(unsigned long addr, unsigned long size)
60{
61 return 1;
62}
63#else /* CONFIG_MMU */
64#define __addr_ok(addr) \
65 ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
66
67#define get_fs() (current_thread_info()->addr_limit)
68#define set_fs(x) (current_thread_info()->addr_limit = (x))
69
70/*
71 * __access_ok: Check if address with size is OK or not.
72 *
73 * Uhhuh, this needs 33-bit arithmetic. We have a carry..
74 *
75 * sum := addr + size; carry? --> flag = true;
76 * if (sum >= addr_limit) flag = true;
77 */
78static inline int __access_ok(unsigned long addr, unsigned long size)
79{
80 unsigned long flag, sum;
81
82 __asm__("clrt\n\t"
83 "addc %3, %1\n\t"
84 "movt %0\n\t"
85 "cmp/hi %4, %1\n\t"
86 "rotcl %0"
87 :"=&r" (flag), "=r" (sum)
88 :"1" (addr), "r" (size),
89 "r" (current_thread_info()->addr_limit.seg)
90 :"t");
91 return flag == 0;
92}
93#endif /* CONFIG_MMU */
94
95#define access_ok(type, addr, size) \
96 (__chk_user_ptr(addr), \
97 __access_ok((unsigned long __force)(addr), (size)))
98
99/*
100 * Uh, these should become the main single-value transfer routines ...
101 * They automatically use the right size if we just have the right
102 * pointer type ...
103 *
104 * As SuperH uses the same address space for kernel and user data, we
105 * can just do these as direct assignments.
106 *
107 * Careful to not
108 * (a) re-use the arguments for side effects (sizeof is ok)
109 * (b) require any knowledge of processes at this stage
110 */
111#define put_user(x,ptr) __put_user_check((x), (ptr), sizeof(*(ptr)))
112#define get_user(x,ptr) __get_user_check((x), (ptr), sizeof(*(ptr)))
113
114/*
115 * The "__xxx" versions do not do address space checking, useful when
116 * doing multiple accesses to the same area (the user has to do the
117 * checks by hand with "access_ok()")
118 */
119#define __put_user(x,ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
120#define __get_user(x,ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
121
122struct __large_struct { unsigned long buf[100]; };
123#define __m(x) (*(struct __large_struct __user *)(x))
124
125#define __get_user_size(x,ptr,size,retval) \
126do { \
127 retval = 0; \
128 switch (size) { \
129 case 1: \
130 __get_user_asm(x, ptr, retval, "b"); \
131 break; \
132 case 2: \
133 __get_user_asm(x, ptr, retval, "w"); \
134 break; \
135 case 4: \
136 __get_user_asm(x, ptr, retval, "l"); \
137 break; \
138 default: \
139 __get_user_unknown(); \
140 break; \
141 } \
142} while (0)
143
144#define __get_user_nocheck(x,ptr,size) \
145({ \
146 long __gu_err; \
147 unsigned long __gu_val; \
148 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
149 __chk_user_ptr(ptr); \
150 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
151 (x) = (__typeof__(*(ptr)))__gu_val; \
152 __gu_err; \
153})
154
155#define __get_user_check(x,ptr,size) \
156({ \
157 long __gu_err = -EFAULT; \
158 unsigned long __gu_val = 0; \
159 const __typeof__(*(ptr)) *__gu_addr = (ptr); \
160 if (likely(access_ok(VERIFY_READ, __gu_addr, (size)))) \
161 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
162 (x) = (__typeof__(*(ptr)))__gu_val; \
163 __gu_err; \
164})
165
166#define __get_user_asm(x, addr, err, insn) \
167({ \
168__asm__ __volatile__( \
169 "1:\n\t" \
170 "mov." insn " %2, %1\n\t" \
171 "2:\n" \
172 ".section .fixup,\"ax\"\n" \
173 "3:\n\t" \
174 "mov #0, %1\n\t" \
175 "mov.l 4f, %0\n\t" \
176 "jmp @%0\n\t" \
177 " mov %3, %0\n\t" \
178 ".balign 4\n" \
179 "4: .long 2b\n\t" \
180 ".previous\n" \
181 ".section __ex_table,\"a\"\n\t" \
182 ".long 1b, 3b\n\t" \
183 ".previous" \
184 :"=&r" (err), "=&r" (x) \
185 :"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
186
187extern void __get_user_unknown(void);
188
189#define __put_user_size(x,ptr,size,retval) \
190do { \
191 retval = 0; \
192 switch (size) { \
193 case 1: \
194 __put_user_asm(x, ptr, retval, "b"); \
195 break; \
196 case 2: \
197 __put_user_asm(x, ptr, retval, "w"); \
198 break; \
199 case 4: \
200 __put_user_asm(x, ptr, retval, "l"); \
201 break; \
202 case 8: \
203 __put_user_u64(x, ptr, retval); \
204 break; \
205 default: \
206 __put_user_unknown(); \
207 } \
208} while (0)
209
210#define __put_user_nocheck(x,ptr,size) \
211({ \
212 long __pu_err; \
213 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
214 __chk_user_ptr(ptr); \
215 __put_user_size((x), __pu_addr, (size), __pu_err); \
216 __pu_err; \
217})
218
219#define __put_user_check(x,ptr,size) \
220({ \
221 long __pu_err = -EFAULT; \
222 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
223 if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) \
224 __put_user_size((x), __pu_addr, (size), \
225 __pu_err); \
226 __pu_err; \
227})
228
229#define __put_user_asm(x, addr, err, insn) \
230({ \
231__asm__ __volatile__( \
232 "1:\n\t" \
233 "mov." insn " %1, %2\n\t" \
234 "2:\n" \
235 ".section .fixup,\"ax\"\n" \
236 "3:\n\t" \
237 "mov.l 4f, %0\n\t" \
238 "jmp @%0\n\t" \
239 " mov %3, %0\n\t" \
240 ".balign 4\n" \
241 "4: .long 2b\n\t" \
242 ".previous\n" \
243 ".section __ex_table,\"a\"\n\t" \
244 ".long 1b, 3b\n\t" \
245 ".previous" \
246 :"=&r" (err) \
247 :"r" (x), "m" (__m(addr)), "i" (-EFAULT), "0" (err) \
248 :"memory"); })
249
250#if defined(CONFIG_CPU_LITTLE_ENDIAN)
251#define __put_user_u64(val,addr,retval) \
252({ \
253__asm__ __volatile__( \
254 "1:\n\t" \
255 "mov.l %R1,%2\n\t" \
256 "mov.l %S1,%T2\n\t" \
257 "2:\n" \
258 ".section .fixup,\"ax\"\n" \
259 "3:\n\t" \
260 "mov.l 4f,%0\n\t" \
261 "jmp @%0\n\t" \
262 " mov %3,%0\n\t" \
263 ".balign 4\n" \
264 "4: .long 2b\n\t" \
265 ".previous\n" \
266 ".section __ex_table,\"a\"\n\t" \
267 ".long 1b, 3b\n\t" \
268 ".previous" \
269 : "=r" (retval) \
270 : "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
271 : "memory"); })
272#else
273#define __put_user_u64(val,addr,retval) \
274({ \
275__asm__ __volatile__( \
276 "1:\n\t" \
277 "mov.l %S1,%2\n\t" \
278 "mov.l %R1,%T2\n\t" \
279 "2:\n" \
280 ".section .fixup,\"ax\"\n" \
281 "3:\n\t" \
282 "mov.l 4f,%0\n\t" \
283 "jmp @%0\n\t" \
284 " mov %3,%0\n\t" \
285 ".balign 4\n" \
286 "4: .long 2b\n\t" \
287 ".previous\n" \
288 ".section __ex_table,\"a\"\n\t" \
289 ".long 1b, 3b\n\t" \
290 ".previous" \
291 : "=r" (retval) \
292 : "r" (val), "m" (__m(addr)), "i" (-EFAULT), "0" (retval) \
293 : "memory"); })
294#endif
295
296extern void __put_user_unknown(void);
297
298/* Generic arbitrary sized copy. */
299/* Return the number of bytes NOT copied */
300__kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n);
301
302
303static __always_inline unsigned long
304__copy_from_user(void *to, const void __user *from, unsigned long n)
305{
306 return __copy_user(to, (__force void *)from, n);
307}
308
309static __always_inline unsigned long __must_check
310__copy_to_user(void __user *to, const void *from, unsigned long n)
311{
312 return __copy_user((__force void *)to, from, n);
313}
314
315#define __copy_to_user_inatomic __copy_to_user
316#define __copy_from_user_inatomic __copy_from_user
317
318/*
319 * Clear the area and return remaining number of bytes
320 * (on failure. Usually it's 0.)
321 */
322extern __kernel_size_t __clear_user(void *addr, __kernel_size_t size);
323
324#define clear_user(addr,n) ({ \
325void * __cl_addr = (addr); \
326unsigned long __cl_size = (n); \
327if (__cl_size && __access_ok(((unsigned long)(__cl_addr)), __cl_size)) \
328__cl_size = __clear_user(__cl_addr, __cl_size); \
329__cl_size; })
330
331static __inline__ int
332__strncpy_from_user(unsigned long __dest, unsigned long __user __src, int __count)
333{
334 __kernel_size_t res;
335 unsigned long __dummy, _d, _s, _c;
336
337 __asm__ __volatile__(
338 "9:\n"
339 "mov.b @%2+, %1\n\t"
340 "cmp/eq #0, %1\n\t"
341 "bt/s 2f\n"
342 "1:\n"
343 "mov.b %1, @%3\n\t"
344 "dt %4\n\t"
345 "bf/s 9b\n\t"
346 " add #1, %3\n\t"
347 "2:\n\t"
348 "sub %4, %0\n"
349 "3:\n"
350 ".section .fixup,\"ax\"\n"
351 "4:\n\t"
352 "mov.l 5f, %1\n\t"
353 "jmp @%1\n\t"
354 " mov %9, %0\n\t"
355 ".balign 4\n"
356 "5: .long 3b\n"
357 ".previous\n"
358 ".section __ex_table,\"a\"\n"
359 " .balign 4\n"
360 " .long 9b,4b\n"
361 ".previous"
362 : "=r" (res), "=&z" (__dummy), "=r" (_s), "=r" (_d), "=r"(_c)
363 : "0" (__count), "2" (__src), "3" (__dest), "4" (__count),
364 "i" (-EFAULT)
365 : "memory", "t");
366
367 return res;
368}
369
370/**
371 * strncpy_from_user: - Copy a NUL terminated string from userspace.
372 * @dst: Destination address, in kernel space. This buffer must be at
373 * least @count bytes long.
374 * @src: Source address, in user space.
375 * @count: Maximum number of bytes to copy, including the trailing NUL.
376 *
377 * Copies a NUL-terminated string from userspace to kernel space.
378 *
379 * On success, returns the length of the string (not including the trailing
380 * NUL).
381 *
382 * If access to userspace fails, returns -EFAULT (some data may have been
383 * copied).
384 *
385 * If @count is smaller than the length of the string, copies @count bytes
386 * and returns @count.
387 */
388#define strncpy_from_user(dest,src,count) ({ \
389unsigned long __sfu_src = (unsigned long) (src); \
390int __sfu_count = (int) (count); \
391long __sfu_res = -EFAULT; \
392if(__access_ok(__sfu_src, __sfu_count)) { \
393__sfu_res = __strncpy_from_user((unsigned long) (dest), __sfu_src, __sfu_count); \
394} __sfu_res; })
395
396/*
397 * Return the size of a string (including the ending 0 even when we have
398 * exceeded the maximum string length).
399 */
400static __inline__ long __strnlen_user(const char __user *__s, long __n)
401{
402 unsigned long res;
403 unsigned long __dummy;
404
405 __asm__ __volatile__(
406 "1:\t"
407 "mov.b @(%0,%3), %1\n\t"
408 "cmp/eq %4, %0\n\t"
409 "bt/s 2f\n\t"
410 " add #1, %0\n\t"
411 "tst %1, %1\n\t"
412 "bf 1b\n\t"
413 "2:\n"
414 ".section .fixup,\"ax\"\n"
415 "3:\n\t"
416 "mov.l 4f, %1\n\t"
417 "jmp @%1\n\t"
418 " mov #0, %0\n"
419 ".balign 4\n"
420 "4: .long 2b\n"
421 ".previous\n"
422 ".section __ex_table,\"a\"\n"
423 " .balign 4\n"
424 " .long 1b,3b\n"
425 ".previous"
426 : "=z" (res), "=&r" (__dummy)
427 : "0" (0), "r" (__s), "r" (__n)
428 : "t");
429 return res;
430}
431
432/**
433 * strnlen_user: - Get the size of a string in user space.
434 * @s: The string to measure.
435 * @n: The maximum valid length
436 *
437 * Context: User context only. This function may sleep.
438 *
439 * Get the size of a NUL-terminated string in user space.
440 *
441 * Returns the size of the string INCLUDING the terminating NUL.
442 * On exception, returns 0.
443 * If the string is too long, returns a value greater than @n.
444 */
445static __inline__ long strnlen_user(const char __user *s, long n)
446{
447 if (!__addr_ok(s))
448 return 0;
449 else
450 return __strnlen_user(s, n);
451}
452
453/**
454 * strlen_user: - Get the size of a string in user space.
455 * @str: The string to measure.
456 *
457 * Context: User context only. This function may sleep.
458 *
459 * Get the size of a NUL-terminated string in user space.
460 *
461 * Returns the size of the string INCLUDING the terminating NUL.
462 * On exception, returns 0.
463 *
464 * If there is a limit on the length of a valid string, you may wish to
465 * consider using strnlen_user() instead.
466 */
467#define strlen_user(str) strnlen_user(str, ~0UL >> 1)
468
469/*
470 * The exception table consists of pairs of addresses: the first is the
471 * address of an instruction that is allowed to fault, and the second is
472 * the address at which the program should continue. No registers are
473 * modified, so it is entirely up to the continuation code to figure out
474 * what to do.
475 *
476 * All the routines below use bits of fixup code that are out of line
477 * with the main instruction path. This means when everything is well,
478 * we don't even have to jump over them. Further, they do not intrude
479 * on our cache or tlb entries.
480 */
481
482struct exception_table_entry
483{
484 unsigned long insn, fixup;
485};
486
487extern int fixup_exception(struct pt_regs *regs);
488
489#endif /* __ASM_SH_UACCESS_32_H */
diff --git a/include/asm-sh/uaccess_64.h b/include/asm-sh/uaccess_64.h
deleted file mode 100644
index a9b68d094844..000000000000
--- a/include/asm-sh/uaccess_64.h
+++ /dev/null
@@ -1,285 +0,0 @@
1#ifndef __ASM_SH_UACCESS_64_H
2#define __ASM_SH_UACCESS_64_H
3
4/*
5 * include/asm-sh/uaccess_64.h
6 *
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 * Copyright (C) 2003, 2004 Paul Mundt
9 *
10 * User space memory access functions
11 *
12 * Copyright (C) 1999 Niibe Yutaka
13 *
14 * Based on:
15 * MIPS implementation version 1.15 by
16 * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
17 * and i386 version.
18 *
19 * This file is subject to the terms and conditions of the GNU General Public
20 * License. See the file "COPYING" in the main directory of this archive
21 * for more details.
22 */
23#include <linux/errno.h>
24#include <linux/sched.h>
25
26#define VERIFY_READ 0
27#define VERIFY_WRITE 1
28
29/*
30 * The fs value determines whether argument validity checking should be
31 * performed or not. If get_fs() == USER_DS, checking is performed, with
32 * get_fs() == KERNEL_DS, checking is bypassed.
33 *
34 * For historical reasons (Data Segment Register?), these macros are misnamed.
35 */
36
37#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
38
39#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
40#define USER_DS MAKE_MM_SEG(0x80000000)
41
42#define get_ds() (KERNEL_DS)
43#define get_fs() (current_thread_info()->addr_limit)
44#define set_fs(x) (current_thread_info()->addr_limit=(x))
45
46#define segment_eq(a,b) ((a).seg == (b).seg)
47
48#define __addr_ok(addr) ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
49
50/*
51 * Uhhuh, this needs 33-bit arithmetic. We have a carry..
52 *
53 * sum := addr + size; carry? --> flag = true;
54 * if (sum >= addr_limit) flag = true;
55 */
56#define __range_ok(addr,size) (((unsigned long) (addr) + (size) < (current_thread_info()->addr_limit.seg)) ? 0 : 1)
57
58#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
59#define __access_ok(addr,size) (__range_ok(addr,size) == 0)
60
61/*
62 * Uh, these should become the main single-value transfer routines ...
63 * They automatically use the right size if we just have the right
64 * pointer type ...
65 *
66 * As MIPS uses the same address space for kernel and user data, we
67 * can just do these as direct assignments.
68 *
69 * Careful to not
70 * (a) re-use the arguments for side effects (sizeof is ok)
71 * (b) require any knowledge of processes at this stage
72 */
73#define put_user(x,ptr) __put_user_check((x),(ptr),sizeof(*(ptr)))
74#define get_user(x,ptr) __get_user_check((x),(ptr),sizeof(*(ptr)))
75
76/*
77 * The "__xxx" versions do not do address space checking, useful when
78 * doing multiple accesses to the same area (the user has to do the
79 * checks by hand with "access_ok()")
80 */
81#define __put_user(x,ptr) __put_user_nocheck((x),(ptr),sizeof(*(ptr)))
82#define __get_user(x,ptr) __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
83
84/*
85 * The "xxx_ret" versions return constant specified in third argument, if
86 * something bad happens. These macros can be optimized for the
87 * case of just returning from the function xxx_ret is used.
88 */
89
90#define put_user_ret(x,ptr,ret) ({ \
91if (put_user(x,ptr)) return ret; })
92
93#define get_user_ret(x,ptr,ret) ({ \
94if (get_user(x,ptr)) return ret; })
95
96#define __put_user_ret(x,ptr,ret) ({ \
97if (__put_user(x,ptr)) return ret; })
98
99#define __get_user_ret(x,ptr,ret) ({ \
100if (__get_user(x,ptr)) return ret; })
101
102struct __large_struct { unsigned long buf[100]; };
103#define __m(x) (*(struct __large_struct *)(x))
104
105#define __get_user_size(x,ptr,size,retval) \
106do { \
107 retval = 0; \
108 switch (size) { \
109 case 1: \
110 retval = __get_user_asm_b(x, ptr); \
111 break; \
112 case 2: \
113 retval = __get_user_asm_w(x, ptr); \
114 break; \
115 case 4: \
116 retval = __get_user_asm_l(x, ptr); \
117 break; \
118 case 8: \
119 retval = __get_user_asm_q(x, ptr); \
120 break; \
121 default: \
122 __get_user_unknown(); \
123 break; \
124 } \
125} while (0)
126
127#define __get_user_nocheck(x,ptr,size) \
128({ \
129 long __gu_err, __gu_val; \
130 __get_user_size((void *)&__gu_val, (long)(ptr), \
131 (size), __gu_err); \
132 (x) = (__typeof__(*(ptr)))__gu_val; \
133 __gu_err; \
134})
135
136#define __get_user_check(x,ptr,size) \
137({ \
138 long __gu_addr = (long)(ptr); \
139 long __gu_err = -EFAULT, __gu_val; \
140 if (__access_ok(__gu_addr, (size))) \
141 __get_user_size((void *)&__gu_val, __gu_addr, \
142 (size), __gu_err); \
143 (x) = (__typeof__(*(ptr))) __gu_val; \
144 __gu_err; \
145})
146
147extern long __get_user_asm_b(void *, long);
148extern long __get_user_asm_w(void *, long);
149extern long __get_user_asm_l(void *, long);
150extern long __get_user_asm_q(void *, long);
151extern void __get_user_unknown(void);
152
153#define __put_user_size(x,ptr,size,retval) \
154do { \
155 retval = 0; \
156 switch (size) { \
157 case 1: \
158 retval = __put_user_asm_b(x, ptr); \
159 break; \
160 case 2: \
161 retval = __put_user_asm_w(x, ptr); \
162 break; \
163 case 4: \
164 retval = __put_user_asm_l(x, ptr); \
165 break; \
166 case 8: \
167 retval = __put_user_asm_q(x, ptr); \
168 break; \
169 default: \
170 __put_user_unknown(); \
171 } \
172} while (0)
173
174#define __put_user_nocheck(x,ptr,size) \
175({ \
176 long __pu_err; \
177 __typeof__(*(ptr)) __pu_val = (x); \
178 __put_user_size((void *)&__pu_val, (long)(ptr), (size), __pu_err); \
179 __pu_err; \
180})
181
182#define __put_user_check(x,ptr,size) \
183({ \
184 long __pu_err = -EFAULT; \
185 long __pu_addr = (long)(ptr); \
186 __typeof__(*(ptr)) __pu_val = (x); \
187 \
188 if (__access_ok(__pu_addr, (size))) \
189 __put_user_size((void *)&__pu_val, __pu_addr, (size), __pu_err);\
190 __pu_err; \
191})
192
193extern long __put_user_asm_b(void *, long);
194extern long __put_user_asm_w(void *, long);
195extern long __put_user_asm_l(void *, long);
196extern long __put_user_asm_q(void *, long);
197extern void __put_user_unknown(void);
198
199
200/* Generic arbitrary sized copy. */
201/* Return the number of bytes NOT copied */
202/* XXX: should be such that: 4byte and the rest. */
203extern __kernel_size_t __copy_user(void *__to, const void *__from, __kernel_size_t __n);
204
205#define copy_to_user_ret(to,from,n,retval) ({ \
206if (copy_to_user(to,from,n)) \
207 return retval; \
208})
209
210#define __copy_to_user(to,from,n) \
211 __copy_user((void *)(to), \
212 (void *)(from), n)
213
214#define __copy_to_user_ret(to,from,n,retval) ({ \
215if (__copy_to_user(to,from,n)) \
216 return retval; \
217})
218
219#define copy_from_user_ret(to,from,n,retval) ({ \
220if (copy_from_user(to,from,n)) \
221 return retval; \
222})
223
224#define __copy_from_user(to,from,n) \
225 __copy_user((void *)(to), \
226 (void *)(from), n)
227
228#define __copy_from_user_ret(to,from,n,retval) ({ \
229if (__copy_from_user(to,from,n)) \
230 return retval; \
231})
232
233#define __copy_to_user_inatomic __copy_to_user
234#define __copy_from_user_inatomic __copy_from_user
235
236/* XXX: Not sure it works well..
237 should be such that: 4byte clear and the rest. */
238extern __kernel_size_t __clear_user(void *addr, __kernel_size_t size);
239
240#define clear_user(addr,n) ({ \
241void * __cl_addr = (addr); \
242unsigned long __cl_size = (n); \
243if (__cl_size && __access_ok(((unsigned long)(__cl_addr)), __cl_size)) \
244__cl_size = __clear_user(__cl_addr, __cl_size); \
245__cl_size; })
246
247extern int __strncpy_from_user(unsigned long __dest, unsigned long __src, int __count);
248
249#define strncpy_from_user(dest,src,count) ({ \
250unsigned long __sfu_src = (unsigned long) (src); \
251int __sfu_count = (int) (count); \
252long __sfu_res = -EFAULT; \
253if(__access_ok(__sfu_src, __sfu_count)) { \
254__sfu_res = __strncpy_from_user((unsigned long) (dest), __sfu_src, __sfu_count); \
255} __sfu_res; })
256
257#define strlen_user(str) strnlen_user(str, ~0UL >> 1)
258
259/*
260 * Return the size of a string (including the ending 0!)
261 */
262extern long __strnlen_user(const char *__s, long __n);
263
264static inline long strnlen_user(const char *s, long n)
265{
266 if (!__addr_ok(s))
267 return 0;
268 else
269 return __strnlen_user(s, n);
270}
271
272struct exception_table_entry
273{
274 unsigned long insn, fixup;
275};
276
277#ifdef CONFIG_MMU
278#define ARCH_HAS_SEARCH_EXTABLE
279#endif
280
281/* Returns 0 if exception not found and fixup.unit otherwise. */
282extern unsigned long search_exception_table(unsigned long addr);
283extern const struct exception_table_entry *search_exception_tables (unsigned long addr);
284
285#endif /* __ASM_SH_UACCESS_64_H */
diff --git a/include/asm-sh/ubc.h b/include/asm-sh/ubc.h
deleted file mode 100644
index 56f4e30dc49c..000000000000
--- a/include/asm-sh/ubc.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * include/asm-sh/ubc.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2002, 2003 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#ifndef __ASM_SH_UBC_H
12#define __ASM_SH_UBC_H
13#ifdef __KERNEL__
14
15#include <asm/cpu/ubc.h>
16
17/* User Break Controller */
18#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709)
19#define UBC_TYPE_SH7729 (current_cpu_data.type == CPU_SH7729)
20#else
21#define UBC_TYPE_SH7729 0
22#endif
23
24#define BAMR_ASID (1 << 2)
25#define BAMR_NONE 0
26#define BAMR_10 0x1
27#define BAMR_12 0x2
28#define BAMR_ALL 0x3
29#define BAMR_16 0x8
30#define BAMR_20 0x9
31
32#define BBR_INST (1 << 4)
33#define BBR_DATA (2 << 4)
34#define BBR_READ (1 << 2)
35#define BBR_WRITE (2 << 2)
36#define BBR_BYTE 0x1
37#define BBR_HALF 0x2
38#define BBR_LONG 0x3
39#define BBR_QUAD (1 << 6) /* SH7750 */
40#define BBR_CPU (1 << 6) /* SH7709A,SH7729 */
41#define BBR_DMA (2 << 6) /* SH7709A,SH7729 */
42
43#define BRCR_CMFA (1 << 15)
44#define BRCR_CMFB (1 << 14)
45#define BRCR_PCTE (1 << 11)
46#define BRCR_PCBA (1 << 10) /* 1: after execution */
47#define BRCR_DBEB (1 << 7)
48#define BRCR_PCBB (1 << 6)
49#define BRCR_SEQ (1 << 3)
50#define BRCR_UBDE (1 << 0)
51
52#ifndef __ASSEMBLY__
53/* arch/sh/kernel/cpu/ubc.S */
54extern void ubc_sleep(void);
55
56#ifdef CONFIG_UBC_WAKEUP
57extern void ubc_wakeup(void);
58#else
59#define ubc_wakeup() do { } while (0)
60#endif
61#endif
62
63#endif /* __KERNEL__ */
64#endif /* __ASM_SH_UBC_H */
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
deleted file mode 100644
index 4b21f369c28c..000000000000
--- a/include/asm-sh/unistd.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_SUPERH32
2# include "unistd_32.h"
3#else
4# include "unistd_64.h"
5#endif
diff --git a/include/asm-sh/unistd_32.h b/include/asm-sh/unistd_32.h
deleted file mode 100644
index 0b07212ec659..000000000000
--- a/include/asm-sh/unistd_32.h
+++ /dev/null
@@ -1,378 +0,0 @@
1#ifndef __ASM_SH_UNISTD_H
2#define __ASM_SH_UNISTD_H
3
4/*
5 * Copyright (C) 1999 Niibe Yutaka
6 */
7
8/*
9 * This file contains the system call numbers.
10 */
11
12#define __NR_restart_syscall 0
13#define __NR_exit 1
14#define __NR_fork 2
15#define __NR_read 3
16#define __NR_write 4
17#define __NR_open 5
18#define __NR_close 6
19#define __NR_waitpid 7
20#define __NR_creat 8
21#define __NR_link 9
22#define __NR_unlink 10
23#define __NR_execve 11
24#define __NR_chdir 12
25#define __NR_time 13
26#define __NR_mknod 14
27#define __NR_chmod 15
28#define __NR_lchown 16
29#define __NR_break 17
30#define __NR_oldstat 18
31#define __NR_lseek 19
32#define __NR_getpid 20
33#define __NR_mount 21
34#define __NR_umount 22
35#define __NR_setuid 23
36#define __NR_getuid 24
37#define __NR_stime 25
38#define __NR_ptrace 26
39#define __NR_alarm 27
40#define __NR_oldfstat 28
41#define __NR_pause 29
42#define __NR_utime 30
43#define __NR_stty 31
44#define __NR_gtty 32
45#define __NR_access 33
46#define __NR_nice 34
47#define __NR_ftime 35
48#define __NR_sync 36
49#define __NR_kill 37
50#define __NR_rename 38
51#define __NR_mkdir 39
52#define __NR_rmdir 40
53#define __NR_dup 41
54#define __NR_pipe 42
55#define __NR_times 43
56#define __NR_prof 44
57#define __NR_brk 45
58#define __NR_setgid 46
59#define __NR_getgid 47
60#define __NR_signal 48
61#define __NR_geteuid 49
62#define __NR_getegid 50
63#define __NR_acct 51
64#define __NR_umount2 52
65#define __NR_lock 53
66#define __NR_ioctl 54
67#define __NR_fcntl 55
68#define __NR_mpx 56
69#define __NR_setpgid 57
70#define __NR_ulimit 58
71#define __NR_oldolduname 59
72#define __NR_umask 60
73#define __NR_chroot 61
74#define __NR_ustat 62
75#define __NR_dup2 63
76#define __NR_getppid 64
77#define __NR_getpgrp 65
78#define __NR_setsid 66
79#define __NR_sigaction 67
80#define __NR_sgetmask 68
81#define __NR_ssetmask 69
82#define __NR_setreuid 70
83#define __NR_setregid 71
84#define __NR_sigsuspend 72
85#define __NR_sigpending 73
86#define __NR_sethostname 74
87#define __NR_setrlimit 75
88#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
89#define __NR_getrusage 77
90#define __NR_gettimeofday 78
91#define __NR_settimeofday 79
92#define __NR_getgroups 80
93#define __NR_setgroups 81
94#define __NR_select 82
95#define __NR_symlink 83
96#define __NR_oldlstat 84
97#define __NR_readlink 85
98#define __NR_uselib 86
99#define __NR_swapon 87
100#define __NR_reboot 88
101#define __NR_readdir 89
102#define __NR_mmap 90
103#define __NR_munmap 91
104#define __NR_truncate 92
105#define __NR_ftruncate 93
106#define __NR_fchmod 94
107#define __NR_fchown 95
108#define __NR_getpriority 96
109#define __NR_setpriority 97
110#define __NR_profil 98
111#define __NR_statfs 99
112#define __NR_fstatfs 100
113#define __NR_ioperm 101
114#define __NR_socketcall 102
115#define __NR_syslog 103
116#define __NR_setitimer 104
117#define __NR_getitimer 105
118#define __NR_stat 106
119#define __NR_lstat 107
120#define __NR_fstat 108
121#define __NR_olduname 109
122#define __NR_iopl 110
123#define __NR_vhangup 111
124#define __NR_idle 112
125#define __NR_vm86old 113
126#define __NR_wait4 114
127#define __NR_swapoff 115
128#define __NR_sysinfo 116
129#define __NR_ipc 117
130#define __NR_fsync 118
131#define __NR_sigreturn 119
132#define __NR_clone 120
133#define __NR_setdomainname 121
134#define __NR_uname 122
135#define __NR_modify_ldt 123
136#define __NR_adjtimex 124
137#define __NR_mprotect 125
138#define __NR_sigprocmask 126
139#define __NR_create_module 127
140#define __NR_init_module 128
141#define __NR_delete_module 129
142#define __NR_get_kernel_syms 130
143#define __NR_quotactl 131
144#define __NR_getpgid 132
145#define __NR_fchdir 133
146#define __NR_bdflush 134
147#define __NR_sysfs 135
148#define __NR_personality 136
149#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
150#define __NR_setfsuid 138
151#define __NR_setfsgid 139
152#define __NR__llseek 140
153#define __NR_getdents 141
154#define __NR__newselect 142
155#define __NR_flock 143
156#define __NR_msync 144
157#define __NR_readv 145
158#define __NR_writev 146
159#define __NR_getsid 147
160#define __NR_fdatasync 148
161#define __NR__sysctl 149
162#define __NR_mlock 150
163#define __NR_munlock 151
164#define __NR_mlockall 152
165#define __NR_munlockall 153
166#define __NR_sched_setparam 154
167#define __NR_sched_getparam 155
168#define __NR_sched_setscheduler 156
169#define __NR_sched_getscheduler 157
170#define __NR_sched_yield 158
171#define __NR_sched_get_priority_max 159
172#define __NR_sched_get_priority_min 160
173#define __NR_sched_rr_get_interval 161
174#define __NR_nanosleep 162
175#define __NR_mremap 163
176#define __NR_setresuid 164
177#define __NR_getresuid 165
178#define __NR_vm86 166
179#define __NR_query_module 167
180#define __NR_poll 168
181#define __NR_nfsservctl 169
182#define __NR_setresgid 170
183#define __NR_getresgid 171
184#define __NR_prctl 172
185#define __NR_rt_sigreturn 173
186#define __NR_rt_sigaction 174
187#define __NR_rt_sigprocmask 175
188#define __NR_rt_sigpending 176
189#define __NR_rt_sigtimedwait 177
190#define __NR_rt_sigqueueinfo 178
191#define __NR_rt_sigsuspend 179
192#define __NR_pread64 180
193#define __NR_pwrite64 181
194#define __NR_chown 182
195#define __NR_getcwd 183
196#define __NR_capget 184
197#define __NR_capset 185
198#define __NR_sigaltstack 186
199#define __NR_sendfile 187
200#define __NR_streams1 188 /* some people actually want it */
201#define __NR_streams2 189 /* some people actually want it */
202#define __NR_vfork 190
203#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
204#define __NR_mmap2 192
205#define __NR_truncate64 193
206#define __NR_ftruncate64 194
207#define __NR_stat64 195
208#define __NR_lstat64 196
209#define __NR_fstat64 197
210#define __NR_lchown32 198
211#define __NR_getuid32 199
212#define __NR_getgid32 200
213#define __NR_geteuid32 201
214#define __NR_getegid32 202
215#define __NR_setreuid32 203
216#define __NR_setregid32 204
217#define __NR_getgroups32 205
218#define __NR_setgroups32 206
219#define __NR_fchown32 207
220#define __NR_setresuid32 208
221#define __NR_getresuid32 209
222#define __NR_setresgid32 210
223#define __NR_getresgid32 211
224#define __NR_chown32 212
225#define __NR_setuid32 213
226#define __NR_setgid32 214
227#define __NR_setfsuid32 215
228#define __NR_setfsgid32 216
229#define __NR_pivot_root 217
230#define __NR_mincore 218
231#define __NR_madvise 219
232#define __NR_getdents64 220
233#define __NR_fcntl64 221
234/* 223 is unused */
235#define __NR_gettid 224
236#define __NR_readahead 225
237#define __NR_setxattr 226
238#define __NR_lsetxattr 227
239#define __NR_fsetxattr 228
240#define __NR_getxattr 229
241#define __NR_lgetxattr 230
242#define __NR_fgetxattr 231
243#define __NR_listxattr 232
244#define __NR_llistxattr 233
245#define __NR_flistxattr 234
246#define __NR_removexattr 235
247#define __NR_lremovexattr 236
248#define __NR_fremovexattr 237
249#define __NR_tkill 238
250#define __NR_sendfile64 239
251#define __NR_futex 240
252#define __NR_sched_setaffinity 241
253#define __NR_sched_getaffinity 242
254#define __NR_set_thread_area 243
255#define __NR_get_thread_area 244
256#define __NR_io_setup 245
257#define __NR_io_destroy 246
258#define __NR_io_getevents 247
259#define __NR_io_submit 248
260#define __NR_io_cancel 249
261#define __NR_fadvise64 250
262
263#define __NR_exit_group 252
264#define __NR_lookup_dcookie 253
265#define __NR_epoll_create 254
266#define __NR_epoll_ctl 255
267#define __NR_epoll_wait 256
268#define __NR_remap_file_pages 257
269#define __NR_set_tid_address 258
270#define __NR_timer_create 259
271#define __NR_timer_settime (__NR_timer_create+1)
272#define __NR_timer_gettime (__NR_timer_create+2)
273#define __NR_timer_getoverrun (__NR_timer_create+3)
274#define __NR_timer_delete (__NR_timer_create+4)
275#define __NR_clock_settime (__NR_timer_create+5)
276#define __NR_clock_gettime (__NR_timer_create+6)
277#define __NR_clock_getres (__NR_timer_create+7)
278#define __NR_clock_nanosleep (__NR_timer_create+8)
279#define __NR_statfs64 268
280#define __NR_fstatfs64 269
281#define __NR_tgkill 270
282#define __NR_utimes 271
283#define __NR_fadvise64_64 272
284#define __NR_vserver 273
285#define __NR_mbind 274
286#define __NR_get_mempolicy 275
287#define __NR_set_mempolicy 276
288#define __NR_mq_open 277
289#define __NR_mq_unlink (__NR_mq_open+1)
290#define __NR_mq_timedsend (__NR_mq_open+2)
291#define __NR_mq_timedreceive (__NR_mq_open+3)
292#define __NR_mq_notify (__NR_mq_open+4)
293#define __NR_mq_getsetattr (__NR_mq_open+5)
294#define __NR_kexec_load 283
295#define __NR_waitid 284
296#define __NR_add_key 285
297#define __NR_request_key 286
298#define __NR_keyctl 287
299#define __NR_ioprio_set 288
300#define __NR_ioprio_get 289
301#define __NR_inotify_init 290
302#define __NR_inotify_add_watch 291
303#define __NR_inotify_rm_watch 292
304/* 293 is unused */
305#define __NR_migrate_pages 294
306#define __NR_openat 295
307#define __NR_mkdirat 296
308#define __NR_mknodat 297
309#define __NR_fchownat 298
310#define __NR_futimesat 299
311#define __NR_fstatat64 300
312#define __NR_unlinkat 301
313#define __NR_renameat 302
314#define __NR_linkat 303
315#define __NR_symlinkat 304
316#define __NR_readlinkat 305
317#define __NR_fchmodat 306
318#define __NR_faccessat 307
319#define __NR_pselect6 308
320#define __NR_ppoll 309
321#define __NR_unshare 310
322#define __NR_set_robust_list 311
323#define __NR_get_robust_list 312
324#define __NR_splice 313
325#define __NR_sync_file_range 314
326#define __NR_tee 315
327#define __NR_vmsplice 316
328#define __NR_move_pages 317
329#define __NR_getcpu 318
330#define __NR_epoll_pwait 319
331#define __NR_utimensat 320
332#define __NR_signalfd 321
333#define __NR_timerfd_create 322
334#define __NR_eventfd 323
335#define __NR_fallocate 324
336#define __NR_timerfd_settime 325
337#define __NR_timerfd_gettime 326
338
339#define NR_syscalls 327
340
341#ifdef __KERNEL__
342
343#define __ARCH_WANT_IPC_PARSE_VERSION
344#define __ARCH_WANT_OLD_READDIR
345#define __ARCH_WANT_OLD_STAT
346#define __ARCH_WANT_STAT64
347#define __ARCH_WANT_SYS_ALARM
348#define __ARCH_WANT_SYS_GETHOSTNAME
349#define __ARCH_WANT_SYS_PAUSE
350#define __ARCH_WANT_SYS_SGETMASK
351#define __ARCH_WANT_SYS_SIGNAL
352#define __ARCH_WANT_SYS_TIME
353#define __ARCH_WANT_SYS_UTIME
354#define __ARCH_WANT_SYS_WAITPID
355#define __ARCH_WANT_SYS_SOCKETCALL
356#define __ARCH_WANT_SYS_FADVISE64
357#define __ARCH_WANT_SYS_GETPGRP
358#define __ARCH_WANT_SYS_LLSEEK
359#define __ARCH_WANT_SYS_NICE
360#define __ARCH_WANT_SYS_OLD_GETRLIMIT
361#define __ARCH_WANT_SYS_OLDUMOUNT
362#define __ARCH_WANT_SYS_SIGPENDING
363#define __ARCH_WANT_SYS_SIGPROCMASK
364#define __ARCH_WANT_SYS_RT_SIGACTION
365#define __ARCH_WANT_SYS_RT_SIGSUSPEND
366
367/*
368 * "Conditional" syscalls
369 *
370 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
371 * but it doesn't work on all toolchains, so we just do it by hand
372 */
373#ifndef cond_syscall
374#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
375#endif
376
377#endif /* __KERNEL__ */
378#endif /* __ASM_SH_UNISTD_H */
diff --git a/include/asm-sh/unistd_64.h b/include/asm-sh/unistd_64.h
deleted file mode 100644
index 9d21eab52427..000000000000
--- a/include/asm-sh/unistd_64.h
+++ /dev/null
@@ -1,417 +0,0 @@
1#ifndef __ASM_SH_UNISTD_64_H
2#define __ASM_SH_UNISTD_64_H
3
4/*
5 * include/asm-sh/unistd_64.h
6 *
7 * This file contains the system call numbers.
8 *
9 * Copyright (C) 2000, 2001 Paolo Alberelli
10 * Copyright (C) 2003 - 2007 Paul Mundt
11 * Copyright (C) 2004 Sean McGoogan
12 *
13 * This file is subject to the terms and conditions of the GNU General Public
14 * License. See the file "COPYING" in the main directory of this archive
15 * for more details.
16 */
17#define __NR_restart_syscall 0
18#define __NR_exit 1
19#define __NR_fork 2
20#define __NR_read 3
21#define __NR_write 4
22#define __NR_open 5
23#define __NR_close 6
24#define __NR_waitpid 7
25#define __NR_creat 8
26#define __NR_link 9
27#define __NR_unlink 10
28#define __NR_execve 11
29#define __NR_chdir 12
30#define __NR_time 13
31#define __NR_mknod 14
32#define __NR_chmod 15
33#define __NR_lchown 16
34#define __NR_break 17
35#define __NR_oldstat 18
36#define __NR_lseek 19
37#define __NR_getpid 20
38#define __NR_mount 21
39#define __NR_umount 22
40#define __NR_setuid 23
41#define __NR_getuid 24
42#define __NR_stime 25
43#define __NR_ptrace 26
44#define __NR_alarm 27
45#define __NR_oldfstat 28
46#define __NR_pause 29
47#define __NR_utime 30
48#define __NR_stty 31
49#define __NR_gtty 32
50#define __NR_access 33
51#define __NR_nice 34
52#define __NR_ftime 35
53#define __NR_sync 36
54#define __NR_kill 37
55#define __NR_rename 38
56#define __NR_mkdir 39
57#define __NR_rmdir 40
58#define __NR_dup 41
59#define __NR_pipe 42
60#define __NR_times 43
61#define __NR_prof 44
62#define __NR_brk 45
63#define __NR_setgid 46
64#define __NR_getgid 47
65#define __NR_signal 48
66#define __NR_geteuid 49
67#define __NR_getegid 50
68#define __NR_acct 51
69#define __NR_umount2 52
70#define __NR_lock 53
71#define __NR_ioctl 54
72#define __NR_fcntl 55
73#define __NR_mpx 56
74#define __NR_setpgid 57
75#define __NR_ulimit 58
76#define __NR_oldolduname 59
77#define __NR_umask 60
78#define __NR_chroot 61
79#define __NR_ustat 62
80#define __NR_dup2 63
81#define __NR_getppid 64
82#define __NR_getpgrp 65
83#define __NR_setsid 66
84#define __NR_sigaction 67
85#define __NR_sgetmask 68
86#define __NR_ssetmask 69
87#define __NR_setreuid 70
88#define __NR_setregid 71
89#define __NR_sigsuspend 72
90#define __NR_sigpending 73
91#define __NR_sethostname 74
92#define __NR_setrlimit 75
93#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
94#define __NR_getrusage 77
95#define __NR_gettimeofday 78
96#define __NR_settimeofday 79
97#define __NR_getgroups 80
98#define __NR_setgroups 81
99#define __NR_select 82
100#define __NR_symlink 83
101#define __NR_oldlstat 84
102#define __NR_readlink 85
103#define __NR_uselib 86
104#define __NR_swapon 87
105#define __NR_reboot 88
106#define __NR_readdir 89
107#define __NR_mmap 90
108#define __NR_munmap 91
109#define __NR_truncate 92
110#define __NR_ftruncate 93
111#define __NR_fchmod 94
112#define __NR_fchown 95
113#define __NR_getpriority 96
114#define __NR_setpriority 97
115#define __NR_profil 98
116#define __NR_statfs 99
117#define __NR_fstatfs 100
118#define __NR_ioperm 101
119#define __NR_socketcall 102 /* old implementation of socket systemcall */
120#define __NR_syslog 103
121#define __NR_setitimer 104
122#define __NR_getitimer 105
123#define __NR_stat 106
124#define __NR_lstat 107
125#define __NR_fstat 108
126#define __NR_olduname 109
127#define __NR_iopl 110
128#define __NR_vhangup 111
129#define __NR_idle 112
130#define __NR_vm86old 113
131#define __NR_wait4 114
132#define __NR_swapoff 115
133#define __NR_sysinfo 116
134#define __NR_ipc 117
135#define __NR_fsync 118
136#define __NR_sigreturn 119
137#define __NR_clone 120
138#define __NR_setdomainname 121
139#define __NR_uname 122
140#define __NR_modify_ldt 123
141#define __NR_adjtimex 124
142#define __NR_mprotect 125
143#define __NR_sigprocmask 126
144#define __NR_create_module 127
145#define __NR_init_module 128
146#define __NR_delete_module 129
147#define __NR_get_kernel_syms 130
148#define __NR_quotactl 131
149#define __NR_getpgid 132
150#define __NR_fchdir 133
151#define __NR_bdflush 134
152#define __NR_sysfs 135
153#define __NR_personality 136
154#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
155#define __NR_setfsuid 138
156#define __NR_setfsgid 139
157#define __NR__llseek 140
158#define __NR_getdents 141
159#define __NR__newselect 142
160#define __NR_flock 143
161#define __NR_msync 144
162#define __NR_readv 145
163#define __NR_writev 146
164#define __NR_getsid 147
165#define __NR_fdatasync 148
166#define __NR__sysctl 149
167#define __NR_mlock 150
168#define __NR_munlock 151
169#define __NR_mlockall 152
170#define __NR_munlockall 153
171#define __NR_sched_setparam 154
172#define __NR_sched_getparam 155
173#define __NR_sched_setscheduler 156
174#define __NR_sched_getscheduler 157
175#define __NR_sched_yield 158
176#define __NR_sched_get_priority_max 159
177#define __NR_sched_get_priority_min 160
178#define __NR_sched_rr_get_interval 161
179#define __NR_nanosleep 162
180#define __NR_mremap 163
181#define __NR_setresuid 164
182#define __NR_getresuid 165
183#define __NR_vm86 166
184#define __NR_query_module 167
185#define __NR_poll 168
186#define __NR_nfsservctl 169
187#define __NR_setresgid 170
188#define __NR_getresgid 171
189#define __NR_prctl 172
190#define __NR_rt_sigreturn 173
191#define __NR_rt_sigaction 174
192#define __NR_rt_sigprocmask 175
193#define __NR_rt_sigpending 176
194#define __NR_rt_sigtimedwait 177
195#define __NR_rt_sigqueueinfo 178
196#define __NR_rt_sigsuspend 179
197#define __NR_pread64 180
198#define __NR_pwrite64 181
199#define __NR_chown 182
200#define __NR_getcwd 183
201#define __NR_capget 184
202#define __NR_capset 185
203#define __NR_sigaltstack 186
204#define __NR_sendfile 187
205#define __NR_streams1 188 /* some people actually want it */
206#define __NR_streams2 189 /* some people actually want it */
207#define __NR_vfork 190
208#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
209#define __NR_mmap2 192
210#define __NR_truncate64 193
211#define __NR_ftruncate64 194
212#define __NR_stat64 195
213#define __NR_lstat64 196
214#define __NR_fstat64 197
215#define __NR_lchown32 198
216#define __NR_getuid32 199
217#define __NR_getgid32 200
218#define __NR_geteuid32 201
219#define __NR_getegid32 202
220#define __NR_setreuid32 203
221#define __NR_setregid32 204
222#define __NR_getgroups32 205
223#define __NR_setgroups32 206
224#define __NR_fchown32 207
225#define __NR_setresuid32 208
226#define __NR_getresuid32 209
227#define __NR_setresgid32 210
228#define __NR_getresgid32 211
229#define __NR_chown32 212
230#define __NR_setuid32 213
231#define __NR_setgid32 214
232#define __NR_setfsuid32 215
233#define __NR_setfsgid32 216
234#define __NR_pivot_root 217
235#define __NR_mincore 218
236#define __NR_madvise 219
237
238/* Non-multiplexed socket family */
239#define __NR_socket 220
240#define __NR_bind 221
241#define __NR_connect 222
242#define __NR_listen 223
243#define __NR_accept 224
244#define __NR_getsockname 225
245#define __NR_getpeername 226
246#define __NR_socketpair 227
247#define __NR_send 228
248#define __NR_sendto 229
249#define __NR_recv 230
250#define __NR_recvfrom 231
251#define __NR_shutdown 232
252#define __NR_setsockopt 233
253#define __NR_getsockopt 234
254#define __NR_sendmsg 235
255#define __NR_recvmsg 236
256
257/* Non-multiplexed IPC family */
258#define __NR_semop 237
259#define __NR_semget 238
260#define __NR_semctl 239
261#define __NR_msgsnd 240
262#define __NR_msgrcv 241
263#define __NR_msgget 242
264#define __NR_msgctl 243
265#if 0
266#define __NR_shmatcall 244
267#endif
268#define __NR_shmdt 245
269#define __NR_shmget 246
270#define __NR_shmctl 247
271
272#define __NR_getdents64 248
273#define __NR_fcntl64 249
274/* 223 is unused */
275#define __NR_gettid 252
276#define __NR_readahead 253
277#define __NR_setxattr 254
278#define __NR_lsetxattr 255
279#define __NR_fsetxattr 256
280#define __NR_getxattr 257
281#define __NR_lgetxattr 258
282#define __NR_fgetxattr 269
283#define __NR_listxattr 260
284#define __NR_llistxattr 261
285#define __NR_flistxattr 262
286#define __NR_removexattr 263
287#define __NR_lremovexattr 264
288#define __NR_fremovexattr 265
289#define __NR_tkill 266
290#define __NR_sendfile64 267
291#define __NR_futex 268
292#define __NR_sched_setaffinity 269
293#define __NR_sched_getaffinity 270
294#define __NR_set_thread_area 271
295#define __NR_get_thread_area 272
296#define __NR_io_setup 273
297#define __NR_io_destroy 274
298#define __NR_io_getevents 275
299#define __NR_io_submit 276
300#define __NR_io_cancel 277
301#define __NR_fadvise64 278
302#define __NR_exit_group 280
303
304#define __NR_lookup_dcookie 281
305#define __NR_epoll_create 282
306#define __NR_epoll_ctl 283
307#define __NR_epoll_wait 284
308#define __NR_remap_file_pages 285
309#define __NR_set_tid_address 286
310#define __NR_timer_create 287
311#define __NR_timer_settime (__NR_timer_create+1)
312#define __NR_timer_gettime (__NR_timer_create+2)
313#define __NR_timer_getoverrun (__NR_timer_create+3)
314#define __NR_timer_delete (__NR_timer_create+4)
315#define __NR_clock_settime (__NR_timer_create+5)
316#define __NR_clock_gettime (__NR_timer_create+6)
317#define __NR_clock_getres (__NR_timer_create+7)
318#define __NR_clock_nanosleep (__NR_timer_create+8)
319#define __NR_statfs64 296
320#define __NR_fstatfs64 297
321#define __NR_tgkill 298
322#define __NR_utimes 299
323#define __NR_fadvise64_64 300
324#define __NR_vserver 301
325#define __NR_mbind 302
326#define __NR_get_mempolicy 303
327#define __NR_set_mempolicy 304
328#define __NR_mq_open 305
329#define __NR_mq_unlink (__NR_mq_open+1)
330#define __NR_mq_timedsend (__NR_mq_open+2)
331#define __NR_mq_timedreceive (__NR_mq_open+3)
332#define __NR_mq_notify (__NR_mq_open+4)
333#define __NR_mq_getsetattr (__NR_mq_open+5)
334#define __NR_kexec_load 311
335#define __NR_waitid 312
336#define __NR_add_key 313
337#define __NR_request_key 314
338#define __NR_keyctl 315
339#define __NR_ioprio_set 316
340#define __NR_ioprio_get 317
341#define __NR_inotify_init 318
342#define __NR_inotify_add_watch 319
343#define __NR_inotify_rm_watch 320
344/* 321 is unused */
345#define __NR_migrate_pages 322
346#define __NR_openat 323
347#define __NR_mkdirat 324
348#define __NR_mknodat 325
349#define __NR_fchownat 326
350#define __NR_futimesat 327
351#define __NR_fstatat64 328
352#define __NR_unlinkat 329
353#define __NR_renameat 330
354#define __NR_linkat 331
355#define __NR_symlinkat 332
356#define __NR_readlinkat 333
357#define __NR_fchmodat 334
358#define __NR_faccessat 335
359#define __NR_pselect6 336
360#define __NR_ppoll 337
361#define __NR_unshare 338
362#define __NR_set_robust_list 339
363#define __NR_get_robust_list 340
364#define __NR_splice 341
365#define __NR_sync_file_range 342
366#define __NR_tee 343
367#define __NR_vmsplice 344
368#define __NR_move_pages 345
369#define __NR_getcpu 346
370#define __NR_epoll_pwait 347
371#define __NR_utimensat 348
372#define __NR_signalfd 349
373#define __NR_timerfd_create 350
374#define __NR_eventfd 351
375#define __NR_fallocate 352
376#define __NR_timerfd_settime 353
377#define __NR_timerfd_gettime 354
378
379#ifdef __KERNEL__
380
381#define NR_syscalls 353
382
383#define __ARCH_WANT_IPC_PARSE_VERSION
384#define __ARCH_WANT_OLD_READDIR
385#define __ARCH_WANT_OLD_STAT
386#define __ARCH_WANT_STAT64
387#define __ARCH_WANT_SYS_ALARM
388#define __ARCH_WANT_SYS_GETHOSTNAME
389#define __ARCH_WANT_SYS_PAUSE
390#define __ARCH_WANT_SYS_SGETMASK
391#define __ARCH_WANT_SYS_SIGNAL
392#define __ARCH_WANT_SYS_TIME
393#define __ARCH_WANT_SYS_UTIME
394#define __ARCH_WANT_SYS_WAITPID
395#define __ARCH_WANT_SYS_SOCKETCALL
396#define __ARCH_WANT_SYS_FADVISE64
397#define __ARCH_WANT_SYS_GETPGRP
398#define __ARCH_WANT_SYS_LLSEEK
399#define __ARCH_WANT_SYS_NICE
400#define __ARCH_WANT_SYS_OLD_GETRLIMIT
401#define __ARCH_WANT_SYS_OLDUMOUNT
402#define __ARCH_WANT_SYS_SIGPENDING
403#define __ARCH_WANT_SYS_SIGPROCMASK
404#define __ARCH_WANT_SYS_RT_SIGACTION
405
406/*
407 * "Conditional" syscalls
408 *
409 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
410 * but it doesn't work on all toolchains, so we just do it by hand
411 */
412#ifndef cond_syscall
413#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
414#endif
415
416#endif /* __KERNEL__ */
417#endif /* __ASM_SH_UNISTD_64_H */
diff --git a/include/asm-sh/watchdog.h b/include/asm-sh/watchdog.h
deleted file mode 100644
index d19ea62ef8c6..000000000000
--- a/include/asm-sh/watchdog.h
+++ /dev/null
@@ -1,107 +0,0 @@
1/*
2 * include/asm-sh/watchdog.h
3 *
4 * Copyright (C) 2002, 2003 Paul Mundt
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11#ifndef __ASM_SH_WATCHDOG_H
12#define __ASM_SH_WATCHDOG_H
13#ifdef __KERNEL__
14
15#include <linux/types.h>
16#include <asm/cpu/watchdog.h>
17#include <asm/io.h>
18
19/*
20 * See asm/cpu-sh2/watchdog.h for explanation of this stupidity..
21 */
22#ifndef WTCNT_R
23# define WTCNT_R WTCNT
24#endif
25
26#ifndef WTCSR_R
27# define WTCSR_R WTCSR
28#endif
29
30#define WTCNT_HIGH 0x5a
31#define WTCSR_HIGH 0xa5
32
33#define WTCSR_CKS2 0x04
34#define WTCSR_CKS1 0x02
35#define WTCSR_CKS0 0x01
36
37/*
38 * CKS0-2 supports a number of clock division ratios. At the time the watchdog
39 * is enabled, it defaults to a 41 usec overflow period .. we overload this to
40 * something a little more reasonable, and really can't deal with anything
41 * lower than WTCSR_CKS_1024, else we drop back into the usec range.
42 *
43 * Clock Division Ratio Overflow Period
44 * --------------------------------------------
45 * 1/32 (initial value) 41 usecs
46 * 1/64 82 usecs
47 * 1/128 164 usecs
48 * 1/256 328 usecs
49 * 1/512 656 usecs
50 * 1/1024 1.31 msecs
51 * 1/2048 2.62 msecs
52 * 1/4096 5.25 msecs
53 */
54#define WTCSR_CKS_32 0x00
55#define WTCSR_CKS_64 0x01
56#define WTCSR_CKS_128 0x02
57#define WTCSR_CKS_256 0x03
58#define WTCSR_CKS_512 0x04
59#define WTCSR_CKS_1024 0x05
60#define WTCSR_CKS_2048 0x06
61#define WTCSR_CKS_4096 0x07
62
63/**
64 * sh_wdt_read_cnt - Read from Counter
65 * Reads back the WTCNT value.
66 */
67static inline __u8 sh_wdt_read_cnt(void)
68{
69 return ctrl_inb(WTCNT_R);
70}
71
72/**
73 * sh_wdt_write_cnt - Write to Counter
74 * @val: Value to write
75 *
76 * Writes the given value @val to the lower byte of the timer counter.
77 * The upper byte is set manually on each write.
78 */
79static inline void sh_wdt_write_cnt(__u8 val)
80{
81 ctrl_outw((WTCNT_HIGH << 8) | (__u16)val, WTCNT);
82}
83
84/**
85 * sh_wdt_read_csr - Read from Control/Status Register
86 *
87 * Reads back the WTCSR value.
88 */
89static inline __u8 sh_wdt_read_csr(void)
90{
91 return ctrl_inb(WTCSR_R);
92}
93
94/**
95 * sh_wdt_write_csr - Write to Control/Status Register
96 * @val: Value to write
97 *
98 * Writes the given value @val to the lower byte of the control/status
99 * register. The upper byte is set manually on each write.
100 */
101static inline void sh_wdt_write_csr(__u8 val)
102{
103 ctrl_outw((WTCSR_HIGH << 8) | (__u16)val, WTCSR);
104}
105
106#endif /* __KERNEL__ */
107#endif /* __ASM_SH_WATCHDOG_H */
diff --git a/include/asm-sparc/Kbuild b/include/asm-sparc/Kbuild
deleted file mode 100644
index 6cdaf9d33b38..000000000000
--- a/include/asm-sparc/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1# dummy file to avoid breaking make headers_install
diff --git a/include/asm-sparc/atomic.h b/include/asm-sparc/atomic.h
deleted file mode 100644
index 66d8166ec1d7..000000000000
--- a/include/asm-sparc/atomic.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_ATOMIC_H
2#define ___ASM_SPARC_ATOMIC_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/atomic_64.h>
5#else
6#include <asm-sparc/atomic_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/auxio.h b/include/asm-sparc/auxio.h
deleted file mode 100644
index 24c6f3c0f577..000000000000
--- a/include/asm-sparc/auxio.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_AUXIO_H
2#define ___ASM_SPARC_AUXIO_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/auxio_64.h>
5#else
6#include <asm-sparc/auxio_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/auxio_32.h b/include/asm-sparc/auxio_32.h
deleted file mode 100644
index 4db8f23db20f..000000000000
--- a/include/asm-sparc/auxio_32.h
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * auxio.h: Definitions and code for the Auxiliary I/O register.
3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 */
6#ifndef _SPARC_AUXIO_H
7#define _SPARC_AUXIO_H
8
9#include <asm/system.h>
10#include <asm/vaddrs.h>
11
12/* This register is an unsigned char in IO space. It does two things.
13 * First, it is used to control the front panel LED light on machines
14 * that have it (good for testing entry points to trap handlers and irq's)
15 * Secondly, it controls various floppy drive parameters.
16 */
17#define AUXIO_ORMEIN 0xf0 /* All writes must set these bits. */
18#define AUXIO_ORMEIN4M 0xc0 /* sun4m - All writes must set these bits. */
19#define AUXIO_FLPY_DENS 0x20 /* Floppy density, high if set. Read only. */
20#define AUXIO_FLPY_DCHG 0x10 /* A disk change occurred. Read only. */
21#define AUXIO_EDGE_ON 0x10 /* sun4m - On means Jumper block is in. */
22#define AUXIO_FLPY_DSEL 0x08 /* Drive select/start-motor. Write only. */
23#define AUXIO_LINK_TEST 0x08 /* sun4m - On means TPE Carrier detect. */
24
25/* Set the following to one, then zero, after doing a pseudo DMA transfer. */
26#define AUXIO_FLPY_TCNT 0x04 /* Floppy terminal count. Write only. */
27
28/* Set the following to zero to eject the floppy. */
29#define AUXIO_FLPY_EJCT 0x02 /* Eject floppy disk. Write only. */
30#define AUXIO_LED 0x01 /* On if set, off if unset. Read/Write */
31
32#ifndef __ASSEMBLY__
33
34/*
35 * NOTE: these routines are implementation dependent--
36 * understand the hardware you are querying!
37 */
38extern void set_auxio(unsigned char bits_on, unsigned char bits_off);
39extern unsigned char get_auxio(void); /* .../asm-sparc/floppy.h */
40
41/*
42 * The following routines are provided for driver-compatibility
43 * with sparc64 (primarily sunlance.c)
44 */
45
46#define AUXIO_LTE_ON 1
47#define AUXIO_LTE_OFF 0
48
49/* auxio_set_lte - Set Link Test Enable (TPE Link Detect)
50 *
51 * on - AUXIO_LTE_ON or AUXIO_LTE_OFF
52 */
53#define auxio_set_lte(on) \
54do { \
55 if(on) { \
56 set_auxio(AUXIO_LINK_TEST, 0); \
57 } else { \
58 set_auxio(0, AUXIO_LINK_TEST); \
59 } \
60} while (0)
61
62#define AUXIO_LED_ON 1
63#define AUXIO_LED_OFF 0
64
65/* auxio_set_led - Set system front panel LED
66 *
67 * on - AUXIO_LED_ON or AUXIO_LED_OFF
68 */
69#define auxio_set_led(on) \
70do { \
71 if(on) { \
72 set_auxio(AUXIO_LED, 0); \
73 } else { \
74 set_auxio(0, AUXIO_LED); \
75 } \
76} while (0)
77
78#endif /* !(__ASSEMBLY__) */
79
80
81/* AUXIO2 (Power Off Control) */
82extern __volatile__ unsigned char * auxio_power_register;
83
84#define AUXIO_POWER_DETECT_FAILURE 32
85#define AUXIO_POWER_CLEAR_FAILURE 2
86#define AUXIO_POWER_OFF 1
87
88
89#endif /* !(_SPARC_AUXIO_H) */
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h
deleted file mode 100644
index 1a2949d0193f..000000000000
--- a/include/asm-sparc/bitops.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_BITOPS_H
2#define ___ASM_SPARC_BITOPS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/bitops_64.h>
5#else
6#include <asm-sparc/bitops_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/btfixup.h b/include/asm-sparc/btfixup.h
deleted file mode 100644
index 08277e6fb4cd..000000000000
--- a/include/asm-sparc/btfixup.h
+++ /dev/null
@@ -1,208 +0,0 @@
1/*
2 * asm-sparc/btfixup.h: Macros for boot time linking.
3 *
4 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 */
6
7#ifndef _SPARC_BTFIXUP_H
8#define _SPARC_BTFIXUP_H
9
10#include <linux/init.h>
11
12#ifndef __ASSEMBLY__
13
14#ifdef MODULE
15extern unsigned int ___illegal_use_of_BTFIXUP_SIMM13_in_module(void);
16extern unsigned int ___illegal_use_of_BTFIXUP_SETHI_in_module(void);
17extern unsigned int ___illegal_use_of_BTFIXUP_HALF_in_module(void);
18extern unsigned int ___illegal_use_of_BTFIXUP_INT_in_module(void);
19
20#define BTFIXUP_SIMM13(__name) ___illegal_use_of_BTFIXUP_SIMM13_in_module()
21#define BTFIXUP_HALF(__name) ___illegal_use_of_BTFIXUP_HALF_in_module()
22#define BTFIXUP_SETHI(__name) ___illegal_use_of_BTFIXUP_SETHI_in_module()
23#define BTFIXUP_INT(__name) ___illegal_use_of_BTFIXUP_INT_in_module()
24#define BTFIXUP_BLACKBOX(__name) ___illegal_use_of_BTFIXUP_BLACKBOX_in_module
25
26#else
27
28#define BTFIXUP_SIMM13(__name) ___sf_##__name()
29#define BTFIXUP_HALF(__name) ___af_##__name()
30#define BTFIXUP_SETHI(__name) ___hf_##__name()
31#define BTFIXUP_INT(__name) ((unsigned int)&___i_##__name)
32/* This must be written in assembly and present in a sethi */
33#define BTFIXUP_BLACKBOX(__name) ___b_##__name
34#endif /* MODULE */
35
36/* Fixup call xx */
37
38#define BTFIXUPDEF_CALL(__type, __name, __args...) \
39 extern __type ___f_##__name(__args); \
40 extern unsigned ___fs_##__name[3];
41#define BTFIXUPDEF_CALL_CONST(__type, __name, __args...) \
42 extern __type ___f_##__name(__args) __attribute_const__; \
43 extern unsigned ___fs_##__name[3];
44#define BTFIXUP_CALL(__name) ___f_##__name
45
46#define BTFIXUPDEF_BLACKBOX(__name) \
47 extern unsigned ___bs_##__name[2];
48
49/* Put bottom 13bits into some register variable */
50
51#define BTFIXUPDEF_SIMM13(__name) \
52 static inline unsigned int ___sf_##__name(void) __attribute_const__; \
53 extern unsigned ___ss_##__name[2]; \
54 static inline unsigned int ___sf_##__name(void) { \
55 unsigned int ret; \
56 __asm__ ("or %%g0, ___s_" #__name ", %0" : "=r"(ret)); \
57 return ret; \
58 }
59#define BTFIXUPDEF_SIMM13_INIT(__name,__val) \
60 static inline unsigned int ___sf_##__name(void) __attribute_const__; \
61 extern unsigned ___ss_##__name[2]; \
62 static inline unsigned int ___sf_##__name(void) { \
63 unsigned int ret; \
64 __asm__ ("or %%g0, ___s_" #__name "__btset_" #__val ", %0" : "=r"(ret));\
65 return ret; \
66 }
67
68/* Put either bottom 13 bits, or upper 22 bits into some register variable
69 * (depending on the value, this will lead into sethi FIX, reg; or
70 * mov FIX, reg; )
71 */
72
73#define BTFIXUPDEF_HALF(__name) \
74 static inline unsigned int ___af_##__name(void) __attribute_const__; \
75 extern unsigned ___as_##__name[2]; \
76 static inline unsigned int ___af_##__name(void) { \
77 unsigned int ret; \
78 __asm__ ("or %%g0, ___a_" #__name ", %0" : "=r"(ret)); \
79 return ret; \
80 }
81#define BTFIXUPDEF_HALF_INIT(__name,__val) \
82 static inline unsigned int ___af_##__name(void) __attribute_const__; \
83 extern unsigned ___as_##__name[2]; \
84 static inline unsigned int ___af_##__name(void) { \
85 unsigned int ret; \
86 __asm__ ("or %%g0, ___a_" #__name "__btset_" #__val ", %0" : "=r"(ret));\
87 return ret; \
88 }
89
90/* Put upper 22 bits into some register variable */
91
92#define BTFIXUPDEF_SETHI(__name) \
93 static inline unsigned int ___hf_##__name(void) __attribute_const__; \
94 extern unsigned ___hs_##__name[2]; \
95 static inline unsigned int ___hf_##__name(void) { \
96 unsigned int ret; \
97 __asm__ ("sethi %%hi(___h_" #__name "), %0" : "=r"(ret)); \
98 return ret; \
99 }
100#define BTFIXUPDEF_SETHI_INIT(__name,__val) \
101 static inline unsigned int ___hf_##__name(void) __attribute_const__; \
102 extern unsigned ___hs_##__name[2]; \
103 static inline unsigned int ___hf_##__name(void) { \
104 unsigned int ret; \
105 __asm__ ("sethi %%hi(___h_" #__name "__btset_" #__val "), %0" : \
106 "=r"(ret)); \
107 return ret; \
108 }
109
110/* Put a full 32bit integer into some register variable */
111
112#define BTFIXUPDEF_INT(__name) \
113 extern unsigned char ___i_##__name; \
114 extern unsigned ___is_##__name[2];
115
116#define BTFIXUPCALL_NORM 0x00000000 /* Always call */
117#define BTFIXUPCALL_NOP 0x01000000 /* Possibly optimize to nop */
118#define BTFIXUPCALL_RETINT(i) (0x90102000|((i) & 0x1fff)) /* Possibly optimize to mov i, %o0 */
119#define BTFIXUPCALL_ORINT(i) (0x90122000|((i) & 0x1fff)) /* Possibly optimize to or %o0, i, %o0 */
120#define BTFIXUPCALL_RETO0 0x01000000 /* Return first parameter, actually a nop */
121#define BTFIXUPCALL_ANDNINT(i) (0x902a2000|((i) & 0x1fff)) /* Possibly optimize to andn %o0, i, %o0 */
122#define BTFIXUPCALL_SWAPO0O1 0xd27a0000 /* Possibly optimize to swap [%o0],%o1 */
123#define BTFIXUPCALL_SWAPO0G0 0xc07a0000 /* Possibly optimize to swap [%o0],%g0 */
124#define BTFIXUPCALL_SWAPG1G2 0xc4784000 /* Possibly optimize to swap [%g1],%g2 */
125#define BTFIXUPCALL_STG0O0 0xc0220000 /* Possibly optimize to st %g0,[%o0] */
126#define BTFIXUPCALL_STO1O0 0xd2220000 /* Possibly optimize to st %o1,[%o0] */
127
128#define BTFIXUPSET_CALL(__name, __addr, __insn) \
129 do { \
130 ___fs_##__name[0] |= 1; \
131 ___fs_##__name[1] = (unsigned long)__addr; \
132 ___fs_##__name[2] = __insn; \
133 } while (0)
134
135#define BTFIXUPSET_BLACKBOX(__name, __func) \
136 do { \
137 ___bs_##__name[0] |= 1; \
138 ___bs_##__name[1] = (unsigned long)__func; \
139 } while (0)
140
141#define BTFIXUPCOPY_CALL(__name, __from) \
142 do { \
143 ___fs_##__name[0] |= 1; \
144 ___fs_##__name[1] = ___fs_##__from[1]; \
145 ___fs_##__name[2] = ___fs_##__from[2]; \
146 } while (0)
147
148#define BTFIXUPSET_SIMM13(__name, __val) \
149 do { \
150 ___ss_##__name[0] |= 1; \
151 ___ss_##__name[1] = (unsigned)__val; \
152 } while (0)
153
154#define BTFIXUPCOPY_SIMM13(__name, __from) \
155 do { \
156 ___ss_##__name[0] |= 1; \
157 ___ss_##__name[1] = ___ss_##__from[1]; \
158 } while (0)
159
160#define BTFIXUPSET_HALF(__name, __val) \
161 do { \
162 ___as_##__name[0] |= 1; \
163 ___as_##__name[1] = (unsigned)__val; \
164 } while (0)
165
166#define BTFIXUPCOPY_HALF(__name, __from) \
167 do { \
168 ___as_##__name[0] |= 1; \
169 ___as_##__name[1] = ___as_##__from[1]; \
170 } while (0)
171
172#define BTFIXUPSET_SETHI(__name, __val) \
173 do { \
174 ___hs_##__name[0] |= 1; \
175 ___hs_##__name[1] = (unsigned)__val; \
176 } while (0)
177
178#define BTFIXUPCOPY_SETHI(__name, __from) \
179 do { \
180 ___hs_##__name[0] |= 1; \
181 ___hs_##__name[1] = ___hs_##__from[1]; \
182 } while (0)
183
184#define BTFIXUPSET_INT(__name, __val) \
185 do { \
186 ___is_##__name[0] |= 1; \
187 ___is_##__name[1] = (unsigned)__val; \
188 } while (0)
189
190#define BTFIXUPCOPY_INT(__name, __from) \
191 do { \
192 ___is_##__name[0] |= 1; \
193 ___is_##__name[1] = ___is_##__from[1]; \
194 } while (0)
195
196#define BTFIXUPVAL_CALL(__name) \
197 ((unsigned long)___fs_##__name[1])
198
199extern void btfixup(void);
200
201#else /* __ASSEMBLY__ */
202
203#define BTFIXUP_SETHI(__name) %hi(___h_ ## __name)
204#define BTFIXUP_SETHI_INIT(__name,__val) %hi(___h_ ## __name ## __btset_ ## __val)
205
206#endif /* __ASSEMBLY__ */
207
208#endif /* !(_SPARC_BTFIXUP_H) */
diff --git a/include/asm-sparc/bugs.h b/include/asm-sparc/bugs.h
deleted file mode 100644
index 2dfc07bc8e54..000000000000
--- a/include/asm-sparc/bugs.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/* include/asm-sparc/bugs.h: Sparc probes for various bugs.
2 *
3 * Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#ifdef CONFIG_SPARC32
7#include <asm/cpudata.h>
8#endif
9
10#ifdef CONFIG_SPARC64
11#include <asm/sstate.h>
12#endif
13
14extern unsigned long loops_per_jiffy;
15
16static void __init check_bugs(void)
17{
18#if defined(CONFIG_SPARC32) && !defined(CONFIG_SMP)
19 cpu_data(0).udelay_val = loops_per_jiffy;
20#endif
21#ifdef CONFIG_SPARC64
22 sstate_running();
23#endif
24}
diff --git a/include/asm-sparc/cacheflush.h b/include/asm-sparc/cacheflush.h
deleted file mode 100644
index 2b6a37957c2d..000000000000
--- a/include/asm-sparc/cacheflush.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_CACHEFLUSH_H
2#define ___ASM_SPARC_CACHEFLUSH_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/cacheflush_64.h>
5#else
6#include <asm-sparc/cacheflush_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/checksum.h b/include/asm-sparc/checksum.h
deleted file mode 100644
index 4e3553d4f6e1..000000000000
--- a/include/asm-sparc/checksum.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_CHECKSUM_H
2#define ___ASM_SPARC_CHECKSUM_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/checksum_64.h>
5#else
6#include <asm-sparc/checksum_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/cpudata.h b/include/asm-sparc/cpudata.h
deleted file mode 100644
index b76fac0c8d8f..000000000000
--- a/include/asm-sparc/cpudata.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_CPUDATA_H
2#define ___ASM_SPARC_CPUDATA_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/cpudata_64.h>
5#else
6#include <asm-sparc/cpudata_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/cpudata_32.h b/include/asm-sparc/cpudata_32.h
deleted file mode 100644
index a2c4d51d36c4..000000000000
--- a/include/asm-sparc/cpudata_32.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/* cpudata.h: Per-cpu parameters.
2 *
3 * Copyright (C) 2004 Keith M Wesolowski (wesolows@foobazco.org)
4 *
5 * Based on include/asm-sparc64/cpudata.h and Linux 2.4 smp.h
6 * both (C) David S. Miller.
7 */
8
9#ifndef _SPARC_CPUDATA_H
10#define _SPARC_CPUDATA_H
11
12#include <linux/percpu.h>
13
14typedef struct {
15 unsigned long udelay_val;
16 unsigned long clock_tick;
17 unsigned int multiplier;
18 unsigned int counter;
19 int prom_node;
20 int mid;
21 int next;
22} cpuinfo_sparc;
23
24DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
25#define cpu_data(__cpu) per_cpu(__cpu_data, (__cpu))
26
27#endif /* _SPARC_CPUDATA_H */
diff --git a/include/asm-sparc/current.h b/include/asm-sparc/current.h
deleted file mode 100644
index 8a1d9d6643b0..000000000000
--- a/include/asm-sparc/current.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/* include/asm-sparc/current.h
2 *
3 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
4 * Copyright (C) 2002 Pete Zaitcev (zaitcev@yahoo.com)
5 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
6 *
7 * Derived from "include/asm-s390/current.h" by
8 * Martin Schwidefsky (schwidefsky@de.ibm.com)
9 * Derived from "include/asm-i386/current.h"
10*/
11#ifndef _SPARC_CURRENT_H
12#define _SPARC_CURRENT_H
13
14#include <linux/thread_info.h>
15
16#ifdef CONFIG_SPARC64
17register struct task_struct *current asm("g4");
18#endif
19
20#ifdef CONFIG_SPARC32
21/* We might want to consider using %g4 like sparc64 to shave a few cycles.
22 *
23 * Two stage process (inline + #define) for type-checking.
24 * We also obfuscate get_current() to check if anyone used that by mistake.
25 */
26struct task_struct;
27static inline struct task_struct *__get_current(void)
28{
29 return current_thread_info()->task;
30}
31#define current __get_current()
32#endif
33
34#endif /* !(_SPARC_CURRENT_H) */
diff --git a/include/asm-sparc/delay.h b/include/asm-sparc/delay.h
deleted file mode 100644
index 6210a3ce9751..000000000000
--- a/include/asm-sparc/delay.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_DELAY_H
2#define ___ASM_SPARC_DELAY_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/delay_64.h>
5#else
6#include <asm-sparc/delay_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/dma-mapping.h b/include/asm-sparc/dma-mapping.h
deleted file mode 100644
index 7483504259ce..000000000000
--- a/include/asm-sparc/dma-mapping.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_DMA_MAPPING_H
2#define ___ASM_SPARC_DMA_MAPPING_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/dma-mapping_64.h>
5#else
6#include <asm-sparc/dma-mapping_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/dma.h b/include/asm-sparc/dma.h
deleted file mode 100644
index 8cc69bfaae2a..000000000000
--- a/include/asm-sparc/dma.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_DMA_H
2#define ___ASM_SPARC_DMA_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/dma_64.h>
5#else
6#include <asm-sparc/dma_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/dma_32.h b/include/asm-sparc/dma_32.h
deleted file mode 100644
index 959d6c8a71ae..000000000000
--- a/include/asm-sparc/dma_32.h
+++ /dev/null
@@ -1,288 +0,0 @@
1/* include/asm-sparc/dma.h
2 *
3 * Copyright 1995 (C) David S. Miller (davem@davemloft.net)
4 */
5
6#ifndef _ASM_SPARC_DMA_H
7#define _ASM_SPARC_DMA_H
8
9#include <linux/kernel.h>
10#include <linux/types.h>
11
12#include <asm/vac-ops.h> /* for invalidate's, etc. */
13#include <asm/sbus.h>
14#include <asm/delay.h>
15#include <asm/oplib.h>
16#include <asm/system.h>
17#include <asm/io.h>
18#include <linux/spinlock.h>
19
20struct page;
21extern spinlock_t dma_spin_lock;
22
23static inline unsigned long claim_dma_lock(void)
24{
25 unsigned long flags;
26 spin_lock_irqsave(&dma_spin_lock, flags);
27 return flags;
28}
29
30static inline void release_dma_lock(unsigned long flags)
31{
32 spin_unlock_irqrestore(&dma_spin_lock, flags);
33}
34
35/* These are irrelevant for Sparc DMA, but we leave it in so that
36 * things can compile.
37 */
38#define MAX_DMA_CHANNELS 8
39#define MAX_DMA_ADDRESS (~0UL)
40#define DMA_MODE_READ 1
41#define DMA_MODE_WRITE 2
42
43/* Useful constants */
44#define SIZE_16MB (16*1024*1024)
45#define SIZE_64K (64*1024)
46
47/* SBUS DMA controller reg offsets */
48#define DMA_CSR 0x00UL /* rw DMA control/status register 0x00 */
49#define DMA_ADDR 0x04UL /* rw DMA transfer address register 0x04 */
50#define DMA_COUNT 0x08UL /* rw DMA transfer count register 0x08 */
51#define DMA_TEST 0x0cUL /* rw DMA test/debug register 0x0c */
52
53/* DVMA chip revisions */
54enum dvma_rev {
55 dvmarev0,
56 dvmaesc1,
57 dvmarev1,
58 dvmarev2,
59 dvmarev3,
60 dvmarevplus,
61 dvmahme
62};
63
64#define DMA_HASCOUNT(rev) ((rev)==dvmaesc1)
65
66/* Linux DMA information structure, filled during probe. */
67struct sbus_dma {
68 struct sbus_dma *next;
69 struct sbus_dev *sdev;
70 void __iomem *regs;
71
72 /* Status, misc info */
73 int node; /* Prom node for this DMA device */
74 int running; /* Are we doing DMA now? */
75 int allocated; /* Are we "owned" by anyone yet? */
76
77 /* Transfer information. */
78 unsigned long addr; /* Start address of current transfer */
79 int nbytes; /* Size of current transfer */
80 int realbytes; /* For splitting up large transfers, etc. */
81
82 /* DMA revision */
83 enum dvma_rev revision;
84};
85
86extern struct sbus_dma *dma_chain;
87
88/* Broken hardware... */
89#ifdef CONFIG_SUN4
90/* Have to sort this out. Does rev0 work fine on sun4[cmd] without isbroken?
91 * Or is rev0 present only on sun4 boxes? -jj */
92#define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev0 || (dma)->revision == dvmarev1)
93#else
94#define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev1)
95#endif
96#define DMA_ISESC1(dma) ((dma)->revision == dvmaesc1)
97
98/* Main routines in dma.c */
99extern void dvma_init(struct sbus_bus *);
100
101/* Fields in the cond_reg register */
102/* First, the version identification bits */
103#define DMA_DEVICE_ID 0xf0000000 /* Device identification bits */
104#define DMA_VERS0 0x00000000 /* Sunray DMA version */
105#define DMA_ESCV1 0x40000000 /* DMA ESC Version 1 */
106#define DMA_VERS1 0x80000000 /* DMA rev 1 */
107#define DMA_VERS2 0xa0000000 /* DMA rev 2 */
108#define DMA_VERHME 0xb0000000 /* DMA hme gate array */
109#define DMA_VERSPLUS 0x90000000 /* DMA rev 1 PLUS */
110
111#define DMA_HNDL_INTR 0x00000001 /* An IRQ needs to be handled */
112#define DMA_HNDL_ERROR 0x00000002 /* We need to take an error */
113#define DMA_FIFO_ISDRAIN 0x0000000c /* The DMA FIFO is draining */
114#define DMA_INT_ENAB 0x00000010 /* Turn on interrupts */
115#define DMA_FIFO_INV 0x00000020 /* Invalidate the FIFO */
116#define DMA_ACC_SZ_ERR 0x00000040 /* The access size was bad */
117#define DMA_FIFO_STDRAIN 0x00000040 /* DMA_VERS1 Drain the FIFO */
118#define DMA_RST_SCSI 0x00000080 /* Reset the SCSI controller */
119#define DMA_RST_ENET DMA_RST_SCSI /* Reset the ENET controller */
120#define DMA_RST_BPP DMA_RST_SCSI /* Reset the BPP controller */
121#define DMA_ST_WRITE 0x00000100 /* write from device to memory */
122#define DMA_ENABLE 0x00000200 /* Fire up DMA, handle requests */
123#define DMA_PEND_READ 0x00000400 /* DMA_VERS1/0/PLUS Pending Read */
124#define DMA_ESC_BURST 0x00000800 /* 1=16byte 0=32byte */
125#define DMA_READ_AHEAD 0x00001800 /* DMA read ahead partial longword */
126#define DMA_DSBL_RD_DRN 0x00001000 /* No EC drain on slave reads */
127#define DMA_BCNT_ENAB 0x00002000 /* If on, use the byte counter */
128#define DMA_TERM_CNTR 0x00004000 /* Terminal counter */
129#define DMA_SCSI_SBUS64 0x00008000 /* HME: Enable 64-bit SBUS mode. */
130#define DMA_CSR_DISAB 0x00010000 /* No FIFO drains during csr */
131#define DMA_SCSI_DISAB 0x00020000 /* No FIFO drains during reg */
132#define DMA_DSBL_WR_INV 0x00020000 /* No EC inval. on slave writes */
133#define DMA_ADD_ENABLE 0x00040000 /* Special ESC DVMA optimization */
134#define DMA_E_BURSTS 0x000c0000 /* ENET: SBUS r/w burst mask */
135#define DMA_E_BURST32 0x00040000 /* ENET: SBUS 32 byte r/w burst */
136#define DMA_E_BURST16 0x00000000 /* ENET: SBUS 16 byte r/w burst */
137#define DMA_BRST_SZ 0x000c0000 /* SCSI: SBUS r/w burst size */
138#define DMA_BRST64 0x00080000 /* SCSI: 64byte bursts (HME on UltraSparc only) */
139#define DMA_BRST32 0x00040000 /* SCSI/BPP: 32byte bursts */
140#define DMA_BRST16 0x00000000 /* SCSI/BPP: 16byte bursts */
141#define DMA_BRST0 0x00080000 /* SCSI: no bursts (non-HME gate arrays) */
142#define DMA_ADDR_DISAB 0x00100000 /* No FIFO drains during addr */
143#define DMA_2CLKS 0x00200000 /* Each transfer = 2 clock ticks */
144#define DMA_3CLKS 0x00400000 /* Each transfer = 3 clock ticks */
145#define DMA_EN_ENETAUI DMA_3CLKS /* Put lance into AUI-cable mode */
146#define DMA_CNTR_DISAB 0x00800000 /* No IRQ when DMA_TERM_CNTR set */
147#define DMA_AUTO_NADDR 0x01000000 /* Use "auto nxt addr" feature */
148#define DMA_SCSI_ON 0x02000000 /* Enable SCSI dma */
149#define DMA_BPP_ON DMA_SCSI_ON /* Enable BPP dma */
150#define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */
151#define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */
152#define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */
153#define DMA_RESET_FAS366 0x08000000 /* HME: Assert RESET to FAS366 */
154
155/* Values describing the burst-size property from the PROM */
156#define DMA_BURST1 0x01
157#define DMA_BURST2 0x02
158#define DMA_BURST4 0x04
159#define DMA_BURST8 0x08
160#define DMA_BURST16 0x10
161#define DMA_BURST32 0x20
162#define DMA_BURST64 0x40
163#define DMA_BURSTBITS 0x7f
164
165/* Determine highest possible final transfer address given a base */
166#define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL))
167
168/* Yes, I hack a lot of elisp in my spare time... */
169#define DMA_ERROR_P(regs) ((((regs)->cond_reg) & DMA_HNDL_ERROR))
170#define DMA_IRQ_P(regs) ((((regs)->cond_reg) & (DMA_HNDL_INTR | DMA_HNDL_ERROR)))
171#define DMA_WRITE_P(regs) ((((regs)->cond_reg) & DMA_ST_WRITE))
172#define DMA_OFF(regs) ((((regs)->cond_reg) &= (~DMA_ENABLE)))
173#define DMA_INTSOFF(regs) ((((regs)->cond_reg) &= (~DMA_INT_ENAB)))
174#define DMA_INTSON(regs) ((((regs)->cond_reg) |= (DMA_INT_ENAB)))
175#define DMA_PUNTFIFO(regs) ((((regs)->cond_reg) |= DMA_FIFO_INV))
176#define DMA_SETSTART(regs, addr) ((((regs)->st_addr) = (char *) addr))
177#define DMA_BEGINDMA_W(regs) \
178 ((((regs)->cond_reg |= (DMA_ST_WRITE|DMA_ENABLE|DMA_INT_ENAB))))
179#define DMA_BEGINDMA_R(regs) \
180 ((((regs)->cond_reg |= ((DMA_ENABLE|DMA_INT_ENAB)&(~DMA_ST_WRITE)))))
181
182/* For certain DMA chips, we need to disable ints upon irq entry
183 * and turn them back on when we are done. So in any ESP interrupt
184 * handler you *must* call DMA_IRQ_ENTRY upon entry and DMA_IRQ_EXIT
185 * when leaving the handler. You have been warned...
186 */
187#define DMA_IRQ_ENTRY(dma, dregs) do { \
188 if(DMA_ISBROKEN(dma)) DMA_INTSOFF(dregs); \
189 } while (0)
190
191#define DMA_IRQ_EXIT(dma, dregs) do { \
192 if(DMA_ISBROKEN(dma)) DMA_INTSON(dregs); \
193 } while(0)
194
195#if 0 /* P3 this stuff is inline in ledma.c:init_restart_ledma() */
196/* Pause until counter runs out or BIT isn't set in the DMA condition
197 * register.
198 */
199static inline void sparc_dma_pause(struct sparc_dma_registers *regs,
200 unsigned long bit)
201{
202 int ctr = 50000; /* Let's find some bugs ;) */
203
204 /* Busy wait until the bit is not set any more */
205 while((regs->cond_reg&bit) && (ctr>0)) {
206 ctr--;
207 __delay(5);
208 }
209
210 /* Check for bogus outcome. */
211 if(!ctr)
212 panic("DMA timeout");
213}
214
215/* Reset the friggin' thing... */
216#define DMA_RESET(dma) do { \
217 struct sparc_dma_registers *regs = dma->regs; \
218 /* Let the current FIFO drain itself */ \
219 sparc_dma_pause(regs, (DMA_FIFO_ISDRAIN)); \
220 /* Reset the logic */ \
221 regs->cond_reg |= (DMA_RST_SCSI); /* assert */ \
222 __delay(400); /* let the bits set ;) */ \
223 regs->cond_reg &= ~(DMA_RST_SCSI); /* de-assert */ \
224 sparc_dma_enable_interrupts(regs); /* Re-enable interrupts */ \
225 /* Enable FAST transfers if available */ \
226 if(dma->revision>dvmarev1) regs->cond_reg |= DMA_3CLKS; \
227 dma->running = 0; \
228} while(0)
229#endif
230
231#define for_each_dvma(dma) \
232 for((dma) = dma_chain; (dma); (dma) = (dma)->next)
233
234extern int get_dma_list(char *);
235extern int request_dma(unsigned int, __const__ char *);
236extern void free_dma(unsigned int);
237
238/* From PCI */
239
240#ifdef CONFIG_PCI
241extern int isa_dma_bridge_buggy;
242#else
243#define isa_dma_bridge_buggy (0)
244#endif
245
246/* Routines for data transfer buffers. */
247BTFIXUPDEF_CALL(char *, mmu_lockarea, char *, unsigned long)
248BTFIXUPDEF_CALL(void, mmu_unlockarea, char *, unsigned long)
249
250#define mmu_lockarea(vaddr,len) BTFIXUP_CALL(mmu_lockarea)(vaddr,len)
251#define mmu_unlockarea(vaddr,len) BTFIXUP_CALL(mmu_unlockarea)(vaddr,len)
252
253/* These are implementations for sbus_map_sg/sbus_unmap_sg... collapse later */
254BTFIXUPDEF_CALL(__u32, mmu_get_scsi_one, char *, unsigned long, struct sbus_bus *sbus)
255BTFIXUPDEF_CALL(void, mmu_get_scsi_sgl, struct scatterlist *, int, struct sbus_bus *sbus)
256BTFIXUPDEF_CALL(void, mmu_release_scsi_one, __u32, unsigned long, struct sbus_bus *sbus)
257BTFIXUPDEF_CALL(void, mmu_release_scsi_sgl, struct scatterlist *, int, struct sbus_bus *sbus)
258
259#define mmu_get_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_get_scsi_one)(vaddr,len,sbus)
260#define mmu_get_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_get_scsi_sgl)(sg,sz,sbus)
261#define mmu_release_scsi_one(vaddr,len,sbus) BTFIXUP_CALL(mmu_release_scsi_one)(vaddr,len,sbus)
262#define mmu_release_scsi_sgl(sg,sz,sbus) BTFIXUP_CALL(mmu_release_scsi_sgl)(sg,sz,sbus)
263
264/*
265 * mmu_map/unmap are provided by iommu/iounit; Invalid to call on IIep.
266 *
267 * The mmu_map_dma_area establishes two mappings in one go.
268 * These mappings point to pages normally mapped at 'va' (linear address).
269 * First mapping is for CPU visible address at 'a', uncached.
270 * This is an alias, but it works because it is an uncached mapping.
271 * Second mapping is for device visible address, or "bus" address.
272 * The bus address is returned at '*pba'.
273 *
274 * These functions seem distinct, but are hard to split. On sun4c,
275 * at least for now, 'a' is equal to bus address, and retured in *pba.
276 * On sun4m, page attributes depend on the CPU type, so we have to
277 * know if we are mapping RAM or I/O, so it has to be an additional argument
278 * to a separate mapping function for CPU visible mappings.
279 */
280BTFIXUPDEF_CALL(int, mmu_map_dma_area, dma_addr_t *, unsigned long, unsigned long, int len)
281BTFIXUPDEF_CALL(struct page *, mmu_translate_dvma, unsigned long busa)
282BTFIXUPDEF_CALL(void, mmu_unmap_dma_area, unsigned long busa, int len)
283
284#define mmu_map_dma_area(pba,va,a,len) BTFIXUP_CALL(mmu_map_dma_area)(pba,va,a,len)
285#define mmu_unmap_dma_area(ba,len) BTFIXUP_CALL(mmu_unmap_dma_area)(ba,len)
286#define mmu_translate_dvma(ba) BTFIXUP_CALL(mmu_translate_dvma)(ba)
287
288#endif /* !(_ASM_SPARC_DMA_H) */
diff --git a/include/asm-sparc/dma_64.h b/include/asm-sparc/dma_64.h
deleted file mode 100644
index 9d4c024bd3b3..000000000000
--- a/include/asm-sparc/dma_64.h
+++ /dev/null
@@ -1,205 +0,0 @@
1/*
2 * include/asm-sparc64/dma.h
3 *
4 * Copyright 1996 (C) David S. Miller (davem@caip.rutgers.edu)
5 */
6
7#ifndef _ASM_SPARC64_DMA_H
8#define _ASM_SPARC64_DMA_H
9
10#include <linux/kernel.h>
11#include <linux/types.h>
12#include <linux/spinlock.h>
13
14#include <asm/sbus.h>
15#include <asm/delay.h>
16#include <asm/oplib.h>
17
18/* These are irrelevant for Sparc DMA, but we leave it in so that
19 * things can compile.
20 */
21#define MAX_DMA_CHANNELS 8
22#define DMA_MODE_READ 1
23#define DMA_MODE_WRITE 2
24#define MAX_DMA_ADDRESS (~0UL)
25
26/* Useful constants */
27#define SIZE_16MB (16*1024*1024)
28#define SIZE_64K (64*1024)
29
30/* SBUS DMA controller reg offsets */
31#define DMA_CSR 0x00UL /* rw DMA control/status register 0x00 */
32#define DMA_ADDR 0x04UL /* rw DMA transfer address register 0x04 */
33#define DMA_COUNT 0x08UL /* rw DMA transfer count register 0x08 */
34#define DMA_TEST 0x0cUL /* rw DMA test/debug register 0x0c */
35
36/* DVMA chip revisions */
37enum dvma_rev {
38 dvmarev0,
39 dvmaesc1,
40 dvmarev1,
41 dvmarev2,
42 dvmarev3,
43 dvmarevplus,
44 dvmahme
45};
46
47#define DMA_HASCOUNT(rev) ((rev)==dvmaesc1)
48
49/* Linux DMA information structure, filled during probe. */
50struct sbus_dma {
51 struct sbus_dma *next;
52 struct sbus_dev *sdev;
53 void __iomem *regs;
54
55 /* Status, misc info */
56 int node; /* Prom node for this DMA device */
57 int running; /* Are we doing DMA now? */
58 int allocated; /* Are we "owned" by anyone yet? */
59
60 /* Transfer information. */
61 u32 addr; /* Start address of current transfer */
62 int nbytes; /* Size of current transfer */
63 int realbytes; /* For splitting up large transfers, etc. */
64
65 /* DMA revision */
66 enum dvma_rev revision;
67};
68
69extern struct sbus_dma *dma_chain;
70
71/* Broken hardware... */
72#define DMA_ISBROKEN(dma) ((dma)->revision == dvmarev1)
73#define DMA_ISESC1(dma) ((dma)->revision == dvmaesc1)
74
75/* Main routines in dma.c */
76extern void dvma_init(struct sbus_bus *);
77
78/* Fields in the cond_reg register */
79/* First, the version identification bits */
80#define DMA_DEVICE_ID 0xf0000000 /* Device identification bits */
81#define DMA_VERS0 0x00000000 /* Sunray DMA version */
82#define DMA_ESCV1 0x40000000 /* DMA ESC Version 1 */
83#define DMA_VERS1 0x80000000 /* DMA rev 1 */
84#define DMA_VERS2 0xa0000000 /* DMA rev 2 */
85#define DMA_VERHME 0xb0000000 /* DMA hme gate array */
86#define DMA_VERSPLUS 0x90000000 /* DMA rev 1 PLUS */
87
88#define DMA_HNDL_INTR 0x00000001 /* An IRQ needs to be handled */
89#define DMA_HNDL_ERROR 0x00000002 /* We need to take an error */
90#define DMA_FIFO_ISDRAIN 0x0000000c /* The DMA FIFO is draining */
91#define DMA_INT_ENAB 0x00000010 /* Turn on interrupts */
92#define DMA_FIFO_INV 0x00000020 /* Invalidate the FIFO */
93#define DMA_ACC_SZ_ERR 0x00000040 /* The access size was bad */
94#define DMA_FIFO_STDRAIN 0x00000040 /* DMA_VERS1 Drain the FIFO */
95#define DMA_RST_SCSI 0x00000080 /* Reset the SCSI controller */
96#define DMA_RST_ENET DMA_RST_SCSI /* Reset the ENET controller */
97#define DMA_ST_WRITE 0x00000100 /* write from device to memory */
98#define DMA_ENABLE 0x00000200 /* Fire up DMA, handle requests */
99#define DMA_PEND_READ 0x00000400 /* DMA_VERS1/0/PLUS Pending Read */
100#define DMA_ESC_BURST 0x00000800 /* 1=16byte 0=32byte */
101#define DMA_READ_AHEAD 0x00001800 /* DMA read ahead partial longword */
102#define DMA_DSBL_RD_DRN 0x00001000 /* No EC drain on slave reads */
103#define DMA_BCNT_ENAB 0x00002000 /* If on, use the byte counter */
104#define DMA_TERM_CNTR 0x00004000 /* Terminal counter */
105#define DMA_SCSI_SBUS64 0x00008000 /* HME: Enable 64-bit SBUS mode. */
106#define DMA_CSR_DISAB 0x00010000 /* No FIFO drains during csr */
107#define DMA_SCSI_DISAB 0x00020000 /* No FIFO drains during reg */
108#define DMA_DSBL_WR_INV 0x00020000 /* No EC inval. on slave writes */
109#define DMA_ADD_ENABLE 0x00040000 /* Special ESC DVMA optimization */
110#define DMA_E_BURSTS 0x000c0000 /* ENET: SBUS r/w burst mask */
111#define DMA_E_BURST32 0x00040000 /* ENET: SBUS 32 byte r/w burst */
112#define DMA_E_BURST16 0x00000000 /* ENET: SBUS 16 byte r/w burst */
113#define DMA_BRST_SZ 0x000c0000 /* SCSI: SBUS r/w burst size */
114#define DMA_BRST64 0x000c0000 /* SCSI: 64byte bursts (HME on UltraSparc only) */
115#define DMA_BRST32 0x00040000 /* SCSI: 32byte bursts */
116#define DMA_BRST16 0x00000000 /* SCSI: 16byte bursts */
117#define DMA_BRST0 0x00080000 /* SCSI: no bursts (non-HME gate arrays) */
118#define DMA_ADDR_DISAB 0x00100000 /* No FIFO drains during addr */
119#define DMA_2CLKS 0x00200000 /* Each transfer = 2 clock ticks */
120#define DMA_3CLKS 0x00400000 /* Each transfer = 3 clock ticks */
121#define DMA_EN_ENETAUI DMA_3CLKS /* Put lance into AUI-cable mode */
122#define DMA_CNTR_DISAB 0x00800000 /* No IRQ when DMA_TERM_CNTR set */
123#define DMA_AUTO_NADDR 0x01000000 /* Use "auto nxt addr" feature */
124#define DMA_SCSI_ON 0x02000000 /* Enable SCSI dma */
125#define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */
126#define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */
127#define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */
128#define DMA_RESET_FAS366 0x08000000 /* HME: Assert RESET to FAS366 */
129
130/* Values describing the burst-size property from the PROM */
131#define DMA_BURST1 0x01
132#define DMA_BURST2 0x02
133#define DMA_BURST4 0x04
134#define DMA_BURST8 0x08
135#define DMA_BURST16 0x10
136#define DMA_BURST32 0x20
137#define DMA_BURST64 0x40
138#define DMA_BURSTBITS 0x7f
139
140/* Determine highest possible final transfer address given a base */
141#define DMA_MAXEND(addr) (0x01000000UL-(((unsigned long)(addr))&0x00ffffffUL))
142
143/* Yes, I hack a lot of elisp in my spare time... */
144#define DMA_ERROR_P(regs) ((sbus_readl((regs) + DMA_CSR) & DMA_HNDL_ERROR))
145#define DMA_IRQ_P(regs) ((sbus_readl((regs) + DMA_CSR)) & (DMA_HNDL_INTR | DMA_HNDL_ERROR))
146#define DMA_WRITE_P(regs) ((sbus_readl((regs) + DMA_CSR) & DMA_ST_WRITE))
147#define DMA_OFF(__regs) \
148do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
149 tmp &= ~DMA_ENABLE; \
150 sbus_writel(tmp, (__regs) + DMA_CSR); \
151} while(0)
152#define DMA_INTSOFF(__regs) \
153do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
154 tmp &= ~DMA_INT_ENAB; \
155 sbus_writel(tmp, (__regs) + DMA_CSR); \
156} while(0)
157#define DMA_INTSON(__regs) \
158do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
159 tmp |= DMA_INT_ENAB; \
160 sbus_writel(tmp, (__regs) + DMA_CSR); \
161} while(0)
162#define DMA_PUNTFIFO(__regs) \
163do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
164 tmp |= DMA_FIFO_INV; \
165 sbus_writel(tmp, (__regs) + DMA_CSR); \
166} while(0)
167#define DMA_SETSTART(__regs, __addr) \
168 sbus_writel((u32)(__addr), (__regs) + DMA_ADDR);
169#define DMA_BEGINDMA_W(__regs) \
170do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
171 tmp |= (DMA_ST_WRITE|DMA_ENABLE|DMA_INT_ENAB); \
172 sbus_writel(tmp, (__regs) + DMA_CSR); \
173} while(0)
174#define DMA_BEGINDMA_R(__regs) \
175do { u32 tmp = sbus_readl((__regs) + DMA_CSR); \
176 tmp |= (DMA_ENABLE|DMA_INT_ENAB); \
177 tmp &= ~DMA_ST_WRITE; \
178 sbus_writel(tmp, (__regs) + DMA_CSR); \
179} while(0)
180
181/* For certain DMA chips, we need to disable ints upon irq entry
182 * and turn them back on when we are done. So in any ESP interrupt
183 * handler you *must* call DMA_IRQ_ENTRY upon entry and DMA_IRQ_EXIT
184 * when leaving the handler. You have been warned...
185 */
186#define DMA_IRQ_ENTRY(dma, dregs) do { \
187 if(DMA_ISBROKEN(dma)) DMA_INTSOFF(dregs); \
188 } while (0)
189
190#define DMA_IRQ_EXIT(dma, dregs) do { \
191 if(DMA_ISBROKEN(dma)) DMA_INTSON(dregs); \
192 } while(0)
193
194#define for_each_dvma(dma) \
195 for((dma) = dma_chain; (dma); (dma) = (dma)->next)
196
197/* From PCI */
198
199#ifdef CONFIG_PCI
200extern int isa_dma_bridge_buggy;
201#else
202#define isa_dma_bridge_buggy (0)
203#endif
204
205#endif /* !(_ASM_SPARC64_DMA_H) */
diff --git a/include/asm-sparc/ebus.h b/include/asm-sparc/ebus.h
deleted file mode 100644
index a5da2d00cd18..000000000000
--- a/include/asm-sparc/ebus.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_EBUS_H
2#define ___ASM_SPARC_EBUS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/ebus_64.h>
5#else
6#include <asm-sparc/ebus_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h
deleted file mode 100644
index f035c45d7b5e..000000000000
--- a/include/asm-sparc/elf.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_ELF_H
2#define ___ASM_SPARC_ELF_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/elf_64.h>
5#else
6#include <asm-sparc/elf_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/floppy.h b/include/asm-sparc/floppy.h
deleted file mode 100644
index 6c628ba15a8d..000000000000
--- a/include/asm-sparc/floppy.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_FLOPPY_H
2#define ___ASM_SPARC_FLOPPY_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/floppy_64.h>
5#else
6#include <asm-sparc/floppy_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/floppy_32.h b/include/asm-sparc/floppy_32.h
deleted file mode 100644
index acdd06eafe59..000000000000
--- a/include/asm-sparc/floppy_32.h
+++ /dev/null
@@ -1,388 +0,0 @@
1/* asm-sparc/floppy.h: Sparc specific parts of the Floppy driver.
2 *
3 * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
4 */
5
6#ifndef __ASM_SPARC_FLOPPY_H
7#define __ASM_SPARC_FLOPPY_H
8
9#include <asm/page.h>
10#include <asm/pgtable.h>
11#include <asm/system.h>
12#include <asm/idprom.h>
13#include <asm/machines.h>
14#include <asm/oplib.h>
15#include <asm/auxio.h>
16#include <asm/irq.h>
17
18/* We don't need no stinkin' I/O port allocation crap. */
19#undef release_region
20#undef request_region
21#define release_region(X, Y) do { } while(0)
22#define request_region(X, Y, Z) (1)
23
24/* References:
25 * 1) Netbsd Sun floppy driver.
26 * 2) NCR 82077 controller manual
27 * 3) Intel 82077 controller manual
28 */
29struct sun_flpy_controller {
30 volatile unsigned char status_82072; /* Main Status reg. */
31#define dcr_82072 status_82072 /* Digital Control reg. */
32#define status1_82077 status_82072 /* Auxiliary Status reg. 1 */
33
34 volatile unsigned char data_82072; /* Data fifo. */
35#define status2_82077 data_82072 /* Auxiliary Status reg. 2 */
36
37 volatile unsigned char dor_82077; /* Digital Output reg. */
38 volatile unsigned char tapectl_82077; /* What the? Tape control reg? */
39
40 volatile unsigned char status_82077; /* Main Status Register. */
41#define drs_82077 status_82077 /* Digital Rate Select reg. */
42
43 volatile unsigned char data_82077; /* Data fifo. */
44 volatile unsigned char ___unused;
45 volatile unsigned char dir_82077; /* Digital Input reg. */
46#define dcr_82077 dir_82077 /* Config Control reg. */
47};
48
49/* You'll only ever find one controller on a SparcStation anyways. */
50static struct sun_flpy_controller *sun_fdc = NULL;
51extern volatile unsigned char *fdc_status;
52
53struct sun_floppy_ops {
54 unsigned char (*fd_inb)(int port);
55 void (*fd_outb)(unsigned char value, int port);
56};
57
58static struct sun_floppy_ops sun_fdops;
59
60#define fd_inb(port) sun_fdops.fd_inb(port)
61#define fd_outb(value,port) sun_fdops.fd_outb(value,port)
62#define fd_enable_dma() sun_fd_enable_dma()
63#define fd_disable_dma() sun_fd_disable_dma()
64#define fd_request_dma() (0) /* nothing... */
65#define fd_free_dma() /* nothing... */
66#define fd_clear_dma_ff() /* nothing... */
67#define fd_set_dma_mode(mode) sun_fd_set_dma_mode(mode)
68#define fd_set_dma_addr(addr) sun_fd_set_dma_addr(addr)
69#define fd_set_dma_count(count) sun_fd_set_dma_count(count)
70#define fd_enable_irq() /* nothing... */
71#define fd_disable_irq() /* nothing... */
72#define fd_cacheflush(addr, size) /* nothing... */
73#define fd_request_irq() sun_fd_request_irq()
74#define fd_free_irq() /* nothing... */
75#if 0 /* P3: added by Alain, these cause a MMU corruption. 19960524 XXX */
76#define fd_dma_mem_alloc(size) ((unsigned long) vmalloc(size))
77#define fd_dma_mem_free(addr,size) (vfree((void *)(addr)))
78#endif
79
80/* XXX This isn't really correct. XXX */
81#define get_dma_residue(x) (0)
82
83#define FLOPPY0_TYPE 4
84#define FLOPPY1_TYPE 0
85
86/* Super paranoid... */
87#undef HAVE_DISABLE_HLT
88
89/* Here is where we catch the floppy driver trying to initialize,
90 * therefore this is where we call the PROM device tree probing
91 * routine etc. on the Sparc.
92 */
93#define FDC1 sun_floppy_init()
94
95#define N_FDC 1
96#define N_DRIVE 8
97
98/* No 64k boundary crossing problems on the Sparc. */
99#define CROSS_64KB(a,s) (0)
100
101/* Routines unique to each controller type on a Sun. */
102static void sun_set_dor(unsigned char value, int fdc_82077)
103{
104 if (sparc_cpu_model == sun4c) {
105 unsigned int bits = 0;
106 if (value & 0x10)
107 bits |= AUXIO_FLPY_DSEL;
108 if ((value & 0x80) == 0)
109 bits |= AUXIO_FLPY_EJCT;
110 set_auxio(bits, (~bits) & (AUXIO_FLPY_DSEL|AUXIO_FLPY_EJCT));
111 }
112 if (fdc_82077) {
113 sun_fdc->dor_82077 = value;
114 }
115}
116
117static unsigned char sun_read_dir(void)
118{
119 if (sparc_cpu_model == sun4c)
120 return (get_auxio() & AUXIO_FLPY_DCHG) ? 0x80 : 0;
121 else
122 return sun_fdc->dir_82077;
123}
124
125static unsigned char sun_82072_fd_inb(int port)
126{
127 udelay(5);
128 switch(port & 7) {
129 default:
130 printk("floppy: Asked to read unknown port %d\n", port);
131 panic("floppy: Port bolixed.");
132 case 4: /* FD_STATUS */
133 return sun_fdc->status_82072 & ~STATUS_DMA;
134 case 5: /* FD_DATA */
135 return sun_fdc->data_82072;
136 case 7: /* FD_DIR */
137 return sun_read_dir();
138 };
139 panic("sun_82072_fd_inb: How did I get here?");
140}
141
142static void sun_82072_fd_outb(unsigned char value, int port)
143{
144 udelay(5);
145 switch(port & 7) {
146 default:
147 printk("floppy: Asked to write to unknown port %d\n", port);
148 panic("floppy: Port bolixed.");
149 case 2: /* FD_DOR */
150 sun_set_dor(value, 0);
151 break;
152 case 5: /* FD_DATA */
153 sun_fdc->data_82072 = value;
154 break;
155 case 7: /* FD_DCR */
156 sun_fdc->dcr_82072 = value;
157 break;
158 case 4: /* FD_STATUS */
159 sun_fdc->status_82072 = value;
160 break;
161 };
162 return;
163}
164
165static unsigned char sun_82077_fd_inb(int port)
166{
167 udelay(5);
168 switch(port & 7) {
169 default:
170 printk("floppy: Asked to read unknown port %d\n", port);
171 panic("floppy: Port bolixed.");
172 case 0: /* FD_STATUS_0 */
173 return sun_fdc->status1_82077;
174 case 1: /* FD_STATUS_1 */
175 return sun_fdc->status2_82077;
176 case 2: /* FD_DOR */
177 return sun_fdc->dor_82077;
178 case 3: /* FD_TDR */
179 return sun_fdc->tapectl_82077;
180 case 4: /* FD_STATUS */
181 return sun_fdc->status_82077 & ~STATUS_DMA;
182 case 5: /* FD_DATA */
183 return sun_fdc->data_82077;
184 case 7: /* FD_DIR */
185 return sun_read_dir();
186 };
187 panic("sun_82077_fd_inb: How did I get here?");
188}
189
190static void sun_82077_fd_outb(unsigned char value, int port)
191{
192 udelay(5);
193 switch(port & 7) {
194 default:
195 printk("floppy: Asked to write to unknown port %d\n", port);
196 panic("floppy: Port bolixed.");
197 case 2: /* FD_DOR */
198 sun_set_dor(value, 1);
199 break;
200 case 5: /* FD_DATA */
201 sun_fdc->data_82077 = value;
202 break;
203 case 7: /* FD_DCR */
204 sun_fdc->dcr_82077 = value;
205 break;
206 case 4: /* FD_STATUS */
207 sun_fdc->status_82077 = value;
208 break;
209 case 3: /* FD_TDR */
210 sun_fdc->tapectl_82077 = value;
211 break;
212 };
213 return;
214}
215
216/* For pseudo-dma (Sun floppy drives have no real DMA available to
217 * them so we must eat the data fifo bytes directly ourselves) we have
218 * three state variables. doing_pdma tells our inline low-level
219 * assembly floppy interrupt entry point whether it should sit and eat
220 * bytes from the fifo or just transfer control up to the higher level
221 * floppy interrupt c-code. I tried very hard but I could not get the
222 * pseudo-dma to work in c-code without getting many overruns and
223 * underruns. If non-zero, doing_pdma encodes the direction of
224 * the transfer for debugging. 1=read 2=write
225 */
226extern char *pdma_vaddr;
227extern unsigned long pdma_size;
228extern volatile int doing_pdma;
229
230/* This is software state */
231extern char *pdma_base;
232extern unsigned long pdma_areasize;
233
234/* Common routines to all controller types on the Sparc. */
235static inline void virtual_dma_init(void)
236{
237 /* nothing... */
238}
239
240static inline void sun_fd_disable_dma(void)
241{
242 doing_pdma = 0;
243 if (pdma_base) {
244 mmu_unlockarea(pdma_base, pdma_areasize);
245 pdma_base = NULL;
246 }
247}
248
249static inline void sun_fd_set_dma_mode(int mode)
250{
251 switch(mode) {
252 case DMA_MODE_READ:
253 doing_pdma = 1;
254 break;
255 case DMA_MODE_WRITE:
256 doing_pdma = 2;
257 break;
258 default:
259 printk("Unknown dma mode %d\n", mode);
260 panic("floppy: Giving up...");
261 }
262}
263
264static inline void sun_fd_set_dma_addr(char *buffer)
265{
266 pdma_vaddr = buffer;
267}
268
269static inline void sun_fd_set_dma_count(int length)
270{
271 pdma_size = length;
272}
273
274static inline void sun_fd_enable_dma(void)
275{
276 pdma_vaddr = mmu_lockarea(pdma_vaddr, pdma_size);
277 pdma_base = pdma_vaddr;
278 pdma_areasize = pdma_size;
279}
280
281/* Our low-level entry point in arch/sparc/kernel/entry.S */
282extern int sparc_floppy_request_irq(int irq, unsigned long flags,
283 irq_handler_t irq_handler);
284
285static int sun_fd_request_irq(void)
286{
287 static int once = 0;
288 int error;
289
290 if(!once) {
291 once = 1;
292 error = sparc_floppy_request_irq(FLOPPY_IRQ,
293 IRQF_DISABLED,
294 floppy_interrupt);
295 return ((error == 0) ? 0 : -1);
296 } else return 0;
297}
298
299static struct linux_prom_registers fd_regs[2];
300
301static int sun_floppy_init(void)
302{
303 char state[128];
304 int tnode, fd_node, num_regs;
305 struct resource r;
306
307 use_virtual_dma = 1;
308
309 FLOPPY_IRQ = 11;
310 /* Forget it if we aren't on a machine that could possibly
311 * ever have a floppy drive.
312 */
313 if((sparc_cpu_model != sun4c && sparc_cpu_model != sun4m) ||
314 ((idprom->id_machtype == (SM_SUN4C | SM_4C_SLC)) ||
315 (idprom->id_machtype == (SM_SUN4C | SM_4C_ELC)))) {
316 /* We certainly don't have a floppy controller. */
317 goto no_sun_fdc;
318 }
319 /* Well, try to find one. */
320 tnode = prom_getchild(prom_root_node);
321 fd_node = prom_searchsiblings(tnode, "obio");
322 if(fd_node != 0) {
323 tnode = prom_getchild(fd_node);
324 fd_node = prom_searchsiblings(tnode, "SUNW,fdtwo");
325 } else {
326 fd_node = prom_searchsiblings(tnode, "fd");
327 }
328 if(fd_node == 0) {
329 goto no_sun_fdc;
330 }
331
332 /* The sun4m lets us know if the controller is actually usable. */
333 if(sparc_cpu_model == sun4m &&
334 prom_getproperty(fd_node, "status", state, sizeof(state)) != -1) {
335 if(!strcmp(state, "disabled")) {
336 goto no_sun_fdc;
337 }
338 }
339 num_regs = prom_getproperty(fd_node, "reg", (char *) fd_regs, sizeof(fd_regs));
340 num_regs = (num_regs / sizeof(fd_regs[0]));
341 prom_apply_obio_ranges(fd_regs, num_regs);
342 memset(&r, 0, sizeof(r));
343 r.flags = fd_regs[0].which_io;
344 r.start = fd_regs[0].phys_addr;
345 sun_fdc = (struct sun_flpy_controller *)
346 sbus_ioremap(&r, 0, fd_regs[0].reg_size, "floppy");
347
348 /* Last minute sanity check... */
349 if(sun_fdc->status_82072 == 0xff) {
350 sun_fdc = NULL;
351 goto no_sun_fdc;
352 }
353
354 sun_fdops.fd_inb = sun_82077_fd_inb;
355 sun_fdops.fd_outb = sun_82077_fd_outb;
356 fdc_status = &sun_fdc->status_82077;
357
358 if (sun_fdc->dor_82077 == 0x80) {
359 sun_fdc->dor_82077 = 0x02;
360 if (sun_fdc->dor_82077 == 0x80) {
361 sun_fdops.fd_inb = sun_82072_fd_inb;
362 sun_fdops.fd_outb = sun_82072_fd_outb;
363 fdc_status = &sun_fdc->status_82072;
364 }
365 }
366
367 /* Success... */
368 allowed_drive_mask = 0x01;
369 return (int) sun_fdc;
370
371no_sun_fdc:
372 return -1;
373}
374
375static int sparc_eject(void)
376{
377 set_dor(0x00, 0xff, 0x90);
378 udelay(500);
379 set_dor(0x00, 0x6f, 0x00);
380 udelay(500);
381 return 0;
382}
383
384#define fd_eject(drive) sparc_eject()
385
386#define EXTRA_FLOPPY_PARAMS
387
388#endif /* !(__ASM_SPARC_FLOPPY_H) */
diff --git a/include/asm-sparc/futex.h b/include/asm-sparc/futex.h
deleted file mode 100644
index c6a9f038c531..000000000000
--- a/include/asm-sparc/futex.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_FUTEX_H
2#define ___ASM_SPARC_FUTEX_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/futex_64.h>
5#else
6#include <asm-sparc/futex_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/hardirq.h b/include/asm-sparc/hardirq.h
deleted file mode 100644
index 156478773100..000000000000
--- a/include/asm-sparc/hardirq.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_HARDIRQ_H
2#define ___ASM_SPARC_HARDIRQ_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/hardirq_64.h>
5#else
6#include <asm-sparc/hardirq_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/head.h b/include/asm-sparc/head.h
deleted file mode 100644
index 14652abdea31..000000000000
--- a/include/asm-sparc/head.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_HEAD_H
2#define ___ASM_SPARC_HEAD_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/head_64.h>
5#else
6#include <asm-sparc/head_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/io.h b/include/asm-sparc/io.h
deleted file mode 100644
index fc9024d3dfc3..000000000000
--- a/include/asm-sparc/io.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_IO_H
2#define ___ASM_SPARC_IO_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/io_64.h>
5#else
6#include <asm-sparc/io_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/iommu.h b/include/asm-sparc/iommu.h
deleted file mode 100644
index 91b072b0d7a0..000000000000
--- a/include/asm-sparc/iommu.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_IOMMU_H
2#define ___ASM_SPARC_IOMMU_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/iommu_64.h>
5#else
6#include <asm-sparc/iommu_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/ipcbuf.h b/include/asm-sparc/ipcbuf.h
deleted file mode 100644
index 037605d986e2..000000000000
--- a/include/asm-sparc/ipcbuf.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_IPCBUF_H
2#define ___ASM_SPARC_IPCBUF_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/ipcbuf_64.h>
5#else
6#include <asm-sparc/ipcbuf_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h
deleted file mode 100644
index 7af6bb4aa09c..000000000000
--- a/include/asm-sparc/irq.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_IRQ_H
2#define ___ASM_SPARC_IRQ_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/irq_64.h>
5#else
6#include <asm-sparc/irq_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/irqflags.h b/include/asm-sparc/irqflags.h
deleted file mode 100644
index c6402b187e23..000000000000
--- a/include/asm-sparc/irqflags.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_IRQFLAGS_H
2#define ___ASM_SPARC_IRQFLAGS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/irqflags_64.h>
5#else
6#include <asm-sparc/irqflags_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/irqflags_32.h b/include/asm-sparc/irqflags_32.h
deleted file mode 100644
index db398fb32826..000000000000
--- a/include/asm-sparc/irqflags_32.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * include/asm-sparc/irqflags.h
3 *
4 * IRQ flags handling
5 *
6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers.
9 */
10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H
12
13#ifndef __ASSEMBLY__
14
15extern void raw_local_irq_restore(unsigned long);
16extern unsigned long __raw_local_irq_save(void);
17extern void raw_local_irq_enable(void);
18
19static inline unsigned long getipl(void)
20{
21 unsigned long retval;
22
23 __asm__ __volatile__("rd %%psr, %0" : "=r" (retval));
24 return retval;
25}
26
27#define raw_local_save_flags(flags) ((flags) = getipl())
28#define raw_local_irq_save(flags) ((flags) = __raw_local_irq_save())
29#define raw_local_irq_disable() ((void) __raw_local_irq_save())
30#define raw_irqs_disabled() ((getipl() & PSR_PIL) != 0)
31
32static inline int raw_irqs_disabled_flags(unsigned long flags)
33{
34 return ((flags & PSR_PIL) != 0);
35}
36
37#endif /* (__ASSEMBLY__) */
38
39#endif /* !(_ASM_IRQFLAGS_H) */
diff --git a/include/asm-sparc/irqflags_64.h b/include/asm-sparc/irqflags_64.h
deleted file mode 100644
index 024fc54d0682..000000000000
--- a/include/asm-sparc/irqflags_64.h
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * include/asm-sparc64/irqflags.h
3 *
4 * IRQ flags handling
5 *
6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers.
9 */
10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H
12
13#ifndef __ASSEMBLY__
14
15static inline unsigned long __raw_local_save_flags(void)
16{
17 unsigned long flags;
18
19 __asm__ __volatile__(
20 "rdpr %%pil, %0"
21 : "=r" (flags)
22 );
23
24 return flags;
25}
26
27#define raw_local_save_flags(flags) \
28 do { (flags) = __raw_local_save_flags(); } while (0)
29
30static inline void raw_local_irq_restore(unsigned long flags)
31{
32 __asm__ __volatile__(
33 "wrpr %0, %%pil"
34 : /* no output */
35 : "r" (flags)
36 : "memory"
37 );
38}
39
40static inline void raw_local_irq_disable(void)
41{
42 __asm__ __volatile__(
43 "wrpr 15, %%pil"
44 : /* no outputs */
45 : /* no inputs */
46 : "memory"
47 );
48}
49
50static inline void raw_local_irq_enable(void)
51{
52 __asm__ __volatile__(
53 "wrpr 0, %%pil"
54 : /* no outputs */
55 : /* no inputs */
56 : "memory"
57 );
58}
59
60static inline int raw_irqs_disabled_flags(unsigned long flags)
61{
62 return (flags > 0);
63}
64
65static inline int raw_irqs_disabled(void)
66{
67 unsigned long flags = __raw_local_save_flags();
68
69 return raw_irqs_disabled_flags(flags);
70}
71
72/*
73 * For spinlocks, etc:
74 */
75static inline unsigned long __raw_local_irq_save(void)
76{
77 unsigned long flags = __raw_local_save_flags();
78
79 raw_local_irq_disable();
80
81 return flags;
82}
83
84#define raw_local_irq_save(flags) \
85 do { (flags) = __raw_local_irq_save(); } while (0)
86
87#endif /* (__ASSEMBLY__) */
88
89#endif /* !(_ASM_IRQFLAGS_H) */
diff --git a/include/asm-sparc/kdebug.h b/include/asm-sparc/kdebug.h
deleted file mode 100644
index fe07d00d0534..000000000000
--- a/include/asm-sparc/kdebug.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_KDEBUG_H
2#define ___ASM_SPARC_KDEBUG_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/kdebug_64.h>
5#else
6#include <asm-sparc/kdebug_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/mc146818rtc.h b/include/asm-sparc/mc146818rtc.h
deleted file mode 100644
index 9ab65c21e9e4..000000000000
--- a/include/asm-sparc/mc146818rtc.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_MC146818RTC_H
2#define ___ASM_SPARC_MC146818RTC_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/mc146818rtc_64.h>
5#else
6#include <asm-sparc/mc146818rtc_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/mmu.h b/include/asm-sparc/mmu.h
deleted file mode 100644
index ee66bf6dcbd6..000000000000
--- a/include/asm-sparc/mmu.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_MMU_H
2#define ___ASM_SPARC_MMU_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/mmu_64.h>
5#else
6#include <asm-sparc/mmu_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/mmu_context.h b/include/asm-sparc/mmu_context.h
deleted file mode 100644
index e14efb9532ff..000000000000
--- a/include/asm-sparc/mmu_context.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_MMU_CONTEXT_H
2#define ___ASM_SPARC_MMU_CONTEXT_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/mmu_context_64.h>
5#else
6#include <asm-sparc/mmu_context_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/module.h b/include/asm-sparc/module.h
deleted file mode 100644
index 516138fe681a..000000000000
--- a/include/asm-sparc/module.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_MODULE_H
2#define ___ASM_SPARC_MODULE_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/module_64.h>
5#else
6#include <asm-sparc/module_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/mostek.h b/include/asm-sparc/mostek.h
deleted file mode 100644
index 5b9f7fec7ee7..000000000000
--- a/include/asm-sparc/mostek.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_MOSTEK_H
2#define ___ASM_SPARC_MOSTEK_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/mostek_64.h>
5#else
6#include <asm-sparc/mostek_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/of_platform.h b/include/asm-sparc/of_platform.h
deleted file mode 100644
index 851eb84d737e..000000000000
--- a/include/asm-sparc/of_platform.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_OF_PLATFORM_H
2#define ___ASM_SPARC_OF_PLATFORM_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/of_platform_64.h>
5#else
6#include <asm-sparc/of_platform_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/of_platform_32.h b/include/asm-sparc/of_platform_32.h
deleted file mode 100644
index 38334351c36b..000000000000
--- a/include/asm-sparc/of_platform_32.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef _ASM_SPARC_OF_PLATFORM_H
2#define _ASM_SPARC_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 * Modified for Sparc by merging parts of asm-sparc/of_device.h
7 * by Stephen Rothwell
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
15
16/* This is just here during the transition */
17#include <linux/of_platform.h>
18
19extern struct bus_type ebus_bus_type;
20extern struct bus_type sbus_bus_type;
21
22#define of_bus_type of_platform_bus_type /* for compatibility */
23
24#endif /* _ASM_SPARC_OF_PLATFORM_H */
diff --git a/include/asm-sparc/of_platform_64.h b/include/asm-sparc/of_platform_64.h
deleted file mode 100644
index 78aa032b674c..000000000000
--- a/include/asm-sparc/of_platform_64.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef _ASM_SPARC64_OF_PLATFORM_H
2#define _ASM_SPARC64_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 * Modified for Sparc by merging parts of asm-sparc/of_device.h
7 * by Stephen Rothwell
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
15
16/* This is just here during the transition */
17#include <linux/of_platform.h>
18
19extern struct bus_type isa_bus_type;
20extern struct bus_type ebus_bus_type;
21extern struct bus_type sbus_bus_type;
22
23#define of_bus_type of_platform_bus_type /* for compatibility */
24
25#endif /* _ASM_SPARC64_OF_PLATFORM_H */
diff --git a/include/asm-sparc/openprom.h b/include/asm-sparc/openprom.h
deleted file mode 100644
index 8c349f061994..000000000000
--- a/include/asm-sparc/openprom.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_OPENPROM_H
2#define ___ASM_SPARC_OPENPROM_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/openprom_64.h>
5#else
6#include <asm-sparc/openprom_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/oplib.h b/include/asm-sparc/oplib.h
deleted file mode 100644
index e88d7c04a292..000000000000
--- a/include/asm-sparc/oplib.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_OPLIB_H
2#define ___ASM_SPARC_OPLIB_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/oplib_64.h>
5#else
6#include <asm-sparc/oplib_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h
deleted file mode 100644
index f32f49fcf75c..000000000000
--- a/include/asm-sparc/page.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_PAGE_H
2#define ___ASM_SPARC_PAGE_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/page_64.h>
5#else
6#include <asm-sparc/page_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h
deleted file mode 100644
index b807d52a4809..000000000000
--- a/include/asm-sparc/pci.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_PCI_H
2#define ___ASM_SPARC_PCI_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/pci_64.h>
5#else
6#include <asm-sparc/pci_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/percpu.h b/include/asm-sparc/percpu.h
deleted file mode 100644
index d98ed6cf2e36..000000000000
--- a/include/asm-sparc/percpu.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_PERCPU_H
2#define ___ASM_SPARC_PERCPU_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/percpu_64.h>
5#else
6#include <asm-sparc/percpu_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/pgalloc.h b/include/asm-sparc/pgalloc.h
deleted file mode 100644
index 7fa02b53d392..000000000000
--- a/include/asm-sparc/pgalloc.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_PGALLOC_H
2#define ___ASM_SPARC_PGALLOC_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/pgalloc_64.h>
5#else
6#include <asm-sparc/pgalloc_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
deleted file mode 100644
index 63cdef53bc52..000000000000
--- a/include/asm-sparc/pgtable.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_PGTABLE_H
2#define ___ASM_SPARC_PGTABLE_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/pgtable_64.h>
5#else
6#include <asm-sparc/pgtable_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/pgtable_32.h b/include/asm-sparc/pgtable_32.h
deleted file mode 100644
index 781bd4694a1c..000000000000
--- a/include/asm-sparc/pgtable_32.h
+++ /dev/null
@@ -1,480 +0,0 @@
1#ifndef _SPARC_PGTABLE_H
2#define _SPARC_PGTABLE_H
3
4/* asm-sparc/pgtable.h: Defines and functions used to work
5 * with Sparc page tables.
6 *
7 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
8 * Copyright (C) 1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
9 */
10
11#ifndef __ASSEMBLY__
12#include <asm-generic/4level-fixup.h>
13
14#include <linux/spinlock.h>
15#include <linux/swap.h>
16#include <asm/types.h>
17#ifdef CONFIG_SUN4
18#include <asm/pgtsun4.h>
19#else
20#include <asm/pgtsun4c.h>
21#endif
22#include <asm/pgtsrmmu.h>
23#include <asm/vac-ops.h>
24#include <asm/oplib.h>
25#include <asm/btfixup.h>
26#include <asm/system.h>
27
28
29struct vm_area_struct;
30struct page;
31
32extern void load_mmu(void);
33extern unsigned long calc_highpages(void);
34
35BTFIXUPDEF_SIMM13(pgdir_shift)
36BTFIXUPDEF_SETHI(pgdir_size)
37BTFIXUPDEF_SETHI(pgdir_mask)
38
39BTFIXUPDEF_SIMM13(ptrs_per_pmd)
40BTFIXUPDEF_SIMM13(ptrs_per_pgd)
41BTFIXUPDEF_SIMM13(user_ptrs_per_pgd)
42
43#define pte_ERROR(e) __builtin_trap()
44#define pmd_ERROR(e) __builtin_trap()
45#define pgd_ERROR(e) __builtin_trap()
46
47BTFIXUPDEF_INT(page_none)
48BTFIXUPDEF_INT(page_copy)
49BTFIXUPDEF_INT(page_readonly)
50BTFIXUPDEF_INT(page_kernel)
51
52#define PMD_SHIFT SUN4C_PMD_SHIFT
53#define PMD_SIZE (1UL << PMD_SHIFT)
54#define PMD_MASK (~(PMD_SIZE-1))
55#define PMD_ALIGN(__addr) (((__addr) + ~PMD_MASK) & PMD_MASK)
56#define PGDIR_SHIFT BTFIXUP_SIMM13(pgdir_shift)
57#define PGDIR_SIZE BTFIXUP_SETHI(pgdir_size)
58#define PGDIR_MASK BTFIXUP_SETHI(pgdir_mask)
59#define PTRS_PER_PTE 1024
60#define PTRS_PER_PMD BTFIXUP_SIMM13(ptrs_per_pmd)
61#define PTRS_PER_PGD BTFIXUP_SIMM13(ptrs_per_pgd)
62#define USER_PTRS_PER_PGD BTFIXUP_SIMM13(user_ptrs_per_pgd)
63#define FIRST_USER_ADDRESS 0
64#define PTE_SIZE (PTRS_PER_PTE*4)
65
66#define PAGE_NONE __pgprot(BTFIXUP_INT(page_none))
67extern pgprot_t PAGE_SHARED;
68#define PAGE_COPY __pgprot(BTFIXUP_INT(page_copy))
69#define PAGE_READONLY __pgprot(BTFIXUP_INT(page_readonly))
70
71extern unsigned long page_kernel;
72
73#ifdef MODULE
74#define PAGE_KERNEL page_kernel
75#else
76#define PAGE_KERNEL __pgprot(BTFIXUP_INT(page_kernel))
77#endif
78
79/* Top-level page directory */
80extern pgd_t swapper_pg_dir[1024];
81
82extern void paging_init(void);
83
84/* Page table for 0-4MB for everybody, on the Sparc this
85 * holds the same as on the i386.
86 */
87extern pte_t pg0[1024];
88extern pte_t pg1[1024];
89extern pte_t pg2[1024];
90extern pte_t pg3[1024];
91
92extern unsigned long ptr_in_current_pgd;
93
94/* Here is a trick, since mmap.c need the initializer elements for
95 * protection_map[] to be constant at compile time, I set the following
96 * to all zeros. I set it to the real values after I link in the
97 * appropriate MMU page table routines at boot time.
98 */
99#define __P000 __pgprot(0)
100#define __P001 __pgprot(0)
101#define __P010 __pgprot(0)
102#define __P011 __pgprot(0)
103#define __P100 __pgprot(0)
104#define __P101 __pgprot(0)
105#define __P110 __pgprot(0)
106#define __P111 __pgprot(0)
107
108#define __S000 __pgprot(0)
109#define __S001 __pgprot(0)
110#define __S010 __pgprot(0)
111#define __S011 __pgprot(0)
112#define __S100 __pgprot(0)
113#define __S101 __pgprot(0)
114#define __S110 __pgprot(0)
115#define __S111 __pgprot(0)
116
117extern int num_contexts;
118
119/* First physical page can be anywhere, the following is needed so that
120 * va-->pa and vice versa conversions work properly without performance
121 * hit for all __pa()/__va() operations.
122 */
123extern unsigned long phys_base;
124extern unsigned long pfn_base;
125
126/*
127 * BAD_PAGETABLE is used when we need a bogus page-table, while
128 * BAD_PAGE is used for a bogus page.
129 *
130 * ZERO_PAGE is a global shared page that is always zero: used
131 * for zero-mapped memory areas etc..
132 */
133extern pte_t * __bad_pagetable(void);
134extern pte_t __bad_page(void);
135extern unsigned long empty_zero_page;
136
137#define BAD_PAGETABLE __bad_pagetable()
138#define BAD_PAGE __bad_page()
139#define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page))
140
141/*
142 */
143BTFIXUPDEF_CALL_CONST(struct page *, pmd_page, pmd_t)
144BTFIXUPDEF_CALL_CONST(unsigned long, pgd_page_vaddr, pgd_t)
145
146#define pmd_page(pmd) BTFIXUP_CALL(pmd_page)(pmd)
147#define pgd_page_vaddr(pgd) BTFIXUP_CALL(pgd_page_vaddr)(pgd)
148
149BTFIXUPDEF_SETHI(none_mask)
150BTFIXUPDEF_CALL_CONST(int, pte_present, pte_t)
151BTFIXUPDEF_CALL(void, pte_clear, pte_t *)
152
153static inline int pte_none(pte_t pte)
154{
155 return !(pte_val(pte) & ~BTFIXUP_SETHI(none_mask));
156}
157
158#define pte_present(pte) BTFIXUP_CALL(pte_present)(pte)
159#define pte_clear(mm,addr,pte) BTFIXUP_CALL(pte_clear)(pte)
160
161BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t)
162BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t)
163BTFIXUPDEF_CALL(void, pmd_clear, pmd_t *)
164
165static inline int pmd_none(pmd_t pmd)
166{
167 return !(pmd_val(pmd) & ~BTFIXUP_SETHI(none_mask));
168}
169
170#define pmd_bad(pmd) BTFIXUP_CALL(pmd_bad)(pmd)
171#define pmd_present(pmd) BTFIXUP_CALL(pmd_present)(pmd)
172#define pmd_clear(pmd) BTFIXUP_CALL(pmd_clear)(pmd)
173
174BTFIXUPDEF_CALL_CONST(int, pgd_none, pgd_t)
175BTFIXUPDEF_CALL_CONST(int, pgd_bad, pgd_t)
176BTFIXUPDEF_CALL_CONST(int, pgd_present, pgd_t)
177BTFIXUPDEF_CALL(void, pgd_clear, pgd_t *)
178
179#define pgd_none(pgd) BTFIXUP_CALL(pgd_none)(pgd)
180#define pgd_bad(pgd) BTFIXUP_CALL(pgd_bad)(pgd)
181#define pgd_present(pgd) BTFIXUP_CALL(pgd_present)(pgd)
182#define pgd_clear(pgd) BTFIXUP_CALL(pgd_clear)(pgd)
183
184/*
185 * The following only work if pte_present() is true.
186 * Undefined behaviour if not..
187 */
188BTFIXUPDEF_HALF(pte_writei)
189BTFIXUPDEF_HALF(pte_dirtyi)
190BTFIXUPDEF_HALF(pte_youngi)
191
192static int pte_write(pte_t pte) __attribute_const__;
193static inline int pte_write(pte_t pte)
194{
195 return pte_val(pte) & BTFIXUP_HALF(pte_writei);
196}
197
198static int pte_dirty(pte_t pte) __attribute_const__;
199static inline int pte_dirty(pte_t pte)
200{
201 return pte_val(pte) & BTFIXUP_HALF(pte_dirtyi);
202}
203
204static int pte_young(pte_t pte) __attribute_const__;
205static inline int pte_young(pte_t pte)
206{
207 return pte_val(pte) & BTFIXUP_HALF(pte_youngi);
208}
209
210/*
211 * The following only work if pte_present() is not true.
212 */
213BTFIXUPDEF_HALF(pte_filei)
214
215static int pte_file(pte_t pte) __attribute_const__;
216static inline int pte_file(pte_t pte)
217{
218 return pte_val(pte) & BTFIXUP_HALF(pte_filei);
219}
220
221static inline int pte_special(pte_t pte)
222{
223 return 0;
224}
225
226/*
227 */
228BTFIXUPDEF_HALF(pte_wrprotecti)
229BTFIXUPDEF_HALF(pte_mkcleani)
230BTFIXUPDEF_HALF(pte_mkoldi)
231
232static pte_t pte_wrprotect(pte_t pte) __attribute_const__;
233static inline pte_t pte_wrprotect(pte_t pte)
234{
235 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_wrprotecti));
236}
237
238static pte_t pte_mkclean(pte_t pte) __attribute_const__;
239static inline pte_t pte_mkclean(pte_t pte)
240{
241 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkcleani));
242}
243
244static pte_t pte_mkold(pte_t pte) __attribute_const__;
245static inline pte_t pte_mkold(pte_t pte)
246{
247 return __pte(pte_val(pte) & ~BTFIXUP_HALF(pte_mkoldi));
248}
249
250BTFIXUPDEF_CALL_CONST(pte_t, pte_mkwrite, pte_t)
251BTFIXUPDEF_CALL_CONST(pte_t, pte_mkdirty, pte_t)
252BTFIXUPDEF_CALL_CONST(pte_t, pte_mkyoung, pte_t)
253
254#define pte_mkwrite(pte) BTFIXUP_CALL(pte_mkwrite)(pte)
255#define pte_mkdirty(pte) BTFIXUP_CALL(pte_mkdirty)(pte)
256#define pte_mkyoung(pte) BTFIXUP_CALL(pte_mkyoung)(pte)
257
258#define pte_mkspecial(pte) (pte)
259
260#define pfn_pte(pfn, prot) mk_pte(pfn_to_page(pfn), prot)
261
262BTFIXUPDEF_CALL(unsigned long, pte_pfn, pte_t)
263#define pte_pfn(pte) BTFIXUP_CALL(pte_pfn)(pte)
264#define pte_page(pte) pfn_to_page(pte_pfn(pte))
265
266/*
267 * Conversion functions: convert a page and protection to a page entry,
268 * and a page entry and page directory to the page they refer to.
269 */
270BTFIXUPDEF_CALL_CONST(pte_t, mk_pte, struct page *, pgprot_t)
271
272BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_phys, unsigned long, pgprot_t)
273BTFIXUPDEF_CALL_CONST(pte_t, mk_pte_io, unsigned long, pgprot_t, int)
274BTFIXUPDEF_CALL_CONST(pgprot_t, pgprot_noncached, pgprot_t)
275
276#define mk_pte(page,pgprot) BTFIXUP_CALL(mk_pte)(page,pgprot)
277#define mk_pte_phys(page,pgprot) BTFIXUP_CALL(mk_pte_phys)(page,pgprot)
278#define mk_pte_io(page,pgprot,space) BTFIXUP_CALL(mk_pte_io)(page,pgprot,space)
279
280#define pgprot_noncached(pgprot) BTFIXUP_CALL(pgprot_noncached)(pgprot)
281
282BTFIXUPDEF_INT(pte_modify_mask)
283
284static pte_t pte_modify(pte_t pte, pgprot_t newprot) __attribute_const__;
285static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
286{
287 return __pte((pte_val(pte) & BTFIXUP_INT(pte_modify_mask)) |
288 pgprot_val(newprot));
289}
290
291#define pgd_index(address) ((address) >> PGDIR_SHIFT)
292
293/* to find an entry in a page-table-directory */
294#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
295
296/* to find an entry in a kernel page-table-directory */
297#define pgd_offset_k(address) pgd_offset(&init_mm, address)
298
299/* Find an entry in the second-level page table.. */
300BTFIXUPDEF_CALL(pmd_t *, pmd_offset, pgd_t *, unsigned long)
301#define pmd_offset(dir,addr) BTFIXUP_CALL(pmd_offset)(dir,addr)
302
303/* Find an entry in the third-level page table.. */
304BTFIXUPDEF_CALL(pte_t *, pte_offset_kernel, pmd_t *, unsigned long)
305#define pte_offset_kernel(dir,addr) BTFIXUP_CALL(pte_offset_kernel)(dir,addr)
306
307/*
308 * This shortcut works on sun4m (and sun4d) because the nocache area is static,
309 * and sun4c is guaranteed to have no highmem anyway.
310 */
311#define pte_offset_map(d, a) pte_offset_kernel(d,a)
312#define pte_offset_map_nested(d, a) pte_offset_kernel(d,a)
313
314#define pte_unmap(pte) do{}while(0)
315#define pte_unmap_nested(pte) do{}while(0)
316
317/* Certain architectures need to do special things when pte's
318 * within a page table are directly modified. Thus, the following
319 * hook is made available.
320 */
321
322BTFIXUPDEF_CALL(void, set_pte, pte_t *, pte_t)
323
324#define set_pte(ptep,pteval) BTFIXUP_CALL(set_pte)(ptep,pteval)
325#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
326
327struct seq_file;
328BTFIXUPDEF_CALL(void, mmu_info, struct seq_file *)
329
330#define mmu_info(p) BTFIXUP_CALL(mmu_info)(p)
331
332/* Fault handler stuff... */
333#define FAULT_CODE_PROT 0x1
334#define FAULT_CODE_WRITE 0x2
335#define FAULT_CODE_USER 0x4
336
337BTFIXUPDEF_CALL(void, update_mmu_cache, struct vm_area_struct *, unsigned long, pte_t)
338
339#define update_mmu_cache(vma,addr,pte) BTFIXUP_CALL(update_mmu_cache)(vma,addr,pte)
340
341BTFIXUPDEF_CALL(void, sparc_mapiorange, unsigned int, unsigned long,
342 unsigned long, unsigned int)
343BTFIXUPDEF_CALL(void, sparc_unmapiorange, unsigned long, unsigned int)
344#define sparc_mapiorange(bus,pa,va,len) BTFIXUP_CALL(sparc_mapiorange)(bus,pa,va,len)
345#define sparc_unmapiorange(va,len) BTFIXUP_CALL(sparc_unmapiorange)(va,len)
346
347extern int invalid_segment;
348
349/* Encode and de-code a swap entry */
350BTFIXUPDEF_CALL(unsigned long, __swp_type, swp_entry_t)
351BTFIXUPDEF_CALL(unsigned long, __swp_offset, swp_entry_t)
352BTFIXUPDEF_CALL(swp_entry_t, __swp_entry, unsigned long, unsigned long)
353
354#define __swp_type(__x) BTFIXUP_CALL(__swp_type)(__x)
355#define __swp_offset(__x) BTFIXUP_CALL(__swp_offset)(__x)
356#define __swp_entry(__type,__off) BTFIXUP_CALL(__swp_entry)(__type,__off)
357
358#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
359#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
360
361/* file-offset-in-pte helpers */
362BTFIXUPDEF_CALL(unsigned long, pte_to_pgoff, pte_t pte);
363BTFIXUPDEF_CALL(pte_t, pgoff_to_pte, unsigned long pgoff);
364
365#define pte_to_pgoff(pte) BTFIXUP_CALL(pte_to_pgoff)(pte)
366#define pgoff_to_pte(off) BTFIXUP_CALL(pgoff_to_pte)(off)
367
368/*
369 * This is made a constant because mm/fremap.c required a constant.
370 * Note that layout of these bits is different between sun4c.c and srmmu.c.
371 */
372#define PTE_FILE_MAX_BITS 24
373
374/*
375 */
376struct ctx_list {
377 struct ctx_list *next;
378 struct ctx_list *prev;
379 unsigned int ctx_number;
380 struct mm_struct *ctx_mm;
381};
382
383extern struct ctx_list *ctx_list_pool; /* Dynamically allocated */
384extern struct ctx_list ctx_free; /* Head of free list */
385extern struct ctx_list ctx_used; /* Head of used contexts list */
386
387#define NO_CONTEXT -1
388
389static inline void remove_from_ctx_list(struct ctx_list *entry)
390{
391 entry->next->prev = entry->prev;
392 entry->prev->next = entry->next;
393}
394
395static inline void add_to_ctx_list(struct ctx_list *head, struct ctx_list *entry)
396{
397 entry->next = head;
398 (entry->prev = head->prev)->next = entry;
399 head->prev = entry;
400}
401#define add_to_free_ctxlist(entry) add_to_ctx_list(&ctx_free, entry)
402#define add_to_used_ctxlist(entry) add_to_ctx_list(&ctx_used, entry)
403
404static inline unsigned long
405__get_phys (unsigned long addr)
406{
407 switch (sparc_cpu_model){
408 case sun4:
409 case sun4c:
410 return sun4c_get_pte (addr) << PAGE_SHIFT;
411 case sun4m:
412 case sun4d:
413 return ((srmmu_get_pte (addr) & 0xffffff00) << 4);
414 default:
415 return 0;
416 }
417}
418
419static inline int
420__get_iospace (unsigned long addr)
421{
422 switch (sparc_cpu_model){
423 case sun4:
424 case sun4c:
425 return -1; /* Don't check iospace on sun4c */
426 case sun4m:
427 case sun4d:
428 return (srmmu_get_pte (addr) >> 28);
429 default:
430 return -1;
431 }
432}
433
434extern unsigned long *sparc_valid_addr_bitmap;
435
436/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
437#define kern_addr_valid(addr) \
438 (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap))
439
440extern int io_remap_pfn_range(struct vm_area_struct *vma,
441 unsigned long from, unsigned long pfn,
442 unsigned long size, pgprot_t prot);
443
444/*
445 * For sparc32&64, the pfn in io_remap_pfn_range() carries <iospace> in
446 * its high 4 bits. These macros/functions put it there or get it from there.
447 */
448#define MK_IOSPACE_PFN(space, pfn) (pfn | (space << (BITS_PER_LONG - 4)))
449#define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4))
450#define GET_PFN(pfn) (pfn & 0x0fffffffUL)
451
452#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
453#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
454({ \
455 int __changed = !pte_same(*(__ptep), __entry); \
456 if (__changed) { \
457 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
458 flush_tlb_page(__vma, __address); \
459 } \
460 (sparc_cpu_model == sun4c) || __changed; \
461})
462
463#include <asm-generic/pgtable.h>
464
465#endif /* !(__ASSEMBLY__) */
466
467#define VMALLOC_START 0xfe600000
468/* XXX Alter this when I get around to fixing sun4c - Anton */
469#define VMALLOC_END 0xffc00000
470
471
472/* We provide our own get_unmapped_area to cope with VA holes for userland */
473#define HAVE_ARCH_UNMAPPED_AREA
474
475/*
476 * No page table caches to initialise
477 */
478#define pgtable_cache_init() do { } while (0)
479
480#endif /* !(_SPARC_PGTABLE_H) */
diff --git a/include/asm-sparc/posix_types.h b/include/asm-sparc/posix_types.h
deleted file mode 100644
index 58c820d75e83..000000000000
--- a/include/asm-sparc/posix_types.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_POSIX_TYPES_H
2#define ___ASM_SPARC_POSIX_TYPES_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/posix_types_64.h>
5#else
6#include <asm-sparc/posix_types_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h
deleted file mode 100644
index 11a66bb02eaa..000000000000
--- a/include/asm-sparc/processor.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_PROCESSOR_H
2#define ___ASM_SPARC_PROCESSOR_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/processor_64.h>
5#else
6#include <asm-sparc/processor_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/processor_32.h b/include/asm-sparc/processor_32.h
deleted file mode 100644
index 562c0d69c537..000000000000
--- a/include/asm-sparc/processor_32.h
+++ /dev/null
@@ -1,128 +0,0 @@
1/* include/asm-sparc/processor.h
2 *
3 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
4 */
5
6#ifndef __ASM_SPARC_PROCESSOR_H
7#define __ASM_SPARC_PROCESSOR_H
8
9/*
10 * Sparc32 implementation of macro that returns current
11 * instruction pointer ("program counter").
12 */
13#define current_text_addr() ({ void *pc; __asm__("sethi %%hi(1f), %0; or %0, %%lo(1f), %0;\n1:" : "=r" (pc)); pc; })
14
15#include <asm/psr.h>
16#include <asm/ptrace.h>
17#include <asm/head.h>
18#include <asm/signal.h>
19#include <asm/btfixup.h>
20#include <asm/page.h>
21
22/*
23 * The sparc has no problems with write protection
24 */
25#define wp_works_ok 1
26#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
27
28/* Whee, this is STACK_TOP + PAGE_SIZE and the lowest kernel address too...
29 * That one page is used to protect kernel from intruders, so that
30 * we can make our access_ok test faster
31 */
32#define TASK_SIZE PAGE_OFFSET
33#ifdef __KERNEL__
34#define STACK_TOP (PAGE_OFFSET - PAGE_SIZE)
35#define STACK_TOP_MAX STACK_TOP
36#endif /* __KERNEL__ */
37
38struct task_struct;
39
40#ifdef __KERNEL__
41struct fpq {
42 unsigned long *insn_addr;
43 unsigned long insn;
44};
45#endif
46
47typedef struct {
48 int seg;
49} mm_segment_t;
50
51/* The Sparc processor specific thread struct. */
52struct thread_struct {
53 struct pt_regs *kregs;
54 unsigned int _pad1;
55
56 /* Special child fork kpsr/kwim values. */
57 unsigned long fork_kpsr __attribute__ ((aligned (8)));
58 unsigned long fork_kwim;
59
60 /* Floating point regs */
61 unsigned long float_regs[32] __attribute__ ((aligned (8)));
62 unsigned long fsr;
63 unsigned long fpqdepth;
64 struct fpq fpqueue[16];
65 unsigned long flags;
66 mm_segment_t current_ds;
67};
68
69#define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */
70#define SPARC_FLAG_UNALIGNED 0x2 /* is allowed to do unaligned accesses */
71
72#define INIT_THREAD { \
73 .flags = SPARC_FLAG_KTHREAD, \
74 .current_ds = KERNEL_DS, \
75}
76
77/* Return saved PC of a blocked thread. */
78extern unsigned long thread_saved_pc(struct task_struct *t);
79
80/* Do necessary setup to start up a newly executed thread. */
81static inline void start_thread(struct pt_regs * regs, unsigned long pc,
82 unsigned long sp)
83{
84 register unsigned long zero asm("g1");
85
86 regs->psr = (regs->psr & (PSR_CWP)) | PSR_S;
87 regs->pc = ((pc & (~3)) - 4);
88 regs->npc = regs->pc + 4;
89 regs->y = 0;
90 zero = 0;
91 __asm__ __volatile__("std\t%%g0, [%0 + %3 + 0x00]\n\t"
92 "std\t%%g0, [%0 + %3 + 0x08]\n\t"
93 "std\t%%g0, [%0 + %3 + 0x10]\n\t"
94 "std\t%%g0, [%0 + %3 + 0x18]\n\t"
95 "std\t%%g0, [%0 + %3 + 0x20]\n\t"
96 "std\t%%g0, [%0 + %3 + 0x28]\n\t"
97 "std\t%%g0, [%0 + %3 + 0x30]\n\t"
98 "st\t%1, [%0 + %3 + 0x38]\n\t"
99 "st\t%%g0, [%0 + %3 + 0x3c]"
100 : /* no outputs */
101 : "r" (regs),
102 "r" (sp - sizeof(struct reg_window)),
103 "r" (zero),
104 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))
105 : "memory");
106}
107
108/* Free all resources held by a thread. */
109#define release_thread(tsk) do { } while(0)
110extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
111
112/* Prepare to copy thread state - unlazy all lazy status */
113#define prepare_to_copy(tsk) do { } while (0)
114
115extern unsigned long get_wchan(struct task_struct *);
116
117#define KSTK_EIP(tsk) ((tsk)->thread.kregs->pc)
118#define KSTK_ESP(tsk) ((tsk)->thread.kregs->u_regs[UREG_FP])
119
120#ifdef __KERNEL__
121
122extern struct task_struct *last_task_used_math;
123
124#define cpu_relax() barrier()
125
126#endif
127
128#endif /* __ASM_SPARC_PROCESSOR_H */
diff --git a/include/asm-sparc/processor_64.h b/include/asm-sparc/processor_64.h
deleted file mode 100644
index 70d42801a0d2..000000000000
--- a/include/asm-sparc/processor_64.h
+++ /dev/null
@@ -1,237 +0,0 @@
1/*
2 * include/asm-sparc64/processor.h
3 *
4 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
5 */
6
7#ifndef __ASM_SPARC64_PROCESSOR_H
8#define __ASM_SPARC64_PROCESSOR_H
9
10/*
11 * Sparc64 implementation of macro that returns current
12 * instruction pointer ("program counter").
13 */
14#define current_text_addr() ({ void *pc; __asm__("rd %%pc, %0" : "=r" (pc)); pc; })
15
16#include <asm/asi.h>
17#include <asm/pstate.h>
18#include <asm/ptrace.h>
19#include <asm/page.h>
20
21/* The sparc has no problems with write protection */
22#define wp_works_ok 1
23#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
24
25/*
26 * User lives in his very own context, and cannot reference us. Note
27 * that TASK_SIZE is a misnomer, it really gives maximum user virtual
28 * address that the kernel will allocate out.
29 *
30 * XXX No longer using virtual page tables, kill this upper limit...
31 */
32#define VA_BITS 44
33#ifndef __ASSEMBLY__
34#define VPTE_SIZE (1UL << (VA_BITS - PAGE_SHIFT + 3))
35#else
36#define VPTE_SIZE (1 << (VA_BITS - PAGE_SHIFT + 3))
37#endif
38
39#define TASK_SIZE ((unsigned long)-VPTE_SIZE)
40#define TASK_SIZE_OF(tsk) \
41 (test_tsk_thread_flag(tsk,TIF_32BIT) ? \
42 (1UL << 32UL) : TASK_SIZE)
43#ifdef __KERNEL__
44
45#define STACK_TOP32 ((1UL << 32UL) - PAGE_SIZE)
46#define STACK_TOP64 (0x0000080000000000UL - (1UL << 32UL))
47
48#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
49 STACK_TOP32 : STACK_TOP64)
50
51#define STACK_TOP_MAX STACK_TOP64
52
53#endif
54
55#ifndef __ASSEMBLY__
56
57typedef struct {
58 unsigned char seg;
59} mm_segment_t;
60
61/* The Sparc processor specific thread struct. */
62/* XXX This should die, everything can go into thread_info now. */
63struct thread_struct {
64#ifdef CONFIG_DEBUG_SPINLOCK
65 /* How many spinlocks held by this thread.
66 * Used with spin lock debugging to catch tasks
67 * sleeping illegally with locks held.
68 */
69 int smp_lock_count;
70 unsigned int smp_lock_pc;
71#else
72 int dummy; /* f'in gcc bug... */
73#endif
74};
75
76#endif /* !(__ASSEMBLY__) */
77
78#ifndef CONFIG_DEBUG_SPINLOCK
79#define INIT_THREAD { \
80 0, \
81}
82#else /* CONFIG_DEBUG_SPINLOCK */
83#define INIT_THREAD { \
84/* smp_lock_count, smp_lock_pc, */ \
85 0, 0, \
86}
87#endif /* !(CONFIG_DEBUG_SPINLOCK) */
88
89#ifndef __ASSEMBLY__
90
91#include <linux/types.h>
92
93/* Return saved PC of a blocked thread. */
94struct task_struct;
95extern unsigned long thread_saved_pc(struct task_struct *);
96
97/* On Uniprocessor, even in RMO processes see TSO semantics */
98#ifdef CONFIG_SMP
99#define TSTATE_INITIAL_MM TSTATE_TSO
100#else
101#define TSTATE_INITIAL_MM TSTATE_RMO
102#endif
103
104/* Do necessary setup to start up a newly executed thread. */
105#define start_thread(regs, pc, sp) \
106do { \
107 unsigned long __asi = ASI_PNF; \
108 regs->tstate = (regs->tstate & (TSTATE_CWP)) | (TSTATE_INITIAL_MM|TSTATE_IE) | (__asi << 24UL); \
109 regs->tpc = ((pc & (~3)) - 4); \
110 regs->tnpc = regs->tpc + 4; \
111 regs->y = 0; \
112 set_thread_wstate(1 << 3); \
113 if (current_thread_info()->utraps) { \
114 if (*(current_thread_info()->utraps) < 2) \
115 kfree(current_thread_info()->utraps); \
116 else \
117 (*(current_thread_info()->utraps))--; \
118 current_thread_info()->utraps = NULL; \
119 } \
120 __asm__ __volatile__( \
121 "stx %%g0, [%0 + %2 + 0x00]\n\t" \
122 "stx %%g0, [%0 + %2 + 0x08]\n\t" \
123 "stx %%g0, [%0 + %2 + 0x10]\n\t" \
124 "stx %%g0, [%0 + %2 + 0x18]\n\t" \
125 "stx %%g0, [%0 + %2 + 0x20]\n\t" \
126 "stx %%g0, [%0 + %2 + 0x28]\n\t" \
127 "stx %%g0, [%0 + %2 + 0x30]\n\t" \
128 "stx %%g0, [%0 + %2 + 0x38]\n\t" \
129 "stx %%g0, [%0 + %2 + 0x40]\n\t" \
130 "stx %%g0, [%0 + %2 + 0x48]\n\t" \
131 "stx %%g0, [%0 + %2 + 0x50]\n\t" \
132 "stx %%g0, [%0 + %2 + 0x58]\n\t" \
133 "stx %%g0, [%0 + %2 + 0x60]\n\t" \
134 "stx %%g0, [%0 + %2 + 0x68]\n\t" \
135 "stx %1, [%0 + %2 + 0x70]\n\t" \
136 "stx %%g0, [%0 + %2 + 0x78]\n\t" \
137 "wrpr %%g0, (1 << 3), %%wstate\n\t" \
138 : \
139 : "r" (regs), "r" (sp - sizeof(struct reg_window) - STACK_BIAS), \
140 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \
141} while (0)
142
143#define start_thread32(regs, pc, sp) \
144do { \
145 unsigned long __asi = ASI_PNF; \
146 pc &= 0x00000000ffffffffUL; \
147 sp &= 0x00000000ffffffffUL; \
148 regs->tstate = (regs->tstate & (TSTATE_CWP))|(TSTATE_INITIAL_MM|TSTATE_IE|TSTATE_AM) | (__asi << 24UL); \
149 regs->tpc = ((pc & (~3)) - 4); \
150 regs->tnpc = regs->tpc + 4; \
151 regs->y = 0; \
152 set_thread_wstate(2 << 3); \
153 if (current_thread_info()->utraps) { \
154 if (*(current_thread_info()->utraps) < 2) \
155 kfree(current_thread_info()->utraps); \
156 else \
157 (*(current_thread_info()->utraps))--; \
158 current_thread_info()->utraps = NULL; \
159 } \
160 __asm__ __volatile__( \
161 "stx %%g0, [%0 + %2 + 0x00]\n\t" \
162 "stx %%g0, [%0 + %2 + 0x08]\n\t" \
163 "stx %%g0, [%0 + %2 + 0x10]\n\t" \
164 "stx %%g0, [%0 + %2 + 0x18]\n\t" \
165 "stx %%g0, [%0 + %2 + 0x20]\n\t" \
166 "stx %%g0, [%0 + %2 + 0x28]\n\t" \
167 "stx %%g0, [%0 + %2 + 0x30]\n\t" \
168 "stx %%g0, [%0 + %2 + 0x38]\n\t" \
169 "stx %%g0, [%0 + %2 + 0x40]\n\t" \
170 "stx %%g0, [%0 + %2 + 0x48]\n\t" \
171 "stx %%g0, [%0 + %2 + 0x50]\n\t" \
172 "stx %%g0, [%0 + %2 + 0x58]\n\t" \
173 "stx %%g0, [%0 + %2 + 0x60]\n\t" \
174 "stx %%g0, [%0 + %2 + 0x68]\n\t" \
175 "stx %1, [%0 + %2 + 0x70]\n\t" \
176 "stx %%g0, [%0 + %2 + 0x78]\n\t" \
177 "wrpr %%g0, (2 << 3), %%wstate\n\t" \
178 : \
179 : "r" (regs), "r" (sp - sizeof(struct reg_window32)), \
180 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \
181} while (0)
182
183/* Free all resources held by a thread. */
184#define release_thread(tsk) do { } while (0)
185
186/* Prepare to copy thread state - unlazy all lazy status */
187#define prepare_to_copy(tsk) do { } while (0)
188
189extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
190
191extern unsigned long get_wchan(struct task_struct *task);
192
193#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs)
194#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc)
195#define KSTK_ESP(tsk) (task_pt_regs(tsk)->u_regs[UREG_FP])
196
197#define cpu_relax() barrier()
198
199/* Prefetch support. This is tuned for UltraSPARC-III and later.
200 * UltraSPARC-I will treat these as nops, and UltraSPARC-II has
201 * a shallower prefetch queue than later chips.
202 */
203#define ARCH_HAS_PREFETCH
204#define ARCH_HAS_PREFETCHW
205#define ARCH_HAS_SPINLOCK_PREFETCH
206
207static inline void prefetch(const void *x)
208{
209 /* We do not use the read prefetch mnemonic because that
210 * prefetches into the prefetch-cache which only is accessible
211 * by floating point operations in UltraSPARC-III and later.
212 * By contrast, "#one_write" prefetches into the L2 cache
213 * in shared state.
214 */
215 __asm__ __volatile__("prefetch [%0], #one_write"
216 : /* no outputs */
217 : "r" (x));
218}
219
220static inline void prefetchw(const void *x)
221{
222 /* The most optimal prefetch to use for writes is
223 * "#n_writes". This brings the cacheline into the
224 * L2 cache in "owned" state.
225 */
226 __asm__ __volatile__("prefetch [%0], #n_writes"
227 : /* no outputs */
228 : "r" (x));
229}
230
231#define spin_lock_prefetch(x) prefetchw(x)
232
233#define HAVE_ARCH_PICK_MMAP_LAYOUT
234
235#endif /* !(__ASSEMBLY__) */
236
237#endif /* !(__ASM_SPARC64_PROCESSOR_H) */
diff --git a/include/asm-sparc/ptrace.h b/include/asm-sparc/ptrace.h
deleted file mode 100644
index f36ab6c30ff3..000000000000
--- a/include/asm-sparc/ptrace.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_PTRACE_H
2#define ___ASM_SPARC_PTRACE_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/ptrace_64.h>
5#else
6#include <asm-sparc/ptrace_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/ptrace_32.h b/include/asm-sparc/ptrace_32.h
deleted file mode 100644
index 0401cc7ec38e..000000000000
--- a/include/asm-sparc/ptrace_32.h
+++ /dev/null
@@ -1,175 +0,0 @@
1#ifndef _SPARC_PTRACE_H
2#define _SPARC_PTRACE_H
3
4#include <asm/psr.h>
5
6/* This struct defines the way the registers are stored on the
7 * stack during a system call and basically all traps.
8 */
9
10#ifndef __ASSEMBLY__
11
12#include <linux/types.h>
13
14struct pt_regs {
15 unsigned long psr;
16 unsigned long pc;
17 unsigned long npc;
18 unsigned long y;
19 unsigned long u_regs[16]; /* globals and ins */
20};
21
22#define UREG_G0 0
23#define UREG_G1 1
24#define UREG_G2 2
25#define UREG_G3 3
26#define UREG_G4 4
27#define UREG_G5 5
28#define UREG_G6 6
29#define UREG_G7 7
30#define UREG_I0 8
31#define UREG_I1 9
32#define UREG_I2 10
33#define UREG_I3 11
34#define UREG_I4 12
35#define UREG_I5 13
36#define UREG_I6 14
37#define UREG_I7 15
38#define UREG_WIM UREG_G0
39#define UREG_FADDR UREG_G0
40#define UREG_FP UREG_I6
41#define UREG_RETPC UREG_I7
42
43static inline bool pt_regs_is_syscall(struct pt_regs *regs)
44{
45 return (regs->psr & PSR_SYSCALL);
46}
47
48static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
49{
50 return (regs->psr &= ~PSR_SYSCALL);
51}
52
53/* A register window */
54struct reg_window {
55 unsigned long locals[8];
56 unsigned long ins[8];
57};
58
59/* A Sparc stack frame */
60struct sparc_stackf {
61 unsigned long locals[8];
62 unsigned long ins[6];
63 struct sparc_stackf *fp;
64 unsigned long callers_pc;
65 char *structptr;
66 unsigned long xargs[6];
67 unsigned long xxargs[1];
68};
69
70#define TRACEREG_SZ sizeof(struct pt_regs)
71#define STACKFRAME_SZ sizeof(struct sparc_stackf)
72
73#ifdef __KERNEL__
74
75#define user_mode(regs) (!((regs)->psr & PSR_PS))
76#define instruction_pointer(regs) ((regs)->pc)
77unsigned long profile_pc(struct pt_regs *);
78extern void show_regs(struct pt_regs *);
79#endif
80
81#else /* __ASSEMBLY__ */
82/* For assembly code. */
83#define TRACEREG_SZ 0x50
84#define STACKFRAME_SZ 0x60
85#endif
86
87/*
88 * The asm-offsets.h is a generated file, so we cannot include it.
89 * It may be OK for glibc headers, but it's utterly pointless for C code.
90 * The assembly code using those offsets has to include it explicitly.
91 */
92/* #include <asm/asm-offsets.h> */
93
94/* These are for pt_regs. */
95#define PT_PSR 0x0
96#define PT_PC 0x4
97#define PT_NPC 0x8
98#define PT_Y 0xc
99#define PT_G0 0x10
100#define PT_WIM PT_G0
101#define PT_G1 0x14
102#define PT_G2 0x18
103#define PT_G3 0x1c
104#define PT_G4 0x20
105#define PT_G5 0x24
106#define PT_G6 0x28
107#define PT_G7 0x2c
108#define PT_I0 0x30
109#define PT_I1 0x34
110#define PT_I2 0x38
111#define PT_I3 0x3c
112#define PT_I4 0x40
113#define PT_I5 0x44
114#define PT_I6 0x48
115#define PT_FP PT_I6
116#define PT_I7 0x4c
117
118/* Reg_window offsets */
119#define RW_L0 0x00
120#define RW_L1 0x04
121#define RW_L2 0x08
122#define RW_L3 0x0c
123#define RW_L4 0x10
124#define RW_L5 0x14
125#define RW_L6 0x18
126#define RW_L7 0x1c
127#define RW_I0 0x20
128#define RW_I1 0x24
129#define RW_I2 0x28
130#define RW_I3 0x2c
131#define RW_I4 0x30
132#define RW_I5 0x34
133#define RW_I6 0x38
134#define RW_I7 0x3c
135
136/* Stack_frame offsets */
137#define SF_L0 0x00
138#define SF_L1 0x04
139#define SF_L2 0x08
140#define SF_L3 0x0c
141#define SF_L4 0x10
142#define SF_L5 0x14
143#define SF_L6 0x18
144#define SF_L7 0x1c
145#define SF_I0 0x20
146#define SF_I1 0x24
147#define SF_I2 0x28
148#define SF_I3 0x2c
149#define SF_I4 0x30
150#define SF_I5 0x34
151#define SF_FP 0x38
152#define SF_PC 0x3c
153#define SF_RETP 0x40
154#define SF_XARG0 0x44
155#define SF_XARG1 0x48
156#define SF_XARG2 0x4c
157#define SF_XARG3 0x50
158#define SF_XARG4 0x54
159#define SF_XARG5 0x58
160#define SF_XXARG 0x5c
161
162/* Stuff for the ptrace system call */
163#define PTRACE_SPARC_DETACH 11
164#define PTRACE_GETREGS 12
165#define PTRACE_SETREGS 13
166#define PTRACE_GETFPREGS 14
167#define PTRACE_SETFPREGS 15
168#define PTRACE_READDATA 16
169#define PTRACE_WRITEDATA 17
170#define PTRACE_READTEXT 18
171#define PTRACE_WRITETEXT 19
172#define PTRACE_GETFPAREGS 20
173#define PTRACE_SETFPAREGS 21
174
175#endif /* !(_SPARC_PTRACE_H) */
diff --git a/include/asm-sparc/ptrace_64.h b/include/asm-sparc/ptrace_64.h
deleted file mode 100644
index a682e66d5c4a..000000000000
--- a/include/asm-sparc/ptrace_64.h
+++ /dev/null
@@ -1,346 +0,0 @@
1#ifndef _SPARC64_PTRACE_H
2#define _SPARC64_PTRACE_H
3
4#include <asm/pstate.h>
5
6/* This struct defines the way the registers are stored on the
7 * stack during a system call and basically all traps.
8 */
9
10/* This magic value must have the low 9 bits clear,
11 * as that is where we encode the %tt value, see below.
12 */
13#define PT_REGS_MAGIC 0x57ac6c00
14
15#ifndef __ASSEMBLY__
16
17#include <linux/types.h>
18
19struct pt_regs {
20 unsigned long u_regs[16]; /* globals and ins */
21 unsigned long tstate;
22 unsigned long tpc;
23 unsigned long tnpc;
24 unsigned int y;
25
26 /* We encode a magic number, PT_REGS_MAGIC, along
27 * with the %tt (trap type) register value at trap
28 * entry time. The magic number allows us to identify
29 * accurately a trap stack frame in the stack
30 * unwinder, and the %tt value allows us to test
31 * things like "in a system call" etc. for an arbitray
32 * process.
33 *
34 * The PT_REGS_MAGIC is choosen such that it can be
35 * loaded completely using just a sethi instruction.
36 */
37 unsigned int magic;
38};
39
40static inline int pt_regs_trap_type(struct pt_regs *regs)
41{
42 return regs->magic & 0x1ff;
43}
44
45static inline bool pt_regs_is_syscall(struct pt_regs *regs)
46{
47 return (regs->tstate & TSTATE_SYSCALL);
48}
49
50static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
51{
52 return (regs->tstate &= ~TSTATE_SYSCALL);
53}
54
55struct pt_regs32 {
56 unsigned int psr;
57 unsigned int pc;
58 unsigned int npc;
59 unsigned int y;
60 unsigned int u_regs[16]; /* globals and ins */
61};
62
63#define UREG_G0 0
64#define UREG_G1 1
65#define UREG_G2 2
66#define UREG_G3 3
67#define UREG_G4 4
68#define UREG_G5 5
69#define UREG_G6 6
70#define UREG_G7 7
71#define UREG_I0 8
72#define UREG_I1 9
73#define UREG_I2 10
74#define UREG_I3 11
75#define UREG_I4 12
76#define UREG_I5 13
77#define UREG_I6 14
78#define UREG_I7 15
79#define UREG_FP UREG_I6
80#define UREG_RETPC UREG_I7
81
82/* A V9 register window */
83struct reg_window {
84 unsigned long locals[8];
85 unsigned long ins[8];
86};
87
88/* A 32-bit register window. */
89struct reg_window32 {
90 unsigned int locals[8];
91 unsigned int ins[8];
92};
93
94/* A V9 Sparc stack frame */
95struct sparc_stackf {
96 unsigned long locals[8];
97 unsigned long ins[6];
98 struct sparc_stackf *fp;
99 unsigned long callers_pc;
100 char *structptr;
101 unsigned long xargs[6];
102 unsigned long xxargs[1];
103};
104
105/* A 32-bit Sparc stack frame */
106struct sparc_stackf32 {
107 unsigned int locals[8];
108 unsigned int ins[6];
109 unsigned int fp;
110 unsigned int callers_pc;
111 unsigned int structptr;
112 unsigned int xargs[6];
113 unsigned int xxargs[1];
114};
115
116struct sparc_trapf {
117 unsigned long locals[8];
118 unsigned long ins[8];
119 unsigned long _unused;
120 struct pt_regs *regs;
121};
122
123#define TRACEREG_SZ sizeof(struct pt_regs)
124#define STACKFRAME_SZ sizeof(struct sparc_stackf)
125
126#define TRACEREG32_SZ sizeof(struct pt_regs32)
127#define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
128
129#ifdef __KERNEL__
130
131struct global_reg_snapshot {
132 unsigned long tstate;
133 unsigned long tpc;
134 unsigned long tnpc;
135 unsigned long o7;
136 unsigned long i7;
137 struct thread_info *thread;
138 unsigned long pad1;
139 unsigned long pad2;
140};
141
142#define __ARCH_WANT_COMPAT_SYS_PTRACE
143
144#define force_successful_syscall_return() \
145do { current_thread_info()->syscall_noerror = 1; \
146} while (0)
147#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
148#define instruction_pointer(regs) ((regs)->tpc)
149#define regs_return_value(regs) ((regs)->u_regs[UREG_I0])
150#ifdef CONFIG_SMP
151extern unsigned long profile_pc(struct pt_regs *);
152#else
153#define profile_pc(regs) instruction_pointer(regs)
154#endif
155extern void show_regs(struct pt_regs *);
156extern void __show_regs(struct pt_regs *);
157#endif
158
159#else /* __ASSEMBLY__ */
160/* For assembly code. */
161#define TRACEREG_SZ 0xa0
162#define STACKFRAME_SZ 0xc0
163
164#define TRACEREG32_SZ 0x50
165#define STACKFRAME32_SZ 0x60
166#endif
167
168#ifdef __KERNEL__
169#define STACK_BIAS 2047
170#endif
171
172/* These are for pt_regs. */
173#define PT_V9_G0 0x00
174#define PT_V9_G1 0x08
175#define PT_V9_G2 0x10
176#define PT_V9_G3 0x18
177#define PT_V9_G4 0x20
178#define PT_V9_G5 0x28
179#define PT_V9_G6 0x30
180#define PT_V9_G7 0x38
181#define PT_V9_I0 0x40
182#define PT_V9_I1 0x48
183#define PT_V9_I2 0x50
184#define PT_V9_I3 0x58
185#define PT_V9_I4 0x60
186#define PT_V9_I5 0x68
187#define PT_V9_I6 0x70
188#define PT_V9_FP PT_V9_I6
189#define PT_V9_I7 0x78
190#define PT_V9_TSTATE 0x80
191#define PT_V9_TPC 0x88
192#define PT_V9_TNPC 0x90
193#define PT_V9_Y 0x98
194#define PT_V9_MAGIC 0x9c
195#define PT_TSTATE PT_V9_TSTATE
196#define PT_TPC PT_V9_TPC
197#define PT_TNPC PT_V9_TNPC
198
199/* These for pt_regs32. */
200#define PT_PSR 0x0
201#define PT_PC 0x4
202#define PT_NPC 0x8
203#define PT_Y 0xc
204#define PT_G0 0x10
205#define PT_WIM PT_G0
206#define PT_G1 0x14
207#define PT_G2 0x18
208#define PT_G3 0x1c
209#define PT_G4 0x20
210#define PT_G5 0x24
211#define PT_G6 0x28
212#define PT_G7 0x2c
213#define PT_I0 0x30
214#define PT_I1 0x34
215#define PT_I2 0x38
216#define PT_I3 0x3c
217#define PT_I4 0x40
218#define PT_I5 0x44
219#define PT_I6 0x48
220#define PT_FP PT_I6
221#define PT_I7 0x4c
222
223/* Reg_window offsets */
224#define RW_V9_L0 0x00
225#define RW_V9_L1 0x08
226#define RW_V9_L2 0x10
227#define RW_V9_L3 0x18
228#define RW_V9_L4 0x20
229#define RW_V9_L5 0x28
230#define RW_V9_L6 0x30
231#define RW_V9_L7 0x38
232#define RW_V9_I0 0x40
233#define RW_V9_I1 0x48
234#define RW_V9_I2 0x50
235#define RW_V9_I3 0x58
236#define RW_V9_I4 0x60
237#define RW_V9_I5 0x68
238#define RW_V9_I6 0x70
239#define RW_V9_I7 0x78
240
241#define RW_L0 0x00
242#define RW_L1 0x04
243#define RW_L2 0x08
244#define RW_L3 0x0c
245#define RW_L4 0x10
246#define RW_L5 0x14
247#define RW_L6 0x18
248#define RW_L7 0x1c
249#define RW_I0 0x20
250#define RW_I1 0x24
251#define RW_I2 0x28
252#define RW_I3 0x2c
253#define RW_I4 0x30
254#define RW_I5 0x34
255#define RW_I6 0x38
256#define RW_I7 0x3c
257
258/* Stack_frame offsets */
259#define SF_V9_L0 0x00
260#define SF_V9_L1 0x08
261#define SF_V9_L2 0x10
262#define SF_V9_L3 0x18
263#define SF_V9_L4 0x20
264#define SF_V9_L5 0x28
265#define SF_V9_L6 0x30
266#define SF_V9_L7 0x38
267#define SF_V9_I0 0x40
268#define SF_V9_I1 0x48
269#define SF_V9_I2 0x50
270#define SF_V9_I3 0x58
271#define SF_V9_I4 0x60
272#define SF_V9_I5 0x68
273#define SF_V9_FP 0x70
274#define SF_V9_PC 0x78
275#define SF_V9_RETP 0x80
276#define SF_V9_XARG0 0x88
277#define SF_V9_XARG1 0x90
278#define SF_V9_XARG2 0x98
279#define SF_V9_XARG3 0xa0
280#define SF_V9_XARG4 0xa8
281#define SF_V9_XARG5 0xb0
282#define SF_V9_XXARG 0xb8
283
284#define SF_L0 0x00
285#define SF_L1 0x04
286#define SF_L2 0x08
287#define SF_L3 0x0c
288#define SF_L4 0x10
289#define SF_L5 0x14
290#define SF_L6 0x18
291#define SF_L7 0x1c
292#define SF_I0 0x20
293#define SF_I1 0x24
294#define SF_I2 0x28
295#define SF_I3 0x2c
296#define SF_I4 0x30
297#define SF_I5 0x34
298#define SF_FP 0x38
299#define SF_PC 0x3c
300#define SF_RETP 0x40
301#define SF_XARG0 0x44
302#define SF_XARG1 0x48
303#define SF_XARG2 0x4c
304#define SF_XARG3 0x50
305#define SF_XARG4 0x54
306#define SF_XARG5 0x58
307#define SF_XXARG 0x5c
308
309#ifdef __KERNEL__
310
311/* global_reg_snapshot offsets */
312#define GR_SNAP_TSTATE 0x00
313#define GR_SNAP_TPC 0x08
314#define GR_SNAP_TNPC 0x10
315#define GR_SNAP_O7 0x18
316#define GR_SNAP_I7 0x20
317#define GR_SNAP_THREAD 0x28
318#define GR_SNAP_PAD1 0x30
319#define GR_SNAP_PAD2 0x38
320
321#endif /* __KERNEL__ */
322
323/* Stuff for the ptrace system call */
324#define PTRACE_SPARC_DETACH 11
325#define PTRACE_GETREGS 12
326#define PTRACE_SETREGS 13
327#define PTRACE_GETFPREGS 14
328#define PTRACE_SETFPREGS 15
329#define PTRACE_READDATA 16
330#define PTRACE_WRITEDATA 17
331#define PTRACE_READTEXT 18
332#define PTRACE_WRITETEXT 19
333#define PTRACE_GETFPAREGS 20
334#define PTRACE_SETFPAREGS 21
335
336/* There are for debugging 64-bit processes, either from a 32 or 64 bit
337 * parent. Thus their complements are for debugging 32-bit processes only.
338 */
339
340#define PTRACE_GETREGS64 22
341#define PTRACE_SETREGS64 23
342/* PTRACE_SYSCALL is 24 */
343#define PTRACE_GETFPREGS64 25
344#define PTRACE_SETFPREGS64 26
345
346#endif /* !(_SPARC64_PTRACE_H) */
diff --git a/include/asm-sparc/reg.h b/include/asm-sparc/reg.h
deleted file mode 100644
index cb34b0a49aad..000000000000
--- a/include/asm-sparc/reg.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_REG_H
2#define ___ASM_SPARC_REG_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/reg_64.h>
5#else
6#include <asm-sparc/reg_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/reg_32.h b/include/asm-sparc/reg_32.h
deleted file mode 100644
index 42fecfcd97e7..000000000000
--- a/include/asm-sparc/reg_32.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * linux/include/asm-sparc/reg.h
3 * Layout of the registers as expected by gdb on the Sparc
4 * we should replace the user.h definitions with those in
5 * this file, we don't even use the other
6 * -miguel
7 *
8 * The names of the structures, constants and aliases in this file
9 * have the same names as the sunos ones, some programs rely on these
10 * names (gdb for example).
11 *
12 */
13
14#ifndef __SPARC_REG_H
15#define __SPARC_REG_H
16
17struct regs {
18 int r_psr;
19#define r_ps r_psr
20 int r_pc;
21 int r_npc;
22 int r_y;
23 int r_g1;
24 int r_g2;
25 int r_g3;
26 int r_g4;
27 int r_g5;
28 int r_g6;
29 int r_g7;
30 int r_o0;
31 int r_o1;
32 int r_o2;
33 int r_o3;
34 int r_o4;
35 int r_o5;
36 int r_o6;
37 int r_o7;
38};
39
40struct fpq {
41 unsigned long *addr;
42 unsigned long instr;
43};
44
45struct fq {
46 union {
47 double whole;
48 struct fpq fpq;
49 } FQu;
50};
51
52#define FPU_REGS_TYPE unsigned int
53#define FPU_FSR_TYPE unsigned
54
55struct fp_status {
56 union {
57 FPU_REGS_TYPE Fpu_regs[32];
58 double Fpu_dregs[16];
59 } fpu_fr;
60 FPU_FSR_TYPE Fpu_fsr;
61 unsigned Fpu_flags;
62 unsigned Fpu_extra;
63 unsigned Fpu_qcnt;
64 struct fq Fpu_q[16];
65};
66
67#define fpu_regs f_fpstatus.fpu_fr.Fpu_regs
68#define fpu_dregs f_fpstatus.fpu_fr.Fpu_dregs
69#define fpu_fsr f_fpstatus.Fpu_fsr
70#define fpu_flags f_fpstatus.Fpu_flags
71#define fpu_extra f_fpstatus.Fpu_extra
72#define fpu_q f_fpstatus.Fpu_q
73#define fpu_qcnt f_fpstatus.Fpu_qcnt
74
75struct fpu {
76 struct fp_status f_fpstatus;
77};
78
79#endif /* __SPARC_REG_H */
diff --git a/include/asm-sparc/reg_64.h b/include/asm-sparc/reg_64.h
deleted file mode 100644
index eb24a07ff4d5..000000000000
--- a/include/asm-sparc/reg_64.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * linux/asm-sparc64/reg.h
3 * Layout of the registers as expected by gdb on the Sparc
4 * we should replace the user.h definitions with those in
5 * this file, we don't even use the other
6 * -miguel
7 *
8 * The names of the structures, constants and aliases in this file
9 * have the same names as the sunos ones, some programs rely on these
10 * names (gdb for example).
11 *
12 */
13
14#ifndef __SPARC64_REG_H
15#define __SPARC64_REG_H
16
17struct regs {
18 unsigned long r_g1;
19 unsigned long r_g2;
20 unsigned long r_g3;
21 unsigned long r_g4;
22 unsigned long r_g5;
23 unsigned long r_g6;
24 unsigned long r_g7;
25 unsigned long r_o0;
26 unsigned long r_o1;
27 unsigned long r_o2;
28 unsigned long r_o3;
29 unsigned long r_o4;
30 unsigned long r_o5;
31 unsigned long r_o6;
32 unsigned long r_o7;
33 unsigned long __pad;
34 unsigned long r_tstate;
35 unsigned long r_tpc;
36 unsigned long r_tnpc;
37 unsigned int r_y;
38 unsigned int r_fprs;
39};
40
41#define FPU_REGS_TYPE unsigned int
42#define FPU_FSR_TYPE unsigned long
43
44struct fp_status {
45 unsigned long fpu_fr[32];
46 unsigned long Fpu_fsr;
47};
48
49struct fpu {
50 struct fp_status f_fpstatus;
51};
52
53#define fpu_regs f_fpstatus.fpu_fr
54#define fpu_fsr f_fpstatus.Fpu_fsr
55
56#endif /* __SPARC64_REG_H */
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h
deleted file mode 100644
index 8f29a1979665..000000000000
--- a/include/asm-sparc/sbus.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_SBUS_H
2#define ___ASM_SPARC_SBUS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/sbus_64.h>
5#else
6#include <asm-sparc/sbus_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/scatterlist.h b/include/asm-sparc/scatterlist.h
deleted file mode 100644
index b1a0e316c2b6..000000000000
--- a/include/asm-sparc/scatterlist.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_SCATTERLIST_H
2#define ___ASM_SPARC_SCATTERLIST_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/scatterlist_64.h>
5#else
6#include <asm-sparc/scatterlist_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/sections.h b/include/asm-sparc/sections.h
deleted file mode 100644
index cbd019162425..000000000000
--- a/include/asm-sparc/sections.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_SECTIONS_H
2#define ___ASM_SPARC_SECTIONS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/sections_64.h>
5#else
6#include <asm-sparc/sections_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/sfp-machine.h b/include/asm-sparc/sfp-machine.h
deleted file mode 100644
index c676fcc2dd27..000000000000
--- a/include/asm-sparc/sfp-machine.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_SFP_MACHINE_H
2#define ___ASM_SPARC_SFP_MACHINE_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/sfp-machine_64.h>
5#else
6#include <asm-sparc/sfp-machine_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/shmparam.h b/include/asm-sparc/shmparam.h
deleted file mode 100644
index 16fda7e9acc8..000000000000
--- a/include/asm-sparc/shmparam.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_SHMPARAM_H
2#define ___ASM_SPARC_SHMPARAM_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/shmparam_64.h>
5#else
6#include <asm-sparc/shmparam_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/sigcontext.h b/include/asm-sparc/sigcontext.h
deleted file mode 100644
index 82fc7d54a4fa..000000000000
--- a/include/asm-sparc/sigcontext.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_SIGCONTEXT_H
2#define ___ASM_SPARC_SIGCONTEXT_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/sigcontext_64.h>
5#else
6#include <asm-sparc/sigcontext_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/siginfo.h b/include/asm-sparc/siginfo.h
deleted file mode 100644
index 2c9fccf4ce18..000000000000
--- a/include/asm-sparc/siginfo.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_SIGINFO_H
2#define ___ASM_SPARC_SIGINFO_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/siginfo_64.h>
5#else
6#include <asm-sparc/siginfo_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h
deleted file mode 100644
index 36f5f9e482f7..000000000000
--- a/include/asm-sparc/signal.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_SIGNAL_H
2#define ___ASM_SPARC_SIGNAL_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/signal_64.h>
5#else
6#include <asm-sparc/signal_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
deleted file mode 100644
index 1f9dedfbabd8..000000000000
--- a/include/asm-sparc/smp.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_SMP_H
2#define ___ASM_SPARC_SMP_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/smp_64.h>
5#else
6#include <asm-sparc/smp_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h
deleted file mode 100644
index 3b71c50b72eb..000000000000
--- a/include/asm-sparc/spinlock.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_SPINLOCK_H
2#define ___ASM_SPARC_SPINLOCK_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/spinlock_64.h>
5#else
6#include <asm-sparc/spinlock_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/stat.h b/include/asm-sparc/stat.h
deleted file mode 100644
index 9fdcaf8c9cd3..000000000000
--- a/include/asm-sparc/stat.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_STAT_H
2#define ___ASM_SPARC_STAT_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/stat_64.h>
5#else
6#include <asm-sparc/stat_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/statfs.h b/include/asm-sparc/statfs.h
deleted file mode 100644
index a70cc52e7018..000000000000
--- a/include/asm-sparc/statfs.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_STATFS_H
2#define ___ASM_SPARC_STATFS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/statfs_64.h>
5#else
6#include <asm-sparc/statfs_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/string.h b/include/asm-sparc/string.h
deleted file mode 100644
index 14c04c7697a5..000000000000
--- a/include/asm-sparc/string.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_STRING_H
2#define ___ASM_SPARC_STRING_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/string_64.h>
5#else
6#include <asm-sparc/string_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/sunbpp.h b/include/asm-sparc/sunbpp.h
deleted file mode 100644
index 92ee1a8ff3a2..000000000000
--- a/include/asm-sparc/sunbpp.h
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * include/asm-sparc/sunbpp.h
3 */
4
5#ifndef _ASM_SPARC_SUNBPP_H
6#define _ASM_SPARC_SUNBPP_H
7
8struct bpp_regs {
9 /* DMA registers */
10 __volatile__ __u32 p_csr; /* DMA Control/Status Register */
11 __volatile__ __u32 p_addr; /* Address Register */
12 __volatile__ __u32 p_bcnt; /* Byte Count Register */
13 __volatile__ __u32 p_tst_csr; /* Test Control/Status (DMA2 only) */
14 /* Parallel Port registers */
15 __volatile__ __u16 p_hcr; /* Hardware Configuration Register */
16 __volatile__ __u16 p_ocr; /* Operation Configuration Register */
17 __volatile__ __u8 p_dr; /* Parallel Data Register */
18 __volatile__ __u8 p_tcr; /* Transfer Control Register */
19 __volatile__ __u8 p_or; /* Output Register */
20 __volatile__ __u8 p_ir; /* Input Register */
21 __volatile__ __u16 p_icr; /* Interrupt Control Register */
22};
23
24/* P_HCR. Time is in increments of SBus clock. */
25#define P_HCR_TEST 0x8000 /* Allows buried counters to be read */
26#define P_HCR_DSW 0x7f00 /* Data strobe width (in ticks) */
27#define P_HCR_DDS 0x007f /* Data setup before strobe (in ticks) */
28
29/* P_OCR. */
30#define P_OCR_MEM_CLR 0x8000
31#define P_OCR_DATA_SRC 0x4000 /* ) */
32#define P_OCR_DS_DSEL 0x2000 /* ) Bidirectional */
33#define P_OCR_BUSY_DSEL 0x1000 /* ) selects */
34#define P_OCR_ACK_DSEL 0x0800 /* ) */
35#define P_OCR_EN_DIAG 0x0400
36#define P_OCR_BUSY_OP 0x0200 /* Busy operation */
37#define P_OCR_ACK_OP 0x0100 /* Ack operation */
38#define P_OCR_SRST 0x0080 /* Reset state machines. Not selfcleaning. */
39#define P_OCR_IDLE 0x0008 /* PP data transfer state machine is idle */
40#define P_OCR_V_ILCK 0x0002 /* Versatec faded. Zebra only. */
41#define P_OCR_EN_VER 0x0001 /* Enable Versatec (0 - enable). Zebra only. */
42
43/* P_TCR */
44#define P_TCR_DIR 0x08
45#define P_TCR_BUSY 0x04
46#define P_TCR_ACK 0x02
47#define P_TCR_DS 0x01 /* Strobe */
48
49/* P_OR */
50#define P_OR_V3 0x20 /* ) */
51#define P_OR_V2 0x10 /* ) on Zebra only */
52#define P_OR_V1 0x08 /* ) */
53#define P_OR_INIT 0x04
54#define P_OR_AFXN 0x02 /* Auto Feed */
55#define P_OR_SLCT_IN 0x01
56
57/* P_IR */
58#define P_IR_PE 0x04
59#define P_IR_SLCT 0x02
60#define P_IR_ERR 0x01
61
62/* P_ICR */
63#define P_DS_IRQ 0x8000 /* RW1 */
64#define P_ACK_IRQ 0x4000 /* RW1 */
65#define P_BUSY_IRQ 0x2000 /* RW1 */
66#define P_PE_IRQ 0x1000 /* RW1 */
67#define P_SLCT_IRQ 0x0800 /* RW1 */
68#define P_ERR_IRQ 0x0400 /* RW1 */
69#define P_DS_IRQ_EN 0x0200 /* RW Always on rising edge */
70#define P_ACK_IRQ_EN 0x0100 /* RW Always on rising edge */
71#define P_BUSY_IRP 0x0080 /* RW 1= rising edge */
72#define P_BUSY_IRQ_EN 0x0040 /* RW */
73#define P_PE_IRP 0x0020 /* RW 1= rising edge */
74#define P_PE_IRQ_EN 0x0010 /* RW */
75#define P_SLCT_IRP 0x0008 /* RW 1= rising edge */
76#define P_SLCT_IRQ_EN 0x0004 /* RW */
77#define P_ERR_IRP 0x0002 /* RW1 1= rising edge */
78#define P_ERR_IRQ_EN 0x0001 /* RW */
79
80#endif /* !(_ASM_SPARC_SUNBPP_H) */
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
deleted file mode 100644
index 15e2a3bc4f61..000000000000
--- a/include/asm-sparc/system.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_SYSTEM_H
2#define ___ASM_SPARC_SYSTEM_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/system_64.h>
5#else
6#include <asm-sparc/system_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/thread_info.h b/include/asm-sparc/thread_info.h
deleted file mode 100644
index 64155cf89f37..000000000000
--- a/include/asm-sparc/thread_info.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_THREAD_INFO_H
2#define ___ASM_SPARC_THREAD_INFO_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/thread_info_64.h>
5#else
6#include <asm-sparc/thread_info_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/thread_info_32.h b/include/asm-sparc/thread_info_32.h
deleted file mode 100644
index 2cf9db044055..000000000000
--- a/include/asm-sparc/thread_info_32.h
+++ /dev/null
@@ -1,153 +0,0 @@
1/*
2 * thread_info.h: sparc low-level thread information
3 * adapted from the ppc version by Pete Zaitcev, which was
4 * adapted from the i386 version by Paul Mackerras
5 *
6 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
7 * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
8 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
9 */
10
11#ifndef _ASM_THREAD_INFO_H
12#define _ASM_THREAD_INFO_H
13
14#ifdef __KERNEL__
15
16#ifndef __ASSEMBLY__
17
18#include <asm/btfixup.h>
19#include <asm/ptrace.h>
20#include <asm/page.h>
21
22/*
23 * Low level task data.
24 *
25 * If you change this, change the TI_* offsets below to match.
26 */
27#define NSWINS 8
28struct thread_info {
29 unsigned long uwinmask;
30 struct task_struct *task; /* main task structure */
31 struct exec_domain *exec_domain; /* execution domain */
32 unsigned long flags; /* low level flags */
33 int cpu; /* cpu we're on */
34 int preempt_count; /* 0 => preemptable,
35 <0 => BUG */
36 int softirq_count;
37 int hardirq_count;
38
39 /* Context switch saved kernel state. */
40 unsigned long ksp; /* ... ksp __attribute__ ((aligned (8))); */
41 unsigned long kpc;
42 unsigned long kpsr;
43 unsigned long kwim;
44
45 /* A place to store user windows and stack pointers
46 * when the stack needs inspection.
47 */
48 struct reg_window reg_window[NSWINS]; /* align for ldd! */
49 unsigned long rwbuf_stkptrs[NSWINS];
50 unsigned long w_saved;
51
52 struct restart_block restart_block;
53};
54
55/*
56 * macros/functions for gaining access to the thread information structure
57 *
58 * preempt_count needs to be 1 initially, until the scheduler is functional.
59 */
60#define INIT_THREAD_INFO(tsk) \
61{ \
62 .uwinmask = 0, \
63 .task = &tsk, \
64 .exec_domain = &default_exec_domain, \
65 .flags = 0, \
66 .cpu = 0, \
67 .preempt_count = 1, \
68 .restart_block = { \
69 .fn = do_no_restart_syscall, \
70 }, \
71}
72
73#define init_thread_info (init_thread_union.thread_info)
74#define init_stack (init_thread_union.stack)
75
76/* how to get the thread information struct from C */
77register struct thread_info *current_thread_info_reg asm("g6");
78#define current_thread_info() (current_thread_info_reg)
79
80/*
81 * thread information allocation
82 */
83#if PAGE_SHIFT == 13
84#define THREAD_INFO_ORDER 0
85#else /* PAGE_SHIFT */
86#define THREAD_INFO_ORDER 1
87#endif
88
89#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
90
91BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info, void)
92#define alloc_thread_info(tsk) BTFIXUP_CALL(alloc_thread_info)()
93
94BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
95#define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti)
96
97#endif /* __ASSEMBLY__ */
98
99/*
100 * Size of kernel stack for each process.
101 * Observe the order of get_free_pages() in alloc_thread_info().
102 * The sun4 has 8K stack too, because it's short on memory, and 16K is a waste.
103 */
104#define THREAD_SIZE 8192
105
106/*
107 * Offsets in thread_info structure, used in assembly code
108 * The "#define REGWIN_SZ 0x40" was abolished, so no multiplications.
109 */
110#define TI_UWINMASK 0x00 /* uwinmask */
111#define TI_TASK 0x04
112#define TI_EXECDOMAIN 0x08 /* exec_domain */
113#define TI_FLAGS 0x0c
114#define TI_CPU 0x10
115#define TI_PREEMPT 0x14 /* preempt_count */
116#define TI_SOFTIRQ 0x18 /* softirq_count */
117#define TI_HARDIRQ 0x1c /* hardirq_count */
118#define TI_KSP 0x20 /* ksp */
119#define TI_KPC 0x24 /* kpc (ldd'ed with kpc) */
120#define TI_KPSR 0x28 /* kpsr */
121#define TI_KWIM 0x2c /* kwim (ldd'ed with kpsr) */
122#define TI_REG_WINDOW 0x30
123#define TI_RWIN_SPTRS 0x230
124#define TI_W_SAVED 0x250
125/* #define TI_RESTART_BLOCK 0x25n */ /* Nobody cares */
126
127#define PREEMPT_ACTIVE 0x4000000
128
129/*
130 * thread information flag bit numbers
131 */
132#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
133/* flag bit 1 is available */
134#define TIF_SIGPENDING 2 /* signal pending */
135#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
136#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
137#define TIF_USEDFPU 8 /* FPU was used by this task
138 * this quantum (SMP) */
139#define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling
140 * TIF_NEED_RESCHED */
141#define TIF_MEMDIE 10
142
143/* as above, but as bit values */
144#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
145#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
146#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
147#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
148#define _TIF_USEDFPU (1<<TIF_USEDFPU)
149#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
150
151#endif /* __KERNEL__ */
152
153#endif /* _ASM_THREAD_INFO_H */
diff --git a/include/asm-sparc/thread_info_64.h b/include/asm-sparc/thread_info_64.h
deleted file mode 100644
index 960969d5ad06..000000000000
--- a/include/asm-sparc/thread_info_64.h
+++ /dev/null
@@ -1,279 +0,0 @@
1/* thread_info.h: sparc64 low-level thread information
2 *
3 * Copyright (C) 2002 David S. Miller (davem@redhat.com)
4 */
5
6#ifndef _ASM_THREAD_INFO_H
7#define _ASM_THREAD_INFO_H
8
9#ifdef __KERNEL__
10
11#define NSWINS 7
12
13#define TI_FLAG_BYTE_FAULT_CODE 0
14#define TI_FLAG_FAULT_CODE_SHIFT 56
15#define TI_FLAG_BYTE_WSTATE 1
16#define TI_FLAG_WSTATE_SHIFT 48
17#define TI_FLAG_BYTE_CWP 2
18#define TI_FLAG_CWP_SHIFT 40
19#define TI_FLAG_BYTE_CURRENT_DS 3
20#define TI_FLAG_CURRENT_DS_SHIFT 32
21#define TI_FLAG_BYTE_FPDEPTH 4
22#define TI_FLAG_FPDEPTH_SHIFT 24
23#define TI_FLAG_BYTE_WSAVED 5
24#define TI_FLAG_WSAVED_SHIFT 16
25
26#include <asm/page.h>
27
28#ifndef __ASSEMBLY__
29
30#include <asm/ptrace.h>
31#include <asm/types.h>
32
33struct task_struct;
34struct exec_domain;
35
36struct thread_info {
37 /* D$ line 1 */
38 struct task_struct *task;
39 unsigned long flags;
40 __u8 fpsaved[7];
41 __u8 status;
42 unsigned long ksp;
43
44 /* D$ line 2 */
45 unsigned long fault_address;
46 struct pt_regs *kregs;
47 struct exec_domain *exec_domain;
48 int preempt_count; /* 0 => preemptable, <0 => BUG */
49 __u8 new_child;
50 __u8 syscall_noerror;
51 __u16 cpu;
52
53 unsigned long *utraps;
54
55 struct reg_window reg_window[NSWINS];
56 unsigned long rwbuf_stkptrs[NSWINS];
57
58 unsigned long gsr[7];
59 unsigned long xfsr[7];
60
61 __u64 __user *user_cntd0;
62 __u64 __user *user_cntd1;
63 __u64 kernel_cntd0, kernel_cntd1;
64 __u64 pcr_reg;
65
66 struct restart_block restart_block;
67
68 struct pt_regs *kern_una_regs;
69 unsigned int kern_una_insn;
70
71 unsigned long fpregs[0] __attribute__ ((aligned(64)));
72};
73
74#endif /* !(__ASSEMBLY__) */
75
76/* offsets into the thread_info struct for assembly code access */
77#define TI_TASK 0x00000000
78#define TI_FLAGS 0x00000008
79#define TI_FAULT_CODE (TI_FLAGS + TI_FLAG_BYTE_FAULT_CODE)
80#define TI_WSTATE (TI_FLAGS + TI_FLAG_BYTE_WSTATE)
81#define TI_CWP (TI_FLAGS + TI_FLAG_BYTE_CWP)
82#define TI_CURRENT_DS (TI_FLAGS + TI_FLAG_BYTE_CURRENT_DS)
83#define TI_FPDEPTH (TI_FLAGS + TI_FLAG_BYTE_FPDEPTH)
84#define TI_WSAVED (TI_FLAGS + TI_FLAG_BYTE_WSAVED)
85#define TI_FPSAVED 0x00000010
86#define TI_KSP 0x00000018
87#define TI_FAULT_ADDR 0x00000020
88#define TI_KREGS 0x00000028
89#define TI_EXEC_DOMAIN 0x00000030
90#define TI_PRE_COUNT 0x00000038
91#define TI_NEW_CHILD 0x0000003c
92#define TI_SYS_NOERROR 0x0000003d
93#define TI_CPU 0x0000003e
94#define TI_UTRAPS 0x00000040
95#define TI_REG_WINDOW 0x00000048
96#define TI_RWIN_SPTRS 0x000003c8
97#define TI_GSR 0x00000400
98#define TI_XFSR 0x00000438
99#define TI_USER_CNTD0 0x00000470
100#define TI_USER_CNTD1 0x00000478
101#define TI_KERN_CNTD0 0x00000480
102#define TI_KERN_CNTD1 0x00000488
103#define TI_PCR 0x00000490
104#define TI_RESTART_BLOCK 0x00000498
105#define TI_KUNA_REGS 0x000004c0
106#define TI_KUNA_INSN 0x000004c8
107#define TI_FPREGS 0x00000500
108
109/* We embed this in the uppermost byte of thread_info->flags */
110#define FAULT_CODE_WRITE 0x01 /* Write access, implies D-TLB */
111#define FAULT_CODE_DTLB 0x02 /* Miss happened in D-TLB */
112#define FAULT_CODE_ITLB 0x04 /* Miss happened in I-TLB */
113#define FAULT_CODE_WINFIXUP 0x08 /* Miss happened during spill/fill */
114#define FAULT_CODE_BLKCOMMIT 0x10 /* Use blk-commit ASI in copy_page */
115
116#if PAGE_SHIFT == 13
117#define THREAD_SIZE (2*PAGE_SIZE)
118#define THREAD_SHIFT (PAGE_SHIFT + 1)
119#else /* PAGE_SHIFT == 13 */
120#define THREAD_SIZE PAGE_SIZE
121#define THREAD_SHIFT PAGE_SHIFT
122#endif /* PAGE_SHIFT == 13 */
123
124#define PREEMPT_ACTIVE 0x4000000
125
126/*
127 * macros/functions for gaining access to the thread information structure
128 *
129 * preempt_count needs to be 1 initially, until the scheduler is functional.
130 */
131#ifndef __ASSEMBLY__
132
133#define INIT_THREAD_INFO(tsk) \
134{ \
135 .task = &tsk, \
136 .flags = ((unsigned long)ASI_P) << TI_FLAG_CURRENT_DS_SHIFT, \
137 .exec_domain = &default_exec_domain, \
138 .preempt_count = 1, \
139 .restart_block = { \
140 .fn = do_no_restart_syscall, \
141 }, \
142}
143
144#define init_thread_info (init_thread_union.thread_info)
145#define init_stack (init_thread_union.stack)
146
147/* how to get the thread information struct from C */
148register struct thread_info *current_thread_info_reg asm("g6");
149#define current_thread_info() (current_thread_info_reg)
150
151/* thread information allocation */
152#if PAGE_SHIFT == 13
153#define __THREAD_INFO_ORDER 1
154#else /* PAGE_SHIFT == 13 */
155#define __THREAD_INFO_ORDER 0
156#endif /* PAGE_SHIFT == 13 */
157
158#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
159
160#ifdef CONFIG_DEBUG_STACK_USAGE
161#define alloc_thread_info(tsk) \
162({ \
163 struct thread_info *ret; \
164 \
165 ret = (struct thread_info *) \
166 __get_free_pages(GFP_KERNEL, __THREAD_INFO_ORDER); \
167 if (ret) \
168 memset(ret, 0, PAGE_SIZE<<__THREAD_INFO_ORDER); \
169 ret; \
170})
171#else
172#define alloc_thread_info(tsk) \
173 ((struct thread_info *)__get_free_pages(GFP_KERNEL, __THREAD_INFO_ORDER))
174#endif
175
176#define free_thread_info(ti) \
177 free_pages((unsigned long)(ti),__THREAD_INFO_ORDER)
178
179#define __thread_flag_byte_ptr(ti) \
180 ((unsigned char *)(&((ti)->flags)))
181#define __cur_thread_flag_byte_ptr __thread_flag_byte_ptr(current_thread_info())
182
183#define get_thread_fault_code() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FAULT_CODE])
184#define set_thread_fault_code(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FAULT_CODE] = (val))
185#define get_thread_wstate() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSTATE])
186#define set_thread_wstate(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSTATE] = (val))
187#define get_thread_cwp() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP])
188#define set_thread_cwp(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CWP] = (val))
189#define get_thread_current_ds() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS])
190#define set_thread_current_ds(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_CURRENT_DS] = (val))
191#define get_thread_fpdepth() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH])
192#define set_thread_fpdepth(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_FPDEPTH] = (val))
193#define get_thread_wsaved() (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED])
194#define set_thread_wsaved(val) (__cur_thread_flag_byte_ptr[TI_FLAG_BYTE_WSAVED] = (val))
195
196#endif /* !(__ASSEMBLY__) */
197
198/*
199 * Thread information flags, only 16 bits are available as we encode
200 * other values into the upper 6 bytes.
201 *
202 * On trap return we need to test several values:
203 *
204 * user: need_resched, notify_resume, sigpending, wsaved, perfctr
205 * kernel: fpdepth
206 *
207 * So to check for work in the kernel case we simply load the fpdepth
208 * byte out of the flags and test it. For the user case we encode the
209 * lower 3 bytes of flags as follows:
210 * ----------------------------------------
211 * | wsaved | flags byte 1 | flags byte 2 |
212 * ----------------------------------------
213 * This optimizes the user test into:
214 * ldx [%g6 + TI_FLAGS], REG1
215 * sethi %hi(_TIF_USER_WORK_MASK), REG2
216 * or REG2, %lo(_TIF_USER_WORK_MASK), REG2
217 * andcc REG1, REG2, %g0
218 * be,pt no_work_to_do
219 * nop
220 */
221#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
222/* flags bit 1 is available */
223#define TIF_SIGPENDING 2 /* signal pending */
224#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
225#define TIF_PERFCTR 4 /* performance counters active */
226#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */
227/* flag bit 6 is available */
228#define TIF_32BIT 7 /* 32-bit binary */
229/* flag bit 8 is available */
230#define TIF_SECCOMP 9 /* secure computing */
231#define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */
232/* flag bit 11 is available */
233/* NOTE: Thread flags >= 12 should be ones we have no interest
234 * in using in assembly, else we can't use the mask as
235 * an immediate value in instructions such as andcc.
236 */
237#define TIF_ABI_PENDING 12
238#define TIF_MEMDIE 13
239#define TIF_POLLING_NRFLAG 14
240
241#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
242#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
243#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
244#define _TIF_PERFCTR (1<<TIF_PERFCTR)
245#define _TIF_UNALIGNED (1<<TIF_UNALIGNED)
246#define _TIF_32BIT (1<<TIF_32BIT)
247#define _TIF_SECCOMP (1<<TIF_SECCOMP)
248#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
249#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
250#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
251
252#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \
253 (_TIF_SIGPENDING | \
254 _TIF_NEED_RESCHED | _TIF_PERFCTR))
255
256/*
257 * Thread-synchronous status.
258 *
259 * This is different from the flags in that nobody else
260 * ever touches our thread-synchronous status, so we don't
261 * have to worry about atomic accesses.
262 *
263 * Note that there are only 8 bits available.
264 */
265#define TS_RESTORE_SIGMASK 0x0001 /* restore signal mask in do_signal() */
266
267#ifndef __ASSEMBLY__
268#define HAVE_SET_RESTORE_SIGMASK 1
269static inline void set_restore_sigmask(void)
270{
271 struct thread_info *ti = current_thread_info();
272 ti->status |= TS_RESTORE_SIGMASK;
273 set_bit(TIF_SIGPENDING, &ti->flags);
274}
275#endif /* !__ASSEMBLY__ */
276
277#endif /* __KERNEL__ */
278
279#endif /* _ASM_THREAD_INFO_H */
diff --git a/include/asm-sparc/timer.h b/include/asm-sparc/timer.h
deleted file mode 100644
index 475baa05a96e..000000000000
--- a/include/asm-sparc/timer.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_TIMER_H
2#define ___ASM_SPARC_TIMER_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/timer_64.h>
5#else
6#include <asm-sparc/timer_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/timex.h b/include/asm-sparc/timex.h
deleted file mode 100644
index 01d9f199d452..000000000000
--- a/include/asm-sparc/timex.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_TIMEX_H
2#define ___ASM_SPARC_TIMEX_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/timex_64.h>
5#else
6#include <asm-sparc/timex_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/timex_32.h b/include/asm-sparc/timex_32.h
deleted file mode 100644
index 71b45c90ccae..000000000000
--- a/include/asm-sparc/timex_32.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * linux/include/asm-sparc/timex.h
3 *
4 * sparc architecture timex specifications
5 */
6#ifndef _ASMsparc_TIMEX_H
7#define _ASMsparc_TIMEX_H
8
9#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
10
11/* XXX Maybe do something better at some point... -DaveM */
12typedef unsigned long cycles_t;
13#define get_cycles() (0)
14
15#endif
diff --git a/include/asm-sparc/timex_64.h b/include/asm-sparc/timex_64.h
deleted file mode 100644
index c622535c4560..000000000000
--- a/include/asm-sparc/timex_64.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * linux/include/asm-sparc64/timex.h
3 *
4 * sparc64 architecture timex specifications
5 */
6#ifndef _ASMsparc64_TIMEX_H
7#define _ASMsparc64_TIMEX_H
8
9#include <asm/timer.h>
10
11#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
12
13/* Getting on the cycle counter on sparc64. */
14typedef unsigned long cycles_t;
15#define get_cycles() tick_ops->get_tick()
16
17#define ARCH_HAS_READ_CURRENT_TIMER
18
19#endif
diff --git a/include/asm-sparc/tlb.h b/include/asm-sparc/tlb.h
deleted file mode 100644
index a821057327c4..000000000000
--- a/include/asm-sparc/tlb.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_TLB_H
2#define ___ASM_SPARC_TLB_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/tlb_64.h>
5#else
6#include <asm-sparc/tlb_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/tlbflush.h b/include/asm-sparc/tlbflush.h
deleted file mode 100644
index 6e6bc12227b8..000000000000
--- a/include/asm-sparc/tlbflush.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_TLBFLUSH_H
2#define ___ASM_SPARC_TLBFLUSH_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/tlbflush_64.h>
5#else
6#include <asm-sparc/tlbflush_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/topology.h b/include/asm-sparc/topology.h
deleted file mode 100644
index ed13630f32e2..000000000000
--- a/include/asm-sparc/topology.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_TOPOLOGY_H
2#define ___ASM_SPARC_TOPOLOGY_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/topology_64.h>
5#else
6#include <asm-sparc/topology_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h
deleted file mode 100644
index 424facce5238..000000000000
--- a/include/asm-sparc/uaccess.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_UACCESS_H
2#define ___ASM_SPARC_UACCESS_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/uaccess_64.h>
5#else
6#include <asm-sparc/uaccess_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
deleted file mode 100644
index 3c2609618a09..000000000000
--- a/include/asm-sparc/unistd.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_UNISTD_H
2#define ___ASM_SPARC_UNISTD_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/unistd_64.h>
5#else
6#include <asm-sparc/unistd_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/utrap.h b/include/asm-sparc/utrap.h
deleted file mode 100644
index 9da37babbe5b..000000000000
--- a/include/asm-sparc/utrap.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * include/asm-sparc64/utrap.h
3 *
4 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
5 */
6
7#ifndef __ASM_SPARC64_UTRAP_H
8#define __ASM_SPARC64_UTRAP_H
9
10#define UT_INSTRUCTION_EXCEPTION 1
11#define UT_INSTRUCTION_ERROR 2
12#define UT_INSTRUCTION_PROTECTION 3
13#define UT_ILLTRAP_INSTRUCTION 4
14#define UT_ILLEGAL_INSTRUCTION 5
15#define UT_PRIVILEGED_OPCODE 6
16#define UT_FP_DISABLED 7
17#define UT_FP_EXCEPTION_IEEE_754 8
18#define UT_FP_EXCEPTION_OTHER 9
19#define UT_TAG_OVERVIEW 10
20#define UT_DIVISION_BY_ZERO 11
21#define UT_DATA_EXCEPTION 12
22#define UT_DATA_ERROR 13
23#define UT_DATA_PROTECTION 14
24#define UT_MEM_ADDRESS_NOT_ALIGNED 15
25#define UT_PRIVILEGED_ACTION 16
26#define UT_ASYNC_DATA_ERROR 17
27#define UT_TRAP_INSTRUCTION_16 18
28#define UT_TRAP_INSTRUCTION_17 19
29#define UT_TRAP_INSTRUCTION_18 20
30#define UT_TRAP_INSTRUCTION_19 21
31#define UT_TRAP_INSTRUCTION_20 22
32#define UT_TRAP_INSTRUCTION_21 23
33#define UT_TRAP_INSTRUCTION_22 24
34#define UT_TRAP_INSTRUCTION_23 25
35#define UT_TRAP_INSTRUCTION_24 26
36#define UT_TRAP_INSTRUCTION_25 27
37#define UT_TRAP_INSTRUCTION_26 28
38#define UT_TRAP_INSTRUCTION_27 29
39#define UT_TRAP_INSTRUCTION_28 30
40#define UT_TRAP_INSTRUCTION_29 31
41#define UT_TRAP_INSTRUCTION_30 32
42#define UT_TRAP_INSTRUCTION_31 33
43
44#define UTH_NOCHANGE (-1)
45
46#ifndef __ASSEMBLY__
47typedef int utrap_entry_t;
48typedef void *utrap_handler_t;
49#endif /* __ASSEMBLY__ */
50
51#endif /* !(__ASM_SPARC64_PROCESSOR_H) */
diff --git a/include/asm-sparc/vaddrs.h b/include/asm-sparc/vaddrs.h
deleted file mode 100644
index a22fed5a3c6b..000000000000
--- a/include/asm-sparc/vaddrs.h
+++ /dev/null
@@ -1,64 +0,0 @@
1#ifndef _SPARC_VADDRS_H
2#define _SPARC_VADDRS_H
3
4#include <asm/head.h>
5
6/*
7 * asm-sparc/vaddrs.h: Here we define the virtual addresses at
8 * which important things will be mapped.
9 *
10 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
11 * Copyright (C) 2000 Anton Blanchard (anton@samba.org)
12 */
13
14#define SRMMU_MAXMEM 0x0c000000
15
16#define SRMMU_NOCACHE_VADDR (KERNBASE + SRMMU_MAXMEM)
17 /* = 0x0fc000000 */
18/* XXX Empiricals - this needs to go away - KMW */
19#define SRMMU_MIN_NOCACHE_PAGES (550)
20#define SRMMU_MAX_NOCACHE_PAGES (1280)
21
22/* The following constant is used in mm/srmmu.c::srmmu_nocache_calcsize()
23 * to determine the amount of memory that will be reserved as nocache:
24 *
25 * 256 pages will be taken as nocache per each
26 * SRMMU_NOCACHE_ALCRATIO MB of system memory.
27 *
28 * limits enforced: nocache minimum = 256 pages
29 * nocache maximum = 1280 pages
30 */
31#define SRMMU_NOCACHE_ALCRATIO 64 /* 256 pages per 64MB of system RAM */
32
33#define SUN4M_IOBASE_VADDR 0xfd000000 /* Base for mapping pages */
34#define IOBASE_VADDR 0xfe000000
35#define IOBASE_END 0xfe600000
36
37/*
38 * On the sun4/4c we need a place
39 * to reliably map locked down kernel data. This includes the
40 * task_struct and kernel stack pages of each process plus the
41 * scsi buffers during dvma IO transfers, also the floppy buffers
42 * during pseudo dma which runs with traps off (no faults allowed).
43 * Some quick calculations yield:
44 * NR_TASKS <512> * (3 * PAGE_SIZE) == 0x600000
45 * Subtract this from 0xc00000 and you get 0x927C0 of vm left
46 * over to map SCSI dvma + floppy pseudo-dma buffers. So be
47 * careful if you change NR_TASKS or else there won't be enough
48 * room for it all.
49 */
50#define SUN4C_LOCK_VADDR 0xff000000
51#define SUN4C_LOCK_END 0xffc00000
52
53#define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */
54#define KADB_DEBUGGER_ENDVM 0xffd00000
55#define DEBUG_FIRSTVADDR KADB_DEBUGGER_BEGVM
56#define DEBUG_LASTVADDR KADB_DEBUGGER_ENDVM
57
58#define LINUX_OPPROM_BEGVM 0xffd00000
59#define LINUX_OPPROM_ENDVM 0xfff00000
60
61#define DVMA_VADDR 0xfff00000 /* Base area of the DVMA on suns */
62#define DVMA_END 0xfffc0000
63
64#endif /* !(_SPARC_VADDRS_H) */
diff --git a/include/asm-sparc/xor.h b/include/asm-sparc/xor.h
deleted file mode 100644
index 35089a838c3f..000000000000
--- a/include/asm-sparc/xor.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_XOR_H
2#define ___ASM_SPARC_XOR_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm-sparc/xor_64.h>
5#else
6#include <asm-sparc/xor_32.h>
7#endif
8#endif
diff --git a/include/asm-sparc/xor_32.h b/include/asm-sparc/xor_32.h
deleted file mode 100644
index f34b2cfa8206..000000000000
--- a/include/asm-sparc/xor_32.h
+++ /dev/null
@@ -1,269 +0,0 @@
1/*
2 * include/asm-sparc/xor.h
3 *
4 * Optimized RAID-5 checksumming functions for 32-bit Sparc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * You should have received a copy of the GNU General Public License
12 * (for example /usr/src/linux/COPYING); if not, write to the Free
13 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
14 */
15
16/*
17 * High speed xor_block operation for RAID4/5 utilizing the
18 * ldd/std SPARC instructions.
19 *
20 * Copyright (C) 1999 Jakub Jelinek (jj@ultra.linux.cz)
21 */
22
23static void
24sparc_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
25{
26 int lines = bytes / (sizeof (long)) / 8;
27
28 do {
29 __asm__ __volatile__(
30 "ldd [%0 + 0x00], %%g2\n\t"
31 "ldd [%0 + 0x08], %%g4\n\t"
32 "ldd [%0 + 0x10], %%o0\n\t"
33 "ldd [%0 + 0x18], %%o2\n\t"
34 "ldd [%1 + 0x00], %%o4\n\t"
35 "ldd [%1 + 0x08], %%l0\n\t"
36 "ldd [%1 + 0x10], %%l2\n\t"
37 "ldd [%1 + 0x18], %%l4\n\t"
38 "xor %%g2, %%o4, %%g2\n\t"
39 "xor %%g3, %%o5, %%g3\n\t"
40 "xor %%g4, %%l0, %%g4\n\t"
41 "xor %%g5, %%l1, %%g5\n\t"
42 "xor %%o0, %%l2, %%o0\n\t"
43 "xor %%o1, %%l3, %%o1\n\t"
44 "xor %%o2, %%l4, %%o2\n\t"
45 "xor %%o3, %%l5, %%o3\n\t"
46 "std %%g2, [%0 + 0x00]\n\t"
47 "std %%g4, [%0 + 0x08]\n\t"
48 "std %%o0, [%0 + 0x10]\n\t"
49 "std %%o2, [%0 + 0x18]\n"
50 :
51 : "r" (p1), "r" (p2)
52 : "g2", "g3", "g4", "g5",
53 "o0", "o1", "o2", "o3", "o4", "o5",
54 "l0", "l1", "l2", "l3", "l4", "l5");
55 p1 += 8;
56 p2 += 8;
57 } while (--lines > 0);
58}
59
60static void
61sparc_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
62 unsigned long *p3)
63{
64 int lines = bytes / (sizeof (long)) / 8;
65
66 do {
67 __asm__ __volatile__(
68 "ldd [%0 + 0x00], %%g2\n\t"
69 "ldd [%0 + 0x08], %%g4\n\t"
70 "ldd [%0 + 0x10], %%o0\n\t"
71 "ldd [%0 + 0x18], %%o2\n\t"
72 "ldd [%1 + 0x00], %%o4\n\t"
73 "ldd [%1 + 0x08], %%l0\n\t"
74 "ldd [%1 + 0x10], %%l2\n\t"
75 "ldd [%1 + 0x18], %%l4\n\t"
76 "xor %%g2, %%o4, %%g2\n\t"
77 "xor %%g3, %%o5, %%g3\n\t"
78 "ldd [%2 + 0x00], %%o4\n\t"
79 "xor %%g4, %%l0, %%g4\n\t"
80 "xor %%g5, %%l1, %%g5\n\t"
81 "ldd [%2 + 0x08], %%l0\n\t"
82 "xor %%o0, %%l2, %%o0\n\t"
83 "xor %%o1, %%l3, %%o1\n\t"
84 "ldd [%2 + 0x10], %%l2\n\t"
85 "xor %%o2, %%l4, %%o2\n\t"
86 "xor %%o3, %%l5, %%o3\n\t"
87 "ldd [%2 + 0x18], %%l4\n\t"
88 "xor %%g2, %%o4, %%g2\n\t"
89 "xor %%g3, %%o5, %%g3\n\t"
90 "xor %%g4, %%l0, %%g4\n\t"
91 "xor %%g5, %%l1, %%g5\n\t"
92 "xor %%o0, %%l2, %%o0\n\t"
93 "xor %%o1, %%l3, %%o1\n\t"
94 "xor %%o2, %%l4, %%o2\n\t"
95 "xor %%o3, %%l5, %%o3\n\t"
96 "std %%g2, [%0 + 0x00]\n\t"
97 "std %%g4, [%0 + 0x08]\n\t"
98 "std %%o0, [%0 + 0x10]\n\t"
99 "std %%o2, [%0 + 0x18]\n"
100 :
101 : "r" (p1), "r" (p2), "r" (p3)
102 : "g2", "g3", "g4", "g5",
103 "o0", "o1", "o2", "o3", "o4", "o5",
104 "l0", "l1", "l2", "l3", "l4", "l5");
105 p1 += 8;
106 p2 += 8;
107 p3 += 8;
108 } while (--lines > 0);
109}
110
111static void
112sparc_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
113 unsigned long *p3, unsigned long *p4)
114{
115 int lines = bytes / (sizeof (long)) / 8;
116
117 do {
118 __asm__ __volatile__(
119 "ldd [%0 + 0x00], %%g2\n\t"
120 "ldd [%0 + 0x08], %%g4\n\t"
121 "ldd [%0 + 0x10], %%o0\n\t"
122 "ldd [%0 + 0x18], %%o2\n\t"
123 "ldd [%1 + 0x00], %%o4\n\t"
124 "ldd [%1 + 0x08], %%l0\n\t"
125 "ldd [%1 + 0x10], %%l2\n\t"
126 "ldd [%1 + 0x18], %%l4\n\t"
127 "xor %%g2, %%o4, %%g2\n\t"
128 "xor %%g3, %%o5, %%g3\n\t"
129 "ldd [%2 + 0x00], %%o4\n\t"
130 "xor %%g4, %%l0, %%g4\n\t"
131 "xor %%g5, %%l1, %%g5\n\t"
132 "ldd [%2 + 0x08], %%l0\n\t"
133 "xor %%o0, %%l2, %%o0\n\t"
134 "xor %%o1, %%l3, %%o1\n\t"
135 "ldd [%2 + 0x10], %%l2\n\t"
136 "xor %%o2, %%l4, %%o2\n\t"
137 "xor %%o3, %%l5, %%o3\n\t"
138 "ldd [%2 + 0x18], %%l4\n\t"
139 "xor %%g2, %%o4, %%g2\n\t"
140 "xor %%g3, %%o5, %%g3\n\t"
141 "ldd [%3 + 0x00], %%o4\n\t"
142 "xor %%g4, %%l0, %%g4\n\t"
143 "xor %%g5, %%l1, %%g5\n\t"
144 "ldd [%3 + 0x08], %%l0\n\t"
145 "xor %%o0, %%l2, %%o0\n\t"
146 "xor %%o1, %%l3, %%o1\n\t"
147 "ldd [%3 + 0x10], %%l2\n\t"
148 "xor %%o2, %%l4, %%o2\n\t"
149 "xor %%o3, %%l5, %%o3\n\t"
150 "ldd [%3 + 0x18], %%l4\n\t"
151 "xor %%g2, %%o4, %%g2\n\t"
152 "xor %%g3, %%o5, %%g3\n\t"
153 "xor %%g4, %%l0, %%g4\n\t"
154 "xor %%g5, %%l1, %%g5\n\t"
155 "xor %%o0, %%l2, %%o0\n\t"
156 "xor %%o1, %%l3, %%o1\n\t"
157 "xor %%o2, %%l4, %%o2\n\t"
158 "xor %%o3, %%l5, %%o3\n\t"
159 "std %%g2, [%0 + 0x00]\n\t"
160 "std %%g4, [%0 + 0x08]\n\t"
161 "std %%o0, [%0 + 0x10]\n\t"
162 "std %%o2, [%0 + 0x18]\n"
163 :
164 : "r" (p1), "r" (p2), "r" (p3), "r" (p4)
165 : "g2", "g3", "g4", "g5",
166 "o0", "o1", "o2", "o3", "o4", "o5",
167 "l0", "l1", "l2", "l3", "l4", "l5");
168 p1 += 8;
169 p2 += 8;
170 p3 += 8;
171 p4 += 8;
172 } while (--lines > 0);
173}
174
175static void
176sparc_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
177 unsigned long *p3, unsigned long *p4, unsigned long *p5)
178{
179 int lines = bytes / (sizeof (long)) / 8;
180
181 do {
182 __asm__ __volatile__(
183 "ldd [%0 + 0x00], %%g2\n\t"
184 "ldd [%0 + 0x08], %%g4\n\t"
185 "ldd [%0 + 0x10], %%o0\n\t"
186 "ldd [%0 + 0x18], %%o2\n\t"
187 "ldd [%1 + 0x00], %%o4\n\t"
188 "ldd [%1 + 0x08], %%l0\n\t"
189 "ldd [%1 + 0x10], %%l2\n\t"
190 "ldd [%1 + 0x18], %%l4\n\t"
191 "xor %%g2, %%o4, %%g2\n\t"
192 "xor %%g3, %%o5, %%g3\n\t"
193 "ldd [%2 + 0x00], %%o4\n\t"
194 "xor %%g4, %%l0, %%g4\n\t"
195 "xor %%g5, %%l1, %%g5\n\t"
196 "ldd [%2 + 0x08], %%l0\n\t"
197 "xor %%o0, %%l2, %%o0\n\t"
198 "xor %%o1, %%l3, %%o1\n\t"
199 "ldd [%2 + 0x10], %%l2\n\t"
200 "xor %%o2, %%l4, %%o2\n\t"
201 "xor %%o3, %%l5, %%o3\n\t"
202 "ldd [%2 + 0x18], %%l4\n\t"
203 "xor %%g2, %%o4, %%g2\n\t"
204 "xor %%g3, %%o5, %%g3\n\t"
205 "ldd [%3 + 0x00], %%o4\n\t"
206 "xor %%g4, %%l0, %%g4\n\t"
207 "xor %%g5, %%l1, %%g5\n\t"
208 "ldd [%3 + 0x08], %%l0\n\t"
209 "xor %%o0, %%l2, %%o0\n\t"
210 "xor %%o1, %%l3, %%o1\n\t"
211 "ldd [%3 + 0x10], %%l2\n\t"
212 "xor %%o2, %%l4, %%o2\n\t"
213 "xor %%o3, %%l5, %%o3\n\t"
214 "ldd [%3 + 0x18], %%l4\n\t"
215 "xor %%g2, %%o4, %%g2\n\t"
216 "xor %%g3, %%o5, %%g3\n\t"
217 "ldd [%4 + 0x00], %%o4\n\t"
218 "xor %%g4, %%l0, %%g4\n\t"
219 "xor %%g5, %%l1, %%g5\n\t"
220 "ldd [%4 + 0x08], %%l0\n\t"
221 "xor %%o0, %%l2, %%o0\n\t"
222 "xor %%o1, %%l3, %%o1\n\t"
223 "ldd [%4 + 0x10], %%l2\n\t"
224 "xor %%o2, %%l4, %%o2\n\t"
225 "xor %%o3, %%l5, %%o3\n\t"
226 "ldd [%4 + 0x18], %%l4\n\t"
227 "xor %%g2, %%o4, %%g2\n\t"
228 "xor %%g3, %%o5, %%g3\n\t"
229 "xor %%g4, %%l0, %%g4\n\t"
230 "xor %%g5, %%l1, %%g5\n\t"
231 "xor %%o0, %%l2, %%o0\n\t"
232 "xor %%o1, %%l3, %%o1\n\t"
233 "xor %%o2, %%l4, %%o2\n\t"
234 "xor %%o3, %%l5, %%o3\n\t"
235 "std %%g2, [%0 + 0x00]\n\t"
236 "std %%g4, [%0 + 0x08]\n\t"
237 "std %%o0, [%0 + 0x10]\n\t"
238 "std %%o2, [%0 + 0x18]\n"
239 :
240 : "r" (p1), "r" (p2), "r" (p3), "r" (p4), "r" (p5)
241 : "g2", "g3", "g4", "g5",
242 "o0", "o1", "o2", "o3", "o4", "o5",
243 "l0", "l1", "l2", "l3", "l4", "l5");
244 p1 += 8;
245 p2 += 8;
246 p3 += 8;
247 p4 += 8;
248 p5 += 8;
249 } while (--lines > 0);
250}
251
252static struct xor_block_template xor_block_SPARC = {
253 .name = "SPARC",
254 .do_2 = sparc_2,
255 .do_3 = sparc_3,
256 .do_4 = sparc_4,
257 .do_5 = sparc_5,
258};
259
260/* For grins, also test the generic routines. */
261#include <asm-generic/xor.h>
262
263#undef XOR_TRY_TEMPLATES
264#define XOR_TRY_TEMPLATES \
265 do { \
266 xor_speed(&xor_block_8regs); \
267 xor_speed(&xor_block_32regs); \
268 xor_speed(&xor_block_SPARC); \
269 } while (0)
diff --git a/include/asm-sparc/xor_64.h b/include/asm-sparc/xor_64.h
deleted file mode 100644
index a0233884fc94..000000000000
--- a/include/asm-sparc/xor_64.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * include/asm-sparc64/xor.h
3 *
4 * High speed xor_block operation for RAID4/5 utilizing the
5 * UltraSparc Visual Instruction Set and Niagara block-init
6 * twin-load instructions.
7 *
8 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
9 * Copyright (C) 2006 David S. Miller <davem@davemloft.net>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
15 *
16 * You should have received a copy of the GNU General Public License
17 * (for example /usr/src/linux/COPYING); if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#include <asm/spitfire.h>
22
23extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *);
24extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *,
25 unsigned long *);
26extern void xor_vis_4(unsigned long, unsigned long *, unsigned long *,
27 unsigned long *, unsigned long *);
28extern void xor_vis_5(unsigned long, unsigned long *, unsigned long *,
29 unsigned long *, unsigned long *, unsigned long *);
30
31/* XXX Ugh, write cheetah versions... -DaveM */
32
33static struct xor_block_template xor_block_VIS = {
34 .name = "VIS",
35 .do_2 = xor_vis_2,
36 .do_3 = xor_vis_3,
37 .do_4 = xor_vis_4,
38 .do_5 = xor_vis_5,
39};
40
41extern void xor_niagara_2(unsigned long, unsigned long *, unsigned long *);
42extern void xor_niagara_3(unsigned long, unsigned long *, unsigned long *,
43 unsigned long *);
44extern void xor_niagara_4(unsigned long, unsigned long *, unsigned long *,
45 unsigned long *, unsigned long *);
46extern void xor_niagara_5(unsigned long, unsigned long *, unsigned long *,
47 unsigned long *, unsigned long *, unsigned long *);
48
49static struct xor_block_template xor_block_niagara = {
50 .name = "Niagara",
51 .do_2 = xor_niagara_2,
52 .do_3 = xor_niagara_3,
53 .do_4 = xor_niagara_4,
54 .do_5 = xor_niagara_5,
55};
56
57#undef XOR_TRY_TEMPLATES
58#define XOR_TRY_TEMPLATES \
59 do { \
60 xor_speed(&xor_block_VIS); \
61 xor_speed(&xor_block_niagara); \
62 } while (0)
63
64/* For VIS for everything except Niagara. */
65#define XOR_SELECT_TEMPLATE(FASTEST) \
66 ((tlb_type == hypervisor && \
67 (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \
68 sun4v_chip_type == SUN4V_CHIP_NIAGARA2)) ? \
69 &xor_block_niagara : \
70 &xor_block_VIS)
diff --git a/include/asm-sparc64/Kbuild b/include/asm-sparc64/Kbuild
deleted file mode 100644
index 6cdaf9d33b38..000000000000
--- a/include/asm-sparc64/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1# dummy file to avoid breaking make headers_install
diff --git a/include/asm-sparc64/agp.h b/include/asm-sparc64/agp.h
deleted file mode 100644
index eb8d4b3f5163..000000000000
--- a/include/asm-sparc64/agp.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/agp.h>
diff --git a/include/asm-sparc64/apb.h b/include/asm-sparc64/apb.h
deleted file mode 100644
index 5e236ca6e492..000000000000
--- a/include/asm-sparc64/apb.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/apb.h>
diff --git a/include/asm-sparc64/asi.h b/include/asm-sparc64/asi.h
deleted file mode 100644
index 9b7110c516e8..000000000000
--- a/include/asm-sparc64/asi.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/asi.h>
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h
deleted file mode 100644
index f5126826ba34..000000000000
--- a/include/asm-sparc64/atomic.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/atomic.h>
diff --git a/include/asm-sparc64/auxio.h b/include/asm-sparc64/auxio.h
deleted file mode 100644
index 46c9042f30b4..000000000000
--- a/include/asm-sparc64/auxio.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/auxio.h>
diff --git a/include/asm-sparc64/auxvec.h b/include/asm-sparc64/auxvec.h
deleted file mode 100644
index 1f45c67d7316..000000000000
--- a/include/asm-sparc64/auxvec.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/auxvec.h>
diff --git a/include/asm-sparc64/backoff.h b/include/asm-sparc64/backoff.h
deleted file mode 100644
index 8ee26d947e0e..000000000000
--- a/include/asm-sparc64/backoff.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/backoff.h>
diff --git a/include/asm-sparc64/bbc.h b/include/asm-sparc64/bbc.h
deleted file mode 100644
index 06e8b6306514..000000000000
--- a/include/asm-sparc64/bbc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/bbc.h>
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
deleted file mode 100644
index 204404355bdd..000000000000
--- a/include/asm-sparc64/bitops.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/bitops.h>
diff --git a/include/asm-sparc64/bpp.h b/include/asm-sparc64/bpp.h
deleted file mode 100644
index 514eee20272e..000000000000
--- a/include/asm-sparc64/bpp.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/bpp.h>
diff --git a/include/asm-sparc64/bug.h b/include/asm-sparc64/bug.h
deleted file mode 100644
index 3433737c7a67..000000000000
--- a/include/asm-sparc64/bug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/bug.h>
diff --git a/include/asm-sparc64/bugs.h b/include/asm-sparc64/bugs.h
deleted file mode 100644
index 04ae9e2818cf..000000000000
--- a/include/asm-sparc64/bugs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/bugs.h>
diff --git a/include/asm-sparc64/byteorder.h b/include/asm-sparc64/byteorder.h
deleted file mode 100644
index f672855bee17..000000000000
--- a/include/asm-sparc64/byteorder.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/byteorder.h>
diff --git a/include/asm-sparc64/cache.h b/include/asm-sparc64/cache.h
deleted file mode 100644
index fa9de5cadbf1..000000000000
--- a/include/asm-sparc64/cache.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/cache.h>
diff --git a/include/asm-sparc64/cacheflush.h b/include/asm-sparc64/cacheflush.h
deleted file mode 100644
index cf5b6b3e8a55..000000000000
--- a/include/asm-sparc64/cacheflush.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/cacheflush.h>
diff --git a/include/asm-sparc64/chafsr.h b/include/asm-sparc64/chafsr.h
deleted file mode 100644
index aaab97562a39..000000000000
--- a/include/asm-sparc64/chafsr.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/chafsr.h>
diff --git a/include/asm-sparc64/checksum.h b/include/asm-sparc64/checksum.h
deleted file mode 100644
index c3966c5e29d8..000000000000
--- a/include/asm-sparc64/checksum.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/checksum.h>
diff --git a/include/asm-sparc64/chmctrl.h b/include/asm-sparc64/chmctrl.h
deleted file mode 100644
index eb757b483b30..000000000000
--- a/include/asm-sparc64/chmctrl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/chmctrl.h>
diff --git a/include/asm-sparc64/cmt.h b/include/asm-sparc64/cmt.h
deleted file mode 100644
index b19b445cb810..000000000000
--- a/include/asm-sparc64/cmt.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/cmt.h>
diff --git a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h
deleted file mode 100644
index 8c155d221952..000000000000
--- a/include/asm-sparc64/compat.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/compat.h>
diff --git a/include/asm-sparc64/compat_signal.h b/include/asm-sparc64/compat_signal.h
deleted file mode 100644
index 7187dcc8cac7..000000000000
--- a/include/asm-sparc64/compat_signal.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/compat_signal.h>
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
deleted file mode 100644
index 3220e134a579..000000000000
--- a/include/asm-sparc64/cpudata.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/cpudata.h>
diff --git a/include/asm-sparc64/cputime.h b/include/asm-sparc64/cputime.h
deleted file mode 100644
index 435f37a92f7c..000000000000
--- a/include/asm-sparc64/cputime.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/cputime.h>
diff --git a/include/asm-sparc64/current.h b/include/asm-sparc64/current.h
deleted file mode 100644
index a7904a7f53a8..000000000000
--- a/include/asm-sparc64/current.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/current.h>
diff --git a/include/asm-sparc64/dcr.h b/include/asm-sparc64/dcr.h
deleted file mode 100644
index d67613b1f5fe..000000000000
--- a/include/asm-sparc64/dcr.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/dcr.h>
diff --git a/include/asm-sparc64/dcu.h b/include/asm-sparc64/dcu.h
deleted file mode 100644
index 28853f4968d1..000000000000
--- a/include/asm-sparc64/dcu.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/dcu.h>
diff --git a/include/asm-sparc64/delay.h b/include/asm-sparc64/delay.h
deleted file mode 100644
index 33dc5589d841..000000000000
--- a/include/asm-sparc64/delay.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/delay.h>
diff --git a/include/asm-sparc64/device.h b/include/asm-sparc64/device.h
deleted file mode 100644
index 4145c47097e2..000000000000
--- a/include/asm-sparc64/device.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/device.h>
diff --git a/include/asm-sparc64/display7seg.h b/include/asm-sparc64/display7seg.h
deleted file mode 100644
index e74f046b41de..000000000000
--- a/include/asm-sparc64/display7seg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/display7seg.h>
diff --git a/include/asm-sparc64/div64.h b/include/asm-sparc64/div64.h
deleted file mode 100644
index 928c94f99ecf..000000000000
--- a/include/asm-sparc64/div64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/div64.h>
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h
deleted file mode 100644
index 380b7b63147f..000000000000
--- a/include/asm-sparc64/dma-mapping.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/dma-mapping.h>
diff --git a/include/asm-sparc64/dma.h b/include/asm-sparc64/dma.h
deleted file mode 100644
index 2e36248e6b59..000000000000
--- a/include/asm-sparc64/dma.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/dma.h>
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h
deleted file mode 100644
index d7d476158bd5..000000000000
--- a/include/asm-sparc64/ebus.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/ebus.h>
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h
deleted file mode 100644
index f256d9472c82..000000000000
--- a/include/asm-sparc64/elf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/elf.h>
diff --git a/include/asm-sparc64/emergency-restart.h b/include/asm-sparc64/emergency-restart.h
deleted file mode 100644
index 2cac7b644da8..000000000000
--- a/include/asm-sparc64/emergency-restart.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/emergency-restart.h>
diff --git a/include/asm-sparc64/envctrl.h b/include/asm-sparc64/envctrl.h
deleted file mode 100644
index a2cc0ca334ba..000000000000
--- a/include/asm-sparc64/envctrl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/envctrl.h>
diff --git a/include/asm-sparc64/errno.h b/include/asm-sparc64/errno.h
deleted file mode 100644
index 9701fe01cc53..000000000000
--- a/include/asm-sparc64/errno.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/errno.h>
diff --git a/include/asm-sparc64/estate.h b/include/asm-sparc64/estate.h
deleted file mode 100644
index bedd0ef5f19c..000000000000
--- a/include/asm-sparc64/estate.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/estate.h>
diff --git a/include/asm-sparc64/fb.h b/include/asm-sparc64/fb.h
deleted file mode 100644
index 1c2ac5832f39..000000000000
--- a/include/asm-sparc64/fb.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/fb.h>
diff --git a/include/asm-sparc64/fbio.h b/include/asm-sparc64/fbio.h
deleted file mode 100644
index c17edf8c7bc4..000000000000
--- a/include/asm-sparc64/fbio.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/fbio.h>
diff --git a/include/asm-sparc64/fcntl.h b/include/asm-sparc64/fcntl.h
deleted file mode 100644
index 8b1beae48cd1..000000000000
--- a/include/asm-sparc64/fcntl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/fcntl.h>
diff --git a/include/asm-sparc64/fhc.h b/include/asm-sparc64/fhc.h
deleted file mode 100644
index 73eb04c19c47..000000000000
--- a/include/asm-sparc64/fhc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/fhc.h>
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
deleted file mode 100644
index 214878114436..000000000000
--- a/include/asm-sparc64/floppy.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/floppy.h>
diff --git a/include/asm-sparc64/fpumacro.h b/include/asm-sparc64/fpumacro.h
deleted file mode 100644
index 30d6d0f68bc3..000000000000
--- a/include/asm-sparc64/fpumacro.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/fpumacro.h>
diff --git a/include/asm-sparc64/futex.h b/include/asm-sparc64/futex.h
deleted file mode 100644
index 1ceb0bb2fe53..000000000000
--- a/include/asm-sparc64/futex.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/futex.h>
diff --git a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h
deleted file mode 100644
index 63dca3db11f3..000000000000
--- a/include/asm-sparc64/hardirq.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/hardirq.h>
diff --git a/include/asm-sparc64/head.h b/include/asm-sparc64/head.h
deleted file mode 100644
index 2254c09e53f9..000000000000
--- a/include/asm-sparc64/head.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/head.h>
diff --git a/include/asm-sparc64/hugetlb.h b/include/asm-sparc64/hugetlb.h
deleted file mode 100644
index 21d8f0a9c243..000000000000
--- a/include/asm-sparc64/hugetlb.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/hugetlb.h>
diff --git a/include/asm-sparc64/hvtramp.h b/include/asm-sparc64/hvtramp.h
deleted file mode 100644
index fb46bfe934a7..000000000000
--- a/include/asm-sparc64/hvtramp.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/hvtramp.h>
diff --git a/include/asm-sparc64/hw_irq.h b/include/asm-sparc64/hw_irq.h
deleted file mode 100644
index 16920a291f51..000000000000
--- a/include/asm-sparc64/hw_irq.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/hw_irq.h>
diff --git a/include/asm-sparc64/hypervisor.h b/include/asm-sparc64/hypervisor.h
deleted file mode 100644
index fe7e51a9e429..000000000000
--- a/include/asm-sparc64/hypervisor.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/hypervisor.h>
diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h
deleted file mode 100644
index 7125317a428d..000000000000
--- a/include/asm-sparc64/ide.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/ide.h>
diff --git a/include/asm-sparc64/idprom.h b/include/asm-sparc64/idprom.h
deleted file mode 100644
index c22f9c30bc78..000000000000
--- a/include/asm-sparc64/idprom.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/idprom.h>
diff --git a/include/asm-sparc64/intr_queue.h b/include/asm-sparc64/intr_queue.h
deleted file mode 100644
index f7225015b3db..000000000000
--- a/include/asm-sparc64/intr_queue.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/intr_queue.h>
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
deleted file mode 100644
index 25ff258dfd33..000000000000
--- a/include/asm-sparc64/io.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/io.h>
diff --git a/include/asm-sparc64/ioctl.h b/include/asm-sparc64/ioctl.h
deleted file mode 100644
index 18fc5623ff51..000000000000
--- a/include/asm-sparc64/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/ioctl.h>
diff --git a/include/asm-sparc64/ioctls.h b/include/asm-sparc64/ioctls.h
deleted file mode 100644
index dcd5540ec103..000000000000
--- a/include/asm-sparc64/ioctls.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/ioctls.h>
diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h
deleted file mode 100644
index 76252bb85e97..000000000000
--- a/include/asm-sparc64/iommu.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/iommu.h>
diff --git a/include/asm-sparc64/ipcbuf.h b/include/asm-sparc64/ipcbuf.h
deleted file mode 100644
index 41dfaf1149b5..000000000000
--- a/include/asm-sparc64/ipcbuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/ipcbuf.h>
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
deleted file mode 100644
index b2102e65947c..000000000000
--- a/include/asm-sparc64/irq.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/irq.h>
diff --git a/include/asm-sparc64/irq_regs.h b/include/asm-sparc64/irq_regs.h
deleted file mode 100644
index 1e2b8a1e745a..000000000000
--- a/include/asm-sparc64/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/irq_regs.h>
diff --git a/include/asm-sparc64/irqflags.h b/include/asm-sparc64/irqflags.h
deleted file mode 100644
index 27b091fc3fa0..000000000000
--- a/include/asm-sparc64/irqflags.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/irqflags.h>
diff --git a/include/asm-sparc64/kdebug.h b/include/asm-sparc64/kdebug.h
deleted file mode 100644
index 78cfd5d2749b..000000000000
--- a/include/asm-sparc64/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/kdebug.h>
diff --git a/include/asm-sparc64/kgdb.h b/include/asm-sparc64/kgdb.h
deleted file mode 100644
index aa6532fd3a13..000000000000
--- a/include/asm-sparc64/kgdb.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/kgdb.h>
diff --git a/include/asm-sparc64/kmap_types.h b/include/asm-sparc64/kmap_types.h
deleted file mode 100644
index 276530cf5395..000000000000
--- a/include/asm-sparc64/kmap_types.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/kmap_types.h>
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h
deleted file mode 100644
index c55e43e4d2a4..000000000000
--- a/include/asm-sparc64/kprobes.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/kprobes.h>
diff --git a/include/asm-sparc64/ldc.h b/include/asm-sparc64/ldc.h
deleted file mode 100644
index 40f3f231c457..000000000000
--- a/include/asm-sparc64/ldc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/ldc.h>
diff --git a/include/asm-sparc64/linkage.h b/include/asm-sparc64/linkage.h
deleted file mode 100644
index 3ea4fd13f193..000000000000
--- a/include/asm-sparc64/linkage.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/linkage.h>
diff --git a/include/asm-sparc64/lmb.h b/include/asm-sparc64/lmb.h
deleted file mode 100644
index 3d04981701e2..000000000000
--- a/include/asm-sparc64/lmb.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/lmb.h>
diff --git a/include/asm-sparc64/local.h b/include/asm-sparc64/local.h
deleted file mode 100644
index c11c530f74d0..000000000000
--- a/include/asm-sparc64/local.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local.h>
diff --git a/include/asm-sparc64/lsu.h b/include/asm-sparc64/lsu.h
deleted file mode 100644
index 4e3d8b128a58..000000000000
--- a/include/asm-sparc64/lsu.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/lsu.h>
diff --git a/include/asm-sparc64/mc146818rtc.h b/include/asm-sparc64/mc146818rtc.h
deleted file mode 100644
index 97842e6ed1c2..000000000000
--- a/include/asm-sparc64/mc146818rtc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/mc146818rtc.h>
diff --git a/include/asm-sparc64/mdesc.h b/include/asm-sparc64/mdesc.h
deleted file mode 100644
index 165a19347286..000000000000
--- a/include/asm-sparc64/mdesc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/mdesc.h>
diff --git a/include/asm-sparc64/mman.h b/include/asm-sparc64/mman.h
deleted file mode 100644
index 17ddb1724f51..000000000000
--- a/include/asm-sparc64/mman.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/mman.h>
diff --git a/include/asm-sparc64/mmu.h b/include/asm-sparc64/mmu.h
deleted file mode 100644
index e677a64d8db1..000000000000
--- a/include/asm-sparc64/mmu.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/mmu.h>
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h
deleted file mode 100644
index 877fee94bd4e..000000000000
--- a/include/asm-sparc64/mmu_context.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/mmu_context.h>
diff --git a/include/asm-sparc64/mmzone.h b/include/asm-sparc64/mmzone.h
deleted file mode 100644
index 43a710f7892a..000000000000
--- a/include/asm-sparc64/mmzone.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/mmzone.h>
diff --git a/include/asm-sparc64/module.h b/include/asm-sparc64/module.h
deleted file mode 100644
index a9606db55e4a..000000000000
--- a/include/asm-sparc64/module.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/module.h>
diff --git a/include/asm-sparc64/mostek.h b/include/asm-sparc64/mostek.h
deleted file mode 100644
index 95a752f7e875..000000000000
--- a/include/asm-sparc64/mostek.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/mostek.h>
diff --git a/include/asm-sparc64/msgbuf.h b/include/asm-sparc64/msgbuf.h
deleted file mode 100644
index 5b33cc9d9bfb..000000000000
--- a/include/asm-sparc64/msgbuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/msgbuf.h>
diff --git a/include/asm-sparc64/mutex.h b/include/asm-sparc64/mutex.h
deleted file mode 100644
index c0c0f8f260d6..000000000000
--- a/include/asm-sparc64/mutex.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/mutex.h>
diff --git a/include/asm-sparc64/ns87303.h b/include/asm-sparc64/ns87303.h
deleted file mode 100644
index 5f369d4df3db..000000000000
--- a/include/asm-sparc64/ns87303.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/ns87303.h>
diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h
deleted file mode 100644
index a769fdbe164a..000000000000
--- a/include/asm-sparc64/of_device.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/of_device.h>
diff --git a/include/asm-sparc64/of_platform.h b/include/asm-sparc64/of_platform.h
deleted file mode 100644
index f7c427b8bc61..000000000000
--- a/include/asm-sparc64/of_platform.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/of_platform.h>
diff --git a/include/asm-sparc64/openprom.h b/include/asm-sparc64/openprom.h
deleted file mode 100644
index acf4b234fae3..000000000000
--- a/include/asm-sparc64/openprom.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/openprom.h>
diff --git a/include/asm-sparc64/openpromio.h b/include/asm-sparc64/openpromio.h
deleted file mode 100644
index 122fabda21f1..000000000000
--- a/include/asm-sparc64/openpromio.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/openpromio.h>
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h
deleted file mode 100644
index d93e44e63510..000000000000
--- a/include/asm-sparc64/oplib.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/oplib.h>
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
deleted file mode 100644
index f46c1fb53028..000000000000
--- a/include/asm-sparc64/page.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/page.h>
diff --git a/include/asm-sparc64/param.h b/include/asm-sparc64/param.h
deleted file mode 100644
index 40c6dc110822..000000000000
--- a/include/asm-sparc64/param.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/param.h>
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
deleted file mode 100644
index b4e4ca812eb6..000000000000
--- a/include/asm-sparc64/parport.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/parport.h>
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
deleted file mode 100644
index da54c4d1f39c..000000000000
--- a/include/asm-sparc64/pci.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/pci.h>
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
deleted file mode 100644
index 292729bb350f..000000000000
--- a/include/asm-sparc64/percpu.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/percpu.h>
diff --git a/include/asm-sparc64/perfctr.h b/include/asm-sparc64/perfctr.h
deleted file mode 100644
index 52073a9f8e30..000000000000
--- a/include/asm-sparc64/perfctr.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/perfctr.h>
diff --git a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h
deleted file mode 100644
index bec31641011c..000000000000
--- a/include/asm-sparc64/pgalloc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/pgalloc.h>
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
deleted file mode 100644
index 9decbd99aeff..000000000000
--- a/include/asm-sparc64/pgtable.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/pgtable.h>
diff --git a/include/asm-sparc64/pil.h b/include/asm-sparc64/pil.h
deleted file mode 100644
index d805f33f1e0f..000000000000
--- a/include/asm-sparc64/pil.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/pil.h>
diff --git a/include/asm-sparc64/poll.h b/include/asm-sparc64/poll.h
deleted file mode 100644
index 8e2f31b4641a..000000000000
--- a/include/asm-sparc64/poll.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/poll.h>
diff --git a/include/asm-sparc64/posix_types.h b/include/asm-sparc64/posix_types.h
deleted file mode 100644
index 8cee99200232..000000000000
--- a/include/asm-sparc64/posix_types.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/posix_types.h>
diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h
deleted file mode 100644
index 21de6cc182eb..000000000000
--- a/include/asm-sparc64/processor.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/processor.h>
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
deleted file mode 100644
index 5fa166ee3ffa..000000000000
--- a/include/asm-sparc64/prom.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/prom.h>
diff --git a/include/asm-sparc64/psrcompat.h b/include/asm-sparc64/psrcompat.h
deleted file mode 100644
index 587846f48358..000000000000
--- a/include/asm-sparc64/psrcompat.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/psrcompat.h>
diff --git a/include/asm-sparc64/pstate.h b/include/asm-sparc64/pstate.h
deleted file mode 100644
index 3ccf0be25360..000000000000
--- a/include/asm-sparc64/pstate.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/pstate.h>
diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h
deleted file mode 100644
index 1a55b9fb3b0c..000000000000
--- a/include/asm-sparc64/ptrace.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/ptrace.h>
diff --git a/include/asm-sparc64/reboot.h b/include/asm-sparc64/reboot.h
deleted file mode 100644
index 0d72eb811cc8..000000000000
--- a/include/asm-sparc64/reboot.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/reboot.h>
diff --git a/include/asm-sparc64/reg.h b/include/asm-sparc64/reg.h
deleted file mode 100644
index 495bab27da07..000000000000
--- a/include/asm-sparc64/reg.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/reg.h>
diff --git a/include/asm-sparc64/resource.h b/include/asm-sparc64/resource.h
deleted file mode 100644
index 46e3bc0de476..000000000000
--- a/include/asm-sparc64/resource.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/resource.h>
diff --git a/include/asm-sparc64/rtc.h b/include/asm-sparc64/rtc.h
deleted file mode 100644
index e49a9685aead..000000000000
--- a/include/asm-sparc64/rtc.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/rtc.h>
diff --git a/include/asm-sparc64/rwsem-const.h b/include/asm-sparc64/rwsem-const.h
deleted file mode 100644
index 2a1de315c86a..000000000000
--- a/include/asm-sparc64/rwsem-const.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/rwsem-const.h>
diff --git a/include/asm-sparc64/rwsem.h b/include/asm-sparc64/rwsem.h
deleted file mode 100644
index 6943c56ed087..000000000000
--- a/include/asm-sparc64/rwsem.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/rwsem.h>
diff --git a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h
deleted file mode 100644
index 0cab0e89b874..000000000000
--- a/include/asm-sparc64/sbus.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/sbus.h>
diff --git a/include/asm-sparc64/scatterlist.h b/include/asm-sparc64/scatterlist.h
deleted file mode 100644
index b7fef95953ca..000000000000
--- a/include/asm-sparc64/scatterlist.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/scatterlist.h>
diff --git a/include/asm-sparc64/scratchpad.h b/include/asm-sparc64/scratchpad.h
deleted file mode 100644
index 23675f6a915a..000000000000
--- a/include/asm-sparc64/scratchpad.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/scratchpad.h>
diff --git a/include/asm-sparc64/seccomp.h b/include/asm-sparc64/seccomp.h
deleted file mode 100644
index f22f02a08a61..000000000000
--- a/include/asm-sparc64/seccomp.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/seccomp.h>
diff --git a/include/asm-sparc64/sections.h b/include/asm-sparc64/sections.h
deleted file mode 100644
index 721496f8b2be..000000000000
--- a/include/asm-sparc64/sections.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/sections.h>
diff --git a/include/asm-sparc64/sembuf.h b/include/asm-sparc64/sembuf.h
deleted file mode 100644
index c55b95214136..000000000000
--- a/include/asm-sparc64/sembuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/sembuf.h>
diff --git a/include/asm-sparc64/setup.h b/include/asm-sparc64/setup.h
deleted file mode 100644
index 7143d06b2c55..000000000000
--- a/include/asm-sparc64/setup.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/setup.h>
diff --git a/include/asm-sparc64/sfafsr.h b/include/asm-sparc64/sfafsr.h
deleted file mode 100644
index 8036fc377a4d..000000000000
--- a/include/asm-sparc64/sfafsr.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/sfafsr.h>
diff --git a/include/asm-sparc64/sfp-machine.h b/include/asm-sparc64/sfp-machine.h
deleted file mode 100644
index 7bbc4fecdc7d..000000000000
--- a/include/asm-sparc64/sfp-machine.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/sfp-machine.h>
diff --git a/include/asm-sparc64/shmbuf.h b/include/asm-sparc64/shmbuf.h
deleted file mode 100644
index 0c54a2d68681..000000000000
--- a/include/asm-sparc64/shmbuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/shmbuf.h>
diff --git a/include/asm-sparc64/shmparam.h b/include/asm-sparc64/shmparam.h
deleted file mode 100644
index 5fa3a9b05e7f..000000000000
--- a/include/asm-sparc64/shmparam.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/shmparam.h>
diff --git a/include/asm-sparc64/sigcontext.h b/include/asm-sparc64/sigcontext.h
deleted file mode 100644
index 5b16dcce44f2..000000000000
--- a/include/asm-sparc64/sigcontext.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/sigcontext.h>
diff --git a/include/asm-sparc64/siginfo.h b/include/asm-sparc64/siginfo.h
deleted file mode 100644
index 8ffd6ebabc7a..000000000000
--- a/include/asm-sparc64/siginfo.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/siginfo.h>
diff --git a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h
deleted file mode 100644
index 79705e5d49c3..000000000000
--- a/include/asm-sparc64/signal.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/signal.h>
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
deleted file mode 100644
index 5095a2cbea52..000000000000
--- a/include/asm-sparc64/smp.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/smp.h>
diff --git a/include/asm-sparc64/socket.h b/include/asm-sparc64/socket.h
deleted file mode 100644
index 13e0d5d94bb3..000000000000
--- a/include/asm-sparc64/socket.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/socket.h>
diff --git a/include/asm-sparc64/sockios.h b/include/asm-sparc64/sockios.h
deleted file mode 100644
index 2cb4b641482c..000000000000
--- a/include/asm-sparc64/sockios.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/sockios.h>
diff --git a/include/asm-sparc64/sparsemem.h b/include/asm-sparc64/sparsemem.h
deleted file mode 100644
index e681f22a97ae..000000000000
--- a/include/asm-sparc64/sparsemem.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/sparsemem.h>
diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h
deleted file mode 100644
index 0115b8156eb8..000000000000
--- a/include/asm-sparc64/spinlock.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/spinlock.h>
diff --git a/include/asm-sparc64/spinlock_types.h b/include/asm-sparc64/spinlock_types.h
deleted file mode 100644
index 48d81c8734b5..000000000000
--- a/include/asm-sparc64/spinlock_types.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/spinlock_types.h>
diff --git a/include/asm-sparc64/spitfire.h b/include/asm-sparc64/spitfire.h
deleted file mode 100644
index 4430d2fbb0dc..000000000000
--- a/include/asm-sparc64/spitfire.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/spitfire.h>
diff --git a/include/asm-sparc64/sstate.h b/include/asm-sparc64/sstate.h
deleted file mode 100644
index 97720ce2fd43..000000000000
--- a/include/asm-sparc64/sstate.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/sstate.h>
diff --git a/include/asm-sparc64/stacktrace.h b/include/asm-sparc64/stacktrace.h
deleted file mode 100644
index adc9b92c0ef1..000000000000
--- a/include/asm-sparc64/stacktrace.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/stacktrace.h>
diff --git a/include/asm-sparc64/starfire.h b/include/asm-sparc64/starfire.h
deleted file mode 100644
index db97daa3bed4..000000000000
--- a/include/asm-sparc64/starfire.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/starfire.h>
diff --git a/include/asm-sparc64/stat.h b/include/asm-sparc64/stat.h
deleted file mode 100644
index b108a866256b..000000000000
--- a/include/asm-sparc64/stat.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/stat.h>
diff --git a/include/asm-sparc64/statfs.h b/include/asm-sparc64/statfs.h
deleted file mode 100644
index 5503d6a4c67e..000000000000
--- a/include/asm-sparc64/statfs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/statfs.h>
diff --git a/include/asm-sparc64/string.h b/include/asm-sparc64/string.h
deleted file mode 100644
index 5018cd8b6ad0..000000000000
--- a/include/asm-sparc64/string.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/string.h>
diff --git a/include/asm-sparc64/sunbpp.h b/include/asm-sparc64/sunbpp.h
deleted file mode 100644
index 9632be290eb5..000000000000
--- a/include/asm-sparc64/sunbpp.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/sunbpp.h>
diff --git a/include/asm-sparc64/syscalls.h b/include/asm-sparc64/syscalls.h
deleted file mode 100644
index 3477b16e30ca..000000000000
--- a/include/asm-sparc64/syscalls.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/syscalls.h>
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
deleted file mode 100644
index be2603c2e527..000000000000
--- a/include/asm-sparc64/system.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/system.h>
diff --git a/include/asm-sparc64/termbits.h b/include/asm-sparc64/termbits.h
deleted file mode 100644
index e03f97592c70..000000000000
--- a/include/asm-sparc64/termbits.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/termbits.h>
diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h
deleted file mode 100644
index 940495eb05cc..000000000000
--- a/include/asm-sparc64/termios.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/termios.h>
diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h
deleted file mode 100644
index 92bed7913395..000000000000
--- a/include/asm-sparc64/thread_info.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/thread_info.h>
diff --git a/include/asm-sparc64/timer.h b/include/asm-sparc64/timer.h
deleted file mode 100644
index 88026d83cc93..000000000000
--- a/include/asm-sparc64/timer.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/timer.h>
diff --git a/include/asm-sparc64/timex.h b/include/asm-sparc64/timex.h
deleted file mode 100644
index 8dd59ee24b48..000000000000
--- a/include/asm-sparc64/timex.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/timex.h>
diff --git a/include/asm-sparc64/tlb.h b/include/asm-sparc64/tlb.h
deleted file mode 100644
index ae92fce10936..000000000000
--- a/include/asm-sparc64/tlb.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/tlb.h>
diff --git a/include/asm-sparc64/tlbflush.h b/include/asm-sparc64/tlbflush.h
deleted file mode 100644
index a43979a06cd9..000000000000
--- a/include/asm-sparc64/tlbflush.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/tlbflush.h>
diff --git a/include/asm-sparc64/topology.h b/include/asm-sparc64/topology.h
deleted file mode 100644
index 46999b60fbba..000000000000
--- a/include/asm-sparc64/topology.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/topology.h>
diff --git a/include/asm-sparc64/tsb.h b/include/asm-sparc64/tsb.h
deleted file mode 100644
index 3677a302ea3e..000000000000
--- a/include/asm-sparc64/tsb.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/tsb.h>
diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h
deleted file mode 100644
index a550f1bf6f9b..000000000000
--- a/include/asm-sparc64/ttable.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/ttable.h>
diff --git a/include/asm-sparc64/types.h b/include/asm-sparc64/types.h
deleted file mode 100644
index cfbfad5043eb..000000000000
--- a/include/asm-sparc64/types.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/types.h>
diff --git a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h
deleted file mode 100644
index 2872d22844f3..000000000000
--- a/include/asm-sparc64/uaccess.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/uaccess.h>
diff --git a/include/asm-sparc64/uctx.h b/include/asm-sparc64/uctx.h
deleted file mode 100644
index 9e1b5794b07f..000000000000
--- a/include/asm-sparc64/uctx.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/uctx.h>
diff --git a/include/asm-sparc64/unaligned.h b/include/asm-sparc64/unaligned.h
deleted file mode 100644
index 19fbf9508acf..000000000000
--- a/include/asm-sparc64/unaligned.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/unaligned.h>
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
deleted file mode 100644
index ad86e0b7a455..000000000000
--- a/include/asm-sparc64/unistd.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/unistd.h>
diff --git a/include/asm-sparc64/upa.h b/include/asm-sparc64/upa.h
deleted file mode 100644
index aab72930815a..000000000000
--- a/include/asm-sparc64/upa.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/upa.h>
diff --git a/include/asm-sparc64/user.h b/include/asm-sparc64/user.h
deleted file mode 100644
index 29fc6e906c29..000000000000
--- a/include/asm-sparc64/user.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/user.h>
diff --git a/include/asm-sparc64/utrap.h b/include/asm-sparc64/utrap.h
deleted file mode 100644
index b030a41f1895..000000000000
--- a/include/asm-sparc64/utrap.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/utrap.h>
diff --git a/include/asm-sparc64/vga.h b/include/asm-sparc64/vga.h
deleted file mode 100644
index fbf4d58a56f0..000000000000
--- a/include/asm-sparc64/vga.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/vga.h>
diff --git a/include/asm-sparc64/vio.h b/include/asm-sparc64/vio.h
deleted file mode 100644
index 299b26ab81a7..000000000000
--- a/include/asm-sparc64/vio.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/vio.h>
diff --git a/include/asm-sparc64/visasm.h b/include/asm-sparc64/visasm.h
deleted file mode 100644
index 837a12278f4a..000000000000
--- a/include/asm-sparc64/visasm.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/visasm.h>
diff --git a/include/asm-sparc64/watchdog.h b/include/asm-sparc64/watchdog.h
deleted file mode 100644
index b0f2857145f7..000000000000
--- a/include/asm-sparc64/watchdog.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/watchdog.h>
diff --git a/include/asm-sparc64/xor.h b/include/asm-sparc64/xor.h
deleted file mode 100644
index ef187cc07ed5..000000000000
--- a/include/asm-sparc64/xor.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-sparc/xor.h>
diff --git a/include/asm-x86/dma-mapping.h b/include/asm-x86/dma-mapping.h
index 0eaa9bf6011f..ad9cd6d49bfc 100644
--- a/include/asm-x86/dma-mapping.h
+++ b/include/asm-x86/dma-mapping.h
@@ -249,25 +249,5 @@ static inline int dma_get_cache_alignment(void)
249 249
250#define dma_is_consistent(d, h) (1) 250#define dma_is_consistent(d, h) (1)
251 251
252#ifdef CONFIG_X86_32 252#include <asm-generic/dma-coherent.h>
253# define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
254struct dma_coherent_mem {
255 void *virt_base;
256 u32 device_base;
257 int size;
258 int flags;
259 unsigned long *bitmap;
260};
261
262extern int
263dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
264 dma_addr_t device_addr, size_t size, int flags);
265
266extern void
267dma_release_declared_memory(struct device *dev);
268
269extern void *
270dma_mark_declared_memory_occupied(struct device *dev,
271 dma_addr_t device_addr, size_t size);
272#endif /* CONFIG_X86_32 */
273#endif 253#endif
diff --git a/include/asm-x86/iommu.h b/include/asm-x86/iommu.h
index ecc8061904a9..5f888cc5be49 100644
--- a/include/asm-x86/iommu.h
+++ b/include/asm-x86/iommu.h
@@ -7,6 +7,8 @@ extern struct dma_mapping_ops nommu_dma_ops;
7extern int force_iommu, no_iommu; 7extern int force_iommu, no_iommu;
8extern int iommu_detected; 8extern int iommu_detected;
9 9
10extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len);
11
10#ifdef CONFIG_GART_IOMMU 12#ifdef CONFIG_GART_IOMMU
11extern int gart_iommu_aperture; 13extern int gart_iommu_aperture;
12extern int gart_iommu_aperture_allowed; 14extern int gart_iommu_aperture_allowed;
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 4c4142c5aa6e..a26f565e8189 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -97,6 +97,7 @@ header-y += ioctl.h
97header-y += ip6_tunnel.h 97header-y += ip6_tunnel.h
98header-y += ipmi_msgdefs.h 98header-y += ipmi_msgdefs.h
99header-y += ipsec.h 99header-y += ipsec.h
100header-y += ip_vs.h
100header-y += ipx.h 101header-y += ipx.h
101header-y += irda.h 102header-y += irda.h
102header-y += iso_fs.h 103header-y += iso_fs.h
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 88d68081a0f1..e61f22be4d0e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -655,6 +655,7 @@ extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
655extern void blk_insert_request(struct request_queue *, struct request *, int, void *); 655extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
656extern void blk_requeue_request(struct request_queue *, struct request *); 656extern void blk_requeue_request(struct request_queue *, struct request *);
657extern void blk_plug_device(struct request_queue *); 657extern void blk_plug_device(struct request_queue *);
658extern void blk_plug_device_unlocked(struct request_queue *);
658extern int blk_remove_plug(struct request_queue *); 659extern int blk_remove_plug(struct request_queue *);
659extern void blk_recount_segments(struct request_queue *, struct bio *); 660extern void blk_recount_segments(struct request_queue *, struct bio *);
660extern int scsi_cmd_ioctl(struct file *, struct request_queue *, 661extern int scsi_cmd_ioctl(struct file *, struct request_queue *,
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 82aa36c53ea7..50cfe8ceb478 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -205,6 +205,8 @@ void block_invalidatepage(struct page *page, unsigned long offset);
205int block_write_full_page(struct page *page, get_block_t *get_block, 205int block_write_full_page(struct page *page, get_block_t *get_block,
206 struct writeback_control *wbc); 206 struct writeback_control *wbc);
207int block_read_full_page(struct page*, get_block_t*); 207int block_read_full_page(struct page*, get_block_t*);
208int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc,
209 unsigned long from);
208int block_write_begin(struct file *, struct address_space *, 210int block_write_begin(struct file *, struct address_space *,
209 loff_t, unsigned, unsigned, 211 loff_t, unsigned, unsigned,
210 struct page **, void **, get_block_t*); 212 struct page **, void **, get_block_t*);
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 96a89d3d6727..5c7f9468f753 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -38,8 +38,9 @@
38#define CN_W1_VAL 0x1 38#define CN_W1_VAL 0x1
39#define CN_IDX_V86D 0x4 39#define CN_IDX_V86D 0x4
40#define CN_VAL_V86D_UVESAFB 0x1 40#define CN_VAL_V86D_UVESAFB 0x1
41#define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */
41 42
42#define CN_NETLINK_USERS 5 43#define CN_NETLINK_USERS 6
43 44
44/* 45/*
45 * Maximum connector's message size. 46 * Maximum connector's message size.
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 2270ca5ec631..6fd5668aa572 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -106,6 +106,7 @@ struct cpufreq_policy {
106#define CPUFREQ_ADJUST (0) 106#define CPUFREQ_ADJUST (0)
107#define CPUFREQ_INCOMPATIBLE (1) 107#define CPUFREQ_INCOMPATIBLE (1)
108#define CPUFREQ_NOTIFY (2) 108#define CPUFREQ_NOTIFY (2)
109#define CPUFREQ_START (3)
109 110
110#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ 111#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
111#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ 112#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 1b5c98e7fef7..d3219d73f8e6 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -62,15 +62,7 @@
62 * int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids 62 * int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids
63 * 63 *
64 * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set 64 * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set
65 *ifdef CONFIG_HAS_CPUMASK_OF_CPU 65 * (can be used as an lvalue)
66 * cpumask_of_cpu_ptr_declare(v) Declares cpumask_t *v
67 * cpumask_of_cpu_ptr_next(v, cpu) Sets v = &cpumask_of_cpu_map[cpu]
68 * cpumask_of_cpu_ptr(v, cpu) Combines above two operations
69 *else
70 * cpumask_of_cpu_ptr_declare(v) Declares cpumask_t _v and *v = &_v
71 * cpumask_of_cpu_ptr_next(v, cpu) Sets _v = cpumask_of_cpu(cpu)
72 * cpumask_of_cpu_ptr(v, cpu) Combines above two operations
73 *endif
74 * CPU_MASK_ALL Initializer - all bits set 66 * CPU_MASK_ALL Initializer - all bits set
75 * CPU_MASK_NONE Initializer - no bits set 67 * CPU_MASK_NONE Initializer - no bits set
76 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask 68 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask
@@ -273,37 +265,30 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
273 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); 265 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
274} 266}
275 267
268/*
269 * Special-case data structure for "single bit set only" constant CPU masks.
270 *
271 * We pre-generate all the 64 (or 32) possible bit positions, with enough
272 * padding to the left and the right, and return the constant pointer
273 * appropriately offset.
274 */
275extern const unsigned long
276 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
277
278static inline const cpumask_t *get_cpu_mask(unsigned int cpu)
279{
280 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
281 p -= cpu / BITS_PER_LONG;
282 return (const cpumask_t *)p;
283}
284
285/*
286 * In cases where we take the address of the cpumask immediately,
287 * gcc optimizes it out (it's a constant) and there's no huge stack
288 * variable created:
289 */
290#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
276 291
277#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
278extern cpumask_t *cpumask_of_cpu_map;
279#define cpumask_of_cpu(cpu) (cpumask_of_cpu_map[cpu])
280#define cpumask_of_cpu_ptr(v, cpu) \
281 const cpumask_t *v = &cpumask_of_cpu(cpu)
282#define cpumask_of_cpu_ptr_declare(v) \
283 const cpumask_t *v
284#define cpumask_of_cpu_ptr_next(v, cpu) \
285 v = &cpumask_of_cpu(cpu)
286#else
287#define cpumask_of_cpu(cpu) \
288({ \
289 typeof(_unused_cpumask_arg_) m; \
290 if (sizeof(m) == sizeof(unsigned long)) { \
291 m.bits[0] = 1UL<<(cpu); \
292 } else { \
293 cpus_clear(m); \
294 cpu_set((cpu), m); \
295 } \
296 m; \
297})
298#define cpumask_of_cpu_ptr(v, cpu) \
299 cpumask_t _##v = cpumask_of_cpu(cpu); \
300 const cpumask_t *v = &_##v
301#define cpumask_of_cpu_ptr_declare(v) \
302 cpumask_t _##v; \
303 const cpumask_t *v = &_##v
304#define cpumask_of_cpu_ptr_next(v, cpu) \
305 _##v = cpumask_of_cpu(cpu)
306#endif
307 292
308#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) 293#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
309 294
diff --git a/include/linux/file.h b/include/linux/file.h
index 27c64bdc68c9..a20259e248a5 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -34,8 +34,9 @@ extern struct file *fget(unsigned int fd);
34extern struct file *fget_light(unsigned int fd, int *fput_needed); 34extern struct file *fget_light(unsigned int fd, int *fput_needed);
35extern void set_close_on_exec(unsigned int fd, int flag); 35extern void set_close_on_exec(unsigned int fd, int flag);
36extern void put_filp(struct file *); 36extern void put_filp(struct file *);
37extern int alloc_fd(unsigned start, unsigned flags);
37extern int get_unused_fd(void); 38extern int get_unused_fd(void);
38extern int get_unused_fd_flags(int flags); 39#define get_unused_fd_flags(flags) alloc_fd(0, (flags))
39extern void put_unused_fd(unsigned int fd); 40extern void put_unused_fd(unsigned int fd);
40 41
41extern void fd_install(unsigned int fd, struct file *file); 42extern void fd_install(unsigned int fd, struct file *file);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8252b045e624..580b513668fe 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -443,6 +443,27 @@ static inline size_t iov_iter_count(struct iov_iter *i)
443 return i->count; 443 return i->count;
444} 444}
445 445
446/*
447 * "descriptor" for what we're up to with a read.
448 * This allows us to use the same read code yet
449 * have multiple different users of the data that
450 * we read from a file.
451 *
452 * The simplest case just copies the data to user
453 * mode.
454 */
455typedef struct {
456 size_t written;
457 size_t count;
458 union {
459 char __user *buf;
460 void *data;
461 } arg;
462 int error;
463} read_descriptor_t;
464
465typedef int (*read_actor_t)(read_descriptor_t *, struct page *,
466 unsigned long, unsigned long);
446 467
447struct address_space_operations { 468struct address_space_operations {
448 int (*writepage)(struct page *page, struct writeback_control *wbc); 469 int (*writepage)(struct page *page, struct writeback_control *wbc);
@@ -484,6 +505,8 @@ struct address_space_operations {
484 int (*migratepage) (struct address_space *, 505 int (*migratepage) (struct address_space *,
485 struct page *, struct page *); 506 struct page *, struct page *);
486 int (*launder_page) (struct page *); 507 int (*launder_page) (struct page *);
508 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
509 unsigned long);
487}; 510};
488 511
489/* 512/*
@@ -1198,27 +1221,6 @@ struct block_device_operations {
1198 struct module *owner; 1221 struct module *owner;
1199}; 1222};
1200 1223
1201/*
1202 * "descriptor" for what we're up to with a read.
1203 * This allows us to use the same read code yet
1204 * have multiple different users of the data that
1205 * we read from a file.
1206 *
1207 * The simplest case just copies the data to user
1208 * mode.
1209 */
1210typedef struct {
1211 size_t written;
1212 size_t count;
1213 union {
1214 char __user * buf;
1215 void *data;
1216 } arg;
1217 int error;
1218} read_descriptor_t;
1219
1220typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long);
1221
1222/* These macros are for out of kernel modules to test that 1224/* These macros are for out of kernel modules to test that
1223 * the kernel supports the unlocked_ioctl and compat_ioctl 1225 * the kernel supports the unlocked_ioctl and compat_ioctl
1224 * fields in struct file_operations. */ 1226 * fields in struct file_operations. */
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 2cd07cc29687..22d2115458c6 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -118,6 +118,10 @@ extern int allocate_resource(struct resource *root, struct resource *new,
118int adjust_resource(struct resource *res, resource_size_t start, 118int adjust_resource(struct resource *res, resource_size_t start,
119 resource_size_t size); 119 resource_size_t size);
120resource_size_t resource_alignment(struct resource *res); 120resource_size_t resource_alignment(struct resource *res);
121static inline resource_size_t resource_size(struct resource *res)
122{
123 return res->end - res->start + 1;
124}
121 125
122/* Convenience shorthand with allocation */ 126/* Convenience shorthand with allocation */
123#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) 127#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
new file mode 100644
index 000000000000..ec6eb49af2d8
--- /dev/null
+++ b/include/linux/ip_vs.h
@@ -0,0 +1,245 @@
1/*
2 * IP Virtual Server
3 * data structure and functionality definitions
4 */
5
6#ifndef _IP_VS_H
7#define _IP_VS_H
8
9#include <linux/types.h> /* For __beXX types in userland */
10
11#define IP_VS_VERSION_CODE 0x010201
12#define NVERSION(version) \
13 (version >> 16) & 0xFF, \
14 (version >> 8) & 0xFF, \
15 version & 0xFF
16
17/*
18 * Virtual Service Flags
19 */
20#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
21#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
22
23/*
24 * Destination Server Flags
25 */
26#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
27#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
28
29/*
30 * IPVS sync daemon states
31 */
32#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
33#define IP_VS_STATE_MASTER 0x0001 /* started as master */
34#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
35
36/*
37 * IPVS socket options
38 */
39#define IP_VS_BASE_CTL (64+1024+64) /* base */
40
41#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
42#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
43#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
44#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
45#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
46#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
47#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
48#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
49#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
50#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
51#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
52#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
53#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
54#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
55#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
56#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
57#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
58
59#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
60#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
61#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
62#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
63#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
64#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
65#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
66#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
67#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
68
69
70/*
71 * IPVS Connection Flags
72 */
73#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
74#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
75#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
76#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
77#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
78#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
79#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
80#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
81#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
82#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
83#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
84#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
85#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
86#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
87#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
88
89#define IP_VS_SCHEDNAME_MAXLEN 16
90#define IP_VS_IFNAME_MAXLEN 16
91
92
93/*
94 * The struct ip_vs_service_user and struct ip_vs_dest_user are
95 * used to set IPVS rules through setsockopt.
96 */
97struct ip_vs_service_user {
98 /* virtual service addresses */
99 u_int16_t protocol;
100 __be32 addr; /* virtual ip address */
101 __be16 port;
102 u_int32_t fwmark; /* firwall mark of service */
103
104 /* virtual service options */
105 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
106 unsigned flags; /* virtual service flags */
107 unsigned timeout; /* persistent timeout in sec */
108 __be32 netmask; /* persistent netmask */
109};
110
111
112struct ip_vs_dest_user {
113 /* destination server address */
114 __be32 addr;
115 __be16 port;
116
117 /* real server options */
118 unsigned conn_flags; /* connection flags */
119 int weight; /* destination weight */
120
121 /* thresholds for active connections */
122 u_int32_t u_threshold; /* upper threshold */
123 u_int32_t l_threshold; /* lower threshold */
124};
125
126
127/*
128 * IPVS statistics object (for user space)
129 */
130struct ip_vs_stats_user
131{
132 __u32 conns; /* connections scheduled */
133 __u32 inpkts; /* incoming packets */
134 __u32 outpkts; /* outgoing packets */
135 __u64 inbytes; /* incoming bytes */
136 __u64 outbytes; /* outgoing bytes */
137
138 __u32 cps; /* current connection rate */
139 __u32 inpps; /* current in packet rate */
140 __u32 outpps; /* current out packet rate */
141 __u32 inbps; /* current in byte rate */
142 __u32 outbps; /* current out byte rate */
143};
144
145
146/* The argument to IP_VS_SO_GET_INFO */
147struct ip_vs_getinfo {
148 /* version number */
149 unsigned int version;
150
151 /* size of connection hash table */
152 unsigned int size;
153
154 /* number of virtual services */
155 unsigned int num_services;
156};
157
158
159/* The argument to IP_VS_SO_GET_SERVICE */
160struct ip_vs_service_entry {
161 /* which service: user fills in these */
162 u_int16_t protocol;
163 __be32 addr; /* virtual address */
164 __be16 port;
165 u_int32_t fwmark; /* firwall mark of service */
166
167 /* service options */
168 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
169 unsigned flags; /* virtual service flags */
170 unsigned timeout; /* persistent timeout */
171 __be32 netmask; /* persistent netmask */
172
173 /* number of real servers */
174 unsigned int num_dests;
175
176 /* statistics */
177 struct ip_vs_stats_user stats;
178};
179
180
181struct ip_vs_dest_entry {
182 __be32 addr; /* destination address */
183 __be16 port;
184 unsigned conn_flags; /* connection flags */
185 int weight; /* destination weight */
186
187 u_int32_t u_threshold; /* upper threshold */
188 u_int32_t l_threshold; /* lower threshold */
189
190 u_int32_t activeconns; /* active connections */
191 u_int32_t inactconns; /* inactive connections */
192 u_int32_t persistconns; /* persistent connections */
193
194 /* statistics */
195 struct ip_vs_stats_user stats;
196};
197
198
199/* The argument to IP_VS_SO_GET_DESTS */
200struct ip_vs_get_dests {
201 /* which service: user fills in these */
202 u_int16_t protocol;
203 __be32 addr; /* virtual address */
204 __be16 port;
205 u_int32_t fwmark; /* firwall mark of service */
206
207 /* number of real servers */
208 unsigned int num_dests;
209
210 /* the real servers */
211 struct ip_vs_dest_entry entrytable[0];
212};
213
214
215/* The argument to IP_VS_SO_GET_SERVICES */
216struct ip_vs_get_services {
217 /* number of virtual services */
218 unsigned int num_services;
219
220 /* service table */
221 struct ip_vs_service_entry entrytable[0];
222};
223
224
225/* The argument to IP_VS_SO_GET_TIMEOUT */
226struct ip_vs_timeout_user {
227 int tcp_timeout;
228 int tcp_fin_timeout;
229 int udp_timeout;
230};
231
232
233/* The argument to IP_VS_SO_GET_DAEMON */
234struct ip_vs_daemon_user {
235 /* sync daemon state (master/backup) */
236 int state;
237
238 /* multicast interface name */
239 char mcast_ifn[IP_VS_IFNAME_MAXLEN];
240
241 /* SyncID we belong to */
242 int syncid;
243};
244
245#endif /* _IP_VS_H */
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 57aefa160a92..b96144887444 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -108,8 +108,7 @@ static inline void print_fn_descriptor_symbol(const char *fmt, void *addr)
108 108
109static inline void print_ip_sym(unsigned long ip) 109static inline void print_ip_sym(unsigned long ip)
110{ 110{
111 printk("[<%p>]", (void *) ip); 111 printk("[<%p>] %pS\n", (void *) ip, (void *) ip);
112 print_symbol(" %s\n", ip);
113} 112}
114 113
115#endif /*_LINUX_KALLSYMS_H*/ 114#endif /*_LINUX_KALLSYMS_H*/
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index fdbbf72ca2eb..aaa998f65c7a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -75,6 +75,12 @@ extern const char linux_proc_banner[];
75 */ 75 */
76#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) 76#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
77 77
78/**
79 * lower_32_bits - return bits 0-31 of a number
80 * @n: the number we're accessing
81 */
82#define lower_32_bits(n) ((u32)(n))
83
78#define KERN_EMERG "<0>" /* system is unusable */ 84#define KERN_EMERG "<0>" /* system is unusable */
79#define KERN_ALERT "<1>" /* action must be taken immediately */ 85#define KERN_ALERT "<1>" /* action must be taken immediately */
80#define KERN_CRIT "<2>" /* critical conditions */ 86#define KERN_CRIT "<2>" /* critical conditions */
diff --git a/include/linux/maple.h b/include/linux/maple.h
index d31e36ebb436..c853b1066018 100644
--- a/include/linux/maple.h
+++ b/include/linux/maple.h
@@ -2,6 +2,7 @@
2#define __LINUX_MAPLE_H 2#define __LINUX_MAPLE_H
3 3
4#include <linux/device.h> 4#include <linux/device.h>
5#include <mach/maple.h>
5 6
6extern struct bus_type maple_bus_type; 7extern struct bus_type maple_bus_type;
7 8
@@ -33,6 +34,7 @@ struct mapleq {
33 void *sendbuf, *recvbuf, *recvbufdcsp; 34 void *sendbuf, *recvbuf, *recvbufdcsp;
34 unsigned char length; 35 unsigned char length;
35 enum maple_code command; 36 enum maple_code command;
37 struct mutex mutex;
36}; 38};
37 39
38struct maple_devinfo { 40struct maple_devinfo {
@@ -61,8 +63,6 @@ struct maple_device {
61 63
62struct maple_driver { 64struct maple_driver {
63 unsigned long function; 65 unsigned long function;
64 int (*connect) (struct maple_device * dev);
65 void (*disconnect) (struct maple_device * dev);
66 struct device_driver drv; 66 struct device_driver drv;
67}; 67};
68 68
@@ -71,7 +71,9 @@ void maple_getcond_callback(struct maple_device *dev,
71 unsigned long interval, 71 unsigned long interval,
72 unsigned long function); 72 unsigned long function);
73int maple_driver_register(struct device_driver *drv); 73int maple_driver_register(struct device_driver *drv);
74void maple_add_packet(struct mapleq *mq); 74int maple_add_packet_sleeps(struct maple_device *mdev, u32 function,
75 u32 command, u32 length, void *data);
76void maple_clear_dev(struct maple_device *mdev);
75 77
76#define to_maple_dev(n) container_of(n, struct maple_device, dev) 78#define to_maple_dev(n) container_of(n, struct maple_device, dev)
77#define to_maple_driver(n) container_of(n, struct maple_driver, drv) 79#define to_maple_driver(n) container_of(n, struct maple_driver, drv)
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index bb3dd0545928..49ef857cdb2d 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -1,5 +1,3 @@
1#ifndef MFD_CORE_H
2#define MFD_CORE_H
3/* 1/*
4 * drivers/mfd/mfd-core.h 2 * drivers/mfd/mfd-core.h
5 * 3 *
@@ -13,6 +11,9 @@
13 * 11 *
14 */ 12 */
15 13
14#ifndef MFD_CORE_H
15#define MFD_CORE_H
16
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17 18
18/* 19/*
@@ -28,7 +29,13 @@ struct mfd_cell {
28 int (*suspend)(struct platform_device *dev); 29 int (*suspend)(struct platform_device *dev);
29 int (*resume)(struct platform_device *dev); 30 int (*resume)(struct platform_device *dev);
30 31
31 void *driver_data; /* driver-specific data */ 32 /* driver-specific data for MFD-aware "cell" drivers */
33 void *driver_data;
34
35 /* platform_data can be used to either pass data to "generic"
36 driver or as a hook to mfd_cell for the "cell" drivers */
37 void *platform_data;
38 size_t data_size;
32 39
33 /* 40 /*
34 * This resources can be specified relatievly to the parent device. 41 * This resources can be specified relatievly to the parent device.
@@ -38,18 +45,11 @@ struct mfd_cell {
38 const struct resource *resources; 45 const struct resource *resources;
39}; 46};
40 47
41static inline struct mfd_cell * 48extern int mfd_add_devices(struct device *parent, int id,
42mfd_get_cell(struct platform_device *pdev) 49 const struct mfd_cell *cells, int n_devs,
43{ 50 struct resource *mem_base,
44 return (struct mfd_cell *)pdev->dev.platform_data; 51 int irq_base);
45}
46
47extern int mfd_add_devices(
48 struct platform_device *parent,
49 const struct mfd_cell *cells, int n_devs,
50 struct resource *mem_base,
51 int irq_base);
52 52
53extern void mfd_remove_devices(struct platform_device *parent); 53extern void mfd_remove_devices(struct device *parent);
54 54
55#endif 55#endif
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 6e695eaab4ce..335288bff1b7 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -744,6 +744,8 @@ struct zap_details {
744struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, 744struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
745 pte_t pte); 745 pte_t pte);
746 746
747int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
748 unsigned long size);
747unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, 749unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
748 unsigned long size, struct zap_details *); 750 unsigned long size, struct zap_details *);
749unsigned long unmap_vmas(struct mmu_gather **tlb, 751unsigned long unmap_vmas(struct mmu_gather **tlb,
@@ -1041,7 +1043,6 @@ extern unsigned long absent_pages_in_range(unsigned long start_pfn,
1041extern void get_pfn_range_for_nid(unsigned int nid, 1043extern void get_pfn_range_for_nid(unsigned int nid,
1042 unsigned long *start_pfn, unsigned long *end_pfn); 1044 unsigned long *start_pfn, unsigned long *end_pfn);
1043extern unsigned long find_min_pfn_with_active_regions(void); 1045extern unsigned long find_min_pfn_with_active_regions(void);
1044extern unsigned long find_max_pfn_with_active_regions(void);
1045extern void free_bootmem_with_active_regions(int nid, 1046extern void free_bootmem_with_active_regions(int nid,
1046 unsigned long max_low_pfn); 1047 unsigned long max_low_pfn);
1047typedef int (*work_fn_t)(unsigned long, unsigned long, void *); 1048typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
@@ -1104,6 +1105,9 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
1104 unsigned long addr, unsigned long len, pgoff_t pgoff); 1105 unsigned long addr, unsigned long len, pgoff_t pgoff);
1105extern void exit_mmap(struct mm_struct *); 1106extern void exit_mmap(struct mm_struct *);
1106 1107
1108extern int mm_take_all_locks(struct mm_struct *mm);
1109extern void mm_drop_all_locks(struct mm_struct *mm);
1110
1107#ifdef CONFIG_PROC_FS 1111#ifdef CONFIG_PROC_FS
1108/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */ 1112/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */
1109extern void added_exe_file_vma(struct mm_struct *mm); 1113extern void added_exe_file_vma(struct mm_struct *mm);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 746f975b58ef..386edbe2cb4e 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -10,6 +10,7 @@
10#include <linux/rbtree.h> 10#include <linux/rbtree.h>
11#include <linux/rwsem.h> 11#include <linux/rwsem.h>
12#include <linux/completion.h> 12#include <linux/completion.h>
13#include <linux/cpumask.h>
13#include <asm/page.h> 14#include <asm/page.h>
14#include <asm/mmu.h> 15#include <asm/mmu.h>
15 16
@@ -253,6 +254,9 @@ struct mm_struct {
253 struct file *exe_file; 254 struct file *exe_file;
254 unsigned long num_exe_file_vmas; 255 unsigned long num_exe_file_vmas;
255#endif 256#endif
257#ifdef CONFIG_MMU_NOTIFIER
258 struct mmu_notifier_mm *mmu_notifier_mm;
259#endif
256}; 260};
257 261
258#endif /* _LINUX_MM_TYPES_H */ 262#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
new file mode 100644
index 000000000000..b77486d152cd
--- /dev/null
+++ b/include/linux/mmu_notifier.h
@@ -0,0 +1,279 @@
1#ifndef _LINUX_MMU_NOTIFIER_H
2#define _LINUX_MMU_NOTIFIER_H
3
4#include <linux/list.h>
5#include <linux/spinlock.h>
6#include <linux/mm_types.h>
7
8struct mmu_notifier;
9struct mmu_notifier_ops;
10
11#ifdef CONFIG_MMU_NOTIFIER
12
13/*
14 * The mmu notifier_mm structure is allocated and installed in
15 * mm->mmu_notifier_mm inside the mm_take_all_locks() protected
16 * critical section and it's released only when mm_count reaches zero
17 * in mmdrop().
18 */
19struct mmu_notifier_mm {
20 /* all mmu notifiers registerd in this mm are queued in this list */
21 struct hlist_head list;
22 /* to serialize the list modifications and hlist_unhashed */
23 spinlock_t lock;
24};
25
26struct mmu_notifier_ops {
27 /*
28 * Called either by mmu_notifier_unregister or when the mm is
29 * being destroyed by exit_mmap, always before all pages are
30 * freed. This can run concurrently with other mmu notifier
31 * methods (the ones invoked outside the mm context) and it
32 * should tear down all secondary mmu mappings and freeze the
33 * secondary mmu. If this method isn't implemented you've to
34 * be sure that nothing could possibly write to the pages
35 * through the secondary mmu by the time the last thread with
36 * tsk->mm == mm exits.
37 *
38 * As side note: the pages freed after ->release returns could
39 * be immediately reallocated by the gart at an alias physical
40 * address with a different cache model, so if ->release isn't
41 * implemented because all _software_ driven memory accesses
42 * through the secondary mmu are terminated by the time the
43 * last thread of this mm quits, you've also to be sure that
44 * speculative _hardware_ operations can't allocate dirty
45 * cachelines in the cpu that could not be snooped and made
46 * coherent with the other read and write operations happening
47 * through the gart alias address, so leading to memory
48 * corruption.
49 */
50 void (*release)(struct mmu_notifier *mn,
51 struct mm_struct *mm);
52
53 /*
54 * clear_flush_young is called after the VM is
55 * test-and-clearing the young/accessed bitflag in the
56 * pte. This way the VM will provide proper aging to the
57 * accesses to the page through the secondary MMUs and not
58 * only to the ones through the Linux pte.
59 */
60 int (*clear_flush_young)(struct mmu_notifier *mn,
61 struct mm_struct *mm,
62 unsigned long address);
63
64 /*
65 * Before this is invoked any secondary MMU is still ok to
66 * read/write to the page previously pointed to by the Linux
67 * pte because the page hasn't been freed yet and it won't be
68 * freed until this returns. If required set_page_dirty has to
69 * be called internally to this method.
70 */
71 void (*invalidate_page)(struct mmu_notifier *mn,
72 struct mm_struct *mm,
73 unsigned long address);
74
75 /*
76 * invalidate_range_start() and invalidate_range_end() must be
77 * paired and are called only when the mmap_sem and/or the
78 * locks protecting the reverse maps are held. The subsystem
79 * must guarantee that no additional references are taken to
80 * the pages in the range established between the call to
81 * invalidate_range_start() and the matching call to
82 * invalidate_range_end().
83 *
84 * Invalidation of multiple concurrent ranges may be
85 * optionally permitted by the driver. Either way the
86 * establishment of sptes is forbidden in the range passed to
87 * invalidate_range_begin/end for the whole duration of the
88 * invalidate_range_begin/end critical section.
89 *
90 * invalidate_range_start() is called when all pages in the
91 * range are still mapped and have at least a refcount of one.
92 *
93 * invalidate_range_end() is called when all pages in the
94 * range have been unmapped and the pages have been freed by
95 * the VM.
96 *
97 * The VM will remove the page table entries and potentially
98 * the page between invalidate_range_start() and
99 * invalidate_range_end(). If the page must not be freed
100 * because of pending I/O or other circumstances then the
101 * invalidate_range_start() callback (or the initial mapping
102 * by the driver) must make sure that the refcount is kept
103 * elevated.
104 *
105 * If the driver increases the refcount when the pages are
106 * initially mapped into an address space then either
107 * invalidate_range_start() or invalidate_range_end() may
108 * decrease the refcount. If the refcount is decreased on
109 * invalidate_range_start() then the VM can free pages as page
110 * table entries are removed. If the refcount is only
111 * droppped on invalidate_range_end() then the driver itself
112 * will drop the last refcount but it must take care to flush
113 * any secondary tlb before doing the final free on the
114 * page. Pages will no longer be referenced by the linux
115 * address space but may still be referenced by sptes until
116 * the last refcount is dropped.
117 */
118 void (*invalidate_range_start)(struct mmu_notifier *mn,
119 struct mm_struct *mm,
120 unsigned long start, unsigned long end);
121 void (*invalidate_range_end)(struct mmu_notifier *mn,
122 struct mm_struct *mm,
123 unsigned long start, unsigned long end);
124};
125
126/*
127 * The notifier chains are protected by mmap_sem and/or the reverse map
128 * semaphores. Notifier chains are only changed when all reverse maps and
129 * the mmap_sem locks are taken.
130 *
131 * Therefore notifier chains can only be traversed when either
132 *
133 * 1. mmap_sem is held.
134 * 2. One of the reverse map locks is held (i_mmap_lock or anon_vma->lock).
135 * 3. No other concurrent thread can access the list (release)
136 */
137struct mmu_notifier {
138 struct hlist_node hlist;
139 const struct mmu_notifier_ops *ops;
140};
141
142static inline int mm_has_notifiers(struct mm_struct *mm)
143{
144 return unlikely(mm->mmu_notifier_mm);
145}
146
147extern int mmu_notifier_register(struct mmu_notifier *mn,
148 struct mm_struct *mm);
149extern int __mmu_notifier_register(struct mmu_notifier *mn,
150 struct mm_struct *mm);
151extern void mmu_notifier_unregister(struct mmu_notifier *mn,
152 struct mm_struct *mm);
153extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
154extern void __mmu_notifier_release(struct mm_struct *mm);
155extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
156 unsigned long address);
157extern void __mmu_notifier_invalidate_page(struct mm_struct *mm,
158 unsigned long address);
159extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
160 unsigned long start, unsigned long end);
161extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
162 unsigned long start, unsigned long end);
163
164static inline void mmu_notifier_release(struct mm_struct *mm)
165{
166 if (mm_has_notifiers(mm))
167 __mmu_notifier_release(mm);
168}
169
170static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
171 unsigned long address)
172{
173 if (mm_has_notifiers(mm))
174 return __mmu_notifier_clear_flush_young(mm, address);
175 return 0;
176}
177
178static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
179 unsigned long address)
180{
181 if (mm_has_notifiers(mm))
182 __mmu_notifier_invalidate_page(mm, address);
183}
184
185static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
186 unsigned long start, unsigned long end)
187{
188 if (mm_has_notifiers(mm))
189 __mmu_notifier_invalidate_range_start(mm, start, end);
190}
191
192static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
193 unsigned long start, unsigned long end)
194{
195 if (mm_has_notifiers(mm))
196 __mmu_notifier_invalidate_range_end(mm, start, end);
197}
198
199static inline void mmu_notifier_mm_init(struct mm_struct *mm)
200{
201 mm->mmu_notifier_mm = NULL;
202}
203
204static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
205{
206 if (mm_has_notifiers(mm))
207 __mmu_notifier_mm_destroy(mm);
208}
209
210/*
211 * These two macros will sometime replace ptep_clear_flush.
212 * ptep_clear_flush is impleemnted as macro itself, so this also is
213 * implemented as a macro until ptep_clear_flush will converted to an
214 * inline function, to diminish the risk of compilation failure. The
215 * invalidate_page method over time can be moved outside the PT lock
216 * and these two macros can be later removed.
217 */
218#define ptep_clear_flush_notify(__vma, __address, __ptep) \
219({ \
220 pte_t __pte; \
221 struct vm_area_struct *___vma = __vma; \
222 unsigned long ___address = __address; \
223 __pte = ptep_clear_flush(___vma, ___address, __ptep); \
224 mmu_notifier_invalidate_page(___vma->vm_mm, ___address); \
225 __pte; \
226})
227
228#define ptep_clear_flush_young_notify(__vma, __address, __ptep) \
229({ \
230 int __young; \
231 struct vm_area_struct *___vma = __vma; \
232 unsigned long ___address = __address; \
233 __young = ptep_clear_flush_young(___vma, ___address, __ptep); \
234 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
235 ___address); \
236 __young; \
237})
238
239#else /* CONFIG_MMU_NOTIFIER */
240
241static inline void mmu_notifier_release(struct mm_struct *mm)
242{
243}
244
245static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
246 unsigned long address)
247{
248 return 0;
249}
250
251static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
252 unsigned long address)
253{
254}
255
256static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
257 unsigned long start, unsigned long end)
258{
259}
260
261static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
262 unsigned long start, unsigned long end)
263{
264}
265
266static inline void mmu_notifier_mm_init(struct mm_struct *mm)
267{
268}
269
270static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
271{
272}
273
274#define ptep_clear_flush_young_notify ptep_clear_flush_young
275#define ptep_clear_flush_notify ptep_clear_flush
276
277#endif /* CONFIG_MMU_NOTIFIER */
278
279#endif /* _LINUX_MMU_NOTIFIER_H */
diff --git a/include/linux/mount.h b/include/linux/mount.h
index b5efaa2132ab..30a1d63b6fb5 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -105,7 +105,8 @@ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
105 105
106struct nameidata; 106struct nameidata;
107 107
108extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, 108struct path;
109extern int do_add_mount(struct vfsmount *newmnt, struct path *path,
109 int mnt_flags, struct list_head *fslist); 110 int mnt_flags, struct list_head *fslist);
110 111
111extern void mark_mounts_for_expiry(struct list_head *mounts); 112extern void mark_mounts_for_expiry(struct list_head *mounts);
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 4ed40caff4e5..922636548558 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -272,7 +272,11 @@ static inline void mtd_erase_callback(struct erase_info *instr)
272 printk(KERN_INFO args); \ 272 printk(KERN_INFO args); \
273 } while(0) 273 } while(0)
274#else /* CONFIG_MTD_DEBUG */ 274#else /* CONFIG_MTD_DEBUG */
275#define DEBUG(n, args...) do { } while(0) 275#define DEBUG(n, args...) \
276 do { \
277 if (0) \
278 printk(KERN_INFO args); \
279 } while(0)
276 280
277#endif /* CONFIG_MTD_DEBUG */ 281#endif /* CONFIG_MTD_DEBUG */
278 282
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 83f678702dff..81774e5facf4 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -177,7 +177,9 @@ typedef enum {
177#define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) 177#define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING))
178#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) 178#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG))
179#define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) 179#define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK))
180#define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT)) 180/* Large page NAND with SOFT_ECC should support subpage reads */
181#define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT) \
182 && (chip->page_shift > 9))
181 183
182/* Mask to zero out the chip options, which come from the id table */ 184/* Mask to zero out the chip options, which come from the id table */
183#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) 185#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b4d056ceab96..ee583f642a9f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -440,6 +440,7 @@ static inline void napi_synchronize(const struct napi_struct *n)
440enum netdev_queue_state_t 440enum netdev_queue_state_t
441{ 441{
442 __QUEUE_STATE_XOFF, 442 __QUEUE_STATE_XOFF,
443 __QUEUE_STATE_FROZEN,
443}; 444};
444 445
445struct netdev_queue { 446struct netdev_queue {
@@ -636,7 +637,7 @@ struct net_device
636 unsigned int real_num_tx_queues; 637 unsigned int real_num_tx_queues;
637 638
638 unsigned long tx_queue_len; /* Max frames per queue allowed */ 639 unsigned long tx_queue_len; /* Max frames per queue allowed */
639 640 spinlock_t tx_global_lock;
640/* 641/*
641 * One part is mostly used on xmit path (device) 642 * One part is mostly used on xmit path (device)
642 */ 643 */
@@ -1099,6 +1100,11 @@ static inline int netif_queue_stopped(const struct net_device *dev)
1099 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); 1100 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
1100} 1101}
1101 1102
1103static inline int netif_tx_queue_frozen(const struct netdev_queue *dev_queue)
1104{
1105 return test_bit(__QUEUE_STATE_FROZEN, &dev_queue->state);
1106}
1107
1102/** 1108/**
1103 * netif_running - test if up 1109 * netif_running - test if up
1104 * @dev: network device 1110 * @dev: network device
@@ -1475,6 +1481,26 @@ static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
1475 txq->xmit_lock_owner = smp_processor_id(); 1481 txq->xmit_lock_owner = smp_processor_id();
1476} 1482}
1477 1483
1484static inline int __netif_tx_trylock(struct netdev_queue *txq)
1485{
1486 int ok = spin_trylock(&txq->_xmit_lock);
1487 if (likely(ok))
1488 txq->xmit_lock_owner = smp_processor_id();
1489 return ok;
1490}
1491
1492static inline void __netif_tx_unlock(struct netdev_queue *txq)
1493{
1494 txq->xmit_lock_owner = -1;
1495 spin_unlock(&txq->_xmit_lock);
1496}
1497
1498static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
1499{
1500 txq->xmit_lock_owner = -1;
1501 spin_unlock_bh(&txq->_xmit_lock);
1502}
1503
1478/** 1504/**
1479 * netif_tx_lock - grab network device transmit lock 1505 * netif_tx_lock - grab network device transmit lock
1480 * @dev: network device 1506 * @dev: network device
@@ -1484,12 +1510,23 @@ static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
1484 */ 1510 */
1485static inline void netif_tx_lock(struct net_device *dev) 1511static inline void netif_tx_lock(struct net_device *dev)
1486{ 1512{
1487 int cpu = smp_processor_id();
1488 unsigned int i; 1513 unsigned int i;
1514 int cpu;
1489 1515
1516 spin_lock(&dev->tx_global_lock);
1517 cpu = smp_processor_id();
1490 for (i = 0; i < dev->num_tx_queues; i++) { 1518 for (i = 0; i < dev->num_tx_queues; i++) {
1491 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 1519 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1520
1521 /* We are the only thread of execution doing a
1522 * freeze, but we have to grab the _xmit_lock in
1523 * order to synchronize with threads which are in
1524 * the ->hard_start_xmit() handler and already
1525 * checked the frozen bit.
1526 */
1492 __netif_tx_lock(txq, cpu); 1527 __netif_tx_lock(txq, cpu);
1528 set_bit(__QUEUE_STATE_FROZEN, &txq->state);
1529 __netif_tx_unlock(txq);
1493 } 1530 }
1494} 1531}
1495 1532
@@ -1499,40 +1536,22 @@ static inline void netif_tx_lock_bh(struct net_device *dev)
1499 netif_tx_lock(dev); 1536 netif_tx_lock(dev);
1500} 1537}
1501 1538
1502static inline int __netif_tx_trylock(struct netdev_queue *txq)
1503{
1504 int ok = spin_trylock(&txq->_xmit_lock);
1505 if (likely(ok))
1506 txq->xmit_lock_owner = smp_processor_id();
1507 return ok;
1508}
1509
1510static inline int netif_tx_trylock(struct net_device *dev)
1511{
1512 return __netif_tx_trylock(netdev_get_tx_queue(dev, 0));
1513}
1514
1515static inline void __netif_tx_unlock(struct netdev_queue *txq)
1516{
1517 txq->xmit_lock_owner = -1;
1518 spin_unlock(&txq->_xmit_lock);
1519}
1520
1521static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
1522{
1523 txq->xmit_lock_owner = -1;
1524 spin_unlock_bh(&txq->_xmit_lock);
1525}
1526
1527static inline void netif_tx_unlock(struct net_device *dev) 1539static inline void netif_tx_unlock(struct net_device *dev)
1528{ 1540{
1529 unsigned int i; 1541 unsigned int i;
1530 1542
1531 for (i = 0; i < dev->num_tx_queues; i++) { 1543 for (i = 0; i < dev->num_tx_queues; i++) {
1532 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 1544 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1533 __netif_tx_unlock(txq);
1534 }
1535 1545
1546 /* No need to grab the _xmit_lock here. If the
1547 * queue is not stopped for another reason, we
1548 * force a schedule.
1549 */
1550 clear_bit(__QUEUE_STATE_FROZEN, &txq->state);
1551 if (!test_bit(__QUEUE_STATE_XOFF, &txq->state))
1552 __netif_schedule(txq->qdisc);
1553 }
1554 spin_unlock(&dev->tx_global_lock);
1536} 1555}
1537 1556
1538static inline void netif_tx_unlock_bh(struct net_device *dev) 1557static inline void netif_tx_unlock_bh(struct net_device *dev)
@@ -1556,13 +1575,18 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
1556static inline void netif_tx_disable(struct net_device *dev) 1575static inline void netif_tx_disable(struct net_device *dev)
1557{ 1576{
1558 unsigned int i; 1577 unsigned int i;
1578 int cpu;
1559 1579
1560 netif_tx_lock_bh(dev); 1580 local_bh_disable();
1581 cpu = smp_processor_id();
1561 for (i = 0; i < dev->num_tx_queues; i++) { 1582 for (i = 0; i < dev->num_tx_queues; i++) {
1562 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 1583 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1584
1585 __netif_tx_lock(txq, cpu);
1563 netif_tx_stop_queue(txq); 1586 netif_tx_stop_queue(txq);
1587 __netif_tx_unlock(txq);
1564 } 1588 }
1565 netif_tx_unlock_bh(dev); 1589 local_bh_enable();
1566} 1590}
1567 1591
1568static inline void netif_addr_lock(struct net_device *dev) 1592static inline void netif_addr_lock(struct net_device *dev)
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index 22ce29995f13..a049df4f2236 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -30,6 +30,9 @@ enum tcp_conntrack {
30/* Be liberal in window checking */ 30/* Be liberal in window checking */
31#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 31#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08
32 32
33/* Has unacknowledged data */
34#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10
35
33struct nf_ct_tcp_flags { 36struct nf_ct_tcp_flags {
34 u_int8_t flags; 37 u_int8_t flags;
35 u_int8_t mask; 38 u_int8_t mask;
diff --git a/include/linux/of.h b/include/linux/of.h
index 59a61bdc98b6..79886ade070f 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -70,5 +70,6 @@ extern int of_n_addr_cells(struct device_node *np);
70extern int of_n_size_cells(struct device_node *np); 70extern int of_n_size_cells(struct device_node *np);
71extern const struct of_device_id *of_match_node( 71extern const struct of_device_id *of_match_node(
72 const struct of_device_id *matches, const struct device_node *node); 72 const struct of_device_id *matches, const struct device_node *node);
73extern int of_modalias_node(struct device_node *node, char *modalias, int len);
73 74
74#endif /* _LINUX_OF_H */ 75#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h
new file mode 100644
index 000000000000..5f71ee8c0868
--- /dev/null
+++ b/include/linux/of_spi.h
@@ -0,0 +1,18 @@
1/*
2 * OpenFirmware SPI support routines
3 * Copyright (C) 2008 Secret Lab Technologies Ltd.
4 *
5 * Support routines for deriving SPI device attachments from the device
6 * tree.
7 */
8
9#ifndef __LINUX_OF_SPI_H
10#define __LINUX_OF_SPI_H
11
12#include <linux/of.h>
13#include <linux/spi/spi.h>
14
15extern void of_register_spi_devices(struct spi_master *master,
16 struct device_node *np);
17
18#endif /* __LINUX_OF_SPI */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 54590a9a103e..25aaccdb2f26 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -239,9 +239,6 @@ static inline void __SetPageUptodate(struct page *page)
239{ 239{
240 smp_wmb(); 240 smp_wmb();
241 __set_bit(PG_uptodate, &(page)->flags); 241 __set_bit(PG_uptodate, &(page)->flags);
242#ifdef CONFIG_S390
243 page_clear_dirty(page);
244#endif
245} 242}
246 243
247static inline void SetPageUptodate(struct page *page) 244static inline void SetPageUptodate(struct page *page)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index a81d81890422..69ed3cb1197a 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -20,6 +20,7 @@
20 */ 20 */
21#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */ 21#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */
22#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */ 22#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */
23#define AS_MM_ALL_LOCKS (__GFP_BITS_SHIFT + 2) /* under mm_take_all_locks() */
23 24
24static inline void mapping_set_error(struct address_space *mapping, int error) 25static inline void mapping_set_error(struct address_space *mapping, int error)
25{ 26{
@@ -142,6 +143,29 @@ static inline int page_cache_get_speculative(struct page *page)
142 return 1; 143 return 1;
143} 144}
144 145
146/*
147 * Same as above, but add instead of inc (could just be merged)
148 */
149static inline int page_cache_add_speculative(struct page *page, int count)
150{
151 VM_BUG_ON(in_interrupt());
152
153#if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU)
154# ifdef CONFIG_PREEMPT
155 VM_BUG_ON(!in_atomic());
156# endif
157 VM_BUG_ON(page_count(page) == 0);
158 atomic_add(count, &page->_count);
159
160#else
161 if (unlikely(!atomic_add_unless(&page->_count, count, 0)))
162 return 0;
163#endif
164 VM_BUG_ON(PageCompound(page) && page != compound_head(page));
165
166 return 1;
167}
168
145static inline int page_freeze_refs(struct page *page, int count) 169static inline int page_freeze_refs(struct page *page, int count)
146{ 170{
147 return likely(atomic_cmpxchg(&page->_count, count, 0) == count); 171 return likely(atomic_cmpxchg(&page->_count, count, 0) == count);
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index a1a1e618e996..91ba0b338b47 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -27,6 +27,7 @@ extern void pcie_aspm_init_link_state(struct pci_dev *pdev);
27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); 27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pci_disable_link_state(struct pci_dev *pdev, int state); 29extern void pci_disable_link_state(struct pci_dev *pdev, int state);
30extern void pcie_no_aspm(void);
30#else 31#else
31static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 32static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
32{ 33{
@@ -40,6 +41,10 @@ static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev)
40static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 41static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
41{ 42{
42} 43}
44
45static inline void pcie_no_aspm(void)
46{
47}
43#endif 48#endif
44 49
45#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ 50#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1d296d31abe0..825be3878f68 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -124,6 +124,8 @@ enum pci_dev_flags {
124 * generation too. 124 * generation too.
125 */ 125 */
126 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, 126 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1,
127 /* Device configuration is irrevocably lost if disabled into D3 */
128 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
127}; 129};
128 130
129typedef unsigned short __bitwise pci_bus_flags_t; 131typedef unsigned short __bitwise pci_bus_flags_t;
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 19958b929905..450684f7eaac 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -374,6 +374,7 @@
374#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ 374#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */
375#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ 375#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */
376#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ 376#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */
377#define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */
377#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ 378#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */
378#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ 379#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */
379#define PCI_EXP_DEVCTL 8 /* Device Control */ 380#define PCI_EXP_DEVCTL 8 /* Device Control */
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 68ed19ccf1f7..ea96ead1d39d 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -78,6 +78,7 @@ enum power_supply_property {
78 POWER_SUPPLY_PROP_CHARGE_EMPTY, 78 POWER_SUPPLY_PROP_CHARGE_EMPTY,
79 POWER_SUPPLY_PROP_CHARGE_NOW, 79 POWER_SUPPLY_PROP_CHARGE_NOW,
80 POWER_SUPPLY_PROP_CHARGE_AVG, 80 POWER_SUPPLY_PROP_CHARGE_AVG,
81 POWER_SUPPLY_PROP_CHARGE_COUNTER,
81 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 82 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
82 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, 83 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
83 POWER_SUPPLY_PROP_ENERGY_FULL, 84 POWER_SUPPLY_PROP_ENERGY_FULL,
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 742187f7a05c..ca6b9b5c8d52 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -43,6 +43,8 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
43 43
44int vfs_quota_on(struct super_block *sb, int type, int format_id, 44int vfs_quota_on(struct super_block *sb, int type, int format_id,
45 char *path, int remount); 45 char *path, int remount);
46int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
47 struct path *path);
46int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 48int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
47 int format_id, int type); 49 int format_id, int type);
48int vfs_quota_off(struct super_block *sb, int type, int remount); 50int vfs_quota_off(struct super_block *sb, int type, int remount);
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index b0f39be08b6c..eb4443c7e05b 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -98,6 +98,34 @@ static inline void list_del_rcu(struct list_head *entry)
98} 98}
99 99
100/** 100/**
101 * hlist_del_init_rcu - deletes entry from hash list with re-initialization
102 * @n: the element to delete from the hash list.
103 *
104 * Note: list_unhashed() on the node return true after this. It is
105 * useful for RCU based read lockfree traversal if the writer side
106 * must know if the list entry is still hashed or already unhashed.
107 *
108 * In particular, it means that we can not poison the forward pointers
109 * that may still be used for walking the hash list and we can only
110 * zero the pprev pointer so list_unhashed() will return true after
111 * this.
112 *
113 * The caller must take whatever precautions are necessary (such as
114 * holding appropriate locks) to avoid racing with another
115 * list-mutation primitive, such as hlist_add_head_rcu() or
116 * hlist_del_rcu(), running on this same list. However, it is
117 * perfectly legal to run concurrently with the _rcu list-traversal
118 * primitives, such as hlist_for_each_entry_rcu().
119 */
120static inline void hlist_del_init_rcu(struct hlist_node *n)
121{
122 if (!hlist_unhashed(n)) {
123 __hlist_del(n);
124 n->pprev = NULL;
125 }
126}
127
128/**
101 * list_replace_rcu - replace old entry by new one 129 * list_replace_rcu - replace old entry by new one
102 * @old : the element to be replaced 130 * @old : the element to be replaced
103 * @new : the new element to insert 131 * @new : the new element to insert
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h
new file mode 100644
index 000000000000..e84b0a9feda5
--- /dev/null
+++ b/include/linux/regulator/bq24022.h
@@ -0,0 +1,21 @@
1/*
2 * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater)
3 * 1-Cell Li-Ion Charger connected via GPIOs.
4 *
5 * Copyright (c) 2008 Philipp Zabel
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 */
12
13/**
14 * bq24022_mach_info - platform data for bq24022
15 * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging
16 * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA
17 */
18struct bq24022_mach_info {
19 int gpio_nce;
20 int gpio_iset2;
21};
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
new file mode 100644
index 000000000000..afdc4558bb94
--- /dev/null
+++ b/include/linux/regulator/consumer.h
@@ -0,0 +1,284 @@
1/*
2 * consumer.h -- SoC Regulator consumer support.
3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * Regulator Consumer Interface.
13 *
14 * A Power Management Regulator framework for SoC based devices.
15 * Features:-
16 * o Voltage and current level control.
17 * o Operating mode control.
18 * o Regulator status.
19 * o sysfs entries for showing client devices and status
20 *
21 * EXPERIMENTAL FEATURES:
22 * Dynamic Regulator operating Mode Switching (DRMS) - allows regulators
23 * to use most efficient operating mode depending upon voltage and load and
24 * is transparent to client drivers.
25 *
26 * e.g. Devices x,y,z share regulator r. Device x and y draw 20mA each during
27 * IO and 1mA at idle. Device z draws 100mA when under load and 5mA when
28 * idling. Regulator r has > 90% efficiency in NORMAL mode at loads > 100mA
29 * but this drops rapidly to 60% when below 100mA. Regulator r has > 90%
30 * efficiency in IDLE mode at loads < 10mA. Thus regulator r will operate
31 * in normal mode for loads > 10mA and in IDLE mode for load <= 10mA.
32 *
33 */
34
35#ifndef __LINUX_REGULATOR_CONSUMER_H_
36#define __LINUX_REGULATOR_CONSUMER_H_
37
38/*
39 * Regulator operating modes.
40 *
41 * Regulators can run in a variety of different operating modes depending on
42 * output load. This allows further system power savings by selecting the
43 * best (and most efficient) regulator mode for a desired load.
44 *
45 * Most drivers will only care about NORMAL. The modes below are generic and
46 * will probably not match the naming convention of your regulator data sheet
47 * but should match the use cases in the datasheet.
48 *
49 * In order of power efficiency (least efficient at top).
50 *
51 * Mode Description
52 * FAST Regulator can handle fast changes in it's load.
53 * e.g. useful in CPU voltage & frequency scaling where
54 * load can quickly increase with CPU frequency increases.
55 *
56 * NORMAL Normal regulator power supply mode. Most drivers will
57 * use this mode.
58 *
59 * IDLE Regulator runs in a more efficient mode for light
60 * loads. Can be used for devices that have a low power
61 * requirement during periods of inactivity. This mode
62 * may be more noisy than NORMAL and may not be able
63 * to handle fast load switching.
64 *
65 * STANDBY Regulator runs in the most efficient mode for very
66 * light loads. Can be used by devices when they are
67 * in a sleep/standby state. This mode is likely to be
68 * the most noisy and may not be able to handle fast load
69 * switching.
70 *
71 * NOTE: Most regulators will only support a subset of these modes. Some
72 * will only just support NORMAL.
73 *
74 * These modes can be OR'ed together to make up a mask of valid register modes.
75 */
76
77#define REGULATOR_MODE_FAST 0x1
78#define REGULATOR_MODE_NORMAL 0x2
79#define REGULATOR_MODE_IDLE 0x4
80#define REGULATOR_MODE_STANDBY 0x8
81
82/*
83 * Regulator notifier events.
84 *
85 * UNDER_VOLTAGE Regulator output is under voltage.
86 * OVER_CURRENT Regulator output current is too high.
87 * REGULATION_OUT Regulator output is out of regulation.
88 * FAIL Regulator output has failed.
89 * OVER_TEMP Regulator over temp.
90 * FORCE_DISABLE Regulator shut down by software.
91 *
92 * NOTE: These events can be OR'ed together when passed into handler.
93 */
94
95#define REGULATOR_EVENT_UNDER_VOLTAGE 0x01
96#define REGULATOR_EVENT_OVER_CURRENT 0x02
97#define REGULATOR_EVENT_REGULATION_OUT 0x04
98#define REGULATOR_EVENT_FAIL 0x08
99#define REGULATOR_EVENT_OVER_TEMP 0x10
100#define REGULATOR_EVENT_FORCE_DISABLE 0x20
101
102struct regulator;
103
104/**
105 * struct regulator_bulk_data - Data used for bulk regulator operations.
106 *
107 * @supply The name of the supply. Initialised by the user before
108 * using the bulk regulator APIs.
109 * @consumer The regulator consumer for the supply. This will be managed
110 * by the bulk API.
111 *
112 * The regulator APIs provide a series of regulator_bulk_() API calls as
113 * a convenience to consumers which require multiple supplies. This
114 * structure is used to manage data for these calls.
115 */
116struct regulator_bulk_data {
117 const char *supply;
118 struct regulator *consumer;
119};
120
121#if defined(CONFIG_REGULATOR)
122
123/* regulator get and put */
124struct regulator *__must_check regulator_get(struct device *dev,
125 const char *id);
126void regulator_put(struct regulator *regulator);
127
128/* regulator output control and status */
129int regulator_enable(struct regulator *regulator);
130int regulator_disable(struct regulator *regulator);
131int regulator_force_disable(struct regulator *regulator);
132int regulator_is_enabled(struct regulator *regulator);
133
134int regulator_bulk_get(struct device *dev, int num_consumers,
135 struct regulator_bulk_data *consumers);
136int regulator_bulk_enable(int num_consumers,
137 struct regulator_bulk_data *consumers);
138int regulator_bulk_disable(int num_consumers,
139 struct regulator_bulk_data *consumers);
140void regulator_bulk_free(int num_consumers,
141 struct regulator_bulk_data *consumers);
142
143int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
144int regulator_get_voltage(struct regulator *regulator);
145int regulator_set_current_limit(struct regulator *regulator,
146 int min_uA, int max_uA);
147int regulator_get_current_limit(struct regulator *regulator);
148
149int regulator_set_mode(struct regulator *regulator, unsigned int mode);
150unsigned int regulator_get_mode(struct regulator *regulator);
151int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);
152
153/* regulator notifier block */
154int regulator_register_notifier(struct regulator *regulator,
155 struct notifier_block *nb);
156int regulator_unregister_notifier(struct regulator *regulator,
157 struct notifier_block *nb);
158
159/* driver data - core doesn't touch */
160void *regulator_get_drvdata(struct regulator *regulator);
161void regulator_set_drvdata(struct regulator *regulator, void *data);
162
163#else
164
165/*
166 * Make sure client drivers will still build on systems with no software
167 * controllable voltage or current regulators.
168 */
169static inline struct regulator *__must_check regulator_get(struct device *dev,
170 const char *id)
171{
172 /* Nothing except the stubbed out regulator API should be
173 * looking at the value except to check if it is an error
174 * value so the actual return value doesn't matter.
175 */
176 return (struct regulator *)id;
177}
178static inline void regulator_put(struct regulator *regulator)
179{
180}
181
182static inline int regulator_enable(struct regulator *regulator)
183{
184 return 0;
185}
186
187static inline int regulator_disable(struct regulator *regulator)
188{
189 return 0;
190}
191
192static inline int regulator_is_enabled(struct regulator *regulator)
193{
194 return 1;
195}
196
197static inline int regulator_bulk_get(struct device *dev,
198 int num_consumers,
199 struct regulator_bulk_data *consumers)
200{
201 return 0;
202}
203
204static inline int regulator_bulk_enable(int num_consumers,
205 struct regulator_bulk_data *consumers)
206{
207 return 0;
208}
209
210static inline int regulator_bulk_disable(int num_consumers,
211 struct regulator_bulk_data *consumers)
212{
213 return 0;
214}
215
216static inline void regulator_bulk_free(int num_consumers,
217 struct regulator_bulk_data *consumers)
218{
219}
220
221static inline int regulator_set_voltage(struct regulator *regulator,
222 int min_uV, int max_uV)
223{
224 return 0;
225}
226
227static inline int regulator_get_voltage(struct regulator *regulator)
228{
229 return 0;
230}
231
232static inline int regulator_set_current_limit(struct regulator *regulator,
233 int min_uA, int max_uA)
234{
235 return 0;
236}
237
238static inline int regulator_get_current_limit(struct regulator *regulator)
239{
240 return 0;
241}
242
243static inline int regulator_set_mode(struct regulator *regulator,
244 unsigned int mode)
245{
246 return 0;
247}
248
249static inline unsigned int regulator_get_mode(struct regulator *regulator)
250{
251 return REGULATOR_MODE_NORMAL;
252}
253
254static inline int regulator_set_optimum_mode(struct regulator *regulator,
255 int load_uA)
256{
257 return REGULATOR_MODE_NORMAL;
258}
259
260static inline int regulator_register_notifier(struct regulator *regulator,
261 struct notifier_block *nb)
262{
263 return 0;
264}
265
266static inline int regulator_unregister_notifier(struct regulator *regulator,
267 struct notifier_block *nb)
268{
269 return 0;
270}
271
272static inline void *regulator_get_drvdata(struct regulator *regulator)
273{
274 return NULL;
275}
276
277static inline void regulator_set_drvdata(struct regulator *regulator,
278 void *data)
279{
280}
281
282#endif
283
284#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
new file mode 100644
index 000000000000..1d712c7172a2
--- /dev/null
+++ b/include/linux/regulator/driver.h
@@ -0,0 +1,99 @@
1/*
2 * driver.h -- SoC Regulator driver support.
3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * Regulator Driver Interface.
13 */
14
15#ifndef __LINUX_REGULATOR_DRIVER_H_
16#define __LINUX_REGULATOR_DRIVER_H_
17
18#include <linux/device.h>
19#include <linux/regulator/consumer.h>
20
21struct regulator_constraints;
22struct regulator_dev;
23
24/**
25 * struct regulator_ops - regulator operations.
26 *
27 * This struct describes regulator operations.
28 */
29struct regulator_ops {
30
31 /* get/set regulator voltage */
32 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV);
33 int (*get_voltage) (struct regulator_dev *);
34
35 /* get/set regulator current */
36 int (*set_current_limit) (struct regulator_dev *,
37 int min_uA, int max_uA);
38 int (*get_current_limit) (struct regulator_dev *);
39
40 /* enable/disable regulator */
41 int (*enable) (struct regulator_dev *);
42 int (*disable) (struct regulator_dev *);
43 int (*is_enabled) (struct regulator_dev *);
44
45 /* get/set regulator operating mode (defined in regulator.h) */
46 int (*set_mode) (struct regulator_dev *, unsigned int mode);
47 unsigned int (*get_mode) (struct regulator_dev *);
48
49 /* get most efficient regulator operating mode for load */
50 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,
51 int output_uV, int load_uA);
52
53 /* the operations below are for configuration of regulator state when
54 * it's parent PMIC enters a global STANBY/HIBERNATE state */
55
56 /* set regulator suspend voltage */
57 int (*set_suspend_voltage) (struct regulator_dev *, int uV);
58
59 /* enable/disable regulator in suspend state */
60 int (*set_suspend_enable) (struct regulator_dev *);
61 int (*set_suspend_disable) (struct regulator_dev *);
62
63 /* set regulator suspend operating mode (defined in regulator.h) */
64 int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode);
65};
66
67/*
68 * Regulators can either control voltage or current.
69 */
70enum regulator_type {
71 REGULATOR_VOLTAGE,
72 REGULATOR_CURRENT,
73};
74
75/**
76 * struct regulator_desc - Regulator descriptor
77 *
78 */
79struct regulator_desc {
80 const char *name;
81 int id;
82 struct regulator_ops *ops;
83 int irq;
84 enum regulator_type type;
85 struct module *owner;
86};
87
88
89struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
90 void *reg_data);
91void regulator_unregister(struct regulator_dev *rdev);
92
93int regulator_notifier_call_chain(struct regulator_dev *rdev,
94 unsigned long event, void *data);
95
96void *rdev_get_drvdata(struct regulator_dev *rdev);
97int rdev_get_id(struct regulator_dev *rdev);
98
99#endif
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
new file mode 100644
index 000000000000..1387a5d2190e
--- /dev/null
+++ b/include/linux/regulator/fixed.h
@@ -0,0 +1,22 @@
1/*
2 * fixed.h
3 *
4 * Copyright 2008 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
12 */
13
14#ifndef __REGULATOR_FIXED_H
15#define __REGULATOR_FIXED_H
16
17struct fixed_voltage_config {
18 const char *supply_name;
19 int microvolts;
20};
21
22#endif
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
new file mode 100644
index 000000000000..11e737dbfcf2
--- /dev/null
+++ b/include/linux/regulator/machine.h
@@ -0,0 +1,104 @@
1/*
2 * machine.h -- SoC Regulator support, machine/board driver API.
3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * Regulator Machine/Board Interface.
13 */
14
15#ifndef __LINUX_REGULATOR_MACHINE_H_
16#define __LINUX_REGULATOR_MACHINE_H_
17
18#include <linux/regulator/consumer.h>
19#include <linux/suspend.h>
20
21struct regulator;
22
23/*
24 * Regulator operation constraint flags. These flags are used to enable
25 * certain regulator operations and can be OR'ed together.
26 *
27 * VOLTAGE: Regulator output voltage can be changed by software on this
28 * board/machine.
29 * CURRENT: Regulator output current can be changed by software on this
30 * board/machine.
31 * MODE: Regulator operating mode can be changed by software on this
32 * board/machine.
33 * STATUS: Regulator can be enabled and disabled.
34 * DRMS: Dynamic Regulator Mode Switching is enabled for this regulator.
35 */
36
37#define REGULATOR_CHANGE_VOLTAGE 0x1
38#define REGULATOR_CHANGE_CURRENT 0x2
39#define REGULATOR_CHANGE_MODE 0x4
40#define REGULATOR_CHANGE_STATUS 0x8
41#define REGULATOR_CHANGE_DRMS 0x10
42
43/**
44 * struct regulator_state - regulator state during low power syatem states
45 *
46 * This describes a regulators state during a system wide low power state.
47 */
48struct regulator_state {
49 int uV; /* suspend voltage */
50 unsigned int mode; /* suspend regulator operating mode */
51 int enabled; /* is regulator enabled in this suspend state */
52};
53
54/**
55 * struct regulation_constraints - regulator operating constraints.
56 *
57 * This struct describes regulator and board/machine specific constraints.
58 */
59struct regulation_constraints {
60
61 char *name;
62
63 /* voltage output range (inclusive) - for voltage control */
64 int min_uV;
65 int max_uV;
66
67 /* current output range (inclusive) - for current control */
68 int min_uA;
69 int max_uA;
70
71 /* valid regulator operating modes for this machine */
72 unsigned int valid_modes_mask;
73
74 /* valid operations for regulator on this machine */
75 unsigned int valid_ops_mask;
76
77 /* regulator input voltage - only if supply is another regulator */
78 int input_uV;
79
80 /* regulator suspend states for global PMIC STANDBY/HIBERNATE */
81 struct regulator_state state_disk;
82 struct regulator_state state_mem;
83 struct regulator_state state_standby;
84 suspend_state_t initial_state; /* suspend state to set at init */
85
86 /* constriant flags */
87 unsigned always_on:1; /* regulator never off when system is on */
88 unsigned boot_on:1; /* bootloader/firmware enabled regulator */
89 unsigned apply_uV:1; /* apply uV constraint iff min == max */
90};
91
92int regulator_set_supply(const char *regulator, const char *regulator_supply);
93
94const char *regulator_get_supply(const char *regulator);
95
96int regulator_set_machine_constraints(const char *regulator,
97 struct regulation_constraints *constraints);
98
99int regulator_set_device_supply(const char *regulator, struct device *dev,
100 const char *supply);
101
102int regulator_suspend_prepare(suspend_state_t state);
103
104#endif
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index c5f6e54ec6ae..741d1a62cc3f 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -68,7 +68,8 @@ enum rfkill_state {
68 * @user_claim_unsupported: Whether the hardware supports exclusive 68 * @user_claim_unsupported: Whether the hardware supports exclusive
69 * RF-kill control by userspace. Set this before registering. 69 * RF-kill control by userspace. Set this before registering.
70 * @user_claim: Set when the switch is controlled exlusively by userspace. 70 * @user_claim: Set when the switch is controlled exlusively by userspace.
71 * @mutex: Guards switch state transitions 71 * @mutex: Guards switch state transitions. It serializes callbacks
72 * and also protects the state.
72 * @data: Pointer to the RF button drivers private data which will be 73 * @data: Pointer to the RF button drivers private data which will be
73 * passed along when toggling radio state. 74 * passed along when toggling radio state.
74 * @toggle_radio(): Mandatory handler to control state of the radio. 75 * @toggle_radio(): Mandatory handler to control state of the radio.
@@ -89,12 +90,13 @@ struct rfkill {
89 const char *name; 90 const char *name;
90 enum rfkill_type type; 91 enum rfkill_type type;
91 92
92 enum rfkill_state state;
93 bool user_claim_unsupported; 93 bool user_claim_unsupported;
94 bool user_claim; 94 bool user_claim;
95 95
96 /* the mutex serializes callbacks and also protects
97 * the state */
96 struct mutex mutex; 98 struct mutex mutex;
97 99 enum rfkill_state state;
98 void *data; 100 void *data;
99 int (*toggle_radio)(void *data, enum rfkill_state state); 101 int (*toggle_radio)(void *data, enum rfkill_state state);
100 int (*get_state)(void *data, enum rfkill_state *state); 102 int (*get_state)(void *data, enum rfkill_state *state);
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 1383692ac5bd..69407f85e10b 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -26,6 +26,14 @@
26 */ 26 */
27struct anon_vma { 27struct anon_vma {
28 spinlock_t lock; /* Serialize access to vma list */ 28 spinlock_t lock; /* Serialize access to vma list */
29 /*
30 * NOTE: the LSB of the head.next is set by
31 * mm_take_all_locks() _after_ taking the above lock. So the
32 * head must only be read/written after taking the above lock
33 * to be sure to see a valid next pointer. The LSB bit itself
34 * is serialized by a system wide lock only visible to
35 * mm_take_all_locks() (mm_all_locks_mutex).
36 */
29 struct list_head head; /* List of private "related" vmas */ 37 struct list_head head; /* List of private "related" vmas */
30}; 38};
31 39
diff --git a/include/linux/serio.h b/include/linux/serio.h
index e72716cca577..25641d9e0ea8 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -87,11 +87,10 @@ void serio_unregister_port(struct serio *serio);
87void serio_unregister_child_port(struct serio *serio); 87void serio_unregister_child_port(struct serio *serio);
88 88
89int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name); 89int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name);
90static inline int serio_register_driver(struct serio_driver *drv) 90static inline int __must_check serio_register_driver(struct serio_driver *drv)
91{ 91{
92 return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); 92 return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME);
93} 93}
94int serio_register_driver(struct serio_driver *drv);
95void serio_unregister_driver(struct serio_driver *drv); 94void serio_unregister_driver(struct serio_driver *drv);
96 95
97static inline int serio_write(struct serio *serio, unsigned char data) 96static inline int serio_write(struct serio *serio, unsigned char data)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7ea44f6621f2..cfcc45b3bef0 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -243,6 +243,7 @@ typedef unsigned char *sk_buff_data_t;
243 * @tc_index: Traffic control index 243 * @tc_index: Traffic control index
244 * @tc_verd: traffic control verdict 244 * @tc_verd: traffic control verdict
245 * @ndisc_nodetype: router type (from link layer) 245 * @ndisc_nodetype: router type (from link layer)
246 * @do_not_encrypt: set to prevent encryption of this frame
246 * @dma_cookie: a cookie to one of several possible DMA operations 247 * @dma_cookie: a cookie to one of several possible DMA operations
247 * done by skb DMA functions 248 * done by skb DMA functions
248 * @secmark: security marking 249 * @secmark: security marking
@@ -316,7 +317,10 @@ struct sk_buff {
316#ifdef CONFIG_IPV6_NDISC_NODETYPE 317#ifdef CONFIG_IPV6_NDISC_NODETYPE
317 __u8 ndisc_nodetype:2; 318 __u8 ndisc_nodetype:2;
318#endif 319#endif
319 /* 14 bit hole */ 320#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
321 __u8 do_not_encrypt:1;
322#endif
323 /* 0/13/14 bit hole */
320 324
321#ifdef CONFIG_NET_DMA 325#ifdef CONFIG_NET_DMA
322 dma_cookie_t dma_cookie; 326 dma_cookie_t dma_cookie;
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 5df62ef1280c..7a6e6bba4a71 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -214,6 +214,8 @@ enum
214 LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */ 214 LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */
215 LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */ 215 LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */
216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ 216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */
217 LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */
218 LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */
217 __LINUX_MIB_MAX 219 __LINUX_MIB_MAX
218}; 220};
219 221
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index a9cc29d46653..4be01bb44377 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -778,8 +778,20 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n)
778 * use spi_new_device() to describe each device. You can also call 778 * use spi_new_device() to describe each device. You can also call
779 * spi_unregister_device() to start making that device vanish, but 779 * spi_unregister_device() to start making that device vanish, but
780 * normally that would be handled by spi_unregister_master(). 780 * normally that would be handled by spi_unregister_master().
781 *
782 * You can also use spi_alloc_device() and spi_add_device() to use a two
783 * stage registration sequence for each spi_device. This gives the caller
784 * some more control over the spi_device structure before it is registered,
785 * but requires that caller to initialize fields that would otherwise
786 * be defined using the board info.
781 */ 787 */
782extern struct spi_device * 788extern struct spi_device *
789spi_alloc_device(struct spi_master *master);
790
791extern int
792spi_add_device(struct spi_device *spi);
793
794extern struct spi_device *
783spi_new_device(struct spi_master *, struct spi_board_info *); 795spi_new_device(struct spi_master *, struct spi_board_info *);
784 796
785static inline void 797static inline void
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 5bfc553bdb21..f1cb0ba6d715 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -5,41 +5,43 @@
5 (and more). So the "read" side to such a lock is anything which 5 (and more). So the "read" side to such a lock is anything which
6 diables preeempt. */ 6 diables preeempt. */
7#include <linux/cpu.h> 7#include <linux/cpu.h>
8#include <linux/cpumask.h>
8#include <asm/system.h> 9#include <asm/system.h>
9 10
10#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) 11#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP)
12
13/* Deprecated, but useful for transition. */
14#define ALL_CPUS ~0U
15
11/** 16/**
12 * stop_machine_run: freeze the machine on all CPUs and run this function 17 * stop_machine: freeze the machine on all CPUs and run this function
13 * @fn: the function to run 18 * @fn: the function to run
14 * @data: the data ptr for the @fn() 19 * @data: the data ptr for the @fn()
15 * @cpu: the cpu to run @fn() on (or any, if @cpu == NR_CPUS. 20 * @cpus: the cpus to run the @fn() on (NULL = any online cpu)
16 * 21 *
17 * Description: This causes a thread to be scheduled on every other cpu, 22 * Description: This causes a thread to be scheduled on every cpu,
18 * each of which disables interrupts, and finally interrupts are disabled 23 * each of which disables interrupts. The result is that noone is
19 * on the current CPU. The result is that noone is holding a spinlock 24 * holding a spinlock or inside any other preempt-disabled region when
20 * or inside any other preempt-disabled region when @fn() runs. 25 * @fn() runs.
21 * 26 *
22 * This can be thought of as a very heavy write lock, equivalent to 27 * This can be thought of as a very heavy write lock, equivalent to
23 * grabbing every spinlock in the kernel. */ 28 * grabbing every spinlock in the kernel. */
24int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu); 29int stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus);
25 30
26/** 31/**
27 * __stop_machine_run: freeze the machine on all CPUs and run this function 32 * __stop_machine: freeze the machine on all CPUs and run this function
28 * @fn: the function to run 33 * @fn: the function to run
29 * @data: the data ptr for the @fn 34 * @data: the data ptr for the @fn
30 * @cpu: the cpu to run @fn on (or any, if @cpu == NR_CPUS. 35 * @cpus: the cpus to run the @fn() on (NULL = any online cpu)
31 * 36 *
32 * Description: This is a special version of the above, which returns the 37 * Description: This is a special version of the above, which assumes cpus
33 * thread which has run @fn(): kthread_stop will return the return value 38 * won't come or go while it's being called. Used by hotplug cpu.
34 * of @fn(). Used by hotplug cpu.
35 */ 39 */
36struct task_struct *__stop_machine_run(int (*fn)(void *), void *data, 40int __stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus);
37 unsigned int cpu);
38
39#else 41#else
40 42
41static inline int stop_machine_run(int (*fn)(void *), void *data, 43static inline int stop_machine(int (*fn)(void *), void *data,
42 unsigned int cpu) 44 const cpumask_t *cpus)
43{ 45{
44 int ret; 46 int ret;
45 local_irq_disable(); 47 local_irq_disable();
@@ -48,4 +50,18 @@ static inline int stop_machine_run(int (*fn)(void *), void *data,
48 return ret; 50 return ret;
49} 51}
50#endif /* CONFIG_SMP */ 52#endif /* CONFIG_SMP */
53
54static inline int __deprecated stop_machine_run(int (*fn)(void *), void *data,
55 unsigned int cpu)
56{
57 /* If they don't care which cpu fn runs on, just pick one. */
58 if (cpu == NR_CPUS)
59 return stop_machine(fn, data, NULL);
60 else if (cpu == ~0U)
61 return stop_machine(fn, data, &cpu_possible_map);
62 else {
63 cpumask_t cpus = cpumask_of_cpu(cpu);
64 return stop_machine(fn, data, &cpus);
65 }
66}
51#endif /* _LINUX_STOP_MACHINE */ 67#endif /* _LINUX_STOP_MACHINE */
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 9385a566aed8..15a653d41132 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -17,6 +17,21 @@
17 17
18#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) 18#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
19 19
20#define VID_TYPE_CAPTURE 1 /* Can capture */
21#define VID_TYPE_TUNER 2 /* Can tune */
22#define VID_TYPE_TELETEXT 4 /* Does teletext */
23#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
24#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
25#define VID_TYPE_CLIPPING 32 /* Can clip */
26#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
27#define VID_TYPE_SCALES 128 /* Scalable */
28#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
29#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
30#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
31#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
32#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
33#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
34
20struct video_capability 35struct video_capability
21{ 36{
22 char name[32]; 37 char name[32];
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 2e66a95e8d32..e466bd54a50e 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -71,6 +71,11 @@
71 */ 71 */
72#define VIDEO_MAX_FRAME 32 72#define VIDEO_MAX_FRAME 32
73 73
74#ifndef __KERNEL__
75
76/* These defines are V4L1 specific and should not be used with the V4L2 API!
77 They will be removed from this header in the future. */
78
74#define VID_TYPE_CAPTURE 1 /* Can capture */ 79#define VID_TYPE_CAPTURE 1 /* Can capture */
75#define VID_TYPE_TUNER 2 /* Can tune */ 80#define VID_TYPE_TUNER 2 /* Can tune */
76#define VID_TYPE_TELETEXT 4 /* Does teletext */ 81#define VID_TYPE_TELETEXT 4 /* Does teletext */
@@ -85,14 +90,15 @@
85#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ 90#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
86#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ 91#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
87#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ 92#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
93#endif
88 94
89/* 95/*
90 * M I S C E L L A N E O U S 96 * M I S C E L L A N E O U S
91 */ 97 */
92 98
93/* Four-character-code (FOURCC) */ 99/* Four-character-code (FOURCC) */
94#define v4l2_fourcc(a,b,c,d)\ 100#define v4l2_fourcc(a, b, c, d)\
95 (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) 101 ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
96 102
97/* 103/*
98 * E N U M S 104 * E N U M S
@@ -226,8 +232,7 @@ struct v4l2_fract {
226/* 232/*
227 * D R I V E R C A P A B I L I T I E S 233 * D R I V E R C A P A B I L I T I E S
228 */ 234 */
229struct v4l2_capability 235struct v4l2_capability {
230{
231 __u8 driver[16]; /* i.e. "bttv" */ 236 __u8 driver[16]; /* i.e. "bttv" */
232 __u8 card[32]; /* i.e. "Hauppauge WinTV" */ 237 __u8 card[32]; /* i.e. "Hauppauge WinTV" */
233 __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ 238 __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */
@@ -259,8 +264,7 @@ struct v4l2_capability
259/* 264/*
260 * V I D E O I M A G E F O R M A T 265 * V I D E O I M A G E F O R M A T
261 */ 266 */
262struct v4l2_pix_format 267struct v4l2_pix_format {
263{
264 __u32 width; 268 __u32 width;
265 __u32 height; 269 __u32 height;
266 __u32 pixelformat; 270 __u32 pixelformat;
@@ -272,68 +276,69 @@ struct v4l2_pix_format
272}; 276};
273 277
274/* Pixel format FOURCC depth Description */ 278/* Pixel format FOURCC depth Description */
275#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ 279#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
276#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R','4','4','4') /* 16 xxxxrrrr ggggbbbb */ 280#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
277#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ 281#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
278#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ 282#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
279#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */ 283#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
280#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16 RGB-5-6-5 BE */ 284#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
281#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B','G','R','3') /* 24 BGR-8-8-8 */ 285#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
282#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R','G','B','3') /* 24 RGB-8-8-8 */ 286#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
283#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */ 287#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
284#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */ 288#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
285#define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */ 289#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
286#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y','1','6',' ') /* 16 Greyscale */ 290#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
287#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P','A','L','8') /* 8 8-bit palette */ 291#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */
288#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ 292#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
289#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */ 293#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
290#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y','U','Y','V') /* 16 YUV 4:2:2 */ 294#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
291#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U','Y','V','Y') /* 16 YUV 4:2:2 */ 295#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
292#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */ 296#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
293#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */ 297#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */
294#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ 298#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
295#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y','4','4','4') /* 16 xxxxyyyy uuuuvvvv */ 299#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */
296#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y','U','V','O') /* 16 YUV-5-5-5 */ 300#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */
297#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y','U','V','P') /* 16 YUV-5-6-5 */ 301#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */
298#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y','U','V','4') /* 32 YUV-8-8-8-8 */ 302#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */
299 303
300/* two planes -- one Y, one Cr + Cb interleaved */ 304/* two planes -- one Y, one Cr + Cb interleaved */
301#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */ 305#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
302#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N','V','2','1') /* 12 Y/CrCb 4:2:0 */ 306#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
303 307
304/* The following formats are not defined in the V4L2 specification */ 308/* The following formats are not defined in the V4L2 specification */
305#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y','U','V','9') /* 9 YUV 4:1:0 */ 309#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
306#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ 310#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
307#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ 311#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
308#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ 312#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
309#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:2:0 16x16 macroblocks */ 313#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
310 314
311/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 315/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
312#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ 316#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
313#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G','B','R','G') /* 8 GBGB.. RGRG.. */ 317#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
314#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B','Y','R','2') /* 16 BGBG.. GRGR.. */ 318#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
315 319
316/* compressed formats */ 320/* compressed formats */
317#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */ 321#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
318#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */ 322#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
319#define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */ 323#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
320#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG-1/2/4 */ 324#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */
321 325
322/* Vendor-specific formats */ 326/* Vendor-specific formats */
323#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ 327#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
324#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ 328#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
325#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */ 329#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */
326#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */ 330#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */
327#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */ 331#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */
328#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S','5','0','1') /* YUYV per line */ 332#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */
329#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S','5','6','1') /* compressed GBRG bayer */ 333#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */
330#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P','2','0','7') /* compressed BGGR bayer */ 334#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
335#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
336#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
331 337
332/* 338/*
333 * F O R M A T E N U M E R A T I O N 339 * F O R M A T E N U M E R A T I O N
334 */ 340 */
335struct v4l2_fmtdesc 341struct v4l2_fmtdesc {
336{
337 __u32 index; /* Format number */ 342 __u32 index; /* Format number */
338 enum v4l2_buf_type type; /* buffer type */ 343 enum v4l2_buf_type type; /* buffer type */
339 __u32 flags; 344 __u32 flags;
@@ -349,21 +354,18 @@ struct v4l2_fmtdesc
349/* 354/*
350 * F R A M E S I Z E E N U M E R A T I O N 355 * F R A M E S I Z E E N U M E R A T I O N
351 */ 356 */
352enum v4l2_frmsizetypes 357enum v4l2_frmsizetypes {
353{
354 V4L2_FRMSIZE_TYPE_DISCRETE = 1, 358 V4L2_FRMSIZE_TYPE_DISCRETE = 1,
355 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, 359 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
356 V4L2_FRMSIZE_TYPE_STEPWISE = 3, 360 V4L2_FRMSIZE_TYPE_STEPWISE = 3,
357}; 361};
358 362
359struct v4l2_frmsize_discrete 363struct v4l2_frmsize_discrete {
360{
361 __u32 width; /* Frame width [pixel] */ 364 __u32 width; /* Frame width [pixel] */
362 __u32 height; /* Frame height [pixel] */ 365 __u32 height; /* Frame height [pixel] */
363}; 366};
364 367
365struct v4l2_frmsize_stepwise 368struct v4l2_frmsize_stepwise {
366{
367 __u32 min_width; /* Minimum frame width [pixel] */ 369 __u32 min_width; /* Minimum frame width [pixel] */
368 __u32 max_width; /* Maximum frame width [pixel] */ 370 __u32 max_width; /* Maximum frame width [pixel] */
369 __u32 step_width; /* Frame width step size [pixel] */ 371 __u32 step_width; /* Frame width step size [pixel] */
@@ -372,8 +374,7 @@ struct v4l2_frmsize_stepwise
372 __u32 step_height; /* Frame height step size [pixel] */ 374 __u32 step_height; /* Frame height step size [pixel] */
373}; 375};
374 376
375struct v4l2_frmsizeenum 377struct v4l2_frmsizeenum {
376{
377 __u32 index; /* Frame size number */ 378 __u32 index; /* Frame size number */
378 __u32 pixel_format; /* Pixel format */ 379 __u32 pixel_format; /* Pixel format */
379 __u32 type; /* Frame size type the device supports. */ 380 __u32 type; /* Frame size type the device supports. */
@@ -389,22 +390,19 @@ struct v4l2_frmsizeenum
389/* 390/*
390 * F R A M E R A T E E N U M E R A T I O N 391 * F R A M E R A T E E N U M E R A T I O N
391 */ 392 */
392enum v4l2_frmivaltypes 393enum v4l2_frmivaltypes {
393{
394 V4L2_FRMIVAL_TYPE_DISCRETE = 1, 394 V4L2_FRMIVAL_TYPE_DISCRETE = 1,
395 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, 395 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
396 V4L2_FRMIVAL_TYPE_STEPWISE = 3, 396 V4L2_FRMIVAL_TYPE_STEPWISE = 3,
397}; 397};
398 398
399struct v4l2_frmival_stepwise 399struct v4l2_frmival_stepwise {
400{
401 struct v4l2_fract min; /* Minimum frame interval [s] */ 400 struct v4l2_fract min; /* Minimum frame interval [s] */
402 struct v4l2_fract max; /* Maximum frame interval [s] */ 401 struct v4l2_fract max; /* Maximum frame interval [s] */
403 struct v4l2_fract step; /* Frame interval step size [s] */ 402 struct v4l2_fract step; /* Frame interval step size [s] */
404}; 403};
405 404
406struct v4l2_frmivalenum 405struct v4l2_frmivalenum {
407{
408 __u32 index; /* Frame format index */ 406 __u32 index; /* Frame format index */
409 __u32 pixel_format; /* Pixel format */ 407 __u32 pixel_format; /* Pixel format */
410 __u32 width; /* Frame width */ 408 __u32 width; /* Frame width */
@@ -423,8 +421,7 @@ struct v4l2_frmivalenum
423/* 421/*
424 * T I M E C O D E 422 * T I M E C O D E
425 */ 423 */
426struct v4l2_timecode 424struct v4l2_timecode {
427{
428 __u32 type; 425 __u32 type;
429 __u32 flags; 426 __u32 flags;
430 __u8 frames; 427 __u8 frames;
@@ -449,8 +446,7 @@ struct v4l2_timecode
449#define V4L2_TC_USERBITS_8BITCHARS 0x0008 446#define V4L2_TC_USERBITS_8BITCHARS 0x0008
450/* The above is based on SMPTE timecodes */ 447/* The above is based on SMPTE timecodes */
451 448
452struct v4l2_jpegcompression 449struct v4l2_jpegcompression {
453{
454 int quality; 450 int quality;
455 451
456 int APPn; /* Number of APP segment to be written, 452 int APPn; /* Number of APP segment to be written,
@@ -482,16 +478,14 @@ struct v4l2_jpegcompression
482/* 478/*
483 * M E M O R Y - M A P P I N G B U F F E R S 479 * M E M O R Y - M A P P I N G B U F F E R S
484 */ 480 */
485struct v4l2_requestbuffers 481struct v4l2_requestbuffers {
486{
487 __u32 count; 482 __u32 count;
488 enum v4l2_buf_type type; 483 enum v4l2_buf_type type;
489 enum v4l2_memory memory; 484 enum v4l2_memory memory;
490 __u32 reserved[2]; 485 __u32 reserved[2];
491}; 486};
492 487
493struct v4l2_buffer 488struct v4l2_buffer {
494{
495 __u32 index; 489 __u32 index;
496 enum v4l2_buf_type type; 490 enum v4l2_buf_type type;
497 __u32 bytesused; 491 __u32 bytesused;
@@ -525,13 +519,12 @@ struct v4l2_buffer
525/* 519/*
526 * O V E R L A Y P R E V I E W 520 * O V E R L A Y P R E V I E W
527 */ 521 */
528struct v4l2_framebuffer 522struct v4l2_framebuffer {
529{
530 __u32 capability; 523 __u32 capability;
531 __u32 flags; 524 __u32 flags;
532/* FIXME: in theory we should pass something like PCI device + memory 525/* FIXME: in theory we should pass something like PCI device + memory
533 * region + offset instead of some physical address */ 526 * region + offset instead of some physical address */
534 void* base; 527 void *base;
535 struct v4l2_pix_format fmt; 528 struct v4l2_pix_format fmt;
536}; 529};
537/* Flags for the 'capability' field. Read only */ 530/* Flags for the 'capability' field. Read only */
@@ -550,14 +543,12 @@ struct v4l2_framebuffer
550#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 543#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
551#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 544#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
552 545
553struct v4l2_clip 546struct v4l2_clip {
554{
555 struct v4l2_rect c; 547 struct v4l2_rect c;
556 struct v4l2_clip __user *next; 548 struct v4l2_clip __user *next;
557}; 549};
558 550
559struct v4l2_window 551struct v4l2_window {
560{
561 struct v4l2_rect w; 552 struct v4l2_rect w;
562 enum v4l2_field field; 553 enum v4l2_field field;
563 __u32 chromakey; 554 __u32 chromakey;
@@ -570,8 +561,7 @@ struct v4l2_window
570/* 561/*
571 * C A P T U R E P A R A M E T E R S 562 * C A P T U R E P A R A M E T E R S
572 */ 563 */
573struct v4l2_captureparm 564struct v4l2_captureparm {
574{
575 __u32 capability; /* Supported modes */ 565 __u32 capability; /* Supported modes */
576 __u32 capturemode; /* Current mode */ 566 __u32 capturemode; /* Current mode */
577 struct v4l2_fract timeperframe; /* Time per frame in .1us units */ 567 struct v4l2_fract timeperframe; /* Time per frame in .1us units */
@@ -584,8 +574,7 @@ struct v4l2_captureparm
584#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ 574#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
585#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ 575#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
586 576
587struct v4l2_outputparm 577struct v4l2_outputparm {
588{
589 __u32 capability; /* Supported modes */ 578 __u32 capability; /* Supported modes */
590 __u32 outputmode; /* Current mode */ 579 __u32 outputmode; /* Current mode */
591 struct v4l2_fract timeperframe; /* Time per frame in seconds */ 580 struct v4l2_fract timeperframe; /* Time per frame in seconds */
@@ -702,8 +691,7 @@ typedef __u64 v4l2_std_id;
702#define V4L2_STD_ALL (V4L2_STD_525_60 |\ 691#define V4L2_STD_ALL (V4L2_STD_525_60 |\
703 V4L2_STD_625_50) 692 V4L2_STD_625_50)
704 693
705struct v4l2_standard 694struct v4l2_standard {
706{
707 __u32 index; 695 __u32 index;
708 v4l2_std_id id; 696 v4l2_std_id id;
709 __u8 name[24]; 697 __u8 name[24];
@@ -715,8 +703,7 @@ struct v4l2_standard
715/* 703/*
716 * V I D E O I N P U T S 704 * V I D E O I N P U T S
717 */ 705 */
718struct v4l2_input 706struct v4l2_input {
719{
720 __u32 index; /* Which input */ 707 __u32 index; /* Which input */
721 __u8 name[32]; /* Label */ 708 __u8 name[32]; /* Label */
722 __u32 type; /* Type of input */ 709 __u32 type; /* Type of input */
@@ -753,8 +740,7 @@ struct v4l2_input
753/* 740/*
754 * V I D E O O U T P U T S 741 * V I D E O O U T P U T S
755 */ 742 */
756struct v4l2_output 743struct v4l2_output {
757{
758 __u32 index; /* Which output */ 744 __u32 index; /* Which output */
759 __u8 name[32]; /* Label */ 745 __u8 name[32]; /* Label */
760 __u32 type; /* Type of output */ 746 __u32 type; /* Type of output */
@@ -771,14 +757,12 @@ struct v4l2_output
771/* 757/*
772 * C O N T R O L S 758 * C O N T R O L S
773 */ 759 */
774struct v4l2_control 760struct v4l2_control {
775{
776 __u32 id; 761 __u32 id;
777 __s32 value; 762 __s32 value;
778}; 763};
779 764
780struct v4l2_ext_control 765struct v4l2_ext_control {
781{
782 __u32 id; 766 __u32 id;
783 __u32 reserved2[2]; 767 __u32 reserved2[2];
784 union { 768 union {
@@ -788,8 +772,7 @@ struct v4l2_ext_control
788 }; 772 };
789} __attribute__ ((packed)); 773} __attribute__ ((packed));
790 774
791struct v4l2_ext_controls 775struct v4l2_ext_controls {
792{
793 __u32 ctrl_class; 776 __u32 ctrl_class;
794 __u32 count; 777 __u32 count;
795 __u32 error_idx; 778 __u32 error_idx;
@@ -807,8 +790,7 @@ struct v4l2_ext_controls
807#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) 790#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
808 791
809/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 792/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
810struct v4l2_queryctrl 793struct v4l2_queryctrl {
811{
812 __u32 id; 794 __u32 id;
813 enum v4l2_ctrl_type type; 795 enum v4l2_ctrl_type type;
814 __u8 name[32]; /* Whatever */ 796 __u8 name[32]; /* Whatever */
@@ -821,8 +803,7 @@ struct v4l2_queryctrl
821}; 803};
822 804
823/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ 805/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
824struct v4l2_querymenu 806struct v4l2_querymenu {
825{
826 __u32 id; 807 __u32 id;
827 __u32 index; 808 __u32 index;
828 __u8 name[32]; /* Whatever */ 809 __u8 name[32]; /* Whatever */
@@ -1104,8 +1085,7 @@ enum v4l2_exposure_auto_type {
1104/* 1085/*
1105 * T U N I N G 1086 * T U N I N G
1106 */ 1087 */
1107struct v4l2_tuner 1088struct v4l2_tuner {
1108{
1109 __u32 index; 1089 __u32 index;
1110 __u8 name[32]; 1090 __u8 name[32];
1111 enum v4l2_tuner_type type; 1091 enum v4l2_tuner_type type;
@@ -1119,8 +1099,7 @@ struct v4l2_tuner
1119 __u32 reserved[4]; 1099 __u32 reserved[4];
1120}; 1100};
1121 1101
1122struct v4l2_modulator 1102struct v4l2_modulator {
1123{
1124 __u32 index; 1103 __u32 index;
1125 __u8 name[32]; 1104 __u8 name[32];
1126 __u32 capability; 1105 __u32 capability;
@@ -1153,8 +1132,7 @@ struct v4l2_modulator
1153#define V4L2_TUNER_MODE_LANG1 0x0003 1132#define V4L2_TUNER_MODE_LANG1 0x0003
1154#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 1133#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004
1155 1134
1156struct v4l2_frequency 1135struct v4l2_frequency {
1157{
1158 __u32 tuner; 1136 __u32 tuner;
1159 enum v4l2_tuner_type type; 1137 enum v4l2_tuner_type type;
1160 __u32 frequency; 1138 __u32 frequency;
@@ -1172,8 +1150,7 @@ struct v4l2_hw_freq_seek {
1172/* 1150/*
1173 * A U D I O 1151 * A U D I O
1174 */ 1152 */
1175struct v4l2_audio 1153struct v4l2_audio {
1176{
1177 __u32 index; 1154 __u32 index;
1178 __u8 name[32]; 1155 __u8 name[32];
1179 __u32 capability; 1156 __u32 capability;
@@ -1188,8 +1165,7 @@ struct v4l2_audio
1188/* Flags for the 'mode' field */ 1165/* Flags for the 'mode' field */
1189#define V4L2_AUDMODE_AVL 0x00001 1166#define V4L2_AUDMODE_AVL 0x00001
1190 1167
1191struct v4l2_audioout 1168struct v4l2_audioout {
1192{
1193 __u32 index; 1169 __u32 index;
1194 __u8 name[32]; 1170 __u8 name[32];
1195 __u32 capability; 1171 __u32 capability;
@@ -1253,8 +1229,7 @@ struct v4l2_encoder_cmd {
1253 */ 1229 */
1254 1230
1255/* Raw VBI */ 1231/* Raw VBI */
1256struct v4l2_vbi_format 1232struct v4l2_vbi_format {
1257{
1258 __u32 sampling_rate; /* in 1 Hz */ 1233 __u32 sampling_rate; /* in 1 Hz */
1259 __u32 offset; 1234 __u32 offset;
1260 __u32 samples_per_line; 1235 __u32 samples_per_line;
@@ -1266,8 +1241,8 @@ struct v4l2_vbi_format
1266}; 1241};
1267 1242
1268/* VBI flags */ 1243/* VBI flags */
1269#define V4L2_VBI_UNSYNC (1<< 0) 1244#define V4L2_VBI_UNSYNC (1 << 0)
1270#define V4L2_VBI_INTERLACED (1<< 1) 1245#define V4L2_VBI_INTERLACED (1 << 1)
1271 1246
1272/* Sliced VBI 1247/* Sliced VBI
1273 * 1248 *
@@ -1276,8 +1251,7 @@ struct v4l2_vbi_format
1276 * notice in the definitive implementation. 1251 * notice in the definitive implementation.
1277 */ 1252 */
1278 1253
1279struct v4l2_sliced_vbi_format 1254struct v4l2_sliced_vbi_format {
1280{
1281 __u16 service_set; 1255 __u16 service_set;
1282 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field 1256 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
1283 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field 1257 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
@@ -1301,8 +1275,7 @@ struct v4l2_sliced_vbi_format
1301#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) 1275#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
1302#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) 1276#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
1303 1277
1304struct v4l2_sliced_vbi_cap 1278struct v4l2_sliced_vbi_cap {
1305{
1306 __u16 service_set; 1279 __u16 service_set;
1307 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field 1280 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
1308 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field 1281 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
@@ -1313,8 +1286,7 @@ struct v4l2_sliced_vbi_cap
1313 __u32 reserved[3]; /* must be 0 */ 1286 __u32 reserved[3]; /* must be 0 */
1314}; 1287};
1315 1288
1316struct v4l2_sliced_vbi_data 1289struct v4l2_sliced_vbi_data {
1317{
1318 __u32 id; 1290 __u32 id;
1319 __u32 field; /* 0: first field, 1: second field */ 1291 __u32 field; /* 0: first field, 1: second field */
1320 __u32 line; /* 1-23 */ 1292 __u32 line; /* 1-23 */
@@ -1328,27 +1300,23 @@ struct v4l2_sliced_vbi_data
1328 1300
1329/* Stream data format 1301/* Stream data format
1330 */ 1302 */
1331struct v4l2_format 1303struct v4l2_format {
1332{
1333 enum v4l2_buf_type type; 1304 enum v4l2_buf_type type;
1334 union 1305 union {
1335 { 1306 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
1336 struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE 1307 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
1337 struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY 1308 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
1338 struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE 1309 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
1339 struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE 1310 __u8 raw_data[200]; /* user-defined */
1340 __u8 raw_data[200]; // user-defined
1341 } fmt; 1311 } fmt;
1342}; 1312};
1343 1313
1344 1314
1345/* Stream type-dependent parameters 1315/* Stream type-dependent parameters
1346 */ 1316 */
1347struct v4l2_streamparm 1317struct v4l2_streamparm {
1348{
1349 enum v4l2_buf_type type; 1318 enum v4l2_buf_type type;
1350 union 1319 union {
1351 {
1352 struct v4l2_captureparm capture; 1320 struct v4l2_captureparm capture;
1353 struct v4l2_outputparm output; 1321 struct v4l2_outputparm output;
1354 __u8 raw_data[200]; /* user-defined */ 1322 __u8 raw_data[200]; /* user-defined */
@@ -1386,92 +1354,86 @@ struct v4l2_chip_ident {
1386 * I O C T L C O D E S F O R V I D E O D E V I C E S 1354 * I O C T L C O D E S F O R V I D E O D E V I C E S
1387 * 1355 *
1388 */ 1356 */
1389#define VIDIOC_QUERYCAP _IOR ('V', 0, struct v4l2_capability) 1357#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability)
1390#define VIDIOC_RESERVED _IO ('V', 1) 1358#define VIDIOC_RESERVED _IO('V', 1)
1391#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) 1359#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc)
1392#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) 1360#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format)
1393#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) 1361#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format)
1394#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) 1362#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers)
1395#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) 1363#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer)
1396#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) 1364#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer)
1397#define VIDIOC_S_FBUF _IOW ('V', 11, struct v4l2_framebuffer) 1365#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer)
1398#define VIDIOC_OVERLAY _IOW ('V', 14, int) 1366#define VIDIOC_OVERLAY _IOW('V', 14, int)
1399#define VIDIOC_QBUF _IOWR ('V', 15, struct v4l2_buffer) 1367#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer)
1400#define VIDIOC_DQBUF _IOWR ('V', 17, struct v4l2_buffer) 1368#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer)
1401#define VIDIOC_STREAMON _IOW ('V', 18, int) 1369#define VIDIOC_STREAMON _IOW('V', 18, int)
1402#define VIDIOC_STREAMOFF _IOW ('V', 19, int) 1370#define VIDIOC_STREAMOFF _IOW('V', 19, int)
1403#define VIDIOC_G_PARM _IOWR ('V', 21, struct v4l2_streamparm) 1371#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm)
1404#define VIDIOC_S_PARM _IOWR ('V', 22, struct v4l2_streamparm) 1372#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm)
1405#define VIDIOC_G_STD _IOR ('V', 23, v4l2_std_id) 1373#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id)
1406#define VIDIOC_S_STD _IOW ('V', 24, v4l2_std_id) 1374#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id)
1407#define VIDIOC_ENUMSTD _IOWR ('V', 25, struct v4l2_standard) 1375#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard)
1408#define VIDIOC_ENUMINPUT _IOWR ('V', 26, struct v4l2_input) 1376#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input)
1409#define VIDIOC_G_CTRL _IOWR ('V', 27, struct v4l2_control) 1377#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control)
1410#define VIDIOC_S_CTRL _IOWR ('V', 28, struct v4l2_control) 1378#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control)
1411#define VIDIOC_G_TUNER _IOWR ('V', 29, struct v4l2_tuner) 1379#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner)
1412#define VIDIOC_S_TUNER _IOW ('V', 30, struct v4l2_tuner) 1380#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner)
1413#define VIDIOC_G_AUDIO _IOR ('V', 33, struct v4l2_audio) 1381#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio)
1414#define VIDIOC_S_AUDIO _IOW ('V', 34, struct v4l2_audio) 1382#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio)
1415#define VIDIOC_QUERYCTRL _IOWR ('V', 36, struct v4l2_queryctrl) 1383#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl)
1416#define VIDIOC_QUERYMENU _IOWR ('V', 37, struct v4l2_querymenu) 1384#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu)
1417#define VIDIOC_G_INPUT _IOR ('V', 38, int) 1385#define VIDIOC_G_INPUT _IOR('V', 38, int)
1418#define VIDIOC_S_INPUT _IOWR ('V', 39, int) 1386#define VIDIOC_S_INPUT _IOWR('V', 39, int)
1419#define VIDIOC_G_OUTPUT _IOR ('V', 46, int) 1387#define VIDIOC_G_OUTPUT _IOR('V', 46, int)
1420#define VIDIOC_S_OUTPUT _IOWR ('V', 47, int) 1388#define VIDIOC_S_OUTPUT _IOWR('V', 47, int)
1421#define VIDIOC_ENUMOUTPUT _IOWR ('V', 48, struct v4l2_output) 1389#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output)
1422#define VIDIOC_G_AUDOUT _IOR ('V', 49, struct v4l2_audioout) 1390#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout)
1423#define VIDIOC_S_AUDOUT _IOW ('V', 50, struct v4l2_audioout) 1391#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout)
1424#define VIDIOC_G_MODULATOR _IOWR ('V', 54, struct v4l2_modulator) 1392#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator)
1425#define VIDIOC_S_MODULATOR _IOW ('V', 55, struct v4l2_modulator) 1393#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator)
1426#define VIDIOC_G_FREQUENCY _IOWR ('V', 56, struct v4l2_frequency) 1394#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency)
1427#define VIDIOC_S_FREQUENCY _IOW ('V', 57, struct v4l2_frequency) 1395#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency)
1428#define VIDIOC_CROPCAP _IOWR ('V', 58, struct v4l2_cropcap) 1396#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap)
1429#define VIDIOC_G_CROP _IOWR ('V', 59, struct v4l2_crop) 1397#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop)
1430#define VIDIOC_S_CROP _IOW ('V', 60, struct v4l2_crop) 1398#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop)
1431#define VIDIOC_G_JPEGCOMP _IOR ('V', 61, struct v4l2_jpegcompression) 1399#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression)
1432#define VIDIOC_S_JPEGCOMP _IOW ('V', 62, struct v4l2_jpegcompression) 1400#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression)
1433#define VIDIOC_QUERYSTD _IOR ('V', 63, v4l2_std_id) 1401#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id)
1434#define VIDIOC_TRY_FMT _IOWR ('V', 64, struct v4l2_format) 1402#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format)
1435#define VIDIOC_ENUMAUDIO _IOWR ('V', 65, struct v4l2_audio) 1403#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio)
1436#define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout) 1404#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout)
1437#define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority) 1405#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority)
1438#define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority) 1406#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority)
1439#define VIDIOC_G_SLICED_VBI_CAP _IOWR ('V', 69, struct v4l2_sliced_vbi_cap) 1407#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap)
1440#define VIDIOC_LOG_STATUS _IO ('V', 70) 1408#define VIDIOC_LOG_STATUS _IO('V', 70)
1441#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls) 1409#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
1442#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls) 1410#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls)
1443#define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls) 1411#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls)
1444#if 1 1412#if 1
1445#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) 1413#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum)
1446#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) 1414#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum)
1447#define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx) 1415#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx)
1448#define VIDIOC_ENCODER_CMD _IOWR ('V', 77, struct v4l2_encoder_cmd) 1416#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd)
1449#define VIDIOC_TRY_ENCODER_CMD _IOWR ('V', 78, struct v4l2_encoder_cmd) 1417#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd)
1450 1418
1451/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 1419/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
1452#define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) 1420#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_register)
1453#define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) 1421#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_register)
1454 1422
1455#define VIDIOC_G_CHIP_IDENT _IOWR ('V', 81, struct v4l2_chip_ident) 1423#define VIDIOC_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_chip_ident)
1456#endif 1424#endif
1457#define VIDIOC_S_HW_FREQ_SEEK _IOW ('V', 82, struct v4l2_hw_freq_seek) 1425#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
1458 1426
1459#ifdef __OLD_VIDIOC_ 1427#ifdef __OLD_VIDIOC_
1460/* for compatibility, will go away some day */ 1428/* for compatibility, will go away some day */
1461#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) 1429#define VIDIOC_OVERLAY_OLD _IOWR('V', 14, int)
1462#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) 1430#define VIDIOC_S_PARM_OLD _IOW('V', 22, struct v4l2_streamparm)
1463#define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control) 1431#define VIDIOC_S_CTRL_OLD _IOW('V', 28, struct v4l2_control)
1464#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) 1432#define VIDIOC_G_AUDIO_OLD _IOWR('V', 33, struct v4l2_audio)
1465#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) 1433#define VIDIOC_G_AUDOUT_OLD _IOWR('V', 49, struct v4l2_audioout)
1466#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) 1434#define VIDIOC_CROPCAP_OLD _IOR('V', 58, struct v4l2_cropcap)
1467#endif 1435#endif
1468 1436
1469#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ 1437#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1470 1438
1471#endif /* __LINUX_VIDEODEV2_H */ 1439#endif /* __LINUX_VIDEODEV2_H */
1472
1473/*
1474 * Local variables:
1475 * c-basic-offset: 8
1476 * End:
1477 */
diff --git a/include/linux/videotext.h b/include/linux/videotext.h
index 018f92047ff8..3e68c8d1c7f7 100644
--- a/include/linux/videotext.h
+++ b/include/linux/videotext.h
@@ -45,10 +45,10 @@
45#define VTXIOCCLRCACHE_OLD 0x710b /* clear cache on VTX-interface (if avail.) */ 45#define VTXIOCCLRCACHE_OLD 0x710b /* clear cache on VTX-interface (if avail.) */
46#define VTXIOCSETVIRT_OLD 0x710c /* turn on virtual mode (this disables TV-display) */ 46#define VTXIOCSETVIRT_OLD 0x710c /* turn on virtual mode (this disables TV-display) */
47 47
48/* 48/*
49 * Definitions for VTXIOCGETINFO 49 * Definitions for VTXIOCGETINFO
50 */ 50 */
51 51
52#define SAA5243 0 52#define SAA5243 0
53#define SAA5246 1 53#define SAA5246 1
54#define SAA5249 2 54#define SAA5249 2
@@ -57,10 +57,10 @@
57 57
58typedef struct { 58typedef struct {
59 int version_major, version_minor; /* version of driver; if version_major changes, driver */ 59 int version_major, version_minor; /* version of driver; if version_major changes, driver */
60 /* is not backward compatible!!! CHECK THIS!!! */ 60 /* is not backward compatible!!! CHECK THIS!!! */
61 int numpages; /* number of page-buffers of vtx-chipset */ 61 int numpages; /* number of page-buffers of vtx-chipset */
62 int cct_type; /* type of vtx-chipset (SAA5243, SAA5246, SAA5248 or 62 int cct_type; /* type of vtx-chipset (SAA5243, SAA5246, SAA5248 or
63 * SAA5249) */ 63 * SAA5249) */
64} 64}
65vtx_info_t; 65vtx_info_t;
66 66
@@ -81,7 +81,7 @@ vtx_info_t;
81#define PGMASK_HOUR (HR_TEN | HR_UNIT) 81#define PGMASK_HOUR (HR_TEN | HR_UNIT)
82#define PGMASK_MINUTE (MIN_TEN | MIN_UNIT) 82#define PGMASK_MINUTE (MIN_TEN | MIN_UNIT)
83 83
84typedef struct 84typedef struct
85{ 85{
86 int page; /* number of requested page (hexadecimal) */ 86 int page; /* number of requested page (hexadecimal) */
87 int hour; /* requested hour (hexadecimal) */ 87 int hour; /* requested hour (hexadecimal) */
@@ -98,11 +98,11 @@ vtx_pagereq_t;
98/* 98/*
99 * Definitions for VTXIOC{GETSTAT,PUTSTAT} 99 * Definitions for VTXIOC{GETSTAT,PUTSTAT}
100 */ 100 */
101 101
102#define VTX_PAGESIZE (40 * 24) 102#define VTX_PAGESIZE (40 * 24)
103#define VTX_VIRTUALSIZE (40 * 49) 103#define VTX_VIRTUALSIZE (40 * 49)
104 104
105typedef struct 105typedef struct
106{ 106{
107 int pagenum; /* number of page (hexadecimal) */ 107 int pagenum; /* number of page (hexadecimal) */
108 int hour; /* hour (hexadecimal) */ 108 int hour; /* hour (hexadecimal) */
@@ -121,5 +121,5 @@ typedef struct
121 unsigned hamming : 1; /* hamming-error occurred */ 121 unsigned hamming : 1; /* hamming-error occurred */
122} 122}
123vtx_pageinfo_t; 123vtx_pageinfo_t;
124 124
125#endif /* _VTX_H */ 125#endif /* _VTX_H */
diff --git a/include/media/audiochip.h b/include/media/audiochip.h
index db8823d45a7d..e69de29bb2d1 100644
--- a/include/media/audiochip.h
+++ b/include/media/audiochip.h
@@ -1,26 +0,0 @@
1/*
2 */
3
4#ifndef AUDIOCHIP_H
5#define AUDIOCHIP_H
6
7enum audiochip {
8 AUDIO_CHIP_NONE,
9 AUDIO_CHIP_UNKNOWN,
10 /* Provided by video chip */
11 AUDIO_CHIP_INTERNAL,
12 /* Provided by tvaudio.c */
13 AUDIO_CHIP_TDA8425,
14 AUDIO_CHIP_TEA6300,
15 AUDIO_CHIP_TEA6420,
16 AUDIO_CHIP_TDA9840,
17 AUDIO_CHIP_TDA985X,
18 AUDIO_CHIP_TDA9874,
19 AUDIO_CHIP_PIC16C54,
20 /* Provided by msp3400.c */
21 AUDIO_CHIP_MSP34XX,
22 /* Provided by wm8775.c */
23 AUDIO_CHIP_WM8775
24};
25
26#endif /* AUDIOCHIP_H */
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 89c442eb8849..1d104096619c 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -2,6 +2,7 @@
2#define __SAA7146_VV__ 2#define __SAA7146_VV__
3 3
4#include <media/v4l2-common.h> 4#include <media/v4l2-common.h>
5#include <media/v4l2-ioctl.h>
5#include <media/saa7146.h> 6#include <media/saa7146.h>
6#include <media/videobuf-dma-sg.h> 7#include <media/videobuf-dma-sg.h>
7 8
diff --git a/include/media/tveeprom.h b/include/media/tveeprom.h
index 5660ea24996b..a8ad75a9152a 100644
--- a/include/media/tveeprom.h
+++ b/include/media/tveeprom.h
@@ -3,7 +3,12 @@
3 3
4struct tveeprom { 4struct tveeprom {
5 u32 has_radio; 5 u32 has_radio;
6 u32 has_ir; /* bit 0: IR receiver present, bit 1: IR transmitter (blaster) present. -1 == unknown */ 6 /* If has_ir == 0, then it is unknown what the IR capabilities are,
7 otherwise:
8 bit 0: 1 (= IR capabilities are known)
9 bit 1: IR receiver present
10 bit 2: IR transmitter (blaster) present */
11 u32 has_ir;
7 u32 has_MAC_address; /* 0: no MAC, 1: MAC present, 2: unknown */ 12 u32 has_MAC_address; /* 0: no MAC, 1: MAC present, 2: unknown */
8 13
9 u32 tuner_type; 14 u32 tuner_type;
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 2a527742701a..41b509babf3f 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -90,7 +90,10 @@ enum {
90 /* module m52790: just ident 52790 */ 90 /* module m52790: just ident 52790 */
91 V4L2_IDENT_M52790 = 52790, 91 V4L2_IDENT_M52790 = 52790,
92 92
93 /* module msp34xx: reserved range 34000-34999 */ 93 /* module msp3400: reserved range 34000-34999 and 44000-44999 */
94 V4L2_IDENT_MSPX4XX = 34000, /* generic MSPX4XX identifier, only
95 use internally (tveeprom.c). */
96
94 V4L2_IDENT_MSP3400B = 34002, 97 V4L2_IDENT_MSP3400B = 34002,
95 V4L2_IDENT_MSP3410B = 34102, 98 V4L2_IDENT_MSP3410B = 34102,
96 99
@@ -142,7 +145,7 @@ enum {
142 V4L2_IDENT_MSP3457G = 34577, 145 V4L2_IDENT_MSP3457G = 34577,
143 V4L2_IDENT_MSP3467G = 34677, 146 V4L2_IDENT_MSP3467G = 34677,
144 147
145 /* module msp44xx: reserved range 44000-44999 */ 148 /* module msp3400: reserved range 34000-34999 and 44000-44999 */
146 V4L2_IDENT_MSP4400G = 44007, 149 V4L2_IDENT_MSP4400G = 44007,
147 V4L2_IDENT_MSP4410G = 44107, 150 V4L2_IDENT_MSP4410G = 44107,
148 V4L2_IDENT_MSP4420G = 44207, 151 V4L2_IDENT_MSP4420G = 44207,
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 020d05758bd8..07d3a9a575d1 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -28,12 +28,6 @@
28 28
29#include <media/v4l2-dev.h> 29#include <media/v4l2-dev.h>
30 30
31/* v4l debugging and diagnostics */
32
33/* Debug bitmask flags to be used on V4L2 */
34#define V4L2_DEBUG_IOCTL 0x01
35#define V4L2_DEBUG_IOCTL_ARG 0x02
36
37/* Common printk constucts for v4l-i2c drivers. These macros create a unique 31/* Common printk constucts for v4l-i2c drivers. These macros create a unique
38 prefix consisting of the driver name, the adapter number and the i2c 32 prefix consisting of the driver name, the adapter number and the i2c
39 address. */ 33 address. */
@@ -61,21 +55,20 @@
61 v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \ 55 v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \
62 } while (0) 56 } while (0)
63 57
58/* ------------------------------------------------------------------------- */
64 59
65/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */ 60/* Priority helper functions */
66#define v4l_print_ioctl(name, cmd) \
67 do { \
68 printk(KERN_DEBUG "%s: ", name); \
69 v4l_printk_ioctl(cmd); \
70 } while (0)
71 61
72/* Use this macro in I2C drivers where 'client' is the struct i2c_client 62struct v4l2_prio_state {
73 pointer */ 63 atomic_t prios[4];
74#define v4l_i2c_print_ioctl(client, cmd) \ 64};
75 do { \ 65int v4l2_prio_init(struct v4l2_prio_state *global);
76 v4l_client_printk(KERN_DEBUG, client, ""); \ 66int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
77 v4l_printk_ioctl(cmd); \ 67 enum v4l2_priority new);
78 } while (0) 68int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
69int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
70enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
71int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
79 72
80/* ------------------------------------------------------------------------- */ 73/* ------------------------------------------------------------------------- */
81 74
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 33f379b1ecfe..2745e1afc722 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -9,7 +9,6 @@
9#ifndef _V4L2_DEV_H 9#ifndef _V4L2_DEV_H
10#define _V4L2_DEV_H 10#define _V4L2_DEV_H
11 11
12#define OBSOLETE_OWNER 1 /* to be removed soon */
13#define OBSOLETE_DEVDATA 1 /* to be removed soon */ 12#define OBSOLETE_DEVDATA 1 /* to be removed soon */
14 13
15#include <linux/poll.h> 14#include <linux/poll.h>
@@ -17,11 +16,7 @@
17#include <linux/device.h> 16#include <linux/device.h>
18#include <linux/mutex.h> 17#include <linux/mutex.h>
19#include <linux/compiler.h> /* need __user */ 18#include <linux/compiler.h> /* need __user */
20#ifdef CONFIG_VIDEO_V4L1_COMPAT
21#include <linux/videodev.h>
22#else
23#include <linux/videodev2.h> 19#include <linux/videodev2.h>
24#endif
25 20
26#define VIDEO_MAJOR 81 21#define VIDEO_MAJOR 81
27/* Minor device allocation */ 22/* Minor device allocation */
@@ -39,42 +34,7 @@
39#define VFL_TYPE_RADIO 2 34#define VFL_TYPE_RADIO 2
40#define VFL_TYPE_VTX 3 35#define VFL_TYPE_VTX 3
41 36
42/* Video standard functions */ 37struct v4l2_ioctl_callbacks;
43extern const char *v4l2_norm_to_name(v4l2_std_id id);
44extern int v4l2_video_std_construct(struct v4l2_standard *vs,
45 int id, const char *name);
46/* Prints the ioctl in a human-readable format */
47extern void v4l_printk_ioctl(unsigned int cmd);
48
49/* prority handling */
50struct v4l2_prio_state {
51 atomic_t prios[4];
52};
53int v4l2_prio_init(struct v4l2_prio_state *global);
54int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
55 enum v4l2_priority new);
56int v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
57int v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority *local);
58enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
59int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority *local);
60
61/* names for fancy debug output */
62extern const char *v4l2_field_names[];
63extern const char *v4l2_type_names[];
64
65/* Compatibility layer interface -- v4l1-compat module */
66typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
67 unsigned int cmd, void *arg);
68#ifdef CONFIG_VIDEO_V4L1_COMPAT
69int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
70 int cmd, void *arg, v4l2_kioctl driver_ioctl);
71#else
72#define v4l_compat_translate_ioctl(inode,file,cmd,arg,ioctl) -EINVAL
73#endif
74
75/* 32 Bits compatibility layer for 64 bits processors */
76extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
77 unsigned long arg);
78 38
79/* 39/*
80 * Newer version of video_device, handled by videodev2.c 40 * Newer version of video_device, handled by videodev2.c
@@ -88,18 +48,17 @@ struct video_device
88 const struct file_operations *fops; 48 const struct file_operations *fops;
89 49
90 /* sysfs */ 50 /* sysfs */
91 struct device class_dev; /* v4l device */ 51 struct device dev; /* v4l device */
92 struct device *dev; /* device parent */ 52 struct device *parent; /* device parent */
93 53
94 /* device info */ 54 /* device info */
95 char name[32]; 55 char name[32];
96 int type; /* v4l1 */ 56 int vfl_type;
97 int type2; /* v4l2 */
98 int minor; 57 int minor;
99 /* attribute to diferentiate multiple indexs on one physical device */ 58 /* attribute to differentiate multiple indices on one physical device */
100 int index; 59 int index;
101 60
102 int debug; /* Activates debug level*/ 61 int debug; /* Activates debug level*/
103 62
104 /* Video standard vars */ 63 /* Video standard vars */
105 v4l2_std_id tvnorms; /* Supported tv norms */ 64 v4l2_std_id tvnorms; /* Supported tv norms */
@@ -109,285 +68,36 @@ struct video_device
109 void (*release)(struct video_device *vfd); 68 void (*release)(struct video_device *vfd);
110 69
111 /* ioctl callbacks */ 70 /* ioctl callbacks */
71 const struct v4l2_ioctl_ops *ioctl_ops;
112 72
113 /* VIDIOC_QUERYCAP handler */ 73#ifdef OBSOLETE_DEVDATA /* to be removed soon */
114 int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap); 74 /* dev->driver_data will be used instead some day.
115 75 * Use the video_{get|set}_drvdata() helper functions,
116 /* Priority handling */ 76 * so the switch over will be transparent for you.
117 int (*vidioc_g_priority) (struct file *file, void *fh, 77 * Or use {pci|usb}_{get|set}_drvdata() directly. */
118 enum v4l2_priority *p); 78 void *priv;
119 int (*vidioc_s_priority) (struct file *file, void *fh,
120 enum v4l2_priority p);
121
122 /* VIDIOC_ENUM_FMT handlers */
123 int (*vidioc_enum_fmt_vid_cap) (struct file *file, void *fh,
124 struct v4l2_fmtdesc *f);
125 int (*vidioc_enum_fmt_vid_overlay) (struct file *file, void *fh,
126 struct v4l2_fmtdesc *f);
127 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh,
128 struct v4l2_fmtdesc *f);
129#if 1
130 /* deprecated, will be removed in 2.6.28 */
131 int (*vidioc_enum_fmt_vbi_cap) (struct file *file, void *fh,
132 struct v4l2_fmtdesc *f);
133#endif
134 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
135 struct v4l2_fmtdesc *f);
136
137 /* VIDIOC_G_FMT handlers */
138 int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh,
139 struct v4l2_format *f);
140 int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
141 struct v4l2_format *f);
142 int (*vidioc_g_fmt_vid_out) (struct file *file, void *fh,
143 struct v4l2_format *f);
144 int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh,
145 struct v4l2_format *f);
146 int (*vidioc_g_fmt_vbi_cap) (struct file *file, void *fh,
147 struct v4l2_format *f);
148 int (*vidioc_g_fmt_vbi_out) (struct file *file, void *fh,
149 struct v4l2_format *f);
150 int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh,
151 struct v4l2_format *f);
152 int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
153 struct v4l2_format *f);
154 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
155 struct v4l2_format *f);
156
157 /* VIDIOC_S_FMT handlers */
158 int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh,
159 struct v4l2_format *f);
160 int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh,
161 struct v4l2_format *f);
162 int (*vidioc_s_fmt_vid_out) (struct file *file, void *fh,
163 struct v4l2_format *f);
164 int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh,
165 struct v4l2_format *f);
166 int (*vidioc_s_fmt_vbi_cap) (struct file *file, void *fh,
167 struct v4l2_format *f);
168 int (*vidioc_s_fmt_vbi_out) (struct file *file, void *fh,
169 struct v4l2_format *f);
170 int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh,
171 struct v4l2_format *f);
172 int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
173 struct v4l2_format *f);
174 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
175 struct v4l2_format *f);
176
177 /* VIDIOC_TRY_FMT handlers */
178 int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh,
179 struct v4l2_format *f);
180 int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
181 struct v4l2_format *f);
182 int (*vidioc_try_fmt_vid_out) (struct file *file, void *fh,
183 struct v4l2_format *f);
184 int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh,
185 struct v4l2_format *f);
186 int (*vidioc_try_fmt_vbi_cap) (struct file *file, void *fh,
187 struct v4l2_format *f);
188 int (*vidioc_try_fmt_vbi_out) (struct file *file, void *fh,
189 struct v4l2_format *f);
190 int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh,
191 struct v4l2_format *f);
192 int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
193 struct v4l2_format *f);
194 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
195 struct v4l2_format *f);
196
197 /* Buffer handlers */
198 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
199 int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
200 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
201 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
202
203
204 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i);
205#ifdef CONFIG_VIDEO_V4L1_COMPAT
206 /* buffer type is struct vidio_mbuf * */
207 int (*vidiocgmbuf) (struct file *file, void *fh, struct video_mbuf *p);
208#endif
209 int (*vidioc_g_fbuf) (struct file *file, void *fh,
210 struct v4l2_framebuffer *a);
211 int (*vidioc_s_fbuf) (struct file *file, void *fh,
212 struct v4l2_framebuffer *a);
213
214 /* Stream on/off */
215 int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i);
216 int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i);
217
218 /* Standard handling
219 ENUMSTD is handled by videodev.c
220 */
221 int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm);
222 int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id *norm);
223 int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a);
224
225 /* Input handling */
226 int (*vidioc_enum_input)(struct file *file, void *fh,
227 struct v4l2_input *inp);
228 int (*vidioc_g_input) (struct file *file, void *fh, unsigned int *i);
229 int (*vidioc_s_input) (struct file *file, void *fh, unsigned int i);
230
231 /* Output handling */
232 int (*vidioc_enum_output) (struct file *file, void *fh,
233 struct v4l2_output *a);
234 int (*vidioc_g_output) (struct file *file, void *fh, unsigned int *i);
235 int (*vidioc_s_output) (struct file *file, void *fh, unsigned int i);
236
237 /* Control handling */
238 int (*vidioc_queryctrl) (struct file *file, void *fh,
239 struct v4l2_queryctrl *a);
240 int (*vidioc_g_ctrl) (struct file *file, void *fh,
241 struct v4l2_control *a);
242 int (*vidioc_s_ctrl) (struct file *file, void *fh,
243 struct v4l2_control *a);
244 int (*vidioc_g_ext_ctrls) (struct file *file, void *fh,
245 struct v4l2_ext_controls *a);
246 int (*vidioc_s_ext_ctrls) (struct file *file, void *fh,
247 struct v4l2_ext_controls *a);
248 int (*vidioc_try_ext_ctrls) (struct file *file, void *fh,
249 struct v4l2_ext_controls *a);
250 int (*vidioc_querymenu) (struct file *file, void *fh,
251 struct v4l2_querymenu *a);
252
253 /* Audio ioctls */
254 int (*vidioc_enumaudio) (struct file *file, void *fh,
255 struct v4l2_audio *a);
256 int (*vidioc_g_audio) (struct file *file, void *fh,
257 struct v4l2_audio *a);
258 int (*vidioc_s_audio) (struct file *file, void *fh,
259 struct v4l2_audio *a);
260
261 /* Audio out ioctls */
262 int (*vidioc_enumaudout) (struct file *file, void *fh,
263 struct v4l2_audioout *a);
264 int (*vidioc_g_audout) (struct file *file, void *fh,
265 struct v4l2_audioout *a);
266 int (*vidioc_s_audout) (struct file *file, void *fh,
267 struct v4l2_audioout *a);
268 int (*vidioc_g_modulator) (struct file *file, void *fh,
269 struct v4l2_modulator *a);
270 int (*vidioc_s_modulator) (struct file *file, void *fh,
271 struct v4l2_modulator *a);
272 /* Crop ioctls */
273 int (*vidioc_cropcap) (struct file *file, void *fh,
274 struct v4l2_cropcap *a);
275 int (*vidioc_g_crop) (struct file *file, void *fh,
276 struct v4l2_crop *a);
277 int (*vidioc_s_crop) (struct file *file, void *fh,
278 struct v4l2_crop *a);
279 /* Compression ioctls */
280 int (*vidioc_g_jpegcomp) (struct file *file, void *fh,
281 struct v4l2_jpegcompression *a);
282 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
283 struct v4l2_jpegcompression *a);
284 int (*vidioc_g_enc_index) (struct file *file, void *fh,
285 struct v4l2_enc_idx *a);
286 int (*vidioc_encoder_cmd) (struct file *file, void *fh,
287 struct v4l2_encoder_cmd *a);
288 int (*vidioc_try_encoder_cmd) (struct file *file, void *fh,
289 struct v4l2_encoder_cmd *a);
290
291 /* Stream type-dependent parameter ioctls */
292 int (*vidioc_g_parm) (struct file *file, void *fh,
293 struct v4l2_streamparm *a);
294 int (*vidioc_s_parm) (struct file *file, void *fh,
295 struct v4l2_streamparm *a);
296
297 /* Tuner ioctls */
298 int (*vidioc_g_tuner) (struct file *file, void *fh,
299 struct v4l2_tuner *a);
300 int (*vidioc_s_tuner) (struct file *file, void *fh,
301 struct v4l2_tuner *a);
302 int (*vidioc_g_frequency) (struct file *file, void *fh,
303 struct v4l2_frequency *a);
304 int (*vidioc_s_frequency) (struct file *file, void *fh,
305 struct v4l2_frequency *a);
306
307 /* Sliced VBI cap */
308 int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh,
309 struct v4l2_sliced_vbi_cap *a);
310
311 /* Log status ioctl */
312 int (*vidioc_log_status) (struct file *file, void *fh);
313
314 int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh,
315 struct v4l2_hw_freq_seek *a);
316
317 /* Debugging ioctls */
318#ifdef CONFIG_VIDEO_ADV_DEBUG
319 int (*vidioc_g_register) (struct file *file, void *fh,
320 struct v4l2_register *reg);
321 int (*vidioc_s_register) (struct file *file, void *fh,
322 struct v4l2_register *reg);
323#endif
324 int (*vidioc_g_chip_ident) (struct file *file, void *fh,
325 struct v4l2_chip_ident *chip);
326
327 /* For other private ioctls */
328 int (*vidioc_default) (struct file *file, void *fh,
329 int cmd, void *arg);
330
331
332#ifdef OBSOLETE_OWNER /* to be removed soon */
333/* obsolete -- fops->owner is used instead */
334struct module *owner;
335/* dev->driver_data will be used instead some day.
336 * Use the video_{get|set}_drvdata() helper functions,
337 * so the switch over will be transparent for you.
338 * Or use {pci|usb}_{get|set}_drvdata() directly. */
339void *priv;
340#endif 79#endif
341 80
342 /* for videodev.c intenal usage -- please don't touch */ 81 /* for videodev.c internal usage -- please don't touch */
343 int users; /* video_exclusive_{open|close} ... */ 82 int users; /* video_exclusive_{open|close} ... */
344 struct mutex lock; /* ... helper function uses these */ 83 struct mutex lock; /* ... helper function uses these */
345}; 84};
346 85
347/* Class-dev to video-device */ 86/* Class-dev to video-device */
348#define to_video_device(cd) container_of(cd, struct video_device, class_dev) 87#define to_video_device(cd) container_of(cd, struct video_device, dev)
349 88
350/* Version 2 functions */ 89/* Version 2 functions */
351extern int video_register_device(struct video_device *vfd, int type, int nr); 90extern int video_register_device(struct video_device *vfd, int type, int nr);
352int video_register_device_index(struct video_device *vfd, int type, int nr, 91int video_register_device_index(struct video_device *vfd, int type, int nr,
353 int index); 92 int index);
354void video_unregister_device(struct video_device *); 93void video_unregister_device(struct video_device *);
355extern int video_ioctl2(struct inode *inode, struct file *file,
356 unsigned int cmd, unsigned long arg);
357 94
358/* helper functions to alloc / release struct video_device, the 95/* helper functions to alloc / release struct video_device, the
359 later can be used for video_device->release() */ 96 later can be used for video_device->release() */
360struct video_device *video_device_alloc(void); 97struct video_device *video_device_alloc(void);
361void video_device_release(struct video_device *vfd); 98void video_device_release(struct video_device *vfd);
362 99
363/* Include support for obsoleted stuff */ 100#ifdef OBSOLETE_DEVDATA /* to be removed soon */
364extern int video_usercopy(struct inode *inode, struct file *file,
365 unsigned int cmd, unsigned long arg,
366 int (*func)(struct inode *inode, struct file *file,
367 unsigned int cmd, void *arg));
368
369#ifdef CONFIG_VIDEO_V4L1_COMPAT
370#include <linux/mm.h>
371
372static inline int __must_check
373video_device_create_file(struct video_device *vfd,
374 struct device_attribute *attr)
375{
376 int ret = device_create_file(&vfd->class_dev, attr);
377 if (ret < 0)
378 printk(KERN_WARNING "%s error: %d\n", __func__, ret);
379 return ret;
380}
381static inline void
382video_device_remove_file(struct video_device *vfd,
383 struct device_attribute *attr)
384{
385 device_remove_file(&vfd->class_dev, attr);
386}
387
388#endif /* CONFIG_VIDEO_V4L1_COMPAT */
389
390#ifdef OBSOLETE_OWNER /* to be removed soon */
391/* helper functions to access driver private data. */ 101/* helper functions to access driver private data. */
392static inline void *video_get_drvdata(struct video_device *dev) 102static inline void *video_get_drvdata(struct video_device *dev)
393{ 103{
@@ -399,9 +109,6 @@ static inline void video_set_drvdata(struct video_device *dev, void *data)
399 dev->priv = data; 109 dev->priv = data;
400} 110}
401 111
402#endif
403
404#ifdef OBSOLETE_DEVDATA /* to be removed soon */
405/* Obsolete stuff - Still needed for radio devices and obsolete drivers */ 112/* Obsolete stuff - Still needed for radio devices and obsolete drivers */
406extern struct video_device* video_devdata(struct file*); 113extern struct video_device* video_devdata(struct file*);
407extern int video_exclusive_open(struct inode *inode, struct file *file); 114extern int video_exclusive_open(struct inode *inode, struct file *file);
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
new file mode 100644
index 000000000000..dc6404618555
--- /dev/null
+++ b/include/media/v4l2-ioctl.h
@@ -0,0 +1,301 @@
1/*
2 *
3 * V 4 L 2 D R I V E R H E L P E R A P I
4 *
5 * Moved from videodev2.h
6 *
7 * Some commonly needed functions for drivers (v4l2-common.o module)
8 */
9#ifndef _V4L2_IOCTL_H
10#define _V4L2_IOCTL_H
11
12#include <linux/poll.h>
13#include <linux/fs.h>
14#include <linux/device.h>
15#include <linux/mutex.h>
16#include <linux/compiler.h> /* need __user */
17#ifdef CONFIG_VIDEO_V4L1_COMPAT
18#include <linux/videodev.h>
19#else
20#include <linux/videodev2.h>
21#endif
22
23struct v4l2_ioctl_ops {
24 /* ioctl callbacks */
25
26 /* VIDIOC_QUERYCAP handler */
27 int (*vidioc_querycap)(struct file *file, void *fh, struct v4l2_capability *cap);
28
29 /* Priority handling */
30 int (*vidioc_g_priority) (struct file *file, void *fh,
31 enum v4l2_priority *p);
32 int (*vidioc_s_priority) (struct file *file, void *fh,
33 enum v4l2_priority p);
34
35 /* VIDIOC_ENUM_FMT handlers */
36 int (*vidioc_enum_fmt_vid_cap) (struct file *file, void *fh,
37 struct v4l2_fmtdesc *f);
38 int (*vidioc_enum_fmt_vid_overlay) (struct file *file, void *fh,
39 struct v4l2_fmtdesc *f);
40 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh,
41 struct v4l2_fmtdesc *f);
42#if 1
43 /* deprecated, will be removed in 2.6.28 */
44 int (*vidioc_enum_fmt_vbi_cap) (struct file *file, void *fh,
45 struct v4l2_fmtdesc *f);
46#endif
47 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
48 struct v4l2_fmtdesc *f);
49
50 /* VIDIOC_G_FMT handlers */
51 int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh,
52 struct v4l2_format *f);
53 int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
54 struct v4l2_format *f);
55 int (*vidioc_g_fmt_vid_out) (struct file *file, void *fh,
56 struct v4l2_format *f);
57 int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh,
58 struct v4l2_format *f);
59 int (*vidioc_g_fmt_vbi_cap) (struct file *file, void *fh,
60 struct v4l2_format *f);
61 int (*vidioc_g_fmt_vbi_out) (struct file *file, void *fh,
62 struct v4l2_format *f);
63 int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh,
64 struct v4l2_format *f);
65 int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
66 struct v4l2_format *f);
67 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
68 struct v4l2_format *f);
69
70 /* VIDIOC_S_FMT handlers */
71 int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh,
72 struct v4l2_format *f);
73 int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh,
74 struct v4l2_format *f);
75 int (*vidioc_s_fmt_vid_out) (struct file *file, void *fh,
76 struct v4l2_format *f);
77 int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh,
78 struct v4l2_format *f);
79 int (*vidioc_s_fmt_vbi_cap) (struct file *file, void *fh,
80 struct v4l2_format *f);
81 int (*vidioc_s_fmt_vbi_out) (struct file *file, void *fh,
82 struct v4l2_format *f);
83 int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh,
84 struct v4l2_format *f);
85 int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
86 struct v4l2_format *f);
87 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
88 struct v4l2_format *f);
89
90 /* VIDIOC_TRY_FMT handlers */
91 int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh,
92 struct v4l2_format *f);
93 int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
94 struct v4l2_format *f);
95 int (*vidioc_try_fmt_vid_out) (struct file *file, void *fh,
96 struct v4l2_format *f);
97 int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh,
98 struct v4l2_format *f);
99 int (*vidioc_try_fmt_vbi_cap) (struct file *file, void *fh,
100 struct v4l2_format *f);
101 int (*vidioc_try_fmt_vbi_out) (struct file *file, void *fh,
102 struct v4l2_format *f);
103 int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh,
104 struct v4l2_format *f);
105 int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
106 struct v4l2_format *f);
107 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
108 struct v4l2_format *f);
109
110 /* Buffer handlers */
111 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
112 int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
113 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
114 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
115
116
117 int (*vidioc_overlay) (struct file *file, void *fh, unsigned int i);
118#ifdef CONFIG_VIDEO_V4L1_COMPAT
119 /* buffer type is struct vidio_mbuf * */
120 int (*vidiocgmbuf) (struct file *file, void *fh, struct video_mbuf *p);
121#endif
122 int (*vidioc_g_fbuf) (struct file *file, void *fh,
123 struct v4l2_framebuffer *a);
124 int (*vidioc_s_fbuf) (struct file *file, void *fh,
125 struct v4l2_framebuffer *a);
126
127 /* Stream on/off */
128 int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i);
129 int (*vidioc_streamoff)(struct file *file, void *fh, enum v4l2_buf_type i);
130
131 /* Standard handling
132 ENUMSTD is handled by videodev.c
133 */
134 int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm);
135 int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id *norm);
136 int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a);
137
138 /* Input handling */
139 int (*vidioc_enum_input)(struct file *file, void *fh,
140 struct v4l2_input *inp);
141 int (*vidioc_g_input) (struct file *file, void *fh, unsigned int *i);
142 int (*vidioc_s_input) (struct file *file, void *fh, unsigned int i);
143
144 /* Output handling */
145 int (*vidioc_enum_output) (struct file *file, void *fh,
146 struct v4l2_output *a);
147 int (*vidioc_g_output) (struct file *file, void *fh, unsigned int *i);
148 int (*vidioc_s_output) (struct file *file, void *fh, unsigned int i);
149
150 /* Control handling */
151 int (*vidioc_queryctrl) (struct file *file, void *fh,
152 struct v4l2_queryctrl *a);
153 int (*vidioc_g_ctrl) (struct file *file, void *fh,
154 struct v4l2_control *a);
155 int (*vidioc_s_ctrl) (struct file *file, void *fh,
156 struct v4l2_control *a);
157 int (*vidioc_g_ext_ctrls) (struct file *file, void *fh,
158 struct v4l2_ext_controls *a);
159 int (*vidioc_s_ext_ctrls) (struct file *file, void *fh,
160 struct v4l2_ext_controls *a);
161 int (*vidioc_try_ext_ctrls) (struct file *file, void *fh,
162 struct v4l2_ext_controls *a);
163 int (*vidioc_querymenu) (struct file *file, void *fh,
164 struct v4l2_querymenu *a);
165
166 /* Audio ioctls */
167 int (*vidioc_enumaudio) (struct file *file, void *fh,
168 struct v4l2_audio *a);
169 int (*vidioc_g_audio) (struct file *file, void *fh,
170 struct v4l2_audio *a);
171 int (*vidioc_s_audio) (struct file *file, void *fh,
172 struct v4l2_audio *a);
173
174 /* Audio out ioctls */
175 int (*vidioc_enumaudout) (struct file *file, void *fh,
176 struct v4l2_audioout *a);
177 int (*vidioc_g_audout) (struct file *file, void *fh,
178 struct v4l2_audioout *a);
179 int (*vidioc_s_audout) (struct file *file, void *fh,
180 struct v4l2_audioout *a);
181 int (*vidioc_g_modulator) (struct file *file, void *fh,
182 struct v4l2_modulator *a);
183 int (*vidioc_s_modulator) (struct file *file, void *fh,
184 struct v4l2_modulator *a);
185 /* Crop ioctls */
186 int (*vidioc_cropcap) (struct file *file, void *fh,
187 struct v4l2_cropcap *a);
188 int (*vidioc_g_crop) (struct file *file, void *fh,
189 struct v4l2_crop *a);
190 int (*vidioc_s_crop) (struct file *file, void *fh,
191 struct v4l2_crop *a);
192 /* Compression ioctls */
193 int (*vidioc_g_jpegcomp) (struct file *file, void *fh,
194 struct v4l2_jpegcompression *a);
195 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
196 struct v4l2_jpegcompression *a);
197 int (*vidioc_g_enc_index) (struct file *file, void *fh,
198 struct v4l2_enc_idx *a);
199 int (*vidioc_encoder_cmd) (struct file *file, void *fh,
200 struct v4l2_encoder_cmd *a);
201 int (*vidioc_try_encoder_cmd) (struct file *file, void *fh,
202 struct v4l2_encoder_cmd *a);
203
204 /* Stream type-dependent parameter ioctls */
205 int (*vidioc_g_parm) (struct file *file, void *fh,
206 struct v4l2_streamparm *a);
207 int (*vidioc_s_parm) (struct file *file, void *fh,
208 struct v4l2_streamparm *a);
209
210 /* Tuner ioctls */
211 int (*vidioc_g_tuner) (struct file *file, void *fh,
212 struct v4l2_tuner *a);
213 int (*vidioc_s_tuner) (struct file *file, void *fh,
214 struct v4l2_tuner *a);
215 int (*vidioc_g_frequency) (struct file *file, void *fh,
216 struct v4l2_frequency *a);
217 int (*vidioc_s_frequency) (struct file *file, void *fh,
218 struct v4l2_frequency *a);
219
220 /* Sliced VBI cap */
221 int (*vidioc_g_sliced_vbi_cap) (struct file *file, void *fh,
222 struct v4l2_sliced_vbi_cap *a);
223
224 /* Log status ioctl */
225 int (*vidioc_log_status) (struct file *file, void *fh);
226
227 int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh,
228 struct v4l2_hw_freq_seek *a);
229
230 /* Debugging ioctls */
231#ifdef CONFIG_VIDEO_ADV_DEBUG
232 int (*vidioc_g_register) (struct file *file, void *fh,
233 struct v4l2_register *reg);
234 int (*vidioc_s_register) (struct file *file, void *fh,
235 struct v4l2_register *reg);
236#endif
237 int (*vidioc_g_chip_ident) (struct file *file, void *fh,
238 struct v4l2_chip_ident *chip);
239
240 /* For other private ioctls */
241 int (*vidioc_default) (struct file *file, void *fh,
242 int cmd, void *arg);
243};
244
245
246/* v4l debugging and diagnostics */
247
248/* Debug bitmask flags to be used on V4L2 */
249#define V4L2_DEBUG_IOCTL 0x01
250#define V4L2_DEBUG_IOCTL_ARG 0x02
251
252/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
253#define v4l_print_ioctl(name, cmd) \
254 do { \
255 printk(KERN_DEBUG "%s: ", name); \
256 v4l_printk_ioctl(cmd); \
257 } while (0)
258
259/* Use this macro in I2C drivers where 'client' is the struct i2c_client
260 pointer */
261#define v4l_i2c_print_ioctl(client, cmd) \
262 do { \
263 v4l_client_printk(KERN_DEBUG, client, ""); \
264 v4l_printk_ioctl(cmd); \
265 } while (0)
266
267/* Video standard functions */
268extern const char *v4l2_norm_to_name(v4l2_std_id id);
269extern int v4l2_video_std_construct(struct v4l2_standard *vs,
270 int id, const char *name);
271/* Prints the ioctl in a human-readable format */
272extern void v4l_printk_ioctl(unsigned int cmd);
273
274/* names for fancy debug output */
275extern const char *v4l2_field_names[];
276extern const char *v4l2_type_names[];
277
278/* Compatibility layer interface -- v4l1-compat module */
279typedef int (*v4l2_kioctl)(struct inode *inode, struct file *file,
280 unsigned int cmd, void *arg);
281#ifdef CONFIG_VIDEO_V4L1_COMPAT
282int v4l_compat_translate_ioctl(struct inode *inode, struct file *file,
283 int cmd, void *arg, v4l2_kioctl driver_ioctl);
284#else
285#define v4l_compat_translate_ioctl(inode, file, cmd, arg, ioctl) (-EINVAL)
286#endif
287
288/* 32 Bits compatibility layer for 64 bits processors */
289extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd,
290 unsigned long arg);
291
292extern int video_ioctl2(struct inode *inode, struct file *file,
293 unsigned int cmd, unsigned long arg);
294
295/* Include support for obsoleted stuff */
296extern int video_usercopy(struct inode *inode, struct file *file,
297 unsigned int cmd, unsigned long arg,
298 int (*func)(struct inode *inode, struct file *file,
299 unsigned int cmd, void *arg));
300
301#endif /* _V4L2_IOCTL_H */
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 9a51ebad3f1f..cbb59ebed4ae 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -3,254 +3,17 @@
3 * data structure and functionality definitions 3 * data structure and functionality definitions
4 */ 4 */
5 5
6#ifndef _IP_VS_H 6#ifndef _NET_IP_VS_H
7#define _IP_VS_H 7#define _NET_IP_VS_H
8
9#include <asm/types.h> /* For __uXX types */
10#include <linux/types.h> /* For __beXX types in userland */
11
12#include <linux/sysctl.h> /* For ctl_path */
13
14#define IP_VS_VERSION_CODE 0x010201
15#define NVERSION(version) \
16 (version >> 16) & 0xFF, \
17 (version >> 8) & 0xFF, \
18 version & 0xFF
19
20/*
21 * Virtual Service Flags
22 */
23#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
24#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
25
26/*
27 * Destination Server Flags
28 */
29#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
30#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
31
32/*
33 * IPVS sync daemon states
34 */
35#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
36#define IP_VS_STATE_MASTER 0x0001 /* started as master */
37#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
38
39/*
40 * IPVS socket options
41 */
42#define IP_VS_BASE_CTL (64+1024+64) /* base */
43
44#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
45#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
46#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
47#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
48#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
49#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
50#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
51#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
52#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
53#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
54#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
55#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
56#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
57#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
58#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
59#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
60#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
61
62#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
63#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
64#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
65#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
66#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
67#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
68#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
69#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
70#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
71
72
73/*
74 * IPVS Connection Flags
75 */
76#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
77#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
78#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
79#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
80#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
81#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
82#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
83#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
84#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
85#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
86#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
87#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
88#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
89#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
90#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
91
92/* Move it to better place one day, for now keep it unique */
93#define NFC_IPVS_PROPERTY 0x10000
94
95#define IP_VS_SCHEDNAME_MAXLEN 16
96#define IP_VS_IFNAME_MAXLEN 16
97
98
99/*
100 * The struct ip_vs_service_user and struct ip_vs_dest_user are
101 * used to set IPVS rules through setsockopt.
102 */
103struct ip_vs_service_user {
104 /* virtual service addresses */
105 u_int16_t protocol;
106 __be32 addr; /* virtual ip address */
107 __be16 port;
108 u_int32_t fwmark; /* firwall mark of service */
109
110 /* virtual service options */
111 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
112 unsigned flags; /* virtual service flags */
113 unsigned timeout; /* persistent timeout in sec */
114 __be32 netmask; /* persistent netmask */
115};
116
117
118struct ip_vs_dest_user {
119 /* destination server address */
120 __be32 addr;
121 __be16 port;
122
123 /* real server options */
124 unsigned conn_flags; /* connection flags */
125 int weight; /* destination weight */
126
127 /* thresholds for active connections */
128 u_int32_t u_threshold; /* upper threshold */
129 u_int32_t l_threshold; /* lower threshold */
130};
131
132
133/*
134 * IPVS statistics object (for user space)
135 */
136struct ip_vs_stats_user
137{
138 __u32 conns; /* connections scheduled */
139 __u32 inpkts; /* incoming packets */
140 __u32 outpkts; /* outgoing packets */
141 __u64 inbytes; /* incoming bytes */
142 __u64 outbytes; /* outgoing bytes */
143
144 __u32 cps; /* current connection rate */
145 __u32 inpps; /* current in packet rate */
146 __u32 outpps; /* current out packet rate */
147 __u32 inbps; /* current in byte rate */
148 __u32 outbps; /* current out byte rate */
149};
150
151
152/* The argument to IP_VS_SO_GET_INFO */
153struct ip_vs_getinfo {
154 /* version number */
155 unsigned int version;
156
157 /* size of connection hash table */
158 unsigned int size;
159
160 /* number of virtual services */
161 unsigned int num_services;
162};
163
164
165/* The argument to IP_VS_SO_GET_SERVICE */
166struct ip_vs_service_entry {
167 /* which service: user fills in these */
168 u_int16_t protocol;
169 __be32 addr; /* virtual address */
170 __be16 port;
171 u_int32_t fwmark; /* firwall mark of service */
172
173 /* service options */
174 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
175 unsigned flags; /* virtual service flags */
176 unsigned timeout; /* persistent timeout */
177 __be32 netmask; /* persistent netmask */
178
179 /* number of real servers */
180 unsigned int num_dests;
181
182 /* statistics */
183 struct ip_vs_stats_user stats;
184};
185
186
187struct ip_vs_dest_entry {
188 __be32 addr; /* destination address */
189 __be16 port;
190 unsigned conn_flags; /* connection flags */
191 int weight; /* destination weight */
192
193 u_int32_t u_threshold; /* upper threshold */
194 u_int32_t l_threshold; /* lower threshold */
195
196 u_int32_t activeconns; /* active connections */
197 u_int32_t inactconns; /* inactive connections */
198 u_int32_t persistconns; /* persistent connections */
199
200 /* statistics */
201 struct ip_vs_stats_user stats;
202};
203
204
205/* The argument to IP_VS_SO_GET_DESTS */
206struct ip_vs_get_dests {
207 /* which service: user fills in these */
208 u_int16_t protocol;
209 __be32 addr; /* virtual address */
210 __be16 port;
211 u_int32_t fwmark; /* firwall mark of service */
212
213 /* number of real servers */
214 unsigned int num_dests;
215
216 /* the real servers */
217 struct ip_vs_dest_entry entrytable[0];
218};
219
220
221/* The argument to IP_VS_SO_GET_SERVICES */
222struct ip_vs_get_services {
223 /* number of virtual services */
224 unsigned int num_services;
225
226 /* service table */
227 struct ip_vs_service_entry entrytable[0];
228};
229
230
231/* The argument to IP_VS_SO_GET_TIMEOUT */
232struct ip_vs_timeout_user {
233 int tcp_timeout;
234 int tcp_fin_timeout;
235 int udp_timeout;
236};
237
238
239/* The argument to IP_VS_SO_GET_DAEMON */
240struct ip_vs_daemon_user {
241 /* sync daemon state (master/backup) */
242 int state;
243
244 /* multicast interface name */
245 char mcast_ifn[IP_VS_IFNAME_MAXLEN];
246
247 /* SyncID we belong to */
248 int syncid;
249};
250 8
9#include <linux/ip_vs.h> /* definitions shared with userland */
251 10
11/* old ipvsadm versions still include this file directly */
252#ifdef __KERNEL__ 12#ifdef __KERNEL__
253 13
14#include <asm/types.h> /* for __uXX types */
15
16#include <linux/sysctl.h> /* for ctl_path */
254#include <linux/list.h> /* for struct list_head */ 17#include <linux/list.h> /* for struct list_head */
255#include <linux/spinlock.h> /* for struct rwlock_t */ 18#include <linux/spinlock.h> /* for struct rwlock_t */
256#include <asm/atomic.h> /* for struct atomic_t */ 19#include <asm/atomic.h> /* for struct atomic_t */
@@ -981,4 +744,4 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
981 744
982#endif /* __KERNEL__ */ 745#endif /* __KERNEL__ */
983 746
984#endif /* _IP_VS_H */ 747#endif /* _NET_IP_VS_H */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 4dd3d93e1960..b52721008be8 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -206,8 +206,6 @@ struct ieee80211_bss_conf {
206 * These flags are used with the @flags member of &ieee80211_tx_info. 206 * These flags are used with the @flags member of &ieee80211_tx_info.
207 * 207 *
208 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame. 208 * @IEEE80211_TX_CTL_REQ_TX_STATUS: request TX status callback for this frame.
209 * @IEEE80211_TX_CTL_DO_NOT_ENCRYPT: send this frame without encryption;
210 * e.g., for EAPOL frame
211 * @IEEE80211_TX_CTL_USE_RTS_CTS: use RTS-CTS before sending frame 209 * @IEEE80211_TX_CTL_USE_RTS_CTS: use RTS-CTS before sending frame
212 * @IEEE80211_TX_CTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g., 210 * @IEEE80211_TX_CTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g.,
213 * for combined 802.11g / 802.11b networks) 211 * for combined 802.11g / 802.11b networks)
@@ -220,7 +218,6 @@ struct ieee80211_bss_conf {
220 * @IEEE80211_TX_CTL_SHORT_PREAMBLE: TBD 218 * @IEEE80211_TX_CTL_SHORT_PREAMBLE: TBD
221 * @IEEE80211_TX_CTL_LONG_RETRY_LIMIT: this frame should be send using the 219 * @IEEE80211_TX_CTL_LONG_RETRY_LIMIT: this frame should be send using the
222 * through set_retry_limit configured long retry value 220 * through set_retry_limit configured long retry value
223 * @IEEE80211_TX_CTL_EAPOL_FRAME: internal to mac80211
224 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon 221 * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
225 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU 222 * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
226 * @IEEE80211_TX_CTL_OFDM_HT: this frame can be sent in HT OFDM rates. number 223 * @IEEE80211_TX_CTL_OFDM_HT: this frame can be sent in HT OFDM rates. number
@@ -253,7 +250,6 @@ struct ieee80211_bss_conf {
253 */ 250 */
254enum mac80211_tx_control_flags { 251enum mac80211_tx_control_flags {
255 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 252 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
256 IEEE80211_TX_CTL_DO_NOT_ENCRYPT = BIT(1),
257 IEEE80211_TX_CTL_USE_RTS_CTS = BIT(2), 253 IEEE80211_TX_CTL_USE_RTS_CTS = BIT(2),
258 IEEE80211_TX_CTL_USE_CTS_PROTECT = BIT(3), 254 IEEE80211_TX_CTL_USE_CTS_PROTECT = BIT(3),
259 IEEE80211_TX_CTL_NO_ACK = BIT(4), 255 IEEE80211_TX_CTL_NO_ACK = BIT(4),
@@ -263,7 +259,6 @@ enum mac80211_tx_control_flags {
263 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(8), 259 IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(8),
264 IEEE80211_TX_CTL_SHORT_PREAMBLE = BIT(9), 260 IEEE80211_TX_CTL_SHORT_PREAMBLE = BIT(9),
265 IEEE80211_TX_CTL_LONG_RETRY_LIMIT = BIT(10), 261 IEEE80211_TX_CTL_LONG_RETRY_LIMIT = BIT(10),
266 IEEE80211_TX_CTL_EAPOL_FRAME = BIT(11),
267 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(12), 262 IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(12),
268 IEEE80211_TX_CTL_AMPDU = BIT(13), 263 IEEE80211_TX_CTL_AMPDU = BIT(13),
269 IEEE80211_TX_CTL_OFDM_HT = BIT(14), 264 IEEE80211_TX_CTL_OFDM_HT = BIT(14),
@@ -323,7 +318,6 @@ struct ieee80211_tx_info {
323 struct ieee80211_vif *vif; 318 struct ieee80211_vif *vif;
324 struct ieee80211_key_conf *hw_key; 319 struct ieee80211_key_conf *hw_key;
325 unsigned long jiffies; 320 unsigned long jiffies;
326 int ifindex;
327 u16 aid; 321 u16 aid;
328 s8 rts_cts_rate_idx, alt_retry_rate_idx; 322 s8 rts_cts_rate_idx, alt_retry_rate_idx;
329 u8 retry_limit; 323 u8 retry_limit;
@@ -746,7 +740,6 @@ enum ieee80211_tkip_key_type {
746 * Measurement, Channel Switch, Quieting, TPC 740 * Measurement, Channel Switch, Quieting, TPC
747 */ 741 */
748enum ieee80211_hw_flags { 742enum ieee80211_hw_flags {
749 IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE = 1<<0,
750 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 743 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
751 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, 744 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2,
752 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, 745 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3,
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 3030fdc6981d..c1b26fcc0b5c 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -202,6 +202,9 @@ struct snd_soc_dapm_path;
202struct snd_soc_dapm_pin; 202struct snd_soc_dapm_pin;
203struct snd_soc_dapm_route; 203struct snd_soc_dapm_route;
204 204
205int dapm_reg_event(struct snd_soc_dapm_widget *w,
206 struct snd_kcontrol *kcontrol, int event);
207
205/* dapm controls */ 208/* dapm controls */
206int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, 209int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
207 struct snd_ctl_elem_value *ucontrol); 210 struct snd_ctl_elem_value *ucontrol);
diff --git a/init/Kconfig b/init/Kconfig
index 43d6989c275f..7e6dae1ae727 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -522,7 +522,7 @@ config CC_OPTIMIZE_FOR_SIZE
522 Enabling this option will pass "-Os" instead of "-O2" to gcc 522 Enabling this option will pass "-Os" instead of "-O2" to gcc
523 resulting in a smaller kernel. 523 resulting in a smaller kernel.
524 524
525 If unsure, say N. 525 If unsure, say Y.
526 526
527config SYSCTL 527config SYSCTL
528 bool 528 bool
@@ -802,6 +802,10 @@ config PROC_PAGE_MONITOR
802 802
803endmenu # General setup 803endmenu # General setup
804 804
805config HAVE_GENERIC_DMA_COHERENT
806 bool
807 default n
808
805config SLABINFO 809config SLABINFO
806 bool 810 bool
807 depends on PROC_FS 811 depends on PROC_FS
diff --git a/init/calibrate.c b/init/calibrate.c
index 7963e3fc51d9..a379c9061199 100644
--- a/init/calibrate.c
+++ b/init/calibrate.c
@@ -170,7 +170,7 @@ void __cpuinit calibrate_delay(void)
170 loops_per_jiffy &= ~loopbit; 170 loops_per_jiffy &= ~loopbit;
171 } 171 }
172 } 172 }
173 printk(KERN_INFO "%lu.%02lu BogoMIPS (lpj=%lu)\n", 173 printk(KERN_CONT "%lu.%02lu BogoMIPS (lpj=%lu)\n",
174 loops_per_jiffy/(500000/HZ), 174 loops_per_jiffy/(500000/HZ),
175 (loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy); 175 (loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy);
176} 176}
diff --git a/init/main.c b/init/main.c
index 20fdc9884b77..9c3b68b86ca0 100644
--- a/init/main.c
+++ b/init/main.c
@@ -635,10 +635,11 @@ asmlinkage void __init start_kernel(void)
635 635
636#ifdef CONFIG_BLK_DEV_INITRD 636#ifdef CONFIG_BLK_DEV_INITRD
637 if (initrd_start && !initrd_below_start_ok && 637 if (initrd_start && !initrd_below_start_ok &&
638 page_to_pfn(virt_to_page(initrd_start)) < min_low_pfn) { 638 page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) {
639 printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " 639 printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "
640 "disabling it.\n", 640 "disabling it.\n",
641 page_to_pfn(virt_to_page(initrd_start)), min_low_pfn); 641 page_to_pfn(virt_to_page((void *)initrd_start)),
642 min_low_pfn);
642 initrd_start = 0; 643 initrd_start = 0;
643 } 644 }
644#endif 645#endif
diff --git a/kernel/Makefile b/kernel/Makefile
index 54f69837d35a..4e1d7df7c3e2 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -84,6 +84,7 @@ obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
84obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o 84obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
85obj-$(CONFIG_MARKERS) += marker.o 85obj-$(CONFIG_MARKERS) += marker.o
86obj-$(CONFIG_LATENCYTOP) += latencytop.o 86obj-$(CONFIG_LATENCYTOP) += latencytop.o
87obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
87obj-$(CONFIG_FTRACE) += trace/ 88obj-$(CONFIG_FTRACE) += trace/
88obj-$(CONFIG_TRACING) += trace/ 89obj-$(CONFIG_TRACING) += trace/
89obj-$(CONFIG_SMP) += sched_cpupri.o 90obj-$(CONFIG_SMP) += sched_cpupri.o
diff --git a/kernel/audit.c b/kernel/audit.c
index e092f1c0ce30..4414e93d8750 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -707,12 +707,14 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
707 if (status_get->mask & AUDIT_STATUS_ENABLED) { 707 if (status_get->mask & AUDIT_STATUS_ENABLED) {
708 err = audit_set_enabled(status_get->enabled, 708 err = audit_set_enabled(status_get->enabled,
709 loginuid, sessionid, sid); 709 loginuid, sessionid, sid);
710 if (err < 0) return err; 710 if (err < 0)
711 return err;
711 } 712 }
712 if (status_get->mask & AUDIT_STATUS_FAILURE) { 713 if (status_get->mask & AUDIT_STATUS_FAILURE) {
713 err = audit_set_failure(status_get->failure, 714 err = audit_set_failure(status_get->failure,
714 loginuid, sessionid, sid); 715 loginuid, sessionid, sid);
715 if (err < 0) return err; 716 if (err < 0)
717 return err;
716 } 718 }
717 if (status_get->mask & AUDIT_STATUS_PID) { 719 if (status_get->mask & AUDIT_STATUS_PID) {
718 int new_pid = status_get->pid; 720 int new_pid = status_get->pid;
@@ -725,9 +727,12 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
725 audit_pid = new_pid; 727 audit_pid = new_pid;
726 audit_nlk_pid = NETLINK_CB(skb).pid; 728 audit_nlk_pid = NETLINK_CB(skb).pid;
727 } 729 }
728 if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) 730 if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) {
729 err = audit_set_rate_limit(status_get->rate_limit, 731 err = audit_set_rate_limit(status_get->rate_limit,
730 loginuid, sessionid, sid); 732 loginuid, sessionid, sid);
733 if (err < 0)
734 return err;
735 }
731 if (status_get->mask & AUDIT_STATUS_BACKLOG_LIMIT) 736 if (status_get->mask & AUDIT_STATUS_BACKLOG_LIMIT)
732 err = audit_set_backlog_limit(status_get->backlog_limit, 737 err = audit_set_backlog_limit(status_get->backlog_limit,
733 loginuid, sessionid, sid); 738 loginuid, sessionid, sid);
@@ -1366,7 +1371,7 @@ int audit_string_contains_control(const char *string, size_t len)
1366{ 1371{
1367 const unsigned char *p; 1372 const unsigned char *p;
1368 for (p = string; p < (const unsigned char *)string + len && *p; p++) { 1373 for (p = string; p < (const unsigned char *)string + len && *p; p++) {
1369 if (*p == '"' || *p < 0x21 || *p > 0x7f) 1374 if (*p == '"' || *p < 0x21 || *p > 0x7e)
1370 return 1; 1375 return 1;
1371 } 1376 }
1372 return 0; 1377 return 0;
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 98c50cc671bb..b7d354e2b0ef 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -1022,8 +1022,11 @@ static void audit_update_watch(struct audit_parent *parent,
1022 struct audit_buffer *ab; 1022 struct audit_buffer *ab;
1023 ab = audit_log_start(NULL, GFP_KERNEL, 1023 ab = audit_log_start(NULL, GFP_KERNEL,
1024 AUDIT_CONFIG_CHANGE); 1024 AUDIT_CONFIG_CHANGE);
1025 audit_log_format(ab, "auid=%u ses=%u",
1026 audit_get_loginuid(current),
1027 audit_get_sessionid(current));
1025 audit_log_format(ab, 1028 audit_log_format(ab,
1026 "op=updated rules specifying path="); 1029 " op=updated rules specifying path=");
1027 audit_log_untrustedstring(ab, owatch->path); 1030 audit_log_untrustedstring(ab, owatch->path);
1028 audit_log_format(ab, " with dev=%u ino=%lu\n", 1031 audit_log_format(ab, " with dev=%u ino=%lu\n",
1029 dev, ino); 1032 dev, ino);
@@ -1058,7 +1061,10 @@ static void audit_remove_parent_watches(struct audit_parent *parent)
1058 struct audit_buffer *ab; 1061 struct audit_buffer *ab;
1059 ab = audit_log_start(NULL, GFP_KERNEL, 1062 ab = audit_log_start(NULL, GFP_KERNEL,
1060 AUDIT_CONFIG_CHANGE); 1063 AUDIT_CONFIG_CHANGE);
1061 audit_log_format(ab, "op=remove rule path="); 1064 audit_log_format(ab, "auid=%u ses=%u",
1065 audit_get_loginuid(current),
1066 audit_get_sessionid(current));
1067 audit_log_format(ab, " op=remove rule path=");
1062 audit_log_untrustedstring(ab, w->path); 1068 audit_log_untrustedstring(ab, w->path);
1063 if (r->filterkey) { 1069 if (r->filterkey) {
1064 audit_log_format(ab, " key="); 1070 audit_log_format(ab, " key=");
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 4699950e65bd..496c3dd37276 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -610,7 +610,7 @@ static int audit_filter_rules(struct task_struct *tsk,
610 if (!result) 610 if (!result)
611 return 0; 611 return 0;
612 } 612 }
613 if (rule->filterkey) 613 if (rule->filterkey && ctx)
614 ctx->filterkey = kstrdup(rule->filterkey, GFP_ATOMIC); 614 ctx->filterkey = kstrdup(rule->filterkey, GFP_ATOMIC);
615 switch (rule->action) { 615 switch (rule->action) {
616 case AUDIT_NEVER: *state = AUDIT_DISABLED; break; 616 case AUDIT_NEVER: *state = AUDIT_DISABLED; break;
@@ -2375,7 +2375,7 @@ int __audit_signal_info(int sig, struct task_struct *t)
2375 struct audit_context *ctx = tsk->audit_context; 2375 struct audit_context *ctx = tsk->audit_context;
2376 2376
2377 if (audit_pid && t->tgid == audit_pid) { 2377 if (audit_pid && t->tgid == audit_pid) {
2378 if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1) { 2378 if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1 || sig == SIGUSR2) {
2379 audit_sig_pid = tsk->pid; 2379 audit_sig_pid = tsk->pid;
2380 if (tsk->loginuid != -1) 2380 if (tsk->loginuid != -1)
2381 audit_sig_uid = tsk->loginuid; 2381 audit_sig_uid = tsk->loginuid;
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 657f8f8d93a5..13932abde159 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -355,6 +355,17 @@ static struct css_set *find_existing_css_set(
355 return NULL; 355 return NULL;
356} 356}
357 357
358static void free_cg_links(struct list_head *tmp)
359{
360 struct cg_cgroup_link *link;
361 struct cg_cgroup_link *saved_link;
362
363 list_for_each_entry_safe(link, saved_link, tmp, cgrp_link_list) {
364 list_del(&link->cgrp_link_list);
365 kfree(link);
366 }
367}
368
358/* 369/*
359 * allocate_cg_links() allocates "count" cg_cgroup_link structures 370 * allocate_cg_links() allocates "count" cg_cgroup_link structures
360 * and chains them on tmp through their cgrp_link_list fields. Returns 0 on 371 * and chains them on tmp through their cgrp_link_list fields. Returns 0 on
@@ -363,17 +374,12 @@ static struct css_set *find_existing_css_set(
363static int allocate_cg_links(int count, struct list_head *tmp) 374static int allocate_cg_links(int count, struct list_head *tmp)
364{ 375{
365 struct cg_cgroup_link *link; 376 struct cg_cgroup_link *link;
366 struct cg_cgroup_link *saved_link;
367 int i; 377 int i;
368 INIT_LIST_HEAD(tmp); 378 INIT_LIST_HEAD(tmp);
369 for (i = 0; i < count; i++) { 379 for (i = 0; i < count; i++) {
370 link = kmalloc(sizeof(*link), GFP_KERNEL); 380 link = kmalloc(sizeof(*link), GFP_KERNEL);
371 if (!link) { 381 if (!link) {
372 list_for_each_entry_safe(link, saved_link, tmp, 382 free_cg_links(tmp);
373 cgrp_link_list) {
374 list_del(&link->cgrp_link_list);
375 kfree(link);
376 }
377 return -ENOMEM; 383 return -ENOMEM;
378 } 384 }
379 list_add(&link->cgrp_link_list, tmp); 385 list_add(&link->cgrp_link_list, tmp);
@@ -381,17 +387,6 @@ static int allocate_cg_links(int count, struct list_head *tmp)
381 return 0; 387 return 0;
382} 388}
383 389
384static void free_cg_links(struct list_head *tmp)
385{
386 struct cg_cgroup_link *link;
387 struct cg_cgroup_link *saved_link;
388
389 list_for_each_entry_safe(link, saved_link, tmp, cgrp_link_list) {
390 list_del(&link->cgrp_link_list);
391 kfree(link);
392 }
393}
394
395/* 390/*
396 * find_css_set() takes an existing cgroup group and a 391 * find_css_set() takes an existing cgroup group and a
397 * cgroup object, and returns a css_set object that's 392 * cgroup object, and returns a css_set object that's
@@ -956,7 +951,6 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
956 struct super_block *sb; 951 struct super_block *sb;
957 struct cgroupfs_root *root; 952 struct cgroupfs_root *root;
958 struct list_head tmp_cg_links; 953 struct list_head tmp_cg_links;
959 INIT_LIST_HEAD(&tmp_cg_links);
960 954
961 /* First find the desired set of subsystems */ 955 /* First find the desired set of subsystems */
962 ret = parse_cgroupfs_options(data, &opts); 956 ret = parse_cgroupfs_options(data, &opts);
@@ -1424,14 +1418,17 @@ static ssize_t cgroup_write_string(struct cgroup *cgrp, struct cftype *cft,
1424 if (buffer == NULL) 1418 if (buffer == NULL)
1425 return -ENOMEM; 1419 return -ENOMEM;
1426 } 1420 }
1427 if (nbytes && copy_from_user(buffer, userbuf, nbytes)) 1421 if (nbytes && copy_from_user(buffer, userbuf, nbytes)) {
1428 return -EFAULT; 1422 retval = -EFAULT;
1423 goto out;
1424 }
1429 1425
1430 buffer[nbytes] = 0; /* nul-terminate */ 1426 buffer[nbytes] = 0; /* nul-terminate */
1431 strstrip(buffer); 1427 strstrip(buffer);
1432 retval = cft->write_string(cgrp, cft, buffer); 1428 retval = cft->write_string(cgrp, cft, buffer);
1433 if (!retval) 1429 if (!retval)
1434 retval = nbytes; 1430 retval = nbytes;
1431out:
1435 if (buffer != local_buffer) 1432 if (buffer != local_buffer)
1436 kfree(buffer); 1433 kfree(buffer);
1437 return retval; 1434 return retval;
@@ -2371,7 +2368,7 @@ static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2371 return cgroup_create(c_parent, dentry, mode | S_IFDIR); 2368 return cgroup_create(c_parent, dentry, mode | S_IFDIR);
2372} 2369}
2373 2370
2374static inline int cgroup_has_css_refs(struct cgroup *cgrp) 2371static int cgroup_has_css_refs(struct cgroup *cgrp)
2375{ 2372{
2376 /* Check the reference count on each subsystem. Since we 2373 /* Check the reference count on each subsystem. Since we
2377 * already established that there are no tasks in the 2374 * already established that there are no tasks in the
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 10ba5f1004a5..e202a68d1cc1 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -216,7 +216,6 @@ static int __ref take_cpu_down(void *_param)
216static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) 216static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
217{ 217{
218 int err, nr_calls = 0; 218 int err, nr_calls = 0;
219 struct task_struct *p;
220 cpumask_t old_allowed, tmp; 219 cpumask_t old_allowed, tmp;
221 void *hcpu = (void *)(long)cpu; 220 void *hcpu = (void *)(long)cpu;
222 unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0; 221 unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0;
@@ -249,21 +248,18 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
249 cpus_setall(tmp); 248 cpus_setall(tmp);
250 cpu_clear(cpu, tmp); 249 cpu_clear(cpu, tmp);
251 set_cpus_allowed_ptr(current, &tmp); 250 set_cpus_allowed_ptr(current, &tmp);
251 tmp = cpumask_of_cpu(cpu);
252 252
253 p = __stop_machine_run(take_cpu_down, &tcd_param, cpu); 253 err = __stop_machine(take_cpu_down, &tcd_param, &tmp);
254 254 if (err) {
255 if (IS_ERR(p) || cpu_online(cpu)) {
256 /* CPU didn't die: tell everyone. Can't complain. */ 255 /* CPU didn't die: tell everyone. Can't complain. */
257 if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod, 256 if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,
258 hcpu) == NOTIFY_BAD) 257 hcpu) == NOTIFY_BAD)
259 BUG(); 258 BUG();
260 259
261 if (IS_ERR(p)) { 260 goto out_allowed;
262 err = PTR_ERR(p);
263 goto out_allowed;
264 }
265 goto out_thread;
266 } 261 }
262 BUG_ON(cpu_online(cpu));
267 263
268 /* Wait for it to sleep (leaving idle task). */ 264 /* Wait for it to sleep (leaving idle task). */
269 while (!idle_cpu(cpu)) 265 while (!idle_cpu(cpu))
@@ -279,8 +275,6 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
279 275
280 check_for_tasks(cpu); 276 check_for_tasks(cpu);
281 277
282out_thread:
283 err = kthread_stop(p);
284out_allowed: 278out_allowed:
285 set_cpus_allowed_ptr(current, &old_allowed); 279 set_cpus_allowed_ptr(current, &old_allowed);
286out_release: 280out_release:
@@ -461,3 +455,28 @@ out:
461#endif /* CONFIG_PM_SLEEP_SMP */ 455#endif /* CONFIG_PM_SLEEP_SMP */
462 456
463#endif /* CONFIG_SMP */ 457#endif /* CONFIG_SMP */
458
459/*
460 * cpu_bit_bitmap[] is a special, "compressed" data structure that
461 * represents all NR_CPUS bits binary values of 1<<nr.
462 *
463 * It is used by cpumask_of_cpu() to get a constant address to a CPU
464 * mask value that has a single bit set only.
465 */
466
467/* cpu_bit_bitmap[0] is empty - so we can back into it */
468#define MASK_DECLARE_1(x) [x+1][0] = 1UL << (x)
469#define MASK_DECLARE_2(x) MASK_DECLARE_1(x), MASK_DECLARE_1(x+1)
470#define MASK_DECLARE_4(x) MASK_DECLARE_2(x), MASK_DECLARE_2(x+2)
471#define MASK_DECLARE_8(x) MASK_DECLARE_4(x), MASK_DECLARE_4(x+4)
472
473const unsigned long cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)] = {
474
475 MASK_DECLARE_8(0), MASK_DECLARE_8(8),
476 MASK_DECLARE_8(16), MASK_DECLARE_8(24),
477#if BITS_PER_LONG > 32
478 MASK_DECLARE_8(32), MASK_DECLARE_8(40),
479 MASK_DECLARE_8(48), MASK_DECLARE_8(56),
480#endif
481};
482EXPORT_SYMBOL_GPL(cpu_bit_bitmap);
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 91cf85b36dd5..d5ab79cf516d 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -54,7 +54,6 @@
54#include <asm/uaccess.h> 54#include <asm/uaccess.h>
55#include <asm/atomic.h> 55#include <asm/atomic.h>
56#include <linux/mutex.h> 56#include <linux/mutex.h>
57#include <linux/kfifo.h>
58#include <linux/workqueue.h> 57#include <linux/workqueue.h>
59#include <linux/cgroup.h> 58#include <linux/cgroup.h>
60 59
@@ -486,13 +485,38 @@ static int cpusets_overlap(struct cpuset *a, struct cpuset *b)
486static void 485static void
487update_domain_attr(struct sched_domain_attr *dattr, struct cpuset *c) 486update_domain_attr(struct sched_domain_attr *dattr, struct cpuset *c)
488{ 487{
489 if (!dattr)
490 return;
491 if (dattr->relax_domain_level < c->relax_domain_level) 488 if (dattr->relax_domain_level < c->relax_domain_level)
492 dattr->relax_domain_level = c->relax_domain_level; 489 dattr->relax_domain_level = c->relax_domain_level;
493 return; 490 return;
494} 491}
495 492
493static void
494update_domain_attr_tree(struct sched_domain_attr *dattr, struct cpuset *c)
495{
496 LIST_HEAD(q);
497
498 list_add(&c->stack_list, &q);
499 while (!list_empty(&q)) {
500 struct cpuset *cp;
501 struct cgroup *cont;
502 struct cpuset *child;
503
504 cp = list_first_entry(&q, struct cpuset, stack_list);
505 list_del(q.next);
506
507 if (cpus_empty(cp->cpus_allowed))
508 continue;
509
510 if (is_sched_load_balance(cp))
511 update_domain_attr(dattr, cp);
512
513 list_for_each_entry(cont, &cp->css.cgroup->children, sibling) {
514 child = cgroup_cs(cont);
515 list_add_tail(&child->stack_list, &q);
516 }
517 }
518}
519
496/* 520/*
497 * rebuild_sched_domains() 521 * rebuild_sched_domains()
498 * 522 *
@@ -532,7 +556,7 @@ update_domain_attr(struct sched_domain_attr *dattr, struct cpuset *c)
532 * So the reverse nesting would risk an ABBA deadlock. 556 * So the reverse nesting would risk an ABBA deadlock.
533 * 557 *
534 * The three key local variables below are: 558 * The three key local variables below are:
535 * q - a kfifo queue of cpuset pointers, used to implement a 559 * q - a linked-list queue of cpuset pointers, used to implement a
536 * top-down scan of all cpusets. This scan loads a pointer 560 * top-down scan of all cpusets. This scan loads a pointer
537 * to each cpuset marked is_sched_load_balance into the 561 * to each cpuset marked is_sched_load_balance into the
538 * array 'csa'. For our purposes, rebuilding the schedulers 562 * array 'csa'. For our purposes, rebuilding the schedulers
@@ -567,7 +591,7 @@ update_domain_attr(struct sched_domain_attr *dattr, struct cpuset *c)
567 591
568void rebuild_sched_domains(void) 592void rebuild_sched_domains(void)
569{ 593{
570 struct kfifo *q; /* queue of cpusets to be scanned */ 594 LIST_HEAD(q); /* queue of cpusets to be scanned*/
571 struct cpuset *cp; /* scans q */ 595 struct cpuset *cp; /* scans q */
572 struct cpuset **csa; /* array of all cpuset ptrs */ 596 struct cpuset **csa; /* array of all cpuset ptrs */
573 int csn; /* how many cpuset ptrs in csa so far */ 597 int csn; /* how many cpuset ptrs in csa so far */
@@ -577,7 +601,6 @@ void rebuild_sched_domains(void)
577 int ndoms; /* number of sched domains in result */ 601 int ndoms; /* number of sched domains in result */
578 int nslot; /* next empty doms[] cpumask_t slot */ 602 int nslot; /* next empty doms[] cpumask_t slot */
579 603
580 q = NULL;
581 csa = NULL; 604 csa = NULL;
582 doms = NULL; 605 doms = NULL;
583 dattr = NULL; 606 dattr = NULL;
@@ -591,35 +614,42 @@ void rebuild_sched_domains(void)
591 dattr = kmalloc(sizeof(struct sched_domain_attr), GFP_KERNEL); 614 dattr = kmalloc(sizeof(struct sched_domain_attr), GFP_KERNEL);
592 if (dattr) { 615 if (dattr) {
593 *dattr = SD_ATTR_INIT; 616 *dattr = SD_ATTR_INIT;
594 update_domain_attr(dattr, &top_cpuset); 617 update_domain_attr_tree(dattr, &top_cpuset);
595 } 618 }
596 *doms = top_cpuset.cpus_allowed; 619 *doms = top_cpuset.cpus_allowed;
597 goto rebuild; 620 goto rebuild;
598 } 621 }
599 622
600 q = kfifo_alloc(number_of_cpusets * sizeof(cp), GFP_KERNEL, NULL);
601 if (IS_ERR(q))
602 goto done;
603 csa = kmalloc(number_of_cpusets * sizeof(cp), GFP_KERNEL); 623 csa = kmalloc(number_of_cpusets * sizeof(cp), GFP_KERNEL);
604 if (!csa) 624 if (!csa)
605 goto done; 625 goto done;
606 csn = 0; 626 csn = 0;
607 627
608 cp = &top_cpuset; 628 list_add(&top_cpuset.stack_list, &q);
609 __kfifo_put(q, (void *)&cp, sizeof(cp)); 629 while (!list_empty(&q)) {
610 while (__kfifo_get(q, (void *)&cp, sizeof(cp))) {
611 struct cgroup *cont; 630 struct cgroup *cont;
612 struct cpuset *child; /* scans child cpusets of cp */ 631 struct cpuset *child; /* scans child cpusets of cp */
613 632
633 cp = list_first_entry(&q, struct cpuset, stack_list);
634 list_del(q.next);
635
614 if (cpus_empty(cp->cpus_allowed)) 636 if (cpus_empty(cp->cpus_allowed))
615 continue; 637 continue;
616 638
617 if (is_sched_load_balance(cp)) 639 /*
640 * All child cpusets contain a subset of the parent's cpus, so
641 * just skip them, and then we call update_domain_attr_tree()
642 * to calc relax_domain_level of the corresponding sched
643 * domain.
644 */
645 if (is_sched_load_balance(cp)) {
618 csa[csn++] = cp; 646 csa[csn++] = cp;
647 continue;
648 }
619 649
620 list_for_each_entry(cont, &cp->css.cgroup->children, sibling) { 650 list_for_each_entry(cont, &cp->css.cgroup->children, sibling) {
621 child = cgroup_cs(cont); 651 child = cgroup_cs(cont);
622 __kfifo_put(q, (void *)&child, sizeof(cp)); 652 list_add_tail(&child->stack_list, &q);
623 } 653 }
624 } 654 }
625 655
@@ -686,7 +716,7 @@ restart:
686 cpus_or(*dp, *dp, b->cpus_allowed); 716 cpus_or(*dp, *dp, b->cpus_allowed);
687 b->pn = -1; 717 b->pn = -1;
688 if (dattr) 718 if (dattr)
689 update_domain_attr(dattr 719 update_domain_attr_tree(dattr
690 + nslot, b); 720 + nslot, b);
691 } 721 }
692 } 722 }
@@ -702,8 +732,6 @@ rebuild:
702 put_online_cpus(); 732 put_online_cpus();
703 733
704done: 734done:
705 if (q && !IS_ERR(q))
706 kfifo_free(q);
707 kfree(csa); 735 kfree(csa);
708 /* Don't kfree(doms) -- partition_sched_domains() does that. */ 736 /* Don't kfree(doms) -- partition_sched_domains() does that. */
709 /* Don't kfree(dattr) -- partition_sched_domains() does that. */ 737 /* Don't kfree(dattr) -- partition_sched_domains() does that. */
@@ -1833,24 +1861,21 @@ static void remove_tasks_in_empty_cpuset(struct cpuset *cs)
1833 */ 1861 */
1834static void scan_for_empty_cpusets(const struct cpuset *root) 1862static void scan_for_empty_cpusets(const struct cpuset *root)
1835{ 1863{
1864 LIST_HEAD(queue);
1836 struct cpuset *cp; /* scans cpusets being updated */ 1865 struct cpuset *cp; /* scans cpusets being updated */
1837 struct cpuset *child; /* scans child cpusets of cp */ 1866 struct cpuset *child; /* scans child cpusets of cp */
1838 struct list_head queue;
1839 struct cgroup *cont; 1867 struct cgroup *cont;
1840 nodemask_t oldmems; 1868 nodemask_t oldmems;
1841 1869
1842 INIT_LIST_HEAD(&queue);
1843
1844 list_add_tail((struct list_head *)&root->stack_list, &queue); 1870 list_add_tail((struct list_head *)&root->stack_list, &queue);
1845 1871
1846 while (!list_empty(&queue)) { 1872 while (!list_empty(&queue)) {
1847 cp = container_of(queue.next, struct cpuset, stack_list); 1873 cp = list_first_entry(&queue, struct cpuset, stack_list);
1848 list_del(queue.next); 1874 list_del(queue.next);
1849 list_for_each_entry(cont, &cp->css.cgroup->children, sibling) { 1875 list_for_each_entry(cont, &cp->css.cgroup->children, sibling) {
1850 child = cgroup_cs(cont); 1876 child = cgroup_cs(cont);
1851 list_add_tail(&child->stack_list, &queue); 1877 list_add_tail(&child->stack_list, &queue);
1852 } 1878 }
1853 cont = cp->css.cgroup;
1854 1879
1855 /* Continue past cpusets with all cpus, mems online */ 1880 /* Continue past cpusets with all cpus, mems online */
1856 if (cpus_subset(cp->cpus_allowed, cpu_online_map) && 1881 if (cpus_subset(cp->cpus_allowed, cpu_online_map) &&
diff --git a/kernel/dma-coherent.c b/kernel/dma-coherent.c
new file mode 100644
index 000000000000..7517115a8cce
--- /dev/null
+++ b/kernel/dma-coherent.c
@@ -0,0 +1,154 @@
1/*
2 * Coherent per-device memory handling.
3 * Borrowed from i386
4 */
5#include <linux/kernel.h>
6#include <linux/dma-mapping.h>
7
8struct dma_coherent_mem {
9 void *virt_base;
10 u32 device_base;
11 int size;
12 int flags;
13 unsigned long *bitmap;
14};
15
16int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
17 dma_addr_t device_addr, size_t size, int flags)
18{
19 void __iomem *mem_base = NULL;
20 int pages = size >> PAGE_SHIFT;
21 int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long);
22
23 if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0)
24 goto out;
25 if (!size)
26 goto out;
27 if (dev->dma_mem)
28 goto out;
29
30 /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */
31
32 mem_base = ioremap(bus_addr, size);
33 if (!mem_base)
34 goto out;
35
36 dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
37 if (!dev->dma_mem)
38 goto out;
39 dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
40 if (!dev->dma_mem->bitmap)
41 goto free1_out;
42
43 dev->dma_mem->virt_base = mem_base;
44 dev->dma_mem->device_base = device_addr;
45 dev->dma_mem->size = pages;
46 dev->dma_mem->flags = flags;
47
48 if (flags & DMA_MEMORY_MAP)
49 return DMA_MEMORY_MAP;
50
51 return DMA_MEMORY_IO;
52
53 free1_out:
54 kfree(dev->dma_mem);
55 out:
56 if (mem_base)
57 iounmap(mem_base);
58 return 0;
59}
60EXPORT_SYMBOL(dma_declare_coherent_memory);
61
62void dma_release_declared_memory(struct device *dev)
63{
64 struct dma_coherent_mem *mem = dev->dma_mem;
65
66 if (!mem)
67 return;
68 dev->dma_mem = NULL;
69 iounmap(mem->virt_base);
70 kfree(mem->bitmap);
71 kfree(mem);
72}
73EXPORT_SYMBOL(dma_release_declared_memory);
74
75void *dma_mark_declared_memory_occupied(struct device *dev,
76 dma_addr_t device_addr, size_t size)
77{
78 struct dma_coherent_mem *mem = dev->dma_mem;
79 int pos, err;
80 int pages = (size + (device_addr & ~PAGE_MASK) + PAGE_SIZE - 1);
81
82 pages >>= PAGE_SHIFT;
83
84 if (!mem)
85 return ERR_PTR(-EINVAL);
86
87 pos = (device_addr - mem->device_base) >> PAGE_SHIFT;
88 err = bitmap_allocate_region(mem->bitmap, pos, get_order(pages));
89 if (err != 0)
90 return ERR_PTR(err);
91 return mem->virt_base + (pos << PAGE_SHIFT);
92}
93EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
94
95/**
96 * Try to allocate memory from the per-device coherent area.
97 *
98 * @dev: device from which we allocate memory
99 * @size: size of requested memory area
100 * @dma_handle: This will be filled with the correct dma handle
101 * @ret: This pointer will be filled with the virtual address
102 * to allocated area.
103 *
104 * This function should be only called from per-arch %dma_alloc_coherent()
105 * to support allocation from per-device coherent memory pools.
106 *
107 * Returns 0 if dma_alloc_coherent should continue with allocating from
108 * generic memory areas, or !0 if dma_alloc_coherent should return %ret.
109 */
110int dma_alloc_from_coherent(struct device *dev, ssize_t size,
111 dma_addr_t *dma_handle, void **ret)
112{
113 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
114 int order = get_order(size);
115
116 if (mem) {
117 int page = bitmap_find_free_region(mem->bitmap, mem->size,
118 order);
119 if (page >= 0) {
120 *dma_handle = mem->device_base + (page << PAGE_SHIFT);
121 *ret = mem->virt_base + (page << PAGE_SHIFT);
122 memset(*ret, 0, size);
123 } else if (mem->flags & DMA_MEMORY_EXCLUSIVE)
124 *ret = NULL;
125 }
126 return (mem != NULL);
127}
128
129/**
130 * Try to free the memory allocated from per-device coherent memory pool.
131 * @dev: device from which the memory was allocated
132 * @order: the order of pages allocated
133 * @vaddr: virtual address of allocated pages
134 *
135 * This checks whether the memory was allocated from the per-device
136 * coherent memory pool and if so, releases that memory.
137 *
138 * Returns 1 if we correctly released the memory, or 0 if
139 * %dma_release_coherent() should proceed with releasing memory from
140 * generic pools.
141 */
142int dma_release_from_coherent(struct device *dev, int order, void *vaddr)
143{
144 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
145
146 if (mem && vaddr >= mem->virt_base && vaddr <
147 (mem->virt_base + (mem->size << PAGE_SHIFT))) {
148 int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
149
150 bitmap_release_region(mem->bitmap, page, order);
151 return 1;
152 }
153 return 0;
154}
diff --git a/kernel/fork.c b/kernel/fork.c
index 8214ba7c8bb1..7ce2ebe84796 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -27,6 +27,7 @@
27#include <linux/key.h> 27#include <linux/key.h>
28#include <linux/binfmts.h> 28#include <linux/binfmts.h>
29#include <linux/mman.h> 29#include <linux/mman.h>
30#include <linux/mmu_notifier.h>
30#include <linux/fs.h> 31#include <linux/fs.h>
31#include <linux/nsproxy.h> 32#include <linux/nsproxy.h>
32#include <linux/capability.h> 33#include <linux/capability.h>
@@ -414,6 +415,7 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)
414 415
415 if (likely(!mm_alloc_pgd(mm))) { 416 if (likely(!mm_alloc_pgd(mm))) {
416 mm->def_flags = 0; 417 mm->def_flags = 0;
418 mmu_notifier_mm_init(mm);
417 return mm; 419 return mm;
418 } 420 }
419 421
@@ -446,6 +448,7 @@ void __mmdrop(struct mm_struct *mm)
446 BUG_ON(mm == &init_mm); 448 BUG_ON(mm == &init_mm);
447 mm_free_pgd(mm); 449 mm_free_pgd(mm);
448 destroy_context(mm); 450 destroy_context(mm);
451 mmu_notifier_mm_destroy(mm);
449 free_mm(mm); 452 free_mm(mm);
450} 453}
451EXPORT_SYMBOL_GPL(__mmdrop); 454EXPORT_SYMBOL_GPL(__mmdrop);
diff --git a/kernel/kgdb.c b/kernel/kgdb.c
index 3ec23c3ec97f..eaa21fc9ad1d 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -56,12 +56,14 @@
56 56
57static int kgdb_break_asap; 57static int kgdb_break_asap;
58 58
59#define KGDB_MAX_THREAD_QUERY 17
59struct kgdb_state { 60struct kgdb_state {
60 int ex_vector; 61 int ex_vector;
61 int signo; 62 int signo;
62 int err_code; 63 int err_code;
63 int cpu; 64 int cpu;
64 int pass_exception; 65 int pass_exception;
66 unsigned long thr_query;
65 unsigned long threadid; 67 unsigned long threadid;
66 long kgdb_usethreadid; 68 long kgdb_usethreadid;
67 struct pt_regs *linux_regs; 69 struct pt_regs *linux_regs;
@@ -166,13 +168,6 @@ early_param("nokgdbroundup", opt_nokgdbroundup);
166 * Weak aliases for breakpoint management, 168 * Weak aliases for breakpoint management,
167 * can be overriden by architectures when needed: 169 * can be overriden by architectures when needed:
168 */ 170 */
169int __weak kgdb_validate_break_address(unsigned long addr)
170{
171 char tmp_variable[BREAK_INSTR_SIZE];
172
173 return probe_kernel_read(tmp_variable, (char *)addr, BREAK_INSTR_SIZE);
174}
175
176int __weak kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr) 171int __weak kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr)
177{ 172{
178 int err; 173 int err;
@@ -191,6 +186,25 @@ int __weak kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle)
191 (char *)bundle, BREAK_INSTR_SIZE); 186 (char *)bundle, BREAK_INSTR_SIZE);
192} 187}
193 188
189int __weak kgdb_validate_break_address(unsigned long addr)
190{
191 char tmp_variable[BREAK_INSTR_SIZE];
192 int err;
193 /* Validate setting the breakpoint and then removing it. In the
194 * remove fails, the kernel needs to emit a bad message because we
195 * are deep trouble not being able to put things back the way we
196 * found them.
197 */
198 err = kgdb_arch_set_breakpoint(addr, tmp_variable);
199 if (err)
200 return err;
201 err = kgdb_arch_remove_breakpoint(addr, tmp_variable);
202 if (err)
203 printk(KERN_ERR "KGDB: Critical breakpoint error, kernel "
204 "memory destroyed at: %lx", addr);
205 return err;
206}
207
194unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs) 208unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs)
195{ 209{
196 return instruction_pointer(regs); 210 return instruction_pointer(regs);
@@ -433,9 +447,14 @@ int kgdb_hex2long(char **ptr, unsigned long *long_val)
433{ 447{
434 int hex_val; 448 int hex_val;
435 int num = 0; 449 int num = 0;
450 int negate = 0;
436 451
437 *long_val = 0; 452 *long_val = 0;
438 453
454 if (**ptr == '-') {
455 negate = 1;
456 (*ptr)++;
457 }
439 while (**ptr) { 458 while (**ptr) {
440 hex_val = hex(**ptr); 459 hex_val = hex(**ptr);
441 if (hex_val < 0) 460 if (hex_val < 0)
@@ -446,6 +465,9 @@ int kgdb_hex2long(char **ptr, unsigned long *long_val)
446 (*ptr)++; 465 (*ptr)++;
447 } 466 }
448 467
468 if (negate)
469 *long_val = -*long_val;
470
449 return num; 471 return num;
450} 472}
451 473
@@ -515,10 +537,16 @@ static void int_to_threadref(unsigned char *id, int value)
515static struct task_struct *getthread(struct pt_regs *regs, int tid) 537static struct task_struct *getthread(struct pt_regs *regs, int tid)
516{ 538{
517 /* 539 /*
518 * Non-positive TIDs are remapped idle tasks: 540 * Non-positive TIDs are remapped to the cpu shadow information
519 */ 541 */
520 if (tid <= 0) 542 if (tid == 0 || tid == -1)
521 return idle_task(-tid); 543 tid = -atomic_read(&kgdb_active) - 2;
544 if (tid < 0) {
545 if (kgdb_info[-tid - 2].task)
546 return kgdb_info[-tid - 2].task;
547 else
548 return idle_task(-tid - 2);
549 }
522 550
523 /* 551 /*
524 * find_task_by_pid_ns() does not take the tasklist lock anymore 552 * find_task_by_pid_ns() does not take the tasklist lock anymore
@@ -725,14 +753,15 @@ setundefined:
725} 753}
726 754
727/* 755/*
728 * Remap normal tasks to their real PID, idle tasks to -1 ... -NR_CPUs: 756 * Remap normal tasks to their real PID,
757 * CPU shadow threads are mapped to -CPU - 2
729 */ 758 */
730static inline int shadow_pid(int realpid) 759static inline int shadow_pid(int realpid)
731{ 760{
732 if (realpid) 761 if (realpid)
733 return realpid; 762 return realpid;
734 763
735 return -1-raw_smp_processor_id(); 764 return -raw_smp_processor_id() - 2;
736} 765}
737 766
738static char gdbmsgbuf[BUFMAX + 1]; 767static char gdbmsgbuf[BUFMAX + 1];
@@ -826,7 +855,7 @@ static void gdb_cmd_getregs(struct kgdb_state *ks)
826 local_debuggerinfo = kgdb_info[ks->cpu].debuggerinfo; 855 local_debuggerinfo = kgdb_info[ks->cpu].debuggerinfo;
827 } else { 856 } else {
828 local_debuggerinfo = NULL; 857 local_debuggerinfo = NULL;
829 for (i = 0; i < NR_CPUS; i++) { 858 for_each_online_cpu(i) {
830 /* 859 /*
831 * Try to find the task on some other 860 * Try to find the task on some other
832 * or possibly this node if we do not 861 * or possibly this node if we do not
@@ -960,10 +989,13 @@ static int gdb_cmd_reboot(struct kgdb_state *ks)
960/* Handle the 'q' query packets */ 989/* Handle the 'q' query packets */
961static void gdb_cmd_query(struct kgdb_state *ks) 990static void gdb_cmd_query(struct kgdb_state *ks)
962{ 991{
963 struct task_struct *thread; 992 struct task_struct *g;
993 struct task_struct *p;
964 unsigned char thref[8]; 994 unsigned char thref[8];
965 char *ptr; 995 char *ptr;
966 int i; 996 int i;
997 int cpu;
998 int finished = 0;
967 999
968 switch (remcom_in_buffer[1]) { 1000 switch (remcom_in_buffer[1]) {
969 case 's': 1001 case 's':
@@ -973,22 +1005,34 @@ static void gdb_cmd_query(struct kgdb_state *ks)
973 break; 1005 break;
974 } 1006 }
975 1007
976 if (remcom_in_buffer[1] == 'f') 1008 i = 0;
977 ks->threadid = 1;
978
979 remcom_out_buffer[0] = 'm'; 1009 remcom_out_buffer[0] = 'm';
980 ptr = remcom_out_buffer + 1; 1010 ptr = remcom_out_buffer + 1;
981 1011 if (remcom_in_buffer[1] == 'f') {
982 for (i = 0; i < 17; ks->threadid++) { 1012 /* Each cpu is a shadow thread */
983 thread = getthread(ks->linux_regs, ks->threadid); 1013 for_each_online_cpu(cpu) {
984 if (thread) { 1014 ks->thr_query = 0;
985 int_to_threadref(thref, ks->threadid); 1015 int_to_threadref(thref, -cpu - 2);
986 pack_threadid(ptr, thref); 1016 pack_threadid(ptr, thref);
987 ptr += BUF_THREAD_ID_SIZE; 1017 ptr += BUF_THREAD_ID_SIZE;
988 *(ptr++) = ','; 1018 *(ptr++) = ',';
989 i++; 1019 i++;
990 } 1020 }
991 } 1021 }
1022
1023 do_each_thread(g, p) {
1024 if (i >= ks->thr_query && !finished) {
1025 int_to_threadref(thref, p->pid);
1026 pack_threadid(ptr, thref);
1027 ptr += BUF_THREAD_ID_SIZE;
1028 *(ptr++) = ',';
1029 ks->thr_query++;
1030 if (ks->thr_query % KGDB_MAX_THREAD_QUERY == 0)
1031 finished = 1;
1032 }
1033 i++;
1034 } while_each_thread(g, p);
1035
992 *(--ptr) = '\0'; 1036 *(--ptr) = '\0';
993 break; 1037 break;
994 1038
@@ -1011,15 +1055,15 @@ static void gdb_cmd_query(struct kgdb_state *ks)
1011 error_packet(remcom_out_buffer, -EINVAL); 1055 error_packet(remcom_out_buffer, -EINVAL);
1012 break; 1056 break;
1013 } 1057 }
1014 if (ks->threadid > 0) { 1058 if ((int)ks->threadid > 0) {
1015 kgdb_mem2hex(getthread(ks->linux_regs, 1059 kgdb_mem2hex(getthread(ks->linux_regs,
1016 ks->threadid)->comm, 1060 ks->threadid)->comm,
1017 remcom_out_buffer, 16); 1061 remcom_out_buffer, 16);
1018 } else { 1062 } else {
1019 static char tmpstr[23 + BUF_THREAD_ID_SIZE]; 1063 static char tmpstr[23 + BUF_THREAD_ID_SIZE];
1020 1064
1021 sprintf(tmpstr, "Shadow task %d for pid 0", 1065 sprintf(tmpstr, "shadowCPU%d",
1022 (int)(-ks->threadid-1)); 1066 (int)(-ks->threadid - 2));
1023 kgdb_mem2hex(tmpstr, remcom_out_buffer, strlen(tmpstr)); 1067 kgdb_mem2hex(tmpstr, remcom_out_buffer, strlen(tmpstr));
1024 } 1068 }
1025 break; 1069 break;
diff --git a/kernel/marker.c b/kernel/marker.c
index 971da5317903..7d1faecd7a51 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -126,6 +126,11 @@ void marker_probe_cb(const struct marker *mdata, void *call_private, ...)
126 struct marker_probe_closure *multi; 126 struct marker_probe_closure *multi;
127 int i; 127 int i;
128 /* 128 /*
129 * Read mdata->ptype before mdata->multi.
130 */
131 smp_rmb();
132 multi = mdata->multi;
133 /*
129 * multi points to an array, therefore accessing the array 134 * multi points to an array, therefore accessing the array
130 * depends on reading multi. However, even in this case, 135 * depends on reading multi. However, even in this case,
131 * we must insure that the pointer is read _before_ the array 136 * we must insure that the pointer is read _before_ the array
@@ -133,7 +138,6 @@ void marker_probe_cb(const struct marker *mdata, void *call_private, ...)
133 * in the fast path, so put the explicit barrier here. 138 * in the fast path, so put the explicit barrier here.
134 */ 139 */
135 smp_read_barrier_depends(); 140 smp_read_barrier_depends();
136 multi = mdata->multi;
137 for (i = 0; multi[i].func; i++) { 141 for (i = 0; multi[i].func; i++) {
138 va_start(args, call_private); 142 va_start(args, call_private);
139 multi[i].func(multi[i].probe_private, call_private, 143 multi[i].func(multi[i].probe_private, call_private,
@@ -175,6 +179,11 @@ void marker_probe_cb_noarg(const struct marker *mdata, void *call_private, ...)
175 struct marker_probe_closure *multi; 179 struct marker_probe_closure *multi;
176 int i; 180 int i;
177 /* 181 /*
182 * Read mdata->ptype before mdata->multi.
183 */
184 smp_rmb();
185 multi = mdata->multi;
186 /*
178 * multi points to an array, therefore accessing the array 187 * multi points to an array, therefore accessing the array
179 * depends on reading multi. However, even in this case, 188 * depends on reading multi. However, even in this case,
180 * we must insure that the pointer is read _before_ the array 189 * we must insure that the pointer is read _before_ the array
@@ -182,7 +191,6 @@ void marker_probe_cb_noarg(const struct marker *mdata, void *call_private, ...)
182 * in the fast path, so put the explicit barrier here. 191 * in the fast path, so put the explicit barrier here.
183 */ 192 */
184 smp_read_barrier_depends(); 193 smp_read_barrier_depends();
185 multi = mdata->multi;
186 for (i = 0; multi[i].func; i++) 194 for (i = 0; multi[i].func; i++)
187 multi[i].func(multi[i].probe_private, call_private, 195 multi[i].func(multi[i].probe_private, call_private,
188 mdata->format, &args); 196 mdata->format, &args);
diff --git a/kernel/module.c b/kernel/module.c
index d8b5605132a0..61d212120df4 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -325,18 +325,6 @@ static unsigned long find_symbol(const char *name,
325 return -ENOENT; 325 return -ENOENT;
326} 326}
327 327
328/* lookup symbol in given range of kernel_symbols */
329static const struct kernel_symbol *lookup_symbol(const char *name,
330 const struct kernel_symbol *start,
331 const struct kernel_symbol *stop)
332{
333 const struct kernel_symbol *ks = start;
334 for (; ks < stop; ks++)
335 if (strcmp(ks->name, name) == 0)
336 return ks;
337 return NULL;
338}
339
340/* Search for module by name: must hold module_mutex. */ 328/* Search for module by name: must hold module_mutex. */
341static struct module *find_module(const char *name) 329static struct module *find_module(const char *name)
342{ 330{
@@ -690,7 +678,7 @@ static int try_stop_module(struct module *mod, int flags, int *forced)
690 if (flags & O_NONBLOCK) { 678 if (flags & O_NONBLOCK) {
691 struct stopref sref = { mod, flags, forced }; 679 struct stopref sref = { mod, flags, forced };
692 680
693 return stop_machine_run(__try_stop_module, &sref, NR_CPUS); 681 return stop_machine(__try_stop_module, &sref, NULL);
694 } else { 682 } else {
695 /* We don't need to stop the machine for this. */ 683 /* We don't need to stop the machine for this. */
696 mod->state = MODULE_STATE_GOING; 684 mod->state = MODULE_STATE_GOING;
@@ -1428,7 +1416,7 @@ static int __unlink_module(void *_mod)
1428static void free_module(struct module *mod) 1416static void free_module(struct module *mod)
1429{ 1417{
1430 /* Delete from various lists */ 1418 /* Delete from various lists */
1431 stop_machine_run(__unlink_module, mod, NR_CPUS); 1419 stop_machine(__unlink_module, mod, NULL);
1432 remove_notes_attrs(mod); 1420 remove_notes_attrs(mod);
1433 remove_sect_attrs(mod); 1421 remove_sect_attrs(mod);
1434 mod_kobject_remove(mod); 1422 mod_kobject_remove(mod);
@@ -1703,6 +1691,19 @@ static void setup_modinfo(struct module *mod, Elf_Shdr *sechdrs,
1703} 1691}
1704 1692
1705#ifdef CONFIG_KALLSYMS 1693#ifdef CONFIG_KALLSYMS
1694
1695/* lookup symbol in given range of kernel_symbols */
1696static const struct kernel_symbol *lookup_symbol(const char *name,
1697 const struct kernel_symbol *start,
1698 const struct kernel_symbol *stop)
1699{
1700 const struct kernel_symbol *ks = start;
1701 for (; ks < stop; ks++)
1702 if (strcmp(ks->name, name) == 0)
1703 return ks;
1704 return NULL;
1705}
1706
1706static int is_exported(const char *name, const struct module *mod) 1707static int is_exported(const char *name, const struct module *mod)
1707{ 1708{
1708 if (!mod && lookup_symbol(name, __start___ksymtab, __stop___ksymtab)) 1709 if (!mod && lookup_symbol(name, __start___ksymtab, __stop___ksymtab))
@@ -2196,7 +2197,7 @@ static struct module *load_module(void __user *umod,
2196 /* Now sew it into the lists so we can get lockdep and oops 2197 /* Now sew it into the lists so we can get lockdep and oops
2197 * info during argument parsing. Noone should access us, since 2198 * info during argument parsing. Noone should access us, since
2198 * strong_try_module_get() will fail. */ 2199 * strong_try_module_get() will fail. */
2199 stop_machine_run(__link_module, mod, NR_CPUS); 2200 stop_machine(__link_module, mod, NULL);
2200 2201
2201 /* Size of section 0 is 0, so this works well if no params */ 2202 /* Size of section 0 is 0, so this works well if no params */
2202 err = parse_args(mod->name, mod->args, 2203 err = parse_args(mod->name, mod->args,
@@ -2230,7 +2231,7 @@ static struct module *load_module(void __user *umod,
2230 return mod; 2231 return mod;
2231 2232
2232 unlink: 2233 unlink:
2233 stop_machine_run(__unlink_module, mod, NR_CPUS); 2234 stop_machine(__unlink_module, mod, NULL);
2234 module_arch_cleanup(mod); 2235 module_arch_cleanup(mod);
2235 cleanup: 2236 cleanup:
2236 kobject_del(&mod->mkobj.kobj); 2237 kobject_del(&mod->mkobj.kobj);
diff --git a/kernel/printk.c b/kernel/printk.c
index a7f7559c5f6c..b51b1567bb55 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1309,14 +1309,14 @@ void tty_write_message(struct tty_struct *tty, char *msg)
1309 1309
1310#if defined CONFIG_PRINTK 1310#if defined CONFIG_PRINTK
1311 1311
1312DEFINE_RATELIMIT_STATE(printk_ratelimit_state, 5 * HZ, 10);
1313/* 1312/*
1314 * printk rate limiting, lifted from the networking subsystem. 1313 * printk rate limiting, lifted from the networking subsystem.
1315 * 1314 *
1316 * This enforces a rate limit: not more than one kernel message 1315 * This enforces a rate limit: not more than 10 kernel messages
1317 * every printk_ratelimit_jiffies to make a denial-of-service 1316 * every 5s to make a denial-of-service attack impossible.
1318 * attack impossible.
1319 */ 1317 */
1318DEFINE_RATELIMIT_STATE(printk_ratelimit_state, 5 * HZ, 10);
1319
1320int printk_ratelimit(void) 1320int printk_ratelimit(void)
1321{ 1321{
1322 return __ratelimit(&printk_ratelimit_state); 1322 return __ratelimit(&printk_ratelimit_state);
diff --git a/kernel/rcuclassic.c b/kernel/rcuclassic.c
index 6f8696c502f4..aad93cdc9f68 100644
--- a/kernel/rcuclassic.c
+++ b/kernel/rcuclassic.c
@@ -91,8 +91,8 @@ static void force_quiescent_state(struct rcu_data *rdp,
91 * rdp->cpu is the current cpu. 91 * rdp->cpu is the current cpu.
92 * 92 *
93 * cpu_online_map is updated by the _cpu_down() 93 * cpu_online_map is updated by the _cpu_down()
94 * using stop_machine_run(). Since we're in irqs disabled 94 * using __stop_machine(). Since we're in irqs disabled
95 * section, stop_machine_run() is not exectuting, hence 95 * section, __stop_machine() is not exectuting, hence
96 * the cpu_online_map is stable. 96 * the cpu_online_map is stable.
97 * 97 *
98 * However, a cpu might have been offlined _just_ before 98 * However, a cpu might have been offlined _just_ before
diff --git a/kernel/resource.c b/kernel/resource.c
index 74af2d7cb5a1..f5b518eabefe 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -490,7 +490,7 @@ resource_size_t resource_alignment(struct resource *res)
490{ 490{
491 switch (res->flags & (IORESOURCE_SIZEALIGN | IORESOURCE_STARTALIGN)) { 491 switch (res->flags & (IORESOURCE_SIZEALIGN | IORESOURCE_STARTALIGN)) {
492 case IORESOURCE_SIZEALIGN: 492 case IORESOURCE_SIZEALIGN:
493 return res->end - res->start + 1; 493 return resource_size(res);
494 case IORESOURCE_STARTALIGN: 494 case IORESOURCE_STARTALIGN:
495 return res->start; 495 return res->start;
496 default: 496 default:
diff --git a/kernel/sched.c b/kernel/sched.c
index 0236958addcb..21f7da94662e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7671,34 +7671,34 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
7671} 7671}
7672 7672
7673#ifdef CONFIG_SCHED_MC 7673#ifdef CONFIG_SCHED_MC
7674static ssize_t sched_mc_power_savings_show(struct sys_device *dev, 7674static ssize_t sched_mc_power_savings_show(struct sysdev_class *class,
7675 struct sysdev_attribute *attr, char *page) 7675 char *page)
7676{ 7676{
7677 return sprintf(page, "%u\n", sched_mc_power_savings); 7677 return sprintf(page, "%u\n", sched_mc_power_savings);
7678} 7678}
7679static ssize_t sched_mc_power_savings_store(struct sys_device *dev, 7679static ssize_t sched_mc_power_savings_store(struct sysdev_class *class,
7680 struct sysdev_attribute *attr,
7681 const char *buf, size_t count) 7680 const char *buf, size_t count)
7682{ 7681{
7683 return sched_power_savings_store(buf, count, 0); 7682 return sched_power_savings_store(buf, count, 0);
7684} 7683}
7685static SYSDEV_ATTR(sched_mc_power_savings, 0644, sched_mc_power_savings_show, 7684static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644,
7686 sched_mc_power_savings_store); 7685 sched_mc_power_savings_show,
7686 sched_mc_power_savings_store);
7687#endif 7687#endif
7688 7688
7689#ifdef CONFIG_SCHED_SMT 7689#ifdef CONFIG_SCHED_SMT
7690static ssize_t sched_smt_power_savings_show(struct sys_device *dev, 7690static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev,
7691 struct sysdev_attribute *attr, char *page) 7691 char *page)
7692{ 7692{
7693 return sprintf(page, "%u\n", sched_smt_power_savings); 7693 return sprintf(page, "%u\n", sched_smt_power_savings);
7694} 7694}
7695static ssize_t sched_smt_power_savings_store(struct sys_device *dev, 7695static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev,
7696 struct sysdev_attribute *attr,
7697 const char *buf, size_t count) 7696 const char *buf, size_t count)
7698{ 7697{
7699 return sched_power_savings_store(buf, count, 1); 7698 return sched_power_savings_store(buf, count, 1);
7700} 7699}
7701static SYSDEV_ATTR(sched_smt_power_savings, 0644, sched_smt_power_savings_show, 7700static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644,
7701 sched_smt_power_savings_show,
7702 sched_smt_power_savings_store); 7702 sched_smt_power_savings_store);
7703#endif 7703#endif
7704 7704
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 738b411ff2d3..e446c7c7d6a9 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -1,4 +1,4 @@
1/* Copyright 2005 Rusty Russell rusty@rustcorp.com.au IBM Corporation. 1/* Copyright 2008, 2005 Rusty Russell rusty@rustcorp.com.au IBM Corporation.
2 * GPL v2 and any later version. 2 * GPL v2 and any later version.
3 */ 3 */
4#include <linux/cpu.h> 4#include <linux/cpu.h>
@@ -13,204 +13,178 @@
13#include <asm/atomic.h> 13#include <asm/atomic.h>
14#include <asm/uaccess.h> 14#include <asm/uaccess.h>
15 15
16/* Since we effect priority and affinity (both of which are visible 16/* This controls the threads on each CPU. */
17 * to, and settable by outside processes) we do indirection via a
18 * kthread. */
19
20/* Thread to stop each CPU in user context. */
21enum stopmachine_state { 17enum stopmachine_state {
22 STOPMACHINE_WAIT, 18 /* Dummy starting state for thread. */
19 STOPMACHINE_NONE,
20 /* Awaiting everyone to be scheduled. */
23 STOPMACHINE_PREPARE, 21 STOPMACHINE_PREPARE,
22 /* Disable interrupts. */
24 STOPMACHINE_DISABLE_IRQ, 23 STOPMACHINE_DISABLE_IRQ,
24 /* Run the function */
25 STOPMACHINE_RUN,
26 /* Exit */
25 STOPMACHINE_EXIT, 27 STOPMACHINE_EXIT,
26}; 28};
29static enum stopmachine_state state;
27 30
28static enum stopmachine_state stopmachine_state; 31struct stop_machine_data {
29static unsigned int stopmachine_num_threads; 32 int (*fn)(void *);
30static atomic_t stopmachine_thread_ack; 33 void *data;
31 34 int fnret;
32static int stopmachine(void *cpu) 35};
33{
34 int irqs_disabled = 0;
35 int prepared = 0;
36 cpumask_of_cpu_ptr(cpumask, (int)(long)cpu);
37
38 set_cpus_allowed_ptr(current, cpumask);
39
40 /* Ack: we are alive */
41 smp_mb(); /* Theoretically the ack = 0 might not be on this CPU yet. */
42 atomic_inc(&stopmachine_thread_ack);
43
44 /* Simple state machine */
45 while (stopmachine_state != STOPMACHINE_EXIT) {
46 if (stopmachine_state == STOPMACHINE_DISABLE_IRQ
47 && !irqs_disabled) {
48 local_irq_disable();
49 hard_irq_disable();
50 irqs_disabled = 1;
51 /* Ack: irqs disabled. */
52 smp_mb(); /* Must read state first. */
53 atomic_inc(&stopmachine_thread_ack);
54 } else if (stopmachine_state == STOPMACHINE_PREPARE
55 && !prepared) {
56 /* Everyone is in place, hold CPU. */
57 preempt_disable();
58 prepared = 1;
59 smp_mb(); /* Must read state first. */
60 atomic_inc(&stopmachine_thread_ack);
61 }
62 /* Yield in first stage: migration threads need to
63 * help our sisters onto their CPUs. */
64 if (!prepared && !irqs_disabled)
65 yield();
66 cpu_relax();
67 }
68
69 /* Ack: we are exiting. */
70 smp_mb(); /* Must read state first. */
71 atomic_inc(&stopmachine_thread_ack);
72
73 if (irqs_disabled)
74 local_irq_enable();
75 if (prepared)
76 preempt_enable();
77 36
78 return 0; 37/* Like num_online_cpus(), but hotplug cpu uses us, so we need this. */
79} 38static unsigned int num_threads;
39static atomic_t thread_ack;
40static struct completion finished;
41static DEFINE_MUTEX(lock);
80 42
81/* Change the thread state */ 43static void set_state(enum stopmachine_state newstate)
82static void stopmachine_set_state(enum stopmachine_state state)
83{ 44{
84 atomic_set(&stopmachine_thread_ack, 0); 45 /* Reset ack counter. */
46 atomic_set(&thread_ack, num_threads);
85 smp_wmb(); 47 smp_wmb();
86 stopmachine_state = state; 48 state = newstate;
87 while (atomic_read(&stopmachine_thread_ack) != stopmachine_num_threads)
88 cpu_relax();
89} 49}
90 50
91static int stop_machine(void) 51/* Last one to ack a state moves to the next state. */
52static void ack_state(void)
92{ 53{
93 int i, ret = 0; 54 if (atomic_dec_and_test(&thread_ack)) {
94 55 /* If we're the last one to ack the EXIT, we're finished. */
95 atomic_set(&stopmachine_thread_ack, 0); 56 if (state == STOPMACHINE_EXIT)
96 stopmachine_num_threads = 0; 57 complete(&finished);
97 stopmachine_state = STOPMACHINE_WAIT; 58 else
98 59 set_state(state + 1);
99 for_each_online_cpu(i) {
100 if (i == raw_smp_processor_id())
101 continue;
102 ret = kernel_thread(stopmachine, (void *)(long)i,CLONE_KERNEL);
103 if (ret < 0)
104 break;
105 stopmachine_num_threads++;
106 }
107
108 /* Wait for them all to come to life. */
109 while (atomic_read(&stopmachine_thread_ack) != stopmachine_num_threads) {
110 yield();
111 cpu_relax();
112 } 60 }
61}
113 62
114 /* If some failed, kill them all. */ 63/* This is the actual thread which stops the CPU. It exits by itself rather
115 if (ret < 0) { 64 * than waiting for kthread_stop(), because it's easier for hotplug CPU. */
116 stopmachine_set_state(STOPMACHINE_EXIT); 65static int stop_cpu(struct stop_machine_data *smdata)
117 return ret; 66{
118 } 67 enum stopmachine_state curstate = STOPMACHINE_NONE;
68 int uninitialized_var(ret);
119 69
120 /* Now they are all started, make them hold the CPUs, ready. */ 70 /* Simple state machine */
121 preempt_disable(); 71 do {
122 stopmachine_set_state(STOPMACHINE_PREPARE); 72 /* Chill out and ensure we re-read stopmachine_state. */
73 cpu_relax();
74 if (state != curstate) {
75 curstate = state;
76 switch (curstate) {
77 case STOPMACHINE_DISABLE_IRQ:
78 local_irq_disable();
79 hard_irq_disable();
80 break;
81 case STOPMACHINE_RUN:
82 /* |= allows error detection if functions on
83 * multiple CPUs. */
84 smdata->fnret |= smdata->fn(smdata->data);
85 break;
86 default:
87 break;
88 }
89 ack_state();
90 }
91 } while (curstate != STOPMACHINE_EXIT);
123 92
124 /* Make them disable irqs. */ 93 local_irq_enable();
125 local_irq_disable(); 94 do_exit(0);
126 hard_irq_disable(); 95}
127 stopmachine_set_state(STOPMACHINE_DISABLE_IRQ);
128 96
97/* Callback for CPUs which aren't supposed to do anything. */
98static int chill(void *unused)
99{
129 return 0; 100 return 0;
130} 101}
131 102
132static void restart_machine(void) 103int __stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus)
133{ 104{
134 stopmachine_set_state(STOPMACHINE_EXIT); 105 int i, err;
135 local_irq_enable(); 106 struct stop_machine_data active, idle;
136 preempt_enable_no_resched(); 107 struct task_struct **threads;
137} 108
109 active.fn = fn;
110 active.data = data;
111 active.fnret = 0;
112 idle.fn = chill;
113 idle.data = NULL;
114
115 /* This could be too big for stack on large machines. */
116 threads = kcalloc(NR_CPUS, sizeof(threads[0]), GFP_KERNEL);
117 if (!threads)
118 return -ENOMEM;
119
120 /* Set up initial state. */
121 mutex_lock(&lock);
122 init_completion(&finished);
123 num_threads = num_online_cpus();
124 set_state(STOPMACHINE_PREPARE);
138 125
139struct stop_machine_data { 126 for_each_online_cpu(i) {
140 int (*fn)(void *); 127 struct stop_machine_data *smdata = &idle;
141 void *data; 128 struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
142 struct completion done;
143};
144 129
145static int do_stop(void *_smdata) 130 if (!cpus) {
146{ 131 if (i == first_cpu(cpu_online_map))
147 struct stop_machine_data *smdata = _smdata; 132 smdata = &active;
148 int ret; 133 } else {
134 if (cpu_isset(i, *cpus))
135 smdata = &active;
136 }
149 137
150 ret = stop_machine(); 138 threads[i] = kthread_create((void *)stop_cpu, smdata, "kstop%u",
151 if (ret == 0) { 139 i);
152 ret = smdata->fn(smdata->data); 140 if (IS_ERR(threads[i])) {
153 restart_machine(); 141 err = PTR_ERR(threads[i]);
154 } 142 threads[i] = NULL;
143 goto kill_threads;
144 }
155 145
156 /* We're done: you can kthread_stop us now */ 146 /* Place it onto correct cpu. */
157 complete(&smdata->done); 147 kthread_bind(threads[i], i);
158 148
159 /* Wait for kthread_stop */ 149 /* Make it highest prio. */
160 set_current_state(TASK_INTERRUPTIBLE); 150 if (sched_setscheduler_nocheck(threads[i], SCHED_FIFO, &param))
161 while (!kthread_should_stop()) { 151 BUG();
162 schedule();
163 set_current_state(TASK_INTERRUPTIBLE);
164 } 152 }
165 __set_current_state(TASK_RUNNING);
166 return ret;
167}
168 153
169struct task_struct *__stop_machine_run(int (*fn)(void *), void *data, 154 /* We've created all the threads. Wake them all: hold this CPU so one
170 unsigned int cpu) 155 * doesn't hit this CPU until we're ready. */
171{ 156 get_cpu();
172 static DEFINE_MUTEX(stopmachine_mutex); 157 for_each_online_cpu(i)
173 struct stop_machine_data smdata; 158 wake_up_process(threads[i]);
174 struct task_struct *p;
175 159
176 smdata.fn = fn; 160 /* This will release the thread on our CPU. */
177 smdata.data = data; 161 put_cpu();
178 init_completion(&smdata.done); 162 wait_for_completion(&finished);
163 mutex_unlock(&lock);
179 164
180 mutex_lock(&stopmachine_mutex); 165 kfree(threads);
181 166
182 /* If they don't care which CPU fn runs on, bind to any online one. */ 167 return active.fnret;
183 if (cpu == NR_CPUS)
184 cpu = raw_smp_processor_id();
185 168
186 p = kthread_create(do_stop, &smdata, "kstopmachine"); 169kill_threads:
187 if (!IS_ERR(p)) { 170 for_each_online_cpu(i)
188 struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; 171 if (threads[i])
172 kthread_stop(threads[i]);
173 mutex_unlock(&lock);
189 174
190 /* One high-prio thread per cpu. We'll do this one. */ 175 kfree(threads);
191 sched_setscheduler_nocheck(p, SCHED_FIFO, &param); 176 return err;
192 kthread_bind(p, cpu);
193 wake_up_process(p);
194 wait_for_completion(&smdata.done);
195 }
196 mutex_unlock(&stopmachine_mutex);
197 return p;
198} 177}
199 178
200int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) 179int stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus)
201{ 180{
202 struct task_struct *p;
203 int ret; 181 int ret;
204 182
205 /* No CPUs can come up or down during this. */ 183 /* No CPUs can come up or down during this. */
206 get_online_cpus(); 184 get_online_cpus();
207 p = __stop_machine_run(fn, data, cpu); 185 ret = __stop_machine(fn, data, cpus);
208 if (!IS_ERR(p))
209 ret = kthread_stop(p);
210 else
211 ret = PTR_ERR(p);
212 put_online_cpus(); 186 put_online_cpus();
213 187
214 return ret; 188 return ret;
215} 189}
216EXPORT_SYMBOL_GPL(stop_machine_run); 190EXPORT_SYMBOL_GPL(stop_machine);
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index bf43284d6855..80c4336f4188 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -196,12 +196,10 @@ static int tick_check_new_device(struct clock_event_device *newdev)
196 struct tick_device *td; 196 struct tick_device *td;
197 int cpu, ret = NOTIFY_OK; 197 int cpu, ret = NOTIFY_OK;
198 unsigned long flags; 198 unsigned long flags;
199 cpumask_of_cpu_ptr_declare(cpumask);
200 199
201 spin_lock_irqsave(&tick_device_lock, flags); 200 spin_lock_irqsave(&tick_device_lock, flags);
202 201
203 cpu = smp_processor_id(); 202 cpu = smp_processor_id();
204 cpumask_of_cpu_ptr_next(cpumask, cpu);
205 if (!cpu_isset(cpu, newdev->cpumask)) 203 if (!cpu_isset(cpu, newdev->cpumask))
206 goto out_bc; 204 goto out_bc;
207 205
@@ -209,7 +207,7 @@ static int tick_check_new_device(struct clock_event_device *newdev)
209 curdev = td->evtdev; 207 curdev = td->evtdev;
210 208
211 /* cpu local device ? */ 209 /* cpu local device ? */
212 if (!cpus_equal(newdev->cpumask, *cpumask)) { 210 if (!cpus_equal(newdev->cpumask, cpumask_of_cpu(cpu))) {
213 211
214 /* 212 /*
215 * If the cpu affinity of the device interrupt can not 213 * If the cpu affinity of the device interrupt can not
@@ -222,7 +220,7 @@ static int tick_check_new_device(struct clock_event_device *newdev)
222 * If we have a cpu local device already, do not replace it 220 * If we have a cpu local device already, do not replace it
223 * by a non cpu local device 221 * by a non cpu local device
224 */ 222 */
225 if (curdev && cpus_equal(curdev->cpumask, *cpumask)) 223 if (curdev && cpus_equal(curdev->cpumask, cpumask_of_cpu(cpu)))
226 goto out_bc; 224 goto out_bc;
227 } 225 }
228 226
@@ -254,7 +252,7 @@ static int tick_check_new_device(struct clock_event_device *newdev)
254 curdev = NULL; 252 curdev = NULL;
255 } 253 }
256 clockevents_exchange_device(curdev, newdev); 254 clockevents_exchange_device(curdev, newdev);
257 tick_setup_device(td, newdev, cpu, cpumask); 255 tick_setup_device(td, newdev, cpu, &cpumask_of_cpu(cpu));
258 if (newdev->features & CLOCK_EVT_FEAT_ONESHOT) 256 if (newdev->features & CLOCK_EVT_FEAT_ONESHOT)
259 tick_oneshot_notify(); 257 tick_oneshot_notify();
260 258
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4231a3dc224a..f6e3af31b403 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -587,7 +587,7 @@ static int __ftrace_modify_code(void *data)
587 587
588static void ftrace_run_update_code(int command) 588static void ftrace_run_update_code(int command)
589{ 589{
590 stop_machine_run(__ftrace_modify_code, &command, NR_CPUS); 590 stop_machine(__ftrace_modify_code, &command, NULL);
591} 591}
592 592
593void ftrace_disable_daemon(void) 593void ftrace_disable_daemon(void)
@@ -787,7 +787,7 @@ static int ftrace_update_code(void)
787 !ftrace_enabled || !ftraced_trigger) 787 !ftrace_enabled || !ftraced_trigger)
788 return 0; 788 return 0;
789 789
790 stop_machine_run(__ftrace_update_code, NULL, NR_CPUS); 790 stop_machine(__ftrace_update_code, NULL, NULL);
791 791
792 return 1; 792 return 1;
793} 793}
@@ -1564,7 +1564,7 @@ static int __init ftrace_dynamic_init(void)
1564 1564
1565 addr = (unsigned long)ftrace_record_ip; 1565 addr = (unsigned long)ftrace_record_ip;
1566 1566
1567 stop_machine_run(ftrace_dyn_arch_init, &addr, NR_CPUS); 1567 stop_machine(ftrace_dyn_arch_init, &addr, NULL);
1568 1568
1569 /* ftrace_dyn_arch_init places the return code in addr */ 1569 /* ftrace_dyn_arch_init places the return code in addr */
1570 if (addr) { 1570 if (addr) {
diff --git a/kernel/trace/trace_sysprof.c b/kernel/trace/trace_sysprof.c
index ce2d723c10e1..bb948e52ce20 100644
--- a/kernel/trace/trace_sysprof.c
+++ b/kernel/trace/trace_sysprof.c
@@ -213,9 +213,7 @@ static void start_stack_timers(void)
213 int cpu; 213 int cpu;
214 214
215 for_each_online_cpu(cpu) { 215 for_each_online_cpu(cpu) {
216 cpumask_of_cpu_ptr(new_mask, cpu); 216 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
217
218 set_cpus_allowed_ptr(current, new_mask);
219 start_stack_timer(cpu); 217 start_stack_timer(cpu);
220 } 218 }
221 set_cpus_allowed_ptr(current, &saved_mask); 219 set_cpus_allowed_ptr(current, &saved_mask);
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ec7e4f62aaff..4a26a1382df0 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -830,10 +830,21 @@ struct workqueue_struct *__create_workqueue_key(const char *name,
830 start_workqueue_thread(cwq, -1); 830 start_workqueue_thread(cwq, -1);
831 } else { 831 } else {
832 cpu_maps_update_begin(); 832 cpu_maps_update_begin();
833 /*
834 * We must place this wq on list even if the code below fails.
835 * cpu_down(cpu) can remove cpu from cpu_populated_map before
836 * destroy_workqueue() takes the lock, in that case we leak
837 * cwq[cpu]->thread.
838 */
833 spin_lock(&workqueue_lock); 839 spin_lock(&workqueue_lock);
834 list_add(&wq->list, &workqueues); 840 list_add(&wq->list, &workqueues);
835 spin_unlock(&workqueue_lock); 841 spin_unlock(&workqueue_lock);
836 842 /*
843 * We must initialize cwqs for each possible cpu even if we
844 * are going to call destroy_workqueue() finally. Otherwise
845 * cpu_up() can hit the uninitialized cwq once we drop the
846 * lock.
847 */
837 for_each_possible_cpu(cpu) { 848 for_each_possible_cpu(cpu) {
838 cwq = init_cpu_workqueue(wq, cpu); 849 cwq = init_cpu_workqueue(wq, cpu);
839 if (err || !cpu_online(cpu)) 850 if (err || !cpu_online(cpu))
diff --git a/lib/Kconfig.kgdb b/lib/Kconfig.kgdb
index 2cfd2721f7ed..9b5d1d7f2ef7 100644
--- a/lib/Kconfig.kgdb
+++ b/lib/Kconfig.kgdb
@@ -4,14 +4,17 @@ config HAVE_ARCH_KGDB
4 4
5menuconfig KGDB 5menuconfig KGDB
6 bool "KGDB: kernel debugging with remote gdb" 6 bool "KGDB: kernel debugging with remote gdb"
7 select FRAME_POINTER
8 depends on HAVE_ARCH_KGDB 7 depends on HAVE_ARCH_KGDB
9 depends on DEBUG_KERNEL && EXPERIMENTAL 8 depends on DEBUG_KERNEL && EXPERIMENTAL
10 help 9 help
11 If you say Y here, it will be possible to remotely debug the 10 If you say Y here, it will be possible to remotely debug the
12 kernel using gdb. Documentation of kernel debugger is available 11 kernel using gdb. It is recommended but not required, that
13 at http://kgdb.sourceforge.net as well as in DocBook form 12 you also turn on the kernel config option
14 in Documentation/DocBook/. If unsure, say N. 13 CONFIG_FRAME_POINTER to aid in producing more reliable stack
14 backtraces in the external debugger. Documentation of
15 kernel debugger is available at http://kgdb.sourceforge.net
16 as well as in DocBook form in Documentation/DocBook/. If
17 unsure, say N.
15 18
16if KGDB 19if KGDB
17 20
diff --git a/lib/random32.c b/lib/random32.c
index ca87d86992bd..217d5c4b666d 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -56,23 +56,12 @@ static u32 __random32(struct rnd_state *state)
56 return (state->s1 ^ state->s2 ^ state->s3); 56 return (state->s1 ^ state->s2 ^ state->s3);
57} 57}
58 58
59static void __set_random32(struct rnd_state *state, unsigned long s) 59/*
60 * Handle minimum values for seeds
61 */
62static inline u32 __seed(u32 x, u32 m)
60{ 63{
61 if (s == 0) 64 return (x < m) ? x + m : x;
62 s = 1; /* default seed is 1 */
63
64#define LCG(n) (69069 * n)
65 state->s1 = LCG(s);
66 state->s2 = LCG(state->s1);
67 state->s3 = LCG(state->s2);
68
69 /* "warm it up" */
70 __random32(state);
71 __random32(state);
72 __random32(state);
73 __random32(state);
74 __random32(state);
75 __random32(state);
76} 65}
77 66
78/** 67/**
@@ -107,7 +96,7 @@ void srandom32(u32 entropy)
107 */ 96 */
108 for_each_possible_cpu (i) { 97 for_each_possible_cpu (i) {
109 struct rnd_state *state = &per_cpu(net_rand_state, i); 98 struct rnd_state *state = &per_cpu(net_rand_state, i);
110 __set_random32(state, state->s1 ^ entropy); 99 state->s1 = __seed(state->s1 ^ entropy, 1);
111 } 100 }
112} 101}
113EXPORT_SYMBOL(srandom32); 102EXPORT_SYMBOL(srandom32);
@@ -122,7 +111,19 @@ static int __init random32_init(void)
122 111
123 for_each_possible_cpu(i) { 112 for_each_possible_cpu(i) {
124 struct rnd_state *state = &per_cpu(net_rand_state,i); 113 struct rnd_state *state = &per_cpu(net_rand_state,i);
125 __set_random32(state, i + jiffies); 114
115#define LCG(x) ((x) * 69069) /* super-duper LCG */
116 state->s1 = __seed(LCG(i + jiffies), 1);
117 state->s2 = __seed(LCG(state->s1), 7);
118 state->s3 = __seed(LCG(state->s2), 15);
119
120 /* "warm it up" */
121 __random32(state);
122 __random32(state);
123 __random32(state);
124 __random32(state);
125 __random32(state);
126 __random32(state);
126 } 127 }
127 return 0; 128 return 0;
128} 129}
@@ -135,13 +136,18 @@ core_initcall(random32_init);
135static int __init random32_reseed(void) 136static int __init random32_reseed(void)
136{ 137{
137 int i; 138 int i;
138 unsigned long seed;
139 139
140 for_each_possible_cpu(i) { 140 for_each_possible_cpu(i) {
141 struct rnd_state *state = &per_cpu(net_rand_state,i); 141 struct rnd_state *state = &per_cpu(net_rand_state,i);
142 u32 seeds[3];
143
144 get_random_bytes(&seeds, sizeof(seeds));
145 state->s1 = __seed(seeds[0], 1);
146 state->s2 = __seed(seeds[1], 7);
147 state->s3 = __seed(seeds[2], 15);
142 148
143 get_random_bytes(&seed, sizeof(seed)); 149 /* mix it in */
144 __set_random32(state, seed); 150 __random32(state);
145 } 151 }
146 return 0; 152 return 0;
147} 153}
diff --git a/lib/ratelimit.c b/lib/ratelimit.c
index 35136671b215..26187edcc7ea 100644
--- a/lib/ratelimit.c
+++ b/lib/ratelimit.c
@@ -15,7 +15,6 @@
15#include <linux/module.h> 15#include <linux/module.h>
16 16
17static DEFINE_SPINLOCK(ratelimit_lock); 17static DEFINE_SPINLOCK(ratelimit_lock);
18static unsigned long flags;
19 18
20/* 19/*
21 * __ratelimit - rate limiting 20 * __ratelimit - rate limiting
@@ -26,6 +25,8 @@ static unsigned long flags;
26 */ 25 */
27int __ratelimit(struct ratelimit_state *rs) 26int __ratelimit(struct ratelimit_state *rs)
28{ 27{
28 unsigned long flags;
29
29 if (!rs->interval) 30 if (!rs->interval)
30 return 1; 31 return 1;
31 32
diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c
index c4381d9516f6..0f8fc22ed103 100644
--- a/lib/smp_processor_id.c
+++ b/lib/smp_processor_id.c
@@ -11,7 +11,6 @@ notrace unsigned int debug_smp_processor_id(void)
11{ 11{
12 unsigned long preempt_count = preempt_count(); 12 unsigned long preempt_count = preempt_count();
13 int this_cpu = raw_smp_processor_id(); 13 int this_cpu = raw_smp_processor_id();
14 cpumask_of_cpu_ptr_declare(this_mask);
15 14
16 if (likely(preempt_count)) 15 if (likely(preempt_count))
17 goto out; 16 goto out;
@@ -23,9 +22,7 @@ notrace unsigned int debug_smp_processor_id(void)
23 * Kernel threads bound to a single CPU can safely use 22 * Kernel threads bound to a single CPU can safely use
24 * smp_processor_id(): 23 * smp_processor_id():
25 */ 24 */
26 cpumask_of_cpu_ptr_next(this_mask, this_cpu); 25 if (cpus_equal(current->cpus_allowed, cpumask_of_cpu(this_cpu)))
27
28 if (cpus_equal(current->cpus_allowed, *this_mask))
29 goto out; 26 goto out;
30 27
31 /* 28 /*
diff --git a/mm/Kconfig b/mm/Kconfig
index efee5d379df4..446c6588c753 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -208,3 +208,6 @@ config NR_QUICK
208config VIRT_TO_BUS 208config VIRT_TO_BUS
209 def_bool y 209 def_bool y
210 depends on !ARCH_NO_VIRT_TO_BUS 210 depends on !ARCH_NO_VIRT_TO_BUS
211
212config MMU_NOTIFIER
213 bool
diff --git a/mm/Makefile b/mm/Makefile
index 06ca2381fef1..da4ccf015aea 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_SHMEM) += shmem.o
25obj-$(CONFIG_TMPFS_POSIX_ACL) += shmem_acl.o 25obj-$(CONFIG_TMPFS_POSIX_ACL) += shmem_acl.o
26obj-$(CONFIG_TINY_SHMEM) += tiny-shmem.o 26obj-$(CONFIG_TINY_SHMEM) += tiny-shmem.o
27obj-$(CONFIG_SLOB) += slob.o 27obj-$(CONFIG_SLOB) += slob.o
28obj-$(CONFIG_MMU_NOTIFIER) += mmu_notifier.o
28obj-$(CONFIG_SLAB) += slab.o 29obj-$(CONFIG_SLAB) += slab.o
29obj-$(CONFIG_SLUB) += slub.o 30obj-$(CONFIG_SLUB) += slub.o
30obj-$(CONFIG_MEMORY_HOTPLUG) += memory_hotplug.o 31obj-$(CONFIG_MEMORY_HOTPLUG) += memory_hotplug.o
diff --git a/mm/filemap.c b/mm/filemap.c
index 5de7633e1dbe..d97d1ad55473 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1023,8 +1023,17 @@ find_page:
1023 ra, filp, page, 1023 ra, filp, page,
1024 index, last_index - index); 1024 index, last_index - index);
1025 } 1025 }
1026 if (!PageUptodate(page)) 1026 if (!PageUptodate(page)) {
1027 goto page_not_up_to_date; 1027 if (inode->i_blkbits == PAGE_CACHE_SHIFT ||
1028 !mapping->a_ops->is_partially_uptodate)
1029 goto page_not_up_to_date;
1030 if (TestSetPageLocked(page))
1031 goto page_not_up_to_date;
1032 if (!mapping->a_ops->is_partially_uptodate(page,
1033 desc, offset))
1034 goto page_not_up_to_date_locked;
1035 unlock_page(page);
1036 }
1028page_ok: 1037page_ok:
1029 /* 1038 /*
1030 * i_size must be checked after we know the page is Uptodate. 1039 * i_size must be checked after we know the page is Uptodate.
@@ -1094,6 +1103,7 @@ page_not_up_to_date:
1094 if (lock_page_killable(page)) 1103 if (lock_page_killable(page))
1095 goto readpage_eio; 1104 goto readpage_eio;
1096 1105
1106page_not_up_to_date_locked:
1097 /* Did it get truncated before we got the lock? */ 1107 /* Did it get truncated before we got the lock? */
1098 if (!page->mapping) { 1108 if (!page->mapping) {
1099 unlock_page(page); 1109 unlock_page(page);
@@ -1869,7 +1879,7 @@ void iov_iter_advance(struct iov_iter *i, size_t bytes)
1869 * The !iov->iov_len check ensures we skip over unlikely 1879 * The !iov->iov_len check ensures we skip over unlikely
1870 * zero-length segments (without overruning the iovec). 1880 * zero-length segments (without overruning the iovec).
1871 */ 1881 */
1872 while (bytes || unlikely(!iov->iov_len && i->count)) { 1882 while (bytes || unlikely(i->count && !iov->iov_len)) {
1873 int copy; 1883 int copy;
1874 1884
1875 copy = min(bytes, iov->iov_len - base); 1885 copy = min(bytes, iov->iov_len - base);
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 98a3f31ccd6a..380ab402d711 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -13,6 +13,7 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/uio.h> 14#include <linux/uio.h>
15#include <linux/rmap.h> 15#include <linux/rmap.h>
16#include <linux/mmu_notifier.h>
16#include <linux/sched.h> 17#include <linux/sched.h>
17#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
18#include <asm/io.h> 19#include <asm/io.h>
@@ -188,7 +189,7 @@ __xip_unmap (struct address_space * mapping,
188 if (pte) { 189 if (pte) {
189 /* Nuke the page table entry. */ 190 /* Nuke the page table entry. */
190 flush_cache_page(vma, address, pte_pfn(*pte)); 191 flush_cache_page(vma, address, pte_pfn(*pte));
191 pteval = ptep_clear_flush(vma, address, pte); 192 pteval = ptep_clear_flush_notify(vma, address, pte);
192 page_remove_rmap(page, vma); 193 page_remove_rmap(page, vma);
193 dec_mm_counter(mm, file_rss); 194 dec_mm_counter(mm, file_rss);
194 BUG_ON(pte_dirty(pteval)); 195 BUG_ON(pte_dirty(pteval));
diff --git a/mm/fremap.c b/mm/fremap.c
index 07a9c82ce1a3..7881638e4a12 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -15,6 +15,7 @@
15#include <linux/rmap.h> 15#include <linux/rmap.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/syscalls.h> 17#include <linux/syscalls.h>
18#include <linux/mmu_notifier.h>
18 19
19#include <asm/mmu_context.h> 20#include <asm/mmu_context.h>
20#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
@@ -214,7 +215,9 @@ asmlinkage long sys_remap_file_pages(unsigned long start, unsigned long size,
214 spin_unlock(&mapping->i_mmap_lock); 215 spin_unlock(&mapping->i_mmap_lock);
215 } 216 }
216 217
218 mmu_notifier_invalidate_range_start(mm, start, start + size);
217 err = populate_range(mm, vma, start, size, pgoff); 219 err = populate_range(mm, vma, start, size, pgoff);
220 mmu_notifier_invalidate_range_end(mm, start, start + size);
218 if (!err && !(flags & MAP_NONBLOCK)) { 221 if (!err && !(flags & MAP_NONBLOCK)) {
219 if (unlikely(has_write_lock)) { 222 if (unlikely(has_write_lock)) {
220 downgrade_write(&mm->mmap_sem); 223 downgrade_write(&mm->mmap_sem);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 3be79dc18c5c..d237a02eb228 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -9,6 +9,7 @@
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/sysctl.h> 10#include <linux/sysctl.h>
11#include <linux/highmem.h> 11#include <linux/highmem.h>
12#include <linux/mmu_notifier.h>
12#include <linux/nodemask.h> 13#include <linux/nodemask.h>
13#include <linux/pagemap.h> 14#include <linux/pagemap.h>
14#include <linux/mempolicy.h> 15#include <linux/mempolicy.h>
@@ -16,9 +17,10 @@
16#include <linux/mutex.h> 17#include <linux/mutex.h>
17#include <linux/bootmem.h> 18#include <linux/bootmem.h>
18#include <linux/sysfs.h> 19#include <linux/sysfs.h>
19 20#include <asm/io.h>
20#include <asm/page.h> 21#include <asm/page.h>
21#include <asm/pgtable.h> 22#include <asm/pgtable.h>
23#include <asm/io.h>
22 24
23#include <linux/hugetlb.h> 25#include <linux/hugetlb.h>
24#include "internal.h" 26#include "internal.h"
@@ -1672,6 +1674,7 @@ void __unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
1672 BUG_ON(start & ~huge_page_mask(h)); 1674 BUG_ON(start & ~huge_page_mask(h));
1673 BUG_ON(end & ~huge_page_mask(h)); 1675 BUG_ON(end & ~huge_page_mask(h));
1674 1676
1677 mmu_notifier_invalidate_range_start(mm, start, end);
1675 spin_lock(&mm->page_table_lock); 1678 spin_lock(&mm->page_table_lock);
1676 for (address = start; address < end; address += sz) { 1679 for (address = start; address < end; address += sz) {
1677 ptep = huge_pte_offset(mm, address); 1680 ptep = huge_pte_offset(mm, address);
@@ -1713,6 +1716,7 @@ void __unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
1713 } 1716 }
1714 spin_unlock(&mm->page_table_lock); 1717 spin_unlock(&mm->page_table_lock);
1715 flush_tlb_range(vma, start, end); 1718 flush_tlb_range(vma, start, end);
1719 mmu_notifier_invalidate_range_end(mm, start, end);
1716 list_for_each_entry_safe(page, tmp, &page_list, lru) { 1720 list_for_each_entry_safe(page, tmp, &page_list, lru) {
1717 list_del(&page->lru); 1721 list_del(&page->lru);
1718 put_page(page); 1722 put_page(page);
diff --git a/mm/madvise.c b/mm/madvise.c
index 23a0ec3e0ea0..f9349c18a1b5 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -132,10 +132,10 @@ static long madvise_willneed(struct vm_area_struct * vma,
132 * Application no longer needs these pages. If the pages are dirty, 132 * Application no longer needs these pages. If the pages are dirty,
133 * it's OK to just throw them away. The app will be more careful about 133 * it's OK to just throw them away. The app will be more careful about
134 * data it wants to keep. Be sure to free swap resources too. The 134 * data it wants to keep. Be sure to free swap resources too. The
135 * zap_page_range call sets things up for refill_inactive to actually free 135 * zap_page_range call sets things up for shrink_active_list to actually free
136 * these pages later if no one else has touched them in the meantime, 136 * these pages later if no one else has touched them in the meantime,
137 * although we could add these pages to a global reuse list for 137 * although we could add these pages to a global reuse list for
138 * refill_inactive to pick up before reclaiming other pages. 138 * shrink_active_list to pick up before reclaiming other pages.
139 * 139 *
140 * NB: This interface discards data rather than pushes it out to swap, 140 * NB: This interface discards data rather than pushes it out to swap,
141 * as some implementations do. This has performance implications for 141 * as some implementations do. This has performance implications for
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index fba566c51322..7056c3bdb478 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1168,9 +1168,6 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss,
1168 mem = mem_cgroup_from_cont(cont); 1168 mem = mem_cgroup_from_cont(cont);
1169 old_mem = mem_cgroup_from_cont(old_cont); 1169 old_mem = mem_cgroup_from_cont(old_cont);
1170 1170
1171 if (mem == old_mem)
1172 goto out;
1173
1174 /* 1171 /*
1175 * Only thread group leaders are allowed to migrate, the mm_struct is 1172 * Only thread group leaders are allowed to migrate, the mm_struct is
1176 * in effect owned by the leader 1173 * in effect owned by the leader
diff --git a/mm/memory.c b/mm/memory.c
index a8ca04faaea6..0e4eea10c7b0 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -51,6 +51,7 @@
51#include <linux/init.h> 51#include <linux/init.h>
52#include <linux/writeback.h> 52#include <linux/writeback.h>
53#include <linux/memcontrol.h> 53#include <linux/memcontrol.h>
54#include <linux/mmu_notifier.h>
54 55
55#include <asm/pgalloc.h> 56#include <asm/pgalloc.h>
56#include <asm/uaccess.h> 57#include <asm/uaccess.h>
@@ -652,6 +653,7 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
652 unsigned long next; 653 unsigned long next;
653 unsigned long addr = vma->vm_start; 654 unsigned long addr = vma->vm_start;
654 unsigned long end = vma->vm_end; 655 unsigned long end = vma->vm_end;
656 int ret;
655 657
656 /* 658 /*
657 * Don't copy ptes where a page fault will fill them correctly. 659 * Don't copy ptes where a page fault will fill them correctly.
@@ -667,17 +669,33 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
667 if (is_vm_hugetlb_page(vma)) 669 if (is_vm_hugetlb_page(vma))
668 return copy_hugetlb_page_range(dst_mm, src_mm, vma); 670 return copy_hugetlb_page_range(dst_mm, src_mm, vma);
669 671
672 /*
673 * We need to invalidate the secondary MMU mappings only when
674 * there could be a permission downgrade on the ptes of the
675 * parent mm. And a permission downgrade will only happen if
676 * is_cow_mapping() returns true.
677 */
678 if (is_cow_mapping(vma->vm_flags))
679 mmu_notifier_invalidate_range_start(src_mm, addr, end);
680
681 ret = 0;
670 dst_pgd = pgd_offset(dst_mm, addr); 682 dst_pgd = pgd_offset(dst_mm, addr);
671 src_pgd = pgd_offset(src_mm, addr); 683 src_pgd = pgd_offset(src_mm, addr);
672 do { 684 do {
673 next = pgd_addr_end(addr, end); 685 next = pgd_addr_end(addr, end);
674 if (pgd_none_or_clear_bad(src_pgd)) 686 if (pgd_none_or_clear_bad(src_pgd))
675 continue; 687 continue;
676 if (copy_pud_range(dst_mm, src_mm, dst_pgd, src_pgd, 688 if (unlikely(copy_pud_range(dst_mm, src_mm, dst_pgd, src_pgd,
677 vma, addr, next)) 689 vma, addr, next))) {
678 return -ENOMEM; 690 ret = -ENOMEM;
691 break;
692 }
679 } while (dst_pgd++, src_pgd++, addr = next, addr != end); 693 } while (dst_pgd++, src_pgd++, addr = next, addr != end);
680 return 0; 694
695 if (is_cow_mapping(vma->vm_flags))
696 mmu_notifier_invalidate_range_end(src_mm,
697 vma->vm_start, end);
698 return ret;
681} 699}
682 700
683static unsigned long zap_pte_range(struct mmu_gather *tlb, 701static unsigned long zap_pte_range(struct mmu_gather *tlb,
@@ -881,7 +899,9 @@ unsigned long unmap_vmas(struct mmu_gather **tlbp,
881 unsigned long start = start_addr; 899 unsigned long start = start_addr;
882 spinlock_t *i_mmap_lock = details? details->i_mmap_lock: NULL; 900 spinlock_t *i_mmap_lock = details? details->i_mmap_lock: NULL;
883 int fullmm = (*tlbp)->fullmm; 901 int fullmm = (*tlbp)->fullmm;
902 struct mm_struct *mm = vma->vm_mm;
884 903
904 mmu_notifier_invalidate_range_start(mm, start_addr, end_addr);
885 for ( ; vma && vma->vm_start < end_addr; vma = vma->vm_next) { 905 for ( ; vma && vma->vm_start < end_addr; vma = vma->vm_next) {
886 unsigned long end; 906 unsigned long end;
887 907
@@ -946,6 +966,7 @@ unsigned long unmap_vmas(struct mmu_gather **tlbp,
946 } 966 }
947 } 967 }
948out: 968out:
969 mmu_notifier_invalidate_range_end(mm, start_addr, end_addr);
949 return start; /* which is now the end (or restart) address */ 970 return start; /* which is now the end (or restart) address */
950} 971}
951 972
@@ -972,6 +993,30 @@ unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
972 tlb_finish_mmu(tlb, address, end); 993 tlb_finish_mmu(tlb, address, end);
973 return end; 994 return end;
974} 995}
996EXPORT_SYMBOL_GPL(zap_page_range);
997
998/**
999 * zap_vma_ptes - remove ptes mapping the vma
1000 * @vma: vm_area_struct holding ptes to be zapped
1001 * @address: starting address of pages to zap
1002 * @size: number of bytes to zap
1003 *
1004 * This function only unmaps ptes assigned to VM_PFNMAP vmas.
1005 *
1006 * The entire address range must be fully contained within the vma.
1007 *
1008 * Returns 0 if successful.
1009 */
1010int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
1011 unsigned long size)
1012{
1013 if (address < vma->vm_start || address + size > vma->vm_end ||
1014 !(vma->vm_flags & VM_PFNMAP))
1015 return -1;
1016 zap_page_range(vma, address, size, NULL);
1017 return 0;
1018}
1019EXPORT_SYMBOL_GPL(zap_vma_ptes);
975 1020
976/* 1021/*
977 * Do a quick page-table lookup for a single page. 1022 * Do a quick page-table lookup for a single page.
@@ -1066,6 +1111,7 @@ no_page_table:
1066 } 1111 }
1067 return page; 1112 return page;
1068} 1113}
1114EXPORT_SYMBOL_GPL(follow_page);
1069 1115
1070/* Can we do the FOLL_ANON optimization? */ 1116/* Can we do the FOLL_ANON optimization? */
1071static inline int use_zero_page(struct vm_area_struct *vma) 1117static inline int use_zero_page(struct vm_area_struct *vma)
@@ -1616,10 +1662,11 @@ int apply_to_page_range(struct mm_struct *mm, unsigned long addr,
1616{ 1662{
1617 pgd_t *pgd; 1663 pgd_t *pgd;
1618 unsigned long next; 1664 unsigned long next;
1619 unsigned long end = addr + size; 1665 unsigned long start = addr, end = addr + size;
1620 int err; 1666 int err;
1621 1667
1622 BUG_ON(addr >= end); 1668 BUG_ON(addr >= end);
1669 mmu_notifier_invalidate_range_start(mm, start, end);
1623 pgd = pgd_offset(mm, addr); 1670 pgd = pgd_offset(mm, addr);
1624 do { 1671 do {
1625 next = pgd_addr_end(addr, end); 1672 next = pgd_addr_end(addr, end);
@@ -1627,6 +1674,7 @@ int apply_to_page_range(struct mm_struct *mm, unsigned long addr,
1627 if (err) 1674 if (err)
1628 break; 1675 break;
1629 } while (pgd++, addr = next, addr != end); 1676 } while (pgd++, addr = next, addr != end);
1677 mmu_notifier_invalidate_range_end(mm, start, end);
1630 return err; 1678 return err;
1631} 1679}
1632EXPORT_SYMBOL_GPL(apply_to_page_range); 1680EXPORT_SYMBOL_GPL(apply_to_page_range);
@@ -1839,7 +1887,7 @@ gotten:
1839 * seen in the presence of one thread doing SMC and another 1887 * seen in the presence of one thread doing SMC and another
1840 * thread doing COW. 1888 * thread doing COW.
1841 */ 1889 */
1842 ptep_clear_flush(vma, address, page_table); 1890 ptep_clear_flush_notify(vma, address, page_table);
1843 set_pte_at(mm, address, page_table, entry); 1891 set_pte_at(mm, address, page_table, entry);
1844 update_mmu_cache(vma, address, entry); 1892 update_mmu_cache(vma, address, entry);
1845 lru_cache_add_active(new_page); 1893 lru_cache_add_active(new_page);
diff --git a/mm/mmap.c b/mm/mmap.c
index 5e0cc99e9cd5..245c3d69067b 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -26,6 +26,7 @@
26#include <linux/mount.h> 26#include <linux/mount.h>
27#include <linux/mempolicy.h> 27#include <linux/mempolicy.h>
28#include <linux/rmap.h> 28#include <linux/rmap.h>
29#include <linux/mmu_notifier.h>
29 30
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
31#include <asm/cacheflush.h> 32#include <asm/cacheflush.h>
@@ -2061,6 +2062,7 @@ void exit_mmap(struct mm_struct *mm)
2061 2062
2062 /* mm's last user has gone, and its about to be pulled down */ 2063 /* mm's last user has gone, and its about to be pulled down */
2063 arch_exit_mmap(mm); 2064 arch_exit_mmap(mm);
2065 mmu_notifier_release(mm);
2064 2066
2065 lru_add_drain(); 2067 lru_add_drain();
2066 flush_cache_mm(mm); 2068 flush_cache_mm(mm);
@@ -2268,3 +2270,161 @@ int install_special_mapping(struct mm_struct *mm,
2268 2270
2269 return 0; 2271 return 0;
2270} 2272}
2273
2274static DEFINE_MUTEX(mm_all_locks_mutex);
2275
2276static void vm_lock_anon_vma(struct anon_vma *anon_vma)
2277{
2278 if (!test_bit(0, (unsigned long *) &anon_vma->head.next)) {
2279 /*
2280 * The LSB of head.next can't change from under us
2281 * because we hold the mm_all_locks_mutex.
2282 */
2283 spin_lock(&anon_vma->lock);
2284 /*
2285 * We can safely modify head.next after taking the
2286 * anon_vma->lock. If some other vma in this mm shares
2287 * the same anon_vma we won't take it again.
2288 *
2289 * No need of atomic instructions here, head.next
2290 * can't change from under us thanks to the
2291 * anon_vma->lock.
2292 */
2293 if (__test_and_set_bit(0, (unsigned long *)
2294 &anon_vma->head.next))
2295 BUG();
2296 }
2297}
2298
2299static void vm_lock_mapping(struct address_space *mapping)
2300{
2301 if (!test_bit(AS_MM_ALL_LOCKS, &mapping->flags)) {
2302 /*
2303 * AS_MM_ALL_LOCKS can't change from under us because
2304 * we hold the mm_all_locks_mutex.
2305 *
2306 * Operations on ->flags have to be atomic because
2307 * even if AS_MM_ALL_LOCKS is stable thanks to the
2308 * mm_all_locks_mutex, there may be other cpus
2309 * changing other bitflags in parallel to us.
2310 */
2311 if (test_and_set_bit(AS_MM_ALL_LOCKS, &mapping->flags))
2312 BUG();
2313 spin_lock(&mapping->i_mmap_lock);
2314 }
2315}
2316
2317/*
2318 * This operation locks against the VM for all pte/vma/mm related
2319 * operations that could ever happen on a certain mm. This includes
2320 * vmtruncate, try_to_unmap, and all page faults.
2321 *
2322 * The caller must take the mmap_sem in write mode before calling
2323 * mm_take_all_locks(). The caller isn't allowed to release the
2324 * mmap_sem until mm_drop_all_locks() returns.
2325 *
2326 * mmap_sem in write mode is required in order to block all operations
2327 * that could modify pagetables and free pages without need of
2328 * altering the vma layout (for example populate_range() with
2329 * nonlinear vmas). It's also needed in write mode to avoid new
2330 * anon_vmas to be associated with existing vmas.
2331 *
2332 * A single task can't take more than one mm_take_all_locks() in a row
2333 * or it would deadlock.
2334 *
2335 * The LSB in anon_vma->head.next and the AS_MM_ALL_LOCKS bitflag in
2336 * mapping->flags avoid to take the same lock twice, if more than one
2337 * vma in this mm is backed by the same anon_vma or address_space.
2338 *
2339 * We can take all the locks in random order because the VM code
2340 * taking i_mmap_lock or anon_vma->lock outside the mmap_sem never
2341 * takes more than one of them in a row. Secondly we're protected
2342 * against a concurrent mm_take_all_locks() by the mm_all_locks_mutex.
2343 *
2344 * mm_take_all_locks() and mm_drop_all_locks are expensive operations
2345 * that may have to take thousand of locks.
2346 *
2347 * mm_take_all_locks() can fail if it's interrupted by signals.
2348 */
2349int mm_take_all_locks(struct mm_struct *mm)
2350{
2351 struct vm_area_struct *vma;
2352 int ret = -EINTR;
2353
2354 BUG_ON(down_read_trylock(&mm->mmap_sem));
2355
2356 mutex_lock(&mm_all_locks_mutex);
2357
2358 for (vma = mm->mmap; vma; vma = vma->vm_next) {
2359 if (signal_pending(current))
2360 goto out_unlock;
2361 if (vma->anon_vma)
2362 vm_lock_anon_vma(vma->anon_vma);
2363 if (vma->vm_file && vma->vm_file->f_mapping)
2364 vm_lock_mapping(vma->vm_file->f_mapping);
2365 }
2366 ret = 0;
2367
2368out_unlock:
2369 if (ret)
2370 mm_drop_all_locks(mm);
2371
2372 return ret;
2373}
2374
2375static void vm_unlock_anon_vma(struct anon_vma *anon_vma)
2376{
2377 if (test_bit(0, (unsigned long *) &anon_vma->head.next)) {
2378 /*
2379 * The LSB of head.next can't change to 0 from under
2380 * us because we hold the mm_all_locks_mutex.
2381 *
2382 * We must however clear the bitflag before unlocking
2383 * the vma so the users using the anon_vma->head will
2384 * never see our bitflag.
2385 *
2386 * No need of atomic instructions here, head.next
2387 * can't change from under us until we release the
2388 * anon_vma->lock.
2389 */
2390 if (!__test_and_clear_bit(0, (unsigned long *)
2391 &anon_vma->head.next))
2392 BUG();
2393 spin_unlock(&anon_vma->lock);
2394 }
2395}
2396
2397static void vm_unlock_mapping(struct address_space *mapping)
2398{
2399 if (test_bit(AS_MM_ALL_LOCKS, &mapping->flags)) {
2400 /*
2401 * AS_MM_ALL_LOCKS can't change to 0 from under us
2402 * because we hold the mm_all_locks_mutex.
2403 */
2404 spin_unlock(&mapping->i_mmap_lock);
2405 if (!test_and_clear_bit(AS_MM_ALL_LOCKS,
2406 &mapping->flags))
2407 BUG();
2408 }
2409}
2410
2411/*
2412 * The mmap_sem cannot be released by the caller until
2413 * mm_drop_all_locks() returns.
2414 */
2415void mm_drop_all_locks(struct mm_struct *mm)
2416{
2417 struct vm_area_struct *vma;
2418
2419 BUG_ON(down_read_trylock(&mm->mmap_sem));
2420 BUG_ON(!mutex_is_locked(&mm_all_locks_mutex));
2421
2422 for (vma = mm->mmap; vma; vma = vma->vm_next) {
2423 if (vma->anon_vma)
2424 vm_unlock_anon_vma(vma->anon_vma);
2425 if (vma->vm_file && vma->vm_file->f_mapping)
2426 vm_unlock_mapping(vma->vm_file->f_mapping);
2427 }
2428
2429 mutex_unlock(&mm_all_locks_mutex);
2430}
diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
new file mode 100644
index 000000000000..5f4ef0250bee
--- /dev/null
+++ b/mm/mmu_notifier.c
@@ -0,0 +1,277 @@
1/*
2 * linux/mm/mmu_notifier.c
3 *
4 * Copyright (C) 2008 Qumranet, Inc.
5 * Copyright (C) 2008 SGI
6 * Christoph Lameter <clameter@sgi.com>
7 *
8 * This work is licensed under the terms of the GNU GPL, version 2. See
9 * the COPYING file in the top-level directory.
10 */
11
12#include <linux/rculist.h>
13#include <linux/mmu_notifier.h>
14#include <linux/module.h>
15#include <linux/mm.h>
16#include <linux/err.h>
17#include <linux/rcupdate.h>
18#include <linux/sched.h>
19
20/*
21 * This function can't run concurrently against mmu_notifier_register
22 * because mm->mm_users > 0 during mmu_notifier_register and exit_mmap
23 * runs with mm_users == 0. Other tasks may still invoke mmu notifiers
24 * in parallel despite there being no task using this mm any more,
25 * through the vmas outside of the exit_mmap context, such as with
26 * vmtruncate. This serializes against mmu_notifier_unregister with
27 * the mmu_notifier_mm->lock in addition to RCU and it serializes
28 * against the other mmu notifiers with RCU. struct mmu_notifier_mm
29 * can't go away from under us as exit_mmap holds an mm_count pin
30 * itself.
31 */
32void __mmu_notifier_release(struct mm_struct *mm)
33{
34 struct mmu_notifier *mn;
35
36 spin_lock(&mm->mmu_notifier_mm->lock);
37 while (unlikely(!hlist_empty(&mm->mmu_notifier_mm->list))) {
38 mn = hlist_entry(mm->mmu_notifier_mm->list.first,
39 struct mmu_notifier,
40 hlist);
41 /*
42 * We arrived before mmu_notifier_unregister so
43 * mmu_notifier_unregister will do nothing other than
44 * to wait ->release to finish and
45 * mmu_notifier_unregister to return.
46 */
47 hlist_del_init_rcu(&mn->hlist);
48 /*
49 * RCU here will block mmu_notifier_unregister until
50 * ->release returns.
51 */
52 rcu_read_lock();
53 spin_unlock(&mm->mmu_notifier_mm->lock);
54 /*
55 * if ->release runs before mmu_notifier_unregister it
56 * must be handled as it's the only way for the driver
57 * to flush all existing sptes and stop the driver
58 * from establishing any more sptes before all the
59 * pages in the mm are freed.
60 */
61 if (mn->ops->release)
62 mn->ops->release(mn, mm);
63 rcu_read_unlock();
64 spin_lock(&mm->mmu_notifier_mm->lock);
65 }
66 spin_unlock(&mm->mmu_notifier_mm->lock);
67
68 /*
69 * synchronize_rcu here prevents mmu_notifier_release to
70 * return to exit_mmap (which would proceed freeing all pages
71 * in the mm) until the ->release method returns, if it was
72 * invoked by mmu_notifier_unregister.
73 *
74 * The mmu_notifier_mm can't go away from under us because one
75 * mm_count is hold by exit_mmap.
76 */
77 synchronize_rcu();
78}
79
80/*
81 * If no young bitflag is supported by the hardware, ->clear_flush_young can
82 * unmap the address and return 1 or 0 depending if the mapping previously
83 * existed or not.
84 */
85int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
86 unsigned long address)
87{
88 struct mmu_notifier *mn;
89 struct hlist_node *n;
90 int young = 0;
91
92 rcu_read_lock();
93 hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_mm->list, hlist) {
94 if (mn->ops->clear_flush_young)
95 young |= mn->ops->clear_flush_young(mn, mm, address);
96 }
97 rcu_read_unlock();
98
99 return young;
100}
101
102void __mmu_notifier_invalidate_page(struct mm_struct *mm,
103 unsigned long address)
104{
105 struct mmu_notifier *mn;
106 struct hlist_node *n;
107
108 rcu_read_lock();
109 hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_mm->list, hlist) {
110 if (mn->ops->invalidate_page)
111 mn->ops->invalidate_page(mn, mm, address);
112 }
113 rcu_read_unlock();
114}
115
116void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
117 unsigned long start, unsigned long end)
118{
119 struct mmu_notifier *mn;
120 struct hlist_node *n;
121
122 rcu_read_lock();
123 hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_mm->list, hlist) {
124 if (mn->ops->invalidate_range_start)
125 mn->ops->invalidate_range_start(mn, mm, start, end);
126 }
127 rcu_read_unlock();
128}
129
130void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
131 unsigned long start, unsigned long end)
132{
133 struct mmu_notifier *mn;
134 struct hlist_node *n;
135
136 rcu_read_lock();
137 hlist_for_each_entry_rcu(mn, n, &mm->mmu_notifier_mm->list, hlist) {
138 if (mn->ops->invalidate_range_end)
139 mn->ops->invalidate_range_end(mn, mm, start, end);
140 }
141 rcu_read_unlock();
142}
143
144static int do_mmu_notifier_register(struct mmu_notifier *mn,
145 struct mm_struct *mm,
146 int take_mmap_sem)
147{
148 struct mmu_notifier_mm *mmu_notifier_mm;
149 int ret;
150
151 BUG_ON(atomic_read(&mm->mm_users) <= 0);
152
153 ret = -ENOMEM;
154 mmu_notifier_mm = kmalloc(sizeof(struct mmu_notifier_mm), GFP_KERNEL);
155 if (unlikely(!mmu_notifier_mm))
156 goto out;
157
158 if (take_mmap_sem)
159 down_write(&mm->mmap_sem);
160 ret = mm_take_all_locks(mm);
161 if (unlikely(ret))
162 goto out_cleanup;
163
164 if (!mm_has_notifiers(mm)) {
165 INIT_HLIST_HEAD(&mmu_notifier_mm->list);
166 spin_lock_init(&mmu_notifier_mm->lock);
167 mm->mmu_notifier_mm = mmu_notifier_mm;
168 mmu_notifier_mm = NULL;
169 }
170 atomic_inc(&mm->mm_count);
171
172 /*
173 * Serialize the update against mmu_notifier_unregister. A
174 * side note: mmu_notifier_release can't run concurrently with
175 * us because we hold the mm_users pin (either implicitly as
176 * current->mm or explicitly with get_task_mm() or similar).
177 * We can't race against any other mmu notifier method either
178 * thanks to mm_take_all_locks().
179 */
180 spin_lock(&mm->mmu_notifier_mm->lock);
181 hlist_add_head(&mn->hlist, &mm->mmu_notifier_mm->list);
182 spin_unlock(&mm->mmu_notifier_mm->lock);
183
184 mm_drop_all_locks(mm);
185out_cleanup:
186 if (take_mmap_sem)
187 up_write(&mm->mmap_sem);
188 /* kfree() does nothing if mmu_notifier_mm is NULL */
189 kfree(mmu_notifier_mm);
190out:
191 BUG_ON(atomic_read(&mm->mm_users) <= 0);
192 return ret;
193}
194
195/*
196 * Must not hold mmap_sem nor any other VM related lock when calling
197 * this registration function. Must also ensure mm_users can't go down
198 * to zero while this runs to avoid races with mmu_notifier_release,
199 * so mm has to be current->mm or the mm should be pinned safely such
200 * as with get_task_mm(). If the mm is not current->mm, the mm_users
201 * pin should be released by calling mmput after mmu_notifier_register
202 * returns. mmu_notifier_unregister must be always called to
203 * unregister the notifier. mm_count is automatically pinned to allow
204 * mmu_notifier_unregister to safely run at any time later, before or
205 * after exit_mmap. ->release will always be called before exit_mmap
206 * frees the pages.
207 */
208int mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm)
209{
210 return do_mmu_notifier_register(mn, mm, 1);
211}
212EXPORT_SYMBOL_GPL(mmu_notifier_register);
213
214/*
215 * Same as mmu_notifier_register but here the caller must hold the
216 * mmap_sem in write mode.
217 */
218int __mmu_notifier_register(struct mmu_notifier *mn, struct mm_struct *mm)
219{
220 return do_mmu_notifier_register(mn, mm, 0);
221}
222EXPORT_SYMBOL_GPL(__mmu_notifier_register);
223
224/* this is called after the last mmu_notifier_unregister() returned */
225void __mmu_notifier_mm_destroy(struct mm_struct *mm)
226{
227 BUG_ON(!hlist_empty(&mm->mmu_notifier_mm->list));
228 kfree(mm->mmu_notifier_mm);
229 mm->mmu_notifier_mm = LIST_POISON1; /* debug */
230}
231
232/*
233 * This releases the mm_count pin automatically and frees the mm
234 * structure if it was the last user of it. It serializes against
235 * running mmu notifiers with RCU and against mmu_notifier_unregister
236 * with the unregister lock + RCU. All sptes must be dropped before
237 * calling mmu_notifier_unregister. ->release or any other notifier
238 * method may be invoked concurrently with mmu_notifier_unregister,
239 * and only after mmu_notifier_unregister returned we're guaranteed
240 * that ->release or any other method can't run anymore.
241 */
242void mmu_notifier_unregister(struct mmu_notifier *mn, struct mm_struct *mm)
243{
244 BUG_ON(atomic_read(&mm->mm_count) <= 0);
245
246 spin_lock(&mm->mmu_notifier_mm->lock);
247 if (!hlist_unhashed(&mn->hlist)) {
248 hlist_del_rcu(&mn->hlist);
249
250 /*
251 * RCU here will force exit_mmap to wait ->release to finish
252 * before freeing the pages.
253 */
254 rcu_read_lock();
255 spin_unlock(&mm->mmu_notifier_mm->lock);
256 /*
257 * exit_mmap will block in mmu_notifier_release to
258 * guarantee ->release is called before freeing the
259 * pages.
260 */
261 if (mn->ops->release)
262 mn->ops->release(mn, mm);
263 rcu_read_unlock();
264 } else
265 spin_unlock(&mm->mmu_notifier_mm->lock);
266
267 /*
268 * Wait any running method to finish, of course including
269 * ->release if it was run by mmu_notifier_relase instead of us.
270 */
271 synchronize_rcu();
272
273 BUG_ON(atomic_read(&mm->mm_count) <= 0);
274
275 mmdrop(mm);
276}
277EXPORT_SYMBOL_GPL(mmu_notifier_unregister);
diff --git a/mm/mprotect.c b/mm/mprotect.c
index abd645a3b0a0..fded06f923f4 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -21,6 +21,7 @@
21#include <linux/syscalls.h> 21#include <linux/syscalls.h>
22#include <linux/swap.h> 22#include <linux/swap.h>
23#include <linux/swapops.h> 23#include <linux/swapops.h>
24#include <linux/mmu_notifier.h>
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
25#include <asm/pgtable.h> 26#include <asm/pgtable.h>
26#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
@@ -203,10 +204,12 @@ success:
203 dirty_accountable = 1; 204 dirty_accountable = 1;
204 } 205 }
205 206
207 mmu_notifier_invalidate_range_start(mm, start, end);
206 if (is_vm_hugetlb_page(vma)) 208 if (is_vm_hugetlb_page(vma))
207 hugetlb_change_protection(vma, start, end, vma->vm_page_prot); 209 hugetlb_change_protection(vma, start, end, vma->vm_page_prot);
208 else 210 else
209 change_protection(vma, start, end, vma->vm_page_prot, dirty_accountable); 211 change_protection(vma, start, end, vma->vm_page_prot, dirty_accountable);
212 mmu_notifier_invalidate_range_end(mm, start, end);
210 vm_stat_account(mm, oldflags, vma->vm_file, -nrpages); 213 vm_stat_account(mm, oldflags, vma->vm_file, -nrpages);
211 vm_stat_account(mm, newflags, vma->vm_file, nrpages); 214 vm_stat_account(mm, newflags, vma->vm_file, nrpages);
212 return 0; 215 return 0;
diff --git a/mm/mremap.c b/mm/mremap.c
index 08e3c7f2bd15..1a7743923c8c 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -18,6 +18,7 @@
18#include <linux/highmem.h> 18#include <linux/highmem.h>
19#include <linux/security.h> 19#include <linux/security.h>
20#include <linux/syscalls.h> 20#include <linux/syscalls.h>
21#include <linux/mmu_notifier.h>
21 22
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
23#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
@@ -74,7 +75,11 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
74 struct mm_struct *mm = vma->vm_mm; 75 struct mm_struct *mm = vma->vm_mm;
75 pte_t *old_pte, *new_pte, pte; 76 pte_t *old_pte, *new_pte, pte;
76 spinlock_t *old_ptl, *new_ptl; 77 spinlock_t *old_ptl, *new_ptl;
78 unsigned long old_start;
77 79
80 old_start = old_addr;
81 mmu_notifier_invalidate_range_start(vma->vm_mm,
82 old_start, old_end);
78 if (vma->vm_file) { 83 if (vma->vm_file) {
79 /* 84 /*
80 * Subtle point from Rajesh Venkatasubramanian: before 85 * Subtle point from Rajesh Venkatasubramanian: before
@@ -116,6 +121,7 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
116 pte_unmap_unlock(old_pte - 1, old_ptl); 121 pte_unmap_unlock(old_pte - 1, old_ptl);
117 if (mapping) 122 if (mapping)
118 spin_unlock(&mapping->i_mmap_lock); 123 spin_unlock(&mapping->i_mmap_lock);
124 mmu_notifier_invalidate_range_end(vma->vm_mm, old_start, old_end);
119} 125}
120 126
121#define LATENCY_LIMIT (64 * PAGE_SIZE) 127#define LATENCY_LIMIT (64 * PAGE_SIZE)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6da667274df5..401d104d2bb6 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2372,7 +2372,7 @@ static void build_zonelist_cache(pg_data_t *pgdat)
2372 2372
2373#endif /* CONFIG_NUMA */ 2373#endif /* CONFIG_NUMA */
2374 2374
2375/* return values int ....just for stop_machine_run() */ 2375/* return values int ....just for stop_machine() */
2376static int __build_all_zonelists(void *dummy) 2376static int __build_all_zonelists(void *dummy)
2377{ 2377{
2378 int nid; 2378 int nid;
@@ -2397,7 +2397,7 @@ void build_all_zonelists(void)
2397 } else { 2397 } else {
2398 /* we have to stop all cpus to guarantee there is no user 2398 /* we have to stop all cpus to guarantee there is no user
2399 of zonelist */ 2399 of zonelist */
2400 stop_machine_run(__build_all_zonelists, NULL, NR_CPUS); 2400 stop_machine(__build_all_zonelists, NULL, NULL);
2401 /* cpuset refresh routine should be here */ 2401 /* cpuset refresh routine should be here */
2402 } 2402 }
2403 vm_total_pages = nr_free_pagecache_pages(); 2403 vm_total_pages = nr_free_pagecache_pages();
@@ -3753,23 +3753,6 @@ unsigned long __init find_min_pfn_with_active_regions(void)
3753 return find_min_pfn_for_node(MAX_NUMNODES); 3753 return find_min_pfn_for_node(MAX_NUMNODES);
3754} 3754}
3755 3755
3756/**
3757 * find_max_pfn_with_active_regions - Find the maximum PFN registered
3758 *
3759 * It returns the maximum PFN based on information provided via
3760 * add_active_range().
3761 */
3762unsigned long __init find_max_pfn_with_active_regions(void)
3763{
3764 int i;
3765 unsigned long max_pfn = 0;
3766
3767 for (i = 0; i < nr_nodemap_entries; i++)
3768 max_pfn = max(max_pfn, early_node_map[i].end_pfn);
3769
3770 return max_pfn;
3771}
3772
3773/* 3756/*
3774 * early_calculate_totalpages() 3757 * early_calculate_totalpages()
3775 * Sum pages in active regions for movable zone. 3758 * Sum pages in active regions for movable zone.
diff --git a/mm/rmap.c b/mm/rmap.c
index 39ae5a9bf382..94a5246a3f98 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -49,6 +49,7 @@
49#include <linux/module.h> 49#include <linux/module.h>
50#include <linux/kallsyms.h> 50#include <linux/kallsyms.h>
51#include <linux/memcontrol.h> 51#include <linux/memcontrol.h>
52#include <linux/mmu_notifier.h>
52 53
53#include <asm/tlbflush.h> 54#include <asm/tlbflush.h>
54 55
@@ -287,7 +288,7 @@ static int page_referenced_one(struct page *page,
287 if (vma->vm_flags & VM_LOCKED) { 288 if (vma->vm_flags & VM_LOCKED) {
288 referenced++; 289 referenced++;
289 *mapcount = 1; /* break early from loop */ 290 *mapcount = 1; /* break early from loop */
290 } else if (ptep_clear_flush_young(vma, address, pte)) 291 } else if (ptep_clear_flush_young_notify(vma, address, pte))
291 referenced++; 292 referenced++;
292 293
293 /* Pretend the page is referenced if the task has the 294 /* Pretend the page is referenced if the task has the
@@ -457,7 +458,7 @@ static int page_mkclean_one(struct page *page, struct vm_area_struct *vma)
457 pte_t entry; 458 pte_t entry;
458 459
459 flush_cache_page(vma, address, pte_pfn(*pte)); 460 flush_cache_page(vma, address, pte_pfn(*pte));
460 entry = ptep_clear_flush(vma, address, pte); 461 entry = ptep_clear_flush_notify(vma, address, pte);
461 entry = pte_wrprotect(entry); 462 entry = pte_wrprotect(entry);
462 entry = pte_mkclean(entry); 463 entry = pte_mkclean(entry);
463 set_pte_at(mm, address, pte, entry); 464 set_pte_at(mm, address, pte, entry);
@@ -666,7 +667,8 @@ void page_remove_rmap(struct page *page, struct vm_area_struct *vma)
666 * Leaving it set also helps swapoff to reinstate ptes 667 * Leaving it set also helps swapoff to reinstate ptes
667 * faster for those pages still in swapcache. 668 * faster for those pages still in swapcache.
668 */ 669 */
669 if (page_test_dirty(page)) { 670 if ((!PageAnon(page) || PageSwapCache(page)) &&
671 page_test_dirty(page)) {
670 page_clear_dirty(page); 672 page_clear_dirty(page);
671 set_page_dirty(page); 673 set_page_dirty(page);
672 } 674 }
@@ -705,14 +707,14 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
705 * skipped over this mm) then we should reactivate it. 707 * skipped over this mm) then we should reactivate it.
706 */ 708 */
707 if (!migration && ((vma->vm_flags & VM_LOCKED) || 709 if (!migration && ((vma->vm_flags & VM_LOCKED) ||
708 (ptep_clear_flush_young(vma, address, pte)))) { 710 (ptep_clear_flush_young_notify(vma, address, pte)))) {
709 ret = SWAP_FAIL; 711 ret = SWAP_FAIL;
710 goto out_unmap; 712 goto out_unmap;
711 } 713 }
712 714
713 /* Nuke the page table entry. */ 715 /* Nuke the page table entry. */
714 flush_cache_page(vma, address, page_to_pfn(page)); 716 flush_cache_page(vma, address, page_to_pfn(page));
715 pteval = ptep_clear_flush(vma, address, pte); 717 pteval = ptep_clear_flush_notify(vma, address, pte);
716 718
717 /* Move the dirty bit to the physical page now the pte is gone. */ 719 /* Move the dirty bit to the physical page now the pte is gone. */
718 if (pte_dirty(pteval)) 720 if (pte_dirty(pteval))
@@ -837,12 +839,12 @@ static void try_to_unmap_cluster(unsigned long cursor,
837 page = vm_normal_page(vma, address, *pte); 839 page = vm_normal_page(vma, address, *pte);
838 BUG_ON(!page || PageAnon(page)); 840 BUG_ON(!page || PageAnon(page));
839 841
840 if (ptep_clear_flush_young(vma, address, pte)) 842 if (ptep_clear_flush_young_notify(vma, address, pte))
841 continue; 843 continue;
842 844
843 /* Nuke the page table entry. */ 845 /* Nuke the page table entry. */
844 flush_cache_page(vma, address, pte_pfn(*pte)); 846 flush_cache_page(vma, address, pte_pfn(*pte));
845 pteval = ptep_clear_flush(vma, address, pte); 847 pteval = ptep_clear_flush_notify(vma, address, pte);
846 848
847 /* If nonlinear, store the file page offset in the pte. */ 849 /* If nonlinear, store the file page offset in the pte. */
848 if (page->index != linear_page_index(vma, address)) 850 if (page->index != linear_page_index(vma, address))
diff --git a/mm/shmem.c b/mm/shmem.c
index 952d361774bb..c1e5a3b4f758 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1513,7 +1513,6 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev)
1513 inode->i_uid = current->fsuid; 1513 inode->i_uid = current->fsuid;
1514 inode->i_gid = current->fsgid; 1514 inode->i_gid = current->fsgid;
1515 inode->i_blocks = 0; 1515 inode->i_blocks = 0;
1516 inode->i_mapping->a_ops = &shmem_aops;
1517 inode->i_mapping->backing_dev_info = &shmem_backing_dev_info; 1516 inode->i_mapping->backing_dev_info = &shmem_backing_dev_info;
1518 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 1517 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
1519 inode->i_generation = get_seconds(); 1518 inode->i_generation = get_seconds();
@@ -1528,6 +1527,7 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev)
1528 init_special_inode(inode, mode, dev); 1527 init_special_inode(inode, mode, dev);
1529 break; 1528 break;
1530 case S_IFREG: 1529 case S_IFREG:
1530 inode->i_mapping->a_ops = &shmem_aops;
1531 inode->i_op = &shmem_inode_operations; 1531 inode->i_op = &shmem_inode_operations;
1532 inode->i_fop = &shmem_file_operations; 1532 inode->i_fop = &shmem_file_operations;
1533 mpol_shared_policy_init(&info->policy, 1533 mpol_shared_policy_init(&info->policy,
@@ -1929,6 +1929,7 @@ static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *s
1929 return error; 1929 return error;
1930 } 1930 }
1931 unlock_page(page); 1931 unlock_page(page);
1932 inode->i_mapping->a_ops = &shmem_aops;
1932 inode->i_op = &shmem_symlink_inode_operations; 1933 inode->i_op = &shmem_symlink_inode_operations;
1933 kaddr = kmap_atomic(page, KM_USER0); 1934 kaddr = kmap_atomic(page, KM_USER0);
1934 memcpy(kaddr, symname, len); 1935 memcpy(kaddr, symname, len);
diff --git a/mm/swap.c b/mm/swap.c
index dd89234ee51f..7417a2adbe50 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -278,9 +278,10 @@ int lru_add_drain_all(void)
278 * Avoid taking zone->lru_lock if possible, but if it is taken, retain it 278 * Avoid taking zone->lru_lock if possible, but if it is taken, retain it
279 * for the remainder of the operation. 279 * for the remainder of the operation.
280 * 280 *
281 * The locking in this function is against shrink_cache(): we recheck the 281 * The locking in this function is against shrink_inactive_list(): we recheck
282 * page count inside the lock to see whether shrink_cache grabbed the page 282 * the page count inside the lock to see whether shrink_inactive_list()
283 * via the LRU. If it did, give up: shrink_cache will free it. 283 * grabbed the page via the LRU. If it did, give up: shrink_inactive_list()
284 * will free it.
284 */ 285 */
285void release_pages(struct page **pages, int nr, int cold) 286void release_pages(struct page **pages, int nr, int cold)
286{ 287{
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 6beb6251e99d..bb7f79641f9e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -656,8 +656,8 @@ static int unuse_mm(struct mm_struct *mm,
656 656
657 if (!down_read_trylock(&mm->mmap_sem)) { 657 if (!down_read_trylock(&mm->mmap_sem)) {
658 /* 658 /*
659 * Activate page so shrink_cache is unlikely to unmap its 659 * Activate page so shrink_inactive_list is unlikely to unmap
660 * ptes while lock is dropped, so swapoff can make progress. 660 * its ptes while lock is dropped, so swapoff can make progress.
661 */ 661 */
662 activate_page(page); 662 activate_page(page);
663 unlock_page(page); 663 unlock_page(page);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 8f71761bc4b7..75be453628bf 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1408,7 +1408,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
1408 if (sc->nr_scanned && priority < DEF_PRIORITY - 2) 1408 if (sc->nr_scanned && priority < DEF_PRIORITY - 2)
1409 congestion_wait(WRITE, HZ/10); 1409 congestion_wait(WRITE, HZ/10);
1410 } 1410 }
1411 /* top priority shrink_caches still had more to do? don't OOM, then */ 1411 /* top priority shrink_zones still had more to do? don't OOM, then */
1412 if (!sc->all_unreclaimable && scan_global_lru(sc)) 1412 if (!sc->all_unreclaimable && scan_global_lru(sc))
1413 ret = nr_reclaimed; 1413 ret = nr_reclaimed;
1414out: 1414out:
@@ -1979,7 +1979,7 @@ module_init(kswapd_init)
1979int zone_reclaim_mode __read_mostly; 1979int zone_reclaim_mode __read_mostly;
1980 1980
1981#define RECLAIM_OFF 0 1981#define RECLAIM_OFF 0
1982#define RECLAIM_ZONE (1<<0) /* Run shrink_cache on the zone */ 1982#define RECLAIM_ZONE (1<<0) /* Run shrink_inactive_list on the zone */
1983#define RECLAIM_WRITE (1<<1) /* Writeout pages during reclaim */ 1983#define RECLAIM_WRITE (1<<1) /* Writeout pages during reclaim */
1984#define RECLAIM_SWAP (1<<2) /* Swap pages out during reclaim */ 1984#define RECLAIM_SWAP (1<<2) /* Swap pages out during reclaim */
1985 1985
diff --git a/net/Kconfig b/net/Kconfig
index b98668751749..7612cc8c337c 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -2,9 +2,7 @@
2# Network configuration 2# Network configuration
3# 3#
4 4
5menu "Networking" 5menuconfig NET
6
7config NET
8 bool "Networking support" 6 bool "Networking support"
9 ---help--- 7 ---help---
10 Unless you really know what you are doing, you should say Y here. 8 Unless you really know what you are doing, you should say Y here.
@@ -22,7 +20,6 @@ config NET
22 recommended to read the NET-HOWTO, available from 20 recommended to read the NET-HOWTO, available from
23 <http://www.tldp.org/docs.html#howto>. 21 <http://www.tldp.org/docs.html#howto>.
24 22
25# Make sure that all config symbols are dependent on NET
26if NET 23if NET
27 24
28menu "Networking options" 25menu "Networking options"
@@ -252,5 +249,3 @@ source "net/rfkill/Kconfig"
252source "net/9p/Kconfig" 249source "net/9p/Kconfig"
253 250
254endif # if NET 251endif # if NET
255endmenu # Networking
256
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 4fccaa1e07be..11b16d16661c 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -62,11 +62,13 @@ static void MPOA_cache_impos_rcvd(struct k_message *msg, struct mpoa_client *mpc
62static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); 62static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc);
63static void set_mps_mac_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc); 63static void set_mps_mac_addr_rcvd(struct k_message *mesg, struct mpoa_client *mpc);
64 64
65static uint8_t *copy_macs(struct mpoa_client *mpc, uint8_t *router_mac, 65static const uint8_t *copy_macs(struct mpoa_client *mpc,
66 uint8_t *tlvs, uint8_t mps_macs, uint8_t device_type); 66 const uint8_t *router_mac,
67 const uint8_t *tlvs, uint8_t mps_macs,
68 uint8_t device_type);
67static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry); 69static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry);
68 70
69static void send_set_mps_ctrl_addr(char *addr, struct mpoa_client *mpc); 71static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc);
70static void mpoad_close(struct atm_vcc *vcc); 72static void mpoad_close(struct atm_vcc *vcc);
71static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb); 73static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb);
72 74
@@ -351,12 +353,12 @@ static const char *mpoa_device_type_string(char type)
351 * lec sees a TLV it uses the pointer to call this function. 353 * lec sees a TLV it uses the pointer to call this function.
352 * 354 *
353 */ 355 */
354static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr, 356static void lane2_assoc_ind(struct net_device *dev, const u8 *mac_addr,
355 uint8_t *tlvs, uint32_t sizeoftlvs) 357 const u8 *tlvs, u32 sizeoftlvs)
356{ 358{
357 uint32_t type; 359 uint32_t type;
358 uint8_t length, mpoa_device_type, number_of_mps_macs; 360 uint8_t length, mpoa_device_type, number_of_mps_macs;
359 uint8_t *end_of_tlvs; 361 const uint8_t *end_of_tlvs;
360 struct mpoa_client *mpc; 362 struct mpoa_client *mpc;
361 363
362 mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */ 364 mpoa_device_type = number_of_mps_macs = 0; /* silence gcc */
@@ -430,8 +432,10 @@ static void lane2_assoc_ind(struct net_device *dev, uint8_t *mac_addr,
430 * plus the possible MAC address(es) to mpc->mps_macs. 432 * plus the possible MAC address(es) to mpc->mps_macs.
431 * For a freshly allocated MPOA client mpc->mps_macs == 0. 433 * For a freshly allocated MPOA client mpc->mps_macs == 0.
432 */ 434 */
433static uint8_t *copy_macs(struct mpoa_client *mpc, uint8_t *router_mac, 435static const uint8_t *copy_macs(struct mpoa_client *mpc,
434 uint8_t *tlvs, uint8_t mps_macs, uint8_t device_type) 436 const uint8_t *router_mac,
437 const uint8_t *tlvs, uint8_t mps_macs,
438 uint8_t device_type)
435{ 439{
436 int num_macs; 440 int num_macs;
437 num_macs = (mps_macs > 1) ? mps_macs : 1; 441 num_macs = (mps_macs > 1) ? mps_macs : 1;
@@ -811,7 +815,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg)
811 return arg; 815 return arg;
812} 816}
813 817
814static void send_set_mps_ctrl_addr(char *addr, struct mpoa_client *mpc) 818static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc)
815{ 819{
816 struct k_message mesg; 820 struct k_message mesg;
817 821
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index d9449df7cad5..9b58d70b0e7d 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -68,10 +68,17 @@ static int br_dev_stop(struct net_device *dev)
68 68
69static int br_change_mtu(struct net_device *dev, int new_mtu) 69static int br_change_mtu(struct net_device *dev, int new_mtu)
70{ 70{
71 if (new_mtu < 68 || new_mtu > br_min_mtu(netdev_priv(dev))) 71 struct net_bridge *br = netdev_priv(dev);
72 if (new_mtu < 68 || new_mtu > br_min_mtu(br))
72 return -EINVAL; 73 return -EINVAL;
73 74
74 dev->mtu = new_mtu; 75 dev->mtu = new_mtu;
76
77#ifdef CONFIG_BRIDGE_NETFILTER
78 /* remember the MTU in the rtable for PMTU */
79 br->fake_rtable.u.dst.metrics[RTAX_MTU - 1] = new_mtu;
80#endif
81
75 return 0; 82 return 0;
76} 83}
77 84
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index a072ea5ca6f5..63c18aacde8c 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -202,6 +202,9 @@ static struct net_device *new_bridge_dev(const char *name)
202 br->topology_change = 0; 202 br->topology_change = 0;
203 br->topology_change_detected = 0; 203 br->topology_change_detected = 0;
204 br->ageing_time = 300 * HZ; 204 br->ageing_time = 300 * HZ;
205
206 br_netfilter_rtable_init(br);
207
205 INIT_LIST_HEAD(&br->age_list); 208 INIT_LIST_HEAD(&br->age_list);
206 209
207 br_stp_timer_init(br); 210 br_stp_timer_init(br);
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index bb90cd7bace3..6e280a8a31ee 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -101,33 +101,30 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb)
101 pppoe_proto(skb) == htons(PPP_IPV6) && \ 101 pppoe_proto(skb) == htons(PPP_IPV6) && \
102 brnf_filter_pppoe_tagged) 102 brnf_filter_pppoe_tagged)
103 103
104/* We need these fake structures to make netfilter happy -- 104/*
105 * lots of places assume that skb->dst != NULL, which isn't 105 * Initialize bogus route table used to keep netfilter happy.
106 * all that unreasonable.
107 *
108 * Currently, we fill in the PMTU entry because netfilter 106 * Currently, we fill in the PMTU entry because netfilter
109 * refragmentation needs it, and the rt_flags entry because 107 * refragmentation needs it, and the rt_flags entry because
110 * ipt_REJECT needs it. Future netfilter modules might 108 * ipt_REJECT needs it. Future netfilter modules might
111 * require us to fill additional fields. */ 109 * require us to fill additional fields.
112static struct net_device __fake_net_device = { 110 */
113 .hard_header_len = ETH_HLEN, 111void br_netfilter_rtable_init(struct net_bridge *br)
114#ifdef CONFIG_NET_NS 112{
115 .nd_net = &init_net, 113 struct rtable *rt = &br->fake_rtable;
116#endif
117};
118 114
119static struct rtable __fake_rtable = { 115 atomic_set(&rt->u.dst.__refcnt, 1);
120 .u = { 116 rt->u.dst.dev = &br->dev;
121 .dst = { 117 rt->u.dst.path = &rt->u.dst;
122 .__refcnt = ATOMIC_INIT(1), 118 rt->u.dst.metrics[RTAX_MTU - 1] = 1500;
123 .dev = &__fake_net_device, 119 rt->u.dst.flags = DST_NOXFRM;
124 .path = &__fake_rtable.u.dst, 120}
125 .metrics = {[RTAX_MTU - 1] = 1500}, 121
126 .flags = DST_NOXFRM, 122static inline struct rtable *bridge_parent_rtable(const struct net_device *dev)
127 } 123{
128 }, 124 struct net_bridge_port *port = rcu_dereference(dev->br_port);
129 .rt_flags = 0, 125
130}; 126 return port ? &port->br->fake_rtable : NULL;
127}
131 128
132static inline struct net_device *bridge_parent(const struct net_device *dev) 129static inline struct net_device *bridge_parent(const struct net_device *dev)
133{ 130{
@@ -226,8 +223,12 @@ static int br_nf_pre_routing_finish_ipv6(struct sk_buff *skb)
226 } 223 }
227 nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; 224 nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
228 225
229 skb->rtable = &__fake_rtable; 226 skb->rtable = bridge_parent_rtable(nf_bridge->physindev);
230 dst_hold(&__fake_rtable.u.dst); 227 if (!skb->rtable) {
228 kfree_skb(skb);
229 return 0;
230 }
231 dst_hold(&skb->rtable->u.dst);
231 232
232 skb->dev = nf_bridge->physindev; 233 skb->dev = nf_bridge->physindev;
233 nf_bridge_push_encap_header(skb); 234 nf_bridge_push_encap_header(skb);
@@ -391,8 +392,12 @@ bridged_dnat:
391 skb->pkt_type = PACKET_HOST; 392 skb->pkt_type = PACKET_HOST;
392 } 393 }
393 } else { 394 } else {
394 skb->rtable = &__fake_rtable; 395 skb->rtable = bridge_parent_rtable(nf_bridge->physindev);
395 dst_hold(&__fake_rtable.u.dst); 396 if (!skb->rtable) {
397 kfree_skb(skb);
398 return 0;
399 }
400 dst_hold(&skb->rtable->u.dst);
396 } 401 }
397 402
398 skb->dev = nf_bridge->physindev; 403 skb->dev = nf_bridge->physindev;
@@ -611,8 +616,8 @@ static unsigned int br_nf_local_in(unsigned int hook, struct sk_buff *skb,
611 const struct net_device *out, 616 const struct net_device *out,
612 int (*okfn)(struct sk_buff *)) 617 int (*okfn)(struct sk_buff *))
613{ 618{
614 if (skb->rtable == &__fake_rtable) { 619 if (skb->rtable && skb->rtable == bridge_parent_rtable(in)) {
615 dst_release(&__fake_rtable.u.dst); 620 dst_release(&skb->rtable->u.dst);
616 skb->rtable = NULL; 621 skb->rtable = NULL;
617 } 622 }
618 623
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 815ed38925b2..c3dc18ddc043 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <linux/if_bridge.h> 17#include <linux/if_bridge.h>
18#include <net/route.h>
18 19
19#define BR_HASH_BITS 8 20#define BR_HASH_BITS 8
20#define BR_HASH_SIZE (1 << BR_HASH_BITS) 21#define BR_HASH_SIZE (1 << BR_HASH_BITS)
@@ -92,6 +93,9 @@ struct net_bridge
92 struct hlist_head hash[BR_HASH_SIZE]; 93 struct hlist_head hash[BR_HASH_SIZE];
93 struct list_head age_list; 94 struct list_head age_list;
94 unsigned long feature_mask; 95 unsigned long feature_mask;
96#ifdef CONFIG_BRIDGE_NETFILTER
97 struct rtable fake_rtable;
98#endif
95 unsigned long flags; 99 unsigned long flags;
96#define BR_SET_MAC_ADDR 0x00000001 100#define BR_SET_MAC_ADDR 0x00000001
97 101
@@ -197,9 +201,11 @@ extern int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd, void __us
197#ifdef CONFIG_BRIDGE_NETFILTER 201#ifdef CONFIG_BRIDGE_NETFILTER
198extern int br_netfilter_init(void); 202extern int br_netfilter_init(void);
199extern void br_netfilter_fini(void); 203extern void br_netfilter_fini(void);
204extern void br_netfilter_rtable_init(struct net_bridge *);
200#else 205#else
201#define br_netfilter_init() (0) 206#define br_netfilter_init() (0)
202#define br_netfilter_fini() do { } while(0) 207#define br_netfilter_fini() do { } while(0)
208#define br_netfilter_rtable_init(x)
203#endif 209#endif
204 210
205/* br_stp.c */ 211/* br_stp.c */
diff --git a/net/core/dev.c b/net/core/dev.c
index 8d13a9b9f1df..69320a56a084 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2100,7 +2100,7 @@ static int ing_filter(struct sk_buff *skb)
2100 rxq = &dev->rx_queue; 2100 rxq = &dev->rx_queue;
2101 2101
2102 q = rxq->qdisc; 2102 q = rxq->qdisc;
2103 if (q) { 2103 if (q != &noop_qdisc) {
2104 spin_lock(qdisc_lock(q)); 2104 spin_lock(qdisc_lock(q));
2105 result = qdisc_enqueue_root(skb, q); 2105 result = qdisc_enqueue_root(skb, q);
2106 spin_unlock(qdisc_lock(q)); 2106 spin_unlock(qdisc_lock(q));
@@ -2113,7 +2113,7 @@ static inline struct sk_buff *handle_ing(struct sk_buff *skb,
2113 struct packet_type **pt_prev, 2113 struct packet_type **pt_prev,
2114 int *ret, struct net_device *orig_dev) 2114 int *ret, struct net_device *orig_dev)
2115{ 2115{
2116 if (!skb->dev->rx_queue.qdisc) 2116 if (skb->dev->rx_queue.qdisc == &noop_qdisc)
2117 goto out; 2117 goto out;
2118 2118
2119 if (*pt_prev) { 2119 if (*pt_prev) {
@@ -4200,6 +4200,7 @@ static void netdev_init_queues(struct net_device *dev)
4200{ 4200{
4201 netdev_init_one_queue(dev, &dev->rx_queue, NULL); 4201 netdev_init_one_queue(dev, &dev->rx_queue, NULL);
4202 netdev_for_each_tx_queue(dev, netdev_init_one_queue, NULL); 4202 netdev_for_each_tx_queue(dev, netdev_init_one_queue, NULL);
4203 spin_lock_init(&dev->tx_global_lock);
4203} 4204}
4204 4205
4205/** 4206/**
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index c12720895ecf..6c7af390be0a 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -70,6 +70,7 @@ static void queue_process(struct work_struct *work)
70 local_irq_save(flags); 70 local_irq_save(flags);
71 __netif_tx_lock(txq, smp_processor_id()); 71 __netif_tx_lock(txq, smp_processor_id());
72 if (netif_tx_queue_stopped(txq) || 72 if (netif_tx_queue_stopped(txq) ||
73 netif_tx_queue_frozen(txq) ||
73 dev->hard_start_xmit(skb, dev) != NETDEV_TX_OK) { 74 dev->hard_start_xmit(skb, dev) != NETDEV_TX_OK) {
74 skb_queue_head(&npinfo->txq, skb); 75 skb_queue_head(&npinfo->txq, skb);
75 __netif_tx_unlock(txq); 76 __netif_tx_unlock(txq);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index c7d484f7e1c4..3284605f2ec7 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3305,6 +3305,7 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
3305 3305
3306 txq = netdev_get_tx_queue(odev, queue_map); 3306 txq = netdev_get_tx_queue(odev, queue_map);
3307 if (netif_tx_queue_stopped(txq) || 3307 if (netif_tx_queue_stopped(txq) ||
3308 netif_tx_queue_frozen(txq) ||
3308 need_resched()) { 3309 need_resched()) {
3309 idle_start = getCurUs(); 3310 idle_start = getCurUs();
3310 3311
@@ -3320,7 +3321,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
3320 3321
3321 pkt_dev->idle_acc += getCurUs() - idle_start; 3322 pkt_dev->idle_acc += getCurUs() - idle_start;
3322 3323
3323 if (netif_tx_queue_stopped(txq)) { 3324 if (netif_tx_queue_stopped(txq) ||
3325 netif_tx_queue_frozen(txq)) {
3324 pkt_dev->next_tx_us = getCurUs(); /* TODO */ 3326 pkt_dev->next_tx_us = getCurUs(); /* TODO */
3325 pkt_dev->next_tx_ns = 0; 3327 pkt_dev->next_tx_ns = 0;
3326 goto out; /* Try the next interface */ 3328 goto out; /* Try the next interface */
@@ -3352,7 +3354,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
3352 txq = netdev_get_tx_queue(odev, queue_map); 3354 txq = netdev_get_tx_queue(odev, queue_map);
3353 3355
3354 __netif_tx_lock_bh(txq); 3356 __netif_tx_lock_bh(txq);
3355 if (!netif_tx_queue_stopped(txq)) { 3357 if (!netif_tx_queue_stopped(txq) &&
3358 !netif_tx_queue_frozen(txq)) {
3356 3359
3357 atomic_inc(&(pkt_dev->skb->users)); 3360 atomic_inc(&(pkt_dev->skb->users));
3358 retry_now: 3361 retry_now:
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4e0c92274189..84640172d65d 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -485,6 +485,9 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
485 C(head); 485 C(head);
486 C(data); 486 C(data);
487 C(truesize); 487 C(truesize);
488#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
489 C(do_not_encrypt);
490#endif
488 atomic_set(&n->users, 1); 491 atomic_set(&n->users, 1);
489 492
490 atomic_inc(&(skb_shinfo(skb)->dataref)); 493 atomic_inc(&(skb_shinfo(skb)->dataref));
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 743d85fcd651..1c2e3ec2eb57 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -226,7 +226,7 @@ static inline void dccp_csum_outgoing(struct sk_buff *skb)
226 226
227extern void dccp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb); 227extern void dccp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb);
228 228
229extern int dccp_retransmit_skb(struct sock *sk, struct sk_buff *skb); 229extern int dccp_retransmit_skb(struct sock *sk);
230 230
231extern void dccp_send_ack(struct sock *sk); 231extern void dccp_send_ack(struct sock *sk);
232extern void dccp_reqsk_send_ack(struct sk_buff *sk, struct request_sock *rsk); 232extern void dccp_reqsk_send_ack(struct sk_buff *sk, struct request_sock *rsk);
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index a835b88237cb..882c5c4de69e 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -196,8 +196,8 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk,
196static void dccp_v4_err(struct sk_buff *skb, u32 info) 196static void dccp_v4_err(struct sk_buff *skb, u32 info)
197{ 197{
198 const struct iphdr *iph = (struct iphdr *)skb->data; 198 const struct iphdr *iph = (struct iphdr *)skb->data;
199 const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + 199 const u8 offset = iph->ihl << 2;
200 (iph->ihl << 2)); 200 const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset);
201 struct dccp_sock *dp; 201 struct dccp_sock *dp;
202 struct inet_sock *inet; 202 struct inet_sock *inet;
203 const int type = icmp_hdr(skb)->type; 203 const int type = icmp_hdr(skb)->type;
@@ -207,7 +207,8 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
207 int err; 207 int err;
208 struct net *net = dev_net(skb->dev); 208 struct net *net = dev_net(skb->dev);
209 209
210 if (skb->len < (iph->ihl << 2) + 8) { 210 if (skb->len < offset + sizeof(*dh) ||
211 skb->len < offset + __dccp_basic_hdr_len(dh)) {
211 ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); 212 ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
212 return; 213 return;
213 } 214 }
@@ -238,7 +239,7 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
238 dp = dccp_sk(sk); 239 dp = dccp_sk(sk);
239 seq = dccp_hdr_seq(dh); 240 seq = dccp_hdr_seq(dh);
240 if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) && 241 if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) &&
241 !between48(seq, dp->dccps_swl, dp->dccps_swh)) { 242 !between48(seq, dp->dccps_awl, dp->dccps_awh)) {
242 NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); 243 NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
243 goto out; 244 goto out;
244 } 245 }
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index da509127e00c..5e1ee0da2c40 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -89,12 +89,19 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
89{ 89{
90 struct ipv6hdr *hdr = (struct ipv6hdr *)skb->data; 90 struct ipv6hdr *hdr = (struct ipv6hdr *)skb->data;
91 const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset); 91 const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset);
92 struct dccp_sock *dp;
92 struct ipv6_pinfo *np; 93 struct ipv6_pinfo *np;
93 struct sock *sk; 94 struct sock *sk;
94 int err; 95 int err;
95 __u64 seq; 96 __u64 seq;
96 struct net *net = dev_net(skb->dev); 97 struct net *net = dev_net(skb->dev);
97 98
99 if (skb->len < offset + sizeof(*dh) ||
100 skb->len < offset + __dccp_basic_hdr_len(dh)) {
101 ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), ICMP6_MIB_INERRORS);
102 return;
103 }
104
98 sk = inet6_lookup(net, &dccp_hashinfo, 105 sk = inet6_lookup(net, &dccp_hashinfo,
99 &hdr->daddr, dh->dccph_dport, 106 &hdr->daddr, dh->dccph_dport,
100 &hdr->saddr, dh->dccph_sport, inet6_iif(skb)); 107 &hdr->saddr, dh->dccph_sport, inet6_iif(skb));
@@ -116,6 +123,14 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
116 if (sk->sk_state == DCCP_CLOSED) 123 if (sk->sk_state == DCCP_CLOSED)
117 goto out; 124 goto out;
118 125
126 dp = dccp_sk(sk);
127 seq = dccp_hdr_seq(dh);
128 if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) &&
129 !between48(seq, dp->dccps_awl, dp->dccps_awh)) {
130 NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
131 goto out;
132 }
133
119 np = inet6_sk(sk); 134 np = inet6_sk(sk);
120 135
121 if (type == ICMPV6_PKT_TOOBIG) { 136 if (type == ICMPV6_PKT_TOOBIG) {
@@ -168,7 +183,6 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
168 183
169 icmpv6_err_convert(type, code, &err); 184 icmpv6_err_convert(type, code, &err);
170 185
171 seq = dccp_hdr_seq(dh);
172 /* Might be for an request_sock */ 186 /* Might be for an request_sock */
173 switch (sk->sk_state) { 187 switch (sk->sk_state) {
174 struct request_sock *req, **prev; 188 struct request_sock *req, **prev;
diff --git a/net/dccp/output.c b/net/dccp/output.c
index fe20068c5d8e..d06945c7d3df 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -53,8 +53,11 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
53 dccp_packet_hdr_len(dcb->dccpd_type); 53 dccp_packet_hdr_len(dcb->dccpd_type);
54 int err, set_ack = 1; 54 int err, set_ack = 1;
55 u64 ackno = dp->dccps_gsr; 55 u64 ackno = dp->dccps_gsr;
56 56 /*
57 dccp_inc_seqno(&dp->dccps_gss); 57 * Increment GSS here already in case the option code needs it.
58 * Update GSS for real only if option processing below succeeds.
59 */
60 dcb->dccpd_seq = ADD48(dp->dccps_gss, 1);
58 61
59 switch (dcb->dccpd_type) { 62 switch (dcb->dccpd_type) {
60 case DCCP_PKT_DATA: 63 case DCCP_PKT_DATA:
@@ -66,6 +69,9 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
66 69
67 case DCCP_PKT_REQUEST: 70 case DCCP_PKT_REQUEST:
68 set_ack = 0; 71 set_ack = 0;
72 /* Use ISS on the first (non-retransmitted) Request. */
73 if (icsk->icsk_retransmits == 0)
74 dcb->dccpd_seq = dp->dccps_iss;
69 /* fall through */ 75 /* fall through */
70 76
71 case DCCP_PKT_SYNC: 77 case DCCP_PKT_SYNC:
@@ -84,8 +90,6 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
84 break; 90 break;
85 } 91 }
86 92
87 dcb->dccpd_seq = dp->dccps_gss;
88
89 if (dccp_insert_options(sk, skb)) { 93 if (dccp_insert_options(sk, skb)) {
90 kfree_skb(skb); 94 kfree_skb(skb);
91 return -EPROTO; 95 return -EPROTO;
@@ -103,7 +107,7 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
103 /* XXX For now we're using only 48 bits sequence numbers */ 107 /* XXX For now we're using only 48 bits sequence numbers */
104 dh->dccph_x = 1; 108 dh->dccph_x = 1;
105 109
106 dp->dccps_awh = dp->dccps_gss; 110 dccp_update_gss(sk, dcb->dccpd_seq);
107 dccp_hdr_set_seq(dh, dp->dccps_gss); 111 dccp_hdr_set_seq(dh, dp->dccps_gss);
108 if (set_ack) 112 if (set_ack)
109 dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), ackno); 113 dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), ackno);
@@ -112,6 +116,11 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
112 case DCCP_PKT_REQUEST: 116 case DCCP_PKT_REQUEST:
113 dccp_hdr_request(skb)->dccph_req_service = 117 dccp_hdr_request(skb)->dccph_req_service =
114 dp->dccps_service; 118 dp->dccps_service;
119 /*
120 * Limit Ack window to ISS <= P.ackno <= GSS, so that
121 * only Responses to Requests we sent are considered.
122 */
123 dp->dccps_awl = dp->dccps_iss;
115 break; 124 break;
116 case DCCP_PKT_RESET: 125 case DCCP_PKT_RESET:
117 dccp_hdr_reset(skb)->dccph_reset_code = 126 dccp_hdr_reset(skb)->dccph_reset_code =
@@ -284,14 +293,26 @@ void dccp_write_xmit(struct sock *sk, int block)
284 } 293 }
285} 294}
286 295
287int dccp_retransmit_skb(struct sock *sk, struct sk_buff *skb) 296/**
297 * dccp_retransmit_skb - Retransmit Request, Close, or CloseReq packets
298 * There are only four retransmittable packet types in DCCP:
299 * - Request in client-REQUEST state (sec. 8.1.1),
300 * - CloseReq in server-CLOSEREQ state (sec. 8.3),
301 * - Close in node-CLOSING state (sec. 8.3),
302 * - Acks in client-PARTOPEN state (sec. 8.1.5, handled by dccp_delack_timer()).
303 * This function expects sk->sk_send_head to contain the original skb.
304 */
305int dccp_retransmit_skb(struct sock *sk)
288{ 306{
307 WARN_ON(sk->sk_send_head == NULL);
308
289 if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk) != 0) 309 if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk) != 0)
290 return -EHOSTUNREACH; /* Routing failure or similar. */ 310 return -EHOSTUNREACH; /* Routing failure or similar. */
291 311
292 return dccp_transmit_skb(sk, (skb_cloned(skb) ? 312 /* this count is used to distinguish original and retransmitted skb */
293 pskb_copy(skb, GFP_ATOMIC): 313 inet_csk(sk)->icsk_retransmits++;
294 skb_clone(skb, GFP_ATOMIC))); 314
315 return dccp_transmit_skb(sk, skb_clone(sk->sk_send_head, GFP_ATOMIC));
295} 316}
296 317
297struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst, 318struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst,
@@ -437,19 +458,7 @@ static inline void dccp_connect_init(struct sock *sk)
437 458
438 dccp_sync_mss(sk, dst_mtu(dst)); 459 dccp_sync_mss(sk, dst_mtu(dst));
439 460
440 /* 461 /* Initialise GAR as per 8.5; AWL/AWH are set in dccp_transmit_skb() */
441 * SWL and AWL are initially adjusted so that they are not less than
442 * the initial Sequence Numbers received and sent, respectively:
443 * SWL := max(GSR + 1 - floor(W/4), ISR),
444 * AWL := max(GSS - W' + 1, ISS).
445 * These adjustments MUST be applied only at the beginning of the
446 * connection.
447 */
448 dccp_update_gss(sk, dp->dccps_iss);
449 dccp_set_seqno(&dp->dccps_awl, max48(dp->dccps_awl, dp->dccps_iss));
450
451 /* S.GAR - greatest valid acknowledgement number received on a non-Sync;
452 * initialized to S.ISS (sec. 8.5) */
453 dp->dccps_gar = dp->dccps_iss; 462 dp->dccps_gar = dp->dccps_iss;
454 463
455 icsk->icsk_retransmits = 0; 464 icsk->icsk_retransmits = 0;
diff --git a/net/dccp/timer.c b/net/dccp/timer.c
index 6a5b961b6f5c..54b3c7e9e016 100644
--- a/net/dccp/timer.c
+++ b/net/dccp/timer.c
@@ -99,21 +99,11 @@ static void dccp_retransmit_timer(struct sock *sk)
99 } 99 }
100 100
101 /* 101 /*
102 * sk->sk_send_head has to have one skb with
103 * DCCP_SKB_CB(skb)->dccpd_type set to one of the retransmittable DCCP
104 * packet types. The only packets eligible for retransmission are:
105 * -- Requests in client-REQUEST state (sec. 8.1.1)
106 * -- Acks in client-PARTOPEN state (sec. 8.1.5)
107 * -- CloseReq in server-CLOSEREQ state (sec. 8.3)
108 * -- Close in node-CLOSING state (sec. 8.3) */
109 WARN_ON(sk->sk_send_head == NULL);
110
111 /*
112 * More than than 4MSL (8 minutes) has passed, a RESET(aborted) was 102 * More than than 4MSL (8 minutes) has passed, a RESET(aborted) was
113 * sent, no need to retransmit, this sock is dead. 103 * sent, no need to retransmit, this sock is dead.
114 */ 104 */
115 if (dccp_write_timeout(sk)) 105 if (dccp_write_timeout(sk))
116 goto out; 106 return;
117 107
118 /* 108 /*
119 * We want to know the number of packets retransmitted, not the 109 * We want to know the number of packets retransmitted, not the
@@ -122,30 +112,28 @@ static void dccp_retransmit_timer(struct sock *sk)
122 if (icsk->icsk_retransmits == 0) 112 if (icsk->icsk_retransmits == 0)
123 DCCP_INC_STATS_BH(DCCP_MIB_TIMEOUTS); 113 DCCP_INC_STATS_BH(DCCP_MIB_TIMEOUTS);
124 114
125 if (dccp_retransmit_skb(sk, sk->sk_send_head) < 0) { 115 if (dccp_retransmit_skb(sk) != 0) {
126 /* 116 /*
127 * Retransmission failed because of local congestion, 117 * Retransmission failed because of local congestion,
128 * do not backoff. 118 * do not backoff.
129 */ 119 */
130 if (icsk->icsk_retransmits == 0) 120 if (--icsk->icsk_retransmits == 0)
131 icsk->icsk_retransmits = 1; 121 icsk->icsk_retransmits = 1;
132 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, 122 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
133 min(icsk->icsk_rto, 123 min(icsk->icsk_rto,
134 TCP_RESOURCE_PROBE_INTERVAL), 124 TCP_RESOURCE_PROBE_INTERVAL),
135 DCCP_RTO_MAX); 125 DCCP_RTO_MAX);
136 goto out; 126 return;
137 } 127 }
138 128
139backoff: 129backoff:
140 icsk->icsk_backoff++; 130 icsk->icsk_backoff++;
141 icsk->icsk_retransmits++;
142 131
143 icsk->icsk_rto = min(icsk->icsk_rto << 1, DCCP_RTO_MAX); 132 icsk->icsk_rto = min(icsk->icsk_rto << 1, DCCP_RTO_MAX);
144 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto, 133 inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, icsk->icsk_rto,
145 DCCP_RTO_MAX); 134 DCCP_RTO_MAX);
146 if (icsk->icsk_retransmits > sysctl_dccp_retries1) 135 if (icsk->icsk_retransmits > sysctl_dccp_retries1)
147 __sk_dst_reset(sk); 136 __sk_dst_reset(sk);
148out:;
149} 137}
150 138
151static void dccp_write_timer(unsigned long data) 139static void dccp_write_timer(unsigned long data)
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index a42b64d040c4..38ccb6dfb02e 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -104,9 +104,7 @@ out:
104 104
105static int ipcomp4_init_state(struct xfrm_state *x) 105static int ipcomp4_init_state(struct xfrm_state *x)
106{ 106{
107 int err; 107 int err = -EINVAL;
108 struct ipcomp_data *ipcd;
109 struct xfrm_algo_desc *calg_desc;
110 108
111 x->props.header_len = 0; 109 x->props.header_len = 0;
112 switch (x->props.mode) { 110 switch (x->props.mode) {
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 1819ad7ab910..fafe8ebb4c55 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -475,11 +475,10 @@ static void arp_print(struct arp_payload *payload)
475#define HBUFFERLEN 30 475#define HBUFFERLEN 30
476 char hbuffer[HBUFFERLEN]; 476 char hbuffer[HBUFFERLEN];
477 int j,k; 477 int j,k;
478 const char hexbuf[]= "0123456789abcdef";
479 478
480 for (k=0, j=0; k < HBUFFERLEN-3 && j < ETH_ALEN; j++) { 479 for (k=0, j=0; k < HBUFFERLEN-3 && j < ETH_ALEN; j++) {
481 hbuffer[k++]=hexbuf[(payload->src_hw[j]>>4)&15]; 480 hbuffer[k++] = hex_asc_hi(payload->src_hw[j]);
482 hbuffer[k++]=hexbuf[payload->src_hw[j]&15]; 481 hbuffer[k++] = hex_asc_lo(payload->src_hw[j]);
483 hbuffer[k++]=':'; 482 hbuffer[k++]=':';
484 } 483 }
485 hbuffer[--k]='\0'; 484 hbuffer[--k]='\0';
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
index 21cb053f5d7d..3974d7cae5c0 100644
--- a/net/ipv4/netfilter/ipt_recent.c
+++ b/net/ipv4/netfilter/ipt_recent.c
@@ -305,10 +305,10 @@ static void recent_mt_destroy(const struct xt_match *match, void *matchinfo)
305 spin_lock_bh(&recent_lock); 305 spin_lock_bh(&recent_lock);
306 list_del(&t->list); 306 list_del(&t->list);
307 spin_unlock_bh(&recent_lock); 307 spin_unlock_bh(&recent_lock);
308 recent_table_flush(t);
309#ifdef CONFIG_PROC_FS 308#ifdef CONFIG_PROC_FS
310 remove_proc_entry(t->name, proc_dir); 309 remove_proc_entry(t->name, proc_dir);
311#endif 310#endif
311 recent_table_flush(t);
312 kfree(t); 312 kfree(t);
313 } 313 }
314 mutex_unlock(&recent_mutex); 314 mutex_unlock(&recent_mutex);
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 834356ea99df..8f5a403f6f6b 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -232,6 +232,8 @@ static const struct snmp_mib snmp4_net_list[] = {
232 SNMP_MIB_ITEM("TCPDSACKIgnoredOld", LINUX_MIB_TCPDSACKIGNOREDOLD), 232 SNMP_MIB_ITEM("TCPDSACKIgnoredOld", LINUX_MIB_TCPDSACKIGNOREDOLD),
233 SNMP_MIB_ITEM("TCPDSACKIgnoredNoUndo", LINUX_MIB_TCPDSACKIGNOREDNOUNDO), 233 SNMP_MIB_ITEM("TCPDSACKIgnoredNoUndo", LINUX_MIB_TCPDSACKIGNOREDNOUNDO),
234 SNMP_MIB_ITEM("TCPSpuriousRTOs", LINUX_MIB_TCPSPURIOUSRTOS), 234 SNMP_MIB_ITEM("TCPSpuriousRTOs", LINUX_MIB_TCPSPURIOUSRTOS),
235 SNMP_MIB_ITEM("TCPMD5NotFound", LINUX_MIB_TCPMD5NOTFOUND),
236 SNMP_MIB_ITEM("TCPMD5Unexpected", LINUX_MIB_TCPMD5UNEXPECTED),
235 SNMP_MIB_SENTINEL 237 SNMP_MIB_SENTINEL
236}; 238};
237 239
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 380d6474cf66..1bfa078ddbd0 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -3216,14 +3216,18 @@ int __init ip_rt_init(void)
3216 return rc; 3216 return rc;
3217} 3217}
3218 3218
3219#ifdef CONFIG_SYSCTL
3219/* 3220/*
3220 * We really need to sanitize the damn ipv4 init order, then all 3221 * We really need to sanitize the damn ipv4 init order, then all
3221 * this nonsense will go away. 3222 * this nonsense will go away.
3222 */ 3223 */
3223void __init ip_static_sysctl_init(void) 3224void __init ip_static_sysctl_init(void)
3224{ 3225{
3226#ifdef CONFIG_SYSCTL
3225 register_sysctl_paths(ipv4_route_path, ipv4_route_table); 3227 register_sysctl_paths(ipv4_route_path, ipv4_route_table);
3228#endif
3226} 3229}
3230#endif
3227 3231
3228EXPORT_SYMBOL(__ip_select_ident); 3232EXPORT_SYMBOL(__ip_select_ident);
3229EXPORT_SYMBOL(ip_route_input); 3233EXPORT_SYMBOL(ip_route_input);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a2b06d0cc26b..91a8cfddf1c4 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -655,8 +655,8 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
655 rep.th.doff = arg.iov[0].iov_len/4; 655 rep.th.doff = arg.iov[0].iov_len/4;
656 656
657 tcp_v4_md5_hash_hdr((__u8 *) &rep.opt[offset], 657 tcp_v4_md5_hash_hdr((__u8 *) &rep.opt[offset],
658 key, ip_hdr(skb)->daddr, 658 key, ip_hdr(skb)->saddr,
659 ip_hdr(skb)->saddr, &rep.th); 659 ip_hdr(skb)->daddr, &rep.th);
660 } 660 }
661#endif 661#endif
662 arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr, 662 arg.csum = csum_tcpudp_nofold(ip_hdr(skb)->daddr,
@@ -1116,18 +1116,12 @@ static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb)
1116 return 0; 1116 return 0;
1117 1117
1118 if (hash_expected && !hash_location) { 1118 if (hash_expected && !hash_location) {
1119 LIMIT_NETDEBUG(KERN_INFO "MD5 Hash expected but NOT found " 1119 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
1120 "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n",
1121 NIPQUAD(iph->saddr), ntohs(th->source),
1122 NIPQUAD(iph->daddr), ntohs(th->dest));
1123 return 1; 1120 return 1;
1124 } 1121 }
1125 1122
1126 if (!hash_expected && hash_location) { 1123 if (!hash_expected && hash_location) {
1127 LIMIT_NETDEBUG(KERN_INFO "MD5 Hash NOT expected but found " 1124 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
1128 "(" NIPQUAD_FMT ", %d)->(" NIPQUAD_FMT ", %d)\n",
1129 NIPQUAD(iph->saddr), ntohs(th->source),
1130 NIPQUAD(iph->daddr), ntohs(th->dest));
1131 return 1; 1125 return 1;
1132 } 1126 }
1133 1127
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index f7b535dec860..410046a8cc91 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -732,7 +732,7 @@ int datagram_send_ctl(struct net *net,
732 LIMIT_NETDEBUG(KERN_DEBUG "invalid cmsg type: %d\n", 732 LIMIT_NETDEBUG(KERN_DEBUG "invalid cmsg type: %d\n",
733 cmsg->cmsg_type); 733 cmsg->cmsg_type);
734 err = -EINVAL; 734 err = -EINVAL;
735 break; 735 goto exit_f;
736 } 736 }
737 } 737 }
738 738
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 6811901e6b1e..a027003d69a4 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -236,6 +236,10 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
236 skb_reset_network_header(skb); 236 skb_reset_network_header(skb);
237 hdr = ipv6_hdr(skb); 237 hdr = ipv6_hdr(skb);
238 238
239 /* Allow local fragmentation. */
240 if (ipfragok)
241 skb->local_df = 1;
242
239 /* 243 /*
240 * Fill in the IPv6 header 244 * Fill in the IPv6 header
241 */ 245 */
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 0cfcea42153a..4545e4306862 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -134,9 +134,7 @@ out:
134 134
135static int ipcomp6_init_state(struct xfrm_state *x) 135static int ipcomp6_init_state(struct xfrm_state *x)
136{ 136{
137 int err; 137 int err = -EINVAL;
138 struct ipcomp_data *ipcd;
139 struct xfrm_algo_desc *calg_desc;
140 138
141 x->props.header_len = 0; 139 x->props.header_len = 0;
142 switch (x->props.mode) { 140 switch (x->props.mode) {
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index f82f6074cf85..0179b66864f1 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -286,7 +286,6 @@ proc_net_fail:
286 286
287void ipv6_misc_proc_exit(void) 287void ipv6_misc_proc_exit(void)
288{ 288{
289 proc_net_remove(&init_net, "sockstat6");
290 proc_net_remove(&init_net, "dev_snmp6"); 289 proc_net_remove(&init_net, "dev_snmp6");
291 proc_net_remove(&init_net, "snmp6"); 290 proc_net_remove(&init_net, "snmp6");
292 unregister_pernet_subsys(&ipv6_proc_ops); 291 unregister_pernet_subsys(&ipv6_proc_ops);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index cff778b23a7f..78185a409212 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -748,7 +748,7 @@ static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp,
748 ipv6_addr_copy(&bp->saddr, saddr); 748 ipv6_addr_copy(&bp->saddr, saddr);
749 ipv6_addr_copy(&bp->daddr, daddr); 749 ipv6_addr_copy(&bp->daddr, daddr);
750 bp->protocol = cpu_to_be32(IPPROTO_TCP); 750 bp->protocol = cpu_to_be32(IPPROTO_TCP);
751 bp->len = cpu_to_be16(nbytes); 751 bp->len = cpu_to_be32(nbytes);
752 752
753 sg_init_one(&sg, bp, sizeof(*bp)); 753 sg_init_one(&sg, bp, sizeof(*bp));
754 return crypto_hash_update(&hp->md5_desc, &sg, sizeof(*bp)); 754 return crypto_hash_update(&hp->md5_desc, &sg, sizeof(*bp));
@@ -849,28 +849,17 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
849 hash_expected = tcp_v6_md5_do_lookup(sk, &ip6h->saddr); 849 hash_expected = tcp_v6_md5_do_lookup(sk, &ip6h->saddr);
850 hash_location = tcp_parse_md5sig_option(th); 850 hash_location = tcp_parse_md5sig_option(th);
851 851
852 /* do we have a hash as expected? */ 852 /* We've parsed the options - do we have a hash? */
853 if (!hash_expected) { 853 if (!hash_expected && !hash_location)
854 if (!hash_location) 854 return 0;
855 return 0; 855
856 if (net_ratelimit()) { 856 if (hash_expected && !hash_location) {
857 printk(KERN_INFO "MD5 Hash NOT expected but found " 857 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
858 "(" NIP6_FMT ", %u)->"
859 "(" NIP6_FMT ", %u)\n",
860 NIP6(ip6h->saddr), ntohs(th->source),
861 NIP6(ip6h->daddr), ntohs(th->dest));
862 }
863 return 1; 858 return 1;
864 } 859 }
865 860
866 if (!hash_location) { 861 if (!hash_expected && hash_location) {
867 if (net_ratelimit()) { 862 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
868 printk(KERN_INFO "MD5 Hash expected but NOT found "
869 "(" NIP6_FMT ", %u)->"
870 "(" NIP6_FMT ", %u)\n",
871 NIP6(ip6h->saddr), ntohs(th->source),
872 NIP6(ip6h->daddr), ntohs(th->dest));
873 }
874 return 1; 863 return 1;
875 } 864 }
876 865
@@ -1105,8 +1094,8 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
1105 *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 1094 *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
1106 (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); 1095 (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
1107 tcp_v6_md5_hash_hdr((__u8 *)topt, key, 1096 tcp_v6_md5_hash_hdr((__u8 *)topt, key,
1108 &ipv6_hdr(skb)->daddr, 1097 &ipv6_hdr(skb)->saddr,
1109 &ipv6_hdr(skb)->saddr, t1); 1098 &ipv6_hdr(skb)->daddr, t1);
1110 } 1099 }
1111#endif 1100#endif
1112 1101
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 8e7ba0e62cf5..297c257864c7 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -81,6 +81,7 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
81 enum nl80211_iftype type, u32 *flags, 81 enum nl80211_iftype type, u32 *flags,
82 struct vif_params *params) 82 struct vif_params *params)
83{ 83{
84 struct ieee80211_local *local = wiphy_priv(wiphy);
84 struct net_device *dev; 85 struct net_device *dev;
85 enum ieee80211_if_types itype; 86 enum ieee80211_if_types itype;
86 struct ieee80211_sub_if_data *sdata; 87 struct ieee80211_sub_if_data *sdata;
@@ -95,6 +96,9 @@ static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex,
95 if (itype == IEEE80211_IF_TYPE_INVALID) 96 if (itype == IEEE80211_IF_TYPE_INVALID)
96 return -EINVAL; 97 return -EINVAL;
97 98
99 if (dev == local->mdev)
100 return -EOPNOTSUPP;
101
98 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 102 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
99 103
100 ret = ieee80211_if_change_type(sdata, itype); 104 ret = ieee80211_if_change_type(sdata, itype);
@@ -117,12 +121,16 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
117 u8 key_idx, u8 *mac_addr, 121 u8 key_idx, u8 *mac_addr,
118 struct key_params *params) 122 struct key_params *params)
119{ 123{
124 struct ieee80211_local *local = wiphy_priv(wiphy);
120 struct ieee80211_sub_if_data *sdata; 125 struct ieee80211_sub_if_data *sdata;
121 struct sta_info *sta = NULL; 126 struct sta_info *sta = NULL;
122 enum ieee80211_key_alg alg; 127 enum ieee80211_key_alg alg;
123 struct ieee80211_key *key; 128 struct ieee80211_key *key;
124 int err; 129 int err;
125 130
131 if (dev == local->mdev)
132 return -EOPNOTSUPP;
133
126 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 134 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
127 135
128 switch (params->cipher) { 136 switch (params->cipher) {
@@ -167,10 +175,14 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
167static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, 175static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev,
168 u8 key_idx, u8 *mac_addr) 176 u8 key_idx, u8 *mac_addr)
169{ 177{
178 struct ieee80211_local *local = wiphy_priv(wiphy);
170 struct ieee80211_sub_if_data *sdata; 179 struct ieee80211_sub_if_data *sdata;
171 struct sta_info *sta; 180 struct sta_info *sta;
172 int ret; 181 int ret;
173 182
183 if (dev == local->mdev)
184 return -EOPNOTSUPP;
185
174 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 186 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
175 187
176 rcu_read_lock(); 188 rcu_read_lock();
@@ -211,7 +223,8 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
211 void (*callback)(void *cookie, 223 void (*callback)(void *cookie,
212 struct key_params *params)) 224 struct key_params *params))
213{ 225{
214 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 226 struct ieee80211_local *local = wiphy_priv(wiphy);
227 struct ieee80211_sub_if_data *sdata;
215 struct sta_info *sta = NULL; 228 struct sta_info *sta = NULL;
216 u8 seq[6] = {0}; 229 u8 seq[6] = {0};
217 struct key_params params; 230 struct key_params params;
@@ -220,6 +233,11 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
220 u16 iv16; 233 u16 iv16;
221 int err = -ENOENT; 234 int err = -ENOENT;
222 235
236 if (dev == local->mdev)
237 return -EOPNOTSUPP;
238
239 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
240
223 rcu_read_lock(); 241 rcu_read_lock();
224 242
225 if (mac_addr) { 243 if (mac_addr) {
@@ -293,8 +311,12 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
293 struct net_device *dev, 311 struct net_device *dev,
294 u8 key_idx) 312 u8 key_idx)
295{ 313{
314 struct ieee80211_local *local = wiphy_priv(wiphy);
296 struct ieee80211_sub_if_data *sdata; 315 struct ieee80211_sub_if_data *sdata;
297 316
317 if (dev == local->mdev)
318 return -EOPNOTSUPP;
319
298 rcu_read_lock(); 320 rcu_read_lock();
299 321
300 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 322 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -475,9 +497,15 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
475static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, 497static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
476 struct beacon_parameters *params) 498 struct beacon_parameters *params)
477{ 499{
478 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 500 struct ieee80211_local *local = wiphy_priv(wiphy);
501 struct ieee80211_sub_if_data *sdata;
479 struct beacon_data *old; 502 struct beacon_data *old;
480 503
504 if (dev == local->mdev)
505 return -EOPNOTSUPP;
506
507 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
508
481 if (sdata->vif.type != IEEE80211_IF_TYPE_AP) 509 if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
482 return -EINVAL; 510 return -EINVAL;
483 511
@@ -492,9 +520,15 @@ static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
492static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, 520static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
493 struct beacon_parameters *params) 521 struct beacon_parameters *params)
494{ 522{
495 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 523 struct ieee80211_local *local = wiphy_priv(wiphy);
524 struct ieee80211_sub_if_data *sdata;
496 struct beacon_data *old; 525 struct beacon_data *old;
497 526
527 if (dev == local->mdev)
528 return -EOPNOTSUPP;
529
530 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
531
498 if (sdata->vif.type != IEEE80211_IF_TYPE_AP) 532 if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
499 return -EINVAL; 533 return -EINVAL;
500 534
@@ -508,9 +542,15 @@ static int ieee80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
508 542
509static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) 543static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
510{ 544{
511 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 545 struct ieee80211_local *local = wiphy_priv(wiphy);
546 struct ieee80211_sub_if_data *sdata;
512 struct beacon_data *old; 547 struct beacon_data *old;
513 548
549 if (dev == local->mdev)
550 return -EOPNOTSUPP;
551
552 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
553
514 if (sdata->vif.type != IEEE80211_IF_TYPE_AP) 554 if (sdata->vif.type != IEEE80211_IF_TYPE_AP)
515 return -EINVAL; 555 return -EINVAL;
516 556
@@ -646,11 +686,14 @@ static void sta_apply_parameters(struct ieee80211_local *local,
646static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, 686static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
647 u8 *mac, struct station_parameters *params) 687 u8 *mac, struct station_parameters *params)
648{ 688{
649 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 689 struct ieee80211_local *local = wiphy_priv(wiphy);
650 struct sta_info *sta; 690 struct sta_info *sta;
651 struct ieee80211_sub_if_data *sdata; 691 struct ieee80211_sub_if_data *sdata;
652 int err; 692 int err;
653 693
694 if (dev == local->mdev || params->vlan == local->mdev)
695 return -EOPNOTSUPP;
696
654 /* Prevent a race with changing the rate control algorithm */ 697 /* Prevent a race with changing the rate control algorithm */
655 if (!netif_running(dev)) 698 if (!netif_running(dev))
656 return -ENETDOWN; 699 return -ENETDOWN;
@@ -701,10 +744,15 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
701static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, 744static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev,
702 u8 *mac) 745 u8 *mac)
703{ 746{
704 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 747 struct ieee80211_local *local = wiphy_priv(wiphy);
705 struct ieee80211_local *local = sdata->local; 748 struct ieee80211_sub_if_data *sdata;
706 struct sta_info *sta; 749 struct sta_info *sta;
707 750
751 if (dev == local->mdev)
752 return -EOPNOTSUPP;
753
754 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
755
708 if (mac) { 756 if (mac) {
709 rcu_read_lock(); 757 rcu_read_lock();
710 758
@@ -730,10 +778,13 @@ static int ieee80211_change_station(struct wiphy *wiphy,
730 u8 *mac, 778 u8 *mac,
731 struct station_parameters *params) 779 struct station_parameters *params)
732{ 780{
733 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 781 struct ieee80211_local *local = wiphy_priv(wiphy);
734 struct sta_info *sta; 782 struct sta_info *sta;
735 struct ieee80211_sub_if_data *vlansdata; 783 struct ieee80211_sub_if_data *vlansdata;
736 784
785 if (dev == local->mdev || params->vlan == local->mdev)
786 return -EOPNOTSUPP;
787
737 rcu_read_lock(); 788 rcu_read_lock();
738 789
739 /* XXX: get sta belonging to dev */ 790 /* XXX: get sta belonging to dev */
@@ -752,7 +803,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
752 return -EINVAL; 803 return -EINVAL;
753 } 804 }
754 805
755 sta->sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); 806 sta->sdata = vlansdata;
756 ieee80211_send_layer2_update(sta); 807 ieee80211_send_layer2_update(sta);
757 } 808 }
758 809
@@ -767,15 +818,20 @@ static int ieee80211_change_station(struct wiphy *wiphy,
767static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, 818static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
768 u8 *dst, u8 *next_hop) 819 u8 *dst, u8 *next_hop)
769{ 820{
770 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 821 struct ieee80211_local *local = wiphy_priv(wiphy);
771 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 822 struct ieee80211_sub_if_data *sdata;
772 struct mesh_path *mpath; 823 struct mesh_path *mpath;
773 struct sta_info *sta; 824 struct sta_info *sta;
774 int err; 825 int err;
775 826
827 if (dev == local->mdev)
828 return -EOPNOTSUPP;
829
776 if (!netif_running(dev)) 830 if (!netif_running(dev))
777 return -ENETDOWN; 831 return -ENETDOWN;
778 832
833 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
834
779 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 835 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
780 return -ENOTSUPP; 836 return -ENOTSUPP;
781 837
@@ -817,14 +873,19 @@ static int ieee80211_change_mpath(struct wiphy *wiphy,
817 struct net_device *dev, 873 struct net_device *dev,
818 u8 *dst, u8 *next_hop) 874 u8 *dst, u8 *next_hop)
819{ 875{
820 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 876 struct ieee80211_local *local = wiphy_priv(wiphy);
821 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 877 struct ieee80211_sub_if_data *sdata;
822 struct mesh_path *mpath; 878 struct mesh_path *mpath;
823 struct sta_info *sta; 879 struct sta_info *sta;
824 880
881 if (dev == local->mdev)
882 return -EOPNOTSUPP;
883
825 if (!netif_running(dev)) 884 if (!netif_running(dev))
826 return -ENETDOWN; 885 return -ENETDOWN;
827 886
887 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
888
828 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 889 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
829 return -ENOTSUPP; 890 return -ENOTSUPP;
830 891
@@ -891,9 +952,15 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
891 u8 *dst, u8 *next_hop, struct mpath_info *pinfo) 952 u8 *dst, u8 *next_hop, struct mpath_info *pinfo)
892 953
893{ 954{
894 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 955 struct ieee80211_local *local = wiphy_priv(wiphy);
956 struct ieee80211_sub_if_data *sdata;
895 struct mesh_path *mpath; 957 struct mesh_path *mpath;
896 958
959 if (dev == local->mdev)
960 return -EOPNOTSUPP;
961
962 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
963
897 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 964 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
898 return -ENOTSUPP; 965 return -ENOTSUPP;
899 966
@@ -913,9 +980,15 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
913 int idx, u8 *dst, u8 *next_hop, 980 int idx, u8 *dst, u8 *next_hop,
914 struct mpath_info *pinfo) 981 struct mpath_info *pinfo)
915{ 982{
916 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 983 struct ieee80211_local *local = wiphy_priv(wiphy);
984 struct ieee80211_sub_if_data *sdata;
917 struct mesh_path *mpath; 985 struct mesh_path *mpath;
918 986
987 if (dev == local->mdev)
988 return -EOPNOTSUPP;
989
990 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
991
919 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT) 992 if (sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT)
920 return -ENOTSUPP; 993 return -ENOTSUPP;
921 994
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index f1a83d450ea0..a4c5b90de769 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1233,18 +1233,12 @@ static void ieee80211_tasklet_handler(unsigned long data)
1233/* Remove added headers (e.g., QoS control), encryption header/MIC, etc. to 1233/* Remove added headers (e.g., QoS control), encryption header/MIC, etc. to
1234 * make a prepared TX frame (one that has been given to hw) to look like brand 1234 * make a prepared TX frame (one that has been given to hw) to look like brand
1235 * new IEEE 802.11 frame that is ready to go through TX processing again. 1235 * new IEEE 802.11 frame that is ready to go through TX processing again.
1236 * Also, tx_packet_data in cb is restored from tx_control. */ 1236 */
1237static void ieee80211_remove_tx_extra(struct ieee80211_local *local, 1237static void ieee80211_remove_tx_extra(struct ieee80211_local *local,
1238 struct ieee80211_key *key, 1238 struct ieee80211_key *key,
1239 struct sk_buff *skb) 1239 struct sk_buff *skb)
1240{ 1240{
1241 int hdrlen, iv_len, mic_len; 1241 int hdrlen, iv_len, mic_len;
1242 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1243
1244 info->flags &= IEEE80211_TX_CTL_REQ_TX_STATUS |
1245 IEEE80211_TX_CTL_DO_NOT_ENCRYPT |
1246 IEEE80211_TX_CTL_REQUEUE |
1247 IEEE80211_TX_CTL_EAPOL_FRAME;
1248 1242
1249 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 1243 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
1250 1244
@@ -1731,8 +1725,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
1731 result = ieee80211_wep_init(local); 1725 result = ieee80211_wep_init(local);
1732 1726
1733 if (result < 0) { 1727 if (result < 0) {
1734 printk(KERN_DEBUG "%s: Failed to initialize wep\n", 1728 printk(KERN_DEBUG "%s: Failed to initialize wep: %d\n",
1735 wiphy_name(local->hw.wiphy)); 1729 wiphy_name(local->hw.wiphy), result);
1736 goto fail_wep; 1730 goto fail_wep;
1737 } 1731 }
1738 1732
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index d7c371e36bf0..acb04133a95d 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -606,7 +606,6 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
606 int encrypt) 606 int encrypt)
607{ 607{
608 struct ieee80211_sub_if_data *sdata; 608 struct ieee80211_sub_if_data *sdata;
609 struct ieee80211_tx_info *info;
610 609
611 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 610 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
612 skb->dev = sdata->local->mdev; 611 skb->dev = sdata->local->mdev;
@@ -614,11 +613,8 @@ void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
614 skb_set_network_header(skb, 0); 613 skb_set_network_header(skb, 0);
615 skb_set_transport_header(skb, 0); 614 skb_set_transport_header(skb, 0);
616 615
617 info = IEEE80211_SKB_CB(skb); 616 skb->iif = sdata->dev->ifindex;
618 memset(info, 0, sizeof(struct ieee80211_tx_info)); 617 skb->do_not_encrypt = !encrypt;
619 info->control.ifindex = sdata->dev->ifindex;
620 if (!encrypt)
621 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
622 618
623 dev_queue_xmit(skb); 619 dev_queue_xmit(skb);
624} 620}
@@ -3303,6 +3299,7 @@ void ieee80211_start_mesh(struct net_device *dev)
3303 ifsta = &sdata->u.sta; 3299 ifsta = &sdata->u.sta;
3304 ifsta->state = IEEE80211_MESH_UP; 3300 ifsta->state = IEEE80211_MESH_UP;
3305 ieee80211_sta_timer((unsigned long)sdata); 3301 ieee80211_sta_timer((unsigned long)sdata);
3302 ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
3306} 3303}
3307#endif 3304#endif
3308 3305
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 0fbadd8b983c..69019e943873 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -305,7 +305,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
305 rcu_read_unlock(); 305 rcu_read_unlock();
306 306
307 local->total_ps_buffered = total; 307 local->total_ps_buffered = total;
308#ifdef MAC80211_VERBOSE_PS_DEBUG 308#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
309 printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n", 309 printk(KERN_DEBUG "%s: PS buffers full - purged %d frames\n",
310 wiphy_name(local->hw.wiphy), purged); 310 wiphy_name(local->hw.wiphy), purged);
311#endif 311#endif
@@ -342,7 +342,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
342 purge_old_ps_buffers(tx->local); 342 purge_old_ps_buffers(tx->local);
343 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= 343 if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >=
344 AP_MAX_BC_BUFFER) { 344 AP_MAX_BC_BUFFER) {
345#ifdef MAC80211_VERBOSE_PS_DEBUG 345#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
346 if (net_ratelimit()) { 346 if (net_ratelimit()) {
347 printk(KERN_DEBUG "%s: BC TX buffer full - " 347 printk(KERN_DEBUG "%s: BC TX buffer full - "
348 "dropping the oldest frame\n", 348 "dropping the oldest frame\n",
@@ -389,7 +389,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
389 purge_old_ps_buffers(tx->local); 389 purge_old_ps_buffers(tx->local);
390 if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) { 390 if (skb_queue_len(&sta->ps_tx_buf) >= STA_MAX_TX_BUFFER) {
391 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf); 391 struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf);
392#ifdef MAC80211_VERBOSE_PS_DEBUG 392#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
393 if (net_ratelimit()) { 393 if (net_ratelimit()) {
394 printk(KERN_DEBUG "%s: STA %s TX " 394 printk(KERN_DEBUG "%s: STA %s TX "
395 "buffer full - dropping oldest frame\n", 395 "buffer full - dropping oldest frame\n",
@@ -439,14 +439,14 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
439 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 439 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
440 u16 fc = tx->fc; 440 u16 fc = tx->fc;
441 441
442 if (unlikely(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)) 442 if (unlikely(tx->skb->do_not_encrypt))
443 tx->key = NULL; 443 tx->key = NULL;
444 else if (tx->sta && (key = rcu_dereference(tx->sta->key))) 444 else if (tx->sta && (key = rcu_dereference(tx->sta->key)))
445 tx->key = key; 445 tx->key = key;
446 else if ((key = rcu_dereference(tx->sdata->default_key))) 446 else if ((key = rcu_dereference(tx->sdata->default_key)))
447 tx->key = key; 447 tx->key = key;
448 else if (tx->sdata->drop_unencrypted && 448 else if (tx->sdata->drop_unencrypted &&
449 !(info->flags & IEEE80211_TX_CTL_EAPOL_FRAME) && 449 (tx->skb->protocol != cpu_to_be16(ETH_P_PAE)) &&
450 !(info->flags & IEEE80211_TX_CTL_INJECTED)) { 450 !(info->flags & IEEE80211_TX_CTL_INJECTED)) {
451 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); 451 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
452 return TX_DROP; 452 return TX_DROP;
@@ -476,7 +476,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
476 } 476 }
477 477
478 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) 478 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
479 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; 479 tx->skb->do_not_encrypt = 1;
480 480
481 return TX_CONTINUE; 481 return TX_CONTINUE;
482} 482}
@@ -732,6 +732,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
732 memcpy(skb_put(frag, copylen), pos, copylen); 732 memcpy(skb_put(frag, copylen), pos, copylen);
733 memcpy(frag->cb, first->cb, sizeof(frag->cb)); 733 memcpy(frag->cb, first->cb, sizeof(frag->cb));
734 skb_copy_queue_mapping(frag, first); 734 skb_copy_queue_mapping(frag, first);
735 frag->do_not_encrypt = first->do_not_encrypt;
735 736
736 pos += copylen; 737 pos += copylen;
737 left -= copylen; 738 left -= copylen;
@@ -852,7 +853,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
852 853
853 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 854 sband = tx->local->hw.wiphy->bands[tx->channel->band];
854 855
855 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; 856 skb->do_not_encrypt = 1;
856 info->flags |= IEEE80211_TX_CTL_INJECTED; 857 info->flags |= IEEE80211_TX_CTL_INJECTED;
857 tx->flags &= ~IEEE80211_TX_FRAGMENTED; 858 tx->flags &= ~IEEE80211_TX_FRAGMENTED;
858 859
@@ -925,8 +926,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
925 skb_trim(skb, skb->len - FCS_LEN); 926 skb_trim(skb, skb->len - FCS_LEN);
926 } 927 }
927 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP) 928 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
928 info->flags &= 929 tx->skb->do_not_encrypt = 0;
929 ~IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
930 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) 930 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
931 tx->flags |= IEEE80211_TX_FRAGMENTED; 931 tx->flags |= IEEE80211_TX_FRAGMENTED;
932 break; 932 break;
@@ -1042,10 +1042,9 @@ static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1042 struct sk_buff *skb, 1042 struct sk_buff *skb,
1043 struct net_device *mdev) 1043 struct net_device *mdev)
1044{ 1044{
1045 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1046 struct net_device *dev; 1045 struct net_device *dev;
1047 1046
1048 dev = dev_get_by_index(&init_net, info->control.ifindex); 1047 dev = dev_get_by_index(&init_net, skb->iif);
1049 if (unlikely(dev && !is_ieee80211_device(dev, mdev))) { 1048 if (unlikely(dev && !is_ieee80211_device(dev, mdev))) {
1050 dev_put(dev); 1049 dev_put(dev);
1051 dev = NULL; 1050 dev = NULL;
@@ -1306,8 +1305,8 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
1306 bool may_encrypt; 1305 bool may_encrypt;
1307 int ret; 1306 int ret;
1308 1307
1309 if (info->control.ifindex) 1308 if (skb->iif)
1310 odev = dev_get_by_index(&init_net, info->control.ifindex); 1309 odev = dev_get_by_index(&init_net, skb->iif);
1311 if (unlikely(odev && !is_ieee80211_device(odev, dev))) { 1310 if (unlikely(odev && !is_ieee80211_device(odev, dev))) {
1312 dev_put(odev); 1311 dev_put(odev);
1313 odev = NULL; 1312 odev = NULL;
@@ -1321,9 +1320,13 @@ int ieee80211_master_start_xmit(struct sk_buff *skb,
1321 return 0; 1320 return 0;
1322 } 1321 }
1323 1322
1323 memset(info, 0, sizeof(*info));
1324
1325 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1326
1324 osdata = IEEE80211_DEV_TO_SUB_IF(odev); 1327 osdata = IEEE80211_DEV_TO_SUB_IF(odev);
1325 1328
1326 may_encrypt = !(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT); 1329 may_encrypt = !skb->do_not_encrypt;
1327 1330
1328 headroom = osdata->local->tx_headroom; 1331 headroom = osdata->local->tx_headroom;
1329 if (may_encrypt) 1332 if (may_encrypt)
@@ -1348,7 +1351,6 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1348 struct net_device *dev) 1351 struct net_device *dev)
1349{ 1352{
1350 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1353 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1351 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1352 struct ieee80211_radiotap_header *prthdr = 1354 struct ieee80211_radiotap_header *prthdr =
1353 (struct ieee80211_radiotap_header *)skb->data; 1355 (struct ieee80211_radiotap_header *)skb->data;
1354 u16 len_rthdr; 1356 u16 len_rthdr;
@@ -1371,11 +1373,11 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
1371 skb->dev = local->mdev; 1373 skb->dev = local->mdev;
1372 1374
1373 /* needed because we set skb device to master */ 1375 /* needed because we set skb device to master */
1374 info->control.ifindex = dev->ifindex; 1376 skb->iif = dev->ifindex;
1375 1377
1376 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; 1378 /* sometimes we do encrypt injected frames, will be fixed
1377 /* Interfaces should always request a status report */ 1379 * up in radiotap parser if not wanted */
1378 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; 1380 skb->do_not_encrypt = 0;
1379 1381
1380 /* 1382 /*
1381 * fix up the pointers accounting for the radiotap 1383 * fix up the pointers accounting for the radiotap
@@ -1419,7 +1421,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1419 struct net_device *dev) 1421 struct net_device *dev)
1420{ 1422{
1421 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1423 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1422 struct ieee80211_tx_info *info;
1423 struct ieee80211_sub_if_data *sdata; 1424 struct ieee80211_sub_if_data *sdata;
1424 int ret = 1, head_need; 1425 int ret = 1, head_need;
1425 u16 ethertype, hdrlen, meshhdrlen = 0; 1426 u16 ethertype, hdrlen, meshhdrlen = 0;
@@ -1645,14 +1646,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
1645 nh_pos += hdrlen; 1646 nh_pos += hdrlen;
1646 h_pos += hdrlen; 1647 h_pos += hdrlen;
1647 1648
1648 info = IEEE80211_SKB_CB(skb); 1649 skb->iif = dev->ifindex;
1649 memset(info, 0, sizeof(*info));
1650 info->control.ifindex = dev->ifindex;
1651 if (ethertype == ETH_P_PAE)
1652 info->flags |= IEEE80211_TX_CTL_EAPOL_FRAME;
1653
1654 /* Interfaces should always request a status report */
1655 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1656 1650
1657 skb->dev = local->mdev; 1651 skb->dev = local->mdev;
1658 dev->stats.tx_packets++; 1652 dev->stats.tx_packets++;
@@ -1922,6 +1916,8 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1922 1916
1923 info = IEEE80211_SKB_CB(skb); 1917 info = IEEE80211_SKB_CB(skb);
1924 1918
1919 skb->do_not_encrypt = 1;
1920
1925 info->band = band; 1921 info->band = band;
1926 rate_control_get_rate(local->mdev, sband, skb, &rsel); 1922 rate_control_get_rate(local->mdev, sband, skb, &rsel);
1927 1923
@@ -1931,7 +1927,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1931 "no rate found\n", 1927 "no rate found\n",
1932 wiphy_name(local->hw.wiphy)); 1928 wiphy_name(local->hw.wiphy));
1933 } 1929 }
1934 dev_kfree_skb(skb); 1930 dev_kfree_skb_any(skb);
1935 skb = NULL; 1931 skb = NULL;
1936 goto out; 1932 goto out;
1937 } 1933 }
@@ -1940,7 +1936,6 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1940 info->tx_rate_idx = rsel.rate_idx; 1936 info->tx_rate_idx = rsel.rate_idx;
1941 1937
1942 info->flags |= IEEE80211_TX_CTL_NO_ACK; 1938 info->flags |= IEEE80211_TX_CTL_NO_ACK;
1943 info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT;
1944 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; 1939 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1945 info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; 1940 info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
1946 if (sdata->bss_conf.use_short_preamble && 1941 if (sdata->bss_conf.use_short_preamble &&
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 872d2fcd1a5b..5c2bf0a3d4db 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -31,13 +31,13 @@ int ieee80211_wep_init(struct ieee80211_local *local)
31 local->wep_tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, 31 local->wep_tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
32 CRYPTO_ALG_ASYNC); 32 CRYPTO_ALG_ASYNC);
33 if (IS_ERR(local->wep_tx_tfm)) 33 if (IS_ERR(local->wep_tx_tfm))
34 return -ENOMEM; 34 return PTR_ERR(local->wep_tx_tfm);
35 35
36 local->wep_rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, 36 local->wep_rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
37 CRYPTO_ALG_ASYNC); 37 CRYPTO_ALG_ASYNC);
38 if (IS_ERR(local->wep_rx_tfm)) { 38 if (IS_ERR(local->wep_rx_tfm)) {
39 crypto_free_blkcipher(local->wep_tx_tfm); 39 crypto_free_blkcipher(local->wep_tx_tfm);
40 return -ENOMEM; 40 return PTR_ERR(local->wep_rx_tfm);
41 } 41 }
42 42
43 return 0; 43 return 0;
diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
index 07edda0b8a5c..28437f0001db 100644
--- a/net/mac80211/wme.c
+++ b/net/mac80211/wme.c
@@ -188,6 +188,9 @@ int ieee80211_ht_agg_queue_add(struct ieee80211_local *local,
188{ 188{
189 int i; 189 int i;
190 190
191 /* XXX: currently broken due to cb/requeue use */
192 return -EPERM;
193
191 /* prepare the filter and save it for the SW queue 194 /* prepare the filter and save it for the SW queue
192 * matching the received HW queue */ 195 * matching the received HW queue */
193 196
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 420a10d8eb1e..6f61261888ef 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -67,7 +67,8 @@ static const char *const tcp_conntrack_names[] = {
67/* RFC1122 says the R2 limit should be at least 100 seconds. 67/* RFC1122 says the R2 limit should be at least 100 seconds.
68 Linux uses 15 packets as limit, which corresponds 68 Linux uses 15 packets as limit, which corresponds
69 to ~13-30min depending on RTO. */ 69 to ~13-30min depending on RTO. */
70static unsigned int nf_ct_tcp_timeout_max_retrans __read_mostly = 5 MINS; 70static unsigned int nf_ct_tcp_timeout_max_retrans __read_mostly = 5 MINS;
71static unsigned int nf_ct_tcp_timeout_unacknowledged __read_mostly = 5 MINS;
71 72
72static unsigned int tcp_timeouts[TCP_CONNTRACK_MAX] __read_mostly = { 73static unsigned int tcp_timeouts[TCP_CONNTRACK_MAX] __read_mostly = {
73 [TCP_CONNTRACK_SYN_SENT] = 2 MINS, 74 [TCP_CONNTRACK_SYN_SENT] = 2 MINS,
@@ -625,8 +626,10 @@ static bool tcp_in_window(const struct nf_conn *ct,
625 swin = win + (sack - ack); 626 swin = win + (sack - ack);
626 if (sender->td_maxwin < swin) 627 if (sender->td_maxwin < swin)
627 sender->td_maxwin = swin; 628 sender->td_maxwin = swin;
628 if (after(end, sender->td_end)) 629 if (after(end, sender->td_end)) {
629 sender->td_end = end; 630 sender->td_end = end;
631 sender->flags |= IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED;
632 }
630 /* 633 /*
631 * Update receiver data. 634 * Update receiver data.
632 */ 635 */
@@ -637,6 +640,8 @@ static bool tcp_in_window(const struct nf_conn *ct,
637 if (win == 0) 640 if (win == 0)
638 receiver->td_maxend++; 641 receiver->td_maxend++;
639 } 642 }
643 if (ack == receiver->td_end)
644 receiver->flags &= ~IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED;
640 645
641 /* 646 /*
642 * Check retransmissions. 647 * Check retransmissions.
@@ -951,9 +956,16 @@ static int tcp_packet(struct nf_conn *ct,
951 if (old_state != new_state 956 if (old_state != new_state
952 && new_state == TCP_CONNTRACK_FIN_WAIT) 957 && new_state == TCP_CONNTRACK_FIN_WAIT)
953 ct->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT; 958 ct->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT;
954 timeout = ct->proto.tcp.retrans >= nf_ct_tcp_max_retrans 959
955 && tcp_timeouts[new_state] > nf_ct_tcp_timeout_max_retrans 960 if (ct->proto.tcp.retrans >= nf_ct_tcp_max_retrans &&
956 ? nf_ct_tcp_timeout_max_retrans : tcp_timeouts[new_state]; 961 tcp_timeouts[new_state] > nf_ct_tcp_timeout_max_retrans)
962 timeout = nf_ct_tcp_timeout_max_retrans;
963 else if ((ct->proto.tcp.seen[0].flags | ct->proto.tcp.seen[1].flags) &
964 IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED &&
965 tcp_timeouts[new_state] > nf_ct_tcp_timeout_unacknowledged)
966 timeout = nf_ct_tcp_timeout_unacknowledged;
967 else
968 timeout = tcp_timeouts[new_state];
957 write_unlock_bh(&tcp_lock); 969 write_unlock_bh(&tcp_lock);
958 970
959 nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb); 971 nf_conntrack_event_cache(IPCT_PROTOINFO_VOLATILE, skb);
@@ -1236,6 +1248,13 @@ static struct ctl_table tcp_sysctl_table[] = {
1236 .proc_handler = &proc_dointvec_jiffies, 1248 .proc_handler = &proc_dointvec_jiffies,
1237 }, 1249 },
1238 { 1250 {
1251 .procname = "nf_conntrack_tcp_timeout_unacknowledged",
1252 .data = &nf_ct_tcp_timeout_unacknowledged,
1253 .maxlen = sizeof(unsigned int),
1254 .mode = 0644,
1255 .proc_handler = &proc_dointvec_jiffies,
1256 },
1257 {
1239 .ctl_name = NET_NF_CONNTRACK_TCP_LOOSE, 1258 .ctl_name = NET_NF_CONNTRACK_TCP_LOOSE,
1240 .procname = "nf_conntrack_tcp_loose", 1259 .procname = "nf_conntrack_tcp_loose",
1241 .data = &nf_ct_tcp_loose, 1260 .data = &nf_ct_tcp_loose,
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 6809af542a2c..d9418a267812 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -367,9 +367,7 @@ static void htable_gc(unsigned long htlong)
367 367
368static void htable_destroy(struct xt_hashlimit_htable *hinfo) 368static void htable_destroy(struct xt_hashlimit_htable *hinfo)
369{ 369{
370 /* remove timer, if it is pending */ 370 del_timer_sync(&hinfo->timer);
371 if (timer_pending(&hinfo->timer))
372 del_timer(&hinfo->timer);
373 371
374 /* remove proc entry */ 372 /* remove proc entry */
375 remove_proc_entry(hinfo->pde->name, 373 remove_proc_entry(hinfo->pde->name,
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 7a560b785097..c6f2f388cb72 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -130,7 +130,6 @@ static void update_rfkill_state(struct rfkill *rfkill)
130 130
131/** 131/**
132 * rfkill_toggle_radio - wrapper for toggle_radio hook 132 * rfkill_toggle_radio - wrapper for toggle_radio hook
133 *
134 * @rfkill: the rfkill struct to use 133 * @rfkill: the rfkill struct to use
135 * @force: calls toggle_radio even if cache says it is not needed, 134 * @force: calls toggle_radio even if cache says it is not needed,
136 * and also makes sure notifications of the state will be 135 * and also makes sure notifications of the state will be
@@ -141,8 +140,8 @@ static void update_rfkill_state(struct rfkill *rfkill)
141 * calls and handling all the red tape such as issuing notifications 140 * calls and handling all the red tape such as issuing notifications
142 * if the call is successful. 141 * if the call is successful.
143 * 142 *
144 * Note that @force cannot override a (possibly cached) state of 143 * Note that the @force parameter cannot override a (possibly cached)
145 * RFKILL_STATE_HARD_BLOCKED. Any device making use of 144 * state of RFKILL_STATE_HARD_BLOCKED. Any device making use of
146 * RFKILL_STATE_HARD_BLOCKED implements either get_state() or 145 * RFKILL_STATE_HARD_BLOCKED implements either get_state() or
147 * rfkill_force_state(), so the cache either is bypassed or valid. 146 * rfkill_force_state(), so the cache either is bypassed or valid.
148 * 147 *
@@ -150,7 +149,7 @@ static void update_rfkill_state(struct rfkill *rfkill)
150 * even if the radio is in RFKILL_STATE_HARD_BLOCKED state, so as to 149 * even if the radio is in RFKILL_STATE_HARD_BLOCKED state, so as to
151 * give the driver a hint that it should double-BLOCK the transmitter. 150 * give the driver a hint that it should double-BLOCK the transmitter.
152 * 151 *
153 * Caller must have aquired rfkill_mutex. 152 * Caller must have acquired rfkill->mutex.
154 */ 153 */
155static int rfkill_toggle_radio(struct rfkill *rfkill, 154static int rfkill_toggle_radio(struct rfkill *rfkill,
156 enum rfkill_state state, 155 enum rfkill_state state,
@@ -200,12 +199,12 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
200 199
201/** 200/**
202 * rfkill_switch_all - Toggle state of all switches of given type 201 * rfkill_switch_all - Toggle state of all switches of given type
203 * @type: type of interfaces to be affeceted 202 * @type: type of interfaces to be affected
204 * @state: the new state 203 * @state: the new state
205 * 204 *
206 * This function toggles state of all switches of given type unless 205 * This function toggles the state of all switches of given type,
207 * a specific switch is claimed by userspace in which case it is 206 * unless a specific switch is claimed by userspace (in which case,
208 * left alone. 207 * that switch is left alone).
209 */ 208 */
210void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state) 209void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state)
211{ 210{
@@ -216,8 +215,11 @@ void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state)
216 rfkill_states[type] = state; 215 rfkill_states[type] = state;
217 216
218 list_for_each_entry(rfkill, &rfkill_list, node) { 217 list_for_each_entry(rfkill, &rfkill_list, node) {
219 if ((!rfkill->user_claim) && (rfkill->type == type)) 218 if ((!rfkill->user_claim) && (rfkill->type == type)) {
219 mutex_lock(&rfkill->mutex);
220 rfkill_toggle_radio(rfkill, state, 0); 220 rfkill_toggle_radio(rfkill, state, 0);
221 mutex_unlock(&rfkill->mutex);
222 }
221 } 223 }
222 224
223 mutex_unlock(&rfkill_mutex); 225 mutex_unlock(&rfkill_mutex);
@@ -228,7 +230,7 @@ EXPORT_SYMBOL(rfkill_switch_all);
228 * rfkill_epo - emergency power off all transmitters 230 * rfkill_epo - emergency power off all transmitters
229 * 231 *
230 * This kicks all rfkill devices to RFKILL_STATE_SOFT_BLOCKED, ignoring 232 * This kicks all rfkill devices to RFKILL_STATE_SOFT_BLOCKED, ignoring
231 * everything in its path but rfkill_mutex. 233 * everything in its path but rfkill_mutex and rfkill->mutex.
232 */ 234 */
233void rfkill_epo(void) 235void rfkill_epo(void)
234{ 236{
@@ -236,7 +238,9 @@ void rfkill_epo(void)
236 238
237 mutex_lock(&rfkill_mutex); 239 mutex_lock(&rfkill_mutex);
238 list_for_each_entry(rfkill, &rfkill_list, node) { 240 list_for_each_entry(rfkill, &rfkill_list, node) {
241 mutex_lock(&rfkill->mutex);
239 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1); 242 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1);
243 mutex_unlock(&rfkill->mutex);
240 } 244 }
241 mutex_unlock(&rfkill_mutex); 245 mutex_unlock(&rfkill_mutex);
242} 246}
@@ -252,7 +256,12 @@ EXPORT_SYMBOL_GPL(rfkill_epo);
252 * a notification by the firmware/hardware of the current *real* 256 * a notification by the firmware/hardware of the current *real*
253 * state of the radio rfkill switch. 257 * state of the radio rfkill switch.
254 * 258 *
255 * It may not be called from an atomic context. 259 * Devices which are subject to external changes on their rfkill
260 * state (such as those caused by a hardware rfkill line) MUST
261 * have their driver arrange to call rfkill_force_state() as soon
262 * as possible after such a change.
263 *
264 * This function may not be called from an atomic context.
256 */ 265 */
257int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state) 266int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state)
258{ 267{
@@ -367,6 +376,9 @@ static ssize_t rfkill_claim_store(struct device *dev,
367 if (!capable(CAP_NET_ADMIN)) 376 if (!capable(CAP_NET_ADMIN))
368 return -EPERM; 377 return -EPERM;
369 378
379 if (rfkill->user_claim_unsupported)
380 return -EOPNOTSUPP;
381
370 /* 382 /*
371 * Take the global lock to make sure the kernel is not in 383 * Take the global lock to make sure the kernel is not in
372 * the middle of rfkill_switch_all 384 * the middle of rfkill_switch_all
@@ -375,19 +387,17 @@ static ssize_t rfkill_claim_store(struct device *dev,
375 if (error) 387 if (error)
376 return error; 388 return error;
377 389
378 if (rfkill->user_claim_unsupported) {
379 error = -EOPNOTSUPP;
380 goto out_unlock;
381 }
382 if (rfkill->user_claim != claim) { 390 if (rfkill->user_claim != claim) {
383 if (!claim) 391 if (!claim) {
392 mutex_lock(&rfkill->mutex);
384 rfkill_toggle_radio(rfkill, 393 rfkill_toggle_radio(rfkill,
385 rfkill_states[rfkill->type], 394 rfkill_states[rfkill->type],
386 0); 395 0);
396 mutex_unlock(&rfkill->mutex);
397 }
387 rfkill->user_claim = claim; 398 rfkill->user_claim = claim;
388 } 399 }
389 400
390out_unlock:
391 mutex_unlock(&rfkill_mutex); 401 mutex_unlock(&rfkill_mutex);
392 402
393 return error ? error : count; 403 return error ? error : count;
@@ -516,8 +526,11 @@ static void rfkill_remove_switch(struct rfkill *rfkill)
516{ 526{
517 mutex_lock(&rfkill_mutex); 527 mutex_lock(&rfkill_mutex);
518 list_del_init(&rfkill->node); 528 list_del_init(&rfkill->node);
519 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1);
520 mutex_unlock(&rfkill_mutex); 529 mutex_unlock(&rfkill_mutex);
530
531 mutex_lock(&rfkill->mutex);
532 rfkill_toggle_radio(rfkill, RFKILL_STATE_SOFT_BLOCKED, 1);
533 mutex_unlock(&rfkill->mutex);
521} 534}
522 535
523/** 536/**
@@ -526,9 +539,10 @@ static void rfkill_remove_switch(struct rfkill *rfkill)
526 * @type: type of the switch (RFKILL_TYPE_*) 539 * @type: type of the switch (RFKILL_TYPE_*)
527 * 540 *
528 * This function should be called by the network driver when it needs 541 * This function should be called by the network driver when it needs
529 * rfkill structure. Once the structure is allocated the driver shoud 542 * rfkill structure. Once the structure is allocated the driver should
530 * finish its initialization by setting name, private data, enable_radio 543 * finish its initialization by setting the name, private data, enable_radio
531 * and disable_radio methods and then register it with rfkill_register(). 544 * and disable_radio methods and then register it with rfkill_register().
545 *
532 * NOTE: If registration fails the structure shoudl be freed by calling 546 * NOTE: If registration fails the structure shoudl be freed by calling
533 * rfkill_free() otherwise rfkill_unregister() should be used. 547 * rfkill_free() otherwise rfkill_unregister() should be used.
534 */ 548 */
@@ -560,7 +574,7 @@ EXPORT_SYMBOL(rfkill_allocate);
560 * rfkill_free - Mark rfkill structure for deletion 574 * rfkill_free - Mark rfkill structure for deletion
561 * @rfkill: rfkill structure to be destroyed 575 * @rfkill: rfkill structure to be destroyed
562 * 576 *
563 * Decrements reference count of rfkill structure so it is destroyed. 577 * Decrements reference count of the rfkill structure so it is destroyed.
564 * Note that rfkill_free() should _not_ be called after rfkill_unregister(). 578 * Note that rfkill_free() should _not_ be called after rfkill_unregister().
565 */ 579 */
566void rfkill_free(struct rfkill *rfkill) 580void rfkill_free(struct rfkill *rfkill)
@@ -585,8 +599,10 @@ static void rfkill_led_trigger_register(struct rfkill *rfkill)
585static void rfkill_led_trigger_unregister(struct rfkill *rfkill) 599static void rfkill_led_trigger_unregister(struct rfkill *rfkill)
586{ 600{
587#ifdef CONFIG_RFKILL_LEDS 601#ifdef CONFIG_RFKILL_LEDS
588 if (rfkill->led_trigger.name) 602 if (rfkill->led_trigger.name) {
589 led_trigger_unregister(&rfkill->led_trigger); 603 led_trigger_unregister(&rfkill->led_trigger);
604 rfkill->led_trigger.name = NULL;
605 }
590#endif 606#endif
591} 607}
592 608
@@ -622,8 +638,8 @@ int rfkill_register(struct rfkill *rfkill)
622 638
623 error = device_add(dev); 639 error = device_add(dev);
624 if (error) { 640 if (error) {
625 rfkill_led_trigger_unregister(rfkill);
626 rfkill_remove_switch(rfkill); 641 rfkill_remove_switch(rfkill);
642 rfkill_led_trigger_unregister(rfkill);
627 return error; 643 return error;
628 } 644 }
629 645
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index b0601642e227..4840aff47256 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -572,44 +572,21 @@ static u32 qdisc_alloc_handle(struct net_device *dev)
572static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, 572static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
573 struct Qdisc *qdisc) 573 struct Qdisc *qdisc)
574{ 574{
575 struct Qdisc *oqdisc = dev_queue->qdisc_sleeping;
575 spinlock_t *root_lock; 576 spinlock_t *root_lock;
576 struct Qdisc *oqdisc;
577 int ingress;
578
579 ingress = 0;
580 if (qdisc && qdisc->flags&TCQ_F_INGRESS)
581 ingress = 1;
582
583 if (ingress) {
584 oqdisc = dev_queue->qdisc;
585 } else {
586 oqdisc = dev_queue->qdisc_sleeping;
587 }
588 577
589 root_lock = qdisc_root_lock(oqdisc); 578 root_lock = qdisc_root_lock(oqdisc);
590 spin_lock_bh(root_lock); 579 spin_lock_bh(root_lock);
591 580
592 if (ingress) { 581 /* Prune old scheduler */
593 /* Prune old scheduler */ 582 if (oqdisc && atomic_read(&oqdisc->refcnt) <= 1)
594 if (oqdisc && atomic_read(&oqdisc->refcnt) <= 1) { 583 qdisc_reset(oqdisc);
595 /* delete */
596 qdisc_reset(oqdisc);
597 dev_queue->qdisc = NULL;
598 } else { /* new */
599 dev_queue->qdisc = qdisc;
600 }
601 584
602 } else { 585 /* ... and graft new one */
603 /* Prune old scheduler */ 586 if (qdisc == NULL)
604 if (oqdisc && atomic_read(&oqdisc->refcnt) <= 1) 587 qdisc = &noop_qdisc;
605 qdisc_reset(oqdisc); 588 dev_queue->qdisc_sleeping = qdisc;
606 589 dev_queue->qdisc = &noop_qdisc;
607 /* ... and graft new one */
608 if (qdisc == NULL)
609 qdisc = &noop_qdisc;
610 dev_queue->qdisc_sleeping = qdisc;
611 dev_queue->qdisc = &noop_qdisc;
612 }
613 590
614 spin_unlock_bh(root_lock); 591 spin_unlock_bh(root_lock);
615 592
@@ -678,7 +655,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
678 655
679 ingress = 0; 656 ingress = 0;
680 num_q = dev->num_tx_queues; 657 num_q = dev->num_tx_queues;
681 if (q && q->flags & TCQ_F_INGRESS) { 658 if ((q && q->flags & TCQ_F_INGRESS) ||
659 (new && new->flags & TCQ_F_INGRESS)) {
682 num_q = 1; 660 num_q = 1;
683 ingress = 1; 661 ingress = 1;
684 } 662 }
@@ -692,13 +670,10 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
692 if (!ingress) 670 if (!ingress)
693 dev_queue = netdev_get_tx_queue(dev, i); 671 dev_queue = netdev_get_tx_queue(dev, i);
694 672
695 if (ingress) { 673 old = dev_graft_qdisc(dev_queue, new);
696 old = dev_graft_qdisc(dev_queue, q); 674 if (new && i > 0)
697 } else { 675 atomic_inc(&new->refcnt);
698 old = dev_graft_qdisc(dev_queue, new); 676
699 if (new && i > 0)
700 atomic_inc(&new->refcnt);
701 }
702 notify_and_destroy(skb, n, classid, old, new); 677 notify_and_destroy(skb, n, classid, old, new);
703 } 678 }
704 679
@@ -817,7 +792,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
817 goto err_out3; 792 goto err_out3;
818 } 793 }
819 } 794 }
820 if (parent) 795 if (parent && !(sch->flags & TCQ_F_INGRESS))
821 list_add_tail(&sch->list, &dev_queue->qdisc->list); 796 list_add_tail(&sch->list, &dev_queue->qdisc->list);
822 797
823 return sch; 798 return sch;
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index fd2a6cadb115..9c9cd4d94890 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -135,7 +135,8 @@ static inline int qdisc_restart(struct Qdisc *q)
135 txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); 135 txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb));
136 136
137 HARD_TX_LOCK(dev, txq, smp_processor_id()); 137 HARD_TX_LOCK(dev, txq, smp_processor_id());
138 if (!netif_subqueue_stopped(dev, skb)) 138 if (!netif_tx_queue_stopped(txq) &&
139 !netif_tx_queue_frozen(txq))
139 ret = dev_hard_start_xmit(skb, dev, txq); 140 ret = dev_hard_start_xmit(skb, dev, txq);
140 HARD_TX_UNLOCK(dev, txq); 141 HARD_TX_UNLOCK(dev, txq);
141 142
@@ -162,7 +163,8 @@ static inline int qdisc_restart(struct Qdisc *q)
162 break; 163 break;
163 } 164 }
164 165
165 if (ret && netif_tx_queue_stopped(txq)) 166 if (ret && (netif_tx_queue_stopped(txq) ||
167 netif_tx_queue_frozen(txq)))
166 ret = 0; 168 ret = 0;
167 169
168 return ret; 170 return ret;
@@ -596,7 +598,7 @@ static void transition_one_qdisc(struct net_device *dev,
596 int *need_watchdog_p = _need_watchdog; 598 int *need_watchdog_p = _need_watchdog;
597 599
598 rcu_assign_pointer(dev_queue->qdisc, new_qdisc); 600 rcu_assign_pointer(dev_queue->qdisc, new_qdisc);
599 if (new_qdisc != &noqueue_qdisc) 601 if (need_watchdog_p && new_qdisc != &noqueue_qdisc)
600 *need_watchdog_p = 1; 602 *need_watchdog_p = 1;
601} 603}
602 604
@@ -619,6 +621,7 @@ void dev_activate(struct net_device *dev)
619 621
620 need_watchdog = 0; 622 need_watchdog = 0;
621 netdev_for_each_tx_queue(dev, transition_one_qdisc, &need_watchdog); 623 netdev_for_each_tx_queue(dev, transition_one_qdisc, &need_watchdog);
624 transition_one_qdisc(dev, &dev->rx_queue, NULL);
622 625
623 if (need_watchdog) { 626 if (need_watchdog) {
624 dev->trans_start = jiffies; 627 dev->trans_start = jiffies;
@@ -677,6 +680,7 @@ void dev_deactivate(struct net_device *dev)
677 bool running; 680 bool running;
678 681
679 netdev_for_each_tx_queue(dev, dev_deactivate_queue, &noop_qdisc); 682 netdev_for_each_tx_queue(dev, dev_deactivate_queue, &noop_qdisc);
683 dev_deactivate_queue(dev, &dev->rx_queue, &noop_qdisc);
680 684
681 dev_watchdog_down(dev); 685 dev_watchdog_down(dev);
682 686
@@ -718,7 +722,7 @@ static void dev_init_scheduler_queue(struct net_device *dev,
718void dev_init_scheduler(struct net_device *dev) 722void dev_init_scheduler(struct net_device *dev)
719{ 723{
720 netdev_for_each_tx_queue(dev, dev_init_scheduler_queue, &noop_qdisc); 724 netdev_for_each_tx_queue(dev, dev_init_scheduler_queue, &noop_qdisc);
721 dev_init_scheduler_queue(dev, &dev->rx_queue, NULL); 725 dev_init_scheduler_queue(dev, &dev->rx_queue, &noop_qdisc);
722 726
723 setup_timer(&dev->watchdog_timer, dev_watchdog, (unsigned long)dev); 727 setup_timer(&dev->watchdog_timer, dev_watchdog, (unsigned long)dev);
724} 728}
@@ -745,6 +749,6 @@ static void shutdown_scheduler_queue(struct net_device *dev,
745void dev_shutdown(struct net_device *dev) 749void dev_shutdown(struct net_device *dev)
746{ 750{
747 netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc); 751 netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc);
748 shutdown_scheduler_queue(dev, &dev->rx_queue, NULL); 752 shutdown_scheduler_queue(dev, &dev->rx_queue, &noop_qdisc);
749 WARN_ON(timer_pending(&dev->watchdog_timer)); 753 WARN_ON(timer_pending(&dev->watchdog_timer));
750} 754}
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 537223642b6e..2c35c678563b 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -305,10 +305,11 @@ restart:
305 305
306 switch (teql_resolve(skb, skb_res, slave)) { 306 switch (teql_resolve(skb, skb_res, slave)) {
307 case 0: 307 case 0:
308 if (netif_tx_trylock(slave)) { 308 if (__netif_tx_trylock(slave_txq)) {
309 if (!__netif_subqueue_stopped(slave, subq) && 309 if (!netif_tx_queue_stopped(slave_txq) &&
310 !netif_tx_queue_frozen(slave_txq) &&
310 slave->hard_start_xmit(skb, slave) == 0) { 311 slave->hard_start_xmit(skb, slave) == 0) {
311 netif_tx_unlock(slave); 312 __netif_tx_unlock(slave_txq);
312 master->slaves = NEXT_SLAVE(q); 313 master->slaves = NEXT_SLAVE(q);
313 netif_wake_queue(dev); 314 netif_wake_queue(dev);
314 master->stats.tx_packets++; 315 master->stats.tx_packets++;
@@ -316,7 +317,7 @@ restart:
316 qdisc_pkt_len(skb); 317 qdisc_pkt_len(skb);
317 return 0; 318 return 0;
318 } 319 }
319 netif_tx_unlock(slave); 320 __netif_tx_unlock(slave_txq);
320 } 321 }
321 if (netif_queue_stopped(dev)) 322 if (netif_queue_stopped(dev))
322 busy = 1; 323 busy = 1;
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 835d27413083..5a32cb7c4bb4 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -310,8 +310,7 @@ svc_pool_map_set_cpumask(struct task_struct *task, unsigned int pidx)
310 switch (m->mode) { 310 switch (m->mode) {
311 case SVC_POOL_PERCPU: 311 case SVC_POOL_PERCPU:
312 { 312 {
313 cpumask_of_cpu_ptr(cpumask, node); 313 set_cpus_allowed_ptr(task, &cpumask_of_cpu(node));
314 set_cpus_allowed_ptr(task, cpumask);
315 break; 314 break;
316 } 315 }
317 case SVC_POOL_PERNODE: 316 case SVC_POOL_PERNODE:
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index b7fefffd2d0d..59eb2cf42e5f 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -29,16 +29,16 @@ static struct genl_family nl80211_fam = {
29}; 29};
30 30
31/* internal helper: get drv and dev */ 31/* internal helper: get drv and dev */
32static int get_drv_dev_by_info_ifindex(struct genl_info *info, 32static int get_drv_dev_by_info_ifindex(struct nlattr **attrs,
33 struct cfg80211_registered_device **drv, 33 struct cfg80211_registered_device **drv,
34 struct net_device **dev) 34 struct net_device **dev)
35{ 35{
36 int ifindex; 36 int ifindex;
37 37
38 if (!info->attrs[NL80211_ATTR_IFINDEX]) 38 if (!attrs[NL80211_ATTR_IFINDEX])
39 return -EINVAL; 39 return -EINVAL;
40 40
41 ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]); 41 ifindex = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]);
42 *dev = dev_get_by_index(&init_net, ifindex); 42 *dev = dev_get_by_index(&init_net, ifindex);
43 if (!*dev) 43 if (!*dev)
44 return -ENODEV; 44 return -ENODEV;
@@ -291,21 +291,31 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *
291 291
292 mutex_lock(&cfg80211_drv_mutex); 292 mutex_lock(&cfg80211_drv_mutex);
293 list_for_each_entry(dev, &cfg80211_drv_list, list) { 293 list_for_each_entry(dev, &cfg80211_drv_list, list) {
294 if (++wp_idx < wp_start) 294 if (wp_idx < wp_start) {
295 wp_idx++;
295 continue; 296 continue;
297 }
296 if_idx = 0; 298 if_idx = 0;
297 299
298 mutex_lock(&dev->devlist_mtx); 300 mutex_lock(&dev->devlist_mtx);
299 list_for_each_entry(wdev, &dev->netdev_list, list) { 301 list_for_each_entry(wdev, &dev->netdev_list, list) {
300 if (++if_idx < if_start) 302 if (if_idx < if_start) {
303 if_idx++;
301 continue; 304 continue;
305 }
302 if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).pid, 306 if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).pid,
303 cb->nlh->nlmsg_seq, NLM_F_MULTI, 307 cb->nlh->nlmsg_seq, NLM_F_MULTI,
304 wdev->netdev) < 0) 308 wdev->netdev) < 0) {
305 break; 309 mutex_unlock(&dev->devlist_mtx);
310 goto out;
311 }
312 if_idx++;
306 } 313 }
307 mutex_unlock(&dev->devlist_mtx); 314 mutex_unlock(&dev->devlist_mtx);
315
316 wp_idx++;
308 } 317 }
318 out:
309 mutex_unlock(&cfg80211_drv_mutex); 319 mutex_unlock(&cfg80211_drv_mutex);
310 320
311 cb->args[0] = wp_idx; 321 cb->args[0] = wp_idx;
@@ -321,7 +331,7 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info)
321 struct net_device *netdev; 331 struct net_device *netdev;
322 int err; 332 int err;
323 333
324 err = get_drv_dev_by_info_ifindex(info, &dev, &netdev); 334 err = get_drv_dev_by_info_ifindex(info->attrs, &dev, &netdev);
325 if (err) 335 if (err)
326 return err; 336 return err;
327 337
@@ -392,7 +402,7 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
392 } else 402 } else
393 return -EINVAL; 403 return -EINVAL;
394 404
395 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 405 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
396 if (err) 406 if (err)
397 return err; 407 return err;
398 ifindex = dev->ifindex; 408 ifindex = dev->ifindex;
@@ -477,7 +487,7 @@ static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info)
477 int ifindex, err; 487 int ifindex, err;
478 struct net_device *dev; 488 struct net_device *dev;
479 489
480 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 490 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
481 if (err) 491 if (err)
482 return err; 492 return err;
483 ifindex = dev->ifindex; 493 ifindex = dev->ifindex;
@@ -545,7 +555,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
545 if (info->attrs[NL80211_ATTR_MAC]) 555 if (info->attrs[NL80211_ATTR_MAC])
546 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 556 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
547 557
548 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 558 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
549 if (err) 559 if (err)
550 return err; 560 return err;
551 561
@@ -618,7 +628,7 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info)
618 if (!info->attrs[NL80211_ATTR_KEY_DEFAULT]) 628 if (!info->attrs[NL80211_ATTR_KEY_DEFAULT])
619 return -EINVAL; 629 return -EINVAL;
620 630
621 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 631 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
622 if (err) 632 if (err)
623 return err; 633 return err;
624 634
@@ -699,7 +709,7 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
699 return -EINVAL; 709 return -EINVAL;
700 } 710 }
701 711
702 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 712 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
703 if (err) 713 if (err)
704 return err; 714 return err;
705 715
@@ -735,7 +745,7 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info)
735 if (info->attrs[NL80211_ATTR_MAC]) 745 if (info->attrs[NL80211_ATTR_MAC])
736 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 746 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
737 747
738 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 748 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
739 if (err) 749 if (err)
740 return err; 750 return err;
741 751
@@ -764,7 +774,7 @@ static int nl80211_addset_beacon(struct sk_buff *skb, struct genl_info *info)
764 struct beacon_parameters params; 774 struct beacon_parameters params;
765 int haveinfo = 0; 775 int haveinfo = 0;
766 776
767 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 777 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
768 if (err) 778 if (err)
769 return err; 779 return err;
770 780
@@ -843,7 +853,7 @@ static int nl80211_del_beacon(struct sk_buff *skb, struct genl_info *info)
843 int err; 853 int err;
844 struct net_device *dev; 854 struct net_device *dev;
845 855
846 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 856 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
847 if (err) 857 if (err)
848 return err; 858 return err;
849 859
@@ -937,67 +947,78 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq,
937} 947}
938 948
939static int nl80211_dump_station(struct sk_buff *skb, 949static int nl80211_dump_station(struct sk_buff *skb,
940 struct netlink_callback *cb) 950 struct netlink_callback *cb)
941{ 951{
942 int wp_idx = 0;
943 int if_idx = 0;
944 int sta_idx = cb->args[2];
945 int wp_start = cb->args[0];
946 int if_start = cb->args[1];
947 struct station_info sinfo; 952 struct station_info sinfo;
948 struct cfg80211_registered_device *dev; 953 struct cfg80211_registered_device *dev;
949 struct wireless_dev *wdev; 954 struct net_device *netdev;
950 u8 mac_addr[ETH_ALEN]; 955 u8 mac_addr[ETH_ALEN];
956 int ifidx = cb->args[0];
957 int sta_idx = cb->args[1];
951 int err; 958 int err;
952 int exit = 0;
953 959
954 /* TODO: filter by device */ 960 if (!ifidx) {
955 mutex_lock(&cfg80211_drv_mutex); 961 err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
956 list_for_each_entry(dev, &cfg80211_drv_list, list) { 962 nl80211_fam.attrbuf, nl80211_fam.maxattr,
957 if (exit) 963 nl80211_policy);
964 if (err)
965 return err;
966
967 if (!nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX])
968 return -EINVAL;
969
970 ifidx = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX]);
971 if (!ifidx)
972 return -EINVAL;
973 }
974
975 netdev = dev_get_by_index(&init_net, ifidx);
976 if (!netdev)
977 return -ENODEV;
978
979 dev = cfg80211_get_dev_from_ifindex(ifidx);
980 if (IS_ERR(dev)) {
981 err = PTR_ERR(dev);
982 goto out_put_netdev;
983 }
984
985 if (!dev->ops->dump_station) {
986 err = -ENOSYS;
987 goto out_err;
988 }
989
990 rtnl_lock();
991
992 while (1) {
993 err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx,
994 mac_addr, &sinfo);
995 if (err == -ENOENT)
958 break; 996 break;
959 if (++wp_idx < wp_start) 997 if (err)
960 continue; 998 goto out_err_rtnl;
961 if_idx = 0;
962 999
963 mutex_lock(&dev->devlist_mtx); 1000 if (nl80211_send_station(skb,
964 list_for_each_entry(wdev, &dev->netdev_list, list) { 1001 NETLINK_CB(cb->skb).pid,
965 if (exit) 1002 cb->nlh->nlmsg_seq, NLM_F_MULTI,
966 break; 1003 netdev, mac_addr,
967 if (++if_idx < if_start) 1004 &sinfo) < 0)
968 continue; 1005 goto out;
969 if (!dev->ops->dump_station)
970 continue;
971 1006
972 for (;; ++sta_idx) { 1007 sta_idx++;
973 rtnl_lock();
974 err = dev->ops->dump_station(&dev->wiphy,
975 wdev->netdev, sta_idx, mac_addr,
976 &sinfo);
977 rtnl_unlock();
978 if (err) {
979 sta_idx = 0;
980 break;
981 }
982 if (nl80211_send_station(skb,
983 NETLINK_CB(cb->skb).pid,
984 cb->nlh->nlmsg_seq, NLM_F_MULTI,
985 wdev->netdev, mac_addr,
986 &sinfo) < 0) {
987 exit = 1;
988 break;
989 }
990 }
991 }
992 mutex_unlock(&dev->devlist_mtx);
993 } 1008 }
994 mutex_unlock(&cfg80211_drv_mutex);
995 1009
996 cb->args[0] = wp_idx;
997 cb->args[1] = if_idx;
998 cb->args[2] = sta_idx;
999 1010
1000 return skb->len; 1011 out:
1012 cb->args[1] = sta_idx;
1013 err = skb->len;
1014 out_err_rtnl:
1015 rtnl_unlock();
1016 out_err:
1017 cfg80211_put_dev(dev);
1018 out_put_netdev:
1019 dev_put(netdev);
1020
1021 return err;
1001} 1022}
1002 1023
1003static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) 1024static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
@@ -1016,7 +1037,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
1016 1037
1017 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 1038 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
1018 1039
1019 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1040 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1020 if (err) 1041 if (err)
1021 return err; 1042 return err;
1022 1043
@@ -1112,7 +1133,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
1112 params.plink_action = 1133 params.plink_action =
1113 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]); 1134 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]);
1114 1135
1115 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1136 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1116 if (err) 1137 if (err)
1117 return err; 1138 return err;
1118 1139
@@ -1172,7 +1193,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
1172 &params.station_flags)) 1193 &params.station_flags))
1173 return -EINVAL; 1194 return -EINVAL;
1174 1195
1175 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1196 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1176 if (err) 1197 if (err)
1177 return err; 1198 return err;
1178 1199
@@ -1207,7 +1228,7 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
1207 if (info->attrs[NL80211_ATTR_MAC]) 1228 if (info->attrs[NL80211_ATTR_MAC])
1208 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 1229 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
1209 1230
1210 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1231 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1211 if (err) 1232 if (err)
1212 return err; 1233 return err;
1213 1234
@@ -1277,68 +1298,78 @@ static int nl80211_send_mpath(struct sk_buff *msg, u32 pid, u32 seq,
1277} 1298}
1278 1299
1279static int nl80211_dump_mpath(struct sk_buff *skb, 1300static int nl80211_dump_mpath(struct sk_buff *skb,
1280 struct netlink_callback *cb) 1301 struct netlink_callback *cb)
1281{ 1302{
1282 int wp_idx = 0;
1283 int if_idx = 0;
1284 int sta_idx = cb->args[2];
1285 int wp_start = cb->args[0];
1286 int if_start = cb->args[1];
1287 struct mpath_info pinfo; 1303 struct mpath_info pinfo;
1288 struct cfg80211_registered_device *dev; 1304 struct cfg80211_registered_device *dev;
1289 struct wireless_dev *wdev; 1305 struct net_device *netdev;
1290 u8 dst[ETH_ALEN]; 1306 u8 dst[ETH_ALEN];
1291 u8 next_hop[ETH_ALEN]; 1307 u8 next_hop[ETH_ALEN];
1308 int ifidx = cb->args[0];
1309 int path_idx = cb->args[1];
1292 int err; 1310 int err;
1293 int exit = 0;
1294 1311
1295 /* TODO: filter by device */ 1312 if (!ifidx) {
1296 mutex_lock(&cfg80211_drv_mutex); 1313 err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
1297 list_for_each_entry(dev, &cfg80211_drv_list, list) { 1314 nl80211_fam.attrbuf, nl80211_fam.maxattr,
1298 if (exit) 1315 nl80211_policy);
1316 if (err)
1317 return err;
1318
1319 if (!nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX])
1320 return -EINVAL;
1321
1322 ifidx = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX]);
1323 if (!ifidx)
1324 return -EINVAL;
1325 }
1326
1327 netdev = dev_get_by_index(&init_net, ifidx);
1328 if (!netdev)
1329 return -ENODEV;
1330
1331 dev = cfg80211_get_dev_from_ifindex(ifidx);
1332 if (IS_ERR(dev)) {
1333 err = PTR_ERR(dev);
1334 goto out_put_netdev;
1335 }
1336
1337 if (!dev->ops->dump_mpath) {
1338 err = -ENOSYS;
1339 goto out_err;
1340 }
1341
1342 rtnl_lock();
1343
1344 while (1) {
1345 err = dev->ops->dump_mpath(&dev->wiphy, netdev, path_idx,
1346 dst, next_hop, &pinfo);
1347 if (err == -ENOENT)
1299 break; 1348 break;
1300 if (++wp_idx < wp_start) 1349 if (err)
1301 continue; 1350 goto out_err_rtnl;
1302 if_idx = 0;
1303 1351
1304 mutex_lock(&dev->devlist_mtx); 1352 if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).pid,
1305 list_for_each_entry(wdev, &dev->netdev_list, list) { 1353 cb->nlh->nlmsg_seq, NLM_F_MULTI,
1306 if (exit) 1354 netdev, dst, next_hop,
1307 break; 1355 &pinfo) < 0)
1308 if (++if_idx < if_start) 1356 goto out;
1309 continue;
1310 if (!dev->ops->dump_mpath)
1311 continue;
1312 1357
1313 for (;; ++sta_idx) { 1358 path_idx++;
1314 rtnl_lock();
1315 err = dev->ops->dump_mpath(&dev->wiphy,
1316 wdev->netdev, sta_idx, dst,
1317 next_hop, &pinfo);
1318 rtnl_unlock();
1319 if (err) {
1320 sta_idx = 0;
1321 break;
1322 }
1323 if (nl80211_send_mpath(skb,
1324 NETLINK_CB(cb->skb).pid,
1325 cb->nlh->nlmsg_seq, NLM_F_MULTI,
1326 wdev->netdev, dst, next_hop,
1327 &pinfo) < 0) {
1328 exit = 1;
1329 break;
1330 }
1331 }
1332 }
1333 mutex_unlock(&dev->devlist_mtx);
1334 } 1359 }
1335 mutex_unlock(&cfg80211_drv_mutex);
1336 1360
1337 cb->args[0] = wp_idx;
1338 cb->args[1] = if_idx;
1339 cb->args[2] = sta_idx;
1340 1361
1341 return skb->len; 1362 out:
1363 cb->args[1] = path_idx;
1364 err = skb->len;
1365 out_err_rtnl:
1366 rtnl_unlock();
1367 out_err:
1368 cfg80211_put_dev(dev);
1369 out_put_netdev:
1370 dev_put(netdev);
1371
1372 return err;
1342} 1373}
1343 1374
1344static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info) 1375static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)
@@ -1358,7 +1389,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)
1358 1389
1359 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); 1390 dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
1360 1391
1361 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1392 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1362 if (err) 1393 if (err)
1363 return err; 1394 return err;
1364 1395
@@ -1411,7 +1442,7 @@ static int nl80211_set_mpath(struct sk_buff *skb, struct genl_info *info)
1411 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); 1442 dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
1412 next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]); 1443 next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]);
1413 1444
1414 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1445 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1415 if (err) 1446 if (err)
1416 return err; 1447 return err;
1417 1448
@@ -1446,7 +1477,7 @@ static int nl80211_new_mpath(struct sk_buff *skb, struct genl_info *info)
1446 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); 1477 dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
1447 next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]); 1478 next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]);
1448 1479
1449 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1480 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1450 if (err) 1481 if (err)
1451 return err; 1482 return err;
1452 1483
@@ -1475,7 +1506,7 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info)
1475 if (info->attrs[NL80211_ATTR_MAC]) 1506 if (info->attrs[NL80211_ATTR_MAC])
1476 dst = nla_data(info->attrs[NL80211_ATTR_MAC]); 1507 dst = nla_data(info->attrs[NL80211_ATTR_MAC]);
1477 1508
1478 err = get_drv_dev_by_info_ifindex(info, &drv, &dev); 1509 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
1479 if (err) 1510 if (err)
1480 return err; 1511 return err;
1481 1512
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index 4f8a3007e457..c249274e005a 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -545,6 +545,8 @@ int main(int argc, char **argv)
545 } 545 }
546 fputs(sym->name, dumpfile); 546 fputs(sym->name, dumpfile);
547 putc(' ', dumpfile); 547 putc(' ', dumpfile);
548 if (sym->is_extern)
549 fputs("extern ", dumpfile);
548 print_list(dumpfile, sym->defn); 550 print_list(dumpfile, sym->defn);
549 putc('\n', dumpfile); 551 putc('\n', dumpfile);
550 552
diff --git a/scripts/genksyms/lex.c_shipped b/scripts/genksyms/lex.c_shipped
index 2a176988d468..2ac23bcca5b5 100644
--- a/scripts/genksyms/lex.c_shipped
+++ b/scripts/genksyms/lex.c_shipped
@@ -6,10 +6,19 @@
6 6
7/* A lexical scanner generated by flex */ 7/* A lexical scanner generated by flex */
8 8
9/* %not-for-header */
10
11/* %if-c-only */
12/* %if-not-reentrant */
13
14/* %endif */
15/* %endif */
16/* %ok-for-header */
17
9#define FLEX_SCANNER 18#define FLEX_SCANNER
10#define YY_FLEX_MAJOR_VERSION 2 19#define YY_FLEX_MAJOR_VERSION 2
11#define YY_FLEX_MINOR_VERSION 5 20#define YY_FLEX_MINOR_VERSION 5
12#define YY_FLEX_SUBMINOR_VERSION 33 21#define YY_FLEX_SUBMINOR_VERSION 35
13#if YY_FLEX_SUBMINOR_VERSION > 0 22#if YY_FLEX_SUBMINOR_VERSION > 0
14#define FLEX_BETA 23#define FLEX_BETA
15#endif 24#endif
@@ -47,7 +56,7 @@
47 56
48/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 57/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
49 58
50#if __STDC_VERSION__ >= 199901L 59#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
51 60
52/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 61/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
53 * if you want the limit (max/min) macros for int types. 62 * if you want the limit (max/min) macros for int types.
@@ -70,7 +79,6 @@ typedef int flex_int32_t;
70typedef unsigned char flex_uint8_t; 79typedef unsigned char flex_uint8_t;
71typedef unsigned short int flex_uint16_t; 80typedef unsigned short int flex_uint16_t;
72typedef unsigned int flex_uint32_t; 81typedef unsigned int flex_uint32_t;
73#endif /* ! C99 */
74 82
75/* Limits of integral types. */ 83/* Limits of integral types. */
76#ifndef INT8_MIN 84#ifndef INT8_MIN
@@ -101,6 +109,8 @@ typedef unsigned int flex_uint32_t;
101#define UINT32_MAX (4294967295U) 109#define UINT32_MAX (4294967295U)
102#endif 110#endif
103 111
112#endif /* ! C99 */
113
104#endif /* ! FLEXINT_H */ 114#endif /* ! FLEXINT_H */
105 115
106/* %endif */ 116/* %endif */
@@ -115,11 +125,12 @@ typedef unsigned int flex_uint32_t;
115 125
116#else /* ! __cplusplus */ 126#else /* ! __cplusplus */
117 127
118#if __STDC__ 128/* C99 requires __STDC__ to be defined as 1. */
129#if defined (__STDC__)
119 130
120#define YY_USE_CONST 131#define YY_USE_CONST
121 132
122#endif /* __STDC__ */ 133#endif /* defined (__STDC__) */
123#endif /* ! __cplusplus */ 134#endif /* ! __cplusplus */
124 135
125#ifdef YY_USE_CONST 136#ifdef YY_USE_CONST
@@ -218,14 +229,9 @@ extern FILE *yyin, *yyout;
218 229
219#define unput(c) yyunput( c, (yytext_ptr) ) 230#define unput(c) yyunput( c, (yytext_ptr) )
220 231
221/* The following is because we cannot portably get our hands on size_t
222 * (without autoconf's help, which isn't available because we want
223 * flex-generated scanners to compile on their own).
224 */
225
226#ifndef YY_TYPEDEF_YY_SIZE_T 232#ifndef YY_TYPEDEF_YY_SIZE_T
227#define YY_TYPEDEF_YY_SIZE_T 233#define YY_TYPEDEF_YY_SIZE_T
228typedef unsigned int yy_size_t; 234typedef size_t yy_size_t;
229#endif 235#endif
230 236
231#ifndef YY_STRUCT_YY_BUFFER_STATE 237#ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -401,7 +407,7 @@ void yyfree (void * );
401/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ 407/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
402/* Begin user sect3 */ 408/* Begin user sect3 */
403 409
404#define yywrap() 1 410#define yywrap(n) 1
405#define YY_SKIP_YYWRAP 411#define YY_SKIP_YYWRAP
406 412
407#define FLEX_DEBUG 413#define FLEX_DEBUG
@@ -613,8 +619,8 @@ int yy_flex_debug = 1;
613 619
614static yyconst flex_int16_t yy_rule_linenum[13] = 620static yyconst flex_int16_t yy_rule_linenum[13] =
615 { 0, 621 { 0,
616 69, 70, 71, 74, 77, 78, 79, 85, 86, 87, 622 71, 72, 73, 76, 79, 80, 81, 87, 88, 89,
617 89, 92 623 91, 94
618 } ; 624 } ;
619 625
620/* The intent behind this definition is that it'll catch 626/* The intent behind this definition is that it'll catch
@@ -665,7 +671,8 @@ char *yytext;
665 quite so pedantic. */ 671 quite so pedantic. */
666 672
667/* We don't do multiple input files. */ 673/* We don't do multiple input files. */
668#line 669 "scripts/genksyms/lex.c" 674#define YY_NO_INPUT 1
675#line 676 "scripts/genksyms/lex.c"
669 676
670#define INITIAL 0 677#define INITIAL 0
671#define V2_TOKENS 1 678#define V2_TOKENS 1
@@ -695,9 +702,39 @@ static int yy_init_globals (void );
695/* %endif */ 702/* %endif */
696/* %if-reentrant */ 703/* %if-reentrant */
697/* %endif */ 704/* %endif */
705/* %endif End reentrant structures and macros. */
706
707/* Accessor methods to globals.
708 These are made visible to non-reentrant scanners for convenience. */
709
710int yylex_destroy (void );
711
712int yyget_debug (void );
713
714void yyset_debug (int debug_flag );
715
716YY_EXTRA_TYPE yyget_extra (void );
717
718void yyset_extra (YY_EXTRA_TYPE user_defined );
719
720FILE *yyget_in (void );
721
722void yyset_in (FILE * in_str );
723
724FILE *yyget_out (void );
725
726void yyset_out (FILE * out_str );
727
728int yyget_leng (void );
729
730char *yyget_text (void );
731
732int yyget_lineno (void );
733
734void yyset_lineno (int line_number );
735
698/* %if-bison-bridge */ 736/* %if-bison-bridge */
699/* %endif */ 737/* %endif */
700/* %endif End reentrant structures and macros. */
701 738
702/* Macros after this point can all be overridden by user definitions in 739/* Macros after this point can all be overridden by user definitions in
703 * section 1. 740 * section 1.
@@ -756,7 +793,7 @@ static int input (void );
756/* This used to be an fputs(), but since the string might contain NUL's, 793/* This used to be an fputs(), but since the string might contain NUL's,
757 * we now use fwrite(). 794 * we now use fwrite().
758 */ 795 */
759#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) 796#define ECHO fwrite( yytext, yyleng, 1, yyout )
760/* %endif */ 797/* %endif */
761/* %if-c++-only C++ definition */ 798/* %if-c++-only C++ definition */
762/* %endif */ 799/* %endif */
@@ -881,12 +918,12 @@ YY_DECL
881 register int yy_act; 918 register int yy_act;
882 919
883/* %% [7.0] user's declarations go here */ 920/* %% [7.0] user's declarations go here */
884#line 65 "scripts/genksyms/lex.l" 921#line 67 "scripts/genksyms/lex.l"
885 922
886 923
887 924
888 /* Keep track of our location in the original source files. */ 925 /* Keep track of our location in the original source files. */
889#line 890 "scripts/genksyms/lex.c" 926#line 927 "scripts/genksyms/lex.c"
890 927
891 if ( !(yy_init) ) 928 if ( !(yy_init) )
892 { 929 {
@@ -1004,42 +1041,42 @@ do_action: /* This label is used only to access EOF actions. */
1004case 1: 1041case 1:
1005/* rule 1 can match eol */ 1042/* rule 1 can match eol */
1006YY_RULE_SETUP 1043YY_RULE_SETUP
1007#line 69 "scripts/genksyms/lex.l" 1044#line 71 "scripts/genksyms/lex.l"
1008return FILENAME; 1045return FILENAME;
1009 YY_BREAK 1046 YY_BREAK
1010case 2: 1047case 2:
1011/* rule 2 can match eol */ 1048/* rule 2 can match eol */
1012YY_RULE_SETUP 1049YY_RULE_SETUP
1013#line 70 "scripts/genksyms/lex.l" 1050#line 72 "scripts/genksyms/lex.l"
1014cur_line++; 1051cur_line++;
1015 YY_BREAK 1052 YY_BREAK
1016case 3: 1053case 3:
1017/* rule 3 can match eol */ 1054/* rule 3 can match eol */
1018YY_RULE_SETUP 1055YY_RULE_SETUP
1019#line 71 "scripts/genksyms/lex.l" 1056#line 73 "scripts/genksyms/lex.l"
1020cur_line++; 1057cur_line++;
1021 YY_BREAK 1058 YY_BREAK
1022/* Ignore all other whitespace. */ 1059/* Ignore all other whitespace. */
1023case 4: 1060case 4:
1024YY_RULE_SETUP 1061YY_RULE_SETUP
1025#line 74 "scripts/genksyms/lex.l" 1062#line 76 "scripts/genksyms/lex.l"
1026; 1063;
1027 YY_BREAK 1064 YY_BREAK
1028case 5: 1065case 5:
1029/* rule 5 can match eol */ 1066/* rule 5 can match eol */
1030YY_RULE_SETUP 1067YY_RULE_SETUP
1031#line 77 "scripts/genksyms/lex.l" 1068#line 79 "scripts/genksyms/lex.l"
1032return STRING; 1069return STRING;
1033 YY_BREAK 1070 YY_BREAK
1034case 6: 1071case 6:
1035/* rule 6 can match eol */ 1072/* rule 6 can match eol */
1036YY_RULE_SETUP 1073YY_RULE_SETUP
1037#line 78 "scripts/genksyms/lex.l" 1074#line 80 "scripts/genksyms/lex.l"
1038return CHAR; 1075return CHAR;
1039 YY_BREAK 1076 YY_BREAK
1040case 7: 1077case 7:
1041YY_RULE_SETUP 1078YY_RULE_SETUP
1042#line 79 "scripts/genksyms/lex.l" 1079#line 81 "scripts/genksyms/lex.l"
1043return IDENT; 1080return IDENT;
1044 YY_BREAK 1081 YY_BREAK
1045/* The Pedant requires that the other C multi-character tokens be 1082/* The Pedant requires that the other C multi-character tokens be
@@ -1048,36 +1085,36 @@ return IDENT;
1048 around them properly. */ 1085 around them properly. */
1049case 8: 1086case 8:
1050YY_RULE_SETUP 1087YY_RULE_SETUP
1051#line 85 "scripts/genksyms/lex.l" 1088#line 87 "scripts/genksyms/lex.l"
1052return OTHER; 1089return OTHER;
1053 YY_BREAK 1090 YY_BREAK
1054case 9: 1091case 9:
1055YY_RULE_SETUP 1092YY_RULE_SETUP
1056#line 86 "scripts/genksyms/lex.l" 1093#line 88 "scripts/genksyms/lex.l"
1057return INT; 1094return INT;
1058 YY_BREAK 1095 YY_BREAK
1059case 10: 1096case 10:
1060YY_RULE_SETUP 1097YY_RULE_SETUP
1061#line 87 "scripts/genksyms/lex.l" 1098#line 89 "scripts/genksyms/lex.l"
1062return REAL; 1099return REAL;
1063 YY_BREAK 1100 YY_BREAK
1064case 11: 1101case 11:
1065YY_RULE_SETUP 1102YY_RULE_SETUP
1066#line 89 "scripts/genksyms/lex.l" 1103#line 91 "scripts/genksyms/lex.l"
1067return DOTS; 1104return DOTS;
1068 YY_BREAK 1105 YY_BREAK
1069/* All other tokens are single characters. */ 1106/* All other tokens are single characters. */
1070case 12: 1107case 12:
1071YY_RULE_SETUP 1108YY_RULE_SETUP
1072#line 92 "scripts/genksyms/lex.l" 1109#line 94 "scripts/genksyms/lex.l"
1073return yytext[0]; 1110return yytext[0];
1074 YY_BREAK 1111 YY_BREAK
1075case 13: 1112case 13:
1076YY_RULE_SETUP 1113YY_RULE_SETUP
1077#line 95 "scripts/genksyms/lex.l" 1114#line 97 "scripts/genksyms/lex.l"
1078ECHO; 1115ECHO;
1079 YY_BREAK 1116 YY_BREAK
1080#line 1081 "scripts/genksyms/lex.c" 1117#line 1118 "scripts/genksyms/lex.c"
1081case YY_STATE_EOF(INITIAL): 1118case YY_STATE_EOF(INITIAL):
1082case YY_STATE_EOF(V2_TOKENS): 1119case YY_STATE_EOF(V2_TOKENS):
1083 yyterminate(); 1120 yyterminate();
@@ -1346,6 +1383,14 @@ static int yy_get_next_buffer (void)
1346 else 1383 else
1347 ret_val = EOB_ACT_CONTINUE_SCAN; 1384 ret_val = EOB_ACT_CONTINUE_SCAN;
1348 1385
1386 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1387 /* Extend the array by 50%, plus the number we really need. */
1388 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1389 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1390 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1391 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1392 }
1393
1349 (yy_n_chars) += number_to_move; 1394 (yy_n_chars) += number_to_move;
1350 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1395 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1351 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1396 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1851,7 +1896,9 @@ static void yyensure_buffer_stack (void)
1851 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 1896 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1852 (num_to_alloc * sizeof(struct yy_buffer_state*) 1897 (num_to_alloc * sizeof(struct yy_buffer_state*)
1853 ); 1898 );
1854 1899 if ( ! (yy_buffer_stack) )
1900 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1901
1855 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1902 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1856 1903
1857 (yy_buffer_stack_max) = num_to_alloc; 1904 (yy_buffer_stack_max) = num_to_alloc;
@@ -1869,6 +1916,8 @@ static void yyensure_buffer_stack (void)
1869 ((yy_buffer_stack), 1916 ((yy_buffer_stack),
1870 num_to_alloc * sizeof(struct yy_buffer_state*) 1917 num_to_alloc * sizeof(struct yy_buffer_state*)
1871 ); 1918 );
1919 if ( ! (yy_buffer_stack) )
1920 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1872 1921
1873 /* zero only the new slots.*/ 1922 /* zero only the new slots.*/
1874 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1923 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -2092,7 +2141,7 @@ void yyset_debug (int bdebug )
2092/* %if-reentrant */ 2141/* %if-reentrant */
2093/* %if-bison-bridge */ 2142/* %if-bison-bridge */
2094/* %endif */ 2143/* %endif */
2095/* %endif */ 2144/* %endif if-c-only */
2096 2145
2097/* %if-c-only */ 2146/* %if-c-only */
2098static int yy_init_globals (void) 2147static int yy_init_globals (void)
@@ -2124,13 +2173,9 @@ static int yy_init_globals (void)
2124} 2173}
2125/* %endif */ 2174/* %endif */
2126 2175
2127/* %if-c-or-c++ */ 2176/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
2128/* %if-c-only */
2129/* yylex_destroy is for both reentrant and non-reentrant scanners. */ 2177/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2130int yylex_destroy (void) 2178int yylex_destroy (void)
2131/* %endif */
2132/* %if-c++-only */
2133/* %endif */
2134{ 2179{
2135 2180
2136 /* Pop the buffer stack, destroying each element. */ 2181 /* Pop the buffer stack, destroying each element. */
@@ -2144,11 +2189,6 @@ int yylex_destroy (void)
2144 yyfree((yy_buffer_stack) ); 2189 yyfree((yy_buffer_stack) );
2145 (yy_buffer_stack) = NULL; 2190 (yy_buffer_stack) = NULL;
2146 2191
2147/* %if-c++-only */
2148/* %endif */
2149
2150/* %if-c-only */
2151
2152 /* Reset the globals. This is important in a non-reentrant scanner so the next time 2192 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2153 * yylex() is called, initialization will occur. */ 2193 * yylex() is called, initialization will occur. */
2154 yy_init_globals( ); 2194 yy_init_globals( );
@@ -2156,7 +2196,6 @@ int yylex_destroy (void)
2156/* %if-reentrant */ 2196/* %if-reentrant */
2157/* %endif */ 2197/* %endif */
2158 return 0; 2198 return 0;
2159/* %endif */
2160} 2199}
2161/* %endif */ 2200/* %endif */
2162 2201
@@ -2213,7 +2252,7 @@ void yyfree (void * ptr )
2213 2252
2214/* %ok-for-header */ 2253/* %ok-for-header */
2215 2254
2216#line 95 "scripts/genksyms/lex.l" 2255#line 97 "scripts/genksyms/lex.l"
2217 2256
2218 2257
2219 2258
diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l
index 5e544a06678b..fe50ff9dacd0 100644
--- a/scripts/genksyms/lex.l
+++ b/scripts/genksyms/lex.l
@@ -62,6 +62,8 @@ MC_TOKEN ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>)
62/* We don't do multiple input files. */ 62/* We don't do multiple input files. */
63%option noyywrap 63%option noyywrap
64 64
65%option noinput
66
65%% 67%%
66 68
67 69
diff --git a/scripts/genksyms/parse.c_shipped b/scripts/genksyms/parse.c_shipped
index 3e6079f36b9f..eaee44e66a43 100644
--- a/scripts/genksyms/parse.c_shipped
+++ b/scripts/genksyms/parse.c_shipped
@@ -504,7 +504,7 @@ static const yytype_uint16 yyprhs[] =
504 239, 242, 245, 247, 248, 250, 252, 257, 262, 265, 504 239, 242, 245, 247, 248, 250, 252, 257, 262, 265,
505 269, 273, 277, 278, 280, 283, 287, 291, 292, 294, 505 269, 273, 277, 278, 280, 283, 287, 291, 292, 294,
506 296, 299, 303, 306, 307, 309, 311, 315, 318, 321, 506 296, 299, 303, 306, 307, 309, 311, 315, 318, 321,
507 323, 326, 327, 329, 332, 333, 335 507 323, 326, 327, 330, 333, 334, 336
508}; 508};
509 509
510/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 510/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -542,9 +542,9 @@ static const yytype_int8 yyrhs[] =
542 -1, -1, 89, -1, 90, -1, 89, 90, -1, 64, 542 -1, -1, 89, -1, 90, -1, 89, 90, -1, 64,
543 91, 44, -1, 1, 44, -1, -1, 92, -1, 93, 543 91, 44, -1, 1, 44, -1, -1, 92, -1, 93,
544 -1, 92, 46, 93, -1, 76, 95, -1, 37, 94, 544 -1, 92, 46, 93, -1, 76, 95, -1, 37, 94,
545 -1, 94, -1, 52, 34, -1, -1, 31, -1, 30, 545 -1, 94, -1, 52, 34, -1, -1, 95, 31, -1,
546 44, -1, -1, 30, -1, 29, 47, 37, 49, 44, 546 30, 44, -1, -1, 30, -1, 29, 47, 37, 49,
547 -1 547 44, -1
548}; 548};
549 549
550/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 550/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -647,7 +647,7 @@ static const yytype_uint8 yyr2[] =
647 2, 2, 1, 0, 1, 1, 4, 4, 2, 3, 647 2, 2, 1, 0, 1, 1, 4, 4, 2, 3,
648 3, 3, 0, 1, 2, 3, 3, 0, 1, 1, 648 3, 3, 0, 1, 2, 3, 3, 0, 1, 1,
649 2, 3, 2, 0, 1, 1, 3, 2, 2, 1, 649 2, 3, 2, 0, 1, 1, 3, 2, 2, 1,
650 2, 0, 1, 2, 0, 1, 5 650 2, 0, 2, 2, 0, 1, 5
651}; 651};
652 652
653/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 653/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -667,9 +667,9 @@ static const yytype_uint8 yydefact[] =
667 0, 66, 125, 101, 121, 71, 0, 7, 112, 106, 667 0, 66, 125, 101, 121, 71, 0, 7, 112, 106,
668 76, 77, 0, 0, 0, 121, 75, 0, 114, 115, 668 76, 77, 0, 0, 0, 121, 75, 0, 114, 115,
669 119, 105, 0, 110, 124, 0, 36, 0, 73, 72, 669 119, 105, 0, 110, 124, 0, 36, 0, 73, 72,
670 61, 20, 122, 102, 0, 93, 0, 84, 87, 88, 670 61, 20, 102, 0, 93, 0, 84, 87, 88, 118,
671 118, 0, 76, 0, 120, 74, 117, 80, 0, 111, 671 0, 76, 0, 120, 74, 117, 80, 0, 111, 0,
672 0, 35, 126, 0, 21, 103, 70, 94, 56, 0, 672 35, 126, 122, 0, 21, 103, 70, 94, 56, 0,
673 93, 90, 92, 69, 83, 0, 82, 81, 0, 0, 673 93, 90, 92, 69, 83, 0, 82, 81, 0, 0,
674 116, 104, 0, 95, 0, 91, 98, 0, 85, 89, 674 116, 104, 0, 95, 0, 91, 98, 0, 85, 89,
675 79, 78, 100, 99, 0, 0, 97, 96 675 79, 78, 100, 99, 0, 0, 97, 96
@@ -680,44 +680,44 @@ static const yytype_int16 yydefgoto[] =
680{ 680{
681 -1, 1, 2, 3, 35, 72, 55, 36, 64, 65, 681 -1, 1, 2, 3, 35, 72, 55, 36, 64, 65,
682 66, 75, 38, 39, 40, 41, 42, 67, 86, 87, 682 66, 75, 38, 39, 40, 41, 42, 67, 86, 87,
683 43, 114, 69, 105, 106, 126, 127, 128, 129, 151, 683 43, 114, 69, 105, 106, 125, 126, 127, 128, 151,
684 152, 44, 144, 145, 54, 76, 77, 78, 107, 108, 684 152, 44, 144, 145, 54, 76, 77, 78, 107, 108,
685 109, 110, 123, 45, 94, 46 685 109, 110, 122, 45, 94, 46
686}; 686};
687 687
688/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 688/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
689 STATE-NUM. */ 689 STATE-NUM. */
690#define YYPACT_NINF -135 690#define YYPACT_NINF -134
691static const yytype_int16 yypact[] = 691static const yytype_int16 yypact[] =
692{ 692{
693 -135, 11, -135, 312, -135, -135, 24, -135, -135, -135, 693 -134, 16, -134, 312, -134, -134, 20, -134, -134, -134,
694 -135, -135, -23, -135, -2, -135, -135, -135, -135, -135, 694 -134, -134, -18, -134, -3, -134, -134, -134, -134, -134,
695 -135, -135, -135, -135, -17, -135, -11, -135, -135, -135, 695 -134, -134, -134, -134, -26, -134, -25, -134, -134, -134,
696 -3, 16, 26, -135, -135, -135, -135, 34, 482, -135, 696 -7, 5, 27, -134, -134, -134, -134, 46, 482, -134,
697 -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, 697 -134, -134, -134, -134, -134, -134, -134, -134, -134, -134,
698 -8, -135, 22, 97, -135, 482, 22, -135, 482, 56, 698 -8, -134, 30, 97, -134, 482, 30, -134, 482, 7,
699 -135, -135, 12, 10, 50, 49, -135, 34, -13, 15, 699 -134, -134, 12, 10, 42, 55, -134, 46, -15, 15,
700 -135, -135, 482, -135, 47, -25, 51, 145, -135, -135, 700 -134, -134, 482, -134, 25, 26, 47, 145, -134, -134,
701 34, -135, 356, 52, 71, 77, -135, 10, -135, -135, 701 46, -134, 356, 39, 71, 77, -134, 10, -134, -134,
702 34, -135, -135, -135, 68, -135, 193, -135, -135, -135, 702 46, -134, -134, -134, -134, -134, 193, -134, -134, -134,
703 48, -135, 6, 93, 37, 68, 18, 85, 84, -135, 703 75, -134, 6, 95, 43, -134, 28, 86, 85, -134,
704 -135, -135, 87, -135, 102, 86, -135, 89, -135, -135, 704 -134, -134, 88, -134, 103, 87, -134, 91, -134, -134,
705 -135, -135, -135, 90, 88, 401, 94, 100, 101, -135, 705 -134, -134, -23, 90, 401, 94, 101, 102, -134, -134,
706 -135, 99, -135, 108, -135, -135, -135, -135, 230, -135, 706 98, -134, 108, -134, -134, 109, -134, 230, -134, 26,
707 -25, -135, -135, 105, -135, -135, -135, -135, -135, 9, 707 -134, -134, -134, 134, -134, -134, -134, -134, -134, 9,
708 42, -135, 28, -135, -135, 445, -135, -135, 119, 125, 708 48, -134, 35, -134, -134, 445, -134, -134, 125, 126,
709 -135, -135, 126, -135, 128, -135, -135, 267, -135, -135, 709 -134, -134, 128, -134, 129, -134, -134, 267, -134, -134,
710 -135, -135, -135, -135, 129, 130, -135, -135 710 -134, -134, -134, -134, 130, 131, -134, -134
711}; 711};
712 712
713/* YYPGOTO[NTERM-NUM]. */ 713/* YYPGOTO[NTERM-NUM]. */
714static const yytype_int16 yypgoto[] = 714static const yytype_int16 yypgoto[] =
715{ 715{
716 -135, -135, 179, -135, -135, -135, -135, -47, -135, -135, 716 -134, -134, 180, -134, -134, -134, -134, -33, -134, -134,
717 91, 0, -58, -37, -135, -135, -135, -73, -135, -135, 717 93, 0, -58, -37, -134, -134, -134, -73, -134, -134,
718 -48, -32, -135, -38, -135, -134, -135, -135, 29, -63, 718 -54, -32, -134, -81, -134, -133, -134, -134, 29, -50,
719 -135, -135, -135, -135, -20, -135, -135, 106, -135, -135, 719 -134, -134, -134, -134, -20, -134, -134, 110, -134, -134,
720 45, 95, 82, -135, -135, -135 720 49, 96, 80, -134, -134, -134
721}; 721};
722 722
723/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 723/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -727,26 +727,26 @@ static const yytype_int16 yypgoto[] =
727#define YYTABLE_NINF -109 727#define YYTABLE_NINF -109
728static const yytype_int16 yytable[] = 728static const yytype_int16 yytable[] =
729{ 729{
730 82, 70, 104, 37, 159, 68, 57, 131, 79, 49, 730 82, 70, 104, 37, 159, 68, 57, 130, 142, 88,
731 162, 4, 100, 84, 50, 88, 101, 92, 10, 93, 731 162, 52, 56, 84, 49, 92, 4, 93, 10, 50,
732 52, 51, 102, 63, 71, 97, 56, 103, 20, 104, 732 51, 132, 79, 134, 71, 53, 53, 143, 20, 104,
733 85, 104, 73, 175, 53, 91, 81, 29, 125, 120, 733 85, 104, 73, 120, 175, 91, 81, 29, 124, 97,
734 53, 33, -93, 132, 58, 70, 147, 101, 95, 61, 734 58, 33, -93, 131, 83, 70, 147, 101, 95, 61,
735 163, 137, 150, 102, 63, 80, 149, 63, -93, 62, 735 163, 150, 59, 102, 63, 80, 149, 63, -93, 62,
736 63, 166, 96, 59, 133, 138, 135, 104, 47, 48, 736 63, 136, 96, 100, 47, 48, 104, 101, 166, 98,
737 60, 61, 80, 53, 132, 167, 150, 150, 101, 147, 737 99, 60, 80, 102, 63, 137, 150, 150, 103, 124,
738 125, 62, 63, 163, 102, 63, 164, 165, 70, 149, 738 131, 53, 167, 61, 101, 147, 89, 70, 117, 163,
739 63, 98, 99, 83, 89, 90, 111, 125, 74, 122, 739 102, 63, 111, 62, 63, 149, 63, 124, 74, 164,
740 103, 117, 7, 8, 9, 10, 11, 12, 13, 125, 740 165, 90, 7, 8, 9, 10, 11, 12, 13, 124,
741 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 741 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
742 118, 26, 27, 28, 29, 30, 119, 134, 33, 139, 742 118, 26, 27, 28, 29, 30, 119, 103, 33, 133,
743 140, 98, 92, 142, -22, 141, 154, 146, 34, 161, 743 138, 139, 98, 92, -22, 141, 140, 154, 34, 146,
744 143, -22, -107, 153, -22, -22, 112, 155, 156, -22, 744 142, -22, -107, 153, -22, -22, 112, 156, 155, -22,
745 7, 8, 9, 10, 11, 12, 13, 157, 15, 16, 745 7, 8, 9, 10, 11, 12, 13, 157, 15, 16,
746 17, 18, 19, 20, 21, 22, 23, 24, 170, 26, 746 17, 18, 19, 20, 21, 22, 23, 24, 161, 26,
747 27, 28, 29, 30, 171, 172, 33, 173, 176, 177, 747 27, 28, 29, 30, 170, 171, 33, 172, 173, 176,
748 5, 121, -22, 113, 169, 160, 34, 136, 0, -22, 748 177, 5, -22, 121, 169, 135, 34, 113, 160, -22,
749 -108, 0, -22, -22, 124, 130, 0, -22, 7, 8, 749 -108, 0, -22, -22, 123, 0, 129, -22, 7, 8,
750 9, 10, 11, 12, 13, 0, 15, 16, 17, 18, 750 9, 10, 11, 12, 13, 0, 15, 16, 17, 18,
751 19, 20, 21, 22, 23, 24, 0, 26, 27, 28, 751 19, 20, 21, 22, 23, 24, 0, 26, 27, 28,
752 29, 30, 0, 0, 33, 0, 0, 0, 0, -86, 752 29, 30, 0, 0, 33, 0, 0, 0, 0, -86,
@@ -784,26 +784,26 @@ static const yytype_int16 yytable[] =
784 784
785static const yytype_int16 yycheck[] = 785static const yytype_int16 yycheck[] =
786{ 786{
787 58, 38, 75, 3, 138, 37, 26, 1, 55, 32, 787 58, 38, 75, 3, 137, 37, 26, 1, 31, 63,
788 1, 0, 37, 1, 37, 63, 41, 30, 8, 32, 788 1, 37, 37, 1, 32, 30, 0, 32, 8, 37,
789 37, 23, 47, 48, 32, 72, 37, 52, 18, 102, 789 23, 102, 55, 104, 32, 51, 51, 50, 18, 102,
790 62, 104, 52, 167, 51, 67, 56, 27, 96, 87, 790 62, 104, 52, 87, 167, 67, 56, 27, 96, 72,
791 51, 31, 33, 37, 47, 82, 37, 41, 33, 37, 791 47, 31, 33, 37, 37, 82, 37, 41, 33, 37,
792 41, 33, 125, 47, 48, 55, 47, 48, 49, 47, 792 41, 124, 47, 47, 48, 55, 47, 48, 49, 47,
793 48, 33, 47, 47, 102, 47, 104, 140, 44, 45, 793 48, 33, 47, 37, 44, 45, 139, 41, 33, 44,
794 44, 37, 72, 51, 37, 47, 149, 150, 41, 37, 794 45, 44, 72, 47, 48, 47, 149, 150, 52, 137,
795 138, 47, 48, 41, 47, 48, 149, 150, 125, 47, 795 37, 51, 47, 37, 41, 37, 44, 124, 49, 41,
796 48, 44, 45, 37, 44, 46, 45, 155, 1, 31, 796 47, 48, 45, 47, 48, 47, 48, 155, 1, 149,
797 52, 49, 5, 6, 7, 8, 9, 10, 11, 167, 797 150, 46, 5, 6, 7, 8, 9, 10, 11, 167,
798 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 798 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
799 49, 24, 25, 26, 27, 28, 49, 34, 31, 44, 799 49, 24, 25, 26, 27, 28, 49, 52, 31, 34,
800 46, 44, 30, 44, 37, 49, 36, 49, 41, 34, 800 44, 46, 44, 30, 37, 44, 49, 36, 41, 49,
801 50, 44, 45, 49, 47, 48, 1, 46, 49, 52, 801 31, 44, 45, 49, 47, 48, 1, 49, 46, 52,
802 5, 6, 7, 8, 9, 10, 11, 49, 13, 14, 802 5, 6, 7, 8, 9, 10, 11, 49, 13, 14,
803 15, 16, 17, 18, 19, 20, 21, 22, 49, 24, 803 15, 16, 17, 18, 19, 20, 21, 22, 34, 24,
804 25, 26, 27, 28, 49, 49, 31, 49, 49, 49, 804 25, 26, 27, 28, 49, 49, 31, 49, 49, 49,
805 1, 90, 37, 77, 155, 140, 41, 105, -1, 44, 805 49, 1, 37, 90, 155, 105, 41, 77, 139, 44,
806 45, -1, 47, 48, 1, 100, -1, 52, 5, 6, 806 45, -1, 47, 48, 1, -1, 100, 52, 5, 6,
807 7, 8, 9, 10, 11, -1, 13, 14, 15, 16, 807 7, 8, 9, 10, 11, -1, 13, 14, 15, 16,
808 17, 18, 19, 20, 21, 22, -1, 24, 25, 26, 808 17, 18, 19, 20, 21, 22, -1, 24, 25, 26,
809 27, 28, -1, -1, 31, -1, -1, -1, -1, 36, 809 27, 28, -1, -1, 31, -1, -1, -1, -1, 36,
@@ -855,9 +855,9 @@ static const yytype_uint8 yystos[] =
855 46, 74, 30, 32, 97, 33, 47, 60, 44, 45, 855 46, 74, 30, 32, 97, 33, 47, 60, 44, 45,
856 37, 41, 47, 52, 70, 76, 77, 91, 92, 93, 856 37, 41, 47, 52, 70, 76, 77, 91, 92, 93,
857 94, 45, 1, 90, 74, 48, 49, 49, 49, 49, 857 94, 45, 1, 90, 74, 48, 49, 49, 49, 49,
858 73, 63, 31, 95, 1, 65, 78, 79, 80, 81, 858 73, 63, 95, 1, 65, 78, 79, 80, 81, 94,
859 94, 1, 37, 76, 34, 76, 95, 33, 47, 44, 859 1, 37, 76, 34, 76, 95, 33, 47, 44, 46,
860 46, 49, 44, 50, 85, 86, 49, 37, 41, 47, 860 49, 44, 31, 50, 85, 86, 49, 37, 41, 47,
861 70, 82, 83, 49, 36, 46, 49, 49, 1, 78, 861 70, 82, 83, 49, 36, 46, 49, 49, 1, 78,
862 93, 34, 1, 41, 82, 82, 33, 47, 36, 81, 862 93, 34, 1, 41, 82, 82, 33, 47, 36, 81,
863 49, 49, 49, 49, 1, 78, 49, 49 863 49, 49, 49, 49, 1, 78, 49, 49
diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y
index 408cdf82b271..10d7dc724b6d 100644
--- a/scripts/genksyms/parse.y
+++ b/scripts/genksyms/parse.y
@@ -446,7 +446,7 @@ member_bitfield_declarator:
446 446
447attribute_opt: 447attribute_opt:
448 /* empty */ { $$ = NULL; } 448 /* empty */ { $$ = NULL; }
449 | ATTRIBUTE_PHRASE 449 | attribute_opt ATTRIBUTE_PHRASE
450 ; 450 ;
451 451
452asm_definition: 452asm_definition:
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index 6a61cee4a32c..7342ce0a7780 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -5,10 +5,29 @@
5 5
6/* A lexical scanner generated by flex */ 6/* A lexical scanner generated by flex */
7 7
8#define yy_create_buffer zconf_create_buffer
9#define yy_delete_buffer zconf_delete_buffer
10#define yy_flex_debug zconf_flex_debug
11#define yy_init_buffer zconf_init_buffer
12#define yy_flush_buffer zconf_flush_buffer
13#define yy_load_buffer_state zconf_load_buffer_state
14#define yy_switch_to_buffer zconf_switch_to_buffer
15#define yyin zconfin
16#define yyleng zconfleng
17#define yylex zconflex
18#define yylineno zconflineno
19#define yyout zconfout
20#define yyrestart zconfrestart
21#define yytext zconftext
22#define yywrap zconfwrap
23#define yyalloc zconfalloc
24#define yyrealloc zconfrealloc
25#define yyfree zconffree
26
8#define FLEX_SCANNER 27#define FLEX_SCANNER
9#define YY_FLEX_MAJOR_VERSION 2 28#define YY_FLEX_MAJOR_VERSION 2
10#define YY_FLEX_MINOR_VERSION 5 29#define YY_FLEX_MINOR_VERSION 5
11#define YY_FLEX_SUBMINOR_VERSION 33 30#define YY_FLEX_SUBMINOR_VERSION 35
12#if YY_FLEX_SUBMINOR_VERSION > 0 31#if YY_FLEX_SUBMINOR_VERSION > 0
13#define FLEX_BETA 32#define FLEX_BETA
14#endif 33#endif
@@ -30,7 +49,7 @@
30 49
31/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 50/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
32 51
33#if __STDC_VERSION__ >= 199901L 52#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
34 53
35/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 54/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36 * if you want the limit (max/min) macros for int types. 55 * if you want the limit (max/min) macros for int types.
@@ -53,7 +72,6 @@ typedef int flex_int32_t;
53typedef unsigned char flex_uint8_t; 72typedef unsigned char flex_uint8_t;
54typedef unsigned short int flex_uint16_t; 73typedef unsigned short int flex_uint16_t;
55typedef unsigned int flex_uint32_t; 74typedef unsigned int flex_uint32_t;
56#endif /* ! C99 */
57 75
58/* Limits of integral types. */ 76/* Limits of integral types. */
59#ifndef INT8_MIN 77#ifndef INT8_MIN
@@ -84,6 +102,8 @@ typedef unsigned int flex_uint32_t;
84#define UINT32_MAX (4294967295U) 102#define UINT32_MAX (4294967295U)
85#endif 103#endif
86 104
105#endif /* ! C99 */
106
87#endif /* ! FLEXINT_H */ 107#endif /* ! FLEXINT_H */
88 108
89#ifdef __cplusplus 109#ifdef __cplusplus
@@ -93,11 +113,12 @@ typedef unsigned int flex_uint32_t;
93 113
94#else /* ! __cplusplus */ 114#else /* ! __cplusplus */
95 115
96#if __STDC__ 116/* C99 requires __STDC__ to be defined as 1. */
117#if defined (__STDC__)
97 118
98#define YY_USE_CONST 119#define YY_USE_CONST
99 120
100#endif /* __STDC__ */ 121#endif /* defined (__STDC__) */
101#endif /* ! __cplusplus */ 122#endif /* ! __cplusplus */
102 123
103#ifdef YY_USE_CONST 124#ifdef YY_USE_CONST
@@ -177,14 +198,9 @@ extern FILE *zconfin, *zconfout;
177 198
178#define unput(c) yyunput( c, (yytext_ptr) ) 199#define unput(c) yyunput( c, (yytext_ptr) )
179 200
180/* The following is because we cannot portably get our hands on size_t
181 * (without autoconf's help, which isn't available because we want
182 * flex-generated scanners to compile on their own).
183 */
184
185#ifndef YY_TYPEDEF_YY_SIZE_T 201#ifndef YY_TYPEDEF_YY_SIZE_T
186#define YY_TYPEDEF_YY_SIZE_T 202#define YY_TYPEDEF_YY_SIZE_T
187typedef unsigned int yy_size_t; 203typedef size_t yy_size_t;
188#endif 204#endif
189 205
190#ifndef YY_STRUCT_YY_BUFFER_STATE 206#ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -335,7 +351,7 @@ void zconffree (void * );
335 351
336/* Begin user sect3 */ 352/* Begin user sect3 */
337 353
338#define zconfwrap() 1 354#define zconfwrap(n) 1
339#define YY_SKIP_YYWRAP 355#define YY_SKIP_YYWRAP
340 356
341typedef unsigned char YY_CHAR; 357typedef unsigned char YY_CHAR;
@@ -748,6 +764,7 @@ int zconf_flex_debug = 0;
748#define YY_MORE_ADJ 0 764#define YY_MORE_ADJ 0
749#define YY_RESTORE_YY_MORE_OFFSET 765#define YY_RESTORE_YY_MORE_OFFSET
750char *zconftext; 766char *zconftext;
767#define YY_NO_INPUT 1
751 768
752/* 769/*
753 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 770 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
@@ -834,6 +851,35 @@ void alloc_string(const char *str, int size)
834 851
835static int yy_init_globals (void ); 852static int yy_init_globals (void );
836 853
854/* Accessor methods to globals.
855 These are made visible to non-reentrant scanners for convenience. */
856
857int zconflex_destroy (void );
858
859int zconfget_debug (void );
860
861void zconfset_debug (int debug_flag );
862
863YY_EXTRA_TYPE zconfget_extra (void );
864
865void zconfset_extra (YY_EXTRA_TYPE user_defined );
866
867FILE *zconfget_in (void );
868
869void zconfset_in (FILE * in_str );
870
871FILE *zconfget_out (void );
872
873void zconfset_out (FILE * out_str );
874
875int zconfget_leng (void );
876
877char *zconfget_text (void );
878
879int zconfget_lineno (void );
880
881void zconfset_lineno (int line_number );
882
837/* Macros after this point can all be overridden by user definitions in 883/* Macros after this point can all be overridden by user definitions in
838 * section 1. 884 * section 1.
839 */ 885 */
@@ -876,7 +922,7 @@ static int input (void );
876/* This used to be an fputs(), but since the string might contain NUL's, 922/* This used to be an fputs(), but since the string might contain NUL's,
877 * we now use fwrite(). 923 * we now use fwrite().
878 */ 924 */
879#define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout ) 925#define ECHO fwrite( zconftext, zconfleng, 1, zconfout )
880#endif 926#endif
881 927
882/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 928/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -1540,6 +1586,14 @@ static int yy_get_next_buffer (void)
1540 else 1586 else
1541 ret_val = EOB_ACT_CONTINUE_SCAN; 1587 ret_val = EOB_ACT_CONTINUE_SCAN;
1542 1588
1589 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1590 /* Extend the array by 50%, plus the number we really need. */
1591 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1592 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) zconfrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1593 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1594 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1595 }
1596
1543 (yy_n_chars) += number_to_move; 1597 (yy_n_chars) += number_to_move;
1544 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1598 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1545 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1599 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1926,7 +1980,9 @@ static void zconfensure_buffer_stack (void)
1926 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc 1980 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
1927 (num_to_alloc * sizeof(struct yy_buffer_state*) 1981 (num_to_alloc * sizeof(struct yy_buffer_state*)
1928 ); 1982 );
1929 1983 if ( ! (yy_buffer_stack) )
1984 YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
1985
1930 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1986 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1931 1987
1932 (yy_buffer_stack_max) = num_to_alloc; 1988 (yy_buffer_stack_max) = num_to_alloc;
@@ -1944,6 +2000,8 @@ static void zconfensure_buffer_stack (void)
1944 ((yy_buffer_stack), 2000 ((yy_buffer_stack),
1945 num_to_alloc * sizeof(struct yy_buffer_state*) 2001 num_to_alloc * sizeof(struct yy_buffer_state*)
1946 ); 2002 );
2003 if ( ! (yy_buffer_stack) )
2004 YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
1947 2005
1948 /* zero only the new slots.*/ 2006 /* zero only the new slots.*/
1949 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 2007 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 4cea5c85cd0a..5164ef7ce499 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -1,5 +1,6 @@
1%option backup nostdinit noyywrap never-interactive full ecs 1%option backup nostdinit noyywrap never-interactive full ecs
2%option 8bit backup nodefault perf-report perf-report 2%option 8bit backup nodefault perf-report perf-report
3%option noinput
3%x COMMAND HELP STRING PARAM 4%x COMMAND HELP STRING PARAM
4%{ 5%{
5/* 6/*
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 8f038e6d5f98..418cd7dbbc93 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1468,7 +1468,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
1468 * marked __initdata will be discarded when the module has been intialized. 1468 * marked __initdata will be discarded when the module has been intialized.
1469 * Likewise for modules used built-in the sections marked __exit 1469 * Likewise for modules used built-in the sections marked __exit
1470 * are discarded because __exit marked function are supposed to be called 1470 * are discarded because __exit marked function are supposed to be called
1471 * only when a moduel is unloaded which never happes for built-in modules. 1471 * only when a module is unloaded which never happens for built-in modules.
1472 * The check_sec_ref() function traverses all relocation records 1472 * The check_sec_ref() function traverses all relocation records
1473 * to find all references to a section that reference a section that will 1473 * to find all references to a section that reference a section that will
1474 * be discarded and warns about it. 1474 * be discarded and warns about it.
diff --git a/scripts/ver_linux b/scripts/ver_linux
index 7ac0e309be09..dbb3037f1346 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -4,7 +4,6 @@
4# /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may 4# /bin /sbin /usr/bin /usr/sbin /usr/local/bin, but it may
5# differ on your system. 5# differ on your system.
6# 6#
7PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:$PATH
8echo 'If some fields are empty or look unusual you may have an old version.' 7echo 'If some fields are empty or look unusual you may have an old version.'
9echo 'Compare to the current minimal requirements in Documentation/Changes.' 8echo 'Compare to the current minimal requirements in Documentation/Changes.'
10echo ' ' 9echo ' '
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 40d06c533f89..3ae9bec5a508 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -998,8 +998,12 @@ static int selinux_sb_show_options(struct seq_file *m, struct super_block *sb)
998 int rc; 998 int rc;
999 999
1000 rc = selinux_get_mnt_opts(sb, &opts); 1000 rc = selinux_get_mnt_opts(sb, &opts);
1001 if (rc) 1001 if (rc) {
1002 /* before policy load we may get EINVAL, don't show anything */
1003 if (rc == -EINVAL)
1004 rc = 0;
1002 return rc; 1005 return rc;
1006 }
1003 1007
1004 selinux_write_opts(m, &opts); 1008 selinux_write_opts(m, &opts);
1005 1009
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c
index 87e3aefeddc3..83e90057270e 100644
--- a/sound/i2c/other/tea575x-tuner.c
+++ b/sound/i2c/other/tea575x-tuner.c
@@ -189,9 +189,7 @@ void snd_tea575x_init(struct snd_tea575x *tea)
189 } 189 }
190 190
191 memset(&tea->vd, 0, sizeof(tea->vd)); 191 memset(&tea->vd, 0, sizeof(tea->vd));
192 tea->vd.owner = tea->card->module;
193 strcpy(tea->vd.name, tea->tea5759 ? "TEA5759 radio" : "TEA5757 radio"); 192 strcpy(tea->vd.name, tea->tea5759 ? "TEA5759 radio" : "TEA5757 radio");
194 tea->vd.type = VID_TYPE_TUNER;
195 tea->vd.release = snd_tea575x_release; 193 tea->vd.release = snd_tea575x_release;
196 video_set_drvdata(&tea->vd, tea); 194 video_set_drvdata(&tea->vd, tea);
197 tea->vd.fops = &tea->fops; 195 tea->vd.fops = &tea->fops;
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index 9ca113326143..54df8baf916f 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -42,7 +42,7 @@
42#include <sound/info.h> 42#include <sound/info.h>
43#include <asm/io.h> 43#include <asm/io.h>
44#include <asm/dma.h> 44#include <asm/dma.h>
45#include <asm/dreamcast/sysasic.h> 45#include <mach/sysasic.h>
46#include "aica.h" 46#include "aica.h"
47 47
48MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk>"); 48MODULE_AUTHOR("Adrian McMenamin <adrian@mcmen.demon.co.uk>");
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index da2bc5902864..7ceea2bba1f5 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -132,12 +132,17 @@ struct fsl_dma_private {
132 * Since each link descriptor has a 32-bit byte count field, we set 132 * Since each link descriptor has a 32-bit byte count field, we set
133 * period_bytes_max to the largest 32-bit number. We also have no maximum 133 * period_bytes_max to the largest 32-bit number. We also have no maximum
134 * number of periods. 134 * number of periods.
135 *
136 * Note that we specify SNDRV_PCM_INFO_JOINT_DUPLEX here, but only because a
137 * limitation in the SSI driver requires the sample rates for playback and
138 * capture to be the same.
135 */ 139 */
136static const struct snd_pcm_hardware fsl_dma_hardware = { 140static const struct snd_pcm_hardware fsl_dma_hardware = {
137 141
138 .info = SNDRV_PCM_INFO_INTERLEAVED | 142 .info = SNDRV_PCM_INFO_INTERLEAVED |
139 SNDRV_PCM_INFO_MMAP | 143 SNDRV_PCM_INFO_MMAP |
140 SNDRV_PCM_INFO_MMAP_VALID, 144 SNDRV_PCM_INFO_MMAP_VALID |
145 SNDRV_PCM_INFO_JOINT_DUPLEX,
141 .formats = FSLDMA_PCM_FORMATS, 146 .formats = FSLDMA_PCM_FORMATS,
142 .rates = FSLDMA_PCM_RATES, 147 .rates = FSLDMA_PCM_RATES,
143 .rate_min = 5512, 148 .rate_min = 5512,
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 71bff33f5528..157a7895ffa1 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -67,6 +67,8 @@
67 * @ssi: pointer to the SSI's registers 67 * @ssi: pointer to the SSI's registers
68 * @ssi_phys: physical address of the SSI registers 68 * @ssi_phys: physical address of the SSI registers
69 * @irq: IRQ of this SSI 69 * @irq: IRQ of this SSI
70 * @first_stream: pointer to the stream that was opened first
71 * @second_stream: pointer to second stream
70 * @dev: struct device pointer 72 * @dev: struct device pointer
71 * @playback: the number of playback streams opened 73 * @playback: the number of playback streams opened
72 * @capture: the number of capture streams opened 74 * @capture: the number of capture streams opened
@@ -79,6 +81,8 @@ struct fsl_ssi_private {
79 struct ccsr_ssi __iomem *ssi; 81 struct ccsr_ssi __iomem *ssi;
80 dma_addr_t ssi_phys; 82 dma_addr_t ssi_phys;
81 unsigned int irq; 83 unsigned int irq;
84 struct snd_pcm_substream *first_stream;
85 struct snd_pcm_substream *second_stream;
82 struct device *dev; 86 struct device *dev;
83 unsigned int playback; 87 unsigned int playback;
84 unsigned int capture; 88 unsigned int capture;
@@ -342,6 +346,49 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream)
342 */ 346 */
343 } 347 }
344 348
349 if (!ssi_private->first_stream)
350 ssi_private->first_stream = substream;
351 else {
352 /* This is the second stream open, so we need to impose sample
353 * rate and maybe sample size constraints. Note that this can
354 * cause a race condition if the second stream is opened before
355 * the first stream is fully initialized.
356 *
357 * We provide some protection by checking to make sure the first
358 * stream is initialized, but it's not perfect. ALSA sometimes
359 * re-initializes the driver with a different sample rate or
360 * size. If the second stream is opened before the first stream
361 * has received its final parameters, then the second stream may
362 * be constrained to the wrong sample rate or size.
363 *
364 * FIXME: This code does not handle opening and closing streams
365 * repeatedly. If you open two streams and then close the first
366 * one, you may not be able to open another stream until you
367 * close the second one as well.
368 */
369 struct snd_pcm_runtime *first_runtime =
370 ssi_private->first_stream->runtime;
371
372 if (!first_runtime->rate || !first_runtime->sample_bits) {
373 dev_err(substream->pcm->card->dev,
374 "set sample rate and size in %s stream first\n",
375 substream->stream == SNDRV_PCM_STREAM_PLAYBACK
376 ? "capture" : "playback");
377 return -EAGAIN;
378 }
379
380 snd_pcm_hw_constraint_minmax(substream->runtime,
381 SNDRV_PCM_HW_PARAM_RATE,
382 first_runtime->rate, first_runtime->rate);
383
384 snd_pcm_hw_constraint_minmax(substream->runtime,
385 SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
386 first_runtime->sample_bits,
387 first_runtime->sample_bits);
388
389 ssi_private->second_stream = substream;
390 }
391
345 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 392 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
346 ssi_private->playback++; 393 ssi_private->playback++;
347 394
@@ -371,18 +418,16 @@ static int fsl_ssi_prepare(struct snd_pcm_substream *substream)
371 struct fsl_ssi_private *ssi_private = rtd->dai->cpu_dai->private_data; 418 struct fsl_ssi_private *ssi_private = rtd->dai->cpu_dai->private_data;
372 419
373 struct ccsr_ssi __iomem *ssi = ssi_private->ssi; 420 struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
374 u32 wl;
375 421
376 wl = CCSR_SSI_SxCCR_WL(snd_pcm_format_width(runtime->format)); 422 if (substream == ssi_private->first_stream) {
423 u32 wl;
377 424
378 clrbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN); 425 /* The SSI should always be disabled at this points (SSIEN=0) */
426 wl = CCSR_SSI_SxCCR_WL(snd_pcm_format_width(runtime->format));
379 427
380 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 428 /* In synchronous mode, the SSI uses STCCR for capture */
381 clrsetbits_be32(&ssi->stccr, CCSR_SSI_SxCCR_WL_MASK, wl); 429 clrsetbits_be32(&ssi->stccr, CCSR_SSI_SxCCR_WL_MASK, wl);
382 else 430 }
383 clrsetbits_be32(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl);
384
385 setbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
386 431
387 return 0; 432 return 0;
388} 433}
@@ -407,9 +452,13 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd)
407 case SNDRV_PCM_TRIGGER_RESUME: 452 case SNDRV_PCM_TRIGGER_RESUME:
408 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 453 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
409 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 454 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
410 setbits32(&ssi->scr, CCSR_SSI_SCR_TE); 455 clrbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
456 setbits32(&ssi->scr,
457 CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_TE);
411 } else { 458 } else {
412 setbits32(&ssi->scr, CCSR_SSI_SCR_RE); 459 clrbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
460 setbits32(&ssi->scr,
461 CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_RE);
413 462
414 /* 463 /*
415 * I think we need this delay to allow time for the SSI 464 * I think we need this delay to allow time for the SSI
@@ -452,6 +501,11 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream)
452 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) 501 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
453 ssi_private->capture--; 502 ssi_private->capture--;
454 503
504 if (ssi_private->first_stream == substream)
505 ssi_private->first_stream = ssi_private->second_stream;
506
507 ssi_private->second_stream = NULL;
508
455 /* 509 /*
456 * If this is the last active substream, disable the SSI and release 510 * If this is the last active substream, disable the SSI and release
457 * the IRQ. 511 * the IRQ.
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index 65a4e9a8c39e..d968cf71b569 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -85,17 +85,13 @@ static int poodle_startup(struct snd_pcm_substream *substream)
85} 85}
86 86
87/* we need to unmute the HP at shutdown as the mute burns power on poodle */ 87/* we need to unmute the HP at shutdown as the mute burns power on poodle */
88static int poodle_shutdown(struct snd_pcm_substream *substream) 88static void poodle_shutdown(struct snd_pcm_substream *substream)
89{ 89{
90 struct snd_soc_pcm_runtime *rtd = substream->private_data;
91 struct snd_soc_codec *codec = rtd->socdev->codec;
92
93 /* set = unmute headphone */ 90 /* set = unmute headphone */
94 locomo_gpio_write(&poodle_locomo_device.dev, 91 locomo_gpio_write(&poodle_locomo_device.dev,
95 POODLE_LOCOMO_GPIO_MUTE_L, 1); 92 POODLE_LOCOMO_GPIO_MUTE_L, 1);
96 locomo_gpio_write(&poodle_locomo_device.dev, 93 locomo_gpio_write(&poodle_locomo_device.dev,
97 POODLE_LOCOMO_GPIO_MUTE_R, 1); 94 POODLE_LOCOMO_GPIO_MUTE_R, 1);
98 return 0;
99} 95}
100 96
101static int poodle_hw_params(struct snd_pcm_substream *substream, 97static int poodle_hw_params(struct snd_pcm_substream *substream,
@@ -232,7 +228,7 @@ static const struct soc_enum poodle_enum[] = {
232 SOC_ENUM_SINGLE_EXT(2, spk_function), 228 SOC_ENUM_SINGLE_EXT(2, spk_function),
233}; 229};
234 230
235static const snd_kcontrol_new_t wm8731_poodle_controls[] = { 231static const struct snd_kcontrol_new wm8731_poodle_controls[] = {
236 SOC_ENUM_EXT("Jack Function", poodle_enum[0], poodle_get_jack, 232 SOC_ENUM_EXT("Jack Function", poodle_enum[0], poodle_get_jack,
237 poodle_set_jack), 233 poodle_set_jack),
238 SOC_ENUM_EXT("Speaker Function", poodle_enum[1], poodle_get_spk, 234 SOC_ENUM_EXT("Speaker Function", poodle_enum[1], poodle_get_spk,
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index fe6cca9c9e76..22971a0f040e 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -33,7 +33,6 @@
33#include <asm/arch/pxa-regs.h> 33#include <asm/arch/pxa-regs.h>
34#include <asm/arch/hardware.h> 34#include <asm/arch/hardware.h>
35#include <asm/arch/audio.h> 35#include <asm/arch/audio.h>
36#include <asm/arch/tosa.h>
37 36
38#include "../codecs/wm9712.h" 37#include "../codecs/wm9712.h"
39#include "pxa2xx-pcm.h" 38#include "pxa2xx-pcm.h"
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 820347c9ae4b..f9d100bc8479 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -470,6 +470,7 @@ int dapm_reg_event(struct snd_soc_dapm_widget *w,
470 470
471 return 0; 471 return 0;
472} 472}
473EXPORT_SYMBOL_GPL(dapm_reg_event);
473 474
474/* 475/*
475 * Scan each dapm widget for complete audio path. 476 * Scan each dapm widget for complete audio path.