diff options
488 files changed, 5182 insertions, 4110 deletions
@@ -688,10 +688,13 @@ S: Oxfordshire, UK. | |||
688 | 688 | ||
689 | N: Kees Cook | 689 | N: Kees Cook |
690 | E: kees@outflux.net | 690 | E: kees@outflux.net |
691 | W: http://outflux.net/ | 691 | E: kees@ubuntu.com |
692 | P: 1024D/17063E6D 9FA3 C49C 23C9 D1BC 2E30 1975 1FFF 4BA9 1706 3E6D | 692 | E: keescook@chromium.org |
693 | D: Minor updates to SCSI types, added /proc/pid/maps protection | 693 | W: http://outflux.net/blog/ |
694 | P: 4096R/DC6DC026 A5C3 F68F 229D D60F 723E 6E13 8972 F4DF DC6D C026 | ||
695 | D: Various security things, bug fixes, and documentation. | ||
694 | S: (ask for current address) | 696 | S: (ask for current address) |
697 | S: Portland, Oregon | ||
695 | S: USA | 698 | S: USA |
696 | 699 | ||
697 | N: Robin Cornelius | 700 | N: Robin Cornelius |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index a0c5c5f4fce6..81c287fad79d 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -315,12 +315,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
315 | CPU-intensive style benchmark, and it can vary highly in | 315 | CPU-intensive style benchmark, and it can vary highly in |
316 | a microbenchmark depending on workload and compiler. | 316 | a microbenchmark depending on workload and compiler. |
317 | 317 | ||
318 | 1: only for 32-bit processes | 318 | 32: only for 32-bit processes |
319 | 2: only for 64-bit processes | 319 | 64: only for 64-bit processes |
320 | on: enable for both 32- and 64-bit processes | 320 | on: enable for both 32- and 64-bit processes |
321 | off: disable for both 32- and 64-bit processes | 321 | off: disable for both 32- and 64-bit processes |
322 | 322 | ||
323 | amd_iommu= [HW,X86-84] | 323 | amd_iommu= [HW,X86-64] |
324 | Pass parameters to the AMD IOMMU driver in the system. | 324 | Pass parameters to the AMD IOMMU driver in the system. |
325 | Possible values are: | 325 | Possible values are: |
326 | fullflush - enable flushing of IO/TLB entries when | 326 | fullflush - enable flushing of IO/TLB entries when |
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index f049a1ca186f..589f2da5d545 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -282,11 +282,11 @@ tcp_max_ssthresh - INTEGER | |||
282 | Default: 0 (off) | 282 | Default: 0 (off) |
283 | 283 | ||
284 | tcp_max_syn_backlog - INTEGER | 284 | tcp_max_syn_backlog - INTEGER |
285 | Maximal number of remembered connection requests, which are | 285 | Maximal number of remembered connection requests, which have not |
286 | still did not receive an acknowledgment from connecting client. | 286 | received an acknowledgment from connecting client. |
287 | Default value is 1024 for systems with more than 128Mb of memory, | 287 | The minimal value is 128 for low memory machines, and it will |
288 | and 128 for low memory machines. If server suffers of overload, | 288 | increase in proportion to the memory of machine. |
289 | try to increase this number. | 289 | If server suffers from overload, try increasing this number. |
290 | 290 | ||
291 | tcp_max_tw_buckets - INTEGER | 291 | tcp_max_tw_buckets - INTEGER |
292 | Maximal number of timewait sockets held by system simultaneously. | 292 | Maximal number of timewait sockets held by system simultaneously. |
diff --git a/Documentation/sound/alsa/soc/machine.txt b/Documentation/sound/alsa/soc/machine.txt index 3e2ec9cbf397..d50c14df3411 100644 --- a/Documentation/sound/alsa/soc/machine.txt +++ b/Documentation/sound/alsa/soc/machine.txt | |||
@@ -50,8 +50,7 @@ Machine DAI Configuration | |||
50 | The machine DAI configuration glues all the codec and CPU DAIs together. It can | 50 | The machine DAI configuration glues all the codec and CPU DAIs together. It can |
51 | also be used to set up the DAI system clock and for any machine related DAI | 51 | also be used to set up the DAI system clock and for any machine related DAI |
52 | initialisation e.g. the machine audio map can be connected to the codec audio | 52 | initialisation e.g. the machine audio map can be connected to the codec audio |
53 | map, unconnected codec pins can be set as such. Please see corgi.c, spitz.c | 53 | map, unconnected codec pins can be set as such. |
54 | for examples. | ||
55 | 54 | ||
56 | struct snd_soc_dai_link is used to set up each DAI in your machine. e.g. | 55 | struct snd_soc_dai_link is used to set up each DAI in your machine. e.g. |
57 | 56 | ||
@@ -83,8 +82,7 @@ Machine Power Map | |||
83 | The machine driver can optionally extend the codec power map and to become an | 82 | The machine driver can optionally extend the codec power map and to become an |
84 | audio power map of the audio subsystem. This allows for automatic power up/down | 83 | audio power map of the audio subsystem. This allows for automatic power up/down |
85 | of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack | 84 | of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack |
86 | sockets in the machine init function. See soc/pxa/spitz.c and dapm.txt for | 85 | sockets in the machine init function. |
87 | details. | ||
88 | 86 | ||
89 | 87 | ||
90 | Machine Controls | 88 | Machine Controls |
diff --git a/Documentation/usb/linux-cdc-acm.inf b/Documentation/usb/linux-cdc-acm.inf index 37a02ce54841..f0ffc27d4c0a 100644 --- a/Documentation/usb/linux-cdc-acm.inf +++ b/Documentation/usb/linux-cdc-acm.inf | |||
@@ -90,10 +90,10 @@ ServiceBinary=%12%\USBSER.sys | |||
90 | [SourceDisksFiles] | 90 | [SourceDisksFiles] |
91 | [SourceDisksNames] | 91 | [SourceDisksNames] |
92 | [DeviceList] | 92 | [DeviceList] |
93 | %DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_1D6B&PID_0104&MI_02 | 93 | %DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_1D6B&PID_0104&MI_02, USB\VID_1D6B&PID_0106&MI_00 |
94 | 94 | ||
95 | [DeviceList.NTamd64] | 95 | [DeviceList.NTamd64] |
96 | %DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_1D6B&PID_0104&MI_02 | 96 | %DESCRIPTION%=DriverInstall, USB\VID_0525&PID_A4A7, USB\VID_1D6B&PID_0104&MI_02, USB\VID_1D6B&PID_0106&MI_00 |
97 | 97 | ||
98 | 98 | ||
99 | ;------------------------------------------------------------------------------ | 99 | ;------------------------------------------------------------------------------ |
diff --git a/MAINTAINERS b/MAINTAINERS index 4b823fff515f..796d67a58491 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -511,8 +511,8 @@ M: Joerg Roedel <joerg.roedel@amd.com> | |||
511 | L: iommu@lists.linux-foundation.org | 511 | L: iommu@lists.linux-foundation.org |
512 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git | 512 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git |
513 | S: Supported | 513 | S: Supported |
514 | F: arch/x86/kernel/amd_iommu*.c | 514 | F: drivers/iommu/amd_iommu*.[ch] |
515 | F: arch/x86/include/asm/amd_iommu*.h | 515 | F: include/linux/amd-iommu.h |
516 | 516 | ||
517 | AMD MICROCODE UPDATE SUPPORT | 517 | AMD MICROCODE UPDATE SUPPORT |
518 | M: Andreas Herrmann <andreas.herrmann3@amd.com> | 518 | M: Andreas Herrmann <andreas.herrmann3@amd.com> |
@@ -1054,35 +1054,18 @@ ARM/SAMSUNG ARM ARCHITECTURES | |||
1054 | M: Ben Dooks <ben-linux@fluff.org> | 1054 | M: Ben Dooks <ben-linux@fluff.org> |
1055 | M: Kukjin Kim <kgene.kim@samsung.com> | 1055 | M: Kukjin Kim <kgene.kim@samsung.com> |
1056 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1056 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1057 | L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | ||
1057 | W: http://www.fluff.org/ben/linux/ | 1058 | W: http://www.fluff.org/ben/linux/ |
1058 | S: Maintained | 1059 | S: Maintained |
1059 | F: arch/arm/plat-samsung/ | 1060 | F: arch/arm/plat-samsung/ |
1060 | F: arch/arm/plat-s3c24xx/ | 1061 | F: arch/arm/plat-s3c24xx/ |
1061 | F: arch/arm/plat-s5p/ | 1062 | F: arch/arm/plat-s5p/ |
1063 | F: arch/arm/mach-s3c24*/ | ||
1064 | F: arch/arm/mach-s3c64xx/ | ||
1062 | F: drivers/*/*s3c2410* | 1065 | F: drivers/*/*s3c2410* |
1063 | F: drivers/*/*/*s3c2410* | 1066 | F: drivers/*/*/*s3c2410* |
1064 | 1067 | F: drivers/spi/spi-s3c* | |
1065 | ARM/S3C2410 ARM ARCHITECTURE | 1068 | F: sound/soc/samsung/* |
1066 | M: Ben Dooks <ben-linux@fluff.org> | ||
1067 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
1068 | W: http://www.fluff.org/ben/linux/ | ||
1069 | S: Maintained | ||
1070 | F: arch/arm/mach-s3c2410/ | ||
1071 | |||
1072 | ARM/S3C244x ARM ARCHITECTURE | ||
1073 | M: Ben Dooks <ben-linux@fluff.org> | ||
1074 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
1075 | W: http://www.fluff.org/ben/linux/ | ||
1076 | S: Maintained | ||
1077 | F: arch/arm/mach-s3c2440/ | ||
1078 | F: arch/arm/mach-s3c2443/ | ||
1079 | |||
1080 | ARM/S3C64xx ARM ARCHITECTURE | ||
1081 | M: Ben Dooks <ben-linux@fluff.org> | ||
1082 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
1083 | W: http://www.fluff.org/ben/linux/ | ||
1084 | S: Maintained | ||
1085 | F: arch/arm/mach-s3c64xx/ | ||
1086 | 1069 | ||
1087 | ARM/S5P EXYNOS ARM ARCHITECTURES | 1070 | ARM/S5P EXYNOS ARM ARCHITECTURES |
1088 | M: Kukjin Kim <kgene.kim@samsung.com> | 1071 | M: Kukjin Kim <kgene.kim@samsung.com> |
@@ -4319,8 +4302,9 @@ F: include/linux/mm.h | |||
4319 | F: mm/ | 4302 | F: mm/ |
4320 | 4303 | ||
4321 | MEMORY RESOURCE CONTROLLER | 4304 | MEMORY RESOURCE CONTROLLER |
4305 | M: Johannes Weiner <hannes@cmpxchg.org> | ||
4306 | M: Michal Hocko <mhocko@suse.cz> | ||
4322 | M: Balbir Singh <bsingharora@gmail.com> | 4307 | M: Balbir Singh <bsingharora@gmail.com> |
4323 | M: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> | ||
4324 | M: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 4308 | M: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> |
4325 | L: cgroups@vger.kernel.org | 4309 | L: cgroups@vger.kernel.org |
4326 | L: linux-mm@kvack.org | 4310 | L: linux-mm@kvack.org |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 2 | 2 | PATCHLEVEL = 2 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc5 |
5 | NAME = Saber-toothed Squirrel | 5 | NAME = Saber-toothed Squirrel |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index c5213e78606b..e0d236d7ff73 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -100,6 +100,14 @@ choice | |||
100 | Note that the system will appear to hang during boot if there | 100 | Note that the system will appear to hang during boot if there |
101 | is nothing connected to read from the DCC. | 101 | is nothing connected to read from the DCC. |
102 | 102 | ||
103 | config AT91_DEBUG_LL_DBGU0 | ||
104 | bool "Kernel low-level debugging on rm9200, 9260/9g20, 9261/9g10 and 9rl" | ||
105 | depends on HAVE_AT91_DBGU0 | ||
106 | |||
107 | config AT91_DEBUG_LL_DBGU1 | ||
108 | bool "Kernel low-level debugging on 9263, 9g45 and cap9" | ||
109 | depends on HAVE_AT91_DBGU1 | ||
110 | |||
103 | config DEBUG_FOOTBRIDGE_COM1 | 111 | config DEBUG_FOOTBRIDGE_COM1 |
104 | bool "Kernel low-level debugging messages via footbridge 8250 at PCI COM1" | 112 | bool "Kernel low-level debugging messages via footbridge 8250 at PCI COM1" |
105 | depends on FOOTBRIDGE | 113 | depends on FOOTBRIDGE |
@@ -247,6 +255,43 @@ choice | |||
247 | their output to the standard serial port on the RealView | 255 | their output to the standard serial port on the RealView |
248 | PB1176 platform. | 256 | PB1176 platform. |
249 | 257 | ||
258 | config DEBUG_MSM_UART1 | ||
259 | bool "Kernel low-level debugging messages via MSM UART1" | ||
260 | depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 | ||
261 | help | ||
262 | Say Y here if you want the debug print routines to direct | ||
263 | their output to the first serial port on MSM devices. | ||
264 | |||
265 | config DEBUG_MSM_UART2 | ||
266 | bool "Kernel low-level debugging messages via MSM UART2" | ||
267 | depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 | ||
268 | help | ||
269 | Say Y here if you want the debug print routines to direct | ||
270 | their output to the second serial port on MSM devices. | ||
271 | |||
272 | config DEBUG_MSM_UART3 | ||
273 | bool "Kernel low-level debugging messages via MSM UART3" | ||
274 | depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 | ||
275 | help | ||
276 | Say Y here if you want the debug print routines to direct | ||
277 | their output to the third serial port on MSM devices. | ||
278 | |||
279 | config DEBUG_MSM8660_UART | ||
280 | bool "Kernel low-level debugging messages via MSM 8660 UART" | ||
281 | depends on ARCH_MSM8X60 | ||
282 | select MSM_HAS_DEBUG_UART_HS | ||
283 | help | ||
284 | Say Y here if you want the debug print routines to direct | ||
285 | their output to the serial port on MSM 8660 devices. | ||
286 | |||
287 | config DEBUG_MSM8960_UART | ||
288 | bool "Kernel low-level debugging messages via MSM 8960 UART" | ||
289 | depends on ARCH_MSM8960 | ||
290 | select MSM_HAS_DEBUG_UART_HS | ||
291 | help | ||
292 | Say Y here if you want the debug print routines to direct | ||
293 | their output to the serial port on MSM 8960 devices. | ||
294 | |||
250 | endchoice | 295 | endchoice |
251 | 296 | ||
252 | config EARLY_PRINTK | 297 | config EARLY_PRINTK |
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig index a7e777581378..945a34f2a34d 100644 --- a/arch/arm/configs/omap1_defconfig +++ b/arch/arm/configs/omap1_defconfig | |||
@@ -48,12 +48,7 @@ CONFIG_MACH_SX1=y | |||
48 | CONFIG_MACH_NOKIA770=y | 48 | CONFIG_MACH_NOKIA770=y |
49 | CONFIG_MACH_AMS_DELTA=y | 49 | CONFIG_MACH_AMS_DELTA=y |
50 | CONFIG_MACH_OMAP_GENERIC=y | 50 | CONFIG_MACH_OMAP_GENERIC=y |
51 | CONFIG_OMAP_ARM_216MHZ=y | ||
52 | CONFIG_OMAP_ARM_195MHZ=y | ||
53 | CONFIG_OMAP_ARM_192MHZ=y | ||
54 | CONFIG_OMAP_ARM_182MHZ=y | 51 | CONFIG_OMAP_ARM_182MHZ=y |
55 | CONFIG_OMAP_ARM_168MHZ=y | ||
56 | # CONFIG_OMAP_ARM_60MHZ is not set | ||
57 | # CONFIG_ARM_THUMB is not set | 52 | # CONFIG_ARM_THUMB is not set |
58 | CONFIG_PCCARD=y | 53 | CONFIG_PCCARD=y |
59 | CONFIG_OMAP_CF=y | 54 | CONFIG_OMAP_CF=y |
diff --git a/arch/arm/configs/pcontrol_g20_defconfig b/arch/arm/configs/pcontrol_g20_defconfig deleted file mode 100644 index c75c9fcede58..000000000000 --- a/arch/arm/configs/pcontrol_g20_defconfig +++ /dev/null | |||
@@ -1,175 +0,0 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_CROSS_COMPILE="/opt/arm-2010q1/bin/arm-none-linux-gnueabi-" | ||
3 | # CONFIG_LOCALVERSION_AUTO is not set | ||
4 | # CONFIG_SWAP is not set | ||
5 | CONFIG_SYSVIPC=y | ||
6 | CONFIG_POSIX_MQUEUE=y | ||
7 | CONFIG_TREE_PREEMPT_RCU=y | ||
8 | CONFIG_IKCONFIG=y | ||
9 | CONFIG_IKCONFIG_PROC=y | ||
10 | CONFIG_LOG_BUF_SHIFT=14 | ||
11 | CONFIG_NAMESPACES=y | ||
12 | CONFIG_BLK_DEV_INITRD=y | ||
13 | CONFIG_EXPERT=y | ||
14 | # CONFIG_SYSCTL_SYSCALL is not set | ||
15 | # CONFIG_KALLSYMS is not set | ||
16 | # CONFIG_VM_EVENT_COUNTERS is not set | ||
17 | # CONFIG_COMPAT_BRK is not set | ||
18 | CONFIG_SLAB=y | ||
19 | CONFIG_MODULES=y | ||
20 | CONFIG_MODULE_UNLOAD=y | ||
21 | # CONFIG_LBDAF is not set | ||
22 | # CONFIG_BLK_DEV_BSG is not set | ||
23 | CONFIG_DEFAULT_DEADLINE=y | ||
24 | CONFIG_ARCH_AT91=y | ||
25 | CONFIG_ARCH_AT91SAM9G20=y | ||
26 | CONFIG_MACH_PCONTROL_G20=y | ||
27 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
28 | CONFIG_NO_HZ=y | ||
29 | CONFIG_HIGH_RES_TIMERS=y | ||
30 | CONFIG_PREEMPT=y | ||
31 | CONFIG_AEABI=y | ||
32 | # CONFIG_OABI_COMPAT is not set | ||
33 | CONFIG_ZBOOT_ROM_TEXT=0x0 | ||
34 | CONFIG_ZBOOT_ROM_BSS=0x0 | ||
35 | CONFIG_CMDLINE="console=ttyS0,115200 mem=128M mtdparts=atmel_nand:128k(bootstrap)ro,256k(uboot)ro,128k(env1)ro,128k(env2)ro,2M(linux),-(root) root=/dev/mmcblk0p1 rootwait rw" | ||
36 | CONFIG_VFP=y | ||
37 | CONFIG_BINFMT_MISC=y | ||
38 | CONFIG_NET=y | ||
39 | CONFIG_PACKET=y | ||
40 | CONFIG_UNIX=y | ||
41 | CONFIG_INET=y | ||
42 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | ||
43 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | ||
44 | # CONFIG_INET_XFRM_MODE_BEET is not set | ||
45 | # CONFIG_INET_LRO is not set | ||
46 | # CONFIG_IPV6 is not set | ||
47 | CONFIG_VLAN_8021Q=y | ||
48 | # CONFIG_WIRELESS is not set | ||
49 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
50 | # CONFIG_FW_LOADER is not set | ||
51 | CONFIG_MTD=y | ||
52 | CONFIG_MTD_PARTITIONS=y | ||
53 | CONFIG_MTD_CMDLINE_PARTS=y | ||
54 | CONFIG_MTD_CHAR=y | ||
55 | CONFIG_MTD_BLOCK=y | ||
56 | CONFIG_MTD_COMPLEX_MAPPINGS=y | ||
57 | CONFIG_MTD_PHRAM=m | ||
58 | CONFIG_MTD_NAND=y | ||
59 | CONFIG_MTD_NAND_ATMEL=y | ||
60 | CONFIG_BLK_DEV_LOOP=y | ||
61 | CONFIG_BLK_DEV_RAM=y | ||
62 | CONFIG_BLK_DEV_RAM_SIZE=8192 | ||
63 | CONFIG_ATMEL_TCLIB=y | ||
64 | CONFIG_EEPROM_AT24=m | ||
65 | CONFIG_SCSI=m | ||
66 | # CONFIG_SCSI_PROC_FS is not set | ||
67 | CONFIG_BLK_DEV_SD=m | ||
68 | CONFIG_SCSI_MULTI_LUN=y | ||
69 | # CONFIG_SCSI_LOWLEVEL is not set | ||
70 | CONFIG_NETDEVICES=y | ||
71 | CONFIG_MACVLAN=m | ||
72 | CONFIG_TUN=m | ||
73 | CONFIG_SMSC_PHY=m | ||
74 | CONFIG_BROADCOM_PHY=m | ||
75 | CONFIG_NET_ETHERNET=y | ||
76 | CONFIG_MII=y | ||
77 | CONFIG_MACB=y | ||
78 | CONFIG_SMSC911X=m | ||
79 | # CONFIG_NETDEV_1000 is not set | ||
80 | # CONFIG_NETDEV_10000 is not set | ||
81 | # CONFIG_WLAN is not set | ||
82 | CONFIG_PPP=m | ||
83 | CONFIG_PPP_ASYNC=m | ||
84 | CONFIG_PPP_DEFLATE=m | ||
85 | CONFIG_PPP_MPPE=m | ||
86 | CONFIG_INPUT_POLLDEV=y | ||
87 | CONFIG_INPUT_SPARSEKMAP=y | ||
88 | # CONFIG_INPUT_MOUSEDEV is not set | ||
89 | CONFIG_INPUT_EVDEV=m | ||
90 | CONFIG_INPUT_EVBUG=m | ||
91 | # CONFIG_KEYBOARD_ATKBD is not set | ||
92 | CONFIG_KEYBOARD_GPIO=m | ||
93 | CONFIG_KEYBOARD_MATRIX=m | ||
94 | # CONFIG_INPUT_MOUSE is not set | ||
95 | CONFIG_INPUT_TOUCHSCREEN=y | ||
96 | CONFIG_INPUT_MISC=y | ||
97 | CONFIG_INPUT_UINPUT=m | ||
98 | CONFIG_INPUT_GPIO_ROTARY_ENCODER=m | ||
99 | # CONFIG_SERIO is not set | ||
100 | # CONFIG_DEVKMEM is not set | ||
101 | CONFIG_SERIAL_ATMEL=y | ||
102 | CONFIG_SERIAL_ATMEL_CONSOLE=y | ||
103 | CONFIG_SERIAL_MAX3100=m | ||
104 | # CONFIG_LEGACY_PTYS is not set | ||
105 | # CONFIG_HW_RANDOM is not set | ||
106 | CONFIG_R3964=m | ||
107 | CONFIG_I2C=m | ||
108 | CONFIG_I2C_CHARDEV=m | ||
109 | # CONFIG_I2C_HELPER_AUTO is not set | ||
110 | CONFIG_I2C_GPIO=m | ||
111 | CONFIG_SPI=y | ||
112 | CONFIG_SPI_ATMEL=m | ||
113 | CONFIG_SPI_SPIDEV=m | ||
114 | CONFIG_GPIO_SYSFS=y | ||
115 | CONFIG_W1=m | ||
116 | CONFIG_W1_MASTER_GPIO=m | ||
117 | CONFIG_W1_SLAVE_DS2431=m | ||
118 | # CONFIG_HWMON is not set | ||
119 | CONFIG_WATCHDOG=y | ||
120 | CONFIG_AT91SAM9X_WATCHDOG=y | ||
121 | # CONFIG_MFD_SUPPORT is not set | ||
122 | # CONFIG_HID_SUPPORT is not set | ||
123 | CONFIG_USB=y | ||
124 | # CONFIG_USB_DEVICE_CLASS is not set | ||
125 | CONFIG_USB_OHCI_HCD=y | ||
126 | CONFIG_USB_STORAGE=m | ||
127 | CONFIG_USB_LIBUSUAL=y | ||
128 | CONFIG_USB_SERIAL=m | ||
129 | CONFIG_USB_SERIAL_GENERIC=y | ||
130 | CONFIG_USB_SERIAL_FTDI_SIO=m | ||
131 | CONFIG_USB_SERIAL_PL2303=m | ||
132 | CONFIG_USB_GADGET=y | ||
133 | CONFIG_USB_ZERO=m | ||
134 | CONFIG_USB_ETH=m | ||
135 | CONFIG_USB_FILE_STORAGE=m | ||
136 | CONFIG_USB_G_SERIAL=m | ||
137 | CONFIG_USB_G_HID=m | ||
138 | CONFIG_MMC=y | ||
139 | CONFIG_MMC_UNSAFE_RESUME=y | ||
140 | CONFIG_MMC_ATMELMCI=y | ||
141 | CONFIG_NEW_LEDS=y | ||
142 | CONFIG_LEDS_CLASS=y | ||
143 | CONFIG_LEDS_GPIO=y | ||
144 | CONFIG_LEDS_TRIGGERS=y | ||
145 | CONFIG_LEDS_TRIGGER_TIMER=y | ||
146 | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | ||
147 | CONFIG_LEDS_TRIGGER_DEFAULT_ON=y | ||
148 | CONFIG_RTC_CLASS=y | ||
149 | CONFIG_RTC_DRV_AT91SAM9=y | ||
150 | CONFIG_AUXDISPLAY=y | ||
151 | CONFIG_UIO=y | ||
152 | CONFIG_UIO_PDRV=y | ||
153 | CONFIG_STAGING=y | ||
154 | # CONFIG_STAGING_EXCLUDE_BUILD is not set | ||
155 | CONFIG_IIO=y | ||
156 | CONFIG_EXT2_FS=y | ||
157 | CONFIG_EXT3_FS=y | ||
158 | # CONFIG_EXT3_FS_XATTR is not set | ||
159 | CONFIG_VFAT_FS=y | ||
160 | CONFIG_TMPFS=y | ||
161 | CONFIG_JFFS2_FS=y | ||
162 | CONFIG_NFS_FS=y | ||
163 | CONFIG_NFS_V3=y | ||
164 | CONFIG_NFS_V4=y | ||
165 | CONFIG_PARTITION_ADVANCED=y | ||
166 | CONFIG_NLS_CODEPAGE_437=y | ||
167 | CONFIG_NLS_CODEPAGE_850=y | ||
168 | CONFIG_NLS_ISO8859_1=y | ||
169 | CONFIG_NLS_ISO8859_15=y | ||
170 | CONFIG_NLS_UTF8=y | ||
171 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
172 | CONFIG_CRYPTO=y | ||
173 | CONFIG_CRYPTO_ANSI_CPRNG=y | ||
174 | # CONFIG_CRYPTO_HW is not set | ||
175 | CONFIG_CRC_CCITT=y | ||
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 172101ac97de..a4f192cc51b2 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c | |||
@@ -346,15 +346,15 @@ validate_group(struct perf_event *event) | |||
346 | fake_pmu.used_mask = fake_used_mask; | 346 | fake_pmu.used_mask = fake_used_mask; |
347 | 347 | ||
348 | if (!validate_event(&fake_pmu, leader)) | 348 | if (!validate_event(&fake_pmu, leader)) |
349 | return -ENOSPC; | 349 | return -EINVAL; |
350 | 350 | ||
351 | list_for_each_entry(sibling, &leader->sibling_list, group_entry) { | 351 | list_for_each_entry(sibling, &leader->sibling_list, group_entry) { |
352 | if (!validate_event(&fake_pmu, sibling)) | 352 | if (!validate_event(&fake_pmu, sibling)) |
353 | return -ENOSPC; | 353 | return -EINVAL; |
354 | } | 354 | } |
355 | 355 | ||
356 | if (!validate_event(&fake_pmu, event)) | 356 | if (!validate_event(&fake_pmu, event)) |
357 | return -ENOSPC; | 357 | return -EINVAL; |
358 | 358 | ||
359 | return 0; | 359 | return 0; |
360 | } | 360 | } |
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index d111c3e99249..4f991f295284 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig | |||
@@ -3,6 +3,12 @@ if ARCH_AT91 | |||
3 | config HAVE_AT91_DATAFLASH_CARD | 3 | config HAVE_AT91_DATAFLASH_CARD |
4 | bool | 4 | bool |
5 | 5 | ||
6 | config HAVE_AT91_DBGU0 | ||
7 | bool | ||
8 | |||
9 | config HAVE_AT91_DBGU1 | ||
10 | bool | ||
11 | |||
6 | config HAVE_AT91_USART3 | 12 | config HAVE_AT91_USART3 |
7 | bool | 13 | bool |
8 | 14 | ||
@@ -21,12 +27,14 @@ config ARCH_AT91RM9200 | |||
21 | bool "AT91RM9200" | 27 | bool "AT91RM9200" |
22 | select CPU_ARM920T | 28 | select CPU_ARM920T |
23 | select GENERIC_CLOCKEVENTS | 29 | select GENERIC_CLOCKEVENTS |
30 | select HAVE_AT91_DBGU0 | ||
24 | select HAVE_AT91_USART3 | 31 | select HAVE_AT91_USART3 |
25 | 32 | ||
26 | config ARCH_AT91SAM9260 | 33 | config ARCH_AT91SAM9260 |
27 | bool "AT91SAM9260 or AT91SAM9XE" | 34 | bool "AT91SAM9260 or AT91SAM9XE" |
28 | select CPU_ARM926T | 35 | select CPU_ARM926T |
29 | select GENERIC_CLOCKEVENTS | 36 | select GENERIC_CLOCKEVENTS |
37 | select HAVE_AT91_DBGU0 | ||
30 | select HAVE_AT91_USART3 | 38 | select HAVE_AT91_USART3 |
31 | select HAVE_AT91_USART4 | 39 | select HAVE_AT91_USART4 |
32 | select HAVE_AT91_USART5 | 40 | select HAVE_AT91_USART5 |
@@ -37,11 +45,13 @@ config ARCH_AT91SAM9261 | |||
37 | select CPU_ARM926T | 45 | select CPU_ARM926T |
38 | select GENERIC_CLOCKEVENTS | 46 | select GENERIC_CLOCKEVENTS |
39 | select HAVE_FB_ATMEL | 47 | select HAVE_FB_ATMEL |
48 | select HAVE_AT91_DBGU0 | ||
40 | 49 | ||
41 | config ARCH_AT91SAM9G10 | 50 | config ARCH_AT91SAM9G10 |
42 | bool "AT91SAM9G10" | 51 | bool "AT91SAM9G10" |
43 | select CPU_ARM926T | 52 | select CPU_ARM926T |
44 | select GENERIC_CLOCKEVENTS | 53 | select GENERIC_CLOCKEVENTS |
54 | select HAVE_AT91_DBGU0 | ||
45 | select HAVE_FB_ATMEL | 55 | select HAVE_FB_ATMEL |
46 | 56 | ||
47 | config ARCH_AT91SAM9263 | 57 | config ARCH_AT91SAM9263 |
@@ -50,6 +60,7 @@ config ARCH_AT91SAM9263 | |||
50 | select GENERIC_CLOCKEVENTS | 60 | select GENERIC_CLOCKEVENTS |
51 | select HAVE_FB_ATMEL | 61 | select HAVE_FB_ATMEL |
52 | select HAVE_NET_MACB | 62 | select HAVE_NET_MACB |
63 | select HAVE_AT91_DBGU1 | ||
53 | 64 | ||
54 | config ARCH_AT91SAM9RL | 65 | config ARCH_AT91SAM9RL |
55 | bool "AT91SAM9RL" | 66 | bool "AT91SAM9RL" |
@@ -57,11 +68,13 @@ config ARCH_AT91SAM9RL | |||
57 | select GENERIC_CLOCKEVENTS | 68 | select GENERIC_CLOCKEVENTS |
58 | select HAVE_AT91_USART3 | 69 | select HAVE_AT91_USART3 |
59 | select HAVE_FB_ATMEL | 70 | select HAVE_FB_ATMEL |
71 | select HAVE_AT91_DBGU0 | ||
60 | 72 | ||
61 | config ARCH_AT91SAM9G20 | 73 | config ARCH_AT91SAM9G20 |
62 | bool "AT91SAM9G20" | 74 | bool "AT91SAM9G20" |
63 | select CPU_ARM926T | 75 | select CPU_ARM926T |
64 | select GENERIC_CLOCKEVENTS | 76 | select GENERIC_CLOCKEVENTS |
77 | select HAVE_AT91_DBGU0 | ||
65 | select HAVE_AT91_USART3 | 78 | select HAVE_AT91_USART3 |
66 | select HAVE_AT91_USART4 | 79 | select HAVE_AT91_USART4 |
67 | select HAVE_AT91_USART5 | 80 | select HAVE_AT91_USART5 |
@@ -74,6 +87,7 @@ config ARCH_AT91SAM9G45 | |||
74 | select HAVE_AT91_USART3 | 87 | select HAVE_AT91_USART3 |
75 | select HAVE_FB_ATMEL | 88 | select HAVE_FB_ATMEL |
76 | select HAVE_NET_MACB | 89 | select HAVE_NET_MACB |
90 | select HAVE_AT91_DBGU1 | ||
77 | 91 | ||
78 | config ARCH_AT91CAP9 | 92 | config ARCH_AT91CAP9 |
79 | bool "AT91CAP9" | 93 | bool "AT91CAP9" |
@@ -81,6 +95,7 @@ config ARCH_AT91CAP9 | |||
81 | select GENERIC_CLOCKEVENTS | 95 | select GENERIC_CLOCKEVENTS |
82 | select HAVE_FB_ATMEL | 96 | select HAVE_FB_ATMEL |
83 | select HAVE_NET_MACB | 97 | select HAVE_NET_MACB |
98 | select HAVE_AT91_DBGU1 | ||
84 | 99 | ||
85 | config ARCH_AT91X40 | 100 | config ARCH_AT91X40 |
86 | bool "AT91x40" | 101 | bool "AT91x40" |
@@ -510,8 +525,13 @@ config AT91_TIMER_HZ | |||
510 | choice | 525 | choice |
511 | prompt "Select a UART for early kernel messages" | 526 | prompt "Select a UART for early kernel messages" |
512 | 527 | ||
513 | config AT91_EARLY_DBGU | 528 | config AT91_EARLY_DBGU0 |
514 | bool "DBGU" | 529 | bool "DBGU on rm9200, 9260/9g20, 9261/9g10 and 9rl" |
530 | depends on HAVE_AT91_DBGU0 | ||
531 | |||
532 | config AT91_EARLY_DBGU1 | ||
533 | bool "DBGU on 9263, 9g45 and cap9" | ||
534 | depends on HAVE_AT91_DBGU1 | ||
515 | 535 | ||
516 | config AT91_EARLY_USART0 | 536 | config AT91_EARLY_USART0 |
517 | bool "USART0" | 537 | bool "USART0" |
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c index ecdd54dd68c6..506a26c3fff6 100644 --- a/arch/arm/mach-at91/at91cap9.c +++ b/arch/arm/mach-at91/at91cap9.c | |||
@@ -13,7 +13,6 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/pm.h> | ||
17 | 16 | ||
18 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
19 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
@@ -23,11 +22,11 @@ | |||
23 | #include <mach/at91cap9.h> | 22 | #include <mach/at91cap9.h> |
24 | #include <mach/at91_pmc.h> | 23 | #include <mach/at91_pmc.h> |
25 | #include <mach/at91_rstc.h> | 24 | #include <mach/at91_rstc.h> |
26 | #include <mach/at91_shdwc.h> | ||
27 | 25 | ||
28 | #include "soc.h" | 26 | #include "soc.h" |
29 | #include "generic.h" | 27 | #include "generic.h" |
30 | #include "clock.h" | 28 | #include "clock.h" |
29 | #include "sam9_smc.h" | ||
31 | 30 | ||
32 | /* -------------------------------------------------------------------- | 31 | /* -------------------------------------------------------------------- |
33 | * Clocks | 32 | * Clocks |
@@ -137,7 +136,7 @@ static struct clk pwm_clk = { | |||
137 | .type = CLK_TYPE_PERIPHERAL, | 136 | .type = CLK_TYPE_PERIPHERAL, |
138 | }; | 137 | }; |
139 | static struct clk macb_clk = { | 138 | static struct clk macb_clk = { |
140 | .name = "macb_clk", | 139 | .name = "pclk", |
141 | .pmc_mask = 1 << AT91CAP9_ID_EMAC, | 140 | .pmc_mask = 1 << AT91CAP9_ID_EMAC, |
142 | .type = CLK_TYPE_PERIPHERAL, | 141 | .type = CLK_TYPE_PERIPHERAL, |
143 | }; | 142 | }; |
@@ -210,6 +209,8 @@ static struct clk *periph_clocks[] __initdata = { | |||
210 | }; | 209 | }; |
211 | 210 | ||
212 | static struct clk_lookup periph_clocks_lookups[] = { | 211 | static struct clk_lookup periph_clocks_lookups[] = { |
212 | /* One additional fake clock for macb_hclk */ | ||
213 | CLKDEV_CON_ID("hclk", &macb_clk), | ||
213 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), | 214 | CLKDEV_CON_DEV_ID("hclk", "atmel_usba_udc", &utmi_clk), |
214 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), | 215 | CLKDEV_CON_DEV_ID("pclk", "atmel_usba_udc", &udphs_clk), |
215 | CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk), | 216 | CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk), |
@@ -221,6 +222,10 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
221 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), | 222 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), |
222 | /* fake hclk clock */ | 223 | /* fake hclk clock */ |
223 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), | 224 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), |
225 | CLKDEV_CON_ID("pioA", &pioABCD_clk), | ||
226 | CLKDEV_CON_ID("pioB", &pioABCD_clk), | ||
227 | CLKDEV_CON_ID("pioC", &pioABCD_clk), | ||
228 | CLKDEV_CON_ID("pioD", &pioABCD_clk), | ||
224 | }; | 229 | }; |
225 | 230 | ||
226 | static struct clk_lookup usart_clocks_lookups[] = { | 231 | static struct clk_lookup usart_clocks_lookups[] = { |
@@ -293,23 +298,19 @@ void __init at91cap9_set_console_clock(int id) | |||
293 | * GPIO | 298 | * GPIO |
294 | * -------------------------------------------------------------------- */ | 299 | * -------------------------------------------------------------------- */ |
295 | 300 | ||
296 | static struct at91_gpio_bank at91cap9_gpio[] = { | 301 | static struct at91_gpio_bank at91cap9_gpio[] __initdata = { |
297 | { | 302 | { |
298 | .id = AT91CAP9_ID_PIOABCD, | 303 | .id = AT91CAP9_ID_PIOABCD, |
299 | .offset = AT91_PIOA, | 304 | .regbase = AT91CAP9_BASE_PIOA, |
300 | .clock = &pioABCD_clk, | ||
301 | }, { | 305 | }, { |
302 | .id = AT91CAP9_ID_PIOABCD, | 306 | .id = AT91CAP9_ID_PIOABCD, |
303 | .offset = AT91_PIOB, | 307 | .regbase = AT91CAP9_BASE_PIOB, |
304 | .clock = &pioABCD_clk, | ||
305 | }, { | 308 | }, { |
306 | .id = AT91CAP9_ID_PIOABCD, | 309 | .id = AT91CAP9_ID_PIOABCD, |
307 | .offset = AT91_PIOC, | 310 | .regbase = AT91CAP9_BASE_PIOC, |
308 | .clock = &pioABCD_clk, | ||
309 | }, { | 311 | }, { |
310 | .id = AT91CAP9_ID_PIOABCD, | 312 | .id = AT91CAP9_ID_PIOABCD, |
311 | .offset = AT91_PIOD, | 313 | .regbase = AT91CAP9_BASE_PIOD, |
312 | .clock = &pioABCD_clk, | ||
313 | } | 314 | } |
314 | }; | 315 | }; |
315 | 316 | ||
@@ -318,12 +319,6 @@ static void at91cap9_reset(void) | |||
318 | at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST); | 319 | at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST); |
319 | } | 320 | } |
320 | 321 | ||
321 | static void at91cap9_poweroff(void) | ||
322 | { | ||
323 | at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); | ||
324 | } | ||
325 | |||
326 | |||
327 | /* -------------------------------------------------------------------- | 322 | /* -------------------------------------------------------------------- |
328 | * AT91CAP9 processor initialization | 323 | * AT91CAP9 processor initialization |
329 | * -------------------------------------------------------------------- */ | 324 | * -------------------------------------------------------------------- */ |
@@ -333,10 +328,16 @@ static void __init at91cap9_map_io(void) | |||
333 | at91_init_sram(0, AT91CAP9_SRAM_BASE, AT91CAP9_SRAM_SIZE); | 328 | at91_init_sram(0, AT91CAP9_SRAM_BASE, AT91CAP9_SRAM_SIZE); |
334 | } | 329 | } |
335 | 330 | ||
331 | static void __init at91cap9_ioremap_registers(void) | ||
332 | { | ||
333 | at91_ioremap_shdwc(AT91CAP9_BASE_SHDWC); | ||
334 | at91sam926x_ioremap_pit(AT91CAP9_BASE_PIT); | ||
335 | at91sam9_ioremap_smc(0, AT91CAP9_BASE_SMC); | ||
336 | } | ||
337 | |||
336 | static void __init at91cap9_initialize(void) | 338 | static void __init at91cap9_initialize(void) |
337 | { | 339 | { |
338 | at91_arch_reset = at91cap9_reset; | 340 | at91_arch_reset = at91cap9_reset; |
339 | pm_power_off = at91cap9_poweroff; | ||
340 | at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1); | 341 | at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1); |
341 | 342 | ||
342 | /* Register GPIO subsystem */ | 343 | /* Register GPIO subsystem */ |
@@ -394,6 +395,7 @@ static unsigned int at91cap9_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
394 | struct at91_init_soc __initdata at91cap9_soc = { | 395 | struct at91_init_soc __initdata at91cap9_soc = { |
395 | .map_io = at91cap9_map_io, | 396 | .map_io = at91cap9_map_io, |
396 | .default_irq_priority = at91cap9_default_irq_priority, | 397 | .default_irq_priority = at91cap9_default_irq_priority, |
398 | .ioremap_registers = at91cap9_ioremap_registers, | ||
397 | .register_clocks = at91cap9_register_clocks, | 399 | .register_clocks = at91cap9_register_clocks, |
398 | .init = at91cap9_initialize, | 400 | .init = at91cap9_initialize, |
399 | }; | 401 | }; |
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c index adad70db70eb..d298fb7cb210 100644 --- a/arch/arm/mach-at91/at91cap9_devices.c +++ b/arch/arm/mach-at91/at91cap9_devices.c | |||
@@ -76,7 +76,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) | |||
76 | 76 | ||
77 | /* Enable VBus control for UHP ports */ | 77 | /* Enable VBus control for UHP ports */ |
78 | for (i = 0; i < data->ports; i++) { | 78 | for (i = 0; i < data->ports; i++) { |
79 | if (data->vbus_pin[i]) | 79 | if (gpio_is_valid(data->vbus_pin[i])) |
80 | at91_set_gpio_output(data->vbus_pin[i], 0); | 80 | at91_set_gpio_output(data->vbus_pin[i], 0); |
81 | } | 81 | } |
82 | 82 | ||
@@ -179,7 +179,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) | |||
179 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); | 179 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); |
180 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); | 180 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); |
181 | 181 | ||
182 | if (data && data->vbus_pin > 0) { | 182 | if (data && gpio_is_valid(data->vbus_pin)) { |
183 | at91_set_gpio_input(data->vbus_pin, 0); | 183 | at91_set_gpio_input(data->vbus_pin, 0); |
184 | at91_set_deglitch(data->vbus_pin, 1); | 184 | at91_set_deglitch(data->vbus_pin, 1); |
185 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; | 185 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; |
@@ -200,7 +200,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {} | |||
200 | 200 | ||
201 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) | 201 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) |
202 | static u64 eth_dmamask = DMA_BIT_MASK(32); | 202 | static u64 eth_dmamask = DMA_BIT_MASK(32); |
203 | static struct at91_eth_data eth_data; | 203 | static struct macb_platform_data eth_data; |
204 | 204 | ||
205 | static struct resource eth_resources[] = { | 205 | static struct resource eth_resources[] = { |
206 | [0] = { | 206 | [0] = { |
@@ -227,12 +227,12 @@ static struct platform_device at91cap9_eth_device = { | |||
227 | .num_resources = ARRAY_SIZE(eth_resources), | 227 | .num_resources = ARRAY_SIZE(eth_resources), |
228 | }; | 228 | }; |
229 | 229 | ||
230 | void __init at91_add_device_eth(struct at91_eth_data *data) | 230 | void __init at91_add_device_eth(struct macb_platform_data *data) |
231 | { | 231 | { |
232 | if (!data) | 232 | if (!data) |
233 | return; | 233 | return; |
234 | 234 | ||
235 | if (data->phy_irq_pin) { | 235 | if (gpio_is_valid(data->phy_irq_pin)) { |
236 | at91_set_gpio_input(data->phy_irq_pin, 0); | 236 | at91_set_gpio_input(data->phy_irq_pin, 0); |
237 | at91_set_deglitch(data->phy_irq_pin, 1); | 237 | at91_set_deglitch(data->phy_irq_pin, 1); |
238 | } | 238 | } |
@@ -264,7 +264,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data) | |||
264 | platform_device_register(&at91cap9_eth_device); | 264 | platform_device_register(&at91cap9_eth_device); |
265 | } | 265 | } |
266 | #else | 266 | #else |
267 | void __init at91_add_device_eth(struct at91_eth_data *data) {} | 267 | void __init at91_add_device_eth(struct macb_platform_data *data) {} |
268 | #endif | 268 | #endif |
269 | 269 | ||
270 | 270 | ||
@@ -332,13 +332,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
332 | return; | 332 | return; |
333 | 333 | ||
334 | /* input/irq */ | 334 | /* input/irq */ |
335 | if (data->det_pin) { | 335 | if (gpio_is_valid(data->det_pin)) { |
336 | at91_set_gpio_input(data->det_pin, 1); | 336 | at91_set_gpio_input(data->det_pin, 1); |
337 | at91_set_deglitch(data->det_pin, 1); | 337 | at91_set_deglitch(data->det_pin, 1); |
338 | } | 338 | } |
339 | if (data->wp_pin) | 339 | if (gpio_is_valid(data->wp_pin)) |
340 | at91_set_gpio_input(data->wp_pin, 1); | 340 | at91_set_gpio_input(data->wp_pin, 1); |
341 | if (data->vcc_pin) | 341 | if (gpio_is_valid(data->vcc_pin)) |
342 | at91_set_gpio_output(data->vcc_pin, 0); | 342 | at91_set_gpio_output(data->vcc_pin, 0); |
343 | 343 | ||
344 | if (mmc_id == 0) { /* MCI0 */ | 344 | if (mmc_id == 0) { /* MCI0 */ |
@@ -398,8 +398,8 @@ static struct resource nand_resources[] = { | |||
398 | .flags = IORESOURCE_MEM, | 398 | .flags = IORESOURCE_MEM, |
399 | }, | 399 | }, |
400 | [1] = { | 400 | [1] = { |
401 | .start = AT91_BASE_SYS + AT91_ECC, | 401 | .start = AT91CAP9_BASE_ECC, |
402 | .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1, | 402 | .end = AT91CAP9_BASE_ECC + SZ_512 - 1, |
403 | .flags = IORESOURCE_MEM, | 403 | .flags = IORESOURCE_MEM, |
404 | } | 404 | } |
405 | }; | 405 | }; |
@@ -425,15 +425,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
425 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); | 425 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); |
426 | 426 | ||
427 | /* enable pin */ | 427 | /* enable pin */ |
428 | if (data->enable_pin) | 428 | if (gpio_is_valid(data->enable_pin)) |
429 | at91_set_gpio_output(data->enable_pin, 1); | 429 | at91_set_gpio_output(data->enable_pin, 1); |
430 | 430 | ||
431 | /* ready/busy pin */ | 431 | /* ready/busy pin */ |
432 | if (data->rdy_pin) | 432 | if (gpio_is_valid(data->rdy_pin)) |
433 | at91_set_gpio_input(data->rdy_pin, 1); | 433 | at91_set_gpio_input(data->rdy_pin, 1); |
434 | 434 | ||
435 | /* card detect pin */ | 435 | /* card detect pin */ |
436 | if (data->det_pin) | 436 | if (gpio_is_valid(data->det_pin)) |
437 | at91_set_gpio_input(data->det_pin, 1); | 437 | at91_set_gpio_input(data->det_pin, 1); |
438 | 438 | ||
439 | nand_data = *data; | 439 | nand_data = *data; |
@@ -670,8 +670,8 @@ static void __init at91_add_device_tc(void) { } | |||
670 | 670 | ||
671 | static struct resource rtt_resources[] = { | 671 | static struct resource rtt_resources[] = { |
672 | { | 672 | { |
673 | .start = AT91_BASE_SYS + AT91_RTT, | 673 | .start = AT91CAP9_BASE_RTT, |
674 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | 674 | .end = AT91CAP9_BASE_RTT + SZ_16 - 1, |
675 | .flags = IORESOURCE_MEM, | 675 | .flags = IORESOURCE_MEM, |
676 | } | 676 | } |
677 | }; | 677 | }; |
@@ -694,10 +694,19 @@ static void __init at91_add_device_rtt(void) | |||
694 | * -------------------------------------------------------------------- */ | 694 | * -------------------------------------------------------------------- */ |
695 | 695 | ||
696 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 696 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
697 | static struct resource wdt_resources[] = { | ||
698 | { | ||
699 | .start = AT91CAP9_BASE_WDT, | ||
700 | .end = AT91CAP9_BASE_WDT + SZ_16 - 1, | ||
701 | .flags = IORESOURCE_MEM, | ||
702 | } | ||
703 | }; | ||
704 | |||
697 | static struct platform_device at91cap9_wdt_device = { | 705 | static struct platform_device at91cap9_wdt_device = { |
698 | .name = "at91_wdt", | 706 | .name = "at91_wdt", |
699 | .id = -1, | 707 | .id = -1, |
700 | .num_resources = 0, | 708 | .resource = wdt_resources, |
709 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
701 | }; | 710 | }; |
702 | 711 | ||
703 | static void __init at91_add_device_watchdog(void) | 712 | static void __init at91_add_device_watchdog(void) |
@@ -807,7 +816,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
807 | at91_set_A_periph(AT91_PIN_PA9, 0); /* AC97RX */ | 816 | at91_set_A_periph(AT91_PIN_PA9, 0); /* AC97RX */ |
808 | 817 | ||
809 | /* reset */ | 818 | /* reset */ |
810 | if (data->reset_pin) | 819 | if (gpio_is_valid(data->reset_pin)) |
811 | at91_set_gpio_output(data->reset_pin, 0); | 820 | at91_set_gpio_output(data->reset_pin, 0); |
812 | 821 | ||
813 | ac97_data = *data; | 822 | ac97_data = *data; |
@@ -1021,8 +1030,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | |||
1021 | #if defined(CONFIG_SERIAL_ATMEL) | 1030 | #if defined(CONFIG_SERIAL_ATMEL) |
1022 | static struct resource dbgu_resources[] = { | 1031 | static struct resource dbgu_resources[] = { |
1023 | [0] = { | 1032 | [0] = { |
1024 | .start = AT91_BASE_SYS + AT91_DBGU, | 1033 | .start = AT91CAP9_BASE_DBGU, |
1025 | .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, | 1034 | .end = AT91CAP9_BASE_DBGU + SZ_512 - 1, |
1026 | .flags = IORESOURCE_MEM, | 1035 | .flags = IORESOURCE_MEM, |
1027 | }, | 1036 | }, |
1028 | [1] = { | 1037 | [1] = { |
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c index 713d3bdbd284..9163d7d5f76e 100644 --- a/arch/arm/mach-at91/at91rm9200.c +++ b/arch/arm/mach-at91/at91rm9200.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "soc.h" | 23 | #include "soc.h" |
24 | #include "generic.h" | 24 | #include "generic.h" |
25 | #include "clock.h" | 25 | #include "clock.h" |
26 | #include "sam9_smc.h" | ||
26 | 27 | ||
27 | static struct map_desc at91rm9200_io_desc[] __initdata = { | 28 | static struct map_desc at91rm9200_io_desc[] __initdata = { |
28 | { | 29 | { |
@@ -195,6 +196,10 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
195 | CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk), | 196 | CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk), |
196 | /* fake hclk clock */ | 197 | /* fake hclk clock */ |
197 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), | 198 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), |
199 | CLKDEV_CON_ID("pioA", &pioA_clk), | ||
200 | CLKDEV_CON_ID("pioB", &pioB_clk), | ||
201 | CLKDEV_CON_ID("pioC", &pioC_clk), | ||
202 | CLKDEV_CON_ID("pioD", &pioD_clk), | ||
198 | }; | 203 | }; |
199 | 204 | ||
200 | static struct clk_lookup usart_clocks_lookups[] = { | 205 | static struct clk_lookup usart_clocks_lookups[] = { |
@@ -268,23 +273,19 @@ void __init at91rm9200_set_console_clock(int id) | |||
268 | * GPIO | 273 | * GPIO |
269 | * -------------------------------------------------------------------- */ | 274 | * -------------------------------------------------------------------- */ |
270 | 275 | ||
271 | static struct at91_gpio_bank at91rm9200_gpio[] = { | 276 | static struct at91_gpio_bank at91rm9200_gpio[] __initdata = { |
272 | { | 277 | { |
273 | .id = AT91RM9200_ID_PIOA, | 278 | .id = AT91RM9200_ID_PIOA, |
274 | .offset = AT91_PIOA, | 279 | .regbase = AT91RM9200_BASE_PIOA, |
275 | .clock = &pioA_clk, | ||
276 | }, { | 280 | }, { |
277 | .id = AT91RM9200_ID_PIOB, | 281 | .id = AT91RM9200_ID_PIOB, |
278 | .offset = AT91_PIOB, | 282 | .regbase = AT91RM9200_BASE_PIOB, |
279 | .clock = &pioB_clk, | ||
280 | }, { | 283 | }, { |
281 | .id = AT91RM9200_ID_PIOC, | 284 | .id = AT91RM9200_ID_PIOC, |
282 | .offset = AT91_PIOC, | 285 | .regbase = AT91RM9200_BASE_PIOC, |
283 | .clock = &pioC_clk, | ||
284 | }, { | 286 | }, { |
285 | .id = AT91RM9200_ID_PIOD, | 287 | .id = AT91RM9200_ID_PIOD, |
286 | .offset = AT91_PIOD, | 288 | .regbase = AT91RM9200_BASE_PIOD, |
287 | .clock = &pioD_clk, | ||
288 | } | 289 | } |
289 | }; | 290 | }; |
290 | 291 | ||
@@ -307,6 +308,10 @@ static void __init at91rm9200_map_io(void) | |||
307 | iotable_init(at91rm9200_io_desc, ARRAY_SIZE(at91rm9200_io_desc)); | 308 | iotable_init(at91rm9200_io_desc, ARRAY_SIZE(at91rm9200_io_desc)); |
308 | } | 309 | } |
309 | 310 | ||
311 | static void __init at91rm9200_ioremap_registers(void) | ||
312 | { | ||
313 | } | ||
314 | |||
310 | static void __init at91rm9200_initialize(void) | 315 | static void __init at91rm9200_initialize(void) |
311 | { | 316 | { |
312 | at91_arch_reset = at91rm9200_reset; | 317 | at91_arch_reset = at91rm9200_reset; |
@@ -366,6 +371,7 @@ static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
366 | struct at91_init_soc __initdata at91rm9200_soc = { | 371 | struct at91_init_soc __initdata at91rm9200_soc = { |
367 | .map_io = at91rm9200_map_io, | 372 | .map_io = at91rm9200_map_io, |
368 | .default_irq_priority = at91rm9200_default_irq_priority, | 373 | .default_irq_priority = at91rm9200_default_irq_priority, |
374 | .ioremap_registers = at91rm9200_ioremap_registers, | ||
369 | .register_clocks = at91rm9200_register_clocks, | 375 | .register_clocks = at91rm9200_register_clocks, |
370 | .init = at91rm9200_initialize, | 376 | .init = at91rm9200_initialize, |
371 | }; | 377 | }; |
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c index 66591fa53e05..18bacec2b094 100644 --- a/arch/arm/mach-at91/at91rm9200_devices.c +++ b/arch/arm/mach-at91/at91rm9200_devices.c | |||
@@ -83,7 +83,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
83 | * USB Device (Gadget) | 83 | * USB Device (Gadget) |
84 | * -------------------------------------------------------------------- */ | 84 | * -------------------------------------------------------------------- */ |
85 | 85 | ||
86 | #ifdef CONFIG_USB_GADGET_AT91 | 86 | #ifdef CONFIG_USB_AT91 |
87 | static struct at91_udc_data udc_data; | 87 | static struct at91_udc_data udc_data; |
88 | 88 | ||
89 | static struct resource udc_resources[] = { | 89 | static struct resource udc_resources[] = { |
@@ -114,11 +114,11 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
114 | if (!data) | 114 | if (!data) |
115 | return; | 115 | return; |
116 | 116 | ||
117 | if (data->vbus_pin) { | 117 | if (gpio_is_valid(data->vbus_pin)) { |
118 | at91_set_gpio_input(data->vbus_pin, 0); | 118 | at91_set_gpio_input(data->vbus_pin, 0); |
119 | at91_set_deglitch(data->vbus_pin, 1); | 119 | at91_set_deglitch(data->vbus_pin, 1); |
120 | } | 120 | } |
121 | if (data->pullup_pin) | 121 | if (gpio_is_valid(data->pullup_pin)) |
122 | at91_set_gpio_output(data->pullup_pin, 0); | 122 | at91_set_gpio_output(data->pullup_pin, 0); |
123 | 123 | ||
124 | udc_data = *data; | 124 | udc_data = *data; |
@@ -135,7 +135,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {} | |||
135 | 135 | ||
136 | #if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE) | 136 | #if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE) |
137 | static u64 eth_dmamask = DMA_BIT_MASK(32); | 137 | static u64 eth_dmamask = DMA_BIT_MASK(32); |
138 | static struct at91_eth_data eth_data; | 138 | static struct macb_platform_data eth_data; |
139 | 139 | ||
140 | static struct resource eth_resources[] = { | 140 | static struct resource eth_resources[] = { |
141 | [0] = { | 141 | [0] = { |
@@ -162,12 +162,12 @@ static struct platform_device at91rm9200_eth_device = { | |||
162 | .num_resources = ARRAY_SIZE(eth_resources), | 162 | .num_resources = ARRAY_SIZE(eth_resources), |
163 | }; | 163 | }; |
164 | 164 | ||
165 | void __init at91_add_device_eth(struct at91_eth_data *data) | 165 | void __init at91_add_device_eth(struct macb_platform_data *data) |
166 | { | 166 | { |
167 | if (!data) | 167 | if (!data) |
168 | return; | 168 | return; |
169 | 169 | ||
170 | if (data->phy_irq_pin) { | 170 | if (gpio_is_valid(data->phy_irq_pin)) { |
171 | at91_set_gpio_input(data->phy_irq_pin, 0); | 171 | at91_set_gpio_input(data->phy_irq_pin, 0); |
172 | at91_set_deglitch(data->phy_irq_pin, 1); | 172 | at91_set_deglitch(data->phy_irq_pin, 1); |
173 | } | 173 | } |
@@ -199,7 +199,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data) | |||
199 | platform_device_register(&at91rm9200_eth_device); | 199 | platform_device_register(&at91rm9200_eth_device); |
200 | } | 200 | } |
201 | #else | 201 | #else |
202 | void __init at91_add_device_eth(struct at91_eth_data *data) {} | 202 | void __init at91_add_device_eth(struct macb_platform_data *data) {} |
203 | #endif | 203 | #endif |
204 | 204 | ||
205 | 205 | ||
@@ -260,7 +260,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
260 | ); | 260 | ); |
261 | 261 | ||
262 | /* input/irq */ | 262 | /* input/irq */ |
263 | if (data->irq_pin) { | 263 | if (gpio_is_valid(data->irq_pin)) { |
264 | at91_set_gpio_input(data->irq_pin, 1); | 264 | at91_set_gpio_input(data->irq_pin, 1); |
265 | at91_set_deglitch(data->irq_pin, 1); | 265 | at91_set_deglitch(data->irq_pin, 1); |
266 | } | 266 | } |
@@ -268,7 +268,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
268 | at91_set_deglitch(data->det_pin, 1); | 268 | at91_set_deglitch(data->det_pin, 1); |
269 | 269 | ||
270 | /* outputs, initially off */ | 270 | /* outputs, initially off */ |
271 | if (data->vcc_pin) | 271 | if (gpio_is_valid(data->vcc_pin)) |
272 | at91_set_gpio_output(data->vcc_pin, 0); | 272 | at91_set_gpio_output(data->vcc_pin, 0); |
273 | at91_set_gpio_output(data->rst_pin, 0); | 273 | at91_set_gpio_output(data->rst_pin, 0); |
274 | 274 | ||
@@ -328,13 +328,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
328 | return; | 328 | return; |
329 | 329 | ||
330 | /* input/irq */ | 330 | /* input/irq */ |
331 | if (data->det_pin) { | 331 | if (gpio_is_valid(data->det_pin)) { |
332 | at91_set_gpio_input(data->det_pin, 1); | 332 | at91_set_gpio_input(data->det_pin, 1); |
333 | at91_set_deglitch(data->det_pin, 1); | 333 | at91_set_deglitch(data->det_pin, 1); |
334 | } | 334 | } |
335 | if (data->wp_pin) | 335 | if (gpio_is_valid(data->wp_pin)) |
336 | at91_set_gpio_input(data->wp_pin, 1); | 336 | at91_set_gpio_input(data->wp_pin, 1); |
337 | if (data->vcc_pin) | 337 | if (gpio_is_valid(data->vcc_pin)) |
338 | at91_set_gpio_output(data->vcc_pin, 0); | 338 | at91_set_gpio_output(data->vcc_pin, 0); |
339 | 339 | ||
340 | /* CLK */ | 340 | /* CLK */ |
@@ -419,15 +419,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
419 | ); | 419 | ); |
420 | 420 | ||
421 | /* enable pin */ | 421 | /* enable pin */ |
422 | if (data->enable_pin) | 422 | if (gpio_is_valid(data->enable_pin)) |
423 | at91_set_gpio_output(data->enable_pin, 1); | 423 | at91_set_gpio_output(data->enable_pin, 1); |
424 | 424 | ||
425 | /* ready/busy pin */ | 425 | /* ready/busy pin */ |
426 | if (data->rdy_pin) | 426 | if (gpio_is_valid(data->rdy_pin)) |
427 | at91_set_gpio_input(data->rdy_pin, 1); | 427 | at91_set_gpio_input(data->rdy_pin, 1); |
428 | 428 | ||
429 | /* card detect pin */ | 429 | /* card detect pin */ |
430 | if (data->det_pin) | 430 | if (gpio_is_valid(data->det_pin)) |
431 | at91_set_gpio_input(data->det_pin, 1); | 431 | at91_set_gpio_input(data->det_pin, 1); |
432 | 432 | ||
433 | at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */ | 433 | at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */ |
@@ -665,10 +665,24 @@ static void __init at91_add_device_tc(void) { } | |||
665 | * -------------------------------------------------------------------- */ | 665 | * -------------------------------------------------------------------- */ |
666 | 666 | ||
667 | #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE) | 667 | #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE) |
668 | static struct resource rtc_resources[] = { | ||
669 | [0] = { | ||
670 | .start = AT91RM9200_BASE_RTC, | ||
671 | .end = AT91RM9200_BASE_RTC + SZ_256 - 1, | ||
672 | .flags = IORESOURCE_MEM, | ||
673 | }, | ||
674 | [1] = { | ||
675 | .start = AT91_ID_SYS, | ||
676 | .end = AT91_ID_SYS, | ||
677 | .flags = IORESOURCE_IRQ, | ||
678 | }, | ||
679 | }; | ||
680 | |||
668 | static struct platform_device at91rm9200_rtc_device = { | 681 | static struct platform_device at91rm9200_rtc_device = { |
669 | .name = "at91_rtc", | 682 | .name = "at91_rtc", |
670 | .id = -1, | 683 | .id = -1, |
671 | .num_resources = 0, | 684 | .resource = rtc_resources, |
685 | .num_resources = ARRAY_SIZE(rtc_resources), | ||
672 | }; | 686 | }; |
673 | 687 | ||
674 | static void __init at91_add_device_rtc(void) | 688 | static void __init at91_add_device_rtc(void) |
@@ -877,8 +891,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | |||
877 | #if defined(CONFIG_SERIAL_ATMEL) | 891 | #if defined(CONFIG_SERIAL_ATMEL) |
878 | static struct resource dbgu_resources[] = { | 892 | static struct resource dbgu_resources[] = { |
879 | [0] = { | 893 | [0] = { |
880 | .start = AT91_BASE_SYS + AT91_DBGU, | 894 | .start = AT91RM9200_BASE_DBGU, |
881 | .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, | 895 | .end = AT91RM9200_BASE_DBGU + SZ_512 - 1, |
882 | .flags = IORESOURCE_MEM, | 896 | .flags = IORESOURCE_MEM, |
883 | }, | 897 | }, |
884 | [1] = { | 898 | [1] = { |
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index 1dd69c85dfec..a028cdf8f974 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c | |||
@@ -32,6 +32,8 @@ static unsigned long last_crtr; | |||
32 | static u32 irqmask; | 32 | static u32 irqmask; |
33 | static struct clock_event_device clkevt; | 33 | static struct clock_event_device clkevt; |
34 | 34 | ||
35 | #define RM9200_TIMER_LATCH ((AT91_SLOW_CLOCK + HZ/2) / HZ) | ||
36 | |||
35 | /* | 37 | /* |
36 | * The ST_CRTR is updated asynchronously to the master clock ... but | 38 | * The ST_CRTR is updated asynchronously to the master clock ... but |
37 | * the updates as seen by the CPU don't seem to be strictly monotonic. | 39 | * the updates as seen by the CPU don't seem to be strictly monotonic. |
@@ -74,8 +76,8 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id) | |||
74 | if (sr & AT91_ST_PITS) { | 76 | if (sr & AT91_ST_PITS) { |
75 | u32 crtr = read_CRTR(); | 77 | u32 crtr = read_CRTR(); |
76 | 78 | ||
77 | while (((crtr - last_crtr) & AT91_ST_CRTV) >= LATCH) { | 79 | while (((crtr - last_crtr) & AT91_ST_CRTV) >= RM9200_TIMER_LATCH) { |
78 | last_crtr += LATCH; | 80 | last_crtr += RM9200_TIMER_LATCH; |
79 | clkevt.event_handler(&clkevt); | 81 | clkevt.event_handler(&clkevt); |
80 | } | 82 | } |
81 | return IRQ_HANDLED; | 83 | return IRQ_HANDLED; |
@@ -116,7 +118,7 @@ clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev) | |||
116 | case CLOCK_EVT_MODE_PERIODIC: | 118 | case CLOCK_EVT_MODE_PERIODIC: |
117 | /* PIT for periodic irqs; fixed rate of 1/HZ */ | 119 | /* PIT for periodic irqs; fixed rate of 1/HZ */ |
118 | irqmask = AT91_ST_PITS; | 120 | irqmask = AT91_ST_PITS; |
119 | at91_sys_write(AT91_ST_PIMR, LATCH); | 121 | at91_sys_write(AT91_ST_PIMR, RM9200_TIMER_LATCH); |
120 | break; | 122 | break; |
121 | case CLOCK_EVT_MODE_ONESHOT: | 123 | case CLOCK_EVT_MODE_ONESHOT: |
122 | /* ALM for oneshot irqs, set by next_event() | 124 | /* ALM for oneshot irqs, set by next_event() |
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c index b84a9f642f59..3a960d2740b6 100644 --- a/arch/arm/mach-at91/at91sam9260.c +++ b/arch/arm/mach-at91/at91sam9260.c | |||
@@ -11,7 +11,6 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/pm.h> | ||
15 | 14 | ||
16 | #include <asm/irq.h> | 15 | #include <asm/irq.h> |
17 | #include <asm/mach/arch.h> | 16 | #include <asm/mach/arch.h> |
@@ -21,11 +20,11 @@ | |||
21 | #include <mach/at91sam9260.h> | 20 | #include <mach/at91sam9260.h> |
22 | #include <mach/at91_pmc.h> | 21 | #include <mach/at91_pmc.h> |
23 | #include <mach/at91_rstc.h> | 22 | #include <mach/at91_rstc.h> |
24 | #include <mach/at91_shdwc.h> | ||
25 | 23 | ||
26 | #include "soc.h" | 24 | #include "soc.h" |
27 | #include "generic.h" | 25 | #include "generic.h" |
28 | #include "clock.h" | 26 | #include "clock.h" |
27 | #include "sam9_smc.h" | ||
29 | 28 | ||
30 | /* -------------------------------------------------------------------- | 29 | /* -------------------------------------------------------------------- |
31 | * Clocks | 30 | * Clocks |
@@ -120,7 +119,7 @@ static struct clk ohci_clk = { | |||
120 | .type = CLK_TYPE_PERIPHERAL, | 119 | .type = CLK_TYPE_PERIPHERAL, |
121 | }; | 120 | }; |
122 | static struct clk macb_clk = { | 121 | static struct clk macb_clk = { |
123 | .name = "macb_clk", | 122 | .name = "pclk", |
124 | .pmc_mask = 1 << AT91SAM9260_ID_EMAC, | 123 | .pmc_mask = 1 << AT91SAM9260_ID_EMAC, |
125 | .type = CLK_TYPE_PERIPHERAL, | 124 | .type = CLK_TYPE_PERIPHERAL, |
126 | }; | 125 | }; |
@@ -190,14 +189,16 @@ static struct clk *periph_clocks[] __initdata = { | |||
190 | }; | 189 | }; |
191 | 190 | ||
192 | static struct clk_lookup periph_clocks_lookups[] = { | 191 | static struct clk_lookup periph_clocks_lookups[] = { |
192 | /* One additional fake clock for macb_hclk */ | ||
193 | CLKDEV_CON_ID("hclk", &macb_clk), | ||
193 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), | 194 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), |
194 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), | 195 | CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), |
195 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), | 196 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk), |
196 | CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk), | 197 | CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk), |
197 | CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk), | 198 | CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk), |
198 | CLKDEV_CON_DEV_ID("t3_clk", "atmel_tcb.1", &tc3_clk), | 199 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tc3_clk), |
199 | CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk), | 200 | CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.1", &tc4_clk), |
200 | CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk), | 201 | CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.1", &tc5_clk), |
201 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk), | 202 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk), |
202 | /* more usart lookup table for DT entries */ | 203 | /* more usart lookup table for DT entries */ |
203 | CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck), | 204 | CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck), |
@@ -209,6 +210,9 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
209 | CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk), | 210 | CLKDEV_CON_DEV_ID("usart", "fffd8000.serial", &usart5_clk), |
210 | /* fake hclk clock */ | 211 | /* fake hclk clock */ |
211 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), | 212 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), |
213 | CLKDEV_CON_ID("pioA", &pioA_clk), | ||
214 | CLKDEV_CON_ID("pioB", &pioB_clk), | ||
215 | CLKDEV_CON_ID("pioC", &pioC_clk), | ||
212 | }; | 216 | }; |
213 | 217 | ||
214 | static struct clk_lookup usart_clocks_lookups[] = { | 218 | static struct clk_lookup usart_clocks_lookups[] = { |
@@ -270,28 +274,19 @@ void __init at91sam9260_set_console_clock(int id) | |||
270 | * GPIO | 274 | * GPIO |
271 | * -------------------------------------------------------------------- */ | 275 | * -------------------------------------------------------------------- */ |
272 | 276 | ||
273 | static struct at91_gpio_bank at91sam9260_gpio[] = { | 277 | static struct at91_gpio_bank at91sam9260_gpio[] __initdata = { |
274 | { | 278 | { |
275 | .id = AT91SAM9260_ID_PIOA, | 279 | .id = AT91SAM9260_ID_PIOA, |
276 | .offset = AT91_PIOA, | 280 | .regbase = AT91SAM9260_BASE_PIOA, |
277 | .clock = &pioA_clk, | ||
278 | }, { | 281 | }, { |
279 | .id = AT91SAM9260_ID_PIOB, | 282 | .id = AT91SAM9260_ID_PIOB, |
280 | .offset = AT91_PIOB, | 283 | .regbase = AT91SAM9260_BASE_PIOB, |
281 | .clock = &pioB_clk, | ||
282 | }, { | 284 | }, { |
283 | .id = AT91SAM9260_ID_PIOC, | 285 | .id = AT91SAM9260_ID_PIOC, |
284 | .offset = AT91_PIOC, | 286 | .regbase = AT91SAM9260_BASE_PIOC, |
285 | .clock = &pioC_clk, | ||
286 | } | 287 | } |
287 | }; | 288 | }; |
288 | 289 | ||
289 | static void at91sam9260_poweroff(void) | ||
290 | { | ||
291 | at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); | ||
292 | } | ||
293 | |||
294 | |||
295 | /* -------------------------------------------------------------------- | 290 | /* -------------------------------------------------------------------- |
296 | * AT91SAM9260 processor initialization | 291 | * AT91SAM9260 processor initialization |
297 | * -------------------------------------------------------------------- */ | 292 | * -------------------------------------------------------------------- */ |
@@ -325,10 +320,16 @@ static void __init at91sam9260_map_io(void) | |||
325 | } | 320 | } |
326 | } | 321 | } |
327 | 322 | ||
323 | static void __init at91sam9260_ioremap_registers(void) | ||
324 | { | ||
325 | at91_ioremap_shdwc(AT91SAM9260_BASE_SHDWC); | ||
326 | at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT); | ||
327 | at91sam9_ioremap_smc(0, AT91SAM9260_BASE_SMC); | ||
328 | } | ||
329 | |||
328 | static void __init at91sam9260_initialize(void) | 330 | static void __init at91sam9260_initialize(void) |
329 | { | 331 | { |
330 | at91_arch_reset = at91sam9_alt_reset; | 332 | at91_arch_reset = at91sam9_alt_reset; |
331 | pm_power_off = at91sam9260_poweroff; | ||
332 | at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1) | 333 | at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1) |
333 | | (1 << AT91SAM9260_ID_IRQ2); | 334 | | (1 << AT91SAM9260_ID_IRQ2); |
334 | 335 | ||
@@ -381,6 +382,7 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
381 | struct at91_init_soc __initdata at91sam9260_soc = { | 382 | struct at91_init_soc __initdata at91sam9260_soc = { |
382 | .map_io = at91sam9260_map_io, | 383 | .map_io = at91sam9260_map_io, |
383 | .default_irq_priority = at91sam9260_default_irq_priority, | 384 | .default_irq_priority = at91sam9260_default_irq_priority, |
385 | .ioremap_registers = at91sam9260_ioremap_registers, | ||
384 | .register_clocks = at91sam9260_register_clocks, | 386 | .register_clocks = at91sam9260_register_clocks, |
385 | .init = at91sam9260_initialize, | 387 | .init = at91sam9260_initialize, |
386 | }; | 388 | }; |
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 25e3464fb07f..642ccb6d26b2 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -84,7 +84,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
84 | * USB Device (Gadget) | 84 | * USB Device (Gadget) |
85 | * -------------------------------------------------------------------- */ | 85 | * -------------------------------------------------------------------- */ |
86 | 86 | ||
87 | #ifdef CONFIG_USB_GADGET_AT91 | 87 | #ifdef CONFIG_USB_AT91 |
88 | static struct at91_udc_data udc_data; | 88 | static struct at91_udc_data udc_data; |
89 | 89 | ||
90 | static struct resource udc_resources[] = { | 90 | static struct resource udc_resources[] = { |
@@ -115,7 +115,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
115 | if (!data) | 115 | if (!data) |
116 | return; | 116 | return; |
117 | 117 | ||
118 | if (data->vbus_pin) { | 118 | if (gpio_is_valid(data->vbus_pin)) { |
119 | at91_set_gpio_input(data->vbus_pin, 0); | 119 | at91_set_gpio_input(data->vbus_pin, 0); |
120 | at91_set_deglitch(data->vbus_pin, 1); | 120 | at91_set_deglitch(data->vbus_pin, 1); |
121 | } | 121 | } |
@@ -136,7 +136,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {} | |||
136 | 136 | ||
137 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) | 137 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) |
138 | static u64 eth_dmamask = DMA_BIT_MASK(32); | 138 | static u64 eth_dmamask = DMA_BIT_MASK(32); |
139 | static struct at91_eth_data eth_data; | 139 | static struct macb_platform_data eth_data; |
140 | 140 | ||
141 | static struct resource eth_resources[] = { | 141 | static struct resource eth_resources[] = { |
142 | [0] = { | 142 | [0] = { |
@@ -163,12 +163,12 @@ static struct platform_device at91sam9260_eth_device = { | |||
163 | .num_resources = ARRAY_SIZE(eth_resources), | 163 | .num_resources = ARRAY_SIZE(eth_resources), |
164 | }; | 164 | }; |
165 | 165 | ||
166 | void __init at91_add_device_eth(struct at91_eth_data *data) | 166 | void __init at91_add_device_eth(struct macb_platform_data *data) |
167 | { | 167 | { |
168 | if (!data) | 168 | if (!data) |
169 | return; | 169 | return; |
170 | 170 | ||
171 | if (data->phy_irq_pin) { | 171 | if (gpio_is_valid(data->phy_irq_pin)) { |
172 | at91_set_gpio_input(data->phy_irq_pin, 0); | 172 | at91_set_gpio_input(data->phy_irq_pin, 0); |
173 | at91_set_deglitch(data->phy_irq_pin, 1); | 173 | at91_set_deglitch(data->phy_irq_pin, 1); |
174 | } | 174 | } |
@@ -200,7 +200,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data) | |||
200 | platform_device_register(&at91sam9260_eth_device); | 200 | platform_device_register(&at91sam9260_eth_device); |
201 | } | 201 | } |
202 | #else | 202 | #else |
203 | void __init at91_add_device_eth(struct at91_eth_data *data) {} | 203 | void __init at91_add_device_eth(struct macb_platform_data *data) {} |
204 | #endif | 204 | #endif |
205 | 205 | ||
206 | 206 | ||
@@ -243,13 +243,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
243 | return; | 243 | return; |
244 | 244 | ||
245 | /* input/irq */ | 245 | /* input/irq */ |
246 | if (data->det_pin) { | 246 | if (gpio_is_valid(data->det_pin)) { |
247 | at91_set_gpio_input(data->det_pin, 1); | 247 | at91_set_gpio_input(data->det_pin, 1); |
248 | at91_set_deglitch(data->det_pin, 1); | 248 | at91_set_deglitch(data->det_pin, 1); |
249 | } | 249 | } |
250 | if (data->wp_pin) | 250 | if (gpio_is_valid(data->wp_pin)) |
251 | at91_set_gpio_input(data->wp_pin, 1); | 251 | at91_set_gpio_input(data->wp_pin, 1); |
252 | if (data->vcc_pin) | 252 | if (gpio_is_valid(data->vcc_pin)) |
253 | at91_set_gpio_output(data->vcc_pin, 0); | 253 | at91_set_gpio_output(data->vcc_pin, 0); |
254 | 254 | ||
255 | /* CLK */ | 255 | /* CLK */ |
@@ -330,11 +330,11 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) | |||
330 | for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) { | 330 | for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) { |
331 | if (data->slot[i].bus_width) { | 331 | if (data->slot[i].bus_width) { |
332 | /* input/irq */ | 332 | /* input/irq */ |
333 | if (data->slot[i].detect_pin) { | 333 | if (gpio_is_valid(data->slot[i].detect_pin)) { |
334 | at91_set_gpio_input(data->slot[i].detect_pin, 1); | 334 | at91_set_gpio_input(data->slot[i].detect_pin, 1); |
335 | at91_set_deglitch(data->slot[i].detect_pin, 1); | 335 | at91_set_deglitch(data->slot[i].detect_pin, 1); |
336 | } | 336 | } |
337 | if (data->slot[i].wp_pin) | 337 | if (gpio_is_valid(data->slot[i].wp_pin)) |
338 | at91_set_gpio_input(data->slot[i].wp_pin, 1); | 338 | at91_set_gpio_input(data->slot[i].wp_pin, 1); |
339 | 339 | ||
340 | switch (i) { | 340 | switch (i) { |
@@ -399,8 +399,8 @@ static struct resource nand_resources[] = { | |||
399 | .flags = IORESOURCE_MEM, | 399 | .flags = IORESOURCE_MEM, |
400 | }, | 400 | }, |
401 | [1] = { | 401 | [1] = { |
402 | .start = AT91_BASE_SYS + AT91_ECC, | 402 | .start = AT91SAM9260_BASE_ECC, |
403 | .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1, | 403 | .end = AT91SAM9260_BASE_ECC + SZ_512 - 1, |
404 | .flags = IORESOURCE_MEM, | 404 | .flags = IORESOURCE_MEM, |
405 | } | 405 | } |
406 | }; | 406 | }; |
@@ -426,15 +426,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
426 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); | 426 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); |
427 | 427 | ||
428 | /* enable pin */ | 428 | /* enable pin */ |
429 | if (data->enable_pin) | 429 | if (gpio_is_valid(data->enable_pin)) |
430 | at91_set_gpio_output(data->enable_pin, 1); | 430 | at91_set_gpio_output(data->enable_pin, 1); |
431 | 431 | ||
432 | /* ready/busy pin */ | 432 | /* ready/busy pin */ |
433 | if (data->rdy_pin) | 433 | if (gpio_is_valid(data->rdy_pin)) |
434 | at91_set_gpio_input(data->rdy_pin, 1); | 434 | at91_set_gpio_input(data->rdy_pin, 1); |
435 | 435 | ||
436 | /* card detect pin */ | 436 | /* card detect pin */ |
437 | if (data->det_pin) | 437 | if (gpio_is_valid(data->det_pin)) |
438 | at91_set_gpio_input(data->det_pin, 1); | 438 | at91_set_gpio_input(data->det_pin, 1); |
439 | 439 | ||
440 | nand_data = *data; | 440 | nand_data = *data; |
@@ -714,8 +714,8 @@ static void __init at91_add_device_tc(void) { } | |||
714 | 714 | ||
715 | static struct resource rtt_resources[] = { | 715 | static struct resource rtt_resources[] = { |
716 | { | 716 | { |
717 | .start = AT91_BASE_SYS + AT91_RTT, | 717 | .start = AT91SAM9260_BASE_RTT, |
718 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | 718 | .end = AT91SAM9260_BASE_RTT + SZ_16 - 1, |
719 | .flags = IORESOURCE_MEM, | 719 | .flags = IORESOURCE_MEM, |
720 | } | 720 | } |
721 | }; | 721 | }; |
@@ -738,10 +738,19 @@ static void __init at91_add_device_rtt(void) | |||
738 | * -------------------------------------------------------------------- */ | 738 | * -------------------------------------------------------------------- */ |
739 | 739 | ||
740 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 740 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
741 | static struct resource wdt_resources[] = { | ||
742 | { | ||
743 | .start = AT91SAM9260_BASE_WDT, | ||
744 | .end = AT91SAM9260_BASE_WDT + SZ_16 - 1, | ||
745 | .flags = IORESOURCE_MEM, | ||
746 | } | ||
747 | }; | ||
748 | |||
741 | static struct platform_device at91sam9260_wdt_device = { | 749 | static struct platform_device at91sam9260_wdt_device = { |
742 | .name = "at91_wdt", | 750 | .name = "at91_wdt", |
743 | .id = -1, | 751 | .id = -1, |
744 | .num_resources = 0, | 752 | .resource = wdt_resources, |
753 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
745 | }; | 754 | }; |
746 | 755 | ||
747 | static void __init at91_add_device_watchdog(void) | 756 | static void __init at91_add_device_watchdog(void) |
@@ -837,8 +846,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | |||
837 | #if defined(CONFIG_SERIAL_ATMEL) | 846 | #if defined(CONFIG_SERIAL_ATMEL) |
838 | static struct resource dbgu_resources[] = { | 847 | static struct resource dbgu_resources[] = { |
839 | [0] = { | 848 | [0] = { |
840 | .start = AT91_BASE_SYS + AT91_DBGU, | 849 | .start = AT91SAM9260_BASE_DBGU, |
841 | .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, | 850 | .end = AT91SAM9260_BASE_DBGU + SZ_512 - 1, |
842 | .flags = IORESOURCE_MEM, | 851 | .flags = IORESOURCE_MEM, |
843 | }, | 852 | }, |
844 | [1] = { | 853 | [1] = { |
@@ -1281,17 +1290,17 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
1281 | 1290 | ||
1282 | at91_sys_write(AT91_MATRIX_EBICSA, csa); | 1291 | at91_sys_write(AT91_MATRIX_EBICSA, csa); |
1283 | 1292 | ||
1284 | if (data->rst_pin) { | 1293 | if (gpio_is_valid(data->rst_pin)) { |
1285 | at91_set_multi_drive(data->rst_pin, 0); | 1294 | at91_set_multi_drive(data->rst_pin, 0); |
1286 | at91_set_gpio_output(data->rst_pin, 1); | 1295 | at91_set_gpio_output(data->rst_pin, 1); |
1287 | } | 1296 | } |
1288 | 1297 | ||
1289 | if (data->irq_pin) { | 1298 | if (gpio_is_valid(data->irq_pin)) { |
1290 | at91_set_gpio_input(data->irq_pin, 0); | 1299 | at91_set_gpio_input(data->irq_pin, 0); |
1291 | at91_set_deglitch(data->irq_pin, 1); | 1300 | at91_set_deglitch(data->irq_pin, 1); |
1292 | } | 1301 | } |
1293 | 1302 | ||
1294 | if (data->det_pin) { | 1303 | if (gpio_is_valid(data->det_pin)) { |
1295 | at91_set_gpio_input(data->det_pin, 0); | 1304 | at91_set_gpio_input(data->det_pin, 0); |
1296 | at91_set_deglitch(data->det_pin, 1); | 1305 | at91_set_deglitch(data->det_pin, 1); |
1297 | } | 1306 | } |
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index 658a5185abfd..a0538c5c2520 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c | |||
@@ -11,7 +11,6 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/pm.h> | ||
15 | 14 | ||
16 | #include <asm/irq.h> | 15 | #include <asm/irq.h> |
17 | #include <asm/mach/arch.h> | 16 | #include <asm/mach/arch.h> |
@@ -20,11 +19,11 @@ | |||
20 | #include <mach/at91sam9261.h> | 19 | #include <mach/at91sam9261.h> |
21 | #include <mach/at91_pmc.h> | 20 | #include <mach/at91_pmc.h> |
22 | #include <mach/at91_rstc.h> | 21 | #include <mach/at91_rstc.h> |
23 | #include <mach/at91_shdwc.h> | ||
24 | 22 | ||
25 | #include "soc.h" | 23 | #include "soc.h" |
26 | #include "generic.h" | 24 | #include "generic.h" |
27 | #include "clock.h" | 25 | #include "clock.h" |
26 | #include "sam9_smc.h" | ||
28 | 27 | ||
29 | /* -------------------------------------------------------------------- | 28 | /* -------------------------------------------------------------------- |
30 | * Clocks | 29 | * Clocks |
@@ -176,6 +175,9 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
176 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), | 175 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), |
177 | CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk), | 176 | CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk), |
178 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0), | 177 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0), |
178 | CLKDEV_CON_ID("pioA", &pioA_clk), | ||
179 | CLKDEV_CON_ID("pioB", &pioB_clk), | ||
180 | CLKDEV_CON_ID("pioC", &pioC_clk), | ||
179 | }; | 181 | }; |
180 | 182 | ||
181 | static struct clk_lookup usart_clocks_lookups[] = { | 183 | static struct clk_lookup usart_clocks_lookups[] = { |
@@ -251,28 +253,19 @@ void __init at91sam9261_set_console_clock(int id) | |||
251 | * GPIO | 253 | * GPIO |
252 | * -------------------------------------------------------------------- */ | 254 | * -------------------------------------------------------------------- */ |
253 | 255 | ||
254 | static struct at91_gpio_bank at91sam9261_gpio[] = { | 256 | static struct at91_gpio_bank at91sam9261_gpio[] __initdata = { |
255 | { | 257 | { |
256 | .id = AT91SAM9261_ID_PIOA, | 258 | .id = AT91SAM9261_ID_PIOA, |
257 | .offset = AT91_PIOA, | 259 | .regbase = AT91SAM9261_BASE_PIOA, |
258 | .clock = &pioA_clk, | ||
259 | }, { | 260 | }, { |
260 | .id = AT91SAM9261_ID_PIOB, | 261 | .id = AT91SAM9261_ID_PIOB, |
261 | .offset = AT91_PIOB, | 262 | .regbase = AT91SAM9261_BASE_PIOB, |
262 | .clock = &pioB_clk, | ||
263 | }, { | 263 | }, { |
264 | .id = AT91SAM9261_ID_PIOC, | 264 | .id = AT91SAM9261_ID_PIOC, |
265 | .offset = AT91_PIOC, | 265 | .regbase = AT91SAM9261_BASE_PIOC, |
266 | .clock = &pioC_clk, | ||
267 | } | 266 | } |
268 | }; | 267 | }; |
269 | 268 | ||
270 | static void at91sam9261_poweroff(void) | ||
271 | { | ||
272 | at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); | ||
273 | } | ||
274 | |||
275 | |||
276 | /* -------------------------------------------------------------------- | 269 | /* -------------------------------------------------------------------- |
277 | * AT91SAM9261 processor initialization | 270 | * AT91SAM9261 processor initialization |
278 | * -------------------------------------------------------------------- */ | 271 | * -------------------------------------------------------------------- */ |
@@ -285,10 +278,16 @@ static void __init at91sam9261_map_io(void) | |||
285 | at91_init_sram(0, AT91SAM9261_SRAM_BASE, AT91SAM9261_SRAM_SIZE); | 278 | at91_init_sram(0, AT91SAM9261_SRAM_BASE, AT91SAM9261_SRAM_SIZE); |
286 | } | 279 | } |
287 | 280 | ||
281 | static void __init at91sam9261_ioremap_registers(void) | ||
282 | { | ||
283 | at91_ioremap_shdwc(AT91SAM9261_BASE_SHDWC); | ||
284 | at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT); | ||
285 | at91sam9_ioremap_smc(0, AT91SAM9261_BASE_SMC); | ||
286 | } | ||
287 | |||
288 | static void __init at91sam9261_initialize(void) | 288 | static void __init at91sam9261_initialize(void) |
289 | { | 289 | { |
290 | at91_arch_reset = at91sam9_alt_reset; | 290 | at91_arch_reset = at91sam9_alt_reset; |
291 | pm_power_off = at91sam9261_poweroff; | ||
292 | at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1) | 291 | at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1) |
293 | | (1 << AT91SAM9261_ID_IRQ2); | 292 | | (1 << AT91SAM9261_ID_IRQ2); |
294 | 293 | ||
@@ -341,6 +340,7 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
341 | struct at91_init_soc __initdata at91sam9261_soc = { | 340 | struct at91_init_soc __initdata at91sam9261_soc = { |
342 | .map_io = at91sam9261_map_io, | 341 | .map_io = at91sam9261_map_io, |
343 | .default_irq_priority = at91sam9261_default_irq_priority, | 342 | .default_irq_priority = at91sam9261_default_irq_priority, |
343 | .ioremap_registers = at91sam9261_ioremap_registers, | ||
344 | .register_clocks = at91sam9261_register_clocks, | 344 | .register_clocks = at91sam9261_register_clocks, |
345 | .init = at91sam9261_initialize, | 345 | .init = at91sam9261_initialize, |
346 | }; | 346 | }; |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index ae78f4d03b73..fc59cbdb0e3c 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -87,7 +87,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
87 | * USB Device (Gadget) | 87 | * USB Device (Gadget) |
88 | * -------------------------------------------------------------------- */ | 88 | * -------------------------------------------------------------------- */ |
89 | 89 | ||
90 | #ifdef CONFIG_USB_GADGET_AT91 | 90 | #ifdef CONFIG_USB_AT91 |
91 | static struct at91_udc_data udc_data; | 91 | static struct at91_udc_data udc_data; |
92 | 92 | ||
93 | static struct resource udc_resources[] = { | 93 | static struct resource udc_resources[] = { |
@@ -118,7 +118,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
118 | if (!data) | 118 | if (!data) |
119 | return; | 119 | return; |
120 | 120 | ||
121 | if (data->vbus_pin) { | 121 | if (gpio_is_valid(data->vbus_pin)) { |
122 | at91_set_gpio_input(data->vbus_pin, 0); | 122 | at91_set_gpio_input(data->vbus_pin, 0); |
123 | at91_set_deglitch(data->vbus_pin, 1); | 123 | at91_set_deglitch(data->vbus_pin, 1); |
124 | } | 124 | } |
@@ -171,13 +171,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
171 | return; | 171 | return; |
172 | 172 | ||
173 | /* input/irq */ | 173 | /* input/irq */ |
174 | if (data->det_pin) { | 174 | if (gpio_is_valid(data->det_pin)) { |
175 | at91_set_gpio_input(data->det_pin, 1); | 175 | at91_set_gpio_input(data->det_pin, 1); |
176 | at91_set_deglitch(data->det_pin, 1); | 176 | at91_set_deglitch(data->det_pin, 1); |
177 | } | 177 | } |
178 | if (data->wp_pin) | 178 | if (gpio_is_valid(data->wp_pin)) |
179 | at91_set_gpio_input(data->wp_pin, 1); | 179 | at91_set_gpio_input(data->wp_pin, 1); |
180 | if (data->vcc_pin) | 180 | if (gpio_is_valid(data->vcc_pin)) |
181 | at91_set_gpio_output(data->vcc_pin, 0); | 181 | at91_set_gpio_output(data->vcc_pin, 0); |
182 | 182 | ||
183 | /* CLK */ | 183 | /* CLK */ |
@@ -240,15 +240,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
240 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); | 240 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); |
241 | 241 | ||
242 | /* enable pin */ | 242 | /* enable pin */ |
243 | if (data->enable_pin) | 243 | if (gpio_is_valid(data->enable_pin)) |
244 | at91_set_gpio_output(data->enable_pin, 1); | 244 | at91_set_gpio_output(data->enable_pin, 1); |
245 | 245 | ||
246 | /* ready/busy pin */ | 246 | /* ready/busy pin */ |
247 | if (data->rdy_pin) | 247 | if (gpio_is_valid(data->rdy_pin)) |
248 | at91_set_gpio_input(data->rdy_pin, 1); | 248 | at91_set_gpio_input(data->rdy_pin, 1); |
249 | 249 | ||
250 | /* card detect pin */ | 250 | /* card detect pin */ |
251 | if (data->det_pin) | 251 | if (gpio_is_valid(data->det_pin)) |
252 | at91_set_gpio_input(data->det_pin, 1); | 252 | at91_set_gpio_input(data->det_pin, 1); |
253 | 253 | ||
254 | at91_set_A_periph(AT91_PIN_PC0, 0); /* NANDOE */ | 254 | at91_set_A_periph(AT91_PIN_PC0, 0); /* NANDOE */ |
@@ -600,8 +600,8 @@ static void __init at91_add_device_tc(void) { } | |||
600 | 600 | ||
601 | static struct resource rtt_resources[] = { | 601 | static struct resource rtt_resources[] = { |
602 | { | 602 | { |
603 | .start = AT91_BASE_SYS + AT91_RTT, | 603 | .start = AT91SAM9261_BASE_RTT, |
604 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | 604 | .end = AT91SAM9261_BASE_RTT + SZ_16 - 1, |
605 | .flags = IORESOURCE_MEM, | 605 | .flags = IORESOURCE_MEM, |
606 | } | 606 | } |
607 | }; | 607 | }; |
@@ -624,10 +624,19 @@ static void __init at91_add_device_rtt(void) | |||
624 | * -------------------------------------------------------------------- */ | 624 | * -------------------------------------------------------------------- */ |
625 | 625 | ||
626 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 626 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
627 | static struct resource wdt_resources[] = { | ||
628 | { | ||
629 | .start = AT91SAM9261_BASE_WDT, | ||
630 | .end = AT91SAM9261_BASE_WDT + SZ_16 - 1, | ||
631 | .flags = IORESOURCE_MEM, | ||
632 | } | ||
633 | }; | ||
634 | |||
627 | static struct platform_device at91sam9261_wdt_device = { | 635 | static struct platform_device at91sam9261_wdt_device = { |
628 | .name = "at91_wdt", | 636 | .name = "at91_wdt", |
629 | .id = -1, | 637 | .id = -1, |
630 | .num_resources = 0, | 638 | .resource = wdt_resources, |
639 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
631 | }; | 640 | }; |
632 | 641 | ||
633 | static void __init at91_add_device_watchdog(void) | 642 | static void __init at91_add_device_watchdog(void) |
@@ -816,8 +825,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | |||
816 | #if defined(CONFIG_SERIAL_ATMEL) | 825 | #if defined(CONFIG_SERIAL_ATMEL) |
817 | static struct resource dbgu_resources[] = { | 826 | static struct resource dbgu_resources[] = { |
818 | [0] = { | 827 | [0] = { |
819 | .start = AT91_BASE_SYS + AT91_DBGU, | 828 | .start = AT91SAM9261_BASE_DBGU, |
820 | .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, | 829 | .end = AT91SAM9261_BASE_DBGU + SZ_512 - 1, |
821 | .flags = IORESOURCE_MEM, | 830 | .flags = IORESOURCE_MEM, |
822 | }, | 831 | }, |
823 | [1] = { | 832 | [1] = { |
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c index f83fbb0ee0c5..5ffbbb024c1e 100644 --- a/arch/arm/mach-at91/at91sam9263.c +++ b/arch/arm/mach-at91/at91sam9263.c | |||
@@ -11,7 +11,6 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/pm.h> | ||
15 | 14 | ||
16 | #include <asm/irq.h> | 15 | #include <asm/irq.h> |
17 | #include <asm/mach/arch.h> | 16 | #include <asm/mach/arch.h> |
@@ -19,11 +18,11 @@ | |||
19 | #include <mach/at91sam9263.h> | 18 | #include <mach/at91sam9263.h> |
20 | #include <mach/at91_pmc.h> | 19 | #include <mach/at91_pmc.h> |
21 | #include <mach/at91_rstc.h> | 20 | #include <mach/at91_rstc.h> |
22 | #include <mach/at91_shdwc.h> | ||
23 | 21 | ||
24 | #include "soc.h" | 22 | #include "soc.h" |
25 | #include "generic.h" | 23 | #include "generic.h" |
26 | #include "clock.h" | 24 | #include "clock.h" |
25 | #include "sam9_smc.h" | ||
27 | 26 | ||
28 | /* -------------------------------------------------------------------- | 27 | /* -------------------------------------------------------------------- |
29 | * Clocks | 28 | * Clocks |
@@ -118,7 +117,7 @@ static struct clk pwm_clk = { | |||
118 | .type = CLK_TYPE_PERIPHERAL, | 117 | .type = CLK_TYPE_PERIPHERAL, |
119 | }; | 118 | }; |
120 | static struct clk macb_clk = { | 119 | static struct clk macb_clk = { |
121 | .name = "macb_clk", | 120 | .name = "pclk", |
122 | .pmc_mask = 1 << AT91SAM9263_ID_EMAC, | 121 | .pmc_mask = 1 << AT91SAM9263_ID_EMAC, |
123 | .type = CLK_TYPE_PERIPHERAL, | 122 | .type = CLK_TYPE_PERIPHERAL, |
124 | }; | 123 | }; |
@@ -182,6 +181,8 @@ static struct clk *periph_clocks[] __initdata = { | |||
182 | }; | 181 | }; |
183 | 182 | ||
184 | static struct clk_lookup periph_clocks_lookups[] = { | 183 | static struct clk_lookup periph_clocks_lookups[] = { |
184 | /* One additional fake clock for macb_hclk */ | ||
185 | CLKDEV_CON_ID("hclk", &macb_clk), | ||
185 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), | 186 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), |
186 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), | 187 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), |
187 | CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk), | 188 | CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk), |
@@ -191,6 +192,11 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
191 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk), | 192 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk), |
192 | /* fake hclk clock */ | 193 | /* fake hclk clock */ |
193 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), | 194 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), |
195 | CLKDEV_CON_ID("pioA", &pioA_clk), | ||
196 | CLKDEV_CON_ID("pioB", &pioB_clk), | ||
197 | CLKDEV_CON_ID("pioC", &pioCDE_clk), | ||
198 | CLKDEV_CON_ID("pioD", &pioCDE_clk), | ||
199 | CLKDEV_CON_ID("pioE", &pioCDE_clk), | ||
194 | }; | 200 | }; |
195 | 201 | ||
196 | static struct clk_lookup usart_clocks_lookups[] = { | 202 | static struct clk_lookup usart_clocks_lookups[] = { |
@@ -263,36 +269,25 @@ void __init at91sam9263_set_console_clock(int id) | |||
263 | * GPIO | 269 | * GPIO |
264 | * -------------------------------------------------------------------- */ | 270 | * -------------------------------------------------------------------- */ |
265 | 271 | ||
266 | static struct at91_gpio_bank at91sam9263_gpio[] = { | 272 | static struct at91_gpio_bank at91sam9263_gpio[] __initdata = { |
267 | { | 273 | { |
268 | .id = AT91SAM9263_ID_PIOA, | 274 | .id = AT91SAM9263_ID_PIOA, |
269 | .offset = AT91_PIOA, | 275 | .regbase = AT91SAM9263_BASE_PIOA, |
270 | .clock = &pioA_clk, | ||
271 | }, { | 276 | }, { |
272 | .id = AT91SAM9263_ID_PIOB, | 277 | .id = AT91SAM9263_ID_PIOB, |
273 | .offset = AT91_PIOB, | 278 | .regbase = AT91SAM9263_BASE_PIOB, |
274 | .clock = &pioB_clk, | ||
275 | }, { | 279 | }, { |
276 | .id = AT91SAM9263_ID_PIOCDE, | 280 | .id = AT91SAM9263_ID_PIOCDE, |
277 | .offset = AT91_PIOC, | 281 | .regbase = AT91SAM9263_BASE_PIOC, |
278 | .clock = &pioCDE_clk, | ||
279 | }, { | 282 | }, { |
280 | .id = AT91SAM9263_ID_PIOCDE, | 283 | .id = AT91SAM9263_ID_PIOCDE, |
281 | .offset = AT91_PIOD, | 284 | .regbase = AT91SAM9263_BASE_PIOD, |
282 | .clock = &pioCDE_clk, | ||
283 | }, { | 285 | }, { |
284 | .id = AT91SAM9263_ID_PIOCDE, | 286 | .id = AT91SAM9263_ID_PIOCDE, |
285 | .offset = AT91_PIOE, | 287 | .regbase = AT91SAM9263_BASE_PIOE, |
286 | .clock = &pioCDE_clk, | ||
287 | } | 288 | } |
288 | }; | 289 | }; |
289 | 290 | ||
290 | static void at91sam9263_poweroff(void) | ||
291 | { | ||
292 | at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); | ||
293 | } | ||
294 | |||
295 | |||
296 | /* -------------------------------------------------------------------- | 291 | /* -------------------------------------------------------------------- |
297 | * AT91SAM9263 processor initialization | 292 | * AT91SAM9263 processor initialization |
298 | * -------------------------------------------------------------------- */ | 293 | * -------------------------------------------------------------------- */ |
@@ -303,10 +298,17 @@ static void __init at91sam9263_map_io(void) | |||
303 | at91_init_sram(1, AT91SAM9263_SRAM1_BASE, AT91SAM9263_SRAM1_SIZE); | 298 | at91_init_sram(1, AT91SAM9263_SRAM1_BASE, AT91SAM9263_SRAM1_SIZE); |
304 | } | 299 | } |
305 | 300 | ||
301 | static void __init at91sam9263_ioremap_registers(void) | ||
302 | { | ||
303 | at91_ioremap_shdwc(AT91SAM9263_BASE_SHDWC); | ||
304 | at91sam926x_ioremap_pit(AT91SAM9263_BASE_PIT); | ||
305 | at91sam9_ioremap_smc(0, AT91SAM9263_BASE_SMC0); | ||
306 | at91sam9_ioremap_smc(1, AT91SAM9263_BASE_SMC1); | ||
307 | } | ||
308 | |||
306 | static void __init at91sam9263_initialize(void) | 309 | static void __init at91sam9263_initialize(void) |
307 | { | 310 | { |
308 | at91_arch_reset = at91sam9_alt_reset; | 311 | at91_arch_reset = at91sam9_alt_reset; |
309 | pm_power_off = at91sam9263_poweroff; | ||
310 | at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1); | 312 | at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1); |
311 | 313 | ||
312 | /* Register GPIO subsystem */ | 314 | /* Register GPIO subsystem */ |
@@ -358,6 +360,7 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
358 | struct at91_init_soc __initdata at91sam9263_soc = { | 360 | struct at91_init_soc __initdata at91sam9263_soc = { |
359 | .map_io = at91sam9263_map_io, | 361 | .map_io = at91sam9263_map_io, |
360 | .default_irq_priority = at91sam9263_default_irq_priority, | 362 | .default_irq_priority = at91sam9263_default_irq_priority, |
363 | .ioremap_registers = at91sam9263_ioremap_registers, | ||
361 | .register_clocks = at91sam9263_register_clocks, | 364 | .register_clocks = at91sam9263_register_clocks, |
362 | .init = at91sam9263_initialize, | 365 | .init = at91sam9263_initialize, |
363 | }; | 366 | }; |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index ad017eb1f8df..7b46b2787022 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -70,7 +70,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) | |||
70 | 70 | ||
71 | /* Enable VBus control for UHP ports */ | 71 | /* Enable VBus control for UHP ports */ |
72 | for (i = 0; i < data->ports; i++) { | 72 | for (i = 0; i < data->ports; i++) { |
73 | if (data->vbus_pin[i]) | 73 | if (gpio_is_valid(data->vbus_pin[i])) |
74 | at91_set_gpio_output(data->vbus_pin[i], 0); | 74 | at91_set_gpio_output(data->vbus_pin[i], 0); |
75 | } | 75 | } |
76 | 76 | ||
@@ -92,7 +92,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
92 | * USB Device (Gadget) | 92 | * USB Device (Gadget) |
93 | * -------------------------------------------------------------------- */ | 93 | * -------------------------------------------------------------------- */ |
94 | 94 | ||
95 | #ifdef CONFIG_USB_GADGET_AT91 | 95 | #ifdef CONFIG_USB_AT91 |
96 | static struct at91_udc_data udc_data; | 96 | static struct at91_udc_data udc_data; |
97 | 97 | ||
98 | static struct resource udc_resources[] = { | 98 | static struct resource udc_resources[] = { |
@@ -123,7 +123,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
123 | if (!data) | 123 | if (!data) |
124 | return; | 124 | return; |
125 | 125 | ||
126 | if (data->vbus_pin) { | 126 | if (gpio_is_valid(data->vbus_pin)) { |
127 | at91_set_gpio_input(data->vbus_pin, 0); | 127 | at91_set_gpio_input(data->vbus_pin, 0); |
128 | at91_set_deglitch(data->vbus_pin, 1); | 128 | at91_set_deglitch(data->vbus_pin, 1); |
129 | } | 129 | } |
@@ -144,7 +144,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {} | |||
144 | 144 | ||
145 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) | 145 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) |
146 | static u64 eth_dmamask = DMA_BIT_MASK(32); | 146 | static u64 eth_dmamask = DMA_BIT_MASK(32); |
147 | static struct at91_eth_data eth_data; | 147 | static struct macb_platform_data eth_data; |
148 | 148 | ||
149 | static struct resource eth_resources[] = { | 149 | static struct resource eth_resources[] = { |
150 | [0] = { | 150 | [0] = { |
@@ -171,12 +171,12 @@ static struct platform_device at91sam9263_eth_device = { | |||
171 | .num_resources = ARRAY_SIZE(eth_resources), | 171 | .num_resources = ARRAY_SIZE(eth_resources), |
172 | }; | 172 | }; |
173 | 173 | ||
174 | void __init at91_add_device_eth(struct at91_eth_data *data) | 174 | void __init at91_add_device_eth(struct macb_platform_data *data) |
175 | { | 175 | { |
176 | if (!data) | 176 | if (!data) |
177 | return; | 177 | return; |
178 | 178 | ||
179 | if (data->phy_irq_pin) { | 179 | if (gpio_is_valid(data->phy_irq_pin)) { |
180 | at91_set_gpio_input(data->phy_irq_pin, 0); | 180 | at91_set_gpio_input(data->phy_irq_pin, 0); |
181 | at91_set_deglitch(data->phy_irq_pin, 1); | 181 | at91_set_deglitch(data->phy_irq_pin, 1); |
182 | } | 182 | } |
@@ -208,7 +208,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data) | |||
208 | platform_device_register(&at91sam9263_eth_device); | 208 | platform_device_register(&at91sam9263_eth_device); |
209 | } | 209 | } |
210 | #else | 210 | #else |
211 | void __init at91_add_device_eth(struct at91_eth_data *data) {} | 211 | void __init at91_add_device_eth(struct macb_platform_data *data) {} |
212 | #endif | 212 | #endif |
213 | 213 | ||
214 | 214 | ||
@@ -276,13 +276,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
276 | return; | 276 | return; |
277 | 277 | ||
278 | /* input/irq */ | 278 | /* input/irq */ |
279 | if (data->det_pin) { | 279 | if (gpio_is_valid(data->det_pin)) { |
280 | at91_set_gpio_input(data->det_pin, 1); | 280 | at91_set_gpio_input(data->det_pin, 1); |
281 | at91_set_deglitch(data->det_pin, 1); | 281 | at91_set_deglitch(data->det_pin, 1); |
282 | } | 282 | } |
283 | if (data->wp_pin) | 283 | if (gpio_is_valid(data->wp_pin)) |
284 | at91_set_gpio_input(data->wp_pin, 1); | 284 | at91_set_gpio_input(data->wp_pin, 1); |
285 | if (data->vcc_pin) | 285 | if (gpio_is_valid(data->vcc_pin)) |
286 | at91_set_gpio_output(data->vcc_pin, 0); | 286 | at91_set_gpio_output(data->vcc_pin, 0); |
287 | 287 | ||
288 | if (mmc_id == 0) { /* MCI0 */ | 288 | if (mmc_id == 0) { /* MCI0 */ |
@@ -430,17 +430,17 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
430 | } | 430 | } |
431 | at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa); | 431 | at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa); |
432 | 432 | ||
433 | if (data->det_pin) { | 433 | if (gpio_is_valid(data->det_pin)) { |
434 | at91_set_gpio_input(data->det_pin, 1); | 434 | at91_set_gpio_input(data->det_pin, 1); |
435 | at91_set_deglitch(data->det_pin, 1); | 435 | at91_set_deglitch(data->det_pin, 1); |
436 | } | 436 | } |
437 | 437 | ||
438 | if (data->irq_pin) { | 438 | if (gpio_is_valid(data->irq_pin)) { |
439 | at91_set_gpio_input(data->irq_pin, 1); | 439 | at91_set_gpio_input(data->irq_pin, 1); |
440 | at91_set_deglitch(data->irq_pin, 1); | 440 | at91_set_deglitch(data->irq_pin, 1); |
441 | } | 441 | } |
442 | 442 | ||
443 | if (data->vcc_pin) | 443 | if (gpio_is_valid(data->vcc_pin)) |
444 | /* initially off */ | 444 | /* initially off */ |
445 | at91_set_gpio_output(data->vcc_pin, 0); | 445 | at91_set_gpio_output(data->vcc_pin, 0); |
446 | 446 | ||
@@ -473,8 +473,8 @@ static struct resource nand_resources[] = { | |||
473 | .flags = IORESOURCE_MEM, | 473 | .flags = IORESOURCE_MEM, |
474 | }, | 474 | }, |
475 | [1] = { | 475 | [1] = { |
476 | .start = AT91_BASE_SYS + AT91_ECC0, | 476 | .start = AT91SAM9263_BASE_ECC0, |
477 | .end = AT91_BASE_SYS + AT91_ECC0 + SZ_512 - 1, | 477 | .end = AT91SAM9263_BASE_ECC0 + SZ_512 - 1, |
478 | .flags = IORESOURCE_MEM, | 478 | .flags = IORESOURCE_MEM, |
479 | } | 479 | } |
480 | }; | 480 | }; |
@@ -500,15 +500,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
500 | at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); | 500 | at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); |
501 | 501 | ||
502 | /* enable pin */ | 502 | /* enable pin */ |
503 | if (data->enable_pin) | 503 | if (gpio_is_valid(data->enable_pin)) |
504 | at91_set_gpio_output(data->enable_pin, 1); | 504 | at91_set_gpio_output(data->enable_pin, 1); |
505 | 505 | ||
506 | /* ready/busy pin */ | 506 | /* ready/busy pin */ |
507 | if (data->rdy_pin) | 507 | if (gpio_is_valid(data->rdy_pin)) |
508 | at91_set_gpio_input(data->rdy_pin, 1); | 508 | at91_set_gpio_input(data->rdy_pin, 1); |
509 | 509 | ||
510 | /* card detect pin */ | 510 | /* card detect pin */ |
511 | if (data->det_pin) | 511 | if (gpio_is_valid(data->det_pin)) |
512 | at91_set_gpio_input(data->det_pin, 1); | 512 | at91_set_gpio_input(data->det_pin, 1); |
513 | 513 | ||
514 | nand_data = *data; | 514 | nand_data = *data; |
@@ -749,7 +749,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
749 | at91_set_A_periph(AT91_PIN_PB3, 0); /* AC97RX */ | 749 | at91_set_A_periph(AT91_PIN_PB3, 0); /* AC97RX */ |
750 | 750 | ||
751 | /* reset */ | 751 | /* reset */ |
752 | if (data->reset_pin) | 752 | if (gpio_is_valid(data->reset_pin)) |
753 | at91_set_gpio_output(data->reset_pin, 0); | 753 | at91_set_gpio_output(data->reset_pin, 0); |
754 | 754 | ||
755 | ac97_data = *data; | 755 | ac97_data = *data; |
@@ -956,8 +956,8 @@ static void __init at91_add_device_tc(void) { } | |||
956 | 956 | ||
957 | static struct resource rtt0_resources[] = { | 957 | static struct resource rtt0_resources[] = { |
958 | { | 958 | { |
959 | .start = AT91_BASE_SYS + AT91_RTT0, | 959 | .start = AT91SAM9263_BASE_RTT0, |
960 | .end = AT91_BASE_SYS + AT91_RTT0 + SZ_16 - 1, | 960 | .end = AT91SAM9263_BASE_RTT0 + SZ_16 - 1, |
961 | .flags = IORESOURCE_MEM, | 961 | .flags = IORESOURCE_MEM, |
962 | } | 962 | } |
963 | }; | 963 | }; |
@@ -971,8 +971,8 @@ static struct platform_device at91sam9263_rtt0_device = { | |||
971 | 971 | ||
972 | static struct resource rtt1_resources[] = { | 972 | static struct resource rtt1_resources[] = { |
973 | { | 973 | { |
974 | .start = AT91_BASE_SYS + AT91_RTT1, | 974 | .start = AT91SAM9263_BASE_RTT1, |
975 | .end = AT91_BASE_SYS + AT91_RTT1 + SZ_16 - 1, | 975 | .end = AT91SAM9263_BASE_RTT1 + SZ_16 - 1, |
976 | .flags = IORESOURCE_MEM, | 976 | .flags = IORESOURCE_MEM, |
977 | } | 977 | } |
978 | }; | 978 | }; |
@@ -996,10 +996,19 @@ static void __init at91_add_device_rtt(void) | |||
996 | * -------------------------------------------------------------------- */ | 996 | * -------------------------------------------------------------------- */ |
997 | 997 | ||
998 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 998 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
999 | static struct resource wdt_resources[] = { | ||
1000 | { | ||
1001 | .start = AT91SAM9263_BASE_WDT, | ||
1002 | .end = AT91SAM9263_BASE_WDT + SZ_16 - 1, | ||
1003 | .flags = IORESOURCE_MEM, | ||
1004 | } | ||
1005 | }; | ||
1006 | |||
999 | static struct platform_device at91sam9263_wdt_device = { | 1007 | static struct platform_device at91sam9263_wdt_device = { |
1000 | .name = "at91_wdt", | 1008 | .name = "at91_wdt", |
1001 | .id = -1, | 1009 | .id = -1, |
1002 | .num_resources = 0, | 1010 | .resource = wdt_resources, |
1011 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
1003 | }; | 1012 | }; |
1004 | 1013 | ||
1005 | static void __init at91_add_device_watchdog(void) | 1014 | static void __init at91_add_device_watchdog(void) |
@@ -1196,8 +1205,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | |||
1196 | 1205 | ||
1197 | static struct resource dbgu_resources[] = { | 1206 | static struct resource dbgu_resources[] = { |
1198 | [0] = { | 1207 | [0] = { |
1199 | .start = AT91_BASE_SYS + AT91_DBGU, | 1208 | .start = AT91SAM9263_BASE_DBGU, |
1200 | .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, | 1209 | .end = AT91SAM9263_BASE_DBGU + SZ_512 - 1, |
1201 | .flags = IORESOURCE_MEM, | 1210 | .flags = IORESOURCE_MEM, |
1202 | }, | 1211 | }, |
1203 | [1] = { | 1212 | [1] = { |
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c index 4ba85499fa97..d89ead740a99 100644 --- a/arch/arm/mach-at91/at91sam926x_time.c +++ b/arch/arm/mach-at91/at91sam926x_time.c | |||
@@ -25,7 +25,17 @@ | |||
25 | 25 | ||
26 | static u32 pit_cycle; /* write-once */ | 26 | static u32 pit_cycle; /* write-once */ |
27 | static u32 pit_cnt; /* access only w/system irq blocked */ | 27 | static u32 pit_cnt; /* access only w/system irq blocked */ |
28 | static void __iomem *pit_base_addr __read_mostly; | ||
28 | 29 | ||
30 | static inline unsigned int pit_read(unsigned int reg_offset) | ||
31 | { | ||
32 | return __raw_readl(pit_base_addr + reg_offset); | ||
33 | } | ||
34 | |||
35 | static inline void pit_write(unsigned int reg_offset, unsigned long value) | ||
36 | { | ||
37 | __raw_writel(value, pit_base_addr + reg_offset); | ||
38 | } | ||
29 | 39 | ||
30 | /* | 40 | /* |
31 | * Clocksource: just a monotonic counter of MCK/16 cycles. | 41 | * Clocksource: just a monotonic counter of MCK/16 cycles. |
@@ -39,7 +49,7 @@ static cycle_t read_pit_clk(struct clocksource *cs) | |||
39 | 49 | ||
40 | raw_local_irq_save(flags); | 50 | raw_local_irq_save(flags); |
41 | elapsed = pit_cnt; | 51 | elapsed = pit_cnt; |
42 | t = at91_sys_read(AT91_PIT_PIIR); | 52 | t = pit_read(AT91_PIT_PIIR); |
43 | raw_local_irq_restore(flags); | 53 | raw_local_irq_restore(flags); |
44 | 54 | ||
45 | elapsed += PIT_PICNT(t) * pit_cycle; | 55 | elapsed += PIT_PICNT(t) * pit_cycle; |
@@ -64,8 +74,8 @@ pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev) | |||
64 | switch (mode) { | 74 | switch (mode) { |
65 | case CLOCK_EVT_MODE_PERIODIC: | 75 | case CLOCK_EVT_MODE_PERIODIC: |
66 | /* update clocksource counter */ | 76 | /* update clocksource counter */ |
67 | pit_cnt += pit_cycle * PIT_PICNT(at91_sys_read(AT91_PIT_PIVR)); | 77 | pit_cnt += pit_cycle * PIT_PICNT(pit_read(AT91_PIT_PIVR)); |
68 | at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN | 78 | pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN |
69 | | AT91_PIT_PITIEN); | 79 | | AT91_PIT_PITIEN); |
70 | break; | 80 | break; |
71 | case CLOCK_EVT_MODE_ONESHOT: | 81 | case CLOCK_EVT_MODE_ONESHOT: |
@@ -74,7 +84,7 @@ pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev) | |||
74 | case CLOCK_EVT_MODE_SHUTDOWN: | 84 | case CLOCK_EVT_MODE_SHUTDOWN: |
75 | case CLOCK_EVT_MODE_UNUSED: | 85 | case CLOCK_EVT_MODE_UNUSED: |
76 | /* disable irq, leaving the clocksource active */ | 86 | /* disable irq, leaving the clocksource active */ |
77 | at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN); | 87 | pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN); |
78 | break; | 88 | break; |
79 | case CLOCK_EVT_MODE_RESUME: | 89 | case CLOCK_EVT_MODE_RESUME: |
80 | break; | 90 | break; |
@@ -103,11 +113,11 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id) | |||
103 | 113 | ||
104 | /* The PIT interrupt may be disabled, and is shared */ | 114 | /* The PIT interrupt may be disabled, and is shared */ |
105 | if ((pit_clkevt.mode == CLOCK_EVT_MODE_PERIODIC) | 115 | if ((pit_clkevt.mode == CLOCK_EVT_MODE_PERIODIC) |
106 | && (at91_sys_read(AT91_PIT_SR) & AT91_PIT_PITS)) { | 116 | && (pit_read(AT91_PIT_SR) & AT91_PIT_PITS)) { |
107 | unsigned nr_ticks; | 117 | unsigned nr_ticks; |
108 | 118 | ||
109 | /* Get number of ticks performed before irq, and ack it */ | 119 | /* Get number of ticks performed before irq, and ack it */ |
110 | nr_ticks = PIT_PICNT(at91_sys_read(AT91_PIT_PIVR)); | 120 | nr_ticks = PIT_PICNT(pit_read(AT91_PIT_PIVR)); |
111 | do { | 121 | do { |
112 | pit_cnt += pit_cycle; | 122 | pit_cnt += pit_cycle; |
113 | pit_clkevt.event_handler(&pit_clkevt); | 123 | pit_clkevt.event_handler(&pit_clkevt); |
@@ -129,14 +139,14 @@ static struct irqaction at91sam926x_pit_irq = { | |||
129 | static void at91sam926x_pit_reset(void) | 139 | static void at91sam926x_pit_reset(void) |
130 | { | 140 | { |
131 | /* Disable timer and irqs */ | 141 | /* Disable timer and irqs */ |
132 | at91_sys_write(AT91_PIT_MR, 0); | 142 | pit_write(AT91_PIT_MR, 0); |
133 | 143 | ||
134 | /* Clear any pending interrupts, wait for PIT to stop counting */ | 144 | /* Clear any pending interrupts, wait for PIT to stop counting */ |
135 | while (PIT_CPIV(at91_sys_read(AT91_PIT_PIVR)) != 0) | 145 | while (PIT_CPIV(pit_read(AT91_PIT_PIVR)) != 0) |
136 | cpu_relax(); | 146 | cpu_relax(); |
137 | 147 | ||
138 | /* Start PIT but don't enable IRQ */ | 148 | /* Start PIT but don't enable IRQ */ |
139 | at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN); | 149 | pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN); |
140 | } | 150 | } |
141 | 151 | ||
142 | /* | 152 | /* |
@@ -178,7 +188,15 @@ static void __init at91sam926x_pit_init(void) | |||
178 | static void at91sam926x_pit_suspend(void) | 188 | static void at91sam926x_pit_suspend(void) |
179 | { | 189 | { |
180 | /* Disable timer */ | 190 | /* Disable timer */ |
181 | at91_sys_write(AT91_PIT_MR, 0); | 191 | pit_write(AT91_PIT_MR, 0); |
192 | } | ||
193 | |||
194 | void __init at91sam926x_ioremap_pit(u32 addr) | ||
195 | { | ||
196 | pit_base_addr = ioremap(addr, 16); | ||
197 | |||
198 | if (!pit_base_addr) | ||
199 | panic("Impossible to ioremap PIT\n"); | ||
182 | } | 200 | } |
183 | 201 | ||
184 | struct sys_timer at91sam926x_timer = { | 202 | struct sys_timer at91sam926x_timer = { |
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index 318b0407ea04..f61eb64e6b39 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c | |||
@@ -11,7 +11,6 @@ | |||
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/pm.h> | ||
15 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
16 | 15 | ||
17 | #include <asm/irq.h> | 16 | #include <asm/irq.h> |
@@ -20,12 +19,12 @@ | |||
20 | #include <mach/at91sam9g45.h> | 19 | #include <mach/at91sam9g45.h> |
21 | #include <mach/at91_pmc.h> | 20 | #include <mach/at91_pmc.h> |
22 | #include <mach/at91_rstc.h> | 21 | #include <mach/at91_rstc.h> |
23 | #include <mach/at91_shdwc.h> | ||
24 | #include <mach/cpu.h> | 22 | #include <mach/cpu.h> |
25 | 23 | ||
26 | #include "soc.h" | 24 | #include "soc.h" |
27 | #include "generic.h" | 25 | #include "generic.h" |
28 | #include "clock.h" | 26 | #include "clock.h" |
27 | #include "sam9_smc.h" | ||
29 | 28 | ||
30 | /* -------------------------------------------------------------------- | 29 | /* -------------------------------------------------------------------- |
31 | * Clocks | 30 | * Clocks |
@@ -150,7 +149,7 @@ static struct clk ac97_clk = { | |||
150 | .type = CLK_TYPE_PERIPHERAL, | 149 | .type = CLK_TYPE_PERIPHERAL, |
151 | }; | 150 | }; |
152 | static struct clk macb_clk = { | 151 | static struct clk macb_clk = { |
153 | .name = "macb_clk", | 152 | .name = "pclk", |
154 | .pmc_mask = 1 << AT91SAM9G45_ID_EMAC, | 153 | .pmc_mask = 1 << AT91SAM9G45_ID_EMAC, |
155 | .type = CLK_TYPE_PERIPHERAL, | 154 | .type = CLK_TYPE_PERIPHERAL, |
156 | }; | 155 | }; |
@@ -209,6 +208,8 @@ static struct clk *periph_clocks[] __initdata = { | |||
209 | }; | 208 | }; |
210 | 209 | ||
211 | static struct clk_lookup periph_clocks_lookups[] = { | 210 | static struct clk_lookup periph_clocks_lookups[] = { |
211 | /* One additional fake clock for macb_hclk */ | ||
212 | CLKDEV_CON_ID("hclk", &macb_clk), | ||
212 | /* One additional fake clock for ohci */ | 213 | /* One additional fake clock for ohci */ |
213 | CLKDEV_CON_ID("ohci_clk", &uhphs_clk), | 214 | CLKDEV_CON_ID("ohci_clk", &uhphs_clk), |
214 | CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk), | 215 | CLKDEV_CON_DEV_ID("ehci_clk", "atmel-ehci", &uhphs_clk), |
@@ -231,6 +232,11 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
231 | CLKDEV_CON_DEV_ID("usart", "fff98000.serial", &usart3_clk), | 232 | CLKDEV_CON_DEV_ID("usart", "fff98000.serial", &usart3_clk), |
232 | /* fake hclk clock */ | 233 | /* fake hclk clock */ |
233 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk), | 234 | CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk), |
235 | CLKDEV_CON_ID("pioA", &pioA_clk), | ||
236 | CLKDEV_CON_ID("pioB", &pioB_clk), | ||
237 | CLKDEV_CON_ID("pioC", &pioC_clk), | ||
238 | CLKDEV_CON_ID("pioD", &pioDE_clk), | ||
239 | CLKDEV_CON_ID("pioE", &pioDE_clk), | ||
234 | }; | 240 | }; |
235 | 241 | ||
236 | static struct clk_lookup usart_clocks_lookups[] = { | 242 | static struct clk_lookup usart_clocks_lookups[] = { |
@@ -293,27 +299,22 @@ void __init at91sam9g45_set_console_clock(int id) | |||
293 | * GPIO | 299 | * GPIO |
294 | * -------------------------------------------------------------------- */ | 300 | * -------------------------------------------------------------------- */ |
295 | 301 | ||
296 | static struct at91_gpio_bank at91sam9g45_gpio[] = { | 302 | static struct at91_gpio_bank at91sam9g45_gpio[] __initdata = { |
297 | { | 303 | { |
298 | .id = AT91SAM9G45_ID_PIOA, | 304 | .id = AT91SAM9G45_ID_PIOA, |
299 | .offset = AT91_PIOA, | 305 | .regbase = AT91SAM9G45_BASE_PIOA, |
300 | .clock = &pioA_clk, | ||
301 | }, { | 306 | }, { |
302 | .id = AT91SAM9G45_ID_PIOB, | 307 | .id = AT91SAM9G45_ID_PIOB, |
303 | .offset = AT91_PIOB, | 308 | .regbase = AT91SAM9G45_BASE_PIOB, |
304 | .clock = &pioB_clk, | ||
305 | }, { | 309 | }, { |
306 | .id = AT91SAM9G45_ID_PIOC, | 310 | .id = AT91SAM9G45_ID_PIOC, |
307 | .offset = AT91_PIOC, | 311 | .regbase = AT91SAM9G45_BASE_PIOC, |
308 | .clock = &pioC_clk, | ||
309 | }, { | 312 | }, { |
310 | .id = AT91SAM9G45_ID_PIODE, | 313 | .id = AT91SAM9G45_ID_PIODE, |
311 | .offset = AT91_PIOD, | 314 | .regbase = AT91SAM9G45_BASE_PIOD, |
312 | .clock = &pioDE_clk, | ||
313 | }, { | 315 | }, { |
314 | .id = AT91SAM9G45_ID_PIODE, | 316 | .id = AT91SAM9G45_ID_PIODE, |
315 | .offset = AT91_PIOE, | 317 | .regbase = AT91SAM9G45_BASE_PIOE, |
316 | .clock = &pioDE_clk, | ||
317 | } | 318 | } |
318 | }; | 319 | }; |
319 | 320 | ||
@@ -322,12 +323,6 @@ static void at91sam9g45_reset(void) | |||
322 | at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST); | 323 | at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST); |
323 | } | 324 | } |
324 | 325 | ||
325 | static void at91sam9g45_poweroff(void) | ||
326 | { | ||
327 | at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); | ||
328 | } | ||
329 | |||
330 | |||
331 | /* -------------------------------------------------------------------- | 326 | /* -------------------------------------------------------------------- |
332 | * AT91SAM9G45 processor initialization | 327 | * AT91SAM9G45 processor initialization |
333 | * -------------------------------------------------------------------- */ | 328 | * -------------------------------------------------------------------- */ |
@@ -338,10 +333,16 @@ static void __init at91sam9g45_map_io(void) | |||
338 | init_consistent_dma_size(SZ_4M); | 333 | init_consistent_dma_size(SZ_4M); |
339 | } | 334 | } |
340 | 335 | ||
336 | static void __init at91sam9g45_ioremap_registers(void) | ||
337 | { | ||
338 | at91_ioremap_shdwc(AT91SAM9G45_BASE_SHDWC); | ||
339 | at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT); | ||
340 | at91sam9_ioremap_smc(0, AT91SAM9G45_BASE_SMC); | ||
341 | } | ||
342 | |||
341 | static void __init at91sam9g45_initialize(void) | 343 | static void __init at91sam9g45_initialize(void) |
342 | { | 344 | { |
343 | at91_arch_reset = at91sam9g45_reset; | 345 | at91_arch_reset = at91sam9g45_reset; |
344 | pm_power_off = at91sam9g45_poweroff; | ||
345 | at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0); | 346 | at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0); |
346 | 347 | ||
347 | /* Register GPIO subsystem */ | 348 | /* Register GPIO subsystem */ |
@@ -393,6 +394,7 @@ static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
393 | struct at91_init_soc __initdata at91sam9g45_soc = { | 394 | struct at91_init_soc __initdata at91sam9g45_soc = { |
394 | .map_io = at91sam9g45_map_io, | 395 | .map_io = at91sam9g45_map_io, |
395 | .default_irq_priority = at91sam9g45_default_irq_priority, | 396 | .default_irq_priority = at91sam9g45_default_irq_priority, |
397 | .ioremap_registers = at91sam9g45_ioremap_registers, | ||
396 | .register_clocks = at91sam9g45_register_clocks, | 398 | .register_clocks = at91sam9g45_register_clocks, |
397 | .init = at91sam9g45_initialize, | 399 | .init = at91sam9g45_initialize, |
398 | }; | 400 | }; |
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index 09a16d6bd5cd..b7582dd10dc3 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -44,8 +44,8 @@ static struct at_dma_platform_data atdma_pdata = { | |||
44 | 44 | ||
45 | static struct resource hdmac_resources[] = { | 45 | static struct resource hdmac_resources[] = { |
46 | [0] = { | 46 | [0] = { |
47 | .start = AT91_BASE_SYS + AT91_DMA, | 47 | .start = AT91SAM9G45_BASE_DMA, |
48 | .end = AT91_BASE_SYS + AT91_DMA + SZ_512 - 1, | 48 | .end = AT91SAM9G45_BASE_DMA + SZ_512 - 1, |
49 | .flags = IORESOURCE_MEM, | 49 | .flags = IORESOURCE_MEM, |
50 | }, | 50 | }, |
51 | [1] = { | 51 | [1] = { |
@@ -120,7 +120,7 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) | |||
120 | 120 | ||
121 | /* Enable VBus control for UHP ports */ | 121 | /* Enable VBus control for UHP ports */ |
122 | for (i = 0; i < data->ports; i++) { | 122 | for (i = 0; i < data->ports; i++) { |
123 | if (data->vbus_pin[i]) | 123 | if (gpio_is_valid(data->vbus_pin[i])) |
124 | at91_set_gpio_output(data->vbus_pin[i], 0); | 124 | at91_set_gpio_output(data->vbus_pin[i], 0); |
125 | } | 125 | } |
126 | 126 | ||
@@ -181,7 +181,7 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data) | |||
181 | 181 | ||
182 | /* Enable VBus control for UHP ports */ | 182 | /* Enable VBus control for UHP ports */ |
183 | for (i = 0; i < data->ports; i++) { | 183 | for (i = 0; i < data->ports; i++) { |
184 | if (data->vbus_pin[i]) | 184 | if (gpio_is_valid(data->vbus_pin[i])) |
185 | at91_set_gpio_output(data->vbus_pin[i], 0); | 185 | at91_set_gpio_output(data->vbus_pin[i], 0); |
186 | } | 186 | } |
187 | 187 | ||
@@ -263,7 +263,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) | |||
263 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); | 263 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); |
264 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); | 264 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); |
265 | 265 | ||
266 | if (data && data->vbus_pin > 0) { | 266 | if (data && gpio_is_valid(data->vbus_pin)) { |
267 | at91_set_gpio_input(data->vbus_pin, 0); | 267 | at91_set_gpio_input(data->vbus_pin, 0); |
268 | at91_set_deglitch(data->vbus_pin, 1); | 268 | at91_set_deglitch(data->vbus_pin, 1); |
269 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; | 269 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; |
@@ -284,7 +284,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {} | |||
284 | 284 | ||
285 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) | 285 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) |
286 | static u64 eth_dmamask = DMA_BIT_MASK(32); | 286 | static u64 eth_dmamask = DMA_BIT_MASK(32); |
287 | static struct at91_eth_data eth_data; | 287 | static struct macb_platform_data eth_data; |
288 | 288 | ||
289 | static struct resource eth_resources[] = { | 289 | static struct resource eth_resources[] = { |
290 | [0] = { | 290 | [0] = { |
@@ -311,12 +311,12 @@ static struct platform_device at91sam9g45_eth_device = { | |||
311 | .num_resources = ARRAY_SIZE(eth_resources), | 311 | .num_resources = ARRAY_SIZE(eth_resources), |
312 | }; | 312 | }; |
313 | 313 | ||
314 | void __init at91_add_device_eth(struct at91_eth_data *data) | 314 | void __init at91_add_device_eth(struct macb_platform_data *data) |
315 | { | 315 | { |
316 | if (!data) | 316 | if (!data) |
317 | return; | 317 | return; |
318 | 318 | ||
319 | if (data->phy_irq_pin) { | 319 | if (gpio_is_valid(data->phy_irq_pin)) { |
320 | at91_set_gpio_input(data->phy_irq_pin, 0); | 320 | at91_set_gpio_input(data->phy_irq_pin, 0); |
321 | at91_set_deglitch(data->phy_irq_pin, 1); | 321 | at91_set_deglitch(data->phy_irq_pin, 1); |
322 | } | 322 | } |
@@ -348,7 +348,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data) | |||
348 | platform_device_register(&at91sam9g45_eth_device); | 348 | platform_device_register(&at91sam9g45_eth_device); |
349 | } | 349 | } |
350 | #else | 350 | #else |
351 | void __init at91_add_device_eth(struct at91_eth_data *data) {} | 351 | void __init at91_add_device_eth(struct macb_platform_data *data) {} |
352 | #endif | 352 | #endif |
353 | 353 | ||
354 | 354 | ||
@@ -449,11 +449,11 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) | |||
449 | 449 | ||
450 | 450 | ||
451 | /* input/irq */ | 451 | /* input/irq */ |
452 | if (data->slot[0].detect_pin) { | 452 | if (gpio_is_valid(data->slot[0].detect_pin)) { |
453 | at91_set_gpio_input(data->slot[0].detect_pin, 1); | 453 | at91_set_gpio_input(data->slot[0].detect_pin, 1); |
454 | at91_set_deglitch(data->slot[0].detect_pin, 1); | 454 | at91_set_deglitch(data->slot[0].detect_pin, 1); |
455 | } | 455 | } |
456 | if (data->slot[0].wp_pin) | 456 | if (gpio_is_valid(data->slot[0].wp_pin)) |
457 | at91_set_gpio_input(data->slot[0].wp_pin, 1); | 457 | at91_set_gpio_input(data->slot[0].wp_pin, 1); |
458 | 458 | ||
459 | if (mmc_id == 0) { /* MCI0 */ | 459 | if (mmc_id == 0) { /* MCI0 */ |
@@ -529,8 +529,8 @@ static struct resource nand_resources[] = { | |||
529 | .flags = IORESOURCE_MEM, | 529 | .flags = IORESOURCE_MEM, |
530 | }, | 530 | }, |
531 | [1] = { | 531 | [1] = { |
532 | .start = AT91_BASE_SYS + AT91_ECC, | 532 | .start = AT91SAM9G45_BASE_ECC, |
533 | .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1, | 533 | .end = AT91SAM9G45_BASE_ECC + SZ_512 - 1, |
534 | .flags = IORESOURCE_MEM, | 534 | .flags = IORESOURCE_MEM, |
535 | } | 535 | } |
536 | }; | 536 | }; |
@@ -556,15 +556,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
556 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); | 556 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA); |
557 | 557 | ||
558 | /* enable pin */ | 558 | /* enable pin */ |
559 | if (data->enable_pin) | 559 | if (gpio_is_valid(data->enable_pin)) |
560 | at91_set_gpio_output(data->enable_pin, 1); | 560 | at91_set_gpio_output(data->enable_pin, 1); |
561 | 561 | ||
562 | /* ready/busy pin */ | 562 | /* ready/busy pin */ |
563 | if (data->rdy_pin) | 563 | if (gpio_is_valid(data->rdy_pin)) |
564 | at91_set_gpio_input(data->rdy_pin, 1); | 564 | at91_set_gpio_input(data->rdy_pin, 1); |
565 | 565 | ||
566 | /* card detect pin */ | 566 | /* card detect pin */ |
567 | if (data->det_pin) | 567 | if (gpio_is_valid(data->det_pin)) |
568 | at91_set_gpio_input(data->det_pin, 1); | 568 | at91_set_gpio_input(data->det_pin, 1); |
569 | 569 | ||
570 | nand_data = *data; | 570 | nand_data = *data; |
@@ -859,7 +859,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
859 | at91_set_A_periph(AT91_PIN_PD6, 0); /* AC97RX */ | 859 | at91_set_A_periph(AT91_PIN_PD6, 0); /* AC97RX */ |
860 | 860 | ||
861 | /* reset */ | 861 | /* reset */ |
862 | if (data->reset_pin) | 862 | if (gpio_is_valid(data->reset_pin)) |
863 | at91_set_gpio_output(data->reset_pin, 0); | 863 | at91_set_gpio_output(data->reset_pin, 0); |
864 | 864 | ||
865 | ac97_data = *data; | 865 | ac97_data = *data; |
@@ -1009,10 +1009,24 @@ static void __init at91_add_device_tc(void) { } | |||
1009 | * -------------------------------------------------------------------- */ | 1009 | * -------------------------------------------------------------------- */ |
1010 | 1010 | ||
1011 | #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE) | 1011 | #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE) |
1012 | static struct resource rtc_resources[] = { | ||
1013 | [0] = { | ||
1014 | .start = AT91SAM9G45_BASE_RTC, | ||
1015 | .end = AT91SAM9G45_BASE_RTC + SZ_256 - 1, | ||
1016 | .flags = IORESOURCE_MEM, | ||
1017 | }, | ||
1018 | [1] = { | ||
1019 | .start = AT91_ID_SYS, | ||
1020 | .end = AT91_ID_SYS, | ||
1021 | .flags = IORESOURCE_IRQ, | ||
1022 | }, | ||
1023 | }; | ||
1024 | |||
1012 | static struct platform_device at91sam9g45_rtc_device = { | 1025 | static struct platform_device at91sam9g45_rtc_device = { |
1013 | .name = "at91_rtc", | 1026 | .name = "at91_rtc", |
1014 | .id = -1, | 1027 | .id = -1, |
1015 | .num_resources = 0, | 1028 | .resource = rtc_resources, |
1029 | .num_resources = ARRAY_SIZE(rtc_resources), | ||
1016 | }; | 1030 | }; |
1017 | 1031 | ||
1018 | static void __init at91_add_device_rtc(void) | 1032 | static void __init at91_add_device_rtc(void) |
@@ -1081,8 +1095,8 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {} | |||
1081 | 1095 | ||
1082 | static struct resource rtt_resources[] = { | 1096 | static struct resource rtt_resources[] = { |
1083 | { | 1097 | { |
1084 | .start = AT91_BASE_SYS + AT91_RTT, | 1098 | .start = AT91SAM9G45_BASE_RTT, |
1085 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | 1099 | .end = AT91SAM9G45_BASE_RTT + SZ_16 - 1, |
1086 | .flags = IORESOURCE_MEM, | 1100 | .flags = IORESOURCE_MEM, |
1087 | } | 1101 | } |
1088 | }; | 1102 | }; |
@@ -1133,10 +1147,19 @@ static void __init at91_add_device_trng(void) {} | |||
1133 | * -------------------------------------------------------------------- */ | 1147 | * -------------------------------------------------------------------- */ |
1134 | 1148 | ||
1135 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 1149 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
1150 | static struct resource wdt_resources[] = { | ||
1151 | { | ||
1152 | .start = AT91SAM9G45_BASE_WDT, | ||
1153 | .end = AT91SAM9G45_BASE_WDT + SZ_16 - 1, | ||
1154 | .flags = IORESOURCE_MEM, | ||
1155 | } | ||
1156 | }; | ||
1157 | |||
1136 | static struct platform_device at91sam9g45_wdt_device = { | 1158 | static struct platform_device at91sam9g45_wdt_device = { |
1137 | .name = "at91_wdt", | 1159 | .name = "at91_wdt", |
1138 | .id = -1, | 1160 | .id = -1, |
1139 | .num_resources = 0, | 1161 | .resource = wdt_resources, |
1162 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
1140 | }; | 1163 | }; |
1141 | 1164 | ||
1142 | static void __init at91_add_device_watchdog(void) | 1165 | static void __init at91_add_device_watchdog(void) |
@@ -1332,8 +1355,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | |||
1332 | #if defined(CONFIG_SERIAL_ATMEL) | 1355 | #if defined(CONFIG_SERIAL_ATMEL) |
1333 | static struct resource dbgu_resources[] = { | 1356 | static struct resource dbgu_resources[] = { |
1334 | [0] = { | 1357 | [0] = { |
1335 | .start = AT91_BASE_SYS + AT91_DBGU, | 1358 | .start = AT91SAM9G45_BASE_DBGU, |
1336 | .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, | 1359 | .end = AT91SAM9G45_BASE_DBGU + SZ_512 - 1, |
1337 | .flags = IORESOURCE_MEM, | 1360 | .flags = IORESOURCE_MEM, |
1338 | }, | 1361 | }, |
1339 | [1] = { | 1362 | [1] = { |
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c index a238105d2c11..96247f68b9d2 100644 --- a/arch/arm/mach-at91/at91sam9rl.c +++ b/arch/arm/mach-at91/at91sam9rl.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/pm.h> | ||
14 | 13 | ||
15 | #include <asm/irq.h> | 14 | #include <asm/irq.h> |
16 | #include <asm/mach/arch.h> | 15 | #include <asm/mach/arch.h> |
@@ -20,11 +19,11 @@ | |||
20 | #include <mach/at91sam9rl.h> | 19 | #include <mach/at91sam9rl.h> |
21 | #include <mach/at91_pmc.h> | 20 | #include <mach/at91_pmc.h> |
22 | #include <mach/at91_rstc.h> | 21 | #include <mach/at91_rstc.h> |
23 | #include <mach/at91_shdwc.h> | ||
24 | 22 | ||
25 | #include "soc.h" | 23 | #include "soc.h" |
26 | #include "generic.h" | 24 | #include "generic.h" |
27 | #include "clock.h" | 25 | #include "clock.h" |
26 | #include "sam9_smc.h" | ||
28 | 27 | ||
29 | /* -------------------------------------------------------------------- | 28 | /* -------------------------------------------------------------------- |
30 | * Clocks | 29 | * Clocks |
@@ -184,6 +183,10 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
184 | CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk), | 183 | CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk), |
185 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), | 184 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), |
186 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), | 185 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), |
186 | CLKDEV_CON_ID("pioA", &pioA_clk), | ||
187 | CLKDEV_CON_ID("pioB", &pioB_clk), | ||
188 | CLKDEV_CON_ID("pioC", &pioC_clk), | ||
189 | CLKDEV_CON_ID("pioD", &pioD_clk), | ||
187 | }; | 190 | }; |
188 | 191 | ||
189 | static struct clk_lookup usart_clocks_lookups[] = { | 192 | static struct clk_lookup usart_clocks_lookups[] = { |
@@ -243,32 +246,22 @@ void __init at91sam9rl_set_console_clock(int id) | |||
243 | * GPIO | 246 | * GPIO |
244 | * -------------------------------------------------------------------- */ | 247 | * -------------------------------------------------------------------- */ |
245 | 248 | ||
246 | static struct at91_gpio_bank at91sam9rl_gpio[] = { | 249 | static struct at91_gpio_bank at91sam9rl_gpio[] __initdata = { |
247 | { | 250 | { |
248 | .id = AT91SAM9RL_ID_PIOA, | 251 | .id = AT91SAM9RL_ID_PIOA, |
249 | .offset = AT91_PIOA, | 252 | .regbase = AT91SAM9RL_BASE_PIOA, |
250 | .clock = &pioA_clk, | ||
251 | }, { | 253 | }, { |
252 | .id = AT91SAM9RL_ID_PIOB, | 254 | .id = AT91SAM9RL_ID_PIOB, |
253 | .offset = AT91_PIOB, | 255 | .regbase = AT91SAM9RL_BASE_PIOB, |
254 | .clock = &pioB_clk, | ||
255 | }, { | 256 | }, { |
256 | .id = AT91SAM9RL_ID_PIOC, | 257 | .id = AT91SAM9RL_ID_PIOC, |
257 | .offset = AT91_PIOC, | 258 | .regbase = AT91SAM9RL_BASE_PIOC, |
258 | .clock = &pioC_clk, | ||
259 | }, { | 259 | }, { |
260 | .id = AT91SAM9RL_ID_PIOD, | 260 | .id = AT91SAM9RL_ID_PIOD, |
261 | .offset = AT91_PIOD, | 261 | .regbase = AT91SAM9RL_BASE_PIOD, |
262 | .clock = &pioD_clk, | ||
263 | } | 262 | } |
264 | }; | 263 | }; |
265 | 264 | ||
266 | static void at91sam9rl_poweroff(void) | ||
267 | { | ||
268 | at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); | ||
269 | } | ||
270 | |||
271 | |||
272 | /* -------------------------------------------------------------------- | 265 | /* -------------------------------------------------------------------- |
273 | * AT91SAM9RL processor initialization | 266 | * AT91SAM9RL processor initialization |
274 | * -------------------------------------------------------------------- */ | 267 | * -------------------------------------------------------------------- */ |
@@ -290,10 +283,16 @@ static void __init at91sam9rl_map_io(void) | |||
290 | at91_init_sram(0, AT91SAM9RL_SRAM_BASE, sram_size); | 283 | at91_init_sram(0, AT91SAM9RL_SRAM_BASE, sram_size); |
291 | } | 284 | } |
292 | 285 | ||
286 | static void __init at91sam9rl_ioremap_registers(void) | ||
287 | { | ||
288 | at91_ioremap_shdwc(AT91SAM9RL_BASE_SHDWC); | ||
289 | at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT); | ||
290 | at91sam9_ioremap_smc(0, AT91SAM9RL_BASE_SMC); | ||
291 | } | ||
292 | |||
293 | static void __init at91sam9rl_initialize(void) | 293 | static void __init at91sam9rl_initialize(void) |
294 | { | 294 | { |
295 | at91_arch_reset = at91sam9_alt_reset; | 295 | at91_arch_reset = at91sam9_alt_reset; |
296 | pm_power_off = at91sam9rl_poweroff; | ||
297 | at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0); | 296 | at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0); |
298 | 297 | ||
299 | /* Register GPIO subsystem */ | 298 | /* Register GPIO subsystem */ |
@@ -345,6 +344,7 @@ static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
345 | struct at91_init_soc __initdata at91sam9rl_soc = { | 344 | struct at91_init_soc __initdata at91sam9rl_soc = { |
346 | .map_io = at91sam9rl_map_io, | 345 | .map_io = at91sam9rl_map_io, |
347 | .default_irq_priority = at91sam9rl_default_irq_priority, | 346 | .default_irq_priority = at91sam9rl_default_irq_priority, |
347 | .ioremap_registers = at91sam9rl_ioremap_registers, | ||
348 | .register_clocks = at91sam9rl_register_clocks, | 348 | .register_clocks = at91sam9rl_register_clocks, |
349 | .init = at91sam9rl_initialize, | 349 | .init = at91sam9rl_initialize, |
350 | }; | 350 | }; |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index 628eb566d60c..61908dce9784 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -39,8 +39,8 @@ static struct at_dma_platform_data atdma_pdata = { | |||
39 | 39 | ||
40 | static struct resource hdmac_resources[] = { | 40 | static struct resource hdmac_resources[] = { |
41 | [0] = { | 41 | [0] = { |
42 | .start = AT91_BASE_SYS + AT91_DMA, | 42 | .start = AT91SAM9RL_BASE_DMA, |
43 | .end = AT91_BASE_SYS + AT91_DMA + SZ_512 - 1, | 43 | .end = AT91SAM9RL_BASE_DMA + SZ_512 - 1, |
44 | .flags = IORESOURCE_MEM, | 44 | .flags = IORESOURCE_MEM, |
45 | }, | 45 | }, |
46 | [2] = { | 46 | [2] = { |
@@ -147,7 +147,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) | |||
147 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); | 147 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); |
148 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); | 148 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); |
149 | 149 | ||
150 | if (data && data->vbus_pin > 0) { | 150 | if (data && gpio_is_valid(data->vbus_pin)) { |
151 | at91_set_gpio_input(data->vbus_pin, 0); | 151 | at91_set_gpio_input(data->vbus_pin, 0); |
152 | at91_set_deglitch(data->vbus_pin, 1); | 152 | at91_set_deglitch(data->vbus_pin, 1); |
153 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; | 153 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; |
@@ -201,13 +201,13 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) | |||
201 | return; | 201 | return; |
202 | 202 | ||
203 | /* input/irq */ | 203 | /* input/irq */ |
204 | if (data->det_pin) { | 204 | if (gpio_is_valid(data->det_pin)) { |
205 | at91_set_gpio_input(data->det_pin, 1); | 205 | at91_set_gpio_input(data->det_pin, 1); |
206 | at91_set_deglitch(data->det_pin, 1); | 206 | at91_set_deglitch(data->det_pin, 1); |
207 | } | 207 | } |
208 | if (data->wp_pin) | 208 | if (gpio_is_valid(data->wp_pin)) |
209 | at91_set_gpio_input(data->wp_pin, 1); | 209 | at91_set_gpio_input(data->wp_pin, 1); |
210 | if (data->vcc_pin) | 210 | if (gpio_is_valid(data->vcc_pin)) |
211 | at91_set_gpio_output(data->vcc_pin, 0); | 211 | at91_set_gpio_output(data->vcc_pin, 0); |
212 | 212 | ||
213 | /* CLK */ | 213 | /* CLK */ |
@@ -248,8 +248,8 @@ static struct resource nand_resources[] = { | |||
248 | .flags = IORESOURCE_MEM, | 248 | .flags = IORESOURCE_MEM, |
249 | }, | 249 | }, |
250 | [1] = { | 250 | [1] = { |
251 | .start = AT91_BASE_SYS + AT91_ECC, | 251 | .start = AT91SAM9RL_BASE_ECC, |
252 | .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1, | 252 | .end = AT91SAM9RL_BASE_ECC + SZ_512 - 1, |
253 | .flags = IORESOURCE_MEM, | 253 | .flags = IORESOURCE_MEM, |
254 | } | 254 | } |
255 | }; | 255 | }; |
@@ -275,15 +275,15 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
275 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); | 275 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); |
276 | 276 | ||
277 | /* enable pin */ | 277 | /* enable pin */ |
278 | if (data->enable_pin) | 278 | if (gpio_is_valid(data->enable_pin)) |
279 | at91_set_gpio_output(data->enable_pin, 1); | 279 | at91_set_gpio_output(data->enable_pin, 1); |
280 | 280 | ||
281 | /* ready/busy pin */ | 281 | /* ready/busy pin */ |
282 | if (data->rdy_pin) | 282 | if (gpio_is_valid(data->rdy_pin)) |
283 | at91_set_gpio_input(data->rdy_pin, 1); | 283 | at91_set_gpio_input(data->rdy_pin, 1); |
284 | 284 | ||
285 | /* card detect pin */ | 285 | /* card detect pin */ |
286 | if (data->det_pin) | 286 | if (gpio_is_valid(data->det_pin)) |
287 | at91_set_gpio_input(data->det_pin, 1); | 287 | at91_set_gpio_input(data->det_pin, 1); |
288 | 288 | ||
289 | at91_set_A_periph(AT91_PIN_PB4, 0); /* NANDOE */ | 289 | at91_set_A_periph(AT91_PIN_PB4, 0); /* NANDOE */ |
@@ -483,7 +483,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
483 | at91_set_A_periph(AT91_PIN_PD4, 0); /* AC97RX */ | 483 | at91_set_A_periph(AT91_PIN_PD4, 0); /* AC97RX */ |
484 | 484 | ||
485 | /* reset */ | 485 | /* reset */ |
486 | if (data->reset_pin) | 486 | if (gpio_is_valid(data->reset_pin)) |
487 | at91_set_gpio_output(data->reset_pin, 0); | 487 | at91_set_gpio_output(data->reset_pin, 0); |
488 | 488 | ||
489 | ac97_data = *data; | 489 | ac97_data = *data; |
@@ -685,8 +685,8 @@ static void __init at91_add_device_rtc(void) {} | |||
685 | 685 | ||
686 | static struct resource rtt_resources[] = { | 686 | static struct resource rtt_resources[] = { |
687 | { | 687 | { |
688 | .start = AT91_BASE_SYS + AT91_RTT, | 688 | .start = AT91SAM9RL_BASE_RTT, |
689 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | 689 | .end = AT91SAM9RL_BASE_RTT + SZ_16 - 1, |
690 | .flags = IORESOURCE_MEM, | 690 | .flags = IORESOURCE_MEM, |
691 | } | 691 | } |
692 | }; | 692 | }; |
@@ -709,10 +709,19 @@ static void __init at91_add_device_rtt(void) | |||
709 | * -------------------------------------------------------------------- */ | 709 | * -------------------------------------------------------------------- */ |
710 | 710 | ||
711 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 711 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
712 | static struct resource wdt_resources[] = { | ||
713 | { | ||
714 | .start = AT91SAM9RL_BASE_WDT, | ||
715 | .end = AT91SAM9RL_BASE_WDT + SZ_16 - 1, | ||
716 | .flags = IORESOURCE_MEM, | ||
717 | } | ||
718 | }; | ||
719 | |||
712 | static struct platform_device at91sam9rl_wdt_device = { | 720 | static struct platform_device at91sam9rl_wdt_device = { |
713 | .name = "at91_wdt", | 721 | .name = "at91_wdt", |
714 | .id = -1, | 722 | .id = -1, |
715 | .num_resources = 0, | 723 | .resource = wdt_resources, |
724 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
716 | }; | 725 | }; |
717 | 726 | ||
718 | static void __init at91_add_device_watchdog(void) | 727 | static void __init at91_add_device_watchdog(void) |
@@ -908,8 +917,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | |||
908 | #if defined(CONFIG_SERIAL_ATMEL) | 917 | #if defined(CONFIG_SERIAL_ATMEL) |
909 | static struct resource dbgu_resources[] = { | 918 | static struct resource dbgu_resources[] = { |
910 | [0] = { | 919 | [0] = { |
911 | .start = AT91_BASE_SYS + AT91_DBGU, | 920 | .start = AT91SAM9RL_BASE_DBGU, |
912 | .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, | 921 | .end = AT91SAM9RL_BASE_DBGU + SZ_512 - 1, |
913 | .flags = IORESOURCE_MEM, | 922 | .flags = IORESOURCE_MEM, |
914 | }, | 923 | }, |
915 | [1] = { | 924 | [1] = { |
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c index 367d5cd5e362..2628384aaae1 100644 --- a/arch/arm/mach-at91/board-1arm.c +++ b/arch/arm/mach-at91/board-1arm.c | |||
@@ -63,13 +63,15 @@ static void __init onearm_init_early(void) | |||
63 | at91_set_serial_console(0); | 63 | at91_set_serial_console(0); |
64 | } | 64 | } |
65 | 65 | ||
66 | static struct at91_eth_data __initdata onearm_eth_data = { | 66 | static struct macb_platform_data __initdata onearm_eth_data = { |
67 | .phy_irq_pin = AT91_PIN_PC4, | 67 | .phy_irq_pin = AT91_PIN_PC4, |
68 | .is_rmii = 1, | 68 | .is_rmii = 1, |
69 | }; | 69 | }; |
70 | 70 | ||
71 | static struct at91_usbh_data __initdata onearm_usbh_data = { | 71 | static struct at91_usbh_data __initdata onearm_usbh_data = { |
72 | .ports = 1, | 72 | .ports = 1, |
73 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
74 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
73 | }; | 75 | }; |
74 | 76 | ||
75 | static struct at91_udc_data __initdata onearm_udc_data = { | 77 | static struct at91_udc_data __initdata onearm_udc_data = { |
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c index 4282d96dffa8..3bb40694b02d 100644 --- a/arch/arm/mach-at91/board-afeb-9260v1.c +++ b/arch/arm/mach-at91/board-afeb-9260v1.c | |||
@@ -75,6 +75,8 @@ static void __init afeb9260_init_early(void) | |||
75 | */ | 75 | */ |
76 | static struct at91_usbh_data __initdata afeb9260_usbh_data = { | 76 | static struct at91_usbh_data __initdata afeb9260_usbh_data = { |
77 | .ports = 1, | 77 | .ports = 1, |
78 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
79 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
78 | }; | 80 | }; |
79 | 81 | ||
80 | /* | 82 | /* |
@@ -82,7 +84,7 @@ static struct at91_usbh_data __initdata afeb9260_usbh_data = { | |||
82 | */ | 84 | */ |
83 | static struct at91_udc_data __initdata afeb9260_udc_data = { | 85 | static struct at91_udc_data __initdata afeb9260_udc_data = { |
84 | .vbus_pin = AT91_PIN_PC5, | 86 | .vbus_pin = AT91_PIN_PC5, |
85 | .pullup_pin = 0, /* pull-up driven by UDC */ | 87 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
86 | }; | 88 | }; |
87 | 89 | ||
88 | 90 | ||
@@ -103,7 +105,7 @@ static struct spi_board_info afeb9260_spi_devices[] = { | |||
103 | /* | 105 | /* |
104 | * MACB Ethernet device | 106 | * MACB Ethernet device |
105 | */ | 107 | */ |
106 | static struct at91_eth_data __initdata afeb9260_macb_data = { | 108 | static struct macb_platform_data __initdata afeb9260_macb_data = { |
107 | .phy_irq_pin = AT91_PIN_PA9, | 109 | .phy_irq_pin = AT91_PIN_PA9, |
108 | .is_rmii = 0, | 110 | .is_rmii = 0, |
109 | }; | 111 | }; |
@@ -138,6 +140,7 @@ static struct atmel_nand_data __initdata afeb9260_nand_data = { | |||
138 | .bus_width_16 = 0, | 140 | .bus_width_16 = 0, |
139 | .parts = afeb9260_nand_partition, | 141 | .parts = afeb9260_nand_partition, |
140 | .num_parts = ARRAY_SIZE(afeb9260_nand_partition), | 142 | .num_parts = ARRAY_SIZE(afeb9260_nand_partition), |
143 | .det_pin = -EINVAL, | ||
141 | }; | 144 | }; |
142 | 145 | ||
143 | 146 | ||
@@ -149,6 +152,7 @@ static struct at91_mmc_data __initdata afeb9260_mmc_data = { | |||
149 | .wp_pin = AT91_PIN_PC4, | 152 | .wp_pin = AT91_PIN_PC4, |
150 | .slot_b = 1, | 153 | .slot_b = 1, |
151 | .wire4 = 1, | 154 | .wire4 = 1, |
155 | .vcc_pin = -EINVAL, | ||
152 | }; | 156 | }; |
153 | 157 | ||
154 | 158 | ||
@@ -169,6 +173,8 @@ static struct i2c_board_info __initdata afeb9260_i2c_devices[] = { | |||
169 | static struct at91_cf_data afeb9260_cf_data = { | 173 | static struct at91_cf_data afeb9260_cf_data = { |
170 | .chipselect = 4, | 174 | .chipselect = 4, |
171 | .irq_pin = AT91_PIN_PA6, | 175 | .irq_pin = AT91_PIN_PA6, |
176 | .det_pin = -EINVAL, | ||
177 | .vcc_pin = -EINVAL, | ||
172 | .rst_pin = AT91_PIN_PA7, | 178 | .rst_pin = AT91_PIN_PA7, |
173 | .flags = AT91_CF_TRUE_IDE, | 179 | .flags = AT91_CF_TRUE_IDE, |
174 | }; | 180 | }; |
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c index f90cfb32bad2..8510e9e54988 100644 --- a/arch/arm/mach-at91/board-cam60.c +++ b/arch/arm/mach-at91/board-cam60.c | |||
@@ -62,6 +62,8 @@ static void __init cam60_init_early(void) | |||
62 | */ | 62 | */ |
63 | static struct at91_usbh_data __initdata cam60_usbh_data = { | 63 | static struct at91_usbh_data __initdata cam60_usbh_data = { |
64 | .ports = 1, | 64 | .ports = 1, |
65 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
66 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
65 | }; | 67 | }; |
66 | 68 | ||
67 | 69 | ||
@@ -115,7 +117,7 @@ static struct spi_board_info cam60_spi_devices[] __initdata = { | |||
115 | /* | 117 | /* |
116 | * MACB Ethernet device | 118 | * MACB Ethernet device |
117 | */ | 119 | */ |
118 | static struct __initdata at91_eth_data cam60_macb_data = { | 120 | static struct __initdata macb_platform_data cam60_macb_data = { |
119 | .phy_irq_pin = AT91_PIN_PB5, | 121 | .phy_irq_pin = AT91_PIN_PB5, |
120 | .is_rmii = 0, | 122 | .is_rmii = 0, |
121 | }; | 123 | }; |
@@ -135,7 +137,7 @@ static struct mtd_partition __initdata cam60_nand_partition[] = { | |||
135 | static struct atmel_nand_data __initdata cam60_nand_data = { | 137 | static struct atmel_nand_data __initdata cam60_nand_data = { |
136 | .ale = 21, | 138 | .ale = 21, |
137 | .cle = 22, | 139 | .cle = 22, |
138 | // .det_pin = ... not there | 140 | .det_pin = -EINVAL, |
139 | .rdy_pin = AT91_PIN_PA9, | 141 | .rdy_pin = AT91_PIN_PA9, |
140 | .enable_pin = AT91_PIN_PA7, | 142 | .enable_pin = AT91_PIN_PA7, |
141 | .parts = cam60_nand_partition, | 143 | .parts = cam60_nand_partition, |
@@ -163,7 +165,7 @@ static struct sam9_smc_config __initdata cam60_nand_smc_config = { | |||
163 | static void __init cam60_add_device_nand(void) | 165 | static void __init cam60_add_device_nand(void) |
164 | { | 166 | { |
165 | /* configure chip-select 3 (NAND) */ | 167 | /* configure chip-select 3 (NAND) */ |
166 | sam9_smc_configure(3, &cam60_nand_smc_config); | 168 | sam9_smc_configure(0, 3, &cam60_nand_smc_config); |
167 | 169 | ||
168 | at91_add_device_nand(&cam60_nand_data); | 170 | at91_add_device_nand(&cam60_nand_data); |
169 | } | 171 | } |
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c index 5dffd3be62d2..ac3de4f7c31d 100644 --- a/arch/arm/mach-at91/board-cap9adk.c +++ b/arch/arm/mach-at91/board-cap9adk.c | |||
@@ -70,6 +70,8 @@ static void __init cap9adk_init_early(void) | |||
70 | */ | 70 | */ |
71 | static struct at91_usbh_data __initdata cap9adk_usbh_data = { | 71 | static struct at91_usbh_data __initdata cap9adk_usbh_data = { |
72 | .ports = 2, | 72 | .ports = 2, |
73 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
74 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
73 | }; | 75 | }; |
74 | 76 | ||
75 | /* | 77 | /* |
@@ -144,16 +146,17 @@ static struct spi_board_info cap9adk_spi_devices[] = { | |||
144 | */ | 146 | */ |
145 | static struct at91_mmc_data __initdata cap9adk_mmc_data = { | 147 | static struct at91_mmc_data __initdata cap9adk_mmc_data = { |
146 | .wire4 = 1, | 148 | .wire4 = 1, |
147 | // .det_pin = ... not connected | 149 | .det_pin = -EINVAL, |
148 | // .wp_pin = ... not connected | 150 | .wp_pin = -EINVAL, |
149 | // .vcc_pin = ... not connected | 151 | .vcc_pin = -EINVAL, |
150 | }; | 152 | }; |
151 | 153 | ||
152 | 154 | ||
153 | /* | 155 | /* |
154 | * MACB Ethernet device | 156 | * MACB Ethernet device |
155 | */ | 157 | */ |
156 | static struct at91_eth_data __initdata cap9adk_macb_data = { | 158 | static struct macb_platform_data __initdata cap9adk_macb_data = { |
159 | .phy_irq_pin = -EINVAL, | ||
157 | .is_rmii = 1, | 160 | .is_rmii = 1, |
158 | }; | 161 | }; |
159 | 162 | ||
@@ -172,8 +175,8 @@ static struct mtd_partition __initdata cap9adk_nand_partitions[] = { | |||
172 | static struct atmel_nand_data __initdata cap9adk_nand_data = { | 175 | static struct atmel_nand_data __initdata cap9adk_nand_data = { |
173 | .ale = 21, | 176 | .ale = 21, |
174 | .cle = 22, | 177 | .cle = 22, |
175 | // .det_pin = ... not connected | 178 | .det_pin = -EINVAL, |
176 | // .rdy_pin = ... not connected | 179 | .rdy_pin = -EINVAL, |
177 | .enable_pin = AT91_PIN_PD15, | 180 | .enable_pin = AT91_PIN_PD15, |
178 | .parts = cap9adk_nand_partitions, | 181 | .parts = cap9adk_nand_partitions, |
179 | .num_parts = ARRAY_SIZE(cap9adk_nand_partitions), | 182 | .num_parts = ARRAY_SIZE(cap9adk_nand_partitions), |
@@ -212,7 +215,7 @@ static void __init cap9adk_add_device_nand(void) | |||
212 | cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_8; | 215 | cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_8; |
213 | 216 | ||
214 | /* configure chip-select 3 (NAND) */ | 217 | /* configure chip-select 3 (NAND) */ |
215 | sam9_smc_configure(3, &cap9adk_nand_smc_config); | 218 | sam9_smc_configure(0, 3, &cap9adk_nand_smc_config); |
216 | 219 | ||
217 | at91_add_device_nand(&cap9adk_nand_data); | 220 | at91_add_device_nand(&cap9adk_nand_data); |
218 | } | 221 | } |
@@ -282,7 +285,7 @@ static __init void cap9adk_add_device_nor(void) | |||
282 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); | 285 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); |
283 | 286 | ||
284 | /* configure chip-select 0 (NOR) */ | 287 | /* configure chip-select 0 (NOR) */ |
285 | sam9_smc_configure(0, &cap9adk_nor_smc_config); | 288 | sam9_smc_configure(0, 0, &cap9adk_nor_smc_config); |
286 | 289 | ||
287 | platform_device_register(&cap9adk_nor_flash); | 290 | platform_device_register(&cap9adk_nor_flash); |
288 | } | 291 | } |
@@ -351,7 +354,7 @@ static struct atmel_lcdfb_info __initdata cap9adk_lcdc_data; | |||
351 | * AC97 | 354 | * AC97 |
352 | */ | 355 | */ |
353 | static struct ac97c_platform_data cap9adk_ac97_data = { | 356 | static struct ac97c_platform_data cap9adk_ac97_data = { |
354 | // .reset_pin = ... not connected | 357 | .reset_pin = -EINVAL, |
355 | }; | 358 | }; |
356 | 359 | ||
357 | 360 | ||
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c index 774c87fcbd5b..59d9cf997537 100644 --- a/arch/arm/mach-at91/board-carmeva.c +++ b/arch/arm/mach-at91/board-carmeva.c | |||
@@ -57,13 +57,15 @@ static void __init carmeva_init_early(void) | |||
57 | at91_set_serial_console(0); | 57 | at91_set_serial_console(0); |
58 | } | 58 | } |
59 | 59 | ||
60 | static struct at91_eth_data __initdata carmeva_eth_data = { | 60 | static struct macb_platform_data __initdata carmeva_eth_data = { |
61 | .phy_irq_pin = AT91_PIN_PC4, | 61 | .phy_irq_pin = AT91_PIN_PC4, |
62 | .is_rmii = 1, | 62 | .is_rmii = 1, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static struct at91_usbh_data __initdata carmeva_usbh_data = { | 65 | static struct at91_usbh_data __initdata carmeva_usbh_data = { |
66 | .ports = 2, | 66 | .ports = 2, |
67 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
68 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
67 | }; | 69 | }; |
68 | 70 | ||
69 | static struct at91_udc_data __initdata carmeva_udc_data = { | 71 | static struct at91_udc_data __initdata carmeva_udc_data = { |
@@ -75,8 +77,8 @@ static struct at91_udc_data __initdata carmeva_udc_data = { | |||
75 | // static struct at91_cf_data __initdata carmeva_cf_data = { | 77 | // static struct at91_cf_data __initdata carmeva_cf_data = { |
76 | // .det_pin = AT91_PIN_PB0, | 78 | // .det_pin = AT91_PIN_PB0, |
77 | // .rst_pin = AT91_PIN_PC5, | 79 | // .rst_pin = AT91_PIN_PC5, |
78 | // .irq_pin = ... not connected | 80 | // .irq_pin = -EINVAL, |
79 | // .vcc_pin = ... always powered | 81 | // .vcc_pin = -EINVAL, |
80 | // }; | 82 | // }; |
81 | 83 | ||
82 | static struct at91_mmc_data __initdata carmeva_mmc_data = { | 84 | static struct at91_mmc_data __initdata carmeva_mmc_data = { |
@@ -84,6 +86,7 @@ static struct at91_mmc_data __initdata carmeva_mmc_data = { | |||
84 | .wire4 = 1, | 86 | .wire4 = 1, |
85 | .det_pin = AT91_PIN_PB10, | 87 | .det_pin = AT91_PIN_PB10, |
86 | .wp_pin = AT91_PIN_PC14, | 88 | .wp_pin = AT91_PIN_PC14, |
89 | .vcc_pin = -EINVAL, | ||
87 | }; | 90 | }; |
88 | 91 | ||
89 | static struct spi_board_info carmeva_spi_devices[] = { | 92 | static struct spi_board_info carmeva_spi_devices[] = { |
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c index fc885a4ce243..9ab3d1ea326d 100644 --- a/arch/arm/mach-at91/board-cpu9krea.c +++ b/arch/arm/mach-at91/board-cpu9krea.c | |||
@@ -86,6 +86,8 @@ static void __init cpu9krea_init_early(void) | |||
86 | */ | 86 | */ |
87 | static struct at91_usbh_data __initdata cpu9krea_usbh_data = { | 87 | static struct at91_usbh_data __initdata cpu9krea_usbh_data = { |
88 | .ports = 2, | 88 | .ports = 2, |
89 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
90 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
89 | }; | 91 | }; |
90 | 92 | ||
91 | /* | 93 | /* |
@@ -93,13 +95,14 @@ static struct at91_usbh_data __initdata cpu9krea_usbh_data = { | |||
93 | */ | 95 | */ |
94 | static struct at91_udc_data __initdata cpu9krea_udc_data = { | 96 | static struct at91_udc_data __initdata cpu9krea_udc_data = { |
95 | .vbus_pin = AT91_PIN_PC8, | 97 | .vbus_pin = AT91_PIN_PC8, |
96 | .pullup_pin = 0, /* pull-up driven by UDC */ | 98 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
97 | }; | 99 | }; |
98 | 100 | ||
99 | /* | 101 | /* |
100 | * MACB Ethernet device | 102 | * MACB Ethernet device |
101 | */ | 103 | */ |
102 | static struct at91_eth_data __initdata cpu9krea_macb_data = { | 104 | static struct macb_platform_data __initdata cpu9krea_macb_data = { |
105 | .phy_irq_pin = -EINVAL, | ||
103 | .is_rmii = 1, | 106 | .is_rmii = 1, |
104 | }; | 107 | }; |
105 | 108 | ||
@@ -112,6 +115,7 @@ static struct atmel_nand_data __initdata cpu9krea_nand_data = { | |||
112 | .rdy_pin = AT91_PIN_PC13, | 115 | .rdy_pin = AT91_PIN_PC13, |
113 | .enable_pin = AT91_PIN_PC14, | 116 | .enable_pin = AT91_PIN_PC14, |
114 | .bus_width_16 = 0, | 117 | .bus_width_16 = 0, |
118 | .det_pin = -EINVAL, | ||
115 | }; | 119 | }; |
116 | 120 | ||
117 | #ifdef CONFIG_MACH_CPU9260 | 121 | #ifdef CONFIG_MACH_CPU9260 |
@@ -156,7 +160,7 @@ static struct sam9_smc_config __initdata cpu9krea_nand_smc_config = { | |||
156 | 160 | ||
157 | static void __init cpu9krea_add_device_nand(void) | 161 | static void __init cpu9krea_add_device_nand(void) |
158 | { | 162 | { |
159 | sam9_smc_configure(3, &cpu9krea_nand_smc_config); | 163 | sam9_smc_configure(0, 3, &cpu9krea_nand_smc_config); |
160 | at91_add_device_nand(&cpu9krea_nand_data); | 164 | at91_add_device_nand(&cpu9krea_nand_data); |
161 | } | 165 | } |
162 | 166 | ||
@@ -238,7 +242,7 @@ static __init void cpu9krea_add_device_nor(void) | |||
238 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_VDDIOMSEL_3_3V); | 242 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_VDDIOMSEL_3_3V); |
239 | 243 | ||
240 | /* configure chip-select 0 (NOR) */ | 244 | /* configure chip-select 0 (NOR) */ |
241 | sam9_smc_configure(0, &cpu9krea_nor_smc_config); | 245 | sam9_smc_configure(0, 0, &cpu9krea_nor_smc_config); |
242 | 246 | ||
243 | platform_device_register(&cpu9krea_nor_flash); | 247 | platform_device_register(&cpu9krea_nor_flash); |
244 | } | 248 | } |
@@ -337,6 +341,8 @@ static struct at91_mmc_data __initdata cpu9krea_mmc_data = { | |||
337 | .slot_b = 0, | 341 | .slot_b = 0, |
338 | .wire4 = 1, | 342 | .wire4 = 1, |
339 | .det_pin = AT91_PIN_PA29, | 343 | .det_pin = AT91_PIN_PA29, |
344 | .wp_pin = -EINVAL, | ||
345 | .vcc_pin = -EINVAL, | ||
340 | }; | 346 | }; |
341 | 347 | ||
342 | static void __init cpu9krea_board_init(void) | 348 | static void __init cpu9krea_board_init(void) |
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c index d35e65b08ccd..368e1427ad99 100644 --- a/arch/arm/mach-at91/board-cpuat91.c +++ b/arch/arm/mach-at91/board-cpuat91.c | |||
@@ -82,12 +82,15 @@ static void __init cpuat91_init_early(void) | |||
82 | at91_set_serial_console(0); | 82 | at91_set_serial_console(0); |
83 | } | 83 | } |
84 | 84 | ||
85 | static struct at91_eth_data __initdata cpuat91_eth_data = { | 85 | static struct macb_platform_data __initdata cpuat91_eth_data = { |
86 | .phy_irq_pin = -EINVAL, | ||
86 | .is_rmii = 1, | 87 | .is_rmii = 1, |
87 | }; | 88 | }; |
88 | 89 | ||
89 | static struct at91_usbh_data __initdata cpuat91_usbh_data = { | 90 | static struct at91_usbh_data __initdata cpuat91_usbh_data = { |
90 | .ports = 1, | 91 | .ports = 1, |
92 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
93 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
91 | }; | 94 | }; |
92 | 95 | ||
93 | static struct at91_udc_data __initdata cpuat91_udc_data = { | 96 | static struct at91_udc_data __initdata cpuat91_udc_data = { |
@@ -98,6 +101,8 @@ static struct at91_udc_data __initdata cpuat91_udc_data = { | |||
98 | static struct at91_mmc_data __initdata cpuat91_mmc_data = { | 101 | static struct at91_mmc_data __initdata cpuat91_mmc_data = { |
99 | .det_pin = AT91_PIN_PC2, | 102 | .det_pin = AT91_PIN_PC2, |
100 | .wire4 = 1, | 103 | .wire4 = 1, |
104 | .wp_pin = -EINVAL, | ||
105 | .vcc_pin = -EINVAL, | ||
101 | }; | 106 | }; |
102 | 107 | ||
103 | static struct physmap_flash_data cpuat91_flash_data = { | 108 | static struct physmap_flash_data cpuat91_flash_data = { |
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c index c3936665e645..1a1547b1ce4e 100644 --- a/arch/arm/mach-at91/board-csb337.c +++ b/arch/arm/mach-at91/board-csb337.c | |||
@@ -58,18 +58,20 @@ static void __init csb337_init_early(void) | |||
58 | at91_set_serial_console(0); | 58 | at91_set_serial_console(0); |
59 | } | 59 | } |
60 | 60 | ||
61 | static struct at91_eth_data __initdata csb337_eth_data = { | 61 | static struct macb_platform_data __initdata csb337_eth_data = { |
62 | .phy_irq_pin = AT91_PIN_PC2, | 62 | .phy_irq_pin = AT91_PIN_PC2, |
63 | .is_rmii = 0, | 63 | .is_rmii = 0, |
64 | }; | 64 | }; |
65 | 65 | ||
66 | static struct at91_usbh_data __initdata csb337_usbh_data = { | 66 | static struct at91_usbh_data __initdata csb337_usbh_data = { |
67 | .ports = 2, | 67 | .ports = 2, |
68 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
69 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
68 | }; | 70 | }; |
69 | 71 | ||
70 | static struct at91_udc_data __initdata csb337_udc_data = { | 72 | static struct at91_udc_data __initdata csb337_udc_data = { |
71 | // this has no VBUS sensing pin | ||
72 | .pullup_pin = AT91_PIN_PA24, | 73 | .pullup_pin = AT91_PIN_PA24, |
74 | .vbus_pin = -EINVAL, | ||
73 | }; | 75 | }; |
74 | 76 | ||
75 | static struct i2c_board_info __initdata csb337_i2c_devices[] = { | 77 | static struct i2c_board_info __initdata csb337_i2c_devices[] = { |
@@ -98,6 +100,7 @@ static struct at91_mmc_data __initdata csb337_mmc_data = { | |||
98 | .slot_b = 0, | 100 | .slot_b = 0, |
99 | .wire4 = 1, | 101 | .wire4 = 1, |
100 | .wp_pin = AT91_PIN_PD6, | 102 | .wp_pin = AT91_PIN_PD6, |
103 | .vcc_pin = -EINVAL, | ||
101 | }; | 104 | }; |
102 | 105 | ||
103 | static struct spi_board_info csb337_spi_devices[] = { | 106 | static struct spi_board_info csb337_spi_devices[] = { |
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c index 586100e2acbb..f650bf39455d 100644 --- a/arch/arm/mach-at91/board-csb637.c +++ b/arch/arm/mach-at91/board-csb637.c | |||
@@ -52,13 +52,15 @@ static void __init csb637_init_early(void) | |||
52 | at91_set_serial_console(0); | 52 | at91_set_serial_console(0); |
53 | } | 53 | } |
54 | 54 | ||
55 | static struct at91_eth_data __initdata csb637_eth_data = { | 55 | static struct macb_platform_data __initdata csb637_eth_data = { |
56 | .phy_irq_pin = AT91_PIN_PC0, | 56 | .phy_irq_pin = AT91_PIN_PC0, |
57 | .is_rmii = 0, | 57 | .is_rmii = 0, |
58 | }; | 58 | }; |
59 | 59 | ||
60 | static struct at91_usbh_data __initdata csb637_usbh_data = { | 60 | static struct at91_usbh_data __initdata csb637_usbh_data = { |
61 | .ports = 2, | 61 | .ports = 2, |
62 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
63 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
62 | }; | 64 | }; |
63 | 65 | ||
64 | static struct at91_udc_data __initdata csb637_udc_data = { | 66 | static struct at91_udc_data __initdata csb637_udc_data = { |
diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c index 0b7d32778210..bb6b434ec0c1 100644 --- a/arch/arm/mach-at91/board-dt.c +++ b/arch/arm/mach-at91/board-dt.c | |||
@@ -50,6 +50,7 @@ static void __init ek_init_early(void) | |||
50 | static struct atmel_nand_data __initdata ek_nand_data = { | 50 | static struct atmel_nand_data __initdata ek_nand_data = { |
51 | .ale = 21, | 51 | .ale = 21, |
52 | .cle = 22, | 52 | .cle = 22, |
53 | .det_pin = -EINVAL, | ||
53 | .rdy_pin = AT91_PIN_PC8, | 54 | .rdy_pin = AT91_PIN_PC8, |
54 | .enable_pin = AT91_PIN_PC14, | 55 | .enable_pin = AT91_PIN_PC14, |
55 | }; | 56 | }; |
@@ -82,7 +83,7 @@ static void __init ek_add_device_nand(void) | |||
82 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; | 83 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; |
83 | 84 | ||
84 | /* configure chip-select 3 (NAND) */ | 85 | /* configure chip-select 3 (NAND) */ |
85 | sam9_smc_configure(3, &ek_nand_smc_config); | 86 | sam9_smc_configure(0, 3, &ek_nand_smc_config); |
86 | 87 | ||
87 | at91_add_device_nand(&ek_nand_data); | 88 | at91_add_device_nand(&ek_nand_data); |
88 | } | 89 | } |
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c index 45db7a3dbef0..d302ca3eeb64 100644 --- a/arch/arm/mach-at91/board-eb9200.c +++ b/arch/arm/mach-at91/board-eb9200.c | |||
@@ -60,13 +60,15 @@ static void __init eb9200_init_early(void) | |||
60 | at91_set_serial_console(0); | 60 | at91_set_serial_console(0); |
61 | } | 61 | } |
62 | 62 | ||
63 | static struct at91_eth_data __initdata eb9200_eth_data = { | 63 | static struct macb_platform_data __initdata eb9200_eth_data = { |
64 | .phy_irq_pin = AT91_PIN_PC4, | 64 | .phy_irq_pin = AT91_PIN_PC4, |
65 | .is_rmii = 1, | 65 | .is_rmii = 1, |
66 | }; | 66 | }; |
67 | 67 | ||
68 | static struct at91_usbh_data __initdata eb9200_usbh_data = { | 68 | static struct at91_usbh_data __initdata eb9200_usbh_data = { |
69 | .ports = 2, | 69 | .ports = 2, |
70 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
71 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
70 | }; | 72 | }; |
71 | 73 | ||
72 | static struct at91_udc_data __initdata eb9200_udc_data = { | 74 | static struct at91_udc_data __initdata eb9200_udc_data = { |
@@ -75,15 +77,18 @@ static struct at91_udc_data __initdata eb9200_udc_data = { | |||
75 | }; | 77 | }; |
76 | 78 | ||
77 | static struct at91_cf_data __initdata eb9200_cf_data = { | 79 | static struct at91_cf_data __initdata eb9200_cf_data = { |
80 | .irq_pin = -EINVAL, | ||
78 | .det_pin = AT91_PIN_PB0, | 81 | .det_pin = AT91_PIN_PB0, |
82 | .vcc_pin = -EINVAL, | ||
79 | .rst_pin = AT91_PIN_PC5, | 83 | .rst_pin = AT91_PIN_PC5, |
80 | // .irq_pin = ... not connected | ||
81 | // .vcc_pin = ... always powered | ||
82 | }; | 84 | }; |
83 | 85 | ||
84 | static struct at91_mmc_data __initdata eb9200_mmc_data = { | 86 | static struct at91_mmc_data __initdata eb9200_mmc_data = { |
85 | .slot_b = 0, | 87 | .slot_b = 0, |
86 | .wire4 = 1, | 88 | .wire4 = 1, |
89 | .det_pin = -EINVAL, | ||
90 | .wp_pin = -EINVAL, | ||
91 | .vcc_pin = -EINVAL, | ||
87 | }; | 92 | }; |
88 | 93 | ||
89 | static struct i2c_board_info __initdata eb9200_i2c_devices[] = { | 94 | static struct i2c_board_info __initdata eb9200_i2c_devices[] = { |
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c index 2f9c16d29212..69966ce4d776 100644 --- a/arch/arm/mach-at91/board-ecbat91.c +++ b/arch/arm/mach-at91/board-ecbat91.c | |||
@@ -64,18 +64,23 @@ static void __init ecb_at91init_early(void) | |||
64 | at91_set_serial_console(0); | 64 | at91_set_serial_console(0); |
65 | } | 65 | } |
66 | 66 | ||
67 | static struct at91_eth_data __initdata ecb_at91eth_data = { | 67 | static struct macb_platform_data __initdata ecb_at91eth_data = { |
68 | .phy_irq_pin = AT91_PIN_PC4, | 68 | .phy_irq_pin = AT91_PIN_PC4, |
69 | .is_rmii = 0, | 69 | .is_rmii = 0, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static struct at91_usbh_data __initdata ecb_at91usbh_data = { | 72 | static struct at91_usbh_data __initdata ecb_at91usbh_data = { |
73 | .ports = 1, | 73 | .ports = 1, |
74 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
75 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
74 | }; | 76 | }; |
75 | 77 | ||
76 | static struct at91_mmc_data __initdata ecb_at91mmc_data = { | 78 | static struct at91_mmc_data __initdata ecb_at91mmc_data = { |
77 | .slot_b = 0, | 79 | .slot_b = 0, |
78 | .wire4 = 1, | 80 | .wire4 = 1, |
81 | .det_pin = -EINVAL, | ||
82 | .wp_pin = -EINVAL, | ||
83 | .vcc_pin = -EINVAL, | ||
79 | }; | 84 | }; |
80 | 85 | ||
81 | 86 | ||
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c index 8252c722607b..07ef35b0ec2c 100644 --- a/arch/arm/mach-at91/board-eco920.c +++ b/arch/arm/mach-at91/board-eco920.c | |||
@@ -47,13 +47,15 @@ static void __init eco920_init_early(void) | |||
47 | at91_set_serial_console(0); | 47 | at91_set_serial_console(0); |
48 | } | 48 | } |
49 | 49 | ||
50 | static struct at91_eth_data __initdata eco920_eth_data = { | 50 | static struct macb_platform_data __initdata eco920_eth_data = { |
51 | .phy_irq_pin = AT91_PIN_PC2, | 51 | .phy_irq_pin = AT91_PIN_PC2, |
52 | .is_rmii = 1, | 52 | .is_rmii = 1, |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static struct at91_usbh_data __initdata eco920_usbh_data = { | 55 | static struct at91_usbh_data __initdata eco920_usbh_data = { |
56 | .ports = 1, | 56 | .ports = 1, |
57 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
58 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
57 | }; | 59 | }; |
58 | 60 | ||
59 | static struct at91_udc_data __initdata eco920_udc_data = { | 61 | static struct at91_udc_data __initdata eco920_udc_data = { |
@@ -64,6 +66,9 @@ static struct at91_udc_data __initdata eco920_udc_data = { | |||
64 | static struct at91_mmc_data __initdata eco920_mmc_data = { | 66 | static struct at91_mmc_data __initdata eco920_mmc_data = { |
65 | .slot_b = 0, | 67 | .slot_b = 0, |
66 | .wire4 = 0, | 68 | .wire4 = 0, |
69 | .det_pin = -EINVAL, | ||
70 | .wp_pin = -EINVAL, | ||
71 | .vcc_pin = -EINVAL, | ||
67 | }; | 72 | }; |
68 | 73 | ||
69 | static struct physmap_flash_data eco920_flash_data = { | 74 | static struct physmap_flash_data eco920_flash_data = { |
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c index 4c3f65d9c59b..eec02cd57ced 100644 --- a/arch/arm/mach-at91/board-flexibity.c +++ b/arch/arm/mach-at91/board-flexibity.c | |||
@@ -52,12 +52,14 @@ static void __init flexibity_init_early(void) | |||
52 | /* USB Host port */ | 52 | /* USB Host port */ |
53 | static struct at91_usbh_data __initdata flexibity_usbh_data = { | 53 | static struct at91_usbh_data __initdata flexibity_usbh_data = { |
54 | .ports = 2, | 54 | .ports = 2, |
55 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
56 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
55 | }; | 57 | }; |
56 | 58 | ||
57 | /* USB Device port */ | 59 | /* USB Device port */ |
58 | static struct at91_udc_data __initdata flexibity_udc_data = { | 60 | static struct at91_udc_data __initdata flexibity_udc_data = { |
59 | .vbus_pin = AT91_PIN_PC5, | 61 | .vbus_pin = AT91_PIN_PC5, |
60 | .pullup_pin = 0, /* pull-up driven by UDC */ | 62 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
61 | }; | 63 | }; |
62 | 64 | ||
63 | /* SPI devices */ | 65 | /* SPI devices */ |
@@ -76,6 +78,7 @@ static struct at91_mmc_data __initdata flexibity_mmc_data = { | |||
76 | .wire4 = 1, | 78 | .wire4 = 1, |
77 | .det_pin = AT91_PIN_PC9, | 79 | .det_pin = AT91_PIN_PC9, |
78 | .wp_pin = AT91_PIN_PC4, | 80 | .wp_pin = AT91_PIN_PC4, |
81 | .vcc_pin = -EINVAL, | ||
79 | }; | 82 | }; |
80 | 83 | ||
81 | /* LEDs */ | 84 | /* LEDs */ |
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c index f27d1a780cfa..caf017f0f4ee 100644 --- a/arch/arm/mach-at91/board-foxg20.c +++ b/arch/arm/mach-at91/board-foxg20.c | |||
@@ -106,6 +106,8 @@ static void __init foxg20_init_early(void) | |||
106 | */ | 106 | */ |
107 | static struct at91_usbh_data __initdata foxg20_usbh_data = { | 107 | static struct at91_usbh_data __initdata foxg20_usbh_data = { |
108 | .ports = 2, | 108 | .ports = 2, |
109 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
110 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
109 | }; | 111 | }; |
110 | 112 | ||
111 | /* | 113 | /* |
@@ -113,7 +115,7 @@ static struct at91_usbh_data __initdata foxg20_usbh_data = { | |||
113 | */ | 115 | */ |
114 | static struct at91_udc_data __initdata foxg20_udc_data = { | 116 | static struct at91_udc_data __initdata foxg20_udc_data = { |
115 | .vbus_pin = AT91_PIN_PC6, | 117 | .vbus_pin = AT91_PIN_PC6, |
116 | .pullup_pin = 0, /* pull-up driven by UDC */ | 118 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
117 | }; | 119 | }; |
118 | 120 | ||
119 | 121 | ||
@@ -135,7 +137,7 @@ static struct spi_board_info foxg20_spi_devices[] = { | |||
135 | /* | 137 | /* |
136 | * MACB Ethernet device | 138 | * MACB Ethernet device |
137 | */ | 139 | */ |
138 | static struct at91_eth_data __initdata foxg20_macb_data = { | 140 | static struct macb_platform_data __initdata foxg20_macb_data = { |
139 | .phy_irq_pin = AT91_PIN_PA7, | 141 | .phy_irq_pin = AT91_PIN_PA7, |
140 | .is_rmii = 1, | 142 | .is_rmii = 1, |
141 | }; | 143 | }; |
@@ -147,6 +149,9 @@ static struct at91_eth_data __initdata foxg20_macb_data = { | |||
147 | static struct at91_mmc_data __initdata foxg20_mmc_data = { | 149 | static struct at91_mmc_data __initdata foxg20_mmc_data = { |
148 | .slot_b = 1, | 150 | .slot_b = 1, |
149 | .wire4 = 1, | 151 | .wire4 = 1, |
152 | .det_pin = -EINVAL, | ||
153 | .wp_pin = -EINVAL, | ||
154 | .vcc_pin = -EINVAL, | ||
150 | }; | 155 | }; |
151 | 156 | ||
152 | 157 | ||
diff --git a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c index 2e95949737e6..230e71969fb7 100644 --- a/arch/arm/mach-at91/board-gsia18s.c +++ b/arch/arm/mach-at91/board-gsia18s.c | |||
@@ -80,6 +80,8 @@ static void __init gsia18s_init_early(void) | |||
80 | */ | 80 | */ |
81 | static struct at91_usbh_data __initdata usbh_data = { | 81 | static struct at91_usbh_data __initdata usbh_data = { |
82 | .ports = 2, | 82 | .ports = 2, |
83 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
84 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
83 | }; | 85 | }; |
84 | 86 | ||
85 | /* | 87 | /* |
@@ -87,13 +89,13 @@ static struct at91_usbh_data __initdata usbh_data = { | |||
87 | */ | 89 | */ |
88 | static struct at91_udc_data __initdata udc_data = { | 90 | static struct at91_udc_data __initdata udc_data = { |
89 | .vbus_pin = AT91_PIN_PA22, | 91 | .vbus_pin = AT91_PIN_PA22, |
90 | .pullup_pin = 0, /* pull-up driven by UDC */ | 92 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
91 | }; | 93 | }; |
92 | 94 | ||
93 | /* | 95 | /* |
94 | * MACB Ethernet device | 96 | * MACB Ethernet device |
95 | */ | 97 | */ |
96 | static struct at91_eth_data __initdata macb_data = { | 98 | static struct macb_platform_data __initdata macb_data = { |
97 | .phy_irq_pin = AT91_PIN_PA28, | 99 | .phy_irq_pin = AT91_PIN_PA28, |
98 | .is_rmii = 1, | 100 | .is_rmii = 1, |
99 | }; | 101 | }; |
@@ -530,6 +532,7 @@ static struct i2c_board_info __initdata gsia18s_i2c_devices[] = { | |||
530 | static struct at91_cf_data __initdata gsia18s_cf1_data = { | 532 | static struct at91_cf_data __initdata gsia18s_cf1_data = { |
531 | .irq_pin = AT91_PIN_PA27, | 533 | .irq_pin = AT91_PIN_PA27, |
532 | .det_pin = AT91_PIN_PB30, | 534 | .det_pin = AT91_PIN_PB30, |
535 | .vcc_pin = -EINVAL, | ||
533 | .rst_pin = AT91_PIN_PB31, | 536 | .rst_pin = AT91_PIN_PB31, |
534 | .chipselect = 5, | 537 | .chipselect = 5, |
535 | .flags = AT91_CF_TRUE_IDE, | 538 | .flags = AT91_CF_TRUE_IDE, |
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c index 3bae73e63633..efde1b2327c8 100644 --- a/arch/arm/mach-at91/board-kafa.c +++ b/arch/arm/mach-at91/board-kafa.c | |||
@@ -61,13 +61,15 @@ static void __init kafa_init_early(void) | |||
61 | at91_set_serial_console(0); | 61 | at91_set_serial_console(0); |
62 | } | 62 | } |
63 | 63 | ||
64 | static struct at91_eth_data __initdata kafa_eth_data = { | 64 | static struct macb_platform_data __initdata kafa_eth_data = { |
65 | .phy_irq_pin = AT91_PIN_PC4, | 65 | .phy_irq_pin = AT91_PIN_PC4, |
66 | .is_rmii = 0, | 66 | .is_rmii = 0, |
67 | }; | 67 | }; |
68 | 68 | ||
69 | static struct at91_usbh_data __initdata kafa_usbh_data = { | 69 | static struct at91_usbh_data __initdata kafa_usbh_data = { |
70 | .ports = 1, | 70 | .ports = 1, |
71 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
72 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
71 | }; | 73 | }; |
72 | 74 | ||
73 | static struct at91_udc_data __initdata kafa_udc_data = { | 75 | static struct at91_udc_data __initdata kafa_udc_data = { |
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c index e61351ffad50..d75a4a2ad9c2 100644 --- a/arch/arm/mach-at91/board-kb9202.c +++ b/arch/arm/mach-at91/board-kb9202.c | |||
@@ -69,13 +69,15 @@ static void __init kb9202_init_early(void) | |||
69 | at91_set_serial_console(0); | 69 | at91_set_serial_console(0); |
70 | } | 70 | } |
71 | 71 | ||
72 | static struct at91_eth_data __initdata kb9202_eth_data = { | 72 | static struct macb_platform_data __initdata kb9202_eth_data = { |
73 | .phy_irq_pin = AT91_PIN_PB29, | 73 | .phy_irq_pin = AT91_PIN_PB29, |
74 | .is_rmii = 0, | 74 | .is_rmii = 0, |
75 | }; | 75 | }; |
76 | 76 | ||
77 | static struct at91_usbh_data __initdata kb9202_usbh_data = { | 77 | static struct at91_usbh_data __initdata kb9202_usbh_data = { |
78 | .ports = 1, | 78 | .ports = 1, |
79 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
80 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
79 | }; | 81 | }; |
80 | 82 | ||
81 | static struct at91_udc_data __initdata kb9202_udc_data = { | 83 | static struct at91_udc_data __initdata kb9202_udc_data = { |
@@ -87,6 +89,8 @@ static struct at91_mmc_data __initdata kb9202_mmc_data = { | |||
87 | .det_pin = AT91_PIN_PB2, | 89 | .det_pin = AT91_PIN_PB2, |
88 | .slot_b = 0, | 90 | .slot_b = 0, |
89 | .wire4 = 1, | 91 | .wire4 = 1, |
92 | .wp_pin = -EINVAL, | ||
93 | .vcc_pin = -EINVAL, | ||
90 | }; | 94 | }; |
91 | 95 | ||
92 | static struct mtd_partition __initdata kb9202_nand_partition[] = { | 96 | static struct mtd_partition __initdata kb9202_nand_partition[] = { |
@@ -100,7 +104,7 @@ static struct mtd_partition __initdata kb9202_nand_partition[] = { | |||
100 | static struct atmel_nand_data __initdata kb9202_nand_data = { | 104 | static struct atmel_nand_data __initdata kb9202_nand_data = { |
101 | .ale = 22, | 105 | .ale = 22, |
102 | .cle = 21, | 106 | .cle = 21, |
103 | // .det_pin = ... not there | 107 | .det_pin = -EINVAL, |
104 | .rdy_pin = AT91_PIN_PC29, | 108 | .rdy_pin = AT91_PIN_PC29, |
105 | .enable_pin = AT91_PIN_PC28, | 109 | .enable_pin = AT91_PIN_PC28, |
106 | .parts = kb9202_nand_partition, | 110 | .parts = kb9202_nand_partition, |
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c index ef816c17dc61..3f8617c0e04e 100644 --- a/arch/arm/mach-at91/board-neocore926.c +++ b/arch/arm/mach-at91/board-neocore926.c | |||
@@ -72,6 +72,7 @@ static void __init neocore926_init_early(void) | |||
72 | static struct at91_usbh_data __initdata neocore926_usbh_data = { | 72 | static struct at91_usbh_data __initdata neocore926_usbh_data = { |
73 | .ports = 2, | 73 | .ports = 2, |
74 | .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 }, | 74 | .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 }, |
75 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
75 | }; | 76 | }; |
76 | 77 | ||
77 | /* | 78 | /* |
@@ -79,7 +80,7 @@ static struct at91_usbh_data __initdata neocore926_usbh_data = { | |||
79 | */ | 80 | */ |
80 | static struct at91_udc_data __initdata neocore926_udc_data = { | 81 | static struct at91_udc_data __initdata neocore926_udc_data = { |
81 | .vbus_pin = AT91_PIN_PA25, | 82 | .vbus_pin = AT91_PIN_PA25, |
82 | .pullup_pin = 0, /* pull-up driven by UDC */ | 83 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
83 | }; | 84 | }; |
84 | 85 | ||
85 | 86 | ||
@@ -149,13 +150,14 @@ static struct at91_mmc_data __initdata neocore926_mmc_data = { | |||
149 | .wire4 = 1, | 150 | .wire4 = 1, |
150 | .det_pin = AT91_PIN_PE18, | 151 | .det_pin = AT91_PIN_PE18, |
151 | .wp_pin = AT91_PIN_PE19, | 152 | .wp_pin = AT91_PIN_PE19, |
153 | .vcc_pin = -EINVAL, | ||
152 | }; | 154 | }; |
153 | 155 | ||
154 | 156 | ||
155 | /* | 157 | /* |
156 | * MACB Ethernet device | 158 | * MACB Ethernet device |
157 | */ | 159 | */ |
158 | static struct at91_eth_data __initdata neocore926_macb_data = { | 160 | static struct macb_platform_data __initdata neocore926_macb_data = { |
159 | .phy_irq_pin = AT91_PIN_PE31, | 161 | .phy_irq_pin = AT91_PIN_PE31, |
160 | .is_rmii = 1, | 162 | .is_rmii = 1, |
161 | }; | 163 | }; |
@@ -190,6 +192,7 @@ static struct atmel_nand_data __initdata neocore926_nand_data = { | |||
190 | .enable_pin = AT91_PIN_PD15, | 192 | .enable_pin = AT91_PIN_PD15, |
191 | .parts = neocore926_nand_partition, | 193 | .parts = neocore926_nand_partition, |
192 | .num_parts = ARRAY_SIZE(neocore926_nand_partition), | 194 | .num_parts = ARRAY_SIZE(neocore926_nand_partition), |
195 | .det_pin = -EINVAL, | ||
193 | }; | 196 | }; |
194 | 197 | ||
195 | static struct sam9_smc_config __initdata neocore926_nand_smc_config = { | 198 | static struct sam9_smc_config __initdata neocore926_nand_smc_config = { |
@@ -213,7 +216,7 @@ static struct sam9_smc_config __initdata neocore926_nand_smc_config = { | |||
213 | static void __init neocore926_add_device_nand(void) | 216 | static void __init neocore926_add_device_nand(void) |
214 | { | 217 | { |
215 | /* configure chip-select 3 (NAND) */ | 218 | /* configure chip-select 3 (NAND) */ |
216 | sam9_smc_configure(3, &neocore926_nand_smc_config); | 219 | sam9_smc_configure(0, 3, &neocore926_nand_smc_config); |
217 | 220 | ||
218 | at91_add_device_nand(&neocore926_nand_data); | 221 | at91_add_device_nand(&neocore926_nand_data); |
219 | } | 222 | } |
diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c index 49e3f699b48e..b4a12fc184c8 100644 --- a/arch/arm/mach-at91/board-pcontrol-g20.c +++ b/arch/arm/mach-at91/board-pcontrol-g20.c | |||
@@ -96,9 +96,9 @@ static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { { | |||
96 | static void __init add_device_pcontrol(void) | 96 | static void __init add_device_pcontrol(void) |
97 | { | 97 | { |
98 | /* configure chip-select 4 (IO compatible to 8051 X4 ) */ | 98 | /* configure chip-select 4 (IO compatible to 8051 X4 ) */ |
99 | sam9_smc_configure(4, &pcontrol_smc_config[0]); | 99 | sam9_smc_configure(0, 4, &pcontrol_smc_config[0]); |
100 | /* configure chip-select 7 (FerroRAM 256KiBx16bit MR2A16A D4 ) */ | 100 | /* configure chip-select 7 (FerroRAM 256KiBx16bit MR2A16A D4 ) */ |
101 | sam9_smc_configure(7, &pcontrol_smc_config[1]); | 101 | sam9_smc_configure(0, 7, &pcontrol_smc_config[1]); |
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
@@ -107,6 +107,8 @@ static void __init add_device_pcontrol(void) | |||
107 | */ | 107 | */ |
108 | static struct at91_usbh_data __initdata usbh_data = { | 108 | static struct at91_usbh_data __initdata usbh_data = { |
109 | .ports = 2, | 109 | .ports = 2, |
110 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
111 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
110 | }; | 112 | }; |
111 | 113 | ||
112 | 114 | ||
@@ -122,7 +124,7 @@ static struct at91_udc_data __initdata pcontrol_g20_udc_data = { | |||
122 | /* | 124 | /* |
123 | * MACB Ethernet device | 125 | * MACB Ethernet device |
124 | */ | 126 | */ |
125 | static struct at91_eth_data __initdata macb_data = { | 127 | static struct macb_platform_data __initdata macb_data = { |
126 | .phy_irq_pin = AT91_PIN_PA28, | 128 | .phy_irq_pin = AT91_PIN_PA28, |
127 | .is_rmii = 1, | 129 | .is_rmii = 1, |
128 | }; | 130 | }; |
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c index 0a8fe6a1b7c8..ab024fa11d5c 100644 --- a/arch/arm/mach-at91/board-picotux200.c +++ b/arch/arm/mach-at91/board-picotux200.c | |||
@@ -60,13 +60,15 @@ static void __init picotux200_init_early(void) | |||
60 | at91_set_serial_console(0); | 60 | at91_set_serial_console(0); |
61 | } | 61 | } |
62 | 62 | ||
63 | static struct at91_eth_data __initdata picotux200_eth_data = { | 63 | static struct macb_platform_data __initdata picotux200_eth_data = { |
64 | .phy_irq_pin = AT91_PIN_PC4, | 64 | .phy_irq_pin = AT91_PIN_PC4, |
65 | .is_rmii = 1, | 65 | .is_rmii = 1, |
66 | }; | 66 | }; |
67 | 67 | ||
68 | static struct at91_usbh_data __initdata picotux200_usbh_data = { | 68 | static struct at91_usbh_data __initdata picotux200_usbh_data = { |
69 | .ports = 1, | 69 | .ports = 1, |
70 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
71 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
70 | }; | 72 | }; |
71 | 73 | ||
72 | static struct at91_mmc_data __initdata picotux200_mmc_data = { | 74 | static struct at91_mmc_data __initdata picotux200_mmc_data = { |
@@ -74,6 +76,7 @@ static struct at91_mmc_data __initdata picotux200_mmc_data = { | |||
74 | .slot_b = 0, | 76 | .slot_b = 0, |
75 | .wire4 = 1, | 77 | .wire4 = 1, |
76 | .wp_pin = AT91_PIN_PA17, | 78 | .wp_pin = AT91_PIN_PA17, |
79 | .vcc_pin = -EINVAL, | ||
77 | }; | 80 | }; |
78 | 81 | ||
79 | #define PICOTUX200_FLASH_BASE AT91_CHIPSELECT_0 | 82 | #define PICOTUX200_FLASH_BASE AT91_CHIPSELECT_0 |
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c index 07421bdb88ea..e029d220cb84 100644 --- a/arch/arm/mach-at91/board-qil-a9260.c +++ b/arch/arm/mach-at91/board-qil-a9260.c | |||
@@ -77,6 +77,8 @@ static void __init ek_init_early(void) | |||
77 | */ | 77 | */ |
78 | static struct at91_usbh_data __initdata ek_usbh_data = { | 78 | static struct at91_usbh_data __initdata ek_usbh_data = { |
79 | .ports = 2, | 79 | .ports = 2, |
80 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
81 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
80 | }; | 82 | }; |
81 | 83 | ||
82 | /* | 84 | /* |
@@ -84,7 +86,7 @@ static struct at91_usbh_data __initdata ek_usbh_data = { | |||
84 | */ | 86 | */ |
85 | static struct at91_udc_data __initdata ek_udc_data = { | 87 | static struct at91_udc_data __initdata ek_udc_data = { |
86 | .vbus_pin = AT91_PIN_PC5, | 88 | .vbus_pin = AT91_PIN_PC5, |
87 | .pullup_pin = 0, /* pull-up driven by UDC */ | 89 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
88 | }; | 90 | }; |
89 | 91 | ||
90 | /* | 92 | /* |
@@ -104,7 +106,7 @@ static struct spi_board_info ek_spi_devices[] = { | |||
104 | /* | 106 | /* |
105 | * MACB Ethernet device | 107 | * MACB Ethernet device |
106 | */ | 108 | */ |
107 | static struct at91_eth_data __initdata ek_macb_data = { | 109 | static struct macb_platform_data __initdata ek_macb_data = { |
108 | .phy_irq_pin = AT91_PIN_PA31, | 110 | .phy_irq_pin = AT91_PIN_PA31, |
109 | .is_rmii = 1, | 111 | .is_rmii = 1, |
110 | }; | 112 | }; |
@@ -133,7 +135,7 @@ static struct mtd_partition __initdata ek_nand_partition[] = { | |||
133 | static struct atmel_nand_data __initdata ek_nand_data = { | 135 | static struct atmel_nand_data __initdata ek_nand_data = { |
134 | .ale = 21, | 136 | .ale = 21, |
135 | .cle = 22, | 137 | .cle = 22, |
136 | // .det_pin = ... not connected | 138 | .det_pin = -EINVAL, |
137 | .rdy_pin = AT91_PIN_PC13, | 139 | .rdy_pin = AT91_PIN_PC13, |
138 | .enable_pin = AT91_PIN_PC14, | 140 | .enable_pin = AT91_PIN_PC14, |
139 | .parts = ek_nand_partition, | 141 | .parts = ek_nand_partition, |
@@ -161,7 +163,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = { | |||
161 | static void __init ek_add_device_nand(void) | 163 | static void __init ek_add_device_nand(void) |
162 | { | 164 | { |
163 | /* configure chip-select 3 (NAND) */ | 165 | /* configure chip-select 3 (NAND) */ |
164 | sam9_smc_configure(3, &ek_nand_smc_config); | 166 | sam9_smc_configure(0, 3, &ek_nand_smc_config); |
165 | 167 | ||
166 | at91_add_device_nand(&ek_nand_data); | 168 | at91_add_device_nand(&ek_nand_data); |
167 | } | 169 | } |
@@ -172,9 +174,9 @@ static void __init ek_add_device_nand(void) | |||
172 | static struct at91_mmc_data __initdata ek_mmc_data = { | 174 | static struct at91_mmc_data __initdata ek_mmc_data = { |
173 | .slot_b = 0, | 175 | .slot_b = 0, |
174 | .wire4 = 1, | 176 | .wire4 = 1, |
175 | // .det_pin = ... not connected | 177 | .det_pin = -EINVAL, |
176 | // .wp_pin = ... not connected | 178 | .wp_pin = -EINVAL, |
177 | // .vcc_pin = ... not connected | 179 | .vcc_pin = -EINVAL, |
178 | }; | 180 | }; |
179 | 181 | ||
180 | /* | 182 | /* |
@@ -251,7 +253,7 @@ static void __init ek_board_init(void) | |||
251 | /* LEDs */ | 253 | /* LEDs */ |
252 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); | 254 | at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds)); |
253 | /* shutdown controller, wakeup button (5 msec low) */ | 255 | /* shutdown controller, wakeup button (5 msec low) */ |
254 | at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW | 256 | at91_shdwc_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | AT91_SHDW_WKMODE0_LOW |
255 | | AT91_SHDW_RTTWKEN); | 257 | | AT91_SHDW_RTTWKEN); |
256 | } | 258 | } |
257 | 259 | ||
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c index 80a8c9c6e922..782f37946af5 100644 --- a/arch/arm/mach-at91/board-rm9200dk.c +++ b/arch/arm/mach-at91/board-rm9200dk.c | |||
@@ -65,13 +65,15 @@ static void __init dk_init_early(void) | |||
65 | at91_set_serial_console(0); | 65 | at91_set_serial_console(0); |
66 | } | 66 | } |
67 | 67 | ||
68 | static struct at91_eth_data __initdata dk_eth_data = { | 68 | static struct macb_platform_data __initdata dk_eth_data = { |
69 | .phy_irq_pin = AT91_PIN_PC4, | 69 | .phy_irq_pin = AT91_PIN_PC4, |
70 | .is_rmii = 1, | 70 | .is_rmii = 1, |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static struct at91_usbh_data __initdata dk_usbh_data = { | 73 | static struct at91_usbh_data __initdata dk_usbh_data = { |
74 | .ports = 2, | 74 | .ports = 2, |
75 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
76 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
75 | }; | 77 | }; |
76 | 78 | ||
77 | static struct at91_udc_data __initdata dk_udc_data = { | 79 | static struct at91_udc_data __initdata dk_udc_data = { |
@@ -80,16 +82,19 @@ static struct at91_udc_data __initdata dk_udc_data = { | |||
80 | }; | 82 | }; |
81 | 83 | ||
82 | static struct at91_cf_data __initdata dk_cf_data = { | 84 | static struct at91_cf_data __initdata dk_cf_data = { |
85 | .irq_pin = -EINVAL, | ||
83 | .det_pin = AT91_PIN_PB0, | 86 | .det_pin = AT91_PIN_PB0, |
87 | .vcc_pin = -EINVAL, | ||
84 | .rst_pin = AT91_PIN_PC5, | 88 | .rst_pin = AT91_PIN_PC5, |
85 | // .irq_pin = ... not connected | ||
86 | // .vcc_pin = ... always powered | ||
87 | }; | 89 | }; |
88 | 90 | ||
89 | #ifndef CONFIG_MTD_AT91_DATAFLASH_CARD | 91 | #ifndef CONFIG_MTD_AT91_DATAFLASH_CARD |
90 | static struct at91_mmc_data __initdata dk_mmc_data = { | 92 | static struct at91_mmc_data __initdata dk_mmc_data = { |
91 | .slot_b = 0, | 93 | .slot_b = 0, |
92 | .wire4 = 1, | 94 | .wire4 = 1, |
95 | .det_pin = -EINVAL, | ||
96 | .wp_pin = -EINVAL, | ||
97 | .vcc_pin = -EINVAL, | ||
93 | }; | 98 | }; |
94 | #endif | 99 | #endif |
95 | 100 | ||
@@ -143,7 +148,7 @@ static struct atmel_nand_data __initdata dk_nand_data = { | |||
143 | .cle = 21, | 148 | .cle = 21, |
144 | .det_pin = AT91_PIN_PB1, | 149 | .det_pin = AT91_PIN_PB1, |
145 | .rdy_pin = AT91_PIN_PC2, | 150 | .rdy_pin = AT91_PIN_PC2, |
146 | // .enable_pin = ... not there | 151 | .enable_pin = -EINVAL, |
147 | .parts = dk_nand_partition, | 152 | .parts = dk_nand_partition, |
148 | .num_parts = ARRAY_SIZE(dk_nand_partition), | 153 | .num_parts = ARRAY_SIZE(dk_nand_partition), |
149 | }; | 154 | }; |
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c index 99fd7f8aee0e..ef7c12a92246 100644 --- a/arch/arm/mach-at91/board-rm9200ek.c +++ b/arch/arm/mach-at91/board-rm9200ek.c | |||
@@ -65,13 +65,15 @@ static void __init ek_init_early(void) | |||
65 | at91_set_serial_console(0); | 65 | at91_set_serial_console(0); |
66 | } | 66 | } |
67 | 67 | ||
68 | static struct at91_eth_data __initdata ek_eth_data = { | 68 | static struct macb_platform_data __initdata ek_eth_data = { |
69 | .phy_irq_pin = AT91_PIN_PC4, | 69 | .phy_irq_pin = AT91_PIN_PC4, |
70 | .is_rmii = 1, | 70 | .is_rmii = 1, |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static struct at91_usbh_data __initdata ek_usbh_data = { | 73 | static struct at91_usbh_data __initdata ek_usbh_data = { |
74 | .ports = 2, | 74 | .ports = 2, |
75 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
76 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
75 | }; | 77 | }; |
76 | 78 | ||
77 | static struct at91_udc_data __initdata ek_udc_data = { | 79 | static struct at91_udc_data __initdata ek_udc_data = { |
@@ -85,6 +87,7 @@ static struct at91_mmc_data __initdata ek_mmc_data = { | |||
85 | .slot_b = 0, | 87 | .slot_b = 0, |
86 | .wire4 = 1, | 88 | .wire4 = 1, |
87 | .wp_pin = AT91_PIN_PA17, | 89 | .wp_pin = AT91_PIN_PA17, |
90 | .vcc_pin = -EINVAL, | ||
88 | }; | 91 | }; |
89 | #endif | 92 | #endif |
90 | 93 | ||
diff --git a/arch/arm/mach-at91/board-rsi-ews.c b/arch/arm/mach-at91/board-rsi-ews.c index e927df0175df..af0750fafa29 100644 --- a/arch/arm/mach-at91/board-rsi-ews.c +++ b/arch/arm/mach-at91/board-rsi-ews.c | |||
@@ -60,7 +60,7 @@ static void __init rsi_ews_init_early(void) | |||
60 | /* | 60 | /* |
61 | * Ethernet | 61 | * Ethernet |
62 | */ | 62 | */ |
63 | static struct at91_eth_data rsi_ews_eth_data __initdata = { | 63 | static struct macb_platform_data rsi_ews_eth_data __initdata = { |
64 | .phy_irq_pin = AT91_PIN_PC4, | 64 | .phy_irq_pin = AT91_PIN_PC4, |
65 | .is_rmii = 1, | 65 | .is_rmii = 1, |
66 | }; | 66 | }; |
@@ -70,6 +70,8 @@ static struct at91_eth_data rsi_ews_eth_data __initdata = { | |||
70 | */ | 70 | */ |
71 | static struct at91_usbh_data rsi_ews_usbh_data __initdata = { | 71 | static struct at91_usbh_data rsi_ews_usbh_data __initdata = { |
72 | .ports = 1, | 72 | .ports = 1, |
73 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
74 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
73 | }; | 75 | }; |
74 | 76 | ||
75 | /* | 77 | /* |
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c index 072d53af98d9..84bce587735f 100644 --- a/arch/arm/mach-at91/board-sam9-l9260.c +++ b/arch/arm/mach-at91/board-sam9-l9260.c | |||
@@ -72,6 +72,8 @@ static void __init ek_init_early(void) | |||
72 | */ | 72 | */ |
73 | static struct at91_usbh_data __initdata ek_usbh_data = { | 73 | static struct at91_usbh_data __initdata ek_usbh_data = { |
74 | .ports = 2, | 74 | .ports = 2, |
75 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
76 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
75 | }; | 77 | }; |
76 | 78 | ||
77 | /* | 79 | /* |
@@ -79,7 +81,7 @@ static struct at91_usbh_data __initdata ek_usbh_data = { | |||
79 | */ | 81 | */ |
80 | static struct at91_udc_data __initdata ek_udc_data = { | 82 | static struct at91_udc_data __initdata ek_udc_data = { |
81 | .vbus_pin = AT91_PIN_PC5, | 83 | .vbus_pin = AT91_PIN_PC5, |
82 | .pullup_pin = 0, /* pull-up driven by UDC */ | 84 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
83 | }; | 85 | }; |
84 | 86 | ||
85 | 87 | ||
@@ -109,7 +111,7 @@ static struct spi_board_info ek_spi_devices[] = { | |||
109 | /* | 111 | /* |
110 | * MACB Ethernet device | 112 | * MACB Ethernet device |
111 | */ | 113 | */ |
112 | static struct at91_eth_data __initdata ek_macb_data = { | 114 | static struct macb_platform_data __initdata ek_macb_data = { |
113 | .phy_irq_pin = AT91_PIN_PA7, | 115 | .phy_irq_pin = AT91_PIN_PA7, |
114 | .is_rmii = 0, | 116 | .is_rmii = 0, |
115 | }; | 117 | }; |
@@ -134,7 +136,7 @@ static struct mtd_partition __initdata ek_nand_partition[] = { | |||
134 | static struct atmel_nand_data __initdata ek_nand_data = { | 136 | static struct atmel_nand_data __initdata ek_nand_data = { |
135 | .ale = 21, | 137 | .ale = 21, |
136 | .cle = 22, | 138 | .cle = 22, |
137 | // .det_pin = ... not connected | 139 | .det_pin = -EINVAL, |
138 | .rdy_pin = AT91_PIN_PC13, | 140 | .rdy_pin = AT91_PIN_PC13, |
139 | .enable_pin = AT91_PIN_PC14, | 141 | .enable_pin = AT91_PIN_PC14, |
140 | .parts = ek_nand_partition, | 142 | .parts = ek_nand_partition, |
@@ -162,7 +164,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = { | |||
162 | static void __init ek_add_device_nand(void) | 164 | static void __init ek_add_device_nand(void) |
163 | { | 165 | { |
164 | /* configure chip-select 3 (NAND) */ | 166 | /* configure chip-select 3 (NAND) */ |
165 | sam9_smc_configure(3, &ek_nand_smc_config); | 167 | sam9_smc_configure(0, 3, &ek_nand_smc_config); |
166 | 168 | ||
167 | at91_add_device_nand(&ek_nand_data); | 169 | at91_add_device_nand(&ek_nand_data); |
168 | } | 170 | } |
@@ -176,7 +178,7 @@ static struct at91_mmc_data __initdata ek_mmc_data = { | |||
176 | .wire4 = 1, | 178 | .wire4 = 1, |
177 | .det_pin = AT91_PIN_PC8, | 179 | .det_pin = AT91_PIN_PC8, |
178 | .wp_pin = AT91_PIN_PC4, | 180 | .wp_pin = AT91_PIN_PC4, |
179 | // .vcc_pin = ... not connected | 181 | .vcc_pin = -EINVAL, |
180 | }; | 182 | }; |
181 | 183 | ||
182 | static void __init ek_board_init(void) | 184 | static void __init ek_board_init(void) |
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c index 4f10181a0782..be8233bcabdc 100644 --- a/arch/arm/mach-at91/board-sam9260ek.c +++ b/arch/arm/mach-at91/board-sam9260ek.c | |||
@@ -75,6 +75,8 @@ static void __init ek_init_early(void) | |||
75 | */ | 75 | */ |
76 | static struct at91_usbh_data __initdata ek_usbh_data = { | 76 | static struct at91_usbh_data __initdata ek_usbh_data = { |
77 | .ports = 2, | 77 | .ports = 2, |
78 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
79 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
78 | }; | 80 | }; |
79 | 81 | ||
80 | /* | 82 | /* |
@@ -82,7 +84,7 @@ static struct at91_usbh_data __initdata ek_usbh_data = { | |||
82 | */ | 84 | */ |
83 | static struct at91_udc_data __initdata ek_udc_data = { | 85 | static struct at91_udc_data __initdata ek_udc_data = { |
84 | .vbus_pin = AT91_PIN_PC5, | 86 | .vbus_pin = AT91_PIN_PC5, |
85 | .pullup_pin = 0, /* pull-up driven by UDC */ | 87 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
86 | }; | 88 | }; |
87 | 89 | ||
88 | 90 | ||
@@ -151,7 +153,7 @@ static struct spi_board_info ek_spi_devices[] = { | |||
151 | /* | 153 | /* |
152 | * MACB Ethernet device | 154 | * MACB Ethernet device |
153 | */ | 155 | */ |
154 | static struct at91_eth_data __initdata ek_macb_data = { | 156 | static struct macb_platform_data __initdata ek_macb_data = { |
155 | .phy_irq_pin = AT91_PIN_PA7, | 157 | .phy_irq_pin = AT91_PIN_PA7, |
156 | .is_rmii = 1, | 158 | .is_rmii = 1, |
157 | }; | 159 | }; |
@@ -176,7 +178,7 @@ static struct mtd_partition __initdata ek_nand_partition[] = { | |||
176 | static struct atmel_nand_data __initdata ek_nand_data = { | 178 | static struct atmel_nand_data __initdata ek_nand_data = { |
177 | .ale = 21, | 179 | .ale = 21, |
178 | .cle = 22, | 180 | .cle = 22, |
179 | // .det_pin = ... not connected | 181 | .det_pin = -EINVAL, |
180 | .rdy_pin = AT91_PIN_PC13, | 182 | .rdy_pin = AT91_PIN_PC13, |
181 | .enable_pin = AT91_PIN_PC14, | 183 | .enable_pin = AT91_PIN_PC14, |
182 | .parts = ek_nand_partition, | 184 | .parts = ek_nand_partition, |
@@ -211,7 +213,7 @@ static void __init ek_add_device_nand(void) | |||
211 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; | 213 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; |
212 | 214 | ||
213 | /* configure chip-select 3 (NAND) */ | 215 | /* configure chip-select 3 (NAND) */ |
214 | sam9_smc_configure(3, &ek_nand_smc_config); | 216 | sam9_smc_configure(0, 3, &ek_nand_smc_config); |
215 | 217 | ||
216 | at91_add_device_nand(&ek_nand_data); | 218 | at91_add_device_nand(&ek_nand_data); |
217 | } | 219 | } |
@@ -223,9 +225,9 @@ static void __init ek_add_device_nand(void) | |||
223 | static struct at91_mmc_data __initdata ek_mmc_data = { | 225 | static struct at91_mmc_data __initdata ek_mmc_data = { |
224 | .slot_b = 1, | 226 | .slot_b = 1, |
225 | .wire4 = 1, | 227 | .wire4 = 1, |
226 | // .det_pin = ... not connected | 228 | .det_pin = -EINVAL, |
227 | // .wp_pin = ... not connected | 229 | .wp_pin = -EINVAL, |
228 | // .vcc_pin = ... not connected | 230 | .vcc_pin = -EINVAL, |
229 | }; | 231 | }; |
230 | 232 | ||
231 | 233 | ||
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c index b005b738e8ff..40895072a1a7 100644 --- a/arch/arm/mach-at91/board-sam9261ek.c +++ b/arch/arm/mach-at91/board-sam9261ek.c | |||
@@ -131,7 +131,7 @@ static struct sam9_smc_config __initdata dm9000_smc_config = { | |||
131 | static void __init ek_add_device_dm9000(void) | 131 | static void __init ek_add_device_dm9000(void) |
132 | { | 132 | { |
133 | /* Configure chip-select 2 (DM9000) */ | 133 | /* Configure chip-select 2 (DM9000) */ |
134 | sam9_smc_configure(2, &dm9000_smc_config); | 134 | sam9_smc_configure(0, 2, &dm9000_smc_config); |
135 | 135 | ||
136 | /* Configure Reset signal as output */ | 136 | /* Configure Reset signal as output */ |
137 | at91_set_gpio_output(AT91_PIN_PC10, 0); | 137 | at91_set_gpio_output(AT91_PIN_PC10, 0); |
@@ -151,6 +151,8 @@ static void __init ek_add_device_dm9000(void) {} | |||
151 | */ | 151 | */ |
152 | static struct at91_usbh_data __initdata ek_usbh_data = { | 152 | static struct at91_usbh_data __initdata ek_usbh_data = { |
153 | .ports = 2, | 153 | .ports = 2, |
154 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
155 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
154 | }; | 156 | }; |
155 | 157 | ||
156 | 158 | ||
@@ -159,7 +161,7 @@ static struct at91_usbh_data __initdata ek_usbh_data = { | |||
159 | */ | 161 | */ |
160 | static struct at91_udc_data __initdata ek_udc_data = { | 162 | static struct at91_udc_data __initdata ek_udc_data = { |
161 | .vbus_pin = AT91_PIN_PB29, | 163 | .vbus_pin = AT91_PIN_PB29, |
162 | .pullup_pin = 0, /* pull-up driven by UDC */ | 164 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
163 | }; | 165 | }; |
164 | 166 | ||
165 | 167 | ||
@@ -182,7 +184,7 @@ static struct mtd_partition __initdata ek_nand_partition[] = { | |||
182 | static struct atmel_nand_data __initdata ek_nand_data = { | 184 | static struct atmel_nand_data __initdata ek_nand_data = { |
183 | .ale = 22, | 185 | .ale = 22, |
184 | .cle = 21, | 186 | .cle = 21, |
185 | // .det_pin = ... not connected | 187 | .det_pin = -EINVAL, |
186 | .rdy_pin = AT91_PIN_PC15, | 188 | .rdy_pin = AT91_PIN_PC15, |
187 | .enable_pin = AT91_PIN_PC14, | 189 | .enable_pin = AT91_PIN_PC14, |
188 | .parts = ek_nand_partition, | 190 | .parts = ek_nand_partition, |
@@ -217,7 +219,7 @@ static void __init ek_add_device_nand(void) | |||
217 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; | 219 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; |
218 | 220 | ||
219 | /* configure chip-select 3 (NAND) */ | 221 | /* configure chip-select 3 (NAND) */ |
220 | sam9_smc_configure(3, &ek_nand_smc_config); | 222 | sam9_smc_configure(0, 3, &ek_nand_smc_config); |
221 | 223 | ||
222 | at91_add_device_nand(&ek_nand_data); | 224 | at91_add_device_nand(&ek_nand_data); |
223 | } | 225 | } |
@@ -345,6 +347,9 @@ static struct spi_board_info ek_spi_devices[] = { | |||
345 | */ | 347 | */ |
346 | static struct at91_mmc_data __initdata ek_mmc_data = { | 348 | static struct at91_mmc_data __initdata ek_mmc_data = { |
347 | .wire4 = 1, | 349 | .wire4 = 1, |
350 | .det_pin = -EINVAL, | ||
351 | .wp_pin = -EINVAL, | ||
352 | .vcc_pin = -EINVAL, | ||
348 | }; | 353 | }; |
349 | 354 | ||
350 | #endif /* CONFIG_SPI_ATMEL_* */ | 355 | #endif /* CONFIG_SPI_ATMEL_* */ |
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c index bccdcf23caa1..29f66052fe63 100644 --- a/arch/arm/mach-at91/board-sam9263ek.c +++ b/arch/arm/mach-at91/board-sam9263ek.c | |||
@@ -74,6 +74,7 @@ static void __init ek_init_early(void) | |||
74 | static struct at91_usbh_data __initdata ek_usbh_data = { | 74 | static struct at91_usbh_data __initdata ek_usbh_data = { |
75 | .ports = 2, | 75 | .ports = 2, |
76 | .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 }, | 76 | .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 }, |
77 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
77 | }; | 78 | }; |
78 | 79 | ||
79 | /* | 80 | /* |
@@ -81,7 +82,7 @@ static struct at91_usbh_data __initdata ek_usbh_data = { | |||
81 | */ | 82 | */ |
82 | static struct at91_udc_data __initdata ek_udc_data = { | 83 | static struct at91_udc_data __initdata ek_udc_data = { |
83 | .vbus_pin = AT91_PIN_PA25, | 84 | .vbus_pin = AT91_PIN_PA25, |
84 | .pullup_pin = 0, /* pull-up driven by UDC */ | 85 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
85 | }; | 86 | }; |
86 | 87 | ||
87 | 88 | ||
@@ -151,14 +152,14 @@ static struct at91_mmc_data __initdata ek_mmc_data = { | |||
151 | .wire4 = 1, | 152 | .wire4 = 1, |
152 | .det_pin = AT91_PIN_PE18, | 153 | .det_pin = AT91_PIN_PE18, |
153 | .wp_pin = AT91_PIN_PE19, | 154 | .wp_pin = AT91_PIN_PE19, |
154 | // .vcc_pin = ... not connected | 155 | .vcc_pin = -EINVAL, |
155 | }; | 156 | }; |
156 | 157 | ||
157 | 158 | ||
158 | /* | 159 | /* |
159 | * MACB Ethernet device | 160 | * MACB Ethernet device |
160 | */ | 161 | */ |
161 | static struct at91_eth_data __initdata ek_macb_data = { | 162 | static struct macb_platform_data __initdata ek_macb_data = { |
162 | .phy_irq_pin = AT91_PIN_PE31, | 163 | .phy_irq_pin = AT91_PIN_PE31, |
163 | .is_rmii = 1, | 164 | .is_rmii = 1, |
164 | }; | 165 | }; |
@@ -183,7 +184,7 @@ static struct mtd_partition __initdata ek_nand_partition[] = { | |||
183 | static struct atmel_nand_data __initdata ek_nand_data = { | 184 | static struct atmel_nand_data __initdata ek_nand_data = { |
184 | .ale = 21, | 185 | .ale = 21, |
185 | .cle = 22, | 186 | .cle = 22, |
186 | // .det_pin = ... not connected | 187 | .det_pin = -EINVAL, |
187 | .rdy_pin = AT91_PIN_PA22, | 188 | .rdy_pin = AT91_PIN_PA22, |
188 | .enable_pin = AT91_PIN_PD15, | 189 | .enable_pin = AT91_PIN_PD15, |
189 | .parts = ek_nand_partition, | 190 | .parts = ek_nand_partition, |
@@ -218,7 +219,7 @@ static void __init ek_add_device_nand(void) | |||
218 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; | 219 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; |
219 | 220 | ||
220 | /* configure chip-select 3 (NAND) */ | 221 | /* configure chip-select 3 (NAND) */ |
221 | sam9_smc_configure(3, &ek_nand_smc_config); | 222 | sam9_smc_configure(0, 3, &ek_nand_smc_config); |
222 | 223 | ||
223 | at91_add_device_nand(&ek_nand_data); | 224 | at91_add_device_nand(&ek_nand_data); |
224 | } | 225 | } |
@@ -353,6 +354,7 @@ static void __init ek_add_device_buttons(void) {} | |||
353 | * reset_pin is not connected: NRST | 354 | * reset_pin is not connected: NRST |
354 | */ | 355 | */ |
355 | static struct ac97c_platform_data ek_ac97_data = { | 356 | static struct ac97c_platform_data ek_ac97_data = { |
357 | .reset_pin = -EINVAL, | ||
356 | }; | 358 | }; |
357 | 359 | ||
358 | 360 | ||
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c index 64fc75c9d0ac..843d6286c6f4 100644 --- a/arch/arm/mach-at91/board-sam9g20ek.c +++ b/arch/arm/mach-at91/board-sam9g20ek.c | |||
@@ -86,6 +86,8 @@ static void __init ek_init_early(void) | |||
86 | */ | 86 | */ |
87 | static struct at91_usbh_data __initdata ek_usbh_data = { | 87 | static struct at91_usbh_data __initdata ek_usbh_data = { |
88 | .ports = 2, | 88 | .ports = 2, |
89 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
90 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
89 | }; | 91 | }; |
90 | 92 | ||
91 | /* | 93 | /* |
@@ -93,7 +95,7 @@ static struct at91_usbh_data __initdata ek_usbh_data = { | |||
93 | */ | 95 | */ |
94 | static struct at91_udc_data __initdata ek_udc_data = { | 96 | static struct at91_udc_data __initdata ek_udc_data = { |
95 | .vbus_pin = AT91_PIN_PC5, | 97 | .vbus_pin = AT91_PIN_PC5, |
96 | .pullup_pin = 0, /* pull-up driven by UDC */ | 98 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
97 | }; | 99 | }; |
98 | 100 | ||
99 | 101 | ||
@@ -123,7 +125,7 @@ static struct spi_board_info ek_spi_devices[] = { | |||
123 | /* | 125 | /* |
124 | * MACB Ethernet device | 126 | * MACB Ethernet device |
125 | */ | 127 | */ |
126 | static struct at91_eth_data __initdata ek_macb_data = { | 128 | static struct macb_platform_data __initdata ek_macb_data = { |
127 | .phy_irq_pin = AT91_PIN_PA7, | 129 | .phy_irq_pin = AT91_PIN_PA7, |
128 | .is_rmii = 1, | 130 | .is_rmii = 1, |
129 | }; | 131 | }; |
@@ -163,6 +165,7 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
163 | .cle = 22, | 165 | .cle = 22, |
164 | .rdy_pin = AT91_PIN_PC13, | 166 | .rdy_pin = AT91_PIN_PC13, |
165 | .enable_pin = AT91_PIN_PC14, | 167 | .enable_pin = AT91_PIN_PC14, |
168 | .det_pin = -EINVAL, | ||
166 | .parts = ek_nand_partition, | 169 | .parts = ek_nand_partition, |
167 | .num_parts = ARRAY_SIZE(ek_nand_partition), | 170 | .num_parts = ARRAY_SIZE(ek_nand_partition), |
168 | }; | 171 | }; |
@@ -195,7 +198,7 @@ static void __init ek_add_device_nand(void) | |||
195 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; | 198 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; |
196 | 199 | ||
197 | /* configure chip-select 3 (NAND) */ | 200 | /* configure chip-select 3 (NAND) */ |
198 | sam9_smc_configure(3, &ek_nand_smc_config); | 201 | sam9_smc_configure(0, 3, &ek_nand_smc_config); |
199 | 202 | ||
200 | at91_add_device_nand(&ek_nand_data); | 203 | at91_add_device_nand(&ek_nand_data); |
201 | } | 204 | } |
@@ -210,6 +213,7 @@ static struct mci_platform_data __initdata ek_mmc_data = { | |||
210 | .slot[1] = { | 213 | .slot[1] = { |
211 | .bus_width = 4, | 214 | .bus_width = 4, |
212 | .detect_pin = AT91_PIN_PC9, | 215 | .detect_pin = AT91_PIN_PC9, |
216 | .wp_pin = -EINVAL, | ||
213 | }, | 217 | }, |
214 | 218 | ||
215 | }; | 219 | }; |
@@ -218,6 +222,8 @@ static struct at91_mmc_data __initdata ek_mmc_data = { | |||
218 | .slot_b = 1, /* Only one slot so use slot B */ | 222 | .slot_b = 1, /* Only one slot so use slot B */ |
219 | .wire4 = 1, | 223 | .wire4 = 1, |
220 | .det_pin = AT91_PIN_PC9, | 224 | .det_pin = AT91_PIN_PC9, |
225 | .wp_pin = -EINVAL, | ||
226 | .vcc_pin = -EINVAL, | ||
221 | }; | 227 | }; |
222 | #endif | 228 | #endif |
223 | 229 | ||
@@ -227,6 +233,7 @@ static void __init ek_add_device_mmc(void) | |||
227 | if (ek_have_2mmc()) { | 233 | if (ek_have_2mmc()) { |
228 | ek_mmc_data.slot[0].bus_width = 4; | 234 | ek_mmc_data.slot[0].bus_width = 4; |
229 | ek_mmc_data.slot[0].detect_pin = AT91_PIN_PC2; | 235 | ek_mmc_data.slot[0].detect_pin = AT91_PIN_PC2; |
236 | ek_mmc_data.slot[0].wp_pin = -1; | ||
230 | } | 237 | } |
231 | at91_add_device_mci(0, &ek_mmc_data); | 238 | at91_add_device_mci(0, &ek_mmc_data); |
232 | #else | 239 | #else |
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c index 92de9127923a..ea0d1b9c2b7b 100644 --- a/arch/arm/mach-at91/board-sam9m10g45ek.c +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c | |||
@@ -69,6 +69,7 @@ static void __init ek_init_early(void) | |||
69 | static struct at91_usbh_data __initdata ek_usbh_hs_data = { | 69 | static struct at91_usbh_data __initdata ek_usbh_hs_data = { |
70 | .ports = 2, | 70 | .ports = 2, |
71 | .vbus_pin = {AT91_PIN_PD1, AT91_PIN_PD3}, | 71 | .vbus_pin = {AT91_PIN_PD1, AT91_PIN_PD3}, |
72 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
72 | }; | 73 | }; |
73 | 74 | ||
74 | 75 | ||
@@ -100,6 +101,7 @@ static struct mci_platform_data __initdata mci0_data = { | |||
100 | .slot[0] = { | 101 | .slot[0] = { |
101 | .bus_width = 4, | 102 | .bus_width = 4, |
102 | .detect_pin = AT91_PIN_PD10, | 103 | .detect_pin = AT91_PIN_PD10, |
104 | .wp_pin = -EINVAL, | ||
103 | }, | 105 | }, |
104 | }; | 106 | }; |
105 | 107 | ||
@@ -115,7 +117,7 @@ static struct mci_platform_data __initdata mci1_data = { | |||
115 | /* | 117 | /* |
116 | * MACB Ethernet device | 118 | * MACB Ethernet device |
117 | */ | 119 | */ |
118 | static struct at91_eth_data __initdata ek_macb_data = { | 120 | static struct macb_platform_data __initdata ek_macb_data = { |
119 | .phy_irq_pin = AT91_PIN_PD5, | 121 | .phy_irq_pin = AT91_PIN_PD5, |
120 | .is_rmii = 1, | 122 | .is_rmii = 1, |
121 | }; | 123 | }; |
@@ -143,6 +145,7 @@ static struct atmel_nand_data __initdata ek_nand_data = { | |||
143 | .cle = 22, | 145 | .cle = 22, |
144 | .rdy_pin = AT91_PIN_PC8, | 146 | .rdy_pin = AT91_PIN_PC8, |
145 | .enable_pin = AT91_PIN_PC14, | 147 | .enable_pin = AT91_PIN_PC14, |
148 | .det_pin = -EINVAL, | ||
146 | .parts = ek_nand_partition, | 149 | .parts = ek_nand_partition, |
147 | .num_parts = ARRAY_SIZE(ek_nand_partition), | 150 | .num_parts = ARRAY_SIZE(ek_nand_partition), |
148 | }; | 151 | }; |
@@ -175,7 +178,7 @@ static void __init ek_add_device_nand(void) | |||
175 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; | 178 | ek_nand_smc_config.mode |= AT91_SMC_DBW_8; |
176 | 179 | ||
177 | /* configure chip-select 3 (NAND) */ | 180 | /* configure chip-select 3 (NAND) */ |
178 | sam9_smc_configure(3, &ek_nand_smc_config); | 181 | sam9_smc_configure(0, 3, &ek_nand_smc_config); |
179 | 182 | ||
180 | at91_add_device_nand(&ek_nand_data); | 183 | at91_add_device_nand(&ek_nand_data); |
181 | } | 184 | } |
@@ -330,6 +333,7 @@ static void __init ek_add_device_buttons(void) {} | |||
330 | * reset_pin is not connected: NRST | 333 | * reset_pin is not connected: NRST |
331 | */ | 334 | */ |
332 | static struct ac97c_platform_data ek_ac97_data = { | 335 | static struct ac97c_platform_data ek_ac97_data = { |
336 | .reset_pin = -EINVAL, | ||
333 | }; | 337 | }; |
334 | 338 | ||
335 | 339 | ||
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c index b2b748239f36..c1366d0032bf 100644 --- a/arch/arm/mach-at91/board-sam9rlek.c +++ b/arch/arm/mach-at91/board-sam9rlek.c | |||
@@ -67,8 +67,8 @@ static struct usba_platform_data __initdata ek_usba_udc_data = { | |||
67 | static struct at91_mmc_data __initdata ek_mmc_data = { | 67 | static struct at91_mmc_data __initdata ek_mmc_data = { |
68 | .wire4 = 1, | 68 | .wire4 = 1, |
69 | .det_pin = AT91_PIN_PA15, | 69 | .det_pin = AT91_PIN_PA15, |
70 | // .wp_pin = ... not connected | 70 | .wp_pin = -EINVAL, |
71 | // .vcc_pin = ... not connected | 71 | .vcc_pin = -EINVAL, |
72 | }; | 72 | }; |
73 | 73 | ||
74 | 74 | ||
@@ -91,7 +91,7 @@ static struct mtd_partition __initdata ek_nand_partition[] = { | |||
91 | static struct atmel_nand_data __initdata ek_nand_data = { | 91 | static struct atmel_nand_data __initdata ek_nand_data = { |
92 | .ale = 21, | 92 | .ale = 21, |
93 | .cle = 22, | 93 | .cle = 22, |
94 | // .det_pin = ... not connected | 94 | .det_pin = -EINVAL, |
95 | .rdy_pin = AT91_PIN_PD17, | 95 | .rdy_pin = AT91_PIN_PD17, |
96 | .enable_pin = AT91_PIN_PB6, | 96 | .enable_pin = AT91_PIN_PB6, |
97 | .parts = ek_nand_partition, | 97 | .parts = ek_nand_partition, |
@@ -119,7 +119,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = { | |||
119 | static void __init ek_add_device_nand(void) | 119 | static void __init ek_add_device_nand(void) |
120 | { | 120 | { |
121 | /* configure chip-select 3 (NAND) */ | 121 | /* configure chip-select 3 (NAND) */ |
122 | sam9_smc_configure(3, &ek_nand_smc_config); | 122 | sam9_smc_configure(0, 3, &ek_nand_smc_config); |
123 | 123 | ||
124 | at91_add_device_nand(&ek_nand_data); | 124 | at91_add_device_nand(&ek_nand_data); |
125 | } | 125 | } |
@@ -204,6 +204,7 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data; | |||
204 | * reset_pin is not connected: NRST | 204 | * reset_pin is not connected: NRST |
205 | */ | 205 | */ |
206 | static struct ac97c_platform_data ek_ac97_data = { | 206 | static struct ac97c_platform_data ek_ac97_data = { |
207 | .reset_pin = -EINVAL, | ||
207 | }; | 208 | }; |
208 | 209 | ||
209 | 210 | ||
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c index 0df01c6e2d0c..4770db08e5a6 100644 --- a/arch/arm/mach-at91/board-snapper9260.c +++ b/arch/arm/mach-at91/board-snapper9260.c | |||
@@ -57,15 +57,19 @@ static void __init snapper9260_init_early(void) | |||
57 | 57 | ||
58 | static struct at91_usbh_data __initdata snapper9260_usbh_data = { | 58 | static struct at91_usbh_data __initdata snapper9260_usbh_data = { |
59 | .ports = 2, | 59 | .ports = 2, |
60 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
61 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
60 | }; | 62 | }; |
61 | 63 | ||
62 | static struct at91_udc_data __initdata snapper9260_udc_data = { | 64 | static struct at91_udc_data __initdata snapper9260_udc_data = { |
63 | .vbus_pin = SNAPPER9260_IO_EXP_GPIO(5), | 65 | .vbus_pin = SNAPPER9260_IO_EXP_GPIO(5), |
64 | .vbus_active_low = 1, | 66 | .vbus_active_low = 1, |
65 | .vbus_polled = 1, | 67 | .vbus_polled = 1, |
68 | .pullup_pin = -EINVAL, | ||
66 | }; | 69 | }; |
67 | 70 | ||
68 | static struct at91_eth_data snapper9260_macb_data = { | 71 | static struct macb_platform_data snapper9260_macb_data = { |
72 | .phy_irq_pin = -EINVAL, | ||
69 | .is_rmii = 1, | 73 | .is_rmii = 1, |
70 | }; | 74 | }; |
71 | 75 | ||
@@ -104,6 +108,8 @@ static struct atmel_nand_data __initdata snapper9260_nand_data = { | |||
104 | .parts = snapper9260_nand_partitions, | 108 | .parts = snapper9260_nand_partitions, |
105 | .num_parts = ARRAY_SIZE(snapper9260_nand_partitions), | 109 | .num_parts = ARRAY_SIZE(snapper9260_nand_partitions), |
106 | .bus_width_16 = 0, | 110 | .bus_width_16 = 0, |
111 | .enable_pin = -EINVAL, | ||
112 | .det_pin = -EINVAL, | ||
107 | }; | 113 | }; |
108 | 114 | ||
109 | static struct sam9_smc_config __initdata snapper9260_nand_smc_config = { | 115 | static struct sam9_smc_config __initdata snapper9260_nand_smc_config = { |
@@ -149,7 +155,7 @@ static struct i2c_board_info __initdata snapper9260_i2c_devices[] = { | |||
149 | static void __init snapper9260_add_device_nand(void) | 155 | static void __init snapper9260_add_device_nand(void) |
150 | { | 156 | { |
151 | at91_set_A_periph(AT91_PIN_PC14, 0); | 157 | at91_set_A_periph(AT91_PIN_PC14, 0); |
152 | sam9_smc_configure(3, &snapper9260_nand_smc_config); | 158 | sam9_smc_configure(0, 3, &snapper9260_nand_smc_config); |
153 | at91_add_device_nand(&snapper9260_nand_data); | 159 | at91_add_device_nand(&snapper9260_nand_data); |
154 | } | 160 | } |
155 | 161 | ||
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c index 936e5fd7f406..e8d3d5b88244 100644 --- a/arch/arm/mach-at91/board-stamp9g20.c +++ b/arch/arm/mach-at91/board-stamp9g20.c | |||
@@ -85,6 +85,7 @@ static struct atmel_nand_data __initdata nand_data = { | |||
85 | .rdy_pin = AT91_PIN_PC13, | 85 | .rdy_pin = AT91_PIN_PC13, |
86 | .enable_pin = AT91_PIN_PC14, | 86 | .enable_pin = AT91_PIN_PC14, |
87 | .bus_width_16 = 0, | 87 | .bus_width_16 = 0, |
88 | .det_pin = -EINVAL, | ||
88 | }; | 89 | }; |
89 | 90 | ||
90 | static struct sam9_smc_config __initdata nand_smc_config = { | 91 | static struct sam9_smc_config __initdata nand_smc_config = { |
@@ -108,7 +109,7 @@ static struct sam9_smc_config __initdata nand_smc_config = { | |||
108 | static void __init add_device_nand(void) | 109 | static void __init add_device_nand(void) |
109 | { | 110 | { |
110 | /* configure chip-select 3 (NAND) */ | 111 | /* configure chip-select 3 (NAND) */ |
111 | sam9_smc_configure(3, &nand_smc_config); | 112 | sam9_smc_configure(0, 3, &nand_smc_config); |
112 | 113 | ||
113 | at91_add_device_nand(&nand_data); | 114 | at91_add_device_nand(&nand_data); |
114 | } | 115 | } |
@@ -122,12 +123,17 @@ static void __init add_device_nand(void) | |||
122 | static struct mci_platform_data __initdata mmc_data = { | 123 | static struct mci_platform_data __initdata mmc_data = { |
123 | .slot[0] = { | 124 | .slot[0] = { |
124 | .bus_width = 4, | 125 | .bus_width = 4, |
126 | .detect_pin = -1; | ||
127 | .wp_pin = -1; | ||
125 | }, | 128 | }, |
126 | }; | 129 | }; |
127 | #else | 130 | #else |
128 | static struct at91_mmc_data __initdata mmc_data = { | 131 | static struct at91_mmc_data __initdata mmc_data = { |
129 | .slot_b = 0, | 132 | .slot_b = 0, |
130 | .wire4 = 1, | 133 | .wire4 = 1, |
134 | .det_pin = -EINVAL, | ||
135 | .wp_pin = -EINVAL, | ||
136 | .vcc_pin = -EINVAL, | ||
131 | }; | 137 | }; |
132 | #endif | 138 | #endif |
133 | 139 | ||
@@ -137,6 +143,8 @@ static struct at91_mmc_data __initdata mmc_data = { | |||
137 | */ | 143 | */ |
138 | static struct at91_usbh_data __initdata usbh_data = { | 144 | static struct at91_usbh_data __initdata usbh_data = { |
139 | .ports = 2, | 145 | .ports = 2, |
146 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
147 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
140 | }; | 148 | }; |
141 | 149 | ||
142 | 150 | ||
@@ -145,19 +153,19 @@ static struct at91_usbh_data __initdata usbh_data = { | |||
145 | */ | 153 | */ |
146 | static struct at91_udc_data __initdata portuxg20_udc_data = { | 154 | static struct at91_udc_data __initdata portuxg20_udc_data = { |
147 | .vbus_pin = AT91_PIN_PC7, | 155 | .vbus_pin = AT91_PIN_PC7, |
148 | .pullup_pin = 0, /* pull-up driven by UDC */ | 156 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
149 | }; | 157 | }; |
150 | 158 | ||
151 | static struct at91_udc_data __initdata stamp9g20evb_udc_data = { | 159 | static struct at91_udc_data __initdata stamp9g20evb_udc_data = { |
152 | .vbus_pin = AT91_PIN_PA22, | 160 | .vbus_pin = AT91_PIN_PA22, |
153 | .pullup_pin = 0, /* pull-up driven by UDC */ | 161 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
154 | }; | 162 | }; |
155 | 163 | ||
156 | 164 | ||
157 | /* | 165 | /* |
158 | * MACB Ethernet device | 166 | * MACB Ethernet device |
159 | */ | 167 | */ |
160 | static struct at91_eth_data __initdata macb_data = { | 168 | static struct macb_platform_data __initdata macb_data = { |
161 | .phy_irq_pin = AT91_PIN_PA28, | 169 | .phy_irq_pin = AT91_PIN_PA28, |
162 | .is_rmii = 1, | 170 | .is_rmii = 1, |
163 | }; | 171 | }; |
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c index 0a20bab21f99..26c36fc2d1e5 100644 --- a/arch/arm/mach-at91/board-usb-a926x.c +++ b/arch/arm/mach-at91/board-usb-a926x.c | |||
@@ -66,6 +66,8 @@ static void __init ek_init_early(void) | |||
66 | */ | 66 | */ |
67 | static struct at91_usbh_data __initdata ek_usbh_data = { | 67 | static struct at91_usbh_data __initdata ek_usbh_data = { |
68 | .ports = 2, | 68 | .ports = 2, |
69 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
70 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
69 | }; | 71 | }; |
70 | 72 | ||
71 | /* | 73 | /* |
@@ -73,7 +75,7 @@ static struct at91_usbh_data __initdata ek_usbh_data = { | |||
73 | */ | 75 | */ |
74 | static struct at91_udc_data __initdata ek_udc_data = { | 76 | static struct at91_udc_data __initdata ek_udc_data = { |
75 | .vbus_pin = AT91_PIN_PB11, | 77 | .vbus_pin = AT91_PIN_PB11, |
76 | .pullup_pin = 0, /* pull-up driven by UDC */ | 78 | .pullup_pin = -EINVAL, /* pull-up driven by UDC */ |
77 | }; | 79 | }; |
78 | 80 | ||
79 | static void __init ek_add_device_udc(void) | 81 | static void __init ek_add_device_udc(void) |
@@ -146,7 +148,7 @@ static void __init ek_add_device_spi(void) | |||
146 | /* | 148 | /* |
147 | * MACB Ethernet device | 149 | * MACB Ethernet device |
148 | */ | 150 | */ |
149 | static struct at91_eth_data __initdata ek_macb_data = { | 151 | static struct macb_platform_data __initdata ek_macb_data = { |
150 | .phy_irq_pin = AT91_PIN_PE31, | 152 | .phy_irq_pin = AT91_PIN_PE31, |
151 | .is_rmii = 1, | 153 | .is_rmii = 1, |
152 | }; | 154 | }; |
@@ -193,7 +195,7 @@ static struct mtd_partition __initdata ek_nand_partition[] = { | |||
193 | static struct atmel_nand_data __initdata ek_nand_data = { | 195 | static struct atmel_nand_data __initdata ek_nand_data = { |
194 | .ale = 21, | 196 | .ale = 21, |
195 | .cle = 22, | 197 | .cle = 22, |
196 | // .det_pin = ... not connected | 198 | .det_pin = -EINVAL, |
197 | .rdy_pin = AT91_PIN_PA22, | 199 | .rdy_pin = AT91_PIN_PA22, |
198 | .enable_pin = AT91_PIN_PD15, | 200 | .enable_pin = AT91_PIN_PD15, |
199 | .parts = ek_nand_partition, | 201 | .parts = ek_nand_partition, |
@@ -245,9 +247,9 @@ static void __init ek_add_device_nand(void) | |||
245 | 247 | ||
246 | /* configure chip-select 3 (NAND) */ | 248 | /* configure chip-select 3 (NAND) */ |
247 | if (machine_is_usb_a9g20()) | 249 | if (machine_is_usb_a9g20()) |
248 | sam9_smc_configure(3, &usb_a9g20_nand_smc_config); | 250 | sam9_smc_configure(0, 3, &usb_a9g20_nand_smc_config); |
249 | else | 251 | else |
250 | sam9_smc_configure(3, &usb_a9260_nand_smc_config); | 252 | sam9_smc_configure(0, 3, &usb_a9260_nand_smc_config); |
251 | 253 | ||
252 | at91_add_device_nand(&ek_nand_data); | 254 | at91_add_device_nand(&ek_nand_data); |
253 | } | 255 | } |
@@ -344,7 +346,7 @@ static void __init ek_board_init(void) | |||
344 | /* I2C */ | 346 | /* I2C */ |
345 | at91_add_device_i2c(NULL, 0); | 347 | at91_add_device_i2c(NULL, 0); |
346 | /* shutdown controller, wakeup button (5 msec low) */ | 348 | /* shutdown controller, wakeup button (5 msec low) */ |
347 | at91_sys_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) | 349 | at91_shdwc_write(AT91_SHDW_MR, AT91_SHDW_CPTWK0_(10) |
348 | | AT91_SHDW_WKMODE0_LOW | 350 | | AT91_SHDW_WKMODE0_LOW |
349 | | AT91_SHDW_RTTWKEN); | 351 | | AT91_SHDW_RTTWKEN); |
350 | } | 352 | } |
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c index 12a3f955162b..bbd553e1cd93 100644 --- a/arch/arm/mach-at91/board-yl-9200.c +++ b/arch/arm/mach-at91/board-yl-9200.c | |||
@@ -110,7 +110,7 @@ static struct gpio_led yl9200_leds[] = { | |||
110 | /* | 110 | /* |
111 | * Ethernet | 111 | * Ethernet |
112 | */ | 112 | */ |
113 | static struct at91_eth_data __initdata yl9200_eth_data = { | 113 | static struct macb_platform_data __initdata yl9200_eth_data = { |
114 | .phy_irq_pin = AT91_PIN_PB28, | 114 | .phy_irq_pin = AT91_PIN_PB28, |
115 | .is_rmii = 1, | 115 | .is_rmii = 1, |
116 | }; | 116 | }; |
@@ -120,6 +120,8 @@ static struct at91_eth_data __initdata yl9200_eth_data = { | |||
120 | */ | 120 | */ |
121 | static struct at91_usbh_data __initdata yl9200_usbh_data = { | 121 | static struct at91_usbh_data __initdata yl9200_usbh_data = { |
122 | .ports = 1, /* PQFP version of AT91RM9200 */ | 122 | .ports = 1, /* PQFP version of AT91RM9200 */ |
123 | .vbus_pin = {-EINVAL, -EINVAL}, | ||
124 | .overcurrent_pin= {-EINVAL, -EINVAL}, | ||
123 | }; | 125 | }; |
124 | 126 | ||
125 | /* | 127 | /* |
@@ -137,8 +139,9 @@ static struct at91_udc_data __initdata yl9200_udc_data = { | |||
137 | */ | 139 | */ |
138 | static struct at91_mmc_data __initdata yl9200_mmc_data = { | 140 | static struct at91_mmc_data __initdata yl9200_mmc_data = { |
139 | .det_pin = AT91_PIN_PB9, | 141 | .det_pin = AT91_PIN_PB9, |
140 | // .wp_pin = ... not connected | ||
141 | .wire4 = 1, | 142 | .wire4 = 1, |
143 | .wp_pin = -EINVAL, | ||
144 | .vcc_pin = -EINVAL, | ||
142 | }; | 145 | }; |
143 | 146 | ||
144 | /* | 147 | /* |
@@ -175,7 +178,7 @@ static struct mtd_partition __initdata yl9200_nand_partition[] = { | |||
175 | static struct atmel_nand_data __initdata yl9200_nand_data = { | 178 | static struct atmel_nand_data __initdata yl9200_nand_data = { |
176 | .ale = 6, | 179 | .ale = 6, |
177 | .cle = 7, | 180 | .cle = 7, |
178 | // .det_pin = ... not connected | 181 | .det_pin = -EINVAL, |
179 | .rdy_pin = AT91_PIN_PC14, /* R/!B (Sheet10) */ | 182 | .rdy_pin = AT91_PIN_PC14, /* R/!B (Sheet10) */ |
180 | .enable_pin = AT91_PIN_PC15, /* !CE (Sheet10) */ | 183 | .enable_pin = AT91_PIN_PC15, /* !CE (Sheet10) */ |
181 | .parts = yl9200_nand_partition, | 184 | .parts = yl9200_nand_partition, |
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index 938b34f57741..40309588f360 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h | |||
@@ -29,6 +29,7 @@ extern void __init at91_aic_init(unsigned int priority[]); | |||
29 | /* Timer */ | 29 | /* Timer */ |
30 | struct sys_timer; | 30 | struct sys_timer; |
31 | extern struct sys_timer at91rm9200_timer; | 31 | extern struct sys_timer at91rm9200_timer; |
32 | extern void at91sam926x_ioremap_pit(u32 addr); | ||
32 | extern struct sys_timer at91sam926x_timer; | 33 | extern struct sys_timer at91sam926x_timer; |
33 | extern struct sys_timer at91x40_timer; | 34 | extern struct sys_timer at91x40_timer; |
34 | 35 | ||
@@ -59,14 +60,16 @@ extern void at91_irq_resume(void); | |||
59 | /* reset */ | 60 | /* reset */ |
60 | extern void at91sam9_alt_reset(void); | 61 | extern void at91sam9_alt_reset(void); |
61 | 62 | ||
63 | /* shutdown */ | ||
64 | extern void at91_ioremap_shdwc(u32 base_addr); | ||
65 | |||
62 | /* GPIO */ | 66 | /* GPIO */ |
63 | #define AT91RM9200_PQFP 3 /* AT91RM9200 PQFP package has 3 banks */ | 67 | #define AT91RM9200_PQFP 3 /* AT91RM9200 PQFP package has 3 banks */ |
64 | #define AT91RM9200_BGA 4 /* AT91RM9200 BGA package has 4 banks */ | 68 | #define AT91RM9200_BGA 4 /* AT91RM9200 BGA package has 4 banks */ |
65 | 69 | ||
66 | struct at91_gpio_bank { | 70 | struct at91_gpio_bank { |
67 | unsigned short id; /* peripheral ID */ | 71 | unsigned short id; /* peripheral ID */ |
68 | unsigned long offset; /* offset from system peripheral base */ | 72 | unsigned long regbase; /* offset from system peripheral base */ |
69 | struct clk *clock; /* associated clock */ | ||
70 | }; | 73 | }; |
71 | extern void __init at91_gpio_init(struct at91_gpio_bank *, int nr_banks); | 74 | extern void __init at91_gpio_init(struct at91_gpio_bank *, int nr_banks); |
72 | extern void __init at91_gpio_irq_setup(void); | 75 | extern void __init at91_gpio_irq_setup(void); |
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c index 224e9e2f8674..74d6783eeabb 100644 --- a/arch/arm/mach-at91/gpio.c +++ b/arch/arm/mach-at91/gpio.c | |||
@@ -29,8 +29,9 @@ | |||
29 | struct at91_gpio_chip { | 29 | struct at91_gpio_chip { |
30 | struct gpio_chip chip; | 30 | struct gpio_chip chip; |
31 | struct at91_gpio_chip *next; /* Bank sharing same clock */ | 31 | struct at91_gpio_chip *next; /* Bank sharing same clock */ |
32 | struct at91_gpio_bank *bank; /* Bank definition */ | 32 | int id; /* ID of register bank */ |
33 | void __iomem *regbase; /* Base of register bank */ | 33 | void __iomem *regbase; /* Base of register bank */ |
34 | struct clk *clock; /* associated clock */ | ||
34 | }; | 35 | }; |
35 | 36 | ||
36 | #define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip) | 37 | #define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip) |
@@ -58,18 +59,17 @@ static int at91_gpiolib_direction_input(struct gpio_chip *chip, | |||
58 | } | 59 | } |
59 | 60 | ||
60 | static struct at91_gpio_chip gpio_chip[] = { | 61 | static struct at91_gpio_chip gpio_chip[] = { |
61 | AT91_GPIO_CHIP("A", 0x00 + PIN_BASE, 32), | 62 | AT91_GPIO_CHIP("pioA", 0x00, 32), |
62 | AT91_GPIO_CHIP("B", 0x20 + PIN_BASE, 32), | 63 | AT91_GPIO_CHIP("pioB", 0x20, 32), |
63 | AT91_GPIO_CHIP("C", 0x40 + PIN_BASE, 32), | 64 | AT91_GPIO_CHIP("pioC", 0x40, 32), |
64 | AT91_GPIO_CHIP("D", 0x60 + PIN_BASE, 32), | 65 | AT91_GPIO_CHIP("pioD", 0x60, 32), |
65 | AT91_GPIO_CHIP("E", 0x80 + PIN_BASE, 32), | 66 | AT91_GPIO_CHIP("pioE", 0x80, 32), |
66 | }; | 67 | }; |
67 | 68 | ||
68 | static int gpio_banks; | 69 | static int gpio_banks; |
69 | 70 | ||
70 | static inline void __iomem *pin_to_controller(unsigned pin) | 71 | static inline void __iomem *pin_to_controller(unsigned pin) |
71 | { | 72 | { |
72 | pin -= PIN_BASE; | ||
73 | pin /= 32; | 73 | pin /= 32; |
74 | if (likely(pin < gpio_banks)) | 74 | if (likely(pin < gpio_banks)) |
75 | return gpio_chip[pin].regbase; | 75 | return gpio_chip[pin].regbase; |
@@ -79,7 +79,6 @@ static inline void __iomem *pin_to_controller(unsigned pin) | |||
79 | 79 | ||
80 | static inline unsigned pin_to_mask(unsigned pin) | 80 | static inline unsigned pin_to_mask(unsigned pin) |
81 | { | 81 | { |
82 | pin -= PIN_BASE; | ||
83 | return 1 << (pin % 32); | 82 | return 1 << (pin % 32); |
84 | } | 83 | } |
85 | 84 | ||
@@ -274,8 +273,9 @@ static u32 backups[MAX_GPIO_BANKS]; | |||
274 | 273 | ||
275 | static int gpio_irq_set_wake(struct irq_data *d, unsigned state) | 274 | static int gpio_irq_set_wake(struct irq_data *d, unsigned state) |
276 | { | 275 | { |
277 | unsigned mask = pin_to_mask(d->irq); | 276 | unsigned pin = irq_to_gpio(d->irq); |
278 | unsigned bank = (d->irq - PIN_BASE) / 32; | 277 | unsigned mask = pin_to_mask(pin); |
278 | unsigned bank = pin / 32; | ||
279 | 279 | ||
280 | if (unlikely(bank >= MAX_GPIO_BANKS)) | 280 | if (unlikely(bank >= MAX_GPIO_BANKS)) |
281 | return -EINVAL; | 281 | return -EINVAL; |
@@ -285,7 +285,7 @@ static int gpio_irq_set_wake(struct irq_data *d, unsigned state) | |||
285 | else | 285 | else |
286 | wakeups[bank] &= ~mask; | 286 | wakeups[bank] &= ~mask; |
287 | 287 | ||
288 | irq_set_irq_wake(gpio_chip[bank].bank->id, state); | 288 | irq_set_irq_wake(gpio_chip[bank].id, state); |
289 | 289 | ||
290 | return 0; | 290 | return 0; |
291 | } | 291 | } |
@@ -302,7 +302,7 @@ void at91_gpio_suspend(void) | |||
302 | __raw_writel(wakeups[i], pio + PIO_IER); | 302 | __raw_writel(wakeups[i], pio + PIO_IER); |
303 | 303 | ||
304 | if (!wakeups[i]) | 304 | if (!wakeups[i]) |
305 | clk_disable(gpio_chip[i].bank->clock); | 305 | clk_disable(gpio_chip[i].clock); |
306 | else { | 306 | else { |
307 | #ifdef CONFIG_PM_DEBUG | 307 | #ifdef CONFIG_PM_DEBUG |
308 | printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", 'A'+i, wakeups[i]); | 308 | printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", 'A'+i, wakeups[i]); |
@@ -319,7 +319,7 @@ void at91_gpio_resume(void) | |||
319 | void __iomem *pio = gpio_chip[i].regbase; | 319 | void __iomem *pio = gpio_chip[i].regbase; |
320 | 320 | ||
321 | if (!wakeups[i]) | 321 | if (!wakeups[i]) |
322 | clk_enable(gpio_chip[i].bank->clock); | 322 | clk_enable(gpio_chip[i].clock); |
323 | 323 | ||
324 | __raw_writel(wakeups[i], pio + PIO_IDR); | 324 | __raw_writel(wakeups[i], pio + PIO_IDR); |
325 | __raw_writel(backups[i], pio + PIO_IER); | 325 | __raw_writel(backups[i], pio + PIO_IER); |
@@ -344,8 +344,9 @@ void at91_gpio_resume(void) | |||
344 | 344 | ||
345 | static void gpio_irq_mask(struct irq_data *d) | 345 | static void gpio_irq_mask(struct irq_data *d) |
346 | { | 346 | { |
347 | void __iomem *pio = pin_to_controller(d->irq); | 347 | unsigned pin = irq_to_gpio(d->irq); |
348 | unsigned mask = pin_to_mask(d->irq); | 348 | void __iomem *pio = pin_to_controller(pin); |
349 | unsigned mask = pin_to_mask(pin); | ||
349 | 350 | ||
350 | if (pio) | 351 | if (pio) |
351 | __raw_writel(mask, pio + PIO_IDR); | 352 | __raw_writel(mask, pio + PIO_IDR); |
@@ -353,8 +354,9 @@ static void gpio_irq_mask(struct irq_data *d) | |||
353 | 354 | ||
354 | static void gpio_irq_unmask(struct irq_data *d) | 355 | static void gpio_irq_unmask(struct irq_data *d) |
355 | { | 356 | { |
356 | void __iomem *pio = pin_to_controller(d->irq); | 357 | unsigned pin = irq_to_gpio(d->irq); |
357 | unsigned mask = pin_to_mask(d->irq); | 358 | void __iomem *pio = pin_to_controller(pin); |
359 | unsigned mask = pin_to_mask(pin); | ||
358 | 360 | ||
359 | if (pio) | 361 | if (pio) |
360 | __raw_writel(mask, pio + PIO_IER); | 362 | __raw_writel(mask, pio + PIO_IER); |
@@ -382,7 +384,7 @@ static struct irq_chip gpio_irqchip = { | |||
382 | 384 | ||
383 | static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) | 385 | static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) |
384 | { | 386 | { |
385 | unsigned pin; | 387 | unsigned irq_pin; |
386 | struct irq_data *idata = irq_desc_get_irq_data(desc); | 388 | struct irq_data *idata = irq_desc_get_irq_data(desc); |
387 | struct irq_chip *chip = irq_data_get_irq_chip(idata); | 389 | struct irq_chip *chip = irq_data_get_irq_chip(idata); |
388 | struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(idata); | 390 | struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(idata); |
@@ -405,12 +407,12 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc) | |||
405 | continue; | 407 | continue; |
406 | } | 408 | } |
407 | 409 | ||
408 | pin = at91_gpio->chip.base; | 410 | irq_pin = gpio_to_irq(at91_gpio->chip.base); |
409 | 411 | ||
410 | while (isr) { | 412 | while (isr) { |
411 | if (isr & 1) | 413 | if (isr & 1) |
412 | generic_handle_irq(pin); | 414 | generic_handle_irq(irq_pin); |
413 | pin++; | 415 | irq_pin++; |
414 | isr >>= 1; | 416 | isr >>= 1; |
415 | } | 417 | } |
416 | } | 418 | } |
@@ -438,7 +440,7 @@ static int at91_gpio_show(struct seq_file *s, void *unused) | |||
438 | seq_printf(s, "%i:\t", j); | 440 | seq_printf(s, "%i:\t", j); |
439 | 441 | ||
440 | for (bank = 0; bank < gpio_banks; bank++) { | 442 | for (bank = 0; bank < gpio_banks; bank++) { |
441 | unsigned pin = PIN_BASE + (32 * bank) + j; | 443 | unsigned pin = (32 * bank) + j; |
442 | void __iomem *pio = pin_to_controller(pin); | 444 | void __iomem *pio = pin_to_controller(pin); |
443 | unsigned mask = pin_to_mask(pin); | 445 | unsigned mask = pin_to_mask(pin); |
444 | 446 | ||
@@ -491,27 +493,28 @@ static struct lock_class_key gpio_lock_class; | |||
491 | */ | 493 | */ |
492 | void __init at91_gpio_irq_setup(void) | 494 | void __init at91_gpio_irq_setup(void) |
493 | { | 495 | { |
494 | unsigned pioc, pin; | 496 | unsigned pioc, irq = gpio_to_irq(0); |
495 | struct at91_gpio_chip *this, *prev; | 497 | struct at91_gpio_chip *this, *prev; |
496 | 498 | ||
497 | for (pioc = 0, pin = PIN_BASE, this = gpio_chip, prev = NULL; | 499 | for (pioc = 0, this = gpio_chip, prev = NULL; |
498 | pioc++ < gpio_banks; | 500 | pioc++ < gpio_banks; |
499 | prev = this, this++) { | 501 | prev = this, this++) { |
500 | unsigned id = this->bank->id; | 502 | unsigned id = this->id; |
501 | unsigned i; | 503 | unsigned i; |
502 | 504 | ||
503 | __raw_writel(~0, this->regbase + PIO_IDR); | 505 | __raw_writel(~0, this->regbase + PIO_IDR); |
504 | 506 | ||
505 | for (i = 0, pin = this->chip.base; i < 32; i++, pin++) { | 507 | for (i = 0, irq = gpio_to_irq(this->chip.base); i < 32; |
506 | irq_set_lockdep_class(pin, &gpio_lock_class); | 508 | i++, irq++) { |
509 | irq_set_lockdep_class(irq, &gpio_lock_class); | ||
507 | 510 | ||
508 | /* | 511 | /* |
509 | * Can use the "simple" and not "edge" handler since it's | 512 | * Can use the "simple" and not "edge" handler since it's |
510 | * shorter, and the AIC handles interrupts sanely. | 513 | * shorter, and the AIC handles interrupts sanely. |
511 | */ | 514 | */ |
512 | irq_set_chip_and_handler(pin, &gpio_irqchip, | 515 | irq_set_chip_and_handler(irq, &gpio_irqchip, |
513 | handle_simple_irq); | 516 | handle_simple_irq); |
514 | set_irq_flags(pin, IRQF_VALID); | 517 | set_irq_flags(irq, IRQF_VALID); |
515 | } | 518 | } |
516 | 519 | ||
517 | /* The toplevel handler handles one bank of GPIOs, except | 520 | /* The toplevel handler handles one bank of GPIOs, except |
@@ -524,7 +527,7 @@ void __init at91_gpio_irq_setup(void) | |||
524 | irq_set_chip_data(id, this); | 527 | irq_set_chip_data(id, this); |
525 | irq_set_chained_handler(id, gpio_irq_handler); | 528 | irq_set_chained_handler(id, gpio_irq_handler); |
526 | } | 529 | } |
527 | pr_info("AT91: %d gpio irqs in %d banks\n", pin - PIN_BASE, gpio_banks); | 530 | pr_info("AT91: %d gpio irqs in %d banks\n", irq - gpio_to_irq(0), gpio_banks); |
528 | } | 531 | } |
529 | 532 | ||
530 | /* gpiolib support */ | 533 | /* gpiolib support */ |
@@ -612,16 +615,26 @@ void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks) | |||
612 | for (i = 0; i < nr_banks; i++) { | 615 | for (i = 0; i < nr_banks; i++) { |
613 | at91_gpio = &gpio_chip[i]; | 616 | at91_gpio = &gpio_chip[i]; |
614 | 617 | ||
615 | at91_gpio->bank = &data[i]; | 618 | at91_gpio->id = data[i].id; |
616 | at91_gpio->chip.base = PIN_BASE + i * 32; | 619 | at91_gpio->chip.base = i * 32; |
617 | at91_gpio->regbase = at91_gpio->bank->offset + | 620 | |
618 | (void __iomem *)AT91_VA_BASE_SYS; | 621 | at91_gpio->regbase = ioremap(data[i].regbase, 512); |
622 | if (!at91_gpio->regbase) { | ||
623 | pr_err("at91_gpio.%d, failed to map registers, ignoring.\n", i); | ||
624 | continue; | ||
625 | } | ||
626 | |||
627 | at91_gpio->clock = clk_get_sys(NULL, at91_gpio->chip.label); | ||
628 | if (!at91_gpio->clock) { | ||
629 | pr_err("at91_gpio.%d, failed to get clock, ignoring.\n", i); | ||
630 | continue; | ||
631 | } | ||
619 | 632 | ||
620 | /* enable PIO controller's clock */ | 633 | /* enable PIO controller's clock */ |
621 | clk_enable(at91_gpio->bank->clock); | 634 | clk_enable(at91_gpio->clock); |
622 | 635 | ||
623 | /* AT91SAM9263_ID_PIOCDE groups PIOC, PIOD, PIOE */ | 636 | /* AT91SAM9263_ID_PIOCDE groups PIOC, PIOD, PIOE */ |
624 | if (last && last->bank->id == at91_gpio->bank->id) | 637 | if (last && last->id == at91_gpio->id) |
625 | last->next = at91_gpio; | 638 | last->next = at91_gpio; |
626 | last = at91_gpio; | 639 | last = at91_gpio; |
627 | 640 | ||
diff --git a/arch/arm/mach-at91/include/mach/at91_aic.h b/arch/arm/mach-at91/include/mach/at91_aic.h index 03566799d3be..3045781c473f 100644 --- a/arch/arm/mach-at91/include/mach/at91_aic.h +++ b/arch/arm/mach-at91/include/mach/at91_aic.h | |||
@@ -16,7 +16,19 @@ | |||
16 | #ifndef AT91_AIC_H | 16 | #ifndef AT91_AIC_H |
17 | #define AT91_AIC_H | 17 | #define AT91_AIC_H |
18 | 18 | ||
19 | #define AT91_AIC_SMR(n) (AT91_AIC + ((n) * 4)) /* Source Mode Registers 0-31 */ | 19 | #ifndef __ASSEMBLY__ |
20 | extern void __iomem *at91_aic_base; | ||
21 | |||
22 | #define at91_aic_read(field) \ | ||
23 | __raw_readl(at91_aic_base + field) | ||
24 | |||
25 | #define at91_aic_write(field, value) \ | ||
26 | __raw_writel(value, at91_aic_base + field); | ||
27 | #else | ||
28 | .extern at91_aic_base | ||
29 | #endif | ||
30 | |||
31 | #define AT91_AIC_SMR(n) ((n) * 4) /* Source Mode Registers 0-31 */ | ||
20 | #define AT91_AIC_PRIOR (7 << 0) /* Priority Level */ | 32 | #define AT91_AIC_PRIOR (7 << 0) /* Priority Level */ |
21 | #define AT91_AIC_SRCTYPE (3 << 5) /* Interrupt Source Type */ | 33 | #define AT91_AIC_SRCTYPE (3 << 5) /* Interrupt Source Type */ |
22 | #define AT91_AIC_SRCTYPE_LOW (0 << 5) | 34 | #define AT91_AIC_SRCTYPE_LOW (0 << 5) |
@@ -24,30 +36,30 @@ | |||
24 | #define AT91_AIC_SRCTYPE_HIGH (2 << 5) | 36 | #define AT91_AIC_SRCTYPE_HIGH (2 << 5) |
25 | #define AT91_AIC_SRCTYPE_RISING (3 << 5) | 37 | #define AT91_AIC_SRCTYPE_RISING (3 << 5) |
26 | 38 | ||
27 | #define AT91_AIC_SVR(n) (AT91_AIC + 0x80 + ((n) * 4)) /* Source Vector Registers 0-31 */ | 39 | #define AT91_AIC_SVR(n) (0x80 + ((n) * 4)) /* Source Vector Registers 0-31 */ |
28 | #define AT91_AIC_IVR (AT91_AIC + 0x100) /* Interrupt Vector Register */ | 40 | #define AT91_AIC_IVR 0x100 /* Interrupt Vector Register */ |
29 | #define AT91_AIC_FVR (AT91_AIC + 0x104) /* Fast Interrupt Vector Register */ | 41 | #define AT91_AIC_FVR 0x104 /* Fast Interrupt Vector Register */ |
30 | #define AT91_AIC_ISR (AT91_AIC + 0x108) /* Interrupt Status Register */ | 42 | #define AT91_AIC_ISR 0x108 /* Interrupt Status Register */ |
31 | #define AT91_AIC_IRQID (0x1f << 0) /* Current Interrupt Identifier */ | 43 | #define AT91_AIC_IRQID (0x1f << 0) /* Current Interrupt Identifier */ |
32 | 44 | ||
33 | #define AT91_AIC_IPR (AT91_AIC + 0x10c) /* Interrupt Pending Register */ | 45 | #define AT91_AIC_IPR 0x10c /* Interrupt Pending Register */ |
34 | #define AT91_AIC_IMR (AT91_AIC + 0x110) /* Interrupt Mask Register */ | 46 | #define AT91_AIC_IMR 0x110 /* Interrupt Mask Register */ |
35 | #define AT91_AIC_CISR (AT91_AIC + 0x114) /* Core Interrupt Status Register */ | 47 | #define AT91_AIC_CISR 0x114 /* Core Interrupt Status Register */ |
36 | #define AT91_AIC_NFIQ (1 << 0) /* nFIQ Status */ | 48 | #define AT91_AIC_NFIQ (1 << 0) /* nFIQ Status */ |
37 | #define AT91_AIC_NIRQ (1 << 1) /* nIRQ Status */ | 49 | #define AT91_AIC_NIRQ (1 << 1) /* nIRQ Status */ |
38 | 50 | ||
39 | #define AT91_AIC_IECR (AT91_AIC + 0x120) /* Interrupt Enable Command Register */ | 51 | #define AT91_AIC_IECR 0x120 /* Interrupt Enable Command Register */ |
40 | #define AT91_AIC_IDCR (AT91_AIC + 0x124) /* Interrupt Disable Command Register */ | 52 | #define AT91_AIC_IDCR 0x124 /* Interrupt Disable Command Register */ |
41 | #define AT91_AIC_ICCR (AT91_AIC + 0x128) /* Interrupt Clear Command Register */ | 53 | #define AT91_AIC_ICCR 0x128 /* Interrupt Clear Command Register */ |
42 | #define AT91_AIC_ISCR (AT91_AIC + 0x12c) /* Interrupt Set Command Register */ | 54 | #define AT91_AIC_ISCR 0x12c /* Interrupt Set Command Register */ |
43 | #define AT91_AIC_EOICR (AT91_AIC + 0x130) /* End of Interrupt Command Register */ | 55 | #define AT91_AIC_EOICR 0x130 /* End of Interrupt Command Register */ |
44 | #define AT91_AIC_SPU (AT91_AIC + 0x134) /* Spurious Interrupt Vector Register */ | 56 | #define AT91_AIC_SPU 0x134 /* Spurious Interrupt Vector Register */ |
45 | #define AT91_AIC_DCR (AT91_AIC + 0x138) /* Debug Control Register */ | 57 | #define AT91_AIC_DCR 0x138 /* Debug Control Register */ |
46 | #define AT91_AIC_DCR_PROT (1 << 0) /* Protection Mode */ | 58 | #define AT91_AIC_DCR_PROT (1 << 0) /* Protection Mode */ |
47 | #define AT91_AIC_DCR_GMSK (1 << 1) /* General Mask */ | 59 | #define AT91_AIC_DCR_GMSK (1 << 1) /* General Mask */ |
48 | 60 | ||
49 | #define AT91_AIC_FFER (AT91_AIC + 0x140) /* Fast Forcing Enable Register [SAM9 only] */ | 61 | #define AT91_AIC_FFER 0x140 /* Fast Forcing Enable Register [SAM9 only] */ |
50 | #define AT91_AIC_FFDR (AT91_AIC + 0x144) /* Fast Forcing Disable Register [SAM9 only] */ | 62 | #define AT91_AIC_FFDR 0x144 /* Fast Forcing Disable Register [SAM9 only] */ |
51 | #define AT91_AIC_FFSR (AT91_AIC + 0x148) /* Fast Forcing Status Register [SAM9 only] */ | 63 | #define AT91_AIC_FFSR 0x148 /* Fast Forcing Status Register [SAM9 only] */ |
52 | 64 | ||
53 | #endif | 65 | #endif |
diff --git a/arch/arm/mach-at91/include/mach/at91_dbgu.h b/arch/arm/mach-at91/include/mach/at91_dbgu.h index dbfe455a4c41..2aa0c5e13495 100644 --- a/arch/arm/mach-at91/include/mach/at91_dbgu.h +++ b/arch/arm/mach-at91/include/mach/at91_dbgu.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #define dbgu_readl(dbgu, field) \ | 19 | #define dbgu_readl(dbgu, field) \ |
20 | __raw_readl(AT91_VA_BASE_SYS + dbgu + AT91_DBGU_ ## field) | 20 | __raw_readl(AT91_VA_BASE_SYS + dbgu + AT91_DBGU_ ## field) |
21 | 21 | ||
22 | #ifdef AT91_DBGU | 22 | #if !defined(CONFIG_ARCH_AT91X40) |
23 | #define AT91_DBGU_CR (0x00) /* Control Register */ | 23 | #define AT91_DBGU_CR (0x00) /* Control Register */ |
24 | #define AT91_DBGU_MR (0x04) /* Mode Register */ | 24 | #define AT91_DBGU_MR (0x04) /* Mode Register */ |
25 | #define AT91_DBGU_IER (0x08) /* Interrupt Enable Register */ | 25 | #define AT91_DBGU_IER (0x08) /* Interrupt Enable Register */ |
diff --git a/arch/arm/mach-at91/include/mach/at91_pit.h b/arch/arm/mach-at91/include/mach/at91_pit.h index 974d0bd05b5b..d1f80ad7f4d4 100644 --- a/arch/arm/mach-at91/include/mach/at91_pit.h +++ b/arch/arm/mach-at91/include/mach/at91_pit.h | |||
@@ -16,16 +16,16 @@ | |||
16 | #ifndef AT91_PIT_H | 16 | #ifndef AT91_PIT_H |
17 | #define AT91_PIT_H | 17 | #define AT91_PIT_H |
18 | 18 | ||
19 | #define AT91_PIT_MR (AT91_PIT + 0x00) /* Mode Register */ | 19 | #define AT91_PIT_MR 0x00 /* Mode Register */ |
20 | #define AT91_PIT_PITIEN (1 << 25) /* Timer Interrupt Enable */ | 20 | #define AT91_PIT_PITIEN (1 << 25) /* Timer Interrupt Enable */ |
21 | #define AT91_PIT_PITEN (1 << 24) /* Timer Enabled */ | 21 | #define AT91_PIT_PITEN (1 << 24) /* Timer Enabled */ |
22 | #define AT91_PIT_PIV (0xfffff) /* Periodic Interval Value */ | 22 | #define AT91_PIT_PIV (0xfffff) /* Periodic Interval Value */ |
23 | 23 | ||
24 | #define AT91_PIT_SR (AT91_PIT + 0x04) /* Status Register */ | 24 | #define AT91_PIT_SR 0x04 /* Status Register */ |
25 | #define AT91_PIT_PITS (1 << 0) /* Timer Status */ | 25 | #define AT91_PIT_PITS (1 << 0) /* Timer Status */ |
26 | 26 | ||
27 | #define AT91_PIT_PIVR (AT91_PIT + 0x08) /* Periodic Interval Value Register */ | 27 | #define AT91_PIT_PIVR 0x08 /* Periodic Interval Value Register */ |
28 | #define AT91_PIT_PIIR (AT91_PIT + 0x0c) /* Periodic Interval Image Register */ | 28 | #define AT91_PIT_PIIR 0x0c /* Periodic Interval Image Register */ |
29 | #define AT91_PIT_PICNT (0xfff << 20) /* Interval Counter */ | 29 | #define AT91_PIT_PICNT (0xfff << 20) /* Interval Counter */ |
30 | #define AT91_PIT_CPIV (0xfffff) /* Inverval Value */ | 30 | #define AT91_PIT_CPIV (0xfffff) /* Inverval Value */ |
31 | 31 | ||
diff --git a/arch/arm/mach-at91/include/mach/at91_rtc.h b/arch/arm/mach-at91/include/mach/at91_rtc.h index e56f4701a3e5..da1945e5f714 100644 --- a/arch/arm/mach-at91/include/mach/at91_rtc.h +++ b/arch/arm/mach-at91/include/mach/at91_rtc.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #ifndef AT91_RTC_H | 16 | #ifndef AT91_RTC_H |
17 | #define AT91_RTC_H | 17 | #define AT91_RTC_H |
18 | 18 | ||
19 | #define AT91_RTC_CR (AT91_RTC + 0x00) /* Control Register */ | 19 | #define AT91_RTC_CR 0x00 /* Control Register */ |
20 | #define AT91_RTC_UPDTIM (1 << 0) /* Update Request Time Register */ | 20 | #define AT91_RTC_UPDTIM (1 << 0) /* Update Request Time Register */ |
21 | #define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */ | 21 | #define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */ |
22 | #define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */ | 22 | #define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */ |
@@ -29,44 +29,44 @@ | |||
29 | #define AT91_RTC_CALEVSEL_MONTH (1 << 16) | 29 | #define AT91_RTC_CALEVSEL_MONTH (1 << 16) |
30 | #define AT91_RTC_CALEVSEL_YEAR (2 << 16) | 30 | #define AT91_RTC_CALEVSEL_YEAR (2 << 16) |
31 | 31 | ||
32 | #define AT91_RTC_MR (AT91_RTC + 0x04) /* Mode Register */ | 32 | #define AT91_RTC_MR 0x04 /* Mode Register */ |
33 | #define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */ | 33 | #define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */ |
34 | 34 | ||
35 | #define AT91_RTC_TIMR (AT91_RTC + 0x08) /* Time Register */ | 35 | #define AT91_RTC_TIMR 0x08 /* Time Register */ |
36 | #define AT91_RTC_SEC (0x7f << 0) /* Current Second */ | 36 | #define AT91_RTC_SEC (0x7f << 0) /* Current Second */ |
37 | #define AT91_RTC_MIN (0x7f << 8) /* Current Minute */ | 37 | #define AT91_RTC_MIN (0x7f << 8) /* Current Minute */ |
38 | #define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */ | 38 | #define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */ |
39 | #define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */ | 39 | #define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */ |
40 | 40 | ||
41 | #define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */ | 41 | #define AT91_RTC_CALR 0x0c /* Calendar Register */ |
42 | #define AT91_RTC_CENT (0x7f << 0) /* Current Century */ | 42 | #define AT91_RTC_CENT (0x7f << 0) /* Current Century */ |
43 | #define AT91_RTC_YEAR (0xff << 8) /* Current Year */ | 43 | #define AT91_RTC_YEAR (0xff << 8) /* Current Year */ |
44 | #define AT91_RTC_MONTH (0x1f << 16) /* Current Month */ | 44 | #define AT91_RTC_MONTH (0x1f << 16) /* Current Month */ |
45 | #define AT91_RTC_DAY (7 << 21) /* Current Day */ | 45 | #define AT91_RTC_DAY (7 << 21) /* Current Day */ |
46 | #define AT91_RTC_DATE (0x3f << 24) /* Current Date */ | 46 | #define AT91_RTC_DATE (0x3f << 24) /* Current Date */ |
47 | 47 | ||
48 | #define AT91_RTC_TIMALR (AT91_RTC + 0x10) /* Time Alarm Register */ | 48 | #define AT91_RTC_TIMALR 0x10 /* Time Alarm Register */ |
49 | #define AT91_RTC_SECEN (1 << 7) /* Second Alarm Enable */ | 49 | #define AT91_RTC_SECEN (1 << 7) /* Second Alarm Enable */ |
50 | #define AT91_RTC_MINEN (1 << 15) /* Minute Alarm Enable */ | 50 | #define AT91_RTC_MINEN (1 << 15) /* Minute Alarm Enable */ |
51 | #define AT91_RTC_HOUREN (1 << 23) /* Hour Alarm Enable */ | 51 | #define AT91_RTC_HOUREN (1 << 23) /* Hour Alarm Enable */ |
52 | 52 | ||
53 | #define AT91_RTC_CALALR (AT91_RTC + 0x14) /* Calendar Alarm Register */ | 53 | #define AT91_RTC_CALALR 0x14 /* Calendar Alarm Register */ |
54 | #define AT91_RTC_MTHEN (1 << 23) /* Month Alarm Enable */ | 54 | #define AT91_RTC_MTHEN (1 << 23) /* Month Alarm Enable */ |
55 | #define AT91_RTC_DATEEN (1 << 31) /* Date Alarm Enable */ | 55 | #define AT91_RTC_DATEEN (1 << 31) /* Date Alarm Enable */ |
56 | 56 | ||
57 | #define AT91_RTC_SR (AT91_RTC + 0x18) /* Status Register */ | 57 | #define AT91_RTC_SR 0x18 /* Status Register */ |
58 | #define AT91_RTC_ACKUPD (1 << 0) /* Acknowledge for Update */ | 58 | #define AT91_RTC_ACKUPD (1 << 0) /* Acknowledge for Update */ |
59 | #define AT91_RTC_ALARM (1 << 1) /* Alarm Flag */ | 59 | #define AT91_RTC_ALARM (1 << 1) /* Alarm Flag */ |
60 | #define AT91_RTC_SECEV (1 << 2) /* Second Event */ | 60 | #define AT91_RTC_SECEV (1 << 2) /* Second Event */ |
61 | #define AT91_RTC_TIMEV (1 << 3) /* Time Event */ | 61 | #define AT91_RTC_TIMEV (1 << 3) /* Time Event */ |
62 | #define AT91_RTC_CALEV (1 << 4) /* Calendar Event */ | 62 | #define AT91_RTC_CALEV (1 << 4) /* Calendar Event */ |
63 | 63 | ||
64 | #define AT91_RTC_SCCR (AT91_RTC + 0x1c) /* Status Clear Command Register */ | 64 | #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ |
65 | #define AT91_RTC_IER (AT91_RTC + 0x20) /* Interrupt Enable Register */ | 65 | #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ |
66 | #define AT91_RTC_IDR (AT91_RTC + 0x24) /* Interrupt Disable Register */ | 66 | #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ |
67 | #define AT91_RTC_IMR (AT91_RTC + 0x28) /* Interrupt Mask Register */ | 67 | #define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */ |
68 | 68 | ||
69 | #define AT91_RTC_VER (AT91_RTC + 0x2c) /* Valid Entry Register */ | 69 | #define AT91_RTC_VER 0x2c /* Valid Entry Register */ |
70 | #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ | 70 | #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ |
71 | #define AT91_RTC_NVCAL (1 << 1) /* Non valid Calendar */ | 71 | #define AT91_RTC_NVCAL (1 << 1) /* Non valid Calendar */ |
72 | #define AT91_RTC_NVTIMALR (1 << 2) /* Non valid Time Alarm */ | 72 | #define AT91_RTC_NVTIMALR (1 << 2) /* Non valid Time Alarm */ |
diff --git a/arch/arm/mach-at91/include/mach/at91_shdwc.h b/arch/arm/mach-at91/include/mach/at91_shdwc.h index c4ce07e8a8fa..1d4fe822c77a 100644 --- a/arch/arm/mach-at91/include/mach/at91_shdwc.h +++ b/arch/arm/mach-at91/include/mach/at91_shdwc.h | |||
@@ -16,11 +16,21 @@ | |||
16 | #ifndef AT91_SHDWC_H | 16 | #ifndef AT91_SHDWC_H |
17 | #define AT91_SHDWC_H | 17 | #define AT91_SHDWC_H |
18 | 18 | ||
19 | #define AT91_SHDW_CR (AT91_SHDWC + 0x00) /* Shut Down Control Register */ | 19 | #ifndef __ASSEMBLY__ |
20 | extern void __iomem *at91_shdwc_base; | ||
21 | |||
22 | #define at91_shdwc_read(field) \ | ||
23 | __raw_readl(at91_shdwc_base + field) | ||
24 | |||
25 | #define at91_shdwc_write(field, value) \ | ||
26 | __raw_writel(value, at91_shdwc_base + field); | ||
27 | #endif | ||
28 | |||
29 | #define AT91_SHDW_CR 0x00 /* Shut Down Control Register */ | ||
20 | #define AT91_SHDW_SHDW (1 << 0) /* Shut Down command */ | 30 | #define AT91_SHDW_SHDW (1 << 0) /* Shut Down command */ |
21 | #define AT91_SHDW_KEY (0xa5 << 24) /* KEY Password */ | 31 | #define AT91_SHDW_KEY (0xa5 << 24) /* KEY Password */ |
22 | 32 | ||
23 | #define AT91_SHDW_MR (AT91_SHDWC + 0x04) /* Shut Down Mode Register */ | 33 | #define AT91_SHDW_MR 0x04 /* Shut Down Mode Register */ |
24 | #define AT91_SHDW_WKMODE0 (3 << 0) /* Wake-up 0 Mode Selection */ | 34 | #define AT91_SHDW_WKMODE0 (3 << 0) /* Wake-up 0 Mode Selection */ |
25 | #define AT91_SHDW_WKMODE0_NONE 0 | 35 | #define AT91_SHDW_WKMODE0_NONE 0 |
26 | #define AT91_SHDW_WKMODE0_HIGH 1 | 36 | #define AT91_SHDW_WKMODE0_HIGH 1 |
@@ -30,7 +40,7 @@ | |||
30 | #define AT91_SHDW_CPTWK0_(x) ((x) << 4) | 40 | #define AT91_SHDW_CPTWK0_(x) ((x) << 4) |
31 | #define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */ | 41 | #define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */ |
32 | 42 | ||
33 | #define AT91_SHDW_SR (AT91_SHDWC + 0x08) /* Shut Down Status Register */ | 43 | #define AT91_SHDW_SR 0x08 /* Shut Down Status Register */ |
34 | #define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */ | 44 | #define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */ |
35 | #define AT91_SHDW_RTTWK (1 << 16) /* Real-time Timer Wake-up */ | 45 | #define AT91_SHDW_RTTWK (1 << 16) /* Real-time Timer Wake-up */ |
36 | #define AT91_SHDW_RTCWK (1 << 17) /* Real-time Clock Wake-up [SAM9RL] */ | 46 | #define AT91_SHDW_RTCWK (1 << 17) /* Real-time Clock Wake-up [SAM9RL] */ |
diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h index c5df1e8f1955..4c0e2f6011d7 100644 --- a/arch/arm/mach-at91/include/mach/at91cap9.h +++ b/arch/arm/mach-at91/include/mach/at91cap9.h | |||
@@ -79,29 +79,28 @@ | |||
79 | /* | 79 | /* |
80 | * System Peripherals (offset from AT91_BASE_SYS) | 80 | * System Peripherals (offset from AT91_BASE_SYS) |
81 | */ | 81 | */ |
82 | #define AT91_ECC (0xffffe200 - AT91_BASE_SYS) | ||
83 | #define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS) | 82 | #define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS) |
84 | #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) | 83 | #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) |
85 | #define AT91_SMC (0xffffe800 - AT91_BASE_SYS) | ||
86 | #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) | 84 | #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) |
87 | #define AT91_CCFG (0xffffeb10 - AT91_BASE_SYS) | ||
88 | #define AT91_DMA (0xffffec00 - AT91_BASE_SYS) | ||
89 | #define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) | ||
90 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) | ||
91 | #define AT91_PIOA (0xfffff200 - AT91_BASE_SYS) | ||
92 | #define AT91_PIOB (0xfffff400 - AT91_BASE_SYS) | ||
93 | #define AT91_PIOC (0xfffff600 - AT91_BASE_SYS) | ||
94 | #define AT91_PIOD (0xfffff800 - AT91_BASE_SYS) | ||
95 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 85 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
96 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 86 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
97 | #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) | ||
98 | #define AT91_RTT (0xfffffd20 - AT91_BASE_SYS) | ||
99 | #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) | ||
100 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
101 | #define AT91_GPBR (cpu_is_at91cap9_revB() ? \ | 87 | #define AT91_GPBR (cpu_is_at91cap9_revB() ? \ |
102 | (0xfffffd50 - AT91_BASE_SYS) : \ | 88 | (0xfffffd50 - AT91_BASE_SYS) : \ |
103 | (0xfffffd60 - AT91_BASE_SYS)) | 89 | (0xfffffd60 - AT91_BASE_SYS)) |
104 | 90 | ||
91 | #define AT91CAP9_BASE_ECC 0xffffe200 | ||
92 | #define AT91CAP9_BASE_DMA 0xffffec00 | ||
93 | #define AT91CAP9_BASE_SMC 0xffffe800 | ||
94 | #define AT91CAP9_BASE_DBGU AT91_BASE_DBGU1 | ||
95 | #define AT91CAP9_BASE_PIOA 0xfffff200 | ||
96 | #define AT91CAP9_BASE_PIOB 0xfffff400 | ||
97 | #define AT91CAP9_BASE_PIOC 0xfffff600 | ||
98 | #define AT91CAP9_BASE_PIOD 0xfffff800 | ||
99 | #define AT91CAP9_BASE_SHDWC 0xfffffd10 | ||
100 | #define AT91CAP9_BASE_RTT 0xfffffd20 | ||
101 | #define AT91CAP9_BASE_PIT 0xfffffd30 | ||
102 | #define AT91CAP9_BASE_WDT 0xfffffd40 | ||
103 | |||
105 | #define AT91_USART0 AT91CAP9_BASE_US0 | 104 | #define AT91_USART0 AT91CAP9_BASE_US0 |
106 | #define AT91_USART1 AT91CAP9_BASE_US1 | 105 | #define AT91_USART1 AT91CAP9_BASE_US1 |
107 | #define AT91_USART2 AT91CAP9_BASE_US2 | 106 | #define AT91_USART2 AT91CAP9_BASE_US2 |
diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h b/arch/arm/mach-at91/include/mach/at91rm9200.h index e4037b500302..bacb51141819 100644 --- a/arch/arm/mach-at91/include/mach/at91rm9200.h +++ b/arch/arm/mach-at91/include/mach/at91rm9200.h | |||
@@ -79,17 +79,17 @@ | |||
79 | /* | 79 | /* |
80 | * System Peripherals (offset from AT91_BASE_SYS) | 80 | * System Peripherals (offset from AT91_BASE_SYS) |
81 | */ | 81 | */ |
82 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) /* Advanced Interrupt Controller */ | ||
83 | #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) /* Debug Unit */ | ||
84 | #define AT91_PIOA (0xfffff400 - AT91_BASE_SYS) /* PIO Controller A */ | ||
85 | #define AT91_PIOB (0xfffff600 - AT91_BASE_SYS) /* PIO Controller B */ | ||
86 | #define AT91_PIOC (0xfffff800 - AT91_BASE_SYS) /* PIO Controller C */ | ||
87 | #define AT91_PIOD (0xfffffa00 - AT91_BASE_SYS) /* PIO Controller D */ | ||
88 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) /* Power Management Controller */ | 82 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) /* Power Management Controller */ |
89 | #define AT91_ST (0xfffffd00 - AT91_BASE_SYS) /* System Timer */ | 83 | #define AT91_ST (0xfffffd00 - AT91_BASE_SYS) /* System Timer */ |
90 | #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) /* Real-Time Clock */ | ||
91 | #define AT91_MC (0xffffff00 - AT91_BASE_SYS) /* Memory Controllers */ | 84 | #define AT91_MC (0xffffff00 - AT91_BASE_SYS) /* Memory Controllers */ |
92 | 85 | ||
86 | #define AT91RM9200_BASE_DBGU AT91_BASE_DBGU0 /* Debug Unit */ | ||
87 | #define AT91RM9200_BASE_PIOA 0xfffff400 /* PIO Controller A */ | ||
88 | #define AT91RM9200_BASE_PIOB 0xfffff600 /* PIO Controller B */ | ||
89 | #define AT91RM9200_BASE_PIOC 0xfffff800 /* PIO Controller C */ | ||
90 | #define AT91RM9200_BASE_PIOD 0xfffffa00 /* PIO Controller D */ | ||
91 | #define AT91RM9200_BASE_RTC 0xfffffe00 /* Real-Time Clock */ | ||
92 | |||
93 | #define AT91_USART0 AT91RM9200_BASE_US0 | 93 | #define AT91_USART0 AT91RM9200_BASE_US0 |
94 | #define AT91_USART1 AT91RM9200_BASE_US1 | 94 | #define AT91_USART1 AT91RM9200_BASE_US1 |
95 | #define AT91_USART2 AT91RM9200_BASE_US2 | 95 | #define AT91_USART2 AT91RM9200_BASE_US2 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h index 9a791165913f..f937c476bb67 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9260.h +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h | |||
@@ -80,24 +80,23 @@ | |||
80 | /* | 80 | /* |
81 | * System Peripherals (offset from AT91_BASE_SYS) | 81 | * System Peripherals (offset from AT91_BASE_SYS) |
82 | */ | 82 | */ |
83 | #define AT91_ECC (0xffffe800 - AT91_BASE_SYS) | ||
84 | #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) | 83 | #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) |
85 | #define AT91_SMC (0xffffec00 - AT91_BASE_SYS) | ||
86 | #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) | 84 | #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) |
87 | #define AT91_CCFG (0xffffef10 - AT91_BASE_SYS) | ||
88 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) | ||
89 | #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) | ||
90 | #define AT91_PIOA (0xfffff400 - AT91_BASE_SYS) | ||
91 | #define AT91_PIOB (0xfffff600 - AT91_BASE_SYS) | ||
92 | #define AT91_PIOC (0xfffff800 - AT91_BASE_SYS) | ||
93 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 85 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
94 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 86 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
95 | #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) | ||
96 | #define AT91_RTT (0xfffffd20 - AT91_BASE_SYS) | ||
97 | #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) | ||
98 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
99 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) | 87 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) |
100 | 88 | ||
89 | #define AT91SAM9260_BASE_ECC 0xffffe800 | ||
90 | #define AT91SAM9260_BASE_SMC 0xffffec00 | ||
91 | #define AT91SAM9260_BASE_DBGU AT91_BASE_DBGU0 | ||
92 | #define AT91SAM9260_BASE_PIOA 0xfffff400 | ||
93 | #define AT91SAM9260_BASE_PIOB 0xfffff600 | ||
94 | #define AT91SAM9260_BASE_PIOC 0xfffff800 | ||
95 | #define AT91SAM9260_BASE_SHDWC 0xfffffd10 | ||
96 | #define AT91SAM9260_BASE_RTT 0xfffffd20 | ||
97 | #define AT91SAM9260_BASE_PIT 0xfffffd30 | ||
98 | #define AT91SAM9260_BASE_WDT 0xfffffd40 | ||
99 | |||
101 | #define AT91_USART0 AT91SAM9260_BASE_US0 | 100 | #define AT91_USART0 AT91SAM9260_BASE_US0 |
102 | #define AT91_USART1 AT91SAM9260_BASE_US1 | 101 | #define AT91_USART1 AT91SAM9260_BASE_US1 |
103 | #define AT91_USART2 AT91SAM9260_BASE_US2 | 102 | #define AT91_USART2 AT91SAM9260_BASE_US2 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h index ce596204cefa..175604e261be 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9261.h +++ b/arch/arm/mach-at91/include/mach/at91sam9261.h | |||
@@ -66,21 +66,21 @@ | |||
66 | * System Peripherals (offset from AT91_BASE_SYS) | 66 | * System Peripherals (offset from AT91_BASE_SYS) |
67 | */ | 67 | */ |
68 | #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) | 68 | #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) |
69 | #define AT91_SMC (0xffffec00 - AT91_BASE_SYS) | ||
70 | #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) | 69 | #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) |
71 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) | ||
72 | #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) | ||
73 | #define AT91_PIOA (0xfffff400 - AT91_BASE_SYS) | ||
74 | #define AT91_PIOB (0xfffff600 - AT91_BASE_SYS) | ||
75 | #define AT91_PIOC (0xfffff800 - AT91_BASE_SYS) | ||
76 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 70 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
77 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 71 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
78 | #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) | ||
79 | #define AT91_RTT (0xfffffd20 - AT91_BASE_SYS) | ||
80 | #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) | ||
81 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
82 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) | 72 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) |
83 | 73 | ||
74 | #define AT91SAM9261_BASE_SMC 0xffffec00 | ||
75 | #define AT91SAM9261_BASE_DBGU AT91_BASE_DBGU0 | ||
76 | #define AT91SAM9261_BASE_PIOA 0xfffff400 | ||
77 | #define AT91SAM9261_BASE_PIOB 0xfffff600 | ||
78 | #define AT91SAM9261_BASE_PIOC 0xfffff800 | ||
79 | #define AT91SAM9261_BASE_SHDWC 0xfffffd10 | ||
80 | #define AT91SAM9261_BASE_RTT 0xfffffd20 | ||
81 | #define AT91SAM9261_BASE_PIT 0xfffffd30 | ||
82 | #define AT91SAM9261_BASE_WDT 0xfffffd40 | ||
83 | |||
84 | #define AT91_USART0 AT91SAM9261_BASE_US0 | 84 | #define AT91_USART0 AT91SAM9261_BASE_US0 |
85 | #define AT91_USART1 AT91SAM9261_BASE_US1 | 85 | #define AT91_USART1 AT91SAM9261_BASE_US1 |
86 | #define AT91_USART2 AT91SAM9261_BASE_US2 | 86 | #define AT91_USART2 AT91SAM9261_BASE_US2 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h index f1b92961a2b1..80c915002d83 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9263.h +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h | |||
@@ -74,30 +74,29 @@ | |||
74 | /* | 74 | /* |
75 | * System Peripherals (offset from AT91_BASE_SYS) | 75 | * System Peripherals (offset from AT91_BASE_SYS) |
76 | */ | 76 | */ |
77 | #define AT91_ECC0 (0xffffe000 - AT91_BASE_SYS) | ||
78 | #define AT91_SDRAMC0 (0xffffe200 - AT91_BASE_SYS) | 77 | #define AT91_SDRAMC0 (0xffffe200 - AT91_BASE_SYS) |
79 | #define AT91_SMC0 (0xffffe400 - AT91_BASE_SYS) | ||
80 | #define AT91_ECC1 (0xffffe600 - AT91_BASE_SYS) | ||
81 | #define AT91_SDRAMC1 (0xffffe800 - AT91_BASE_SYS) | 78 | #define AT91_SDRAMC1 (0xffffe800 - AT91_BASE_SYS) |
82 | #define AT91_SMC1 (0xffffea00 - AT91_BASE_SYS) | ||
83 | #define AT91_MATRIX (0xffffec00 - AT91_BASE_SYS) | 79 | #define AT91_MATRIX (0xffffec00 - AT91_BASE_SYS) |
84 | #define AT91_CCFG (0xffffed10 - AT91_BASE_SYS) | ||
85 | #define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) | ||
86 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) | ||
87 | #define AT91_PIOA (0xfffff200 - AT91_BASE_SYS) | ||
88 | #define AT91_PIOB (0xfffff400 - AT91_BASE_SYS) | ||
89 | #define AT91_PIOC (0xfffff600 - AT91_BASE_SYS) | ||
90 | #define AT91_PIOD (0xfffff800 - AT91_BASE_SYS) | ||
91 | #define AT91_PIOE (0xfffffa00 - AT91_BASE_SYS) | ||
92 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 80 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
93 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 81 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
94 | #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) | ||
95 | #define AT91_RTT0 (0xfffffd20 - AT91_BASE_SYS) | ||
96 | #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) | ||
97 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
98 | #define AT91_RTT1 (0xfffffd50 - AT91_BASE_SYS) | ||
99 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | 82 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) |
100 | 83 | ||
84 | #define AT91SAM9263_BASE_ECC0 0xffffe000 | ||
85 | #define AT91SAM9263_BASE_SMC0 0xffffe400 | ||
86 | #define AT91SAM9263_BASE_ECC1 0xffffe600 | ||
87 | #define AT91SAM9263_BASE_SMC1 0xffffea00 | ||
88 | #define AT91SAM9263_BASE_DBGU AT91_BASE_DBGU1 | ||
89 | #define AT91SAM9263_BASE_PIOA 0xfffff200 | ||
90 | #define AT91SAM9263_BASE_PIOB 0xfffff400 | ||
91 | #define AT91SAM9263_BASE_PIOC 0xfffff600 | ||
92 | #define AT91SAM9263_BASE_PIOD 0xfffff800 | ||
93 | #define AT91SAM9263_BASE_PIOE 0xfffffa00 | ||
94 | #define AT91SAM9263_BASE_SHDWC 0xfffffd10 | ||
95 | #define AT91SAM9263_BASE_RTT0 0xfffffd20 | ||
96 | #define AT91SAM9263_BASE_PIT 0xfffffd30 | ||
97 | #define AT91SAM9263_BASE_WDT 0xfffffd40 | ||
98 | #define AT91SAM9263_BASE_RTT1 0xfffffd50 | ||
99 | |||
101 | #define AT91_USART0 AT91SAM9263_BASE_US0 | 100 | #define AT91_USART0 AT91SAM9263_BASE_US0 |
102 | #define AT91_USART1 AT91SAM9263_BASE_US1 | 101 | #define AT91_USART1 AT91SAM9263_BASE_US1 |
103 | #define AT91_USART2 AT91SAM9263_BASE_US2 | 102 | #define AT91_USART2 AT91SAM9263_BASE_US2 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_smc.h b/arch/arm/mach-at91/include/mach/at91sam9_smc.h index 57de6207e57e..eb18a70fa647 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9_smc.h +++ b/arch/arm/mach-at91/include/mach/at91sam9_smc.h | |||
@@ -16,7 +16,9 @@ | |||
16 | #ifndef AT91SAM9_SMC_H | 16 | #ifndef AT91SAM9_SMC_H |
17 | #define AT91SAM9_SMC_H | 17 | #define AT91SAM9_SMC_H |
18 | 18 | ||
19 | #define AT91_SMC_SETUP(n) (AT91_SMC + 0x00 + ((n)*0x10)) /* Setup Register for CS n */ | 19 | #include <mach/cpu.h> |
20 | |||
21 | #define AT91_SMC_SETUP 0x00 /* Setup Register for CS n */ | ||
20 | #define AT91_SMC_NWESETUP (0x3f << 0) /* NWE Setup Length */ | 22 | #define AT91_SMC_NWESETUP (0x3f << 0) /* NWE Setup Length */ |
21 | #define AT91_SMC_NWESETUP_(x) ((x) << 0) | 23 | #define AT91_SMC_NWESETUP_(x) ((x) << 0) |
22 | #define AT91_SMC_NCS_WRSETUP (0x3f << 8) /* NCS Setup Length in Write Access */ | 24 | #define AT91_SMC_NCS_WRSETUP (0x3f << 8) /* NCS Setup Length in Write Access */ |
@@ -26,7 +28,7 @@ | |||
26 | #define AT91_SMC_NCS_RDSETUP (0x3f << 24) /* NCS Setup Length in Read Access */ | 28 | #define AT91_SMC_NCS_RDSETUP (0x3f << 24) /* NCS Setup Length in Read Access */ |
27 | #define AT91_SMC_NCS_RDSETUP_(x) ((x) << 24) | 29 | #define AT91_SMC_NCS_RDSETUP_(x) ((x) << 24) |
28 | 30 | ||
29 | #define AT91_SMC_PULSE(n) (AT91_SMC + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */ | 31 | #define AT91_SMC_PULSE 0x04 /* Pulse Register for CS n */ |
30 | #define AT91_SMC_NWEPULSE (0x7f << 0) /* NWE Pulse Length */ | 32 | #define AT91_SMC_NWEPULSE (0x7f << 0) /* NWE Pulse Length */ |
31 | #define AT91_SMC_NWEPULSE_(x) ((x) << 0) | 33 | #define AT91_SMC_NWEPULSE_(x) ((x) << 0) |
32 | #define AT91_SMC_NCS_WRPULSE (0x7f << 8) /* NCS Pulse Length in Write Access */ | 34 | #define AT91_SMC_NCS_WRPULSE (0x7f << 8) /* NCS Pulse Length in Write Access */ |
@@ -36,13 +38,13 @@ | |||
36 | #define AT91_SMC_NCS_RDPULSE (0x7f << 24) /* NCS Pulse Length in Read Access */ | 38 | #define AT91_SMC_NCS_RDPULSE (0x7f << 24) /* NCS Pulse Length in Read Access */ |
37 | #define AT91_SMC_NCS_RDPULSE_(x)((x) << 24) | 39 | #define AT91_SMC_NCS_RDPULSE_(x)((x) << 24) |
38 | 40 | ||
39 | #define AT91_SMC_CYCLE(n) (AT91_SMC + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */ | 41 | #define AT91_SMC_CYCLE 0x08 /* Cycle Register for CS n */ |
40 | #define AT91_SMC_NWECYCLE (0x1ff << 0 ) /* Total Write Cycle Length */ | 42 | #define AT91_SMC_NWECYCLE (0x1ff << 0 ) /* Total Write Cycle Length */ |
41 | #define AT91_SMC_NWECYCLE_(x) ((x) << 0) | 43 | #define AT91_SMC_NWECYCLE_(x) ((x) << 0) |
42 | #define AT91_SMC_NRDCYCLE (0x1ff << 16) /* Total Read Cycle Length */ | 44 | #define AT91_SMC_NRDCYCLE (0x1ff << 16) /* Total Read Cycle Length */ |
43 | #define AT91_SMC_NRDCYCLE_(x) ((x) << 16) | 45 | #define AT91_SMC_NRDCYCLE_(x) ((x) << 16) |
44 | 46 | ||
45 | #define AT91_SMC_MODE(n) (AT91_SMC + 0x0c + ((n)*0x10)) /* Mode Register for CS n */ | 47 | #define AT91_SMC_MODE 0x0c /* Mode Register for CS n */ |
46 | #define AT91_SMC_READMODE (1 << 0) /* Read Mode */ | 48 | #define AT91_SMC_READMODE (1 << 0) /* Read Mode */ |
47 | #define AT91_SMC_WRITEMODE (1 << 1) /* Write Mode */ | 49 | #define AT91_SMC_WRITEMODE (1 << 1) /* Write Mode */ |
48 | #define AT91_SMC_EXNWMODE (3 << 4) /* NWAIT Mode */ | 50 | #define AT91_SMC_EXNWMODE (3 << 4) /* NWAIT Mode */ |
@@ -66,11 +68,4 @@ | |||
66 | #define AT91_SMC_PS_16 (2 << 28) | 68 | #define AT91_SMC_PS_16 (2 << 28) |
67 | #define AT91_SMC_PS_32 (3 << 28) | 69 | #define AT91_SMC_PS_32 (3 << 28) |
68 | 70 | ||
69 | #if defined(AT91_SMC1) /* The AT91SAM9263 has 2 Static Memory contollers */ | ||
70 | #define AT91_SMC1_SETUP(n) (AT91_SMC1 + 0x00 + ((n)*0x10)) /* Setup Register for CS n */ | ||
71 | #define AT91_SMC1_PULSE(n) (AT91_SMC1 + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */ | ||
72 | #define AT91_SMC1_CYCLE(n) (AT91_SMC1 + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */ | ||
73 | #define AT91_SMC1_MODE(n) (AT91_SMC1 + 0x0c + ((n)*0x10)) /* Mode Register for CS n */ | ||
74 | #endif | ||
75 | |||
76 | #endif | 71 | #endif |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h index 406bb6496805..f0c23c960dec 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h | |||
@@ -86,27 +86,27 @@ | |||
86 | /* | 86 | /* |
87 | * System Peripherals (offset from AT91_BASE_SYS) | 87 | * System Peripherals (offset from AT91_BASE_SYS) |
88 | */ | 88 | */ |
89 | #define AT91_ECC (0xffffe200 - AT91_BASE_SYS) | ||
90 | #define AT91_DDRSDRC1 (0xffffe400 - AT91_BASE_SYS) | 89 | #define AT91_DDRSDRC1 (0xffffe400 - AT91_BASE_SYS) |
91 | #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) | 90 | #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) |
92 | #define AT91_SMC (0xffffe800 - AT91_BASE_SYS) | ||
93 | #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) | 91 | #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) |
94 | #define AT91_DMA (0xffffec00 - AT91_BASE_SYS) | ||
95 | #define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) | ||
96 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) | ||
97 | #define AT91_PIOA (0xfffff200 - AT91_BASE_SYS) | ||
98 | #define AT91_PIOB (0xfffff400 - AT91_BASE_SYS) | ||
99 | #define AT91_PIOC (0xfffff600 - AT91_BASE_SYS) | ||
100 | #define AT91_PIOD (0xfffff800 - AT91_BASE_SYS) | ||
101 | #define AT91_PIOE (0xfffffa00 - AT91_BASE_SYS) | ||
102 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 92 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
103 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 93 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
104 | #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) | ||
105 | #define AT91_RTT (0xfffffd20 - AT91_BASE_SYS) | ||
106 | #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) | ||
107 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
108 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | 94 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) |
109 | #define AT91_RTC (0xfffffdb0 - AT91_BASE_SYS) | 95 | |
96 | #define AT91SAM9G45_BASE_ECC 0xffffe200 | ||
97 | #define AT91SAM9G45_BASE_DMA 0xffffec00 | ||
98 | #define AT91SAM9G45_BASE_SMC 0xffffe800 | ||
99 | #define AT91SAM9G45_BASE_DBGU AT91_BASE_DBGU1 | ||
100 | #define AT91SAM9G45_BASE_PIOA 0xfffff200 | ||
101 | #define AT91SAM9G45_BASE_PIOB 0xfffff400 | ||
102 | #define AT91SAM9G45_BASE_PIOC 0xfffff600 | ||
103 | #define AT91SAM9G45_BASE_PIOD 0xfffff800 | ||
104 | #define AT91SAM9G45_BASE_PIOE 0xfffffa00 | ||
105 | #define AT91SAM9G45_BASE_SHDWC 0xfffffd10 | ||
106 | #define AT91SAM9G45_BASE_RTT 0xfffffd20 | ||
107 | #define AT91SAM9G45_BASE_PIT 0xfffffd30 | ||
108 | #define AT91SAM9G45_BASE_WDT 0xfffffd40 | ||
109 | #define AT91SAM9G45_BASE_RTC 0xfffffdb0 | ||
110 | 110 | ||
111 | #define AT91_USART0 AT91SAM9G45_BASE_US0 | 111 | #define AT91_USART0 AT91SAM9G45_BASE_US0 |
112 | #define AT91_USART1 AT91SAM9G45_BASE_US1 | 112 | #define AT91_USART1 AT91SAM9G45_BASE_US1 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h index 1aabacd315d4..2bb359e60b97 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h | |||
@@ -69,27 +69,26 @@ | |||
69 | /* | 69 | /* |
70 | * System Peripherals (offset from AT91_BASE_SYS) | 70 | * System Peripherals (offset from AT91_BASE_SYS) |
71 | */ | 71 | */ |
72 | #define AT91_DMA (0xffffe600 - AT91_BASE_SYS) | ||
73 | #define AT91_ECC (0xffffe800 - AT91_BASE_SYS) | ||
74 | #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) | 72 | #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) |
75 | #define AT91_SMC (0xffffec00 - AT91_BASE_SYS) | ||
76 | #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) | 73 | #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) |
77 | #define AT91_CCFG (0xffffef10 - AT91_BASE_SYS) | ||
78 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) | ||
79 | #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) | ||
80 | #define AT91_PIOA (0xfffff400 - AT91_BASE_SYS) | ||
81 | #define AT91_PIOB (0xfffff600 - AT91_BASE_SYS) | ||
82 | #define AT91_PIOC (0xfffff800 - AT91_BASE_SYS) | ||
83 | #define AT91_PIOD (0xfffffa00 - AT91_BASE_SYS) | ||
84 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 74 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
85 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 75 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
86 | #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) | ||
87 | #define AT91_RTT (0xfffffd20 - AT91_BASE_SYS) | ||
88 | #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) | ||
89 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
90 | #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) | 76 | #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) |
91 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | 77 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) |
92 | #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) | 78 | |
79 | #define AT91SAM9RL_BASE_DMA 0xffffe600 | ||
80 | #define AT91SAM9RL_BASE_ECC 0xffffe800 | ||
81 | #define AT91SAM9RL_BASE_SMC 0xffffec00 | ||
82 | #define AT91SAM9RL_BASE_DBGU AT91_BASE_DBGU0 | ||
83 | #define AT91SAM9RL_BASE_PIOA 0xfffff400 | ||
84 | #define AT91SAM9RL_BASE_PIOB 0xfffff600 | ||
85 | #define AT91SAM9RL_BASE_PIOC 0xfffff800 | ||
86 | #define AT91SAM9RL_BASE_PIOD 0xfffffa00 | ||
87 | #define AT91SAM9RL_BASE_SHDWC 0xfffffd10 | ||
88 | #define AT91SAM9RL_BASE_RTT 0xfffffd20 | ||
89 | #define AT91SAM9RL_BASE_PIT 0xfffffd30 | ||
90 | #define AT91SAM9RL_BASE_WDT 0xfffffd40 | ||
91 | #define AT91SAM9RL_BASE_RTC 0xfffffe00 | ||
93 | 92 | ||
94 | #define AT91_USART0 AT91SAM9RL_BASE_US0 | 93 | #define AT91_USART0 AT91SAM9RL_BASE_US0 |
95 | #define AT91_USART1 AT91SAM9RL_BASE_US1 | 94 | #define AT91_USART1 AT91SAM9RL_BASE_US1 |
diff --git a/arch/arm/mach-at91/include/mach/at91x40.h b/arch/arm/mach-at91/include/mach/at91x40.h index a152ff87e688..a57829f4fd18 100644 --- a/arch/arm/mach-at91/include/mach/at91x40.h +++ b/arch/arm/mach-at91/include/mach/at91x40.h | |||
@@ -40,7 +40,6 @@ | |||
40 | #define AT91_PIOA (0xffff0000 - AT91_BASE_SYS) /* PIO Controller A */ | 40 | #define AT91_PIOA (0xffff0000 - AT91_BASE_SYS) /* PIO Controller A */ |
41 | #define AT91_PS (0xffff4000 - AT91_BASE_SYS) /* Power Save */ | 41 | #define AT91_PS (0xffff4000 - AT91_BASE_SYS) /* Power Save */ |
42 | #define AT91_WD (0xffff8000 - AT91_BASE_SYS) /* Watchdog Timer */ | 42 | #define AT91_WD (0xffff8000 - AT91_BASE_SYS) /* Watchdog Timer */ |
43 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) /* Advanced Interrupt Controller */ | ||
44 | 43 | ||
45 | /* | 44 | /* |
46 | * The AT91x40 series doesn't have a debug unit like the other AT91 parts. | 45 | * The AT91x40 series doesn't have a debug unit like the other AT91 parts. |
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h index eac92e995bb5..d0b377b21bd7 100644 --- a/arch/arm/mach-at91/include/mach/board.h +++ b/arch/arm/mach-at91/include/mach/board.h | |||
@@ -40,13 +40,14 @@ | |||
40 | #include <linux/atmel-mci.h> | 40 | #include <linux/atmel-mci.h> |
41 | #include <sound/atmel-ac97c.h> | 41 | #include <sound/atmel-ac97c.h> |
42 | #include <linux/serial.h> | 42 | #include <linux/serial.h> |
43 | #include <linux/platform_data/macb.h> | ||
43 | 44 | ||
44 | /* USB Device */ | 45 | /* USB Device */ |
45 | struct at91_udc_data { | 46 | struct at91_udc_data { |
46 | u8 vbus_pin; /* high == host powering us */ | 47 | int vbus_pin; /* high == host powering us */ |
47 | u8 vbus_active_low; /* vbus polarity */ | 48 | u8 vbus_active_low; /* vbus polarity */ |
48 | u8 vbus_polled; /* Use polling, not interrupt */ | 49 | u8 vbus_polled; /* Use polling, not interrupt */ |
49 | u8 pullup_pin; /* active == D+ pulled up */ | 50 | int pullup_pin; /* active == D+ pulled up */ |
50 | u8 pullup_active_low; /* true == pullup_pin is active low */ | 51 | u8 pullup_active_low; /* true == pullup_pin is active low */ |
51 | }; | 52 | }; |
52 | extern void __init at91_add_device_udc(struct at91_udc_data *data); | 53 | extern void __init at91_add_device_udc(struct at91_udc_data *data); |
@@ -56,10 +57,10 @@ extern void __init at91_add_device_usba(struct usba_platform_data *data); | |||
56 | 57 | ||
57 | /* Compact Flash */ | 58 | /* Compact Flash */ |
58 | struct at91_cf_data { | 59 | struct at91_cf_data { |
59 | u8 irq_pin; /* I/O IRQ */ | 60 | int irq_pin; /* I/O IRQ */ |
60 | u8 det_pin; /* Card detect */ | 61 | int det_pin; /* Card detect */ |
61 | u8 vcc_pin; /* power switching */ | 62 | int vcc_pin; /* power switching */ |
62 | u8 rst_pin; /* card reset */ | 63 | int rst_pin; /* card reset */ |
63 | u8 chipselect; /* EBI Chip Select number */ | 64 | u8 chipselect; /* EBI Chip Select number */ |
64 | u8 flags; | 65 | u8 flags; |
65 | #define AT91_CF_TRUE_IDE 0x01 | 66 | #define AT91_CF_TRUE_IDE 0x01 |
@@ -70,37 +71,26 @@ extern void __init at91_add_device_cf(struct at91_cf_data *data); | |||
70 | /* MMC / SD */ | 71 | /* MMC / SD */ |
71 | /* at91_mci platform config */ | 72 | /* at91_mci platform config */ |
72 | struct at91_mmc_data { | 73 | struct at91_mmc_data { |
73 | u8 det_pin; /* card detect IRQ */ | 74 | int det_pin; /* card detect IRQ */ |
74 | unsigned slot_b:1; /* uses Slot B */ | 75 | unsigned slot_b:1; /* uses Slot B */ |
75 | unsigned wire4:1; /* (SD) supports DAT0..DAT3 */ | 76 | unsigned wire4:1; /* (SD) supports DAT0..DAT3 */ |
76 | u8 wp_pin; /* (SD) writeprotect detect */ | 77 | int wp_pin; /* (SD) writeprotect detect */ |
77 | u8 vcc_pin; /* power switching (high == on) */ | 78 | int vcc_pin; /* power switching (high == on) */ |
78 | }; | 79 | }; |
79 | extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data); | 80 | extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data); |
80 | 81 | ||
81 | /* atmel-mci platform config */ | 82 | /* atmel-mci platform config */ |
82 | extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data); | 83 | extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data); |
83 | 84 | ||
84 | /* Ethernet (EMAC & MACB) */ | 85 | extern void __init at91_add_device_eth(struct macb_platform_data *data); |
85 | struct at91_eth_data { | ||
86 | u32 phy_mask; | ||
87 | u8 phy_irq_pin; /* PHY IRQ */ | ||
88 | u8 is_rmii; /* using RMII interface? */ | ||
89 | }; | ||
90 | extern void __init at91_add_device_eth(struct at91_eth_data *data); | ||
91 | |||
92 | #if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9263) || defined(CONFIG_ARCH_AT91SAM9G20) || defined(CONFIG_ARCH_AT91CAP9) \ | ||
93 | || defined(CONFIG_ARCH_AT91SAM9G45) | ||
94 | #define eth_platform_data at91_eth_data | ||
95 | #endif | ||
96 | 86 | ||
97 | /* USB Host */ | 87 | /* USB Host */ |
98 | struct at91_usbh_data { | 88 | struct at91_usbh_data { |
99 | u8 ports; /* number of ports on root hub */ | 89 | u8 ports; /* number of ports on root hub */ |
100 | u8 vbus_pin[2]; /* port power-control pin */ | 90 | int vbus_pin[2]; /* port power-control pin */ |
101 | u8 vbus_pin_inverted; | 91 | u8 vbus_pin_inverted; |
102 | u8 overcurrent_supported; | 92 | u8 overcurrent_supported; |
103 | u8 overcurrent_pin[2]; | 93 | int overcurrent_pin[2]; |
104 | u8 overcurrent_status[2]; | 94 | u8 overcurrent_status[2]; |
105 | u8 overcurrent_changed[2]; | 95 | u8 overcurrent_changed[2]; |
106 | }; | 96 | }; |
@@ -110,9 +100,9 @@ extern void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data); | |||
110 | 100 | ||
111 | /* NAND / SmartMedia */ | 101 | /* NAND / SmartMedia */ |
112 | struct atmel_nand_data { | 102 | struct atmel_nand_data { |
113 | u8 enable_pin; /* chip enable */ | 103 | int enable_pin; /* chip enable */ |
114 | u8 det_pin; /* card detect */ | 104 | int det_pin; /* card detect */ |
115 | u8 rdy_pin; /* ready/busy */ | 105 | int rdy_pin; /* ready/busy */ |
116 | u8 rdy_pin_active_low; /* rdy_pin value is inverted */ | 106 | u8 rdy_pin_active_low; /* rdy_pin value is inverted */ |
117 | u8 ale; /* address line number connected to ALE */ | 107 | u8 ale; /* address line number connected to ALE */ |
118 | u8 cle; /* address line number connected to CLE */ | 108 | u8 cle; /* address line number connected to CLE */ |
diff --git a/arch/arm/mach-at91/include/mach/debug-macro.S b/arch/arm/mach-at91/include/mach/debug-macro.S index 0ed8648c6452..c6bb9e2d9baa 100644 --- a/arch/arm/mach-at91/include/mach/debug-macro.S +++ b/arch/arm/mach-at91/include/mach/debug-macro.S | |||
@@ -14,9 +14,15 @@ | |||
14 | #include <mach/hardware.h> | 14 | #include <mach/hardware.h> |
15 | #include <mach/at91_dbgu.h> | 15 | #include <mach/at91_dbgu.h> |
16 | 16 | ||
17 | #if defined(CONFIG_AT91_DEBUG_LL_DBGU0) | ||
18 | #define AT91_DBGU AT91_BASE_DBGU0 | ||
19 | #else | ||
20 | #define AT91_DBGU AT91_BASE_DBGU1 | ||
21 | #endif | ||
22 | |||
17 | .macro addruart, rp, rv, tmp | 23 | .macro addruart, rp, rv, tmp |
18 | ldr \rp, =(AT91_BASE_SYS + AT91_DBGU) @ System peripherals (phys address) | 24 | ldr \rp, =AT91_DBGU @ System peripherals (phys address) |
19 | ldr \rv, =(AT91_VA_BASE_SYS + AT91_DBGU) @ System peripherals (virt address) | 25 | ldr \rv, =AT91_IO_P2V(AT91_DBGU) @ System peripherals (virt address) |
20 | .endm | 26 | .endm |
21 | 27 | ||
22 | .macro senduart,rd,rx | 28 | .macro senduart,rd,rx |
diff --git a/arch/arm/mach-at91/include/mach/entry-macro.S b/arch/arm/mach-at91/include/mach/entry-macro.S index 7ab68f972227..423eea0ed74c 100644 --- a/arch/arm/mach-at91/include/mach/entry-macro.S +++ b/arch/arm/mach-at91/include/mach/entry-macro.S | |||
@@ -17,16 +17,17 @@ | |||
17 | .endm | 17 | .endm |
18 | 18 | ||
19 | .macro get_irqnr_preamble, base, tmp | 19 | .macro get_irqnr_preamble, base, tmp |
20 | ldr \base, =(AT91_VA_BASE_SYS + AT91_AIC) @ base virtual address of AIC peripheral | 20 | ldr \base, =at91_aic_base @ base virtual address of AIC peripheral |
21 | ldr \base, [\base] | ||
21 | .endm | 22 | .endm |
22 | 23 | ||
23 | .macro arch_ret_to_user, tmp1, tmp2 | 24 | .macro arch_ret_to_user, tmp1, tmp2 |
24 | .endm | 25 | .endm |
25 | 26 | ||
26 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | 27 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp |
27 | ldr \irqnr, [\base, #(AT91_AIC_IVR - AT91_AIC)] @ read IRQ vector register: de-asserts nIRQ to processor (and clears interrupt) | 28 | ldr \irqnr, [\base, #AT91_AIC_IVR] @ read IRQ vector register: de-asserts nIRQ to processor (and clears interrupt) |
28 | ldr \irqstat, [\base, #(AT91_AIC_ISR - AT91_AIC)] @ read interrupt source number | 29 | ldr \irqstat, [\base, #AT91_AIC_ISR] @ read interrupt source number |
29 | teq \irqstat, #0 @ ISR is 0 when no current interrupt, or spurious interrupt | 30 | teq \irqstat, #0 @ ISR is 0 when no current interrupt, or spurious interrupt |
30 | streq \tmp, [\base, #(AT91_AIC_EOICR - AT91_AIC)] @ not going to be handled further, then ACK it now. | 31 | streq \tmp, [\base, #AT91_AIC_EOICR] @ not going to be handled further, then ACK it now. |
31 | .endm | 32 | .endm |
32 | 33 | ||
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h index 2b9a1f51210f..e3fd225121c7 100644 --- a/arch/arm/mach-at91/include/mach/gpio.h +++ b/arch/arm/mach-at91/include/mach/gpio.h | |||
@@ -16,177 +16,175 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
18 | 18 | ||
19 | #define PIN_BASE NR_AIC_IRQS | ||
20 | |||
21 | #define MAX_GPIO_BANKS 5 | 19 | #define MAX_GPIO_BANKS 5 |
22 | #define NR_BUILTIN_GPIO (PIN_BASE + (MAX_GPIO_BANKS * 32)) | 20 | #define NR_BUILTIN_GPIO (MAX_GPIO_BANKS * 32) |
23 | 21 | ||
24 | /* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */ | 22 | /* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */ |
25 | 23 | ||
26 | #define AT91_PIN_PA0 (PIN_BASE + 0x00 + 0) | 24 | #define AT91_PIN_PA0 (0x00 + 0) |
27 | #define AT91_PIN_PA1 (PIN_BASE + 0x00 + 1) | 25 | #define AT91_PIN_PA1 (0x00 + 1) |
28 | #define AT91_PIN_PA2 (PIN_BASE + 0x00 + 2) | 26 | #define AT91_PIN_PA2 (0x00 + 2) |
29 | #define AT91_PIN_PA3 (PIN_BASE + 0x00 + 3) | 27 | #define AT91_PIN_PA3 (0x00 + 3) |
30 | #define AT91_PIN_PA4 (PIN_BASE + 0x00 + 4) | 28 | #define AT91_PIN_PA4 (0x00 + 4) |
31 | #define AT91_PIN_PA5 (PIN_BASE + 0x00 + 5) | 29 | #define AT91_PIN_PA5 (0x00 + 5) |
32 | #define AT91_PIN_PA6 (PIN_BASE + 0x00 + 6) | 30 | #define AT91_PIN_PA6 (0x00 + 6) |
33 | #define AT91_PIN_PA7 (PIN_BASE + 0x00 + 7) | 31 | #define AT91_PIN_PA7 (0x00 + 7) |
34 | #define AT91_PIN_PA8 (PIN_BASE + 0x00 + 8) | 32 | #define AT91_PIN_PA8 (0x00 + 8) |
35 | #define AT91_PIN_PA9 (PIN_BASE + 0x00 + 9) | 33 | #define AT91_PIN_PA9 (0x00 + 9) |
36 | #define AT91_PIN_PA10 (PIN_BASE + 0x00 + 10) | 34 | #define AT91_PIN_PA10 (0x00 + 10) |
37 | #define AT91_PIN_PA11 (PIN_BASE + 0x00 + 11) | 35 | #define AT91_PIN_PA11 (0x00 + 11) |
38 | #define AT91_PIN_PA12 (PIN_BASE + 0x00 + 12) | 36 | #define AT91_PIN_PA12 (0x00 + 12) |
39 | #define AT91_PIN_PA13 (PIN_BASE + 0x00 + 13) | 37 | #define AT91_PIN_PA13 (0x00 + 13) |
40 | #define AT91_PIN_PA14 (PIN_BASE + 0x00 + 14) | 38 | #define AT91_PIN_PA14 (0x00 + 14) |
41 | #define AT91_PIN_PA15 (PIN_BASE + 0x00 + 15) | 39 | #define AT91_PIN_PA15 (0x00 + 15) |
42 | #define AT91_PIN_PA16 (PIN_BASE + 0x00 + 16) | 40 | #define AT91_PIN_PA16 (0x00 + 16) |
43 | #define AT91_PIN_PA17 (PIN_BASE + 0x00 + 17) | 41 | #define AT91_PIN_PA17 (0x00 + 17) |
44 | #define AT91_PIN_PA18 (PIN_BASE + 0x00 + 18) | 42 | #define AT91_PIN_PA18 (0x00 + 18) |
45 | #define AT91_PIN_PA19 (PIN_BASE + 0x00 + 19) | 43 | #define AT91_PIN_PA19 (0x00 + 19) |
46 | #define AT91_PIN_PA20 (PIN_BASE + 0x00 + 20) | 44 | #define AT91_PIN_PA20 (0x00 + 20) |
47 | #define AT91_PIN_PA21 (PIN_BASE + 0x00 + 21) | 45 | #define AT91_PIN_PA21 (0x00 + 21) |
48 | #define AT91_PIN_PA22 (PIN_BASE + 0x00 + 22) | 46 | #define AT91_PIN_PA22 (0x00 + 22) |
49 | #define AT91_PIN_PA23 (PIN_BASE + 0x00 + 23) | 47 | #define AT91_PIN_PA23 (0x00 + 23) |
50 | #define AT91_PIN_PA24 (PIN_BASE + 0x00 + 24) | 48 | #define AT91_PIN_PA24 (0x00 + 24) |
51 | #define AT91_PIN_PA25 (PIN_BASE + 0x00 + 25) | 49 | #define AT91_PIN_PA25 (0x00 + 25) |
52 | #define AT91_PIN_PA26 (PIN_BASE + 0x00 + 26) | 50 | #define AT91_PIN_PA26 (0x00 + 26) |
53 | #define AT91_PIN_PA27 (PIN_BASE + 0x00 + 27) | 51 | #define AT91_PIN_PA27 (0x00 + 27) |
54 | #define AT91_PIN_PA28 (PIN_BASE + 0x00 + 28) | 52 | #define AT91_PIN_PA28 (0x00 + 28) |
55 | #define AT91_PIN_PA29 (PIN_BASE + 0x00 + 29) | 53 | #define AT91_PIN_PA29 (0x00 + 29) |
56 | #define AT91_PIN_PA30 (PIN_BASE + 0x00 + 30) | 54 | #define AT91_PIN_PA30 (0x00 + 30) |
57 | #define AT91_PIN_PA31 (PIN_BASE + 0x00 + 31) | 55 | #define AT91_PIN_PA31 (0x00 + 31) |
58 | 56 | ||
59 | #define AT91_PIN_PB0 (PIN_BASE + 0x20 + 0) | 57 | #define AT91_PIN_PB0 (0x20 + 0) |
60 | #define AT91_PIN_PB1 (PIN_BASE + 0x20 + 1) | 58 | #define AT91_PIN_PB1 (0x20 + 1) |
61 | #define AT91_PIN_PB2 (PIN_BASE + 0x20 + 2) | 59 | #define AT91_PIN_PB2 (0x20 + 2) |
62 | #define AT91_PIN_PB3 (PIN_BASE + 0x20 + 3) | 60 | #define AT91_PIN_PB3 (0x20 + 3) |
63 | #define AT91_PIN_PB4 (PIN_BASE + 0x20 + 4) | 61 | #define AT91_PIN_PB4 (0x20 + 4) |
64 | #define AT91_PIN_PB5 (PIN_BASE + 0x20 + 5) | 62 | #define AT91_PIN_PB5 (0x20 + 5) |
65 | #define AT91_PIN_PB6 (PIN_BASE + 0x20 + 6) | 63 | #define AT91_PIN_PB6 (0x20 + 6) |
66 | #define AT91_PIN_PB7 (PIN_BASE + 0x20 + 7) | 64 | #define AT91_PIN_PB7 (0x20 + 7) |
67 | #define AT91_PIN_PB8 (PIN_BASE + 0x20 + 8) | 65 | #define AT91_PIN_PB8 (0x20 + 8) |
68 | #define AT91_PIN_PB9 (PIN_BASE + 0x20 + 9) | 66 | #define AT91_PIN_PB9 (0x20 + 9) |
69 | #define AT91_PIN_PB10 (PIN_BASE + 0x20 + 10) | 67 | #define AT91_PIN_PB10 (0x20 + 10) |
70 | #define AT91_PIN_PB11 (PIN_BASE + 0x20 + 11) | 68 | #define AT91_PIN_PB11 (0x20 + 11) |
71 | #define AT91_PIN_PB12 (PIN_BASE + 0x20 + 12) | 69 | #define AT91_PIN_PB12 (0x20 + 12) |
72 | #define AT91_PIN_PB13 (PIN_BASE + 0x20 + 13) | 70 | #define AT91_PIN_PB13 (0x20 + 13) |
73 | #define AT91_PIN_PB14 (PIN_BASE + 0x20 + 14) | 71 | #define AT91_PIN_PB14 (0x20 + 14) |
74 | #define AT91_PIN_PB15 (PIN_BASE + 0x20 + 15) | 72 | #define AT91_PIN_PB15 (0x20 + 15) |
75 | #define AT91_PIN_PB16 (PIN_BASE + 0x20 + 16) | 73 | #define AT91_PIN_PB16 (0x20 + 16) |
76 | #define AT91_PIN_PB17 (PIN_BASE + 0x20 + 17) | 74 | #define AT91_PIN_PB17 (0x20 + 17) |
77 | #define AT91_PIN_PB18 (PIN_BASE + 0x20 + 18) | 75 | #define AT91_PIN_PB18 (0x20 + 18) |
78 | #define AT91_PIN_PB19 (PIN_BASE + 0x20 + 19) | 76 | #define AT91_PIN_PB19 (0x20 + 19) |
79 | #define AT91_PIN_PB20 (PIN_BASE + 0x20 + 20) | 77 | #define AT91_PIN_PB20 (0x20 + 20) |
80 | #define AT91_PIN_PB21 (PIN_BASE + 0x20 + 21) | 78 | #define AT91_PIN_PB21 (0x20 + 21) |
81 | #define AT91_PIN_PB22 (PIN_BASE + 0x20 + 22) | 79 | #define AT91_PIN_PB22 (0x20 + 22) |
82 | #define AT91_PIN_PB23 (PIN_BASE + 0x20 + 23) | 80 | #define AT91_PIN_PB23 (0x20 + 23) |
83 | #define AT91_PIN_PB24 (PIN_BASE + 0x20 + 24) | 81 | #define AT91_PIN_PB24 (0x20 + 24) |
84 | #define AT91_PIN_PB25 (PIN_BASE + 0x20 + 25) | 82 | #define AT91_PIN_PB25 (0x20 + 25) |
85 | #define AT91_PIN_PB26 (PIN_BASE + 0x20 + 26) | 83 | #define AT91_PIN_PB26 (0x20 + 26) |
86 | #define AT91_PIN_PB27 (PIN_BASE + 0x20 + 27) | 84 | #define AT91_PIN_PB27 (0x20 + 27) |
87 | #define AT91_PIN_PB28 (PIN_BASE + 0x20 + 28) | 85 | #define AT91_PIN_PB28 (0x20 + 28) |
88 | #define AT91_PIN_PB29 (PIN_BASE + 0x20 + 29) | 86 | #define AT91_PIN_PB29 (0x20 + 29) |
89 | #define AT91_PIN_PB30 (PIN_BASE + 0x20 + 30) | 87 | #define AT91_PIN_PB30 (0x20 + 30) |
90 | #define AT91_PIN_PB31 (PIN_BASE + 0x20 + 31) | 88 | #define AT91_PIN_PB31 (0x20 + 31) |
91 | 89 | ||
92 | #define AT91_PIN_PC0 (PIN_BASE + 0x40 + 0) | 90 | #define AT91_PIN_PC0 (0x40 + 0) |
93 | #define AT91_PIN_PC1 (PIN_BASE + 0x40 + 1) | 91 | #define AT91_PIN_PC1 (0x40 + 1) |
94 | #define AT91_PIN_PC2 (PIN_BASE + 0x40 + 2) | 92 | #define AT91_PIN_PC2 (0x40 + 2) |
95 | #define AT91_PIN_PC3 (PIN_BASE + 0x40 + 3) | 93 | #define AT91_PIN_PC3 (0x40 + 3) |
96 | #define AT91_PIN_PC4 (PIN_BASE + 0x40 + 4) | 94 | #define AT91_PIN_PC4 (0x40 + 4) |
97 | #define AT91_PIN_PC5 (PIN_BASE + 0x40 + 5) | 95 | #define AT91_PIN_PC5 (0x40 + 5) |
98 | #define AT91_PIN_PC6 (PIN_BASE + 0x40 + 6) | 96 | #define AT91_PIN_PC6 (0x40 + 6) |
99 | #define AT91_PIN_PC7 (PIN_BASE + 0x40 + 7) | 97 | #define AT91_PIN_PC7 (0x40 + 7) |
100 | #define AT91_PIN_PC8 (PIN_BASE + 0x40 + 8) | 98 | #define AT91_PIN_PC8 (0x40 + 8) |
101 | #define AT91_PIN_PC9 (PIN_BASE + 0x40 + 9) | 99 | #define AT91_PIN_PC9 (0x40 + 9) |
102 | #define AT91_PIN_PC10 (PIN_BASE + 0x40 + 10) | 100 | #define AT91_PIN_PC10 (0x40 + 10) |
103 | #define AT91_PIN_PC11 (PIN_BASE + 0x40 + 11) | 101 | #define AT91_PIN_PC11 (0x40 + 11) |
104 | #define AT91_PIN_PC12 (PIN_BASE + 0x40 + 12) | 102 | #define AT91_PIN_PC12 (0x40 + 12) |
105 | #define AT91_PIN_PC13 (PIN_BASE + 0x40 + 13) | 103 | #define AT91_PIN_PC13 (0x40 + 13) |
106 | #define AT91_PIN_PC14 (PIN_BASE + 0x40 + 14) | 104 | #define AT91_PIN_PC14 (0x40 + 14) |
107 | #define AT91_PIN_PC15 (PIN_BASE + 0x40 + 15) | 105 | #define AT91_PIN_PC15 (0x40 + 15) |
108 | #define AT91_PIN_PC16 (PIN_BASE + 0x40 + 16) | 106 | #define AT91_PIN_PC16 (0x40 + 16) |
109 | #define AT91_PIN_PC17 (PIN_BASE + 0x40 + 17) | 107 | #define AT91_PIN_PC17 (0x40 + 17) |
110 | #define AT91_PIN_PC18 (PIN_BASE + 0x40 + 18) | 108 | #define AT91_PIN_PC18 (0x40 + 18) |
111 | #define AT91_PIN_PC19 (PIN_BASE + 0x40 + 19) | 109 | #define AT91_PIN_PC19 (0x40 + 19) |
112 | #define AT91_PIN_PC20 (PIN_BASE + 0x40 + 20) | 110 | #define AT91_PIN_PC20 (0x40 + 20) |
113 | #define AT91_PIN_PC21 (PIN_BASE + 0x40 + 21) | 111 | #define AT91_PIN_PC21 (0x40 + 21) |
114 | #define AT91_PIN_PC22 (PIN_BASE + 0x40 + 22) | 112 | #define AT91_PIN_PC22 (0x40 + 22) |
115 | #define AT91_PIN_PC23 (PIN_BASE + 0x40 + 23) | 113 | #define AT91_PIN_PC23 (0x40 + 23) |
116 | #define AT91_PIN_PC24 (PIN_BASE + 0x40 + 24) | 114 | #define AT91_PIN_PC24 (0x40 + 24) |
117 | #define AT91_PIN_PC25 (PIN_BASE + 0x40 + 25) | 115 | #define AT91_PIN_PC25 (0x40 + 25) |
118 | #define AT91_PIN_PC26 (PIN_BASE + 0x40 + 26) | 116 | #define AT91_PIN_PC26 (0x40 + 26) |
119 | #define AT91_PIN_PC27 (PIN_BASE + 0x40 + 27) | 117 | #define AT91_PIN_PC27 (0x40 + 27) |
120 | #define AT91_PIN_PC28 (PIN_BASE + 0x40 + 28) | 118 | #define AT91_PIN_PC28 (0x40 + 28) |
121 | #define AT91_PIN_PC29 (PIN_BASE + 0x40 + 29) | 119 | #define AT91_PIN_PC29 (0x40 + 29) |
122 | #define AT91_PIN_PC30 (PIN_BASE + 0x40 + 30) | 120 | #define AT91_PIN_PC30 (0x40 + 30) |
123 | #define AT91_PIN_PC31 (PIN_BASE + 0x40 + 31) | 121 | #define AT91_PIN_PC31 (0x40 + 31) |
124 | 122 | ||
125 | #define AT91_PIN_PD0 (PIN_BASE + 0x60 + 0) | 123 | #define AT91_PIN_PD0 (0x60 + 0) |
126 | #define AT91_PIN_PD1 (PIN_BASE + 0x60 + 1) | 124 | #define AT91_PIN_PD1 (0x60 + 1) |
127 | #define AT91_PIN_PD2 (PIN_BASE + 0x60 + 2) | 125 | #define AT91_PIN_PD2 (0x60 + 2) |
128 | #define AT91_PIN_PD3 (PIN_BASE + 0x60 + 3) | 126 | #define AT91_PIN_PD3 (0x60 + 3) |
129 | #define AT91_PIN_PD4 (PIN_BASE + 0x60 + 4) | 127 | #define AT91_PIN_PD4 (0x60 + 4) |
130 | #define AT91_PIN_PD5 (PIN_BASE + 0x60 + 5) | 128 | #define AT91_PIN_PD5 (0x60 + 5) |
131 | #define AT91_PIN_PD6 (PIN_BASE + 0x60 + 6) | 129 | #define AT91_PIN_PD6 (0x60 + 6) |
132 | #define AT91_PIN_PD7 (PIN_BASE + 0x60 + 7) | 130 | #define AT91_PIN_PD7 (0x60 + 7) |
133 | #define AT91_PIN_PD8 (PIN_BASE + 0x60 + 8) | 131 | #define AT91_PIN_PD8 (0x60 + 8) |
134 | #define AT91_PIN_PD9 (PIN_BASE + 0x60 + 9) | 132 | #define AT91_PIN_PD9 (0x60 + 9) |
135 | #define AT91_PIN_PD10 (PIN_BASE + 0x60 + 10) | 133 | #define AT91_PIN_PD10 (0x60 + 10) |
136 | #define AT91_PIN_PD11 (PIN_BASE + 0x60 + 11) | 134 | #define AT91_PIN_PD11 (0x60 + 11) |
137 | #define AT91_PIN_PD12 (PIN_BASE + 0x60 + 12) | 135 | #define AT91_PIN_PD12 (0x60 + 12) |
138 | #define AT91_PIN_PD13 (PIN_BASE + 0x60 + 13) | 136 | #define AT91_PIN_PD13 (0x60 + 13) |
139 | #define AT91_PIN_PD14 (PIN_BASE + 0x60 + 14) | 137 | #define AT91_PIN_PD14 (0x60 + 14) |
140 | #define AT91_PIN_PD15 (PIN_BASE + 0x60 + 15) | 138 | #define AT91_PIN_PD15 (0x60 + 15) |
141 | #define AT91_PIN_PD16 (PIN_BASE + 0x60 + 16) | 139 | #define AT91_PIN_PD16 (0x60 + 16) |
142 | #define AT91_PIN_PD17 (PIN_BASE + 0x60 + 17) | 140 | #define AT91_PIN_PD17 (0x60 + 17) |
143 | #define AT91_PIN_PD18 (PIN_BASE + 0x60 + 18) | 141 | #define AT91_PIN_PD18 (0x60 + 18) |
144 | #define AT91_PIN_PD19 (PIN_BASE + 0x60 + 19) | 142 | #define AT91_PIN_PD19 (0x60 + 19) |
145 | #define AT91_PIN_PD20 (PIN_BASE + 0x60 + 20) | 143 | #define AT91_PIN_PD20 (0x60 + 20) |
146 | #define AT91_PIN_PD21 (PIN_BASE + 0x60 + 21) | 144 | #define AT91_PIN_PD21 (0x60 + 21) |
147 | #define AT91_PIN_PD22 (PIN_BASE + 0x60 + 22) | 145 | #define AT91_PIN_PD22 (0x60 + 22) |
148 | #define AT91_PIN_PD23 (PIN_BASE + 0x60 + 23) | 146 | #define AT91_PIN_PD23 (0x60 + 23) |
149 | #define AT91_PIN_PD24 (PIN_BASE + 0x60 + 24) | 147 | #define AT91_PIN_PD24 (0x60 + 24) |
150 | #define AT91_PIN_PD25 (PIN_BASE + 0x60 + 25) | 148 | #define AT91_PIN_PD25 (0x60 + 25) |
151 | #define AT91_PIN_PD26 (PIN_BASE + 0x60 + 26) | 149 | #define AT91_PIN_PD26 (0x60 + 26) |
152 | #define AT91_PIN_PD27 (PIN_BASE + 0x60 + 27) | 150 | #define AT91_PIN_PD27 (0x60 + 27) |
153 | #define AT91_PIN_PD28 (PIN_BASE + 0x60 + 28) | 151 | #define AT91_PIN_PD28 (0x60 + 28) |
154 | #define AT91_PIN_PD29 (PIN_BASE + 0x60 + 29) | 152 | #define AT91_PIN_PD29 (0x60 + 29) |
155 | #define AT91_PIN_PD30 (PIN_BASE + 0x60 + 30) | 153 | #define AT91_PIN_PD30 (0x60 + 30) |
156 | #define AT91_PIN_PD31 (PIN_BASE + 0x60 + 31) | 154 | #define AT91_PIN_PD31 (0x60 + 31) |
157 | 155 | ||
158 | #define AT91_PIN_PE0 (PIN_BASE + 0x80 + 0) | 156 | #define AT91_PIN_PE0 (0x80 + 0) |
159 | #define AT91_PIN_PE1 (PIN_BASE + 0x80 + 1) | 157 | #define AT91_PIN_PE1 (0x80 + 1) |
160 | #define AT91_PIN_PE2 (PIN_BASE + 0x80 + 2) | 158 | #define AT91_PIN_PE2 (0x80 + 2) |
161 | #define AT91_PIN_PE3 (PIN_BASE + 0x80 + 3) | 159 | #define AT91_PIN_PE3 (0x80 + 3) |
162 | #define AT91_PIN_PE4 (PIN_BASE + 0x80 + 4) | 160 | #define AT91_PIN_PE4 (0x80 + 4) |
163 | #define AT91_PIN_PE5 (PIN_BASE + 0x80 + 5) | 161 | #define AT91_PIN_PE5 (0x80 + 5) |
164 | #define AT91_PIN_PE6 (PIN_BASE + 0x80 + 6) | 162 | #define AT91_PIN_PE6 (0x80 + 6) |
165 | #define AT91_PIN_PE7 (PIN_BASE + 0x80 + 7) | 163 | #define AT91_PIN_PE7 (0x80 + 7) |
166 | #define AT91_PIN_PE8 (PIN_BASE + 0x80 + 8) | 164 | #define AT91_PIN_PE8 (0x80 + 8) |
167 | #define AT91_PIN_PE9 (PIN_BASE + 0x80 + 9) | 165 | #define AT91_PIN_PE9 (0x80 + 9) |
168 | #define AT91_PIN_PE10 (PIN_BASE + 0x80 + 10) | 166 | #define AT91_PIN_PE10 (0x80 + 10) |
169 | #define AT91_PIN_PE11 (PIN_BASE + 0x80 + 11) | 167 | #define AT91_PIN_PE11 (0x80 + 11) |
170 | #define AT91_PIN_PE12 (PIN_BASE + 0x80 + 12) | 168 | #define AT91_PIN_PE12 (0x80 + 12) |
171 | #define AT91_PIN_PE13 (PIN_BASE + 0x80 + 13) | 169 | #define AT91_PIN_PE13 (0x80 + 13) |
172 | #define AT91_PIN_PE14 (PIN_BASE + 0x80 + 14) | 170 | #define AT91_PIN_PE14 (0x80 + 14) |
173 | #define AT91_PIN_PE15 (PIN_BASE + 0x80 + 15) | 171 | #define AT91_PIN_PE15 (0x80 + 15) |
174 | #define AT91_PIN_PE16 (PIN_BASE + 0x80 + 16) | 172 | #define AT91_PIN_PE16 (0x80 + 16) |
175 | #define AT91_PIN_PE17 (PIN_BASE + 0x80 + 17) | 173 | #define AT91_PIN_PE17 (0x80 + 17) |
176 | #define AT91_PIN_PE18 (PIN_BASE + 0x80 + 18) | 174 | #define AT91_PIN_PE18 (0x80 + 18) |
177 | #define AT91_PIN_PE19 (PIN_BASE + 0x80 + 19) | 175 | #define AT91_PIN_PE19 (0x80 + 19) |
178 | #define AT91_PIN_PE20 (PIN_BASE + 0x80 + 20) | 176 | #define AT91_PIN_PE20 (0x80 + 20) |
179 | #define AT91_PIN_PE21 (PIN_BASE + 0x80 + 21) | 177 | #define AT91_PIN_PE21 (0x80 + 21) |
180 | #define AT91_PIN_PE22 (PIN_BASE + 0x80 + 22) | 178 | #define AT91_PIN_PE22 (0x80 + 22) |
181 | #define AT91_PIN_PE23 (PIN_BASE + 0x80 + 23) | 179 | #define AT91_PIN_PE23 (0x80 + 23) |
182 | #define AT91_PIN_PE24 (PIN_BASE + 0x80 + 24) | 180 | #define AT91_PIN_PE24 (0x80 + 24) |
183 | #define AT91_PIN_PE25 (PIN_BASE + 0x80 + 25) | 181 | #define AT91_PIN_PE25 (0x80 + 25) |
184 | #define AT91_PIN_PE26 (PIN_BASE + 0x80 + 26) | 182 | #define AT91_PIN_PE26 (0x80 + 26) |
185 | #define AT91_PIN_PE27 (PIN_BASE + 0x80 + 27) | 183 | #define AT91_PIN_PE27 (0x80 + 27) |
186 | #define AT91_PIN_PE28 (PIN_BASE + 0x80 + 28) | 184 | #define AT91_PIN_PE28 (0x80 + 28) |
187 | #define AT91_PIN_PE29 (PIN_BASE + 0x80 + 29) | 185 | #define AT91_PIN_PE29 (0x80 + 29) |
188 | #define AT91_PIN_PE30 (PIN_BASE + 0x80 + 30) | 186 | #define AT91_PIN_PE30 (0x80 + 30) |
189 | #define AT91_PIN_PE31 (PIN_BASE + 0x80 + 31) | 187 | #define AT91_PIN_PE31 (0x80 + 31) |
190 | 188 | ||
191 | #ifndef __ASSEMBLY__ | 189 | #ifndef __ASSEMBLY__ |
192 | /* setup setup routines, called from board init or driver probe() */ | 190 | /* setup setup routines, called from board init or driver probe() */ |
@@ -215,8 +213,8 @@ extern void at91_gpio_resume(void); | |||
215 | 213 | ||
216 | #include <asm/errno.h> | 214 | #include <asm/errno.h> |
217 | 215 | ||
218 | #define gpio_to_irq(gpio) (gpio) | 216 | #define gpio_to_irq(gpio) (gpio + NR_AIC_IRQS) |
219 | #define irq_to_gpio(irq) (irq) | 217 | #define irq_to_gpio(irq) (irq - NR_AIC_IRQS) |
220 | 218 | ||
221 | #endif /* __ASSEMBLY__ */ | 219 | #endif /* __ASSEMBLY__ */ |
222 | 220 | ||
diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h index 483478d8be6b..2d0e4e998566 100644 --- a/arch/arm/mach-at91/include/mach/hardware.h +++ b/arch/arm/mach-at91/include/mach/hardware.h | |||
@@ -16,6 +16,12 @@ | |||
16 | 16 | ||
17 | #include <asm/sizes.h> | 17 | #include <asm/sizes.h> |
18 | 18 | ||
19 | /* DBGU base */ | ||
20 | /* rm9200, 9260/9g20, 9261/9g10, 9rl */ | ||
21 | #define AT91_BASE_DBGU0 0xfffff200 | ||
22 | /* 9263, 9g45, cap9 */ | ||
23 | #define AT91_BASE_DBGU1 0xffffee00 | ||
24 | |||
19 | #if defined(CONFIG_ARCH_AT91RM9200) | 25 | #if defined(CONFIG_ARCH_AT91RM9200) |
20 | #include <mach/at91rm9200.h> | 26 | #include <mach/at91rm9200.h> |
21 | #elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20) | 27 | #elif defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20) |
@@ -52,6 +58,12 @@ | |||
52 | #endif | 58 | #endif |
53 | 59 | ||
54 | /* | 60 | /* |
61 | * On all at91 have the Advanced Interrupt Controller starts at address | ||
62 | * 0xfffff000 | ||
63 | */ | ||
64 | #define AT91_AIC 0xfffff000 | ||
65 | |||
66 | /* | ||
55 | * Peripheral identifiers/interrupts. | 67 | * Peripheral identifiers/interrupts. |
56 | */ | 68 | */ |
57 | #define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */ | 69 | #define AT91_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */ |
diff --git a/arch/arm/mach-at91/include/mach/irqs.h b/arch/arm/mach-at91/include/mach/irqs.h index 36bd55f3fc6e..ac8b7dfc85ef 100644 --- a/arch/arm/mach-at91/include/mach/irqs.h +++ b/arch/arm/mach-at91/include/mach/irqs.h | |||
@@ -31,7 +31,7 @@ | |||
31 | * Acknowledge interrupt with AIC after interrupt has been handled. | 31 | * Acknowledge interrupt with AIC after interrupt has been handled. |
32 | * (by kernel/irq.c) | 32 | * (by kernel/irq.c) |
33 | */ | 33 | */ |
34 | #define irq_finish(irq) do { at91_sys_write(AT91_AIC_EOICR, 0); } while (0) | 34 | #define irq_finish(irq) do { at91_aic_write(AT91_AIC_EOICR, 0); } while (0) |
35 | 35 | ||
36 | 36 | ||
37 | /* | 37 | /* |
diff --git a/arch/arm/mach-at91/include/mach/system_rev.h b/arch/arm/mach-at91/include/mach/system_rev.h index 8f4866045b41..ec164a4124c9 100644 --- a/arch/arm/mach-at91/include/mach/system_rev.h +++ b/arch/arm/mach-at91/include/mach/system_rev.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #define BOARD_HAVE_NAND_16BIT (1 << 31) | 19 | #define BOARD_HAVE_NAND_16BIT (1 << 31) |
20 | static inline int board_have_nand_16bit(void) | 20 | static inline int board_have_nand_16bit(void) |
21 | { | 21 | { |
22 | return system_rev & BOARD_HAVE_NAND_16BIT; | 22 | return (system_rev & BOARD_HAVE_NAND_16BIT) ? 1 : 0; |
23 | } | 23 | } |
24 | 24 | ||
25 | #endif /* __ARCH_SYSTEM_REV_H__ */ | 25 | #endif /* __ARCH_SYSTEM_REV_H__ */ |
diff --git a/arch/arm/mach-at91/include/mach/timex.h b/arch/arm/mach-at91/include/mach/timex.h index 85820ad801cc..5e917a66edd7 100644 --- a/arch/arm/mach-at91/include/mach/timex.h +++ b/arch/arm/mach-at91/include/mach/timex.h | |||
@@ -23,70 +23,15 @@ | |||
23 | 23 | ||
24 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
25 | 25 | ||
26 | #if defined(CONFIG_ARCH_AT91RM9200) | 26 | #ifdef CONFIG_ARCH_AT91X40 |
27 | 27 | ||
28 | #define CLOCK_TICK_RATE (AT91_SLOW_CLOCK) | 28 | #define AT91X40_MASTER_CLOCK 40000000 |
29 | 29 | #define CLOCK_TICK_RATE (AT91X40_MASTER_CLOCK) | |
30 | #elif defined(CONFIG_ARCH_AT91SAM9260) | ||
31 | |||
32 | #if defined(CONFIG_MACH_USB_A9260) || defined(CONFIG_MACH_QIL_A9260) | ||
33 | #define AT91SAM9_MASTER_CLOCK 90000000 | ||
34 | #else | ||
35 | #define AT91SAM9_MASTER_CLOCK 99300000 | ||
36 | #endif | ||
37 | |||
38 | #define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) | ||
39 | |||
40 | #elif defined(CONFIG_ARCH_AT91SAM9261) | ||
41 | |||
42 | #define AT91SAM9_MASTER_CLOCK 99300000 | ||
43 | #define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) | ||
44 | |||
45 | #elif defined(CONFIG_ARCH_AT91SAM9G10) | ||
46 | |||
47 | #define AT91SAM9_MASTER_CLOCK 133000000 | ||
48 | #define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) | ||
49 | |||
50 | #elif defined(CONFIG_ARCH_AT91SAM9263) | ||
51 | |||
52 | #if defined(CONFIG_MACH_USB_A9263) | ||
53 | #define AT91SAM9_MASTER_CLOCK 90000000 | ||
54 | #else | ||
55 | #define AT91SAM9_MASTER_CLOCK 99959500 | ||
56 | #endif | ||
57 | |||
58 | #define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) | ||
59 | |||
60 | #elif defined(CONFIG_ARCH_AT91SAM9RL) | ||
61 | |||
62 | #define AT91SAM9_MASTER_CLOCK 100000000 | ||
63 | #define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) | ||
64 | |||
65 | #elif defined(CONFIG_ARCH_AT91SAM9G20) | ||
66 | 30 | ||
67 | #if defined(CONFIG_MACH_USB_A9G20) | ||
68 | #define AT91SAM9_MASTER_CLOCK 133000000 | ||
69 | #else | 31 | #else |
70 | #define AT91SAM9_MASTER_CLOCK 132096000 | ||
71 | #endif | ||
72 | |||
73 | #define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) | ||
74 | |||
75 | #elif defined(CONFIG_ARCH_AT91SAM9G45) | ||
76 | 32 | ||
77 | #define AT91SAM9_MASTER_CLOCK 133333333 | 33 | #define CLOCK_TICK_RATE 12345678 |
78 | #define CLOCK_TICK_RATE (AT91SAM9_MASTER_CLOCK/16) | ||
79 | |||
80 | #elif defined(CONFIG_ARCH_AT91CAP9) | ||
81 | |||
82 | #define AT91CAP9_MASTER_CLOCK 100000000 | ||
83 | #define CLOCK_TICK_RATE (AT91CAP9_MASTER_CLOCK/16) | ||
84 | |||
85 | #elif defined(CONFIG_ARCH_AT91X40) | ||
86 | |||
87 | #define AT91X40_MASTER_CLOCK 40000000 | ||
88 | #define CLOCK_TICK_RATE (AT91X40_MASTER_CLOCK) | ||
89 | 34 | ||
90 | #endif | 35 | #endif |
91 | 36 | ||
92 | #endif | 37 | #endif /* __ASM_ARCH_TIMEX_H */ |
diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h index 18bdcdeb474f..0234fd9d20d6 100644 --- a/arch/arm/mach-at91/include/mach/uncompress.h +++ b/arch/arm/mach-at91/include/mach/uncompress.h | |||
@@ -24,8 +24,10 @@ | |||
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/atmel_serial.h> | 25 | #include <linux/atmel_serial.h> |
26 | 26 | ||
27 | #if defined(CONFIG_AT91_EARLY_DBGU) | 27 | #if defined(CONFIG_AT91_EARLY_DBGU0) |
28 | #define UART_OFFSET (AT91_DBGU + AT91_BASE_SYS) | 28 | #define UART_OFFSET AT91_BASE_DBGU0 |
29 | #elif defined(CONFIG_AT91_EARLY_DBGU1) | ||
30 | #define UART_OFFSET AT91_BASE_DBGU1 | ||
29 | #elif defined(CONFIG_AT91_EARLY_USART0) | 31 | #elif defined(CONFIG_AT91_EARLY_USART0) |
30 | #define UART_OFFSET AT91_USART0 | 32 | #define UART_OFFSET AT91_USART0 |
31 | #elif defined(CONFIG_AT91_EARLY_USART1) | 33 | #elif defined(CONFIG_AT91_EARLY_USART1) |
diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c index 9665265ec757..be6b639ecd7b 100644 --- a/arch/arm/mach-at91/irq.c +++ b/arch/arm/mach-at91/irq.c | |||
@@ -33,17 +33,18 @@ | |||
33 | #include <asm/mach/irq.h> | 33 | #include <asm/mach/irq.h> |
34 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
35 | 35 | ||
36 | void __iomem *at91_aic_base; | ||
36 | 37 | ||
37 | static void at91_aic_mask_irq(struct irq_data *d) | 38 | static void at91_aic_mask_irq(struct irq_data *d) |
38 | { | 39 | { |
39 | /* Disable interrupt on AIC */ | 40 | /* Disable interrupt on AIC */ |
40 | at91_sys_write(AT91_AIC_IDCR, 1 << d->irq); | 41 | at91_aic_write(AT91_AIC_IDCR, 1 << d->irq); |
41 | } | 42 | } |
42 | 43 | ||
43 | static void at91_aic_unmask_irq(struct irq_data *d) | 44 | static void at91_aic_unmask_irq(struct irq_data *d) |
44 | { | 45 | { |
45 | /* Enable interrupt on AIC */ | 46 | /* Enable interrupt on AIC */ |
46 | at91_sys_write(AT91_AIC_IECR, 1 << d->irq); | 47 | at91_aic_write(AT91_AIC_IECR, 1 << d->irq); |
47 | } | 48 | } |
48 | 49 | ||
49 | unsigned int at91_extern_irq; | 50 | unsigned int at91_extern_irq; |
@@ -77,8 +78,8 @@ static int at91_aic_set_type(struct irq_data *d, unsigned type) | |||
77 | return -EINVAL; | 78 | return -EINVAL; |
78 | } | 79 | } |
79 | 80 | ||
80 | smr = at91_sys_read(AT91_AIC_SMR(d->irq)) & ~AT91_AIC_SRCTYPE; | 81 | smr = at91_aic_read(AT91_AIC_SMR(d->irq)) & ~AT91_AIC_SRCTYPE; |
81 | at91_sys_write(AT91_AIC_SMR(d->irq), smr | srctype); | 82 | at91_aic_write(AT91_AIC_SMR(d->irq), smr | srctype); |
82 | return 0; | 83 | return 0; |
83 | } | 84 | } |
84 | 85 | ||
@@ -102,15 +103,15 @@ static int at91_aic_set_wake(struct irq_data *d, unsigned value) | |||
102 | 103 | ||
103 | void at91_irq_suspend(void) | 104 | void at91_irq_suspend(void) |
104 | { | 105 | { |
105 | backups = at91_sys_read(AT91_AIC_IMR); | 106 | backups = at91_aic_read(AT91_AIC_IMR); |
106 | at91_sys_write(AT91_AIC_IDCR, backups); | 107 | at91_aic_write(AT91_AIC_IDCR, backups); |
107 | at91_sys_write(AT91_AIC_IECR, wakeups); | 108 | at91_aic_write(AT91_AIC_IECR, wakeups); |
108 | } | 109 | } |
109 | 110 | ||
110 | void at91_irq_resume(void) | 111 | void at91_irq_resume(void) |
111 | { | 112 | { |
112 | at91_sys_write(AT91_AIC_IDCR, wakeups); | 113 | at91_aic_write(AT91_AIC_IDCR, wakeups); |
113 | at91_sys_write(AT91_AIC_IECR, backups); | 114 | at91_aic_write(AT91_AIC_IECR, backups); |
114 | } | 115 | } |
115 | 116 | ||
116 | #else | 117 | #else |
@@ -133,34 +134,39 @@ void __init at91_aic_init(unsigned int priority[NR_AIC_IRQS]) | |||
133 | { | 134 | { |
134 | unsigned int i; | 135 | unsigned int i; |
135 | 136 | ||
137 | at91_aic_base = ioremap(AT91_AIC, 512); | ||
138 | |||
139 | if (!at91_aic_base) | ||
140 | panic("Impossible to ioremap AT91_AIC\n"); | ||
141 | |||
136 | /* | 142 | /* |
137 | * The IVR is used by macro get_irqnr_and_base to read and verify. | 143 | * The IVR is used by macro get_irqnr_and_base to read and verify. |
138 | * The irq number is NR_AIC_IRQS when a spurious interrupt has occurred. | 144 | * The irq number is NR_AIC_IRQS when a spurious interrupt has occurred. |
139 | */ | 145 | */ |
140 | for (i = 0; i < NR_AIC_IRQS; i++) { | 146 | for (i = 0; i < NR_AIC_IRQS; i++) { |
141 | /* Put irq number in Source Vector Register: */ | 147 | /* Put irq number in Source Vector Register: */ |
142 | at91_sys_write(AT91_AIC_SVR(i), i); | 148 | at91_aic_write(AT91_AIC_SVR(i), i); |
143 | /* Active Low interrupt, with the specified priority */ | 149 | /* Active Low interrupt, with the specified priority */ |
144 | at91_sys_write(AT91_AIC_SMR(i), AT91_AIC_SRCTYPE_LOW | priority[i]); | 150 | at91_aic_write(AT91_AIC_SMR(i), AT91_AIC_SRCTYPE_LOW | priority[i]); |
145 | 151 | ||
146 | irq_set_chip_and_handler(i, &at91_aic_chip, handle_level_irq); | 152 | irq_set_chip_and_handler(i, &at91_aic_chip, handle_level_irq); |
147 | set_irq_flags(i, IRQF_VALID | IRQF_PROBE); | 153 | set_irq_flags(i, IRQF_VALID | IRQF_PROBE); |
148 | 154 | ||
149 | /* Perform 8 End Of Interrupt Command to make sure AIC will not Lock out nIRQ */ | 155 | /* Perform 8 End Of Interrupt Command to make sure AIC will not Lock out nIRQ */ |
150 | if (i < 8) | 156 | if (i < 8) |
151 | at91_sys_write(AT91_AIC_EOICR, 0); | 157 | at91_aic_write(AT91_AIC_EOICR, 0); |
152 | } | 158 | } |
153 | 159 | ||
154 | /* | 160 | /* |
155 | * Spurious Interrupt ID in Spurious Vector Register is NR_AIC_IRQS | 161 | * Spurious Interrupt ID in Spurious Vector Register is NR_AIC_IRQS |
156 | * When there is no current interrupt, the IRQ Vector Register reads the value stored in AIC_SPU | 162 | * When there is no current interrupt, the IRQ Vector Register reads the value stored in AIC_SPU |
157 | */ | 163 | */ |
158 | at91_sys_write(AT91_AIC_SPU, NR_AIC_IRQS); | 164 | at91_aic_write(AT91_AIC_SPU, NR_AIC_IRQS); |
159 | 165 | ||
160 | /* No debugging in AIC: Debug (Protect) Control Register */ | 166 | /* No debugging in AIC: Debug (Protect) Control Register */ |
161 | at91_sys_write(AT91_AIC_DCR, 0); | 167 | at91_aic_write(AT91_AIC_DCR, 0); |
162 | 168 | ||
163 | /* Disable and clear all interrupts initially */ | 169 | /* Disable and clear all interrupts initially */ |
164 | at91_sys_write(AT91_AIC_IDCR, 0xFFFFFFFF); | 170 | at91_aic_write(AT91_AIC_IDCR, 0xFFFFFFFF); |
165 | at91_sys_write(AT91_AIC_ICCR, 0xFFFFFFFF); | 171 | at91_aic_write(AT91_AIC_ICCR, 0xFFFFFFFF); |
166 | } | 172 | } |
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 7046158109d7..62ad95556c36 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -34,7 +34,7 @@ | |||
34 | /* | 34 | /* |
35 | * Show the reason for the previous system reset. | 35 | * Show the reason for the previous system reset. |
36 | */ | 36 | */ |
37 | #if defined(AT91_SHDWC) | 37 | #if defined(AT91_RSTC) |
38 | 38 | ||
39 | #include <mach/at91_rstc.h> | 39 | #include <mach/at91_rstc.h> |
40 | #include <mach/at91_shdwc.h> | 40 | #include <mach/at91_shdwc.h> |
@@ -58,8 +58,11 @@ static void __init show_reset_status(void) | |||
58 | char *reason, *r2 = reset; | 58 | char *reason, *r2 = reset; |
59 | u32 reset_type, wake_type; | 59 | u32 reset_type, wake_type; |
60 | 60 | ||
61 | if (!at91_shdwc_base) | ||
62 | return; | ||
63 | |||
61 | reset_type = at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_RSTTYP; | 64 | reset_type = at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_RSTTYP; |
62 | wake_type = at91_sys_read(AT91_SHDW_SR); | 65 | wake_type = at91_shdwc_read(AT91_SHDW_SR); |
63 | 66 | ||
64 | switch (reset_type) { | 67 | switch (reset_type) { |
65 | case AT91_RSTC_RSTTYP_GENERAL: | 68 | case AT91_RSTC_RSTTYP_GENERAL: |
@@ -215,7 +218,7 @@ static int at91_pm_enter(suspend_state_t state) | |||
215 | | (1 << AT91_ID_FIQ) | 218 | | (1 << AT91_ID_FIQ) |
216 | | (1 << AT91_ID_SYS) | 219 | | (1 << AT91_ID_SYS) |
217 | | (at91_extern_irq)) | 220 | | (at91_extern_irq)) |
218 | & at91_sys_read(AT91_AIC_IMR), | 221 | & at91_aic_read(AT91_AIC_IMR), |
219 | state); | 222 | state); |
220 | 223 | ||
221 | switch (state) { | 224 | switch (state) { |
@@ -283,7 +286,7 @@ static int at91_pm_enter(suspend_state_t state) | |||
283 | } | 286 | } |
284 | 287 | ||
285 | pr_debug("AT91: PM - wakeup %08x\n", | 288 | pr_debug("AT91: PM - wakeup %08x\n", |
286 | at91_sys_read(AT91_AIC_IPR) & at91_sys_read(AT91_AIC_IMR)); | 289 | at91_aic_read(AT91_AIC_IPR) & at91_aic_read(AT91_AIC_IMR)); |
287 | 290 | ||
288 | error: | 291 | error: |
289 | target_state = PM_SUSPEND_ON; | 292 | target_state = PM_SUSPEND_ON; |
diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c index 5eab6aa621d0..8294783b679d 100644 --- a/arch/arm/mach-at91/sam9_smc.c +++ b/arch/arm/mach-at91/sam9_smc.c | |||
@@ -10,38 +10,58 @@ | |||
10 | 10 | ||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/io.h> | 12 | #include <linux/io.h> |
13 | #include <linux/of.h> | ||
14 | #include <linux/of_address.h> | ||
13 | 15 | ||
14 | #include <mach/at91sam9_smc.h> | 16 | #include <mach/at91sam9_smc.h> |
15 | 17 | ||
16 | #include "sam9_smc.h" | 18 | #include "sam9_smc.h" |
17 | 19 | ||
18 | void __init sam9_smc_configure(int cs, struct sam9_smc_config* config) | 20 | |
21 | #define AT91_SMC_CS(id, n) (smc_base_addr[id] + ((n) * 0x10)) | ||
22 | |||
23 | static void __iomem *smc_base_addr[2]; | ||
24 | |||
25 | static void __init sam9_smc_cs_configure(void __iomem *base, struct sam9_smc_config* config) | ||
19 | { | 26 | { |
27 | |||
20 | /* Setup register */ | 28 | /* Setup register */ |
21 | at91_sys_write(AT91_SMC_SETUP(cs), | 29 | __raw_writel(AT91_SMC_NWESETUP_(config->nwe_setup) |
22 | AT91_SMC_NWESETUP_(config->nwe_setup) | 30 | | AT91_SMC_NCS_WRSETUP_(config->ncs_write_setup) |
23 | | AT91_SMC_NCS_WRSETUP_(config->ncs_write_setup) | 31 | | AT91_SMC_NRDSETUP_(config->nrd_setup) |
24 | | AT91_SMC_NRDSETUP_(config->nrd_setup) | 32 | | AT91_SMC_NCS_RDSETUP_(config->ncs_read_setup), |
25 | | AT91_SMC_NCS_RDSETUP_(config->ncs_read_setup) | 33 | base + AT91_SMC_SETUP); |
26 | ); | ||
27 | 34 | ||
28 | /* Pulse register */ | 35 | /* Pulse register */ |
29 | at91_sys_write(AT91_SMC_PULSE(cs), | 36 | __raw_writel(AT91_SMC_NWEPULSE_(config->nwe_pulse) |
30 | AT91_SMC_NWEPULSE_(config->nwe_pulse) | 37 | | AT91_SMC_NCS_WRPULSE_(config->ncs_write_pulse) |
31 | | AT91_SMC_NCS_WRPULSE_(config->ncs_write_pulse) | 38 | | AT91_SMC_NRDPULSE_(config->nrd_pulse) |
32 | | AT91_SMC_NRDPULSE_(config->nrd_pulse) | 39 | | AT91_SMC_NCS_RDPULSE_(config->ncs_read_pulse), |
33 | | AT91_SMC_NCS_RDPULSE_(config->ncs_read_pulse) | 40 | base + AT91_SMC_PULSE); |
34 | ); | ||
35 | 41 | ||
36 | /* Cycle register */ | 42 | /* Cycle register */ |
37 | at91_sys_write(AT91_SMC_CYCLE(cs), | 43 | __raw_writel(AT91_SMC_NWECYCLE_(config->write_cycle) |
38 | AT91_SMC_NWECYCLE_(config->write_cycle) | 44 | | AT91_SMC_NRDCYCLE_(config->read_cycle), |
39 | | AT91_SMC_NRDCYCLE_(config->read_cycle) | 45 | base + AT91_SMC_CYCLE); |
40 | ); | ||
41 | 46 | ||
42 | /* Mode register */ | 47 | /* Mode register */ |
43 | at91_sys_write(AT91_SMC_MODE(cs), | 48 | __raw_writel(config->mode |
44 | config->mode | 49 | | AT91_SMC_TDF_(config->tdf_cycles), |
45 | | AT91_SMC_TDF_(config->tdf_cycles) | 50 | base + AT91_SMC_MODE); |
46 | ); | 51 | } |
52 | |||
53 | void __init sam9_smc_configure(int id, int cs, struct sam9_smc_config* config) | ||
54 | { | ||
55 | sam9_smc_cs_configure(AT91_SMC_CS(id, cs), config); | ||
56 | } | ||
57 | |||
58 | void __init at91sam9_ioremap_smc(int id, u32 addr) | ||
59 | { | ||
60 | if (id > 1) { | ||
61 | pr_warn("%s: id > 2\n", __func__); | ||
62 | return; | ||
63 | } | ||
64 | smc_base_addr[id] = ioremap(addr, 512); | ||
65 | if (!smc_base_addr[id]) | ||
66 | pr_warn("Impossible to ioremap smc.%d 0x%x\n", id, addr); | ||
47 | } | 67 | } |
diff --git a/arch/arm/mach-at91/sam9_smc.h b/arch/arm/mach-at91/sam9_smc.h index bf72cfb3455b..039c5ce17aec 100644 --- a/arch/arm/mach-at91/sam9_smc.h +++ b/arch/arm/mach-at91/sam9_smc.h | |||
@@ -30,4 +30,5 @@ struct sam9_smc_config { | |||
30 | u8 tdf_cycles:4; | 30 | u8 tdf_cycles:4; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | extern void __init sam9_smc_configure(int cs, struct sam9_smc_config* config); | 33 | extern void __init sam9_smc_configure(int id, int cs, struct sam9_smc_config* config); |
34 | extern void __init at91sam9_ioremap_smc(int id, u32 addr); | ||
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index cf98a8f94dc5..8bdcc3cb6012 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
10 | #include <linux/mm.h> | 10 | #include <linux/mm.h> |
11 | #include <linux/pm.h> | ||
11 | 12 | ||
12 | #include <asm/mach/map.h> | 13 | #include <asm/mach/map.h> |
13 | 14 | ||
@@ -15,6 +16,7 @@ | |||
15 | #include <mach/cpu.h> | 16 | #include <mach/cpu.h> |
16 | #include <mach/at91_dbgu.h> | 17 | #include <mach/at91_dbgu.h> |
17 | #include <mach/at91_pmc.h> | 18 | #include <mach/at91_pmc.h> |
19 | #include <mach/at91_shdwc.h> | ||
18 | 20 | ||
19 | #include "soc.h" | 21 | #include "soc.h" |
20 | #include "generic.h" | 22 | #include "generic.h" |
@@ -73,9 +75,6 @@ static struct map_desc at91_io_desc __initdata = { | |||
73 | .type = MT_DEVICE, | 75 | .type = MT_DEVICE, |
74 | }; | 76 | }; |
75 | 77 | ||
76 | #define AT91_DBGU0 0xfffff200 | ||
77 | #define AT91_DBGU1 0xffffee00 | ||
78 | |||
79 | static void __init soc_detect(u32 dbgu_base) | 78 | static void __init soc_detect(u32 dbgu_base) |
80 | { | 79 | { |
81 | u32 cidr, socid; | 80 | u32 cidr, socid; |
@@ -248,9 +247,9 @@ void __init at91_map_io(void) | |||
248 | at91_soc_initdata.type = AT91_SOC_NONE; | 247 | at91_soc_initdata.type = AT91_SOC_NONE; |
249 | at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; | 248 | at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; |
250 | 249 | ||
251 | soc_detect(AT91_DBGU0); | 250 | soc_detect(AT91_BASE_DBGU0); |
252 | if (!at91_soc_is_detected()) | 251 | if (!at91_soc_is_detected()) |
253 | soc_detect(AT91_DBGU1); | 252 | soc_detect(AT91_BASE_DBGU1); |
254 | 253 | ||
255 | if (!at91_soc_is_detected()) | 254 | if (!at91_soc_is_detected()) |
256 | panic("AT91: Impossible to detect the SOC type"); | 255 | panic("AT91: Impossible to detect the SOC type"); |
@@ -267,8 +266,25 @@ void __init at91_map_io(void) | |||
267 | at91_boot_soc.map_io(); | 266 | at91_boot_soc.map_io(); |
268 | } | 267 | } |
269 | 268 | ||
269 | void __iomem *at91_shdwc_base = NULL; | ||
270 | |||
271 | static void at91sam9_poweroff(void) | ||
272 | { | ||
273 | at91_shdwc_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); | ||
274 | } | ||
275 | |||
276 | void __init at91_ioremap_shdwc(u32 base_addr) | ||
277 | { | ||
278 | at91_shdwc_base = ioremap(base_addr, 16); | ||
279 | if (!at91_shdwc_base) | ||
280 | panic("Impossible to ioremap at91_shdwc_base\n"); | ||
281 | pm_power_off = at91sam9_poweroff; | ||
282 | } | ||
283 | |||
270 | void __init at91_initialize(unsigned long main_clock) | 284 | void __init at91_initialize(unsigned long main_clock) |
271 | { | 285 | { |
286 | at91_boot_soc.ioremap_registers(); | ||
287 | |||
272 | /* Init clock subsystem */ | 288 | /* Init clock subsystem */ |
273 | at91_clock_init(main_clock); | 289 | at91_clock_init(main_clock); |
274 | 290 | ||
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h index 21ed8816e6f7..4588ae6f7acd 100644 --- a/arch/arm/mach-at91/soc.h +++ b/arch/arm/mach-at91/soc.h | |||
@@ -7,6 +7,7 @@ | |||
7 | struct at91_init_soc { | 7 | struct at91_init_soc { |
8 | unsigned int *default_irq_priority; | 8 | unsigned int *default_irq_priority; |
9 | void (*map_io)(void); | 9 | void (*map_io)(void); |
10 | void (*ioremap_registers)(void); | ||
10 | void (*register_clocks)(void); | 11 | void (*register_clocks)(void); |
11 | void (*init)(void); | 12 | void (*init)(void); |
12 | }; | 13 | }; |
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 1d7d24995226..6659a90dbcad 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c | |||
@@ -753,7 +753,7 @@ static struct snd_platform_data da850_evm_snd_data = { | |||
753 | .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction), | 753 | .num_serializer = ARRAY_SIZE(da850_iis_serializer_direction), |
754 | .tdm_slots = 2, | 754 | .tdm_slots = 2, |
755 | .serial_dir = da850_iis_serializer_direction, | 755 | .serial_dir = da850_iis_serializer_direction, |
756 | .asp_chan_q = EVENTQ_1, | 756 | .asp_chan_q = EVENTQ_0, |
757 | .version = MCASP_VERSION_2, | 757 | .version = MCASP_VERSION_2, |
758 | .txnumevt = 1, | 758 | .txnumevt = 1, |
759 | .rxnumevt = 1, | 759 | .rxnumevt = 1, |
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index 1918ae711428..46e1f4173b97 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c | |||
@@ -107,7 +107,7 @@ static struct mtd_partition davinci_nand_partitions[] = { | |||
107 | /* UBL (a few copies) plus U-Boot */ | 107 | /* UBL (a few copies) plus U-Boot */ |
108 | .name = "bootloader", | 108 | .name = "bootloader", |
109 | .offset = 0, | 109 | .offset = 0, |
110 | .size = 28 * NAND_BLOCK_SIZE, | 110 | .size = 30 * NAND_BLOCK_SIZE, |
111 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | 111 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
112 | }, { | 112 | }, { |
113 | /* U-Boot environment */ | 113 | /* U-Boot environment */ |
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index e574d7f837a8..635bf7740157 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c | |||
@@ -564,7 +564,7 @@ static int setup_vpif_input_channel_mode(int mux_mode) | |||
564 | int val; | 564 | int val; |
565 | u32 value; | 565 | u32 value; |
566 | 566 | ||
567 | if (!vpif_vsclkdis_reg || !cpld_client) | 567 | if (!vpif_vidclkctl_reg || !cpld_client) |
568 | return -ENXIO; | 568 | return -ENXIO; |
569 | 569 | ||
570 | val = i2c_smbus_read_byte(cpld_client); | 570 | val = i2c_smbus_read_byte(cpld_client); |
@@ -572,7 +572,7 @@ static int setup_vpif_input_channel_mode(int mux_mode) | |||
572 | return val; | 572 | return val; |
573 | 573 | ||
574 | spin_lock_irqsave(&vpif_reg_lock, flags); | 574 | spin_lock_irqsave(&vpif_reg_lock, flags); |
575 | value = __raw_readl(vpif_vsclkdis_reg); | 575 | value = __raw_readl(vpif_vidclkctl_reg); |
576 | if (mux_mode) { | 576 | if (mux_mode) { |
577 | val &= VPIF_INPUT_TWO_CHANNEL; | 577 | val &= VPIF_INPUT_TWO_CHANNEL; |
578 | value |= VIDCH1CLK; | 578 | value |= VIDCH1CLK; |
@@ -580,7 +580,7 @@ static int setup_vpif_input_channel_mode(int mux_mode) | |||
580 | val |= VPIF_INPUT_ONE_CHANNEL; | 580 | val |= VPIF_INPUT_ONE_CHANNEL; |
581 | value &= ~VIDCH1CLK; | 581 | value &= ~VIDCH1CLK; |
582 | } | 582 | } |
583 | __raw_writel(value, vpif_vsclkdis_reg); | 583 | __raw_writel(value, vpif_vidclkctl_reg); |
584 | spin_unlock_irqrestore(&vpif_reg_lock, flags); | 584 | spin_unlock_irqrestore(&vpif_reg_lock, flags); |
585 | 585 | ||
586 | err = i2c_smbus_write_byte(cpld_client, val); | 586 | err = i2c_smbus_write_byte(cpld_client, val); |
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 0b68ed534f8e..af27c130595f 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c | |||
@@ -161,7 +161,6 @@ static struct clk dsp_clk = { | |||
161 | .name = "dsp", | 161 | .name = "dsp", |
162 | .parent = &pll1_sysclk1, | 162 | .parent = &pll1_sysclk1, |
163 | .lpsc = DM646X_LPSC_C64X_CPU, | 163 | .lpsc = DM646X_LPSC_C64X_CPU, |
164 | .flags = PSC_DSP, | ||
165 | .usecount = 1, /* REVISIT how to disable? */ | 164 | .usecount = 1, /* REVISIT how to disable? */ |
166 | }; | 165 | }; |
167 | 166 | ||
diff --git a/arch/arm/mach-davinci/include/mach/dm646x.h b/arch/arm/mach-davinci/include/mach/dm646x.h index 2a00fe5ac253..a8ee6c9f0bb0 100644 --- a/arch/arm/mach-davinci/include/mach/dm646x.h +++ b/arch/arm/mach-davinci/include/mach/dm646x.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
17 | #include <linux/videodev2.h> | 17 | #include <linux/videodev2.h> |
18 | #include <linux/davinci_emac.h> | 18 | #include <linux/davinci_emac.h> |
19 | #include <media/davinci/vpif_types.h> | ||
19 | 20 | ||
20 | #define DM646X_EMAC_BASE (0x01C80000) | 21 | #define DM646X_EMAC_BASE (0x01C80000) |
21 | #define DM646X_EMAC_MDIO_BASE (DM646X_EMAC_BASE + 0x4000) | 22 | #define DM646X_EMAC_MDIO_BASE (DM646X_EMAC_BASE + 0x4000) |
@@ -34,58 +35,6 @@ int __init dm646x_init_edma(struct edma_rsv_info *rsv); | |||
34 | 35 | ||
35 | void dm646x_video_init(void); | 36 | void dm646x_video_init(void); |
36 | 37 | ||
37 | enum vpif_if_type { | ||
38 | VPIF_IF_BT656, | ||
39 | VPIF_IF_BT1120, | ||
40 | VPIF_IF_RAW_BAYER | ||
41 | }; | ||
42 | |||
43 | struct vpif_interface { | ||
44 | enum vpif_if_type if_type; | ||
45 | unsigned hd_pol:1; | ||
46 | unsigned vd_pol:1; | ||
47 | unsigned fid_pol:1; | ||
48 | }; | ||
49 | |||
50 | struct vpif_subdev_info { | ||
51 | const char *name; | ||
52 | struct i2c_board_info board_info; | ||
53 | u32 input; | ||
54 | u32 output; | ||
55 | unsigned can_route:1; | ||
56 | struct vpif_interface vpif_if; | ||
57 | }; | ||
58 | |||
59 | struct vpif_display_config { | ||
60 | int (*set_clock)(int, int); | ||
61 | struct vpif_subdev_info *subdevinfo; | ||
62 | int subdev_count; | ||
63 | const char **output; | ||
64 | int output_count; | ||
65 | const char *card_name; | ||
66 | }; | ||
67 | |||
68 | struct vpif_input { | ||
69 | struct v4l2_input input; | ||
70 | const char *subdev_name; | ||
71 | }; | ||
72 | |||
73 | #define VPIF_CAPTURE_MAX_CHANNELS 2 | ||
74 | |||
75 | struct vpif_capture_chan_config { | ||
76 | const struct vpif_input *inputs; | ||
77 | int input_count; | ||
78 | }; | ||
79 | |||
80 | struct vpif_capture_config { | ||
81 | int (*setup_input_channel_mode)(int); | ||
82 | int (*setup_input_path)(int, const char *); | ||
83 | struct vpif_capture_chan_config chan_config[VPIF_CAPTURE_MAX_CHANNELS]; | ||
84 | struct vpif_subdev_info *subdev_info; | ||
85 | int subdev_count; | ||
86 | const char *card_name; | ||
87 | }; | ||
88 | |||
89 | void dm646x_setup_vpif(struct vpif_display_config *, | 38 | void dm646x_setup_vpif(struct vpif_display_config *, |
90 | struct vpif_capture_config *); | 39 | struct vpif_capture_config *); |
91 | 40 | ||
diff --git a/arch/arm/mach-davinci/include/mach/psc.h b/arch/arm/mach-davinci/include/mach/psc.h index fa59c097223d..8bc3fc256171 100644 --- a/arch/arm/mach-davinci/include/mach/psc.h +++ b/arch/arm/mach-davinci/include/mach/psc.h | |||
@@ -233,7 +233,7 @@ | |||
233 | #define PTCMD 0x120 | 233 | #define PTCMD 0x120 |
234 | #define PTSTAT 0x128 | 234 | #define PTSTAT 0x128 |
235 | #define PDSTAT 0x200 | 235 | #define PDSTAT 0x200 |
236 | #define PDCTL1 0x304 | 236 | #define PDCTL 0x300 |
237 | #define MDSTAT 0x800 | 237 | #define MDSTAT 0x800 |
238 | #define MDCTL 0xA00 | 238 | #define MDCTL 0xA00 |
239 | 239 | ||
@@ -244,7 +244,10 @@ | |||
244 | #define PSC_STATE_ENABLE 3 | 244 | #define PSC_STATE_ENABLE 3 |
245 | 245 | ||
246 | #define MDSTAT_STATE_MASK 0x3f | 246 | #define MDSTAT_STATE_MASK 0x3f |
247 | #define PDSTAT_STATE_MASK 0x1f | ||
247 | #define MDCTL_FORCE BIT(31) | 248 | #define MDCTL_FORCE BIT(31) |
249 | #define PDCTL_NEXT BIT(1) | ||
250 | #define PDCTL_EPCGOOD BIT(8) | ||
248 | 251 | ||
249 | #ifndef __ASSEMBLER__ | 252 | #ifndef __ASSEMBLER__ |
250 | 253 | ||
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c index 1fb6bdff38c1..d7e210f4b55c 100644 --- a/arch/arm/mach-davinci/psc.c +++ b/arch/arm/mach-davinci/psc.c | |||
@@ -52,7 +52,7 @@ int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id) | |||
52 | void davinci_psc_config(unsigned int domain, unsigned int ctlr, | 52 | void davinci_psc_config(unsigned int domain, unsigned int ctlr, |
53 | unsigned int id, bool enable, u32 flags) | 53 | unsigned int id, bool enable, u32 flags) |
54 | { | 54 | { |
55 | u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl; | 55 | u32 epcpr, ptcmd, ptstat, pdstat, pdctl, mdstat, mdctl; |
56 | void __iomem *psc_base; | 56 | void __iomem *psc_base; |
57 | struct davinci_soc_info *soc_info = &davinci_soc_info; | 57 | struct davinci_soc_info *soc_info = &davinci_soc_info; |
58 | u32 next_state = PSC_STATE_ENABLE; | 58 | u32 next_state = PSC_STATE_ENABLE; |
@@ -79,11 +79,11 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr, | |||
79 | mdctl |= MDCTL_FORCE; | 79 | mdctl |= MDCTL_FORCE; |
80 | __raw_writel(mdctl, psc_base + MDCTL + 4 * id); | 80 | __raw_writel(mdctl, psc_base + MDCTL + 4 * id); |
81 | 81 | ||
82 | pdstat = __raw_readl(psc_base + PDSTAT); | 82 | pdstat = __raw_readl(psc_base + PDSTAT + 4 * domain); |
83 | if ((pdstat & 0x00000001) == 0) { | 83 | if ((pdstat & PDSTAT_STATE_MASK) == 0) { |
84 | pdctl1 = __raw_readl(psc_base + PDCTL1); | 84 | pdctl = __raw_readl(psc_base + PDCTL + 4 * domain); |
85 | pdctl1 |= 0x1; | 85 | pdctl |= PDCTL_NEXT; |
86 | __raw_writel(pdctl1, psc_base + PDCTL1); | 86 | __raw_writel(pdctl, psc_base + PDCTL + 4 * domain); |
87 | 87 | ||
88 | ptcmd = 1 << domain; | 88 | ptcmd = 1 << domain; |
89 | __raw_writel(ptcmd, psc_base + PTCMD); | 89 | __raw_writel(ptcmd, psc_base + PTCMD); |
@@ -92,9 +92,9 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr, | |||
92 | epcpr = __raw_readl(psc_base + EPCPR); | 92 | epcpr = __raw_readl(psc_base + EPCPR); |
93 | } while ((((epcpr >> domain) & 1) == 0)); | 93 | } while ((((epcpr >> domain) & 1) == 0)); |
94 | 94 | ||
95 | pdctl1 = __raw_readl(psc_base + PDCTL1); | 95 | pdctl = __raw_readl(psc_base + PDCTL + 4 * domain); |
96 | pdctl1 |= 0x100; | 96 | pdctl |= PDCTL_EPCGOOD; |
97 | __raw_writel(pdctl1, psc_base + PDCTL1); | 97 | __raw_writel(pdctl, psc_base + PDCTL + 4 * domain); |
98 | } else { | 98 | } else { |
99 | ptcmd = 1 << domain; | 99 | ptcmd = 1 << domain; |
100 | __raw_writel(ptcmd, psc_base + PTCMD); | 100 | __raw_writel(ptcmd, psc_base + PTCMD); |
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 9cd860a27af5..8deb012189b5 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c | |||
@@ -37,14 +37,15 @@ static void __init imx6q_map_io(void) | |||
37 | imx6q_clock_map_io(); | 37 | imx6q_clock_map_io(); |
38 | } | 38 | } |
39 | 39 | ||
40 | static void __init imx6q_gpio_add_irq_domain(struct device_node *np, | 40 | static int __init imx6q_gpio_add_irq_domain(struct device_node *np, |
41 | struct device_node *interrupt_parent) | 41 | struct device_node *interrupt_parent) |
42 | { | 42 | { |
43 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS - | 43 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; |
44 | 32 * 7; /* imx6q gets 7 gpio ports */ | ||
45 | 44 | ||
45 | gpio_irq_base -= 32; | ||
46 | irq_domain_add_simple(np, gpio_irq_base); | 46 | irq_domain_add_simple(np, gpio_irq_base); |
47 | gpio_irq_base += 32; | 47 | |
48 | return 0; | ||
48 | } | 49 | } |
49 | 50 | ||
50 | static const struct of_device_id imx6q_irq_match[] __initconst = { | 51 | static const struct of_device_id imx6q_irq_match[] __initconst = { |
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig index ebde97f5d5f0..000ddf0a4f33 100644 --- a/arch/arm/mach-msm/Kconfig +++ b/arch/arm/mach-msm/Kconfig | |||
@@ -13,7 +13,6 @@ config ARCH_MSM7X00A | |||
13 | select CPU_V6 | 13 | select CPU_V6 |
14 | select GPIO_MSM_V1 | 14 | select GPIO_MSM_V1 |
15 | select MSM_PROC_COMM | 15 | select MSM_PROC_COMM |
16 | select HAS_MSM_DEBUG_UART_PHYS | ||
17 | 16 | ||
18 | config ARCH_MSM7X30 | 17 | config ARCH_MSM7X30 |
19 | bool "MSM7x30" | 18 | bool "MSM7x30" |
@@ -25,7 +24,6 @@ config ARCH_MSM7X30 | |||
25 | select MSM_GPIOMUX | 24 | select MSM_GPIOMUX |
26 | select GPIO_MSM_V1 | 25 | select GPIO_MSM_V1 |
27 | select MSM_PROC_COMM | 26 | select MSM_PROC_COMM |
28 | select HAS_MSM_DEBUG_UART_PHYS | ||
29 | 27 | ||
30 | config ARCH_QSD8X50 | 28 | config ARCH_QSD8X50 |
31 | bool "QSD8X50" | 29 | bool "QSD8X50" |
@@ -37,7 +35,6 @@ config ARCH_QSD8X50 | |||
37 | select MSM_GPIOMUX | 35 | select MSM_GPIOMUX |
38 | select GPIO_MSM_V1 | 36 | select GPIO_MSM_V1 |
39 | select MSM_PROC_COMM | 37 | select MSM_PROC_COMM |
40 | select HAS_MSM_DEBUG_UART_PHYS | ||
41 | 38 | ||
42 | config ARCH_MSM8X60 | 39 | config ARCH_MSM8X60 |
43 | bool "MSM8X60" | 40 | bool "MSM8X60" |
@@ -63,6 +60,9 @@ config ARCH_MSM8960 | |||
63 | 60 | ||
64 | endchoice | 61 | endchoice |
65 | 62 | ||
63 | config MSM_HAS_DEBUG_UART_HS | ||
64 | bool | ||
65 | |||
66 | config MSM_SOC_REV_A | 66 | config MSM_SOC_REV_A |
67 | bool | 67 | bool |
68 | config ARCH_MSM_SCORPIONMP | 68 | config ARCH_MSM_SCORPIONMP |
@@ -73,9 +73,6 @@ config ARCH_MSM_ARM11 | |||
73 | config ARCH_MSM_SCORPION | 73 | config ARCH_MSM_SCORPION |
74 | bool | 74 | bool |
75 | 75 | ||
76 | config HAS_MSM_DEBUG_UART_PHYS | ||
77 | bool | ||
78 | |||
79 | config MSM_VIC | 76 | config MSM_VIC |
80 | bool | 77 | bool |
81 | 78 | ||
@@ -152,32 +149,6 @@ config MACH_MSM8960_RUMI3 | |||
152 | 149 | ||
153 | endmenu | 150 | endmenu |
154 | 151 | ||
155 | config MSM_DEBUG_UART | ||
156 | int | ||
157 | default 1 if MSM_DEBUG_UART1 | ||
158 | default 2 if MSM_DEBUG_UART2 | ||
159 | default 3 if MSM_DEBUG_UART3 | ||
160 | |||
161 | if HAS_MSM_DEBUG_UART_PHYS | ||
162 | choice | ||
163 | prompt "Debug UART" | ||
164 | |||
165 | default MSM_DEBUG_UART_NONE | ||
166 | |||
167 | config MSM_DEBUG_UART_NONE | ||
168 | bool "None" | ||
169 | |||
170 | config MSM_DEBUG_UART1 | ||
171 | bool "UART1" | ||
172 | |||
173 | config MSM_DEBUG_UART2 | ||
174 | bool "UART2" | ||
175 | |||
176 | config MSM_DEBUG_UART3 | ||
177 | bool "UART3" | ||
178 | endchoice | ||
179 | endif | ||
180 | |||
181 | config MSM_SMD_PKG3 | 152 | config MSM_SMD_PKG3 |
182 | bool | 153 | bool |
183 | 154 | ||
diff --git a/arch/arm/mach-msm/devices-iommu.c b/arch/arm/mach-msm/devices-iommu.c index 24030d0da6e3..0fb7a17df398 100644 --- a/arch/arm/mach-msm/devices-iommu.c +++ b/arch/arm/mach-msm/devices-iommu.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/bootmem.h> | 20 | #include <linux/bootmem.h> |
21 | #include <linux/module.h> | ||
21 | #include <mach/irqs.h> | 22 | #include <mach/irqs.h> |
22 | #include <mach/iommu.h> | 23 | #include <mach/iommu.h> |
23 | 24 | ||
diff --git a/arch/arm/mach-msm/include/mach/debug-macro.S b/arch/arm/mach-msm/include/mach/debug-macro.S index 2dc73ccddb11..3ffd8668c9a5 100644 --- a/arch/arm/mach-msm/include/mach/debug-macro.S +++ b/arch/arm/mach-msm/include/mach/debug-macro.S | |||
@@ -1,6 +1,7 @@ | |||
1 | /* arch/arm/mach-msm7200/include/mach/debug-macro.S | 1 | /* |
2 | * | 2 | * |
3 | * Copyright (C) 2007 Google, Inc. | 3 | * Copyright (C) 2007 Google, Inc. |
4 | * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | ||
4 | * Author: Brian Swetland <swetland@google.com> | 5 | * Author: Brian Swetland <swetland@google.com> |
5 | * | 6 | * |
6 | * This software is licensed under the terms of the GNU General Public | 7 | * This software is licensed under the terms of the GNU General Public |
@@ -14,40 +15,52 @@ | |||
14 | * | 15 | * |
15 | */ | 16 | */ |
16 | 17 | ||
17 | |||
18 | |||
19 | #include <mach/hardware.h> | 18 | #include <mach/hardware.h> |
20 | #include <mach/msm_iomap.h> | 19 | #include <mach/msm_iomap.h> |
21 | 20 | ||
22 | #if defined(CONFIG_HAS_MSM_DEBUG_UART_PHYS) && !defined(CONFIG_MSM_DEBUG_UART_NONE) | ||
23 | .macro addruart, rp, rv, tmp | 21 | .macro addruart, rp, rv, tmp |
22 | #ifdef MSM_DEBUG_UART_PHYS | ||
24 | ldr \rp, =MSM_DEBUG_UART_PHYS | 23 | ldr \rp, =MSM_DEBUG_UART_PHYS |
25 | ldr \rv, =MSM_DEBUG_UART_BASE | 24 | ldr \rv, =MSM_DEBUG_UART_BASE |
25 | #endif | ||
26 | .endm | 26 | .endm |
27 | 27 | ||
28 | .macro senduart,rd,rx | 28 | .macro senduart, rd, rx |
29 | #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS | ||
30 | @ Write the 1 character to UARTDM_TF | ||
31 | str \rd, [\rx, #0x70] | ||
32 | #else | ||
29 | teq \rx, #0 | 33 | teq \rx, #0 |
30 | strne \rd, [\rx, #0x0C] | 34 | strne \rd, [\rx, #0x0C] |
35 | #endif | ||
31 | .endm | 36 | .endm |
32 | 37 | ||
33 | .macro waituart,rd,rx | 38 | .macro waituart, rd, rx |
39 | #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS | ||
40 | @ check for TX_EMT in UARTDM_SR | ||
41 | ldr \rd, [\rx, #0x08] | ||
42 | tst \rd, #0x08 | ||
43 | bne 1002f | ||
44 | @ wait for TXREADY in UARTDM_ISR | ||
45 | 1001: ldr \rd, [\rx, #0x14] | ||
46 | tst \rd, #0x80 | ||
47 | beq 1001b | ||
48 | 1002: | ||
49 | @ Clear TX_READY by writing to the UARTDM_CR register | ||
50 | mov \rd, #0x300 | ||
51 | str \rd, [\rx, #0x10] | ||
52 | @ Write 0x1 to NCF register | ||
53 | mov \rd, #0x1 | ||
54 | str \rd, [\rx, #0x40] | ||
55 | @ UARTDM reg. Read to induce delay | ||
56 | ldr \rd, [\rx, #0x08] | ||
57 | #else | ||
34 | @ wait for TX_READY | 58 | @ wait for TX_READY |
35 | 1001: ldr \rd, [\rx, #0x08] | 59 | 1001: ldr \rd, [\rx, #0x08] |
36 | tst \rd, #0x04 | 60 | tst \rd, #0x04 |
37 | beq 1001b | 61 | beq 1001b |
38 | .endm | ||
39 | #else | ||
40 | .macro addruart, rp, rv, tmp | ||
41 | mov \rv, #0xff000000 | ||
42 | orr \rv, \rv, #0x00f00000 | ||
43 | .endm | ||
44 | |||
45 | .macro senduart,rd,rx | ||
46 | .endm | ||
47 | |||
48 | .macro waituart,rd,rx | ||
49 | .endm | ||
50 | #endif | 62 | #endif |
63 | .endm | ||
51 | 64 | ||
52 | .macro busyuart,rd,rx | 65 | .macro busyuart, rd, rx |
53 | .endm | 66 | .endm |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h index 94fe9fe6feb3..8af46123dab6 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h | |||
@@ -78,18 +78,6 @@ | |||
78 | #define MSM_UART3_PHYS 0xA9C00000 | 78 | #define MSM_UART3_PHYS 0xA9C00000 |
79 | #define MSM_UART3_SIZE SZ_4K | 79 | #define MSM_UART3_SIZE SZ_4K |
80 | 80 | ||
81 | #ifdef CONFIG_MSM_DEBUG_UART | ||
82 | #define MSM_DEBUG_UART_BASE 0xE1000000 | ||
83 | #if CONFIG_MSM_DEBUG_UART == 1 | ||
84 | #define MSM_DEBUG_UART_PHYS MSM_UART1_PHYS | ||
85 | #elif CONFIG_MSM_DEBUG_UART == 2 | ||
86 | #define MSM_DEBUG_UART_PHYS MSM_UART2_PHYS | ||
87 | #elif CONFIG_MSM_DEBUG_UART == 3 | ||
88 | #define MSM_DEBUG_UART_PHYS MSM_UART3_PHYS | ||
89 | #endif | ||
90 | #define MSM_DEBUG_UART_SIZE SZ_4K | ||
91 | #endif | ||
92 | |||
93 | #define MSM_SDC1_PHYS 0xA0400000 | 81 | #define MSM_SDC1_PHYS 0xA0400000 |
94 | #define MSM_SDC1_SIZE SZ_4K | 82 | #define MSM_SDC1_SIZE SZ_4K |
95 | 83 | ||
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h index 37694442d1bd..198202c267c8 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h | |||
@@ -89,18 +89,6 @@ | |||
89 | #define MSM_UART3_PHYS 0xACC00000 | 89 | #define MSM_UART3_PHYS 0xACC00000 |
90 | #define MSM_UART3_SIZE SZ_4K | 90 | #define MSM_UART3_SIZE SZ_4K |
91 | 91 | ||
92 | #ifdef CONFIG_MSM_DEBUG_UART | ||
93 | #define MSM_DEBUG_UART_BASE 0xE1000000 | ||
94 | #if CONFIG_MSM_DEBUG_UART == 1 | ||
95 | #define MSM_DEBUG_UART_PHYS MSM_UART1_PHYS | ||
96 | #elif CONFIG_MSM_DEBUG_UART == 2 | ||
97 | #define MSM_DEBUG_UART_PHYS MSM_UART2_PHYS | ||
98 | #elif CONFIG_MSM_DEBUG_UART == 3 | ||
99 | #define MSM_DEBUG_UART_PHYS MSM_UART3_PHYS | ||
100 | #endif | ||
101 | #define MSM_DEBUG_UART_SIZE SZ_4K | ||
102 | #endif | ||
103 | |||
104 | #define MSM_MDC_BASE IOMEM(0xE0200000) | 92 | #define MSM_MDC_BASE IOMEM(0xE0200000) |
105 | #define MSM_MDC_PHYS 0xAA500000 | 93 | #define MSM_MDC_PHYS 0xAA500000 |
106 | #define MSM_MDC_SIZE SZ_1M | 94 | #define MSM_MDC_SIZE SZ_1M |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h index 3c9d9602a318..800b55767e6b 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h | |||
@@ -45,4 +45,9 @@ | |||
45 | #define MSM8960_TMR0_PHYS 0x0208A000 | 45 | #define MSM8960_TMR0_PHYS 0x0208A000 |
46 | #define MSM8960_TMR0_SIZE SZ_4K | 46 | #define MSM8960_TMR0_SIZE SZ_4K |
47 | 47 | ||
48 | #ifdef CONFIG_DEBUG_MSM8960_UART | ||
49 | #define MSM_DEBUG_UART_BASE 0xE1040000 | ||
50 | #define MSM_DEBUG_UART_PHYS 0x16440000 | ||
51 | #endif | ||
52 | |||
48 | #endif | 53 | #endif |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h index d67cd73316f4..0faa894729b7 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h | |||
@@ -83,18 +83,6 @@ | |||
83 | #define MSM_UART3_PHYS 0xA9C00000 | 83 | #define MSM_UART3_PHYS 0xA9C00000 |
84 | #define MSM_UART3_SIZE SZ_4K | 84 | #define MSM_UART3_SIZE SZ_4K |
85 | 85 | ||
86 | #ifdef CONFIG_MSM_DEBUG_UART | ||
87 | #define MSM_DEBUG_UART_BASE 0xE1000000 | ||
88 | #if CONFIG_MSM_DEBUG_UART == 1 | ||
89 | #define MSM_DEBUG_UART_PHYS MSM_UART1_PHYS | ||
90 | #elif CONFIG_MSM_DEBUG_UART == 2 | ||
91 | #define MSM_DEBUG_UART_PHYS MSM_UART2_PHYS | ||
92 | #elif CONFIG_MSM_DEBUG_UART == 3 | ||
93 | #define MSM_DEBUG_UART_PHYS MSM_UART3_PHYS | ||
94 | #endif | ||
95 | #define MSM_DEBUG_UART_SIZE SZ_4K | ||
96 | #endif | ||
97 | |||
98 | #define MSM_MDC_BASE IOMEM(0xE0200000) | 86 | #define MSM_MDC_BASE IOMEM(0xE0200000) |
99 | #define MSM_MDC_PHYS 0xAA500000 | 87 | #define MSM_MDC_PHYS 0xAA500000 |
100 | #define MSM_MDC_SIZE SZ_1M | 88 | #define MSM_MDC_SIZE SZ_1M |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h index 3b19b8f244b8..54e12caa8d86 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h | |||
@@ -62,4 +62,9 @@ | |||
62 | #define MSM8X60_TMR0_PHYS 0x02040000 | 62 | #define MSM8X60_TMR0_PHYS 0x02040000 |
63 | #define MSM8X60_TMR0_SIZE SZ_4K | 63 | #define MSM8X60_TMR0_SIZE SZ_4K |
64 | 64 | ||
65 | #ifdef CONFIG_DEBUG_MSM8660_UART | ||
66 | #define MSM_DEBUG_UART_BASE 0xE1040000 | ||
67 | #define MSM_DEBUG_UART_PHYS 0x19C40000 | ||
68 | #endif | ||
69 | |||
65 | #endif | 70 | #endif |
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h index 4ded15238b60..90682f4599d3 100644 --- a/arch/arm/mach-msm/include/mach/msm_iomap.h +++ b/arch/arm/mach-msm/include/mach/msm_iomap.h | |||
@@ -55,6 +55,18 @@ | |||
55 | 55 | ||
56 | #include "msm_iomap-8960.h" | 56 | #include "msm_iomap-8960.h" |
57 | 57 | ||
58 | #define MSM_DEBUG_UART_SIZE SZ_4K | ||
59 | #if defined(CONFIG_DEBUG_MSM_UART1) | ||
60 | #define MSM_DEBUG_UART_BASE 0xE1000000 | ||
61 | #define MSM_DEBUG_UART_PHYS MSM_UART1_PHYS | ||
62 | #elif defined(CONFIG_DEBUG_MSM_UART2) | ||
63 | #define MSM_DEBUG_UART_BASE 0xE1000000 | ||
64 | #define MSM_DEBUG_UART_PHYS MSM_UART2_PHYS | ||
65 | #elif defined(CONFIG_DEBUG_MSM_UART3) | ||
66 | #define MSM_DEBUG_UART_BASE 0xE1000000 | ||
67 | #define MSM_DEBUG_UART_PHYS MSM_UART3_PHYS | ||
68 | #endif | ||
69 | |||
58 | /* Virtual addresses shared across all MSM targets. */ | 70 | /* Virtual addresses shared across all MSM targets. */ |
59 | #define MSM_CSR_BASE IOMEM(0xE0001000) | 71 | #define MSM_CSR_BASE IOMEM(0xE0001000) |
60 | #define MSM_QGIC_DIST_BASE IOMEM(0xF0000000) | 72 | #define MSM_QGIC_DIST_BASE IOMEM(0xF0000000) |
diff --git a/arch/arm/mach-msm/include/mach/uncompress.h b/arch/arm/mach-msm/include/mach/uncompress.h index d94292c29d8e..169a84007456 100644 --- a/arch/arm/mach-msm/include/mach/uncompress.h +++ b/arch/arm/mach-msm/include/mach/uncompress.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* arch/arm/mach-msm/include/mach/uncompress.h | 1 | /* |
2 | * | ||
3 | * Copyright (C) 2007 Google, Inc. | 2 | * Copyright (C) 2007 Google, Inc. |
3 | * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | ||
4 | * | 4 | * |
5 | * This software is licensed under the terms of the GNU General Public | 5 | * This software is licensed under the terms of the GNU General Public |
6 | * License version 2, as published by the Free Software Foundation, and | 6 | * License version 2, as published by the Free Software Foundation, and |
@@ -14,17 +14,40 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifndef __ASM_ARCH_MSM_UNCOMPRESS_H | 16 | #ifndef __ASM_ARCH_MSM_UNCOMPRESS_H |
17 | #define __ASM_ARCH_MSM_UNCOMPRESS_H | ||
18 | |||
19 | #include <asm/processor.h> | ||
20 | #include <mach/msm_iomap.h> | ||
21 | |||
22 | #define UART_CSR (*(volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x08)) | ||
23 | #define UART_TF (*(volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x0c)) | ||
17 | 24 | ||
18 | #include "hardware.h" | 25 | #define UART_DM_SR (*((volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x08))) |
19 | #include "linux/io.h" | 26 | #define UART_DM_CR (*((volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x10))) |
20 | #include "mach/msm_iomap.h" | 27 | #define UART_DM_ISR (*((volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x14))) |
28 | #define UART_DM_NCHAR (*((volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x40))) | ||
29 | #define UART_DM_TF (*((volatile uint32_t *)(MSM_DEBUG_UART_PHYS + 0x70))) | ||
21 | 30 | ||
22 | static void putc(int c) | 31 | static void putc(int c) |
23 | { | 32 | { |
24 | #if defined(MSM_DEBUG_UART_PHYS) | 33 | #if defined(MSM_DEBUG_UART_PHYS) |
25 | unsigned base = MSM_DEBUG_UART_PHYS; | 34 | #ifdef CONFIG_MSM_HAS_DEBUG_UART_HS |
26 | while (!(readl(base + 0x08) & 0x04)) ; | 35 | /* |
27 | writel(c, base + 0x0c); | 36 | * Wait for TX_READY to be set; but skip it if we have a |
37 | * TX underrun. | ||
38 | */ | ||
39 | if (UART_DM_SR & 0x08) | ||
40 | while (!(UART_DM_ISR & 0x80)) | ||
41 | cpu_relax(); | ||
42 | |||
43 | UART_DM_CR = 0x300; | ||
44 | UART_DM_NCHAR = 0x1; | ||
45 | UART_DM_TF = c; | ||
46 | #else | ||
47 | while (!(UART_CSR & 0x04)) | ||
48 | cpu_relax(); | ||
49 | UART_TF = c; | ||
50 | #endif | ||
28 | #endif | 51 | #endif |
29 | } | 52 | } |
30 | 53 | ||
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c index 8759ecf7454f..578b04e42deb 100644 --- a/arch/arm/mach-msm/io.c +++ b/arch/arm/mach-msm/io.c | |||
@@ -47,7 +47,8 @@ static struct map_desc msm_io_desc[] __initdata = { | |||
47 | MSM_CHIP_DEVICE(GPIO1, MSM7X00), | 47 | MSM_CHIP_DEVICE(GPIO1, MSM7X00), |
48 | MSM_CHIP_DEVICE(GPIO2, MSM7X00), | 48 | MSM_CHIP_DEVICE(GPIO2, MSM7X00), |
49 | MSM_DEVICE(CLK_CTL), | 49 | MSM_DEVICE(CLK_CTL), |
50 | #ifdef CONFIG_MSM_DEBUG_UART | 50 | #if defined(CONFIG_DEBUG_MSM_UART1) || defined(CONFIG_DEBUG_MSM_UART2) || \ |
51 | defined(CONFIG_DEBUG_MSM_UART3) | ||
51 | MSM_DEVICE(DEBUG_UART), | 52 | MSM_DEVICE(DEBUG_UART), |
52 | #endif | 53 | #endif |
53 | #ifdef CONFIG_ARCH_MSM7X30 | 54 | #ifdef CONFIG_ARCH_MSM7X30 |
@@ -84,7 +85,8 @@ static struct map_desc qsd8x50_io_desc[] __initdata = { | |||
84 | MSM_DEVICE(SCPLL), | 85 | MSM_DEVICE(SCPLL), |
85 | MSM_DEVICE(AD5), | 86 | MSM_DEVICE(AD5), |
86 | MSM_DEVICE(MDC), | 87 | MSM_DEVICE(MDC), |
87 | #ifdef CONFIG_MSM_DEBUG_UART | 88 | #if defined(CONFIG_DEBUG_MSM_UART1) || defined(CONFIG_DEBUG_MSM_UART2) || \ |
89 | defined(CONFIG_DEBUG_MSM_UART3) | ||
88 | MSM_DEVICE(DEBUG_UART), | 90 | MSM_DEVICE(DEBUG_UART), |
89 | #endif | 91 | #endif |
90 | { | 92 | { |
@@ -109,6 +111,9 @@ static struct map_desc msm8x60_io_desc[] __initdata = { | |||
109 | MSM_CHIP_DEVICE(TMR0, MSM8X60), | 111 | MSM_CHIP_DEVICE(TMR0, MSM8X60), |
110 | MSM_DEVICE(ACC), | 112 | MSM_DEVICE(ACC), |
111 | MSM_DEVICE(GCC), | 113 | MSM_DEVICE(GCC), |
114 | #ifdef CONFIG_DEBUG_MSM8660_UART | ||
115 | MSM_DEVICE(DEBUG_UART), | ||
116 | #endif | ||
112 | }; | 117 | }; |
113 | 118 | ||
114 | void __init msm_map_msm8x60_io(void) | 119 | void __init msm_map_msm8x60_io(void) |
@@ -123,6 +128,9 @@ static struct map_desc msm8960_io_desc[] __initdata = { | |||
123 | MSM_CHIP_DEVICE(QGIC_CPU, MSM8960), | 128 | MSM_CHIP_DEVICE(QGIC_CPU, MSM8960), |
124 | MSM_CHIP_DEVICE(TMR, MSM8960), | 129 | MSM_CHIP_DEVICE(TMR, MSM8960), |
125 | MSM_CHIP_DEVICE(TMR0, MSM8960), | 130 | MSM_CHIP_DEVICE(TMR0, MSM8960), |
131 | #ifdef CONFIG_DEBUG_MSM8960_UART | ||
132 | MSM_DEVICE(DEBUG_UART), | ||
133 | #endif | ||
126 | }; | 134 | }; |
127 | 135 | ||
128 | void __init msm_map_msm8960_io(void) | 136 | void __init msm_map_msm8960_io(void) |
@@ -146,7 +154,8 @@ static struct map_desc msm7x30_io_desc[] __initdata = { | |||
146 | MSM_DEVICE(SAW), | 154 | MSM_DEVICE(SAW), |
147 | MSM_DEVICE(GCC), | 155 | MSM_DEVICE(GCC), |
148 | MSM_DEVICE(TCSR), | 156 | MSM_DEVICE(TCSR), |
149 | #ifdef CONFIG_MSM_DEBUG_UART | 157 | #if defined(CONFIG_DEBUG_MSM_UART1) || defined(CONFIG_DEBUG_MSM_UART2) || \ |
158 | defined(CONFIG_DEBUG_MSM_UART3) | ||
150 | MSM_DEVICE(DEBUG_UART), | 159 | MSM_DEVICE(DEBUG_UART), |
151 | #endif | 160 | #endif |
152 | { | 161 | { |
diff --git a/arch/arm/mach-msm/platsmp.c b/arch/arm/mach-msm/platsmp.c index fdec58aaa35c..0b3e357c4c8c 100644 --- a/arch/arm/mach-msm/platsmp.c +++ b/arch/arm/mach-msm/platsmp.c | |||
@@ -79,7 +79,7 @@ static __cpuinit void prepare_cold_cpu(unsigned int cpu) | |||
79 | ret = scm_set_boot_addr(virt_to_phys(msm_secondary_startup), | 79 | ret = scm_set_boot_addr(virt_to_phys(msm_secondary_startup), |
80 | SCM_FLAG_COLDBOOT_CPU1); | 80 | SCM_FLAG_COLDBOOT_CPU1); |
81 | if (ret == 0) { | 81 | if (ret == 0) { |
82 | void *sc1_base_ptr; | 82 | void __iomem *sc1_base_ptr; |
83 | sc1_base_ptr = ioremap_nocache(0x00902000, SZ_4K*2); | 83 | sc1_base_ptr = ioremap_nocache(0x00902000, SZ_4K*2); |
84 | if (sc1_base_ptr) { | 84 | if (sc1_base_ptr) { |
85 | writel(0, sc1_base_ptr + VDD_SC1_ARRAY_CLAMP_GFS_CTL); | 85 | writel(0, sc1_base_ptr + VDD_SC1_ARRAY_CLAMP_GFS_CTL); |
diff --git a/arch/arm/mach-mx5/imx51-dt.c b/arch/arm/mach-mx5/imx51-dt.c index ccc61585659b..596edd967dbf 100644 --- a/arch/arm/mach-mx5/imx51-dt.c +++ b/arch/arm/mach-mx5/imx51-dt.c | |||
@@ -44,20 +44,22 @@ static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = { | |||
44 | { /* sentinel */ } | 44 | { /* sentinel */ } |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static void __init imx51_tzic_add_irq_domain(struct device_node *np, | 47 | static int __init imx51_tzic_add_irq_domain(struct device_node *np, |
48 | struct device_node *interrupt_parent) | 48 | struct device_node *interrupt_parent) |
49 | { | 49 | { |
50 | irq_domain_add_simple(np, 0); | 50 | irq_domain_add_simple(np, 0); |
51 | return 0; | ||
51 | } | 52 | } |
52 | 53 | ||
53 | static void __init imx51_gpio_add_irq_domain(struct device_node *np, | 54 | static int __init imx51_gpio_add_irq_domain(struct device_node *np, |
54 | struct device_node *interrupt_parent) | 55 | struct device_node *interrupt_parent) |
55 | { | 56 | { |
56 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS - | 57 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; |
57 | 32 * 4; /* imx51 gets 4 gpio ports */ | ||
58 | 58 | ||
59 | gpio_irq_base -= 32; | ||
59 | irq_domain_add_simple(np, gpio_irq_base); | 60 | irq_domain_add_simple(np, gpio_irq_base); |
60 | gpio_irq_base += 32; | 61 | |
62 | return 0; | ||
61 | } | 63 | } |
62 | 64 | ||
63 | static const struct of_device_id imx51_irq_match[] __initconst = { | 65 | static const struct of_device_id imx51_irq_match[] __initconst = { |
diff --git a/arch/arm/mach-mx5/imx53-dt.c b/arch/arm/mach-mx5/imx53-dt.c index ccaa0b81b768..85bfd5ff21b0 100644 --- a/arch/arm/mach-mx5/imx53-dt.c +++ b/arch/arm/mach-mx5/imx53-dt.c | |||
@@ -48,20 +48,22 @@ static const struct of_dev_auxdata imx53_auxdata_lookup[] __initconst = { | |||
48 | { /* sentinel */ } | 48 | { /* sentinel */ } |
49 | }; | 49 | }; |
50 | 50 | ||
51 | static void __init imx53_tzic_add_irq_domain(struct device_node *np, | 51 | static int __init imx53_tzic_add_irq_domain(struct device_node *np, |
52 | struct device_node *interrupt_parent) | 52 | struct device_node *interrupt_parent) |
53 | { | 53 | { |
54 | irq_domain_add_simple(np, 0); | 54 | irq_domain_add_simple(np, 0); |
55 | return 0; | ||
55 | } | 56 | } |
56 | 57 | ||
57 | static void __init imx53_gpio_add_irq_domain(struct device_node *np, | 58 | static int __init imx53_gpio_add_irq_domain(struct device_node *np, |
58 | struct device_node *interrupt_parent) | 59 | struct device_node *interrupt_parent) |
59 | { | 60 | { |
60 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS - | 61 | static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; |
61 | 32 * 7; /* imx53 gets 7 gpio ports */ | ||
62 | 62 | ||
63 | gpio_irq_base -= 32; | ||
63 | irq_domain_add_simple(np, gpio_irq_base); | 64 | irq_domain_add_simple(np, gpio_irq_base); |
64 | gpio_irq_base += 32; | 65 | |
66 | return 0; | ||
65 | } | 67 | } |
66 | 68 | ||
67 | static const struct of_device_id imx53_irq_match[] __initconst = { | 69 | static const struct of_device_id imx53_irq_match[] __initconst = { |
diff --git a/arch/arm/mach-mxs/include/mach/mx28.h b/arch/arm/mach-mxs/include/mach/mx28.h index 75d86118b76a..30c7990f3c01 100644 --- a/arch/arm/mach-mxs/include/mach/mx28.h +++ b/arch/arm/mach-mxs/include/mach/mx28.h | |||
@@ -104,8 +104,8 @@ | |||
104 | #define MX28_INT_CAN1 9 | 104 | #define MX28_INT_CAN1 9 |
105 | #define MX28_INT_LRADC_TOUCH 10 | 105 | #define MX28_INT_LRADC_TOUCH 10 |
106 | #define MX28_INT_HSADC 13 | 106 | #define MX28_INT_HSADC 13 |
107 | #define MX28_INT_IRADC_THRESH0 14 | 107 | #define MX28_INT_LRADC_THRESH0 14 |
108 | #define MX28_INT_IRADC_THRESH1 15 | 108 | #define MX28_INT_LRADC_THRESH1 15 |
109 | #define MX28_INT_LRADC_CH0 16 | 109 | #define MX28_INT_LRADC_CH0 16 |
110 | #define MX28_INT_LRADC_CH1 17 | 110 | #define MX28_INT_LRADC_CH1 17 |
111 | #define MX28_INT_LRADC_CH2 18 | 111 | #define MX28_INT_LRADC_CH2 18 |
diff --git a/arch/arm/mach-mxs/include/mach/mxs.h b/arch/arm/mach-mxs/include/mach/mxs.h index 0d2d2b470998..bde5f6634747 100644 --- a/arch/arm/mach-mxs/include/mach/mxs.h +++ b/arch/arm/mach-mxs/include/mach/mxs.h | |||
@@ -30,6 +30,7 @@ | |||
30 | */ | 30 | */ |
31 | #define cpu_is_mx23() ( \ | 31 | #define cpu_is_mx23() ( \ |
32 | machine_is_mx23evk() || \ | 32 | machine_is_mx23evk() || \ |
33 | machine_is_stmp378x() || \ | ||
33 | 0) | 34 | 0) |
34 | #define cpu_is_mx28() ( \ | 35 | #define cpu_is_mx28() ( \ |
35 | machine_is_mx28evk() || \ | 36 | machine_is_mx28evk() || \ |
diff --git a/arch/arm/mach-mxs/mach-m28evk.c b/arch/arm/mach-mxs/mach-m28evk.c index 3b1681e4f49a..6b00577b7025 100644 --- a/arch/arm/mach-mxs/mach-m28evk.c +++ b/arch/arm/mach-mxs/mach-m28evk.c | |||
@@ -361,6 +361,6 @@ static struct sys_timer m28evk_timer = { | |||
361 | MACHINE_START(M28EVK, "DENX M28 EVK") | 361 | MACHINE_START(M28EVK, "DENX M28 EVK") |
362 | .map_io = mx28_map_io, | 362 | .map_io = mx28_map_io, |
363 | .init_irq = mx28_init_irq, | 363 | .init_irq = mx28_init_irq, |
364 | .init_machine = m28evk_init, | ||
365 | .timer = &m28evk_timer, | 364 | .timer = &m28evk_timer, |
365 | .init_machine = m28evk_init, | ||
366 | MACHINE_END | 366 | MACHINE_END |
diff --git a/arch/arm/mach-mxs/mach-stmp378x_devb.c b/arch/arm/mach-mxs/mach-stmp378x_devb.c index 177e53123a02..6834dea38c04 100644 --- a/arch/arm/mach-mxs/mach-stmp378x_devb.c +++ b/arch/arm/mach-mxs/mach-stmp378x_devb.c | |||
@@ -115,6 +115,6 @@ static struct sys_timer stmp378x_dvb_timer = { | |||
115 | MACHINE_START(STMP378X, "STMP378X") | 115 | MACHINE_START(STMP378X, "STMP378X") |
116 | .map_io = mx23_map_io, | 116 | .map_io = mx23_map_io, |
117 | .init_irq = mx23_init_irq, | 117 | .init_irq = mx23_init_irq, |
118 | .init_machine = stmp378x_dvb_init, | ||
119 | .timer = &stmp378x_dvb_timer, | 118 | .timer = &stmp378x_dvb_timer, |
119 | .init_machine = stmp378x_dvb_init, | ||
120 | MACHINE_END | 120 | MACHINE_END |
diff --git a/arch/arm/mach-mxs/module-tx28.c b/arch/arm/mach-mxs/module-tx28.c index 0fcff47009cf..9a7b08b2a925 100644 --- a/arch/arm/mach-mxs/module-tx28.c +++ b/arch/arm/mach-mxs/module-tx28.c | |||
@@ -66,11 +66,11 @@ static const iomux_cfg_t tx28_fec1_pads[] __initconst = { | |||
66 | MX28_PAD_ENET0_CRS__ENET1_RX_EN, | 66 | MX28_PAD_ENET0_CRS__ENET1_RX_EN, |
67 | }; | 67 | }; |
68 | 68 | ||
69 | static struct fec_platform_data tx28_fec0_data = { | 69 | static const struct fec_platform_data tx28_fec0_data __initconst = { |
70 | .phy = PHY_INTERFACE_MODE_RMII, | 70 | .phy = PHY_INTERFACE_MODE_RMII, |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static struct fec_platform_data tx28_fec1_data = { | 73 | static const struct fec_platform_data tx28_fec1_data __initconst = { |
74 | .phy = PHY_INTERFACE_MODE_RMII, | 74 | .phy = PHY_INTERFACE_MODE_RMII, |
75 | }; | 75 | }; |
76 | 76 | ||
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c index 1297bb58869c..9ff90a744a21 100644 --- a/arch/arm/mach-omap1/clock_data.c +++ b/arch/arm/mach-omap1/clock_data.c | |||
@@ -16,6 +16,8 @@ | |||
16 | 16 | ||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/cpufreq.h> | ||
20 | #include <linux/delay.h> | ||
19 | #include <linux/io.h> | 21 | #include <linux/io.h> |
20 | 22 | ||
21 | #include <asm/mach-types.h> /* for machine_is_* */ | 23 | #include <asm/mach-types.h> /* for machine_is_* */ |
@@ -927,16 +929,22 @@ int __init omap1_clk_init(void) | |||
927 | 929 | ||
928 | void __init omap1_clk_late_init(void) | 930 | void __init omap1_clk_late_init(void) |
929 | { | 931 | { |
930 | if (ck_dpll1.rate >= OMAP1_DPLL1_SANE_VALUE) | 932 | unsigned long rate = ck_dpll1.rate; |
933 | |||
934 | if (rate >= OMAP1_DPLL1_SANE_VALUE) | ||
931 | return; | 935 | return; |
932 | 936 | ||
937 | /* System booting at unusable rate, force reprogramming of DPLL1 */ | ||
938 | ck_dpll1_p->rate = 0; | ||
939 | |||
933 | /* Find the highest supported frequency and enable it */ | 940 | /* Find the highest supported frequency and enable it */ |
934 | if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) { | 941 | if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) { |
935 | pr_err("System frequencies not set, using default. Check your config.\n"); | 942 | pr_err("System frequencies not set, using default. Check your config.\n"); |
936 | omap_writew(0x2290, DPLL_CTL); | 943 | omap_writew(0x2290, DPLL_CTL); |
937 | omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL); | 944 | omap_writew(cpu_is_omap7xx() ? 0x2005 : 0x0005, ARM_CKCTL); |
938 | ck_dpll1.rate = OMAP1_DPLL1_SANE_VALUE; | 945 | ck_dpll1.rate = OMAP1_DPLL1_SANE_VALUE; |
939 | } | 946 | } |
940 | propagate_rate(&ck_dpll1); | 947 | propagate_rate(&ck_dpll1); |
941 | omap1_show_rates(); | 948 | omap1_show_rates(); |
949 | loops_per_jiffy = cpufreq_scale(loops_per_jiffy, rate, ck_dpll1.rate); | ||
942 | } | 950 | } |
diff --git a/arch/arm/mach-prima2/pm.c b/arch/arm/mach-prima2/pm.c index cb53160f6c5d..26ebb57719df 100644 --- a/arch/arm/mach-prima2/pm.c +++ b/arch/arm/mach-prima2/pm.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/suspend.h> | 10 | #include <linux/suspend.h> |
11 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
12 | #include <linux/module.h> | ||
12 | #include <linux/of.h> | 13 | #include <linux/of.h> |
13 | #include <linux/of_address.h> | 14 | #include <linux/of_address.h> |
14 | #include <linux/of_device.h> | 15 | #include <linux/of_device.h> |
diff --git a/arch/arm/mach-prima2/prima2.c b/arch/arm/mach-prima2/prima2.c index ef555c041962..a12b689a8702 100644 --- a/arch/arm/mach-prima2/prima2.c +++ b/arch/arm/mach-prima2/prima2.c | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <asm/sizes.h> | ||
11 | #include <asm/mach-types.h> | 12 | #include <asm/mach-types.h> |
12 | #include <asm/mach/arch.h> | 13 | #include <asm/mach/arch.h> |
13 | #include <linux/of.h> | 14 | #include <linux/of.h> |
diff --git a/arch/arm/mach-s3c64xx/dev-spi.c b/arch/arm/mach-s3c64xx/dev-spi.c index 5e6b42089eb4..3341fd118723 100644 --- a/arch/arm/mach-s3c64xx/dev-spi.c +++ b/arch/arm/mach-s3c64xx/dev-spi.c | |||
@@ -10,6 +10,7 @@ | |||
10 | 10 | ||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/export.h> | ||
13 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
14 | #include <linux/dma-mapping.h> | 15 | #include <linux/dma-mapping.h> |
15 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
diff --git a/arch/arm/mach-s3c64xx/s3c6400.c b/arch/arm/mach-s3c64xx/s3c6400.c index 7a3bc32df425..51c00f2453c6 100644 --- a/arch/arm/mach-s3c64xx/s3c6400.c +++ b/arch/arm/mach-s3c64xx/s3c6400.c | |||
@@ -70,7 +70,7 @@ void __init s3c6400_init_irq(void) | |||
70 | s3c64xx_init_irq(~0 & ~(0xf << 5), ~0); | 70 | s3c64xx_init_irq(~0 & ~(0xf << 5), ~0); |
71 | } | 71 | } |
72 | 72 | ||
73 | struct sysdev_class s3c6400_sysclass = { | 73 | static struct sysdev_class s3c6400_sysclass = { |
74 | .name = "s3c6400-core", | 74 | .name = "s3c6400-core", |
75 | }; | 75 | }; |
76 | 76 | ||
diff --git a/arch/arm/mach-s3c64xx/setup-fb-24bpp.c b/arch/arm/mach-s3c64xx/setup-fb-24bpp.c index 83d2afb79e9f..2cf80026c58d 100644 --- a/arch/arm/mach-s3c64xx/setup-fb-24bpp.c +++ b/arch/arm/mach-s3c64xx/setup-fb-24bpp.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include <plat/fb.h> | 20 | #include <plat/fb.h> |
21 | #include <plat/gpio-cfg.h> | 21 | #include <plat/gpio-cfg.h> |
22 | 22 | ||
23 | extern void s3c64xx_fb_gpio_setup_24bpp(void) | 23 | void s3c64xx_fb_gpio_setup_24bpp(void) |
24 | { | 24 | { |
25 | s3c_gpio_cfgrange_nopull(S3C64XX_GPI(0), 16, S3C_GPIO_SFN(2)); | 25 | s3c_gpio_cfgrange_nopull(S3C64XX_GPI(0), 16, S3C_GPIO_SFN(2)); |
26 | s3c_gpio_cfgrange_nopull(S3C64XX_GPJ(0), 12, S3C_GPIO_SFN(2)); | 26 | s3c_gpio_cfgrange_nopull(S3C64XX_GPJ(0), 12, S3C_GPIO_SFN(2)); |
diff --git a/arch/arm/mach-sa1100/Makefile.boot b/arch/arm/mach-sa1100/Makefile.boot index 5a616f6e5612..f7951aa04562 100644 --- a/arch/arm/mach-sa1100/Makefile.boot +++ b/arch/arm/mach-sa1100/Makefile.boot | |||
@@ -1,5 +1,5 @@ | |||
1 | ifeq ($(CONFIG_ARCH_SA1100),y) | 1 | ifeq ($(CONFIG_SA1111),y) |
2 | zreladdr-$(CONFIG_SA1111) += 0xc0208000 | 2 | zreladdr-y += 0xc0208000 |
3 | else | 3 | else |
4 | zreladdr-y += 0xc0008000 | 4 | zreladdr-y += 0xc0008000 |
5 | endif | 5 | endif |
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c index 1f17bde52cd4..7c756fb189f7 100644 --- a/arch/avr32/boards/atngw100/setup.c +++ b/arch/avr32/boards/atngw100/setup.c | |||
@@ -109,7 +109,7 @@ struct eth_addr { | |||
109 | u8 addr[6]; | 109 | u8 addr[6]; |
110 | }; | 110 | }; |
111 | static struct eth_addr __initdata hw_addr[2]; | 111 | static struct eth_addr __initdata hw_addr[2]; |
112 | static struct eth_platform_data __initdata eth_data[2]; | 112 | static struct macb_platform_data __initdata eth_data[2]; |
113 | 113 | ||
114 | static struct spi_board_info spi0_board_info[] __initdata = { | 114 | static struct spi_board_info spi0_board_info[] __initdata = { |
115 | { | 115 | { |
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c index 4643ff5107c9..c56ddac85d61 100644 --- a/arch/avr32/boards/atstk1000/atstk1002.c +++ b/arch/avr32/boards/atstk1000/atstk1002.c | |||
@@ -105,7 +105,7 @@ struct eth_addr { | |||
105 | }; | 105 | }; |
106 | 106 | ||
107 | static struct eth_addr __initdata hw_addr[2]; | 107 | static struct eth_addr __initdata hw_addr[2]; |
108 | static struct eth_platform_data __initdata eth_data[2] = { | 108 | static struct macb_platform_data __initdata eth_data[2] = { |
109 | { | 109 | { |
110 | /* | 110 | /* |
111 | * The MDIO pullups on STK1000 are a bit too weak for | 111 | * The MDIO pullups on STK1000 are a bit too weak for |
diff --git a/arch/avr32/boards/favr-32/setup.c b/arch/avr32/boards/favr-32/setup.c index 86fab77a5a00..27bd6fbe21cb 100644 --- a/arch/avr32/boards/favr-32/setup.c +++ b/arch/avr32/boards/favr-32/setup.c | |||
@@ -50,7 +50,7 @@ struct eth_addr { | |||
50 | u8 addr[6]; | 50 | u8 addr[6]; |
51 | }; | 51 | }; |
52 | static struct eth_addr __initdata hw_addr[1]; | 52 | static struct eth_addr __initdata hw_addr[1]; |
53 | static struct eth_platform_data __initdata eth_data[1] = { | 53 | static struct macb_platform_data __initdata eth_data[1] = { |
54 | { | 54 | { |
55 | .phy_mask = ~(1U << 1), | 55 | .phy_mask = ~(1U << 1), |
56 | }, | 56 | }, |
diff --git a/arch/avr32/boards/hammerhead/setup.c b/arch/avr32/boards/hammerhead/setup.c index da14fbdd4e8e..9d1efd1cd425 100644 --- a/arch/avr32/boards/hammerhead/setup.c +++ b/arch/avr32/boards/hammerhead/setup.c | |||
@@ -102,7 +102,7 @@ struct eth_addr { | |||
102 | }; | 102 | }; |
103 | 103 | ||
104 | static struct eth_addr __initdata hw_addr[1]; | 104 | static struct eth_addr __initdata hw_addr[1]; |
105 | static struct eth_platform_data __initdata eth_data[1]; | 105 | static struct macb_platform_data __initdata eth_data[1]; |
106 | 106 | ||
107 | /* | 107 | /* |
108 | * The next two functions should go away as the boot loader is | 108 | * The next two functions should go away as the boot loader is |
diff --git a/arch/avr32/boards/merisc/setup.c b/arch/avr32/boards/merisc/setup.c index e61bc948f959..ed137e335796 100644 --- a/arch/avr32/boards/merisc/setup.c +++ b/arch/avr32/boards/merisc/setup.c | |||
@@ -52,7 +52,7 @@ struct eth_addr { | |||
52 | }; | 52 | }; |
53 | 53 | ||
54 | static struct eth_addr __initdata hw_addr[2]; | 54 | static struct eth_addr __initdata hw_addr[2]; |
55 | static struct eth_platform_data __initdata eth_data[2]; | 55 | static struct macb_platform_data __initdata eth_data[2]; |
56 | 56 | ||
57 | static int ads7846_get_pendown_state_PB26(void) | 57 | static int ads7846_get_pendown_state_PB26(void) |
58 | { | 58 | { |
diff --git a/arch/avr32/boards/mimc200/setup.c b/arch/avr32/boards/mimc200/setup.c index c4da5cba2dbf..05358aa5ef7d 100644 --- a/arch/avr32/boards/mimc200/setup.c +++ b/arch/avr32/boards/mimc200/setup.c | |||
@@ -86,7 +86,7 @@ struct eth_addr { | |||
86 | u8 addr[6]; | 86 | u8 addr[6]; |
87 | }; | 87 | }; |
88 | static struct eth_addr __initdata hw_addr[2]; | 88 | static struct eth_addr __initdata hw_addr[2]; |
89 | static struct eth_platform_data __initdata eth_data[2]; | 89 | static struct macb_platform_data __initdata eth_data[2]; |
90 | 90 | ||
91 | static struct spi_eeprom eeprom_25lc010 = { | 91 | static struct spi_eeprom eeprom_25lc010 = { |
92 | .name = "25lc010", | 92 | .name = "25lc010", |
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 7fbf0dcb9afe..402a7bb72669 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -1067,7 +1067,7 @@ void __init at32_setup_serial_console(unsigned int usart_id) | |||
1067 | * -------------------------------------------------------------------- */ | 1067 | * -------------------------------------------------------------------- */ |
1068 | 1068 | ||
1069 | #ifdef CONFIG_CPU_AT32AP7000 | 1069 | #ifdef CONFIG_CPU_AT32AP7000 |
1070 | static struct eth_platform_data macb0_data; | 1070 | static struct macb_platform_data macb0_data; |
1071 | static struct resource macb0_resource[] = { | 1071 | static struct resource macb0_resource[] = { |
1072 | PBMEM(0xfff01800), | 1072 | PBMEM(0xfff01800), |
1073 | IRQ(25), | 1073 | IRQ(25), |
@@ -1076,7 +1076,7 @@ DEFINE_DEV_DATA(macb, 0); | |||
1076 | DEV_CLK(hclk, macb0, hsb, 8); | 1076 | DEV_CLK(hclk, macb0, hsb, 8); |
1077 | DEV_CLK(pclk, macb0, pbb, 6); | 1077 | DEV_CLK(pclk, macb0, pbb, 6); |
1078 | 1078 | ||
1079 | static struct eth_platform_data macb1_data; | 1079 | static struct macb_platform_data macb1_data; |
1080 | static struct resource macb1_resource[] = { | 1080 | static struct resource macb1_resource[] = { |
1081 | PBMEM(0xfff01c00), | 1081 | PBMEM(0xfff01c00), |
1082 | IRQ(26), | 1082 | IRQ(26), |
@@ -1086,7 +1086,7 @@ DEV_CLK(hclk, macb1, hsb, 9); | |||
1086 | DEV_CLK(pclk, macb1, pbb, 7); | 1086 | DEV_CLK(pclk, macb1, pbb, 7); |
1087 | 1087 | ||
1088 | struct platform_device *__init | 1088 | struct platform_device *__init |
1089 | at32_add_device_eth(unsigned int id, struct eth_platform_data *data) | 1089 | at32_add_device_eth(unsigned int id, struct macb_platform_data *data) |
1090 | { | 1090 | { |
1091 | struct platform_device *pdev; | 1091 | struct platform_device *pdev; |
1092 | u32 pin_mask; | 1092 | u32 pin_mask; |
@@ -1163,7 +1163,7 @@ at32_add_device_eth(unsigned int id, struct eth_platform_data *data) | |||
1163 | return NULL; | 1163 | return NULL; |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | memcpy(pdev->dev.platform_data, data, sizeof(struct eth_platform_data)); | 1166 | memcpy(pdev->dev.platform_data, data, sizeof(struct macb_platform_data)); |
1167 | platform_device_register(pdev); | 1167 | platform_device_register(pdev); |
1168 | 1168 | ||
1169 | return pdev; | 1169 | return pdev; |
diff --git a/arch/avr32/mach-at32ap/include/mach/board.h b/arch/avr32/mach-at32ap/include/mach/board.h index 5d7ffca7d69f..67b111ce332d 100644 --- a/arch/avr32/mach-at32ap/include/mach/board.h +++ b/arch/avr32/mach-at32ap/include/mach/board.h | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/types.h> | 7 | #include <linux/types.h> |
8 | #include <linux/serial.h> | 8 | #include <linux/serial.h> |
9 | #include <linux/platform_data/macb.h> | ||
9 | 10 | ||
10 | #define GPIO_PIN_NONE (-1) | 11 | #define GPIO_PIN_NONE (-1) |
11 | 12 | ||
@@ -42,12 +43,8 @@ struct atmel_uart_data { | |||
42 | void at32_map_usart(unsigned int hw_id, unsigned int line, int flags); | 43 | void at32_map_usart(unsigned int hw_id, unsigned int line, int flags); |
43 | struct platform_device *at32_add_device_usart(unsigned int id); | 44 | struct platform_device *at32_add_device_usart(unsigned int id); |
44 | 45 | ||
45 | struct eth_platform_data { | ||
46 | u32 phy_mask; | ||
47 | u8 is_rmii; | ||
48 | }; | ||
49 | struct platform_device * | 46 | struct platform_device * |
50 | at32_add_device_eth(unsigned int id, struct eth_platform_data *data); | 47 | at32_add_device_eth(unsigned int id, struct macb_platform_data *data); |
51 | 48 | ||
52 | struct spi_board_info; | 49 | struct spi_board_info; |
53 | struct platform_device * | 50 | struct platform_device * |
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 43f984e93970..303192fc9260 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
@@ -350,10 +350,12 @@ | |||
350 | #define __NR_clock_adjtime 342 | 350 | #define __NR_clock_adjtime 342 |
351 | #define __NR_syncfs 343 | 351 | #define __NR_syncfs 343 |
352 | #define __NR_setns 344 | 352 | #define __NR_setns 344 |
353 | #define __NR_process_vm_readv 345 | ||
354 | #define __NR_process_vm_writev 346 | ||
353 | 355 | ||
354 | #ifdef __KERNEL__ | 356 | #ifdef __KERNEL__ |
355 | 357 | ||
356 | #define NR_syscalls 345 | 358 | #define NR_syscalls 347 |
357 | 359 | ||
358 | #define __ARCH_WANT_IPC_PARSE_VERSION | 360 | #define __ARCH_WANT_IPC_PARSE_VERSION |
359 | #define __ARCH_WANT_OLD_READDIR | 361 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S index c468f2edaa85..ce827b376110 100644 --- a/arch/m68k/kernel/syscalltable.S +++ b/arch/m68k/kernel/syscalltable.S | |||
@@ -365,4 +365,6 @@ ENTRY(sys_call_table) | |||
365 | .long sys_clock_adjtime | 365 | .long sys_clock_adjtime |
366 | .long sys_syncfs | 366 | .long sys_syncfs |
367 | .long sys_setns | 367 | .long sys_setns |
368 | .long sys_process_vm_readv /* 345 */ | ||
369 | .long sys_process_vm_writev | ||
368 | 370 | ||
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c index 4f2971bcf8e5..315fc0b250f8 100644 --- a/arch/mips/kernel/perf_event_mipsxx.c +++ b/arch/mips/kernel/perf_event_mipsxx.c | |||
@@ -623,7 +623,7 @@ static int mipspmu_event_init(struct perf_event *event) | |||
623 | if (!atomic_inc_not_zero(&active_events)) { | 623 | if (!atomic_inc_not_zero(&active_events)) { |
624 | if (atomic_read(&active_events) > MIPS_MAX_HWEVENTS) { | 624 | if (atomic_read(&active_events) > MIPS_MAX_HWEVENTS) { |
625 | atomic_dec(&active_events); | 625 | atomic_dec(&active_events); |
626 | return -ENOSPC; | 626 | return -EINVAL; |
627 | } | 627 | } |
628 | 628 | ||
629 | mutex_lock(&pmu_reserve_mutex); | 629 | mutex_lock(&pmu_reserve_mutex); |
@@ -732,15 +732,15 @@ static int validate_group(struct perf_event *event) | |||
732 | memset(&fake_cpuc, 0, sizeof(fake_cpuc)); | 732 | memset(&fake_cpuc, 0, sizeof(fake_cpuc)); |
733 | 733 | ||
734 | if (!validate_event(&fake_cpuc, leader)) | 734 | if (!validate_event(&fake_cpuc, leader)) |
735 | return -ENOSPC; | 735 | return -EINVAL; |
736 | 736 | ||
737 | list_for_each_entry(sibling, &leader->sibling_list, group_entry) { | 737 | list_for_each_entry(sibling, &leader->sibling_list, group_entry) { |
738 | if (!validate_event(&fake_cpuc, sibling)) | 738 | if (!validate_event(&fake_cpuc, sibling)) |
739 | return -ENOSPC; | 739 | return -EINVAL; |
740 | } | 740 | } |
741 | 741 | ||
742 | if (!validate_event(&fake_cpuc, event)) | 742 | if (!validate_event(&fake_cpuc, event)) |
743 | return -ENOSPC; | 743 | return -EINVAL; |
744 | 744 | ||
745 | return 0; | 745 | return 0; |
746 | } | 746 | } |
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index 524d23b8610c..4f289ff0b7fe 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h | |||
@@ -599,10 +599,10 @@ static inline pgste_t pgste_update_all(pte_t *ptep, pgste_t pgste) | |||
599 | skey = page_get_storage_key(address); | 599 | skey = page_get_storage_key(address); |
600 | bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); | 600 | bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); |
601 | /* Clear page changed & referenced bit in the storage key */ | 601 | /* Clear page changed & referenced bit in the storage key */ |
602 | if (bits) { | 602 | if (bits & _PAGE_CHANGED) |
603 | skey ^= bits; | 603 | page_set_storage_key(address, skey ^ bits, 1); |
604 | page_set_storage_key(address, skey, 1); | 604 | else if (bits) |
605 | } | 605 | page_reset_referenced(address); |
606 | /* Transfer page changed & referenced bit to guest bits in pgste */ | 606 | /* Transfer page changed & referenced bit to guest bits in pgste */ |
607 | pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */ | 607 | pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */ |
608 | /* Get host changed & referenced bits from pgste */ | 608 | /* Get host changed & referenced bits from pgste */ |
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 450931a45b68..573bc29551ef 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -296,13 +296,6 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data) | |||
296 | ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)))) | 296 | ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)))) |
297 | /* Invalid psw mask. */ | 297 | /* Invalid psw mask. */ |
298 | return -EINVAL; | 298 | return -EINVAL; |
299 | if (addr == (addr_t) &dummy->regs.psw.addr) | ||
300 | /* | ||
301 | * The debugger changed the instruction address, | ||
302 | * reset system call restart, see signal.c:do_signal | ||
303 | */ | ||
304 | task_thread_info(child)->system_call = 0; | ||
305 | |||
306 | *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; | 299 | *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; |
307 | 300 | ||
308 | } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { | 301 | } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { |
@@ -614,11 +607,6 @@ static int __poke_user_compat(struct task_struct *child, | |||
614 | /* Transfer 31 bit amode bit to psw mask. */ | 607 | /* Transfer 31 bit amode bit to psw mask. */ |
615 | regs->psw.mask = (regs->psw.mask & ~PSW_MASK_BA) | | 608 | regs->psw.mask = (regs->psw.mask & ~PSW_MASK_BA) | |
616 | (__u64)(tmp & PSW32_ADDR_AMODE); | 609 | (__u64)(tmp & PSW32_ADDR_AMODE); |
617 | /* | ||
618 | * The debugger changed the instruction address, | ||
619 | * reset system call restart, see signal.c:do_signal | ||
620 | */ | ||
621 | task_thread_info(child)->system_call = 0; | ||
622 | } else { | 610 | } else { |
623 | /* gpr 0-15 */ | 611 | /* gpr 0-15 */ |
624 | *(__u32*)((addr_t) ®s->psw + addr*2 + 4) = tmp; | 612 | *(__u32*)((addr_t) ®s->psw + addr*2 + 4) = tmp; |
@@ -905,6 +893,14 @@ static int s390_last_break_get(struct task_struct *target, | |||
905 | return 0; | 893 | return 0; |
906 | } | 894 | } |
907 | 895 | ||
896 | static int s390_last_break_set(struct task_struct *target, | ||
897 | const struct user_regset *regset, | ||
898 | unsigned int pos, unsigned int count, | ||
899 | const void *kbuf, const void __user *ubuf) | ||
900 | { | ||
901 | return 0; | ||
902 | } | ||
903 | |||
908 | #endif | 904 | #endif |
909 | 905 | ||
910 | static int s390_system_call_get(struct task_struct *target, | 906 | static int s390_system_call_get(struct task_struct *target, |
@@ -951,6 +947,7 @@ static const struct user_regset s390_regsets[] = { | |||
951 | .size = sizeof(long), | 947 | .size = sizeof(long), |
952 | .align = sizeof(long), | 948 | .align = sizeof(long), |
953 | .get = s390_last_break_get, | 949 | .get = s390_last_break_get, |
950 | .set = s390_last_break_set, | ||
954 | }, | 951 | }, |
955 | #endif | 952 | #endif |
956 | [REGSET_SYSTEM_CALL] = { | 953 | [REGSET_SYSTEM_CALL] = { |
@@ -1116,6 +1113,14 @@ static int s390_compat_last_break_get(struct task_struct *target, | |||
1116 | return 0; | 1113 | return 0; |
1117 | } | 1114 | } |
1118 | 1115 | ||
1116 | static int s390_compat_last_break_set(struct task_struct *target, | ||
1117 | const struct user_regset *regset, | ||
1118 | unsigned int pos, unsigned int count, | ||
1119 | const void *kbuf, const void __user *ubuf) | ||
1120 | { | ||
1121 | return 0; | ||
1122 | } | ||
1123 | |||
1119 | static const struct user_regset s390_compat_regsets[] = { | 1124 | static const struct user_regset s390_compat_regsets[] = { |
1120 | [REGSET_GENERAL] = { | 1125 | [REGSET_GENERAL] = { |
1121 | .core_note_type = NT_PRSTATUS, | 1126 | .core_note_type = NT_PRSTATUS, |
@@ -1139,6 +1144,7 @@ static const struct user_regset s390_compat_regsets[] = { | |||
1139 | .size = sizeof(long), | 1144 | .size = sizeof(long), |
1140 | .align = sizeof(long), | 1145 | .align = sizeof(long), |
1141 | .get = s390_compat_last_break_get, | 1146 | .get = s390_compat_last_break_get, |
1147 | .set = s390_compat_last_break_set, | ||
1142 | }, | 1148 | }, |
1143 | [REGSET_SYSTEM_CALL] = { | 1149 | [REGSET_SYSTEM_CALL] = { |
1144 | .core_note_type = NT_S390_SYSTEM_CALL, | 1150 | .core_note_type = NT_S390_SYSTEM_CALL, |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index e58a462949b1..e54c4ff8abaa 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -579,7 +579,7 @@ static unsigned long __init find_crash_base(unsigned long crash_size, | |||
579 | *msg = "first memory chunk must be at least crashkernel size"; | 579 | *msg = "first memory chunk must be at least crashkernel size"; |
580 | return 0; | 580 | return 0; |
581 | } | 581 | } |
582 | if (is_kdump_kernel() && (crash_size == OLDMEM_SIZE)) | 582 | if (OLDMEM_BASE && crash_size == OLDMEM_SIZE) |
583 | return OLDMEM_BASE; | 583 | return OLDMEM_BASE; |
584 | 584 | ||
585 | for (i = MEMORY_CHUNKS - 1; i >= 0; i--) { | 585 | for (i = MEMORY_CHUNKS - 1; i >= 0; i--) { |
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index 05a85bc14c98..7f6f9f354545 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
@@ -460,9 +460,9 @@ void do_signal(struct pt_regs *regs) | |||
460 | regs->svc_code >> 16); | 460 | regs->svc_code >> 16); |
461 | break; | 461 | break; |
462 | } | 462 | } |
463 | /* No longer in a system call */ | ||
464 | clear_thread_flag(TIF_SYSCALL); | ||
465 | } | 463 | } |
464 | /* No longer in a system call */ | ||
465 | clear_thread_flag(TIF_SYSCALL); | ||
466 | 466 | ||
467 | if ((is_compat_task() ? | 467 | if ((is_compat_task() ? |
468 | handle_signal32(signr, &ka, &info, oldset, regs) : | 468 | handle_signal32(signr, &ka, &info, oldset, regs) : |
@@ -486,6 +486,7 @@ void do_signal(struct pt_regs *regs) | |||
486 | } | 486 | } |
487 | 487 | ||
488 | /* No handlers present - check for system call restart */ | 488 | /* No handlers present - check for system call restart */ |
489 | clear_thread_flag(TIF_SYSCALL); | ||
489 | if (current_thread_info()->system_call) { | 490 | if (current_thread_info()->system_call) { |
490 | regs->svc_code = current_thread_info()->system_call; | 491 | regs->svc_code = current_thread_info()->system_call; |
491 | switch (regs->gprs[2]) { | 492 | switch (regs->gprs[2]) { |
@@ -500,9 +501,6 @@ void do_signal(struct pt_regs *regs) | |||
500 | regs->gprs[2] = regs->orig_gpr2; | 501 | regs->gprs[2] = regs->orig_gpr2; |
501 | set_thread_flag(TIF_SYSCALL); | 502 | set_thread_flag(TIF_SYSCALL); |
502 | break; | 503 | break; |
503 | default: | ||
504 | clear_thread_flag(TIF_SYSCALL); | ||
505 | break; | ||
506 | } | 504 | } |
507 | } | 505 | } |
508 | 506 | ||
diff --git a/arch/tile/include/asm/irq.h b/arch/tile/include/asm/irq.h index 94e9a511de84..f80f8ceabc67 100644 --- a/arch/tile/include/asm/irq.h +++ b/arch/tile/include/asm/irq.h | |||
@@ -74,16 +74,6 @@ enum { | |||
74 | */ | 74 | */ |
75 | void tile_irq_activate(unsigned int irq, int tile_irq_type); | 75 | void tile_irq_activate(unsigned int irq, int tile_irq_type); |
76 | 76 | ||
77 | /* | ||
78 | * For onboard, non-PCI (e.g. TILE_IRQ_PERCPU) devices, drivers know | ||
79 | * how to use enable/disable_percpu_irq() to manage interrupts on each | ||
80 | * core. We can't use the generic enable/disable_irq() because they | ||
81 | * use a single reference count per irq, rather than per cpu per irq. | ||
82 | */ | ||
83 | void enable_percpu_irq(unsigned int irq); | ||
84 | void disable_percpu_irq(unsigned int irq); | ||
85 | |||
86 | |||
87 | void setup_irq_regs(void); | 77 | void setup_irq_regs(void); |
88 | 78 | ||
89 | #endif /* _ASM_TILE_IRQ_H */ | 79 | #endif /* _ASM_TILE_IRQ_H */ |
diff --git a/arch/tile/kernel/irq.c b/arch/tile/kernel/irq.c index aa0134db2dd6..02e628065012 100644 --- a/arch/tile/kernel/irq.c +++ b/arch/tile/kernel/irq.c | |||
@@ -152,14 +152,13 @@ void tile_dev_intr(struct pt_regs *regs, int intnum) | |||
152 | * Remove an irq from the disabled mask. If we're in an interrupt | 152 | * Remove an irq from the disabled mask. If we're in an interrupt |
153 | * context, defer enabling the HW interrupt until we leave. | 153 | * context, defer enabling the HW interrupt until we leave. |
154 | */ | 154 | */ |
155 | void enable_percpu_irq(unsigned int irq) | 155 | static void tile_irq_chip_enable(struct irq_data *d) |
156 | { | 156 | { |
157 | get_cpu_var(irq_disable_mask) &= ~(1UL << irq); | 157 | get_cpu_var(irq_disable_mask) &= ~(1UL << d->irq); |
158 | if (__get_cpu_var(irq_depth) == 0) | 158 | if (__get_cpu_var(irq_depth) == 0) |
159 | unmask_irqs(1UL << irq); | 159 | unmask_irqs(1UL << d->irq); |
160 | put_cpu_var(irq_disable_mask); | 160 | put_cpu_var(irq_disable_mask); |
161 | } | 161 | } |
162 | EXPORT_SYMBOL(enable_percpu_irq); | ||
163 | 162 | ||
164 | /* | 163 | /* |
165 | * Add an irq to the disabled mask. We disable the HW interrupt | 164 | * Add an irq to the disabled mask. We disable the HW interrupt |
@@ -167,13 +166,12 @@ EXPORT_SYMBOL(enable_percpu_irq); | |||
167 | * in an interrupt context, the return path is careful to avoid | 166 | * in an interrupt context, the return path is careful to avoid |
168 | * unmasking a newly disabled interrupt. | 167 | * unmasking a newly disabled interrupt. |
169 | */ | 168 | */ |
170 | void disable_percpu_irq(unsigned int irq) | 169 | static void tile_irq_chip_disable(struct irq_data *d) |
171 | { | 170 | { |
172 | get_cpu_var(irq_disable_mask) |= (1UL << irq); | 171 | get_cpu_var(irq_disable_mask) |= (1UL << d->irq); |
173 | mask_irqs(1UL << irq); | 172 | mask_irqs(1UL << d->irq); |
174 | put_cpu_var(irq_disable_mask); | 173 | put_cpu_var(irq_disable_mask); |
175 | } | 174 | } |
176 | EXPORT_SYMBOL(disable_percpu_irq); | ||
177 | 175 | ||
178 | /* Mask an interrupt. */ | 176 | /* Mask an interrupt. */ |
179 | static void tile_irq_chip_mask(struct irq_data *d) | 177 | static void tile_irq_chip_mask(struct irq_data *d) |
@@ -209,6 +207,8 @@ static void tile_irq_chip_eoi(struct irq_data *d) | |||
209 | 207 | ||
210 | static struct irq_chip tile_irq_chip = { | 208 | static struct irq_chip tile_irq_chip = { |
211 | .name = "tile_irq_chip", | 209 | .name = "tile_irq_chip", |
210 | .irq_enable = tile_irq_chip_enable, | ||
211 | .irq_disable = tile_irq_chip_disable, | ||
212 | .irq_ack = tile_irq_chip_ack, | 212 | .irq_ack = tile_irq_chip_ack, |
213 | .irq_eoi = tile_irq_chip_eoi, | 213 | .irq_eoi = tile_irq_chip_eoi, |
214 | .irq_mask = tile_irq_chip_mask, | 214 | .irq_mask = tile_irq_chip_mask, |
diff --git a/arch/tile/kernel/pci-dma.c b/arch/tile/kernel/pci-dma.c index 658f2ce426a4..b3ed19f8779c 100644 --- a/arch/tile/kernel/pci-dma.c +++ b/arch/tile/kernel/pci-dma.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
16 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
17 | #include <linux/vmalloc.h> | 17 | #include <linux/vmalloc.h> |
18 | #include <linux/export.h> | ||
18 | #include <asm/tlbflush.h> | 19 | #include <asm/tlbflush.h> |
19 | #include <asm/homecache.h> | 20 | #include <asm/homecache.h> |
20 | 21 | ||
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c index 2a8014cb1ff5..9d610d3fb11e 100644 --- a/arch/tile/kernel/pci.c +++ b/arch/tile/kernel/pci.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/uaccess.h> | 26 | #include <linux/uaccess.h> |
27 | #include <linux/export.h> | ||
27 | 28 | ||
28 | #include <asm/processor.h> | 29 | #include <asm/processor.h> |
29 | #include <asm/sections.h> | 30 | #include <asm/sections.h> |
diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c index b671a86f4515..602908268093 100644 --- a/arch/tile/kernel/sysfs.c +++ b/arch/tile/kernel/sysfs.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/cpu.h> | 18 | #include <linux/cpu.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/smp.h> | 20 | #include <linux/smp.h> |
21 | #include <linux/stat.h> | ||
21 | #include <hv/hypervisor.h> | 22 | #include <hv/hypervisor.h> |
22 | 23 | ||
23 | /* Return a string queried from the hypervisor, truncated to page size. */ | 24 | /* Return a string queried from the hypervisor, truncated to page size. */ |
diff --git a/arch/tile/lib/exports.c b/arch/tile/lib/exports.c index a87d2a859ba9..2a81d32de0da 100644 --- a/arch/tile/lib/exports.c +++ b/arch/tile/lib/exports.c | |||
@@ -39,6 +39,9 @@ EXPORT_SYMBOL(finv_user_asm); | |||
39 | EXPORT_SYMBOL(current_text_addr); | 39 | EXPORT_SYMBOL(current_text_addr); |
40 | EXPORT_SYMBOL(dump_stack); | 40 | EXPORT_SYMBOL(dump_stack); |
41 | 41 | ||
42 | /* arch/tile/kernel/head.S */ | ||
43 | EXPORT_SYMBOL(empty_zero_page); | ||
44 | |||
42 | /* arch/tile/lib/, various memcpy files */ | 45 | /* arch/tile/lib/, various memcpy files */ |
43 | EXPORT_SYMBOL(memcpy); | 46 | EXPORT_SYMBOL(memcpy); |
44 | EXPORT_SYMBOL(__copy_to_user_inatomic); | 47 | EXPORT_SYMBOL(__copy_to_user_inatomic); |
diff --git a/arch/tile/mm/homecache.c b/arch/tile/mm/homecache.c index cbe6f4f9eca3..1cc6ae477c98 100644 --- a/arch/tile/mm/homecache.c +++ b/arch/tile/mm/homecache.c | |||
@@ -449,9 +449,12 @@ void homecache_free_pages(unsigned long addr, unsigned int order) | |||
449 | VM_BUG_ON(!virt_addr_valid((void *)addr)); | 449 | VM_BUG_ON(!virt_addr_valid((void *)addr)); |
450 | page = virt_to_page((void *)addr); | 450 | page = virt_to_page((void *)addr); |
451 | if (put_page_testzero(page)) { | 451 | if (put_page_testzero(page)) { |
452 | int pages = (1 << order); | ||
453 | homecache_change_page_home(page, order, initial_page_home()); | 452 | homecache_change_page_home(page, order, initial_page_home()); |
454 | while (pages--) | 453 | if (order == 0) { |
455 | __free_page(page++); | 454 | free_hot_cold_page(page, 0); |
455 | } else { | ||
456 | init_page_count(page); | ||
457 | __free_pages(page, order); | ||
458 | } | ||
456 | } | 459 | } |
457 | } | 460 | } |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index cb9a1044a771..efb42949cc09 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -390,7 +390,7 @@ config X86_INTEL_CE | |||
390 | This option compiles in support for the CE4100 SOC for settop | 390 | This option compiles in support for the CE4100 SOC for settop |
391 | boxes and media devices. | 391 | boxes and media devices. |
392 | 392 | ||
393 | config X86_INTEL_MID | 393 | config X86_WANT_INTEL_MID |
394 | bool "Intel MID platform support" | 394 | bool "Intel MID platform support" |
395 | depends on X86_32 | 395 | depends on X86_32 |
396 | depends on X86_EXTENDED_PLATFORM | 396 | depends on X86_EXTENDED_PLATFORM |
@@ -399,7 +399,10 @@ config X86_INTEL_MID | |||
399 | systems which do not have the PCI legacy interfaces (Moorestown, | 399 | systems which do not have the PCI legacy interfaces (Moorestown, |
400 | Medfield). If you are building for a PC class system say N here. | 400 | Medfield). If you are building for a PC class system say N here. |
401 | 401 | ||
402 | if X86_INTEL_MID | 402 | if X86_WANT_INTEL_MID |
403 | |||
404 | config X86_INTEL_MID | ||
405 | bool | ||
403 | 406 | ||
404 | config X86_MRST | 407 | config X86_MRST |
405 | bool "Moorestown MID platform" | 408 | bool "Moorestown MID platform" |
@@ -411,6 +414,7 @@ config X86_MRST | |||
411 | select SPI | 414 | select SPI |
412 | select INTEL_SCU_IPC | 415 | select INTEL_SCU_IPC |
413 | select X86_PLATFORM_DEVICES | 416 | select X86_PLATFORM_DEVICES |
417 | select X86_INTEL_MID | ||
414 | ---help--- | 418 | ---help--- |
415 | Moorestown is Intel's Low Power Intel Architecture (LPIA) based Moblin | 419 | Moorestown is Intel's Low Power Intel Architecture (LPIA) based Moblin |
416 | Internet Device(MID) platform. Moorestown consists of two chips: | 420 | Internet Device(MID) platform. Moorestown consists of two chips: |
diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h index 908b96957d88..c9547033e38e 100644 --- a/arch/x86/include/asm/e820.h +++ b/arch/x86/include/asm/e820.h | |||
@@ -53,6 +53,13 @@ | |||
53 | */ | 53 | */ |
54 | #define E820_RESERVED_KERN 128 | 54 | #define E820_RESERVED_KERN 128 |
55 | 55 | ||
56 | /* | ||
57 | * Address ranges that need to be mapped by the kernel direct | ||
58 | * mapping. This is used to make sure regions such as | ||
59 | * EFI_RUNTIME_SERVICES_DATA are directly mapped. See setup_arch(). | ||
60 | */ | ||
61 | #define E820_RESERVED_EFI 129 | ||
62 | |||
56 | #ifndef __ASSEMBLY__ | 63 | #ifndef __ASSEMBLY__ |
57 | #include <linux/types.h> | 64 | #include <linux/types.h> |
58 | struct e820entry { | 65 | struct e820entry { |
@@ -115,6 +122,7 @@ static inline void early_memtest(unsigned long start, unsigned long end) | |||
115 | } | 122 | } |
116 | #endif | 123 | #endif |
117 | 124 | ||
125 | extern unsigned long e820_end_pfn(unsigned long limit_pfn, unsigned type); | ||
118 | extern unsigned long e820_end_of_ram_pfn(void); | 126 | extern unsigned long e820_end_of_ram_pfn(void); |
119 | extern unsigned long e820_end_of_low_ram_pfn(void); | 127 | extern unsigned long e820_end_of_low_ram_pfn(void); |
120 | extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align); | 128 | extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align); |
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 7093e4a6a0bc..b8d8bfcd44a9 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -33,8 +33,6 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...); | |||
33 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ | 33 | #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ |
34 | efi_call_virt(f, a1, a2, a3, a4, a5, a6) | 34 | efi_call_virt(f, a1, a2, a3, a4, a5, a6) |
35 | 35 | ||
36 | #define efi_ioremap(addr, size, type) ioremap_cache(addr, size) | ||
37 | |||
38 | #else /* !CONFIG_X86_32 */ | 36 | #else /* !CONFIG_X86_32 */ |
39 | 37 | ||
40 | extern u64 efi_call0(void *fp); | 38 | extern u64 efi_call0(void *fp); |
@@ -84,9 +82,6 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3, | |||
84 | efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ | 82 | efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ |
85 | (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) | 83 | (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) |
86 | 84 | ||
87 | extern void __iomem *efi_ioremap(unsigned long addr, unsigned long size, | ||
88 | u32 type); | ||
89 | |||
90 | #endif /* CONFIG_X86_32 */ | 85 | #endif /* CONFIG_X86_32 */ |
91 | 86 | ||
92 | extern int add_efi_memmap; | 87 | extern int add_efi_memmap; |
diff --git a/arch/x86/include/asm/intel_scu_ipc.h b/arch/x86/include/asm/intel_scu_ipc.h index 4420993acc47..925b605eb5c6 100644 --- a/arch/x86/include/asm/intel_scu_ipc.h +++ b/arch/x86/include/asm/intel_scu_ipc.h | |||
@@ -3,11 +3,15 @@ | |||
3 | 3 | ||
4 | #include <linux/notifier.h> | 4 | #include <linux/notifier.h> |
5 | 5 | ||
6 | #define IPCMSG_VRTC 0xFA /* Set vRTC device */ | 6 | #define IPCMSG_WARM_RESET 0xF0 |
7 | 7 | #define IPCMSG_COLD_RESET 0xF1 | |
8 | /* Command id associated with message IPCMSG_VRTC */ | 8 | #define IPCMSG_SOFT_RESET 0xF2 |
9 | #define IPC_CMD_VRTC_SETTIME 1 /* Set time */ | 9 | #define IPCMSG_COLD_BOOT 0xF3 |
10 | #define IPC_CMD_VRTC_SETALARM 2 /* Set alarm */ | 10 | |
11 | #define IPCMSG_VRTC 0xFA /* Set vRTC device */ | ||
12 | /* Command id associated with message IPCMSG_VRTC */ | ||
13 | #define IPC_CMD_VRTC_SETTIME 1 /* Set time */ | ||
14 | #define IPC_CMD_VRTC_SETALARM 2 /* Set alarm */ | ||
11 | 15 | ||
12 | /* Read single register */ | 16 | /* Read single register */ |
13 | int intel_scu_ipc_ioread8(u16 addr, u8 *data); | 17 | int intel_scu_ipc_ioread8(u16 addr, u8 *data); |
diff --git a/arch/x86/include/asm/mrst.h b/arch/x86/include/asm/mrst.h index e6283129c821..93f79094c224 100644 --- a/arch/x86/include/asm/mrst.h +++ b/arch/x86/include/asm/mrst.h | |||
@@ -31,11 +31,20 @@ enum mrst_cpu_type { | |||
31 | }; | 31 | }; |
32 | 32 | ||
33 | extern enum mrst_cpu_type __mrst_cpu_chip; | 33 | extern enum mrst_cpu_type __mrst_cpu_chip; |
34 | |||
35 | #ifdef CONFIG_X86_INTEL_MID | ||
36 | |||
34 | static inline enum mrst_cpu_type mrst_identify_cpu(void) | 37 | static inline enum mrst_cpu_type mrst_identify_cpu(void) |
35 | { | 38 | { |
36 | return __mrst_cpu_chip; | 39 | return __mrst_cpu_chip; |
37 | } | 40 | } |
38 | 41 | ||
42 | #else /* !CONFIG_X86_INTEL_MID */ | ||
43 | |||
44 | #define mrst_identify_cpu() (0) | ||
45 | |||
46 | #endif /* !CONFIG_X86_INTEL_MID */ | ||
47 | |||
39 | enum mrst_timer_options { | 48 | enum mrst_timer_options { |
40 | MRST_TIMER_DEFAULT, | 49 | MRST_TIMER_DEFAULT, |
41 | MRST_TIMER_APBT_ONLY, | 50 | MRST_TIMER_APBT_ONLY, |
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 084ef95274cd..95203d40ffdd 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h | |||
@@ -169,7 +169,14 @@ static inline int wrmsr_safe(unsigned msr, unsigned low, unsigned high) | |||
169 | return native_write_msr_safe(msr, low, high); | 169 | return native_write_msr_safe(msr, low, high); |
170 | } | 170 | } |
171 | 171 | ||
172 | /* rdmsr with exception handling */ | 172 | /* |
173 | * rdmsr with exception handling. | ||
174 | * | ||
175 | * Please note that the exception handling works only after we've | ||
176 | * switched to the "smart" #GP handler in trap_init() which knows about | ||
177 | * exception tables - using this macro earlier than that causes machine | ||
178 | * hangs on boxes which do not implement the @msr in the first argument. | ||
179 | */ | ||
173 | #define rdmsr_safe(msr, p1, p2) \ | 180 | #define rdmsr_safe(msr, p1, p2) \ |
174 | ({ \ | 181 | ({ \ |
175 | int __err; \ | 182 | int __err; \ |
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h index c2ff2a1d845e..2d2f01ce6dcb 100644 --- a/arch/x86/include/asm/system.h +++ b/arch/x86/include/asm/system.h | |||
@@ -401,6 +401,7 @@ extern unsigned long arch_align_stack(unsigned long sp); | |||
401 | extern void free_init_pages(char *what, unsigned long begin, unsigned long end); | 401 | extern void free_init_pages(char *what, unsigned long begin, unsigned long end); |
402 | 402 | ||
403 | void default_idle(void); | 403 | void default_idle(void); |
404 | bool set_pm_idle_to_default(void); | ||
404 | 405 | ||
405 | void stop_this_cpu(void *dummy); | 406 | void stop_this_cpu(void *dummy); |
406 | 407 | ||
diff --git a/arch/x86/include/asm/timer.h b/arch/x86/include/asm/timer.h index fa7b9176b76c..431793e5d484 100644 --- a/arch/x86/include/asm/timer.h +++ b/arch/x86/include/asm/timer.h | |||
@@ -32,6 +32,22 @@ extern int no_timer_check; | |||
32 | * (mathieu.desnoyers@polymtl.ca) | 32 | * (mathieu.desnoyers@polymtl.ca) |
33 | * | 33 | * |
34 | * -johnstul@us.ibm.com "math is hard, lets go shopping!" | 34 | * -johnstul@us.ibm.com "math is hard, lets go shopping!" |
35 | * | ||
36 | * In: | ||
37 | * | ||
38 | * ns = cycles * cyc2ns_scale / SC | ||
39 | * | ||
40 | * Although we may still have enough bits to store the value of ns, | ||
41 | * in some cases, we may not have enough bits to store cycles * cyc2ns_scale, | ||
42 | * leading to an incorrect result. | ||
43 | * | ||
44 | * To avoid this, we can decompose 'cycles' into quotient and remainder | ||
45 | * of division by SC. Then, | ||
46 | * | ||
47 | * ns = (quot * SC + rem) * cyc2ns_scale / SC | ||
48 | * = quot * cyc2ns_scale + (rem * cyc2ns_scale) / SC | ||
49 | * | ||
50 | * - sqazi@google.com | ||
35 | */ | 51 | */ |
36 | 52 | ||
37 | DECLARE_PER_CPU(unsigned long, cyc2ns); | 53 | DECLARE_PER_CPU(unsigned long, cyc2ns); |
@@ -41,9 +57,14 @@ DECLARE_PER_CPU(unsigned long long, cyc2ns_offset); | |||
41 | 57 | ||
42 | static inline unsigned long long __cycles_2_ns(unsigned long long cyc) | 58 | static inline unsigned long long __cycles_2_ns(unsigned long long cyc) |
43 | { | 59 | { |
60 | unsigned long long quot; | ||
61 | unsigned long long rem; | ||
44 | int cpu = smp_processor_id(); | 62 | int cpu = smp_processor_id(); |
45 | unsigned long long ns = per_cpu(cyc2ns_offset, cpu); | 63 | unsigned long long ns = per_cpu(cyc2ns_offset, cpu); |
46 | ns += cyc * per_cpu(cyc2ns, cpu) >> CYC2NS_SCALE_FACTOR; | 64 | quot = (cyc >> CYC2NS_SCALE_FACTOR); |
65 | rem = cyc & ((1ULL << CYC2NS_SCALE_FACTOR) - 1); | ||
66 | ns += quot * per_cpu(cyc2ns, cpu) + | ||
67 | ((rem * per_cpu(cyc2ns, cpu)) >> CYC2NS_SCALE_FACTOR); | ||
47 | return ns; | 68 | return ns; |
48 | } | 69 | } |
49 | 70 | ||
diff --git a/arch/x86/include/asm/uv/uv_mmrs.h b/arch/x86/include/asm/uv/uv_mmrs.h index 10474fb1185d..cf1d73643f60 100644 --- a/arch/x86/include/asm/uv/uv_mmrs.h +++ b/arch/x86/include/asm/uv/uv_mmrs.h | |||
@@ -57,6 +57,7 @@ | |||
57 | 57 | ||
58 | #define UV1_HUB_PART_NUMBER 0x88a5 | 58 | #define UV1_HUB_PART_NUMBER 0x88a5 |
59 | #define UV2_HUB_PART_NUMBER 0x8eb8 | 59 | #define UV2_HUB_PART_NUMBER 0x8eb8 |
60 | #define UV2_HUB_PART_NUMBER_X 0x1111 | ||
60 | 61 | ||
61 | /* Compat: if this #define is present, UV headers support UV2 */ | 62 | /* Compat: if this #define is present, UV headers support UV2 */ |
62 | #define UV2_HUB_IS_SUPPORTED 1 | 63 | #define UV2_HUB_IS_SUPPORTED 1 |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 62ae3001ae02..9d59bbacd4e3 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -93,6 +93,8 @@ static int __init early_get_pnodeid(void) | |||
93 | 93 | ||
94 | if (node_id.s.part_number == UV2_HUB_PART_NUMBER) | 94 | if (node_id.s.part_number == UV2_HUB_PART_NUMBER) |
95 | uv_min_hub_revision_id += UV2_HUB_REVISION_BASE - 1; | 95 | uv_min_hub_revision_id += UV2_HUB_REVISION_BASE - 1; |
96 | if (node_id.s.part_number == UV2_HUB_PART_NUMBER_X) | ||
97 | uv_min_hub_revision_id += UV2_HUB_REVISION_BASE - 1; | ||
96 | 98 | ||
97 | uv_hub_info->hub_revision = uv_min_hub_revision_id; | 99 | uv_hub_info->hub_revision = uv_min_hub_revision_id; |
98 | pnode = (node_id.s.node_id >> 1) & ((1 << m_n_config.s.n_skt) - 1); | 100 | pnode = (node_id.s.node_id >> 1) & ((1 << m_n_config.s.n_skt) - 1); |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index c7e46cb35327..0bab2b18bb20 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -442,8 +442,6 @@ static void __cpuinit bsp_init_amd(struct cpuinfo_x86 *c) | |||
442 | 442 | ||
443 | static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) | 443 | static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) |
444 | { | 444 | { |
445 | u32 dummy; | ||
446 | |||
447 | early_init_amd_mc(c); | 445 | early_init_amd_mc(c); |
448 | 446 | ||
449 | /* | 447 | /* |
@@ -473,12 +471,12 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) | |||
473 | set_cpu_cap(c, X86_FEATURE_EXTD_APICID); | 471 | set_cpu_cap(c, X86_FEATURE_EXTD_APICID); |
474 | } | 472 | } |
475 | #endif | 473 | #endif |
476 | |||
477 | rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy); | ||
478 | } | 474 | } |
479 | 475 | ||
480 | static void __cpuinit init_amd(struct cpuinfo_x86 *c) | 476 | static void __cpuinit init_amd(struct cpuinfo_x86 *c) |
481 | { | 477 | { |
478 | u32 dummy; | ||
479 | |||
482 | #ifdef CONFIG_SMP | 480 | #ifdef CONFIG_SMP |
483 | unsigned long long value; | 481 | unsigned long long value; |
484 | 482 | ||
@@ -657,6 +655,8 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) | |||
657 | checking_wrmsrl(MSR_AMD64_MCx_MASK(4), mask); | 655 | checking_wrmsrl(MSR_AMD64_MCx_MASK(4), mask); |
658 | } | 656 | } |
659 | } | 657 | } |
658 | |||
659 | rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy); | ||
660 | } | 660 | } |
661 | 661 | ||
662 | #ifdef CONFIG_X86_32 | 662 | #ifdef CONFIG_X86_32 |
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c index a71efcdbb092..97b26356e9ee 100644 --- a/arch/x86/kernel/cpu/mtrr/generic.c +++ b/arch/x86/kernel/cpu/mtrr/generic.c | |||
@@ -547,6 +547,7 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base, | |||
547 | 547 | ||
548 | if (tmp != mask_lo) { | 548 | if (tmp != mask_lo) { |
549 | printk(KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n"); | 549 | printk(KERN_WARNING "mtrr: your BIOS has configured an incorrect mask, fixing it.\n"); |
550 | add_taint(TAINT_FIRMWARE_WORKAROUND); | ||
550 | mask_lo = tmp; | 551 | mask_lo = tmp; |
551 | } | 552 | } |
552 | } | 553 | } |
@@ -693,6 +694,7 @@ static void prepare_set(void) __acquires(set_atomicity_lock) | |||
693 | 694 | ||
694 | /* Disable MTRRs, and set the default type to uncached */ | 695 | /* Disable MTRRs, and set the default type to uncached */ |
695 | mtrr_wrmsr(MSR_MTRRdefType, deftype_lo & ~0xcff, deftype_hi); | 696 | mtrr_wrmsr(MSR_MTRRdefType, deftype_lo & ~0xcff, deftype_hi); |
697 | wbinvd(); | ||
696 | } | 698 | } |
697 | 699 | ||
698 | static void post_set(void) __releases(set_atomicity_lock) | 700 | static void post_set(void) __releases(set_atomicity_lock) |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 640891014b2a..2bda212a0010 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -312,12 +312,8 @@ int x86_setup_perfctr(struct perf_event *event) | |||
312 | return -EOPNOTSUPP; | 312 | return -EOPNOTSUPP; |
313 | } | 313 | } |
314 | 314 | ||
315 | /* | ||
316 | * Do not allow config1 (extended registers) to propagate, | ||
317 | * there's no sane user-space generalization yet: | ||
318 | */ | ||
319 | if (attr->type == PERF_TYPE_RAW) | 315 | if (attr->type == PERF_TYPE_RAW) |
320 | return 0; | 316 | return x86_pmu_extra_regs(event->attr.config, event); |
321 | 317 | ||
322 | if (attr->type == PERF_TYPE_HW_CACHE) | 318 | if (attr->type == PERF_TYPE_HW_CACHE) |
323 | return set_ext_hw_attr(hwc, event); | 319 | return set_ext_hw_attr(hwc, event); |
@@ -588,7 +584,7 @@ done: | |||
588 | x86_pmu.put_event_constraints(cpuc, cpuc->event_list[i]); | 584 | x86_pmu.put_event_constraints(cpuc, cpuc->event_list[i]); |
589 | } | 585 | } |
590 | } | 586 | } |
591 | return num ? -ENOSPC : 0; | 587 | return num ? -EINVAL : 0; |
592 | } | 588 | } |
593 | 589 | ||
594 | /* | 590 | /* |
@@ -607,7 +603,7 @@ static int collect_events(struct cpu_hw_events *cpuc, struct perf_event *leader, | |||
607 | 603 | ||
608 | if (is_x86_event(leader)) { | 604 | if (is_x86_event(leader)) { |
609 | if (n >= max_count) | 605 | if (n >= max_count) |
610 | return -ENOSPC; | 606 | return -EINVAL; |
611 | cpuc->event_list[n] = leader; | 607 | cpuc->event_list[n] = leader; |
612 | n++; | 608 | n++; |
613 | } | 609 | } |
@@ -620,7 +616,7 @@ static int collect_events(struct cpu_hw_events *cpuc, struct perf_event *leader, | |||
620 | continue; | 616 | continue; |
621 | 617 | ||
622 | if (n >= max_count) | 618 | if (n >= max_count) |
623 | return -ENOSPC; | 619 | return -EINVAL; |
624 | 620 | ||
625 | cpuc->event_list[n] = event; | 621 | cpuc->event_list[n] = event; |
626 | n++; | 622 | n++; |
@@ -1316,7 +1312,7 @@ static int validate_event(struct perf_event *event) | |||
1316 | c = x86_pmu.get_event_constraints(fake_cpuc, event); | 1312 | c = x86_pmu.get_event_constraints(fake_cpuc, event); |
1317 | 1313 | ||
1318 | if (!c || !c->weight) | 1314 | if (!c || !c->weight) |
1319 | ret = -ENOSPC; | 1315 | ret = -EINVAL; |
1320 | 1316 | ||
1321 | if (x86_pmu.put_event_constraints) | 1317 | if (x86_pmu.put_event_constraints) |
1322 | x86_pmu.put_event_constraints(fake_cpuc, event); | 1318 | x86_pmu.put_event_constraints(fake_cpuc, event); |
@@ -1341,7 +1337,7 @@ static int validate_group(struct perf_event *event) | |||
1341 | { | 1337 | { |
1342 | struct perf_event *leader = event->group_leader; | 1338 | struct perf_event *leader = event->group_leader; |
1343 | struct cpu_hw_events *fake_cpuc; | 1339 | struct cpu_hw_events *fake_cpuc; |
1344 | int ret = -ENOSPC, n; | 1340 | int ret = -EINVAL, n; |
1345 | 1341 | ||
1346 | fake_cpuc = allocate_fake_cpuc(); | 1342 | fake_cpuc = allocate_fake_cpuc(); |
1347 | if (IS_ERR(fake_cpuc)) | 1343 | if (IS_ERR(fake_cpuc)) |
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c index ab6343d21825..3b8a2d30d14e 100644 --- a/arch/x86/kernel/cpu/perf_event_amd_ibs.c +++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c | |||
@@ -199,8 +199,7 @@ static int force_ibs_eilvt_setup(void) | |||
199 | goto out; | 199 | goto out; |
200 | } | 200 | } |
201 | 201 | ||
202 | pr_err(FW_BUG "using offset %d for IBS interrupts\n", offset); | 202 | pr_info("IBS: LVT offset %d assigned\n", offset); |
203 | pr_err(FW_BUG "workaround enabled for IBS LVT offset\n"); | ||
204 | 203 | ||
205 | return 0; | 204 | return 0; |
206 | out: | 205 | out: |
@@ -265,19 +264,23 @@ perf_ibs_cpu_notifier(struct notifier_block *self, unsigned long action, void *h | |||
265 | static __init int amd_ibs_init(void) | 264 | static __init int amd_ibs_init(void) |
266 | { | 265 | { |
267 | u32 caps; | 266 | u32 caps; |
268 | int ret; | 267 | int ret = -EINVAL; |
269 | 268 | ||
270 | caps = __get_ibs_caps(); | 269 | caps = __get_ibs_caps(); |
271 | if (!caps) | 270 | if (!caps) |
272 | return -ENODEV; /* ibs not supported by the cpu */ | 271 | return -ENODEV; /* ibs not supported by the cpu */ |
273 | 272 | ||
274 | if (!ibs_eilvt_valid()) { | 273 | /* |
275 | ret = force_ibs_eilvt_setup(); | 274 | * Force LVT offset assignment for family 10h: The offsets are |
276 | if (ret) { | 275 | * not assigned by the BIOS for this family, so the OS is |
277 | pr_err("Failed to setup IBS, %d\n", ret); | 276 | * responsible for doing it. If the OS assignment fails, fall |
278 | return ret; | 277 | * back to BIOS settings and try to setup this. |
279 | } | 278 | */ |
280 | } | 279 | if (boot_cpu_data.x86 == 0x10) |
280 | force_ibs_eilvt_setup(); | ||
281 | |||
282 | if (!ibs_eilvt_valid()) | ||
283 | goto out; | ||
281 | 284 | ||
282 | get_online_cpus(); | 285 | get_online_cpus(); |
283 | ibs_caps = caps; | 286 | ibs_caps = caps; |
@@ -287,7 +290,11 @@ static __init int amd_ibs_init(void) | |||
287 | smp_call_function(setup_APIC_ibs, NULL, 1); | 290 | smp_call_function(setup_APIC_ibs, NULL, 1); |
288 | put_online_cpus(); | 291 | put_online_cpus(); |
289 | 292 | ||
290 | return perf_event_ibs_init(); | 293 | ret = perf_event_ibs_init(); |
294 | out: | ||
295 | if (ret) | ||
296 | pr_err("Failed to setup IBS, %d\n", ret); | ||
297 | return ret; | ||
291 | } | 298 | } |
292 | 299 | ||
293 | /* Since we need the pci subsystem to init ibs we can't do this earlier: */ | 300 | /* Since we need the pci subsystem to init ibs we can't do this earlier: */ |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 2be5ebe99872..8d601b18bf9f 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -1545,6 +1545,13 @@ static void intel_clovertown_quirks(void) | |||
1545 | x86_pmu.pebs_constraints = NULL; | 1545 | x86_pmu.pebs_constraints = NULL; |
1546 | } | 1546 | } |
1547 | 1547 | ||
1548 | static void intel_sandybridge_quirks(void) | ||
1549 | { | ||
1550 | printk(KERN_WARNING "PEBS disabled due to CPU errata.\n"); | ||
1551 | x86_pmu.pebs = 0; | ||
1552 | x86_pmu.pebs_constraints = NULL; | ||
1553 | } | ||
1554 | |||
1548 | __init int intel_pmu_init(void) | 1555 | __init int intel_pmu_init(void) |
1549 | { | 1556 | { |
1550 | union cpuid10_edx edx; | 1557 | union cpuid10_edx edx; |
@@ -1694,6 +1701,7 @@ __init int intel_pmu_init(void) | |||
1694 | break; | 1701 | break; |
1695 | 1702 | ||
1696 | case 42: /* SandyBridge */ | 1703 | case 42: /* SandyBridge */ |
1704 | x86_pmu.quirks = intel_sandybridge_quirks; | ||
1697 | case 45: /* SandyBridge, "Romely-EP" */ | 1705 | case 45: /* SandyBridge, "Romely-EP" */ |
1698 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, | 1706 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, |
1699 | sizeof(hw_cache_event_ids)); | 1707 | sizeof(hw_cache_event_ids)); |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index c0d238f49db8..73da6b64f5b7 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
@@ -493,6 +493,7 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs) | |||
493 | unsigned long from = cpuc->lbr_entries[0].from; | 493 | unsigned long from = cpuc->lbr_entries[0].from; |
494 | unsigned long old_to, to = cpuc->lbr_entries[0].to; | 494 | unsigned long old_to, to = cpuc->lbr_entries[0].to; |
495 | unsigned long ip = regs->ip; | 495 | unsigned long ip = regs->ip; |
496 | int is_64bit = 0; | ||
496 | 497 | ||
497 | /* | 498 | /* |
498 | * We don't need to fixup if the PEBS assist is fault like | 499 | * We don't need to fixup if the PEBS assist is fault like |
@@ -544,7 +545,10 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs) | |||
544 | } else | 545 | } else |
545 | kaddr = (void *)to; | 546 | kaddr = (void *)to; |
546 | 547 | ||
547 | kernel_insn_init(&insn, kaddr); | 548 | #ifdef CONFIG_X86_64 |
549 | is_64bit = kernel_ip(to) || !test_thread_flag(TIF_IA32); | ||
550 | #endif | ||
551 | insn_init(&insn, kaddr, is_64bit); | ||
548 | insn_get_length(&insn); | 552 | insn_get_length(&insn); |
549 | to += insn.length; | 553 | to += insn.length; |
550 | } while (to < ip); | 554 | } while (to < ip); |
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c index 492bf1358a7c..ef484d9d0a25 100644 --- a/arch/x86/kernel/cpu/perf_event_p4.c +++ b/arch/x86/kernel/cpu/perf_event_p4.c | |||
@@ -1268,7 +1268,7 @@ reserve: | |||
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | done: | 1270 | done: |
1271 | return num ? -ENOSPC : 0; | 1271 | return num ? -EINVAL : 0; |
1272 | } | 1272 | } |
1273 | 1273 | ||
1274 | static __initconst const struct x86_pmu p4_pmu = { | 1274 | static __initconst const struct x86_pmu p4_pmu = { |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 303a0e48f076..65ffd110a81b 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -135,6 +135,7 @@ static void __init e820_print_type(u32 type) | |||
135 | printk(KERN_CONT "(usable)"); | 135 | printk(KERN_CONT "(usable)"); |
136 | break; | 136 | break; |
137 | case E820_RESERVED: | 137 | case E820_RESERVED: |
138 | case E820_RESERVED_EFI: | ||
138 | printk(KERN_CONT "(reserved)"); | 139 | printk(KERN_CONT "(reserved)"); |
139 | break; | 140 | break; |
140 | case E820_ACPI: | 141 | case E820_ACPI: |
@@ -783,7 +784,7 @@ u64 __init early_reserve_e820(u64 startt, u64 sizet, u64 align) | |||
783 | /* | 784 | /* |
784 | * Find the highest page frame number we have available | 785 | * Find the highest page frame number we have available |
785 | */ | 786 | */ |
786 | static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type) | 787 | unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type) |
787 | { | 788 | { |
788 | int i; | 789 | int i; |
789 | unsigned long last_pfn = 0; | 790 | unsigned long last_pfn = 0; |
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index b946a9eac7d9..1bb0bf4d92cd 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -1049,6 +1049,14 @@ int hpet_rtc_timer_init(void) | |||
1049 | } | 1049 | } |
1050 | EXPORT_SYMBOL_GPL(hpet_rtc_timer_init); | 1050 | EXPORT_SYMBOL_GPL(hpet_rtc_timer_init); |
1051 | 1051 | ||
1052 | static void hpet_disable_rtc_channel(void) | ||
1053 | { | ||
1054 | unsigned long cfg; | ||
1055 | cfg = hpet_readl(HPET_T1_CFG); | ||
1056 | cfg &= ~HPET_TN_ENABLE; | ||
1057 | hpet_writel(cfg, HPET_T1_CFG); | ||
1058 | } | ||
1059 | |||
1052 | /* | 1060 | /* |
1053 | * The functions below are called from rtc driver. | 1061 | * The functions below are called from rtc driver. |
1054 | * Return 0 if HPET is not being used. | 1062 | * Return 0 if HPET is not being used. |
@@ -1060,6 +1068,9 @@ int hpet_mask_rtc_irq_bit(unsigned long bit_mask) | |||
1060 | return 0; | 1068 | return 0; |
1061 | 1069 | ||
1062 | hpet_rtc_flags &= ~bit_mask; | 1070 | hpet_rtc_flags &= ~bit_mask; |
1071 | if (unlikely(!hpet_rtc_flags)) | ||
1072 | hpet_disable_rtc_channel(); | ||
1073 | |||
1063 | return 1; | 1074 | return 1; |
1064 | } | 1075 | } |
1065 | EXPORT_SYMBOL_GPL(hpet_mask_rtc_irq_bit); | 1076 | EXPORT_SYMBOL_GPL(hpet_mask_rtc_irq_bit); |
@@ -1125,15 +1136,11 @@ EXPORT_SYMBOL_GPL(hpet_rtc_dropped_irq); | |||
1125 | 1136 | ||
1126 | static void hpet_rtc_timer_reinit(void) | 1137 | static void hpet_rtc_timer_reinit(void) |
1127 | { | 1138 | { |
1128 | unsigned int cfg, delta; | 1139 | unsigned int delta; |
1129 | int lost_ints = -1; | 1140 | int lost_ints = -1; |
1130 | 1141 | ||
1131 | if (unlikely(!hpet_rtc_flags)) { | 1142 | if (unlikely(!hpet_rtc_flags)) |
1132 | cfg = hpet_readl(HPET_T1_CFG); | 1143 | hpet_disable_rtc_channel(); |
1133 | cfg &= ~HPET_TN_ENABLE; | ||
1134 | hpet_writel(cfg, HPET_T1_CFG); | ||
1135 | return; | ||
1136 | } | ||
1137 | 1144 | ||
1138 | if (!(hpet_rtc_flags & RTC_PIE) || hpet_pie_limit) | 1145 | if (!(hpet_rtc_flags & RTC_PIE) || hpet_pie_limit) |
1139 | delta = hpet_default_delta; | 1146 | delta = hpet_default_delta; |
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c index acf8fbf8fbda..69bca468c47a 100644 --- a/arch/x86/kernel/irq_64.c +++ b/arch/x86/kernel/irq_64.c | |||
@@ -38,6 +38,9 @@ static inline void stack_overflow_check(struct pt_regs *regs) | |||
38 | #ifdef CONFIG_DEBUG_STACKOVERFLOW | 38 | #ifdef CONFIG_DEBUG_STACKOVERFLOW |
39 | u64 curbase = (u64)task_stack_page(current); | 39 | u64 curbase = (u64)task_stack_page(current); |
40 | 40 | ||
41 | if (user_mode_vm(regs)) | ||
42 | return; | ||
43 | |||
41 | WARN_ONCE(regs->sp >= curbase && | 44 | WARN_ONCE(regs->sp >= curbase && |
42 | regs->sp <= curbase + THREAD_SIZE && | 45 | regs->sp <= curbase + THREAD_SIZE && |
43 | regs->sp < curbase + sizeof(struct thread_info) + | 46 | regs->sp < curbase + sizeof(struct thread_info) + |
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c index f2d2a664e797..9d46f5e43b51 100644 --- a/arch/x86/kernel/microcode_core.c +++ b/arch/x86/kernel/microcode_core.c | |||
@@ -256,7 +256,7 @@ static int __init microcode_dev_init(void) | |||
256 | return 0; | 256 | return 0; |
257 | } | 257 | } |
258 | 258 | ||
259 | static void microcode_dev_exit(void) | 259 | static void __exit microcode_dev_exit(void) |
260 | { | 260 | { |
261 | misc_deregister(µcode_dev); | 261 | misc_deregister(µcode_dev); |
262 | } | 262 | } |
@@ -519,10 +519,8 @@ static int __init microcode_init(void) | |||
519 | 519 | ||
520 | microcode_pdev = platform_device_register_simple("microcode", -1, | 520 | microcode_pdev = platform_device_register_simple("microcode", -1, |
521 | NULL, 0); | 521 | NULL, 0); |
522 | if (IS_ERR(microcode_pdev)) { | 522 | if (IS_ERR(microcode_pdev)) |
523 | microcode_dev_exit(); | ||
524 | return PTR_ERR(microcode_pdev); | 523 | return PTR_ERR(microcode_pdev); |
525 | } | ||
526 | 524 | ||
527 | get_online_cpus(); | 525 | get_online_cpus(); |
528 | mutex_lock(µcode_mutex); | 526 | mutex_lock(µcode_mutex); |
@@ -532,14 +530,12 @@ static int __init microcode_init(void) | |||
532 | mutex_unlock(µcode_mutex); | 530 | mutex_unlock(µcode_mutex); |
533 | put_online_cpus(); | 531 | put_online_cpus(); |
534 | 532 | ||
535 | if (error) { | 533 | if (error) |
536 | platform_device_unregister(microcode_pdev); | 534 | goto out_pdev; |
537 | return error; | ||
538 | } | ||
539 | 535 | ||
540 | error = microcode_dev_init(); | 536 | error = microcode_dev_init(); |
541 | if (error) | 537 | if (error) |
542 | return error; | 538 | goto out_sysdev_driver; |
543 | 539 | ||
544 | register_syscore_ops(&mc_syscore_ops); | 540 | register_syscore_ops(&mc_syscore_ops); |
545 | register_hotcpu_notifier(&mc_cpu_notifier); | 541 | register_hotcpu_notifier(&mc_cpu_notifier); |
@@ -548,6 +544,20 @@ static int __init microcode_init(void) | |||
548 | " <tigran@aivazian.fsnet.co.uk>, Peter Oruba\n"); | 544 | " <tigran@aivazian.fsnet.co.uk>, Peter Oruba\n"); |
549 | 545 | ||
550 | return 0; | 546 | return 0; |
547 | |||
548 | out_sysdev_driver: | ||
549 | get_online_cpus(); | ||
550 | mutex_lock(µcode_mutex); | ||
551 | |||
552 | sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver); | ||
553 | |||
554 | mutex_unlock(µcode_mutex); | ||
555 | put_online_cpus(); | ||
556 | |||
557 | out_pdev: | ||
558 | platform_device_unregister(microcode_pdev); | ||
559 | return error; | ||
560 | |||
551 | } | 561 | } |
552 | module_init(microcode_init); | 562 | module_init(microcode_init); |
553 | 563 | ||
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 9103b89c145a..0741b062a304 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -95,8 +95,8 @@ static void __init MP_bus_info(struct mpc_bus *m) | |||
95 | } | 95 | } |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | set_bit(m->busid, mp_bus_not_pci); | ||
98 | if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA) - 1) == 0) { | 99 | if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA) - 1) == 0) { |
99 | set_bit(m->busid, mp_bus_not_pci); | ||
100 | #if defined(CONFIG_EISA) || defined(CONFIG_MCA) | 100 | #if defined(CONFIG_EISA) || defined(CONFIG_MCA) |
101 | mp_bus_id_to_type[m->busid] = MP_BUS_ISA; | 101 | mp_bus_id_to_type[m->busid] = MP_BUS_ISA; |
102 | #endif | 102 | #endif |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index b9b3b1a51643..ee5d4fbd53b4 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -403,6 +403,14 @@ void default_idle(void) | |||
403 | EXPORT_SYMBOL(default_idle); | 403 | EXPORT_SYMBOL(default_idle); |
404 | #endif | 404 | #endif |
405 | 405 | ||
406 | bool set_pm_idle_to_default(void) | ||
407 | { | ||
408 | bool ret = !!pm_idle; | ||
409 | |||
410 | pm_idle = default_idle; | ||
411 | |||
412 | return ret; | ||
413 | } | ||
406 | void stop_this_cpu(void *dummy) | 414 | void stop_this_cpu(void *dummy) |
407 | { | 415 | { |
408 | local_irq_disable(); | 416 | local_irq_disable(); |
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index b78643d0f9a5..03920a15a632 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c | |||
@@ -553,4 +553,17 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC, | |||
553 | quirk_amd_nb_node); | 553 | quirk_amd_nb_node); |
554 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_LINK, | 554 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_LINK, |
555 | quirk_amd_nb_node); | 555 | quirk_amd_nb_node); |
556 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F0, | ||
557 | quirk_amd_nb_node); | ||
558 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F1, | ||
559 | quirk_amd_nb_node); | ||
560 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F2, | ||
561 | quirk_amd_nb_node); | ||
562 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F3, | ||
563 | quirk_amd_nb_node); | ||
564 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4, | ||
565 | quirk_amd_nb_node); | ||
566 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F5, | ||
567 | quirk_amd_nb_node); | ||
568 | |||
556 | #endif | 569 | #endif |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index e334be1182b9..37a458b521a6 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -124,7 +124,7 @@ __setup("reboot=", reboot_setup); | |||
124 | */ | 124 | */ |
125 | 125 | ||
126 | /* | 126 | /* |
127 | * Some machines require the "reboot=b" commandline option, | 127 | * Some machines require the "reboot=b" or "reboot=k" commandline options, |
128 | * this quirk makes that automatic. | 128 | * this quirk makes that automatic. |
129 | */ | 129 | */ |
130 | static int __init set_bios_reboot(const struct dmi_system_id *d) | 130 | static int __init set_bios_reboot(const struct dmi_system_id *d) |
@@ -136,6 +136,15 @@ static int __init set_bios_reboot(const struct dmi_system_id *d) | |||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
139 | static int __init set_kbd_reboot(const struct dmi_system_id *d) | ||
140 | { | ||
141 | if (reboot_type != BOOT_KBD) { | ||
142 | reboot_type = BOOT_KBD; | ||
143 | printk(KERN_INFO "%s series board detected. Selecting KBD-method for reboot.\n", d->ident); | ||
144 | } | ||
145 | return 0; | ||
146 | } | ||
147 | |||
139 | static struct dmi_system_id __initdata reboot_dmi_table[] = { | 148 | static struct dmi_system_id __initdata reboot_dmi_table[] = { |
140 | { /* Handle problems with rebooting on Dell E520's */ | 149 | { /* Handle problems with rebooting on Dell E520's */ |
141 | .callback = set_bios_reboot, | 150 | .callback = set_bios_reboot, |
@@ -295,7 +304,7 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | |||
295 | }, | 304 | }, |
296 | }, | 305 | }, |
297 | { /* Handle reboot issue on Acer Aspire one */ | 306 | { /* Handle reboot issue on Acer Aspire one */ |
298 | .callback = set_bios_reboot, | 307 | .callback = set_kbd_reboot, |
299 | .ident = "Acer Aspire One A110", | 308 | .ident = "Acer Aspire One A110", |
300 | .matches = { | 309 | .matches = { |
301 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | 310 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), |
@@ -443,6 +452,14 @@ static struct dmi_system_id __initdata pci_reboot_dmi_table[] = { | |||
443 | DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6420"), | 452 | DMI_MATCH(DMI_PRODUCT_NAME, "Latitude E6420"), |
444 | }, | 453 | }, |
445 | }, | 454 | }, |
455 | { /* Handle problems with rebooting on the OptiPlex 990. */ | ||
456 | .callback = set_pci_reboot, | ||
457 | .ident = "Dell OptiPlex 990", | ||
458 | .matches = { | ||
459 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
460 | DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"), | ||
461 | }, | ||
462 | }, | ||
446 | { } | 463 | { } |
447 | }; | 464 | }; |
448 | 465 | ||
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c index 348ce016a835..af6db6ec5b2a 100644 --- a/arch/x86/kernel/rtc.c +++ b/arch/x86/kernel/rtc.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <asm/vsyscall.h> | 12 | #include <asm/vsyscall.h> |
13 | #include <asm/x86_init.h> | 13 | #include <asm/x86_init.h> |
14 | #include <asm/time.h> | 14 | #include <asm/time.h> |
15 | #include <asm/mrst.h> | ||
15 | 16 | ||
16 | #ifdef CONFIG_X86_32 | 17 | #ifdef CONFIG_X86_32 |
17 | /* | 18 | /* |
@@ -242,6 +243,10 @@ static __init int add_rtc_cmos(void) | |||
242 | if (of_have_populated_dt()) | 243 | if (of_have_populated_dt()) |
243 | return 0; | 244 | return 0; |
244 | 245 | ||
246 | /* Intel MID platforms don't have ioport rtc */ | ||
247 | if (mrst_identify_cpu()) | ||
248 | return -ENODEV; | ||
249 | |||
245 | platform_device_register(&rtc_device); | 250 | platform_device_register(&rtc_device); |
246 | dev_info(&rtc_device.dev, | 251 | dev_info(&rtc_device.dev, |
247 | "registered platform RTC device (no PNP device found)\n"); | 252 | "registered platform RTC device (no PNP device found)\n"); |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index cf0ef986cb6d..9a9e40fb091c 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -691,6 +691,8 @@ early_param("reservelow", parse_reservelow); | |||
691 | 691 | ||
692 | void __init setup_arch(char **cmdline_p) | 692 | void __init setup_arch(char **cmdline_p) |
693 | { | 693 | { |
694 | unsigned long end_pfn; | ||
695 | |||
694 | #ifdef CONFIG_X86_32 | 696 | #ifdef CONFIG_X86_32 |
695 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); | 697 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); |
696 | visws_early_detect(); | 698 | visws_early_detect(); |
@@ -932,7 +934,24 @@ void __init setup_arch(char **cmdline_p) | |||
932 | init_gbpages(); | 934 | init_gbpages(); |
933 | 935 | ||
934 | /* max_pfn_mapped is updated here */ | 936 | /* max_pfn_mapped is updated here */ |
935 | max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT); | 937 | end_pfn = max_low_pfn; |
938 | |||
939 | #ifdef CONFIG_X86_64 | ||
940 | /* | ||
941 | * There may be regions after the last E820_RAM region that we | ||
942 | * want to include in the kernel direct mapping, such as | ||
943 | * EFI_RUNTIME_SERVICES_DATA. | ||
944 | */ | ||
945 | if (efi_enabled) { | ||
946 | unsigned long efi_end; | ||
947 | |||
948 | efi_end = e820_end_pfn(MAXMEM>>PAGE_SHIFT, E820_RESERVED_EFI); | ||
949 | if (efi_end > max_low_pfn) | ||
950 | end_pfn = efi_end; | ||
951 | } | ||
952 | #endif | ||
953 | |||
954 | max_low_pfn_mapped = init_memory_mapping(0, end_pfn << PAGE_SHIFT); | ||
936 | max_pfn_mapped = max_low_pfn_mapped; | 955 | max_pfn_mapped = max_low_pfn_mapped; |
937 | 956 | ||
938 | #ifdef CONFIG_X86_64 | 957 | #ifdef CONFIG_X86_64 |
diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c index ea305856151c..dd74e46828c0 100644 --- a/arch/x86/mm/gup.c +++ b/arch/x86/mm/gup.c | |||
@@ -201,6 +201,8 @@ static noinline int gup_huge_pud(pud_t pud, unsigned long addr, | |||
201 | do { | 201 | do { |
202 | VM_BUG_ON(compound_head(page) != head); | 202 | VM_BUG_ON(compound_head(page) != head); |
203 | pages[*nr] = page; | 203 | pages[*nr] = page; |
204 | if (PageTail(page)) | ||
205 | get_huge_page_tail(page); | ||
204 | (*nr)++; | 206 | (*nr)++; |
205 | page++; | 207 | page++; |
206 | refs++; | 208 | refs++; |
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c index b49962662101..f4f29b19fac5 100644 --- a/arch/x86/mm/highmem_32.c +++ b/arch/x86/mm/highmem_32.c | |||
@@ -45,6 +45,7 @@ void *kmap_atomic_prot(struct page *page, pgprot_t prot) | |||
45 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); | 45 | vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); |
46 | BUG_ON(!pte_none(*(kmap_pte-idx))); | 46 | BUG_ON(!pte_none(*(kmap_pte-idx))); |
47 | set_pte(kmap_pte-idx, mk_pte(page, prot)); | 47 | set_pte(kmap_pte-idx, mk_pte(page, prot)); |
48 | arch_flush_lazy_mmu_mode(); | ||
48 | 49 | ||
49 | return (void *)vaddr; | 50 | return (void *)vaddr; |
50 | } | 51 | } |
@@ -88,6 +89,7 @@ void __kunmap_atomic(void *kvaddr) | |||
88 | */ | 89 | */ |
89 | kpte_clear_flush(kmap_pte-idx, vaddr); | 90 | kpte_clear_flush(kmap_pte-idx, vaddr); |
90 | kmap_atomic_idx_pop(); | 91 | kmap_atomic_idx_pop(); |
92 | arch_flush_lazy_mmu_mode(); | ||
91 | } | 93 | } |
92 | #ifdef CONFIG_DEBUG_HIGHMEM | 94 | #ifdef CONFIG_DEBUG_HIGHMEM |
93 | else { | 95 | else { |
diff --git a/arch/x86/oprofile/init.c b/arch/x86/oprofile/init.c index cdfe4c54deca..f148cf652678 100644 --- a/arch/x86/oprofile/init.c +++ b/arch/x86/oprofile/init.c | |||
@@ -21,6 +21,7 @@ extern int op_nmi_timer_init(struct oprofile_operations *ops); | |||
21 | extern void op_nmi_exit(void); | 21 | extern void op_nmi_exit(void); |
22 | extern void x86_backtrace(struct pt_regs * const regs, unsigned int depth); | 22 | extern void x86_backtrace(struct pt_regs * const regs, unsigned int depth); |
23 | 23 | ||
24 | static int nmi_timer; | ||
24 | 25 | ||
25 | int __init oprofile_arch_init(struct oprofile_operations *ops) | 26 | int __init oprofile_arch_init(struct oprofile_operations *ops) |
26 | { | 27 | { |
@@ -31,8 +32,9 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
31 | #ifdef CONFIG_X86_LOCAL_APIC | 32 | #ifdef CONFIG_X86_LOCAL_APIC |
32 | ret = op_nmi_init(ops); | 33 | ret = op_nmi_init(ops); |
33 | #endif | 34 | #endif |
35 | nmi_timer = (ret != 0); | ||
34 | #ifdef CONFIG_X86_IO_APIC | 36 | #ifdef CONFIG_X86_IO_APIC |
35 | if (ret < 0) | 37 | if (nmi_timer) |
36 | ret = op_nmi_timer_init(ops); | 38 | ret = op_nmi_timer_init(ops); |
37 | #endif | 39 | #endif |
38 | ops->backtrace = x86_backtrace; | 40 | ops->backtrace = x86_backtrace; |
@@ -44,6 +46,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops) | |||
44 | void oprofile_arch_exit(void) | 46 | void oprofile_arch_exit(void) |
45 | { | 47 | { |
46 | #ifdef CONFIG_X86_LOCAL_APIC | 48 | #ifdef CONFIG_X86_LOCAL_APIC |
47 | op_nmi_exit(); | 49 | if (!nmi_timer) |
50 | op_nmi_exit(); | ||
48 | #endif | 51 | #endif |
49 | } | 52 | } |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 37718f0f053d..c9718a16be15 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -323,10 +323,13 @@ static void __init do_add_efi_memmap(void) | |||
323 | case EFI_UNUSABLE_MEMORY: | 323 | case EFI_UNUSABLE_MEMORY: |
324 | e820_type = E820_UNUSABLE; | 324 | e820_type = E820_UNUSABLE; |
325 | break; | 325 | break; |
326 | case EFI_RUNTIME_SERVICES_DATA: | ||
327 | e820_type = E820_RESERVED_EFI; | ||
328 | break; | ||
326 | default: | 329 | default: |
327 | /* | 330 | /* |
328 | * EFI_RESERVED_TYPE EFI_RUNTIME_SERVICES_CODE | 331 | * EFI_RESERVED_TYPE EFI_RUNTIME_SERVICES_CODE |
329 | * EFI_RUNTIME_SERVICES_DATA EFI_MEMORY_MAPPED_IO | 332 | * EFI_MEMORY_MAPPED_IO |
330 | * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE | 333 | * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE |
331 | */ | 334 | */ |
332 | e820_type = E820_RESERVED; | 335 | e820_type = E820_RESERVED; |
@@ -671,10 +674,21 @@ void __init efi_enter_virtual_mode(void) | |||
671 | end_pfn = PFN_UP(end); | 674 | end_pfn = PFN_UP(end); |
672 | if (end_pfn <= max_low_pfn_mapped | 675 | if (end_pfn <= max_low_pfn_mapped |
673 | || (end_pfn > (1UL << (32 - PAGE_SHIFT)) | 676 | || (end_pfn > (1UL << (32 - PAGE_SHIFT)) |
674 | && end_pfn <= max_pfn_mapped)) | 677 | && end_pfn <= max_pfn_mapped)) { |
675 | va = __va(md->phys_addr); | 678 | va = __va(md->phys_addr); |
676 | else | 679 | |
677 | va = efi_ioremap(md->phys_addr, size, md->type); | 680 | if (!(md->attribute & EFI_MEMORY_WB)) { |
681 | addr = (u64) (unsigned long)va; | ||
682 | npages = md->num_pages; | ||
683 | memrange_efi_to_native(&addr, &npages); | ||
684 | set_memory_uc(addr, npages); | ||
685 | } | ||
686 | } else { | ||
687 | if (!(md->attribute & EFI_MEMORY_WB)) | ||
688 | va = ioremap_nocache(md->phys_addr, size); | ||
689 | else | ||
690 | va = ioremap_cache(md->phys_addr, size); | ||
691 | } | ||
678 | 692 | ||
679 | md->virt_addr = (u64) (unsigned long) va; | 693 | md->virt_addr = (u64) (unsigned long) va; |
680 | 694 | ||
@@ -684,13 +698,6 @@ void __init efi_enter_virtual_mode(void) | |||
684 | continue; | 698 | continue; |
685 | } | 699 | } |
686 | 700 | ||
687 | if (!(md->attribute & EFI_MEMORY_WB)) { | ||
688 | addr = md->virt_addr; | ||
689 | npages = md->num_pages; | ||
690 | memrange_efi_to_native(&addr, &npages); | ||
691 | set_memory_uc(addr, npages); | ||
692 | } | ||
693 | |||
694 | systab = (u64) (unsigned long) efi_phys.systab; | 701 | systab = (u64) (unsigned long) efi_phys.systab; |
695 | if (md->phys_addr <= systab && systab < end) { | 702 | if (md->phys_addr <= systab && systab < end) { |
696 | systab += md->virt_addr - md->phys_addr; | 703 | systab += md->virt_addr - md->phys_addr; |
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index ac3aa54e2654..312250c6b2de 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c | |||
@@ -80,20 +80,3 @@ void __init efi_call_phys_epilog(void) | |||
80 | local_irq_restore(efi_flags); | 80 | local_irq_restore(efi_flags); |
81 | early_code_mapping_set_exec(0); | 81 | early_code_mapping_set_exec(0); |
82 | } | 82 | } |
83 | |||
84 | void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size, | ||
85 | u32 type) | ||
86 | { | ||
87 | unsigned long last_map_pfn; | ||
88 | |||
89 | if (type == EFI_MEMORY_MAPPED_IO) | ||
90 | return ioremap(phys_addr, size); | ||
91 | |||
92 | last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size); | ||
93 | if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) { | ||
94 | unsigned long top = last_map_pfn << PAGE_SHIFT; | ||
95 | efi_ioremap(top, size - (top - phys_addr), type); | ||
96 | } | ||
97 | |||
98 | return (void __iomem *)__va(phys_addr); | ||
99 | } | ||
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index b1489a06a49d..ad4ec1cb097e 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c | |||
@@ -76,6 +76,20 @@ struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX]; | |||
76 | EXPORT_SYMBOL_GPL(sfi_mrtc_array); | 76 | EXPORT_SYMBOL_GPL(sfi_mrtc_array); |
77 | int sfi_mrtc_num; | 77 | int sfi_mrtc_num; |
78 | 78 | ||
79 | static void mrst_power_off(void) | ||
80 | { | ||
81 | if (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) | ||
82 | intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 1); | ||
83 | } | ||
84 | |||
85 | static void mrst_reboot(void) | ||
86 | { | ||
87 | if (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) | ||
88 | intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 0); | ||
89 | else | ||
90 | intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0); | ||
91 | } | ||
92 | |||
79 | /* parse all the mtimer info to a static mtimer array */ | 93 | /* parse all the mtimer info to a static mtimer array */ |
80 | static int __init sfi_parse_mtmr(struct sfi_table_header *table) | 94 | static int __init sfi_parse_mtmr(struct sfi_table_header *table) |
81 | { | 95 | { |
@@ -265,17 +279,6 @@ static int mrst_i8042_detect(void) | |||
265 | return 0; | 279 | return 0; |
266 | } | 280 | } |
267 | 281 | ||
268 | /* Reboot and power off are handled by the SCU on a MID device */ | ||
269 | static void mrst_power_off(void) | ||
270 | { | ||
271 | intel_scu_ipc_simple_command(0xf1, 1); | ||
272 | } | ||
273 | |||
274 | static void mrst_reboot(void) | ||
275 | { | ||
276 | intel_scu_ipc_simple_command(0xf1, 0); | ||
277 | } | ||
278 | |||
279 | /* | 282 | /* |
280 | * Moorestown does not have external NMI source nor port 0x61 to report | 283 | * Moorestown does not have external NMI source nor port 0x61 to report |
281 | * NMI status. The possible NMI sources are from pmu as a result of NMI | 284 | * NMI status. The possible NMI sources are from pmu as a result of NMI |
@@ -484,6 +487,46 @@ static void __init *max7315_platform_data(void *info) | |||
484 | return max7315; | 487 | return max7315; |
485 | } | 488 | } |
486 | 489 | ||
490 | static void *tca6416_platform_data(void *info) | ||
491 | { | ||
492 | static struct pca953x_platform_data tca6416; | ||
493 | struct i2c_board_info *i2c_info = info; | ||
494 | int gpio_base, intr; | ||
495 | char base_pin_name[SFI_NAME_LEN + 1]; | ||
496 | char intr_pin_name[SFI_NAME_LEN + 1]; | ||
497 | |||
498 | strcpy(i2c_info->type, "tca6416"); | ||
499 | strcpy(base_pin_name, "tca6416_base"); | ||
500 | strcpy(intr_pin_name, "tca6416_int"); | ||
501 | |||
502 | gpio_base = get_gpio_by_name(base_pin_name); | ||
503 | intr = get_gpio_by_name(intr_pin_name); | ||
504 | |||
505 | if (gpio_base == -1) | ||
506 | return NULL; | ||
507 | tca6416.gpio_base = gpio_base; | ||
508 | if (intr != -1) { | ||
509 | i2c_info->irq = intr + MRST_IRQ_OFFSET; | ||
510 | tca6416.irq_base = gpio_base + MRST_IRQ_OFFSET; | ||
511 | } else { | ||
512 | i2c_info->irq = -1; | ||
513 | tca6416.irq_base = -1; | ||
514 | } | ||
515 | return &tca6416; | ||
516 | } | ||
517 | |||
518 | static void *mpu3050_platform_data(void *info) | ||
519 | { | ||
520 | struct i2c_board_info *i2c_info = info; | ||
521 | int intr = get_gpio_by_name("mpu3050_int"); | ||
522 | |||
523 | if (intr == -1) | ||
524 | return NULL; | ||
525 | |||
526 | i2c_info->irq = intr + MRST_IRQ_OFFSET; | ||
527 | return NULL; | ||
528 | } | ||
529 | |||
487 | static void __init *emc1403_platform_data(void *info) | 530 | static void __init *emc1403_platform_data(void *info) |
488 | { | 531 | { |
489 | static short intr2nd_pdata; | 532 | static short intr2nd_pdata; |
@@ -646,12 +689,15 @@ static void *msic_ocd_platform_data(void *info) | |||
646 | static const struct devs_id __initconst device_ids[] = { | 689 | static const struct devs_id __initconst device_ids[] = { |
647 | {"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data}, | 690 | {"bma023", SFI_DEV_TYPE_I2C, 1, &no_platform_data}, |
648 | {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, | 691 | {"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data}, |
692 | {"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data}, | ||
649 | {"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data}, | 693 | {"spi_max3111", SFI_DEV_TYPE_SPI, 0, &max3111_platform_data}, |
650 | {"i2c_max7315", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data}, | 694 | {"i2c_max7315", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data}, |
651 | {"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data}, | 695 | {"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data}, |
696 | {"tca6416", SFI_DEV_TYPE_I2C, 1, &tca6416_platform_data}, | ||
652 | {"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data}, | 697 | {"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data}, |
653 | {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data}, | 698 | {"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data}, |
654 | {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, | 699 | {"pmic_audio", SFI_DEV_TYPE_IPC, 1, &no_platform_data}, |
700 | {"mpu3050", SFI_DEV_TYPE_I2C, 1, &mpu3050_platform_data}, | ||
655 | 701 | ||
656 | /* MSIC subdevices */ | 702 | /* MSIC subdevices */ |
657 | {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data}, | 703 | {"msic_battery", SFI_DEV_TYPE_IPC, 1, &msic_battery_platform_data}, |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 38d0af4fefec..1093f80c162d 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -410,6 +410,6 @@ void __init xen_arch_setup(void) | |||
410 | #endif | 410 | #endif |
411 | disable_cpuidle(); | 411 | disable_cpuidle(); |
412 | boot_option_idle_override = IDLE_HALT; | 412 | boot_option_idle_override = IDLE_HALT; |
413 | 413 | WARN_ON(set_pm_idle_to_default()); | |
414 | fiddle_vdso(); | 414 | fiddle_vdso(); |
415 | } | 415 | } |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index a76f24a8e5db..5249e6d918a3 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -360,7 +360,7 @@ static int __devinit pata_at91_probe(struct platform_device *pdev) | |||
360 | ap->flags |= ATA_FLAG_SLAVE_POSS; | 360 | ap->flags |= ATA_FLAG_SLAVE_POSS; |
361 | ap->pio_mask = ATA_PIO4; | 361 | ap->pio_mask = ATA_PIO4; |
362 | 362 | ||
363 | if (!irq) { | 363 | if (!gpio_is_valid(irq)) { |
364 | ap->flags |= ATA_FLAG_PIO_POLLING; | 364 | ap->flags |= ATA_FLAG_PIO_POLLING; |
365 | ata_port_desc(ap, "no IRQ, using PIO polling"); | 365 | ata_port_desc(ap, "no IRQ, using PIO polling"); |
366 | } | 366 | } |
@@ -414,8 +414,8 @@ static int __devinit pata_at91_probe(struct platform_device *pdev) | |||
414 | 414 | ||
415 | host->private_data = info; | 415 | host->private_data = info; |
416 | 416 | ||
417 | ret = ata_host_activate(host, irq ? gpio_to_irq(irq) : 0, | 417 | return ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0, |
418 | irq ? ata_sff_interrupt : NULL, | 418 | gpio_is_valid(irq) ? ata_sff_interrupt : NULL, |
419 | irq_flags, &pata_at91_sht); | 419 | irq_flags, &pata_at91_sht); |
420 | 420 | ||
421 | if (!ret) | 421 | if (!ret) |
diff --git a/drivers/base/core.c b/drivers/base/core.c index d8b3d89db043..919daa7cd5b1 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -1743,8 +1743,10 @@ void device_shutdown(void) | |||
1743 | */ | 1743 | */ |
1744 | list_del_init(&dev->kobj.entry); | 1744 | list_del_init(&dev->kobj.entry); |
1745 | spin_unlock(&devices_kset->list_lock); | 1745 | spin_unlock(&devices_kset->list_lock); |
1746 | /* Disable all device's runtime power management */ | 1746 | |
1747 | pm_runtime_disable(dev); | 1747 | /* Don't allow any more runtime suspends */ |
1748 | pm_runtime_get_noresume(dev); | ||
1749 | pm_runtime_barrier(dev); | ||
1748 | 1750 | ||
1749 | if (dev->bus && dev->bus->shutdown) { | 1751 | if (dev->bus && dev->bus->shutdown) { |
1750 | dev_dbg(dev, "shutdown\n"); | 1752 | dev_dbg(dev, "shutdown\n"); |
diff --git a/drivers/firmware/sigma.c b/drivers/firmware/sigma.c index f10fc521951b..1eedb6f7fdab 100644 --- a/drivers/firmware/sigma.c +++ b/drivers/firmware/sigma.c | |||
@@ -14,13 +14,34 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/sigma.h> | 15 | #include <linux/sigma.h> |
16 | 16 | ||
17 | /* Return: 0==OK, <0==error, =1 ==no more actions */ | 17 | static size_t sigma_action_size(struct sigma_action *sa) |
18 | { | ||
19 | size_t payload = 0; | ||
20 | |||
21 | switch (sa->instr) { | ||
22 | case SIGMA_ACTION_WRITEXBYTES: | ||
23 | case SIGMA_ACTION_WRITESINGLE: | ||
24 | case SIGMA_ACTION_WRITESAFELOAD: | ||
25 | payload = sigma_action_len(sa); | ||
26 | break; | ||
27 | default: | ||
28 | break; | ||
29 | } | ||
30 | |||
31 | payload = ALIGN(payload, 2); | ||
32 | |||
33 | return payload + sizeof(struct sigma_action); | ||
34 | } | ||
35 | |||
36 | /* | ||
37 | * Returns a negative error value in case of an error, 0 if processing of | ||
38 | * the firmware should be stopped after this action, 1 otherwise. | ||
39 | */ | ||
18 | static int | 40 | static int |
19 | process_sigma_action(struct i2c_client *client, struct sigma_firmware *ssfw) | 41 | process_sigma_action(struct i2c_client *client, struct sigma_action *sa) |
20 | { | 42 | { |
21 | struct sigma_action *sa = (void *)(ssfw->fw->data + ssfw->pos); | ||
22 | size_t len = sigma_action_len(sa); | 43 | size_t len = sigma_action_len(sa); |
23 | int ret = 0; | 44 | int ret; |
24 | 45 | ||
25 | pr_debug("%s: instr:%i addr:%#x len:%zu\n", __func__, | 46 | pr_debug("%s: instr:%i addr:%#x len:%zu\n", __func__, |
26 | sa->instr, sa->addr, len); | 47 | sa->instr, sa->addr, len); |
@@ -29,44 +50,50 @@ process_sigma_action(struct i2c_client *client, struct sigma_firmware *ssfw) | |||
29 | case SIGMA_ACTION_WRITEXBYTES: | 50 | case SIGMA_ACTION_WRITEXBYTES: |
30 | case SIGMA_ACTION_WRITESINGLE: | 51 | case SIGMA_ACTION_WRITESINGLE: |
31 | case SIGMA_ACTION_WRITESAFELOAD: | 52 | case SIGMA_ACTION_WRITESAFELOAD: |
32 | if (ssfw->fw->size < ssfw->pos + len) | ||
33 | return -EINVAL; | ||
34 | ret = i2c_master_send(client, (void *)&sa->addr, len); | 53 | ret = i2c_master_send(client, (void *)&sa->addr, len); |
35 | if (ret < 0) | 54 | if (ret < 0) |
36 | return -EINVAL; | 55 | return -EINVAL; |
37 | break; | 56 | break; |
38 | |||
39 | case SIGMA_ACTION_DELAY: | 57 | case SIGMA_ACTION_DELAY: |
40 | ret = 0; | ||
41 | udelay(len); | 58 | udelay(len); |
42 | len = 0; | 59 | len = 0; |
43 | break; | 60 | break; |
44 | |||
45 | case SIGMA_ACTION_END: | 61 | case SIGMA_ACTION_END: |
46 | return 1; | 62 | return 0; |
47 | |||
48 | default: | 63 | default: |
49 | return -EINVAL; | 64 | return -EINVAL; |
50 | } | 65 | } |
51 | 66 | ||
52 | /* when arrive here ret=0 or sent data */ | 67 | return 1; |
53 | ssfw->pos += sigma_action_size(sa, len); | ||
54 | return ssfw->pos == ssfw->fw->size; | ||
55 | } | 68 | } |
56 | 69 | ||
57 | static int | 70 | static int |
58 | process_sigma_actions(struct i2c_client *client, struct sigma_firmware *ssfw) | 71 | process_sigma_actions(struct i2c_client *client, struct sigma_firmware *ssfw) |
59 | { | 72 | { |
60 | pr_debug("%s: processing %p\n", __func__, ssfw); | 73 | struct sigma_action *sa; |
74 | size_t size; | ||
75 | int ret; | ||
76 | |||
77 | while (ssfw->pos + sizeof(*sa) <= ssfw->fw->size) { | ||
78 | sa = (struct sigma_action *)(ssfw->fw->data + ssfw->pos); | ||
79 | |||
80 | size = sigma_action_size(sa); | ||
81 | ssfw->pos += size; | ||
82 | if (ssfw->pos > ssfw->fw->size || size == 0) | ||
83 | break; | ||
84 | |||
85 | ret = process_sigma_action(client, sa); | ||
61 | 86 | ||
62 | while (1) { | ||
63 | int ret = process_sigma_action(client, ssfw); | ||
64 | pr_debug("%s: action returned %i\n", __func__, ret); | 87 | pr_debug("%s: action returned %i\n", __func__, ret); |
65 | if (ret == 1) | 88 | |
66 | return 0; | 89 | if (ret <= 0) |
67 | else if (ret) | ||
68 | return ret; | 90 | return ret; |
69 | } | 91 | } |
92 | |||
93 | if (ssfw->pos != ssfw->fw->size) | ||
94 | return -EINVAL; | ||
95 | |||
96 | return 0; | ||
70 | } | 97 | } |
71 | 98 | ||
72 | int process_sigma_firmware(struct i2c_client *client, const char *name) | 99 | int process_sigma_firmware(struct i2c_client *client, const char *name) |
@@ -89,16 +116,24 @@ int process_sigma_firmware(struct i2c_client *client, const char *name) | |||
89 | 116 | ||
90 | /* then verify the header */ | 117 | /* then verify the header */ |
91 | ret = -EINVAL; | 118 | ret = -EINVAL; |
92 | if (fw->size < sizeof(*ssfw_head)) | 119 | |
120 | /* | ||
121 | * Reject too small or unreasonable large files. The upper limit has been | ||
122 | * chosen a bit arbitrarily, but it should be enough for all practical | ||
123 | * purposes and having the limit makes it easier to avoid integer | ||
124 | * overflows later in the loading process. | ||
125 | */ | ||
126 | if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000) | ||
93 | goto done; | 127 | goto done; |
94 | 128 | ||
95 | ssfw_head = (void *)fw->data; | 129 | ssfw_head = (void *)fw->data; |
96 | if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) | 130 | if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) |
97 | goto done; | 131 | goto done; |
98 | 132 | ||
99 | crc = crc32(0, fw->data, fw->size); | 133 | crc = crc32(0, fw->data + sizeof(*ssfw_head), |
134 | fw->size - sizeof(*ssfw_head)); | ||
100 | pr_debug("%s: crc=%x\n", __func__, crc); | 135 | pr_debug("%s: crc=%x\n", __func__, crc); |
101 | if (crc != ssfw_head->crc) | 136 | if (crc != le32_to_cpu(ssfw_head->crc)) |
102 | goto done; | 137 | goto done; |
103 | 138 | ||
104 | ssfw.pos = sizeof(*ssfw_head); | 139 | ssfw.pos = sizeof(*ssfw_head); |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index dbcb0bcfd8da..4e018d6a7639 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
@@ -18,7 +18,7 @@ obj-$(CONFIG_ARCH_DAVINCI) += gpio-davinci.o | |||
18 | obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o | 18 | obj-$(CONFIG_GPIO_EP93XX) += gpio-ep93xx.o |
19 | obj-$(CONFIG_GPIO_IT8761E) += gpio-it8761e.o | 19 | obj-$(CONFIG_GPIO_IT8761E) += gpio-it8761e.o |
20 | obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o | 20 | obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o |
21 | obj-$(CONFIG_MACH_KS8695) += gpio-ks8695.o | 21 | obj-$(CONFIG_ARCH_KS8695) += gpio-ks8695.o |
22 | obj-$(CONFIG_GPIO_LANGWELL) += gpio-langwell.o | 22 | obj-$(CONFIG_GPIO_LANGWELL) += gpio-langwell.o |
23 | obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o | 23 | obj-$(CONFIG_ARCH_LPC32XX) += gpio-lpc32xx.o |
24 | obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o | 24 | obj-$(CONFIG_GPIO_MAX730X) += gpio-max730x.o |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 3969f7553fe7..d2619d72cece 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -456,6 +456,30 @@ done: | |||
456 | EXPORT_SYMBOL(drm_crtc_helper_set_mode); | 456 | EXPORT_SYMBOL(drm_crtc_helper_set_mode); |
457 | 457 | ||
458 | 458 | ||
459 | static int | ||
460 | drm_crtc_helper_disable(struct drm_crtc *crtc) | ||
461 | { | ||
462 | struct drm_device *dev = crtc->dev; | ||
463 | struct drm_connector *connector; | ||
464 | struct drm_encoder *encoder; | ||
465 | |||
466 | /* Decouple all encoders and their attached connectors from this crtc */ | ||
467 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | ||
468 | if (encoder->crtc != crtc) | ||
469 | continue; | ||
470 | |||
471 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
472 | if (connector->encoder != encoder) | ||
473 | continue; | ||
474 | |||
475 | connector->encoder = NULL; | ||
476 | } | ||
477 | } | ||
478 | |||
479 | drm_helper_disable_unused_functions(dev); | ||
480 | return 0; | ||
481 | } | ||
482 | |||
459 | /** | 483 | /** |
460 | * drm_crtc_helper_set_config - set a new config from userspace | 484 | * drm_crtc_helper_set_config - set a new config from userspace |
461 | * @crtc: CRTC to setup | 485 | * @crtc: CRTC to setup |
@@ -510,8 +534,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
510 | (int)set->num_connectors, set->x, set->y); | 534 | (int)set->num_connectors, set->x, set->y); |
511 | } else { | 535 | } else { |
512 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id); | 536 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id); |
513 | set->mode = NULL; | 537 | return drm_crtc_helper_disable(set->crtc); |
514 | set->num_connectors = 0; | ||
515 | } | 538 | } |
516 | 539 | ||
517 | dev = set->crtc->dev; | 540 | dev = set->crtc->dev; |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 8359dc777041..60ff1b63b568 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2026,8 +2026,13 @@ i915_wait_request(struct intel_ring_buffer *ring, | |||
2026 | * to handle this, the waiter on a request often wants an associated | 2026 | * to handle this, the waiter on a request often wants an associated |
2027 | * buffer to have made it to the inactive list, and we would need | 2027 | * buffer to have made it to the inactive list, and we would need |
2028 | * a separate wait queue to handle that. | 2028 | * a separate wait queue to handle that. |
2029 | * | ||
2030 | * To avoid a recursion with the ilk VT-d workaround (that calls | ||
2031 | * gpu_idle when unbinding objects with interruptible==false) don't | ||
2032 | * retire requests in that case (because it might call unbind if the | ||
2033 | * active list holds the last reference to the object). | ||
2029 | */ | 2034 | */ |
2030 | if (ret == 0) | 2035 | if (ret == 0 && dev_priv->mm.interruptible) |
2031 | i915_gem_retire_requests_ring(ring); | 2036 | i915_gem_retire_requests_ring(ring); |
2032 | 2037 | ||
2033 | return ret; | 2038 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index ddbabefb4273..b12fd2c80812 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -369,3 +369,48 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, | |||
369 | spin_unlock_irqrestore(&dev->event_lock, flags); | 369 | spin_unlock_irqrestore(&dev->event_lock, flags); |
370 | return 0; | 370 | return 0; |
371 | } | 371 | } |
372 | |||
373 | int | ||
374 | nouveau_display_dumb_create(struct drm_file *file_priv, struct drm_device *dev, | ||
375 | struct drm_mode_create_dumb *args) | ||
376 | { | ||
377 | struct nouveau_bo *bo; | ||
378 | int ret; | ||
379 | |||
380 | args->pitch = roundup(args->width * (args->bpp / 8), 256); | ||
381 | args->size = args->pitch * args->height; | ||
382 | args->size = roundup(args->size, PAGE_SIZE); | ||
383 | |||
384 | ret = nouveau_gem_new(dev, args->size, 0, TTM_PL_FLAG_VRAM, 0, 0, &bo); | ||
385 | if (ret) | ||
386 | return ret; | ||
387 | |||
388 | ret = drm_gem_handle_create(file_priv, bo->gem, &args->handle); | ||
389 | drm_gem_object_unreference_unlocked(bo->gem); | ||
390 | return ret; | ||
391 | } | ||
392 | |||
393 | int | ||
394 | nouveau_display_dumb_destroy(struct drm_file *file_priv, struct drm_device *dev, | ||
395 | uint32_t handle) | ||
396 | { | ||
397 | return drm_gem_handle_delete(file_priv, handle); | ||
398 | } | ||
399 | |||
400 | int | ||
401 | nouveau_display_dumb_map_offset(struct drm_file *file_priv, | ||
402 | struct drm_device *dev, | ||
403 | uint32_t handle, uint64_t *poffset) | ||
404 | { | ||
405 | struct drm_gem_object *gem; | ||
406 | |||
407 | gem = drm_gem_object_lookup(dev, file_priv, handle); | ||
408 | if (gem) { | ||
409 | struct nouveau_bo *bo = gem->driver_private; | ||
410 | *poffset = bo->bo.addr_space_offset; | ||
411 | drm_gem_object_unreference_unlocked(gem); | ||
412 | return 0; | ||
413 | } | ||
414 | |||
415 | return -ENOENT; | ||
416 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index 9f7bb1295262..9791d13c9e3b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
@@ -433,6 +433,10 @@ static struct drm_driver driver = { | |||
433 | .gem_open_object = nouveau_gem_object_open, | 433 | .gem_open_object = nouveau_gem_object_open, |
434 | .gem_close_object = nouveau_gem_object_close, | 434 | .gem_close_object = nouveau_gem_object_close, |
435 | 435 | ||
436 | .dumb_create = nouveau_display_dumb_create, | ||
437 | .dumb_map_offset = nouveau_display_dumb_map_offset, | ||
438 | .dumb_destroy = nouveau_display_dumb_destroy, | ||
439 | |||
436 | .name = DRIVER_NAME, | 440 | .name = DRIVER_NAME, |
437 | .desc = DRIVER_DESC, | 441 | .desc = DRIVER_DESC, |
438 | #ifdef GIT_REVISION | 442 | #ifdef GIT_REVISION |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 29837da1098b..4c0be3a4ed88 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -1418,6 +1418,12 @@ int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
1418 | struct drm_pending_vblank_event *event); | 1418 | struct drm_pending_vblank_event *event); |
1419 | int nouveau_finish_page_flip(struct nouveau_channel *, | 1419 | int nouveau_finish_page_flip(struct nouveau_channel *, |
1420 | struct nouveau_page_flip_state *); | 1420 | struct nouveau_page_flip_state *); |
1421 | int nouveau_display_dumb_create(struct drm_file *, struct drm_device *, | ||
1422 | struct drm_mode_create_dumb *args); | ||
1423 | int nouveau_display_dumb_map_offset(struct drm_file *, struct drm_device *, | ||
1424 | uint32_t handle, uint64_t *offset); | ||
1425 | int nouveau_display_dumb_destroy(struct drm_file *, struct drm_device *, | ||
1426 | uint32_t handle); | ||
1421 | 1427 | ||
1422 | /* nv10_gpio.c */ | 1428 | /* nv10_gpio.c */ |
1423 | int nv10_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); | 1429 | int nv10_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 02222c540aee..960c0ae0c0c3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
@@ -680,7 +680,7 @@ nouveau_gpuobj_channel_init_pramin(struct nouveau_channel *chan) | |||
680 | return ret; | 680 | return ret; |
681 | } | 681 | } |
682 | 682 | ||
683 | ret = drm_mm_init(&chan->ramin_heap, base, size); | 683 | ret = drm_mm_init(&chan->ramin_heap, base, size - base); |
684 | if (ret) { | 684 | if (ret) { |
685 | NV_ERROR(dev, "Error creating PRAMIN heap: %d\n", ret); | 685 | NV_ERROR(dev, "Error creating PRAMIN heap: %d\n", ret); |
686 | nouveau_gpuobj_ref(NULL, &chan->ramin); | 686 | nouveau_gpuobj_ref(NULL, &chan->ramin); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index b75258a9fe44..c8a463b76c89 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
@@ -67,7 +67,10 @@ nouveau_sgdma_clear(struct ttm_backend *be) | |||
67 | pci_unmap_page(dev->pdev, nvbe->pages[nvbe->nr_pages], | 67 | pci_unmap_page(dev->pdev, nvbe->pages[nvbe->nr_pages], |
68 | PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); | 68 | PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
69 | } | 69 | } |
70 | nvbe->unmap_pages = false; | ||
70 | } | 71 | } |
72 | |||
73 | nvbe->pages = NULL; | ||
71 | } | 74 | } |
72 | 75 | ||
73 | static void | 76 | static void |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index d23ca00e7d62..06de250fe617 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -616,7 +616,7 @@ nv50_display_unk10_handler(struct drm_device *dev) | |||
616 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 616 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
617 | struct nv50_display *disp = nv50_display(dev); | 617 | struct nv50_display *disp = nv50_display(dev); |
618 | u32 unk30 = nv_rd32(dev, 0x610030), mc; | 618 | u32 unk30 = nv_rd32(dev, 0x610030), mc; |
619 | int i, crtc, or, type = OUTPUT_ANY; | 619 | int i, crtc, or = 0, type = OUTPUT_ANY; |
620 | 620 | ||
621 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); | 621 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); |
622 | disp->irq.dcb = NULL; | 622 | disp->irq.dcb = NULL; |
@@ -708,7 +708,7 @@ nv50_display_unk20_handler(struct drm_device *dev) | |||
708 | struct nv50_display *disp = nv50_display(dev); | 708 | struct nv50_display *disp = nv50_display(dev); |
709 | u32 unk30 = nv_rd32(dev, 0x610030), tmp, pclk, script, mc = 0; | 709 | u32 unk30 = nv_rd32(dev, 0x610030), tmp, pclk, script, mc = 0; |
710 | struct dcb_entry *dcb; | 710 | struct dcb_entry *dcb; |
711 | int i, crtc, or, type = OUTPUT_ANY; | 711 | int i, crtc, or = 0, type = OUTPUT_ANY; |
712 | 712 | ||
713 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); | 713 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); |
714 | dcb = disp->irq.dcb; | 714 | dcb = disp->irq.dcb; |
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c index a74e501afd25..ecfafd70cf0e 100644 --- a/drivers/gpu/drm/nouveau/nvc0_graph.c +++ b/drivers/gpu/drm/nouveau/nvc0_graph.c | |||
@@ -381,6 +381,8 @@ nvc0_graph_init_gpc_0(struct drm_device *dev) | |||
381 | u8 tpnr[GPC_MAX]; | 381 | u8 tpnr[GPC_MAX]; |
382 | int i, gpc, tpc; | 382 | int i, gpc, tpc; |
383 | 383 | ||
384 | nv_wr32(dev, TP_UNIT(0, 0, 0x5c), 1); /* affects TFB offset queries */ | ||
385 | |||
384 | /* | 386 | /* |
385 | * TP ROP UNKVAL(magic_not_rop_nr) | 387 | * TP ROP UNKVAL(magic_not_rop_nr) |
386 | * 450: 4/0/0/0 2 3 | 388 | * 450: 4/0/0/0 2 3 |
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c index 23d63b4b3d77..cb006a718e70 100644 --- a/drivers/gpu/drm/nouveau/nvd0_display.c +++ b/drivers/gpu/drm/nouveau/nvd0_display.c | |||
@@ -780,7 +780,7 @@ nvd0_sor_dpms(struct drm_encoder *encoder, int mode) | |||
780 | continue; | 780 | continue; |
781 | 781 | ||
782 | if (nv_partner != nv_encoder && | 782 | if (nv_partner != nv_encoder && |
783 | nv_partner->dcb->or == nv_encoder->or) { | 783 | nv_partner->dcb->or == nv_encoder->dcb->or) { |
784 | if (nv_partner->last_dpms == DRM_MODE_DPMS_ON) | 784 | if (nv_partner->last_dpms == DRM_MODE_DPMS_ON) |
785 | return; | 785 | return; |
786 | break; | 786 | break; |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 87631fede1f8..2b97262e3ab1 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -1107,9 +1107,40 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
1107 | return -EINVAL; | 1107 | return -EINVAL; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | if (tiling_flags & RADEON_TILING_MACRO) | 1110 | if (tiling_flags & RADEON_TILING_MACRO) { |
1111 | if (rdev->family >= CHIP_CAYMAN) | ||
1112 | tmp = rdev->config.cayman.tile_config; | ||
1113 | else | ||
1114 | tmp = rdev->config.evergreen.tile_config; | ||
1115 | |||
1116 | switch ((tmp & 0xf0) >> 4) { | ||
1117 | case 0: /* 4 banks */ | ||
1118 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_4_BANK); | ||
1119 | break; | ||
1120 | case 1: /* 8 banks */ | ||
1121 | default: | ||
1122 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_8_BANK); | ||
1123 | break; | ||
1124 | case 2: /* 16 banks */ | ||
1125 | fb_format |= EVERGREEN_GRPH_NUM_BANKS(EVERGREEN_ADDR_SURF_16_BANK); | ||
1126 | break; | ||
1127 | } | ||
1128 | |||
1129 | switch ((tmp & 0xf000) >> 12) { | ||
1130 | case 0: /* 1KB rows */ | ||
1131 | default: | ||
1132 | fb_format |= EVERGREEN_GRPH_TILE_SPLIT(EVERGREEN_ADDR_SURF_TILE_SPLIT_1KB); | ||
1133 | break; | ||
1134 | case 1: /* 2KB rows */ | ||
1135 | fb_format |= EVERGREEN_GRPH_TILE_SPLIT(EVERGREEN_ADDR_SURF_TILE_SPLIT_2KB); | ||
1136 | break; | ||
1137 | case 2: /* 4KB rows */ | ||
1138 | fb_format |= EVERGREEN_GRPH_TILE_SPLIT(EVERGREEN_ADDR_SURF_TILE_SPLIT_4KB); | ||
1139 | break; | ||
1140 | } | ||
1141 | |||
1111 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1); | 1142 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1); |
1112 | else if (tiling_flags & RADEON_TILING_MICRO) | 1143 | } else if (tiling_flags & RADEON_TILING_MICRO) |
1113 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1); | 1144 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1); |
1114 | 1145 | ||
1115 | switch (radeon_crtc->crtc_id) { | 1146 | switch (radeon_crtc->crtc_id) { |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 1d603a3335db..5e00d1670aa9 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -82,6 +82,7 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
82 | { | 82 | { |
83 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 83 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
84 | u32 tmp = RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset); | 84 | u32 tmp = RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset); |
85 | int i; | ||
85 | 86 | ||
86 | /* Lock the graphics update lock */ | 87 | /* Lock the graphics update lock */ |
87 | tmp |= EVERGREEN_GRPH_UPDATE_LOCK; | 88 | tmp |= EVERGREEN_GRPH_UPDATE_LOCK; |
@@ -99,7 +100,11 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
99 | (u32)crtc_base); | 100 | (u32)crtc_base); |
100 | 101 | ||
101 | /* Wait for update_pending to go high. */ | 102 | /* Wait for update_pending to go high. */ |
102 | while (!(RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset) & EVERGREEN_GRPH_SURFACE_UPDATE_PENDING)); | 103 | for (i = 0; i < rdev->usec_timeout; i++) { |
104 | if (RREG32(EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset) & EVERGREEN_GRPH_SURFACE_UPDATE_PENDING) | ||
105 | break; | ||
106 | udelay(1); | ||
107 | } | ||
103 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 108 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
104 | 109 | ||
105 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 110 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 38e1bda73d33..cd4590aae154 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
@@ -38,6 +38,7 @@ struct evergreen_cs_track { | |||
38 | u32 group_size; | 38 | u32 group_size; |
39 | u32 nbanks; | 39 | u32 nbanks; |
40 | u32 npipes; | 40 | u32 npipes; |
41 | u32 row_size; | ||
41 | /* value we track */ | 42 | /* value we track */ |
42 | u32 nsamples; | 43 | u32 nsamples; |
43 | u32 cb_color_base_last[12]; | 44 | u32 cb_color_base_last[12]; |
@@ -77,6 +78,44 @@ struct evergreen_cs_track { | |||
77 | struct radeon_bo *db_s_write_bo; | 78 | struct radeon_bo *db_s_write_bo; |
78 | }; | 79 | }; |
79 | 80 | ||
81 | static u32 evergreen_cs_get_aray_mode(u32 tiling_flags) | ||
82 | { | ||
83 | if (tiling_flags & RADEON_TILING_MACRO) | ||
84 | return ARRAY_2D_TILED_THIN1; | ||
85 | else if (tiling_flags & RADEON_TILING_MICRO) | ||
86 | return ARRAY_1D_TILED_THIN1; | ||
87 | else | ||
88 | return ARRAY_LINEAR_GENERAL; | ||
89 | } | ||
90 | |||
91 | static u32 evergreen_cs_get_num_banks(u32 nbanks) | ||
92 | { | ||
93 | switch (nbanks) { | ||
94 | case 2: | ||
95 | return ADDR_SURF_2_BANK; | ||
96 | case 4: | ||
97 | return ADDR_SURF_4_BANK; | ||
98 | case 8: | ||
99 | default: | ||
100 | return ADDR_SURF_8_BANK; | ||
101 | case 16: | ||
102 | return ADDR_SURF_16_BANK; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | static u32 evergreen_cs_get_tile_split(u32 row_size) | ||
107 | { | ||
108 | switch (row_size) { | ||
109 | case 1: | ||
110 | default: | ||
111 | return ADDR_SURF_TILE_SPLIT_1KB; | ||
112 | case 2: | ||
113 | return ADDR_SURF_TILE_SPLIT_2KB; | ||
114 | case 4: | ||
115 | return ADDR_SURF_TILE_SPLIT_4KB; | ||
116 | } | ||
117 | } | ||
118 | |||
80 | static void evergreen_cs_track_init(struct evergreen_cs_track *track) | 119 | static void evergreen_cs_track_init(struct evergreen_cs_track *track) |
81 | { | 120 | { |
82 | int i; | 121 | int i; |
@@ -490,12 +529,11 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
490 | } | 529 | } |
491 | ib[idx] &= ~Z_ARRAY_MODE(0xf); | 530 | ib[idx] &= ~Z_ARRAY_MODE(0xf); |
492 | track->db_z_info &= ~Z_ARRAY_MODE(0xf); | 531 | track->db_z_info &= ~Z_ARRAY_MODE(0xf); |
532 | ib[idx] |= Z_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); | ||
533 | track->db_z_info |= Z_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); | ||
493 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 534 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { |
494 | ib[idx] |= Z_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 535 | ib[idx] |= DB_NUM_BANKS(evergreen_cs_get_num_banks(track->nbanks)); |
495 | track->db_z_info |= Z_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 536 | ib[idx] |= DB_TILE_SPLIT(evergreen_cs_get_tile_split(track->row_size)); |
496 | } else { | ||
497 | ib[idx] |= Z_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
498 | track->db_z_info |= Z_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
499 | } | 537 | } |
500 | } | 538 | } |
501 | break; | 539 | break; |
@@ -618,13 +656,8 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
618 | "0x%04X\n", reg); | 656 | "0x%04X\n", reg); |
619 | return -EINVAL; | 657 | return -EINVAL; |
620 | } | 658 | } |
621 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 659 | ib[idx] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
622 | ib[idx] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 660 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
623 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
624 | } else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) { | ||
625 | ib[idx] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
626 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
627 | } | ||
628 | } | 661 | } |
629 | break; | 662 | break; |
630 | case CB_COLOR8_INFO: | 663 | case CB_COLOR8_INFO: |
@@ -640,13 +673,8 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
640 | "0x%04X\n", reg); | 673 | "0x%04X\n", reg); |
641 | return -EINVAL; | 674 | return -EINVAL; |
642 | } | 675 | } |
643 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | 676 | ib[idx] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
644 | ib[idx] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 677 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
645 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | ||
646 | } else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) { | ||
647 | ib[idx] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
648 | track->cb_color_info[tmp] |= CB_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | ||
649 | } | ||
650 | } | 678 | } |
651 | break; | 679 | break; |
652 | case CB_COLOR0_PITCH: | 680 | case CB_COLOR0_PITCH: |
@@ -701,6 +729,16 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
701 | case CB_COLOR9_ATTRIB: | 729 | case CB_COLOR9_ATTRIB: |
702 | case CB_COLOR10_ATTRIB: | 730 | case CB_COLOR10_ATTRIB: |
703 | case CB_COLOR11_ATTRIB: | 731 | case CB_COLOR11_ATTRIB: |
732 | r = evergreen_cs_packet_next_reloc(p, &reloc); | ||
733 | if (r) { | ||
734 | dev_warn(p->dev, "bad SET_CONTEXT_REG " | ||
735 | "0x%04X\n", reg); | ||
736 | return -EINVAL; | ||
737 | } | ||
738 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { | ||
739 | ib[idx] |= CB_NUM_BANKS(evergreen_cs_get_num_banks(track->nbanks)); | ||
740 | ib[idx] |= CB_TILE_SPLIT(evergreen_cs_get_tile_split(track->row_size)); | ||
741 | } | ||
704 | break; | 742 | break; |
705 | case CB_COLOR0_DIM: | 743 | case CB_COLOR0_DIM: |
706 | case CB_COLOR1_DIM: | 744 | case CB_COLOR1_DIM: |
@@ -1318,10 +1356,14 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p, | |||
1318 | } | 1356 | } |
1319 | ib[idx+1+(i*8)+2] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1357 | ib[idx+1+(i*8)+2] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
1320 | if (!p->keep_tiling_flags) { | 1358 | if (!p->keep_tiling_flags) { |
1321 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) | 1359 | ib[idx+1+(i*8)+1] |= |
1322 | ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_2D_TILED_THIN1); | 1360 | TEX_ARRAY_MODE(evergreen_cs_get_aray_mode(reloc->lobj.tiling_flags)); |
1323 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) | 1361 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) { |
1324 | ib[idx+1+(i*8)+1] |= TEX_ARRAY_MODE(ARRAY_1D_TILED_THIN1); | 1362 | ib[idx+1+(i*8)+6] |= |
1363 | TEX_TILE_SPLIT(evergreen_cs_get_tile_split(track->row_size)); | ||
1364 | ib[idx+1+(i*8)+7] |= | ||
1365 | TEX_NUM_BANKS(evergreen_cs_get_num_banks(track->nbanks)); | ||
1366 | } | ||
1325 | } | 1367 | } |
1326 | texture = reloc->robj; | 1368 | texture = reloc->robj; |
1327 | /* tex mip base */ | 1369 | /* tex mip base */ |
@@ -1422,6 +1464,7 @@ int evergreen_cs_parse(struct radeon_cs_parser *p) | |||
1422 | { | 1464 | { |
1423 | struct radeon_cs_packet pkt; | 1465 | struct radeon_cs_packet pkt; |
1424 | struct evergreen_cs_track *track; | 1466 | struct evergreen_cs_track *track; |
1467 | u32 tmp; | ||
1425 | int r; | 1468 | int r; |
1426 | 1469 | ||
1427 | if (p->track == NULL) { | 1470 | if (p->track == NULL) { |
@@ -1430,9 +1473,63 @@ int evergreen_cs_parse(struct radeon_cs_parser *p) | |||
1430 | if (track == NULL) | 1473 | if (track == NULL) |
1431 | return -ENOMEM; | 1474 | return -ENOMEM; |
1432 | evergreen_cs_track_init(track); | 1475 | evergreen_cs_track_init(track); |
1433 | track->npipes = p->rdev->config.evergreen.tiling_npipes; | 1476 | if (p->rdev->family >= CHIP_CAYMAN) |
1434 | track->nbanks = p->rdev->config.evergreen.tiling_nbanks; | 1477 | tmp = p->rdev->config.cayman.tile_config; |
1435 | track->group_size = p->rdev->config.evergreen.tiling_group_size; | 1478 | else |
1479 | tmp = p->rdev->config.evergreen.tile_config; | ||
1480 | |||
1481 | switch (tmp & 0xf) { | ||
1482 | case 0: | ||
1483 | track->npipes = 1; | ||
1484 | break; | ||
1485 | case 1: | ||
1486 | default: | ||
1487 | track->npipes = 2; | ||
1488 | break; | ||
1489 | case 2: | ||
1490 | track->npipes = 4; | ||
1491 | break; | ||
1492 | case 3: | ||
1493 | track->npipes = 8; | ||
1494 | break; | ||
1495 | } | ||
1496 | |||
1497 | switch ((tmp & 0xf0) >> 4) { | ||
1498 | case 0: | ||
1499 | track->nbanks = 4; | ||
1500 | break; | ||
1501 | case 1: | ||
1502 | default: | ||
1503 | track->nbanks = 8; | ||
1504 | break; | ||
1505 | case 2: | ||
1506 | track->nbanks = 16; | ||
1507 | break; | ||
1508 | } | ||
1509 | |||
1510 | switch ((tmp & 0xf00) >> 8) { | ||
1511 | case 0: | ||
1512 | track->group_size = 256; | ||
1513 | break; | ||
1514 | case 1: | ||
1515 | default: | ||
1516 | track->group_size = 512; | ||
1517 | break; | ||
1518 | } | ||
1519 | |||
1520 | switch ((tmp & 0xf000) >> 12) { | ||
1521 | case 0: | ||
1522 | track->row_size = 1; | ||
1523 | break; | ||
1524 | case 1: | ||
1525 | default: | ||
1526 | track->row_size = 2; | ||
1527 | break; | ||
1528 | case 2: | ||
1529 | track->row_size = 4; | ||
1530 | break; | ||
1531 | } | ||
1532 | |||
1436 | p->track = track; | 1533 | p->track = track; |
1437 | } | 1534 | } |
1438 | do { | 1535 | do { |
diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h index c781c92c3451..7d7f2155e34c 100644 --- a/drivers/gpu/drm/radeon/evergreen_reg.h +++ b/drivers/gpu/drm/radeon/evergreen_reg.h | |||
@@ -42,6 +42,17 @@ | |||
42 | # define EVERGREEN_GRPH_DEPTH_8BPP 0 | 42 | # define EVERGREEN_GRPH_DEPTH_8BPP 0 |
43 | # define EVERGREEN_GRPH_DEPTH_16BPP 1 | 43 | # define EVERGREEN_GRPH_DEPTH_16BPP 1 |
44 | # define EVERGREEN_GRPH_DEPTH_32BPP 2 | 44 | # define EVERGREEN_GRPH_DEPTH_32BPP 2 |
45 | # define EVERGREEN_GRPH_NUM_BANKS(x) (((x) & 0x3) << 2) | ||
46 | # define EVERGREEN_ADDR_SURF_2_BANK 0 | ||
47 | # define EVERGREEN_ADDR_SURF_4_BANK 1 | ||
48 | # define EVERGREEN_ADDR_SURF_8_BANK 2 | ||
49 | # define EVERGREEN_ADDR_SURF_16_BANK 3 | ||
50 | # define EVERGREEN_GRPH_Z(x) (((x) & 0x3) << 4) | ||
51 | # define EVERGREEN_GRPH_BANK_WIDTH(x) (((x) & 0x3) << 6) | ||
52 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_1 0 | ||
53 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_2 1 | ||
54 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_4 2 | ||
55 | # define EVERGREEN_ADDR_SURF_BANK_WIDTH_8 3 | ||
45 | # define EVERGREEN_GRPH_FORMAT(x) (((x) & 0x7) << 8) | 56 | # define EVERGREEN_GRPH_FORMAT(x) (((x) & 0x7) << 8) |
46 | /* 8 BPP */ | 57 | /* 8 BPP */ |
47 | # define EVERGREEN_GRPH_FORMAT_INDEXED 0 | 58 | # define EVERGREEN_GRPH_FORMAT_INDEXED 0 |
@@ -61,6 +72,24 @@ | |||
61 | # define EVERGREEN_GRPH_FORMAT_8B_BGRA1010102 5 | 72 | # define EVERGREEN_GRPH_FORMAT_8B_BGRA1010102 5 |
62 | # define EVERGREEN_GRPH_FORMAT_RGB111110 6 | 73 | # define EVERGREEN_GRPH_FORMAT_RGB111110 6 |
63 | # define EVERGREEN_GRPH_FORMAT_BGR101111 7 | 74 | # define EVERGREEN_GRPH_FORMAT_BGR101111 7 |
75 | # define EVERGREEN_GRPH_BANK_HEIGHT(x) (((x) & 0x3) << 11) | ||
76 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_1 0 | ||
77 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_2 1 | ||
78 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_4 2 | ||
79 | # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_8 3 | ||
80 | # define EVERGREEN_GRPH_TILE_SPLIT(x) (((x) & 0x7) << 13) | ||
81 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_64B 0 | ||
82 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_128B 1 | ||
83 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_256B 2 | ||
84 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_512B 3 | ||
85 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_1KB 4 | ||
86 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_2KB 5 | ||
87 | # define EVERGREEN_ADDR_SURF_TILE_SPLIT_4KB 6 | ||
88 | # define EVERGREEN_GRPH_MACRO_TILE_ASPECT(x) (((x) & 0x3) << 18) | ||
89 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_1 0 | ||
90 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_2 1 | ||
91 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_4 2 | ||
92 | # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_8 3 | ||
64 | # define EVERGREEN_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20) | 93 | # define EVERGREEN_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20) |
65 | # define EVERGREEN_GRPH_ARRAY_LINEAR_GENERAL 0 | 94 | # define EVERGREEN_GRPH_ARRAY_LINEAR_GENERAL 0 |
66 | # define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1 | 95 | # define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1 |
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index b937c49054d9..e00039e59a75 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -899,6 +899,10 @@ | |||
899 | #define DB_HTILE_DATA_BASE 0x28014 | 899 | #define DB_HTILE_DATA_BASE 0x28014 |
900 | #define DB_Z_INFO 0x28040 | 900 | #define DB_Z_INFO 0x28040 |
901 | # define Z_ARRAY_MODE(x) ((x) << 4) | 901 | # define Z_ARRAY_MODE(x) ((x) << 4) |
902 | # define DB_TILE_SPLIT(x) (((x) & 0x7) << 8) | ||
903 | # define DB_NUM_BANKS(x) (((x) & 0x3) << 12) | ||
904 | # define DB_BANK_WIDTH(x) (((x) & 0x3) << 16) | ||
905 | # define DB_BANK_HEIGHT(x) (((x) & 0x3) << 20) | ||
902 | #define DB_STENCIL_INFO 0x28044 | 906 | #define DB_STENCIL_INFO 0x28044 |
903 | #define DB_Z_READ_BASE 0x28048 | 907 | #define DB_Z_READ_BASE 0x28048 |
904 | #define DB_STENCIL_READ_BASE 0x2804c | 908 | #define DB_STENCIL_READ_BASE 0x2804c |
@@ -951,6 +955,29 @@ | |||
951 | # define CB_SF_EXPORT_FULL 0 | 955 | # define CB_SF_EXPORT_FULL 0 |
952 | # define CB_SF_EXPORT_NORM 1 | 956 | # define CB_SF_EXPORT_NORM 1 |
953 | #define CB_COLOR0_ATTRIB 0x28c74 | 957 | #define CB_COLOR0_ATTRIB 0x28c74 |
958 | # define CB_TILE_SPLIT(x) (((x) & 0x7) << 5) | ||
959 | # define ADDR_SURF_TILE_SPLIT_64B 0 | ||
960 | # define ADDR_SURF_TILE_SPLIT_128B 1 | ||
961 | # define ADDR_SURF_TILE_SPLIT_256B 2 | ||
962 | # define ADDR_SURF_TILE_SPLIT_512B 3 | ||
963 | # define ADDR_SURF_TILE_SPLIT_1KB 4 | ||
964 | # define ADDR_SURF_TILE_SPLIT_2KB 5 | ||
965 | # define ADDR_SURF_TILE_SPLIT_4KB 6 | ||
966 | # define CB_NUM_BANKS(x) (((x) & 0x3) << 10) | ||
967 | # define ADDR_SURF_2_BANK 0 | ||
968 | # define ADDR_SURF_4_BANK 1 | ||
969 | # define ADDR_SURF_8_BANK 2 | ||
970 | # define ADDR_SURF_16_BANK 3 | ||
971 | # define CB_BANK_WIDTH(x) (((x) & 0x3) << 13) | ||
972 | # define ADDR_SURF_BANK_WIDTH_1 0 | ||
973 | # define ADDR_SURF_BANK_WIDTH_2 1 | ||
974 | # define ADDR_SURF_BANK_WIDTH_4 2 | ||
975 | # define ADDR_SURF_BANK_WIDTH_8 3 | ||
976 | # define CB_BANK_HEIGHT(x) (((x) & 0x3) << 16) | ||
977 | # define ADDR_SURF_BANK_HEIGHT_1 0 | ||
978 | # define ADDR_SURF_BANK_HEIGHT_2 1 | ||
979 | # define ADDR_SURF_BANK_HEIGHT_4 2 | ||
980 | # define ADDR_SURF_BANK_HEIGHT_8 3 | ||
954 | #define CB_COLOR0_DIM 0x28c78 | 981 | #define CB_COLOR0_DIM 0x28c78 |
955 | /* only CB0-7 blocks have these regs */ | 982 | /* only CB0-7 blocks have these regs */ |
956 | #define CB_COLOR0_CMASK 0x28c7c | 983 | #define CB_COLOR0_CMASK 0x28c7c |
@@ -1137,7 +1164,11 @@ | |||
1137 | # define SQ_SEL_1 5 | 1164 | # define SQ_SEL_1 5 |
1138 | #define SQ_TEX_RESOURCE_WORD5_0 0x30014 | 1165 | #define SQ_TEX_RESOURCE_WORD5_0 0x30014 |
1139 | #define SQ_TEX_RESOURCE_WORD6_0 0x30018 | 1166 | #define SQ_TEX_RESOURCE_WORD6_0 0x30018 |
1167 | # define TEX_TILE_SPLIT(x) (((x) & 0x7) << 29) | ||
1140 | #define SQ_TEX_RESOURCE_WORD7_0 0x3001c | 1168 | #define SQ_TEX_RESOURCE_WORD7_0 0x3001c |
1169 | # define TEX_BANK_WIDTH(x) (((x) & 0x3) << 8) | ||
1170 | # define TEX_BANK_HEIGHT(x) (((x) & 0x3) << 10) | ||
1171 | # define TEX_NUM_BANKS(x) (((x) & 0x3) << 16) | ||
1141 | 1172 | ||
1142 | #define SQ_VTX_CONSTANT_WORD0_0 0x30000 | 1173 | #define SQ_VTX_CONSTANT_WORD0_0 0x30000 |
1143 | #define SQ_VTX_CONSTANT_WORD1_0 0x30004 | 1174 | #define SQ_VTX_CONSTANT_WORD1_0 0x30004 |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index ad158ea49901..bfc08f6320f8 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -187,13 +187,18 @@ u32 r100_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
187 | { | 187 | { |
188 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 188 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
189 | u32 tmp = ((u32)crtc_base) | RADEON_CRTC_OFFSET__OFFSET_LOCK; | 189 | u32 tmp = ((u32)crtc_base) | RADEON_CRTC_OFFSET__OFFSET_LOCK; |
190 | int i; | ||
190 | 191 | ||
191 | /* Lock the graphics update lock */ | 192 | /* Lock the graphics update lock */ |
192 | /* update the scanout addresses */ | 193 | /* update the scanout addresses */ |
193 | WREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, tmp); | 194 | WREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, tmp); |
194 | 195 | ||
195 | /* Wait for update_pending to go high. */ | 196 | /* Wait for update_pending to go high. */ |
196 | while (!(RREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) & RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET)); | 197 | for (i = 0; i < rdev->usec_timeout; i++) { |
198 | if (RREG32(RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) & RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET) | ||
199 | break; | ||
200 | udelay(1); | ||
201 | } | ||
197 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 202 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
198 | 203 | ||
199 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 204 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c index 3f6636bb2d7f..3516a6081dcf 100644 --- a/drivers/gpu/drm/radeon/radeon_acpi.c +++ b/drivers/gpu/drm/radeon/radeon_acpi.c | |||
@@ -35,7 +35,8 @@ static int radeon_atif_call(acpi_handle handle) | |||
35 | 35 | ||
36 | /* Fail only if calling the method fails and ATIF is supported */ | 36 | /* Fail only if calling the method fails and ATIF is supported */ |
37 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 37 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
38 | printk(KERN_DEBUG "failed to evaluate ATIF got %s\n", acpi_format_exception(status)); | 38 | DRM_DEBUG_DRIVER("failed to evaluate ATIF got %s\n", |
39 | acpi_format_exception(status)); | ||
39 | kfree(buffer.pointer); | 40 | kfree(buffer.pointer); |
40 | return 1; | 41 | return 1; |
41 | } | 42 | } |
@@ -50,13 +51,13 @@ int radeon_acpi_init(struct radeon_device *rdev) | |||
50 | acpi_handle handle; | 51 | acpi_handle handle; |
51 | int ret; | 52 | int ret; |
52 | 53 | ||
53 | /* No need to proceed if we're sure that ATIF is not supported */ | ||
54 | if (!ASIC_IS_AVIVO(rdev) || !rdev->bios) | ||
55 | return 0; | ||
56 | |||
57 | /* Get the device handle */ | 54 | /* Get the device handle */ |
58 | handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); | 55 | handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); |
59 | 56 | ||
57 | /* No need to proceed if we're sure that ATIF is not supported */ | ||
58 | if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle) | ||
59 | return 0; | ||
60 | |||
60 | /* Call the ATIF method */ | 61 | /* Call the ATIF method */ |
61 | ret = radeon_atif_call(handle); | 62 | ret = radeon_atif_call(handle); |
62 | if (ret) | 63 | if (ret) |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 06e413e6a920..4b27efa4405b 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -233,13 +233,12 @@ u16 radeon_encoder_get_dp_bridge_encoder_id(struct drm_encoder *encoder) | |||
233 | switch (radeon_encoder->encoder_id) { | 233 | switch (radeon_encoder->encoder_id) { |
234 | case ENCODER_OBJECT_ID_TRAVIS: | 234 | case ENCODER_OBJECT_ID_TRAVIS: |
235 | case ENCODER_OBJECT_ID_NUTMEG: | 235 | case ENCODER_OBJECT_ID_NUTMEG: |
236 | return true; | 236 | return radeon_encoder->encoder_id; |
237 | default: | 237 | default: |
238 | return false; | 238 | return ENCODER_OBJECT_ID_NONE; |
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | return ENCODER_OBJECT_ID_NONE; | |
242 | return false; | ||
243 | } | 242 | } |
244 | 243 | ||
245 | void radeon_panel_mode_fixup(struct drm_encoder *encoder, | 244 | void radeon_panel_mode_fixup(struct drm_encoder *encoder, |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 481b99e89f65..b1053d640423 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -62,6 +62,7 @@ u32 rs600_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
62 | { | 62 | { |
63 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 63 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
64 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); | 64 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); |
65 | int i; | ||
65 | 66 | ||
66 | /* Lock the graphics update lock */ | 67 | /* Lock the graphics update lock */ |
67 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; | 68 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; |
@@ -74,7 +75,11 @@ u32 rs600_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
74 | (u32)crtc_base); | 75 | (u32)crtc_base); |
75 | 76 | ||
76 | /* Wait for update_pending to go high. */ | 77 | /* Wait for update_pending to go high. */ |
77 | while (!(RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING)); | 78 | for (i = 0; i < rdev->usec_timeout; i++) { |
79 | if (RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING) | ||
80 | break; | ||
81 | udelay(1); | ||
82 | } | ||
78 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 83 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
79 | 84 | ||
80 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 85 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index a983f410ab89..23ae1c60ab3d 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -47,6 +47,7 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
47 | { | 47 | { |
48 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; | 48 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; |
49 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); | 49 | u32 tmp = RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset); |
50 | int i; | ||
50 | 51 | ||
51 | /* Lock the graphics update lock */ | 52 | /* Lock the graphics update lock */ |
52 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; | 53 | tmp |= AVIVO_D1GRPH_UPDATE_LOCK; |
@@ -66,7 +67,11 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
66 | (u32)crtc_base); | 67 | (u32)crtc_base); |
67 | 68 | ||
68 | /* Wait for update_pending to go high. */ | 69 | /* Wait for update_pending to go high. */ |
69 | while (!(RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING)); | 70 | for (i = 0; i < rdev->usec_timeout; i++) { |
71 | if (RREG32(AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & AVIVO_D1GRPH_SURFACE_UPDATE_PENDING) | ||
72 | break; | ||
73 | udelay(1); | ||
74 | } | ||
70 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); | 75 | DRM_DEBUG("Update pending now high. Unlocking vupdate_lock.\n"); |
71 | 76 | ||
72 | /* Unlock the lock, so double-buffering can take place inside vblank */ | 77 | /* Unlock the lock, so double-buffering can take place inside vblank */ |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c index 3f6343502d1f..5ff561d4e0b4 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | |||
@@ -140,7 +140,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data, | |||
140 | goto out_clips; | 140 | goto out_clips; |
141 | } | 141 | } |
142 | 142 | ||
143 | clips = kzalloc(num_clips * sizeof(*clips), GFP_KERNEL); | 143 | clips = kcalloc(num_clips, sizeof(*clips), GFP_KERNEL); |
144 | if (clips == NULL) { | 144 | if (clips == NULL) { |
145 | DRM_ERROR("Failed to allocate clip rect list.\n"); | 145 | DRM_ERROR("Failed to allocate clip rect list.\n"); |
146 | ret = -ENOMEM; | 146 | ret = -ENOMEM; |
@@ -232,7 +232,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data, | |||
232 | goto out_clips; | 232 | goto out_clips; |
233 | } | 233 | } |
234 | 234 | ||
235 | clips = kzalloc(num_clips * sizeof(*clips), GFP_KERNEL); | 235 | clips = kcalloc(num_clips, sizeof(*clips), GFP_KERNEL); |
236 | if (clips == NULL) { | 236 | if (clips == NULL) { |
237 | DRM_ERROR("Failed to allocate clip rect list.\n"); | 237 | DRM_ERROR("Failed to allocate clip rect list.\n"); |
238 | ret = -ENOMEM; | 238 | ret = -ENOMEM; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 880e285d7578..37d40545ed77 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -1809,7 +1809,8 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, | |||
1809 | } | 1809 | } |
1810 | 1810 | ||
1811 | rects_size = arg->num_outputs * sizeof(struct drm_vmw_rect); | 1811 | rects_size = arg->num_outputs * sizeof(struct drm_vmw_rect); |
1812 | rects = kzalloc(rects_size, GFP_KERNEL); | 1812 | rects = kcalloc(arg->num_outputs, sizeof(struct drm_vmw_rect), |
1813 | GFP_KERNEL); | ||
1813 | if (unlikely(!rects)) { | 1814 | if (unlikely(!rects)) { |
1814 | ret = -ENOMEM; | 1815 | ret = -ENOMEM; |
1815 | goto out_unlock; | 1816 | goto out_unlock; |
@@ -1824,10 +1825,10 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, | |||
1824 | } | 1825 | } |
1825 | 1826 | ||
1826 | for (i = 0; i < arg->num_outputs; ++i) { | 1827 | for (i = 0; i < arg->num_outputs; ++i) { |
1827 | if (rects->x < 0 || | 1828 | if (rects[i].x < 0 || |
1828 | rects->y < 0 || | 1829 | rects[i].y < 0 || |
1829 | rects->x + rects->w > mode_config->max_width || | 1830 | rects[i].x + rects[i].w > mode_config->max_width || |
1830 | rects->y + rects->h > mode_config->max_height) { | 1831 | rects[i].y + rects[i].h > mode_config->max_height) { |
1831 | DRM_ERROR("Invalid GUI layout.\n"); | 1832 | DRM_ERROR("Invalid GUI layout.\n"); |
1832 | ret = -EINVAL; | 1833 | ret = -EINVAL; |
1833 | goto out_free; | 1834 | goto out_free; |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 848a56c0279c..af353842f75f 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1771,8 +1771,8 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1771 | { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, | 1771 | { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, |
1772 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, | 1772 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC5UH) }, |
1773 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, | 1773 | { HID_USB_DEVICE(USB_VENDOR_ID_ETT, USB_DEVICE_ID_TC4UM) }, |
1774 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0001) }, | ||
1774 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, | 1775 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0002) }, |
1775 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0003) }, | ||
1776 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, | 1776 | { HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH, 0x0004) }, |
1777 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30) }, | 1777 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_4_PHIDGETSERVO_30) }, |
1778 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30) }, | 1778 | { HID_USB_DEVICE(USB_VENDOR_ID_GLAB, USB_DEVICE_ID_1_PHIDGETSERVO_30) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 06ce996b8b65..4a441a6f9967 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -266,7 +266,7 @@ | |||
266 | #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 | 266 | #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 |
267 | 267 | ||
268 | #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc | 268 | #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc |
269 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0001 | 269 | #define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0003 |
270 | 270 | ||
271 | #define USB_VENDOR_ID_GLAB 0x06c2 | 271 | #define USB_VENDOR_ID_GLAB 0x06c2 |
272 | #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 | 272 | #define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 |
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c index 6dede8f366c5..41d415529479 100644 --- a/drivers/ide/at91_ide.c +++ b/drivers/ide/at91_ide.c | |||
@@ -314,7 +314,7 @@ static int __init at91_ide_probe(struct platform_device *pdev) | |||
314 | apply_timings(board->chipselect, 0, ide_timing_find_mode(XFER_PIO_0), 0); | 314 | apply_timings(board->chipselect, 0, ide_timing_find_mode(XFER_PIO_0), 0); |
315 | 315 | ||
316 | /* with GPIO interrupt we have to do quirks in handler */ | 316 | /* with GPIO interrupt we have to do quirks in handler */ |
317 | if (board->irq_pin >= PIN_BASE) | 317 | if (gpio_is_valid(board->irq_pin)) |
318 | host->irq_handler = at91_irq_handler; | 318 | host->irq_handler = at91_irq_handler; |
319 | 319 | ||
320 | host->ports[0]->select_data = board->chipselect; | 320 | host->ports[0]->select_data = board->chipselect; |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index c0c7820d4c46..a004c3945c67 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -3524,7 +3524,7 @@ found: | |||
3524 | return 0; | 3524 | return 0; |
3525 | } | 3525 | } |
3526 | 3526 | ||
3527 | int dmar_parse_rmrr_atsr_dev(void) | 3527 | int __init dmar_parse_rmrr_atsr_dev(void) |
3528 | { | 3528 | { |
3529 | struct dmar_rmrr_unit *rmrr, *rmrr_n; | 3529 | struct dmar_rmrr_unit *rmrr, *rmrr_n; |
3530 | struct dmar_atsr_unit *atsr, *atsr_n; | 3530 | struct dmar_atsr_unit *atsr, *atsr_n; |
diff --git a/drivers/iommu/intr_remapping.c b/drivers/iommu/intr_remapping.c index 07c9f189f314..6777ca049471 100644 --- a/drivers/iommu/intr_remapping.c +++ b/drivers/iommu/intr_remapping.c | |||
@@ -773,7 +773,7 @@ int __init parse_ioapics_under_ir(void) | |||
773 | return ir_supported; | 773 | return ir_supported; |
774 | } | 774 | } |
775 | 775 | ||
776 | int ir_dev_scope_init(void) | 776 | int __init ir_dev_scope_init(void) |
777 | { | 777 | { |
778 | if (!intr_remapping_enabled) | 778 | if (!intr_remapping_enabled) |
779 | return 0; | 779 | return 0; |
diff --git a/drivers/isdn/divert/divert_procfs.c b/drivers/isdn/divert/divert_procfs.c index 33ec9e467772..9021182c4b76 100644 --- a/drivers/isdn/divert/divert_procfs.c +++ b/drivers/isdn/divert/divert_procfs.c | |||
@@ -242,6 +242,12 @@ static int isdn_divert_ioctl_unlocked(struct file *file, uint cmd, ulong arg) | |||
242 | case IIOCDOCFINT: | 242 | case IIOCDOCFINT: |
243 | if (!divert_if.drv_to_name(dioctl.cf_ctrl.drvid)) | 243 | if (!divert_if.drv_to_name(dioctl.cf_ctrl.drvid)) |
244 | return (-EINVAL); /* invalid driver */ | 244 | return (-EINVAL); /* invalid driver */ |
245 | if (strnlen(dioctl.cf_ctrl.msn, sizeof(dioctl.cf_ctrl.msn)) == | ||
246 | sizeof(dioctl.cf_ctrl.msn)) | ||
247 | return -EINVAL; | ||
248 | if (strnlen(dioctl.cf_ctrl.fwd_nr, sizeof(dioctl.cf_ctrl.fwd_nr)) == | ||
249 | sizeof(dioctl.cf_ctrl.fwd_nr)) | ||
250 | return -EINVAL; | ||
245 | if ((i = cf_command(dioctl.cf_ctrl.drvid, | 251 | if ((i = cf_command(dioctl.cf_ctrl.drvid, |
246 | (cmd == IIOCDOCFACT) ? 1 : (cmd == IIOCDOCFDIS) ? 0 : 2, | 252 | (cmd == IIOCDOCFACT) ? 1 : (cmd == IIOCDOCFDIS) ? 0 : 2, |
247 | dioctl.cf_ctrl.cfproc, | 253 | dioctl.cf_ctrl.cfproc, |
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 1f73d7f7e024..2339d7396b9e 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -2756,6 +2756,9 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg) | |||
2756 | char *c, | 2756 | char *c, |
2757 | *e; | 2757 | *e; |
2758 | 2758 | ||
2759 | if (strnlen(cfg->drvid, sizeof(cfg->drvid)) == | ||
2760 | sizeof(cfg->drvid)) | ||
2761 | return -EINVAL; | ||
2759 | drvidx = -1; | 2762 | drvidx = -1; |
2760 | chidx = -1; | 2763 | chidx = -1; |
2761 | strcpy(drvid, cfg->drvid); | 2764 | strcpy(drvid, cfg->drvid); |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 7878712721bf..b6907118283a 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1106,10 +1106,12 @@ void bitmap_write_all(struct bitmap *bitmap) | |||
1106 | */ | 1106 | */ |
1107 | int i; | 1107 | int i; |
1108 | 1108 | ||
1109 | spin_lock_irq(&bitmap->lock); | ||
1109 | for (i = 0; i < bitmap->file_pages; i++) | 1110 | for (i = 0; i < bitmap->file_pages; i++) |
1110 | set_page_attr(bitmap, bitmap->filemap[i], | 1111 | set_page_attr(bitmap, bitmap->filemap[i], |
1111 | BITMAP_PAGE_NEEDWRITE); | 1112 | BITMAP_PAGE_NEEDWRITE); |
1112 | bitmap->allclean = 0; | 1113 | bitmap->allclean = 0; |
1114 | spin_unlock_irq(&bitmap->lock); | ||
1113 | } | 1115 | } |
1114 | 1116 | ||
1115 | static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc) | 1117 | static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc) |
@@ -1605,7 +1607,9 @@ void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e) | |||
1605 | for (chunk = s; chunk <= e; chunk++) { | 1607 | for (chunk = s; chunk <= e; chunk++) { |
1606 | sector_t sec = (sector_t)chunk << CHUNK_BLOCK_SHIFT(bitmap); | 1608 | sector_t sec = (sector_t)chunk << CHUNK_BLOCK_SHIFT(bitmap); |
1607 | bitmap_set_memory_bits(bitmap, sec, 1); | 1609 | bitmap_set_memory_bits(bitmap, sec, 1); |
1610 | spin_lock_irq(&bitmap->lock); | ||
1608 | bitmap_file_set_bit(bitmap, sec); | 1611 | bitmap_file_set_bit(bitmap, sec); |
1612 | spin_unlock_irq(&bitmap->lock); | ||
1609 | if (sec < bitmap->mddev->recovery_cp) | 1613 | if (sec < bitmap->mddev->recovery_cp) |
1610 | /* We are asserting that the array is dirty, | 1614 | /* We are asserting that the array is dirty, |
1611 | * so move the recovery_cp address back so | 1615 | * so move the recovery_cp address back so |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 84acfe7d10e4..ee981737edfc 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -570,7 +570,7 @@ static void mddev_put(struct mddev *mddev) | |||
570 | mddev->ctime == 0 && !mddev->hold_active) { | 570 | mddev->ctime == 0 && !mddev->hold_active) { |
571 | /* Array is not configured at all, and not held active, | 571 | /* Array is not configured at all, and not held active, |
572 | * so destroy it */ | 572 | * so destroy it */ |
573 | list_del(&mddev->all_mddevs); | 573 | list_del_init(&mddev->all_mddevs); |
574 | bs = mddev->bio_set; | 574 | bs = mddev->bio_set; |
575 | mddev->bio_set = NULL; | 575 | mddev->bio_set = NULL; |
576 | if (mddev->gendisk) { | 576 | if (mddev->gendisk) { |
@@ -2546,7 +2546,8 @@ state_show(struct md_rdev *rdev, char *page) | |||
2546 | sep = ","; | 2546 | sep = ","; |
2547 | } | 2547 | } |
2548 | if (test_bit(Blocked, &rdev->flags) || | 2548 | if (test_bit(Blocked, &rdev->flags) || |
2549 | rdev->badblocks.unacked_exist) { | 2549 | (rdev->badblocks.unacked_exist |
2550 | && !test_bit(Faulty, &rdev->flags))) { | ||
2550 | len += sprintf(page+len, "%sblocked", sep); | 2551 | len += sprintf(page+len, "%sblocked", sep); |
2551 | sep = ","; | 2552 | sep = ","; |
2552 | } | 2553 | } |
@@ -3788,6 +3789,8 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len) | |||
3788 | if (err) | 3789 | if (err) |
3789 | return err; | 3790 | return err; |
3790 | else { | 3791 | else { |
3792 | if (mddev->hold_active == UNTIL_IOCTL) | ||
3793 | mddev->hold_active = 0; | ||
3791 | sysfs_notify_dirent_safe(mddev->sysfs_state); | 3794 | sysfs_notify_dirent_safe(mddev->sysfs_state); |
3792 | return len; | 3795 | return len; |
3793 | } | 3796 | } |
@@ -4487,11 +4490,20 @@ md_attr_show(struct kobject *kobj, struct attribute *attr, char *page) | |||
4487 | 4490 | ||
4488 | if (!entry->show) | 4491 | if (!entry->show) |
4489 | return -EIO; | 4492 | return -EIO; |
4493 | spin_lock(&all_mddevs_lock); | ||
4494 | if (list_empty(&mddev->all_mddevs)) { | ||
4495 | spin_unlock(&all_mddevs_lock); | ||
4496 | return -EBUSY; | ||
4497 | } | ||
4498 | mddev_get(mddev); | ||
4499 | spin_unlock(&all_mddevs_lock); | ||
4500 | |||
4490 | rv = mddev_lock(mddev); | 4501 | rv = mddev_lock(mddev); |
4491 | if (!rv) { | 4502 | if (!rv) { |
4492 | rv = entry->show(mddev, page); | 4503 | rv = entry->show(mddev, page); |
4493 | mddev_unlock(mddev); | 4504 | mddev_unlock(mddev); |
4494 | } | 4505 | } |
4506 | mddev_put(mddev); | ||
4495 | return rv; | 4507 | return rv; |
4496 | } | 4508 | } |
4497 | 4509 | ||
@@ -4507,13 +4519,19 @@ md_attr_store(struct kobject *kobj, struct attribute *attr, | |||
4507 | return -EIO; | 4519 | return -EIO; |
4508 | if (!capable(CAP_SYS_ADMIN)) | 4520 | if (!capable(CAP_SYS_ADMIN)) |
4509 | return -EACCES; | 4521 | return -EACCES; |
4522 | spin_lock(&all_mddevs_lock); | ||
4523 | if (list_empty(&mddev->all_mddevs)) { | ||
4524 | spin_unlock(&all_mddevs_lock); | ||
4525 | return -EBUSY; | ||
4526 | } | ||
4527 | mddev_get(mddev); | ||
4528 | spin_unlock(&all_mddevs_lock); | ||
4510 | rv = mddev_lock(mddev); | 4529 | rv = mddev_lock(mddev); |
4511 | if (mddev->hold_active == UNTIL_IOCTL) | ||
4512 | mddev->hold_active = 0; | ||
4513 | if (!rv) { | 4530 | if (!rv) { |
4514 | rv = entry->store(mddev, page, length); | 4531 | rv = entry->store(mddev, page, length); |
4515 | mddev_unlock(mddev); | 4532 | mddev_unlock(mddev); |
4516 | } | 4533 | } |
4534 | mddev_put(mddev); | ||
4517 | return rv; | 4535 | return rv; |
4518 | } | 4536 | } |
4519 | 4537 | ||
@@ -7840,6 +7858,7 @@ int rdev_set_badblocks(struct md_rdev *rdev, sector_t s, int sectors, | |||
7840 | s + rdev->data_offset, sectors, acknowledged); | 7858 | s + rdev->data_offset, sectors, acknowledged); |
7841 | if (rv) { | 7859 | if (rv) { |
7842 | /* Make sure they get written out promptly */ | 7860 | /* Make sure they get written out promptly */ |
7861 | sysfs_notify_dirent_safe(rdev->sysfs_state); | ||
7843 | set_bit(MD_CHANGE_CLEAN, &rdev->mddev->flags); | 7862 | set_bit(MD_CHANGE_CLEAN, &rdev->mddev->flags); |
7844 | md_wakeup_thread(rdev->mddev->thread); | 7863 | md_wakeup_thread(rdev->mddev->thread); |
7845 | } | 7864 | } |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 297e26092178..31670f8d6b65 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3036,6 +3036,8 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
3036 | if (dev->written) | 3036 | if (dev->written) |
3037 | s->written++; | 3037 | s->written++; |
3038 | rdev = rcu_dereference(conf->disks[i].rdev); | 3038 | rdev = rcu_dereference(conf->disks[i].rdev); |
3039 | if (rdev && test_bit(Faulty, &rdev->flags)) | ||
3040 | rdev = NULL; | ||
3039 | if (rdev) { | 3041 | if (rdev) { |
3040 | is_bad = is_badblock(rdev, sh->sector, STRIPE_SECTORS, | 3042 | is_bad = is_badblock(rdev, sh->sector, STRIPE_SECTORS, |
3041 | &first_bad, &bad_sectors); | 3043 | &first_bad, &bad_sectors); |
@@ -3063,12 +3065,12 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
3063 | } | 3065 | } |
3064 | } else if (test_bit(In_sync, &rdev->flags)) | 3066 | } else if (test_bit(In_sync, &rdev->flags)) |
3065 | set_bit(R5_Insync, &dev->flags); | 3067 | set_bit(R5_Insync, &dev->flags); |
3066 | else if (!test_bit(Faulty, &rdev->flags)) { | 3068 | else { |
3067 | /* in sync if before recovery_offset */ | 3069 | /* in sync if before recovery_offset */ |
3068 | if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) | 3070 | if (sh->sector + STRIPE_SECTORS <= rdev->recovery_offset) |
3069 | set_bit(R5_Insync, &dev->flags); | 3071 | set_bit(R5_Insync, &dev->flags); |
3070 | } | 3072 | } |
3071 | if (test_bit(R5_WriteError, &dev->flags)) { | 3073 | if (rdev && test_bit(R5_WriteError, &dev->flags)) { |
3072 | clear_bit(R5_Insync, &dev->flags); | 3074 | clear_bit(R5_Insync, &dev->flags); |
3073 | if (!test_bit(Faulty, &rdev->flags)) { | 3075 | if (!test_bit(Faulty, &rdev->flags)) { |
3074 | s->handle_bad_blocks = 1; | 3076 | s->handle_bad_blocks = 1; |
@@ -3076,7 +3078,7 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
3076 | } else | 3078 | } else |
3077 | clear_bit(R5_WriteError, &dev->flags); | 3079 | clear_bit(R5_WriteError, &dev->flags); |
3078 | } | 3080 | } |
3079 | if (test_bit(R5_MadeGood, &dev->flags)) { | 3081 | if (rdev && test_bit(R5_MadeGood, &dev->flags)) { |
3080 | if (!test_bit(Faulty, &rdev->flags)) { | 3082 | if (!test_bit(Faulty, &rdev->flags)) { |
3081 | s->handle_bad_blocks = 1; | 3083 | s->handle_bad_blocks = 1; |
3082 | atomic_inc(&rdev->nr_pending); | 3084 | atomic_inc(&rdev->nr_pending); |
diff --git a/drivers/media/video/davinci/vpif.h b/drivers/media/video/davinci/vpif.h index 10550bd93b06..25036cb11bea 100644 --- a/drivers/media/video/davinci/vpif.h +++ b/drivers/media/video/davinci/vpif.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/videodev2.h> | 20 | #include <linux/videodev2.h> |
21 | #include <mach/hardware.h> | 21 | #include <mach/hardware.h> |
22 | #include <mach/dm646x.h> | 22 | #include <mach/dm646x.h> |
23 | #include <media/davinci/vpif_types.h> | ||
23 | 24 | ||
24 | /* Maximum channel allowed */ | 25 | /* Maximum channel allowed */ |
25 | #define VPIF_NUM_CHANNELS (4) | 26 | #define VPIF_NUM_CHANNELS (4) |
diff --git a/drivers/media/video/davinci/vpif_capture.h b/drivers/media/video/davinci/vpif_capture.h index 064550f5ce4a..a693d4ebda55 100644 --- a/drivers/media/video/davinci/vpif_capture.h +++ b/drivers/media/video/davinci/vpif_capture.h | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <media/v4l2-device.h> | 27 | #include <media/v4l2-device.h> |
28 | #include <media/videobuf-core.h> | 28 | #include <media/videobuf-core.h> |
29 | #include <media/videobuf-dma-contig.h> | 29 | #include <media/videobuf-dma-contig.h> |
30 | #include <mach/dm646x.h> | 30 | #include <media/davinci/vpif_types.h> |
31 | 31 | ||
32 | #include "vpif.h" | 32 | #include "vpif.h" |
33 | 33 | ||
diff --git a/drivers/media/video/davinci/vpif_display.h b/drivers/media/video/davinci/vpif_display.h index 5d1936dafed2..56879d1a0684 100644 --- a/drivers/media/video/davinci/vpif_display.h +++ b/drivers/media/video/davinci/vpif_display.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <media/v4l2-device.h> | 22 | #include <media/v4l2-device.h> |
23 | #include <media/videobuf-core.h> | 23 | #include <media/videobuf-core.h> |
24 | #include <media/videobuf-dma-contig.h> | 24 | #include <media/videobuf-dma-contig.h> |
25 | #include <media/davinci/vpif_types.h> | ||
25 | 26 | ||
26 | #include "vpif.h" | 27 | #include "vpif.h" |
27 | 28 | ||
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index a8b4d2aa18e5..f437c3e6f3aa 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
@@ -741,7 +741,7 @@ static void at91_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
741 | at91_mci_write(host, AT91_MCI_MR, (at91_mci_read(host, AT91_MCI_MR) & ~AT91_MCI_CLKDIV) | clkdiv); | 741 | at91_mci_write(host, AT91_MCI_MR, (at91_mci_read(host, AT91_MCI_MR) & ~AT91_MCI_CLKDIV) | clkdiv); |
742 | 742 | ||
743 | /* maybe switch power to the card */ | 743 | /* maybe switch power to the card */ |
744 | if (host->board->vcc_pin) { | 744 | if (gpio_is_valid(host->board->vcc_pin)) { |
745 | switch (ios->power_mode) { | 745 | switch (ios->power_mode) { |
746 | case MMC_POWER_OFF: | 746 | case MMC_POWER_OFF: |
747 | gpio_set_value(host->board->vcc_pin, 0); | 747 | gpio_set_value(host->board->vcc_pin, 0); |
@@ -897,7 +897,7 @@ static int at91_mci_get_ro(struct mmc_host *mmc) | |||
897 | { | 897 | { |
898 | struct at91mci_host *host = mmc_priv(mmc); | 898 | struct at91mci_host *host = mmc_priv(mmc); |
899 | 899 | ||
900 | if (host->board->wp_pin) | 900 | if (gpio_is_valid(host->board->wp_pin)) |
901 | return !!gpio_get_value(host->board->wp_pin); | 901 | return !!gpio_get_value(host->board->wp_pin); |
902 | /* | 902 | /* |
903 | * Board doesn't support read only detection; let the mmc core | 903 | * Board doesn't support read only detection; let the mmc core |
@@ -991,21 +991,21 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
991 | * Reserve GPIOs ... board init code makes sure these pins are set | 991 | * Reserve GPIOs ... board init code makes sure these pins are set |
992 | * up as GPIOs with the right direction (input, except for vcc) | 992 | * up as GPIOs with the right direction (input, except for vcc) |
993 | */ | 993 | */ |
994 | if (host->board->det_pin) { | 994 | if (gpio_is_valid(host->board->det_pin)) { |
995 | ret = gpio_request(host->board->det_pin, "mmc_detect"); | 995 | ret = gpio_request(host->board->det_pin, "mmc_detect"); |
996 | if (ret < 0) { | 996 | if (ret < 0) { |
997 | dev_dbg(&pdev->dev, "couldn't claim card detect pin\n"); | 997 | dev_dbg(&pdev->dev, "couldn't claim card detect pin\n"); |
998 | goto fail4b; | 998 | goto fail4b; |
999 | } | 999 | } |
1000 | } | 1000 | } |
1001 | if (host->board->wp_pin) { | 1001 | if (gpio_is_valid(host->board->wp_pin)) { |
1002 | ret = gpio_request(host->board->wp_pin, "mmc_wp"); | 1002 | ret = gpio_request(host->board->wp_pin, "mmc_wp"); |
1003 | if (ret < 0) { | 1003 | if (ret < 0) { |
1004 | dev_dbg(&pdev->dev, "couldn't claim wp sense pin\n"); | 1004 | dev_dbg(&pdev->dev, "couldn't claim wp sense pin\n"); |
1005 | goto fail4; | 1005 | goto fail4; |
1006 | } | 1006 | } |
1007 | } | 1007 | } |
1008 | if (host->board->vcc_pin) { | 1008 | if (gpio_is_valid(host->board->vcc_pin)) { |
1009 | ret = gpio_request(host->board->vcc_pin, "mmc_vcc"); | 1009 | ret = gpio_request(host->board->vcc_pin, "mmc_vcc"); |
1010 | if (ret < 0) { | 1010 | if (ret < 0) { |
1011 | dev_dbg(&pdev->dev, "couldn't claim vcc switch pin\n"); | 1011 | dev_dbg(&pdev->dev, "couldn't claim vcc switch pin\n"); |
@@ -1057,7 +1057,7 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
1057 | /* | 1057 | /* |
1058 | * Add host to MMC layer | 1058 | * Add host to MMC layer |
1059 | */ | 1059 | */ |
1060 | if (host->board->det_pin) { | 1060 | if (gpio_is_valid(host->board->det_pin)) { |
1061 | host->present = !gpio_get_value(host->board->det_pin); | 1061 | host->present = !gpio_get_value(host->board->det_pin); |
1062 | } | 1062 | } |
1063 | else | 1063 | else |
@@ -1068,7 +1068,7 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
1068 | /* | 1068 | /* |
1069 | * monitor card insertion/removal if we can | 1069 | * monitor card insertion/removal if we can |
1070 | */ | 1070 | */ |
1071 | if (host->board->det_pin) { | 1071 | if (gpio_is_valid(host->board->det_pin)) { |
1072 | ret = request_irq(gpio_to_irq(host->board->det_pin), | 1072 | ret = request_irq(gpio_to_irq(host->board->det_pin), |
1073 | at91_mmc_det_irq, 0, mmc_hostname(mmc), host); | 1073 | at91_mmc_det_irq, 0, mmc_hostname(mmc), host); |
1074 | if (ret) | 1074 | if (ret) |
@@ -1087,13 +1087,13 @@ fail0: | |||
1087 | fail1: | 1087 | fail1: |
1088 | clk_put(host->mci_clk); | 1088 | clk_put(host->mci_clk); |
1089 | fail2: | 1089 | fail2: |
1090 | if (host->board->vcc_pin) | 1090 | if (gpio_is_valid(host->board->vcc_pin)) |
1091 | gpio_free(host->board->vcc_pin); | 1091 | gpio_free(host->board->vcc_pin); |
1092 | fail3: | 1092 | fail3: |
1093 | if (host->board->wp_pin) | 1093 | if (gpio_is_valid(host->board->wp_pin)) |
1094 | gpio_free(host->board->wp_pin); | 1094 | gpio_free(host->board->wp_pin); |
1095 | fail4: | 1095 | fail4: |
1096 | if (host->board->det_pin) | 1096 | if (gpio_is_valid(host->board->det_pin)) |
1097 | gpio_free(host->board->det_pin); | 1097 | gpio_free(host->board->det_pin); |
1098 | fail4b: | 1098 | fail4b: |
1099 | if (host->buffer) | 1099 | if (host->buffer) |
@@ -1125,7 +1125,7 @@ static int __exit at91_mci_remove(struct platform_device *pdev) | |||
1125 | dma_free_coherent(&pdev->dev, MCI_BUFSIZE, | 1125 | dma_free_coherent(&pdev->dev, MCI_BUFSIZE, |
1126 | host->buffer, host->physical_address); | 1126 | host->buffer, host->physical_address); |
1127 | 1127 | ||
1128 | if (host->board->det_pin) { | 1128 | if (gpio_is_valid(host->board->det_pin)) { |
1129 | if (device_can_wakeup(&pdev->dev)) | 1129 | if (device_can_wakeup(&pdev->dev)) |
1130 | free_irq(gpio_to_irq(host->board->det_pin), host); | 1130 | free_irq(gpio_to_irq(host->board->det_pin), host); |
1131 | device_init_wakeup(&pdev->dev, 0); | 1131 | device_init_wakeup(&pdev->dev, 0); |
@@ -1140,9 +1140,9 @@ static int __exit at91_mci_remove(struct platform_device *pdev) | |||
1140 | clk_disable(host->mci_clk); /* Disable the peripheral clock */ | 1140 | clk_disable(host->mci_clk); /* Disable the peripheral clock */ |
1141 | clk_put(host->mci_clk); | 1141 | clk_put(host->mci_clk); |
1142 | 1142 | ||
1143 | if (host->board->vcc_pin) | 1143 | if (gpio_is_valid(host->board->vcc_pin)) |
1144 | gpio_free(host->board->vcc_pin); | 1144 | gpio_free(host->board->vcc_pin); |
1145 | if (host->board->wp_pin) | 1145 | if (gpio_is_valid(host->board->wp_pin)) |
1146 | gpio_free(host->board->wp_pin); | 1146 | gpio_free(host->board->wp_pin); |
1147 | 1147 | ||
1148 | iounmap(host->baseaddr); | 1148 | iounmap(host->baseaddr); |
@@ -1163,7 +1163,7 @@ static int at91_mci_suspend(struct platform_device *pdev, pm_message_t state) | |||
1163 | struct at91mci_host *host = mmc_priv(mmc); | 1163 | struct at91mci_host *host = mmc_priv(mmc); |
1164 | int ret = 0; | 1164 | int ret = 0; |
1165 | 1165 | ||
1166 | if (host->board->det_pin && device_may_wakeup(&pdev->dev)) | 1166 | if (gpio_is_valid(host->board->det_pin) && device_may_wakeup(&pdev->dev)) |
1167 | enable_irq_wake(host->board->det_pin); | 1167 | enable_irq_wake(host->board->det_pin); |
1168 | 1168 | ||
1169 | if (mmc) | 1169 | if (mmc) |
@@ -1178,7 +1178,7 @@ static int at91_mci_resume(struct platform_device *pdev) | |||
1178 | struct at91mci_host *host = mmc_priv(mmc); | 1178 | struct at91mci_host *host = mmc_priv(mmc); |
1179 | int ret = 0; | 1179 | int ret = 0; |
1180 | 1180 | ||
1181 | if (host->board->det_pin && device_may_wakeup(&pdev->dev)) | 1181 | if (gpio_is_valid(host->board->det_pin) && device_may_wakeup(&pdev->dev)) |
1182 | disable_irq_wake(host->board->det_pin); | 1182 | disable_irq_wake(host->board->det_pin); |
1183 | 1183 | ||
1184 | if (mmc) | 1184 | if (mmc) |
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 23e5d77c39fc..4dd056e2e16a 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c | |||
@@ -113,7 +113,7 @@ static int cpu_has_dma(void) | |||
113 | */ | 113 | */ |
114 | static void atmel_nand_enable(struct atmel_nand_host *host) | 114 | static void atmel_nand_enable(struct atmel_nand_host *host) |
115 | { | 115 | { |
116 | if (host->board->enable_pin) | 116 | if (gpio_is_valid(host->board->enable_pin)) |
117 | gpio_set_value(host->board->enable_pin, 0); | 117 | gpio_set_value(host->board->enable_pin, 0); |
118 | } | 118 | } |
119 | 119 | ||
@@ -122,7 +122,7 @@ static void atmel_nand_enable(struct atmel_nand_host *host) | |||
122 | */ | 122 | */ |
123 | static void atmel_nand_disable(struct atmel_nand_host *host) | 123 | static void atmel_nand_disable(struct atmel_nand_host *host) |
124 | { | 124 | { |
125 | if (host->board->enable_pin) | 125 | if (gpio_is_valid(host->board->enable_pin)) |
126 | gpio_set_value(host->board->enable_pin, 1); | 126 | gpio_set_value(host->board->enable_pin, 1); |
127 | } | 127 | } |
128 | 128 | ||
@@ -492,7 +492,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
492 | nand_chip->IO_ADDR_W = host->io_base; | 492 | nand_chip->IO_ADDR_W = host->io_base; |
493 | nand_chip->cmd_ctrl = atmel_nand_cmd_ctrl; | 493 | nand_chip->cmd_ctrl = atmel_nand_cmd_ctrl; |
494 | 494 | ||
495 | if (host->board->rdy_pin) | 495 | if (gpio_is_valid(host->board->rdy_pin)) |
496 | nand_chip->dev_ready = atmel_nand_device_ready; | 496 | nand_chip->dev_ready = atmel_nand_device_ready; |
497 | 497 | ||
498 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 498 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
@@ -530,7 +530,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
530 | platform_set_drvdata(pdev, host); | 530 | platform_set_drvdata(pdev, host); |
531 | atmel_nand_enable(host); | 531 | atmel_nand_enable(host); |
532 | 532 | ||
533 | if (host->board->det_pin) { | 533 | if (gpio_is_valid(host->board->det_pin)) { |
534 | if (gpio_get_value(host->board->det_pin)) { | 534 | if (gpio_get_value(host->board->det_pin)) { |
535 | printk(KERN_INFO "No SmartMedia card inserted.\n"); | 535 | printk(KERN_INFO "No SmartMedia card inserted.\n"); |
536 | res = -ENXIO; | 536 | res = -ENXIO; |
diff --git a/drivers/net/arcnet/Kconfig b/drivers/net/arcnet/Kconfig index a73d9dc80ff6..84fb6349a59a 100644 --- a/drivers/net/arcnet/Kconfig +++ b/drivers/net/arcnet/Kconfig | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | menuconfig ARCNET | 5 | menuconfig ARCNET |
6 | depends on NETDEVICES && (ISA || PCI || PCMCIA) | 6 | depends on NETDEVICES && (ISA || PCI || PCMCIA) |
7 | bool "ARCnet support" | 7 | tristate "ARCnet support" |
8 | ---help--- | 8 | ---help--- |
9 | If you have a network card of this type, say Y and check out the | 9 | If you have a network card of this type, say Y and check out the |
10 | (arguably) beautiful poetry in | 10 | (arguably) beautiful poetry in |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index b0c577256487..7f8756825b8a 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2553,30 +2553,6 @@ re_arm: | |||
2553 | } | 2553 | } |
2554 | } | 2554 | } |
2555 | 2555 | ||
2556 | static __be32 bond_glean_dev_ip(struct net_device *dev) | ||
2557 | { | ||
2558 | struct in_device *idev; | ||
2559 | struct in_ifaddr *ifa; | ||
2560 | __be32 addr = 0; | ||
2561 | |||
2562 | if (!dev) | ||
2563 | return 0; | ||
2564 | |||
2565 | rcu_read_lock(); | ||
2566 | idev = __in_dev_get_rcu(dev); | ||
2567 | if (!idev) | ||
2568 | goto out; | ||
2569 | |||
2570 | ifa = idev->ifa_list; | ||
2571 | if (!ifa) | ||
2572 | goto out; | ||
2573 | |||
2574 | addr = ifa->ifa_local; | ||
2575 | out: | ||
2576 | rcu_read_unlock(); | ||
2577 | return addr; | ||
2578 | } | ||
2579 | |||
2580 | static int bond_has_this_ip(struct bonding *bond, __be32 ip) | 2556 | static int bond_has_this_ip(struct bonding *bond, __be32 ip) |
2581 | { | 2557 | { |
2582 | struct vlan_entry *vlan; | 2558 | struct vlan_entry *vlan; |
@@ -3322,6 +3298,10 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
3322 | struct bonding *bond; | 3298 | struct bonding *bond; |
3323 | struct vlan_entry *vlan; | 3299 | struct vlan_entry *vlan; |
3324 | 3300 | ||
3301 | /* we only care about primary address */ | ||
3302 | if(ifa->ifa_flags & IFA_F_SECONDARY) | ||
3303 | return NOTIFY_DONE; | ||
3304 | |||
3325 | list_for_each_entry(bond, &bn->dev_list, bond_list) { | 3305 | list_for_each_entry(bond, &bn->dev_list, bond_list) { |
3326 | if (bond->dev == event_dev) { | 3306 | if (bond->dev == event_dev) { |
3327 | switch (event) { | 3307 | switch (event) { |
@@ -3329,7 +3309,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
3329 | bond->master_ip = ifa->ifa_local; | 3309 | bond->master_ip = ifa->ifa_local; |
3330 | return NOTIFY_OK; | 3310 | return NOTIFY_OK; |
3331 | case NETDEV_DOWN: | 3311 | case NETDEV_DOWN: |
3332 | bond->master_ip = bond_glean_dev_ip(bond->dev); | 3312 | bond->master_ip = 0; |
3333 | return NOTIFY_OK; | 3313 | return NOTIFY_OK; |
3334 | default: | 3314 | default: |
3335 | return NOTIFY_DONE; | 3315 | return NOTIFY_DONE; |
@@ -3345,8 +3325,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
3345 | vlan->vlan_ip = ifa->ifa_local; | 3325 | vlan->vlan_ip = ifa->ifa_local; |
3346 | return NOTIFY_OK; | 3326 | return NOTIFY_OK; |
3347 | case NETDEV_DOWN: | 3327 | case NETDEV_DOWN: |
3348 | vlan->vlan_ip = | 3328 | vlan->vlan_ip = 0; |
3349 | bond_glean_dev_ip(vlan_dev); | ||
3350 | return NOTIFY_OK; | 3329 | return NOTIFY_OK; |
3351 | default: | 3330 | default: |
3352 | return NOTIFY_DONE; | 3331 | return NOTIFY_DONE; |
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c index 905bce0b3a43..2c7f5036f570 100644 --- a/drivers/net/can/sja1000/peak_pci.c +++ b/drivers/net/can/sja1000/peak_pci.c | |||
@@ -20,7 +20,6 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
23 | #include <linux/version.h> | ||
24 | #include <linux/module.h> | 23 | #include <linux/module.h> |
25 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
26 | #include <linux/netdevice.h> | 25 | #include <linux/netdevice.h> |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 4cf835dbc122..3fb66d09ece5 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
@@ -608,7 +608,7 @@ static void b44_tx(struct b44 *bp) | |||
608 | skb->len, | 608 | skb->len, |
609 | DMA_TO_DEVICE); | 609 | DMA_TO_DEVICE); |
610 | rp->skb = NULL; | 610 | rp->skb = NULL; |
611 | dev_kfree_skb(skb); | 611 | dev_kfree_skb_irq(skb); |
612 | } | 612 | } |
613 | 613 | ||
614 | bp->tx_cons = cons; | 614 | bp->tx_cons = cons; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index bce203fa4b9e..882f48f0a03c 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -10327,6 +10327,43 @@ static int bnx2x_54618se_config_init(struct bnx2x_phy *phy, | |||
10327 | return 0; | 10327 | return 0; |
10328 | } | 10328 | } |
10329 | 10329 | ||
10330 | |||
10331 | static void bnx2x_5461x_set_link_led(struct bnx2x_phy *phy, | ||
10332 | struct link_params *params, u8 mode) | ||
10333 | { | ||
10334 | struct bnx2x *bp = params->bp; | ||
10335 | u16 temp; | ||
10336 | |||
10337 | bnx2x_cl22_write(bp, phy, | ||
10338 | MDIO_REG_GPHY_SHADOW, | ||
10339 | MDIO_REG_GPHY_SHADOW_LED_SEL1); | ||
10340 | bnx2x_cl22_read(bp, phy, | ||
10341 | MDIO_REG_GPHY_SHADOW, | ||
10342 | &temp); | ||
10343 | temp &= 0xff00; | ||
10344 | |||
10345 | DP(NETIF_MSG_LINK, "54618x set link led (mode=%x)\n", mode); | ||
10346 | switch (mode) { | ||
10347 | case LED_MODE_FRONT_PANEL_OFF: | ||
10348 | case LED_MODE_OFF: | ||
10349 | temp |= 0x00ee; | ||
10350 | break; | ||
10351 | case LED_MODE_OPER: | ||
10352 | temp |= 0x0001; | ||
10353 | break; | ||
10354 | case LED_MODE_ON: | ||
10355 | temp |= 0x00ff; | ||
10356 | break; | ||
10357 | default: | ||
10358 | break; | ||
10359 | } | ||
10360 | bnx2x_cl22_write(bp, phy, | ||
10361 | MDIO_REG_GPHY_SHADOW, | ||
10362 | MDIO_REG_GPHY_SHADOW_WR_ENA | temp); | ||
10363 | return; | ||
10364 | } | ||
10365 | |||
10366 | |||
10330 | static void bnx2x_54618se_link_reset(struct bnx2x_phy *phy, | 10367 | static void bnx2x_54618se_link_reset(struct bnx2x_phy *phy, |
10331 | struct link_params *params) | 10368 | struct link_params *params) |
10332 | { | 10369 | { |
@@ -11103,7 +11140,7 @@ static struct bnx2x_phy phy_54618se = { | |||
11103 | .config_loopback = (config_loopback_t)bnx2x_54618se_config_loopback, | 11140 | .config_loopback = (config_loopback_t)bnx2x_54618se_config_loopback, |
11104 | .format_fw_ver = (format_fw_ver_t)NULL, | 11141 | .format_fw_ver = (format_fw_ver_t)NULL, |
11105 | .hw_reset = (hw_reset_t)NULL, | 11142 | .hw_reset = (hw_reset_t)NULL, |
11106 | .set_link_led = (set_link_led_t)NULL, | 11143 | .set_link_led = (set_link_led_t)bnx2x_5461x_set_link_led, |
11107 | .phy_specific_func = (phy_specific_func_t)NULL | 11144 | .phy_specific_func = (phy_specific_func_t)NULL |
11108 | }; | 11145 | }; |
11109 | /*****************************************************************/ | 11146 | /*****************************************************************/ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h index fc7bd0f23c0b..e58073ef33b4 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h | |||
@@ -6990,6 +6990,7 @@ Theotherbitsarereservedandshouldbezero*/ | |||
6990 | #define MDIO_REG_INTR_MASK 0x1b | 6990 | #define MDIO_REG_INTR_MASK 0x1b |
6991 | #define MDIO_REG_INTR_MASK_LINK_STATUS (0x1 << 1) | 6991 | #define MDIO_REG_INTR_MASK_LINK_STATUS (0x1 << 1) |
6992 | #define MDIO_REG_GPHY_SHADOW 0x1c | 6992 | #define MDIO_REG_GPHY_SHADOW 0x1c |
6993 | #define MDIO_REG_GPHY_SHADOW_LED_SEL1 (0x0d << 10) | ||
6993 | #define MDIO_REG_GPHY_SHADOW_LED_SEL2 (0x0e << 10) | 6994 | #define MDIO_REG_GPHY_SHADOW_LED_SEL2 (0x0e << 10) |
6994 | #define MDIO_REG_GPHY_SHADOW_WR_ENA (0x1 << 15) | 6995 | #define MDIO_REG_GPHY_SHADOW_WR_ENA (0x1 << 15) |
6995 | #define MDIO_REG_GPHY_SHADOW_AUTO_DET_MED (0x1e << 10) | 6996 | #define MDIO_REG_GPHY_SHADOW_AUTO_DET_MED (0x1e << 10) |
diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c index 56624d303487..dfeb46cb3f74 100644 --- a/drivers/net/ethernet/cadence/at91_ether.c +++ b/drivers/net/ethernet/cadence/at91_ether.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/skbuff.h> | 26 | #include <linux/skbuff.h> |
27 | #include <linux/dma-mapping.h> | 27 | #include <linux/dma-mapping.h> |
28 | #include <linux/ethtool.h> | 28 | #include <linux/ethtool.h> |
29 | #include <linux/platform_data/macb.h> | ||
29 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
30 | #include <linux/clk.h> | 31 | #include <linux/clk.h> |
31 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
@@ -984,7 +985,7 @@ static const struct net_device_ops at91ether_netdev_ops = { | |||
984 | static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address, | 985 | static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address, |
985 | struct platform_device *pdev, struct clk *ether_clk) | 986 | struct platform_device *pdev, struct clk *ether_clk) |
986 | { | 987 | { |
987 | struct at91_eth_data *board_data = pdev->dev.platform_data; | 988 | struct macb_platform_data *board_data = pdev->dev.platform_data; |
988 | struct net_device *dev; | 989 | struct net_device *dev; |
989 | struct at91_private *lp; | 990 | struct at91_private *lp; |
990 | unsigned int val; | 991 | unsigned int val; |
diff --git a/drivers/net/ethernet/cadence/at91_ether.h b/drivers/net/ethernet/cadence/at91_ether.h index 353f4dab62be..3725fbb0defe 100644 --- a/drivers/net/ethernet/cadence/at91_ether.h +++ b/drivers/net/ethernet/cadence/at91_ether.h | |||
@@ -85,7 +85,9 @@ struct recv_desc_bufs | |||
85 | struct at91_private | 85 | struct at91_private |
86 | { | 86 | { |
87 | struct mii_if_info mii; /* ethtool support */ | 87 | struct mii_if_info mii; /* ethtool support */ |
88 | struct at91_eth_data board_data; /* board-specific configuration */ | 88 | struct macb_platform_data board_data; /* board-specific |
89 | * configuration (shared with | ||
90 | * macb for common data */ | ||
89 | struct clk *ether_clk; /* clock */ | 91 | struct clk *ether_clk; /* clock */ |
90 | 92 | ||
91 | /* PHY */ | 93 | /* PHY */ |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index a437b46e5490..aa1d597091a8 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
11 | #include <linux/clk.h> | 12 | #include <linux/clk.h> |
12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
13 | #include <linux/moduleparam.h> | 14 | #include <linux/moduleparam.h> |
@@ -19,12 +20,10 @@ | |||
19 | #include <linux/netdevice.h> | 20 | #include <linux/netdevice.h> |
20 | #include <linux/etherdevice.h> | 21 | #include <linux/etherdevice.h> |
21 | #include <linux/dma-mapping.h> | 22 | #include <linux/dma-mapping.h> |
23 | #include <linux/platform_data/macb.h> | ||
22 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
23 | #include <linux/phy.h> | 25 | #include <linux/phy.h> |
24 | 26 | ||
25 | #include <mach/board.h> | ||
26 | #include <mach/cpu.h> | ||
27 | |||
28 | #include "macb.h" | 27 | #include "macb.h" |
29 | 28 | ||
30 | #define RX_BUFFER_SIZE 128 | 29 | #define RX_BUFFER_SIZE 128 |
@@ -84,7 +83,7 @@ static void __init macb_get_hwaddr(struct macb *bp) | |||
84 | if (is_valid_ether_addr(addr)) { | 83 | if (is_valid_ether_addr(addr)) { |
85 | memcpy(bp->dev->dev_addr, addr, sizeof(addr)); | 84 | memcpy(bp->dev->dev_addr, addr, sizeof(addr)); |
86 | } else { | 85 | } else { |
87 | dev_info(&bp->pdev->dev, "invalid hw address, using random\n"); | 86 | netdev_info(bp->dev, "invalid hw address, using random\n"); |
88 | random_ether_addr(bp->dev->dev_addr); | 87 | random_ether_addr(bp->dev->dev_addr); |
89 | } | 88 | } |
90 | } | 89 | } |
@@ -178,11 +177,12 @@ static void macb_handle_link_change(struct net_device *dev) | |||
178 | 177 | ||
179 | if (status_change) { | 178 | if (status_change) { |
180 | if (phydev->link) | 179 | if (phydev->link) |
181 | printk(KERN_INFO "%s: link up (%d/%s)\n", | 180 | netdev_info(dev, "link up (%d/%s)\n", |
182 | dev->name, phydev->speed, | 181 | phydev->speed, |
183 | DUPLEX_FULL == phydev->duplex ? "Full":"Half"); | 182 | phydev->duplex == DUPLEX_FULL ? |
183 | "Full" : "Half"); | ||
184 | else | 184 | else |
185 | printk(KERN_INFO "%s: link down\n", dev->name); | 185 | netdev_info(dev, "link down\n"); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
@@ -191,12 +191,12 @@ static int macb_mii_probe(struct net_device *dev) | |||
191 | { | 191 | { |
192 | struct macb *bp = netdev_priv(dev); | 192 | struct macb *bp = netdev_priv(dev); |
193 | struct phy_device *phydev; | 193 | struct phy_device *phydev; |
194 | struct eth_platform_data *pdata; | 194 | struct macb_platform_data *pdata; |
195 | int ret; | 195 | int ret; |
196 | 196 | ||
197 | phydev = phy_find_first(bp->mii_bus); | 197 | phydev = phy_find_first(bp->mii_bus); |
198 | if (!phydev) { | 198 | if (!phydev) { |
199 | printk (KERN_ERR "%s: no PHY found\n", dev->name); | 199 | netdev_err(dev, "no PHY found\n"); |
200 | return -1; | 200 | return -1; |
201 | } | 201 | } |
202 | 202 | ||
@@ -209,7 +209,7 @@ static int macb_mii_probe(struct net_device *dev) | |||
209 | PHY_INTERFACE_MODE_RMII : | 209 | PHY_INTERFACE_MODE_RMII : |
210 | PHY_INTERFACE_MODE_MII); | 210 | PHY_INTERFACE_MODE_MII); |
211 | if (ret) { | 211 | if (ret) { |
212 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | 212 | netdev_err(dev, "Could not attach to PHY\n"); |
213 | return ret; | 213 | return ret; |
214 | } | 214 | } |
215 | 215 | ||
@@ -228,7 +228,7 @@ static int macb_mii_probe(struct net_device *dev) | |||
228 | 228 | ||
229 | static int macb_mii_init(struct macb *bp) | 229 | static int macb_mii_init(struct macb *bp) |
230 | { | 230 | { |
231 | struct eth_platform_data *pdata; | 231 | struct macb_platform_data *pdata; |
232 | int err = -ENXIO, i; | 232 | int err = -ENXIO, i; |
233 | 233 | ||
234 | /* Enable management port */ | 234 | /* Enable management port */ |
@@ -303,14 +303,13 @@ static void macb_tx(struct macb *bp) | |||
303 | status = macb_readl(bp, TSR); | 303 | status = macb_readl(bp, TSR); |
304 | macb_writel(bp, TSR, status); | 304 | macb_writel(bp, TSR, status); |
305 | 305 | ||
306 | dev_dbg(&bp->pdev->dev, "macb_tx status = %02lx\n", | 306 | netdev_dbg(bp->dev, "macb_tx status = %02lx\n", (unsigned long)status); |
307 | (unsigned long)status); | ||
308 | 307 | ||
309 | if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { | 308 | if (status & (MACB_BIT(UND) | MACB_BIT(TSR_RLE))) { |
310 | int i; | 309 | int i; |
311 | printk(KERN_ERR "%s: TX %s, resetting buffers\n", | 310 | netdev_err(bp->dev, "TX %s, resetting buffers\n", |
312 | bp->dev->name, status & MACB_BIT(UND) ? | 311 | status & MACB_BIT(UND) ? |
313 | "underrun" : "retry limit exceeded"); | 312 | "underrun" : "retry limit exceeded"); |
314 | 313 | ||
315 | /* Transfer ongoing, disable transmitter, to avoid confusion */ | 314 | /* Transfer ongoing, disable transmitter, to avoid confusion */ |
316 | if (status & MACB_BIT(TGO)) | 315 | if (status & MACB_BIT(TGO)) |
@@ -369,8 +368,8 @@ static void macb_tx(struct macb *bp) | |||
369 | if (!(bufstat & MACB_BIT(TX_USED))) | 368 | if (!(bufstat & MACB_BIT(TX_USED))) |
370 | break; | 369 | break; |
371 | 370 | ||
372 | dev_dbg(&bp->pdev->dev, "skb %u (data %p) TX complete\n", | 371 | netdev_dbg(bp->dev, "skb %u (data %p) TX complete\n", |
373 | tail, skb->data); | 372 | tail, skb->data); |
374 | dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len, | 373 | dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len, |
375 | DMA_TO_DEVICE); | 374 | DMA_TO_DEVICE); |
376 | bp->stats.tx_packets++; | 375 | bp->stats.tx_packets++; |
@@ -395,8 +394,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, | |||
395 | 394 | ||
396 | len = MACB_BFEXT(RX_FRMLEN, bp->rx_ring[last_frag].ctrl); | 395 | len = MACB_BFEXT(RX_FRMLEN, bp->rx_ring[last_frag].ctrl); |
397 | 396 | ||
398 | dev_dbg(&bp->pdev->dev, "macb_rx_frame frags %u - %u (len %u)\n", | 397 | netdev_dbg(bp->dev, "macb_rx_frame frags %u - %u (len %u)\n", |
399 | first_frag, last_frag, len); | 398 | first_frag, last_frag, len); |
400 | 399 | ||
401 | skb = dev_alloc_skb(len + RX_OFFSET); | 400 | skb = dev_alloc_skb(len + RX_OFFSET); |
402 | if (!skb) { | 401 | if (!skb) { |
@@ -437,8 +436,8 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag, | |||
437 | 436 | ||
438 | bp->stats.rx_packets++; | 437 | bp->stats.rx_packets++; |
439 | bp->stats.rx_bytes += len; | 438 | bp->stats.rx_bytes += len; |
440 | dev_dbg(&bp->pdev->dev, "received skb of length %u, csum: %08x\n", | 439 | netdev_dbg(bp->dev, "received skb of length %u, csum: %08x\n", |
441 | skb->len, skb->csum); | 440 | skb->len, skb->csum); |
442 | netif_receive_skb(skb); | 441 | netif_receive_skb(skb); |
443 | 442 | ||
444 | return 0; | 443 | return 0; |
@@ -515,8 +514,8 @@ static int macb_poll(struct napi_struct *napi, int budget) | |||
515 | 514 | ||
516 | work_done = 0; | 515 | work_done = 0; |
517 | 516 | ||
518 | dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n", | 517 | netdev_dbg(bp->dev, "poll: status = %08lx, budget = %d\n", |
519 | (unsigned long)status, budget); | 518 | (unsigned long)status, budget); |
520 | 519 | ||
521 | work_done = macb_rx(bp, budget); | 520 | work_done = macb_rx(bp, budget); |
522 | if (work_done < budget) { | 521 | if (work_done < budget) { |
@@ -565,8 +564,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
565 | macb_writel(bp, IDR, MACB_RX_INT_FLAGS); | 564 | macb_writel(bp, IDR, MACB_RX_INT_FLAGS); |
566 | 565 | ||
567 | if (napi_schedule_prep(&bp->napi)) { | 566 | if (napi_schedule_prep(&bp->napi)) { |
568 | dev_dbg(&bp->pdev->dev, | 567 | netdev_dbg(bp->dev, "scheduling RX softirq\n"); |
569 | "scheduling RX softirq\n"); | ||
570 | __napi_schedule(&bp->napi); | 568 | __napi_schedule(&bp->napi); |
571 | } | 569 | } |
572 | } | 570 | } |
@@ -587,11 +585,11 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
587 | 585 | ||
588 | if (status & MACB_BIT(HRESP)) { | 586 | if (status & MACB_BIT(HRESP)) { |
589 | /* | 587 | /* |
590 | * TODO: Reset the hardware, and maybe move the printk | 588 | * TODO: Reset the hardware, and maybe move the |
591 | * to a lower-priority context as well (work queue?) | 589 | * netdev_err to a lower-priority context as well |
590 | * (work queue?) | ||
592 | */ | 591 | */ |
593 | printk(KERN_ERR "%s: DMA bus error: HRESP not OK\n", | 592 | netdev_err(dev, "DMA bus error: HRESP not OK\n"); |
594 | dev->name); | ||
595 | } | 593 | } |
596 | 594 | ||
597 | status = macb_readl(bp, ISR); | 595 | status = macb_readl(bp, ISR); |
@@ -626,16 +624,12 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
626 | unsigned long flags; | 624 | unsigned long flags; |
627 | 625 | ||
628 | #ifdef DEBUG | 626 | #ifdef DEBUG |
629 | int i; | 627 | netdev_dbg(bp->dev, |
630 | dev_dbg(&bp->pdev->dev, | 628 | "start_xmit: len %u head %p data %p tail %p end %p\n", |
631 | "start_xmit: len %u head %p data %p tail %p end %p\n", | 629 | skb->len, skb->head, skb->data, |
632 | skb->len, skb->head, skb->data, | 630 | skb_tail_pointer(skb), skb_end_pointer(skb)); |
633 | skb_tail_pointer(skb), skb_end_pointer(skb)); | 631 | print_hex_dump(KERN_DEBUG, "data: ", DUMP_PREFIX_OFFSET, 16, 1, |
634 | dev_dbg(&bp->pdev->dev, | 632 | skb->data, 16, true); |
635 | "data:"); | ||
636 | for (i = 0; i < 16; i++) | ||
637 | printk(" %02x", (unsigned int)skb->data[i]); | ||
638 | printk("\n"); | ||
639 | #endif | 633 | #endif |
640 | 634 | ||
641 | len = skb->len; | 635 | len = skb->len; |
@@ -645,21 +639,20 @@ static int macb_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
645 | if (TX_BUFFS_AVAIL(bp) < 1) { | 639 | if (TX_BUFFS_AVAIL(bp) < 1) { |
646 | netif_stop_queue(dev); | 640 | netif_stop_queue(dev); |
647 | spin_unlock_irqrestore(&bp->lock, flags); | 641 | spin_unlock_irqrestore(&bp->lock, flags); |
648 | dev_err(&bp->pdev->dev, | 642 | netdev_err(bp->dev, "BUG! Tx Ring full when queue awake!\n"); |
649 | "BUG! Tx Ring full when queue awake!\n"); | 643 | netdev_dbg(bp->dev, "tx_head = %u, tx_tail = %u\n", |
650 | dev_dbg(&bp->pdev->dev, "tx_head = %u, tx_tail = %u\n", | 644 | bp->tx_head, bp->tx_tail); |
651 | bp->tx_head, bp->tx_tail); | ||
652 | return NETDEV_TX_BUSY; | 645 | return NETDEV_TX_BUSY; |
653 | } | 646 | } |
654 | 647 | ||
655 | entry = bp->tx_head; | 648 | entry = bp->tx_head; |
656 | dev_dbg(&bp->pdev->dev, "Allocated ring entry %u\n", entry); | 649 | netdev_dbg(bp->dev, "Allocated ring entry %u\n", entry); |
657 | mapping = dma_map_single(&bp->pdev->dev, skb->data, | 650 | mapping = dma_map_single(&bp->pdev->dev, skb->data, |
658 | len, DMA_TO_DEVICE); | 651 | len, DMA_TO_DEVICE); |
659 | bp->tx_skb[entry].skb = skb; | 652 | bp->tx_skb[entry].skb = skb; |
660 | bp->tx_skb[entry].mapping = mapping; | 653 | bp->tx_skb[entry].mapping = mapping; |
661 | dev_dbg(&bp->pdev->dev, "Mapped skb data %p to DMA addr %08lx\n", | 654 | netdev_dbg(bp->dev, "Mapped skb data %p to DMA addr %08lx\n", |
662 | skb->data, (unsigned long)mapping); | 655 | skb->data, (unsigned long)mapping); |
663 | 656 | ||
664 | ctrl = MACB_BF(TX_FRMLEN, len); | 657 | ctrl = MACB_BF(TX_FRMLEN, len); |
665 | ctrl |= MACB_BIT(TX_LAST); | 658 | ctrl |= MACB_BIT(TX_LAST); |
@@ -723,27 +716,27 @@ static int macb_alloc_consistent(struct macb *bp) | |||
723 | &bp->rx_ring_dma, GFP_KERNEL); | 716 | &bp->rx_ring_dma, GFP_KERNEL); |
724 | if (!bp->rx_ring) | 717 | if (!bp->rx_ring) |
725 | goto out_err; | 718 | goto out_err; |
726 | dev_dbg(&bp->pdev->dev, | 719 | netdev_dbg(bp->dev, |
727 | "Allocated RX ring of %d bytes at %08lx (mapped %p)\n", | 720 | "Allocated RX ring of %d bytes at %08lx (mapped %p)\n", |
728 | size, (unsigned long)bp->rx_ring_dma, bp->rx_ring); | 721 | size, (unsigned long)bp->rx_ring_dma, bp->rx_ring); |
729 | 722 | ||
730 | size = TX_RING_BYTES; | 723 | size = TX_RING_BYTES; |
731 | bp->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size, | 724 | bp->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size, |
732 | &bp->tx_ring_dma, GFP_KERNEL); | 725 | &bp->tx_ring_dma, GFP_KERNEL); |
733 | if (!bp->tx_ring) | 726 | if (!bp->tx_ring) |
734 | goto out_err; | 727 | goto out_err; |
735 | dev_dbg(&bp->pdev->dev, | 728 | netdev_dbg(bp->dev, |
736 | "Allocated TX ring of %d bytes at %08lx (mapped %p)\n", | 729 | "Allocated TX ring of %d bytes at %08lx (mapped %p)\n", |
737 | size, (unsigned long)bp->tx_ring_dma, bp->tx_ring); | 730 | size, (unsigned long)bp->tx_ring_dma, bp->tx_ring); |
738 | 731 | ||
739 | size = RX_RING_SIZE * RX_BUFFER_SIZE; | 732 | size = RX_RING_SIZE * RX_BUFFER_SIZE; |
740 | bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size, | 733 | bp->rx_buffers = dma_alloc_coherent(&bp->pdev->dev, size, |
741 | &bp->rx_buffers_dma, GFP_KERNEL); | 734 | &bp->rx_buffers_dma, GFP_KERNEL); |
742 | if (!bp->rx_buffers) | 735 | if (!bp->rx_buffers) |
743 | goto out_err; | 736 | goto out_err; |
744 | dev_dbg(&bp->pdev->dev, | 737 | netdev_dbg(bp->dev, |
745 | "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n", | 738 | "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n", |
746 | size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers); | 739 | size, (unsigned long)bp->rx_buffers_dma, bp->rx_buffers); |
747 | 740 | ||
748 | return 0; | 741 | return 0; |
749 | 742 | ||
@@ -954,7 +947,7 @@ static int macb_open(struct net_device *dev) | |||
954 | struct macb *bp = netdev_priv(dev); | 947 | struct macb *bp = netdev_priv(dev); |
955 | int err; | 948 | int err; |
956 | 949 | ||
957 | dev_dbg(&bp->pdev->dev, "open\n"); | 950 | netdev_dbg(bp->dev, "open\n"); |
958 | 951 | ||
959 | /* if the phy is not yet register, retry later*/ | 952 | /* if the phy is not yet register, retry later*/ |
960 | if (!bp->phy_dev) | 953 | if (!bp->phy_dev) |
@@ -965,9 +958,8 @@ static int macb_open(struct net_device *dev) | |||
965 | 958 | ||
966 | err = macb_alloc_consistent(bp); | 959 | err = macb_alloc_consistent(bp); |
967 | if (err) { | 960 | if (err) { |
968 | printk(KERN_ERR | 961 | netdev_err(dev, "Unable to allocate DMA memory (error %d)\n", |
969 | "%s: Unable to allocate DMA memory (error %d)\n", | 962 | err); |
970 | dev->name, err); | ||
971 | return err; | 963 | return err; |
972 | } | 964 | } |
973 | 965 | ||
@@ -1119,7 +1111,7 @@ static const struct net_device_ops macb_netdev_ops = { | |||
1119 | 1111 | ||
1120 | static int __init macb_probe(struct platform_device *pdev) | 1112 | static int __init macb_probe(struct platform_device *pdev) |
1121 | { | 1113 | { |
1122 | struct eth_platform_data *pdata; | 1114 | struct macb_platform_data *pdata; |
1123 | struct resource *regs; | 1115 | struct resource *regs; |
1124 | struct net_device *dev; | 1116 | struct net_device *dev; |
1125 | struct macb *bp; | 1117 | struct macb *bp; |
@@ -1152,28 +1144,19 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1152 | 1144 | ||
1153 | spin_lock_init(&bp->lock); | 1145 | spin_lock_init(&bp->lock); |
1154 | 1146 | ||
1155 | #if defined(CONFIG_ARCH_AT91) | 1147 | bp->pclk = clk_get(&pdev->dev, "pclk"); |
1156 | bp->pclk = clk_get(&pdev->dev, "macb_clk"); | ||
1157 | if (IS_ERR(bp->pclk)) { | 1148 | if (IS_ERR(bp->pclk)) { |
1158 | dev_err(&pdev->dev, "failed to get macb_clk\n"); | 1149 | dev_err(&pdev->dev, "failed to get macb_clk\n"); |
1159 | goto err_out_free_dev; | 1150 | goto err_out_free_dev; |
1160 | } | 1151 | } |
1161 | clk_enable(bp->pclk); | 1152 | clk_enable(bp->pclk); |
1162 | #else | 1153 | |
1163 | bp->pclk = clk_get(&pdev->dev, "pclk"); | ||
1164 | if (IS_ERR(bp->pclk)) { | ||
1165 | dev_err(&pdev->dev, "failed to get pclk\n"); | ||
1166 | goto err_out_free_dev; | ||
1167 | } | ||
1168 | bp->hclk = clk_get(&pdev->dev, "hclk"); | 1154 | bp->hclk = clk_get(&pdev->dev, "hclk"); |
1169 | if (IS_ERR(bp->hclk)) { | 1155 | if (IS_ERR(bp->hclk)) { |
1170 | dev_err(&pdev->dev, "failed to get hclk\n"); | 1156 | dev_err(&pdev->dev, "failed to get hclk\n"); |
1171 | goto err_out_put_pclk; | 1157 | goto err_out_put_pclk; |
1172 | } | 1158 | } |
1173 | |||
1174 | clk_enable(bp->pclk); | ||
1175 | clk_enable(bp->hclk); | 1159 | clk_enable(bp->hclk); |
1176 | #endif | ||
1177 | 1160 | ||
1178 | bp->regs = ioremap(regs->start, resource_size(regs)); | 1161 | bp->regs = ioremap(regs->start, resource_size(regs)); |
1179 | if (!bp->regs) { | 1162 | if (!bp->regs) { |
@@ -1185,9 +1168,8 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1185 | dev->irq = platform_get_irq(pdev, 0); | 1168 | dev->irq = platform_get_irq(pdev, 0); |
1186 | err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev); | 1169 | err = request_irq(dev->irq, macb_interrupt, 0, dev->name, dev); |
1187 | if (err) { | 1170 | if (err) { |
1188 | printk(KERN_ERR | 1171 | dev_err(&pdev->dev, "Unable to request IRQ %d (error %d)\n", |
1189 | "%s: Unable to request IRQ %d (error %d)\n", | 1172 | dev->irq, err); |
1190 | dev->name, dev->irq, err); | ||
1191 | goto err_out_iounmap; | 1173 | goto err_out_iounmap; |
1192 | } | 1174 | } |
1193 | 1175 | ||
@@ -1239,13 +1221,12 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1239 | 1221 | ||
1240 | platform_set_drvdata(pdev, dev); | 1222 | platform_set_drvdata(pdev, dev); |
1241 | 1223 | ||
1242 | printk(KERN_INFO "%s: Atmel MACB at 0x%08lx irq %d (%pM)\n", | 1224 | netdev_info(dev, "Atmel MACB at 0x%08lx irq %d (%pM)\n", |
1243 | dev->name, dev->base_addr, dev->irq, dev->dev_addr); | 1225 | dev->base_addr, dev->irq, dev->dev_addr); |
1244 | 1226 | ||
1245 | phydev = bp->phy_dev; | 1227 | phydev = bp->phy_dev; |
1246 | printk(KERN_INFO "%s: attached PHY driver [%s] " | 1228 | netdev_info(dev, "attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", |
1247 | "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name, | 1229 | phydev->drv->name, dev_name(&phydev->dev), phydev->irq); |
1248 | phydev->drv->name, dev_name(&phydev->dev), phydev->irq); | ||
1249 | 1230 | ||
1250 | return 0; | 1231 | return 0; |
1251 | 1232 | ||
@@ -1256,14 +1237,10 @@ err_out_free_irq: | |||
1256 | err_out_iounmap: | 1237 | err_out_iounmap: |
1257 | iounmap(bp->regs); | 1238 | iounmap(bp->regs); |
1258 | err_out_disable_clocks: | 1239 | err_out_disable_clocks: |
1259 | #ifndef CONFIG_ARCH_AT91 | ||
1260 | clk_disable(bp->hclk); | 1240 | clk_disable(bp->hclk); |
1261 | clk_put(bp->hclk); | 1241 | clk_put(bp->hclk); |
1262 | #endif | ||
1263 | clk_disable(bp->pclk); | 1242 | clk_disable(bp->pclk); |
1264 | #ifndef CONFIG_ARCH_AT91 | ||
1265 | err_out_put_pclk: | 1243 | err_out_put_pclk: |
1266 | #endif | ||
1267 | clk_put(bp->pclk); | 1244 | clk_put(bp->pclk); |
1268 | err_out_free_dev: | 1245 | err_out_free_dev: |
1269 | free_netdev(dev); | 1246 | free_netdev(dev); |
@@ -1289,10 +1266,8 @@ static int __exit macb_remove(struct platform_device *pdev) | |||
1289 | unregister_netdev(dev); | 1266 | unregister_netdev(dev); |
1290 | free_irq(dev->irq, dev); | 1267 | free_irq(dev->irq, dev); |
1291 | iounmap(bp->regs); | 1268 | iounmap(bp->regs); |
1292 | #ifndef CONFIG_ARCH_AT91 | ||
1293 | clk_disable(bp->hclk); | 1269 | clk_disable(bp->hclk); |
1294 | clk_put(bp->hclk); | 1270 | clk_put(bp->hclk); |
1295 | #endif | ||
1296 | clk_disable(bp->pclk); | 1271 | clk_disable(bp->pclk); |
1297 | clk_put(bp->pclk); | 1272 | clk_put(bp->pclk); |
1298 | free_netdev(dev); | 1273 | free_netdev(dev); |
@@ -1310,9 +1285,7 @@ static int macb_suspend(struct platform_device *pdev, pm_message_t state) | |||
1310 | 1285 | ||
1311 | netif_device_detach(netdev); | 1286 | netif_device_detach(netdev); |
1312 | 1287 | ||
1313 | #ifndef CONFIG_ARCH_AT91 | ||
1314 | clk_disable(bp->hclk); | 1288 | clk_disable(bp->hclk); |
1315 | #endif | ||
1316 | clk_disable(bp->pclk); | 1289 | clk_disable(bp->pclk); |
1317 | 1290 | ||
1318 | return 0; | 1291 | return 0; |
@@ -1324,9 +1297,7 @@ static int macb_resume(struct platform_device *pdev) | |||
1324 | struct macb *bp = netdev_priv(netdev); | 1297 | struct macb *bp = netdev_priv(netdev); |
1325 | 1298 | ||
1326 | clk_enable(bp->pclk); | 1299 | clk_enable(bp->pclk); |
1327 | #ifndef CONFIG_ARCH_AT91 | ||
1328 | clk_enable(bp->hclk); | 1300 | clk_enable(bp->hclk); |
1329 | #endif | ||
1330 | 1301 | ||
1331 | netif_device_attach(netdev); | 1302 | netif_device_attach(netdev); |
1332 | 1303 | ||
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index 438f4580bf66..2a22f5256353 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c | |||
@@ -613,7 +613,7 @@ static int dm9000_set_wol(struct net_device *dev, struct ethtool_wolinfo *w) | |||
613 | 613 | ||
614 | if (!dm->wake_state) | 614 | if (!dm->wake_state) |
615 | irq_set_irq_wake(dm->irq_wake, 1); | 615 | irq_set_irq_wake(dm->irq_wake, 1); |
616 | else if (dm->wake_state & !opts) | 616 | else if (dm->wake_state && !opts) |
617 | irq_set_irq_wake(dm->irq_wake, 0); | 617 | irq_set_irq_wake(dm->irq_wake, 0); |
618 | } | 618 | } |
619 | 619 | ||
diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig index c520cfd3b298..5272f9d4dda9 100644 --- a/drivers/net/ethernet/freescale/Kconfig +++ b/drivers/net/ethernet/freescale/Kconfig | |||
@@ -24,6 +24,7 @@ config FEC | |||
24 | bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)" | 24 | bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)" |
25 | depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \ | 25 | depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \ |
26 | ARCH_MXC || ARCH_MXS) | 26 | ARCH_MXC || ARCH_MXS) |
27 | default ARCH_MXC || ARCH_MXS if ARM | ||
27 | select PHYLIB | 28 | select PHYLIB |
28 | ---help--- | 29 | ---help--- |
29 | Say Y here if you want to use the built-in 10/100 Fast ethernet | 30 | Say Y here if you want to use the built-in 10/100 Fast ethernet |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea.h b/drivers/net/ethernet/ibm/ehea/ehea.h index 410d6a1984ed..6650068c996c 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea.h +++ b/drivers/net/ethernet/ibm/ehea/ehea.h | |||
@@ -61,9 +61,9 @@ | |||
61 | #ifdef EHEA_SMALL_QUEUES | 61 | #ifdef EHEA_SMALL_QUEUES |
62 | #define EHEA_MAX_CQE_COUNT 1023 | 62 | #define EHEA_MAX_CQE_COUNT 1023 |
63 | #define EHEA_DEF_ENTRIES_SQ 1023 | 63 | #define EHEA_DEF_ENTRIES_SQ 1023 |
64 | #define EHEA_DEF_ENTRIES_RQ1 4095 | 64 | #define EHEA_DEF_ENTRIES_RQ1 1023 |
65 | #define EHEA_DEF_ENTRIES_RQ2 1023 | 65 | #define EHEA_DEF_ENTRIES_RQ2 1023 |
66 | #define EHEA_DEF_ENTRIES_RQ3 1023 | 66 | #define EHEA_DEF_ENTRIES_RQ3 511 |
67 | #else | 67 | #else |
68 | #define EHEA_MAX_CQE_COUNT 4080 | 68 | #define EHEA_MAX_CQE_COUNT 4080 |
69 | #define EHEA_DEF_ENTRIES_SQ 4080 | 69 | #define EHEA_DEF_ENTRIES_SQ 4080 |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index 37b70f7052b6..bfeccbfde236 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
@@ -371,7 +371,8 @@ static void ehea_update_stats(struct work_struct *work) | |||
371 | out_herr: | 371 | out_herr: |
372 | free_page((unsigned long)cb2); | 372 | free_page((unsigned long)cb2); |
373 | resched: | 373 | resched: |
374 | schedule_delayed_work(&port->stats_work, msecs_to_jiffies(1000)); | 374 | schedule_delayed_work(&port->stats_work, |
375 | round_jiffies_relative(msecs_to_jiffies(1000))); | ||
375 | } | 376 | } |
376 | 377 | ||
377 | static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes) | 378 | static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes) |
@@ -2434,7 +2435,8 @@ static int ehea_open(struct net_device *dev) | |||
2434 | } | 2435 | } |
2435 | 2436 | ||
2436 | mutex_unlock(&port->port_lock); | 2437 | mutex_unlock(&port->port_lock); |
2437 | schedule_delayed_work(&port->stats_work, msecs_to_jiffies(1000)); | 2438 | schedule_delayed_work(&port->stats_work, |
2439 | round_jiffies_relative(msecs_to_jiffies(1000))); | ||
2438 | 2440 | ||
2439 | return ret; | 2441 | return ret; |
2440 | } | 2442 | } |
diff --git a/drivers/net/ethernet/ibm/iseries_veth.c b/drivers/net/ethernet/ibm/iseries_veth.c index 4326681df382..acc31af6594a 100644 --- a/drivers/net/ethernet/ibm/iseries_veth.c +++ b/drivers/net/ethernet/ibm/iseries_veth.c | |||
@@ -1421,7 +1421,7 @@ static void veth_receive(struct veth_lpar_connection *cnx, | |||
1421 | 1421 | ||
1422 | /* FIXME: do we need this? */ | 1422 | /* FIXME: do we need this? */ |
1423 | memset(local_list, 0, sizeof(local_list)); | 1423 | memset(local_list, 0, sizeof(local_list)); |
1424 | memset(remote_list, 0, sizeof(VETH_MAX_FRAMES_PER_MSG)); | 1424 | memset(remote_list, 0, sizeof(remote_list)); |
1425 | 1425 | ||
1426 | /* a 0 address marks the end of the valid entries */ | 1426 | /* a 0 address marks the end of the valid entries */ |
1427 | if (senddata->addr[startchunk] == 0) | 1427 | if (senddata->addr[startchunk] == 0) |
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c index 7becff1f387d..76b84573566b 100644 --- a/drivers/net/ethernet/jme.c +++ b/drivers/net/ethernet/jme.c | |||
@@ -1745,6 +1745,112 @@ jme_phy_off(struct jme_adapter *jme) | |||
1745 | } | 1745 | } |
1746 | 1746 | ||
1747 | static int | 1747 | static int |
1748 | jme_phy_specreg_read(struct jme_adapter *jme, u32 specreg) | ||
1749 | { | ||
1750 | u32 phy_addr; | ||
1751 | |||
1752 | phy_addr = JM_PHY_SPEC_REG_READ | specreg; | ||
1753 | jme_mdio_write(jme->dev, jme->mii_if.phy_id, JM_PHY_SPEC_ADDR_REG, | ||
1754 | phy_addr); | ||
1755 | return jme_mdio_read(jme->dev, jme->mii_if.phy_id, | ||
1756 | JM_PHY_SPEC_DATA_REG); | ||
1757 | } | ||
1758 | |||
1759 | static void | ||
1760 | jme_phy_specreg_write(struct jme_adapter *jme, u32 ext_reg, u32 phy_data) | ||
1761 | { | ||
1762 | u32 phy_addr; | ||
1763 | |||
1764 | phy_addr = JM_PHY_SPEC_REG_WRITE | ext_reg; | ||
1765 | jme_mdio_write(jme->dev, jme->mii_if.phy_id, JM_PHY_SPEC_DATA_REG, | ||
1766 | phy_data); | ||
1767 | jme_mdio_write(jme->dev, jme->mii_if.phy_id, JM_PHY_SPEC_ADDR_REG, | ||
1768 | phy_addr); | ||
1769 | } | ||
1770 | |||
1771 | static int | ||
1772 | jme_phy_calibration(struct jme_adapter *jme) | ||
1773 | { | ||
1774 | u32 ctrl1000, phy_data; | ||
1775 | |||
1776 | jme_phy_off(jme); | ||
1777 | jme_phy_on(jme); | ||
1778 | /* Enabel PHY test mode 1 */ | ||
1779 | ctrl1000 = jme_mdio_read(jme->dev, jme->mii_if.phy_id, MII_CTRL1000); | ||
1780 | ctrl1000 &= ~PHY_GAD_TEST_MODE_MSK; | ||
1781 | ctrl1000 |= PHY_GAD_TEST_MODE_1; | ||
1782 | jme_mdio_write(jme->dev, jme->mii_if.phy_id, MII_CTRL1000, ctrl1000); | ||
1783 | |||
1784 | phy_data = jme_phy_specreg_read(jme, JM_PHY_EXT_COMM_2_REG); | ||
1785 | phy_data &= ~JM_PHY_EXT_COMM_2_CALI_MODE_0; | ||
1786 | phy_data |= JM_PHY_EXT_COMM_2_CALI_LATCH | | ||
1787 | JM_PHY_EXT_COMM_2_CALI_ENABLE; | ||
1788 | jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_2_REG, phy_data); | ||
1789 | msleep(20); | ||
1790 | phy_data = jme_phy_specreg_read(jme, JM_PHY_EXT_COMM_2_REG); | ||
1791 | phy_data &= ~(JM_PHY_EXT_COMM_2_CALI_ENABLE | | ||
1792 | JM_PHY_EXT_COMM_2_CALI_MODE_0 | | ||
1793 | JM_PHY_EXT_COMM_2_CALI_LATCH); | ||
1794 | jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_2_REG, phy_data); | ||
1795 | |||
1796 | /* Disable PHY test mode */ | ||
1797 | ctrl1000 = jme_mdio_read(jme->dev, jme->mii_if.phy_id, MII_CTRL1000); | ||
1798 | ctrl1000 &= ~PHY_GAD_TEST_MODE_MSK; | ||
1799 | jme_mdio_write(jme->dev, jme->mii_if.phy_id, MII_CTRL1000, ctrl1000); | ||
1800 | return 0; | ||
1801 | } | ||
1802 | |||
1803 | static int | ||
1804 | jme_phy_setEA(struct jme_adapter *jme) | ||
1805 | { | ||
1806 | u32 phy_comm0 = 0, phy_comm1 = 0; | ||
1807 | u8 nic_ctrl; | ||
1808 | |||
1809 | pci_read_config_byte(jme->pdev, PCI_PRIV_SHARE_NICCTRL, &nic_ctrl); | ||
1810 | if ((nic_ctrl & 0x3) == JME_FLAG_PHYEA_ENABLE) | ||
1811 | return 0; | ||
1812 | |||
1813 | switch (jme->pdev->device) { | ||
1814 | case PCI_DEVICE_ID_JMICRON_JMC250: | ||
1815 | if (((jme->chip_main_rev == 5) && | ||
1816 | ((jme->chip_sub_rev == 0) || (jme->chip_sub_rev == 1) || | ||
1817 | (jme->chip_sub_rev == 3))) || | ||
1818 | (jme->chip_main_rev >= 6)) { | ||
1819 | phy_comm0 = 0x008A; | ||
1820 | phy_comm1 = 0x4109; | ||
1821 | } | ||
1822 | if ((jme->chip_main_rev == 3) && | ||
1823 | ((jme->chip_sub_rev == 1) || (jme->chip_sub_rev == 2))) | ||
1824 | phy_comm0 = 0xE088; | ||
1825 | break; | ||
1826 | case PCI_DEVICE_ID_JMICRON_JMC260: | ||
1827 | if (((jme->chip_main_rev == 5) && | ||
1828 | ((jme->chip_sub_rev == 0) || (jme->chip_sub_rev == 1) || | ||
1829 | (jme->chip_sub_rev == 3))) || | ||
1830 | (jme->chip_main_rev >= 6)) { | ||
1831 | phy_comm0 = 0x008A; | ||
1832 | phy_comm1 = 0x4109; | ||
1833 | } | ||
1834 | if ((jme->chip_main_rev == 3) && | ||
1835 | ((jme->chip_sub_rev == 1) || (jme->chip_sub_rev == 2))) | ||
1836 | phy_comm0 = 0xE088; | ||
1837 | if ((jme->chip_main_rev == 2) && (jme->chip_sub_rev == 0)) | ||
1838 | phy_comm0 = 0x608A; | ||
1839 | if ((jme->chip_main_rev == 2) && (jme->chip_sub_rev == 2)) | ||
1840 | phy_comm0 = 0x408A; | ||
1841 | break; | ||
1842 | default: | ||
1843 | return -ENODEV; | ||
1844 | } | ||
1845 | if (phy_comm0) | ||
1846 | jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_0_REG, phy_comm0); | ||
1847 | if (phy_comm1) | ||
1848 | jme_phy_specreg_write(jme, JM_PHY_EXT_COMM_1_REG, phy_comm1); | ||
1849 | |||
1850 | return 0; | ||
1851 | } | ||
1852 | |||
1853 | static int | ||
1748 | jme_open(struct net_device *netdev) | 1854 | jme_open(struct net_device *netdev) |
1749 | { | 1855 | { |
1750 | struct jme_adapter *jme = netdev_priv(netdev); | 1856 | struct jme_adapter *jme = netdev_priv(netdev); |
@@ -1769,7 +1875,8 @@ jme_open(struct net_device *netdev) | |||
1769 | jme_set_settings(netdev, &jme->old_ecmd); | 1875 | jme_set_settings(netdev, &jme->old_ecmd); |
1770 | else | 1876 | else |
1771 | jme_reset_phy_processor(jme); | 1877 | jme_reset_phy_processor(jme); |
1772 | 1878 | jme_phy_calibration(jme); | |
1879 | jme_phy_setEA(jme); | ||
1773 | jme_reset_link(jme); | 1880 | jme_reset_link(jme); |
1774 | 1881 | ||
1775 | return 0; | 1882 | return 0; |
@@ -3184,7 +3291,8 @@ jme_resume(struct device *dev) | |||
3184 | jme_set_settings(netdev, &jme->old_ecmd); | 3291 | jme_set_settings(netdev, &jme->old_ecmd); |
3185 | else | 3292 | else |
3186 | jme_reset_phy_processor(jme); | 3293 | jme_reset_phy_processor(jme); |
3187 | 3294 | jme_phy_calibration(jme); | |
3295 | jme_phy_setEA(jme); | ||
3188 | jme_start_irq(jme); | 3296 | jme_start_irq(jme); |
3189 | netif_device_attach(netdev); | 3297 | netif_device_attach(netdev); |
3190 | 3298 | ||
@@ -3239,4 +3347,3 @@ MODULE_DESCRIPTION("JMicron JMC2x0 PCI Express Ethernet driver"); | |||
3239 | MODULE_LICENSE("GPL"); | 3347 | MODULE_LICENSE("GPL"); |
3240 | MODULE_VERSION(DRV_VERSION); | 3348 | MODULE_VERSION(DRV_VERSION); |
3241 | MODULE_DEVICE_TABLE(pci, jme_pci_tbl); | 3349 | MODULE_DEVICE_TABLE(pci, jme_pci_tbl); |
3242 | |||
diff --git a/drivers/net/ethernet/jme.h b/drivers/net/ethernet/jme.h index 02ea27c1dcb5..4304072bd3c5 100644 --- a/drivers/net/ethernet/jme.h +++ b/drivers/net/ethernet/jme.h | |||
@@ -760,6 +760,25 @@ enum jme_rxmcs_bits { | |||
760 | RXMCS_CHECKSUM, | 760 | RXMCS_CHECKSUM, |
761 | }; | 761 | }; |
762 | 762 | ||
763 | /* Extern PHY common register 2 */ | ||
764 | |||
765 | #define PHY_GAD_TEST_MODE_1 0x00002000 | ||
766 | #define PHY_GAD_TEST_MODE_MSK 0x0000E000 | ||
767 | #define JM_PHY_SPEC_REG_READ 0x00004000 | ||
768 | #define JM_PHY_SPEC_REG_WRITE 0x00008000 | ||
769 | #define PHY_CALIBRATION_DELAY 20 | ||
770 | #define JM_PHY_SPEC_ADDR_REG 0x1E | ||
771 | #define JM_PHY_SPEC_DATA_REG 0x1F | ||
772 | |||
773 | #define JM_PHY_EXT_COMM_0_REG 0x30 | ||
774 | #define JM_PHY_EXT_COMM_1_REG 0x31 | ||
775 | #define JM_PHY_EXT_COMM_2_REG 0x32 | ||
776 | #define JM_PHY_EXT_COMM_2_CALI_ENABLE 0x01 | ||
777 | #define JM_PHY_EXT_COMM_2_CALI_MODE_0 0x02 | ||
778 | #define JM_PHY_EXT_COMM_2_CALI_LATCH 0x10 | ||
779 | #define PCI_PRIV_SHARE_NICCTRL 0xF5 | ||
780 | #define JME_FLAG_PHYEA_ENABLE 0x2 | ||
781 | |||
763 | /* | 782 | /* |
764 | * Wakeup Frame setup interface registers | 783 | * Wakeup Frame setup interface registers |
765 | */ | 784 | */ |
diff --git a/drivers/net/ethernet/pasemi/Makefile b/drivers/net/ethernet/pasemi/Makefile index 05db5434bafc..90497ffb1ac3 100644 --- a/drivers/net/ethernet/pasemi/Makefile +++ b/drivers/net/ethernet/pasemi/Makefile | |||
@@ -2,4 +2,5 @@ | |||
2 | # Makefile for the A Semi network device drivers. | 2 | # Makefile for the A Semi network device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac.o pasemi_mac_ethtool.o | 5 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac_driver.o |
6 | pasemi_mac_driver-objs := pasemi_mac.o pasemi_mac_ethtool.o | ||
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge.h b/drivers/net/ethernet/qlogic/qlge/qlge.h index 8731f79c9efc..b8478aab050e 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge.h +++ b/drivers/net/ethernet/qlogic/qlge/qlge.h | |||
@@ -58,10 +58,8 @@ | |||
58 | 58 | ||
59 | 59 | ||
60 | #define TX_DESC_PER_IOCB 8 | 60 | #define TX_DESC_PER_IOCB 8 |
61 | /* The maximum number of frags we handle is based | 61 | |
62 | * on PAGE_SIZE... | 62 | #if ((MAX_SKB_FRAGS - TX_DESC_PER_IOCB) + 2) > 0 |
63 | */ | ||
64 | #if (PAGE_SHIFT == 12) || (PAGE_SHIFT == 13) /* 4k & 8k pages */ | ||
65 | #define TX_DESC_PER_OAL ((MAX_SKB_FRAGS - TX_DESC_PER_IOCB) + 2) | 63 | #define TX_DESC_PER_OAL ((MAX_SKB_FRAGS - TX_DESC_PER_IOCB) + 2) |
66 | #else /* all other page sizes */ | 64 | #else /* all other page sizes */ |
67 | #define TX_DESC_PER_OAL 0 | 65 | #define TX_DESC_PER_OAL 0 |
@@ -1353,7 +1351,7 @@ struct tx_ring_desc { | |||
1353 | struct ob_mac_iocb_req *queue_entry; | 1351 | struct ob_mac_iocb_req *queue_entry; |
1354 | u32 index; | 1352 | u32 index; |
1355 | struct oal oal; | 1353 | struct oal oal; |
1356 | struct map_list map[MAX_SKB_FRAGS + 1]; | 1354 | struct map_list map[MAX_SKB_FRAGS + 2]; |
1357 | int map_cnt; | 1355 | int map_cnt; |
1358 | struct tx_ring_desc *next; | 1356 | struct tx_ring_desc *next; |
1359 | }; | 1357 | }; |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 6f06aa10f0d7..67bf07819992 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -1183,11 +1183,13 @@ static u8 rtl8168d_efuse_read(void __iomem *ioaddr, int reg_addr) | |||
1183 | return value; | 1183 | return value; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | static void rtl8169_irq_mask_and_ack(void __iomem *ioaddr) | 1186 | static void rtl8169_irq_mask_and_ack(struct rtl8169_private *tp) |
1187 | { | 1187 | { |
1188 | RTL_W16(IntrMask, 0x0000); | 1188 | void __iomem *ioaddr = tp->mmio_addr; |
1189 | 1189 | ||
1190 | RTL_W16(IntrStatus, 0xffff); | 1190 | RTL_W16(IntrMask, 0x0000); |
1191 | RTL_W16(IntrStatus, tp->intr_event); | ||
1192 | RTL_R8(ChipCmd); | ||
1191 | } | 1193 | } |
1192 | 1194 | ||
1193 | static unsigned int rtl8169_tbi_reset_pending(struct rtl8169_private *tp) | 1195 | static unsigned int rtl8169_tbi_reset_pending(struct rtl8169_private *tp) |
@@ -3933,8 +3935,6 @@ static void rtl_hw_reset(struct rtl8169_private *tp) | |||
3933 | break; | 3935 | break; |
3934 | udelay(100); | 3936 | udelay(100); |
3935 | } | 3937 | } |
3936 | |||
3937 | rtl8169_init_ring_indexes(tp); | ||
3938 | } | 3938 | } |
3939 | 3939 | ||
3940 | static int __devinit | 3940 | static int __devinit |
@@ -4339,7 +4339,7 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp) | |||
4339 | void __iomem *ioaddr = tp->mmio_addr; | 4339 | void __iomem *ioaddr = tp->mmio_addr; |
4340 | 4340 | ||
4341 | /* Disable interrupts */ | 4341 | /* Disable interrupts */ |
4342 | rtl8169_irq_mask_and_ack(ioaddr); | 4342 | rtl8169_irq_mask_and_ack(tp); |
4343 | 4343 | ||
4344 | rtl_rx_close(tp); | 4344 | rtl_rx_close(tp); |
4345 | 4345 | ||
@@ -4885,8 +4885,7 @@ static void rtl_hw_start_8168(struct net_device *dev) | |||
4885 | RTL_W16(IntrMitigate, 0x5151); | 4885 | RTL_W16(IntrMitigate, 0x5151); |
4886 | 4886 | ||
4887 | /* Work around for RxFIFO overflow. */ | 4887 | /* Work around for RxFIFO overflow. */ |
4888 | if (tp->mac_version == RTL_GIGA_MAC_VER_11 || | 4888 | if (tp->mac_version == RTL_GIGA_MAC_VER_11) { |
4889 | tp->mac_version == RTL_GIGA_MAC_VER_22) { | ||
4890 | tp->intr_event |= RxFIFOOver | PCSTimeout; | 4889 | tp->intr_event |= RxFIFOOver | PCSTimeout; |
4891 | tp->intr_event &= ~RxOverflow; | 4890 | tp->intr_event &= ~RxOverflow; |
4892 | } | 4891 | } |
@@ -5076,6 +5075,11 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
5076 | void __iomem *ioaddr = tp->mmio_addr; | 5075 | void __iomem *ioaddr = tp->mmio_addr; |
5077 | struct pci_dev *pdev = tp->pci_dev; | 5076 | struct pci_dev *pdev = tp->pci_dev; |
5078 | 5077 | ||
5078 | if (tp->mac_version >= RTL_GIGA_MAC_VER_30) { | ||
5079 | tp->intr_event &= ~RxFIFOOver; | ||
5080 | tp->napi_event &= ~RxFIFOOver; | ||
5081 | } | ||
5082 | |||
5079 | if (tp->mac_version == RTL_GIGA_MAC_VER_13 || | 5083 | if (tp->mac_version == RTL_GIGA_MAC_VER_13 || |
5080 | tp->mac_version == RTL_GIGA_MAC_VER_16) { | 5084 | tp->mac_version == RTL_GIGA_MAC_VER_16) { |
5081 | int cap = pci_pcie_cap(pdev); | 5085 | int cap = pci_pcie_cap(pdev); |
@@ -5342,7 +5346,7 @@ static void rtl8169_wait_for_quiescence(struct net_device *dev) | |||
5342 | /* Wait for any pending NAPI task to complete */ | 5346 | /* Wait for any pending NAPI task to complete */ |
5343 | napi_disable(&tp->napi); | 5347 | napi_disable(&tp->napi); |
5344 | 5348 | ||
5345 | rtl8169_irq_mask_and_ack(ioaddr); | 5349 | rtl8169_irq_mask_and_ack(tp); |
5346 | 5350 | ||
5347 | tp->intr_mask = 0xffff; | 5351 | tp->intr_mask = 0xffff; |
5348 | RTL_W16(IntrMask, tp->intr_event); | 5352 | RTL_W16(IntrMask, tp->intr_event); |
@@ -5389,14 +5393,16 @@ static void rtl8169_reset_task(struct work_struct *work) | |||
5389 | if (!netif_running(dev)) | 5393 | if (!netif_running(dev)) |
5390 | goto out_unlock; | 5394 | goto out_unlock; |
5391 | 5395 | ||
5396 | rtl8169_hw_reset(tp); | ||
5397 | |||
5392 | rtl8169_wait_for_quiescence(dev); | 5398 | rtl8169_wait_for_quiescence(dev); |
5393 | 5399 | ||
5394 | for (i = 0; i < NUM_RX_DESC; i++) | 5400 | for (i = 0; i < NUM_RX_DESC; i++) |
5395 | rtl8169_mark_to_asic(tp->RxDescArray + i, rx_buf_sz); | 5401 | rtl8169_mark_to_asic(tp->RxDescArray + i, rx_buf_sz); |
5396 | 5402 | ||
5397 | rtl8169_tx_clear(tp); | 5403 | rtl8169_tx_clear(tp); |
5404 | rtl8169_init_ring_indexes(tp); | ||
5398 | 5405 | ||
5399 | rtl8169_hw_reset(tp); | ||
5400 | rtl_hw_start(dev); | 5406 | rtl_hw_start(dev); |
5401 | netif_wake_queue(dev); | 5407 | netif_wake_queue(dev); |
5402 | rtl8169_check_link_status(dev, tp, tp->mmio_addr); | 5408 | rtl8169_check_link_status(dev, tp, tp->mmio_addr); |
@@ -5407,11 +5413,6 @@ out_unlock: | |||
5407 | 5413 | ||
5408 | static void rtl8169_tx_timeout(struct net_device *dev) | 5414 | static void rtl8169_tx_timeout(struct net_device *dev) |
5409 | { | 5415 | { |
5410 | struct rtl8169_private *tp = netdev_priv(dev); | ||
5411 | |||
5412 | rtl8169_hw_reset(tp); | ||
5413 | |||
5414 | /* Let's wait a bit while any (async) irq lands on */ | ||
5415 | rtl8169_schedule_work(dev, rtl8169_reset_task); | 5416 | rtl8169_schedule_work(dev, rtl8169_reset_task); |
5416 | } | 5417 | } |
5417 | 5418 | ||
@@ -5804,6 +5805,10 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) | |||
5804 | */ | 5805 | */ |
5805 | status = RTL_R16(IntrStatus); | 5806 | status = RTL_R16(IntrStatus); |
5806 | while (status && status != 0xffff) { | 5807 | while (status && status != 0xffff) { |
5808 | status &= tp->intr_event; | ||
5809 | if (!status) | ||
5810 | break; | ||
5811 | |||
5807 | handled = 1; | 5812 | handled = 1; |
5808 | 5813 | ||
5809 | /* Handle all of the error cases first. These will reset | 5814 | /* Handle all of the error cases first. These will reset |
@@ -5818,27 +5823,9 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) | |||
5818 | switch (tp->mac_version) { | 5823 | switch (tp->mac_version) { |
5819 | /* Work around for rx fifo overflow */ | 5824 | /* Work around for rx fifo overflow */ |
5820 | case RTL_GIGA_MAC_VER_11: | 5825 | case RTL_GIGA_MAC_VER_11: |
5821 | case RTL_GIGA_MAC_VER_22: | ||
5822 | case RTL_GIGA_MAC_VER_26: | ||
5823 | netif_stop_queue(dev); | 5826 | netif_stop_queue(dev); |
5824 | rtl8169_tx_timeout(dev); | 5827 | rtl8169_tx_timeout(dev); |
5825 | goto done; | 5828 | goto done; |
5826 | /* Testers needed. */ | ||
5827 | case RTL_GIGA_MAC_VER_17: | ||
5828 | case RTL_GIGA_MAC_VER_19: | ||
5829 | case RTL_GIGA_MAC_VER_20: | ||
5830 | case RTL_GIGA_MAC_VER_21: | ||
5831 | case RTL_GIGA_MAC_VER_23: | ||
5832 | case RTL_GIGA_MAC_VER_24: | ||
5833 | case RTL_GIGA_MAC_VER_27: | ||
5834 | case RTL_GIGA_MAC_VER_28: | ||
5835 | case RTL_GIGA_MAC_VER_31: | ||
5836 | /* Experimental science. Pktgen proof. */ | ||
5837 | case RTL_GIGA_MAC_VER_12: | ||
5838 | case RTL_GIGA_MAC_VER_25: | ||
5839 | if (status == RxFIFOOver) | ||
5840 | goto done; | ||
5841 | break; | ||
5842 | default: | 5829 | default: |
5843 | break; | 5830 | break; |
5844 | } | 5831 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8ea770a89f25..72cd190b9c1a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -781,10 +781,15 @@ static void stmmac_mmc_setup(struct stmmac_priv *priv) | |||
781 | unsigned int mode = MMC_CNTRL_RESET_ON_READ | MMC_CNTRL_COUNTER_RESET | | 781 | unsigned int mode = MMC_CNTRL_RESET_ON_READ | MMC_CNTRL_COUNTER_RESET | |
782 | MMC_CNTRL_PRESET | MMC_CNTRL_FULL_HALF_PRESET; | 782 | MMC_CNTRL_PRESET | MMC_CNTRL_FULL_HALF_PRESET; |
783 | 783 | ||
784 | /* Do not manage MMC IRQ (FIXME) */ | 784 | /* Mask MMC irq, counters are managed in SW and registers |
785 | * are cleared on each READ eventually. */ | ||
785 | dwmac_mmc_intr_all_mask(priv->ioaddr); | 786 | dwmac_mmc_intr_all_mask(priv->ioaddr); |
786 | dwmac_mmc_ctrl(priv->ioaddr, mode); | 787 | |
787 | memset(&priv->mmc, 0, sizeof(struct stmmac_counters)); | 788 | if (priv->dma_cap.rmon) { |
789 | dwmac_mmc_ctrl(priv->ioaddr, mode); | ||
790 | memset(&priv->mmc, 0, sizeof(struct stmmac_counters)); | ||
791 | } else | ||
792 | pr_info(" No MAC Management Counters available"); | ||
788 | } | 793 | } |
789 | 794 | ||
790 | static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv) | 795 | static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv) |
@@ -1012,8 +1017,7 @@ static int stmmac_open(struct net_device *dev) | |||
1012 | memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); | 1017 | memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); |
1013 | priv->xstats.threshold = tc; | 1018 | priv->xstats.threshold = tc; |
1014 | 1019 | ||
1015 | if (priv->dma_cap.rmon) | 1020 | stmmac_mmc_setup(priv); |
1016 | stmmac_mmc_setup(priv); | ||
1017 | 1021 | ||
1018 | /* Start the ball rolling... */ | 1022 | /* Start the ball rolling... */ |
1019 | DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name); | 1023 | DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name); |
diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c index 10826d8a2a2d..1187a1169eb2 100644 --- a/drivers/net/ethernet/tile/tilepro.c +++ b/drivers/net/ethernet/tile/tilepro.c | |||
@@ -926,7 +926,7 @@ static int tile_net_poll(struct napi_struct *napi, int budget) | |||
926 | goto done; | 926 | goto done; |
927 | 927 | ||
928 | /* Re-enable the ingress interrupt. */ | 928 | /* Re-enable the ingress interrupt. */ |
929 | enable_percpu_irq(priv->intr_id); | 929 | enable_percpu_irq(priv->intr_id, 0); |
930 | 930 | ||
931 | /* HACK: Avoid the "rotting packet" problem (see above). */ | 931 | /* HACK: Avoid the "rotting packet" problem (see above). */ |
932 | if (qup->__packet_receive_read != | 932 | if (qup->__packet_receive_read != |
@@ -1296,7 +1296,7 @@ static void tile_net_open_enable(void *dev_ptr) | |||
1296 | info->napi_enabled = true; | 1296 | info->napi_enabled = true; |
1297 | 1297 | ||
1298 | /* Enable the ingress interrupt. */ | 1298 | /* Enable the ingress interrupt. */ |
1299 | enable_percpu_irq(priv->intr_id); | 1299 | enable_percpu_irq(priv->intr_id, 0); |
1300 | } | 1300 | } |
1301 | 1301 | ||
1302 | 1302 | ||
@@ -1697,7 +1697,7 @@ static unsigned int tile_net_tx_frags(lepp_frag_t *frags, | |||
1697 | for (i = 0; i < sh->nr_frags; i++) { | 1697 | for (i = 0; i < sh->nr_frags; i++) { |
1698 | 1698 | ||
1699 | skb_frag_t *f = &sh->frags[i]; | 1699 | skb_frag_t *f = &sh->frags[i]; |
1700 | unsigned long pfn = page_to_pfn(f->page); | 1700 | unsigned long pfn = page_to_pfn(skb_frag_page(f)); |
1701 | 1701 | ||
1702 | /* FIXME: Compute "hash_for_home" properly. */ | 1702 | /* FIXME: Compute "hash_for_home" properly. */ |
1703 | /* ISSUE: The hypervisor checks CHIP_HAS_REV1_DMA_PACKETS(). */ | 1703 | /* ISSUE: The hypervisor checks CHIP_HAS_REV1_DMA_PACKETS(). */ |
@@ -1706,7 +1706,7 @@ static unsigned int tile_net_tx_frags(lepp_frag_t *frags, | |||
1706 | /* FIXME: Hmmm. */ | 1706 | /* FIXME: Hmmm. */ |
1707 | if (!hash_default) { | 1707 | if (!hash_default) { |
1708 | void *va = pfn_to_kaddr(pfn) + f->page_offset; | 1708 | void *va = pfn_to_kaddr(pfn) + f->page_offset; |
1709 | BUG_ON(PageHighMem(f->page)); | 1709 | BUG_ON(PageHighMem(skb_frag_page(f))); |
1710 | finv_buffer_remote(va, f->size, 0); | 1710 | finv_buffer_remote(va, f->size, 0); |
1711 | } | 1711 | } |
1712 | 1712 | ||
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index bb88e12101c7..a70244306c94 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig PHYLIB | 5 | menuconfig PHYLIB |
6 | bool "PHY Device support and infrastructure" | 6 | tristate "PHY Device support and infrastructure" |
7 | depends on !S390 | 7 | depends on !S390 |
8 | depends on NETDEVICES | 8 | depends on NETDEVICES |
9 | help | 9 | help |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index e12b48c2cff6..dd008b0e6417 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -191,6 +191,7 @@ static struct iwl_base_params iwl1000_base_params = { | |||
191 | .chain_noise_scale = 1000, | 191 | .chain_noise_scale = 1000, |
192 | .wd_timeout = IWL_DEF_WD_TIMEOUT, | 192 | .wd_timeout = IWL_DEF_WD_TIMEOUT, |
193 | .max_event_log_size = 128, | 193 | .max_event_log_size = 128, |
194 | .wd_disable = true, | ||
194 | }; | 195 | }; |
195 | static struct iwl_ht_params iwl1000_ht_params = { | 196 | static struct iwl_ht_params iwl1000_ht_params = { |
196 | .ht_greenfield_support = true, | 197 | .ht_greenfield_support = true, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index c511c98a89a8..f55fb2d1af52 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -364,6 +364,7 @@ static struct iwl_base_params iwl5000_base_params = { | |||
364 | .wd_timeout = IWL_LONG_WD_TIMEOUT, | 364 | .wd_timeout = IWL_LONG_WD_TIMEOUT, |
365 | .max_event_log_size = 512, | 365 | .max_event_log_size = 512, |
366 | .no_idle_support = true, | 366 | .no_idle_support = true, |
367 | .wd_disable = true, | ||
367 | }; | 368 | }; |
368 | static struct iwl_ht_params iwl5000_ht_params = { | 369 | static struct iwl_ht_params iwl5000_ht_params = { |
369 | .ht_greenfield_support = true, | 370 | .ht_greenfield_support = true, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c index 58a381c01c89..a7a6def40d05 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c | |||
@@ -528,6 +528,24 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
528 | return 0; | 528 | return 0; |
529 | } | 529 | } |
530 | 530 | ||
531 | void iwlagn_config_ht40(struct ieee80211_conf *conf, | ||
532 | struct iwl_rxon_context *ctx) | ||
533 | { | ||
534 | if (conf_is_ht40_minus(conf)) { | ||
535 | ctx->ht.extension_chan_offset = | ||
536 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; | ||
537 | ctx->ht.is_40mhz = true; | ||
538 | } else if (conf_is_ht40_plus(conf)) { | ||
539 | ctx->ht.extension_chan_offset = | ||
540 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | ||
541 | ctx->ht.is_40mhz = true; | ||
542 | } else { | ||
543 | ctx->ht.extension_chan_offset = | ||
544 | IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
545 | ctx->ht.is_40mhz = false; | ||
546 | } | ||
547 | } | ||
548 | |||
531 | int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) | 549 | int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) |
532 | { | 550 | { |
533 | struct iwl_priv *priv = hw->priv; | 551 | struct iwl_priv *priv = hw->priv; |
@@ -586,19 +604,11 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
586 | ctx->ht.enabled = conf_is_ht(conf); | 604 | ctx->ht.enabled = conf_is_ht(conf); |
587 | 605 | ||
588 | if (ctx->ht.enabled) { | 606 | if (ctx->ht.enabled) { |
589 | if (conf_is_ht40_minus(conf)) { | 607 | /* if HT40 is used, it should not change |
590 | ctx->ht.extension_chan_offset = | 608 | * after associated except channel switch */ |
591 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; | 609 | if (iwl_is_associated_ctx(ctx) && |
592 | ctx->ht.is_40mhz = true; | 610 | !ctx->ht.is_40mhz) |
593 | } else if (conf_is_ht40_plus(conf)) { | 611 | iwlagn_config_ht40(conf, ctx); |
594 | ctx->ht.extension_chan_offset = | ||
595 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | ||
596 | ctx->ht.is_40mhz = true; | ||
597 | } else { | ||
598 | ctx->ht.extension_chan_offset = | ||
599 | IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
600 | ctx->ht.is_40mhz = false; | ||
601 | } | ||
602 | } else | 612 | } else |
603 | ctx->ht.is_40mhz = false; | 613 | ctx->ht.is_40mhz = false; |
604 | 614 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c index ed6283623932..4b2aa1da0953 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c | |||
@@ -1268,9 +1268,6 @@ int iwl_set_dynamic_key(struct iwl_priv *priv, | |||
1268 | 1268 | ||
1269 | switch (keyconf->cipher) { | 1269 | switch (keyconf->cipher) { |
1270 | case WLAN_CIPHER_SUITE_TKIP: | 1270 | case WLAN_CIPHER_SUITE_TKIP: |
1271 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | ||
1272 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | ||
1273 | |||
1274 | if (sta) | 1271 | if (sta) |
1275 | addr = sta->addr; | 1272 | addr = sta->addr; |
1276 | else /* station mode case only */ | 1273 | else /* station mode case only */ |
@@ -1283,8 +1280,6 @@ int iwl_set_dynamic_key(struct iwl_priv *priv, | |||
1283 | seq.tkip.iv32, p1k, CMD_SYNC); | 1280 | seq.tkip.iv32, p1k, CMD_SYNC); |
1284 | break; | 1281 | break; |
1285 | case WLAN_CIPHER_SUITE_CCMP: | 1282 | case WLAN_CIPHER_SUITE_CCMP: |
1286 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | ||
1287 | /* fall through */ | ||
1288 | case WLAN_CIPHER_SUITE_WEP40: | 1283 | case WLAN_CIPHER_SUITE_WEP40: |
1289 | case WLAN_CIPHER_SUITE_WEP104: | 1284 | case WLAN_CIPHER_SUITE_WEP104: |
1290 | ret = iwlagn_send_sta_key(priv, keyconf, sta_id, | 1285 | ret = iwlagn_send_sta_key(priv, keyconf, sta_id, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index ccba69b7f8a7..bacc06c95e7a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -2316,6 +2316,17 @@ static int iwlagn_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2316 | return -EOPNOTSUPP; | 2316 | return -EOPNOTSUPP; |
2317 | } | 2317 | } |
2318 | 2318 | ||
2319 | switch (key->cipher) { | ||
2320 | case WLAN_CIPHER_SUITE_TKIP: | ||
2321 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | ||
2322 | /* fall through */ | ||
2323 | case WLAN_CIPHER_SUITE_CCMP: | ||
2324 | key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | ||
2325 | break; | ||
2326 | default: | ||
2327 | break; | ||
2328 | } | ||
2329 | |||
2319 | /* | 2330 | /* |
2320 | * We could program these keys into the hardware as well, but we | 2331 | * We could program these keys into the hardware as well, but we |
2321 | * don't expect much multicast traffic in IBSS and having keys | 2332 | * don't expect much multicast traffic in IBSS and having keys |
@@ -2599,21 +2610,9 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw, | |||
2599 | 2610 | ||
2600 | /* Configure HT40 channels */ | 2611 | /* Configure HT40 channels */ |
2601 | ctx->ht.enabled = conf_is_ht(conf); | 2612 | ctx->ht.enabled = conf_is_ht(conf); |
2602 | if (ctx->ht.enabled) { | 2613 | if (ctx->ht.enabled) |
2603 | if (conf_is_ht40_minus(conf)) { | 2614 | iwlagn_config_ht40(conf, ctx); |
2604 | ctx->ht.extension_chan_offset = | 2615 | else |
2605 | IEEE80211_HT_PARAM_CHA_SEC_BELOW; | ||
2606 | ctx->ht.is_40mhz = true; | ||
2607 | } else if (conf_is_ht40_plus(conf)) { | ||
2608 | ctx->ht.extension_chan_offset = | ||
2609 | IEEE80211_HT_PARAM_CHA_SEC_ABOVE; | ||
2610 | ctx->ht.is_40mhz = true; | ||
2611 | } else { | ||
2612 | ctx->ht.extension_chan_offset = | ||
2613 | IEEE80211_HT_PARAM_CHA_SEC_NONE; | ||
2614 | ctx->ht.is_40mhz = false; | ||
2615 | } | ||
2616 | } else | ||
2617 | ctx->ht.is_40mhz = false; | 2616 | ctx->ht.is_40mhz = false; |
2618 | 2617 | ||
2619 | if ((le16_to_cpu(ctx->staging.channel) != ch)) | 2618 | if ((le16_to_cpu(ctx->staging.channel) != ch)) |
@@ -3499,9 +3498,10 @@ MODULE_PARM_DESC(plcp_check, "Check plcp health (default: 1 [enabled])"); | |||
3499 | module_param_named(ack_check, iwlagn_mod_params.ack_check, bool, S_IRUGO); | 3498 | module_param_named(ack_check, iwlagn_mod_params.ack_check, bool, S_IRUGO); |
3500 | MODULE_PARM_DESC(ack_check, "Check ack health (default: 0 [disabled])"); | 3499 | MODULE_PARM_DESC(ack_check, "Check ack health (default: 0 [disabled])"); |
3501 | 3500 | ||
3502 | module_param_named(wd_disable, iwlagn_mod_params.wd_disable, bool, S_IRUGO); | 3501 | module_param_named(wd_disable, iwlagn_mod_params.wd_disable, int, S_IRUGO); |
3503 | MODULE_PARM_DESC(wd_disable, | 3502 | MODULE_PARM_DESC(wd_disable, |
3504 | "Disable stuck queue watchdog timer (default: 0 [enabled])"); | 3503 | "Disable stuck queue watchdog timer 0=system default, " |
3504 | "1=disable, 2=enable (default: 0)"); | ||
3505 | 3505 | ||
3506 | /* | 3506 | /* |
3507 | * set bt_coex_active to true, uCode will do kill/defer | 3507 | * set bt_coex_active to true, uCode will do kill/defer |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h index 5b936ec1a541..3856abaea507 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn.h | |||
@@ -86,6 +86,8 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
86 | struct ieee80211_vif *vif, | 86 | struct ieee80211_vif *vif, |
87 | struct ieee80211_bss_conf *bss_conf, | 87 | struct ieee80211_bss_conf *bss_conf, |
88 | u32 changes); | 88 | u32 changes); |
89 | void iwlagn_config_ht40(struct ieee80211_conf *conf, | ||
90 | struct iwl_rxon_context *ctx); | ||
89 | 91 | ||
90 | /* uCode */ | 92 | /* uCode */ |
91 | int iwlagn_rx_calib_result(struct iwl_priv *priv, | 93 | int iwlagn_rx_calib_result(struct iwl_priv *priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 001fdf140abb..fcf54160e4ed 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -1810,11 +1810,23 @@ void iwl_setup_watchdog(struct iwl_priv *priv) | |||
1810 | { | 1810 | { |
1811 | unsigned int timeout = priv->cfg->base_params->wd_timeout; | 1811 | unsigned int timeout = priv->cfg->base_params->wd_timeout; |
1812 | 1812 | ||
1813 | if (timeout && !iwlagn_mod_params.wd_disable) | 1813 | if (!iwlagn_mod_params.wd_disable) { |
1814 | mod_timer(&priv->watchdog, | 1814 | /* use system default */ |
1815 | jiffies + msecs_to_jiffies(IWL_WD_TICK(timeout))); | 1815 | if (timeout && !priv->cfg->base_params->wd_disable) |
1816 | else | 1816 | mod_timer(&priv->watchdog, |
1817 | del_timer(&priv->watchdog); | 1817 | jiffies + |
1818 | msecs_to_jiffies(IWL_WD_TICK(timeout))); | ||
1819 | else | ||
1820 | del_timer(&priv->watchdog); | ||
1821 | } else { | ||
1822 | /* module parameter overwrite default configuration */ | ||
1823 | if (timeout && iwlagn_mod_params.wd_disable == 2) | ||
1824 | mod_timer(&priv->watchdog, | ||
1825 | jiffies + | ||
1826 | msecs_to_jiffies(IWL_WD_TICK(timeout))); | ||
1827 | else | ||
1828 | del_timer(&priv->watchdog); | ||
1829 | } | ||
1818 | } | 1830 | } |
1819 | 1831 | ||
1820 | /** | 1832 | /** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 137da3380704..f2fc288f3dd3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -113,6 +113,7 @@ struct iwl_lib_ops { | |||
113 | * @shadow_reg_enable: HW shadhow register bit | 113 | * @shadow_reg_enable: HW shadhow register bit |
114 | * @no_idle_support: do not support idle mode | 114 | * @no_idle_support: do not support idle mode |
115 | * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up | 115 | * @hd_v2: v2 of enhanced sensitivity value, used for 2000 series and up |
116 | * wd_disable: disable watchdog timer | ||
116 | */ | 117 | */ |
117 | struct iwl_base_params { | 118 | struct iwl_base_params { |
118 | int eeprom_size; | 119 | int eeprom_size; |
@@ -134,6 +135,7 @@ struct iwl_base_params { | |||
134 | const bool shadow_reg_enable; | 135 | const bool shadow_reg_enable; |
135 | const bool no_idle_support; | 136 | const bool no_idle_support; |
136 | const bool hd_v2; | 137 | const bool hd_v2; |
138 | const bool wd_disable; | ||
137 | }; | 139 | }; |
138 | /* | 140 | /* |
139 | * @advanced_bt_coexist: support advanced bt coexist | 141 | * @advanced_bt_coexist: support advanced bt coexist |
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h index 1f7a93c67c45..14eaf37ce3b1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-shared.h +++ b/drivers/net/wireless/iwlwifi/iwl-shared.h | |||
@@ -120,7 +120,7 @@ extern struct iwl_mod_params iwlagn_mod_params; | |||
120 | * @restart_fw: restart firmware, default = 1 | 120 | * @restart_fw: restart firmware, default = 1 |
121 | * @plcp_check: enable plcp health check, default = true | 121 | * @plcp_check: enable plcp health check, default = true |
122 | * @ack_check: disable ack health check, default = false | 122 | * @ack_check: disable ack health check, default = false |
123 | * @wd_disable: enable stuck queue check, default = false | 123 | * @wd_disable: enable stuck queue check, default = 0 |
124 | * @bt_coex_active: enable bt coex, default = true | 124 | * @bt_coex_active: enable bt coex, default = true |
125 | * @led_mode: system default, default = 0 | 125 | * @led_mode: system default, default = 0 |
126 | * @no_sleep_autoadjust: disable autoadjust, default = true | 126 | * @no_sleep_autoadjust: disable autoadjust, default = true |
@@ -141,7 +141,7 @@ struct iwl_mod_params { | |||
141 | int restart_fw; | 141 | int restart_fw; |
142 | bool plcp_check; | 142 | bool plcp_check; |
143 | bool ack_check; | 143 | bool ack_check; |
144 | bool wd_disable; | 144 | int wd_disable; |
145 | bool bt_coex_active; | 145 | bool bt_coex_active; |
146 | int led_mode; | 146 | int led_mode; |
147 | bool no_sleep_autoadjust; | 147 | bool no_sleep_autoadjust; |
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c index f18df82eeb92..78d0d6988553 100644 --- a/drivers/net/wireless/p54/p54spi.c +++ b/drivers/net/wireless/p54/p54spi.c | |||
@@ -588,8 +588,6 @@ static void p54spi_op_stop(struct ieee80211_hw *dev) | |||
588 | 588 | ||
589 | WARN_ON(priv->fw_state != FW_STATE_READY); | 589 | WARN_ON(priv->fw_state != FW_STATE_READY); |
590 | 590 | ||
591 | cancel_work_sync(&priv->work); | ||
592 | |||
593 | p54spi_power_off(priv); | 591 | p54spi_power_off(priv); |
594 | spin_lock_irqsave(&priv->tx_lock, flags); | 592 | spin_lock_irqsave(&priv->tx_lock, flags); |
595 | INIT_LIST_HEAD(&priv->tx_pending); | 593 | INIT_LIST_HEAD(&priv->tx_pending); |
@@ -597,6 +595,8 @@ static void p54spi_op_stop(struct ieee80211_hw *dev) | |||
597 | 595 | ||
598 | priv->fw_state = FW_STATE_OFF; | 596 | priv->fw_state = FW_STATE_OFF; |
599 | mutex_unlock(&priv->mutex); | 597 | mutex_unlock(&priv->mutex); |
598 | |||
599 | cancel_work_sync(&priv->work); | ||
600 | } | 600 | } |
601 | 601 | ||
602 | static int __devinit p54spi_probe(struct spi_device *spi) | 602 | static int __devinit p54spi_probe(struct spi_device *spi) |
@@ -656,6 +656,7 @@ static int __devinit p54spi_probe(struct spi_device *spi) | |||
656 | init_completion(&priv->fw_comp); | 656 | init_completion(&priv->fw_comp); |
657 | INIT_LIST_HEAD(&priv->tx_pending); | 657 | INIT_LIST_HEAD(&priv->tx_pending); |
658 | mutex_init(&priv->mutex); | 658 | mutex_init(&priv->mutex); |
659 | spin_lock_init(&priv->tx_lock); | ||
659 | SET_IEEE80211_DEV(hw, &spi->dev); | 660 | SET_IEEE80211_DEV(hw, &spi->dev); |
660 | priv->common.open = p54spi_op_start; | 661 | priv->common.open = p54spi_op_start; |
661 | priv->common.stop = p54spi_op_stop; | 662 | priv->common.stop = p54spi_op_stop; |
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c index d97a2caf582b..bc2ba80c47bb 100644 --- a/drivers/net/wireless/prism54/isl_ioctl.c +++ b/drivers/net/wireless/prism54/isl_ioctl.c | |||
@@ -778,7 +778,7 @@ prism54_get_essid(struct net_device *ndev, struct iw_request_info *info, | |||
778 | dwrq->flags = 0; | 778 | dwrq->flags = 0; |
779 | dwrq->length = 0; | 779 | dwrq->length = 0; |
780 | } | 780 | } |
781 | essid->octets[essid->length] = '\0'; | 781 | essid->octets[dwrq->length] = '\0'; |
782 | memcpy(extra, essid->octets, dwrq->length); | 782 | memcpy(extra, essid->octets, dwrq->length); |
783 | kfree(essid); | 783 | kfree(essid); |
784 | 784 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 3f183a15186e..1ba079dffb11 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -3771,7 +3771,7 @@ static void rt2800_efuse_read(struct rt2x00_dev *rt2x00dev, unsigned int i) | |||
3771 | /* Apparently the data is read from end to start */ | 3771 | /* Apparently the data is read from end to start */ |
3772 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3, ®); | 3772 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3, ®); |
3773 | /* The returned value is in CPU order, but eeprom is le */ | 3773 | /* The returned value is in CPU order, but eeprom is le */ |
3774 | rt2x00dev->eeprom[i] = cpu_to_le32(reg); | 3774 | *(u32 *)&rt2x00dev->eeprom[i] = cpu_to_le32(reg); |
3775 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2, ®); | 3775 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2, ®); |
3776 | *(u32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg); | 3776 | *(u32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg); |
3777 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1, ®); | 3777 | rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1, ®); |
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c index db5262844543..55c8e50f45fd 100644 --- a/drivers/net/wireless/rtlwifi/ps.c +++ b/drivers/net/wireless/rtlwifi/ps.c | |||
@@ -395,7 +395,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw) | |||
395 | if (mac->link_state != MAC80211_LINKED) | 395 | if (mac->link_state != MAC80211_LINKED) |
396 | return; | 396 | return; |
397 | 397 | ||
398 | spin_lock(&rtlpriv->locks.lps_lock); | 398 | spin_lock_irq(&rtlpriv->locks.lps_lock); |
399 | 399 | ||
400 | /* Idle for a while if we connect to AP a while ago. */ | 400 | /* Idle for a while if we connect to AP a while ago. */ |
401 | if (mac->cnt_after_linked >= 2) { | 401 | if (mac->cnt_after_linked >= 2) { |
@@ -407,7 +407,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw) | |||
407 | } | 407 | } |
408 | } | 408 | } |
409 | 409 | ||
410 | spin_unlock(&rtlpriv->locks.lps_lock); | 410 | spin_unlock_irq(&rtlpriv->locks.lps_lock); |
411 | } | 411 | } |
412 | 412 | ||
413 | /*Leave the leisure power save mode.*/ | 413 | /*Leave the leisure power save mode.*/ |
@@ -416,8 +416,9 @@ void rtl_lps_leave(struct ieee80211_hw *hw) | |||
416 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 416 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
417 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); | 417 | struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); |
418 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); | 418 | struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); |
419 | unsigned long flags; | ||
419 | 420 | ||
420 | spin_lock(&rtlpriv->locks.lps_lock); | 421 | spin_lock_irqsave(&rtlpriv->locks.lps_lock, flags); |
421 | 422 | ||
422 | if (ppsc->fwctrl_lps) { | 423 | if (ppsc->fwctrl_lps) { |
423 | if (ppsc->dot11_psmode != EACTIVE) { | 424 | if (ppsc->dot11_psmode != EACTIVE) { |
@@ -438,7 +439,7 @@ void rtl_lps_leave(struct ieee80211_hw *hw) | |||
438 | rtl_lps_set_psmode(hw, EACTIVE); | 439 | rtl_lps_set_psmode(hw, EACTIVE); |
439 | } | 440 | } |
440 | } | 441 | } |
441 | spin_unlock(&rtlpriv->locks.lps_lock); | 442 | spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flags); |
442 | } | 443 | } |
443 | 444 | ||
444 | /* For sw LPS*/ | 445 | /* For sw LPS*/ |
@@ -539,9 +540,9 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw) | |||
539 | RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); | 540 | RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); |
540 | } | 541 | } |
541 | 542 | ||
542 | spin_lock(&rtlpriv->locks.lps_lock); | 543 | spin_lock_irq(&rtlpriv->locks.lps_lock); |
543 | rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS); | 544 | rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS); |
544 | spin_unlock(&rtlpriv->locks.lps_lock); | 545 | spin_unlock_irq(&rtlpriv->locks.lps_lock); |
545 | } | 546 | } |
546 | 547 | ||
547 | void rtl_swlps_rfon_wq_callback(void *data) | 548 | void rtl_swlps_rfon_wq_callback(void *data) |
@@ -574,9 +575,9 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) | |||
574 | if (rtlpriv->link_info.busytraffic) | 575 | if (rtlpriv->link_info.busytraffic) |
575 | return; | 576 | return; |
576 | 577 | ||
577 | spin_lock(&rtlpriv->locks.lps_lock); | 578 | spin_lock_irq(&rtlpriv->locks.lps_lock); |
578 | rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS); | 579 | rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS); |
579 | spin_unlock(&rtlpriv->locks.lps_lock); | 580 | spin_unlock_irq(&rtlpriv->locks.lps_lock); |
580 | 581 | ||
581 | if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && | 582 | if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && |
582 | !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { | 583 | !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 0cb594c86090..15e332d08c8d 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -1021,7 +1021,7 @@ static int xen_netbk_tx_check_gop(struct xen_netbk *netbk, | |||
1021 | pending_idx = *((u16 *)skb->data); | 1021 | pending_idx = *((u16 *)skb->data); |
1022 | xen_netbk_idx_release(netbk, pending_idx); | 1022 | xen_netbk_idx_release(netbk, pending_idx); |
1023 | for (j = start; j < i; j++) { | 1023 | for (j = start; j < i; j++) { |
1024 | pending_idx = frag_get_pending_idx(&shinfo->frags[i]); | 1024 | pending_idx = frag_get_pending_idx(&shinfo->frags[j]); |
1025 | xen_netbk_idx_release(netbk, pending_idx); | 1025 | xen_netbk_idx_release(netbk, pending_idx); |
1026 | } | 1026 | } |
1027 | 1027 | ||
@@ -1668,7 +1668,7 @@ static int __init netback_init(void) | |||
1668 | "netback/%u", group); | 1668 | "netback/%u", group); |
1669 | 1669 | ||
1670 | if (IS_ERR(netbk->task)) { | 1670 | if (IS_ERR(netbk->task)) { |
1671 | printk(KERN_ALERT "kthread_run() fails at netback\n"); | 1671 | printk(KERN_ALERT "kthread_create() fails at netback\n"); |
1672 | del_timer(&netbk->net_timer); | 1672 | del_timer(&netbk->net_timer); |
1673 | rc = PTR_ERR(netbk->task); | 1673 | rc = PTR_ERR(netbk->task); |
1674 | goto failed_init; | 1674 | goto failed_init; |
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 19c0115092dd..0f0cfa3bca30 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
@@ -26,11 +26,6 @@ | |||
26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | 28 | ||
29 | /* For archs that don't support NO_IRQ (such as x86), provide a dummy value */ | ||
30 | #ifndef NO_IRQ | ||
31 | #define NO_IRQ 0 | ||
32 | #endif | ||
33 | |||
34 | /** | 29 | /** |
35 | * irq_of_parse_and_map - Parse and map an interrupt into linux virq space | 30 | * irq_of_parse_and_map - Parse and map an interrupt into linux virq space |
36 | * @device: Device node of the device whose interrupt is to be mapped | 31 | * @device: Device node of the device whose interrupt is to be mapped |
@@ -44,7 +39,7 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index) | |||
44 | struct of_irq oirq; | 39 | struct of_irq oirq; |
45 | 40 | ||
46 | if (of_irq_map_one(dev, index, &oirq)) | 41 | if (of_irq_map_one(dev, index, &oirq)) |
47 | return NO_IRQ; | 42 | return 0; |
48 | 43 | ||
49 | return irq_create_of_mapping(oirq.controller, oirq.specifier, | 44 | return irq_create_of_mapping(oirq.controller, oirq.specifier, |
50 | oirq.size); | 45 | oirq.size); |
@@ -345,7 +340,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) | |||
345 | 340 | ||
346 | /* Only dereference the resource if both the | 341 | /* Only dereference the resource if both the |
347 | * resource and the irq are valid. */ | 342 | * resource and the irq are valid. */ |
348 | if (r && irq != NO_IRQ) { | 343 | if (r && irq) { |
349 | r->start = r->end = irq; | 344 | r->start = r->end = irq; |
350 | r->flags = IORESOURCE_IRQ; | 345 | r->flags = IORESOURCE_IRQ; |
351 | r->name = dev->full_name; | 346 | r->name = dev->full_name; |
@@ -363,7 +358,7 @@ int of_irq_count(struct device_node *dev) | |||
363 | { | 358 | { |
364 | int nr = 0; | 359 | int nr = 0; |
365 | 360 | ||
366 | while (of_irq_to_resource(dev, nr, NULL) != NO_IRQ) | 361 | while (of_irq_to_resource(dev, nr, NULL)) |
367 | nr++; | 362 | nr++; |
368 | 363 | ||
369 | return nr; | 364 | return nr; |
@@ -383,7 +378,7 @@ int of_irq_to_resource_table(struct device_node *dev, struct resource *res, | |||
383 | int i; | 378 | int i; |
384 | 379 | ||
385 | for (i = 0; i < nr_irqs; i++, res++) | 380 | for (i = 0; i < nr_irqs; i++, res++) |
386 | if (of_irq_to_resource(dev, i, res) == NO_IRQ) | 381 | if (!of_irq_to_resource(dev, i, res)) |
387 | break; | 382 | break; |
388 | 383 | ||
389 | return i; | 384 | return i; |
diff --git a/drivers/oprofile/oprof.c b/drivers/oprofile/oprof.c index dccd8636095c..f8c752e408a6 100644 --- a/drivers/oprofile/oprof.c +++ b/drivers/oprofile/oprof.c | |||
@@ -239,26 +239,45 @@ int oprofile_set_ulong(unsigned long *addr, unsigned long val) | |||
239 | return err; | 239 | return err; |
240 | } | 240 | } |
241 | 241 | ||
242 | static int timer_mode; | ||
243 | |||
242 | static int __init oprofile_init(void) | 244 | static int __init oprofile_init(void) |
243 | { | 245 | { |
244 | int err; | 246 | int err; |
245 | 247 | ||
248 | /* always init architecture to setup backtrace support */ | ||
246 | err = oprofile_arch_init(&oprofile_ops); | 249 | err = oprofile_arch_init(&oprofile_ops); |
247 | if (err < 0 || timer) { | 250 | |
248 | printk(KERN_INFO "oprofile: using timer interrupt.\n"); | 251 | timer_mode = err || timer; /* fall back to timer mode on errors */ |
252 | if (timer_mode) { | ||
253 | if (!err) | ||
254 | oprofile_arch_exit(); | ||
249 | err = oprofile_timer_init(&oprofile_ops); | 255 | err = oprofile_timer_init(&oprofile_ops); |
250 | if (err) | 256 | if (err) |
251 | return err; | 257 | return err; |
252 | } | 258 | } |
253 | return oprofilefs_register(); | 259 | |
260 | err = oprofilefs_register(); | ||
261 | if (!err) | ||
262 | return 0; | ||
263 | |||
264 | /* failed */ | ||
265 | if (timer_mode) | ||
266 | oprofile_timer_exit(); | ||
267 | else | ||
268 | oprofile_arch_exit(); | ||
269 | |||
270 | return err; | ||
254 | } | 271 | } |
255 | 272 | ||
256 | 273 | ||
257 | static void __exit oprofile_exit(void) | 274 | static void __exit oprofile_exit(void) |
258 | { | 275 | { |
259 | oprofile_timer_exit(); | ||
260 | oprofilefs_unregister(); | 276 | oprofilefs_unregister(); |
261 | oprofile_arch_exit(); | 277 | if (timer_mode) |
278 | oprofile_timer_exit(); | ||
279 | else | ||
280 | oprofile_arch_exit(); | ||
262 | } | 281 | } |
263 | 282 | ||
264 | 283 | ||
diff --git a/drivers/oprofile/timer_int.c b/drivers/oprofile/timer_int.c index 3ef44624f510..878fba126582 100644 --- a/drivers/oprofile/timer_int.c +++ b/drivers/oprofile/timer_int.c | |||
@@ -110,6 +110,7 @@ int oprofile_timer_init(struct oprofile_operations *ops) | |||
110 | ops->start = oprofile_hrtimer_start; | 110 | ops->start = oprofile_hrtimer_start; |
111 | ops->stop = oprofile_hrtimer_stop; | 111 | ops->stop = oprofile_hrtimer_stop; |
112 | ops->cpu_type = "timer"; | 112 | ops->cpu_type = "timer"; |
113 | printk(KERN_INFO "oprofile: using timer interrupt.\n"); | ||
113 | return 0; | 114 | return 0; |
114 | } | 115 | } |
115 | 116 | ||
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 13ef8c37471d..dcdc1f4a4624 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -121,6 +121,7 @@ struct toshiba_acpi_dev { | |||
121 | int illumination_supported:1; | 121 | int illumination_supported:1; |
122 | int video_supported:1; | 122 | int video_supported:1; |
123 | int fan_supported:1; | 123 | int fan_supported:1; |
124 | int system_event_supported:1; | ||
124 | 125 | ||
125 | struct mutex mutex; | 126 | struct mutex mutex; |
126 | }; | 127 | }; |
@@ -724,7 +725,7 @@ static int keys_proc_show(struct seq_file *m, void *v) | |||
724 | u32 hci_result; | 725 | u32 hci_result; |
725 | u32 value; | 726 | u32 value; |
726 | 727 | ||
727 | if (!dev->key_event_valid) { | 728 | if (!dev->key_event_valid && dev->system_event_supported) { |
728 | hci_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); | 729 | hci_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); |
729 | if (hci_result == HCI_SUCCESS) { | 730 | if (hci_result == HCI_SUCCESS) { |
730 | dev->key_event_valid = 1; | 731 | dev->key_event_valid = 1; |
@@ -964,6 +965,8 @@ static int __devinit toshiba_acpi_add(struct acpi_device *acpi_dev) | |||
964 | 965 | ||
965 | /* enable event fifo */ | 966 | /* enable event fifo */ |
966 | hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); | 967 | hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); |
968 | if (hci_result == HCI_SUCCESS) | ||
969 | dev->system_event_supported = 1; | ||
967 | 970 | ||
968 | props.type = BACKLIGHT_PLATFORM; | 971 | props.type = BACKLIGHT_PLATFORM; |
969 | props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; | 972 | props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; |
@@ -1032,12 +1035,15 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event) | |||
1032 | { | 1035 | { |
1033 | struct toshiba_acpi_dev *dev = acpi_driver_data(acpi_dev); | 1036 | struct toshiba_acpi_dev *dev = acpi_driver_data(acpi_dev); |
1034 | u32 hci_result, value; | 1037 | u32 hci_result, value; |
1038 | int retries = 3; | ||
1035 | 1039 | ||
1036 | if (event != 0x80) | 1040 | if (!dev->system_event_supported || event != 0x80) |
1037 | return; | 1041 | return; |
1042 | |||
1038 | do { | 1043 | do { |
1039 | hci_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); | 1044 | hci_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); |
1040 | if (hci_result == HCI_SUCCESS) { | 1045 | switch (hci_result) { |
1046 | case HCI_SUCCESS: | ||
1041 | if (value == 0x100) | 1047 | if (value == 0x100) |
1042 | continue; | 1048 | continue; |
1043 | /* act on key press; ignore key release */ | 1049 | /* act on key press; ignore key release */ |
@@ -1049,14 +1055,19 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event) | |||
1049 | pr_info("Unknown key %x\n", | 1055 | pr_info("Unknown key %x\n", |
1050 | value); | 1056 | value); |
1051 | } | 1057 | } |
1052 | } else if (hci_result == HCI_NOT_SUPPORTED) { | 1058 | break; |
1059 | case HCI_NOT_SUPPORTED: | ||
1053 | /* This is a workaround for an unresolved issue on | 1060 | /* This is a workaround for an unresolved issue on |
1054 | * some machines where system events sporadically | 1061 | * some machines where system events sporadically |
1055 | * become disabled. */ | 1062 | * become disabled. */ |
1056 | hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); | 1063 | hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); |
1057 | pr_notice("Re-enabled hotkeys\n"); | 1064 | pr_notice("Re-enabled hotkeys\n"); |
1065 | /* fall through */ | ||
1066 | default: | ||
1067 | retries--; | ||
1068 | break; | ||
1058 | } | 1069 | } |
1059 | } while (hci_result != HCI_EMPTY); | 1070 | } while (retries && hci_result != HCI_EMPTY); |
1060 | } | 1071 | } |
1061 | 1072 | ||
1062 | 1073 | ||
diff --git a/drivers/power/intel_mid_battery.c b/drivers/power/intel_mid_battery.c index cffcb7c00b00..01fa671ec97f 100644 --- a/drivers/power/intel_mid_battery.c +++ b/drivers/power/intel_mid_battery.c | |||
@@ -61,7 +61,8 @@ MODULE_PARM_DESC(debug, "Flag to enable PMIC Battery debug messages."); | |||
61 | #define PMIC_BATT_CHR_SBATDET_MASK (1 << 5) | 61 | #define PMIC_BATT_CHR_SBATDET_MASK (1 << 5) |
62 | #define PMIC_BATT_CHR_SDCLMT_MASK (1 << 6) | 62 | #define PMIC_BATT_CHR_SDCLMT_MASK (1 << 6) |
63 | #define PMIC_BATT_CHR_SUSBOVP_MASK (1 << 7) | 63 | #define PMIC_BATT_CHR_SUSBOVP_MASK (1 << 7) |
64 | #define PMIC_BATT_CHR_EXCPT_MASK 0xC6 | 64 | #define PMIC_BATT_CHR_EXCPT_MASK 0x86 |
65 | |||
65 | #define PMIC_BATT_ADC_ACCCHRG_MASK (1 << 31) | 66 | #define PMIC_BATT_ADC_ACCCHRG_MASK (1 << 31) |
66 | #define PMIC_BATT_ADC_ACCCHRGVAL_MASK 0x7FFFFFFF | 67 | #define PMIC_BATT_ADC_ACCCHRGVAL_MASK 0x7FFFFFFF |
67 | 68 | ||
@@ -304,11 +305,6 @@ static void pmic_battery_read_status(struct pmic_power_module_info *pbi) | |||
304 | pbi->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING; | 305 | pbi->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING; |
305 | pmic_battery_log_event(BATT_EVENT_BATOVP_EXCPT); | 306 | pmic_battery_log_event(BATT_EVENT_BATOVP_EXCPT); |
306 | batt_exception = 1; | 307 | batt_exception = 1; |
307 | } else if (r8 & PMIC_BATT_CHR_SDCLMT_MASK) { | ||
308 | pbi->batt_health = POWER_SUPPLY_HEALTH_OVERVOLTAGE; | ||
309 | pbi->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING; | ||
310 | pmic_battery_log_event(BATT_EVENT_DCLMT_EXCPT); | ||
311 | batt_exception = 1; | ||
312 | } else if (r8 & PMIC_BATT_CHR_STEMP_MASK) { | 308 | } else if (r8 & PMIC_BATT_CHR_STEMP_MASK) { |
313 | pbi->batt_health = POWER_SUPPLY_HEALTH_OVERHEAT; | 309 | pbi->batt_health = POWER_SUPPLY_HEALTH_OVERHEAT; |
314 | pbi->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING; | 310 | pbi->batt_status = POWER_SUPPLY_STATUS_NOT_CHARGING; |
@@ -316,6 +312,10 @@ static void pmic_battery_read_status(struct pmic_power_module_info *pbi) | |||
316 | batt_exception = 1; | 312 | batt_exception = 1; |
317 | } else { | 313 | } else { |
318 | pbi->batt_health = POWER_SUPPLY_HEALTH_GOOD; | 314 | pbi->batt_health = POWER_SUPPLY_HEALTH_GOOD; |
315 | if (r8 & PMIC_BATT_CHR_SDCLMT_MASK) { | ||
316 | /* PMIC will change charging current automatically */ | ||
317 | pmic_battery_log_event(BATT_EVENT_DCLMT_EXCPT); | ||
318 | } | ||
319 | } | 319 | } |
320 | } | 320 | } |
321 | 321 | ||
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index cf3f9997546d..10451a15e828 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c | |||
@@ -101,7 +101,9 @@ static s32 scaled_ppm_to_ppb(long ppm) | |||
101 | 101 | ||
102 | static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp) | 102 | static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp) |
103 | { | 103 | { |
104 | return 1; /* always round timer functions to one nanosecond */ | 104 | tp->tv_sec = 0; |
105 | tp->tv_nsec = 1; | ||
106 | return 0; | ||
105 | } | 107 | } |
106 | 108 | ||
107 | static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp) | 109 | static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp) |
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c index 5225930a10cd..691b1ab1a3d0 100644 --- a/drivers/rapidio/devices/tsi721.c +++ b/drivers/rapidio/devices/tsi721.c | |||
@@ -851,14 +851,12 @@ static int tsi721_doorbell_init(struct tsi721_device *priv) | |||
851 | INIT_WORK(&priv->idb_work, tsi721_db_dpc); | 851 | INIT_WORK(&priv->idb_work, tsi721_db_dpc); |
852 | 852 | ||
853 | /* Allocate buffer for inbound doorbells queue */ | 853 | /* Allocate buffer for inbound doorbells queue */ |
854 | priv->idb_base = dma_alloc_coherent(&priv->pdev->dev, | 854 | priv->idb_base = dma_zalloc_coherent(&priv->pdev->dev, |
855 | IDB_QSIZE * TSI721_IDB_ENTRY_SIZE, | 855 | IDB_QSIZE * TSI721_IDB_ENTRY_SIZE, |
856 | &priv->idb_dma, GFP_KERNEL); | 856 | &priv->idb_dma, GFP_KERNEL); |
857 | if (!priv->idb_base) | 857 | if (!priv->idb_base) |
858 | return -ENOMEM; | 858 | return -ENOMEM; |
859 | 859 | ||
860 | memset(priv->idb_base, 0, IDB_QSIZE * TSI721_IDB_ENTRY_SIZE); | ||
861 | |||
862 | dev_dbg(&priv->pdev->dev, "Allocated IDB buffer @ %p (phys = %llx)\n", | 860 | dev_dbg(&priv->pdev->dev, "Allocated IDB buffer @ %p (phys = %llx)\n", |
863 | priv->idb_base, (unsigned long long)priv->idb_dma); | 861 | priv->idb_base, (unsigned long long)priv->idb_dma); |
864 | 862 | ||
@@ -904,7 +902,7 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) | |||
904 | */ | 902 | */ |
905 | 903 | ||
906 | /* Allocate space for DMA descriptors */ | 904 | /* Allocate space for DMA descriptors */ |
907 | bd_ptr = dma_alloc_coherent(&priv->pdev->dev, | 905 | bd_ptr = dma_zalloc_coherent(&priv->pdev->dev, |
908 | bd_num * sizeof(struct tsi721_dma_desc), | 906 | bd_num * sizeof(struct tsi721_dma_desc), |
909 | &bd_phys, GFP_KERNEL); | 907 | &bd_phys, GFP_KERNEL); |
910 | if (!bd_ptr) | 908 | if (!bd_ptr) |
@@ -913,8 +911,6 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) | |||
913 | priv->bdma[chnum].bd_phys = bd_phys; | 911 | priv->bdma[chnum].bd_phys = bd_phys; |
914 | priv->bdma[chnum].bd_base = bd_ptr; | 912 | priv->bdma[chnum].bd_base = bd_ptr; |
915 | 913 | ||
916 | memset(bd_ptr, 0, bd_num * sizeof(struct tsi721_dma_desc)); | ||
917 | |||
918 | dev_dbg(&priv->pdev->dev, "DMA descriptors @ %p (phys = %llx)\n", | 914 | dev_dbg(&priv->pdev->dev, "DMA descriptors @ %p (phys = %llx)\n", |
919 | bd_ptr, (unsigned long long)bd_phys); | 915 | bd_ptr, (unsigned long long)bd_phys); |
920 | 916 | ||
@@ -922,7 +918,7 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) | |||
922 | sts_size = (bd_num >= TSI721_DMA_MINSTSSZ) ? | 918 | sts_size = (bd_num >= TSI721_DMA_MINSTSSZ) ? |
923 | bd_num : TSI721_DMA_MINSTSSZ; | 919 | bd_num : TSI721_DMA_MINSTSSZ; |
924 | sts_size = roundup_pow_of_two(sts_size); | 920 | sts_size = roundup_pow_of_two(sts_size); |
925 | sts_ptr = dma_alloc_coherent(&priv->pdev->dev, | 921 | sts_ptr = dma_zalloc_coherent(&priv->pdev->dev, |
926 | sts_size * sizeof(struct tsi721_dma_sts), | 922 | sts_size * sizeof(struct tsi721_dma_sts), |
927 | &sts_phys, GFP_KERNEL); | 923 | &sts_phys, GFP_KERNEL); |
928 | if (!sts_ptr) { | 924 | if (!sts_ptr) { |
@@ -938,8 +934,6 @@ static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum) | |||
938 | priv->bdma[chnum].sts_base = sts_ptr; | 934 | priv->bdma[chnum].sts_base = sts_ptr; |
939 | priv->bdma[chnum].sts_size = sts_size; | 935 | priv->bdma[chnum].sts_size = sts_size; |
940 | 936 | ||
941 | memset(sts_ptr, 0, sts_size); | ||
942 | |||
943 | dev_dbg(&priv->pdev->dev, | 937 | dev_dbg(&priv->pdev->dev, |
944 | "desc status FIFO @ %p (phys = %llx) size=0x%x\n", | 938 | "desc status FIFO @ %p (phys = %llx) size=0x%x\n", |
945 | sts_ptr, (unsigned long long)sts_phys, sts_size); | 939 | sts_ptr, (unsigned long long)sts_phys, sts_size); |
@@ -1400,7 +1394,7 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id, | |||
1400 | 1394 | ||
1401 | /* Outbound message descriptor status FIFO allocation */ | 1395 | /* Outbound message descriptor status FIFO allocation */ |
1402 | priv->omsg_ring[mbox].sts_size = roundup_pow_of_two(entries + 1); | 1396 | priv->omsg_ring[mbox].sts_size = roundup_pow_of_two(entries + 1); |
1403 | priv->omsg_ring[mbox].sts_base = dma_alloc_coherent(&priv->pdev->dev, | 1397 | priv->omsg_ring[mbox].sts_base = dma_zalloc_coherent(&priv->pdev->dev, |
1404 | priv->omsg_ring[mbox].sts_size * | 1398 | priv->omsg_ring[mbox].sts_size * |
1405 | sizeof(struct tsi721_dma_sts), | 1399 | sizeof(struct tsi721_dma_sts), |
1406 | &priv->omsg_ring[mbox].sts_phys, GFP_KERNEL); | 1400 | &priv->omsg_ring[mbox].sts_phys, GFP_KERNEL); |
@@ -1412,9 +1406,6 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id, | |||
1412 | goto out_desc; | 1406 | goto out_desc; |
1413 | } | 1407 | } |
1414 | 1408 | ||
1415 | memset(priv->omsg_ring[mbox].sts_base, 0, | ||
1416 | entries * sizeof(struct tsi721_dma_sts)); | ||
1417 | |||
1418 | /* | 1409 | /* |
1419 | * Configure Outbound Messaging Engine | 1410 | * Configure Outbound Messaging Engine |
1420 | */ | 1411 | */ |
@@ -2116,8 +2107,8 @@ static int __devinit tsi721_setup_mport(struct tsi721_device *priv) | |||
2116 | INIT_LIST_HEAD(&mport->dbells); | 2107 | INIT_LIST_HEAD(&mport->dbells); |
2117 | 2108 | ||
2118 | rio_init_dbell_res(&mport->riores[RIO_DOORBELL_RESOURCE], 0, 0xffff); | 2109 | rio_init_dbell_res(&mport->riores[RIO_DOORBELL_RESOURCE], 0, 0xffff); |
2119 | rio_init_mbox_res(&mport->riores[RIO_INB_MBOX_RESOURCE], 0, 0); | 2110 | rio_init_mbox_res(&mport->riores[RIO_INB_MBOX_RESOURCE], 0, 3); |
2120 | rio_init_mbox_res(&mport->riores[RIO_OUTB_MBOX_RESOURCE], 0, 0); | 2111 | rio_init_mbox_res(&mport->riores[RIO_OUTB_MBOX_RESOURCE], 0, 3); |
2121 | strcpy(mport->name, "Tsi721 mport"); | 2112 | strcpy(mport->name, "Tsi721 mport"); |
2122 | 2113 | ||
2123 | /* Hook up interrupt handler */ | 2114 | /* Hook up interrupt handler */ |
@@ -2163,7 +2154,7 @@ static int __devinit tsi721_probe(struct pci_dev *pdev, | |||
2163 | const struct pci_device_id *id) | 2154 | const struct pci_device_id *id) |
2164 | { | 2155 | { |
2165 | struct tsi721_device *priv; | 2156 | struct tsi721_device *priv; |
2166 | int i; | 2157 | int i, cap; |
2167 | int err; | 2158 | int err; |
2168 | u32 regval; | 2159 | u32 regval; |
2169 | 2160 | ||
@@ -2271,10 +2262,20 @@ static int __devinit tsi721_probe(struct pci_dev *pdev, | |||
2271 | dev_info(&pdev->dev, "Unable to set consistent DMA mask\n"); | 2262 | dev_info(&pdev->dev, "Unable to set consistent DMA mask\n"); |
2272 | } | 2263 | } |
2273 | 2264 | ||
2274 | /* Clear "no snoop" and "relaxed ordering" bits. */ | 2265 | cap = pci_pcie_cap(pdev); |
2275 | pci_read_config_dword(pdev, 0x40 + PCI_EXP_DEVCTL, ®val); | 2266 | BUG_ON(cap == 0); |
2276 | regval &= ~(PCI_EXP_DEVCTL_RELAX_EN | PCI_EXP_DEVCTL_NOSNOOP_EN); | 2267 | |
2277 | pci_write_config_dword(pdev, 0x40 + PCI_EXP_DEVCTL, regval); | 2268 | /* Clear "no snoop" and "relaxed ordering" bits, use default MRRS. */ |
2269 | pci_read_config_dword(pdev, cap + PCI_EXP_DEVCTL, ®val); | ||
2270 | regval &= ~(PCI_EXP_DEVCTL_READRQ | PCI_EXP_DEVCTL_RELAX_EN | | ||
2271 | PCI_EXP_DEVCTL_NOSNOOP_EN); | ||
2272 | regval |= 0x2 << MAX_READ_REQUEST_SZ_SHIFT; | ||
2273 | pci_write_config_dword(pdev, cap + PCI_EXP_DEVCTL, regval); | ||
2274 | |||
2275 | /* Adjust PCIe completion timeout. */ | ||
2276 | pci_read_config_dword(pdev, cap + PCI_EXP_DEVCTL2, ®val); | ||
2277 | regval &= ~(0x0f); | ||
2278 | pci_write_config_dword(pdev, cap + PCI_EXP_DEVCTL2, regval | 0x2); | ||
2278 | 2279 | ||
2279 | /* | 2280 | /* |
2280 | * FIXUP: correct offsets of MSI-X tables in the MSI-X Capability Block | 2281 | * FIXUP: correct offsets of MSI-X tables in the MSI-X Capability Block |
diff --git a/drivers/rapidio/devices/tsi721.h b/drivers/rapidio/devices/tsi721.h index 58be4deb1402..822e54c394d5 100644 --- a/drivers/rapidio/devices/tsi721.h +++ b/drivers/rapidio/devices/tsi721.h | |||
@@ -72,6 +72,8 @@ | |||
72 | #define TSI721_MSIXPBA_OFFSET 0x2a000 | 72 | #define TSI721_MSIXPBA_OFFSET 0x2a000 |
73 | #define TSI721_PCIECFG_EPCTL 0x400 | 73 | #define TSI721_PCIECFG_EPCTL 0x400 |
74 | 74 | ||
75 | #define MAX_READ_REQUEST_SZ_SHIFT 12 | ||
76 | |||
75 | /* | 77 | /* |
76 | * Event Management Registers | 78 | * Event Management Registers |
77 | */ | 79 | */ |
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index e8326f26fa2f..dc4c2748bbc3 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -63,7 +63,7 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg) | |||
63 | */ | 63 | */ |
64 | delta = timespec_sub(old_system, old_rtc); | 64 | delta = timespec_sub(old_system, old_rtc); |
65 | delta_delta = timespec_sub(delta, old_delta); | 65 | delta_delta = timespec_sub(delta, old_delta); |
66 | if (abs(delta_delta.tv_sec) >= 2) { | 66 | if (delta_delta.tv_sec < -2 || delta_delta.tv_sec >= 2) { |
67 | /* | 67 | /* |
68 | * if delta_delta is too large, assume time correction | 68 | * if delta_delta is too large, assume time correction |
69 | * has occured and set old_delta to the current delta. | 69 | * has occured and set old_delta to the current delta. |
@@ -97,9 +97,8 @@ static int rtc_resume(struct device *dev) | |||
97 | rtc_tm_to_time(&tm, &new_rtc.tv_sec); | 97 | rtc_tm_to_time(&tm, &new_rtc.tv_sec); |
98 | new_rtc.tv_nsec = 0; | 98 | new_rtc.tv_nsec = 0; |
99 | 99 | ||
100 | if (new_rtc.tv_sec <= old_rtc.tv_sec) { | 100 | if (new_rtc.tv_sec < old_rtc.tv_sec) { |
101 | if (new_rtc.tv_sec < old_rtc.tv_sec) | 101 | pr_debug("%s: time travel!\n", dev_name(&rtc->dev)); |
102 | pr_debug("%s: time travel!\n", dev_name(&rtc->dev)); | ||
103 | return 0; | 102 | return 0; |
104 | } | 103 | } |
105 | 104 | ||
@@ -116,7 +115,8 @@ static int rtc_resume(struct device *dev) | |||
116 | sleep_time = timespec_sub(sleep_time, | 115 | sleep_time = timespec_sub(sleep_time, |
117 | timespec_sub(new_system, old_system)); | 116 | timespec_sub(new_system, old_system)); |
118 | 117 | ||
119 | timekeeping_inject_sleeptime(&sleep_time); | 118 | if (sleep_time.tv_sec >= 0) |
119 | timekeeping_inject_sleeptime(&sleep_time); | ||
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
122 | 122 | ||
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 8e286259a007..fa4d9f324189 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -319,6 +319,20 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
319 | } | 319 | } |
320 | EXPORT_SYMBOL_GPL(rtc_read_alarm); | 320 | EXPORT_SYMBOL_GPL(rtc_read_alarm); |
321 | 321 | ||
322 | static int ___rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | ||
323 | { | ||
324 | int err; | ||
325 | |||
326 | if (!rtc->ops) | ||
327 | err = -ENODEV; | ||
328 | else if (!rtc->ops->set_alarm) | ||
329 | err = -EINVAL; | ||
330 | else | ||
331 | err = rtc->ops->set_alarm(rtc->dev.parent, alarm); | ||
332 | |||
333 | return err; | ||
334 | } | ||
335 | |||
322 | static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | 336 | static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) |
323 | { | 337 | { |
324 | struct rtc_time tm; | 338 | struct rtc_time tm; |
@@ -342,14 +356,7 @@ static int __rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | |||
342 | * over right here, before we set the alarm. | 356 | * over right here, before we set the alarm. |
343 | */ | 357 | */ |
344 | 358 | ||
345 | if (!rtc->ops) | 359 | return ___rtc_set_alarm(rtc, alarm); |
346 | err = -ENODEV; | ||
347 | else if (!rtc->ops->set_alarm) | ||
348 | err = -EINVAL; | ||
349 | else | ||
350 | err = rtc->ops->set_alarm(rtc->dev.parent, alarm); | ||
351 | |||
352 | return err; | ||
353 | } | 360 | } |
354 | 361 | ||
355 | int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) | 362 | int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm) |
@@ -763,6 +770,20 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) | |||
763 | return 0; | 770 | return 0; |
764 | } | 771 | } |
765 | 772 | ||
773 | static void rtc_alarm_disable(struct rtc_device *rtc) | ||
774 | { | ||
775 | struct rtc_wkalrm alarm; | ||
776 | struct rtc_time tm; | ||
777 | |||
778 | __rtc_read_time(rtc, &tm); | ||
779 | |||
780 | alarm.time = rtc_ktime_to_tm(ktime_add(rtc_tm_to_ktime(tm), | ||
781 | ktime_set(300, 0))); | ||
782 | alarm.enabled = 0; | ||
783 | |||
784 | ___rtc_set_alarm(rtc, &alarm); | ||
785 | } | ||
786 | |||
766 | /** | 787 | /** |
767 | * rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue | 788 | * rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue |
768 | * @rtc rtc device | 789 | * @rtc rtc device |
@@ -784,8 +805,10 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer) | |||
784 | struct rtc_wkalrm alarm; | 805 | struct rtc_wkalrm alarm; |
785 | int err; | 806 | int err; |
786 | next = timerqueue_getnext(&rtc->timerqueue); | 807 | next = timerqueue_getnext(&rtc->timerqueue); |
787 | if (!next) | 808 | if (!next) { |
809 | rtc_alarm_disable(rtc); | ||
788 | return; | 810 | return; |
811 | } | ||
789 | alarm.time = rtc_ktime_to_tm(next->expires); | 812 | alarm.time = rtc_ktime_to_tm(next->expires); |
790 | alarm.enabled = 1; | 813 | alarm.enabled = 1; |
791 | err = __rtc_set_alarm(rtc, &alarm); | 814 | err = __rtc_set_alarm(rtc, &alarm); |
@@ -847,7 +870,8 @@ again: | |||
847 | err = __rtc_set_alarm(rtc, &alarm); | 870 | err = __rtc_set_alarm(rtc, &alarm); |
848 | if (err == -ETIME) | 871 | if (err == -ETIME) |
849 | goto again; | 872 | goto again; |
850 | } | 873 | } else |
874 | rtc_alarm_disable(rtc); | ||
851 | 875 | ||
852 | mutex_unlock(&rtc->ops_lock); | 876 | mutex_unlock(&rtc->ops_lock); |
853 | } | 877 | } |
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c index e39b77a4609a..dc474bc6522d 100644 --- a/drivers/rtc/rtc-at91rm9200.c +++ b/drivers/rtc/rtc-at91rm9200.c | |||
@@ -32,11 +32,17 @@ | |||
32 | 32 | ||
33 | #include <mach/at91_rtc.h> | 33 | #include <mach/at91_rtc.h> |
34 | 34 | ||
35 | #define at91_rtc_read(field) \ | ||
36 | __raw_readl(at91_rtc_regs + field) | ||
37 | #define at91_rtc_write(field, val) \ | ||
38 | __raw_writel((val), at91_rtc_regs + field) | ||
35 | 39 | ||
36 | #define AT91_RTC_EPOCH 1900UL /* just like arch/arm/common/rtctime.c */ | 40 | #define AT91_RTC_EPOCH 1900UL /* just like arch/arm/common/rtctime.c */ |
37 | 41 | ||
38 | static DECLARE_COMPLETION(at91_rtc_updated); | 42 | static DECLARE_COMPLETION(at91_rtc_updated); |
39 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; | 43 | static unsigned int at91_alarm_year = AT91_RTC_EPOCH; |
44 | static void __iomem *at91_rtc_regs; | ||
45 | static int irq; | ||
40 | 46 | ||
41 | /* | 47 | /* |
42 | * Decode time/date into rtc_time structure | 48 | * Decode time/date into rtc_time structure |
@@ -48,10 +54,10 @@ static void at91_rtc_decodetime(unsigned int timereg, unsigned int calreg, | |||
48 | 54 | ||
49 | /* must read twice in case it changes */ | 55 | /* must read twice in case it changes */ |
50 | do { | 56 | do { |
51 | time = at91_sys_read(timereg); | 57 | time = at91_rtc_read(timereg); |
52 | date = at91_sys_read(calreg); | 58 | date = at91_rtc_read(calreg); |
53 | } while ((time != at91_sys_read(timereg)) || | 59 | } while ((time != at91_rtc_read(timereg)) || |
54 | (date != at91_sys_read(calreg))); | 60 | (date != at91_rtc_read(calreg))); |
55 | 61 | ||
56 | tm->tm_sec = bcd2bin((time & AT91_RTC_SEC) >> 0); | 62 | tm->tm_sec = bcd2bin((time & AT91_RTC_SEC) >> 0); |
57 | tm->tm_min = bcd2bin((time & AT91_RTC_MIN) >> 8); | 63 | tm->tm_min = bcd2bin((time & AT91_RTC_MIN) >> 8); |
@@ -98,19 +104,19 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
98 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 104 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
99 | 105 | ||
100 | /* Stop Time/Calendar from counting */ | 106 | /* Stop Time/Calendar from counting */ |
101 | cr = at91_sys_read(AT91_RTC_CR); | 107 | cr = at91_rtc_read(AT91_RTC_CR); |
102 | at91_sys_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); | 108 | at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); |
103 | 109 | ||
104 | at91_sys_write(AT91_RTC_IER, AT91_RTC_ACKUPD); | 110 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); |
105 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ | 111 | wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ |
106 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); | 112 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); |
107 | 113 | ||
108 | at91_sys_write(AT91_RTC_TIMR, | 114 | at91_rtc_write(AT91_RTC_TIMR, |
109 | bin2bcd(tm->tm_sec) << 0 | 115 | bin2bcd(tm->tm_sec) << 0 |
110 | | bin2bcd(tm->tm_min) << 8 | 116 | | bin2bcd(tm->tm_min) << 8 |
111 | | bin2bcd(tm->tm_hour) << 16); | 117 | | bin2bcd(tm->tm_hour) << 16); |
112 | 118 | ||
113 | at91_sys_write(AT91_RTC_CALR, | 119 | at91_rtc_write(AT91_RTC_CALR, |
114 | bin2bcd((tm->tm_year + 1900) / 100) /* century */ | 120 | bin2bcd((tm->tm_year + 1900) / 100) /* century */ |
115 | | bin2bcd(tm->tm_year % 100) << 8 /* year */ | 121 | | bin2bcd(tm->tm_year % 100) << 8 /* year */ |
116 | | bin2bcd(tm->tm_mon + 1) << 16 /* tm_mon starts at zero */ | 122 | | bin2bcd(tm->tm_mon + 1) << 16 /* tm_mon starts at zero */ |
@@ -118,8 +124,8 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
118 | | bin2bcd(tm->tm_mday) << 24); | 124 | | bin2bcd(tm->tm_mday) << 24); |
119 | 125 | ||
120 | /* Restart Time/Calendar */ | 126 | /* Restart Time/Calendar */ |
121 | cr = at91_sys_read(AT91_RTC_CR); | 127 | cr = at91_rtc_read(AT91_RTC_CR); |
122 | at91_sys_write(AT91_RTC_CR, cr & ~(AT91_RTC_UPDCAL | AT91_RTC_UPDTIM)); | 128 | at91_rtc_write(AT91_RTC_CR, cr & ~(AT91_RTC_UPDCAL | AT91_RTC_UPDTIM)); |
123 | 129 | ||
124 | return 0; | 130 | return 0; |
125 | } | 131 | } |
@@ -135,7 +141,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
135 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); | 141 | tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); |
136 | tm->tm_year = at91_alarm_year - 1900; | 142 | tm->tm_year = at91_alarm_year - 1900; |
137 | 143 | ||
138 | alrm->enabled = (at91_sys_read(AT91_RTC_IMR) & AT91_RTC_ALARM) | 144 | alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM) |
139 | ? 1 : 0; | 145 | ? 1 : 0; |
140 | 146 | ||
141 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, | 147 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
@@ -160,20 +166,20 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
160 | tm.tm_min = alrm->time.tm_min; | 166 | tm.tm_min = alrm->time.tm_min; |
161 | tm.tm_sec = alrm->time.tm_sec; | 167 | tm.tm_sec = alrm->time.tm_sec; |
162 | 168 | ||
163 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 169 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); |
164 | at91_sys_write(AT91_RTC_TIMALR, | 170 | at91_rtc_write(AT91_RTC_TIMALR, |
165 | bin2bcd(tm.tm_sec) << 0 | 171 | bin2bcd(tm.tm_sec) << 0 |
166 | | bin2bcd(tm.tm_min) << 8 | 172 | | bin2bcd(tm.tm_min) << 8 |
167 | | bin2bcd(tm.tm_hour) << 16 | 173 | | bin2bcd(tm.tm_hour) << 16 |
168 | | AT91_RTC_HOUREN | AT91_RTC_MINEN | AT91_RTC_SECEN); | 174 | | AT91_RTC_HOUREN | AT91_RTC_MINEN | AT91_RTC_SECEN); |
169 | at91_sys_write(AT91_RTC_CALALR, | 175 | at91_rtc_write(AT91_RTC_CALALR, |
170 | bin2bcd(tm.tm_mon + 1) << 16 /* tm_mon starts at zero */ | 176 | bin2bcd(tm.tm_mon + 1) << 16 /* tm_mon starts at zero */ |
171 | | bin2bcd(tm.tm_mday) << 24 | 177 | | bin2bcd(tm.tm_mday) << 24 |
172 | | AT91_RTC_DATEEN | AT91_RTC_MTHEN); | 178 | | AT91_RTC_DATEEN | AT91_RTC_MTHEN); |
173 | 179 | ||
174 | if (alrm->enabled) { | 180 | if (alrm->enabled) { |
175 | at91_sys_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 181 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
176 | at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM); | 182 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); |
177 | } | 183 | } |
178 | 184 | ||
179 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, | 185 | pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, |
@@ -188,10 +194,10 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
188 | pr_debug("%s(): cmd=%08x\n", __func__, enabled); | 194 | pr_debug("%s(): cmd=%08x\n", __func__, enabled); |
189 | 195 | ||
190 | if (enabled) { | 196 | if (enabled) { |
191 | at91_sys_write(AT91_RTC_SCCR, AT91_RTC_ALARM); | 197 | at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); |
192 | at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM); | 198 | at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); |
193 | } else | 199 | } else |
194 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); | 200 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); |
195 | 201 | ||
196 | return 0; | 202 | return 0; |
197 | } | 203 | } |
@@ -200,7 +206,7 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
200 | */ | 206 | */ |
201 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) | 207 | static int at91_rtc_proc(struct device *dev, struct seq_file *seq) |
202 | { | 208 | { |
203 | unsigned long imr = at91_sys_read(AT91_RTC_IMR); | 209 | unsigned long imr = at91_rtc_read(AT91_RTC_IMR); |
204 | 210 | ||
205 | seq_printf(seq, "update_IRQ\t: %s\n", | 211 | seq_printf(seq, "update_IRQ\t: %s\n", |
206 | (imr & AT91_RTC_ACKUPD) ? "yes" : "no"); | 212 | (imr & AT91_RTC_ACKUPD) ? "yes" : "no"); |
@@ -220,7 +226,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
220 | unsigned int rtsr; | 226 | unsigned int rtsr; |
221 | unsigned long events = 0; | 227 | unsigned long events = 0; |
222 | 228 | ||
223 | rtsr = at91_sys_read(AT91_RTC_SR) & at91_sys_read(AT91_RTC_IMR); | 229 | rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR); |
224 | if (rtsr) { /* this interrupt is shared! Is it ours? */ | 230 | if (rtsr) { /* this interrupt is shared! Is it ours? */ |
225 | if (rtsr & AT91_RTC_ALARM) | 231 | if (rtsr & AT91_RTC_ALARM) |
226 | events |= (RTC_AF | RTC_IRQF); | 232 | events |= (RTC_AF | RTC_IRQF); |
@@ -229,7 +235,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) | |||
229 | if (rtsr & AT91_RTC_ACKUPD) | 235 | if (rtsr & AT91_RTC_ACKUPD) |
230 | complete(&at91_rtc_updated); | 236 | complete(&at91_rtc_updated); |
231 | 237 | ||
232 | at91_sys_write(AT91_RTC_SCCR, rtsr); /* clear status reg */ | 238 | at91_rtc_write(AT91_RTC_SCCR, rtsr); /* clear status reg */ |
233 | 239 | ||
234 | rtc_update_irq(rtc, 1, events); | 240 | rtc_update_irq(rtc, 1, events); |
235 | 241 | ||
@@ -256,22 +262,41 @@ static const struct rtc_class_ops at91_rtc_ops = { | |||
256 | static int __init at91_rtc_probe(struct platform_device *pdev) | 262 | static int __init at91_rtc_probe(struct platform_device *pdev) |
257 | { | 263 | { |
258 | struct rtc_device *rtc; | 264 | struct rtc_device *rtc; |
259 | int ret; | 265 | struct resource *regs; |
266 | int ret = 0; | ||
260 | 267 | ||
261 | at91_sys_write(AT91_RTC_CR, 0); | 268 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
262 | at91_sys_write(AT91_RTC_MR, 0); /* 24 hour mode */ | 269 | if (!regs) { |
270 | dev_err(&pdev->dev, "no mmio resource defined\n"); | ||
271 | return -ENXIO; | ||
272 | } | ||
273 | |||
274 | irq = platform_get_irq(pdev, 0); | ||
275 | if (irq < 0) { | ||
276 | dev_err(&pdev->dev, "no irq resource defined\n"); | ||
277 | return -ENXIO; | ||
278 | } | ||
279 | |||
280 | at91_rtc_regs = ioremap(regs->start, resource_size(regs)); | ||
281 | if (!at91_rtc_regs) { | ||
282 | dev_err(&pdev->dev, "failed to map registers, aborting.\n"); | ||
283 | return -ENOMEM; | ||
284 | } | ||
285 | |||
286 | at91_rtc_write(AT91_RTC_CR, 0); | ||
287 | at91_rtc_write(AT91_RTC_MR, 0); /* 24 hour mode */ | ||
263 | 288 | ||
264 | /* Disable all interrupts */ | 289 | /* Disable all interrupts */ |
265 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 290 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
266 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 291 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
267 | AT91_RTC_CALEV); | 292 | AT91_RTC_CALEV); |
268 | 293 | ||
269 | ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, | 294 | ret = request_irq(irq, at91_rtc_interrupt, |
270 | IRQF_SHARED, | 295 | IRQF_SHARED, |
271 | "at91_rtc", pdev); | 296 | "at91_rtc", pdev); |
272 | if (ret) { | 297 | if (ret) { |
273 | printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n", | 298 | printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n", |
274 | AT91_ID_SYS); | 299 | irq); |
275 | return ret; | 300 | return ret; |
276 | } | 301 | } |
277 | 302 | ||
@@ -284,7 +309,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
284 | rtc = rtc_device_register(pdev->name, &pdev->dev, | 309 | rtc = rtc_device_register(pdev->name, &pdev->dev, |
285 | &at91_rtc_ops, THIS_MODULE); | 310 | &at91_rtc_ops, THIS_MODULE); |
286 | if (IS_ERR(rtc)) { | 311 | if (IS_ERR(rtc)) { |
287 | free_irq(AT91_ID_SYS, pdev); | 312 | free_irq(irq, pdev); |
288 | return PTR_ERR(rtc); | 313 | return PTR_ERR(rtc); |
289 | } | 314 | } |
290 | platform_set_drvdata(pdev, rtc); | 315 | platform_set_drvdata(pdev, rtc); |
@@ -301,10 +326,10 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) | |||
301 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 326 | struct rtc_device *rtc = platform_get_drvdata(pdev); |
302 | 327 | ||
303 | /* Disable all interrupts */ | 328 | /* Disable all interrupts */ |
304 | at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | | 329 | at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | |
305 | AT91_RTC_SECEV | AT91_RTC_TIMEV | | 330 | AT91_RTC_SECEV | AT91_RTC_TIMEV | |
306 | AT91_RTC_CALEV); | 331 | AT91_RTC_CALEV); |
307 | free_irq(AT91_ID_SYS, pdev); | 332 | free_irq(irq, pdev); |
308 | 333 | ||
309 | rtc_device_unregister(rtc); | 334 | rtc_device_unregister(rtc); |
310 | platform_set_drvdata(pdev, NULL); | 335 | platform_set_drvdata(pdev, NULL); |
@@ -323,13 +348,13 @@ static int at91_rtc_suspend(struct device *dev) | |||
323 | /* this IRQ is shared with DBGU and other hardware which isn't | 348 | /* this IRQ is shared with DBGU and other hardware which isn't |
324 | * necessarily doing PM like we are... | 349 | * necessarily doing PM like we are... |
325 | */ | 350 | */ |
326 | at91_rtc_imr = at91_sys_read(AT91_RTC_IMR) | 351 | at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR) |
327 | & (AT91_RTC_ALARM|AT91_RTC_SECEV); | 352 | & (AT91_RTC_ALARM|AT91_RTC_SECEV); |
328 | if (at91_rtc_imr) { | 353 | if (at91_rtc_imr) { |
329 | if (device_may_wakeup(dev)) | 354 | if (device_may_wakeup(dev)) |
330 | enable_irq_wake(AT91_ID_SYS); | 355 | enable_irq_wake(irq); |
331 | else | 356 | else |
332 | at91_sys_write(AT91_RTC_IDR, at91_rtc_imr); | 357 | at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr); |
333 | } | 358 | } |
334 | return 0; | 359 | return 0; |
335 | } | 360 | } |
@@ -338,9 +363,9 @@ static int at91_rtc_resume(struct device *dev) | |||
338 | { | 363 | { |
339 | if (at91_rtc_imr) { | 364 | if (at91_rtc_imr) { |
340 | if (device_may_wakeup(dev)) | 365 | if (device_may_wakeup(dev)) |
341 | disable_irq_wake(AT91_ID_SYS); | 366 | disable_irq_wake(irq); |
342 | else | 367 | else |
343 | at91_sys_write(AT91_RTC_IER, at91_rtc_imr); | 368 | at91_rtc_write(AT91_RTC_IER, at91_rtc_imr); |
344 | } | 369 | } |
345 | return 0; | 370 | return 0; |
346 | } | 371 | } |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 7639ab906f02..5b979d9cc332 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -202,7 +202,6 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
202 | void __iomem *base = s3c_rtc_base; | 202 | void __iomem *base = s3c_rtc_base; |
203 | int year = tm->tm_year - 100; | 203 | int year = tm->tm_year - 100; |
204 | 204 | ||
205 | clk_enable(rtc_clk); | ||
206 | pr_debug("set time %04d.%02d.%02d %02d:%02d:%02d\n", | 205 | pr_debug("set time %04d.%02d.%02d %02d:%02d:%02d\n", |
207 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, | 206 | 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, |
208 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 207 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
@@ -214,6 +213,7 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) | |||
214 | return -EINVAL; | 213 | return -EINVAL; |
215 | } | 214 | } |
216 | 215 | ||
216 | clk_enable(rtc_clk); | ||
217 | writeb(bin2bcd(tm->tm_sec), base + S3C2410_RTCSEC); | 217 | writeb(bin2bcd(tm->tm_sec), base + S3C2410_RTCSEC); |
218 | writeb(bin2bcd(tm->tm_min), base + S3C2410_RTCMIN); | 218 | writeb(bin2bcd(tm->tm_min), base + S3C2410_RTCMIN); |
219 | writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR); | 219 | writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR); |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 75c3f1f8fd43..a84631a7391d 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -529,10 +529,7 @@ __s390_vary_chpid_on(struct subchannel_id schid, void *data) | |||
529 | int chsc_chp_vary(struct chp_id chpid, int on) | 529 | int chsc_chp_vary(struct chp_id chpid, int on) |
530 | { | 530 | { |
531 | struct channel_path *chp = chpid_to_chp(chpid); | 531 | struct channel_path *chp = chpid_to_chp(chpid); |
532 | struct chp_link link; | ||
533 | 532 | ||
534 | memset(&link, 0, sizeof(struct chp_link)); | ||
535 | link.chpid = chpid; | ||
536 | /* Wait until previous actions have settled. */ | 533 | /* Wait until previous actions have settled. */ |
537 | css_wait_for_slow_path(); | 534 | css_wait_for_slow_path(); |
538 | /* | 535 | /* |
@@ -542,10 +539,10 @@ int chsc_chp_vary(struct chp_id chpid, int on) | |||
542 | /* Try to update the channel path descritor. */ | 539 | /* Try to update the channel path descritor. */ |
543 | chsc_determine_base_channel_path_desc(chpid, &chp->desc); | 540 | chsc_determine_base_channel_path_desc(chpid, &chp->desc); |
544 | for_each_subchannel_staged(s390_subchannel_vary_chpid_on, | 541 | for_each_subchannel_staged(s390_subchannel_vary_chpid_on, |
545 | __s390_vary_chpid_on, &link); | 542 | __s390_vary_chpid_on, &chpid); |
546 | } else | 543 | } else |
547 | for_each_subchannel_staged(s390_subchannel_vary_chpid_off, | 544 | for_each_subchannel_staged(s390_subchannel_vary_chpid_off, |
548 | NULL, &link); | 545 | NULL, &chpid); |
549 | 546 | ||
550 | return 0; | 547 | return 0; |
551 | } | 548 | } |
diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h index 155a82bcb9e5..4a1ff5c2eb88 100644 --- a/drivers/s390/cio/cio.h +++ b/drivers/s390/cio/cio.h | |||
@@ -68,8 +68,13 @@ struct schib { | |||
68 | __u8 mda[4]; /* model dependent area */ | 68 | __u8 mda[4]; /* model dependent area */ |
69 | } __attribute__ ((packed,aligned(4))); | 69 | } __attribute__ ((packed,aligned(4))); |
70 | 70 | ||
71 | /* | ||
72 | * When rescheduled, todo's with higher values will overwrite those | ||
73 | * with lower values. | ||
74 | */ | ||
71 | enum sch_todo { | 75 | enum sch_todo { |
72 | SCH_TODO_NOTHING, | 76 | SCH_TODO_NOTHING, |
77 | SCH_TODO_EVAL, | ||
73 | SCH_TODO_UNREG, | 78 | SCH_TODO_UNREG, |
74 | }; | 79 | }; |
75 | 80 | ||
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 92d7324acb1c..21908e67bf67 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -195,51 +195,6 @@ void css_sch_device_unregister(struct subchannel *sch) | |||
195 | } | 195 | } |
196 | EXPORT_SYMBOL_GPL(css_sch_device_unregister); | 196 | EXPORT_SYMBOL_GPL(css_sch_device_unregister); |
197 | 197 | ||
198 | static void css_sch_todo(struct work_struct *work) | ||
199 | { | ||
200 | struct subchannel *sch; | ||
201 | enum sch_todo todo; | ||
202 | |||
203 | sch = container_of(work, struct subchannel, todo_work); | ||
204 | /* Find out todo. */ | ||
205 | spin_lock_irq(sch->lock); | ||
206 | todo = sch->todo; | ||
207 | CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, | ||
208 | sch->schid.sch_no, todo); | ||
209 | sch->todo = SCH_TODO_NOTHING; | ||
210 | spin_unlock_irq(sch->lock); | ||
211 | /* Perform todo. */ | ||
212 | if (todo == SCH_TODO_UNREG) | ||
213 | css_sch_device_unregister(sch); | ||
214 | /* Release workqueue ref. */ | ||
215 | put_device(&sch->dev); | ||
216 | } | ||
217 | |||
218 | /** | ||
219 | * css_sched_sch_todo - schedule a subchannel operation | ||
220 | * @sch: subchannel | ||
221 | * @todo: todo | ||
222 | * | ||
223 | * Schedule the operation identified by @todo to be performed on the slow path | ||
224 | * workqueue. Do nothing if another operation with higher priority is already | ||
225 | * scheduled. Needs to be called with subchannel lock held. | ||
226 | */ | ||
227 | void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) | ||
228 | { | ||
229 | CIO_MSG_EVENT(4, "sch_todo: sched sch=0.%x.%04x todo=%d\n", | ||
230 | sch->schid.ssid, sch->schid.sch_no, todo); | ||
231 | if (sch->todo >= todo) | ||
232 | return; | ||
233 | /* Get workqueue ref. */ | ||
234 | if (!get_device(&sch->dev)) | ||
235 | return; | ||
236 | sch->todo = todo; | ||
237 | if (!queue_work(cio_work_q, &sch->todo_work)) { | ||
238 | /* Already queued, release workqueue ref. */ | ||
239 | put_device(&sch->dev); | ||
240 | } | ||
241 | } | ||
242 | |||
243 | static void ssd_from_pmcw(struct chsc_ssd_info *ssd, struct pmcw *pmcw) | 198 | static void ssd_from_pmcw(struct chsc_ssd_info *ssd, struct pmcw *pmcw) |
244 | { | 199 | { |
245 | int i; | 200 | int i; |
@@ -466,6 +421,65 @@ static void css_evaluate_subchannel(struct subchannel_id schid, int slow) | |||
466 | css_schedule_eval(schid); | 421 | css_schedule_eval(schid); |
467 | } | 422 | } |
468 | 423 | ||
424 | /** | ||
425 | * css_sched_sch_todo - schedule a subchannel operation | ||
426 | * @sch: subchannel | ||
427 | * @todo: todo | ||
428 | * | ||
429 | * Schedule the operation identified by @todo to be performed on the slow path | ||
430 | * workqueue. Do nothing if another operation with higher priority is already | ||
431 | * scheduled. Needs to be called with subchannel lock held. | ||
432 | */ | ||
433 | void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) | ||
434 | { | ||
435 | CIO_MSG_EVENT(4, "sch_todo: sched sch=0.%x.%04x todo=%d\n", | ||
436 | sch->schid.ssid, sch->schid.sch_no, todo); | ||
437 | if (sch->todo >= todo) | ||
438 | return; | ||
439 | /* Get workqueue ref. */ | ||
440 | if (!get_device(&sch->dev)) | ||
441 | return; | ||
442 | sch->todo = todo; | ||
443 | if (!queue_work(cio_work_q, &sch->todo_work)) { | ||
444 | /* Already queued, release workqueue ref. */ | ||
445 | put_device(&sch->dev); | ||
446 | } | ||
447 | } | ||
448 | |||
449 | static void css_sch_todo(struct work_struct *work) | ||
450 | { | ||
451 | struct subchannel *sch; | ||
452 | enum sch_todo todo; | ||
453 | int ret; | ||
454 | |||
455 | sch = container_of(work, struct subchannel, todo_work); | ||
456 | /* Find out todo. */ | ||
457 | spin_lock_irq(sch->lock); | ||
458 | todo = sch->todo; | ||
459 | CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, | ||
460 | sch->schid.sch_no, todo); | ||
461 | sch->todo = SCH_TODO_NOTHING; | ||
462 | spin_unlock_irq(sch->lock); | ||
463 | /* Perform todo. */ | ||
464 | switch (todo) { | ||
465 | case SCH_TODO_NOTHING: | ||
466 | break; | ||
467 | case SCH_TODO_EVAL: | ||
468 | ret = css_evaluate_known_subchannel(sch, 1); | ||
469 | if (ret == -EAGAIN) { | ||
470 | spin_lock_irq(sch->lock); | ||
471 | css_sched_sch_todo(sch, todo); | ||
472 | spin_unlock_irq(sch->lock); | ||
473 | } | ||
474 | break; | ||
475 | case SCH_TODO_UNREG: | ||
476 | css_sch_device_unregister(sch); | ||
477 | break; | ||
478 | } | ||
479 | /* Release workqueue ref. */ | ||
480 | put_device(&sch->dev); | ||
481 | } | ||
482 | |||
469 | static struct idset *slow_subchannel_set; | 483 | static struct idset *slow_subchannel_set; |
470 | static spinlock_t slow_subchannel_lock; | 484 | static spinlock_t slow_subchannel_lock; |
471 | static wait_queue_head_t css_eval_wq; | 485 | static wait_queue_head_t css_eval_wq; |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index d734f4a0ecac..47269858ecb6 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -1868,9 +1868,9 @@ static void __ccw_device_pm_restore(struct ccw_device *cdev) | |||
1868 | */ | 1868 | */ |
1869 | cdev->private->flags.resuming = 1; | 1869 | cdev->private->flags.resuming = 1; |
1870 | cdev->private->path_new_mask = LPM_ANYPATH; | 1870 | cdev->private->path_new_mask = LPM_ANYPATH; |
1871 | css_schedule_eval(sch->schid); | 1871 | css_sched_sch_todo(sch, SCH_TODO_EVAL); |
1872 | spin_unlock_irq(sch->lock); | 1872 | spin_unlock_irq(sch->lock); |
1873 | css_complete_work(); | 1873 | css_wait_for_slow_path(); |
1874 | 1874 | ||
1875 | /* cdev may have been moved to a different subchannel. */ | 1875 | /* cdev may have been moved to a different subchannel. */ |
1876 | sch = to_subchannel(cdev->dev.parent); | 1876 | sch = to_subchannel(cdev->dev.parent); |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 52c233fa2b12..1b853513c891 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -496,8 +496,26 @@ static void ccw_device_reset_path_events(struct ccw_device *cdev) | |||
496 | cdev->private->pgid_reset_mask = 0; | 496 | cdev->private->pgid_reset_mask = 0; |
497 | } | 497 | } |
498 | 498 | ||
499 | void | 499 | static void create_fake_irb(struct irb *irb, int type) |
500 | ccw_device_verify_done(struct ccw_device *cdev, int err) | 500 | { |
501 | memset(irb, 0, sizeof(*irb)); | ||
502 | if (type == FAKE_CMD_IRB) { | ||
503 | struct cmd_scsw *scsw = &irb->scsw.cmd; | ||
504 | scsw->cc = 1; | ||
505 | scsw->fctl = SCSW_FCTL_START_FUNC; | ||
506 | scsw->actl = SCSW_ACTL_START_PEND; | ||
507 | scsw->stctl = SCSW_STCTL_STATUS_PEND; | ||
508 | } else if (type == FAKE_TM_IRB) { | ||
509 | struct tm_scsw *scsw = &irb->scsw.tm; | ||
510 | scsw->x = 1; | ||
511 | scsw->cc = 1; | ||
512 | scsw->fctl = SCSW_FCTL_START_FUNC; | ||
513 | scsw->actl = SCSW_ACTL_START_PEND; | ||
514 | scsw->stctl = SCSW_STCTL_STATUS_PEND; | ||
515 | } | ||
516 | } | ||
517 | |||
518 | void ccw_device_verify_done(struct ccw_device *cdev, int err) | ||
501 | { | 519 | { |
502 | struct subchannel *sch; | 520 | struct subchannel *sch; |
503 | 521 | ||
@@ -520,12 +538,8 @@ callback: | |||
520 | ccw_device_done(cdev, DEV_STATE_ONLINE); | 538 | ccw_device_done(cdev, DEV_STATE_ONLINE); |
521 | /* Deliver fake irb to device driver, if needed. */ | 539 | /* Deliver fake irb to device driver, if needed. */ |
522 | if (cdev->private->flags.fake_irb) { | 540 | if (cdev->private->flags.fake_irb) { |
523 | memset(&cdev->private->irb, 0, sizeof(struct irb)); | 541 | create_fake_irb(&cdev->private->irb, |
524 | cdev->private->irb.scsw.cmd.cc = 1; | 542 | cdev->private->flags.fake_irb); |
525 | cdev->private->irb.scsw.cmd.fctl = SCSW_FCTL_START_FUNC; | ||
526 | cdev->private->irb.scsw.cmd.actl = SCSW_ACTL_START_PEND; | ||
527 | cdev->private->irb.scsw.cmd.stctl = | ||
528 | SCSW_STCTL_STATUS_PEND; | ||
529 | cdev->private->flags.fake_irb = 0; | 543 | cdev->private->flags.fake_irb = 0; |
530 | if (cdev->handler) | 544 | if (cdev->handler) |
531 | cdev->handler(cdev, cdev->private->intparm, | 545 | cdev->handler(cdev, cdev->private->intparm, |
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c index f98698d5735e..ec7fb6d3b479 100644 --- a/drivers/s390/cio/device_ops.c +++ b/drivers/s390/cio/device_ops.c | |||
@@ -198,7 +198,7 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa, | |||
198 | if (cdev->private->state == DEV_STATE_VERIFY) { | 198 | if (cdev->private->state == DEV_STATE_VERIFY) { |
199 | /* Remember to fake irb when finished. */ | 199 | /* Remember to fake irb when finished. */ |
200 | if (!cdev->private->flags.fake_irb) { | 200 | if (!cdev->private->flags.fake_irb) { |
201 | cdev->private->flags.fake_irb = 1; | 201 | cdev->private->flags.fake_irb = FAKE_CMD_IRB; |
202 | cdev->private->intparm = intparm; | 202 | cdev->private->intparm = intparm; |
203 | return 0; | 203 | return 0; |
204 | } else | 204 | } else |
@@ -213,9 +213,9 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa, | |||
213 | ret = cio_set_options (sch, flags); | 213 | ret = cio_set_options (sch, flags); |
214 | if (ret) | 214 | if (ret) |
215 | return ret; | 215 | return ret; |
216 | /* Adjust requested path mask to excluded varied off paths. */ | 216 | /* Adjust requested path mask to exclude unusable paths. */ |
217 | if (lpm) { | 217 | if (lpm) { |
218 | lpm &= sch->opm; | 218 | lpm &= sch->lpm; |
219 | if (lpm == 0) | 219 | if (lpm == 0) |
220 | return -EACCES; | 220 | return -EACCES; |
221 | } | 221 | } |
@@ -605,11 +605,21 @@ int ccw_device_tm_start_key(struct ccw_device *cdev, struct tcw *tcw, | |||
605 | sch = to_subchannel(cdev->dev.parent); | 605 | sch = to_subchannel(cdev->dev.parent); |
606 | if (!sch->schib.pmcw.ena) | 606 | if (!sch->schib.pmcw.ena) |
607 | return -EINVAL; | 607 | return -EINVAL; |
608 | if (cdev->private->state == DEV_STATE_VERIFY) { | ||
609 | /* Remember to fake irb when finished. */ | ||
610 | if (!cdev->private->flags.fake_irb) { | ||
611 | cdev->private->flags.fake_irb = FAKE_TM_IRB; | ||
612 | cdev->private->intparm = intparm; | ||
613 | return 0; | ||
614 | } else | ||
615 | /* There's already a fake I/O around. */ | ||
616 | return -EBUSY; | ||
617 | } | ||
608 | if (cdev->private->state != DEV_STATE_ONLINE) | 618 | if (cdev->private->state != DEV_STATE_ONLINE) |
609 | return -EIO; | 619 | return -EIO; |
610 | /* Adjust requested path mask to excluded varied off paths. */ | 620 | /* Adjust requested path mask to exclude unusable paths. */ |
611 | if (lpm) { | 621 | if (lpm) { |
612 | lpm &= sch->opm; | 622 | lpm &= sch->lpm; |
613 | if (lpm == 0) | 623 | if (lpm == 0) |
614 | return -EACCES; | 624 | return -EACCES; |
615 | } | 625 | } |
diff --git a/drivers/s390/cio/io_sch.h b/drivers/s390/cio/io_sch.h index 2ebb492a5c17..76253dfcc1be 100644 --- a/drivers/s390/cio/io_sch.h +++ b/drivers/s390/cio/io_sch.h | |||
@@ -111,6 +111,9 @@ enum cdev_todo { | |||
111 | CDEV_TODO_UNREG_EVAL, | 111 | CDEV_TODO_UNREG_EVAL, |
112 | }; | 112 | }; |
113 | 113 | ||
114 | #define FAKE_CMD_IRB 1 | ||
115 | #define FAKE_TM_IRB 2 | ||
116 | |||
114 | struct ccw_device_private { | 117 | struct ccw_device_private { |
115 | struct ccw_device *cdev; | 118 | struct ccw_device *cdev; |
116 | struct subchannel *sch; | 119 | struct subchannel *sch; |
@@ -138,7 +141,7 @@ struct ccw_device_private { | |||
138 | unsigned int doverify:1; /* delayed path verification */ | 141 | unsigned int doverify:1; /* delayed path verification */ |
139 | unsigned int donotify:1; /* call notify function */ | 142 | unsigned int donotify:1; /* call notify function */ |
140 | unsigned int recog_done:1; /* dev. recog. complete */ | 143 | unsigned int recog_done:1; /* dev. recog. complete */ |
141 | unsigned int fake_irb:1; /* deliver faked irb */ | 144 | unsigned int fake_irb:2; /* deliver faked irb */ |
142 | unsigned int resuming:1; /* recognition while resume */ | 145 | unsigned int resuming:1; /* recognition while resume */ |
143 | unsigned int pgroup:1; /* pathgroup is set up */ | 146 | unsigned int pgroup:1; /* pathgroup is set up */ |
144 | unsigned int mpath:1; /* multipathing is set up */ | 147 | unsigned int mpath:1; /* multipathing is set up */ |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index ec94f049e995..96bbe9d12a79 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -1552,6 +1552,8 @@ static void ap_reset(struct ap_device *ap_dev) | |||
1552 | rc = ap_init_queue(ap_dev->qid); | 1552 | rc = ap_init_queue(ap_dev->qid); |
1553 | if (rc == -ENODEV) | 1553 | if (rc == -ENODEV) |
1554 | ap_dev->unregistered = 1; | 1554 | ap_dev->unregistered = 1; |
1555 | else | ||
1556 | __ap_schedule_poll_timer(); | ||
1555 | } | 1557 | } |
1556 | 1558 | ||
1557 | static int __ap_poll_device(struct ap_device *ap_dev, unsigned long *flags) | 1559 | static int __ap_poll_device(struct ap_device *ap_dev, unsigned long *flags) |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index a1fd73df5416..8ba4510a9519 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -199,7 +199,7 @@ config SPI_FSL_LIB | |||
199 | depends on FSL_SOC | 199 | depends on FSL_SOC |
200 | 200 | ||
201 | config SPI_FSL_SPI | 201 | config SPI_FSL_SPI |
202 | tristate "Freescale SPI controller" | 202 | bool "Freescale SPI controller" |
203 | depends on FSL_SOC | 203 | depends on FSL_SOC |
204 | select SPI_FSL_LIB | 204 | select SPI_FSL_LIB |
205 | help | 205 | help |
@@ -208,7 +208,7 @@ config SPI_FSL_SPI | |||
208 | MPC8569 uses the controller in QE mode, MPC8610 in cpu mode. | 208 | MPC8569 uses the controller in QE mode, MPC8610 in cpu mode. |
209 | 209 | ||
210 | config SPI_FSL_ESPI | 210 | config SPI_FSL_ESPI |
211 | tristate "Freescale eSPI controller" | 211 | bool "Freescale eSPI controller" |
212 | depends on FSL_SOC | 212 | depends on FSL_SOC |
213 | select SPI_FSL_LIB | 213 | select SPI_FSL_LIB |
214 | help | 214 | help |
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c index 024b48aed5ca..acc88b4d2869 100644 --- a/drivers/spi/spi-ath79.c +++ b/drivers/spi/spi-ath79.c | |||
@@ -13,6 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/module.h> | ||
16 | #include <linux/init.h> | 17 | #include <linux/init.h> |
17 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
18 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c index e093d3ec41ba..0094c645ff0d 100644 --- a/drivers/spi/spi-gpio.c +++ b/drivers/spi/spi-gpio.c | |||
@@ -256,7 +256,7 @@ static void spi_gpio_cleanup(struct spi_device *spi) | |||
256 | spi_bitbang_cleanup(spi); | 256 | spi_bitbang_cleanup(spi); |
257 | } | 257 | } |
258 | 258 | ||
259 | static int __init spi_gpio_alloc(unsigned pin, const char *label, bool is_in) | 259 | static int __devinit spi_gpio_alloc(unsigned pin, const char *label, bool is_in) |
260 | { | 260 | { |
261 | int value; | 261 | int value; |
262 | 262 | ||
@@ -270,7 +270,7 @@ static int __init spi_gpio_alloc(unsigned pin, const char *label, bool is_in) | |||
270 | return value; | 270 | return value; |
271 | } | 271 | } |
272 | 272 | ||
273 | static int __init | 273 | static int __devinit |
274 | spi_gpio_request(struct spi_gpio_platform_data *pdata, const char *label, | 274 | spi_gpio_request(struct spi_gpio_platform_data *pdata, const char *label, |
275 | u16 *res_flags) | 275 | u16 *res_flags) |
276 | { | 276 | { |
diff --git a/drivers/spi/spi-nuc900.c b/drivers/spi/spi-nuc900.c index 21c70b2b8311..182e9c873822 100644 --- a/drivers/spi/spi-nuc900.c +++ b/drivers/spi/spi-nuc900.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/module.h> | ||
11 | #include <linux/init.h> | 12 | #include <linux/init.h> |
12 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
13 | #include <linux/workqueue.h> | 14 | #include <linux/workqueue.h> |
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 21d8c1c16cd8..5e78c77d5a08 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c | |||
@@ -671,7 +671,7 @@ static int do_insnlist_ioctl(struct comedi_device *dev, | |||
671 | } | 671 | } |
672 | 672 | ||
673 | insns = | 673 | insns = |
674 | kmalloc(sizeof(struct comedi_insn) * insnlist.n_insns, GFP_KERNEL); | 674 | kcalloc(insnlist.n_insns, sizeof(struct comedi_insn), GFP_KERNEL); |
675 | if (!insns) { | 675 | if (!insns) { |
676 | DPRINTK("kmalloc failed\n"); | 676 | DPRINTK("kmalloc failed\n"); |
677 | ret = -ENOMEM; | 677 | ret = -ENOMEM; |
@@ -1432,7 +1432,21 @@ static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s) | |||
1432 | return ret; | 1432 | return ret; |
1433 | } | 1433 | } |
1434 | 1434 | ||
1435 | static void comedi_unmap(struct vm_area_struct *area) | 1435 | |
1436 | static void comedi_vm_open(struct vm_area_struct *area) | ||
1437 | { | ||
1438 | struct comedi_async *async; | ||
1439 | struct comedi_device *dev; | ||
1440 | |||
1441 | async = area->vm_private_data; | ||
1442 | dev = async->subdevice->device; | ||
1443 | |||
1444 | mutex_lock(&dev->mutex); | ||
1445 | async->mmap_count++; | ||
1446 | mutex_unlock(&dev->mutex); | ||
1447 | } | ||
1448 | |||
1449 | static void comedi_vm_close(struct vm_area_struct *area) | ||
1436 | { | 1450 | { |
1437 | struct comedi_async *async; | 1451 | struct comedi_async *async; |
1438 | struct comedi_device *dev; | 1452 | struct comedi_device *dev; |
@@ -1446,15 +1460,13 @@ static void comedi_unmap(struct vm_area_struct *area) | |||
1446 | } | 1460 | } |
1447 | 1461 | ||
1448 | static struct vm_operations_struct comedi_vm_ops = { | 1462 | static struct vm_operations_struct comedi_vm_ops = { |
1449 | .close = comedi_unmap, | 1463 | .open = comedi_vm_open, |
1464 | .close = comedi_vm_close, | ||
1450 | }; | 1465 | }; |
1451 | 1466 | ||
1452 | static int comedi_mmap(struct file *file, struct vm_area_struct *vma) | 1467 | static int comedi_mmap(struct file *file, struct vm_area_struct *vma) |
1453 | { | 1468 | { |
1454 | const unsigned minor = iminor(file->f_dentry->d_inode); | 1469 | const unsigned minor = iminor(file->f_dentry->d_inode); |
1455 | struct comedi_device_file_info *dev_file_info = | ||
1456 | comedi_get_device_file_info(minor); | ||
1457 | struct comedi_device *dev = dev_file_info->device; | ||
1458 | struct comedi_async *async = NULL; | 1470 | struct comedi_async *async = NULL; |
1459 | unsigned long start = vma->vm_start; | 1471 | unsigned long start = vma->vm_start; |
1460 | unsigned long size; | 1472 | unsigned long size; |
@@ -1462,6 +1474,15 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) | |||
1462 | int i; | 1474 | int i; |
1463 | int retval; | 1475 | int retval; |
1464 | struct comedi_subdevice *s; | 1476 | struct comedi_subdevice *s; |
1477 | struct comedi_device_file_info *dev_file_info; | ||
1478 | struct comedi_device *dev; | ||
1479 | |||
1480 | dev_file_info = comedi_get_device_file_info(minor); | ||
1481 | if (dev_file_info == NULL) | ||
1482 | return -ENODEV; | ||
1483 | dev = dev_file_info->device; | ||
1484 | if (dev == NULL) | ||
1485 | return -ENODEV; | ||
1465 | 1486 | ||
1466 | mutex_lock(&dev->mutex); | 1487 | mutex_lock(&dev->mutex); |
1467 | if (!dev->attached) { | 1488 | if (!dev->attached) { |
@@ -1528,11 +1549,17 @@ static unsigned int comedi_poll(struct file *file, poll_table * wait) | |||
1528 | { | 1549 | { |
1529 | unsigned int mask = 0; | 1550 | unsigned int mask = 0; |
1530 | const unsigned minor = iminor(file->f_dentry->d_inode); | 1551 | const unsigned minor = iminor(file->f_dentry->d_inode); |
1531 | struct comedi_device_file_info *dev_file_info = | ||
1532 | comedi_get_device_file_info(minor); | ||
1533 | struct comedi_device *dev = dev_file_info->device; | ||
1534 | struct comedi_subdevice *read_subdev; | 1552 | struct comedi_subdevice *read_subdev; |
1535 | struct comedi_subdevice *write_subdev; | 1553 | struct comedi_subdevice *write_subdev; |
1554 | struct comedi_device_file_info *dev_file_info; | ||
1555 | struct comedi_device *dev; | ||
1556 | dev_file_info = comedi_get_device_file_info(minor); | ||
1557 | |||
1558 | if (dev_file_info == NULL) | ||
1559 | return -ENODEV; | ||
1560 | dev = dev_file_info->device; | ||
1561 | if (dev == NULL) | ||
1562 | return -ENODEV; | ||
1536 | 1563 | ||
1537 | mutex_lock(&dev->mutex); | 1564 | mutex_lock(&dev->mutex); |
1538 | if (!dev->attached) { | 1565 | if (!dev->attached) { |
@@ -1578,9 +1605,15 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, | |||
1578 | int n, m, count = 0, retval = 0; | 1605 | int n, m, count = 0, retval = 0; |
1579 | DECLARE_WAITQUEUE(wait, current); | 1606 | DECLARE_WAITQUEUE(wait, current); |
1580 | const unsigned minor = iminor(file->f_dentry->d_inode); | 1607 | const unsigned minor = iminor(file->f_dentry->d_inode); |
1581 | struct comedi_device_file_info *dev_file_info = | 1608 | struct comedi_device_file_info *dev_file_info; |
1582 | comedi_get_device_file_info(minor); | 1609 | struct comedi_device *dev; |
1583 | struct comedi_device *dev = dev_file_info->device; | 1610 | dev_file_info = comedi_get_device_file_info(minor); |
1611 | |||
1612 | if (dev_file_info == NULL) | ||
1613 | return -ENODEV; | ||
1614 | dev = dev_file_info->device; | ||
1615 | if (dev == NULL) | ||
1616 | return -ENODEV; | ||
1584 | 1617 | ||
1585 | if (!dev->attached) { | 1618 | if (!dev->attached) { |
1586 | DPRINTK("no driver configured on comedi%i\n", dev->minor); | 1619 | DPRINTK("no driver configured on comedi%i\n", dev->minor); |
@@ -1640,11 +1673,11 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, | |||
1640 | retval = -EAGAIN; | 1673 | retval = -EAGAIN; |
1641 | break; | 1674 | break; |
1642 | } | 1675 | } |
1676 | schedule(); | ||
1643 | if (signal_pending(current)) { | 1677 | if (signal_pending(current)) { |
1644 | retval = -ERESTARTSYS; | 1678 | retval = -ERESTARTSYS; |
1645 | break; | 1679 | break; |
1646 | } | 1680 | } |
1647 | schedule(); | ||
1648 | if (!s->busy) | 1681 | if (!s->busy) |
1649 | break; | 1682 | break; |
1650 | if (s->busy != file) { | 1683 | if (s->busy != file) { |
@@ -1683,9 +1716,15 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, | |||
1683 | int n, m, count = 0, retval = 0; | 1716 | int n, m, count = 0, retval = 0; |
1684 | DECLARE_WAITQUEUE(wait, current); | 1717 | DECLARE_WAITQUEUE(wait, current); |
1685 | const unsigned minor = iminor(file->f_dentry->d_inode); | 1718 | const unsigned minor = iminor(file->f_dentry->d_inode); |
1686 | struct comedi_device_file_info *dev_file_info = | 1719 | struct comedi_device_file_info *dev_file_info; |
1687 | comedi_get_device_file_info(minor); | 1720 | struct comedi_device *dev; |
1688 | struct comedi_device *dev = dev_file_info->device; | 1721 | dev_file_info = comedi_get_device_file_info(minor); |
1722 | |||
1723 | if (dev_file_info == NULL) | ||
1724 | return -ENODEV; | ||
1725 | dev = dev_file_info->device; | ||
1726 | if (dev == NULL) | ||
1727 | return -ENODEV; | ||
1689 | 1728 | ||
1690 | if (!dev->attached) { | 1729 | if (!dev->attached) { |
1691 | DPRINTK("no driver configured on comedi%i\n", dev->minor); | 1730 | DPRINTK("no driver configured on comedi%i\n", dev->minor); |
@@ -1741,11 +1780,11 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, | |||
1741 | retval = -EAGAIN; | 1780 | retval = -EAGAIN; |
1742 | break; | 1781 | break; |
1743 | } | 1782 | } |
1783 | schedule(); | ||
1744 | if (signal_pending(current)) { | 1784 | if (signal_pending(current)) { |
1745 | retval = -ERESTARTSYS; | 1785 | retval = -ERESTARTSYS; |
1746 | break; | 1786 | break; |
1747 | } | 1787 | } |
1748 | schedule(); | ||
1749 | if (!s->busy) { | 1788 | if (!s->busy) { |
1750 | retval = 0; | 1789 | retval = 0; |
1751 | break; | 1790 | break; |
@@ -1885,11 +1924,17 @@ ok: | |||
1885 | static int comedi_close(struct inode *inode, struct file *file) | 1924 | static int comedi_close(struct inode *inode, struct file *file) |
1886 | { | 1925 | { |
1887 | const unsigned minor = iminor(inode); | 1926 | const unsigned minor = iminor(inode); |
1888 | struct comedi_device_file_info *dev_file_info = | ||
1889 | comedi_get_device_file_info(minor); | ||
1890 | struct comedi_device *dev = dev_file_info->device; | ||
1891 | struct comedi_subdevice *s = NULL; | 1927 | struct comedi_subdevice *s = NULL; |
1892 | int i; | 1928 | int i; |
1929 | struct comedi_device_file_info *dev_file_info; | ||
1930 | struct comedi_device *dev; | ||
1931 | dev_file_info = comedi_get_device_file_info(minor); | ||
1932 | |||
1933 | if (dev_file_info == NULL) | ||
1934 | return -ENODEV; | ||
1935 | dev = dev_file_info->device; | ||
1936 | if (dev == NULL) | ||
1937 | return -ENODEV; | ||
1893 | 1938 | ||
1894 | mutex_lock(&dev->mutex); | 1939 | mutex_lock(&dev->mutex); |
1895 | 1940 | ||
@@ -1923,10 +1968,15 @@ static int comedi_close(struct inode *inode, struct file *file) | |||
1923 | static int comedi_fasync(int fd, struct file *file, int on) | 1968 | static int comedi_fasync(int fd, struct file *file, int on) |
1924 | { | 1969 | { |
1925 | const unsigned minor = iminor(file->f_dentry->d_inode); | 1970 | const unsigned minor = iminor(file->f_dentry->d_inode); |
1926 | struct comedi_device_file_info *dev_file_info = | 1971 | struct comedi_device_file_info *dev_file_info; |
1927 | comedi_get_device_file_info(minor); | 1972 | struct comedi_device *dev; |
1973 | dev_file_info = comedi_get_device_file_info(minor); | ||
1928 | 1974 | ||
1929 | struct comedi_device *dev = dev_file_info->device; | 1975 | if (dev_file_info == NULL) |
1976 | return -ENODEV; | ||
1977 | dev = dev_file_info->device; | ||
1978 | if (dev == NULL) | ||
1979 | return -ENODEV; | ||
1930 | 1980 | ||
1931 | return fasync_helper(fd, file, on, &dev->async_queue); | 1981 | return fasync_helper(fd, file, on, &dev->async_queue); |
1932 | } | 1982 | } |
diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index a8fea9a91733..6144afb8cbaa 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #define DRIVER_VERSION "v0.5" | 1 | #define DRIVER_VERSION "v0.6" |
2 | #define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" | 2 | #define DRIVER_AUTHOR "Bernd Porr, BerndPorr@f2s.com" |
3 | #define DRIVER_DESC "Stirling/ITL USB-DUX SIGMA -- Bernd.Porr@f2s.com" | 3 | #define DRIVER_DESC "Stirling/ITL USB-DUX SIGMA -- Bernd.Porr@f2s.com" |
4 | /* | 4 | /* |
@@ -25,7 +25,7 @@ Driver: usbduxsigma | |||
25 | Description: University of Stirling USB DAQ & INCITE Technology Limited | 25 | Description: University of Stirling USB DAQ & INCITE Technology Limited |
26 | Devices: [ITL] USB-DUX (usbduxsigma.o) | 26 | Devices: [ITL] USB-DUX (usbduxsigma.o) |
27 | Author: Bernd Porr <BerndPorr@f2s.com> | 27 | Author: Bernd Porr <BerndPorr@f2s.com> |
28 | Updated: 21 Jul 2011 | 28 | Updated: 8 Nov 2011 |
29 | Status: testing | 29 | Status: testing |
30 | */ | 30 | */ |
31 | /* | 31 | /* |
@@ -44,6 +44,7 @@ Status: testing | |||
44 | * 0.3: proper vendor ID and driver name | 44 | * 0.3: proper vendor ID and driver name |
45 | * 0.4: fixed D/A voltage range | 45 | * 0.4: fixed D/A voltage range |
46 | * 0.5: various bug fixes, health check at startup | 46 | * 0.5: various bug fixes, health check at startup |
47 | * 0.6: corrected wrong input range | ||
47 | */ | 48 | */ |
48 | 49 | ||
49 | /* generates loads of debug info */ | 50 | /* generates loads of debug info */ |
@@ -175,7 +176,7 @@ Status: testing | |||
175 | /* comedi constants */ | 176 | /* comedi constants */ |
176 | static const struct comedi_lrange range_usbdux_ai_range = { 1, { | 177 | static const struct comedi_lrange range_usbdux_ai_range = { 1, { |
177 | BIP_RANGE | 178 | BIP_RANGE |
178 | (2.65) | 179 | (2.65/2.0) |
179 | } | 180 | } |
180 | }; | 181 | }; |
181 | 182 | ||
diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c index 480b0ed2e4de..115635f95024 100644 --- a/drivers/staging/rts_pstor/rtsx.c +++ b/drivers/staging/rts_pstor/rtsx.c | |||
@@ -1021,6 +1021,7 @@ static int __devinit rtsx_probe(struct pci_dev *pci, | |||
1021 | th = kthread_create(rtsx_scan_thread, dev, "rtsx-scan"); | 1021 | th = kthread_create(rtsx_scan_thread, dev, "rtsx-scan"); |
1022 | if (IS_ERR(th)) { | 1022 | if (IS_ERR(th)) { |
1023 | printk(KERN_ERR "Unable to start the device-scanning thread\n"); | 1023 | printk(KERN_ERR "Unable to start the device-scanning thread\n"); |
1024 | complete(&dev->scanning_done); | ||
1024 | quiesce_and_remove_host(dev); | 1025 | quiesce_and_remove_host(dev); |
1025 | err = PTR_ERR(th); | 1026 | err = PTR_ERR(th); |
1026 | goto errout; | 1027 | goto errout; |
diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c index 09c44abb89e8..3872b8cccdcf 100644 --- a/drivers/staging/usbip/vhci_rx.c +++ b/drivers/staging/usbip/vhci_rx.c | |||
@@ -68,6 +68,7 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, | |||
68 | { | 68 | { |
69 | struct usbip_device *ud = &vdev->ud; | 69 | struct usbip_device *ud = &vdev->ud; |
70 | struct urb *urb; | 70 | struct urb *urb; |
71 | unsigned long flags; | ||
71 | 72 | ||
72 | spin_lock(&vdev->priv_lock); | 73 | spin_lock(&vdev->priv_lock); |
73 | urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum); | 74 | urb = pickup_urb_and_free_priv(vdev, pdu->base.seqnum); |
@@ -101,9 +102,9 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, | |||
101 | 102 | ||
102 | usbip_dbg_vhci_rx("now giveback urb %p\n", urb); | 103 | usbip_dbg_vhci_rx("now giveback urb %p\n", urb); |
103 | 104 | ||
104 | spin_lock(&the_controller->lock); | 105 | spin_lock_irqsave(&the_controller->lock, flags); |
105 | usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); | 106 | usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); |
106 | spin_unlock(&the_controller->lock); | 107 | spin_unlock_irqrestore(&the_controller->lock, flags); |
107 | 108 | ||
108 | usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status); | 109 | usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, urb->status); |
109 | 110 | ||
@@ -141,6 +142,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, | |||
141 | { | 142 | { |
142 | struct vhci_unlink *unlink; | 143 | struct vhci_unlink *unlink; |
143 | struct urb *urb; | 144 | struct urb *urb; |
145 | unsigned long flags; | ||
144 | 146 | ||
145 | usbip_dump_header(pdu); | 147 | usbip_dump_header(pdu); |
146 | 148 | ||
@@ -170,9 +172,9 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, | |||
170 | urb->status = pdu->u.ret_unlink.status; | 172 | urb->status = pdu->u.ret_unlink.status; |
171 | pr_info("urb->status %d\n", urb->status); | 173 | pr_info("urb->status %d\n", urb->status); |
172 | 174 | ||
173 | spin_lock(&the_controller->lock); | 175 | spin_lock_irqsave(&the_controller->lock, flags); |
174 | usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); | 176 | usb_hcd_unlink_urb_from_ep(vhci_to_hcd(the_controller), urb); |
175 | spin_unlock(&the_controller->lock); | 177 | spin_unlock_irqrestore(&the_controller->lock, flags); |
176 | 178 | ||
177 | usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, | 179 | usb_hcd_giveback_urb(vhci_to_hcd(the_controller), urb, |
178 | urb->status); | 180 | urb->status); |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 0fd96c10271d..8599545cdf9e 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -614,13 +614,12 @@ int iscsit_add_reject( | |||
614 | hdr = (struct iscsi_reject *) cmd->pdu; | 614 | hdr = (struct iscsi_reject *) cmd->pdu; |
615 | hdr->reason = reason; | 615 | hdr->reason = reason; |
616 | 616 | ||
617 | cmd->buf_ptr = kzalloc(ISCSI_HDR_LEN, GFP_KERNEL); | 617 | cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); |
618 | if (!cmd->buf_ptr) { | 618 | if (!cmd->buf_ptr) { |
619 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); | 619 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); |
620 | iscsit_release_cmd(cmd); | 620 | iscsit_release_cmd(cmd); |
621 | return -1; | 621 | return -1; |
622 | } | 622 | } |
623 | memcpy(cmd->buf_ptr, buf, ISCSI_HDR_LEN); | ||
624 | 623 | ||
625 | spin_lock_bh(&conn->cmd_lock); | 624 | spin_lock_bh(&conn->cmd_lock); |
626 | list_add_tail(&cmd->i_list, &conn->conn_cmd_list); | 625 | list_add_tail(&cmd->i_list, &conn->conn_cmd_list); |
@@ -661,13 +660,12 @@ int iscsit_add_reject_from_cmd( | |||
661 | hdr = (struct iscsi_reject *) cmd->pdu; | 660 | hdr = (struct iscsi_reject *) cmd->pdu; |
662 | hdr->reason = reason; | 661 | hdr->reason = reason; |
663 | 662 | ||
664 | cmd->buf_ptr = kzalloc(ISCSI_HDR_LEN, GFP_KERNEL); | 663 | cmd->buf_ptr = kmemdup(buf, ISCSI_HDR_LEN, GFP_KERNEL); |
665 | if (!cmd->buf_ptr) { | 664 | if (!cmd->buf_ptr) { |
666 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); | 665 | pr_err("Unable to allocate memory for cmd->buf_ptr\n"); |
667 | iscsit_release_cmd(cmd); | 666 | iscsit_release_cmd(cmd); |
668 | return -1; | 667 | return -1; |
669 | } | 668 | } |
670 | memcpy(cmd->buf_ptr, buf, ISCSI_HDR_LEN); | ||
671 | 669 | ||
672 | if (add_to_conn) { | 670 | if (add_to_conn) { |
673 | spin_lock_bh(&conn->cmd_lock); | 671 | spin_lock_bh(&conn->cmd_lock); |
@@ -1017,11 +1015,6 @@ done: | |||
1017 | " non-existent or non-exported iSCSI LUN:" | 1015 | " non-existent or non-exported iSCSI LUN:" |
1018 | " 0x%016Lx\n", get_unaligned_le64(&hdr->lun)); | 1016 | " 0x%016Lx\n", get_unaligned_le64(&hdr->lun)); |
1019 | } | 1017 | } |
1020 | if (ret == PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES) | ||
1021 | return iscsit_add_reject_from_cmd( | ||
1022 | ISCSI_REASON_BOOKMARK_NO_RESOURCES, | ||
1023 | 1, 1, buf, cmd); | ||
1024 | |||
1025 | send_check_condition = 1; | 1018 | send_check_condition = 1; |
1026 | goto attach_cmd; | 1019 | goto attach_cmd; |
1027 | } | 1020 | } |
@@ -1044,6 +1037,8 @@ done: | |||
1044 | */ | 1037 | */ |
1045 | send_check_condition = 1; | 1038 | send_check_condition = 1; |
1046 | } else { | 1039 | } else { |
1040 | cmd->data_length = cmd->se_cmd.data_length; | ||
1041 | |||
1047 | if (iscsit_decide_list_to_build(cmd, payload_length) < 0) | 1042 | if (iscsit_decide_list_to_build(cmd, payload_length) < 0) |
1048 | return iscsit_add_reject_from_cmd( | 1043 | return iscsit_add_reject_from_cmd( |
1049 | ISCSI_REASON_BOOKMARK_NO_RESOURCES, | 1044 | ISCSI_REASON_BOOKMARK_NO_RESOURCES, |
@@ -1123,7 +1118,7 @@ attach_cmd: | |||
1123 | * the backend memory allocation. | 1118 | * the backend memory allocation. |
1124 | */ | 1119 | */ |
1125 | ret = transport_generic_new_cmd(&cmd->se_cmd); | 1120 | ret = transport_generic_new_cmd(&cmd->se_cmd); |
1126 | if ((ret < 0) || (cmd->se_cmd.se_cmd_flags & SCF_SE_CMD_FAILED)) { | 1121 | if (ret < 0) { |
1127 | immed_ret = IMMEDIATE_DATA_NORMAL_OPERATION; | 1122 | immed_ret = IMMEDIATE_DATA_NORMAL_OPERATION; |
1128 | dump_immediate_data = 1; | 1123 | dump_immediate_data = 1; |
1129 | goto after_immediate_data; | 1124 | goto after_immediate_data; |
@@ -1341,7 +1336,7 @@ static int iscsit_handle_data_out(struct iscsi_conn *conn, unsigned char *buf) | |||
1341 | 1336 | ||
1342 | spin_lock_irqsave(&se_cmd->t_state_lock, flags); | 1337 | spin_lock_irqsave(&se_cmd->t_state_lock, flags); |
1343 | if (!(se_cmd->se_cmd_flags & SCF_SUPPORTED_SAM_OPCODE) || | 1338 | if (!(se_cmd->se_cmd_flags & SCF_SUPPORTED_SAM_OPCODE) || |
1344 | (se_cmd->se_cmd_flags & SCF_SE_CMD_FAILED)) | 1339 | (se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION)) |
1345 | dump_unsolicited_data = 1; | 1340 | dump_unsolicited_data = 1; |
1346 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); | 1341 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); |
1347 | 1342 | ||
@@ -2513,10 +2508,10 @@ static int iscsit_send_data_in( | |||
2513 | if (hdr->flags & ISCSI_FLAG_DATA_STATUS) { | 2508 | if (hdr->flags & ISCSI_FLAG_DATA_STATUS) { |
2514 | if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { | 2509 | if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { |
2515 | hdr->flags |= ISCSI_FLAG_DATA_OVERFLOW; | 2510 | hdr->flags |= ISCSI_FLAG_DATA_OVERFLOW; |
2516 | hdr->residual_count = cpu_to_be32(cmd->residual_count); | 2511 | hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); |
2517 | } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { | 2512 | } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { |
2518 | hdr->flags |= ISCSI_FLAG_DATA_UNDERFLOW; | 2513 | hdr->flags |= ISCSI_FLAG_DATA_UNDERFLOW; |
2519 | hdr->residual_count = cpu_to_be32(cmd->residual_count); | 2514 | hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); |
2520 | } | 2515 | } |
2521 | } | 2516 | } |
2522 | hton24(hdr->dlength, datain.length); | 2517 | hton24(hdr->dlength, datain.length); |
@@ -3018,10 +3013,10 @@ static int iscsit_send_status( | |||
3018 | hdr->flags |= ISCSI_FLAG_CMD_FINAL; | 3013 | hdr->flags |= ISCSI_FLAG_CMD_FINAL; |
3019 | if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { | 3014 | if (cmd->se_cmd.se_cmd_flags & SCF_OVERFLOW_BIT) { |
3020 | hdr->flags |= ISCSI_FLAG_CMD_OVERFLOW; | 3015 | hdr->flags |= ISCSI_FLAG_CMD_OVERFLOW; |
3021 | hdr->residual_count = cpu_to_be32(cmd->residual_count); | 3016 | hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); |
3022 | } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { | 3017 | } else if (cmd->se_cmd.se_cmd_flags & SCF_UNDERFLOW_BIT) { |
3023 | hdr->flags |= ISCSI_FLAG_CMD_UNDERFLOW; | 3018 | hdr->flags |= ISCSI_FLAG_CMD_UNDERFLOW; |
3024 | hdr->residual_count = cpu_to_be32(cmd->residual_count); | 3019 | hdr->residual_count = cpu_to_be32(cmd->se_cmd.residual_count); |
3025 | } | 3020 | } |
3026 | hdr->response = cmd->iscsi_response; | 3021 | hdr->response = cmd->iscsi_response; |
3027 | hdr->cmd_status = cmd->se_cmd.scsi_status; | 3022 | hdr->cmd_status = cmd->se_cmd.scsi_status; |
@@ -3133,6 +3128,7 @@ static int iscsit_send_task_mgt_rsp( | |||
3133 | hdr = (struct iscsi_tm_rsp *) cmd->pdu; | 3128 | hdr = (struct iscsi_tm_rsp *) cmd->pdu; |
3134 | memset(hdr, 0, ISCSI_HDR_LEN); | 3129 | memset(hdr, 0, ISCSI_HDR_LEN); |
3135 | hdr->opcode = ISCSI_OP_SCSI_TMFUNC_RSP; | 3130 | hdr->opcode = ISCSI_OP_SCSI_TMFUNC_RSP; |
3131 | hdr->flags = ISCSI_FLAG_CMD_FINAL; | ||
3136 | hdr->response = iscsit_convert_tcm_tmr_rsp(se_tmr); | 3132 | hdr->response = iscsit_convert_tcm_tmr_rsp(se_tmr); |
3137 | hdr->itt = cpu_to_be32(cmd->init_task_tag); | 3133 | hdr->itt = cpu_to_be32(cmd->init_task_tag); |
3138 | cmd->stat_sn = conn->stat_sn++; | 3134 | cmd->stat_sn = conn->stat_sn++; |
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index beb39469e7f1..1cd6ce373b83 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
@@ -30,9 +30,11 @@ | |||
30 | 30 | ||
31 | static int chap_string_to_hex(unsigned char *dst, unsigned char *src, int len) | 31 | static int chap_string_to_hex(unsigned char *dst, unsigned char *src, int len) |
32 | { | 32 | { |
33 | int j = DIV_ROUND_UP(len, 2); | 33 | int j = DIV_ROUND_UP(len, 2), rc; |
34 | 34 | ||
35 | hex2bin(dst, src, j); | 35 | rc = hex2bin(dst, src, j); |
36 | if (rc < 0) | ||
37 | pr_debug("CHAP string contains non hex digit symbols\n"); | ||
36 | 38 | ||
37 | dst[j] = '\0'; | 39 | dst[j] = '\0'; |
38 | return j; | 40 | return j; |
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h index 3723d90d5ae5..f1a02dad05a0 100644 --- a/drivers/target/iscsi/iscsi_target_core.h +++ b/drivers/target/iscsi/iscsi_target_core.h | |||
@@ -398,7 +398,6 @@ struct iscsi_cmd { | |||
398 | u32 pdu_send_order; | 398 | u32 pdu_send_order; |
399 | /* Current struct iscsi_pdu in struct iscsi_cmd->pdu_list */ | 399 | /* Current struct iscsi_pdu in struct iscsi_cmd->pdu_list */ |
400 | u32 pdu_start; | 400 | u32 pdu_start; |
401 | u32 residual_count; | ||
402 | /* Next struct iscsi_seq to send in struct iscsi_cmd->seq_list */ | 401 | /* Next struct iscsi_seq to send in struct iscsi_cmd->seq_list */ |
403 | u32 seq_send_order; | 402 | u32 seq_send_order; |
404 | /* Number of struct iscsi_seq in struct iscsi_cmd->seq_list */ | 403 | /* Number of struct iscsi_seq in struct iscsi_cmd->seq_list */ |
@@ -535,7 +534,6 @@ struct iscsi_conn { | |||
535 | atomic_t connection_exit; | 534 | atomic_t connection_exit; |
536 | atomic_t connection_recovery; | 535 | atomic_t connection_recovery; |
537 | atomic_t connection_reinstatement; | 536 | atomic_t connection_reinstatement; |
538 | atomic_t connection_wait; | ||
539 | atomic_t connection_wait_rcfr; | 537 | atomic_t connection_wait_rcfr; |
540 | atomic_t sleep_on_conn_wait_comp; | 538 | atomic_t sleep_on_conn_wait_comp; |
541 | atomic_t transport_failed; | 539 | atomic_t transport_failed; |
@@ -643,7 +641,6 @@ struct iscsi_session { | |||
643 | atomic_t session_reinstatement; | 641 | atomic_t session_reinstatement; |
644 | atomic_t session_stop_active; | 642 | atomic_t session_stop_active; |
645 | atomic_t sleep_on_sess_wait_comp; | 643 | atomic_t sleep_on_sess_wait_comp; |
646 | atomic_t transport_wait_cmds; | ||
647 | /* connection list */ | 644 | /* connection list */ |
648 | struct list_head sess_conn_list; | 645 | struct list_head sess_conn_list; |
649 | struct list_head cr_active_list; | 646 | struct list_head cr_active_list; |
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index c4c68da3e500..101b1beb3bca 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c | |||
@@ -938,8 +938,7 @@ int iscsit_execute_cmd(struct iscsi_cmd *cmd, int ooo) | |||
938 | * handle the SCF_SCSI_RESERVATION_CONFLICT case here as well. | 938 | * handle the SCF_SCSI_RESERVATION_CONFLICT case here as well. |
939 | */ | 939 | */ |
940 | if (se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION) { | 940 | if (se_cmd->se_cmd_flags & SCF_SCSI_CDB_EXCEPTION) { |
941 | if (se_cmd->se_cmd_flags & | 941 | if (se_cmd->scsi_sense_reason == TCM_RESERVATION_CONFLICT) { |
942 | SCF_SCSI_RESERVATION_CONFLICT) { | ||
943 | cmd->i_state = ISTATE_SEND_STATUS; | 942 | cmd->i_state = ISTATE_SEND_STATUS; |
944 | spin_unlock_bh(&cmd->istate_lock); | 943 | spin_unlock_bh(&cmd->istate_lock); |
945 | iscsit_add_cmd_to_response_queue(cmd, cmd->conn, | 944 | iscsit_add_cmd_to_response_queue(cmd, cmd->conn, |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index daad362a93ce..d734bdec24f9 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -224,7 +224,7 @@ static int iscsi_login_zero_tsih_s1( | |||
224 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | 224 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
225 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 225 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
226 | pr_err("Could not allocate memory for session\n"); | 226 | pr_err("Could not allocate memory for session\n"); |
227 | return -1; | 227 | return -ENOMEM; |
228 | } | 228 | } |
229 | 229 | ||
230 | iscsi_login_set_conn_values(sess, conn, pdu->cid); | 230 | iscsi_login_set_conn_values(sess, conn, pdu->cid); |
@@ -250,7 +250,8 @@ static int iscsi_login_zero_tsih_s1( | |||
250 | pr_err("idr_pre_get() for sess_idr failed\n"); | 250 | pr_err("idr_pre_get() for sess_idr failed\n"); |
251 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | 251 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
252 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 252 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
253 | return -1; | 253 | kfree(sess); |
254 | return -ENOMEM; | ||
254 | } | 255 | } |
255 | spin_lock(&sess_idr_lock); | 256 | spin_lock(&sess_idr_lock); |
256 | idr_get_new(&sess_idr, NULL, &sess->session_index); | 257 | idr_get_new(&sess_idr, NULL, &sess->session_index); |
@@ -270,14 +271,16 @@ static int iscsi_login_zero_tsih_s1( | |||
270 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 271 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
271 | pr_err("Unable to allocate memory for" | 272 | pr_err("Unable to allocate memory for" |
272 | " struct iscsi_sess_ops.\n"); | 273 | " struct iscsi_sess_ops.\n"); |
273 | return -1; | 274 | kfree(sess); |
275 | return -ENOMEM; | ||
274 | } | 276 | } |
275 | 277 | ||
276 | sess->se_sess = transport_init_session(); | 278 | sess->se_sess = transport_init_session(); |
277 | if (!sess->se_sess) { | 279 | if (IS_ERR(sess->se_sess)) { |
278 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | 280 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
279 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 281 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
280 | return -1; | 282 | kfree(sess); |
283 | return -ENOMEM; | ||
281 | } | 284 | } |
282 | 285 | ||
283 | return 0; | 286 | return 0; |
diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c index 426cd4bf6a9a..98936cb7c294 100644 --- a/drivers/target/iscsi/iscsi_target_nego.c +++ b/drivers/target/iscsi/iscsi_target_nego.c | |||
@@ -981,14 +981,13 @@ struct iscsi_login *iscsi_target_init_negotiation( | |||
981 | return NULL; | 981 | return NULL; |
982 | } | 982 | } |
983 | 983 | ||
984 | login->req = kzalloc(ISCSI_HDR_LEN, GFP_KERNEL); | 984 | login->req = kmemdup(login_pdu, ISCSI_HDR_LEN, GFP_KERNEL); |
985 | if (!login->req) { | 985 | if (!login->req) { |
986 | pr_err("Unable to allocate memory for Login Request.\n"); | 986 | pr_err("Unable to allocate memory for Login Request.\n"); |
987 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | 987 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
988 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 988 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
989 | goto out; | 989 | goto out; |
990 | } | 990 | } |
991 | memcpy(login->req, login_pdu, ISCSI_HDR_LEN); | ||
992 | 991 | ||
993 | login->req_buf = kzalloc(MAX_KEY_VALUE_PAIRS, GFP_KERNEL); | 992 | login->req_buf = kzalloc(MAX_KEY_VALUE_PAIRS, GFP_KERNEL); |
994 | if (!login->req_buf) { | 993 | if (!login->req_buf) { |
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 3df1c9b8ae6b..81d5832fbbd5 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c | |||
@@ -113,11 +113,9 @@ static struct se_cmd *tcm_loop_allocate_core_cmd( | |||
113 | scsi_bufflen(sc), sc->sc_data_direction, sam_task_attr, | 113 | scsi_bufflen(sc), sc->sc_data_direction, sam_task_attr, |
114 | &tl_cmd->tl_sense_buf[0]); | 114 | &tl_cmd->tl_sense_buf[0]); |
115 | 115 | ||
116 | /* | ||
117 | * Signal BIDI usage with T_TASK(cmd)->t_tasks_bidi | ||
118 | */ | ||
119 | if (scsi_bidi_cmnd(sc)) | 116 | if (scsi_bidi_cmnd(sc)) |
120 | se_cmd->t_tasks_bidi = 1; | 117 | se_cmd->se_cmd_flags |= SCF_BIDI; |
118 | |||
121 | /* | 119 | /* |
122 | * Locate the struct se_lun pointer and attach it to struct se_cmd | 120 | * Locate the struct se_lun pointer and attach it to struct se_cmd |
123 | */ | 121 | */ |
@@ -148,27 +146,13 @@ static int tcm_loop_new_cmd_map(struct se_cmd *se_cmd) | |||
148 | * Allocate the necessary tasks to complete the received CDB+data | 146 | * Allocate the necessary tasks to complete the received CDB+data |
149 | */ | 147 | */ |
150 | ret = transport_generic_allocate_tasks(se_cmd, sc->cmnd); | 148 | ret = transport_generic_allocate_tasks(se_cmd, sc->cmnd); |
151 | if (ret == -ENOMEM) { | 149 | if (ret != 0) |
152 | /* Out of Resources */ | 150 | return ret; |
153 | return PYX_TRANSPORT_LU_COMM_FAILURE; | ||
154 | } else if (ret == -EINVAL) { | ||
155 | /* | ||
156 | * Handle case for SAM_STAT_RESERVATION_CONFLICT | ||
157 | */ | ||
158 | if (se_cmd->se_cmd_flags & SCF_SCSI_RESERVATION_CONFLICT) | ||
159 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | ||
160 | /* | ||
161 | * Otherwise, return SAM_STAT_CHECK_CONDITION and return | ||
162 | * sense data. | ||
163 | */ | ||
164 | return PYX_TRANSPORT_USE_SENSE_REASON; | ||
165 | } | ||
166 | |||
167 | /* | 151 | /* |
168 | * For BIDI commands, pass in the extra READ buffer | 152 | * For BIDI commands, pass in the extra READ buffer |
169 | * to transport_generic_map_mem_to_cmd() below.. | 153 | * to transport_generic_map_mem_to_cmd() below.. |
170 | */ | 154 | */ |
171 | if (se_cmd->t_tasks_bidi) { | 155 | if (se_cmd->se_cmd_flags & SCF_BIDI) { |
172 | struct scsi_data_buffer *sdb = scsi_in(sc); | 156 | struct scsi_data_buffer *sdb = scsi_in(sc); |
173 | 157 | ||
174 | sgl_bidi = sdb->table.sgl; | 158 | sgl_bidi = sdb->table.sgl; |
@@ -194,12 +178,8 @@ static int tcm_loop_new_cmd_map(struct se_cmd *se_cmd) | |||
194 | } | 178 | } |
195 | 179 | ||
196 | /* Tell the core about our preallocated memory */ | 180 | /* Tell the core about our preallocated memory */ |
197 | ret = transport_generic_map_mem_to_cmd(se_cmd, scsi_sglist(sc), | 181 | return transport_generic_map_mem_to_cmd(se_cmd, scsi_sglist(sc), |
198 | scsi_sg_count(sc), sgl_bidi, sgl_bidi_count); | 182 | scsi_sg_count(sc), sgl_bidi, sgl_bidi_count); |
199 | if (ret < 0) | ||
200 | return PYX_TRANSPORT_LU_COMM_FAILURE; | ||
201 | |||
202 | return 0; | ||
203 | } | 183 | } |
204 | 184 | ||
205 | /* | 185 | /* |
@@ -1360,17 +1340,16 @@ void tcm_loop_drop_scsi_hba( | |||
1360 | { | 1340 | { |
1361 | struct tcm_loop_hba *tl_hba = container_of(wwn, | 1341 | struct tcm_loop_hba *tl_hba = container_of(wwn, |
1362 | struct tcm_loop_hba, tl_hba_wwn); | 1342 | struct tcm_loop_hba, tl_hba_wwn); |
1363 | int host_no = tl_hba->sh->host_no; | 1343 | |
1344 | pr_debug("TCM_Loop_ConfigFS: Deallocating emulated Target" | ||
1345 | " SAS Address: %s at Linux/SCSI Host ID: %d\n", | ||
1346 | tl_hba->tl_wwn_address, tl_hba->sh->host_no); | ||
1364 | /* | 1347 | /* |
1365 | * Call device_unregister() on the original tl_hba->dev. | 1348 | * Call device_unregister() on the original tl_hba->dev. |
1366 | * tcm_loop_fabric_scsi.c:tcm_loop_release_adapter() will | 1349 | * tcm_loop_fabric_scsi.c:tcm_loop_release_adapter() will |
1367 | * release *tl_hba; | 1350 | * release *tl_hba; |
1368 | */ | 1351 | */ |
1369 | device_unregister(&tl_hba->dev); | 1352 | device_unregister(&tl_hba->dev); |
1370 | |||
1371 | pr_debug("TCM_Loop_ConfigFS: Deallocated emulated Target" | ||
1372 | " SAS Address: %s at Linux/SCSI Host ID: %d\n", | ||
1373 | config_item_name(&wwn->wwn_group.cg_item), host_no); | ||
1374 | } | 1353 | } |
1375 | 1354 | ||
1376 | /* Start items for tcm_loop_cit */ | 1355 | /* Start items for tcm_loop_cit */ |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 88f2ad43ec8b..1dcbef499d6a 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
@@ -191,9 +191,10 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
191 | int alua_access_state, primary = 0, rc; | 191 | int alua_access_state, primary = 0, rc; |
192 | u16 tg_pt_id, rtpi; | 192 | u16 tg_pt_id, rtpi; |
193 | 193 | ||
194 | if (!l_port) | 194 | if (!l_port) { |
195 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 195 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
196 | 196 | return -EINVAL; | |
197 | } | ||
197 | buf = transport_kmap_first_data_page(cmd); | 198 | buf = transport_kmap_first_data_page(cmd); |
198 | 199 | ||
199 | /* | 200 | /* |
@@ -203,7 +204,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
203 | l_tg_pt_gp_mem = l_port->sep_alua_tg_pt_gp_mem; | 204 | l_tg_pt_gp_mem = l_port->sep_alua_tg_pt_gp_mem; |
204 | if (!l_tg_pt_gp_mem) { | 205 | if (!l_tg_pt_gp_mem) { |
205 | pr_err("Unable to access l_port->sep_alua_tg_pt_gp_mem\n"); | 206 | pr_err("Unable to access l_port->sep_alua_tg_pt_gp_mem\n"); |
206 | rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 207 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
208 | rc = -EINVAL; | ||
207 | goto out; | 209 | goto out; |
208 | } | 210 | } |
209 | spin_lock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); | 211 | spin_lock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); |
@@ -211,7 +213,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
211 | if (!l_tg_pt_gp) { | 213 | if (!l_tg_pt_gp) { |
212 | spin_unlock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); | 214 | spin_unlock(&l_tg_pt_gp_mem->tg_pt_gp_mem_lock); |
213 | pr_err("Unable to access *l_tg_pt_gp_mem->tg_pt_gp\n"); | 215 | pr_err("Unable to access *l_tg_pt_gp_mem->tg_pt_gp\n"); |
214 | rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 216 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
217 | rc = -EINVAL; | ||
215 | goto out; | 218 | goto out; |
216 | } | 219 | } |
217 | rc = (l_tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_EXPLICT_ALUA); | 220 | rc = (l_tg_pt_gp->tg_pt_gp_alua_access_type & TPGS_EXPLICT_ALUA); |
@@ -220,7 +223,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
220 | if (!rc) { | 223 | if (!rc) { |
221 | pr_debug("Unable to process SET_TARGET_PORT_GROUPS" | 224 | pr_debug("Unable to process SET_TARGET_PORT_GROUPS" |
222 | " while TPGS_EXPLICT_ALUA is disabled\n"); | 225 | " while TPGS_EXPLICT_ALUA is disabled\n"); |
223 | rc = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 226 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
227 | rc = -EINVAL; | ||
224 | goto out; | 228 | goto out; |
225 | } | 229 | } |
226 | 230 | ||
@@ -245,7 +249,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
245 | * REQUEST, and the additional sense code set to INVALID | 249 | * REQUEST, and the additional sense code set to INVALID |
246 | * FIELD IN PARAMETER LIST. | 250 | * FIELD IN PARAMETER LIST. |
247 | */ | 251 | */ |
248 | rc = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 252 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
253 | rc = -EINVAL; | ||
249 | goto out; | 254 | goto out; |
250 | } | 255 | } |
251 | rc = -1; | 256 | rc = -1; |
@@ -298,7 +303,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
298 | * throw an exception with ASCQ: INVALID_PARAMETER_LIST | 303 | * throw an exception with ASCQ: INVALID_PARAMETER_LIST |
299 | */ | 304 | */ |
300 | if (rc != 0) { | 305 | if (rc != 0) { |
301 | rc = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 306 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
307 | rc = -EINVAL; | ||
302 | goto out; | 308 | goto out; |
303 | } | 309 | } |
304 | } else { | 310 | } else { |
@@ -335,7 +341,8 @@ int target_emulate_set_target_port_groups(struct se_task *task) | |||
335 | * INVALID_PARAMETER_LIST | 341 | * INVALID_PARAMETER_LIST |
336 | */ | 342 | */ |
337 | if (rc != 0) { | 343 | if (rc != 0) { |
338 | rc = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 344 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
345 | rc = -EINVAL; | ||
339 | goto out; | 346 | goto out; |
340 | } | 347 | } |
341 | } | 348 | } |
@@ -1184,7 +1191,6 @@ void core_alua_free_lu_gp(struct t10_alua_lu_gp *lu_gp) | |||
1184 | * struct t10_alua_lu_gp. | 1191 | * struct t10_alua_lu_gp. |
1185 | */ | 1192 | */ |
1186 | spin_lock(&lu_gps_lock); | 1193 | spin_lock(&lu_gps_lock); |
1187 | atomic_set(&lu_gp->lu_gp_shutdown, 1); | ||
1188 | list_del(&lu_gp->lu_gp_node); | 1194 | list_del(&lu_gp->lu_gp_node); |
1189 | alua_lu_gps_count--; | 1195 | alua_lu_gps_count--; |
1190 | spin_unlock(&lu_gps_lock); | 1196 | spin_unlock(&lu_gps_lock); |
@@ -1438,7 +1444,6 @@ struct t10_alua_tg_pt_gp_member *core_alua_allocate_tg_pt_gp_mem( | |||
1438 | 1444 | ||
1439 | tg_pt_gp_mem->tg_pt = port; | 1445 | tg_pt_gp_mem->tg_pt = port; |
1440 | port->sep_alua_tg_pt_gp_mem = tg_pt_gp_mem; | 1446 | port->sep_alua_tg_pt_gp_mem = tg_pt_gp_mem; |
1441 | atomic_set(&port->sep_tg_pt_gp_active, 1); | ||
1442 | 1447 | ||
1443 | return tg_pt_gp_mem; | 1448 | return tg_pt_gp_mem; |
1444 | } | 1449 | } |
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 683ba02b8247..831468b3163d 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c | |||
@@ -478,7 +478,7 @@ target_emulate_evpd_86(struct se_cmd *cmd, unsigned char *buf) | |||
478 | if (cmd->data_length < 60) | 478 | if (cmd->data_length < 60) |
479 | return 0; | 479 | return 0; |
480 | 480 | ||
481 | buf[2] = 0x3c; | 481 | buf[3] = 0x3c; |
482 | /* Set HEADSUP, ORDSUP, SIMPSUP */ | 482 | /* Set HEADSUP, ORDSUP, SIMPSUP */ |
483 | buf[5] = 0x07; | 483 | buf[5] = 0x07; |
484 | 484 | ||
@@ -703,6 +703,7 @@ int target_emulate_inquiry(struct se_task *task) | |||
703 | if (cmd->data_length < 4) { | 703 | if (cmd->data_length < 4) { |
704 | pr_err("SCSI Inquiry payload length: %u" | 704 | pr_err("SCSI Inquiry payload length: %u" |
705 | " too small for EVPD=1\n", cmd->data_length); | 705 | " too small for EVPD=1\n", cmd->data_length); |
706 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
706 | return -EINVAL; | 707 | return -EINVAL; |
707 | } | 708 | } |
708 | 709 | ||
@@ -719,6 +720,7 @@ int target_emulate_inquiry(struct se_task *task) | |||
719 | } | 720 | } |
720 | 721 | ||
721 | pr_err("Unknown VPD Code: 0x%02x\n", cdb[2]); | 722 | pr_err("Unknown VPD Code: 0x%02x\n", cdb[2]); |
723 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; | ||
722 | ret = -EINVAL; | 724 | ret = -EINVAL; |
723 | 725 | ||
724 | out_unmap: | 726 | out_unmap: |
@@ -969,7 +971,8 @@ int target_emulate_modesense(struct se_task *task) | |||
969 | default: | 971 | default: |
970 | pr_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n", | 972 | pr_err("MODE SENSE: unimplemented page/subpage: 0x%02x/0x%02x\n", |
971 | cdb[2] & 0x3f, cdb[3]); | 973 | cdb[2] & 0x3f, cdb[3]); |
972 | return PYX_TRANSPORT_UNKNOWN_MODE_PAGE; | 974 | cmd->scsi_sense_reason = TCM_UNKNOWN_MODE_PAGE; |
975 | return -EINVAL; | ||
973 | } | 976 | } |
974 | offset += length; | 977 | offset += length; |
975 | 978 | ||
@@ -1027,7 +1030,8 @@ int target_emulate_request_sense(struct se_task *task) | |||
1027 | if (cdb[1] & 0x01) { | 1030 | if (cdb[1] & 0x01) { |
1028 | pr_err("REQUEST_SENSE description emulation not" | 1031 | pr_err("REQUEST_SENSE description emulation not" |
1029 | " supported\n"); | 1032 | " supported\n"); |
1030 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 1033 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
1034 | return -ENOSYS; | ||
1031 | } | 1035 | } |
1032 | 1036 | ||
1033 | buf = transport_kmap_first_data_page(cmd); | 1037 | buf = transport_kmap_first_data_page(cmd); |
@@ -1100,7 +1104,8 @@ int target_emulate_unmap(struct se_task *task) | |||
1100 | if (!dev->transport->do_discard) { | 1104 | if (!dev->transport->do_discard) { |
1101 | pr_err("UNMAP emulation not supported for: %s\n", | 1105 | pr_err("UNMAP emulation not supported for: %s\n", |
1102 | dev->transport->name); | 1106 | dev->transport->name); |
1103 | return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 1107 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
1108 | return -ENOSYS; | ||
1104 | } | 1109 | } |
1105 | 1110 | ||
1106 | /* First UNMAP block descriptor starts at 8 byte offset */ | 1111 | /* First UNMAP block descriptor starts at 8 byte offset */ |
@@ -1157,7 +1162,8 @@ int target_emulate_write_same(struct se_task *task) | |||
1157 | if (!dev->transport->do_discard) { | 1162 | if (!dev->transport->do_discard) { |
1158 | pr_err("WRITE_SAME emulation not supported" | 1163 | pr_err("WRITE_SAME emulation not supported" |
1159 | " for: %s\n", dev->transport->name); | 1164 | " for: %s\n", dev->transport->name); |
1160 | return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 1165 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
1166 | return -ENOSYS; | ||
1161 | } | 1167 | } |
1162 | 1168 | ||
1163 | if (cmd->t_task_cdb[0] == WRITE_SAME) | 1169 | if (cmd->t_task_cdb[0] == WRITE_SAME) |
@@ -1193,11 +1199,13 @@ int target_emulate_write_same(struct se_task *task) | |||
1193 | int target_emulate_synchronize_cache(struct se_task *task) | 1199 | int target_emulate_synchronize_cache(struct se_task *task) |
1194 | { | 1200 | { |
1195 | struct se_device *dev = task->task_se_cmd->se_dev; | 1201 | struct se_device *dev = task->task_se_cmd->se_dev; |
1202 | struct se_cmd *cmd = task->task_se_cmd; | ||
1196 | 1203 | ||
1197 | if (!dev->transport->do_sync_cache) { | 1204 | if (!dev->transport->do_sync_cache) { |
1198 | pr_err("SYNCHRONIZE_CACHE emulation not supported" | 1205 | pr_err("SYNCHRONIZE_CACHE emulation not supported" |
1199 | " for: %s\n", dev->transport->name); | 1206 | " for: %s\n", dev->transport->name); |
1200 | return PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 1207 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
1208 | return -ENOSYS; | ||
1201 | } | 1209 | } |
1202 | 1210 | ||
1203 | dev->transport->do_sync_cache(task); | 1211 | dev->transport->do_sync_cache(task); |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index e0c1e8a8dd4e..93d4f6a1b798 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -67,9 +67,6 @@ static struct config_group target_core_hbagroup; | |||
67 | static struct config_group alua_group; | 67 | static struct config_group alua_group; |
68 | static struct config_group alua_lu_gps_group; | 68 | static struct config_group alua_lu_gps_group; |
69 | 69 | ||
70 | static DEFINE_SPINLOCK(se_device_lock); | ||
71 | static LIST_HEAD(se_dev_list); | ||
72 | |||
73 | static inline struct se_hba * | 70 | static inline struct se_hba * |
74 | item_to_hba(struct config_item *item) | 71 | item_to_hba(struct config_item *item) |
75 | { | 72 | { |
@@ -2741,7 +2738,6 @@ static struct config_group *target_core_make_subdev( | |||
2741 | " struct se_subsystem_dev\n"); | 2738 | " struct se_subsystem_dev\n"); |
2742 | goto unlock; | 2739 | goto unlock; |
2743 | } | 2740 | } |
2744 | INIT_LIST_HEAD(&se_dev->se_dev_node); | ||
2745 | INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list); | 2741 | INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list); |
2746 | spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock); | 2742 | spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock); |
2747 | INIT_LIST_HEAD(&se_dev->t10_pr.registration_list); | 2743 | INIT_LIST_HEAD(&se_dev->t10_pr.registration_list); |
@@ -2777,9 +2773,6 @@ static struct config_group *target_core_make_subdev( | |||
2777 | " from allocate_virtdevice()\n"); | 2773 | " from allocate_virtdevice()\n"); |
2778 | goto out; | 2774 | goto out; |
2779 | } | 2775 | } |
2780 | spin_lock(&se_device_lock); | ||
2781 | list_add_tail(&se_dev->se_dev_node, &se_dev_list); | ||
2782 | spin_unlock(&se_device_lock); | ||
2783 | 2776 | ||
2784 | config_group_init_type_name(&se_dev->se_dev_group, name, | 2777 | config_group_init_type_name(&se_dev->se_dev_group, name, |
2785 | &target_core_dev_cit); | 2778 | &target_core_dev_cit); |
@@ -2874,10 +2867,6 @@ static void target_core_drop_subdev( | |||
2874 | mutex_lock(&hba->hba_access_mutex); | 2867 | mutex_lock(&hba->hba_access_mutex); |
2875 | t = hba->transport; | 2868 | t = hba->transport; |
2876 | 2869 | ||
2877 | spin_lock(&se_device_lock); | ||
2878 | list_del(&se_dev->se_dev_node); | ||
2879 | spin_unlock(&se_device_lock); | ||
2880 | |||
2881 | dev_stat_grp = &se_dev->dev_stat_grps.stat_group; | 2870 | dev_stat_grp = &se_dev->dev_stat_grps.stat_group; |
2882 | for (i = 0; dev_stat_grp->default_groups[i]; i++) { | 2871 | for (i = 0; dev_stat_grp->default_groups[i]; i++) { |
2883 | df_item = &dev_stat_grp->default_groups[i]->cg_item; | 2872 | df_item = &dev_stat_grp->default_groups[i]->cg_item; |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index ba5edec2c5f8..9b8639425472 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -104,7 +104,6 @@ int transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) | |||
104 | se_cmd->se_lun = deve->se_lun; | 104 | se_cmd->se_lun = deve->se_lun; |
105 | se_cmd->pr_res_key = deve->pr_res_key; | 105 | se_cmd->pr_res_key = deve->pr_res_key; |
106 | se_cmd->orig_fe_lun = unpacked_lun; | 106 | se_cmd->orig_fe_lun = unpacked_lun; |
107 | se_cmd->se_orig_obj_ptr = se_cmd->se_lun->lun_se_dev; | ||
108 | se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; | 107 | se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; |
109 | } | 108 | } |
110 | spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); | 109 | spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); |
@@ -137,7 +136,6 @@ int transport_lookup_cmd_lun(struct se_cmd *se_cmd, u32 unpacked_lun) | |||
137 | se_lun = &se_sess->se_tpg->tpg_virt_lun0; | 136 | se_lun = &se_sess->se_tpg->tpg_virt_lun0; |
138 | se_cmd->se_lun = &se_sess->se_tpg->tpg_virt_lun0; | 137 | se_cmd->se_lun = &se_sess->se_tpg->tpg_virt_lun0; |
139 | se_cmd->orig_fe_lun = 0; | 138 | se_cmd->orig_fe_lun = 0; |
140 | se_cmd->se_orig_obj_ptr = se_cmd->se_lun->lun_se_dev; | ||
141 | se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; | 139 | se_cmd->se_cmd_flags |= SCF_SE_LUN_CMD; |
142 | } | 140 | } |
143 | /* | 141 | /* |
@@ -200,7 +198,6 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u32 unpacked_lun) | |||
200 | se_lun = deve->se_lun; | 198 | se_lun = deve->se_lun; |
201 | se_cmd->pr_res_key = deve->pr_res_key; | 199 | se_cmd->pr_res_key = deve->pr_res_key; |
202 | se_cmd->orig_fe_lun = unpacked_lun; | 200 | se_cmd->orig_fe_lun = unpacked_lun; |
203 | se_cmd->se_orig_obj_ptr = se_cmd->se_dev; | ||
204 | } | 201 | } |
205 | spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); | 202 | spin_unlock_irqrestore(&se_sess->se_node_acl->device_list_lock, flags); |
206 | 203 | ||
@@ -708,7 +705,7 @@ done: | |||
708 | 705 | ||
709 | se_task->task_scsi_status = GOOD; | 706 | se_task->task_scsi_status = GOOD; |
710 | transport_complete_task(se_task, 1); | 707 | transport_complete_task(se_task, 1); |
711 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 708 | return 0; |
712 | } | 709 | } |
713 | 710 | ||
714 | /* se_release_device_for_hba(): | 711 | /* se_release_device_for_hba(): |
@@ -957,8 +954,12 @@ int se_dev_set_emulate_dpo(struct se_device *dev, int flag) | |||
957 | return -EINVAL; | 954 | return -EINVAL; |
958 | } | 955 | } |
959 | 956 | ||
960 | pr_err("dpo_emulated not supported\n"); | 957 | if (flag) { |
961 | return -EINVAL; | 958 | pr_err("dpo_emulated not supported\n"); |
959 | return -EINVAL; | ||
960 | } | ||
961 | |||
962 | return 0; | ||
962 | } | 963 | } |
963 | 964 | ||
964 | int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) | 965 | int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) |
@@ -968,7 +969,7 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int flag) | |||
968 | return -EINVAL; | 969 | return -EINVAL; |
969 | } | 970 | } |
970 | 971 | ||
971 | if (dev->transport->fua_write_emulated == 0) { | 972 | if (flag && dev->transport->fua_write_emulated == 0) { |
972 | pr_err("fua_write_emulated not supported\n"); | 973 | pr_err("fua_write_emulated not supported\n"); |
973 | return -EINVAL; | 974 | return -EINVAL; |
974 | } | 975 | } |
@@ -985,8 +986,12 @@ int se_dev_set_emulate_fua_read(struct se_device *dev, int flag) | |||
985 | return -EINVAL; | 986 | return -EINVAL; |
986 | } | 987 | } |
987 | 988 | ||
988 | pr_err("ua read emulated not supported\n"); | 989 | if (flag) { |
989 | return -EINVAL; | 990 | pr_err("ua read emulated not supported\n"); |
991 | return -EINVAL; | ||
992 | } | ||
993 | |||
994 | return 0; | ||
990 | } | 995 | } |
991 | 996 | ||
992 | int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) | 997 | int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) |
@@ -995,7 +1000,7 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, int flag) | |||
995 | pr_err("Illegal value %d\n", flag); | 1000 | pr_err("Illegal value %d\n", flag); |
996 | return -EINVAL; | 1001 | return -EINVAL; |
997 | } | 1002 | } |
998 | if (dev->transport->write_cache_emulated == 0) { | 1003 | if (flag && dev->transport->write_cache_emulated == 0) { |
999 | pr_err("write_cache_emulated not supported\n"); | 1004 | pr_err("write_cache_emulated not supported\n"); |
1000 | return -EINVAL; | 1005 | return -EINVAL; |
1001 | } | 1006 | } |
@@ -1056,7 +1061,7 @@ int se_dev_set_emulate_tpu(struct se_device *dev, int flag) | |||
1056 | * We expect this value to be non-zero when generic Block Layer | 1061 | * We expect this value to be non-zero when generic Block Layer |
1057 | * Discard supported is detected iblock_create_virtdevice(). | 1062 | * Discard supported is detected iblock_create_virtdevice(). |
1058 | */ | 1063 | */ |
1059 | if (!dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { | 1064 | if (flag && !dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { |
1060 | pr_err("Generic Block Discard not supported\n"); | 1065 | pr_err("Generic Block Discard not supported\n"); |
1061 | return -ENOSYS; | 1066 | return -ENOSYS; |
1062 | } | 1067 | } |
@@ -1077,7 +1082,7 @@ int se_dev_set_emulate_tpws(struct se_device *dev, int flag) | |||
1077 | * We expect this value to be non-zero when generic Block Layer | 1082 | * We expect this value to be non-zero when generic Block Layer |
1078 | * Discard supported is detected iblock_create_virtdevice(). | 1083 | * Discard supported is detected iblock_create_virtdevice(). |
1079 | */ | 1084 | */ |
1080 | if (!dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { | 1085 | if (flag && !dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { |
1081 | pr_err("Generic Block Discard not supported\n"); | 1086 | pr_err("Generic Block Discard not supported\n"); |
1082 | return -ENOSYS; | 1087 | return -ENOSYS; |
1083 | } | 1088 | } |
@@ -1587,7 +1592,6 @@ int core_dev_setup_virtual_lun0(void) | |||
1587 | ret = -ENOMEM; | 1592 | ret = -ENOMEM; |
1588 | goto out; | 1593 | goto out; |
1589 | } | 1594 | } |
1590 | INIT_LIST_HEAD(&se_dev->se_dev_node); | ||
1591 | INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list); | 1595 | INIT_LIST_HEAD(&se_dev->t10_wwn.t10_vpd_list); |
1592 | spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock); | 1596 | spin_lock_init(&se_dev->t10_wwn.t10_vpd_lock); |
1593 | INIT_LIST_HEAD(&se_dev->t10_pr.registration_list); | 1597 | INIT_LIST_HEAD(&se_dev->t10_pr.registration_list); |
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 67cd6fe05bfa..b4864fba4ef0 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
@@ -289,9 +289,9 @@ static int fd_do_readv(struct se_task *task) | |||
289 | return -ENOMEM; | 289 | return -ENOMEM; |
290 | } | 290 | } |
291 | 291 | ||
292 | for (i = 0; i < task->task_sg_nents; i++) { | 292 | for_each_sg(task->task_sg, sg, task->task_sg_nents, i) { |
293 | iov[i].iov_len = sg[i].length; | 293 | iov[i].iov_len = sg->length; |
294 | iov[i].iov_base = sg_virt(&sg[i]); | 294 | iov[i].iov_base = sg_virt(sg); |
295 | } | 295 | } |
296 | 296 | ||
297 | old_fs = get_fs(); | 297 | old_fs = get_fs(); |
@@ -342,9 +342,9 @@ static int fd_do_writev(struct se_task *task) | |||
342 | return -ENOMEM; | 342 | return -ENOMEM; |
343 | } | 343 | } |
344 | 344 | ||
345 | for (i = 0; i < task->task_sg_nents; i++) { | 345 | for_each_sg(task->task_sg, sg, task->task_sg_nents, i) { |
346 | iov[i].iov_len = sg[i].length; | 346 | iov[i].iov_len = sg->length; |
347 | iov[i].iov_base = sg_virt(&sg[i]); | 347 | iov[i].iov_base = sg_virt(sg); |
348 | } | 348 | } |
349 | 349 | ||
350 | old_fs = get_fs(); | 350 | old_fs = get_fs(); |
@@ -438,7 +438,7 @@ static int fd_do_task(struct se_task *task) | |||
438 | if (ret > 0 && | 438 | if (ret > 0 && |
439 | dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0 && | 439 | dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0 && |
440 | dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && | 440 | dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && |
441 | cmd->t_tasks_fua) { | 441 | (cmd->se_cmd_flags & SCF_FUA)) { |
442 | /* | 442 | /* |
443 | * We might need to be a bit smarter here | 443 | * We might need to be a bit smarter here |
444 | * and return some sense data to let the initiator | 444 | * and return some sense data to let the initiator |
@@ -449,13 +449,15 @@ static int fd_do_task(struct se_task *task) | |||
449 | 449 | ||
450 | } | 450 | } |
451 | 451 | ||
452 | if (ret < 0) | 452 | if (ret < 0) { |
453 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
453 | return ret; | 454 | return ret; |
455 | } | ||
454 | if (ret) { | 456 | if (ret) { |
455 | task->task_scsi_status = GOOD; | 457 | task->task_scsi_status = GOOD; |
456 | transport_complete_task(task, 1); | 458 | transport_complete_task(task, 1); |
457 | } | 459 | } |
458 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 460 | return 0; |
459 | } | 461 | } |
460 | 462 | ||
461 | /* fd_free_task(): (Part of se_subsystem_api_t template) | 463 | /* fd_free_task(): (Part of se_subsystem_api_t template) |
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 7698efe29262..4aa992204438 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -531,7 +531,7 @@ static int iblock_do_task(struct se_task *task) | |||
531 | */ | 531 | */ |
532 | if (dev->se_sub_dev->se_dev_attrib.emulate_write_cache == 0 || | 532 | if (dev->se_sub_dev->se_dev_attrib.emulate_write_cache == 0 || |
533 | (dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && | 533 | (dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && |
534 | task->task_se_cmd->t_tasks_fua)) | 534 | (cmd->se_cmd_flags & SCF_FUA))) |
535 | rw = WRITE_FUA; | 535 | rw = WRITE_FUA; |
536 | else | 536 | else |
537 | rw = WRITE; | 537 | rw = WRITE; |
@@ -554,12 +554,15 @@ static int iblock_do_task(struct se_task *task) | |||
554 | else { | 554 | else { |
555 | pr_err("Unsupported SCSI -> BLOCK LBA conversion:" | 555 | pr_err("Unsupported SCSI -> BLOCK LBA conversion:" |
556 | " %u\n", dev->se_sub_dev->se_dev_attrib.block_size); | 556 | " %u\n", dev->se_sub_dev->se_dev_attrib.block_size); |
557 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 557 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
558 | return -ENOSYS; | ||
558 | } | 559 | } |
559 | 560 | ||
560 | bio = iblock_get_bio(task, block_lba, sg_num); | 561 | bio = iblock_get_bio(task, block_lba, sg_num); |
561 | if (!bio) | 562 | if (!bio) { |
562 | return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; | 563 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
564 | return -ENOMEM; | ||
565 | } | ||
563 | 566 | ||
564 | bio_list_init(&list); | 567 | bio_list_init(&list); |
565 | bio_list_add(&list, bio); | 568 | bio_list_add(&list, bio); |
@@ -588,12 +591,13 @@ static int iblock_do_task(struct se_task *task) | |||
588 | submit_bio(rw, bio); | 591 | submit_bio(rw, bio); |
589 | blk_finish_plug(&plug); | 592 | blk_finish_plug(&plug); |
590 | 593 | ||
591 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 594 | return 0; |
592 | 595 | ||
593 | fail: | 596 | fail: |
594 | while ((bio = bio_list_pop(&list))) | 597 | while ((bio = bio_list_pop(&list))) |
595 | bio_put(bio); | 598 | bio_put(bio); |
596 | return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; | 599 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
600 | return -ENOMEM; | ||
597 | } | 601 | } |
598 | 602 | ||
599 | static u32 iblock_get_device_rev(struct se_device *dev) | 603 | static u32 iblock_get_device_rev(struct se_device *dev) |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 5a4ebfc3a54f..95dee7074aeb 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -191,7 +191,7 @@ static int target_check_scsi2_reservation_conflict(struct se_cmd *cmd, int *ret) | |||
191 | pr_err("Received legacy SPC-2 RESERVE/RELEASE" | 191 | pr_err("Received legacy SPC-2 RESERVE/RELEASE" |
192 | " while active SPC-3 registrations exist," | 192 | " while active SPC-3 registrations exist," |
193 | " returning RESERVATION_CONFLICT\n"); | 193 | " returning RESERVATION_CONFLICT\n"); |
194 | *ret = PYX_TRANSPORT_RESERVATION_CONFLICT; | 194 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
195 | return true; | 195 | return true; |
196 | } | 196 | } |
197 | 197 | ||
@@ -252,7 +252,8 @@ int target_scsi2_reservation_reserve(struct se_task *task) | |||
252 | (cmd->t_task_cdb[1] & 0x02)) { | 252 | (cmd->t_task_cdb[1] & 0x02)) { |
253 | pr_err("LongIO and Obselete Bits set, returning" | 253 | pr_err("LongIO and Obselete Bits set, returning" |
254 | " ILLEGAL_REQUEST\n"); | 254 | " ILLEGAL_REQUEST\n"); |
255 | ret = PYX_TRANSPORT_ILLEGAL_REQUEST; | 255 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
256 | ret = -EINVAL; | ||
256 | goto out; | 257 | goto out; |
257 | } | 258 | } |
258 | /* | 259 | /* |
@@ -277,7 +278,8 @@ int target_scsi2_reservation_reserve(struct se_task *task) | |||
277 | " from %s \n", cmd->se_lun->unpacked_lun, | 278 | " from %s \n", cmd->se_lun->unpacked_lun, |
278 | cmd->se_deve->mapped_lun, | 279 | cmd->se_deve->mapped_lun, |
279 | sess->se_node_acl->initiatorname); | 280 | sess->se_node_acl->initiatorname); |
280 | ret = PYX_TRANSPORT_RESERVATION_CONFLICT; | 281 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
282 | ret = -EINVAL; | ||
281 | goto out_unlock; | 283 | goto out_unlock; |
282 | } | 284 | } |
283 | 285 | ||
@@ -1510,7 +1512,8 @@ static int core_scsi3_decode_spec_i_port( | |||
1510 | tidh_new = kzalloc(sizeof(struct pr_transport_id_holder), GFP_KERNEL); | 1512 | tidh_new = kzalloc(sizeof(struct pr_transport_id_holder), GFP_KERNEL); |
1511 | if (!tidh_new) { | 1513 | if (!tidh_new) { |
1512 | pr_err("Unable to allocate tidh_new\n"); | 1514 | pr_err("Unable to allocate tidh_new\n"); |
1513 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 1515 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
1516 | return -EINVAL; | ||
1514 | } | 1517 | } |
1515 | INIT_LIST_HEAD(&tidh_new->dest_list); | 1518 | INIT_LIST_HEAD(&tidh_new->dest_list); |
1516 | tidh_new->dest_tpg = tpg; | 1519 | tidh_new->dest_tpg = tpg; |
@@ -1522,7 +1525,8 @@ static int core_scsi3_decode_spec_i_port( | |||
1522 | sa_res_key, all_tg_pt, aptpl); | 1525 | sa_res_key, all_tg_pt, aptpl); |
1523 | if (!local_pr_reg) { | 1526 | if (!local_pr_reg) { |
1524 | kfree(tidh_new); | 1527 | kfree(tidh_new); |
1525 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 1528 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
1529 | return -ENOMEM; | ||
1526 | } | 1530 | } |
1527 | tidh_new->dest_pr_reg = local_pr_reg; | 1531 | tidh_new->dest_pr_reg = local_pr_reg; |
1528 | /* | 1532 | /* |
@@ -1548,7 +1552,8 @@ static int core_scsi3_decode_spec_i_port( | |||
1548 | pr_err("SPC-3 PR: Illegal tpdl: %u + 28 byte header" | 1552 | pr_err("SPC-3 PR: Illegal tpdl: %u + 28 byte header" |
1549 | " does not equal CDB data_length: %u\n", tpdl, | 1553 | " does not equal CDB data_length: %u\n", tpdl, |
1550 | cmd->data_length); | 1554 | cmd->data_length); |
1551 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 1555 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
1556 | ret = -EINVAL; | ||
1552 | goto out; | 1557 | goto out; |
1553 | } | 1558 | } |
1554 | /* | 1559 | /* |
@@ -1598,7 +1603,9 @@ static int core_scsi3_decode_spec_i_port( | |||
1598 | " for tmp_tpg\n"); | 1603 | " for tmp_tpg\n"); |
1599 | atomic_dec(&tmp_tpg->tpg_pr_ref_count); | 1604 | atomic_dec(&tmp_tpg->tpg_pr_ref_count); |
1600 | smp_mb__after_atomic_dec(); | 1605 | smp_mb__after_atomic_dec(); |
1601 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 1606 | cmd->scsi_sense_reason = |
1607 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1608 | ret = -EINVAL; | ||
1602 | goto out; | 1609 | goto out; |
1603 | } | 1610 | } |
1604 | /* | 1611 | /* |
@@ -1628,7 +1635,9 @@ static int core_scsi3_decode_spec_i_port( | |||
1628 | atomic_dec(&dest_node_acl->acl_pr_ref_count); | 1635 | atomic_dec(&dest_node_acl->acl_pr_ref_count); |
1629 | smp_mb__after_atomic_dec(); | 1636 | smp_mb__after_atomic_dec(); |
1630 | core_scsi3_tpg_undepend_item(tmp_tpg); | 1637 | core_scsi3_tpg_undepend_item(tmp_tpg); |
1631 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 1638 | cmd->scsi_sense_reason = |
1639 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1640 | ret = -EINVAL; | ||
1632 | goto out; | 1641 | goto out; |
1633 | } | 1642 | } |
1634 | 1643 | ||
@@ -1646,7 +1655,8 @@ static int core_scsi3_decode_spec_i_port( | |||
1646 | if (!dest_tpg) { | 1655 | if (!dest_tpg) { |
1647 | pr_err("SPC-3 PR SPEC_I_PT: Unable to locate" | 1656 | pr_err("SPC-3 PR SPEC_I_PT: Unable to locate" |
1648 | " dest_tpg\n"); | 1657 | " dest_tpg\n"); |
1649 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 1658 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
1659 | ret = -EINVAL; | ||
1650 | goto out; | 1660 | goto out; |
1651 | } | 1661 | } |
1652 | #if 0 | 1662 | #if 0 |
@@ -1660,7 +1670,8 @@ static int core_scsi3_decode_spec_i_port( | |||
1660 | " %u for Transport ID: %s\n", tid_len, ptr); | 1670 | " %u for Transport ID: %s\n", tid_len, ptr); |
1661 | core_scsi3_nodeacl_undepend_item(dest_node_acl); | 1671 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
1662 | core_scsi3_tpg_undepend_item(dest_tpg); | 1672 | core_scsi3_tpg_undepend_item(dest_tpg); |
1663 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 1673 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
1674 | ret = -EINVAL; | ||
1664 | goto out; | 1675 | goto out; |
1665 | } | 1676 | } |
1666 | /* | 1677 | /* |
@@ -1678,7 +1689,8 @@ static int core_scsi3_decode_spec_i_port( | |||
1678 | 1689 | ||
1679 | core_scsi3_nodeacl_undepend_item(dest_node_acl); | 1690 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
1680 | core_scsi3_tpg_undepend_item(dest_tpg); | 1691 | core_scsi3_tpg_undepend_item(dest_tpg); |
1681 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 1692 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
1693 | ret = -EINVAL; | ||
1682 | goto out; | 1694 | goto out; |
1683 | } | 1695 | } |
1684 | 1696 | ||
@@ -1690,7 +1702,9 @@ static int core_scsi3_decode_spec_i_port( | |||
1690 | smp_mb__after_atomic_dec(); | 1702 | smp_mb__after_atomic_dec(); |
1691 | core_scsi3_nodeacl_undepend_item(dest_node_acl); | 1703 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
1692 | core_scsi3_tpg_undepend_item(dest_tpg); | 1704 | core_scsi3_tpg_undepend_item(dest_tpg); |
1693 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 1705 | cmd->scsi_sense_reason = |
1706 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1707 | ret = -EINVAL; | ||
1694 | goto out; | 1708 | goto out; |
1695 | } | 1709 | } |
1696 | #if 0 | 1710 | #if 0 |
@@ -1727,7 +1741,9 @@ static int core_scsi3_decode_spec_i_port( | |||
1727 | core_scsi3_lunacl_undepend_item(dest_se_deve); | 1741 | core_scsi3_lunacl_undepend_item(dest_se_deve); |
1728 | core_scsi3_nodeacl_undepend_item(dest_node_acl); | 1742 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
1729 | core_scsi3_tpg_undepend_item(dest_tpg); | 1743 | core_scsi3_tpg_undepend_item(dest_tpg); |
1730 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 1744 | cmd->scsi_sense_reason = |
1745 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1746 | ret = -ENOMEM; | ||
1731 | goto out; | 1747 | goto out; |
1732 | } | 1748 | } |
1733 | INIT_LIST_HEAD(&tidh_new->dest_list); | 1749 | INIT_LIST_HEAD(&tidh_new->dest_list); |
@@ -1759,7 +1775,8 @@ static int core_scsi3_decode_spec_i_port( | |||
1759 | core_scsi3_nodeacl_undepend_item(dest_node_acl); | 1775 | core_scsi3_nodeacl_undepend_item(dest_node_acl); |
1760 | core_scsi3_tpg_undepend_item(dest_tpg); | 1776 | core_scsi3_tpg_undepend_item(dest_tpg); |
1761 | kfree(tidh_new); | 1777 | kfree(tidh_new); |
1762 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 1778 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
1779 | ret = -EINVAL; | ||
1763 | goto out; | 1780 | goto out; |
1764 | } | 1781 | } |
1765 | tidh_new->dest_pr_reg = dest_pr_reg; | 1782 | tidh_new->dest_pr_reg = dest_pr_reg; |
@@ -2098,7 +2115,8 @@ static int core_scsi3_emulate_pro_register( | |||
2098 | 2115 | ||
2099 | if (!se_sess || !se_lun) { | 2116 | if (!se_sess || !se_lun) { |
2100 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); | 2117 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); |
2101 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2118 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2119 | return -EINVAL; | ||
2102 | } | 2120 | } |
2103 | se_tpg = se_sess->se_tpg; | 2121 | se_tpg = se_sess->se_tpg; |
2104 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; | 2122 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; |
@@ -2117,13 +2135,14 @@ static int core_scsi3_emulate_pro_register( | |||
2117 | if (res_key) { | 2135 | if (res_key) { |
2118 | pr_warn("SPC-3 PR: Reservation Key non-zero" | 2136 | pr_warn("SPC-3 PR: Reservation Key non-zero" |
2119 | " for SA REGISTER, returning CONFLICT\n"); | 2137 | " for SA REGISTER, returning CONFLICT\n"); |
2120 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2138 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
2139 | return -EINVAL; | ||
2121 | } | 2140 | } |
2122 | /* | 2141 | /* |
2123 | * Do nothing but return GOOD status. | 2142 | * Do nothing but return GOOD status. |
2124 | */ | 2143 | */ |
2125 | if (!sa_res_key) | 2144 | if (!sa_res_key) |
2126 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 2145 | return 0; |
2127 | 2146 | ||
2128 | if (!spec_i_pt) { | 2147 | if (!spec_i_pt) { |
2129 | /* | 2148 | /* |
@@ -2138,7 +2157,8 @@ static int core_scsi3_emulate_pro_register( | |||
2138 | if (ret != 0) { | 2157 | if (ret != 0) { |
2139 | pr_err("Unable to allocate" | 2158 | pr_err("Unable to allocate" |
2140 | " struct t10_pr_registration\n"); | 2159 | " struct t10_pr_registration\n"); |
2141 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 2160 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
2161 | return -EINVAL; | ||
2142 | } | 2162 | } |
2143 | } else { | 2163 | } else { |
2144 | /* | 2164 | /* |
@@ -2197,14 +2217,16 @@ static int core_scsi3_emulate_pro_register( | |||
2197 | " 0x%016Lx\n", res_key, | 2217 | " 0x%016Lx\n", res_key, |
2198 | pr_reg->pr_res_key); | 2218 | pr_reg->pr_res_key); |
2199 | core_scsi3_put_pr_reg(pr_reg); | 2219 | core_scsi3_put_pr_reg(pr_reg); |
2200 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2220 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
2221 | return -EINVAL; | ||
2201 | } | 2222 | } |
2202 | } | 2223 | } |
2203 | if (spec_i_pt) { | 2224 | if (spec_i_pt) { |
2204 | pr_err("SPC-3 PR UNREGISTER: SPEC_I_PT" | 2225 | pr_err("SPC-3 PR UNREGISTER: SPEC_I_PT" |
2205 | " set while sa_res_key=0\n"); | 2226 | " set while sa_res_key=0\n"); |
2206 | core_scsi3_put_pr_reg(pr_reg); | 2227 | core_scsi3_put_pr_reg(pr_reg); |
2207 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 2228 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
2229 | return -EINVAL; | ||
2208 | } | 2230 | } |
2209 | /* | 2231 | /* |
2210 | * An existing ALL_TG_PT=1 registration being released | 2232 | * An existing ALL_TG_PT=1 registration being released |
@@ -2215,7 +2237,8 @@ static int core_scsi3_emulate_pro_register( | |||
2215 | " registration exists, but ALL_TG_PT=1 bit not" | 2237 | " registration exists, but ALL_TG_PT=1 bit not" |
2216 | " present in received PROUT\n"); | 2238 | " present in received PROUT\n"); |
2217 | core_scsi3_put_pr_reg(pr_reg); | 2239 | core_scsi3_put_pr_reg(pr_reg); |
2218 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 2240 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
2241 | return -EINVAL; | ||
2219 | } | 2242 | } |
2220 | /* | 2243 | /* |
2221 | * Allocate APTPL metadata buffer used for UNREGISTER ops | 2244 | * Allocate APTPL metadata buffer used for UNREGISTER ops |
@@ -2227,7 +2250,9 @@ static int core_scsi3_emulate_pro_register( | |||
2227 | pr_err("Unable to allocate" | 2250 | pr_err("Unable to allocate" |
2228 | " pr_aptpl_buf\n"); | 2251 | " pr_aptpl_buf\n"); |
2229 | core_scsi3_put_pr_reg(pr_reg); | 2252 | core_scsi3_put_pr_reg(pr_reg); |
2230 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2253 | cmd->scsi_sense_reason = |
2254 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
2255 | return -EINVAL; | ||
2231 | } | 2256 | } |
2232 | } | 2257 | } |
2233 | /* | 2258 | /* |
@@ -2241,7 +2266,8 @@ static int core_scsi3_emulate_pro_register( | |||
2241 | if (pr_holder < 0) { | 2266 | if (pr_holder < 0) { |
2242 | kfree(pr_aptpl_buf); | 2267 | kfree(pr_aptpl_buf); |
2243 | core_scsi3_put_pr_reg(pr_reg); | 2268 | core_scsi3_put_pr_reg(pr_reg); |
2244 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2269 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
2270 | return -EINVAL; | ||
2245 | } | 2271 | } |
2246 | 2272 | ||
2247 | spin_lock(&pr_tmpl->registration_lock); | 2273 | spin_lock(&pr_tmpl->registration_lock); |
@@ -2405,7 +2431,8 @@ static int core_scsi3_pro_reserve( | |||
2405 | 2431 | ||
2406 | if (!se_sess || !se_lun) { | 2432 | if (!se_sess || !se_lun) { |
2407 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); | 2433 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); |
2408 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2434 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2435 | return -EINVAL; | ||
2409 | } | 2436 | } |
2410 | se_tpg = se_sess->se_tpg; | 2437 | se_tpg = se_sess->se_tpg; |
2411 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; | 2438 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; |
@@ -2417,7 +2444,8 @@ static int core_scsi3_pro_reserve( | |||
2417 | if (!pr_reg) { | 2444 | if (!pr_reg) { |
2418 | pr_err("SPC-3 PR: Unable to locate" | 2445 | pr_err("SPC-3 PR: Unable to locate" |
2419 | " PR_REGISTERED *pr_reg for RESERVE\n"); | 2446 | " PR_REGISTERED *pr_reg for RESERVE\n"); |
2420 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2447 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2448 | return -EINVAL; | ||
2421 | } | 2449 | } |
2422 | /* | 2450 | /* |
2423 | * From spc4r17 Section 5.7.9: Reserving: | 2451 | * From spc4r17 Section 5.7.9: Reserving: |
@@ -2433,7 +2461,8 @@ static int core_scsi3_pro_reserve( | |||
2433 | " does not match existing SA REGISTER res_key:" | 2461 | " does not match existing SA REGISTER res_key:" |
2434 | " 0x%016Lx\n", res_key, pr_reg->pr_res_key); | 2462 | " 0x%016Lx\n", res_key, pr_reg->pr_res_key); |
2435 | core_scsi3_put_pr_reg(pr_reg); | 2463 | core_scsi3_put_pr_reg(pr_reg); |
2436 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2464 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
2465 | return -EINVAL; | ||
2437 | } | 2466 | } |
2438 | /* | 2467 | /* |
2439 | * From spc4r17 Section 5.7.9: Reserving: | 2468 | * From spc4r17 Section 5.7.9: Reserving: |
@@ -2448,7 +2477,8 @@ static int core_scsi3_pro_reserve( | |||
2448 | if (scope != PR_SCOPE_LU_SCOPE) { | 2477 | if (scope != PR_SCOPE_LU_SCOPE) { |
2449 | pr_err("SPC-3 PR: Illegal SCOPE: 0x%02x\n", scope); | 2478 | pr_err("SPC-3 PR: Illegal SCOPE: 0x%02x\n", scope); |
2450 | core_scsi3_put_pr_reg(pr_reg); | 2479 | core_scsi3_put_pr_reg(pr_reg); |
2451 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 2480 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
2481 | return -EINVAL; | ||
2452 | } | 2482 | } |
2453 | /* | 2483 | /* |
2454 | * See if we have an existing PR reservation holder pointer at | 2484 | * See if we have an existing PR reservation holder pointer at |
@@ -2480,7 +2510,8 @@ static int core_scsi3_pro_reserve( | |||
2480 | 2510 | ||
2481 | spin_unlock(&dev->dev_reservation_lock); | 2511 | spin_unlock(&dev->dev_reservation_lock); |
2482 | core_scsi3_put_pr_reg(pr_reg); | 2512 | core_scsi3_put_pr_reg(pr_reg); |
2483 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2513 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
2514 | return -EINVAL; | ||
2484 | } | 2515 | } |
2485 | /* | 2516 | /* |
2486 | * From spc4r17 Section 5.7.9: Reserving: | 2517 | * From spc4r17 Section 5.7.9: Reserving: |
@@ -2503,7 +2534,8 @@ static int core_scsi3_pro_reserve( | |||
2503 | 2534 | ||
2504 | spin_unlock(&dev->dev_reservation_lock); | 2535 | spin_unlock(&dev->dev_reservation_lock); |
2505 | core_scsi3_put_pr_reg(pr_reg); | 2536 | core_scsi3_put_pr_reg(pr_reg); |
2506 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2537 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
2538 | return -EINVAL; | ||
2507 | } | 2539 | } |
2508 | /* | 2540 | /* |
2509 | * From spc4r17 Section 5.7.9: Reserving: | 2541 | * From spc4r17 Section 5.7.9: Reserving: |
@@ -2517,7 +2549,7 @@ static int core_scsi3_pro_reserve( | |||
2517 | */ | 2549 | */ |
2518 | spin_unlock(&dev->dev_reservation_lock); | 2550 | spin_unlock(&dev->dev_reservation_lock); |
2519 | core_scsi3_put_pr_reg(pr_reg); | 2551 | core_scsi3_put_pr_reg(pr_reg); |
2520 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 2552 | return 0; |
2521 | } | 2553 | } |
2522 | /* | 2554 | /* |
2523 | * Otherwise, our *pr_reg becomes the PR reservation holder for said | 2555 | * Otherwise, our *pr_reg becomes the PR reservation holder for said |
@@ -2574,7 +2606,8 @@ static int core_scsi3_emulate_pro_reserve( | |||
2574 | default: | 2606 | default: |
2575 | pr_err("SPC-3 PR: Unknown Service Action RESERVE Type:" | 2607 | pr_err("SPC-3 PR: Unknown Service Action RESERVE Type:" |
2576 | " 0x%02x\n", type); | 2608 | " 0x%02x\n", type); |
2577 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 2609 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
2610 | return -EINVAL; | ||
2578 | } | 2611 | } |
2579 | 2612 | ||
2580 | return ret; | 2613 | return ret; |
@@ -2630,7 +2663,8 @@ static int core_scsi3_emulate_pro_release( | |||
2630 | 2663 | ||
2631 | if (!se_sess || !se_lun) { | 2664 | if (!se_sess || !se_lun) { |
2632 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); | 2665 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); |
2633 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2666 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2667 | return -EINVAL; | ||
2634 | } | 2668 | } |
2635 | /* | 2669 | /* |
2636 | * Locate the existing *pr_reg via struct se_node_acl pointers | 2670 | * Locate the existing *pr_reg via struct se_node_acl pointers |
@@ -2639,7 +2673,8 @@ static int core_scsi3_emulate_pro_release( | |||
2639 | if (!pr_reg) { | 2673 | if (!pr_reg) { |
2640 | pr_err("SPC-3 PR: Unable to locate" | 2674 | pr_err("SPC-3 PR: Unable to locate" |
2641 | " PR_REGISTERED *pr_reg for RELEASE\n"); | 2675 | " PR_REGISTERED *pr_reg for RELEASE\n"); |
2642 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2676 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2677 | return -EINVAL; | ||
2643 | } | 2678 | } |
2644 | /* | 2679 | /* |
2645 | * From spc4r17 Section 5.7.11.2 Releasing: | 2680 | * From spc4r17 Section 5.7.11.2 Releasing: |
@@ -2661,7 +2696,7 @@ static int core_scsi3_emulate_pro_release( | |||
2661 | */ | 2696 | */ |
2662 | spin_unlock(&dev->dev_reservation_lock); | 2697 | spin_unlock(&dev->dev_reservation_lock); |
2663 | core_scsi3_put_pr_reg(pr_reg); | 2698 | core_scsi3_put_pr_reg(pr_reg); |
2664 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 2699 | return 0; |
2665 | } | 2700 | } |
2666 | if ((pr_res_holder->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG) || | 2701 | if ((pr_res_holder->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG) || |
2667 | (pr_res_holder->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG)) | 2702 | (pr_res_holder->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG)) |
@@ -2675,7 +2710,7 @@ static int core_scsi3_emulate_pro_release( | |||
2675 | */ | 2710 | */ |
2676 | spin_unlock(&dev->dev_reservation_lock); | 2711 | spin_unlock(&dev->dev_reservation_lock); |
2677 | core_scsi3_put_pr_reg(pr_reg); | 2712 | core_scsi3_put_pr_reg(pr_reg); |
2678 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 2713 | return 0; |
2679 | } | 2714 | } |
2680 | /* | 2715 | /* |
2681 | * From spc4r17 Section 5.7.11.2 Releasing: | 2716 | * From spc4r17 Section 5.7.11.2 Releasing: |
@@ -2697,7 +2732,8 @@ static int core_scsi3_emulate_pro_release( | |||
2697 | " 0x%016Lx\n", res_key, pr_reg->pr_res_key); | 2732 | " 0x%016Lx\n", res_key, pr_reg->pr_res_key); |
2698 | spin_unlock(&dev->dev_reservation_lock); | 2733 | spin_unlock(&dev->dev_reservation_lock); |
2699 | core_scsi3_put_pr_reg(pr_reg); | 2734 | core_scsi3_put_pr_reg(pr_reg); |
2700 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2735 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
2736 | return -EINVAL; | ||
2701 | } | 2737 | } |
2702 | /* | 2738 | /* |
2703 | * From spc4r17 Section 5.7.11.2 Releasing and above: | 2739 | * From spc4r17 Section 5.7.11.2 Releasing and above: |
@@ -2719,7 +2755,8 @@ static int core_scsi3_emulate_pro_release( | |||
2719 | 2755 | ||
2720 | spin_unlock(&dev->dev_reservation_lock); | 2756 | spin_unlock(&dev->dev_reservation_lock); |
2721 | core_scsi3_put_pr_reg(pr_reg); | 2757 | core_scsi3_put_pr_reg(pr_reg); |
2722 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2758 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
2759 | return -EINVAL; | ||
2723 | } | 2760 | } |
2724 | /* | 2761 | /* |
2725 | * In response to a persistent reservation release request from the | 2762 | * In response to a persistent reservation release request from the |
@@ -2802,7 +2839,8 @@ static int core_scsi3_emulate_pro_clear( | |||
2802 | if (!pr_reg_n) { | 2839 | if (!pr_reg_n) { |
2803 | pr_err("SPC-3 PR: Unable to locate" | 2840 | pr_err("SPC-3 PR: Unable to locate" |
2804 | " PR_REGISTERED *pr_reg for CLEAR\n"); | 2841 | " PR_REGISTERED *pr_reg for CLEAR\n"); |
2805 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 2842 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2843 | return -EINVAL; | ||
2806 | } | 2844 | } |
2807 | /* | 2845 | /* |
2808 | * From spc4r17 section 5.7.11.6, Clearing: | 2846 | * From spc4r17 section 5.7.11.6, Clearing: |
@@ -2821,7 +2859,8 @@ static int core_scsi3_emulate_pro_clear( | |||
2821 | " existing SA REGISTER res_key:" | 2859 | " existing SA REGISTER res_key:" |
2822 | " 0x%016Lx\n", res_key, pr_reg_n->pr_res_key); | 2860 | " 0x%016Lx\n", res_key, pr_reg_n->pr_res_key); |
2823 | core_scsi3_put_pr_reg(pr_reg_n); | 2861 | core_scsi3_put_pr_reg(pr_reg_n); |
2824 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 2862 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
2863 | return -EINVAL; | ||
2825 | } | 2864 | } |
2826 | /* | 2865 | /* |
2827 | * a) Release the persistent reservation, if any; | 2866 | * a) Release the persistent reservation, if any; |
@@ -2979,8 +3018,10 @@ static int core_scsi3_pro_preempt( | |||
2979 | int all_reg = 0, calling_it_nexus = 0, released_regs = 0; | 3018 | int all_reg = 0, calling_it_nexus = 0, released_regs = 0; |
2980 | int prh_type = 0, prh_scope = 0, ret; | 3019 | int prh_type = 0, prh_scope = 0, ret; |
2981 | 3020 | ||
2982 | if (!se_sess) | 3021 | if (!se_sess) { |
2983 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3022 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
3023 | return -EINVAL; | ||
3024 | } | ||
2984 | 3025 | ||
2985 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; | 3026 | se_deve = &se_sess->se_node_acl->device_list[cmd->orig_fe_lun]; |
2986 | pr_reg_n = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl, | 3027 | pr_reg_n = core_scsi3_locate_pr_reg(cmd->se_dev, se_sess->se_node_acl, |
@@ -2989,16 +3030,19 @@ static int core_scsi3_pro_preempt( | |||
2989 | pr_err("SPC-3 PR: Unable to locate" | 3030 | pr_err("SPC-3 PR: Unable to locate" |
2990 | " PR_REGISTERED *pr_reg for PREEMPT%s\n", | 3031 | " PR_REGISTERED *pr_reg for PREEMPT%s\n", |
2991 | (abort) ? "_AND_ABORT" : ""); | 3032 | (abort) ? "_AND_ABORT" : ""); |
2992 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 3033 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
3034 | return -EINVAL; | ||
2993 | } | 3035 | } |
2994 | if (pr_reg_n->pr_res_key != res_key) { | 3036 | if (pr_reg_n->pr_res_key != res_key) { |
2995 | core_scsi3_put_pr_reg(pr_reg_n); | 3037 | core_scsi3_put_pr_reg(pr_reg_n); |
2996 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 3038 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
3039 | return -EINVAL; | ||
2997 | } | 3040 | } |
2998 | if (scope != PR_SCOPE_LU_SCOPE) { | 3041 | if (scope != PR_SCOPE_LU_SCOPE) { |
2999 | pr_err("SPC-3 PR: Illegal SCOPE: 0x%02x\n", scope); | 3042 | pr_err("SPC-3 PR: Illegal SCOPE: 0x%02x\n", scope); |
3000 | core_scsi3_put_pr_reg(pr_reg_n); | 3043 | core_scsi3_put_pr_reg(pr_reg_n); |
3001 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3044 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3045 | return -EINVAL; | ||
3002 | } | 3046 | } |
3003 | INIT_LIST_HEAD(&preempt_and_abort_list); | 3047 | INIT_LIST_HEAD(&preempt_and_abort_list); |
3004 | 3048 | ||
@@ -3012,7 +3056,8 @@ static int core_scsi3_pro_preempt( | |||
3012 | if (!all_reg && !sa_res_key) { | 3056 | if (!all_reg && !sa_res_key) { |
3013 | spin_unlock(&dev->dev_reservation_lock); | 3057 | spin_unlock(&dev->dev_reservation_lock); |
3014 | core_scsi3_put_pr_reg(pr_reg_n); | 3058 | core_scsi3_put_pr_reg(pr_reg_n); |
3015 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3059 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3060 | return -EINVAL; | ||
3016 | } | 3061 | } |
3017 | /* | 3062 | /* |
3018 | * From spc4r17, section 5.7.11.4.4 Removing Registrations: | 3063 | * From spc4r17, section 5.7.11.4.4 Removing Registrations: |
@@ -3106,7 +3151,8 @@ static int core_scsi3_pro_preempt( | |||
3106 | if (!released_regs) { | 3151 | if (!released_regs) { |
3107 | spin_unlock(&dev->dev_reservation_lock); | 3152 | spin_unlock(&dev->dev_reservation_lock); |
3108 | core_scsi3_put_pr_reg(pr_reg_n); | 3153 | core_scsi3_put_pr_reg(pr_reg_n); |
3109 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 3154 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
3155 | return -EINVAL; | ||
3110 | } | 3156 | } |
3111 | /* | 3157 | /* |
3112 | * For an existing all registrants type reservation | 3158 | * For an existing all registrants type reservation |
@@ -3297,7 +3343,8 @@ static int core_scsi3_emulate_pro_preempt( | |||
3297 | default: | 3343 | default: |
3298 | pr_err("SPC-3 PR: Unknown Service Action PREEMPT%s" | 3344 | pr_err("SPC-3 PR: Unknown Service Action PREEMPT%s" |
3299 | " Type: 0x%02x\n", (abort) ? "_AND_ABORT" : "", type); | 3345 | " Type: 0x%02x\n", (abort) ? "_AND_ABORT" : "", type); |
3300 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 3346 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
3347 | return -EINVAL; | ||
3301 | } | 3348 | } |
3302 | 3349 | ||
3303 | return ret; | 3350 | return ret; |
@@ -3331,7 +3378,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3331 | 3378 | ||
3332 | if (!se_sess || !se_lun) { | 3379 | if (!se_sess || !se_lun) { |
3333 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); | 3380 | pr_err("SPC-3 PR: se_sess || struct se_lun is NULL!\n"); |
3334 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3381 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
3382 | return -EINVAL; | ||
3335 | } | 3383 | } |
3336 | memset(dest_iport, 0, 64); | 3384 | memset(dest_iport, 0, 64); |
3337 | memset(i_buf, 0, PR_REG_ISID_ID_LEN); | 3385 | memset(i_buf, 0, PR_REG_ISID_ID_LEN); |
@@ -3349,7 +3397,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3349 | if (!pr_reg) { | 3397 | if (!pr_reg) { |
3350 | pr_err("SPC-3 PR: Unable to locate PR_REGISTERED" | 3398 | pr_err("SPC-3 PR: Unable to locate PR_REGISTERED" |
3351 | " *pr_reg for REGISTER_AND_MOVE\n"); | 3399 | " *pr_reg for REGISTER_AND_MOVE\n"); |
3352 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3400 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
3401 | return -EINVAL; | ||
3353 | } | 3402 | } |
3354 | /* | 3403 | /* |
3355 | * The provided reservation key much match the existing reservation key | 3404 | * The provided reservation key much match the existing reservation key |
@@ -3360,7 +3409,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3360 | " res_key: 0x%016Lx does not match existing SA REGISTER" | 3409 | " res_key: 0x%016Lx does not match existing SA REGISTER" |
3361 | " res_key: 0x%016Lx\n", res_key, pr_reg->pr_res_key); | 3410 | " res_key: 0x%016Lx\n", res_key, pr_reg->pr_res_key); |
3362 | core_scsi3_put_pr_reg(pr_reg); | 3411 | core_scsi3_put_pr_reg(pr_reg); |
3363 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 3412 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
3413 | return -EINVAL; | ||
3364 | } | 3414 | } |
3365 | /* | 3415 | /* |
3366 | * The service active reservation key needs to be non zero | 3416 | * The service active reservation key needs to be non zero |
@@ -3369,7 +3419,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3369 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: Received zero" | 3419 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: Received zero" |
3370 | " sa_res_key\n"); | 3420 | " sa_res_key\n"); |
3371 | core_scsi3_put_pr_reg(pr_reg); | 3421 | core_scsi3_put_pr_reg(pr_reg); |
3372 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3422 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3423 | return -EINVAL; | ||
3373 | } | 3424 | } |
3374 | 3425 | ||
3375 | /* | 3426 | /* |
@@ -3392,7 +3443,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3392 | " does not equal CDB data_length: %u\n", tid_len, | 3443 | " does not equal CDB data_length: %u\n", tid_len, |
3393 | cmd->data_length); | 3444 | cmd->data_length); |
3394 | core_scsi3_put_pr_reg(pr_reg); | 3445 | core_scsi3_put_pr_reg(pr_reg); |
3395 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3446 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3447 | return -EINVAL; | ||
3396 | } | 3448 | } |
3397 | 3449 | ||
3398 | spin_lock(&dev->se_port_lock); | 3450 | spin_lock(&dev->se_port_lock); |
@@ -3417,7 +3469,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3417 | atomic_dec(&dest_se_tpg->tpg_pr_ref_count); | 3469 | atomic_dec(&dest_se_tpg->tpg_pr_ref_count); |
3418 | smp_mb__after_atomic_dec(); | 3470 | smp_mb__after_atomic_dec(); |
3419 | core_scsi3_put_pr_reg(pr_reg); | 3471 | core_scsi3_put_pr_reg(pr_reg); |
3420 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3472 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
3473 | return -EINVAL; | ||
3421 | } | 3474 | } |
3422 | 3475 | ||
3423 | spin_lock(&dev->se_port_lock); | 3476 | spin_lock(&dev->se_port_lock); |
@@ -3430,7 +3483,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3430 | " fabric ops from Relative Target Port Identifier:" | 3483 | " fabric ops from Relative Target Port Identifier:" |
3431 | " %hu\n", rtpi); | 3484 | " %hu\n", rtpi); |
3432 | core_scsi3_put_pr_reg(pr_reg); | 3485 | core_scsi3_put_pr_reg(pr_reg); |
3433 | return PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3486 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3487 | return -EINVAL; | ||
3434 | } | 3488 | } |
3435 | 3489 | ||
3436 | buf = transport_kmap_first_data_page(cmd); | 3490 | buf = transport_kmap_first_data_page(cmd); |
@@ -3445,14 +3499,16 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3445 | " from fabric: %s\n", proto_ident, | 3499 | " from fabric: %s\n", proto_ident, |
3446 | dest_tf_ops->get_fabric_proto_ident(dest_se_tpg), | 3500 | dest_tf_ops->get_fabric_proto_ident(dest_se_tpg), |
3447 | dest_tf_ops->get_fabric_name()); | 3501 | dest_tf_ops->get_fabric_name()); |
3448 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3502 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3503 | ret = -EINVAL; | ||
3449 | goto out; | 3504 | goto out; |
3450 | } | 3505 | } |
3451 | if (dest_tf_ops->tpg_parse_pr_out_transport_id == NULL) { | 3506 | if (dest_tf_ops->tpg_parse_pr_out_transport_id == NULL) { |
3452 | pr_err("SPC-3 PR REGISTER_AND_MOVE: Fabric does not" | 3507 | pr_err("SPC-3 PR REGISTER_AND_MOVE: Fabric does not" |
3453 | " containg a valid tpg_parse_pr_out_transport_id" | 3508 | " containg a valid tpg_parse_pr_out_transport_id" |
3454 | " function pointer\n"); | 3509 | " function pointer\n"); |
3455 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 3510 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
3511 | ret = -EINVAL; | ||
3456 | goto out; | 3512 | goto out; |
3457 | } | 3513 | } |
3458 | initiator_str = dest_tf_ops->tpg_parse_pr_out_transport_id(dest_se_tpg, | 3514 | initiator_str = dest_tf_ops->tpg_parse_pr_out_transport_id(dest_se_tpg, |
@@ -3460,7 +3516,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3460 | if (!initiator_str) { | 3516 | if (!initiator_str) { |
3461 | pr_err("SPC-3 PR REGISTER_AND_MOVE: Unable to locate" | 3517 | pr_err("SPC-3 PR REGISTER_AND_MOVE: Unable to locate" |
3462 | " initiator_str from Transport ID\n"); | 3518 | " initiator_str from Transport ID\n"); |
3463 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3519 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3520 | ret = -EINVAL; | ||
3464 | goto out; | 3521 | goto out; |
3465 | } | 3522 | } |
3466 | 3523 | ||
@@ -3489,7 +3546,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3489 | pr_err("SPC-3 PR REGISTER_AND_MOVE: TransportID: %s" | 3546 | pr_err("SPC-3 PR REGISTER_AND_MOVE: TransportID: %s" |
3490 | " matches: %s on received I_T Nexus\n", initiator_str, | 3547 | " matches: %s on received I_T Nexus\n", initiator_str, |
3491 | pr_reg_nacl->initiatorname); | 3548 | pr_reg_nacl->initiatorname); |
3492 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3549 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3550 | ret = -EINVAL; | ||
3493 | goto out; | 3551 | goto out; |
3494 | } | 3552 | } |
3495 | if (!strcmp(iport_ptr, pr_reg->pr_reg_isid)) { | 3553 | if (!strcmp(iport_ptr, pr_reg->pr_reg_isid)) { |
@@ -3497,7 +3555,8 @@ static int core_scsi3_emulate_pro_register_and_move( | |||
3497 | " matches: %s %s on received I_T Nexus\n", | 3555 | " matches: %s %s on received I_T Nexus\n", |
3498 | initiator_str, iport_ptr, pr_reg_nacl->initiatorname, | 3556 | initiator_str, iport_ptr, pr_reg_nacl->initiatorname, |
3499 | pr_reg->pr_reg_isid); | 3557 | pr_reg->pr_reg_isid); |
3500 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3558 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3559 | ret = -EINVAL; | ||
3501 | goto out; | 3560 | goto out; |
3502 | } | 3561 | } |
3503 | after_iport_check: | 3562 | after_iport_check: |
@@ -3517,7 +3576,8 @@ after_iport_check: | |||
3517 | pr_err("Unable to locate %s dest_node_acl for" | 3576 | pr_err("Unable to locate %s dest_node_acl for" |
3518 | " TransportID%s\n", dest_tf_ops->get_fabric_name(), | 3577 | " TransportID%s\n", dest_tf_ops->get_fabric_name(), |
3519 | initiator_str); | 3578 | initiator_str); |
3520 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3579 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3580 | ret = -EINVAL; | ||
3521 | goto out; | 3581 | goto out; |
3522 | } | 3582 | } |
3523 | ret = core_scsi3_nodeacl_depend_item(dest_node_acl); | 3583 | ret = core_scsi3_nodeacl_depend_item(dest_node_acl); |
@@ -3527,7 +3587,8 @@ after_iport_check: | |||
3527 | atomic_dec(&dest_node_acl->acl_pr_ref_count); | 3587 | atomic_dec(&dest_node_acl->acl_pr_ref_count); |
3528 | smp_mb__after_atomic_dec(); | 3588 | smp_mb__after_atomic_dec(); |
3529 | dest_node_acl = NULL; | 3589 | dest_node_acl = NULL; |
3530 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 3590 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3591 | ret = -EINVAL; | ||
3531 | goto out; | 3592 | goto out; |
3532 | } | 3593 | } |
3533 | #if 0 | 3594 | #if 0 |
@@ -3543,7 +3604,8 @@ after_iport_check: | |||
3543 | if (!dest_se_deve) { | 3604 | if (!dest_se_deve) { |
3544 | pr_err("Unable to locate %s dest_se_deve from RTPI:" | 3605 | pr_err("Unable to locate %s dest_se_deve from RTPI:" |
3545 | " %hu\n", dest_tf_ops->get_fabric_name(), rtpi); | 3606 | " %hu\n", dest_tf_ops->get_fabric_name(), rtpi); |
3546 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3607 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3608 | ret = -EINVAL; | ||
3547 | goto out; | 3609 | goto out; |
3548 | } | 3610 | } |
3549 | 3611 | ||
@@ -3553,7 +3615,8 @@ after_iport_check: | |||
3553 | atomic_dec(&dest_se_deve->pr_ref_count); | 3615 | atomic_dec(&dest_se_deve->pr_ref_count); |
3554 | smp_mb__after_atomic_dec(); | 3616 | smp_mb__after_atomic_dec(); |
3555 | dest_se_deve = NULL; | 3617 | dest_se_deve = NULL; |
3556 | ret = PYX_TRANSPORT_LU_COMM_FAILURE; | 3618 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
3619 | ret = -EINVAL; | ||
3557 | goto out; | 3620 | goto out; |
3558 | } | 3621 | } |
3559 | #if 0 | 3622 | #if 0 |
@@ -3572,7 +3635,8 @@ after_iport_check: | |||
3572 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: No reservation" | 3635 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: No reservation" |
3573 | " currently held\n"); | 3636 | " currently held\n"); |
3574 | spin_unlock(&dev->dev_reservation_lock); | 3637 | spin_unlock(&dev->dev_reservation_lock); |
3575 | ret = PYX_TRANSPORT_INVALID_CDB_FIELD; | 3638 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
3639 | ret = -EINVAL; | ||
3576 | goto out; | 3640 | goto out; |
3577 | } | 3641 | } |
3578 | /* | 3642 | /* |
@@ -3585,7 +3649,8 @@ after_iport_check: | |||
3585 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: Calling I_T" | 3649 | pr_warn("SPC-3 PR REGISTER_AND_MOVE: Calling I_T" |
3586 | " Nexus is not reservation holder\n"); | 3650 | " Nexus is not reservation holder\n"); |
3587 | spin_unlock(&dev->dev_reservation_lock); | 3651 | spin_unlock(&dev->dev_reservation_lock); |
3588 | ret = PYX_TRANSPORT_RESERVATION_CONFLICT; | 3652 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
3653 | ret = -EINVAL; | ||
3589 | goto out; | 3654 | goto out; |
3590 | } | 3655 | } |
3591 | /* | 3656 | /* |
@@ -3603,7 +3668,8 @@ after_iport_check: | |||
3603 | " reservation for type: %s\n", | 3668 | " reservation for type: %s\n", |
3604 | core_scsi3_pr_dump_type(pr_res_holder->pr_res_type)); | 3669 | core_scsi3_pr_dump_type(pr_res_holder->pr_res_type)); |
3605 | spin_unlock(&dev->dev_reservation_lock); | 3670 | spin_unlock(&dev->dev_reservation_lock); |
3606 | ret = PYX_TRANSPORT_RESERVATION_CONFLICT; | 3671 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
3672 | ret = -EINVAL; | ||
3607 | goto out; | 3673 | goto out; |
3608 | } | 3674 | } |
3609 | pr_res_nacl = pr_res_holder->pr_reg_nacl; | 3675 | pr_res_nacl = pr_res_holder->pr_reg_nacl; |
@@ -3640,7 +3706,8 @@ after_iport_check: | |||
3640 | sa_res_key, 0, aptpl, 2, 1); | 3706 | sa_res_key, 0, aptpl, 2, 1); |
3641 | if (ret != 0) { | 3707 | if (ret != 0) { |
3642 | spin_unlock(&dev->dev_reservation_lock); | 3708 | spin_unlock(&dev->dev_reservation_lock); |
3643 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3709 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3710 | ret = -EINVAL; | ||
3644 | goto out; | 3711 | goto out; |
3645 | } | 3712 | } |
3646 | dest_pr_reg = __core_scsi3_locate_pr_reg(dev, dest_node_acl, | 3713 | dest_pr_reg = __core_scsi3_locate_pr_reg(dev, dest_node_acl, |
@@ -3771,7 +3838,8 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
3771 | pr_err("Received PERSISTENT_RESERVE CDB while legacy" | 3838 | pr_err("Received PERSISTENT_RESERVE CDB while legacy" |
3772 | " SPC-2 reservation is held, returning" | 3839 | " SPC-2 reservation is held, returning" |
3773 | " RESERVATION_CONFLICT\n"); | 3840 | " RESERVATION_CONFLICT\n"); |
3774 | ret = PYX_TRANSPORT_RESERVATION_CONFLICT; | 3841 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
3842 | ret = EINVAL; | ||
3775 | goto out; | 3843 | goto out; |
3776 | } | 3844 | } |
3777 | 3845 | ||
@@ -3779,13 +3847,16 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
3779 | * FIXME: A NULL struct se_session pointer means an this is not coming from | 3847 | * FIXME: A NULL struct se_session pointer means an this is not coming from |
3780 | * a $FABRIC_MOD's nexus, but from internal passthrough ops. | 3848 | * a $FABRIC_MOD's nexus, but from internal passthrough ops. |
3781 | */ | 3849 | */ |
3782 | if (!cmd->se_sess) | 3850 | if (!cmd->se_sess) { |
3783 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 3851 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
3852 | return -EINVAL; | ||
3853 | } | ||
3784 | 3854 | ||
3785 | if (cmd->data_length < 24) { | 3855 | if (cmd->data_length < 24) { |
3786 | pr_warn("SPC-PR: Received PR OUT parameter list" | 3856 | pr_warn("SPC-PR: Received PR OUT parameter list" |
3787 | " length too small: %u\n", cmd->data_length); | 3857 | " length too small: %u\n", cmd->data_length); |
3788 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3858 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3859 | ret = -EINVAL; | ||
3789 | goto out; | 3860 | goto out; |
3790 | } | 3861 | } |
3791 | /* | 3862 | /* |
@@ -3820,7 +3891,8 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
3820 | * SPEC_I_PT=1 is only valid for Service action: REGISTER | 3891 | * SPEC_I_PT=1 is only valid for Service action: REGISTER |
3821 | */ | 3892 | */ |
3822 | if (spec_i_pt && ((cdb[1] & 0x1f) != PRO_REGISTER)) { | 3893 | if (spec_i_pt && ((cdb[1] & 0x1f) != PRO_REGISTER)) { |
3823 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3894 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3895 | ret = -EINVAL; | ||
3824 | goto out; | 3896 | goto out; |
3825 | } | 3897 | } |
3826 | 3898 | ||
@@ -3837,7 +3909,8 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
3837 | (cmd->data_length != 24)) { | 3909 | (cmd->data_length != 24)) { |
3838 | pr_warn("SPC-PR: Received PR OUT illegal parameter" | 3910 | pr_warn("SPC-PR: Received PR OUT illegal parameter" |
3839 | " list length: %u\n", cmd->data_length); | 3911 | " list length: %u\n", cmd->data_length); |
3840 | ret = PYX_TRANSPORT_INVALID_PARAMETER_LIST; | 3912 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; |
3913 | ret = -EINVAL; | ||
3841 | goto out; | 3914 | goto out; |
3842 | } | 3915 | } |
3843 | /* | 3916 | /* |
@@ -3878,7 +3951,8 @@ int target_scsi3_emulate_pr_out(struct se_task *task) | |||
3878 | default: | 3951 | default: |
3879 | pr_err("Unknown PERSISTENT_RESERVE_OUT service" | 3952 | pr_err("Unknown PERSISTENT_RESERVE_OUT service" |
3880 | " action: 0x%02x\n", cdb[1] & 0x1f); | 3953 | " action: 0x%02x\n", cdb[1] & 0x1f); |
3881 | ret = PYX_TRANSPORT_INVALID_CDB_FIELD; | 3954 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
3955 | ret = -EINVAL; | ||
3882 | break; | 3956 | break; |
3883 | } | 3957 | } |
3884 | 3958 | ||
@@ -3906,7 +3980,8 @@ static int core_scsi3_pri_read_keys(struct se_cmd *cmd) | |||
3906 | if (cmd->data_length < 8) { | 3980 | if (cmd->data_length < 8) { |
3907 | pr_err("PRIN SA READ_KEYS SCSI Data Length: %u" | 3981 | pr_err("PRIN SA READ_KEYS SCSI Data Length: %u" |
3908 | " too small\n", cmd->data_length); | 3982 | " too small\n", cmd->data_length); |
3909 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 3983 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
3984 | return -EINVAL; | ||
3910 | } | 3985 | } |
3911 | 3986 | ||
3912 | buf = transport_kmap_first_data_page(cmd); | 3987 | buf = transport_kmap_first_data_page(cmd); |
@@ -3965,7 +4040,8 @@ static int core_scsi3_pri_read_reservation(struct se_cmd *cmd) | |||
3965 | if (cmd->data_length < 8) { | 4040 | if (cmd->data_length < 8) { |
3966 | pr_err("PRIN SA READ_RESERVATIONS SCSI Data Length: %u" | 4041 | pr_err("PRIN SA READ_RESERVATIONS SCSI Data Length: %u" |
3967 | " too small\n", cmd->data_length); | 4042 | " too small\n", cmd->data_length); |
3968 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 4043 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
4044 | return -EINVAL; | ||
3969 | } | 4045 | } |
3970 | 4046 | ||
3971 | buf = transport_kmap_first_data_page(cmd); | 4047 | buf = transport_kmap_first_data_page(cmd); |
@@ -4047,7 +4123,8 @@ static int core_scsi3_pri_report_capabilities(struct se_cmd *cmd) | |||
4047 | if (cmd->data_length < 6) { | 4123 | if (cmd->data_length < 6) { |
4048 | pr_err("PRIN SA REPORT_CAPABILITIES SCSI Data Length:" | 4124 | pr_err("PRIN SA REPORT_CAPABILITIES SCSI Data Length:" |
4049 | " %u too small\n", cmd->data_length); | 4125 | " %u too small\n", cmd->data_length); |
4050 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 4126 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
4127 | return -EINVAL; | ||
4051 | } | 4128 | } |
4052 | 4129 | ||
4053 | buf = transport_kmap_first_data_page(cmd); | 4130 | buf = transport_kmap_first_data_page(cmd); |
@@ -4108,7 +4185,8 @@ static int core_scsi3_pri_read_full_status(struct se_cmd *cmd) | |||
4108 | if (cmd->data_length < 8) { | 4185 | if (cmd->data_length < 8) { |
4109 | pr_err("PRIN SA READ_FULL_STATUS SCSI Data Length: %u" | 4186 | pr_err("PRIN SA READ_FULL_STATUS SCSI Data Length: %u" |
4110 | " too small\n", cmd->data_length); | 4187 | " too small\n", cmd->data_length); |
4111 | return PYX_TRANSPORT_INVALID_CDB_FIELD; | 4188 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
4189 | return -EINVAL; | ||
4112 | } | 4190 | } |
4113 | 4191 | ||
4114 | buf = transport_kmap_first_data_page(cmd); | 4192 | buf = transport_kmap_first_data_page(cmd); |
@@ -4255,7 +4333,8 @@ int target_scsi3_emulate_pr_in(struct se_task *task) | |||
4255 | pr_err("Received PERSISTENT_RESERVE CDB while legacy" | 4333 | pr_err("Received PERSISTENT_RESERVE CDB while legacy" |
4256 | " SPC-2 reservation is held, returning" | 4334 | " SPC-2 reservation is held, returning" |
4257 | " RESERVATION_CONFLICT\n"); | 4335 | " RESERVATION_CONFLICT\n"); |
4258 | return PYX_TRANSPORT_RESERVATION_CONFLICT; | 4336 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
4337 | return -EINVAL; | ||
4259 | } | 4338 | } |
4260 | 4339 | ||
4261 | switch (cmd->t_task_cdb[1] & 0x1f) { | 4340 | switch (cmd->t_task_cdb[1] & 0x1f) { |
@@ -4274,7 +4353,8 @@ int target_scsi3_emulate_pr_in(struct se_task *task) | |||
4274 | default: | 4353 | default: |
4275 | pr_err("Unknown PERSISTENT_RESERVE_IN service" | 4354 | pr_err("Unknown PERSISTENT_RESERVE_IN service" |
4276 | " action: 0x%02x\n", cmd->t_task_cdb[1] & 0x1f); | 4355 | " action: 0x%02x\n", cmd->t_task_cdb[1] & 0x1f); |
4277 | ret = PYX_TRANSPORT_INVALID_CDB_FIELD; | 4356 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; |
4357 | ret = -EINVAL; | ||
4278 | break; | 4358 | break; |
4279 | } | 4359 | } |
4280 | 4360 | ||
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index ed32e1efe429..8b15e56b0384 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -963,6 +963,7 @@ static inline struct bio *pscsi_get_bio(int sg_num) | |||
963 | static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, | 963 | static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, |
964 | struct bio **hbio) | 964 | struct bio **hbio) |
965 | { | 965 | { |
966 | struct se_cmd *cmd = task->task_se_cmd; | ||
966 | struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr; | 967 | struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr; |
967 | u32 task_sg_num = task->task_sg_nents; | 968 | u32 task_sg_num = task->task_sg_nents; |
968 | struct bio *bio = NULL, *tbio = NULL; | 969 | struct bio *bio = NULL, *tbio = NULL; |
@@ -971,7 +972,7 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, | |||
971 | u32 data_len = task->task_size, i, len, bytes, off; | 972 | u32 data_len = task->task_size, i, len, bytes, off; |
972 | int nr_pages = (task->task_size + task_sg[0].offset + | 973 | int nr_pages = (task->task_size + task_sg[0].offset + |
973 | PAGE_SIZE - 1) >> PAGE_SHIFT; | 974 | PAGE_SIZE - 1) >> PAGE_SHIFT; |
974 | int nr_vecs = 0, rc, ret = PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; | 975 | int nr_vecs = 0, rc; |
975 | int rw = (task->task_data_direction == DMA_TO_DEVICE); | 976 | int rw = (task->task_data_direction == DMA_TO_DEVICE); |
976 | 977 | ||
977 | *hbio = NULL; | 978 | *hbio = NULL; |
@@ -1058,11 +1059,13 @@ fail: | |||
1058 | bio->bi_next = NULL; | 1059 | bio->bi_next = NULL; |
1059 | bio_endio(bio, 0); /* XXX: should be error */ | 1060 | bio_endio(bio, 0); /* XXX: should be error */ |
1060 | } | 1061 | } |
1061 | return ret; | 1062 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
1063 | return -ENOMEM; | ||
1062 | } | 1064 | } |
1063 | 1065 | ||
1064 | static int pscsi_do_task(struct se_task *task) | 1066 | static int pscsi_do_task(struct se_task *task) |
1065 | { | 1067 | { |
1068 | struct se_cmd *cmd = task->task_se_cmd; | ||
1066 | struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr; | 1069 | struct pscsi_dev_virt *pdv = task->task_se_cmd->se_dev->dev_ptr; |
1067 | struct pscsi_plugin_task *pt = PSCSI_TASK(task); | 1070 | struct pscsi_plugin_task *pt = PSCSI_TASK(task); |
1068 | struct request *req; | 1071 | struct request *req; |
@@ -1078,7 +1081,9 @@ static int pscsi_do_task(struct se_task *task) | |||
1078 | if (!req || IS_ERR(req)) { | 1081 | if (!req || IS_ERR(req)) { |
1079 | pr_err("PSCSI: blk_get_request() failed: %ld\n", | 1082 | pr_err("PSCSI: blk_get_request() failed: %ld\n", |
1080 | req ? IS_ERR(req) : -ENOMEM); | 1083 | req ? IS_ERR(req) : -ENOMEM); |
1081 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 1084 | cmd->scsi_sense_reason = |
1085 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1086 | return -ENODEV; | ||
1082 | } | 1087 | } |
1083 | } else { | 1088 | } else { |
1084 | BUG_ON(!task->task_size); | 1089 | BUG_ON(!task->task_size); |
@@ -1087,8 +1092,11 @@ static int pscsi_do_task(struct se_task *task) | |||
1087 | * Setup the main struct request for the task->task_sg[] payload | 1092 | * Setup the main struct request for the task->task_sg[] payload |
1088 | */ | 1093 | */ |
1089 | ret = pscsi_map_sg(task, task->task_sg, &hbio); | 1094 | ret = pscsi_map_sg(task, task->task_sg, &hbio); |
1090 | if (ret < 0) | 1095 | if (ret < 0) { |
1091 | return PYX_TRANSPORT_LU_COMM_FAILURE; | 1096 | cmd->scsi_sense_reason = |
1097 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1098 | return ret; | ||
1099 | } | ||
1092 | 1100 | ||
1093 | req = blk_make_request(pdv->pdv_sd->request_queue, hbio, | 1101 | req = blk_make_request(pdv->pdv_sd->request_queue, hbio, |
1094 | GFP_KERNEL); | 1102 | GFP_KERNEL); |
@@ -1115,7 +1123,7 @@ static int pscsi_do_task(struct se_task *task) | |||
1115 | (task->task_se_cmd->sam_task_attr == MSG_HEAD_TAG), | 1123 | (task->task_se_cmd->sam_task_attr == MSG_HEAD_TAG), |
1116 | pscsi_req_done); | 1124 | pscsi_req_done); |
1117 | 1125 | ||
1118 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | 1126 | return 0; |
1119 | 1127 | ||
1120 | fail: | 1128 | fail: |
1121 | while (hbio) { | 1129 | while (hbio) { |
@@ -1124,7 +1132,8 @@ fail: | |||
1124 | bio->bi_next = NULL; | 1132 | bio->bi_next = NULL; |
1125 | bio_endio(bio, 0); /* XXX: should be error */ | 1133 | bio_endio(bio, 0); /* XXX: should be error */ |
1126 | } | 1134 | } |
1127 | return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; | 1135 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
1136 | return -ENOMEM; | ||
1128 | } | 1137 | } |
1129 | 1138 | ||
1130 | /* pscsi_get_sense_buffer(): | 1139 | /* pscsi_get_sense_buffer(): |
@@ -1198,9 +1207,8 @@ static inline void pscsi_process_SAM_status( | |||
1198 | " 0x%02x Result: 0x%08x\n", task, pt->pscsi_cdb[0], | 1207 | " 0x%02x Result: 0x%08x\n", task, pt->pscsi_cdb[0], |
1199 | pt->pscsi_result); | 1208 | pt->pscsi_result); |
1200 | task->task_scsi_status = SAM_STAT_CHECK_CONDITION; | 1209 | task->task_scsi_status = SAM_STAT_CHECK_CONDITION; |
1201 | task->task_error_status = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 1210 | task->task_se_cmd->scsi_sense_reason = |
1202 | task->task_se_cmd->transport_error_status = | 1211 | TCM_UNSUPPORTED_SCSI_OPCODE; |
1203 | PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | ||
1204 | transport_complete_task(task, 0); | 1212 | transport_complete_task(task, 0); |
1205 | break; | 1213 | break; |
1206 | } | 1214 | } |
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index 5158d3846f19..02e51faa2f4e 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c | |||
@@ -343,235 +343,74 @@ static struct rd_dev_sg_table *rd_get_sg_table(struct rd_dev *rd_dev, u32 page) | |||
343 | return NULL; | 343 | return NULL; |
344 | } | 344 | } |
345 | 345 | ||
346 | /* rd_MEMCPY_read(): | 346 | static int rd_MEMCPY(struct rd_request *req, u32 read_rd) |
347 | * | ||
348 | * | ||
349 | */ | ||
350 | static int rd_MEMCPY_read(struct rd_request *req) | ||
351 | { | 347 | { |
352 | struct se_task *task = &req->rd_task; | 348 | struct se_task *task = &req->rd_task; |
353 | struct rd_dev *dev = req->rd_task.task_se_cmd->se_dev->dev_ptr; | 349 | struct rd_dev *dev = req->rd_task.task_se_cmd->se_dev->dev_ptr; |
354 | struct rd_dev_sg_table *table; | 350 | struct rd_dev_sg_table *table; |
355 | struct scatterlist *sg_d, *sg_s; | 351 | struct scatterlist *rd_sg; |
356 | void *dst, *src; | 352 | struct sg_mapping_iter m; |
357 | u32 i = 0, j = 0, dst_offset = 0, src_offset = 0; | ||
358 | u32 length, page_end = 0, table_sg_end; | ||
359 | u32 rd_offset = req->rd_offset; | 353 | u32 rd_offset = req->rd_offset; |
354 | u32 src_len; | ||
360 | 355 | ||
361 | table = rd_get_sg_table(dev, req->rd_page); | 356 | table = rd_get_sg_table(dev, req->rd_page); |
362 | if (!table) | 357 | if (!table) |
363 | return -EINVAL; | 358 | return -EINVAL; |
364 | 359 | ||
365 | table_sg_end = (table->page_end_offset - req->rd_page); | 360 | rd_sg = &table->sg_table[req->rd_page - table->page_start_offset]; |
366 | sg_d = task->task_sg; | ||
367 | sg_s = &table->sg_table[req->rd_page - table->page_start_offset]; | ||
368 | 361 | ||
369 | pr_debug("RD[%u]: Read LBA: %llu, Size: %u Page: %u, Offset:" | 362 | pr_debug("RD[%u]: %s LBA: %llu, Size: %u Page: %u, Offset: %u\n", |
370 | " %u\n", dev->rd_dev_id, task->task_lba, req->rd_size, | 363 | dev->rd_dev_id, read_rd ? "Read" : "Write", |
371 | req->rd_page, req->rd_offset); | 364 | task->task_lba, req->rd_size, req->rd_page, |
372 | 365 | rd_offset); | |
373 | src_offset = rd_offset; | ||
374 | 366 | ||
367 | src_len = PAGE_SIZE - rd_offset; | ||
368 | sg_miter_start(&m, task->task_sg, task->task_sg_nents, | ||
369 | read_rd ? SG_MITER_TO_SG : SG_MITER_FROM_SG); | ||
375 | while (req->rd_size) { | 370 | while (req->rd_size) { |
376 | if ((sg_d[i].length - dst_offset) < | 371 | u32 len; |
377 | (sg_s[j].length - src_offset)) { | 372 | void *rd_addr; |
378 | length = (sg_d[i].length - dst_offset); | ||
379 | |||
380 | pr_debug("Step 1 - sg_d[%d]: %p length: %d" | ||
381 | " offset: %u sg_s[%d].length: %u\n", i, | ||
382 | &sg_d[i], sg_d[i].length, sg_d[i].offset, j, | ||
383 | sg_s[j].length); | ||
384 | pr_debug("Step 1 - length: %u dst_offset: %u" | ||
385 | " src_offset: %u\n", length, dst_offset, | ||
386 | src_offset); | ||
387 | |||
388 | if (length > req->rd_size) | ||
389 | length = req->rd_size; | ||
390 | |||
391 | dst = sg_virt(&sg_d[i++]) + dst_offset; | ||
392 | BUG_ON(!dst); | ||
393 | |||
394 | src = sg_virt(&sg_s[j]) + src_offset; | ||
395 | BUG_ON(!src); | ||
396 | |||
397 | dst_offset = 0; | ||
398 | src_offset = length; | ||
399 | page_end = 0; | ||
400 | } else { | ||
401 | length = (sg_s[j].length - src_offset); | ||
402 | |||
403 | pr_debug("Step 2 - sg_d[%d]: %p length: %d" | ||
404 | " offset: %u sg_s[%d].length: %u\n", i, | ||
405 | &sg_d[i], sg_d[i].length, sg_d[i].offset, | ||
406 | j, sg_s[j].length); | ||
407 | pr_debug("Step 2 - length: %u dst_offset: %u" | ||
408 | " src_offset: %u\n", length, dst_offset, | ||
409 | src_offset); | ||
410 | |||
411 | if (length > req->rd_size) | ||
412 | length = req->rd_size; | ||
413 | |||
414 | dst = sg_virt(&sg_d[i]) + dst_offset; | ||
415 | BUG_ON(!dst); | ||
416 | |||
417 | if (sg_d[i].length == length) { | ||
418 | i++; | ||
419 | dst_offset = 0; | ||
420 | } else | ||
421 | dst_offset = length; | ||
422 | |||
423 | src = sg_virt(&sg_s[j++]) + src_offset; | ||
424 | BUG_ON(!src); | ||
425 | |||
426 | src_offset = 0; | ||
427 | page_end = 1; | ||
428 | } | ||
429 | 373 | ||
430 | memcpy(dst, src, length); | 374 | sg_miter_next(&m); |
375 | len = min((u32)m.length, src_len); | ||
376 | m.consumed = len; | ||
431 | 377 | ||
432 | pr_debug("page: %u, remaining size: %u, length: %u," | 378 | rd_addr = sg_virt(rd_sg) + rd_offset; |
433 | " i: %u, j: %u\n", req->rd_page, | ||
434 | (req->rd_size - length), length, i, j); | ||
435 | 379 | ||
436 | req->rd_size -= length; | 380 | if (read_rd) |
437 | if (!req->rd_size) | 381 | memcpy(m.addr, rd_addr, len); |
438 | return 0; | 382 | else |
383 | memcpy(rd_addr, m.addr, len); | ||
439 | 384 | ||
440 | if (!page_end) | 385 | req->rd_size -= len; |
386 | if (!req->rd_size) | ||
441 | continue; | 387 | continue; |
442 | 388 | ||
443 | if (++req->rd_page <= table->page_end_offset) { | 389 | src_len -= len; |
444 | pr_debug("page: %u in same page table\n", | 390 | if (src_len) { |
445 | req->rd_page); | 391 | rd_offset += len; |
446 | continue; | 392 | continue; |
447 | } | 393 | } |
448 | 394 | ||
449 | pr_debug("getting new page table for page: %u\n", | 395 | /* rd page completed, next one please */ |
450 | req->rd_page); | 396 | req->rd_page++; |
451 | 397 | rd_offset = 0; | |
452 | table = rd_get_sg_table(dev, req->rd_page); | 398 | src_len = PAGE_SIZE; |
453 | if (!table) | 399 | if (req->rd_page <= table->page_end_offset) { |
454 | return -EINVAL; | 400 | rd_sg++; |
455 | |||
456 | sg_s = &table->sg_table[j = 0]; | ||
457 | } | ||
458 | |||
459 | return 0; | ||
460 | } | ||
461 | |||
462 | /* rd_MEMCPY_write(): | ||
463 | * | ||
464 | * | ||
465 | */ | ||
466 | static int rd_MEMCPY_write(struct rd_request *req) | ||
467 | { | ||
468 | struct se_task *task = &req->rd_task; | ||
469 | struct rd_dev *dev = req->rd_task.task_se_cmd->se_dev->dev_ptr; | ||
470 | struct rd_dev_sg_table *table; | ||
471 | struct scatterlist *sg_d, *sg_s; | ||
472 | void *dst, *src; | ||
473 | u32 i = 0, j = 0, dst_offset = 0, src_offset = 0; | ||
474 | u32 length, page_end = 0, table_sg_end; | ||
475 | u32 rd_offset = req->rd_offset; | ||
476 | |||
477 | table = rd_get_sg_table(dev, req->rd_page); | ||
478 | if (!table) | ||
479 | return -EINVAL; | ||
480 | |||
481 | table_sg_end = (table->page_end_offset - req->rd_page); | ||
482 | sg_d = &table->sg_table[req->rd_page - table->page_start_offset]; | ||
483 | sg_s = task->task_sg; | ||
484 | |||
485 | pr_debug("RD[%d] Write LBA: %llu, Size: %u, Page: %u," | ||
486 | " Offset: %u\n", dev->rd_dev_id, task->task_lba, req->rd_size, | ||
487 | req->rd_page, req->rd_offset); | ||
488 | |||
489 | dst_offset = rd_offset; | ||
490 | |||
491 | while (req->rd_size) { | ||
492 | if ((sg_s[i].length - src_offset) < | ||
493 | (sg_d[j].length - dst_offset)) { | ||
494 | length = (sg_s[i].length - src_offset); | ||
495 | |||
496 | pr_debug("Step 1 - sg_s[%d]: %p length: %d" | ||
497 | " offset: %d sg_d[%d].length: %u\n", i, | ||
498 | &sg_s[i], sg_s[i].length, sg_s[i].offset, | ||
499 | j, sg_d[j].length); | ||
500 | pr_debug("Step 1 - length: %u src_offset: %u" | ||
501 | " dst_offset: %u\n", length, src_offset, | ||
502 | dst_offset); | ||
503 | |||
504 | if (length > req->rd_size) | ||
505 | length = req->rd_size; | ||
506 | |||
507 | src = sg_virt(&sg_s[i++]) + src_offset; | ||
508 | BUG_ON(!src); | ||
509 | |||
510 | dst = sg_virt(&sg_d[j]) + dst_offset; | ||
511 | BUG_ON(!dst); | ||
512 | |||
513 | src_offset = 0; | ||
514 | dst_offset = length; | ||
515 | page_end = 0; | ||
516 | } else { | ||
517 | length = (sg_d[j].length - dst_offset); | ||
518 | |||
519 | pr_debug("Step 2 - sg_s[%d]: %p length: %d" | ||
520 | " offset: %d sg_d[%d].length: %u\n", i, | ||
521 | &sg_s[i], sg_s[i].length, sg_s[i].offset, | ||
522 | j, sg_d[j].length); | ||
523 | pr_debug("Step 2 - length: %u src_offset: %u" | ||
524 | " dst_offset: %u\n", length, src_offset, | ||
525 | dst_offset); | ||
526 | |||
527 | if (length > req->rd_size) | ||
528 | length = req->rd_size; | ||
529 | |||
530 | src = sg_virt(&sg_s[i]) + src_offset; | ||
531 | BUG_ON(!src); | ||
532 | |||
533 | if (sg_s[i].length == length) { | ||
534 | i++; | ||
535 | src_offset = 0; | ||
536 | } else | ||
537 | src_offset = length; | ||
538 | |||
539 | dst = sg_virt(&sg_d[j++]) + dst_offset; | ||
540 | BUG_ON(!dst); | ||
541 | |||
542 | dst_offset = 0; | ||
543 | page_end = 1; | ||
544 | } | ||
545 | |||
546 | memcpy(dst, src, length); | ||
547 | |||
548 | pr_debug("page: %u, remaining size: %u, length: %u," | ||
549 | " i: %u, j: %u\n", req->rd_page, | ||
550 | (req->rd_size - length), length, i, j); | ||
551 | |||
552 | req->rd_size -= length; | ||
553 | if (!req->rd_size) | ||
554 | return 0; | ||
555 | |||
556 | if (!page_end) | ||
557 | continue; | ||
558 | |||
559 | if (++req->rd_page <= table->page_end_offset) { | ||
560 | pr_debug("page: %u in same page table\n", | ||
561 | req->rd_page); | ||
562 | continue; | 401 | continue; |
563 | } | 402 | } |
564 | 403 | ||
565 | pr_debug("getting new page table for page: %u\n", | ||
566 | req->rd_page); | ||
567 | |||
568 | table = rd_get_sg_table(dev, req->rd_page); | 404 | table = rd_get_sg_table(dev, req->rd_page); |
569 | if (!table) | 405 | if (!table) { |
406 | sg_miter_stop(&m); | ||
570 | return -EINVAL; | 407 | return -EINVAL; |
408 | } | ||
571 | 409 | ||
572 | sg_d = &table->sg_table[j = 0]; | 410 | /* since we increment, the first sg entry is correct */ |
411 | rd_sg = table->sg_table; | ||
573 | } | 412 | } |
574 | 413 | sg_miter_stop(&m); | |
575 | return 0; | 414 | return 0; |
576 | } | 415 | } |
577 | 416 | ||
@@ -583,28 +422,21 @@ static int rd_MEMCPY_do_task(struct se_task *task) | |||
583 | { | 422 | { |
584 | struct se_device *dev = task->task_se_cmd->se_dev; | 423 | struct se_device *dev = task->task_se_cmd->se_dev; |
585 | struct rd_request *req = RD_REQ(task); | 424 | struct rd_request *req = RD_REQ(task); |
586 | unsigned long long lba; | 425 | u64 tmp; |
587 | int ret; | 426 | int ret; |
588 | 427 | ||
589 | req->rd_page = (task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size) / PAGE_SIZE; | 428 | tmp = task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size; |
590 | lba = task->task_lba; | 429 | req->rd_offset = do_div(tmp, PAGE_SIZE); |
591 | req->rd_offset = (do_div(lba, | 430 | req->rd_page = tmp; |
592 | (PAGE_SIZE / dev->se_sub_dev->se_dev_attrib.block_size))) * | ||
593 | dev->se_sub_dev->se_dev_attrib.block_size; | ||
594 | req->rd_size = task->task_size; | 431 | req->rd_size = task->task_size; |
595 | 432 | ||
596 | if (task->task_data_direction == DMA_FROM_DEVICE) | 433 | ret = rd_MEMCPY(req, task->task_data_direction == DMA_FROM_DEVICE); |
597 | ret = rd_MEMCPY_read(req); | ||
598 | else | ||
599 | ret = rd_MEMCPY_write(req); | ||
600 | |||
601 | if (ret != 0) | 434 | if (ret != 0) |
602 | return ret; | 435 | return ret; |
603 | 436 | ||
604 | task->task_scsi_status = GOOD; | 437 | task->task_scsi_status = GOOD; |
605 | transport_complete_task(task, 1); | 438 | transport_complete_task(task, 1); |
606 | 439 | return 0; | |
607 | return PYX_TRANSPORT_SENT_TO_TRANSPORT; | ||
608 | } | 440 | } |
609 | 441 | ||
610 | /* rd_free_task(): (Part of se_subsystem_api_t template) | 442 | /* rd_free_task(): (Part of se_subsystem_api_t template) |
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 217e29df6297..684522805a1f 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
@@ -345,10 +345,6 @@ static void core_tmr_drain_cmd_list( | |||
345 | " %d t_fe_count: %d\n", (preempt_and_abort_list) ? | 345 | " %d t_fe_count: %d\n", (preempt_and_abort_list) ? |
346 | "Preempt" : "", cmd, cmd->t_state, | 346 | "Preempt" : "", cmd, cmd->t_state, |
347 | atomic_read(&cmd->t_fe_count)); | 347 | atomic_read(&cmd->t_fe_count)); |
348 | /* | ||
349 | * Signal that the command has failed via cmd->se_cmd_flags, | ||
350 | */ | ||
351 | transport_new_cmd_failure(cmd); | ||
352 | 348 | ||
353 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, | 349 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, |
354 | atomic_read(&cmd->t_fe_count)); | 350 | atomic_read(&cmd->t_fe_count)); |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 3400ae6e93f8..0257658e2e3e 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -61,7 +61,6 @@ | |||
61 | static int sub_api_initialized; | 61 | static int sub_api_initialized; |
62 | 62 | ||
63 | static struct workqueue_struct *target_completion_wq; | 63 | static struct workqueue_struct *target_completion_wq; |
64 | static struct kmem_cache *se_cmd_cache; | ||
65 | static struct kmem_cache *se_sess_cache; | 64 | static struct kmem_cache *se_sess_cache; |
66 | struct kmem_cache *se_tmr_req_cache; | 65 | struct kmem_cache *se_tmr_req_cache; |
67 | struct kmem_cache *se_ua_cache; | 66 | struct kmem_cache *se_ua_cache; |
@@ -82,24 +81,18 @@ static int transport_generic_get_mem(struct se_cmd *cmd); | |||
82 | static void transport_put_cmd(struct se_cmd *cmd); | 81 | static void transport_put_cmd(struct se_cmd *cmd); |
83 | static void transport_remove_cmd_from_queue(struct se_cmd *cmd); | 82 | static void transport_remove_cmd_from_queue(struct se_cmd *cmd); |
84 | static int transport_set_sense_codes(struct se_cmd *cmd, u8 asc, u8 ascq); | 83 | static int transport_set_sense_codes(struct se_cmd *cmd, u8 asc, u8 ascq); |
85 | static void transport_generic_request_failure(struct se_cmd *, int, int); | 84 | static void transport_generic_request_failure(struct se_cmd *); |
86 | static void target_complete_ok_work(struct work_struct *work); | 85 | static void target_complete_ok_work(struct work_struct *work); |
87 | 86 | ||
88 | int init_se_kmem_caches(void) | 87 | int init_se_kmem_caches(void) |
89 | { | 88 | { |
90 | se_cmd_cache = kmem_cache_create("se_cmd_cache", | ||
91 | sizeof(struct se_cmd), __alignof__(struct se_cmd), 0, NULL); | ||
92 | if (!se_cmd_cache) { | ||
93 | pr_err("kmem_cache_create for struct se_cmd failed\n"); | ||
94 | goto out; | ||
95 | } | ||
96 | se_tmr_req_cache = kmem_cache_create("se_tmr_cache", | 89 | se_tmr_req_cache = kmem_cache_create("se_tmr_cache", |
97 | sizeof(struct se_tmr_req), __alignof__(struct se_tmr_req), | 90 | sizeof(struct se_tmr_req), __alignof__(struct se_tmr_req), |
98 | 0, NULL); | 91 | 0, NULL); |
99 | if (!se_tmr_req_cache) { | 92 | if (!se_tmr_req_cache) { |
100 | pr_err("kmem_cache_create() for struct se_tmr_req" | 93 | pr_err("kmem_cache_create() for struct se_tmr_req" |
101 | " failed\n"); | 94 | " failed\n"); |
102 | goto out_free_cmd_cache; | 95 | goto out; |
103 | } | 96 | } |
104 | se_sess_cache = kmem_cache_create("se_sess_cache", | 97 | se_sess_cache = kmem_cache_create("se_sess_cache", |
105 | sizeof(struct se_session), __alignof__(struct se_session), | 98 | sizeof(struct se_session), __alignof__(struct se_session), |
@@ -182,8 +175,6 @@ out_free_sess_cache: | |||
182 | kmem_cache_destroy(se_sess_cache); | 175 | kmem_cache_destroy(se_sess_cache); |
183 | out_free_tmr_req_cache: | 176 | out_free_tmr_req_cache: |
184 | kmem_cache_destroy(se_tmr_req_cache); | 177 | kmem_cache_destroy(se_tmr_req_cache); |
185 | out_free_cmd_cache: | ||
186 | kmem_cache_destroy(se_cmd_cache); | ||
187 | out: | 178 | out: |
188 | return -ENOMEM; | 179 | return -ENOMEM; |
189 | } | 180 | } |
@@ -191,7 +182,6 @@ out: | |||
191 | void release_se_kmem_caches(void) | 182 | void release_se_kmem_caches(void) |
192 | { | 183 | { |
193 | destroy_workqueue(target_completion_wq); | 184 | destroy_workqueue(target_completion_wq); |
194 | kmem_cache_destroy(se_cmd_cache); | ||
195 | kmem_cache_destroy(se_tmr_req_cache); | 185 | kmem_cache_destroy(se_tmr_req_cache); |
196 | kmem_cache_destroy(se_sess_cache); | 186 | kmem_cache_destroy(se_sess_cache); |
197 | kmem_cache_destroy(se_ua_cache); | 187 | kmem_cache_destroy(se_ua_cache); |
@@ -680,9 +670,9 @@ void transport_complete_sync_cache(struct se_cmd *cmd, int good) | |||
680 | task->task_scsi_status = GOOD; | 670 | task->task_scsi_status = GOOD; |
681 | } else { | 671 | } else { |
682 | task->task_scsi_status = SAM_STAT_CHECK_CONDITION; | 672 | task->task_scsi_status = SAM_STAT_CHECK_CONDITION; |
683 | task->task_error_status = PYX_TRANSPORT_ILLEGAL_REQUEST; | 673 | task->task_se_cmd->scsi_sense_reason = |
684 | task->task_se_cmd->transport_error_status = | 674 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
685 | PYX_TRANSPORT_ILLEGAL_REQUEST; | 675 | |
686 | } | 676 | } |
687 | 677 | ||
688 | transport_complete_task(task, good); | 678 | transport_complete_task(task, good); |
@@ -693,7 +683,7 @@ static void target_complete_failure_work(struct work_struct *work) | |||
693 | { | 683 | { |
694 | struct se_cmd *cmd = container_of(work, struct se_cmd, work); | 684 | struct se_cmd *cmd = container_of(work, struct se_cmd, work); |
695 | 685 | ||
696 | transport_generic_request_failure(cmd, 1, 1); | 686 | transport_generic_request_failure(cmd); |
697 | } | 687 | } |
698 | 688 | ||
699 | /* transport_complete_task(): | 689 | /* transport_complete_task(): |
@@ -755,10 +745,11 @@ void transport_complete_task(struct se_task *task, int success) | |||
755 | if (cmd->t_tasks_failed) { | 745 | if (cmd->t_tasks_failed) { |
756 | if (!task->task_error_status) { | 746 | if (!task->task_error_status) { |
757 | task->task_error_status = | 747 | task->task_error_status = |
758 | PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 748 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
759 | cmd->transport_error_status = | 749 | cmd->scsi_sense_reason = |
760 | PYX_TRANSPORT_UNKNOWN_SAM_OPCODE; | 750 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
761 | } | 751 | } |
752 | |||
762 | INIT_WORK(&cmd->work, target_complete_failure_work); | 753 | INIT_WORK(&cmd->work, target_complete_failure_work); |
763 | } else { | 754 | } else { |
764 | atomic_set(&cmd->t_transport_complete, 1); | 755 | atomic_set(&cmd->t_transport_complete, 1); |
@@ -1335,23 +1326,17 @@ struct se_device *transport_add_device_to_core_hba( | |||
1335 | dev->se_hba = hba; | 1326 | dev->se_hba = hba; |
1336 | dev->se_sub_dev = se_dev; | 1327 | dev->se_sub_dev = se_dev; |
1337 | dev->transport = transport; | 1328 | dev->transport = transport; |
1338 | atomic_set(&dev->active_cmds, 0); | ||
1339 | INIT_LIST_HEAD(&dev->dev_list); | 1329 | INIT_LIST_HEAD(&dev->dev_list); |
1340 | INIT_LIST_HEAD(&dev->dev_sep_list); | 1330 | INIT_LIST_HEAD(&dev->dev_sep_list); |
1341 | INIT_LIST_HEAD(&dev->dev_tmr_list); | 1331 | INIT_LIST_HEAD(&dev->dev_tmr_list); |
1342 | INIT_LIST_HEAD(&dev->execute_task_list); | 1332 | INIT_LIST_HEAD(&dev->execute_task_list); |
1343 | INIT_LIST_HEAD(&dev->delayed_cmd_list); | 1333 | INIT_LIST_HEAD(&dev->delayed_cmd_list); |
1344 | INIT_LIST_HEAD(&dev->ordered_cmd_list); | ||
1345 | INIT_LIST_HEAD(&dev->state_task_list); | 1334 | INIT_LIST_HEAD(&dev->state_task_list); |
1346 | INIT_LIST_HEAD(&dev->qf_cmd_list); | 1335 | INIT_LIST_HEAD(&dev->qf_cmd_list); |
1347 | spin_lock_init(&dev->execute_task_lock); | 1336 | spin_lock_init(&dev->execute_task_lock); |
1348 | spin_lock_init(&dev->delayed_cmd_lock); | 1337 | spin_lock_init(&dev->delayed_cmd_lock); |
1349 | spin_lock_init(&dev->ordered_cmd_lock); | ||
1350 | spin_lock_init(&dev->state_task_lock); | ||
1351 | spin_lock_init(&dev->dev_alua_lock); | ||
1352 | spin_lock_init(&dev->dev_reservation_lock); | 1338 | spin_lock_init(&dev->dev_reservation_lock); |
1353 | spin_lock_init(&dev->dev_status_lock); | 1339 | spin_lock_init(&dev->dev_status_lock); |
1354 | spin_lock_init(&dev->dev_status_thr_lock); | ||
1355 | spin_lock_init(&dev->se_port_lock); | 1340 | spin_lock_init(&dev->se_port_lock); |
1356 | spin_lock_init(&dev->se_tmr_lock); | 1341 | spin_lock_init(&dev->se_tmr_lock); |
1357 | spin_lock_init(&dev->qf_cmd_lock); | 1342 | spin_lock_init(&dev->qf_cmd_lock); |
@@ -1507,7 +1492,6 @@ void transport_init_se_cmd( | |||
1507 | { | 1492 | { |
1508 | INIT_LIST_HEAD(&cmd->se_lun_node); | 1493 | INIT_LIST_HEAD(&cmd->se_lun_node); |
1509 | INIT_LIST_HEAD(&cmd->se_delayed_node); | 1494 | INIT_LIST_HEAD(&cmd->se_delayed_node); |
1510 | INIT_LIST_HEAD(&cmd->se_ordered_node); | ||
1511 | INIT_LIST_HEAD(&cmd->se_qf_node); | 1495 | INIT_LIST_HEAD(&cmd->se_qf_node); |
1512 | INIT_LIST_HEAD(&cmd->se_queue_node); | 1496 | INIT_LIST_HEAD(&cmd->se_queue_node); |
1513 | INIT_LIST_HEAD(&cmd->se_cmd_list); | 1497 | INIT_LIST_HEAD(&cmd->se_cmd_list); |
@@ -1573,6 +1557,8 @@ int transport_generic_allocate_tasks( | |||
1573 | pr_err("Received SCSI CDB with command_size: %d that" | 1557 | pr_err("Received SCSI CDB with command_size: %d that" |
1574 | " exceeds SCSI_MAX_VARLEN_CDB_SIZE: %d\n", | 1558 | " exceeds SCSI_MAX_VARLEN_CDB_SIZE: %d\n", |
1575 | scsi_command_size(cdb), SCSI_MAX_VARLEN_CDB_SIZE); | 1559 | scsi_command_size(cdb), SCSI_MAX_VARLEN_CDB_SIZE); |
1560 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
1561 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
1576 | return -EINVAL; | 1562 | return -EINVAL; |
1577 | } | 1563 | } |
1578 | /* | 1564 | /* |
@@ -1588,6 +1574,9 @@ int transport_generic_allocate_tasks( | |||
1588 | " %u > sizeof(cmd->__t_task_cdb): %lu ops\n", | 1574 | " %u > sizeof(cmd->__t_task_cdb): %lu ops\n", |
1589 | scsi_command_size(cdb), | 1575 | scsi_command_size(cdb), |
1590 | (unsigned long)sizeof(cmd->__t_task_cdb)); | 1576 | (unsigned long)sizeof(cmd->__t_task_cdb)); |
1577 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
1578 | cmd->scsi_sense_reason = | ||
1579 | TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1591 | return -ENOMEM; | 1580 | return -ENOMEM; |
1592 | } | 1581 | } |
1593 | } else | 1582 | } else |
@@ -1658,11 +1647,9 @@ int transport_handle_cdb_direct( | |||
1658 | * and call transport_generic_request_failure() if necessary.. | 1647 | * and call transport_generic_request_failure() if necessary.. |
1659 | */ | 1648 | */ |
1660 | ret = transport_generic_new_cmd(cmd); | 1649 | ret = transport_generic_new_cmd(cmd); |
1661 | if (ret < 0) { | 1650 | if (ret < 0) |
1662 | cmd->transport_error_status = ret; | 1651 | transport_generic_request_failure(cmd); |
1663 | transport_generic_request_failure(cmd, 0, | 1652 | |
1664 | (cmd->data_direction != DMA_TO_DEVICE)); | ||
1665 | } | ||
1666 | return 0; | 1653 | return 0; |
1667 | } | 1654 | } |
1668 | EXPORT_SYMBOL(transport_handle_cdb_direct); | 1655 | EXPORT_SYMBOL(transport_handle_cdb_direct); |
@@ -1798,20 +1785,16 @@ static int transport_stop_tasks_for_cmd(struct se_cmd *cmd) | |||
1798 | /* | 1785 | /* |
1799 | * Handle SAM-esque emulation for generic transport request failures. | 1786 | * Handle SAM-esque emulation for generic transport request failures. |
1800 | */ | 1787 | */ |
1801 | static void transport_generic_request_failure( | 1788 | static void transport_generic_request_failure(struct se_cmd *cmd) |
1802 | struct se_cmd *cmd, | ||
1803 | int complete, | ||
1804 | int sc) | ||
1805 | { | 1789 | { |
1806 | int ret = 0; | 1790 | int ret = 0; |
1807 | 1791 | ||
1808 | pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08x" | 1792 | pr_debug("-----[ Storage Engine Exception for cmd: %p ITT: 0x%08x" |
1809 | " CDB: 0x%02x\n", cmd, cmd->se_tfo->get_task_tag(cmd), | 1793 | " CDB: 0x%02x\n", cmd, cmd->se_tfo->get_task_tag(cmd), |
1810 | cmd->t_task_cdb[0]); | 1794 | cmd->t_task_cdb[0]); |
1811 | pr_debug("-----[ i_state: %d t_state: %d transport_error_status: %d\n", | 1795 | pr_debug("-----[ i_state: %d t_state: %d scsi_sense_reason: %d\n", |
1812 | cmd->se_tfo->get_cmd_state(cmd), | 1796 | cmd->se_tfo->get_cmd_state(cmd), |
1813 | cmd->t_state, | 1797 | cmd->t_state, cmd->scsi_sense_reason); |
1814 | cmd->transport_error_status); | ||
1815 | pr_debug("-----[ t_tasks: %d t_task_cdbs_left: %d" | 1798 | pr_debug("-----[ t_tasks: %d t_task_cdbs_left: %d" |
1816 | " t_task_cdbs_sent: %d t_task_cdbs_ex_left: %d --" | 1799 | " t_task_cdbs_sent: %d t_task_cdbs_ex_left: %d --" |
1817 | " t_transport_active: %d t_transport_stop: %d" | 1800 | " t_transport_active: %d t_transport_stop: %d" |
@@ -1829,46 +1812,19 @@ static void transport_generic_request_failure( | |||
1829 | if (cmd->se_dev->dev_task_attr_type == SAM_TASK_ATTR_EMULATED) | 1812 | if (cmd->se_dev->dev_task_attr_type == SAM_TASK_ATTR_EMULATED) |
1830 | transport_complete_task_attr(cmd); | 1813 | transport_complete_task_attr(cmd); |
1831 | 1814 | ||
1832 | if (complete) { | 1815 | switch (cmd->scsi_sense_reason) { |
1833 | cmd->transport_error_status = PYX_TRANSPORT_LU_COMM_FAILURE; | 1816 | case TCM_NON_EXISTENT_LUN: |
1834 | } | 1817 | case TCM_UNSUPPORTED_SCSI_OPCODE: |
1835 | 1818 | case TCM_INVALID_CDB_FIELD: | |
1836 | switch (cmd->transport_error_status) { | 1819 | case TCM_INVALID_PARAMETER_LIST: |
1837 | case PYX_TRANSPORT_UNKNOWN_SAM_OPCODE: | 1820 | case TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE: |
1838 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; | 1821 | case TCM_UNKNOWN_MODE_PAGE: |
1839 | break; | 1822 | case TCM_WRITE_PROTECTED: |
1840 | case PYX_TRANSPORT_REQ_TOO_MANY_SECTORS: | 1823 | case TCM_CHECK_CONDITION_ABORT_CMD: |
1841 | cmd->scsi_sense_reason = TCM_SECTOR_COUNT_TOO_MANY; | 1824 | case TCM_CHECK_CONDITION_UNIT_ATTENTION: |
1842 | break; | 1825 | case TCM_CHECK_CONDITION_NOT_READY: |
1843 | case PYX_TRANSPORT_INVALID_CDB_FIELD: | ||
1844 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
1845 | break; | ||
1846 | case PYX_TRANSPORT_INVALID_PARAMETER_LIST: | ||
1847 | cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; | ||
1848 | break; | ||
1849 | case PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES: | ||
1850 | if (!sc) | ||
1851 | transport_new_cmd_failure(cmd); | ||
1852 | /* | ||
1853 | * Currently for PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES, | ||
1854 | * we force this session to fall back to session | ||
1855 | * recovery. | ||
1856 | */ | ||
1857 | cmd->se_tfo->fall_back_to_erl0(cmd->se_sess); | ||
1858 | cmd->se_tfo->stop_session(cmd->se_sess, 0, 0); | ||
1859 | |||
1860 | goto check_stop; | ||
1861 | case PYX_TRANSPORT_LU_COMM_FAILURE: | ||
1862 | case PYX_TRANSPORT_ILLEGAL_REQUEST: | ||
1863 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1864 | break; | ||
1865 | case PYX_TRANSPORT_UNKNOWN_MODE_PAGE: | ||
1866 | cmd->scsi_sense_reason = TCM_UNKNOWN_MODE_PAGE; | ||
1867 | break; | ||
1868 | case PYX_TRANSPORT_WRITE_PROTECTED: | ||
1869 | cmd->scsi_sense_reason = TCM_WRITE_PROTECTED; | ||
1870 | break; | 1826 | break; |
1871 | case PYX_TRANSPORT_RESERVATION_CONFLICT: | 1827 | case TCM_RESERVATION_CONFLICT: |
1872 | /* | 1828 | /* |
1873 | * No SENSE Data payload for this case, set SCSI Status | 1829 | * No SENSE Data payload for this case, set SCSI Status |
1874 | * and queue the response to $FABRIC_MOD. | 1830 | * and queue the response to $FABRIC_MOD. |
@@ -1893,15 +1849,9 @@ static void transport_generic_request_failure( | |||
1893 | if (ret == -EAGAIN || ret == -ENOMEM) | 1849 | if (ret == -EAGAIN || ret == -ENOMEM) |
1894 | goto queue_full; | 1850 | goto queue_full; |
1895 | goto check_stop; | 1851 | goto check_stop; |
1896 | case PYX_TRANSPORT_USE_SENSE_REASON: | ||
1897 | /* | ||
1898 | * struct se_cmd->scsi_sense_reason already set | ||
1899 | */ | ||
1900 | break; | ||
1901 | default: | 1852 | default: |
1902 | pr_err("Unknown transport error for CDB 0x%02x: %d\n", | 1853 | pr_err("Unknown transport error for CDB 0x%02x: %d\n", |
1903 | cmd->t_task_cdb[0], | 1854 | cmd->t_task_cdb[0], cmd->scsi_sense_reason); |
1904 | cmd->transport_error_status); | ||
1905 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; | 1855 | cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE; |
1906 | break; | 1856 | break; |
1907 | } | 1857 | } |
@@ -1912,14 +1862,10 @@ static void transport_generic_request_failure( | |||
1912 | * transport_send_check_condition_and_sense() after handling | 1862 | * transport_send_check_condition_and_sense() after handling |
1913 | * possible unsoliticied write data payloads. | 1863 | * possible unsoliticied write data payloads. |
1914 | */ | 1864 | */ |
1915 | if (!sc && !cmd->se_tfo->new_cmd_map) | 1865 | ret = transport_send_check_condition_and_sense(cmd, |
1916 | transport_new_cmd_failure(cmd); | 1866 | cmd->scsi_sense_reason, 0); |
1917 | else { | 1867 | if (ret == -EAGAIN || ret == -ENOMEM) |
1918 | ret = transport_send_check_condition_and_sense(cmd, | 1868 | goto queue_full; |
1919 | cmd->scsi_sense_reason, 0); | ||
1920 | if (ret == -EAGAIN || ret == -ENOMEM) | ||
1921 | goto queue_full; | ||
1922 | } | ||
1923 | 1869 | ||
1924 | check_stop: | 1870 | check_stop: |
1925 | transport_lun_remove_cmd(cmd); | 1871 | transport_lun_remove_cmd(cmd); |
@@ -2002,19 +1948,12 @@ static inline int transport_execute_task_attr(struct se_cmd *cmd) | |||
2002 | * to allow the passed struct se_cmd list of tasks to the front of the list. | 1948 | * to allow the passed struct se_cmd list of tasks to the front of the list. |
2003 | */ | 1949 | */ |
2004 | if (cmd->sam_task_attr == MSG_HEAD_TAG) { | 1950 | if (cmd->sam_task_attr == MSG_HEAD_TAG) { |
2005 | atomic_inc(&cmd->se_dev->dev_hoq_count); | ||
2006 | smp_mb__after_atomic_inc(); | ||
2007 | pr_debug("Added HEAD_OF_QUEUE for CDB:" | 1951 | pr_debug("Added HEAD_OF_QUEUE for CDB:" |
2008 | " 0x%02x, se_ordered_id: %u\n", | 1952 | " 0x%02x, se_ordered_id: %u\n", |
2009 | cmd->t_task_cdb[0], | 1953 | cmd->t_task_cdb[0], |
2010 | cmd->se_ordered_id); | 1954 | cmd->se_ordered_id); |
2011 | return 1; | 1955 | return 1; |
2012 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { | 1956 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { |
2013 | spin_lock(&cmd->se_dev->ordered_cmd_lock); | ||
2014 | list_add_tail(&cmd->se_ordered_node, | ||
2015 | &cmd->se_dev->ordered_cmd_list); | ||
2016 | spin_unlock(&cmd->se_dev->ordered_cmd_lock); | ||
2017 | |||
2018 | atomic_inc(&cmd->se_dev->dev_ordered_sync); | 1957 | atomic_inc(&cmd->se_dev->dev_ordered_sync); |
2019 | smp_mb__after_atomic_inc(); | 1958 | smp_mb__after_atomic_inc(); |
2020 | 1959 | ||
@@ -2076,9 +2015,9 @@ static int transport_execute_tasks(struct se_cmd *cmd) | |||
2076 | { | 2015 | { |
2077 | int add_tasks; | 2016 | int add_tasks; |
2078 | 2017 | ||
2079 | if (se_dev_check_online(cmd->se_orig_obj_ptr) != 0) { | 2018 | if (se_dev_check_online(cmd->se_dev) != 0) { |
2080 | cmd->transport_error_status = PYX_TRANSPORT_LU_COMM_FAILURE; | 2019 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2081 | transport_generic_request_failure(cmd, 0, 1); | 2020 | transport_generic_request_failure(cmd); |
2082 | return 0; | 2021 | return 0; |
2083 | } | 2022 | } |
2084 | 2023 | ||
@@ -2163,14 +2102,13 @@ check_depth: | |||
2163 | else | 2102 | else |
2164 | error = dev->transport->do_task(task); | 2103 | error = dev->transport->do_task(task); |
2165 | if (error != 0) { | 2104 | if (error != 0) { |
2166 | cmd->transport_error_status = error; | ||
2167 | spin_lock_irqsave(&cmd->t_state_lock, flags); | 2105 | spin_lock_irqsave(&cmd->t_state_lock, flags); |
2168 | task->task_flags &= ~TF_ACTIVE; | 2106 | task->task_flags &= ~TF_ACTIVE; |
2169 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 2107 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
2170 | atomic_set(&cmd->t_transport_sent, 0); | 2108 | atomic_set(&cmd->t_transport_sent, 0); |
2171 | transport_stop_tasks_for_cmd(cmd); | 2109 | transport_stop_tasks_for_cmd(cmd); |
2172 | atomic_inc(&dev->depth_left); | 2110 | atomic_inc(&dev->depth_left); |
2173 | transport_generic_request_failure(cmd, 0, 1); | 2111 | transport_generic_request_failure(cmd); |
2174 | } | 2112 | } |
2175 | 2113 | ||
2176 | goto check_depth; | 2114 | goto check_depth; |
@@ -2178,19 +2116,6 @@ check_depth: | |||
2178 | return 0; | 2116 | return 0; |
2179 | } | 2117 | } |
2180 | 2118 | ||
2181 | void transport_new_cmd_failure(struct se_cmd *se_cmd) | ||
2182 | { | ||
2183 | unsigned long flags; | ||
2184 | /* | ||
2185 | * Any unsolicited data will get dumped for failed command inside of | ||
2186 | * the fabric plugin | ||
2187 | */ | ||
2188 | spin_lock_irqsave(&se_cmd->t_state_lock, flags); | ||
2189 | se_cmd->se_cmd_flags |= SCF_SE_CMD_FAILED; | ||
2190 | se_cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
2191 | spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); | ||
2192 | } | ||
2193 | |||
2194 | static inline u32 transport_get_sectors_6( | 2119 | static inline u32 transport_get_sectors_6( |
2195 | unsigned char *cdb, | 2120 | unsigned char *cdb, |
2196 | struct se_cmd *cmd, | 2121 | struct se_cmd *cmd, |
@@ -2213,10 +2138,15 @@ static inline u32 transport_get_sectors_6( | |||
2213 | 2138 | ||
2214 | /* | 2139 | /* |
2215 | * Everything else assume TYPE_DISK Sector CDB location. | 2140 | * Everything else assume TYPE_DISK Sector CDB location. |
2216 | * Use 8-bit sector value. | 2141 | * Use 8-bit sector value. SBC-3 says: |
2142 | * | ||
2143 | * A TRANSFER LENGTH field set to zero specifies that 256 | ||
2144 | * logical blocks shall be written. Any other value | ||
2145 | * specifies the number of logical blocks that shall be | ||
2146 | * written. | ||
2217 | */ | 2147 | */ |
2218 | type_disk: | 2148 | type_disk: |
2219 | return (u32)cdb[4]; | 2149 | return cdb[4] ? : 256; |
2220 | } | 2150 | } |
2221 | 2151 | ||
2222 | static inline u32 transport_get_sectors_10( | 2152 | static inline u32 transport_get_sectors_10( |
@@ -2460,27 +2390,6 @@ static int transport_get_sense_data(struct se_cmd *cmd) | |||
2460 | return -1; | 2390 | return -1; |
2461 | } | 2391 | } |
2462 | 2392 | ||
2463 | static int | ||
2464 | transport_handle_reservation_conflict(struct se_cmd *cmd) | ||
2465 | { | ||
2466 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
2467 | cmd->se_cmd_flags |= SCF_SCSI_RESERVATION_CONFLICT; | ||
2468 | cmd->scsi_status = SAM_STAT_RESERVATION_CONFLICT; | ||
2469 | /* | ||
2470 | * For UA Interlock Code 11b, a RESERVATION CONFLICT will | ||
2471 | * establish a UNIT ATTENTION with PREVIOUS RESERVATION | ||
2472 | * CONFLICT STATUS. | ||
2473 | * | ||
2474 | * See spc4r17, section 7.4.6 Control Mode Page, Table 349 | ||
2475 | */ | ||
2476 | if (cmd->se_sess && | ||
2477 | cmd->se_dev->se_sub_dev->se_dev_attrib.emulate_ua_intlck_ctrl == 2) | ||
2478 | core_scsi3_ua_allocate(cmd->se_sess->se_node_acl, | ||
2479 | cmd->orig_fe_lun, 0x2C, | ||
2480 | ASCQ_2CH_PREVIOUS_RESERVATION_CONFLICT_STATUS); | ||
2481 | return -EINVAL; | ||
2482 | } | ||
2483 | |||
2484 | static inline long long transport_dev_end_lba(struct se_device *dev) | 2393 | static inline long long transport_dev_end_lba(struct se_device *dev) |
2485 | { | 2394 | { |
2486 | return dev->transport->get_blocks(dev) + 1; | 2395 | return dev->transport->get_blocks(dev) + 1; |
@@ -2595,8 +2504,12 @@ static int transport_generic_cmd_sequencer( | |||
2595 | */ | 2504 | */ |
2596 | if (su_dev->t10_pr.pr_ops.t10_reservation_check(cmd, &pr_reg_type) != 0) { | 2505 | if (su_dev->t10_pr.pr_ops.t10_reservation_check(cmd, &pr_reg_type) != 0) { |
2597 | if (su_dev->t10_pr.pr_ops.t10_seq_non_holder( | 2506 | if (su_dev->t10_pr.pr_ops.t10_seq_non_holder( |
2598 | cmd, cdb, pr_reg_type) != 0) | 2507 | cmd, cdb, pr_reg_type) != 0) { |
2599 | return transport_handle_reservation_conflict(cmd); | 2508 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; |
2509 | cmd->se_cmd_flags |= SCF_SCSI_RESERVATION_CONFLICT; | ||
2510 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; | ||
2511 | return -EBUSY; | ||
2512 | } | ||
2600 | /* | 2513 | /* |
2601 | * This means the CDB is allowed for the SCSI Initiator port | 2514 | * This means the CDB is allowed for the SCSI Initiator port |
2602 | * when said port is *NOT* holding the legacy SPC-2 or | 2515 | * when said port is *NOT* holding the legacy SPC-2 or |
@@ -2658,7 +2571,8 @@ static int transport_generic_cmd_sequencer( | |||
2658 | goto out_unsupported_cdb; | 2571 | goto out_unsupported_cdb; |
2659 | size = transport_get_size(sectors, cdb, cmd); | 2572 | size = transport_get_size(sectors, cdb, cmd); |
2660 | cmd->t_task_lba = transport_lba_32(cdb); | 2573 | cmd->t_task_lba = transport_lba_32(cdb); |
2661 | cmd->t_tasks_fua = (cdb[1] & 0x8); | 2574 | if (cdb[1] & 0x8) |
2575 | cmd->se_cmd_flags |= SCF_FUA; | ||
2662 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; | 2576 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; |
2663 | break; | 2577 | break; |
2664 | case WRITE_12: | 2578 | case WRITE_12: |
@@ -2667,7 +2581,8 @@ static int transport_generic_cmd_sequencer( | |||
2667 | goto out_unsupported_cdb; | 2581 | goto out_unsupported_cdb; |
2668 | size = transport_get_size(sectors, cdb, cmd); | 2582 | size = transport_get_size(sectors, cdb, cmd); |
2669 | cmd->t_task_lba = transport_lba_32(cdb); | 2583 | cmd->t_task_lba = transport_lba_32(cdb); |
2670 | cmd->t_tasks_fua = (cdb[1] & 0x8); | 2584 | if (cdb[1] & 0x8) |
2585 | cmd->se_cmd_flags |= SCF_FUA; | ||
2671 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; | 2586 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; |
2672 | break; | 2587 | break; |
2673 | case WRITE_16: | 2588 | case WRITE_16: |
@@ -2676,12 +2591,13 @@ static int transport_generic_cmd_sequencer( | |||
2676 | goto out_unsupported_cdb; | 2591 | goto out_unsupported_cdb; |
2677 | size = transport_get_size(sectors, cdb, cmd); | 2592 | size = transport_get_size(sectors, cdb, cmd); |
2678 | cmd->t_task_lba = transport_lba_64(cdb); | 2593 | cmd->t_task_lba = transport_lba_64(cdb); |
2679 | cmd->t_tasks_fua = (cdb[1] & 0x8); | 2594 | if (cdb[1] & 0x8) |
2595 | cmd->se_cmd_flags |= SCF_FUA; | ||
2680 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; | 2596 | cmd->se_cmd_flags |= SCF_SCSI_DATA_SG_IO_CDB; |
2681 | break; | 2597 | break; |
2682 | case XDWRITEREAD_10: | 2598 | case XDWRITEREAD_10: |
2683 | if ((cmd->data_direction != DMA_TO_DEVICE) || | 2599 | if ((cmd->data_direction != DMA_TO_DEVICE) || |
2684 | !(cmd->t_tasks_bidi)) | 2600 | !(cmd->se_cmd_flags & SCF_BIDI)) |
2685 | goto out_invalid_cdb_field; | 2601 | goto out_invalid_cdb_field; |
2686 | sectors = transport_get_sectors_10(cdb, cmd, §or_ret); | 2602 | sectors = transport_get_sectors_10(cdb, cmd, §or_ret); |
2687 | if (sector_ret) | 2603 | if (sector_ret) |
@@ -2700,7 +2616,8 @@ static int transport_generic_cmd_sequencer( | |||
2700 | * Setup BIDI XOR callback to be run after I/O completion. | 2616 | * Setup BIDI XOR callback to be run after I/O completion. |
2701 | */ | 2617 | */ |
2702 | cmd->transport_complete_callback = &transport_xor_callback; | 2618 | cmd->transport_complete_callback = &transport_xor_callback; |
2703 | cmd->t_tasks_fua = (cdb[1] & 0x8); | 2619 | if (cdb[1] & 0x8) |
2620 | cmd->se_cmd_flags |= SCF_FUA; | ||
2704 | break; | 2621 | break; |
2705 | case VARIABLE_LENGTH_CMD: | 2622 | case VARIABLE_LENGTH_CMD: |
2706 | service_action = get_unaligned_be16(&cdb[8]); | 2623 | service_action = get_unaligned_be16(&cdb[8]); |
@@ -2728,7 +2645,8 @@ static int transport_generic_cmd_sequencer( | |||
2728 | * completion. | 2645 | * completion. |
2729 | */ | 2646 | */ |
2730 | cmd->transport_complete_callback = &transport_xor_callback; | 2647 | cmd->transport_complete_callback = &transport_xor_callback; |
2731 | cmd->t_tasks_fua = (cdb[10] & 0x8); | 2648 | if (cdb[1] & 0x8) |
2649 | cmd->se_cmd_flags |= SCF_FUA; | ||
2732 | break; | 2650 | break; |
2733 | case WRITE_SAME_32: | 2651 | case WRITE_SAME_32: |
2734 | sectors = transport_get_sectors_32(cdb, cmd, §or_ret); | 2652 | sectors = transport_get_sectors_32(cdb, cmd, §or_ret); |
@@ -3171,18 +3089,13 @@ static void transport_complete_task_attr(struct se_cmd *cmd) | |||
3171 | " SIMPLE: %u\n", dev->dev_cur_ordered_id, | 3089 | " SIMPLE: %u\n", dev->dev_cur_ordered_id, |
3172 | cmd->se_ordered_id); | 3090 | cmd->se_ordered_id); |
3173 | } else if (cmd->sam_task_attr == MSG_HEAD_TAG) { | 3091 | } else if (cmd->sam_task_attr == MSG_HEAD_TAG) { |
3174 | atomic_dec(&dev->dev_hoq_count); | ||
3175 | smp_mb__after_atomic_dec(); | ||
3176 | dev->dev_cur_ordered_id++; | 3092 | dev->dev_cur_ordered_id++; |
3177 | pr_debug("Incremented dev_cur_ordered_id: %u for" | 3093 | pr_debug("Incremented dev_cur_ordered_id: %u for" |
3178 | " HEAD_OF_QUEUE: %u\n", dev->dev_cur_ordered_id, | 3094 | " HEAD_OF_QUEUE: %u\n", dev->dev_cur_ordered_id, |
3179 | cmd->se_ordered_id); | 3095 | cmd->se_ordered_id); |
3180 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { | 3096 | } else if (cmd->sam_task_attr == MSG_ORDERED_TAG) { |
3181 | spin_lock(&dev->ordered_cmd_lock); | ||
3182 | list_del(&cmd->se_ordered_node); | ||
3183 | atomic_dec(&dev->dev_ordered_sync); | 3097 | atomic_dec(&dev->dev_ordered_sync); |
3184 | smp_mb__after_atomic_dec(); | 3098 | smp_mb__after_atomic_dec(); |
3185 | spin_unlock(&dev->ordered_cmd_lock); | ||
3186 | 3099 | ||
3187 | dev->dev_cur_ordered_id++; | 3100 | dev->dev_cur_ordered_id++; |
3188 | pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED:" | 3101 | pr_debug("Incremented dev_cur_ordered_id: %u for ORDERED:" |
@@ -3495,6 +3408,18 @@ int transport_generic_map_mem_to_cmd( | |||
3495 | 3408 | ||
3496 | if ((cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) || | 3409 | if ((cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB) || |
3497 | (cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB)) { | 3410 | (cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB)) { |
3411 | /* | ||
3412 | * Reject SCSI data overflow with map_mem_to_cmd() as incoming | ||
3413 | * scatterlists already have been set to follow what the fabric | ||
3414 | * passes for the original expected data transfer length. | ||
3415 | */ | ||
3416 | if (cmd->se_cmd_flags & SCF_OVERFLOW_BIT) { | ||
3417 | pr_warn("Rejecting SCSI DATA overflow for fabric using" | ||
3418 | " SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC\n"); | ||
3419 | cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; | ||
3420 | cmd->scsi_sense_reason = TCM_INVALID_CDB_FIELD; | ||
3421 | return -EINVAL; | ||
3422 | } | ||
3498 | 3423 | ||
3499 | cmd->t_data_sg = sgl; | 3424 | cmd->t_data_sg = sgl; |
3500 | cmd->t_data_nents = sgl_count; | 3425 | cmd->t_data_nents = sgl_count; |
@@ -3813,7 +3738,7 @@ int transport_generic_new_cmd(struct se_cmd *cmd) | |||
3813 | cmd->data_length) { | 3738 | cmd->data_length) { |
3814 | ret = transport_generic_get_mem(cmd); | 3739 | ret = transport_generic_get_mem(cmd); |
3815 | if (ret < 0) | 3740 | if (ret < 0) |
3816 | return ret; | 3741 | goto out_fail; |
3817 | } | 3742 | } |
3818 | 3743 | ||
3819 | /* | 3744 | /* |
@@ -3842,8 +3767,15 @@ int transport_generic_new_cmd(struct se_cmd *cmd) | |||
3842 | task_cdbs = transport_allocate_control_task(cmd); | 3767 | task_cdbs = transport_allocate_control_task(cmd); |
3843 | } | 3768 | } |
3844 | 3769 | ||
3845 | if (task_cdbs <= 0) | 3770 | if (task_cdbs < 0) |
3846 | goto out_fail; | 3771 | goto out_fail; |
3772 | else if (!task_cdbs && (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB)) { | ||
3773 | cmd->t_state = TRANSPORT_COMPLETE; | ||
3774 | atomic_set(&cmd->t_transport_active, 1); | ||
3775 | INIT_WORK(&cmd->work, target_complete_ok_work); | ||
3776 | queue_work(target_completion_wq, &cmd->work); | ||
3777 | return 0; | ||
3778 | } | ||
3847 | 3779 | ||
3848 | if (set_counts) { | 3780 | if (set_counts) { |
3849 | atomic_inc(&cmd->t_fe_count); | 3781 | atomic_inc(&cmd->t_fe_count); |
@@ -3929,7 +3861,7 @@ static int transport_generic_write_pending(struct se_cmd *cmd) | |||
3929 | else if (ret < 0) | 3861 | else if (ret < 0) |
3930 | return ret; | 3862 | return ret; |
3931 | 3863 | ||
3932 | return PYX_TRANSPORT_WRITE_PENDING; | 3864 | return 1; |
3933 | 3865 | ||
3934 | queue_full: | 3866 | queue_full: |
3935 | pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd); | 3867 | pr_debug("Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd); |
@@ -4602,9 +4534,6 @@ void transport_send_task_abort(struct se_cmd *cmd) | |||
4602 | if (cmd->se_tfo->write_pending_status(cmd) != 0) { | 4534 | if (cmd->se_tfo->write_pending_status(cmd) != 0) { |
4603 | atomic_inc(&cmd->t_transport_aborted); | 4535 | atomic_inc(&cmd->t_transport_aborted); |
4604 | smp_mb__after_atomic_inc(); | 4536 | smp_mb__after_atomic_inc(); |
4605 | cmd->scsi_status = SAM_STAT_TASK_ABORTED; | ||
4606 | transport_new_cmd_failure(cmd); | ||
4607 | return; | ||
4608 | } | 4537 | } |
4609 | } | 4538 | } |
4610 | cmd->scsi_status = SAM_STAT_TASK_ABORTED; | 4539 | cmd->scsi_status = SAM_STAT_TASK_ABORTED; |
@@ -4670,8 +4599,6 @@ static int transport_processing_thread(void *param) | |||
4670 | struct se_cmd *cmd; | 4599 | struct se_cmd *cmd; |
4671 | struct se_device *dev = (struct se_device *) param; | 4600 | struct se_device *dev = (struct se_device *) param; |
4672 | 4601 | ||
4673 | set_user_nice(current, -20); | ||
4674 | |||
4675 | while (!kthread_should_stop()) { | 4602 | while (!kthread_should_stop()) { |
4676 | ret = wait_event_interruptible(dev->dev_queue_obj.thread_wq, | 4603 | ret = wait_event_interruptible(dev->dev_queue_obj.thread_wq, |
4677 | atomic_read(&dev->dev_queue_obj.queue_cnt) || | 4604 | atomic_read(&dev->dev_queue_obj.queue_cnt) || |
@@ -4698,18 +4625,13 @@ get_cmd: | |||
4698 | } | 4625 | } |
4699 | ret = cmd->se_tfo->new_cmd_map(cmd); | 4626 | ret = cmd->se_tfo->new_cmd_map(cmd); |
4700 | if (ret < 0) { | 4627 | if (ret < 0) { |
4701 | cmd->transport_error_status = ret; | 4628 | transport_generic_request_failure(cmd); |
4702 | transport_generic_request_failure(cmd, | ||
4703 | 0, (cmd->data_direction != | ||
4704 | DMA_TO_DEVICE)); | ||
4705 | break; | 4629 | break; |
4706 | } | 4630 | } |
4707 | ret = transport_generic_new_cmd(cmd); | 4631 | ret = transport_generic_new_cmd(cmd); |
4708 | if (ret < 0) { | 4632 | if (ret < 0) { |
4709 | cmd->transport_error_status = ret; | 4633 | transport_generic_request_failure(cmd); |
4710 | transport_generic_request_failure(cmd, | 4634 | break; |
4711 | 0, (cmd->data_direction != | ||
4712 | DMA_TO_DEVICE)); | ||
4713 | } | 4635 | } |
4714 | break; | 4636 | break; |
4715 | case TRANSPORT_PROCESS_WRITE: | 4637 | case TRANSPORT_PROCESS_WRITE: |
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 4fac37c4c615..71fc9cea5dc9 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
@@ -200,7 +200,7 @@ int ft_write_pending(struct se_cmd *se_cmd) | |||
200 | lport = ep->lp; | 200 | lport = ep->lp; |
201 | fp = fc_frame_alloc(lport, sizeof(*txrdy)); | 201 | fp = fc_frame_alloc(lport, sizeof(*txrdy)); |
202 | if (!fp) | 202 | if (!fp) |
203 | return PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES; | 203 | return -ENOMEM; /* Signal QUEUE_FULL */ |
204 | 204 | ||
205 | txrdy = fc_frame_payload_get(fp, sizeof(*txrdy)); | 205 | txrdy = fc_frame_payload_get(fp, sizeof(*txrdy)); |
206 | memset(txrdy, 0, sizeof(*txrdy)); | 206 | memset(txrdy, 0, sizeof(*txrdy)); |
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c index 5f770412ca40..9402b7387cac 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c | |||
@@ -436,8 +436,7 @@ static void ft_del_lport(struct se_wwn *wwn) | |||
436 | struct ft_lport_acl *lacl = container_of(wwn, | 436 | struct ft_lport_acl *lacl = container_of(wwn, |
437 | struct ft_lport_acl, fc_lport_wwn); | 437 | struct ft_lport_acl, fc_lport_wwn); |
438 | 438 | ||
439 | pr_debug("del lport %s\n", | 439 | pr_debug("del lport %s\n", lacl->name); |
440 | config_item_name(&wwn->wwn_group.cg_item)); | ||
441 | mutex_lock(&ft_lport_lock); | 440 | mutex_lock(&ft_lport_lock); |
442 | list_del(&lacl->list); | 441 | list_del(&lacl->list); |
443 | mutex_unlock(&ft_lport_lock); | 442 | mutex_unlock(&ft_lport_lock); |
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index 4730016d7cd4..45f422ac103f 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c | |||
@@ -1959,7 +1959,7 @@ static int amd5536_start(struct usb_gadget_driver *driver, | |||
1959 | u32 tmp; | 1959 | u32 tmp; |
1960 | 1960 | ||
1961 | if (!driver || !bind || !driver->setup | 1961 | if (!driver || !bind || !driver->setup |
1962 | || driver->speed != USB_SPEED_HIGH) | 1962 | || driver->speed < USB_SPEED_HIGH) |
1963 | return -EINVAL; | 1963 | return -EINVAL; |
1964 | if (!dev) | 1964 | if (!dev) |
1965 | return -ENODEV; | 1965 | return -ENODEV; |
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 8efe0fa9228d..1ed56d8492d7 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -1748,7 +1748,7 @@ static int __init at91udc_probe(struct platform_device *pdev) | |||
1748 | 1748 | ||
1749 | /* rm9200 needs manual D+ pullup; off by default */ | 1749 | /* rm9200 needs manual D+ pullup; off by default */ |
1750 | if (cpu_is_at91rm9200()) { | 1750 | if (cpu_is_at91rm9200()) { |
1751 | if (udc->board.pullup_pin <= 0) { | 1751 | if (gpio_is_valid(udc->board.pullup_pin)) { |
1752 | DBG("no D+ pullup?\n"); | 1752 | DBG("no D+ pullup?\n"); |
1753 | retval = -ENODEV; | 1753 | retval = -ENODEV; |
1754 | goto fail0; | 1754 | goto fail0; |
@@ -1815,7 +1815,7 @@ static int __init at91udc_probe(struct platform_device *pdev) | |||
1815 | DBG("request irq %d failed\n", udc->udp_irq); | 1815 | DBG("request irq %d failed\n", udc->udp_irq); |
1816 | goto fail1; | 1816 | goto fail1; |
1817 | } | 1817 | } |
1818 | if (udc->board.vbus_pin > 0) { | 1818 | if (gpio_is_valid(udc->board.vbus_pin)) { |
1819 | retval = gpio_request(udc->board.vbus_pin, "udc_vbus"); | 1819 | retval = gpio_request(udc->board.vbus_pin, "udc_vbus"); |
1820 | if (retval < 0) { | 1820 | if (retval < 0) { |
1821 | DBG("request vbus pin failed\n"); | 1821 | DBG("request vbus pin failed\n"); |
@@ -1859,10 +1859,10 @@ static int __init at91udc_probe(struct platform_device *pdev) | |||
1859 | INFO("%s version %s\n", driver_name, DRIVER_VERSION); | 1859 | INFO("%s version %s\n", driver_name, DRIVER_VERSION); |
1860 | return 0; | 1860 | return 0; |
1861 | fail4: | 1861 | fail4: |
1862 | if (udc->board.vbus_pin > 0 && !udc->board.vbus_polled) | 1862 | if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled) |
1863 | free_irq(udc->board.vbus_pin, udc); | 1863 | free_irq(udc->board.vbus_pin, udc); |
1864 | fail3: | 1864 | fail3: |
1865 | if (udc->board.vbus_pin > 0) | 1865 | if (gpio_is_valid(udc->board.vbus_pin)) |
1866 | gpio_free(udc->board.vbus_pin); | 1866 | gpio_free(udc->board.vbus_pin); |
1867 | fail2: | 1867 | fail2: |
1868 | free_irq(udc->udp_irq, udc); | 1868 | free_irq(udc->udp_irq, udc); |
@@ -1897,7 +1897,7 @@ static int __exit at91udc_remove(struct platform_device *pdev) | |||
1897 | 1897 | ||
1898 | device_init_wakeup(&pdev->dev, 0); | 1898 | device_init_wakeup(&pdev->dev, 0); |
1899 | remove_debug_file(udc); | 1899 | remove_debug_file(udc); |
1900 | if (udc->board.vbus_pin > 0) { | 1900 | if (gpio_is_valid(udc->board.vbus_pin)) { |
1901 | free_irq(udc->board.vbus_pin, udc); | 1901 | free_irq(udc->board.vbus_pin, udc); |
1902 | gpio_free(udc->board.vbus_pin); | 1902 | gpio_free(udc->board.vbus_pin); |
1903 | } | 1903 | } |
@@ -1941,7 +1941,7 @@ static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg) | |||
1941 | enable_irq_wake(udc->udp_irq); | 1941 | enable_irq_wake(udc->udp_irq); |
1942 | 1942 | ||
1943 | udc->active_suspend = wake; | 1943 | udc->active_suspend = wake; |
1944 | if (udc->board.vbus_pin > 0 && !udc->board.vbus_polled && wake) | 1944 | if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled && wake) |
1945 | enable_irq_wake(udc->board.vbus_pin); | 1945 | enable_irq_wake(udc->board.vbus_pin); |
1946 | return 0; | 1946 | return 0; |
1947 | } | 1947 | } |
@@ -1951,7 +1951,7 @@ static int at91udc_resume(struct platform_device *pdev) | |||
1951 | struct at91_udc *udc = platform_get_drvdata(pdev); | 1951 | struct at91_udc *udc = platform_get_drvdata(pdev); |
1952 | unsigned long flags; | 1952 | unsigned long flags; |
1953 | 1953 | ||
1954 | if (udc->board.vbus_pin > 0 && !udc->board.vbus_polled && | 1954 | if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled && |
1955 | udc->active_suspend) | 1955 | udc->active_suspend) |
1956 | disable_irq_wake(udc->board.vbus_pin); | 1956 | disable_irq_wake(udc->board.vbus_pin); |
1957 | 1957 | ||
diff --git a/drivers/usb/gadget/f_serial.c b/drivers/usb/gadget/f_serial.c index 91fdf790ed20..cf33a8d0fd5d 100644 --- a/drivers/usb/gadget/f_serial.c +++ b/drivers/usb/gadget/f_serial.c | |||
@@ -131,8 +131,8 @@ static int gser_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
131 | } | 131 | } |
132 | if (!gser->port.in->desc || !gser->port.out->desc) { | 132 | if (!gser->port.in->desc || !gser->port.out->desc) { |
133 | DBG(cdev, "activate generic ttyGS%d\n", gser->port_num); | 133 | DBG(cdev, "activate generic ttyGS%d\n", gser->port_num); |
134 | if (!config_ep_by_speed(cdev->gadget, f, gser->port.in) || | 134 | if (config_ep_by_speed(cdev->gadget, f, gser->port.in) || |
135 | !config_ep_by_speed(cdev->gadget, f, gser->port.out)) { | 135 | config_ep_by_speed(cdev->gadget, f, gser->port.out)) { |
136 | gser->port.in->desc = NULL; | 136 | gser->port.in->desc = NULL; |
137 | gser->port.out->desc = NULL; | 137 | gser->port.out->desc = NULL; |
138 | return -EINVAL; | 138 | return -EINVAL; |
diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c index 43a49ecc1f36..dcbc0a2e48dd 100644 --- a/drivers/usb/gadget/fsl_mxc_udc.c +++ b/drivers/usb/gadget/fsl_mxc_udc.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/fsl_devices.h> | 17 | #include <linux/fsl_devices.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/io.h> | ||
19 | 20 | ||
20 | #include <mach/hardware.h> | 21 | #include <mach/hardware.h> |
21 | 22 | ||
@@ -88,7 +89,6 @@ eenahb: | |||
88 | void fsl_udc_clk_finalize(struct platform_device *pdev) | 89 | void fsl_udc_clk_finalize(struct platform_device *pdev) |
89 | { | 90 | { |
90 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; | 91 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; |
91 | #if defined(CONFIG_SOC_IMX35) | ||
92 | if (cpu_is_mx35()) { | 92 | if (cpu_is_mx35()) { |
93 | unsigned int v; | 93 | unsigned int v; |
94 | 94 | ||
@@ -101,7 +101,6 @@ void fsl_udc_clk_finalize(struct platform_device *pdev) | |||
101 | USBPHYCTRL_OTGBASE_OFFSET)); | 101 | USBPHYCTRL_OTGBASE_OFFSET)); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | #endif | ||
105 | 104 | ||
106 | /* ULPI transceivers don't need usbpll */ | 105 | /* ULPI transceivers don't need usbpll */ |
107 | if (pdata->phy_mode == FSL_USB2_PHY_ULPI) { | 106 | if (pdata->phy_mode == FSL_USB2_PHY_ULPI) { |
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c index 2a03e4de11c1..e00cf92409ce 100644 --- a/drivers/usb/gadget/fsl_qe_udc.c +++ b/drivers/usb/gadget/fsl_qe_udc.c | |||
@@ -2336,8 +2336,7 @@ static int fsl_qe_start(struct usb_gadget_driver *driver, | |||
2336 | if (!udc_controller) | 2336 | if (!udc_controller) |
2337 | return -ENODEV; | 2337 | return -ENODEV; |
2338 | 2338 | ||
2339 | if (!driver || (driver->speed != USB_SPEED_FULL | 2339 | if (!driver || driver->speed < USB_SPEED_FULL |
2340 | && driver->speed != USB_SPEED_HIGH) | ||
2341 | || !bind || !driver->disconnect || !driver->setup) | 2340 | || !bind || !driver->disconnect || !driver->setup) |
2342 | return -EINVAL; | 2341 | return -EINVAL; |
2343 | 2342 | ||
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index b3b3d83b7c33..dd28ef3def71 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
@@ -696,12 +696,31 @@ static void fsl_free_request(struct usb_ep *_ep, struct usb_request *_req) | |||
696 | kfree(req); | 696 | kfree(req); |
697 | } | 697 | } |
698 | 698 | ||
699 | /*-------------------------------------------------------------------------*/ | 699 | /* Actually add a dTD chain to an empty dQH and let go */ |
700 | static void fsl_prime_ep(struct fsl_ep *ep, struct ep_td_struct *td) | ||
701 | { | ||
702 | struct ep_queue_head *qh = get_qh_by_ep(ep); | ||
703 | |||
704 | /* Write dQH next pointer and terminate bit to 0 */ | ||
705 | qh->next_dtd_ptr = cpu_to_hc32(td->td_dma | ||
706 | & EP_QUEUE_HEAD_NEXT_POINTER_MASK); | ||
707 | |||
708 | /* Clear active and halt bit */ | ||
709 | qh->size_ioc_int_sts &= cpu_to_hc32(~(EP_QUEUE_HEAD_STATUS_ACTIVE | ||
710 | | EP_QUEUE_HEAD_STATUS_HALT)); | ||
711 | |||
712 | /* Ensure that updates to the QH will occur before priming. */ | ||
713 | wmb(); | ||
714 | |||
715 | /* Prime endpoint by writing correct bit to ENDPTPRIME */ | ||
716 | fsl_writel(ep_is_in(ep) ? (1 << (ep_index(ep) + 16)) | ||
717 | : (1 << (ep_index(ep))), &dr_regs->endpointprime); | ||
718 | } | ||
719 | |||
720 | /* Add dTD chain to the dQH of an EP */ | ||
700 | static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) | 721 | static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) |
701 | { | 722 | { |
702 | int i = ep_index(ep) * 2 + ep_is_in(ep); | ||
703 | u32 temp, bitmask, tmp_stat; | 723 | u32 temp, bitmask, tmp_stat; |
704 | struct ep_queue_head *dQH = &ep->udc->ep_qh[i]; | ||
705 | 724 | ||
706 | /* VDBG("QH addr Register 0x%8x", dr_regs->endpointlistaddr); | 725 | /* VDBG("QH addr Register 0x%8x", dr_regs->endpointlistaddr); |
707 | VDBG("ep_qh[%d] addr is 0x%8x", i, (u32)&(ep->udc->ep_qh[i])); */ | 726 | VDBG("ep_qh[%d] addr is 0x%8x", i, (u32)&(ep->udc->ep_qh[i])); */ |
@@ -719,7 +738,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) | |||
719 | cpu_to_hc32(req->head->td_dma & DTD_ADDR_MASK); | 738 | cpu_to_hc32(req->head->td_dma & DTD_ADDR_MASK); |
720 | /* Read prime bit, if 1 goto done */ | 739 | /* Read prime bit, if 1 goto done */ |
721 | if (fsl_readl(&dr_regs->endpointprime) & bitmask) | 740 | if (fsl_readl(&dr_regs->endpointprime) & bitmask) |
722 | goto out; | 741 | return; |
723 | 742 | ||
724 | do { | 743 | do { |
725 | /* Set ATDTW bit in USBCMD */ | 744 | /* Set ATDTW bit in USBCMD */ |
@@ -736,28 +755,10 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) | |||
736 | fsl_writel(temp & ~USB_CMD_ATDTW, &dr_regs->usbcmd); | 755 | fsl_writel(temp & ~USB_CMD_ATDTW, &dr_regs->usbcmd); |
737 | 756 | ||
738 | if (tmp_stat) | 757 | if (tmp_stat) |
739 | goto out; | 758 | return; |
740 | } | 759 | } |
741 | 760 | ||
742 | /* Write dQH next pointer and terminate bit to 0 */ | 761 | fsl_prime_ep(ep, req->head); |
743 | temp = req->head->td_dma & EP_QUEUE_HEAD_NEXT_POINTER_MASK; | ||
744 | dQH->next_dtd_ptr = cpu_to_hc32(temp); | ||
745 | |||
746 | /* Clear active and halt bit */ | ||
747 | temp = cpu_to_hc32(~(EP_QUEUE_HEAD_STATUS_ACTIVE | ||
748 | | EP_QUEUE_HEAD_STATUS_HALT)); | ||
749 | dQH->size_ioc_int_sts &= temp; | ||
750 | |||
751 | /* Ensure that updates to the QH will occur before priming. */ | ||
752 | wmb(); | ||
753 | |||
754 | /* Prime endpoint by writing 1 to ENDPTPRIME */ | ||
755 | temp = ep_is_in(ep) | ||
756 | ? (1 << (ep_index(ep) + 16)) | ||
757 | : (1 << (ep_index(ep))); | ||
758 | fsl_writel(temp, &dr_regs->endpointprime); | ||
759 | out: | ||
760 | return; | ||
761 | } | 762 | } |
762 | 763 | ||
763 | /* Fill in the dTD structure | 764 | /* Fill in the dTD structure |
@@ -877,7 +878,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
877 | VDBG("%s, bad ep", __func__); | 878 | VDBG("%s, bad ep", __func__); |
878 | return -EINVAL; | 879 | return -EINVAL; |
879 | } | 880 | } |
880 | if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) { | 881 | if (usb_endpoint_xfer_isoc(ep->desc)) { |
881 | if (req->req.length > ep->ep.maxpacket) | 882 | if (req->req.length > ep->ep.maxpacket) |
882 | return -EMSGSIZE; | 883 | return -EMSGSIZE; |
883 | } | 884 | } |
@@ -973,25 +974,20 @@ static int fsl_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | |||
973 | 974 | ||
974 | /* The request isn't the last request in this ep queue */ | 975 | /* The request isn't the last request in this ep queue */ |
975 | if (req->queue.next != &ep->queue) { | 976 | if (req->queue.next != &ep->queue) { |
976 | struct ep_queue_head *qh; | ||
977 | struct fsl_req *next_req; | 977 | struct fsl_req *next_req; |
978 | 978 | ||
979 | qh = ep->qh; | ||
980 | next_req = list_entry(req->queue.next, struct fsl_req, | 979 | next_req = list_entry(req->queue.next, struct fsl_req, |
981 | queue); | 980 | queue); |
982 | 981 | ||
983 | /* Point the QH to the first TD of next request */ | 982 | /* prime with dTD of next request */ |
984 | fsl_writel((u32) next_req->head, &qh->curr_dtd_ptr); | 983 | fsl_prime_ep(ep, next_req->head); |
985 | } | 984 | } |
986 | 985 | /* The request hasn't been processed, patch up the TD chain */ | |
987 | /* The request hasn't been processed, patch up the TD chain */ | ||
988 | } else { | 986 | } else { |
989 | struct fsl_req *prev_req; | 987 | struct fsl_req *prev_req; |
990 | 988 | ||
991 | prev_req = list_entry(req->queue.prev, struct fsl_req, queue); | 989 | prev_req = list_entry(req->queue.prev, struct fsl_req, queue); |
992 | fsl_writel(fsl_readl(&req->tail->next_td_ptr), | 990 | prev_req->tail->next_td_ptr = req->tail->next_td_ptr; |
993 | &prev_req->tail->next_td_ptr); | ||
994 | |||
995 | } | 991 | } |
996 | 992 | ||
997 | done(ep, req, -ECONNRESET); | 993 | done(ep, req, -ECONNRESET); |
@@ -1032,7 +1028,7 @@ static int fsl_ep_set_halt(struct usb_ep *_ep, int value) | |||
1032 | goto out; | 1028 | goto out; |
1033 | } | 1029 | } |
1034 | 1030 | ||
1035 | if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) { | 1031 | if (usb_endpoint_xfer_isoc(ep->desc)) { |
1036 | status = -EOPNOTSUPP; | 1032 | status = -EOPNOTSUPP; |
1037 | goto out; | 1033 | goto out; |
1038 | } | 1034 | } |
@@ -1068,7 +1064,7 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep) | |||
1068 | struct fsl_udc *udc; | 1064 | struct fsl_udc *udc; |
1069 | int size = 0; | 1065 | int size = 0; |
1070 | u32 bitmask; | 1066 | u32 bitmask; |
1071 | struct ep_queue_head *d_qh; | 1067 | struct ep_queue_head *qh; |
1072 | 1068 | ||
1073 | ep = container_of(_ep, struct fsl_ep, ep); | 1069 | ep = container_of(_ep, struct fsl_ep, ep); |
1074 | if (!_ep || (!ep->desc && ep_index(ep) != 0)) | 1070 | if (!_ep || (!ep->desc && ep_index(ep) != 0)) |
@@ -1079,13 +1075,13 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep) | |||
1079 | if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) | 1075 | if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) |
1080 | return -ESHUTDOWN; | 1076 | return -ESHUTDOWN; |
1081 | 1077 | ||
1082 | d_qh = &ep->udc->ep_qh[ep_index(ep) * 2 + ep_is_in(ep)]; | 1078 | qh = get_qh_by_ep(ep); |
1083 | 1079 | ||
1084 | bitmask = (ep_is_in(ep)) ? (1 << (ep_index(ep) + 16)) : | 1080 | bitmask = (ep_is_in(ep)) ? (1 << (ep_index(ep) + 16)) : |
1085 | (1 << (ep_index(ep))); | 1081 | (1 << (ep_index(ep))); |
1086 | 1082 | ||
1087 | if (fsl_readl(&dr_regs->endptstatus) & bitmask) | 1083 | if (fsl_readl(&dr_regs->endptstatus) & bitmask) |
1088 | size = (d_qh->size_ioc_int_sts & DTD_PACKET_SIZE) | 1084 | size = (qh->size_ioc_int_sts & DTD_PACKET_SIZE) |
1089 | >> DTD_LENGTH_BIT_POS; | 1085 | >> DTD_LENGTH_BIT_POS; |
1090 | 1086 | ||
1091 | pr_debug("%s %u\n", __func__, size); | 1087 | pr_debug("%s %u\n", __func__, size); |
@@ -1938,8 +1934,7 @@ static int fsl_start(struct usb_gadget_driver *driver, | |||
1938 | if (!udc_controller) | 1934 | if (!udc_controller) |
1939 | return -ENODEV; | 1935 | return -ENODEV; |
1940 | 1936 | ||
1941 | if (!driver || (driver->speed != USB_SPEED_FULL | 1937 | if (!driver || driver->speed < USB_SPEED_FULL |
1942 | && driver->speed != USB_SPEED_HIGH) | ||
1943 | || !bind || !driver->disconnect || !driver->setup) | 1938 | || !bind || !driver->disconnect || !driver->setup) |
1944 | return -EINVAL; | 1939 | return -EINVAL; |
1945 | 1940 | ||
diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index 1d51be83fda8..f781f5dec417 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h | |||
@@ -569,6 +569,16 @@ static void dump_msg(const char *label, const u8 * buf, unsigned int length) | |||
569 | * 2 + ((windex & USB_DIR_IN) ? 1 : 0)) | 569 | * 2 + ((windex & USB_DIR_IN) ? 1 : 0)) |
570 | #define get_pipe_by_ep(EP) (ep_index(EP) * 2 + ep_is_in(EP)) | 570 | #define get_pipe_by_ep(EP) (ep_index(EP) * 2 + ep_is_in(EP)) |
571 | 571 | ||
572 | static inline struct ep_queue_head *get_qh_by_ep(struct fsl_ep *ep) | ||
573 | { | ||
574 | /* we only have one ep0 structure but two queue heads */ | ||
575 | if (ep_index(ep) != 0) | ||
576 | return ep->qh; | ||
577 | else | ||
578 | return &ep->udc->ep_qh[(ep->udc->ep0_dir == | ||
579 | USB_DIR_IN) ? 1 : 0]; | ||
580 | } | ||
581 | |||
572 | struct platform_device; | 582 | struct platform_device; |
573 | #ifdef CONFIG_ARCH_MXC | 583 | #ifdef CONFIG_ARCH_MXC |
574 | int fsl_udc_clk_init(struct platform_device *pdev); | 584 | int fsl_udc_clk_init(struct platform_device *pdev); |
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c index 91d0af2a24a8..9aa1cbbee45b 100644 --- a/drivers/usb/gadget/m66592-udc.c +++ b/drivers/usb/gadget/m66592-udc.c | |||
@@ -1472,7 +1472,7 @@ static int m66592_start(struct usb_gadget_driver *driver, | |||
1472 | int retval; | 1472 | int retval; |
1473 | 1473 | ||
1474 | if (!driver | 1474 | if (!driver |
1475 | || driver->speed != USB_SPEED_HIGH | 1475 | || driver->speed < USB_SPEED_HIGH |
1476 | || !bind | 1476 | || !bind |
1477 | || !driver->setup) | 1477 | || !driver->setup) |
1478 | return -EINVAL; | 1478 | return -EINVAL; |
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index 7f1bc9a73cda..da2b9d0be3ca 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -1881,7 +1881,7 @@ static int net2280_start(struct usb_gadget *_gadget, | |||
1881 | * (dev->usb->xcvrdiag & FORCE_FULL_SPEED_MODE) | 1881 | * (dev->usb->xcvrdiag & FORCE_FULL_SPEED_MODE) |
1882 | * "must not be used in normal operation" | 1882 | * "must not be used in normal operation" |
1883 | */ | 1883 | */ |
1884 | if (!driver || driver->speed != USB_SPEED_HIGH | 1884 | if (!driver || driver->speed < USB_SPEED_HIGH |
1885 | || !driver->setup) | 1885 | || !driver->setup) |
1886 | return -EINVAL; | 1886 | return -EINVAL; |
1887 | 1887 | ||
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 24f84b210ce1..fc719a3f8557 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c | |||
@@ -1746,7 +1746,7 @@ static int r8a66597_start(struct usb_gadget *gadget, | |||
1746 | struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); | 1746 | struct r8a66597 *r8a66597 = gadget_to_r8a66597(gadget); |
1747 | 1747 | ||
1748 | if (!driver | 1748 | if (!driver |
1749 | || driver->speed != USB_SPEED_HIGH | 1749 | || driver->speed < USB_SPEED_HIGH |
1750 | || !driver->setup) | 1750 | || !driver->setup) |
1751 | return -EINVAL; | 1751 | return -EINVAL; |
1752 | if (!r8a66597) | 1752 | if (!r8a66597) |
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index a552453dc946..b31448229f0b 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -2586,10 +2586,8 @@ static int s3c_hsotg_start(struct usb_gadget_driver *driver, | |||
2586 | return -EINVAL; | 2586 | return -EINVAL; |
2587 | } | 2587 | } |
2588 | 2588 | ||
2589 | if (driver->speed != USB_SPEED_HIGH && | 2589 | if (driver->speed < USB_SPEED_FULL) |
2590 | driver->speed != USB_SPEED_FULL) { | ||
2591 | dev_err(hsotg->dev, "%s: bad speed\n", __func__); | 2590 | dev_err(hsotg->dev, "%s: bad speed\n", __func__); |
2592 | } | ||
2593 | 2591 | ||
2594 | if (!bind || !driver->setup) { | 2592 | if (!bind || !driver->setup) { |
2595 | dev_err(hsotg->dev, "%s: missing entry points\n", __func__); | 2593 | dev_err(hsotg->dev, "%s: missing entry points\n", __func__); |
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c index 8d54f893cefe..20a553b46aed 100644 --- a/drivers/usb/gadget/s3c-hsudc.c +++ b/drivers/usb/gadget/s3c-hsudc.c | |||
@@ -1142,8 +1142,7 @@ static int s3c_hsudc_start(struct usb_gadget_driver *driver, | |||
1142 | int ret; | 1142 | int ret; |
1143 | 1143 | ||
1144 | if (!driver | 1144 | if (!driver |
1145 | || (driver->speed != USB_SPEED_FULL && | 1145 | || driver->speed < USB_SPEED_FULL |
1146 | driver->speed != USB_SPEED_HIGH) | ||
1147 | || !bind | 1146 | || !bind |
1148 | || !driver->unbind || !driver->disconnect || !driver->setup) | 1147 | || !driver->unbind || !driver->disconnect || !driver->setup) |
1149 | return -EINVAL; | 1148 | return -EINVAL; |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 56a32033adb3..a60679cbbf85 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1475,6 +1475,7 @@ iso_stream_schedule ( | |||
1475 | * jump until after the queue is primed. | 1475 | * jump until after the queue is primed. |
1476 | */ | 1476 | */ |
1477 | else { | 1477 | else { |
1478 | int done = 0; | ||
1478 | start = SCHEDULE_SLOP + (now & ~0x07); | 1479 | start = SCHEDULE_SLOP + (now & ~0x07); |
1479 | 1480 | ||
1480 | /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */ | 1481 | /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */ |
@@ -1492,18 +1493,18 @@ iso_stream_schedule ( | |||
1492 | if (stream->highspeed) { | 1493 | if (stream->highspeed) { |
1493 | if (itd_slot_ok(ehci, mod, start, | 1494 | if (itd_slot_ok(ehci, mod, start, |
1494 | stream->usecs, period)) | 1495 | stream->usecs, period)) |
1495 | break; | 1496 | done = 1; |
1496 | } else { | 1497 | } else { |
1497 | if ((start % 8) >= 6) | 1498 | if ((start % 8) >= 6) |
1498 | continue; | 1499 | continue; |
1499 | if (sitd_slot_ok(ehci, mod, stream, | 1500 | if (sitd_slot_ok(ehci, mod, stream, |
1500 | start, sched, period)) | 1501 | start, sched, period)) |
1501 | break; | 1502 | done = 1; |
1502 | } | 1503 | } |
1503 | } while (start > next); | 1504 | } while (start > next && !done); |
1504 | 1505 | ||
1505 | /* no room in the schedule */ | 1506 | /* no room in the schedule */ |
1506 | if (start == next) { | 1507 | if (!done) { |
1507 | ehci_dbg(ehci, "iso resched full %p (now %d max %d)\n", | 1508 | ehci_dbg(ehci, "iso resched full %p (now %d max %d)\n", |
1508 | urb, now, now + mod); | 1509 | urb, now, now + mod); |
1509 | status = -ENOSPC; | 1510 | status = -ENOSPC; |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 95a9fec38e89..5df0b0e3392b 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -223,7 +223,7 @@ static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int | |||
223 | if (port < 0 || port >= 2) | 223 | if (port < 0 || port >= 2) |
224 | return; | 224 | return; |
225 | 225 | ||
226 | if (pdata->vbus_pin[port] <= 0) | 226 | if (!gpio_is_valid(pdata->vbus_pin[port])) |
227 | return; | 227 | return; |
228 | 228 | ||
229 | gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable); | 229 | gpio_set_value(pdata->vbus_pin[port], !pdata->vbus_pin_inverted ^ enable); |
@@ -234,7 +234,7 @@ static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) | |||
234 | if (port < 0 || port >= 2) | 234 | if (port < 0 || port >= 2) |
235 | return -EINVAL; | 235 | return -EINVAL; |
236 | 236 | ||
237 | if (pdata->vbus_pin[port] <= 0) | 237 | if (!gpio_is_valid(pdata->vbus_pin[port])) |
238 | return -EINVAL; | 238 | return -EINVAL; |
239 | 239 | ||
240 | return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted; | 240 | return gpio_get_value(pdata->vbus_pin[port]) ^ !pdata->vbus_pin_inverted; |
@@ -465,7 +465,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | |||
465 | 465 | ||
466 | if (pdata) { | 466 | if (pdata) { |
467 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { | 467 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { |
468 | if (pdata->vbus_pin[i] <= 0) | 468 | if (!gpio_is_valid(pdata->vbus_pin[i])) |
469 | continue; | 469 | continue; |
470 | gpio_request(pdata->vbus_pin[i], "ohci_vbus"); | 470 | gpio_request(pdata->vbus_pin[i], "ohci_vbus"); |
471 | ohci_at91_usb_set_power(pdata, i, 1); | 471 | ohci_at91_usb_set_power(pdata, i, 1); |
@@ -474,7 +474,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | |||
474 | for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { | 474 | for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { |
475 | int ret; | 475 | int ret; |
476 | 476 | ||
477 | if (pdata->overcurrent_pin[i] <= 0) | 477 | if (!gpio_is_valid(pdata->overcurrent_pin[i])) |
478 | continue; | 478 | continue; |
479 | gpio_request(pdata->overcurrent_pin[i], "ohci_overcurrent"); | 479 | gpio_request(pdata->overcurrent_pin[i], "ohci_overcurrent"); |
480 | 480 | ||
@@ -499,14 +499,14 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) | |||
499 | 499 | ||
500 | if (pdata) { | 500 | if (pdata) { |
501 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { | 501 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { |
502 | if (pdata->vbus_pin[i] <= 0) | 502 | if (!gpio_is_valid(pdata->vbus_pin[i])) |
503 | continue; | 503 | continue; |
504 | ohci_at91_usb_set_power(pdata, i, 0); | 504 | ohci_at91_usb_set_power(pdata, i, 0); |
505 | gpio_free(pdata->vbus_pin[i]); | 505 | gpio_free(pdata->vbus_pin[i]); |
506 | } | 506 | } |
507 | 507 | ||
508 | for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { | 508 | for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { |
509 | if (pdata->overcurrent_pin[i] <= 0) | 509 | if (!gpio_is_valid(pdata->overcurrent_pin[i])) |
510 | continue; | 510 | continue; |
511 | free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev); | 511 | free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev); |
512 | gpio_free(pdata->overcurrent_pin[i]); | 512 | gpio_free(pdata->overcurrent_pin[i]); |
diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c index d6e175428618..a403b53e86b9 100644 --- a/drivers/usb/host/whci/qset.c +++ b/drivers/usb/host/whci/qset.c | |||
@@ -124,7 +124,7 @@ void qset_clear(struct whc *whc, struct whc_qset *qset) | |||
124 | { | 124 | { |
125 | qset->td_start = qset->td_end = qset->ntds = 0; | 125 | qset->td_start = qset->td_end = qset->ntds = 0; |
126 | 126 | ||
127 | qset->qh.link = cpu_to_le32(QH_LINK_NTDS(8) | QH_LINK_T); | 127 | qset->qh.link = cpu_to_le64(QH_LINK_NTDS(8) | QH_LINK_T); |
128 | qset->qh.status = qset->qh.status & QH_STATUS_SEQ_MASK; | 128 | qset->qh.status = qset->qh.status & QH_STATUS_SEQ_MASK; |
129 | qset->qh.err_count = 0; | 129 | qset->qh.err_count = 0; |
130 | qset->qh.scratch[0] = 0; | 130 | qset->qh.scratch[0] = 0; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index aa94c0195791..a1afb7c39f7e 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -711,7 +711,10 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) | |||
711 | ring = xhci->cmd_ring; | 711 | ring = xhci->cmd_ring; |
712 | seg = ring->deq_seg; | 712 | seg = ring->deq_seg; |
713 | do { | 713 | do { |
714 | memset(seg->trbs, 0, SEGMENT_SIZE); | 714 | memset(seg->trbs, 0, |
715 | sizeof(union xhci_trb) * (TRBS_PER_SEGMENT - 1)); | ||
716 | seg->trbs[TRBS_PER_SEGMENT - 1].link.control &= | ||
717 | cpu_to_le32(~TRB_CYCLE); | ||
715 | seg = seg->next; | 718 | seg = seg->next; |
716 | } while (seg != ring->deq_seg); | 719 | } while (seg != ring->deq_seg); |
717 | 720 | ||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index c1fa12ec7a9a..b63ab1570103 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -2301,18 +2301,12 @@ static int musb_suspend(struct device *dev) | |||
2301 | */ | 2301 | */ |
2302 | } | 2302 | } |
2303 | 2303 | ||
2304 | musb_save_context(musb); | ||
2305 | |||
2306 | spin_unlock_irqrestore(&musb->lock, flags); | 2304 | spin_unlock_irqrestore(&musb->lock, flags); |
2307 | return 0; | 2305 | return 0; |
2308 | } | 2306 | } |
2309 | 2307 | ||
2310 | static int musb_resume_noirq(struct device *dev) | 2308 | static int musb_resume_noirq(struct device *dev) |
2311 | { | 2309 | { |
2312 | struct musb *musb = dev_to_musb(dev); | ||
2313 | |||
2314 | musb_restore_context(musb); | ||
2315 | |||
2316 | /* for static cmos like DaVinci, register values were preserved | 2310 | /* for static cmos like DaVinci, register values were preserved |
2317 | * unless for some reason the whole soc powered down or the USB | 2311 | * unless for some reason the whole soc powered down or the USB |
2318 | * module got reset through the PSC (vs just being disabled). | 2312 | * module got reset through the PSC (vs just being disabled). |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index d51043acfe1a..922148ff8d29 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -1903,7 +1903,7 @@ static int musb_gadget_start(struct usb_gadget *g, | |||
1903 | unsigned long flags; | 1903 | unsigned long flags; |
1904 | int retval = -EINVAL; | 1904 | int retval = -EINVAL; |
1905 | 1905 | ||
1906 | if (driver->speed != USB_SPEED_HIGH) | 1906 | if (driver->speed < USB_SPEED_HIGH) |
1907 | goto err0; | 1907 | goto err0; |
1908 | 1908 | ||
1909 | pm_runtime_get_sync(musb->controller); | 1909 | pm_runtime_get_sync(musb->controller); |
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index d9717e0bc1ff..7f4e80338570 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c | |||
@@ -751,53 +751,32 @@ static int usbhsg_gadget_start(struct usb_gadget *gadget, | |||
751 | struct usb_gadget_driver *driver) | 751 | struct usb_gadget_driver *driver) |
752 | { | 752 | { |
753 | struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); | 753 | struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); |
754 | struct usbhs_priv *priv; | 754 | struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); |
755 | struct device *dev; | ||
756 | int ret; | ||
757 | 755 | ||
758 | if (!driver || | 756 | if (!driver || |
759 | !driver->setup || | 757 | !driver->setup || |
760 | driver->speed != USB_SPEED_HIGH) | 758 | driver->speed < USB_SPEED_FULL) |
761 | return -EINVAL; | 759 | return -EINVAL; |
762 | 760 | ||
763 | dev = usbhsg_gpriv_to_dev(gpriv); | ||
764 | priv = usbhsg_gpriv_to_priv(gpriv); | ||
765 | |||
766 | /* first hook up the driver ... */ | 761 | /* first hook up the driver ... */ |
767 | gpriv->driver = driver; | 762 | gpriv->driver = driver; |
768 | gpriv->gadget.dev.driver = &driver->driver; | 763 | gpriv->gadget.dev.driver = &driver->driver; |
769 | 764 | ||
770 | ret = device_add(&gpriv->gadget.dev); | ||
771 | if (ret) { | ||
772 | dev_err(dev, "device_add error %d\n", ret); | ||
773 | goto add_fail; | ||
774 | } | ||
775 | |||
776 | return usbhsg_try_start(priv, USBHSG_STATUS_REGISTERD); | 765 | return usbhsg_try_start(priv, USBHSG_STATUS_REGISTERD); |
777 | |||
778 | add_fail: | ||
779 | gpriv->driver = NULL; | ||
780 | gpriv->gadget.dev.driver = NULL; | ||
781 | |||
782 | return ret; | ||
783 | } | 766 | } |
784 | 767 | ||
785 | static int usbhsg_gadget_stop(struct usb_gadget *gadget, | 768 | static int usbhsg_gadget_stop(struct usb_gadget *gadget, |
786 | struct usb_gadget_driver *driver) | 769 | struct usb_gadget_driver *driver) |
787 | { | 770 | { |
788 | struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); | 771 | struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget); |
789 | struct usbhs_priv *priv; | 772 | struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); |
790 | struct device *dev; | ||
791 | 773 | ||
792 | if (!driver || | 774 | if (!driver || |
793 | !driver->unbind) | 775 | !driver->unbind) |
794 | return -EINVAL; | 776 | return -EINVAL; |
795 | 777 | ||
796 | dev = usbhsg_gpriv_to_dev(gpriv); | ||
797 | priv = usbhsg_gpriv_to_priv(gpriv); | ||
798 | |||
799 | usbhsg_try_stop(priv, USBHSG_STATUS_REGISTERD); | 778 | usbhsg_try_stop(priv, USBHSG_STATUS_REGISTERD); |
800 | device_del(&gpriv->gadget.dev); | 779 | gpriv->gadget.dev.driver = NULL; |
801 | gpriv->driver = NULL; | 780 | gpriv->driver = NULL; |
802 | 781 | ||
803 | return 0; | 782 | return 0; |
@@ -827,6 +806,13 @@ static int usbhsg_start(struct usbhs_priv *priv) | |||
827 | 806 | ||
828 | static int usbhsg_stop(struct usbhs_priv *priv) | 807 | static int usbhsg_stop(struct usbhs_priv *priv) |
829 | { | 808 | { |
809 | struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); | ||
810 | |||
811 | /* cable disconnect */ | ||
812 | if (gpriv->driver && | ||
813 | gpriv->driver->disconnect) | ||
814 | gpriv->driver->disconnect(&gpriv->gadget); | ||
815 | |||
830 | return usbhsg_try_stop(priv, USBHSG_STATUS_STARTED); | 816 | return usbhsg_try_stop(priv, USBHSG_STATUS_STARTED); |
831 | } | 817 | } |
832 | 818 | ||
@@ -876,12 +862,14 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) | |||
876 | /* | 862 | /* |
877 | * init gadget | 863 | * init gadget |
878 | */ | 864 | */ |
879 | device_initialize(&gpriv->gadget.dev); | ||
880 | dev_set_name(&gpriv->gadget.dev, "gadget"); | 865 | dev_set_name(&gpriv->gadget.dev, "gadget"); |
881 | gpriv->gadget.dev.parent = dev; | 866 | gpriv->gadget.dev.parent = dev; |
882 | gpriv->gadget.name = "renesas_usbhs_udc"; | 867 | gpriv->gadget.name = "renesas_usbhs_udc"; |
883 | gpriv->gadget.ops = &usbhsg_gadget_ops; | 868 | gpriv->gadget.ops = &usbhsg_gadget_ops; |
884 | gpriv->gadget.is_dualspeed = 1; | 869 | gpriv->gadget.is_dualspeed = 1; |
870 | ret = device_register(&gpriv->gadget.dev); | ||
871 | if (ret < 0) | ||
872 | goto err_add_udc; | ||
885 | 873 | ||
886 | INIT_LIST_HEAD(&gpriv->gadget.ep_list); | 874 | INIT_LIST_HEAD(&gpriv->gadget.ep_list); |
887 | 875 | ||
@@ -912,12 +900,15 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) | |||
912 | 900 | ||
913 | ret = usb_add_gadget_udc(dev, &gpriv->gadget); | 901 | ret = usb_add_gadget_udc(dev, &gpriv->gadget); |
914 | if (ret) | 902 | if (ret) |
915 | goto err_add_udc; | 903 | goto err_register; |
916 | 904 | ||
917 | 905 | ||
918 | dev_info(dev, "gadget probed\n"); | 906 | dev_info(dev, "gadget probed\n"); |
919 | 907 | ||
920 | return 0; | 908 | return 0; |
909 | |||
910 | err_register: | ||
911 | device_unregister(&gpriv->gadget.dev); | ||
921 | err_add_udc: | 912 | err_add_udc: |
922 | kfree(gpriv->uep); | 913 | kfree(gpriv->uep); |
923 | 914 | ||
@@ -933,6 +924,8 @@ void usbhs_mod_gadget_remove(struct usbhs_priv *priv) | |||
933 | 924 | ||
934 | usb_del_gadget_udc(&gpriv->gadget); | 925 | usb_del_gadget_udc(&gpriv->gadget); |
935 | 926 | ||
927 | device_unregister(&gpriv->gadget.dev); | ||
928 | |||
936 | usbhsg_controller_unregister(gpriv); | 929 | usbhsg_controller_unregister(gpriv); |
937 | 930 | ||
938 | kfree(gpriv->uep); | 931 | kfree(gpriv->uep); |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index bd4298bb6750..ff3db5d056a5 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -736,6 +736,7 @@ static struct usb_device_id id_table_combined [] = { | |||
736 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, | 736 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, |
737 | { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, | 737 | { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, |
738 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, | 738 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, |
739 | { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, | ||
739 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), | 740 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), |
740 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 741 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
741 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), | 742 | { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 571fa96b49c7..055b64ef0bba 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -112,6 +112,7 @@ | |||
112 | 112 | ||
113 | /* Propox devices */ | 113 | /* Propox devices */ |
114 | #define FTDI_PROPOX_JTAGCABLEII_PID 0xD738 | 114 | #define FTDI_PROPOX_JTAGCABLEII_PID 0xD738 |
115 | #define FTDI_PROPOX_ISPCABLEIII_PID 0xD739 | ||
115 | 116 | ||
116 | /* Lenz LI-USB Computer Interface. */ | 117 | /* Lenz LI-USB Computer Interface. */ |
117 | #define FTDI_LENZ_LIUSB_PID 0xD780 | 118 | #define FTDI_LENZ_LIUSB_PID 0xD780 |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index d865878c9f97..e3426602dc82 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -661,6 +661,9 @@ static const struct usb_device_id option_ids[] = { | |||
661 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4511, 0xff, 0x01, 0x31) }, | 661 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4511, 0xff, 0x01, 0x31) }, |
662 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4511, 0xff, 0x01, 0x32) }, | 662 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4511, 0xff, 0x01, 0x32) }, |
663 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) }, | 663 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) }, |
664 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x02) }, | ||
665 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x03) }, | ||
666 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x08) }, | ||
664 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, | 667 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, |
665 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, | 668 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, |
666 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, | 669 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, |
@@ -747,6 +750,7 @@ static const struct usb_device_id option_ids[] = { | |||
747 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, | 750 | { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, |
748 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ | 751 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ |
749 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ | 752 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
753 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ | ||
750 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ | 754 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ |
751 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) }, | 755 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) }, |
752 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, | 756 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 3041a974faf3..24caba79d722 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1854,6 +1854,13 @@ UNUSUAL_DEV( 0x1370, 0x6828, 0x0110, 0x0110, | |||
1854 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1854 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1855 | US_FL_IGNORE_RESIDUE ), | 1855 | US_FL_IGNORE_RESIDUE ), |
1856 | 1856 | ||
1857 | /* Reported by Qinglin Ye <yestyle@gmail.com> */ | ||
1858 | UNUSUAL_DEV( 0x13fe, 0x3600, 0x0100, 0x0100, | ||
1859 | "Kingston", | ||
1860 | "DT 101 G2", | ||
1861 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
1862 | US_FL_BULK_IGNORE_TAG ), | ||
1863 | |||
1857 | /* Reported by Francesco Foresti <frafore@tiscali.it> */ | 1864 | /* Reported by Francesco Foresti <frafore@tiscali.it> */ |
1858 | UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, | 1865 | UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x0201, |
1859 | "Super Top", | 1866 | "Super Top", |
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index 87445b2d72a7..00562566ef5f 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c | |||
@@ -35,6 +35,11 @@ | |||
35 | 35 | ||
36 | #define DRV_NAME "AT91SAM9 Watchdog" | 36 | #define DRV_NAME "AT91SAM9 Watchdog" |
37 | 37 | ||
38 | #define wdt_read(field) \ | ||
39 | __raw_readl(at91wdt_private.base + field) | ||
40 | #define wdt_write(field, val) \ | ||
41 | __raw_writel((val), at91wdt_private.base + field) | ||
42 | |||
38 | /* AT91SAM9 watchdog runs a 12bit counter @ 256Hz, | 43 | /* AT91SAM9 watchdog runs a 12bit counter @ 256Hz, |
39 | * use this to convert a watchdog | 44 | * use this to convert a watchdog |
40 | * value from/to milliseconds. | 45 | * value from/to milliseconds. |
@@ -63,6 +68,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | |||
63 | static void at91_ping(unsigned long data); | 68 | static void at91_ping(unsigned long data); |
64 | 69 | ||
65 | static struct { | 70 | static struct { |
71 | void __iomem *base; | ||
66 | unsigned long next_heartbeat; /* the next_heartbeat for the timer */ | 72 | unsigned long next_heartbeat; /* the next_heartbeat for the timer */ |
67 | unsigned long open; | 73 | unsigned long open; |
68 | char expect_close; | 74 | char expect_close; |
@@ -77,7 +83,7 @@ static struct { | |||
77 | */ | 83 | */ |
78 | static inline void at91_wdt_reset(void) | 84 | static inline void at91_wdt_reset(void) |
79 | { | 85 | { |
80 | at91_sys_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT); | 86 | wdt_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT); |
81 | } | 87 | } |
82 | 88 | ||
83 | /* | 89 | /* |
@@ -132,7 +138,7 @@ static int at91_wdt_settimeout(unsigned int timeout) | |||
132 | unsigned int mr; | 138 | unsigned int mr; |
133 | 139 | ||
134 | /* Check if disabled */ | 140 | /* Check if disabled */ |
135 | mr = at91_sys_read(AT91_WDT_MR); | 141 | mr = wdt_read(AT91_WDT_MR); |
136 | if (mr & AT91_WDT_WDDIS) { | 142 | if (mr & AT91_WDT_WDDIS) { |
137 | printk(KERN_ERR DRV_NAME": sorry, watchdog is disabled\n"); | 143 | printk(KERN_ERR DRV_NAME": sorry, watchdog is disabled\n"); |
138 | return -EIO; | 144 | return -EIO; |
@@ -149,7 +155,7 @@ static int at91_wdt_settimeout(unsigned int timeout) | |||
149 | | AT91_WDT_WDDBGHLT /* disabled in debug mode */ | 155 | | AT91_WDT_WDDBGHLT /* disabled in debug mode */ |
150 | | AT91_WDT_WDD /* restart at any time */ | 156 | | AT91_WDT_WDD /* restart at any time */ |
151 | | (timeout & AT91_WDT_WDV); /* timer value */ | 157 | | (timeout & AT91_WDT_WDV); /* timer value */ |
152 | at91_sys_write(AT91_WDT_MR, reg); | 158 | wdt_write(AT91_WDT_MR, reg); |
153 | 159 | ||
154 | return 0; | 160 | return 0; |
155 | } | 161 | } |
@@ -248,12 +254,22 @@ static struct miscdevice at91wdt_miscdev = { | |||
248 | 254 | ||
249 | static int __init at91wdt_probe(struct platform_device *pdev) | 255 | static int __init at91wdt_probe(struct platform_device *pdev) |
250 | { | 256 | { |
257 | struct resource *r; | ||
251 | int res; | 258 | int res; |
252 | 259 | ||
253 | if (at91wdt_miscdev.parent) | 260 | if (at91wdt_miscdev.parent) |
254 | return -EBUSY; | 261 | return -EBUSY; |
255 | at91wdt_miscdev.parent = &pdev->dev; | 262 | at91wdt_miscdev.parent = &pdev->dev; |
256 | 263 | ||
264 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
265 | if (!r) | ||
266 | return -ENODEV; | ||
267 | at91wdt_private.base = ioremap(r->start, resource_size(r)); | ||
268 | if (!at91wdt_private.base) { | ||
269 | dev_err(&pdev->dev, "failed to map registers, aborting.\n"); | ||
270 | return -ENOMEM; | ||
271 | } | ||
272 | |||
257 | /* Set watchdog */ | 273 | /* Set watchdog */ |
258 | res = at91_wdt_settimeout(ms_to_ticks(WDT_HW_TIMEOUT * 1000)); | 274 | res = at91_wdt_settimeout(ms_to_ticks(WDT_HW_TIMEOUT * 1000)); |
259 | if (res) | 275 | if (res) |
diff --git a/drivers/watchdog/at91sam9_wdt.h b/drivers/watchdog/at91sam9_wdt.h index 757f9cab5c82..c6fbb2e6c41b 100644 --- a/drivers/watchdog/at91sam9_wdt.h +++ b/drivers/watchdog/at91sam9_wdt.h | |||
@@ -16,11 +16,11 @@ | |||
16 | #ifndef AT91_WDT_H | 16 | #ifndef AT91_WDT_H |
17 | #define AT91_WDT_H | 17 | #define AT91_WDT_H |
18 | 18 | ||
19 | #define AT91_WDT_CR (AT91_WDT + 0x00) /* Watchdog Control Register */ | 19 | #define AT91_WDT_CR 0x00 /* Watchdog Control Register */ |
20 | #define AT91_WDT_WDRSTT (1 << 0) /* Restart */ | 20 | #define AT91_WDT_WDRSTT (1 << 0) /* Restart */ |
21 | #define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */ | 21 | #define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */ |
22 | 22 | ||
23 | #define AT91_WDT_MR (AT91_WDT + 0x04) /* Watchdog Mode Register */ | 23 | #define AT91_WDT_MR 0x04 /* Watchdog Mode Register */ |
24 | #define AT91_WDT_WDV (0xfff << 0) /* Counter Value */ | 24 | #define AT91_WDT_WDV (0xfff << 0) /* Counter Value */ |
25 | #define AT91_WDT_WDFIEN (1 << 12) /* Fault Interrupt Enable */ | 25 | #define AT91_WDT_WDFIEN (1 << 12) /* Fault Interrupt Enable */ |
26 | #define AT91_WDT_WDRSTEN (1 << 13) /* Reset Processor */ | 26 | #define AT91_WDT_WDRSTEN (1 << 13) /* Reset Processor */ |
@@ -30,7 +30,7 @@ | |||
30 | #define AT91_WDT_WDDBGHLT (1 << 28) /* Debug Halt */ | 30 | #define AT91_WDT_WDDBGHLT (1 << 28) /* Debug Halt */ |
31 | #define AT91_WDT_WDIDLEHLT (1 << 29) /* Idle Halt */ | 31 | #define AT91_WDT_WDIDLEHLT (1 << 29) /* Idle Halt */ |
32 | 32 | ||
33 | #define AT91_WDT_SR (AT91_WDT + 0x08) /* Watchdog Status Register */ | 33 | #define AT91_WDT_SR 0x08 /* Watchdog Status Register */ |
34 | #define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */ | 34 | #define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */ |
35 | #define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */ | 35 | #define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */ |
36 | 36 | ||
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f0d5718d2587..2ad813674d77 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -5107,11 +5107,11 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, | |||
5107 | struct btrfs_root *root = orig_root->fs_info->extent_root; | 5107 | struct btrfs_root *root = orig_root->fs_info->extent_root; |
5108 | struct btrfs_free_cluster *last_ptr = NULL; | 5108 | struct btrfs_free_cluster *last_ptr = NULL; |
5109 | struct btrfs_block_group_cache *block_group = NULL; | 5109 | struct btrfs_block_group_cache *block_group = NULL; |
5110 | struct btrfs_block_group_cache *used_block_group; | ||
5110 | int empty_cluster = 2 * 1024 * 1024; | 5111 | int empty_cluster = 2 * 1024 * 1024; |
5111 | int allowed_chunk_alloc = 0; | 5112 | int allowed_chunk_alloc = 0; |
5112 | int done_chunk_alloc = 0; | 5113 | int done_chunk_alloc = 0; |
5113 | struct btrfs_space_info *space_info; | 5114 | struct btrfs_space_info *space_info; |
5114 | int last_ptr_loop = 0; | ||
5115 | int loop = 0; | 5115 | int loop = 0; |
5116 | int index = 0; | 5116 | int index = 0; |
5117 | int alloc_type = (data & BTRFS_BLOCK_GROUP_DATA) ? | 5117 | int alloc_type = (data & BTRFS_BLOCK_GROUP_DATA) ? |
@@ -5173,6 +5173,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, | |||
5173 | ideal_cache: | 5173 | ideal_cache: |
5174 | block_group = btrfs_lookup_block_group(root->fs_info, | 5174 | block_group = btrfs_lookup_block_group(root->fs_info, |
5175 | search_start); | 5175 | search_start); |
5176 | used_block_group = block_group; | ||
5176 | /* | 5177 | /* |
5177 | * we don't want to use the block group if it doesn't match our | 5178 | * we don't want to use the block group if it doesn't match our |
5178 | * allocation bits, or if its not cached. | 5179 | * allocation bits, or if its not cached. |
@@ -5210,6 +5211,7 @@ search: | |||
5210 | u64 offset; | 5211 | u64 offset; |
5211 | int cached; | 5212 | int cached; |
5212 | 5213 | ||
5214 | used_block_group = block_group; | ||
5213 | btrfs_get_block_group(block_group); | 5215 | btrfs_get_block_group(block_group); |
5214 | search_start = block_group->key.objectid; | 5216 | search_start = block_group->key.objectid; |
5215 | 5217 | ||
@@ -5286,71 +5288,62 @@ alloc: | |||
5286 | spin_unlock(&block_group->free_space_ctl->tree_lock); | 5288 | spin_unlock(&block_group->free_space_ctl->tree_lock); |
5287 | 5289 | ||
5288 | /* | 5290 | /* |
5289 | * Ok we want to try and use the cluster allocator, so lets look | 5291 | * Ok we want to try and use the cluster allocator, so |
5290 | * there, unless we are on LOOP_NO_EMPTY_SIZE, since we will | 5292 | * lets look there |
5291 | * have tried the cluster allocator plenty of times at this | ||
5292 | * point and not have found anything, so we are likely way too | ||
5293 | * fragmented for the clustering stuff to find anything, so lets | ||
5294 | * just skip it and let the allocator find whatever block it can | ||
5295 | * find | ||
5296 | */ | 5293 | */ |
5297 | if (last_ptr && loop < LOOP_NO_EMPTY_SIZE) { | 5294 | if (last_ptr) { |
5298 | /* | 5295 | /* |
5299 | * the refill lock keeps out other | 5296 | * the refill lock keeps out other |
5300 | * people trying to start a new cluster | 5297 | * people trying to start a new cluster |
5301 | */ | 5298 | */ |
5302 | spin_lock(&last_ptr->refill_lock); | 5299 | spin_lock(&last_ptr->refill_lock); |
5303 | if (!last_ptr->block_group || | 5300 | used_block_group = last_ptr->block_group; |
5304 | last_ptr->block_group->ro || | 5301 | if (used_block_group != block_group && |
5305 | !block_group_bits(last_ptr->block_group, data)) | 5302 | (!used_block_group || |
5303 | used_block_group->ro || | ||
5304 | !block_group_bits(used_block_group, data))) { | ||
5305 | used_block_group = block_group; | ||
5306 | goto refill_cluster; | 5306 | goto refill_cluster; |
5307 | } | ||
5308 | |||
5309 | if (used_block_group != block_group) | ||
5310 | btrfs_get_block_group(used_block_group); | ||
5307 | 5311 | ||
5308 | offset = btrfs_alloc_from_cluster(block_group, last_ptr, | 5312 | offset = btrfs_alloc_from_cluster(used_block_group, |
5309 | num_bytes, search_start); | 5313 | last_ptr, num_bytes, used_block_group->key.objectid); |
5310 | if (offset) { | 5314 | if (offset) { |
5311 | /* we have a block, we're done */ | 5315 | /* we have a block, we're done */ |
5312 | spin_unlock(&last_ptr->refill_lock); | 5316 | spin_unlock(&last_ptr->refill_lock); |
5313 | goto checks; | 5317 | goto checks; |
5314 | } | 5318 | } |
5315 | 5319 | ||
5316 | spin_lock(&last_ptr->lock); | 5320 | WARN_ON(last_ptr->block_group != used_block_group); |
5317 | /* | 5321 | if (used_block_group != block_group) { |
5318 | * whoops, this cluster doesn't actually point to | 5322 | btrfs_put_block_group(used_block_group); |
5319 | * this block group. Get a ref on the block | 5323 | used_block_group = block_group; |
5320 | * group is does point to and try again | ||
5321 | */ | ||
5322 | if (!last_ptr_loop && last_ptr->block_group && | ||
5323 | last_ptr->block_group != block_group && | ||
5324 | index <= | ||
5325 | get_block_group_index(last_ptr->block_group)) { | ||
5326 | |||
5327 | btrfs_put_block_group(block_group); | ||
5328 | block_group = last_ptr->block_group; | ||
5329 | btrfs_get_block_group(block_group); | ||
5330 | spin_unlock(&last_ptr->lock); | ||
5331 | spin_unlock(&last_ptr->refill_lock); | ||
5332 | |||
5333 | last_ptr_loop = 1; | ||
5334 | search_start = block_group->key.objectid; | ||
5335 | /* | ||
5336 | * we know this block group is properly | ||
5337 | * in the list because | ||
5338 | * btrfs_remove_block_group, drops the | ||
5339 | * cluster before it removes the block | ||
5340 | * group from the list | ||
5341 | */ | ||
5342 | goto have_block_group; | ||
5343 | } | 5324 | } |
5344 | spin_unlock(&last_ptr->lock); | ||
5345 | refill_cluster: | 5325 | refill_cluster: |
5326 | BUG_ON(used_block_group != block_group); | ||
5327 | /* If we are on LOOP_NO_EMPTY_SIZE, we can't | ||
5328 | * set up a new clusters, so lets just skip it | ||
5329 | * and let the allocator find whatever block | ||
5330 | * it can find. If we reach this point, we | ||
5331 | * will have tried the cluster allocator | ||
5332 | * plenty of times and not have found | ||
5333 | * anything, so we are likely way too | ||
5334 | * fragmented for the clustering stuff to find | ||
5335 | * anything. */ | ||
5336 | if (loop >= LOOP_NO_EMPTY_SIZE) { | ||
5337 | spin_unlock(&last_ptr->refill_lock); | ||
5338 | goto unclustered_alloc; | ||
5339 | } | ||
5340 | |||
5346 | /* | 5341 | /* |
5347 | * this cluster didn't work out, free it and | 5342 | * this cluster didn't work out, free it and |
5348 | * start over | 5343 | * start over |
5349 | */ | 5344 | */ |
5350 | btrfs_return_cluster_to_free_space(NULL, last_ptr); | 5345 | btrfs_return_cluster_to_free_space(NULL, last_ptr); |
5351 | 5346 | ||
5352 | last_ptr_loop = 0; | ||
5353 | |||
5354 | /* allocate a cluster in this block group */ | 5347 | /* allocate a cluster in this block group */ |
5355 | ret = btrfs_find_space_cluster(trans, root, | 5348 | ret = btrfs_find_space_cluster(trans, root, |
5356 | block_group, last_ptr, | 5349 | block_group, last_ptr, |
@@ -5390,6 +5383,7 @@ refill_cluster: | |||
5390 | goto loop; | 5383 | goto loop; |
5391 | } | 5384 | } |
5392 | 5385 | ||
5386 | unclustered_alloc: | ||
5393 | offset = btrfs_find_space_for_alloc(block_group, search_start, | 5387 | offset = btrfs_find_space_for_alloc(block_group, search_start, |
5394 | num_bytes, empty_size); | 5388 | num_bytes, empty_size); |
5395 | /* | 5389 | /* |
@@ -5416,14 +5410,14 @@ checks: | |||
5416 | search_start = stripe_align(root, offset); | 5410 | search_start = stripe_align(root, offset); |
5417 | /* move on to the next group */ | 5411 | /* move on to the next group */ |
5418 | if (search_start + num_bytes >= search_end) { | 5412 | if (search_start + num_bytes >= search_end) { |
5419 | btrfs_add_free_space(block_group, offset, num_bytes); | 5413 | btrfs_add_free_space(used_block_group, offset, num_bytes); |
5420 | goto loop; | 5414 | goto loop; |
5421 | } | 5415 | } |
5422 | 5416 | ||
5423 | /* move on to the next group */ | 5417 | /* move on to the next group */ |
5424 | if (search_start + num_bytes > | 5418 | if (search_start + num_bytes > |
5425 | block_group->key.objectid + block_group->key.offset) { | 5419 | used_block_group->key.objectid + used_block_group->key.offset) { |
5426 | btrfs_add_free_space(block_group, offset, num_bytes); | 5420 | btrfs_add_free_space(used_block_group, offset, num_bytes); |
5427 | goto loop; | 5421 | goto loop; |
5428 | } | 5422 | } |
5429 | 5423 | ||
@@ -5431,14 +5425,14 @@ checks: | |||
5431 | ins->offset = num_bytes; | 5425 | ins->offset = num_bytes; |
5432 | 5426 | ||
5433 | if (offset < search_start) | 5427 | if (offset < search_start) |
5434 | btrfs_add_free_space(block_group, offset, | 5428 | btrfs_add_free_space(used_block_group, offset, |
5435 | search_start - offset); | 5429 | search_start - offset); |
5436 | BUG_ON(offset > search_start); | 5430 | BUG_ON(offset > search_start); |
5437 | 5431 | ||
5438 | ret = btrfs_update_reserved_bytes(block_group, num_bytes, | 5432 | ret = btrfs_update_reserved_bytes(used_block_group, num_bytes, |
5439 | alloc_type); | 5433 | alloc_type); |
5440 | if (ret == -EAGAIN) { | 5434 | if (ret == -EAGAIN) { |
5441 | btrfs_add_free_space(block_group, offset, num_bytes); | 5435 | btrfs_add_free_space(used_block_group, offset, num_bytes); |
5442 | goto loop; | 5436 | goto loop; |
5443 | } | 5437 | } |
5444 | 5438 | ||
@@ -5447,15 +5441,19 @@ checks: | |||
5447 | ins->offset = num_bytes; | 5441 | ins->offset = num_bytes; |
5448 | 5442 | ||
5449 | if (offset < search_start) | 5443 | if (offset < search_start) |
5450 | btrfs_add_free_space(block_group, offset, | 5444 | btrfs_add_free_space(used_block_group, offset, |
5451 | search_start - offset); | 5445 | search_start - offset); |
5452 | BUG_ON(offset > search_start); | 5446 | BUG_ON(offset > search_start); |
5447 | if (used_block_group != block_group) | ||
5448 | btrfs_put_block_group(used_block_group); | ||
5453 | btrfs_put_block_group(block_group); | 5449 | btrfs_put_block_group(block_group); |
5454 | break; | 5450 | break; |
5455 | loop: | 5451 | loop: |
5456 | failed_cluster_refill = false; | 5452 | failed_cluster_refill = false; |
5457 | failed_alloc = false; | 5453 | failed_alloc = false; |
5458 | BUG_ON(index != get_block_group_index(block_group)); | 5454 | BUG_ON(index != get_block_group_index(block_group)); |
5455 | if (used_block_group != block_group) | ||
5456 | btrfs_put_block_group(used_block_group); | ||
5459 | btrfs_put_block_group(block_group); | 5457 | btrfs_put_block_group(block_group); |
5460 | } | 5458 | } |
5461 | up_read(&space_info->groups_sem); | 5459 | up_read(&space_info->groups_sem); |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index be1bf627a14b..49f3c9dc09f4 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -935,8 +935,10 @@ again: | |||
935 | node = tree_search(tree, start); | 935 | node = tree_search(tree, start); |
936 | if (!node) { | 936 | if (!node) { |
937 | prealloc = alloc_extent_state_atomic(prealloc); | 937 | prealloc = alloc_extent_state_atomic(prealloc); |
938 | if (!prealloc) | 938 | if (!prealloc) { |
939 | return -ENOMEM; | 939 | err = -ENOMEM; |
940 | goto out; | ||
941 | } | ||
940 | err = insert_state(tree, prealloc, start, end, &bits); | 942 | err = insert_state(tree, prealloc, start, end, &bits); |
941 | prealloc = NULL; | 943 | prealloc = NULL; |
942 | BUG_ON(err == -EEXIST); | 944 | BUG_ON(err == -EEXIST); |
@@ -992,8 +994,10 @@ hit_next: | |||
992 | */ | 994 | */ |
993 | if (state->start < start) { | 995 | if (state->start < start) { |
994 | prealloc = alloc_extent_state_atomic(prealloc); | 996 | prealloc = alloc_extent_state_atomic(prealloc); |
995 | if (!prealloc) | 997 | if (!prealloc) { |
996 | return -ENOMEM; | 998 | err = -ENOMEM; |
999 | goto out; | ||
1000 | } | ||
997 | err = split_state(tree, state, prealloc, start); | 1001 | err = split_state(tree, state, prealloc, start); |
998 | BUG_ON(err == -EEXIST); | 1002 | BUG_ON(err == -EEXIST); |
999 | prealloc = NULL; | 1003 | prealloc = NULL; |
@@ -1024,8 +1028,10 @@ hit_next: | |||
1024 | this_end = last_start - 1; | 1028 | this_end = last_start - 1; |
1025 | 1029 | ||
1026 | prealloc = alloc_extent_state_atomic(prealloc); | 1030 | prealloc = alloc_extent_state_atomic(prealloc); |
1027 | if (!prealloc) | 1031 | if (!prealloc) { |
1028 | return -ENOMEM; | 1032 | err = -ENOMEM; |
1033 | goto out; | ||
1034 | } | ||
1029 | 1035 | ||
1030 | /* | 1036 | /* |
1031 | * Avoid to free 'prealloc' if it can be merged with | 1037 | * Avoid to free 'prealloc' if it can be merged with |
@@ -1051,8 +1057,10 @@ hit_next: | |||
1051 | */ | 1057 | */ |
1052 | if (state->start <= end && state->end > end) { | 1058 | if (state->start <= end && state->end > end) { |
1053 | prealloc = alloc_extent_state_atomic(prealloc); | 1059 | prealloc = alloc_extent_state_atomic(prealloc); |
1054 | if (!prealloc) | 1060 | if (!prealloc) { |
1055 | return -ENOMEM; | 1061 | err = -ENOMEM; |
1062 | goto out; | ||
1063 | } | ||
1056 | 1064 | ||
1057 | err = split_state(tree, state, prealloc, end + 1); | 1065 | err = split_state(tree, state, prealloc, end + 1); |
1058 | BUG_ON(err == -EEXIST); | 1066 | BUG_ON(err == -EEXIST); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c37433d3cd82..0a8c8f8304b1 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1611,7 +1611,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1611 | if ((sb->s_flags & MS_RDONLY) && !root->fs_info->fs_devices->seeding) | 1611 | if ((sb->s_flags & MS_RDONLY) && !root->fs_info->fs_devices->seeding) |
1612 | return -EINVAL; | 1612 | return -EINVAL; |
1613 | 1613 | ||
1614 | bdev = blkdev_get_by_path(device_path, FMODE_EXCL, | 1614 | bdev = blkdev_get_by_path(device_path, FMODE_WRITE | FMODE_EXCL, |
1615 | root->fs_info->bdev_holder); | 1615 | root->fs_info->bdev_holder); |
1616 | if (IS_ERR(bdev)) | 1616 | if (IS_ERR(bdev)) |
1617 | return PTR_ERR(bdev); | 1617 | return PTR_ERR(bdev); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index d6a972df0338..8cd4b52d4217 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -441,6 +441,8 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, struct kvec *iov_orig, | |||
441 | smb_msg.msg_controllen = 0; | 441 | smb_msg.msg_controllen = 0; |
442 | 442 | ||
443 | for (total_read = 0; to_read; total_read += length, to_read -= length) { | 443 | for (total_read = 0; to_read; total_read += length, to_read -= length) { |
444 | try_to_freeze(); | ||
445 | |||
444 | if (server_unresponsive(server)) { | 446 | if (server_unresponsive(server)) { |
445 | total_read = -EAGAIN; | 447 | total_read = -EAGAIN; |
446 | break; | 448 | break; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index cf0b1539b321..4dd9283885e7 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -702,6 +702,13 @@ cifs_find_lock_conflict(struct cifsInodeInfo *cinode, struct cifsLockInfo *lock, | |||
702 | lock->type, lock->netfid, conf_lock); | 702 | lock->type, lock->netfid, conf_lock); |
703 | } | 703 | } |
704 | 704 | ||
705 | /* | ||
706 | * Check if there is another lock that prevents us to set the lock (mandatory | ||
707 | * style). If such a lock exists, update the flock structure with its | ||
708 | * properties. Otherwise, set the flock type to F_UNLCK if we can cache brlocks | ||
709 | * or leave it the same if we can't. Returns 0 if we don't need to request to | ||
710 | * the server or 1 otherwise. | ||
711 | */ | ||
705 | static int | 712 | static int |
706 | cifs_lock_test(struct cifsInodeInfo *cinode, __u64 offset, __u64 length, | 713 | cifs_lock_test(struct cifsInodeInfo *cinode, __u64 offset, __u64 length, |
707 | __u8 type, __u16 netfid, struct file_lock *flock) | 714 | __u8 type, __u16 netfid, struct file_lock *flock) |
@@ -739,6 +746,12 @@ cifs_lock_add(struct cifsInodeInfo *cinode, struct cifsLockInfo *lock) | |||
739 | mutex_unlock(&cinode->lock_mutex); | 746 | mutex_unlock(&cinode->lock_mutex); |
740 | } | 747 | } |
741 | 748 | ||
749 | /* | ||
750 | * Set the byte-range lock (mandatory style). Returns: | ||
751 | * 1) 0, if we set the lock and don't need to request to the server; | ||
752 | * 2) 1, if no locks prevent us but we need to request to the server; | ||
753 | * 3) -EACCESS, if there is a lock that prevents us and wait is false. | ||
754 | */ | ||
742 | static int | 755 | static int |
743 | cifs_lock_add_if(struct cifsInodeInfo *cinode, struct cifsLockInfo *lock, | 756 | cifs_lock_add_if(struct cifsInodeInfo *cinode, struct cifsLockInfo *lock, |
744 | bool wait) | 757 | bool wait) |
@@ -778,6 +791,13 @@ try_again: | |||
778 | return rc; | 791 | return rc; |
779 | } | 792 | } |
780 | 793 | ||
794 | /* | ||
795 | * Check if there is another lock that prevents us to set the lock (posix | ||
796 | * style). If such a lock exists, update the flock structure with its | ||
797 | * properties. Otherwise, set the flock type to F_UNLCK if we can cache brlocks | ||
798 | * or leave it the same if we can't. Returns 0 if we don't need to request to | ||
799 | * the server or 1 otherwise. | ||
800 | */ | ||
781 | static int | 801 | static int |
782 | cifs_posix_lock_test(struct file *file, struct file_lock *flock) | 802 | cifs_posix_lock_test(struct file *file, struct file_lock *flock) |
783 | { | 803 | { |
@@ -800,6 +820,12 @@ cifs_posix_lock_test(struct file *file, struct file_lock *flock) | |||
800 | return rc; | 820 | return rc; |
801 | } | 821 | } |
802 | 822 | ||
823 | /* | ||
824 | * Set the byte-range lock (posix style). Returns: | ||
825 | * 1) 0, if we set the lock and don't need to request to the server; | ||
826 | * 2) 1, if we need to request to the server; | ||
827 | * 3) <0, if the error occurs while setting the lock. | ||
828 | */ | ||
803 | static int | 829 | static int |
804 | cifs_posix_lock_set(struct file *file, struct file_lock *flock) | 830 | cifs_posix_lock_set(struct file *file, struct file_lock *flock) |
805 | { | 831 | { |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 5de03ec20144..a090bbe6ee29 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -554,7 +554,10 @@ static int find_cifs_entry(const int xid, struct cifs_tcon *pTcon, | |||
554 | rc); | 554 | rc); |
555 | return rc; | 555 | return rc; |
556 | } | 556 | } |
557 | cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile); | 557 | /* FindFirst/Next set last_entry to NULL on malformed reply */ |
558 | if (cifsFile->srch_inf.last_entry) | ||
559 | cifs_save_resume_key(cifsFile->srch_inf.last_entry, | ||
560 | cifsFile); | ||
558 | } | 561 | } |
559 | 562 | ||
560 | while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && | 563 | while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && |
@@ -562,7 +565,10 @@ static int find_cifs_entry(const int xid, struct cifs_tcon *pTcon, | |||
562 | cFYI(1, "calling findnext2"); | 565 | cFYI(1, "calling findnext2"); |
563 | rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, | 566 | rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, |
564 | &cifsFile->srch_inf); | 567 | &cifsFile->srch_inf); |
565 | cifs_save_resume_key(cifsFile->srch_inf.last_entry, cifsFile); | 568 | /* FindFirst/Next set last_entry to NULL on malformed reply */ |
569 | if (cifsFile->srch_inf.last_entry) | ||
570 | cifs_save_resume_key(cifsFile->srch_inf.last_entry, | ||
571 | cifsFile); | ||
566 | if (rc) | 572 | if (rc) |
567 | return -ENOENT; | 573 | return -ENOENT; |
568 | } | 574 | } |
diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c index 7cacba12b8f1..80d850881938 100644 --- a/fs/cifs/smbencrypt.c +++ b/fs/cifs/smbencrypt.c | |||
@@ -209,7 +209,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16, | |||
209 | { | 209 | { |
210 | int rc; | 210 | int rc; |
211 | int len; | 211 | int len; |
212 | __u16 wpwd[129]; | 212 | __le16 wpwd[129]; |
213 | 213 | ||
214 | /* Password cannot be longer than 128 characters */ | 214 | /* Password cannot be longer than 128 characters */ |
215 | if (passwd) /* Password must be converted to NT unicode */ | 215 | if (passwd) /* Password must be converted to NT unicode */ |
@@ -219,8 +219,8 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16, | |||
219 | *wpwd = 0; /* Ensure string is null terminated */ | 219 | *wpwd = 0; /* Ensure string is null terminated */ |
220 | } | 220 | } |
221 | 221 | ||
222 | rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__u16)); | 222 | rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16)); |
223 | memset(wpwd, 0, 129 * sizeof(__u16)); | 223 | memset(wpwd, 0, 129 * sizeof(__le16)); |
224 | 224 | ||
225 | return rc; | 225 | return rc; |
226 | } | 226 | } |
diff --git a/fs/dcache.c b/fs/dcache.c index 10ba92def3f6..89509b5a090e 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -2439,16 +2439,14 @@ static int prepend_name(char **buffer, int *buflen, struct qstr *name) | |||
2439 | /** | 2439 | /** |
2440 | * prepend_path - Prepend path string to a buffer | 2440 | * prepend_path - Prepend path string to a buffer |
2441 | * @path: the dentry/vfsmount to report | 2441 | * @path: the dentry/vfsmount to report |
2442 | * @root: root vfsmnt/dentry (may be modified by this function) | 2442 | * @root: root vfsmnt/dentry |
2443 | * @buffer: pointer to the end of the buffer | 2443 | * @buffer: pointer to the end of the buffer |
2444 | * @buflen: pointer to buffer length | 2444 | * @buflen: pointer to buffer length |
2445 | * | 2445 | * |
2446 | * Caller holds the rename_lock. | 2446 | * Caller holds the rename_lock. |
2447 | * | ||
2448 | * If path is not reachable from the supplied root, then the value of | ||
2449 | * root is changed (without modifying refcounts). | ||
2450 | */ | 2447 | */ |
2451 | static int prepend_path(const struct path *path, struct path *root, | 2448 | static int prepend_path(const struct path *path, |
2449 | const struct path *root, | ||
2452 | char **buffer, int *buflen) | 2450 | char **buffer, int *buflen) |
2453 | { | 2451 | { |
2454 | struct dentry *dentry = path->dentry; | 2452 | struct dentry *dentry = path->dentry; |
@@ -2483,10 +2481,10 @@ static int prepend_path(const struct path *path, struct path *root, | |||
2483 | dentry = parent; | 2481 | dentry = parent; |
2484 | } | 2482 | } |
2485 | 2483 | ||
2486 | out: | ||
2487 | if (!error && !slash) | 2484 | if (!error && !slash) |
2488 | error = prepend(buffer, buflen, "/", 1); | 2485 | error = prepend(buffer, buflen, "/", 1); |
2489 | 2486 | ||
2487 | out: | ||
2490 | br_read_unlock(vfsmount_lock); | 2488 | br_read_unlock(vfsmount_lock); |
2491 | return error; | 2489 | return error; |
2492 | 2490 | ||
@@ -2500,15 +2498,17 @@ global_root: | |||
2500 | WARN(1, "Root dentry has weird name <%.*s>\n", | 2498 | WARN(1, "Root dentry has weird name <%.*s>\n", |
2501 | (int) dentry->d_name.len, dentry->d_name.name); | 2499 | (int) dentry->d_name.len, dentry->d_name.name); |
2502 | } | 2500 | } |
2503 | root->mnt = vfsmnt; | 2501 | if (!slash) |
2504 | root->dentry = dentry; | 2502 | error = prepend(buffer, buflen, "/", 1); |
2503 | if (!error) | ||
2504 | error = vfsmnt->mnt_ns ? 1 : 2; | ||
2505 | goto out; | 2505 | goto out; |
2506 | } | 2506 | } |
2507 | 2507 | ||
2508 | /** | 2508 | /** |
2509 | * __d_path - return the path of a dentry | 2509 | * __d_path - return the path of a dentry |
2510 | * @path: the dentry/vfsmount to report | 2510 | * @path: the dentry/vfsmount to report |
2511 | * @root: root vfsmnt/dentry (may be modified by this function) | 2511 | * @root: root vfsmnt/dentry |
2512 | * @buf: buffer to return value in | 2512 | * @buf: buffer to return value in |
2513 | * @buflen: buffer length | 2513 | * @buflen: buffer length |
2514 | * | 2514 | * |
@@ -2519,10 +2519,10 @@ global_root: | |||
2519 | * | 2519 | * |
2520 | * "buflen" should be positive. | 2520 | * "buflen" should be positive. |
2521 | * | 2521 | * |
2522 | * If path is not reachable from the supplied root, then the value of | 2522 | * If the path is not reachable from the supplied root, return %NULL. |
2523 | * root is changed (without modifying refcounts). | ||
2524 | */ | 2523 | */ |
2525 | char *__d_path(const struct path *path, struct path *root, | 2524 | char *__d_path(const struct path *path, |
2525 | const struct path *root, | ||
2526 | char *buf, int buflen) | 2526 | char *buf, int buflen) |
2527 | { | 2527 | { |
2528 | char *res = buf + buflen; | 2528 | char *res = buf + buflen; |
@@ -2533,7 +2533,28 @@ char *__d_path(const struct path *path, struct path *root, | |||
2533 | error = prepend_path(path, root, &res, &buflen); | 2533 | error = prepend_path(path, root, &res, &buflen); |
2534 | write_sequnlock(&rename_lock); | 2534 | write_sequnlock(&rename_lock); |
2535 | 2535 | ||
2536 | if (error) | 2536 | if (error < 0) |
2537 | return ERR_PTR(error); | ||
2538 | if (error > 0) | ||
2539 | return NULL; | ||
2540 | return res; | ||
2541 | } | ||
2542 | |||
2543 | char *d_absolute_path(const struct path *path, | ||
2544 | char *buf, int buflen) | ||
2545 | { | ||
2546 | struct path root = {}; | ||
2547 | char *res = buf + buflen; | ||
2548 | int error; | ||
2549 | |||
2550 | prepend(&res, &buflen, "\0", 1); | ||
2551 | write_seqlock(&rename_lock); | ||
2552 | error = prepend_path(path, &root, &res, &buflen); | ||
2553 | write_sequnlock(&rename_lock); | ||
2554 | |||
2555 | if (error > 1) | ||
2556 | error = -EINVAL; | ||
2557 | if (error < 0) | ||
2537 | return ERR_PTR(error); | 2558 | return ERR_PTR(error); |
2538 | return res; | 2559 | return res; |
2539 | } | 2560 | } |
@@ -2541,8 +2562,9 @@ char *__d_path(const struct path *path, struct path *root, | |||
2541 | /* | 2562 | /* |
2542 | * same as __d_path but appends "(deleted)" for unlinked files. | 2563 | * same as __d_path but appends "(deleted)" for unlinked files. |
2543 | */ | 2564 | */ |
2544 | static int path_with_deleted(const struct path *path, struct path *root, | 2565 | static int path_with_deleted(const struct path *path, |
2545 | char **buf, int *buflen) | 2566 | const struct path *root, |
2567 | char **buf, int *buflen) | ||
2546 | { | 2568 | { |
2547 | prepend(buf, buflen, "\0", 1); | 2569 | prepend(buf, buflen, "\0", 1); |
2548 | if (d_unlinked(path->dentry)) { | 2570 | if (d_unlinked(path->dentry)) { |
@@ -2579,7 +2601,6 @@ char *d_path(const struct path *path, char *buf, int buflen) | |||
2579 | { | 2601 | { |
2580 | char *res = buf + buflen; | 2602 | char *res = buf + buflen; |
2581 | struct path root; | 2603 | struct path root; |
2582 | struct path tmp; | ||
2583 | int error; | 2604 | int error; |
2584 | 2605 | ||
2585 | /* | 2606 | /* |
@@ -2594,9 +2615,8 @@ char *d_path(const struct path *path, char *buf, int buflen) | |||
2594 | 2615 | ||
2595 | get_fs_root(current->fs, &root); | 2616 | get_fs_root(current->fs, &root); |
2596 | write_seqlock(&rename_lock); | 2617 | write_seqlock(&rename_lock); |
2597 | tmp = root; | 2618 | error = path_with_deleted(path, &root, &res, &buflen); |
2598 | error = path_with_deleted(path, &tmp, &res, &buflen); | 2619 | if (error < 0) |
2599 | if (error) | ||
2600 | res = ERR_PTR(error); | 2620 | res = ERR_PTR(error); |
2601 | write_sequnlock(&rename_lock); | 2621 | write_sequnlock(&rename_lock); |
2602 | path_put(&root); | 2622 | path_put(&root); |
@@ -2617,7 +2637,6 @@ char *d_path_with_unreachable(const struct path *path, char *buf, int buflen) | |||
2617 | { | 2637 | { |
2618 | char *res = buf + buflen; | 2638 | char *res = buf + buflen; |
2619 | struct path root; | 2639 | struct path root; |
2620 | struct path tmp; | ||
2621 | int error; | 2640 | int error; |
2622 | 2641 | ||
2623 | if (path->dentry->d_op && path->dentry->d_op->d_dname) | 2642 | if (path->dentry->d_op && path->dentry->d_op->d_dname) |
@@ -2625,9 +2644,8 @@ char *d_path_with_unreachable(const struct path *path, char *buf, int buflen) | |||
2625 | 2644 | ||
2626 | get_fs_root(current->fs, &root); | 2645 | get_fs_root(current->fs, &root); |
2627 | write_seqlock(&rename_lock); | 2646 | write_seqlock(&rename_lock); |
2628 | tmp = root; | 2647 | error = path_with_deleted(path, &root, &res, &buflen); |
2629 | error = path_with_deleted(path, &tmp, &res, &buflen); | 2648 | if (error > 0) |
2630 | if (!error && !path_equal(&tmp, &root)) | ||
2631 | error = prepend_unreachable(&res, &buflen); | 2649 | error = prepend_unreachable(&res, &buflen); |
2632 | write_sequnlock(&rename_lock); | 2650 | write_sequnlock(&rename_lock); |
2633 | path_put(&root); | 2651 | path_put(&root); |
@@ -2758,19 +2776,18 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size) | |||
2758 | write_seqlock(&rename_lock); | 2776 | write_seqlock(&rename_lock); |
2759 | if (!d_unlinked(pwd.dentry)) { | 2777 | if (!d_unlinked(pwd.dentry)) { |
2760 | unsigned long len; | 2778 | unsigned long len; |
2761 | struct path tmp = root; | ||
2762 | char *cwd = page + PAGE_SIZE; | 2779 | char *cwd = page + PAGE_SIZE; |
2763 | int buflen = PAGE_SIZE; | 2780 | int buflen = PAGE_SIZE; |
2764 | 2781 | ||
2765 | prepend(&cwd, &buflen, "\0", 1); | 2782 | prepend(&cwd, &buflen, "\0", 1); |
2766 | error = prepend_path(&pwd, &tmp, &cwd, &buflen); | 2783 | error = prepend_path(&pwd, &root, &cwd, &buflen); |
2767 | write_sequnlock(&rename_lock); | 2784 | write_sequnlock(&rename_lock); |
2768 | 2785 | ||
2769 | if (error) | 2786 | if (error < 0) |
2770 | goto out; | 2787 | goto out; |
2771 | 2788 | ||
2772 | /* Unreachable from current root */ | 2789 | /* Unreachable from current root */ |
2773 | if (!path_equal(&tmp, &root)) { | 2790 | if (error > 0) { |
2774 | error = prepend_unreachable(&cwd, &buflen); | 2791 | error = prepend_unreachable(&cwd, &buflen); |
2775 | if (error) | 2792 | if (error) |
2776 | goto out; | 2793 | goto out; |
diff --git a/fs/namespace.c b/fs/namespace.c index 6d3a1963879b..cfc6d4448aa5 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -1048,15 +1048,12 @@ static int show_mountinfo(struct seq_file *m, void *v) | |||
1048 | if (err) | 1048 | if (err) |
1049 | goto out; | 1049 | goto out; |
1050 | seq_putc(m, ' '); | 1050 | seq_putc(m, ' '); |
1051 | seq_path_root(m, &mnt_path, &root, " \t\n\\"); | 1051 | |
1052 | if (root.mnt != p->root.mnt || root.dentry != p->root.dentry) { | 1052 | /* mountpoints outside of chroot jail will give SEQ_SKIP on this */ |
1053 | /* | 1053 | err = seq_path_root(m, &mnt_path, &root, " \t\n\\"); |
1054 | * Mountpoint is outside root, discard that one. Ugly, | 1054 | if (err) |
1055 | * but less so than trying to do that in iterator in a | 1055 | goto out; |
1056 | * race-free way (due to renames). | 1056 | |
1057 | */ | ||
1058 | return SEQ_SKIP; | ||
1059 | } | ||
1060 | seq_puts(m, mnt->mnt_flags & MNT_READONLY ? " ro" : " rw"); | 1057 | seq_puts(m, mnt->mnt_flags & MNT_READONLY ? " ro" : " rw"); |
1061 | show_mnt_opts(m, mnt); | 1058 | show_mnt_opts(m, mnt); |
1062 | 1059 | ||
@@ -2776,3 +2773,8 @@ void kern_unmount(struct vfsmount *mnt) | |||
2776 | } | 2773 | } |
2777 | } | 2774 | } |
2778 | EXPORT_SYMBOL(kern_unmount); | 2775 | EXPORT_SYMBOL(kern_unmount); |
2776 | |||
2777 | bool our_mnt(struct vfsmount *mnt) | ||
2778 | { | ||
2779 | return check_mnt(mnt); | ||
2780 | } | ||
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c index 586174168e2a..80e4645f7990 100644 --- a/fs/proc/meminfo.c +++ b/fs/proc/meminfo.c | |||
@@ -131,12 +131,13 @@ static int meminfo_proc_show(struct seq_file *m, void *v) | |||
131 | K(i.freeswap), | 131 | K(i.freeswap), |
132 | K(global_page_state(NR_FILE_DIRTY)), | 132 | K(global_page_state(NR_FILE_DIRTY)), |
133 | K(global_page_state(NR_WRITEBACK)), | 133 | K(global_page_state(NR_WRITEBACK)), |
134 | K(global_page_state(NR_ANON_PAGES) | ||
135 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 134 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
135 | K(global_page_state(NR_ANON_PAGES) | ||
136 | + global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * | 136 | + global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * |
137 | HPAGE_PMD_NR | 137 | HPAGE_PMD_NR), |
138 | #else | ||
139 | K(global_page_state(NR_ANON_PAGES)), | ||
138 | #endif | 140 | #endif |
139 | ), | ||
140 | K(global_page_state(NR_FILE_MAPPED)), | 141 | K(global_page_state(NR_FILE_MAPPED)), |
141 | K(global_page_state(NR_SHMEM)), | 142 | K(global_page_state(NR_SHMEM)), |
142 | K(global_page_state(NR_SLAB_RECLAIMABLE) + | 143 | K(global_page_state(NR_SLAB_RECLAIMABLE) + |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 42b274da92c3..2a30d67dd6b8 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -32,7 +32,7 @@ static cputime64_t get_idle_time(int cpu) | |||
32 | idle = kstat_cpu(cpu).cpustat.idle; | 32 | idle = kstat_cpu(cpu).cpustat.idle; |
33 | idle = cputime64_add(idle, arch_idle_time(cpu)); | 33 | idle = cputime64_add(idle, arch_idle_time(cpu)); |
34 | } else | 34 | } else |
35 | idle = usecs_to_cputime(idle_time); | 35 | idle = nsecs_to_jiffies64(1000 * idle_time); |
36 | 36 | ||
37 | return idle; | 37 | return idle; |
38 | } | 38 | } |
@@ -46,7 +46,7 @@ static cputime64_t get_iowait_time(int cpu) | |||
46 | /* !NO_HZ so we can rely on cpustat.iowait */ | 46 | /* !NO_HZ so we can rely on cpustat.iowait */ |
47 | iowait = kstat_cpu(cpu).cpustat.iowait; | 47 | iowait = kstat_cpu(cpu).cpustat.iowait; |
48 | else | 48 | else |
49 | iowait = usecs_to_cputime(iowait_time); | 49 | iowait = nsecs_to_jiffies64(1000 * iowait_time); |
50 | 50 | ||
51 | return iowait; | 51 | return iowait; |
52 | } | 52 | } |
diff --git a/fs/seq_file.c b/fs/seq_file.c index 05d6b0e78c95..dba43c3ea3af 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
@@ -449,8 +449,6 @@ EXPORT_SYMBOL(seq_path); | |||
449 | 449 | ||
450 | /* | 450 | /* |
451 | * Same as seq_path, but relative to supplied root. | 451 | * Same as seq_path, but relative to supplied root. |
452 | * | ||
453 | * root may be changed, see __d_path(). | ||
454 | */ | 452 | */ |
455 | int seq_path_root(struct seq_file *m, struct path *path, struct path *root, | 453 | int seq_path_root(struct seq_file *m, struct path *path, struct path *root, |
456 | char *esc) | 454 | char *esc) |
@@ -463,6 +461,8 @@ int seq_path_root(struct seq_file *m, struct path *path, struct path *root, | |||
463 | char *p; | 461 | char *p; |
464 | 462 | ||
465 | p = __d_path(path, root, buf, size); | 463 | p = __d_path(path, root, buf, size); |
464 | if (!p) | ||
465 | return SEQ_SKIP; | ||
466 | res = PTR_ERR(p); | 466 | res = PTR_ERR(p); |
467 | if (!IS_ERR(p)) { | 467 | if (!IS_ERR(p)) { |
468 | char *end = mangle_path(buf, p, esc); | 468 | char *end = mangle_path(buf, p, esc); |
@@ -474,7 +474,7 @@ int seq_path_root(struct seq_file *m, struct path *path, struct path *root, | |||
474 | } | 474 | } |
475 | seq_commit(m, res); | 475 | seq_commit(m, res); |
476 | 476 | ||
477 | return res < 0 ? res : 0; | 477 | return res < 0 && res != -ENAMETOOLONG ? res : 0; |
478 | } | 478 | } |
479 | 479 | ||
480 | /* | 480 | /* |
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c index b6c4b3795c4a..76e4266d2e7e 100644 --- a/fs/xfs/xfs_acl.c +++ b/fs/xfs/xfs_acl.c | |||
@@ -42,6 +42,8 @@ xfs_acl_from_disk(struct xfs_acl *aclp) | |||
42 | int count, i; | 42 | int count, i; |
43 | 43 | ||
44 | count = be32_to_cpu(aclp->acl_cnt); | 44 | count = be32_to_cpu(aclp->acl_cnt); |
45 | if (count > XFS_ACL_MAX_ENTRIES) | ||
46 | return ERR_PTR(-EFSCORRUPTED); | ||
45 | 47 | ||
46 | acl = posix_acl_alloc(count, GFP_KERNEL); | 48 | acl = posix_acl_alloc(count, GFP_KERNEL); |
47 | if (!acl) | 49 | if (!acl) |
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c index d4906e7c9787..c1b55e596551 100644 --- a/fs/xfs/xfs_attr_leaf.c +++ b/fs/xfs/xfs_attr_leaf.c | |||
@@ -110,6 +110,7 @@ xfs_attr_namesp_match(int arg_flags, int ondisk_flags) | |||
110 | /* | 110 | /* |
111 | * Query whether the requested number of additional bytes of extended | 111 | * Query whether the requested number of additional bytes of extended |
112 | * attribute space will be able to fit inline. | 112 | * attribute space will be able to fit inline. |
113 | * | ||
113 | * Returns zero if not, else the di_forkoff fork offset to be used in the | 114 | * Returns zero if not, else the di_forkoff fork offset to be used in the |
114 | * literal area for attribute data once the new bytes have been added. | 115 | * literal area for attribute data once the new bytes have been added. |
115 | * | 116 | * |
@@ -122,7 +123,7 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes) | |||
122 | int offset; | 123 | int offset; |
123 | int minforkoff; /* lower limit on valid forkoff locations */ | 124 | int minforkoff; /* lower limit on valid forkoff locations */ |
124 | int maxforkoff; /* upper limit on valid forkoff locations */ | 125 | int maxforkoff; /* upper limit on valid forkoff locations */ |
125 | int dsize; | 126 | int dsize; |
126 | xfs_mount_t *mp = dp->i_mount; | 127 | xfs_mount_t *mp = dp->i_mount; |
127 | 128 | ||
128 | offset = (XFS_LITINO(mp) - bytes) >> 3; /* rounded down */ | 129 | offset = (XFS_LITINO(mp) - bytes) >> 3; /* rounded down */ |
@@ -136,47 +137,60 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes) | |||
136 | return (offset >= minforkoff) ? minforkoff : 0; | 137 | return (offset >= minforkoff) ? minforkoff : 0; |
137 | } | 138 | } |
138 | 139 | ||
139 | if (!(mp->m_flags & XFS_MOUNT_ATTR2)) { | 140 | /* |
140 | if (bytes <= XFS_IFORK_ASIZE(dp)) | 141 | * If the requested numbers of bytes is smaller or equal to the |
141 | return dp->i_d.di_forkoff; | 142 | * current attribute fork size we can always proceed. |
143 | * | ||
144 | * Note that if_bytes in the data fork might actually be larger than | ||
145 | * the current data fork size is due to delalloc extents. In that | ||
146 | * case either the extent count will go down when they are converted | ||
147 | * to real extents, or the delalloc conversion will take care of the | ||
148 | * literal area rebalancing. | ||
149 | */ | ||
150 | if (bytes <= XFS_IFORK_ASIZE(dp)) | ||
151 | return dp->i_d.di_forkoff; | ||
152 | |||
153 | /* | ||
154 | * For attr2 we can try to move the forkoff if there is space in the | ||
155 | * literal area, but for the old format we are done if there is no | ||
156 | * space in the fixed attribute fork. | ||
157 | */ | ||
158 | if (!(mp->m_flags & XFS_MOUNT_ATTR2)) | ||
142 | return 0; | 159 | return 0; |
143 | } | ||
144 | 160 | ||
145 | dsize = dp->i_df.if_bytes; | 161 | dsize = dp->i_df.if_bytes; |
146 | 162 | ||
147 | switch (dp->i_d.di_format) { | 163 | switch (dp->i_d.di_format) { |
148 | case XFS_DINODE_FMT_EXTENTS: | 164 | case XFS_DINODE_FMT_EXTENTS: |
149 | /* | 165 | /* |
150 | * If there is no attr fork and the data fork is extents, | 166 | * If there is no attr fork and the data fork is extents, |
151 | * determine if creating the default attr fork will result | 167 | * determine if creating the default attr fork will result |
152 | * in the extents form migrating to btree. If so, the | 168 | * in the extents form migrating to btree. If so, the |
153 | * minimum offset only needs to be the space required for | 169 | * minimum offset only needs to be the space required for |
154 | * the btree root. | 170 | * the btree root. |
155 | */ | 171 | */ |
156 | if (!dp->i_d.di_forkoff && dp->i_df.if_bytes > | 172 | if (!dp->i_d.di_forkoff && dp->i_df.if_bytes > |
157 | xfs_default_attroffset(dp)) | 173 | xfs_default_attroffset(dp)) |
158 | dsize = XFS_BMDR_SPACE_CALC(MINDBTPTRS); | 174 | dsize = XFS_BMDR_SPACE_CALC(MINDBTPTRS); |
159 | break; | 175 | break; |
160 | |||
161 | case XFS_DINODE_FMT_BTREE: | 176 | case XFS_DINODE_FMT_BTREE: |
162 | /* | 177 | /* |
163 | * If have data btree then keep forkoff if we have one, | 178 | * If we have a data btree then keep forkoff if we have one, |
164 | * otherwise we are adding a new attr, so then we set | 179 | * otherwise we are adding a new attr, so then we set |
165 | * minforkoff to where the btree root can finish so we have | 180 | * minforkoff to where the btree root can finish so we have |
166 | * plenty of room for attrs | 181 | * plenty of room for attrs |
167 | */ | 182 | */ |
168 | if (dp->i_d.di_forkoff) { | 183 | if (dp->i_d.di_forkoff) { |
169 | if (offset < dp->i_d.di_forkoff) | 184 | if (offset < dp->i_d.di_forkoff) |
170 | return 0; | 185 | return 0; |
171 | else | 186 | return dp->i_d.di_forkoff; |
172 | return dp->i_d.di_forkoff; | 187 | } |
173 | } else | 188 | dsize = XFS_BMAP_BROOT_SPACE(dp->i_df.if_broot); |
174 | dsize = XFS_BMAP_BROOT_SPACE(dp->i_df.if_broot); | ||
175 | break; | 189 | break; |
176 | } | 190 | } |
177 | 191 | ||
178 | /* | 192 | /* |
179 | * A data fork btree root must have space for at least | 193 | * A data fork btree root must have space for at least |
180 | * MINDBTPTRS key/ptr pairs if the data fork is small or empty. | 194 | * MINDBTPTRS key/ptr pairs if the data fork is small or empty. |
181 | */ | 195 | */ |
182 | minforkoff = MAX(dsize, XFS_BMDR_SPACE_CALC(MINDBTPTRS)); | 196 | minforkoff = MAX(dsize, XFS_BMDR_SPACE_CALC(MINDBTPTRS)); |
@@ -186,10 +200,10 @@ xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes) | |||
186 | maxforkoff = XFS_LITINO(mp) - XFS_BMDR_SPACE_CALC(MINABTPTRS); | 200 | maxforkoff = XFS_LITINO(mp) - XFS_BMDR_SPACE_CALC(MINABTPTRS); |
187 | maxforkoff = maxforkoff >> 3; /* rounded down */ | 201 | maxforkoff = maxforkoff >> 3; /* rounded down */ |
188 | 202 | ||
189 | if (offset >= minforkoff && offset < maxforkoff) | ||
190 | return offset; | ||
191 | if (offset >= maxforkoff) | 203 | if (offset >= maxforkoff) |
192 | return maxforkoff; | 204 | return maxforkoff; |
205 | if (offset >= minforkoff) | ||
206 | return offset; | ||
193 | return 0; | 207 | return 0; |
194 | } | 208 | } |
195 | 209 | ||
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index c68baeb0974a..d0ab78837057 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -2383,6 +2383,8 @@ xfs_bmap_btalloc( | |||
2383 | int tryagain; | 2383 | int tryagain; |
2384 | int error; | 2384 | int error; |
2385 | 2385 | ||
2386 | ASSERT(ap->length); | ||
2387 | |||
2386 | mp = ap->ip->i_mount; | 2388 | mp = ap->ip->i_mount; |
2387 | align = ap->userdata ? xfs_get_extsz_hint(ap->ip) : 0; | 2389 | align = ap->userdata ? xfs_get_extsz_hint(ap->ip) : 0; |
2388 | if (unlikely(align)) { | 2390 | if (unlikely(align)) { |
@@ -4629,6 +4631,8 @@ xfs_bmapi_allocate( | |||
4629 | int error; | 4631 | int error; |
4630 | int rt; | 4632 | int rt; |
4631 | 4633 | ||
4634 | ASSERT(bma->length > 0); | ||
4635 | |||
4632 | rt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(bma->ip); | 4636 | rt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(bma->ip); |
4633 | 4637 | ||
4634 | /* | 4638 | /* |
@@ -4849,6 +4853,7 @@ xfs_bmapi_write( | |||
4849 | ASSERT(*nmap <= XFS_BMAP_MAX_NMAP); | 4853 | ASSERT(*nmap <= XFS_BMAP_MAX_NMAP); |
4850 | ASSERT(!(flags & XFS_BMAPI_IGSTATE)); | 4854 | ASSERT(!(flags & XFS_BMAPI_IGSTATE)); |
4851 | ASSERT(tp != NULL); | 4855 | ASSERT(tp != NULL); |
4856 | ASSERT(len > 0); | ||
4852 | 4857 | ||
4853 | whichfork = (flags & XFS_BMAPI_ATTRFORK) ? | 4858 | whichfork = (flags & XFS_BMAPI_ATTRFORK) ? |
4854 | XFS_ATTR_FORK : XFS_DATA_FORK; | 4859 | XFS_ATTR_FORK : XFS_DATA_FORK; |
@@ -4918,9 +4923,22 @@ xfs_bmapi_write( | |||
4918 | bma.eof = eof; | 4923 | bma.eof = eof; |
4919 | bma.conv = !!(flags & XFS_BMAPI_CONVERT); | 4924 | bma.conv = !!(flags & XFS_BMAPI_CONVERT); |
4920 | bma.wasdel = wasdelay; | 4925 | bma.wasdel = wasdelay; |
4921 | bma.length = len; | ||
4922 | bma.offset = bno; | 4926 | bma.offset = bno; |
4923 | 4927 | ||
4928 | /* | ||
4929 | * There's a 32/64 bit type mismatch between the | ||
4930 | * allocation length request (which can be 64 bits in | ||
4931 | * length) and the bma length request, which is | ||
4932 | * xfs_extlen_t and therefore 32 bits. Hence we have to | ||
4933 | * check for 32-bit overflows and handle them here. | ||
4934 | */ | ||
4935 | if (len > (xfs_filblks_t)MAXEXTLEN) | ||
4936 | bma.length = MAXEXTLEN; | ||
4937 | else | ||
4938 | bma.length = len; | ||
4939 | |||
4940 | ASSERT(len > 0); | ||
4941 | ASSERT(bma.length > 0); | ||
4924 | error = xfs_bmapi_allocate(&bma, flags); | 4942 | error = xfs_bmapi_allocate(&bma, flags); |
4925 | if (error) | 4943 | if (error) |
4926 | goto error0; | 4944 | goto error0; |
diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c index da108977b21f..558910f5e3c0 100644 --- a/fs/xfs/xfs_export.c +++ b/fs/xfs/xfs_export.c | |||
@@ -98,22 +98,22 @@ xfs_fs_encode_fh( | |||
98 | switch (fileid_type) { | 98 | switch (fileid_type) { |
99 | case FILEID_INO32_GEN_PARENT: | 99 | case FILEID_INO32_GEN_PARENT: |
100 | spin_lock(&dentry->d_lock); | 100 | spin_lock(&dentry->d_lock); |
101 | fid->i32.parent_ino = dentry->d_parent->d_inode->i_ino; | 101 | fid->i32.parent_ino = XFS_I(dentry->d_parent->d_inode)->i_ino; |
102 | fid->i32.parent_gen = dentry->d_parent->d_inode->i_generation; | 102 | fid->i32.parent_gen = dentry->d_parent->d_inode->i_generation; |
103 | spin_unlock(&dentry->d_lock); | 103 | spin_unlock(&dentry->d_lock); |
104 | /*FALLTHRU*/ | 104 | /*FALLTHRU*/ |
105 | case FILEID_INO32_GEN: | 105 | case FILEID_INO32_GEN: |
106 | fid->i32.ino = inode->i_ino; | 106 | fid->i32.ino = XFS_I(inode)->i_ino; |
107 | fid->i32.gen = inode->i_generation; | 107 | fid->i32.gen = inode->i_generation; |
108 | break; | 108 | break; |
109 | case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG: | 109 | case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG: |
110 | spin_lock(&dentry->d_lock); | 110 | spin_lock(&dentry->d_lock); |
111 | fid64->parent_ino = dentry->d_parent->d_inode->i_ino; | 111 | fid64->parent_ino = XFS_I(dentry->d_parent->d_inode)->i_ino; |
112 | fid64->parent_gen = dentry->d_parent->d_inode->i_generation; | 112 | fid64->parent_gen = dentry->d_parent->d_inode->i_generation; |
113 | spin_unlock(&dentry->d_lock); | 113 | spin_unlock(&dentry->d_lock); |
114 | /*FALLTHRU*/ | 114 | /*FALLTHRU*/ |
115 | case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG: | 115 | case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG: |
116 | fid64->ino = inode->i_ino; | 116 | fid64->ino = XFS_I(inode)->i_ino; |
117 | fid64->gen = inode->i_generation; | 117 | fid64->gen = inode->i_generation; |
118 | break; | 118 | break; |
119 | } | 119 | } |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index c0237c602f11..755ee8164880 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -2835,6 +2835,27 @@ corrupt_out: | |||
2835 | return XFS_ERROR(EFSCORRUPTED); | 2835 | return XFS_ERROR(EFSCORRUPTED); |
2836 | } | 2836 | } |
2837 | 2837 | ||
2838 | void | ||
2839 | xfs_promote_inode( | ||
2840 | struct xfs_inode *ip) | ||
2841 | { | ||
2842 | struct xfs_buf *bp; | ||
2843 | |||
2844 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); | ||
2845 | |||
2846 | bp = xfs_incore(ip->i_mount->m_ddev_targp, ip->i_imap.im_blkno, | ||
2847 | ip->i_imap.im_len, XBF_TRYLOCK); | ||
2848 | if (!bp) | ||
2849 | return; | ||
2850 | |||
2851 | if (XFS_BUF_ISDELAYWRITE(bp)) { | ||
2852 | xfs_buf_delwri_promote(bp); | ||
2853 | wake_up_process(ip->i_mount->m_ddev_targp->bt_task); | ||
2854 | } | ||
2855 | |||
2856 | xfs_buf_relse(bp); | ||
2857 | } | ||
2858 | |||
2838 | /* | 2859 | /* |
2839 | * Return a pointer to the extent record at file index idx. | 2860 | * Return a pointer to the extent record at file index idx. |
2840 | */ | 2861 | */ |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 760140d1dd66..b4cd4739f98e 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -498,6 +498,7 @@ int xfs_iunlink(struct xfs_trans *, xfs_inode_t *); | |||
498 | void xfs_iext_realloc(xfs_inode_t *, int, int); | 498 | void xfs_iext_realloc(xfs_inode_t *, int, int); |
499 | void xfs_iunpin_wait(xfs_inode_t *); | 499 | void xfs_iunpin_wait(xfs_inode_t *); |
500 | int xfs_iflush(xfs_inode_t *, uint); | 500 | int xfs_iflush(xfs_inode_t *, uint); |
501 | void xfs_promote_inode(struct xfs_inode *); | ||
501 | void xfs_lock_inodes(xfs_inode_t **, int, uint); | 502 | void xfs_lock_inodes(xfs_inode_t **, int, uint); |
502 | void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint); | 503 | void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint); |
503 | 504 | ||
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index a14cd89fe465..34817adf4b9e 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -150,6 +150,117 @@ xlog_grant_add_space( | |||
150 | } while (head_val != old); | 150 | } while (head_val != old); |
151 | } | 151 | } |
152 | 152 | ||
153 | STATIC bool | ||
154 | xlog_reserveq_wake( | ||
155 | struct log *log, | ||
156 | int *free_bytes) | ||
157 | { | ||
158 | struct xlog_ticket *tic; | ||
159 | int need_bytes; | ||
160 | |||
161 | list_for_each_entry(tic, &log->l_reserveq, t_queue) { | ||
162 | if (tic->t_flags & XLOG_TIC_PERM_RESERV) | ||
163 | need_bytes = tic->t_unit_res * tic->t_cnt; | ||
164 | else | ||
165 | need_bytes = tic->t_unit_res; | ||
166 | |||
167 | if (*free_bytes < need_bytes) | ||
168 | return false; | ||
169 | *free_bytes -= need_bytes; | ||
170 | |||
171 | trace_xfs_log_grant_wake_up(log, tic); | ||
172 | wake_up(&tic->t_wait); | ||
173 | } | ||
174 | |||
175 | return true; | ||
176 | } | ||
177 | |||
178 | STATIC bool | ||
179 | xlog_writeq_wake( | ||
180 | struct log *log, | ||
181 | int *free_bytes) | ||
182 | { | ||
183 | struct xlog_ticket *tic; | ||
184 | int need_bytes; | ||
185 | |||
186 | list_for_each_entry(tic, &log->l_writeq, t_queue) { | ||
187 | ASSERT(tic->t_flags & XLOG_TIC_PERM_RESERV); | ||
188 | |||
189 | need_bytes = tic->t_unit_res; | ||
190 | |||
191 | if (*free_bytes < need_bytes) | ||
192 | return false; | ||
193 | *free_bytes -= need_bytes; | ||
194 | |||
195 | trace_xfs_log_regrant_write_wake_up(log, tic); | ||
196 | wake_up(&tic->t_wait); | ||
197 | } | ||
198 | |||
199 | return true; | ||
200 | } | ||
201 | |||
202 | STATIC int | ||
203 | xlog_reserveq_wait( | ||
204 | struct log *log, | ||
205 | struct xlog_ticket *tic, | ||
206 | int need_bytes) | ||
207 | { | ||
208 | list_add_tail(&tic->t_queue, &log->l_reserveq); | ||
209 | |||
210 | do { | ||
211 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
212 | goto shutdown; | ||
213 | xlog_grant_push_ail(log, need_bytes); | ||
214 | |||
215 | XFS_STATS_INC(xs_sleep_logspace); | ||
216 | trace_xfs_log_grant_sleep(log, tic); | ||
217 | |||
218 | xlog_wait(&tic->t_wait, &log->l_grant_reserve_lock); | ||
219 | trace_xfs_log_grant_wake(log, tic); | ||
220 | |||
221 | spin_lock(&log->l_grant_reserve_lock); | ||
222 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
223 | goto shutdown; | ||
224 | } while (xlog_space_left(log, &log->l_grant_reserve_head) < need_bytes); | ||
225 | |||
226 | list_del_init(&tic->t_queue); | ||
227 | return 0; | ||
228 | shutdown: | ||
229 | list_del_init(&tic->t_queue); | ||
230 | return XFS_ERROR(EIO); | ||
231 | } | ||
232 | |||
233 | STATIC int | ||
234 | xlog_writeq_wait( | ||
235 | struct log *log, | ||
236 | struct xlog_ticket *tic, | ||
237 | int need_bytes) | ||
238 | { | ||
239 | list_add_tail(&tic->t_queue, &log->l_writeq); | ||
240 | |||
241 | do { | ||
242 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
243 | goto shutdown; | ||
244 | xlog_grant_push_ail(log, need_bytes); | ||
245 | |||
246 | XFS_STATS_INC(xs_sleep_logspace); | ||
247 | trace_xfs_log_regrant_write_sleep(log, tic); | ||
248 | |||
249 | xlog_wait(&tic->t_wait, &log->l_grant_write_lock); | ||
250 | trace_xfs_log_regrant_write_wake(log, tic); | ||
251 | |||
252 | spin_lock(&log->l_grant_write_lock); | ||
253 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
254 | goto shutdown; | ||
255 | } while (xlog_space_left(log, &log->l_grant_write_head) < need_bytes); | ||
256 | |||
257 | list_del_init(&tic->t_queue); | ||
258 | return 0; | ||
259 | shutdown: | ||
260 | list_del_init(&tic->t_queue); | ||
261 | return XFS_ERROR(EIO); | ||
262 | } | ||
263 | |||
153 | static void | 264 | static void |
154 | xlog_tic_reset_res(xlog_ticket_t *tic) | 265 | xlog_tic_reset_res(xlog_ticket_t *tic) |
155 | { | 266 | { |
@@ -350,8 +461,19 @@ xfs_log_reserve( | |||
350 | retval = xlog_grant_log_space(log, internal_ticket); | 461 | retval = xlog_grant_log_space(log, internal_ticket); |
351 | } | 462 | } |
352 | 463 | ||
464 | if (unlikely(retval)) { | ||
465 | /* | ||
466 | * If we are failing, make sure the ticket doesn't have any | ||
467 | * current reservations. We don't want to add this back | ||
468 | * when the ticket/ transaction gets cancelled. | ||
469 | */ | ||
470 | internal_ticket->t_curr_res = 0; | ||
471 | /* ungrant will give back unit_res * t_cnt. */ | ||
472 | internal_ticket->t_cnt = 0; | ||
473 | } | ||
474 | |||
353 | return retval; | 475 | return retval; |
354 | } /* xfs_log_reserve */ | 476 | } |
355 | 477 | ||
356 | 478 | ||
357 | /* | 479 | /* |
@@ -2481,8 +2603,8 @@ restart: | |||
2481 | /* | 2603 | /* |
2482 | * Atomically get the log space required for a log ticket. | 2604 | * Atomically get the log space required for a log ticket. |
2483 | * | 2605 | * |
2484 | * Once a ticket gets put onto the reserveq, it will only return after | 2606 | * Once a ticket gets put onto the reserveq, it will only return after the |
2485 | * the needed reservation is satisfied. | 2607 | * needed reservation is satisfied. |
2486 | * | 2608 | * |
2487 | * This function is structured so that it has a lock free fast path. This is | 2609 | * This function is structured so that it has a lock free fast path. This is |
2488 | * necessary because every new transaction reservation will come through this | 2610 | * necessary because every new transaction reservation will come through this |
@@ -2490,113 +2612,53 @@ restart: | |||
2490 | * every pass. | 2612 | * every pass. |
2491 | * | 2613 | * |
2492 | * As tickets are only ever moved on and off the reserveq under the | 2614 | * As tickets are only ever moved on and off the reserveq under the |
2493 | * l_grant_reserve_lock, we only need to take that lock if we are going | 2615 | * l_grant_reserve_lock, we only need to take that lock if we are going to add |
2494 | * to add the ticket to the queue and sleep. We can avoid taking the lock if the | 2616 | * the ticket to the queue and sleep. We can avoid taking the lock if the ticket |
2495 | * ticket was never added to the reserveq because the t_queue list head will be | 2617 | * was never added to the reserveq because the t_queue list head will be empty |
2496 | * empty and we hold the only reference to it so it can safely be checked | 2618 | * and we hold the only reference to it so it can safely be checked unlocked. |
2497 | * unlocked. | ||
2498 | */ | 2619 | */ |
2499 | STATIC int | 2620 | STATIC int |
2500 | xlog_grant_log_space(xlog_t *log, | 2621 | xlog_grant_log_space( |
2501 | xlog_ticket_t *tic) | 2622 | struct log *log, |
2623 | struct xlog_ticket *tic) | ||
2502 | { | 2624 | { |
2503 | int free_bytes; | 2625 | int free_bytes, need_bytes; |
2504 | int need_bytes; | 2626 | int error = 0; |
2505 | 2627 | ||
2506 | #ifdef DEBUG | 2628 | ASSERT(!(log->l_flags & XLOG_ACTIVE_RECOVERY)); |
2507 | if (log->l_flags & XLOG_ACTIVE_RECOVERY) | ||
2508 | panic("grant Recovery problem"); | ||
2509 | #endif | ||
2510 | 2629 | ||
2511 | trace_xfs_log_grant_enter(log, tic); | 2630 | trace_xfs_log_grant_enter(log, tic); |
2512 | 2631 | ||
2632 | /* | ||
2633 | * If there are other waiters on the queue then give them a chance at | ||
2634 | * logspace before us. Wake up the first waiters, if we do not wake | ||
2635 | * up all the waiters then go to sleep waiting for more free space, | ||
2636 | * otherwise try to get some space for this transaction. | ||
2637 | */ | ||
2513 | need_bytes = tic->t_unit_res; | 2638 | need_bytes = tic->t_unit_res; |
2514 | if (tic->t_flags & XFS_LOG_PERM_RESERV) | 2639 | if (tic->t_flags & XFS_LOG_PERM_RESERV) |
2515 | need_bytes *= tic->t_ocnt; | 2640 | need_bytes *= tic->t_ocnt; |
2516 | |||
2517 | /* something is already sleeping; insert new transaction at end */ | ||
2518 | if (!list_empty_careful(&log->l_reserveq)) { | ||
2519 | spin_lock(&log->l_grant_reserve_lock); | ||
2520 | /* recheck the queue now we are locked */ | ||
2521 | if (list_empty(&log->l_reserveq)) { | ||
2522 | spin_unlock(&log->l_grant_reserve_lock); | ||
2523 | goto redo; | ||
2524 | } | ||
2525 | list_add_tail(&tic->t_queue, &log->l_reserveq); | ||
2526 | |||
2527 | trace_xfs_log_grant_sleep1(log, tic); | ||
2528 | |||
2529 | /* | ||
2530 | * Gotta check this before going to sleep, while we're | ||
2531 | * holding the grant lock. | ||
2532 | */ | ||
2533 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
2534 | goto error_return; | ||
2535 | |||
2536 | XFS_STATS_INC(xs_sleep_logspace); | ||
2537 | xlog_wait(&tic->t_wait, &log->l_grant_reserve_lock); | ||
2538 | |||
2539 | /* | ||
2540 | * If we got an error, and the filesystem is shutting down, | ||
2541 | * we'll catch it down below. So just continue... | ||
2542 | */ | ||
2543 | trace_xfs_log_grant_wake1(log, tic); | ||
2544 | } | ||
2545 | |||
2546 | redo: | ||
2547 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
2548 | goto error_return_unlocked; | ||
2549 | |||
2550 | free_bytes = xlog_space_left(log, &log->l_grant_reserve_head); | 2641 | free_bytes = xlog_space_left(log, &log->l_grant_reserve_head); |
2551 | if (free_bytes < need_bytes) { | 2642 | if (!list_empty_careful(&log->l_reserveq)) { |
2552 | spin_lock(&log->l_grant_reserve_lock); | 2643 | spin_lock(&log->l_grant_reserve_lock); |
2553 | if (list_empty(&tic->t_queue)) | 2644 | if (!xlog_reserveq_wake(log, &free_bytes) || |
2554 | list_add_tail(&tic->t_queue, &log->l_reserveq); | 2645 | free_bytes < need_bytes) |
2555 | 2646 | error = xlog_reserveq_wait(log, tic, need_bytes); | |
2556 | trace_xfs_log_grant_sleep2(log, tic); | 2647 | spin_unlock(&log->l_grant_reserve_lock); |
2557 | 2648 | } else if (free_bytes < need_bytes) { | |
2558 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
2559 | goto error_return; | ||
2560 | |||
2561 | xlog_grant_push_ail(log, need_bytes); | ||
2562 | |||
2563 | XFS_STATS_INC(xs_sleep_logspace); | ||
2564 | xlog_wait(&tic->t_wait, &log->l_grant_reserve_lock); | ||
2565 | |||
2566 | trace_xfs_log_grant_wake2(log, tic); | ||
2567 | goto redo; | ||
2568 | } | ||
2569 | |||
2570 | if (!list_empty(&tic->t_queue)) { | ||
2571 | spin_lock(&log->l_grant_reserve_lock); | 2649 | spin_lock(&log->l_grant_reserve_lock); |
2572 | list_del_init(&tic->t_queue); | 2650 | error = xlog_reserveq_wait(log, tic, need_bytes); |
2573 | spin_unlock(&log->l_grant_reserve_lock); | 2651 | spin_unlock(&log->l_grant_reserve_lock); |
2574 | } | 2652 | } |
2653 | if (error) | ||
2654 | return error; | ||
2575 | 2655 | ||
2576 | /* we've got enough space */ | ||
2577 | xlog_grant_add_space(log, &log->l_grant_reserve_head, need_bytes); | 2656 | xlog_grant_add_space(log, &log->l_grant_reserve_head, need_bytes); |
2578 | xlog_grant_add_space(log, &log->l_grant_write_head, need_bytes); | 2657 | xlog_grant_add_space(log, &log->l_grant_write_head, need_bytes); |
2579 | trace_xfs_log_grant_exit(log, tic); | 2658 | trace_xfs_log_grant_exit(log, tic); |
2580 | xlog_verify_grant_tail(log); | 2659 | xlog_verify_grant_tail(log); |
2581 | return 0; | 2660 | return 0; |
2582 | 2661 | } | |
2583 | error_return_unlocked: | ||
2584 | spin_lock(&log->l_grant_reserve_lock); | ||
2585 | error_return: | ||
2586 | list_del_init(&tic->t_queue); | ||
2587 | spin_unlock(&log->l_grant_reserve_lock); | ||
2588 | trace_xfs_log_grant_error(log, tic); | ||
2589 | |||
2590 | /* | ||
2591 | * If we are failing, make sure the ticket doesn't have any | ||
2592 | * current reservations. We don't want to add this back when | ||
2593 | * the ticket/transaction gets cancelled. | ||
2594 | */ | ||
2595 | tic->t_curr_res = 0; | ||
2596 | tic->t_cnt = 0; /* ungrant will give back unit_res * t_cnt. */ | ||
2597 | return XFS_ERROR(EIO); | ||
2598 | } /* xlog_grant_log_space */ | ||
2599 | |||
2600 | 2662 | ||
2601 | /* | 2663 | /* |
2602 | * Replenish the byte reservation required by moving the grant write head. | 2664 | * Replenish the byte reservation required by moving the grant write head. |
@@ -2605,10 +2667,12 @@ error_return: | |||
2605 | * free fast path. | 2667 | * free fast path. |
2606 | */ | 2668 | */ |
2607 | STATIC int | 2669 | STATIC int |
2608 | xlog_regrant_write_log_space(xlog_t *log, | 2670 | xlog_regrant_write_log_space( |
2609 | xlog_ticket_t *tic) | 2671 | struct log *log, |
2672 | struct xlog_ticket *tic) | ||
2610 | { | 2673 | { |
2611 | int free_bytes, need_bytes; | 2674 | int free_bytes, need_bytes; |
2675 | int error = 0; | ||
2612 | 2676 | ||
2613 | tic->t_curr_res = tic->t_unit_res; | 2677 | tic->t_curr_res = tic->t_unit_res; |
2614 | xlog_tic_reset_res(tic); | 2678 | xlog_tic_reset_res(tic); |
@@ -2616,104 +2680,38 @@ xlog_regrant_write_log_space(xlog_t *log, | |||
2616 | if (tic->t_cnt > 0) | 2680 | if (tic->t_cnt > 0) |
2617 | return 0; | 2681 | return 0; |
2618 | 2682 | ||
2619 | #ifdef DEBUG | 2683 | ASSERT(!(log->l_flags & XLOG_ACTIVE_RECOVERY)); |
2620 | if (log->l_flags & XLOG_ACTIVE_RECOVERY) | ||
2621 | panic("regrant Recovery problem"); | ||
2622 | #endif | ||
2623 | 2684 | ||
2624 | trace_xfs_log_regrant_write_enter(log, tic); | 2685 | trace_xfs_log_regrant_write_enter(log, tic); |
2625 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
2626 | goto error_return_unlocked; | ||
2627 | 2686 | ||
2628 | /* If there are other waiters on the queue then give them a | 2687 | /* |
2629 | * chance at logspace before us. Wake up the first waiters, | 2688 | * If there are other waiters on the queue then give them a chance at |
2630 | * if we do not wake up all the waiters then go to sleep waiting | 2689 | * logspace before us. Wake up the first waiters, if we do not wake |
2631 | * for more free space, otherwise try to get some space for | 2690 | * up all the waiters then go to sleep waiting for more free space, |
2632 | * this transaction. | 2691 | * otherwise try to get some space for this transaction. |
2633 | */ | 2692 | */ |
2634 | need_bytes = tic->t_unit_res; | 2693 | need_bytes = tic->t_unit_res; |
2635 | if (!list_empty_careful(&log->l_writeq)) { | ||
2636 | struct xlog_ticket *ntic; | ||
2637 | |||
2638 | spin_lock(&log->l_grant_write_lock); | ||
2639 | free_bytes = xlog_space_left(log, &log->l_grant_write_head); | ||
2640 | list_for_each_entry(ntic, &log->l_writeq, t_queue) { | ||
2641 | ASSERT(ntic->t_flags & XLOG_TIC_PERM_RESERV); | ||
2642 | |||
2643 | if (free_bytes < ntic->t_unit_res) | ||
2644 | break; | ||
2645 | free_bytes -= ntic->t_unit_res; | ||
2646 | wake_up(&ntic->t_wait); | ||
2647 | } | ||
2648 | |||
2649 | if (ntic != list_first_entry(&log->l_writeq, | ||
2650 | struct xlog_ticket, t_queue)) { | ||
2651 | if (list_empty(&tic->t_queue)) | ||
2652 | list_add_tail(&tic->t_queue, &log->l_writeq); | ||
2653 | trace_xfs_log_regrant_write_sleep1(log, tic); | ||
2654 | |||
2655 | xlog_grant_push_ail(log, need_bytes); | ||
2656 | |||
2657 | XFS_STATS_INC(xs_sleep_logspace); | ||
2658 | xlog_wait(&tic->t_wait, &log->l_grant_write_lock); | ||
2659 | trace_xfs_log_regrant_write_wake1(log, tic); | ||
2660 | } else | ||
2661 | spin_unlock(&log->l_grant_write_lock); | ||
2662 | } | ||
2663 | |||
2664 | redo: | ||
2665 | if (XLOG_FORCED_SHUTDOWN(log)) | ||
2666 | goto error_return_unlocked; | ||
2667 | |||
2668 | free_bytes = xlog_space_left(log, &log->l_grant_write_head); | 2694 | free_bytes = xlog_space_left(log, &log->l_grant_write_head); |
2669 | if (free_bytes < need_bytes) { | 2695 | if (!list_empty_careful(&log->l_writeq)) { |
2670 | spin_lock(&log->l_grant_write_lock); | 2696 | spin_lock(&log->l_grant_write_lock); |
2671 | if (list_empty(&tic->t_queue)) | 2697 | if (!xlog_writeq_wake(log, &free_bytes) || |
2672 | list_add_tail(&tic->t_queue, &log->l_writeq); | 2698 | free_bytes < need_bytes) |
2673 | 2699 | error = xlog_writeq_wait(log, tic, need_bytes); | |
2674 | if (XLOG_FORCED_SHUTDOWN(log)) | 2700 | spin_unlock(&log->l_grant_write_lock); |
2675 | goto error_return; | 2701 | } else if (free_bytes < need_bytes) { |
2676 | |||
2677 | xlog_grant_push_ail(log, need_bytes); | ||
2678 | |||
2679 | XFS_STATS_INC(xs_sleep_logspace); | ||
2680 | trace_xfs_log_regrant_write_sleep2(log, tic); | ||
2681 | xlog_wait(&tic->t_wait, &log->l_grant_write_lock); | ||
2682 | |||
2683 | trace_xfs_log_regrant_write_wake2(log, tic); | ||
2684 | goto redo; | ||
2685 | } | ||
2686 | |||
2687 | if (!list_empty(&tic->t_queue)) { | ||
2688 | spin_lock(&log->l_grant_write_lock); | 2702 | spin_lock(&log->l_grant_write_lock); |
2689 | list_del_init(&tic->t_queue); | 2703 | error = xlog_writeq_wait(log, tic, need_bytes); |
2690 | spin_unlock(&log->l_grant_write_lock); | 2704 | spin_unlock(&log->l_grant_write_lock); |
2691 | } | 2705 | } |
2692 | 2706 | ||
2693 | /* we've got enough space */ | 2707 | if (error) |
2708 | return error; | ||
2709 | |||
2694 | xlog_grant_add_space(log, &log->l_grant_write_head, need_bytes); | 2710 | xlog_grant_add_space(log, &log->l_grant_write_head, need_bytes); |
2695 | trace_xfs_log_regrant_write_exit(log, tic); | 2711 | trace_xfs_log_regrant_write_exit(log, tic); |
2696 | xlog_verify_grant_tail(log); | 2712 | xlog_verify_grant_tail(log); |
2697 | return 0; | 2713 | return 0; |
2698 | 2714 | } | |
2699 | |||
2700 | error_return_unlocked: | ||
2701 | spin_lock(&log->l_grant_write_lock); | ||
2702 | error_return: | ||
2703 | list_del_init(&tic->t_queue); | ||
2704 | spin_unlock(&log->l_grant_write_lock); | ||
2705 | trace_xfs_log_regrant_write_error(log, tic); | ||
2706 | |||
2707 | /* | ||
2708 | * If we are failing, make sure the ticket doesn't have any | ||
2709 | * current reservations. We don't want to add this back when | ||
2710 | * the ticket/transaction gets cancelled. | ||
2711 | */ | ||
2712 | tic->t_curr_res = 0; | ||
2713 | tic->t_cnt = 0; /* ungrant will give back unit_res * t_cnt. */ | ||
2714 | return XFS_ERROR(EIO); | ||
2715 | } /* xlog_regrant_write_log_space */ | ||
2716 | |||
2717 | 2715 | ||
2718 | /* The first cnt-1 times through here we don't need to | 2716 | /* The first cnt-1 times through here we don't need to |
2719 | * move the grant write head because the permanent | 2717 | * move the grant write head because the permanent |
diff --git a/fs/xfs/xfs_sync.c b/fs/xfs/xfs_sync.c index aa3dc1a4d53d..be5c51d8f757 100644 --- a/fs/xfs/xfs_sync.c +++ b/fs/xfs/xfs_sync.c | |||
@@ -770,6 +770,17 @@ restart: | |||
770 | if (!xfs_iflock_nowait(ip)) { | 770 | if (!xfs_iflock_nowait(ip)) { |
771 | if (!(sync_mode & SYNC_WAIT)) | 771 | if (!(sync_mode & SYNC_WAIT)) |
772 | goto out; | 772 | goto out; |
773 | |||
774 | /* | ||
775 | * If we only have a single dirty inode in a cluster there is | ||
776 | * a fair chance that the AIL push may have pushed it into | ||
777 | * the buffer, but xfsbufd won't touch it until 30 seconds | ||
778 | * from now, and thus we will lock up here. | ||
779 | * | ||
780 | * Promote the inode buffer to the front of the delwri list | ||
781 | * and wake up xfsbufd now. | ||
782 | */ | ||
783 | xfs_promote_inode(ip); | ||
773 | xfs_iflock(ip); | 784 | xfs_iflock(ip); |
774 | } | 785 | } |
775 | 786 | ||
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index f1d2802b2f07..494035798873 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h | |||
@@ -834,18 +834,14 @@ DEFINE_LOGGRANT_EVENT(xfs_log_umount_write); | |||
834 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_enter); | 834 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_enter); |
835 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_exit); | 835 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_exit); |
836 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_error); | 836 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_error); |
837 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep1); | 837 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep); |
838 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake1); | 838 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake); |
839 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep2); | ||
840 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake2); | ||
841 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up); | 839 | DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up); |
842 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_enter); | 840 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_enter); |
843 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_exit); | 841 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_exit); |
844 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_error); | 842 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_error); |
845 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep1); | 843 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep); |
846 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake1); | 844 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake); |
847 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep2); | ||
848 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake2); | ||
849 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake_up); | 845 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake_up); |
850 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter); | 846 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter); |
851 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit); | 847 | DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit); |
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index f4c38d8c6674..2292d1af9d70 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
@@ -685,9 +685,15 @@ __SYSCALL(__NR_syncfs, sys_syncfs) | |||
685 | __SYSCALL(__NR_setns, sys_setns) | 685 | __SYSCALL(__NR_setns, sys_setns) |
686 | #define __NR_sendmmsg 269 | 686 | #define __NR_sendmmsg 269 |
687 | __SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg) | 687 | __SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg) |
688 | #define __NR_process_vm_readv 270 | ||
689 | __SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \ | ||
690 | compat_sys_process_vm_readv) | ||
691 | #define __NR_process_vm_writev 271 | ||
692 | __SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \ | ||
693 | compat_sys_process_vm_writev) | ||
688 | 694 | ||
689 | #undef __NR_syscalls | 695 | #undef __NR_syscalls |
690 | #define __NR_syscalls 270 | 696 | #define __NR_syscalls 272 |
691 | 697 | ||
692 | /* | 698 | /* |
693 | * All syscalls below here should go away really, | 699 | * All syscalls below here should go away really, |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index f81676f1b310..4e4fbb820e20 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -197,6 +197,14 @@ | |||
197 | {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 197 | {0x1002, 0x6770, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
198 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 198 | {0x1002, 0x6778, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
199 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ | 199 | {0x1002, 0x6779, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAICOS|RADEON_NEW_MEMMAP}, \ |
200 | {0x1002, 0x6840, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
201 | {0x1002, 0x6841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
202 | {0x1002, 0x6842, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
203 | {0x1002, 0x6843, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
204 | {0x1002, 0x6849, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
205 | {0x1002, 0x6850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
206 | {0x1002, 0x6858, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
207 | {0x1002, 0x6859, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TURKS|RADEON_NEW_MEMMAP}, \ | ||
200 | {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 208 | {0x1002, 0x6880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
201 | {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | 209 | {0x1002, 0x6888, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ |
202 | {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ | 210 | {0x1002, 0x6889, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYPRESS|RADEON_NEW_MEMMAP}, \ |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 154bf5683015..66ed067fb729 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -552,5 +552,14 @@ extern ssize_t compat_rw_copy_check_uvector(int type, | |||
552 | 552 | ||
553 | extern void __user *compat_alloc_user_space(unsigned long len); | 553 | extern void __user *compat_alloc_user_space(unsigned long len); |
554 | 554 | ||
555 | asmlinkage ssize_t compat_sys_process_vm_readv(compat_pid_t pid, | ||
556 | const struct compat_iovec __user *lvec, | ||
557 | unsigned long liovcnt, const struct compat_iovec __user *rvec, | ||
558 | unsigned long riovcnt, unsigned long flags); | ||
559 | asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid, | ||
560 | const struct compat_iovec __user *lvec, | ||
561 | unsigned long liovcnt, const struct compat_iovec __user *rvec, | ||
562 | unsigned long riovcnt, unsigned long flags); | ||
563 | |||
555 | #endif /* CONFIG_COMPAT */ | 564 | #endif /* CONFIG_COMPAT */ |
556 | #endif /* _LINUX_COMPAT_H */ | 565 | #endif /* _LINUX_COMPAT_H */ |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 4df926199369..ed9f74f6c519 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -339,7 +339,8 @@ extern int d_validate(struct dentry *, struct dentry *); | |||
339 | */ | 339 | */ |
340 | extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); | 340 | extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); |
341 | 341 | ||
342 | extern char *__d_path(const struct path *path, struct path *root, char *, int); | 342 | extern char *__d_path(const struct path *, const struct path *, char *, int); |
343 | extern char *d_absolute_path(const struct path *, char *, int); | ||
343 | extern char *d_path(const struct path *, char *, int); | 344 | extern char *d_path(const struct path *, char *, int); |
344 | extern char *d_path_with_unreachable(const struct path *, char *, int); | 345 | extern char *d_path_with_unreachable(const struct path *, char *, int); |
345 | extern char *dentry_path_raw(struct dentry *, char *, int); | 346 | extern char *dentry_path_raw(struct dentry *, char *, int); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index e3130220ce3e..e0bc4ffb8e7f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -393,8 +393,8 @@ struct inodes_stat_t { | |||
393 | #include <linux/semaphore.h> | 393 | #include <linux/semaphore.h> |
394 | #include <linux/fiemap.h> | 394 | #include <linux/fiemap.h> |
395 | #include <linux/rculist_bl.h> | 395 | #include <linux/rculist_bl.h> |
396 | #include <linux/shrinker.h> | ||
397 | #include <linux/atomic.h> | 396 | #include <linux/atomic.h> |
397 | #include <linux/shrinker.h> | ||
398 | 398 | ||
399 | #include <asm/byteorder.h> | 399 | #include <asm/byteorder.h> |
400 | 400 | ||
@@ -1942,6 +1942,7 @@ extern int fd_statfs(int, struct kstatfs *); | |||
1942 | extern int statfs_by_dentry(struct dentry *, struct kstatfs *); | 1942 | extern int statfs_by_dentry(struct dentry *, struct kstatfs *); |
1943 | extern int freeze_super(struct super_block *super); | 1943 | extern int freeze_super(struct super_block *super); |
1944 | extern int thaw_super(struct super_block *super); | 1944 | extern int thaw_super(struct super_block *super); |
1945 | extern bool our_mnt(struct vfsmount *mnt); | ||
1945 | 1946 | ||
1946 | extern int current_umask(void); | 1947 | extern int current_umask(void); |
1947 | 1948 | ||
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 96efa6794ea5..c3da42dd22ba 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -172,6 +172,7 @@ enum { | |||
172 | TRACE_EVENT_FL_FILTERED_BIT, | 172 | TRACE_EVENT_FL_FILTERED_BIT, |
173 | TRACE_EVENT_FL_RECORDED_CMD_BIT, | 173 | TRACE_EVENT_FL_RECORDED_CMD_BIT, |
174 | TRACE_EVENT_FL_CAP_ANY_BIT, | 174 | TRACE_EVENT_FL_CAP_ANY_BIT, |
175 | TRACE_EVENT_FL_NO_SET_FILTER_BIT, | ||
175 | }; | 176 | }; |
176 | 177 | ||
177 | enum { | 178 | enum { |
@@ -179,6 +180,7 @@ enum { | |||
179 | TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), | 180 | TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), |
180 | TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), | 181 | TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT), |
181 | TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), | 182 | TRACE_EVENT_FL_CAP_ANY = (1 << TRACE_EVENT_FL_CAP_ANY_BIT), |
183 | TRACE_EVENT_FL_NO_SET_FILTER = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT), | ||
182 | }; | 184 | }; |
183 | 185 | ||
184 | struct ftrace_event_call { | 186 | struct ftrace_event_call { |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 94b1e356c02a..32574eef9394 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
@@ -126,6 +126,8 @@ extern struct cred init_cred; | |||
126 | # define INIT_PERF_EVENTS(tsk) | 126 | # define INIT_PERF_EVENTS(tsk) |
127 | #endif | 127 | #endif |
128 | 128 | ||
129 | #define INIT_TASK_COMM "swapper" | ||
130 | |||
129 | /* | 131 | /* |
130 | * INIT_TASK is used to set up the first task table, touch at | 132 | * INIT_TASK is used to set up the first task table, touch at |
131 | * your own risk!. Base=0, limit=0x1fffff (=2MB) | 133 | * your own risk!. Base=0, limit=0x1fffff (=2MB) |
@@ -162,7 +164,7 @@ extern struct cred init_cred; | |||
162 | .group_leader = &tsk, \ | 164 | .group_leader = &tsk, \ |
163 | RCU_INIT_POINTER(.real_cred, &init_cred), \ | 165 | RCU_INIT_POINTER(.real_cred, &init_cred), \ |
164 | RCU_INIT_POINTER(.cred, &init_cred), \ | 166 | RCU_INIT_POINTER(.cred, &init_cred), \ |
165 | .comm = "swapper", \ | 167 | .comm = INIT_TASK_COMM, \ |
166 | .thread = INIT_THREAD, \ | 168 | .thread = INIT_THREAD, \ |
167 | .fs = &init_fs, \ | 169 | .fs = &init_fs, \ |
168 | .files = &init_files, \ | 170 | .files = &init_files, \ |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 3dc3a8c2c485..4baadd18f4ad 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/mmzone.h> | 10 | #include <linux/mmzone.h> |
11 | #include <linux/rbtree.h> | 11 | #include <linux/rbtree.h> |
12 | #include <linux/prio_tree.h> | 12 | #include <linux/prio_tree.h> |
13 | #include <linux/atomic.h> | ||
13 | #include <linux/debug_locks.h> | 14 | #include <linux/debug_locks.h> |
14 | #include <linux/mm_types.h> | 15 | #include <linux/mm_types.h> |
15 | #include <linux/range.h> | 16 | #include <linux/range.h> |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index cbeb5867cff7..a82ad4dd306a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -2536,6 +2536,8 @@ extern void net_disable_timestamp(void); | |||
2536 | extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); | 2536 | extern void *dev_seq_start(struct seq_file *seq, loff_t *pos); |
2537 | extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); | 2537 | extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); |
2538 | extern void dev_seq_stop(struct seq_file *seq, void *v); | 2538 | extern void dev_seq_stop(struct seq_file *seq, void *v); |
2539 | extern int dev_seq_open_ops(struct inode *inode, struct file *file, | ||
2540 | const struct seq_operations *ops); | ||
2539 | #endif | 2541 | #endif |
2540 | 2542 | ||
2541 | extern int netdev_class_create_file(struct class_attribute *class_attr); | 2543 | extern int netdev_class_create_file(struct class_attribute *class_attr); |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 172ba70306d1..2aaee0ca9da8 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -517,8 +517,12 @@ | |||
517 | #define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302 | 517 | #define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302 |
518 | #define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 | 518 | #define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 |
519 | #define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 | 519 | #define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 |
520 | #define PCI_DEVICE_ID_AMD_15H_NB_F0 0x1600 | ||
521 | #define PCI_DEVICE_ID_AMD_15H_NB_F1 0x1601 | ||
522 | #define PCI_DEVICE_ID_AMD_15H_NB_F2 0x1602 | ||
520 | #define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603 | 523 | #define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603 |
521 | #define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604 | 524 | #define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604 |
525 | #define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605 | ||
522 | #define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 | 526 | #define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 |
523 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 | 527 | #define PCI_DEVICE_ID_AMD_LANCE 0x2000 |
524 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 | 528 | #define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 |
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 1e9ebe5e0091..b1f89122bf6a 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -822,6 +822,7 @@ struct perf_event { | |||
822 | int mmap_locked; | 822 | int mmap_locked; |
823 | struct user_struct *mmap_user; | 823 | struct user_struct *mmap_user; |
824 | struct ring_buffer *rb; | 824 | struct ring_buffer *rb; |
825 | struct list_head rb_entry; | ||
825 | 826 | ||
826 | /* poll related */ | 827 | /* poll related */ |
827 | wait_queue_head_t waitq; | 828 | wait_queue_head_t waitq; |
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index c5336705921f..7281d5acf2f9 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
@@ -30,7 +30,7 @@ | |||
30 | */ | 30 | */ |
31 | 31 | ||
32 | struct tc_stats { | 32 | struct tc_stats { |
33 | __u64 bytes; /* NUmber of enqueues bytes */ | 33 | __u64 bytes; /* Number of enqueued bytes */ |
34 | __u32 packets; /* Number of enqueued packets */ | 34 | __u32 packets; /* Number of enqueued packets */ |
35 | __u32 drops; /* Packets dropped because of lack of resources */ | 35 | __u32 drops; /* Packets dropped because of lack of resources */ |
36 | __u32 overlimits; /* Number of throttle events when this | 36 | __u32 overlimits; /* Number of throttle events when this |
@@ -297,7 +297,7 @@ struct tc_htb_glob { | |||
297 | __u32 debug; /* debug flags */ | 297 | __u32 debug; /* debug flags */ |
298 | 298 | ||
299 | /* stats */ | 299 | /* stats */ |
300 | __u32 direct_pkts; /* count of non shapped packets */ | 300 | __u32 direct_pkts; /* count of non shaped packets */ |
301 | }; | 301 | }; |
302 | enum { | 302 | enum { |
303 | TCA_HTB_UNSPEC, | 303 | TCA_HTB_UNSPEC, |
@@ -503,7 +503,7 @@ enum { | |||
503 | }; | 503 | }; |
504 | #define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) | 504 | #define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) |
505 | 505 | ||
506 | /* State transition probablities for 4 state model */ | 506 | /* State transition probabilities for 4 state model */ |
507 | struct tc_netem_gimodel { | 507 | struct tc_netem_gimodel { |
508 | __u32 p13; | 508 | __u32 p13; |
509 | __u32 p31; | 509 | __u32 p31; |
diff --git a/include/linux/platform_data/macb.h b/include/linux/platform_data/macb.h new file mode 100644 index 000000000000..b081c7245ec8 --- /dev/null +++ b/include/linux/platform_data/macb.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __MACB_PDATA_H__ | ||
9 | #define __MACB_PDATA_H__ | ||
10 | |||
11 | struct macb_platform_data { | ||
12 | u32 phy_mask; | ||
13 | int phy_irq_pin; /* PHY IRQ */ | ||
14 | u8 is_rmii; /* using RMII interface? */ | ||
15 | }; | ||
16 | |||
17 | #endif /* __MACB_PDATA_H__ */ | ||
diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index a83833a1f7a2..07ceb97d53fa 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h | |||
@@ -35,7 +35,7 @@ struct shrinker { | |||
35 | 35 | ||
36 | /* These are for internal use */ | 36 | /* These are for internal use */ |
37 | struct list_head list; | 37 | struct list_head list; |
38 | long nr; /* objs pending delete */ | 38 | atomic_long_t nr_in_batch; /* objs pending delete */ |
39 | }; | 39 | }; |
40 | #define DEFAULT_SEEKS 2 /* A good number if you don't know better. */ | 40 | #define DEFAULT_SEEKS 2 /* A good number if you don't know better. */ |
41 | extern void register_shrinker(struct shrinker *); | 41 | extern void register_shrinker(struct shrinker *); |
diff --git a/include/linux/sigma.h b/include/linux/sigma.h index e2accb3164d8..d0de882c0d96 100644 --- a/include/linux/sigma.h +++ b/include/linux/sigma.h | |||
@@ -24,7 +24,7 @@ struct sigma_firmware { | |||
24 | struct sigma_firmware_header { | 24 | struct sigma_firmware_header { |
25 | unsigned char magic[7]; | 25 | unsigned char magic[7]; |
26 | u8 version; | 26 | u8 version; |
27 | u32 crc; | 27 | __le32 crc; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | enum { | 30 | enum { |
@@ -40,19 +40,14 @@ enum { | |||
40 | struct sigma_action { | 40 | struct sigma_action { |
41 | u8 instr; | 41 | u8 instr; |
42 | u8 len_hi; | 42 | u8 len_hi; |
43 | u16 len; | 43 | __le16 len; |
44 | u16 addr; | 44 | __be16 addr; |
45 | unsigned char payload[]; | 45 | unsigned char payload[]; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static inline u32 sigma_action_len(struct sigma_action *sa) | 48 | static inline u32 sigma_action_len(struct sigma_action *sa) |
49 | { | 49 | { |
50 | return (sa->len_hi << 16) | sa->len; | 50 | return (sa->len_hi << 16) | le16_to_cpu(sa->len); |
51 | } | ||
52 | |||
53 | static inline size_t sigma_action_size(struct sigma_action *sa, u32 payload_len) | ||
54 | { | ||
55 | return sizeof(*sa) + payload_len + (payload_len % 2); | ||
56 | } | 51 | } |
57 | 52 | ||
58 | extern int process_sigma_firmware(struct i2c_client *client, const char *name); | 53 | extern int process_sigma_firmware(struct i2c_client *client, const char *name); |
diff --git a/include/media/davinci/vpif_types.h b/include/media/davinci/vpif_types.h new file mode 100644 index 000000000000..9929b05cff3a --- /dev/null +++ b/include/media/davinci/vpif_types.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Texas Instruments Inc | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program; if not, write to the Free Software | ||
15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
16 | */ | ||
17 | #ifndef _VPIF_TYPES_H | ||
18 | #define _VPIF_TYPES_H | ||
19 | |||
20 | #define VPIF_CAPTURE_MAX_CHANNELS 2 | ||
21 | |||
22 | enum vpif_if_type { | ||
23 | VPIF_IF_BT656, | ||
24 | VPIF_IF_BT1120, | ||
25 | VPIF_IF_RAW_BAYER | ||
26 | }; | ||
27 | |||
28 | struct vpif_interface { | ||
29 | enum vpif_if_type if_type; | ||
30 | unsigned hd_pol:1; | ||
31 | unsigned vd_pol:1; | ||
32 | unsigned fid_pol:1; | ||
33 | }; | ||
34 | |||
35 | struct vpif_subdev_info { | ||
36 | const char *name; | ||
37 | struct i2c_board_info board_info; | ||
38 | u32 input; | ||
39 | u32 output; | ||
40 | unsigned can_route:1; | ||
41 | struct vpif_interface vpif_if; | ||
42 | }; | ||
43 | |||
44 | struct vpif_display_config { | ||
45 | int (*set_clock)(int, int); | ||
46 | struct vpif_subdev_info *subdevinfo; | ||
47 | int subdev_count; | ||
48 | const char **output; | ||
49 | int output_count; | ||
50 | const char *card_name; | ||
51 | }; | ||
52 | |||
53 | struct vpif_input { | ||
54 | struct v4l2_input input; | ||
55 | const char *subdev_name; | ||
56 | }; | ||
57 | |||
58 | struct vpif_capture_chan_config { | ||
59 | const struct vpif_input *inputs; | ||
60 | int input_count; | ||
61 | }; | ||
62 | |||
63 | struct vpif_capture_config { | ||
64 | int (*setup_input_channel_mode)(int); | ||
65 | int (*setup_input_path)(int, const char *); | ||
66 | struct vpif_capture_chan_config chan_config[VPIF_CAPTURE_MAX_CHANNELS]; | ||
67 | struct vpif_subdev_info *subdev_info; | ||
68 | int subdev_count; | ||
69 | const char *card_name; | ||
70 | }; | ||
71 | #endif /* _VPIF_TYPES_H */ | ||
diff --git a/include/net/dst.h b/include/net/dst.h index 4fb6c4381791..6faec1a60216 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -205,12 +205,7 @@ dst_feature(const struct dst_entry *dst, u32 feature) | |||
205 | 205 | ||
206 | static inline u32 dst_mtu(const struct dst_entry *dst) | 206 | static inline u32 dst_mtu(const struct dst_entry *dst) |
207 | { | 207 | { |
208 | u32 mtu = dst_metric_raw(dst, RTAX_MTU); | 208 | return dst->ops->mtu(dst); |
209 | |||
210 | if (!mtu) | ||
211 | mtu = dst->ops->default_mtu(dst); | ||
212 | |||
213 | return mtu; | ||
214 | } | 209 | } |
215 | 210 | ||
216 | /* RTT metrics are stored in milliseconds for user ABI, but used as jiffies */ | 211 | /* RTT metrics are stored in milliseconds for user ABI, but used as jiffies */ |
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h index 9adb99845a56..e1c2ee0eef47 100644 --- a/include/net/dst_ops.h +++ b/include/net/dst_ops.h | |||
@@ -17,7 +17,7 @@ struct dst_ops { | |||
17 | int (*gc)(struct dst_ops *ops); | 17 | int (*gc)(struct dst_ops *ops); |
18 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); | 18 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); |
19 | unsigned int (*default_advmss)(const struct dst_entry *); | 19 | unsigned int (*default_advmss)(const struct dst_entry *); |
20 | unsigned int (*default_mtu)(const struct dst_entry *); | 20 | unsigned int (*mtu)(const struct dst_entry *); |
21 | u32 * (*cow_metrics)(struct dst_entry *, unsigned long); | 21 | u32 * (*cow_metrics)(struct dst_entry *, unsigned long); |
22 | void (*destroy)(struct dst_entry *); | 22 | void (*destroy)(struct dst_entry *); |
23 | void (*ifdown)(struct dst_entry *, | 23 | void (*ifdown)(struct dst_entry *, |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index b897d6e6d0a5..f941964a9931 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -31,6 +31,7 @@ | |||
31 | /** struct ip_options - IP Options | 31 | /** struct ip_options - IP Options |
32 | * | 32 | * |
33 | * @faddr - Saved first hop address | 33 | * @faddr - Saved first hop address |
34 | * @nexthop - Saved nexthop address in LSRR and SSRR | ||
34 | * @is_data - Options in __data, rather than skb | 35 | * @is_data - Options in __data, rather than skb |
35 | * @is_strictroute - Strict source route | 36 | * @is_strictroute - Strict source route |
36 | * @srr_is_hit - Packet destination addr was our one | 37 | * @srr_is_hit - Packet destination addr was our one |
@@ -41,6 +42,7 @@ | |||
41 | */ | 42 | */ |
42 | struct ip_options { | 43 | struct ip_options { |
43 | __be32 faddr; | 44 | __be32 faddr; |
45 | __be32 nexthop; | ||
44 | unsigned char optlen; | 46 | unsigned char optlen; |
45 | unsigned char srr; | 47 | unsigned char srr; |
46 | unsigned char rr; | 48 | unsigned char rr; |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 78c83e62218f..e9ff3fc5e688 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -35,6 +35,7 @@ struct inet_peer { | |||
35 | 35 | ||
36 | u32 metrics[RTAX_MAX]; | 36 | u32 metrics[RTAX_MAX]; |
37 | u32 rate_tokens; /* rate limiting for ICMP */ | 37 | u32 rate_tokens; /* rate limiting for ICMP */ |
38 | int redirect_genid; | ||
38 | unsigned long rate_last; | 39 | unsigned long rate_last; |
39 | unsigned long pmtu_expires; | 40 | unsigned long pmtu_expires; |
40 | u32 pmtu_orig; | 41 | u32 pmtu_orig; |
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h index 4283508b3e18..a88fb6939387 100644 --- a/include/net/netfilter/nf_conntrack_ecache.h +++ b/include/net/netfilter/nf_conntrack_ecache.h | |||
@@ -67,18 +67,18 @@ struct nf_ct_event_notifier { | |||
67 | int (*fcn)(unsigned int events, struct nf_ct_event *item); | 67 | int (*fcn)(unsigned int events, struct nf_ct_event *item); |
68 | }; | 68 | }; |
69 | 69 | ||
70 | extern struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; | 70 | extern int nf_conntrack_register_notifier(struct net *net, struct nf_ct_event_notifier *nb); |
71 | extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb); | 71 | extern void nf_conntrack_unregister_notifier(struct net *net, struct nf_ct_event_notifier *nb); |
72 | extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb); | ||
73 | 72 | ||
74 | extern void nf_ct_deliver_cached_events(struct nf_conn *ct); | 73 | extern void nf_ct_deliver_cached_events(struct nf_conn *ct); |
75 | 74 | ||
76 | static inline void | 75 | static inline void |
77 | nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) | 76 | nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) |
78 | { | 77 | { |
78 | struct net *net = nf_ct_net(ct); | ||
79 | struct nf_conntrack_ecache *e; | 79 | struct nf_conntrack_ecache *e; |
80 | 80 | ||
81 | if (nf_conntrack_event_cb == NULL) | 81 | if (net->ct.nf_conntrack_event_cb == NULL) |
82 | return; | 82 | return; |
83 | 83 | ||
84 | e = nf_ct_ecache_find(ct); | 84 | e = nf_ct_ecache_find(ct); |
@@ -95,11 +95,12 @@ nf_conntrack_eventmask_report(unsigned int eventmask, | |||
95 | int report) | 95 | int report) |
96 | { | 96 | { |
97 | int ret = 0; | 97 | int ret = 0; |
98 | struct net *net = nf_ct_net(ct); | ||
98 | struct nf_ct_event_notifier *notify; | 99 | struct nf_ct_event_notifier *notify; |
99 | struct nf_conntrack_ecache *e; | 100 | struct nf_conntrack_ecache *e; |
100 | 101 | ||
101 | rcu_read_lock(); | 102 | rcu_read_lock(); |
102 | notify = rcu_dereference(nf_conntrack_event_cb); | 103 | notify = rcu_dereference(net->ct.nf_conntrack_event_cb); |
103 | if (notify == NULL) | 104 | if (notify == NULL) |
104 | goto out_unlock; | 105 | goto out_unlock; |
105 | 106 | ||
@@ -164,9 +165,8 @@ struct nf_exp_event_notifier { | |||
164 | int (*fcn)(unsigned int events, struct nf_exp_event *item); | 165 | int (*fcn)(unsigned int events, struct nf_exp_event *item); |
165 | }; | 166 | }; |
166 | 167 | ||
167 | extern struct nf_exp_event_notifier __rcu *nf_expect_event_cb; | 168 | extern int nf_ct_expect_register_notifier(struct net *net, struct nf_exp_event_notifier *nb); |
168 | extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb); | 169 | extern void nf_ct_expect_unregister_notifier(struct net *net, struct nf_exp_event_notifier *nb); |
169 | extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb); | ||
170 | 170 | ||
171 | static inline void | 171 | static inline void |
172 | nf_ct_expect_event_report(enum ip_conntrack_expect_events event, | 172 | nf_ct_expect_event_report(enum ip_conntrack_expect_events event, |
@@ -174,11 +174,12 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event, | |||
174 | u32 pid, | 174 | u32 pid, |
175 | int report) | 175 | int report) |
176 | { | 176 | { |
177 | struct net *net = nf_ct_exp_net(exp); | ||
177 | struct nf_exp_event_notifier *notify; | 178 | struct nf_exp_event_notifier *notify; |
178 | struct nf_conntrack_ecache *e; | 179 | struct nf_conntrack_ecache *e; |
179 | 180 | ||
180 | rcu_read_lock(); | 181 | rcu_read_lock(); |
181 | notify = rcu_dereference(nf_expect_event_cb); | 182 | notify = rcu_dereference(net->ct.nf_expect_event_cb); |
182 | if (notify == NULL) | 183 | if (notify == NULL) |
183 | goto out_unlock; | 184 | goto out_unlock; |
184 | 185 | ||
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index 0249399e51a7..7a911eca0f18 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h | |||
@@ -18,6 +18,8 @@ struct netns_ct { | |||
18 | struct hlist_nulls_head unconfirmed; | 18 | struct hlist_nulls_head unconfirmed; |
19 | struct hlist_nulls_head dying; | 19 | struct hlist_nulls_head dying; |
20 | struct ip_conntrack_stat __percpu *stat; | 20 | struct ip_conntrack_stat __percpu *stat; |
21 | struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; | ||
22 | struct nf_exp_event_notifier __rcu *nf_expect_event_cb; | ||
21 | int sysctl_events; | 23 | int sysctl_events; |
22 | unsigned int sysctl_events_retry_timeout; | 24 | unsigned int sysctl_events_retry_timeout; |
23 | int sysctl_acct; | 25 | int sysctl_acct; |
diff --git a/include/net/red.h b/include/net/red.h index 3319f16b3beb..b72a3b833936 100644 --- a/include/net/red.h +++ b/include/net/red.h | |||
@@ -116,7 +116,7 @@ struct red_parms { | |||
116 | u32 qR; /* Cached random number */ | 116 | u32 qR; /* Cached random number */ |
117 | 117 | ||
118 | unsigned long qavg; /* Average queue length: A scaled */ | 118 | unsigned long qavg; /* Average queue length: A scaled */ |
119 | psched_time_t qidlestart; /* Start of current idle period */ | 119 | ktime_t qidlestart; /* Start of current idle period */ |
120 | }; | 120 | }; |
121 | 121 | ||
122 | static inline u32 red_rmask(u8 Plog) | 122 | static inline u32 red_rmask(u8 Plog) |
@@ -148,17 +148,17 @@ static inline void red_set_parms(struct red_parms *p, | |||
148 | 148 | ||
149 | static inline int red_is_idling(struct red_parms *p) | 149 | static inline int red_is_idling(struct red_parms *p) |
150 | { | 150 | { |
151 | return p->qidlestart != PSCHED_PASTPERFECT; | 151 | return p->qidlestart.tv64 != 0; |
152 | } | 152 | } |
153 | 153 | ||
154 | static inline void red_start_of_idle_period(struct red_parms *p) | 154 | static inline void red_start_of_idle_period(struct red_parms *p) |
155 | { | 155 | { |
156 | p->qidlestart = psched_get_time(); | 156 | p->qidlestart = ktime_get(); |
157 | } | 157 | } |
158 | 158 | ||
159 | static inline void red_end_of_idle_period(struct red_parms *p) | 159 | static inline void red_end_of_idle_period(struct red_parms *p) |
160 | { | 160 | { |
161 | p->qidlestart = PSCHED_PASTPERFECT; | 161 | p->qidlestart.tv64 = 0; |
162 | } | 162 | } |
163 | 163 | ||
164 | static inline void red_restart(struct red_parms *p) | 164 | static inline void red_restart(struct red_parms *p) |
@@ -170,13 +170,10 @@ static inline void red_restart(struct red_parms *p) | |||
170 | 170 | ||
171 | static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) | 171 | static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p) |
172 | { | 172 | { |
173 | psched_time_t now; | 173 | s64 delta = ktime_us_delta(ktime_get(), p->qidlestart); |
174 | long us_idle; | 174 | long us_idle = min_t(s64, delta, p->Scell_max); |
175 | int shift; | 175 | int shift; |
176 | 176 | ||
177 | now = psched_get_time(); | ||
178 | us_idle = psched_tdiff_bounded(now, p->qidlestart, p->Scell_max); | ||
179 | |||
180 | /* | 177 | /* |
181 | * The problem: ideally, average length queue recalcultion should | 178 | * The problem: ideally, average length queue recalcultion should |
182 | * be done over constant clock intervals. This is too expensive, so | 179 | * be done over constant clock intervals. This is too expensive, so |
diff --git a/include/net/route.h b/include/net/route.h index db7b3432f07c..91855d185b53 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -71,12 +71,12 @@ struct rtable { | |||
71 | struct fib_info *fi; /* for client ref to shared metrics */ | 71 | struct fib_info *fi; /* for client ref to shared metrics */ |
72 | }; | 72 | }; |
73 | 73 | ||
74 | static inline bool rt_is_input_route(struct rtable *rt) | 74 | static inline bool rt_is_input_route(const struct rtable *rt) |
75 | { | 75 | { |
76 | return rt->rt_route_iif != 0; | 76 | return rt->rt_route_iif != 0; |
77 | } | 77 | } |
78 | 78 | ||
79 | static inline bool rt_is_output_route(struct rtable *rt) | 79 | static inline bool rt_is_output_route(const struct rtable *rt) |
80 | { | 80 | { |
81 | return rt->rt_route_iif == 0; | 81 | return rt->rt_route_iif == 0; |
82 | } | 82 | } |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 7f5fed3c89e1..6873c7dd9145 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -103,9 +103,10 @@ enum se_cmd_flags_table { | |||
103 | SCF_SCSI_NON_DATA_CDB = 0x00000040, | 103 | SCF_SCSI_NON_DATA_CDB = 0x00000040, |
104 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, | 104 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, |
105 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, | 105 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, |
106 | SCF_SE_CMD_FAILED = 0x00000400, | 106 | SCF_FUA = 0x00000200, |
107 | SCF_SE_LUN_CMD = 0x00000800, | 107 | SCF_SE_LUN_CMD = 0x00000800, |
108 | SCF_SE_ALLOW_EOO = 0x00001000, | 108 | SCF_SE_ALLOW_EOO = 0x00001000, |
109 | SCF_BIDI = 0x00002000, | ||
109 | SCF_SENT_CHECK_CONDITION = 0x00004000, | 110 | SCF_SENT_CHECK_CONDITION = 0x00004000, |
110 | SCF_OVERFLOW_BIT = 0x00008000, | 111 | SCF_OVERFLOW_BIT = 0x00008000, |
111 | SCF_UNDERFLOW_BIT = 0x00010000, | 112 | SCF_UNDERFLOW_BIT = 0x00010000, |
@@ -154,6 +155,7 @@ enum tcm_sense_reason_table { | |||
154 | TCM_CHECK_CONDITION_ABORT_CMD = 0x0d, | 155 | TCM_CHECK_CONDITION_ABORT_CMD = 0x0d, |
155 | TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e, | 156 | TCM_CHECK_CONDITION_UNIT_ATTENTION = 0x0e, |
156 | TCM_CHECK_CONDITION_NOT_READY = 0x0f, | 157 | TCM_CHECK_CONDITION_NOT_READY = 0x0f, |
158 | TCM_RESERVATION_CONFLICT = 0x10, | ||
157 | }; | 159 | }; |
158 | 160 | ||
159 | struct se_obj { | 161 | struct se_obj { |
@@ -211,7 +213,6 @@ struct t10_alua_lu_gp { | |||
211 | u16 lu_gp_id; | 213 | u16 lu_gp_id; |
212 | int lu_gp_valid_id; | 214 | int lu_gp_valid_id; |
213 | u32 lu_gp_members; | 215 | u32 lu_gp_members; |
214 | atomic_t lu_gp_shutdown; | ||
215 | atomic_t lu_gp_ref_cnt; | 216 | atomic_t lu_gp_ref_cnt; |
216 | spinlock_t lu_gp_lock; | 217 | spinlock_t lu_gp_lock; |
217 | struct config_group lu_gp_group; | 218 | struct config_group lu_gp_group; |
@@ -422,11 +423,9 @@ struct se_cmd { | |||
422 | int sam_task_attr; | 423 | int sam_task_attr; |
423 | /* Transport protocol dependent state, see transport_state_table */ | 424 | /* Transport protocol dependent state, see transport_state_table */ |
424 | enum transport_state_table t_state; | 425 | enum transport_state_table t_state; |
425 | /* Transport specific error status */ | ||
426 | int transport_error_status; | ||
427 | /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */ | 426 | /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */ |
428 | int check_release:1; | 427 | unsigned check_release:1; |
429 | int cmd_wait_set:1; | 428 | unsigned cmd_wait_set:1; |
430 | /* See se_cmd_flags_table */ | 429 | /* See se_cmd_flags_table */ |
431 | u32 se_cmd_flags; | 430 | u32 se_cmd_flags; |
432 | u32 se_ordered_id; | 431 | u32 se_ordered_id; |
@@ -441,13 +440,10 @@ struct se_cmd { | |||
441 | /* Used for sense data */ | 440 | /* Used for sense data */ |
442 | void *sense_buffer; | 441 | void *sense_buffer; |
443 | struct list_head se_delayed_node; | 442 | struct list_head se_delayed_node; |
444 | struct list_head se_ordered_node; | ||
445 | struct list_head se_lun_node; | 443 | struct list_head se_lun_node; |
446 | struct list_head se_qf_node; | 444 | struct list_head se_qf_node; |
447 | struct se_device *se_dev; | 445 | struct se_device *se_dev; |
448 | struct se_dev_entry *se_deve; | 446 | struct se_dev_entry *se_deve; |
449 | struct se_device *se_obj_ptr; | ||
450 | struct se_device *se_orig_obj_ptr; | ||
451 | struct se_lun *se_lun; | 447 | struct se_lun *se_lun; |
452 | /* Only used for internal passthrough and legacy TCM fabric modules */ | 448 | /* Only used for internal passthrough and legacy TCM fabric modules */ |
453 | struct se_session *se_sess; | 449 | struct se_session *se_sess; |
@@ -463,8 +459,6 @@ struct se_cmd { | |||
463 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; | 459 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; |
464 | unsigned long long t_task_lba; | 460 | unsigned long long t_task_lba; |
465 | int t_tasks_failed; | 461 | int t_tasks_failed; |
466 | int t_tasks_fua; | ||
467 | bool t_tasks_bidi; | ||
468 | u32 t_tasks_sg_chained_no; | 462 | u32 t_tasks_sg_chained_no; |
469 | atomic_t t_fe_count; | 463 | atomic_t t_fe_count; |
470 | atomic_t t_se_count; | 464 | atomic_t t_se_count; |
@@ -489,14 +483,6 @@ struct se_cmd { | |||
489 | 483 | ||
490 | struct work_struct work; | 484 | struct work_struct work; |
491 | 485 | ||
492 | /* | ||
493 | * Used for pre-registered fabric SGL passthrough WRITE and READ | ||
494 | * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop | ||
495 | * and other HW target mode fabric modules. | ||
496 | */ | ||
497 | struct scatterlist *t_task_pt_sgl; | ||
498 | u32 t_task_pt_sgl_num; | ||
499 | |||
500 | struct scatterlist *t_data_sg; | 486 | struct scatterlist *t_data_sg; |
501 | unsigned int t_data_nents; | 487 | unsigned int t_data_nents; |
502 | struct scatterlist *t_bidi_data_sg; | 488 | struct scatterlist *t_bidi_data_sg; |
@@ -562,7 +548,7 @@ struct se_node_acl { | |||
562 | } ____cacheline_aligned; | 548 | } ____cacheline_aligned; |
563 | 549 | ||
564 | struct se_session { | 550 | struct se_session { |
565 | int sess_tearing_down:1; | 551 | unsigned sess_tearing_down:1; |
566 | u64 sess_bin_isid; | 552 | u64 sess_bin_isid; |
567 | struct se_node_acl *se_node_acl; | 553 | struct se_node_acl *se_node_acl; |
568 | struct se_portal_group *se_tpg; | 554 | struct se_portal_group *se_tpg; |
@@ -683,7 +669,6 @@ struct se_subsystem_dev { | |||
683 | struct t10_reservation t10_pr; | 669 | struct t10_reservation t10_pr; |
684 | spinlock_t se_dev_lock; | 670 | spinlock_t se_dev_lock; |
685 | void *se_dev_su_ptr; | 671 | void *se_dev_su_ptr; |
686 | struct list_head se_dev_node; | ||
687 | struct config_group se_dev_group; | 672 | struct config_group se_dev_group; |
688 | /* For T10 Reservations */ | 673 | /* For T10 Reservations */ |
689 | struct config_group se_dev_pr_group; | 674 | struct config_group se_dev_pr_group; |
@@ -692,9 +677,6 @@ struct se_subsystem_dev { | |||
692 | } ____cacheline_aligned; | 677 | } ____cacheline_aligned; |
693 | 678 | ||
694 | struct se_device { | 679 | struct se_device { |
695 | /* Set to 1 if thread is NOT sleeping on thread_sem */ | ||
696 | u8 thread_active; | ||
697 | u8 dev_status_timer_flags; | ||
698 | /* RELATIVE TARGET PORT IDENTIFER Counter */ | 680 | /* RELATIVE TARGET PORT IDENTIFER Counter */ |
699 | u16 dev_rpti_counter; | 681 | u16 dev_rpti_counter; |
700 | /* Used for SAM Task Attribute ordering */ | 682 | /* Used for SAM Task Attribute ordering */ |
@@ -719,14 +701,10 @@ struct se_device { | |||
719 | u64 write_bytes; | 701 | u64 write_bytes; |
720 | spinlock_t stats_lock; | 702 | spinlock_t stats_lock; |
721 | /* Active commands on this virtual SE device */ | 703 | /* Active commands on this virtual SE device */ |
722 | atomic_t active_cmds; | ||
723 | atomic_t simple_cmds; | 704 | atomic_t simple_cmds; |
724 | atomic_t depth_left; | 705 | atomic_t depth_left; |
725 | atomic_t dev_ordered_id; | 706 | atomic_t dev_ordered_id; |
726 | atomic_t dev_tur_active; | ||
727 | atomic_t execute_tasks; | 707 | atomic_t execute_tasks; |
728 | atomic_t dev_status_thr_count; | ||
729 | atomic_t dev_hoq_count; | ||
730 | atomic_t dev_ordered_sync; | 708 | atomic_t dev_ordered_sync; |
731 | atomic_t dev_qf_count; | 709 | atomic_t dev_qf_count; |
732 | struct se_obj dev_obj; | 710 | struct se_obj dev_obj; |
@@ -734,14 +712,9 @@ struct se_device { | |||
734 | struct se_obj dev_export_obj; | 712 | struct se_obj dev_export_obj; |
735 | struct se_queue_obj dev_queue_obj; | 713 | struct se_queue_obj dev_queue_obj; |
736 | spinlock_t delayed_cmd_lock; | 714 | spinlock_t delayed_cmd_lock; |
737 | spinlock_t ordered_cmd_lock; | ||
738 | spinlock_t execute_task_lock; | 715 | spinlock_t execute_task_lock; |
739 | spinlock_t state_task_lock; | ||
740 | spinlock_t dev_alua_lock; | ||
741 | spinlock_t dev_reservation_lock; | 716 | spinlock_t dev_reservation_lock; |
742 | spinlock_t dev_state_lock; | ||
743 | spinlock_t dev_status_lock; | 717 | spinlock_t dev_status_lock; |
744 | spinlock_t dev_status_thr_lock; | ||
745 | spinlock_t se_port_lock; | 718 | spinlock_t se_port_lock; |
746 | spinlock_t se_tmr_lock; | 719 | spinlock_t se_tmr_lock; |
747 | spinlock_t qf_cmd_lock; | 720 | spinlock_t qf_cmd_lock; |
@@ -753,14 +726,10 @@ struct se_device { | |||
753 | struct t10_pr_registration *dev_pr_res_holder; | 726 | struct t10_pr_registration *dev_pr_res_holder; |
754 | struct list_head dev_sep_list; | 727 | struct list_head dev_sep_list; |
755 | struct list_head dev_tmr_list; | 728 | struct list_head dev_tmr_list; |
756 | struct timer_list dev_status_timer; | ||
757 | /* Pointer to descriptor for processing thread */ | 729 | /* Pointer to descriptor for processing thread */ |
758 | struct task_struct *process_thread; | 730 | struct task_struct *process_thread; |
759 | pid_t process_thread_pid; | ||
760 | struct task_struct *dev_mgmt_thread; | ||
761 | struct work_struct qf_work_queue; | 731 | struct work_struct qf_work_queue; |
762 | struct list_head delayed_cmd_list; | 732 | struct list_head delayed_cmd_list; |
763 | struct list_head ordered_cmd_list; | ||
764 | struct list_head execute_task_list; | 733 | struct list_head execute_task_list; |
765 | struct list_head state_task_list; | 734 | struct list_head state_task_list; |
766 | struct list_head qf_cmd_list; | 735 | struct list_head qf_cmd_list; |
@@ -771,8 +740,6 @@ struct se_device { | |||
771 | struct se_subsystem_api *transport; | 740 | struct se_subsystem_api *transport; |
772 | /* Linked list for struct se_hba struct se_device list */ | 741 | /* Linked list for struct se_hba struct se_device list */ |
773 | struct list_head dev_list; | 742 | struct list_head dev_list; |
774 | /* Linked list for struct se_global->g_se_dev_list */ | ||
775 | struct list_head g_se_dev_list; | ||
776 | } ____cacheline_aligned; | 743 | } ____cacheline_aligned; |
777 | 744 | ||
778 | struct se_hba { | 745 | struct se_hba { |
@@ -834,7 +801,6 @@ struct se_port { | |||
834 | u32 sep_index; | 801 | u32 sep_index; |
835 | struct scsi_port_stats sep_stats; | 802 | struct scsi_port_stats sep_stats; |
836 | /* Used for ALUA Target Port Groups membership */ | 803 | /* Used for ALUA Target Port Groups membership */ |
837 | atomic_t sep_tg_pt_gp_active; | ||
838 | atomic_t sep_tg_pt_secondary_offline; | 804 | atomic_t sep_tg_pt_secondary_offline; |
839 | /* Used for PR ALL_TG_PT=1 */ | 805 | /* Used for PR ALL_TG_PT=1 */ |
840 | atomic_t sep_tg_pt_ref_cnt; | 806 | atomic_t sep_tg_pt_ref_cnt; |
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h index c16e9431dd01..dac4f2d859fd 100644 --- a/include/target/target_core_transport.h +++ b/include/target/target_core_transport.h | |||
@@ -10,29 +10,6 @@ | |||
10 | 10 | ||
11 | #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ | 11 | #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ |
12 | 12 | ||
13 | #define PYX_TRANSPORT_SENT_TO_TRANSPORT 0 | ||
14 | #define PYX_TRANSPORT_WRITE_PENDING 1 | ||
15 | |||
16 | #define PYX_TRANSPORT_UNKNOWN_SAM_OPCODE -1 | ||
17 | #define PYX_TRANSPORT_HBA_QUEUE_FULL -2 | ||
18 | #define PYX_TRANSPORT_REQ_TOO_MANY_SECTORS -3 | ||
19 | #define PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES -4 | ||
20 | #define PYX_TRANSPORT_INVALID_CDB_FIELD -5 | ||
21 | #define PYX_TRANSPORT_INVALID_PARAMETER_LIST -6 | ||
22 | #define PYX_TRANSPORT_LU_COMM_FAILURE -7 | ||
23 | #define PYX_TRANSPORT_UNKNOWN_MODE_PAGE -8 | ||
24 | #define PYX_TRANSPORT_WRITE_PROTECTED -9 | ||
25 | #define PYX_TRANSPORT_RESERVATION_CONFLICT -10 | ||
26 | #define PYX_TRANSPORT_ILLEGAL_REQUEST -11 | ||
27 | #define PYX_TRANSPORT_USE_SENSE_REASON -12 | ||
28 | |||
29 | #ifndef SAM_STAT_RESERVATION_CONFLICT | ||
30 | #define SAM_STAT_RESERVATION_CONFLICT 0x18 | ||
31 | #endif | ||
32 | |||
33 | #define TRANSPORT_PLUGIN_FREE 0 | ||
34 | #define TRANSPORT_PLUGIN_REGISTERED 1 | ||
35 | |||
36 | #define TRANSPORT_PLUGIN_PHBA_PDEV 1 | 13 | #define TRANSPORT_PLUGIN_PHBA_PDEV 1 |
37 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 | 14 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 |
38 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 | 15 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 |
@@ -158,7 +135,6 @@ extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | |||
158 | extern int transport_handle_cdb_direct(struct se_cmd *); | 135 | extern int transport_handle_cdb_direct(struct se_cmd *); |
159 | extern int transport_generic_handle_cdb_map(struct se_cmd *); | 136 | extern int transport_generic_handle_cdb_map(struct se_cmd *); |
160 | extern int transport_generic_handle_data(struct se_cmd *); | 137 | extern int transport_generic_handle_data(struct se_cmd *); |
161 | extern void transport_new_cmd_failure(struct se_cmd *); | ||
162 | extern int transport_generic_handle_tmr(struct se_cmd *); | 138 | extern int transport_generic_handle_tmr(struct se_cmd *); |
163 | extern bool target_stop_task(struct se_task *task, unsigned long *flags); | 139 | extern bool target_stop_task(struct se_task *task, unsigned long *flags); |
164 | extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, | 140 | extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 0e8457da6f95..d3b9df5962c2 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -185,6 +185,9 @@ static void cpu_ctx_sched_in(struct perf_cpu_context *cpuctx, | |||
185 | static void update_context_time(struct perf_event_context *ctx); | 185 | static void update_context_time(struct perf_event_context *ctx); |
186 | static u64 perf_event_time(struct perf_event *event); | 186 | static u64 perf_event_time(struct perf_event *event); |
187 | 187 | ||
188 | static void ring_buffer_attach(struct perf_event *event, | ||
189 | struct ring_buffer *rb); | ||
190 | |||
188 | void __weak perf_event_print_debug(void) { } | 191 | void __weak perf_event_print_debug(void) { } |
189 | 192 | ||
190 | extern __weak const char *perf_pmu_name(void) | 193 | extern __weak const char *perf_pmu_name(void) |
@@ -2171,9 +2174,10 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx, | |||
2171 | */ | 2174 | */ |
2172 | cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE); | 2175 | cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE); |
2173 | 2176 | ||
2174 | perf_event_sched_in(cpuctx, ctx, task); | 2177 | if (ctx->nr_events) |
2178 | cpuctx->task_ctx = ctx; | ||
2175 | 2179 | ||
2176 | cpuctx->task_ctx = ctx; | 2180 | perf_event_sched_in(cpuctx, cpuctx->task_ctx, task); |
2177 | 2181 | ||
2178 | perf_pmu_enable(ctx->pmu); | 2182 | perf_pmu_enable(ctx->pmu); |
2179 | perf_ctx_unlock(cpuctx, ctx); | 2183 | perf_ctx_unlock(cpuctx, ctx); |
@@ -3190,12 +3194,33 @@ static unsigned int perf_poll(struct file *file, poll_table *wait) | |||
3190 | struct ring_buffer *rb; | 3194 | struct ring_buffer *rb; |
3191 | unsigned int events = POLL_HUP; | 3195 | unsigned int events = POLL_HUP; |
3192 | 3196 | ||
3197 | /* | ||
3198 | * Race between perf_event_set_output() and perf_poll(): perf_poll() | ||
3199 | * grabs the rb reference but perf_event_set_output() overrides it. | ||
3200 | * Here is the timeline for two threads T1, T2: | ||
3201 | * t0: T1, rb = rcu_dereference(event->rb) | ||
3202 | * t1: T2, old_rb = event->rb | ||
3203 | * t2: T2, event->rb = new rb | ||
3204 | * t3: T2, ring_buffer_detach(old_rb) | ||
3205 | * t4: T1, ring_buffer_attach(rb1) | ||
3206 | * t5: T1, poll_wait(event->waitq) | ||
3207 | * | ||
3208 | * To avoid this problem, we grab mmap_mutex in perf_poll() | ||
3209 | * thereby ensuring that the assignment of the new ring buffer | ||
3210 | * and the detachment of the old buffer appear atomic to perf_poll() | ||
3211 | */ | ||
3212 | mutex_lock(&event->mmap_mutex); | ||
3213 | |||
3193 | rcu_read_lock(); | 3214 | rcu_read_lock(); |
3194 | rb = rcu_dereference(event->rb); | 3215 | rb = rcu_dereference(event->rb); |
3195 | if (rb) | 3216 | if (rb) { |
3217 | ring_buffer_attach(event, rb); | ||
3196 | events = atomic_xchg(&rb->poll, 0); | 3218 | events = atomic_xchg(&rb->poll, 0); |
3219 | } | ||
3197 | rcu_read_unlock(); | 3220 | rcu_read_unlock(); |
3198 | 3221 | ||
3222 | mutex_unlock(&event->mmap_mutex); | ||
3223 | |||
3199 | poll_wait(file, &event->waitq, wait); | 3224 | poll_wait(file, &event->waitq, wait); |
3200 | 3225 | ||
3201 | return events; | 3226 | return events; |
@@ -3496,6 +3521,49 @@ unlock: | |||
3496 | return ret; | 3521 | return ret; |
3497 | } | 3522 | } |
3498 | 3523 | ||
3524 | static void ring_buffer_attach(struct perf_event *event, | ||
3525 | struct ring_buffer *rb) | ||
3526 | { | ||
3527 | unsigned long flags; | ||
3528 | |||
3529 | if (!list_empty(&event->rb_entry)) | ||
3530 | return; | ||
3531 | |||
3532 | spin_lock_irqsave(&rb->event_lock, flags); | ||
3533 | if (!list_empty(&event->rb_entry)) | ||
3534 | goto unlock; | ||
3535 | |||
3536 | list_add(&event->rb_entry, &rb->event_list); | ||
3537 | unlock: | ||
3538 | spin_unlock_irqrestore(&rb->event_lock, flags); | ||
3539 | } | ||
3540 | |||
3541 | static void ring_buffer_detach(struct perf_event *event, | ||
3542 | struct ring_buffer *rb) | ||
3543 | { | ||
3544 | unsigned long flags; | ||
3545 | |||
3546 | if (list_empty(&event->rb_entry)) | ||
3547 | return; | ||
3548 | |||
3549 | spin_lock_irqsave(&rb->event_lock, flags); | ||
3550 | list_del_init(&event->rb_entry); | ||
3551 | wake_up_all(&event->waitq); | ||
3552 | spin_unlock_irqrestore(&rb->event_lock, flags); | ||
3553 | } | ||
3554 | |||
3555 | static void ring_buffer_wakeup(struct perf_event *event) | ||
3556 | { | ||
3557 | struct ring_buffer *rb; | ||
3558 | |||
3559 | rcu_read_lock(); | ||
3560 | rb = rcu_dereference(event->rb); | ||
3561 | list_for_each_entry_rcu(event, &rb->event_list, rb_entry) { | ||
3562 | wake_up_all(&event->waitq); | ||
3563 | } | ||
3564 | rcu_read_unlock(); | ||
3565 | } | ||
3566 | |||
3499 | static void rb_free_rcu(struct rcu_head *rcu_head) | 3567 | static void rb_free_rcu(struct rcu_head *rcu_head) |
3500 | { | 3568 | { |
3501 | struct ring_buffer *rb; | 3569 | struct ring_buffer *rb; |
@@ -3521,9 +3589,19 @@ static struct ring_buffer *ring_buffer_get(struct perf_event *event) | |||
3521 | 3589 | ||
3522 | static void ring_buffer_put(struct ring_buffer *rb) | 3590 | static void ring_buffer_put(struct ring_buffer *rb) |
3523 | { | 3591 | { |
3592 | struct perf_event *event, *n; | ||
3593 | unsigned long flags; | ||
3594 | |||
3524 | if (!atomic_dec_and_test(&rb->refcount)) | 3595 | if (!atomic_dec_and_test(&rb->refcount)) |
3525 | return; | 3596 | return; |
3526 | 3597 | ||
3598 | spin_lock_irqsave(&rb->event_lock, flags); | ||
3599 | list_for_each_entry_safe(event, n, &rb->event_list, rb_entry) { | ||
3600 | list_del_init(&event->rb_entry); | ||
3601 | wake_up_all(&event->waitq); | ||
3602 | } | ||
3603 | spin_unlock_irqrestore(&rb->event_lock, flags); | ||
3604 | |||
3527 | call_rcu(&rb->rcu_head, rb_free_rcu); | 3605 | call_rcu(&rb->rcu_head, rb_free_rcu); |
3528 | } | 3606 | } |
3529 | 3607 | ||
@@ -3546,6 +3624,7 @@ static void perf_mmap_close(struct vm_area_struct *vma) | |||
3546 | atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm); | 3624 | atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm); |
3547 | vma->vm_mm->pinned_vm -= event->mmap_locked; | 3625 | vma->vm_mm->pinned_vm -= event->mmap_locked; |
3548 | rcu_assign_pointer(event->rb, NULL); | 3626 | rcu_assign_pointer(event->rb, NULL); |
3627 | ring_buffer_detach(event, rb); | ||
3549 | mutex_unlock(&event->mmap_mutex); | 3628 | mutex_unlock(&event->mmap_mutex); |
3550 | 3629 | ||
3551 | ring_buffer_put(rb); | 3630 | ring_buffer_put(rb); |
@@ -3700,7 +3779,7 @@ static const struct file_operations perf_fops = { | |||
3700 | 3779 | ||
3701 | void perf_event_wakeup(struct perf_event *event) | 3780 | void perf_event_wakeup(struct perf_event *event) |
3702 | { | 3781 | { |
3703 | wake_up_all(&event->waitq); | 3782 | ring_buffer_wakeup(event); |
3704 | 3783 | ||
3705 | if (event->pending_kill) { | 3784 | if (event->pending_kill) { |
3706 | kill_fasync(&event->fasync, SIGIO, event->pending_kill); | 3785 | kill_fasync(&event->fasync, SIGIO, event->pending_kill); |
@@ -5822,6 +5901,8 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, | |||
5822 | INIT_LIST_HEAD(&event->group_entry); | 5901 | INIT_LIST_HEAD(&event->group_entry); |
5823 | INIT_LIST_HEAD(&event->event_entry); | 5902 | INIT_LIST_HEAD(&event->event_entry); |
5824 | INIT_LIST_HEAD(&event->sibling_list); | 5903 | INIT_LIST_HEAD(&event->sibling_list); |
5904 | INIT_LIST_HEAD(&event->rb_entry); | ||
5905 | |||
5825 | init_waitqueue_head(&event->waitq); | 5906 | init_waitqueue_head(&event->waitq); |
5826 | init_irq_work(&event->pending, perf_pending_event); | 5907 | init_irq_work(&event->pending, perf_pending_event); |
5827 | 5908 | ||
@@ -6028,6 +6109,8 @@ set: | |||
6028 | 6109 | ||
6029 | old_rb = event->rb; | 6110 | old_rb = event->rb; |
6030 | rcu_assign_pointer(event->rb, rb); | 6111 | rcu_assign_pointer(event->rb, rb); |
6112 | if (old_rb) | ||
6113 | ring_buffer_detach(event, old_rb); | ||
6031 | ret = 0; | 6114 | ret = 0; |
6032 | unlock: | 6115 | unlock: |
6033 | mutex_unlock(&event->mmap_mutex); | 6116 | mutex_unlock(&event->mmap_mutex); |
diff --git a/kernel/events/internal.h b/kernel/events/internal.h index 09097dd8116c..64568a699375 100644 --- a/kernel/events/internal.h +++ b/kernel/events/internal.h | |||
@@ -22,6 +22,9 @@ struct ring_buffer { | |||
22 | local_t lost; /* nr records lost */ | 22 | local_t lost; /* nr records lost */ |
23 | 23 | ||
24 | long watermark; /* wakeup watermark */ | 24 | long watermark; /* wakeup watermark */ |
25 | /* poll crap */ | ||
26 | spinlock_t event_lock; | ||
27 | struct list_head event_list; | ||
25 | 28 | ||
26 | struct perf_event_mmap_page *user_page; | 29 | struct perf_event_mmap_page *user_page; |
27 | void *data_pages[0]; | 30 | void *data_pages[0]; |
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index a2a29205cc0f..7f3011c6b57f 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
@@ -209,6 +209,9 @@ ring_buffer_init(struct ring_buffer *rb, long watermark, int flags) | |||
209 | rb->writable = 1; | 209 | rb->writable = 1; |
210 | 210 | ||
211 | atomic_set(&rb->refcount, 1); | 211 | atomic_set(&rb->refcount, 1); |
212 | |||
213 | INIT_LIST_HEAD(&rb->event_list); | ||
214 | spin_lock_init(&rb->event_lock); | ||
212 | } | 215 | } |
213 | 216 | ||
214 | #ifndef CONFIG_PERF_USE_VMALLOC | 217 | #ifndef CONFIG_PERF_USE_VMALLOC |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 0e2b179bc7b3..1da999f5e746 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -623,8 +623,9 @@ static irqreturn_t irq_nested_primary_handler(int irq, void *dev_id) | |||
623 | 623 | ||
624 | static int irq_wait_for_interrupt(struct irqaction *action) | 624 | static int irq_wait_for_interrupt(struct irqaction *action) |
625 | { | 625 | { |
626 | set_current_state(TASK_INTERRUPTIBLE); | ||
627 | |||
626 | while (!kthread_should_stop()) { | 628 | while (!kthread_should_stop()) { |
627 | set_current_state(TASK_INTERRUPTIBLE); | ||
628 | 629 | ||
629 | if (test_and_clear_bit(IRQTF_RUNTHREAD, | 630 | if (test_and_clear_bit(IRQTF_RUNTHREAD, |
630 | &action->thread_flags)) { | 631 | &action->thread_flags)) { |
@@ -632,7 +633,9 @@ static int irq_wait_for_interrupt(struct irqaction *action) | |||
632 | return 0; | 633 | return 0; |
633 | } | 634 | } |
634 | schedule(); | 635 | schedule(); |
636 | set_current_state(TASK_INTERRUPTIBLE); | ||
635 | } | 637 | } |
638 | __set_current_state(TASK_RUNNING); | ||
636 | return -1; | 639 | return -1; |
637 | } | 640 | } |
638 | 641 | ||
diff --git a/kernel/jump_label.c b/kernel/jump_label.c index bbdfe2a462a0..66ff7109f697 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c | |||
@@ -66,8 +66,9 @@ void jump_label_inc(struct jump_label_key *key) | |||
66 | return; | 66 | return; |
67 | 67 | ||
68 | jump_label_lock(); | 68 | jump_label_lock(); |
69 | if (atomic_add_return(1, &key->enabled) == 1) | 69 | if (atomic_read(&key->enabled) == 0) |
70 | jump_label_update(key, JUMP_LABEL_ENABLE); | 70 | jump_label_update(key, JUMP_LABEL_ENABLE); |
71 | atomic_inc(&key->enabled); | ||
71 | jump_label_unlock(); | 72 | jump_label_unlock(); |
72 | } | 73 | } |
73 | 74 | ||
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index e69434b070da..b2e08c932d91 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/stringify.h> | 44 | #include <linux/stringify.h> |
45 | #include <linux/bitops.h> | 45 | #include <linux/bitops.h> |
46 | #include <linux/gfp.h> | 46 | #include <linux/gfp.h> |
47 | #include <linux/kmemcheck.h> | ||
47 | 48 | ||
48 | #include <asm/sections.h> | 49 | #include <asm/sections.h> |
49 | 50 | ||
@@ -2948,7 +2949,12 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this, | |||
2948 | void lockdep_init_map(struct lockdep_map *lock, const char *name, | 2949 | void lockdep_init_map(struct lockdep_map *lock, const char *name, |
2949 | struct lock_class_key *key, int subclass) | 2950 | struct lock_class_key *key, int subclass) |
2950 | { | 2951 | { |
2951 | memset(lock, 0, sizeof(*lock)); | 2952 | int i; |
2953 | |||
2954 | kmemcheck_mark_initialized(lock, sizeof(*lock)); | ||
2955 | |||
2956 | for (i = 0; i < NR_LOCKDEP_CACHING_CLASSES; i++) | ||
2957 | lock->class_cache[i] = NULL; | ||
2952 | 2958 | ||
2953 | #ifdef CONFIG_LOCK_STAT | 2959 | #ifdef CONFIG_LOCK_STAT |
2954 | lock->cpu = raw_smp_processor_id(); | 2960 | lock->cpu = raw_smp_processor_id(); |
diff --git a/kernel/printk.c b/kernel/printk.c index 1455a0d4eedd..7982a0a841ea 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -1293,10 +1293,11 @@ again: | |||
1293 | raw_spin_lock(&logbuf_lock); | 1293 | raw_spin_lock(&logbuf_lock); |
1294 | if (con_start != log_end) | 1294 | if (con_start != log_end) |
1295 | retry = 1; | 1295 | retry = 1; |
1296 | raw_spin_unlock_irqrestore(&logbuf_lock, flags); | ||
1297 | |||
1296 | if (retry && console_trylock()) | 1298 | if (retry && console_trylock()) |
1297 | goto again; | 1299 | goto again; |
1298 | 1300 | ||
1299 | raw_spin_unlock_irqrestore(&logbuf_lock, flags); | ||
1300 | if (wake_klogd) | 1301 | if (wake_klogd) |
1301 | wake_up_klogd(); | 1302 | wake_up_klogd(); |
1302 | } | 1303 | } |
diff --git a/kernel/sched.c b/kernel/sched.c index 0e9344a71be3..d6b149ccf925 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -71,6 +71,7 @@ | |||
71 | #include <linux/ctype.h> | 71 | #include <linux/ctype.h> |
72 | #include <linux/ftrace.h> | 72 | #include <linux/ftrace.h> |
73 | #include <linux/slab.h> | 73 | #include <linux/slab.h> |
74 | #include <linux/init_task.h> | ||
74 | 75 | ||
75 | #include <asm/tlb.h> | 76 | #include <asm/tlb.h> |
76 | #include <asm/irq_regs.h> | 77 | #include <asm/irq_regs.h> |
@@ -4810,6 +4811,9 @@ EXPORT_SYMBOL(wait_for_completion); | |||
4810 | * This waits for either a completion of a specific task to be signaled or for a | 4811 | * This waits for either a completion of a specific task to be signaled or for a |
4811 | * specified timeout to expire. The timeout is in jiffies. It is not | 4812 | * specified timeout to expire. The timeout is in jiffies. It is not |
4812 | * interruptible. | 4813 | * interruptible. |
4814 | * | ||
4815 | * The return value is 0 if timed out, and positive (at least 1, or number of | ||
4816 | * jiffies left till timeout) if completed. | ||
4813 | */ | 4817 | */ |
4814 | unsigned long __sched | 4818 | unsigned long __sched |
4815 | wait_for_completion_timeout(struct completion *x, unsigned long timeout) | 4819 | wait_for_completion_timeout(struct completion *x, unsigned long timeout) |
@@ -4824,6 +4828,8 @@ EXPORT_SYMBOL(wait_for_completion_timeout); | |||
4824 | * | 4828 | * |
4825 | * This waits for completion of a specific task to be signaled. It is | 4829 | * This waits for completion of a specific task to be signaled. It is |
4826 | * interruptible. | 4830 | * interruptible. |
4831 | * | ||
4832 | * The return value is -ERESTARTSYS if interrupted, 0 if completed. | ||
4827 | */ | 4833 | */ |
4828 | int __sched wait_for_completion_interruptible(struct completion *x) | 4834 | int __sched wait_for_completion_interruptible(struct completion *x) |
4829 | { | 4835 | { |
@@ -4841,6 +4847,9 @@ EXPORT_SYMBOL(wait_for_completion_interruptible); | |||
4841 | * | 4847 | * |
4842 | * This waits for either a completion of a specific task to be signaled or for a | 4848 | * This waits for either a completion of a specific task to be signaled or for a |
4843 | * specified timeout to expire. It is interruptible. The timeout is in jiffies. | 4849 | * specified timeout to expire. It is interruptible. The timeout is in jiffies. |
4850 | * | ||
4851 | * The return value is -ERESTARTSYS if interrupted, 0 if timed out, | ||
4852 | * positive (at least 1, or number of jiffies left till timeout) if completed. | ||
4844 | */ | 4853 | */ |
4845 | long __sched | 4854 | long __sched |
4846 | wait_for_completion_interruptible_timeout(struct completion *x, | 4855 | wait_for_completion_interruptible_timeout(struct completion *x, |
@@ -4856,6 +4865,8 @@ EXPORT_SYMBOL(wait_for_completion_interruptible_timeout); | |||
4856 | * | 4865 | * |
4857 | * This waits to be signaled for completion of a specific task. It can be | 4866 | * This waits to be signaled for completion of a specific task. It can be |
4858 | * interrupted by a kill signal. | 4867 | * interrupted by a kill signal. |
4868 | * | ||
4869 | * The return value is -ERESTARTSYS if interrupted, 0 if completed. | ||
4859 | */ | 4870 | */ |
4860 | int __sched wait_for_completion_killable(struct completion *x) | 4871 | int __sched wait_for_completion_killable(struct completion *x) |
4861 | { | 4872 | { |
@@ -4874,6 +4885,9 @@ EXPORT_SYMBOL(wait_for_completion_killable); | |||
4874 | * This waits for either a completion of a specific task to be | 4885 | * This waits for either a completion of a specific task to be |
4875 | * signaled or for a specified timeout to expire. It can be | 4886 | * signaled or for a specified timeout to expire. It can be |
4876 | * interrupted by a kill signal. The timeout is in jiffies. | 4887 | * interrupted by a kill signal. The timeout is in jiffies. |
4888 | * | ||
4889 | * The return value is -ERESTARTSYS if interrupted, 0 if timed out, | ||
4890 | * positive (at least 1, or number of jiffies left till timeout) if completed. | ||
4877 | */ | 4891 | */ |
4878 | long __sched | 4892 | long __sched |
4879 | wait_for_completion_killable_timeout(struct completion *x, | 4893 | wait_for_completion_killable_timeout(struct completion *x, |
@@ -6099,6 +6113,9 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) | |||
6099 | */ | 6113 | */ |
6100 | idle->sched_class = &idle_sched_class; | 6114 | idle->sched_class = &idle_sched_class; |
6101 | ftrace_graph_init_idle_task(idle, cpu); | 6115 | ftrace_graph_init_idle_task(idle, cpu); |
6116 | #if defined(CONFIG_SMP) | ||
6117 | sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu); | ||
6118 | #endif | ||
6102 | } | 6119 | } |
6103 | 6120 | ||
6104 | /* | 6121 | /* |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 5c9e67923b7c..a78ed2736ba7 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -772,19 +772,32 @@ static void update_cfs_load(struct cfs_rq *cfs_rq, int global_update) | |||
772 | list_del_leaf_cfs_rq(cfs_rq); | 772 | list_del_leaf_cfs_rq(cfs_rq); |
773 | } | 773 | } |
774 | 774 | ||
775 | static inline long calc_tg_weight(struct task_group *tg, struct cfs_rq *cfs_rq) | ||
776 | { | ||
777 | long tg_weight; | ||
778 | |||
779 | /* | ||
780 | * Use this CPU's actual weight instead of the last load_contribution | ||
781 | * to gain a more accurate current total weight. See | ||
782 | * update_cfs_rq_load_contribution(). | ||
783 | */ | ||
784 | tg_weight = atomic_read(&tg->load_weight); | ||
785 | tg_weight -= cfs_rq->load_contribution; | ||
786 | tg_weight += cfs_rq->load.weight; | ||
787 | |||
788 | return tg_weight; | ||
789 | } | ||
790 | |||
775 | static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg) | 791 | static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg) |
776 | { | 792 | { |
777 | long load_weight, load, shares; | 793 | long tg_weight, load, shares; |
778 | 794 | ||
795 | tg_weight = calc_tg_weight(tg, cfs_rq); | ||
779 | load = cfs_rq->load.weight; | 796 | load = cfs_rq->load.weight; |
780 | 797 | ||
781 | load_weight = atomic_read(&tg->load_weight); | ||
782 | load_weight += load; | ||
783 | load_weight -= cfs_rq->load_contribution; | ||
784 | |||
785 | shares = (tg->shares * load); | 798 | shares = (tg->shares * load); |
786 | if (load_weight) | 799 | if (tg_weight) |
787 | shares /= load_weight; | 800 | shares /= tg_weight; |
788 | 801 | ||
789 | if (shares < MIN_SHARES) | 802 | if (shares < MIN_SHARES) |
790 | shares = MIN_SHARES; | 803 | shares = MIN_SHARES; |
@@ -1743,7 +1756,7 @@ static void __return_cfs_rq_runtime(struct cfs_rq *cfs_rq) | |||
1743 | 1756 | ||
1744 | static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq) | 1757 | static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq) |
1745 | { | 1758 | { |
1746 | if (!cfs_rq->runtime_enabled || !cfs_rq->nr_running) | 1759 | if (!cfs_rq->runtime_enabled || cfs_rq->nr_running) |
1747 | return; | 1760 | return; |
1748 | 1761 | ||
1749 | __return_cfs_rq_runtime(cfs_rq); | 1762 | __return_cfs_rq_runtime(cfs_rq); |
@@ -2036,36 +2049,100 @@ static void task_waking_fair(struct task_struct *p) | |||
2036 | * Adding load to a group doesn't make a group heavier, but can cause movement | 2049 | * Adding load to a group doesn't make a group heavier, but can cause movement |
2037 | * of group shares between cpus. Assuming the shares were perfectly aligned one | 2050 | * of group shares between cpus. Assuming the shares were perfectly aligned one |
2038 | * can calculate the shift in shares. | 2051 | * can calculate the shift in shares. |
2052 | * | ||
2053 | * Calculate the effective load difference if @wl is added (subtracted) to @tg | ||
2054 | * on this @cpu and results in a total addition (subtraction) of @wg to the | ||
2055 | * total group weight. | ||
2056 | * | ||
2057 | * Given a runqueue weight distribution (rw_i) we can compute a shares | ||
2058 | * distribution (s_i) using: | ||
2059 | * | ||
2060 | * s_i = rw_i / \Sum rw_j (1) | ||
2061 | * | ||
2062 | * Suppose we have 4 CPUs and our @tg is a direct child of the root group and | ||
2063 | * has 7 equal weight tasks, distributed as below (rw_i), with the resulting | ||
2064 | * shares distribution (s_i): | ||
2065 | * | ||
2066 | * rw_i = { 2, 4, 1, 0 } | ||
2067 | * s_i = { 2/7, 4/7, 1/7, 0 } | ||
2068 | * | ||
2069 | * As per wake_affine() we're interested in the load of two CPUs (the CPU the | ||
2070 | * task used to run on and the CPU the waker is running on), we need to | ||
2071 | * compute the effect of waking a task on either CPU and, in case of a sync | ||
2072 | * wakeup, compute the effect of the current task going to sleep. | ||
2073 | * | ||
2074 | * So for a change of @wl to the local @cpu with an overall group weight change | ||
2075 | * of @wl we can compute the new shares distribution (s'_i) using: | ||
2076 | * | ||
2077 | * s'_i = (rw_i + @wl) / (@wg + \Sum rw_j) (2) | ||
2078 | * | ||
2079 | * Suppose we're interested in CPUs 0 and 1, and want to compute the load | ||
2080 | * differences in waking a task to CPU 0. The additional task changes the | ||
2081 | * weight and shares distributions like: | ||
2082 | * | ||
2083 | * rw'_i = { 3, 4, 1, 0 } | ||
2084 | * s'_i = { 3/8, 4/8, 1/8, 0 } | ||
2085 | * | ||
2086 | * We can then compute the difference in effective weight by using: | ||
2087 | * | ||
2088 | * dw_i = S * (s'_i - s_i) (3) | ||
2089 | * | ||
2090 | * Where 'S' is the group weight as seen by its parent. | ||
2091 | * | ||
2092 | * Therefore the effective change in loads on CPU 0 would be 5/56 (3/8 - 2/7) | ||
2093 | * times the weight of the group. The effect on CPU 1 would be -4/56 (4/8 - | ||
2094 | * 4/7) times the weight of the group. | ||
2039 | */ | 2095 | */ |
2040 | static long effective_load(struct task_group *tg, int cpu, long wl, long wg) | 2096 | static long effective_load(struct task_group *tg, int cpu, long wl, long wg) |
2041 | { | 2097 | { |
2042 | struct sched_entity *se = tg->se[cpu]; | 2098 | struct sched_entity *se = tg->se[cpu]; |
2043 | 2099 | ||
2044 | if (!tg->parent) | 2100 | if (!tg->parent) /* the trivial, non-cgroup case */ |
2045 | return wl; | 2101 | return wl; |
2046 | 2102 | ||
2047 | for_each_sched_entity(se) { | 2103 | for_each_sched_entity(se) { |
2048 | long lw, w; | 2104 | long w, W; |
2049 | 2105 | ||
2050 | tg = se->my_q->tg; | 2106 | tg = se->my_q->tg; |
2051 | w = se->my_q->load.weight; | ||
2052 | 2107 | ||
2053 | /* use this cpu's instantaneous contribution */ | 2108 | /* |
2054 | lw = atomic_read(&tg->load_weight); | 2109 | * W = @wg + \Sum rw_j |
2055 | lw -= se->my_q->load_contribution; | 2110 | */ |
2056 | lw += w + wg; | 2111 | W = wg + calc_tg_weight(tg, se->my_q); |
2057 | 2112 | ||
2058 | wl += w; | 2113 | /* |
2114 | * w = rw_i + @wl | ||
2115 | */ | ||
2116 | w = se->my_q->load.weight + wl; | ||
2059 | 2117 | ||
2060 | if (lw > 0 && wl < lw) | 2118 | /* |
2061 | wl = (wl * tg->shares) / lw; | 2119 | * wl = S * s'_i; see (2) |
2120 | */ | ||
2121 | if (W > 0 && w < W) | ||
2122 | wl = (w * tg->shares) / W; | ||
2062 | else | 2123 | else |
2063 | wl = tg->shares; | 2124 | wl = tg->shares; |
2064 | 2125 | ||
2065 | /* zero point is MIN_SHARES */ | 2126 | /* |
2127 | * Per the above, wl is the new se->load.weight value; since | ||
2128 | * those are clipped to [MIN_SHARES, ...) do so now. See | ||
2129 | * calc_cfs_shares(). | ||
2130 | */ | ||
2066 | if (wl < MIN_SHARES) | 2131 | if (wl < MIN_SHARES) |
2067 | wl = MIN_SHARES; | 2132 | wl = MIN_SHARES; |
2133 | |||
2134 | /* | ||
2135 | * wl = dw_i = S * (s'_i - s_i); see (3) | ||
2136 | */ | ||
2068 | wl -= se->load.weight; | 2137 | wl -= se->load.weight; |
2138 | |||
2139 | /* | ||
2140 | * Recursively apply this logic to all parent groups to compute | ||
2141 | * the final effective load change on the root group. Since | ||
2142 | * only the @tg group gets extra weight, all parent groups can | ||
2143 | * only redistribute existing shares. @wl is the shift in shares | ||
2144 | * resulting from this level per the above. | ||
2145 | */ | ||
2069 | wg = 0; | 2146 | wg = 0; |
2070 | } | 2147 | } |
2071 | 2148 | ||
@@ -2249,7 +2326,8 @@ static int select_idle_sibling(struct task_struct *p, int target) | |||
2249 | int cpu = smp_processor_id(); | 2326 | int cpu = smp_processor_id(); |
2250 | int prev_cpu = task_cpu(p); | 2327 | int prev_cpu = task_cpu(p); |
2251 | struct sched_domain *sd; | 2328 | struct sched_domain *sd; |
2252 | int i; | 2329 | struct sched_group *sg; |
2330 | int i, smt = 0; | ||
2253 | 2331 | ||
2254 | /* | 2332 | /* |
2255 | * If the task is going to be woken-up on this cpu and if it is | 2333 | * If the task is going to be woken-up on this cpu and if it is |
@@ -2269,25 +2347,38 @@ static int select_idle_sibling(struct task_struct *p, int target) | |||
2269 | * Otherwise, iterate the domains and find an elegible idle cpu. | 2347 | * Otherwise, iterate the domains and find an elegible idle cpu. |
2270 | */ | 2348 | */ |
2271 | rcu_read_lock(); | 2349 | rcu_read_lock(); |
2350 | again: | ||
2272 | for_each_domain(target, sd) { | 2351 | for_each_domain(target, sd) { |
2273 | if (!(sd->flags & SD_SHARE_PKG_RESOURCES)) | 2352 | if (!smt && (sd->flags & SD_SHARE_CPUPOWER)) |
2274 | break; | 2353 | continue; |
2275 | 2354 | ||
2276 | for_each_cpu_and(i, sched_domain_span(sd), tsk_cpus_allowed(p)) { | 2355 | if (!(sd->flags & SD_SHARE_PKG_RESOURCES)) { |
2277 | if (idle_cpu(i)) { | 2356 | if (!smt) { |
2278 | target = i; | 2357 | smt = 1; |
2279 | break; | 2358 | goto again; |
2280 | } | 2359 | } |
2360 | break; | ||
2281 | } | 2361 | } |
2282 | 2362 | ||
2283 | /* | 2363 | sg = sd->groups; |
2284 | * Lets stop looking for an idle sibling when we reached | 2364 | do { |
2285 | * the domain that spans the current cpu and prev_cpu. | 2365 | if (!cpumask_intersects(sched_group_cpus(sg), |
2286 | */ | 2366 | tsk_cpus_allowed(p))) |
2287 | if (cpumask_test_cpu(cpu, sched_domain_span(sd)) && | 2367 | goto next; |
2288 | cpumask_test_cpu(prev_cpu, sched_domain_span(sd))) | 2368 | |
2289 | break; | 2369 | for_each_cpu(i, sched_group_cpus(sg)) { |
2370 | if (!idle_cpu(i)) | ||
2371 | goto next; | ||
2372 | } | ||
2373 | |||
2374 | target = cpumask_first_and(sched_group_cpus(sg), | ||
2375 | tsk_cpus_allowed(p)); | ||
2376 | goto done; | ||
2377 | next: | ||
2378 | sg = sg->next; | ||
2379 | } while (sg != sd->groups); | ||
2290 | } | 2380 | } |
2381 | done: | ||
2291 | rcu_read_unlock(); | 2382 | rcu_read_unlock(); |
2292 | 2383 | ||
2293 | return target; | 2384 | return target; |
@@ -3511,7 +3602,7 @@ static bool update_sd_pick_busiest(struct sched_domain *sd, | |||
3511 | } | 3602 | } |
3512 | 3603 | ||
3513 | /** | 3604 | /** |
3514 | * update_sd_lb_stats - Update sched_group's statistics for load balancing. | 3605 | * update_sd_lb_stats - Update sched_domain's statistics for load balancing. |
3515 | * @sd: sched_domain whose statistics are to be updated. | 3606 | * @sd: sched_domain whose statistics are to be updated. |
3516 | * @this_cpu: Cpu for which load balance is currently performed. | 3607 | * @this_cpu: Cpu for which load balance is currently performed. |
3517 | * @idle: Idle status of this_cpu | 3608 | * @idle: Idle status of this_cpu |
diff --git a/kernel/sched_features.h b/kernel/sched_features.h index efa0a7b75dde..84802245abd2 100644 --- a/kernel/sched_features.h +++ b/kernel/sched_features.h | |||
@@ -67,3 +67,4 @@ SCHED_FEAT(NONTASK_POWER, 1) | |||
67 | SCHED_FEAT(TTWU_QUEUE, 1) | 67 | SCHED_FEAT(TTWU_QUEUE, 1) |
68 | 68 | ||
69 | SCHED_FEAT(FORCE_SD_OVERLAP, 0) | 69 | SCHED_FEAT(FORCE_SD_OVERLAP, 0) |
70 | SCHED_FEAT(RT_RUNTIME_SHARE, 1) | ||
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index 056cbd2e2a27..583a1368afe6 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
@@ -560,6 +560,9 @@ static int balance_runtime(struct rt_rq *rt_rq) | |||
560 | { | 560 | { |
561 | int more = 0; | 561 | int more = 0; |
562 | 562 | ||
563 | if (!sched_feat(RT_RUNTIME_SHARE)) | ||
564 | return more; | ||
565 | |||
563 | if (rt_rq->rt_time > rt_rq->rt_runtime) { | 566 | if (rt_rq->rt_time > rt_rq->rt_runtime) { |
564 | raw_spin_unlock(&rt_rq->rt_runtime_lock); | 567 | raw_spin_unlock(&rt_rq->rt_runtime_lock); |
565 | more = do_balance_runtime(rt_rq); | 568 | more = do_balance_runtime(rt_rq); |
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index c436e790b21b..8a46f5d64504 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c | |||
@@ -195,7 +195,7 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer) | |||
195 | struct alarm *alarm; | 195 | struct alarm *alarm; |
196 | ktime_t expired = next->expires; | 196 | ktime_t expired = next->expires; |
197 | 197 | ||
198 | if (expired.tv64 >= now.tv64) | 198 | if (expired.tv64 > now.tv64) |
199 | break; | 199 | break; |
200 | 200 | ||
201 | alarm = container_of(next, struct alarm, node); | 201 | alarm = container_of(next, struct alarm, node); |
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 1ecd6ba36d6c..c4eb71c8b2ea 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
@@ -387,6 +387,7 @@ void clockevents_exchange_device(struct clock_event_device *old, | |||
387 | * released list and do a notify add later. | 387 | * released list and do a notify add later. |
388 | */ | 388 | */ |
389 | if (old) { | 389 | if (old) { |
390 | old->event_handler = clockevents_handle_noop; | ||
390 | clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED); | 391 | clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED); |
391 | list_del(&old->list); | 392 | list_del(&old->list); |
392 | list_add(&old->list, &clockevents_released); | 393 | list_add(&old->list, &clockevents_released); |
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index cfc65e1eb9fb..da2f760e780c 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c | |||
@@ -548,7 +548,7 @@ static u64 clocksource_max_deferment(struct clocksource *cs) | |||
548 | * note a margin of 12.5% is used because this can be computed with | 548 | * note a margin of 12.5% is used because this can be computed with |
549 | * a shift, versus say 10% which would require division. | 549 | * a shift, versus say 10% which would require division. |
550 | */ | 550 | */ |
551 | return max_nsecs - (max_nsecs >> 5); | 551 | return max_nsecs - (max_nsecs >> 3); |
552 | } | 552 | } |
553 | 553 | ||
554 | #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET | 554 | #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET |
@@ -669,7 +669,7 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq) | |||
669 | * ~ 0.06ppm granularity for NTP. We apply the same 12.5% | 669 | * ~ 0.06ppm granularity for NTP. We apply the same 12.5% |
670 | * margin as we do in clocksource_max_deferment() | 670 | * margin as we do in clocksource_max_deferment() |
671 | */ | 671 | */ |
672 | sec = (cs->mask - (cs->mask >> 5)); | 672 | sec = (cs->mask - (cs->mask >> 3)); |
673 | do_div(sec, freq); | 673 | do_div(sec, freq); |
674 | do_div(sec, scale); | 674 | do_div(sec, scale); |
675 | if (!sec) | 675 | if (!sec) |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index f954282d9a82..fd4a7b1625a2 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -71,7 +71,7 @@ int tick_check_broadcast_device(struct clock_event_device *dev) | |||
71 | (dev->features & CLOCK_EVT_FEAT_C3STOP)) | 71 | (dev->features & CLOCK_EVT_FEAT_C3STOP)) |
72 | return 0; | 72 | return 0; |
73 | 73 | ||
74 | clockevents_exchange_device(NULL, dev); | 74 | clockevents_exchange_device(tick_broadcast_device.evtdev, dev); |
75 | tick_broadcast_device.evtdev = dev; | 75 | tick_broadcast_device.evtdev = dev; |
76 | if (!cpumask_empty(tick_get_broadcast_mask())) | 76 | if (!cpumask_empty(tick_get_broadcast_mask())) |
77 | tick_broadcast_start_periodic(dev); | 77 | tick_broadcast_start_periodic(dev); |
diff --git a/kernel/timer.c b/kernel/timer.c index dbaa62422b13..9c3c62b0c4bc 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -1368,7 +1368,7 @@ SYSCALL_DEFINE0(getppid) | |||
1368 | int pid; | 1368 | int pid; |
1369 | 1369 | ||
1370 | rcu_read_lock(); | 1370 | rcu_read_lock(); |
1371 | pid = task_tgid_vnr(current->real_parent); | 1371 | pid = task_tgid_vnr(rcu_dereference(current->real_parent)); |
1372 | rcu_read_unlock(); | 1372 | rcu_read_unlock(); |
1373 | 1373 | ||
1374 | return pid; | 1374 | return pid; |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 900b409543db..b1e8943fed1d 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -152,7 +152,6 @@ void clear_ftrace_function(void) | |||
152 | ftrace_pid_function = ftrace_stub; | 152 | ftrace_pid_function = ftrace_stub; |
153 | } | 153 | } |
154 | 154 | ||
155 | #undef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST | ||
156 | #ifndef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST | 155 | #ifndef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST |
157 | /* | 156 | /* |
158 | * For those archs that do not test ftrace_trace_stop in their | 157 | * For those archs that do not test ftrace_trace_stop in their |
@@ -1212,7 +1211,9 @@ ftrace_hash_move(struct ftrace_ops *ops, int enable, | |||
1212 | if (!src->count) { | 1211 | if (!src->count) { |
1213 | free_ftrace_hash_rcu(*dst); | 1212 | free_ftrace_hash_rcu(*dst); |
1214 | rcu_assign_pointer(*dst, EMPTY_HASH); | 1213 | rcu_assign_pointer(*dst, EMPTY_HASH); |
1215 | return 0; | 1214 | /* still need to update the function records */ |
1215 | ret = 0; | ||
1216 | goto out; | ||
1216 | } | 1217 | } |
1217 | 1218 | ||
1218 | /* | 1219 | /* |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 581876f9f387..c212a7f934ec 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -1078,7 +1078,6 @@ event_subsystem_dir(const char *name, struct dentry *d_events) | |||
1078 | /* First see if we did not already create this dir */ | 1078 | /* First see if we did not already create this dir */ |
1079 | list_for_each_entry(system, &event_subsystems, list) { | 1079 | list_for_each_entry(system, &event_subsystems, list) { |
1080 | if (strcmp(system->name, name) == 0) { | 1080 | if (strcmp(system->name, name) == 0) { |
1081 | __get_system(system); | ||
1082 | system->nr_events++; | 1081 | system->nr_events++; |
1083 | return system->entry; | 1082 | return system->entry; |
1084 | } | 1083 | } |
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 816d3d074979..95dc31efd6dd 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c | |||
@@ -1649,7 +1649,9 @@ static int replace_system_preds(struct event_subsystem *system, | |||
1649 | */ | 1649 | */ |
1650 | err = replace_preds(call, NULL, ps, filter_string, true); | 1650 | err = replace_preds(call, NULL, ps, filter_string, true); |
1651 | if (err) | 1651 | if (err) |
1652 | goto fail; | 1652 | call->flags |= TRACE_EVENT_FL_NO_SET_FILTER; |
1653 | else | ||
1654 | call->flags &= ~TRACE_EVENT_FL_NO_SET_FILTER; | ||
1653 | } | 1655 | } |
1654 | 1656 | ||
1655 | list_for_each_entry(call, &ftrace_events, list) { | 1657 | list_for_each_entry(call, &ftrace_events, list) { |
@@ -1658,6 +1660,9 @@ static int replace_system_preds(struct event_subsystem *system, | |||
1658 | if (strcmp(call->class->system, system->name) != 0) | 1660 | if (strcmp(call->class->system, system->name) != 0) |
1659 | continue; | 1661 | continue; |
1660 | 1662 | ||
1663 | if (call->flags & TRACE_EVENT_FL_NO_SET_FILTER) | ||
1664 | continue; | ||
1665 | |||
1661 | filter_item = kzalloc(sizeof(*filter_item), GFP_KERNEL); | 1666 | filter_item = kzalloc(sizeof(*filter_item), GFP_KERNEL); |
1662 | if (!filter_item) | 1667 | if (!filter_item) |
1663 | goto fail_mem; | 1668 | goto fail_mem; |
@@ -1686,7 +1691,7 @@ static int replace_system_preds(struct event_subsystem *system, | |||
1686 | * replace the filter for the call. | 1691 | * replace the filter for the call. |
1687 | */ | 1692 | */ |
1688 | filter = call->filter; | 1693 | filter = call->filter; |
1689 | call->filter = filter_item->filter; | 1694 | rcu_assign_pointer(call->filter, filter_item->filter); |
1690 | filter_item->filter = filter; | 1695 | filter_item->filter = filter; |
1691 | 1696 | ||
1692 | fail = false; | 1697 | fail = false; |
@@ -1741,7 +1746,7 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string) | |||
1741 | filter = call->filter; | 1746 | filter = call->filter; |
1742 | if (!filter) | 1747 | if (!filter) |
1743 | goto out_unlock; | 1748 | goto out_unlock; |
1744 | call->filter = NULL; | 1749 | RCU_INIT_POINTER(call->filter, NULL); |
1745 | /* Make sure the filter is not being used */ | 1750 | /* Make sure the filter is not being used */ |
1746 | synchronize_sched(); | 1751 | synchronize_sched(); |
1747 | __free_filter(filter); | 1752 | __free_filter(filter); |
@@ -1782,7 +1787,7 @@ out: | |||
1782 | * string | 1787 | * string |
1783 | */ | 1788 | */ |
1784 | tmp = call->filter; | 1789 | tmp = call->filter; |
1785 | call->filter = filter; | 1790 | rcu_assign_pointer(call->filter, filter); |
1786 | if (tmp) { | 1791 | if (tmp) { |
1787 | /* Make sure the call is done with the filter */ | 1792 | /* Make sure the call is done with the filter */ |
1788 | synchronize_sched(); | 1793 | synchronize_sched(); |
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 74c6c7fce749..fea790a2b176 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -245,7 +245,7 @@ static void put_hash_bucket(struct hash_bucket *bucket, | |||
245 | 245 | ||
246 | static bool exact_match(struct dma_debug_entry *a, struct dma_debug_entry *b) | 246 | static bool exact_match(struct dma_debug_entry *a, struct dma_debug_entry *b) |
247 | { | 247 | { |
248 | return ((a->dev_addr == a->dev_addr) && | 248 | return ((a->dev_addr == b->dev_addr) && |
249 | (a->dev == b->dev)) ? true : false; | 249 | (a->dev == b->dev)) ? true : false; |
250 | } | 250 | } |
251 | 251 | ||
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 4298abaae153..36b3d988b4ef 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -2259,12 +2259,8 @@ static void khugepaged_do_scan(struct page **hpage) | |||
2259 | 2259 | ||
2260 | static void khugepaged_alloc_sleep(void) | 2260 | static void khugepaged_alloc_sleep(void) |
2261 | { | 2261 | { |
2262 | DEFINE_WAIT(wait); | 2262 | wait_event_freezable_timeout(khugepaged_wait, false, |
2263 | add_wait_queue(&khugepaged_wait, &wait); | 2263 | msecs_to_jiffies(khugepaged_alloc_sleep_millisecs)); |
2264 | schedule_timeout_interruptible( | ||
2265 | msecs_to_jiffies( | ||
2266 | khugepaged_alloc_sleep_millisecs)); | ||
2267 | remove_wait_queue(&khugepaged_wait, &wait); | ||
2268 | } | 2264 | } |
2269 | 2265 | ||
2270 | #ifndef CONFIG_NUMA | 2266 | #ifndef CONFIG_NUMA |
@@ -2313,14 +2309,10 @@ static void khugepaged_loop(void) | |||
2313 | if (unlikely(kthread_should_stop())) | 2309 | if (unlikely(kthread_should_stop())) |
2314 | break; | 2310 | break; |
2315 | if (khugepaged_has_work()) { | 2311 | if (khugepaged_has_work()) { |
2316 | DEFINE_WAIT(wait); | ||
2317 | if (!khugepaged_scan_sleep_millisecs) | 2312 | if (!khugepaged_scan_sleep_millisecs) |
2318 | continue; | 2313 | continue; |
2319 | add_wait_queue(&khugepaged_wait, &wait); | 2314 | wait_event_freezable_timeout(khugepaged_wait, false, |
2320 | schedule_timeout_interruptible( | 2315 | msecs_to_jiffies(khugepaged_scan_sleep_millisecs)); |
2321 | msecs_to_jiffies( | ||
2322 | khugepaged_scan_sleep_millisecs)); | ||
2323 | remove_wait_queue(&khugepaged_wait, &wait); | ||
2324 | } else if (khugepaged_enabled()) | 2316 | } else if (khugepaged_enabled()) |
2325 | wait_event_freezable(khugepaged_wait, | 2317 | wait_event_freezable(khugepaged_wait, |
2326 | khugepaged_wait_event()); | 2318 | khugepaged_wait_event()); |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index bb28a5f9db8d..73f17c0293c0 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -576,6 +576,7 @@ static void prep_compound_gigantic_page(struct page *page, unsigned long order) | |||
576 | __SetPageHead(page); | 576 | __SetPageHead(page); |
577 | for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) { | 577 | for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) { |
578 | __SetPageTail(p); | 578 | __SetPageTail(p); |
579 | set_page_count(p, 0); | ||
579 | p->first_page = page; | 580 | p->first_page = page; |
580 | } | 581 | } |
581 | } | 582 | } |
diff --git a/mm/migrate.c b/mm/migrate.c index 578e29174fa6..177aca424a06 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -871,9 +871,9 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, | |||
871 | 871 | ||
872 | if (anon_vma) | 872 | if (anon_vma) |
873 | put_anon_vma(anon_vma); | 873 | put_anon_vma(anon_vma); |
874 | out: | ||
875 | unlock_page(hpage); | 874 | unlock_page(hpage); |
876 | 875 | ||
876 | out: | ||
877 | if (rc != -EAGAIN) { | 877 | if (rc != -EAGAIN) { |
878 | list_del(&hpage->lru); | 878 | list_del(&hpage->lru); |
879 | put_page(hpage); | 879 | put_page(hpage); |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9dd443d89d8b..2b8ba3aebf6e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -356,8 +356,8 @@ void prep_compound_page(struct page *page, unsigned long order) | |||
356 | __SetPageHead(page); | 356 | __SetPageHead(page); |
357 | for (i = 1; i < nr_pages; i++) { | 357 | for (i = 1; i < nr_pages; i++) { |
358 | struct page *p = page + i; | 358 | struct page *p = page + i; |
359 | |||
360 | __SetPageTail(p); | 359 | __SetPageTail(p); |
360 | set_page_count(p, 0); | ||
361 | p->first_page = page; | 361 | p->first_page = page; |
362 | } | 362 | } |
363 | } | 363 | } |
@@ -3377,9 +3377,15 @@ static void setup_zone_migrate_reserve(struct zone *zone) | |||
3377 | unsigned long block_migratetype; | 3377 | unsigned long block_migratetype; |
3378 | int reserve; | 3378 | int reserve; |
3379 | 3379 | ||
3380 | /* Get the start pfn, end pfn and the number of blocks to reserve */ | 3380 | /* |
3381 | * Get the start pfn, end pfn and the number of blocks to reserve | ||
3382 | * We have to be careful to be aligned to pageblock_nr_pages to | ||
3383 | * make sure that we always check pfn_valid for the first page in | ||
3384 | * the block. | ||
3385 | */ | ||
3381 | start_pfn = zone->zone_start_pfn; | 3386 | start_pfn = zone->zone_start_pfn; |
3382 | end_pfn = start_pfn + zone->spanned_pages; | 3387 | end_pfn = start_pfn + zone->spanned_pages; |
3388 | start_pfn = roundup(start_pfn, pageblock_nr_pages); | ||
3383 | reserve = roundup(min_wmark_pages(zone), pageblock_nr_pages) >> | 3389 | reserve = roundup(min_wmark_pages(zone), pageblock_nr_pages) >> |
3384 | pageblock_order; | 3390 | pageblock_order; |
3385 | 3391 | ||
@@ -595,6 +595,7 @@ static enum { | |||
595 | PARTIAL_AC, | 595 | PARTIAL_AC, |
596 | PARTIAL_L3, | 596 | PARTIAL_L3, |
597 | EARLY, | 597 | EARLY, |
598 | LATE, | ||
598 | FULL | 599 | FULL |
599 | } g_cpucache_up; | 600 | } g_cpucache_up; |
600 | 601 | ||
@@ -671,7 +672,7 @@ static void init_node_lock_keys(int q) | |||
671 | { | 672 | { |
672 | struct cache_sizes *s = malloc_sizes; | 673 | struct cache_sizes *s = malloc_sizes; |
673 | 674 | ||
674 | if (g_cpucache_up != FULL) | 675 | if (g_cpucache_up < LATE) |
675 | return; | 676 | return; |
676 | 677 | ||
677 | for (s = malloc_sizes; s->cs_size != ULONG_MAX; s++) { | 678 | for (s = malloc_sizes; s->cs_size != ULONG_MAX; s++) { |
@@ -1666,6 +1667,8 @@ void __init kmem_cache_init_late(void) | |||
1666 | { | 1667 | { |
1667 | struct kmem_cache *cachep; | 1668 | struct kmem_cache *cachep; |
1668 | 1669 | ||
1670 | g_cpucache_up = LATE; | ||
1671 | |||
1669 | /* Annotate slab for lockdep -- annotate the malloc caches */ | 1672 | /* Annotate slab for lockdep -- annotate the malloc caches */ |
1670 | init_lock_keys(); | 1673 | init_lock_keys(); |
1671 | 1674 | ||
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index e583f770dfee..f87577042a86 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -1658,6 +1658,8 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, | |||
1658 | goto fail; | 1658 | goto fail; |
1659 | 1659 | ||
1660 | addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller); | 1660 | addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller); |
1661 | if (!addr) | ||
1662 | return NULL; | ||
1661 | 1663 | ||
1662 | /* | 1664 | /* |
1663 | * In this function, newly allocated vm_struct is not added | 1665 | * In this function, newly allocated vm_struct is not added |
diff --git a/mm/vmscan.c b/mm/vmscan.c index a1893c050795..f54a05b7a61d 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -183,7 +183,7 @@ static unsigned long zone_nr_lru_pages(struct zone *zone, | |||
183 | */ | 183 | */ |
184 | void register_shrinker(struct shrinker *shrinker) | 184 | void register_shrinker(struct shrinker *shrinker) |
185 | { | 185 | { |
186 | shrinker->nr = 0; | 186 | atomic_long_set(&shrinker->nr_in_batch, 0); |
187 | down_write(&shrinker_rwsem); | 187 | down_write(&shrinker_rwsem); |
188 | list_add_tail(&shrinker->list, &shrinker_list); | 188 | list_add_tail(&shrinker->list, &shrinker_list); |
189 | up_write(&shrinker_rwsem); | 189 | up_write(&shrinker_rwsem); |
@@ -247,25 +247,26 @@ unsigned long shrink_slab(struct shrink_control *shrink, | |||
247 | 247 | ||
248 | list_for_each_entry(shrinker, &shrinker_list, list) { | 248 | list_for_each_entry(shrinker, &shrinker_list, list) { |
249 | unsigned long long delta; | 249 | unsigned long long delta; |
250 | unsigned long total_scan; | 250 | long total_scan; |
251 | unsigned long max_pass; | 251 | long max_pass; |
252 | int shrink_ret = 0; | 252 | int shrink_ret = 0; |
253 | long nr; | 253 | long nr; |
254 | long new_nr; | 254 | long new_nr; |
255 | long batch_size = shrinker->batch ? shrinker->batch | 255 | long batch_size = shrinker->batch ? shrinker->batch |
256 | : SHRINK_BATCH; | 256 | : SHRINK_BATCH; |
257 | 257 | ||
258 | max_pass = do_shrinker_shrink(shrinker, shrink, 0); | ||
259 | if (max_pass <= 0) | ||
260 | continue; | ||
261 | |||
258 | /* | 262 | /* |
259 | * copy the current shrinker scan count into a local variable | 263 | * copy the current shrinker scan count into a local variable |
260 | * and zero it so that other concurrent shrinker invocations | 264 | * and zero it so that other concurrent shrinker invocations |
261 | * don't also do this scanning work. | 265 | * don't also do this scanning work. |
262 | */ | 266 | */ |
263 | do { | 267 | nr = atomic_long_xchg(&shrinker->nr_in_batch, 0); |
264 | nr = shrinker->nr; | ||
265 | } while (cmpxchg(&shrinker->nr, nr, 0) != nr); | ||
266 | 268 | ||
267 | total_scan = nr; | 269 | total_scan = nr; |
268 | max_pass = do_shrinker_shrink(shrinker, shrink, 0); | ||
269 | delta = (4 * nr_pages_scanned) / shrinker->seeks; | 270 | delta = (4 * nr_pages_scanned) / shrinker->seeks; |
270 | delta *= max_pass; | 271 | delta *= max_pass; |
271 | do_div(delta, lru_pages + 1); | 272 | do_div(delta, lru_pages + 1); |
@@ -325,12 +326,11 @@ unsigned long shrink_slab(struct shrink_control *shrink, | |||
325 | * manner that handles concurrent updates. If we exhausted the | 326 | * manner that handles concurrent updates. If we exhausted the |
326 | * scan, there is no need to do an update. | 327 | * scan, there is no need to do an update. |
327 | */ | 328 | */ |
328 | do { | 329 | if (total_scan > 0) |
329 | nr = shrinker->nr; | 330 | new_nr = atomic_long_add_return(total_scan, |
330 | new_nr = total_scan + nr; | 331 | &shrinker->nr_in_batch); |
331 | if (total_scan <= 0) | 332 | else |
332 | break; | 333 | new_nr = atomic_long_read(&shrinker->nr_in_batch); |
333 | } while (cmpxchg(&shrinker->nr, nr, new_nr) != nr); | ||
334 | 334 | ||
335 | trace_mm_shrink_slab_end(shrinker, shrink_ret, nr, new_nr); | 335 | trace_mm_shrink_slab_end(shrinker, shrink_ret, nr, new_nr); |
336 | } | 336 | } |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index e5f9ece3c9a0..a1daf8227ed1 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <net/sock.h> | 18 | #include <net/sock.h> |
19 | 19 | ||
20 | #include "br_private.h" | 20 | #include "br_private.h" |
21 | #include "br_private_stp.h" | ||
21 | 22 | ||
22 | static inline size_t br_nlmsg_size(void) | 23 | static inline size_t br_nlmsg_size(void) |
23 | { | 24 | { |
@@ -188,6 +189,11 @@ static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | |||
188 | 189 | ||
189 | p->state = new_state; | 190 | p->state = new_state; |
190 | br_log_state(p); | 191 | br_log_state(p); |
192 | |||
193 | spin_lock_bh(&p->br->lock); | ||
194 | br_port_state_selection(p->br); | ||
195 | spin_unlock_bh(&p->br->lock); | ||
196 | |||
191 | br_ifinfo_notify(RTM_NEWLINK, p); | 197 | br_ifinfo_notify(RTM_NEWLINK, p); |
192 | 198 | ||
193 | return 0; | 199 | return 0; |
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c index ad0a3f7cf6cc..dd147d78a588 100644 --- a/net/bridge/br_stp.c +++ b/net/bridge/br_stp.c | |||
@@ -399,25 +399,24 @@ void br_port_state_selection(struct net_bridge *br) | |||
399 | struct net_bridge_port *p; | 399 | struct net_bridge_port *p; |
400 | unsigned int liveports = 0; | 400 | unsigned int liveports = 0; |
401 | 401 | ||
402 | /* Don't change port states if userspace is handling STP */ | ||
403 | if (br->stp_enabled == BR_USER_STP) | ||
404 | return; | ||
405 | |||
406 | list_for_each_entry(p, &br->port_list, list) { | 402 | list_for_each_entry(p, &br->port_list, list) { |
407 | if (p->state == BR_STATE_DISABLED) | 403 | if (p->state == BR_STATE_DISABLED) |
408 | continue; | 404 | continue; |
409 | 405 | ||
410 | if (p->port_no == br->root_port) { | 406 | /* Don't change port states if userspace is handling STP */ |
411 | p->config_pending = 0; | 407 | if (br->stp_enabled != BR_USER_STP) { |
412 | p->topology_change_ack = 0; | 408 | if (p->port_no == br->root_port) { |
413 | br_make_forwarding(p); | 409 | p->config_pending = 0; |
414 | } else if (br_is_designated_port(p)) { | 410 | p->topology_change_ack = 0; |
415 | del_timer(&p->message_age_timer); | 411 | br_make_forwarding(p); |
416 | br_make_forwarding(p); | 412 | } else if (br_is_designated_port(p)) { |
417 | } else { | 413 | del_timer(&p->message_age_timer); |
418 | p->config_pending = 0; | 414 | br_make_forwarding(p); |
419 | p->topology_change_ack = 0; | 415 | } else { |
420 | br_make_blocking(p); | 416 | p->config_pending = 0; |
417 | p->topology_change_ack = 0; | ||
418 | br_make_blocking(p); | ||
419 | } | ||
421 | } | 420 | } |
422 | 421 | ||
423 | if (p->state == BR_STATE_FORWARDING) | 422 | if (p->state == BR_STATE_FORWARDING) |
diff --git a/net/caif/cffrml.c b/net/caif/cffrml.c index f39921171d0d..d3ca87bf23b7 100644 --- a/net/caif/cffrml.c +++ b/net/caif/cffrml.c | |||
@@ -136,20 +136,21 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt) | |||
136 | 136 | ||
137 | static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt) | 137 | static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt) |
138 | { | 138 | { |
139 | int tmp; | ||
140 | u16 chks; | 139 | u16 chks; |
141 | u16 len; | 140 | u16 len; |
141 | __le16 data; | ||
142 | |||
142 | struct cffrml *this = container_obj(layr); | 143 | struct cffrml *this = container_obj(layr); |
143 | if (this->dofcs) { | 144 | if (this->dofcs) { |
144 | chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff); | 145 | chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff); |
145 | tmp = cpu_to_le16(chks); | 146 | data = cpu_to_le16(chks); |
146 | cfpkt_add_trail(pkt, &tmp, 2); | 147 | cfpkt_add_trail(pkt, &data, 2); |
147 | } else { | 148 | } else { |
148 | cfpkt_pad_trail(pkt, 2); | 149 | cfpkt_pad_trail(pkt, 2); |
149 | } | 150 | } |
150 | len = cfpkt_getlen(pkt); | 151 | len = cfpkt_getlen(pkt); |
151 | tmp = cpu_to_le16(len); | 152 | data = cpu_to_le16(len); |
152 | cfpkt_add_head(pkt, &tmp, 2); | 153 | cfpkt_add_head(pkt, &data, 2); |
153 | cfpkt_info(pkt)->hdr_len += 2; | 154 | cfpkt_info(pkt)->hdr_len += 2; |
154 | if (cfpkt_erroneous(pkt)) { | 155 | if (cfpkt_erroneous(pkt)) { |
155 | pr_err("Packet is erroneous!\n"); | 156 | pr_err("Packet is erroneous!\n"); |
diff --git a/net/core/dev.c b/net/core/dev.c index 6ba50a1e404c..5a13edfc9f73 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1396,7 +1396,7 @@ rollback: | |||
1396 | for_each_net(net) { | 1396 | for_each_net(net) { |
1397 | for_each_netdev(net, dev) { | 1397 | for_each_netdev(net, dev) { |
1398 | if (dev == last) | 1398 | if (dev == last) |
1399 | break; | 1399 | goto outroll; |
1400 | 1400 | ||
1401 | if (dev->flags & IFF_UP) { | 1401 | if (dev->flags & IFF_UP) { |
1402 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); | 1402 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); |
@@ -1407,6 +1407,7 @@ rollback: | |||
1407 | } | 1407 | } |
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | outroll: | ||
1410 | raw_notifier_chain_unregister(&netdev_chain, nb); | 1411 | raw_notifier_chain_unregister(&netdev_chain, nb); |
1411 | goto unlock; | 1412 | goto unlock; |
1412 | } | 1413 | } |
@@ -4282,6 +4283,12 @@ static int dev_seq_open(struct inode *inode, struct file *file) | |||
4282 | sizeof(struct dev_iter_state)); | 4283 | sizeof(struct dev_iter_state)); |
4283 | } | 4284 | } |
4284 | 4285 | ||
4286 | int dev_seq_open_ops(struct inode *inode, struct file *file, | ||
4287 | const struct seq_operations *ops) | ||
4288 | { | ||
4289 | return seq_open_net(inode, file, ops, sizeof(struct dev_iter_state)); | ||
4290 | } | ||
4291 | |||
4285 | static const struct file_operations dev_seq_fops = { | 4292 | static const struct file_operations dev_seq_fops = { |
4286 | .owner = THIS_MODULE, | 4293 | .owner = THIS_MODULE, |
4287 | .open = dev_seq_open, | 4294 | .open = dev_seq_open, |
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c index 277faef9148d..febba516db62 100644 --- a/net/core/dev_addr_lists.c +++ b/net/core/dev_addr_lists.c | |||
@@ -696,8 +696,7 @@ static const struct seq_operations dev_mc_seq_ops = { | |||
696 | 696 | ||
697 | static int dev_mc_seq_open(struct inode *inode, struct file *file) | 697 | static int dev_mc_seq_open(struct inode *inode, struct file *file) |
698 | { | 698 | { |
699 | return seq_open_net(inode, file, &dev_mc_seq_ops, | 699 | return dev_seq_open_ops(inode, file, &dev_mc_seq_ops); |
700 | sizeof(struct seq_net_private)); | ||
701 | } | 700 | } |
702 | 701 | ||
703 | static const struct file_operations dev_mc_seq_fops = { | 702 | static const struct file_operations dev_mc_seq_fops = { |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 039d51e6c284..5ac07d31fbc9 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -2397,7 +2397,10 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq, | |||
2397 | struct net *net = seq_file_net(seq); | 2397 | struct net *net = seq_file_net(seq); |
2398 | struct neigh_table *tbl = state->tbl; | 2398 | struct neigh_table *tbl = state->tbl; |
2399 | 2399 | ||
2400 | pn = pn->next; | 2400 | do { |
2401 | pn = pn->next; | ||
2402 | } while (pn && !net_eq(pneigh_net(pn), net)); | ||
2403 | |||
2401 | while (!pn) { | 2404 | while (!pn) { |
2402 | if (++state->bucket > PNEIGH_HASHMASK) | 2405 | if (++state->bucket > PNEIGH_HASHMASK) |
2403 | break; | 2406 | break; |
diff --git a/net/core/request_sock.c b/net/core/request_sock.c index 182236b2510a..9b570a6a33c5 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c | |||
@@ -26,10 +26,11 @@ | |||
26 | * but then some measure against one socket starving all other sockets | 26 | * but then some measure against one socket starving all other sockets |
27 | * would be needed. | 27 | * would be needed. |
28 | * | 28 | * |
29 | * It was 128 by default. Experiments with real servers show, that | 29 | * The minimum value of it is 128. Experiments with real servers show that |
30 | * it is absolutely not enough even at 100conn/sec. 256 cures most | 30 | * it is absolutely not enough even at 100conn/sec. 256 cures most |
31 | * of problems. This value is adjusted to 128 for very small machines | 31 | * of problems. |
32 | * (<=32Mb of memory) and to 1024 on normal or better ones (>=256Mb). | 32 | * This value is adjusted to 128 for low memory machines, |
33 | * and it will increase in proportion to the memory of machine. | ||
33 | * Note : Dont forget somaxconn that may limit backlog too. | 34 | * Note : Dont forget somaxconn that may limit backlog too. |
34 | */ | 35 | */ |
35 | int sysctl_max_syn_backlog = 256; | 36 | int sysctl_max_syn_backlog = 256; |
diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c index 025233de25f9..925991ae6f52 100644 --- a/net/core/secure_seq.c +++ b/net/core/secure_seq.c | |||
@@ -19,6 +19,7 @@ static int __init net_secret_init(void) | |||
19 | } | 19 | } |
20 | late_initcall(net_secret_init); | 20 | late_initcall(net_secret_init); |
21 | 21 | ||
22 | #ifdef CONFIG_INET | ||
22 | static u32 seq_scale(u32 seq) | 23 | static u32 seq_scale(u32 seq) |
23 | { | 24 | { |
24 | /* | 25 | /* |
@@ -33,6 +34,7 @@ static u32 seq_scale(u32 seq) | |||
33 | */ | 34 | */ |
34 | return seq + (ktime_to_ns(ktime_get_real()) >> 6); | 35 | return seq + (ktime_to_ns(ktime_get_real()) >> 6); |
35 | } | 36 | } |
37 | #endif | ||
36 | 38 | ||
37 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 39 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
38 | __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, | 40 | __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 18a3cebb753d..3c30ee4a5710 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2230,7 +2230,7 @@ static int skb_prepare_for_shift(struct sk_buff *skb) | |||
2230 | * @shiftlen: shift up to this many bytes | 2230 | * @shiftlen: shift up to this many bytes |
2231 | * | 2231 | * |
2232 | * Attempts to shift up to shiftlen worth of bytes, which may be less than | 2232 | * Attempts to shift up to shiftlen worth of bytes, which may be less than |
2233 | * the length of the skb, from tgt to skb. Returns number bytes shifted. | 2233 | * the length of the skb, from skb to tgt. Returns number bytes shifted. |
2234 | * It's up to caller to free skb if everything was shifted. | 2234 | * It's up to caller to free skb if everything was shifted. |
2235 | * | 2235 | * |
2236 | * If @tgt runs out of frags, the whole operation is aborted. | 2236 | * If @tgt runs out of frags, the whole operation is aborted. |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 90a919afbed7..3f4e5414c8e5 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -111,6 +111,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
111 | rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, | 111 | rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, |
112 | inet->inet_sport, inet->inet_dport, sk); | 112 | inet->inet_sport, inet->inet_dport, sk); |
113 | if (IS_ERR(rt)) { | 113 | if (IS_ERR(rt)) { |
114 | err = PTR_ERR(rt); | ||
114 | rt = NULL; | 115 | rt = NULL; |
115 | goto failure; | 116 | goto failure; |
116 | } | 117 | } |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index a77d16158eb6..94f4ec036669 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -112,7 +112,7 @@ static unsigned long dn_rt_deadline; | |||
112 | static int dn_dst_gc(struct dst_ops *ops); | 112 | static int dn_dst_gc(struct dst_ops *ops); |
113 | static struct dst_entry *dn_dst_check(struct dst_entry *, __u32); | 113 | static struct dst_entry *dn_dst_check(struct dst_entry *, __u32); |
114 | static unsigned int dn_dst_default_advmss(const struct dst_entry *dst); | 114 | static unsigned int dn_dst_default_advmss(const struct dst_entry *dst); |
115 | static unsigned int dn_dst_default_mtu(const struct dst_entry *dst); | 115 | static unsigned int dn_dst_mtu(const struct dst_entry *dst); |
116 | static void dn_dst_destroy(struct dst_entry *); | 116 | static void dn_dst_destroy(struct dst_entry *); |
117 | static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); | 117 | static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); |
118 | static void dn_dst_link_failure(struct sk_buff *); | 118 | static void dn_dst_link_failure(struct sk_buff *); |
@@ -135,7 +135,7 @@ static struct dst_ops dn_dst_ops = { | |||
135 | .gc = dn_dst_gc, | 135 | .gc = dn_dst_gc, |
136 | .check = dn_dst_check, | 136 | .check = dn_dst_check, |
137 | .default_advmss = dn_dst_default_advmss, | 137 | .default_advmss = dn_dst_default_advmss, |
138 | .default_mtu = dn_dst_default_mtu, | 138 | .mtu = dn_dst_mtu, |
139 | .cow_metrics = dst_cow_metrics_generic, | 139 | .cow_metrics = dst_cow_metrics_generic, |
140 | .destroy = dn_dst_destroy, | 140 | .destroy = dn_dst_destroy, |
141 | .negative_advice = dn_dst_negative_advice, | 141 | .negative_advice = dn_dst_negative_advice, |
@@ -825,9 +825,11 @@ static unsigned int dn_dst_default_advmss(const struct dst_entry *dst) | |||
825 | return dn_mss_from_pmtu(dst->dev, dst_mtu(dst)); | 825 | return dn_mss_from_pmtu(dst->dev, dst_mtu(dst)); |
826 | } | 826 | } |
827 | 827 | ||
828 | static unsigned int dn_dst_default_mtu(const struct dst_entry *dst) | 828 | static unsigned int dn_dst_mtu(const struct dst_entry *dst) |
829 | { | 829 | { |
830 | return dst->dev->mtu; | 830 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
831 | |||
832 | return mtu ? : dst->dev->mtu; | ||
831 | } | 833 | } |
832 | 834 | ||
833 | static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) | 835 | static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) |
diff --git a/net/decnet/dn_timer.c b/net/decnet/dn_timer.c index 67f691bd4acf..d9c150cc59a9 100644 --- a/net/decnet/dn_timer.c +++ b/net/decnet/dn_timer.c | |||
@@ -36,16 +36,13 @@ static void dn_slow_timer(unsigned long arg); | |||
36 | 36 | ||
37 | void dn_start_slow_timer(struct sock *sk) | 37 | void dn_start_slow_timer(struct sock *sk) |
38 | { | 38 | { |
39 | sk->sk_timer.expires = jiffies + SLOW_INTERVAL; | 39 | setup_timer(&sk->sk_timer, dn_slow_timer, (unsigned long)sk); |
40 | sk->sk_timer.function = dn_slow_timer; | 40 | sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL); |
41 | sk->sk_timer.data = (unsigned long)sk; | ||
42 | |||
43 | add_timer(&sk->sk_timer); | ||
44 | } | 41 | } |
45 | 42 | ||
46 | void dn_stop_slow_timer(struct sock *sk) | 43 | void dn_stop_slow_timer(struct sock *sk) |
47 | { | 44 | { |
48 | del_timer(&sk->sk_timer); | 45 | sk_stop_timer(sk, &sk->sk_timer); |
49 | } | 46 | } |
50 | 47 | ||
51 | static void dn_slow_timer(unsigned long arg) | 48 | static void dn_slow_timer(unsigned long arg) |
@@ -53,12 +50,10 @@ static void dn_slow_timer(unsigned long arg) | |||
53 | struct sock *sk = (struct sock *)arg; | 50 | struct sock *sk = (struct sock *)arg; |
54 | struct dn_scp *scp = DN_SK(sk); | 51 | struct dn_scp *scp = DN_SK(sk); |
55 | 52 | ||
56 | sock_hold(sk); | ||
57 | bh_lock_sock(sk); | 53 | bh_lock_sock(sk); |
58 | 54 | ||
59 | if (sock_owned_by_user(sk)) { | 55 | if (sock_owned_by_user(sk)) { |
60 | sk->sk_timer.expires = jiffies + HZ / 10; | 56 | sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ / 10); |
61 | add_timer(&sk->sk_timer); | ||
62 | goto out; | 57 | goto out; |
63 | } | 58 | } |
64 | 59 | ||
@@ -100,9 +95,7 @@ static void dn_slow_timer(unsigned long arg) | |||
100 | scp->keepalive_fxn(sk); | 95 | scp->keepalive_fxn(sk); |
101 | } | 96 | } |
102 | 97 | ||
103 | sk->sk_timer.expires = jiffies + SLOW_INTERVAL; | 98 | sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL); |
104 | |||
105 | add_timer(&sk->sk_timer); | ||
106 | out: | 99 | out: |
107 | bh_unlock_sock(sk); | 100 | bh_unlock_sock(sk); |
108 | sock_put(sk); | 101 | sock_put(sk); |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index c6b5092f29a1..65f01dc47565 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1490,7 +1490,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write, | |||
1490 | void __user *buffer, | 1490 | void __user *buffer, |
1491 | size_t *lenp, loff_t *ppos) | 1491 | size_t *lenp, loff_t *ppos) |
1492 | { | 1492 | { |
1493 | int old_value = *(int *)ctl->data; | ||
1493 | int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); | 1494 | int ret = proc_dointvec(ctl, write, buffer, lenp, ppos); |
1495 | int new_value = *(int *)ctl->data; | ||
1494 | 1496 | ||
1495 | if (write) { | 1497 | if (write) { |
1496 | struct ipv4_devconf *cnf = ctl->extra1; | 1498 | struct ipv4_devconf *cnf = ctl->extra1; |
@@ -1501,6 +1503,9 @@ static int devinet_conf_proc(ctl_table *ctl, int write, | |||
1501 | 1503 | ||
1502 | if (cnf == net->ipv4.devconf_dflt) | 1504 | if (cnf == net->ipv4.devconf_dflt) |
1503 | devinet_copy_dflt_conf(net, i); | 1505 | devinet_copy_dflt_conf(net, i); |
1506 | if (i == IPV4_DEVCONF_ACCEPT_LOCAL - 1) | ||
1507 | if ((new_value == 0) && (old_value != 0)) | ||
1508 | rt_cache_flush(net, 0); | ||
1504 | } | 1509 | } |
1505 | 1510 | ||
1506 | return ret; | 1511 | return ret; |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index c7472eff2d51..b2ca095cb9da 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -1716,7 +1716,8 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode, | |||
1716 | if (err) { | 1716 | if (err) { |
1717 | int j; | 1717 | int j; |
1718 | 1718 | ||
1719 | pmc->sfcount[sfmode]--; | 1719 | if (!delta) |
1720 | pmc->sfcount[sfmode]--; | ||
1720 | for (j=0; j<i; j++) | 1721 | for (j=0; j<i; j++) |
1721 | (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]); | 1722 | (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]); |
1722 | } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { | 1723 | } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 68e8ac514383..ccee270a9b65 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -108,9 +108,6 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
108 | icsk->icsk_ca_ops->name); | 108 | icsk->icsk_ca_ops->name); |
109 | } | 109 | } |
110 | 110 | ||
111 | if ((ext & (1 << (INET_DIAG_TOS - 1))) && (sk->sk_family != AF_INET6)) | ||
112 | RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos); | ||
113 | |||
114 | r->idiag_family = sk->sk_family; | 111 | r->idiag_family = sk->sk_family; |
115 | r->idiag_state = sk->sk_state; | 112 | r->idiag_state = sk->sk_state; |
116 | r->idiag_timer = 0; | 113 | r->idiag_timer = 0; |
@@ -125,16 +122,23 @@ static int inet_csk_diag_fill(struct sock *sk, | |||
125 | r->id.idiag_src[0] = inet->inet_rcv_saddr; | 122 | r->id.idiag_src[0] = inet->inet_rcv_saddr; |
126 | r->id.idiag_dst[0] = inet->inet_daddr; | 123 | r->id.idiag_dst[0] = inet->inet_daddr; |
127 | 124 | ||
125 | /* IPv6 dual-stack sockets use inet->tos for IPv4 connections, | ||
126 | * hence this needs to be included regardless of socket family. | ||
127 | */ | ||
128 | if (ext & (1 << (INET_DIAG_TOS - 1))) | ||
129 | RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos); | ||
130 | |||
128 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 131 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
129 | if (r->idiag_family == AF_INET6) { | 132 | if (r->idiag_family == AF_INET6) { |
130 | const struct ipv6_pinfo *np = inet6_sk(sk); | 133 | const struct ipv6_pinfo *np = inet6_sk(sk); |
131 | 134 | ||
135 | if (ext & (1 << (INET_DIAG_TCLASS - 1))) | ||
136 | RTA_PUT_U8(skb, INET_DIAG_TCLASS, np->tclass); | ||
137 | |||
132 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, | 138 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, |
133 | &np->rcv_saddr); | 139 | &np->rcv_saddr); |
134 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, | 140 | ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, |
135 | &np->daddr); | 141 | &np->daddr); |
136 | if (ext & (1 << (INET_DIAG_TCLASS - 1))) | ||
137 | RTA_PUT_U8(skb, INET_DIAG_TCLASS, np->tclass); | ||
138 | } | 142 | } |
139 | #endif | 143 | #endif |
140 | 144 | ||
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index 3b34d1c86270..29a07b6c7168 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c | |||
@@ -84,7 +84,7 @@ int ip_forward(struct sk_buff *skb) | |||
84 | 84 | ||
85 | rt = skb_rtable(skb); | 85 | rt = skb_rtable(skb); |
86 | 86 | ||
87 | if (opt->is_strictroute && ip_hdr(skb)->daddr != rt->rt_gateway) | 87 | if (opt->is_strictroute && opt->nexthop != rt->rt_gateway) |
88 | goto sr_failed; | 88 | goto sr_failed; |
89 | 89 | ||
90 | if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) && | 90 | if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) && |
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index 05d20cca9d66..1e60f7679075 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -568,12 +568,13 @@ void ip_forward_options(struct sk_buff *skb) | |||
568 | ) { | 568 | ) { |
569 | if (srrptr + 3 > srrspace) | 569 | if (srrptr + 3 > srrspace) |
570 | break; | 570 | break; |
571 | if (memcmp(&ip_hdr(skb)->daddr, &optptr[srrptr-1], 4) == 0) | 571 | if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0) |
572 | break; | 572 | break; |
573 | } | 573 | } |
574 | if (srrptr + 3 <= srrspace) { | 574 | if (srrptr + 3 <= srrspace) { |
575 | opt->is_changed = 1; | 575 | opt->is_changed = 1; |
576 | ip_rt_get_source(&optptr[srrptr-1], skb, rt); | 576 | ip_rt_get_source(&optptr[srrptr-1], skb, rt); |
577 | ip_hdr(skb)->daddr = opt->nexthop; | ||
577 | optptr[2] = srrptr+4; | 578 | optptr[2] = srrptr+4; |
578 | } else if (net_ratelimit()) | 579 | } else if (net_ratelimit()) |
579 | printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n"); | 580 | printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n"); |
@@ -640,7 +641,7 @@ int ip_options_rcv_srr(struct sk_buff *skb) | |||
640 | } | 641 | } |
641 | if (srrptr <= srrspace) { | 642 | if (srrptr <= srrspace) { |
642 | opt->srr_is_hit = 1; | 643 | opt->srr_is_hit = 1; |
643 | iph->daddr = nexthop; | 644 | opt->nexthop = nexthop; |
644 | opt->is_changed = 1; | 645 | opt->is_changed = 1; |
645 | } | 646 | } |
646 | return 0; | 647 | return 0; |
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c index 9899619ab9b8..4f47e064e262 100644 --- a/net/ipv4/netfilter.c +++ b/net/ipv4/netfilter.c | |||
@@ -64,7 +64,8 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type) | |||
64 | /* Change in oif may mean change in hh_len. */ | 64 | /* Change in oif may mean change in hh_len. */ |
65 | hh_len = skb_dst(skb)->dev->hard_header_len; | 65 | hh_len = skb_dst(skb)->dev->hard_header_len; |
66 | if (skb_headroom(skb) < hh_len && | 66 | if (skb_headroom(skb) < hh_len && |
67 | pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC)) | 67 | pskb_expand_head(skb, HH_DATA_ALIGN(hh_len - skb_headroom(skb)), |
68 | 0, GFP_ATOMIC)) | ||
68 | return -1; | 69 | return -1; |
69 | 70 | ||
70 | return 0; | 71 | return 0; |
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig index 1dfc18a03fd4..f19f2182894c 100644 --- a/net/ipv4/netfilter/Kconfig +++ b/net/ipv4/netfilter/Kconfig | |||
@@ -325,7 +325,6 @@ config IP_NF_TARGET_TTL | |||
325 | # raw + specific targets | 325 | # raw + specific targets |
326 | config IP_NF_RAW | 326 | config IP_NF_RAW |
327 | tristate 'raw table support (required for NOTRACK/TRACE)' | 327 | tristate 'raw table support (required for NOTRACK/TRACE)' |
328 | depends on NETFILTER_ADVANCED | ||
329 | help | 328 | help |
330 | This option adds a `raw' table to iptables. This table is the very | 329 | This option adds a `raw' table to iptables. This table is the very |
331 | first in the netfilter framework and hooks in at the PREROUTING | 330 | first in the netfilter framework and hooks in at the PREROUTING |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 0c74da8a0473..46af62363b8c 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -112,7 +112,7 @@ | |||
112 | #include <net/secure_seq.h> | 112 | #include <net/secure_seq.h> |
113 | 113 | ||
114 | #define RT_FL_TOS(oldflp4) \ | 114 | #define RT_FL_TOS(oldflp4) \ |
115 | ((u32)(oldflp4->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK))) | 115 | ((oldflp4)->flowi4_tos & (IPTOS_RT_MASK | RTO_ONLINK)) |
116 | 116 | ||
117 | #define IP_MAX_MTU 0xFFF0 | 117 | #define IP_MAX_MTU 0xFFF0 |
118 | 118 | ||
@@ -131,6 +131,7 @@ static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ; | |||
131 | static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; | 131 | static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; |
132 | static int ip_rt_min_advmss __read_mostly = 256; | 132 | static int ip_rt_min_advmss __read_mostly = 256; |
133 | static int rt_chain_length_max __read_mostly = 20; | 133 | static int rt_chain_length_max __read_mostly = 20; |
134 | static int redirect_genid; | ||
134 | 135 | ||
135 | /* | 136 | /* |
136 | * Interface to generic destination cache. | 137 | * Interface to generic destination cache. |
@@ -138,7 +139,7 @@ static int rt_chain_length_max __read_mostly = 20; | |||
138 | 139 | ||
139 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie); | 140 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie); |
140 | static unsigned int ipv4_default_advmss(const struct dst_entry *dst); | 141 | static unsigned int ipv4_default_advmss(const struct dst_entry *dst); |
141 | static unsigned int ipv4_default_mtu(const struct dst_entry *dst); | 142 | static unsigned int ipv4_mtu(const struct dst_entry *dst); |
142 | static void ipv4_dst_destroy(struct dst_entry *dst); | 143 | static void ipv4_dst_destroy(struct dst_entry *dst); |
143 | static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); | 144 | static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); |
144 | static void ipv4_link_failure(struct sk_buff *skb); | 145 | static void ipv4_link_failure(struct sk_buff *skb); |
@@ -193,7 +194,7 @@ static struct dst_ops ipv4_dst_ops = { | |||
193 | .gc = rt_garbage_collect, | 194 | .gc = rt_garbage_collect, |
194 | .check = ipv4_dst_check, | 195 | .check = ipv4_dst_check, |
195 | .default_advmss = ipv4_default_advmss, | 196 | .default_advmss = ipv4_default_advmss, |
196 | .default_mtu = ipv4_default_mtu, | 197 | .mtu = ipv4_mtu, |
197 | .cow_metrics = ipv4_cow_metrics, | 198 | .cow_metrics = ipv4_cow_metrics, |
198 | .destroy = ipv4_dst_destroy, | 199 | .destroy = ipv4_dst_destroy, |
199 | .ifdown = ipv4_dst_ifdown, | 200 | .ifdown = ipv4_dst_ifdown, |
@@ -416,9 +417,13 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) | |||
416 | else { | 417 | else { |
417 | struct rtable *r = v; | 418 | struct rtable *r = v; |
418 | struct neighbour *n; | 419 | struct neighbour *n; |
419 | int len; | 420 | int len, HHUptod; |
420 | 421 | ||
422 | rcu_read_lock(); | ||
421 | n = dst_get_neighbour(&r->dst); | 423 | n = dst_get_neighbour(&r->dst); |
424 | HHUptod = (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0; | ||
425 | rcu_read_unlock(); | ||
426 | |||
422 | seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t" | 427 | seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t" |
423 | "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n", | 428 | "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n", |
424 | r->dst.dev ? r->dst.dev->name : "*", | 429 | r->dst.dev ? r->dst.dev->name : "*", |
@@ -432,7 +437,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v) | |||
432 | dst_metric(&r->dst, RTAX_RTTVAR)), | 437 | dst_metric(&r->dst, RTAX_RTTVAR)), |
433 | r->rt_key_tos, | 438 | r->rt_key_tos, |
434 | -1, | 439 | -1, |
435 | (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0, | 440 | HHUptod, |
436 | r->rt_spec_dst, &len); | 441 | r->rt_spec_dst, &len); |
437 | 442 | ||
438 | seq_printf(seq, "%*s\n", 127 - len, ""); | 443 | seq_printf(seq, "%*s\n", 127 - len, ""); |
@@ -837,6 +842,7 @@ static void rt_cache_invalidate(struct net *net) | |||
837 | 842 | ||
838 | get_random_bytes(&shuffle, sizeof(shuffle)); | 843 | get_random_bytes(&shuffle, sizeof(shuffle)); |
839 | atomic_add(shuffle + 1U, &net->ipv4.rt_genid); | 844 | atomic_add(shuffle + 1U, &net->ipv4.rt_genid); |
845 | redirect_genid++; | ||
840 | } | 846 | } |
841 | 847 | ||
842 | /* | 848 | /* |
@@ -1304,7 +1310,7 @@ static void rt_del(unsigned hash, struct rtable *rt) | |||
1304 | spin_unlock_bh(rt_hash_lock_addr(hash)); | 1310 | spin_unlock_bh(rt_hash_lock_addr(hash)); |
1305 | } | 1311 | } |
1306 | 1312 | ||
1307 | static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer) | 1313 | static void check_peer_redir(struct dst_entry *dst, struct inet_peer *peer) |
1308 | { | 1314 | { |
1309 | struct rtable *rt = (struct rtable *) dst; | 1315 | struct rtable *rt = (struct rtable *) dst; |
1310 | __be32 orig_gw = rt->rt_gateway; | 1316 | __be32 orig_gw = rt->rt_gateway; |
@@ -1315,21 +1321,19 @@ static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer) | |||
1315 | rt->rt_gateway = peer->redirect_learned.a4; | 1321 | rt->rt_gateway = peer->redirect_learned.a4; |
1316 | 1322 | ||
1317 | n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway); | 1323 | n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway); |
1318 | if (IS_ERR(n)) | 1324 | if (IS_ERR(n)) { |
1319 | return PTR_ERR(n); | 1325 | rt->rt_gateway = orig_gw; |
1326 | return; | ||
1327 | } | ||
1320 | old_n = xchg(&rt->dst._neighbour, n); | 1328 | old_n = xchg(&rt->dst._neighbour, n); |
1321 | if (old_n) | 1329 | if (old_n) |
1322 | neigh_release(old_n); | 1330 | neigh_release(old_n); |
1323 | if (!n || !(n->nud_state & NUD_VALID)) { | 1331 | if (!(n->nud_state & NUD_VALID)) { |
1324 | if (n) | 1332 | neigh_event_send(n, NULL); |
1325 | neigh_event_send(n, NULL); | ||
1326 | rt->rt_gateway = orig_gw; | ||
1327 | return -EAGAIN; | ||
1328 | } else { | 1333 | } else { |
1329 | rt->rt_flags |= RTCF_REDIRECTED; | 1334 | rt->rt_flags |= RTCF_REDIRECTED; |
1330 | call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n); | 1335 | call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n); |
1331 | } | 1336 | } |
1332 | return 0; | ||
1333 | } | 1337 | } |
1334 | 1338 | ||
1335 | /* called in rcu_read_lock() section */ | 1339 | /* called in rcu_read_lock() section */ |
@@ -1391,8 +1395,10 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1391 | 1395 | ||
1392 | peer = rt->peer; | 1396 | peer = rt->peer; |
1393 | if (peer) { | 1397 | if (peer) { |
1394 | if (peer->redirect_learned.a4 != new_gw) { | 1398 | if (peer->redirect_learned.a4 != new_gw || |
1399 | peer->redirect_genid != redirect_genid) { | ||
1395 | peer->redirect_learned.a4 = new_gw; | 1400 | peer->redirect_learned.a4 = new_gw; |
1401 | peer->redirect_genid = redirect_genid; | ||
1396 | atomic_inc(&__rt_peer_genid); | 1402 | atomic_inc(&__rt_peer_genid); |
1397 | } | 1403 | } |
1398 | check_peer_redir(&rt->dst, peer); | 1404 | check_peer_redir(&rt->dst, peer); |
@@ -1685,12 +1691,8 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu) | |||
1685 | } | 1691 | } |
1686 | 1692 | ||
1687 | 1693 | ||
1688 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | 1694 | static void ipv4_validate_peer(struct rtable *rt) |
1689 | { | 1695 | { |
1690 | struct rtable *rt = (struct rtable *) dst; | ||
1691 | |||
1692 | if (rt_is_expired(rt)) | ||
1693 | return NULL; | ||
1694 | if (rt->rt_peer_genid != rt_peer_genid()) { | 1696 | if (rt->rt_peer_genid != rt_peer_genid()) { |
1695 | struct inet_peer *peer; | 1697 | struct inet_peer *peer; |
1696 | 1698 | ||
@@ -1699,17 +1701,26 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | |||
1699 | 1701 | ||
1700 | peer = rt->peer; | 1702 | peer = rt->peer; |
1701 | if (peer) { | 1703 | if (peer) { |
1702 | check_peer_pmtu(dst, peer); | 1704 | check_peer_pmtu(&rt->dst, peer); |
1703 | 1705 | ||
1706 | if (peer->redirect_genid != redirect_genid) | ||
1707 | peer->redirect_learned.a4 = 0; | ||
1704 | if (peer->redirect_learned.a4 && | 1708 | if (peer->redirect_learned.a4 && |
1705 | peer->redirect_learned.a4 != rt->rt_gateway) { | 1709 | peer->redirect_learned.a4 != rt->rt_gateway) |
1706 | if (check_peer_redir(dst, peer)) | 1710 | check_peer_redir(&rt->dst, peer); |
1707 | return NULL; | ||
1708 | } | ||
1709 | } | 1711 | } |
1710 | 1712 | ||
1711 | rt->rt_peer_genid = rt_peer_genid(); | 1713 | rt->rt_peer_genid = rt_peer_genid(); |
1712 | } | 1714 | } |
1715 | } | ||
1716 | |||
1717 | static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) | ||
1718 | { | ||
1719 | struct rtable *rt = (struct rtable *) dst; | ||
1720 | |||
1721 | if (rt_is_expired(rt)) | ||
1722 | return NULL; | ||
1723 | ipv4_validate_peer(rt); | ||
1713 | return dst; | 1724 | return dst; |
1714 | } | 1725 | } |
1715 | 1726 | ||
@@ -1814,12 +1825,17 @@ static unsigned int ipv4_default_advmss(const struct dst_entry *dst) | |||
1814 | return advmss; | 1825 | return advmss; |
1815 | } | 1826 | } |
1816 | 1827 | ||
1817 | static unsigned int ipv4_default_mtu(const struct dst_entry *dst) | 1828 | static unsigned int ipv4_mtu(const struct dst_entry *dst) |
1818 | { | 1829 | { |
1819 | unsigned int mtu = dst->dev->mtu; | 1830 | const struct rtable *rt = (const struct rtable *) dst; |
1831 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | ||
1832 | |||
1833 | if (mtu && rt_is_output_route(rt)) | ||
1834 | return mtu; | ||
1835 | |||
1836 | mtu = dst->dev->mtu; | ||
1820 | 1837 | ||
1821 | if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { | 1838 | if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { |
1822 | const struct rtable *rt = (const struct rtable *) dst; | ||
1823 | 1839 | ||
1824 | if (rt->rt_gateway != rt->rt_dst && mtu > 576) | 1840 | if (rt->rt_gateway != rt->rt_dst && mtu > 576) |
1825 | mtu = 576; | 1841 | mtu = 576; |
@@ -1852,6 +1868,8 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4, | |||
1852 | dst_init_metrics(&rt->dst, peer->metrics, false); | 1868 | dst_init_metrics(&rt->dst, peer->metrics, false); |
1853 | 1869 | ||
1854 | check_peer_pmtu(&rt->dst, peer); | 1870 | check_peer_pmtu(&rt->dst, peer); |
1871 | if (peer->redirect_genid != redirect_genid) | ||
1872 | peer->redirect_learned.a4 = 0; | ||
1855 | if (peer->redirect_learned.a4 && | 1873 | if (peer->redirect_learned.a4 && |
1856 | peer->redirect_learned.a4 != rt->rt_gateway) { | 1874 | peer->redirect_learned.a4 != rt->rt_gateway) { |
1857 | rt->rt_gateway = peer->redirect_learned.a4; | 1875 | rt->rt_gateway = peer->redirect_learned.a4; |
@@ -2357,6 +2375,7 @@ int ip_route_input_common(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2357 | rth->rt_mark == skb->mark && | 2375 | rth->rt_mark == skb->mark && |
2358 | net_eq(dev_net(rth->dst.dev), net) && | 2376 | net_eq(dev_net(rth->dst.dev), net) && |
2359 | !rt_is_expired(rth)) { | 2377 | !rt_is_expired(rth)) { |
2378 | ipv4_validate_peer(rth); | ||
2360 | if (noref) { | 2379 | if (noref) { |
2361 | dst_use_noref(&rth->dst, jiffies); | 2380 | dst_use_noref(&rth->dst, jiffies); |
2362 | skb_dst_set_noref(skb, &rth->dst); | 2381 | skb_dst_set_noref(skb, &rth->dst); |
@@ -2415,11 +2434,11 @@ EXPORT_SYMBOL(ip_route_input_common); | |||
2415 | static struct rtable *__mkroute_output(const struct fib_result *res, | 2434 | static struct rtable *__mkroute_output(const struct fib_result *res, |
2416 | const struct flowi4 *fl4, | 2435 | const struct flowi4 *fl4, |
2417 | __be32 orig_daddr, __be32 orig_saddr, | 2436 | __be32 orig_daddr, __be32 orig_saddr, |
2418 | int orig_oif, struct net_device *dev_out, | 2437 | int orig_oif, __u8 orig_rtos, |
2438 | struct net_device *dev_out, | ||
2419 | unsigned int flags) | 2439 | unsigned int flags) |
2420 | { | 2440 | { |
2421 | struct fib_info *fi = res->fi; | 2441 | struct fib_info *fi = res->fi; |
2422 | u32 tos = RT_FL_TOS(fl4); | ||
2423 | struct in_device *in_dev; | 2442 | struct in_device *in_dev; |
2424 | u16 type = res->type; | 2443 | u16 type = res->type; |
2425 | struct rtable *rth; | 2444 | struct rtable *rth; |
@@ -2470,7 +2489,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
2470 | rth->rt_genid = rt_genid(dev_net(dev_out)); | 2489 | rth->rt_genid = rt_genid(dev_net(dev_out)); |
2471 | rth->rt_flags = flags; | 2490 | rth->rt_flags = flags; |
2472 | rth->rt_type = type; | 2491 | rth->rt_type = type; |
2473 | rth->rt_key_tos = tos; | 2492 | rth->rt_key_tos = orig_rtos; |
2474 | rth->rt_dst = fl4->daddr; | 2493 | rth->rt_dst = fl4->daddr; |
2475 | rth->rt_src = fl4->saddr; | 2494 | rth->rt_src = fl4->saddr; |
2476 | rth->rt_route_iif = 0; | 2495 | rth->rt_route_iif = 0; |
@@ -2520,7 +2539,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res, | |||
2520 | static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) | 2539 | static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) |
2521 | { | 2540 | { |
2522 | struct net_device *dev_out = NULL; | 2541 | struct net_device *dev_out = NULL; |
2523 | u32 tos = RT_FL_TOS(fl4); | 2542 | __u8 tos = RT_FL_TOS(fl4); |
2524 | unsigned int flags = 0; | 2543 | unsigned int flags = 0; |
2525 | struct fib_result res; | 2544 | struct fib_result res; |
2526 | struct rtable *rth; | 2545 | struct rtable *rth; |
@@ -2696,7 +2715,7 @@ static struct rtable *ip_route_output_slow(struct net *net, struct flowi4 *fl4) | |||
2696 | 2715 | ||
2697 | make_route: | 2716 | make_route: |
2698 | rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif, | 2717 | rth = __mkroute_output(&res, fl4, orig_daddr, orig_saddr, orig_oif, |
2699 | dev_out, flags); | 2718 | tos, dev_out, flags); |
2700 | if (!IS_ERR(rth)) { | 2719 | if (!IS_ERR(rth)) { |
2701 | unsigned int hash; | 2720 | unsigned int hash; |
2702 | 2721 | ||
@@ -2732,6 +2751,7 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *flp4) | |||
2732 | (IPTOS_RT_MASK | RTO_ONLINK)) && | 2751 | (IPTOS_RT_MASK | RTO_ONLINK)) && |
2733 | net_eq(dev_net(rth->dst.dev), net) && | 2752 | net_eq(dev_net(rth->dst.dev), net) && |
2734 | !rt_is_expired(rth)) { | 2753 | !rt_is_expired(rth)) { |
2754 | ipv4_validate_peer(rth); | ||
2735 | dst_use(&rth->dst, jiffies); | 2755 | dst_use(&rth->dst, jiffies); |
2736 | RT_CACHE_STAT_INC(out_hit); | 2756 | RT_CACHE_STAT_INC(out_hit); |
2737 | rcu_read_unlock_bh(); | 2757 | rcu_read_unlock_bh(); |
@@ -2755,9 +2775,11 @@ static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 coo | |||
2755 | return NULL; | 2775 | return NULL; |
2756 | } | 2776 | } |
2757 | 2777 | ||
2758 | static unsigned int ipv4_blackhole_default_mtu(const struct dst_entry *dst) | 2778 | static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst) |
2759 | { | 2779 | { |
2760 | return 0; | 2780 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
2781 | |||
2782 | return mtu ? : dst->dev->mtu; | ||
2761 | } | 2783 | } |
2762 | 2784 | ||
2763 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 2785 | static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
@@ -2775,7 +2797,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = { | |||
2775 | .protocol = cpu_to_be16(ETH_P_IP), | 2797 | .protocol = cpu_to_be16(ETH_P_IP), |
2776 | .destroy = ipv4_dst_destroy, | 2798 | .destroy = ipv4_dst_destroy, |
2777 | .check = ipv4_blackhole_dst_check, | 2799 | .check = ipv4_blackhole_dst_check, |
2778 | .default_mtu = ipv4_blackhole_default_mtu, | 2800 | .mtu = ipv4_blackhole_mtu, |
2779 | .default_advmss = ipv4_default_advmss, | 2801 | .default_advmss = ipv4_default_advmss, |
2780 | .update_pmtu = ipv4_rt_blackhole_update_pmtu, | 2802 | .update_pmtu = ipv4_rt_blackhole_update_pmtu, |
2781 | .cow_metrics = ipv4_rt_blackhole_cow_metrics, | 2803 | .cow_metrics = ipv4_rt_blackhole_cow_metrics, |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index ab0966df1e2a..5a65eeac1d29 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1164,7 +1164,7 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1164 | struct inet_sock *inet = inet_sk(sk); | 1164 | struct inet_sock *inet = inet_sk(sk); |
1165 | struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; | 1165 | struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name; |
1166 | struct sk_buff *skb; | 1166 | struct sk_buff *skb; |
1167 | unsigned int ulen; | 1167 | unsigned int ulen, copied; |
1168 | int peeked; | 1168 | int peeked; |
1169 | int err; | 1169 | int err; |
1170 | int is_udplite = IS_UDPLITE(sk); | 1170 | int is_udplite = IS_UDPLITE(sk); |
@@ -1186,9 +1186,10 @@ try_again: | |||
1186 | goto out; | 1186 | goto out; |
1187 | 1187 | ||
1188 | ulen = skb->len - sizeof(struct udphdr); | 1188 | ulen = skb->len - sizeof(struct udphdr); |
1189 | if (len > ulen) | 1189 | copied = len; |
1190 | len = ulen; | 1190 | if (copied > ulen) |
1191 | else if (len < ulen) | 1191 | copied = ulen; |
1192 | else if (copied < ulen) | ||
1192 | msg->msg_flags |= MSG_TRUNC; | 1193 | msg->msg_flags |= MSG_TRUNC; |
1193 | 1194 | ||
1194 | /* | 1195 | /* |
@@ -1197,14 +1198,14 @@ try_again: | |||
1197 | * coverage checksum (UDP-Lite), do it before the copy. | 1198 | * coverage checksum (UDP-Lite), do it before the copy. |
1198 | */ | 1199 | */ |
1199 | 1200 | ||
1200 | if (len < ulen || UDP_SKB_CB(skb)->partial_cov) { | 1201 | if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) { |
1201 | if (udp_lib_checksum_complete(skb)) | 1202 | if (udp_lib_checksum_complete(skb)) |
1202 | goto csum_copy_err; | 1203 | goto csum_copy_err; |
1203 | } | 1204 | } |
1204 | 1205 | ||
1205 | if (skb_csum_unnecessary(skb)) | 1206 | if (skb_csum_unnecessary(skb)) |
1206 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), | 1207 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), |
1207 | msg->msg_iov, len); | 1208 | msg->msg_iov, copied); |
1208 | else { | 1209 | else { |
1209 | err = skb_copy_and_csum_datagram_iovec(skb, | 1210 | err = skb_copy_and_csum_datagram_iovec(skb, |
1210 | sizeof(struct udphdr), | 1211 | sizeof(struct udphdr), |
@@ -1233,7 +1234,7 @@ try_again: | |||
1233 | if (inet->cmsg_flags) | 1234 | if (inet->cmsg_flags) |
1234 | ip_cmsg_recv(msg, skb); | 1235 | ip_cmsg_recv(msg, skb); |
1235 | 1236 | ||
1236 | err = len; | 1237 | err = copied; |
1237 | if (flags & MSG_TRUNC) | 1238 | if (flags & MSG_TRUNC) |
1238 | err = ulen; | 1239 | err = ulen; |
1239 | 1240 | ||
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index fee46d5a2f12..1567fb120392 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -85,7 +85,7 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk, | |||
85 | * request_sock (formerly open request) hash tables. | 85 | * request_sock (formerly open request) hash tables. |
86 | */ | 86 | */ |
87 | static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, | 87 | static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, |
88 | const u32 rnd, const u16 synq_hsize) | 88 | const u32 rnd, const u32 synq_hsize) |
89 | { | 89 | { |
90 | u32 c; | 90 | u32 c; |
91 | 91 | ||
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index c99e3ee9781f..26cb08c84b74 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -503,7 +503,7 @@ done: | |||
503 | goto e_inval; | 503 | goto e_inval; |
504 | if (val > 255 || val < -1) | 504 | if (val > 255 || val < -1) |
505 | goto e_inval; | 505 | goto e_inval; |
506 | np->mcast_hops = val; | 506 | np->mcast_hops = (val == -1 ? IPV6_DEFAULT_MCASTHOPS : val); |
507 | retv = 0; | 507 | retv = 0; |
508 | break; | 508 | break; |
509 | 509 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 44e5b7f2a6c1..0cb78d7ddaf5 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1571,7 +1571,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | |||
1571 | } | 1571 | } |
1572 | if (!rt->rt6i_peer) | 1572 | if (!rt->rt6i_peer) |
1573 | rt6_bind_peer(rt, 1); | 1573 | rt6_bind_peer(rt, 1); |
1574 | if (inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) | 1574 | if (!inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) |
1575 | goto release; | 1575 | goto release; |
1576 | 1576 | ||
1577 | if (dev->addr_len) { | 1577 | if (dev->addr_len) { |
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig index 448464844a25..f792b34cbe9c 100644 --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig | |||
@@ -186,7 +186,6 @@ config IP6_NF_MANGLE | |||
186 | 186 | ||
187 | config IP6_NF_RAW | 187 | config IP6_NF_RAW |
188 | tristate 'raw table support (required for TRACE)' | 188 | tristate 'raw table support (required for TRACE)' |
189 | depends on NETFILTER_ADVANCED | ||
190 | help | 189 | help |
191 | This option adds a `raw' table to ip6tables. This table is the very | 190 | This option adds a `raw' table to ip6tables. This table is the very |
192 | first in the netfilter framework and hooks in at the PREROUTING | 191 | first in the netfilter framework and hooks in at the PREROUTING |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 8473016bba4a..3399dd326287 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -77,7 +77,7 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | |||
77 | const struct in6_addr *dest); | 77 | const struct in6_addr *dest); |
78 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); | 78 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); |
79 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); | 79 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); |
80 | static unsigned int ip6_default_mtu(const struct dst_entry *dst); | 80 | static unsigned int ip6_mtu(const struct dst_entry *dst); |
81 | static struct dst_entry *ip6_negative_advice(struct dst_entry *); | 81 | static struct dst_entry *ip6_negative_advice(struct dst_entry *); |
82 | static void ip6_dst_destroy(struct dst_entry *); | 82 | static void ip6_dst_destroy(struct dst_entry *); |
83 | static void ip6_dst_ifdown(struct dst_entry *, | 83 | static void ip6_dst_ifdown(struct dst_entry *, |
@@ -144,7 +144,7 @@ static struct dst_ops ip6_dst_ops_template = { | |||
144 | .gc_thresh = 1024, | 144 | .gc_thresh = 1024, |
145 | .check = ip6_dst_check, | 145 | .check = ip6_dst_check, |
146 | .default_advmss = ip6_default_advmss, | 146 | .default_advmss = ip6_default_advmss, |
147 | .default_mtu = ip6_default_mtu, | 147 | .mtu = ip6_mtu, |
148 | .cow_metrics = ipv6_cow_metrics, | 148 | .cow_metrics = ipv6_cow_metrics, |
149 | .destroy = ip6_dst_destroy, | 149 | .destroy = ip6_dst_destroy, |
150 | .ifdown = ip6_dst_ifdown, | 150 | .ifdown = ip6_dst_ifdown, |
@@ -155,9 +155,11 @@ static struct dst_ops ip6_dst_ops_template = { | |||
155 | .neigh_lookup = ip6_neigh_lookup, | 155 | .neigh_lookup = ip6_neigh_lookup, |
156 | }; | 156 | }; |
157 | 157 | ||
158 | static unsigned int ip6_blackhole_default_mtu(const struct dst_entry *dst) | 158 | static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst) |
159 | { | 159 | { |
160 | return 0; | 160 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
161 | |||
162 | return mtu ? : dst->dev->mtu; | ||
161 | } | 163 | } |
162 | 164 | ||
163 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 165 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
@@ -175,7 +177,7 @@ static struct dst_ops ip6_dst_blackhole_ops = { | |||
175 | .protocol = cpu_to_be16(ETH_P_IPV6), | 177 | .protocol = cpu_to_be16(ETH_P_IPV6), |
176 | .destroy = ip6_dst_destroy, | 178 | .destroy = ip6_dst_destroy, |
177 | .check = ip6_dst_check, | 179 | .check = ip6_dst_check, |
178 | .default_mtu = ip6_blackhole_default_mtu, | 180 | .mtu = ip6_blackhole_mtu, |
179 | .default_advmss = ip6_default_advmss, | 181 | .default_advmss = ip6_default_advmss, |
180 | .update_pmtu = ip6_rt_blackhole_update_pmtu, | 182 | .update_pmtu = ip6_rt_blackhole_update_pmtu, |
181 | .cow_metrics = ip6_rt_blackhole_cow_metrics, | 183 | .cow_metrics = ip6_rt_blackhole_cow_metrics, |
@@ -1041,10 +1043,15 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst) | |||
1041 | return mtu; | 1043 | return mtu; |
1042 | } | 1044 | } |
1043 | 1045 | ||
1044 | static unsigned int ip6_default_mtu(const struct dst_entry *dst) | 1046 | static unsigned int ip6_mtu(const struct dst_entry *dst) |
1045 | { | 1047 | { |
1046 | unsigned int mtu = IPV6_MIN_MTU; | ||
1047 | struct inet6_dev *idev; | 1048 | struct inet6_dev *idev; |
1049 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | ||
1050 | |||
1051 | if (mtu) | ||
1052 | return mtu; | ||
1053 | |||
1054 | mtu = IPV6_MIN_MTU; | ||
1048 | 1055 | ||
1049 | rcu_read_lock(); | 1056 | rcu_read_lock(); |
1050 | idev = __in6_dev_get(dst->dev); | 1057 | idev = __in6_dev_get(dst->dev); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 36131d122a6f..2dea4bb7b54a 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1255,6 +1255,13 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1255 | if (!want_cookie || tmp_opt.tstamp_ok) | 1255 | if (!want_cookie || tmp_opt.tstamp_ok) |
1256 | TCP_ECN_create_request(req, tcp_hdr(skb)); | 1256 | TCP_ECN_create_request(req, tcp_hdr(skb)); |
1257 | 1257 | ||
1258 | treq->iif = sk->sk_bound_dev_if; | ||
1259 | |||
1260 | /* So that link locals have meaning */ | ||
1261 | if (!sk->sk_bound_dev_if && | ||
1262 | ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) | ||
1263 | treq->iif = inet6_iif(skb); | ||
1264 | |||
1258 | if (!isn) { | 1265 | if (!isn) { |
1259 | struct inet_peer *peer = NULL; | 1266 | struct inet_peer *peer = NULL; |
1260 | 1267 | ||
@@ -1264,12 +1271,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
1264 | atomic_inc(&skb->users); | 1271 | atomic_inc(&skb->users); |
1265 | treq->pktopts = skb; | 1272 | treq->pktopts = skb; |
1266 | } | 1273 | } |
1267 | treq->iif = sk->sk_bound_dev_if; | ||
1268 | |||
1269 | /* So that link locals have meaning */ | ||
1270 | if (!sk->sk_bound_dev_if && | ||
1271 | ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) | ||
1272 | treq->iif = inet6_iif(skb); | ||
1273 | 1274 | ||
1274 | if (want_cookie) { | 1275 | if (want_cookie) { |
1275 | isn = cookie_v6_init_sequence(sk, skb, &req->mss); | 1276 | isn = cookie_v6_init_sequence(sk, skb, &req->mss); |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 846f4757eb8d..8c2541915183 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -340,7 +340,7 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
340 | struct ipv6_pinfo *np = inet6_sk(sk); | 340 | struct ipv6_pinfo *np = inet6_sk(sk); |
341 | struct inet_sock *inet = inet_sk(sk); | 341 | struct inet_sock *inet = inet_sk(sk); |
342 | struct sk_buff *skb; | 342 | struct sk_buff *skb; |
343 | unsigned int ulen; | 343 | unsigned int ulen, copied; |
344 | int peeked; | 344 | int peeked; |
345 | int err; | 345 | int err; |
346 | int is_udplite = IS_UDPLITE(sk); | 346 | int is_udplite = IS_UDPLITE(sk); |
@@ -363,9 +363,10 @@ try_again: | |||
363 | goto out; | 363 | goto out; |
364 | 364 | ||
365 | ulen = skb->len - sizeof(struct udphdr); | 365 | ulen = skb->len - sizeof(struct udphdr); |
366 | if (len > ulen) | 366 | copied = len; |
367 | len = ulen; | 367 | if (copied > ulen) |
368 | else if (len < ulen) | 368 | copied = ulen; |
369 | else if (copied < ulen) | ||
369 | msg->msg_flags |= MSG_TRUNC; | 370 | msg->msg_flags |= MSG_TRUNC; |
370 | 371 | ||
371 | is_udp4 = (skb->protocol == htons(ETH_P_IP)); | 372 | is_udp4 = (skb->protocol == htons(ETH_P_IP)); |
@@ -376,14 +377,14 @@ try_again: | |||
376 | * coverage checksum (UDP-Lite), do it before the copy. | 377 | * coverage checksum (UDP-Lite), do it before the copy. |
377 | */ | 378 | */ |
378 | 379 | ||
379 | if (len < ulen || UDP_SKB_CB(skb)->partial_cov) { | 380 | if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) { |
380 | if (udp_lib_checksum_complete(skb)) | 381 | if (udp_lib_checksum_complete(skb)) |
381 | goto csum_copy_err; | 382 | goto csum_copy_err; |
382 | } | 383 | } |
383 | 384 | ||
384 | if (skb_csum_unnecessary(skb)) | 385 | if (skb_csum_unnecessary(skb)) |
385 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), | 386 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), |
386 | msg->msg_iov,len); | 387 | msg->msg_iov, copied ); |
387 | else { | 388 | else { |
388 | err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov); | 389 | err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov); |
389 | if (err == -EINVAL) | 390 | if (err == -EINVAL) |
@@ -432,7 +433,7 @@ try_again: | |||
432 | datagram_recv_ctl(sk, msg, skb); | 433 | datagram_recv_ctl(sk, msg, skb); |
433 | } | 434 | } |
434 | 435 | ||
435 | err = len; | 436 | err = copied; |
436 | if (flags & MSG_TRUNC) | 437 | if (flags & MSG_TRUNC) |
437 | err = ulen; | 438 | err = ulen; |
438 | 439 | ||
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c index cf0f308abf5e..89ff8c67943e 100644 --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c | |||
@@ -1072,7 +1072,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len | |||
1072 | 1072 | ||
1073 | /* Get routing info from the tunnel socket */ | 1073 | /* Get routing info from the tunnel socket */ |
1074 | skb_dst_drop(skb); | 1074 | skb_dst_drop(skb); |
1075 | skb_dst_set(skb, dst_clone(__sk_dst_get(sk))); | 1075 | skb_dst_set(skb, dst_clone(__sk_dst_check(sk, 0))); |
1076 | 1076 | ||
1077 | inet = inet_sk(sk); | 1077 | inet = inet_sk(sk); |
1078 | fl = &inet->cork.fl; | 1078 | fl = &inet->cork.fl; |
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c index b3f65520e7a7..b064e4df12c6 100644 --- a/net/mac80211/agg-tx.c +++ b/net/mac80211/agg-tx.c | |||
@@ -161,6 +161,12 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
161 | return -ENOENT; | 161 | return -ENOENT; |
162 | } | 162 | } |
163 | 163 | ||
164 | /* if we're already stopping ignore any new requests to stop */ | ||
165 | if (test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { | ||
166 | spin_unlock_bh(&sta->lock); | ||
167 | return -EALREADY; | ||
168 | } | ||
169 | |||
164 | if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { | 170 | if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { |
165 | /* not even started yet! */ | 171 | /* not even started yet! */ |
166 | ieee80211_assign_tid_tx(sta, tid, NULL); | 172 | ieee80211_assign_tid_tx(sta, tid, NULL); |
@@ -169,6 +175,8 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
169 | return 0; | 175 | return 0; |
170 | } | 176 | } |
171 | 177 | ||
178 | set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state); | ||
179 | |||
172 | spin_unlock_bh(&sta->lock); | 180 | spin_unlock_bh(&sta->lock); |
173 | 181 | ||
174 | #ifdef CONFIG_MAC80211_HT_DEBUG | 182 | #ifdef CONFIG_MAC80211_HT_DEBUG |
@@ -176,8 +184,6 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
176 | sta->sta.addr, tid); | 184 | sta->sta.addr, tid); |
177 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | 185 | #endif /* CONFIG_MAC80211_HT_DEBUG */ |
178 | 186 | ||
179 | set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state); | ||
180 | |||
181 | del_timer_sync(&tid_tx->addba_resp_timer); | 187 | del_timer_sync(&tid_tx->addba_resp_timer); |
182 | 188 | ||
183 | /* | 189 | /* |
@@ -187,6 +193,20 @@ int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, | |||
187 | */ | 193 | */ |
188 | clear_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state); | 194 | clear_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state); |
189 | 195 | ||
196 | /* | ||
197 | * There might be a few packets being processed right now (on | ||
198 | * another CPU) that have already gotten past the aggregation | ||
199 | * check when it was still OPERATIONAL and consequently have | ||
200 | * IEEE80211_TX_CTL_AMPDU set. In that case, this code might | ||
201 | * call into the driver at the same time or even before the | ||
202 | * TX paths calls into it, which could confuse the driver. | ||
203 | * | ||
204 | * Wait for all currently running TX paths to finish before | ||
205 | * telling the driver. New packets will not go through since | ||
206 | * the aggregation session is no longer OPERATIONAL. | ||
207 | */ | ||
208 | synchronize_net(); | ||
209 | |||
190 | tid_tx->stop_initiator = initiator; | 210 | tid_tx->stop_initiator = initiator; |
191 | tid_tx->tx_stop = tx; | 211 | tid_tx->tx_stop = tx; |
192 | 212 | ||
@@ -757,11 +777,27 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local, | |||
757 | goto out; | 777 | goto out; |
758 | } | 778 | } |
759 | 779 | ||
760 | del_timer(&tid_tx->addba_resp_timer); | 780 | del_timer_sync(&tid_tx->addba_resp_timer); |
761 | 781 | ||
762 | #ifdef CONFIG_MAC80211_HT_DEBUG | 782 | #ifdef CONFIG_MAC80211_HT_DEBUG |
763 | printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid); | 783 | printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid); |
764 | #endif | 784 | #endif |
785 | |||
786 | /* | ||
787 | * addba_resp_timer may have fired before we got here, and | ||
788 | * caused WANT_STOP to be set. If the stop then was already | ||
789 | * processed further, STOPPING might be set. | ||
790 | */ | ||
791 | if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) || | ||
792 | test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { | ||
793 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
794 | printk(KERN_DEBUG | ||
795 | "got addBA resp for tid %d but we already gave up\n", | ||
796 | tid); | ||
797 | #endif | ||
798 | goto out; | ||
799 | } | ||
800 | |||
765 | /* | 801 | /* |
766 | * IEEE 802.11-2007 7.3.1.14: | 802 | * IEEE 802.11-2007 7.3.1.14: |
767 | * In an ADDBA Response frame, when the Status Code field | 803 | * In an ADDBA Response frame, when the Status Code field |
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index c5f341798c16..3110cbdc501b 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -274,9 +274,9 @@ static ssize_t sta_ht_capa_read(struct file *file, char __user *userbuf, | |||
274 | 274 | ||
275 | PRINT_HT_CAP((htc->cap & BIT(10)), "HT Delayed Block Ack"); | 275 | PRINT_HT_CAP((htc->cap & BIT(10)), "HT Delayed Block Ack"); |
276 | 276 | ||
277 | PRINT_HT_CAP((htc->cap & BIT(11)), "Max AMSDU length: " | ||
278 | "3839 bytes"); | ||
279 | PRINT_HT_CAP(!(htc->cap & BIT(11)), "Max AMSDU length: " | 277 | PRINT_HT_CAP(!(htc->cap & BIT(11)), "Max AMSDU length: " |
278 | "3839 bytes"); | ||
279 | PRINT_HT_CAP((htc->cap & BIT(11)), "Max AMSDU length: " | ||
280 | "7935 bytes"); | 280 | "7935 bytes"); |
281 | 281 | ||
282 | /* | 282 | /* |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index d999bf3b84e1..cae443563ec9 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -757,6 +757,12 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
757 | if (!local->int_scan_req) | 757 | if (!local->int_scan_req) |
758 | return -ENOMEM; | 758 | return -ENOMEM; |
759 | 759 | ||
760 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | ||
761 | if (!local->hw.wiphy->bands[band]) | ||
762 | continue; | ||
763 | local->int_scan_req->rates[band] = (u32) -1; | ||
764 | } | ||
765 | |||
760 | /* if low-level driver supports AP, we also support VLAN */ | 766 | /* if low-level driver supports AP, we also support VLAN */ |
761 | if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { | 767 | if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { |
762 | hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); | 768 | hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); |
diff --git a/net/mac80211/status.c b/net/mac80211/status.c index 80de436eae20..16518f386117 100644 --- a/net/mac80211/status.c +++ b/net/mac80211/status.c | |||
@@ -260,7 +260,7 @@ static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band | |||
260 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 260 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
261 | struct ieee80211_radiotap_header *rthdr; | 261 | struct ieee80211_radiotap_header *rthdr; |
262 | unsigned char *pos; | 262 | unsigned char *pos; |
263 | __le16 txflags; | 263 | u16 txflags; |
264 | 264 | ||
265 | rthdr = (struct ieee80211_radiotap_header *) skb_push(skb, rtap_len); | 265 | rthdr = (struct ieee80211_radiotap_header *) skb_push(skb, rtap_len); |
266 | 266 | ||
@@ -290,13 +290,13 @@ static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band | |||
290 | txflags = 0; | 290 | txflags = 0; |
291 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && | 291 | if (!(info->flags & IEEE80211_TX_STAT_ACK) && |
292 | !is_multicast_ether_addr(hdr->addr1)) | 292 | !is_multicast_ether_addr(hdr->addr1)) |
293 | txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL); | 293 | txflags |= IEEE80211_RADIOTAP_F_TX_FAIL; |
294 | 294 | ||
295 | if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || | 295 | if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || |
296 | (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) | 296 | (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) |
297 | txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS); | 297 | txflags |= IEEE80211_RADIOTAP_F_TX_CTS; |
298 | else if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) | 298 | else if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) |
299 | txflags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS); | 299 | txflags |= IEEE80211_RADIOTAP_F_TX_RTS; |
300 | 300 | ||
301 | put_unaligned_le16(txflags, pos); | 301 | put_unaligned_le16(txflags, pos); |
302 | pos += 2; | 302 | pos += 2; |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index eca0fad09709..d5230ecc784d 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1039,7 +1039,6 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
1039 | struct ieee80211_sub_if_data, | 1039 | struct ieee80211_sub_if_data, |
1040 | u.ap); | 1040 | u.ap); |
1041 | 1041 | ||
1042 | memset(&sta->sta.drv_priv, 0, hw->sta_data_size); | ||
1043 | WARN_ON(drv_sta_add(local, sdata, &sta->sta)); | 1042 | WARN_ON(drv_sta_add(local, sdata, &sta->sta)); |
1044 | } | 1043 | } |
1045 | } | 1044 | } |
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index 8260b13d93c9..d5597b759ba3 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -201,7 +201,6 @@ config NF_CONNTRACK_BROADCAST | |||
201 | 201 | ||
202 | config NF_CONNTRACK_NETBIOS_NS | 202 | config NF_CONNTRACK_NETBIOS_NS |
203 | tristate "NetBIOS name service protocol support" | 203 | tristate "NetBIOS name service protocol support" |
204 | depends on NETFILTER_ADVANCED | ||
205 | select NF_CONNTRACK_BROADCAST | 204 | select NF_CONNTRACK_BROADCAST |
206 | help | 205 | help |
207 | NetBIOS name service requests are sent as broadcast messages from an | 206 | NetBIOS name service requests are sent as broadcast messages from an |
@@ -542,7 +541,6 @@ config NETFILTER_XT_TARGET_NOTRACK | |||
542 | tristate '"NOTRACK" target support' | 541 | tristate '"NOTRACK" target support' |
543 | depends on IP_NF_RAW || IP6_NF_RAW | 542 | depends on IP_NF_RAW || IP6_NF_RAW |
544 | depends on NF_CONNTRACK | 543 | depends on NF_CONNTRACK |
545 | depends on NETFILTER_ADVANCED | ||
546 | help | 544 | help |
547 | The NOTRACK target allows a select rule to specify | 545 | The NOTRACK target allows a select rule to specify |
548 | which packets *not* to enter the conntrack/NAT | 546 | which packets *not* to enter the conntrack/NAT |
diff --git a/net/netfilter/ipset/ip_set_hash_ipport.c b/net/netfilter/ipset/ip_set_hash_ipport.c index 6ee10f5d59bd..37d667e3f6f8 100644 --- a/net/netfilter/ipset/ip_set_hash_ipport.c +++ b/net/netfilter/ipset/ip_set_hash_ipport.c | |||
@@ -158,7 +158,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
158 | const struct ip_set_hash *h = set->data; | 158 | const struct ip_set_hash *h = set->data; |
159 | ipset_adtfn adtfn = set->variant->adt[adt]; | 159 | ipset_adtfn adtfn = set->variant->adt[adt]; |
160 | struct hash_ipport4_elem data = { }; | 160 | struct hash_ipport4_elem data = { }; |
161 | u32 ip, ip_to, p = 0, port, port_to; | 161 | u32 ip, ip_to = 0, p = 0, port, port_to; |
162 | u32 timeout = h->timeout; | 162 | u32 timeout = h->timeout; |
163 | bool with_ports = false; | 163 | bool with_ports = false; |
164 | int ret; | 164 | int ret; |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportip.c b/net/netfilter/ipset/ip_set_hash_ipportip.c index fb90e344e907..e69e2718fbe1 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportip.c +++ b/net/netfilter/ipset/ip_set_hash_ipportip.c | |||
@@ -162,7 +162,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
162 | const struct ip_set_hash *h = set->data; | 162 | const struct ip_set_hash *h = set->data; |
163 | ipset_adtfn adtfn = set->variant->adt[adt]; | 163 | ipset_adtfn adtfn = set->variant->adt[adt]; |
164 | struct hash_ipportip4_elem data = { }; | 164 | struct hash_ipportip4_elem data = { }; |
165 | u32 ip, ip_to, p = 0, port, port_to; | 165 | u32 ip, ip_to = 0, p = 0, port, port_to; |
166 | u32 timeout = h->timeout; | 166 | u32 timeout = h->timeout; |
167 | bool with_ports = false; | 167 | bool with_ports = false; |
168 | int ret; | 168 | int ret; |
diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c index deb3e3dfa5fc..64199b4e93c9 100644 --- a/net/netfilter/ipset/ip_set_hash_ipportnet.c +++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c | |||
@@ -184,7 +184,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], | |||
184 | const struct ip_set_hash *h = set->data; | 184 | const struct ip_set_hash *h = set->data; |
185 | ipset_adtfn adtfn = set->variant->adt[adt]; | 185 | ipset_adtfn adtfn = set->variant->adt[adt]; |
186 | struct hash_ipportnet4_elem data = { .cidr = HOST_MASK }; | 186 | struct hash_ipportnet4_elem data = { .cidr = HOST_MASK }; |
187 | u32 ip, ip_to, p = 0, port, port_to; | 187 | u32 ip, ip_to = 0, p = 0, port, port_to; |
188 | u32 ip2_from = 0, ip2_to, ip2_last, ip2; | 188 | u32 ip2_from = 0, ip2_to, ip2_last, ip2; |
189 | u32 timeout = h->timeout; | 189 | u32 timeout = h->timeout; |
190 | bool with_ports = false; | 190 | bool with_ports = false; |
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c index 6b368be937c6..b62c4148b921 100644 --- a/net/netfilter/nf_conntrack_ecache.c +++ b/net/netfilter/nf_conntrack_ecache.c | |||
@@ -27,22 +27,17 @@ | |||
27 | 27 | ||
28 | static DEFINE_MUTEX(nf_ct_ecache_mutex); | 28 | static DEFINE_MUTEX(nf_ct_ecache_mutex); |
29 | 29 | ||
30 | struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb __read_mostly; | ||
31 | EXPORT_SYMBOL_GPL(nf_conntrack_event_cb); | ||
32 | |||
33 | struct nf_exp_event_notifier __rcu *nf_expect_event_cb __read_mostly; | ||
34 | EXPORT_SYMBOL_GPL(nf_expect_event_cb); | ||
35 | |||
36 | /* deliver cached events and clear cache entry - must be called with locally | 30 | /* deliver cached events and clear cache entry - must be called with locally |
37 | * disabled softirqs */ | 31 | * disabled softirqs */ |
38 | void nf_ct_deliver_cached_events(struct nf_conn *ct) | 32 | void nf_ct_deliver_cached_events(struct nf_conn *ct) |
39 | { | 33 | { |
34 | struct net *net = nf_ct_net(ct); | ||
40 | unsigned long events; | 35 | unsigned long events; |
41 | struct nf_ct_event_notifier *notify; | 36 | struct nf_ct_event_notifier *notify; |
42 | struct nf_conntrack_ecache *e; | 37 | struct nf_conntrack_ecache *e; |
43 | 38 | ||
44 | rcu_read_lock(); | 39 | rcu_read_lock(); |
45 | notify = rcu_dereference(nf_conntrack_event_cb); | 40 | notify = rcu_dereference(net->ct.nf_conntrack_event_cb); |
46 | if (notify == NULL) | 41 | if (notify == NULL) |
47 | goto out_unlock; | 42 | goto out_unlock; |
48 | 43 | ||
@@ -83,19 +78,20 @@ out_unlock: | |||
83 | } | 78 | } |
84 | EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); | 79 | EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); |
85 | 80 | ||
86 | int nf_conntrack_register_notifier(struct nf_ct_event_notifier *new) | 81 | int nf_conntrack_register_notifier(struct net *net, |
82 | struct nf_ct_event_notifier *new) | ||
87 | { | 83 | { |
88 | int ret = 0; | 84 | int ret = 0; |
89 | struct nf_ct_event_notifier *notify; | 85 | struct nf_ct_event_notifier *notify; |
90 | 86 | ||
91 | mutex_lock(&nf_ct_ecache_mutex); | 87 | mutex_lock(&nf_ct_ecache_mutex); |
92 | notify = rcu_dereference_protected(nf_conntrack_event_cb, | 88 | notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb, |
93 | lockdep_is_held(&nf_ct_ecache_mutex)); | 89 | lockdep_is_held(&nf_ct_ecache_mutex)); |
94 | if (notify != NULL) { | 90 | if (notify != NULL) { |
95 | ret = -EBUSY; | 91 | ret = -EBUSY; |
96 | goto out_unlock; | 92 | goto out_unlock; |
97 | } | 93 | } |
98 | RCU_INIT_POINTER(nf_conntrack_event_cb, new); | 94 | RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, new); |
99 | mutex_unlock(&nf_ct_ecache_mutex); | 95 | mutex_unlock(&nf_ct_ecache_mutex); |
100 | return ret; | 96 | return ret; |
101 | 97 | ||
@@ -105,32 +101,34 @@ out_unlock: | |||
105 | } | 101 | } |
106 | EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); | 102 | EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); |
107 | 103 | ||
108 | void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *new) | 104 | void nf_conntrack_unregister_notifier(struct net *net, |
105 | struct nf_ct_event_notifier *new) | ||
109 | { | 106 | { |
110 | struct nf_ct_event_notifier *notify; | 107 | struct nf_ct_event_notifier *notify; |
111 | 108 | ||
112 | mutex_lock(&nf_ct_ecache_mutex); | 109 | mutex_lock(&nf_ct_ecache_mutex); |
113 | notify = rcu_dereference_protected(nf_conntrack_event_cb, | 110 | notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb, |
114 | lockdep_is_held(&nf_ct_ecache_mutex)); | 111 | lockdep_is_held(&nf_ct_ecache_mutex)); |
115 | BUG_ON(notify != new); | 112 | BUG_ON(notify != new); |
116 | RCU_INIT_POINTER(nf_conntrack_event_cb, NULL); | 113 | RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, NULL); |
117 | mutex_unlock(&nf_ct_ecache_mutex); | 114 | mutex_unlock(&nf_ct_ecache_mutex); |
118 | } | 115 | } |
119 | EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); | 116 | EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); |
120 | 117 | ||
121 | int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *new) | 118 | int nf_ct_expect_register_notifier(struct net *net, |
119 | struct nf_exp_event_notifier *new) | ||
122 | { | 120 | { |
123 | int ret = 0; | 121 | int ret = 0; |
124 | struct nf_exp_event_notifier *notify; | 122 | struct nf_exp_event_notifier *notify; |
125 | 123 | ||
126 | mutex_lock(&nf_ct_ecache_mutex); | 124 | mutex_lock(&nf_ct_ecache_mutex); |
127 | notify = rcu_dereference_protected(nf_expect_event_cb, | 125 | notify = rcu_dereference_protected(net->ct.nf_expect_event_cb, |
128 | lockdep_is_held(&nf_ct_ecache_mutex)); | 126 | lockdep_is_held(&nf_ct_ecache_mutex)); |
129 | if (notify != NULL) { | 127 | if (notify != NULL) { |
130 | ret = -EBUSY; | 128 | ret = -EBUSY; |
131 | goto out_unlock; | 129 | goto out_unlock; |
132 | } | 130 | } |
133 | RCU_INIT_POINTER(nf_expect_event_cb, new); | 131 | RCU_INIT_POINTER(net->ct.nf_expect_event_cb, new); |
134 | mutex_unlock(&nf_ct_ecache_mutex); | 132 | mutex_unlock(&nf_ct_ecache_mutex); |
135 | return ret; | 133 | return ret; |
136 | 134 | ||
@@ -140,15 +138,16 @@ out_unlock: | |||
140 | } | 138 | } |
141 | EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier); | 139 | EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier); |
142 | 140 | ||
143 | void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *new) | 141 | void nf_ct_expect_unregister_notifier(struct net *net, |
142 | struct nf_exp_event_notifier *new) | ||
144 | { | 143 | { |
145 | struct nf_exp_event_notifier *notify; | 144 | struct nf_exp_event_notifier *notify; |
146 | 145 | ||
147 | mutex_lock(&nf_ct_ecache_mutex); | 146 | mutex_lock(&nf_ct_ecache_mutex); |
148 | notify = rcu_dereference_protected(nf_expect_event_cb, | 147 | notify = rcu_dereference_protected(net->ct.nf_expect_event_cb, |
149 | lockdep_is_held(&nf_ct_ecache_mutex)); | 148 | lockdep_is_held(&nf_ct_ecache_mutex)); |
150 | BUG_ON(notify != new); | 149 | BUG_ON(notify != new); |
151 | RCU_INIT_POINTER(nf_expect_event_cb, NULL); | 150 | RCU_INIT_POINTER(net->ct.nf_expect_event_cb, NULL); |
152 | mutex_unlock(&nf_ct_ecache_mutex); | 151 | mutex_unlock(&nf_ct_ecache_mutex); |
153 | } | 152 | } |
154 | EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier); | 153 | EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier); |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index e58aa9b1fe8a..ef21b221f036 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * (C) 2001 by Jay Schulist <jschlst@samba.org> | 4 | * (C) 2001 by Jay Schulist <jschlst@samba.org> |
5 | * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org> | 5 | * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org> |
6 | * (C) 2003 by Patrick Mchardy <kaber@trash.net> | 6 | * (C) 2003 by Patrick Mchardy <kaber@trash.net> |
7 | * (C) 2005-2008 by Pablo Neira Ayuso <pablo@netfilter.org> | 7 | * (C) 2005-2011 by Pablo Neira Ayuso <pablo@netfilter.org> |
8 | * | 8 | * |
9 | * Initial connection tracking via netlink development funded and | 9 | * Initial connection tracking via netlink development funded and |
10 | * generally made possible by Network Robots, Inc. (www.networkrobots.com) | 10 | * generally made possible by Network Robots, Inc. (www.networkrobots.com) |
@@ -2163,6 +2163,54 @@ MODULE_ALIAS("ip_conntrack_netlink"); | |||
2163 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK); | 2163 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK); |
2164 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK_EXP); | 2164 | MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK_EXP); |
2165 | 2165 | ||
2166 | static int __net_init ctnetlink_net_init(struct net *net) | ||
2167 | { | ||
2168 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
2169 | int ret; | ||
2170 | |||
2171 | ret = nf_conntrack_register_notifier(net, &ctnl_notifier); | ||
2172 | if (ret < 0) { | ||
2173 | pr_err("ctnetlink_init: cannot register notifier.\n"); | ||
2174 | goto err_out; | ||
2175 | } | ||
2176 | |||
2177 | ret = nf_ct_expect_register_notifier(net, &ctnl_notifier_exp); | ||
2178 | if (ret < 0) { | ||
2179 | pr_err("ctnetlink_init: cannot expect register notifier.\n"); | ||
2180 | goto err_unreg_notifier; | ||
2181 | } | ||
2182 | #endif | ||
2183 | return 0; | ||
2184 | |||
2185 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
2186 | err_unreg_notifier: | ||
2187 | nf_conntrack_unregister_notifier(net, &ctnl_notifier); | ||
2188 | err_out: | ||
2189 | return ret; | ||
2190 | #endif | ||
2191 | } | ||
2192 | |||
2193 | static void ctnetlink_net_exit(struct net *net) | ||
2194 | { | ||
2195 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
2196 | nf_ct_expect_unregister_notifier(net, &ctnl_notifier_exp); | ||
2197 | nf_conntrack_unregister_notifier(net, &ctnl_notifier); | ||
2198 | #endif | ||
2199 | } | ||
2200 | |||
2201 | static void __net_exit ctnetlink_net_exit_batch(struct list_head *net_exit_list) | ||
2202 | { | ||
2203 | struct net *net; | ||
2204 | |||
2205 | list_for_each_entry(net, net_exit_list, exit_list) | ||
2206 | ctnetlink_net_exit(net); | ||
2207 | } | ||
2208 | |||
2209 | static struct pernet_operations ctnetlink_net_ops = { | ||
2210 | .init = ctnetlink_net_init, | ||
2211 | .exit_batch = ctnetlink_net_exit_batch, | ||
2212 | }; | ||
2213 | |||
2166 | static int __init ctnetlink_init(void) | 2214 | static int __init ctnetlink_init(void) |
2167 | { | 2215 | { |
2168 | int ret; | 2216 | int ret; |
@@ -2180,28 +2228,15 @@ static int __init ctnetlink_init(void) | |||
2180 | goto err_unreg_subsys; | 2228 | goto err_unreg_subsys; |
2181 | } | 2229 | } |
2182 | 2230 | ||
2183 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 2231 | if (register_pernet_subsys(&ctnetlink_net_ops)) { |
2184 | ret = nf_conntrack_register_notifier(&ctnl_notifier); | 2232 | pr_err("ctnetlink_init: cannot register pernet operations\n"); |
2185 | if (ret < 0) { | ||
2186 | pr_err("ctnetlink_init: cannot register notifier.\n"); | ||
2187 | goto err_unreg_exp_subsys; | 2233 | goto err_unreg_exp_subsys; |
2188 | } | 2234 | } |
2189 | 2235 | ||
2190 | ret = nf_ct_expect_register_notifier(&ctnl_notifier_exp); | ||
2191 | if (ret < 0) { | ||
2192 | pr_err("ctnetlink_init: cannot expect register notifier.\n"); | ||
2193 | goto err_unreg_notifier; | ||
2194 | } | ||
2195 | #endif | ||
2196 | |||
2197 | return 0; | 2236 | return 0; |
2198 | 2237 | ||
2199 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | ||
2200 | err_unreg_notifier: | ||
2201 | nf_conntrack_unregister_notifier(&ctnl_notifier); | ||
2202 | err_unreg_exp_subsys: | 2238 | err_unreg_exp_subsys: |
2203 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); | 2239 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); |
2204 | #endif | ||
2205 | err_unreg_subsys: | 2240 | err_unreg_subsys: |
2206 | nfnetlink_subsys_unregister(&ctnl_subsys); | 2241 | nfnetlink_subsys_unregister(&ctnl_subsys); |
2207 | err_out: | 2242 | err_out: |
@@ -2213,11 +2248,7 @@ static void __exit ctnetlink_exit(void) | |||
2213 | pr_info("ctnetlink: unregistering from nfnetlink.\n"); | 2248 | pr_info("ctnetlink: unregistering from nfnetlink.\n"); |
2214 | 2249 | ||
2215 | nf_ct_remove_userspace_expectations(); | 2250 | nf_ct_remove_userspace_expectations(); |
2216 | #ifdef CONFIG_NF_CONNTRACK_EVENTS | 2251 | unregister_pernet_subsys(&ctnetlink_net_ops); |
2217 | nf_ct_expect_unregister_notifier(&ctnl_notifier_exp); | ||
2218 | nf_conntrack_unregister_notifier(&ctnl_notifier); | ||
2219 | #endif | ||
2220 | |||
2221 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); | 2252 | nfnetlink_subsys_unregister(&ctnl_exp_subsys); |
2222 | nfnetlink_subsys_unregister(&ctnl_subsys); | 2253 | nfnetlink_subsys_unregister(&ctnl_subsys); |
2223 | } | 2254 | } |
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c index 9c24de10a657..824f184f7a9b 100644 --- a/net/netlabel/netlabel_kapi.c +++ b/net/netlabel/netlabel_kapi.c | |||
@@ -111,8 +111,6 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
111 | struct netlbl_domaddr_map *addrmap = NULL; | 111 | struct netlbl_domaddr_map *addrmap = NULL; |
112 | struct netlbl_domaddr4_map *map4 = NULL; | 112 | struct netlbl_domaddr4_map *map4 = NULL; |
113 | struct netlbl_domaddr6_map *map6 = NULL; | 113 | struct netlbl_domaddr6_map *map6 = NULL; |
114 | const struct in_addr *addr4, *mask4; | ||
115 | const struct in6_addr *addr6, *mask6; | ||
116 | 114 | ||
117 | entry = kzalloc(sizeof(*entry), GFP_ATOMIC); | 115 | entry = kzalloc(sizeof(*entry), GFP_ATOMIC); |
118 | if (entry == NULL) | 116 | if (entry == NULL) |
@@ -133,9 +131,9 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
133 | INIT_LIST_HEAD(&addrmap->list6); | 131 | INIT_LIST_HEAD(&addrmap->list6); |
134 | 132 | ||
135 | switch (family) { | 133 | switch (family) { |
136 | case AF_INET: | 134 | case AF_INET: { |
137 | addr4 = addr; | 135 | const struct in_addr *addr4 = addr; |
138 | mask4 = mask; | 136 | const struct in_addr *mask4 = mask; |
139 | map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); | 137 | map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); |
140 | if (map4 == NULL) | 138 | if (map4 == NULL) |
141 | goto cfg_unlbl_map_add_failure; | 139 | goto cfg_unlbl_map_add_failure; |
@@ -148,9 +146,11 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
148 | if (ret_val != 0) | 146 | if (ret_val != 0) |
149 | goto cfg_unlbl_map_add_failure; | 147 | goto cfg_unlbl_map_add_failure; |
150 | break; | 148 | break; |
151 | case AF_INET6: | 149 | } |
152 | addr6 = addr; | 150 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
153 | mask6 = mask; | 151 | case AF_INET6: { |
152 | const struct in6_addr *addr6 = addr; | ||
153 | const struct in6_addr *mask6 = mask; | ||
154 | map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); | 154 | map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); |
155 | if (map6 == NULL) | 155 | if (map6 == NULL) |
156 | goto cfg_unlbl_map_add_failure; | 156 | goto cfg_unlbl_map_add_failure; |
@@ -162,11 +162,13 @@ int netlbl_cfg_unlbl_map_add(const char *domain, | |||
162 | map6->list.addr.s6_addr32[3] &= mask6->s6_addr32[3]; | 162 | map6->list.addr.s6_addr32[3] &= mask6->s6_addr32[3]; |
163 | ipv6_addr_copy(&map6->list.mask, mask6); | 163 | ipv6_addr_copy(&map6->list.mask, mask6); |
164 | map6->list.valid = 1; | 164 | map6->list.valid = 1; |
165 | ret_val = netlbl_af4list_add(&map4->list, | 165 | ret_val = netlbl_af6list_add(&map6->list, |
166 | &addrmap->list4); | 166 | &addrmap->list6); |
167 | if (ret_val != 0) | 167 | if (ret_val != 0) |
168 | goto cfg_unlbl_map_add_failure; | 168 | goto cfg_unlbl_map_add_failure; |
169 | break; | 169 | break; |
170 | } | ||
171 | #endif /* IPv6 */ | ||
170 | default: | 172 | default: |
171 | goto cfg_unlbl_map_add_failure; | 173 | goto cfg_unlbl_map_add_failure; |
172 | break; | 174 | break; |
@@ -225,9 +227,11 @@ int netlbl_cfg_unlbl_static_add(struct net *net, | |||
225 | case AF_INET: | 227 | case AF_INET: |
226 | addr_len = sizeof(struct in_addr); | 228 | addr_len = sizeof(struct in_addr); |
227 | break; | 229 | break; |
230 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
228 | case AF_INET6: | 231 | case AF_INET6: |
229 | addr_len = sizeof(struct in6_addr); | 232 | addr_len = sizeof(struct in6_addr); |
230 | break; | 233 | break; |
234 | #endif /* IPv6 */ | ||
231 | default: | 235 | default: |
232 | return -EPFNOSUPPORT; | 236 | return -EPFNOSUPPORT; |
233 | } | 237 | } |
@@ -266,9 +270,11 @@ int netlbl_cfg_unlbl_static_del(struct net *net, | |||
266 | case AF_INET: | 270 | case AF_INET: |
267 | addr_len = sizeof(struct in_addr); | 271 | addr_len = sizeof(struct in_addr); |
268 | break; | 272 | break; |
273 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
269 | case AF_INET6: | 274 | case AF_INET6: |
270 | addr_len = sizeof(struct in6_addr); | 275 | addr_len = sizeof(struct in6_addr); |
271 | break; | 276 | break; |
277 | #endif /* IPv6 */ | ||
272 | default: | 278 | default: |
273 | return -EPFNOSUPPORT; | 279 | return -EPFNOSUPPORT; |
274 | } | 280 | } |
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index 6649463da1b6..d617161f8dd3 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
@@ -209,8 +209,8 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt) | |||
209 | ctl->Plog, ctl->Scell_log, | 209 | ctl->Plog, ctl->Scell_log, |
210 | nla_data(tb[TCA_RED_STAB])); | 210 | nla_data(tb[TCA_RED_STAB])); |
211 | 211 | ||
212 | if (skb_queue_empty(&sch->q)) | 212 | if (!q->qdisc->q.qlen) |
213 | red_end_of_idle_period(&q->parms); | 213 | red_start_of_idle_period(&q->parms); |
214 | 214 | ||
215 | sch_tree_unlock(sch); | 215 | sch_tree_unlock(sch); |
216 | return 0; | 216 | return 0; |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index a3b7120fcc74..4f4c52c0eeb3 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
@@ -225,11 +225,11 @@ static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt) | |||
225 | 225 | ||
226 | 226 | ||
227 | static int | 227 | static int |
228 | __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device *dev) | 228 | __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, |
229 | struct net_device *dev, struct netdev_queue *txq, | ||
230 | struct neighbour *mn) | ||
229 | { | 231 | { |
230 | struct netdev_queue *dev_queue = netdev_get_tx_queue(dev, 0); | 232 | struct teql_sched_data *q = qdisc_priv(txq->qdisc); |
231 | struct teql_sched_data *q = qdisc_priv(dev_queue->qdisc); | ||
232 | struct neighbour *mn = dst_get_neighbour(skb_dst(skb)); | ||
233 | struct neighbour *n = q->ncache; | 233 | struct neighbour *n = q->ncache; |
234 | 234 | ||
235 | if (mn->tbl == NULL) | 235 | if (mn->tbl == NULL) |
@@ -262,17 +262,26 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res, struct net_device * | |||
262 | } | 262 | } |
263 | 263 | ||
264 | static inline int teql_resolve(struct sk_buff *skb, | 264 | static inline int teql_resolve(struct sk_buff *skb, |
265 | struct sk_buff *skb_res, struct net_device *dev) | 265 | struct sk_buff *skb_res, |
266 | struct net_device *dev, | ||
267 | struct netdev_queue *txq) | ||
266 | { | 268 | { |
267 | struct netdev_queue *txq = netdev_get_tx_queue(dev, 0); | 269 | struct dst_entry *dst = skb_dst(skb); |
270 | struct neighbour *mn; | ||
271 | int res; | ||
272 | |||
268 | if (txq->qdisc == &noop_qdisc) | 273 | if (txq->qdisc == &noop_qdisc) |
269 | return -ENODEV; | 274 | return -ENODEV; |
270 | 275 | ||
271 | if (dev->header_ops == NULL || | 276 | if (!dev->header_ops || !dst) |
272 | skb_dst(skb) == NULL || | ||
273 | dst_get_neighbour(skb_dst(skb)) == NULL) | ||
274 | return 0; | 277 | return 0; |
275 | return __teql_resolve(skb, skb_res, dev); | 278 | |
279 | rcu_read_lock(); | ||
280 | mn = dst_get_neighbour(dst); | ||
281 | res = mn ? __teql_resolve(skb, skb_res, dev, txq, mn) : 0; | ||
282 | rcu_read_unlock(); | ||
283 | |||
284 | return res; | ||
276 | } | 285 | } |
277 | 286 | ||
278 | static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev) | 287 | static netdev_tx_t teql_master_xmit(struct sk_buff *skb, struct net_device *dev) |
@@ -307,7 +316,7 @@ restart: | |||
307 | continue; | 316 | continue; |
308 | } | 317 | } |
309 | 318 | ||
310 | switch (teql_resolve(skb, skb_res, slave)) { | 319 | switch (teql_resolve(skb, skb_res, slave, slave_txq)) { |
311 | case 0: | 320 | case 0: |
312 | if (__netif_tx_trylock(slave_txq)) { | 321 | if (__netif_tx_trylock(slave_txq)) { |
313 | unsigned int length = qdisc_pkt_len(skb); | 322 | unsigned int length = qdisc_pkt_len(skb); |
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 865e68fef21c..bf812048cf6f 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c | |||
@@ -82,7 +82,7 @@ static struct sctp_auth_bytes *sctp_auth_create_key(__u32 key_len, gfp_t gfp) | |||
82 | struct sctp_auth_bytes *key; | 82 | struct sctp_auth_bytes *key; |
83 | 83 | ||
84 | /* Verify that we are not going to overflow INT_MAX */ | 84 | /* Verify that we are not going to overflow INT_MAX */ |
85 | if ((INT_MAX - key_len) < sizeof(struct sctp_auth_bytes)) | 85 | if (key_len > (INT_MAX - sizeof(struct sctp_auth_bytes))) |
86 | return NULL; | 86 | return NULL; |
87 | 87 | ||
88 | /* Allocate the shared key */ | 88 | /* Allocate the shared key */ |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 466fbcc5cf77..b595a3d8679f 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1957,6 +1957,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1957 | if ((UNIXCB(skb).pid != siocb->scm->pid) || | 1957 | if ((UNIXCB(skb).pid != siocb->scm->pid) || |
1958 | (UNIXCB(skb).cred != siocb->scm->cred)) { | 1958 | (UNIXCB(skb).cred != siocb->scm->cred)) { |
1959 | skb_queue_head(&sk->sk_receive_queue, skb); | 1959 | skb_queue_head(&sk->sk_receive_queue, skb); |
1960 | sk->sk_data_ready(sk, skb->len); | ||
1960 | break; | 1961 | break; |
1961 | } | 1962 | } |
1962 | } else { | 1963 | } else { |
@@ -1974,6 +1975,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1974 | chunk = min_t(unsigned int, skb->len, size); | 1975 | chunk = min_t(unsigned int, skb->len, size); |
1975 | if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { | 1976 | if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { |
1976 | skb_queue_head(&sk->sk_receive_queue, skb); | 1977 | skb_queue_head(&sk->sk_receive_queue, skb); |
1978 | sk->sk_data_ready(sk, skb->len); | ||
1977 | if (copied == 0) | 1979 | if (copied == 0) |
1978 | copied = -EFAULT; | 1980 | copied = -EFAULT; |
1979 | break; | 1981 | break; |
@@ -1991,6 +1993,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1991 | /* put the skb back if we didn't use it up.. */ | 1993 | /* put the skb back if we didn't use it up.. */ |
1992 | if (skb->len) { | 1994 | if (skb->len) { |
1993 | skb_queue_head(&sk->sk_receive_queue, skb); | 1995 | skb_queue_head(&sk->sk_receive_queue, skb); |
1996 | sk->sk_data_ready(sk, skb->len); | ||
1994 | break; | 1997 | break; |
1995 | } | 1998 | } |
1996 | 1999 | ||
@@ -2006,6 +2009,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
2006 | 2009 | ||
2007 | /* put message back and return */ | 2010 | /* put message back and return */ |
2008 | skb_queue_head(&sk->sk_receive_queue, skb); | 2011 | skb_queue_head(&sk->sk_receive_queue, skb); |
2012 | sk->sk_data_ready(sk, skb->len); | ||
2009 | break; | 2013 | break; |
2010 | } | 2014 | } |
2011 | } while (size); | 2015 | } while (size); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b3a476fe8272..ffafda5022c2 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -89,8 +89,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { | |||
89 | [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, | 89 | [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, |
90 | [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, | 90 | [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, |
91 | 91 | ||
92 | [NL80211_ATTR_MAC] = { .type = NLA_BINARY, .len = ETH_ALEN }, | 92 | [NL80211_ATTR_MAC] = { .len = ETH_ALEN }, |
93 | [NL80211_ATTR_PREV_BSSID] = { .type = NLA_BINARY, .len = ETH_ALEN }, | 93 | [NL80211_ATTR_PREV_BSSID] = { .len = ETH_ALEN }, |
94 | 94 | ||
95 | [NL80211_ATTR_KEY] = { .type = NLA_NESTED, }, | 95 | [NL80211_ATTR_KEY] = { .type = NLA_NESTED, }, |
96 | [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY, | 96 | [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY, |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index e71f5a66574e..3302c56f60d1 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -57,8 +57,17 @@ | |||
57 | #define REG_DBG_PRINT(args...) | 57 | #define REG_DBG_PRINT(args...) |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | static struct regulatory_request core_request_world = { | ||
61 | .initiator = NL80211_REGDOM_SET_BY_CORE, | ||
62 | .alpha2[0] = '0', | ||
63 | .alpha2[1] = '0', | ||
64 | .intersect = false, | ||
65 | .processed = true, | ||
66 | .country_ie_env = ENVIRON_ANY, | ||
67 | }; | ||
68 | |||
60 | /* Receipt of information from last regulatory request */ | 69 | /* Receipt of information from last regulatory request */ |
61 | static struct regulatory_request *last_request; | 70 | static struct regulatory_request *last_request = &core_request_world; |
62 | 71 | ||
63 | /* To trigger userspace events */ | 72 | /* To trigger userspace events */ |
64 | static struct platform_device *reg_pdev; | 73 | static struct platform_device *reg_pdev; |
@@ -150,7 +159,7 @@ static char user_alpha2[2]; | |||
150 | module_param(ieee80211_regdom, charp, 0444); | 159 | module_param(ieee80211_regdom, charp, 0444); |
151 | MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); | 160 | MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); |
152 | 161 | ||
153 | static void reset_regdomains(void) | 162 | static void reset_regdomains(bool full_reset) |
154 | { | 163 | { |
155 | /* avoid freeing static information or freeing something twice */ | 164 | /* avoid freeing static information or freeing something twice */ |
156 | if (cfg80211_regdomain == cfg80211_world_regdom) | 165 | if (cfg80211_regdomain == cfg80211_world_regdom) |
@@ -165,6 +174,13 @@ static void reset_regdomains(void) | |||
165 | 174 | ||
166 | cfg80211_world_regdom = &world_regdom; | 175 | cfg80211_world_regdom = &world_regdom; |
167 | cfg80211_regdomain = NULL; | 176 | cfg80211_regdomain = NULL; |
177 | |||
178 | if (!full_reset) | ||
179 | return; | ||
180 | |||
181 | if (last_request != &core_request_world) | ||
182 | kfree(last_request); | ||
183 | last_request = &core_request_world; | ||
168 | } | 184 | } |
169 | 185 | ||
170 | /* | 186 | /* |
@@ -175,7 +191,7 @@ static void update_world_regdomain(const struct ieee80211_regdomain *rd) | |||
175 | { | 191 | { |
176 | BUG_ON(!last_request); | 192 | BUG_ON(!last_request); |
177 | 193 | ||
178 | reset_regdomains(); | 194 | reset_regdomains(false); |
179 | 195 | ||
180 | cfg80211_world_regdom = rd; | 196 | cfg80211_world_regdom = rd; |
181 | cfg80211_regdomain = rd; | 197 | cfg80211_regdomain = rd; |
@@ -1407,7 +1423,8 @@ static int __regulatory_hint(struct wiphy *wiphy, | |||
1407 | } | 1423 | } |
1408 | 1424 | ||
1409 | new_request: | 1425 | new_request: |
1410 | kfree(last_request); | 1426 | if (last_request != &core_request_world) |
1427 | kfree(last_request); | ||
1411 | 1428 | ||
1412 | last_request = pending_request; | 1429 | last_request = pending_request; |
1413 | last_request->intersect = intersect; | 1430 | last_request->intersect = intersect; |
@@ -1577,9 +1594,6 @@ static int regulatory_hint_core(const char *alpha2) | |||
1577 | { | 1594 | { |
1578 | struct regulatory_request *request; | 1595 | struct regulatory_request *request; |
1579 | 1596 | ||
1580 | kfree(last_request); | ||
1581 | last_request = NULL; | ||
1582 | |||
1583 | request = kzalloc(sizeof(struct regulatory_request), | 1597 | request = kzalloc(sizeof(struct regulatory_request), |
1584 | GFP_KERNEL); | 1598 | GFP_KERNEL); |
1585 | if (!request) | 1599 | if (!request) |
@@ -1777,7 +1791,7 @@ static void restore_regulatory_settings(bool reset_user) | |||
1777 | mutex_lock(&cfg80211_mutex); | 1791 | mutex_lock(&cfg80211_mutex); |
1778 | mutex_lock(®_mutex); | 1792 | mutex_lock(®_mutex); |
1779 | 1793 | ||
1780 | reset_regdomains(); | 1794 | reset_regdomains(true); |
1781 | restore_alpha2(alpha2, reset_user); | 1795 | restore_alpha2(alpha2, reset_user); |
1782 | 1796 | ||
1783 | /* | 1797 | /* |
@@ -2037,12 +2051,18 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
2037 | } | 2051 | } |
2038 | 2052 | ||
2039 | request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); | 2053 | request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); |
2054 | if (!request_wiphy && | ||
2055 | (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER || | ||
2056 | last_request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE)) { | ||
2057 | schedule_delayed_work(®_timeout, 0); | ||
2058 | return -ENODEV; | ||
2059 | } | ||
2040 | 2060 | ||
2041 | if (!last_request->intersect) { | 2061 | if (!last_request->intersect) { |
2042 | int r; | 2062 | int r; |
2043 | 2063 | ||
2044 | if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) { | 2064 | if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) { |
2045 | reset_regdomains(); | 2065 | reset_regdomains(false); |
2046 | cfg80211_regdomain = rd; | 2066 | cfg80211_regdomain = rd; |
2047 | return 0; | 2067 | return 0; |
2048 | } | 2068 | } |
@@ -2063,7 +2083,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
2063 | if (r) | 2083 | if (r) |
2064 | return r; | 2084 | return r; |
2065 | 2085 | ||
2066 | reset_regdomains(); | 2086 | reset_regdomains(false); |
2067 | cfg80211_regdomain = rd; | 2087 | cfg80211_regdomain = rd; |
2068 | return 0; | 2088 | return 0; |
2069 | } | 2089 | } |
@@ -2088,7 +2108,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
2088 | 2108 | ||
2089 | rd = NULL; | 2109 | rd = NULL; |
2090 | 2110 | ||
2091 | reset_regdomains(); | 2111 | reset_regdomains(false); |
2092 | cfg80211_regdomain = intersected_rd; | 2112 | cfg80211_regdomain = intersected_rd; |
2093 | 2113 | ||
2094 | return 0; | 2114 | return 0; |
@@ -2108,7 +2128,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
2108 | kfree(rd); | 2128 | kfree(rd); |
2109 | rd = NULL; | 2129 | rd = NULL; |
2110 | 2130 | ||
2111 | reset_regdomains(); | 2131 | reset_regdomains(false); |
2112 | cfg80211_regdomain = intersected_rd; | 2132 | cfg80211_regdomain = intersected_rd; |
2113 | 2133 | ||
2114 | return 0; | 2134 | return 0; |
@@ -2261,11 +2281,8 @@ void /* __init_or_exit */ regulatory_exit(void) | |||
2261 | mutex_lock(&cfg80211_mutex); | 2281 | mutex_lock(&cfg80211_mutex); |
2262 | mutex_lock(®_mutex); | 2282 | mutex_lock(®_mutex); |
2263 | 2283 | ||
2264 | reset_regdomains(); | 2284 | reset_regdomains(true); |
2265 | |||
2266 | kfree(last_request); | ||
2267 | 2285 | ||
2268 | last_request = NULL; | ||
2269 | dev_set_uevent_suppress(®_pdev->dev, true); | 2286 | dev_set_uevent_suppress(®_pdev->dev, true); |
2270 | 2287 | ||
2271 | platform_device_unregister(reg_pdev); | 2288 | platform_device_unregister(reg_pdev); |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 552df27dcf53..2118d6446630 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2382,9 +2382,11 @@ static unsigned int xfrm_default_advmss(const struct dst_entry *dst) | |||
2382 | return dst_metric_advmss(dst->path); | 2382 | return dst_metric_advmss(dst->path); |
2383 | } | 2383 | } |
2384 | 2384 | ||
2385 | static unsigned int xfrm_default_mtu(const struct dst_entry *dst) | 2385 | static unsigned int xfrm_mtu(const struct dst_entry *dst) |
2386 | { | 2386 | { |
2387 | return dst_mtu(dst->path); | 2387 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
2388 | |||
2389 | return mtu ? : dst_mtu(dst->path); | ||
2388 | } | 2390 | } |
2389 | 2391 | ||
2390 | static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr) | 2392 | static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr) |
@@ -2411,8 +2413,8 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo) | |||
2411 | dst_ops->check = xfrm_dst_check; | 2413 | dst_ops->check = xfrm_dst_check; |
2412 | if (likely(dst_ops->default_advmss == NULL)) | 2414 | if (likely(dst_ops->default_advmss == NULL)) |
2413 | dst_ops->default_advmss = xfrm_default_advmss; | 2415 | dst_ops->default_advmss = xfrm_default_advmss; |
2414 | if (likely(dst_ops->default_mtu == NULL)) | 2416 | if (likely(dst_ops->mtu == NULL)) |
2415 | dst_ops->default_mtu = xfrm_default_mtu; | 2417 | dst_ops->mtu = xfrm_mtu; |
2416 | if (likely(dst_ops->negative_advice == NULL)) | 2418 | if (likely(dst_ops->negative_advice == NULL)) |
2417 | dst_ops->negative_advice = xfrm_negative_advice; | 2419 | dst_ops->negative_advice = xfrm_negative_advice; |
2418 | if (likely(dst_ops->link_failure == NULL)) | 2420 | if (likely(dst_ops->link_failure == NULL)) |
diff --git a/security/apparmor/path.c b/security/apparmor/path.c index 36cc0cc39e78..b566eba4a65c 100644 --- a/security/apparmor/path.c +++ b/security/apparmor/path.c | |||
@@ -57,23 +57,44 @@ static int prepend(char **buffer, int buflen, const char *str, int namelen) | |||
57 | static int d_namespace_path(struct path *path, char *buf, int buflen, | 57 | static int d_namespace_path(struct path *path, char *buf, int buflen, |
58 | char **name, int flags) | 58 | char **name, int flags) |
59 | { | 59 | { |
60 | struct path root, tmp; | ||
61 | char *res; | 60 | char *res; |
62 | int connected, error = 0; | 61 | int error = 0; |
62 | int connected = 1; | ||
63 | |||
64 | if (path->mnt->mnt_flags & MNT_INTERNAL) { | ||
65 | /* it's not mounted anywhere */ | ||
66 | res = dentry_path(path->dentry, buf, buflen); | ||
67 | *name = res; | ||
68 | if (IS_ERR(res)) { | ||
69 | *name = buf; | ||
70 | return PTR_ERR(res); | ||
71 | } | ||
72 | if (path->dentry->d_sb->s_magic == PROC_SUPER_MAGIC && | ||
73 | strncmp(*name, "/sys/", 5) == 0) { | ||
74 | /* TODO: convert over to using a per namespace | ||
75 | * control instead of hard coded /proc | ||
76 | */ | ||
77 | return prepend(name, *name - buf, "/proc", 5); | ||
78 | } | ||
79 | return 0; | ||
80 | } | ||
63 | 81 | ||
64 | /* Get the root we want to resolve too, released below */ | 82 | /* resolve paths relative to chroot?*/ |
65 | if (flags & PATH_CHROOT_REL) { | 83 | if (flags & PATH_CHROOT_REL) { |
66 | /* resolve paths relative to chroot */ | 84 | struct path root; |
67 | get_fs_root(current->fs, &root); | 85 | get_fs_root(current->fs, &root); |
68 | } else { | 86 | res = __d_path(path, &root, buf, buflen); |
69 | /* resolve paths relative to namespace */ | 87 | if (res && !IS_ERR(res)) { |
70 | root.mnt = current->nsproxy->mnt_ns->root; | 88 | /* everything's fine */ |
71 | root.dentry = root.mnt->mnt_root; | 89 | *name = res; |
72 | path_get(&root); | 90 | path_put(&root); |
91 | goto ok; | ||
92 | } | ||
93 | path_put(&root); | ||
94 | connected = 0; | ||
73 | } | 95 | } |
74 | 96 | ||
75 | tmp = root; | 97 | res = d_absolute_path(path, buf, buflen); |
76 | res = __d_path(path, &tmp, buf, buflen); | ||
77 | 98 | ||
78 | *name = res; | 99 | *name = res; |
79 | /* handle error conditions - and still allow a partial path to | 100 | /* handle error conditions - and still allow a partial path to |
@@ -84,7 +105,10 @@ static int d_namespace_path(struct path *path, char *buf, int buflen, | |||
84 | *name = buf; | 105 | *name = buf; |
85 | goto out; | 106 | goto out; |
86 | } | 107 | } |
108 | if (!our_mnt(path->mnt)) | ||
109 | connected = 0; | ||
87 | 110 | ||
111 | ok: | ||
88 | /* Handle two cases: | 112 | /* Handle two cases: |
89 | * 1. A deleted dentry && profile is not allowing mediation of deleted | 113 | * 1. A deleted dentry && profile is not allowing mediation of deleted |
90 | * 2. On some filesystems, newly allocated dentries appear to the | 114 | * 2. On some filesystems, newly allocated dentries appear to the |
@@ -97,10 +121,7 @@ static int d_namespace_path(struct path *path, char *buf, int buflen, | |||
97 | goto out; | 121 | goto out; |
98 | } | 122 | } |
99 | 123 | ||
100 | /* Determine if the path is connected to the expected root */ | 124 | /* If the path is not connected to the expected root, |
101 | connected = tmp.dentry == root.dentry && tmp.mnt == root.mnt; | ||
102 | |||
103 | /* If the path is not connected, | ||
104 | * check if it is a sysctl and handle specially else remove any | 125 | * check if it is a sysctl and handle specially else remove any |
105 | * leading / that __d_path may have returned. | 126 | * leading / that __d_path may have returned. |
106 | * Unless | 127 | * Unless |
@@ -112,17 +133,9 @@ static int d_namespace_path(struct path *path, char *buf, int buflen, | |||
112 | * namespace root. | 133 | * namespace root. |
113 | */ | 134 | */ |
114 | if (!connected) { | 135 | if (!connected) { |
115 | /* is the disconnect path a sysctl? */ | 136 | if (!(flags & PATH_CONNECT_PATH) && |
116 | if (tmp.dentry->d_sb->s_magic == PROC_SUPER_MAGIC && | ||
117 | strncmp(*name, "/sys/", 5) == 0) { | ||
118 | /* TODO: convert over to using a per namespace | ||
119 | * control instead of hard coded /proc | ||
120 | */ | ||
121 | error = prepend(name, *name - buf, "/proc", 5); | ||
122 | } else if (!(flags & PATH_CONNECT_PATH) && | ||
123 | !(((flags & CHROOT_NSCONNECT) == CHROOT_NSCONNECT) && | 137 | !(((flags & CHROOT_NSCONNECT) == CHROOT_NSCONNECT) && |
124 | (tmp.mnt == current->nsproxy->mnt_ns->root && | 138 | our_mnt(path->mnt))) { |
125 | tmp.dentry == tmp.mnt->mnt_root))) { | ||
126 | /* disconnected path, don't return pathname starting | 139 | /* disconnected path, don't return pathname starting |
127 | * with '/' | 140 | * with '/' |
128 | */ | 141 | */ |
@@ -133,8 +146,6 @@ static int d_namespace_path(struct path *path, char *buf, int buflen, | |||
133 | } | 146 | } |
134 | 147 | ||
135 | out: | 148 | out: |
136 | path_put(&root); | ||
137 | |||
138 | return error; | 149 | return error; |
139 | } | 150 | } |
140 | 151 | ||
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index 738bbdf8d4c7..d9f3ced8756e 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c | |||
@@ -101,9 +101,8 @@ static char *tomoyo_get_absolute_path(struct path *path, char * const buffer, | |||
101 | { | 101 | { |
102 | char *pos = ERR_PTR(-ENOMEM); | 102 | char *pos = ERR_PTR(-ENOMEM); |
103 | if (buflen >= 256) { | 103 | if (buflen >= 256) { |
104 | struct path ns_root = { }; | ||
105 | /* go to whatever namespace root we are under */ | 104 | /* go to whatever namespace root we are under */ |
106 | pos = __d_path(path, &ns_root, buffer, buflen - 1); | 105 | pos = d_absolute_path(path, buffer, buflen - 1); |
107 | if (!IS_ERR(pos) && *pos == '/' && pos[1]) { | 106 | if (!IS_ERR(pos) && *pos == '/' && pos[1]) { |
108 | struct inode *inode = path->dentry->d_inode; | 107 | struct inode *inode = path->dentry->d_inode; |
109 | if (inode && S_ISDIR(inode->i_mode)) { | 108 | if (inode && S_ISDIR(inode->i_mode)) { |
@@ -294,8 +293,16 @@ char *tomoyo_realpath_from_path(struct path *path) | |||
294 | pos = tomoyo_get_local_path(path->dentry, buf, | 293 | pos = tomoyo_get_local_path(path->dentry, buf, |
295 | buf_len - 1); | 294 | buf_len - 1); |
296 | /* Get absolute name for the rest. */ | 295 | /* Get absolute name for the rest. */ |
297 | else | 296 | else { |
298 | pos = tomoyo_get_absolute_path(path, buf, buf_len - 1); | 297 | pos = tomoyo_get_absolute_path(path, buf, buf_len - 1); |
298 | /* | ||
299 | * Fall back to local name if absolute name is not | ||
300 | * available. | ||
301 | */ | ||
302 | if (pos == ERR_PTR(-EINVAL)) | ||
303 | pos = tomoyo_get_local_path(path->dentry, buf, | ||
304 | buf_len - 1); | ||
305 | } | ||
299 | encode: | 306 | encode: |
300 | if (IS_ERR(pos)) | 307 | if (IS_ERR(pos)) |
301 | continue; | 308 | continue; |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 096507d2ca9a..7d98240def0b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -2508,7 +2508,6 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = { | |||
2508 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), | 2508 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), |
2509 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), | 2509 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), |
2510 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), | 2510 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), |
2511 | SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), | ||
2512 | SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), | 2511 | SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), |
2513 | SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), | 2512 | SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), |
2514 | SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), | 2513 | SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index cbde019d3d52..1d07e8fa2433 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -297,6 +297,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
297 | imux = &spec->input_mux[mux_idx]; | 297 | imux = &spec->input_mux[mux_idx]; |
298 | if (!imux->num_items && mux_idx > 0) | 298 | if (!imux->num_items && mux_idx > 0) |
299 | imux = &spec->input_mux[0]; | 299 | imux = &spec->input_mux[0]; |
300 | if (!imux->num_items) | ||
301 | return 0; | ||
300 | 302 | ||
301 | if (idx >= imux->num_items) | 303 | if (idx >= imux->num_items) |
302 | idx = imux->num_items - 1; | 304 | idx = imux->num_items - 1; |
@@ -2629,6 +2631,8 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, | |||
2629 | case AUTO_PIN_SPEAKER_OUT: | 2631 | case AUTO_PIN_SPEAKER_OUT: |
2630 | if (cfg->line_outs == 1) | 2632 | if (cfg->line_outs == 1) |
2631 | return "Speaker"; | 2633 | return "Speaker"; |
2634 | if (cfg->line_outs == 2) | ||
2635 | return ch ? "Bass Speaker" : "Speaker"; | ||
2632 | break; | 2636 | break; |
2633 | case AUTO_PIN_HP_OUT: | 2637 | case AUTO_PIN_HP_OUT: |
2634 | /* for multi-io case, only the primary out */ | 2638 | /* for multi-io case, only the primary out */ |
@@ -2902,7 +2906,7 @@ static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | |||
2902 | if (!nid) | 2906 | if (!nid) |
2903 | continue; | 2907 | continue; |
2904 | if (found_in_nid_list(nid, spec->multiout.dac_nids, | 2908 | if (found_in_nid_list(nid, spec->multiout.dac_nids, |
2905 | spec->multiout.num_dacs)) | 2909 | ARRAY_SIZE(spec->private_dac_nids))) |
2906 | continue; | 2910 | continue; |
2907 | if (found_in_nid_list(nid, spec->multiout.hp_out_nid, | 2911 | if (found_in_nid_list(nid, spec->multiout.hp_out_nid, |
2908 | ARRAY_SIZE(spec->multiout.hp_out_nid))) | 2912 | ARRAY_SIZE(spec->multiout.hp_out_nid))) |
@@ -2923,6 +2927,7 @@ static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) | |||
2923 | return 0; | 2927 | return 0; |
2924 | } | 2928 | } |
2925 | 2929 | ||
2930 | /* return 0 if no possible DAC is found, 1 if one or more found */ | ||
2926 | static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, | 2931 | static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, |
2927 | const hda_nid_t *pins, hda_nid_t *dacs) | 2932 | const hda_nid_t *pins, hda_nid_t *dacs) |
2928 | { | 2933 | { |
@@ -2940,7 +2945,7 @@ static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, | |||
2940 | if (!dacs[i]) | 2945 | if (!dacs[i]) |
2941 | dacs[i] = alc_auto_look_for_dac(codec, pins[i]); | 2946 | dacs[i] = alc_auto_look_for_dac(codec, pins[i]); |
2942 | } | 2947 | } |
2943 | return 0; | 2948 | return 1; |
2944 | } | 2949 | } |
2945 | 2950 | ||
2946 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, | 2951 | static int alc_auto_fill_multi_ios(struct hda_codec *codec, |
@@ -2950,7 +2955,7 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec, | |||
2950 | static int alc_auto_fill_dac_nids(struct hda_codec *codec) | 2955 | static int alc_auto_fill_dac_nids(struct hda_codec *codec) |
2951 | { | 2956 | { |
2952 | struct alc_spec *spec = codec->spec; | 2957 | struct alc_spec *spec = codec->spec; |
2953 | const struct auto_pin_cfg *cfg = &spec->autocfg; | 2958 | struct auto_pin_cfg *cfg = &spec->autocfg; |
2954 | bool redone = false; | 2959 | bool redone = false; |
2955 | int i; | 2960 | int i; |
2956 | 2961 | ||
@@ -2961,6 +2966,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
2961 | spec->multiout.extra_out_nid[0] = 0; | 2966 | spec->multiout.extra_out_nid[0] = 0; |
2962 | memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids)); | 2967 | memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids)); |
2963 | spec->multiout.dac_nids = spec->private_dac_nids; | 2968 | spec->multiout.dac_nids = spec->private_dac_nids; |
2969 | spec->multi_ios = 0; | ||
2964 | 2970 | ||
2965 | /* fill hard-wired DACs first */ | 2971 | /* fill hard-wired DACs first */ |
2966 | if (!redone) { | 2972 | if (!redone) { |
@@ -2994,10 +3000,12 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
2994 | for (i = 0; i < cfg->line_outs; i++) { | 3000 | for (i = 0; i < cfg->line_outs; i++) { |
2995 | if (spec->private_dac_nids[i]) | 3001 | if (spec->private_dac_nids[i]) |
2996 | spec->multiout.num_dacs++; | 3002 | spec->multiout.num_dacs++; |
2997 | else | 3003 | else { |
2998 | memmove(spec->private_dac_nids + i, | 3004 | memmove(spec->private_dac_nids + i, |
2999 | spec->private_dac_nids + i + 1, | 3005 | spec->private_dac_nids + i + 1, |
3000 | sizeof(hda_nid_t) * (cfg->line_outs - i - 1)); | 3006 | sizeof(hda_nid_t) * (cfg->line_outs - i - 1)); |
3007 | spec->private_dac_nids[cfg->line_outs - 1] = 0; | ||
3008 | } | ||
3001 | } | 3009 | } |
3002 | 3010 | ||
3003 | if (cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { | 3011 | if (cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
@@ -3019,9 +3027,28 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) | |||
3019 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) | 3027 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) |
3020 | alc_auto_fill_extra_dacs(codec, cfg->hp_outs, cfg->hp_pins, | 3028 | alc_auto_fill_extra_dacs(codec, cfg->hp_outs, cfg->hp_pins, |
3021 | spec->multiout.hp_out_nid); | 3029 | spec->multiout.hp_out_nid); |
3022 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) | 3030 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
3023 | alc_auto_fill_extra_dacs(codec, cfg->speaker_outs, cfg->speaker_pins, | 3031 | int err = alc_auto_fill_extra_dacs(codec, cfg->speaker_outs, |
3024 | spec->multiout.extra_out_nid); | 3032 | cfg->speaker_pins, |
3033 | spec->multiout.extra_out_nid); | ||
3034 | /* if no speaker volume is assigned, try again as the primary | ||
3035 | * output | ||
3036 | */ | ||
3037 | if (!err && cfg->speaker_outs > 0 && | ||
3038 | cfg->line_out_type == AUTO_PIN_HP_OUT) { | ||
3039 | cfg->hp_outs = cfg->line_outs; | ||
3040 | memcpy(cfg->hp_pins, cfg->line_out_pins, | ||
3041 | sizeof(cfg->hp_pins)); | ||
3042 | cfg->line_outs = cfg->speaker_outs; | ||
3043 | memcpy(cfg->line_out_pins, cfg->speaker_pins, | ||
3044 | sizeof(cfg->speaker_pins)); | ||
3045 | cfg->speaker_outs = 0; | ||
3046 | memset(cfg->speaker_pins, 0, sizeof(cfg->speaker_pins)); | ||
3047 | cfg->line_out_type = AUTO_PIN_SPEAKER_OUT; | ||
3048 | redone = false; | ||
3049 | goto again; | ||
3050 | } | ||
3051 | } | ||
3025 | 3052 | ||
3026 | return 0; | 3053 | return 0; |
3027 | } | 3054 | } |
@@ -3171,7 +3198,8 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
3171 | } | 3198 | } |
3172 | 3199 | ||
3173 | static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | 3200 | static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, |
3174 | hda_nid_t dac, const char *pfx) | 3201 | hda_nid_t dac, const char *pfx, |
3202 | int cidx) | ||
3175 | { | 3203 | { |
3176 | struct alc_spec *spec = codec->spec; | 3204 | struct alc_spec *spec = codec->spec; |
3177 | hda_nid_t sw, vol; | 3205 | hda_nid_t sw, vol; |
@@ -3187,15 +3215,15 @@ static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |||
3187 | if (is_ctl_used(spec->sw_ctls, val)) | 3215 | if (is_ctl_used(spec->sw_ctls, val)) |
3188 | return 0; /* already created */ | 3216 | return 0; /* already created */ |
3189 | mark_ctl_usage(spec->sw_ctls, val); | 3217 | mark_ctl_usage(spec->sw_ctls, val); |
3190 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); | 3218 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, cidx, val); |
3191 | } | 3219 | } |
3192 | 3220 | ||
3193 | sw = alc_look_for_out_mute_nid(codec, pin, dac); | 3221 | sw = alc_look_for_out_mute_nid(codec, pin, dac); |
3194 | vol = alc_look_for_out_vol_nid(codec, pin, dac); | 3222 | vol = alc_look_for_out_vol_nid(codec, pin, dac); |
3195 | err = alc_auto_add_stereo_vol(codec, pfx, 0, vol); | 3223 | err = alc_auto_add_stereo_vol(codec, pfx, cidx, vol); |
3196 | if (err < 0) | 3224 | if (err < 0) |
3197 | return err; | 3225 | return err; |
3198 | err = alc_auto_add_stereo_sw(codec, pfx, 0, sw); | 3226 | err = alc_auto_add_stereo_sw(codec, pfx, cidx, sw); |
3199 | if (err < 0) | 3227 | if (err < 0) |
3200 | return err; | 3228 | return err; |
3201 | return 0; | 3229 | return 0; |
@@ -3236,16 +3264,21 @@ static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins, | |||
3236 | hda_nid_t dac = *dacs; | 3264 | hda_nid_t dac = *dacs; |
3237 | if (!dac) | 3265 | if (!dac) |
3238 | dac = spec->multiout.dac_nids[0]; | 3266 | dac = spec->multiout.dac_nids[0]; |
3239 | return alc_auto_create_extra_out(codec, *pins, dac, pfx); | 3267 | return alc_auto_create_extra_out(codec, *pins, dac, pfx, 0); |
3240 | } | 3268 | } |
3241 | 3269 | ||
3242 | if (dacs[num_pins - 1]) { | 3270 | if (dacs[num_pins - 1]) { |
3243 | /* OK, we have a multi-output system with individual volumes */ | 3271 | /* OK, we have a multi-output system with individual volumes */ |
3244 | for (i = 0; i < num_pins; i++) { | 3272 | for (i = 0; i < num_pins; i++) { |
3245 | snprintf(name, sizeof(name), "%s %s", | 3273 | if (num_pins >= 3) { |
3246 | pfx, channel_name[i]); | 3274 | snprintf(name, sizeof(name), "%s %s", |
3247 | err = alc_auto_create_extra_out(codec, pins[i], dacs[i], | 3275 | pfx, channel_name[i]); |
3248 | name); | 3276 | err = alc_auto_create_extra_out(codec, pins[i], dacs[i], |
3277 | name, 0); | ||
3278 | } else { | ||
3279 | err = alc_auto_create_extra_out(codec, pins[i], dacs[i], | ||
3280 | pfx, i); | ||
3281 | } | ||
3249 | if (err < 0) | 3282 | if (err < 0) |
3250 | return err; | 3283 | return err; |
3251 | } | 3284 | } |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index f3658658548e..eeb25d529e30 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -215,6 +215,7 @@ struct sigmatel_spec { | |||
215 | unsigned int gpio_mute; | 215 | unsigned int gpio_mute; |
216 | unsigned int gpio_led; | 216 | unsigned int gpio_led; |
217 | unsigned int gpio_led_polarity; | 217 | unsigned int gpio_led_polarity; |
218 | unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */ | ||
218 | unsigned int vref_led; | 219 | unsigned int vref_led; |
219 | 220 | ||
220 | /* stream */ | 221 | /* stream */ |
@@ -4318,12 +4319,10 @@ static void stac_store_hints(struct hda_codec *codec) | |||
4318 | spec->eapd_switch = val; | 4319 | spec->eapd_switch = val; |
4319 | get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity); | 4320 | get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity); |
4320 | if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { | 4321 | if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { |
4321 | if (spec->gpio_led <= 8) { | 4322 | spec->gpio_mask |= spec->gpio_led; |
4322 | spec->gpio_mask |= spec->gpio_led; | 4323 | spec->gpio_dir |= spec->gpio_led; |
4323 | spec->gpio_dir |= spec->gpio_led; | 4324 | if (spec->gpio_led_polarity) |
4324 | if (spec->gpio_led_polarity) | 4325 | spec->gpio_data |= spec->gpio_led; |
4325 | spec->gpio_data |= spec->gpio_led; | ||
4326 | } | ||
4327 | } | 4326 | } |
4328 | } | 4327 | } |
4329 | 4328 | ||
@@ -4441,7 +4440,9 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4441 | int pinctl, def_conf; | 4440 | int pinctl, def_conf; |
4442 | 4441 | ||
4443 | /* power on when no jack detection is available */ | 4442 | /* power on when no jack detection is available */ |
4444 | if (!spec->hp_detect) { | 4443 | /* or when the VREF is used for controlling LED */ |
4444 | if (!spec->hp_detect || | ||
4445 | spec->vref_mute_led_nid == nid) { | ||
4445 | stac_toggle_power_map(codec, nid, 1); | 4446 | stac_toggle_power_map(codec, nid, 1); |
4446 | continue; | 4447 | continue; |
4447 | } | 4448 | } |
@@ -4913,8 +4914,14 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity) | |||
4913 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", | 4914 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", |
4914 | &spec->gpio_led_polarity, | 4915 | &spec->gpio_led_polarity, |
4915 | &spec->gpio_led) == 2) { | 4916 | &spec->gpio_led) == 2) { |
4916 | if (spec->gpio_led < 4) | 4917 | unsigned int max_gpio; |
4918 | max_gpio = snd_hda_param_read(codec, codec->afg, | ||
4919 | AC_PAR_GPIO_CAP); | ||
4920 | max_gpio &= AC_GPIO_IO_COUNT; | ||
4921 | if (spec->gpio_led < max_gpio) | ||
4917 | spec->gpio_led = 1 << spec->gpio_led; | 4922 | spec->gpio_led = 1 << spec->gpio_led; |
4923 | else | ||
4924 | spec->vref_mute_led_nid = spec->gpio_led; | ||
4918 | return 1; | 4925 | return 1; |
4919 | } | 4926 | } |
4920 | if (sscanf(dev->name, "HP_Mute_LED_%d", | 4927 | if (sscanf(dev->name, "HP_Mute_LED_%d", |
@@ -5043,29 +5050,12 @@ static int stac92xx_pre_resume(struct hda_codec *codec) | |||
5043 | struct sigmatel_spec *spec = codec->spec; | 5050 | struct sigmatel_spec *spec = codec->spec; |
5044 | 5051 | ||
5045 | /* sync mute LED */ | 5052 | /* sync mute LED */ |
5046 | if (spec->gpio_led) { | 5053 | if (spec->vref_mute_led_nid) |
5047 | if (spec->gpio_led <= 8) { | 5054 | stac_vrefout_set(codec, spec->vref_mute_led_nid, |
5048 | stac_gpio_set(codec, spec->gpio_mask, | 5055 | spec->vref_led); |
5049 | spec->gpio_dir, spec->gpio_data); | 5056 | else if (spec->gpio_led) |
5050 | } else { | 5057 | stac_gpio_set(codec, spec->gpio_mask, |
5051 | stac_vrefout_set(codec, | 5058 | spec->gpio_dir, spec->gpio_data); |
5052 | spec->gpio_led, spec->vref_led); | ||
5053 | } | ||
5054 | } | ||
5055 | return 0; | ||
5056 | } | ||
5057 | |||
5058 | static int stac92xx_post_suspend(struct hda_codec *codec) | ||
5059 | { | ||
5060 | struct sigmatel_spec *spec = codec->spec; | ||
5061 | if (spec->gpio_led > 8) { | ||
5062 | /* with vref-out pin used for mute led control | ||
5063 | * codec AFG is prevented from D3 state, but on | ||
5064 | * system suspend it can (and should) be used | ||
5065 | */ | ||
5066 | snd_hda_codec_read(codec, codec->afg, 0, | ||
5067 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | ||
5068 | } | ||
5069 | return 0; | 5059 | return 0; |
5070 | } | 5060 | } |
5071 | 5061 | ||
@@ -5076,7 +5066,7 @@ static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
5076 | struct sigmatel_spec *spec = codec->spec; | 5066 | struct sigmatel_spec *spec = codec->spec; |
5077 | 5067 | ||
5078 | if (power_state == AC_PWRST_D3) { | 5068 | if (power_state == AC_PWRST_D3) { |
5079 | if (spec->gpio_led > 8) { | 5069 | if (spec->vref_mute_led_nid) { |
5080 | /* with vref-out pin used for mute led control | 5070 | /* with vref-out pin used for mute led control |
5081 | * codec AFG is prevented from D3 state | 5071 | * codec AFG is prevented from D3 state |
5082 | */ | 5072 | */ |
@@ -5129,7 +5119,7 @@ static int stac92xx_update_led_status(struct hda_codec *codec) | |||
5129 | } | 5119 | } |
5130 | } | 5120 | } |
5131 | /*polarity defines *not* muted state level*/ | 5121 | /*polarity defines *not* muted state level*/ |
5132 | if (spec->gpio_led <= 8) { | 5122 | if (!spec->vref_mute_led_nid) { |
5133 | if (muted) | 5123 | if (muted) |
5134 | spec->gpio_data &= ~spec->gpio_led; /* orange */ | 5124 | spec->gpio_data &= ~spec->gpio_led; /* orange */ |
5135 | else | 5125 | else |
@@ -5147,7 +5137,8 @@ static int stac92xx_update_led_status(struct hda_codec *codec) | |||
5147 | muted_lvl = spec->gpio_led_polarity ? | 5137 | muted_lvl = spec->gpio_led_polarity ? |
5148 | AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ; | 5138 | AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ; |
5149 | spec->vref_led = muted ? muted_lvl : notmtd_lvl; | 5139 | spec->vref_led = muted ? muted_lvl : notmtd_lvl; |
5150 | stac_vrefout_set(codec, spec->gpio_led, spec->vref_led); | 5140 | stac_vrefout_set(codec, spec->vref_mute_led_nid, |
5141 | spec->vref_led); | ||
5151 | } | 5142 | } |
5152 | return 0; | 5143 | return 0; |
5153 | } | 5144 | } |
@@ -5661,15 +5652,13 @@ again: | |||
5661 | 5652 | ||
5662 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5653 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5663 | if (spec->gpio_led) { | 5654 | if (spec->gpio_led) { |
5664 | if (spec->gpio_led <= 8) { | 5655 | if (!spec->vref_mute_led_nid) { |
5665 | spec->gpio_mask |= spec->gpio_led; | 5656 | spec->gpio_mask |= spec->gpio_led; |
5666 | spec->gpio_dir |= spec->gpio_led; | 5657 | spec->gpio_dir |= spec->gpio_led; |
5667 | spec->gpio_data |= spec->gpio_led; | 5658 | spec->gpio_data |= spec->gpio_led; |
5668 | } else { | 5659 | } else { |
5669 | codec->patch_ops.set_power_state = | 5660 | codec->patch_ops.set_power_state = |
5670 | stac92xx_set_power_state; | 5661 | stac92xx_set_power_state; |
5671 | codec->patch_ops.post_suspend = | ||
5672 | stac92xx_post_suspend; | ||
5673 | } | 5662 | } |
5674 | codec->patch_ops.pre_resume = stac92xx_pre_resume; | 5663 | codec->patch_ops.pre_resume = stac92xx_pre_resume; |
5675 | codec->patch_ops.check_power_status = | 5664 | codec->patch_ops.check_power_status = |
@@ -5976,15 +5965,13 @@ again: | |||
5976 | 5965 | ||
5977 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 5966 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
5978 | if (spec->gpio_led) { | 5967 | if (spec->gpio_led) { |
5979 | if (spec->gpio_led <= 8) { | 5968 | if (!spec->vref_mute_led_nid) { |
5980 | spec->gpio_mask |= spec->gpio_led; | 5969 | spec->gpio_mask |= spec->gpio_led; |
5981 | spec->gpio_dir |= spec->gpio_led; | 5970 | spec->gpio_dir |= spec->gpio_led; |
5982 | spec->gpio_data |= spec->gpio_led; | 5971 | spec->gpio_data |= spec->gpio_led; |
5983 | } else { | 5972 | } else { |
5984 | codec->patch_ops.set_power_state = | 5973 | codec->patch_ops.set_power_state = |
5985 | stac92xx_set_power_state; | 5974 | stac92xx_set_power_state; |
5986 | codec->patch_ops.post_suspend = | ||
5987 | stac92xx_post_suspend; | ||
5988 | } | 5975 | } |
5989 | codec->patch_ops.pre_resume = stac92xx_pre_resume; | 5976 | codec->patch_ops.pre_resume = stac92xx_pre_resume; |
5990 | codec->patch_ops.check_power_status = | 5977 | codec->patch_ops.check_power_status = |
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index a391e622a192..28dfafb56dd1 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c | |||
@@ -41,6 +41,7 @@ MODULE_SUPPORTED_DEVICE("{{SiS,SiS7019 Audio Accelerator}}"); | |||
41 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ | 41 | static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ |
42 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ | 42 | static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ |
43 | static int enable = 1; | 43 | static int enable = 1; |
44 | static int codecs = 1; | ||
44 | 45 | ||
45 | module_param(index, int, 0444); | 46 | module_param(index, int, 0444); |
46 | MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator."); | 47 | MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator."); |
@@ -48,6 +49,8 @@ module_param(id, charp, 0444); | |||
48 | MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator."); | 49 | MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator."); |
49 | module_param(enable, bool, 0444); | 50 | module_param(enable, bool, 0444); |
50 | MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator."); | 51 | MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator."); |
52 | module_param(codecs, int, 0444); | ||
53 | MODULE_PARM_DESC(codecs, "Set bit to indicate that codec number is expected to be present (default 1)"); | ||
51 | 54 | ||
52 | static DEFINE_PCI_DEVICE_TABLE(snd_sis7019_ids) = { | 55 | static DEFINE_PCI_DEVICE_TABLE(snd_sis7019_ids) = { |
53 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x7019) }, | 56 | { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x7019) }, |
@@ -140,6 +143,9 @@ struct sis7019 { | |||
140 | dma_addr_t silence_dma_addr; | 143 | dma_addr_t silence_dma_addr; |
141 | }; | 144 | }; |
142 | 145 | ||
146 | /* These values are also used by the module param 'codecs' to indicate | ||
147 | * which codecs should be present. | ||
148 | */ | ||
143 | #define SIS_PRIMARY_CODEC_PRESENT 0x0001 | 149 | #define SIS_PRIMARY_CODEC_PRESENT 0x0001 |
144 | #define SIS_SECONDARY_CODEC_PRESENT 0x0002 | 150 | #define SIS_SECONDARY_CODEC_PRESENT 0x0002 |
145 | #define SIS_TERTIARY_CODEC_PRESENT 0x0004 | 151 | #define SIS_TERTIARY_CODEC_PRESENT 0x0004 |
@@ -1078,6 +1084,7 @@ static int sis_chip_init(struct sis7019 *sis) | |||
1078 | { | 1084 | { |
1079 | unsigned long io = sis->ioport; | 1085 | unsigned long io = sis->ioport; |
1080 | void __iomem *ioaddr = sis->ioaddr; | 1086 | void __iomem *ioaddr = sis->ioaddr; |
1087 | unsigned long timeout; | ||
1081 | u16 status; | 1088 | u16 status; |
1082 | int count; | 1089 | int count; |
1083 | int i; | 1090 | int i; |
@@ -1104,21 +1111,45 @@ static int sis_chip_init(struct sis7019 *sis) | |||
1104 | while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count) | 1111 | while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count) |
1105 | udelay(1); | 1112 | udelay(1); |
1106 | 1113 | ||
1114 | /* Command complete, we can let go of the semaphore now. | ||
1115 | */ | ||
1116 | outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA); | ||
1117 | if (!count) | ||
1118 | return -EIO; | ||
1119 | |||
1107 | /* Now that we've finished the reset, find out what's attached. | 1120 | /* Now that we've finished the reset, find out what's attached. |
1121 | * There are some codec/board combinations that take an extremely | ||
1122 | * long time to come up. 350+ ms has been observed in the field, | ||
1123 | * so we'll give them up to 500ms. | ||
1108 | */ | 1124 | */ |
1109 | status = inl(io + SIS_AC97_STATUS); | 1125 | sis->codecs_present = 0; |
1110 | if (status & SIS_AC97_STATUS_CODEC_READY) | 1126 | timeout = msecs_to_jiffies(500) + jiffies; |
1111 | sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT; | 1127 | while (time_before_eq(jiffies, timeout)) { |
1112 | if (status & SIS_AC97_STATUS_CODEC2_READY) | 1128 | status = inl(io + SIS_AC97_STATUS); |
1113 | sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT; | 1129 | if (status & SIS_AC97_STATUS_CODEC_READY) |
1114 | if (status & SIS_AC97_STATUS_CODEC3_READY) | 1130 | sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT; |
1115 | sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT; | 1131 | if (status & SIS_AC97_STATUS_CODEC2_READY) |
1116 | 1132 | sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT; | |
1117 | /* All done, let go of the semaphore, and check for errors | 1133 | if (status & SIS_AC97_STATUS_CODEC3_READY) |
1134 | sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT; | ||
1135 | |||
1136 | if (sis->codecs_present == codecs) | ||
1137 | break; | ||
1138 | |||
1139 | msleep(1); | ||
1140 | } | ||
1141 | |||
1142 | /* All done, check for errors. | ||
1118 | */ | 1143 | */ |
1119 | outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA); | 1144 | if (!sis->codecs_present) { |
1120 | if (!sis->codecs_present || !count) | 1145 | printk(KERN_ERR "sis7019: could not find any codecs\n"); |
1121 | return -EIO; | 1146 | return -EIO; |
1147 | } | ||
1148 | |||
1149 | if (sis->codecs_present != codecs) { | ||
1150 | printk(KERN_WARNING "sis7019: missing codecs, found %0x, expected %0x\n", | ||
1151 | sis->codecs_present, codecs); | ||
1152 | } | ||
1122 | 1153 | ||
1123 | /* Let the hardware know that the audio driver is alive, | 1154 | /* Let the hardware know that the audio driver is alive, |
1124 | * and enable PCM slots on the AC-link for L/R playback (3 & 4) and | 1155 | * and enable PCM slots on the AC-link for L/R playback (3 & 4) and |
@@ -1390,6 +1421,17 @@ static int __devinit snd_sis7019_probe(struct pci_dev *pci, | |||
1390 | if (!enable) | 1421 | if (!enable) |
1391 | goto error_out; | 1422 | goto error_out; |
1392 | 1423 | ||
1424 | /* The user can specify which codecs should be present so that we | ||
1425 | * can wait for them to show up if they are slow to recover from | ||
1426 | * the AC97 cold reset. We default to a single codec, the primary. | ||
1427 | * | ||
1428 | * We assume that SIS_PRIMARY_*_PRESENT matches bits 0-2. | ||
1429 | */ | ||
1430 | codecs &= SIS_PRIMARY_CODEC_PRESENT | SIS_SECONDARY_CODEC_PRESENT | | ||
1431 | SIS_TERTIARY_CODEC_PRESENT; | ||
1432 | if (!codecs) | ||
1433 | codecs = SIS_PRIMARY_CODEC_PRESENT; | ||
1434 | |||
1393 | rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card); | 1435 | rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card); |
1394 | if (rc < 0) | 1436 | if (rc < 0) |
1395 | goto error_out; | 1437 | goto error_out; |
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig index bee3c94f58b0..d1fcc816ce97 100644 --- a/sound/soc/atmel/Kconfig +++ b/sound/soc/atmel/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config SND_ATMEL_SOC | 1 | config SND_ATMEL_SOC |
2 | tristate "SoC Audio for the Atmel System-on-Chip" | 2 | tristate "SoC Audio for the Atmel System-on-Chip" |
3 | depends on ARCH_AT91 || AVR32 | 3 | depends on ARCH_AT91 |
4 | help | 4 | help |
5 | Say Y or M if you want to add support for codecs attached to | 5 | Say Y or M if you want to add support for codecs attached to |
6 | the ATMEL SSC interface. You will also need | 6 | the ATMEL SSC interface. You will also need |
@@ -24,25 +24,6 @@ config SND_AT91_SOC_SAM9G20_WM8731 | |||
24 | Say Y if you want to add support for SoC audio on WM8731-based | 24 | Say Y if you want to add support for SoC audio on WM8731-based |
25 | AT91sam9g20 evaluation board. | 25 | AT91sam9g20 evaluation board. |
26 | 26 | ||
27 | config SND_AT32_SOC_PLAYPAQ | ||
28 | tristate "SoC Audio support for PlayPaq with WM8510" | ||
29 | depends on SND_ATMEL_SOC && BOARD_PLAYPAQ && AT91_PROGRAMMABLE_CLOCKS | ||
30 | select SND_ATMEL_SOC_SSC | ||
31 | select SND_SOC_WM8510 | ||
32 | help | ||
33 | Say Y or M here if you want to add support for SoC audio | ||
34 | on the LRS PlayPaq. | ||
35 | |||
36 | config SND_AT32_SOC_PLAYPAQ_SLAVE | ||
37 | bool "Run CODEC on PlayPaq in slave mode" | ||
38 | depends on SND_AT32_SOC_PLAYPAQ | ||
39 | default n | ||
40 | help | ||
41 | Say Y if you want to run with the AT32 SSC generating the BCLK | ||
42 | and FRAME signals on the PlayPaq. Unless you want to play | ||
43 | with the AT32 as the SSC master, you probably want to say N here, | ||
44 | as this will give you better sound quality. | ||
45 | |||
46 | config SND_AT91_SOC_AFEB9260 | 27 | config SND_AT91_SOC_AFEB9260 |
47 | tristate "SoC Audio support for AFEB9260 board" | 28 | tristate "SoC Audio support for AFEB9260 board" |
48 | depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC | 29 | depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC |
diff --git a/sound/soc/atmel/Makefile b/sound/soc/atmel/Makefile index e7ea56bd5f82..a5c0bf19da78 100644 --- a/sound/soc/atmel/Makefile +++ b/sound/soc/atmel/Makefile | |||
@@ -8,9 +8,5 @@ obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o | |||
8 | # AT91 Machine Support | 8 | # AT91 Machine Support |
9 | snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o | 9 | snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o |
10 | 10 | ||
11 | # AT32 Machine Support | ||
12 | snd-soc-playpaq-objs := playpaq_wm8510.o | ||
13 | |||
14 | obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o | 11 | obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o |
15 | obj-$(CONFIG_SND_AT32_SOC_PLAYPAQ) += snd-soc-playpaq.o | ||
16 | obj-$(CONFIG_SND_AT91_SOC_AFEB9260) += snd-soc-afeb9260.o | 12 | obj-$(CONFIG_SND_AT91_SOC_AFEB9260) += snd-soc-afeb9260.o |
diff --git a/sound/soc/atmel/playpaq_wm8510.c b/sound/soc/atmel/playpaq_wm8510.c deleted file mode 100644 index 73ae99ad4578..000000000000 --- a/sound/soc/atmel/playpaq_wm8510.c +++ /dev/null | |||
@@ -1,473 +0,0 @@ | |||
1 | /* sound/soc/at32/playpaq_wm8510.c | ||
2 | * ASoC machine driver for PlayPaq using WM8510 codec | ||
3 | * | ||
4 | * Copyright (C) 2008 Long Range Systems | ||
5 | * Geoffrey Wossum <gwossum@acm.org> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This code is largely inspired by sound/soc/at91/eti_b1_wm8731.c | ||
12 | * | ||
13 | * NOTE: If you don't have the AT32 enhanced portmux configured (which | ||
14 | * isn't currently in the mainline or Atmel patched kernel), you will | ||
15 | * need to set the MCLK pin (PA30) to peripheral A in your board initialization | ||
16 | * code. Something like: | ||
17 | * at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0); | ||
18 | * | ||
19 | */ | ||
20 | |||
21 | /* #define DEBUG */ | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/moduleparam.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/clk.h> | ||
28 | #include <linux/timer.h> | ||
29 | #include <linux/interrupt.h> | ||
30 | #include <linux/platform_device.h> | ||
31 | |||
32 | #include <sound/core.h> | ||
33 | #include <sound/pcm.h> | ||
34 | #include <sound/pcm_params.h> | ||
35 | #include <sound/soc.h> | ||
36 | |||
37 | #include <mach/at32ap700x.h> | ||
38 | #include <mach/portmux.h> | ||
39 | |||
40 | #include "../codecs/wm8510.h" | ||
41 | #include "atmel-pcm.h" | ||
42 | #include "atmel_ssc_dai.h" | ||
43 | |||
44 | |||
45 | /*-------------------------------------------------------------------------*\ | ||
46 | * constants | ||
47 | \*-------------------------------------------------------------------------*/ | ||
48 | #define MCLK_PIN GPIO_PIN_PA(30) | ||
49 | #define MCLK_PERIPH GPIO_PERIPH_A | ||
50 | |||
51 | |||
52 | /*-------------------------------------------------------------------------*\ | ||
53 | * data types | ||
54 | \*-------------------------------------------------------------------------*/ | ||
55 | /* SSC clocking data */ | ||
56 | struct ssc_clock_data { | ||
57 | /* CMR div */ | ||
58 | unsigned int cmr_div; | ||
59 | |||
60 | /* Frame period (as needed by xCMR.PERIOD) */ | ||
61 | unsigned int period; | ||
62 | |||
63 | /* The SSC clock rate these settings where calculated for */ | ||
64 | unsigned long ssc_rate; | ||
65 | }; | ||
66 | |||
67 | |||
68 | /*-------------------------------------------------------------------------*\ | ||
69 | * module data | ||
70 | \*-------------------------------------------------------------------------*/ | ||
71 | static struct clk *_gclk0; | ||
72 | static struct clk *_pll0; | ||
73 | |||
74 | #define CODEC_CLK (_gclk0) | ||
75 | |||
76 | |||
77 | /*-------------------------------------------------------------------------*\ | ||
78 | * Sound SOC operations | ||
79 | \*-------------------------------------------------------------------------*/ | ||
80 | #if defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE | ||
81 | static struct ssc_clock_data playpaq_wm8510_calc_ssc_clock( | ||
82 | struct snd_pcm_hw_params *params, | ||
83 | struct snd_soc_dai *cpu_dai) | ||
84 | { | ||
85 | struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai); | ||
86 | struct ssc_device *ssc = ssc_p->ssc; | ||
87 | struct ssc_clock_data cd; | ||
88 | unsigned int rate, width_bits, channels; | ||
89 | unsigned int bitrate, ssc_div; | ||
90 | unsigned actual_rate; | ||
91 | |||
92 | |||
93 | /* | ||
94 | * Figure out required bitrate | ||
95 | */ | ||
96 | rate = params_rate(params); | ||
97 | channels = params_channels(params); | ||
98 | width_bits = snd_pcm_format_physical_width(params_format(params)); | ||
99 | bitrate = rate * width_bits * channels; | ||
100 | |||
101 | |||
102 | /* | ||
103 | * Figure out required SSC divider and period for required bitrate | ||
104 | */ | ||
105 | cd.ssc_rate = clk_get_rate(ssc->clk); | ||
106 | ssc_div = cd.ssc_rate / bitrate; | ||
107 | cd.cmr_div = ssc_div / 2; | ||
108 | if (ssc_div & 1) { | ||
109 | /* round cmr_div up */ | ||
110 | cd.cmr_div++; | ||
111 | } | ||
112 | cd.period = width_bits - 1; | ||
113 | |||
114 | |||
115 | /* | ||
116 | * Find actual rate, compare to requested rate | ||
117 | */ | ||
118 | actual_rate = (cd.ssc_rate / (cd.cmr_div * 2)) / (2 * (cd.period + 1)); | ||
119 | pr_debug("playpaq_wm8510: Request rate = %u, actual rate = %u\n", | ||
120 | rate, actual_rate); | ||
121 | |||
122 | |||
123 | return cd; | ||
124 | } | ||
125 | #endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */ | ||
126 | |||
127 | |||
128 | |||
129 | static int playpaq_wm8510_hw_params(struct snd_pcm_substream *substream, | ||
130 | struct snd_pcm_hw_params *params) | ||
131 | { | ||
132 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
133 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
134 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
135 | struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai); | ||
136 | struct ssc_device *ssc = ssc_p->ssc; | ||
137 | unsigned int pll_out = 0, bclk = 0, mclk_div = 0; | ||
138 | int ret; | ||
139 | |||
140 | |||
141 | /* Due to difficulties with getting the correct clocks from the AT32's | ||
142 | * PLL0, we're going to let the CODEC be in charge of all the clocks | ||
143 | */ | ||
144 | #if !defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE | ||
145 | const unsigned int fmt = (SND_SOC_DAIFMT_I2S | | ||
146 | SND_SOC_DAIFMT_NB_NF | | ||
147 | SND_SOC_DAIFMT_CBM_CFM); | ||
148 | #else | ||
149 | struct ssc_clock_data cd; | ||
150 | const unsigned int fmt = (SND_SOC_DAIFMT_I2S | | ||
151 | SND_SOC_DAIFMT_NB_NF | | ||
152 | SND_SOC_DAIFMT_CBS_CFS); | ||
153 | #endif | ||
154 | |||
155 | if (ssc == NULL) { | ||
156 | pr_warning("playpaq_wm8510_hw_params: ssc is NULL!\n"); | ||
157 | return -EINVAL; | ||
158 | } | ||
159 | |||
160 | |||
161 | /* | ||
162 | * Figure out PLL and BCLK dividers for WM8510 | ||
163 | */ | ||
164 | switch (params_rate(params)) { | ||
165 | case 48000: | ||
166 | pll_out = 24576000; | ||
167 | mclk_div = WM8510_MCLKDIV_2; | ||
168 | bclk = WM8510_BCLKDIV_8; | ||
169 | break; | ||
170 | |||
171 | case 44100: | ||
172 | pll_out = 22579200; | ||
173 | mclk_div = WM8510_MCLKDIV_2; | ||
174 | bclk = WM8510_BCLKDIV_8; | ||
175 | break; | ||
176 | |||
177 | case 22050: | ||
178 | pll_out = 22579200; | ||
179 | mclk_div = WM8510_MCLKDIV_4; | ||
180 | bclk = WM8510_BCLKDIV_8; | ||
181 | break; | ||
182 | |||
183 | case 16000: | ||
184 | pll_out = 24576000; | ||
185 | mclk_div = WM8510_MCLKDIV_6; | ||
186 | bclk = WM8510_BCLKDIV_8; | ||
187 | break; | ||
188 | |||
189 | case 11025: | ||
190 | pll_out = 22579200; | ||
191 | mclk_div = WM8510_MCLKDIV_8; | ||
192 | bclk = WM8510_BCLKDIV_8; | ||
193 | break; | ||
194 | |||
195 | case 8000: | ||
196 | pll_out = 24576000; | ||
197 | mclk_div = WM8510_MCLKDIV_12; | ||
198 | bclk = WM8510_BCLKDIV_8; | ||
199 | break; | ||
200 | |||
201 | default: | ||
202 | pr_warning("playpaq_wm8510: Unsupported sample rate %d\n", | ||
203 | params_rate(params)); | ||
204 | return -EINVAL; | ||
205 | } | ||
206 | |||
207 | |||
208 | /* | ||
209 | * set CPU and CODEC DAI configuration | ||
210 | */ | ||
211 | ret = snd_soc_dai_set_fmt(codec_dai, fmt); | ||
212 | if (ret < 0) { | ||
213 | pr_warning("playpaq_wm8510: " | ||
214 | "Failed to set CODEC DAI format (%d)\n", | ||
215 | ret); | ||
216 | return ret; | ||
217 | } | ||
218 | ret = snd_soc_dai_set_fmt(cpu_dai, fmt); | ||
219 | if (ret < 0) { | ||
220 | pr_warning("playpaq_wm8510: " | ||
221 | "Failed to set CPU DAI format (%d)\n", | ||
222 | ret); | ||
223 | return ret; | ||
224 | } | ||
225 | |||
226 | |||
227 | /* | ||
228 | * Set CPU clock configuration | ||
229 | */ | ||
230 | #if defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE | ||
231 | cd = playpaq_wm8510_calc_ssc_clock(params, cpu_dai); | ||
232 | pr_debug("playpaq_wm8510: cmr_div = %d, period = %d\n", | ||
233 | cd.cmr_div, cd.period); | ||
234 | ret = snd_soc_dai_set_clkdiv(cpu_dai, AT32_SSC_CMR_DIV, cd.cmr_div); | ||
235 | if (ret < 0) { | ||
236 | pr_warning("playpaq_wm8510: Failed to set CPU CMR_DIV (%d)\n", | ||
237 | ret); | ||
238 | return ret; | ||
239 | } | ||
240 | ret = snd_soc_dai_set_clkdiv(cpu_dai, AT32_SSC_TCMR_PERIOD, | ||
241 | cd.period); | ||
242 | if (ret < 0) { | ||
243 | pr_warning("playpaq_wm8510: " | ||
244 | "Failed to set CPU transmit period (%d)\n", | ||
245 | ret); | ||
246 | return ret; | ||
247 | } | ||
248 | #endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */ | ||
249 | |||
250 | |||
251 | /* | ||
252 | * Set CODEC clock configuration | ||
253 | */ | ||
254 | pr_debug("playpaq_wm8510: " | ||
255 | "pll_in = %ld, pll_out = %u, bclk = %x, mclk = %x\n", | ||
256 | clk_get_rate(CODEC_CLK), pll_out, bclk, mclk_div); | ||
257 | |||
258 | |||
259 | #if !defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE | ||
260 | ret = snd_soc_dai_set_clkdiv(codec_dai, WM8510_BCLKDIV, bclk); | ||
261 | if (ret < 0) { | ||
262 | pr_warning | ||
263 | ("playpaq_wm8510: Failed to set CODEC DAI BCLKDIV (%d)\n", | ||
264 | ret); | ||
265 | return ret; | ||
266 | } | ||
267 | #endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */ | ||
268 | |||
269 | |||
270 | ret = snd_soc_dai_set_pll(codec_dai, 0, 0, | ||
271 | clk_get_rate(CODEC_CLK), pll_out); | ||
272 | if (ret < 0) { | ||
273 | pr_warning("playpaq_wm8510: Failed to set CODEC DAI PLL (%d)\n", | ||
274 | ret); | ||
275 | return ret; | ||
276 | } | ||
277 | |||
278 | |||
279 | ret = snd_soc_dai_set_clkdiv(codec_dai, WM8510_MCLKDIV, mclk_div); | ||
280 | if (ret < 0) { | ||
281 | pr_warning("playpaq_wm8510: Failed to set CODEC MCLKDIV (%d)\n", | ||
282 | ret); | ||
283 | return ret; | ||
284 | } | ||
285 | |||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | |||
291 | |||
292 | static struct snd_soc_ops playpaq_wm8510_ops = { | ||
293 | .hw_params = playpaq_wm8510_hw_params, | ||
294 | }; | ||
295 | |||
296 | |||
297 | |||
298 | static const struct snd_soc_dapm_widget playpaq_dapm_widgets[] = { | ||
299 | SND_SOC_DAPM_MIC("Int Mic", NULL), | ||
300 | SND_SOC_DAPM_SPK("Ext Spk", NULL), | ||
301 | }; | ||
302 | |||
303 | |||
304 | |||
305 | static const struct snd_soc_dapm_route intercon[] = { | ||
306 | /* speaker connected to SPKOUT */ | ||
307 | {"Ext Spk", NULL, "SPKOUTP"}, | ||
308 | {"Ext Spk", NULL, "SPKOUTN"}, | ||
309 | |||
310 | {"Mic Bias", NULL, "Int Mic"}, | ||
311 | {"MICN", NULL, "Mic Bias"}, | ||
312 | {"MICP", NULL, "Mic Bias"}, | ||
313 | }; | ||
314 | |||
315 | |||
316 | |||
317 | static int playpaq_wm8510_init(struct snd_soc_pcm_runtime *rtd) | ||
318 | { | ||
319 | struct snd_soc_codec *codec = rtd->codec; | ||
320 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
321 | int i; | ||
322 | |||
323 | /* | ||
324 | * Add DAPM widgets | ||
325 | */ | ||
326 | for (i = 0; i < ARRAY_SIZE(playpaq_dapm_widgets); i++) | ||
327 | snd_soc_dapm_new_control(dapm, &playpaq_dapm_widgets[i]); | ||
328 | |||
329 | |||
330 | |||
331 | /* | ||
332 | * Setup audio path interconnects | ||
333 | */ | ||
334 | snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon)); | ||
335 | |||
336 | |||
337 | |||
338 | /* always connected pins */ | ||
339 | snd_soc_dapm_enable_pin(dapm, "Int Mic"); | ||
340 | snd_soc_dapm_enable_pin(dapm, "Ext Spk"); | ||
341 | |||
342 | |||
343 | |||
344 | /* Make CSB show PLL rate */ | ||
345 | snd_soc_dai_set_clkdiv(rtd->codec_dai, WM8510_OPCLKDIV, | ||
346 | WM8510_OPCLKDIV_1 | 4); | ||
347 | |||
348 | return 0; | ||
349 | } | ||
350 | |||
351 | |||
352 | |||
353 | static struct snd_soc_dai_link playpaq_wm8510_dai = { | ||
354 | .name = "WM8510", | ||
355 | .stream_name = "WM8510 PCM", | ||
356 | .cpu_dai_name= "atmel-ssc-dai.0", | ||
357 | .platform_name = "atmel-pcm-audio", | ||
358 | .codec_name = "wm8510-codec.0-0x1a", | ||
359 | .codec_dai_name = "wm8510-hifi", | ||
360 | .init = playpaq_wm8510_init, | ||
361 | .ops = &playpaq_wm8510_ops, | ||
362 | }; | ||
363 | |||
364 | |||
365 | |||
366 | static struct snd_soc_card snd_soc_playpaq = { | ||
367 | .name = "LRS_PlayPaq_WM8510", | ||
368 | .dai_link = &playpaq_wm8510_dai, | ||
369 | .num_links = 1, | ||
370 | }; | ||
371 | |||
372 | static struct platform_device *playpaq_snd_device; | ||
373 | |||
374 | |||
375 | static int __init playpaq_asoc_init(void) | ||
376 | { | ||
377 | int ret = 0; | ||
378 | |||
379 | /* | ||
380 | * Configure MCLK for WM8510 | ||
381 | */ | ||
382 | _gclk0 = clk_get(NULL, "gclk0"); | ||
383 | if (IS_ERR(_gclk0)) { | ||
384 | _gclk0 = NULL; | ||
385 | ret = PTR_ERR(_gclk0); | ||
386 | goto err_gclk0; | ||
387 | } | ||
388 | _pll0 = clk_get(NULL, "pll0"); | ||
389 | if (IS_ERR(_pll0)) { | ||
390 | _pll0 = NULL; | ||
391 | ret = PTR_ERR(_pll0); | ||
392 | goto err_pll0; | ||
393 | } | ||
394 | ret = clk_set_parent(_gclk0, _pll0); | ||
395 | if (ret) { | ||
396 | pr_warning("snd-soc-playpaq: " | ||
397 | "Failed to set PLL0 as parent for DAC clock\n"); | ||
398 | goto err_set_clk; | ||
399 | } | ||
400 | clk_set_rate(CODEC_CLK, 12000000); | ||
401 | clk_enable(CODEC_CLK); | ||
402 | |||
403 | #if defined CONFIG_AT32_ENHANCED_PORTMUX | ||
404 | at32_select_periph(MCLK_PIN, MCLK_PERIPH, 0); | ||
405 | #endif | ||
406 | |||
407 | |||
408 | /* | ||
409 | * Create and register platform device | ||
410 | */ | ||
411 | playpaq_snd_device = platform_device_alloc("soc-audio", 0); | ||
412 | if (playpaq_snd_device == NULL) { | ||
413 | ret = -ENOMEM; | ||
414 | goto err_device_alloc; | ||
415 | } | ||
416 | |||
417 | platform_set_drvdata(playpaq_snd_device, &snd_soc_playpaq); | ||
418 | |||
419 | ret = platform_device_add(playpaq_snd_device); | ||
420 | if (ret) { | ||
421 | pr_warning("playpaq_wm8510: platform_device_add failed (%d)\n", | ||
422 | ret); | ||
423 | goto err_device_add; | ||
424 | } | ||
425 | |||
426 | return 0; | ||
427 | |||
428 | |||
429 | err_device_add: | ||
430 | if (playpaq_snd_device != NULL) { | ||
431 | platform_device_put(playpaq_snd_device); | ||
432 | playpaq_snd_device = NULL; | ||
433 | } | ||
434 | err_device_alloc: | ||
435 | err_set_clk: | ||
436 | if (_pll0 != NULL) { | ||
437 | clk_put(_pll0); | ||
438 | _pll0 = NULL; | ||
439 | } | ||
440 | err_pll0: | ||
441 | if (_gclk0 != NULL) { | ||
442 | clk_put(_gclk0); | ||
443 | _gclk0 = NULL; | ||
444 | } | ||
445 | return ret; | ||
446 | } | ||
447 | |||
448 | |||
449 | static void __exit playpaq_asoc_exit(void) | ||
450 | { | ||
451 | if (_gclk0 != NULL) { | ||
452 | clk_put(_gclk0); | ||
453 | _gclk0 = NULL; | ||
454 | } | ||
455 | if (_pll0 != NULL) { | ||
456 | clk_put(_pll0); | ||
457 | _pll0 = NULL; | ||
458 | } | ||
459 | |||
460 | #if defined CONFIG_AT32_ENHANCED_PORTMUX | ||
461 | at32_free_pin(MCLK_PIN); | ||
462 | #endif | ||
463 | |||
464 | platform_device_unregister(playpaq_snd_device); | ||
465 | playpaq_snd_device = NULL; | ||
466 | } | ||
467 | |||
468 | module_init(playpaq_asoc_init); | ||
469 | module_exit(playpaq_asoc_exit); | ||
470 | |||
471 | MODULE_AUTHOR("Geoffrey Wossum <gwossum@acm.org>"); | ||
472 | MODULE_DESCRIPTION("ASoC machine driver for LRS PlayPaq"); | ||
473 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/codecs/ad1836.h b/sound/soc/codecs/ad1836.h index 444747f0db26..dd7be0dbbc58 100644 --- a/sound/soc/codecs/ad1836.h +++ b/sound/soc/codecs/ad1836.h | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | #define AD1836_ADC_CTRL2 13 | 35 | #define AD1836_ADC_CTRL2 13 |
36 | #define AD1836_ADC_WORD_LEN_MASK 0x30 | 36 | #define AD1836_ADC_WORD_LEN_MASK 0x30 |
37 | #define AD1836_ADC_WORD_OFFSET 5 | 37 | #define AD1836_ADC_WORD_OFFSET 4 |
38 | #define AD1836_ADC_SERFMT_MASK (7 << 6) | 38 | #define AD1836_ADC_SERFMT_MASK (7 << 6) |
39 | #define AD1836_ADC_SERFMT_PCK256 (0x4 << 6) | 39 | #define AD1836_ADC_SERFMT_PCK256 (0x4 << 6) |
40 | #define AD1836_ADC_SERFMT_PCK128 (0x5 << 6) | 40 | #define AD1836_ADC_SERFMT_PCK128 (0x5 << 6) |
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index f1f237ecec2a..73f46eb459f1 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c | |||
@@ -601,7 +601,6 @@ static int cs4270_soc_suspend(struct snd_soc_codec *codec, pm_message_t mesg) | |||
601 | static int cs4270_soc_resume(struct snd_soc_codec *codec) | 601 | static int cs4270_soc_resume(struct snd_soc_codec *codec) |
602 | { | 602 | { |
603 | struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); | 603 | struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); |
604 | struct i2c_client *i2c_client = to_i2c_client(codec->dev); | ||
605 | int reg; | 604 | int reg; |
606 | 605 | ||
607 | regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), | 606 | regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), |
@@ -612,14 +611,7 @@ static int cs4270_soc_resume(struct snd_soc_codec *codec) | |||
612 | ndelay(500); | 611 | ndelay(500); |
613 | 612 | ||
614 | /* first restore the entire register cache ... */ | 613 | /* first restore the entire register cache ... */ |
615 | for (reg = CS4270_FIRSTREG; reg <= CS4270_LASTREG; reg++) { | 614 | snd_soc_cache_sync(codec); |
616 | u8 val = snd_soc_read(codec, reg); | ||
617 | |||
618 | if (i2c_smbus_write_byte_data(i2c_client, reg, val)) { | ||
619 | dev_err(codec->dev, "i2c write failed\n"); | ||
620 | return -EIO; | ||
621 | } | ||
622 | } | ||
623 | 615 | ||
624 | /* ... then disable the power-down bits */ | 616 | /* ... then disable the power-down bits */ |
625 | reg = snd_soc_read(codec, CS4270_PWRCTL); | 617 | reg = snd_soc_read(codec, CS4270_PWRCTL); |
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 8c3c8205d19e..1ee66361f61b 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c | |||
@@ -555,7 +555,7 @@ static int cs42l51_probe(struct snd_soc_codec *codec) | |||
555 | 555 | ||
556 | static struct snd_soc_codec_driver soc_codec_device_cs42l51 = { | 556 | static struct snd_soc_codec_driver soc_codec_device_cs42l51 = { |
557 | .probe = cs42l51_probe, | 557 | .probe = cs42l51_probe, |
558 | .reg_cache_size = CS42L51_NUMREGS, | 558 | .reg_cache_size = CS42L51_NUMREGS + 1, |
559 | .reg_word_size = sizeof(u8), | 559 | .reg_word_size = sizeof(u8), |
560 | }; | 560 | }; |
561 | 561 | ||
diff --git a/sound/soc/codecs/max9877.c b/sound/soc/codecs/max9877.c index 9e7e964a5fa3..dcf6f2a1600a 100644 --- a/sound/soc/codecs/max9877.c +++ b/sound/soc/codecs/max9877.c | |||
@@ -106,13 +106,13 @@ static int max9877_set_2reg(struct snd_kcontrol *kcontrol, | |||
106 | unsigned int mask = mc->max; | 106 | unsigned int mask = mc->max; |
107 | unsigned int val = (ucontrol->value.integer.value[0] & mask); | 107 | unsigned int val = (ucontrol->value.integer.value[0] & mask); |
108 | unsigned int val2 = (ucontrol->value.integer.value[1] & mask); | 108 | unsigned int val2 = (ucontrol->value.integer.value[1] & mask); |
109 | unsigned int change = 1; | 109 | unsigned int change = 0; |
110 | 110 | ||
111 | if (((max9877_regs[reg] >> shift) & mask) == val) | 111 | if (((max9877_regs[reg] >> shift) & mask) != val) |
112 | change = 0; | 112 | change = 1; |
113 | 113 | ||
114 | if (((max9877_regs[reg2] >> shift) & mask) == val2) | 114 | if (((max9877_regs[reg2] >> shift) & mask) != val2) |
115 | change = 0; | 115 | change = 1; |
116 | 116 | ||
117 | if (change) { | 117 | if (change) { |
118 | max9877_regs[reg] &= ~(mask << shift); | 118 | max9877_regs[reg] &= ~(mask << shift); |
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index c5ca8cfea60f..0441893e270e 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c | |||
@@ -863,13 +863,13 @@ static struct i2c_driver uda1380_i2c_driver = { | |||
863 | 863 | ||
864 | static int __init uda1380_modinit(void) | 864 | static int __init uda1380_modinit(void) |
865 | { | 865 | { |
866 | int ret; | 866 | int ret = 0; |
867 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 867 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
868 | ret = i2c_add_driver(&uda1380_i2c_driver); | 868 | ret = i2c_add_driver(&uda1380_i2c_driver); |
869 | if (ret != 0) | 869 | if (ret != 0) |
870 | pr_err("Failed to register UDA1380 I2C driver: %d\n", ret); | 870 | pr_err("Failed to register UDA1380 I2C driver: %d\n", ret); |
871 | #endif | 871 | #endif |
872 | return 0; | 872 | return ret; |
873 | } | 873 | } |
874 | module_init(uda1380_modinit); | 874 | module_init(uda1380_modinit); |
875 | 875 | ||
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 9c982e47eb99..d0c545b73d78 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -1325,15 +1325,15 @@ SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0), | |||
1325 | }; | 1325 | }; |
1326 | 1326 | ||
1327 | static const struct snd_soc_dapm_widget wm8994_adc_revd_widgets[] = { | 1327 | static const struct snd_soc_dapm_widget wm8994_adc_revd_widgets[] = { |
1328 | SND_SOC_DAPM_MUX_E("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux, | 1328 | SND_SOC_DAPM_VIRT_MUX_E("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux, |
1329 | adc_mux_ev, SND_SOC_DAPM_PRE_PMU), | 1329 | adc_mux_ev, SND_SOC_DAPM_PRE_PMU), |
1330 | SND_SOC_DAPM_MUX_E("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux, | 1330 | SND_SOC_DAPM_VIRT_MUX_E("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux, |
1331 | adc_mux_ev, SND_SOC_DAPM_PRE_PMU), | 1331 | adc_mux_ev, SND_SOC_DAPM_PRE_PMU), |
1332 | }; | 1332 | }; |
1333 | 1333 | ||
1334 | static const struct snd_soc_dapm_widget wm8994_adc_widgets[] = { | 1334 | static const struct snd_soc_dapm_widget wm8994_adc_widgets[] = { |
1335 | SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux), | 1335 | SND_SOC_DAPM_VIRT_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux), |
1336 | SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux), | 1336 | SND_SOC_DAPM_VIRT_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux), |
1337 | }; | 1337 | }; |
1338 | 1338 | ||
1339 | static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { | 1339 | static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { |
@@ -2357,6 +2357,11 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream, | |||
2357 | bclk |= best << WM8994_AIF1_BCLK_DIV_SHIFT; | 2357 | bclk |= best << WM8994_AIF1_BCLK_DIV_SHIFT; |
2358 | 2358 | ||
2359 | lrclk = bclk_rate / params_rate(params); | 2359 | lrclk = bclk_rate / params_rate(params); |
2360 | if (!lrclk) { | ||
2361 | dev_err(dai->dev, "Unable to generate LRCLK from %dHz BCLK\n", | ||
2362 | bclk_rate); | ||
2363 | return -EINVAL; | ||
2364 | } | ||
2360 | dev_dbg(dai->dev, "Using LRCLK rate %d for actual LRCLK %dHz\n", | 2365 | dev_dbg(dai->dev, "Using LRCLK rate %d for actual LRCLK %dHz\n", |
2361 | lrclk, bclk_rate / lrclk); | 2366 | lrclk, bclk_rate / lrclk); |
2362 | 2367 | ||
@@ -3178,6 +3183,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3178 | switch (wm8994->revision) { | 3183 | switch (wm8994->revision) { |
3179 | case 0: | 3184 | case 0: |
3180 | case 1: | 3185 | case 1: |
3186 | case 2: | ||
3187 | case 3: | ||
3181 | wm8994->hubs.dcs_codes_l = -9; | 3188 | wm8994->hubs.dcs_codes_l = -9; |
3182 | wm8994->hubs.dcs_codes_r = -5; | 3189 | wm8994->hubs.dcs_codes_r = -5; |
3183 | break; | 3190 | break; |
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index 31af405bda84..ae49f1c78c6d 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c | |||
@@ -392,7 +392,8 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) | |||
392 | } | 392 | } |
393 | 393 | ||
394 | if (strcasecmp(sprop, "i2s-slave") == 0) { | 394 | if (strcasecmp(sprop, "i2s-slave") == 0) { |
395 | machine_data->dai_format = SND_SOC_DAIFMT_I2S; | 395 | machine_data->dai_format = |
396 | SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM; | ||
396 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; | 397 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; |
397 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; | 398 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; |
398 | 399 | ||
@@ -409,31 +410,38 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) | |||
409 | } | 410 | } |
410 | machine_data->clk_frequency = be32_to_cpup(iprop); | 411 | machine_data->clk_frequency = be32_to_cpup(iprop); |
411 | } else if (strcasecmp(sprop, "i2s-master") == 0) { | 412 | } else if (strcasecmp(sprop, "i2s-master") == 0) { |
412 | machine_data->dai_format = SND_SOC_DAIFMT_I2S; | 413 | machine_data->dai_format = |
414 | SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS; | ||
413 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; | 415 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; |
414 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; | 416 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
415 | } else if (strcasecmp(sprop, "lj-slave") == 0) { | 417 | } else if (strcasecmp(sprop, "lj-slave") == 0) { |
416 | machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J; | 418 | machine_data->dai_format = |
419 | SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM; | ||
417 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; | 420 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; |
418 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; | 421 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; |
419 | } else if (strcasecmp(sprop, "lj-master") == 0) { | 422 | } else if (strcasecmp(sprop, "lj-master") == 0) { |
420 | machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J; | 423 | machine_data->dai_format = |
424 | SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBS_CFS; | ||
421 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; | 425 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; |
422 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; | 426 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
423 | } else if (strcasecmp(sprop, "rj-slave") == 0) { | 427 | } else if (strcasecmp(sprop, "rj-slave") == 0) { |
424 | machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J; | 428 | machine_data->dai_format = |
429 | SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_CBM_CFM; | ||
425 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; | 430 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; |
426 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; | 431 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; |
427 | } else if (strcasecmp(sprop, "rj-master") == 0) { | 432 | } else if (strcasecmp(sprop, "rj-master") == 0) { |
428 | machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J; | 433 | machine_data->dai_format = |
434 | SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_CBS_CFS; | ||
429 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; | 435 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; |
430 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; | 436 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
431 | } else if (strcasecmp(sprop, "ac97-slave") == 0) { | 437 | } else if (strcasecmp(sprop, "ac97-slave") == 0) { |
432 | machine_data->dai_format = SND_SOC_DAIFMT_AC97; | 438 | machine_data->dai_format = |
439 | SND_SOC_DAIFMT_AC97 | SND_SOC_DAIFMT_CBM_CFM; | ||
433 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; | 440 | machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; |
434 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; | 441 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; |
435 | } else if (strcasecmp(sprop, "ac97-master") == 0) { | 442 | } else if (strcasecmp(sprop, "ac97-master") == 0) { |
436 | machine_data->dai_format = SND_SOC_DAIFMT_AC97; | 443 | machine_data->dai_format = |
444 | SND_SOC_DAIFMT_AC97 | SND_SOC_DAIFMT_CBS_CFS; | ||
437 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; | 445 | machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; |
438 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; | 446 | machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
439 | } else { | 447 | } else { |
diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig index b133bfcc5848..738391757f2c 100644 --- a/sound/soc/imx/Kconfig +++ b/sound/soc/imx/Kconfig | |||
@@ -28,7 +28,7 @@ config SND_MXC_SOC_WM1133_EV1 | |||
28 | 28 | ||
29 | config SND_SOC_MX27VIS_AIC32X4 | 29 | config SND_SOC_MX27VIS_AIC32X4 |
30 | tristate "SoC audio support for Visstrim M10 boards" | 30 | tristate "SoC audio support for Visstrim M10 boards" |
31 | depends on MACH_IMX27_VISSTRIM_M10 | 31 | depends on MACH_IMX27_VISSTRIM_M10 && I2C |
32 | select SND_SOC_TLV320AIC32X4 | 32 | select SND_SOC_TLV320AIC32X4 |
33 | select SND_MXC_SOC_MX2 | 33 | select SND_MXC_SOC_MX2 |
34 | help | 34 | help |
diff --git a/sound/soc/kirkwood/Kconfig b/sound/soc/kirkwood/Kconfig index 8f49e165f4d1..c62d715235e2 100644 --- a/sound/soc/kirkwood/Kconfig +++ b/sound/soc/kirkwood/Kconfig | |||
@@ -12,6 +12,7 @@ config SND_KIRKWOOD_SOC_I2S | |||
12 | config SND_KIRKWOOD_SOC_OPENRD | 12 | config SND_KIRKWOOD_SOC_OPENRD |
13 | tristate "SoC Audio support for Kirkwood Openrd Client" | 13 | tristate "SoC Audio support for Kirkwood Openrd Client" |
14 | depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE) | 14 | depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE) |
15 | depends on I2C | ||
15 | select SND_KIRKWOOD_SOC_I2S | 16 | select SND_KIRKWOOD_SOC_I2S |
16 | select SND_SOC_CS42L51 | 17 | select SND_SOC_CS42L51 |
17 | help | 18 | help |
@@ -20,7 +21,7 @@ config SND_KIRKWOOD_SOC_OPENRD | |||
20 | 21 | ||
21 | config SND_KIRKWOOD_SOC_T5325 | 22 | config SND_KIRKWOOD_SOC_T5325 |
22 | tristate "SoC Audio support for HP t5325" | 23 | tristate "SoC Audio support for HP t5325" |
23 | depends on SND_KIRKWOOD_SOC && MACH_T5325 | 24 | depends on SND_KIRKWOOD_SOC && MACH_T5325 && I2C |
24 | select SND_KIRKWOOD_SOC_I2S | 25 | select SND_KIRKWOOD_SOC_I2S |
25 | select SND_SOC_ALC5623 | 26 | select SND_SOC_ALC5623 |
26 | help | 27 | help |
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index ffd2242e305f..a0f7d3cfa470 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig | |||
@@ -151,6 +151,7 @@ config SND_SOC_ZYLONITE | |||
151 | config SND_SOC_RAUMFELD | 151 | config SND_SOC_RAUMFELD |
152 | tristate "SoC Audio support Raumfeld audio adapter" | 152 | tristate "SoC Audio support Raumfeld audio adapter" |
153 | depends on SND_PXA2XX_SOC && (MACH_RAUMFELD_SPEAKER || MACH_RAUMFELD_CONNECTOR) | 153 | depends on SND_PXA2XX_SOC && (MACH_RAUMFELD_SPEAKER || MACH_RAUMFELD_CONNECTOR) |
154 | depends on I2C && SPI_MASTER | ||
154 | select SND_PXA_SOC_SSP | 155 | select SND_PXA_SOC_SSP |
155 | select SND_SOC_CS4270 | 156 | select SND_SOC_CS4270 |
156 | select SND_SOC_AK4104 | 157 | select SND_SOC_AK4104 |
@@ -159,7 +160,7 @@ config SND_SOC_RAUMFELD | |||
159 | 160 | ||
160 | config SND_PXA2XX_SOC_HX4700 | 161 | config SND_PXA2XX_SOC_HX4700 |
161 | tristate "SoC Audio support for HP iPAQ hx4700" | 162 | tristate "SoC Audio support for HP iPAQ hx4700" |
162 | depends on SND_PXA2XX_SOC && MACH_H4700 | 163 | depends on SND_PXA2XX_SOC && MACH_H4700 && I2C |
163 | select SND_PXA2XX_SOC_I2S | 164 | select SND_PXA2XX_SOC_I2S |
164 | select SND_SOC_AK4641 | 165 | select SND_SOC_AK4641 |
165 | help | 166 | help |
diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c index f75e43997d5b..ad9ac42522e2 100644 --- a/sound/soc/samsung/smdk_wm8994.c +++ b/sound/soc/samsung/smdk_wm8994.c | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include "../codecs/wm8994.h" | 10 | #include "../codecs/wm8994.h" |
11 | #include <sound/pcm_params.h> | 11 | #include <sound/pcm_params.h> |
12 | #include <linux/module.h> | ||
12 | 13 | ||
13 | /* | 14 | /* |
14 | * Default CFG switch settings to use this driver: | 15 | * Default CFG switch settings to use this driver: |
diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c index 85bf541a771d..4b8e35410eb1 100644 --- a/sound/soc/samsung/speyside.c +++ b/sound/soc/samsung/speyside.c | |||
@@ -191,7 +191,7 @@ static int speyside_late_probe(struct snd_soc_card *card) | |||
191 | snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic"); | 191 | snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic"); |
192 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main AMIC"); | 192 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main AMIC"); |
193 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main DMIC"); | 193 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main DMIC"); |
194 | snd_soc_dapm_ignore_suspend(&card->dapm, "Speaker"); | 194 | snd_soc_dapm_ignore_suspend(&card->dapm, "Main Speaker"); |
195 | snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Output"); | 195 | snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Output"); |
196 | snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Input"); | 196 | snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Input"); |
197 | 197 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a5d3685a5d38..a25fa63ce9a2 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -709,6 +709,12 @@ int snd_soc_resume(struct device *dev) | |||
709 | struct snd_soc_card *card = dev_get_drvdata(dev); | 709 | struct snd_soc_card *card = dev_get_drvdata(dev); |
710 | int i, ac97_control = 0; | 710 | int i, ac97_control = 0; |
711 | 711 | ||
712 | /* If the initialization of this soc device failed, there is no codec | ||
713 | * associated with it. Just bail out in this case. | ||
714 | */ | ||
715 | if (list_empty(&card->codec_dev_list)) | ||
716 | return 0; | ||
717 | |||
712 | /* AC97 devices might have other drivers hanging off them so | 718 | /* AC97 devices might have other drivers hanging off them so |
713 | * need to resume immediately. Other drivers don't have that | 719 | * need to resume immediately. Other drivers don't have that |
714 | * problem and may take a substantial amount of time to resume | 720 | * problem and may take a substantial amount of time to resume |
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c index 0c12b98484bd..4220bb0f2730 100644 --- a/sound/soc/soc-utils.c +++ b/sound/soc/soc-utils.c | |||
@@ -58,7 +58,36 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *params) | |||
58 | } | 58 | } |
59 | EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk); | 59 | EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk); |
60 | 60 | ||
61 | static struct snd_soc_platform_driver dummy_platform; | 61 | static const struct snd_pcm_hardware dummy_dma_hardware = { |
62 | .formats = 0xffffffff, | ||
63 | .channels_min = 1, | ||
64 | .channels_max = UINT_MAX, | ||
65 | |||
66 | /* Random values to keep userspace happy when checking constraints */ | ||
67 | .info = SNDRV_PCM_INFO_INTERLEAVED | | ||
68 | SNDRV_PCM_INFO_BLOCK_TRANSFER, | ||
69 | .buffer_bytes_max = 128*1024, | ||
70 | .period_bytes_min = PAGE_SIZE, | ||
71 | .period_bytes_max = PAGE_SIZE*2, | ||
72 | .periods_min = 2, | ||
73 | .periods_max = 128, | ||
74 | }; | ||
75 | |||
76 | static int dummy_dma_open(struct snd_pcm_substream *substream) | ||
77 | { | ||
78 | snd_soc_set_runtime_hwparams(substream, &dummy_dma_hardware); | ||
79 | |||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | static struct snd_pcm_ops dummy_dma_ops = { | ||
84 | .open = dummy_dma_open, | ||
85 | .ioctl = snd_pcm_lib_ioctl, | ||
86 | }; | ||
87 | |||
88 | static struct snd_soc_platform_driver dummy_platform = { | ||
89 | .ops = &dummy_dma_ops, | ||
90 | }; | ||
62 | 91 | ||
63 | static __devinit int snd_soc_dummy_probe(struct platform_device *pdev) | 92 | static __devinit int snd_soc_dummy_probe(struct platform_device *pdev) |
64 | { | 93 | { |
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index b61945f3af9e..32d2a21f2e3b 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h | |||
@@ -1633,6 +1633,37 @@ YAMAHA_DEVICE(0x7010, "UB99"), | |||
1633 | } | 1633 | } |
1634 | }, | 1634 | }, |
1635 | { | 1635 | { |
1636 | /* Roland GAIA SH-01 */ | ||
1637 | USB_DEVICE(0x0582, 0x0111), | ||
1638 | .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { | ||
1639 | .vendor_name = "Roland", | ||
1640 | .product_name = "GAIA", | ||
1641 | .ifnum = QUIRK_ANY_INTERFACE, | ||
1642 | .type = QUIRK_COMPOSITE, | ||
1643 | .data = (const struct snd_usb_audio_quirk[]) { | ||
1644 | { | ||
1645 | .ifnum = 0, | ||
1646 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
1647 | }, | ||
1648 | { | ||
1649 | .ifnum = 1, | ||
1650 | .type = QUIRK_AUDIO_STANDARD_INTERFACE | ||
1651 | }, | ||
1652 | { | ||
1653 | .ifnum = 2, | ||
1654 | .type = QUIRK_MIDI_FIXED_ENDPOINT, | ||
1655 | .data = &(const struct snd_usb_midi_endpoint_info) { | ||
1656 | .out_cables = 0x0003, | ||
1657 | .in_cables = 0x0003 | ||
1658 | } | ||
1659 | }, | ||
1660 | { | ||
1661 | .ifnum = -1 | ||
1662 | } | ||
1663 | } | ||
1664 | } | ||
1665 | }, | ||
1666 | { | ||
1636 | USB_DEVICE(0x0582, 0x0113), | 1667 | USB_DEVICE(0x0582, 0x0113), |
1637 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | 1668 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { |
1638 | /* .vendor_name = "BOSS", */ | 1669 | /* .vendor_name = "BOSS", */ |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 7d98676808d8..955930e0a5c3 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -463,7 +463,8 @@ static int run_perf_stat(int argc __used, const char **argv) | |||
463 | 463 | ||
464 | list_for_each_entry(counter, &evsel_list->entries, node) { | 464 | list_for_each_entry(counter, &evsel_list->entries, node) { |
465 | if (create_perf_stat_counter(counter, first) < 0) { | 465 | if (create_perf_stat_counter(counter, first) < 0) { |
466 | if (errno == EINVAL || errno == ENOSYS || errno == ENOENT) { | 466 | if (errno == EINVAL || errno == ENOSYS || |
467 | errno == ENOENT || errno == EOPNOTSUPP) { | ||
467 | if (verbose) | 468 | if (verbose) |
468 | ui__warning("%s event is not supported by the kernel.\n", | 469 | ui__warning("%s event is not supported by the kernel.\n", |
469 | event_name(counter)); | 470 | event_name(counter)); |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index e42626422587..d7915d4e77cb 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -34,6 +34,16 @@ int __perf_evsel__sample_size(u64 sample_type) | |||
34 | return size; | 34 | return size; |
35 | } | 35 | } |
36 | 36 | ||
37 | static void hists__init(struct hists *hists) | ||
38 | { | ||
39 | memset(hists, 0, sizeof(*hists)); | ||
40 | hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; | ||
41 | hists->entries_in = &hists->entries_in_array[0]; | ||
42 | hists->entries_collapsed = RB_ROOT; | ||
43 | hists->entries = RB_ROOT; | ||
44 | pthread_mutex_init(&hists->lock, NULL); | ||
45 | } | ||
46 | |||
37 | void perf_evsel__init(struct perf_evsel *evsel, | 47 | void perf_evsel__init(struct perf_evsel *evsel, |
38 | struct perf_event_attr *attr, int idx) | 48 | struct perf_event_attr *attr, int idx) |
39 | { | 49 | { |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index bcd05d05b4f0..33c17a2b2a81 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -388,7 +388,7 @@ static int write_event_desc(int fd, struct perf_header *h __used, | |||
388 | /* | 388 | /* |
389 | * write event string as passed on cmdline | 389 | * write event string as passed on cmdline |
390 | */ | 390 | */ |
391 | ret = do_write_string(fd, attr->name); | 391 | ret = do_write_string(fd, event_name(attr)); |
392 | if (ret < 0) | 392 | if (ret < 0) |
393 | return ret; | 393 | return ret; |
394 | /* | 394 | /* |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index a36a3fa81ffb..abef2703cd24 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -1211,13 +1211,3 @@ size_t hists__fprintf_nr_events(struct hists *hists, FILE *fp) | |||
1211 | 1211 | ||
1212 | return ret; | 1212 | return ret; |
1213 | } | 1213 | } |
1214 | |||
1215 | void hists__init(struct hists *hists) | ||
1216 | { | ||
1217 | memset(hists, 0, sizeof(*hists)); | ||
1218 | hists->entries_in_array[0] = hists->entries_in_array[1] = RB_ROOT; | ||
1219 | hists->entries_in = &hists->entries_in_array[0]; | ||
1220 | hists->entries_collapsed = RB_ROOT; | ||
1221 | hists->entries = RB_ROOT; | ||
1222 | pthread_mutex_init(&hists->lock, NULL); | ||
1223 | } | ||
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index c86c1d27bd1e..89289c8e935e 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -63,8 +63,6 @@ struct hists { | |||
63 | struct callchain_cursor callchain_cursor; | 63 | struct callchain_cursor callchain_cursor; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | void hists__init(struct hists *hists); | ||
67 | |||
68 | struct hist_entry *__hists__add_entry(struct hists *self, | 66 | struct hist_entry *__hists__add_entry(struct hists *self, |
69 | struct addr_location *al, | 67 | struct addr_location *al, |
70 | struct symbol *parent, u64 period); | 68 | struct symbol *parent, u64 period); |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 85c1e6b76f0a..0f4555ce9063 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -1333,6 +1333,10 @@ int perf_session__cpu_bitmap(struct perf_session *session, | |||
1333 | } | 1333 | } |
1334 | 1334 | ||
1335 | map = cpu_map__new(cpu_list); | 1335 | map = cpu_map__new(cpu_list); |
1336 | if (map == NULL) { | ||
1337 | pr_err("Invalid cpu_list\n"); | ||
1338 | return -1; | ||
1339 | } | ||
1336 | 1340 | ||
1337 | for (i = 0; i < map->nr; i++) { | 1341 | for (i = 0; i < map->nr; i++) { |
1338 | int cpu = map->map[i]; | 1342 | int cpu = map->map[i]; |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 0a7ed5b5e281..6c164dc9ee95 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -1537,6 +1537,8 @@ process_flags(struct event *event, struct print_arg *arg, char **tok) | |||
1537 | field = malloc_or_die(sizeof(*field)); | 1537 | field = malloc_or_die(sizeof(*field)); |
1538 | 1538 | ||
1539 | type = process_arg(event, field, &token); | 1539 | type = process_arg(event, field, &token); |
1540 | while (type == EVENT_OP) | ||
1541 | type = process_op(event, field, &token); | ||
1540 | if (test_type_token(type, token, EVENT_DELIM, ",")) | 1542 | if (test_type_token(type, token, EVENT_DELIM, ",")) |
1541 | goto out_free; | 1543 | goto out_free; |
1542 | 1544 | ||