mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 17:53:56 +08:00
Auto merge with /home/aegl/GIT/linus
This commit is contained in:
commit
e7578c08a4
@ -223,7 +223,9 @@ source "arch/arm/mach-pxa/Kconfig"
|
||||
|
||||
source "arch/arm/mach-sa1100/Kconfig"
|
||||
|
||||
source "arch/arm/mach-omap/Kconfig"
|
||||
source "arch/arm/plat-omap/Kconfig"
|
||||
|
||||
source "arch/arm/mach-omap1/Kconfig"
|
||||
|
||||
source "arch/arm/mach-s3c2410/Kconfig"
|
||||
|
||||
@ -514,7 +516,7 @@ config XIP_PHYS_ADDR
|
||||
|
||||
endmenu
|
||||
|
||||
if (ARCH_SA1100 || ARCH_INTEGRATOR)
|
||||
if (ARCH_SA1100 || ARCH_INTEGRATOR || ARCH_OMAP1)
|
||||
|
||||
menu "CPU Frequency scaling"
|
||||
|
||||
|
@ -91,7 +91,8 @@ textaddr-$(CONFIG_ARCH_FORTUNET) := 0xc0008000
|
||||
machine-$(CONFIG_ARCH_IOP3XX) := iop3xx
|
||||
machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
|
||||
machine-$(CONFIG_ARCH_IXP2000) := ixp2000
|
||||
machine-$(CONFIG_ARCH_OMAP) := omap
|
||||
machine-$(CONFIG_ARCH_OMAP1) := omap1
|
||||
incdir-$(CONFIG_ARCH_OMAP) := omap
|
||||
machine-$(CONFIG_ARCH_S3C2410) := s3c2410
|
||||
machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x
|
||||
machine-$(CONFIG_ARCH_VERSATILE) := versatile
|
||||
@ -142,6 +143,9 @@ core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/
|
||||
core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ)
|
||||
core-$(CONFIG_VFP) += arch/arm/vfp/
|
||||
|
||||
# If we have a common platform directory, then include it in the build.
|
||||
core-$(CONFIG_ARCH_OMAP) += arch/arm/plat-omap/
|
||||
|
||||
drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
|
||||
drivers-$(CONFIG_ARCH_CLPS7500) += drivers/acorn/char/
|
||||
drivers-$(CONFIG_ARCH_L7200) += drivers/acorn/char/
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version: 2.6.12-git6
|
||||
# Sat Jun 25 00:57:29 2005
|
||||
# Linux kernel version: 2.6.13-rc2
|
||||
# Thu Jul 7 16:41:21 2005
|
||||
#
|
||||
CONFIG_ARM=y
|
||||
CONFIG_MMU=y
|
||||
@ -137,6 +137,7 @@ CONFIG_PCI_NAMES=y
|
||||
#
|
||||
# CONFIG_SMP is not set
|
||||
# CONFIG_PREEMPT is not set
|
||||
# CONFIG_NO_IDLE_HZ is not set
|
||||
# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
|
||||
CONFIG_SELECT_MEMORY_MODEL=y
|
||||
CONFIG_FLATMEM_MANUAL=y
|
||||
@ -345,10 +346,9 @@ CONFIG_PACKET_MMAP=y
|
||||
CONFIG_UNIX=y
|
||||
# CONFIG_NET_KEY is not set
|
||||
CONFIG_INET=y
|
||||
CONFIG_IP_FIB_HASH=y
|
||||
# CONFIG_IP_FIB_TRIE is not set
|
||||
# CONFIG_IP_MULTICAST is not set
|
||||
# CONFIG_IP_ADVANCED_ROUTER is not set
|
||||
CONFIG_IP_FIB_HASH=y
|
||||
CONFIG_IP_PNP=y
|
||||
CONFIG_IP_PNP_DHCP=y
|
||||
CONFIG_IP_PNP_BOOTP=y
|
||||
@ -363,17 +363,8 @@ CONFIG_SYN_COOKIES=y
|
||||
# CONFIG_INET_TUNNEL is not set
|
||||
# CONFIG_IP_TCPDIAG is not set
|
||||
# CONFIG_IP_TCPDIAG_IPV6 is not set
|
||||
|
||||
#
|
||||
# TCP congestion control
|
||||
#
|
||||
# CONFIG_TCP_CONG_ADVANCED is not set
|
||||
CONFIG_TCP_CONG_BIC=y
|
||||
CONFIG_TCP_CONG_WESTWOOD=m
|
||||
CONFIG_TCP_CONG_HTCP=m
|
||||
# CONFIG_TCP_CONG_HSTCP is not set
|
||||
# CONFIG_TCP_CONG_HYBLA is not set
|
||||
# CONFIG_TCP_CONG_VEGAS is not set
|
||||
# CONFIG_TCP_CONG_SCALABLE is not set
|
||||
# CONFIG_IPV6 is not set
|
||||
# CONFIG_NETFILTER is not set
|
||||
|
||||
@ -931,4 +922,3 @@ CONFIG_CRC32=y
|
||||
# CONFIG_LIBCRC32C is not set
|
||||
CONFIG_ZLIB_INFLATE=y
|
||||
CONFIG_ZLIB_DEFLATE=y
|
||||
# CONFIG_TEXTSEARCH is not set
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version: 2.6.12-git6
|
||||
# Sat Jun 25 00:58:38 2005
|
||||
# Linux kernel version: 2.6.13-rc2
|
||||
# Thu Jul 7 16:49:01 2005
|
||||
#
|
||||
CONFIG_ARM=y
|
||||
CONFIG_MMU=y
|
||||
@ -138,6 +138,7 @@ CONFIG_PCI_NAMES=y
|
||||
#
|
||||
# CONFIG_SMP is not set
|
||||
# CONFIG_PREEMPT is not set
|
||||
# CONFIG_NO_IDLE_HZ is not set
|
||||
# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
|
||||
CONFIG_SELECT_MEMORY_MODEL=y
|
||||
CONFIG_FLATMEM_MANUAL=y
|
||||
@ -346,10 +347,9 @@ CONFIG_PACKET_MMAP=y
|
||||
CONFIG_UNIX=y
|
||||
# CONFIG_NET_KEY is not set
|
||||
CONFIG_INET=y
|
||||
CONFIG_IP_FIB_HASH=y
|
||||
# CONFIG_IP_FIB_TRIE is not set
|
||||
# CONFIG_IP_MULTICAST is not set
|
||||
# CONFIG_IP_ADVANCED_ROUTER is not set
|
||||
CONFIG_IP_FIB_HASH=y
|
||||
CONFIG_IP_PNP=y
|
||||
CONFIG_IP_PNP_DHCP=y
|
||||
CONFIG_IP_PNP_BOOTP=y
|
||||
@ -364,17 +364,8 @@ CONFIG_SYN_COOKIES=y
|
||||
# CONFIG_INET_TUNNEL is not set
|
||||
# CONFIG_IP_TCPDIAG is not set
|
||||
# CONFIG_IP_TCPDIAG_IPV6 is not set
|
||||
|
||||
#
|
||||
# TCP congestion control
|
||||
#
|
||||
# CONFIG_TCP_CONG_ADVANCED is not set
|
||||
CONFIG_TCP_CONG_BIC=y
|
||||
CONFIG_TCP_CONG_WESTWOOD=m
|
||||
CONFIG_TCP_CONG_HTCP=m
|
||||
# CONFIG_TCP_CONG_HSTCP is not set
|
||||
# CONFIG_TCP_CONG_HYBLA is not set
|
||||
# CONFIG_TCP_CONG_VEGAS is not set
|
||||
# CONFIG_TCP_CONG_SCALABLE is not set
|
||||
# CONFIG_IPV6 is not set
|
||||
# CONFIG_NETFILTER is not set
|
||||
|
||||
@ -932,4 +923,3 @@ CONFIG_CRC32=y
|
||||
# CONFIG_LIBCRC32C is not set
|
||||
CONFIG_ZLIB_INFLATE=y
|
||||
CONFIG_ZLIB_DEFLATE=y
|
||||
# CONFIG_TEXTSEARCH is not set
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version: 2.6.12-git6
|
||||
# Sat Jun 25 00:59:35 2005
|
||||
# Linux kernel version: 2.6.13-rc2
|
||||
# Thu Jul 7 16:49:08 2005
|
||||
#
|
||||
CONFIG_ARM=y
|
||||
CONFIG_MMU=y
|
||||
@ -138,6 +138,7 @@ CONFIG_PCI_NAMES=y
|
||||
#
|
||||
# CONFIG_SMP is not set
|
||||
# CONFIG_PREEMPT is not set
|
||||
# CONFIG_NO_IDLE_HZ is not set
|
||||
# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
|
||||
CONFIG_SELECT_MEMORY_MODEL=y
|
||||
CONFIG_FLATMEM_MANUAL=y
|
||||
@ -346,10 +347,9 @@ CONFIG_PACKET_MMAP=y
|
||||
CONFIG_UNIX=y
|
||||
# CONFIG_NET_KEY is not set
|
||||
CONFIG_INET=y
|
||||
CONFIG_IP_FIB_HASH=y
|
||||
# CONFIG_IP_FIB_TRIE is not set
|
||||
# CONFIG_IP_MULTICAST is not set
|
||||
# CONFIG_IP_ADVANCED_ROUTER is not set
|
||||
CONFIG_IP_FIB_HASH=y
|
||||
CONFIG_IP_PNP=y
|
||||
CONFIG_IP_PNP_DHCP=y
|
||||
CONFIG_IP_PNP_BOOTP=y
|
||||
@ -364,17 +364,8 @@ CONFIG_SYN_COOKIES=y
|
||||
# CONFIG_INET_TUNNEL is not set
|
||||
CONFIG_IP_TCPDIAG=y
|
||||
# CONFIG_IP_TCPDIAG_IPV6 is not set
|
||||
|
||||
#
|
||||
# TCP congestion control
|
||||
#
|
||||
# CONFIG_TCP_CONG_ADVANCED is not set
|
||||
CONFIG_TCP_CONG_BIC=y
|
||||
CONFIG_TCP_CONG_WESTWOOD=m
|
||||
CONFIG_TCP_CONG_HTCP=m
|
||||
# CONFIG_TCP_CONG_HSTCP is not set
|
||||
# CONFIG_TCP_CONG_HYBLA is not set
|
||||
# CONFIG_TCP_CONG_VEGAS is not set
|
||||
# CONFIG_TCP_CONG_SCALABLE is not set
|
||||
# CONFIG_IPV6 is not set
|
||||
# CONFIG_NETFILTER is not set
|
||||
|
||||
@ -933,4 +924,3 @@ CONFIG_CRC32=y
|
||||
# CONFIG_LIBCRC32C is not set
|
||||
CONFIG_ZLIB_INFLATE=y
|
||||
CONFIG_ZLIB_DEFLATE=y
|
||||
# CONFIG_TEXTSEARCH is not set
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version: 2.6.12-git6
|
||||
# Sat Jun 25 01:00:27 2005
|
||||
# Linux kernel version: 2.6.13-rc2
|
||||
# Thu Jul 7 16:49:20 2005
|
||||
#
|
||||
CONFIG_ARM=y
|
||||
CONFIG_MMU=y
|
||||
@ -138,6 +138,7 @@ CONFIG_PCI_NAMES=y
|
||||
#
|
||||
# CONFIG_SMP is not set
|
||||
# CONFIG_PREEMPT is not set
|
||||
# CONFIG_NO_IDLE_HZ is not set
|
||||
# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
|
||||
CONFIG_SELECT_MEMORY_MODEL=y
|
||||
CONFIG_FLATMEM_MANUAL=y
|
||||
@ -346,10 +347,9 @@ CONFIG_PACKET_MMAP=y
|
||||
CONFIG_UNIX=y
|
||||
# CONFIG_NET_KEY is not set
|
||||
CONFIG_INET=y
|
||||
CONFIG_IP_FIB_HASH=y
|
||||
# CONFIG_IP_FIB_TRIE is not set
|
||||
# CONFIG_IP_MULTICAST is not set
|
||||
# CONFIG_IP_ADVANCED_ROUTER is not set
|
||||
CONFIG_IP_FIB_HASH=y
|
||||
CONFIG_IP_PNP=y
|
||||
CONFIG_IP_PNP_DHCP=y
|
||||
CONFIG_IP_PNP_BOOTP=y
|
||||
@ -364,17 +364,8 @@ CONFIG_SYN_COOKIES=y
|
||||
# CONFIG_INET_TUNNEL is not set
|
||||
# CONFIG_IP_TCPDIAG is not set
|
||||
# CONFIG_IP_TCPDIAG_IPV6 is not set
|
||||
|
||||
#
|
||||
# TCP congestion control
|
||||
#
|
||||
# CONFIG_TCP_CONG_ADVANCED is not set
|
||||
CONFIG_TCP_CONG_BIC=y
|
||||
CONFIG_TCP_CONG_WESTWOOD=m
|
||||
CONFIG_TCP_CONG_HTCP=m
|
||||
# CONFIG_TCP_CONG_HSTCP is not set
|
||||
# CONFIG_TCP_CONG_HYBLA is not set
|
||||
# CONFIG_TCP_CONG_VEGAS is not set
|
||||
# CONFIG_TCP_CONG_SCALABLE is not set
|
||||
# CONFIG_IPV6 is not set
|
||||
# CONFIG_NETFILTER is not set
|
||||
|
||||
@ -932,4 +923,3 @@ CONFIG_CRC32=y
|
||||
# CONFIG_LIBCRC32C is not set
|
||||
CONFIG_ZLIB_INFLATE=y
|
||||
CONFIG_ZLIB_DEFLATE=y
|
||||
# CONFIG_TEXTSEARCH is not set
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version: 2.6.12-git6
|
||||
# Sat Jun 25 01:01:18 2005
|
||||
# Linux kernel version: 2.6.13-rc2
|
||||
# Thu Jul 7 16:49:13 2005
|
||||
#
|
||||
CONFIG_ARM=y
|
||||
CONFIG_MMU=y
|
||||
@ -138,6 +138,7 @@ CONFIG_PCI_NAMES=y
|
||||
#
|
||||
# CONFIG_SMP is not set
|
||||
# CONFIG_PREEMPT is not set
|
||||
# CONFIG_NO_IDLE_HZ is not set
|
||||
# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
|
||||
CONFIG_SELECT_MEMORY_MODEL=y
|
||||
CONFIG_FLATMEM_MANUAL=y
|
||||
@ -346,10 +347,9 @@ CONFIG_PACKET_MMAP=y
|
||||
CONFIG_UNIX=y
|
||||
# CONFIG_NET_KEY is not set
|
||||
CONFIG_INET=y
|
||||
CONFIG_IP_FIB_HASH=y
|
||||
# CONFIG_IP_FIB_TRIE is not set
|
||||
# CONFIG_IP_MULTICAST is not set
|
||||
# CONFIG_IP_ADVANCED_ROUTER is not set
|
||||
CONFIG_IP_FIB_HASH=y
|
||||
CONFIG_IP_PNP=y
|
||||
CONFIG_IP_PNP_DHCP=y
|
||||
CONFIG_IP_PNP_BOOTP=y
|
||||
@ -364,17 +364,8 @@ CONFIG_SYN_COOKIES=y
|
||||
# CONFIG_INET_TUNNEL is not set
|
||||
# CONFIG_IP_TCPDIAG is not set
|
||||
# CONFIG_IP_TCPDIAG_IPV6 is not set
|
||||
|
||||
#
|
||||
# TCP congestion control
|
||||
#
|
||||
# CONFIG_TCP_CONG_ADVANCED is not set
|
||||
CONFIG_TCP_CONG_BIC=y
|
||||
CONFIG_TCP_CONG_WESTWOOD=m
|
||||
CONFIG_TCP_CONG_HTCP=m
|
||||
# CONFIG_TCP_CONG_HSTCP is not set
|
||||
# CONFIG_TCP_CONG_HYBLA is not set
|
||||
# CONFIG_TCP_CONG_VEGAS is not set
|
||||
# CONFIG_TCP_CONG_SCALABLE is not set
|
||||
# CONFIG_IPV6 is not set
|
||||
# CONFIG_NETFILTER is not set
|
||||
|
||||
@ -933,4 +924,3 @@ CONFIG_CRC32=y
|
||||
# CONFIG_LIBCRC32C is not set
|
||||
CONFIG_ZLIB_INFLATE=y
|
||||
CONFIG_ZLIB_DEFLATE=y
|
||||
# CONFIG_TEXTSEARCH is not set
|
||||
|
@ -1,14 +1,13 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version: 2.6.12-rc1-bk2
|
||||
# Sun Mar 27 17:52:41 2005
|
||||
# Linux kernel version: 2.6.13-rc2
|
||||
# Fri Jul 8 04:49:34 2005
|
||||
#
|
||||
CONFIG_ARM=y
|
||||
CONFIG_MMU=y
|
||||
CONFIG_UID16=y
|
||||
CONFIG_RWSEM_GENERIC_SPINLOCK=y
|
||||
CONFIG_GENERIC_CALIBRATE_DELAY=y
|
||||
CONFIG_GENERIC_IOMAP=y
|
||||
|
||||
#
|
||||
# Code maturity level options
|
||||
@ -17,6 +16,7 @@ CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_CLEAN_COMPILE=y
|
||||
CONFIG_BROKEN_ON_SMP=y
|
||||
CONFIG_LOCK_KERNEL=y
|
||||
CONFIG_INIT_ENV_ARG_LIMIT=32
|
||||
|
||||
#
|
||||
# General setup
|
||||
@ -33,8 +33,9 @@ CONFIG_KOBJECT_UEVENT=y
|
||||
# CONFIG_IKCONFIG is not set
|
||||
# CONFIG_EMBEDDED is not set
|
||||
CONFIG_KALLSYMS=y
|
||||
# CONFIG_KALLSYMS_ALL is not set
|
||||
# CONFIG_KALLSYMS_EXTRA_PASS is not set
|
||||
CONFIG_PRINTK=y
|
||||
CONFIG_BUG=y
|
||||
CONFIG_BASE_FULL=y
|
||||
CONFIG_FUTEX=y
|
||||
CONFIG_EPOLL=y
|
||||
@ -82,10 +83,28 @@ CONFIG_ARCH_OMAP=y
|
||||
# CONFIG_ARCH_VERSATILE is not set
|
||||
# CONFIG_ARCH_IMX is not set
|
||||
# CONFIG_ARCH_H720X is not set
|
||||
# CONFIG_ARCH_AAEC2000 is not set
|
||||
|
||||
#
|
||||
# TI OMAP Implementations
|
||||
#
|
||||
CONFIG_ARCH_OMAP_OTG=y
|
||||
CONFIG_ARCH_OMAP1=y
|
||||
# CONFIG_ARCH_OMAP2 is not set
|
||||
|
||||
#
|
||||
# OMAP Feature Selections
|
||||
#
|
||||
# CONFIG_OMAP_RESET_CLOCKS is not set
|
||||
CONFIG_OMAP_MUX=y
|
||||
# CONFIG_OMAP_MUX_DEBUG is not set
|
||||
CONFIG_OMAP_MUX_WARNINGS=y
|
||||
# CONFIG_OMAP_MPU_TIMER is not set
|
||||
CONFIG_OMAP_32K_TIMER=y
|
||||
CONFIG_OMAP_32K_TIMER_HZ=128
|
||||
CONFIG_OMAP_LL_DEBUG_UART1=y
|
||||
# CONFIG_OMAP_LL_DEBUG_UART2 is not set
|
||||
# CONFIG_OMAP_LL_DEBUG_UART3 is not set
|
||||
|
||||
#
|
||||
# OMAP Core Type
|
||||
@ -93,7 +112,6 @@ CONFIG_ARCH_OMAP=y
|
||||
# CONFIG_ARCH_OMAP730 is not set
|
||||
# CONFIG_ARCH_OMAP1510 is not set
|
||||
CONFIG_ARCH_OMAP16XX=y
|
||||
CONFIG_ARCH_OMAP_OTG=y
|
||||
|
||||
#
|
||||
# OMAP Board Type
|
||||
@ -101,21 +119,14 @@ CONFIG_ARCH_OMAP_OTG=y
|
||||
# CONFIG_MACH_OMAP_INNOVATOR is not set
|
||||
CONFIG_MACH_OMAP_H2=y
|
||||
# CONFIG_MACH_OMAP_H3 is not set
|
||||
# CONFIG_MACH_OMAP_H4 is not set
|
||||
# CONFIG_MACH_OMAP_OSK is not set
|
||||
# CONFIG_MACH_OMAP_GENERIC is not set
|
||||
|
||||
#
|
||||
# OMAP Feature Selections
|
||||
# OMAP CPU Speed
|
||||
#
|
||||
CONFIG_OMAP_MUX=y
|
||||
# CONFIG_OMAP_MUX_DEBUG is not set
|
||||
CONFIG_OMAP_MUX_WARNINGS=y
|
||||
CONFIG_OMAP_MPU_TIMER=y
|
||||
# CONFIG_OMAP_32K_TIMER is not set
|
||||
CONFIG_OMAP_LL_DEBUG_UART1=y
|
||||
# CONFIG_OMAP_LL_DEBUG_UART2 is not set
|
||||
# CONFIG_OMAP_LL_DEBUG_UART3 is not set
|
||||
# CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER is not set
|
||||
# CONFIG_OMAP_ARM_216MHZ is not set
|
||||
CONFIG_OMAP_ARM_192MHZ=y
|
||||
# CONFIG_OMAP_ARM_168MHZ is not set
|
||||
# CONFIG_OMAP_ARM_120MHZ is not set
|
||||
@ -145,6 +156,7 @@ CONFIG_ARM_THUMB=y
|
||||
#
|
||||
# Bus support
|
||||
#
|
||||
CONFIG_ISA_DMA_API=y
|
||||
|
||||
#
|
||||
# PCCARD (PCMCIA/CardBus) support
|
||||
@ -154,7 +166,16 @@ CONFIG_ARM_THUMB=y
|
||||
#
|
||||
# Kernel Features
|
||||
#
|
||||
# CONFIG_SMP is not set
|
||||
CONFIG_PREEMPT=y
|
||||
CONFIG_NO_IDLE_HZ=y
|
||||
# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
|
||||
CONFIG_SELECT_MEMORY_MODEL=y
|
||||
CONFIG_FLATMEM_MANUAL=y
|
||||
# CONFIG_DISCONTIGMEM_MANUAL is not set
|
||||
# CONFIG_SPARSEMEM_MANUAL is not set
|
||||
CONFIG_FLATMEM=y
|
||||
CONFIG_FLAT_NODE_MEM_MAP=y
|
||||
# CONFIG_LEDS is not set
|
||||
CONFIG_ALIGNMENT_TRAP=y
|
||||
|
||||
@ -166,6 +187,22 @@ CONFIG_ZBOOT_ROM_BSS=0x0
|
||||
CONFIG_CMDLINE="mem=32M console=ttyS0,115200n8 root=0801 ro init=/bin/sh"
|
||||
# CONFIG_XIP_KERNEL is not set
|
||||
|
||||
#
|
||||
# CPU Frequency scaling
|
||||
#
|
||||
CONFIG_CPU_FREQ=y
|
||||
CONFIG_CPU_FREQ_TABLE=y
|
||||
# CONFIG_CPU_FREQ_DEBUG is not set
|
||||
CONFIG_CPU_FREQ_STAT=y
|
||||
# CONFIG_CPU_FREQ_STAT_DETAILS is not set
|
||||
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
|
||||
CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
|
||||
# CONFIG_CPU_FREQ_GOV_PERFORMANCE is not set
|
||||
# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
|
||||
CONFIG_CPU_FREQ_GOV_USERSPACE=y
|
||||
# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
|
||||
# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
|
||||
|
||||
#
|
||||
# Floating point emulation
|
||||
#
|
||||
@ -202,7 +239,6 @@ CONFIG_PM=y
|
||||
CONFIG_STANDALONE=y
|
||||
CONFIG_PREVENT_FIRMWARE_BUILD=y
|
||||
# CONFIG_FW_LOADER is not set
|
||||
CONFIG_DEBUG_DRIVER=y
|
||||
|
||||
#
|
||||
# Memory Technology Devices (MTD)
|
||||
@ -292,7 +328,6 @@ CONFIG_MTD_CFI_UTIL=y
|
||||
#
|
||||
# Block devices
|
||||
#
|
||||
# CONFIG_BLK_DEV_FD is not set
|
||||
# CONFIG_BLK_DEV_COW_COMMON is not set
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
# CONFIG_BLK_DEV_CRYPTOLOOP is not set
|
||||
@ -327,6 +362,7 @@ CONFIG_SCSI_PROC_FS=y
|
||||
# CONFIG_CHR_DEV_OSST is not set
|
||||
# CONFIG_BLK_DEV_SR is not set
|
||||
# CONFIG_CHR_DEV_SG is not set
|
||||
# CONFIG_CHR_DEV_SCH is not set
|
||||
|
||||
#
|
||||
# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
|
||||
@ -356,6 +392,7 @@ CONFIG_SCSI_PROC_FS=y
|
||||
#
|
||||
# Fusion MPT device support
|
||||
#
|
||||
# CONFIG_FUSION is not set
|
||||
|
||||
#
|
||||
# IEEE 1394 (FireWire) support
|
||||
@ -375,12 +412,12 @@ CONFIG_NET=y
|
||||
#
|
||||
CONFIG_PACKET=y
|
||||
# CONFIG_PACKET_MMAP is not set
|
||||
# CONFIG_NETLINK_DEV is not set
|
||||
CONFIG_UNIX=y
|
||||
# CONFIG_NET_KEY is not set
|
||||
CONFIG_INET=y
|
||||
# CONFIG_IP_MULTICAST is not set
|
||||
# CONFIG_IP_ADVANCED_ROUTER is not set
|
||||
CONFIG_IP_FIB_HASH=y
|
||||
CONFIG_IP_PNP=y
|
||||
CONFIG_IP_PNP_DHCP=y
|
||||
CONFIG_IP_PNP_BOOTP=y
|
||||
@ -395,6 +432,8 @@ CONFIG_IP_PNP_BOOTP=y
|
||||
# CONFIG_INET_TUNNEL is not set
|
||||
CONFIG_IP_TCPDIAG=y
|
||||
# CONFIG_IP_TCPDIAG_IPV6 is not set
|
||||
# CONFIG_TCP_CONG_ADVANCED is not set
|
||||
CONFIG_TCP_CONG_BIC=y
|
||||
# CONFIG_IPV6 is not set
|
||||
# CONFIG_NETFILTER is not set
|
||||
|
||||
@ -442,6 +481,7 @@ CONFIG_NETDEVICES=y
|
||||
CONFIG_NET_ETHERNET=y
|
||||
CONFIG_MII=y
|
||||
CONFIG_SMC91X=y
|
||||
# CONFIG_DM9000 is not set
|
||||
|
||||
#
|
||||
# Ethernet (1000 Mbit)
|
||||
@ -518,7 +558,6 @@ CONFIG_SERIO=y
|
||||
CONFIG_SERIO_SERPORT=y
|
||||
# CONFIG_SERIO_RAW is not set
|
||||
# CONFIG_GAMEPORT is not set
|
||||
CONFIG_SOUND_GAMEPORT=y
|
||||
|
||||
#
|
||||
# Character devices
|
||||
@ -567,13 +606,11 @@ CONFIG_WATCHDOG_NOWAYOUT=y
|
||||
#
|
||||
# Ftape, the floppy tape device driver
|
||||
#
|
||||
# CONFIG_DRM is not set
|
||||
# CONFIG_RAW_DRIVER is not set
|
||||
|
||||
#
|
||||
# TPM devices
|
||||
#
|
||||
# CONFIG_TCG_TPM is not set
|
||||
|
||||
#
|
||||
# I2C support
|
||||
@ -604,7 +641,9 @@ CONFIG_I2C_CHARDEV=y
|
||||
# CONFIG_SENSORS_ADM1025 is not set
|
||||
# CONFIG_SENSORS_ADM1026 is not set
|
||||
# CONFIG_SENSORS_ADM1031 is not set
|
||||
# CONFIG_SENSORS_ADM9240 is not set
|
||||
# CONFIG_SENSORS_ASB100 is not set
|
||||
# CONFIG_SENSORS_ATXP1 is not set
|
||||
# CONFIG_SENSORS_DS1621 is not set
|
||||
# CONFIG_SENSORS_FSCHER is not set
|
||||
# CONFIG_SENSORS_FSCPOS is not set
|
||||
@ -620,6 +659,7 @@ CONFIG_I2C_CHARDEV=y
|
||||
# CONFIG_SENSORS_LM85 is not set
|
||||
# CONFIG_SENSORS_LM87 is not set
|
||||
# CONFIG_SENSORS_LM90 is not set
|
||||
# CONFIG_SENSORS_LM92 is not set
|
||||
# CONFIG_SENSORS_MAX1619 is not set
|
||||
# CONFIG_SENSORS_PC87360 is not set
|
||||
# CONFIG_SENSORS_SMSC47B397 is not set
|
||||
@ -627,15 +667,21 @@ CONFIG_I2C_CHARDEV=y
|
||||
# CONFIG_SENSORS_W83781D is not set
|
||||
# CONFIG_SENSORS_W83L785TS is not set
|
||||
# CONFIG_SENSORS_W83627HF is not set
|
||||
# CONFIG_SENSORS_W83627EHF is not set
|
||||
|
||||
#
|
||||
# Other I2C Chip support
|
||||
#
|
||||
# CONFIG_SENSORS_DS1337 is not set
|
||||
# CONFIG_SENSORS_DS1374 is not set
|
||||
# CONFIG_SENSORS_EEPROM is not set
|
||||
# CONFIG_SENSORS_PCF8574 is not set
|
||||
# CONFIG_SENSORS_PCA9539 is not set
|
||||
# CONFIG_SENSORS_PCF8591 is not set
|
||||
# CONFIG_SENSORS_RTC8564 is not set
|
||||
CONFIG_ISP1301_OMAP=y
|
||||
CONFIG_TPS65010=y
|
||||
# CONFIG_SENSORS_MAX6875 is not set
|
||||
# CONFIG_I2C_DEBUG_CORE is not set
|
||||
# CONFIG_I2C_DEBUG_ALGO is not set
|
||||
# CONFIG_I2C_DEBUG_BUS is not set
|
||||
@ -663,8 +709,10 @@ CONFIG_FB=y
|
||||
# CONFIG_FB_CFB_COPYAREA is not set
|
||||
# CONFIG_FB_CFB_IMAGEBLIT is not set
|
||||
# CONFIG_FB_SOFT_CURSOR is not set
|
||||
# CONFIG_FB_MACMODES is not set
|
||||
CONFIG_FB_MODE_HELPERS=y
|
||||
# CONFIG_FB_TILEBLITTING is not set
|
||||
# CONFIG_FB_S1D13XXX is not set
|
||||
# CONFIG_FB_VIRTUAL is not set
|
||||
|
||||
#
|
||||
@ -677,11 +725,13 @@ CONFIG_FONTS=y
|
||||
CONFIG_FONT_8x8=y
|
||||
CONFIG_FONT_8x16=y
|
||||
# CONFIG_FONT_6x11 is not set
|
||||
# CONFIG_FONT_7x14 is not set
|
||||
# CONFIG_FONT_PEARL_8x8 is not set
|
||||
# CONFIG_FONT_ACORN_8x8 is not set
|
||||
# CONFIG_FONT_MINI_4x6 is not set
|
||||
# CONFIG_FONT_SUN8x16 is not set
|
||||
# CONFIG_FONT_SUN12x22 is not set
|
||||
# CONFIG_FONT_10x18 is not set
|
||||
|
||||
#
|
||||
# Logo configuration
|
||||
@ -729,14 +779,14 @@ CONFIG_USB_ARCH_HAS_OHCI=y
|
||||
#
|
||||
CONFIG_USB_GADGET=y
|
||||
# CONFIG_USB_GADGET_DEBUG_FILES is not set
|
||||
CONFIG_USB_GADGET_SELECTED=y
|
||||
# CONFIG_USB_GADGET_NET2280 is not set
|
||||
# CONFIG_USB_GADGET_PXA2XX is not set
|
||||
# CONFIG_USB_GADGET_GOKU is not set
|
||||
# CONFIG_USB_GADGET_SA1100 is not set
|
||||
# CONFIG_USB_GADGET_LH7A40X is not set
|
||||
# CONFIG_USB_GADGET_DUMMY_HCD is not set
|
||||
CONFIG_USB_GADGET_OMAP=y
|
||||
CONFIG_USB_OMAP=y
|
||||
# CONFIG_USB_GADGET_DUMMY_HCD is not set
|
||||
# CONFIG_USB_GADGET_DUALSPEED is not set
|
||||
# CONFIG_USB_ZERO is not set
|
||||
CONFIG_USB_ETH=y
|
||||
@ -755,6 +805,7 @@ CONFIG_USB_ETH_RNDIS=y
|
||||
#
|
||||
CONFIG_EXT2_FS=y
|
||||
# CONFIG_EXT2_FS_XATTR is not set
|
||||
# CONFIG_EXT2_FS_XIP is not set
|
||||
# CONFIG_EXT3_FS is not set
|
||||
# CONFIG_JBD is not set
|
||||
# CONFIG_REISERFS_FS is not set
|
||||
@ -791,7 +842,6 @@ CONFIG_FAT_DEFAULT_CODEPAGE=437
|
||||
#
|
||||
CONFIG_PROC_FS=y
|
||||
CONFIG_SYSFS=y
|
||||
# CONFIG_DEVFS_FS is not set
|
||||
# CONFIG_DEVPTS_FS_XATTR is not set
|
||||
# CONFIG_TMPFS is not set
|
||||
# CONFIG_HUGETLB_PAGE is not set
|
||||
@ -828,12 +878,14 @@ CONFIG_CRAMFS=y
|
||||
#
|
||||
CONFIG_NFS_FS=y
|
||||
CONFIG_NFS_V3=y
|
||||
# CONFIG_NFS_V3_ACL is not set
|
||||
CONFIG_NFS_V4=y
|
||||
# CONFIG_NFS_DIRECTIO is not set
|
||||
# CONFIG_NFSD is not set
|
||||
CONFIG_ROOT_NFS=y
|
||||
CONFIG_LOCKD=y
|
||||
CONFIG_LOCKD_V4=y
|
||||
CONFIG_NFS_COMMON=y
|
||||
CONFIG_SUNRPC=y
|
||||
CONFIG_SUNRPC_GSS=y
|
||||
CONFIG_RPCSEC_GSS_KRB5=y
|
||||
@ -903,24 +955,11 @@ CONFIG_NLS_DEFAULT="iso8859-1"
|
||||
# Kernel hacking
|
||||
#
|
||||
# CONFIG_PRINTK_TIME is not set
|
||||
CONFIG_DEBUG_KERNEL=y
|
||||
# CONFIG_MAGIC_SYSRQ is not set
|
||||
# CONFIG_DEBUG_KERNEL is not set
|
||||
CONFIG_LOG_BUF_SHIFT=14
|
||||
# CONFIG_SCHEDSTATS is not set
|
||||
# CONFIG_DEBUG_SLAB is not set
|
||||
CONFIG_DEBUG_PREEMPT=y
|
||||
# CONFIG_DEBUG_SPINLOCK is not set
|
||||
# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
|
||||
# CONFIG_DEBUG_KOBJECT is not set
|
||||
CONFIG_DEBUG_BUGVERBOSE=y
|
||||
CONFIG_DEBUG_INFO=y
|
||||
# CONFIG_DEBUG_FS is not set
|
||||
CONFIG_FRAME_POINTER=y
|
||||
CONFIG_DEBUG_USER=y
|
||||
# CONFIG_DEBUG_WAITQ is not set
|
||||
CONFIG_DEBUG_ERRORS=y
|
||||
CONFIG_DEBUG_LL=y
|
||||
# CONFIG_DEBUG_ICEDCC is not set
|
||||
# CONFIG_DEBUG_USER is not set
|
||||
|
||||
#
|
||||
# Security options
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <linux/serial.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/serial_core.h>
|
||||
#include <linux/serial_8250.h>
|
||||
#include <linux/mm.h>
|
||||
|
||||
#include <asm/types.h>
|
||||
@ -125,19 +125,6 @@ static struct map_desc ixp2000_io_desc[] __initdata = {
|
||||
}
|
||||
};
|
||||
|
||||
static struct uart_port ixp2000_serial_port = {
|
||||
.membase = (char *)(IXP2000_UART_VIRT_BASE + 3),
|
||||
.mapbase = IXP2000_UART_PHYS_BASE + 3,
|
||||
.irq = IRQ_IXP2000_UART,
|
||||
.flags = UPF_SKIP_TEST,
|
||||
.iotype = UPIO_MEM,
|
||||
.regshift = 2,
|
||||
.uartclk = 50000000,
|
||||
.line = 0,
|
||||
.type = PORT_XSCALE,
|
||||
.fifosize = 16
|
||||
};
|
||||
|
||||
void __init ixp2000_map_io(void)
|
||||
{
|
||||
extern unsigned int processor_id;
|
||||
@ -157,12 +144,50 @@ void __init ixp2000_map_io(void)
|
||||
}
|
||||
|
||||
iotable_init(ixp2000_io_desc, ARRAY_SIZE(ixp2000_io_desc));
|
||||
early_serial_setup(&ixp2000_serial_port);
|
||||
|
||||
/* Set slowport to 8-bit mode. */
|
||||
ixp2000_reg_write(IXP2000_SLOWPORT_FRM, 1);
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Serial port support for IXP2000
|
||||
*************************************************************************/
|
||||
static struct plat_serial8250_port ixp2000_serial_port[] = {
|
||||
{
|
||||
.mapbase = IXP2000_UART_PHYS_BASE,
|
||||
.membase = (char *)(IXP2000_UART_VIRT_BASE + 3),
|
||||
.irq = IRQ_IXP2000_UART,
|
||||
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
|
||||
.iotype = UPIO_MEM,
|
||||
.regshift = 2,
|
||||
.uartclk = 50000000,
|
||||
},
|
||||
{ },
|
||||
};
|
||||
|
||||
static struct resource ixp2000_uart_resource = {
|
||||
.start = IXP2000_UART_PHYS_BASE,
|
||||
.end = IXP2000_UART_PHYS_BASE + 0xffff,
|
||||
.flags = IORESOURCE_MEM,
|
||||
};
|
||||
|
||||
static struct platform_device ixp2000_serial_device = {
|
||||
.name = "serial8250",
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.platform_data = ixp2000_serial_port,
|
||||
},
|
||||
.num_resources = 1,
|
||||
.resource = &ixp2000_uart_resource,
|
||||
};
|
||||
|
||||
void __init ixp2000_uart_init(void)
|
||||
{
|
||||
platform_device_register(&ixp2000_serial_device);
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Timer-tick functions for IXP2000
|
||||
*************************************************************************/
|
||||
|
@ -219,6 +219,7 @@ static struct platform_device *enp2611_devices[] __initdata = {
|
||||
static void __init enp2611_init_machine(void)
|
||||
{
|
||||
platform_add_devices(enp2611_devices, ARRAY_SIZE(enp2611_devices));
|
||||
ixp2000_uart_init();
|
||||
}
|
||||
|
||||
|
||||
|
@ -303,5 +303,6 @@ void __init ixdp2x00_init_machine(void)
|
||||
gpio_line_config(IXDP2X00_GPIO_I2C_ENABLE, GPIO_OUT);
|
||||
|
||||
platform_add_devices(ixdp2x00_devices, ARRAY_SIZE(ixdp2x00_devices));
|
||||
ixp2000_uart_init();
|
||||
}
|
||||
|
||||
|
@ -370,6 +370,7 @@ static void __init ixdp2x01_init_machine(void)
|
||||
((*IXDP2X01_CPLD_FLASH_REG & IXDP2X01_CPLD_FLASH_BANK_MASK) + 1);
|
||||
|
||||
platform_add_devices(ixdp2x01_devices, ARRAY_SIZE(ixdp2x01_devices));
|
||||
ixp2000_uart_init();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,221 +0,0 @@
|
||||
if ARCH_OMAP
|
||||
|
||||
menu "TI OMAP Implementations"
|
||||
|
||||
comment "OMAP Core Type"
|
||||
|
||||
config ARCH_OMAP730
|
||||
depends on ARCH_OMAP
|
||||
bool "OMAP730 Based System"
|
||||
select ARCH_OMAP_OTG
|
||||
|
||||
config ARCH_OMAP1510
|
||||
depends on ARCH_OMAP
|
||||
default y
|
||||
bool "OMAP1510 Based System"
|
||||
|
||||
config ARCH_OMAP16XX
|
||||
depends on ARCH_OMAP
|
||||
bool "OMAP16XX Based System"
|
||||
select ARCH_OMAP_OTG
|
||||
|
||||
config ARCH_OMAP_OTG
|
||||
bool
|
||||
|
||||
comment "OMAP Board Type"
|
||||
|
||||
config MACH_OMAP_INNOVATOR
|
||||
bool "TI Innovator"
|
||||
depends on ARCH_OMAP1510 || ARCH_OMAP16XX
|
||||
help
|
||||
TI OMAP 1510 or 1610 Innovator board support. Say Y here if you
|
||||
have such a board.
|
||||
|
||||
config MACH_OMAP_H2
|
||||
bool "TI H2 Support"
|
||||
depends on ARCH_OMAP16XX
|
||||
help
|
||||
TI OMAP 1610/1611B H2 board support. Say Y here if you have such
|
||||
a board.
|
||||
|
||||
config MACH_OMAP_H3
|
||||
bool "TI H3 Support"
|
||||
depends on ARCH_OMAP16XX
|
||||
help
|
||||
TI OMAP 1710 H3 board support. Say Y here if you have such
|
||||
a board.
|
||||
|
||||
config MACH_OMAP_H4
|
||||
bool "TI H4 Support"
|
||||
depends on ARCH_OMAP16XX
|
||||
help
|
||||
TI OMAP 1610 H4 board support. Say Y here if you have such
|
||||
a board.
|
||||
|
||||
config MACH_OMAP_OSK
|
||||
bool "TI OSK Support"
|
||||
depends on ARCH_OMAP16XX
|
||||
help
|
||||
TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
|
||||
if you have such a board.
|
||||
|
||||
config MACH_OMAP_PERSEUS2
|
||||
bool "TI Perseus2"
|
||||
depends on ARCH_OMAP730
|
||||
help
|
||||
Support for TI OMAP 730 Perseus2 board. Say Y here if you have such
|
||||
a board.
|
||||
|
||||
config MACH_VOICEBLUE
|
||||
bool "Voiceblue"
|
||||
depends on ARCH_OMAP1510
|
||||
help
|
||||
Support for Voiceblue GSM/VoIP gateway. Say Y here if you have such
|
||||
board.
|
||||
|
||||
config MACH_NETSTAR
|
||||
bool "NetStar"
|
||||
depends on ARCH_OMAP1510
|
||||
help
|
||||
Support for NetStar PBX. Say Y here if you have such a board.
|
||||
|
||||
config MACH_OMAP_GENERIC
|
||||
bool "Generic OMAP board"
|
||||
depends on ARCH_OMAP1510 || ARCH_OMAP16XX
|
||||
help
|
||||
Support for generic OMAP-1510, 1610 or 1710 board with
|
||||
no FPGA. Can be used as template for porting Linux to
|
||||
custom OMAP boards. Say Y here if you have a custom
|
||||
board.
|
||||
|
||||
comment "OMAP Feature Selections"
|
||||
|
||||
#config OMAP_BOOT_TAG
|
||||
# bool "OMAP bootloader information passing"
|
||||
# depends on ARCH_OMAP
|
||||
# default n
|
||||
# help
|
||||
# Say Y, if you have a bootloader which passes information
|
||||
# about your board and its peripheral configuration.
|
||||
|
||||
config OMAP_MUX
|
||||
bool "OMAP multiplexing support"
|
||||
depends on ARCH_OMAP
|
||||
default y
|
||||
help
|
||||
Pin multiplexing support for OMAP boards. If your bootloader
|
||||
sets the multiplexing correctly, say N. Otherwise, or if unsure,
|
||||
say Y.
|
||||
|
||||
config OMAP_MUX_DEBUG
|
||||
bool "Multiplexing debug output"
|
||||
depends on OMAP_MUX
|
||||
default n
|
||||
help
|
||||
Makes the multiplexing functions print out a lot of debug info.
|
||||
This is useful if you want to find out the correct values of the
|
||||
multiplexing registers.
|
||||
|
||||
config OMAP_MUX_WARNINGS
|
||||
bool "Warn about pins the bootloader didn't set up"
|
||||
depends on OMAP_MUX
|
||||
default y
|
||||
help
|
||||
Choose Y here to warn whenever driver initialization logic needs
|
||||
to change the pin multiplexing setup. When there are no warnings
|
||||
printed, it's safe to deselect OMAP_MUX for your product.
|
||||
|
||||
choice
|
||||
prompt "System timer"
|
||||
default OMAP_MPU_TIMER
|
||||
|
||||
config OMAP_MPU_TIMER
|
||||
bool "Use mpu timer"
|
||||
help
|
||||
Select this option if you want to use the OMAP mpu timer. This
|
||||
timer provides more intra-tick resolution than the 32KHz timer,
|
||||
but consumes more power.
|
||||
|
||||
config OMAP_32K_TIMER
|
||||
bool "Use 32KHz timer"
|
||||
depends on ARCH_OMAP16XX
|
||||
help
|
||||
Select this option if you want to enable the OMAP 32KHz timer.
|
||||
This timer saves power compared to the OMAP_MPU_TIMER, and has
|
||||
support for no tick during idle. The 32KHz timer provides less
|
||||
intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is
|
||||
currently only available for OMAP-16xx.
|
||||
|
||||
endchoice
|
||||
|
||||
config OMAP_32K_TIMER_HZ
|
||||
int "Kernel internal timer frequency for 32KHz timer"
|
||||
range 32 1024
|
||||
depends on OMAP_32K_TIMER
|
||||
default "128"
|
||||
help
|
||||
Kernel internal timer frequency should be a divisor of 32768,
|
||||
such as 64 or 128.
|
||||
|
||||
choice
|
||||
prompt "Low-level debug console UART"
|
||||
depends on ARCH_OMAP
|
||||
default OMAP_LL_DEBUG_UART1
|
||||
|
||||
config OMAP_LL_DEBUG_UART1
|
||||
bool "UART1"
|
||||
|
||||
config OMAP_LL_DEBUG_UART2
|
||||
bool "UART2"
|
||||
|
||||
config OMAP_LL_DEBUG_UART3
|
||||
bool "UART3"
|
||||
|
||||
endchoice
|
||||
|
||||
config OMAP_ARM_195MHZ
|
||||
bool "OMAP ARM 195 MHz CPU"
|
||||
depends on ARCH_OMAP730
|
||||
help
|
||||
Enable 195MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_192MHZ
|
||||
bool "OMAP ARM 192 MHz CPU"
|
||||
depends on ARCH_OMAP16XX
|
||||
help
|
||||
Enable 192MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_182MHZ
|
||||
bool "OMAP ARM 182 MHz CPU"
|
||||
depends on ARCH_OMAP730
|
||||
help
|
||||
Enable 182MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_168MHZ
|
||||
bool "OMAP ARM 168 MHz CPU"
|
||||
depends on ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730
|
||||
help
|
||||
Enable 168MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_120MHZ
|
||||
bool "OMAP ARM 120 MHz CPU"
|
||||
depends on ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730
|
||||
help
|
||||
Enable 120MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_60MHZ
|
||||
bool "OMAP ARM 60 MHz CPU"
|
||||
depends on ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730
|
||||
default y
|
||||
help
|
||||
Enable 60MHz clock for OMAP CPU. If unsure, say Y.
|
||||
|
||||
config OMAP_ARM_30MHZ
|
||||
bool "OMAP ARM 30 MHz CPU"
|
||||
depends on ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730
|
||||
help
|
||||
Enable 30MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
endmenu
|
||||
|
||||
endif
|
@ -1,40 +0,0 @@
|
||||
#
|
||||
# Makefile for the linux kernel.
|
||||
#
|
||||
|
||||
# Common support
|
||||
obj-y := common.o time.o irq.o dma.o clock.o mux.o gpio.o mcbsp.o usb.o
|
||||
obj-m :=
|
||||
obj-n :=
|
||||
obj- :=
|
||||
led-y := leds.o
|
||||
|
||||
# Specific board support
|
||||
obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o
|
||||
obj-$(CONFIG_MACH_OMAP_INNOVATOR) += board-innovator.o
|
||||
obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
|
||||
obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o
|
||||
obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o
|
||||
obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o
|
||||
obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o
|
||||
obj-$(CONFIG_MACH_NETSTAR) += board-netstar.o
|
||||
|
||||
# OCPI interconnect support for 1710, 1610 and 5912
|
||||
obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
|
||||
|
||||
# LEDs support
|
||||
led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
|
||||
led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o
|
||||
led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o
|
||||
obj-$(CONFIG_LEDS) += $(led-y)
|
||||
|
||||
# Power Management
|
||||
obj-$(CONFIG_PM) += pm.o sleep.o
|
||||
|
||||
ifeq ($(CONFIG_ARCH_OMAP1510),y)
|
||||
# Innovator-1510 FPGA
|
||||
obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o
|
||||
endif
|
||||
|
||||
# kgdb support
|
||||
obj-$(CONFIG_KGDB_SERIAL) += kgdb-serial.o
|
@ -1,549 +0,0 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/common.c
|
||||
*
|
||||
* Code common to all OMAP machines.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/serial.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/serial_8250.h>
|
||||
#include <linux/serial_reg.h>
|
||||
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/mach/map.h>
|
||||
#include <asm/hardware/clock.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <asm/arch/board.h>
|
||||
#include <asm/arch/mux.h>
|
||||
#include <asm/arch/fpga.h>
|
||||
|
||||
#include "clock.h"
|
||||
|
||||
#define DEBUG 1
|
||||
|
||||
struct omap_id {
|
||||
u16 jtag_id; /* Used to determine OMAP type */
|
||||
u8 die_rev; /* Processor revision */
|
||||
u32 omap_id; /* OMAP revision */
|
||||
u32 type; /* Cpu id bits [31:08], cpu class bits [07:00] */
|
||||
};
|
||||
|
||||
/* Register values to detect the OMAP version */
|
||||
static struct omap_id omap_ids[] __initdata = {
|
||||
{ .jtag_id = 0x355f, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x07300100},
|
||||
{ .jtag_id = 0xb55f, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x07300300},
|
||||
{ .jtag_id = 0xb470, .die_rev = 0x0, .omap_id = 0x03310100, .type = 0x15100000},
|
||||
{ .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x16100000},
|
||||
{ .jtag_id = 0xb576, .die_rev = 0x2, .omap_id = 0x03320100, .type = 0x16110000},
|
||||
{ .jtag_id = 0xb576, .die_rev = 0x3, .omap_id = 0x03320100, .type = 0x16100c00},
|
||||
{ .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x03320200, .type = 0x16100d00},
|
||||
{ .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 0x1610ef00},
|
||||
{ .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 0x1610ef00},
|
||||
{ .jtag_id = 0xb576, .die_rev = 0x1, .omap_id = 0x03320100, .type = 0x16110000},
|
||||
{ .jtag_id = 0xb58c, .die_rev = 0x2, .omap_id = 0x03320200, .type = 0x16110b00},
|
||||
{ .jtag_id = 0xb58c, .die_rev = 0x3, .omap_id = 0x03320200, .type = 0x16110c00},
|
||||
{ .jtag_id = 0xb65f, .die_rev = 0x0, .omap_id = 0x03320400, .type = 0x16212300},
|
||||
{ .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320400, .type = 0x16212300},
|
||||
{ .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320500, .type = 0x16212300},
|
||||
{ .jtag_id = 0xb5f7, .die_rev = 0x0, .omap_id = 0x03330000, .type = 0x17100000},
|
||||
{ .jtag_id = 0xb5f7, .die_rev = 0x1, .omap_id = 0x03330100, .type = 0x17100000},
|
||||
{ .jtag_id = 0xb5f7, .die_rev = 0x2, .omap_id = 0x03330100, .type = 0x17100000},
|
||||
};
|
||||
|
||||
/*
|
||||
* Get OMAP type from PROD_ID.
|
||||
* 1710 has the PROD_ID in bits 15:00, not in 16:01 as documented in TRM.
|
||||
* 1510 PROD_ID is empty, and 1610 PROD_ID does not make sense.
|
||||
* Undocumented register in TEST BLOCK is used as fallback; This seems to
|
||||
* work on 1510, 1610 & 1710. The official way hopefully will work in future
|
||||
* processors.
|
||||
*/
|
||||
static u16 __init omap_get_jtag_id(void)
|
||||
{
|
||||
u32 prod_id, omap_id;
|
||||
|
||||
prod_id = omap_readl(OMAP_PRODUCTION_ID_1);
|
||||
omap_id = omap_readl(OMAP32_ID_1);
|
||||
|
||||
/* Check for unusable OMAP_PRODUCTION_ID_1 on 1611B/5912 and 730 */
|
||||
if (((prod_id >> 20) == 0) || (prod_id == omap_id))
|
||||
prod_id = 0;
|
||||
else
|
||||
prod_id &= 0xffff;
|
||||
|
||||
if (prod_id)
|
||||
return prod_id;
|
||||
|
||||
/* Use OMAP32_ID_1 as fallback */
|
||||
prod_id = ((omap_id >> 12) & 0xffff);
|
||||
|
||||
return prod_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get OMAP revision from DIE_REV.
|
||||
* Early 1710 processors may have broken OMAP_DIE_ID, it contains PROD_ID.
|
||||
* Undocumented register in the TEST BLOCK is used as fallback.
|
||||
* REVISIT: This does not seem to work on 1510
|
||||
*/
|
||||
static u8 __init omap_get_die_rev(void)
|
||||
{
|
||||
u32 die_rev;
|
||||
|
||||
die_rev = omap_readl(OMAP_DIE_ID_1);
|
||||
|
||||
/* Check for broken OMAP_DIE_ID on early 1710 */
|
||||
if (((die_rev >> 12) & 0xffff) == omap_get_jtag_id())
|
||||
die_rev = 0;
|
||||
|
||||
die_rev = (die_rev >> 17) & 0xf;
|
||||
if (die_rev)
|
||||
return die_rev;
|
||||
|
||||
die_rev = (omap_readl(OMAP32_ID_1) >> 28) & 0xf;
|
||||
|
||||
return die_rev;
|
||||
}
|
||||
|
||||
static void __init omap_check_revision(void)
|
||||
{
|
||||
int i;
|
||||
u16 jtag_id;
|
||||
u8 die_rev;
|
||||
u32 omap_id;
|
||||
u8 cpu_type;
|
||||
|
||||
jtag_id = omap_get_jtag_id();
|
||||
die_rev = omap_get_die_rev();
|
||||
omap_id = omap_readl(OMAP32_ID_0);
|
||||
|
||||
#ifdef DEBUG
|
||||
printk("OMAP_DIE_ID_0: 0x%08x\n", omap_readl(OMAP_DIE_ID_0));
|
||||
printk("OMAP_DIE_ID_1: 0x%08x DIE_REV: %i\n",
|
||||
omap_readl(OMAP_DIE_ID_1),
|
||||
(omap_readl(OMAP_DIE_ID_1) >> 17) & 0xf);
|
||||
printk("OMAP_PRODUCTION_ID_0: 0x%08x\n", omap_readl(OMAP_PRODUCTION_ID_0));
|
||||
printk("OMAP_PRODUCTION_ID_1: 0x%08x JTAG_ID: 0x%04x\n",
|
||||
omap_readl(OMAP_PRODUCTION_ID_1),
|
||||
omap_readl(OMAP_PRODUCTION_ID_1) & 0xffff);
|
||||
printk("OMAP32_ID_0: 0x%08x\n", omap_readl(OMAP32_ID_0));
|
||||
printk("OMAP32_ID_1: 0x%08x\n", omap_readl(OMAP32_ID_1));
|
||||
printk("JTAG_ID: 0x%04x DIE_REV: %i\n", jtag_id, die_rev);
|
||||
#endif
|
||||
|
||||
system_serial_high = omap_readl(OMAP_DIE_ID_0);
|
||||
system_serial_low = omap_readl(OMAP_DIE_ID_1);
|
||||
|
||||
/* First check only the major version in a safe way */
|
||||
for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
|
||||
if (jtag_id == (omap_ids[i].jtag_id)) {
|
||||
system_rev = omap_ids[i].type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if we can find the die revision */
|
||||
for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
|
||||
if (jtag_id == omap_ids[i].jtag_id && die_rev == omap_ids[i].die_rev) {
|
||||
system_rev = omap_ids[i].type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally check also the omap_id */
|
||||
for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
|
||||
if (jtag_id == omap_ids[i].jtag_id
|
||||
&& die_rev == omap_ids[i].die_rev
|
||||
&& omap_id == omap_ids[i].omap_id) {
|
||||
system_rev = omap_ids[i].type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add the cpu class info (7xx, 15xx, 16xx, 24xx) */
|
||||
cpu_type = system_rev >> 24;
|
||||
|
||||
switch (cpu_type) {
|
||||
case 0x07:
|
||||
system_rev |= 0x07;
|
||||
break;
|
||||
case 0x15:
|
||||
system_rev |= 0x15;
|
||||
break;
|
||||
case 0x16:
|
||||
case 0x17:
|
||||
system_rev |= 0x16;
|
||||
break;
|
||||
case 0x24:
|
||||
system_rev |= 0x24;
|
||||
break;
|
||||
default:
|
||||
printk("Unknown OMAP cpu type: 0x%02x\n", cpu_type);
|
||||
}
|
||||
|
||||
printk("OMAP%04x", system_rev >> 16);
|
||||
if ((system_rev >> 8) & 0xff)
|
||||
printk("%x", (system_rev >> 8) & 0xff);
|
||||
printk(" revision %i handled as %02xxx id: %08x%08x\n",
|
||||
die_rev, system_rev & 0xff, system_serial_low,
|
||||
system_serial_high);
|
||||
}
|
||||
|
||||
/*
|
||||
* ----------------------------------------------------------------------------
|
||||
* OMAP I/O mapping
|
||||
*
|
||||
* The machine specific code may provide the extra mapping besides the
|
||||
* default mapping provided here.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static struct map_desc omap_io_desc[] __initdata = {
|
||||
{ IO_VIRT, IO_PHYS, IO_SIZE, MT_DEVICE },
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP730
|
||||
static struct map_desc omap730_io_desc[] __initdata = {
|
||||
{ OMAP730_DSP_BASE, OMAP730_DSP_START, OMAP730_DSP_SIZE, MT_DEVICE },
|
||||
{ OMAP730_DSPREG_BASE, OMAP730_DSPREG_START, OMAP730_DSPREG_SIZE, MT_DEVICE },
|
||||
{ OMAP730_SRAM_BASE, OMAP730_SRAM_START, OMAP730_SRAM_SIZE, MT_DEVICE }
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP1510
|
||||
static struct map_desc omap1510_io_desc[] __initdata = {
|
||||
{ OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE },
|
||||
{ OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE },
|
||||
{ OMAP1510_SRAM_BASE, OMAP1510_SRAM_START, OMAP1510_SRAM_SIZE, MT_DEVICE }
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_OMAP16XX)
|
||||
static struct map_desc omap1610_io_desc[] __initdata = {
|
||||
{ OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
|
||||
{ OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
|
||||
{ OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP1610_SRAM_SIZE, MT_DEVICE }
|
||||
};
|
||||
|
||||
static struct map_desc omap5912_io_desc[] __initdata = {
|
||||
{ OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
|
||||
{ OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
|
||||
/*
|
||||
* The OMAP5912 has 250kByte internal SRAM. Because the mapping is baseed on page
|
||||
* size (4kByte), it seems that the last 2kByte (=0x800) of the 250kByte are not mapped.
|
||||
* Add additional 2kByte (0x800) so that the last page is mapped and the last 2kByte
|
||||
* can be used.
|
||||
*/
|
||||
{ OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP5912_SRAM_SIZE + 0x800, MT_DEVICE }
|
||||
};
|
||||
#endif
|
||||
|
||||
static int initialized = 0;
|
||||
|
||||
static void __init _omap_map_io(void)
|
||||
{
|
||||
initialized = 1;
|
||||
|
||||
/* We have to initialize the IO space mapping before we can run
|
||||
* cpu_is_omapxxx() macros. */
|
||||
iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
|
||||
omap_check_revision();
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP730
|
||||
if (cpu_is_omap730()) {
|
||||
iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_ARCH_OMAP1510
|
||||
if (cpu_is_omap1510()) {
|
||||
iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_ARCH_OMAP16XX)
|
||||
if (cpu_is_omap1610() || cpu_is_omap1710()) {
|
||||
iotable_init(omap1610_io_desc, ARRAY_SIZE(omap1610_io_desc));
|
||||
}
|
||||
if (cpu_is_omap5912()) {
|
||||
iotable_init(omap5912_io_desc, ARRAY_SIZE(omap5912_io_desc));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
|
||||
* on a Posted Write in the TIPB Bridge".
|
||||
*/
|
||||
omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
|
||||
omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
|
||||
|
||||
/* Must init clocks early to assure that timer interrupt works
|
||||
*/
|
||||
clk_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* This should only get called from board specific init
|
||||
*/
|
||||
void omap_map_io(void)
|
||||
{
|
||||
if (!initialized)
|
||||
_omap_map_io();
|
||||
}
|
||||
|
||||
static inline unsigned int omap_serial_in(struct plat_serial8250_port *up,
|
||||
int offset)
|
||||
{
|
||||
offset <<= up->regshift;
|
||||
return (unsigned int)__raw_readb(up->membase + offset);
|
||||
}
|
||||
|
||||
static inline void omap_serial_outp(struct plat_serial8250_port *p, int offset,
|
||||
int value)
|
||||
{
|
||||
offset <<= p->regshift;
|
||||
__raw_writeb(value, p->membase + offset);
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal UARTs need to be initialized for the 8250 autoconfig to work
|
||||
* properly. Note that the TX watermark initialization may not be needed
|
||||
* once the 8250.c watermark handling code is merged.
|
||||
*/
|
||||
static void __init omap_serial_reset(struct plat_serial8250_port *p)
|
||||
{
|
||||
omap_serial_outp(p, UART_OMAP_MDR1, 0x07); /* disable UART */
|
||||
omap_serial_outp(p, UART_OMAP_SCR, 0x08); /* TX watermark */
|
||||
omap_serial_outp(p, UART_OMAP_MDR1, 0x00); /* enable UART */
|
||||
|
||||
if (!cpu_is_omap1510()) {
|
||||
omap_serial_outp(p, UART_OMAP_SYSC, 0x01);
|
||||
while (!(omap_serial_in(p, UART_OMAP_SYSC) & 0x01));
|
||||
}
|
||||
}
|
||||
|
||||
static struct plat_serial8250_port serial_platform_data[] = {
|
||||
{
|
||||
.membase = (char*)IO_ADDRESS(OMAP_UART1_BASE),
|
||||
.mapbase = (unsigned long)OMAP_UART1_BASE,
|
||||
.irq = INT_UART1,
|
||||
.flags = UPF_BOOT_AUTOCONF,
|
||||
.iotype = UPIO_MEM,
|
||||
.regshift = 2,
|
||||
.uartclk = OMAP16XX_BASE_BAUD * 16,
|
||||
},
|
||||
{
|
||||
.membase = (char*)IO_ADDRESS(OMAP_UART2_BASE),
|
||||
.mapbase = (unsigned long)OMAP_UART2_BASE,
|
||||
.irq = INT_UART2,
|
||||
.flags = UPF_BOOT_AUTOCONF,
|
||||
.iotype = UPIO_MEM,
|
||||
.regshift = 2,
|
||||
.uartclk = OMAP16XX_BASE_BAUD * 16,
|
||||
},
|
||||
{
|
||||
.membase = (char*)IO_ADDRESS(OMAP_UART3_BASE),
|
||||
.mapbase = (unsigned long)OMAP_UART3_BASE,
|
||||
.irq = INT_UART3,
|
||||
.flags = UPF_BOOT_AUTOCONF,
|
||||
.iotype = UPIO_MEM,
|
||||
.regshift = 2,
|
||||
.uartclk = OMAP16XX_BASE_BAUD * 16,
|
||||
},
|
||||
{ },
|
||||
};
|
||||
|
||||
static struct platform_device serial_device = {
|
||||
.name = "serial8250",
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.platform_data = serial_platform_data,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* Note that on Innovator-1510 UART2 pins conflict with USB2.
|
||||
* By default UART2 does not work on Innovator-1510 if you have
|
||||
* USB OHCI enabled. To use UART2, you must disable USB2 first.
|
||||
*/
|
||||
void __init omap_serial_init(int ports[OMAP_MAX_NR_PORTS])
|
||||
{
|
||||
int i;
|
||||
|
||||
if (cpu_is_omap730()) {
|
||||
serial_platform_data[0].regshift = 0;
|
||||
serial_platform_data[1].regshift = 0;
|
||||
serial_platform_data[0].irq = INT_730_UART_MODEM_1;
|
||||
serial_platform_data[1].irq = INT_730_UART_MODEM_IRDA_2;
|
||||
}
|
||||
|
||||
if (cpu_is_omap1510()) {
|
||||
serial_platform_data[0].uartclk = OMAP1510_BASE_BAUD * 16;
|
||||
serial_platform_data[1].uartclk = OMAP1510_BASE_BAUD * 16;
|
||||
serial_platform_data[2].uartclk = OMAP1510_BASE_BAUD * 16;
|
||||
}
|
||||
|
||||
for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
|
||||
unsigned char reg;
|
||||
|
||||
if (ports[i] == 0) {
|
||||
serial_platform_data[i].membase = 0;
|
||||
serial_platform_data[i].mapbase = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
if (cpu_is_omap1510()) {
|
||||
omap_cfg_reg(UART1_TX);
|
||||
omap_cfg_reg(UART1_RTS);
|
||||
if (machine_is_omap_innovator()) {
|
||||
reg = fpga_read(OMAP1510_FPGA_POWER);
|
||||
reg |= OMAP1510_FPGA_PCR_COM1_EN;
|
||||
fpga_write(reg, OMAP1510_FPGA_POWER);
|
||||
udelay(10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (cpu_is_omap1510()) {
|
||||
omap_cfg_reg(UART2_TX);
|
||||
omap_cfg_reg(UART2_RTS);
|
||||
if (machine_is_omap_innovator()) {
|
||||
reg = fpga_read(OMAP1510_FPGA_POWER);
|
||||
reg |= OMAP1510_FPGA_PCR_COM2_EN;
|
||||
fpga_write(reg, OMAP1510_FPGA_POWER);
|
||||
udelay(10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (cpu_is_omap1510()) {
|
||||
omap_cfg_reg(UART3_TX);
|
||||
omap_cfg_reg(UART3_RX);
|
||||
}
|
||||
if (cpu_is_omap1710()) {
|
||||
clk_enable(clk_get(0, "uart3_ck"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
omap_serial_reset(&serial_platform_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static int __init omap_init(void)
|
||||
{
|
||||
return platform_device_register(&serial_device);
|
||||
}
|
||||
arch_initcall(omap_init);
|
||||
|
||||
#define NO_LENGTH_CHECK 0xffffffff
|
||||
|
||||
extern int omap_bootloader_tag_len;
|
||||
extern u8 omap_bootloader_tag[];
|
||||
|
||||
struct omap_board_config_kernel *omap_board_config;
|
||||
int omap_board_config_size = 0;
|
||||
|
||||
static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out)
|
||||
{
|
||||
struct omap_board_config_kernel *kinfo = NULL;
|
||||
int i;
|
||||
|
||||
#ifdef CONFIG_OMAP_BOOT_TAG
|
||||
struct omap_board_config_entry *info = NULL;
|
||||
|
||||
if (omap_bootloader_tag_len > 4)
|
||||
info = (struct omap_board_config_entry *) omap_bootloader_tag;
|
||||
while (info != NULL) {
|
||||
u8 *next;
|
||||
|
||||
if (info->tag == tag) {
|
||||
if (skip == 0)
|
||||
break;
|
||||
skip--;
|
||||
}
|
||||
|
||||
if ((info->len & 0x03) != 0) {
|
||||
/* We bail out to avoid an alignment fault */
|
||||
printk(KERN_ERR "OMAP peripheral config: Length (%d) not word-aligned (tag %04x)\n",
|
||||
info->len, info->tag);
|
||||
return NULL;
|
||||
}
|
||||
next = (u8 *) info + sizeof(*info) + info->len;
|
||||
if (next >= omap_bootloader_tag + omap_bootloader_tag_len)
|
||||
info = NULL;
|
||||
else
|
||||
info = (struct omap_board_config_entry *) next;
|
||||
}
|
||||
if (info != NULL) {
|
||||
/* Check the length as a lame attempt to check for
|
||||
* binary inconsistancy. */
|
||||
if (len != NO_LENGTH_CHECK) {
|
||||
/* Word-align len */
|
||||
if (len & 0x03)
|
||||
len = (len + 3) & ~0x03;
|
||||
if (info->len != len) {
|
||||
printk(KERN_ERR "OMAP peripheral config: Length mismatch with tag %x (want %d, got %d)\n",
|
||||
tag, len, info->len);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (len_out != NULL)
|
||||
*len_out = info->len;
|
||||
return info->data;
|
||||
}
|
||||
#endif
|
||||
/* Try to find the config from the board-specific structures
|
||||
* in the kernel. */
|
||||
for (i = 0; i < omap_board_config_size; i++) {
|
||||
if (omap_board_config[i].tag == tag) {
|
||||
kinfo = &omap_board_config[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (kinfo == NULL)
|
||||
return NULL;
|
||||
return kinfo->data;
|
||||
}
|
||||
|
||||
const void *__omap_get_config(u16 tag, size_t len, int nr)
|
||||
{
|
||||
return get_config(tag, len, nr, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL(__omap_get_config);
|
||||
|
||||
const void *omap_get_var_config(u16 tag, size_t *len)
|
||||
{
|
||||
return get_config(tag, NO_LENGTH_CHECK, 0, len);
|
||||
}
|
||||
EXPORT_SYMBOL(omap_get_var_config);
|
||||
|
||||
static int __init omap_add_serial_console(void)
|
||||
{
|
||||
const struct omap_uart_config *info;
|
||||
|
||||
info = omap_get_config(OMAP_TAG_UART, struct omap_uart_config);
|
||||
if (info != NULL && info->console_uart) {
|
||||
static char speed[11], *opt = NULL;
|
||||
|
||||
if (info->console_speed) {
|
||||
snprintf(speed, sizeof(speed), "%u", info->console_speed);
|
||||
opt = speed;
|
||||
}
|
||||
return add_preferred_console("ttyS", info->console_uart - 1, opt);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
console_initcall(omap_add_serial_console);
|
144
arch/arm/mach-omap1/Kconfig
Normal file
144
arch/arm/mach-omap1/Kconfig
Normal file
@ -0,0 +1,144 @@
|
||||
comment "OMAP Core Type"
|
||||
depends on ARCH_OMAP1
|
||||
|
||||
config ARCH_OMAP730
|
||||
depends on ARCH_OMAP1
|
||||
bool "OMAP730 Based System"
|
||||
select ARCH_OMAP_OTG
|
||||
|
||||
config ARCH_OMAP1510
|
||||
depends on ARCH_OMAP1
|
||||
default y
|
||||
bool "OMAP1510 Based System"
|
||||
|
||||
config ARCH_OMAP16XX
|
||||
depends on ARCH_OMAP1
|
||||
bool "OMAP16xx Based System"
|
||||
select ARCH_OMAP_OTG
|
||||
|
||||
comment "OMAP Board Type"
|
||||
depends on ARCH_OMAP1
|
||||
|
||||
config MACH_OMAP_INNOVATOR
|
||||
bool "TI Innovator"
|
||||
depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX)
|
||||
help
|
||||
TI OMAP 1510 or 1610 Innovator board support. Say Y here if you
|
||||
have such a board.
|
||||
|
||||
config MACH_OMAP_H2
|
||||
bool "TI H2 Support"
|
||||
depends on ARCH_OMAP1 && ARCH_OMAP16XX
|
||||
help
|
||||
TI OMAP 1610/1611B H2 board support. Say Y here if you have such
|
||||
a board.
|
||||
|
||||
config MACH_OMAP_H3
|
||||
bool "TI H3 Support"
|
||||
depends on ARCH_OMAP1 && ARCH_OMAP16XX
|
||||
help
|
||||
TI OMAP 1710 H3 board support. Say Y here if you have such
|
||||
a board.
|
||||
|
||||
config MACH_OMAP_OSK
|
||||
bool "TI OSK Support"
|
||||
depends on ARCH_OMAP1 && ARCH_OMAP16XX
|
||||
help
|
||||
TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
|
||||
if you have such a board.
|
||||
|
||||
config MACH_OMAP_PERSEUS2
|
||||
bool "TI Perseus2"
|
||||
depends on ARCH_OMAP1 && ARCH_OMAP730
|
||||
help
|
||||
Support for TI OMAP 730 Perseus2 board. Say Y here if you have such
|
||||
a board.
|
||||
|
||||
config MACH_VOICEBLUE
|
||||
bool "Voiceblue"
|
||||
depends on ARCH_OMAP1 && ARCH_OMAP1510
|
||||
help
|
||||
Support for Voiceblue GSM/VoIP gateway. Say Y here if you have
|
||||
such a board.
|
||||
|
||||
config MACH_NETSTAR
|
||||
bool "NetStar"
|
||||
depends on ARCH_OMAP1 && ARCH_OMAP1510
|
||||
help
|
||||
Support for NetStar PBX. Say Y here if you have such a board.
|
||||
|
||||
config MACH_OMAP_GENERIC
|
||||
bool "Generic OMAP board"
|
||||
depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX)
|
||||
help
|
||||
Support for generic OMAP-1510, 1610 or 1710 board with
|
||||
no FPGA. Can be used as template for porting Linux to
|
||||
custom OMAP boards. Say Y here if you have a custom
|
||||
board.
|
||||
|
||||
comment "OMAP CPU Speed"
|
||||
depends on ARCH_OMAP1
|
||||
|
||||
config OMAP_CLOCKS_SET_BY_BOOTLOADER
|
||||
bool "OMAP clocks set by bootloader"
|
||||
depends on ARCH_OMAP1
|
||||
help
|
||||
Enable this option to prevent the kernel from overriding the clock
|
||||
frequencies programmed by bootloader for MPU, DSP, MMUs, TC,
|
||||
internal LCD controller and MPU peripherals.
|
||||
|
||||
config OMAP_ARM_216MHZ
|
||||
bool "OMAP ARM 216 MHz CPU (1710 only)"
|
||||
depends on ARCH_OMAP1 && ARCH_OMAP16XX
|
||||
help
|
||||
Enable 216 MHz clock for OMAP1710 CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_195MHZ
|
||||
bool "OMAP ARM 195 MHz CPU"
|
||||
depends on ARCH_OMAP1 && ARCH_OMAP730
|
||||
help
|
||||
Enable 195MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_192MHZ
|
||||
bool "OMAP ARM 192 MHz CPU"
|
||||
depends on ARCH_OMAP1 && ARCH_OMAP16XX
|
||||
help
|
||||
Enable 192MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_182MHZ
|
||||
bool "OMAP ARM 182 MHz CPU"
|
||||
depends on ARCH_OMAP1 && ARCH_OMAP730
|
||||
help
|
||||
Enable 182MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_168MHZ
|
||||
bool "OMAP ARM 168 MHz CPU"
|
||||
depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730)
|
||||
help
|
||||
Enable 168MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_150MHZ
|
||||
bool "OMAP ARM 150 MHz CPU"
|
||||
depends on ARCH_OMAP1 && ARCH_OMAP1510
|
||||
help
|
||||
Enable 150MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_120MHZ
|
||||
bool "OMAP ARM 120 MHz CPU"
|
||||
depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730)
|
||||
help
|
||||
Enable 120MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
||||
config OMAP_ARM_60MHZ
|
||||
bool "OMAP ARM 60 MHz CPU"
|
||||
depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730)
|
||||
default y
|
||||
help
|
||||
Enable 60MHz clock for OMAP CPU. If unsure, say Y.
|
||||
|
||||
config OMAP_ARM_30MHZ
|
||||
bool "OMAP ARM 30 MHz CPU"
|
||||
depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730)
|
||||
help
|
||||
Enable 30MHz clock for OMAP CPU. If unsure, say N.
|
||||
|
30
arch/arm/mach-omap1/Makefile
Normal file
30
arch/arm/mach-omap1/Makefile
Normal file
@ -0,0 +1,30 @@
|
||||
#
|
||||
# Makefile for the linux kernel.
|
||||
#
|
||||
|
||||
# Common support
|
||||
obj-y := io.o id.o irq.o time.o serial.o
|
||||
led-y := leds.o
|
||||
|
||||
# Specific board support
|
||||
obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o
|
||||
obj-$(CONFIG_MACH_OMAP_INNOVATOR) += board-innovator.o
|
||||
obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
|
||||
obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o
|
||||
obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o
|
||||
obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o
|
||||
obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o
|
||||
obj-$(CONFIG_MACH_NETSTAR) += board-netstar.o
|
||||
|
||||
ifeq ($(CONFIG_ARCH_OMAP1510),y)
|
||||
# Innovator-1510 FPGA
|
||||
obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o
|
||||
endif
|
||||
|
||||
# LEDs support
|
||||
led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
|
||||
led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o
|
||||
led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o
|
||||
led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o
|
||||
obj-$(CONFIG_LEDS) += $(led-y)
|
||||
|
@ -1,4 +1,3 @@
|
||||
zreladdr-y := 0x10008000
|
||||
params_phys-y := 0x10000100
|
||||
initrd_phys-y := 0x10800000
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/board-generic.c
|
||||
* linux/arch/arm/mach-omap1/board-generic.c
|
||||
*
|
||||
* Modified from board-innovator1510.c
|
||||
*
|
||||
@ -26,8 +26,7 @@
|
||||
#include <asm/arch/mux.h>
|
||||
#include <asm/arch/usb.h>
|
||||
#include <asm/arch/board.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <asm/arch/common.h>
|
||||
|
||||
static int __initdata generic_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
|
||||
|
||||
@ -84,7 +83,7 @@ static void __init omap_generic_init(void)
|
||||
|
||||
static void __init omap_generic_map_io(void)
|
||||
{
|
||||
omap_map_io();
|
||||
omap_map_common_io()
|
||||
}
|
||||
|
||||
MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/board-h2.c
|
||||
* linux/arch/arm/mach-omap1/board-h2.c
|
||||
*
|
||||
* Board specific inits for OMAP-1610 H2
|
||||
*
|
||||
@ -35,8 +35,7 @@
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <asm/arch/tc.h>
|
||||
#include <asm/arch/usb.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <asm/arch/common.h>
|
||||
|
||||
extern int omap_gpio_init(void);
|
||||
|
||||
@ -172,7 +171,7 @@ static void __init h2_init(void)
|
||||
|
||||
static void __init h2_map_io(void)
|
||||
{
|
||||
omap_map_io();
|
||||
omap_map_common_io();
|
||||
omap_serial_init(h2_serial_ports);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/board-h3.c
|
||||
* linux/arch/arm/mach-omap1/board-h3.c
|
||||
*
|
||||
* This file contains OMAP1710 H3 specific code.
|
||||
*
|
||||
@ -37,8 +37,7 @@
|
||||
#include <asm/arch/mux.h>
|
||||
#include <asm/arch/tc.h>
|
||||
#include <asm/arch/usb.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <asm/arch/common.h>
|
||||
|
||||
extern int omap_gpio_init(void);
|
||||
|
||||
@ -190,7 +189,7 @@ void h3_init_irq(void)
|
||||
|
||||
static void __init h3_map_io(void)
|
||||
{
|
||||
omap_map_io();
|
||||
omap_map_common_io();
|
||||
omap_serial_init(h3_serial_ports);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/board-innovator.c
|
||||
* linux/arch/arm/mach-omap1/board-innovator.c
|
||||
*
|
||||
* Board specific inits for OMAP-1510 and OMAP-1610 Innovator
|
||||
*
|
||||
@ -33,8 +33,7 @@
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <asm/arch/tc.h>
|
||||
#include <asm/arch/usb.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <asm/arch/common.h>
|
||||
|
||||
static int __initdata innovator_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
|
||||
|
||||
@ -252,7 +251,7 @@ static void __init innovator_init(void)
|
||||
|
||||
static void __init innovator_map_io(void)
|
||||
{
|
||||
omap_map_io();
|
||||
omap_map_common_io();
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP1510
|
||||
if (cpu_is_omap1510()) {
|
@ -26,8 +26,7 @@
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <asm/arch/mux.h>
|
||||
#include <asm/arch/usb.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <asm/arch/common.h>
|
||||
|
||||
extern void __init omap_init_time(void);
|
||||
extern int omap_gpio_init(void);
|
||||
@ -100,7 +99,7 @@ static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
|
||||
|
||||
static void __init netstar_map_io(void)
|
||||
{
|
||||
omap_map_io();
|
||||
omap_map_common_io();
|
||||
omap_serial_init(omap_serial_ports);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/board-osk.c
|
||||
* linux/arch/arm/mach-omap1/board-osk.c
|
||||
*
|
||||
* Board specific init for OMAP5912 OSK
|
||||
*
|
||||
@ -39,8 +39,7 @@
|
||||
#include <asm/arch/usb.h>
|
||||
#include <asm/arch/mux.h>
|
||||
#include <asm/arch/tc.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <asm/arch/common.h>
|
||||
|
||||
static struct map_desc osk5912_io_desc[] __initdata = {
|
||||
{ OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE,
|
||||
@ -153,7 +152,7 @@ static void __init osk_init(void)
|
||||
|
||||
static void __init osk_map_io(void)
|
||||
{
|
||||
omap_map_io();
|
||||
omap_map_common_io();
|
||||
iotable_init(osk5912_io_desc, ARRAY_SIZE(osk5912_io_desc));
|
||||
omap_serial_init(osk_serial_ports);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/board-perseus2.c
|
||||
* linux/arch/arm/mach-omap1/board-perseus2.c
|
||||
*
|
||||
* Modified from board-generic.c
|
||||
*
|
||||
@ -27,8 +27,7 @@
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <asm/arch/mux.h>
|
||||
#include <asm/arch/fpga.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <asm/arch/common.h>
|
||||
|
||||
static struct resource smc91x_resources[] = {
|
||||
[0] = {
|
||||
@ -140,7 +139,7 @@ static struct map_desc omap_perseus2_io_desc[] __initdata = {
|
||||
|
||||
static void __init omap_perseus2_map_io(void)
|
||||
{
|
||||
omap_map_io();
|
||||
omap_map_common_io();
|
||||
iotable_init(omap_perseus2_io_desc,
|
||||
ARRAY_SIZE(omap_perseus2_io_desc));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/board-voiceblue.c
|
||||
* linux/arch/arm/mach-omap1/board-voiceblue.c
|
||||
*
|
||||
* Modified from board-generic.c
|
||||
*
|
||||
@ -31,8 +31,7 @@
|
||||
#include <asm/arch/tc.h>
|
||||
#include <asm/arch/mux.h>
|
||||
#include <asm/arch/usb.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <asm/arch/common.h>
|
||||
|
||||
extern void omap_init_time(void);
|
||||
extern int omap_gpio_init(void);
|
||||
@ -170,7 +169,7 @@ static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
|
||||
|
||||
static void __init voiceblue_map_io(void)
|
||||
{
|
||||
omap_map_io();
|
||||
omap_map_common_io();
|
||||
omap_serial_init(omap_serial_ports);
|
||||
}
|
||||
|
188
arch/arm/mach-omap1/id.c
Normal file
188
arch/arm/mach-omap1/id.c
Normal file
@ -0,0 +1,188 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap1/id.c
|
||||
*
|
||||
* OMAP1 CPU identification code
|
||||
*
|
||||
* Copyright (C) 2004 Nokia Corporation
|
||||
* Written by Tony Lindgren <tony@atomide.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
|
||||
struct omap_id {
|
||||
u16 jtag_id; /* Used to determine OMAP type */
|
||||
u8 die_rev; /* Processor revision */
|
||||
u32 omap_id; /* OMAP revision */
|
||||
u32 type; /* Cpu id bits [31:08], cpu class bits [07:00] */
|
||||
};
|
||||
|
||||
/* Register values to detect the OMAP version */
|
||||
static struct omap_id omap_ids[] __initdata = {
|
||||
{ .jtag_id = 0x355f, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x07300100},
|
||||
{ .jtag_id = 0xb55f, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x07300300},
|
||||
{ .jtag_id = 0xb470, .die_rev = 0x0, .omap_id = 0x03310100, .type = 0x15100000},
|
||||
{ .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x16100000},
|
||||
{ .jtag_id = 0xb576, .die_rev = 0x2, .omap_id = 0x03320100, .type = 0x16110000},
|
||||
{ .jtag_id = 0xb576, .die_rev = 0x3, .omap_id = 0x03320100, .type = 0x16100c00},
|
||||
{ .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x03320200, .type = 0x16100d00},
|
||||
{ .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 0x1610ef00},
|
||||
{ .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 0x1610ef00},
|
||||
{ .jtag_id = 0xb576, .die_rev = 0x1, .omap_id = 0x03320100, .type = 0x16110000},
|
||||
{ .jtag_id = 0xb58c, .die_rev = 0x2, .omap_id = 0x03320200, .type = 0x16110b00},
|
||||
{ .jtag_id = 0xb58c, .die_rev = 0x3, .omap_id = 0x03320200, .type = 0x16110c00},
|
||||
{ .jtag_id = 0xb65f, .die_rev = 0x0, .omap_id = 0x03320400, .type = 0x16212300},
|
||||
{ .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320400, .type = 0x16212300},
|
||||
{ .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320500, .type = 0x16212300},
|
||||
{ .jtag_id = 0xb5f7, .die_rev = 0x0, .omap_id = 0x03330000, .type = 0x17100000},
|
||||
{ .jtag_id = 0xb5f7, .die_rev = 0x1, .omap_id = 0x03330100, .type = 0x17100000},
|
||||
{ .jtag_id = 0xb5f7, .die_rev = 0x2, .omap_id = 0x03330100, .type = 0x17100000},
|
||||
};
|
||||
|
||||
/*
|
||||
* Get OMAP type from PROD_ID.
|
||||
* 1710 has the PROD_ID in bits 15:00, not in 16:01 as documented in TRM.
|
||||
* 1510 PROD_ID is empty, and 1610 PROD_ID does not make sense.
|
||||
* Undocumented register in TEST BLOCK is used as fallback; This seems to
|
||||
* work on 1510, 1610 & 1710. The official way hopefully will work in future
|
||||
* processors.
|
||||
*/
|
||||
static u16 __init omap_get_jtag_id(void)
|
||||
{
|
||||
u32 prod_id, omap_id;
|
||||
|
||||
prod_id = omap_readl(OMAP_PRODUCTION_ID_1);
|
||||
omap_id = omap_readl(OMAP32_ID_1);
|
||||
|
||||
/* Check for unusable OMAP_PRODUCTION_ID_1 on 1611B/5912 and 730 */
|
||||
if (((prod_id >> 20) == 0) || (prod_id == omap_id))
|
||||
prod_id = 0;
|
||||
else
|
||||
prod_id &= 0xffff;
|
||||
|
||||
if (prod_id)
|
||||
return prod_id;
|
||||
|
||||
/* Use OMAP32_ID_1 as fallback */
|
||||
prod_id = ((omap_id >> 12) & 0xffff);
|
||||
|
||||
return prod_id;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get OMAP revision from DIE_REV.
|
||||
* Early 1710 processors may have broken OMAP_DIE_ID, it contains PROD_ID.
|
||||
* Undocumented register in the TEST BLOCK is used as fallback.
|
||||
* REVISIT: This does not seem to work on 1510
|
||||
*/
|
||||
static u8 __init omap_get_die_rev(void)
|
||||
{
|
||||
u32 die_rev;
|
||||
|
||||
die_rev = omap_readl(OMAP_DIE_ID_1);
|
||||
|
||||
/* Check for broken OMAP_DIE_ID on early 1710 */
|
||||
if (((die_rev >> 12) & 0xffff) == omap_get_jtag_id())
|
||||
die_rev = 0;
|
||||
|
||||
die_rev = (die_rev >> 17) & 0xf;
|
||||
if (die_rev)
|
||||
return die_rev;
|
||||
|
||||
die_rev = (omap_readl(OMAP32_ID_1) >> 28) & 0xf;
|
||||
|
||||
return die_rev;
|
||||
}
|
||||
|
||||
void __init omap_check_revision(void)
|
||||
{
|
||||
int i;
|
||||
u16 jtag_id;
|
||||
u8 die_rev;
|
||||
u32 omap_id;
|
||||
u8 cpu_type;
|
||||
|
||||
jtag_id = omap_get_jtag_id();
|
||||
die_rev = omap_get_die_rev();
|
||||
omap_id = omap_readl(OMAP32_ID_0);
|
||||
|
||||
#ifdef DEBUG
|
||||
printk("OMAP_DIE_ID_0: 0x%08x\n", omap_readl(OMAP_DIE_ID_0));
|
||||
printk("OMAP_DIE_ID_1: 0x%08x DIE_REV: %i\n",
|
||||
omap_readl(OMAP_DIE_ID_1),
|
||||
(omap_readl(OMAP_DIE_ID_1) >> 17) & 0xf);
|
||||
printk("OMAP_PRODUCTION_ID_0: 0x%08x\n", omap_readl(OMAP_PRODUCTION_ID_0));
|
||||
printk("OMAP_PRODUCTION_ID_1: 0x%08x JTAG_ID: 0x%04x\n",
|
||||
omap_readl(OMAP_PRODUCTION_ID_1),
|
||||
omap_readl(OMAP_PRODUCTION_ID_1) & 0xffff);
|
||||
printk("OMAP32_ID_0: 0x%08x\n", omap_readl(OMAP32_ID_0));
|
||||
printk("OMAP32_ID_1: 0x%08x\n", omap_readl(OMAP32_ID_1));
|
||||
printk("JTAG_ID: 0x%04x DIE_REV: %i\n", jtag_id, die_rev);
|
||||
#endif
|
||||
|
||||
system_serial_high = omap_readl(OMAP_DIE_ID_0);
|
||||
system_serial_low = omap_readl(OMAP_DIE_ID_1);
|
||||
|
||||
/* First check only the major version in a safe way */
|
||||
for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
|
||||
if (jtag_id == (omap_ids[i].jtag_id)) {
|
||||
system_rev = omap_ids[i].type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if we can find the die revision */
|
||||
for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
|
||||
if (jtag_id == omap_ids[i].jtag_id && die_rev == omap_ids[i].die_rev) {
|
||||
system_rev = omap_ids[i].type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally check also the omap_id */
|
||||
for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
|
||||
if (jtag_id == omap_ids[i].jtag_id
|
||||
&& die_rev == omap_ids[i].die_rev
|
||||
&& omap_id == omap_ids[i].omap_id) {
|
||||
system_rev = omap_ids[i].type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add the cpu class info (7xx, 15xx, 16xx, 24xx) */
|
||||
cpu_type = system_rev >> 24;
|
||||
|
||||
switch (cpu_type) {
|
||||
case 0x07:
|
||||
system_rev |= 0x07;
|
||||
break;
|
||||
case 0x15:
|
||||
system_rev |= 0x15;
|
||||
break;
|
||||
case 0x16:
|
||||
case 0x17:
|
||||
system_rev |= 0x16;
|
||||
break;
|
||||
case 0x24:
|
||||
system_rev |= 0x24;
|
||||
break;
|
||||
default:
|
||||
printk("Unknown OMAP cpu type: 0x%02x\n", cpu_type);
|
||||
}
|
||||
|
||||
printk("OMAP%04x", system_rev >> 16);
|
||||
if ((system_rev >> 8) & 0xff)
|
||||
printk("%x", (system_rev >> 8) & 0xff);
|
||||
printk(" revision %i handled as %02xxx id: %08x%08x\n",
|
||||
die_rev, system_rev & 0xff, system_serial_low,
|
||||
system_serial_high);
|
||||
}
|
||||
|
115
arch/arm/mach-omap1/io.c
Normal file
115
arch/arm/mach-omap1/io.c
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap1/io.c
|
||||
*
|
||||
* OMAP1 I/O mapping code
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#include <asm/mach/map.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/tc.h>
|
||||
|
||||
extern int clk_init(void);
|
||||
extern void omap_check_revision(void);
|
||||
|
||||
/*
|
||||
* The machine specific code may provide the extra mapping besides the
|
||||
* default mapping provided here.
|
||||
*/
|
||||
static struct map_desc omap_io_desc[] __initdata = {
|
||||
{ IO_VIRT, IO_PHYS, IO_SIZE, MT_DEVICE },
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP730
|
||||
static struct map_desc omap730_io_desc[] __initdata = {
|
||||
{ OMAP730_DSP_BASE, OMAP730_DSP_START, OMAP730_DSP_SIZE, MT_DEVICE },
|
||||
{ OMAP730_DSPREG_BASE, OMAP730_DSPREG_START, OMAP730_DSPREG_SIZE, MT_DEVICE },
|
||||
{ OMAP730_SRAM_BASE, OMAP730_SRAM_START, OMAP730_SRAM_SIZE, MT_DEVICE }
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP1510
|
||||
static struct map_desc omap1510_io_desc[] __initdata = {
|
||||
{ OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE },
|
||||
{ OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE },
|
||||
{ OMAP1510_SRAM_BASE, OMAP1510_SRAM_START, OMAP1510_SRAM_SIZE, MT_DEVICE }
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_OMAP16XX)
|
||||
static struct map_desc omap1610_io_desc[] __initdata = {
|
||||
{ OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
|
||||
{ OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
|
||||
{ OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP1610_SRAM_SIZE, MT_DEVICE }
|
||||
};
|
||||
|
||||
static struct map_desc omap5912_io_desc[] __initdata = {
|
||||
{ OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
|
||||
{ OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
|
||||
/*
|
||||
* The OMAP5912 has 250kByte internal SRAM. Because the mapping is baseed on page
|
||||
* size (4kByte), it seems that the last 2kByte (=0x800) of the 250kByte are not mapped.
|
||||
* Add additional 2kByte (0x800) so that the last page is mapped and the last 2kByte
|
||||
* can be used.
|
||||
*/
|
||||
{ OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP5912_SRAM_SIZE + 0x800, MT_DEVICE }
|
||||
};
|
||||
#endif
|
||||
|
||||
static int initialized = 0;
|
||||
|
||||
static void __init _omap_map_io(void)
|
||||
{
|
||||
initialized = 1;
|
||||
|
||||
/* We have to initialize the IO space mapping before we can run
|
||||
* cpu_is_omapxxx() macros. */
|
||||
iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
|
||||
omap_check_revision();
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP730
|
||||
if (cpu_is_omap730()) {
|
||||
iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_ARCH_OMAP1510
|
||||
if (cpu_is_omap1510()) {
|
||||
iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_ARCH_OMAP16XX)
|
||||
if (cpu_is_omap1610() || cpu_is_omap1710()) {
|
||||
iotable_init(omap1610_io_desc, ARRAY_SIZE(omap1610_io_desc));
|
||||
}
|
||||
if (cpu_is_omap5912()) {
|
||||
iotable_init(omap5912_io_desc, ARRAY_SIZE(omap5912_io_desc));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
|
||||
* on a Posted Write in the TIPB Bridge".
|
||||
*/
|
||||
omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
|
||||
omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
|
||||
|
||||
/* Must init clocks early to assure that timer interrupt works
|
||||
*/
|
||||
clk_init();
|
||||
}
|
||||
|
||||
/*
|
||||
* This should only get called from board specific init
|
||||
*/
|
||||
void omap_map_common_io(void)
|
||||
{
|
||||
if (!initialized)
|
||||
_omap_map_io();
|
||||
}
|
@ -56,6 +56,7 @@
|
||||
struct omap_irq_bank {
|
||||
unsigned long base_reg;
|
||||
unsigned long trigger_map;
|
||||
unsigned long wake_enable;
|
||||
};
|
||||
|
||||
static unsigned int irq_bank_count = 0;
|
||||
@ -105,6 +106,19 @@ static void omap_mask_ack_irq(unsigned int irq)
|
||||
omap_ack_irq(irq);
|
||||
}
|
||||
|
||||
static int omap_wake_irq(unsigned int irq, unsigned int enable)
|
||||
{
|
||||
int bank = IRQ_BANK(irq);
|
||||
|
||||
if (enable)
|
||||
irq_banks[bank].wake_enable |= IRQ_BIT(irq);
|
||||
else
|
||||
irq_banks[bank].wake_enable &= ~IRQ_BIT(irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Allows tuning the IRQ type and priority
|
||||
*
|
||||
@ -145,7 +159,7 @@ static struct omap_irq_bank omap1510_irq_banks[] = {
|
||||
static struct omap_irq_bank omap1610_irq_banks[] = {
|
||||
{ .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3fefe8f },
|
||||
{ .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb7c1fd },
|
||||
{ .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0xfffff7ff },
|
||||
{ .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0xffffb7ff },
|
||||
{ .base_reg = OMAP_IH2_BASE + 0x200, .trigger_map = 0xffffffff },
|
||||
};
|
||||
#endif
|
||||
@ -154,6 +168,7 @@ static struct irqchip omap_irq_chip = {
|
||||
.ack = omap_mask_ack_irq,
|
||||
.mask = omap_mask_irq,
|
||||
.unmask = omap_unmask_irq,
|
||||
.wake = omap_wake_irq,
|
||||
};
|
||||
|
||||
void __init omap_init_irq(void)
|
@ -129,14 +129,11 @@ void osk_leds_event(led_event_t evt)
|
||||
|
||||
#ifdef CONFIG_FB_OMAP
|
||||
|
||||
#ifdef CONFIG_LEDS_TIMER
|
||||
case led_timer:
|
||||
hw_led_state ^= TIMER_LED;
|
||||
mistral_setled();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LEDS_CPU
|
||||
case led_idle_start:
|
||||
hw_led_state |= IDLE_LED;
|
||||
mistral_setled();
|
||||
@ -146,7 +143,6 @@ void osk_leds_event(led_event_t evt)
|
||||
hw_led_state &= ~IDLE_LED;
|
||||
mistral_setled();
|
||||
break;
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_FB_OMAP */
|
||||
|
200
arch/arm/mach-omap1/serial.c
Normal file
200
arch/arm/mach-omap1/serial.c
Normal file
@ -0,0 +1,200 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap1/id.c
|
||||
*
|
||||
* OMAP1 CPU identification code
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/serial.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/serial_8250.h>
|
||||
#include <linux/serial_reg.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/hardware/clock.h>
|
||||
|
||||
#include <asm/arch/board.h>
|
||||
#include <asm/arch/mux.h>
|
||||
#include <asm/arch/fpga.h>
|
||||
|
||||
static struct clk * uart1_ck = NULL;
|
||||
static struct clk * uart2_ck = NULL;
|
||||
static struct clk * uart3_ck = NULL;
|
||||
|
||||
static inline unsigned int omap_serial_in(struct plat_serial8250_port *up,
|
||||
int offset)
|
||||
{
|
||||
offset <<= up->regshift;
|
||||
return (unsigned int)__raw_readb(up->membase + offset);
|
||||
}
|
||||
|
||||
static inline void omap_serial_outp(struct plat_serial8250_port *p, int offset,
|
||||
int value)
|
||||
{
|
||||
offset <<= p->regshift;
|
||||
__raw_writeb(value, p->membase + offset);
|
||||
}
|
||||
|
||||
/*
|
||||
* Internal UARTs need to be initialized for the 8250 autoconfig to work
|
||||
* properly. Note that the TX watermark initialization may not be needed
|
||||
* once the 8250.c watermark handling code is merged.
|
||||
*/
|
||||
static void __init omap_serial_reset(struct plat_serial8250_port *p)
|
||||
{
|
||||
omap_serial_outp(p, UART_OMAP_MDR1, 0x07); /* disable UART */
|
||||
omap_serial_outp(p, UART_OMAP_SCR, 0x08); /* TX watermark */
|
||||
omap_serial_outp(p, UART_OMAP_MDR1, 0x00); /* enable UART */
|
||||
|
||||
if (!cpu_is_omap1510()) {
|
||||
omap_serial_outp(p, UART_OMAP_SYSC, 0x01);
|
||||
while (!(omap_serial_in(p, UART_OMAP_SYSC) & 0x01));
|
||||
}
|
||||
}
|
||||
|
||||
static struct plat_serial8250_port serial_platform_data[] = {
|
||||
{
|
||||
.membase = (char*)IO_ADDRESS(OMAP_UART1_BASE),
|
||||
.mapbase = (unsigned long)OMAP_UART1_BASE,
|
||||
.irq = INT_UART1,
|
||||
.flags = UPF_BOOT_AUTOCONF,
|
||||
.iotype = UPIO_MEM,
|
||||
.regshift = 2,
|
||||
.uartclk = OMAP16XX_BASE_BAUD * 16,
|
||||
},
|
||||
{
|
||||
.membase = (char*)IO_ADDRESS(OMAP_UART2_BASE),
|
||||
.mapbase = (unsigned long)OMAP_UART2_BASE,
|
||||
.irq = INT_UART2,
|
||||
.flags = UPF_BOOT_AUTOCONF,
|
||||
.iotype = UPIO_MEM,
|
||||
.regshift = 2,
|
||||
.uartclk = OMAP16XX_BASE_BAUD * 16,
|
||||
},
|
||||
{
|
||||
.membase = (char*)IO_ADDRESS(OMAP_UART3_BASE),
|
||||
.mapbase = (unsigned long)OMAP_UART3_BASE,
|
||||
.irq = INT_UART3,
|
||||
.flags = UPF_BOOT_AUTOCONF,
|
||||
.iotype = UPIO_MEM,
|
||||
.regshift = 2,
|
||||
.uartclk = OMAP16XX_BASE_BAUD * 16,
|
||||
},
|
||||
{ },
|
||||
};
|
||||
|
||||
static struct platform_device serial_device = {
|
||||
.name = "serial8250",
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.platform_data = serial_platform_data,
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
* Note that on Innovator-1510 UART2 pins conflict with USB2.
|
||||
* By default UART2 does not work on Innovator-1510 if you have
|
||||
* USB OHCI enabled. To use UART2, you must disable USB2 first.
|
||||
*/
|
||||
void __init omap_serial_init(int ports[OMAP_MAX_NR_PORTS])
|
||||
{
|
||||
int i;
|
||||
|
||||
if (cpu_is_omap730()) {
|
||||
serial_platform_data[0].regshift = 0;
|
||||
serial_platform_data[1].regshift = 0;
|
||||
serial_platform_data[0].irq = INT_730_UART_MODEM_1;
|
||||
serial_platform_data[1].irq = INT_730_UART_MODEM_IRDA_2;
|
||||
}
|
||||
|
||||
if (cpu_is_omap1510()) {
|
||||
serial_platform_data[0].uartclk = OMAP1510_BASE_BAUD * 16;
|
||||
serial_platform_data[1].uartclk = OMAP1510_BASE_BAUD * 16;
|
||||
serial_platform_data[2].uartclk = OMAP1510_BASE_BAUD * 16;
|
||||
}
|
||||
|
||||
for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
|
||||
unsigned char reg;
|
||||
|
||||
if (ports[i] == 0) {
|
||||
serial_platform_data[i].membase = NULL;
|
||||
serial_platform_data[i].mapbase = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
uart1_ck = clk_get(NULL, "uart1_ck");
|
||||
if (IS_ERR(uart1_ck))
|
||||
printk("Could not get uart1_ck\n");
|
||||
else {
|
||||
clk_use(uart1_ck);
|
||||
if (cpu_is_omap1510())
|
||||
clk_set_rate(uart1_ck, 12000000);
|
||||
}
|
||||
if (cpu_is_omap1510()) {
|
||||
omap_cfg_reg(UART1_TX);
|
||||
omap_cfg_reg(UART1_RTS);
|
||||
if (machine_is_omap_innovator()) {
|
||||
reg = fpga_read(OMAP1510_FPGA_POWER);
|
||||
reg |= OMAP1510_FPGA_PCR_COM1_EN;
|
||||
fpga_write(reg, OMAP1510_FPGA_POWER);
|
||||
udelay(10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
uart2_ck = clk_get(NULL, "uart2_ck");
|
||||
if (IS_ERR(uart2_ck))
|
||||
printk("Could not get uart2_ck\n");
|
||||
else {
|
||||
clk_use(uart2_ck);
|
||||
if (cpu_is_omap1510())
|
||||
clk_set_rate(uart2_ck, 12000000);
|
||||
else
|
||||
clk_set_rate(uart2_ck, 48000000);
|
||||
}
|
||||
if (cpu_is_omap1510()) {
|
||||
omap_cfg_reg(UART2_TX);
|
||||
omap_cfg_reg(UART2_RTS);
|
||||
if (machine_is_omap_innovator()) {
|
||||
reg = fpga_read(OMAP1510_FPGA_POWER);
|
||||
reg |= OMAP1510_FPGA_PCR_COM2_EN;
|
||||
fpga_write(reg, OMAP1510_FPGA_POWER);
|
||||
udelay(10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
uart3_ck = clk_get(NULL, "uart3_ck");
|
||||
if (IS_ERR(uart3_ck))
|
||||
printk("Could not get uart3_ck\n");
|
||||
else {
|
||||
clk_use(uart3_ck);
|
||||
if (cpu_is_omap1510())
|
||||
clk_set_rate(uart3_ck, 12000000);
|
||||
}
|
||||
if (cpu_is_omap1510()) {
|
||||
omap_cfg_reg(UART3_TX);
|
||||
omap_cfg_reg(UART3_RX);
|
||||
}
|
||||
break;
|
||||
}
|
||||
omap_serial_reset(&serial_platform_data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static int __init omap_init(void)
|
||||
{
|
||||
return platform_device_register(&serial_device);
|
||||
}
|
||||
arch_initcall(omap_init);
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/time.c
|
||||
* linux/arch/arm/mach-omap1/time.c
|
||||
*
|
||||
* OMAP Timers
|
||||
*
|
||||
@ -58,17 +58,9 @@ struct sys_timer omap_timer;
|
||||
* MPU timer
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#define OMAP_MPU_TIMER1_BASE (0xfffec500)
|
||||
#define OMAP_MPU_TIMER2_BASE (0xfffec600)
|
||||
#define OMAP_MPU_TIMER3_BASE (0xfffec700)
|
||||
#define OMAP_MPU_TIMER_BASE OMAP_MPU_TIMER1_BASE
|
||||
#define OMAP_MPU_TIMER_OFFSET 0x100
|
||||
|
||||
#define MPU_TIMER_FREE (1 << 6)
|
||||
#define MPU_TIMER_CLOCK_ENABLE (1 << 5)
|
||||
#define MPU_TIMER_AR (1 << 1)
|
||||
#define MPU_TIMER_ST (1 << 0)
|
||||
|
||||
/* cycles to nsec conversions taken from arch/i386/kernel/timers/timer_tsc.c,
|
||||
* converted to use kHz by Kevin Hilman */
|
||||
/* convert from cycles(64bits) => nanoseconds (64bits)
|
||||
@ -255,6 +247,13 @@ unsigned long long sched_clock(void)
|
||||
#define OMAP_32K_TIMER_TCR 0x04
|
||||
|
||||
#define OMAP_32K_TICKS_PER_HZ (32768 / HZ)
|
||||
#if (32768 % HZ) != 0
|
||||
/* We cannot ignore modulo.
|
||||
* Potential error can be as high as several percent.
|
||||
*/
|
||||
#define OMAP_32K_TICK_MODULO (32768 % HZ)
|
||||
static unsigned modulo_count = 0; /* Counts 1/HZ units */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1
|
||||
@ -331,6 +330,19 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id,
|
||||
now = omap_32k_sync_timer_read();
|
||||
|
||||
while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) {
|
||||
#ifdef OMAP_32K_TICK_MODULO
|
||||
/* Modulo addition may put omap_32k_last_tick ahead of now
|
||||
* and cause unwanted repetition of the while loop.
|
||||
*/
|
||||
if (unlikely(now - omap_32k_last_tick == ~0))
|
||||
break;
|
||||
|
||||
modulo_count += OMAP_32K_TICK_MODULO;
|
||||
if (modulo_count > HZ) {
|
||||
++omap_32k_last_tick;
|
||||
modulo_count -= HZ;
|
||||
}
|
||||
#endif
|
||||
omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ;
|
||||
timer_tick(regs);
|
||||
}
|
||||
@ -407,7 +419,7 @@ static __init void omap_init_32k_timer(void)
|
||||
* Timer initialization
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
void __init omap_timer_init(void)
|
||||
static void __init omap_timer_init(void)
|
||||
{
|
||||
#if defined(CONFIG_OMAP_MPU_TIMER)
|
||||
omap_init_mpu_timer();
|
@ -101,7 +101,7 @@ config CPU_ARM922T
|
||||
|
||||
# ARM925T
|
||||
config CPU_ARM925T
|
||||
bool "Support ARM925T processor" if ARCH_OMAP
|
||||
bool "Support ARM925T processor" if ARCH_OMAP1
|
||||
depends on ARCH_OMAP1510
|
||||
default y if ARCH_OMAP1510
|
||||
select CPU_32v4
|
||||
|
@ -399,7 +399,7 @@ static void __init build_mem_type_table(void)
|
||||
ecc_mask = 0;
|
||||
}
|
||||
|
||||
if (cpu_arch <= CPU_ARCH_ARMv5) {
|
||||
if (cpu_arch <= CPU_ARCH_ARMv5TEJ) {
|
||||
for (i = 0; i < ARRAY_SIZE(mem_types); i++) {
|
||||
if (mem_types[i].prot_l1)
|
||||
mem_types[i].prot_l1 |= PMD_BIT4;
|
||||
@ -584,7 +584,7 @@ void setup_mm_for_reboot(char mode)
|
||||
pmdval = (i << PGDIR_SHIFT) |
|
||||
PMD_SECT_AP_WRITE | PMD_SECT_AP_READ |
|
||||
PMD_TYPE_SECT;
|
||||
if (cpu_arch <= CPU_ARCH_ARMv5)
|
||||
if (cpu_arch <= CPU_ARCH_ARMv5TEJ)
|
||||
pmdval |= PMD_BIT4;
|
||||
pmd = pmd_off(pgd, i << PGDIR_SHIFT);
|
||||
pmd[0] = __pmd(pmdval);
|
||||
|
112
arch/arm/plat-omap/Kconfig
Normal file
112
arch/arm/plat-omap/Kconfig
Normal file
@ -0,0 +1,112 @@
|
||||
if ARCH_OMAP
|
||||
|
||||
menu "TI OMAP Implementations"
|
||||
|
||||
config ARCH_OMAP_OTG
|
||||
bool
|
||||
|
||||
choice
|
||||
prompt "OMAP System Type"
|
||||
default ARCH_OMAP1
|
||||
|
||||
config ARCH_OMAP1
|
||||
bool "TI OMAP1"
|
||||
|
||||
config ARCH_OMAP2
|
||||
bool "TI OMAP2"
|
||||
|
||||
endchoice
|
||||
|
||||
comment "OMAP Feature Selections"
|
||||
|
||||
config OMAP_RESET_CLOCKS
|
||||
bool "Reset unused clocks during boot"
|
||||
depends on ARCH_OMAP
|
||||
default n
|
||||
help
|
||||
Say Y if you want to reset unused clocks during boot.
|
||||
This option saves power, but assumes all drivers are
|
||||
using the clock framework. Broken drivers that do not
|
||||
yet use clock framework may not work with this option.
|
||||
If you are booting from another operating system, you
|
||||
probably do not want this option enabled until your
|
||||
device drivers work properly.
|
||||
|
||||
config OMAP_MUX
|
||||
bool "OMAP multiplexing support"
|
||||
depends on ARCH_OMAP
|
||||
default y
|
||||
help
|
||||
Pin multiplexing support for OMAP boards. If your bootloader
|
||||
sets the multiplexing correctly, say N. Otherwise, or if unsure,
|
||||
say Y.
|
||||
|
||||
config OMAP_MUX_DEBUG
|
||||
bool "Multiplexing debug output"
|
||||
depends on OMAP_MUX
|
||||
default n
|
||||
help
|
||||
Makes the multiplexing functions print out a lot of debug info.
|
||||
This is useful if you want to find out the correct values of the
|
||||
multiplexing registers.
|
||||
|
||||
config OMAP_MUX_WARNINGS
|
||||
bool "Warn about pins the bootloader didn't set up"
|
||||
depends on OMAP_MUX
|
||||
default y
|
||||
help
|
||||
Choose Y here to warn whenever driver initialization logic needs
|
||||
to change the pin multiplexing setup. When there are no warnings
|
||||
printed, it's safe to deselect OMAP_MUX for your product.
|
||||
|
||||
choice
|
||||
prompt "System timer"
|
||||
default OMAP_MPU_TIMER
|
||||
|
||||
config OMAP_MPU_TIMER
|
||||
bool "Use mpu timer"
|
||||
help
|
||||
Select this option if you want to use the OMAP mpu timer. This
|
||||
timer provides more intra-tick resolution than the 32KHz timer,
|
||||
but consumes more power.
|
||||
|
||||
config OMAP_32K_TIMER
|
||||
bool "Use 32KHz timer"
|
||||
depends on ARCH_OMAP16XX
|
||||
help
|
||||
Select this option if you want to enable the OMAP 32KHz timer.
|
||||
This timer saves power compared to the OMAP_MPU_TIMER, and has
|
||||
support for no tick during idle. The 32KHz timer provides less
|
||||
intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is
|
||||
currently only available for OMAP-16xx.
|
||||
|
||||
endchoice
|
||||
|
||||
config OMAP_32K_TIMER_HZ
|
||||
int "Kernel internal timer frequency for 32KHz timer"
|
||||
range 32 1024
|
||||
depends on OMAP_32K_TIMER
|
||||
default "128"
|
||||
help
|
||||
Kernel internal timer frequency should be a divisor of 32768,
|
||||
such as 64 or 128.
|
||||
|
||||
choice
|
||||
prompt "Low-level debug console UART"
|
||||
depends on ARCH_OMAP
|
||||
default OMAP_LL_DEBUG_UART1
|
||||
|
||||
config OMAP_LL_DEBUG_UART1
|
||||
bool "UART1"
|
||||
|
||||
config OMAP_LL_DEBUG_UART2
|
||||
bool "UART2"
|
||||
|
||||
config OMAP_LL_DEBUG_UART3
|
||||
bool "UART3"
|
||||
|
||||
endchoice
|
||||
|
||||
endmenu
|
||||
|
||||
endif
|
17
arch/arm/plat-omap/Makefile
Normal file
17
arch/arm/plat-omap/Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
#
|
||||
# Makefile for the linux kernel.
|
||||
#
|
||||
|
||||
# Common support
|
||||
obj-y := common.o dma.o clock.o mux.o gpio.o mcbsp.o usb.o
|
||||
obj-m :=
|
||||
obj-n :=
|
||||
obj- :=
|
||||
|
||||
# OCPI interconnect support for 1710, 1610 and 5912
|
||||
obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
|
||||
|
||||
# Power Management
|
||||
obj-$(CONFIG_PM) += pm.o sleep.o
|
||||
|
||||
obj-$(CONFIG_CPU_FREQ) += cpu-omap.o
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/clock.c
|
||||
* linux/arch/arm/plat-omap/clock.c
|
||||
*
|
||||
* Copyright (C) 2004 Nokia corporation
|
||||
* Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
|
||||
@ -14,6 +14,7 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/semaphore.h>
|
||||
#include <asm/hardware/clock.h>
|
||||
#include <asm/arch/board.h>
|
||||
@ -25,6 +26,8 @@ static LIST_HEAD(clocks);
|
||||
static DECLARE_MUTEX(clocks_sem);
|
||||
static DEFINE_SPINLOCK(clockfw_lock);
|
||||
static void propagate_rate(struct clk * clk);
|
||||
/* UART clock function */
|
||||
static int set_uart_rate(struct clk * clk, unsigned long rate);
|
||||
/* External clock (MCLK & BCLK) functions */
|
||||
static int set_ext_clk_rate(struct clk * clk, unsigned long rate);
|
||||
static long round_ext_clk_rate(struct clk * clk, unsigned long rate);
|
||||
@ -34,7 +37,7 @@ static int select_table_rate(struct clk * clk, unsigned long rate);
|
||||
static long round_to_table_rate(struct clk * clk, unsigned long rate);
|
||||
void clk_setdpll(__u16, __u16);
|
||||
|
||||
struct mpu_rate rate_table[] = {
|
||||
static struct mpu_rate rate_table[] = {
|
||||
/* MPU MHz, xtal MHz, dpll1 MHz, CKCTL, DPLL_CTL
|
||||
* armdiv, dspdiv, dspmmu, tcdiv, perdiv, lcddiv
|
||||
*/
|
||||
@ -48,7 +51,7 @@ struct mpu_rate rate_table[] = {
|
||||
{ 192000000, 19200000, 192000000, 0x050f, 0x2510 }, /* 1/1/2/2/8/8 */
|
||||
{ 192000000, 12000000, 192000000, 0x050f, 0x2810 }, /* 1/1/2/2/8/8 */
|
||||
{ 96000000, 12000000, 192000000, 0x055f, 0x2810 }, /* 2/2/2/2/8/8 */
|
||||
{ 48000000, 12000000, 192000000, 0x0ccf, 0x2810 }, /* 4/4/4/4/8/8 */
|
||||
{ 48000000, 12000000, 192000000, 0x0baf, 0x2810 }, /* 4/8/4/4/8/8 */
|
||||
{ 24000000, 12000000, 192000000, 0x0fff, 0x2810 }, /* 8/8/8/8/8/8 */
|
||||
#endif
|
||||
#if defined(CONFIG_OMAP_ARM_182MHZ)
|
||||
@ -58,7 +61,7 @@ struct mpu_rate rate_table[] = {
|
||||
{ 168000000, 12000000, 168000000, 0x010f, 0x2710 }, /* 1/1/1/2/8/8 */
|
||||
#endif
|
||||
#if defined(CONFIG_OMAP_ARM_150MHZ)
|
||||
{ 150000000, 12000000, 150000000, 0x150a, 0x2cb0 }, /* 0/0/1/1/2/2 */
|
||||
{ 150000000, 12000000, 150000000, 0x010a, 0x2cb0 }, /* 1/1/1/2/4/4 */
|
||||
#endif
|
||||
#if defined(CONFIG_OMAP_ARM_120MHZ)
|
||||
{ 120000000, 12000000, 120000000, 0x010a, 0x2510 }, /* 1/1/1/2/4/4 */
|
||||
@ -76,19 +79,11 @@ struct mpu_rate rate_table[] = {
|
||||
};
|
||||
|
||||
|
||||
static void ckctl_recalc(struct clk * clk)
|
||||
{
|
||||
int dsor;
|
||||
|
||||
/* Calculate divisor encoded as 2-bit exponent */
|
||||
dsor = 1 << (3 & (omap_readw(ARM_CKCTL) >> clk->rate_offset));
|
||||
if (unlikely(clk->rate == clk->parent->rate / dsor))
|
||||
return; /* No change, quick exit */
|
||||
clk->rate = clk->parent->rate / dsor;
|
||||
|
||||
if (unlikely(clk->flags & RATE_PROPAGATES))
|
||||
propagate_rate(clk);
|
||||
}
|
||||
static void ckctl_recalc(struct clk * clk);
|
||||
int __clk_enable(struct clk *clk);
|
||||
void __clk_disable(struct clk *clk);
|
||||
void __clk_unuse(struct clk *clk);
|
||||
int __clk_use(struct clk *clk);
|
||||
|
||||
|
||||
static void followparent_recalc(struct clk * clk)
|
||||
@ -102,6 +97,14 @@ static void watchdog_recalc(struct clk * clk)
|
||||
clk->rate = clk->parent->rate / 14;
|
||||
}
|
||||
|
||||
static void uart_recalc(struct clk * clk)
|
||||
{
|
||||
unsigned int val = omap_readl(clk->enable_reg);
|
||||
if (val & clk->enable_bit)
|
||||
clk->rate = 48000000;
|
||||
else
|
||||
clk->rate = 12000000;
|
||||
}
|
||||
|
||||
static struct clk ck_ref = {
|
||||
.name = "ck_ref",
|
||||
@ -138,7 +141,7 @@ static struct clk arm_ck = {
|
||||
static struct clk armper_ck = {
|
||||
.name = "armper_ck",
|
||||
.parent = &ck_dpll1,
|
||||
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
|
||||
.flags = CLOCK_IN_OMAP730 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
|
||||
RATE_CKCTL,
|
||||
.enable_reg = ARM_IDLECT2,
|
||||
.enable_bit = EN_PERCK,
|
||||
@ -185,7 +188,7 @@ static struct clk armwdt_ck = {
|
||||
static struct clk arminth_ck16xx = {
|
||||
.name = "arminth_ck",
|
||||
.parent = &arm_ck,
|
||||
.flags = CLOCK_IN_OMAP16XX,
|
||||
.flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED,
|
||||
.recalc = &followparent_recalc,
|
||||
/* Note: On 16xx the frequency can be divided by 2 by programming
|
||||
* ARM_CKCTL:ARM_INTHCK_SEL(14) to 1
|
||||
@ -214,6 +217,38 @@ static struct clk dspmmu_ck = {
|
||||
.recalc = &ckctl_recalc,
|
||||
};
|
||||
|
||||
static struct clk dspper_ck = {
|
||||
.name = "dspper_ck",
|
||||
.parent = &ck_dpll1,
|
||||
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
|
||||
RATE_CKCTL | DSP_DOMAIN_CLOCK | VIRTUAL_IO_ADDRESS,
|
||||
.enable_reg = DSP_IDLECT2,
|
||||
.enable_bit = EN_PERCK,
|
||||
.rate_offset = CKCTL_PERDIV_OFFSET,
|
||||
.recalc = &followparent_recalc,
|
||||
//.recalc = &ckctl_recalc,
|
||||
};
|
||||
|
||||
static struct clk dspxor_ck = {
|
||||
.name = "dspxor_ck",
|
||||
.parent = &ck_ref,
|
||||
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
|
||||
DSP_DOMAIN_CLOCK | VIRTUAL_IO_ADDRESS,
|
||||
.enable_reg = DSP_IDLECT2,
|
||||
.enable_bit = EN_XORPCK,
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk dsptim_ck = {
|
||||
.name = "dsptim_ck",
|
||||
.parent = &ck_ref,
|
||||
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
|
||||
DSP_DOMAIN_CLOCK | VIRTUAL_IO_ADDRESS,
|
||||
.enable_reg = DSP_IDLECT2,
|
||||
.enable_bit = EN_DSPTIMCK,
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk tc_ck = {
|
||||
.name = "tc_ck",
|
||||
.parent = &ck_dpll1,
|
||||
@ -226,7 +261,7 @@ static struct clk tc_ck = {
|
||||
static struct clk arminth_ck1510 = {
|
||||
.name = "arminth_ck",
|
||||
.parent = &tc_ck,
|
||||
.flags = CLOCK_IN_OMAP1510,
|
||||
.flags = CLOCK_IN_OMAP1510 | ALWAYS_ENABLED,
|
||||
.recalc = &followparent_recalc,
|
||||
/* Note: On 1510 the frequency follows TC_CK
|
||||
*
|
||||
@ -237,7 +272,7 @@ static struct clk arminth_ck1510 = {
|
||||
static struct clk tipb_ck = {
|
||||
.name = "tibp_ck",
|
||||
.parent = &tc_ck,
|
||||
.flags = CLOCK_IN_OMAP1510,
|
||||
.flags = CLOCK_IN_OMAP1510 | ALWAYS_ENABLED,
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
@ -271,14 +306,15 @@ static struct clk tc2_ck = {
|
||||
static struct clk dma_ck = {
|
||||
.name = "dma_ck",
|
||||
.parent = &tc_ck,
|
||||
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX,
|
||||
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
|
||||
ALWAYS_ENABLED,
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk dma_lcdfree_ck = {
|
||||
.name = "dma_lcdfree_ck",
|
||||
.parent = &tc_ck,
|
||||
.flags = CLOCK_IN_OMAP16XX,
|
||||
.flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED,
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
@ -303,14 +339,14 @@ static struct clk lb_ck = {
|
||||
static struct clk rhea1_ck = {
|
||||
.name = "rhea1_ck",
|
||||
.parent = &tc_ck,
|
||||
.flags = CLOCK_IN_OMAP16XX,
|
||||
.flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED,
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk rhea2_ck = {
|
||||
.name = "rhea2_ck",
|
||||
.parent = &tc_ck,
|
||||
.flags = CLOCK_IN_OMAP16XX,
|
||||
.flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED,
|
||||
.recalc = &followparent_recalc,
|
||||
};
|
||||
|
||||
@ -325,43 +361,55 @@ static struct clk lcd_ck = {
|
||||
.recalc = &ckctl_recalc,
|
||||
};
|
||||
|
||||
static struct clk uart1_ck = {
|
||||
static struct clk uart1_1510 = {
|
||||
.name = "uart1_ck",
|
||||
/* Direct from ULPD, no parent */
|
||||
.rate = 12000000,
|
||||
.flags = CLOCK_IN_OMAP1510 | ENABLE_REG_32BIT | ALWAYS_ENABLED,
|
||||
.enable_reg = MOD_CONF_CTRL_0,
|
||||
.enable_bit = 29, /* Chooses between 12MHz and 48MHz */
|
||||
.set_rate = &set_uart_rate,
|
||||
.recalc = &uart_recalc,
|
||||
};
|
||||
|
||||
static struct clk uart1_16xx = {
|
||||
.name = "uart1_ck",
|
||||
/* Direct from ULPD, no parent */
|
||||
.rate = 48000000,
|
||||
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
|
||||
RATE_FIXED | ENABLE_REG_32BIT,
|
||||
.flags = CLOCK_IN_OMAP16XX | RATE_FIXED | ENABLE_REG_32BIT,
|
||||
.enable_reg = MOD_CONF_CTRL_0,
|
||||
.enable_bit = 29,
|
||||
/* (Only on 1510)
|
||||
* The "enable bit" actually chooses between 48MHz and 12MHz.
|
||||
*/
|
||||
};
|
||||
|
||||
static struct clk uart2_ck = {
|
||||
.name = "uart2_ck",
|
||||
/* Direct from ULPD, no parent */
|
||||
.rate = 48000000,
|
||||
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
|
||||
RATE_FIXED | ENABLE_REG_32BIT,
|
||||
.rate = 12000000,
|
||||
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | ENABLE_REG_32BIT,
|
||||
.enable_reg = MOD_CONF_CTRL_0,
|
||||
.enable_bit = 30,
|
||||
/* (for both 1510 and 16xx)
|
||||
* The "enable bit" actually chooses between 48MHz and 12MHz/32kHz.
|
||||
*/
|
||||
.enable_bit = 30, /* Chooses between 12MHz and 48MHz */
|
||||
.set_rate = &set_uart_rate,
|
||||
.recalc = &uart_recalc,
|
||||
};
|
||||
|
||||
static struct clk uart3_ck = {
|
||||
static struct clk uart3_1510 = {
|
||||
.name = "uart3_ck",
|
||||
/* Direct from ULPD, no parent */
|
||||
.rate = 12000000,
|
||||
.flags = CLOCK_IN_OMAP1510 | ENABLE_REG_32BIT | ALWAYS_ENABLED,
|
||||
.enable_reg = MOD_CONF_CTRL_0,
|
||||
.enable_bit = 31, /* Chooses between 12MHz and 48MHz */
|
||||
.set_rate = &set_uart_rate,
|
||||
.recalc = &uart_recalc,
|
||||
};
|
||||
|
||||
static struct clk uart3_16xx = {
|
||||
.name = "uart3_ck",
|
||||
/* Direct from ULPD, no parent */
|
||||
.rate = 48000000,
|
||||
.flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
|
||||
RATE_FIXED | ENABLE_REG_32BIT,
|
||||
.flags = CLOCK_IN_OMAP16XX | RATE_FIXED | ENABLE_REG_32BIT,
|
||||
.enable_reg = MOD_CONF_CTRL_0,
|
||||
.enable_bit = 31,
|
||||
/* (Only on 1510)
|
||||
* The "enable bit" actually chooses between 48MHz and 12MHz.
|
||||
*/
|
||||
};
|
||||
|
||||
static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */
|
||||
@ -480,6 +528,9 @@ static struct clk * onchip_clks[] = {
|
||||
/* CK_GEN2 clocks */
|
||||
&dsp_ck,
|
||||
&dspmmu_ck,
|
||||
&dspper_ck,
|
||||
&dspxor_ck,
|
||||
&dsptim_ck,
|
||||
/* CK_GEN3 clocks */
|
||||
&tc_ck,
|
||||
&tipb_ck,
|
||||
@ -494,9 +545,11 @@ static struct clk * onchip_clks[] = {
|
||||
&rhea2_ck,
|
||||
&lcd_ck,
|
||||
/* ULPD clocks */
|
||||
&uart1_ck,
|
||||
&uart1_1510,
|
||||
&uart1_16xx,
|
||||
&uart2_ck,
|
||||
&uart3_ck,
|
||||
&uart3_1510,
|
||||
&uart3_16xx,
|
||||
&usb_clko,
|
||||
&usb_hhc_ck1510, &usb_hhc_ck16xx,
|
||||
&mclk_1510, &mclk_16xx,
|
||||
@ -547,15 +600,35 @@ int __clk_enable(struct clk *clk)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (clk->flags & DSP_DOMAIN_CLOCK) {
|
||||
__clk_use(&api_ck);
|
||||
}
|
||||
|
||||
if (clk->flags & ENABLE_REG_32BIT) {
|
||||
if (clk->flags & VIRTUAL_IO_ADDRESS) {
|
||||
regval32 = __raw_readl(clk->enable_reg);
|
||||
regval32 |= (1 << clk->enable_bit);
|
||||
__raw_writel(regval32, clk->enable_reg);
|
||||
} else {
|
||||
regval32 = omap_readl(clk->enable_reg);
|
||||
regval32 |= (1 << clk->enable_bit);
|
||||
omap_writel(regval32, clk->enable_reg);
|
||||
}
|
||||
} else {
|
||||
if (clk->flags & VIRTUAL_IO_ADDRESS) {
|
||||
regval16 = __raw_readw(clk->enable_reg);
|
||||
regval16 |= (1 << clk->enable_bit);
|
||||
__raw_writew(regval16, clk->enable_reg);
|
||||
} else {
|
||||
regval16 = omap_readw(clk->enable_reg);
|
||||
regval16 |= (1 << clk->enable_bit);
|
||||
omap_writew(regval16, clk->enable_reg);
|
||||
}
|
||||
}
|
||||
|
||||
if (clk->flags & DSP_DOMAIN_CLOCK) {
|
||||
__clk_unuse(&api_ck);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -569,15 +642,35 @@ void __clk_disable(struct clk *clk)
|
||||
if (clk->enable_reg == 0)
|
||||
return;
|
||||
|
||||
if (clk->flags & DSP_DOMAIN_CLOCK) {
|
||||
__clk_use(&api_ck);
|
||||
}
|
||||
|
||||
if (clk->flags & ENABLE_REG_32BIT) {
|
||||
if (clk->flags & VIRTUAL_IO_ADDRESS) {
|
||||
regval32 = __raw_readl(clk->enable_reg);
|
||||
regval32 &= ~(1 << clk->enable_bit);
|
||||
__raw_writel(regval32, clk->enable_reg);
|
||||
} else {
|
||||
regval32 = omap_readl(clk->enable_reg);
|
||||
regval32 &= ~(1 << clk->enable_bit);
|
||||
omap_writel(regval32, clk->enable_reg);
|
||||
}
|
||||
} else {
|
||||
if (clk->flags & VIRTUAL_IO_ADDRESS) {
|
||||
regval16 = __raw_readw(clk->enable_reg);
|
||||
regval16 &= ~(1 << clk->enable_bit);
|
||||
__raw_writew(regval16, clk->enable_reg);
|
||||
} else {
|
||||
regval16 = omap_readw(clk->enable_reg);
|
||||
regval16 &= ~(1 << clk->enable_bit);
|
||||
omap_writew(regval16, clk->enable_reg);
|
||||
}
|
||||
}
|
||||
|
||||
if (clk->flags & DSP_DOMAIN_CLOCK) {
|
||||
__clk_unuse(&api_ck);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -766,6 +859,33 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate)
|
||||
return dsor_exp;
|
||||
}
|
||||
|
||||
|
||||
static void ckctl_recalc(struct clk * clk)
|
||||
{
|
||||
int dsor;
|
||||
|
||||
/* Calculate divisor encoded as 2-bit exponent */
|
||||
if (clk->flags & DSP_DOMAIN_CLOCK) {
|
||||
/* The clock control bits are in DSP domain,
|
||||
* so api_ck is needed for access.
|
||||
* Note that DSP_CKCTL virt addr = phys addr, so
|
||||
* we must use __raw_readw() instead of omap_readw().
|
||||
*/
|
||||
__clk_use(&api_ck);
|
||||
dsor = 1 << (3 & (__raw_readw(DSP_CKCTL) >> clk->rate_offset));
|
||||
__clk_unuse(&api_ck);
|
||||
} else {
|
||||
dsor = 1 << (3 & (omap_readw(ARM_CKCTL) >> clk->rate_offset));
|
||||
}
|
||||
if (unlikely(clk->rate == clk->parent->rate / dsor))
|
||||
return; /* No change, quick exit */
|
||||
clk->rate = clk->parent->rate / dsor;
|
||||
|
||||
if (unlikely(clk->flags & RATE_PROPAGATES))
|
||||
propagate_rate(clk);
|
||||
}
|
||||
|
||||
|
||||
long clk_round_rate(struct clk *clk, unsigned long rate)
|
||||
{
|
||||
int dsor_exp;
|
||||
@ -823,6 +943,9 @@ static int select_table_rate(struct clk * clk, unsigned long rate)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ptr->rate)
|
||||
return -EINVAL;
|
||||
|
||||
if (!ptr->rate)
|
||||
return -EINVAL;
|
||||
|
||||
@ -921,6 +1044,23 @@ static unsigned calc_ext_dsor(unsigned long rate)
|
||||
return dsor;
|
||||
}
|
||||
|
||||
/* Only needed on 1510 */
|
||||
static int set_uart_rate(struct clk * clk, unsigned long rate)
|
||||
{
|
||||
unsigned int val;
|
||||
|
||||
val = omap_readl(clk->enable_reg);
|
||||
if (rate == 12000000)
|
||||
val &= ~(1 << clk->enable_bit);
|
||||
else if (rate == 48000000)
|
||||
val |= (1 << clk->enable_bit);
|
||||
else
|
||||
return -EINVAL;
|
||||
omap_writel(val, clk->enable_reg);
|
||||
clk->rate = rate;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_ext_clk_rate(struct clk * clk, unsigned long rate)
|
||||
{
|
||||
@ -985,7 +1125,18 @@ void clk_unregister(struct clk *clk)
|
||||
}
|
||||
EXPORT_SYMBOL(clk_unregister);
|
||||
|
||||
|
||||
#ifdef CONFIG_OMAP_RESET_CLOCKS
|
||||
/*
|
||||
* Resets some clocks that may be left on from bootloader,
|
||||
* but leaves serial clocks on. See also omap_late_clk_reset().
|
||||
*/
|
||||
static inline void omap_early_clk_reset(void)
|
||||
{
|
||||
//omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
|
||||
}
|
||||
#else
|
||||
#define omap_early_clk_reset() {}
|
||||
#endif
|
||||
|
||||
int __init clk_init(void)
|
||||
{
|
||||
@ -993,6 +1144,8 @@ int __init clk_init(void)
|
||||
const struct omap_clock_config *info;
|
||||
int crystal_type = 0; /* Default 12 MHz */
|
||||
|
||||
omap_early_clk_reset();
|
||||
|
||||
for (clkp = onchip_clks; clkp < onchip_clks+ARRAY_SIZE(onchip_clks); clkp++) {
|
||||
if (((*clkp)->flags &CLOCK_IN_OMAP1510) && cpu_is_omap1510()) {
|
||||
clk_register(*clkp);
|
||||
@ -1023,9 +1176,42 @@ int __init clk_init(void)
|
||||
ck_ref.rate = 19200000;
|
||||
#endif
|
||||
|
||||
printk("Clocks: ARM_SYSST: 0x%04x DPLL_CTL: 0x%04x ARM_CKCTL: 0x%04x\n",
|
||||
omap_readw(ARM_SYSST), omap_readw(DPLL_CTL),
|
||||
omap_readw(ARM_CKCTL));
|
||||
|
||||
/* We want to be in syncronous scalable mode */
|
||||
omap_writew(0x1000, ARM_SYSST);
|
||||
|
||||
#ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER
|
||||
/* Use values set by bootloader. Determine PLL rate and recalculate
|
||||
* dependent clocks as if kernel had changed PLL or divisors.
|
||||
*/
|
||||
{
|
||||
unsigned pll_ctl_val = omap_readw(DPLL_CTL);
|
||||
|
||||
ck_dpll1.rate = ck_ref.rate; /* Base xtal rate */
|
||||
if (pll_ctl_val & 0x10) {
|
||||
/* PLL enabled, apply multiplier and divisor */
|
||||
if (pll_ctl_val & 0xf80)
|
||||
ck_dpll1.rate *= (pll_ctl_val & 0xf80) >> 7;
|
||||
ck_dpll1.rate /= ((pll_ctl_val & 0x60) >> 5) + 1;
|
||||
} else {
|
||||
/* PLL disabled, apply bypass divisor */
|
||||
switch (pll_ctl_val & 0xc) {
|
||||
case 0:
|
||||
break;
|
||||
case 0x4:
|
||||
ck_dpll1.rate /= 2;
|
||||
break;
|
||||
default:
|
||||
ck_dpll1.rate /= 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
propagate_rate(&ck_dpll1);
|
||||
#else
|
||||
/* Find the highest supported frequency and enable it */
|
||||
if (select_table_rate(&virtual_ck_mpu, ~0)) {
|
||||
printk(KERN_ERR "System frequencies not set. Check your config.\n");
|
||||
@ -1034,12 +1220,13 @@ int __init clk_init(void)
|
||||
omap_writew(0x1005, ARM_CKCTL);
|
||||
ck_dpll1.rate = 60000000;
|
||||
propagate_rate(&ck_dpll1);
|
||||
printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): %ld/%ld/%ld\n",
|
||||
ck_ref.rate, ck_dpll1.rate, arm_ck.rate);
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Cache rates for clocks connected to ck_ref (not dpll1) */
|
||||
propagate_rate(&ck_ref);
|
||||
printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): %ld.%01ld/%ld/%ld MHz\n",
|
||||
ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
|
||||
ck_dpll1.rate, arm_ck.rate);
|
||||
|
||||
#ifdef CONFIG_MACH_OMAP_PERSEUS2
|
||||
/* Select slicer output as OMAP input clock */
|
||||
@ -1074,3 +1261,63 @@ int __init clk_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_OMAP_RESET_CLOCKS
|
||||
|
||||
static int __init omap_late_clk_reset(void)
|
||||
{
|
||||
/* Turn off all unused clocks */
|
||||
struct clk *p;
|
||||
__u32 regval32;
|
||||
|
||||
omap_writew(0, SOFT_REQ_REG);
|
||||
omap_writew(0, SOFT_REQ_REG2);
|
||||
|
||||
list_for_each_entry(p, &clocks, node) {
|
||||
if (p->usecount > 0 || (p->flags & ALWAYS_ENABLED) ||
|
||||
p->enable_reg == 0)
|
||||
continue;
|
||||
|
||||
/* Assume no DSP clocks have been activated by bootloader */
|
||||
if (p->flags & DSP_DOMAIN_CLOCK)
|
||||
continue;
|
||||
|
||||
/* Is the clock already disabled? */
|
||||
if (p->flags & ENABLE_REG_32BIT) {
|
||||
if (p->flags & VIRTUAL_IO_ADDRESS)
|
||||
regval32 = __raw_readl(p->enable_reg);
|
||||
else
|
||||
regval32 = omap_readl(p->enable_reg);
|
||||
} else {
|
||||
if (p->flags & VIRTUAL_IO_ADDRESS)
|
||||
regval32 = __raw_readw(p->enable_reg);
|
||||
else
|
||||
regval32 = omap_readw(p->enable_reg);
|
||||
}
|
||||
|
||||
if ((regval32 & (1 << p->enable_bit)) == 0)
|
||||
continue;
|
||||
|
||||
/* FIXME: This clock seems to be necessary but no-one
|
||||
* has asked for its activation. */
|
||||
if (p == &tc2_ck // FIX: pm.c (SRAM), CCP, Camera
|
||||
|| p == &ck_dpll1out // FIX: SoSSI, SSR
|
||||
|| p == &arm_gpio_ck // FIX: GPIO code for 1510
|
||||
) {
|
||||
printk(KERN_INFO "FIXME: Clock \"%s\" seems unused\n",
|
||||
p->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
printk(KERN_INFO "Disabling unused clock \"%s\"... ", p->name);
|
||||
__clk_disable(p);
|
||||
printk(" done\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
late_initcall(omap_late_clk_reset);
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/clock.h
|
||||
* linux/arch/arm/plat-omap/clock.h
|
||||
*
|
||||
* Copyright (C) 2004 Nokia corporation
|
||||
* Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
|
||||
@ -52,6 +52,8 @@ struct mpu_rate {
|
||||
#define CLOCK_IN_OMAP16XX 64
|
||||
#define CLOCK_IN_OMAP1510 128
|
||||
#define CLOCK_IN_OMAP730 256
|
||||
#define DSP_DOMAIN_CLOCK 512
|
||||
#define VIRTUAL_IO_ADDRESS 1024
|
||||
|
||||
/* ARM_CKCTL bit shifts */
|
||||
#define CKCTL_PERDIV_OFFSET 0
|
||||
@ -63,6 +65,8 @@ struct mpu_rate {
|
||||
/*#define ARM_TIMXO 12*/
|
||||
#define EN_DSPCK 13
|
||||
/*#define ARM_INTHCK_SEL 14*/ /* Divide-by-2 for mpu inth_ck */
|
||||
/* DSP_CKCTL bit shifts */
|
||||
#define CKCTL_DSPPERDIV_OFFSET 0
|
||||
|
||||
/* ARM_IDLECT1 bit shifts */
|
||||
/*#define IDLWDT_ARM 0*/
|
||||
@ -96,6 +100,9 @@ struct mpu_rate {
|
||||
#define EN_TC1_CK 2
|
||||
#define EN_TC2_CK 4
|
||||
|
||||
/* DSP_IDLECT2 bit shifts (0,1,2 are same as for ARM_IDLECT2) */
|
||||
#define EN_DSPTIMCK 5
|
||||
|
||||
/* Various register defines for clock controls scattered around OMAP chip */
|
||||
#define USB_MCLK_EN_BIT 4 /* In ULPD_CLKC_CTRL */
|
||||
#define USB_HOST_HHC_UHOST_EN 9 /* In MOD_CONF_CTRL_0 */
|
||||
@ -103,7 +110,8 @@ struct mpu_rate {
|
||||
#define COM_ULPD_PLL_CLK_REQ 1 /* In COM_CLK_DIV_CTRL_SEL */
|
||||
#define SWD_CLK_DIV_CTRL_SEL 0xfffe0874
|
||||
#define COM_CLK_DIV_CTRL_SEL 0xfffe0878
|
||||
|
||||
#define SOFT_REQ_REG 0xfffe0834
|
||||
#define SOFT_REQ_REG2 0xfffe0880
|
||||
|
||||
int clk_register(struct clk *clk);
|
||||
void clk_unregister(struct clk *clk);
|
135
arch/arm/plat-omap/common.c
Normal file
135
arch/arm/plat-omap/common.c
Normal file
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* linux/arch/arm/plat-omap/common.c
|
||||
*
|
||||
* Code common to all OMAP machines.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#include <linux/config.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/serial.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/serial_8250.h>
|
||||
#include <linux/serial_reg.h>
|
||||
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/mach/map.h>
|
||||
#include <asm/hardware/clock.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#include <asm/arch/board.h>
|
||||
#include <asm/arch/mux.h>
|
||||
#include <asm/arch/fpga.h>
|
||||
|
||||
#include "clock.h"
|
||||
|
||||
#define NO_LENGTH_CHECK 0xffffffff
|
||||
|
||||
extern int omap_bootloader_tag_len;
|
||||
extern u8 omap_bootloader_tag[];
|
||||
|
||||
struct omap_board_config_kernel *omap_board_config;
|
||||
int omap_board_config_size = 0;
|
||||
|
||||
static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out)
|
||||
{
|
||||
struct omap_board_config_kernel *kinfo = NULL;
|
||||
int i;
|
||||
|
||||
#ifdef CONFIG_OMAP_BOOT_TAG
|
||||
struct omap_board_config_entry *info = NULL;
|
||||
|
||||
if (omap_bootloader_tag_len > 4)
|
||||
info = (struct omap_board_config_entry *) omap_bootloader_tag;
|
||||
while (info != NULL) {
|
||||
u8 *next;
|
||||
|
||||
if (info->tag == tag) {
|
||||
if (skip == 0)
|
||||
break;
|
||||
skip--;
|
||||
}
|
||||
|
||||
if ((info->len & 0x03) != 0) {
|
||||
/* We bail out to avoid an alignment fault */
|
||||
printk(KERN_ERR "OMAP peripheral config: Length (%d) not word-aligned (tag %04x)\n",
|
||||
info->len, info->tag);
|
||||
return NULL;
|
||||
}
|
||||
next = (u8 *) info + sizeof(*info) + info->len;
|
||||
if (next >= omap_bootloader_tag + omap_bootloader_tag_len)
|
||||
info = NULL;
|
||||
else
|
||||
info = (struct omap_board_config_entry *) next;
|
||||
}
|
||||
if (info != NULL) {
|
||||
/* Check the length as a lame attempt to check for
|
||||
* binary inconsistancy. */
|
||||
if (len != NO_LENGTH_CHECK) {
|
||||
/* Word-align len */
|
||||
if (len & 0x03)
|
||||
len = (len + 3) & ~0x03;
|
||||
if (info->len != len) {
|
||||
printk(KERN_ERR "OMAP peripheral config: Length mismatch with tag %x (want %d, got %d)\n",
|
||||
tag, len, info->len);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (len_out != NULL)
|
||||
*len_out = info->len;
|
||||
return info->data;
|
||||
}
|
||||
#endif
|
||||
/* Try to find the config from the board-specific structures
|
||||
* in the kernel. */
|
||||
for (i = 0; i < omap_board_config_size; i++) {
|
||||
if (omap_board_config[i].tag == tag) {
|
||||
kinfo = &omap_board_config[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (kinfo == NULL)
|
||||
return NULL;
|
||||
return kinfo->data;
|
||||
}
|
||||
|
||||
const void *__omap_get_config(u16 tag, size_t len, int nr)
|
||||
{
|
||||
return get_config(tag, len, nr, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL(__omap_get_config);
|
||||
|
||||
const void *omap_get_var_config(u16 tag, size_t *len)
|
||||
{
|
||||
return get_config(tag, NO_LENGTH_CHECK, 0, len);
|
||||
}
|
||||
EXPORT_SYMBOL(omap_get_var_config);
|
||||
|
||||
static int __init omap_add_serial_console(void)
|
||||
{
|
||||
const struct omap_serial_console_config *info;
|
||||
|
||||
info = omap_get_config(OMAP_TAG_SERIAL_CONSOLE,
|
||||
struct omap_serial_console_config);
|
||||
if (info != NULL && info->console_uart) {
|
||||
static char speed[11], *opt = NULL;
|
||||
|
||||
if (info->console_speed) {
|
||||
snprintf(speed, sizeof(speed), "%u", info->console_speed);
|
||||
opt = speed;
|
||||
}
|
||||
return add_preferred_console("ttyS", info->console_uart - 1, opt);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
console_initcall(omap_add_serial_console);
|
128
arch/arm/plat-omap/cpu-omap.c
Normal file
128
arch/arm/plat-omap/cpu-omap.c
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
* linux/arch/arm/plat-omap/cpu-omap.c
|
||||
*
|
||||
* CPU frequency scaling for OMAP
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation
|
||||
* Written by Tony Lindgren <tony@atomide.com>
|
||||
*
|
||||
* Based on cpu-sa1110.c, Copyright (C) 2001 Russell King
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/mach-types.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
#include <asm/hardware/clock.h>
|
||||
|
||||
/* TODO: Add support for SDRAM timing changes */
|
||||
|
||||
int omap_verify_speed(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct clk * mpu_clk;
|
||||
|
||||
if (policy->cpu)
|
||||
return -EINVAL;
|
||||
|
||||
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
|
||||
policy->cpuinfo.max_freq);
|
||||
mpu_clk = clk_get(NULL, "mpu");
|
||||
if (IS_ERR(mpu_clk))
|
||||
return PTR_ERR(mpu_clk);
|
||||
policy->min = clk_round_rate(mpu_clk, policy->min * 1000) / 1000;
|
||||
policy->max = clk_round_rate(mpu_clk, policy->max * 1000) / 1000;
|
||||
cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
|
||||
policy->cpuinfo.max_freq);
|
||||
clk_put(mpu_clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int omap_getspeed(unsigned int cpu)
|
||||
{
|
||||
struct clk * mpu_clk;
|
||||
unsigned long rate;
|
||||
|
||||
if (cpu)
|
||||
return 0;
|
||||
|
||||
mpu_clk = clk_get(NULL, "mpu");
|
||||
if (IS_ERR(mpu_clk))
|
||||
return 0;
|
||||
rate = clk_get_rate(mpu_clk) / 1000;
|
||||
clk_put(mpu_clk);
|
||||
|
||||
return rate;
|
||||
}
|
||||
|
||||
static int omap_target(struct cpufreq_policy *policy,
|
||||
unsigned int target_freq,
|
||||
unsigned int relation)
|
||||
{
|
||||
struct clk * mpu_clk;
|
||||
struct cpufreq_freqs freqs;
|
||||
int ret = 0;
|
||||
|
||||
mpu_clk = clk_get(NULL, "mpu");
|
||||
if (IS_ERR(mpu_clk))
|
||||
return PTR_ERR(mpu_clk);
|
||||
|
||||
freqs.old = omap_getspeed(0);
|
||||
freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
|
||||
freqs.cpu = 0;
|
||||
|
||||
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
|
||||
ret = clk_set_rate(mpu_clk, target_freq * 1000);
|
||||
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
|
||||
clk_put(mpu_clk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __init omap_cpu_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct clk * mpu_clk;
|
||||
|
||||
mpu_clk = clk_get(NULL, "mpu");
|
||||
if (IS_ERR(mpu_clk))
|
||||
return PTR_ERR(mpu_clk);
|
||||
|
||||
if (policy->cpu != 0)
|
||||
return -EINVAL;
|
||||
policy->cur = policy->min = policy->max = omap_getspeed(0);
|
||||
policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
|
||||
policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000;
|
||||
policy->cpuinfo.max_freq = clk_round_rate(mpu_clk, 216000000) / 1000;
|
||||
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
|
||||
clk_put(mpu_clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct cpufreq_driver omap_driver = {
|
||||
.flags = CPUFREQ_STICKY,
|
||||
.verify = omap_verify_speed,
|
||||
.target = omap_target,
|
||||
.get = omap_getspeed,
|
||||
.init = omap_cpu_init,
|
||||
.name = "omap",
|
||||
};
|
||||
|
||||
static int __init omap_cpufreq_init(void)
|
||||
{
|
||||
return cpufreq_register_driver(&omap_driver);
|
||||
}
|
||||
|
||||
arch_initcall(omap_cpufreq_init);
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/omap/dma.c
|
||||
* linux/arch/arm/plat-omap/dma.c
|
||||
*
|
||||
* Copyright (C) 2003 Nokia Corporation
|
||||
* Author: Juha Yrjölä <juha.yrjola@nokia.com>
|
||||
@ -794,10 +794,6 @@ static void set_b1_regs(void)
|
||||
w = omap_readw(OMAP1610_DMA_LCD_CTRL);
|
||||
/* Always set the source port as SDRAM for now*/
|
||||
w &= ~(0x03 << 6);
|
||||
if (lcd_dma.ext_ctrl)
|
||||
w |= 1 << 8;
|
||||
else
|
||||
w &= ~(1 << 8);
|
||||
if (lcd_dma.callback != NULL)
|
||||
w |= 1 << 1; /* Block interrupt enable */
|
||||
else
|
||||
@ -889,9 +885,15 @@ void omap_enable_lcd_dma(void)
|
||||
*/
|
||||
if (enable_1510_mode || !lcd_dma.ext_ctrl)
|
||||
return;
|
||||
|
||||
w = omap_readw(OMAP1610_DMA_LCD_CTRL);
|
||||
w |= 1 << 8;
|
||||
omap_writew(w, OMAP1610_DMA_LCD_CTRL);
|
||||
|
||||
w = omap_readw(OMAP1610_DMA_LCD_CCR);
|
||||
w |= 1 << 7;
|
||||
omap_writew(w, OMAP1610_DMA_LCD_CCR);
|
||||
|
||||
lcd_dma.active = 1;
|
||||
}
|
||||
|
||||
@ -922,10 +924,19 @@ void omap_setup_lcd_dma(void)
|
||||
|
||||
void omap_stop_lcd_dma(void)
|
||||
{
|
||||
u16 w;
|
||||
|
||||
lcd_dma.active = 0;
|
||||
if (!enable_1510_mode && lcd_dma.ext_ctrl)
|
||||
omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~(1 << 7),
|
||||
OMAP1610_DMA_LCD_CCR);
|
||||
if (enable_1510_mode || !lcd_dma.ext_ctrl)
|
||||
return;
|
||||
|
||||
w = omap_readw(OMAP1610_DMA_LCD_CCR);
|
||||
w &= ~(1 << 7);
|
||||
omap_writew(w, OMAP1610_DMA_LCD_CCR);
|
||||
|
||||
w = omap_readw(OMAP1610_DMA_LCD_CTRL);
|
||||
w &= ~(1 << 8);
|
||||
omap_writew(w, OMAP1610_DMA_LCD_CTRL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -972,6 +983,25 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
|
||||
(OMAP_DMA_CDSA_U(lch) << 16));
|
||||
}
|
||||
|
||||
int omap_dma_running(void)
|
||||
{
|
||||
int lch;
|
||||
|
||||
/* Check if LCD DMA is running */
|
||||
if (cpu_is_omap16xx())
|
||||
if (omap_readw(OMAP1610_DMA_LCD_CCR) & OMAP_DMA_CCR_EN)
|
||||
return 1;
|
||||
|
||||
for (lch = 0; lch < dma_chan_count; lch++) {
|
||||
u16 w;
|
||||
|
||||
w = omap_readw(OMAP_DMA_CCR(lch));
|
||||
if (w & OMAP_DMA_CCR_EN)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init omap_init_dma(void)
|
||||
{
|
||||
int ch, r;
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/gpio.c
|
||||
* linux/arch/arm/plat-omap/gpio.c
|
||||
*
|
||||
* Support functions for OMAP GPIO
|
||||
*
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/omap/mcbsp.c
|
||||
* linux/arch/arm/plat-omap/mcbsp.c
|
||||
*
|
||||
* Copyright (C) 2004 Nokia Corporation
|
||||
* Author: Samuel Ortiz <samuel.ortiz@nokia.com>
|
||||
@ -66,6 +66,7 @@ struct omap_mcbsp {
|
||||
static struct omap_mcbsp mcbsp[OMAP_MAX_MCBSP_COUNT];
|
||||
static struct clk *mcbsp_dsp_ck = 0;
|
||||
static struct clk *mcbsp_api_ck = 0;
|
||||
static struct clk *mcbsp_dspxor_ck = 0;
|
||||
|
||||
|
||||
static void omap_mcbsp_dump_reg(u8 id)
|
||||
@ -175,7 +176,7 @@ static int omap_mcbsp_check(unsigned int id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cpu_is_omap1510() || cpu_is_omap1610() || cpu_is_omap1710()) {
|
||||
if (cpu_is_omap1510() || cpu_is_omap16xx()) {
|
||||
if (id > OMAP_MAX_MCBSP_COUNT) {
|
||||
printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1);
|
||||
return -1;
|
||||
@ -191,15 +192,12 @@ static int omap_mcbsp_check(unsigned int id)
|
||||
|
||||
static void omap_mcbsp_dsp_request(void)
|
||||
{
|
||||
if (cpu_is_omap1510() || cpu_is_omap1610() || cpu_is_omap1710()) {
|
||||
omap_writew((omap_readw(ARM_RSTCT1) | (1 << 1) | (1 << 2)),
|
||||
ARM_RSTCT1);
|
||||
clk_enable(mcbsp_dsp_ck);
|
||||
clk_enable(mcbsp_api_ck);
|
||||
if (cpu_is_omap1510() || cpu_is_omap16xx()) {
|
||||
clk_use(mcbsp_dsp_ck);
|
||||
clk_use(mcbsp_api_ck);
|
||||
|
||||
/* enable 12MHz clock to mcbsp 1 & 3 */
|
||||
__raw_writew(__raw_readw(DSP_IDLECT2) | (1 << EN_XORPCK),
|
||||
DSP_IDLECT2);
|
||||
clk_use(mcbsp_dspxor_ck);
|
||||
__raw_writew(__raw_readw(DSP_RSTCT2) | 1 | 1 << 1,
|
||||
DSP_RSTCT2);
|
||||
}
|
||||
@ -207,10 +205,13 @@ static void omap_mcbsp_dsp_request(void)
|
||||
|
||||
static void omap_mcbsp_dsp_free(void)
|
||||
{
|
||||
/* Useless for now */
|
||||
if (cpu_is_omap1510() || cpu_is_omap16xx()) {
|
||||
clk_unuse(mcbsp_dspxor_ck);
|
||||
clk_unuse(mcbsp_dsp_ck);
|
||||
clk_unuse(mcbsp_api_ck);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int omap_mcbsp_request(unsigned int id)
|
||||
{
|
||||
int err;
|
||||
@ -350,6 +351,73 @@ void omap_mcbsp_stop(unsigned int id)
|
||||
}
|
||||
|
||||
|
||||
/* polled mcbsp i/o operations */
|
||||
int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
|
||||
{
|
||||
u32 base = mcbsp[id].io_base;
|
||||
writew(buf, base + OMAP_MCBSP_REG_DXR1);
|
||||
/* if frame sync error - clear the error */
|
||||
if (readw(base + OMAP_MCBSP_REG_SPCR2) & XSYNC_ERR) {
|
||||
/* clear error */
|
||||
writew(readw(base + OMAP_MCBSP_REG_SPCR2) & (~XSYNC_ERR),
|
||||
base + OMAP_MCBSP_REG_SPCR2);
|
||||
/* resend */
|
||||
return -1;
|
||||
} else {
|
||||
/* wait for transmit confirmation */
|
||||
int attemps = 0;
|
||||
while (!(readw(base + OMAP_MCBSP_REG_SPCR2) & XRDY)) {
|
||||
if (attemps++ > 1000) {
|
||||
writew(readw(base + OMAP_MCBSP_REG_SPCR2) &
|
||||
(~XRST),
|
||||
base + OMAP_MCBSP_REG_SPCR2);
|
||||
udelay(10);
|
||||
writew(readw(base + OMAP_MCBSP_REG_SPCR2) |
|
||||
(XRST),
|
||||
base + OMAP_MCBSP_REG_SPCR2);
|
||||
udelay(10);
|
||||
printk(KERN_ERR
|
||||
" Could not write to McBSP Register\n");
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int omap_mcbsp_pollread(unsigned int id, u16 * buf)
|
||||
{
|
||||
u32 base = mcbsp[id].io_base;
|
||||
/* if frame sync error - clear the error */
|
||||
if (readw(base + OMAP_MCBSP_REG_SPCR1) & RSYNC_ERR) {
|
||||
/* clear error */
|
||||
writew(readw(base + OMAP_MCBSP_REG_SPCR1) & (~RSYNC_ERR),
|
||||
base + OMAP_MCBSP_REG_SPCR1);
|
||||
/* resend */
|
||||
return -1;
|
||||
} else {
|
||||
/* wait for recieve confirmation */
|
||||
int attemps = 0;
|
||||
while (!(readw(base + OMAP_MCBSP_REG_SPCR1) & RRDY)) {
|
||||
if (attemps++ > 1000) {
|
||||
writew(readw(base + OMAP_MCBSP_REG_SPCR1) &
|
||||
(~RRST),
|
||||
base + OMAP_MCBSP_REG_SPCR1);
|
||||
udelay(10);
|
||||
writew(readw(base + OMAP_MCBSP_REG_SPCR1) |
|
||||
(RRST),
|
||||
base + OMAP_MCBSP_REG_SPCR1);
|
||||
udelay(10);
|
||||
printk(KERN_ERR
|
||||
" Could not read from McBSP Register\n");
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
*buf = readw(base + OMAP_MCBSP_REG_DRR1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* IRQ based word transmission.
|
||||
*/
|
||||
@ -625,10 +693,15 @@ static int __init omap_mcbsp_init(void)
|
||||
return PTR_ERR(mcbsp_dsp_ck);
|
||||
}
|
||||
mcbsp_api_ck = clk_get(0, "api_ck");
|
||||
if (IS_ERR(mcbsp_dsp_ck)) {
|
||||
if (IS_ERR(mcbsp_api_ck)) {
|
||||
printk(KERN_ERR "mcbsp: could not acquire api_ck handle.\n");
|
||||
return PTR_ERR(mcbsp_api_ck);
|
||||
}
|
||||
mcbsp_dspxor_ck = clk_get(0, "dspxor_ck");
|
||||
if (IS_ERR(mcbsp_dspxor_ck)) {
|
||||
printk(KERN_ERR "mcbsp: could not acquire dspxor_ck handle.\n");
|
||||
return PTR_ERR(mcbsp_dspxor_ck);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP730
|
||||
if (cpu_is_omap730()) {
|
||||
@ -643,7 +716,7 @@ static int __init omap_mcbsp_init(void)
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_ARCH_OMAP16XX)
|
||||
if (cpu_is_omap1610() || cpu_is_omap1710()) {
|
||||
if (cpu_is_omap16xx()) {
|
||||
mcbsp_info = mcbsp_1610;
|
||||
mcbsp_count = ARRAY_SIZE(mcbsp_1610);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/mux.c
|
||||
* linux/arch/arm/plat-omap/mux.c
|
||||
*
|
||||
* Utility to set the Omap MUX and PULL_DWN registers from a table in mux.h
|
||||
*
|
||||
@ -53,19 +53,13 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cfg = ®_cfg_table[reg_cfg];
|
||||
|
||||
/*
|
||||
* We do a pretty long section here with lock on, but pin muxing
|
||||
* should only happen on driver init for each driver, so it's not time
|
||||
* critical.
|
||||
*/
|
||||
spin_lock_irqsave(&mux_spin_lock, flags);
|
||||
cfg = (reg_cfg_set *)®_cfg_table[reg_cfg];
|
||||
|
||||
/* Check the mux register in question */
|
||||
if (cfg->mux_reg) {
|
||||
unsigned tmp1, tmp2;
|
||||
|
||||
spin_lock_irqsave(&mux_spin_lock, flags);
|
||||
reg_orig = omap_readl(cfg->mux_reg);
|
||||
|
||||
/* The mux registers always seem to be 3 bits long */
|
||||
@ -80,11 +74,13 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
|
||||
warn = 1;
|
||||
|
||||
omap_writel(reg, cfg->mux_reg);
|
||||
spin_unlock_irqrestore(&mux_spin_lock, flags);
|
||||
}
|
||||
|
||||
/* Check for pull up or pull down selection on 1610 */
|
||||
if (!cpu_is_omap1510()) {
|
||||
if (cfg->pu_pd_reg && cfg->pull_val) {
|
||||
spin_lock_irqsave(&mux_spin_lock, flags);
|
||||
pu_pd_orig = omap_readl(cfg->pu_pd_reg);
|
||||
mask = 1 << cfg->pull_bit;
|
||||
|
||||
@ -100,11 +96,13 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
|
||||
pu_pd = pu_pd_orig & ~mask;
|
||||
}
|
||||
omap_writel(pu_pd, cfg->pu_pd_reg);
|
||||
spin_unlock_irqrestore(&mux_spin_lock, flags);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for an associated pull down register */
|
||||
if (cfg->pull_reg) {
|
||||
spin_lock_irqsave(&mux_spin_lock, flags);
|
||||
pull_orig = omap_readl(cfg->pull_reg);
|
||||
mask = 1 << cfg->pull_bit;
|
||||
|
||||
@ -121,6 +119,7 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
|
||||
}
|
||||
|
||||
omap_writel(pull, cfg->pull_reg);
|
||||
spin_unlock_irqrestore(&mux_spin_lock, flags);
|
||||
}
|
||||
|
||||
if (warn) {
|
||||
@ -149,8 +148,6 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
|
||||
}
|
||||
#endif
|
||||
|
||||
spin_unlock_irqrestore(&mux_spin_lock, flags);
|
||||
|
||||
#ifdef CONFIG_OMAP_MUX_ERRORS
|
||||
return warn ? -ETXTBSY : 0;
|
||||
#else
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/ocpi.c
|
||||
* linux/arch/arm/plat-omap/ocpi.c
|
||||
*
|
||||
* Minimal OCP bus support for omap16xx
|
||||
*
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/pm.c
|
||||
* linux/arch/arm/plat-omap/pm.c
|
||||
*
|
||||
* OMAP Power Management Routines
|
||||
*
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* linux/arch/arm/mach-omap/sleep.S
|
||||
* linux/arch/arm/plat-omap/sleep.S
|
||||
*
|
||||
* Low-level OMAP1510/1610 sleep/wakeUp support
|
||||
*
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* arch/arm/mach-omap/usb.c -- platform level USB initialization
|
||||
* arch/arm/plat-omap/usb.c -- platform level USB initialization
|
||||
*
|
||||
* Copyright (C) 2004 Texas Instruments, Inc.
|
||||
*
|
||||
@ -326,7 +326,7 @@ static u64 ohci_dmamask = ~(u32)0;
|
||||
static struct resource ohci_resources[] = {
|
||||
{
|
||||
.start = OMAP_OHCI_BASE,
|
||||
.end = OMAP_OHCI_BASE + 4096,
|
||||
.end = OMAP_OHCI_BASE + 4096 - 1,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
{
|
@ -43,6 +43,8 @@ config SPARC64_PAGE_SIZE_4MB
|
||||
|
||||
endchoice
|
||||
|
||||
source kernel/Kconfig.hz
|
||||
|
||||
source "init/Kconfig"
|
||||
|
||||
config SYSVIPC_COMPAT
|
||||
|
@ -16,7 +16,7 @@
|
||||
#elif PAGE_SHIFT == 19
|
||||
#define SZ_BITS _PAGE_SZ512K
|
||||
#elif PAGE_SHIFT == 22
|
||||
#define SZ_BITS _PAGE_SZ4M
|
||||
#define SZ_BITS _PAGE_SZ4MB
|
||||
#endif
|
||||
|
||||
#define VALID_SZ_BITS (_PAGE_VALID | SZ_BITS)
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include <asm/mman.h>
|
||||
#include <asm/shmparam.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/ipc.h>
|
||||
|
||||
extern void do_syscall_trace(void);
|
||||
typedef int (*syscall_t)(void *a0,...);
|
||||
|
@ -120,7 +120,7 @@ static unsigned int hci_vhci_chr_poll(struct file *file, poll_table * wait)
|
||||
|
||||
poll_wait(file, &hci_vhci->read_wait, wait);
|
||||
|
||||
if (skb_queue_len(&hci_vhci->readq))
|
||||
if (!skb_queue_empty(&hci_vhci->readq))
|
||||
return POLLIN | POLLRDNORM;
|
||||
|
||||
return POLLOUT | POLLWRNORM;
|
||||
|
@ -96,3 +96,10 @@ config DRM_SIS
|
||||
chipset. If M is selected the module will be called sis. AGP
|
||||
support is required for this driver to work.
|
||||
|
||||
config DRM_VIA
|
||||
tristate "Via unichrome video cards"
|
||||
depends on DRM
|
||||
help
|
||||
Choose this option if you have a Via unichrome or compatible video
|
||||
chipset. If M is selected the module will be called via.
|
||||
|
||||
|
@ -18,10 +18,14 @@ i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o
|
||||
radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o
|
||||
ffb-objs := ffb_drv.o ffb_context.o
|
||||
sis-objs := sis_drv.o sis_ds.o sis_mm.o
|
||||
via-objs := via_irq.o via_drv.o via_ds.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o
|
||||
|
||||
ifeq ($(CONFIG_COMPAT),y)
|
||||
drm-objs += drm_ioc32.o
|
||||
radeon-objs += radeon_ioc32.o
|
||||
mga-objs += mga_ioc32.o
|
||||
r128-objs += r128_ioc32.o
|
||||
i915-objs += i915_ioc32.o
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_DRM) += drm.o
|
||||
@ -35,4 +39,5 @@ obj-$(CONFIG_DRM_I830) += i830.o
|
||||
obj-$(CONFIG_DRM_I915) += i915.o
|
||||
obj-$(CONFIG_DRM_FFB) += ffb.o
|
||||
obj-$(CONFIG_DRM_SIS) += sis.o
|
||||
obj-$(CONFIG_DRM_VIA) +=via.o
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
# define ATI_MAX_PCIGART_PAGES 8192 /**< 32 MB aperture, 4K pages */
|
||||
# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */
|
||||
|
||||
unsigned long drm_ati_alloc_pcigart_table( void )
|
||||
static unsigned long drm_ati_alloc_pcigart_table( void )
|
||||
{
|
||||
unsigned long address;
|
||||
struct page *page;
|
||||
|
@ -38,7 +38,9 @@
|
||||
#define _DRM_H_
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(__KERNEL__)
|
||||
#include <linux/config.h>
|
||||
#endif
|
||||
#include <asm/ioctl.h> /* For _IO* macros */
|
||||
#define DRM_IOCTL_NR(n) _IOC_NR(n)
|
||||
#define DRM_IOC_VOID _IOC_NONE
|
||||
|
@ -774,8 +774,6 @@ extern int drm_cpu_valid( void );
|
||||
/* Driver support (drm_drv.h) */
|
||||
extern int drm_init(struct drm_driver *driver);
|
||||
extern void drm_exit(struct drm_driver *driver);
|
||||
extern int drm_version(struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
extern int drm_ioctl(struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
extern long drm_compat_ioctl(struct file *filp,
|
||||
@ -785,28 +783,19 @@ extern int drm_takedown(drm_device_t * dev);
|
||||
/* Device support (drm_fops.h) */
|
||||
extern int drm_open(struct inode *inode, struct file *filp);
|
||||
extern int drm_stub_open(struct inode *inode, struct file *filp);
|
||||
extern int drm_open_helper(struct inode *inode, struct file *filp,
|
||||
drm_device_t *dev);
|
||||
extern int drm_flush(struct file *filp);
|
||||
extern int drm_fasync(int fd, struct file *filp, int on);
|
||||
extern int drm_release(struct inode *inode, struct file *filp);
|
||||
|
||||
/* Mapping support (drm_vm.h) */
|
||||
extern void drm_vm_open(struct vm_area_struct *vma);
|
||||
extern void drm_vm_close(struct vm_area_struct *vma);
|
||||
extern void drm_vm_shm_close(struct vm_area_struct *vma);
|
||||
extern int drm_mmap_dma(struct file *filp,
|
||||
struct vm_area_struct *vma);
|
||||
extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
|
||||
extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
|
||||
extern ssize_t drm_read(struct file *filp, char __user *buf, size_t count, loff_t *off);
|
||||
|
||||
/* Memory management support (drm_memory.h) */
|
||||
#include "drm_memory.h"
|
||||
extern void drm_mem_init(void);
|
||||
extern int drm_mem_info(char *buf, char **start, off_t offset,
|
||||
int request, int *eof, void *data);
|
||||
extern void *drm_calloc(size_t nmemb, size_t size, int area);
|
||||
extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
|
||||
int area);
|
||||
extern unsigned long drm_alloc_pages(int order, int area);
|
||||
@ -854,9 +843,6 @@ extern int drm_newctx( struct inode *inode, struct file *filp,
|
||||
extern int drm_rmctx( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
|
||||
extern int drm_context_switch(drm_device_t *dev, int old, int new);
|
||||
extern int drm_context_switch_complete(drm_device_t *dev, int new);
|
||||
|
||||
extern int drm_ctxbitmap_init( drm_device_t *dev );
|
||||
extern void drm_ctxbitmap_cleanup( drm_device_t *dev );
|
||||
extern void drm_ctxbitmap_free( drm_device_t *dev, int ctx_handle );
|
||||
@ -874,9 +860,6 @@ extern int drm_rmdraw(struct inode *inode, struct file *filp,
|
||||
|
||||
|
||||
/* Authentication IOCTL support (drm_auth.h) */
|
||||
extern int drm_add_magic(drm_device_t *dev, drm_file_t *priv,
|
||||
drm_magic_t magic);
|
||||
extern int drm_remove_magic(drm_device_t *dev, drm_magic_t magic);
|
||||
extern int drm_getmagic(struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
extern int drm_authmagic(struct inode *inode, struct file *filp,
|
||||
@ -893,13 +876,9 @@ extern int drm_unlock(struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
extern int drm_lock_take(__volatile__ unsigned int *lock,
|
||||
unsigned int context);
|
||||
extern int drm_lock_transfer(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock,
|
||||
unsigned int context);
|
||||
extern int drm_lock_free(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock,
|
||||
unsigned int context);
|
||||
extern int drm_notifier(void *priv);
|
||||
|
||||
/* Buffer management support (drm_bufs.h) */
|
||||
extern int drm_order( unsigned long size );
|
||||
@ -927,7 +906,6 @@ extern void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp);
|
||||
/* IRQ support (drm_irq.h) */
|
||||
extern int drm_control( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
extern int drm_irq_install( drm_device_t *dev );
|
||||
extern int drm_irq_uninstall( drm_device_t *dev );
|
||||
extern irqreturn_t drm_irq_handler( DRM_IRQ_ARGS );
|
||||
extern void drm_driver_irq_preinstall( drm_device_t *dev );
|
||||
@ -967,7 +945,6 @@ extern int drm_agp_unbind_memory(DRM_AGP_MEM *handle);
|
||||
extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
|
||||
struct drm_driver *driver);
|
||||
extern int drm_put_dev(drm_device_t * dev);
|
||||
extern int drm_get_head(drm_device_t * dev, drm_head_t *head);
|
||||
extern int drm_put_head(drm_head_t * head);
|
||||
extern unsigned int drm_debug;
|
||||
extern unsigned int drm_cards_limit;
|
||||
@ -1064,9 +1041,16 @@ static __inline__ void drm_free(void *pt, size_t size, int area)
|
||||
{
|
||||
kfree(pt);
|
||||
}
|
||||
|
||||
/** Wrapper around kcalloc() */
|
||||
static __inline__ void *drm_calloc(size_t nmemb, size_t size, int area)
|
||||
{
|
||||
return kcalloc(nmemb, size, GFP_KERNEL);
|
||||
}
|
||||
#else
|
||||
extern void *drm_alloc(size_t size, int area);
|
||||
extern void drm_free(void *pt, size_t size, int area);
|
||||
extern void *drm_calloc(size_t nmemb, size_t size, int area);
|
||||
#endif
|
||||
|
||||
/*@}*/
|
||||
|
@ -87,7 +87,7 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic)
|
||||
* associated the magic number hash key in drm_device::magiclist, while holding
|
||||
* the drm_device::struct_sem lock.
|
||||
*/
|
||||
int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
||||
static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
||||
{
|
||||
int hash;
|
||||
drm_magic_entry_t *entry;
|
||||
@ -124,7 +124,7 @@ int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
||||
* Searches and unlinks the entry in drm_device::magiclist with the magic
|
||||
* number hash key, while holding the drm_device::struct_sem lock.
|
||||
*/
|
||||
int drm_remove_magic(drm_device_t *dev, drm_magic_t magic)
|
||||
static int drm_remove_magic(drm_device_t *dev, drm_magic_t magic)
|
||||
{
|
||||
drm_magic_entry_t *prev = NULL;
|
||||
drm_magic_entry_t *pt;
|
||||
|
@ -356,7 +356,7 @@ static void drm_cleanup_buf_error(drm_device_t *dev, drm_buf_entry_t *entry)
|
||||
* reallocates the buffer list of the same size order to accommodate the new
|
||||
* buffers.
|
||||
*/
|
||||
int drm_addbufs_agp( struct inode *inode, struct file *filp,
|
||||
static int drm_addbufs_agp( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
@ -521,7 +521,7 @@ int drm_addbufs_agp( struct inode *inode, struct file *filp,
|
||||
}
|
||||
#endif /* __OS_HAS_AGP */
|
||||
|
||||
int drm_addbufs_pci( struct inode *inode, struct file *filp,
|
||||
static int drm_addbufs_pci( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
@ -751,7 +751,7 @@ int drm_addbufs_pci( struct inode *inode, struct file *filp,
|
||||
|
||||
}
|
||||
|
||||
int drm_addbufs_sg( struct inode *inode, struct file *filp,
|
||||
static int drm_addbufs_sg( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
|
@ -84,7 +84,7 @@ failed:
|
||||
* drm_device::context_sareas to accommodate the new entry while holding the
|
||||
* drm_device::struct_sem lock.
|
||||
*/
|
||||
int drm_ctxbitmap_next( drm_device_t *dev )
|
||||
static int drm_ctxbitmap_next( drm_device_t *dev )
|
||||
{
|
||||
int bit;
|
||||
|
||||
@ -326,7 +326,7 @@ int drm_context_switch( drm_device_t *dev, int old, int new )
|
||||
* hardware lock is held, clears the drm_device::context_flag and wakes up
|
||||
* drm_device::context_wait.
|
||||
*/
|
||||
int drm_context_switch_complete( drm_device_t *dev, int new )
|
||||
static int drm_context_switch_complete( drm_device_t *dev, int new )
|
||||
{
|
||||
dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
|
||||
dev->last_switch = jiffies;
|
||||
|
@ -51,8 +51,11 @@
|
||||
#include "drmP.h"
|
||||
#include "drm_core.h"
|
||||
|
||||
static int drm_version(struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
|
||||
/** Ioctl table */
|
||||
drm_ioctl_desc_t drm_ioctls[] = {
|
||||
static drm_ioctl_desc_t drm_ioctls[] = {
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { drm_version, 0, 0 },
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 },
|
||||
[DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 },
|
||||
@ -447,7 +450,7 @@ module_exit( drm_core_exit );
|
||||
*
|
||||
* Fills in the version information in \p arg.
|
||||
*/
|
||||
int drm_version( struct inode *inode, struct file *filp,
|
||||
static int drm_version( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg )
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
|
@ -37,6 +37,8 @@
|
||||
#include "drmP.h"
|
||||
#include <linux/poll.h>
|
||||
|
||||
static int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev);
|
||||
|
||||
static int drm_setup( drm_device_t *dev )
|
||||
{
|
||||
int i;
|
||||
@ -251,7 +253,7 @@ int drm_release( struct inode *inode, struct file *filp )
|
||||
}
|
||||
}
|
||||
|
||||
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
|
||||
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && !dev->driver->release)
|
||||
{
|
||||
dev->driver->reclaim_buffers(dev, filp);
|
||||
}
|
||||
@ -259,7 +261,7 @@ int drm_release( struct inode *inode, struct file *filp )
|
||||
drm_fasync( -1, filp, 0 );
|
||||
|
||||
down( &dev->ctxlist_sem );
|
||||
if ( !list_empty( &dev->ctxlist->head ) ) {
|
||||
if ( dev->ctxlist && (!list_empty(&dev->ctxlist->head))) {
|
||||
drm_ctx_list_t *pos, *n;
|
||||
|
||||
list_for_each_entry_safe( pos, n, &dev->ctxlist->head, head ) {
|
||||
@ -341,7 +343,7 @@ EXPORT_SYMBOL(drm_release);
|
||||
* Creates and initializes a drm_file structure for the file private data in \p
|
||||
* filp and add it into the double linked list in \p dev.
|
||||
*/
|
||||
int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev)
|
||||
static int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev)
|
||||
{
|
||||
int minor = iminor(inode);
|
||||
drm_file_t *priv;
|
||||
@ -443,9 +445,3 @@ unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait)
|
||||
}
|
||||
EXPORT_SYMBOL(drm_poll);
|
||||
|
||||
|
||||
/** No-op. */
|
||||
ssize_t drm_read(struct file *filp, char __user *buf, size_t count, loff_t *off)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp,
|
||||
* \c drm_driver_irq_preinstall() and \c drm_driver_irq_postinstall() functions
|
||||
* before and after the installation.
|
||||
*/
|
||||
int drm_irq_install( drm_device_t *dev )
|
||||
static int drm_irq_install( drm_device_t *dev )
|
||||
{
|
||||
int ret;
|
||||
unsigned long sh_flags=0;
|
||||
|
@ -35,6 +35,11 @@
|
||||
|
||||
#include "drmP.h"
|
||||
|
||||
static int drm_lock_transfer(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock,
|
||||
unsigned int context);
|
||||
static int drm_notifier(void *priv);
|
||||
|
||||
/**
|
||||
* Lock ioctl.
|
||||
*
|
||||
@ -225,8 +230,9 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
|
||||
* Resets the lock file pointer.
|
||||
* Marks the lock as held by the given context, via the \p cmpxchg instruction.
|
||||
*/
|
||||
int drm_lock_transfer(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock, unsigned int context)
|
||||
static int drm_lock_transfer(drm_device_t *dev,
|
||||
__volatile__ unsigned int *lock,
|
||||
unsigned int context)
|
||||
{
|
||||
unsigned int old, new, prev;
|
||||
|
||||
@ -282,7 +288,7 @@ int drm_lock_free(drm_device_t *dev,
|
||||
* \return one if the signal should be delivered normally, or zero if the
|
||||
* signal should be blocked.
|
||||
*/
|
||||
int drm_notifier(void *priv)
|
||||
static int drm_notifier(void *priv)
|
||||
{
|
||||
drm_sigdata_t *s = (drm_sigdata_t *)priv;
|
||||
unsigned int old, new, prev;
|
||||
|
@ -65,19 +65,6 @@ int drm_mem_info(char *buf, char **start, off_t offset,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Wrapper around kmalloc() */
|
||||
void *drm_calloc(size_t nmemb, size_t size, int area)
|
||||
{
|
||||
void *addr;
|
||||
|
||||
addr = kmalloc(size * nmemb, GFP_KERNEL);
|
||||
if (addr != NULL)
|
||||
memset((void *)addr, 0, size * nmemb);
|
||||
|
||||
return addr;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_calloc);
|
||||
|
||||
/** Wrapper around kmalloc() and kfree() */
|
||||
void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
|
||||
{
|
||||
|
@ -223,3 +223,10 @@
|
||||
{0x8086, 0x2772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
|
||||
{0, 0, 0}
|
||||
|
||||
#define viadrv_PCI_IDS \
|
||||
{0x1106, 0x3022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
|
||||
{0x1106, 0x3122, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
|
||||
{0x1106, 0x7205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
|
||||
{0x1106, 0x7204, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
|
||||
{0, 0, 0}
|
||||
|
||||
|
@ -57,7 +57,7 @@ static int drm_vma_info(char *buf, char **start, off_t offset,
|
||||
/**
|
||||
* Proc file list.
|
||||
*/
|
||||
struct drm_proc_list {
|
||||
static struct drm_proc_list {
|
||||
const char *name; /**< file name */
|
||||
int (*f)(char *, char **, off_t, int, int *, void *); /**< proc callback*/
|
||||
} drm_proc_list[] = {
|
||||
|
@ -157,52 +157,6 @@ int drm_stub_open(struct inode *inode, struct file *filp)
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register.
|
||||
*
|
||||
* \param pdev - PCI device structure
|
||||
* \param ent entry from the PCI ID table with device type flags
|
||||
* \return zero on success or a negative number on failure.
|
||||
*
|
||||
* Attempt to gets inter module "drm" information. If we are first
|
||||
* then register the character device and inter module information.
|
||||
* Try and register, if we fail to register, backout previous work.
|
||||
*/
|
||||
int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
|
||||
struct drm_driver *driver)
|
||||
{
|
||||
drm_device_t *dev;
|
||||
int ret;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
dev = drm_calloc(1, sizeof(*dev), DRM_MEM_STUB);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
pci_enable_device(pdev);
|
||||
|
||||
if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
|
||||
printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
|
||||
goto err_g1;
|
||||
}
|
||||
if ((ret = drm_get_head(dev, &dev->primary)))
|
||||
goto err_g1;
|
||||
|
||||
/* postinit is a required function to display the signon banner */
|
||||
/* drivers add secondary heads here if needed */
|
||||
if ((ret = dev->driver->postinit(dev, ent->driver_data)))
|
||||
goto err_g1;
|
||||
|
||||
return 0;
|
||||
|
||||
err_g1:
|
||||
drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_get_dev);
|
||||
|
||||
/**
|
||||
* Get a secondary minor number.
|
||||
*
|
||||
@ -214,7 +168,7 @@ EXPORT_SYMBOL(drm_get_dev);
|
||||
* create the proc init entry via proc_init(). This routines assigns
|
||||
* minor numbers to secondary heads of multi-headed cards
|
||||
*/
|
||||
int drm_get_head(drm_device_t *dev, drm_head_t *head)
|
||||
static int drm_get_head(drm_device_t *dev, drm_head_t *head)
|
||||
{
|
||||
drm_head_t **heads = drm_heads;
|
||||
int ret;
|
||||
@ -262,6 +216,50 @@ err_g1:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register.
|
||||
*
|
||||
* \param pdev - PCI device structure
|
||||
* \param ent entry from the PCI ID table with device type flags
|
||||
* \return zero on success or a negative number on failure.
|
||||
*
|
||||
* Attempt to gets inter module "drm" information. If we are first
|
||||
* then register the character device and inter module information.
|
||||
* Try and register, if we fail to register, backout previous work.
|
||||
*/
|
||||
int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
|
||||
struct drm_driver *driver)
|
||||
{
|
||||
drm_device_t *dev;
|
||||
int ret;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
dev = drm_calloc(1, sizeof(*dev), DRM_MEM_STUB);
|
||||
if (!dev)
|
||||
return -ENOMEM;
|
||||
|
||||
pci_enable_device(pdev);
|
||||
|
||||
if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
|
||||
printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
|
||||
goto err_g1;
|
||||
}
|
||||
if ((ret = drm_get_head(dev, &dev->primary)))
|
||||
goto err_g1;
|
||||
|
||||
/* postinit is a required function to display the signon banner */
|
||||
/* drivers add secondary heads here if needed */
|
||||
if ((ret = dev->driver->postinit(dev, ent->driver_data)))
|
||||
goto err_g1;
|
||||
|
||||
return 0;
|
||||
|
||||
err_g1:
|
||||
drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_get_dev);
|
||||
|
||||
/**
|
||||
* Put a device minor number.
|
||||
|
@ -38,6 +38,8 @@
|
||||
#include <linux/efi.h>
|
||||
#endif
|
||||
|
||||
static void drm_vm_open(struct vm_area_struct *vma);
|
||||
static void drm_vm_close(struct vm_area_struct *vma);
|
||||
|
||||
/**
|
||||
* \c nopage method for AGP virtual memory.
|
||||
@ -163,7 +165,7 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
|
||||
* Deletes map information if we are the last
|
||||
* person to close a mapping and it's not in the global maplist.
|
||||
*/
|
||||
void drm_vm_shm_close(struct vm_area_struct *vma)
|
||||
static void drm_vm_shm_close(struct vm_area_struct *vma)
|
||||
{
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
drm_device_t *dev = priv->head->dev;
|
||||
@ -399,7 +401,7 @@ static struct vm_operations_struct drm_vm_sg_ops = {
|
||||
* Create a new drm_vma_entry structure as the \p vma private data entry and
|
||||
* add it to drm_device::vmalist.
|
||||
*/
|
||||
void drm_vm_open(struct vm_area_struct *vma)
|
||||
static void drm_vm_open(struct vm_area_struct *vma)
|
||||
{
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
drm_device_t *dev = priv->head->dev;
|
||||
@ -428,7 +430,7 @@ void drm_vm_open(struct vm_area_struct *vma)
|
||||
* Search the \p vma private data entry in drm_device::vmalist, unlink it, and
|
||||
* free it.
|
||||
*/
|
||||
void drm_vm_close(struct vm_area_struct *vma)
|
||||
static void drm_vm_close(struct vm_area_struct *vma)
|
||||
{
|
||||
drm_file_t *priv = vma->vm_file->private_data;
|
||||
drm_device_t *dev = priv->head->dev;
|
||||
@ -463,7 +465,7 @@ void drm_vm_close(struct vm_area_struct *vma)
|
||||
* Sets the virtual memory area operations structure to vm_dma_ops, the file
|
||||
* pointer, and calls vm_open().
|
||||
*/
|
||||
int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
|
||||
static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev;
|
||||
|
@ -90,16 +90,7 @@ static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations i810_buffer_fops = {
|
||||
.open = drm_open,
|
||||
.flush = drm_flush,
|
||||
.release = drm_release,
|
||||
.ioctl = drm_ioctl,
|
||||
.mmap = i810_mmap_buffers,
|
||||
.fasync = drm_fasync,
|
||||
};
|
||||
|
||||
int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
||||
static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev;
|
||||
@ -126,6 +117,15 @@ int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations i810_buffer_fops = {
|
||||
.open = drm_open,
|
||||
.flush = drm_flush,
|
||||
.release = drm_release,
|
||||
.ioctl = drm_ioctl,
|
||||
.mmap = i810_mmap_buffers,
|
||||
.fasync = drm_fasync,
|
||||
};
|
||||
|
||||
static int i810_map_buffer(drm_buf_t *buf, struct file *filp)
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
@ -1003,7 +1003,7 @@ void i810_reclaim_buffers(drm_device_t *dev, struct file *filp)
|
||||
}
|
||||
}
|
||||
|
||||
int i810_flush_ioctl(struct inode *inode, struct file *filp,
|
||||
static int i810_flush_ioctl(struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
|
@ -115,7 +115,6 @@ typedef struct drm_i810_private {
|
||||
|
||||
/* i810_dma.c */
|
||||
extern void i810_reclaim_buffers(drm_device_t *dev, struct file *filp);
|
||||
extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
|
||||
|
||||
extern int i810_driver_dma_quiescent(drm_device_t *dev);
|
||||
extern void i810_driver_release(drm_device_t *dev, struct file *filp);
|
||||
|
@ -92,16 +92,7 @@ static int i830_freelist_put(drm_device_t *dev, drm_buf_t *buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations i830_buffer_fops = {
|
||||
.open = drm_open,
|
||||
.flush = drm_flush,
|
||||
.release = drm_release,
|
||||
.ioctl = drm_ioctl,
|
||||
.mmap = i830_mmap_buffers,
|
||||
.fasync = drm_fasync,
|
||||
};
|
||||
|
||||
int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
||||
static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev;
|
||||
@ -128,6 +119,15 @@ int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct file_operations i830_buffer_fops = {
|
||||
.open = drm_open,
|
||||
.flush = drm_flush,
|
||||
.release = drm_release,
|
||||
.ioctl = drm_ioctl,
|
||||
.mmap = i830_mmap_buffers,
|
||||
.fasync = drm_fasync,
|
||||
};
|
||||
|
||||
static int i830_map_buffer(drm_buf_t *buf, struct file *filp)
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
#include "drm_pciids.h"
|
||||
|
||||
int postinit( struct drm_device *dev, unsigned long flags )
|
||||
static int postinit( struct drm_device *dev, unsigned long flags )
|
||||
{
|
||||
dev->counters += 4;
|
||||
dev->types[6] = _DRM_STAT_IRQ;
|
||||
|
@ -123,8 +123,6 @@ typedef struct drm_i830_private {
|
||||
/* i830_dma.c */
|
||||
extern void i830_reclaim_buffers(drm_device_t *dev, struct file *filp);
|
||||
|
||||
extern int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma);
|
||||
|
||||
/* i830_irq.c */
|
||||
extern int i830_irq_emit( struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg );
|
||||
|
@ -54,8 +54,7 @@ irqreturn_t i830_driver_irq_handler( DRM_IRQ_ARGS )
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
||||
int i830_emit_irq(drm_device_t *dev)
|
||||
static int i830_emit_irq(drm_device_t *dev)
|
||||
{
|
||||
drm_i830_private_t *dev_priv = dev->dev_private;
|
||||
RING_LOCALS;
|
||||
@ -73,7 +72,7 @@ int i830_emit_irq(drm_device_t *dev)
|
||||
}
|
||||
|
||||
|
||||
int i830_wait_irq(drm_device_t *dev, int irq_nr)
|
||||
static int i830_wait_irq(drm_device_t *dev, int irq_nr)
|
||||
{
|
||||
drm_i830_private_t *dev_priv =
|
||||
(drm_i830_private_t *)dev->dev_private;
|
||||
|
@ -32,23 +32,6 @@
|
||||
#include "i915_drm.h"
|
||||
#include "i915_drv.h"
|
||||
|
||||
drm_ioctl_desc_t i915_ioctls[] = {
|
||||
[DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, 1, 0}
|
||||
};
|
||||
|
||||
int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
|
||||
|
||||
/* Really want an OS-independent resettable timer. Would like to have
|
||||
* this loop run for (eg) 3 sec, but have the timer reset every time
|
||||
* the head pointer changes, so that EBUSY only happens if the ring
|
||||
@ -95,7 +78,7 @@ void i915_kernel_lost_context(drm_device_t * dev)
|
||||
dev_priv->sarea_priv->perf_boxes |= I915_BOX_RING_EMPTY;
|
||||
}
|
||||
|
||||
int i915_dma_cleanup(drm_device_t * dev)
|
||||
static int i915_dma_cleanup(drm_device_t * dev)
|
||||
{
|
||||
/* Make sure interrupts are disabled here because the uninstall ioctl
|
||||
* may not have been called from userspace and after dev_private
|
||||
@ -247,7 +230,7 @@ static int i915_resume(drm_device_t * dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i915_dma_init(DRM_IOCTL_ARGS)
|
||||
static int i915_dma_init(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_i915_private_t *dev_priv;
|
||||
@ -558,7 +541,7 @@ static int i915_quiescent(drm_device_t * dev)
|
||||
return i915_wait_ring(dev, dev_priv->ring.Size - 8, __FUNCTION__);
|
||||
}
|
||||
|
||||
int i915_flush_ioctl(DRM_IOCTL_ARGS)
|
||||
static int i915_flush_ioctl(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
|
||||
@ -567,7 +550,7 @@ int i915_flush_ioctl(DRM_IOCTL_ARGS)
|
||||
return i915_quiescent(dev);
|
||||
}
|
||||
|
||||
int i915_batchbuffer(DRM_IOCTL_ARGS)
|
||||
static int i915_batchbuffer(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
|
||||
@ -601,7 +584,7 @@ int i915_batchbuffer(DRM_IOCTL_ARGS)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int i915_cmdbuffer(DRM_IOCTL_ARGS)
|
||||
static int i915_cmdbuffer(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
|
||||
@ -637,18 +620,7 @@ int i915_cmdbuffer(DRM_IOCTL_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i915_do_cleanup_pageflip(drm_device_t * dev)
|
||||
{
|
||||
drm_i915_private_t *dev_priv = dev->dev_private;
|
||||
|
||||
DRM_DEBUG("%s\n", __FUNCTION__);
|
||||
if (dev_priv->current_page != 0)
|
||||
i915_dispatch_flip(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i915_flip_bufs(DRM_IOCTL_ARGS)
|
||||
static int i915_flip_bufs(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
|
||||
@ -659,7 +631,7 @@ int i915_flip_bufs(DRM_IOCTL_ARGS)
|
||||
return i915_dispatch_flip(dev);
|
||||
}
|
||||
|
||||
int i915_getparam(DRM_IOCTL_ARGS)
|
||||
static int i915_getparam(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_i915_private_t *dev_priv = dev->dev_private;
|
||||
@ -694,7 +666,7 @@ int i915_getparam(DRM_IOCTL_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i915_setparam(DRM_IOCTL_ARGS)
|
||||
static int i915_setparam(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_i915_private_t *dev_priv = dev->dev_private;
|
||||
@ -743,3 +715,19 @@ void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp)
|
||||
}
|
||||
}
|
||||
|
||||
drm_ioctl_desc_t i915_ioctls[] = {
|
||||
[DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, 1, 1},
|
||||
[DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, 1, 0}
|
||||
};
|
||||
|
||||
int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include "drm_pciids.h"
|
||||
|
||||
int postinit( struct drm_device *dev, unsigned long flags )
|
||||
static int postinit( struct drm_device *dev, unsigned long flags )
|
||||
{
|
||||
dev->counters += 4;
|
||||
dev->types[6] = _DRM_STAT_IRQ;
|
||||
@ -97,6 +97,9 @@ static struct drm_driver driver = {
|
||||
.mmap = drm_mmap,
|
||||
.poll = drm_poll,
|
||||
.fasync = drm_fasync,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = i915_compat_ioctl,
|
||||
#endif
|
||||
},
|
||||
.pci_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
|
@ -99,14 +99,6 @@ typedef struct drm_i915_private {
|
||||
} drm_i915_private_t;
|
||||
|
||||
/* i915_dma.c */
|
||||
extern int i915_dma_init(DRM_IOCTL_ARGS);
|
||||
extern int i915_dma_cleanup(drm_device_t * dev);
|
||||
extern int i915_flush_ioctl(DRM_IOCTL_ARGS);
|
||||
extern int i915_batchbuffer(DRM_IOCTL_ARGS);
|
||||
extern int i915_flip_bufs(DRM_IOCTL_ARGS);
|
||||
extern int i915_getparam(DRM_IOCTL_ARGS);
|
||||
extern int i915_setparam(DRM_IOCTL_ARGS);
|
||||
extern int i915_cmdbuffer(DRM_IOCTL_ARGS);
|
||||
extern void i915_kernel_lost_context(drm_device_t * dev);
|
||||
extern void i915_driver_pretakedown(drm_device_t *dev);
|
||||
extern void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp);
|
||||
@ -114,8 +106,6 @@ extern void i915_driver_prerelease(drm_device_t *dev, DRMFILE filp);
|
||||
/* i915_irq.c */
|
||||
extern int i915_irq_emit(DRM_IOCTL_ARGS);
|
||||
extern int i915_irq_wait(DRM_IOCTL_ARGS);
|
||||
extern int i915_wait_irq(drm_device_t * dev, int irq_nr);
|
||||
extern int i915_emit_irq(drm_device_t * dev);
|
||||
|
||||
extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS);
|
||||
extern void i915_driver_irq_preinstall(drm_device_t *dev);
|
||||
@ -130,6 +120,10 @@ extern void i915_mem_takedown(struct mem_block **heap);
|
||||
extern void i915_mem_release(drm_device_t * dev,
|
||||
DRMFILE filp, struct mem_block *heap);
|
||||
|
||||
extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg);
|
||||
|
||||
|
||||
#define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, reg)
|
||||
#define I915_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, reg, val)
|
||||
#define I915_READ16(reg) DRM_READ16(dev_priv->mmio_map, reg)
|
||||
|
221
drivers/char/drm/i915_ioc32.c
Normal file
221
drivers/char/drm/i915_ioc32.c
Normal file
@ -0,0 +1,221 @@
|
||||
/**
|
||||
* \file i915_ioc32.c
|
||||
*
|
||||
* 32-bit ioctl compatibility routines for the i915 DRM.
|
||||
*
|
||||
* \author Alan Hourihane <alanh@fairlite.demon.co.uk>
|
||||
*
|
||||
*
|
||||
* Copyright (C) Paul Mackerras 2005
|
||||
* Copyright (C) Alan Hourihane 2005
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
#include <linux/compat.h>
|
||||
#include <linux/ioctl32.h>
|
||||
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
#include "i915_drm.h"
|
||||
|
||||
typedef struct _drm_i915_batchbuffer32 {
|
||||
int start; /* agp offset */
|
||||
int used; /* nr bytes in use */
|
||||
int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
|
||||
int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
|
||||
int num_cliprects; /* mulitpass with multiple cliprects? */
|
||||
u32 cliprects; /* pointer to userspace cliprects */
|
||||
} drm_i915_batchbuffer32_t;
|
||||
|
||||
static int compat_i915_batchbuffer(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_i915_batchbuffer32_t batchbuffer32;
|
||||
drm_i915_batchbuffer_t __user *batchbuffer;
|
||||
|
||||
if (copy_from_user(&batchbuffer32, (void __user *)arg, sizeof(batchbuffer32)))
|
||||
return -EFAULT;
|
||||
|
||||
batchbuffer = compat_alloc_user_space(sizeof(*batchbuffer));
|
||||
if (!access_ok(VERIFY_WRITE, batchbuffer, sizeof(*batchbuffer))
|
||||
|| __put_user(batchbuffer32.start, &batchbuffer->start)
|
||||
|| __put_user(batchbuffer32.used, &batchbuffer->used)
|
||||
|| __put_user(batchbuffer32.DR1, &batchbuffer->DR1)
|
||||
|| __put_user(batchbuffer32.DR4, &batchbuffer->DR4)
|
||||
|| __put_user(batchbuffer32.num_cliprects, &batchbuffer->num_cliprects)
|
||||
|| __put_user((int __user *)(unsigned long)batchbuffer32.cliprects,
|
||||
&batchbuffer->cliprects))
|
||||
return -EFAULT;
|
||||
|
||||
return drm_ioctl(file->f_dentry->d_inode, file,
|
||||
DRM_IOCTL_I915_BATCHBUFFER, (unsigned long) batchbuffer);
|
||||
}
|
||||
|
||||
typedef struct _drm_i915_cmdbuffer32 {
|
||||
u32 buf; /* pointer to userspace command buffer */
|
||||
int sz; /* nr bytes in buf */
|
||||
int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
|
||||
int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
|
||||
int num_cliprects; /* mulitpass with multiple cliprects? */
|
||||
u32 cliprects; /* pointer to userspace cliprects */
|
||||
} drm_i915_cmdbuffer32_t;
|
||||
|
||||
static int compat_i915_cmdbuffer(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_i915_cmdbuffer32_t cmdbuffer32;
|
||||
drm_i915_cmdbuffer_t __user *cmdbuffer;
|
||||
|
||||
if (copy_from_user(&cmdbuffer32, (void __user *)arg, sizeof(cmdbuffer32)))
|
||||
return -EFAULT;
|
||||
|
||||
cmdbuffer = compat_alloc_user_space(sizeof(*cmdbuffer));
|
||||
if (!access_ok(VERIFY_WRITE, cmdbuffer, sizeof(*cmdbuffer))
|
||||
|| __put_user((int __user *)(unsigned long)cmdbuffer32.buf,
|
||||
&cmdbuffer->buf)
|
||||
|| __put_user(cmdbuffer32.sz, &cmdbuffer->sz)
|
||||
|| __put_user(cmdbuffer32.DR1, &cmdbuffer->DR1)
|
||||
|| __put_user(cmdbuffer32.DR4, &cmdbuffer->DR4)
|
||||
|| __put_user(cmdbuffer32.num_cliprects, &cmdbuffer->num_cliprects)
|
||||
|| __put_user((int __user *)(unsigned long)cmdbuffer32.cliprects,
|
||||
&cmdbuffer->cliprects))
|
||||
return -EFAULT;
|
||||
|
||||
return drm_ioctl(file->f_dentry->d_inode, file,
|
||||
DRM_IOCTL_I915_CMDBUFFER, (unsigned long) cmdbuffer);
|
||||
}
|
||||
|
||||
typedef struct drm_i915_irq_emit32 {
|
||||
u32 irq_seq;
|
||||
} drm_i915_irq_emit32_t;
|
||||
|
||||
static int compat_i915_irq_emit(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_i915_irq_emit32_t req32;
|
||||
drm_i915_irq_emit_t __user *request;
|
||||
|
||||
if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
|
||||
return -EFAULT;
|
||||
|
||||
request = compat_alloc_user_space(sizeof(*request));
|
||||
if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
|
||||
|| __put_user((int __user *)(unsigned long)req32.irq_seq,
|
||||
&request->irq_seq))
|
||||
return -EFAULT;
|
||||
|
||||
return drm_ioctl(file->f_dentry->d_inode, file,
|
||||
DRM_IOCTL_I915_IRQ_EMIT, (unsigned long) request);
|
||||
}
|
||||
typedef struct drm_i915_getparam32 {
|
||||
int param;
|
||||
u32 value;
|
||||
} drm_i915_getparam32_t;
|
||||
|
||||
static int compat_i915_getparam(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_i915_getparam32_t req32;
|
||||
drm_i915_getparam_t __user *request;
|
||||
|
||||
if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
|
||||
return -EFAULT;
|
||||
|
||||
request = compat_alloc_user_space(sizeof(*request));
|
||||
if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
|
||||
|| __put_user(req32.param, &request->param)
|
||||
|| __put_user((void __user *)(unsigned long)req32.value,
|
||||
&request->value))
|
||||
return -EFAULT;
|
||||
|
||||
return drm_ioctl(file->f_dentry->d_inode, file,
|
||||
DRM_IOCTL_I915_GETPARAM, (unsigned long) request);
|
||||
}
|
||||
|
||||
typedef struct drm_i915_mem_alloc32 {
|
||||
int region;
|
||||
int alignment;
|
||||
int size;
|
||||
u32 region_offset; /* offset from start of fb or agp */
|
||||
} drm_i915_mem_alloc32_t;
|
||||
|
||||
static int compat_i915_alloc(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_i915_mem_alloc32_t req32;
|
||||
drm_i915_mem_alloc_t __user *request;
|
||||
|
||||
if (copy_from_user(&req32, (void __user *) arg, sizeof(req32)))
|
||||
return -EFAULT;
|
||||
|
||||
request = compat_alloc_user_space(sizeof(*request));
|
||||
if (!access_ok(VERIFY_WRITE, request, sizeof(*request))
|
||||
|| __put_user(req32.region, &request->region)
|
||||
|| __put_user(req32.alignment, &request->alignment)
|
||||
|| __put_user(req32.size, &request->size)
|
||||
|| __put_user((void __user *)(unsigned long)req32.region_offset,
|
||||
&request->region_offset))
|
||||
return -EFAULT;
|
||||
|
||||
return drm_ioctl(file->f_dentry->d_inode, file,
|
||||
DRM_IOCTL_I915_ALLOC, (unsigned long) request);
|
||||
}
|
||||
|
||||
|
||||
drm_ioctl_compat_t *i915_compat_ioctls[] = {
|
||||
[DRM_I915_BATCHBUFFER] = compat_i915_batchbuffer,
|
||||
[DRM_I915_CMDBUFFER] = compat_i915_cmdbuffer,
|
||||
[DRM_I915_GETPARAM] = compat_i915_getparam,
|
||||
[DRM_I915_IRQ_EMIT] = compat_i915_irq_emit,
|
||||
[DRM_I915_ALLOC] = compat_i915_alloc
|
||||
};
|
||||
|
||||
/**
|
||||
* Called whenever a 32-bit process running under a 64-bit kernel
|
||||
* performs an ioctl on /dev/dri/card<n>.
|
||||
*
|
||||
* \param filp file pointer.
|
||||
* \param cmd command.
|
||||
* \param arg user argument.
|
||||
* \return zero on success or negative number on failure.
|
||||
*/
|
||||
long i915_compat_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
unsigned int nr = DRM_IOCTL_NR(cmd);
|
||||
drm_ioctl_compat_t *fn = NULL;
|
||||
int ret;
|
||||
|
||||
if (nr < DRM_COMMAND_BASE)
|
||||
return drm_compat_ioctl(filp, cmd, arg);
|
||||
|
||||
if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(i915_compat_ioctls))
|
||||
fn = i915_compat_ioctls[nr - DRM_COMMAND_BASE];
|
||||
|
||||
lock_kernel(); /* XXX for now */
|
||||
if (fn != NULL)
|
||||
ret = (*fn)(filp, cmd, arg);
|
||||
else
|
||||
ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
|
||||
unlock_kernel();
|
||||
|
||||
return ret;
|
||||
}
|
@ -56,7 +56,7 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
int i915_emit_irq(drm_device_t * dev)
|
||||
static int i915_emit_irq(drm_device_t * dev)
|
||||
{
|
||||
drm_i915_private_t *dev_priv = dev->dev_private;
|
||||
u32 ret;
|
||||
@ -76,7 +76,7 @@ int i915_emit_irq(drm_device_t * dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int i915_wait_irq(drm_device_t * dev, int irq_nr)
|
||||
static int i915_wait_irq(drm_device_t * dev, int irq_nr)
|
||||
{
|
||||
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
|
||||
int ret = 0;
|
||||
|
@ -101,6 +101,9 @@ static struct drm_driver driver = {
|
||||
.mmap = drm_mmap,
|
||||
.poll = drm_poll,
|
||||
.fasync = drm_fasync,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = mga_compat_ioctl,
|
||||
#endif
|
||||
},
|
||||
.pci_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
|
@ -137,6 +137,8 @@ extern irqreturn_t mga_driver_irq_handler( DRM_IRQ_ARGS );
|
||||
extern void mga_driver_irq_preinstall( drm_device_t *dev );
|
||||
extern void mga_driver_irq_postinstall( drm_device_t *dev );
|
||||
extern void mga_driver_irq_uninstall( drm_device_t *dev );
|
||||
extern long mga_compat_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg);
|
||||
|
||||
#define mga_flush_write_combine() DRM_WRITEMEMORYBARRIER()
|
||||
|
||||
|
167
drivers/char/drm/mga_ioc32.c
Normal file
167
drivers/char/drm/mga_ioc32.c
Normal file
@ -0,0 +1,167 @@
|
||||
/**
|
||||
* \file mga_ioc32.c
|
||||
*
|
||||
* 32-bit ioctl compatibility routines for the MGA DRM.
|
||||
*
|
||||
* \author Dave Airlie <airlied@linux.ie> with code from patches by Egbert Eich
|
||||
*
|
||||
*
|
||||
* Copyright (C) Paul Mackerras 2005
|
||||
* Copyright (C) Egbert Eich 2003,2004
|
||||
* Copyright (C) Dave Airlie 2005
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
#include <linux/compat.h>
|
||||
#include <linux/ioctl32.h>
|
||||
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
#include "mga_drm.h"
|
||||
|
||||
typedef struct drm32_mga_init {
|
||||
int func;
|
||||
u32 sarea_priv_offset;
|
||||
int chipset;
|
||||
int sgram;
|
||||
unsigned int maccess;
|
||||
unsigned int fb_cpp;
|
||||
unsigned int front_offset, front_pitch;
|
||||
unsigned int back_offset, back_pitch;
|
||||
unsigned int depth_cpp;
|
||||
unsigned int depth_offset, depth_pitch;
|
||||
unsigned int texture_offset[MGA_NR_TEX_HEAPS];
|
||||
unsigned int texture_size[MGA_NR_TEX_HEAPS];
|
||||
u32 fb_offset;
|
||||
u32 mmio_offset;
|
||||
u32 status_offset;
|
||||
u32 warp_offset;
|
||||
u32 primary_offset;
|
||||
u32 buffers_offset;
|
||||
} drm_mga_init32_t;
|
||||
|
||||
static int compat_mga_init(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_mga_init32_t init32;
|
||||
drm_mga_init_t __user *init;
|
||||
int err = 0, i;
|
||||
|
||||
if (copy_from_user(&init32, (void __user *)arg, sizeof(init32)))
|
||||
return -EFAULT;
|
||||
|
||||
init = compat_alloc_user_space(sizeof(*init));
|
||||
if (!access_ok(VERIFY_WRITE, init, sizeof(*init))
|
||||
|| __put_user(init32.func, &init->func)
|
||||
|| __put_user(init32.sarea_priv_offset, &init->sarea_priv_offset)
|
||||
|| __put_user(init32.chipset, &init->chipset)
|
||||
|| __put_user(init32.sgram, &init->sgram)
|
||||
|| __put_user(init32.maccess, &init->maccess)
|
||||
|| __put_user(init32.fb_cpp, &init->fb_cpp)
|
||||
|| __put_user(init32.front_offset, &init->front_offset)
|
||||
|| __put_user(init32.front_pitch, &init->front_pitch)
|
||||
|| __put_user(init32.back_offset, &init->back_offset)
|
||||
|| __put_user(init32.back_pitch, &init->back_pitch)
|
||||
|| __put_user(init32.depth_cpp, &init->depth_cpp)
|
||||
|| __put_user(init32.depth_offset, &init->depth_offset)
|
||||
|| __put_user(init32.depth_pitch, &init->depth_pitch)
|
||||
|| __put_user(init32.fb_offset, &init->fb_offset)
|
||||
|| __put_user(init32.mmio_offset, &init->mmio_offset)
|
||||
|| __put_user(init32.status_offset, &init->status_offset)
|
||||
|| __put_user(init32.warp_offset, &init->warp_offset)
|
||||
|| __put_user(init32.primary_offset, &init->primary_offset)
|
||||
|| __put_user(init32.buffers_offset, &init->buffers_offset))
|
||||
return -EFAULT;
|
||||
|
||||
for (i=0; i<MGA_NR_TEX_HEAPS; i++)
|
||||
{
|
||||
err |= __put_user(init32.texture_offset[i], &init->texture_offset[i]);
|
||||
err |= __put_user(init32.texture_size[i], &init->texture_size[i]);
|
||||
}
|
||||
if (err)
|
||||
return -EFAULT;
|
||||
|
||||
return drm_ioctl(file->f_dentry->d_inode, file,
|
||||
DRM_IOCTL_MGA_INIT, (unsigned long) init);
|
||||
}
|
||||
|
||||
|
||||
typedef struct drm_mga_getparam32 {
|
||||
int param;
|
||||
u32 value;
|
||||
} drm_mga_getparam32_t;
|
||||
|
||||
|
||||
static int compat_mga_getparam(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_mga_getparam32_t getparam32;
|
||||
drm_mga_getparam_t __user *getparam;
|
||||
|
||||
if (copy_from_user(&getparam32, (void __user *)arg, sizeof(getparam32)))
|
||||
return -EFAULT;
|
||||
|
||||
getparam = compat_alloc_user_space(sizeof(*getparam));
|
||||
if (!access_ok(VERIFY_WRITE, getparam, sizeof(*getparam))
|
||||
|| __put_user(getparam32.param, &getparam->param)
|
||||
|| __put_user((void __user *)(unsigned long)getparam32.value, &getparam->value))
|
||||
return -EFAULT;
|
||||
|
||||
return drm_ioctl(file->f_dentry->d_inode, file,
|
||||
DRM_IOCTL_MGA_GETPARAM, (unsigned long)getparam);
|
||||
}
|
||||
|
||||
drm_ioctl_compat_t *mga_compat_ioctls[] = {
|
||||
[DRM_MGA_INIT] = compat_mga_init,
|
||||
[DRM_MGA_GETPARAM] = compat_mga_getparam,
|
||||
};
|
||||
|
||||
/**
|
||||
* Called whenever a 32-bit process running under a 64-bit kernel
|
||||
* performs an ioctl on /dev/dri/card<n>.
|
||||
*
|
||||
* \param filp file pointer.
|
||||
* \param cmd command.
|
||||
* \param arg user argument.
|
||||
* \return zero on success or negative number on failure.
|
||||
*/
|
||||
long mga_compat_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
unsigned int nr = DRM_IOCTL_NR(cmd);
|
||||
drm_ioctl_compat_t *fn = NULL;
|
||||
int ret;
|
||||
|
||||
if (nr < DRM_COMMAND_BASE)
|
||||
return drm_compat_ioctl(filp, cmd, arg);
|
||||
|
||||
if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls))
|
||||
fn = mga_compat_ioctls[nr - DRM_COMMAND_BASE];
|
||||
|
||||
lock_kernel(); /* XXX for now */
|
||||
if (fn != NULL)
|
||||
ret = (*fn)(filp, cmd, arg);
|
||||
else
|
||||
ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
|
||||
unlock_kernel();
|
||||
|
||||
return ret;
|
||||
}
|
@ -96,6 +96,9 @@ static struct drm_driver driver = {
|
||||
.mmap = drm_mmap,
|
||||
.poll = drm_poll,
|
||||
.fasync = drm_fasync,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = r128_compat_ioctl,
|
||||
#endif
|
||||
},
|
||||
.pci_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
|
@ -156,6 +156,9 @@ extern void r128_driver_irq_uninstall( drm_device_t *dev );
|
||||
extern void r128_driver_pretakedown(drm_device_t *dev);
|
||||
extern void r128_driver_prerelease(drm_device_t *dev, DRMFILE filp);
|
||||
|
||||
extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg);
|
||||
|
||||
/* Register definitions, register access macros and drmAddMap constants
|
||||
* for Rage 128 kernel driver.
|
||||
*/
|
||||
|
219
drivers/char/drm/r128_ioc32.c
Normal file
219
drivers/char/drm/r128_ioc32.c
Normal file
@ -0,0 +1,219 @@
|
||||
/**
|
||||
* \file r128_ioc32.c
|
||||
*
|
||||
* 32-bit ioctl compatibility routines for the R128 DRM.
|
||||
*
|
||||
* \author Dave Airlie <airlied@linux.ie> with code from patches by Egbert Eich
|
||||
*
|
||||
* Copyright (C) Paul Mackerras 2005
|
||||
* Copyright (C) Egbert Eich 2003,2004
|
||||
* Copyright (C) Dave Airlie 2005
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
#include <linux/compat.h>
|
||||
#include <linux/ioctl32.h>
|
||||
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
#include "r128_drm.h"
|
||||
|
||||
typedef struct drm_r128_init32 {
|
||||
int func;
|
||||
unsigned int sarea_priv_offset;
|
||||
int is_pci;
|
||||
int cce_mode;
|
||||
int cce_secure;
|
||||
int ring_size;
|
||||
int usec_timeout;
|
||||
|
||||
unsigned int fb_bpp;
|
||||
unsigned int front_offset, front_pitch;
|
||||
unsigned int back_offset, back_pitch;
|
||||
unsigned int depth_bpp;
|
||||
unsigned int depth_offset, depth_pitch;
|
||||
unsigned int span_offset;
|
||||
|
||||
unsigned int fb_offset;
|
||||
unsigned int mmio_offset;
|
||||
unsigned int ring_offset;
|
||||
unsigned int ring_rptr_offset;
|
||||
unsigned int buffers_offset;
|
||||
unsigned int agp_textures_offset;
|
||||
} drm_r128_init32_t;
|
||||
|
||||
static int compat_r128_init(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_r128_init32_t init32;
|
||||
drm_r128_init_t __user *init;
|
||||
|
||||
if (copy_from_user(&init32, (void __user *)arg, sizeof(init32)))
|
||||
return -EFAULT;
|
||||
|
||||
init = compat_alloc_user_space(sizeof(*init));
|
||||
if (!access_ok(VERIFY_WRITE, init, sizeof(*init))
|
||||
|| __put_user(init32.func, &init->func)
|
||||
|| __put_user(init32.sarea_priv_offset, &init->sarea_priv_offset)
|
||||
|| __put_user(init32.is_pci, &init->is_pci)
|
||||
|| __put_user(init32.cce_mode, &init->cce_mode)
|
||||
|| __put_user(init32.cce_secure, &init->cce_secure)
|
||||
|| __put_user(init32.ring_size, &init->ring_size)
|
||||
|| __put_user(init32.usec_timeout, &init->usec_timeout)
|
||||
|| __put_user(init32.fb_bpp, &init->fb_bpp)
|
||||
|| __put_user(init32.front_offset, &init->front_offset)
|
||||
|| __put_user(init32.front_pitch, &init->front_pitch)
|
||||
|| __put_user(init32.back_offset, &init->back_offset)
|
||||
|| __put_user(init32.back_pitch, &init->back_pitch)
|
||||
|| __put_user(init32.depth_bpp, &init->depth_bpp)
|
||||
|| __put_user(init32.depth_offset, &init->depth_offset)
|
||||
|| __put_user(init32.depth_pitch, &init->depth_pitch)
|
||||
|| __put_user(init32.span_offset, &init->span_offset)
|
||||
|| __put_user(init32.fb_offset, &init->fb_offset)
|
||||
|| __put_user(init32.mmio_offset, &init->mmio_offset)
|
||||
|| __put_user(init32.ring_offset, &init->ring_offset)
|
||||
|| __put_user(init32.ring_rptr_offset, &init->ring_rptr_offset)
|
||||
|| __put_user(init32.buffers_offset, &init->buffers_offset)
|
||||
|| __put_user(init32.agp_textures_offset, &init->agp_textures_offset))
|
||||
return -EFAULT;
|
||||
|
||||
return drm_ioctl(file->f_dentry->d_inode, file,
|
||||
DRM_IOCTL_R128_INIT, (unsigned long)init);
|
||||
}
|
||||
|
||||
|
||||
typedef struct drm_r128_depth32 {
|
||||
int func;
|
||||
int n;
|
||||
u32 x;
|
||||
u32 y;
|
||||
u32 buffer;
|
||||
u32 mask;
|
||||
} drm_r128_depth32_t;
|
||||
|
||||
static int compat_r128_depth(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_r128_depth32_t depth32;
|
||||
drm_r128_depth_t __user *depth;
|
||||
|
||||
if (copy_from_user(&depth32, (void __user *)arg, sizeof(depth32)))
|
||||
return -EFAULT;
|
||||
|
||||
depth = compat_alloc_user_space(sizeof(*depth));
|
||||
if (!access_ok(VERIFY_WRITE, depth, sizeof(*depth))
|
||||
|| __put_user(depth32.func, &depth->func)
|
||||
|| __put_user(depth32.n, &depth->n)
|
||||
|| __put_user((int __user *)(unsigned long)depth32.x, &depth->x)
|
||||
|| __put_user((int __user *)(unsigned long)depth32.y, &depth->y)
|
||||
|| __put_user((unsigned int __user *)(unsigned long)depth32.buffer, &depth->buffer)
|
||||
|| __put_user((unsigned char __user *)(unsigned long)depth32.mask, &depth->mask))
|
||||
return -EFAULT;
|
||||
|
||||
return drm_ioctl(file->f_dentry->d_inode, file,
|
||||
DRM_IOCTL_R128_DEPTH, (unsigned long)depth);
|
||||
|
||||
}
|
||||
|
||||
typedef struct drm_r128_stipple32 {
|
||||
u32 mask;
|
||||
} drm_r128_stipple32_t;
|
||||
|
||||
static int compat_r128_stipple(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_r128_stipple32_t stipple32;
|
||||
drm_r128_stipple_t __user *stipple;
|
||||
|
||||
if (copy_from_user(&stipple32, (void __user *)arg, sizeof(stipple32)))
|
||||
return -EFAULT;
|
||||
|
||||
stipple = compat_alloc_user_space(sizeof(*stipple));
|
||||
if (!access_ok(VERIFY_WRITE, stipple, sizeof(*stipple))
|
||||
|| __put_user((unsigned int __user *)(unsigned long)stipple32.mask, &stipple->mask))
|
||||
return -EFAULT;
|
||||
|
||||
return drm_ioctl(file->f_dentry->d_inode, file,
|
||||
DRM_IOCTL_R128_STIPPLE, (unsigned long)stipple);
|
||||
}
|
||||
|
||||
typedef struct drm_r128_getparam32 {
|
||||
int param;
|
||||
u32 value;
|
||||
} drm_r128_getparam32_t;
|
||||
|
||||
static int compat_r128_getparam(struct file *file, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
drm_r128_getparam32_t getparam32;
|
||||
drm_r128_getparam_t __user *getparam;
|
||||
|
||||
if (copy_from_user(&getparam32, (void __user *)arg, sizeof(getparam32)))
|
||||
return -EFAULT;
|
||||
|
||||
getparam = compat_alloc_user_space(sizeof(*getparam));
|
||||
if (!access_ok(VERIFY_WRITE, getparam, sizeof(*getparam))
|
||||
|| __put_user(getparam32.param, &getparam->param)
|
||||
|| __put_user((void __user *)(unsigned long)getparam32.value, &getparam->value))
|
||||
return -EFAULT;
|
||||
|
||||
return drm_ioctl(file->f_dentry->d_inode, file,
|
||||
DRM_IOCTL_R128_GETPARAM, (unsigned long)getparam);
|
||||
}
|
||||
|
||||
drm_ioctl_compat_t *r128_compat_ioctls[] = {
|
||||
[DRM_R128_INIT] = compat_r128_init,
|
||||
[DRM_R128_DEPTH] = compat_r128_depth,
|
||||
[DRM_R128_STIPPLE] = compat_r128_stipple,
|
||||
[DRM_R128_GETPARAM] = compat_r128_getparam,
|
||||
};
|
||||
|
||||
/**
|
||||
* Called whenever a 32-bit process running under a 64-bit kernel
|
||||
* performs an ioctl on /dev/dri/card<n>.
|
||||
*
|
||||
* \param filp file pointer.
|
||||
* \param cmd command.
|
||||
* \param arg user argument.
|
||||
* \return zero on success or negative number on failure.
|
||||
*/
|
||||
long r128_compat_ioctl(struct file *filp, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
unsigned int nr = DRM_IOCTL_NR(cmd);
|
||||
drm_ioctl_compat_t *fn = NULL;
|
||||
int ret;
|
||||
|
||||
if (nr < DRM_COMMAND_BASE)
|
||||
return drm_compat_ioctl(filp, cmd, arg);
|
||||
|
||||
if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(r128_compat_ioctls))
|
||||
fn = r128_compat_ioctls[nr - DRM_COMMAND_BASE];
|
||||
|
||||
lock_kernel(); /* XXX for now */
|
||||
if (fn != NULL)
|
||||
ret = (*fn)(filp, cmd, arg);
|
||||
else
|
||||
ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
|
||||
unlock_kernel();
|
||||
|
||||
return ret;
|
||||
}
|
@ -1307,7 +1307,7 @@ static int r128_do_init_pageflip( drm_device_t *dev )
|
||||
return 0;
|
||||
}
|
||||
|
||||
int r128_do_cleanup_pageflip( drm_device_t *dev )
|
||||
static int r128_do_cleanup_pageflip( drm_device_t *dev )
|
||||
{
|
||||
drm_r128_private_t *dev_priv = dev->dev_private;
|
||||
DRM_DEBUG( "\n" );
|
||||
|
1651
drivers/char/drm/via_3d_reg.h
Normal file
1651
drivers/char/drm/via_3d_reg.h
Normal file
File diff suppressed because it is too large
Load Diff
741
drivers/char/drm/via_dma.c
Normal file
741
drivers/char/drm/via_dma.c
Normal file
@ -0,0 +1,741 @@
|
||||
/* via_dma.c -- DMA support for the VIA Unichrome/Pro
|
||||
*
|
||||
* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Copyright 2004 Digeo, Inc., Palo Alto, CA, U.S.A.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Copyright 2004 The Unichrome project.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Tungsten Graphics,
|
||||
* Erdi Chen,
|
||||
* Thomas Hellstrom.
|
||||
*/
|
||||
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
#include "via_drm.h"
|
||||
#include "via_drv.h"
|
||||
#include "via_3d_reg.h"
|
||||
|
||||
#define CMDBUF_ALIGNMENT_SIZE (0x100)
|
||||
#define CMDBUF_ALIGNMENT_MASK (0x0ff)
|
||||
|
||||
/* defines for VIA 3D registers */
|
||||
#define VIA_REG_STATUS 0x400
|
||||
#define VIA_REG_TRANSET 0x43C
|
||||
#define VIA_REG_TRANSPACE 0x440
|
||||
|
||||
/* VIA_REG_STATUS(0x400): Engine Status */
|
||||
#define VIA_CMD_RGTR_BUSY 0x00000080 /* Command Regulator is busy */
|
||||
#define VIA_2D_ENG_BUSY 0x00000001 /* 2D Engine is busy */
|
||||
#define VIA_3D_ENG_BUSY 0x00000002 /* 3D Engine is busy */
|
||||
#define VIA_VR_QUEUE_BUSY 0x00020000 /* Virtual Queue is busy */
|
||||
|
||||
#define SetReg2DAGP(nReg, nData) { \
|
||||
*((uint32_t *)(vb)) = ((nReg) >> 2) | HALCYON_HEADER1; \
|
||||
*((uint32_t *)(vb) + 1) = (nData); \
|
||||
vb = ((uint32_t *)vb) + 2; \
|
||||
dev_priv->dma_low +=8; \
|
||||
}
|
||||
|
||||
#define via_flush_write_combine() DRM_MEMORYBARRIER()
|
||||
|
||||
#define VIA_OUT_RING_QW(w1,w2) \
|
||||
*vb++ = (w1); \
|
||||
*vb++ = (w2); \
|
||||
dev_priv->dma_low += 8;
|
||||
|
||||
static void via_cmdbuf_start(drm_via_private_t * dev_priv);
|
||||
static void via_cmdbuf_pause(drm_via_private_t * dev_priv);
|
||||
static void via_cmdbuf_reset(drm_via_private_t * dev_priv);
|
||||
static void via_cmdbuf_rewind(drm_via_private_t * dev_priv);
|
||||
static int via_wait_idle(drm_via_private_t * dev_priv);
|
||||
static void via_pad_cache(drm_via_private_t *dev_priv, int qwords);
|
||||
|
||||
|
||||
/*
|
||||
* Free space in command buffer.
|
||||
*/
|
||||
|
||||
static uint32_t
|
||||
via_cmdbuf_space(drm_via_private_t *dev_priv)
|
||||
{
|
||||
uint32_t agp_base = dev_priv->dma_offset +
|
||||
(uint32_t) dev_priv->agpAddr;
|
||||
uint32_t hw_addr = *(dev_priv->hw_addr_ptr) - agp_base;
|
||||
|
||||
return ((hw_addr <= dev_priv->dma_low) ?
|
||||
(dev_priv->dma_high + hw_addr - dev_priv->dma_low) :
|
||||
(hw_addr - dev_priv->dma_low));
|
||||
}
|
||||
|
||||
/*
|
||||
* How much does the command regulator lag behind?
|
||||
*/
|
||||
|
||||
static uint32_t
|
||||
via_cmdbuf_lag(drm_via_private_t *dev_priv)
|
||||
{
|
||||
uint32_t agp_base = dev_priv->dma_offset +
|
||||
(uint32_t) dev_priv->agpAddr;
|
||||
uint32_t hw_addr = *(dev_priv->hw_addr_ptr) - agp_base;
|
||||
|
||||
return ((hw_addr <= dev_priv->dma_low) ?
|
||||
(dev_priv->dma_low - hw_addr) :
|
||||
(dev_priv->dma_wrap + dev_priv->dma_low - hw_addr));
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that the given size fits in the buffer, otherwise wait.
|
||||
*/
|
||||
|
||||
static inline int
|
||||
via_cmdbuf_wait(drm_via_private_t * dev_priv, unsigned int size)
|
||||
{
|
||||
uint32_t agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr;
|
||||
uint32_t cur_addr, hw_addr, next_addr;
|
||||
volatile uint32_t *hw_addr_ptr;
|
||||
uint32_t count;
|
||||
hw_addr_ptr = dev_priv->hw_addr_ptr;
|
||||
cur_addr = dev_priv->dma_low;
|
||||
next_addr = cur_addr + size + 512*1024;
|
||||
count = 1000000;
|
||||
do {
|
||||
hw_addr = *hw_addr_ptr - agp_base;
|
||||
if (count-- == 0) {
|
||||
DRM_ERROR("via_cmdbuf_wait timed out hw %x cur_addr %x next_addr %x\n",
|
||||
hw_addr, cur_addr, next_addr);
|
||||
return -1;
|
||||
}
|
||||
} while ((cur_addr < hw_addr) && (next_addr >= hw_addr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Checks whether buffer head has reach the end. Rewind the ring buffer
|
||||
* when necessary.
|
||||
*
|
||||
* Returns virtual pointer to ring buffer.
|
||||
*/
|
||||
|
||||
static inline uint32_t *via_check_dma(drm_via_private_t * dev_priv,
|
||||
unsigned int size)
|
||||
{
|
||||
if ((dev_priv->dma_low + size + 4*CMDBUF_ALIGNMENT_SIZE) > dev_priv->dma_high) {
|
||||
via_cmdbuf_rewind(dev_priv);
|
||||
}
|
||||
if (via_cmdbuf_wait(dev_priv, size) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (uint32_t *) (dev_priv->dma_ptr + dev_priv->dma_low);
|
||||
}
|
||||
|
||||
int via_dma_cleanup(drm_device_t * dev)
|
||||
{
|
||||
if (dev->dev_private) {
|
||||
drm_via_private_t *dev_priv =
|
||||
(drm_via_private_t *) dev->dev_private;
|
||||
|
||||
if (dev_priv->ring.virtual_start) {
|
||||
via_cmdbuf_reset(dev_priv);
|
||||
|
||||
drm_core_ioremapfree(&dev_priv->ring.map, dev);
|
||||
dev_priv->ring.virtual_start = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int via_initialize(drm_device_t * dev,
|
||||
drm_via_private_t * dev_priv,
|
||||
drm_via_dma_init_t * init)
|
||||
{
|
||||
if (!dev_priv || !dev_priv->mmio) {
|
||||
DRM_ERROR("via_dma_init called before via_map_init\n");
|
||||
return DRM_ERR(EFAULT);
|
||||
}
|
||||
|
||||
if (dev_priv->ring.virtual_start != NULL) {
|
||||
DRM_ERROR("%s called again without calling cleanup\n",
|
||||
__FUNCTION__);
|
||||
return DRM_ERR(EFAULT);
|
||||
}
|
||||
|
||||
if (!dev->agp || !dev->agp->base) {
|
||||
DRM_ERROR("%s called with no agp memory available\n",
|
||||
__FUNCTION__);
|
||||
return DRM_ERR(EFAULT);
|
||||
}
|
||||
|
||||
dev_priv->ring.map.offset = dev->agp->base + init->offset;
|
||||
dev_priv->ring.map.size = init->size;
|
||||
dev_priv->ring.map.type = 0;
|
||||
dev_priv->ring.map.flags = 0;
|
||||
dev_priv->ring.map.mtrr = 0;
|
||||
|
||||
drm_core_ioremap(&dev_priv->ring.map, dev);
|
||||
|
||||
if (dev_priv->ring.map.handle == NULL) {
|
||||
via_dma_cleanup(dev);
|
||||
DRM_ERROR("can not ioremap virtual address for"
|
||||
" ring buffer\n");
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
dev_priv->ring.virtual_start = dev_priv->ring.map.handle;
|
||||
|
||||
dev_priv->dma_ptr = dev_priv->ring.virtual_start;
|
||||
dev_priv->dma_low = 0;
|
||||
dev_priv->dma_high = init->size;
|
||||
dev_priv->dma_wrap = init->size;
|
||||
dev_priv->dma_offset = init->offset;
|
||||
dev_priv->last_pause_ptr = NULL;
|
||||
dev_priv->hw_addr_ptr = dev_priv->mmio->handle + init->reg_pause_addr;
|
||||
|
||||
via_cmdbuf_start(dev_priv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int via_dma_init(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
|
||||
drm_via_dma_init_t init;
|
||||
int retcode = 0;
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL(init, (drm_via_dma_init_t *) data,
|
||||
sizeof(init));
|
||||
|
||||
switch (init.func) {
|
||||
case VIA_INIT_DMA:
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
retcode = DRM_ERR(EPERM);
|
||||
else
|
||||
retcode = via_initialize(dev, dev_priv, &init);
|
||||
break;
|
||||
case VIA_CLEANUP_DMA:
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
retcode = DRM_ERR(EPERM);
|
||||
else
|
||||
retcode = via_dma_cleanup(dev);
|
||||
break;
|
||||
case VIA_DMA_INITIALIZED:
|
||||
retcode = (dev_priv->ring.virtual_start != NULL) ?
|
||||
0: DRM_ERR( EFAULT );
|
||||
break;
|
||||
default:
|
||||
retcode = DRM_ERR(EINVAL);
|
||||
break;
|
||||
}
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int via_dispatch_cmdbuffer(drm_device_t * dev, drm_via_cmdbuffer_t * cmd)
|
||||
{
|
||||
drm_via_private_t *dev_priv;
|
||||
uint32_t *vb;
|
||||
int ret;
|
||||
|
||||
dev_priv = (drm_via_private_t *) dev->dev_private;
|
||||
|
||||
if (dev_priv->ring.virtual_start == NULL) {
|
||||
DRM_ERROR("%s called without initializing AGP ring buffer.\n",
|
||||
__FUNCTION__);
|
||||
return DRM_ERR(EFAULT);
|
||||
}
|
||||
|
||||
if (cmd->size > VIA_PCI_BUF_SIZE) {
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
|
||||
if (DRM_COPY_FROM_USER(dev_priv->pci_buf, cmd->buf, cmd->size))
|
||||
return DRM_ERR(EFAULT);
|
||||
|
||||
/*
|
||||
* Running this function on AGP memory is dead slow. Therefore
|
||||
* we run it on a temporary cacheable system memory buffer and
|
||||
* copy it to AGP memory when ready.
|
||||
*/
|
||||
|
||||
|
||||
if ((ret = via_verify_command_stream((uint32_t *)dev_priv->pci_buf, cmd->size, dev, 1))) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
vb = via_check_dma(dev_priv, (cmd->size < 0x100) ? 0x102 : cmd->size);
|
||||
if (vb == NULL) {
|
||||
return DRM_ERR(EAGAIN);
|
||||
}
|
||||
|
||||
memcpy(vb, dev_priv->pci_buf, cmd->size);
|
||||
|
||||
dev_priv->dma_low += cmd->size;
|
||||
|
||||
/*
|
||||
* Small submissions somehow stalls the CPU. (AGP cache effects?)
|
||||
* pad to greater size.
|
||||
*/
|
||||
|
||||
if (cmd->size < 0x100)
|
||||
via_pad_cache(dev_priv,(0x100 - cmd->size) >> 3);
|
||||
via_cmdbuf_pause(dev_priv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int via_driver_dma_quiescent(drm_device_t * dev)
|
||||
{
|
||||
drm_via_private_t *dev_priv = dev->dev_private;
|
||||
|
||||
if (!via_wait_idle(dev_priv)) {
|
||||
return DRM_ERR(EBUSY);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int via_flush_ioctl(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
|
||||
LOCK_TEST_WITH_RETURN( dev, filp );
|
||||
|
||||
return via_driver_dma_quiescent(dev);
|
||||
}
|
||||
|
||||
int via_cmdbuffer(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_via_cmdbuffer_t cmdbuf;
|
||||
int ret;
|
||||
|
||||
LOCK_TEST_WITH_RETURN( dev, filp );
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL(cmdbuf, (drm_via_cmdbuffer_t *) data,
|
||||
sizeof(cmdbuf));
|
||||
|
||||
DRM_DEBUG("via cmdbuffer, buf %p size %lu\n", cmdbuf.buf, cmdbuf.size);
|
||||
|
||||
ret = via_dispatch_cmdbuffer(dev, &cmdbuf);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int
|
||||
via_parse_command_stream(drm_device_t *dev, const uint32_t * buf, unsigned int size);
|
||||
static int via_dispatch_pci_cmdbuffer(drm_device_t * dev,
|
||||
drm_via_cmdbuffer_t * cmd)
|
||||
{
|
||||
drm_via_private_t *dev_priv = dev->dev_private;
|
||||
int ret;
|
||||
|
||||
if (cmd->size > VIA_PCI_BUF_SIZE) {
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
if (DRM_COPY_FROM_USER(dev_priv->pci_buf, cmd->buf, cmd->size))
|
||||
return DRM_ERR(EFAULT);
|
||||
|
||||
if ((ret = via_verify_command_stream((uint32_t *)dev_priv->pci_buf, cmd->size, dev, 0))) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = via_parse_command_stream(dev, (const uint32_t *)dev_priv->pci_buf, cmd->size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int via_pci_cmdbuffer(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_via_cmdbuffer_t cmdbuf;
|
||||
int ret;
|
||||
|
||||
LOCK_TEST_WITH_RETURN( dev, filp );
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL(cmdbuf, (drm_via_cmdbuffer_t *) data,
|
||||
sizeof(cmdbuf));
|
||||
|
||||
DRM_DEBUG("via_pci_cmdbuffer, buf %p size %lu\n", cmdbuf.buf,
|
||||
cmdbuf.size);
|
||||
|
||||
ret = via_dispatch_pci_cmdbuffer(dev, &cmdbuf);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static inline uint32_t *via_align_buffer(drm_via_private_t * dev_priv,
|
||||
uint32_t * vb, int qw_count)
|
||||
{
|
||||
for (; qw_count > 0; --qw_count) {
|
||||
VIA_OUT_RING_QW(HC_DUMMY, HC_DUMMY);
|
||||
}
|
||||
return vb;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This function is used internally by ring buffer mangement code.
|
||||
*
|
||||
* Returns virtual pointer to ring buffer.
|
||||
*/
|
||||
static inline uint32_t *via_get_dma(drm_via_private_t * dev_priv)
|
||||
{
|
||||
return (uint32_t *) (dev_priv->dma_ptr + dev_priv->dma_low);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hooks a segment of data into the tail of the ring-buffer by
|
||||
* modifying the pause address stored in the buffer itself. If
|
||||
* the regulator has already paused, restart it.
|
||||
*/
|
||||
static int via_hook_segment(drm_via_private_t *dev_priv,
|
||||
uint32_t pause_addr_hi, uint32_t pause_addr_lo,
|
||||
int no_pci_fire)
|
||||
{
|
||||
int paused, count;
|
||||
volatile uint32_t *paused_at = dev_priv->last_pause_ptr;
|
||||
|
||||
via_flush_write_combine();
|
||||
while(! *(via_get_dma(dev_priv)-1));
|
||||
*dev_priv->last_pause_ptr = pause_addr_lo;
|
||||
via_flush_write_combine();
|
||||
|
||||
/*
|
||||
* The below statement is inserted to really force the flush.
|
||||
* Not sure it is needed.
|
||||
*/
|
||||
|
||||
while(! *dev_priv->last_pause_ptr);
|
||||
dev_priv->last_pause_ptr = via_get_dma(dev_priv) - 1;
|
||||
while(! *dev_priv->last_pause_ptr);
|
||||
|
||||
|
||||
paused = 0;
|
||||
count = 20;
|
||||
|
||||
while (!(paused = (VIA_READ(0x41c) & 0x80000000)) && count--);
|
||||
if ((count <= 8) && (count >= 0)) {
|
||||
uint32_t rgtr, ptr;
|
||||
rgtr = *(dev_priv->hw_addr_ptr);
|
||||
ptr = ((char *)dev_priv->last_pause_ptr - dev_priv->dma_ptr) +
|
||||
dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4 -
|
||||
CMDBUF_ALIGNMENT_SIZE;
|
||||
if (rgtr <= ptr) {
|
||||
DRM_ERROR("Command regulator\npaused at count %d, address %x, "
|
||||
"while current pause address is %x.\n"
|
||||
"Please mail this message to "
|
||||
"<unichrome-devel@lists.sourceforge.net>\n",
|
||||
count, rgtr, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
if (paused && !no_pci_fire) {
|
||||
uint32_t rgtr,ptr;
|
||||
uint32_t ptr_low;
|
||||
|
||||
count = 1000000;
|
||||
while ((VIA_READ(VIA_REG_STATUS) & VIA_CMD_RGTR_BUSY) && count--);
|
||||
|
||||
rgtr = *(dev_priv->hw_addr_ptr);
|
||||
ptr = ((char *)paused_at - dev_priv->dma_ptr) +
|
||||
dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr + 4;
|
||||
|
||||
|
||||
ptr_low = (ptr > 3*CMDBUF_ALIGNMENT_SIZE) ?
|
||||
ptr - 3*CMDBUF_ALIGNMENT_SIZE : 0;
|
||||
if (rgtr <= ptr && rgtr >= ptr_low) {
|
||||
VIA_WRITE(VIA_REG_TRANSET, (HC_ParaType_PreCR << 16));
|
||||
VIA_WRITE(VIA_REG_TRANSPACE, pause_addr_hi);
|
||||
VIA_WRITE(VIA_REG_TRANSPACE, pause_addr_lo);
|
||||
}
|
||||
}
|
||||
return paused;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int via_wait_idle(drm_via_private_t * dev_priv)
|
||||
{
|
||||
int count = 10000000;
|
||||
while (count-- && (VIA_READ(VIA_REG_STATUS) &
|
||||
(VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY |
|
||||
VIA_3D_ENG_BUSY))) ;
|
||||
return count;
|
||||
}
|
||||
|
||||
static uint32_t *via_align_cmd(drm_via_private_t * dev_priv, uint32_t cmd_type,
|
||||
uint32_t addr, uint32_t *cmd_addr_hi,
|
||||
uint32_t *cmd_addr_lo,
|
||||
int skip_wait)
|
||||
{
|
||||
uint32_t agp_base;
|
||||
uint32_t cmd_addr, addr_lo, addr_hi;
|
||||
uint32_t *vb;
|
||||
uint32_t qw_pad_count;
|
||||
|
||||
if (!skip_wait)
|
||||
via_cmdbuf_wait(dev_priv, 2*CMDBUF_ALIGNMENT_SIZE);
|
||||
|
||||
vb = via_get_dma(dev_priv);
|
||||
VIA_OUT_RING_QW( HC_HEADER2 | ((VIA_REG_TRANSET >> 2) << 12) |
|
||||
(VIA_REG_TRANSPACE >> 2), HC_ParaType_PreCR << 16);
|
||||
agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr;
|
||||
qw_pad_count = (CMDBUF_ALIGNMENT_SIZE >> 3) -
|
||||
((dev_priv->dma_low & CMDBUF_ALIGNMENT_MASK) >> 3);
|
||||
|
||||
|
||||
cmd_addr = (addr) ? addr :
|
||||
agp_base + dev_priv->dma_low - 8 + (qw_pad_count << 3);
|
||||
addr_lo = ((HC_SubA_HAGPBpL << 24) | (cmd_type & HC_HAGPBpID_MASK) |
|
||||
(cmd_addr & HC_HAGPBpL_MASK));
|
||||
addr_hi = ((HC_SubA_HAGPBpH << 24) | (cmd_addr >> 24));
|
||||
|
||||
vb = via_align_buffer(dev_priv, vb, qw_pad_count - 1);
|
||||
VIA_OUT_RING_QW(*cmd_addr_hi = addr_hi,
|
||||
*cmd_addr_lo = addr_lo);
|
||||
return vb;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void via_cmdbuf_start(drm_via_private_t * dev_priv)
|
||||
{
|
||||
uint32_t pause_addr_lo, pause_addr_hi;
|
||||
uint32_t start_addr, start_addr_lo;
|
||||
uint32_t end_addr, end_addr_lo;
|
||||
uint32_t command;
|
||||
uint32_t agp_base;
|
||||
|
||||
|
||||
dev_priv->dma_low = 0;
|
||||
|
||||
agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr;
|
||||
start_addr = agp_base;
|
||||
end_addr = agp_base + dev_priv->dma_high;
|
||||
|
||||
start_addr_lo = ((HC_SubA_HAGPBstL << 24) | (start_addr & 0xFFFFFF));
|
||||
end_addr_lo = ((HC_SubA_HAGPBendL << 24) | (end_addr & 0xFFFFFF));
|
||||
command = ((HC_SubA_HAGPCMNT << 24) | (start_addr >> 24) |
|
||||
((end_addr & 0xff000000) >> 16));
|
||||
|
||||
dev_priv->last_pause_ptr =
|
||||
via_align_cmd(dev_priv, HC_HAGPBpID_PAUSE, 0,
|
||||
&pause_addr_hi, & pause_addr_lo, 1) - 1;
|
||||
|
||||
via_flush_write_combine();
|
||||
while(! *dev_priv->last_pause_ptr);
|
||||
|
||||
VIA_WRITE(VIA_REG_TRANSET, (HC_ParaType_PreCR << 16));
|
||||
VIA_WRITE(VIA_REG_TRANSPACE, command);
|
||||
VIA_WRITE(VIA_REG_TRANSPACE, start_addr_lo);
|
||||
VIA_WRITE(VIA_REG_TRANSPACE, end_addr_lo);
|
||||
|
||||
VIA_WRITE(VIA_REG_TRANSPACE, pause_addr_hi);
|
||||
VIA_WRITE(VIA_REG_TRANSPACE, pause_addr_lo);
|
||||
|
||||
VIA_WRITE(VIA_REG_TRANSPACE, command | HC_HAGPCMNT_MASK);
|
||||
}
|
||||
|
||||
static void via_pad_cache(drm_via_private_t *dev_priv, int qwords)
|
||||
{
|
||||
uint32_t *vb;
|
||||
|
||||
via_cmdbuf_wait(dev_priv, qwords + 2);
|
||||
vb = via_get_dma(dev_priv);
|
||||
VIA_OUT_RING_QW( HC_HEADER2, HC_ParaType_NotTex << 16);
|
||||
via_align_buffer(dev_priv,vb,qwords);
|
||||
}
|
||||
|
||||
static inline void via_dummy_bitblt(drm_via_private_t * dev_priv)
|
||||
{
|
||||
uint32_t *vb = via_get_dma(dev_priv);
|
||||
SetReg2DAGP(0x0C, (0 | (0 << 16)));
|
||||
SetReg2DAGP(0x10, 0 | (0 << 16));
|
||||
SetReg2DAGP(0x0, 0x1 | 0x2000 | 0xAA000000);
|
||||
}
|
||||
|
||||
|
||||
static void via_cmdbuf_jump(drm_via_private_t * dev_priv)
|
||||
{
|
||||
uint32_t agp_base;
|
||||
uint32_t pause_addr_lo, pause_addr_hi;
|
||||
uint32_t jump_addr_lo, jump_addr_hi;
|
||||
volatile uint32_t *last_pause_ptr;
|
||||
uint32_t dma_low_save1, dma_low_save2;
|
||||
|
||||
agp_base = dev_priv->dma_offset + (uint32_t) dev_priv->agpAddr;
|
||||
via_align_cmd(dev_priv, HC_HAGPBpID_JUMP, 0, &jump_addr_hi,
|
||||
&jump_addr_lo, 0);
|
||||
|
||||
dev_priv->dma_wrap = dev_priv->dma_low;
|
||||
|
||||
|
||||
/*
|
||||
* Wrap command buffer to the beginning.
|
||||
*/
|
||||
|
||||
dev_priv->dma_low = 0;
|
||||
if (via_cmdbuf_wait(dev_priv, CMDBUF_ALIGNMENT_SIZE) != 0) {
|
||||
DRM_ERROR("via_cmdbuf_jump failed\n");
|
||||
}
|
||||
|
||||
via_dummy_bitblt(dev_priv);
|
||||
via_dummy_bitblt(dev_priv);
|
||||
|
||||
last_pause_ptr = via_align_cmd(dev_priv, HC_HAGPBpID_PAUSE, 0, &pause_addr_hi,
|
||||
&pause_addr_lo, 0) -1;
|
||||
via_align_cmd(dev_priv, HC_HAGPBpID_PAUSE, 0, &pause_addr_hi,
|
||||
&pause_addr_lo, 0);
|
||||
|
||||
*last_pause_ptr = pause_addr_lo;
|
||||
dma_low_save1 = dev_priv->dma_low;
|
||||
|
||||
/*
|
||||
* Now, set a trap that will pause the regulator if it tries to rerun the old
|
||||
* command buffer. (Which may happen if via_hook_segment detecs a command regulator pause
|
||||
* and reissues the jump command over PCI, while the regulator has already taken the jump
|
||||
* and actually paused at the current buffer end).
|
||||
* There appears to be no other way to detect this condition, since the hw_addr_pointer
|
||||
* does not seem to get updated immediately when a jump occurs.
|
||||
*/
|
||||
|
||||
last_pause_ptr = via_align_cmd(dev_priv, HC_HAGPBpID_PAUSE, 0, &pause_addr_hi,
|
||||
&pause_addr_lo, 0) -1;
|
||||
via_align_cmd(dev_priv, HC_HAGPBpID_PAUSE, 0, &pause_addr_hi,
|
||||
&pause_addr_lo, 0);
|
||||
*last_pause_ptr = pause_addr_lo;
|
||||
|
||||
dma_low_save2 = dev_priv->dma_low;
|
||||
dev_priv->dma_low = dma_low_save1;
|
||||
via_hook_segment( dev_priv, jump_addr_hi, jump_addr_lo, 0);
|
||||
dev_priv->dma_low = dma_low_save2;
|
||||
via_hook_segment( dev_priv, pause_addr_hi, pause_addr_lo, 0);
|
||||
}
|
||||
|
||||
|
||||
static void via_cmdbuf_rewind(drm_via_private_t * dev_priv)
|
||||
{
|
||||
via_cmdbuf_jump(dev_priv);
|
||||
}
|
||||
|
||||
static void via_cmdbuf_flush(drm_via_private_t * dev_priv, uint32_t cmd_type)
|
||||
{
|
||||
uint32_t pause_addr_lo, pause_addr_hi;
|
||||
|
||||
via_align_cmd(dev_priv, cmd_type, 0, &pause_addr_hi, &pause_addr_lo, 0);
|
||||
via_hook_segment( dev_priv, pause_addr_hi, pause_addr_lo, 0);
|
||||
}
|
||||
|
||||
|
||||
static void via_cmdbuf_pause(drm_via_private_t * dev_priv)
|
||||
{
|
||||
via_cmdbuf_flush(dev_priv, HC_HAGPBpID_PAUSE);
|
||||
}
|
||||
|
||||
static void via_cmdbuf_reset(drm_via_private_t * dev_priv)
|
||||
{
|
||||
via_cmdbuf_flush(dev_priv, HC_HAGPBpID_STOP);
|
||||
via_wait_idle(dev_priv);
|
||||
}
|
||||
|
||||
/*
|
||||
* User interface to the space and lag functions.
|
||||
*/
|
||||
|
||||
int
|
||||
via_cmdbuf_size(DRM_IOCTL_ARGS)
|
||||
{
|
||||
DRM_DEVICE;
|
||||
drm_via_cmdbuf_size_t d_siz;
|
||||
int ret = 0;
|
||||
uint32_t tmp_size, count;
|
||||
drm_via_private_t *dev_priv;
|
||||
|
||||
DRM_DEBUG("via cmdbuf_size\n");
|
||||
LOCK_TEST_WITH_RETURN( dev, filp );
|
||||
|
||||
dev_priv = (drm_via_private_t *) dev->dev_private;
|
||||
|
||||
if (dev_priv->ring.virtual_start == NULL) {
|
||||
DRM_ERROR("%s called without initializing AGP ring buffer.\n",
|
||||
__FUNCTION__);
|
||||
return DRM_ERR(EFAULT);
|
||||
}
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL(d_siz, (drm_via_cmdbuf_size_t *) data,
|
||||
sizeof(d_siz));
|
||||
|
||||
|
||||
count = 1000000;
|
||||
tmp_size = d_siz.size;
|
||||
switch(d_siz.func) {
|
||||
case VIA_CMDBUF_SPACE:
|
||||
while (((tmp_size = via_cmdbuf_space(dev_priv)) < d_siz.size) && count--) {
|
||||
if (!d_siz.wait) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!count) {
|
||||
DRM_ERROR("VIA_CMDBUF_SPACE timed out.\n");
|
||||
ret = DRM_ERR(EAGAIN);
|
||||
}
|
||||
break;
|
||||
case VIA_CMDBUF_LAG:
|
||||
while (((tmp_size = via_cmdbuf_lag(dev_priv)) > d_siz.size) && count--) {
|
||||
if (!d_siz.wait) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!count) {
|
||||
DRM_ERROR("VIA_CMDBUF_LAG timed out.\n");
|
||||
ret = DRM_ERR(EAGAIN);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ret = DRM_ERR(EFAULT);
|
||||
}
|
||||
d_siz.size = tmp_size;
|
||||
|
||||
DRM_COPY_TO_USER_IOCTL((drm_via_cmdbuf_size_t *) data, d_siz,
|
||||
sizeof(d_siz));
|
||||
return ret;
|
||||
}
|
243
drivers/char/drm/via_drm.h
Normal file
243
drivers/char/drm/via_drm.h
Normal file
@ -0,0 +1,243 @@
|
||||
/*
|
||||
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
|
||||
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _VIA_DRM_H_
|
||||
#define _VIA_DRM_H_
|
||||
|
||||
/* WARNING: These defines must be the same as what the Xserver uses.
|
||||
* if you change them, you must change the defines in the Xserver.
|
||||
*/
|
||||
|
||||
#ifndef _VIA_DEFINES_
|
||||
#define _VIA_DEFINES_
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include "via_drmclient.h"
|
||||
#endif
|
||||
|
||||
#define VIA_NR_SAREA_CLIPRECTS 8
|
||||
#define VIA_NR_XVMC_PORTS 10
|
||||
#define VIA_NR_XVMC_LOCKS 5
|
||||
#define VIA_MAX_CACHELINE_SIZE 64
|
||||
#define XVMCLOCKPTR(saPriv,lockNo) \
|
||||
((volatile drm_hw_lock_t *)(((((unsigned long) (saPriv)->XvMCLockArea) + \
|
||||
(VIA_MAX_CACHELINE_SIZE - 1)) & \
|
||||
~(VIA_MAX_CACHELINE_SIZE - 1)) + \
|
||||
VIA_MAX_CACHELINE_SIZE*(lockNo)))
|
||||
|
||||
/* Each region is a minimum of 64k, and there are at most 64 of them.
|
||||
*/
|
||||
#define VIA_NR_TEX_REGIONS 64
|
||||
#define VIA_LOG_MIN_TEX_REGION_SIZE 16
|
||||
#endif
|
||||
|
||||
#define VIA_UPLOAD_TEX0IMAGE 0x1 /* handled clientside */
|
||||
#define VIA_UPLOAD_TEX1IMAGE 0x2 /* handled clientside */
|
||||
#define VIA_UPLOAD_CTX 0x4
|
||||
#define VIA_UPLOAD_BUFFERS 0x8
|
||||
#define VIA_UPLOAD_TEX0 0x10
|
||||
#define VIA_UPLOAD_TEX1 0x20
|
||||
#define VIA_UPLOAD_CLIPRECTS 0x40
|
||||
#define VIA_UPLOAD_ALL 0xff
|
||||
|
||||
/* VIA specific ioctls */
|
||||
#define DRM_VIA_ALLOCMEM 0x00
|
||||
#define DRM_VIA_FREEMEM 0x01
|
||||
#define DRM_VIA_AGP_INIT 0x02
|
||||
#define DRM_VIA_FB_INIT 0x03
|
||||
#define DRM_VIA_MAP_INIT 0x04
|
||||
#define DRM_VIA_DEC_FUTEX 0x05
|
||||
#define NOT_USED
|
||||
#define DRM_VIA_DMA_INIT 0x07
|
||||
#define DRM_VIA_CMDBUFFER 0x08
|
||||
#define DRM_VIA_FLUSH 0x09
|
||||
#define DRM_VIA_PCICMD 0x0a
|
||||
#define DRM_VIA_CMDBUF_SIZE 0x0b
|
||||
#define NOT_USED
|
||||
#define DRM_VIA_WAIT_IRQ 0x0d
|
||||
|
||||
#define DRM_IOCTL_VIA_ALLOCMEM DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_ALLOCMEM, drm_via_mem_t)
|
||||
#define DRM_IOCTL_VIA_FREEMEM DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_FREEMEM, drm_via_mem_t)
|
||||
#define DRM_IOCTL_VIA_AGP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_AGP_INIT, drm_via_agp_t)
|
||||
#define DRM_IOCTL_VIA_FB_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_FB_INIT, drm_via_fb_t)
|
||||
#define DRM_IOCTL_VIA_MAP_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_MAP_INIT, drm_via_init_t)
|
||||
#define DRM_IOCTL_VIA_DEC_FUTEX DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_DEC_FUTEX, drm_via_futex_t)
|
||||
#define DRM_IOCTL_VIA_DMA_INIT DRM_IOWR(DRM_COMMAND_BASE + DRM_VIA_DMA_INIT, drm_via_dma_init_t)
|
||||
#define DRM_IOCTL_VIA_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_CMDBUFFER, drm_via_cmdbuffer_t)
|
||||
#define DRM_IOCTL_VIA_FLUSH DRM_IO( DRM_COMMAND_BASE + DRM_VIA_FLUSH)
|
||||
#define DRM_IOCTL_VIA_PCICMD DRM_IOW( DRM_COMMAND_BASE + DRM_VIA_PCICMD, drm_via_cmdbuffer_t)
|
||||
#define DRM_IOCTL_VIA_CMDBUF_SIZE DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_CMDBUF_SIZE, \
|
||||
drm_via_cmdbuf_size_t)
|
||||
#define DRM_IOCTL_VIA_WAIT_IRQ DRM_IOWR( DRM_COMMAND_BASE + DRM_VIA_WAIT_IRQ, drm_via_irqwait_t)
|
||||
|
||||
/* Indices into buf.Setup where various bits of state are mirrored per
|
||||
* context and per buffer. These can be fired at the card as a unit,
|
||||
* or in a piecewise fashion as required.
|
||||
*/
|
||||
|
||||
#define VIA_TEX_SETUP_SIZE 8
|
||||
|
||||
/* Flags for clear ioctl
|
||||
*/
|
||||
#define VIA_FRONT 0x1
|
||||
#define VIA_BACK 0x2
|
||||
#define VIA_DEPTH 0x4
|
||||
#define VIA_STENCIL 0x8
|
||||
#define VIDEO 0
|
||||
#define AGP 1
|
||||
typedef struct {
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
} drm_via_agp_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
} drm_via_fb_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t context;
|
||||
uint32_t type;
|
||||
uint32_t size;
|
||||
unsigned long index;
|
||||
unsigned long offset;
|
||||
} drm_via_mem_t;
|
||||
|
||||
typedef struct _drm_via_init {
|
||||
enum {
|
||||
VIA_INIT_MAP = 0x01,
|
||||
VIA_CLEANUP_MAP = 0x02
|
||||
} func;
|
||||
|
||||
unsigned long sarea_priv_offset;
|
||||
unsigned long fb_offset;
|
||||
unsigned long mmio_offset;
|
||||
unsigned long agpAddr;
|
||||
} drm_via_init_t;
|
||||
|
||||
typedef struct _drm_via_futex {
|
||||
enum {
|
||||
VIA_FUTEX_WAIT = 0x00,
|
||||
VIA_FUTEX_WAKE = 0X01
|
||||
} func;
|
||||
uint32_t ms;
|
||||
uint32_t lock;
|
||||
uint32_t val;
|
||||
} drm_via_futex_t;
|
||||
|
||||
typedef struct _drm_via_dma_init {
|
||||
enum {
|
||||
VIA_INIT_DMA = 0x01,
|
||||
VIA_CLEANUP_DMA = 0x02,
|
||||
VIA_DMA_INITIALIZED = 0x03
|
||||
} func;
|
||||
|
||||
unsigned long offset;
|
||||
unsigned long size;
|
||||
unsigned long reg_pause_addr;
|
||||
} drm_via_dma_init_t;
|
||||
|
||||
typedef struct _drm_via_cmdbuffer {
|
||||
char *buf;
|
||||
unsigned long size;
|
||||
} drm_via_cmdbuffer_t;
|
||||
|
||||
/* Warning: If you change the SAREA structure you must change the Xserver
|
||||
* structure as well */
|
||||
|
||||
typedef struct _drm_via_tex_region {
|
||||
unsigned char next, prev; /* indices to form a circular LRU */
|
||||
unsigned char inUse; /* owned by a client, or free? */
|
||||
int age; /* tracked by clients to update local LRU's */
|
||||
} drm_via_tex_region_t;
|
||||
|
||||
typedef struct _drm_via_sarea {
|
||||
unsigned int dirty;
|
||||
unsigned int nbox;
|
||||
drm_clip_rect_t boxes[VIA_NR_SAREA_CLIPRECTS];
|
||||
drm_via_tex_region_t texList[VIA_NR_TEX_REGIONS + 1];
|
||||
int texAge; /* last time texture was uploaded */
|
||||
int ctxOwner; /* last context to upload state */
|
||||
int vertexPrim;
|
||||
|
||||
/*
|
||||
* Below is for XvMC.
|
||||
* We want the lock integers alone on, and aligned to, a cache line.
|
||||
* Therefore this somewhat strange construct.
|
||||
*/
|
||||
|
||||
char XvMCLockArea[VIA_MAX_CACHELINE_SIZE * (VIA_NR_XVMC_LOCKS + 1)];
|
||||
|
||||
unsigned int XvMCDisplaying[VIA_NR_XVMC_PORTS];
|
||||
unsigned int XvMCSubPicOn[VIA_NR_XVMC_PORTS];
|
||||
unsigned int XvMCCtxNoGrabbed; /* Last context to hold decoder */
|
||||
|
||||
} drm_via_sarea_t;
|
||||
|
||||
typedef struct _drm_via_cmdbuf_size {
|
||||
enum {
|
||||
VIA_CMDBUF_SPACE = 0x01,
|
||||
VIA_CMDBUF_LAG = 0x02
|
||||
} func;
|
||||
int wait;
|
||||
uint32_t size;
|
||||
} drm_via_cmdbuf_size_t;
|
||||
|
||||
typedef enum {
|
||||
VIA_IRQ_ABSOLUTE = 0x0,
|
||||
VIA_IRQ_RELATIVE = 0x1,
|
||||
VIA_IRQ_SIGNAL = 0x10000000,
|
||||
VIA_IRQ_FORCE_SEQUENCE = 0x20000000
|
||||
} via_irq_seq_type_t;
|
||||
|
||||
#define VIA_IRQ_FLAGS_MASK 0xF0000000
|
||||
|
||||
struct drm_via_wait_irq_request{
|
||||
unsigned irq;
|
||||
via_irq_seq_type_t type;
|
||||
uint32_t sequence;
|
||||
uint32_t signal;
|
||||
};
|
||||
|
||||
typedef union drm_via_irqwait {
|
||||
struct drm_via_wait_irq_request request;
|
||||
struct drm_wait_vblank_reply reply;
|
||||
} drm_via_irqwait_t;
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
int via_fb_init(DRM_IOCTL_ARGS);
|
||||
int via_mem_alloc(DRM_IOCTL_ARGS);
|
||||
int via_mem_free(DRM_IOCTL_ARGS);
|
||||
int via_agp_init(DRM_IOCTL_ARGS);
|
||||
int via_map_init(DRM_IOCTL_ARGS);
|
||||
int via_decoder_futex(DRM_IOCTL_ARGS);
|
||||
int via_dma_init(DRM_IOCTL_ARGS);
|
||||
int via_cmdbuffer(DRM_IOCTL_ARGS);
|
||||
int via_flush_ioctl(DRM_IOCTL_ARGS);
|
||||
int via_pci_cmdbuffer(DRM_IOCTL_ARGS);
|
||||
int via_cmdbuf_size(DRM_IOCTL_ARGS);
|
||||
int via_wait_irq(DRM_IOCTL_ARGS);
|
||||
|
||||
#endif
|
||||
#endif /* _VIA_DRM_H_ */
|
126
drivers/char/drm/via_drv.c
Normal file
126
drivers/char/drm/via_drv.c
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
|
||||
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/config.h>
|
||||
#include "drmP.h"
|
||||
#include "via_drm.h"
|
||||
#include "via_drv.h"
|
||||
|
||||
#include "drm_pciids.h"
|
||||
|
||||
static int postinit(struct drm_device *dev, unsigned long flags)
|
||||
{
|
||||
DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n",
|
||||
DRIVER_NAME,
|
||||
DRIVER_MAJOR,
|
||||
DRIVER_MINOR,
|
||||
DRIVER_PATCHLEVEL,
|
||||
DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int version(drm_version_t * version)
|
||||
{
|
||||
int len;
|
||||
|
||||
version->version_major = DRIVER_MAJOR;
|
||||
version->version_minor = DRIVER_MINOR;
|
||||
version->version_patchlevel = DRIVER_PATCHLEVEL;
|
||||
DRM_COPY(version->name, DRIVER_NAME);
|
||||
DRM_COPY(version->date, DRIVER_DATE);
|
||||
DRM_COPY(version->desc, DRIVER_DESC);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pci_device_id pciidlist[] = {
|
||||
viadrv_PCI_IDS
|
||||
};
|
||||
|
||||
static drm_ioctl_desc_t ioctls[] = {
|
||||
[DRM_IOCTL_NR(DRM_VIA_ALLOCMEM)] = {via_mem_alloc, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_VIA_FREEMEM)] = {via_mem_free, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_VIA_AGP_INIT)] = {via_agp_init, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_VIA_FB_INIT)] = {via_fb_init, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_VIA_MAP_INIT)] = {via_map_init, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_VIA_DEC_FUTEX)] = {via_decoder_futex, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_VIA_DMA_INIT)] = {via_dma_init, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_VIA_CMDBUFFER)] = {via_cmdbuffer, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_VIA_FLUSH)] = {via_flush_ioctl, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_VIA_PCICMD)] = {via_pci_cmdbuffer, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_VIA_CMDBUF_SIZE)] = {via_cmdbuf_size, 1, 0},
|
||||
[DRM_IOCTL_NR(DRM_VIA_WAIT_IRQ)] = {via_wait_irq, 1, 0}
|
||||
};
|
||||
|
||||
static struct drm_driver driver = {
|
||||
.driver_features =
|
||||
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ |
|
||||
DRIVER_IRQ_SHARED | DRIVER_IRQ_VBL,
|
||||
.context_ctor = via_init_context,
|
||||
.context_dtor = via_final_context,
|
||||
.vblank_wait = via_driver_vblank_wait,
|
||||
.irq_preinstall = via_driver_irq_preinstall,
|
||||
.irq_postinstall = via_driver_irq_postinstall,
|
||||
.irq_uninstall = via_driver_irq_uninstall,
|
||||
.irq_handler = via_driver_irq_handler,
|
||||
.dma_quiescent = via_driver_dma_quiescent,
|
||||
.reclaim_buffers = drm_core_reclaim_buffers,
|
||||
.get_map_ofs = drm_core_get_map_ofs,
|
||||
.get_reg_ofs = drm_core_get_reg_ofs,
|
||||
.postinit = postinit,
|
||||
.version = version,
|
||||
.ioctls = ioctls,
|
||||
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
|
||||
.fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = drm_open,
|
||||
.release = drm_release,
|
||||
.ioctl = drm_ioctl,
|
||||
.mmap = drm_mmap,
|
||||
.poll = drm_poll,
|
||||
.fasync = drm_fasync,
|
||||
},
|
||||
.pci_driver = {
|
||||
.name = DRIVER_NAME,
|
||||
.id_table = pciidlist,
|
||||
}
|
||||
};
|
||||
|
||||
static int __init via_init(void)
|
||||
{
|
||||
via_init_command_verifier();
|
||||
return drm_init(&driver);
|
||||
}
|
||||
|
||||
static void __exit via_exit(void)
|
||||
{
|
||||
drm_exit(&driver);
|
||||
}
|
||||
|
||||
module_init(via_init);
|
||||
module_exit(via_exit);
|
||||
|
||||
MODULE_AUTHOR(DRIVER_AUTHOR);
|
||||
MODULE_DESCRIPTION(DRIVER_DESC);
|
||||
MODULE_LICENSE("GPL and additional rights");
|
118
drivers/char/drm/via_drv.h
Normal file
118
drivers/char/drm/via_drv.h
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
|
||||
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _VIA_DRV_H_
|
||||
#define _VIA_DRV_H_
|
||||
|
||||
#define DRIVER_AUTHOR "VIA"
|
||||
|
||||
#define DRIVER_NAME "via"
|
||||
#define DRIVER_DESC "VIA Unichrome / Pro"
|
||||
#define DRIVER_DATE "20050523"
|
||||
|
||||
#define DRIVER_MAJOR 2
|
||||
#define DRIVER_MINOR 6
|
||||
#define DRIVER_PATCHLEVEL 3
|
||||
|
||||
#include "via_verifier.h"
|
||||
|
||||
#define VIA_PCI_BUF_SIZE 60000
|
||||
#define VIA_FIRE_BUF_SIZE 1024
|
||||
#define VIA_NUM_IRQS 2
|
||||
|
||||
|
||||
|
||||
typedef struct drm_via_ring_buffer {
|
||||
drm_map_t map;
|
||||
char *virtual_start;
|
||||
} drm_via_ring_buffer_t;
|
||||
|
||||
typedef uint32_t maskarray_t[5];
|
||||
|
||||
typedef struct drm_via_irq {
|
||||
atomic_t irq_received;
|
||||
uint32_t pending_mask;
|
||||
uint32_t enable_mask;
|
||||
wait_queue_head_t irq_queue;
|
||||
} drm_via_irq_t;
|
||||
|
||||
typedef struct drm_via_private {
|
||||
drm_via_sarea_t *sarea_priv;
|
||||
drm_map_t *sarea;
|
||||
drm_map_t *fb;
|
||||
drm_map_t *mmio;
|
||||
unsigned long agpAddr;
|
||||
wait_queue_head_t decoder_queue[VIA_NR_XVMC_LOCKS];
|
||||
char *dma_ptr;
|
||||
unsigned int dma_low;
|
||||
unsigned int dma_high;
|
||||
unsigned int dma_offset;
|
||||
uint32_t dma_wrap;
|
||||
volatile uint32_t *last_pause_ptr;
|
||||
volatile uint32_t *hw_addr_ptr;
|
||||
drm_via_ring_buffer_t ring;
|
||||
struct timeval last_vblank;
|
||||
int last_vblank_valid;
|
||||
unsigned usec_per_vblank;
|
||||
drm_via_state_t hc_state;
|
||||
char pci_buf[VIA_PCI_BUF_SIZE];
|
||||
const uint32_t *fire_offsets[VIA_FIRE_BUF_SIZE];
|
||||
uint32_t num_fire_offsets;
|
||||
int pro_group_a;
|
||||
drm_via_irq_t via_irqs[VIA_NUM_IRQS];
|
||||
unsigned num_irqs;
|
||||
maskarray_t *irq_masks;
|
||||
uint32_t irq_enable_mask;
|
||||
uint32_t irq_pending_mask;
|
||||
} drm_via_private_t;
|
||||
|
||||
/* VIA MMIO register access */
|
||||
#define VIA_BASE ((dev_priv->mmio))
|
||||
|
||||
#define VIA_READ(reg) DRM_READ32(VIA_BASE, reg)
|
||||
#define VIA_WRITE(reg,val) DRM_WRITE32(VIA_BASE, reg, val)
|
||||
#define VIA_READ8(reg) DRM_READ8(VIA_BASE, reg)
|
||||
#define VIA_WRITE8(reg,val) DRM_WRITE8(VIA_BASE, reg, val)
|
||||
|
||||
extern int via_init_context(drm_device_t * dev, int context);
|
||||
extern int via_final_context(drm_device_t * dev, int context);
|
||||
|
||||
extern int via_do_cleanup_map(drm_device_t * dev);
|
||||
extern int via_map_init(struct inode *inode, struct file *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
extern int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence);
|
||||
|
||||
extern irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS);
|
||||
extern void via_driver_irq_preinstall(drm_device_t * dev);
|
||||
extern void via_driver_irq_postinstall(drm_device_t * dev);
|
||||
extern void via_driver_irq_uninstall(drm_device_t * dev);
|
||||
|
||||
extern int via_dma_cleanup(drm_device_t * dev);
|
||||
extern void via_init_command_verifier(void);
|
||||
extern int via_driver_dma_quiescent(drm_device_t * dev);
|
||||
extern void via_init_futex(drm_via_private_t *dev_priv);
|
||||
extern void via_cleanup_futex(drm_via_private_t *dev_priv);
|
||||
extern void via_release_futex(drm_via_private_t *dev_priv, int context);
|
||||
|
||||
|
||||
#endif
|
280
drivers/char/drm/via_ds.c
Normal file
280
drivers/char/drm/via_ds.c
Normal file
@ -0,0 +1,280 @@
|
||||
/*
|
||||
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
|
||||
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
|
||||
* Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/pci.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#include "via_ds.h"
|
||||
extern unsigned int VIA_DEBUG;
|
||||
|
||||
set_t *via_setInit(void)
|
||||
{
|
||||
int i;
|
||||
set_t *set;
|
||||
set = (set_t *) drm_alloc(sizeof(set_t), DRM_MEM_DRIVER);
|
||||
for (i = 0; i < SET_SIZE; i++) {
|
||||
set->list[i].free_next = i + 1;
|
||||
set->list[i].alloc_next = -1;
|
||||
}
|
||||
set->list[SET_SIZE - 1].free_next = -1;
|
||||
set->free = 0;
|
||||
set->alloc = -1;
|
||||
set->trace = -1;
|
||||
return set;
|
||||
}
|
||||
|
||||
int via_setAdd(set_t * set, ITEM_TYPE item)
|
||||
{
|
||||
int free = set->free;
|
||||
if (free != -1) {
|
||||
set->list[free].val = item;
|
||||
set->free = set->list[free].free_next;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
set->list[free].alloc_next = set->alloc;
|
||||
set->alloc = free;
|
||||
set->list[free].free_next = -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int via_setDel(set_t * set, ITEM_TYPE item)
|
||||
{
|
||||
int alloc = set->alloc;
|
||||
int prev = -1;
|
||||
|
||||
while (alloc != -1) {
|
||||
if (set->list[alloc].val == item) {
|
||||
if (prev != -1)
|
||||
set->list[prev].alloc_next =
|
||||
set->list[alloc].alloc_next;
|
||||
else
|
||||
set->alloc = set->list[alloc].alloc_next;
|
||||
break;
|
||||
}
|
||||
prev = alloc;
|
||||
alloc = set->list[alloc].alloc_next;
|
||||
}
|
||||
|
||||
if (alloc == -1)
|
||||
return 0;
|
||||
|
||||
set->list[alloc].free_next = set->free;
|
||||
set->free = alloc;
|
||||
set->list[alloc].alloc_next = -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* setFirst -> setAdd -> setNext is wrong */
|
||||
|
||||
int via_setFirst(set_t * set, ITEM_TYPE * item)
|
||||
{
|
||||
if (set->alloc == -1)
|
||||
return 0;
|
||||
|
||||
*item = set->list[set->alloc].val;
|
||||
set->trace = set->list[set->alloc].alloc_next;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int via_setNext(set_t * set, ITEM_TYPE * item)
|
||||
{
|
||||
if (set->trace == -1)
|
||||
return 0;
|
||||
|
||||
*item = set->list[set->trace].val;
|
||||
set->trace = set->list[set->trace].alloc_next;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int via_setDestroy(set_t * set)
|
||||
{
|
||||
drm_free(set, sizeof(set_t), DRM_MEM_DRIVER);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define ISFREE(bptr) ((bptr)->free)
|
||||
|
||||
#define fprintf(fmt, arg...) do{}while(0)
|
||||
|
||||
memHeap_t *via_mmInit(int ofs, int size)
|
||||
{
|
||||
PMemBlock blocks;
|
||||
|
||||
if (size <= 0)
|
||||
return 0;
|
||||
|
||||
blocks = (TMemBlock *) drm_calloc(1, sizeof(TMemBlock), DRM_MEM_DRIVER);
|
||||
|
||||
if (blocks) {
|
||||
blocks->ofs = ofs;
|
||||
blocks->size = size;
|
||||
blocks->free = 1;
|
||||
return (memHeap_t *) blocks;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static TMemBlock *SliceBlock(TMemBlock * p,
|
||||
int startofs, int size,
|
||||
int reserved, int alignment)
|
||||
{
|
||||
TMemBlock *newblock;
|
||||
|
||||
/* break left */
|
||||
if (startofs > p->ofs) {
|
||||
newblock =
|
||||
(TMemBlock *) drm_calloc(1, sizeof(TMemBlock),
|
||||
DRM_MEM_DRIVER);
|
||||
newblock->ofs = startofs;
|
||||
newblock->size = p->size - (startofs - p->ofs);
|
||||
newblock->free = 1;
|
||||
newblock->next = p->next;
|
||||
p->size -= newblock->size;
|
||||
p->next = newblock;
|
||||
p = newblock;
|
||||
}
|
||||
|
||||
/* break right */
|
||||
if (size < p->size) {
|
||||
newblock =
|
||||
(TMemBlock *) drm_calloc(1, sizeof(TMemBlock),
|
||||
DRM_MEM_DRIVER);
|
||||
newblock->ofs = startofs + size;
|
||||
newblock->size = p->size - size;
|
||||
newblock->free = 1;
|
||||
newblock->next = p->next;
|
||||
p->size = size;
|
||||
p->next = newblock;
|
||||
}
|
||||
|
||||
/* p = middle block */
|
||||
p->align = alignment;
|
||||
p->free = 0;
|
||||
p->reserved = reserved;
|
||||
return p;
|
||||
}
|
||||
|
||||
PMemBlock via_mmAllocMem(memHeap_t * heap, int size, int align2,
|
||||
int startSearch)
|
||||
{
|
||||
int mask, startofs, endofs;
|
||||
TMemBlock *p;
|
||||
|
||||
if (!heap || align2 < 0 || size <= 0)
|
||||
return NULL;
|
||||
|
||||
mask = (1 << align2) - 1;
|
||||
startofs = 0;
|
||||
p = (TMemBlock *) heap;
|
||||
|
||||
while (p) {
|
||||
if (ISFREE(p)) {
|
||||
startofs = (p->ofs + mask) & ~mask;
|
||||
|
||||
if (startofs < startSearch)
|
||||
startofs = startSearch;
|
||||
|
||||
endofs = startofs + size;
|
||||
|
||||
if (endofs <= (p->ofs + p->size))
|
||||
break;
|
||||
}
|
||||
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
p = SliceBlock(p, startofs, size, 0, mask + 1);
|
||||
p->heap = heap;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static __inline__ int Join2Blocks(TMemBlock * p)
|
||||
{
|
||||
if (p->free && p->next && p->next->free) {
|
||||
TMemBlock *q = p->next;
|
||||
p->size += q->size;
|
||||
p->next = q->next;
|
||||
drm_free(q, sizeof(TMemBlock), DRM_MEM_DRIVER);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int via_mmFreeMem(PMemBlock b)
|
||||
{
|
||||
TMemBlock *p, *prev;
|
||||
|
||||
if (!b)
|
||||
return 0;
|
||||
|
||||
if (!b->heap) {
|
||||
fprintf(stderr, "no heap\n");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
p = b->heap;
|
||||
prev = NULL;
|
||||
|
||||
while (p && p != b) {
|
||||
prev = p;
|
||||
p = p->next;
|
||||
}
|
||||
|
||||
if (!p || p->free || p->reserved) {
|
||||
if (!p)
|
||||
fprintf(stderr, "block not found in heap\n");
|
||||
else if (p->free)
|
||||
fprintf(stderr, "block already free\n");
|
||||
else
|
||||
fprintf(stderr, "block is reserved\n");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
p->free = 1;
|
||||
Join2Blocks(p);
|
||||
|
||||
if (prev)
|
||||
Join2Blocks(prev);
|
||||
|
||||
return 0;
|
||||
}
|
104
drivers/char/drm/via_ds.h
Normal file
104
drivers/char/drm/via_ds.h
Normal file
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
|
||||
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
|
||||
* Copyright 2000 Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _via_ds_h_
|
||||
#define _via_ds_h_
|
||||
|
||||
#include "drmP.h"
|
||||
|
||||
/* Set Data Structure */
|
||||
#define SET_SIZE 5000
|
||||
typedef unsigned long ITEM_TYPE;
|
||||
|
||||
typedef struct {
|
||||
ITEM_TYPE val;
|
||||
int alloc_next, free_next;
|
||||
} list_item_t;
|
||||
|
||||
typedef struct {
|
||||
int alloc;
|
||||
int free;
|
||||
int trace;
|
||||
list_item_t list[SET_SIZE];
|
||||
} set_t;
|
||||
|
||||
set_t *via_setInit(void);
|
||||
int via_setAdd(set_t * set, ITEM_TYPE item);
|
||||
int via_setDel(set_t * set, ITEM_TYPE item);
|
||||
int via_setFirst(set_t * set, ITEM_TYPE * item);
|
||||
int via_setNext(set_t * set, ITEM_TYPE * item);
|
||||
int via_setDestroy(set_t * set);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef MM_INC
|
||||
#define MM_INC
|
||||
|
||||
struct mem_block_t {
|
||||
struct mem_block_t *next;
|
||||
struct mem_block_t *heap;
|
||||
int ofs, size;
|
||||
int align;
|
||||
int free:1;
|
||||
int reserved:1;
|
||||
};
|
||||
typedef struct mem_block_t TMemBlock;
|
||||
typedef struct mem_block_t *PMemBlock;
|
||||
|
||||
/* a heap is just the first block in a chain */
|
||||
typedef struct mem_block_t memHeap_t;
|
||||
|
||||
static __inline__ int mmBlockSize(PMemBlock b)
|
||||
{
|
||||
return b->size;
|
||||
}
|
||||
|
||||
static __inline__ int mmOffset(PMemBlock b)
|
||||
{
|
||||
return b->ofs;
|
||||
}
|
||||
|
||||
static __inline__ void mmMarkReserved(PMemBlock b)
|
||||
{
|
||||
b->reserved = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* input: total size in bytes
|
||||
* return: a heap pointer if OK, NULL if error
|
||||
*/
|
||||
memHeap_t *via_mmInit(int ofs, int size);
|
||||
|
||||
PMemBlock via_mmAllocMem(memHeap_t * heap, int size, int align2,
|
||||
int startSearch);
|
||||
|
||||
/*
|
||||
* Free block starts at offset
|
||||
* input: pointer to a block
|
||||
* return: 0 if OK, -1 if error
|
||||
*/
|
||||
int via_mmFreeMem(PMemBlock b);
|
||||
|
||||
#endif
|
339
drivers/char/drm/via_irq.c
Normal file
339
drivers/char/drm/via_irq.c
Normal file
@ -0,0 +1,339 @@
|
||||
/* via_irq.c
|
||||
*
|
||||
* Copyright 2004 BEAM Ltd.
|
||||
* Copyright 2002 Tungsten Graphics, Inc.
|
||||
* Copyright 2005 Thomas Hellstrom.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BEAM LTD, TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors:
|
||||
* Terry Barnaby <terry1@beam.ltd.uk>
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
* Thomas Hellstrom <unichrome@shipmail.org>
|
||||
*
|
||||
* This code provides standard DRM access to the Via Unichrome / Pro Vertical blank
|
||||
* interrupt, as well as an infrastructure to handle other interrupts of the chip.
|
||||
* The refresh rate is also calculated for video playback sync purposes.
|
||||
*/
|
||||
|
||||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
#include "via_drm.h"
|
||||
#include "via_drv.h"
|
||||
|
||||
#define VIA_REG_INTERRUPT 0x200
|
||||
|
||||
/* VIA_REG_INTERRUPT */
|
||||
#define VIA_IRQ_GLOBAL (1 << 31)
|
||||
#define VIA_IRQ_VBLANK_ENABLE (1 << 19)
|
||||
#define VIA_IRQ_VBLANK_PENDING (1 << 3)
|
||||
#define VIA_IRQ_HQV0_ENABLE (1 << 11)
|
||||
#define VIA_IRQ_HQV1_ENABLE (1 << 25)
|
||||
#define VIA_IRQ_HQV0_PENDING (1 << 9)
|
||||
#define VIA_IRQ_HQV1_PENDING (1 << 10)
|
||||
|
||||
/*
|
||||
* Device-specific IRQs go here. This type might need to be extended with
|
||||
* the register if there are multiple IRQ control registers.
|
||||
* Currently we activate the HQV interrupts of Unichrome Pro group A.
|
||||
*/
|
||||
|
||||
static maskarray_t via_pro_group_a_irqs[] = {
|
||||
{VIA_IRQ_HQV0_ENABLE, VIA_IRQ_HQV0_PENDING, 0x000003D0, 0x00008010, 0x00000000 },
|
||||
{VIA_IRQ_HQV1_ENABLE, VIA_IRQ_HQV1_PENDING, 0x000013D0, 0x00008010, 0x00000000 }};
|
||||
static int via_num_pro_group_a = sizeof(via_pro_group_a_irqs)/sizeof(maskarray_t);
|
||||
|
||||
static maskarray_t via_unichrome_irqs[] = {};
|
||||
static int via_num_unichrome = sizeof(via_unichrome_irqs)/sizeof(maskarray_t);
|
||||
|
||||
|
||||
static unsigned time_diff(struct timeval *now,struct timeval *then)
|
||||
{
|
||||
return (now->tv_usec >= then->tv_usec) ?
|
||||
now->tv_usec - then->tv_usec :
|
||||
1000000 - (then->tv_usec - now->tv_usec);
|
||||
}
|
||||
|
||||
irqreturn_t via_driver_irq_handler(DRM_IRQ_ARGS)
|
||||
{
|
||||
drm_device_t *dev = (drm_device_t *) arg;
|
||||
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
|
||||
u32 status;
|
||||
int handled = 0;
|
||||
struct timeval cur_vblank;
|
||||
drm_via_irq_t *cur_irq = dev_priv->via_irqs;
|
||||
int i;
|
||||
|
||||
status = VIA_READ(VIA_REG_INTERRUPT);
|
||||
if (status & VIA_IRQ_VBLANK_PENDING) {
|
||||
atomic_inc(&dev->vbl_received);
|
||||
if (!(atomic_read(&dev->vbl_received) & 0x0F)) {
|
||||
do_gettimeofday(&cur_vblank);
|
||||
if (dev_priv->last_vblank_valid) {
|
||||
dev_priv->usec_per_vblank =
|
||||
time_diff( &cur_vblank,&dev_priv->last_vblank) >> 4;
|
||||
}
|
||||
dev_priv->last_vblank = cur_vblank;
|
||||
dev_priv->last_vblank_valid = 1;
|
||||
}
|
||||
if (!(atomic_read(&dev->vbl_received) & 0xFF)) {
|
||||
DRM_DEBUG("US per vblank is: %u\n",
|
||||
dev_priv->usec_per_vblank);
|
||||
}
|
||||
DRM_WAKEUP(&dev->vbl_queue);
|
||||
drm_vbl_send_signals(dev);
|
||||
handled = 1;
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<dev_priv->num_irqs; ++i) {
|
||||
if (status & cur_irq->pending_mask) {
|
||||
atomic_inc( &cur_irq->irq_received );
|
||||
DRM_WAKEUP( &cur_irq->irq_queue );
|
||||
handled = 1;
|
||||
}
|
||||
cur_irq++;
|
||||
}
|
||||
|
||||
/* Acknowlege interrupts */
|
||||
VIA_WRITE(VIA_REG_INTERRUPT, status);
|
||||
|
||||
|
||||
if (handled)
|
||||
return IRQ_HANDLED;
|
||||
else
|
||||
return IRQ_NONE;
|
||||
}
|
||||
|
||||
static __inline__ void viadrv_acknowledge_irqs(drm_via_private_t * dev_priv)
|
||||
{
|
||||
u32 status;
|
||||
|
||||
if (dev_priv) {
|
||||
/* Acknowlege interrupts */
|
||||
status = VIA_READ(VIA_REG_INTERRUPT);
|
||||
VIA_WRITE(VIA_REG_INTERRUPT, status |
|
||||
dev_priv->irq_pending_mask);
|
||||
}
|
||||
}
|
||||
|
||||
int via_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence)
|
||||
{
|
||||
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
|
||||
unsigned int cur_vblank;
|
||||
int ret = 0;
|
||||
|
||||
DRM_DEBUG("viadrv_vblank_wait\n");
|
||||
if (!dev_priv) {
|
||||
DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
viadrv_acknowledge_irqs(dev_priv);
|
||||
|
||||
/* Assume that the user has missed the current sequence number
|
||||
* by about a day rather than she wants to wait for years
|
||||
* using vertical blanks...
|
||||
*/
|
||||
|
||||
DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
|
||||
(((cur_vblank = atomic_read(&dev->vbl_received)) -
|
||||
*sequence) <= (1 << 23)));
|
||||
|
||||
*sequence = cur_vblank;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
via_driver_irq_wait(drm_device_t * dev, unsigned int irq, int force_sequence,
|
||||
unsigned int *sequence)
|
||||
{
|
||||
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
|
||||
unsigned int cur_irq_sequence;
|
||||
drm_via_irq_t *cur_irq = dev_priv->via_irqs;
|
||||
int ret = 0;
|
||||
maskarray_t *masks = dev_priv->irq_masks;
|
||||
|
||||
DRM_DEBUG("%s\n", __FUNCTION__);
|
||||
|
||||
if (!dev_priv) {
|
||||
DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
if (irq >= dev_priv->num_irqs ) {
|
||||
DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__, irq);
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
cur_irq += irq;
|
||||
|
||||
if (masks[irq][2] && !force_sequence) {
|
||||
DRM_WAIT_ON(ret, cur_irq->irq_queue, 3 * DRM_HZ,
|
||||
((VIA_READ(masks[irq][2]) & masks[irq][3]) == masks[irq][4]));
|
||||
cur_irq_sequence = atomic_read(&cur_irq->irq_received);
|
||||
} else {
|
||||
DRM_WAIT_ON(ret, cur_irq->irq_queue, 3 * DRM_HZ,
|
||||
(((cur_irq_sequence = atomic_read(&cur_irq->irq_received)) -
|
||||
*sequence) <= (1 << 23)));
|
||||
}
|
||||
*sequence = cur_irq_sequence;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* drm_dma.h hooks
|
||||
*/
|
||||
|
||||
void via_driver_irq_preinstall(drm_device_t * dev)
|
||||
{
|
||||
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
|
||||
u32 status;
|
||||
drm_via_irq_t *cur_irq = dev_priv->via_irqs;
|
||||
int i;
|
||||
|
||||
DRM_DEBUG("driver_irq_preinstall: dev_priv: %p\n", dev_priv);
|
||||
if (dev_priv) {
|
||||
|
||||
dev_priv->irq_enable_mask = VIA_IRQ_VBLANK_ENABLE;
|
||||
dev_priv->irq_pending_mask = VIA_IRQ_VBLANK_PENDING;
|
||||
|
||||
dev_priv->irq_masks = (dev_priv->pro_group_a) ?
|
||||
via_pro_group_a_irqs : via_unichrome_irqs;
|
||||
dev_priv->num_irqs = (dev_priv->pro_group_a) ?
|
||||
via_num_pro_group_a : via_num_unichrome;
|
||||
|
||||
for(i=0; i < dev_priv->num_irqs; ++i) {
|
||||
atomic_set(&cur_irq->irq_received, 0);
|
||||
cur_irq->enable_mask = dev_priv->irq_masks[i][0];
|
||||
cur_irq->pending_mask = dev_priv->irq_masks[i][1];
|
||||
DRM_INIT_WAITQUEUE( &cur_irq->irq_queue );
|
||||
dev_priv->irq_enable_mask |= cur_irq->enable_mask;
|
||||
dev_priv->irq_pending_mask |= cur_irq->pending_mask;
|
||||
cur_irq++;
|
||||
|
||||
DRM_DEBUG("Initializing IRQ %d\n", i);
|
||||
}
|
||||
|
||||
dev_priv->last_vblank_valid = 0;
|
||||
|
||||
// Clear VSync interrupt regs
|
||||
status = VIA_READ(VIA_REG_INTERRUPT);
|
||||
VIA_WRITE(VIA_REG_INTERRUPT, status &
|
||||
~(dev_priv->irq_enable_mask));
|
||||
|
||||
/* Clear bits if they're already high */
|
||||
viadrv_acknowledge_irqs(dev_priv);
|
||||
}
|
||||
}
|
||||
|
||||
void via_driver_irq_postinstall(drm_device_t * dev)
|
||||
{
|
||||
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
|
||||
u32 status;
|
||||
|
||||
DRM_DEBUG("via_driver_irq_postinstall\n");
|
||||
if (dev_priv) {
|
||||
status = VIA_READ(VIA_REG_INTERRUPT);
|
||||
VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_GLOBAL
|
||||
| dev_priv->irq_enable_mask);
|
||||
|
||||
/* Some magic, oh for some data sheets ! */
|
||||
|
||||
VIA_WRITE8(0x83d4, 0x11);
|
||||
VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void via_driver_irq_uninstall(drm_device_t * dev)
|
||||
{
|
||||
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
|
||||
u32 status;
|
||||
|
||||
DRM_DEBUG("driver_irq_uninstall)\n");
|
||||
if (dev_priv) {
|
||||
|
||||
/* Some more magic, oh for some data sheets ! */
|
||||
|
||||
VIA_WRITE8(0x83d4, 0x11);
|
||||
VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30);
|
||||
|
||||
status = VIA_READ(VIA_REG_INTERRUPT);
|
||||
VIA_WRITE(VIA_REG_INTERRUPT, status &
|
||||
~(VIA_IRQ_VBLANK_ENABLE | dev_priv->irq_enable_mask));
|
||||
}
|
||||
}
|
||||
|
||||
int via_wait_irq(DRM_IOCTL_ARGS)
|
||||
{
|
||||
drm_file_t *priv = filp->private_data;
|
||||
drm_device_t *dev = priv->head->dev;
|
||||
drm_via_irqwait_t __user *argp = (void __user *)data;
|
||||
drm_via_irqwait_t irqwait;
|
||||
struct timeval now;
|
||||
int ret = 0;
|
||||
drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
|
||||
drm_via_irq_t *cur_irq = dev_priv->via_irqs;
|
||||
int force_sequence;
|
||||
|
||||
if (!dev->irq)
|
||||
return DRM_ERR(EINVAL);
|
||||
|
||||
DRM_COPY_FROM_USER_IOCTL(irqwait, argp, sizeof(irqwait));
|
||||
if (irqwait.request.irq >= dev_priv->num_irqs) {
|
||||
DRM_ERROR("%s Trying to wait on unknown irq %d\n", __FUNCTION__,
|
||||
irqwait.request.irq);
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
cur_irq += irqwait.request.irq;
|
||||
|
||||
switch (irqwait.request.type & ~VIA_IRQ_FLAGS_MASK) {
|
||||
case VIA_IRQ_RELATIVE:
|
||||
irqwait.request.sequence += atomic_read(&cur_irq->irq_received);
|
||||
irqwait.request.type &= ~_DRM_VBLANK_RELATIVE;
|
||||
case VIA_IRQ_ABSOLUTE:
|
||||
break;
|
||||
default:
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
if (irqwait.request.type & VIA_IRQ_SIGNAL) {
|
||||
DRM_ERROR("%s Signals on Via IRQs not implemented yet.\n",
|
||||
__FUNCTION__);
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
force_sequence = (irqwait.request.type & VIA_IRQ_FORCE_SEQUENCE);
|
||||
|
||||
ret = via_driver_irq_wait(dev, irqwait.request.irq, force_sequence,
|
||||
&irqwait.request.sequence);
|
||||
do_gettimeofday(&now);
|
||||
irqwait.reply.tval_sec = now.tv_sec;
|
||||
irqwait.reply.tval_usec = now.tv_usec;
|
||||
|
||||
DRM_COPY_TO_USER_IOCTL(argp, irqwait, sizeof(irqwait));
|
||||
|
||||
return ret;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user