Conflicts: tools/perf/builtin-record.c tools/perf/builtin-top.c tools/perf/perf.h tools/perf/util/top.h Merge reason: resolve these cherry-picking conflicts.
Unified · Split
| @@ -17,11 +17,11 @@ reports supported by a device are also provided by sysfs in · 16 unmodified lines | ||
| 17 | 17 | class/input/event*/device/capabilities/, and the properties of a device are |
| 18 | 18 | provided in class/input/event*/device/properties. |
| 19 | 19 | |
| 20 | −Types: | |
| 21 | −========== | |
| 22 | −Types are groupings of codes under a logical input construct. Each type has a | |
| 23 | −set of applicable codes to be used in generating events. See the Codes section | |
| 24 | −for details on valid codes for each type. | |
| 20 | +Event types: | |
| 21 | +=========== | |
| 22 | +Event types are groupings of codes under a logical input construct. Each | |
| 23 | +type has a set of applicable codes to be used in generating events. See the | |
| 24 | +Codes section for details on valid codes for each type. | |
| 25 | 25 | |
| 26 | 26 | * EV_SYN: |
| 27 | 27 | - Used as markers to separate events. Events may be separated in time or in |
| @@ -63,9 +63,9 @@ for details on valid codes for each type. · 35 unmodified lines | ||
| 63 | 63 | * EV_FF_STATUS: |
| 64 | 64 | - Used to receive force feedback device status. |
| 65 | 65 | |
| 66 | −Codes: | |
| 67 | −========== | |
| 68 | −Codes define the precise type of event. | |
| 66 | +Event codes: | |
| 67 | +=========== | |
| 68 | +Event codes define the precise type of event. | |
| 69 | 69 | |
| 70 | 70 | EV_SYN: |
| 71 | 71 | ---------- |
| @@ -220,6 +220,56 @@ EV_PWR: · 148 unmodified lines | ||
| 220 | 220 | EV_PWR events are a special type of event used specifically for power |
| 221 | 221 | mangement. Its usage is not well defined. To be addressed later. |
| 222 | 222 | |
| 223 | +Device properties: | |
| 224 | +================= | |
| 225 | +Normally, userspace sets up an input device based on the data it emits, | |
| 226 | +i.e., the event types. In the case of two devices emitting the same event | |
| 227 | +types, additional information can be provided in the form of device | |
| 228 | +properties. | |
| 229 | + | |
| 230 | +INPUT_PROP_DIRECT + INPUT_PROP_POINTER: | |
| 231 | +-------------------------------------- | |
| 232 | +The INPUT_PROP_DIRECT property indicates that device coordinates should be | |
| 233 | +directly mapped to screen coordinates (not taking into account trivial | |
| 234 | +transformations, such as scaling, flipping and rotating). Non-direct input | |
| 235 | +devices require non-trivial transformation, such as absolute to relative | |
| 236 | +transformation for touchpads. Typical direct input devices: touchscreens, | |
| 237 | +drawing tablets; non-direct devices: touchpads, mice. | |
| 238 | + | |
| 239 | +The INPUT_PROP_POINTER property indicates that the device is not transposed | |
| 240 | +on the screen and thus requires use of an on-screen pointer to trace user's | |
| 241 | +movements. Typical pointer devices: touchpads, tablets, mice; non-pointer | |
| 242 | +device: touchscreen. | |
| 243 | + | |
| 244 | +If neither INPUT_PROP_DIRECT or INPUT_PROP_POINTER are set, the property is | |
| 245 | +considered undefined and the device type should be deduced in the | |
| 246 | +traditional way, using emitted event types. | |
| 247 | + | |
| 248 | +INPUT_PROP_BUTTONPAD: | |
| 249 | +-------------------- | |
| 250 | +For touchpads where the button is placed beneath the surface, such that | |
| 251 | +pressing down on the pad causes a button click, this property should be | |
| 252 | +set. Common in clickpad notebooks and macbooks from 2009 and onwards. | |
| 253 | + | |
| 254 | +Originally, the buttonpad property was coded into the bcm5974 driver | |
| 255 | +version field under the name integrated button. For backwards | |
| 256 | +compatibility, both methods need to be checked in userspace. | |
| 257 | + | |
| 258 | +INPUT_PROP_SEMI_MT: | |
| 259 | +------------------ | |
| 260 | +Some touchpads, most common between 2008 and 2011, can detect the presence | |
| 261 | +of multiple contacts without resolving the individual positions; only the | |
| 262 | +number of contacts and a rectangular shape is known. For such | |
| 263 | +touchpads, the semi-mt property should be set. | |
| 264 | + | |
| 265 | +Depending on the device, the rectangle may enclose all touches, like a | |
| 266 | +bounding box, or just some of them, for instance the two most recent | |
| 267 | +touches. The diversity makes the rectangle of limited use, but some | |
| 268 | +gestures can normally be extracted from it. | |
| 269 | + | |
| 270 | +If INPUT_PROP_SEMI_MT is not set, the device is assumed to be a true MT | |
| 271 | +device. | |
| 272 | + | |
| 223 | 273 | Guidelines: |
| 224 | 274 | ========== |
| 225 | 275 | The guidelines below ensure proper single-touch and multi-finger functionality. |
| @@ -240,6 +290,8 @@ used to report when a touch is active on the screen. · 14 unmodified lines | ||
| 240 | 290 | BTN_{MOUSE,LEFT,MIDDLE,RIGHT} must not be reported as the result of touch |
| 241 | 291 | contact. BTN_TOOL_<name> events should be reported where possible. |
| 242 | 292 | |
| 293 | +For new hardware, INPUT_PROP_DIRECT should be set. | |
| 294 | + | |
| 243 | 295 | Trackpads: |
| 244 | 296 | ---------- |
| 245 | 297 | Legacy trackpads that only provide relative position information must report |
| @@ -250,6 +302,8 @@ location of the touch. BTN_TOUCH should be used to report when a touch is active · 4 unmodified lines | ||
| 250 | 302 | on the trackpad. Where multi-finger support is available, BTN_TOOL_<name> should |
| 251 | 303 | be used to report the number of touches active on the trackpad. |
| 252 | 304 | |
| 305 | +For new hardware, INPUT_PROP_POINTER should be set. | |
| 306 | + | |
| 253 | 307 | Tablets: |
| 254 | 308 | ---------- |
| 255 | 309 | BTN_TOOL_<name> events must be reported when a stylus or other tool is active on |
| @@ -260,3 +314,5 @@ button may be used for buttons on the tablet except BTN_{MOUSE,LEFT}. · 4 unmodified lines | ||
| 260 | 314 | BTN_{0,1,2,etc} are good generic codes for unlabeled buttons. Do not use |
| 261 | 315 | meaningful buttons, like BTN_FORWARD, unless the button is labeled for that |
| 262 | 316 | purpose on the device. |
| 317 | + | |
| 318 | +For new hardware, both INPUT_PROP_DIRECT and INPUT_PROP_POINTER should be set. | |
| @@ -601,6 +601,8 @@ can be ORed together: · 600 unmodified lines | ||
| 601 | 601 | instead of using the one provided by the hardware. |
| 602 | 602 | 512 - A kernel warning has occurred. |
| 603 | 603 | 1024 - A module from drivers/staging was loaded. |
| 604 | +2048 - The system is working around a severe firmware bug. | |
| 605 | +4096 - An out-of-tree module has been loaded. | |
| 604 | 606 | |
| 605 | 607 | ============================================================== |
| 606 | 608 | |
| @@ -269,7 +269,6 @@ S: Orphan · 268 unmodified lines | ||
| 269 | 269 | F: drivers/platform/x86/wmi.c |
| 270 | 270 | |
| 271 | 271 | AD1889 ALSA SOUND DRIVER |
| 272 | −M: Kyle McMartin <kyle@mcmartin.ca> | |
| 273 | 272 | M: Thibaut Varene <T-Bone@parisc-linux.org> |
| 274 | 273 | W: http://wiki.parisc-linux.org/AD1889 |
| 275 | 274 | L: linux-parisc@vger.kernel.org |
| @@ -789,12 +788,6 @@ F: arch/arm/mach-mx*/ · 513 unmodified lines | ||
| 789 | 788 | F: arch/arm/mach-imx/ |
| 790 | 789 | F: arch/arm/plat-mxc/ |
| 791 | 790 | |
| 792 | −ARM/FREESCALE IMX51 | |
| 793 | −M: Amit Kucheria <amit.kucheria@canonical.com> | |
| 794 | −L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | |
| 795 | −S: Maintained | |
| 796 | −F: arch/arm/mach-mx5/ | |
| 797 | − | |
| 798 | 791 | ARM/FREESCALE IMX6 |
| 799 | 792 | M: Shawn Guo <shawn.guo@linaro.org> |
| 800 | 793 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| @@ -2287,7 +2280,7 @@ F: drivers/acpi/dock.c · 1486 unmodified lines | ||
| 2287 | 2280 | DOCUMENTATION |
| 2288 | 2281 | M: Randy Dunlap <rdunlap@xenotime.net> |
| 2289 | 2282 | L: linux-doc@vger.kernel.org |
| 2290 | −T: quilt http://userweb.kernel.org/~rdunlap/kernel-doc-patches/current/ | |
| 2283 | +T: quilt http://xenotime.net/kernel-doc-patches/current/ | |
| 2291 | 2284 | S: Maintained |
| 2292 | 2285 | F: Documentation/ |
| 2293 | 2286 | |
| @@ -3053,7 +3046,6 @@ F: drivers/hwspinlock/hwspinlock_* · 759 unmodified lines | ||
| 3053 | 3046 | F: include/linux/hwspinlock.h |
| 3054 | 3047 | |
| 3055 | 3048 | HARMONY SOUND DRIVER |
| 3056 | −M: Kyle McMartin <kyle@mcmartin.ca> | |
| 3057 | 3049 | L: linux-parisc@vger.kernel.org |
| 3058 | 3050 | S: Maintained |
| 3059 | 3051 | F: sound/parisc/harmony.* |
| @@ -3324,6 +3316,12 @@ S: Maintained · 264 unmodified lines | ||
| 3324 | 3316 | F: net/ieee802154/ |
| 3325 | 3317 | F: drivers/ieee802154/ |
| 3326 | 3318 | |
| 3319 | +IIO SUBSYSTEM AND DRIVERS | |
| 3320 | +M: Jonathan Cameron <jic23@cam.ac.uk> | |
| 3321 | +L: linux-iio@vger.kernel.org | |
| 3322 | +S: Maintained | |
| 3323 | +F: drivers/staging/iio/ | |
| 3324 | + | |
| 3327 | 3325 | IKANOS/ADI EAGLE ADSL USB DRIVER |
| 3328 | 3326 | M: Matthieu Castet <castet.matthieu@free.fr> |
| 3329 | 3327 | M: Stanislaw Gruszka <stf_xl@wp.pl> |
| @@ -3782,7 +3780,7 @@ F: Documentation/kdump/ · 452 unmodified lines | ||
| 3782 | 3780 | |
| 3783 | 3781 | KERNEL AUTOMOUNTER v4 (AUTOFS4) |
| 3784 | 3782 | M: Ian Kent <raven@themaw.net> |
| 3785 | −L: autofs@linux.kernel.org | |
| 3783 | +L: autofs@vger.kernel.org | |
| 3786 | 3784 | S: Maintained |
| 3787 | 3785 | F: fs/autofs4/ |
| 3788 | 3786 | |
| @@ -3992,11 +3990,11 @@ M: Rusty Russell <rusty@rustcorp.com.au> · 203 unmodified lines | ||
| 3992 | 3990 | L: lguest@lists.ozlabs.org |
| 3993 | 3991 | W: http://lguest.ozlabs.org/ |
| 3994 | 3992 | S: Odd Fixes |
| 3995 | −F: Documentation/virtual/lguest/ | |
| 3993 | +F: arch/x86/include/asm/lguest*.h | |
| 3996 | 3994 | F: arch/x86/lguest/ |
| 3997 | 3995 | F: drivers/lguest/ |
| 3998 | 3996 | F: include/linux/lguest*.h |
| 3999 | −F: arch/x86/include/asm/lguest*.h | |
| 3997 | +F: tools/lguest/ | |
| 4000 | 3998 | |
| 4001 | 3999 | LINUX FOR IBM pSERIES (RS/6000) |
| 4002 | 4000 | M: Paul Mackerras <paulus@au.ibm.com> |
| @@ -4136,7 +4134,7 @@ L: linux-ntfs-dev@lists.sourceforge.net · 133 unmodified lines | ||
| 4136 | 4134 | W: http://www.linux-ntfs.org/content/view/19/37/ |
| 4137 | 4135 | S: Maintained |
| 4138 | 4136 | F: Documentation/ldm.txt |
| 4139 | −F: fs/partitions/ldm.* | |
| 4137 | +F: block/partitions/ldm.* | |
| 4140 | 4138 | |
| 4141 | 4139 | LogFS |
| 4142 | 4140 | M: Joern Engel <joern@logfs.org> |
| @@ -4687,7 +4685,7 @@ NTFS FILESYSTEM · 544 unmodified lines | ||
| 4687 | 4685 | M: Anton Altaparmakov <anton@tuxera.com> |
| 4688 | 4686 | L: linux-ntfs-dev@lists.sourceforge.net |
| 4689 | 4687 | W: http://www.tuxera.com/ |
| 4690 | −T: git git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs-2.6.git | |
| 4688 | +T: git git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs.git | |
| 4691 | 4689 | S: Supported |
| 4692 | 4690 | F: Documentation/filesystems/ntfs.txt |
| 4693 | 4691 | F: fs/ntfs/ |
| @@ -5000,9 +4998,8 @@ F: Documentation/blockdev/paride.txt · 306 unmodified lines | ||
| 5000 | 4998 | F: drivers/block/paride/ |
| 5001 | 4999 | |
| 5002 | 5000 | PARISC ARCHITECTURE |
| 5003 | −M: Kyle McMartin <kyle@mcmartin.ca> | |
| 5004 | −M: Helge Deller <deller@gmx.de> | |
| 5005 | 5001 | M: "James E.J. Bottomley" <jejb@parisc-linux.org> |
| 5002 | +M: Helge Deller <deller@gmx.de> | |
| 5006 | 5003 | L: linux-parisc@vger.kernel.org |
| 5007 | 5004 | W: http://www.parisc-linux.org/ |
| 5008 | 5005 | Q: http://patchwork.kernel.org/project/linux-parisc/list/ |
| @@ -5633,7 +5630,7 @@ W: http://www.ibm.com/developerworks/linux/linux390/ · 624 unmodified lines | ||
| 5633 | 5630 | S: Supported |
| 5634 | 5631 | F: arch/s390/ |
| 5635 | 5632 | F: drivers/s390/ |
| 5636 | −F: fs/partitions/ibm.c | |
| 5633 | +F: block/partitions/ibm.c | |
| 5637 | 5634 | F: Documentation/s390/ |
| 5638 | 5635 | F: Documentation/DocBook/s390* |
| 5639 | 5636 | |
| @@ -5861,7 +5858,7 @@ S: Maintained · 221 unmodified lines | ||
| 5861 | 5858 | F: drivers/mmc/host/sdhci-spear.c |
| 5862 | 5859 | |
| 5863 | 5860 | SECURITY SUBSYSTEM |
| 5864 | −M: James Morris <jmorris@namei.org> | |
| 5861 | +M: James Morris <james.l.morris@oracle.com> | |
| 5865 | 5862 | L: linux-security-module@vger.kernel.org (suggested Cc:) |
| 5866 | 5863 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git |
| 5867 | 5864 | W: http://security.wiki.kernel.org/ |
| @@ -5874,7 +5871,7 @@ S: Supported · 6 unmodified lines | ||
| 5874 | 5871 | |
| 5875 | 5872 | SELINUX SECURITY MODULE |
| 5876 | 5873 | M: Stephen Smalley <sds@tycho.nsa.gov> |
| 5877 | −M: James Morris <jmorris@namei.org> | |
| 5874 | +M: James Morris <james.l.morris@oracle.com> | |
| 5878 | 5875 | M: Eric Paris <eparis@parisplace.org> |
| 5879 | 5876 | L: selinux@tycho.nsa.gov (subscribers-only, general discussion) |
| 5880 | 5877 | W: http://selinuxproject.org |
| @@ -6396,11 +6393,6 @@ M: Omar Ramirez Luna <omar.ramirez@ti.com> · 515 unmodified lines | ||
| 6396 | 6393 | S: Odd Fixes |
| 6397 | 6394 | F: drivers/staging/tidspbridge/ |
| 6398 | 6395 | |
| 6399 | −STAGING - TRIDENT TVMASTER TMxxxx USB VIDEO CAPTURE DRIVERS | |
| 6400 | −L: linux-media@vger.kernel.org | |
| 6401 | −S: Odd Fixes | |
| 6402 | −F: drivers/staging/tm6000/ | |
| 6403 | − | |
| 6404 | 6396 | STAGING - USB ENE SM/MS CARD READER DRIVER |
| 6405 | 6397 | M: Al Cho <acho@novell.com> |
| 6406 | 6398 | S: Odd Fixes |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | VERSION = 3 |
| 2 | 2 | PATCHLEVEL = 3 |
| 3 | 3 | SUBLEVEL = 0 |
| 4 | −EXTRAVERSION = -rc2 | |
| 4 | +EXTRAVERSION = -rc5 | |
| 5 | 5 | NAME = Saber-toothed Squirrel |
| 6 | 6 | |
| 7 | 7 | # *DOCUMENTATION* |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | compatible = "arm,cortex-a9-gic"; |
| 30 | 30 | #interrupt-cells = <3>; |
| 31 | 31 | interrupt-controller; |
| 32 | + cpu-offset = <0x8000>; | |
| 32 | 33 | reg = <0x10490000 0x1000>, <0x10480000 0x100>; |
| 33 | 34 | }; |
| 34 | 35 | |
| @@ -46,11 +46,11 @@ · 45 unmodified lines | ||
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | 48 | serial@70006200 { |
| 49 | − status = "disable"; | |
| 49 | + clock-frequency = <216000000>; | |
| 50 | 50 | }; |
| 51 | 51 | |
| 52 | 52 | serial@70006300 { |
| 53 | − clock-frequency = <216000000>; | |
| 53 | + status = "disable"; | |
| 54 | 54 | }; |
| 55 | 55 | |
| 56 | 56 | serial@70006400 { |
| @@ -60,7 +60,7 @@ · 3 unmodified lines | ||
| 60 | 60 | sdhci@c8000000 { |
| 61 | 61 | cd-gpios = <&gpio 173 0>; /* gpio PV5 */ |
| 62 | 62 | wp-gpios = <&gpio 57 0>; /* gpio PH1 */ |
| 63 | − power-gpios = <&gpio 155 0>; /* gpio PT3 */ | |
| 63 | + power-gpios = <&gpio 169 0>; /* gpio PV1 */ | |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | 66 | sdhci@c8000200 { |
| @@ -320,13 +320,6 @@ err0: · 319 unmodified lines | ||
| 320 | 320 | return -EBUSY; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | −/* | |
| 324 | − * If we set up a device for bus mastering, we need to check the latency | |
| 325 | − * timer as we don't have even crappy BIOSes to set it properly. | |
| 326 | − * The implementation is from arch/i386/pci/i386.c | |
| 327 | − */ | |
| 328 | −unsigned int pcibios_max_latency = 255; | |
| 329 | − | |
| 330 | 323 | /* ITE bridge requires setting latency timer to avoid early bus access |
| 331 | 324 | termination by PCI bus master devices |
| 332 | 325 | */ |
| @@ -1502,12 +1502,13 @@ int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op) · 1501 unmodified lines | ||
| 1502 | 1502 | struct pl330_thread *thrd = ch_id; |
| 1503 | 1503 | struct pl330_dmac *pl330; |
| 1504 | 1504 | unsigned long flags; |
| 1505 | − int ret = 0, active = thrd->req_running; | |
| 1505 | + int ret = 0, active; | |
| 1506 | 1506 | |
| 1507 | 1507 | if (!thrd || thrd->free || thrd->dmac->state == DYING) |
| 1508 | 1508 | return -EINVAL; |
| 1509 | 1509 | |
| 1510 | 1510 | pl330 = thrd->dmac; |
| 1511 | + active = thrd->req_running; | |
| 1511 | 1512 | |
| 1512 | 1513 | spin_lock_irqsave(&pl330->lock, flags); |
| 1513 | 1514 | |
| @@ -137,6 +137,11 @@ · 136 unmodified lines | ||
| 137 | 137 | disable_irq |
| 138 | 138 | .endm |
| 139 | 139 | |
| 140 | + .macro save_and_disable_irqs_notrace, oldcpsr | |
| 141 | + mrs \oldcpsr, cpsr | |
| 142 | + disable_irq_notrace | |
| 143 | + .endm | |
| 144 | + | |
| 140 | 145 | /* |
| 141 | 146 | * Restore interrupt state previously stored in a register. We don't |
| 142 | 147 | * guarantee that this will preserve the flags. |
| @@ -41,7 +41,7 @@ enum pl330_dstcachectrl { · 40 unmodified lines | ||
| 41 | 41 | DCCTRL1, /* Bufferable only */ |
| 42 | 42 | DCCTRL2, /* Cacheable, but do not allocate */ |
| 43 | 43 | DCCTRL3, /* Cacheable and bufferable, but do not allocate */ |
| 44 | − DINVALID1 = 8, | |
| 44 | + DINVALID1, /* AWCACHE = 0x1000 */ | |
| 45 | 45 | DINVALID2, |
| 46 | 46 | DCCTRL6, /* Cacheable write-through, allocate on writes only */ |
| 47 | 47 | DCCTRL7, /* Cacheable write-back, allocate on writes only */ |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <asm/hw_breakpoint.h> |
| 23 | 23 | #include <asm/ptrace.h> |
| 24 | 24 | #include <asm/types.h> |
| 25 | +#include <asm/system.h> | |
| 25 | 26 | |
| 26 | 27 | #ifdef __KERNEL__ |
| 27 | 28 | #define STACK_TOP ((current->personality & ADDR_LIMIT_32BIT) ? \ |
| @@ -198,7 +198,15 @@ static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, · 197 unmodified lines | ||
| 198 | 198 | unsigned long addr) |
| 199 | 199 | { |
| 200 | 200 | pgtable_page_dtor(pte); |
| 201 | − tlb_add_flush(tlb, addr); | |
| 201 | + | |
| 202 | + /* | |
| 203 | + * With the classic ARM MMU, a pte page has two corresponding pmd | |
| 204 | + * entries, each covering 1MB. | |
| 205 | + */ | |
| 206 | + addr &= PMD_MASK; | |
| 207 | + tlb_add_flush(tlb, addr + SZ_1M - PAGE_SIZE); | |
| 208 | + tlb_add_flush(tlb, addr + SZ_1M); | |
| 209 | + | |
| 202 | 210 | tlb_remove_page(tlb, pte); |
| 203 | 211 | } |
| 204 | 212 | |
| @@ -790,7 +790,7 @@ __kuser_cmpxchg64: @ 0xffff0f60 · 789 unmodified lines | ||
| 790 | 790 | smp_dmb arm |
| 791 | 791 | rsbs r0, r3, #0 @ set returned val and C flag |
| 792 | 792 | ldmfd sp!, {r4, r5, r6, r7} |
| 793 | − bx lr | |
| 793 | + usr_ret lr | |
| 794 | 794 | |
| 795 | 795 | #elif !defined(CONFIG_SMP) |
| 796 | 796 | |
| @@ -469,6 +469,20 @@ static const unsigned armv7_a5_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] · 468 unmodified lines | ||
| 469 | 469 | [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, |
| 470 | 470 | }, |
| 471 | 471 | }, |
| 472 | + [C(NODE)] = { | |
| 473 | + [C(OP_READ)] = { | |
| 474 | + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | |
| 475 | + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | |
| 476 | + }, | |
| 477 | + [C(OP_WRITE)] = { | |
| 478 | + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | |
| 479 | + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | |
| 480 | + }, | |
| 481 | + [C(OP_PREFETCH)] = { | |
| 482 | + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | |
| 483 | + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | |
| 484 | + }, | |
| 485 | + }, | |
| 472 | 486 | }; |
| 473 | 487 | |
| 474 | 488 | /* |
| @@ -579,6 +593,20 @@ static const unsigned armv7_a15_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] · 104 unmodified lines | ||
| 579 | 593 | [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, |
| 580 | 594 | }, |
| 581 | 595 | }, |
| 596 | + [C(NODE)] = { | |
| 597 | + [C(OP_READ)] = { | |
| 598 | + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | |
| 599 | + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | |
| 600 | + }, | |
| 601 | + [C(OP_WRITE)] = { | |
| 602 | + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | |
| 603 | + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | |
| 604 | + }, | |
| 605 | + [C(OP_PREFETCH)] = { | |
| 606 | + [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, | |
| 607 | + [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, | |
| 608 | + }, | |
| 609 | + }, | |
| 582 | 610 | }; |
| 583 | 611 | |
| 584 | 612 | /* |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <linux/perf_event.h> |
| 24 | 24 | #include <linux/hw_breakpoint.h> |
| 25 | 25 | #include <linux/regset.h> |
| 26 | +#include <linux/audit.h> | |
| 26 | 27 | |
| 27 | 28 | #include <asm/pgtable.h> |
| 28 | 29 | #include <asm/system.h> |
| @@ -699,10 +700,13 @@ static int vfp_set(struct task_struct *target, · 670 unmodified lines | ||
| 699 | 700 | { |
| 700 | 701 | int ret; |
| 701 | 702 | struct thread_info *thread = task_thread_info(target); |
| 702 | − struct vfp_hard_struct new_vfp = thread->vfpstate.hard; | |
| 703 | + struct vfp_hard_struct new_vfp; | |
| 703 | 704 | const size_t user_fpregs_offset = offsetof(struct user_vfp, fpregs); |
| 704 | 705 | const size_t user_fpscr_offset = offsetof(struct user_vfp, fpscr); |
| 705 | 706 | |
| 707 | + vfp_sync_hwstate(thread); | |
| 708 | + new_vfp = thread->vfpstate.hard; | |
| 709 | + | |
| 706 | 710 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
| 707 | 711 | &new_vfp.fpregs, |
| 708 | 712 | user_fpregs_offset, |
| @@ -723,9 +727,8 @@ static int vfp_set(struct task_struct *target, · 14 unmodified lines | ||
| 723 | 727 | if (ret) |
| 724 | 728 | return ret; |
| 725 | 729 | |
| 726 | − vfp_sync_hwstate(thread); | |
| 727 | − thread->vfpstate.hard = new_vfp; | |
| 728 | 730 | vfp_flush_hwstate(thread); |
| 731 | + thread->vfpstate.hard = new_vfp; | |
| 729 | 732 | |
| 730 | 733 | return 0; |
| 731 | 734 | } |
| @@ -902,6 +905,12 @@ long arch_ptrace(struct task_struct *child, long request, · 170 unmodified lines | ||
| 902 | 905 | return ret; |
| 903 | 906 | } |
| 904 | 907 | |
| 908 | +#ifdef __ARMEB__ | |
| 909 | +#define AUDIT_ARCH_NR AUDIT_ARCH_ARMEB | |
| 910 | +#else | |
| 911 | +#define AUDIT_ARCH_NR AUDIT_ARCH_ARM | |
| 912 | +#endif | |
| 913 | + | |
| 905 | 914 | asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) |
| 906 | 915 | { |
| 907 | 916 | unsigned long ip; |
| @@ -916,7 +925,7 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) · 8 unmodified lines | ||
| 916 | 925 | if (!ip) |
| 917 | 926 | audit_syscall_exit(regs); |
| 918 | 927 | else |
| 919 | − audit_syscall_entry(AUDIT_ARCH_ARMEB, scno, regs->ARM_r0, | |
| 928 | + audit_syscall_entry(AUDIT_ARCH_NR, scno, regs->ARM_r0, | |
| 920 | 929 | regs->ARM_r1, regs->ARM_r2, regs->ARM_r3); |
| 921 | 930 | |
| 922 | 931 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) |
| @@ -227,6 +227,8 @@ static int restore_vfp_context(struct vfp_sigframe __user *frame) · 226 unmodified lines | ||
| 227 | 227 | if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE) |
| 228 | 228 | return -EINVAL; |
| 229 | 229 | |
| 230 | + vfp_flush_hwstate(thread); | |
| 231 | + | |
| 230 | 232 | /* |
| 231 | 233 | * Copy the floating point registers. There can be unused |
| 232 | 234 | * registers see asm/hwcap.h for details. |
| @@ -251,9 +253,6 @@ static int restore_vfp_context(struct vfp_sigframe __user *frame) · 18 unmodified lines | ||
| 251 | 253 | __get_user_error(h->fpinst, &frame->ufp_exc.fpinst, err); |
| 252 | 254 | __get_user_error(h->fpinst2, &frame->ufp_exc.fpinst2, err); |
| 253 | 255 | |
| 254 | − if (!err) | |
| 255 | − vfp_flush_hwstate(thread); | |
| 256 | − | |
| 257 | 256 | return err ? -EFAULT : 0; |
| 258 | 257 | } |
| 259 | 258 | |
| @@ -129,7 +129,7 @@ static struct notifier_block twd_cpufreq_nb = { · 128 unmodified lines | ||
| 129 | 129 | |
| 130 | 130 | static int twd_cpufreq_init(void) |
| 131 | 131 | { |
| 132 | − if (!IS_ERR(twd_clk)) | |
| 132 | + if (twd_evt && *__this_cpu_ptr(twd_evt) && !IS_ERR(twd_clk)) | |
| 133 | 133 | return cpufreq_register_notifier(&twd_cpufreq_nb, |
| 134 | 134 | CPUFREQ_TRANSITION_NOTIFIER); |
| 135 | 135 | |
| @@ -266,6 +266,7 @@ void die(const char *str, struct pt_regs *regs, int err) · 265 unmodified lines | ||
| 266 | 266 | { |
| 267 | 267 | struct thread_info *thread = current_thread_info(); |
| 268 | 268 | int ret; |
| 269 | + enum bug_trap_type bug_type = BUG_TRAP_TYPE_NONE; | |
| 269 | 270 | |
| 270 | 271 | oops_enter(); |
| 271 | 272 | |
| @@ -273,7 +274,9 @@ void die(const char *str, struct pt_regs *regs, int err) · 1 unmodified line | ||
| 273 | 274 | console_verbose(); |
| 274 | 275 | bust_spinlocks(1); |
| 275 | 276 | if (!user_mode(regs)) |
| 276 | − report_bug(regs->ARM_pc, regs); | |
| 277 | + bug_type = report_bug(regs->ARM_pc, regs); | |
| 278 | + if (bug_type != BUG_TRAP_TYPE_NONE) | |
| 279 | + str = "Oops - BUG"; | |
| 277 | 280 | ret = __die(str, err, thread, regs); |
| 278 | 281 | |
| 279 | 282 | if (regs && kexec_should_crash(thread->task)) |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | ||
| 10 | 10 | #include <asm/page.h> |
| 11 | 11 | |
| 12 | 12 | #define PROC_INFO \ |
| 13 | + . = ALIGN(4); \ | |
| 13 | 14 | VMLINUX_SYMBOL(__proc_info_begin) = .; \ |
| 14 | 15 | *(.proc.info.init) \ |
| 15 | 16 | VMLINUX_SYMBOL(__proc_info_end) = .; |
| @@ -83,7 +83,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} · 82 unmodified lines | ||
| 83 | 83 | * USB Device (Gadget) |
| 84 | 84 | * -------------------------------------------------------------------- */ |
| 85 | 85 | |
| 86 | −#ifdef CONFIG_USB_AT91 | |
| 86 | +#if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE) | |
| 87 | 87 | static struct at91_udc_data udc_data; |
| 88 | 88 | |
| 89 | 89 | static struct resource udc_resources[] = { |
| @@ -84,7 +84,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} · 83 unmodified lines | ||
| 84 | 84 | * USB Device (Gadget) |
| 85 | 85 | * -------------------------------------------------------------------- */ |
| 86 | 86 | |
| 87 | −#ifdef CONFIG_USB_AT91 | |
| 87 | +#if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE) | |
| 88 | 88 | static struct at91_udc_data udc_data; |
| 89 | 89 | |
| 90 | 90 | static struct resource udc_resources[] = { |
| @@ -1215,8 +1215,7 @@ void __init at91_add_device_serial(void) {} · 1124 unmodified lines | ||
| 1215 | 1215 | * CF/IDE |
| 1216 | 1216 | * -------------------------------------------------------------------- */ |
| 1217 | 1217 | |
| 1218 | −#if defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) || \ | |
| 1219 | − defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \ | |
| 1218 | +#if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \ | |
| 1220 | 1219 | defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) |
| 1221 | 1220 | |
| 1222 | 1221 | static struct at91_cf_data cf0_data; |
| @@ -1313,10 +1312,8 @@ void __init at91_add_device_cf(struct at91_cf_data *data) · 90 unmodified lines | ||
| 1313 | 1312 | if (data->flags & AT91_CF_TRUE_IDE) |
| 1314 | 1313 | #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) |
| 1315 | 1314 | pdev->name = "pata_at91"; |
| 1316 | −#elif defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) | |
| 1317 | − pdev->name = "at91_ide"; | |
| 1318 | 1315 | #else |
| 1319 | −#warning "board requires AT91_CF_TRUE_IDE: enable either at91_ide or pata_at91" | |
| 1316 | +#warning "board requires AT91_CF_TRUE_IDE: enable pata_at91" | |
| 1320 | 1317 | #endif |
| 1321 | 1318 | else |
| 1322 | 1319 | pdev->name = "at91_cf"; |
| @@ -87,7 +87,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} · 86 unmodified lines | ||
| 87 | 87 | * USB Device (Gadget) |
| 88 | 88 | * -------------------------------------------------------------------- */ |
| 89 | 89 | |
| 90 | −#ifdef CONFIG_USB_AT91 | |
| 90 | +#if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE) | |
| 91 | 91 | static struct at91_udc_data udc_data; |
| 92 | 92 | |
| 93 | 93 | static struct resource udc_resources[] = { |
| @@ -92,7 +92,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} · 91 unmodified lines | ||
| 92 | 92 | * USB Device (Gadget) |
| 93 | 93 | * -------------------------------------------------------------------- */ |
| 94 | 94 | |
| 95 | −#ifdef CONFIG_USB_AT91 | |
| 95 | +#if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE) | |
| 96 | 96 | static struct at91_udc_data udc_data; |
| 97 | 97 | |
| 98 | 98 | static struct resource udc_resources[] = { |
| @@ -355,8 +355,8 @@ void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} · 256 unmodified lines | ||
| 355 | 355 | * Compact Flash (PCMCIA or IDE) |
| 356 | 356 | * -------------------------------------------------------------------- */ |
| 357 | 357 | |
| 358 | −#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) || \ | |
| 359 | − defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) | |
| 358 | +#if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \ | |
| 359 | + defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) | |
| 360 | 360 | |
| 361 | 361 | static struct at91_cf_data cf0_data; |
| 362 | 362 | |
| @@ -450,7 +450,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) · 87 unmodified lines | ||
| 450 | 450 | at91_set_A_periph(AT91_PIN_PD9, 0); /* CFCE2 */ |
| 451 | 451 | at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */ |
| 452 | 452 | |
| 453 | − pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "at91_ide" : "at91_cf"; | |
| 453 | + pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "pata_at91" : "at91_cf"; | |
| 454 | 454 | platform_device_register(pdev); |
| 455 | 455 | } |
| 456 | 456 | #else |
| @@ -18,6 +18,35 @@ · 17 unmodified lines | ||
| 18 | 18 | |
| 19 | 19 | #include <mach/cpu.h> |
| 20 | 20 | |
| 21 | +#ifndef __ASSEMBLY__ | |
| 22 | +struct sam9_smc_config { | |
| 23 | + /* Setup register */ | |
| 24 | + u8 ncs_read_setup; | |
| 25 | + u8 nrd_setup; | |
| 26 | + u8 ncs_write_setup; | |
| 27 | + u8 nwe_setup; | |
| 28 | + | |
| 29 | + /* Pulse register */ | |
| 30 | + u8 ncs_read_pulse; | |
| 31 | + u8 nrd_pulse; | |
| 32 | + u8 ncs_write_pulse; | |
| 33 | + u8 nwe_pulse; | |
| 34 | + | |
| 35 | + /* Cycle register */ | |
| 36 | + u16 read_cycle; | |
| 37 | + u16 write_cycle; | |
| 38 | + | |
| 39 | + /* Mode register */ | |
| 40 | + u32 mode; | |
| 41 | + u8 tdf_cycles:4; | |
| 42 | +}; | |
| 43 | + | |
| 44 | +extern void sam9_smc_configure(int id, int cs, struct sam9_smc_config *config); | |
| 45 | +extern void sam9_smc_read(int id, int cs, struct sam9_smc_config *config); | |
| 46 | +extern void sam9_smc_read_mode(int id, int cs, struct sam9_smc_config *config); | |
| 47 | +extern void sam9_smc_write_mode(int id, int cs, struct sam9_smc_config *config); | |
| 48 | +#endif | |
| 49 | + | |
| 21 | 50 | #define AT91_SMC_SETUP 0x00 /* Setup Register for CS n */ |
| 22 | 51 | #define AT91_SMC_NWESETUP (0x3f << 0) /* NWE Setup Length */ |
| 23 | 52 | #define AT91_SMC_NWESETUP_(x) ((x) << 0) |
| @@ -2,6 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | * linux/arch/arm/mach-at91/sam9_smc.c |
| 3 | 3 | * |
| 4 | 4 | * Copyright (C) 2008 Andrew Victor |
| 5 | + * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | |
| 5 | 6 | * |
| 6 | 7 | * This program is free software; you can redistribute it and/or modify |
| 7 | 8 | * it under the terms of the GNU General Public License version 2 as |
| @@ -22,7 +23,22 @@ · 14 unmodified lines | ||
| 22 | 23 | |
| 23 | 24 | static void __iomem *smc_base_addr[2]; |
| 24 | 25 | |
| 25 | −static void __init sam9_smc_cs_configure(void __iomem *base, struct sam9_smc_config* config) | |
| 26 | +static void sam9_smc_cs_write_mode(void __iomem *base, | |
| 27 | + struct sam9_smc_config *config) | |
| 28 | +{ | |
| 29 | + __raw_writel(config->mode | |
| 30 | + | AT91_SMC_TDF_(config->tdf_cycles), | |
| 31 | + base + AT91_SMC_MODE); | |
| 32 | +} | |
| 33 | + | |
| 34 | +void sam9_smc_write_mode(int id, int cs, | |
| 35 | + struct sam9_smc_config *config) | |
| 36 | +{ | |
| 37 | + sam9_smc_cs_write_mode(AT91_SMC_CS(id, cs), config); | |
| 38 | +} | |
| 39 | + | |
| 40 | +static void sam9_smc_cs_configure(void __iomem *base, | |
| 41 | + struct sam9_smc_config *config) | |
| 26 | 42 | { |
| 27 | 43 | |
| 28 | 44 | /* Setup register */ |
| @@ -45,16 +61,66 @@ static void __init sam9_smc_cs_configure(void __iomem *base, struct sam9_smc_con · 16 unmodified lines | ||
| 45 | 61 | base + AT91_SMC_CYCLE); |
| 46 | 62 | |
| 47 | 63 | /* Mode register */ |
| 48 | − __raw_writel(config->mode | |
| 49 | − | AT91_SMC_TDF_(config->tdf_cycles), | |
| 50 | − base + AT91_SMC_MODE); | |
| 64 | + sam9_smc_cs_write_mode(base, config); | |
| 51 | 65 | } |
| 52 | 66 | |
| 53 | −void __init sam9_smc_configure(int id, int cs, struct sam9_smc_config* config) | |
| 67 | +void sam9_smc_configure(int id, int cs, | |
| 68 | + struct sam9_smc_config *config) | |
| 54 | 69 | { |
| 55 | 70 | sam9_smc_cs_configure(AT91_SMC_CS(id, cs), config); |
| 56 | 71 | } |
| 57 | 72 | |
| 73 | +static void sam9_smc_cs_read_mode(void __iomem *base, | |
| 74 | + struct sam9_smc_config *config) | |
| 75 | +{ | |
| 76 | + u32 val = __raw_readl(base + AT91_SMC_MODE); | |
| 77 | + | |
| 78 | + config->mode = (val & ~AT91_SMC_NWECYCLE); | |
| 79 | + config->tdf_cycles = (val & AT91_SMC_NWECYCLE) >> 16 ; | |
| 80 | +} | |
| 81 | + | |
| 82 | +void sam9_smc_read_mode(int id, int cs, | |
| 83 | + struct sam9_smc_config *config) | |
| 84 | +{ | |
| 85 | + sam9_smc_cs_read_mode(AT91_SMC_CS(id, cs), config); | |
| 86 | +} | |
| 87 | + | |
| 88 | +static void sam9_smc_cs_read(void __iomem *base, | |
| 89 | + struct sam9_smc_config *config) | |
| 90 | +{ | |
| 91 | + u32 val; | |
| 92 | + | |
| 93 | + /* Setup register */ | |
| 94 | + val = __raw_readl(base + AT91_SMC_SETUP); | |
| 95 | + | |
| 96 | + config->nwe_setup = val & AT91_SMC_NWESETUP; | |
| 97 | + config->ncs_write_setup = (val & AT91_SMC_NCS_WRSETUP) >> 8; | |
| 98 | + config->nrd_setup = (val & AT91_SMC_NRDSETUP) >> 16; | |
| 99 | + config->ncs_read_setup = (val & AT91_SMC_NCS_RDSETUP) >> 24; | |
| 100 | + | |
| 101 | + /* Pulse register */ | |
| 102 | + val = __raw_readl(base + AT91_SMC_PULSE); | |
| 103 | + | |
| 104 | + config->nwe_setup = val & AT91_SMC_NWEPULSE; | |
| 105 | + config->ncs_write_pulse = (val & AT91_SMC_NCS_WRPULSE) >> 8; | |
| 106 | + config->nrd_pulse = (val & AT91_SMC_NRDPULSE) >> 16; | |
| 107 | + config->ncs_read_pulse = (val & AT91_SMC_NCS_RDPULSE) >> 24; | |
| 108 | + | |
| 109 | + /* Cycle register */ | |
| 110 | + val = __raw_readl(base + AT91_SMC_CYCLE); | |
| 111 | + | |
| 112 | + config->write_cycle = val & AT91_SMC_NWECYCLE; | |
| 113 | + config->read_cycle = (val & AT91_SMC_NRDCYCLE) >> 16; | |
| 114 | + | |
| 115 | + /* Mode register */ | |
| 116 | + sam9_smc_cs_read_mode(base, config); | |
| 117 | +} | |
| 118 | + | |
| 119 | +void sam9_smc_read(int id, int cs, struct sam9_smc_config *config) | |
| 120 | +{ | |
| 121 | + sam9_smc_cs_read(AT91_SMC_CS(id, cs), config); | |
| 122 | +} | |
| 123 | + | |
| 58 | 124 | void __init at91sam9_ioremap_smc(int id, u32 addr) |
| 59 | 125 | { |
| 60 | 126 | if (id > 1) { |
| @@ -8,27 +8,4 @@ · 7 unmodified lines | ||
| 8 | 8 | * published by the Free Software Foundation. |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | −struct sam9_smc_config { | |
| 12 | − /* Setup register */ | |
| 13 | − u8 ncs_read_setup; | |
| 14 | − u8 nrd_setup; | |
| 15 | − u8 ncs_write_setup; | |
| 16 | − u8 nwe_setup; | |
| 17 | − | |
| 18 | − /* Pulse register */ | |
| 19 | − u8 ncs_read_pulse; | |
| 20 | − u8 nrd_pulse; | |
| 21 | − u8 ncs_write_pulse; | |
| 22 | − u8 nwe_pulse; | |
| 23 | − | |
| 24 | − /* Cycle register */ | |
| 25 | − u16 read_cycle; | |
| 26 | − u16 write_cycle; | |
| 27 | − | |
| 28 | − /* Mode register */ | |
| 29 | − u32 mode; | |
| 30 | − u8 tdf_cycles:4; | |
| 31 | −}; | |
| 32 | − | |
| 33 | −extern void __init sam9_smc_configure(int id, int cs, struct sam9_smc_config* config); | |
| 34 | 11 | extern void __init at91sam9_ioremap_smc(int id, u32 addr); |
| @@ -194,6 +194,6 @@ MACHINE_START(BCMRING, "BCMRING") · 193 unmodified lines | ||
| 194 | 194 | .init_early = bcmring_init_early, |
| 195 | 195 | .init_irq = bcmring_init_irq, |
| 196 | 196 | .timer = &bcmring_timer, |
| 197 | − .init_machine = bcmring_init_machine | |
| 197 | + .init_machine = bcmring_init_machine, | |
| 198 | 198 | .restart = bcmring_restart, |
| 199 | 199 | MACHINE_END |
| @@ -33,17 +33,11 @@ · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | #include <mach/timer.h> |
| 35 | 35 | |
| 36 | −#include <linux/mm.h> | |
| 37 | 36 | #include <linux/pfn.h> |
| 38 | 37 | #include <linux/atomic.h> |
| 39 | 38 | #include <linux/sched.h> |
| 40 | 39 | #include <mach/dma.h> |
| 41 | 40 | |
| 42 | −/* I don't quite understand why dc4 fails when this is set to 1 and DMA is enabled */ | |
| 43 | −/* especially since dc4 doesn't use kmalloc'd memory. */ | |
| 44 | − | |
| 45 | −#define ALLOW_MAP_OF_KMALLOC_MEMORY 0 | |
| 46 | − | |
| 47 | 41 | /* ---- Public Variables ------------------------------------------------- */ |
| 48 | 42 | |
| 49 | 43 | /* ---- Private Constants and Types -------------------------------------- */ |
| @@ -53,58 +47,18 @@ · 3 unmodified lines | ||
| 53 | 47 | #define CONTROLLER_FROM_HANDLE(handle) (((handle) >> 4) & 0x0f) |
| 54 | 48 | #define CHANNEL_FROM_HANDLE(handle) ((handle) & 0x0f) |
| 55 | 49 | |
| 56 | −#define DMA_MAP_DEBUG 0 | |
| 57 | − | |
| 58 | −#if DMA_MAP_DEBUG | |
| 59 | −# define DMA_MAP_PRINT(fmt, args...) printk("%s: " fmt, __func__, ## args) | |
| 60 | −#else | |
| 61 | −# define DMA_MAP_PRINT(fmt, args...) | |
| 62 | −#endif | |
| 63 | 50 | |
| 64 | 51 | /* ---- Private Variables ------------------------------------------------ */ |
| 65 | 52 | |
| 66 | 53 | static DMA_Global_t gDMA; |
| 67 | 54 | static struct proc_dir_entry *gDmaDir; |
| 68 | 55 | |
| 69 | −static atomic_t gDmaStatMemTypeKmalloc = ATOMIC_INIT(0); | |
| 70 | −static atomic_t gDmaStatMemTypeVmalloc = ATOMIC_INIT(0); | |
| 71 | −static atomic_t gDmaStatMemTypeUser = ATOMIC_INIT(0); | |
| 72 | −static atomic_t gDmaStatMemTypeCoherent = ATOMIC_INIT(0); | |
| 73 | − | |
| 74 | 56 | #include "dma_device.c" |
| 75 | 57 | |
| 76 | 58 | /* ---- Private Function Prototypes -------------------------------------- */ |
| 77 | 59 | |
| 78 | 60 | /* ---- Functions ------------------------------------------------------- */ |
| 79 | 61 | |
| 80 | −/****************************************************************************/ | |
| 81 | −/** | |
| 82 | −* Displays information for /proc/dma/mem-type | |
| 83 | −*/ | |
| 84 | −/****************************************************************************/ | |
| 85 | − | |
| 86 | −static int dma_proc_read_mem_type(char *buf, char **start, off_t offset, | |
| 87 | − int count, int *eof, void *data) | |
| 88 | −{ | |
| 89 | − int len = 0; | |
| 90 | − | |
| 91 | − len += sprintf(buf + len, "dma_map_mem statistics\n"); | |
| 92 | − len += | |
| 93 | − sprintf(buf + len, "coherent: %d\n", | |
| 94 | − atomic_read(&gDmaStatMemTypeCoherent)); | |
| 95 | − len += | |
| 96 | − sprintf(buf + len, "kmalloc: %d\n", | |
| 97 | − atomic_read(&gDmaStatMemTypeKmalloc)); | |
| 98 | − len += | |
| 99 | − sprintf(buf + len, "vmalloc: %d\n", | |
| 100 | − atomic_read(&gDmaStatMemTypeVmalloc)); | |
| 101 | − len += | |
| 102 | − sprintf(buf + len, "user: %d\n", | |
| 103 | − atomic_read(&gDmaStatMemTypeUser)); | |
| 104 | − | |
| 105 | − return len; | |
| 106 | −} | |
| 107 | − | |
| 108 | 62 | /****************************************************************************/ |
| 109 | 63 | /** |
| 110 | 64 | * Displays information for /proc/dma/channels |
| @@ -846,8 +800,6 @@ int dma_init(void) · 735 unmodified lines | ||
| 846 | 800 | dma_proc_read_channels, NULL); |
| 847 | 801 | create_proc_read_entry("devices", 0, gDmaDir, |
| 848 | 802 | dma_proc_read_devices, NULL); |
| 849 | − create_proc_read_entry("mem-type", 0, gDmaDir, | |
| 850 | − dma_proc_read_mem_type, NULL); | |
| 851 | 803 | } |
| 852 | 804 | |
| 853 | 805 | out: |
| @@ -1565,767 +1517,3 @@ int dma_set_device_handler(DMA_Device_t dev, /* Device to set the callback for. · 711 unmodified lines | ||
| 1565 | 1517 | } |
| 1566 | 1518 | |
| 1567 | 1519 | EXPORT_SYMBOL(dma_set_device_handler); |
| 1568 | − | |
| 1569 | −/****************************************************************************/ | |
| 1570 | −/** | |
| 1571 | −* Initializes a memory mapping structure | |
| 1572 | −*/ | |
| 1573 | −/****************************************************************************/ | |
| 1574 | − | |
| 1575 | −int dma_init_mem_map(DMA_MemMap_t *memMap) | |
| 1576 | −{ | |
| 1577 | − memset(memMap, 0, sizeof(*memMap)); | |
| 1578 | − | |
| 1579 | − sema_init(&memMap->lock, 1); | |
| 1580 | − | |
| 1581 | − return 0; | |
| 1582 | −} | |
| 1583 | − | |
| 1584 | −EXPORT_SYMBOL(dma_init_mem_map); | |
| 1585 | − | |
| 1586 | −/****************************************************************************/ | |
| 1587 | −/** | |
| 1588 | −* Releases any memory currently being held by a memory mapping structure. | |
| 1589 | −*/ | |
| 1590 | −/****************************************************************************/ | |
| 1591 | − | |
| 1592 | −int dma_term_mem_map(DMA_MemMap_t *memMap) | |
| 1593 | −{ | |
| 1594 | − down(&memMap->lock); /* Just being paranoid */ | |
| 1595 | − | |
| 1596 | − /* Free up any allocated memory */ | |
| 1597 | − | |
| 1598 | − up(&memMap->lock); | |
| 1599 | − memset(memMap, 0, sizeof(*memMap)); | |
| 1600 | − | |
| 1601 | − return 0; | |
| 1602 | −} | |
| 1603 | − | |
| 1604 | −EXPORT_SYMBOL(dma_term_mem_map); | |
| 1605 | − | |
| 1606 | −/****************************************************************************/ | |
| 1607 | −/** | |
| 1608 | −* Looks at a memory address and categorizes it. | |
| 1609 | −* | |
| 1610 | −* @return One of the values from the DMA_MemType_t enumeration. | |
| 1611 | −*/ | |
| 1612 | −/****************************************************************************/ | |
| 1613 | − | |
| 1614 | −DMA_MemType_t dma_mem_type(void *addr) | |
| 1615 | −{ | |
| 1616 | − unsigned long addrVal = (unsigned long)addr; | |
| 1617 | − | |
| 1618 | − if (addrVal >= CONSISTENT_BASE) { | |
| 1619 | − /* NOTE: DMA virtual memory space starts at 0xFFxxxxxx */ | |
| 1620 | − | |
| 1621 | − /* dma_alloc_xxx pages are physically and virtually contiguous */ | |
| 1622 | − | |
| 1623 | − return DMA_MEM_TYPE_DMA; | |
| 1624 | − } | |
| 1625 | − | |
| 1626 | − /* Technically, we could add one more classification. Addresses between VMALLOC_END */ | |
| 1627 | − /* and the beginning of the DMA virtual address could be considered to be I/O space. */ | |
| 1628 | − /* Right now, nobody cares about this particular classification, so we ignore it. */ | |
| 1629 | − | |
| 1630 | − if (is_vmalloc_addr(addr)) { | |
| 1631 | − /* Address comes from the vmalloc'd region. Pages are virtually */ | |
| 1632 | − /* contiguous but NOT physically contiguous */ | |
| 1633 | − | |
| 1634 | − return DMA_MEM_TYPE_VMALLOC; | |
| 1635 | − } | |
| 1636 | − | |
| 1637 | − if (addrVal >= PAGE_OFFSET) { | |
| 1638 | − /* PAGE_OFFSET is typically 0xC0000000 */ | |
| 1639 | − | |
| 1640 | − /* kmalloc'd pages are physically contiguous */ | |
| 1641 | − | |
| 1642 | − return DMA_MEM_TYPE_KMALLOC; | |
| 1643 | − } | |
| 1644 | − | |
| 1645 | − return DMA_MEM_TYPE_USER; | |
| 1646 | −} | |
| 1647 | − | |
| 1648 | −EXPORT_SYMBOL(dma_mem_type); | |
| 1649 | − | |
| 1650 | −/****************************************************************************/ | |
| 1651 | −/** | |
| 1652 | −* Looks at a memory address and determines if we support DMA'ing to/from | |
| 1653 | −* that type of memory. | |
| 1654 | −* | |
| 1655 | −* @return boolean - | |
| 1656 | −* return value != 0 means dma supported | |
| 1657 | −* return value == 0 means dma not supported | |
| 1658 | −*/ | |
| 1659 | −/****************************************************************************/ | |
| 1660 | − | |
| 1661 | −int dma_mem_supports_dma(void *addr) | |
| 1662 | −{ | |
| 1663 | − DMA_MemType_t memType = dma_mem_type(addr); | |
| 1664 | − | |
| 1665 | − return (memType == DMA_MEM_TYPE_DMA) | |
| 1666 | −#if ALLOW_MAP_OF_KMALLOC_MEMORY | |
| 1667 | − || (memType == DMA_MEM_TYPE_KMALLOC) | |
| 1668 | −#endif | |
| 1669 | − || (memType == DMA_MEM_TYPE_USER); | |
| 1670 | −} | |
| 1671 | − | |
| 1672 | −EXPORT_SYMBOL(dma_mem_supports_dma); | |
| 1673 | − | |
| 1674 | −/****************************************************************************/ | |
| 1675 | −/** | |
| 1676 | −* Maps in a memory region such that it can be used for performing a DMA. | |
| 1677 | −* | |
| 1678 | −* @return | |
| 1679 | −*/ | |
| 1680 | −/****************************************************************************/ | |
| 1681 | − | |
| 1682 | −int dma_map_start(DMA_MemMap_t *memMap, /* Stores state information about the map */ | |
| 1683 | − enum dma_data_direction dir /* Direction that the mapping will be going */ | |
| 1684 | − ) { | |
| 1685 | − int rc; | |
| 1686 | − | |
| 1687 | − down(&memMap->lock); | |
| 1688 | − | |
| 1689 | − DMA_MAP_PRINT("memMap: %p\n", memMap); | |
| 1690 | − | |
| 1691 | − if (memMap->inUse) { | |
| 1692 | − printk(KERN_ERR "%s: memory map %p is already being used\n", | |
| 1693 | − __func__, memMap); | |
| 1694 | − rc = -EBUSY; | |
| 1695 | − goto out; | |
| 1696 | − } | |
| 1697 | − | |
| 1698 | − memMap->inUse = 1; | |
| 1699 | − memMap->dir = dir; | |
| 1700 | − memMap->numRegionsUsed = 0; | |
| 1701 | − | |
| 1702 | − rc = 0; | |
| 1703 | − | |
| 1704 | −out: | |
| 1705 | − | |
| 1706 | − DMA_MAP_PRINT("returning %d", rc); | |
| 1707 | − | |
| 1708 | − up(&memMap->lock); | |
| 1709 | − | |
| 1710 | − return rc; | |
| 1711 | −} | |
| 1712 | − | |
| 1713 | −EXPORT_SYMBOL(dma_map_start); | |
| 1714 | − | |
| 1715 | −/****************************************************************************/ | |
| 1716 | −/** | |
| 1717 | −* Adds a segment of memory to a memory map. Each segment is both | |
| 1718 | −* physically and virtually contiguous. | |
| 1719 | −* | |
| 1720 | −* @return 0 on success, error code otherwise. | |
| 1721 | −*/ | |
| 1722 | −/****************************************************************************/ | |
| 1723 | − | |
| 1724 | −static int dma_map_add_segment(DMA_MemMap_t *memMap, /* Stores state information about the map */ | |
| 1725 | − DMA_Region_t *region, /* Region that the segment belongs to */ | |
| 1726 | − void *virtAddr, /* Virtual address of the segment being added */ | |
| 1727 | − dma_addr_t physAddr, /* Physical address of the segment being added */ | |
| 1728 | − size_t numBytes /* Number of bytes of the segment being added */ | |
| 1729 | − ) { | |
| 1730 | − DMA_Segment_t *segment; | |
| 1731 | − | |
| 1732 | − DMA_MAP_PRINT("memMap:%p va:%p pa:0x%x #:%d\n", memMap, virtAddr, | |
| 1733 | − physAddr, numBytes); | |
| 1734 | − | |
| 1735 | − /* Sanity check */ | |
| 1736 | − | |
| 1737 | − if (((unsigned long)virtAddr < (unsigned long)region->virtAddr) | |
| 1738 | − || (((unsigned long)virtAddr + numBytes)) > | |
| 1739 | − ((unsigned long)region->virtAddr + region->numBytes)) { | |
| 1740 | − printk(KERN_ERR | |
| 1741 | − "%s: virtAddr %p is outside region @ %p len: %d\n", | |
| 1742 | − __func__, virtAddr, region->virtAddr, region->numBytes); | |
| 1743 | − return -EINVAL; | |
| 1744 | − } | |
| 1745 | − | |
| 1746 | − if (region->numSegmentsUsed > 0) { | |
| 1747 | − /* Check to see if this segment is physically contiguous with the previous one */ | |
| 1748 | − | |
| 1749 | − segment = ®ion->segment[region->numSegmentsUsed - 1]; | |
| 1750 | − | |
| 1751 | − if ((segment->physAddr + segment->numBytes) == physAddr) { | |
| 1752 | − /* It is - just add on to the end */ | |
| 1753 | − | |
| 1754 | − DMA_MAP_PRINT("appending %d bytes to last segment\n", | |
| 1755 | − numBytes); | |
| 1756 | − | |
| 1757 | − segment->numBytes += numBytes; | |
| 1758 | − | |
| 1759 | − return 0; | |
| 1760 | − } | |
| 1761 | − } | |
| 1762 | − | |
| 1763 | − /* Reallocate to hold more segments, if required. */ | |
| 1764 | − | |
| 1765 | − if (region->numSegmentsUsed >= region->numSegmentsAllocated) { | |
| 1766 | − DMA_Segment_t *newSegment; | |
| 1767 | − size_t oldSize = | |
| 1768 | − region->numSegmentsAllocated * sizeof(*newSegment); | |
| 1769 | − int newAlloc = region->numSegmentsAllocated + 4; | |
| 1770 | − size_t newSize = newAlloc * sizeof(*newSegment); | |
| 1771 | − | |
| 1772 | − newSegment = kmalloc(newSize, GFP_KERNEL); | |
| 1773 | − if (newSegment == NULL) { | |
| 1774 | − return -ENOMEM; | |
| 1775 | − } | |
| 1776 | − memcpy(newSegment, region->segment, oldSize); | |
| 1777 | − memset(&((uint8_t *) newSegment)[oldSize], 0, | |
| 1778 | − newSize - oldSize); | |
| 1779 | − kfree(region->segment); | |
| 1780 | − | |
| 1781 | − region->numSegmentsAllocated = newAlloc; | |
| 1782 | − region->segment = newSegment; | |
| 1783 | − } | |
| 1784 | − | |
| 1785 | − segment = ®ion->segment[region->numSegmentsUsed]; | |
| 1786 | − region->numSegmentsUsed++; | |
| 1787 | − | |
| 1788 | − segment->virtAddr = virtAddr; | |
| 1789 | − segment->physAddr = physAddr; | |
| 1790 | − segment->numBytes = numBytes; | |
| 1791 | − | |
| 1792 | − DMA_MAP_PRINT("returning success\n"); | |
| 1793 | − | |
| 1794 | − return 0; | |
| 1795 | −} | |
| 1796 | − | |
| 1797 | −/****************************************************************************/ | |
| 1798 | −/** | |
| 1799 | −* Adds a region of memory to a memory map. Each region is virtually | |
| 1800 | −* contiguous, but not necessarily physically contiguous. | |
| 1801 | −* | |
| 1802 | −* @return 0 on success, error code otherwise. | |
| 1803 | −*/ | |
| 1804 | −/****************************************************************************/ | |
| 1805 | − | |
| 1806 | −int dma_map_add_region(DMA_MemMap_t *memMap, /* Stores state information about the map */ | |
| 1807 | − void *mem, /* Virtual address that we want to get a map of */ | |
| 1808 | − size_t numBytes /* Number of bytes being mapped */ | |
| 1809 | − ) { | |
| 1810 | − unsigned long addr = (unsigned long)mem; | |
| 1811 | − unsigned int offset; | |
| 1812 | − int rc = 0; | |
| 1813 | − DMA_Region_t *region; | |
| 1814 | − dma_addr_t physAddr; | |
| 1815 | − | |
| 1816 | − down(&memMap->lock); | |
| 1817 | − | |
| 1818 | − DMA_MAP_PRINT("memMap:%p va:%p #:%d\n", memMap, mem, numBytes); | |
| 1819 | − | |
| 1820 | − if (!memMap->inUse) { | |
| 1821 | − printk(KERN_ERR "%s: Make sure you call dma_map_start first\n", | |
| 1822 | − __func__); | |
| 1823 | − rc = -EINVAL; | |
| 1824 | − goto out; | |
| 1825 | − } | |
| 1826 | − | |
| 1827 | − /* Reallocate to hold more regions. */ | |
| 1828 | − | |
| 1829 | − if (memMap->numRegionsUsed >= memMap->numRegionsAllocated) { | |
| 1830 | − DMA_Region_t *newRegion; | |
| 1831 | − size_t oldSize = | |
| 1832 | − memMap->numRegionsAllocated * sizeof(*newRegion); | |
| 1833 | − int newAlloc = memMap->numRegionsAllocated + 4; | |
| 1834 | − size_t newSize = newAlloc * sizeof(*newRegion); | |
| 1835 | − | |
| 1836 | − newRegion = kmalloc(newSize, GFP_KERNEL); | |
| 1837 | − if (newRegion == NULL) { | |
| 1838 | − rc = -ENOMEM; | |
| 1839 | − goto out; | |
| 1840 | − } | |
| 1841 | − memcpy(newRegion, memMap->region, oldSize); | |
| 1842 | − memset(&((uint8_t *) newRegion)[oldSize], 0, newSize - oldSize); | |
| 1843 | − | |
| 1844 | − kfree(memMap->region); | |
| 1845 | − | |
| 1846 | − memMap->numRegionsAllocated = newAlloc; | |
| 1847 | − memMap->region = newRegion; | |
| 1848 | − } | |
| 1849 | − | |
| 1850 | − region = &memMap->region[memMap->numRegionsUsed]; | |
| 1851 | − memMap->numRegionsUsed++; | |
| 1852 | − | |
| 1853 | − offset = addr & ~PAGE_MASK; | |
| 1854 | − | |
| 1855 | − region->memType = dma_mem_type(mem); | |
| 1856 | − region->virtAddr = mem; | |
| 1857 | − region->numBytes = numBytes; | |
| 1858 | − region->numSegmentsUsed = 0; | |
| 1859 | − region->numLockedPages = 0; | |
| 1860 | − region->lockedPages = NULL; | |
| 1861 | − | |
| 1862 | − switch (region->memType) { | |
| 1863 | − case DMA_MEM_TYPE_VMALLOC: | |
| 1864 | − { | |
| 1865 | − atomic_inc(&gDmaStatMemTypeVmalloc); | |
| 1866 | − | |
| 1867 | − /* printk(KERN_ERR "%s: vmalloc'd pages are not supported\n", __func__); */ | |
| 1868 | − | |
| 1869 | − /* vmalloc'd pages are not physically contiguous */ | |
| 1870 | − | |
| 1871 | − rc = -EINVAL; | |
| 1872 | − break; | |
| 1873 | − } | |
| 1874 | − | |
| 1875 | − case DMA_MEM_TYPE_KMALLOC: | |
| 1876 | − { | |
| 1877 | − atomic_inc(&gDmaStatMemTypeKmalloc); | |
| 1878 | − | |
| 1879 | − /* kmalloc'd pages are physically contiguous, so they'll have exactly */ | |
| 1880 | − /* one segment */ | |
| 1881 | − | |
| 1882 | −#if ALLOW_MAP_OF_KMALLOC_MEMORY | |
| 1883 | − physAddr = | |
| 1884 | − dma_map_single(NULL, mem, numBytes, memMap->dir); | |
| 1885 | − rc = dma_map_add_segment(memMap, region, mem, physAddr, | |
| 1886 | − numBytes); | |
| 1887 | −#else | |
| 1888 | − rc = -EINVAL; | |
| 1889 | −#endif | |
| 1890 | − break; | |
| 1891 | − } | |
| 1892 | − | |
| 1893 | − case DMA_MEM_TYPE_DMA: | |
| 1894 | − { | |
| 1895 | − /* dma_alloc_xxx pages are physically contiguous */ | |
| 1896 | − | |
| 1897 | − atomic_inc(&gDmaStatMemTypeCoherent); | |
| 1898 | − | |
| 1899 | − physAddr = (vmalloc_to_pfn(mem) << PAGE_SHIFT) + offset; | |
| 1900 | − | |
| 1901 | − dma_sync_single_for_cpu(NULL, physAddr, numBytes, | |
| 1902 | − memMap->dir); | |
| 1903 | − rc = dma_map_add_segment(memMap, region, mem, physAddr, | |
| 1904 | − numBytes); | |
| 1905 | − break; | |
| 1906 | − } | |
| 1907 | − | |
| 1908 | − case DMA_MEM_TYPE_USER: | |
| 1909 | − { | |
| 1910 | − size_t firstPageOffset; | |
| 1911 | − size_t firstPageSize; | |
| 1912 | − struct page **pages; | |
| 1913 | − struct task_struct *userTask; | |
| 1914 | − | |
| 1915 | − atomic_inc(&gDmaStatMemTypeUser); | |
| 1916 | − | |
| 1917 | −#if 1 | |
| 1918 | − /* If the pages are user pages, then the dma_mem_map_set_user_task function */ | |
| 1919 | − /* must have been previously called. */ | |
| 1920 | − | |
| 1921 | − if (memMap->userTask == NULL) { | |
| 1922 | − printk(KERN_ERR | |
| 1923 | − "%s: must call dma_mem_map_set_user_task when using user-mode memory\n", | |
| 1924 | − __func__); | |
| 1925 | − return -EINVAL; | |
| 1926 | − } | |
| 1927 | − | |
| 1928 | − /* User pages need to be locked. */ | |
| 1929 | − | |
| 1930 | − firstPageOffset = | |
| 1931 | − (unsigned long)region->virtAddr & (PAGE_SIZE - 1); | |
| 1932 | − firstPageSize = PAGE_SIZE - firstPageOffset; | |
| 1933 | − | |
| 1934 | − region->numLockedPages = (firstPageOffset | |
| 1935 | − + region->numBytes + | |
| 1936 | − PAGE_SIZE - 1) / PAGE_SIZE; | |
| 1937 | − pages = | |
| 1938 | − kmalloc(region->numLockedPages * | |
| 1939 | − sizeof(struct page *), GFP_KERNEL); | |
| 1940 | − | |
| 1941 | − if (pages == NULL) { | |
| 1942 | − region->numLockedPages = 0; | |
| 1943 | − return -ENOMEM; | |
| 1944 | − } | |
| 1945 | − | |
| 1946 | − userTask = memMap->userTask; | |
| 1947 | − | |
| 1948 | − down_read(&userTask->mm->mmap_sem); | |
| 1949 | − rc = get_user_pages(userTask, /* task */ | |
| 1950 | − userTask->mm, /* mm */ | |
| 1951 | − (unsigned long)region->virtAddr, /* start */ | |
| 1952 | − region->numLockedPages, /* len */ | |
| 1953 | − memMap->dir == DMA_FROM_DEVICE, /* write */ | |
| 1954 | − 0, /* force */ | |
| 1955 | − pages, /* pages (array of pointers to page) */ | |
| 1956 | − NULL); /* vmas */ | |
| 1957 | − up_read(&userTask->mm->mmap_sem); | |
| 1958 | − | |
| 1959 | − if (rc != region->numLockedPages) { | |
| 1960 | − kfree(pages); | |
| 1961 | − region->numLockedPages = 0; | |
| 1962 | − | |
| 1963 | − if (rc >= 0) { | |
| 1964 | − rc = -EINVAL; | |
| 1965 | − } | |
| 1966 | − } else { | |
| 1967 | − uint8_t *virtAddr = region->virtAddr; | |
| 1968 | − size_t bytesRemaining; | |
| 1969 | − int pageIdx; | |
| 1970 | − | |
| 1971 | − rc = 0; /* Since get_user_pages returns +ve number */ | |
| 1972 | − | |
| 1973 | − region->lockedPages = pages; | |
| 1974 | − | |
| 1975 | − /* We've locked the user pages. Now we need to walk them and figure */ | |
| 1976 | − /* out the physical addresses. */ | |
| 1977 | − | |
| 1978 | − /* The first page may be partial */ | |
| 1979 | − | |
| 1980 | − dma_map_add_segment(memMap, | |
| 1981 | − region, | |
| 1982 | − virtAddr, | |
| 1983 | − PFN_PHYS(page_to_pfn | |
| 1984 | − (pages[0])) + | |
| 1985 | − firstPageOffset, | |
| 1986 | − firstPageSize); | |
| 1987 | − | |
| 1988 | − virtAddr += firstPageSize; | |
| 1989 | − bytesRemaining = | |
| 1990 | − region->numBytes - firstPageSize; | |
| 1991 | − | |
| 1992 | − for (pageIdx = 1; | |
| 1993 | − pageIdx < region->numLockedPages; | |
| 1994 | − pageIdx++) { | |
| 1995 | − size_t bytesThisPage = | |
| 1996 | − (bytesRemaining > | |
| 1997 | − PAGE_SIZE ? PAGE_SIZE : | |
| 1998 | − bytesRemaining); | |
| 1999 | − | |
| 2000 | − DMA_MAP_PRINT | |
| 2001 | − ("pageIdx:%d pages[pageIdx]=%p pfn=%u phys=%u\n", | |
| 2002 | − pageIdx, pages[pageIdx], | |
| 2003 | − page_to_pfn(pages[pageIdx]), | |
| 2004 | − PFN_PHYS(page_to_pfn | |
| 2005 | − (pages[pageIdx]))); | |
| 2006 | − | |
| 2007 | − dma_map_add_segment(memMap, | |
| 2008 | − region, | |
| 2009 | − virtAddr, | |
| 2010 | − PFN_PHYS(page_to_pfn | |
| 2011 | − (pages | |
| 2012 | − [pageIdx])), | |
| 2013 | − bytesThisPage); | |
| 2014 | − | |
| 2015 | − virtAddr += bytesThisPage; | |
| 2016 | − bytesRemaining -= bytesThisPage; | |
| 2017 | − } | |
| 2018 | − } | |
| 2019 | −#else | |
| 2020 | − printk(KERN_ERR | |
| 2021 | − "%s: User mode pages are not yet supported\n", | |
| 2022 | − __func__); | |
| 2023 | − | |
| 2024 | − /* user pages are not physically contiguous */ | |
| 2025 | − | |
| 2026 | − rc = -EINVAL; | |
| 2027 | −#endif | |
| 2028 | − break; | |
| 2029 | − } | |
| 2030 | − | |
| 2031 | − default: | |
| 2032 | − { | |
| 2033 | − printk(KERN_ERR "%s: Unsupported memory type: %d\n", | |
| 2034 | − __func__, region->memType); | |
| 2035 | − | |
| 2036 | − rc = -EINVAL; | |
| 2037 | − break; | |
| 2038 | − } | |
| 2039 | − } | |
| 2040 | − | |
| 2041 | − if (rc != 0) { | |
| 2042 | − memMap->numRegionsUsed--; | |
| 2043 | − } | |
| 2044 | − | |
| 2045 | −out: | |
| 2046 | − | |
| 2047 | − DMA_MAP_PRINT("returning %d\n", rc); | |
| 2048 | − | |
| 2049 | − up(&memMap->lock); | |
| 2050 | − | |
| 2051 | − return rc; | |
| 2052 | −} | |
| 2053 | − | |
| 2054 | −EXPORT_SYMBOL(dma_map_add_segment); | |
| 2055 | − | |
| 2056 | −/****************************************************************************/ | |
| 2057 | −/** | |
| 2058 | −* Maps in a memory region such that it can be used for performing a DMA. | |
| 2059 | −* | |
| 2060 | −* @return 0 on success, error code otherwise. | |
| 2061 | −*/ | |
| 2062 | −/****************************************************************************/ | |
| 2063 | − | |
| 2064 | −int dma_map_mem(DMA_MemMap_t *memMap, /* Stores state information about the map */ | |
| 2065 | − void *mem, /* Virtual address that we want to get a map of */ | |
| 2066 | − size_t numBytes, /* Number of bytes being mapped */ | |
| 2067 | − enum dma_data_direction dir /* Direction that the mapping will be going */ | |
| 2068 | − ) { | |
| 2069 | − int rc; | |
| 2070 | − | |
| 2071 | − rc = dma_map_start(memMap, dir); | |
| 2072 | − if (rc == 0) { | |
| 2073 | − rc = dma_map_add_region(memMap, mem, numBytes); | |
| 2074 | − if (rc < 0) { | |
| 2075 | − /* Since the add fails, this function will fail, and the caller won't */ | |
| 2076 | − /* call unmap, so we need to do it here. */ | |
| 2077 | − | |
| 2078 | − dma_unmap(memMap, 0); | |
| 2079 | − } | |
| 2080 | − } | |
| 2081 | − | |
| 2082 | − return rc; | |
| 2083 | −} | |
| 2084 | − | |
| 2085 | −EXPORT_SYMBOL(dma_map_mem); | |
| 2086 | − | |
| 2087 | −/****************************************************************************/ | |
| 2088 | −/** | |
| 2089 | −* Setup a descriptor ring for a given memory map. | |
| 2090 | −* | |
| 2091 | −* It is assumed that the descriptor ring has already been initialized, and | |
| 2092 | −* this routine will only reallocate a new descriptor ring if the existing | |
| 2093 | −* one is too small. | |
| 2094 | −* | |
| 2095 | −* @return 0 on success, error code otherwise. | |
| 2096 | −*/ | |
| 2097 | −/****************************************************************************/ | |
| 2098 | − | |
| 2099 | −int dma_map_create_descriptor_ring(DMA_Device_t dev, /* DMA device (where the ring is stored) */ | |
| 2100 | − DMA_MemMap_t *memMap, /* Memory map that will be used */ | |
| 2101 | − dma_addr_t devPhysAddr /* Physical address of device */ | |
| 2102 | − ) { | |
| 2103 | − int rc; | |
| 2104 | − int numDescriptors; | |
| 2105 | − DMA_DeviceAttribute_t *devAttr; | |
| 2106 | − DMA_Region_t *region; | |
| 2107 | − DMA_Segment_t *segment; | |
| 2108 | − dma_addr_t srcPhysAddr; | |
| 2109 | − dma_addr_t dstPhysAddr; | |
| 2110 | − int regionIdx; | |
| 2111 | − int segmentIdx; | |
| 2112 | − | |
| 2113 | − devAttr = &DMA_gDeviceAttribute[dev]; | |
| 2114 | − | |
| 2115 | − down(&memMap->lock); | |
| 2116 | − | |
| 2117 | − /* Figure out how many descriptors we need */ | |
| 2118 | − | |
| 2119 | − numDescriptors = 0; | |
| 2120 | − for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) { | |
| 2121 | − region = &memMap->region[regionIdx]; | |
| 2122 | − | |
| 2123 | − for (segmentIdx = 0; segmentIdx < region->numSegmentsUsed; | |
| 2124 | − segmentIdx++) { | |
| 2125 | − segment = ®ion->segment[segmentIdx]; | |
| 2126 | − | |
| 2127 | − if (memMap->dir == DMA_TO_DEVICE) { | |
| 2128 | − srcPhysAddr = segment->physAddr; | |
| 2129 | − dstPhysAddr = devPhysAddr; | |
| 2130 | − } else { | |
| 2131 | − srcPhysAddr = devPhysAddr; | |
| 2132 | − dstPhysAddr = segment->physAddr; | |
| 2133 | − } | |
| 2134 | − | |
| 2135 | − rc = | |
| 2136 | − dma_calculate_descriptor_count(dev, srcPhysAddr, | |
| 2137 | − dstPhysAddr, | |
| 2138 | − segment-> | |
| 2139 | − numBytes); | |
| 2140 | − if (rc < 0) { | |
| 2141 | − printk(KERN_ERR | |
| 2142 | − "%s: dma_calculate_descriptor_count failed: %d\n", | |
| 2143 | − __func__, rc); | |
| 2144 | − goto out; | |
| 2145 | − } | |
| 2146 | − numDescriptors += rc; | |
| 2147 | − } | |
| 2148 | − } | |
| 2149 | − | |
| 2150 | − /* Adjust the size of the ring, if it isn't big enough */ | |
| 2151 | − | |
| 2152 | − if (numDescriptors > devAttr->ring.descriptorsAllocated) { | |
| 2153 | − dma_free_descriptor_ring(&devAttr->ring); | |
| 2154 | − rc = | |
| 2155 | − dma_alloc_descriptor_ring(&devAttr->ring, | |
| 2156 | − numDescriptors); | |
| 2157 | − if (rc < 0) { | |
| 2158 | − printk(KERN_ERR | |
| 2159 | − "%s: dma_alloc_descriptor_ring failed: %d\n", | |
| 2160 | − __func__, rc); | |
| 2161 | − goto out; | |
| 2162 | − } | |
| 2163 | − } else { | |
| 2164 | − rc = | |
| 2165 | − dma_init_descriptor_ring(&devAttr->ring, | |
| 2166 | − numDescriptors); | |
| 2167 | − if (rc < 0) { | |
| 2168 | − printk(KERN_ERR | |
| 2169 | − "%s: dma_init_descriptor_ring failed: %d\n", | |
| 2170 | − __func__, rc); | |
| 2171 | − goto out; | |
| 2172 | − } | |
| 2173 | − } | |
| 2174 | − | |
| 2175 | − /* Populate the descriptors */ | |
| 2176 | − | |
| 2177 | − for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) { | |
| 2178 | − region = &memMap->region[regionIdx]; | |
| 2179 | − | |
| 2180 | − for (segmentIdx = 0; segmentIdx < region->numSegmentsUsed; | |
| 2181 | − segmentIdx++) { | |
| 2182 | − segment = ®ion->segment[segmentIdx]; | |
| 2183 | − | |
| 2184 | − if (memMap->dir == DMA_TO_DEVICE) { | |
| 2185 | − srcPhysAddr = segment->physAddr; | |
| 2186 | − dstPhysAddr = devPhysAddr; | |
| 2187 | − } else { | |
| 2188 | − srcPhysAddr = devPhysAddr; | |
| 2189 | − dstPhysAddr = segment->physAddr; | |
| 2190 | − } | |
| 2191 | − | |
| 2192 | − rc = | |
| 2193 | − dma_add_descriptors(&devAttr->ring, dev, | |
| 2194 | − srcPhysAddr, dstPhysAddr, | |
| 2195 | − segment->numBytes); | |
| 2196 | − if (rc < 0) { | |
| 2197 | − printk(KERN_ERR | |
| 2198 | − "%s: dma_add_descriptors failed: %d\n", | |
| 2199 | − __func__, rc); | |
| 2200 | − goto out; | |
| 2201 | − } | |
| 2202 | − } | |
| 2203 | − } | |
| 2204 | − | |
| 2205 | − rc = 0; | |
| 2206 | − | |
| 2207 | −out: | |
| 2208 | − | |
| 2209 | − up(&memMap->lock); | |
| 2210 | − return rc; | |
| 2211 | −} | |
| 2212 | − | |
| 2213 | −EXPORT_SYMBOL(dma_map_create_descriptor_ring); | |
| 2214 | − | |
| 2215 | −/****************************************************************************/ | |
| 2216 | −/** | |
| 2217 | −* Maps in a memory region such that it can be used for performing a DMA. | |
| 2218 | −* | |
| 2219 | −* @return | |
| 2220 | −*/ | |
| 2221 | −/****************************************************************************/ | |
| 2222 | − | |
| 2223 | −int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */ | |
| 2224 | − int dirtied /* non-zero if any of the pages were modified */ | |
| 2225 | − ) { | |
| 2226 | − | |
| 2227 | − int rc = 0; | |
| 2228 | − int regionIdx; | |
| 2229 | − int segmentIdx; | |
| 2230 | − DMA_Region_t *region; | |
| 2231 | − DMA_Segment_t *segment; | |
| 2232 | − | |
| 2233 | − down(&memMap->lock); | |
| 2234 | − | |
| 2235 | − for (regionIdx = 0; regionIdx < memMap->numRegionsUsed; regionIdx++) { | |
| 2236 | − region = &memMap->region[regionIdx]; | |
| 2237 | − | |
| 2238 | − for (segmentIdx = 0; segmentIdx < region->numSegmentsUsed; | |
| 2239 | − segmentIdx++) { | |
| 2240 | − segment = ®ion->segment[segmentIdx]; | |
| 2241 | − | |
| 2242 | − switch (region->memType) { | |
| 2243 | − case DMA_MEM_TYPE_VMALLOC: | |
| 2244 | − { | |
| 2245 | − printk(KERN_ERR | |
| 2246 | − "%s: vmalloc'd pages are not yet supported\n", | |
| 2247 | − __func__); | |
| 2248 | − rc = -EINVAL; | |
| 2249 | − goto out; | |
| 2250 | − } | |
| 2251 | − | |
| 2252 | − case DMA_MEM_TYPE_KMALLOC: | |
| 2253 | − { | |
| 2254 | −#if ALLOW_MAP_OF_KMALLOC_MEMORY | |
| 2255 | − dma_unmap_single(NULL, | |
| 2256 | − segment->physAddr, | |
| 2257 | − segment->numBytes, | |
| 2258 | − memMap->dir); | |
| 2259 | −#endif | |
| 2260 | − break; | |
| 2261 | − } | |
| 2262 | − | |
| 2263 | − case DMA_MEM_TYPE_DMA: | |
| 2264 | − { | |
| 2265 | − dma_sync_single_for_cpu(NULL, | |
| 2266 | − segment-> | |
| 2267 | − physAddr, | |
| 2268 | − segment-> | |
| 2269 | − numBytes, | |
| 2270 | − memMap->dir); | |
| 2271 | − break; | |
| 2272 | − } | |
| 2273 | − | |
| 2274 | − case DMA_MEM_TYPE_USER: | |
| 2275 | − { | |
| 2276 | − /* Nothing to do here. */ | |
| 2277 | − | |
| 2278 | − break; | |
| 2279 | − } | |
| 2280 | − | |
| 2281 | − default: | |
| 2282 | − { | |
| 2283 | − printk(KERN_ERR | |
| 2284 | − "%s: Unsupported memory type: %d\n", | |
| 2285 | − __func__, region->memType); | |
| 2286 | − rc = -EINVAL; | |
| 2287 | − goto out; | |
| 2288 | − } | |
| 2289 | − } | |
| 2290 | − | |
| 2291 | − segment->virtAddr = NULL; | |
| 2292 | − segment->physAddr = 0; | |
| 2293 | − segment->numBytes = 0; | |
| 2294 | − } | |
| 2295 | − | |
| 2296 | − if (region->numLockedPages > 0) { | |
| 2297 | − int pageIdx; | |
| 2298 | − | |
| 2299 | − /* Some user pages were locked. We need to go and unlock them now. */ | |
| 2300 | − | |
| 2301 | − for (pageIdx = 0; pageIdx < region->numLockedPages; | |
| 2302 | − pageIdx++) { | |
| 2303 | − struct page *page = | |
| 2304 | − region->lockedPages[pageIdx]; | |
| 2305 | − | |
| 2306 | − if (memMap->dir == DMA_FROM_DEVICE) { | |
| 2307 | − SetPageDirty(page); | |
| 2308 | − } | |
| 2309 | − page_cache_release(page); | |
| 2310 | − } | |
| 2311 | − kfree(region->lockedPages); | |
| 2312 | − region->numLockedPages = 0; | |
| 2313 | − region->lockedPages = NULL; | |
| 2314 | − } | |
| 2315 | − | |
| 2316 | − region->memType = DMA_MEM_TYPE_NONE; | |
| 2317 | − region->virtAddr = NULL; | |
| 2318 | − region->numBytes = 0; | |
| 2319 | − region->numSegmentsUsed = 0; | |
| 2320 | − } | |
| 2321 | − memMap->userTask = NULL; | |
| 2322 | − memMap->numRegionsUsed = 0; | |
| 2323 | − memMap->inUse = 0; | |
| 2324 | − | |
| 2325 | −out: | |
| 2326 | − up(&memMap->lock); | |
| 2327 | − | |
| 2328 | − return rc; | |
| 2329 | −} | |
| 2330 | − | |
| 2331 | −EXPORT_SYMBOL(dma_unmap); | |
| @@ -26,15 +26,9 @@ · 25 unmodified lines | ||
| 26 | 26 | /* ---- Include Files ---------------------------------------------------- */ |
| 27 | 27 | |
| 28 | 28 | #include <linux/kernel.h> |
| 29 | −#include <linux/wait.h> | |
| 30 | 29 | #include <linux/semaphore.h> |
| 31 | 30 | #include <csp/dmacHw.h> |
| 32 | 31 | #include <mach/timer.h> |
| 33 | −#include <linux/scatterlist.h> | |
| 34 | −#include <linux/dma-mapping.h> | |
| 35 | −#include <linux/mm.h> | |
| 36 | −#include <linux/vmalloc.h> | |
| 37 | −#include <linux/pagemap.h> | |
| 38 | 32 | |
| 39 | 33 | /* ---- Constants and Types ---------------------------------------------- */ |
| 40 | 34 | |
| @@ -111,78 +105,6 @@ typedef struct { · 70 unmodified lines | ||
| 111 | 105 | |
| 112 | 106 | } DMA_DescriptorRing_t; |
| 113 | 107 | |
| 114 | −/**************************************************************************** | |
| 115 | −* | |
| 116 | −* The DMA_MemType_t and DMA_MemMap_t are helper structures used to setup | |
| 117 | −* DMA chains from a variety of memory sources. | |
| 118 | −* | |
| 119 | −*****************************************************************************/ | |
| 120 | − | |
| 121 | −#define DMA_MEM_MAP_MIN_SIZE 4096 /* Pages less than this size are better */ | |
| 122 | − /* off not being DMA'd. */ | |
| 123 | − | |
| 124 | −typedef enum { | |
| 125 | − DMA_MEM_TYPE_NONE, /* Not a valid setting */ | |
| 126 | − DMA_MEM_TYPE_VMALLOC, /* Memory came from vmalloc call */ | |
| 127 | − DMA_MEM_TYPE_KMALLOC, /* Memory came from kmalloc call */ | |
| 128 | − DMA_MEM_TYPE_DMA, /* Memory came from dma_alloc_xxx call */ | |
| 129 | − DMA_MEM_TYPE_USER, /* Memory came from user space. */ | |
| 130 | − | |
| 131 | −} DMA_MemType_t; | |
| 132 | − | |
| 133 | −/* A segment represents a physically and virtually contiguous chunk of memory. */ | |
| 134 | −/* i.e. each segment can be DMA'd */ | |
| 135 | −/* A user of the DMA code will add memory regions. Each region may need to be */ | |
| 136 | −/* represented by one or more segments. */ | |
| 137 | − | |
| 138 | −typedef struct { | |
| 139 | − void *virtAddr; /* Virtual address used for this segment */ | |
| 140 | − dma_addr_t physAddr; /* Physical address this segment maps to */ | |
| 141 | − size_t numBytes; /* Size of the segment, in bytes */ | |
| 142 | − | |
| 143 | −} DMA_Segment_t; | |
| 144 | − | |
| 145 | −/* A region represents a virtually contiguous chunk of memory, which may be */ | |
| 146 | −/* made up of multiple segments. */ | |
| 147 | − | |
| 148 | −typedef struct { | |
| 149 | − DMA_MemType_t memType; | |
| 150 | − void *virtAddr; | |
| 151 | − size_t numBytes; | |
| 152 | − | |
| 153 | − /* Each region (virtually contiguous) consists of one or more segments. Each */ | |
| 154 | − /* segment is virtually and physically contiguous. */ | |
| 155 | − | |
| 156 | − int numSegmentsUsed; | |
| 157 | − int numSegmentsAllocated; | |
| 158 | − DMA_Segment_t *segment; | |
| 159 | − | |
| 160 | − /* When a region corresponds to user memory, we need to lock all of the pages */ | |
| 161 | − /* down before we can figure out the physical addresses. The lockedPage array contains */ | |
| 162 | − /* the pages that were locked, and which subsequently need to be unlocked once the */ | |
| 163 | − /* memory is unmapped. */ | |
| 164 | − | |
| 165 | − unsigned numLockedPages; | |
| 166 | − struct page **lockedPages; | |
| 167 | − | |
| 168 | −} DMA_Region_t; | |
| 169 | − | |
| 170 | −typedef struct { | |
| 171 | − int inUse; /* Is this mapping currently being used? */ | |
| 172 | − struct semaphore lock; /* Acquired when using this structure */ | |
| 173 | − enum dma_data_direction dir; /* Direction this transfer is intended for */ | |
| 174 | − | |
| 175 | − /* In the event that we're mapping user memory, we need to know which task */ | |
| 176 | − /* the memory is for, so that we can obtain the correct mm locks. */ | |
| 177 | − | |
| 178 | − struct task_struct *userTask; | |
| 179 | − | |
| 180 | − int numRegionsUsed; | |
| 181 | − int numRegionsAllocated; | |
| 182 | − DMA_Region_t *region; | |
| 183 | − | |
| 184 | −} DMA_MemMap_t; | |
| 185 | − | |
| 186 | 108 | /**************************************************************************** |
| 187 | 109 | * |
| 188 | 110 | * The DMA_DeviceAttribute_t contains information which describes a |
| @@ -568,124 +490,6 @@ int dma_alloc_double_dst_descriptors(DMA_Handle_t handle, /* DMA Handle */ · 379 unmodified lines | ||
| 568 | 490 | size_t numBytes /* Number of bytes in each destination buffer */ |
| 569 | 491 | ); |
| 570 | 492 | |
| 571 | −/****************************************************************************/ | |
| 572 | −/** | |
| 573 | −* Initializes a DMA_MemMap_t data structure | |
| 574 | −*/ | |
| 575 | −/****************************************************************************/ | |
| 576 | − | |
| 577 | −int dma_init_mem_map(DMA_MemMap_t *memMap /* Stores state information about the map */ | |
| 578 | − ); | |
| 579 | − | |
| 580 | −/****************************************************************************/ | |
| 581 | −/** | |
| 582 | −* Releases any memory currently being held by a memory mapping structure. | |
| 583 | −*/ | |
| 584 | −/****************************************************************************/ | |
| 585 | − | |
| 586 | −int dma_term_mem_map(DMA_MemMap_t *memMap /* Stores state information about the map */ | |
| 587 | − ); | |
| 588 | − | |
| 589 | −/****************************************************************************/ | |
| 590 | −/** | |
| 591 | −* Looks at a memory address and categorizes it. | |
| 592 | −* | |
| 593 | −* @return One of the values from the DMA_MemType_t enumeration. | |
| 594 | −*/ | |
| 595 | −/****************************************************************************/ | |
| 596 | − | |
| 597 | −DMA_MemType_t dma_mem_type(void *addr); | |
| 598 | − | |
| 599 | −/****************************************************************************/ | |
| 600 | −/** | |
| 601 | −* Sets the process (aka userTask) associated with a mem map. This is | |
| 602 | −* required if user-mode segments will be added to the mapping. | |
| 603 | −*/ | |
| 604 | −/****************************************************************************/ | |
| 605 | − | |
| 606 | −static inline void dma_mem_map_set_user_task(DMA_MemMap_t *memMap, | |
| 607 | − struct task_struct *task) | |
| 608 | −{ | |
| 609 | − memMap->userTask = task; | |
| 610 | −} | |
| 611 | − | |
| 612 | −/****************************************************************************/ | |
| 613 | −/** | |
| 614 | −* Looks at a memory address and determines if we support DMA'ing to/from | |
| 615 | −* that type of memory. | |
| 616 | −* | |
| 617 | −* @return boolean - | |
| 618 | −* return value != 0 means dma supported | |
| 619 | −* return value == 0 means dma not supported | |
| 620 | −*/ | |
| 621 | −/****************************************************************************/ | |
| 622 | − | |
| 623 | −int dma_mem_supports_dma(void *addr); | |
| 624 | − | |
| 625 | −/****************************************************************************/ | |
| 626 | −/** | |
| 627 | −* Initializes a memory map for use. Since this function acquires a | |
| 628 | −* sempaphore within the memory map, it is VERY important that dma_unmap | |
| 629 | −* be called when you're finished using the map. | |
| 630 | −*/ | |
| 631 | −/****************************************************************************/ | |
| 632 | − | |
| 633 | −int dma_map_start(DMA_MemMap_t *memMap, /* Stores state information about the map */ | |
| 634 | − enum dma_data_direction dir /* Direction that the mapping will be going */ | |
| 635 | − ); | |
| 636 | − | |
| 637 | −/****************************************************************************/ | |
| 638 | −/** | |
| 639 | −* Adds a segment of memory to a memory map. | |
| 640 | −* | |
| 641 | −* @return 0 on success, error code otherwise. | |
| 642 | −*/ | |
| 643 | −/****************************************************************************/ | |
| 644 | − | |
| 645 | −int dma_map_add_region(DMA_MemMap_t *memMap, /* Stores state information about the map */ | |
| 646 | − void *mem, /* Virtual address that we want to get a map of */ | |
| 647 | − size_t numBytes /* Number of bytes being mapped */ | |
| 648 | − ); | |
| 649 | − | |
| 650 | −/****************************************************************************/ | |
| 651 | −/** | |
| 652 | −* Creates a descriptor ring from a memory mapping. | |
| 653 | −* | |
| 654 | −* @return 0 on success, error code otherwise. | |
| 655 | −*/ | |
| 656 | −/****************************************************************************/ | |
| 657 | − | |
| 658 | −int dma_map_create_descriptor_ring(DMA_Device_t dev, /* DMA device (where the ring is stored) */ | |
| 659 | − DMA_MemMap_t *memMap, /* Memory map that will be used */ | |
| 660 | − dma_addr_t devPhysAddr /* Physical address of device */ | |
| 661 | − ); | |
| 662 | − | |
| 663 | −/****************************************************************************/ | |
| 664 | −/** | |
| 665 | −* Maps in a memory region such that it can be used for performing a DMA. | |
| 666 | −* | |
| 667 | −* @return | |
| 668 | −*/ | |
| 669 | −/****************************************************************************/ | |
| 670 | − | |
| 671 | −int dma_map_mem(DMA_MemMap_t *memMap, /* Stores state information about the map */ | |
| 672 | − void *addr, /* Virtual address that we want to get a map of */ | |
| 673 | − size_t count, /* Number of bytes being mapped */ | |
| 674 | − enum dma_data_direction dir /* Direction that the mapping will be going */ | |
| 675 | − ); | |
| 676 | − | |
| 677 | −/****************************************************************************/ | |
| 678 | −/** | |
| 679 | −* Maps in a memory region such that it can be used for performing a DMA. | |
| 680 | −* | |
| 681 | −* @return | |
| 682 | −*/ | |
| 683 | −/****************************************************************************/ | |
| 684 | − | |
| 685 | −int dma_unmap(DMA_MemMap_t *memMap, /* Stores state information about the map */ | |
| 686 | − int dirtied /* non-zero if any of the pages were modified */ | |
| 687 | − ); | |
| 688 | − | |
| 689 | 493 | /****************************************************************************/ |
| 690 | 494 | /** |
| 691 | 495 | * Initiates a transfer when the descriptors have already been setup. |
| @@ -44,7 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | #include <mach/aemif.h> |
| 45 | 45 | #include <mach/spi.h> |
| 46 | 46 | |
| 47 | −#define DA850_EVM_PHY_ID "0:00" | |
| 47 | +#define DA850_EVM_PHY_ID "davinci_mdio-0:00" | |
| 48 | 48 | #define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8) |
| 49 | 49 | #define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15) |
| 50 | 50 | |
| @@ -54,7 +54,7 @@ static inline int have_tvp7002(void) · 53 unmodified lines | ||
| 54 | 54 | return 0; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | −#define DM365_EVM_PHY_ID "0:01" | |
| 57 | +#define DM365_EVM_PHY_ID "davinci_mdio-0:01" | |
| 58 | 58 | /* |
| 59 | 59 | * A MAX-II CPLD is used for various board control functions. |
| 60 | 60 | */ |
| @@ -40,7 +40,7 @@ · 39 unmodified lines | ||
| 40 | 40 | #include <mach/usb.h> |
| 41 | 41 | #include <mach/aemif.h> |
| 42 | 42 | |
| 43 | −#define DM644X_EVM_PHY_ID "0:01" | |
| 43 | +#define DM644X_EVM_PHY_ID "davinci_mdio-0:01" | |
| 44 | 44 | #define LXT971_PHY_ID (0x001378e2) |
| 45 | 45 | #define LXT971_PHY_MASK (0xfffffff0) |
| 46 | 46 | |
| @@ -736,7 +736,7 @@ static struct davinci_uart_config uart_config __initdata = { · 735 unmodified lines | ||
| 736 | 736 | .enabled_uarts = (1 << 0), |
| 737 | 737 | }; |
| 738 | 738 | |
| 739 | −#define DM646X_EVM_PHY_ID "0:01" | |
| 739 | +#define DM646X_EVM_PHY_ID "davinci_mdio-0:01" | |
| 740 | 740 | /* |
| 741 | 741 | * The following EDMA channels/slots are not being used by drivers (for |
| 742 | 742 | * example: Timer, GPIO, UART events etc) on dm646x, hence they are being |
| @@ -39,7 +39,7 @@ · 38 unmodified lines | ||
| 39 | 39 | #include <mach/mmc.h> |
| 40 | 40 | #include <mach/usb.h> |
| 41 | 41 | |
| 42 | −#define NEUROS_OSD2_PHY_ID "0:01" | |
| 42 | +#define NEUROS_OSD2_PHY_ID "davinci_mdio-0:01" | |
| 43 | 43 | #define LXT971_PHY_ID 0x001378e2 |
| 44 | 44 | #define LXT971_PHY_MASK 0xfffffff0 |
| 45 | 45 | |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #include <mach/da8xx.h> |
| 22 | 22 | #include <mach/mux.h> |
| 23 | 23 | |
| 24 | −#define HAWKBOARD_PHY_ID "0:07" | |
| 24 | +#define HAWKBOARD_PHY_ID "davinci_mdio-0:07" | |
| 25 | 25 | #define DA850_HAWK_MMCSD_CD_PIN GPIO_TO_PIN(3, 12) |
| 26 | 26 | #define DA850_HAWK_MMCSD_WP_PIN GPIO_TO_PIN(3, 13) |
| 27 | 27 | |
| @@ -42,7 +42,7 @@ · 41 unmodified lines | ||
| 42 | 42 | #include <mach/mux.h> |
| 43 | 43 | #include <mach/usb.h> |
| 44 | 44 | |
| 45 | −#define SFFSDR_PHY_ID "0:01" | |
| 45 | +#define SFFSDR_PHY_ID "davinci_mdio-0:01" | |
| 46 | 46 | static struct mtd_partition davinci_sffsdr_nandflash_partition[] = { |
| 47 | 47 | /* U-Boot Environment: Block 0 |
| 48 | 48 | * UBL: Block 1 |
| @@ -153,34 +153,6 @@ static struct clk pll1_sysclk3 = { · 152 unmodified lines | ||
| 153 | 153 | .div_reg = PLLDIV3, |
| 154 | 154 | }; |
| 155 | 155 | |
| 156 | −static struct clk pll1_sysclk4 = { | |
| 157 | − .name = "pll1_sysclk4", | |
| 158 | − .parent = &pll1_clk, | |
| 159 | − .flags = CLK_PLL, | |
| 160 | − .div_reg = PLLDIV4, | |
| 161 | −}; | |
| 162 | − | |
| 163 | −static struct clk pll1_sysclk5 = { | |
| 164 | − .name = "pll1_sysclk5", | |
| 165 | − .parent = &pll1_clk, | |
| 166 | − .flags = CLK_PLL, | |
| 167 | − .div_reg = PLLDIV5, | |
| 168 | −}; | |
| 169 | − | |
| 170 | −static struct clk pll1_sysclk6 = { | |
| 171 | − .name = "pll0_sysclk6", | |
| 172 | − .parent = &pll0_clk, | |
| 173 | − .flags = CLK_PLL, | |
| 174 | − .div_reg = PLLDIV6, | |
| 175 | −}; | |
| 176 | − | |
| 177 | −static struct clk pll1_sysclk7 = { | |
| 178 | − .name = "pll1_sysclk7", | |
| 179 | − .parent = &pll1_clk, | |
| 180 | − .flags = CLK_PLL, | |
| 181 | − .div_reg = PLLDIV7, | |
| 182 | −}; | |
| 183 | − | |
| 184 | 156 | static struct clk i2c0_clk = { |
| 185 | 157 | .name = "i2c0", |
| 186 | 158 | .parent = &pll0_aux_clk, |
| @@ -397,10 +369,6 @@ static struct clk_lookup da850_clks[] = { · 210 unmodified lines | ||
| 397 | 369 | CLK(NULL, "pll1_aux", &pll1_aux_clk), |
| 398 | 370 | CLK(NULL, "pll1_sysclk2", &pll1_sysclk2), |
| 399 | 371 | CLK(NULL, "pll1_sysclk3", &pll1_sysclk3), |
| 400 | − CLK(NULL, "pll1_sysclk4", &pll1_sysclk4), | |
| 401 | − CLK(NULL, "pll1_sysclk5", &pll1_sysclk5), | |
| 402 | − CLK(NULL, "pll1_sysclk6", &pll1_sysclk6), | |
| 403 | − CLK(NULL, "pll1_sysclk7", &pll1_sysclk7), | |
| 404 | 372 | CLK("i2c_davinci.1", NULL, &i2c0_clk), |
| 405 | 373 | CLK(NULL, "timer0", &timerp64_0_clk), |
| 406 | 374 | CLK("watchdog", NULL, &timerp64_1_clk), |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | #include <asm/mach/arch.h> |
| 29 | 29 | #include <linux/irq.h> |
| 30 | 30 | #include <plat/time.h> |
| 31 | +#include <plat/ehci-orion.h> | |
| 31 | 32 | #include <plat/common.h> |
| 32 | 33 | #include <plat/addr-map.h> |
| 33 | 34 | #include "common.h" |
| @@ -71,7 +72,7 @@ void __init dove_map_io(void) · 37 unmodified lines | ||
| 71 | 72 | ****************************************************************************/ |
| 72 | 73 | void __init dove_ehci0_init(void) |
| 73 | 74 | { |
| 74 | − orion_ehci_init(DOVE_USB0_PHYS_BASE, IRQ_DOVE_USB0); | |
| 75 | + orion_ehci_init(DOVE_USB0_PHYS_BASE, IRQ_DOVE_USB0, EHCI_PHY_NA); | |
| 75 | 76 | } |
| 76 | 77 | |
| 77 | 78 | /***************************************************************************** |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | ||
| 32 | 32 | #include <mach/hardware.h> |
| 33 | 33 | #include <mach/fb.h> |
| 34 | 34 | #include <mach/ep93xx_spi.h> |
| 35 | +#include <mach/gpio-ep93xx.h> | |
| 35 | 36 | |
| 36 | 37 | #include <asm/mach-types.h> |
| 37 | 38 | #include <asm/mach/map.h> |
| @@ -153,7 +154,6 @@ static struct i2c_board_info vision_i2c_info[] __initdata = { · 115 unmodified lines | ||
| 153 | 154 | }, { |
| 154 | 155 | I2C_BOARD_INFO("pca9539", 0x74), |
| 155 | 156 | .platform_data = &pca953x_74_gpio_data, |
| 156 | − .irq = gpio_to_irq(EP93XX_GPIO_LINE_F(7)), | |
| 157 | 157 | }, { |
| 158 | 158 | I2C_BOARD_INFO("pca9539", 0x75), |
| 159 | 159 | .platform_data = &pca953x_75_gpio_data, |
| @@ -348,6 +348,8 @@ static void __init vision_init_machine(void) · 188 unmodified lines | ||
| 348 | 348 | "pca9539:74")) |
| 349 | 349 | pr_warn("cannot request interrupt gpio for pca9539:74\n"); |
| 350 | 350 | |
| 351 | + vision_i2c_info[1].irq = gpio_to_irq(EP93XX_GPIO_LINE_F(7)); | |
| 352 | + | |
| 351 | 353 | ep93xx_register_i2c(&vision_i2c_gpio_data, vision_i2c_info, |
| 352 | 354 | ARRAY_SIZE(vision_i2c_info)); |
| 353 | 355 | ep93xx_register_spi(&vision_spi_master, vision_spi_board_info, |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | ||
| 32 | 32 | |
| 33 | 33 | #include "common.h" |
| 34 | 34 | |
| 35 | +#ifdef CONFIG_PM_SLEEP | |
| 35 | 36 | static struct sleep_save exynos4210_clock_save[] = { |
| 36 | 37 | SAVE_ITEM(S5P_CLKSRC_IMAGE), |
| 37 | 38 | SAVE_ITEM(S5P_CLKSRC_LCD1), |
| @@ -42,6 +43,7 @@ static struct sleep_save exynos4210_clock_save[] = { · 4 unmodified lines | ||
| 42 | 43 | SAVE_ITEM(S5P_CLKGATE_IP_LCD1), |
| 43 | 44 | SAVE_ITEM(S5P_CLKGATE_IP_PERIR_4210), |
| 44 | 45 | }; |
| 46 | +#endif | |
| 45 | 47 | |
| 46 | 48 | static struct clksrc_clk *sysclks[] = { |
| 47 | 49 | /* nothing here yet */ |
| @@ -32,12 +32,14 @@ · 31 unmodified lines | ||
| 32 | 32 | |
| 33 | 33 | #include "common.h" |
| 34 | 34 | |
| 35 | +#ifdef CONFIG_PM_SLEEP | |
| 35 | 36 | static struct sleep_save exynos4212_clock_save[] = { |
| 36 | 37 | SAVE_ITEM(S5P_CLKSRC_IMAGE), |
| 37 | 38 | SAVE_ITEM(S5P_CLKDIV_IMAGE), |
| 38 | 39 | SAVE_ITEM(S5P_CLKGATE_IP_IMAGE_4212), |
| 39 | 40 | SAVE_ITEM(S5P_CLKGATE_IP_PERIR_4212), |
| 40 | 41 | }; |
| 42 | +#endif | |
| 41 | 43 | |
| 42 | 44 | static struct clk *clk_src_mpll_user_list[] = { |
| 43 | 45 | [0] = &clk_fin_mpll, |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | |
| 31 | 31 | #include "common.h" |
| 32 | 32 | |
| 33 | +#ifdef CONFIG_PM_SLEEP | |
| 33 | 34 | static struct sleep_save exynos4_clock_save[] = { |
| 34 | 35 | SAVE_ITEM(S5P_CLKDIV_LEFTBUS), |
| 35 | 36 | SAVE_ITEM(S5P_CLKGATE_IP_LEFTBUS), |
| @@ -93,6 +94,7 @@ static struct sleep_save exynos4_clock_save[] = { · 57 unmodified lines | ||
| 93 | 94 | SAVE_ITEM(S5P_CLKGATE_SCLKCPU), |
| 94 | 95 | SAVE_ITEM(S5P_CLKGATE_IP_CPU), |
| 95 | 96 | }; |
| 97 | +#endif | |
| 96 | 98 | |
| 97 | 99 | struct clk clk_sclk_hdmi27m = { |
| 98 | 100 | .name = "sclk_hdmi27m", |
| @@ -15,11 +15,13 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/serial_core.h> |
| 16 | 16 | |
| 17 | 17 | #include <asm/mach/arch.h> |
| 18 | +#include <asm/hardware/gic.h> | |
| 18 | 19 | #include <mach/map.h> |
| 19 | 20 | |
| 20 | 21 | #include <plat/cpu.h> |
| 21 | 22 | #include <plat/regs-serial.h> |
| 22 | −#include <plat/exynos4.h> | |
| 23 | + | |
| 24 | +#include "common.h" | |
| 23 | 25 | |
| 24 | 26 | /* |
| 25 | 27 | * The following lookup table is used to override device names when devices |
| @@ -60,7 +62,7 @@ static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = { · 34 unmodified lines | ||
| 60 | 62 | |
| 61 | 63 | static void __init exynos4210_dt_map_io(void) |
| 62 | 64 | { |
| 63 | − s5p_init_io(NULL, 0, S5P_VA_CHIPID); | |
| 65 | + exynos_init_io(NULL, 0); | |
| 64 | 66 | s3c24xx_init_clocks(24000000); |
| 65 | 67 | } |
| 66 | 68 | |
| @@ -79,7 +81,9 @@ DT_MACHINE_START(EXYNOS4210_DT, "Samsung Exynos4 (Flattened Device Tree)") · 12 unmodified lines | ||
| 79 | 81 | /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ |
| 80 | 82 | .init_irq = exynos4_init_irq, |
| 81 | 83 | .map_io = exynos4210_dt_map_io, |
| 84 | + .handle_irq = gic_handle_irq, | |
| 82 | 85 | .init_machine = exynos4210_dt_machine_init, |
| 83 | 86 | .timer = &exynos4_timer, |
| 84 | 87 | .dt_compat = exynos4210_dt_compat, |
| 88 | + .restart = exynos4_restart, | |
| 85 | 89 | MACHINE_END |
| @@ -220,14 +220,14 @@ static struct s3c_fb_pd_win nuri_fb_win0 = { · 219 unmodified lines | ||
| 220 | 220 | .lower_margin = 1, |
| 221 | 221 | .hsync_len = 48, |
| 222 | 222 | .vsync_len = 3, |
| 223 | − .xres = 1280, | |
| 224 | − .yres = 800, | |
| 223 | + .xres = 1024, | |
| 224 | + .yres = 600, | |
| 225 | 225 | .refresh = 60, |
| 226 | 226 | }, |
| 227 | 227 | .max_bpp = 24, |
| 228 | 228 | .default_bpp = 16, |
| 229 | − .virtual_x = 1280, | |
| 230 | − .virtual_y = 800, | |
| 229 | + .virtual_x = 1024, | |
| 230 | + .virtual_y = 2 * 600, | |
| 231 | 231 | }; |
| 232 | 232 | |
| 233 | 233 | static struct s3c_fb_platdata nuri_fb_pdata __initdata = { |
| @@ -910,7 +910,7 @@ static struct s5p_fimc_isp_info universal_camera_sensors[] = { · 909 unmodified lines | ||
| 910 | 910 | .bus_type = FIMC_MIPI_CSI2, |
| 911 | 911 | .board_info = &m5mols_board_info, |
| 912 | 912 | .i2c_bus_num = 0, |
| 913 | − .clk_frequency = 21600000UL, | |
| 913 | + .clk_frequency = 24000000UL, | |
| 914 | 914 | .csi_data_align = 32, |
| 915 | 915 | }, |
| 916 | 916 | }; |
| @@ -206,7 +206,7 @@ static void exynos4_pm_prepare(void) · 205 unmodified lines | ||
| 206 | 206 | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | −static int exynos4_pm_add(struct device *dev) | |
| 209 | +static int exynos4_pm_add(struct device *dev, struct subsys_interface *sif) | |
| 210 | 210 | { |
| 211 | 211 | pm_cpu_prep = exynos4_pm_prepare; |
| 212 | 212 | pm_cpu_sleep = exynos4_cpu_suspend; |
| @@ -384,7 +384,9 @@ static void exynos4_pm_resume(void) · 171 unmodified lines | ||
| 384 | 384 | |
| 385 | 385 | exynos4_restore_pll(); |
| 386 | 386 | |
| 387 | +#ifdef CONFIG_SMP | |
| 387 | 388 | scu_enable(S5P_VA_SCU); |
| 389 | +#endif | |
| 388 | 390 | |
| 389 | 391 | #ifdef CONFIG_CACHE_L2X0 |
| 390 | 392 | s3c_pm_do_restore_core(exynos4_l2cc_save, ARRAY_SIZE(exynos4_l2cc_save)); |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <plat/cache-feroceon-l2.h> |
| 28 | 28 | #include <plat/mvsdio.h> |
| 29 | 29 | #include <plat/orion_nand.h> |
| 30 | +#include <plat/ehci-orion.h> | |
| 30 | 31 | #include <plat/common.h> |
| 31 | 32 | #include <plat/time.h> |
| 32 | 33 | #include <plat/addr-map.h> |
| @@ -73,7 +74,7 @@ unsigned int kirkwood_clk_ctrl = CGC_DUNIT | CGC_RESERVED; · 40 unmodified lines | ||
| 73 | 74 | void __init kirkwood_ehci_init(void) |
| 74 | 75 | { |
| 75 | 76 | kirkwood_clk_ctrl |= CGC_USB0; |
| 76 | − orion_ehci_init(USB_PHYS_BASE, IRQ_KIRKWOOD_USB); | |
| 77 | + orion_ehci_init(USB_PHYS_BASE, IRQ_KIRKWOOD_USB, EHCI_PHY_NA); | |
| 77 | 78 | } |
| 78 | 79 | |
| 79 | 80 | |
| @@ -31,314 +31,314 @@ · 30 unmodified lines | ||
| 31 | 31 | #define MPP_F6282_MASK MPP( 0, 0x0, 0, 0, 0, 0, 0, 0, 1 ) |
| 32 | 32 | |
| 33 | 33 | #define MPP0_GPIO MPP( 0, 0x0, 1, 1, 1, 1, 1, 1, 1 ) |
| 34 | −#define MPP0_NF_IO2 MPP( 0, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 35 | −#define MPP0_SPI_SCn MPP( 0, 0x2, 0, 1, 1, 1, 1, 1, 1 ) | |
| 34 | +#define MPP0_NF_IO2 MPP( 0, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 35 | +#define MPP0_SPI_SCn MPP( 0, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 36 | 36 | |
| 37 | 37 | #define MPP1_GPO MPP( 1, 0x0, 0, 1, 1, 1, 1, 1, 1 ) |
| 38 | −#define MPP1_NF_IO3 MPP( 1, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 39 | −#define MPP1_SPI_MOSI MPP( 1, 0x2, 0, 1, 1, 1, 1, 1, 1 ) | |
| 38 | +#define MPP1_NF_IO3 MPP( 1, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 39 | +#define MPP1_SPI_MOSI MPP( 1, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 40 | 40 | |
| 41 | 41 | #define MPP2_GPO MPP( 2, 0x0, 0, 1, 1, 1, 1, 1, 1 ) |
| 42 | −#define MPP2_NF_IO4 MPP( 2, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 43 | −#define MPP2_SPI_SCK MPP( 2, 0x2, 0, 1, 1, 1, 1, 1, 1 ) | |
| 42 | +#define MPP2_NF_IO4 MPP( 2, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 43 | +#define MPP2_SPI_SCK MPP( 2, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 44 | 44 | |
| 45 | 45 | #define MPP3_GPO MPP( 3, 0x0, 0, 1, 1, 1, 1, 1, 1 ) |
| 46 | −#define MPP3_NF_IO5 MPP( 3, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 47 | −#define MPP3_SPI_MISO MPP( 3, 0x2, 1, 0, 1, 1, 1, 1, 1 ) | |
| 46 | +#define MPP3_NF_IO5 MPP( 3, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 47 | +#define MPP3_SPI_MISO MPP( 3, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 48 | 48 | |
| 49 | 49 | #define MPP4_GPIO MPP( 4, 0x0, 1, 1, 1, 1, 1, 1, 1 ) |
| 50 | −#define MPP4_NF_IO6 MPP( 4, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 51 | −#define MPP4_UART0_RXD MPP( 4, 0x2, 1, 0, 1, 1, 1, 1, 1 ) | |
| 52 | −#define MPP4_SATA1_ACTn MPP( 4, 0x5, 0, 1, 0, 0, 1, 1, 1 ) | |
| 50 | +#define MPP4_NF_IO6 MPP( 4, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 51 | +#define MPP4_UART0_RXD MPP( 4, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 52 | +#define MPP4_SATA1_ACTn MPP( 4, 0x5, 0, 0, 0, 0, 1, 1, 1 ) | |
| 53 | 53 | #define MPP4_LCD_VGA_HSYNC MPP( 4, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 54 | −#define MPP4_PTP_CLK MPP( 4, 0xd, 1, 0, 1, 1, 1, 1, 0 ) | |
| 54 | +#define MPP4_PTP_CLK MPP( 4, 0xd, 0, 0, 1, 1, 1, 1, 0 ) | |
| 55 | 55 | |
| 56 | 56 | #define MPP5_GPO MPP( 5, 0x0, 0, 1, 1, 1, 1, 1, 1 ) |
| 57 | −#define MPP5_NF_IO7 MPP( 5, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 58 | −#define MPP5_UART0_TXD MPP( 5, 0x2, 0, 1, 1, 1, 1, 1, 1 ) | |
| 59 | −#define MPP5_PTP_TRIG_GEN MPP( 5, 0x4, 0, 1, 1, 1, 1, 1, 0 ) | |
| 60 | −#define MPP5_SATA0_ACTn MPP( 5, 0x5, 0, 1, 0, 1, 1, 1, 1 ) | |
| 57 | +#define MPP5_NF_IO7 MPP( 5, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 58 | +#define MPP5_UART0_TXD MPP( 5, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 59 | +#define MPP5_PTP_TRIG_GEN MPP( 5, 0x4, 0, 0, 1, 1, 1, 1, 0 ) | |
| 60 | +#define MPP5_SATA0_ACTn MPP( 5, 0x5, 0, 0, 0, 1, 1, 1, 1 ) | |
| 61 | 61 | #define MPP5_LCD_VGA_VSYNC MPP( 5, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 62 | 62 | |
| 63 | −#define MPP6_SYSRST_OUTn MPP( 6, 0x1, 0, 1, 1, 1, 1, 1, 1 ) | |
| 64 | −#define MPP6_SPI_MOSI MPP( 6, 0x2, 0, 1, 1, 1, 1, 1, 1 ) | |
| 65 | −#define MPP6_PTP_TRIG_GEN MPP( 6, 0x3, 0, 1, 1, 1, 1, 1, 0 ) | |
| 63 | +#define MPP6_SYSRST_OUTn MPP( 6, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 64 | +#define MPP6_SPI_MOSI MPP( 6, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 65 | +#define MPP6_PTP_TRIG_GEN MPP( 6, 0x3, 0, 0, 1, 1, 1, 1, 0 ) | |
| 66 | 66 | |
| 67 | 67 | #define MPP7_GPO MPP( 7, 0x0, 0, 1, 1, 1, 1, 1, 1 ) |
| 68 | −#define MPP7_PEX_RST_OUTn MPP( 7, 0x1, 0, 1, 1, 1, 1, 1, 0 ) | |
| 69 | −#define MPP7_SPI_SCn MPP( 7, 0x2, 0, 1, 1, 1, 1, 1, 1 ) | |
| 70 | −#define MPP7_PTP_TRIG_GEN MPP( 7, 0x3, 0, 1, 1, 1, 1, 1, 0 ) | |
| 71 | −#define MPP7_LCD_PWM MPP( 7, 0xb, 0, 1, 0, 0, 0, 0, 1 ) | |
| 68 | +#define MPP7_PEX_RST_OUTn MPP( 7, 0x1, 0, 0, 1, 1, 1, 1, 0 ) | |
| 69 | +#define MPP7_SPI_SCn MPP( 7, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 70 | +#define MPP7_PTP_TRIG_GEN MPP( 7, 0x3, 0, 0, 1, 1, 1, 1, 0 ) | |
| 71 | +#define MPP7_LCD_PWM MPP( 7, 0xb, 0, 0, 0, 0, 0, 0, 1 ) | |
| 72 | 72 | |
| 73 | 73 | #define MPP8_GPIO MPP( 8, 0x0, 1, 1, 1, 1, 1, 1, 1 ) |
| 74 | −#define MPP8_TW0_SDA MPP( 8, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 75 | −#define MPP8_UART0_RTS MPP( 8, 0x2, 0, 1, 1, 1, 1, 1, 1 ) | |
| 76 | −#define MPP8_UART1_RTS MPP( 8, 0x3, 0, 1, 1, 1, 1, 1, 1 ) | |
| 77 | −#define MPP8_MII0_RXERR MPP( 8, 0x4, 1, 0, 0, 1, 1, 1, 1 ) | |
| 78 | −#define MPP8_SATA1_PRESENTn MPP( 8, 0x5, 0, 1, 0, 0, 1, 1, 1 ) | |
| 79 | −#define MPP8_PTP_CLK MPP( 8, 0xc, 1, 0, 1, 1, 1, 1, 0 ) | |
| 80 | −#define MPP8_MII0_COL MPP( 8, 0xd, 1, 0, 1, 1, 1, 1, 1 ) | |
| 74 | +#define MPP8_TW0_SDA MPP( 8, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 75 | +#define MPP8_UART0_RTS MPP( 8, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 76 | +#define MPP8_UART1_RTS MPP( 8, 0x3, 0, 0, 1, 1, 1, 1, 1 ) | |
| 77 | +#define MPP8_MII0_RXERR MPP( 8, 0x4, 0, 0, 0, 1, 1, 1, 1 ) | |
| 78 | +#define MPP8_SATA1_PRESENTn MPP( 8, 0x5, 0, 0, 0, 0, 1, 1, 1 ) | |
| 79 | +#define MPP8_PTP_CLK MPP( 8, 0xc, 0, 0, 1, 1, 1, 1, 0 ) | |
| 80 | +#define MPP8_MII0_COL MPP( 8, 0xd, 0, 0, 1, 1, 1, 1, 1 ) | |
| 81 | 81 | |
| 82 | 82 | #define MPP9_GPIO MPP( 9, 0x0, 1, 1, 1, 1, 1, 1, 1 ) |
| 83 | −#define MPP9_TW0_SCK MPP( 9, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 84 | −#define MPP9_UART0_CTS MPP( 9, 0x2, 1, 0, 1, 1, 1, 1, 1 ) | |
| 85 | −#define MPP9_UART1_CTS MPP( 9, 0x3, 1, 0, 1, 1, 1, 1, 1 ) | |
| 86 | −#define MPP9_SATA0_PRESENTn MPP( 9, 0x5, 0, 1, 0, 1, 1, 1, 1 ) | |
| 87 | −#define MPP9_PTP_EVENT_REQ MPP( 9, 0xc, 1, 0, 1, 1, 1, 1, 0 ) | |
| 88 | −#define MPP9_MII0_CRS MPP( 9, 0xd, 1, 0, 1, 1, 1, 1, 1 ) | |
| 83 | +#define MPP9_TW0_SCK MPP( 9, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 84 | +#define MPP9_UART0_CTS MPP( 9, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 85 | +#define MPP9_UART1_CTS MPP( 9, 0x3, 0, 0, 1, 1, 1, 1, 1 ) | |
| 86 | +#define MPP9_SATA0_PRESENTn MPP( 9, 0x5, 0, 0, 0, 1, 1, 1, 1 ) | |
| 87 | +#define MPP9_PTP_EVENT_REQ MPP( 9, 0xc, 0, 0, 1, 1, 1, 1, 0 ) | |
| 88 | +#define MPP9_MII0_CRS MPP( 9, 0xd, 0, 0, 1, 1, 1, 1, 1 ) | |
| 89 | 89 | |
| 90 | 90 | #define MPP10_GPO MPP( 10, 0x0, 0, 1, 1, 1, 1, 1, 1 ) |
| 91 | −#define MPP10_SPI_SCK MPP( 10, 0x2, 0, 1, 1, 1, 1, 1, 1 ) | |
| 92 | −#define MPP10_UART0_TXD MPP( 10, 0X3, 0, 1, 1, 1, 1, 1, 1 ) | |
| 93 | −#define MPP10_SATA1_ACTn MPP( 10, 0x5, 0, 1, 0, 0, 1, 1, 1 ) | |
| 94 | −#define MPP10_PTP_TRIG_GEN MPP( 10, 0xc, 0, 1, 1, 1, 1, 1, 0 ) | |
| 91 | +#define MPP10_SPI_SCK MPP( 10, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 92 | +#define MPP10_UART0_TXD MPP( 10, 0X3, 0, 0, 1, 1, 1, 1, 1 ) | |
| 93 | +#define MPP10_SATA1_ACTn MPP( 10, 0x5, 0, 0, 0, 0, 1, 1, 1 ) | |
| 94 | +#define MPP10_PTP_TRIG_GEN MPP( 10, 0xc, 0, 0, 1, 1, 1, 1, 0 ) | |
| 95 | 95 | |
| 96 | 96 | #define MPP11_GPIO MPP( 11, 0x0, 1, 1, 1, 1, 1, 1, 1 ) |
| 97 | −#define MPP11_SPI_MISO MPP( 11, 0x2, 1, 0, 1, 1, 1, 1, 1 ) | |
| 98 | −#define MPP11_UART0_RXD MPP( 11, 0x3, 1, 0, 1, 1, 1, 1, 1 ) | |
| 99 | −#define MPP11_PTP_EVENT_REQ MPP( 11, 0x4, 1, 0, 1, 1, 1, 1, 0 ) | |
| 100 | −#define MPP11_PTP_TRIG_GEN MPP( 11, 0xc, 0, 1, 1, 1, 1, 1, 0 ) | |
| 101 | −#define MPP11_PTP_CLK MPP( 11, 0xd, 1, 0, 1, 1, 1, 1, 0 ) | |
| 102 | −#define MPP11_SATA0_ACTn MPP( 11, 0x5, 0, 1, 0, 1, 1, 1, 1 ) | |
| 97 | +#define MPP11_SPI_MISO MPP( 11, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 98 | +#define MPP11_UART0_RXD MPP( 11, 0x3, 0, 0, 1, 1, 1, 1, 1 ) | |
| 99 | +#define MPP11_PTP_EVENT_REQ MPP( 11, 0x4, 0, 0, 1, 1, 1, 1, 0 ) | |
| 100 | +#define MPP11_PTP_TRIG_GEN MPP( 11, 0xc, 0, 0, 1, 1, 1, 1, 0 ) | |
| 101 | +#define MPP11_PTP_CLK MPP( 11, 0xd, 0, 0, 1, 1, 1, 1, 0 ) | |
| 102 | +#define MPP11_SATA0_ACTn MPP( 11, 0x5, 0, 0, 0, 1, 1, 1, 1 ) | |
| 103 | 103 | |
| 104 | 104 | #define MPP12_GPO MPP( 12, 0x0, 0, 1, 1, 1, 1, 1, 1 ) |
| 105 | 105 | #define MPP12_GPIO MPP( 12, 0x0, 1, 1, 0, 0, 0, 1, 0 ) |
| 106 | −#define MPP12_SD_CLK MPP( 12, 0x1, 0, 1, 1, 1, 1, 1, 1 ) | |
| 107 | −#define MPP12_AU_SPDIF0 MPP( 12, 0xa, 0, 1, 0, 0, 0, 0, 1 ) | |
| 108 | −#define MPP12_SPI_MOSI MPP( 12, 0xb, 0, 1, 0, 0, 0, 0, 1 ) | |
| 109 | −#define MPP12_TW1_SDA MPP( 12, 0xd, 1, 0, 0, 0, 0, 0, 1 ) | |
| 106 | +#define MPP12_SD_CLK MPP( 12, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 107 | +#define MPP12_AU_SPDIF0 MPP( 12, 0xa, 0, 0, 0, 0, 0, 0, 1 ) | |
| 108 | +#define MPP12_SPI_MOSI MPP( 12, 0xb, 0, 0, 0, 0, 0, 0, 1 ) | |
| 109 | +#define MPP12_TW1_SDA MPP( 12, 0xd, 0, 0, 0, 0, 0, 0, 1 ) | |
| 110 | 110 | |
| 111 | 111 | #define MPP13_GPIO MPP( 13, 0x0, 1, 1, 1, 1, 1, 1, 1 ) |
| 112 | −#define MPP13_SD_CMD MPP( 13, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 113 | −#define MPP13_UART1_TXD MPP( 13, 0x3, 0, 1, 1, 1, 1, 1, 1 ) | |
| 114 | −#define MPP13_AU_SPDIFRMCLK MPP( 13, 0xa, 0, 1, 0, 0, 0, 0, 1 ) | |
| 115 | −#define MPP13_LCDPWM MPP( 13, 0xb, 0, 1, 0, 0, 0, 0, 1 ) | |
| 112 | +#define MPP13_SD_CMD MPP( 13, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 113 | +#define MPP13_UART1_TXD MPP( 13, 0x3, 0, 0, 1, 1, 1, 1, 1 ) | |
| 114 | +#define MPP13_AU_SPDIFRMCLK MPP( 13, 0xa, 0, 0, 0, 0, 0, 0, 1 ) | |
| 115 | +#define MPP13_LCDPWM MPP( 13, 0xb, 0, 0, 0, 0, 0, 0, 1 ) | |
| 116 | 116 | |
| 117 | 117 | #define MPP14_GPIO MPP( 14, 0x0, 1, 1, 1, 1, 1, 1, 1 ) |
| 118 | −#define MPP14_SD_D0 MPP( 14, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 119 | −#define MPP14_UART1_RXD MPP( 14, 0x3, 1, 0, 1, 1, 1, 1, 1 ) | |
| 120 | −#define MPP14_SATA1_PRESENTn MPP( 14, 0x4, 0, 1, 0, 0, 1, 1, 1 ) | |
| 121 | −#define MPP14_AU_SPDIFI MPP( 14, 0xa, 1, 0, 0, 0, 0, 0, 1 ) | |
| 122 | −#define MPP14_AU_I2SDI MPP( 14, 0xb, 1, 0, 0, 0, 0, 0, 1 ) | |
| 123 | −#define MPP14_MII0_COL MPP( 14, 0xd, 1, 0, 1, 1, 1, 1, 1 ) | |
| 118 | +#define MPP14_SD_D0 MPP( 14, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 119 | +#define MPP14_UART1_RXD MPP( 14, 0x3, 0, 0, 1, 1, 1, 1, 1 ) | |
| 120 | +#define MPP14_SATA1_PRESENTn MPP( 14, 0x4, 0, 0, 0, 0, 1, 1, 1 ) | |
| 121 | +#define MPP14_AU_SPDIFI MPP( 14, 0xa, 0, 0, 0, 0, 0, 0, 1 ) | |
| 122 | +#define MPP14_AU_I2SDI MPP( 14, 0xb, 0, 0, 0, 0, 0, 0, 1 ) | |
| 123 | +#define MPP14_MII0_COL MPP( 14, 0xd, 0, 0, 1, 1, 1, 1, 1 ) | |
| 124 | 124 | |
| 125 | 125 | #define MPP15_GPIO MPP( 15, 0x0, 1, 1, 1, 1, 1, 1, 1 ) |
| 126 | −#define MPP15_SD_D1 MPP( 15, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 127 | −#define MPP15_UART0_RTS MPP( 15, 0x2, 0, 1, 1, 1, 1, 1, 1 ) | |
| 128 | −#define MPP15_UART1_TXD MPP( 15, 0x3, 0, 1, 1, 1, 1, 1, 1 ) | |
| 129 | −#define MPP15_SATA0_ACTn MPP( 15, 0x4, 0, 1, 0, 1, 1, 1, 1 ) | |
| 130 | −#define MPP15_SPI_CSn MPP( 15, 0xb, 0, 1, 0, 0, 0, 0, 1 ) | |
| 126 | +#define MPP15_SD_D1 MPP( 15, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 127 | +#define MPP15_UART0_RTS MPP( 15, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 128 | +#define MPP15_UART1_TXD MPP( 15, 0x3, 0, 0, 1, 1, 1, 1, 1 ) | |
| 129 | +#define MPP15_SATA0_ACTn MPP( 15, 0x4, 0, 0, 0, 1, 1, 1, 1 ) | |
| 130 | +#define MPP15_SPI_CSn MPP( 15, 0xb, 0, 0, 0, 0, 0, 0, 1 ) | |
| 131 | 131 | |
| 132 | 132 | #define MPP16_GPIO MPP( 16, 0x0, 1, 1, 1, 1, 1, 1, 1 ) |
| 133 | −#define MPP16_SD_D2 MPP( 16, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 134 | −#define MPP16_UART0_CTS MPP( 16, 0x2, 1, 0, 1, 1, 1, 1, 1 ) | |
| 135 | −#define MPP16_UART1_RXD MPP( 16, 0x3, 1, 0, 1, 1, 1, 1, 1 ) | |
| 136 | −#define MPP16_SATA1_ACTn MPP( 16, 0x4, 0, 1, 0, 0, 1, 1, 1 ) | |
| 137 | −#define MPP16_LCD_EXT_REF_CLK MPP( 16, 0xb, 1, 0, 0, 0, 0, 0, 1 ) | |
| 138 | −#define MPP16_MII0_CRS MPP( 16, 0xd, 1, 0, 1, 1, 1, 1, 1 ) | |
| 133 | +#define MPP16_SD_D2 MPP( 16, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 134 | +#define MPP16_UART0_CTS MPP( 16, 0x2, 0, 0, 1, 1, 1, 1, 1 ) | |
| 135 | +#define MPP16_UART1_RXD MPP( 16, 0x3, 0, 0, 1, 1, 1, 1, 1 ) | |
| 136 | +#define MPP16_SATA1_ACTn MPP( 16, 0x4, 0, 0, 0, 0, 1, 1, 1 ) | |
| 137 | +#define MPP16_LCD_EXT_REF_CLK MPP( 16, 0xb, 0, 0, 0, 0, 0, 0, 1 ) | |
| 138 | +#define MPP16_MII0_CRS MPP( 16, 0xd, 0, 0, 1, 1, 1, 1, 1 ) | |
| 139 | 139 | |
| 140 | 140 | #define MPP17_GPIO MPP( 17, 0x0, 1, 1, 1, 1, 1, 1, 1 ) |
| 141 | −#define MPP17_SD_D3 MPP( 17, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 142 | −#define MPP17_SATA0_PRESENTn MPP( 17, 0x4, 0, 1, 0, 1, 1, 1, 1 ) | |
| 143 | −#define MPP17_SATA1_ACTn MPP( 17, 0xa, 0, 1, 0, 0, 0, 0, 1 ) | |
| 144 | −#define MPP17_TW1_SCK MPP( 17, 0xd, 1, 1, 0, 0, 0, 0, 1 ) | |
| 141 | +#define MPP17_SD_D3 MPP( 17, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 142 | +#define MPP17_SATA0_PRESENTn MPP( 17, 0x4, 0, 0, 0, 1, 1, 1, 1 ) | |
| 143 | +#define MPP17_SATA1_ACTn MPP( 17, 0xa, 0, 0, 0, 0, 0, 0, 1 ) | |
| 144 | +#define MPP17_TW1_SCK MPP( 17, 0xd, 0, 0, 0, 0, 0, 0, 1 ) | |
| 145 | 145 | |
| 146 | 146 | #define MPP18_GPO MPP( 18, 0x0, 0, 1, 1, 1, 1, 1, 1 ) |
| 147 | −#define MPP18_NF_IO0 MPP( 18, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 148 | −#define MPP18_PEX0_CLKREQ MPP( 18, 0x2, 0, 1, 0, 0, 0, 0, 1 ) | |
| 147 | +#define MPP18_NF_IO0 MPP( 18, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 148 | +#define MPP18_PEX0_CLKREQ MPP( 18, 0x2, 0, 0, 0, 0, 0, 0, 1 ) | |
| 149 | 149 | |
| 150 | 150 | #define MPP19_GPO MPP( 19, 0x0, 0, 1, 1, 1, 1, 1, 1 ) |
| 151 | −#define MPP19_NF_IO1 MPP( 19, 0x1, 1, 1, 1, 1, 1, 1, 1 ) | |
| 151 | +#define MPP19_NF_IO1 MPP( 19, 0x1, 0, 0, 1, 1, 1, 1, 1 ) | |
| 152 | 152 | |
| 153 | 153 | #define MPP20_GPIO MPP( 20, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 154 | −#define MPP20_TSMP0 MPP( 20, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 155 | −#define MPP20_TDM_CH0_TX_QL MPP( 20, 0x2, 0, 1, 0, 0, 1, 1, 1 ) | |
| 154 | +#define MPP20_TSMP0 MPP( 20, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 155 | +#define MPP20_TDM_CH0_TX_QL MPP( 20, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 156 | 156 | #define MPP20_GE1_TXD0 MPP( 20, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 157 | −#define MPP20_AU_SPDIFI MPP( 20, 0x4, 1, 0, 0, 0, 1, 1, 1 ) | |
| 158 | −#define MPP20_SATA1_ACTn MPP( 20, 0x5, 0, 1, 0, 0, 1, 1, 1 ) | |
| 157 | +#define MPP20_AU_SPDIFI MPP( 20, 0x4, 0, 0, 0, 0, 1, 1, 1 ) | |
| 158 | +#define MPP20_SATA1_ACTn MPP( 20, 0x5, 0, 0, 0, 0, 1, 1, 1 ) | |
| 159 | 159 | #define MPP20_LCD_D0 MPP( 20, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 160 | 160 | |
| 161 | 161 | #define MPP21_GPIO MPP( 21, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 162 | −#define MPP21_TSMP1 MPP( 21, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 163 | −#define MPP21_TDM_CH0_RX_QL MPP( 21, 0x2, 0, 1, 0, 0, 1, 1, 1 ) | |
| 162 | +#define MPP21_TSMP1 MPP( 21, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 163 | +#define MPP21_TDM_CH0_RX_QL MPP( 21, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 164 | 164 | #define MPP21_GE1_TXD1 MPP( 21, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 165 | −#define MPP21_AU_SPDIFO MPP( 21, 0x4, 0, 1, 0, 0, 1, 1, 1 ) | |
| 166 | −#define MPP21_SATA0_ACTn MPP( 21, 0x5, 0, 1, 0, 1, 1, 1, 1 ) | |
| 165 | +#define MPP21_AU_SPDIFO MPP( 21, 0x4, 0, 0, 0, 0, 1, 1, 1 ) | |
| 166 | +#define MPP21_SATA0_ACTn MPP( 21, 0x5, 0, 0, 0, 1, 1, 1, 1 ) | |
| 167 | 167 | #define MPP21_LCD_D1 MPP( 21, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 168 | 168 | |
| 169 | 169 | #define MPP22_GPIO MPP( 22, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 170 | −#define MPP22_TSMP2 MPP( 22, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 171 | −#define MPP22_TDM_CH2_TX_QL MPP( 22, 0x2, 0, 1, 0, 0, 1, 1, 1 ) | |
| 170 | +#define MPP22_TSMP2 MPP( 22, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 171 | +#define MPP22_TDM_CH2_TX_QL MPP( 22, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 172 | 172 | #define MPP22_GE1_TXD2 MPP( 22, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 173 | −#define MPP22_AU_SPDIFRMKCLK MPP( 22, 0x4, 0, 1, 0, 0, 1, 1, 1 ) | |
| 174 | −#define MPP22_SATA1_PRESENTn MPP( 22, 0x5, 0, 1, 0, 0, 1, 1, 1 ) | |
| 173 | +#define MPP22_AU_SPDIFRMKCLK MPP( 22, 0x4, 0, 0, 0, 0, 1, 1, 1 ) | |
| 174 | +#define MPP22_SATA1_PRESENTn MPP( 22, 0x5, 0, 0, 0, 0, 1, 1, 1 ) | |
| 175 | 175 | #define MPP22_LCD_D2 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 176 | 176 | |
| 177 | 177 | #define MPP23_GPIO MPP( 23, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 178 | −#define MPP23_TSMP3 MPP( 23, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 179 | −#define MPP23_TDM_CH2_RX_QL MPP( 23, 0x2, 1, 0, 0, 0, 1, 1, 1 ) | |
| 178 | +#define MPP23_TSMP3 MPP( 23, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 179 | +#define MPP23_TDM_CH2_RX_QL MPP( 23, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 180 | 180 | #define MPP23_GE1_TXD3 MPP( 23, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 181 | −#define MPP23_AU_I2SBCLK MPP( 23, 0x4, 0, 1, 0, 0, 1, 1, 1 ) | |
| 182 | −#define MPP23_SATA0_PRESENTn MPP( 23, 0x5, 0, 1, 0, 1, 1, 1, 1 ) | |
| 181 | +#define MPP23_AU_I2SBCLK MPP( 23, 0x4, 0, 0, 0, 0, 1, 1, 1 ) | |
| 182 | +#define MPP23_SATA0_PRESENTn MPP( 23, 0x5, 0, 0, 0, 1, 1, 1, 1 ) | |
| 183 | 183 | #define MPP23_LCD_D3 MPP( 23, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 184 | 184 | |
| 185 | 185 | #define MPP24_GPIO MPP( 24, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 186 | −#define MPP24_TSMP4 MPP( 24, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 187 | −#define MPP24_TDM_SPI_CS0 MPP( 24, 0x2, 0, 1, 0, 0, 1, 1, 1 ) | |
| 186 | +#define MPP24_TSMP4 MPP( 24, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 187 | +#define MPP24_TDM_SPI_CS0 MPP( 24, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 188 | 188 | #define MPP24_GE1_RXD0 MPP( 24, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 189 | −#define MPP24_AU_I2SDO MPP( 24, 0x4, 0, 1, 0, 0, 1, 1, 1 ) | |
| 189 | +#define MPP24_AU_I2SDO MPP( 24, 0x4, 0, 0, 0, 0, 1, 1, 1 ) | |
| 190 | 190 | #define MPP24_LCD_D4 MPP( 24, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 191 | 191 | |
| 192 | 192 | #define MPP25_GPIO MPP( 25, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 193 | −#define MPP25_TSMP5 MPP( 25, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 194 | −#define MPP25_TDM_SPI_SCK MPP( 25, 0x2, 0, 1, 0, 0, 1, 1, 1 ) | |
| 193 | +#define MPP25_TSMP5 MPP( 25, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 194 | +#define MPP25_TDM_SPI_SCK MPP( 25, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 195 | 195 | #define MPP25_GE1_RXD1 MPP( 25, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 196 | −#define MPP25_AU_I2SLRCLK MPP( 25, 0x4, 0, 1, 0, 0, 1, 1, 1 ) | |
| 196 | +#define MPP25_AU_I2SLRCLK MPP( 25, 0x4, 0, 0, 0, 0, 1, 1, 1 ) | |
| 197 | 197 | #define MPP25_LCD_D5 MPP( 25, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 198 | 198 | |
| 199 | 199 | #define MPP26_GPIO MPP( 26, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 200 | −#define MPP26_TSMP6 MPP( 26, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 201 | −#define MPP26_TDM_SPI_MISO MPP( 26, 0x2, 1, 0, 0, 0, 1, 1, 1 ) | |
| 200 | +#define MPP26_TSMP6 MPP( 26, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 201 | +#define MPP26_TDM_SPI_MISO MPP( 26, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 202 | 202 | #define MPP26_GE1_RXD2 MPP( 26, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 203 | −#define MPP26_AU_I2SMCLK MPP( 26, 0x4, 0, 1, 0, 0, 1, 1, 1 ) | |
| 203 | +#define MPP26_AU_I2SMCLK MPP( 26, 0x4, 0, 0, 0, 0, 1, 1, 1 ) | |
| 204 | 204 | #define MPP26_LCD_D6 MPP( 26, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 205 | 205 | |
| 206 | 206 | #define MPP27_GPIO MPP( 27, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 207 | −#define MPP27_TSMP7 MPP( 27, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 208 | −#define MPP27_TDM_SPI_MOSI MPP( 27, 0x2, 0, 1, 0, 0, 1, 1, 1 ) | |
| 207 | +#define MPP27_TSMP7 MPP( 27, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 208 | +#define MPP27_TDM_SPI_MOSI MPP( 27, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 209 | 209 | #define MPP27_GE1_RXD3 MPP( 27, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 210 | −#define MPP27_AU_I2SDI MPP( 27, 0x4, 1, 0, 0, 0, 1, 1, 1 ) | |
| 210 | +#define MPP27_AU_I2SDI MPP( 27, 0x4, 0, 0, 0, 0, 1, 1, 1 ) | |
| 211 | 211 | #define MPP27_LCD_D7 MPP( 27, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 212 | 212 | |
| 213 | 213 | #define MPP28_GPIO MPP( 28, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 214 | −#define MPP28_TSMP8 MPP( 28, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 214 | +#define MPP28_TSMP8 MPP( 28, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 215 | 215 | #define MPP28_TDM_CODEC_INTn MPP( 28, 0x2, 0, 0, 0, 0, 1, 1, 1 ) |
| 216 | 216 | #define MPP28_GE1_COL MPP( 28, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 217 | −#define MPP28_AU_EXTCLK MPP( 28, 0x4, 1, 0, 0, 0, 1, 1, 1 ) | |
| 217 | +#define MPP28_AU_EXTCLK MPP( 28, 0x4, 0, 0, 0, 0, 1, 1, 1 ) | |
| 218 | 218 | #define MPP28_LCD_D8 MPP( 28, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 219 | 219 | |
| 220 | 220 | #define MPP29_GPIO MPP( 29, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 221 | −#define MPP29_TSMP9 MPP( 29, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 221 | +#define MPP29_TSMP9 MPP( 29, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 222 | 222 | #define MPP29_TDM_CODEC_RSTn MPP( 29, 0x2, 0, 0, 0, 0, 1, 1, 1 ) |
| 223 | 223 | #define MPP29_GE1_TCLK MPP( 29, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 224 | 224 | #define MPP29_LCD_D9 MPP( 29, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 225 | 225 | |
| 226 | 226 | #define MPP30_GPIO MPP( 30, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 227 | −#define MPP30_TSMP10 MPP( 30, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 228 | −#define MPP30_TDM_PCLK MPP( 30, 0x2, 1, 1, 0, 0, 1, 1, 1 ) | |
| 227 | +#define MPP30_TSMP10 MPP( 30, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 228 | +#define MPP30_TDM_PCLK MPP( 30, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 229 | 229 | #define MPP30_GE1_RXCTL MPP( 30, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 230 | 230 | #define MPP30_LCD_D10 MPP( 30, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 231 | 231 | |
| 232 | 232 | #define MPP31_GPIO MPP( 31, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 233 | −#define MPP31_TSMP11 MPP( 31, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 234 | −#define MPP31_TDM_FS MPP( 31, 0x2, 1, 1, 0, 0, 1, 1, 1 ) | |
| 233 | +#define MPP31_TSMP11 MPP( 31, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 234 | +#define MPP31_TDM_FS MPP( 31, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 235 | 235 | #define MPP31_GE1_RXCLK MPP( 31, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 236 | 236 | #define MPP31_LCD_D11 MPP( 31, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 237 | 237 | |
| 238 | 238 | #define MPP32_GPIO MPP( 32, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 239 | −#define MPP32_TSMP12 MPP( 32, 0x1, 1, 1, 0, 0, 1, 1, 1 ) | |
| 240 | −#define MPP32_TDM_DRX MPP( 32, 0x2, 1, 0, 0, 0, 1, 1, 1 ) | |
| 239 | +#define MPP32_TSMP12 MPP( 32, 0x1, 0, 0, 0, 0, 1, 1, 1 ) | |
| 240 | +#define MPP32_TDM_DRX MPP( 32, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 241 | 241 | #define MPP32_GE1_TCLKOUT MPP( 32, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 242 | 242 | #define MPP32_LCD_D12 MPP( 32, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 243 | 243 | |
| 244 | 244 | #define MPP33_GPO MPP( 33, 0x0, 0, 1, 0, 1, 1, 1, 1 ) |
| 245 | −#define MPP33_TDM_DTX MPP( 33, 0x2, 0, 1, 0, 0, 1, 1, 1 ) | |
| 245 | +#define MPP33_TDM_DTX MPP( 33, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 246 | 246 | #define MPP33_GE1_TXCTL MPP( 33, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 247 | 247 | #define MPP33_LCD_D13 MPP( 33, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 248 | 248 | |
| 249 | 249 | #define MPP34_GPIO MPP( 34, 0x0, 1, 1, 0, 1, 1, 1, 1 ) |
| 250 | −#define MPP34_TDM_SPI_CS1 MPP( 34, 0x2, 0, 1, 0, 0, 1, 1, 1 ) | |
| 250 | +#define MPP34_TDM_SPI_CS1 MPP( 34, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 251 | 251 | #define MPP34_GE1_TXEN MPP( 34, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 252 | −#define MPP34_SATA1_ACTn MPP( 34, 0x5, 0, 1, 0, 0, 0, 1, 1 ) | |
| 252 | +#define MPP34_SATA1_ACTn MPP( 34, 0x5, 0, 0, 0, 0, 0, 1, 1 ) | |
| 253 | 253 | #define MPP34_LCD_D14 MPP( 34, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 254 | 254 | |
| 255 | 255 | #define MPP35_GPIO MPP( 35, 0x0, 1, 1, 1, 1, 1, 1, 1 ) |
| 256 | −#define MPP35_TDM_CH0_TX_QL MPP( 35, 0x2, 0, 1, 0, 0, 1, 1, 1 ) | |
| 256 | +#define MPP35_TDM_CH0_TX_QL MPP( 35, 0x2, 0, 0, 0, 0, 1, 1, 1 ) | |
| 257 | 257 | #define MPP35_GE1_RXERR MPP( 35, 0x3, 0, 0, 0, 1, 1, 1, 1 ) |
| 258 | −#define MPP35_SATA0_ACTn MPP( 35, 0x5, 0, 1, 0, 1, 1, 1, 1 ) | |
| 258 | +#define MPP35_SATA0_ACTn MPP( 35, 0x5, 0, 0, 0, 1, 1, 1, 1 ) | |
| 259 | 259 | #define MPP35_LCD_D15 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 260 | −#define MPP35_MII0_RXERR MPP( 35, 0xc, 1, 0, 1, 1, 1, 1, 1 ) | |
| 260 | +#define MPP35_MII0_RXERR MPP( 35, 0xc, 0, 0, 1, 1, 1, 1, 1 ) | |
| 261 | 261 | |
| 262 | 262 | #define MPP36_GPIO MPP( 36, 0x0, 1, 1, 1, 0, 0, 1, 1 ) |
| 263 | −#define MPP36_TSMP0 MPP( 36, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 264 | −#define MPP36_TDM_SPI_CS1 MPP( 36, 0x2, 0, 1, 0, 0, 0, 1, 1 ) | |
| 265 | −#define MPP36_AU_SPDIFI MPP( 36, 0x4, 1, 0, 1, 0, 0, 1, 1 ) | |
| 266 | −#define MPP36_TW1_SDA MPP( 36, 0xb, 1, 1, 0, 0, 0, 0, 1 ) | |
| 263 | +#define MPP36_TSMP0 MPP( 36, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 264 | +#define MPP36_TDM_SPI_CS1 MPP( 36, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 265 | +#define MPP36_AU_SPDIFI MPP( 36, 0x4, 0, 0, 1, 0, 0, 1, 1 ) | |
| 266 | +#define MPP36_TW1_SDA MPP( 36, 0xb, 0, 0, 0, 0, 0, 0, 1 ) | |
| 267 | 267 | |
| 268 | 268 | #define MPP37_GPIO MPP( 37, 0x0, 1, 1, 1, 0, 0, 1, 1 ) |
| 269 | −#define MPP37_TSMP1 MPP( 37, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 270 | −#define MPP37_TDM_CH2_TX_QL MPP( 37, 0x2, 0, 1, 0, 0, 0, 1, 1 ) | |
| 271 | −#define MPP37_AU_SPDIFO MPP( 37, 0x4, 0, 1, 1, 0, 0, 1, 1 ) | |
| 272 | −#define MPP37_TW1_SCK MPP( 37, 0xb, 1, 1, 0, 0, 0, 0, 1 ) | |
| 269 | +#define MPP37_TSMP1 MPP( 37, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 270 | +#define MPP37_TDM_CH2_TX_QL MPP( 37, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 271 | +#define MPP37_AU_SPDIFO MPP( 37, 0x4, 0, 0, 1, 0, 0, 1, 1 ) | |
| 272 | +#define MPP37_TW1_SCK MPP( 37, 0xb, 0, 0, 0, 0, 0, 0, 1 ) | |
| 273 | 273 | |
| 274 | 274 | #define MPP38_GPIO MPP( 38, 0x0, 1, 1, 1, 0, 0, 1, 1 ) |
| 275 | −#define MPP38_TSMP2 MPP( 38, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 276 | −#define MPP38_TDM_CH2_RX_QL MPP( 38, 0x2, 0, 1, 0, 0, 0, 1, 1 ) | |
| 277 | −#define MPP38_AU_SPDIFRMLCLK MPP( 38, 0x4, 0, 1, 1, 0, 0, 1, 1 ) | |
| 275 | +#define MPP38_TSMP2 MPP( 38, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 276 | +#define MPP38_TDM_CH2_RX_QL MPP( 38, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 277 | +#define MPP38_AU_SPDIFRMLCLK MPP( 38, 0x4, 0, 0, 1, 0, 0, 1, 1 ) | |
| 278 | 278 | #define MPP38_LCD_D18 MPP( 38, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 279 | 279 | |
| 280 | 280 | #define MPP39_GPIO MPP( 39, 0x0, 1, 1, 1, 0, 0, 1, 1 ) |
| 281 | −#define MPP39_TSMP3 MPP( 39, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 282 | −#define MPP39_TDM_SPI_CS0 MPP( 39, 0x2, 0, 1, 0, 0, 0, 1, 1 ) | |
| 283 | −#define MPP39_AU_I2SBCLK MPP( 39, 0x4, 0, 1, 1, 0, 0, 1, 1 ) | |
| 281 | +#define MPP39_TSMP3 MPP( 39, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 282 | +#define MPP39_TDM_SPI_CS0 MPP( 39, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 283 | +#define MPP39_AU_I2SBCLK MPP( 39, 0x4, 0, 0, 1, 0, 0, 1, 1 ) | |
| 284 | 284 | #define MPP39_LCD_D19 MPP( 39, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 285 | 285 | |
| 286 | 286 | #define MPP40_GPIO MPP( 40, 0x0, 1, 1, 1, 0, 0, 1, 1 ) |
| 287 | −#define MPP40_TSMP4 MPP( 40, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 288 | −#define MPP40_TDM_SPI_SCK MPP( 40, 0x2, 0, 1, 0, 0, 0, 1, 1 ) | |
| 289 | −#define MPP40_AU_I2SDO MPP( 40, 0x4, 0, 1, 1, 0, 0, 1, 1 ) | |
| 287 | +#define MPP40_TSMP4 MPP( 40, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 288 | +#define MPP40_TDM_SPI_SCK MPP( 40, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 289 | +#define MPP40_AU_I2SDO MPP( 40, 0x4, 0, 0, 1, 0, 0, 1, 1 ) | |
| 290 | 290 | #define MPP40_LCD_D20 MPP( 40, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 291 | 291 | |
| 292 | 292 | #define MPP41_GPIO MPP( 41, 0x0, 1, 1, 1, 0, 0, 1, 1 ) |
| 293 | −#define MPP41_TSMP5 MPP( 41, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 294 | −#define MPP41_TDM_SPI_MISO MPP( 41, 0x2, 1, 0, 0, 0, 0, 1, 1 ) | |
| 295 | −#define MPP41_AU_I2SLRCLK MPP( 41, 0x4, 0, 1, 1, 0, 0, 1, 1 ) | |
| 293 | +#define MPP41_TSMP5 MPP( 41, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 294 | +#define MPP41_TDM_SPI_MISO MPP( 41, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 295 | +#define MPP41_AU_I2SLRCLK MPP( 41, 0x4, 0, 0, 1, 0, 0, 1, 1 ) | |
| 296 | 296 | #define MPP41_LCD_D21 MPP( 41, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 297 | 297 | |
| 298 | 298 | #define MPP42_GPIO MPP( 42, 0x0, 1, 1, 1, 0, 0, 1, 1 ) |
| 299 | −#define MPP42_TSMP6 MPP( 42, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 300 | −#define MPP42_TDM_SPI_MOSI MPP( 42, 0x2, 0, 1, 0, 0, 0, 1, 1 ) | |
| 301 | −#define MPP42_AU_I2SMCLK MPP( 42, 0x4, 0, 1, 1, 0, 0, 1, 1 ) | |
| 299 | +#define MPP42_TSMP6 MPP( 42, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 300 | +#define MPP42_TDM_SPI_MOSI MPP( 42, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 301 | +#define MPP42_AU_I2SMCLK MPP( 42, 0x4, 0, 0, 1, 0, 0, 1, 1 ) | |
| 302 | 302 | #define MPP42_LCD_D22 MPP( 42, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 303 | 303 | |
| 304 | 304 | #define MPP43_GPIO MPP( 43, 0x0, 1, 1, 1, 0, 0, 1, 1 ) |
| 305 | −#define MPP43_TSMP7 MPP( 43, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 305 | +#define MPP43_TSMP7 MPP( 43, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 306 | 306 | #define MPP43_TDM_CODEC_INTn MPP( 43, 0x2, 0, 0, 0, 0, 0, 1, 1 ) |
| 307 | −#define MPP43_AU_I2SDI MPP( 43, 0x4, 1, 0, 1, 0, 0, 1, 1 ) | |
| 307 | +#define MPP43_AU_I2SDI MPP( 43, 0x4, 0, 0, 1, 0, 0, 1, 1 ) | |
| 308 | 308 | #define MPP43_LCD_D23 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 309 | 309 | |
| 310 | 310 | #define MPP44_GPIO MPP( 44, 0x0, 1, 1, 1, 0, 0, 1, 1 ) |
| 311 | −#define MPP44_TSMP8 MPP( 44, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 311 | +#define MPP44_TSMP8 MPP( 44, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 312 | 312 | #define MPP44_TDM_CODEC_RSTn MPP( 44, 0x2, 0, 0, 0, 0, 0, 1, 1 ) |
| 313 | −#define MPP44_AU_EXTCLK MPP( 44, 0x4, 1, 0, 1, 0, 0, 1, 1 ) | |
| 313 | +#define MPP44_AU_EXTCLK MPP( 44, 0x4, 0, 0, 1, 0, 0, 1, 1 ) | |
| 314 | 314 | #define MPP44_LCD_CLK MPP( 44, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 315 | 315 | |
| 316 | 316 | #define MPP45_GPIO MPP( 45, 0x0, 1, 1, 0, 0, 0, 1, 1 ) |
| 317 | −#define MPP45_TSMP9 MPP( 45, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 318 | −#define MPP45_TDM_PCLK MPP( 45, 0x2, 1, 1, 0, 0, 0, 1, 1 ) | |
| 317 | +#define MPP45_TSMP9 MPP( 45, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 318 | +#define MPP45_TDM_PCLK MPP( 45, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 319 | 319 | #define MPP245_LCD_E MPP( 45, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 320 | 320 | |
| 321 | 321 | #define MPP46_GPIO MPP( 46, 0x0, 1, 1, 0, 0, 0, 1, 1 ) |
| 322 | −#define MPP46_TSMP10 MPP( 46, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 323 | −#define MPP46_TDM_FS MPP( 46, 0x2, 1, 1, 0, 0, 0, 1, 1 ) | |
| 322 | +#define MPP46_TSMP10 MPP( 46, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 323 | +#define MPP46_TDM_FS MPP( 46, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 324 | 324 | #define MPP46_LCD_HSYNC MPP( 46, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 325 | 325 | |
| 326 | 326 | #define MPP47_GPIO MPP( 47, 0x0, 1, 1, 0, 0, 0, 1, 1 ) |
| 327 | −#define MPP47_TSMP11 MPP( 47, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 328 | −#define MPP47_TDM_DRX MPP( 47, 0x2, 1, 0, 0, 0, 0, 1, 1 ) | |
| 327 | +#define MPP47_TSMP11 MPP( 47, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 328 | +#define MPP47_TDM_DRX MPP( 47, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 329 | 329 | #define MPP47_LCD_VSYNC MPP( 47, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 330 | 330 | |
| 331 | 331 | #define MPP48_GPIO MPP( 48, 0x0, 1, 1, 0, 0, 0, 1, 1 ) |
| 332 | −#define MPP48_TSMP12 MPP( 48, 0x1, 1, 1, 0, 0, 0, 1, 1 ) | |
| 333 | −#define MPP48_TDM_DTX MPP( 48, 0x2, 0, 1, 0, 0, 0, 1, 1 ) | |
| 332 | +#define MPP48_TSMP12 MPP( 48, 0x1, 0, 0, 0, 0, 0, 1, 1 ) | |
| 333 | +#define MPP48_TDM_DTX MPP( 48, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 334 | 334 | #define MPP48_LCD_D16 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 335 | 335 | |
| 336 | 336 | #define MPP49_GPIO MPP( 49, 0x0, 1, 1, 0, 0, 0, 1, 0 ) |
| 337 | 337 | #define MPP49_GPO MPP( 49, 0x0, 0, 1, 0, 0, 0, 0, 1 ) |
| 338 | −#define MPP49_TSMP9 MPP( 49, 0x1, 1, 1, 0, 0, 0, 1, 0 ) | |
| 339 | −#define MPP49_TDM_CH0_RX_QL MPP( 49, 0x2, 0, 1, 0, 0, 0, 1, 1 ) | |
| 340 | −#define MPP49_PTP_CLK MPP( 49, 0x5, 1, 0, 0, 0, 0, 1, 0 ) | |
| 341 | −#define MPP49_PEX0_CLKREQ MPP( 49, 0xa, 0, 1, 0, 0, 0, 0, 1 ) | |
| 338 | +#define MPP49_TSMP9 MPP( 49, 0x1, 0, 0, 0, 0, 0, 1, 0 ) | |
| 339 | +#define MPP49_TDM_CH0_RX_QL MPP( 49, 0x2, 0, 0, 0, 0, 0, 1, 1 ) | |
| 340 | +#define MPP49_PTP_CLK MPP( 49, 0x5, 0, 0, 0, 0, 0, 1, 0 ) | |
| 341 | +#define MPP49_PEX0_CLKREQ MPP( 49, 0xa, 0, 0, 0, 0, 0, 0, 1 ) | |
| 342 | 342 | #define MPP49_LCD_D17 MPP( 49, 0xb, 0, 0, 0, 0, 0, 0, 1 ) |
| 343 | 343 | |
| 344 | 344 | #define MPP_MAX 49 |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <mach/mv78xx0.h> |
| 20 | 20 | #include <mach/bridge-regs.h> |
| 21 | 21 | #include <plat/cache-feroceon-l2.h> |
| 22 | +#include <plat/ehci-orion.h> | |
| 22 | 23 | #include <plat/orion_nand.h> |
| 23 | 24 | #include <plat/time.h> |
| 24 | 25 | #include <plat/common.h> |
| @@ -169,7 +170,7 @@ void __init mv78xx0_map_io(void) · 144 unmodified lines | ||
| 169 | 170 | ****************************************************************************/ |
| 170 | 171 | void __init mv78xx0_ehci0_init(void) |
| 171 | 172 | { |
| 172 | − orion_ehci_init(USB0_PHYS_BASE, IRQ_MV78XX0_USB_0); | |
| 173 | + orion_ehci_init(USB0_PHYS_BASE, IRQ_MV78XX0_USB_0, EHCI_PHY_NA); | |
| 173 | 174 | } |
| 174 | 175 | |
| 175 | 176 | |
| @@ -24,296 +24,296 @@ · 23 unmodified lines | ||
| 24 | 24 | #define MPP_78100_A0_MASK MPP(0, 0x0, 0, 0, 1) |
| 25 | 25 | |
| 26 | 26 | #define MPP0_GPIO MPP(0, 0x0, 1, 1, 1) |
| 27 | −#define MPP0_GE0_COL MPP(0, 0x1, 1, 0, 1) | |
| 28 | −#define MPP0_GE1_TXCLK MPP(0, 0x2, 0, 1, 1) | |
| 27 | +#define MPP0_GE0_COL MPP(0, 0x1, 0, 0, 1) | |
| 28 | +#define MPP0_GE1_TXCLK MPP(0, 0x2, 0, 0, 1) | |
| 29 | 29 | #define MPP0_UNUSED MPP(0, 0x3, 0, 0, 1) |
| 30 | 30 | |
| 31 | 31 | #define MPP1_GPIO MPP(1, 0x0, 1, 1, 1) |
| 32 | −#define MPP1_GE0_RXERR MPP(1, 0x1, 1, 0, 1) | |
| 33 | −#define MPP1_GE1_TXCTL MPP(1, 0x2, 0, 1, 1) | |
| 32 | +#define MPP1_GE0_RXERR MPP(1, 0x1, 0, 0, 1) | |
| 33 | +#define MPP1_GE1_TXCTL MPP(1, 0x2, 0, 0, 1) | |
| 34 | 34 | #define MPP1_UNUSED MPP(1, 0x3, 0, 0, 1) |
| 35 | 35 | |
| 36 | 36 | #define MPP2_GPIO MPP(2, 0x0, 1, 1, 1) |
| 37 | −#define MPP2_GE0_CRS MPP(2, 0x1, 1, 0, 1) | |
| 38 | −#define MPP2_GE1_RXCTL MPP(2, 0x2, 1, 0, 1) | |
| 37 | +#define MPP2_GE0_CRS MPP(2, 0x1, 0, 0, 1) | |
| 38 | +#define MPP2_GE1_RXCTL MPP(2, 0x2, 0, 0, 1) | |
| 39 | 39 | #define MPP2_UNUSED MPP(2, 0x3, 0, 0, 1) |
| 40 | 40 | |
| 41 | 41 | #define MPP3_GPIO MPP(3, 0x0, 1, 1, 1) |
| 42 | −#define MPP3_GE0_TXERR MPP(3, 0x1, 0, 1, 1) | |
| 43 | −#define MPP3_GE1_RXCLK MPP(3, 0x2, 1, 0, 1) | |
| 42 | +#define MPP3_GE0_TXERR MPP(3, 0x1, 0, 0, 1) | |
| 43 | +#define MPP3_GE1_RXCLK MPP(3, 0x2, 0, 0, 1) | |
| 44 | 44 | #define MPP3_UNUSED MPP(3, 0x3, 0, 0, 1) |
| 45 | 45 | |
| 46 | 46 | #define MPP4_GPIO MPP(4, 0x0, 1, 1, 1) |
| 47 | −#define MPP4_GE0_TXD4 MPP(4, 0x1, 0, 1, 1) | |
| 48 | −#define MPP4_GE1_TXD0 MPP(4, 0x2, 0, 1, 1) | |
| 47 | +#define MPP4_GE0_TXD4 MPP(4, 0x1, 0, 0, 1) | |
| 48 | +#define MPP4_GE1_TXD0 MPP(4, 0x2, 0, 0, 1) | |
| 49 | 49 | #define MPP4_UNUSED MPP(4, 0x3, 0, 0, 1) |
| 50 | 50 | |
| 51 | 51 | #define MPP5_GPIO MPP(5, 0x0, 1, 1, 1) |
| 52 | −#define MPP5_GE0_TXD5 MPP(5, 0x1, 0, 1, 1) | |
| 53 | −#define MPP5_GE1_TXD1 MPP(5, 0x2, 0, 1, 1) | |
| 52 | +#define MPP5_GE0_TXD5 MPP(5, 0x1, 0, 0, 1) | |
| 53 | +#define MPP5_GE1_TXD1 MPP(5, 0x2, 0, 0, 1) | |
| 54 | 54 | #define MPP5_UNUSED MPP(5, 0x3, 0, 0, 1) |
| 55 | 55 | |
| 56 | 56 | #define MPP6_GPIO MPP(6, 0x0, 1, 1, 1) |
| 57 | −#define MPP6_GE0_TXD6 MPP(6, 0x1, 0, 1, 1) | |
| 58 | −#define MPP6_GE1_TXD2 MPP(6, 0x2, 0, 1, 1) | |
| 57 | +#define MPP6_GE0_TXD6 MPP(6, 0x1, 0, 0, 1) | |
| 58 | +#define MPP6_GE1_TXD2 MPP(6, 0x2, 0, 0, 1) | |
| 59 | 59 | #define MPP6_UNUSED MPP(6, 0x3, 0, 0, 1) |
| 60 | 60 | |
| 61 | 61 | #define MPP7_GPIO MPP(7, 0x0, 1, 1, 1) |
| 62 | −#define MPP7_GE0_TXD7 MPP(7, 0x1, 0, 1, 1) | |
| 63 | −#define MPP7_GE1_TXD3 MPP(7, 0x2, 0, 1, 1) | |
| 62 | +#define MPP7_GE0_TXD7 MPP(7, 0x1, 0, 0, 1) | |
| 63 | +#define MPP7_GE1_TXD3 MPP(7, 0x2, 0, 0, 1) | |
| 64 | 64 | #define MPP7_UNUSED MPP(7, 0x3, 0, 0, 1) |
| 65 | 65 | |
| 66 | 66 | #define MPP8_GPIO MPP(8, 0x0, 1, 1, 1) |
| 67 | −#define MPP8_GE0_RXD4 MPP(8, 0x1, 1, 0, 1) | |
| 68 | −#define MPP8_GE1_RXD0 MPP(8, 0x2, 1, 0, 1) | |
| 67 | +#define MPP8_GE0_RXD4 MPP(8, 0x1, 0, 0, 1) | |
| 68 | +#define MPP8_GE1_RXD0 MPP(8, 0x2, 0, 0, 1) | |
| 69 | 69 | #define MPP8_UNUSED MPP(8, 0x3, 0, 0, 1) |
| 70 | 70 | |
| 71 | 71 | #define MPP9_GPIO MPP(9, 0x0, 1, 1, 1) |
| 72 | −#define MPP9_GE0_RXD5 MPP(9, 0x1, 1, 0, 1) | |
| 73 | −#define MPP9_GE1_RXD1 MPP(9, 0x2, 1, 0, 1) | |
| 72 | +#define MPP9_GE0_RXD5 MPP(9, 0x1, 0, 0, 1) | |
| 73 | +#define MPP9_GE1_RXD1 MPP(9, 0x2, 0, 0, 1) | |
| 74 | 74 | #define MPP9_UNUSED MPP(9, 0x3, 0, 0, 1) |
| 75 | 75 | |
| 76 | 76 | #define MPP10_GPIO MPP(10, 0x0, 1, 1, 1) |
| 77 | −#define MPP10_GE0_RXD6 MPP(10, 0x1, 1, 0, 1) | |
| 78 | −#define MPP10_GE1_RXD2 MPP(10, 0x2, 1, 0, 1) | |
| 77 | +#define MPP10_GE0_RXD6 MPP(10, 0x1, 0, 0, 1) | |
| 78 | +#define MPP10_GE1_RXD2 MPP(10, 0x2, 0, 0, 1) | |
| 79 | 79 | #define MPP10_UNUSED MPP(10, 0x3, 0, 0, 1) |
| 80 | 80 | |
| 81 | 81 | #define MPP11_GPIO MPP(11, 0x0, 1, 1, 1) |
| 82 | −#define MPP11_GE0_RXD7 MPP(11, 0x1, 1, 0, 1) | |
| 83 | −#define MPP11_GE1_RXD3 MPP(11, 0x2, 1, 0, 1) | |
| 82 | +#define MPP11_GE0_RXD7 MPP(11, 0x1, 0, 0, 1) | |
| 83 | +#define MPP11_GE1_RXD3 MPP(11, 0x2, 0, 0, 1) | |
| 84 | 84 | #define MPP11_UNUSED MPP(11, 0x3, 0, 0, 1) |
| 85 | 85 | |
| 86 | 86 | #define MPP12_GPIO MPP(12, 0x0, 1, 1, 1) |
| 87 | −#define MPP12_M_BB MPP(12, 0x3, 1, 0, 1) | |
| 88 | −#define MPP12_UA0_CTSn MPP(12, 0x4, 1, 0, 1) | |
| 89 | −#define MPP12_NAND_FLASH_REn0 MPP(12, 0x5, 0, 1, 1) | |
| 90 | −#define MPP12_TDM0_SCSn MPP(12, 0X6, 0, 1, 1) | |
| 87 | +#define MPP12_M_BB MPP(12, 0x3, 0, 0, 1) | |
| 88 | +#define MPP12_UA0_CTSn MPP(12, 0x4, 0, 0, 1) | |
| 89 | +#define MPP12_NAND_FLASH_REn0 MPP(12, 0x5, 0, 0, 1) | |
| 90 | +#define MPP12_TDM0_SCSn MPP(12, 0X6, 0, 0, 1) | |
| 91 | 91 | #define MPP12_UNUSED MPP(12, 0x1, 0, 0, 1) |
| 92 | 92 | |
| 93 | 93 | #define MPP13_GPIO MPP(13, 0x0, 1, 1, 1) |
| 94 | −#define MPP13_SYSRST_OUTn MPP(13, 0x3, 0, 1, 1) | |
| 95 | −#define MPP13_UA0_RTSn MPP(13, 0x4, 0, 1, 1) | |
| 96 | −#define MPP13_NAN_FLASH_WEn0 MPP(13, 0x5, 0, 1, 1) | |
| 97 | −#define MPP13_TDM_SCLK MPP(13, 0x6, 0, 1, 1) | |
| 94 | +#define MPP13_SYSRST_OUTn MPP(13, 0x3, 0, 0, 1) | |
| 95 | +#define MPP13_UA0_RTSn MPP(13, 0x4, 0, 0, 1) | |
| 96 | +#define MPP13_NAN_FLASH_WEn0 MPP(13, 0x5, 0, 0, 1) | |
| 97 | +#define MPP13_TDM_SCLK MPP(13, 0x6, 0, 0, 1) | |
| 98 | 98 | #define MPP13_UNUSED MPP(13, 0x1, 0, 0, 1) |
| 99 | 99 | |
| 100 | 100 | #define MPP14_GPIO MPP(14, 0x0, 1, 1, 1) |
| 101 | −#define MPP14_SATA1_ACTn MPP(14, 0x3, 0, 1, 1) | |
| 102 | −#define MPP14_UA1_CTSn MPP(14, 0x4, 1, 0, 1) | |
| 103 | −#define MPP14_NAND_FLASH_REn1 MPP(14, 0x5, 0, 1, 1) | |
| 104 | −#define MPP14_TDM_SMOSI MPP(14, 0x6, 0, 1, 1) | |
| 101 | +#define MPP14_SATA1_ACTn MPP(14, 0x3, 0, 0, 1) | |
| 102 | +#define MPP14_UA1_CTSn MPP(14, 0x4, 0, 0, 1) | |
| 103 | +#define MPP14_NAND_FLASH_REn1 MPP(14, 0x5, 0, 0, 1) | |
| 104 | +#define MPP14_TDM_SMOSI MPP(14, 0x6, 0, 0, 1) | |
| 105 | 105 | #define MPP14_UNUSED MPP(14, 0x1, 0, 0, 1) |
| 106 | 106 | |
| 107 | 107 | #define MPP15_GPIO MPP(15, 0x0, 1, 1, 1) |
| 108 | −#define MPP15_SATA0_ACTn MPP(15, 0x3, 0, 1, 1) | |
| 109 | −#define MPP15_UA1_RTSn MPP(15, 0x4, 0, 1, 1) | |
| 110 | −#define MPP15_NAND_FLASH_WEn1 MPP(15, 0x5, 0, 1, 1) | |
| 111 | −#define MPP15_TDM_SMISO MPP(15, 0x6, 1, 0, 1) | |
| 108 | +#define MPP15_SATA0_ACTn MPP(15, 0x3, 0, 0, 1) | |
| 109 | +#define MPP15_UA1_RTSn MPP(15, 0x4, 0, 0, 1) | |
| 110 | +#define MPP15_NAND_FLASH_WEn1 MPP(15, 0x5, 0, 0, 1) | |
| 111 | +#define MPP15_TDM_SMISO MPP(15, 0x6, 0, 0, 1) | |
| 112 | 112 | #define MPP15_UNUSED MPP(15, 0x1, 0, 0, 1) |
| 113 | 113 | |
| 114 | 114 | #define MPP16_GPIO MPP(16, 0x0, 1, 1, 1) |
| 115 | −#define MPP16_SATA1_PRESENTn MPP(16, 0x3, 0, 1, 1) | |
| 116 | −#define MPP16_UA2_TXD MPP(16, 0x4, 0, 1, 1) | |
| 117 | −#define MPP16_NAND_FLASH_REn3 MPP(16, 0x5, 0, 1, 1) | |
| 118 | −#define MPP16_TDM_INTn MPP(16, 0x6, 1, 0, 1) | |
| 115 | +#define MPP16_SATA1_PRESENTn MPP(16, 0x3, 0, 0, 1) | |
| 116 | +#define MPP16_UA2_TXD MPP(16, 0x4, 0, 0, 1) | |
| 117 | +#define MPP16_NAND_FLASH_REn3 MPP(16, 0x5, 0, 0, 1) | |
| 118 | +#define MPP16_TDM_INTn MPP(16, 0x6, 0, 0, 1) | |
| 119 | 119 | #define MPP16_UNUSED MPP(16, 0x1, 0, 0, 1) |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | #define MPP17_GPIO MPP(17, 0x0, 1, 1, 1) |
| 123 | −#define MPP17_SATA0_PRESENTn MPP(17, 0x3, 0, 1, 1) | |
| 124 | −#define MPP17_UA2_RXD MPP(17, 0x4, 1, 0, 1) | |
| 125 | −#define MPP17_NAND_FLASH_WEn3 MPP(17, 0x5, 0, 1, 1) | |
| 126 | −#define MPP17_TDM_RSTn MPP(17, 0x6, 0, 1, 1) | |
| 123 | +#define MPP17_SATA0_PRESENTn MPP(17, 0x3, 0, 0, 1) | |
| 124 | +#define MPP17_UA2_RXD MPP(17, 0x4, 0, 0, 1) | |
| 125 | +#define MPP17_NAND_FLASH_WEn3 MPP(17, 0x5, 0, 0, 1) | |
| 126 | +#define MPP17_TDM_RSTn MPP(17, 0x6, 0, 0, 1) | |
| 127 | 127 | #define MPP17_UNUSED MPP(17, 0x1, 0, 0, 1) |
| 128 | 128 | |
| 129 | 129 | |
| 130 | 130 | #define MPP18_GPIO MPP(18, 0x0, 1, 1, 1) |
| 131 | −#define MPP18_UA0_CTSn MPP(18, 0x4, 1, 0, 1) | |
| 132 | −#define MPP18_BOOT_FLASH_REn MPP(18, 0x5, 0, 1, 1) | |
| 131 | +#define MPP18_UA0_CTSn MPP(18, 0x4, 0, 0, 1) | |
| 132 | +#define MPP18_BOOT_FLASH_REn MPP(18, 0x5, 0, 0, 1) | |
| 133 | 133 | #define MPP18_UNUSED MPP(18, 0x1, 0, 0, 1) |
| 134 | 134 | |
| 135 | 135 | |
| 136 | 136 | |
| 137 | 137 | #define MPP19_GPIO MPP(19, 0x0, 1, 1, 1) |
| 138 | −#define MPP19_UA0_CTSn MPP(19, 0x4, 0, 1, 1) | |
| 139 | −#define MPP19_BOOT_FLASH_WEn MPP(19, 0x5, 0, 1, 1) | |
| 138 | +#define MPP19_UA0_CTSn MPP(19, 0x4, 0, 0, 1) | |
| 139 | +#define MPP19_BOOT_FLASH_WEn MPP(19, 0x5, 0, 0, 1) | |
| 140 | 140 | #define MPP19_UNUSED MPP(19, 0x1, 0, 0, 1) |
| 141 | 141 | |
| 142 | 142 | |
| 143 | 143 | #define MPP20_GPIO MPP(20, 0x0, 1, 1, 1) |
| 144 | −#define MPP20_UA1_CTSs MPP(20, 0x4, 1, 0, 1) | |
| 145 | −#define MPP20_TDM_PCLK MPP(20, 0x6, 1, 1, 0) | |
| 144 | +#define MPP20_UA1_CTSs MPP(20, 0x4, 0, 0, 1) | |
| 145 | +#define MPP20_TDM_PCLK MPP(20, 0x6, 0, 0, 0) | |
| 146 | 146 | #define MPP20_UNUSED MPP(20, 0x1, 0, 0, 1) |
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | |
| 150 | 150 | #define MPP21_GPIO MPP(21, 0x0, 1, 1, 1) |
| 151 | −#define MPP21_UA1_CTSs MPP(21, 0x4, 0, 1, 1) | |
| 152 | −#define MPP21_TDM_FSYNC MPP(21, 0x6, 1, 1, 0) | |
| 151 | +#define MPP21_UA1_CTSs MPP(21, 0x4, 0, 0, 1) | |
| 152 | +#define MPP21_TDM_FSYNC MPP(21, 0x6, 0, 0, 0) | |
| 153 | 153 | #define MPP21_UNUSED MPP(21, 0x1, 0, 0, 1) |
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | |
| 157 | 157 | #define MPP22_GPIO MPP(22, 0x0, 1, 1, 1) |
| 158 | −#define MPP22_UA3_TDX MPP(22, 0x4, 0, 1, 1) | |
| 159 | −#define MPP22_NAND_FLASH_REn2 MPP(22, 0x5, 0, 1, 1) | |
| 160 | −#define MPP22_TDM_DRX MPP(22, 0x6, 1, 0, 1) | |
| 158 | +#define MPP22_UA3_TDX MPP(22, 0x4, 0, 0, 1) | |
| 159 | +#define MPP22_NAND_FLASH_REn2 MPP(22, 0x5, 0, 0, 1) | |
| 160 | +#define MPP22_TDM_DRX MPP(22, 0x6, 0, 0, 1) | |
| 161 | 161 | #define MPP22_UNUSED MPP(22, 0x1, 0, 0, 1) |
| 162 | 162 | |
| 163 | 163 | |
| 164 | 164 | |
| 165 | 165 | #define MPP23_GPIO MPP(23, 0x0, 1, 1, 1) |
| 166 | −#define MPP23_UA3_RDX MPP(23, 0x4, 1, 0, 1) | |
| 167 | −#define MPP23_NAND_FLASH_WEn2 MPP(23, 0x5, 0, 1, 1) | |
| 168 | −#define MPP23_TDM_DTX MPP(23, 0x6, 0, 1, 1) | |
| 166 | +#define MPP23_UA3_RDX MPP(23, 0x4, 0, 0, 1) | |
| 167 | +#define MPP23_NAND_FLASH_WEn2 MPP(23, 0x5, 0, 0, 1) | |
| 168 | +#define MPP23_TDM_DTX MPP(23, 0x6, 0, 0, 1) | |
| 169 | 169 | #define MPP23_UNUSED MPP(23, 0x1, 0, 0, 1) |
| 170 | 170 | |
| 171 | 171 | |
| 172 | 172 | #define MPP24_GPIO MPP(24, 0x0, 1, 1, 1) |
| 173 | −#define MPP24_UA2_TXD MPP(24, 0x4, 0, 1, 1) | |
| 174 | −#define MPP24_TDM_INTn MPP(24, 0x6, 1, 0, 1) | |
| 173 | +#define MPP24_UA2_TXD MPP(24, 0x4, 0, 0, 1) | |
| 174 | +#define MPP24_TDM_INTn MPP(24, 0x6, 0, 0, 1) | |
| 175 | 175 | #define MPP24_UNUSED MPP(24, 0x1, 0, 0, 1) |
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | #define MPP25_GPIO MPP(25, 0x0, 1, 1, 1) |
| 179 | −#define MPP25_UA2_RXD MPP(25, 0x4, 1, 0, 1) | |
| 180 | −#define MPP25_TDM_RSTn MPP(25, 0x6, 0, 1, 1) | |
| 179 | +#define MPP25_UA2_RXD MPP(25, 0x4, 0, 0, 1) | |
| 180 | +#define MPP25_TDM_RSTn MPP(25, 0x6, 0, 0, 1) | |
| 181 | 181 | #define MPP25_UNUSED MPP(25, 0x1, 0, 0, 1) |
| 182 | 182 | |
| 183 | 183 | |
| 184 | 184 | #define MPP26_GPIO MPP(26, 0x0, 1, 1, 1) |
| 185 | −#define MPP26_UA2_CTSn MPP(26, 0x4, 1, 0, 1) | |
| 186 | −#define MPP26_TDM_PCLK MPP(26, 0x6, 1, 1, 1) | |
| 185 | +#define MPP26_UA2_CTSn MPP(26, 0x4, 0, 0, 1) | |
| 186 | +#define MPP26_TDM_PCLK MPP(26, 0x6, 0, 0, 1) | |
| 187 | 187 | #define MPP26_UNUSED MPP(26, 0x1, 0, 0, 1) |
| 188 | 188 | |
| 189 | 189 | |
| 190 | 190 | #define MPP27_GPIO MPP(27, 0x0, 1, 1, 1) |
| 191 | −#define MPP27_UA2_RTSn MPP(27, 0x4, 0, 1, 1) | |
| 192 | −#define MPP27_TDM_FSYNC MPP(27, 0x6, 1, 1, 1) | |
| 191 | +#define MPP27_UA2_RTSn MPP(27, 0x4, 0, 0, 1) | |
| 192 | +#define MPP27_TDM_FSYNC MPP(27, 0x6, 0, 0, 1) | |
| 193 | 193 | #define MPP27_UNUSED MPP(27, 0x1, 0, 0, 1) |
| 194 | 194 | |
| 195 | 195 | |
| 196 | 196 | #define MPP28_GPIO MPP(28, 0x0, 1, 1, 1) |
| 197 | −#define MPP28_UA3_TXD MPP(28, 0x4, 0, 1, 1) | |
| 198 | −#define MPP28_TDM_DRX MPP(28, 0x6, 1, 0, 1) | |
| 197 | +#define MPP28_UA3_TXD MPP(28, 0x4, 0, 0, 1) | |
| 198 | +#define MPP28_TDM_DRX MPP(28, 0x6, 0, 0, 1) | |
| 199 | 199 | #define MPP28_UNUSED MPP(28, 0x1, 0, 0, 1) |
| 200 | 200 | |
| 201 | 201 | #define MPP29_GPIO MPP(29, 0x0, 1, 1, 1) |
| 202 | −#define MPP29_UA3_RXD MPP(29, 0x4, 1, 0, 1) | |
| 203 | −#define MPP29_SYSRST_OUTn MPP(29, 0x5, 0, 1, 1) | |
| 204 | −#define MPP29_TDM_DTX MPP(29, 0x6, 0, 1, 1) | |
| 202 | +#define MPP29_UA3_RXD MPP(29, 0x4, 0, 0, 1) | |
| 203 | +#define MPP29_SYSRST_OUTn MPP(29, 0x5, 0, 0, 1) | |
| 204 | +#define MPP29_TDM_DTX MPP(29, 0x6, 0, 0, 1) | |
| 205 | 205 | #define MPP29_UNUSED MPP(29, 0x1, 0, 0, 1) |
| 206 | 206 | |
| 207 | 207 | #define MPP30_GPIO MPP(30, 0x0, 1, 1, 1) |
| 208 | −#define MPP30_UA3_CTSn MPP(30, 0x4, 1, 0, 1) | |
| 208 | +#define MPP30_UA3_CTSn MPP(30, 0x4, 0, 0, 1) | |
| 209 | 209 | #define MPP30_UNUSED MPP(30, 0x1, 0, 0, 1) |
| 210 | 210 | |
| 211 | 211 | #define MPP31_GPIO MPP(31, 0x0, 1, 1, 1) |
| 212 | −#define MPP31_UA3_RTSn MPP(31, 0x4, 0, 1, 1) | |
| 213 | −#define MPP31_TDM1_SCSn MPP(31, 0x6, 0, 1, 1) | |
| 212 | +#define MPP31_UA3_RTSn MPP(31, 0x4, 0, 0, 1) | |
| 213 | +#define MPP31_TDM1_SCSn MPP(31, 0x6, 0, 0, 1) | |
| 214 | 214 | #define MPP31_UNUSED MPP(31, 0x1, 0, 0, 1) |
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | #define MPP32_GPIO MPP(32, 0x1, 1, 1, 1) |
| 218 | −#define MPP32_UA3_TDX MPP(32, 0x4, 0, 1, 1) | |
| 219 | −#define MPP32_SYSRST_OUTn MPP(32, 0x5, 0, 1, 1) | |
| 220 | −#define MPP32_TDM0_RXQ MPP(32, 0x6, 0, 1, 1) | |
| 218 | +#define MPP32_UA3_TDX MPP(32, 0x4, 0, 0, 1) | |
| 219 | +#define MPP32_SYSRST_OUTn MPP(32, 0x5, 0, 0, 1) | |
| 220 | +#define MPP32_TDM0_RXQ MPP(32, 0x6, 0, 0, 1) | |
| 221 | 221 | #define MPP32_UNUSED MPP(32, 0x3, 0, 0, 1) |
| 222 | 222 | |
| 223 | 223 | |
| 224 | 224 | #define MPP33_GPIO MPP(33, 0x1, 1, 1, 1) |
| 225 | −#define MPP33_UA3_RDX MPP(33, 0x4, 1, 0, 1) | |
| 226 | −#define MPP33_TDM0_TXQ MPP(33, 0x6, 0, 1, 1) | |
| 225 | +#define MPP33_UA3_RDX MPP(33, 0x4, 0, 0, 1) | |
| 226 | +#define MPP33_TDM0_TXQ MPP(33, 0x6, 0, 0, 1) | |
| 227 | 227 | #define MPP33_UNUSED MPP(33, 0x3, 0, 0, 1) |
| 228 | 228 | |
| 229 | 229 | |
| 230 | 230 | |
| 231 | 231 | #define MPP34_GPIO MPP(34, 0x1, 1, 1, 1) |
| 232 | −#define MPP34_UA2_TDX MPP(34, 0x4, 0, 1, 1) | |
| 233 | −#define MPP34_TDM1_RXQ MPP(34, 0x6, 0, 1, 1) | |
| 232 | +#define MPP34_UA2_TDX MPP(34, 0x4, 0, 0, 1) | |
| 233 | +#define MPP34_TDM1_RXQ MPP(34, 0x6, 0, 0, 1) | |
| 234 | 234 | #define MPP34_UNUSED MPP(34, 0x3, 0, 0, 1) |
| 235 | 235 | |
| 236 | 236 | |
| 237 | 237 | |
| 238 | 238 | #define MPP35_GPIO MPP(35, 0x1, 1, 1, 1) |
| 239 | −#define MPP35_UA2_RDX MPP(35, 0x4, 1, 0, 1) | |
| 240 | −#define MPP35_TDM1_TXQ MPP(35, 0x6, 0, 1, 1) | |
| 239 | +#define MPP35_UA2_RDX MPP(35, 0x4, 0, 0, 1) | |
| 240 | +#define MPP35_TDM1_TXQ MPP(35, 0x6, 0, 0, 1) | |
| 241 | 241 | #define MPP35_UNUSED MPP(35, 0x3, 0, 0, 1) |
| 242 | 242 | |
| 243 | 243 | #define MPP36_GPIO MPP(36, 0x1, 1, 1, 1) |
| 244 | −#define MPP36_UA0_CTSn MPP(36, 0x2, 1, 0, 1) | |
| 245 | −#define MPP36_UA2_TDX MPP(36, 0x4, 0, 1, 1) | |
| 246 | −#define MPP36_TDM0_SCSn MPP(36, 0x6, 0, 1, 1) | |
| 244 | +#define MPP36_UA0_CTSn MPP(36, 0x2, 0, 0, 1) | |
| 245 | +#define MPP36_UA2_TDX MPP(36, 0x4, 0, 0, 1) | |
| 246 | +#define MPP36_TDM0_SCSn MPP(36, 0x6, 0, 0, 1) | |
| 247 | 247 | #define MPP36_UNUSED MPP(36, 0x3, 0, 0, 1) |
| 248 | 248 | |
| 249 | 249 | |
| 250 | 250 | #define MPP37_GPIO MPP(37, 0x1, 1, 1, 1) |
| 251 | −#define MPP37_UA0_RTSn MPP(37, 0x2, 0, 1, 1) | |
| 252 | −#define MPP37_UA2_RXD MPP(37, 0x4, 1, 0, 1) | |
| 253 | −#define MPP37_SYSRST_OUTn MPP(37, 0x5, 0, 1, 1) | |
| 254 | −#define MPP37_TDM_SCLK MPP(37, 0x6, 0, 1, 1) | |
| 251 | +#define MPP37_UA0_RTSn MPP(37, 0x2, 0, 0, 1) | |
| 252 | +#define MPP37_UA2_RXD MPP(37, 0x4, 0, 0, 1) | |
| 253 | +#define MPP37_SYSRST_OUTn MPP(37, 0x5, 0, 0, 1) | |
| 254 | +#define MPP37_TDM_SCLK MPP(37, 0x6, 0, 0, 1) | |
| 255 | 255 | #define MPP37_UNUSED MPP(37, 0x3, 0, 0, 1) |
| 256 | 256 | |
| 257 | 257 | |
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | #define MPP38_GPIO MPP(38, 0x1, 1, 1, 1) |
| 261 | −#define MPP38_UA1_CTSn MPP(38, 0x2, 1, 0, 1) | |
| 262 | −#define MPP38_UA3_TXD MPP(38, 0x4, 0, 1, 1) | |
| 263 | −#define MPP38_SYSRST_OUTn MPP(38, 0x5, 0, 1, 1) | |
| 264 | −#define MPP38_TDM_SMOSI MPP(38, 0x6, 0, 1, 1) | |
| 261 | +#define MPP38_UA1_CTSn MPP(38, 0x2, 0, 0, 1) | |
| 262 | +#define MPP38_UA3_TXD MPP(38, 0x4, 0, 0, 1) | |
| 263 | +#define MPP38_SYSRST_OUTn MPP(38, 0x5, 0, 0, 1) | |
| 264 | +#define MPP38_TDM_SMOSI MPP(38, 0x6, 0, 0, 1) | |
| 265 | 265 | #define MPP38_UNUSED MPP(38, 0x3, 0, 0, 1) |
| 266 | 266 | |
| 267 | 267 | |
| 268 | 268 | |
| 269 | 269 | |
| 270 | 270 | #define MPP39_GPIO MPP(39, 0x1, 1, 1, 1) |
| 271 | −#define MPP39_UA1_RTSn MPP(39, 0x2, 0, 1, 1) | |
| 272 | −#define MPP39_UA3_RXD MPP(39, 0x4, 1, 0, 1) | |
| 273 | −#define MPP39_SYSRST_OUTn MPP(39, 0x5, 0, 1, 1) | |
| 274 | −#define MPP39_TDM_SMISO MPP(39, 0x6, 1, 0, 1) | |
| 271 | +#define MPP39_UA1_RTSn MPP(39, 0x2, 0, 0, 1) | |
| 272 | +#define MPP39_UA3_RXD MPP(39, 0x4, 0, 0, 1) | |
| 273 | +#define MPP39_SYSRST_OUTn MPP(39, 0x5, 0, 0, 1) | |
| 274 | +#define MPP39_TDM_SMISO MPP(39, 0x6, 0, 0, 1) | |
| 275 | 275 | #define MPP39_UNUSED MPP(39, 0x3, 0, 0, 1) |
| 276 | 276 | |
| 277 | 277 | |
| 278 | 278 | |
| 279 | 279 | #define MPP40_GPIO MPP(40, 0x1, 1, 1, 1) |
| 280 | −#define MPP40_TDM_INTn MPP(40, 0x6, 1, 0, 1) | |
| 280 | +#define MPP40_TDM_INTn MPP(40, 0x6, 0, 0, 1) | |
| 281 | 281 | #define MPP40_UNUSED MPP(40, 0x0, 0, 0, 1) |
| 282 | 282 | |
| 283 | 283 | |
| 284 | 284 | |
| 285 | 285 | #define MPP41_GPIO MPP(41, 0x1, 1, 1, 1) |
| 286 | −#define MPP41_TDM_RSTn MPP(41, 0x6, 0, 1, 1) | |
| 286 | +#define MPP41_TDM_RSTn MPP(41, 0x6, 0, 0, 1) | |
| 287 | 287 | #define MPP41_UNUSED MPP(41, 0x0, 0, 0, 1) |
| 288 | 288 | |
| 289 | 289 | |
| 290 | 290 | |
| 291 | 291 | #define MPP42_GPIO MPP(42, 0x1, 1, 1, 1) |
| 292 | −#define MPP42_TDM_PCLK MPP(42, 0x6, 1, 1, 1) | |
| 292 | +#define MPP42_TDM_PCLK MPP(42, 0x6, 0, 0, 1) | |
| 293 | 293 | #define MPP42_UNUSED MPP(42, 0x0, 0, 0, 1) |
| 294 | 294 | |
| 295 | 295 | |
| 296 | 296 | |
| 297 | 297 | #define MPP43_GPIO MPP(43, 0x1, 1, 1, 1) |
| 298 | −#define MPP43_TDM_FSYNC MPP(43, 0x6, 1, 1, 1) | |
| 298 | +#define MPP43_TDM_FSYNC MPP(43, 0x6, 0, 0, 1) | |
| 299 | 299 | #define MPP43_UNUSED MPP(43, 0x0, 0, 0, 1) |
| 300 | 300 | |
| 301 | 301 | |
| 302 | 302 | |
| 303 | 303 | #define MPP44_GPIO MPP(44, 0x1, 1, 1, 1) |
| 304 | −#define MPP44_TDM_DRX MPP(44, 0x6, 1, 0, 1) | |
| 304 | +#define MPP44_TDM_DRX MPP(44, 0x6, 0, 0, 1) | |
| 305 | 305 | #define MPP44_UNUSED MPP(44, 0x0, 0, 0, 1) |
| 306 | 306 | |
| 307 | 307 | |
| 308 | 308 | |
| 309 | 309 | #define MPP45_GPIO MPP(45, 0x1, 1, 1, 1) |
| 310 | −#define MPP45_SATA0_ACTn MPP(45, 0x3, 0, 1, 1) | |
| 311 | −#define MPP45_TDM_DRX MPP(45, 0x6, 0, 1, 1) | |
| 310 | +#define MPP45_SATA0_ACTn MPP(45, 0x3, 0, 0, 1) | |
| 311 | +#define MPP45_TDM_DRX MPP(45, 0x6, 0, 0, 1) | |
| 312 | 312 | #define MPP45_UNUSED MPP(45, 0x0, 0, 0, 1) |
| 313 | 313 | |
| 314 | 314 | |
| 315 | 315 | #define MPP46_GPIO MPP(46, 0x1, 1, 1, 1) |
| 316 | −#define MPP46_TDM_SCSn MPP(46, 0x6, 0, 1, 1) | |
| 316 | +#define MPP46_TDM_SCSn MPP(46, 0x6, 0, 0, 1) | |
| 317 | 317 | #define MPP46_UNUSED MPP(46, 0x0, 0, 0, 1) |
| 318 | 318 | |
| 319 | 319 | |
| @@ -323,14 +323,14 @@ · 3 unmodified lines | ||
| 323 | 323 | |
| 324 | 324 | |
| 325 | 325 | #define MPP48_GPIO MPP(48, 0x1, 1, 1, 1) |
| 326 | −#define MPP48_SATA1_ACTn MPP(48, 0x3, 0, 1, 1) | |
| 326 | +#define MPP48_SATA1_ACTn MPP(48, 0x3, 0, 0, 1) | |
| 327 | 327 | #define MPP48_UNUSED MPP(48, 0x2, 0, 0, 1) |
| 328 | 328 | |
| 329 | 329 | |
| 330 | 330 | |
| 331 | 331 | #define MPP49_GPIO MPP(49, 0x1, 1, 1, 1) |
| 332 | −#define MPP49_SATA0_ACTn MPP(49, 0x3, 0, 1, 1) | |
| 333 | −#define MPP49_M_BB MPP(49, 0x4, 1, 0, 1) | |
| 332 | +#define MPP49_SATA0_ACTn MPP(49, 0x3, 0, 0, 1) | |
| 333 | +#define MPP49_M_BB MPP(49, 0x4, 0, 0, 1) | |
| 334 | 334 | #define MPP49_UNUSED MPP(49, 0x2, 0, 0, 1) |
| 335 | 335 | |
| 336 | 336 | |
| @@ -213,13 +213,12 @@ config MACH_OMAP3_PANDORA · 212 unmodified lines | ||
| 213 | 213 | depends on ARCH_OMAP3 |
| 214 | 214 | default y |
| 215 | 215 | select OMAP_PACKAGE_CBB |
| 216 | − select REGULATOR_FIXED_VOLTAGE | |
| 216 | + select REGULATOR_FIXED_VOLTAGE if REGULATOR | |
| 217 | 217 | |
| 218 | 218 | config MACH_OMAP3_TOUCHBOOK |
| 219 | 219 | bool "OMAP3 Touch Book" |
| 220 | 220 | depends on ARCH_OMAP3 |
| 221 | 221 | default y |
| 222 | − select BACKLIGHT_CLASS_DEVICE | |
| 223 | 222 | |
| 224 | 223 | config MACH_OMAP_3430SDP |
| 225 | 224 | bool "OMAP 3430 SDP board" |
| @@ -265,7 +264,7 @@ config MACH_OMAP_ZOOM2 · 39 unmodified lines | ||
| 265 | 264 | select SERIAL_8250 |
| 266 | 265 | select SERIAL_CORE_CONSOLE |
| 267 | 266 | select SERIAL_8250_CONSOLE |
| 268 | − select REGULATOR_FIXED_VOLTAGE | |
| 267 | + select REGULATOR_FIXED_VOLTAGE if REGULATOR | |
| 269 | 268 | |
| 270 | 269 | config MACH_OMAP_ZOOM3 |
| 271 | 270 | bool "OMAP3630 Zoom3 board" |
| @@ -275,7 +274,7 @@ config MACH_OMAP_ZOOM3 · 3 unmodified lines | ||
| 275 | 274 | select SERIAL_8250 |
| 276 | 275 | select SERIAL_CORE_CONSOLE |
| 277 | 276 | select SERIAL_8250_CONSOLE |
| 278 | − select REGULATOR_FIXED_VOLTAGE | |
| 277 | + select REGULATOR_FIXED_VOLTAGE if REGULATOR | |
| 279 | 278 | |
| 280 | 279 | config MACH_CM_T35 |
| 281 | 280 | bool "CompuLab CM-T35/CM-T3730 modules" |
| @@ -334,7 +333,7 @@ config MACH_OMAP_4430SDP · 52 unmodified lines | ||
| 334 | 333 | depends on ARCH_OMAP4 |
| 335 | 334 | select OMAP_PACKAGE_CBL |
| 336 | 335 | select OMAP_PACKAGE_CBS |
| 337 | − select REGULATOR_FIXED_VOLTAGE | |
| 336 | + select REGULATOR_FIXED_VOLTAGE if REGULATOR | |
| 338 | 337 | |
| 339 | 338 | config MACH_OMAP4_PANDA |
| 340 | 339 | bool "OMAP4 Panda Board" |
| @@ -342,7 +341,7 @@ config MACH_OMAP4_PANDA · 1 unmodified line | ||
| 342 | 341 | depends on ARCH_OMAP4 |
| 343 | 342 | select OMAP_PACKAGE_CBL |
| 344 | 343 | select OMAP_PACKAGE_CBS |
| 345 | − select REGULATOR_FIXED_VOLTAGE | |
| 344 | + select REGULATOR_FIXED_VOLTAGE if REGULATOR | |
| 346 | 345 | |
| 347 | 346 | config OMAP3_EMU |
| 348 | 347 | bool "OMAP3 debugging peripherals" |
| @@ -11,9 +11,9 @@ hwmod-common = omap_hwmod.o \ · 10 unmodified lines | ||
| 11 | 11 | omap_hwmod_common_data.o |
| 12 | 12 | clock-common = clock.o clock_common_data.o \ |
| 13 | 13 | clkt_dpll.o clkt_clksel.o |
| 14 | −secure-common = omap-smc.o omap-secure.o | |
| 14 | +secure-common = omap-smc.o omap-secure.o | |
| 15 | 15 | |
| 16 | −obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common) $(secure-common) | |
| 16 | +obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common) | |
| 17 | 17 | obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common) |
| 18 | 18 | obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common) |
| 19 | 19 | |
| @@ -52,8 +52,9 @@ · 51 unmodified lines | ||
| 52 | 52 | #define ETH_KS8851_QUART 138 |
| 53 | 53 | #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184 |
| 54 | 54 | #define OMAP4_SFH7741_ENABLE_GPIO 188 |
| 55 | −#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */ | |
| 55 | +#define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */ | |
| 56 | 56 | #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ |
| 57 | +#define HDMI_GPIO_HPD 63 /* Hotplug detect */ | |
| 57 | 58 | #define DISPLAY_SEL_GPIO 59 /* LCD2/PicoDLP switch */ |
| 58 | 59 | #define DLP_POWER_ON_GPIO 40 |
| 59 | 60 | |
| @@ -603,8 +604,9 @@ static void __init omap_sfh7741prox_init(void) · 543 unmodified lines | ||
| 603 | 604 | } |
| 604 | 605 | |
| 605 | 606 | static struct gpio sdp4430_hdmi_gpios[] = { |
| 606 | − { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, | |
| 607 | + { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" }, | |
| 607 | 608 | { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, |
| 609 | + { HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" }, | |
| 608 | 610 | }; |
| 609 | 611 | |
| 610 | 612 | static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev) |
| @@ -621,8 +623,7 @@ static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev) · 10 unmodified lines | ||
| 621 | 623 | |
| 622 | 624 | static void sdp4430_panel_disable_hdmi(struct omap_dss_device *dssdev) |
| 623 | 625 | { |
| 624 | − gpio_free(HDMI_GPIO_LS_OE); | |
| 625 | − gpio_free(HDMI_GPIO_HPD); | |
| 626 | + gpio_free_array(sdp4430_hdmi_gpios, ARRAY_SIZE(sdp4430_hdmi_gpios)); | |
| 626 | 627 | } |
| 627 | 628 | |
| 628 | 629 | static struct nokia_dsi_panel_data dsi1_panel = { |
| @@ -738,6 +739,10 @@ static void sdp4430_lcd_init(void) · 109 unmodified lines | ||
| 738 | 739 | pr_err("%s: Could not get lcd2_reset_gpio\n", __func__); |
| 739 | 740 | } |
| 740 | 741 | |
| 742 | +static struct omap_dss_hdmi_data sdp4430_hdmi_data = { | |
| 743 | + .hpd_gpio = HDMI_GPIO_HPD, | |
| 744 | +}; | |
| 745 | + | |
| 741 | 746 | static struct omap_dss_device sdp4430_hdmi_device = { |
| 742 | 747 | .name = "hdmi", |
| 743 | 748 | .driver_name = "hdmi_panel", |
| @@ -745,6 +750,7 @@ static struct omap_dss_device sdp4430_hdmi_device = { · 1 unmodified line | ||
| 745 | 750 | .platform_enable = sdp4430_panel_enable_hdmi, |
| 746 | 751 | .platform_disable = sdp4430_panel_disable_hdmi, |
| 747 | 752 | .channel = OMAP_DSS_CHANNEL_DIGIT, |
| 753 | + .data = &sdp4430_hdmi_data, | |
| 748 | 754 | }; |
| 749 | 755 | |
| 750 | 756 | static struct picodlp_panel_data sdp4430_picodlp_pdata = { |
| @@ -808,7 +814,7 @@ static struct omap_dss_board_info sdp4430_dss_data = { · 57 unmodified lines | ||
| 808 | 814 | .default_device = &sdp4430_lcd_device, |
| 809 | 815 | }; |
| 810 | 816 | |
| 811 | −static void omap_4430sdp_display_init(void) | |
| 817 | +static void __init omap_4430sdp_display_init(void) | |
| 812 | 818 | { |
| 813 | 819 | int r; |
| 814 | 820 | |
| @@ -829,6 +835,10 @@ static void omap_4430sdp_display_init(void) · 14 unmodified lines | ||
| 829 | 835 | omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP); |
| 830 | 836 | else |
| 831 | 837 | omap_hdmi_init(0); |
| 838 | + | |
| 839 | + omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT); | |
| 840 | + omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT); | |
| 841 | + omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN); | |
| 832 | 842 | } |
| 833 | 843 | |
| 834 | 844 | #ifdef CONFIG_OMAP_MUX |
| @@ -841,7 +851,7 @@ static struct omap_board_mux board_mux[] __initdata = { · 6 unmodified lines | ||
| 841 | 851 | #define board_mux NULL |
| 842 | 852 | #endif |
| 843 | 853 | |
| 844 | −static void omap4_sdp4430_wifi_mux_init(void) | |
| 854 | +static void __init omap4_sdp4430_wifi_mux_init(void) | |
| 845 | 855 | { |
| 846 | 856 | omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT | |
| 847 | 857 | OMAP_PIN_OFF_WAKEUPENABLE); |
| @@ -868,12 +878,17 @@ static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = { · 20 unmodified lines | ||
| 868 | 878 | .board_tcxo_clock = WL12XX_TCXOCLOCK_26, |
| 869 | 879 | }; |
| 870 | 880 | |
| 871 | −static void omap4_sdp4430_wifi_init(void) | |
| 881 | +static void __init omap4_sdp4430_wifi_init(void) | |
| 872 | 882 | { |
| 883 | + int ret; | |
| 884 | + | |
| 873 | 885 | omap4_sdp4430_wifi_mux_init(); |
| 874 | − if (wl12xx_set_platform_data(&omap4_sdp4430_wlan_data)) | |
| 875 | − pr_err("Error setting wl12xx data\n"); | |
| 876 | − platform_device_register(&omap_vwlan_device); | |
| 886 | + ret = wl12xx_set_platform_data(&omap4_sdp4430_wlan_data); | |
| 887 | + if (ret) | |
| 888 | + pr_err("Error setting wl12xx data: %d\n", ret); | |
| 889 | + ret = platform_device_register(&omap_vwlan_device); | |
| 890 | + if (ret) | |
| 891 | + pr_err("Error registering wl12xx device: %d\n", ret); | |
| 877 | 892 | } |
| 878 | 893 | |
| 879 | 894 | static void __init omap_4430sdp_init(void) |
| @@ -437,7 +437,7 @@ static struct usbhs_omap_board_data usbhs_bdata __initdata = { · 436 unmodified lines | ||
| 437 | 437 | .reset_gpio_port[2] = -EINVAL |
| 438 | 438 | }; |
| 439 | 439 | |
| 440 | −static void cm_t35_init_usbh(void) | |
| 440 | +static void __init cm_t35_init_usbh(void) | |
| 441 | 441 | { |
| 442 | 442 | int err; |
| 443 | 443 | |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #include <linux/i2c/twl.h> |
| 18 | 18 | |
| 19 | 19 | #include <mach/hardware.h> |
| 20 | +#include <asm/hardware/gic.h> | |
| 20 | 21 | #include <asm/mach/arch.h> |
| 21 | 22 | |
| 22 | 23 | #include <plat/board.h> |
| @@ -102,6 +103,7 @@ DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)") · 79 unmodified lines | ||
| 102 | 103 | .map_io = omap242x_map_io, |
| 103 | 104 | .init_early = omap2420_init_early, |
| 104 | 105 | .init_irq = omap2_init_irq, |
| 106 | + .handle_irq = omap2_intc_handle_irq, | |
| 105 | 107 | .init_machine = omap_generic_init, |
| 106 | 108 | .timer = &omap2_timer, |
| 107 | 109 | .dt_compat = omap242x_boards_compat, |
| @@ -141,6 +143,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)") · 33 unmodified lines | ||
| 141 | 143 | .map_io = omap3_map_io, |
| 142 | 144 | .init_early = omap3430_init_early, |
| 143 | 145 | .init_irq = omap3_init_irq, |
| 146 | + .handle_irq = omap3_intc_handle_irq, | |
| 144 | 147 | .init_machine = omap3_init, |
| 145 | 148 | .timer = &omap3_timer, |
| 146 | 149 | .dt_compat = omap3_boards_compat, |
| @@ -160,6 +163,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)") · 13 unmodified lines | ||
| 160 | 163 | .map_io = omap4_map_io, |
| 161 | 164 | .init_early = omap4430_init_early, |
| 162 | 165 | .init_irq = gic_init_irq, |
| 166 | + .handle_irq = gic_handle_irq, | |
| 163 | 167 | .init_machine = omap4_init, |
| 164 | 168 | .timer = &omap4_timer, |
| 165 | 169 | .dt_compat = omap4_boards_compat, |
| @@ -617,6 +617,21 @@ static struct gpio omap3_evm_ehci_gpios[] __initdata = { · 616 unmodified lines | ||
| 617 | 617 | { OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW, "select EHCI port" }, |
| 618 | 618 | }; |
| 619 | 619 | |
| 620 | +static void __init omap3_evm_wl12xx_init(void) | |
| 621 | +{ | |
| 622 | +#ifdef CONFIG_WL12XX_PLATFORM_DATA | |
| 623 | + int ret; | |
| 624 | + | |
| 625 | + /* WL12xx WLAN Init */ | |
| 626 | + ret = wl12xx_set_platform_data(&omap3evm_wlan_data); | |
| 627 | + if (ret) | |
| 628 | + pr_err("error setting wl12xx data: %d\n", ret); | |
| 629 | + ret = platform_device_register(&omap3evm_wlan_regulator); | |
| 630 | + if (ret) | |
| 631 | + pr_err("error registering wl12xx device: %d\n", ret); | |
| 632 | +#endif | |
| 633 | +} | |
| 634 | + | |
| 620 | 635 | static void __init omap3_evm_init(void) |
| 621 | 636 | { |
| 622 | 637 | omap3_evm_get_revision(); |
| @@ -665,13 +680,7 @@ static void __init omap3_evm_init(void) · 42 unmodified lines | ||
| 665 | 680 | omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL); |
| 666 | 681 | omap3evm_init_smsc911x(); |
| 667 | 682 | omap3_evm_display_init(); |
| 668 | − | |
| 669 | −#ifdef CONFIG_WL12XX_PLATFORM_DATA | |
| 670 | − /* WL12xx WLAN Init */ | |
| 671 | − if (wl12xx_set_platform_data(&omap3evm_wlan_data)) | |
| 672 | − pr_err("error setting wl12xx data\n"); | |
| 673 | − platform_device_register(&omap3evm_wlan_regulator); | |
| 674 | −#endif | |
| 683 | + omap3_evm_wl12xx_init(); | |
| 675 | 684 | } |
| 676 | 685 | |
| 677 | 686 | MACHINE_START(OMAP3EVM, "OMAP3 EVM") |
| @@ -51,8 +51,9 @@ · 50 unmodified lines | ||
| 51 | 51 | #define GPIO_HUB_NRESET 62 |
| 52 | 52 | #define GPIO_WIFI_PMENA 43 |
| 53 | 53 | #define GPIO_WIFI_IRQ 53 |
| 54 | −#define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */ | |
| 54 | +#define HDMI_GPIO_CT_CP_HPD 60 /* HPD mode enable/disable */ | |
| 55 | 55 | #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */ |
| 56 | +#define HDMI_GPIO_HPD 63 /* Hotplug detect */ | |
| 56 | 57 | |
| 57 | 58 | /* wl127x BT, FM, GPS connectivity chip */ |
| 58 | 59 | static int wl1271_gpios[] = {46, -1, -1}; |
| @@ -413,8 +414,9 @@ int __init omap4_panda_dvi_init(void) · 354 unmodified lines | ||
| 413 | 414 | } |
| 414 | 415 | |
| 415 | 416 | static struct gpio panda_hdmi_gpios[] = { |
| 416 | − { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, | |
| 417 | + { HDMI_GPIO_CT_CP_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ct_cp_hpd" }, | |
| 417 | 418 | { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, |
| 419 | + { HDMI_GPIO_HPD, GPIOF_DIR_IN, "hdmi_gpio_hpd" }, | |
| 418 | 420 | }; |
| 419 | 421 | |
| 420 | 422 | static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev) |
| @@ -431,10 +433,13 @@ static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev) · 10 unmodified lines | ||
| 431 | 433 | |
| 432 | 434 | static void omap4_panda_panel_disable_hdmi(struct omap_dss_device *dssdev) |
| 433 | 435 | { |
| 434 | − gpio_free(HDMI_GPIO_LS_OE); | |
| 435 | − gpio_free(HDMI_GPIO_HPD); | |
| 436 | + gpio_free_array(panda_hdmi_gpios, ARRAY_SIZE(panda_hdmi_gpios)); | |
| 436 | 437 | } |
| 437 | 438 | |
| 439 | +static struct omap_dss_hdmi_data omap4_panda_hdmi_data = { | |
| 440 | + .hpd_gpio = HDMI_GPIO_HPD, | |
| 441 | +}; | |
| 442 | + | |
| 438 | 443 | static struct omap_dss_device omap4_panda_hdmi_device = { |
| 439 | 444 | .name = "hdmi", |
| 440 | 445 | .driver_name = "hdmi_panel", |
| @@ -442,6 +447,7 @@ static struct omap_dss_device omap4_panda_hdmi_device = { · 1 unmodified line | ||
| 442 | 447 | .platform_enable = omap4_panda_panel_enable_hdmi, |
| 443 | 448 | .platform_disable = omap4_panda_panel_disable_hdmi, |
| 444 | 449 | .channel = OMAP_DSS_CHANNEL_DIGIT, |
| 450 | + .data = &omap4_panda_hdmi_data, | |
| 445 | 451 | }; |
| 446 | 452 | |
| 447 | 453 | static struct omap_dss_device *omap4_panda_dss_devices[] = { |
| @@ -473,18 +479,24 @@ void omap4_panda_display_init(void) · 25 unmodified lines | ||
| 473 | 479 | omap_hdmi_init(OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP); |
| 474 | 480 | else |
| 475 | 481 | omap_hdmi_init(0); |
| 482 | + | |
| 483 | + omap_mux_init_gpio(HDMI_GPIO_LS_OE, OMAP_PIN_OUTPUT); | |
| 484 | + omap_mux_init_gpio(HDMI_GPIO_CT_CP_HPD, OMAP_PIN_OUTPUT); | |
| 485 | + omap_mux_init_gpio(HDMI_GPIO_HPD, OMAP_PIN_INPUT_PULLDOWN); | |
| 476 | 486 | } |
| 477 | 487 | |
| 478 | 488 | static void __init omap4_panda_init(void) |
| 479 | 489 | { |
| 480 | 490 | int package = OMAP_PACKAGE_CBS; |
| 491 | + int ret; | |
| 481 | 492 | |
| 482 | 493 | if (omap_rev() == OMAP4430_REV_ES1_0) |
| 483 | 494 | package = OMAP_PACKAGE_CBL; |
| 484 | 495 | omap4_mux_init(board_mux, NULL, package); |
| 485 | 496 | |
| 486 | − if (wl12xx_set_platform_data(&omap_panda_wlan_data)) | |
| 487 | − pr_err("error setting wl12xx data\n"); | |
| 497 | + ret = wl12xx_set_platform_data(&omap_panda_wlan_data); | |
| 498 | + if (ret) | |
| 499 | + pr_err("error setting wl12xx data: %d\n", ret); | |
| 488 | 500 | |
| 489 | 501 | omap4_panda_i2c_init(); |
| 490 | 502 | platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); |
| @@ -296,8 +296,10 @@ static void enable_board_wakeup_source(void) · 295 unmodified lines | ||
| 296 | 296 | |
| 297 | 297 | void __init zoom_peripherals_init(void) |
| 298 | 298 | { |
| 299 | − if (wl12xx_set_platform_data(&omap_zoom_wlan_data)) | |
| 300 | − pr_err("error setting wl12xx data\n"); | |
| 299 | + int ret = wl12xx_set_platform_data(&omap_zoom_wlan_data); | |
| 300 | + | |
| 301 | + if (ret) | |
| 302 | + pr_err("error setting wl12xx data: %d\n", ret); | |
| 301 | 303 | |
| 302 | 304 | omap_i2c_init(); |
| 303 | 305 | platform_device_register(&omap_vwlan_device); |
| @@ -405,6 +405,7 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) · 404 unmodified lines | ||
| 405 | 405 | break; |
| 406 | 406 | default: |
| 407 | 407 | pr_err("Invalid McSPI Revision value\n"); |
| 408 | + kfree(pdata); | |
| 408 | 409 | return -EINVAL; |
| 409 | 410 | } |
| 410 | 411 | |
| @@ -103,12 +103,8 @@ static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags) · 102 unmodified lines | ||
| 103 | 103 | u32 reg; |
| 104 | 104 | u16 control_i2c_1; |
| 105 | 105 | |
| 106 | − /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */ | |
| 107 | − omap_mux_init_signal("hdmi_hpd", | |
| 108 | − OMAP_PIN_INPUT_PULLUP); | |
| 109 | 106 | omap_mux_init_signal("hdmi_cec", |
| 110 | 107 | OMAP_PIN_INPUT_PULLUP); |
| 111 | − /* PAD0_HDMI_DDC_SCL_PAD1_HDMI_DDC_SDA */ | |
| 112 | 108 | omap_mux_init_signal("hdmi_ddc_scl", |
| 113 | 109 | OMAP_PIN_INPUT_PULLUP); |
| 114 | 110 | omap_mux_init_signal("hdmi_ddc_sda", |
| @@ -528,7 +528,13 @@ int gpmc_cs_configure(int cs, int cmd, int wval) · 527 unmodified lines | ||
| 528 | 528 | |
| 529 | 529 | case GPMC_CONFIG_DEV_SIZE: |
| 530 | 530 | regval = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); |
| 531 | + | |
| 532 | + /* clear 2 target bits */ | |
| 533 | + regval &= ~GPMC_CONFIG1_DEVICESIZE(3); | |
| 534 | + | |
| 535 | + /* set the proper value */ | |
| 531 | 536 | regval |= GPMC_CONFIG1_DEVICESIZE(wval); |
| 537 | + | |
| 532 | 538 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, regval); |
| 533 | 539 | break; |
| 534 | 540 | |
| @@ -175,14 +175,15 @@ static void hsmmc2_select_input_clk_src(struct omap_mmc_platform_data *mmc) · 174 unmodified lines | ||
| 175 | 175 | { |
| 176 | 176 | u32 reg; |
| 177 | 177 | |
| 178 | − if (mmc->slots[0].internal_clock) { | |
| 179 | − reg = omap_ctrl_readl(control_devconf1_offset); | |
| 178 | + reg = omap_ctrl_readl(control_devconf1_offset); | |
| 179 | + if (mmc->slots[0].internal_clock) | |
| 180 | 180 | reg |= OMAP2_MMCSDIO2ADPCLKISEL; |
| 181 | − omap_ctrl_writel(reg, control_devconf1_offset); | |
| 182 | − } | |
| 181 | + else | |
| 182 | + reg &= ~OMAP2_MMCSDIO2ADPCLKISEL; | |
| 183 | + omap_ctrl_writel(reg, control_devconf1_offset); | |
| 183 | 184 | } |
| 184 | 185 | |
| 185 | −static void hsmmc23_before_set_reg(struct device *dev, int slot, | |
| 186 | +static void hsmmc2_before_set_reg(struct device *dev, int slot, | |
| 186 | 187 | int power_on, int vdd) |
| 187 | 188 | { |
| 188 | 189 | struct omap_mmc_platform_data *mmc = dev->platform_data; |
| @@ -292,8 +293,8 @@ static inline void omap_hsmmc_mux(struct omap_mmc_platform_data *mmc_controller, · 103 unmodified lines | ||
| 292 | 293 | } |
| 293 | 294 | } |
| 294 | 295 | |
| 295 | −static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, | |
| 296 | − struct omap_mmc_platform_data *mmc) | |
| 296 | +static int omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, | |
| 297 | + struct omap_mmc_platform_data *mmc) | |
| 297 | 298 | { |
| 298 | 299 | char *hc_name; |
| 299 | 300 | |
| @@ -407,14 +408,13 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, · 107 unmodified lines | ||
| 407 | 408 | c->caps &= ~MMC_CAP_8_BIT_DATA; |
| 408 | 409 | c->caps |= MMC_CAP_4_BIT_DATA; |
| 409 | 410 | } |
| 410 | − /* FALLTHROUGH */ | |
| 411 | − case 3: | |
| 412 | 411 | if (mmc->slots[0].features & HSMMC_HAS_PBIAS) { |
| 413 | 412 | /* off-chip level shifting, or none */ |
| 414 | − mmc->slots[0].before_set_reg = hsmmc23_before_set_reg; | |
| 413 | + mmc->slots[0].before_set_reg = hsmmc2_before_set_reg; | |
| 415 | 414 | mmc->slots[0].after_set_reg = NULL; |
| 416 | 415 | } |
| 417 | 416 | break; |
| 417 | + case 3: | |
| 418 | 418 | case 4: |
| 419 | 419 | case 5: |
| 420 | 420 | mmc->slots[0].before_set_reg = NULL; |
| @@ -430,7 +430,7 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c, · 9 unmodified lines | ||
| 430 | 430 | |
| 431 | 431 | #define MAX_OMAP_MMC_HWMOD_NAME_LEN 16 |
| 432 | 432 | |
| 433 | −void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) | |
| 433 | +void omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) | |
| 434 | 434 | { |
| 435 | 435 | struct omap_hwmod *oh; |
| 436 | 436 | struct platform_device *pdev; |
| @@ -487,7 +487,7 @@ done: · 50 unmodified lines | ||
| 487 | 487 | kfree(mmc_data); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | −void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) | |
| 490 | +void omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) | |
| 491 | 491 | { |
| 492 | 492 | u32 reg; |
| 493 | 493 | |
| @@ -388,7 +388,7 @@ static void __init omap_hwmod_init_postsetup(void) · 387 unmodified lines | ||
| 388 | 388 | omap_pm_if_early_init(); |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | −#ifdef CONFIG_ARCH_OMAP2 | |
| 391 | +#ifdef CONFIG_SOC_OMAP2420 | |
| 392 | 392 | void __init omap2420_init_early(void) |
| 393 | 393 | { |
| 394 | 394 | omap2_set_globals_242x(); |
| @@ -400,7 +400,9 @@ void __init omap2420_init_early(void) · 5 unmodified lines | ||
| 400 | 400 | omap_hwmod_init_postsetup(); |
| 401 | 401 | omap2420_clk_init(); |
| 402 | 402 | } |
| 403 | +#endif | |
| 403 | 404 | |
| 405 | +#ifdef CONFIG_SOC_OMAP2430 | |
| 404 | 406 | void __init omap2430_init_early(void) |
| 405 | 407 | { |
| 406 | 408 | omap2_set_globals_243x(); |
| @@ -100,8 +100,8 @@ void omap_mux_write_array(struct omap_mux_partition *partition, · 99 unmodified lines | ||
| 100 | 100 | |
| 101 | 101 | static char *omap_mux_options; |
| 102 | 102 | |
| 103 | −static int __init _omap_mux_init_gpio(struct omap_mux_partition *partition, | |
| 104 | − int gpio, int val) | |
| 103 | +static int _omap_mux_init_gpio(struct omap_mux_partition *partition, | |
| 104 | + int gpio, int val) | |
| 105 | 105 | { |
| 106 | 106 | struct omap_mux_entry *e; |
| 107 | 107 | struct omap_mux *gpio_mux = NULL; |
| @@ -145,7 +145,7 @@ static int __init _omap_mux_init_gpio(struct omap_mux_partition *partition, · 37 unmodified lines | ||
| 145 | 145 | return 0; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | −int __init omap_mux_init_gpio(int gpio, int val) | |
| 148 | +int omap_mux_init_gpio(int gpio, int val) | |
| 149 | 149 | { |
| 150 | 150 | struct omap_mux_partition *partition; |
| 151 | 151 | int ret; |
| @@ -159,9 +159,9 @@ int __init omap_mux_init_gpio(int gpio, int val) · 7 unmodified lines | ||
| 159 | 159 | return -ENODEV; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | −static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition, | |
| 163 | − const char *muxname, | |
| 164 | − struct omap_mux **found_mux) | |
| 162 | +static int _omap_mux_get_by_name(struct omap_mux_partition *partition, | |
| 163 | + const char *muxname, | |
| 164 | + struct omap_mux **found_mux) | |
| 165 | 165 | { |
| 166 | 166 | struct omap_mux *mux = NULL; |
| 167 | 167 | struct omap_mux_entry *e; |
| @@ -240,7 +240,7 @@ omap_mux_get_by_name(const char *muxname, · 72 unmodified lines | ||
| 240 | 240 | return -ENODEV; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | −int __init omap_mux_init_signal(const char *muxname, int val) | |
| 243 | +int omap_mux_init_signal(const char *muxname, int val) | |
| 244 | 244 | { |
| 245 | 245 | struct omap_mux_partition *partition = NULL; |
| 246 | 246 | struct omap_mux *mux = NULL; |
| @@ -1094,8 +1094,8 @@ static void omap_mux_init_package(struct omap_mux *superset, · 847 unmodified lines | ||
| 1094 | 1094 | omap_mux_package_init_balls(package_balls, superset); |
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | −static void omap_mux_init_signals(struct omap_mux_partition *partition, | |
| 1098 | − struct omap_board_mux *board_mux) | |
| 1097 | +static void __init omap_mux_init_signals(struct omap_mux_partition *partition, | |
| 1098 | + struct omap_board_mux *board_mux) | |
| 1099 | 1099 | { |
| 1100 | 1100 | omap_mux_set_cmdline_signals(); |
| 1101 | 1101 | omap_mux_write_array(partition, board_mux); |
| @@ -1109,8 +1109,8 @@ static void omap_mux_init_package(struct omap_mux *superset, · 7 unmodified lines | ||
| 1109 | 1109 | { |
| 1110 | 1110 | } |
| 1111 | 1111 | |
| 1112 | −static void omap_mux_init_signals(struct omap_mux_partition *partition, | |
| 1113 | − struct omap_board_mux *board_mux) | |
| 1112 | +static void __init omap_mux_init_signals(struct omap_mux_partition *partition, | |
| 1113 | + struct omap_board_mux *board_mux) | |
| 1114 | 1114 | { |
| 1115 | 1115 | } |
| 1116 | 1116 | |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/linkage.h> |
| 19 | 19 | #include <linux/init.h> |
| 20 | 20 | |
| 21 | + __CPUINIT | |
| 21 | 22 | /* |
| 22 | 23 | * OMAP4 specific entry point for secondary CPU to jump from ROM |
| 23 | 24 | * code. This routine also provides a holding flag into which |
| @@ -1517,8 +1517,8 @@ static int _enable(struct omap_hwmod *oh) · 1516 unmodified lines | ||
| 1517 | 1517 | if (oh->_state != _HWMOD_STATE_INITIALIZED && |
| 1518 | 1518 | oh->_state != _HWMOD_STATE_IDLE && |
| 1519 | 1519 | oh->_state != _HWMOD_STATE_DISABLED) { |
| 1520 | − WARN(1, "omap_hwmod: %s: enabled state can only be entered " | |
| 1521 | − "from initialized, idle, or disabled state\n", oh->name); | |
| 1520 | + WARN(1, "omap_hwmod: %s: enabled state can only be entered from initialized, idle, or disabled state\n", | |
| 1521 | + oh->name); | |
| 1522 | 1522 | return -EINVAL; |
| 1523 | 1523 | } |
| 1524 | 1524 | |
| @@ -1600,8 +1600,8 @@ static int _idle(struct omap_hwmod *oh) · 75 unmodified lines | ||
| 1600 | 1600 | pr_debug("omap_hwmod: %s: idling\n", oh->name); |
| 1601 | 1601 | |
| 1602 | 1602 | if (oh->_state != _HWMOD_STATE_ENABLED) { |
| 1603 | − WARN(1, "omap_hwmod: %s: idle state can only be entered from " | |
| 1604 | − "enabled state\n", oh->name); | |
| 1603 | + WARN(1, "omap_hwmod: %s: idle state can only be entered from enabled state\n", | |
| 1604 | + oh->name); | |
| 1605 | 1605 | return -EINVAL; |
| 1606 | 1606 | } |
| 1607 | 1607 | |
| @@ -1682,8 +1682,8 @@ static int _shutdown(struct omap_hwmod *oh) · 74 unmodified lines | ||
| 1682 | 1682 | |
| 1683 | 1683 | if (oh->_state != _HWMOD_STATE_IDLE && |
| 1684 | 1684 | oh->_state != _HWMOD_STATE_ENABLED) { |
| 1685 | − WARN(1, "omap_hwmod: %s: disabled state can only be entered " | |
| 1686 | − "from idle, or enabled state\n", oh->name); | |
| 1685 | + WARN(1, "omap_hwmod: %s: disabled state can only be entered from idle, or enabled state\n", | |
| 1686 | + oh->name); | |
| 1687 | 1687 | return -EINVAL; |
| 1688 | 1688 | } |
| 1689 | 1689 | |
| @@ -2240,8 +2240,8 @@ void omap_hwmod_ocp_barrier(struct omap_hwmod *oh) · 550 unmodified lines | ||
| 2240 | 2240 | BUG_ON(!oh); |
| 2241 | 2241 | |
| 2242 | 2242 | if (!oh->class->sysc || !oh->class->sysc->sysc_flags) { |
| 2243 | − WARN(1, "omap_device: %s: OCP barrier impossible due to " | |
| 2244 | − "device configuration\n", oh->name); | |
| 2243 | + WARN(1, "omap_device: %s: OCP barrier impossible due to device configuration\n", | |
| 2244 | + oh->name); | |
| 2245 | 2245 | return; |
| 2246 | 2246 | } |
| 2247 | 2247 | |
| @@ -55,27 +55,6 @@ struct omap_hwmod_class omap2_dss_hwmod_class = { · 54 unmodified lines | ||
| 55 | 55 | .reset = omap_dss_reset, |
| 56 | 56 | }; |
| 57 | 57 | |
| 58 | −/* | |
| 59 | − * 'dispc' class | |
| 60 | − * display controller | |
| 61 | − */ | |
| 62 | − | |
| 63 | −static struct omap_hwmod_class_sysconfig omap2_dispc_sysc = { | |
| 64 | − .rev_offs = 0x0000, | |
| 65 | − .sysc_offs = 0x0010, | |
| 66 | − .syss_offs = 0x0014, | |
| 67 | − .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE | | |
| 68 | − SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), | |
| 69 | − .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | |
| 70 | − MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART), | |
| 71 | − .sysc_fields = &omap_hwmod_sysc_type1, | |
| 72 | −}; | |
| 73 | − | |
| 74 | −struct omap_hwmod_class omap2_dispc_hwmod_class = { | |
| 75 | − .name = "dispc", | |
| 76 | − .sysc = &omap2_dispc_sysc, | |
| 77 | −}; | |
| 78 | − | |
| 79 | 58 | /* |
| 80 | 59 | * 'rfbi' class |
| 81 | 60 | * remote frame buffer interface |
| @@ -28,6 +28,28 @@ struct omap_hwmod_dma_info omap2xxx_dss_sdma_chs[] = { · 27 unmodified lines | ||
| 28 | 28 | { .name = "dispc", .dma_req = 5 }, |
| 29 | 29 | { .dma_req = -1 } |
| 30 | 30 | }; |
| 31 | + | |
| 32 | +/* | |
| 33 | + * 'dispc' class | |
| 34 | + * display controller | |
| 35 | + */ | |
| 36 | + | |
| 37 | +static struct omap_hwmod_class_sysconfig omap2_dispc_sysc = { | |
| 38 | + .rev_offs = 0x0000, | |
| 39 | + .sysc_offs = 0x0010, | |
| 40 | + .syss_offs = 0x0014, | |
| 41 | + .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE | | |
| 42 | + SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), | |
| 43 | + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | |
| 44 | + MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART), | |
| 45 | + .sysc_fields = &omap_hwmod_sysc_type1, | |
| 46 | +}; | |
| 47 | + | |
| 48 | +struct omap_hwmod_class omap2_dispc_hwmod_class = { | |
| 49 | + .name = "dispc", | |
| 50 | + .sysc = &omap2_dispc_sysc, | |
| 51 | +}; | |
| 52 | + | |
| 31 | 53 | /* OMAP2xxx Timer Common */ |
| 32 | 54 | static struct omap_hwmod_class_sysconfig omap2xxx_timer_sysc = { |
| 33 | 55 | .rev_offs = 0x0000, |
| @@ -1480,6 +1480,28 @@ static struct omap_hwmod omap3xxx_dss_core_hwmod = { · 1479 unmodified lines | ||
| 1480 | 1480 | .masters_cnt = ARRAY_SIZE(omap3xxx_dss_masters), |
| 1481 | 1481 | }; |
| 1482 | 1482 | |
| 1483 | +/* | |
| 1484 | + * 'dispc' class | |
| 1485 | + * display controller | |
| 1486 | + */ | |
| 1487 | + | |
| 1488 | +static struct omap_hwmod_class_sysconfig omap3_dispc_sysc = { | |
| 1489 | + .rev_offs = 0x0000, | |
| 1490 | + .sysc_offs = 0x0010, | |
| 1491 | + .syss_offs = 0x0014, | |
| 1492 | + .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE | | |
| 1493 | + SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE | | |
| 1494 | + SYSC_HAS_ENAWAKEUP), | |
| 1495 | + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | | |
| 1496 | + MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART), | |
| 1497 | + .sysc_fields = &omap_hwmod_sysc_type1, | |
| 1498 | +}; | |
| 1499 | + | |
| 1500 | +static struct omap_hwmod_class omap3_dispc_hwmod_class = { | |
| 1501 | + .name = "dispc", | |
| 1502 | + .sysc = &omap3_dispc_sysc, | |
| 1503 | +}; | |
| 1504 | + | |
| 1483 | 1505 | /* l4_core -> dss_dispc */ |
| 1484 | 1506 | static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_dispc = { |
| 1485 | 1507 | .master = &omap3xxx_l4_core_hwmod, |
| @@ -1503,7 +1525,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_dss_dispc_slaves[] = { · 17 unmodified lines | ||
| 1503 | 1525 | |
| 1504 | 1526 | static struct omap_hwmod omap3xxx_dss_dispc_hwmod = { |
| 1505 | 1527 | .name = "dss_dispc", |
| 1506 | − .class = &omap2_dispc_hwmod_class, | |
| 1528 | + .class = &omap3_dispc_hwmod_class, | |
| 1507 | 1529 | .mpu_irqs = omap2_dispc_irqs, |
| 1508 | 1530 | .main_clk = "dss1_alwon_fck", |
| 1509 | 1531 | .prcm = { |
| @@ -3523,12 +3545,6 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { · 2013 unmodified lines | ||
| 3523 | 3545 | &omap3xxx_uart2_hwmod, |
| 3524 | 3546 | &omap3xxx_uart3_hwmod, |
| 3525 | 3547 | |
| 3526 | − /* dss class */ | |
| 3527 | − &omap3xxx_dss_dispc_hwmod, | |
| 3528 | − &omap3xxx_dss_dsi1_hwmod, | |
| 3529 | − &omap3xxx_dss_rfbi_hwmod, | |
| 3530 | − &omap3xxx_dss_venc_hwmod, | |
| 3531 | − | |
| 3532 | 3548 | /* i2c class */ |
| 3533 | 3549 | &omap3xxx_i2c1_hwmod, |
| 3534 | 3550 | &omap3xxx_i2c2_hwmod, |
| @@ -3635,6 +3651,15 @@ static __initdata struct omap_hwmod *am35xx_hwmods[] = { · 100 unmodified lines | ||
| 3635 | 3651 | NULL |
| 3636 | 3652 | }; |
| 3637 | 3653 | |
| 3654 | +static __initdata struct omap_hwmod *omap3xxx_dss_hwmods[] = { | |
| 3655 | + /* dss class */ | |
| 3656 | + &omap3xxx_dss_dispc_hwmod, | |
| 3657 | + &omap3xxx_dss_dsi1_hwmod, | |
| 3658 | + &omap3xxx_dss_rfbi_hwmod, | |
| 3659 | + &omap3xxx_dss_venc_hwmod, | |
| 3660 | + NULL | |
| 3661 | +}; | |
| 3662 | + | |
| 3638 | 3663 | int __init omap3xxx_hwmod_init(void) |
| 3639 | 3664 | { |
| 3640 | 3665 | int r; |
| @@ -3708,6 +3733,21 @@ int __init omap3xxx_hwmod_init(void) · 67 unmodified lines | ||
| 3708 | 3733 | |
| 3709 | 3734 | if (h) |
| 3710 | 3735 | r = omap_hwmod_register(h); |
| 3736 | + if (r < 0) | |
| 3737 | + return r; | |
| 3738 | + | |
| 3739 | + /* | |
| 3740 | + * DSS code presumes that dss_core hwmod is handled first, | |
| 3741 | + * _before_ any other DSS related hwmods so register common | |
| 3742 | + * DSS hwmods last to ensure that dss_core is already registered. | |
| 3743 | + * Otherwise some change things may happen, for ex. if dispc | |
| 3744 | + * is handled before dss_core and DSS is enabled in bootloader | |
| 3745 | + * DIPSC will be reset with outputs enabled which sometimes leads | |
| 3746 | + * to unrecoverable L3 error. | |
| 3747 | + * XXX The long-term fix to this is to ensure modules are set up | |
| 3748 | + * in dependency order in the hwmod core code. | |
| 3749 | + */ | |
| 3750 | + r = omap_hwmod_register(omap3xxx_dss_hwmods); | |
| 3711 | 3751 | |
| 3712 | 3752 | return r; |
| 3713 | 3753 | } |
| @@ -1031,6 +1031,7 @@ static struct omap_hwmod_dma_info omap44xx_dmic_sdma_reqs[] = { · 1030 unmodified lines | ||
| 1031 | 1031 | |
| 1032 | 1032 | static struct omap_hwmod_addr_space omap44xx_dmic_addrs[] = { |
| 1033 | 1033 | { |
| 1034 | + .name = "mpu", | |
| 1034 | 1035 | .pa_start = 0x4012e000, |
| 1035 | 1036 | .pa_end = 0x4012e07f, |
| 1036 | 1037 | .flags = ADDR_TYPE_RT |
| @@ -1049,6 +1050,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic = { · 12 unmodified lines | ||
| 1049 | 1050 | |
| 1050 | 1051 | static struct omap_hwmod_addr_space omap44xx_dmic_dma_addrs[] = { |
| 1051 | 1052 | { |
| 1053 | + .name = "dma", | |
| 1052 | 1054 | .pa_start = 0x4902e000, |
| 1053 | 1055 | .pa_end = 0x4902e07f, |
| 1054 | 1056 | .flags = ADDR_TYPE_RT |
| @@ -82,13 +82,7 @@ static int omap2_fclks_active(void) · 81 unmodified lines | ||
| 82 | 82 | f1 = omap2_cm_read_mod_reg(CORE_MOD, CM_FCLKEN1); |
| 83 | 83 | f2 = omap2_cm_read_mod_reg(CORE_MOD, OMAP24XX_CM_FCLKEN2); |
| 84 | 84 | |
| 85 | − /* Ignore UART clocks. These are handled by UART core (serial.c) */ | |
| 86 | − f1 &= ~(OMAP24XX_EN_UART1_MASK | OMAP24XX_EN_UART2_MASK); | |
| 87 | − f2 &= ~OMAP24XX_EN_UART3_MASK; | |
| 88 | − | |
| 89 | − if (f1 | f2) | |
| 90 | − return 1; | |
| 91 | − return 0; | |
| 85 | + return (f1 | f2) ? 1 : 0; | |
| 92 | 86 | } |
| 93 | 87 | |
| 94 | 88 | static void omap2_enter_full_retention(void) |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | #include "common.h" |
| 20 | 20 | #include <plat/cpu.h> |
| 21 | 21 | #include <plat/prcm.h> |
| 22 | +#include <plat/irqs.h> | |
| 22 | 23 | |
| 23 | 24 | #include "vp.h" |
| 24 | 25 | |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | |
| 20 | 20 | #include "common.h" |
| 21 | 21 | #include <plat/cpu.h> |
| 22 | +#include <plat/irqs.h> | |
| 22 | 23 | #include <plat/prcm.h> |
| 23 | 24 | |
| 24 | 25 | #include "vp.h" |
| @@ -107,18 +107,18 @@ static void omap_uart_set_noidle(struct platform_device *pdev) · 106 unmodified lines | ||
| 107 | 107 | omap_hwmod_set_slave_idlemode(od->hwmods[0], HWMOD_IDLEMODE_NO); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | −static void omap_uart_set_forceidle(struct platform_device *pdev) | |
| 110 | +static void omap_uart_set_smartidle(struct platform_device *pdev) | |
| 111 | 111 | { |
| 112 | 112 | struct omap_device *od = to_omap_device(pdev); |
| 113 | 113 | |
| 114 | − omap_hwmod_set_slave_idlemode(od->hwmods[0], HWMOD_IDLEMODE_FORCE); | |
| 114 | + omap_hwmod_set_slave_idlemode(od->hwmods[0], HWMOD_IDLEMODE_SMART); | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | #else |
| 118 | 118 | static void omap_uart_enable_wakeup(struct platform_device *pdev, bool enable) |
| 119 | 119 | {} |
| 120 | 120 | static void omap_uart_set_noidle(struct platform_device *pdev) {} |
| 121 | −static void omap_uart_set_forceidle(struct platform_device *pdev) {} | |
| 121 | +static void omap_uart_set_smartidle(struct platform_device *pdev) {} | |
| 122 | 122 | #endif /* CONFIG_PM */ |
| 123 | 123 | |
| 124 | 124 | #ifdef CONFIG_OMAP_MUX |
| @@ -349,7 +349,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata, · 224 unmodified lines | ||
| 349 | 349 | omap_up.uartclk = OMAP24XX_BASE_BAUD * 16; |
| 350 | 350 | omap_up.flags = UPF_BOOT_AUTOCONF; |
| 351 | 351 | omap_up.get_context_loss_count = omap_pm_get_dev_context_loss_count; |
| 352 | − omap_up.set_forceidle = omap_uart_set_forceidle; | |
| 352 | + omap_up.set_forceidle = omap_uart_set_smartidle; | |
| 353 | 353 | omap_up.set_noidle = omap_uart_set_noidle; |
| 354 | 354 | omap_up.enable_wakeup = omap_uart_enable_wakeup; |
| 355 | 355 | omap_up.dma_rx_buf_size = info->dma_rx_buf_size; |
| @@ -897,7 +897,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) · 896 unmodified lines | ||
| 897 | 897 | ret = sr_late_init(sr_info); |
| 898 | 898 | if (ret) { |
| 899 | 899 | pr_warning("%s: Error in SR late init\n", __func__); |
| 900 | − return ret; | |
| 900 | + goto err_iounmap; | |
| 901 | 901 | } |
| 902 | 902 | } |
| 903 | 903 | |
| @@ -270,7 +270,7 @@ static struct clocksource clocksource_gpt = { · 269 unmodified lines | ||
| 270 | 270 | static u32 notrace dmtimer_read_sched_clock(void) |
| 271 | 271 | { |
| 272 | 272 | if (clksrc.reserved) |
| 273 | − return __omap_dm_timer_read_counter(clksrc.io_base, 1); | |
| 273 | + return __omap_dm_timer_read_counter(&clksrc, 1); | |
| 274 | 274 | |
| 275 | 275 | return 0; |
| 276 | 276 | } |
| @@ -247,7 +247,7 @@ static void __init omap4_vc_init_channel(struct voltagedomain *voltdm) · 246 unmodified lines | ||
| 247 | 247 | * omap_vc_i2c_init - initialize I2C interface to PMIC |
| 248 | 248 | * @voltdm: voltage domain containing VC data |
| 249 | 249 | * |
| 250 | − * Use PMIC supplied seetings for I2C high-speed mode and | |
| 250 | + * Use PMIC supplied settings for I2C high-speed mode and | |
| 251 | 251 | * master code (if set) and program the VC I2C configuration |
| 252 | 252 | * register. |
| 253 | 253 | * |
| @@ -265,8 +265,8 @@ static void __init omap_vc_i2c_init(struct voltagedomain *voltdm) · 11 unmodified lines | ||
| 265 | 265 | |
| 266 | 266 | if (initialized) { |
| 267 | 267 | if (voltdm->pmic->i2c_high_speed != i2c_high_speed) |
| 268 | − pr_warn("%s: I2C config for all channels must match.", | |
| 269 | − __func__); | |
| 268 | + pr_warn("%s: I2C config for vdd_%s does not match other channels (%u).", | |
| 269 | + __func__, voltdm->name, i2c_high_speed); | |
| 270 | 270 | return; |
| 271 | 271 | } |
| 272 | 272 | |
| @@ -292,9 +292,7 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm) · 19 unmodified lines | ||
| 292 | 292 | u32 val; |
| 293 | 293 | |
| 294 | 294 | if (!voltdm->pmic || !voltdm->pmic->uv_to_vsel) { |
| 295 | − pr_err("%s: PMIC info requried to configure vc for" | |
| 296 | − "vdd_%s not populated.Hence cannot initialize vc\n", | |
| 297 | − __func__, voltdm->name); | |
| 295 | + pr_err("%s: No PMIC info for vdd_%s\n", __func__, voltdm->name); | |
| 298 | 296 | return; |
| 299 | 297 | } |
| 300 | 298 | |
| @@ -108,6 +108,7 @@ void __init omap3xxx_voltagedomains_init(void) · 107 unmodified lines | ||
| 108 | 108 | * XXX Will depend on the process, validation, and binning |
| 109 | 109 | * for the currently-running IC |
| 110 | 110 | */ |
| 111 | +#ifdef CONFIG_PM_OPP | |
| 111 | 112 | if (cpu_is_omap3630()) { |
| 112 | 113 | omap3_voltdm_mpu.volt_data = omap36xx_vddmpu_volt_data; |
| 113 | 114 | omap3_voltdm_core.volt_data = omap36xx_vddcore_volt_data; |
| @@ -115,6 +116,7 @@ void __init omap3xxx_voltagedomains_init(void) · 1 unmodified line | ||
| 115 | 116 | omap3_voltdm_mpu.volt_data = omap34xx_vddmpu_volt_data; |
| 116 | 117 | omap3_voltdm_core.volt_data = omap34xx_vddcore_volt_data; |
| 117 | 118 | } |
| 119 | +#endif | |
| 118 | 120 | |
| 119 | 121 | if (cpu_is_omap3517() || cpu_is_omap3505()) |
| 120 | 122 | voltdms = voltagedomains_am35xx; |
| @@ -100,9 +100,11 @@ void __init omap44xx_voltagedomains_init(void) · 99 unmodified lines | ||
| 100 | 100 | * XXX Will depend on the process, validation, and binning |
| 101 | 101 | * for the currently-running IC |
| 102 | 102 | */ |
| 103 | +#ifdef CONFIG_PM_OPP | |
| 103 | 104 | omap4_voltdm_mpu.volt_data = omap44xx_vdd_mpu_volt_data; |
| 104 | 105 | omap4_voltdm_iva.volt_data = omap44xx_vdd_iva_volt_data; |
| 105 | 106 | omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data; |
| 107 | +#endif | |
| 106 | 108 | |
| 107 | 109 | for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++) |
| 108 | 110 | voltdm->sys_clk.name = sys_clk_name; |
| @@ -41,6 +41,11 @@ void __init omap_vp_init(struct voltagedomain *voltdm) · 40 unmodified lines | ||
| 41 | 41 | u32 val, sys_clk_rate, timeout, waittime; |
| 42 | 42 | u32 vddmin, vddmax, vstepmin, vstepmax; |
| 43 | 43 | |
| 44 | + if (!voltdm->pmic || !voltdm->pmic->uv_to_vsel) { | |
| 45 | + pr_err("%s: No PMIC info for vdd_%s\n", __func__, voltdm->name); | |
| 46 | + return; | |
| 47 | + } | |
| 48 | + | |
| 44 | 49 | if (!voltdm->read || !voltdm->write) { |
| 45 | 50 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", |
| 46 | 51 | __func__, voltdm->name); |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include <mach/hardware.h> |
| 30 | 30 | #include <mach/orion5x.h> |
| 31 | 31 | #include <plat/orion_nand.h> |
| 32 | +#include <plat/ehci-orion.h> | |
| 32 | 33 | #include <plat/time.h> |
| 33 | 34 | #include <plat/common.h> |
| 34 | 35 | #include <plat/addr-map.h> |
| @@ -72,7 +73,8 @@ void __init orion5x_map_io(void) · 37 unmodified lines | ||
| 72 | 73 | ****************************************************************************/ |
| 73 | 74 | void __init orion5x_ehci0_init(void) |
| 74 | 75 | { |
| 75 | − orion_ehci_init(ORION5X_USB0_PHYS_BASE, IRQ_ORION5X_USB0_CTRL); | |
| 76 | + orion_ehci_init(ORION5X_USB0_PHYS_BASE, IRQ_ORION5X_USB0_CTRL, | |
| 77 | + EHCI_PHY_ORION); | |
| 76 | 78 | } |
| 77 | 79 | |
| 78 | 80 | |
| @@ -115,7 +115,8 @@ static struct s3c_cpufreq_info s3c2410_cpufreq_info = { · 114 unmodified lines | ||
| 115 | 115 | .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs), |
| 116 | 116 | }; |
| 117 | 117 | |
| 118 | −static int s3c2410_cpufreq_add(struct device *dev) | |
| 118 | +static int s3c2410_cpufreq_add(struct device *dev, | |
| 119 | + struct subsys_interface *sif) | |
| 119 | 120 | { |
| 120 | 121 | return s3c_cpufreq_register(&s3c2410_cpufreq_info); |
| 121 | 122 | } |
| @@ -133,7 +134,8 @@ static int __init s3c2410_cpufreq_init(void) · 11 unmodified lines | ||
| 133 | 134 | |
| 134 | 135 | arch_initcall(s3c2410_cpufreq_init); |
| 135 | 136 | |
| 136 | −static int s3c2410a_cpufreq_add(struct device *dev) | |
| 137 | +static int s3c2410a_cpufreq_add(struct device *dev, | |
| 138 | + struct subsys_interface *sif) | |
| 137 | 139 | { |
| 138 | 140 | /* alter the maximum freq settings for S3C2410A. If a board knows |
| 139 | 141 | * it only has a maximum of 200, then it should register its own |
| @@ -144,7 +146,7 @@ static int s3c2410a_cpufreq_add(struct device *dev) · 4 unmodified lines | ||
| 144 | 146 | s3c2410_cpufreq_info.max.pclk = 66500000; |
| 145 | 147 | s3c2410_cpufreq_info.name = "s3c2410a"; |
| 146 | 148 | |
| 147 | − return s3c2410_cpufreq_add(dev); | |
| 149 | + return s3c2410_cpufreq_add(dev, sif); | |
| 148 | 150 | } |
| 149 | 151 | |
| 150 | 152 | static struct subsys_interface s3c2410a_cpufreq_interface = { |
| @@ -132,7 +132,8 @@ static struct s3c24xx_dma_order __initdata s3c2410_dma_order = { · 131 unmodified lines | ||
| 132 | 132 | }, |
| 133 | 133 | }; |
| 134 | 134 | |
| 135 | −static int __init s3c2410_dma_add(struct device *dev) | |
| 135 | +static int __init s3c2410_dma_add(struct device *dev, | |
| 136 | + struct subsys_interface *sif) | |
| 136 | 137 | { |
| 137 | 138 | s3c2410_dma_init(); |
| 138 | 139 | s3c24xx_dma_order_set(&s3c2410_dma_order); |
| @@ -148,7 +149,7 @@ static struct subsys_interface s3c2410_dma_interface = { · 9 unmodified lines | ||
| 148 | 149 | |
| 149 | 150 | static int __init s3c2410_dma_drvinit(void) |
| 150 | 151 | { |
| 151 | − return subsys_interface_register(&s3c2410_interface); | |
| 152 | + return subsys_interface_register(&s3c2410_dma_interface); | |
| 152 | 153 | } |
| 153 | 154 | |
| 154 | 155 | arch_initcall(s3c2410_dma_drvinit); |
| @@ -66,7 +66,7 @@ static struct cpufreq_frequency_table pll_vals_12MHz[] = { · 65 unmodified lines | ||
| 66 | 66 | { .frequency = 270000000, .index = PLLVAL(127, 1, 1), }, |
| 67 | 67 | }; |
| 68 | 68 | |
| 69 | −static int s3c2410_plls_add(struct device *dev) | |
| 69 | +static int s3c2410_plls_add(struct device *dev, struct subsys_interface *sif) | |
| 70 | 70 | { |
| 71 | 71 | return s3c_plltab_register(pll_vals_12MHz, ARRAY_SIZE(pll_vals_12MHz)); |
| 72 | 72 | } |
| @@ -111,7 +111,7 @@ struct syscore_ops s3c2410_pm_syscore_ops = { · 110 unmodified lines | ||
| 111 | 111 | .resume = s3c2410_pm_resume, |
| 112 | 112 | }; |
| 113 | 113 | |
| 114 | −static int s3c2410_pm_add(struct device *dev) | |
| 114 | +static int s3c2410_pm_add(struct device *dev, struct subsys_interface *sif) | |
| 115 | 115 | { |
| 116 | 116 | pm_cpu_prep = s3c2410_pm_prepare; |
| 117 | 117 | pm_cpu_sleep = s3c2410_cpu_suspend; |
| @@ -194,7 +194,8 @@ static struct s3c_cpufreq_info s3c2412_cpufreq_info = { · 193 unmodified lines | ||
| 194 | 194 | .debug_io_show = s3c_cpufreq_debugfs_call(s3c2412_iotiming_debugfs), |
| 195 | 195 | }; |
| 196 | 196 | |
| 197 | −static int s3c2412_cpufreq_add(struct device *dev) | |
| 197 | +static int s3c2412_cpufreq_add(struct device *dev, | |
| 198 | + struct subsys_interface *sif) | |
| 198 | 199 | { |
| 199 | 200 | unsigned long fclk_rate; |
| 200 | 201 | |
| @@ -159,7 +159,8 @@ static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = { · 158 unmodified lines | ||
| 159 | 159 | .map_size = ARRAY_SIZE(s3c2412_dma_mappings), |
| 160 | 160 | }; |
| 161 | 161 | |
| 162 | −static int __init s3c2412_dma_add(struct device *dev) | |
| 162 | +static int __init s3c2412_dma_add(struct device *dev, | |
| 163 | + struct subsys_interface *sif) | |
| 163 | 164 | { |
| 164 | 165 | s3c2410_dma_init(); |
| 165 | 166 | return s3c24xx_dma_init_map(&s3c2412_dma_sel); |
| @@ -170,7 +170,7 @@ static int s3c2412_irq_rtc_wake(struct irq_data *data, unsigned int state) · 169 unmodified lines | ||
| 170 | 170 | |
| 171 | 171 | static struct irq_chip s3c2412_irq_rtc_chip; |
| 172 | 172 | |
| 173 | −static int s3c2412_irq_add(struct device *dev) | |
| 173 | +static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif) | |
| 174 | 174 | { |
| 175 | 175 | unsigned int irqno; |
| 176 | 176 | |
| @@ -56,7 +56,7 @@ static void s3c2412_pm_prepare(void) · 55 unmodified lines | ||
| 56 | 56 | { |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | −static int s3c2412_pm_add(struct device *dev) | |
| 59 | +static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif) | |
| 60 | 60 | { |
| 61 | 61 | pm_cpu_prep = s3c2412_pm_prepare; |
| 62 | 62 | pm_cpu_sleep = s3c2412_cpu_suspend; |
| @@ -213,7 +213,8 @@ static int __init s3c2416_add_sub(unsigned int base, · 212 unmodified lines | ||
| 213 | 213 | return 0; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | −static int __init s3c2416_irq_add(struct device *dev) | |
| 216 | +static int __init s3c2416_irq_add(struct device *dev, | |
| 217 | + struct subsys_interface *sif) | |
| 217 | 218 | { |
| 218 | 219 | printk(KERN_INFO "S3C2416: IRQ Support\n"); |
| 219 | 220 | |
| @@ -48,7 +48,7 @@ static void s3c2416_pm_prepare(void) · 47 unmodified lines | ||
| 48 | 48 | __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | −static int s3c2416_pm_add(struct device *dev) | |
| 51 | +static int s3c2416_pm_add(struct device *dev, struct subsys_interface *sif) | |
| 52 | 52 | { |
| 53 | 53 | pm_cpu_prep = s3c2416_pm_prepare; |
| 54 | 54 | pm_cpu_sleep = s3c2416_cpu_suspend; |
| @@ -149,7 +149,7 @@ static struct clk_lookup s3c2440_clk_lookup[] = { · 148 unmodified lines | ||
| 149 | 149 | CLKDEV_INIT(NULL, "clk_uart_baud3", &s3c2440_clk_fclk_n), |
| 150 | 150 | }; |
| 151 | 151 | |
| 152 | −static int s3c2440_clk_add(struct device *dev) | |
| 152 | +static int s3c2440_clk_add(struct device *dev, struct subsys_interface *sif) | |
| 153 | 153 | { |
| 154 | 154 | struct clk *clock_upll; |
| 155 | 155 | struct clk *clock_h; |
| @@ -174,7 +174,8 @@ static struct s3c24xx_dma_order __initdata s3c2440_dma_order = { · 173 unmodified lines | ||
| 174 | 174 | }, |
| 175 | 175 | }; |
| 176 | 176 | |
| 177 | −static int __init s3c2440_dma_add(struct device *dev) | |
| 177 | +static int __init s3c2440_dma_add(struct device *dev, | |
| 178 | + struct subsys_interface *sif) | |
| 178 | 179 | { |
| 179 | 180 | s3c2410_dma_init(); |
| 180 | 181 | s3c24xx_dma_order_set(&s3c2440_dma_order); |
| @@ -92,7 +92,7 @@ static struct irq_chip s3c_irq_wdtac97 = { · 91 unmodified lines | ||
| 92 | 92 | .irq_ack = s3c_irq_wdtac97_ack, |
| 93 | 93 | }; |
| 94 | 94 | |
| 95 | −static int s3c2440_irq_add(struct device *dev) | |
| 95 | +static int s3c2440_irq_add(struct device *dev, struct subsys_interface *sif) | |
| 96 | 96 | { |
| 97 | 97 | unsigned int irqno; |
| 98 | 98 | |
| @@ -270,7 +270,8 @@ struct s3c_cpufreq_info s3c2440_cpufreq_info = { · 269 unmodified lines | ||
| 270 | 270 | .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs), |
| 271 | 271 | }; |
| 272 | 272 | |
| 273 | −static int s3c2440_cpufreq_add(struct device *dev) | |
| 273 | +static int s3c2440_cpufreq_add(struct device *dev, | |
| 274 | + struct subsys_interface *sif) | |
| 274 | 275 | { |
| 275 | 276 | xtal = s3c_cpufreq_clk_get(NULL, "xtal"); |
| 276 | 277 | hclk = s3c_cpufreq_clk_get(NULL, "hclk"); |
| @@ -51,7 +51,7 @@ static struct cpufreq_frequency_table s3c2440_plls_12[] __initdata = { · 50 unmodified lines | ||
| 51 | 51 | { .frequency = 400000000, .index = PLLVAL(0x5c, 1, 1), }, /* FVco 800.000000 */ |
| 52 | 52 | }; |
| 53 | 53 | |
| 54 | −static int s3c2440_plls12_add(struct device *dev) | |
| 54 | +static int s3c2440_plls12_add(struct device *dev, struct subsys_interface *sif) | |
| 55 | 55 | { |
| 56 | 56 | struct clk *xtal_clk; |
| 57 | 57 | unsigned long xtal; |
| @@ -79,7 +79,8 @@ static struct cpufreq_frequency_table s3c2440_plls_169344[] __initdata = { · 78 unmodified lines | ||
| 79 | 79 | { .frequency = 402192000, .index = PLLVAL(87, 2, 1), }, /* FVco 804.384000 */ |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | −static int s3c2440_plls169344_add(struct device *dev) | |
| 82 | +static int s3c2440_plls169344_add(struct device *dev, | |
| 83 | + struct subsys_interface *sif) | |
| 83 | 84 | { |
| 84 | 85 | struct clk *xtal_clk; |
| 85 | 86 | unsigned long xtal; |
| @@ -122,7 +122,7 @@ static struct clk s3c2442_clk_cam_upll = { · 121 unmodified lines | ||
| 122 | 122 | }, |
| 123 | 123 | }; |
| 124 | 124 | |
| 125 | −static int s3c2442_clk_add(struct device *dev) | |
| 125 | +static int s3c2442_clk_add(struct device *dev, struct subsys_interface *sif) | |
| 126 | 126 | { |
| 127 | 127 | struct clk *clock_upll; |
| 128 | 128 | struct clk *clock_h; |
| @@ -72,7 +72,7 @@ static struct clk clk_arm = { · 71 unmodified lines | ||
| 72 | 72 | }, |
| 73 | 73 | }; |
| 74 | 74 | |
| 75 | −static int s3c244x_clk_add(struct device *dev) | |
| 75 | +static int s3c244x_clk_add(struct device *dev, struct subsys_interface *sif) | |
| 76 | 76 | { |
| 77 | 77 | unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); |
| 78 | 78 | unsigned long clkdivn; |
| @@ -91,7 +91,7 @@ static struct irq_chip s3c_irq_cam = { · 90 unmodified lines | ||
| 91 | 91 | .irq_ack = s3c_irq_cam_ack, |
| 92 | 92 | }; |
| 93 | 93 | |
| 94 | −static int s3c244x_irq_add(struct device *dev) | |
| 94 | +static int s3c244x_irq_add(struct device *dev, struct subsys_interface *sif) | |
| 95 | 95 | { |
| 96 | 96 | unsigned int irqno; |
| 97 | 97 | |
| @@ -135,7 +135,8 @@ static struct s3c24xx_dma_selection __initdata s3c2443_dma_sel = { · 134 unmodified lines | ||
| 135 | 135 | .map_size = ARRAY_SIZE(s3c2443_dma_mappings), |
| 136 | 136 | }; |
| 137 | 137 | |
| 138 | −static int __init s3c2443_dma_add(struct device *dev) | |
| 138 | +static int __init s3c2443_dma_add(struct device *dev, | |
| 139 | + struct subsys_interface *sif) | |
| 139 | 140 | { |
| 140 | 141 | s3c24xx_dma_init(6, IRQ_S3C2443_DMA0, 0x100); |
| 141 | 142 | return s3c24xx_dma_init_map(&s3c2443_dma_sel); |
| @@ -241,7 +241,8 @@ static int __init s3c2443_add_sub(unsigned int base, · 240 unmodified lines | ||
| 241 | 241 | return 0; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | −static int __init s3c2443_irq_add(struct device *dev) | |
| 244 | +static int __init s3c2443_irq_add(struct device *dev, | |
| 245 | + struct subsys_interface *sif) | |
| 245 | 246 | { |
| 246 | 247 | printk("S3C2443: IRQ Support\n"); |
| 247 | 248 | |
| @@ -138,6 +138,11 @@ static struct clk init_clocks_off[] = { · 137 unmodified lines | ||
| 138 | 138 | .ctrlbit = S3C_CLKCON_PCLK_TSADC, |
| 139 | 139 | }, { |
| 140 | 140 | .name = "i2c", |
| 141 | +#ifdef CONFIG_S3C_DEV_I2C1 | |
| 142 | + .devname = "s3c2440-i2c.0", | |
| 143 | +#else | |
| 144 | + .devname = "s3c2440-i2c", | |
| 145 | +#endif | |
| 141 | 146 | .parent = &clk_p, |
| 142 | 147 | .enable = s3c64xx_pclk_ctrl, |
| 143 | 148 | .ctrlbit = S3C_CLKCON_PCLK_IIC, |
| @@ -49,7 +49,7 @@ · 48 unmodified lines | ||
| 49 | 49 | |
| 50 | 50 | /* uart registration process */ |
| 51 | 51 | |
| 52 | −void __init s3c64xx_init_uarts(struct s3c2410_uartcfg *cfg, int no) | |
| 52 | +static void __init s3c64xx_init_uarts(struct s3c2410_uartcfg *cfg, int no) | |
| 53 | 53 | { |
| 54 | 54 | s3c24xx_init_uartdevs("s3c6400-uart", s3c64xx_uart_resources, cfg, no); |
| 55 | 55 | } |
| @@ -160,7 +160,7 @@ static void s5p64x0_pm_prepare(void) · 159 unmodified lines | ||
| 160 | 160 | |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | −static int s5p64x0_pm_add(struct device *dev) | |
| 163 | +static int s5p64x0_pm_add(struct device *dev, struct subsys_interface *sif) | |
| 164 | 164 | { |
| 165 | 165 | pm_cpu_prep = s5p64x0_pm_prepare; |
| 166 | 166 | pm_cpu_sleep = s5p64x0_cpu_suspend; |
| @@ -175,7 +175,7 @@ static int s5pv210_clk_mask1_ctrl(struct clk *clk, int enable) · 174 unmodified lines | ||
| 175 | 175 | return s5p_gatectrl(S5P_CLK_SRC_MASK1, clk, enable); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | −static int exynos4_clk_hdmiphy_ctrl(struct clk *clk, int enable) | |
| 178 | +static int s5pv210_clk_hdmiphy_ctrl(struct clk *clk, int enable) | |
| 179 | 179 | { |
| 180 | 180 | return s5p_gatectrl(S5P_HDMI_PHY_CONTROL, clk, enable); |
| 181 | 181 | } |
| @@ -372,7 +372,7 @@ static struct clk init_clocks_off[] = { · 190 unmodified lines | ||
| 372 | 372 | }, { |
| 373 | 373 | .name = "hdmiphy", |
| 374 | 374 | .devname = "s5pv210-hdmi", |
| 375 | − .enable = exynos4_clk_hdmiphy_ctrl, | |
| 375 | + .enable = s5pv210_clk_hdmiphy_ctrl, | |
| 376 | 376 | .ctrlbit = (1 << 0), |
| 377 | 377 | }, { |
| 378 | 378 | .name = "dacphy", |
| @@ -133,7 +133,7 @@ static void s5pv210_pm_prepare(void) · 132 unmodified lines | ||
| 133 | 133 | s3c_pm_do_save(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save)); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | −static int s5pv210_pm_add(struct device *dev) | |
| 136 | +static int s5pv210_pm_add(struct device *dev, struct subsys_interface *sif) | |
| 137 | 137 | { |
| 138 | 138 | pm_cpu_prep = s5pv210_pm_prepare; |
| 139 | 139 | pm_cpu_sleep = s5pv210_cpu_suspend; |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | #include <linux/serial_sci.h> |
| 31 | 31 | #include <linux/smsc911x.h> |
| 32 | 32 | #include <linux/gpio.h> |
| 33 | +#include <linux/videodev2.h> | |
| 33 | 34 | #include <linux/input.h> |
| 34 | 35 | #include <linux/input/sh_keysc.h> |
| 35 | 36 | #include <linux/mmc/host.h> |
| @@ -37,7 +38,6 @@ · 1 unmodified line | ||
| 37 | 38 | #include <linux/mmc/sh_mobile_sdhi.h> |
| 38 | 39 | #include <linux/mfd/tmio.h> |
| 39 | 40 | #include <linux/sh_clk.h> |
| 40 | −#include <linux/dma-mapping.h> | |
| 41 | 41 | #include <video/sh_mobile_lcdc.h> |
| 42 | 42 | #include <video/sh_mipi_dsi.h> |
| 43 | 43 | #include <sound/sh_fsi.h> |
| @@ -159,19 +159,12 @@ static struct resource sh_mmcif_resources[] = { · 115 unmodified lines | ||
| 159 | 159 | }, |
| 160 | 160 | }; |
| 161 | 161 | |
| 162 | −static struct sh_mmcif_dma sh_mmcif_dma = { | |
| 163 | − .chan_priv_rx = { | |
| 164 | − .slave_id = SHDMA_SLAVE_MMCIF_RX, | |
| 165 | − }, | |
| 166 | − .chan_priv_tx = { | |
| 167 | − .slave_id = SHDMA_SLAVE_MMCIF_TX, | |
| 168 | − }, | |
| 169 | −}; | |
| 170 | 162 | static struct sh_mmcif_plat_data sh_mmcif_platdata = { |
| 171 | 163 | .sup_pclk = 0, |
| 172 | 164 | .ocr = MMC_VDD_165_195, |
| 173 | 165 | .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, |
| 174 | − .dma = &sh_mmcif_dma, | |
| 166 | + .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, | |
| 167 | + .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, | |
| 175 | 168 | }; |
| 176 | 169 | |
| 177 | 170 | static struct platform_device mmc_device = { |
| @@ -321,12 +314,11 @@ static struct resource mipidsi0_resources[] = { · 143 unmodified lines | ||
| 321 | 314 | }, |
| 322 | 315 | }; |
| 323 | 316 | |
| 324 | −#define DSI0PHYCR 0xe615006c | |
| 325 | 317 | static int sh_mipi_set_dot_clock(struct platform_device *pdev, |
| 326 | 318 | void __iomem *base, |
| 327 | 319 | int enable) |
| 328 | 320 | { |
| 329 | − struct clk *pck; | |
| 321 | + struct clk *pck, *phy; | |
| 330 | 322 | int ret; |
| 331 | 323 | |
| 332 | 324 | pck = clk_get(&pdev->dev, "dsip_clk"); |
| @@ -335,18 +327,27 @@ static int sh_mipi_set_dot_clock(struct platform_device *pdev, · 2 unmodified lines | ||
| 335 | 327 | goto sh_mipi_set_dot_clock_pck_err; |
| 336 | 328 | } |
| 337 | 329 | |
| 330 | + phy = clk_get(&pdev->dev, "dsiphy_clk"); | |
| 331 | + if (IS_ERR(phy)) { | |
| 332 | + ret = PTR_ERR(phy); | |
| 333 | + goto sh_mipi_set_dot_clock_phy_err; | |
| 334 | + } | |
| 335 | + | |
| 338 | 336 | if (enable) { |
| 339 | 337 | clk_set_rate(pck, clk_round_rate(pck, 24000000)); |
| 340 | − __raw_writel(0x2a809010, DSI0PHYCR); | |
| 338 | + clk_set_rate(phy, clk_round_rate(pck, 510000000)); | |
| 341 | 339 | clk_enable(pck); |
| 340 | + clk_enable(phy); | |
| 342 | 341 | } else { |
| 343 | 342 | clk_disable(pck); |
| 343 | + clk_disable(phy); | |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | ret = 0; |
| 347 | 347 | |
| 348 | + clk_put(phy); | |
| 349 | +sh_mipi_set_dot_clock_phy_err: | |
| 348 | 350 | clk_put(pck); |
| 349 | − | |
| 350 | 351 | sh_mipi_set_dot_clock_pck_err: |
| 351 | 352 | return ret; |
| 352 | 353 | } |
| @@ -295,15 +295,6 @@ static struct resource sh_mmcif_resources[] = { · 294 unmodified lines | ||
| 295 | 295 | }, |
| 296 | 296 | }; |
| 297 | 297 | |
| 298 | −static struct sh_mmcif_dma sh_mmcif_dma = { | |
| 299 | − .chan_priv_rx = { | |
| 300 | − .slave_id = SHDMA_SLAVE_MMCIF_RX, | |
| 301 | − }, | |
| 302 | − .chan_priv_tx = { | |
| 303 | − .slave_id = SHDMA_SLAVE_MMCIF_TX, | |
| 304 | − }, | |
| 305 | −}; | |
| 306 | − | |
| 307 | 298 | static struct sh_mmcif_plat_data sh_mmcif_plat = { |
| 308 | 299 | .sup_pclk = 0, |
| 309 | 300 | .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, |
| @@ -311,7 +302,8 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = { · 1 unmodified line | ||
| 311 | 302 | MMC_CAP_8_BIT_DATA | |
| 312 | 303 | MMC_CAP_NEEDS_POLL, |
| 313 | 304 | .get_cd = slot_cn7_get_cd, |
| 314 | − .dma = &sh_mmcif_dma, | |
| 305 | + .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, | |
| 306 | + .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, | |
| 315 | 307 | }; |
| 316 | 308 | |
| 317 | 309 | static struct platform_device sh_mmcif_device = { |
| @@ -143,11 +143,10 @@ static struct gpio_keys_button gpio_buttons[] = { · 142 unmodified lines | ||
| 143 | 143 | static struct gpio_keys_platform_data gpio_key_info = { |
| 144 | 144 | .buttons = gpio_buttons, |
| 145 | 145 | .nbuttons = ARRAY_SIZE(gpio_buttons), |
| 146 | − .poll_interval = 250, /* polled for now */ | |
| 147 | 146 | }; |
| 148 | 147 | |
| 149 | 148 | static struct platform_device gpio_keys_device = { |
| 150 | − .name = "gpio-keys-polled", /* polled for now */ | |
| 149 | + .name = "gpio-keys", | |
| 151 | 150 | .id = -1, |
| 152 | 151 | .dev = { |
| 153 | 152 | .platform_data = &gpio_key_info, |
| @@ -43,7 +43,6 @@ · 42 unmodified lines | ||
| 43 | 43 | #include <linux/smsc911x.h> |
| 44 | 44 | #include <linux/sh_intc.h> |
| 45 | 45 | #include <linux/tca6416_keypad.h> |
| 46 | −#include <linux/usb/r8a66597.h> | |
| 47 | 46 | #include <linux/usb/renesas_usbhs.h> |
| 48 | 47 | #include <linux/dma-mapping.h> |
| 49 | 48 | |
| @@ -145,11 +144,6 @@ · 95 unmodified lines | ||
| 145 | 144 | * 1-2 short | VBUS 5V | Host |
| 146 | 145 | * open | external VBUS | Function |
| 147 | 146 | * |
| 148 | − * *1 | |
| 149 | − * CN31 is used as | |
| 150 | − * CONFIG_USB_R8A66597_HCD Host | |
| 151 | − * CONFIG_USB_RENESAS_USBHS Function | |
| 152 | − * | |
| 153 | 147 | * CAUTION |
| 154 | 148 | * |
| 155 | 149 | * renesas_usbhs driver can use external interrupt mode |
| @@ -161,15 +155,6 @@ · 5 unmodified lines | ||
| 161 | 155 | * mackerel can not use external interrupt (IRQ7-PORT167) mode on "USB0", |
| 162 | 156 | * because Touchscreen is using IRQ7-PORT40. |
| 163 | 157 | * It is impossible to use IRQ7 demux on this board. |
| 164 | − * | |
| 165 | − * We can use external interrupt mode USB-Function on "USB1". | |
| 166 | − * USB1 can become Host by r8a66597, and become Function by renesas_usbhs. | |
| 167 | − * But don't select both drivers in same time. | |
| 168 | − * These uses same IRQ number for request_irq(), and aren't supporting | |
| 169 | − * IRQF_SHARED / IORESOURCE_IRQ_SHAREABLE. | |
| 170 | − * | |
| 171 | − * Actually these are old/new version of USB driver. | |
| 172 | − * This mean its register will be broken if it supports shared IRQ, | |
| 173 | 158 | */ |
| 174 | 159 | |
| 175 | 160 | /* |
| @@ -207,6 +192,16 @@ · 31 unmodified lines | ||
| 207 | 192 | * |
| 208 | 193 | */ |
| 209 | 194 | |
| 195 | +/* | |
| 196 | + * FSI - AK4642 | |
| 197 | + * | |
| 198 | + * it needs amixer settings for playing | |
| 199 | + * | |
| 200 | + * amixer set "Headphone" on | |
| 201 | + * amixer set "HPOUTL Mixer DACH" on | |
| 202 | + * amixer set "HPOUTR Mixer DACH" on | |
| 203 | + */ | |
| 204 | + | |
| 210 | 205 | /* |
| 211 | 206 | * FIXME !! |
| 212 | 207 | * |
| @@ -676,51 +671,16 @@ static struct platform_device usbhs0_device = { · 463 unmodified lines | ||
| 676 | 671 | * Use J30 to select between Host and Function. This setting |
| 677 | 672 | * can however not be detected by software. Hotplug of USBHS1 |
| 678 | 673 | * is provided via IRQ8. |
| 674 | + * | |
| 675 | + * Current USB1 works as "USB Host". | |
| 676 | + * - set J30 "short" | |
| 677 | + * | |
| 678 | + * If you want to use it as "USB gadget", | |
| 679 | + * - J30 "open" | |
| 680 | + * - modify usbhs1_get_id() USBHS_HOST -> USBHS_GADGET | |
| 681 | + * - add .get_vbus = usbhs_get_vbus in usbhs1_private | |
| 679 | 682 | */ |
| 680 | 683 | #define IRQ8 evt2irq(0x0300) |
| 681 | − | |
| 682 | −/* USBHS1 USB Host support via r8a66597_hcd */ | |
| 683 | −static void usb1_host_port_power(int port, int power) | |
| 684 | −{ | |
| 685 | − if (!power) /* only power-on is supported for now */ | |
| 686 | − return; | |
| 687 | − | |
| 688 | − /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */ | |
| 689 | − __raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008); | |
| 690 | −} | |
| 691 | − | |
| 692 | −static struct r8a66597_platdata usb1_host_data = { | |
| 693 | − .on_chip = 1, | |
| 694 | − .port_power = usb1_host_port_power, | |
| 695 | −}; | |
| 696 | − | |
| 697 | −static struct resource usb1_host_resources[] = { | |
| 698 | − [0] = { | |
| 699 | − .name = "USBHS1", | |
| 700 | − .start = 0xe68b0000, | |
| 701 | − .end = 0xe68b00e6 - 1, | |
| 702 | − .flags = IORESOURCE_MEM, | |
| 703 | − }, | |
| 704 | − [1] = { | |
| 705 | − .start = evt2irq(0x1ce0) /* USB1_USB1I0 */, | |
| 706 | − .flags = IORESOURCE_IRQ, | |
| 707 | − }, | |
| 708 | −}; | |
| 709 | − | |
| 710 | −static struct platform_device usb1_host_device = { | |
| 711 | − .name = "r8a66597_hcd", | |
| 712 | − .id = 1, | |
| 713 | − .dev = { | |
| 714 | − .dma_mask = NULL, /* not use dma */ | |
| 715 | − .coherent_dma_mask = 0xffffffff, | |
| 716 | − .platform_data = &usb1_host_data, | |
| 717 | − }, | |
| 718 | − .num_resources = ARRAY_SIZE(usb1_host_resources), | |
| 719 | − .resource = usb1_host_resources, | |
| 720 | −}; | |
| 721 | − | |
| 722 | −/* USBHS1 USB Function support via renesas_usbhs */ | |
| 723 | − | |
| 724 | 684 | #define USB_PHY_MODE (1 << 4) |
| 725 | 685 | #define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) |
| 726 | 686 | #define USB_PHY_ON (1 << 1) |
| @@ -776,7 +736,7 @@ static void usbhs1_hardware_exit(struct platform_device *pdev) · 49 unmodified lines | ||
| 776 | 736 | |
| 777 | 737 | static int usbhs1_get_id(struct platform_device *pdev) |
| 778 | 738 | { |
| 779 | − return USBHS_GADGET; | |
| 739 | + return USBHS_HOST; | |
| 780 | 740 | } |
| 781 | 741 | |
| 782 | 742 | static u32 usbhs1_pipe_cfg[] = { |
| @@ -807,7 +767,6 @@ static struct usbhs_private usbhs1_private = { · 24 unmodified lines | ||
| 807 | 767 | .hardware_exit = usbhs1_hardware_exit, |
| 808 | 768 | .get_id = usbhs1_get_id, |
| 809 | 769 | .phy_reset = usbhs_phy_reset, |
| 810 | − .get_vbus = usbhs_get_vbus, | |
| 811 | 770 | }, |
| 812 | 771 | .driver_param = { |
| 813 | 772 | .buswait_bwait = 4, |
| @@ -1184,15 +1143,6 @@ static struct resource sh_mmcif_resources[] = { · 370 unmodified lines | ||
| 1184 | 1143 | }, |
| 1185 | 1144 | }; |
| 1186 | 1145 | |
| 1187 | −static struct sh_mmcif_dma sh_mmcif_dma = { | |
| 1188 | − .chan_priv_rx = { | |
| 1189 | − .slave_id = SHDMA_SLAVE_MMCIF_RX, | |
| 1190 | − }, | |
| 1191 | − .chan_priv_tx = { | |
| 1192 | − .slave_id = SHDMA_SLAVE_MMCIF_TX, | |
| 1193 | − }, | |
| 1194 | −}; | |
| 1195 | − | |
| 1196 | 1146 | static struct sh_mmcif_plat_data sh_mmcif_plat = { |
| 1197 | 1147 | .sup_pclk = 0, |
| 1198 | 1148 | .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, |
| @@ -1200,7 +1150,8 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = { · 1 unmodified line | ||
| 1200 | 1150 | MMC_CAP_8_BIT_DATA | |
| 1201 | 1151 | MMC_CAP_NEEDS_POLL, |
| 1202 | 1152 | .get_cd = slot_cn7_get_cd, |
| 1203 | − .dma = &sh_mmcif_dma, | |
| 1153 | + .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, | |
| 1154 | + .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, | |
| 1204 | 1155 | }; |
| 1205 | 1156 | |
| 1206 | 1157 | static struct platform_device sh_mmcif_device = { |
| @@ -1311,7 +1262,6 @@ static struct platform_device *mackerel_devices[] __initdata = { · 104 unmodified lines | ||
| 1311 | 1262 | &nor_flash_device, |
| 1312 | 1263 | &smc911x_device, |
| 1313 | 1264 | &lcdc_device, |
| 1314 | − &usb1_host_device, | |
| 1315 | 1265 | &usbhs1_device, |
| 1316 | 1266 | &usbhs0_device, |
| 1317 | 1267 | &leds_device, |
| @@ -1473,9 +1423,6 @@ static void __init mackerel_init(void) · 155 unmodified lines | ||
| 1473 | 1423 | gpio_pull_down(GPIO_PORT167CR); /* VBUS0_1 pull down */ |
| 1474 | 1424 | gpio_request(GPIO_FN_IDIN_1_113, NULL); |
| 1475 | 1425 | |
| 1476 | − /* USB phy tweak to make the r8a66597_hcd host driver work */ | |
| 1477 | − __raw_writew(0x8a0a, 0xe6058130); /* USBCR4 */ | |
| 1478 | − | |
| 1479 | 1426 | /* enable FSI2 port A (ak4643) */ |
| 1480 | 1427 | gpio_request(GPIO_FN_FSIAIBT, NULL); |
| 1481 | 1428 | gpio_request(GPIO_FN_FSIAILR, NULL); |
| @@ -365,6 +365,114 @@ static struct clk div6_clks[DIV6_NR] = { · 364 unmodified lines | ||
| 365 | 365 | dsi_parent, ARRAY_SIZE(dsi_parent), 12, 3), |
| 366 | 366 | }; |
| 367 | 367 | |
| 368 | +/* DSI DIV */ | |
| 369 | +static unsigned long dsiphy_recalc(struct clk *clk) | |
| 370 | +{ | |
| 371 | + u32 value; | |
| 372 | + | |
| 373 | + value = __raw_readl(clk->mapping->base); | |
| 374 | + | |
| 375 | + /* FIXME */ | |
| 376 | + if (!(value & 0x000B8000)) | |
| 377 | + return clk->parent->rate; | |
| 378 | + | |
| 379 | + value &= 0x3f; | |
| 380 | + value += 1; | |
| 381 | + | |
| 382 | + if ((value < 12) || | |
| 383 | + (value > 33)) { | |
| 384 | + pr_err("DSIPHY has wrong value (%d)", value); | |
| 385 | + return 0; | |
| 386 | + } | |
| 387 | + | |
| 388 | + return clk->parent->rate / value; | |
| 389 | +} | |
| 390 | + | |
| 391 | +static long dsiphy_round_rate(struct clk *clk, unsigned long rate) | |
| 392 | +{ | |
| 393 | + return clk_rate_mult_range_round(clk, 12, 33, rate); | |
| 394 | +} | |
| 395 | + | |
| 396 | +static void dsiphy_disable(struct clk *clk) | |
| 397 | +{ | |
| 398 | + u32 value; | |
| 399 | + | |
| 400 | + value = __raw_readl(clk->mapping->base); | |
| 401 | + value &= ~0x000B8000; | |
| 402 | + | |
| 403 | + __raw_writel(value , clk->mapping->base); | |
| 404 | +} | |
| 405 | + | |
| 406 | +static int dsiphy_enable(struct clk *clk) | |
| 407 | +{ | |
| 408 | + u32 value; | |
| 409 | + int multi; | |
| 410 | + | |
| 411 | + value = __raw_readl(clk->mapping->base); | |
| 412 | + multi = (value & 0x3f) + 1; | |
| 413 | + | |
| 414 | + if ((multi < 12) || (multi > 33)) | |
| 415 | + return -EIO; | |
| 416 | + | |
| 417 | + __raw_writel(value | 0x000B8000, clk->mapping->base); | |
| 418 | + | |
| 419 | + return 0; | |
| 420 | +} | |
| 421 | + | |
| 422 | +static int dsiphy_set_rate(struct clk *clk, unsigned long rate) | |
| 423 | +{ | |
| 424 | + u32 value; | |
| 425 | + int idx; | |
| 426 | + | |
| 427 | + idx = rate / clk->parent->rate; | |
| 428 | + if ((idx < 12) || (idx > 33)) | |
| 429 | + return -EINVAL; | |
| 430 | + | |
| 431 | + idx += -1; | |
| 432 | + | |
| 433 | + value = __raw_readl(clk->mapping->base); | |
| 434 | + value = (value & ~0x3f) + idx; | |
| 435 | + | |
| 436 | + __raw_writel(value, clk->mapping->base); | |
| 437 | + | |
| 438 | + return 0; | |
| 439 | +} | |
| 440 | + | |
| 441 | +static struct clk_ops dsiphy_clk_ops = { | |
| 442 | + .recalc = dsiphy_recalc, | |
| 443 | + .round_rate = dsiphy_round_rate, | |
| 444 | + .set_rate = dsiphy_set_rate, | |
| 445 | + .enable = dsiphy_enable, | |
| 446 | + .disable = dsiphy_disable, | |
| 447 | +}; | |
| 448 | + | |
| 449 | +static struct clk_mapping dsi0phy_clk_mapping = { | |
| 450 | + .phys = DSI0PHYCR, | |
| 451 | + .len = 4, | |
| 452 | +}; | |
| 453 | + | |
| 454 | +static struct clk_mapping dsi1phy_clk_mapping = { | |
| 455 | + .phys = DSI1PHYCR, | |
| 456 | + .len = 4, | |
| 457 | +}; | |
| 458 | + | |
| 459 | +static struct clk dsi0phy_clk = { | |
| 460 | + .ops = &dsiphy_clk_ops, | |
| 461 | + .parent = &div6_clks[DIV6_DSI0P], /* late install */ | |
| 462 | + .mapping = &dsi0phy_clk_mapping, | |
| 463 | +}; | |
| 464 | + | |
| 465 | +static struct clk dsi1phy_clk = { | |
| 466 | + .ops = &dsiphy_clk_ops, | |
| 467 | + .parent = &div6_clks[DIV6_DSI1P], /* late install */ | |
| 468 | + .mapping = &dsi1phy_clk_mapping, | |
| 469 | +}; | |
| 470 | + | |
| 471 | +static struct clk *late_main_clks[] = { | |
| 472 | + &dsi0phy_clk, | |
| 473 | + &dsi1phy_clk, | |
| 474 | +}; | |
| 475 | + | |
| 368 | 476 | enum { MSTP001, |
| 369 | 477 | MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100, |
| 370 | 478 | MSTP219, |
| @@ -429,6 +537,8 @@ static struct clk_lookup lookups[] = { · 58 unmodified lines | ||
| 429 | 537 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), |
| 430 | 538 | CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), |
| 431 | 539 | CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), |
| 540 | + CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk), | |
| 541 | + CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk), | |
| 432 | 542 | |
| 433 | 543 | /* MSTP32 clocks */ |
| 434 | 544 | CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ |
| @@ -504,6 +614,9 @@ void __init sh73a0_clock_init(void) · 69 unmodified lines | ||
| 504 | 614 | if (!ret) |
| 505 | 615 | ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); |
| 506 | 616 | |
| 617 | + for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++) | |
| 618 | + ret = clk_register(late_main_clks[k]); | |
| 619 | + | |
| 507 | 620 | clkdev_add_table(lookups, ARRAY_SIZE(lookups)); |
| 508 | 621 | |
| 509 | 622 | if (!ret) |
| @@ -515,8 +515,8 @@ enum { · 514 unmodified lines | ||
| 515 | 515 | SHDMA_SLAVE_MMCIF_RX, |
| 516 | 516 | }; |
| 517 | 517 | |
| 518 | −/* PINT interrupts are located at Linux IRQ 768 and up */ | |
| 519 | −#define SH73A0_PINT0_IRQ(irq) ((irq) + 768) | |
| 520 | −#define SH73A0_PINT1_IRQ(irq) ((irq) + 800) | |
| 518 | +/* PINT interrupts are located at Linux IRQ 800 and up */ | |
| 519 | +#define SH73A0_PINT0_IRQ(irq) ((irq) + 800) | |
| 520 | +#define SH73A0_PINT1_IRQ(irq) ((irq) + 832) | |
| 521 | 521 | |
| 522 | 522 | #endif /* __ASM_SH73A0_H__ */ |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | ||
| 19 | 19 | #include <linux/kernel.h> |
| 20 | 20 | #include <linux/init.h> |
| 21 | 21 | #include <linux/interrupt.h> |
| 22 | +#include <linux/module.h> | |
| 22 | 23 | #include <linux/irq.h> |
| 23 | 24 | #include <linux/io.h> |
| 24 | 25 | #include <linux/sh_intc.h> |
| @@ -445,6 +446,7 @@ void __init sh73a0_init_irq(void) · 420 unmodified lines | ||
| 445 | 446 | setup_irq(gic_spi(1 + k), &sh73a0_irq_pin_cascade[k]); |
| 446 | 447 | |
| 447 | 448 | n = intcs_evt2irq(to_intc_vect(gic_spi(1 + k))); |
| 449 | + WARN_ON(irq_alloc_desc_at(n, numa_node_id()) != n); | |
| 448 | 450 | irq_set_chip_and_handler_name(n, &intca_gic_irq_chip, |
| 449 | 451 | handle_level_irq, "level"); |
| 450 | 452 | set_irq_flags(n, IRQF_VALID); /* yuck */ |
| @@ -2120,7 +2120,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = { · 2119 unmodified lines | ||
| 2120 | 2120 | FN_AUDATA3, 0, 0, 0 } |
| 2121 | 2121 | }, |
| 2122 | 2122 | { PINMUX_CFG_REG_VAR("IPSR4", 0xfffc0030, 32, |
| 2123 | − 3, 1, 1, 1, 1, 1, 1, 3, 3, 1, | |
| 2123 | + 3, 1, 1, 1, 1, 1, 1, 3, 3, | |
| 2124 | 2124 | 1, 1, 1, 1, 1, 1, 3, 3, 3, 2) { |
| 2125 | 2125 | /* IP4_31_29 [3] */ |
| 2126 | 2126 | FN_DU1_DB0, FN_VI2_DATA4_VI2_B4, FN_SCL2_B, FN_SD3_DAT0, |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <linux/init.h> |
| 24 | 24 | #include <linux/kernel.h> |
| 25 | 25 | #include <linux/gpio.h> |
| 26 | +#include <mach/irqs.h> | |
| 26 | 27 | #include <mach/sh7372.h> |
| 27 | 28 | |
| 28 | 29 | #define CPU_ALL_PORT(fn, pfx, sfx) \ |
| @@ -1594,6 +1595,43 @@ static struct pinmux_data_reg pinmux_data_regs[] = { · 1565 unmodified lines | ||
| 1594 | 1595 | { }, |
| 1595 | 1596 | }; |
| 1596 | 1597 | |
| 1598 | +#define EXT_IRQ16L(n) evt2irq(0x200 + ((n) << 5)) | |
| 1599 | +#define EXT_IRQ16H(n) evt2irq(0x3200 + (((n) - 16) << 5)) | |
| 1600 | +static struct pinmux_irq pinmux_irqs[] = { | |
| 1601 | + PINMUX_IRQ(EXT_IRQ16L(0), PORT6_FN0, PORT162_FN0), | |
| 1602 | + PINMUX_IRQ(EXT_IRQ16L(1), PORT12_FN0), | |
| 1603 | + PINMUX_IRQ(EXT_IRQ16L(2), PORT4_FN0, PORT5_FN0), | |
| 1604 | + PINMUX_IRQ(EXT_IRQ16L(3), PORT8_FN0, PORT16_FN0), | |
| 1605 | + PINMUX_IRQ(EXT_IRQ16L(4), PORT17_FN0, PORT163_FN0), | |
| 1606 | + PINMUX_IRQ(EXT_IRQ16L(5), PORT18_FN0), | |
| 1607 | + PINMUX_IRQ(EXT_IRQ16L(6), PORT39_FN0, PORT164_FN0), | |
| 1608 | + PINMUX_IRQ(EXT_IRQ16L(7), PORT40_FN0, PORT167_FN0), | |
| 1609 | + PINMUX_IRQ(EXT_IRQ16L(8), PORT41_FN0, PORT168_FN0), | |
| 1610 | + PINMUX_IRQ(EXT_IRQ16L(9), PORT42_FN0, PORT169_FN0), | |
| 1611 | + PINMUX_IRQ(EXT_IRQ16L(10), PORT65_FN0), | |
| 1612 | + PINMUX_IRQ(EXT_IRQ16L(11), PORT67_FN0), | |
| 1613 | + PINMUX_IRQ(EXT_IRQ16L(12), PORT80_FN0, PORT137_FN0), | |
| 1614 | + PINMUX_IRQ(EXT_IRQ16L(13), PORT81_FN0, PORT145_FN0), | |
| 1615 | + PINMUX_IRQ(EXT_IRQ16L(14), PORT82_FN0, PORT146_FN0), | |
| 1616 | + PINMUX_IRQ(EXT_IRQ16L(15), PORT83_FN0, PORT147_FN0), | |
| 1617 | + PINMUX_IRQ(EXT_IRQ16H(16), PORT84_FN0, PORT170_FN0), | |
| 1618 | + PINMUX_IRQ(EXT_IRQ16H(17), PORT85_FN0), | |
| 1619 | + PINMUX_IRQ(EXT_IRQ16H(18), PORT86_FN0), | |
| 1620 | + PINMUX_IRQ(EXT_IRQ16H(19), PORT87_FN0), | |
| 1621 | + PINMUX_IRQ(EXT_IRQ16H(20), PORT92_FN0), | |
| 1622 | + PINMUX_IRQ(EXT_IRQ16H(21), PORT93_FN0), | |
| 1623 | + PINMUX_IRQ(EXT_IRQ16H(22), PORT94_FN0), | |
| 1624 | + PINMUX_IRQ(EXT_IRQ16H(23), PORT95_FN0), | |
| 1625 | + PINMUX_IRQ(EXT_IRQ16H(24), PORT112_FN0), | |
| 1626 | + PINMUX_IRQ(EXT_IRQ16H(25), PORT119_FN0), | |
| 1627 | + PINMUX_IRQ(EXT_IRQ16H(26), PORT121_FN0, PORT172_FN0), | |
| 1628 | + PINMUX_IRQ(EXT_IRQ16H(27), PORT122_FN0, PORT180_FN0), | |
| 1629 | + PINMUX_IRQ(EXT_IRQ16H(28), PORT123_FN0, PORT181_FN0), | |
| 1630 | + PINMUX_IRQ(EXT_IRQ16H(29), PORT129_FN0, PORT182_FN0), | |
| 1631 | + PINMUX_IRQ(EXT_IRQ16H(30), PORT130_FN0, PORT183_FN0), | |
| 1632 | + PINMUX_IRQ(EXT_IRQ16H(31), PORT138_FN0, PORT184_FN0), | |
| 1633 | +}; | |
| 1634 | + | |
| 1597 | 1635 | static struct pinmux_info sh7372_pinmux_info = { |
| 1598 | 1636 | .name = "sh7372_pfc", |
| 1599 | 1637 | .reserved_id = PINMUX_RESERVED, |
| @@ -1614,6 +1652,9 @@ static struct pinmux_info sh7372_pinmux_info = { · 14 unmodified lines | ||
| 1614 | 1652 | |
| 1615 | 1653 | .gpio_data = pinmux_data, |
| 1616 | 1654 | .gpio_data_size = ARRAY_SIZE(pinmux_data), |
| 1655 | + | |
| 1656 | + .gpio_irq = pinmux_irqs, | |
| 1657 | + .gpio_irq_size = ARRAY_SIZE(pinmux_irqs), | |
| 1617 | 1658 | }; |
| 1618 | 1659 | |
| 1619 | 1660 | void sh7372_pinmux_init(void) |
| @@ -662,6 +662,7 @@ static struct sh_dmae_pdata usb_dma0_platform_data = { · 661 unmodified lines | ||
| 662 | 662 | .dmaor_is_32bit = 1, |
| 663 | 663 | .needs_tend_set = 1, |
| 664 | 664 | .no_dmars = 1, |
| 665 | + .slave_only = 1, | |
| 665 | 666 | }; |
| 666 | 667 | |
| 667 | 668 | static struct resource sh7372_usb_dmae0_resources[] = { |
| @@ -723,6 +724,7 @@ static struct sh_dmae_pdata usb_dma1_platform_data = { · 55 unmodified lines | ||
| 723 | 724 | .dmaor_is_32bit = 1, |
| 724 | 725 | .needs_tend_set = 1, |
| 725 | 726 | .no_dmars = 1, |
| 727 | + .slave_only = 1, | |
| 726 | 728 | }; |
| 727 | 729 | |
| 728 | 730 | static struct resource sh7372_usb_dmae1_resources[] = { |
| @@ -80,7 +80,7 @@ int __cpuinit sh73a0_boot_secondary(unsigned int cpu) · 79 unmodified lines | ||
| 80 | 80 | /* enable cache coherency */ |
| 81 | 81 | modify_scu_cpu_psr(0, 3 << (cpu * 8)); |
| 82 | 82 | |
| 83 | − if (((__raw_readw(__io(PSTR)) >> (4 * cpu)) & 3) == 3) | |
| 83 | + if (((__raw_readl(__io(PSTR)) >> (4 * cpu)) & 3) == 3) | |
| 84 | 84 | __raw_writel(1 << cpu, __io(WUPCR)); /* wake up */ |
| 85 | 85 | else |
| 86 | 86 | __raw_writel(1 << cpu, __io(SRESCR)); /* reset */ |
| @@ -60,9 +60,9 @@ static struct plat_serial8250_port debug_uart_platform_data[] = { · 59 unmodified lines | ||
| 60 | 60 | .uartclk = 216000000, |
| 61 | 61 | }, { |
| 62 | 62 | /* serial port on mini-pcie */ |
| 63 | − .membase = IO_ADDRESS(TEGRA_UARTD_BASE), | |
| 64 | − .mapbase = TEGRA_UARTD_BASE, | |
| 65 | − .irq = INT_UARTD, | |
| 63 | + .membase = IO_ADDRESS(TEGRA_UARTC_BASE), | |
| 64 | + .mapbase = TEGRA_UARTC_BASE, | |
| 65 | + .irq = INT_UARTC, | |
| 66 | 66 | .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE, |
| 67 | 67 | .type = PORT_TEGRA, |
| 68 | 68 | .iotype = UPIO_MEM, |
| @@ -174,7 +174,7 @@ static void __init tegra_paz00_fixup(struct tag *tags, char **cmdline, · 105 unmodified lines | ||
| 174 | 174 | static __initdata struct tegra_clk_init_table paz00_clk_init_table[] = { |
| 175 | 175 | /* name parent rate enabled */ |
| 176 | 176 | { "uarta", "pll_p", 216000000, true }, |
| 177 | − { "uartd", "pll_p", 216000000, true }, | |
| 177 | + { "uartc", "pll_p", 216000000, true }, | |
| 178 | 178 | |
| 179 | 179 | { "pll_p_out4", "pll_p", 24000000, true }, |
| 180 | 180 | { "usbd", "clk_m", 12000000, false }, |
| @@ -22,7 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | /* SDCARD */ |
| 23 | 23 | #define TEGRA_GPIO_SD1_CD TEGRA_GPIO_PV5 |
| 24 | 24 | #define TEGRA_GPIO_SD1_WP TEGRA_GPIO_PH1 |
| 25 | −#define TEGRA_GPIO_SD1_POWER TEGRA_GPIO_PT3 | |
| 25 | +#define TEGRA_GPIO_SD1_POWER TEGRA_GPIO_PV1 | |
| 26 | 26 | |
| 27 | 27 | /* ULPI */ |
| 28 | 28 | #define TEGRA_ULPI_RST TEGRA_GPIO_PV0 |
| @@ -23,11 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | |
| 24 | 24 | #include <linux/list.h> |
| 25 | 25 | |
| 26 | −#if defined(CONFIG_TEGRA_SYSTEM_DMA) | |
| 27 | − | |
| 28 | −struct tegra_dma_req; | |
| 29 | −struct tegra_dma_channel; | |
| 30 | − | |
| 31 | 26 | #define TEGRA_DMA_REQ_SEL_CNTR 0 |
| 32 | 27 | #define TEGRA_DMA_REQ_SEL_I2S_2 1 |
| 33 | 28 | #define TEGRA_DMA_REQ_SEL_I2S_1 2 |
| @@ -56,6 +51,11 @@ struct tegra_dma_channel; · 22 unmodified lines | ||
| 56 | 51 | #define TEGRA_DMA_REQ_SEL_OWR 25 |
| 57 | 52 | #define TEGRA_DMA_REQ_SEL_INVALID 31 |
| 58 | 53 | |
| 54 | +#if defined(CONFIG_TEGRA_SYSTEM_DMA) | |
| 55 | + | |
| 56 | +struct tegra_dma_req; | |
| 57 | +struct tegra_dma_channel; | |
| 58 | + | |
| 59 | 59 | enum tegra_dma_mode { |
| 60 | 60 | TEGRA_DMA_SHARED = 1, |
| 61 | 61 | TEGRA_DMA_MODE_CONTINOUS = 2, |
| @@ -631,7 +631,8 @@ comment "Processor Features" · 630 unmodified lines | ||
| 631 | 631 | |
| 632 | 632 | config ARM_LPAE |
| 633 | 633 | bool "Support for the Large Physical Address Extension" |
| 634 | − depends on MMU && CPU_V7 | |
| 634 | + depends on MMU && CPU_32v7 && !CPU_32v6 && !CPU_32v5 && \ | |
| 635 | + !CPU_32v4 && !CPU_32v3 | |
| 635 | 636 | help |
| 636 | 637 | Say Y if you have an ARMv7 processor supporting the LPAE page |
| 637 | 638 | table format and you would like to access memory beyond the |
| @@ -54,9 +54,15 @@ loop1: · 53 unmodified lines | ||
| 54 | 54 | and r1, r1, #7 @ mask of the bits for current cache only |
| 55 | 55 | cmp r1, #2 @ see what cache we have at this level |
| 56 | 56 | blt skip @ skip if no cache, or just i-cache |
| 57 | +#ifdef CONFIG_PREEMPT | |
| 58 | + save_and_disable_irqs_notrace r9 @ make cssr&csidr read atomic | |
| 59 | +#endif | |
| 57 | 60 | mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr |
| 58 | 61 | isb @ isb to sych the new cssr&csidr |
| 59 | 62 | mrc p15, 1, r1, c0, c0, 0 @ read the new csidr |
| 63 | +#ifdef CONFIG_PREEMPT | |
| 64 | + restore_irqs_notrace r9 | |
| 65 | +#endif | |
| 60 | 66 | and r2, r1, #7 @ extract the length of the cache lines |
| 61 | 67 | add r2, r2, #4 @ add 4 (line length offset) |
| 62 | 68 | ldr r4, =0x3ff |
| @@ -225,8 +225,7 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn, · 224 unmodified lines | ||
| 225 | 225 | if ((area->flags & VM_ARM_MTYPE_MASK) != VM_ARM_MTYPE(mtype)) |
| 226 | 226 | continue; |
| 227 | 227 | if (__phys_to_pfn(area->phys_addr) > pfn || |
| 228 | − __pfn_to_phys(pfn) + offset + size-1 > | |
| 229 | − area->phys_addr + area->size-1) | |
| 228 | + __pfn_to_phys(pfn) + size-1 > area->phys_addr + area->size-1) | |
| 230 | 229 | continue; |
| 231 | 230 | /* we can drop the lock here as we know *area is static */ |
| 232 | 231 | read_unlock(&vmlist_lock); |
| @@ -3,7 +3,7 @@ · 2 unmodified lines | ||
| 3 | 3 | |
| 4 | 4 | #include <linux/types.h> |
| 5 | 5 | |
| 6 | −#ifdef CONFIG_ARCH_OMAP2PLUS | |
| 6 | +#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) | |
| 7 | 7 | extern int omap_secure_ram_reserve_memblock(void); |
| 8 | 8 | #else |
| 9 | 9 | static inline void omap_secure_ram_reserve_memblock(void) |
| @@ -789,10 +789,7 @@ void __init orion_xor1_init(unsigned long mapbase_low, · 788 unmodified lines | ||
| 789 | 789 | /***************************************************************************** |
| 790 | 790 | * EHCI |
| 791 | 791 | ****************************************************************************/ |
| 792 | −static struct orion_ehci_data orion_ehci_data = { | |
| 793 | − .phy_version = EHCI_PHY_NA, | |
| 794 | −}; | |
| 795 | − | |
| 792 | +static struct orion_ehci_data orion_ehci_data; | |
| 796 | 793 | static u64 ehci_dmamask = DMA_BIT_MASK(32); |
| 797 | 794 | |
| 798 | 795 | |
| @@ -812,8 +809,10 @@ static struct platform_device orion_ehci = { · 13 unmodified lines | ||
| 812 | 809 | }; |
| 813 | 810 | |
| 814 | 811 | void __init orion_ehci_init(unsigned long mapbase, |
| 815 | − unsigned long irq) | |
| 812 | + unsigned long irq, | |
| 813 | + enum orion_ehci_phy_ver phy_version) | |
| 816 | 814 | { |
| 815 | + orion_ehci_data.phy_version = phy_version; | |
| 817 | 816 | fill_resources(&orion_ehci, orion_ehci_resources, mapbase, SZ_4K - 1, |
| 818 | 817 | irq); |
| 819 | 818 | |
| @@ -89,7 +89,8 @@ void __init orion_xor1_init(unsigned long mapbase_low, · 88 unmodified lines | ||
| 89 | 89 | unsigned long irq_1); |
| 90 | 90 | |
| 91 | 91 | void __init orion_ehci_init(unsigned long mapbase, |
| 92 | − unsigned long irq); | |
| 92 | + unsigned long irq, | |
| 93 | + enum orion_ehci_phy_ver phy_version); | |
| 93 | 94 | |
| 94 | 95 | void __init orion_ehci_1_init(unsigned long mapbase, |
| 95 | 96 | unsigned long irq); |
| @@ -64,8 +64,7 @@ void __init orion_mpp_conf(unsigned int *mpp_list, unsigned int variant_mask, · 63 unmodified lines | ||
| 64 | 64 | gpio_mode |= GPIO_INPUT_OK; |
| 65 | 65 | if (*mpp_list & MPP_OUTPUT_MASK) |
| 66 | 66 | gpio_mode |= GPIO_OUTPUT_OK; |
| 67 | − if (sel != 0) | |
| 68 | − gpio_mode = 0; | |
| 67 | + | |
| 69 | 68 | orion_gpio_set_valid(num, gpio_mode); |
| 70 | 69 | } |
| 71 | 70 | |
| @@ -468,8 +468,10 @@ void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd) · 467 unmodified lines | ||
| 468 | 468 | { |
| 469 | 469 | struct s3c2410_platform_i2c *npd; |
| 470 | 470 | |
| 471 | − if (!pd) | |
| 471 | + if (!pd) { | |
| 472 | 472 | pd = &default_i2c_data; |
| 473 | + pd->bus_num = 0; | |
| 474 | + } | |
| 473 | 475 | |
| 474 | 476 | npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c), |
| 475 | 477 | &s3c_device_i2c0); |
| @@ -8,6 +8,7 @@ config AVR32 · 7 unmodified lines | ||
| 8 | 8 | select HAVE_KPROBES |
| 9 | 9 | select HAVE_GENERIC_HARDIRQS |
| 10 | 10 | select GENERIC_IRQ_PROBE |
| 11 | + select GENERIC_ATOMIC64 | |
| 11 | 12 | select HARDIRQS_SW_RESEND |
| 12 | 13 | select GENERIC_IRQ_SHOW |
| 13 | 14 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
| @@ -13,7 +13,7 @@ obj-y += linked_dtb.o · 12 unmodified lines | ||
| 13 | 13 | endif |
| 14 | 14 | |
| 15 | 15 | $(obj)/%.dtb: $(src)/dts/%.dts FORCE |
| 16 | − $(call cmd,dtc) | |
| 16 | + $(call if_changed_dep,dtc) | |
| 17 | 17 | |
| 18 | 18 | quiet_cmd_cp = CP $< $@$2 |
| 19 | 19 | cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false) |
| @@ -78,7 +78,8 @@ · 77 unmodified lines | ||
| 78 | 78 | | CF_PAGE_READABLE \ |
| 79 | 79 | | CF_PAGE_WRITABLE \ |
| 80 | 80 | | CF_PAGE_EXEC \ |
| 81 | − | CF_PAGE_SYSTEM) | |
| 81 | + | CF_PAGE_SYSTEM \ | |
| 82 | + | CF_PAGE_SHARED) | |
| 82 | 83 | |
| 83 | 84 | #define PAGE_COPY __pgprot(CF_PAGE_VALID \ |
| 84 | 85 | | CF_PAGE_ACCESSED \ |
| @@ -87,7 +87,7 @@ void __init paging_init(void) · 86 unmodified lines | ||
| 87 | 87 | |
| 88 | 88 | int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word) |
| 89 | 89 | { |
| 90 | − unsigned long flags, mmuar; | |
| 90 | + unsigned long flags, mmuar, mmutr; | |
| 91 | 91 | struct mm_struct *mm; |
| 92 | 92 | pgd_t *pgd; |
| 93 | 93 | pmd_t *pmd; |
| @@ -137,9 +137,10 @@ int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word) · 43 unmodified lines | ||
| 137 | 137 | if (!pte_dirty(*pte) && !KMAPAREA(mmuar)) |
| 138 | 138 | set_pte(pte, pte_wrprotect(*pte)); |
| 139 | 139 | |
| 140 | − mmu_write(MMUTR, (mmuar & PAGE_MASK) | (asid << MMUTR_IDN) | | |
| 141 | − (((int)(pte->pte) & (int)CF_PAGE_MMUTR_MASK) | |
| 142 | − >> CF_PAGE_MMUTR_SHIFT) | MMUTR_V); | |
| 140 | + mmutr = (mmuar & PAGE_MASK) | (asid << MMUTR_IDN) | MMUTR_V; | |
| 141 | + if ((mmuar < TASK_UNMAPPED_BASE) || (mmuar >= TASK_SIZE)) | |
| 142 | + mmutr |= (pte->pte & CF_PAGE_MMUTR_MASK) >> CF_PAGE_MMUTR_SHIFT; | |
| 143 | + mmu_write(MMUTR, mmutr); | |
| 143 | 144 | |
| 144 | 145 | mmu_write(MMUDR, (pte_val(*pte) & PAGE_MASK) | |
| 145 | 146 | ((pte->pte) & CF_PAGE_MMUDR_MASK) | MMUDR_SZ_8KB | MMUDR_X); |
| @@ -136,7 +136,7 @@ Luser_return: · 135 unmodified lines | ||
| 136 | 136 | movel %sp,%d1 /* get thread_info pointer */ |
| 137 | 137 | andl #-THREAD_SIZE,%d1 /* at base of kernel stack */ |
| 138 | 138 | movel %d1,%a0 |
| 139 | − movel %a0@(TINFO_FLAGS),%d1 /* get thread_info->flags */ | |
| 139 | + moveb %a0@(TINFO_FLAGS+3),%d1 /* thread_info->flags (low 8 bits) */ | |
| 140 | 140 | jne Lwork_to_do /* still work to do */ |
| 141 | 141 | |
| 142 | 142 | Lreturn: |
| @@ -148,8 +148,6 @@ Lwork_to_do: · 5 unmodified lines | ||
| 148 | 148 | btst #TIF_NEED_RESCHED,%d1 |
| 149 | 149 | jne reschedule |
| 150 | 150 | |
| 151 | − /* GERG: do we need something here for TRACEing?? */ | |
| 152 | − | |
| 153 | 151 | Lsignal_return: |
| 154 | 152 | subql #4,%sp /* dummy return address */ |
| 155 | 153 | SAVE_SWITCH_STACK |
| @@ -2356,6 +2356,7 @@ config PCI · 2355 unmodified lines | ||
| 2356 | 2356 | depends on HW_HAS_PCI |
| 2357 | 2357 | select PCI_DOMAINS |
| 2358 | 2358 | select GENERIC_PCI_IOMAP |
| 2359 | + select NO_GENERIC_PCI_IOPORT_MAP | |
| 2359 | 2360 | help |
| 2360 | 2361 | Find out whether you have a PCI motherboard. PCI is the name of a |
| 2361 | 2362 | bus system, i.e. the way the CPU talks to the other stuff inside |
| @@ -10,8 +10,8 @@ · 9 unmodified lines | ||
| 10 | 10 | #include <linux/module.h> |
| 11 | 11 | #include <asm/io.h> |
| 12 | 12 | |
| 13 | −static void __iomem *ioport_map_pci(struct pci_dev *dev, | |
| 14 | − unsigned long port, unsigned int nr) | |
| 13 | +void __iomem *__pci_ioport_map(struct pci_dev *dev, | |
| 14 | + unsigned long port, unsigned int nr) | |
| 15 | 15 | { |
| 16 | 16 | struct pci_controller *ctrl = dev->bus->sysdata; |
| 17 | 17 | unsigned long base = ctrl->io_map_base; |
| @@ -24,10 +24,6 @@ CONFIG_PPC_SPLPAR=y · 23 unmodified lines | ||
| 24 | 24 | CONFIG_SCANLOG=m |
| 25 | 25 | CONFIG_PPC_SMLPAR=y |
| 26 | 26 | CONFIG_DTL=y |
| 27 | −CONFIG_PPC_ISERIES=y | |
| 28 | −CONFIG_VIODASD=y | |
| 29 | −CONFIG_VIOCD=m | |
| 30 | −CONFIG_VIOTAPE=m | |
| 31 | 27 | CONFIG_PPC_MAPLE=y |
| 32 | 28 | CONFIG_PPC_PASEMI=y |
| 33 | 29 | CONFIG_PPC_PASEMI_IOMMU=y |
| @@ -259,7 +255,6 @@ CONFIG_PASEMI_MAC=y · 225 unmodified lines | ||
| 259 | 255 | CONFIG_MLX4_EN=m |
| 260 | 256 | CONFIG_QLGE=m |
| 261 | 257 | CONFIG_BE2NET=m |
| 262 | −CONFIG_ISERIES_VETH=m | |
| 263 | 258 | CONFIG_PPP=m |
| 264 | 259 | CONFIG_PPP_ASYNC=m |
| 265 | 260 | CONFIG_PPP_SYNC_TTY=m |
| @@ -142,6 +142,11 @@ static inline const char *eeh_pci_name(struct pci_dev *pdev) · 141 unmodified lines | ||
| 142 | 142 | return pdev ? pci_name(pdev) : "<null>"; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | +static inline const char *eeh_driver_name(struct pci_dev *pdev) | |
| 146 | +{ | |
| 147 | + return (pdev && pdev->driver) ? pdev->driver->name : "<null>"; | |
| 148 | +} | |
| 149 | + | |
| 145 | 150 | #endif /* CONFIG_EEH */ |
| 146 | 151 | |
| 147 | 152 | #else /* CONFIG_PCI */ |
| @@ -83,8 +83,18 @@ struct pt_regs { · 82 unmodified lines | ||
| 83 | 83 | |
| 84 | 84 | #ifndef __ASSEMBLY__ |
| 85 | 85 | |
| 86 | −#define instruction_pointer(regs) ((regs)->nip) | |
| 87 | −#define user_stack_pointer(regs) ((regs)->gpr[1]) | |
| 86 | +#define GET_IP(regs) ((regs)->nip) | |
| 87 | +#define GET_USP(regs) ((regs)->gpr[1]) | |
| 88 | +#define GET_FP(regs) (0) | |
| 89 | +#define SET_FP(regs, val) | |
| 90 | + | |
| 91 | +#ifdef CONFIG_SMP | |
| 92 | +extern unsigned long profile_pc(struct pt_regs *regs); | |
| 93 | +#define profile_pc profile_pc | |
| 94 | +#endif | |
| 95 | + | |
| 96 | +#include <asm-generic/ptrace.h> | |
| 97 | + | |
| 88 | 98 | #define kernel_stack_pointer(regs) ((regs)->gpr[1]) |
| 89 | 99 | static inline int is_syscall_success(struct pt_regs *regs) |
| 90 | 100 | { |
| @@ -99,12 +109,6 @@ static inline long regs_return_value(struct pt_regs *regs) · 8 unmodified lines | ||
| 99 | 109 | return -regs->gpr[3]; |
| 100 | 110 | } |
| 101 | 111 | |
| 102 | −#ifdef CONFIG_SMP | |
| 103 | −extern unsigned long profile_pc(struct pt_regs *regs); | |
| 104 | −#else | |
| 105 | −#define profile_pc(regs) instruction_pointer(regs) | |
| 106 | −#endif | |
| 107 | − | |
| 108 | 112 | #ifdef __powerpc64__ |
| 109 | 113 | #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) |
| 110 | 114 | #else |
| @@ -1213,7 +1213,7 @@ do_user_signal: /* r10 contains MSR_KERNEL here */ · 1212 unmodified lines | ||
| 1213 | 1213 | stw r3,_TRAP(r1) |
| 1214 | 1214 | 2: addi r3,r1,STACK_FRAME_OVERHEAD |
| 1215 | 1215 | mr r4,r9 |
| 1216 | − bl do_signal | |
| 1216 | + bl do_notify_resume | |
| 1217 | 1217 | REST_NVGPRS(r1) |
| 1218 | 1218 | b recheck |
| 1219 | 1219 | |
| @@ -751,12 +751,16 @@ user_work: · 750 unmodified lines | ||
| 751 | 751 | |
| 752 | 752 | andi. r0,r4,_TIF_NEED_RESCHED |
| 753 | 753 | beq 1f |
| 754 | + li r5,1 | |
| 755 | + TRACE_AND_RESTORE_IRQ(r5); | |
| 754 | 756 | bl .schedule |
| 755 | 757 | b .ret_from_except_lite |
| 756 | 758 | |
| 757 | 759 | 1: bl .save_nvgprs |
| 760 | + li r5,1 | |
| 761 | + TRACE_AND_RESTORE_IRQ(r5); | |
| 758 | 762 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 759 | − bl .do_signal | |
| 763 | + bl .do_notify_resume | |
| 760 | 764 | b .ret_from_except |
| 761 | 765 | |
| 762 | 766 | unrecov_restore: |
| @@ -774,8 +774,8 @@ alignment_common: · 773 unmodified lines | ||
| 774 | 774 | program_check_common: |
| 775 | 775 | EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN) |
| 776 | 776 | bl .save_nvgprs |
| 777 | + DISABLE_INTS | |
| 777 | 778 | addi r3,r1,STACK_FRAME_OVERHEAD |
| 778 | − ENABLE_INTS | |
| 779 | 779 | bl .program_check_exception |
| 780 | 780 | b .ret_from_except |
| 781 | 781 | |
| @@ -118,10 +118,14 @@ static inline notrace void set_soft_enabled(unsigned long enable) · 117 unmodified lines | ||
| 118 | 118 | static inline notrace void decrementer_check_overflow(void) |
| 119 | 119 | { |
| 120 | 120 | u64 now = get_tb_or_rtc(); |
| 121 | − u64 *next_tb = &__get_cpu_var(decrementers_next_tb); | |
| 121 | + u64 *next_tb; | |
| 122 | + | |
| 123 | + preempt_disable(); | |
| 124 | + next_tb = &__get_cpu_var(decrementers_next_tb); | |
| 122 | 125 | |
| 123 | 126 | if (now >= *next_tb) |
| 124 | 127 | set_dec(1); |
| 128 | + preempt_enable(); | |
| 125 | 129 | } |
| 126 | 130 | |
| 127 | 131 | notrace void arch_local_irq_restore(unsigned long en) |
| @@ -865,6 +865,7 @@ static void power_pmu_start(struct perf_event *event, int ef_flags) · 864 unmodified lines | ||
| 865 | 865 | { |
| 866 | 866 | unsigned long flags; |
| 867 | 867 | s64 left; |
| 868 | + unsigned long val; | |
| 868 | 869 | |
| 869 | 870 | if (!event->hw.idx || !event->hw.sample_period) |
| 870 | 871 | return; |
| @@ -880,7 +881,12 @@ static void power_pmu_start(struct perf_event *event, int ef_flags) · 9 unmodified lines | ||
| 880 | 881 | |
| 881 | 882 | event->hw.state = 0; |
| 882 | 883 | left = local64_read(&event->hw.period_left); |
| 883 | − write_pmc(event->hw.idx, left); | |
| 884 | + | |
| 885 | + val = 0; | |
| 886 | + if (left < 0x80000000L) | |
| 887 | + val = 0x80000000L - left; | |
| 888 | + | |
| 889 | + write_pmc(event->hw.idx, val); | |
| 884 | 890 | |
| 885 | 891 | perf_event_update_userpage(event); |
| 886 | 892 | perf_pmu_enable(event->pmu); |
| @@ -566,12 +566,12 @@ static void show_instructions(struct pt_regs *regs) · 565 unmodified lines | ||
| 566 | 566 | */ |
| 567 | 567 | if (!__kernel_text_address(pc) || |
| 568 | 568 | __get_user(instr, (unsigned int __user *)pc)) { |
| 569 | − printk("XXXXXXXX "); | |
| 569 | + printk(KERN_CONT "XXXXXXXX "); | |
| 570 | 570 | } else { |
| 571 | 571 | if (regs->nip == pc) |
| 572 | − printk("<%08x> ", instr); | |
| 572 | + printk(KERN_CONT "<%08x> ", instr); | |
| 573 | 573 | else |
| 574 | − printk("%08x ", instr); | |
| 574 | + printk(KERN_CONT "%08x ", instr); | |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | pc += sizeof(int); |
| @@ -716,7 +716,6 @@ static int __rtas_suspend_last_cpu(struct rtas_suspend_me_data *data, int wake_w · 715 unmodified lines | ||
| 716 | 716 | int cpu; |
| 717 | 717 | |
| 718 | 718 | slb_set_size(SLB_MIN_SIZE); |
| 719 | − stop_topology_update(); | |
| 720 | 719 | printk(KERN_DEBUG "calling ibm,suspend-me on cpu %i\n", smp_processor_id()); |
| 721 | 720 | |
| 722 | 721 | while (rc == H_MULTI_THREADS_ACTIVE && !atomic_read(&data->done) && |
| @@ -732,7 +731,6 @@ static int __rtas_suspend_last_cpu(struct rtas_suspend_me_data *data, int wake_w · 9 unmodified lines | ||
| 732 | 731 | rc = atomic_read(&data->error); |
| 733 | 732 | |
| 734 | 733 | atomic_set(&data->error, rc); |
| 735 | − start_topology_update(); | |
| 736 | 734 | pSeries_coalesce_init(); |
| 737 | 735 | |
| 738 | 736 | if (wake_when_done) { |
| @@ -846,6 +844,7 @@ int rtas_ibm_suspend_me(struct rtas_args *args) · 107 unmodified lines | ||
| 846 | 844 | atomic_set(&data.error, 0); |
| 847 | 845 | data.token = rtas_token("ibm,suspend-me"); |
| 848 | 846 | data.complete = &done; |
| 847 | + stop_topology_update(); | |
| 849 | 848 | |
| 850 | 849 | /* Call function on all CPUs. One of us will make the |
| 851 | 850 | * rtas call |
| @@ -858,6 +857,8 @@ int rtas_ibm_suspend_me(struct rtas_args *args) · 6 unmodified lines | ||
| 858 | 857 | if (atomic_read(&data.error) != 0) |
| 859 | 858 | printk(KERN_ERR "Error doing global join\n"); |
| 860 | 859 | |
| 860 | + start_topology_update(); | |
| 861 | + | |
| 861 | 862 | return atomic_read(&data.error); |
| 862 | 863 | } |
| 863 | 864 | #else /* CONFIG_PPC_PSERIES */ |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | #include <linux/tracehook.h> |
| 13 | 13 | #include <linux/signal.h> |
| 14 | +#include <linux/key.h> | |
| 14 | 15 | #include <asm/hw_breakpoint.h> |
| 15 | 16 | #include <asm/uaccess.h> |
| 16 | 17 | #include <asm/unistd.h> |
| @@ -113,8 +114,9 @@ static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka, · 96 unmodified lines | ||
| 113 | 114 | } |
| 114 | 115 | } |
| 115 | 116 | |
| 116 | −static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs) | |
| 117 | +static int do_signal(struct pt_regs *regs) | |
| 117 | 118 | { |
| 119 | + sigset_t *oldset; | |
| 118 | 120 | siginfo_t info; |
| 119 | 121 | int signr; |
| 120 | 122 | struct k_sigaction ka; |
| @@ -123,7 +125,7 @@ static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs) · 2 unmodified lines | ||
| 123 | 125 | |
| 124 | 126 | if (current_thread_info()->local_flags & _TLF_RESTORE_SIGMASK) |
| 125 | 127 | oldset = ¤t->saved_sigmask; |
| 126 | − else if (!oldset) | |
| 128 | + else | |
| 127 | 129 | oldset = ¤t->blocked; |
| 128 | 130 | |
| 129 | 131 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
| @@ -191,14 +193,16 @@ static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs) · 61 unmodified lines | ||
| 191 | 193 | return ret; |
| 192 | 194 | } |
| 193 | 195 | |
| 194 | −void do_signal(struct pt_regs *regs, unsigned long thread_info_flags) | |
| 196 | +void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags) | |
| 195 | 197 | { |
| 196 | 198 | if (thread_info_flags & _TIF_SIGPENDING) |
| 197 | − do_signal_pending(NULL, regs); | |
| 199 | + do_signal(regs); | |
| 198 | 200 | |
| 199 | 201 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
| 200 | 202 | clear_thread_flag(TIF_NOTIFY_RESUME); |
| 201 | 203 | tracehook_notify_resume(regs); |
| 204 | + if (current->replacement_session_keyring) | |
| 205 | + key_replace_session_keyring(); | |
| 202 | 206 | } |
| 203 | 207 | } |
| 204 | 208 | |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
| 14 | 14 | |
| 15 | −extern void do_signal(struct pt_regs *regs, unsigned long thread_info_flags); | |
| 15 | +extern void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags); | |
| 16 | 16 | |
| 17 | 17 | extern void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, |
| 18 | 18 | size_t frame_size, int is_32); |
| @@ -52,32 +52,38 @@ static int pnv_msi_check_device(struct pci_dev* pdev, int nvec, int type) · 51 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | static unsigned int pnv_get_one_msi(struct pnv_phb *phb) |
| 54 | 54 | { |
| 55 | − unsigned int id; | |
| 55 | + unsigned long flags; | |
| 56 | + unsigned int id, rc; | |
| 57 | + | |
| 58 | + spin_lock_irqsave(&phb->lock, flags); | |
| 56 | 59 | |
| 57 | − spin_lock(&phb->lock); | |
| 58 | 60 | id = find_next_zero_bit(phb->msi_map, phb->msi_count, phb->msi_next); |
| 59 | 61 | if (id >= phb->msi_count && phb->msi_next) |
| 60 | 62 | id = find_next_zero_bit(phb->msi_map, phb->msi_count, 0); |
| 61 | 63 | if (id >= phb->msi_count) { |
| 62 | − spin_unlock(&phb->lock); | |
| 63 | − return 0; | |
| 64 | + rc = 0; | |
| 65 | + goto out; | |
| 64 | 66 | } |
| 65 | 67 | __set_bit(id, phb->msi_map); |
| 66 | − spin_unlock(&phb->lock); | |
| 67 | − return id + phb->msi_base; | |
| 68 | + rc = id + phb->msi_base; | |
| 69 | +out: | |
| 70 | + spin_unlock_irqrestore(&phb->lock, flags); | |
| 71 | + return rc; | |
| 68 | 72 | } |
| 69 | 73 | |
| 70 | 74 | static void pnv_put_msi(struct pnv_phb *phb, unsigned int hwirq) |
| 71 | 75 | { |
| 76 | + unsigned long flags; | |
| 72 | 77 | unsigned int id; |
| 73 | 78 | |
| 74 | 79 | if (WARN_ON(hwirq < phb->msi_base || |
| 75 | 80 | hwirq >= (phb->msi_base + phb->msi_count))) |
| 76 | 81 | return; |
| 77 | 82 | id = hwirq - phb->msi_base; |
| 78 | − spin_lock(&phb->lock); | |
| 83 | + | |
| 84 | + spin_lock_irqsave(&phb->lock, flags); | |
| 79 | 85 | __clear_bit(id, phb->msi_map); |
| 80 | − spin_unlock(&phb->lock); | |
| 86 | + spin_unlock_irqrestore(&phb->lock, flags); | |
| 81 | 87 | } |
| 82 | 88 | |
| 83 | 89 | static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) |
| @@ -551,9 +551,9 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) · 550 unmodified lines | ||
| 551 | 551 | printk (KERN_ERR "EEH: %d reads ignored for recovering device at " |
| 552 | 552 | "location=%s driver=%s pci addr=%s\n", |
| 553 | 553 | pdn->eeh_check_count, location, |
| 554 | − dev->driver->name, eeh_pci_name(dev)); | |
| 554 | + eeh_driver_name(dev), eeh_pci_name(dev)); | |
| 555 | 555 | printk (KERN_ERR "EEH: Might be infinite loop in %s driver\n", |
| 556 | − dev->driver->name); | |
| 556 | + eeh_driver_name(dev)); | |
| 557 | 557 | dump_stack(); |
| 558 | 558 | } |
| 559 | 559 | goto dn_unlock; |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <asm/machdep.h> |
| 25 | 25 | #include <asm/mmu.h> |
| 26 | 26 | #include <asm/rtas.h> |
| 27 | +#include <asm/topology.h> | |
| 27 | 28 | |
| 28 | 29 | static u64 stream_id; |
| 29 | 30 | static struct device suspend_dev; |
| @@ -138,8 +139,11 @@ static ssize_t store_hibernate(struct device *dev, · 108 unmodified lines | ||
| 138 | 139 | ssleep(1); |
| 139 | 140 | } while (rc == -EAGAIN); |
| 140 | 141 | |
| 141 | − if (!rc) | |
| 142 | + if (!rc) { | |
| 143 | + stop_topology_update(); | |
| 142 | 144 | rc = pm_suspend(PM_SUSPEND_MEM); |
| 145 | + start_topology_update(); | |
| 146 | + } | |
| 143 | 147 | |
| 144 | 148 | stream_id = 0; |
| 145 | 149 | |
| @@ -346,7 +346,7 @@ static int wsp_chip_set_affinity(struct irq_data *d, · 345 unmodified lines | ||
| 346 | 346 | * For the moment only implement delivery to all cpus or one cpu. |
| 347 | 347 | * Get current irq_server for the given irq |
| 348 | 348 | */ |
| 349 | − ret = cache_hwirq_map(ics, d->irq, cpumask); | |
| 349 | + ret = cache_hwirq_map(ics, hw_irq, cpumask); | |
| 350 | 350 | if (ret == -1) { |
| 351 | 351 | char cpulist[128]; |
| 352 | 352 | cpumask_scnprintf(cpulist, sizeof(cpulist), cpumask); |
| @@ -71,7 +71,7 @@ int __devinit smp_a2_kick_cpu(int nr) · 70 unmodified lines | ||
| 71 | 71 | |
| 72 | 72 | static int __init smp_a2_probe(void) |
| 73 | 73 | { |
| 74 | − return cpus_weight(cpu_possible_map); | |
| 74 | + return num_possible_cpus(); | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | static struct smp_ops_t a2_smp_ops = { |
| @@ -468,15 +468,15 @@ static void __init wsp_pcie_configure_hw(struct pci_controller *hose) · 467 unmodified lines | ||
| 468 | 468 | #define DUMP_REG(x) \ |
| 469 | 469 | pr_debug("%-30s : 0x%016llx\n", #x, in_be64(hose->cfg_data + x)) |
| 470 | 470 | |
| 471 | −#ifdef CONFIG_WSP_DD1_WORKAROUND_BAD_PCIE_CLASS | |
| 472 | − /* WSP DD1 has a bogus class code by default in the PCI-E | |
| 473 | − * root complex's built-in P2P bridge */ | |
| 471 | + /* | |
| 472 | + * Some WSP variants has a bogus class code by default in the PCI-E | |
| 473 | + * root complex's built-in P2P bridge | |
| 474 | + */ | |
| 474 | 475 | val = in_be64(hose->cfg_data + PCIE_REG_SYS_CFG1); |
| 475 | 476 | pr_debug("PCI-E SYS_CFG1 : 0x%llx\n", val); |
| 476 | 477 | out_be64(hose->cfg_data + PCIE_REG_SYS_CFG1, |
| 477 | 478 | (val & ~PCIE_REG_SYS_CFG1_CLASS_CODE) | (PCI_CLASS_BRIDGE_PCI << 8)); |
| 478 | 479 | pr_debug("PCI-E SYS_CFG1 : 0x%llx\n", in_be64(hose->cfg_data + PCIE_REG_SYS_CFG1)); |
| 479 | −#endif /* CONFIG_WSP_DD1_WORKAROUND_BAD_PCIE_CLASS */ | |
| 480 | 480 | |
| 481 | 481 | #ifdef CONFIG_WSP_DD1_WORKAROUND_DD1_TCE_BUGS |
| 482 | 482 | /* XXX Disable TCE caching, it doesn't work on DD1 */ |
| @@ -385,26 +385,36 @@ static void __init setup_pci_cmd(struct pci_controller *hose) · 384 unmodified lines | ||
| 385 | 385 | void fsl_pcibios_fixup_bus(struct pci_bus *bus) |
| 386 | 386 | { |
| 387 | 387 | struct pci_controller *hose = pci_bus_to_host(bus); |
| 388 | − int i; | |
| 389 | − | |
| 390 | − if ((bus->parent == hose->bus) && | |
| 391 | − ((fsl_pcie_bus_fixup && | |
| 392 | − early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) || | |
| 393 | − (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK))) | |
| 394 | − { | |
| 395 | − for (i = 0; i < 4; ++i) { | |
| 388 | + int i, is_pcie = 0, no_link; | |
| 389 | + | |
| 390 | + /* The root complex bridge comes up with bogus resources, | |
| 391 | + * we copy the PHB ones in. | |
| 392 | + * | |
| 393 | + * With the current generic PCI code, the PHB bus no longer | |
| 394 | + * has bus->resource[0..4] set, so things are a bit more | |
| 395 | + * tricky. | |
| 396 | + */ | |
| 397 | + | |
| 398 | + if (fsl_pcie_bus_fixup) | |
| 399 | + is_pcie = early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP); | |
| 400 | + no_link = !!(hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK); | |
| 401 | + | |
| 402 | + if (bus->parent == hose->bus && (is_pcie || no_link)) { | |
| 403 | + for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; ++i) { | |
| 396 | 404 | struct resource *res = bus->resource[i]; |
| 397 | − struct resource *par = bus->parent->resource[i]; | |
| 398 | − if (res) { | |
| 399 | − res->start = 0; | |
| 400 | − res->end = 0; | |
| 401 | − res->flags = 0; | |
| 402 | − } | |
| 403 | − if (res && par) { | |
| 404 | − res->start = par->start; | |
| 405 | − res->end = par->end; | |
| 406 | − res->flags = par->flags; | |
| 407 | − } | |
| 405 | + struct resource *par; | |
| 406 | + | |
| 407 | + if (!res) | |
| 408 | + continue; | |
| 409 | + if (i == 0) | |
| 410 | + par = &hose->io_resource; | |
| 411 | + else if (i < 4) | |
| 412 | + par = &hose->mem_resources[i-1]; | |
| 413 | + else par = NULL; | |
| 414 | + | |
| 415 | + res->start = par ? par->start : 0; | |
| 416 | + res->end = par ? par->end : 0; | |
| 417 | + res->flags = par ? par->flags : 0; | |
| 408 | 418 | } |
| 409 | 419 | } |
| 410 | 420 | } |
| @@ -172,13 +172,6 @@ static inline int is_compat_task(void) · 171 unmodified lines | ||
| 172 | 172 | return is_32bit_task(); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | −#else | |
| 176 | − | |
| 177 | −static inline int is_compat_task(void) | |
| 178 | −{ | |
| 179 | − return 0; | |
| 180 | −} | |
| 181 | − | |
| 182 | 175 | #endif |
| 183 | 176 | |
| 184 | 177 | static inline void __user *arch_compat_alloc_user_space(long len) |
| @@ -662,7 +662,7 @@ ENTRY(sys32_getresuid16_wrapper) · 661 unmodified lines | ||
| 662 | 662 | ENTRY(sys32_poll_wrapper) |
| 663 | 663 | llgtr %r2,%r2 # struct pollfd * |
| 664 | 664 | llgfr %r3,%r3 # unsigned int |
| 665 | − lgfr %r4,%r4 # long | |
| 665 | + lgfr %r4,%r4 # int | |
| 666 | 666 | jg sys_poll # branch to system call |
| 667 | 667 | |
| 668 | 668 | ENTRY(sys32_setresgid16_wrapper) |
| @@ -29,7 +29,6 @@ · 28 unmodified lines | ||
| 29 | 29 | #include <asm/irq.h> |
| 30 | 30 | #include <asm/timer.h> |
| 31 | 31 | #include <asm/nmi.h> |
| 32 | −#include <asm/compat.h> | |
| 33 | 32 | #include <asm/smp.h> |
| 34 | 33 | #include "entry.h" |
| 35 | 34 | |
| @@ -76,7 +75,6 @@ static void default_idle(void) · 40 unmodified lines | ||
| 76 | 75 | if (test_thread_flag(TIF_MCCK_PENDING)) { |
| 77 | 76 | local_mcck_enable(); |
| 78 | 77 | local_irq_enable(); |
| 79 | − s390_handle_mcck(); | |
| 80 | 78 | return; |
| 81 | 79 | } |
| 82 | 80 | trace_hardirqs_on(); |
| @@ -93,10 +91,12 @@ void cpu_idle(void) · 10 unmodified lines | ||
| 93 | 91 | for (;;) { |
| 94 | 92 | tick_nohz_idle_enter(); |
| 95 | 93 | rcu_idle_enter(); |
| 96 | − while (!need_resched()) | |
| 94 | + while (!need_resched() && !test_thread_flag(TIF_MCCK_PENDING)) | |
| 97 | 95 | default_idle(); |
| 98 | 96 | rcu_idle_exit(); |
| 99 | 97 | tick_nohz_idle_exit(); |
| 98 | + if (test_thread_flag(TIF_MCCK_PENDING)) | |
| 99 | + s390_handle_mcck(); | |
| 100 | 100 | preempt_enable_no_resched(); |
| 101 | 101 | schedule(); |
| 102 | 102 | preempt_disable(); |
| @@ -20,8 +20,8 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/regset.h> |
| 21 | 21 | #include <linux/tracehook.h> |
| 22 | 22 | #include <linux/seccomp.h> |
| 23 | +#include <linux/compat.h> | |
| 23 | 24 | #include <trace/syscall.h> |
| 24 | −#include <asm/compat.h> | |
| 25 | 25 | #include <asm/segment.h> |
| 26 | 26 | #include <asm/page.h> |
| 27 | 27 | #include <asm/pgtable.h> |
| @@ -46,6 +46,7 @@ · 45 unmodified lines | ||
| 46 | 46 | #include <linux/kexec.h> |
| 47 | 47 | #include <linux/crash_dump.h> |
| 48 | 48 | #include <linux/memory.h> |
| 49 | +#include <linux/compat.h> | |
| 49 | 50 | |
| 50 | 51 | #include <asm/ipl.h> |
| 51 | 52 | #include <asm/uaccess.h> |
| @@ -59,7 +60,6 @@ · 7 unmodified lines | ||
| 59 | 60 | #include <asm/ptrace.h> |
| 60 | 61 | #include <asm/sections.h> |
| 61 | 62 | #include <asm/ebcdic.h> |
| 62 | −#include <asm/compat.h> | |
| 63 | 63 | #include <asm/kvm_virtio.h> |
| 64 | 64 | #include <asm/diag.h> |
| 65 | 65 | |
| @@ -30,7 +30,6 @@ · 29 unmodified lines | ||
| 30 | 30 | #include <asm/ucontext.h> |
| 31 | 31 | #include <asm/uaccess.h> |
| 32 | 32 | #include <asm/lowcore.h> |
| 33 | −#include <asm/compat.h> | |
| 34 | 33 | #include "entry.h" |
| 35 | 34 | |
| 36 | 35 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) |
| @@ -113,11 +113,14 @@ static void fixup_clock_comparator(unsigned long long delta) · 112 unmodified lines | ||
| 113 | 113 | static int s390_next_ktime(ktime_t expires, |
| 114 | 114 | struct clock_event_device *evt) |
| 115 | 115 | { |
| 116 | + struct timespec ts; | |
| 116 | 117 | u64 nsecs; |
| 117 | 118 | |
| 118 | − nsecs = ktime_to_ns(ktime_sub(expires, ktime_get_monotonic_offset())); | |
| 119 | + ts.tv_sec = ts.tv_nsec = 0; | |
| 120 | + monotonic_to_bootbased(&ts); | |
| 121 | + nsecs = ktime_to_ns(ktime_add(timespec_to_ktime(ts), expires)); | |
| 119 | 122 | do_div(nsecs, 125); |
| 120 | − S390_lowcore.clock_comparator = TOD_UNIX_EPOCH + (nsecs << 9); | |
| 123 | + S390_lowcore.clock_comparator = sched_clock_base_cc + (nsecs << 9); | |
| 121 | 124 | set_clock_comparator(S390_lowcore.clock_comparator); |
| 122 | 125 | return 0; |
| 123 | 126 | } |
| @@ -36,7 +36,6 @@ · 35 unmodified lines | ||
| 36 | 36 | #include <asm/pgtable.h> |
| 37 | 37 | #include <asm/irq.h> |
| 38 | 38 | #include <asm/mmu_context.h> |
| 39 | −#include <asm/compat.h> | |
| 40 | 39 | #include "../kernel/entry.h" |
| 41 | 40 | |
| 42 | 41 | #ifndef CONFIG_64BIT |
| @@ -29,8 +29,8 @@ · 28 unmodified lines | ||
| 29 | 29 | #include <linux/mman.h> |
| 30 | 30 | #include <linux/module.h> |
| 31 | 31 | #include <linux/random.h> |
| 32 | +#include <linux/compat.h> | |
| 32 | 33 | #include <asm/pgalloc.h> |
| 33 | −#include <asm/compat.h> | |
| 34 | 34 | |
| 35 | 35 | static unsigned long stack_maxrandom_size(void) |
| 36 | 36 | { |
| @@ -574,7 +574,7 @@ static inline void page_table_free_pgste(unsigned long *table) · 573 unmodified lines | ||
| 574 | 574 | page = pfn_to_page(__pa(table) >> PAGE_SHIFT); |
| 575 | 575 | mp = (struct gmap_pgtable *) page->index; |
| 576 | 576 | BUG_ON(!list_empty(&mp->mapper)); |
| 577 | − pgtable_page_ctor(page); | |
| 577 | + pgtable_page_dtor(page); | |
| 578 | 578 | atomic_set(&page->_mapcount, -1); |
| 579 | 579 | kfree(mp); |
| 580 | 580 | __free_page(page); |
| @@ -859,6 +859,7 @@ config PCI · 858 unmodified lines | ||
| 859 | 859 | depends on SYS_SUPPORTS_PCI |
| 860 | 860 | select PCI_DOMAINS |
| 861 | 861 | select GENERIC_PCI_IOMAP |
| 862 | + select NO_GENERIC_PCI_IOPORT_MAP | |
| 862 | 863 | help |
| 863 | 864 | Find out whether you have a PCI motherboard. PCI is the name of a |
| 864 | 865 | bus system, i.e. the way the CPU talks to the other stuff inside |
| @@ -168,6 +168,11 @@ static struct resource sh_eth_giga1_resources[] = { · 167 unmodified lines | ||
| 168 | 168 | .start = 0xfee00800, |
| 169 | 169 | .end = 0xfee00fff, |
| 170 | 170 | .flags = IORESOURCE_MEM, |
| 171 | + }, { | |
| 172 | + /* TSU */ | |
| 173 | + .start = 0xfee01800, | |
| 174 | + .end = 0xfee01fff, | |
| 175 | + .flags = IORESOURCE_MEM, | |
| 171 | 176 | }, { |
| 172 | 177 | .start = 316, |
| 173 | 178 | .end = 316, |
| @@ -210,20 +215,13 @@ static struct resource sh_mmcif_resources[] = { · 36 unmodified lines | ||
| 210 | 215 | }, |
| 211 | 216 | }; |
| 212 | 217 | |
| 213 | −static struct sh_mmcif_dma sh7757lcr_mmcif_dma = { | |
| 214 | − .chan_priv_tx = { | |
| 215 | − .slave_id = SHDMA_SLAVE_MMCIF_TX, | |
| 216 | − }, | |
| 217 | − .chan_priv_rx = { | |
| 218 | − .slave_id = SHDMA_SLAVE_MMCIF_RX, | |
| 219 | − } | |
| 220 | −}; | |
| 221 | − | |
| 222 | 218 | static struct sh_mmcif_plat_data sh_mmcif_plat = { |
| 223 | − .dma = &sh7757lcr_mmcif_dma, | |
| 224 | 219 | .sup_pclk = 0x0f, |
| 225 | − .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, | |
| 220 | + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | | |
| 221 | + MMC_CAP_NONREMOVABLE, | |
| 226 | 222 | .ocr = MMC_VDD_32_33 | MMC_VDD_33_34, |
| 223 | + .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, | |
| 224 | + .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, | |
| 227 | 225 | }; |
| 228 | 226 | |
| 229 | 227 | static struct platform_device sh_mmcif_device = { |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <linux/i2c.h> |
| 23 | 23 | #include <linux/smsc911x.h> |
| 24 | 24 | #include <linux/gpio.h> |
| 25 | +#include <linux/videodev2.h> | |
| 25 | 26 | #include <media/ov772x.h> |
| 26 | 27 | #include <media/soc_camera.h> |
| 27 | 28 | #include <media/soc_camera_platform.h> |
| @@ -29,9 +29,11 @@ · 28 unmodified lines | ||
| 29 | 29 | #include <linux/input.h> |
| 30 | 30 | #include <linux/input/sh_keysc.h> |
| 31 | 31 | #include <linux/sh_eth.h> |
| 32 | +#include <linux/videodev2.h> | |
| 32 | 33 | #include <video/sh_mobile_lcdc.h> |
| 33 | 34 | #include <sound/sh_fsi.h> |
| 34 | 35 | #include <media/sh_mobile_ceu.h> |
| 36 | +#include <media/soc_camera.h> | |
| 35 | 37 | #include <media/tw9910.h> |
| 36 | 38 | #include <media/mt9t112.h> |
| 37 | 39 | #include <asm/heartbeat.h> |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <linux/input/sh_keysc.h> |
| 23 | 23 | #include <linux/i2c.h> |
| 24 | 24 | #include <linux/usb/r8a66597.h> |
| 25 | +#include <linux/videodev2.h> | |
| 25 | 26 | #include <media/rj54n1cb0c.h> |
| 26 | 27 | #include <media/soc_camera.h> |
| 27 | 28 | #include <media/sh_mobile_ceu.h> |
| @@ -21,9 +21,11 @@ · 20 unmodified lines | ||
| 21 | 21 | #include <linux/delay.h> |
| 22 | 22 | #include <linux/clk.h> |
| 23 | 23 | #include <linux/gpio.h> |
| 24 | +#include <linux/videodev2.h> | |
| 24 | 25 | #include <video/sh_mobile_lcdc.h> |
| 25 | 26 | #include <media/sh_mobile_ceu.h> |
| 26 | 27 | #include <media/ov772x.h> |
| 28 | +#include <media/soc_camera.h> | |
| 27 | 29 | #include <media/tw9910.h> |
| 28 | 30 | #include <asm/clock.h> |
| 29 | 31 | #include <asm/machvec.h> |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <linux/input/sh_keysc.h> |
| 25 | 25 | #include <linux/usb/r8a66597.h> |
| 26 | 26 | #include <linux/sh_eth.h> |
| 27 | +#include <linux/videodev2.h> | |
| 27 | 28 | #include <video/sh_mobile_lcdc.h> |
| 28 | 29 | #include <media/sh_mobile_ceu.h> |
| 29 | 30 | #include <sound/sh_fsi.h> |
| @@ -74,7 +74,7 @@ struct pci_errors { · 73 unmodified lines | ||
| 74 | 74 | { SH4_PCIINT_MLCK, "master lock error" }, |
| 75 | 75 | { SH4_PCIINT_TABT, "target-target abort" }, |
| 76 | 76 | { SH4_PCIINT_TRET, "target retry time out" }, |
| 77 | − { SH4_PCIINT_MFDE, "master function disable erorr" }, | |
| 77 | + { SH4_PCIINT_MFDE, "master function disable error" }, | |
| 78 | 78 | { SH4_PCIINT_PRTY, "address parity error" }, |
| 79 | 79 | { SH4_PCIINT_SERR, "SERR" }, |
| 80 | 80 | { SH4_PCIINT_TWDP, "data parity error for target write" }, |
| @@ -356,8 +356,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, · 355 unmodified lines | ||
| 356 | 356 | |
| 357 | 357 | #ifndef CONFIG_GENERIC_IOMAP |
| 358 | 358 | |
| 359 | −static void __iomem *ioport_map_pci(struct pci_dev *dev, | |
| 360 | − unsigned long port, unsigned int nr) | |
| 359 | +void __iomem *__pci_ioport_map(struct pci_dev *dev, | |
| 360 | + unsigned long port, unsigned int nr) | |
| 361 | 361 | { |
| 362 | 362 | struct pci_channel *chan = dev->sysdata; |
| 363 | 363 | |
| @@ -3,9 +3,10 @@ · 2 unmodified lines | ||
| 3 | 3 | * |
| 4 | 4 | * This file is released under the GPLv2 |
| 5 | 5 | */ |
| 6 | +#ifndef __ASM_SH_DEVICE_H | |
| 7 | +#define __ASM_SH_DEVICE_H | |
| 6 | 8 | |
| 7 | −struct dev_archdata { | |
| 8 | −}; | |
| 9 | +#include <asm-generic/device.h> | |
| 9 | 10 | |
| 10 | 11 | struct platform_device; |
| 11 | 12 | /* allocate contiguous memory chunk and fill in struct resource */ |
| @@ -14,5 +15,4 @@ int platform_resource_setup_memory(struct platform_device *pdev, · 2 unmodified lines | ||
| 14 | 15 | |
| 15 | 16 | void plat_early_device_setup(void); |
| 16 | 17 | |
| 17 | −struct pdev_archdata { | |
| 18 | −}; | |
| 18 | +#endif /* __ASM_SH_DEVICE_H */ | |
| @@ -343,7 +343,7 @@ static struct clk_lookup lookups[] = { · 342 unmodified lines | ||
| 343 | 343 | CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[HWBLK_CEU1]), |
| 344 | 344 | CLKDEV_CON_ID("beu1", &mstp_clks[HWBLK_BEU1]), |
| 345 | 345 | CLKDEV_CON_ID("2ddmac0", &mstp_clks[HWBLK_2DDMAC]), |
| 346 | − CLKDEV_CON_ID("spu0", &mstp_clks[HWBLK_SPU]), | |
| 346 | + CLKDEV_DEV_ID("sh_fsi.0", &mstp_clks[HWBLK_SPU]), | |
| 347 | 347 | CLKDEV_CON_ID("jpu0", &mstp_clks[HWBLK_JPU]), |
| 348 | 348 | CLKDEV_DEV_ID("sh-vou.0", &mstp_clks[HWBLK_VOU]), |
| 349 | 349 | CLKDEV_CON_ID("beu0", &mstp_clks[HWBLK_BEU0]), |
| @@ -133,7 +133,7 @@ static struct resource spi0_resources[] = { · 132 unmodified lines | ||
| 133 | 133 | [0] = { |
| 134 | 134 | .start = 0xfe002000, |
| 135 | 135 | .end = 0xfe0020ff, |
| 136 | − .flags = IORESOURCE_MEM, | |
| 136 | + .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT, | |
| 137 | 137 | }, |
| 138 | 138 | [1] = { |
| 139 | 139 | .start = 86, |
| @@ -661,6 +661,25 @@ static struct platform_device spi0_device = { · 521 unmodified lines | ||
| 661 | 661 | .resource = spi0_resources, |
| 662 | 662 | }; |
| 663 | 663 | |
| 664 | +static struct resource spi1_resources[] = { | |
| 665 | + { | |
| 666 | + .start = 0xffd8ee70, | |
| 667 | + .end = 0xffd8eeff, | |
| 668 | + .flags = IORESOURCE_MEM | IORESOURCE_MEM_8BIT, | |
| 669 | + }, | |
| 670 | + { | |
| 671 | + .start = 54, | |
| 672 | + .flags = IORESOURCE_IRQ, | |
| 673 | + }, | |
| 674 | +}; | |
| 675 | + | |
| 676 | +static struct platform_device spi1_device = { | |
| 677 | + .name = "sh_spi", | |
| 678 | + .id = 1, | |
| 679 | + .num_resources = ARRAY_SIZE(spi1_resources), | |
| 680 | + .resource = spi1_resources, | |
| 681 | +}; | |
| 682 | + | |
| 664 | 683 | static struct resource usb_ehci_resources[] = { |
| 665 | 684 | [0] = { |
| 666 | 685 | .start = 0xfe4f1000, |
| @@ -720,6 +739,7 @@ static struct platform_device *sh7757_devices[] __initdata = { · 53 unmodified lines | ||
| 720 | 739 | &dma2_device, |
| 721 | 740 | &dma3_device, |
| 722 | 741 | &spi0_device, |
| 742 | + &spi1_device, | |
| 723 | 743 | &usb_ehci_device, |
| 724 | 744 | &usb_ohci_device, |
| 725 | 745 | }; |
| @@ -63,7 +63,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) · 62 unmodified lines | ||
| 63 | 63 | mp_ops->prepare_cpus(max_cpus); |
| 64 | 64 | |
| 65 | 65 | #ifndef CONFIG_HOTPLUG_CPU |
| 66 | − init_cpu_present(&cpu_possible_map); | |
| 66 | + init_cpu_present(cpu_possible_mask); | |
| 67 | 67 | #endif |
| 68 | 68 | } |
| 69 | 69 | |
| @@ -27,7 +27,7 @@ static cpumask_t cpu_coregroup_map(unsigned int cpu) · 26 unmodified lines | ||
| 27 | 27 | * Presently all SH-X3 SMP cores are multi-cores, so just keep it |
| 28 | 28 | * simple until we have a method for determining topology.. |
| 29 | 29 | */ |
| 30 | − return cpu_possible_map; | |
| 30 | + return *cpu_possible_mask; | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | const struct cpumask *cpu_coregroup_mask(unsigned int cpu) |
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #define MAX_OCACHE_PAGES 32 |
| 24 | 24 | #define MAX_ICACHE_PAGES 32 |
| 25 | 25 | |
| 26 | +#ifdef CONFIG_CACHE_WRITEBACK | |
| 26 | 27 | static void sh2a_flush_oc_line(unsigned long v, int way) |
| 27 | 28 | { |
| 28 | 29 | unsigned long addr = (v & 0x000007f0) | (way << 11); |
| @@ -34,6 +35,7 @@ static void sh2a_flush_oc_line(unsigned long v, int way) · 5 unmodified lines | ||
| 34 | 35 | __raw_writel(data, CACHE_OC_ADDRESS_ARRAY | addr); |
| 35 | 36 | } |
| 36 | 37 | } |
| 38 | +#endif | |
| 37 | 39 | |
| 38 | 40 | static void sh2a_invalidate_line(unsigned long cache_addr, unsigned long v) |
| 39 | 41 | { |
| @@ -29,10 +29,11 @@ extern unsigned int sig_xstate_size; · 28 unmodified lines | ||
| 29 | 29 | extern void fpu_init(void); |
| 30 | 30 | extern void mxcsr_feature_mask_init(void); |
| 31 | 31 | extern int init_fpu(struct task_struct *child); |
| 32 | −extern asmlinkage void math_state_restore(void); | |
| 33 | −extern void __math_state_restore(void); | |
| 32 | +extern void math_state_restore(void); | |
| 34 | 33 | extern int dump_fpu(struct pt_regs *, struct user_i387_struct *); |
| 35 | 34 | |
| 35 | +DECLARE_PER_CPU(struct task_struct *, fpu_owner_task); | |
| 36 | + | |
| 36 | 37 | extern user_regset_active_fn fpregs_active, xfpregs_active; |
| 37 | 38 | extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get, |
| 38 | 39 | xstateregs_get; |
| @@ -212,19 +213,11 @@ static inline void fpu_fxsave(struct fpu *fpu) · 173 unmodified lines | ||
| 212 | 213 | |
| 213 | 214 | #endif /* CONFIG_X86_64 */ |
| 214 | 215 | |
| 215 | −/* We need a safe address that is cheap to find and that is already | |
| 216 | − in L1 during context switch. The best choices are unfortunately | |
| 217 | − different for UP and SMP */ | |
| 218 | −#ifdef CONFIG_SMP | |
| 219 | −#define safe_address (__per_cpu_offset[0]) | |
| 220 | −#else | |
| 221 | −#define safe_address (__get_cpu_var(kernel_cpustat).cpustat[CPUTIME_USER]) | |
| 222 | −#endif | |
| 223 | − | |
| 224 | 216 | /* |
| 225 | − * These must be called with preempt disabled | |
| 217 | + * These must be called with preempt disabled. Returns | |
| 218 | + * 'true' if the FPU state is still intact. | |
| 226 | 219 | */ |
| 227 | −static inline void fpu_save_init(struct fpu *fpu) | |
| 220 | +static inline int fpu_save_init(struct fpu *fpu) | |
| 228 | 221 | { |
| 229 | 222 | if (use_xsave()) { |
| 230 | 223 | fpu_xsave(fpu); |
| @@ -233,33 +226,33 @@ static inline void fpu_save_init(struct fpu *fpu) · 2 unmodified lines | ||
| 233 | 226 | * xsave header may indicate the init state of the FP. |
| 234 | 227 | */ |
| 235 | 228 | if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP)) |
| 236 | − return; | |
| 229 | + return 1; | |
| 237 | 230 | } else if (use_fxsr()) { |
| 238 | 231 | fpu_fxsave(fpu); |
| 239 | 232 | } else { |
| 240 | 233 | asm volatile("fnsave %[fx]; fwait" |
| 241 | 234 | : [fx] "=m" (fpu->state->fsave)); |
| 242 | − return; | |
| 235 | + return 0; | |
| 243 | 236 | } |
| 244 | 237 | |
| 245 | − if (unlikely(fpu->state->fxsave.swd & X87_FSW_ES)) | |
| 238 | + /* | |
| 239 | + * If exceptions are pending, we need to clear them so | |
| 240 | + * that we don't randomly get exceptions later. | |
| 241 | + * | |
| 242 | + * FIXME! Is this perhaps only true for the old-style | |
| 243 | + * irq13 case? Maybe we could leave the x87 state | |
| 244 | + * intact otherwise? | |
| 245 | + */ | |
| 246 | + if (unlikely(fpu->state->fxsave.swd & X87_FSW_ES)) { | |
| 246 | 247 | asm volatile("fnclex"); |
| 247 | − | |
| 248 | − /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception | |
| 249 | − is pending. Clear the x87 state here by setting it to fixed | |
| 250 | − values. safe_address is a random variable that should be in L1 */ | |
| 251 | − alternative_input( | |
| 252 | − ASM_NOP8 ASM_NOP2, | |
| 253 | − "emms\n\t" /* clear stack tags */ | |
| 254 | − "fildl %P[addr]", /* set F?P to defined value */ | |
| 255 | − X86_FEATURE_FXSAVE_LEAK, | |
| 256 | − [addr] "m" (safe_address)); | |
| 248 | + return 0; | |
| 249 | + } | |
| 250 | + return 1; | |
| 257 | 251 | } |
| 258 | 252 | |
| 259 | −static inline void __save_init_fpu(struct task_struct *tsk) | |
| 253 | +static inline int __save_init_fpu(struct task_struct *tsk) | |
| 260 | 254 | { |
| 261 | − fpu_save_init(&tsk->thread.fpu); | |
| 262 | − task_thread_info(tsk)->status &= ~TS_USEDFPU; | |
| 255 | + return fpu_save_init(&tsk->thread.fpu); | |
| 263 | 256 | } |
| 264 | 257 | |
| 265 | 258 | static inline int fpu_fxrstor_checking(struct fpu *fpu) |
| @@ -277,44 +270,212 @@ static inline int fpu_restore_checking(struct fpu *fpu) · 11 unmodified lines | ||
| 277 | 270 | |
| 278 | 271 | static inline int restore_fpu_checking(struct task_struct *tsk) |
| 279 | 272 | { |
| 273 | + /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception | |
| 274 | + is pending. Clear the x87 state here by setting it to fixed | |
| 275 | + values. "m" is a random variable that should be in L1 */ | |
| 276 | + alternative_input( | |
| 277 | + ASM_NOP8 ASM_NOP2, | |
| 278 | + "emms\n\t" /* clear stack tags */ | |
| 279 | + "fildl %P[addr]", /* set F?P to defined value */ | |
| 280 | + X86_FEATURE_FXSAVE_LEAK, | |
| 281 | + [addr] "m" (tsk->thread.fpu.has_fpu)); | |
| 282 | + | |
| 280 | 283 | return fpu_restore_checking(&tsk->thread.fpu); |
| 281 | 284 | } |
| 282 | 285 | |
| 283 | 286 | /* |
| 284 | − * Signal frame handlers... | |
| 287 | + * Software FPU state helpers. Careful: these need to | |
| 288 | + * be preemption protection *and* they need to be | |
| 289 | + * properly paired with the CR0.TS changes! | |
| 285 | 290 | */ |
| 286 | −extern int save_i387_xstate(void __user *buf); | |
| 287 | −extern int restore_i387_xstate(void __user *buf); | |
| 291 | +static inline int __thread_has_fpu(struct task_struct *tsk) | |
| 292 | +{ | |
| 293 | + return tsk->thread.fpu.has_fpu; | |
| 294 | +} | |
| 288 | 295 | |
| 289 | −static inline void __unlazy_fpu(struct task_struct *tsk) | |
| 296 | +/* Must be paired with an 'stts' after! */ | |
| 297 | +static inline void __thread_clear_has_fpu(struct task_struct *tsk) | |
| 290 | 298 | { |
| 291 | − if (task_thread_info(tsk)->status & TS_USEDFPU) { | |
| 292 | − __save_init_fpu(tsk); | |
| 293 | − stts(); | |
| 294 | − } else | |
| 295 | − tsk->fpu_counter = 0; | |
| 299 | + tsk->thread.fpu.has_fpu = 0; | |
| 300 | + percpu_write(fpu_owner_task, NULL); | |
| 301 | +} | |
| 302 | + | |
| 303 | +/* Must be paired with a 'clts' before! */ | |
| 304 | +static inline void __thread_set_has_fpu(struct task_struct *tsk) | |
| 305 | +{ | |
| 306 | + tsk->thread.fpu.has_fpu = 1; | |
| 307 | + percpu_write(fpu_owner_task, tsk); | |
| 308 | +} | |
| 309 | + | |
| 310 | +/* | |
| 311 | + * Encapsulate the CR0.TS handling together with the | |
| 312 | + * software flag. | |
| 313 | + * | |
| 314 | + * These generally need preemption protection to work, | |
| 315 | + * do try to avoid using these on their own. | |
| 316 | + */ | |
| 317 | +static inline void __thread_fpu_end(struct task_struct *tsk) | |
| 318 | +{ | |
| 319 | + __thread_clear_has_fpu(tsk); | |
| 320 | + stts(); | |
| 321 | +} | |
| 322 | + | |
| 323 | +static inline void __thread_fpu_begin(struct task_struct *tsk) | |
| 324 | +{ | |
| 325 | + clts(); | |
| 326 | + __thread_set_has_fpu(tsk); | |
| 327 | +} | |
| 328 | + | |
| 329 | +/* | |
| 330 | + * FPU state switching for scheduling. | |
| 331 | + * | |
| 332 | + * This is a two-stage process: | |
| 333 | + * | |
| 334 | + * - switch_fpu_prepare() saves the old state and | |
| 335 | + * sets the new state of the CR0.TS bit. This is | |
| 336 | + * done within the context of the old process. | |
| 337 | + * | |
| 338 | + * - switch_fpu_finish() restores the new state as | |
| 339 | + * necessary. | |
| 340 | + */ | |
| 341 | +typedef struct { int preload; } fpu_switch_t; | |
| 342 | + | |
| 343 | +/* | |
| 344 | + * FIXME! We could do a totally lazy restore, but we need to | |
| 345 | + * add a per-cpu "this was the task that last touched the FPU | |
| 346 | + * on this CPU" variable, and the task needs to have a "I last | |
| 347 | + * touched the FPU on this CPU" and check them. | |
| 348 | + * | |
| 349 | + * We don't do that yet, so "fpu_lazy_restore()" always returns | |
| 350 | + * false, but some day.. | |
| 351 | + */ | |
| 352 | +static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu) | |
| 353 | +{ | |
| 354 | + return new == percpu_read_stable(fpu_owner_task) && | |
| 355 | + cpu == new->thread.fpu.last_cpu; | |
| 356 | +} | |
| 357 | + | |
| 358 | +static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct task_struct *new, int cpu) | |
| 359 | +{ | |
| 360 | + fpu_switch_t fpu; | |
| 361 | + | |
| 362 | + fpu.preload = tsk_used_math(new) && new->fpu_counter > 5; | |
| 363 | + if (__thread_has_fpu(old)) { | |
| 364 | + if (!__save_init_fpu(old)) | |
| 365 | + cpu = ~0; | |
| 366 | + old->thread.fpu.last_cpu = cpu; | |
| 367 | + old->thread.fpu.has_fpu = 0; /* But leave fpu_owner_task! */ | |
| 368 | + | |
| 369 | + /* Don't change CR0.TS if we just switch! */ | |
| 370 | + if (fpu.preload) { | |
| 371 | + new->fpu_counter++; | |
| 372 | + __thread_set_has_fpu(new); | |
| 373 | + prefetch(new->thread.fpu.state); | |
| 374 | + } else | |
| 375 | + stts(); | |
| 376 | + } else { | |
| 377 | + old->fpu_counter = 0; | |
| 378 | + old->thread.fpu.last_cpu = ~0; | |
| 379 | + if (fpu.preload) { | |
| 380 | + new->fpu_counter++; | |
| 381 | + if (fpu_lazy_restore(new, cpu)) | |
| 382 | + fpu.preload = 0; | |
| 383 | + else | |
| 384 | + prefetch(new->thread.fpu.state); | |
| 385 | + __thread_fpu_begin(new); | |
| 386 | + } | |
| 387 | + } | |
| 388 | + return fpu; | |
| 389 | +} | |
| 390 | + | |
| 391 | +/* | |
| 392 | + * By the time this gets called, we've already cleared CR0.TS and | |
| 393 | + * given the process the FPU if we are going to preload the FPU | |
| 394 | + * state - all we need to do is to conditionally restore the register | |
| 395 | + * state itself. | |
| 396 | + */ | |
| 397 | +static inline void switch_fpu_finish(struct task_struct *new, fpu_switch_t fpu) | |
| 398 | +{ | |
| 399 | + if (fpu.preload) { | |
| 400 | + if (unlikely(restore_fpu_checking(new))) | |
| 401 | + __thread_fpu_end(new); | |
| 402 | + } | |
| 296 | 403 | } |
| 297 | 404 | |
| 405 | +/* | |
| 406 | + * Signal frame handlers... | |
| 407 | + */ | |
| 408 | +extern int save_i387_xstate(void __user *buf); | |
| 409 | +extern int restore_i387_xstate(void __user *buf); | |
| 410 | + | |
| 298 | 411 | static inline void __clear_fpu(struct task_struct *tsk) |
| 299 | 412 | { |
| 300 | − if (task_thread_info(tsk)->status & TS_USEDFPU) { | |
| 413 | + if (__thread_has_fpu(tsk)) { | |
| 301 | 414 | /* Ignore delayed exceptions from user space */ |
| 302 | 415 | asm volatile("1: fwait\n" |
| 303 | 416 | "2:\n" |
| 304 | 417 | _ASM_EXTABLE(1b, 2b)); |
| 305 | − task_thread_info(tsk)->status &= ~TS_USEDFPU; | |
| 306 | − stts(); | |
| 418 | + __thread_fpu_end(tsk); | |
| 307 | 419 | } |
| 308 | 420 | } |
| 309 | 421 | |
| 422 | +/* | |
| 423 | + * Were we in an interrupt that interrupted kernel mode? | |
| 424 | + * | |
| 425 | + * We can do a kernel_fpu_begin/end() pair *ONLY* if that | |
| 426 | + * pair does nothing at all: the thread must not have fpu (so | |
| 427 | + * that we don't try to save the FPU state), and TS must | |
| 428 | + * be set (so that the clts/stts pair does nothing that is | |
| 429 | + * visible in the interrupted kernel thread). | |
| 430 | + */ | |
| 431 | +static inline bool interrupted_kernel_fpu_idle(void) | |
| 432 | +{ | |
| 433 | + return !__thread_has_fpu(current) && | |
| 434 | + (read_cr0() & X86_CR0_TS); | |
| 435 | +} | |
| 436 | + | |
| 437 | +/* | |
| 438 | + * Were we in user mode (or vm86 mode) when we were | |
| 439 | + * interrupted? | |
| 440 | + * | |
| 441 | + * Doing kernel_fpu_begin/end() is ok if we are running | |
| 442 | + * in an interrupt context from user mode - we'll just | |
| 443 | + * save the FPU state as required. | |
| 444 | + */ | |
| 445 | +static inline bool interrupted_user_mode(void) | |
| 446 | +{ | |
| 447 | + struct pt_regs *regs = get_irq_regs(); | |
| 448 | + return regs && user_mode_vm(regs); | |
| 449 | +} | |
| 450 | + | |
| 451 | +/* | |
| 452 | + * Can we use the FPU in kernel mode with the | |
| 453 | + * whole "kernel_fpu_begin/end()" sequence? | |
| 454 | + * | |
| 455 | + * It's always ok in process context (ie "not interrupt") | |
| 456 | + * but it is sometimes ok even from an irq. | |
| 457 | + */ | |
| 458 | +static inline bool irq_fpu_usable(void) | |
| 459 | +{ | |
| 460 | + return !in_interrupt() || | |
| 461 | + interrupted_user_mode() || | |
| 462 | + interrupted_kernel_fpu_idle(); | |
| 463 | +} | |
| 464 | + | |
| 310 | 465 | static inline void kernel_fpu_begin(void) |
| 311 | 466 | { |
| 312 | − struct thread_info *me = current_thread_info(); | |
| 467 | + struct task_struct *me = current; | |
| 468 | + | |
| 469 | + WARN_ON_ONCE(!irq_fpu_usable()); | |
| 313 | 470 | preempt_disable(); |
| 314 | − if (me->status & TS_USEDFPU) | |
| 315 | − __save_init_fpu(me->task); | |
| 316 | − else | |
| 471 | + if (__thread_has_fpu(me)) { | |
| 472 | + __save_init_fpu(me); | |
| 473 | + __thread_clear_has_fpu(me); | |
| 474 | + /* We do 'stts()' in kernel_fpu_end() */ | |
| 475 | + } else { | |
| 476 | + percpu_write(fpu_owner_task, NULL); | |
| 317 | 477 | clts(); |
| 478 | + } | |
| 318 | 479 | } |
| 319 | 480 | |
| 320 | 481 | static inline void kernel_fpu_end(void) |
| @@ -323,14 +484,6 @@ static inline void kernel_fpu_end(void) · 2 unmodified lines | ||
| 323 | 484 | preempt_enable(); |
| 324 | 485 | } |
| 325 | 486 | |
| 326 | −static inline bool irq_fpu_usable(void) | |
| 327 | −{ | |
| 328 | − struct pt_regs *regs; | |
| 329 | − | |
| 330 | − return !in_interrupt() || !(regs = get_irq_regs()) || \ | |
| 331 | − user_mode(regs) || (read_cr0() & X86_CR0_TS); | |
| 332 | −} | |
| 333 | − | |
| 334 | 487 | /* |
| 335 | 488 | * Some instructions like VIA's padlock instructions generate a spurious |
| 336 | 489 | * DNA fault but don't modify SSE registers. And these instructions |
| @@ -362,21 +515,65 @@ static inline void irq_ts_restore(int TS_state) · 25 unmodified lines | ||
| 362 | 515 | stts(); |
| 363 | 516 | } |
| 364 | 517 | |
| 518 | +/* | |
| 519 | + * The question "does this thread have fpu access?" | |
| 520 | + * is slightly racy, since preemption could come in | |
| 521 | + * and revoke it immediately after the test. | |
| 522 | + * | |
| 523 | + * However, even in that very unlikely scenario, | |
| 524 | + * we can just assume we have FPU access - typically | |
| 525 | + * to save the FP state - we'll just take a #NM | |
| 526 | + * fault and get the FPU access back. | |
| 527 | + * | |
| 528 | + * The actual user_fpu_begin/end() functions | |
| 529 | + * need to be preemption-safe, though. | |
| 530 | + * | |
| 531 | + * NOTE! user_fpu_end() must be used only after you | |
| 532 | + * have saved the FP state, and user_fpu_begin() must | |
| 533 | + * be used only immediately before restoring it. | |
| 534 | + * These functions do not do any save/restore on | |
| 535 | + * their own. | |
| 536 | + */ | |
| 537 | +static inline int user_has_fpu(void) | |
| 538 | +{ | |
| 539 | + return __thread_has_fpu(current); | |
| 540 | +} | |
| 541 | + | |
| 542 | +static inline void user_fpu_end(void) | |
| 543 | +{ | |
| 544 | + preempt_disable(); | |
| 545 | + __thread_fpu_end(current); | |
| 546 | + preempt_enable(); | |
| 547 | +} | |
| 548 | + | |
| 549 | +static inline void user_fpu_begin(void) | |
| 550 | +{ | |
| 551 | + preempt_disable(); | |
| 552 | + if (!user_has_fpu()) | |
| 553 | + __thread_fpu_begin(current); | |
| 554 | + preempt_enable(); | |
| 555 | +} | |
| 556 | + | |
| 365 | 557 | /* |
| 366 | 558 | * These disable preemption on their own and are safe |
| 367 | 559 | */ |
| 368 | 560 | static inline void save_init_fpu(struct task_struct *tsk) |
| 369 | 561 | { |
| 562 | + WARN_ON_ONCE(!__thread_has_fpu(tsk)); | |
| 370 | 563 | preempt_disable(); |
| 371 | 564 | __save_init_fpu(tsk); |
| 372 | − stts(); | |
| 565 | + __thread_fpu_end(tsk); | |
| 373 | 566 | preempt_enable(); |
| 374 | 567 | } |
| 375 | 568 | |
| 376 | 569 | static inline void unlazy_fpu(struct task_struct *tsk) |
| 377 | 570 | { |
| 378 | 571 | preempt_disable(); |
| 379 | − __unlazy_fpu(tsk); | |
| 572 | + if (__thread_has_fpu(tsk)) { | |
| 573 | + __save_init_fpu(tsk); | |
| 574 | + __thread_fpu_end(tsk); | |
| 575 | + } else | |
| 576 | + tsk->fpu_counter = 0; | |
| 380 | 577 | preempt_enable(); |
| 381 | 578 | } |
| 382 | 579 | |
| @@ -190,6 +190,9 @@ struct x86_emulate_ops { · 189 unmodified lines | ||
| 190 | 190 | int (*intercept)(struct x86_emulate_ctxt *ctxt, |
| 191 | 191 | struct x86_instruction_info *info, |
| 192 | 192 | enum x86_intercept_stage stage); |
| 193 | + | |
| 194 | + bool (*get_cpuid)(struct x86_emulate_ctxt *ctxt, | |
| 195 | + u32 *eax, u32 *ebx, u32 *ecx, u32 *edx); | |
| 193 | 196 | }; |
| 194 | 197 | |
| 195 | 198 | typedef u32 __attribute__((vector_size(16))) sse128_t; |
| @@ -298,6 +301,19 @@ struct x86_emulate_ctxt { · 102 unmodified lines | ||
| 298 | 301 | #define X86EMUL_MODE_PROT (X86EMUL_MODE_PROT16|X86EMUL_MODE_PROT32| \ |
| 299 | 302 | X86EMUL_MODE_PROT64) |
| 300 | 303 | |
| 304 | +/* CPUID vendors */ | |
| 305 | +#define X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx 0x68747541 | |
| 306 | +#define X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx 0x444d4163 | |
| 307 | +#define X86EMUL_CPUID_VENDOR_AuthenticAMD_edx 0x69746e65 | |
| 308 | + | |
| 309 | +#define X86EMUL_CPUID_VENDOR_AMDisbetterI_ebx 0x69444d41 | |
| 310 | +#define X86EMUL_CPUID_VENDOR_AMDisbetterI_ecx 0x21726574 | |
| 311 | +#define X86EMUL_CPUID_VENDOR_AMDisbetterI_edx 0x74656273 | |
| 312 | + | |
| 313 | +#define X86EMUL_CPUID_VENDOR_GenuineIntel_ebx 0x756e6547 | |
| 314 | +#define X86EMUL_CPUID_VENDOR_GenuineIntel_ecx 0x6c65746e | |
| 315 | +#define X86EMUL_CPUID_VENDOR_GenuineIntel_edx 0x49656e69 | |
| 316 | + | |
| 301 | 317 | enum x86_intercept_stage { |
| 302 | 318 | X86_ICTP_NONE = 0, /* Allow zero-init to not match anything */ |
| 303 | 319 | X86_ICPT_PRE_EXCEPT, |
| @@ -240,4 +240,12 @@ static inline void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap) · 239 unmodified lines | ||
| 240 | 240 | static inline void perf_events_lapic_init(void) { } |
| 241 | 241 | #endif |
| 242 | 242 | |
| 243 | +#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD) | |
| 244 | + extern void amd_pmu_enable_virt(void); | |
| 245 | + extern void amd_pmu_disable_virt(void); | |
| 246 | +#else | |
| 247 | + static inline void amd_pmu_enable_virt(void) { } | |
| 248 | + static inline void amd_pmu_disable_virt(void) { } | |
| 249 | +#endif | |
| 250 | + | |
| 243 | 251 | #endif /* _ASM_X86_PERF_EVENT_H */ |
| @@ -374,6 +374,8 @@ union thread_xstate { · 373 unmodified lines | ||
| 374 | 374 | }; |
| 375 | 375 | |
| 376 | 376 | struct fpu { |
| 377 | + unsigned int last_cpu; | |
| 378 | + unsigned int has_fpu; | |
| 377 | 379 | union thread_xstate *state; |
| 378 | 380 | }; |
| 379 | 381 | |
| @@ -247,8 +247,6 @@ static inline struct thread_info *current_thread_info(void) · 246 unmodified lines | ||
| 247 | 247 | * ever touches our thread-synchronous status, so we don't |
| 248 | 248 | * have to worry about atomic accesses. |
| 249 | 249 | */ |
| 250 | −#define TS_USEDFPU 0x0001 /* FPU was used by this task | |
| 251 | − this quantum (SMP) */ | |
| 252 | 250 | #define TS_COMPAT 0x0002 /* 32bit syscall active (64BIT)*/ |
| 253 | 251 | #define TS_POLLING 0x0004 /* idle task polling need_resched, |
| 254 | 252 | skip sending interrupt */ |
| @@ -1044,6 +1044,9 @@ DEFINE_PER_CPU(char *, irq_stack_ptr) = · 1043 unmodified lines | ||
| 1044 | 1044 | |
| 1045 | 1045 | DEFINE_PER_CPU(unsigned int, irq_count) = -1; |
| 1046 | 1046 | |
| 1047 | +DEFINE_PER_CPU(struct task_struct *, fpu_owner_task); | |
| 1048 | +EXPORT_PER_CPU_SYMBOL(fpu_owner_task); | |
| 1049 | + | |
| 1047 | 1050 | /* |
| 1048 | 1051 | * Special IST stacks which the CPU switches to when it calls |
| 1049 | 1052 | * an IST-marked descriptor entry. Up to 7 stacks (hardware |
| @@ -1111,6 +1114,8 @@ void debug_stack_reset(void) · 61 unmodified lines | ||
| 1111 | 1114 | |
| 1112 | 1115 | DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; |
| 1113 | 1116 | EXPORT_PER_CPU_SYMBOL(current_task); |
| 1117 | +DEFINE_PER_CPU(struct task_struct *, fpu_owner_task); | |
| 1118 | +EXPORT_PER_CPU_SYMBOL(fpu_owner_task); | |
| 1114 | 1119 | |
| 1115 | 1120 | #ifdef CONFIG_CC_STACKPROTECTOR |
| 1116 | 1121 | DEFINE_PER_CPU_ALIGNED(struct stack_canary, stack_canary); |
| @@ -326,8 +326,7 @@ static void __cpuinit amd_calc_l3_indices(struct amd_northbridge *nb) · 325 unmodified lines | ||
| 326 | 326 | l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | −static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, | |
| 330 | − int index) | |
| 329 | +static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, int index) | |
| 331 | 330 | { |
| 332 | 331 | int node; |
| 333 | 332 | |
| @@ -725,14 +724,16 @@ static DEFINE_PER_CPU(struct _cpuid4_info *, ici_cpuid4_info); · 391 unmodified lines | ||
| 725 | 724 | #define CPUID4_INFO_IDX(x, y) (&((per_cpu(ici_cpuid4_info, x))[y])) |
| 726 | 725 | |
| 727 | 726 | #ifdef CONFIG_SMP |
| 728 | −static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) | |
| 727 | + | |
| 728 | +static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index) | |
| 729 | 729 | { |
| 730 | − struct _cpuid4_info *this_leaf, *sibling_leaf; | |
| 731 | − unsigned long num_threads_sharing; | |
| 732 | − int index_msb, i, sibling; | |
| 730 | + struct _cpuid4_info *this_leaf; | |
| 731 | + int ret, i, sibling; | |
| 733 | 732 | struct cpuinfo_x86 *c = &cpu_data(cpu); |
| 734 | 733 | |
| 735 | − if ((index == 3) && (c->x86_vendor == X86_VENDOR_AMD)) { | |
| 734 | + ret = 0; | |
| 735 | + if (index == 3) { | |
| 736 | + ret = 1; | |
| 736 | 737 | for_each_cpu(i, cpu_llc_shared_mask(cpu)) { |
| 737 | 738 | if (!per_cpu(ici_cpuid4_info, i)) |
| 738 | 739 | continue; |
| @@ -743,8 +744,35 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) · 4 unmodified lines | ||
| 743 | 744 | set_bit(sibling, this_leaf->shared_cpu_map); |
| 744 | 745 | } |
| 745 | 746 | } |
| 746 | − return; | |
| 747 | + } else if ((c->x86 == 0x15) && ((index == 1) || (index == 2))) { | |
| 748 | + ret = 1; | |
| 749 | + for_each_cpu(i, cpu_sibling_mask(cpu)) { | |
| 750 | + if (!per_cpu(ici_cpuid4_info, i)) | |
| 751 | + continue; | |
| 752 | + this_leaf = CPUID4_INFO_IDX(i, index); | |
| 753 | + for_each_cpu(sibling, cpu_sibling_mask(cpu)) { | |
| 754 | + if (!cpu_online(sibling)) | |
| 755 | + continue; | |
| 756 | + set_bit(sibling, this_leaf->shared_cpu_map); | |
| 757 | + } | |
| 758 | + } | |
| 747 | 759 | } |
| 760 | + | |
| 761 | + return ret; | |
| 762 | +} | |
| 763 | + | |
| 764 | +static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) | |
| 765 | +{ | |
| 766 | + struct _cpuid4_info *this_leaf, *sibling_leaf; | |
| 767 | + unsigned long num_threads_sharing; | |
| 768 | + int index_msb, i; | |
| 769 | + struct cpuinfo_x86 *c = &cpu_data(cpu); | |
| 770 | + | |
| 771 | + if (c->x86_vendor == X86_VENDOR_AMD) { | |
| 772 | + if (cache_shared_amd_cpu_map_setup(cpu, index)) | |
| 773 | + return; | |
| 774 | + } | |
| 775 | + | |
| 748 | 776 | this_leaf = CPUID4_INFO_IDX(cpu, index); |
| 749 | 777 | num_threads_sharing = 1 + this_leaf->base.eax.split.num_threads_sharing; |
| 750 | 778 | |
| @@ -528,6 +528,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) · 527 unmodified lines | ||
| 528 | 528 | |
| 529 | 529 | sprintf(name, "threshold_bank%i", bank); |
| 530 | 530 | |
| 531 | +#ifdef CONFIG_SMP | |
| 531 | 532 | if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ |
| 532 | 533 | i = cpumask_first(cpu_llc_shared_mask(cpu)); |
| 533 | 534 | |
| @@ -553,6 +554,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank) · 19 unmodified lines | ||
| 553 | 554 | |
| 554 | 555 | goto out; |
| 555 | 556 | } |
| 557 | +#endif | |
| 556 | 558 | |
| 557 | 559 | b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL); |
| 558 | 560 | if (!b) { |
| @@ -988,6 +988,9 @@ static void x86_pmu_start(struct perf_event *event, int flags) · 987 unmodified lines | ||
| 988 | 988 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); |
| 989 | 989 | int idx = event->hw.idx; |
| 990 | 990 | |
| 991 | + if (WARN_ON_ONCE(!(event->hw.state & PERF_HES_STOPPED))) | |
| 992 | + return; | |
| 993 | + | |
| 991 | 994 | if (WARN_ON_ONCE(idx == -1)) |
| 992 | 995 | return; |
| 993 | 996 | |
| @@ -147,7 +147,9 @@ struct cpu_hw_events { · 146 unmodified lines | ||
| 147 | 147 | /* |
| 148 | 148 | * AMD specific bits |
| 149 | 149 | */ |
| 150 | − struct amd_nb *amd_nb; | |
| 150 | + struct amd_nb *amd_nb; | |
| 151 | + /* Inverted mask of bits to clear in the perf_ctr ctrl registers */ | |
| 152 | + u64 perf_ctr_virt_mask; | |
| 151 | 153 | |
| 152 | 154 | void *kfree_on_online; |
| 153 | 155 | }; |
| @@ -425,9 +427,11 @@ void x86_pmu_disable_all(void); · 271 unmodified lines | ||
| 425 | 427 | static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc, |
| 426 | 428 | u64 enable_mask) |
| 427 | 429 | { |
| 430 | + u64 disable_mask = __this_cpu_read(cpu_hw_events.perf_ctr_virt_mask); | |
| 431 | + | |
| 428 | 432 | if (hwc->extra_reg.reg) |
| 429 | 433 | wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config); |
| 430 | − wrmsrl(hwc->config_base, hwc->config | enable_mask); | |
| 434 | + wrmsrl(hwc->config_base, (hwc->config | enable_mask) & ~disable_mask); | |
| 431 | 435 | } |
| 432 | 436 | |
| 433 | 437 | void x86_pmu_enable_all(int added); |
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | #include <linux/perf_event.h> |
| 2 | +#include <linux/export.h> | |
| 2 | 3 | #include <linux/types.h> |
| 3 | 4 | #include <linux/init.h> |
| 4 | 5 | #include <linux/slab.h> |
| @@ -357,7 +358,9 @@ static void amd_pmu_cpu_starting(int cpu) · 352 unmodified lines | ||
| 357 | 358 | struct amd_nb *nb; |
| 358 | 359 | int i, nb_id; |
| 359 | 360 | |
| 360 | − if (boot_cpu_data.x86_max_cores < 2) | |
| 361 | + cpuc->perf_ctr_virt_mask = AMD_PERFMON_EVENTSEL_HOSTONLY; | |
| 362 | + | |
| 363 | + if (boot_cpu_data.x86_max_cores < 2 || boot_cpu_data.x86 == 0x15) | |
| 361 | 364 | return; |
| 362 | 365 | |
| 363 | 366 | nb_id = amd_get_nb_id(cpu); |
| @@ -587,9 +590,9 @@ static __initconst const struct x86_pmu amd_pmu_f15h = { · 223 unmodified lines | ||
| 587 | 590 | .put_event_constraints = amd_put_event_constraints, |
| 588 | 591 | |
| 589 | 592 | .cpu_prepare = amd_pmu_cpu_prepare, |
| 590 | − .cpu_starting = amd_pmu_cpu_starting, | |
| 591 | 593 | .cpu_dead = amd_pmu_cpu_dead, |
| 592 | 594 | #endif |
| 595 | + .cpu_starting = amd_pmu_cpu_starting, | |
| 593 | 596 | }; |
| 594 | 597 | |
| 595 | 598 | __init int amd_pmu_init(void) |
| @@ -621,3 +624,33 @@ __init int amd_pmu_init(void) · 25 unmodified lines | ||
| 621 | 624 | |
| 622 | 625 | return 0; |
| 623 | 626 | } |
| 627 | + | |
| 628 | +void amd_pmu_enable_virt(void) | |
| 629 | +{ | |
| 630 | + struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | |
| 631 | + | |
| 632 | + cpuc->perf_ctr_virt_mask = 0; | |
| 633 | + | |
| 634 | + /* Reload all events */ | |
| 635 | + x86_pmu_disable_all(); | |
| 636 | + x86_pmu_enable_all(0); | |
| 637 | +} | |
| 638 | +EXPORT_SYMBOL_GPL(amd_pmu_enable_virt); | |
| 639 | + | |
| 640 | +void amd_pmu_disable_virt(void) | |
| 641 | +{ | |
| 642 | + struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | |
| 643 | + | |
| 644 | + /* | |
| 645 | + * We only mask out the Host-only bit so that host-only counting works | |
| 646 | + * when SVM is disabled. If someone sets up a guest-only counter when | |
| 647 | + * SVM is disabled the Guest-only bits still gets set and the counter | |
| 648 | + * will not count anything. | |
| 649 | + */ | |
| 650 | + cpuc->perf_ctr_virt_mask = AMD_PERFMON_EVENTSEL_HOSTONLY; | |
| 651 | + | |
| 652 | + /* Reload all events */ | |
| 653 | + x86_pmu_disable_all(); | |
| 654 | + x86_pmu_enable_all(0); | |
| 655 | +} | |
| 656 | +EXPORT_SYMBOL_GPL(amd_pmu_disable_virt); | |
| @@ -1531,11 +1531,18 @@ ENTRY(nmi) · 1530 unmodified lines | ||
| 1531 | 1531 | /* Use %rdx as out temp variable throughout */ |
| 1532 | 1532 | pushq_cfi %rdx |
| 1533 | 1533 | |
| 1534 | + /* | |
| 1535 | + * If %cs was not the kernel segment, then the NMI triggered in user | |
| 1536 | + * space, which means it is definitely not nested. | |
| 1537 | + */ | |
| 1538 | + cmpl $__KERNEL_CS, 16(%rsp) | |
| 1539 | + jne first_nmi | |
| 1540 | + | |
| 1534 | 1541 | /* |
| 1535 | 1542 | * Check the special variable on the stack to see if NMIs are |
| 1536 | 1543 | * executing. |
| 1537 | 1544 | */ |
| 1538 | − cmp $1, -8(%rsp) | |
| 1545 | + cmpl $1, -8(%rsp) | |
| 1539 | 1546 | je nested_nmi |
| 1540 | 1547 | |
| 1541 | 1548 | /* |
| @@ -360,7 +360,6 @@ out: · 359 unmodified lines | ||
| 360 | 360 | static enum ucode_state |
| 361 | 361 | request_microcode_user(int cpu, const void __user *buf, size_t size) |
| 362 | 362 | { |
| 363 | − pr_info("AMD microcode update via /dev/cpu/microcode not supported\n"); | |
| 364 | 363 | return UCODE_ERROR; |
| 365 | 364 | } |
| 366 | 365 | |
| @@ -214,6 +214,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, · 213 unmodified lines | ||
| 214 | 214 | |
| 215 | 215 | task_user_gs(p) = get_user_gs(regs); |
| 216 | 216 | |
| 217 | + p->fpu_counter = 0; | |
| 217 | 218 | p->thread.io_bitmap_ptr = NULL; |
| 218 | 219 | tsk = current; |
| 219 | 220 | err = -ENOMEM; |
| @@ -299,22 +300,11 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) · 79 unmodified lines | ||
| 299 | 300 | *next = &next_p->thread; |
| 300 | 301 | int cpu = smp_processor_id(); |
| 301 | 302 | struct tss_struct *tss = &per_cpu(init_tss, cpu); |
| 302 | − bool preload_fpu; | |
| 303 | + fpu_switch_t fpu; | |
| 303 | 304 | |
| 304 | 305 | /* never put a printk in __switch_to... printk() calls wake_up*() indirectly */ |
| 305 | 306 | |
| 306 | − /* | |
| 307 | − * If the task has used fpu the last 5 timeslices, just do a full | |
| 308 | − * restore of the math state immediately to avoid the trap; the | |
| 309 | − * chances of needing FPU soon are obviously high now | |
| 310 | − */ | |
| 311 | − preload_fpu = tsk_used_math(next_p) && next_p->fpu_counter > 5; | |
| 312 | − | |
| 313 | − __unlazy_fpu(prev_p); | |
| 314 | − | |
| 315 | − /* we're going to use this soon, after a few expensive things */ | |
| 316 | − if (preload_fpu) | |
| 317 | − prefetch(next->fpu.state); | |
| 307 | + fpu = switch_fpu_prepare(prev_p, next_p, cpu); | |
| 318 | 308 | |
| 319 | 309 | /* |
| 320 | 310 | * Reload esp0. |
| @@ -354,11 +344,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) · 33 unmodified lines | ||
| 354 | 344 | task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT)) |
| 355 | 345 | __switch_to_xtra(prev_p, next_p, tss); |
| 356 | 346 | |
| 357 | − /* If we're going to preload the fpu context, make sure clts | |
| 358 | − is run while we're batching the cpu state updates. */ | |
| 359 | − if (preload_fpu) | |
| 360 | − clts(); | |
| 361 | − | |
| 362 | 347 | /* |
| 363 | 348 | * Leave lazy mode, flushing any hypercalls made here. |
| 364 | 349 | * This must be done before restoring TLS segments so |
| @@ -368,15 +353,14 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) · 3 unmodified lines | ||
| 368 | 353 | */ |
| 369 | 354 | arch_end_context_switch(next_p); |
| 370 | 355 | |
| 371 | − if (preload_fpu) | |
| 372 | − __math_state_restore(); | |
| 373 | − | |
| 374 | 356 | /* |
| 375 | 357 | * Restore %gs if needed (which is common) |
| 376 | 358 | */ |
| 377 | 359 | if (prev->gs | next->gs) |
| 378 | 360 | lazy_load_gs(next->gs); |
| 379 | 361 | |
| 362 | + switch_fpu_finish(next_p, fpu); | |
| 363 | + | |
| 380 | 364 | percpu_write(current_task, next_p); |
| 381 | 365 | |
| 382 | 366 | return prev_p; |
| @@ -286,6 +286,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, · 285 unmodified lines | ||
| 286 | 286 | |
| 287 | 287 | set_tsk_thread_flag(p, TIF_FORK); |
| 288 | 288 | |
| 289 | + p->fpu_counter = 0; | |
| 289 | 290 | p->thread.io_bitmap_ptr = NULL; |
| 290 | 291 | |
| 291 | 292 | savesegment(gs, p->thread.gsindex); |
| @@ -386,18 +387,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) · 94 unmodified lines | ||
| 386 | 387 | int cpu = smp_processor_id(); |
| 387 | 388 | struct tss_struct *tss = &per_cpu(init_tss, cpu); |
| 388 | 389 | unsigned fsindex, gsindex; |
| 389 | − bool preload_fpu; | |
| 390 | + fpu_switch_t fpu; | |
| 390 | 391 | |
| 391 | − /* | |
| 392 | − * If the task has used fpu the last 5 timeslices, just do a full | |
| 393 | − * restore of the math state immediately to avoid the trap; the | |
| 394 | − * chances of needing FPU soon are obviously high now | |
| 395 | − */ | |
| 396 | − preload_fpu = tsk_used_math(next_p) && next_p->fpu_counter > 5; | |
| 397 | − | |
| 398 | − /* we're going to use this soon, after a few expensive things */ | |
| 399 | − if (preload_fpu) | |
| 400 | − prefetch(next->fpu.state); | |
| 392 | + fpu = switch_fpu_prepare(prev_p, next_p, cpu); | |
| 401 | 393 | |
| 402 | 394 | /* |
| 403 | 395 | * Reload esp0, LDT and the page table pointer: |
| @@ -427,13 +419,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) · 23 unmodified lines | ||
| 427 | 419 | |
| 428 | 420 | load_TLS(next, cpu); |
| 429 | 421 | |
| 430 | − /* Must be after DS reload */ | |
| 431 | − __unlazy_fpu(prev_p); | |
| 432 | − | |
| 433 | − /* Make sure cpu is ready for new context */ | |
| 434 | − if (preload_fpu) | |
| 435 | − clts(); | |
| 436 | − | |
| 437 | 422 | /* |
| 438 | 423 | * Leave lazy mode, flushing any hypercalls made here. |
| 439 | 424 | * This must be done before restoring TLS segments so |
| @@ -474,6 +459,8 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) · 34 unmodified lines | ||
| 474 | 459 | wrmsrl(MSR_KERNEL_GS_BASE, next->gs); |
| 475 | 460 | prev->gsindex = gsindex; |
| 476 | 461 | |
| 462 | + switch_fpu_finish(next_p, fpu); | |
| 463 | + | |
| 477 | 464 | /* |
| 478 | 465 | * Switch the PDA and FPU contexts. |
| 479 | 466 | */ |
| @@ -492,13 +479,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) · 12 unmodified lines | ||
| 492 | 479 | task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV)) |
| 493 | 480 | __switch_to_xtra(prev_p, next_p, tss); |
| 494 | 481 | |
| 495 | − /* | |
| 496 | − * Preload the FPU context, now that we've determined that the | |
| 497 | − * task is likely to be using it. | |
| 498 | − */ | |
| 499 | − if (preload_fpu) | |
| 500 | − __math_state_restore(); | |
| 501 | − | |
| 502 | 482 | return prev_p; |
| 503 | 483 | } |
| 504 | 484 | |
| @@ -570,28 +570,6 @@ asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void) · 569 unmodified lines | ||
| 570 | 570 | { |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | −/* | |
| 574 | − * __math_state_restore assumes that cr0.TS is already clear and the | |
| 575 | − * fpu state is all ready for use. Used during context switch. | |
| 576 | − */ | |
| 577 | −void __math_state_restore(void) | |
| 578 | −{ | |
| 579 | − struct thread_info *thread = current_thread_info(); | |
| 580 | − struct task_struct *tsk = thread->task; | |
| 581 | − | |
| 582 | − /* | |
| 583 | − * Paranoid restore. send a SIGSEGV if we fail to restore the state. | |
| 584 | − */ | |
| 585 | − if (unlikely(restore_fpu_checking(tsk))) { | |
| 586 | − stts(); | |
| 587 | − force_sig(SIGSEGV, tsk); | |
| 588 | − return; | |
| 589 | − } | |
| 590 | − | |
| 591 | − thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */ | |
| 592 | − tsk->fpu_counter++; | |
| 593 | −} | |
| 594 | − | |
| 595 | 573 | /* |
| 596 | 574 | * 'math_state_restore()' saves the current math information in the |
| 597 | 575 | * old math state array, and gets the new ones from the current task |
| @@ -599,13 +577,12 @@ void __math_state_restore(void) · 1 unmodified line | ||
| 599 | 577 | * Careful.. There are problems with IBM-designed IRQ13 behaviour. |
| 600 | 578 | * Don't touch unless you *really* know how it works. |
| 601 | 579 | * |
| 602 | − * Must be called with kernel preemption disabled (in this case, | |
| 603 | − * local interrupts are disabled at the call-site in entry.S). | |
| 580 | + * Must be called with kernel preemption disabled (eg with local | |
| 581 | + * local interrupts as in the case of do_device_not_available). | |
| 604 | 582 | */ |
| 605 | −asmlinkage void math_state_restore(void) | |
| 583 | +void math_state_restore(void) | |
| 606 | 584 | { |
| 607 | − struct thread_info *thread = current_thread_info(); | |
| 608 | − struct task_struct *tsk = thread->task; | |
| 585 | + struct task_struct *tsk = current; | |
| 609 | 586 | |
| 610 | 587 | if (!tsk_used_math(tsk)) { |
| 611 | 588 | local_irq_enable(); |
| @@ -622,9 +599,17 @@ asmlinkage void math_state_restore(void) · 10 unmodified lines | ||
| 622 | 599 | local_irq_disable(); |
| 623 | 600 | } |
| 624 | 601 | |
| 625 | − clts(); /* Allow maths ops (or we recurse) */ | |
| 602 | + __thread_fpu_begin(tsk); | |
| 603 | + /* | |
| 604 | + * Paranoid restore. send a SIGSEGV if we fail to restore the state. | |
| 605 | + */ | |
| 606 | + if (unlikely(restore_fpu_checking(tsk))) { | |
| 607 | + __thread_fpu_end(tsk); | |
| 608 | + force_sig(SIGSEGV, tsk); | |
| 609 | + return; | |
| 610 | + } | |
| 626 | 611 | |
| 627 | − __math_state_restore(); | |
| 612 | + tsk->fpu_counter++; | |
| 628 | 613 | } |
| 629 | 614 | EXPORT_SYMBOL_GPL(math_state_restore); |
| 630 | 615 | |
| @@ -47,7 +47,7 @@ void __sanitize_i387_state(struct task_struct *tsk) · 46 unmodified lines | ||
| 47 | 47 | if (!fx) |
| 48 | 48 | return; |
| 49 | 49 | |
| 50 | − BUG_ON(task_thread_info(tsk)->status & TS_USEDFPU); | |
| 50 | + BUG_ON(__thread_has_fpu(tsk)); | |
| 51 | 51 | |
| 52 | 52 | xstate_bv = tsk->thread.fpu.state->xsave.xsave_hdr.xstate_bv; |
| 53 | 53 | |
| @@ -168,7 +168,7 @@ int save_i387_xstate(void __user *buf) · 114 unmodified lines | ||
| 168 | 168 | if (!used_math()) |
| 169 | 169 | return 0; |
| 170 | 170 | |
| 171 | − if (task_thread_info(tsk)->status & TS_USEDFPU) { | |
| 171 | + if (user_has_fpu()) { | |
| 172 | 172 | if (use_xsave()) |
| 173 | 173 | err = xsave_user(buf); |
| 174 | 174 | else |
| @@ -176,8 +176,7 @@ int save_i387_xstate(void __user *buf) · 1 unmodified line | ||
| 176 | 176 | |
| 177 | 177 | if (err) |
| 178 | 178 | return err; |
| 179 | − task_thread_info(tsk)->status &= ~TS_USEDFPU; | |
| 180 | − stts(); | |
| 179 | + user_fpu_end(); | |
| 181 | 180 | } else { |
| 182 | 181 | sanitize_i387_state(tsk); |
| 183 | 182 | if (__copy_to_user(buf, &tsk->thread.fpu.state->fxsave, |
| @@ -292,10 +291,7 @@ int restore_i387_xstate(void __user *buf) · 108 unmodified lines | ||
| 292 | 291 | return err; |
| 293 | 292 | } |
| 294 | 293 | |
| 295 | − if (!(task_thread_info(current)->status & TS_USEDFPU)) { | |
| 296 | − clts(); | |
| 297 | − task_thread_info(current)->status |= TS_USEDFPU; | |
| 298 | − } | |
| 294 | + user_fpu_begin(); | |
| 299 | 295 | if (use_xsave()) |
| 300 | 296 | err = restore_user_xstate(buf); |
| 301 | 297 | else |
| @@ -1891,6 +1891,51 @@ setup_syscalls_segments(struct x86_emulate_ctxt *ctxt, · 1890 unmodified lines | ||
| 1891 | 1891 | ss->p = 1; |
| 1892 | 1892 | } |
| 1893 | 1893 | |
| 1894 | +static bool em_syscall_is_enabled(struct x86_emulate_ctxt *ctxt) | |
| 1895 | +{ | |
| 1896 | + struct x86_emulate_ops *ops = ctxt->ops; | |
| 1897 | + u32 eax, ebx, ecx, edx; | |
| 1898 | + | |
| 1899 | + /* | |
| 1900 | + * syscall should always be enabled in longmode - so only become | |
| 1901 | + * vendor specific (cpuid) if other modes are active... | |
| 1902 | + */ | |
| 1903 | + if (ctxt->mode == X86EMUL_MODE_PROT64) | |
| 1904 | + return true; | |
| 1905 | + | |
| 1906 | + eax = 0x00000000; | |
| 1907 | + ecx = 0x00000000; | |
| 1908 | + if (ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx)) { | |
| 1909 | + /* | |
| 1910 | + * Intel ("GenuineIntel") | |
| 1911 | + * remark: Intel CPUs only support "syscall" in 64bit | |
| 1912 | + * longmode. Also an 64bit guest with a | |
| 1913 | + * 32bit compat-app running will #UD !! While this | |
| 1914 | + * behaviour can be fixed (by emulating) into AMD | |
| 1915 | + * response - CPUs of AMD can't behave like Intel. | |
| 1916 | + */ | |
| 1917 | + if (ebx == X86EMUL_CPUID_VENDOR_GenuineIntel_ebx && | |
| 1918 | + ecx == X86EMUL_CPUID_VENDOR_GenuineIntel_ecx && | |
| 1919 | + edx == X86EMUL_CPUID_VENDOR_GenuineIntel_edx) | |
| 1920 | + return false; | |
| 1921 | + | |
| 1922 | + /* AMD ("AuthenticAMD") */ | |
| 1923 | + if (ebx == X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx && | |
| 1924 | + ecx == X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx && | |
| 1925 | + edx == X86EMUL_CPUID_VENDOR_AuthenticAMD_edx) | |
| 1926 | + return true; | |
| 1927 | + | |
| 1928 | + /* AMD ("AMDisbetter!") */ | |
| 1929 | + if (ebx == X86EMUL_CPUID_VENDOR_AMDisbetterI_ebx && | |
| 1930 | + ecx == X86EMUL_CPUID_VENDOR_AMDisbetterI_ecx && | |
| 1931 | + edx == X86EMUL_CPUID_VENDOR_AMDisbetterI_edx) | |
| 1932 | + return true; | |
| 1933 | + } | |
| 1934 | + | |
| 1935 | + /* default: (not Intel, not AMD), apply Intel's stricter rules... */ | |
| 1936 | + return false; | |
| 1937 | +} | |
| 1938 | + | |
| 1894 | 1939 | static int em_syscall(struct x86_emulate_ctxt *ctxt) |
| 1895 | 1940 | { |
| 1896 | 1941 | struct x86_emulate_ops *ops = ctxt->ops; |
| @@ -1904,9 +1949,15 @@ static int em_syscall(struct x86_emulate_ctxt *ctxt) · 7 unmodified lines | ||
| 1904 | 1949 | ctxt->mode == X86EMUL_MODE_VM86) |
| 1905 | 1950 | return emulate_ud(ctxt); |
| 1906 | 1951 | |
| 1952 | + if (!(em_syscall_is_enabled(ctxt))) | |
| 1953 | + return emulate_ud(ctxt); | |
| 1954 | + | |
| 1907 | 1955 | ops->get_msr(ctxt, MSR_EFER, &efer); |
| 1908 | 1956 | setup_syscalls_segments(ctxt, &cs, &ss); |
| 1909 | 1957 | |
| 1958 | + if (!(efer & EFER_SCE)) | |
| 1959 | + return emulate_ud(ctxt); | |
| 1960 | + | |
| 1910 | 1961 | ops->get_msr(ctxt, MSR_STAR, &msr_data); |
| 1911 | 1962 | msr_data >>= 32; |
| 1912 | 1963 | cs_sel = (u16)(msr_data & 0xfffc); |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include <linux/ftrace_event.h> |
| 30 | 30 | #include <linux/slab.h> |
| 31 | 31 | |
| 32 | +#include <asm/perf_event.h> | |
| 32 | 33 | #include <asm/tlbflush.h> |
| 33 | 34 | #include <asm/desc.h> |
| 34 | 35 | #include <asm/kvm_para.h> |
| @@ -575,6 +576,8 @@ static void svm_hardware_disable(void *garbage) · 540 unmodified lines | ||
| 575 | 576 | wrmsrl(MSR_AMD64_TSC_RATIO, TSC_RATIO_DEFAULT); |
| 576 | 577 | |
| 577 | 578 | cpu_svm_disable(); |
| 579 | + | |
| 580 | + amd_pmu_disable_virt(); | |
| 578 | 581 | } |
| 579 | 582 | |
| 580 | 583 | static int svm_hardware_enable(void *garbage) |
| @@ -622,6 +625,8 @@ static int svm_hardware_enable(void *garbage) · 41 unmodified lines | ||
| 622 | 625 | |
| 623 | 626 | svm_init_erratum_383(); |
| 624 | 627 | |
| 628 | + amd_pmu_enable_virt(); | |
| 629 | + | |
| 625 | 630 | return 0; |
| 626 | 631 | } |
| 627 | 632 | |
| @@ -1457,7 +1457,7 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx) · 1456 unmodified lines | ||
| 1457 | 1457 | #ifdef CONFIG_X86_64 |
| 1458 | 1458 | wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); |
| 1459 | 1459 | #endif |
| 1460 | − if (current_thread_info()->status & TS_USEDFPU) | |
| 1460 | + if (__thread_has_fpu(current)) | |
| 1461 | 1461 | clts(); |
| 1462 | 1462 | load_gdt(&__get_cpu_var(host_gdt)); |
| 1463 | 1463 | } |
| @@ -1495,6 +1495,8 @@ static void record_steal_time(struct kvm_vcpu *vcpu) · 1494 unmodified lines | ||
| 1495 | 1495 | |
| 1496 | 1496 | int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) |
| 1497 | 1497 | { |
| 1498 | + bool pr = false; | |
| 1499 | + | |
| 1498 | 1500 | switch (msr) { |
| 1499 | 1501 | case MSR_EFER: |
| 1500 | 1502 | return set_efer(vcpu, data); |
| @@ -1635,6 +1637,18 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) · 134 unmodified lines | ||
| 1635 | 1637 | pr_unimpl(vcpu, "unimplemented perfctr wrmsr: " |
| 1636 | 1638 | "0x%x data 0x%llx\n", msr, data); |
| 1637 | 1639 | break; |
| 1640 | + case MSR_P6_PERFCTR0: | |
| 1641 | + case MSR_P6_PERFCTR1: | |
| 1642 | + pr = true; | |
| 1643 | + case MSR_P6_EVNTSEL0: | |
| 1644 | + case MSR_P6_EVNTSEL1: | |
| 1645 | + if (kvm_pmu_msr(vcpu, msr)) | |
| 1646 | + return kvm_pmu_set_msr(vcpu, msr, data); | |
| 1647 | + | |
| 1648 | + if (pr || data != 0) | |
| 1649 | + pr_unimpl(vcpu, "disabled perfctr wrmsr: " | |
| 1650 | + "0x%x data 0x%llx\n", msr, data); | |
| 1651 | + break; | |
| 1638 | 1652 | case MSR_K7_CLK_CTL: |
| 1639 | 1653 | /* |
| 1640 | 1654 | * Ignore all writes to this no longer documented MSR. |
| @@ -1835,6 +1849,14 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) · 194 unmodified lines | ||
| 1835 | 1849 | case MSR_FAM10H_MMIO_CONF_BASE: |
| 1836 | 1850 | data = 0; |
| 1837 | 1851 | break; |
| 1852 | + case MSR_P6_PERFCTR0: | |
| 1853 | + case MSR_P6_PERFCTR1: | |
| 1854 | + case MSR_P6_EVNTSEL0: | |
| 1855 | + case MSR_P6_EVNTSEL1: | |
| 1856 | + if (kvm_pmu_msr(vcpu, msr)) | |
| 1857 | + return kvm_pmu_get_msr(vcpu, msr, pdata); | |
| 1858 | + data = 0; | |
| 1859 | + break; | |
| 1838 | 1860 | case MSR_IA32_UCODE_REV: |
| 1839 | 1861 | data = 0x100000000ULL; |
| 1840 | 1862 | break; |
| @@ -4180,6 +4202,28 @@ static int emulator_intercept(struct x86_emulate_ctxt *ctxt, · 2339 unmodified lines | ||
| 4180 | 4202 | return kvm_x86_ops->check_intercept(emul_to_vcpu(ctxt), info, stage); |
| 4181 | 4203 | } |
| 4182 | 4204 | |
| 4205 | +static bool emulator_get_cpuid(struct x86_emulate_ctxt *ctxt, | |
| 4206 | + u32 *eax, u32 *ebx, u32 *ecx, u32 *edx) | |
| 4207 | +{ | |
| 4208 | + struct kvm_cpuid_entry2 *cpuid = NULL; | |
| 4209 | + | |
| 4210 | + if (eax && ecx) | |
| 4211 | + cpuid = kvm_find_cpuid_entry(emul_to_vcpu(ctxt), | |
| 4212 | + *eax, *ecx); | |
| 4213 | + | |
| 4214 | + if (cpuid) { | |
| 4215 | + *eax = cpuid->eax; | |
| 4216 | + *ecx = cpuid->ecx; | |
| 4217 | + if (ebx) | |
| 4218 | + *ebx = cpuid->ebx; | |
| 4219 | + if (edx) | |
| 4220 | + *edx = cpuid->edx; | |
| 4221 | + return true; | |
| 4222 | + } | |
| 4223 | + | |
| 4224 | + return false; | |
| 4225 | +} | |
| 4226 | + | |
| 4183 | 4227 | static struct x86_emulate_ops emulate_ops = { |
| 4184 | 4228 | .read_std = kvm_read_guest_virt_system, |
| 4185 | 4229 | .write_std = kvm_write_guest_virt_system, |
| @@ -4211,6 +4255,7 @@ static struct x86_emulate_ops emulate_ops = { · 25 unmodified lines | ||
| 4211 | 4255 | .get_fpu = emulator_get_fpu, |
| 4212 | 4256 | .put_fpu = emulator_put_fpu, |
| 4213 | 4257 | .intercept = emulator_intercept, |
| 4258 | + .get_cpuid = emulator_get_cpuid, | |
| 4214 | 4259 | }; |
| 4215 | 4260 | |
| 4216 | 4261 | static void cache_all_regs(struct kvm_vcpu *vcpu) |
| @@ -374,7 +374,7 @@ int __init pci_xen_init(void) · 373 unmodified lines | ||
| 374 | 374 | |
| 375 | 375 | int __init pci_xen_hvm_init(void) |
| 376 | 376 | { |
| 377 | − if (!xen_feature(XENFEAT_hvm_pirqs)) | |
| 377 | + if (!xen_have_vector_callback || !xen_feature(XENFEAT_hvm_pirqs)) | |
| 378 | 378 | return 0; |
| 379 | 379 | |
| 380 | 380 | #ifdef CONFIG_ACPI |
| @@ -1141,7 +1141,9 @@ asmlinkage void __init xen_start_kernel(void) · 1140 unmodified lines | ||
| 1141 | 1141 | |
| 1142 | 1142 | /* Prevent unwanted bits from being set in PTEs. */ |
| 1143 | 1143 | __supported_pte_mask &= ~_PAGE_GLOBAL; |
| 1144 | +#if 0 | |
| 1144 | 1145 | if (!xen_initial_domain()) |
| 1146 | +#endif | |
| 1145 | 1147 | __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD); |
| 1146 | 1148 | |
| 1147 | 1149 | __supported_pte_mask |= _PAGE_IOMAP; |
| @@ -1204,10 +1206,6 @@ asmlinkage void __init xen_start_kernel(void) · 56 unmodified lines | ||
| 1204 | 1206 | |
| 1205 | 1207 | pgd = (pgd_t *)xen_start_info->pt_base; |
| 1206 | 1208 | |
| 1207 | − if (!xen_initial_domain()) | |
| 1208 | − __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD); | |
| 1209 | − | |
| 1210 | − __supported_pte_mask |= _PAGE_IOMAP; | |
| 1211 | 1209 | /* Don't do the full vcpu_info placement stuff until we have a |
| 1212 | 1210 | possible map and a non-dummy shared_info. */ |
| 1213 | 1211 | per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; |
| @@ -415,13 +415,13 @@ static pteval_t iomap_pte(pteval_t val) · 414 unmodified lines | ||
| 415 | 415 | static pteval_t xen_pte_val(pte_t pte) |
| 416 | 416 | { |
| 417 | 417 | pteval_t pteval = pte.pte; |
| 418 | − | |
| 418 | +#if 0 | |
| 419 | 419 | /* If this is a WC pte, convert back from Xen WC to Linux WC */ |
| 420 | 420 | if ((pteval & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)) == _PAGE_PAT) { |
| 421 | 421 | WARN_ON(!pat_enabled); |
| 422 | 422 | pteval = (pteval & ~_PAGE_PAT) | _PAGE_PWT; |
| 423 | 423 | } |
| 424 | − | |
| 424 | +#endif | |
| 425 | 425 | if (xen_initial_domain() && (pteval & _PAGE_IOMAP)) |
| 426 | 426 | return pteval; |
| 427 | 427 | |
| @@ -463,7 +463,7 @@ void xen_set_pat(u64 pat) · 35 unmodified lines | ||
| 463 | 463 | static pte_t xen_make_pte(pteval_t pte) |
| 464 | 464 | { |
| 465 | 465 | phys_addr_t addr = (pte & PTE_PFN_MASK); |
| 466 | − | |
| 466 | +#if 0 | |
| 467 | 467 | /* If Linux is trying to set a WC pte, then map to the Xen WC. |
| 468 | 468 | * If _PAGE_PAT is set, then it probably means it is really |
| 469 | 469 | * _PAGE_PSE, so avoid fiddling with the PAT mapping and hope |
| @@ -476,7 +476,7 @@ static pte_t xen_make_pte(pteval_t pte) · 6 unmodified lines | ||
| 476 | 476 | if ((pte & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT) |
| 477 | 477 | pte = (pte & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT; |
| 478 | 478 | } |
| 479 | − | |
| 479 | +#endif | |
| 480 | 480 | /* |
| 481 | 481 | * Unprivileged domains are allowed to do IOMAPpings for |
| 482 | 482 | * PCI passthrough, but not map ISA space. The ISA |
| @@ -409,6 +409,13 @@ static void __cpuinit xen_play_dead(void) /* used only with HOTPLUG_CPU */ · 408 unmodified lines | ||
| 409 | 409 | play_dead_common(); |
| 410 | 410 | HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); |
| 411 | 411 | cpu_bringup(); |
| 412 | + /* | |
| 413 | + * Balance out the preempt calls - as we are running in cpu_idle | |
| 414 | + * loop which has been called at bootup from cpu_bringup_and_idle. | |
| 415 | + * The cpucpu_bringup_and_idle called cpu_bringup which made a | |
| 416 | + * preempt_disable() So this preempt_enable will balance it out. | |
| 417 | + */ | |
| 418 | + preempt_enable(); | |
| 412 | 419 | } |
| 413 | 420 | |
| 414 | 421 | #else /* !CONFIG_HOTPLUG_CPU */ |
| @@ -118,7 +118,4 @@ extern void *memmove(void *__dest, __const__ void *__src, size_t __n); · 117 unmodified lines | ||
| 118 | 118 | /* Don't build bcopy at all ... */ |
| 119 | 119 | #define __HAVE_ARCH_BCOPY |
| 120 | 120 | |
| 121 | −#define __HAVE_ARCH_MEMSCAN | |
| 122 | −#define memscan memchr | |
| 123 | − | |
| 124 | 121 | #endif /* _XTENSA_STRING_H */ |
| @@ -1659,7 +1659,7 @@ static void blkiocg_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, · 1658 unmodified lines | ||
| 1659 | 1659 | ioc = get_task_io_context(task, GFP_ATOMIC, NUMA_NO_NODE); |
| 1660 | 1660 | if (ioc) { |
| 1661 | 1661 | ioc_cgroup_changed(ioc); |
| 1662 | − put_io_context(ioc, NULL); | |
| 1662 | + put_io_context(ioc); | |
| 1663 | 1663 | } |
| 1664 | 1664 | } |
| 1665 | 1665 | } |
| @@ -642,7 +642,7 @@ static inline void blk_free_request(struct request_queue *q, struct request *rq) · 641 unmodified lines | ||
| 642 | 642 | if (rq->cmd_flags & REQ_ELVPRIV) { |
| 643 | 643 | elv_put_request(q, rq); |
| 644 | 644 | if (rq->elv.icq) |
| 645 | − put_io_context(rq->elv.icq->ioc, q); | |
| 645 | + put_io_context(rq->elv.icq->ioc); | |
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | mempool_free(rq, q->rq.rq_pool); |
| @@ -872,13 +872,15 @@ retry: · 223 unmodified lines | ||
| 872 | 872 | spin_unlock_irq(q->queue_lock); |
| 873 | 873 | |
| 874 | 874 | /* create icq if missing */ |
| 875 | − if (unlikely(et->icq_cache && !icq)) | |
| 875 | + if ((rw_flags & REQ_ELVPRIV) && unlikely(et->icq_cache && !icq)) { | |
| 876 | 876 | icq = ioc_create_icq(q, gfp_mask); |
| 877 | + if (!icq) | |
| 878 | + goto fail_icq; | |
| 879 | + } | |
| 877 | 880 | |
| 878 | − /* rqs are guaranteed to have icq on elv_set_request() if requested */ | |
| 879 | − if (likely(!et->icq_cache || icq)) | |
| 880 | − rq = blk_alloc_request(q, icq, rw_flags, gfp_mask); | |
| 881 | + rq = blk_alloc_request(q, icq, rw_flags, gfp_mask); | |
| 881 | 882 | |
| 883 | +fail_icq: | |
| 882 | 884 | if (unlikely(!rq)) { |
| 883 | 885 | /* |
| 884 | 886 | * Allocation failed presumably due to memory. Undo anything |
| @@ -1210,7 +1212,6 @@ static bool bio_attempt_back_merge(struct request_queue *q, struct request *req, · 325 unmodified lines | ||
| 1210 | 1212 | req->ioprio = ioprio_best(req->ioprio, bio_prio(bio)); |
| 1211 | 1213 | |
| 1212 | 1214 | drive_stat_acct(req, 0); |
| 1213 | − elv_bio_merged(q, req, bio); | |
| 1214 | 1215 | return true; |
| 1215 | 1216 | } |
| 1216 | 1217 | |
| @@ -1241,7 +1242,6 @@ static bool bio_attempt_front_merge(struct request_queue *q, · 24 unmodified lines | ||
| 1241 | 1242 | req->ioprio = ioprio_best(req->ioprio, bio_prio(bio)); |
| 1242 | 1243 | |
| 1243 | 1244 | drive_stat_acct(req, 0); |
| 1244 | − elv_bio_merged(q, req, bio); | |
| 1245 | 1245 | return true; |
| 1246 | 1246 | } |
| 1247 | 1247 | |
| @@ -1255,13 +1255,12 @@ static bool bio_attempt_front_merge(struct request_queue *q, · 7 unmodified lines | ||
| 1255 | 1255 | * on %current's plugged list. Returns %true if merge was successful, |
| 1256 | 1256 | * otherwise %false. |
| 1257 | 1257 | * |
| 1258 | − * This function is called without @q->queue_lock; however, elevator is | |
| 1259 | − * accessed iff there already are requests on the plugged list which in | |
| 1260 | − * turn guarantees validity of the elevator. | |
| 1261 | − * | |
| 1262 | − * Note that, on successful merge, elevator operation | |
| 1263 | − * elevator_bio_merged_fn() will be called without queue lock. Elevator | |
| 1264 | − * must be ready for this. | |
| 1258 | + * Plugging coalesces IOs from the same issuer for the same purpose without | |
| 1259 | + * going through @q->queue_lock. As such it's more of an issuing mechanism | |
| 1260 | + * than scheduling, and the request, while may have elvpriv data, is not | |
| 1261 | + * added on the elevator at this point. In addition, we don't have | |
| 1262 | + * reliable access to the elevator outside queue lock. Only check basic | |
| 1263 | + * merging parameters without querying the elevator. | |
| 1265 | 1264 | */ |
| 1266 | 1265 | static bool attempt_plug_merge(struct request_queue *q, struct bio *bio, |
| 1267 | 1266 | unsigned int *request_count) |
| @@ -1280,10 +1279,10 @@ static bool attempt_plug_merge(struct request_queue *q, struct bio *bio, · 12 unmodified lines | ||
| 1280 | 1279 | |
| 1281 | 1280 | (*request_count)++; |
| 1282 | 1281 | |
| 1283 | − if (rq->q != q) | |
| 1282 | + if (rq->q != q || !blk_rq_merge_ok(rq, bio)) | |
| 1284 | 1283 | continue; |
| 1285 | 1284 | |
| 1286 | − el_ret = elv_try_merge(rq, bio); | |
| 1285 | + el_ret = blk_try_merge(rq, bio); | |
| 1287 | 1286 | if (el_ret == ELEVATOR_BACK_MERGE) { |
| 1288 | 1287 | ret = bio_attempt_back_merge(q, rq, bio); |
| 1289 | 1288 | if (ret) |
| @@ -1345,12 +1344,14 @@ void blk_queue_bio(struct request_queue *q, struct bio *bio) · 55 unmodified lines | ||
| 1345 | 1344 | el_ret = elv_merge(q, &req, bio); |
| 1346 | 1345 | if (el_ret == ELEVATOR_BACK_MERGE) { |
| 1347 | 1346 | if (bio_attempt_back_merge(q, req, bio)) { |
| 1347 | + elv_bio_merged(q, req, bio); | |
| 1348 | 1348 | if (!attempt_back_merge(q, req)) |
| 1349 | 1349 | elv_merged_request(q, req, el_ret); |
| 1350 | 1350 | goto out_unlock; |
| 1351 | 1351 | } |
| 1352 | 1352 | } else if (el_ret == ELEVATOR_FRONT_MERGE) { |
| 1353 | 1353 | if (bio_attempt_front_merge(q, req, bio)) { |
| 1354 | + elv_bio_merged(q, req, bio); | |
| 1354 | 1355 | if (!attempt_front_merge(q, req)) |
| 1355 | 1356 | elv_merged_request(q, req, el_ret); |
| 1356 | 1357 | goto out_unlock; |
| @@ -29,21 +29,6 @@ void get_io_context(struct io_context *ioc) · 28 unmodified lines | ||
| 29 | 29 | } |
| 30 | 30 | EXPORT_SYMBOL(get_io_context); |
| 31 | 31 | |
| 32 | −/* | |
| 33 | − * Releasing ioc may nest into another put_io_context() leading to nested | |
| 34 | − * fast path release. As the ioc's can't be the same, this is okay but | |
| 35 | − * makes lockdep whine. Keep track of nesting and use it as subclass. | |
| 36 | − */ | |
| 37 | −#ifdef CONFIG_LOCKDEP | |
| 38 | −#define ioc_release_depth(q) ((q) ? (q)->ioc_release_depth : 0) | |
| 39 | −#define ioc_release_depth_inc(q) (q)->ioc_release_depth++ | |
| 40 | −#define ioc_release_depth_dec(q) (q)->ioc_release_depth-- | |
| 41 | −#else | |
| 42 | −#define ioc_release_depth(q) 0 | |
| 43 | −#define ioc_release_depth_inc(q) do { } while (0) | |
| 44 | −#define ioc_release_depth_dec(q) do { } while (0) | |
| 45 | −#endif | |
| 46 | − | |
| 47 | 32 | static void icq_free_icq_rcu(struct rcu_head *head) |
| 48 | 33 | { |
| 49 | 34 | struct io_cq *icq = container_of(head, struct io_cq, __rcu_head); |
| @@ -75,11 +60,8 @@ static void ioc_exit_icq(struct io_cq *icq) · 25 unmodified lines | ||
| 75 | 60 | if (rcu_dereference_raw(ioc->icq_hint) == icq) |
| 76 | 61 | rcu_assign_pointer(ioc->icq_hint, NULL); |
| 77 | 62 | |
| 78 | − if (et->ops.elevator_exit_icq_fn) { | |
| 79 | − ioc_release_depth_inc(q); | |
| 63 | + if (et->ops.elevator_exit_icq_fn) | |
| 80 | 64 | et->ops.elevator_exit_icq_fn(icq); |
| 81 | − ioc_release_depth_dec(q); | |
| 82 | − } | |
| 83 | 65 | |
| 84 | 66 | /* |
| 85 | 67 | * @icq->q might have gone away by the time RCU callback runs |
| @@ -98,8 +80,15 @@ static void ioc_release_fn(struct work_struct *work) · 12 unmodified lines | ||
| 98 | 80 | struct io_context *ioc = container_of(work, struct io_context, |
| 99 | 81 | release_work); |
| 100 | 82 | struct request_queue *last_q = NULL; |
| 83 | + unsigned long flags; | |
| 101 | 84 | |
| 102 | − spin_lock_irq(&ioc->lock); | |
| 85 | + /* | |
| 86 | + * Exiting icq may call into put_io_context() through elevator | |
| 87 | + * which will trigger lockdep warning. The ioc's are guaranteed to | |
| 88 | + * be different, use a different locking subclass here. Use | |
| 89 | + * irqsave variant as there's no spin_lock_irq_nested(). | |
| 90 | + */ | |
| 91 | + spin_lock_irqsave_nested(&ioc->lock, flags, 1); | |
| 103 | 92 | |
| 104 | 93 | while (!hlist_empty(&ioc->icq_list)) { |
| 105 | 94 | struct io_cq *icq = hlist_entry(ioc->icq_list.first, |
| @@ -121,15 +110,15 @@ static void ioc_release_fn(struct work_struct *work) · 15 unmodified lines | ||
| 121 | 110 | */ |
| 122 | 111 | if (last_q) { |
| 123 | 112 | spin_unlock(last_q->queue_lock); |
| 124 | − spin_unlock_irq(&ioc->lock); | |
| 113 | + spin_unlock_irqrestore(&ioc->lock, flags); | |
| 125 | 114 | blk_put_queue(last_q); |
| 126 | 115 | } else { |
| 127 | − spin_unlock_irq(&ioc->lock); | |
| 116 | + spin_unlock_irqrestore(&ioc->lock, flags); | |
| 128 | 117 | } |
| 129 | 118 | |
| 130 | 119 | last_q = this_q; |
| 131 | − spin_lock_irq(this_q->queue_lock); | |
| 132 | − spin_lock(&ioc->lock); | |
| 120 | + spin_lock_irqsave(this_q->queue_lock, flags); | |
| 121 | + spin_lock_nested(&ioc->lock, 1); | |
| 133 | 122 | continue; |
| 134 | 123 | } |
| 135 | 124 | ioc_exit_icq(icq); |
| @@ -137,10 +126,10 @@ static void ioc_release_fn(struct work_struct *work) · 1 unmodified line | ||
| 137 | 126 | |
| 138 | 127 | if (last_q) { |
| 139 | 128 | spin_unlock(last_q->queue_lock); |
| 140 | − spin_unlock_irq(&ioc->lock); | |
| 129 | + spin_unlock_irqrestore(&ioc->lock, flags); | |
| 141 | 130 | blk_put_queue(last_q); |
| 142 | 131 | } else { |
| 143 | − spin_unlock_irq(&ioc->lock); | |
| 132 | + spin_unlock_irqrestore(&ioc->lock, flags); | |
| 144 | 133 | } |
| 145 | 134 | |
| 146 | 135 | kmem_cache_free(iocontext_cachep, ioc); |
| @@ -149,79 +138,29 @@ static void ioc_release_fn(struct work_struct *work) · 2 unmodified lines | ||
| 149 | 138 | /** |
| 150 | 139 | * put_io_context - put a reference of io_context |
| 151 | 140 | * @ioc: io_context to put |
| 152 | − * @locked_q: request_queue the caller is holding queue_lock of (hint) | |
| 153 | 141 | * |
| 154 | 142 | * Decrement reference count of @ioc and release it if the count reaches |
| 155 | − * zero. If the caller is holding queue_lock of a queue, it can indicate | |
| 156 | − * that with @locked_q. This is an optimization hint and the caller is | |
| 157 | − * allowed to pass in %NULL even when it's holding a queue_lock. | |
| 143 | + * zero. | |
| 158 | 144 | */ |
| 159 | −void put_io_context(struct io_context *ioc, struct request_queue *locked_q) | |
| 145 | +void put_io_context(struct io_context *ioc) | |
| 160 | 146 | { |
| 161 | − struct request_queue *last_q = locked_q; | |
| 162 | 147 | unsigned long flags; |
| 163 | 148 | |
| 164 | 149 | if (ioc == NULL) |
| 165 | 150 | return; |
| 166 | 151 | |
| 167 | 152 | BUG_ON(atomic_long_read(&ioc->refcount) <= 0); |
| 168 | − if (locked_q) | |
| 169 | − lockdep_assert_held(locked_q->queue_lock); | |
| 170 | − | |
| 171 | − if (!atomic_long_dec_and_test(&ioc->refcount)) | |
| 172 | − return; | |
| 173 | 153 | |
| 174 | 154 | /* |
| 175 | − * Destroy @ioc. This is a bit messy because icq's are chained | |
| 176 | − * from both ioc and queue, and ioc->lock nests inside queue_lock. | |
| 177 | − * The inner ioc->lock should be held to walk our icq_list and then | |
| 178 | − * for each icq the outer matching queue_lock should be grabbed. | |
| 179 | − * ie. We need to do reverse-order double lock dancing. | |
| 180 | − * | |
| 181 | − * Another twist is that we are often called with one of the | |
| 182 | − * matching queue_locks held as indicated by @locked_q, which | |
| 183 | − * prevents performing double-lock dance for other queues. | |
| 184 | − * | |
| 185 | − * So, we do it in two stages. The fast path uses the queue_lock | |
| 186 | − * the caller is holding and, if other queues need to be accessed, | |
| 187 | − * uses trylock to avoid introducing locking dependency. This can | |
| 188 | − * handle most cases, especially if @ioc was performing IO on only | |
| 189 | − * single device. | |
| 190 | − * | |
| 191 | − * If trylock doesn't cut it, we defer to @ioc->release_work which | |
| 192 | − * can do all the double-locking dancing. | |
| 155 | + * Releasing ioc requires reverse order double locking and we may | |
| 156 | + * already be holding a queue_lock. Do it asynchronously from wq. | |
| 193 | 157 | */ |
| 194 | − spin_lock_irqsave_nested(&ioc->lock, flags, | |
| 195 | − ioc_release_depth(locked_q)); | |
| 196 | − | |
| 197 | − while (!hlist_empty(&ioc->icq_list)) { | |
| 198 | − struct io_cq *icq = hlist_entry(ioc->icq_list.first, | |
| 199 | − struct io_cq, ioc_node); | |
| 200 | − struct request_queue *this_q = icq->q; | |
| 201 | − | |
| 202 | − if (this_q != last_q) { | |
| 203 | − if (last_q && last_q != locked_q) | |
| 204 | − spin_unlock(last_q->queue_lock); | |
| 205 | − last_q = NULL; | |
| 206 | − | |
| 207 | − if (!spin_trylock(this_q->queue_lock)) | |
| 208 | − break; | |
| 209 | − last_q = this_q; | |
| 210 | − continue; | |
| 211 | − } | |
| 212 | − ioc_exit_icq(icq); | |
| 158 | + if (atomic_long_dec_and_test(&ioc->refcount)) { | |
| 159 | + spin_lock_irqsave(&ioc->lock, flags); | |
| 160 | + if (!hlist_empty(&ioc->icq_list)) | |
| 161 | + schedule_work(&ioc->release_work); | |
| 162 | + spin_unlock_irqrestore(&ioc->lock, flags); | |
| 213 | 163 | } |
| 214 | − | |
| 215 | − if (last_q && last_q != locked_q) | |
| 216 | − spin_unlock(last_q->queue_lock); | |
| 217 | − | |
| 218 | − spin_unlock_irqrestore(&ioc->lock, flags); | |
| 219 | − | |
| 220 | − /* if no icq is left, we're done; otherwise, kick release_work */ | |
| 221 | − if (hlist_empty(&ioc->icq_list)) | |
| 222 | − kmem_cache_free(iocontext_cachep, ioc); | |
| 223 | − else | |
| 224 | − schedule_work(&ioc->release_work); | |
| 225 | 164 | } |
| 226 | 165 | EXPORT_SYMBOL(put_io_context); |
| 227 | 166 | |
| @@ -236,7 +175,7 @@ void exit_io_context(struct task_struct *task) · 8 unmodified lines | ||
| 236 | 175 | task_unlock(task); |
| 237 | 176 | |
| 238 | 177 | atomic_dec(&ioc->nr_tasks); |
| 239 | − put_io_context(ioc, NULL); | |
| 178 | + put_io_context(ioc); | |
| 240 | 179 | } |
| 241 | 180 | |
| 242 | 181 | /** |
| @@ -471,3 +471,40 @@ int blk_attempt_req_merge(struct request_queue *q, struct request *rq, · 470 unmodified lines | ||
| 471 | 471 | { |
| 472 | 472 | return attempt_merge(q, rq, next); |
| 473 | 473 | } |
| 474 | + | |
| 475 | +bool blk_rq_merge_ok(struct request *rq, struct bio *bio) | |
| 476 | +{ | |
| 477 | + if (!rq_mergeable(rq)) | |
| 478 | + return false; | |
| 479 | + | |
| 480 | + /* don't merge file system requests and discard requests */ | |
| 481 | + if ((bio->bi_rw & REQ_DISCARD) != (rq->bio->bi_rw & REQ_DISCARD)) | |
| 482 | + return false; | |
| 483 | + | |
| 484 | + /* don't merge discard requests and secure discard requests */ | |
| 485 | + if ((bio->bi_rw & REQ_SECURE) != (rq->bio->bi_rw & REQ_SECURE)) | |
| 486 | + return false; | |
| 487 | + | |
| 488 | + /* different data direction or already started, don't merge */ | |
| 489 | + if (bio_data_dir(bio) != rq_data_dir(rq)) | |
| 490 | + return false; | |
| 491 | + | |
| 492 | + /* must be same device and not a special request */ | |
| 493 | + if (rq->rq_disk != bio->bi_bdev->bd_disk || rq->special) | |
| 494 | + return false; | |
| 495 | + | |
| 496 | + /* only merge integrity protected bio into ditto rq */ | |
| 497 | + if (bio_integrity(bio) != blk_integrity_rq(rq)) | |
| 498 | + return false; | |
| 499 | + | |
| 500 | + return true; | |
| 501 | +} | |
| 502 | + | |
| 503 | +int blk_try_merge(struct request *rq, struct bio *bio) | |
| 504 | +{ | |
| 505 | + if (blk_rq_pos(rq) + blk_rq_sectors(rq) == bio->bi_sector) | |
| 506 | + return ELEVATOR_BACK_MERGE; | |
| 507 | + else if (blk_rq_pos(rq) - bio_sectors(bio) == bio->bi_sector) | |
| 508 | + return ELEVATOR_FRONT_MERGE; | |
| 509 | + return ELEVATOR_NO_MERGE; | |
| 510 | +} | |
| @@ -137,6 +137,8 @@ int blk_attempt_req_merge(struct request_queue *q, struct request *rq, · 136 unmodified lines | ||
| 137 | 137 | struct request *next); |
| 138 | 138 | void blk_recalc_rq_segments(struct request *rq); |
| 139 | 139 | void blk_rq_set_mixed_merge(struct request *rq); |
| 140 | +bool blk_rq_merge_ok(struct request *rq, struct bio *bio); | |
| 141 | +int blk_try_merge(struct request *rq, struct bio *bio); | |
| 140 | 142 | |
| 141 | 143 | void blk_queue_congestion_threshold(struct request_queue *q); |
| 142 | 144 | |
| @@ -983,7 +983,8 @@ void bsg_unregister_queue(struct request_queue *q) · 982 unmodified lines | ||
| 983 | 983 | |
| 984 | 984 | mutex_lock(&bsg_mutex); |
| 985 | 985 | idr_remove(&bsg_minor_idr, bcd->minor); |
| 986 | − sysfs_remove_link(&q->kobj, "bsg"); | |
| 986 | + if (q->kobj.sd) | |
| 987 | + sysfs_remove_link(&q->kobj, "bsg"); | |
| 987 | 988 | device_unregister(bcd->class_dev); |
| 988 | 989 | bcd->class_dev = NULL; |
| 989 | 990 | kref_put(&bcd->ref, bsg_kref_release_function); |
| @@ -1699,18 +1699,11 @@ static int cfq_allow_merge(struct request_queue *q, struct request *rq, · 1698 unmodified lines | ||
| 1699 | 1699 | |
| 1700 | 1700 | /* |
| 1701 | 1701 | * Lookup the cfqq that this bio will be queued with and allow |
| 1702 | − * merge only if rq is queued there. This function can be called | |
| 1703 | − * from plug merge without queue_lock. In such cases, ioc of @rq | |
| 1704 | − * and %current are guaranteed to be equal. Avoid lookup which | |
| 1705 | − * requires queue_lock by using @rq's cic. | |
| 1702 | + * merge only if rq is queued there. | |
| 1706 | 1703 | */ |
| 1707 | − if (current->io_context == RQ_CIC(rq)->icq.ioc) { | |
| 1708 | − cic = RQ_CIC(rq); | |
| 1709 | − } else { | |
| 1710 | − cic = cfq_cic_lookup(cfqd, current->io_context); | |
| 1711 | − if (!cic) | |
| 1712 | − return false; | |
| 1713 | − } | |
| 1704 | + cic = cfq_cic_lookup(cfqd, current->io_context); | |
| 1705 | + if (!cic) | |
| 1706 | + return false; | |
| 1714 | 1707 | |
| 1715 | 1708 | cfqq = cic_to_cfqq(cic, cfq_bio_sync(bio)); |
| 1716 | 1709 | return cfqq == RQ_CFQQ(rq); |
| @@ -1794,7 +1787,7 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq, · 77 unmodified lines | ||
| 1794 | 1787 | cfqd->active_queue = NULL; |
| 1795 | 1788 | |
| 1796 | 1789 | if (cfqd->active_cic) { |
| 1797 | − put_io_context(cfqd->active_cic->icq.ioc, cfqd->queue); | |
| 1790 | + put_io_context(cfqd->active_cic->icq.ioc); | |
| 1798 | 1791 | cfqd->active_cic = NULL; |
| 1799 | 1792 | } |
| 1800 | 1793 | } |
| @@ -3117,17 +3110,18 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, · 1316 unmodified lines | ||
| 3117 | 3110 | */ |
| 3118 | 3111 | static void cfq_preempt_queue(struct cfq_data *cfqd, struct cfq_queue *cfqq) |
| 3119 | 3112 | { |
| 3113 | + enum wl_type_t old_type = cfqq_type(cfqd->active_queue); | |
| 3114 | + | |
| 3120 | 3115 | cfq_log_cfqq(cfqd, cfqq, "preempt"); |
| 3116 | + cfq_slice_expired(cfqd, 1); | |
| 3121 | 3117 | |
| 3122 | 3118 | /* |
| 3123 | 3119 | * workload type is changed, don't save slice, otherwise preempt |
| 3124 | 3120 | * doesn't happen |
| 3125 | 3121 | */ |
| 3126 | − if (cfqq_type(cfqd->active_queue) != cfqq_type(cfqq)) | |
| 3122 | + if (old_type != cfqq_type(cfqq)) | |
| 3127 | 3123 | cfqq->cfqg->saved_workload_slice = 0; |
| 3128 | 3124 | |
| 3129 | − cfq_slice_expired(cfqd, 1); | |
| 3130 | − | |
| 3131 | 3125 | /* |
| 3132 | 3126 | * Put the new queue at the front of the of the current list, |
| 3133 | 3127 | * so we know that it will be selected next. |
| @@ -70,39 +70,9 @@ static int elv_iosched_allow_merge(struct request *rq, struct bio *bio) · 69 unmodified lines | ||
| 70 | 70 | /* |
| 71 | 71 | * can we safely merge with this request? |
| 72 | 72 | */ |
| 73 | −int elv_rq_merge_ok(struct request *rq, struct bio *bio) | |
| 73 | +bool elv_rq_merge_ok(struct request *rq, struct bio *bio) | |
| 74 | 74 | { |
| 75 | − if (!rq_mergeable(rq)) | |
| 76 | − return 0; | |
| 77 | − | |
| 78 | − /* | |
| 79 | − * Don't merge file system requests and discard requests | |
| 80 | − */ | |
| 81 | − if ((bio->bi_rw & REQ_DISCARD) != (rq->bio->bi_rw & REQ_DISCARD)) | |
| 82 | − return 0; | |
| 83 | − | |
| 84 | − /* | |
| 85 | − * Don't merge discard requests and secure discard requests | |
| 86 | − */ | |
| 87 | − if ((bio->bi_rw & REQ_SECURE) != (rq->bio->bi_rw & REQ_SECURE)) | |
| 88 | − return 0; | |
| 89 | − | |
| 90 | − /* | |
| 91 | − * different data direction or already started, don't merge | |
| 92 | − */ | |
| 93 | − if (bio_data_dir(bio) != rq_data_dir(rq)) | |
| 94 | − return 0; | |
| 95 | − | |
| 96 | − /* | |
| 97 | − * must be same device and not a special request | |
| 98 | − */ | |
| 99 | − if (rq->rq_disk != bio->bi_bdev->bd_disk || rq->special) | |
| 100 | − return 0; | |
| 101 | − | |
| 102 | − /* | |
| 103 | − * only merge integrity protected bio into ditto rq | |
| 104 | − */ | |
| 105 | − if (bio_integrity(bio) != blk_integrity_rq(rq)) | |
| 75 | + if (!blk_rq_merge_ok(rq, bio)) | |
| 106 | 76 | return 0; |
| 107 | 77 | |
| 108 | 78 | if (!elv_iosched_allow_merge(rq, bio)) |
| @@ -112,23 +82,6 @@ int elv_rq_merge_ok(struct request *rq, struct bio *bio) · 3 unmodified lines | ||
| 112 | 82 | } |
| 113 | 83 | EXPORT_SYMBOL(elv_rq_merge_ok); |
| 114 | 84 | |
| 115 | −int elv_try_merge(struct request *__rq, struct bio *bio) | |
| 116 | −{ | |
| 117 | − int ret = ELEVATOR_NO_MERGE; | |
| 118 | − | |
| 119 | − /* | |
| 120 | − * we can merge and sequence is ok, check if it's possible | |
| 121 | − */ | |
| 122 | − if (elv_rq_merge_ok(__rq, bio)) { | |
| 123 | − if (blk_rq_pos(__rq) + blk_rq_sectors(__rq) == bio->bi_sector) | |
| 124 | − ret = ELEVATOR_BACK_MERGE; | |
| 125 | − else if (blk_rq_pos(__rq) - bio_sectors(bio) == bio->bi_sector) | |
| 126 | − ret = ELEVATOR_FRONT_MERGE; | |
| 127 | − } | |
| 128 | − | |
| 129 | − return ret; | |
| 130 | −} | |
| 131 | − | |
| 132 | 85 | static struct elevator_type *elevator_find(const char *name) |
| 133 | 86 | { |
| 134 | 87 | struct elevator_type *e; |
| @@ -478,8 +431,8 @@ int elv_merge(struct request_queue *q, struct request **req, struct bio *bio) · 343 unmodified lines | ||
| 478 | 431 | /* |
| 479 | 432 | * First try one-hit cache. |
| 480 | 433 | */ |
| 481 | − if (q->last_merge) { | |
| 482 | − ret = elv_try_merge(q->last_merge, bio); | |
| 434 | + if (q->last_merge && elv_rq_merge_ok(q->last_merge, bio)) { | |
| 435 | + ret = blk_try_merge(q->last_merge, bio); | |
| 483 | 436 | if (ret != ELEVATOR_NO_MERGE) { |
| 484 | 437 | *req = q->last_merge; |
| 485 | 438 | return ret; |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | * ldm - Support for Windows Logical Disk Manager (Dynamic Disks) |
| 3 | 3 | * |
| 4 | 4 | * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org> |
| 5 | − * Copyright (c) 2001-2007 Anton Altaparmakov | |
| 5 | + * Copyright (c) 2001-2012 Anton Altaparmakov | |
| 6 | 6 | * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com> |
| 7 | 7 | * |
| 8 | 8 | * Documentation is available at http://www.linux-ntfs.org/doku.php?id=downloads |
| @@ -1341,20 +1341,17 @@ found: · 1332 unmodified lines | ||
| 1341 | 1341 | ldm_error("REC value (%d) exceeds NUM value (%d)", rec, f->num); |
| 1342 | 1342 | return false; |
| 1343 | 1343 | } |
| 1344 | − | |
| 1345 | 1344 | if (f->map & (1 << rec)) { |
| 1346 | 1345 | ldm_error ("Duplicate VBLK, part %d.", rec); |
| 1347 | 1346 | f->map &= 0x7F; /* Mark the group as broken */ |
| 1348 | 1347 | return false; |
| 1349 | 1348 | } |
| 1350 | − | |
| 1351 | 1349 | f->map |= (1 << rec); |
| 1352 | − | |
| 1350 | + if (!rec) | |
| 1351 | + memcpy(f->data, data, VBLK_SIZE_HEAD); | |
| 1353 | 1352 | data += VBLK_SIZE_HEAD; |
| 1354 | 1353 | size -= VBLK_SIZE_HEAD; |
| 1355 | − | |
| 1356 | − memcpy (f->data+rec*(size-VBLK_SIZE_HEAD)+VBLK_SIZE_HEAD, data, size); | |
| 1357 | − | |
| 1354 | + memcpy(f->data + VBLK_SIZE_HEAD + rec * size, data, size); | |
| 1358 | 1355 | return true; |
| 1359 | 1356 | } |
| 1360 | 1357 | |
| @@ -31,11 +31,6 @@ static inline u64 Maj(u64 x, u64 y, u64 z) · 30 unmodified lines | ||
| 31 | 31 | return (x & y) | (z & (x | y)); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | −static inline u64 RORu64(u64 x, u64 y) | |
| 35 | −{ | |
| 36 | − return (x >> y) | (x << (64 - y)); | |
| 37 | −} | |
| 38 | − | |
| 39 | 34 | static const u64 sha512_K[80] = { |
| 40 | 35 | 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL, |
| 41 | 36 | 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, |
| @@ -66,10 +61,10 @@ static const u64 sha512_K[80] = { · 24 unmodified lines | ||
| 66 | 61 | 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL, |
| 67 | 62 | }; |
| 68 | 63 | |
| 69 | −#define e0(x) (RORu64(x,28) ^ RORu64(x,34) ^ RORu64(x,39)) | |
| 70 | −#define e1(x) (RORu64(x,14) ^ RORu64(x,18) ^ RORu64(x,41)) | |
| 71 | −#define s0(x) (RORu64(x, 1) ^ RORu64(x, 8) ^ (x >> 7)) | |
| 72 | −#define s1(x) (RORu64(x,19) ^ RORu64(x,61) ^ (x >> 6)) | |
| 64 | +#define e0(x) (ror64(x,28) ^ ror64(x,34) ^ ror64(x,39)) | |
| 65 | +#define e1(x) (ror64(x,14) ^ ror64(x,18) ^ ror64(x,41)) | |
| 66 | +#define s0(x) (ror64(x, 1) ^ ror64(x, 8) ^ (x >> 7)) | |
| 67 | +#define s1(x) (ror64(x,19) ^ ror64(x,61) ^ (x >> 6)) | |
| 73 | 68 | |
| 74 | 69 | static inline void LOAD_OP(int I, u64 *W, const u8 *input) |
| 75 | 70 | { |
| @@ -78,7 +73,7 @@ static inline void LOAD_OP(int I, u64 *W, const u8 *input) · 2 unmodified lines | ||
| 78 | 73 | |
| 79 | 74 | static inline void BLEND_OP(int I, u64 *W) |
| 80 | 75 | { |
| 81 | − W[I % 16] += s1(W[(I-2) % 16]) + W[(I-7) % 16] + s0(W[(I-15) % 16]); | |
| 76 | + W[I & 15] += s1(W[(I-2) & 15]) + W[(I-7) & 15] + s0(W[(I-15) & 15]); | |
| 82 | 77 | } |
| 83 | 78 | |
| 84 | 79 | static void |
| @@ -89,46 +84,42 @@ sha512_transform(u64 *state, const u8 *input) · 4 unmodified lines | ||
| 89 | 84 | int i; |
| 90 | 85 | u64 W[16]; |
| 91 | 86 | |
| 92 | − /* load the input */ | |
| 93 | − for (i = 0; i < 16; i++) | |
| 94 | − LOAD_OP(i, W, input); | |
| 95 | − | |
| 96 | 87 | /* load the state into our registers */ |
| 97 | 88 | a=state[0]; b=state[1]; c=state[2]; d=state[3]; |
| 98 | 89 | e=state[4]; f=state[5]; g=state[6]; h=state[7]; |
| 99 | 90 | |
| 100 | −#define SHA512_0_15(i, a, b, c, d, e, f, g, h) \ | |
| 101 | − t1 = h + e1(e) + Ch(e, f, g) + sha512_K[i] + W[i]; \ | |
| 102 | − t2 = e0(a) + Maj(a, b, c); \ | |
| 103 | − d += t1; \ | |
| 104 | − h = t1 + t2 | |
| 105 | − | |
| 106 | −#define SHA512_16_79(i, a, b, c, d, e, f, g, h) \ | |
| 107 | − BLEND_OP(i, W); \ | |
| 108 | − t1 = h + e1(e) + Ch(e, f, g) + sha512_K[i] + W[(i)%16]; \ | |
| 109 | − t2 = e0(a) + Maj(a, b, c); \ | |
| 110 | − d += t1; \ | |
| 111 | − h = t1 + t2 | |
| 112 | − | |
| 113 | − for (i = 0; i < 16; i += 8) { | |
| 114 | − SHA512_0_15(i, a, b, c, d, e, f, g, h); | |
| 115 | − SHA512_0_15(i + 1, h, a, b, c, d, e, f, g); | |
| 116 | − SHA512_0_15(i + 2, g, h, a, b, c, d, e, f); | |
| 117 | − SHA512_0_15(i + 3, f, g, h, a, b, c, d, e); | |
| 118 | − SHA512_0_15(i + 4, e, f, g, h, a, b, c, d); | |
| 119 | − SHA512_0_15(i + 5, d, e, f, g, h, a, b, c); | |
| 120 | − SHA512_0_15(i + 6, c, d, e, f, g, h, a, b); | |
| 121 | − SHA512_0_15(i + 7, b, c, d, e, f, g, h, a); | |
| 122 | − } | |
| 123 | − for (i = 16; i < 80; i += 8) { | |
| 124 | − SHA512_16_79(i, a, b, c, d, e, f, g, h); | |
| 125 | − SHA512_16_79(i + 1, h, a, b, c, d, e, f, g); | |
| 126 | − SHA512_16_79(i + 2, g, h, a, b, c, d, e, f); | |
| 127 | − SHA512_16_79(i + 3, f, g, h, a, b, c, d, e); | |
| 128 | − SHA512_16_79(i + 4, e, f, g, h, a, b, c, d); | |
| 129 | − SHA512_16_79(i + 5, d, e, f, g, h, a, b, c); | |
| 130 | − SHA512_16_79(i + 6, c, d, e, f, g, h, a, b); | |
| 131 | − SHA512_16_79(i + 7, b, c, d, e, f, g, h, a); | |
| 91 | + /* now iterate */ | |
| 92 | + for (i=0; i<80; i+=8) { | |
| 93 | + if (!(i & 8)) { | |
| 94 | + int j; | |
| 95 | + | |
| 96 | + if (i < 16) { | |
| 97 | + /* load the input */ | |
| 98 | + for (j = 0; j < 16; j++) | |
| 99 | + LOAD_OP(i + j, W, input); | |
| 100 | + } else { | |
| 101 | + for (j = 0; j < 16; j++) { | |
| 102 | + BLEND_OP(i + j, W); | |
| 103 | + } | |
| 104 | + } | |
| 105 | + } | |
| 106 | + | |
| 107 | + t1 = h + e1(e) + Ch(e,f,g) + sha512_K[i ] + W[(i & 15)]; | |
| 108 | + t2 = e0(a) + Maj(a,b,c); d+=t1; h=t1+t2; | |
| 109 | + t1 = g + e1(d) + Ch(d,e,f) + sha512_K[i+1] + W[(i & 15) + 1]; | |
| 110 | + t2 = e0(h) + Maj(h,a,b); c+=t1; g=t1+t2; | |
| 111 | + t1 = f + e1(c) + Ch(c,d,e) + sha512_K[i+2] + W[(i & 15) + 2]; | |
| 112 | + t2 = e0(g) + Maj(g,h,a); b+=t1; f=t1+t2; | |
| 113 | + t1 = e + e1(b) + Ch(b,c,d) + sha512_K[i+3] + W[(i & 15) + 3]; | |
| 114 | + t2 = e0(f) + Maj(f,g,h); a+=t1; e=t1+t2; | |
| 115 | + t1 = d + e1(a) + Ch(a,b,c) + sha512_K[i+4] + W[(i & 15) + 4]; | |
| 116 | + t2 = e0(e) + Maj(e,f,g); h+=t1; d=t1+t2; | |
| 117 | + t1 = c + e1(h) + Ch(h,a,b) + sha512_K[i+5] + W[(i & 15) + 5]; | |
| 118 | + t2 = e0(d) + Maj(d,e,f); g+=t1; c=t1+t2; | |
| 119 | + t1 = b + e1(g) + Ch(g,h,a) + sha512_K[i+6] + W[(i & 15) + 6]; | |
| 120 | + t2 = e0(c) + Maj(c,d,e); f+=t1; b=t1+t2; | |
| 121 | + t1 = a + e1(f) + Ch(f,g,h) + sha512_K[i+7] + W[(i & 15) + 7]; | |
| 122 | + t2 = e0(b) + Maj(b,c,d); e+=t1; a=t1+t2; | |
| 132 | 123 | } |
| 133 | 124 | |
| 134 | 125 | state[0] += a; state[1] += b; state[2] += c; state[3] += d; |
| @@ -579,13 +579,6 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device) · 578 unmodified lines | ||
| 579 | 579 | goto err_free_cpumask; |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | − /* | |
| 583 | − * Do not start hotplugged CPUs now, but when they | |
| 584 | − * are onlined the first time | |
| 585 | − */ | |
| 586 | − if (pr->flags.need_hotplug_init) | |
| 587 | − return 0; | |
| 588 | − | |
| 589 | 582 | /* |
| 590 | 583 | * Do not start hotplugged CPUs now, but when they |
| 591 | 584 | * are onlined the first time |
| @@ -207,11 +207,11 @@ static void set_smc_timing(struct device *dev, struct ata_device *adev, · 206 unmodified lines | ||
| 207 | 207 | { |
| 208 | 208 | int ret = 0; |
| 209 | 209 | int use_iordy; |
| 210 | + struct sam9_smc_config smc; | |
| 210 | 211 | unsigned int t6z; /* data tristate time in ns */ |
| 211 | 212 | unsigned int cycle; /* SMC Cycle width in MCK ticks */ |
| 212 | 213 | unsigned int setup; /* SMC Setup width in MCK ticks */ |
| 213 | 214 | unsigned int pulse; /* CFIOR and CFIOW pulse width in MCK ticks */ |
| 214 | − unsigned int cs_setup = 0;/* CS4 or CS5 setup width in MCK ticks */ | |
| 215 | 215 | unsigned int cs_pulse; /* CS4 or CS5 pulse width in MCK ticks*/ |
| 216 | 216 | unsigned int tdf_cycles; /* SMC TDF MCK ticks */ |
| 217 | 217 | unsigned long mck_hz; /* MCK frequency in Hz */ |
| @@ -244,26 +244,20 @@ static void set_smc_timing(struct device *dev, struct ata_device *adev, · 26 unmodified lines | ||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | dev_dbg(dev, "Use IORDY=%u, TDF Cycles=%u\n", use_iordy, tdf_cycles); |
| 247 | − info->mode |= AT91_SMC_TDF_(tdf_cycles); | |
| 248 | − | |
| 249 | − /* write SMC Setup Register */ | |
| 250 | − at91_sys_write(AT91_SMC_SETUP(info->cs), | |
| 251 | − AT91_SMC_NWESETUP_(setup) | | |
| 252 | − AT91_SMC_NRDSETUP_(setup) | | |
| 253 | − AT91_SMC_NCS_WRSETUP_(cs_setup) | | |
| 254 | − AT91_SMC_NCS_RDSETUP_(cs_setup)); | |
| 255 | − /* write SMC Pulse Register */ | |
| 256 | − at91_sys_write(AT91_SMC_PULSE(info->cs), | |
| 257 | − AT91_SMC_NWEPULSE_(pulse) | | |
| 258 | − AT91_SMC_NRDPULSE_(pulse) | | |
| 259 | − AT91_SMC_NCS_WRPULSE_(cs_pulse) | | |
| 260 | − AT91_SMC_NCS_RDPULSE_(cs_pulse)); | |
| 261 | − /* write SMC Cycle Register */ | |
| 262 | − at91_sys_write(AT91_SMC_CYCLE(info->cs), | |
| 263 | − AT91_SMC_NWECYCLE_(cycle) | | |
| 264 | − AT91_SMC_NRDCYCLE_(cycle)); | |
| 265 | − /* write SMC Mode Register*/ | |
| 266 | − at91_sys_write(AT91_SMC_MODE(info->cs), info->mode); | |
| 247 | + | |
| 248 | + /* SMC Setup Register */ | |
| 249 | + smc.nwe_setup = smc.nrd_setup = setup; | |
| 250 | + smc.ncs_write_setup = smc.ncs_read_setup = 0; | |
| 251 | + /* SMC Pulse Register */ | |
| 252 | + smc.nwe_pulse = smc.nrd_pulse = pulse; | |
| 253 | + smc.ncs_write_pulse = smc.ncs_read_pulse = cs_pulse; | |
| 254 | + /* SMC Cycle Register */ | |
| 255 | + smc.write_cycle = smc.read_cycle = cycle; | |
| 256 | + /* SMC Mode Register*/ | |
| 257 | + smc.tdf_cycles = tdf_cycles; | |
| 258 | + smc.mode = info->mode; | |
| 259 | + | |
| 260 | + sam9_smc_configure(0, info->cs, &smc); | |
| 267 | 261 | } |
| 268 | 262 | |
| 269 | 263 | static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev) |
| @@ -288,20 +282,20 @@ static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev, · 18 unmodified lines | ||
| 288 | 282 | struct at91_ide_info *info = dev->link->ap->host->private_data; |
| 289 | 283 | unsigned int consumed; |
| 290 | 284 | unsigned long flags; |
| 291 | − unsigned int mode; | |
| 285 | + struct sam9_smc_config smc; | |
| 292 | 286 | |
| 293 | 287 | local_irq_save(flags); |
| 294 | − mode = at91_sys_read(AT91_SMC_MODE(info->cs)); | |
| 288 | + sam9_smc_read_mode(0, info->cs, &smc); | |
| 295 | 289 | |
| 296 | 290 | /* set 16bit mode before writing data */ |
| 297 | − at91_sys_write(AT91_SMC_MODE(info->cs), | |
| 298 | − (mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_16); | |
| 291 | + smc.mode = (smc.mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_16; | |
| 292 | + sam9_smc_write_mode(0, info->cs, &smc); | |
| 299 | 293 | |
| 300 | 294 | consumed = ata_sff_data_xfer(dev, buf, buflen, rw); |
| 301 | 295 | |
| 302 | 296 | /* restore 8bit mode after data is written */ |
| 303 | − at91_sys_write(AT91_SMC_MODE(info->cs), | |
| 304 | − (mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_8); | |
| 297 | + smc.mode = (smc.mode & ~AT91_SMC_DBW) | AT91_SMC_DBW_8; | |
| 298 | + sam9_smc_write_mode(0, info->cs, &smc); | |
| 305 | 299 | |
| 306 | 300 | local_irq_restore(flags); |
| 307 | 301 | return consumed; |
| @@ -1206,9 +1206,9 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) · 1205 unmodified lines | ||
| 1206 | 1206 | |
| 1207 | 1207 | out_unmap_both: |
| 1208 | 1208 | pci_set_drvdata(dev, NULL); |
| 1209 | − pci_iounmap(dev, card->config_regs); | |
| 1210 | − out_unmap_config: | |
| 1211 | 1209 | pci_iounmap(dev, card->buffers); |
| 1210 | + out_unmap_config: | |
| 1211 | + pci_iounmap(dev, card->config_regs); | |
| 1212 | 1212 | out_release_regions: |
| 1213 | 1213 | pci_release_regions(dev); |
| 1214 | 1214 | out: |
| @@ -208,6 +208,25 @@ static ssize_t print_cpus_offline(struct device *dev, · 207 unmodified lines | ||
| 208 | 208 | } |
| 209 | 209 | static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL); |
| 210 | 210 | |
| 211 | +static void cpu_device_release(struct device *dev) | |
| 212 | +{ | |
| 213 | + /* | |
| 214 | + * This is an empty function to prevent the driver core from spitting a | |
| 215 | + * warning at us. Yes, I know this is directly opposite of what the | |
| 216 | + * documentation for the driver core and kobjects say, and the author | |
| 217 | + * of this code has already been publically ridiculed for doing | |
| 218 | + * something as foolish as this. However, at this point in time, it is | |
| 219 | + * the only way to handle the issue of statically allocated cpu | |
| 220 | + * devices. The different architectures will have their cpu device | |
| 221 | + * code reworked to properly handle this in the near future, so this | |
| 222 | + * function will then be changed to correctly free up the memory held | |
| 223 | + * by the cpu device. | |
| 224 | + * | |
| 225 | + * Never copy this way of doing things, or you too will be made fun of | |
| 226 | + * on the linux-kerenl list, you have been warned. | |
| 227 | + */ | |
| 228 | +} | |
| 229 | + | |
| 211 | 230 | /* |
| 212 | 231 | * register_cpu - Setup a sysfs device for a CPU. |
| 213 | 232 | * @cpu - cpu->hotpluggable field set to 1 will generate a control file in |
| @@ -221,8 +240,10 @@ int __cpuinit register_cpu(struct cpu *cpu, int num) · 7 unmodified lines | ||
| 221 | 240 | int error; |
| 222 | 241 | |
| 223 | 242 | cpu->node_id = cpu_to_node(num); |
| 243 | + memset(&cpu->dev, 0x00, sizeof(struct device)); | |
| 224 | 244 | cpu->dev.id = num; |
| 225 | 245 | cpu->dev.bus = &cpu_subsys; |
| 246 | + cpu->dev.release = cpu_device_release; | |
| 226 | 247 | error = device_register(&cpu->dev); |
| 227 | 248 | if (!error && cpu->hotpluggable) |
| 228 | 249 | register_cpu_control(cpu); |
| @@ -572,19 +572,36 @@ static int init_memory_block(struct memory_block **memory, · 571 unmodified lines | ||
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | static int add_memory_section(int nid, struct mem_section *section, |
| 575 | + struct memory_block **mem_p, | |
| 575 | 576 | unsigned long state, enum mem_add_context context) |
| 576 | 577 | { |
| 577 | − struct memory_block *mem; | |
| 578 | + struct memory_block *mem = NULL; | |
| 579 | + int scn_nr = __section_nr(section); | |
| 578 | 580 | int ret = 0; |
| 579 | 581 | |
| 580 | 582 | mutex_lock(&mem_sysfs_mutex); |
| 581 | 583 | |
| 582 | − mem = find_memory_block(section); | |
| 584 | + if (context == BOOT) { | |
| 585 | + /* same memory block ? */ | |
| 586 | + if (mem_p && *mem_p) | |
| 587 | + if (scn_nr >= (*mem_p)->start_section_nr && | |
| 588 | + scn_nr <= (*mem_p)->end_section_nr) { | |
| 589 | + mem = *mem_p; | |
| 590 | + kobject_get(&mem->dev.kobj); | |
| 591 | + } | |
| 592 | + } else | |
| 593 | + mem = find_memory_block(section); | |
| 594 | + | |
| 583 | 595 | if (mem) { |
| 584 | 596 | mem->section_count++; |
| 585 | 597 | kobject_put(&mem->dev.kobj); |
| 586 | − } else | |
| 598 | + } else { | |
| 587 | 599 | ret = init_memory_block(&mem, section, state); |
| 600 | + /* store memory_block pointer for next loop */ | |
| 601 | + if (!ret && context == BOOT) | |
| 602 | + if (mem_p) | |
| 603 | + *mem_p = mem; | |
| 604 | + } | |
| 588 | 605 | |
| 589 | 606 | if (!ret) { |
| 590 | 607 | if (context == HOTPLUG && |
| @@ -627,7 +644,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section, · 36 unmodified lines | ||
| 627 | 644 | */ |
| 628 | 645 | int register_new_memory(int nid, struct mem_section *section) |
| 629 | 646 | { |
| 630 | − return add_memory_section(nid, section, MEM_OFFLINE, HOTPLUG); | |
| 647 | + return add_memory_section(nid, section, NULL, MEM_OFFLINE, HOTPLUG); | |
| 631 | 648 | } |
| 632 | 649 | |
| 633 | 650 | int unregister_memory_section(struct mem_section *section) |
| @@ -647,6 +664,7 @@ int __init memory_dev_init(void) · 13 unmodified lines | ||
| 647 | 664 | int ret; |
| 648 | 665 | int err; |
| 649 | 666 | unsigned long block_sz; |
| 667 | + struct memory_block *mem = NULL; | |
| 650 | 668 | |
| 651 | 669 | ret = subsys_system_register(&memory_subsys, NULL); |
| 652 | 670 | if (ret) |
| @@ -662,7 +680,10 @@ int __init memory_dev_init(void) · 9 unmodified lines | ||
| 662 | 680 | for (i = 0; i < NR_MEM_SECTIONS; i++) { |
| 663 | 681 | if (!present_section_nr(i)) |
| 664 | 682 | continue; |
| 665 | − err = add_memory_section(0, __nr_to_section(i), MEM_ONLINE, | |
| 683 | + /* don't need to reuse memory_block if only one per block */ | |
| 684 | + err = add_memory_section(0, __nr_to_section(i), | |
| 685 | + (sections_per_block == 1) ? NULL : &mem, | |
| 686 | + MEM_ONLINE, | |
| 666 | 687 | BOOT); |
| 667 | 688 | if (!ret) |
| 668 | 689 | ret = err; |
| @@ -456,7 +456,15 @@ static int link_mem_sections(int nid) · 455 unmodified lines | ||
| 456 | 456 | if (!present_section_nr(section_nr)) |
| 457 | 457 | continue; |
| 458 | 458 | mem_sect = __nr_to_section(section_nr); |
| 459 | + | |
| 460 | + /* same memblock ? */ | |
| 461 | + if (mem_blk) | |
| 462 | + if ((section_nr >= mem_blk->start_section_nr) && | |
| 463 | + (section_nr <= mem_blk->end_section_nr)) | |
| 464 | + continue; | |
| 465 | + | |
| 459 | 466 | mem_blk = find_memory_block_hinted(mem_sect, mem_blk); |
| 467 | + | |
| 460 | 468 | ret = register_mem_sect_under_node(mem_blk, nid); |
| 461 | 469 | if (!err) |
| 462 | 470 | err = ret; |
| @@ -53,7 +53,7 @@ static int regcache_hw_init(struct regmap *map) · 52 unmodified lines | ||
| 53 | 53 | for (count = 0, i = 0; i < map->num_reg_defaults_raw; i++) { |
| 54 | 54 | val = regcache_get_val(map->reg_defaults_raw, |
| 55 | 55 | i, map->cache_word_size); |
| 56 | − if (!val) | |
| 56 | + if (regmap_volatile(map, i)) | |
| 57 | 57 | continue; |
| 58 | 58 | count++; |
| 59 | 59 | } |
| @@ -70,7 +70,7 @@ static int regcache_hw_init(struct regmap *map) · 10 unmodified lines | ||
| 70 | 70 | for (i = 0, j = 0; i < map->num_reg_defaults_raw; i++) { |
| 71 | 71 | val = regcache_get_val(map->reg_defaults_raw, |
| 72 | 72 | i, map->cache_word_size); |
| 73 | − if (!val) | |
| 73 | + if (regmap_volatile(map, i)) | |
| 74 | 74 | continue; |
| 75 | 75 | map->reg_defaults[j].reg = i; |
| 76 | 76 | map->reg_defaults[j].def = val; |
| @@ -169,10 +169,8 @@ int bcma_bus_register(struct bcma_bus *bus) · 168 unmodified lines | ||
| 169 | 169 | err = bcma_sprom_get(bus); |
| 170 | 170 | if (err == -ENOENT) { |
| 171 | 171 | pr_err("No SPROM available\n"); |
| 172 | − } else if (err) { | |
| 172 | + } else if (err) | |
| 173 | 173 | pr_err("Failed to get SPROM: %d\n", err); |
| 174 | − return -ENOENT; | |
| 175 | − } | |
| 176 | 174 | |
| 177 | 175 | /* Register found cores */ |
| 178 | 176 | bcma_register_cores(bus); |
| @@ -399,15 +399,18 @@ int bcma_bus_scan(struct bcma_bus *bus) · 398 unmodified lines | ||
| 399 | 399 | core->bus = bus; |
| 400 | 400 | |
| 401 | 401 | err = bcma_get_next_core(bus, &eromptr, NULL, core_num, core); |
| 402 | − if (err == -ENODEV) { | |
| 403 | − core_num++; | |
| 404 | − continue; | |
| 405 | − } else if (err == -ENXIO) | |
| 406 | − continue; | |
| 407 | − else if (err == -ESPIPE) | |
| 408 | − break; | |
| 409 | − else if (err < 0) | |
| 402 | + if (err < 0) { | |
| 403 | + kfree(core); | |
| 404 | + if (err == -ENODEV) { | |
| 405 | + core_num++; | |
| 406 | + continue; | |
| 407 | + } else if (err == -ENXIO) { | |
| 408 | + continue; | |
| 409 | + } else if (err == -ESPIPE) { | |
| 410 | + break; | |
| 411 | + } | |
| 410 | 412 | return err; |
| 413 | + } | |
| 411 | 414 | |
| 412 | 415 | core->core_index = core_num++; |
| 413 | 416 | bus->nr_cores++; |
| @@ -4368,8 +4368,14 @@ out_unreg_blkdev: · 4367 unmodified lines | ||
| 4368 | 4368 | out_put_disk: |
| 4369 | 4369 | while (dr--) { |
| 4370 | 4370 | del_timer_sync(&motor_off_timer[dr]); |
| 4371 | − if (disks[dr]->queue) | |
| 4371 | + if (disks[dr]->queue) { | |
| 4372 | 4372 | blk_cleanup_queue(disks[dr]->queue); |
| 4373 | + /* | |
| 4374 | + * put_disk() is not paired with add_disk() and | |
| 4375 | + * will put queue reference one extra time. fix it. | |
| 4376 | + */ | |
| 4377 | + disks[dr]->queue = NULL; | |
| 4378 | + } | |
| 4373 | 4379 | put_disk(disks[dr]); |
| 4374 | 4380 | } |
| 4375 | 4381 | return err; |
| @@ -4579,6 +4585,15 @@ static void __exit floppy_module_exit(void) · 203 unmodified lines | ||
| 4579 | 4585 | platform_device_unregister(&floppy_device[drive]); |
| 4580 | 4586 | } |
| 4581 | 4587 | blk_cleanup_queue(disks[drive]->queue); |
| 4588 | + | |
| 4589 | + /* | |
| 4590 | + * These disks have not called add_disk(). Don't put down | |
| 4591 | + * queue reference in put_disk(). | |
| 4592 | + */ | |
| 4593 | + if (!(allowed_drive_mask & (1 << drive)) || | |
| 4594 | + fdc_state[FDC(drive)].version == FDC_NONE) | |
| 4595 | + disks[drive]->queue = NULL; | |
| 4596 | + | |
| 4582 | 4597 | put_disk(disks[drive]); |
| 4583 | 4598 | } |
| 4584 | 4599 | |
| @@ -356,14 +356,14 @@ lo_direct_splice_actor(struct pipe_inode_info *pipe, struct splice_desc *sd) · 355 unmodified lines | ||
| 356 | 356 | return __splice_from_pipe(pipe, sd, lo_splice_actor); |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | −static int | |
| 359 | +static ssize_t | |
| 360 | 360 | do_lo_receive(struct loop_device *lo, |
| 361 | 361 | struct bio_vec *bvec, int bsize, loff_t pos) |
| 362 | 362 | { |
| 363 | 363 | struct lo_read_data cookie; |
| 364 | 364 | struct splice_desc sd; |
| 365 | 365 | struct file *file; |
| 366 | − long retval; | |
| 366 | + ssize_t retval; | |
| 367 | 367 | |
| 368 | 368 | cookie.lo = lo; |
| 369 | 369 | cookie.page = bvec->bv_page; |
| @@ -379,26 +379,28 @@ do_lo_receive(struct loop_device *lo, · 9 unmodified lines | ||
| 379 | 379 | file = lo->lo_backing_file; |
| 380 | 380 | retval = splice_direct_to_actor(file, &sd, lo_direct_splice_actor); |
| 381 | 381 | |
| 382 | − if (retval < 0) | |
| 383 | − return retval; | |
| 384 | − if (retval != bvec->bv_len) | |
| 385 | − return -EIO; | |
| 386 | − return 0; | |
| 382 | + return retval; | |
| 387 | 383 | } |
| 388 | 384 | |
| 389 | 385 | static int |
| 390 | 386 | lo_receive(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos) |
| 391 | 387 | { |
| 392 | 388 | struct bio_vec *bvec; |
| 393 | − int i, ret = 0; | |
| 389 | + ssize_t s; | |
| 390 | + int i; | |
| 394 | 391 | |
| 395 | 392 | bio_for_each_segment(bvec, bio, i) { |
| 396 | − ret = do_lo_receive(lo, bvec, bsize, pos); | |
| 397 | − if (ret < 0) | |
| 393 | + s = do_lo_receive(lo, bvec, bsize, pos); | |
| 394 | + if (s < 0) | |
| 395 | + return s; | |
| 396 | + | |
| 397 | + if (s != bvec->bv_len) { | |
| 398 | + zero_fill_bio(bio); | |
| 398 | 399 | break; |
| 400 | + } | |
| 399 | 401 | pos += bvec->bv_len; |
| 400 | 402 | } |
| 401 | − return ret; | |
| 403 | + return 0; | |
| 402 | 404 | } |
| 403 | 405 | |
| 404 | 406 | static int do_bio_filebacked(struct loop_device *lo, struct bio *bio) |
| @@ -2068,8 +2068,6 @@ static int mtip_hw_ioctl(struct driver_data *dd, unsigned int cmd, · 2067 unmodified lines | ||
| 2068 | 2068 | * when the read completes. |
| 2069 | 2069 | * @data Callback data passed to the callback function |
| 2070 | 2070 | * when the read completes. |
| 2071 | − * @barrier If non-zero, this command must be completed before | |
| 2072 | − * issuing any other commands. | |
| 2073 | 2071 | * @dir Direction (read or write) |
| 2074 | 2072 | * |
| 2075 | 2073 | * return value |
| @@ -2077,7 +2075,7 @@ static int mtip_hw_ioctl(struct driver_data *dd, unsigned int cmd, · 1 unmodified line | ||
| 2077 | 2075 | */ |
| 2078 | 2076 | static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, |
| 2079 | 2077 | int nsect, int nents, int tag, void *callback, |
| 2080 | − void *data, int barrier, int dir) | |
| 2078 | + void *data, int dir) | |
| 2081 | 2079 | { |
| 2082 | 2080 | struct host_to_dev_fis *fis; |
| 2083 | 2081 | struct mtip_port *port = dd->port; |
| @@ -2108,8 +2106,6 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, · 24 unmodified lines | ||
| 2108 | 2106 | *((unsigned int *) &fis->lba_low) = (start & 0xFFFFFF); |
| 2109 | 2107 | *((unsigned int *) &fis->lba_low_ex) = ((start >> 24) & 0xFFFFFF); |
| 2110 | 2108 | fis->device = 1 << 6; |
| 2111 | − if (barrier) | |
| 2112 | − fis->device |= FUA_BIT; | |
| 2113 | 2109 | fis->features = nsect & 0xFF; |
| 2114 | 2110 | fis->features_ex = (nsect >> 8) & 0xFF; |
| 2115 | 2111 | fis->sect_count = ((tag << 3) | (tag >> 5)); |
| @@ -3087,7 +3083,6 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) · 971 unmodified lines | ||
| 3087 | 3083 | tag, |
| 3088 | 3084 | bio_endio, |
| 3089 | 3085 | bio, |
| 3090 | − bio->bi_rw & REQ_FUA, | |
| 3091 | 3086 | bio_data_dir(bio)); |
| 3092 | 3087 | } else |
| 3093 | 3088 | bio_io_error(bio); |
| @@ -3187,6 +3182,10 @@ skip_create_disk: · 93 unmodified lines | ||
| 3187 | 3182 | blk_queue_max_segments(dd->queue, MTIP_MAX_SG); |
| 3188 | 3183 | blk_queue_physical_block_size(dd->queue, 4096); |
| 3189 | 3184 | blk_queue_io_min(dd->queue, 4096); |
| 3185 | + /* | |
| 3186 | + * write back cache is not supported in the device. FUA depends on | |
| 3187 | + * write back cache support, hence setting flush support to zero. | |
| 3188 | + */ | |
| 3190 | 3189 | blk_queue_flush(dd->queue, 0); |
| 3191 | 3190 | |
| 3192 | 3191 | /* Set the capacity of the device in 512 byte sectors. */ |
| @@ -104,9 +104,6 @@ · 103 unmodified lines | ||
| 104 | 104 | /* BAR number used to access the HBA registers. */ |
| 105 | 105 | #define MTIP_ABAR 5 |
| 106 | 106 | |
| 107 | −/* Forced Unit Access Bit */ | |
| 108 | −#define FUA_BIT 0x80 | |
| 109 | − | |
| 110 | 107 | #ifdef DEBUG |
| 111 | 108 | #define dbg_printk(format, arg...) \ |
| 112 | 109 | printk(pr_fmt(format), ##arg); |
| @@ -415,8 +412,6 @@ struct driver_data { · 302 unmodified lines | ||
| 415 | 412 | |
| 416 | 413 | atomic_t resumeflag; /* Atomic variable to track suspend/resume */ |
| 417 | 414 | |
| 418 | − atomic_t eh_active; /* Flag for error handling tracking */ | |
| 419 | − | |
| 420 | 415 | struct task_struct *mtip_svc_handler; /* task_struct of svc thd */ |
| 421 | 416 | }; |
| 422 | 417 | |
| @@ -41,6 +41,8 @@ · 40 unmodified lines | ||
| 41 | 41 | #include <linux/types.h> |
| 42 | 42 | #include <linux/version.h> |
| 43 | 43 | |
| 44 | +#include <asm-generic/io-64-nonatomic-lo-hi.h> | |
| 45 | + | |
| 44 | 46 | #define NVME_Q_DEPTH 1024 |
| 45 | 47 | #define SQ_SIZE(depth) (depth * sizeof(struct nvme_command)) |
| 46 | 48 | #define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion)) |
| @@ -102,6 +102,7 @@ static struct usb_device_id btusb_table[] = { · 101 unmodified lines | ||
| 102 | 102 | |
| 103 | 103 | /* Broadcom BCM20702A0 */ |
| 104 | 104 | { USB_DEVICE(0x0a5c, 0x21e3) }, |
| 105 | + { USB_DEVICE(0x0a5c, 0x21f3) }, | |
| 105 | 106 | { USB_DEVICE(0x413c, 0x8197) }, |
| 106 | 107 | |
| 107 | 108 | { } /* Terminating entry */ |
| @@ -726,9 +727,6 @@ static int btusb_send_frame(struct sk_buff *skb) · 618 unmodified lines | ||
| 726 | 727 | usb_fill_bulk_urb(urb, data->udev, pipe, |
| 727 | 728 | skb->data, skb->len, btusb_tx_complete, skb); |
| 728 | 729 | |
| 729 | − if (skb->priority >= HCI_PRIO_MAX - 1) | |
| 730 | − urb->transfer_flags = URB_ISO_ASAP; | |
| 731 | − | |
| 732 | 730 | hdev->stat.acl_tx++; |
| 733 | 731 | break; |
| 734 | 732 | |
| @@ -286,8 +286,6 @@ · 285 unmodified lines | ||
| 286 | 286 | |
| 287 | 287 | /* used to tell the module to turn on full debugging messages */ |
| 288 | 288 | static bool debug; |
| 289 | −/* used to keep tray locked at all times */ | |
| 290 | −static int keeplocked; | |
| 291 | 289 | /* default compatibility mode */ |
| 292 | 290 | static bool autoclose=1; |
| 293 | 291 | static bool autoeject; |
| @@ -1204,7 +1202,7 @@ void cdrom_release(struct cdrom_device_info *cdi, fmode_t mode) · 910 unmodified lines | ||
| 1204 | 1202 | cdinfo(CD_CLOSE, "Use count for \"/dev/%s\" now zero\n", cdi->name); |
| 1205 | 1203 | cdrom_dvd_rw_close_write(cdi); |
| 1206 | 1204 | |
| 1207 | − if ((cdo->capability & CDC_LOCK) && !keeplocked) { | |
| 1205 | + if ((cdo->capability & CDC_LOCK) && !cdi->keeplocked) { | |
| 1208 | 1206 | cdinfo(CD_CLOSE, "Unlocking door!\n"); |
| 1209 | 1207 | cdo->lock_door(cdi, 0); |
| 1210 | 1208 | } |
| @@ -1371,7 +1369,7 @@ static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot) · 160 unmodified lines | ||
| 1371 | 1369 | curslot = info->hdr.curslot; |
| 1372 | 1370 | kfree(info); |
| 1373 | 1371 | |
| 1374 | − if (cdi->use_count > 1 || keeplocked) { | |
| 1372 | + if (cdi->use_count > 1 || cdi->keeplocked) { | |
| 1375 | 1373 | if (slot == CDSL_CURRENT) { |
| 1376 | 1374 | return curslot; |
| 1377 | 1375 | } else { |
| @@ -2119,11 +2117,6 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf, · 741 unmodified lines | ||
| 2119 | 2117 | if (!nr) |
| 2120 | 2118 | return -ENOMEM; |
| 2121 | 2119 | |
| 2122 | − if (!access_ok(VERIFY_WRITE, ubuf, nframes * CD_FRAMESIZE_RAW)) { | |
| 2123 | − ret = -EFAULT; | |
| 2124 | − goto out; | |
| 2125 | − } | |
| 2126 | − | |
| 2127 | 2120 | cgc.data_direction = CGC_DATA_READ; |
| 2128 | 2121 | while (nframes > 0) { |
| 2129 | 2122 | if (nr > nframes) |
| @@ -2132,7 +2125,7 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf, · 2 unmodified lines | ||
| 2132 | 2125 | ret = cdrom_read_block(cdi, &cgc, lba, nr, 1, CD_FRAMESIZE_RAW); |
| 2133 | 2126 | if (ret) |
| 2134 | 2127 | break; |
| 2135 | − if (__copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) { | |
| 2128 | + if (copy_to_user(ubuf, cgc.buffer, CD_FRAMESIZE_RAW * nr)) { | |
| 2136 | 2129 | ret = -EFAULT; |
| 2137 | 2130 | break; |
| 2138 | 2131 | } |
| @@ -2140,7 +2133,6 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf, · 1 unmodified line | ||
| 2140 | 2133 | nframes -= nr; |
| 2141 | 2134 | lba += nr; |
| 2142 | 2135 | } |
| 2143 | −out: | |
| 2144 | 2136 | kfree(cgc.buffer); |
| 2145 | 2137 | return ret; |
| 2146 | 2138 | } |
| @@ -2295,7 +2287,7 @@ static int cdrom_ioctl_eject(struct cdrom_device_info *cdi) · 148 unmodified lines | ||
| 2295 | 2287 | |
| 2296 | 2288 | if (!CDROM_CAN(CDC_OPEN_TRAY)) |
| 2297 | 2289 | return -ENOSYS; |
| 2298 | − if (cdi->use_count != 1 || keeplocked) | |
| 2290 | + if (cdi->use_count != 1 || cdi->keeplocked) | |
| 2299 | 2291 | return -EBUSY; |
| 2300 | 2292 | if (CDROM_CAN(CDC_LOCK)) { |
| 2301 | 2293 | int ret = cdi->ops->lock_door(cdi, 0); |
| @@ -2322,7 +2314,7 @@ static int cdrom_ioctl_eject_sw(struct cdrom_device_info *cdi, · 20 unmodified lines | ||
| 2322 | 2314 | |
| 2323 | 2315 | if (!CDROM_CAN(CDC_OPEN_TRAY)) |
| 2324 | 2316 | return -ENOSYS; |
| 2325 | − if (keeplocked) | |
| 2317 | + if (cdi->keeplocked) | |
| 2326 | 2318 | return -EBUSY; |
| 2327 | 2319 | |
| 2328 | 2320 | cdi->options &= ~(CDO_AUTO_CLOSE | CDO_AUTO_EJECT); |
| @@ -2453,7 +2445,7 @@ static int cdrom_ioctl_lock_door(struct cdrom_device_info *cdi, · 124 unmodified lines | ||
| 2453 | 2445 | if (!CDROM_CAN(CDC_LOCK)) |
| 2454 | 2446 | return -EDRIVE_CANT_DO_THIS; |
| 2455 | 2447 | |
| 2456 | − keeplocked = arg ? 1 : 0; | |
| 2448 | + cdi->keeplocked = arg ? 1 : 0; | |
| 2457 | 2449 | |
| 2458 | 2450 | /* |
| 2459 | 2451 | * Don't unlock the door on multiple opens by default, but allow |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | |
| 2 | 2 | config CPU_IDLE |
| 3 | 3 | bool "CPU idle PM support" |
| 4 | − default ACPI | |
| 4 | + default y if ACPI || PPC_PSERIES | |
| 5 | 5 | help |
| 6 | 6 | CPU idle is a generic framework for supporting software-controlled |
| 7 | 7 | idle processor power management. It includes modular cross-platform |
| @@ -1343,7 +1343,7 @@ static int __init at_dma_probe(struct platform_device *pdev) · 1342 unmodified lines | ||
| 1343 | 1343 | |
| 1344 | 1344 | tasklet_init(&atchan->tasklet, atc_tasklet, |
| 1345 | 1345 | (unsigned long)atchan); |
| 1346 | − atc_enable_irq(atchan); | |
| 1346 | + atc_enable_chan_irq(atdma, i); | |
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | 1349 | /* set base routines */ |
| @@ -1410,7 +1410,7 @@ static int __exit at_dma_remove(struct platform_device *pdev) · 60 unmodified lines | ||
| 1410 | 1410 | struct at_dma_chan *atchan = to_at_dma_chan(chan); |
| 1411 | 1411 | |
| 1412 | 1412 | /* Disable interrupts */ |
| 1413 | − atc_disable_irq(atchan); | |
| 1413 | + atc_disable_chan_irq(atdma, chan->chan_id); | |
| 1414 | 1414 | tasklet_disable(&atchan->tasklet); |
| 1415 | 1415 | |
| 1416 | 1416 | tasklet_kill(&atchan->tasklet); |
| @@ -327,28 +327,27 @@ static void atc_dump_lli(struct at_dma_chan *atchan, struct at_lli *lli) · 326 unmodified lines | ||
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | |
| 330 | −static void atc_setup_irq(struct at_dma_chan *atchan, int on) | |
| 330 | +static void atc_setup_irq(struct at_dma *atdma, int chan_id, int on) | |
| 331 | 331 | { |
| 332 | − struct at_dma *atdma = to_at_dma(atchan->chan_common.device); | |
| 333 | − u32 ebci; | |
| 332 | + u32 ebci; | |
| 334 | 333 | |
| 335 | 334 | /* enable interrupts on buffer transfer completion & error */ |
| 336 | − ebci = AT_DMA_BTC(atchan->chan_common.chan_id) | |
| 337 | − | AT_DMA_ERR(atchan->chan_common.chan_id); | |
| 335 | + ebci = AT_DMA_BTC(chan_id) | |
| 336 | + | AT_DMA_ERR(chan_id); | |
| 338 | 337 | if (on) |
| 339 | 338 | dma_writel(atdma, EBCIER, ebci); |
| 340 | 339 | else |
| 341 | 340 | dma_writel(atdma, EBCIDR, ebci); |
| 342 | 341 | } |
| 343 | 342 | |
| 344 | −static inline void atc_enable_irq(struct at_dma_chan *atchan) | |
| 343 | +static void atc_enable_chan_irq(struct at_dma *atdma, int chan_id) | |
| 345 | 344 | { |
| 346 | − atc_setup_irq(atchan, 1); | |
| 345 | + atc_setup_irq(atdma, chan_id, 1); | |
| 347 | 346 | } |
| 348 | 347 | |
| 349 | −static inline void atc_disable_irq(struct at_dma_chan *atchan) | |
| 348 | +static void atc_disable_chan_irq(struct at_dma *atdma, int chan_id) | |
| 350 | 349 | { |
| 351 | − atc_setup_irq(atchan, 0); | |
| 350 | + atc_setup_irq(atdma, chan_id, 0); | |
| 352 | 351 | } |
| 353 | 352 | |
| 354 | 353 | |
| @@ -599,7 +599,7 @@ static int dmatest_add_channel(struct dma_chan *chan) · 598 unmodified lines | ||
| 599 | 599 | } |
| 600 | 600 | if (dma_has_cap(DMA_PQ, dma_dev->cap_mask)) { |
| 601 | 601 | cnt = dmatest_add_threads(dtc, DMA_PQ); |
| 602 | − thread_count += cnt > 0 ?: 0; | |
| 602 | + thread_count += cnt > 0 ? cnt : 0; | |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | pr_info("dmatest: Started %u threads using %s\n", |
| @@ -1102,11 +1102,13 @@ static int sdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, · 1101 unmodified lines | ||
| 1102 | 1102 | case DMA_SLAVE_CONFIG: |
| 1103 | 1103 | if (dmaengine_cfg->direction == DMA_DEV_TO_MEM) { |
| 1104 | 1104 | sdmac->per_address = dmaengine_cfg->src_addr; |
| 1105 | − sdmac->watermark_level = dmaengine_cfg->src_maxburst; | |
| 1105 | + sdmac->watermark_level = dmaengine_cfg->src_maxburst * | |
| 1106 | + dmaengine_cfg->src_addr_width; | |
| 1106 | 1107 | sdmac->word_size = dmaengine_cfg->src_addr_width; |
| 1107 | 1108 | } else { |
| 1108 | 1109 | sdmac->per_address = dmaengine_cfg->dst_addr; |
| 1109 | − sdmac->watermark_level = dmaengine_cfg->dst_maxburst; | |
| 1110 | + sdmac->watermark_level = dmaengine_cfg->dst_maxburst * | |
| 1111 | + dmaengine_cfg->dst_addr_width; | |
| 1110 | 1112 | sdmac->word_size = dmaengine_cfg->dst_addr_width; |
| 1111 | 1113 | } |
| 1112 | 1114 | sdmac->direction = dmaengine_cfg->direction; |
| @@ -1262,7 +1262,8 @@ static int __init sh_dmae_probe(struct platform_device *pdev) · 1261 unmodified lines | ||
| 1262 | 1262 | |
| 1263 | 1263 | INIT_LIST_HEAD(&shdev->common.channels); |
| 1264 | 1264 | |
| 1265 | − dma_cap_set(DMA_MEMCPY, shdev->common.cap_mask); | |
| 1265 | + if (!pdata->slave_only) | |
| 1266 | + dma_cap_set(DMA_MEMCPY, shdev->common.cap_mask); | |
| 1266 | 1267 | if (pdata->slave && pdata->slave_num) |
| 1267 | 1268 | dma_cap_set(DMA_SLAVE, shdev->common.cap_mask); |
| 1268 | 1269 | |
| @@ -15,6 +15,8 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/io.h> |
| 16 | 16 | #include "edac_core.h" |
| 17 | 17 | |
| 18 | +#include <asm-generic/io-64-nonatomic-lo-hi.h> | |
| 19 | + | |
| 18 | 20 | #define I3200_REVISION "1.1" |
| 19 | 21 | |
| 20 | 22 | #define EDAC_MOD_STR "i3200_edac" |
| @@ -101,19 +103,6 @@ struct i3200_priv { · 80 unmodified lines | ||
| 101 | 103 | |
| 102 | 104 | static int nr_channels; |
| 103 | 105 | |
| 104 | −#ifndef readq | |
| 105 | −static inline __u64 readq(const volatile void __iomem *addr) | |
| 106 | −{ | |
| 107 | − const volatile u32 __iomem *p = addr; | |
| 108 | − u32 low, high; | |
| 109 | − | |
| 110 | − low = readl(p); | |
| 111 | − high = readl(p + 1); | |
| 112 | − | |
| 113 | − return low + ((u64)high << 32); | |
| 114 | −} | |
| 115 | −#endif | |
| 116 | − | |
| 117 | 106 | static int how_many_channels(struct pci_dev *pdev) |
| 118 | 107 | { |
| 119 | 108 | unsigned char capid0_8b; /* 8th byte of CAPID0 */ |
| @@ -96,7 +96,7 @@ static const char *gpio_p2_names[LPC32XX_GPIO_P2_MAX] = { · 95 unmodified lines | ||
| 96 | 96 | }; |
| 97 | 97 | |
| 98 | 98 | static const char *gpio_p3_names[LPC32XX_GPIO_P3_MAX] = { |
| 99 | − "gpi000", "gpio01", "gpio02", "gpio03", | |
| 99 | + "gpio00", "gpio01", "gpio02", "gpio03", | |
| 100 | 100 | "gpio04", "gpio05" |
| 101 | 101 | }; |
| 102 | 102 | |
| @@ -448,6 +448,7 @@ static int __devinit ioh_gpio_probe(struct pci_dev *pdev, · 447 unmodified lines | ||
| 448 | 448 | chip->reg = chip->base; |
| 449 | 449 | chip->ch = i; |
| 450 | 450 | mutex_init(&chip->lock); |
| 451 | + spin_lock_init(&chip->spinlock); | |
| 451 | 452 | ioh_gpio_setup(chip, num_ports[i]); |
| 452 | 453 | ret = gpiochip_add(&chip->gpio); |
| 453 | 454 | if (ret) { |
| @@ -392,6 +392,7 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev, · 391 unmodified lines | ||
| 392 | 392 | chip->reg = chip->base; |
| 393 | 393 | pci_set_drvdata(pdev, chip); |
| 394 | 394 | mutex_init(&chip->lock); |
| 395 | + spin_lock_init(&chip->spinlock); | |
| 395 | 396 | pch_gpio_setup(chip); |
| 396 | 397 | ret = gpiochip_add(&chip->gpio); |
| 397 | 398 | if (ret) { |
| @@ -2387,27 +2387,30 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = { · 2386 unmodified lines | ||
| 2387 | 2387 | }; |
| 2388 | 2388 | |
| 2389 | 2389 | #if defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF) |
| 2390 | −static int exynos4_gpio_xlate(struct gpio_chip *gc, struct device_node *np, | |
| 2391 | − const void *gpio_spec, u32 *flags) | |
| 2390 | +static int exynos4_gpio_xlate(struct gpio_chip *gc, | |
| 2391 | + const struct of_phandle_args *gpiospec, u32 *flags) | |
| 2392 | 2392 | { |
| 2393 | − const __be32 *gpio = gpio_spec; | |
| 2394 | − const u32 n = be32_to_cpup(gpio); | |
| 2395 | − unsigned int pin = gc->base + be32_to_cpu(gpio[0]); | |
| 2393 | + unsigned int pin; | |
| 2396 | 2394 | |
| 2397 | 2395 | if (WARN_ON(gc->of_gpio_n_cells < 4)) |
| 2398 | 2396 | return -EINVAL; |
| 2399 | 2397 | |
| 2400 | − if (n > gc->ngpio) | |
| 2398 | + if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) | |
| 2401 | 2399 | return -EINVAL; |
| 2402 | 2400 | |
| 2403 | − if (s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(be32_to_cpu(gpio[1])))) | |
| 2401 | + if (gpiospec->args[0] > gc->ngpio) | |
| 2402 | + return -EINVAL; | |
| 2403 | + | |
| 2404 | + pin = gc->base + gpiospec->args[0]; | |
| 2405 | + | |
| 2406 | + if (s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(gpiospec->args[1]))) | |
| 2404 | 2407 | pr_warn("gpio_xlate: failed to set pin function\n"); |
| 2405 | − if (s3c_gpio_setpull(pin, be32_to_cpu(gpio[2]))) | |
| 2408 | + if (s3c_gpio_setpull(pin, gpiospec->args[2])) | |
| 2406 | 2409 | pr_warn("gpio_xlate: failed to set pin pull up/down\n"); |
| 2407 | − if (s5p_gpio_set_drvstr(pin, be32_to_cpu(gpio[3]))) | |
| 2410 | + if (s5p_gpio_set_drvstr(pin, gpiospec->args[3])) | |
| 2408 | 2411 | pr_warn("gpio_xlate: failed to set pin drive strength\n"); |
| 2409 | 2412 | |
| 2410 | − return n; | |
| 2413 | + return gpiospec->args[0]; | |
| 2411 | 2414 | } |
| 2412 | 2415 | |
| 2413 | 2416 | static const struct of_device_id exynos4_gpio_dt_match[] __initdata = { |
| @@ -315,7 +315,8 @@ static int compat_drm_getclient(struct file *file, unsigned int cmd, · 314 unmodified lines | ||
| 315 | 315 | if (err) |
| 316 | 316 | return err; |
| 317 | 317 | |
| 318 | − if (__get_user(c32.auth, &client->auth) | |
| 318 | + if (__get_user(c32.idx, &client->idx) | |
| 319 | + || __get_user(c32.auth, &client->auth) | |
| 319 | 320 | || __get_user(c32.pid, &client->pid) |
| 320 | 321 | || __get_user(c32.uid, &client->uid) |
| 321 | 322 | || __get_user(c32.magic, &client->magic) |
| @@ -193,6 +193,9 @@ int exynos_drm_subdrv_register(struct exynos_drm_subdrv *subdrv) · 192 unmodified lines | ||
| 193 | 193 | return err; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | + /* setup possible_clones. */ | |
| 197 | + exynos_drm_encoder_setup(drm_dev); | |
| 198 | + | |
| 196 | 199 | /* |
| 197 | 200 | * if any specific driver such as fimd or hdmi driver called |
| 198 | 201 | * exynos_drm_subdrv_register() later than drm_load(), |
| @@ -307,9 +307,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, · 306 unmodified lines | ||
| 307 | 307 | */ |
| 308 | 308 | event->pipe = exynos_crtc->pipe; |
| 309 | 309 | |
| 310 | − list_add_tail(&event->base.link, | |
| 311 | − &dev_priv->pageflip_event_list); | |
| 312 | − | |
| 313 | 310 | ret = drm_vblank_get(dev, exynos_crtc->pipe); |
| 314 | 311 | if (ret) { |
| 315 | 312 | DRM_DEBUG("failed to acquire vblank counter\n"); |
| @@ -318,6 +315,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, · 2 unmodified lines | ||
| 318 | 315 | goto out; |
| 319 | 316 | } |
| 320 | 317 | |
| 318 | + list_add_tail(&event->base.link, | |
| 319 | + &dev_priv->pageflip_event_list); | |
| 320 | + | |
| 321 | 321 | crtc->fb = fb; |
| 322 | 322 | ret = exynos_drm_crtc_update(crtc); |
| 323 | 323 | if (ret) { |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | #include "exynos_drm_drv.h" |
| 35 | 35 | #include "exynos_drm_crtc.h" |
| 36 | +#include "exynos_drm_encoder.h" | |
| 36 | 37 | #include "exynos_drm_fbdev.h" |
| 37 | 38 | #include "exynos_drm_fb.h" |
| 38 | 39 | #include "exynos_drm_gem.h" |
| @@ -99,6 +100,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) · 60 unmodified lines | ||
| 99 | 100 | if (ret) |
| 100 | 101 | goto err_vblank; |
| 101 | 102 | |
| 103 | + /* setup possible_clones. */ | |
| 104 | + exynos_drm_encoder_setup(dev); | |
| 105 | + | |
| 102 | 106 | /* |
| 103 | 107 | * create and configure fb helper and also exynos specific |
| 104 | 108 | * fbdev object. |
| @@ -141,16 +145,21 @@ static int exynos_drm_unload(struct drm_device *dev) · 36 unmodified lines | ||
| 141 | 145 | } |
| 142 | 146 | |
| 143 | 147 | static void exynos_drm_preclose(struct drm_device *dev, |
| 144 | − struct drm_file *file_priv) | |
| 148 | + struct drm_file *file) | |
| 145 | 149 | { |
| 146 | − struct exynos_drm_private *dev_priv = dev->dev_private; | |
| 150 | + DRM_DEBUG_DRIVER("%s\n", __FILE__); | |
| 147 | 151 | |
| 148 | − /* | |
| 149 | − * drm framework frees all events at release time, | |
| 150 | − * so private event list should be cleared. | |
| 151 | − */ | |
| 152 | − if (!list_empty(&dev_priv->pageflip_event_list)) | |
| 153 | − INIT_LIST_HEAD(&dev_priv->pageflip_event_list); | |
| 152 | +} | |
| 153 | + | |
| 154 | +static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) | |
| 155 | +{ | |
| 156 | + DRM_DEBUG_DRIVER("%s\n", __FILE__); | |
| 157 | + | |
| 158 | + if (!file->driver_priv) | |
| 159 | + return; | |
| 160 | + | |
| 161 | + kfree(file->driver_priv); | |
| 162 | + file->driver_priv = NULL; | |
| 154 | 163 | } |
| 155 | 164 | |
| 156 | 165 | static void exynos_drm_lastclose(struct drm_device *dev) |
| @@ -195,6 +204,7 @@ static struct drm_driver exynos_drm_driver = { · 38 unmodified lines | ||
| 195 | 204 | .unload = exynos_drm_unload, |
| 196 | 205 | .preclose = exynos_drm_preclose, |
| 197 | 206 | .lastclose = exynos_drm_lastclose, |
| 207 | + .postclose = exynos_drm_postclose, | |
| 198 | 208 | .get_vblank_counter = drm_vblank_count, |
| 199 | 209 | .enable_vblank = exynos_drm_crtc_enable_vblank, |
| 200 | 210 | .disable_vblank = exynos_drm_crtc_disable_vblank, |
| @@ -195,6 +195,40 @@ static struct drm_encoder_funcs exynos_encoder_funcs = { · 194 unmodified lines | ||
| 195 | 195 | .destroy = exynos_drm_encoder_destroy, |
| 196 | 196 | }; |
| 197 | 197 | |
| 198 | +static unsigned int exynos_drm_encoder_clones(struct drm_encoder *encoder) | |
| 199 | +{ | |
| 200 | + struct drm_encoder *clone; | |
| 201 | + struct drm_device *dev = encoder->dev; | |
| 202 | + struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder); | |
| 203 | + struct exynos_drm_display_ops *display_ops = | |
| 204 | + exynos_encoder->manager->display_ops; | |
| 205 | + unsigned int clone_mask = 0; | |
| 206 | + int cnt = 0; | |
| 207 | + | |
| 208 | + list_for_each_entry(clone, &dev->mode_config.encoder_list, head) { | |
| 209 | + switch (display_ops->type) { | |
| 210 | + case EXYNOS_DISPLAY_TYPE_LCD: | |
| 211 | + case EXYNOS_DISPLAY_TYPE_HDMI: | |
| 212 | + clone_mask |= (1 << (cnt++)); | |
| 213 | + break; | |
| 214 | + default: | |
| 215 | + continue; | |
| 216 | + } | |
| 217 | + } | |
| 218 | + | |
| 219 | + return clone_mask; | |
| 220 | +} | |
| 221 | + | |
| 222 | +void exynos_drm_encoder_setup(struct drm_device *dev) | |
| 223 | +{ | |
| 224 | + struct drm_encoder *encoder; | |
| 225 | + | |
| 226 | + DRM_DEBUG_KMS("%s\n", __FILE__); | |
| 227 | + | |
| 228 | + list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) | |
| 229 | + encoder->possible_clones = exynos_drm_encoder_clones(encoder); | |
| 230 | +} | |
| 231 | + | |
| 198 | 232 | struct drm_encoder * |
| 199 | 233 | exynos_drm_encoder_create(struct drm_device *dev, |
| 200 | 234 | struct exynos_drm_manager *manager, |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | |
| 31 | 31 | struct exynos_drm_manager; |
| 32 | 32 | |
| 33 | +void exynos_drm_encoder_setup(struct drm_device *dev); | |
| 33 | 34 | struct drm_encoder *exynos_drm_encoder_create(struct drm_device *dev, |
| 34 | 35 | struct exynos_drm_manager *mgr, |
| 35 | 36 | unsigned int possible_crtcs); |
| @@ -195,66 +195,6 @@ out: · 194 unmodified lines | ||
| 195 | 195 | return ret; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | −static bool | |
| 199 | −exynos_drm_fbdev_is_samefb(struct drm_framebuffer *fb, | |
| 200 | − struct drm_fb_helper_surface_size *sizes) | |
| 201 | −{ | |
| 202 | − if (fb->width != sizes->surface_width) | |
| 203 | − return false; | |
| 204 | − if (fb->height != sizes->surface_height) | |
| 205 | − return false; | |
| 206 | − if (fb->bits_per_pixel != sizes->surface_bpp) | |
| 207 | − return false; | |
| 208 | − if (fb->depth != sizes->surface_depth) | |
| 209 | − return false; | |
| 210 | − | |
| 211 | − return true; | |
| 212 | −} | |
| 213 | − | |
| 214 | −static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper, | |
| 215 | − struct drm_fb_helper_surface_size *sizes) | |
| 216 | −{ | |
| 217 | − struct drm_device *dev = helper->dev; | |
| 218 | − struct exynos_drm_fbdev *exynos_fbdev = to_exynos_fbdev(helper); | |
| 219 | − struct exynos_drm_gem_obj *exynos_gem_obj; | |
| 220 | − struct drm_framebuffer *fb = helper->fb; | |
| 221 | − struct drm_mode_fb_cmd2 mode_cmd = { 0 }; | |
| 222 | − unsigned long size; | |
| 223 | − | |
| 224 | − DRM_DEBUG_KMS("%s\n", __FILE__); | |
| 225 | − | |
| 226 | − if (exynos_drm_fbdev_is_samefb(fb, sizes)) | |
| 227 | − return 0; | |
| 228 | − | |
| 229 | − mode_cmd.width = sizes->surface_width; | |
| 230 | − mode_cmd.height = sizes->surface_height; | |
| 231 | − mode_cmd.pitches[0] = sizes->surface_width * (sizes->surface_bpp >> 3); | |
| 232 | − mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, | |
| 233 | − sizes->surface_depth); | |
| 234 | − | |
| 235 | − if (exynos_fbdev->exynos_gem_obj) | |
| 236 | − exynos_drm_gem_destroy(exynos_fbdev->exynos_gem_obj); | |
| 237 | − | |
| 238 | − if (fb->funcs->destroy) | |
| 239 | − fb->funcs->destroy(fb); | |
| 240 | − | |
| 241 | − size = mode_cmd.pitches[0] * mode_cmd.height; | |
| 242 | − exynos_gem_obj = exynos_drm_gem_create(dev, size); | |
| 243 | − if (IS_ERR(exynos_gem_obj)) | |
| 244 | − return PTR_ERR(exynos_gem_obj); | |
| 245 | − | |
| 246 | − exynos_fbdev->exynos_gem_obj = exynos_gem_obj; | |
| 247 | − | |
| 248 | − helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd, | |
| 249 | − &exynos_gem_obj->base); | |
| 250 | − if (IS_ERR_OR_NULL(helper->fb)) { | |
| 251 | − DRM_ERROR("failed to create drm framebuffer.\n"); | |
| 252 | − return PTR_ERR(helper->fb); | |
| 253 | − } | |
| 254 | − | |
| 255 | − return exynos_drm_fbdev_update(helper, helper->fb); | |
| 256 | −} | |
| 257 | − | |
| 258 | 198 | static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, |
| 259 | 199 | struct drm_fb_helper_surface_size *sizes) |
| 260 | 200 | { |
| @@ -262,6 +202,10 @@ static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, · 1 unmodified line | ||
| 262 | 202 | |
| 263 | 203 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 264 | 204 | |
| 205 | + /* | |
| 206 | + * with !helper->fb, it means that this funcion is called first time | |
| 207 | + * and after that, the helper->fb would be used as clone mode. | |
| 208 | + */ | |
| 265 | 209 | if (!helper->fb) { |
| 266 | 210 | ret = exynos_drm_fbdev_create(helper, sizes); |
| 267 | 211 | if (ret < 0) { |
| @@ -274,12 +218,6 @@ static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper, · 6 unmodified lines | ||
| 274 | 218 | * because register_framebuffer() should be called. |
| 275 | 219 | */ |
| 276 | 220 | ret = 1; |
| 277 | − } else { | |
| 278 | − ret = exynos_drm_fbdev_recreate(helper, sizes); | |
| 279 | − if (ret < 0) { | |
| 280 | − DRM_ERROR("failed to reconfigure fbdev\n"); | |
| 281 | − return ret; | |
| 282 | − } | |
| 283 | 221 | } |
| 284 | 222 | |
| 285 | 223 | return ret; |
| @@ -604,7 +604,12 @@ static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) · 603 unmodified lines | ||
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | if (is_checked) { |
| 607 | − drm_vblank_put(drm_dev, crtc); | |
| 607 | + /* | |
| 608 | + * call drm_vblank_put only in case that drm_vblank_get was | |
| 609 | + * called. | |
| 610 | + */ | |
| 611 | + if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0) | |
| 612 | + drm_vblank_put(drm_dev, crtc); | |
| 608 | 613 | |
| 609 | 614 | /* |
| 610 | 615 | * don't off vblank if vblank_disable_allowed is 1, |
| @@ -712,7 +712,12 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) · 711 unmodified lines | ||
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | if (is_checked) |
| 715 | − drm_vblank_put(drm_dev, crtc); | |
| 715 | + /* | |
| 716 | + * call drm_vblank_put only in case that drm_vblank_get was | |
| 717 | + * called. | |
| 718 | + */ | |
| 719 | + if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0) | |
| 720 | + drm_vblank_put(drm_dev, crtc); | |
| 716 | 721 | |
| 717 | 722 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); |
| 718 | 723 | } |
| @@ -779,15 +784,15 @@ static void mixer_win_reset(struct mixer_context *ctx) · 60 unmodified lines | ||
| 779 | 784 | mixer_reg_writemask(res, MXR_STATUS, MXR_STATUS_16_BURST, |
| 780 | 785 | MXR_STATUS_BURST_MASK); |
| 781 | 786 | |
| 782 | − /* setting default layer priority: layer1 > video > layer0 | |
| 787 | + /* setting default layer priority: layer1 > layer0 > video | |
| 783 | 788 | * because typical usage scenario would be |
| 789 | + * layer1 - OSD | |
| 784 | 790 | * layer0 - framebuffer |
| 785 | 791 | * video - video overlay |
| 786 | − * layer1 - OSD | |
| 787 | 792 | */ |
| 788 | − val = MXR_LAYER_CFG_GRP0_VAL(1); | |
| 789 | − val |= MXR_LAYER_CFG_VP_VAL(2); | |
| 790 | − val |= MXR_LAYER_CFG_GRP1_VAL(3); | |
| 793 | + val = MXR_LAYER_CFG_GRP1_VAL(3); | |
| 794 | + val |= MXR_LAYER_CFG_GRP0_VAL(2); | |
| 795 | + val |= MXR_LAYER_CFG_VP_VAL(1); | |
| 791 | 796 | mixer_reg_write(res, MXR_LAYER_CFG, val); |
| 792 | 797 | |
| 793 | 798 | /* setting background color */ |
| @@ -1044,7 +1049,7 @@ static int mixer_remove(struct platform_device *pdev) · 250 unmodified lines | ||
| 1044 | 1049 | platform_get_drvdata(pdev); |
| 1045 | 1050 | struct mixer_context *ctx = (struct mixer_context *)drm_hdmi_ctx->ctx; |
| 1046 | 1051 | |
| 1047 | − dev_info(dev, "remove sucessful\n"); | |
| 1052 | + dev_info(dev, "remove successful\n"); | |
| 1048 | 1053 | |
| 1049 | 1054 | mixer_resource_poweroff(ctx); |
| 1050 | 1055 | mixer_resources_cleanup(ctx); |
| @@ -3028,6 +3028,20 @@ · 3027 unmodified lines | ||
| 3028 | 3028 | #define DISP_TILE_SURFACE_SWIZZLING (1<<13) |
| 3029 | 3029 | #define DISP_FBC_WM_DIS (1<<15) |
| 3030 | 3030 | |
| 3031 | +/* GEN7 chicken */ | |
| 3032 | +#define GEN7_COMMON_SLICE_CHICKEN1 0x7010 | |
| 3033 | +# define GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC ((1<<10) | (1<<26)) | |
| 3034 | + | |
| 3035 | +#define GEN7_L3CNTLREG1 0xB01C | |
| 3036 | +#define GEN7_WA_FOR_GEN7_L3_CONTROL 0x3C4FFF8C | |
| 3037 | + | |
| 3038 | +#define GEN7_L3_CHICKEN_MODE_REGISTER 0xB030 | |
| 3039 | +#define GEN7_WA_L3_CHICKEN_MODE 0x20000000 | |
| 3040 | + | |
| 3041 | +/* WaCatErrorRejectionIssue */ | |
| 3042 | +#define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG 0x9030 | |
| 3043 | +#define GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB (1<<11) | |
| 3044 | + | |
| 3031 | 3045 | /* PCH */ |
| 3032 | 3046 | |
| 3033 | 3047 | /* south display engine interrupt */ |
| @@ -3618,6 +3632,7 @@ · 584 unmodified lines | ||
| 3618 | 3632 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 |
| 3619 | 3633 | |
| 3620 | 3634 | #define GEN6_UCGCTL2 0x9404 |
| 3635 | +# define GEN6_RCZUNIT_CLOCK_GATE_DISABLE (1 << 13) | |
| 3621 | 3636 | # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12) |
| 3622 | 3637 | # define GEN6_RCCUNIT_CLOCK_GATE_DISABLE (1 << 11) |
| 3623 | 3638 | |
| @@ -1872,7 +1872,7 @@ static void intel_update_fbc(struct drm_device *dev) · 1871 unmodified lines | ||
| 1872 | 1872 | if (enable_fbc < 0) { |
| 1873 | 1873 | DRM_DEBUG_KMS("fbc set to per-chip default\n"); |
| 1874 | 1874 | enable_fbc = 1; |
| 1875 | − if (INTEL_INFO(dev)->gen <= 5) | |
| 1875 | + if (INTEL_INFO(dev)->gen <= 6) | |
| 1876 | 1876 | enable_fbc = 0; |
| 1877 | 1877 | } |
| 1878 | 1878 | if (!enable_fbc) { |
| @@ -5307,6 +5307,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, · 3428 unmodified lines | ||
| 5307 | 5307 | } |
| 5308 | 5308 | } |
| 5309 | 5309 | |
| 5310 | + pipeconf &= ~PIPECONF_INTERLACE_MASK; | |
| 5310 | 5311 | if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) { |
| 5311 | 5312 | pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION; |
| 5312 | 5313 | /* the chip adds 2 halflines automatically */ |
| @@ -5317,7 +5318,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, · 4 unmodified lines | ||
| 5317 | 5318 | adjusted_mode->crtc_vsync_end -= 1; |
| 5318 | 5319 | adjusted_mode->crtc_vsync_start -= 1; |
| 5319 | 5320 | } else |
| 5320 | − pipeconf &= ~PIPECONF_INTERLACE_MASK; /* progressive */ | |
| 5321 | + pipeconf |= PIPECONF_PROGRESSIVE; | |
| 5321 | 5322 | |
| 5322 | 5323 | I915_WRITE(HTOTAL(pipe), |
| 5323 | 5324 | (adjusted_mode->crtc_hdisplay - 1) | |
| @@ -5902,6 +5903,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, · 578 unmodified lines | ||
| 5902 | 5903 | } |
| 5903 | 5904 | } |
| 5904 | 5905 | |
| 5906 | + pipeconf &= ~PIPECONF_INTERLACE_MASK; | |
| 5905 | 5907 | if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) { |
| 5906 | 5908 | pipeconf |= PIPECONF_INTERLACE_W_FIELD_INDICATION; |
| 5907 | 5909 | /* the chip adds 2 halflines automatically */ |
| @@ -5912,7 +5914,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, · 4 unmodified lines | ||
| 5912 | 5914 | adjusted_mode->crtc_vsync_end -= 1; |
| 5913 | 5915 | adjusted_mode->crtc_vsync_start -= 1; |
| 5914 | 5916 | } else |
| 5915 | − pipeconf &= ~PIPECONF_INTERLACE_W_FIELD_INDICATION; /* progressive */ | |
| 5917 | + pipeconf |= PIPECONF_PROGRESSIVE; | |
| 5916 | 5918 | |
| 5917 | 5919 | I915_WRITE(HTOTAL(pipe), |
| 5918 | 5920 | (adjusted_mode->crtc_hdisplay - 1) | |
| @@ -8182,8 +8184,8 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) · 2263 unmodified lines | ||
| 8182 | 8184 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ |
| 8183 | 8185 | |
| 8184 | 8186 | if (intel_enable_rc6(dev_priv->dev)) |
| 8185 | − rc6_mask = GEN6_RC_CTL_RC6p_ENABLE | | |
| 8186 | − GEN6_RC_CTL_RC6_ENABLE; | |
| 8187 | + rc6_mask = GEN6_RC_CTL_RC6_ENABLE | | |
| 8188 | + (IS_GEN7(dev_priv->dev)) ? GEN6_RC_CTL_RC6p_ENABLE : 0; | |
| 8187 | 8189 | |
| 8188 | 8190 | I915_WRITE(GEN6_RC_CONTROL, |
| 8189 | 8191 | rc6_mask | |
| @@ -8461,12 +8463,32 @@ static void ivybridge_init_clock_gating(struct drm_device *dev) · 271 unmodified lines | ||
| 8461 | 8463 | I915_WRITE(WM2_LP_ILK, 0); |
| 8462 | 8464 | I915_WRITE(WM1_LP_ILK, 0); |
| 8463 | 8465 | |
| 8466 | + /* According to the spec, bit 13 (RCZUNIT) must be set on IVB. | |
| 8467 | + * This implements the WaDisableRCZUnitClockGating workaround. | |
| 8468 | + */ | |
| 8469 | + I915_WRITE(GEN6_UCGCTL2, GEN6_RCZUNIT_CLOCK_GATE_DISABLE); | |
| 8470 | + | |
| 8464 | 8471 | I915_WRITE(ILK_DSPCLK_GATE, IVB_VRHUNIT_CLK_GATE); |
| 8465 | 8472 | |
| 8466 | 8473 | I915_WRITE(IVB_CHICKEN3, |
| 8467 | 8474 | CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE | |
| 8468 | 8475 | CHICKEN3_DGMG_DONE_FIX_DISABLE); |
| 8469 | 8476 | |
| 8477 | + /* Apply the WaDisableRHWOOptimizationForRenderHang workaround. */ | |
| 8478 | + I915_WRITE(GEN7_COMMON_SLICE_CHICKEN1, | |
| 8479 | + GEN7_CSC1_RHWO_OPT_DISABLE_IN_RCC); | |
| 8480 | + | |
| 8481 | + /* WaApplyL3ControlAndL3ChickenMode requires those two on Ivy Bridge */ | |
| 8482 | + I915_WRITE(GEN7_L3CNTLREG1, | |
| 8483 | + GEN7_WA_FOR_GEN7_L3_CONTROL); | |
| 8484 | + I915_WRITE(GEN7_L3_CHICKEN_MODE_REGISTER, | |
| 8485 | + GEN7_WA_L3_CHICKEN_MODE); | |
| 8486 | + | |
| 8487 | + /* This is required by WaCatErrorRejectionIssue */ | |
| 8488 | + I915_WRITE(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG, | |
| 8489 | + I915_READ(GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) | | |
| 8490 | + GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB); | |
| 8491 | + | |
| 8470 | 8492 | for_each_pipe(pipe) { |
| 8471 | 8493 | I915_WRITE(DSPCNTR(pipe), |
| 8472 | 8494 | I915_READ(DSPCNTR(pipe)) | |
| @@ -208,17 +208,8 @@ intel_dp_link_clock(uint8_t link_bw) · 207 unmodified lines | ||
| 208 | 208 | */ |
| 209 | 209 | |
| 210 | 210 | static int |
| 211 | −intel_dp_link_required(struct intel_dp *intel_dp, int pixel_clock, int check_bpp) | |
| 211 | +intel_dp_link_required(int pixel_clock, int bpp) | |
| 212 | 212 | { |
| 213 | − struct drm_crtc *crtc = intel_dp->base.base.crtc; | |
| 214 | − struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | |
| 215 | − int bpp = 24; | |
| 216 | − | |
| 217 | − if (check_bpp) | |
| 218 | − bpp = check_bpp; | |
| 219 | − else if (intel_crtc) | |
| 220 | − bpp = intel_crtc->bpp; | |
| 221 | − | |
| 222 | 213 | return (pixel_clock * bpp + 9) / 10; |
| 223 | 214 | } |
| 224 | 215 | |
| @@ -245,12 +236,11 @@ intel_dp_mode_valid(struct drm_connector *connector, · 20 unmodified lines | ||
| 245 | 236 | return MODE_PANEL; |
| 246 | 237 | } |
| 247 | 238 | |
| 248 | − mode_rate = intel_dp_link_required(intel_dp, mode->clock, 0); | |
| 239 | + mode_rate = intel_dp_link_required(mode->clock, 24); | |
| 249 | 240 | max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); |
| 250 | 241 | |
| 251 | 242 | if (mode_rate > max_rate) { |
| 252 | − mode_rate = intel_dp_link_required(intel_dp, | |
| 253 | − mode->clock, 18); | |
| 243 | + mode_rate = intel_dp_link_required(mode->clock, 18); | |
| 254 | 244 | if (mode_rate > max_rate) |
| 255 | 245 | return MODE_CLOCK_HIGH; |
| 256 | 246 | else |
| @@ -683,7 +673,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, · 426 unmodified lines | ||
| 683 | 673 | int lane_count, clock; |
| 684 | 674 | int max_lane_count = intel_dp_max_lane_count(intel_dp); |
| 685 | 675 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; |
| 686 | − int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 0; | |
| 676 | + int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24; | |
| 687 | 677 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; |
| 688 | 678 | |
| 689 | 679 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
| @@ -701,7 +691,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, · 11 unmodified lines | ||
| 701 | 691 | for (clock = 0; clock <= max_clock; clock++) { |
| 702 | 692 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); |
| 703 | 693 | |
| 704 | − if (intel_dp_link_required(intel_dp, mode->clock, bpp) | |
| 694 | + if (intel_dp_link_required(mode->clock, bpp) | |
| 705 | 695 | <= link_avail) { |
| 706 | 696 | intel_dp->link_bw = bws[clock]; |
| 707 | 697 | intel_dp->lane_count = lane_count; |
| @@ -692,6 +692,14 @@ static const struct dmi_system_id intel_no_lvds[] = { · 691 unmodified lines | ||
| 692 | 692 | DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), |
| 693 | 693 | }, |
| 694 | 694 | }, |
| 695 | + { | |
| 696 | + .callback = intel_no_lvds_dmi_callback, | |
| 697 | + .ident = "AOpen i45GMx-I", | |
| 698 | + .matches = { | |
| 699 | + DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"), | |
| 700 | + DMI_MATCH(DMI_BOARD_NAME, "i45GMx-I"), | |
| 701 | + }, | |
| 702 | + }, | |
| 695 | 703 | { |
| 696 | 704 | .callback = intel_no_lvds_dmi_callback, |
| 697 | 705 | .ident = "Aopen i945GTt-VFA", |
| @@ -3191,6 +3191,7 @@ static int evergreen_startup(struct radeon_device *rdev) · 3190 unmodified lines | ||
| 3191 | 3191 | if (r) { |
| 3192 | 3192 | DRM_ERROR("radeon: failed testing IB (%d).\n", r); |
| 3193 | 3193 | rdev->accel_working = false; |
| 3194 | + return r; | |
| 3194 | 3195 | } |
| 3195 | 3196 | |
| 3196 | 3197 | r = r600_audio_init(rdev); |
| @@ -3222,6 +3223,7 @@ int evergreen_resume(struct radeon_device *rdev) · 25 unmodified lines | ||
| 3222 | 3223 | r = evergreen_startup(rdev); |
| 3223 | 3224 | if (r) { |
| 3224 | 3225 | DRM_ERROR("evergreen startup failed on resume\n"); |
| 3226 | + rdev->accel_working = false; | |
| 3225 | 3227 | return r; |
| 3226 | 3228 | } |
| 3227 | 3229 | |
| @@ -1547,6 +1547,7 @@ int cayman_resume(struct radeon_device *rdev) · 1546 unmodified lines | ||
| 1547 | 1547 | r = cayman_startup(rdev); |
| 1548 | 1548 | if (r) { |
| 1549 | 1549 | DRM_ERROR("cayman startup failed on resume\n"); |
| 1550 | + rdev->accel_working = false; | |
| 1550 | 1551 | return r; |
| 1551 | 1552 | } |
| 1552 | 1553 | return r; |
| @@ -789,9 +789,7 @@ int r100_irq_process(struct radeon_device *rdev) · 788 unmodified lines | ||
| 789 | 789 | WREG32(RADEON_AIC_CNTL, msi_rearm | RS400_MSI_REARM); |
| 790 | 790 | break; |
| 791 | 791 | default: |
| 792 | − msi_rearm = RREG32(RADEON_MSI_REARM_EN) & ~RV370_MSI_REARM_EN; | |
| 793 | − WREG32(RADEON_MSI_REARM_EN, msi_rearm); | |
| 794 | − WREG32(RADEON_MSI_REARM_EN, msi_rearm | RV370_MSI_REARM_EN); | |
| 792 | + WREG32(RADEON_MSI_REARM_EN, RV370_MSI_REARM_EN); | |
| 795 | 793 | break; |
| 796 | 794 | } |
| 797 | 795 | } |
| @@ -3930,6 +3928,8 @@ static int r100_startup(struct radeon_device *rdev) · 3132 unmodified lines | ||
| 3930 | 3928 | |
| 3931 | 3929 | int r100_resume(struct radeon_device *rdev) |
| 3932 | 3930 | { |
| 3931 | + int r; | |
| 3932 | + | |
| 3933 | 3933 | /* Make sur GART are not working */ |
| 3934 | 3934 | if (rdev->flags & RADEON_IS_PCI) |
| 3935 | 3935 | r100_pci_gart_disable(rdev); |
| @@ -3949,7 +3949,11 @@ int r100_resume(struct radeon_device *rdev) · 13 unmodified lines | ||
| 3949 | 3949 | radeon_surface_init(rdev); |
| 3950 | 3950 | |
| 3951 | 3951 | rdev->accel_working = true; |
| 3952 | − return r100_startup(rdev); | |
| 3952 | + r = r100_startup(rdev); | |
| 3953 | + if (r) { | |
| 3954 | + rdev->accel_working = false; | |
| 3955 | + } | |
| 3956 | + return r; | |
| 3953 | 3957 | } |
| 3954 | 3958 | |
| 3955 | 3959 | int r100_suspend(struct radeon_device *rdev) |
| @@ -1431,6 +1431,8 @@ static int r300_startup(struct radeon_device *rdev) · 1430 unmodified lines | ||
| 1431 | 1431 | |
| 1432 | 1432 | int r300_resume(struct radeon_device *rdev) |
| 1433 | 1433 | { |
| 1434 | + int r; | |
| 1435 | + | |
| 1434 | 1436 | /* Make sur GART are not working */ |
| 1435 | 1437 | if (rdev->flags & RADEON_IS_PCIE) |
| 1436 | 1438 | rv370_pcie_gart_disable(rdev); |
| @@ -1452,7 +1454,11 @@ int r300_resume(struct radeon_device *rdev) · 15 unmodified lines | ||
| 1452 | 1454 | radeon_surface_init(rdev); |
| 1453 | 1455 | |
| 1454 | 1456 | rdev->accel_working = true; |
| 1455 | − return r300_startup(rdev); | |
| 1457 | + r = r300_startup(rdev); | |
| 1458 | + if (r) { | |
| 1459 | + rdev->accel_working = false; | |
| 1460 | + } | |
| 1461 | + return r; | |
| 1456 | 1462 | } |
| 1457 | 1463 | |
| 1458 | 1464 | int r300_suspend(struct radeon_device *rdev) |
| @@ -291,6 +291,8 @@ static int r420_startup(struct radeon_device *rdev) · 290 unmodified lines | ||
| 291 | 291 | |
| 292 | 292 | int r420_resume(struct radeon_device *rdev) |
| 293 | 293 | { |
| 294 | + int r; | |
| 295 | + | |
| 294 | 296 | /* Make sur GART are not working */ |
| 295 | 297 | if (rdev->flags & RADEON_IS_PCIE) |
| 296 | 298 | rv370_pcie_gart_disable(rdev); |
| @@ -316,7 +318,11 @@ int r420_resume(struct radeon_device *rdev) · 19 unmodified lines | ||
| 316 | 318 | radeon_surface_init(rdev); |
| 317 | 319 | |
| 318 | 320 | rdev->accel_working = true; |
| 319 | − return r420_startup(rdev); | |
| 321 | + r = r420_startup(rdev); | |
| 322 | + if (r) { | |
| 323 | + rdev->accel_working = false; | |
| 324 | + } | |
| 325 | + return r; | |
| 320 | 326 | } |
| 321 | 327 | |
| 322 | 328 | int r420_suspend(struct radeon_device *rdev) |
| @@ -218,6 +218,8 @@ static int r520_startup(struct radeon_device *rdev) · 217 unmodified lines | ||
| 218 | 218 | |
| 219 | 219 | int r520_resume(struct radeon_device *rdev) |
| 220 | 220 | { |
| 221 | + int r; | |
| 222 | + | |
| 221 | 223 | /* Make sur GART are not working */ |
| 222 | 224 | if (rdev->flags & RADEON_IS_PCIE) |
| 223 | 225 | rv370_pcie_gart_disable(rdev); |
| @@ -237,7 +239,11 @@ int r520_resume(struct radeon_device *rdev) · 13 unmodified lines | ||
| 237 | 239 | radeon_surface_init(rdev); |
| 238 | 240 | |
| 239 | 241 | rdev->accel_working = true; |
| 240 | − return r520_startup(rdev); | |
| 242 | + r = r520_startup(rdev); | |
| 243 | + if (r) { | |
| 244 | + rdev->accel_working = false; | |
| 245 | + } | |
| 246 | + return r; | |
| 241 | 247 | } |
| 242 | 248 | |
| 243 | 249 | int r520_init(struct radeon_device *rdev) |
| @@ -2529,6 +2529,7 @@ int r600_resume(struct radeon_device *rdev) · 2528 unmodified lines | ||
| 2529 | 2529 | r = r600_startup(rdev); |
| 2530 | 2530 | if (r) { |
| 2531 | 2531 | DRM_ERROR("r600 startup failed on resume\n"); |
| 2532 | + rdev->accel_working = false; | |
| 2532 | 2533 | return r; |
| 2533 | 2534 | } |
| 2534 | 2535 | |
| @@ -2931,6 +2931,20 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector, · 2930 unmodified lines | ||
| 2931 | 2931 | bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP5; |
| 2932 | 2932 | } |
| 2933 | 2933 | } |
| 2934 | + if ((radeon_encoder->devices & ATOM_DEVICE_DFP6_SUPPORT) && | |
| 2935 | + (radeon_connector->devices & ATOM_DEVICE_DFP6_SUPPORT)) { | |
| 2936 | + if (connected) { | |
| 2937 | + DRM_DEBUG_KMS("DFP6 connected\n"); | |
| 2938 | + bios_0_scratch |= ATOM_S0_DFP6; | |
| 2939 | + bios_3_scratch |= ATOM_S3_DFP6_ACTIVE; | |
| 2940 | + bios_6_scratch |= ATOM_S6_ACC_REQ_DFP6; | |
| 2941 | + } else { | |
| 2942 | + DRM_DEBUG_KMS("DFP6 disconnected\n"); | |
| 2943 | + bios_0_scratch &= ~ATOM_S0_DFP6; | |
| 2944 | + bios_3_scratch &= ~ATOM_S3_DFP6_ACTIVE; | |
| 2945 | + bios_6_scratch &= ~ATOM_S6_ACC_REQ_DFP6; | |
| 2946 | + } | |
| 2947 | + } | |
| 2934 | 2948 | |
| 2935 | 2949 | if (rdev->family >= CHIP_R600) { |
| 2936 | 2950 | WREG32(R600_BIOS_0_SCRATCH, bios_0_scratch); |
| @@ -2951,6 +2965,9 @@ radeon_atombios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc) · 14 unmodified lines | ||
| 2951 | 2965 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 2952 | 2966 | uint32_t bios_3_scratch; |
| 2953 | 2967 | |
| 2968 | + if (ASIC_IS_DCE4(rdev)) | |
| 2969 | + return; | |
| 2970 | + | |
| 2954 | 2971 | if (rdev->family >= CHIP_R600) |
| 2955 | 2972 | bios_3_scratch = RREG32(R600_BIOS_3_SCRATCH); |
| 2956 | 2973 | else |
| @@ -3003,6 +3020,9 @@ radeon_atombios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on) · 46 unmodified lines | ||
| 3003 | 3020 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 3004 | 3021 | uint32_t bios_2_scratch; |
| 3005 | 3022 | |
| 3023 | + if (ASIC_IS_DCE4(rdev)) | |
| 3024 | + return; | |
| 3025 | + | |
| 3006 | 3026 | if (rdev->family >= CHIP_R600) |
| 3007 | 3027 | bios_2_scratch = RREG32(R600_BIOS_2_SCRATCH); |
| 3008 | 3028 | else |
| @@ -453,6 +453,10 @@ int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 452 unmodified lines | ||
| 453 | 453 | int r; |
| 454 | 454 | |
| 455 | 455 | radeon_mutex_lock(&rdev->cs_mutex); |
| 456 | + if (!rdev->accel_working) { | |
| 457 | + radeon_mutex_unlock(&rdev->cs_mutex); | |
| 458 | + return -EBUSY; | |
| 459 | + } | |
| 456 | 460 | /* initialize parser */ |
| 457 | 461 | memset(&parser, 0, sizeof(struct radeon_cs_parser)); |
| 458 | 462 | parser.filp = filp; |
| @@ -364,8 +364,10 @@ int radeon_fence_count_emitted(struct radeon_device *rdev, int ring) · 363 unmodified lines | ||
| 364 | 364 | int not_processed = 0; |
| 365 | 365 | |
| 366 | 366 | read_lock_irqsave(&rdev->fence_lock, irq_flags); |
| 367 | − if (!rdev->fence_drv[ring].initialized) | |
| 367 | + if (!rdev->fence_drv[ring].initialized) { | |
| 368 | + read_unlock_irqrestore(&rdev->fence_lock, irq_flags); | |
| 368 | 369 | return 0; |
| 370 | + } | |
| 369 | 371 | |
| 370 | 372 | if (!list_empty(&rdev->fence_drv[ring].emitted)) { |
| 371 | 373 | struct list_head *ptr; |
| @@ -500,8 +500,11 @@ static char radeon_debugfs_ib_names[RADEON_IB_POOL_SIZE][32]; · 499 unmodified lines | ||
| 500 | 500 | int radeon_debugfs_ring_init(struct radeon_device *rdev) |
| 501 | 501 | { |
| 502 | 502 | #if defined(CONFIG_DEBUG_FS) |
| 503 | − return radeon_debugfs_add_files(rdev, radeon_debugfs_ring_info_list, | |
| 504 | − ARRAY_SIZE(radeon_debugfs_ring_info_list)); | |
| 503 | + if (rdev->family >= CHIP_CAYMAN) | |
| 504 | + return radeon_debugfs_add_files(rdev, radeon_debugfs_ring_info_list, | |
| 505 | + ARRAY_SIZE(radeon_debugfs_ring_info_list)); | |
| 506 | + else | |
| 507 | + return radeon_debugfs_add_files(rdev, radeon_debugfs_ring_info_list, 1); | |
| 505 | 508 | #else |
| 506 | 509 | return 0; |
| 507 | 510 | #endif |
| @@ -442,6 +442,8 @@ static int rs400_startup(struct radeon_device *rdev) · 441 unmodified lines | ||
| 442 | 442 | |
| 443 | 443 | int rs400_resume(struct radeon_device *rdev) |
| 444 | 444 | { |
| 445 | + int r; | |
| 446 | + | |
| 445 | 447 | /* Make sur GART are not working */ |
| 446 | 448 | rs400_gart_disable(rdev); |
| 447 | 449 | /* Resume clock before doing reset */ |
| @@ -462,7 +464,11 @@ int rs400_resume(struct radeon_device *rdev) · 14 unmodified lines | ||
| 462 | 464 | radeon_surface_init(rdev); |
| 463 | 465 | |
| 464 | 466 | rdev->accel_working = true; |
| 465 | − return rs400_startup(rdev); | |
| 467 | + r = rs400_startup(rdev); | |
| 468 | + if (r) { | |
| 469 | + rdev->accel_working = false; | |
| 470 | + } | |
| 471 | + return r; | |
| 466 | 472 | } |
| 467 | 473 | |
| 468 | 474 | int rs400_suspend(struct radeon_device *rdev) |
| @@ -684,9 +684,7 @@ int rs600_irq_process(struct radeon_device *rdev) · 683 unmodified lines | ||
| 684 | 684 | WREG32(RADEON_BUS_CNTL, msi_rearm | RS600_MSI_REARM); |
| 685 | 685 | break; |
| 686 | 686 | default: |
| 687 | − msi_rearm = RREG32(RADEON_MSI_REARM_EN) & ~RV370_MSI_REARM_EN; | |
| 688 | − WREG32(RADEON_MSI_REARM_EN, msi_rearm); | |
| 689 | − WREG32(RADEON_MSI_REARM_EN, msi_rearm | RV370_MSI_REARM_EN); | |
| 687 | + WREG32(RADEON_MSI_REARM_EN, RV370_MSI_REARM_EN); | |
| 690 | 688 | break; |
| 691 | 689 | } |
| 692 | 690 | } |
| @@ -878,6 +876,8 @@ static int rs600_startup(struct radeon_device *rdev) · 185 unmodified lines | ||
| 878 | 876 | |
| 879 | 877 | int rs600_resume(struct radeon_device *rdev) |
| 880 | 878 | { |
| 879 | + int r; | |
| 880 | + | |
| 881 | 881 | /* Make sur GART are not working */ |
| 882 | 882 | rs600_gart_disable(rdev); |
| 883 | 883 | /* Resume clock before doing reset */ |
| @@ -896,7 +896,11 @@ int rs600_resume(struct radeon_device *rdev) · 12 unmodified lines | ||
| 896 | 896 | radeon_surface_init(rdev); |
| 897 | 897 | |
| 898 | 898 | rdev->accel_working = true; |
| 899 | − return rs600_startup(rdev); | |
| 899 | + r = rs600_startup(rdev); | |
| 900 | + if (r) { | |
| 901 | + rdev->accel_working = false; | |
| 902 | + } | |
| 903 | + return r; | |
| 900 | 904 | } |
| 901 | 905 | |
| 902 | 906 | int rs600_suspend(struct radeon_device *rdev) |
| @@ -659,6 +659,8 @@ static int rs690_startup(struct radeon_device *rdev) · 658 unmodified lines | ||
| 659 | 659 | |
| 660 | 660 | int rs690_resume(struct radeon_device *rdev) |
| 661 | 661 | { |
| 662 | + int r; | |
| 663 | + | |
| 662 | 664 | /* Make sur GART are not working */ |
| 663 | 665 | rs400_gart_disable(rdev); |
| 664 | 666 | /* Resume clock before doing reset */ |
| @@ -677,7 +679,11 @@ int rs690_resume(struct radeon_device *rdev) · 12 unmodified lines | ||
| 677 | 679 | radeon_surface_init(rdev); |
| 678 | 680 | |
| 679 | 681 | rdev->accel_working = true; |
| 680 | − return rs690_startup(rdev); | |
| 682 | + r = rs690_startup(rdev); | |
| 683 | + if (r) { | |
| 684 | + rdev->accel_working = false; | |
| 685 | + } | |
| 686 | + return r; | |
| 681 | 687 | } |
| 682 | 688 | |
| 683 | 689 | int rs690_suspend(struct radeon_device *rdev) |
| @@ -424,6 +424,8 @@ static int rv515_startup(struct radeon_device *rdev) · 423 unmodified lines | ||
| 424 | 424 | |
| 425 | 425 | int rv515_resume(struct radeon_device *rdev) |
| 426 | 426 | { |
| 427 | + int r; | |
| 428 | + | |
| 427 | 429 | /* Make sur GART are not working */ |
| 428 | 430 | if (rdev->flags & RADEON_IS_PCIE) |
| 429 | 431 | rv370_pcie_gart_disable(rdev); |
| @@ -443,7 +445,11 @@ int rv515_resume(struct radeon_device *rdev) · 13 unmodified lines | ||
| 443 | 445 | radeon_surface_init(rdev); |
| 444 | 446 | |
| 445 | 447 | rdev->accel_working = true; |
| 446 | − return rv515_startup(rdev); | |
| 448 | + r = rv515_startup(rdev); | |
| 449 | + if (r) { | |
| 450 | + rdev->accel_working = false; | |
| 451 | + } | |
| 452 | + return r; | |
| 447 | 453 | } |
| 448 | 454 | |
| 449 | 455 | int rv515_suspend(struct radeon_device *rdev) |
| @@ -1139,6 +1139,7 @@ int rv770_resume(struct radeon_device *rdev) · 1138 unmodified lines | ||
| 1139 | 1139 | r = rv770_startup(rdev); |
| 1140 | 1140 | if (r) { |
| 1141 | 1141 | DRM_ERROR("r600 startup failed on resume\n"); |
| 1142 | + rdev->accel_working = false; | |
| 1142 | 1143 | return r; |
| 1143 | 1144 | } |
| 1144 | 1145 | |
| @@ -548,6 +548,7 @@ static int mousevsc_remove(struct hv_device *dev) · 547 unmodified lines | ||
| 548 | 548 | struct mousevsc_dev *input_dev = hv_get_drvdata(dev); |
| 549 | 549 | |
| 550 | 550 | vmbus_close(dev->channel); |
| 551 | + hid_hw_stop(input_dev->hid_device); | |
| 551 | 552 | hid_destroy_device(input_dev->hid_device); |
| 552 | 553 | mousevsc_free_device(input_dev); |
| 553 | 554 | |
| @@ -531,7 +531,6 @@ static int wacom_probe(struct hid_device *hdev, · 530 unmodified lines | ||
| 531 | 531 | wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY; |
| 532 | 532 | wdata->battery.use_for_apm = 0; |
| 533 | 533 | |
| 534 | − power_supply_powers(&wdata->battery, &hdev->dev); | |
| 535 | 534 | |
| 536 | 535 | ret = power_supply_register(&hdev->dev, &wdata->battery); |
| 537 | 536 | if (ret) { |
| @@ -540,6 +539,8 @@ static int wacom_probe(struct hid_device *hdev, · 2 unmodified lines | ||
| 540 | 539 | goto err_battery; |
| 541 | 540 | } |
| 542 | 541 | |
| 542 | + power_supply_powers(&wdata->battery, &hdev->dev); | |
| 543 | + | |
| 543 | 544 | wdata->ac.properties = wacom_ac_props; |
| 544 | 545 | wdata->ac.num_properties = ARRAY_SIZE(wacom_ac_props); |
| 545 | 546 | wdata->ac.get_property = wacom_ac_get_property; |
| @@ -547,14 +548,14 @@ static int wacom_probe(struct hid_device *hdev, · 1 unmodified line | ||
| 547 | 548 | wdata->ac.type = POWER_SUPPLY_TYPE_MAINS; |
| 548 | 549 | wdata->ac.use_for_apm = 0; |
| 549 | 550 | |
| 550 | − power_supply_powers(&wdata->battery, &hdev->dev); | |
| 551 | − | |
| 552 | 551 | ret = power_supply_register(&hdev->dev, &wdata->ac); |
| 553 | 552 | if (ret) { |
| 554 | 553 | hid_warn(hdev, |
| 555 | 554 | "can't create ac battery attribute, err: %d\n", ret); |
| 556 | 555 | goto err_ac; |
| 557 | 556 | } |
| 557 | + | |
| 558 | + power_supply_powers(&wdata->ac, &hdev->dev); | |
| 558 | 559 | #endif |
| 559 | 560 | return 0; |
| 560 | 561 | |
| @@ -1226,14 +1226,14 @@ static int wiimote_hid_probe(struct hid_device *hdev, · 1225 unmodified lines | ||
| 1226 | 1226 | wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY; |
| 1227 | 1227 | wdata->battery.use_for_apm = 0; |
| 1228 | 1228 | |
| 1229 | − power_supply_powers(&wdata->battery, &hdev->dev); | |
| 1230 | − | |
| 1231 | 1229 | ret = power_supply_register(&wdata->hdev->dev, &wdata->battery); |
| 1232 | 1230 | if (ret) { |
| 1233 | 1231 | hid_err(hdev, "Cannot register battery device\n"); |
| 1234 | 1232 | goto err_battery; |
| 1235 | 1233 | } |
| 1236 | 1234 | |
| 1235 | + power_supply_powers(&wdata->battery, &hdev->dev); | |
| 1236 | + | |
| 1237 | 1237 | ret = wiimote_leds_create(wdata); |
| 1238 | 1238 | if (ret) |
| 1239 | 1239 | goto err_free; |
| @@ -922,11 +922,11 @@ void hiddev_disconnect(struct hid_device *hid) · 921 unmodified lines | ||
| 922 | 922 | struct hiddev *hiddev = hid->hiddev; |
| 923 | 923 | struct usbhid_device *usbhid = hid->driver_data; |
| 924 | 924 | |
| 925 | + usb_deregister_dev(usbhid->intf, &hiddev_class); | |
| 926 | + | |
| 925 | 927 | mutex_lock(&hiddev->existancelock); |
| 926 | 928 | hiddev->exist = 0; |
| 927 | 929 | |
| 928 | − usb_deregister_dev(usbhid->intf, &hiddev_class); | |
| 929 | − | |
| 930 | 930 | if (hiddev->open) { |
| 931 | 931 | mutex_unlock(&hiddev->existancelock); |
| 932 | 932 | usbhid_close(hiddev->hid); |
| @@ -271,7 +271,7 @@ static int ads1015_probe(struct i2c_client *client, · 270 unmodified lines | ||
| 271 | 271 | continue; |
| 272 | 272 | err = device_create_file(&client->dev, &ads1015_in[k].dev_attr); |
| 273 | 273 | if (err) |
| 274 | − goto exit_free; | |
| 274 | + goto exit_remove; | |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | data->hwmon_dev = hwmon_device_register(&client->dev); |
| @@ -285,7 +285,6 @@ static int ads1015_probe(struct i2c_client *client, · 7 unmodified lines | ||
| 285 | 285 | exit_remove: |
| 286 | 286 | for (k = 0; k < ADS1015_CHANNELS; ++k) |
| 287 | 287 | device_remove_file(&client->dev, &ads1015_in[k].dev_attr); |
| 288 | −exit_free: | |
| 289 | 288 | kfree(data); |
| 290 | 289 | exit: |
| 291 | 290 | return err; |
| @@ -172,7 +172,7 @@ static inline void f75375_write8(struct i2c_client *client, u8 reg, · 171 unmodified lines | ||
| 172 | 172 | static inline void f75375_write16(struct i2c_client *client, u8 reg, |
| 173 | 173 | u16 value) |
| 174 | 174 | { |
| 175 | − int err = i2c_smbus_write_byte_data(client, reg, (value << 8)); | |
| 175 | + int err = i2c_smbus_write_byte_data(client, reg, (value >> 8)); | |
| 176 | 176 | if (err) |
| 177 | 177 | return; |
| 178 | 178 | i2c_smbus_write_byte_data(client, reg + 1, (value & 0xFF)); |
| @@ -200,9 +200,6 @@ static struct f75375_data *f75375_update_device(struct device *dev) · 21 unmodified lines | ||
| 200 | 200 | f75375_read16(client, F75375_REG_FAN_MIN(nr)); |
| 201 | 201 | data->fan_target[nr] = |
| 202 | 202 | f75375_read16(client, F75375_REG_FAN_EXP(nr)); |
| 203 | − data->pwm[nr] = f75375_read8(client, | |
| 204 | − F75375_REG_FAN_PWM_DUTY(nr)); | |
| 205 | − | |
| 206 | 203 | } |
| 207 | 204 | for (nr = 0; nr < 4; nr++) { |
| 208 | 205 | data->in_max[nr] = |
| @@ -218,6 +215,8 @@ static struct f75375_data *f75375_update_device(struct device *dev) · 9 unmodified lines | ||
| 218 | 215 | if (time_after(jiffies, data->last_updated + 2 * HZ) |
| 219 | 216 | || !data->valid) { |
| 220 | 217 | for (nr = 0; nr < 2; nr++) { |
| 218 | + data->pwm[nr] = f75375_read8(client, | |
| 219 | + F75375_REG_FAN_PWM_DUTY(nr)); | |
| 221 | 220 | /* assign MSB, therefore shift it by 8 bits */ |
| 222 | 221 | data->temp11[nr] = |
| 223 | 222 | f75375_read8(client, F75375_REG_TEMP(nr)) << 8; |
| @@ -341,8 +340,6 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) · 117 unmodified lines | ||
| 341 | 340 | fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); |
| 342 | 341 | fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); |
| 343 | 342 | data->pwm[nr] = 255; |
| 344 | − f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), | |
| 345 | − data->pwm[nr]); | |
| 346 | 343 | break; |
| 347 | 344 | case 1: /* PWM */ |
| 348 | 345 | fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); |
| @@ -362,14 +359,12 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) · 13 unmodified lines | ||
| 362 | 359 | case 0: /* full speed */ |
| 363 | 360 | fanmode |= (3 << FAN_CTRL_MODE(nr)); |
| 364 | 361 | data->pwm[nr] = 255; |
| 365 | − f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), | |
| 366 | − data->pwm[nr]); | |
| 367 | 362 | break; |
| 368 | 363 | case 1: /* PWM */ |
| 369 | 364 | fanmode |= (3 << FAN_CTRL_MODE(nr)); |
| 370 | 365 | break; |
| 371 | 366 | case 2: /* AUTOMATIC*/ |
| 372 | − fanmode |= (2 << FAN_CTRL_MODE(nr)); | |
| 367 | + fanmode |= (1 << FAN_CTRL_MODE(nr)); | |
| 373 | 368 | break; |
| 374 | 369 | case 3: /* fan speed */ |
| 375 | 370 | break; |
| @@ -378,6 +373,9 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) · 2 unmodified lines | ||
| 378 | 373 | |
| 379 | 374 | f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); |
| 380 | 375 | data->pwm_enable[nr] = val; |
| 376 | + if (val == 0) | |
| 377 | + f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), | |
| 378 | + data->pwm[nr]); | |
| 381 | 379 | return 0; |
| 382 | 380 | } |
| 383 | 381 | |
| @@ -723,7 +721,7 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data, · 339 unmodified lines | ||
| 723 | 721 | if (data->kind == f75387) { |
| 724 | 722 | bool manu, duty; |
| 725 | 723 | |
| 726 | − if (!(conf & (1 << F75387_FAN_CTRL_LINEAR(nr)))) | |
| 724 | + if (!(mode & (1 << F75387_FAN_CTRL_LINEAR(nr)))) | |
| 727 | 725 | data->pwm_mode[nr] = 1; |
| 728 | 726 | |
| 729 | 727 | manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1); |
| @@ -72,8 +72,8 @@ static unsigned short normal_i2c[] = { 0x2c, 0x2e, 0x2f, I2C_CLIENT_END }; · 71 unmodified lines | ||
| 72 | 72 | |
| 73 | 73 | static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 }; |
| 74 | 74 | |
| 75 | −#define FAN_FROM_REG(val, div, rpm_range) ((val) == 0 ? -1 : \ | |
| 76 | − (val) == 255 ? 0 : (rpm_ranges[rpm_range] * 30) / ((div + 1) * (val))) | |
| 75 | +#define FAN_FROM_REG(val, rpm_range) ((val) == 0 || (val) == 255 ? \ | |
| 76 | + 0 : (rpm_ranges[rpm_range] * 30) / (val)) | |
| 77 | 77 | #define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT((val) / 1000, 0, 255) |
| 78 | 78 | |
| 79 | 79 | /* |
| @@ -333,7 +333,7 @@ static ssize_t show_fan_input(struct device *dev, · 253 unmodified lines | ||
| 333 | 333 | return PTR_ERR(data); |
| 334 | 334 | |
| 335 | 335 | return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[attr->index], |
| 336 | − data->ppr, data->rpm_range)); | |
| 336 | + data->rpm_range)); | |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | static ssize_t show_alarm(struct device *dev, |
| @@ -429,9 +429,9 @@ static int max6639_init_client(struct i2c_client *client) · 89 unmodified lines | ||
| 429 | 429 | struct max6639_data *data = i2c_get_clientdata(client); |
| 430 | 430 | struct max6639_platform_data *max6639_info = |
| 431 | 431 | client->dev.platform_data; |
| 432 | − int i = 0; | |
| 432 | + int i; | |
| 433 | 433 | int rpm_range = 1; /* default: 4000 RPM */ |
| 434 | − int err = 0; | |
| 434 | + int err; | |
| 435 | 435 | |
| 436 | 436 | /* Reset chip to default values, see below for GCONFIG setup */ |
| 437 | 437 | err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG, |
| @@ -446,11 +446,6 @@ static int max6639_init_client(struct i2c_client *client) · 8 unmodified lines | ||
| 446 | 446 | else |
| 447 | 447 | data->ppr = 2; |
| 448 | 448 | data->ppr -= 1; |
| 449 | − err = i2c_smbus_write_byte_data(client, | |
| 450 | − MAX6639_REG_FAN_PPR(i), | |
| 451 | − data->ppr << 5); | |
| 452 | − if (err) | |
| 453 | − goto exit; | |
| 454 | 449 | |
| 455 | 450 | if (max6639_info) |
| 456 | 451 | rpm_range = rpm_range_to_reg(max6639_info->rpm_range); |
| @@ -458,6 +453,13 @@ static int max6639_init_client(struct i2c_client *client) · 1 unmodified line | ||
| 458 | 453 | |
| 459 | 454 | for (i = 0; i < 2; i++) { |
| 460 | 455 | |
| 456 | + /* Set Fan pulse per revolution */ | |
| 457 | + err = i2c_smbus_write_byte_data(client, | |
| 458 | + MAX6639_REG_FAN_PPR(i), | |
| 459 | + data->ppr << 6); | |
| 460 | + if (err) | |
| 461 | + goto exit; | |
| 462 | + | |
| 461 | 463 | /* Fans config PWM, RPM */ |
| 462 | 464 | err = i2c_smbus_write_byte_data(client, |
| 463 | 465 | MAX6639_REG_FAN_CONFIG1(i), |
| @@ -82,7 +82,7 @@ static int max34440_write_word_data(struct i2c_client *client, int page, · 81 unmodified lines | ||
| 82 | 82 | case PMBUS_VIRT_RESET_TEMP_HISTORY: |
| 83 | 83 | ret = pmbus_write_word_data(client, page, |
| 84 | 84 | MAX34440_MFR_TEMPERATURE_PEAK, |
| 85 | − 0xffff); | |
| 85 | + 0x8000); | |
| 86 | 86 | break; |
| 87 | 87 | default: |
| 88 | 88 | ret = -ENODATA; |
| @@ -1920,9 +1920,26 @@ w83627ehf_check_fan_inputs(const struct w83627ehf_sio_data *sio_data, · 1919 unmodified lines | ||
| 1920 | 1920 | fan4min = 0; |
| 1921 | 1921 | fan5pin = 0; |
| 1922 | 1922 | } else if (sio_data->kind == nct6776) { |
| 1923 | − fan3pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x40); | |
| 1924 | − fan4pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x01); | |
| 1925 | − fan5pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x02); | |
| 1923 | + bool gpok = superio_inb(sio_data->sioreg, 0x27) & 0x80; | |
| 1924 | + | |
| 1925 | + superio_select(sio_data->sioreg, W83627EHF_LD_HWM); | |
| 1926 | + regval = superio_inb(sio_data->sioreg, SIO_REG_ENABLE); | |
| 1927 | + | |
| 1928 | + if (regval & 0x80) | |
| 1929 | + fan3pin = gpok; | |
| 1930 | + else | |
| 1931 | + fan3pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x40); | |
| 1932 | + | |
| 1933 | + if (regval & 0x40) | |
| 1934 | + fan4pin = gpok; | |
| 1935 | + else | |
| 1936 | + fan4pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x01); | |
| 1937 | + | |
| 1938 | + if (regval & 0x20) | |
| 1939 | + fan5pin = gpok; | |
| 1940 | + else | |
| 1941 | + fan5pin = !!(superio_inb(sio_data->sioreg, 0x1C) & 0x02); | |
| 1942 | + | |
| 1926 | 1943 | fan4min = fan4pin; |
| 1927 | 1944 | } else if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) { |
| 1928 | 1945 | fan3pin = 1; |
| @@ -2332,11 +2349,6 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) · 403 unmodified lines | ||
| 2332 | 2349 | /* Read fan clock dividers immediately */ |
| 2333 | 2350 | w83627ehf_update_fan_div_common(dev, data); |
| 2334 | 2351 | |
| 2335 | − /* Read pwm data to save original values */ | |
| 2336 | − w83627ehf_update_pwm_common(dev, data); | |
| 2337 | − for (i = 0; i < data->pwm_num; i++) | |
| 2338 | − data->pwm_enable_orig[i] = data->pwm_enable[i]; | |
| 2339 | − | |
| 2340 | 2352 | /* Read pwm data to save original values */ |
| 2341 | 2353 | w83627ehf_update_pwm_common(dev, data); |
| 2342 | 2354 | for (i = 0; i < data->pwm_num; i++) |
| @@ -1018,7 +1018,7 @@ omap_i2c_probe(struct platform_device *pdev) · 1017 unmodified lines | ||
| 1018 | 1018 | goto err_release_region; |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | − match = of_match_device(omap_i2c_of_match, &pdev->dev); | |
| 1021 | + match = of_match_device(of_match_ptr(omap_i2c_of_match), &pdev->dev); | |
| 1022 | 1022 | if (match) { |
| 1023 | 1023 | u32 freq = 100000; /* default to 100000 Hz */ |
| 1024 | 1024 | |
| @@ -755,7 +755,7 @@ MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); · 754 unmodified lines | ||
| 755 | 755 | |
| 756 | 756 | static struct platform_driver tegra_i2c_driver = { |
| 757 | 757 | .probe = tegra_i2c_probe, |
| 758 | − .remove = tegra_i2c_remove, | |
| 758 | + .remove = __devexit_p(tegra_i2c_remove), | |
| 759 | 759 | #ifdef CONFIG_PM |
| 760 | 760 | .suspend = tegra_i2c_suspend, |
| 761 | 761 | .resume = tegra_i2c_resume, |
| @@ -116,4 +116,3 @@ obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o · 115 unmodified lines | ||
| 116 | 116 | |
| 117 | 117 | obj-$(CONFIG_BLK_DEV_IDE_TX4938) += tx4938ide.o |
| 118 | 118 | obj-$(CONFIG_BLK_DEV_IDE_TX4939) += tx4939ide.o |
| 119 | −obj-$(CONFIG_BLK_DEV_IDE_AT91) += at91_ide.o | |
| @@ -1,366 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * IDE host driver for AT91 (SAM9, CAP9, AT572D940HF) Static Memory Controller | |
| 3 | − * with Compact Flash True IDE logic | |
| 4 | − * | |
| 5 | − * Copyright (c) 2008, 2009 Kelvatek Ltd. | |
| 6 | − * | |
| 7 | − * This program is free software; you can redistribute it and/or modify | |
| 8 | − * it under the terms of the GNU General Public License as published by | |
| 9 | − * the Free Software Foundation; either version 2 of the License, or | |
| 10 | − * (at your option) any later version. | |
| 11 | − * | |
| 12 | − * This program is distributed in the hope that it will be useful, | |
| 13 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 | − * GNU General Public License for more details. | |
| 16 | − * | |
| 17 | − * You should have received a copy of the GNU General Public License | |
| 18 | − * along with this program; if not, write to the Free Software | |
| 19 | − * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 20 | − * | |
| 21 | − */ | |
| 22 | − | |
| 23 | −#include <linux/kernel.h> | |
| 24 | −#include <linux/module.h> | |
| 25 | −#include <linux/clk.h> | |
| 26 | −#include <linux/err.h> | |
| 27 | −#include <linux/ide.h> | |
| 28 | −#include <linux/platform_device.h> | |
| 29 | − | |
| 30 | −#include <mach/board.h> | |
| 31 | −#include <asm/gpio.h> | |
| 32 | −#include <mach/at91sam9_smc.h> | |
| 33 | − | |
| 34 | −#define DRV_NAME "at91_ide" | |
| 35 | − | |
| 36 | −#define perr(fmt, args...) pr_err(DRV_NAME ": " fmt, ##args) | |
| 37 | −#define pdbg(fmt, args...) pr_debug("%s " fmt, __func__, ##args) | |
| 38 | − | |
| 39 | −/* | |
| 40 | − * Access to IDE device is possible through EBI Static Memory Controller | |
| 41 | − * with Compact Flash logic. For details see EBI and SMC datasheet sections | |
| 42 | − * of any microcontroller from AT91SAM9 family. | |
| 43 | − * | |
| 44 | − * Within SMC chip select address space, lines A[23:21] distinguish Compact | |
| 45 | − * Flash modes (I/O, common memory, attribute memory, True IDE). IDE modes are: | |
| 46 | − * 0x00c0000 - True IDE | |
| 47 | − * 0x00e0000 - Alternate True IDE (Alt Status Register) | |
| 48 | − * | |
| 49 | − * On True IDE mode Task File and Data Register are mapped at the same address. | |
| 50 | − * To distinguish access between these two different bus data width is used: | |
| 51 | − * 8Bit for Task File, 16Bit for Data I/O. | |
| 52 | − * | |
| 53 | − * After initialization we do 8/16 bit flipping (changes in SMC MODE register) | |
| 54 | − * only inside IDE callback routines which are serialized by IDE layer, | |
| 55 | − * so no additional locking needed. | |
| 56 | − */ | |
| 57 | − | |
| 58 | −#define TASK_FILE 0x00c00000 | |
| 59 | −#define ALT_MODE 0x00e00000 | |
| 60 | −#define REGS_SIZE 8 | |
| 61 | − | |
| 62 | −#define enter_16bit(cs, mode) do { \ | |
| 63 | − mode = at91_sys_read(AT91_SMC_MODE(cs)); \ | |
| 64 | − at91_sys_write(AT91_SMC_MODE(cs), mode | AT91_SMC_DBW_16); \ | |
| 65 | −} while (0) | |
| 66 | − | |
| 67 | −#define leave_16bit(cs, mode) at91_sys_write(AT91_SMC_MODE(cs), mode); | |
| 68 | − | |
| 69 | −static void set_smc_timings(const u8 chipselect, const u16 cycle, | |
| 70 | − const u16 setup, const u16 pulse, | |
| 71 | − const u16 data_float, int use_iordy) | |
| 72 | −{ | |
| 73 | − unsigned long mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | | |
| 74 | − AT91_SMC_BAT_SELECT; | |
| 75 | − | |
| 76 | − /* disable or enable waiting for IORDY signal */ | |
| 77 | − if (use_iordy) | |
| 78 | − mode |= AT91_SMC_EXNWMODE_READY; | |
| 79 | − | |
| 80 | − /* add data float cycles if needed */ | |
| 81 | − if (data_float) | |
| 82 | − mode |= AT91_SMC_TDF_(data_float); | |
| 83 | − | |
| 84 | − at91_sys_write(AT91_SMC_MODE(chipselect), mode); | |
| 85 | − | |
| 86 | − /* setup timings in SMC */ | |
| 87 | − at91_sys_write(AT91_SMC_SETUP(chipselect), AT91_SMC_NWESETUP_(setup) | | |
| 88 | − AT91_SMC_NCS_WRSETUP_(0) | | |
| 89 | − AT91_SMC_NRDSETUP_(setup) | | |
| 90 | − AT91_SMC_NCS_RDSETUP_(0)); | |
| 91 | − at91_sys_write(AT91_SMC_PULSE(chipselect), AT91_SMC_NWEPULSE_(pulse) | | |
| 92 | − AT91_SMC_NCS_WRPULSE_(cycle) | | |
| 93 | − AT91_SMC_NRDPULSE_(pulse) | | |
| 94 | − AT91_SMC_NCS_RDPULSE_(cycle)); | |
| 95 | − at91_sys_write(AT91_SMC_CYCLE(chipselect), AT91_SMC_NWECYCLE_(cycle) | | |
| 96 | − AT91_SMC_NRDCYCLE_(cycle)); | |
| 97 | −} | |
| 98 | − | |
| 99 | −static unsigned int calc_mck_cycles(unsigned int ns, unsigned int mck_hz) | |
| 100 | −{ | |
| 101 | − u64 tmp = ns; | |
| 102 | − | |
| 103 | − tmp *= mck_hz; | |
| 104 | − tmp += 1000*1000*1000 - 1; /* round up */ | |
| 105 | − do_div(tmp, 1000*1000*1000); | |
| 106 | − return (unsigned int) tmp; | |
| 107 | −} | |
| 108 | − | |
| 109 | −static void apply_timings(const u8 chipselect, const u8 pio, | |
| 110 | − const struct ide_timing *timing, int use_iordy) | |
| 111 | −{ | |
| 112 | − unsigned int t0, t1, t2, t6z; | |
| 113 | − unsigned int cycle, setup, pulse, data_float; | |
| 114 | − unsigned int mck_hz; | |
| 115 | − struct clk *mck; | |
| 116 | − | |
| 117 | − /* see table 22 of Compact Flash standard 4.1 for the meaning, | |
| 118 | − * we do not stretch active (t2) time, so setup (t1) + hold time (th) | |
| 119 | − * assure at least minimal recovery (t2i) time */ | |
| 120 | − t0 = timing->cyc8b; | |
| 121 | − t1 = timing->setup; | |
| 122 | − t2 = timing->act8b; | |
| 123 | − t6z = (pio < 5) ? 30 : 20; | |
| 124 | − | |
| 125 | − pdbg("t0=%u t1=%u t2=%u t6z=%u\n", t0, t1, t2, t6z); | |
| 126 | − | |
| 127 | − mck = clk_get(NULL, "mck"); | |
| 128 | − BUG_ON(IS_ERR(mck)); | |
| 129 | − mck_hz = clk_get_rate(mck); | |
| 130 | − pdbg("mck_hz=%u\n", mck_hz); | |
| 131 | − | |
| 132 | − cycle = calc_mck_cycles(t0, mck_hz); | |
| 133 | − setup = calc_mck_cycles(t1, mck_hz); | |
| 134 | − pulse = calc_mck_cycles(t2, mck_hz); | |
| 135 | − data_float = calc_mck_cycles(t6z, mck_hz); | |
| 136 | − | |
| 137 | − pdbg("cycle=%u setup=%u pulse=%u data_float=%u\n", | |
| 138 | − cycle, setup, pulse, data_float); | |
| 139 | − | |
| 140 | − set_smc_timings(chipselect, cycle, setup, pulse, data_float, use_iordy); | |
| 141 | −} | |
| 142 | − | |
| 143 | −static void at91_ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, | |
| 144 | − void *buf, unsigned int len) | |
| 145 | −{ | |
| 146 | − ide_hwif_t *hwif = drive->hwif; | |
| 147 | − struct ide_io_ports *io_ports = &hwif->io_ports; | |
| 148 | − u8 chipselect = hwif->select_data; | |
| 149 | − unsigned long mode; | |
| 150 | − | |
| 151 | − pdbg("cs %u buf %p len %d\n", chipselect, buf, len); | |
| 152 | − | |
| 153 | − len++; | |
| 154 | − | |
| 155 | − enter_16bit(chipselect, mode); | |
| 156 | − readsw((void __iomem *)io_ports->data_addr, buf, len / 2); | |
| 157 | − leave_16bit(chipselect, mode); | |
| 158 | −} | |
| 159 | − | |
| 160 | −static void at91_ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, | |
| 161 | − void *buf, unsigned int len) | |
| 162 | −{ | |
| 163 | − ide_hwif_t *hwif = drive->hwif; | |
| 164 | − struct ide_io_ports *io_ports = &hwif->io_ports; | |
| 165 | − u8 chipselect = hwif->select_data; | |
| 166 | − unsigned long mode; | |
| 167 | − | |
| 168 | − pdbg("cs %u buf %p len %d\n", chipselect, buf, len); | |
| 169 | − | |
| 170 | − enter_16bit(chipselect, mode); | |
| 171 | − writesw((void __iomem *)io_ports->data_addr, buf, len / 2); | |
| 172 | − leave_16bit(chipselect, mode); | |
| 173 | −} | |
| 174 | − | |
| 175 | −static void at91_ide_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |
| 176 | −{ | |
| 177 | − struct ide_timing *timing; | |
| 178 | − u8 chipselect = hwif->select_data; | |
| 179 | − int use_iordy = 0; | |
| 180 | − const u8 pio = drive->pio_mode - XFER_PIO_0; | |
| 181 | − | |
| 182 | − pdbg("chipselect %u pio %u\n", chipselect, pio); | |
| 183 | − | |
| 184 | − timing = ide_timing_find_mode(XFER_PIO_0 + pio); | |
| 185 | − BUG_ON(!timing); | |
| 186 | − | |
| 187 | − if (ide_pio_need_iordy(drive, pio)) | |
| 188 | − use_iordy = 1; | |
| 189 | − | |
| 190 | − apply_timings(chipselect, pio, timing, use_iordy); | |
| 191 | −} | |
| 192 | − | |
| 193 | −static const struct ide_tp_ops at91_ide_tp_ops = { | |
| 194 | − .exec_command = ide_exec_command, | |
| 195 | − .read_status = ide_read_status, | |
| 196 | − .read_altstatus = ide_read_altstatus, | |
| 197 | − .write_devctl = ide_write_devctl, | |
| 198 | − | |
| 199 | − .dev_select = ide_dev_select, | |
| 200 | − .tf_load = ide_tf_load, | |
| 201 | − .tf_read = ide_tf_read, | |
| 202 | − | |
| 203 | − .input_data = at91_ide_input_data, | |
| 204 | − .output_data = at91_ide_output_data, | |
| 205 | −}; | |
| 206 | − | |
| 207 | −static const struct ide_port_ops at91_ide_port_ops = { | |
| 208 | − .set_pio_mode = at91_ide_set_pio_mode, | |
| 209 | −}; | |
| 210 | − | |
| 211 | −static const struct ide_port_info at91_ide_port_info __initdata = { | |
| 212 | − .port_ops = &at91_ide_port_ops, | |
| 213 | − .tp_ops = &at91_ide_tp_ops, | |
| 214 | − .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA | IDE_HFLAG_SINGLE | | |
| 215 | − IDE_HFLAG_NO_IO_32BIT | IDE_HFLAG_UNMASK_IRQS, | |
| 216 | − .pio_mask = ATA_PIO6, | |
| 217 | − .chipset = ide_generic, | |
| 218 | −}; | |
| 219 | − | |
| 220 | −/* | |
| 221 | − * If interrupt is delivered through GPIO, IRQ are triggered on falling | |
| 222 | − * and rising edge of signal. Whereas IDE device request interrupt on high | |
| 223 | − * level (rising edge in our case). This mean we have fake interrupts, so | |
| 224 | − * we need to check interrupt pin and exit instantly from ISR when line | |
| 225 | − * is on low level. | |
| 226 | − */ | |
| 227 | − | |
| 228 | −irqreturn_t at91_irq_handler(int irq, void *dev_id) | |
| 229 | −{ | |
| 230 | − int ntries = 8; | |
| 231 | − int pin_val1, pin_val2; | |
| 232 | − | |
| 233 | − /* additional deglitch, line can be noisy in badly designed PCB */ | |
| 234 | − do { | |
| 235 | − pin_val1 = at91_get_gpio_value(irq); | |
| 236 | − pin_val2 = at91_get_gpio_value(irq); | |
| 237 | − } while (pin_val1 != pin_val2 && --ntries > 0); | |
| 238 | − | |
| 239 | − if (pin_val1 == 0 || ntries <= 0) | |
| 240 | − return IRQ_HANDLED; | |
| 241 | − | |
| 242 | − return ide_intr(irq, dev_id); | |
| 243 | −} | |
| 244 | − | |
| 245 | −static int __init at91_ide_probe(struct platform_device *pdev) | |
| 246 | −{ | |
| 247 | − int ret; | |
| 248 | − struct ide_hw hw, *hws[] = { &hw }; | |
| 249 | − struct ide_host *host; | |
| 250 | − struct resource *res; | |
| 251 | − unsigned long tf_base = 0, ctl_base = 0; | |
| 252 | − struct at91_cf_data *board = pdev->dev.platform_data; | |
| 253 | − | |
| 254 | − if (!board) | |
| 255 | − return -ENODEV; | |
| 256 | − | |
| 257 | − if (board->det_pin && at91_get_gpio_value(board->det_pin) != 0) { | |
| 258 | − perr("no device detected\n"); | |
| 259 | − return -ENODEV; | |
| 260 | − } | |
| 261 | − | |
| 262 | − res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
| 263 | − if (!res) { | |
| 264 | − perr("can't get memory resource\n"); | |
| 265 | − return -ENODEV; | |
| 266 | − } | |
| 267 | − | |
| 268 | − if (!devm_request_mem_region(&pdev->dev, res->start + TASK_FILE, | |
| 269 | − REGS_SIZE, "ide") || | |
| 270 | − !devm_request_mem_region(&pdev->dev, res->start + ALT_MODE, | |
| 271 | − REGS_SIZE, "alt")) { | |
| 272 | − perr("memory resources in use\n"); | |
| 273 | − return -EBUSY; | |
| 274 | − } | |
| 275 | − | |
| 276 | − pdbg("chipselect %u irq %u res %08lx\n", board->chipselect, | |
| 277 | − board->irq_pin, (unsigned long) res->start); | |
| 278 | − | |
| 279 | − tf_base = (unsigned long) devm_ioremap(&pdev->dev, res->start + TASK_FILE, | |
| 280 | − REGS_SIZE); | |
| 281 | − ctl_base = (unsigned long) devm_ioremap(&pdev->dev, res->start + ALT_MODE, | |
| 282 | − REGS_SIZE); | |
| 283 | − if (!tf_base || !ctl_base) { | |
| 284 | − perr("can't map memory regions\n"); | |
| 285 | − return -EBUSY; | |
| 286 | − } | |
| 287 | − | |
| 288 | − memset(&hw, 0, sizeof(hw)); | |
| 289 | − | |
| 290 | − if (board->flags & AT91_IDE_SWAP_A0_A2) { | |
| 291 | − /* workaround for stupid hardware bug */ | |
| 292 | − hw.io_ports.data_addr = tf_base + 0; | |
| 293 | − hw.io_ports.error_addr = tf_base + 4; | |
| 294 | − hw.io_ports.nsect_addr = tf_base + 2; | |
| 295 | − hw.io_ports.lbal_addr = tf_base + 6; | |
| 296 | − hw.io_ports.lbam_addr = tf_base + 1; | |
| 297 | − hw.io_ports.lbah_addr = tf_base + 5; | |
| 298 | − hw.io_ports.device_addr = tf_base + 3; | |
| 299 | − hw.io_ports.command_addr = tf_base + 7; | |
| 300 | − hw.io_ports.ctl_addr = ctl_base + 3; | |
| 301 | − } else | |
| 302 | − ide_std_init_ports(&hw, tf_base, ctl_base + 6); | |
| 303 | − | |
| 304 | − hw.irq = board->irq_pin; | |
| 305 | − hw.dev = &pdev->dev; | |
| 306 | − | |
| 307 | − host = ide_host_alloc(&at91_ide_port_info, hws, 1); | |
| 308 | − if (!host) { | |
| 309 | − perr("failed to allocate ide host\n"); | |
| 310 | − return -ENOMEM; | |
| 311 | − } | |
| 312 | − | |
| 313 | − /* setup Static Memory Controller - PIO 0 as default */ | |
| 314 | − apply_timings(board->chipselect, 0, ide_timing_find_mode(XFER_PIO_0), 0); | |
| 315 | − | |
| 316 | − /* with GPIO interrupt we have to do quirks in handler */ | |
| 317 | − if (gpio_is_valid(board->irq_pin)) | |
| 318 | − host->irq_handler = at91_irq_handler; | |
| 319 | − | |
| 320 | − host->ports[0]->select_data = board->chipselect; | |
| 321 | − | |
| 322 | − ret = ide_host_register(host, &at91_ide_port_info, hws); | |
| 323 | − if (ret) { | |
| 324 | − perr("failed to register ide host\n"); | |
| 325 | − goto err_free_host; | |
| 326 | − } | |
| 327 | − platform_set_drvdata(pdev, host); | |
| 328 | − return 0; | |
| 329 | − | |
| 330 | −err_free_host: | |
| 331 | − ide_host_free(host); | |
| 332 | − return ret; | |
| 333 | −} | |
| 334 | − | |
| 335 | −static int __exit at91_ide_remove(struct platform_device *pdev) | |
| 336 | −{ | |
| 337 | − struct ide_host *host = platform_get_drvdata(pdev); | |
| 338 | − | |
| 339 | − ide_host_remove(host); | |
| 340 | − return 0; | |
| 341 | −} | |
| 342 | − | |
| 343 | −static struct platform_driver at91_ide_driver = { | |
| 344 | − .driver = { | |
| 345 | − .name = DRV_NAME, | |
| 346 | − .owner = THIS_MODULE, | |
| 347 | − }, | |
| 348 | − .remove = __exit_p(at91_ide_remove), | |
| 349 | −}; | |
| 350 | − | |
| 351 | −static int __init at91_ide_init(void) | |
| 352 | −{ | |
| 353 | − return platform_driver_probe(&at91_ide_driver, at91_ide_probe); | |
| 354 | −} | |
| 355 | − | |
| 356 | −static void __exit at91_ide_exit(void) | |
| 357 | −{ | |
| 358 | − platform_driver_unregister(&at91_ide_driver); | |
| 359 | −} | |
| 360 | − | |
| 361 | −module_init(at91_ide_init); | |
| 362 | −module_exit(at91_ide_exit); | |
| 363 | − | |
| 364 | −MODULE_LICENSE("GPL"); | |
| 365 | −MODULE_AUTHOR("Stanislaw Gruszka <stf_xl@wp.pl>"); | |
| 366 | − | |
| @@ -44,6 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | #include <linux/mutex.h> |
| 45 | 45 | |
| 46 | 46 | #include <net/neighbour.h> |
| 47 | +#include <net/sch_generic.h> | |
| 47 | 48 | |
| 48 | 49 | #include <linux/atomic.h> |
| 49 | 50 | |
| @@ -117,8 +118,9 @@ struct ipoib_header { · 67 unmodified lines | ||
| 117 | 118 | u16 reserved; |
| 118 | 119 | }; |
| 119 | 120 | |
| 120 | −struct ipoib_pseudoheader { | |
| 121 | − u8 hwaddr[INFINIBAND_ALEN]; | |
| 121 | +struct ipoib_cb { | |
| 122 | + struct qdisc_skb_cb qdisc_cb; | |
| 123 | + u8 hwaddr[INFINIBAND_ALEN]; | |
| 122 | 124 | }; |
| 123 | 125 | |
| 124 | 126 | /* Used for all multicast joins (broadcast, IPv4 mcast and IPv6 mcast) */ |
| @@ -653,7 +653,7 @@ static void ipoib_path_lookup(struct sk_buff *skb, struct neighbour *n, struct n · 652 unmodified lines | ||
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev, |
| 656 | − struct ipoib_pseudoheader *phdr) | |
| 656 | + struct ipoib_cb *cb) | |
| 657 | 657 | { |
| 658 | 658 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
| 659 | 659 | struct ipoib_path *path; |
| @@ -661,17 +661,15 @@ static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev, · 1 unmodified line | ||
| 661 | 661 | |
| 662 | 662 | spin_lock_irqsave(&priv->lock, flags); |
| 663 | 663 | |
| 664 | − path = __path_find(dev, phdr->hwaddr + 4); | |
| 664 | + path = __path_find(dev, cb->hwaddr + 4); | |
| 665 | 665 | if (!path || !path->valid) { |
| 666 | 666 | int new_path = 0; |
| 667 | 667 | |
| 668 | 668 | if (!path) { |
| 669 | − path = path_rec_create(dev, phdr->hwaddr + 4); | |
| 669 | + path = path_rec_create(dev, cb->hwaddr + 4); | |
| 670 | 670 | new_path = 1; |
| 671 | 671 | } |
| 672 | 672 | if (path) { |
| 673 | − /* put pseudoheader back on for next time */ | |
| 674 | − skb_push(skb, sizeof *phdr); | |
| 675 | 673 | __skb_queue_tail(&path->queue, skb); |
| 676 | 674 | |
| 677 | 675 | if (!path->query && path_rec_start(dev, path)) { |
| @@ -695,12 +693,10 @@ static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev, · 17 unmodified lines | ||
| 695 | 693 | be16_to_cpu(path->pathrec.dlid)); |
| 696 | 694 | |
| 697 | 695 | spin_unlock_irqrestore(&priv->lock, flags); |
| 698 | − ipoib_send(dev, skb, path->ah, IPOIB_QPN(phdr->hwaddr)); | |
| 696 | + ipoib_send(dev, skb, path->ah, IPOIB_QPN(cb->hwaddr)); | |
| 699 | 697 | return; |
| 700 | 698 | } else if ((path->query || !path_rec_start(dev, path)) && |
| 701 | 699 | skb_queue_len(&path->queue) < IPOIB_MAX_PATH_REC_QUEUE) { |
| 702 | − /* put pseudoheader back on for next time */ | |
| 703 | − skb_push(skb, sizeof *phdr); | |
| 704 | 700 | __skb_queue_tail(&path->queue, skb); |
| 705 | 701 | } else { |
| 706 | 702 | ++dev->stats.tx_dropped; |
| @@ -774,16 +770,14 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) · 67 unmodified lines | ||
| 774 | 770 | dev_kfree_skb_any(skb); |
| 775 | 771 | } |
| 776 | 772 | } else { |
| 777 | − struct ipoib_pseudoheader *phdr = | |
| 778 | − (struct ipoib_pseudoheader *) skb->data; | |
| 779 | − skb_pull(skb, sizeof *phdr); | |
| 773 | + struct ipoib_cb *cb = (struct ipoib_cb *) skb->cb; | |
| 780 | 774 | |
| 781 | − if (phdr->hwaddr[4] == 0xff) { | |
| 775 | + if (cb->hwaddr[4] == 0xff) { | |
| 782 | 776 | /* Add in the P_Key for multicast*/ |
| 783 | − phdr->hwaddr[8] = (priv->pkey >> 8) & 0xff; | |
| 784 | − phdr->hwaddr[9] = priv->pkey & 0xff; | |
| 777 | + cb->hwaddr[8] = (priv->pkey >> 8) & 0xff; | |
| 778 | + cb->hwaddr[9] = priv->pkey & 0xff; | |
| 785 | 779 | |
| 786 | − ipoib_mcast_send(dev, phdr->hwaddr + 4, skb); | |
| 780 | + ipoib_mcast_send(dev, cb->hwaddr + 4, skb); | |
| 787 | 781 | } else { |
| 788 | 782 | /* unicast GID -- should be ARP or RARP reply */ |
| 789 | 783 | |
| @@ -792,14 +786,14 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) · 2 unmodified lines | ||
| 792 | 786 | ipoib_warn(priv, "Unicast, no %s: type %04x, QPN %06x %pI6\n", |
| 793 | 787 | skb_dst(skb) ? "neigh" : "dst", |
| 794 | 788 | be16_to_cpup((__be16 *) skb->data), |
| 795 | − IPOIB_QPN(phdr->hwaddr), | |
| 796 | − phdr->hwaddr + 4); | |
| 789 | + IPOIB_QPN(cb->hwaddr), | |
| 790 | + cb->hwaddr + 4); | |
| 797 | 791 | dev_kfree_skb_any(skb); |
| 798 | 792 | ++dev->stats.tx_dropped; |
| 799 | 793 | goto unlock; |
| 800 | 794 | } |
| 801 | 795 | |
| 802 | − unicast_arp_send(skb, dev, phdr); | |
| 796 | + unicast_arp_send(skb, dev, cb); | |
| 803 | 797 | } |
| 804 | 798 | } |
| 805 | 799 | unlock: |
| @@ -825,8 +819,6 @@ static int ipoib_hard_header(struct sk_buff *skb, · 19 unmodified lines | ||
| 825 | 819 | const void *daddr, const void *saddr, unsigned len) |
| 826 | 820 | { |
| 827 | 821 | struct ipoib_header *header; |
| 828 | − struct dst_entry *dst; | |
| 829 | − struct neighbour *n; | |
| 830 | 822 | |
| 831 | 823 | header = (struct ipoib_header *) skb_push(skb, sizeof *header); |
| 832 | 824 | |
| @@ -834,18 +826,13 @@ static int ipoib_hard_header(struct sk_buff *skb, · 1 unmodified line | ||
| 834 | 826 | header->reserved = 0; |
| 835 | 827 | |
| 836 | 828 | /* |
| 837 | − * If we don't have a neighbour structure, stuff the | |
| 838 | − * destination address onto the front of the skb so we can | |
| 839 | − * figure out where to send the packet later. | |
| 829 | + * If we don't have a dst_entry structure, stuff the | |
| 830 | + * destination address into skb->cb so we can figure out where | |
| 831 | + * to send the packet later. | |
| 840 | 832 | */ |
| 841 | − dst = skb_dst(skb); | |
| 842 | − n = NULL; | |
| 843 | − if (dst) | |
| 844 | − n = dst_get_neighbour_noref_raw(dst); | |
| 845 | − if ((!dst || !n) && daddr) { | |
| 846 | − struct ipoib_pseudoheader *phdr = | |
| 847 | − (struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr); | |
| 848 | − memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN); | |
| 833 | + if (!skb_dst(skb)) { | |
| 834 | + struct ipoib_cb *cb = (struct ipoib_cb *) skb->cb; | |
| 835 | + memcpy(cb->hwaddr, daddr, INFINIBAND_ALEN); | |
| 849 | 836 | } |
| 850 | 837 | |
| 851 | 838 | return 0; |
| @@ -1021,11 +1008,7 @@ static void ipoib_setup(struct net_device *dev) · 169 unmodified lines | ||
| 1021 | 1008 | |
| 1022 | 1009 | dev->flags |= IFF_BROADCAST | IFF_MULTICAST; |
| 1023 | 1010 | |
| 1024 | − /* | |
| 1025 | − * We add in INFINIBAND_ALEN to allow for the destination | |
| 1026 | − * address "pseudoheader" for skbs without neighbour struct. | |
| 1027 | − */ | |
| 1028 | − dev->hard_header_len = IPOIB_ENCAP_LEN + INFINIBAND_ALEN; | |
| 1011 | + dev->hard_header_len = IPOIB_ENCAP_LEN; | |
| 1029 | 1012 | dev->addr_len = INFINIBAND_ALEN; |
| 1030 | 1013 | dev->type = ARPHRD_INFINIBAND; |
| 1031 | 1014 | dev->tx_queue_len = ipoib_sendq_size * 2; |
| @@ -262,21 +262,13 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, · 261 unmodified lines | ||
| 262 | 262 | netif_tx_lock_bh(dev); |
| 263 | 263 | while (!skb_queue_empty(&mcast->pkt_queue)) { |
| 264 | 264 | struct sk_buff *skb = skb_dequeue(&mcast->pkt_queue); |
| 265 | − struct dst_entry *dst = skb_dst(skb); | |
| 266 | − struct neighbour *n = NULL; | |
| 267 | 265 | |
| 268 | 266 | netif_tx_unlock_bh(dev); |
| 269 | 267 | |
| 270 | 268 | skb->dev = dev; |
| 271 | − if (dst) | |
| 272 | − n = dst_get_neighbour_noref_raw(dst); | |
| 273 | − if (!dst || !n) { | |
| 274 | − /* put pseudoheader back on for next time */ | |
| 275 | − skb_push(skb, sizeof (struct ipoib_pseudoheader)); | |
| 276 | − } | |
| 277 | − | |
| 278 | 269 | if (dev_queue_xmit(skb)) |
| 279 | 270 | ipoib_warn(priv, "dev_queue_xmit failed to requeue packet\n"); |
| 271 | + | |
| 280 | 272 | netif_tx_lock_bh(dev); |
| 281 | 273 | } |
| 282 | 274 | netif_tx_unlock_bh(dev); |
| @@ -69,8 +69,8 @@ MODULE_LICENSE("Dual BSD/GPL"); · 68 unmodified lines | ||
| 69 | 69 | */ |
| 70 | 70 | |
| 71 | 71 | static u64 srpt_service_guid; |
| 72 | −static spinlock_t srpt_dev_lock; /* Protects srpt_dev_list. */ | |
| 73 | −static struct list_head srpt_dev_list; /* List of srpt_device structures. */ | |
| 72 | +static DEFINE_SPINLOCK(srpt_dev_lock); /* Protects srpt_dev_list. */ | |
| 73 | +static LIST_HEAD(srpt_dev_list); /* List of srpt_device structures. */ | |
| 74 | 74 | |
| 75 | 75 | static unsigned srp_max_req_size = DEFAULT_MAX_REQ_SIZE; |
| 76 | 76 | module_param(srp_max_req_size, int, 0444); |
| @@ -687,6 +687,7 @@ err: · 610 unmodified lines | ||
| 687 | 687 | while (--i >= 0) |
| 688 | 688 | srpt_free_ioctx(sdev, ring[i], dma_size, dir); |
| 689 | 689 | kfree(ring); |
| 690 | + ring = NULL; | |
| 690 | 691 | out: |
| 691 | 692 | return ring; |
| 692 | 693 | } |
| @@ -2595,7 +2596,7 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, · 1902 unmodified lines | ||
| 2595 | 2596 | } |
| 2596 | 2597 | |
| 2597 | 2598 | ch->sess = transport_init_session(); |
| 2598 | − if (!ch->sess) { | |
| 2599 | + if (IS_ERR(ch->sess)) { | |
| 2599 | 2600 | rej->reason = __constant_cpu_to_be32( |
| 2600 | 2601 | SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES); |
| 2601 | 2602 | pr_debug("Failed to create session\n"); |
| @@ -3264,8 +3265,7 @@ static void srpt_add_one(struct ib_device *device) · 662 unmodified lines | ||
| 3264 | 3265 | for (i = 0; i < sdev->srq_size; ++i) |
| 3265 | 3266 | srpt_post_recv(sdev, sdev->ioctx_ring[i]); |
| 3266 | 3267 | |
| 3267 | − WARN_ON(sdev->device->phys_port_cnt | |
| 3268 | − > sizeof(sdev->port)/sizeof(sdev->port[0])); | |
| 3268 | + WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port)); | |
| 3269 | 3269 | |
| 3270 | 3270 | for (i = 1; i <= sdev->device->phys_port_cnt; i++) { |
| 3271 | 3271 | sport = &sdev->port[i - 1]; |
| @@ -4010,13 +4010,10 @@ static int __init srpt_init_module(void) · 738 unmodified lines | ||
| 4010 | 4010 | goto out; |
| 4011 | 4011 | } |
| 4012 | 4012 | |
| 4013 | − spin_lock_init(&srpt_dev_lock); | |
| 4014 | − INIT_LIST_HEAD(&srpt_dev_list); | |
| 4015 | − | |
| 4016 | − ret = -ENODEV; | |
| 4017 | 4013 | srpt_target = target_fabric_configfs_init(THIS_MODULE, "srpt"); |
| 4018 | − if (!srpt_target) { | |
| 4014 | + if (IS_ERR(srpt_target)) { | |
| 4019 | 4015 | printk(KERN_ERR "couldn't register\n"); |
| 4016 | + ret = PTR_ERR(srpt_target); | |
| 4020 | 4017 | goto out; |
| 4021 | 4018 | } |
| 4022 | 4019 | |
| @@ -35,7 +35,6 @@ · 34 unmodified lines | ||
| 35 | 35 | #ifndef IB_SRPT_H |
| 36 | 36 | #define IB_SRPT_H |
| 37 | 37 | |
| 38 | −#include <linux/version.h> | |
| 39 | 38 | #include <linux/types.h> |
| 40 | 39 | #include <linux/list.h> |
| 41 | 40 | #include <linux/wait.h> |
| @@ -386,7 +386,7 @@ static ssize_t evdev_read(struct file *file, char __user *buffer, · 385 unmodified lines | ||
| 386 | 386 | struct evdev_client *client = file->private_data; |
| 387 | 387 | struct evdev *evdev = client->evdev; |
| 388 | 388 | struct input_event event; |
| 389 | − int retval; | |
| 389 | + int retval = 0; | |
| 390 | 390 | |
| 391 | 391 | if (count < input_event_size()) |
| 392 | 392 | return -EINVAL; |
| @@ -34,7 +34,6 @@ · 33 unmodified lines | ||
| 34 | 34 | #include <linux/i2c/twl.h> |
| 35 | 35 | #include <linux/slab.h> |
| 36 | 36 | |
| 37 | − | |
| 38 | 37 | /* |
| 39 | 38 | * The TWL4030 family chips include a keypad controller that supports |
| 40 | 39 | * up to an 8x8 switch matrix. The controller can issue system wakeup |
| @@ -302,7 +301,7 @@ static int __devinit twl4030_kp_program(struct twl4030_keypad *kp) · 261 unmodified lines | ||
| 302 | 301 | if (twl4030_kpwrite_u8(kp, i, KEYP_DEB) < 0) |
| 303 | 302 | return -EIO; |
| 304 | 303 | |
| 305 | − /* Set timeout period to 100 ms */ | |
| 304 | + /* Set timeout period to 200 ms */ | |
| 306 | 305 | i = KEYP_PERIOD_US(200000, PTV_PRESCALER); |
| 307 | 306 | if (twl4030_kpwrite_u8(kp, (i & 0xFF), KEYP_TIMEOUT_L) < 0) |
| 308 | 307 | return -EIO; |
| @@ -466,4 +465,3 @@ MODULE_AUTHOR("Texas Instruments"); · 157 unmodified lines | ||
| 466 | 465 | MODULE_DESCRIPTION("TWL4030 Keypad Driver"); |
| 467 | 466 | MODULE_LICENSE("GPL"); |
| 468 | 467 | MODULE_ALIAS("platform:twl4030_keypad"); |
| 469 | − | |
| @@ -512,6 +512,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = { · 511 unmodified lines | ||
| 512 | 512 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"), |
| 513 | 513 | }, |
| 514 | 514 | }, |
| 515 | + { | |
| 516 | + /* Lenovo Ideapad U455 */ | |
| 517 | + .matches = { | |
| 518 | + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | |
| 519 | + DMI_MATCH(DMI_PRODUCT_NAME, "20046"), | |
| 520 | + }, | |
| 521 | + }, | |
| 515 | 522 | { } |
| 516 | 523 | }; |
| 517 | 524 | |
| @@ -164,7 +164,8 @@ static ssize_t serio_raw_read(struct file *file, char __user *buffer, · 163 unmodified lines | ||
| 164 | 164 | struct serio_raw_client *client = file->private_data; |
| 165 | 165 | struct serio_raw *serio_raw = client->serio_raw; |
| 166 | 166 | char uninitialized_var(c); |
| 167 | − ssize_t retval = 0; | |
| 167 | + ssize_t read = 0; | |
| 168 | + int retval; | |
| 168 | 169 | |
| 169 | 170 | if (serio_raw->dead) |
| 170 | 171 | return -ENODEV; |
| @@ -180,13 +181,15 @@ static ssize_t serio_raw_read(struct file *file, char __user *buffer, · 9 unmodified lines | ||
| 180 | 181 | if (serio_raw->dead) |
| 181 | 182 | return -ENODEV; |
| 182 | 183 | |
| 183 | − while (retval < count && serio_raw_fetch_byte(serio_raw, &c)) { | |
| 184 | − if (put_user(c, buffer++)) | |
| 185 | − return -EFAULT; | |
| 186 | − retval++; | |
| 184 | + while (read < count && serio_raw_fetch_byte(serio_raw, &c)) { | |
| 185 | + if (put_user(c, buffer++)) { | |
| 186 | + retval = -EFAULT; | |
| 187 | + break; | |
| 188 | + } | |
| 189 | + read++; | |
| 187 | 190 | } |
| 188 | 191 | |
| 189 | − return retval; | |
| 192 | + return read ?: retval; | |
| 190 | 193 | } |
| 191 | 194 | |
| 192 | 195 | static ssize_t serio_raw_write(struct file *file, const char __user *buffer, |
| @@ -2863,6 +2863,9 @@ static unsigned device_dma_ops_init(void) · 2862 unmodified lines | ||
| 2863 | 2863 | |
| 2864 | 2864 | for_each_pci_dev(pdev) { |
| 2865 | 2865 | if (!check_device(&pdev->dev)) { |
| 2866 | + | |
| 2867 | + iommu_ignore_device(&pdev->dev); | |
| 2868 | + | |
| 2866 | 2869 | unhandled += 1; |
| 2867 | 2870 | continue; |
| 2868 | 2871 | } |
| @@ -482,23 +482,19 @@ static size_t msm_iommu_unmap(struct iommu_domain *domain, unsigned long va, · 481 unmodified lines | ||
| 482 | 482 | |
| 483 | 483 | priv = domain->priv; |
| 484 | 484 | |
| 485 | − if (!priv) { | |
| 486 | − ret = -ENODEV; | |
| 485 | + if (!priv) | |
| 487 | 486 | goto fail; |
| 488 | − } | |
| 489 | 487 | |
| 490 | 488 | fl_table = priv->pgtable; |
| 491 | 489 | |
| 492 | 490 | if (len != SZ_16M && len != SZ_1M && |
| 493 | 491 | len != SZ_64K && len != SZ_4K) { |
| 494 | 492 | pr_debug("Bad length: %d\n", len); |
| 495 | − ret = -EINVAL; | |
| 496 | 493 | goto fail; |
| 497 | 494 | } |
| 498 | 495 | |
| 499 | 496 | if (!fl_table) { |
| 500 | 497 | pr_debug("Null page table\n"); |
| 501 | − ret = -EINVAL; | |
| 502 | 498 | goto fail; |
| 503 | 499 | } |
| 504 | 500 | |
| @@ -507,7 +503,6 @@ static size_t msm_iommu_unmap(struct iommu_domain *domain, unsigned long va, · 2 unmodified lines | ||
| 507 | 503 | |
| 508 | 504 | if (*fl_pte == 0) { |
| 509 | 505 | pr_debug("First level PTE is 0\n"); |
| 510 | − ret = -ENODEV; | |
| 511 | 506 | goto fail; |
| 512 | 507 | } |
| 513 | 508 | |
| @@ -1901,7 +1901,7 @@ static int isdn_net_header(struct sk_buff *skb, struct net_device *dev, · 1900 unmodified lines | ||
| 1901 | 1901 | { |
| 1902 | 1902 | isdn_net_local *lp = netdev_priv(dev); |
| 1903 | 1903 | unsigned char *p; |
| 1904 | − ushort len = 0; | |
| 1904 | + int len = 0; | |
| 1905 | 1905 | |
| 1906 | 1906 | switch (lp->p_encap) { |
| 1907 | 1907 | case ISDN_NET_ENCAP_ETHER: |
| @@ -164,8 +164,8 @@ static int lm3530_init_registers(struct lm3530_data *drvdata) · 163 unmodified lines | ||
| 164 | 164 | |
| 165 | 165 | if (drvdata->mode == LM3530_BL_MODE_ALS) { |
| 166 | 166 | if (pltfm->als_vmax == 0) { |
| 167 | − pltfm->als_vmin = als_vmin = 0; | |
| 168 | − pltfm->als_vmin = als_vmax = LM3530_ALS_WINDOW_mV; | |
| 167 | + pltfm->als_vmin = 0; | |
| 168 | + pltfm->als_vmax = LM3530_ALS_WINDOW_mV; | |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | als_vmin = pltfm->als_vmin; |
| @@ -710,7 +710,7 @@ static ssize_t adb_read(struct file *file, char __user *buf, · 709 unmodified lines | ||
| 710 | 710 | req = NULL; |
| 711 | 711 | spin_lock_irqsave(&state->lock, flags); |
| 712 | 712 | add_wait_queue(&state->wait_queue, &wait); |
| 713 | − current->state = TASK_INTERRUPTIBLE; | |
| 713 | + set_current_state(TASK_INTERRUPTIBLE); | |
| 714 | 714 | |
| 715 | 715 | for (;;) { |
| 716 | 716 | req = state->completed; |
| @@ -734,7 +734,7 @@ static ssize_t adb_read(struct file *file, char __user *buf, · 17 unmodified lines | ||
| 734 | 734 | spin_lock_irqsave(&state->lock, flags); |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | − current->state = TASK_RUNNING; | |
| 737 | + set_current_state(TASK_RUNNING); | |
| 738 | 738 | remove_wait_queue(&state->wait_queue, &wait); |
| 739 | 739 | spin_unlock_irqrestore(&state->lock, flags); |
| 740 | 740 | |
| @@ -56,7 +56,8 @@ struct raid_dev { · 55 unmodified lines | ||
| 56 | 56 | struct raid_set { |
| 57 | 57 | struct dm_target *ti; |
| 58 | 58 | |
| 59 | − uint64_t print_flags; | |
| 59 | + uint32_t bitmap_loaded; | |
| 60 | + uint32_t print_flags; | |
| 60 | 61 | |
| 61 | 62 | struct mddev md; |
| 62 | 63 | struct raid_type *raid_type; |
| @@ -1085,7 +1086,7 @@ static int raid_status(struct dm_target *ti, status_type_t type, · 1022 unmodified lines | ||
| 1085 | 1086 | raid_param_cnt += 2; |
| 1086 | 1087 | } |
| 1087 | 1088 | |
| 1088 | − raid_param_cnt += (hweight64(rs->print_flags & ~DMPF_REBUILD) * 2); | |
| 1089 | + raid_param_cnt += (hweight32(rs->print_flags & ~DMPF_REBUILD) * 2); | |
| 1089 | 1090 | if (rs->print_flags & (DMPF_SYNC | DMPF_NOSYNC)) |
| 1090 | 1091 | raid_param_cnt--; |
| 1091 | 1092 | |
| @@ -1197,7 +1198,12 @@ static void raid_resume(struct dm_target *ti) · 105 unmodified lines | ||
| 1197 | 1198 | { |
| 1198 | 1199 | struct raid_set *rs = ti->private; |
| 1199 | 1200 | |
| 1200 | − bitmap_load(&rs->md); | |
| 1201 | + if (!rs->bitmap_loaded) { | |
| 1202 | + bitmap_load(&rs->md); | |
| 1203 | + rs->bitmap_loaded = 1; | |
| 1204 | + } else | |
| 1205 | + md_wakeup_thread(rs->md.thread); | |
| 1206 | + | |
| 1201 | 1207 | mddev_resume(&rs->md); |
| 1202 | 1208 | } |
| 1203 | 1209 | |
| @@ -7333,7 +7333,8 @@ void md_do_sync(struct mddev *mddev) · 7332 unmodified lines | ||
| 7333 | 7333 | printk(KERN_INFO |
| 7334 | 7334 | "md: checkpointing %s of %s.\n", |
| 7335 | 7335 | desc, mdname(mddev)); |
| 7336 | − mddev->recovery_cp = mddev->curr_resync; | |
| 7336 | + mddev->recovery_cp = | |
| 7337 | + mddev->curr_resync_completed; | |
| 7337 | 7338 | } |
| 7338 | 7339 | } else |
| 7339 | 7340 | mddev->recovery_cp = MaxSector; |
| @@ -7351,9 +7352,9 @@ void md_do_sync(struct mddev *mddev) · 11 unmodified lines | ||
| 7351 | 7352 | rcu_read_unlock(); |
| 7352 | 7353 | } |
| 7353 | 7354 | } |
| 7355 | + skip: | |
| 7354 | 7356 | set_bit(MD_CHANGE_DEVS, &mddev->flags); |
| 7355 | 7357 | |
| 7356 | − skip: | |
| 7357 | 7358 | if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { |
| 7358 | 7359 | /* We completed so min/max setting can be forgotten if used. */ |
| 7359 | 7360 | if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) |
| @@ -4,8 +4,8 @@ · 3 unmodified lines | ||
| 4 | 4 | menu "Texas Instruments WL128x FM driver (ST based)" |
| 5 | 5 | config RADIO_WL128X |
| 6 | 6 | tristate "Texas Instruments WL128x FM Radio" |
| 7 | − depends on VIDEO_V4L2 && RFKILL | |
| 8 | − select TI_ST if NET && GPIOLIB | |
| 7 | + depends on VIDEO_V4L2 && RFKILL && GPIOLIB | |
| 8 | + select TI_ST if NET | |
| 9 | 9 | help |
| 10 | 10 | Choose Y here if you have this FM radio chip. |
| 11 | 11 | |
| @@ -47,7 +47,7 @@ · 46 unmodified lines | ||
| 47 | 47 | #define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" |
| 48 | 48 | #define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display" |
| 49 | 49 | #define MOD_NAME "imon" |
| 50 | −#define MOD_VERSION "0.9.3" | |
| 50 | +#define MOD_VERSION "0.9.4" | |
| 51 | 51 | |
| 52 | 52 | #define DISPLAY_MINOR_BASE 144 |
| 53 | 53 | #define DEVICE_NAME "lcd%d" |
| @@ -1658,9 +1658,17 @@ static void usb_rx_callback_intf0(struct urb *urb) · 1604 unmodified lines | ||
| 1658 | 1658 | return; |
| 1659 | 1659 | |
| 1660 | 1660 | ictx = (struct imon_context *)urb->context; |
| 1661 | − if (!ictx || !ictx->dev_present_intf0) | |
| 1661 | + if (!ictx) | |
| 1662 | 1662 | return; |
| 1663 | 1663 | |
| 1664 | + /* | |
| 1665 | + * if we get a callback before we're done configuring the hardware, we | |
| 1666 | + * can't yet process the data, as there's nowhere to send it, but we | |
| 1667 | + * still need to submit a new rx URB to avoid wedging the hardware | |
| 1668 | + */ | |
| 1669 | + if (!ictx->dev_present_intf0) | |
| 1670 | + goto out; | |
| 1671 | + | |
| 1664 | 1672 | switch (urb->status) { |
| 1665 | 1673 | case -ENOENT: /* usbcore unlink successful! */ |
| 1666 | 1674 | return; |
| @@ -1678,6 +1686,7 @@ static void usb_rx_callback_intf0(struct urb *urb) · 11 unmodified lines | ||
| 1678 | 1686 | break; |
| 1679 | 1687 | } |
| 1680 | 1688 | |
| 1689 | +out: | |
| 1681 | 1690 | usb_submit_urb(ictx->rx_urb_intf0, GFP_ATOMIC); |
| 1682 | 1691 | } |
| 1683 | 1692 | |
| @@ -1690,9 +1699,17 @@ static void usb_rx_callback_intf1(struct urb *urb) · 6 unmodified lines | ||
| 1690 | 1699 | return; |
| 1691 | 1700 | |
| 1692 | 1701 | ictx = (struct imon_context *)urb->context; |
| 1693 | − if (!ictx || !ictx->dev_present_intf1) | |
| 1702 | + if (!ictx) | |
| 1694 | 1703 | return; |
| 1695 | 1704 | |
| 1705 | + /* | |
| 1706 | + * if we get a callback before we're done configuring the hardware, we | |
| 1707 | + * can't yet process the data, as there's nowhere to send it, but we | |
| 1708 | + * still need to submit a new rx URB to avoid wedging the hardware | |
| 1709 | + */ | |
| 1710 | + if (!ictx->dev_present_intf1) | |
| 1711 | + goto out; | |
| 1712 | + | |
| 1696 | 1713 | switch (urb->status) { |
| 1697 | 1714 | case -ENOENT: /* usbcore unlink successful! */ |
| 1698 | 1715 | return; |
| @@ -1710,6 +1727,7 @@ static void usb_rx_callback_intf1(struct urb *urb) · 11 unmodified lines | ||
| 1710 | 1727 | break; |
| 1711 | 1728 | } |
| 1712 | 1729 | |
| 1730 | +out: | |
| 1713 | 1731 | usb_submit_urb(ictx->rx_urb_intf1, GFP_ATOMIC); |
| 1714 | 1732 | } |
| 1715 | 1733 | |
| @@ -2242,7 +2260,7 @@ find_endpoint_failed: · 526 unmodified lines | ||
| 2242 | 2260 | mutex_unlock(&ictx->lock); |
| 2243 | 2261 | usb_free_urb(rx_urb); |
| 2244 | 2262 | rx_urb_alloc_failed: |
| 2245 | − dev_err(ictx->dev, "unable to initialize intf0, err %d\n", ret); | |
| 2263 | + dev_err(ictx->dev, "unable to initialize intf1, err %d\n", ret); | |
| 2246 | 2264 | |
| 2247 | 2265 | return NULL; |
| 2248 | 2266 | } |
| @@ -154,10 +154,20 @@ static int device_authorization(struct hdpvr_device *dev) · 153 unmodified lines | ||
| 154 | 154 | } |
| 155 | 155 | #endif |
| 156 | 156 | |
| 157 | + dev->fw_ver = dev->usbc_buf[1]; | |
| 158 | + | |
| 157 | 159 | v4l2_info(&dev->v4l2_dev, "firmware version 0x%x dated %s\n", |
| 158 | − dev->usbc_buf[1], &dev->usbc_buf[2]); | |
| 160 | + dev->fw_ver, &dev->usbc_buf[2]); | |
| 161 | + | |
| 162 | + if (dev->fw_ver > 0x15) { | |
| 163 | + dev->options.brightness = 0x80; | |
| 164 | + dev->options.contrast = 0x40; | |
| 165 | + dev->options.hue = 0xf; | |
| 166 | + dev->options.saturation = 0x40; | |
| 167 | + dev->options.sharpness = 0x80; | |
| 168 | + } | |
| 159 | 169 | |
| 160 | − switch (dev->usbc_buf[1]) { | |
| 170 | + switch (dev->fw_ver) { | |
| 161 | 171 | case HDPVR_FIRMWARE_VERSION: |
| 162 | 172 | dev->flags &= ~HDPVR_FLAG_AC3_CAP; |
| 163 | 173 | break; |
| @@ -169,7 +179,7 @@ static int device_authorization(struct hdpvr_device *dev) · 5 unmodified lines | ||
| 169 | 179 | default: |
| 170 | 180 | v4l2_info(&dev->v4l2_dev, "untested firmware, the driver might" |
| 171 | 181 | " not work.\n"); |
| 172 | − if (dev->usbc_buf[1] >= HDPVR_FIRMWARE_VERSION_AC3) | |
| 182 | + if (dev->fw_ver >= HDPVR_FIRMWARE_VERSION_AC3) | |
| 173 | 183 | dev->flags |= HDPVR_FLAG_AC3_CAP; |
| 174 | 184 | else |
| 175 | 185 | dev->flags &= ~HDPVR_FLAG_AC3_CAP; |
| @@ -270,6 +280,8 @@ static const struct hdpvr_options hdpvr_default_options = { · 94 unmodified lines | ||
| 270 | 280 | .bitrate_mode = HDPVR_CONSTANT, |
| 271 | 281 | .gop_mode = HDPVR_SIMPLE_IDR_GOP, |
| 272 | 282 | .audio_codec = V4L2_MPEG_AUDIO_ENCODING_AAC, |
| 283 | + /* original picture controls for firmware version <= 0x15 */ | |
| 284 | + /* updated in device_authorization() for newer firmware */ | |
| 273 | 285 | .brightness = 0x86, |
| 274 | 286 | .contrast = 0x80, |
| 275 | 287 | .hue = 0x80, |
| @@ -283,12 +283,13 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev) · 282 unmodified lines | ||
| 283 | 283 | |
| 284 | 284 | hdpvr_config_call(dev, CTRL_START_STREAMING_VALUE, 0x00); |
| 285 | 285 | |
| 286 | + dev->status = STATUS_STREAMING; | |
| 287 | + | |
| 286 | 288 | INIT_WORK(&dev->worker, hdpvr_transmit_buffers); |
| 287 | 289 | queue_work(dev->workqueue, &dev->worker); |
| 288 | 290 | |
| 289 | 291 | v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev, |
| 290 | 292 | "streaming started\n"); |
| 291 | − dev->status = STATUS_STREAMING; | |
| 292 | 293 | |
| 293 | 294 | return 0; |
| 294 | 295 | } |
| @@ -722,21 +723,39 @@ static const s32 supported_v4l2_ctrls[] = { · 427 unmodified lines | ||
| 722 | 723 | }; |
| 723 | 724 | |
| 724 | 725 | static int fill_queryctrl(struct hdpvr_options *opt, struct v4l2_queryctrl *qc, |
| 725 | − int ac3) | |
| 726 | + int ac3, int fw_ver) | |
| 726 | 727 | { |
| 727 | 728 | int err; |
| 728 | 729 | |
| 730 | + if (fw_ver > 0x15) { | |
| 731 | + switch (qc->id) { | |
| 732 | + case V4L2_CID_BRIGHTNESS: | |
| 733 | + return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80); | |
| 734 | + case V4L2_CID_CONTRAST: | |
| 735 | + return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x40); | |
| 736 | + case V4L2_CID_SATURATION: | |
| 737 | + return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x40); | |
| 738 | + case V4L2_CID_HUE: | |
| 739 | + return v4l2_ctrl_query_fill(qc, 0x0, 0x1e, 1, 0xf); | |
| 740 | + case V4L2_CID_SHARPNESS: | |
| 741 | + return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80); | |
| 742 | + } | |
| 743 | + } else { | |
| 744 | + switch (qc->id) { | |
| 745 | + case V4L2_CID_BRIGHTNESS: | |
| 746 | + return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x86); | |
| 747 | + case V4L2_CID_CONTRAST: | |
| 748 | + return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80); | |
| 749 | + case V4L2_CID_SATURATION: | |
| 750 | + return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80); | |
| 751 | + case V4L2_CID_HUE: | |
| 752 | + return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80); | |
| 753 | + case V4L2_CID_SHARPNESS: | |
| 754 | + return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80); | |
| 755 | + } | |
| 756 | + } | |
| 757 | + | |
| 729 | 758 | switch (qc->id) { |
| 730 | − case V4L2_CID_BRIGHTNESS: | |
| 731 | − return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x86); | |
| 732 | − case V4L2_CID_CONTRAST: | |
| 733 | − return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80); | |
| 734 | − case V4L2_CID_SATURATION: | |
| 735 | − return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80); | |
| 736 | − case V4L2_CID_HUE: | |
| 737 | − return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80); | |
| 738 | − case V4L2_CID_SHARPNESS: | |
| 739 | − return v4l2_ctrl_query_fill(qc, 0x0, 0xff, 1, 0x80); | |
| 740 | 759 | case V4L2_CID_MPEG_AUDIO_ENCODING: |
| 741 | 760 | return v4l2_ctrl_query_fill( |
| 742 | 761 | qc, V4L2_MPEG_AUDIO_ENCODING_AAC, |
| @@ -794,7 +813,8 @@ static int vidioc_queryctrl(struct file *file, void *private_data, · 51 unmodified lines | ||
| 794 | 813 | |
| 795 | 814 | if (qc->id == supported_v4l2_ctrls[i]) |
| 796 | 815 | return fill_queryctrl(&dev->options, qc, |
| 797 | − dev->flags & HDPVR_FLAG_AC3_CAP); | |
| 816 | + dev->flags & HDPVR_FLAG_AC3_CAP, | |
| 817 | + dev->fw_ver); | |
| 798 | 818 | |
| 799 | 819 | if (qc->id < supported_v4l2_ctrls[i]) |
| 800 | 820 | break; |
| @@ -113,6 +113,7 @@ struct hdpvr_device { · 112 unmodified lines | ||
| 113 | 113 | /* usb control transfer buffer and lock */ |
| 114 | 114 | struct mutex usbc_mutex; |
| 115 | 115 | u8 *usbc_buf; |
| 116 | + u8 fw_ver; | |
| 116 | 117 | }; |
| 117 | 118 | |
| 118 | 119 | static inline struct hdpvr_device *to_hdpvr_dev(struct v4l2_device *v4l2_dev) |
| @@ -1407,7 +1407,7 @@ static int __ccdc_handle_stopping(struct isp_ccdc_device *ccdc, u32 event) · 1406 unmodified lines | ||
| 1407 | 1407 | static void ccdc_hs_vs_isr(struct isp_ccdc_device *ccdc) |
| 1408 | 1408 | { |
| 1409 | 1409 | struct isp_pipeline *pipe = to_isp_pipeline(&ccdc->subdev.entity); |
| 1410 | − struct video_device *vdev = &ccdc->subdev.devnode; | |
| 1410 | + struct video_device *vdev = ccdc->subdev.devnode; | |
| 1411 | 1411 | struct v4l2_event event; |
| 1412 | 1412 | |
| 1413 | 1413 | memset(&event, 0, sizeof(event)); |
| @@ -200,7 +200,7 @@ config MENELAUS · 199 unmodified lines | ||
| 200 | 200 | |
| 201 | 201 | config TWL4030_CORE |
| 202 | 202 | bool "Texas Instruments TWL4030/TWL5030/TWL6030/TPS659x0 Support" |
| 203 | − depends on I2C=y && GENERIC_HARDIRQS && IRQ_DOMAIN | |
| 203 | + depends on I2C=y && GENERIC_HARDIRQS | |
| 204 | 204 | help |
| 205 | 205 | Say yes here if you have TWL4030 / TWL6030 family chip on your board. |
| 206 | 206 | This core driver provides register access and IRQ handling |
| @@ -263,7 +263,9 @@ struct twl_client { · 262 unmodified lines | ||
| 263 | 263 | |
| 264 | 264 | static struct twl_client twl_modules[TWL_NUM_SLAVES]; |
| 265 | 265 | |
| 266 | +#ifdef CONFIG_IRQ_DOMAIN | |
| 266 | 267 | static struct irq_domain domain; |
| 268 | +#endif | |
| 267 | 269 | |
| 268 | 270 | /* mapping the module id to slave id and base address */ |
| 269 | 271 | struct twl_mapping { |
| @@ -1226,13 +1228,13 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) · 956 unmodified lines | ||
| 1226 | 1228 | pdata->irq_base = status; |
| 1227 | 1229 | pdata->irq_end = pdata->irq_base + nr_irqs; |
| 1228 | 1230 | |
| 1231 | +#ifdef CONFIG_IRQ_DOMAIN | |
| 1229 | 1232 | domain.irq_base = pdata->irq_base; |
| 1230 | 1233 | domain.nr_irq = nr_irqs; |
| 1231 | −#ifdef CONFIG_OF_IRQ | |
| 1232 | 1234 | domain.of_node = of_node_get(node); |
| 1233 | 1235 | domain.ops = &irq_domain_simple_ops; |
| 1234 | −#endif | |
| 1235 | 1236 | irq_domain_add(&domain); |
| 1237 | +#endif | |
| 1236 | 1238 | |
| 1237 | 1239 | if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) { |
| 1238 | 1240 | dev_dbg(&client->dev, "can't talk I2C?\n"); |
| @@ -124,7 +124,7 @@ static u8 res_config_addrs[] = { · 123 unmodified lines | ||
| 124 | 124 | [RES_MAIN_REF] = 0x94, |
| 125 | 125 | }; |
| 126 | 126 | |
| 127 | −static int __init twl4030_write_script_byte(u8 address, u8 byte) | |
| 127 | +static int __devinit twl4030_write_script_byte(u8 address, u8 byte) | |
| 128 | 128 | { |
| 129 | 129 | int err; |
| 130 | 130 | |
| @@ -138,7 +138,7 @@ out: · 7 unmodified lines | ||
| 138 | 138 | return err; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | −static int __init twl4030_write_script_ins(u8 address, u16 pmb_message, | |
| 141 | +static int __devinit twl4030_write_script_ins(u8 address, u16 pmb_message, | |
| 142 | 142 | u8 delay, u8 next) |
| 143 | 143 | { |
| 144 | 144 | int err; |
| @@ -158,7 +158,7 @@ out: · 13 unmodified lines | ||
| 158 | 158 | return err; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | −static int __init twl4030_write_script(u8 address, struct twl4030_ins *script, | |
| 161 | +static int __devinit twl4030_write_script(u8 address, struct twl4030_ins *script, | |
| 162 | 162 | int len) |
| 163 | 163 | { |
| 164 | 164 | int err; |
| @@ -183,7 +183,7 @@ static int __init twl4030_write_script(u8 address, struct twl4030_ins *script, · 18 unmodified lines | ||
| 183 | 183 | return err; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | −static int __init twl4030_config_wakeup3_sequence(u8 address) | |
| 186 | +static int __devinit twl4030_config_wakeup3_sequence(u8 address) | |
| 187 | 187 | { |
| 188 | 188 | int err; |
| 189 | 189 | u8 data; |
| @@ -208,7 +208,7 @@ out: · 18 unmodified lines | ||
| 208 | 208 | return err; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | −static int __init twl4030_config_wakeup12_sequence(u8 address) | |
| 211 | +static int __devinit twl4030_config_wakeup12_sequence(u8 address) | |
| 212 | 212 | { |
| 213 | 213 | int err = 0; |
| 214 | 214 | u8 data; |
| @@ -262,7 +262,7 @@ out: · 47 unmodified lines | ||
| 262 | 262 | return err; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | −static int __init twl4030_config_sleep_sequence(u8 address) | |
| 265 | +static int __devinit twl4030_config_sleep_sequence(u8 address) | |
| 266 | 266 | { |
| 267 | 267 | int err; |
| 268 | 268 | |
| @@ -276,7 +276,7 @@ static int __init twl4030_config_sleep_sequence(u8 address) · 7 unmodified lines | ||
| 276 | 276 | return err; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | −static int __init twl4030_config_warmreset_sequence(u8 address) | |
| 279 | +static int __devinit twl4030_config_warmreset_sequence(u8 address) | |
| 280 | 280 | { |
| 281 | 281 | int err; |
| 282 | 282 | u8 rd_data; |
| @@ -324,7 +324,7 @@ out: · 41 unmodified lines | ||
| 324 | 324 | return err; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | −static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig) | |
| 327 | +static int __devinit twl4030_configure_resource(struct twl4030_resconfig *rconfig) | |
| 328 | 328 | { |
| 329 | 329 | int rconfig_addr; |
| 330 | 330 | int err; |
| @@ -416,7 +416,7 @@ static int __init twl4030_configure_resource(struct twl4030_resconfig *rconfig) · 85 unmodified lines | ||
| 416 | 416 | return 0; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | −static int __init load_twl4030_script(struct twl4030_script *tscript, | |
| 419 | +static int __devinit load_twl4030_script(struct twl4030_script *tscript, | |
| 420 | 420 | u8 address) |
| 421 | 421 | { |
| 422 | 422 | int err; |
| @@ -527,7 +527,7 @@ void twl4030_power_off(void) · 104 unmodified lines | ||
| 527 | 527 | pr_err("TWL4030 Unable to power off\n"); |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | −void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts) | |
| 530 | +void __devinit twl4030_power_init(struct twl4030_power_data *twl4030_scripts) | |
| 531 | 531 | { |
| 532 | 532 | int err = 0; |
| 533 | 533 | int i; |
| @@ -282,6 +282,7 @@ int twl6040_power(struct twl6040 *twl6040, int on) · 281 unmodified lines | ||
| 282 | 282 | /* Default PLL configuration after power up */ |
| 283 | 283 | twl6040->pll = TWL6040_SYSCLK_SEL_LPPLL; |
| 284 | 284 | twl6040->sysclk = 19200000; |
| 285 | + twl6040->mclk = 32768; | |
| 285 | 286 | } else { |
| 286 | 287 | /* already powered-down */ |
| 287 | 288 | if (!twl6040->power_count) { |
| @@ -305,6 +306,7 @@ int twl6040_power(struct twl6040 *twl6040, int on) · 17 unmodified lines | ||
| 305 | 306 | twl6040_power_down(twl6040); |
| 306 | 307 | } |
| 307 | 308 | twl6040->sysclk = 0; |
| 309 | + twl6040->mclk = 0; | |
| 308 | 310 | } |
| 309 | 311 | |
| 310 | 312 | out: |
| @@ -324,23 +326,38 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id, · 13 unmodified lines | ||
| 324 | 326 | hppllctl = twl6040_reg_read(twl6040, TWL6040_REG_HPPLLCTL); |
| 325 | 327 | lppllctl = twl6040_reg_read(twl6040, TWL6040_REG_LPPLLCTL); |
| 326 | 328 | |
| 329 | + /* Force full reconfiguration when switching between PLL */ | |
| 330 | + if (pll_id != twl6040->pll) { | |
| 331 | + twl6040->sysclk = 0; | |
| 332 | + twl6040->mclk = 0; | |
| 333 | + } | |
| 334 | + | |
| 327 | 335 | switch (pll_id) { |
| 328 | 336 | case TWL6040_SYSCLK_SEL_LPPLL: |
| 329 | 337 | /* low-power PLL divider */ |
| 330 | − switch (freq_out) { | |
| 331 | − case 17640000: | |
| 332 | − lppllctl |= TWL6040_LPLLFIN; | |
| 333 | − break; | |
| 334 | − case 19200000: | |
| 335 | − lppllctl &= ~TWL6040_LPLLFIN; | |
| 336 | − break; | |
| 337 | − default: | |
| 338 | − dev_err(twl6040->dev, | |
| 339 | − "freq_out %d not supported\n", freq_out); | |
| 340 | − ret = -EINVAL; | |
| 341 | − goto pll_out; | |
| 338 | + /* Change the sysclk configuration only if it has been canged */ | |
| 339 | + if (twl6040->sysclk != freq_out) { | |
| 340 | + switch (freq_out) { | |
| 341 | + case 17640000: | |
| 342 | + lppllctl |= TWL6040_LPLLFIN; | |
| 343 | + break; | |
| 344 | + case 19200000: | |
| 345 | + lppllctl &= ~TWL6040_LPLLFIN; | |
| 346 | + break; | |
| 347 | + default: | |
| 348 | + dev_err(twl6040->dev, | |
| 349 | + "freq_out %d not supported\n", | |
| 350 | + freq_out); | |
| 351 | + ret = -EINVAL; | |
| 352 | + goto pll_out; | |
| 353 | + } | |
| 354 | + twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, | |
| 355 | + lppllctl); | |
| 342 | 356 | } |
| 343 | − twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); | |
| 357 | + | |
| 358 | + /* The PLL in use has not been change, we can exit */ | |
| 359 | + if (twl6040->pll == pll_id) | |
| 360 | + break; | |
| 344 | 361 | |
| 345 | 362 | switch (freq_in) { |
| 346 | 363 | case 32768: |
| @@ -371,48 +388,56 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id, · 24 unmodified lines | ||
| 371 | 388 | goto pll_out; |
| 372 | 389 | } |
| 373 | 390 | |
| 374 | − hppllctl &= ~TWL6040_MCLK_MSK; | |
| 391 | + if (twl6040->mclk != freq_in) { | |
| 392 | + hppllctl &= ~TWL6040_MCLK_MSK; | |
| 393 | + | |
| 394 | + switch (freq_in) { | |
| 395 | + case 12000000: | |
| 396 | + /* PLL enabled, active mode */ | |
| 397 | + hppllctl |= TWL6040_MCLK_12000KHZ | | |
| 398 | + TWL6040_HPLLENA; | |
| 399 | + break; | |
| 400 | + case 19200000: | |
| 401 | + /* | |
| 402 | + * PLL disabled | |
| 403 | + * (enable PLL if MCLK jitter quality | |
| 404 | + * doesn't meet specification) | |
| 405 | + */ | |
| 406 | + hppllctl |= TWL6040_MCLK_19200KHZ; | |
| 407 | + break; | |
| 408 | + case 26000000: | |
| 409 | + /* PLL enabled, active mode */ | |
| 410 | + hppllctl |= TWL6040_MCLK_26000KHZ | | |
| 411 | + TWL6040_HPLLENA; | |
| 412 | + break; | |
| 413 | + case 38400000: | |
| 414 | + /* PLL enabled, active mode */ | |
| 415 | + hppllctl |= TWL6040_MCLK_38400KHZ | | |
| 416 | + TWL6040_HPLLENA; | |
| 417 | + break; | |
| 418 | + default: | |
| 419 | + dev_err(twl6040->dev, | |
| 420 | + "freq_in %d not supported\n", freq_in); | |
| 421 | + ret = -EINVAL; | |
| 422 | + goto pll_out; | |
| 423 | + } | |
| 375 | 424 | |
| 376 | − switch (freq_in) { | |
| 377 | − case 12000000: | |
| 378 | − /* PLL enabled, active mode */ | |
| 379 | − hppllctl |= TWL6040_MCLK_12000KHZ | | |
| 380 | − TWL6040_HPLLENA; | |
| 381 | − break; | |
| 382 | − case 19200000: | |
| 383 | 425 | /* |
| 384 | − * PLL disabled | |
| 385 | − * (enable PLL if MCLK jitter quality | |
| 386 | − * doesn't meet specification) | |
| 426 | + * enable clock slicer to ensure input waveform is | |
| 427 | + * square | |
| 387 | 428 | */ |
| 388 | − hppllctl |= TWL6040_MCLK_19200KHZ; | |
| 389 | − break; | |
| 390 | − case 26000000: | |
| 391 | − /* PLL enabled, active mode */ | |
| 392 | − hppllctl |= TWL6040_MCLK_26000KHZ | | |
| 393 | − TWL6040_HPLLENA; | |
| 394 | − break; | |
| 395 | − case 38400000: | |
| 396 | − /* PLL enabled, active mode */ | |
| 397 | − hppllctl |= TWL6040_MCLK_38400KHZ | | |
| 398 | − TWL6040_HPLLENA; | |
| 399 | − break; | |
| 400 | − default: | |
| 401 | − dev_err(twl6040->dev, | |
| 402 | − "freq_in %d not supported\n", freq_in); | |
| 403 | − ret = -EINVAL; | |
| 404 | − goto pll_out; | |
| 405 | − } | |
| 429 | + hppllctl |= TWL6040_HPLLSQRENA; | |
| 406 | 430 | |
| 407 | − /* enable clock slicer to ensure input waveform is square */ | |
| 408 | − hppllctl |= TWL6040_HPLLSQRENA; | |
| 409 | − | |
| 410 | − twl6040_reg_write(twl6040, TWL6040_REG_HPPLLCTL, hppllctl); | |
| 411 | − usleep_range(500, 700); | |
| 412 | − lppllctl |= TWL6040_HPLLSEL; | |
| 413 | − twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); | |
| 414 | − lppllctl &= ~TWL6040_LPLLENA; | |
| 415 | − twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); | |
| 431 | + twl6040_reg_write(twl6040, TWL6040_REG_HPPLLCTL, | |
| 432 | + hppllctl); | |
| 433 | + usleep_range(500, 700); | |
| 434 | + lppllctl |= TWL6040_HPLLSEL; | |
| 435 | + twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, | |
| 436 | + lppllctl); | |
| 437 | + lppllctl &= ~TWL6040_LPLLENA; | |
| 438 | + twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, | |
| 439 | + lppllctl); | |
| 440 | + } | |
| 416 | 441 | break; |
| 417 | 442 | default: |
| 418 | 443 | dev_err(twl6040->dev, "unknown pll id %d\n", pll_id); |
| @@ -421,6 +446,7 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id, · 2 unmodified lines | ||
| 421 | 446 | } |
| 422 | 447 | |
| 423 | 448 | twl6040->sysclk = freq_out; |
| 449 | + twl6040->mclk = freq_in; | |
| 424 | 450 | twl6040->pll = pll_id; |
| 425 | 451 | |
| 426 | 452 | pll_out: |
| @@ -2,24 +2,14 @@ · 1 unmodified line | ||
| 2 | 2 | # Misc strange devices |
| 3 | 3 | # |
| 4 | 4 | |
| 5 | −# This one has to live outside of the MISC_DEVICES conditional, | |
| 6 | −# because it may be selected by drivers/platform/x86/hp_accel. | |
| 5 | +menu "Misc devices" | |
| 6 | + | |
| 7 | 7 | config SENSORS_LIS3LV02D |
| 8 | 8 | tristate |
| 9 | 9 | depends on INPUT |
| 10 | 10 | select INPUT_POLLDEV |
| 11 | 11 | default n |
| 12 | 12 | |
| 13 | −menuconfig MISC_DEVICES | |
| 14 | − bool "Misc devices" | |
| 15 | − ---help--- | |
| 16 | − Say Y here to get to see options for device drivers from various | |
| 17 | − different categories. This option alone does not add any kernel code. | |
| 18 | − | |
| 19 | − If you say N, all options in this submenu will be skipped and disabled. | |
| 20 | − | |
| 21 | −if MISC_DEVICES | |
| 22 | − | |
| 23 | 13 | config AD525X_DPOT |
| 24 | 14 | tristate "Analog Devices Digital Potentiometers" |
| 25 | 15 | depends on (I2C || SPI) && SYSFS |
| @@ -516,5 +506,4 @@ source "drivers/misc/ti-st/Kconfig" · 490 unmodified lines | ||
| 516 | 506 | source "drivers/misc/lis3lv02d/Kconfig" |
| 517 | 507 | source "drivers/misc/carma/Kconfig" |
| 518 | 508 | source "drivers/misc/altera-stapl/Kconfig" |
| 519 | − | |
| 520 | −endif # MISC_DEVICES | |
| 509 | +endmenu | |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/module.h> |
| 16 | 16 | #include <linux/delay.h> |
| 17 | 17 | #include <linux/io.h> |
| 18 | +#include <linux/ioport.h> | |
| 18 | 19 | #include <linux/c2port.h> |
| 19 | 20 | |
| 20 | 21 | #define DATA_PORT 0x325 |
| @@ -245,6 +245,7 @@ static int __devinit cb710_probe(struct pci_dev *pdev, · 244 unmodified lines | ||
| 245 | 245 | if (err) |
| 246 | 246 | return err; |
| 247 | 247 | |
| 248 | + spin_lock_init(&chip->irq_lock); | |
| 248 | 249 | chip->pdev = pdev; |
| 249 | 250 | chip->iobase = pcim_iomap_table(pdev)[0]; |
| 250 | 251 | |
| @@ -262,7 +262,7 @@ static void __init reset_all_timers(void) · 261 unmodified lines | ||
| 262 | 262 | * In other cases (such as with VSAless OpenFirmware), the system firmware |
| 263 | 263 | * leaves timers available for us to use. |
| 264 | 264 | */ |
| 265 | −static int __init scan_timers(struct cs5535_mfgpt_chip *mfgpt) | |
| 265 | +static int __devinit scan_timers(struct cs5535_mfgpt_chip *mfgpt) | |
| 266 | 266 | { |
| 267 | 267 | struct cs5535_mfgpt_timer timer = { .chip = mfgpt }; |
| 268 | 268 | unsigned long flags; |
| @@ -354,6 +354,7 @@ static void lkdtm_do_action(enum ctype which) · 353 unmodified lines | ||
| 354 | 354 | static void lkdtm_handler(void) |
| 355 | 355 | { |
| 356 | 356 | unsigned long flags; |
| 357 | + bool do_it = false; | |
| 357 | 358 | |
| 358 | 359 | spin_lock_irqsave(&count_lock, flags); |
| 359 | 360 | count--; |
| @@ -361,10 +362,13 @@ static void lkdtm_handler(void) · 1 unmodified line | ||
| 361 | 362 | cp_name_to_str(cpoint), cp_type_to_str(cptype), count); |
| 362 | 363 | |
| 363 | 364 | if (count == 0) { |
| 364 | − lkdtm_do_action(cptype); | |
| 365 | + do_it = true; | |
| 365 | 366 | count = cpoint_count; |
| 366 | 367 | } |
| 367 | 368 | spin_unlock_irqrestore(&count_lock, flags); |
| 369 | + | |
| 370 | + if (do_it) | |
| 371 | + lkdtm_do_action(cptype); | |
| 368 | 372 | } |
| 369 | 373 | |
| 370 | 374 | static int lkdtm_register_cpoint(enum cname which) |
| @@ -314,7 +314,7 @@ static bool vmballoon_send_get_target(struct vmballoon *b, u32 *new_target) · 313 unmodified lines | ||
| 314 | 314 | * fear that guest will need it. Host may reject some pages, we need to |
| 315 | 315 | * check the return value and maybe submit a different page. |
| 316 | 316 | */ |
| 317 | −static bool vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn, | |
| 317 | +static int vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn, | |
| 318 | 318 | unsigned int *hv_status) |
| 319 | 319 | { |
| 320 | 320 | unsigned long status, dummy; |
| @@ -322,17 +322,17 @@ static bool vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn, · 1 unmodified line | ||
| 322 | 322 | |
| 323 | 323 | pfn32 = (u32)pfn; |
| 324 | 324 | if (pfn32 != pfn) |
| 325 | − return false; | |
| 325 | + return -1; | |
| 326 | 326 | |
| 327 | 327 | STATS_INC(b->stats.lock); |
| 328 | 328 | |
| 329 | 329 | *hv_status = status = VMWARE_BALLOON_CMD(LOCK, pfn, dummy); |
| 330 | 330 | if (vmballoon_check_status(b, status)) |
| 331 | − return true; | |
| 331 | + return 0; | |
| 332 | 332 | |
| 333 | 333 | pr_debug("%s - ppn %lx, hv returns %ld\n", __func__, pfn, status); |
| 334 | 334 | STATS_INC(b->stats.lock_fail); |
| 335 | − return false; | |
| 335 | + return 1; | |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /* |
| @@ -411,7 +411,7 @@ static int vmballoon_reserve_page(struct vmballoon *b, bool can_sleep) · 72 unmodified lines | ||
| 411 | 411 | struct page *page; |
| 412 | 412 | gfp_t flags; |
| 413 | 413 | unsigned int hv_status; |
| 414 | − bool locked = false; | |
| 414 | + int locked; | |
| 415 | 415 | flags = can_sleep ? VMW_PAGE_ALLOC_CANSLEEP : VMW_PAGE_ALLOC_NOSLEEP; |
| 416 | 416 | |
| 417 | 417 | do { |
| @@ -431,7 +431,7 @@ static int vmballoon_reserve_page(struct vmballoon *b, bool can_sleep) · 13 unmodified lines | ||
| 431 | 431 | |
| 432 | 432 | /* inform monitor */ |
| 433 | 433 | locked = vmballoon_send_lock_page(b, page_to_pfn(page), &hv_status); |
| 434 | − if (!locked) { | |
| 434 | + if (locked > 0) { | |
| 435 | 435 | STATS_INC(b->stats.refused_alloc); |
| 436 | 436 | |
| 437 | 437 | if (hv_status == VMW_BALLOON_ERROR_RESET || |
| @@ -449,7 +449,7 @@ static int vmballoon_reserve_page(struct vmballoon *b, bool can_sleep) · 11 unmodified lines | ||
| 449 | 449 | if (++b->n_refused_pages >= VMW_BALLOON_MAX_REFUSED) |
| 450 | 450 | return -EIO; |
| 451 | 451 | } |
| 452 | − } while (!locked); | |
| 452 | + } while (locked != 0); | |
| 453 | 453 | |
| 454 | 454 | /* track allocated page */ |
| 455 | 455 | list_add(&page->lru, &b->pages); |
| @@ -1694,6 +1694,7 @@ static int mmc_add_disk(struct mmc_blk_data *md) · 1693 unmodified lines | ||
| 1694 | 1694 | |
| 1695 | 1695 | md->power_ro_lock.show = power_ro_lock_show; |
| 1696 | 1696 | md->power_ro_lock.store = power_ro_lock_store; |
| 1697 | + sysfs_attr_init(&md->power_ro_lock.attr); | |
| 1697 | 1698 | md->power_ro_lock.attr.mode = mode; |
| 1698 | 1699 | md->power_ro_lock.attr.name = |
| 1699 | 1700 | "ro_lock_until_next_power_on"; |
| @@ -290,8 +290,11 @@ static void mmc_wait_for_req_done(struct mmc_host *host, · 289 unmodified lines | ||
| 290 | 290 | static void mmc_pre_req(struct mmc_host *host, struct mmc_request *mrq, |
| 291 | 291 | bool is_first_req) |
| 292 | 292 | { |
| 293 | − if (host->ops->pre_req) | |
| 293 | + if (host->ops->pre_req) { | |
| 294 | + mmc_host_clk_hold(host); | |
| 294 | 295 | host->ops->pre_req(host, mrq, is_first_req); |
| 296 | + mmc_host_clk_release(host); | |
| 297 | + } | |
| 295 | 298 | } |
| 296 | 299 | |
| 297 | 300 | /** |
| @@ -306,8 +309,11 @@ static void mmc_pre_req(struct mmc_host *host, struct mmc_request *mrq, · 8 unmodified lines | ||
| 306 | 309 | static void mmc_post_req(struct mmc_host *host, struct mmc_request *mrq, |
| 307 | 310 | int err) |
| 308 | 311 | { |
| 309 | − if (host->ops->post_req) | |
| 312 | + if (host->ops->post_req) { | |
| 313 | + mmc_host_clk_hold(host); | |
| 310 | 314 | host->ops->post_req(host, mrq, err); |
| 315 | + mmc_host_clk_release(host); | |
| 316 | + } | |
| 311 | 317 | } |
| 312 | 318 | |
| 313 | 319 | /** |
| @@ -620,7 +626,9 @@ int mmc_host_enable(struct mmc_host *host) · 306 unmodified lines | ||
| 620 | 626 | int err; |
| 621 | 627 | |
| 622 | 628 | host->en_dis_recurs = 1; |
| 629 | + mmc_host_clk_hold(host); | |
| 623 | 630 | err = host->ops->enable(host); |
| 631 | + mmc_host_clk_release(host); | |
| 624 | 632 | host->en_dis_recurs = 0; |
| 625 | 633 | |
| 626 | 634 | if (err) { |
| @@ -640,7 +648,9 @@ static int mmc_host_do_disable(struct mmc_host *host, int lazy) · 13 unmodified lines | ||
| 640 | 648 | int err; |
| 641 | 649 | |
| 642 | 650 | host->en_dis_recurs = 1; |
| 651 | + mmc_host_clk_hold(host); | |
| 643 | 652 | err = host->ops->disable(host, lazy); |
| 653 | + mmc_host_clk_release(host); | |
| 644 | 654 | host->en_dis_recurs = 0; |
| 645 | 655 | |
| 646 | 656 | if (err < 0) { |
| @@ -1121,6 +1131,10 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc, · 474 unmodified lines | ||
| 1121 | 1131 | * might not allow this operation |
| 1122 | 1132 | */ |
| 1123 | 1133 | voltage = regulator_get_voltage(supply); |
| 1134 | + | |
| 1135 | + if (mmc->caps2 & MMC_CAP2_BROKEN_VOLTAGE) | |
| 1136 | + min_uV = max_uV = voltage; | |
| 1137 | + | |
| 1124 | 1138 | if (voltage < 0) |
| 1125 | 1139 | result = voltage; |
| 1126 | 1140 | else if (voltage < min_uV || voltage > max_uV) |
| @@ -1203,8 +1217,11 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, bool cmd11 · 76 unmodified lines | ||
| 1203 | 1217 | |
| 1204 | 1218 | host->ios.signal_voltage = signal_voltage; |
| 1205 | 1219 | |
| 1206 | − if (host->ops->start_signal_voltage_switch) | |
| 1220 | + if (host->ops->start_signal_voltage_switch) { | |
| 1221 | + mmc_host_clk_hold(host); | |
| 1207 | 1222 | err = host->ops->start_signal_voltage_switch(host, &host->ios); |
| 1223 | + mmc_host_clk_release(host); | |
| 1224 | + } | |
| 1208 | 1225 | |
| 1209 | 1226 | return err; |
| 1210 | 1227 | } |
| @@ -1239,6 +1256,7 @@ static void mmc_poweroff_notify(struct mmc_host *host) · 28 unmodified lines | ||
| 1239 | 1256 | int err = 0; |
| 1240 | 1257 | |
| 1241 | 1258 | card = host->card; |
| 1259 | + mmc_claim_host(host); | |
| 1242 | 1260 | |
| 1243 | 1261 | /* |
| 1244 | 1262 | * Send power notify command only if card |
| @@ -1269,6 +1287,7 @@ static void mmc_poweroff_notify(struct mmc_host *host) · 24 unmodified lines | ||
| 1269 | 1287 | /* Set the card state to no notification after the poweroff */ |
| 1270 | 1288 | card->poweroff_notify_state = MMC_NO_POWER_NOTIFICATION; |
| 1271 | 1289 | } |
| 1290 | + mmc_release_host(host); | |
| 1272 | 1291 | } |
| 1273 | 1292 | |
| 1274 | 1293 | /* |
| @@ -1327,12 +1346,28 @@ static void mmc_power_up(struct mmc_host *host) · 52 unmodified lines | ||
| 1327 | 1346 | |
| 1328 | 1347 | void mmc_power_off(struct mmc_host *host) |
| 1329 | 1348 | { |
| 1349 | + int err = 0; | |
| 1330 | 1350 | mmc_host_clk_hold(host); |
| 1331 | 1351 | |
| 1332 | 1352 | host->ios.clock = 0; |
| 1333 | 1353 | host->ios.vdd = 0; |
| 1334 | 1354 | |
| 1335 | − mmc_poweroff_notify(host); | |
| 1355 | + /* | |
| 1356 | + * For eMMC 4.5 device send AWAKE command before | |
| 1357 | + * POWER_OFF_NOTIFY command, because in sleep state | |
| 1358 | + * eMMC 4.5 devices respond to only RESET and AWAKE cmd | |
| 1359 | + */ | |
| 1360 | + if (host->card && mmc_card_is_sleep(host->card) && | |
| 1361 | + host->bus_ops->resume) { | |
| 1362 | + err = host->bus_ops->resume(host); | |
| 1363 | + | |
| 1364 | + if (!err) | |
| 1365 | + mmc_poweroff_notify(host); | |
| 1366 | + else | |
| 1367 | + pr_warning("%s: error %d during resume " | |
| 1368 | + "(continue with poweroff sequence)\n", | |
| 1369 | + mmc_hostname(host), err); | |
| 1370 | + } | |
| 1336 | 1371 | |
| 1337 | 1372 | /* |
| 1338 | 1373 | * Reset ocr mask to be the highest possible voltage supported for |
| @@ -2386,12 +2421,6 @@ int mmc_suspend_host(struct mmc_host *host) · 1047 unmodified lines | ||
| 2386 | 2421 | */ |
| 2387 | 2422 | if (mmc_try_claim_host(host)) { |
| 2388 | 2423 | if (host->bus_ops->suspend) { |
| 2389 | − /* | |
| 2390 | − * For eMMC 4.5 device send notify command | |
| 2391 | − * before sleep, because in sleep state eMMC 4.5 | |
| 2392 | − * devices respond to only RESET and AWAKE cmd | |
| 2393 | − */ | |
| 2394 | − mmc_poweroff_notify(host); | |
| 2395 | 2424 | err = host->bus_ops->suspend(host); |
| 2396 | 2425 | } |
| 2397 | 2426 | mmc_do_release_host(host); |
| @@ -14,27 +14,6 @@ · 13 unmodified lines | ||
| 14 | 14 | |
| 15 | 15 | int mmc_register_host_class(void); |
| 16 | 16 | void mmc_unregister_host_class(void); |
| 17 | − | |
| 18 | −#ifdef CONFIG_MMC_CLKGATE | |
| 19 | −void mmc_host_clk_hold(struct mmc_host *host); | |
| 20 | −void mmc_host_clk_release(struct mmc_host *host); | |
| 21 | −unsigned int mmc_host_clk_rate(struct mmc_host *host); | |
| 22 | − | |
| 23 | −#else | |
| 24 | −static inline void mmc_host_clk_hold(struct mmc_host *host) | |
| 25 | −{ | |
| 26 | −} | |
| 27 | − | |
| 28 | −static inline void mmc_host_clk_release(struct mmc_host *host) | |
| 29 | −{ | |
| 30 | −} | |
| 31 | − | |
| 32 | −static inline unsigned int mmc_host_clk_rate(struct mmc_host *host) | |
| 33 | −{ | |
| 34 | − return host->ios.clock; | |
| 35 | −} | |
| 36 | −#endif | |
| 37 | − | |
| 38 | 17 | void mmc_host_deeper_disable(struct work_struct *work); |
| 39 | 18 | |
| 40 | 19 | #endif |
| @@ -376,7 +376,7 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) · 375 unmodified lines | ||
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | card->ext_csd.raw_hc_erase_gap_size = |
| 379 | − ext_csd[EXT_CSD_PARTITION_ATTRIBUTE]; | |
| 379 | + ext_csd[EXT_CSD_HC_WP_GRP_SIZE]; | |
| 380 | 380 | card->ext_csd.raw_sec_trim_mult = |
| 381 | 381 | ext_csd[EXT_CSD_SEC_TRIM_MULT]; |
| 382 | 382 | card->ext_csd.raw_sec_erase_mult = |
| @@ -551,7 +551,7 @@ static int mmc_compare_ext_csds(struct mmc_card *card, unsigned bus_width) · 168 unmodified lines | ||
| 551 | 551 | goto out; |
| 552 | 552 | |
| 553 | 553 | /* only compare read only fields */ |
| 554 | − err = (!(card->ext_csd.raw_partition_support == | |
| 554 | + err = !((card->ext_csd.raw_partition_support == | |
| 555 | 555 | bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) && |
| 556 | 556 | (card->ext_csd.raw_erased_mem_count == |
| 557 | 557 | bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) && |
| @@ -1006,7 +1006,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, · 448 unmodified lines | ||
| 1006 | 1006 | err = mmc_select_hs200(card); |
| 1007 | 1007 | else if (host->caps & MMC_CAP_MMC_HIGHSPEED) |
| 1008 | 1008 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
| 1009 | − EXT_CSD_HS_TIMING, 1, 0); | |
| 1009 | + EXT_CSD_HS_TIMING, 1, | |
| 1010 | + card->ext_csd.generic_cmd6_time); | |
| 1010 | 1011 | |
| 1011 | 1012 | if (err && err != -EBADMSG) |
| 1012 | 1013 | goto free_card; |
| @@ -1116,7 +1117,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, · 103 unmodified lines | ||
| 1116 | 1117 | * Activate wide bus and DDR (if supported). |
| 1117 | 1118 | */ |
| 1118 | 1119 | if (!mmc_card_hs200(card) && |
| 1119 | − (card->csd.mmca_vsn >= CSD_SPEC_VER_3) && | |
| 1120 | + (card->csd.mmca_vsn >= CSD_SPEC_VER_4) && | |
| 1120 | 1121 | (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) { |
| 1121 | 1122 | static unsigned ext_csd_bits[][2] = { |
| 1122 | 1123 | { EXT_CSD_BUS_WIDTH_8, EXT_CSD_DDR_BUS_WIDTH_8 }, |
| @@ -1315,11 +1316,13 @@ static int mmc_suspend(struct mmc_host *host) · 192 unmodified lines | ||
| 1315 | 1316 | BUG_ON(!host->card); |
| 1316 | 1317 | |
| 1317 | 1318 | mmc_claim_host(host); |
| 1318 | − if (mmc_card_can_sleep(host)) | |
| 1319 | + if (mmc_card_can_sleep(host)) { | |
| 1319 | 1320 | err = mmc_card_sleep(host); |
| 1320 | − else if (!mmc_host_is_spi(host)) | |
| 1321 | + if (!err) | |
| 1322 | + mmc_card_set_sleep(host->card); | |
| 1323 | + } else if (!mmc_host_is_spi(host)) | |
| 1321 | 1324 | mmc_deselect_cards(host); |
| 1322 | − host->card->state &= ~MMC_STATE_HIGHSPEED; | |
| 1325 | + host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200); | |
| 1323 | 1326 | mmc_release_host(host); |
| 1324 | 1327 | |
| 1325 | 1328 | return err; |
| @@ -1339,7 +1342,11 @@ static int mmc_resume(struct mmc_host *host) · 13 unmodified lines | ||
| 1339 | 1342 | BUG_ON(!host->card); |
| 1340 | 1343 | |
| 1341 | 1344 | mmc_claim_host(host); |
| 1342 | − err = mmc_init_card(host, host->ocr, host->card); | |
| 1345 | + if (mmc_card_is_sleep(host->card)) { | |
| 1346 | + err = mmc_card_awake(host); | |
| 1347 | + mmc_card_clr_sleep(host->card); | |
| 1348 | + } else | |
| 1349 | + err = mmc_init_card(host, host->ocr, host->card); | |
| 1343 | 1350 | mmc_release_host(host); |
| 1344 | 1351 | |
| 1345 | 1352 | return err; |
| @@ -1349,7 +1356,8 @@ static int mmc_power_restore(struct mmc_host *host) · 3 unmodified lines | ||
| 1349 | 1356 | { |
| 1350 | 1357 | int ret; |
| 1351 | 1358 | |
| 1352 | − host->card->state &= ~MMC_STATE_HIGHSPEED; | |
| 1359 | + host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200); | |
| 1360 | + mmc_card_clr_sleep(host->card); | |
| 1353 | 1361 | mmc_claim_host(host); |
| 1354 | 1362 | ret = mmc_init_card(host, host->ocr, host->card); |
| 1355 | 1363 | mmc_release_host(host); |
| @@ -451,9 +451,11 @@ static int sd_select_driver_type(struct mmc_card *card, u8 *status) · 450 unmodified lines | ||
| 451 | 451 | * information and let the hardware specific code |
| 452 | 452 | * return what is possible given the options |
| 453 | 453 | */ |
| 454 | + mmc_host_clk_hold(card->host); | |
| 454 | 455 | drive_strength = card->host->ops->select_drive_strength( |
| 455 | 456 | card->sw_caps.uhs_max_dtr, |
| 456 | 457 | host_drv_type, card_drv_type); |
| 458 | + mmc_host_clk_release(card->host); | |
| 457 | 459 | |
| 458 | 460 | err = mmc_sd_switch(card, 1, 2, drive_strength, status); |
| 459 | 461 | if (err) |
| @@ -660,9 +662,12 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card) · 200 unmodified lines | ||
| 660 | 662 | goto out; |
| 661 | 663 | |
| 662 | 664 | /* SPI mode doesn't define CMD19 */ |
| 663 | − if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning) | |
| 665 | + if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning) { | |
| 666 | + mmc_host_clk_hold(card->host); | |
| 664 | 667 | err = card->host->ops->execute_tuning(card->host, |
| 665 | 668 | MMC_SEND_TUNING_BLOCK); |
| 669 | + mmc_host_clk_release(card->host); | |
| 670 | + } | |
| 666 | 671 | |
| 667 | 672 | out: |
| 668 | 673 | kfree(status); |
| @@ -850,8 +855,11 @@ int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card, · 181 unmodified lines | ||
| 850 | 855 | if (!reinit) { |
| 851 | 856 | int ro = -1; |
| 852 | 857 | |
| 853 | − if (host->ops->get_ro) | |
| 858 | + if (host->ops->get_ro) { | |
| 859 | + mmc_host_clk_hold(card->host); | |
| 854 | 860 | ro = host->ops->get_ro(host); |
| 861 | + mmc_host_clk_release(card->host); | |
| 862 | + } | |
| 855 | 863 | |
| 856 | 864 | if (ro < 0) { |
| 857 | 865 | pr_warning("%s: host does not " |
| @@ -967,8 +975,11 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, · 109 unmodified lines | ||
| 967 | 975 | * Since initialization is now complete, enable preset |
| 968 | 976 | * value registers for UHS-I cards. |
| 969 | 977 | */ |
| 970 | − if (host->ops->enable_preset_value) | |
| 978 | + if (host->ops->enable_preset_value) { | |
| 979 | + mmc_host_clk_hold(card->host); | |
| 971 | 980 | host->ops->enable_preset_value(host, true); |
| 981 | + mmc_host_clk_release(card->host); | |
| 982 | + } | |
| 972 | 983 | } else { |
| 973 | 984 | /* |
| 974 | 985 | * Attempt to change to high-speed (if supported) |
| @@ -1151,8 +1162,11 @@ int mmc_attach_sd(struct mmc_host *host) · 176 unmodified lines | ||
| 1151 | 1162 | return err; |
| 1152 | 1163 | |
| 1153 | 1164 | /* Disable preset value enable if already set since last time */ |
| 1154 | − if (host->ops->enable_preset_value) | |
| 1165 | + if (host->ops->enable_preset_value) { | |
| 1166 | + mmc_host_clk_hold(host); | |
| 1155 | 1167 | host->ops->enable_preset_value(host, false); |
| 1168 | + mmc_host_clk_release(host); | |
| 1169 | + } | |
| 1156 | 1170 | |
| 1157 | 1171 | err = mmc_send_app_op_cond(host, 0, &ocr); |
| 1158 | 1172 | if (err) |
| @@ -98,10 +98,11 @@ fail: · 97 unmodified lines | ||
| 98 | 98 | return ret; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | −static int sdio_read_cccr(struct mmc_card *card) | |
| 101 | +static int sdio_read_cccr(struct mmc_card *card, u32 ocr) | |
| 102 | 102 | { |
| 103 | 103 | int ret; |
| 104 | 104 | int cccr_vsn; |
| 105 | + int uhs = ocr & R4_18V_PRESENT; | |
| 105 | 106 | unsigned char data; |
| 106 | 107 | unsigned char speed; |
| 107 | 108 | |
| @@ -149,7 +150,7 @@ static int sdio_read_cccr(struct mmc_card *card) · 41 unmodified lines | ||
| 149 | 150 | card->scr.sda_spec3 = 0; |
| 150 | 151 | card->sw_caps.sd3_bus_mode = 0; |
| 151 | 152 | card->sw_caps.sd3_drv_type = 0; |
| 152 | − if (cccr_vsn >= SDIO_CCCR_REV_3_00) { | |
| 153 | + if (cccr_vsn >= SDIO_CCCR_REV_3_00 && uhs) { | |
| 153 | 154 | card->scr.sda_spec3 = 1; |
| 154 | 155 | ret = mmc_io_rw_direct(card, 0, 0, |
| 155 | 156 | SDIO_CCCR_UHS, 0, &data); |
| @@ -712,7 +713,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, · 556 unmodified lines | ||
| 712 | 713 | /* |
| 713 | 714 | * Read the common registers. |
| 714 | 715 | */ |
| 715 | − err = sdio_read_cccr(card); | |
| 716 | + err = sdio_read_cccr(card, ocr); | |
| 716 | 717 | if (err) |
| 717 | 718 | goto remove; |
| 718 | 719 | |
| @@ -146,15 +146,21 @@ static int sdio_irq_thread(void *_host) · 145 unmodified lines | ||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | set_current_state(TASK_INTERRUPTIBLE); |
| 149 | − if (host->caps & MMC_CAP_SDIO_IRQ) | |
| 149 | + if (host->caps & MMC_CAP_SDIO_IRQ) { | |
| 150 | + mmc_host_clk_hold(host); | |
| 150 | 151 | host->ops->enable_sdio_irq(host, 1); |
| 152 | + mmc_host_clk_release(host); | |
| 153 | + } | |
| 151 | 154 | if (!kthread_should_stop()) |
| 152 | 155 | schedule_timeout(period); |
| 153 | 156 | set_current_state(TASK_RUNNING); |
| 154 | 157 | } while (!kthread_should_stop()); |
| 155 | 158 | |
| 156 | − if (host->caps & MMC_CAP_SDIO_IRQ) | |
| 159 | + if (host->caps & MMC_CAP_SDIO_IRQ) { | |
| 160 | + mmc_host_clk_hold(host); | |
| 157 | 161 | host->ops->enable_sdio_irq(host, 0); |
| 162 | + mmc_host_clk_release(host); | |
| 163 | + } | |
| 158 | 164 | |
| 159 | 165 | pr_debug("%s: IRQ thread exiting with code %d\n", |
| 160 | 166 | mmc_hostname(host), ret); |
| @@ -477,7 +477,6 @@ config MMC_SDHI · 476 unmodified lines | ||
| 477 | 477 | config MMC_CB710 |
| 478 | 478 | tristate "ENE CB710 MMC/SD Interface support" |
| 479 | 479 | depends on PCI |
| 480 | − select MISC_DEVICES | |
| 481 | 480 | select CB710_CORE |
| 482 | 481 | help |
| 483 | 482 | This option enables support for MMC/SD part of ENE CB710/720 Flash |
| @@ -969,11 +969,14 @@ static void atmci_start_request(struct atmel_mci *host, · 968 unmodified lines | ||
| 969 | 969 | host->data_status = 0; |
| 970 | 970 | |
| 971 | 971 | if (host->need_reset) { |
| 972 | + iflags = atmci_readl(host, ATMCI_IMR); | |
| 973 | + iflags &= (ATMCI_SDIOIRQA | ATMCI_SDIOIRQB); | |
| 972 | 974 | atmci_writel(host, ATMCI_CR, ATMCI_CR_SWRST); |
| 973 | 975 | atmci_writel(host, ATMCI_CR, ATMCI_CR_MCIEN); |
| 974 | 976 | atmci_writel(host, ATMCI_MR, host->mode_reg); |
| 975 | 977 | if (host->caps.has_cfg_reg) |
| 976 | 978 | atmci_writel(host, ATMCI_CFG, host->cfg_reg); |
| 979 | + atmci_writel(host, ATMCI_IER, iflags); | |
| 977 | 980 | host->need_reset = false; |
| 978 | 981 | } |
| 979 | 982 | atmci_writel(host, ATMCI_SDCR, slot->sdc_reg); |
| @@ -22,7 +22,6 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <linux/ioport.h> |
| 23 | 23 | #include <linux/module.h> |
| 24 | 24 | #include <linux/platform_device.h> |
| 25 | −#include <linux/scatterlist.h> | |
| 26 | 25 | #include <linux/seq_file.h> |
| 27 | 26 | #include <linux/slab.h> |
| 28 | 27 | #include <linux/stat.h> |
| @@ -502,8 +501,14 @@ static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data) · 473 unmodified lines | ||
| 502 | 501 | host->dir_status = DW_MCI_SEND_STATUS; |
| 503 | 502 | |
| 504 | 503 | if (dw_mci_submit_data_dma(host, data)) { |
| 504 | + int flags = SG_MITER_ATOMIC; | |
| 505 | + if (host->data->flags & MMC_DATA_READ) | |
| 506 | + flags |= SG_MITER_TO_SG; | |
| 507 | + else | |
| 508 | + flags |= SG_MITER_FROM_SG; | |
| 509 | + | |
| 510 | + sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); | |
| 505 | 511 | host->sg = data->sg; |
| 506 | − host->pio_offset = 0; | |
| 507 | 512 | host->part_buf_start = 0; |
| 508 | 513 | host->part_buf_count = 0; |
| 509 | 514 | |
| @@ -972,6 +977,7 @@ static void dw_mci_tasklet_func(unsigned long priv) · 462 unmodified lines | ||
| 972 | 977 | * generates a block interrupt, hence setting |
| 973 | 978 | * the scatter-gather pointer to NULL. |
| 974 | 979 | */ |
| 980 | + sg_miter_stop(&host->sg_miter); | |
| 975 | 981 | host->sg = NULL; |
| 976 | 982 | ctrl = mci_readl(host, CTRL); |
| 977 | 983 | ctrl |= SDMMC_CTRL_FIFO_RESET; |
| @@ -1311,54 +1317,44 @@ static void dw_mci_pull_data(struct dw_mci *host, void *buf, int cnt) · 333 unmodified lines | ||
| 1311 | 1317 | |
| 1312 | 1318 | static void dw_mci_read_data_pio(struct dw_mci *host) |
| 1313 | 1319 | { |
| 1314 | − struct scatterlist *sg = host->sg; | |
| 1315 | − void *buf = sg_virt(sg); | |
| 1316 | − unsigned int offset = host->pio_offset; | |
| 1320 | + struct sg_mapping_iter *sg_miter = &host->sg_miter; | |
| 1321 | + void *buf; | |
| 1322 | + unsigned int offset; | |
| 1317 | 1323 | struct mmc_data *data = host->data; |
| 1318 | 1324 | int shift = host->data_shift; |
| 1319 | 1325 | u32 status; |
| 1320 | 1326 | unsigned int nbytes = 0, len; |
| 1327 | + unsigned int remain, fcnt; | |
| 1321 | 1328 | |
| 1322 | 1329 | do { |
| 1323 | − len = host->part_buf_count + | |
| 1324 | − (SDMMC_GET_FCNT(mci_readl(host, STATUS)) << shift); | |
| 1325 | − if (offset + len <= sg->length) { | |
| 1330 | + if (!sg_miter_next(sg_miter)) | |
| 1331 | + goto done; | |
| 1332 | + | |
| 1333 | + host->sg = sg_miter->__sg; | |
| 1334 | + buf = sg_miter->addr; | |
| 1335 | + remain = sg_miter->length; | |
| 1336 | + offset = 0; | |
| 1337 | + | |
| 1338 | + do { | |
| 1339 | + fcnt = (SDMMC_GET_FCNT(mci_readl(host, STATUS)) | |
| 1340 | + << shift) + host->part_buf_count; | |
| 1341 | + len = min(remain, fcnt); | |
| 1342 | + if (!len) | |
| 1343 | + break; | |
| 1326 | 1344 | dw_mci_pull_data(host, (void *)(buf + offset), len); |
| 1327 | − | |
| 1328 | 1345 | offset += len; |
| 1329 | 1346 | nbytes += len; |
| 1330 | − | |
| 1331 | − if (offset == sg->length) { | |
| 1332 | − flush_dcache_page(sg_page(sg)); | |
| 1333 | − host->sg = sg = sg_next(sg); | |
| 1334 | − if (!sg) | |
| 1335 | − goto done; | |
| 1336 | − | |
| 1337 | − offset = 0; | |
| 1338 | − buf = sg_virt(sg); | |
| 1339 | − } | |
| 1340 | − } else { | |
| 1341 | − unsigned int remaining = sg->length - offset; | |
| 1342 | − dw_mci_pull_data(host, (void *)(buf + offset), | |
| 1343 | − remaining); | |
| 1344 | − nbytes += remaining; | |
| 1345 | − | |
| 1346 | − flush_dcache_page(sg_page(sg)); | |
| 1347 | − host->sg = sg = sg_next(sg); | |
| 1348 | − if (!sg) | |
| 1349 | − goto done; | |
| 1350 | − | |
| 1351 | − offset = len - remaining; | |
| 1352 | − buf = sg_virt(sg); | |
| 1353 | − dw_mci_pull_data(host, buf, offset); | |
| 1354 | − nbytes += offset; | |
| 1355 | − } | |
| 1347 | + remain -= len; | |
| 1348 | + } while (remain); | |
| 1349 | + sg_miter->consumed = offset; | |
| 1356 | 1350 | |
| 1357 | 1351 | status = mci_readl(host, MINTSTS); |
| 1358 | 1352 | mci_writel(host, RINTSTS, SDMMC_INT_RXDR); |
| 1359 | 1353 | if (status & DW_MCI_DATA_ERROR_FLAGS) { |
| 1360 | 1354 | host->data_status = status; |
| 1361 | 1355 | data->bytes_xfered += nbytes; |
| 1356 | + sg_miter_stop(sg_miter); | |
| 1357 | + host->sg = NULL; | |
| 1362 | 1358 | smp_wmb(); |
| 1363 | 1359 | |
| 1364 | 1360 | set_bit(EVENT_DATA_ERROR, &host->pending_events); |
| @@ -1367,65 +1363,66 @@ static void dw_mci_read_data_pio(struct dw_mci *host) · 2 unmodified lines | ||
| 1367 | 1363 | return; |
| 1368 | 1364 | } |
| 1369 | 1365 | } while (status & SDMMC_INT_RXDR); /*if the RXDR is ready read again*/ |
| 1370 | − host->pio_offset = offset; | |
| 1371 | 1366 | data->bytes_xfered += nbytes; |
| 1367 | + | |
| 1368 | + if (!remain) { | |
| 1369 | + if (!sg_miter_next(sg_miter)) | |
| 1370 | + goto done; | |
| 1371 | + sg_miter->consumed = 0; | |
| 1372 | + } | |
| 1373 | + sg_miter_stop(sg_miter); | |
| 1372 | 1374 | return; |
| 1373 | 1375 | |
| 1374 | 1376 | done: |
| 1375 | 1377 | data->bytes_xfered += nbytes; |
| 1378 | + sg_miter_stop(sg_miter); | |
| 1379 | + host->sg = NULL; | |
| 1376 | 1380 | smp_wmb(); |
| 1377 | 1381 | set_bit(EVENT_XFER_COMPLETE, &host->pending_events); |
| 1378 | 1382 | } |
| 1379 | 1383 | |
| 1380 | 1384 | static void dw_mci_write_data_pio(struct dw_mci *host) |
| 1381 | 1385 | { |
| 1382 | − struct scatterlist *sg = host->sg; | |
| 1383 | − void *buf = sg_virt(sg); | |
| 1384 | − unsigned int offset = host->pio_offset; | |
| 1386 | + struct sg_mapping_iter *sg_miter = &host->sg_miter; | |
| 1387 | + void *buf; | |
| 1388 | + unsigned int offset; | |
| 1385 | 1389 | struct mmc_data *data = host->data; |
| 1386 | 1390 | int shift = host->data_shift; |
| 1387 | 1391 | u32 status; |
| 1388 | 1392 | unsigned int nbytes = 0, len; |
| 1393 | + unsigned int fifo_depth = host->fifo_depth; | |
| 1394 | + unsigned int remain, fcnt; | |
| 1389 | 1395 | |
| 1390 | 1396 | do { |
| 1391 | − len = ((host->fifo_depth - | |
| 1392 | − SDMMC_GET_FCNT(mci_readl(host, STATUS))) << shift) | |
| 1393 | − - host->part_buf_count; | |
| 1394 | − if (offset + len <= sg->length) { | |
| 1397 | + if (!sg_miter_next(sg_miter)) | |
| 1398 | + goto done; | |
| 1399 | + | |
| 1400 | + host->sg = sg_miter->__sg; | |
| 1401 | + buf = sg_miter->addr; | |
| 1402 | + remain = sg_miter->length; | |
| 1403 | + offset = 0; | |
| 1404 | + | |
| 1405 | + do { | |
| 1406 | + fcnt = ((fifo_depth - | |
| 1407 | + SDMMC_GET_FCNT(mci_readl(host, STATUS))) | |
| 1408 | + << shift) - host->part_buf_count; | |
| 1409 | + len = min(remain, fcnt); | |
| 1410 | + if (!len) | |
| 1411 | + break; | |
| 1395 | 1412 | host->push_data(host, (void *)(buf + offset), len); |
| 1396 | − | |
| 1397 | 1413 | offset += len; |
| 1398 | 1414 | nbytes += len; |
| 1399 | − if (offset == sg->length) { | |
| 1400 | − host->sg = sg = sg_next(sg); | |
| 1401 | − if (!sg) | |
| 1402 | − goto done; | |
| 1403 | − | |
| 1404 | − offset = 0; | |
| 1405 | − buf = sg_virt(sg); | |
| 1406 | − } | |
| 1407 | − } else { | |
| 1408 | − unsigned int remaining = sg->length - offset; | |
| 1409 | − | |
| 1410 | − host->push_data(host, (void *)(buf + offset), | |
| 1411 | − remaining); | |
| 1412 | − nbytes += remaining; | |
| 1413 | − | |
| 1414 | − host->sg = sg = sg_next(sg); | |
| 1415 | − if (!sg) | |
| 1416 | − goto done; | |
| 1417 | − | |
| 1418 | − offset = len - remaining; | |
| 1419 | − buf = sg_virt(sg); | |
| 1420 | − host->push_data(host, (void *)buf, offset); | |
| 1421 | − nbytes += offset; | |
| 1422 | − } | |
| 1415 | + remain -= len; | |
| 1416 | + } while (remain); | |
| 1417 | + sg_miter->consumed = offset; | |
| 1423 | 1418 | |
| 1424 | 1419 | status = mci_readl(host, MINTSTS); |
| 1425 | 1420 | mci_writel(host, RINTSTS, SDMMC_INT_TXDR); |
| 1426 | 1421 | if (status & DW_MCI_DATA_ERROR_FLAGS) { |
| 1427 | 1422 | host->data_status = status; |
| 1428 | 1423 | data->bytes_xfered += nbytes; |
| 1424 | + sg_miter_stop(sg_miter); | |
| 1425 | + host->sg = NULL; | |
| 1429 | 1426 | |
| 1430 | 1427 | smp_wmb(); |
| 1431 | 1428 | |
| @@ -1435,12 +1432,20 @@ static void dw_mci_write_data_pio(struct dw_mci *host) · 3 unmodified lines | ||
| 1435 | 1432 | return; |
| 1436 | 1433 | } |
| 1437 | 1434 | } while (status & SDMMC_INT_TXDR); /* if TXDR write again */ |
| 1438 | − host->pio_offset = offset; | |
| 1439 | 1435 | data->bytes_xfered += nbytes; |
| 1436 | + | |
| 1437 | + if (!remain) { | |
| 1438 | + if (!sg_miter_next(sg_miter)) | |
| 1439 | + goto done; | |
| 1440 | + sg_miter->consumed = 0; | |
| 1441 | + } | |
| 1442 | + sg_miter_stop(sg_miter); | |
| 1440 | 1443 | return; |
| 1441 | 1444 | |
| 1442 | 1445 | done: |
| 1443 | 1446 | data->bytes_xfered += nbytes; |
| 1447 | + sg_miter_stop(sg_miter); | |
| 1448 | + host->sg = NULL; | |
| 1444 | 1449 | smp_wmb(); |
| 1445 | 1450 | set_bit(EVENT_XFER_COMPLETE, &host->pending_events); |
| 1446 | 1451 | } |
| @@ -1643,6 +1648,7 @@ static void dw_mci_work_routine_card(struct work_struct *work) · 196 unmodified lines | ||
| 1643 | 1648 | * block interrupt, hence setting the |
| 1644 | 1649 | * scatter-gather pointer to NULL. |
| 1645 | 1650 | */ |
| 1651 | + sg_miter_stop(&host->sg_miter); | |
| 1646 | 1652 | host->sg = NULL; |
| 1647 | 1653 | |
| 1648 | 1654 | ctrl = mci_readl(host, CTRL); |
| @@ -113,8 +113,8 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) · 112 unmodified lines | ||
| 113 | 113 | const int j = i * 2; |
| 114 | 114 | u32 mask; |
| 115 | 115 | |
| 116 | − mask = mmc_vddrange_to_ocrmask(voltage_ranges[j], | |
| 117 | − voltage_ranges[j + 1]); | |
| 116 | + mask = mmc_vddrange_to_ocrmask(be32_to_cpu(voltage_ranges[j]), | |
| 117 | + be32_to_cpu(voltage_ranges[j + 1])); | |
| 118 | 118 | if (!mask) { |
| 119 | 119 | ret = -EINVAL; |
| 120 | 120 | dev_err(dev, "OF: voltage-range #%d is invalid\n", i); |
| @@ -38,6 +38,23 @@ static u8 esdhc_readb(struct sdhci_host *host, int reg) · 37 unmodified lines | ||
| 38 | 38 | int base = reg & ~0x3; |
| 39 | 39 | int shift = (reg & 0x3) * 8; |
| 40 | 40 | u8 ret = (in_be32(host->ioaddr + base) >> shift) & 0xff; |
| 41 | + | |
| 42 | + /* | |
| 43 | + * "DMA select" locates at offset 0x28 in SD specification, but on | |
| 44 | + * P5020 or P3041, it locates at 0x29. | |
| 45 | + */ | |
| 46 | + if (reg == SDHCI_HOST_CONTROL) { | |
| 47 | + u32 dma_bits; | |
| 48 | + | |
| 49 | + dma_bits = in_be32(host->ioaddr + reg); | |
| 50 | + /* DMA select is 22,23 bits in Protocol Control Register */ | |
| 51 | + dma_bits = (dma_bits >> 5) & SDHCI_CTRL_DMA_MASK; | |
| 52 | + | |
| 53 | + /* fixup the result */ | |
| 54 | + ret &= ~SDHCI_CTRL_DMA_MASK; | |
| 55 | + ret |= dma_bits; | |
| 56 | + } | |
| 57 | + | |
| 41 | 58 | return ret; |
| 42 | 59 | } |
| 43 | 60 | |
| @@ -56,6 +73,21 @@ static void esdhc_writew(struct sdhci_host *host, u16 val, int reg) · 12 unmodified lines | ||
| 56 | 73 | |
| 57 | 74 | static void esdhc_writeb(struct sdhci_host *host, u8 val, int reg) |
| 58 | 75 | { |
| 76 | + /* | |
| 77 | + * "DMA select" location is offset 0x28 in SD specification, but on | |
| 78 | + * P5020 or P3041, it's located at 0x29. | |
| 79 | + */ | |
| 80 | + if (reg == SDHCI_HOST_CONTROL) { | |
| 81 | + u32 dma_bits; | |
| 82 | + | |
| 83 | + /* DMA select is 22,23 bits in Protocol Control Register */ | |
| 84 | + dma_bits = (val & SDHCI_CTRL_DMA_MASK) << 5; | |
| 85 | + clrsetbits_be32(host->ioaddr + reg , SDHCI_CTRL_DMA_MASK << 5, | |
| 86 | + dma_bits); | |
| 87 | + val &= ~SDHCI_CTRL_DMA_MASK; | |
| 88 | + val |= in_be32(host->ioaddr + reg) & SDHCI_CTRL_DMA_MASK; | |
| 89 | + } | |
| 90 | + | |
| 59 | 91 | /* Prevent SDHCI core from writing reserved bits (e.g. HISPD). */ |
| 60 | 92 | if (reg == SDHCI_HOST_CONTROL) |
| 61 | 93 | val &= ~ESDHC_HOST_CONTROL_RES; |
| @@ -250,7 +250,7 @@ static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot) · 249 unmodified lines | ||
| 250 | 250 | |
| 251 | 251 | static int mfd_sdio_probe_slot(struct sdhci_pci_slot *slot) |
| 252 | 252 | { |
| 253 | − slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD; | |
| 253 | + slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE; | |
| 254 | 254 | return 0; |
| 255 | 255 | } |
| 256 | 256 | |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | * sdhci-pltfm.c Support for SDHCI platform devices |
| 3 | 3 | * Copyright (c) 2009 Intel Corporation |
| 4 | 4 | * |
| 5 | − * Copyright (c) 2007 Freescale Semiconductor, Inc. | |
| 5 | + * Copyright (c) 2007, 2011 Freescale Semiconductor, Inc. | |
| 6 | 6 | * Copyright (c) 2009 MontaVista Software, Inc. |
| 7 | 7 | * |
| 8 | 8 | * Authors: Xiaobo Xie <X.Xie@freescale.com> |
| @@ -71,6 +71,14 @@ void sdhci_get_of_property(struct platform_device *pdev) · 62 unmodified lines | ||
| 71 | 71 | if (sdhci_of_wp_inverted(np)) |
| 72 | 72 | host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT; |
| 73 | 73 | |
| 74 | + if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc")) | |
| 75 | + host->quirks |= SDHCI_QUIRK_BROKEN_DMA; | |
| 76 | + | |
| 77 | + if (of_device_is_compatible(np, "fsl,p2020-esdhc") || | |
| 78 | + of_device_is_compatible(np, "fsl,p1010-esdhc") || | |
| 79 | + of_device_is_compatible(np, "fsl,mpc8536-esdhc")) | |
| 80 | + host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; | |
| 81 | + | |
| 74 | 82 | clk = of_get_property(np, "clock-frequency", &size); |
| 75 | 83 | if (clk && size == sizeof(*clk) && *clk) |
| 76 | 84 | pltfm_host->clock = be32_to_cpup(clk); |
| @@ -1327,7 +1327,7 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev) · 1326 unmodified lines | ||
| 1327 | 1327 | if (ret < 0) |
| 1328 | 1328 | goto clean_up2; |
| 1329 | 1329 | |
| 1330 | − mmc_add_host(mmc); | |
| 1330 | + INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work); | |
| 1331 | 1331 | |
| 1332 | 1332 | sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL); |
| 1333 | 1333 | |
| @@ -1338,22 +1338,24 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev) · 4 unmodified lines | ||
| 1338 | 1338 | } |
| 1339 | 1339 | ret = request_threaded_irq(irq[1], sh_mmcif_intr, sh_mmcif_irqt, 0, "sh_mmc:int", host); |
| 1340 | 1340 | if (ret) { |
| 1341 | − free_irq(irq[0], host); | |
| 1342 | 1341 | dev_err(&pdev->dev, "request_irq error (sh_mmc:int)\n"); |
| 1343 | − goto clean_up3; | |
| 1342 | + goto clean_up4; | |
| 1344 | 1343 | } |
| 1345 | 1344 | |
| 1346 | − INIT_DELAYED_WORK(&host->timeout_work, mmcif_timeout_work); | |
| 1347 | − | |
| 1348 | − mmc_detect_change(host->mmc, 0); | |
| 1345 | + ret = mmc_add_host(mmc); | |
| 1346 | + if (ret < 0) | |
| 1347 | + goto clean_up5; | |
| 1349 | 1348 | |
| 1350 | 1349 | dev_info(&pdev->dev, "driver version %s\n", DRIVER_VERSION); |
| 1351 | 1350 | dev_dbg(&pdev->dev, "chip ver H'%04x\n", |
| 1352 | 1351 | sh_mmcif_readl(host->addr, MMCIF_CE_VERSION) & 0x0000ffff); |
| 1353 | 1352 | return ret; |
| 1354 | 1353 | |
| 1354 | +clean_up5: | |
| 1355 | + free_irq(irq[1], host); | |
| 1356 | +clean_up4: | |
| 1357 | + free_irq(irq[0], host); | |
| 1355 | 1358 | clean_up3: |
| 1356 | − mmc_remove_host(mmc); | |
| 1357 | 1359 | pm_runtime_suspend(&pdev->dev); |
| 1358 | 1360 | clean_up2: |
| 1359 | 1361 | pm_runtime_disable(&pdev->dev); |
| @@ -20,8 +20,8 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/mmc/tmio.h> |
| 21 | 21 | #include <linux/mutex.h> |
| 22 | 22 | #include <linux/pagemap.h> |
| 23 | −#include <linux/spinlock.h> | |
| 24 | 23 | #include <linux/scatterlist.h> |
| 24 | +#include <linux/spinlock.h> | |
| 25 | 25 | |
| 26 | 26 | /* Definitions for values the CTRL_SDIO_STATUS register can take. */ |
| 27 | 27 | #define TMIO_SDIO_STAT_IOIRQ 0x0001 |
| @@ -120,6 +120,7 @@ void tmio_mmc_start_dma(struct tmio_mmc_host *host, struct mmc_data *data); · 92 unmodified lines | ||
| 120 | 120 | void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable); |
| 121 | 121 | void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdata); |
| 122 | 122 | void tmio_mmc_release_dma(struct tmio_mmc_host *host); |
| 123 | +void tmio_mmc_abort_dma(struct tmio_mmc_host *host); | |
| 123 | 124 | #else |
| 124 | 125 | static inline void tmio_mmc_start_dma(struct tmio_mmc_host *host, |
| 125 | 126 | struct mmc_data *data) |
| @@ -140,6 +141,10 @@ static inline void tmio_mmc_request_dma(struct tmio_mmc_host *host, · 14 unmodified lines | ||
| 140 | 141 | static inline void tmio_mmc_release_dma(struct tmio_mmc_host *host) |
| 141 | 142 | { |
| 142 | 143 | } |
| 144 | + | |
| 145 | +static inline void tmio_mmc_abort_dma(struct tmio_mmc_host *host) | |
| 146 | +{ | |
| 147 | +} | |
| 143 | 148 | #endif |
| 144 | 149 | |
| 145 | 150 | #ifdef CONFIG_PM |
| @@ -34,6 +34,18 @@ void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable) · 33 unmodified lines | ||
| 34 | 34 | #endif |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | +void tmio_mmc_abort_dma(struct tmio_mmc_host *host) | |
| 38 | +{ | |
| 39 | + tmio_mmc_enable_dma(host, false); | |
| 40 | + | |
| 41 | + if (host->chan_rx) | |
| 42 | + dmaengine_terminate_all(host->chan_rx); | |
| 43 | + if (host->chan_tx) | |
| 44 | + dmaengine_terminate_all(host->chan_tx); | |
| 45 | + | |
| 46 | + tmio_mmc_enable_dma(host, true); | |
| 47 | +} | |
| 48 | + | |
| 37 | 49 | static void tmio_mmc_start_dma_rx(struct tmio_mmc_host *host) |
| 38 | 50 | { |
| 39 | 51 | struct scatterlist *sg = host->sg_ptr, *sg_tmp; |
| @@ -41,8 +41,8 @@ · 40 unmodified lines | ||
| 41 | 41 | #include <linux/platform_device.h> |
| 42 | 42 | #include <linux/pm_runtime.h> |
| 43 | 43 | #include <linux/scatterlist.h> |
| 44 | −#include <linux/workqueue.h> | |
| 45 | 44 | #include <linux/spinlock.h> |
| 45 | +#include <linux/workqueue.h> | |
| 46 | 46 | |
| 47 | 47 | #include "tmio_mmc.h" |
| 48 | 48 | |
| @@ -246,6 +246,7 @@ static void tmio_mmc_reset_work(struct work_struct *work) · 197 unmodified lines | ||
| 246 | 246 | /* Ready for new calls */ |
| 247 | 247 | host->mrq = NULL; |
| 248 | 248 | |
| 249 | + tmio_mmc_abort_dma(host); | |
| 249 | 250 | mmc_request_done(host->mmc, mrq); |
| 250 | 251 | } |
| 251 | 252 | |
| @@ -272,6 +273,9 @@ static void tmio_mmc_finish_request(struct tmio_mmc_host *host) · 20 unmodified lines | ||
| 272 | 273 | host->mrq = NULL; |
| 273 | 274 | spin_unlock_irqrestore(&host->lock, flags); |
| 274 | 275 | |
| 276 | + if (mrq->cmd->error || (mrq->data && mrq->data->error)) | |
| 277 | + tmio_mmc_abort_dma(host); | |
| 278 | + | |
| 275 | 279 | mmc_request_done(host->mmc, mrq); |
| 276 | 280 | } |
| 277 | 281 | |
| @@ -119,7 +119,7 @@ static int mtd_cls_suspend(struct device *dev, pm_message_t state) · 118 unmodified lines | ||
| 119 | 119 | { |
| 120 | 120 | struct mtd_info *mtd = dev_get_drvdata(dev); |
| 121 | 121 | |
| 122 | − return mtd_suspend(mtd); | |
| 122 | + return mtd ? mtd_suspend(mtd) : 0; | |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | static int mtd_cls_resume(struct device *dev) |
| @@ -161,6 +161,37 @@ static int atmel_nand_device_ready(struct mtd_info *mtd) · 160 unmodified lines | ||
| 161 | 161 | !!host->board->rdy_pin_active_low; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | +/* | |
| 165 | + * Minimal-overhead PIO for data access. | |
| 166 | + */ | |
| 167 | +static void atmel_read_buf8(struct mtd_info *mtd, u8 *buf, int len) | |
| 168 | +{ | |
| 169 | + struct nand_chip *nand_chip = mtd->priv; | |
| 170 | + | |
| 171 | + __raw_readsb(nand_chip->IO_ADDR_R, buf, len); | |
| 172 | +} | |
| 173 | + | |
| 174 | +static void atmel_read_buf16(struct mtd_info *mtd, u8 *buf, int len) | |
| 175 | +{ | |
| 176 | + struct nand_chip *nand_chip = mtd->priv; | |
| 177 | + | |
| 178 | + __raw_readsw(nand_chip->IO_ADDR_R, buf, len / 2); | |
| 179 | +} | |
| 180 | + | |
| 181 | +static void atmel_write_buf8(struct mtd_info *mtd, const u8 *buf, int len) | |
| 182 | +{ | |
| 183 | + struct nand_chip *nand_chip = mtd->priv; | |
| 184 | + | |
| 185 | + __raw_writesb(nand_chip->IO_ADDR_W, buf, len); | |
| 186 | +} | |
| 187 | + | |
| 188 | +static void atmel_write_buf16(struct mtd_info *mtd, const u8 *buf, int len) | |
| 189 | +{ | |
| 190 | + struct nand_chip *nand_chip = mtd->priv; | |
| 191 | + | |
| 192 | + __raw_writesw(nand_chip->IO_ADDR_W, buf, len / 2); | |
| 193 | +} | |
| 194 | + | |
| 164 | 195 | static void dma_complete_func(void *completion) |
| 165 | 196 | { |
| 166 | 197 | complete(completion); |
| @@ -235,27 +266,33 @@ err_buf: · 68 unmodified lines | ||
| 235 | 266 | static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len) |
| 236 | 267 | { |
| 237 | 268 | struct nand_chip *chip = mtd->priv; |
| 269 | + struct atmel_nand_host *host = chip->priv; | |
| 238 | 270 | |
| 239 | 271 | if (use_dma && len > mtd->oobsize) |
| 240 | 272 | /* only use DMA for bigger than oob size: better performances */ |
| 241 | 273 | if (atmel_nand_dma_op(mtd, buf, len, 1) == 0) |
| 242 | 274 | return; |
| 243 | 275 | |
| 244 | − /* if no DMA operation possible, use PIO */ | |
| 245 | − memcpy_fromio(buf, chip->IO_ADDR_R, len); | |
| 276 | + if (host->board->bus_width_16) | |
| 277 | + atmel_read_buf16(mtd, buf, len); | |
| 278 | + else | |
| 279 | + atmel_read_buf8(mtd, buf, len); | |
| 246 | 280 | } |
| 247 | 281 | |
| 248 | 282 | static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len) |
| 249 | 283 | { |
| 250 | 284 | struct nand_chip *chip = mtd->priv; |
| 285 | + struct atmel_nand_host *host = chip->priv; | |
| 251 | 286 | |
| 252 | 287 | if (use_dma && len > mtd->oobsize) |
| 253 | 288 | /* only use DMA for bigger than oob size: better performances */ |
| 254 | 289 | if (atmel_nand_dma_op(mtd, (void *)buf, len, 0) == 0) |
| 255 | 290 | return; |
| 256 | 291 | |
| 257 | − /* if no DMA operation possible, use PIO */ | |
| 258 | − memcpy_toio(chip->IO_ADDR_W, buf, len); | |
| 292 | + if (host->board->bus_width_16) | |
| 293 | + atmel_write_buf16(mtd, buf, len); | |
| 294 | + else | |
| 295 | + atmel_write_buf8(mtd, buf, len); | |
| 259 | 296 | } |
| 260 | 297 | |
| 261 | 298 | /* |
| @@ -69,17 +69,19 @@ static int clear_poll_bit(void __iomem *addr, u32 mask) · 68 unmodified lines | ||
| 69 | 69 | * [1] enable the module. |
| 70 | 70 | * [2] reset the module. |
| 71 | 71 | * |
| 72 | − * In most of the cases, it's ok. But there is a hardware bug in the BCH block. | |
| 72 | + * In most of the cases, it's ok. | |
| 73 | + * But in MX23, there is a hardware bug in the BCH block (see erratum #2847). | |
| 73 | 74 | * If you try to soft reset the BCH block, it becomes unusable until |
| 74 | 75 | * the next hard reset. This case occurs in the NAND boot mode. When the board |
| 75 | 76 | * boots by NAND, the ROM of the chip will initialize the BCH blocks itself. |
| 76 | 77 | * So If the driver tries to reset the BCH again, the BCH will not work anymore. |
| 77 | − * You will see a DMA timeout in this case. | |
| 78 | + * You will see a DMA timeout in this case. The bug has been fixed | |
| 79 | + * in the following chips, such as MX28. | |
| 78 | 80 | * |
| 79 | 81 | * To avoid this bug, just add a new parameter `just_enable` for |
| 80 | 82 | * the mxs_reset_block(), and rewrite it here. |
| 81 | 83 | */ |
| 82 | −int gpmi_reset_block(void __iomem *reset_addr, bool just_enable) | |
| 84 | +static int gpmi_reset_block(void __iomem *reset_addr, bool just_enable) | |
| 83 | 85 | { |
| 84 | 86 | int ret; |
| 85 | 87 | int timeout = 0x400; |
| @@ -206,7 +208,15 @@ int bch_set_geometry(struct gpmi_nand_data *this) · 120 unmodified lines | ||
| 206 | 208 | if (ret) |
| 207 | 209 | goto err_out; |
| 208 | 210 | |
| 209 | − ret = gpmi_reset_block(r->bch_regs, true); | |
| 211 | + /* | |
| 212 | + * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this | |
| 213 | + * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. | |
| 214 | + * On the other hand, the MX28 needs the reset, because one case has been | |
| 215 | + * seen where the BCH produced ECC errors constantly after 10000 | |
| 216 | + * consecutive reboots. The latter case has not been seen on the MX23 yet, | |
| 217 | + * still we don't know if it could happen there as well. | |
| 218 | + */ | |
| 219 | + ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); | |
| 210 | 220 | if (ret) |
| 211 | 221 | goto err_out; |
| 212 | 222 | |
| @@ -2588,7 +2588,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, · 2587 unmodified lines | ||
| 2588 | 2588 | instr->state = MTD_ERASING; |
| 2589 | 2589 | |
| 2590 | 2590 | while (len) { |
| 2591 | − /* Heck if we have a bad block, we do not erase bad blocks! */ | |
| 2591 | + /* Check if we have a bad block, we do not erase bad blocks! */ | |
| 2592 | 2592 | if (nand_block_checkbad(mtd, ((loff_t) page) << |
| 2593 | 2593 | chip->page_shift, 0, allowbbt)) { |
| 2594 | 2594 | pr_warn("%s: attempt to erase a bad block at page 0x%08x\n", |
| @@ -440,12 +440,14 @@ static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev) · 439 unmodified lines | ||
| 440 | 440 | for (i = 0; i < dlc; i++) |
| 441 | 441 | cc770_write_reg(priv, msgobj[mo].data[i], cf->data[i]); |
| 442 | 442 | |
| 443 | + /* Store echo skb before starting the transfer */ | |
| 444 | + can_put_echo_skb(skb, dev, 0); | |
| 445 | + | |
| 443 | 446 | cc770_write_reg(priv, msgobj[mo].ctrl1, |
| 444 | 447 | RMTPND_RES | TXRQST_SET | CPUUPD_RES | NEWDAT_UNC); |
| 445 | 448 | |
| 446 | 449 | stats->tx_bytes += dlc; |
| 447 | 450 | |
| 448 | − can_put_echo_skb(skb, dev, 0); | |
| 449 | 451 | |
| 450 | 452 | /* |
| 451 | 453 | * HM: We had some cases of repeated IRQs so make sure the |
| @@ -110,6 +110,11 @@ MODULE_PARM_DESC(bcr, "Bus configuration register (default=0x40 [CBY])"); · 109 unmodified lines | ||
| 110 | 110 | #define CC770_IOSIZE 0x20 |
| 111 | 111 | #define CC770_IOSIZE_INDIRECT 0x02 |
| 112 | 112 | |
| 113 | +/* Spinlock for cc770_isa_port_write_reg_indirect | |
| 114 | + * and cc770_isa_port_read_reg_indirect | |
| 115 | + */ | |
| 116 | +static DEFINE_SPINLOCK(cc770_isa_port_lock); | |
| 117 | + | |
| 113 | 118 | static struct platform_device *cc770_isa_devs[MAXDEV]; |
| 114 | 119 | |
| 115 | 120 | static u8 cc770_isa_mem_read_reg(const struct cc770_priv *priv, int reg) |
| @@ -138,18 +143,27 @@ static u8 cc770_isa_port_read_reg_indirect(const struct cc770_priv *priv, · 22 unmodified lines | ||
| 138 | 143 | int reg) |
| 139 | 144 | { |
| 140 | 145 | unsigned long base = (unsigned long)priv->reg_base; |
| 146 | + unsigned long flags; | |
| 147 | + u8 val; | |
| 141 | 148 | |
| 149 | + spin_lock_irqsave(&cc770_isa_port_lock, flags); | |
| 142 | 150 | outb(reg, base); |
| 143 | − return inb(base + 1); | |
| 151 | + val = inb(base + 1); | |
| 152 | + spin_unlock_irqrestore(&cc770_isa_port_lock, flags); | |
| 153 | + | |
| 154 | + return val; | |
| 144 | 155 | } |
| 145 | 156 | |
| 146 | 157 | static void cc770_isa_port_write_reg_indirect(const struct cc770_priv *priv, |
| 147 | 158 | int reg, u8 val) |
| 148 | 159 | { |
| 149 | 160 | unsigned long base = (unsigned long)priv->reg_base; |
| 161 | + unsigned long flags; | |
| 150 | 162 | |
| 163 | + spin_lock_irqsave(&cc770_isa_port_lock, flags); | |
| 151 | 164 | outb(reg, base); |
| 152 | 165 | outb(val, base + 1); |
| 166 | + spin_unlock_irqrestore(&cc770_isa_port_lock, flags); | |
| 153 | 167 | } |
| 154 | 168 | |
| 155 | 169 | static int __devinit cc770_isa_probe(struct platform_device *pdev) |
| @@ -118,6 +118,9 @@ · 117 unmodified lines | ||
| 118 | 118 | (FLEXCAN_ESR_TWRN_INT | FLEXCAN_ESR_RWRN_INT | FLEXCAN_ESR_BOFF_INT) |
| 119 | 119 | #define FLEXCAN_ESR_ERR_ALL \ |
| 120 | 120 | (FLEXCAN_ESR_ERR_BUS | FLEXCAN_ESR_ERR_STATE) |
| 121 | +#define FLEXCAN_ESR_ALL_INT \ | |
| 122 | + (FLEXCAN_ESR_TWRN_INT | FLEXCAN_ESR_RWRN_INT | \ | |
| 123 | + FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT) | |
| 121 | 124 | |
| 122 | 125 | /* FLEXCAN interrupt flag register (IFLAG) bits */ |
| 123 | 126 | #define FLEXCAN_TX_BUF_ID 8 |
| @@ -577,7 +580,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) · 453 unmodified lines | ||
| 577 | 580 | |
| 578 | 581 | reg_iflag1 = flexcan_read(®s->iflag1); |
| 579 | 582 | reg_esr = flexcan_read(®s->esr); |
| 580 | − flexcan_write(FLEXCAN_ESR_ERR_INT, ®s->esr); /* ACK err IRQ */ | |
| 583 | + /* ACK all bus error and state change IRQ sources */ | |
| 584 | + if (reg_esr & FLEXCAN_ESR_ALL_INT) | |
| 585 | + flexcan_write(reg_esr & FLEXCAN_ESR_ALL_INT, ®s->esr); | |
| 581 | 586 | |
| 582 | 587 | /* |
| 583 | 588 | * schedule NAPI in case of: |
| @@ -66,6 +66,7 @@ · 65 unmodified lines | ||
| 66 | 66 | #define PCH_IF_CREQ_BUSY BIT(15) |
| 67 | 67 | |
| 68 | 68 | #define PCH_STATUS_INT 0x8000 |
| 69 | +#define PCH_RP 0x00008000 | |
| 69 | 70 | #define PCH_REC 0x00007f00 |
| 70 | 71 | #define PCH_TEC 0x000000ff |
| 71 | 72 | |
| @@ -527,7 +528,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) · 455 unmodified lines | ||
| 527 | 528 | priv->can.can_stats.error_passive++; |
| 528 | 529 | state = CAN_STATE_ERROR_PASSIVE; |
| 529 | 530 | cf->can_id |= CAN_ERR_CRTL; |
| 530 | − if (((errc & PCH_REC) >> 8) > 127) | |
| 531 | + if (errc & PCH_RP) | |
| 531 | 532 | cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE; |
| 532 | 533 | if ((errc & PCH_TEC) > 127) |
| 533 | 534 | cf->data[1] |= CAN_ERR_CRTL_TX_PASSIVE; |
| @@ -39,9 +39,9 @@ MODULE_LICENSE("GPL v2"); · 38 unmodified lines | ||
| 39 | 39 | #define DRV_NAME "peak_pci" |
| 40 | 40 | |
| 41 | 41 | struct peak_pci_chan { |
| 42 | − void __iomem *cfg_base; /* Common for all channels */ | |
| 43 | − struct net_device *next_dev; /* Chain of network devices */ | |
| 44 | − u16 icr_mask; /* Interrupt mask for fast ack */ | |
| 42 | + void __iomem *cfg_base; /* Common for all channels */ | |
| 43 | + struct net_device *prev_dev; /* Chain of network devices */ | |
| 44 | + u16 icr_mask; /* Interrupt mask for fast ack */ | |
| 45 | 45 | }; |
| 46 | 46 | |
| 47 | 47 | #define PEAK_PCI_CAN_CLOCK (16000000 / 2) |
| @@ -98,7 +98,7 @@ static int __devinit peak_pci_probe(struct pci_dev *pdev, · 50 unmodified lines | ||
| 98 | 98 | { |
| 99 | 99 | struct sja1000_priv *priv; |
| 100 | 100 | struct peak_pci_chan *chan; |
| 101 | − struct net_device *dev, *dev0 = NULL; | |
| 101 | + struct net_device *dev; | |
| 102 | 102 | void __iomem *cfg_base, *reg_base; |
| 103 | 103 | u16 sub_sys_id, icr; |
| 104 | 104 | int i, err, channels; |
| @@ -196,18 +196,14 @@ static int __devinit peak_pci_probe(struct pci_dev *pdev, · 91 unmodified lines | ||
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /* Create chain of SJA1000 devices */ |
| 199 | − if (i == 0) | |
| 200 | − dev0 = dev; | |
| 201 | − else | |
| 202 | − chan->next_dev = dev; | |
| 199 | + chan->prev_dev = pci_get_drvdata(pdev); | |
| 200 | + pci_set_drvdata(pdev, dev); | |
| 203 | 201 | |
| 204 | 202 | dev_info(&pdev->dev, |
| 205 | 203 | "%s at reg_base=0x%p cfg_base=0x%p irq=%d\n", |
| 206 | 204 | dev->name, priv->reg_base, chan->cfg_base, dev->irq); |
| 207 | 205 | } |
| 208 | 206 | |
| 209 | − pci_set_drvdata(pdev, dev0); | |
| 210 | − | |
| 211 | 207 | /* Enable interrupts */ |
| 212 | 208 | writew(icr, cfg_base + PITA_ICR + 2); |
| 213 | 209 | |
| @@ -217,12 +213,11 @@ failure_remove_channels: · 3 unmodified lines | ||
| 217 | 213 | /* Disable interrupts */ |
| 218 | 214 | writew(0x0, cfg_base + PITA_ICR + 2); |
| 219 | 215 | |
| 220 | − for (dev = dev0; dev; dev = chan->next_dev) { | |
| 216 | + for (dev = pci_get_drvdata(pdev); dev; dev = chan->prev_dev) { | |
| 221 | 217 | unregister_sja1000dev(dev); |
| 222 | 218 | free_sja1000dev(dev); |
| 223 | 219 | priv = netdev_priv(dev); |
| 224 | 220 | chan = priv->priv; |
| 225 | − dev = chan->next_dev; | |
| 226 | 221 | } |
| 227 | 222 | |
| 228 | 223 | pci_iounmap(pdev, reg_base); |
| @@ -241,7 +236,7 @@ failure_disable_pci: · 12 unmodified lines | ||
| 241 | 236 | |
| 242 | 237 | static void __devexit peak_pci_remove(struct pci_dev *pdev) |
| 243 | 238 | { |
| 244 | − struct net_device *dev = pci_get_drvdata(pdev); /* First device */ | |
| 239 | + struct net_device *dev = pci_get_drvdata(pdev); /* Last device */ | |
| 245 | 240 | struct sja1000_priv *priv = netdev_priv(dev); |
| 246 | 241 | struct peak_pci_chan *chan = priv->priv; |
| 247 | 242 | void __iomem *cfg_base = chan->cfg_base; |
| @@ -255,7 +250,7 @@ static void __devexit peak_pci_remove(struct pci_dev *pdev) · 7 unmodified lines | ||
| 255 | 250 | dev_info(&pdev->dev, "removing device %s\n", dev->name); |
| 256 | 251 | unregister_sja1000dev(dev); |
| 257 | 252 | free_sja1000dev(dev); |
| 258 | − dev = chan->next_dev; | |
| 253 | + dev = chan->prev_dev; | |
| 259 | 254 | if (!dev) |
| 260 | 255 | break; |
| 261 | 256 | priv = netdev_priv(dev); |
| @@ -95,11 +95,16 @@ static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val) · 94 unmodified lines | ||
| 95 | 95 | spin_unlock_irqrestore(&priv->cmdreg_lock, flags); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | +static int sja1000_is_absent(struct sja1000_priv *priv) | |
| 99 | +{ | |
| 100 | + return (priv->read_reg(priv, REG_MOD) == 0xFF); | |
| 101 | +} | |
| 102 | + | |
| 98 | 103 | static int sja1000_probe_chip(struct net_device *dev) |
| 99 | 104 | { |
| 100 | 105 | struct sja1000_priv *priv = netdev_priv(dev); |
| 101 | 106 | |
| 102 | − if (priv->reg_base && (priv->read_reg(priv, 0) == 0xFF)) { | |
| 107 | + if (priv->reg_base && sja1000_is_absent(priv)) { | |
| 103 | 108 | printk(KERN_INFO "%s: probing @0x%lX failed\n", |
| 104 | 109 | DRV_NAME, dev->base_addr); |
| 105 | 110 | return 0; |
| @@ -493,6 +498,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) · 387 unmodified lines | ||
| 493 | 498 | while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { |
| 494 | 499 | n++; |
| 495 | 500 | status = priv->read_reg(priv, REG_SR); |
| 501 | + /* check for absent controller due to hw unplug */ | |
| 502 | + if (status == 0xFF && sja1000_is_absent(priv)) | |
| 503 | + return IRQ_NONE; | |
| 496 | 504 | |
| 497 | 505 | if (isrc & IRQ_WUI) |
| 498 | 506 | dev_warn(dev->dev.parent, "wakeup interrupt\n"); |
| @@ -509,6 +517,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) · 10 unmodified lines | ||
| 509 | 517 | while (status & SR_RBS) { |
| 510 | 518 | sja1000_rx(dev); |
| 511 | 519 | status = priv->read_reg(priv, REG_SR); |
| 520 | + /* check for absent controller */ | |
| 521 | + if (status == 0xFF && sja1000_is_absent(priv)) | |
| 522 | + return IRQ_NONE; | |
| 512 | 523 | } |
| 513 | 524 | } |
| 514 | 525 | if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) { |
| @@ -745,9 +745,10 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, · 744 unmodified lines | ||
| 745 | 745 | } |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | − netif_receive_skb(skb); | |
| 748 | + netif_rx(skb); | |
| 749 | 749 | stats->rx_packets++; |
| 750 | 750 | stats->rx_bytes += cf->can_dlc; |
| 751 | + | |
| 751 | 752 | return 0; |
| 752 | 753 | } |
| 753 | 754 | |
| @@ -627,9 +627,6 @@ static int ems_usb_start(struct ems_usb *dev) · 626 unmodified lines | ||
| 627 | 627 | |
| 628 | 628 | err = usb_submit_urb(urb, GFP_KERNEL); |
| 629 | 629 | if (err) { |
| 630 | − if (err == -ENODEV) | |
| 631 | − netif_device_detach(dev->netdev); | |
| 632 | − | |
| 633 | 630 | usb_unanchor_urb(urb); |
| 634 | 631 | usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf, |
| 635 | 632 | urb->transfer_dma); |
| @@ -659,9 +656,6 @@ static int ems_usb_start(struct ems_usb *dev) · 23 unmodified lines | ||
| 659 | 656 | |
| 660 | 657 | err = usb_submit_urb(dev->intr_urb, GFP_KERNEL); |
| 661 | 658 | if (err) { |
| 662 | − if (err == -ENODEV) | |
| 663 | − netif_device_detach(dev->netdev); | |
| 664 | − | |
| 665 | 659 | dev_warn(netdev->dev.parent, "intr URB submit failed: %d\n", |
| 666 | 660 | err); |
| 667 | 661 | |
| @@ -692,9 +686,6 @@ static int ems_usb_start(struct ems_usb *dev) · 24 unmodified lines | ||
| 692 | 686 | return 0; |
| 693 | 687 | |
| 694 | 688 | failed: |
| 695 | − if (err == -ENODEV) | |
| 696 | − netif_device_detach(dev->netdev); | |
| 697 | − | |
| 698 | 689 | dev_warn(netdev->dev.parent, "couldn't submit control: %d\n", err); |
| 699 | 690 | |
| 700 | 691 | return err; |
| @@ -1842,7 +1842,7 @@ vortex_timer(unsigned long data) · 1841 unmodified lines | ||
| 1842 | 1842 | ok = 1; |
| 1843 | 1843 | } |
| 1844 | 1844 | |
| 1845 | − if (!netif_carrier_ok(dev)) | |
| 1845 | + if (dev->flags & IFF_SLAVE || !netif_carrier_ok(dev)) | |
| 1846 | 1846 | next_tick = 5*HZ; |
| 1847 | 1847 | |
| 1848 | 1848 | if (vp->medialock) |
| @@ -2244,10 +2244,6 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb, · 2243 unmodified lines | ||
| 2244 | 2244 | dev_info(&adapter->pdev->dev, "tx locked\n"); |
| 2245 | 2245 | return NETDEV_TX_LOCKED; |
| 2246 | 2246 | } |
| 2247 | − if (skb->mark == 0x01) | |
| 2248 | − type = atl1c_trans_high; | |
| 2249 | − else | |
| 2250 | − type = atl1c_trans_normal; | |
| 2251 | 2247 | |
| 2252 | 2248 | if (atl1c_tpd_avail(adapter, type) < tpd_req) { |
| 2253 | 2249 | /* no enough descriptor, just stop queue */ |
| @@ -2339,7 +2339,7 @@ static inline int __init b44_pci_init(void) · 2338 unmodified lines | ||
| 2339 | 2339 | return err; |
| 2340 | 2340 | } |
| 2341 | 2341 | |
| 2342 | −static inline void __exit b44_pci_exit(void) | |
| 2342 | +static inline void b44_pci_exit(void) | |
| 2343 | 2343 | { |
| 2344 | 2344 | #ifdef CONFIG_B44_PCI |
| 2345 | 2345 | ssb_pcihost_unregister(&b44_pci_driver); |
| @@ -797,7 +797,7 @@ static int bcm_enet_open(struct net_device *dev) · 796 unmodified lines | ||
| 797 | 797 | if (priv->has_phy) { |
| 798 | 798 | /* connect to PHY */ |
| 799 | 799 | snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, |
| 800 | − priv->mac_id ? "1" : "0", priv->phy_id); | |
| 800 | + priv->mii_bus->id, priv->phy_id); | |
| 801 | 801 | |
| 802 | 802 | phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, 0, |
| 803 | 803 | PHY_INTERFACE_MODE_MII); |
| @@ -523,7 +523,6 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 522 unmodified lines | ||
| 523 | 523 | skb = build_skb(data); |
| 524 | 524 | |
| 525 | 525 | if (likely(skb)) { |
| 526 | − | |
| 527 | 526 | #ifdef BNX2X_STOP_ON_ERROR |
| 528 | 527 | if (pad + len > fp->rx_buf_size) { |
| 529 | 528 | BNX2X_ERR("skb_put is about to fail... " |
| @@ -557,7 +556,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, · 27 unmodified lines | ||
| 557 | 556 | |
| 558 | 557 | return; |
| 559 | 558 | } |
| 560 | − | |
| 559 | + kfree(new_data); | |
| 561 | 560 | drop: |
| 562 | 561 | /* drop the packet and keep the buffer in the bin */ |
| 563 | 562 | DP(NETIF_MSG_RX_STATUS, |
| @@ -117,10 +117,6 @@ static int dropless_fc; · 116 unmodified lines | ||
| 117 | 117 | module_param(dropless_fc, int, 0); |
| 118 | 118 | MODULE_PARM_DESC(dropless_fc, " Pause on exhausted host ring"); |
| 119 | 119 | |
| 120 | −static int poll; | |
| 121 | −module_param(poll, int, 0); | |
| 122 | −MODULE_PARM_DESC(poll, " Use polling (for debug)"); | |
| 123 | − | |
| 124 | 120 | static int mrrs = -1; |
| 125 | 121 | module_param(mrrs, int, 0); |
| 126 | 122 | MODULE_PARM_DESC(mrrs, " Force Max Read Req Size (0..3) (for debug)"); |
| @@ -4834,20 +4830,11 @@ void bnx2x_drv_pulse(struct bnx2x *bp) · 4707 unmodified lines | ||
| 4834 | 4830 | |
| 4835 | 4831 | static void bnx2x_timer(unsigned long data) |
| 4836 | 4832 | { |
| 4837 | − u8 cos; | |
| 4838 | 4833 | struct bnx2x *bp = (struct bnx2x *) data; |
| 4839 | 4834 | |
| 4840 | 4835 | if (!netif_running(bp->dev)) |
| 4841 | 4836 | return; |
| 4842 | 4837 | |
| 4843 | − if (poll) { | |
| 4844 | − struct bnx2x_fastpath *fp = &bp->fp[0]; | |
| 4845 | − | |
| 4846 | − for_each_cos_in_tx_queue(fp, cos) | |
| 4847 | − bnx2x_tx_int(bp, &fp->txdata[cos]); | |
| 4848 | − bnx2x_rx_int(fp, 1000); | |
| 4849 | − } | |
| 4850 | − | |
| 4851 | 4838 | if (!BP_NOMCP(bp)) { |
| 4852 | 4839 | int mb_idx = BP_FW_MB_IDX(bp); |
| 4853 | 4840 | u32 drv_pulse; |
| @@ -10063,7 +10050,6 @@ static void __devinit bnx2x_set_modes_bitmap(struct bnx2x *bp) · 5209 unmodified lines | ||
| 10063 | 10050 | static int __devinit bnx2x_init_bp(struct bnx2x *bp) |
| 10064 | 10051 | { |
| 10065 | 10052 | int func; |
| 10066 | − int timer_interval; | |
| 10067 | 10053 | int rc; |
| 10068 | 10054 | |
| 10069 | 10055 | mutex_init(&bp->port.phy_mutex); |
| @@ -10139,8 +10125,7 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) · 69 unmodified lines | ||
| 10139 | 10125 | bp->tx_ticks = (50 / BNX2X_BTR) * BNX2X_BTR; |
| 10140 | 10126 | bp->rx_ticks = (25 / BNX2X_BTR) * BNX2X_BTR; |
| 10141 | 10127 | |
| 10142 | − timer_interval = (CHIP_REV_IS_SLOW(bp) ? 5*HZ : HZ); | |
| 10143 | − bp->current_interval = (poll ? poll : timer_interval); | |
| 10128 | + bp->current_interval = CHIP_REV_IS_SLOW(bp) ? 5*HZ : HZ; | |
| 10144 | 10129 | |
| 10145 | 10130 | init_timer(&bp->timer); |
| 10146 | 10131 | bp->timer.expires = jiffies + bp->current_interval; |
| @@ -1081,17 +1081,17 @@ static int bnx2x_storm_stats_update(struct bnx2x *bp) · 1080 unmodified lines | ||
| 1081 | 1081 | estats->rx_stat_ifhcinbadoctets_lo); |
| 1082 | 1082 | |
| 1083 | 1083 | ADD_64(fstats->total_bytes_received_hi, |
| 1084 | − tfunc->rcv_error_bytes.hi, | |
| 1084 | + le32_to_cpu(tfunc->rcv_error_bytes.hi), | |
| 1085 | 1085 | fstats->total_bytes_received_lo, |
| 1086 | − tfunc->rcv_error_bytes.lo); | |
| 1086 | + le32_to_cpu(tfunc->rcv_error_bytes.lo)); | |
| 1087 | 1087 | |
| 1088 | 1088 | memcpy(estats, &(fstats->total_bytes_received_hi), |
| 1089 | 1089 | sizeof(struct host_func_stats) - 2*sizeof(u32)); |
| 1090 | 1090 | |
| 1091 | 1091 | ADD_64(estats->error_bytes_received_hi, |
| 1092 | − tfunc->rcv_error_bytes.hi, | |
| 1092 | + le32_to_cpu(tfunc->rcv_error_bytes.hi), | |
| 1093 | 1093 | estats->error_bytes_received_lo, |
| 1094 | − tfunc->rcv_error_bytes.lo); | |
| 1094 | + le32_to_cpu(tfunc->rcv_error_bytes.lo)); | |
| 1095 | 1095 | |
| 1096 | 1096 | ADD_64(estats->etherstatsoverrsizepkts_hi, |
| 1097 | 1097 | estats->rx_stat_dot3statsframestoolong_hi, |
| @@ -3584,7 +3584,11 @@ static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr, · 3583 unmodified lines | ||
| 3584 | 3584 | fl6.flowi6_oif = dst_addr->sin6_scope_id; |
| 3585 | 3585 | |
| 3586 | 3586 | *dst = ip6_route_output(&init_net, NULL, &fl6); |
| 3587 | − if (*dst) | |
| 3587 | + if ((*dst)->error) { | |
| 3588 | + dst_release(*dst); | |
| 3589 | + *dst = NULL; | |
| 3590 | + return -ENETUNREACH; | |
| 3591 | + } else | |
| 3588 | 3592 | return 0; |
| 3589 | 3593 | #endif |
| 3590 | 3594 | |
| @@ -946,7 +946,7 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset, · 945 unmodified lines | ||
| 946 | 946 | |
| 947 | 947 | flash_attr = kzalloc(sizeof(struct bfa_flash_attr), GFP_KERNEL); |
| 948 | 948 | if (!flash_attr) |
| 949 | − return -ENOMEM; | |
| 949 | + return 0; | |
| 950 | 950 | |
| 951 | 951 | fcomp.bnad = bnad; |
| 952 | 952 | fcomp.comp_status = 0; |
| @@ -958,7 +958,7 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset, · 5 unmodified lines | ||
| 958 | 958 | if (ret != BFA_STATUS_OK) { |
| 959 | 959 | spin_unlock_irqrestore(&bnad->bna_lock, flags); |
| 960 | 960 | kfree(flash_attr); |
| 961 | − goto out_err; | |
| 961 | + return 0; | |
| 962 | 962 | } |
| 963 | 963 | spin_unlock_irqrestore(&bnad->bna_lock, flags); |
| 964 | 964 | wait_for_completion(&fcomp.comp); |
| @@ -978,8 +978,6 @@ bnad_get_flash_partition_by_offset(struct bnad *bnad, u32 offset, · 13 unmodified lines | ||
| 978 | 978 | } |
| 979 | 979 | kfree(flash_attr); |
| 980 | 980 | return flash_part; |
| 981 | −out_err: | |
| 982 | − return -EINVAL; | |
| 983 | 981 | } |
| 984 | 982 | |
| 985 | 983 | static int |
| @@ -1006,7 +1004,7 @@ bnad_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom, · 20 unmodified lines | ||
| 1006 | 1004 | /* Query the flash partition based on the offset */ |
| 1007 | 1005 | flash_part = bnad_get_flash_partition_by_offset(bnad, |
| 1008 | 1006 | eeprom->offset, &base_offset); |
| 1009 | − if (flash_part <= 0) | |
| 1007 | + if (flash_part == 0) | |
| 1010 | 1008 | return -EFAULT; |
| 1011 | 1009 | |
| 1012 | 1010 | fcomp.bnad = bnad; |
| @@ -1048,7 +1046,7 @@ bnad_set_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom, · 35 unmodified lines | ||
| 1048 | 1046 | /* Query the flash partition based on the offset */ |
| 1049 | 1047 | flash_part = bnad_get_flash_partition_by_offset(bnad, |
| 1050 | 1048 | eeprom->offset, &base_offset); |
| 1051 | − if (flash_part <= 0) | |
| 1049 | + if (flash_part == 0) | |
| 1052 | 1050 | return -EFAULT; |
| 1053 | 1051 | |
| 1054 | 1052 | fcomp.bnad = bnad; |
| @@ -157,7 +157,7 @@ static inline void cq_enet_rq_desc_dec(struct cq_enet_rq_desc *desc, · 156 unmodified lines | ||
| 157 | 157 | CQ_ENET_RQ_DESC_FCOE_FC_CRC_OK) ? 1 : 0; |
| 158 | 158 | *fcoe_enc_error = (desc->flags & |
| 159 | 159 | CQ_ENET_RQ_DESC_FCOE_ENC_ERROR) ? 1 : 0; |
| 160 | − *fcoe_eof = (u8)((desc->checksum_fcoe >> | |
| 160 | + *fcoe_eof = (u8)((le16_to_cpu(desc->checksum_fcoe) >> | |
| 161 | 161 | CQ_ENET_RQ_DESC_FCOE_EOF_SHIFT) & |
| 162 | 162 | CQ_ENET_RQ_DESC_FCOE_EOF_MASK); |
| 163 | 163 | *checksum = 0; |
| @@ -72,7 +72,7 @@ static int enic_set_port_profile(struct enic *enic, int vf) · 71 unmodified lines | ||
| 72 | 72 | struct enic_port_profile *pp; |
| 73 | 73 | struct vic_provinfo *vp; |
| 74 | 74 | const u8 oui[3] = VIC_PROVINFO_CISCO_OUI; |
| 75 | − const u16 os_type = htons(VIC_GENERIC_PROV_OS_TYPE_LINUX); | |
| 75 | + const __be16 os_type = htons(VIC_GENERIC_PROV_OS_TYPE_LINUX); | |
| 76 | 76 | char uuid_str[38]; |
| 77 | 77 | char client_mac_str[18]; |
| 78 | 78 | u8 *client_mac; |
| @@ -716,12 +716,8 @@ static int · 715 unmodified lines | ||
| 716 | 716 | be_do_flash(struct net_device *netdev, struct ethtool_flash *efl) |
| 717 | 717 | { |
| 718 | 718 | struct be_adapter *adapter = netdev_priv(netdev); |
| 719 | − char file_name[ETHTOOL_FLASH_MAX_FILENAME]; | |
| 720 | 719 | |
| 721 | − file_name[ETHTOOL_FLASH_MAX_FILENAME - 1] = 0; | |
| 722 | − strcpy(file_name, efl->data); | |
| 723 | − | |
| 724 | − return be_load_fw(adapter, file_name); | |
| 720 | + return be_load_fw(adapter, efl->data); | |
| 725 | 721 | } |
| 726 | 722 | |
| 727 | 723 | static int |
| @@ -986,11 +986,11 @@ static int fec_enet_mii_probe(struct net_device *ndev) · 985 unmodified lines | ||
| 986 | 986 | printk(KERN_INFO |
| 987 | 987 | "%s: no PHY, assuming direct connection to switch\n", |
| 988 | 988 | ndev->name); |
| 989 | − strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); | |
| 989 | + strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); | |
| 990 | 990 | phy_id = 0; |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | − snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); | |
| 993 | + snprintf(phy_name, sizeof(phy_name), PHY_ID_FMT, mdio_bus_id, phy_id); | |
| 994 | 994 | phy_dev = phy_connect(ndev, phy_name, &fec_enet_adjust_link, 0, |
| 995 | 995 | fep->phy_interface); |
| 996 | 996 | if (IS_ERR(phy_dev)) { |
| @@ -4740,12 +4740,14 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake) · 4739 unmodified lines | ||
| 4740 | 4740 | e1000_setup_rctl(adapter); |
| 4741 | 4741 | e1000_set_rx_mode(netdev); |
| 4742 | 4742 | |
| 4743 | + rctl = er32(RCTL); | |
| 4744 | + | |
| 4743 | 4745 | /* turn on all-multi mode if wake on multicast is enabled */ |
| 4744 | − if (wufc & E1000_WUFC_MC) { | |
| 4745 | − rctl = er32(RCTL); | |
| 4746 | + if (wufc & E1000_WUFC_MC) | |
| 4746 | 4747 | rctl |= E1000_RCTL_MPE; |
| 4747 | − ew32(RCTL, rctl); | |
| 4748 | − } | |
| 4748 | + | |
| 4749 | + /* enable receives in the hardware */ | |
| 4750 | + ew32(RCTL, rctl | E1000_RCTL_EN); | |
| 4749 | 4751 | |
| 4750 | 4752 | if (hw->mac_type >= e1000_82540) { |
| 4751 | 4753 | ctrl = er32(CTRL); |
| @@ -5012,7 +5012,8 @@ static int igb_find_enabled_vfs(struct igb_adapter *adapter) · 5011 unmodified lines | ||
| 5012 | 5012 | vf_devfn = pdev->devfn + 0x80; |
| 5013 | 5013 | pvfdev = pci_get_device(hw->vendor_id, device_id, NULL); |
| 5014 | 5014 | while (pvfdev) { |
| 5015 | − if (pvfdev->devfn == vf_devfn) | |
| 5015 | + if (pvfdev->devfn == vf_devfn && | |
| 5016 | + (pvfdev->bus->number >= pdev->bus->number)) | |
| 5016 | 5017 | vfs_found++; |
| 5017 | 5018 | vf_devfn += vf_stride; |
| 5018 | 5019 | pvfdev = pci_get_device(hw->vendor_id, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | ################################################################################ |
| 2 | 2 | # |
| 3 | 3 | # Intel(R) 82576 Virtual Function Linux driver |
| 4 | −# Copyright(c) 2009 - 2010 Intel Corporation. | |
| 4 | +# Copyright(c) 2009 - 2012 Intel Corporation. | |
| 5 | 5 | # |
| 6 | 6 | # This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | # under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel(R) 82576 Virtual Function Linux driver |
| 4 | − Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel(R) 82576 Virtual Function Linux driver |
| 4 | − Copyright(c) 2009 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 2009 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel(R) 82576 Virtual Function Linux driver |
| 4 | − Copyright(c) 2009 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 2009 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel(R) 82576 Virtual Function Linux driver |
| 4 | − Copyright(c) 2009 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 2009 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel(R) 82576 Virtual Function Linux driver |
| 4 | − Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel(R) 82576 Virtual Function Linux driver |
| 4 | − Copyright(c) 2009 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 2009 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -53,7 +53,7 @@ const char igbvf_driver_version[] = DRV_VERSION; · 45 unmodified lines | ||
| 53 | 53 | static const char igbvf_driver_string[] = |
| 54 | 54 | "Intel(R) Gigabit Virtual Function Network Driver"; |
| 55 | 55 | static const char igbvf_copyright[] = |
| 56 | − "Copyright (c) 2009 - 2011 Intel Corporation."; | |
| 56 | + "Copyright (c) 2009 - 2012 Intel Corporation."; | |
| 57 | 57 | |
| 58 | 58 | static int igbvf_poll(struct napi_struct *napi, int budget); |
| 59 | 59 | static void igbvf_reset(struct igbvf_adapter *); |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel(R) 82576 Virtual Function Linux driver |
| 4 | − Copyright(c) 2009 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 2009 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel(R) 82576 Virtual Function Linux driver |
| 4 | − Copyright(c) 2009 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 2009 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel(R) 82576 Virtual Function Linux driver |
| 4 | − Copyright(c) 2009 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 2009 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | ################################################################################ |
| 2 | 2 | # |
| 3 | 3 | # Intel 10 Gigabit PCI Express Linux driver |
| 4 | −# Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | +# Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | # |
| 6 | 6 | # This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | # under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -75,7 +75,7 @@ s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, · 67 unmodified lines | ||
| 75 | 75 | s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw); |
| 76 | 76 | s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw); |
| 77 | 77 | s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval); |
| 78 | −s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packtetbuf_num); | |
| 78 | +s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num); | |
| 79 | 79 | s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw); |
| 80 | 80 | |
| 81 | 81 | s32 ixgbe_validate_mac_addr(u8 *mac_addr); |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -112,6 +112,8 @@ static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) · 104 unmodified lines | ||
| 112 | 112 | static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) |
| 113 | 113 | { |
| 114 | 114 | u8 err = 0; |
| 115 | + u8 prio_tc[MAX_USER_PRIORITY] = {0}; | |
| 116 | + int i; | |
| 115 | 117 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| 116 | 118 | |
| 117 | 119 | /* Fail command if not in CEE mode */ |
| @@ -122,10 +124,15 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) · 4 unmodified lines | ||
| 122 | 124 | if (!!state != !(adapter->flags & IXGBE_FLAG_DCB_ENABLED)) |
| 123 | 125 | return err; |
| 124 | 126 | |
| 125 | − if (state > 0) | |
| 127 | + if (state > 0) { | |
| 126 | 128 | err = ixgbe_setup_tc(netdev, adapter->dcb_cfg.num_tcs.pg_tcs); |
| 127 | − else | |
| 129 | + ixgbe_dcb_unpack_map(&adapter->dcb_cfg, DCB_TX_CONFIG, prio_tc); | |
| 130 | + } else { | |
| 128 | 131 | err = ixgbe_setup_tc(netdev, 0); |
| 132 | + } | |
| 133 | + | |
| 134 | + for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) | |
| 135 | + netdev_set_prio_tc_map(netdev, i, prio_tc[i]); | |
| 129 | 136 | |
| 130 | 137 | return err; |
| 131 | 138 | } |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -58,7 +58,7 @@ struct ixgbe_stats { · 50 unmodified lines | ||
| 58 | 58 | sizeof(((struct rtnl_link_stats64 *)0)->m), \ |
| 59 | 59 | offsetof(struct rtnl_link_stats64, m) |
| 60 | 60 | |
| 61 | −static struct ixgbe_stats ixgbe_gstrings_stats[] = { | |
| 61 | +static const struct ixgbe_stats ixgbe_gstrings_stats[] = { | |
| 62 | 62 | {"rx_packets", IXGBE_NETDEV_STAT(rx_packets)}, |
| 63 | 63 | {"tx_packets", IXGBE_NETDEV_STAT(tx_packets)}, |
| 64 | 64 | {"rx_bytes", IXGBE_NETDEV_STAT(rx_bytes)}, |
| @@ -120,19 +120,23 @@ static struct ixgbe_stats ixgbe_gstrings_stats[] = { · 55 unmodified lines | ||
| 120 | 120 | #endif /* IXGBE_FCOE */ |
| 121 | 121 | }; |
| 122 | 122 | |
| 123 | −#define IXGBE_QUEUE_STATS_LEN \ | |
| 124 | − ((((struct ixgbe_adapter *)netdev_priv(netdev))->num_tx_queues + \ | |
| 125 | − ((struct ixgbe_adapter *)netdev_priv(netdev))->num_rx_queues) * \ | |
| 123 | +/* ixgbe allocates num_tx_queues and num_rx_queues symmetrically so | |
| 124 | + * we set the num_rx_queues to evaluate to num_tx_queues. This is | |
| 125 | + * used because we do not have a good way to get the max number of | |
| 126 | + * rx queues with CONFIG_RPS disabled. | |
| 127 | + */ | |
| 128 | +#define IXGBE_NUM_RX_QUEUES netdev->num_tx_queues | |
| 129 | + | |
| 130 | +#define IXGBE_QUEUE_STATS_LEN ( \ | |
| 131 | + (netdev->num_tx_queues + IXGBE_NUM_RX_QUEUES) * \ | |
| 126 | 132 | (sizeof(struct ixgbe_queue_stats) / sizeof(u64))) |
| 127 | 133 | #define IXGBE_GLOBAL_STATS_LEN ARRAY_SIZE(ixgbe_gstrings_stats) |
| 128 | 134 | #define IXGBE_PB_STATS_LEN ( \ |
| 129 | − (((struct ixgbe_adapter *)netdev_priv(netdev))->flags & \ | |
| 130 | − IXGBE_FLAG_DCB_ENABLED) ? \ | |
| 131 | − (sizeof(((struct ixgbe_adapter *)0)->stats.pxonrxc) + \ | |
| 132 | − sizeof(((struct ixgbe_adapter *)0)->stats.pxontxc) + \ | |
| 133 | − sizeof(((struct ixgbe_adapter *)0)->stats.pxoffrxc) + \ | |
| 134 | − sizeof(((struct ixgbe_adapter *)0)->stats.pxofftxc)) \ | |
| 135 | − / sizeof(u64) : 0) | |
| 135 | + (sizeof(((struct ixgbe_adapter *)0)->stats.pxonrxc) + \ | |
| 136 | + sizeof(((struct ixgbe_adapter *)0)->stats.pxontxc) + \ | |
| 137 | + sizeof(((struct ixgbe_adapter *)0)->stats.pxoffrxc) + \ | |
| 138 | + sizeof(((struct ixgbe_adapter *)0)->stats.pxofftxc)) \ | |
| 139 | + / sizeof(u64)) | |
| 136 | 140 | #define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + \ |
| 137 | 141 | IXGBE_PB_STATS_LEN + \ |
| 138 | 142 | IXGBE_QUEUE_STATS_LEN) |
| @@ -1078,8 +1082,15 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, · 939 unmodified lines | ||
| 1078 | 1082 | data[i] = (ixgbe_gstrings_stats[i].sizeof_stat == |
| 1079 | 1083 | sizeof(u64)) ? *(u64 *)p : *(u32 *)p; |
| 1080 | 1084 | } |
| 1081 | − for (j = 0; j < adapter->num_tx_queues; j++) { | |
| 1085 | + for (j = 0; j < IXGBE_NUM_RX_QUEUES; j++) { | |
| 1082 | 1086 | ring = adapter->tx_ring[j]; |
| 1087 | + if (!ring) { | |
| 1088 | + data[i] = 0; | |
| 1089 | + data[i+1] = 0; | |
| 1090 | + i += 2; | |
| 1091 | + continue; | |
| 1092 | + } | |
| 1093 | + | |
| 1083 | 1094 | do { |
| 1084 | 1095 | start = u64_stats_fetch_begin_bh(&ring->syncp); |
| 1085 | 1096 | data[i] = ring->stats.packets; |
| @@ -1087,8 +1098,15 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, · 1 unmodified line | ||
| 1087 | 1098 | } while (u64_stats_fetch_retry_bh(&ring->syncp, start)); |
| 1088 | 1099 | i += 2; |
| 1089 | 1100 | } |
| 1090 | − for (j = 0; j < adapter->num_rx_queues; j++) { | |
| 1101 | + for (j = 0; j < IXGBE_NUM_RX_QUEUES; j++) { | |
| 1091 | 1102 | ring = adapter->rx_ring[j]; |
| 1103 | + if (!ring) { | |
| 1104 | + data[i] = 0; | |
| 1105 | + data[i+1] = 0; | |
| 1106 | + i += 2; | |
| 1107 | + continue; | |
| 1108 | + } | |
| 1109 | + | |
| 1092 | 1110 | do { |
| 1093 | 1111 | start = u64_stats_fetch_begin_bh(&ring->syncp); |
| 1094 | 1112 | data[i] = ring->stats.packets; |
| @@ -1096,22 +1114,20 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev, · 1 unmodified line | ||
| 1096 | 1114 | } while (u64_stats_fetch_retry_bh(&ring->syncp, start)); |
| 1097 | 1115 | i += 2; |
| 1098 | 1116 | } |
| 1099 | − if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | |
| 1100 | − for (j = 0; j < MAX_TX_PACKET_BUFFERS; j++) { | |
| 1101 | − data[i++] = adapter->stats.pxontxc[j]; | |
| 1102 | − data[i++] = adapter->stats.pxofftxc[j]; | |
| 1103 | − } | |
| 1104 | − for (j = 0; j < MAX_RX_PACKET_BUFFERS; j++) { | |
| 1105 | − data[i++] = adapter->stats.pxonrxc[j]; | |
| 1106 | − data[i++] = adapter->stats.pxoffrxc[j]; | |
| 1107 | − } | |
| 1117 | + | |
| 1118 | + for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) { | |
| 1119 | + data[i++] = adapter->stats.pxontxc[j]; | |
| 1120 | + data[i++] = adapter->stats.pxofftxc[j]; | |
| 1121 | + } | |
| 1122 | + for (j = 0; j < IXGBE_MAX_PACKET_BUFFERS; j++) { | |
| 1123 | + data[i++] = adapter->stats.pxonrxc[j]; | |
| 1124 | + data[i++] = adapter->stats.pxoffrxc[j]; | |
| 1108 | 1125 | } |
| 1109 | 1126 | } |
| 1110 | 1127 | |
| 1111 | 1128 | static void ixgbe_get_strings(struct net_device *netdev, u32 stringset, |
| 1112 | 1129 | u8 *data) |
| 1113 | 1130 | { |
| 1114 | − struct ixgbe_adapter *adapter = netdev_priv(netdev); | |
| 1115 | 1131 | char *p = (char *)data; |
| 1116 | 1132 | int i; |
| 1117 | 1133 | |
| @@ -1126,31 +1142,29 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset, · 8 unmodified lines | ||
| 1126 | 1142 | ETH_GSTRING_LEN); |
| 1127 | 1143 | p += ETH_GSTRING_LEN; |
| 1128 | 1144 | } |
| 1129 | − for (i = 0; i < adapter->num_tx_queues; i++) { | |
| 1145 | + for (i = 0; i < netdev->num_tx_queues; i++) { | |
| 1130 | 1146 | sprintf(p, "tx_queue_%u_packets", i); |
| 1131 | 1147 | p += ETH_GSTRING_LEN; |
| 1132 | 1148 | sprintf(p, "tx_queue_%u_bytes", i); |
| 1133 | 1149 | p += ETH_GSTRING_LEN; |
| 1134 | 1150 | } |
| 1135 | − for (i = 0; i < adapter->num_rx_queues; i++) { | |
| 1151 | + for (i = 0; i < IXGBE_NUM_RX_QUEUES; i++) { | |
| 1136 | 1152 | sprintf(p, "rx_queue_%u_packets", i); |
| 1137 | 1153 | p += ETH_GSTRING_LEN; |
| 1138 | 1154 | sprintf(p, "rx_queue_%u_bytes", i); |
| 1139 | 1155 | p += ETH_GSTRING_LEN; |
| 1140 | 1156 | } |
| 1141 | − if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | |
| 1142 | − for (i = 0; i < MAX_TX_PACKET_BUFFERS; i++) { | |
| 1143 | − sprintf(p, "tx_pb_%u_pxon", i); | |
| 1144 | − p += ETH_GSTRING_LEN; | |
| 1145 | − sprintf(p, "tx_pb_%u_pxoff", i); | |
| 1146 | − p += ETH_GSTRING_LEN; | |
| 1147 | − } | |
| 1148 | − for (i = 0; i < MAX_RX_PACKET_BUFFERS; i++) { | |
| 1149 | − sprintf(p, "rx_pb_%u_pxon", i); | |
| 1150 | − p += ETH_GSTRING_LEN; | |
| 1151 | − sprintf(p, "rx_pb_%u_pxoff", i); | |
| 1152 | − p += ETH_GSTRING_LEN; | |
| 1153 | − } | |
| 1157 | + for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++) { | |
| 1158 | + sprintf(p, "tx_pb_%u_pxon", i); | |
| 1159 | + p += ETH_GSTRING_LEN; | |
| 1160 | + sprintf(p, "tx_pb_%u_pxoff", i); | |
| 1161 | + p += ETH_GSTRING_LEN; | |
| 1162 | + } | |
| 1163 | + for (i = 0; i < IXGBE_MAX_PACKET_BUFFERS; i++) { | |
| 1164 | + sprintf(p, "rx_pb_%u_pxon", i); | |
| 1165 | + p += ETH_GSTRING_LEN; | |
| 1166 | + sprintf(p, "rx_pb_%u_pxoff", i); | |
| 1167 | + p += ETH_GSTRING_LEN; | |
| 1154 | 1168 | } |
| 1155 | 1169 | /* BUG_ON(p - data != IXGBE_STATS_LEN * ETH_GSTRING_LEN); */ |
| 1156 | 1170 | break; |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -64,7 +64,7 @@ char ixgbe_default_device_descr[] = · 56 unmodified lines | ||
| 64 | 64 | __stringify(BUILD) "-k" |
| 65 | 65 | const char ixgbe_driver_version[] = DRV_VERSION; |
| 66 | 66 | static const char ixgbe_copyright[] = |
| 67 | − "Copyright (c) 1999-2011 Intel Corporation."; | |
| 67 | + "Copyright (c) 1999-2012 Intel Corporation."; | |
| 68 | 68 | |
| 69 | 69 | static const struct ixgbe_info *ixgbe_info_tbl[] = { |
| 70 | 70 | [board_82598] = &ixgbe_82598_info, |
| @@ -2633,22 +2633,22 @@ static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter, · 2562 unmodified lines | ||
| 2633 | 2633 | /* |
| 2634 | 2634 | * we must limit the number of descriptors so that the |
| 2635 | 2635 | * total size of max desc * buf_len is not greater |
| 2636 | − * than 65535 | |
| 2636 | + * than 65536 | |
| 2637 | 2637 | */ |
| 2638 | 2638 | if (ring_is_ps_enabled(ring)) { |
| 2639 | −#if (MAX_SKB_FRAGS > 16) | |
| 2639 | +#if (PAGE_SIZE < 8192) | |
| 2640 | 2640 | rscctrl |= IXGBE_RSCCTL_MAXDESC_16; |
| 2641 | −#elif (MAX_SKB_FRAGS > 8) | |
| 2641 | +#elif (PAGE_SIZE < 16384) | |
| 2642 | 2642 | rscctrl |= IXGBE_RSCCTL_MAXDESC_8; |
| 2643 | −#elif (MAX_SKB_FRAGS > 4) | |
| 2643 | +#elif (PAGE_SIZE < 32768) | |
| 2644 | 2644 | rscctrl |= IXGBE_RSCCTL_MAXDESC_4; |
| 2645 | 2645 | #else |
| 2646 | 2646 | rscctrl |= IXGBE_RSCCTL_MAXDESC_1; |
| 2647 | 2647 | #endif |
| 2648 | 2648 | } else { |
| 2649 | − if (rx_buf_len < IXGBE_RXBUFFER_4K) | |
| 2649 | + if (rx_buf_len <= IXGBE_RXBUFFER_4K) | |
| 2650 | 2650 | rscctrl |= IXGBE_RSCCTL_MAXDESC_16; |
| 2651 | − else if (rx_buf_len < IXGBE_RXBUFFER_8K) | |
| 2651 | + else if (rx_buf_len <= IXGBE_RXBUFFER_8K) | |
| 2652 | 2652 | rscctrl |= IXGBE_RSCCTL_MAXDESC_8; |
| 2653 | 2653 | else |
| 2654 | 2654 | rscctrl |= IXGBE_RSCCTL_MAXDESC_4; |
| @@ -2830,7 +2830,7 @@ static void ixgbe_configure_virtualization(struct ixgbe_adapter *adapter) · 175 unmodified lines | ||
| 2830 | 2830 | IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, vmdctl | vt_reg_bits); |
| 2831 | 2831 | |
| 2832 | 2832 | vf_shift = adapter->num_vfs % 32; |
| 2833 | − reg_offset = (adapter->num_vfs > 32) ? 1 : 0; | |
| 2833 | + reg_offset = (adapter->num_vfs >= 32) ? 1 : 0; | |
| 2834 | 2834 | |
| 2835 | 2835 | /* Enable only the PF's pool for Tx/Rx */ |
| 2836 | 2836 | IXGBE_WRITE_REG(hw, IXGBE_VFRE(reg_offset), (1 << vf_shift)); |
| @@ -4330,6 +4330,10 @@ static int ixgbe_set_num_queues(struct ixgbe_adapter *adapter) · 1493 unmodified lines | ||
| 4330 | 4330 | adapter->num_tx_queues = 1; |
| 4331 | 4331 | |
| 4332 | 4332 | done: |
| 4333 | + if ((adapter->netdev->reg_state == NETREG_UNREGISTERED) || | |
| 4334 | + (adapter->netdev->reg_state == NETREG_UNREGISTERING)) | |
| 4335 | + return 0; | |
| 4336 | + | |
| 4333 | 4337 | /* Notify the stack of the (possibly) reduced queue counts. */ |
| 4334 | 4338 | netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues); |
| 4335 | 4339 | return netif_set_real_num_rx_queues(adapter->netdev, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -67,7 +67,8 @@ static int ixgbe_find_enabled_vfs(struct ixgbe_adapter *adapter) · 59 unmodified lines | ||
| 67 | 67 | vf_devfn = pdev->devfn + 0x80; |
| 68 | 68 | pvfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID, device_id, NULL); |
| 69 | 69 | while (pvfdev) { |
| 70 | − if (pvfdev->devfn == vf_devfn) | |
| 70 | + if (pvfdev->devfn == vf_devfn && | |
| 71 | + (pvfdev->bus->number >= pdev->bus->number)) | |
| 71 | 72 | vfs_found++; |
| 72 | 73 | vf_devfn += 2; |
| 73 | 74 | pvfdev = pci_get_device(IXGBE_INTEL_VENDOR_ID, |
| @@ -646,6 +647,9 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) · 572 unmodified lines | ||
| 646 | 647 | ixgbe_ndo_set_vf_spoofchk(adapter->netdev, vf, false); |
| 647 | 648 | retval = ixgbe_set_vf_macvlan(adapter, vf, index, |
| 648 | 649 | (unsigned char *)(&msgbuf[1])); |
| 650 | + if (retval == -ENOSPC) | |
| 651 | + e_warn(drv, "VF %d has requested a MACVLAN filter " | |
| 652 | + "but there is no space for it\n", vf); | |
| 649 | 653 | break; |
| 650 | 654 | default: |
| 651 | 655 | e_err(drv, "Unhandled Msg %8.8x\n", msgbuf[0]); |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 10 Gigabit PCI Express Linux driver |
| 4 | − Copyright(c) 1999 - 2011 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | ################################################################################ |
| 2 | 2 | # |
| 3 | 3 | # Intel 82599 Virtual Function driver |
| 4 | −# Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | +# Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | # |
| 6 | 6 | # This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | # under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 82599 Virtual Function driver |
| 4 | − Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 82599 Virtual Function driver |
| 4 | − Copyright(c) 1999 - 2009 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 82599 Virtual Function driver |
| 4 | − Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 82599 Virtual Function driver |
| 4 | − Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -60,7 +60,7 @@ static const char ixgbevf_driver_string[] = · 52 unmodified lines | ||
| 60 | 60 | #define DRV_VERSION "2.2.0-k" |
| 61 | 61 | const char ixgbevf_driver_version[] = DRV_VERSION; |
| 62 | 62 | static char ixgbevf_copyright[] = |
| 63 | − "Copyright (c) 2009 - 2010 Intel Corporation."; | |
| 63 | + "Copyright (c) 2009 - 2012 Intel Corporation."; | |
| 64 | 64 | |
| 65 | 65 | static const struct ixgbevf_info *ixgbevf_info_tbl[] = { |
| 66 | 66 | [board_82599_vf] = &ixgbevf_82599_vf_info, |
| @@ -935,7 +935,11 @@ static irqreturn_t ixgbevf_msix_mbx(int irq, void *data) · 868 unmodified lines | ||
| 935 | 935 | if (msg & IXGBE_VT_MSGTYPE_NACK) |
| 936 | 936 | pr_warn("Last Request of type %2.2x to PF Nacked\n", |
| 937 | 937 | msg & 0xFF); |
| 938 | − goto out; | |
| 938 | + /* | |
| 939 | + * Restore the PFSTS bit in case someone is polling for a | |
| 940 | + * return message from the PF | |
| 941 | + */ | |
| 942 | + hw->mbx.v2p_mailbox |= IXGBE_VFMAILBOX_PFSTS; | |
| 939 | 943 | } |
| 940 | 944 | |
| 941 | 945 | /* |
| @@ -945,7 +949,7 @@ static irqreturn_t ixgbevf_msix_mbx(int irq, void *data) · 3 unmodified lines | ||
| 945 | 949 | */ |
| 946 | 950 | if (got_ack) |
| 947 | 951 | hw->mbx.v2p_mailbox |= IXGBE_VFMAILBOX_PFACK; |
| 948 | −out: | |
| 952 | + | |
| 949 | 953 | return IRQ_HANDLED; |
| 950 | 954 | } |
| 951 | 955 | |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 82599 Virtual Function driver |
| 4 | − Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 82599 Virtual Function driver |
| 4 | − Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 82599 Virtual Function driver |
| 4 | − Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 82599 Virtual Function driver |
| 4 | − Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -283,6 +283,17 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr, · 275 unmodified lines | ||
| 283 | 283 | return ret_val; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | +static void ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw, | |
| 287 | + u32 *msg, u16 size) | |
| 288 | +{ | |
| 289 | + struct ixgbe_mbx_info *mbx = &hw->mbx; | |
| 290 | + u32 retmsg[IXGBE_VFMAILBOX_SIZE]; | |
| 291 | + s32 retval = mbx->ops.write_posted(hw, msg, size); | |
| 292 | + | |
| 293 | + if (!retval) | |
| 294 | + mbx->ops.read_posted(hw, retmsg, size); | |
| 295 | +} | |
| 296 | + | |
| 286 | 297 | /** |
| 287 | 298 | * ixgbevf_update_mc_addr_list_vf - Update Multicast addresses |
| 288 | 299 | * @hw: pointer to the HW structure |
| @@ -294,7 +305,6 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw, · 5 unmodified lines | ||
| 294 | 305 | struct net_device *netdev) |
| 295 | 306 | { |
| 296 | 307 | struct netdev_hw_addr *ha; |
| 297 | − struct ixgbe_mbx_info *mbx = &hw->mbx; | |
| 298 | 308 | u32 msgbuf[IXGBE_VFMAILBOX_SIZE]; |
| 299 | 309 | u16 *vector_list = (u16 *)&msgbuf[1]; |
| 300 | 310 | u32 cnt, i; |
| @@ -321,7 +331,7 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw, · 20 unmodified lines | ||
| 321 | 331 | vector_list[i++] = ixgbevf_mta_vector(hw, ha->addr); |
| 322 | 332 | } |
| 323 | 333 | |
| 324 | − mbx->ops.write_posted(hw, msgbuf, IXGBE_VFMAILBOX_SIZE); | |
| 334 | + ixgbevf_write_msg_read_ack(hw, msgbuf, IXGBE_VFMAILBOX_SIZE); | |
| 325 | 335 | |
| 326 | 336 | return 0; |
| 327 | 337 | } |
| @@ -336,7 +346,6 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw, · 8 unmodified lines | ||
| 336 | 346 | static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, |
| 337 | 347 | bool vlan_on) |
| 338 | 348 | { |
| 339 | − struct ixgbe_mbx_info *mbx = &hw->mbx; | |
| 340 | 349 | u32 msgbuf[2]; |
| 341 | 350 | |
| 342 | 351 | msgbuf[0] = IXGBE_VF_SET_VLAN; |
| @@ -344,7 +353,9 @@ static s32 ixgbevf_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind, · 1 unmodified line | ||
| 344 | 353 | /* Setting the 8 bit field MSG INFO to TRUE indicates "add" */ |
| 345 | 354 | msgbuf[0] |= vlan_on << IXGBE_VT_MSGINFO_SHIFT; |
| 346 | 355 | |
| 347 | − return mbx->ops.write_posted(hw, msgbuf, 2); | |
| 356 | + ixgbevf_write_msg_read_ack(hw, msgbuf, 2); | |
| 357 | + | |
| 358 | + return 0; | |
| 348 | 359 | } |
| 349 | 360 | |
| 350 | 361 | /** |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /******************************************************************************* |
| 2 | 2 | |
| 3 | 3 | Intel 82599 Virtual Function driver |
| 4 | − Copyright(c) 1999 - 2010 Intel Corporation. | |
| 4 | + Copyright(c) 1999 - 2012 Intel Corporation. | |
| 5 | 5 | |
| 6 | 6 | This program is free software; you can redistribute it and/or modify it |
| 7 | 7 | under the terms and conditions of the GNU General Public License, |
| @@ -2328,19 +2328,11 @@ jme_change_mtu(struct net_device *netdev, int new_mtu) · 2327 unmodified lines | ||
| 2328 | 2328 | ((new_mtu) < IPV6_MIN_MTU)) |
| 2329 | 2329 | return -EINVAL; |
| 2330 | 2330 | |
| 2331 | − if (new_mtu > 4000) { | |
| 2332 | − jme->reg_rxcs &= ~RXCS_FIFOTHNP; | |
| 2333 | − jme->reg_rxcs |= RXCS_FIFOTHNP_64QW; | |
| 2334 | − jme_restart_rx_engine(jme); | |
| 2335 | − } else { | |
| 2336 | − jme->reg_rxcs &= ~RXCS_FIFOTHNP; | |
| 2337 | − jme->reg_rxcs |= RXCS_FIFOTHNP_128QW; | |
| 2338 | − jme_restart_rx_engine(jme); | |
| 2339 | − } | |
| 2340 | 2331 | |
| 2341 | 2332 | netdev->mtu = new_mtu; |
| 2342 | 2333 | netdev_update_features(netdev); |
| 2343 | 2334 | |
| 2335 | + jme_restart_rx_engine(jme); | |
| 2344 | 2336 | jme_reset_link(jme); |
| 2345 | 2337 | |
| 2346 | 2338 | return 0; |
| @@ -730,7 +730,7 @@ enum jme_rxcs_values { · 729 unmodified lines | ||
| 730 | 730 | RXCS_RETRYCNT_60 = 0x00000F00, |
| 731 | 731 | |
| 732 | 732 | RXCS_DEFAULT = RXCS_FIFOTHTP_128T | |
| 733 | − RXCS_FIFOTHNP_128QW | | |
| 733 | + RXCS_FIFOTHNP_16QW | | |
| 734 | 734 | RXCS_DMAREQSZ_128B | |
| 735 | 735 | RXCS_RETRYGAP_256ns | |
| 736 | 736 | RXCS_RETRYCNT_32, |
| @@ -931,20 +931,17 @@ static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u32 base) · 930 unmodified lines | ||
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | /* Allocate and setup a new buffer for receiving */ |
| 934 | −static int skge_rx_setup(struct pci_dev *pdev, | |
| 935 | − struct skge_element *e, | |
| 936 | − struct sk_buff *skb, unsigned int bufsize) | |
| 934 | +static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, | |
| 935 | + struct sk_buff *skb, unsigned int bufsize) | |
| 937 | 936 | { |
| 938 | 937 | struct skge_rx_desc *rd = e->desc; |
| 939 | − dma_addr_t map; | |
| 938 | + u64 map; | |
| 940 | 939 | |
| 941 | − map = pci_map_single(pdev, skb->data, bufsize, | |
| 940 | + map = pci_map_single(skge->hw->pdev, skb->data, bufsize, | |
| 942 | 941 | PCI_DMA_FROMDEVICE); |
| 943 | − if (pci_dma_mapping_error(pdev, map)) | |
| 944 | − goto mapping_error; | |
| 945 | 942 | |
| 946 | − rd->dma_lo = lower_32_bits(map); | |
| 947 | − rd->dma_hi = upper_32_bits(map); | |
| 943 | + rd->dma_lo = map; | |
| 944 | + rd->dma_hi = map >> 32; | |
| 948 | 945 | e->skb = skb; |
| 949 | 946 | rd->csum1_start = ETH_HLEN; |
| 950 | 947 | rd->csum2_start = ETH_HLEN; |
| @@ -956,13 +953,6 @@ static int skge_rx_setup(struct pci_dev *pdev, · 5 unmodified lines | ||
| 956 | 953 | rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize; |
| 957 | 954 | dma_unmap_addr_set(e, mapaddr, map); |
| 958 | 955 | dma_unmap_len_set(e, maplen, bufsize); |
| 959 | − return 0; | |
| 960 | − | |
| 961 | −mapping_error: | |
| 962 | − if (net_ratelimit()) | |
| 963 | − dev_warn(&pdev->dev, "%s: rx mapping error\n", | |
| 964 | − skb->dev->name); | |
| 965 | − return -EIO; | |
| 966 | 956 | } |
| 967 | 957 | |
| 968 | 958 | /* Resume receiving using existing skb, |
| @@ -1024,11 +1014,7 @@ static int skge_rx_fill(struct net_device *dev) · 55 unmodified lines | ||
| 1024 | 1014 | return -ENOMEM; |
| 1025 | 1015 | |
| 1026 | 1016 | skb_reserve(skb, NET_IP_ALIGN); |
| 1027 | − if (skge_rx_setup(skge->hw->pdev, e, skb, skge->rx_buf_size)) { | |
| 1028 | − kfree_skb(skb); | |
| 1029 | − return -ENOMEM; | |
| 1030 | − } | |
| 1031 | − | |
| 1017 | + skge_rx_setup(skge, e, skb, skge->rx_buf_size); | |
| 1032 | 1018 | } while ((e = e->next) != ring->start); |
| 1033 | 1019 | |
| 1034 | 1020 | ring->to_clean = ring->start; |
| @@ -2743,7 +2729,7 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, · 1708 unmodified lines | ||
| 2743 | 2729 | struct skge_tx_desc *td; |
| 2744 | 2730 | int i; |
| 2745 | 2731 | u32 control, len; |
| 2746 | − dma_addr_t map; | |
| 2732 | + u64 map; | |
| 2747 | 2733 | |
| 2748 | 2734 | if (skb_padto(skb, ETH_ZLEN)) |
| 2749 | 2735 | return NETDEV_TX_OK; |
| @@ -2757,14 +2743,11 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, · 7 unmodified lines | ||
| 2757 | 2743 | e->skb = skb; |
| 2758 | 2744 | len = skb_headlen(skb); |
| 2759 | 2745 | map = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); |
| 2760 | − if (pci_dma_mapping_error(hw->pdev, map)) | |
| 2761 | − goto mapping_error; | |
| 2762 | − | |
| 2763 | 2746 | dma_unmap_addr_set(e, mapaddr, map); |
| 2764 | 2747 | dma_unmap_len_set(e, maplen, len); |
| 2765 | 2748 | |
| 2766 | − td->dma_lo = lower_32_bits(map); | |
| 2767 | − td->dma_hi = upper_32_bits(map); | |
| 2749 | + td->dma_lo = map; | |
| 2750 | + td->dma_hi = map >> 32; | |
| 2768 | 2751 | |
| 2769 | 2752 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
| 2770 | 2753 | const int offset = skb_checksum_start_offset(skb); |
| @@ -2795,16 +2778,14 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, · 24 unmodified lines | ||
| 2795 | 2778 | |
| 2796 | 2779 | map = skb_frag_dma_map(&hw->pdev->dev, frag, 0, |
| 2797 | 2780 | skb_frag_size(frag), DMA_TO_DEVICE); |
| 2798 | − if (dma_mapping_error(&hw->pdev->dev, map)) | |
| 2799 | − goto mapping_unwind; | |
| 2800 | 2781 | |
| 2801 | 2782 | e = e->next; |
| 2802 | 2783 | e->skb = skb; |
| 2803 | 2784 | tf = e->desc; |
| 2804 | 2785 | BUG_ON(tf->control & BMU_OWN); |
| 2805 | 2786 | |
| 2806 | − tf->dma_lo = lower_32_bits(map); | |
| 2807 | − tf->dma_hi = upper_32_bits(map); | |
| 2787 | + tf->dma_lo = map; | |
| 2788 | + tf->dma_hi = (u64) map >> 32; | |
| 2808 | 2789 | dma_unmap_addr_set(e, mapaddr, map); |
| 2809 | 2790 | dma_unmap_len_set(e, maplen, skb_frag_size(frag)); |
| 2810 | 2791 | |
| @@ -2834,28 +2815,6 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, · 23 unmodified lines | ||
| 2834 | 2815 | } |
| 2835 | 2816 | |
| 2836 | 2817 | return NETDEV_TX_OK; |
| 2837 | − | |
| 2838 | −mapping_unwind: | |
| 2839 | − /* unroll any pages that were already mapped. */ | |
| 2840 | − if (e != skge->tx_ring.to_use) { | |
| 2841 | − struct skge_element *u; | |
| 2842 | − | |
| 2843 | − for (u = skge->tx_ring.to_use->next; u != e; u = u->next) | |
| 2844 | − pci_unmap_page(hw->pdev, dma_unmap_addr(u, mapaddr), | |
| 2845 | − dma_unmap_len(u, maplen), | |
| 2846 | − PCI_DMA_TODEVICE); | |
| 2847 | − e = skge->tx_ring.to_use; | |
| 2848 | − } | |
| 2849 | − /* undo the mapping for the skb header */ | |
| 2850 | − pci_unmap_single(hw->pdev, dma_unmap_addr(e, mapaddr), | |
| 2851 | − dma_unmap_len(e, maplen), | |
| 2852 | − PCI_DMA_TODEVICE); | |
| 2853 | −mapping_error: | |
| 2854 | − /* mapping error causes error message and packet to be discarded. */ | |
| 2855 | − if (net_ratelimit()) | |
| 2856 | − dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name); | |
| 2857 | − dev_kfree_skb(skb); | |
| 2858 | − return NETDEV_TX_OK; | |
| 2859 | 2818 | } |
| 2860 | 2819 | |
| 2861 | 2820 | |
| @@ -3099,17 +3058,13 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, · 237 unmodified lines | ||
| 3099 | 3058 | if (!nskb) |
| 3100 | 3059 | goto resubmit; |
| 3101 | 3060 | |
| 3102 | − if (unlikely(skge_rx_setup(skge->hw->pdev, e, nskb, skge->rx_buf_size))) { | |
| 3103 | − dev_kfree_skb(nskb); | |
| 3104 | − goto resubmit; | |
| 3105 | − } | |
| 3106 | − | |
| 3107 | 3061 | pci_unmap_single(skge->hw->pdev, |
| 3108 | 3062 | dma_unmap_addr(e, mapaddr), |
| 3109 | 3063 | dma_unmap_len(e, maplen), |
| 3110 | 3064 | PCI_DMA_FROMDEVICE); |
| 3111 | 3065 | skb = e->skb; |
| 3112 | 3066 | prefetch(skb->data); |
| 3067 | + skge_rx_setup(skge, e, nskb, skge->rx_buf_size); | |
| 3113 | 3068 | } |
| 3114 | 3069 | |
| 3115 | 3070 | skb_put(skb, len); |
| @@ -1616,12 +1616,12 @@ void mlx4_multi_func_cleanup(struct mlx4_dev *dev) · 1615 unmodified lines | ||
| 1616 | 1616 | kfree(priv->mfunc.master.slave_state[i].vlan_filter[port]); |
| 1617 | 1617 | } |
| 1618 | 1618 | kfree(priv->mfunc.master.slave_state); |
| 1619 | − iounmap(priv->mfunc.comm); | |
| 1620 | − dma_free_coherent(&(dev->pdev->dev), PAGE_SIZE, | |
| 1621 | − priv->mfunc.vhcr, | |
| 1622 | − priv->mfunc.vhcr_dma); | |
| 1623 | − priv->mfunc.vhcr = NULL; | |
| 1624 | 1619 | } |
| 1620 | + | |
| 1621 | + iounmap(priv->mfunc.comm); | |
| 1622 | + dma_free_coherent(&(dev->pdev->dev), PAGE_SIZE, | |
| 1623 | + priv->mfunc.vhcr, priv->mfunc.vhcr_dma); | |
| 1624 | + priv->mfunc.vhcr = NULL; | |
| 1625 | 1625 | } |
| 1626 | 1626 | |
| 1627 | 1627 | void mlx4_cmd_cleanup(struct mlx4_dev *dev) |
| @@ -892,7 +892,8 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv) · 891 unmodified lines | ||
| 892 | 892 | |
| 893 | 893 | for (i = 0; i < priv->rx_ring_num; i++) { |
| 894 | 894 | if (priv->rx_ring[i].rx_info) |
| 895 | − mlx4_en_destroy_rx_ring(priv, &priv->rx_ring[i]); | |
| 895 | + mlx4_en_destroy_rx_ring(priv, &priv->rx_ring[i], | |
| 896 | + priv->prof->rx_ring_size, priv->stride); | |
| 896 | 897 | if (priv->rx_cq[i].buf) |
| 897 | 898 | mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); |
| 898 | 899 | } |
| @@ -168,8 +168,12 @@ static int mlx4_en_prepare_rx_desc(struct mlx4_en_priv *priv, · 167 unmodified lines | ||
| 168 | 168 | return 0; |
| 169 | 169 | |
| 170 | 170 | err: |
| 171 | − while (i--) | |
| 171 | + while (i--) { | |
| 172 | + dma_addr_t dma = be64_to_cpu(rx_desc->data[i].addr); | |
| 173 | + pci_unmap_single(priv->mdev->pdev, dma, skb_frags[i].size, | |
| 174 | + PCI_DMA_FROMDEVICE); | |
| 172 | 175 | put_page(skb_frags[i].page); |
| 176 | + } | |
| 173 | 177 | return -ENOMEM; |
| 174 | 178 | } |
| 175 | 179 | |
| @@ -380,12 +384,12 @@ err_allocator: · 204 unmodified lines | ||
| 380 | 384 | } |
| 381 | 385 | |
| 382 | 386 | void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, |
| 383 | − struct mlx4_en_rx_ring *ring) | |
| 387 | + struct mlx4_en_rx_ring *ring, u32 size, u16 stride) | |
| 384 | 388 | { |
| 385 | 389 | struct mlx4_en_dev *mdev = priv->mdev; |
| 386 | 390 | |
| 387 | 391 | mlx4_en_unmap_buffer(&ring->wqres.buf); |
| 388 | − mlx4_free_hwq_res(mdev->dev, &ring->wqres, ring->buf_size + TXBB_SIZE); | |
| 392 | + mlx4_free_hwq_res(mdev->dev, &ring->wqres, size * stride + TXBB_SIZE); | |
| 389 | 393 | vfree(ring->rx_info); |
| 390 | 394 | ring->rx_info = NULL; |
| 391 | 395 | } |
| @@ -815,8 +815,9 @@ int mlx4_init_eq_table(struct mlx4_dev *dev) · 814 unmodified lines | ||
| 815 | 815 | int err; |
| 816 | 816 | int i; |
| 817 | 817 | |
| 818 | − priv->eq_table.uar_map = kcalloc(sizeof *priv->eq_table.uar_map, | |
| 819 | − mlx4_num_eq_uar(dev), GFP_KERNEL); | |
| 818 | + priv->eq_table.uar_map = kcalloc(mlx4_num_eq_uar(dev), | |
| 819 | + sizeof *priv->eq_table.uar_map, | |
| 820 | + GFP_KERNEL); | |
| 820 | 821 | if (!priv->eq_table.uar_map) { |
| 821 | 822 | err = -ENOMEM; |
| 822 | 823 | goto err_out_free; |
| @@ -1035,7 +1036,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector) · 212 unmodified lines | ||
| 1035 | 1036 | struct mlx4_priv *priv = mlx4_priv(dev); |
| 1036 | 1037 | int vec = 0, err = 0, i; |
| 1037 | 1038 | |
| 1038 | − spin_lock(&priv->msix_ctl.pool_lock); | |
| 1039 | + mutex_lock(&priv->msix_ctl.pool_lock); | |
| 1039 | 1040 | for (i = 0; !vec && i < dev->caps.comp_pool; i++) { |
| 1040 | 1041 | if (~priv->msix_ctl.pool_bm & 1ULL << i) { |
| 1041 | 1042 | priv->msix_ctl.pool_bm |= 1ULL << i; |
| @@ -1057,7 +1058,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector) · 15 unmodified lines | ||
| 1057 | 1058 | eq_set_ci(&priv->eq_table.eq[vec], 1); |
| 1058 | 1059 | } |
| 1059 | 1060 | } |
| 1060 | − spin_unlock(&priv->msix_ctl.pool_lock); | |
| 1061 | + mutex_unlock(&priv->msix_ctl.pool_lock); | |
| 1061 | 1062 | |
| 1062 | 1063 | if (vec) { |
| 1063 | 1064 | *vector = vec; |
| @@ -1078,13 +1079,13 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec) · 14 unmodified lines | ||
| 1078 | 1079 | if (likely(i >= 0)) { |
| 1079 | 1080 | /*sanity check , making sure were not trying to free irq's |
| 1080 | 1081 | Belonging to a legacy EQ*/ |
| 1081 | − spin_lock(&priv->msix_ctl.pool_lock); | |
| 1082 | + mutex_lock(&priv->msix_ctl.pool_lock); | |
| 1082 | 1083 | if (priv->msix_ctl.pool_bm & 1ULL << i) { |
| 1083 | 1084 | free_irq(priv->eq_table.eq[vec].irq, |
| 1084 | 1085 | &priv->eq_table.eq[vec]); |
| 1085 | 1086 | priv->msix_ctl.pool_bm &= ~(1ULL << i); |
| 1086 | 1087 | } |
| 1087 | − spin_unlock(&priv->msix_ctl.pool_lock); | |
| 1088 | + mutex_unlock(&priv->msix_ctl.pool_lock); | |
| 1088 | 1089 | } |
| 1089 | 1090 | |
| 1090 | 1091 | } |
| @@ -685,7 +685,7 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, · 684 unmodified lines | ||
| 685 | 685 | return err; |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | −static int mlx4_QUERY_PORT(struct mlx4_dev *dev, void *ptr, u8 port) | |
| 688 | +int mlx4_QUERY_PORT(struct mlx4_dev *dev, void *ptr, u8 port) | |
| 689 | 689 | { |
| 690 | 690 | struct mlx4_cmd_mailbox *outbox = ptr; |
| 691 | 691 | |
| @@ -531,15 +531,14 @@ int mlx4_change_port_types(struct mlx4_dev *dev, · 530 unmodified lines | ||
| 531 | 531 | for (port = 0; port < dev->caps.num_ports; port++) { |
| 532 | 532 | /* Change the port type only if the new type is different |
| 533 | 533 | * from the current, and not set to Auto */ |
| 534 | − if (port_types[port] != dev->caps.port_type[port + 1]) { | |
| 534 | + if (port_types[port] != dev->caps.port_type[port + 1]) | |
| 535 | 535 | change = 1; |
| 536 | − dev->caps.port_type[port + 1] = port_types[port]; | |
| 537 | − } | |
| 538 | 536 | } |
| 539 | 537 | if (change) { |
| 540 | 538 | mlx4_unregister_device(dev); |
| 541 | 539 | for (port = 1; port <= dev->caps.num_ports; port++) { |
| 542 | 540 | mlx4_CLOSE_PORT(dev, port); |
| 541 | + dev->caps.port_type[port] = port_types[port - 1]; | |
| 543 | 542 | err = mlx4_SET_PORT(dev, port); |
| 544 | 543 | if (err) { |
| 545 | 544 | mlx4_err(dev, "Failed to set port %d, " |
| @@ -986,6 +985,9 @@ static int map_bf_area(struct mlx4_dev *dev) · 440 unmodified lines | ||
| 986 | 985 | resource_size_t bf_len; |
| 987 | 986 | int err = 0; |
| 988 | 987 | |
| 988 | + if (!dev->caps.bf_reg_size) | |
| 989 | + return -ENXIO; | |
| 990 | + | |
| 989 | 991 | bf_start = pci_resource_start(dev->pdev, 2) + |
| 990 | 992 | (dev->caps.num_uars << PAGE_SHIFT); |
| 991 | 993 | bf_len = pci_resource_len(dev->pdev, 2) - |
| @@ -1825,7 +1827,7 @@ slave_start: · 833 unmodified lines | ||
| 1825 | 1827 | goto err_master_mfunc; |
| 1826 | 1828 | |
| 1827 | 1829 | priv->msix_ctl.pool_bm = 0; |
| 1828 | − spin_lock_init(&priv->msix_ctl.pool_lock); | |
| 1830 | + mutex_init(&priv->msix_ctl.pool_lock); | |
| 1829 | 1831 | |
| 1830 | 1832 | mlx4_enable_msi_x(dev); |
| 1831 | 1833 | if ((mlx4_is_mfunc(dev)) && |
| @@ -136,7 +136,7 @@ static int new_steering_entry(struct mlx4_dev *dev, u8 port, · 135 unmodified lines | ||
| 136 | 136 | u32 prot; |
| 137 | 137 | int err; |
| 138 | 138 | |
| 139 | − s_steer = &mlx4_priv(dev)->steer[0]; | |
| 139 | + s_steer = &mlx4_priv(dev)->steer[port - 1]; | |
| 140 | 140 | new_entry = kzalloc(sizeof *new_entry, GFP_KERNEL); |
| 141 | 141 | if (!new_entry) |
| 142 | 142 | return -ENOMEM; |
| @@ -220,7 +220,7 @@ static int existing_steering_entry(struct mlx4_dev *dev, u8 port, · 77 unmodified lines | ||
| 220 | 220 | struct mlx4_promisc_qp *pqp; |
| 221 | 221 | struct mlx4_promisc_qp *dqp; |
| 222 | 222 | |
| 223 | − s_steer = &mlx4_priv(dev)->steer[0]; | |
| 223 | + s_steer = &mlx4_priv(dev)->steer[port - 1]; | |
| 224 | 224 | |
| 225 | 225 | pqp = get_promisc_qp(dev, 0, steer, qpn); |
| 226 | 226 | if (!pqp) |
| @@ -265,7 +265,7 @@ static bool check_duplicate_entry(struct mlx4_dev *dev, u8 port, · 38 unmodified lines | ||
| 265 | 265 | struct mlx4_steer_index *tmp_entry, *entry = NULL; |
| 266 | 266 | struct mlx4_promisc_qp *dqp, *tmp_dqp; |
| 267 | 267 | |
| 268 | − s_steer = &mlx4_priv(dev)->steer[0]; | |
| 268 | + s_steer = &mlx4_priv(dev)->steer[port - 1]; | |
| 269 | 269 | |
| 270 | 270 | /* if qp is not promisc, it cannot be duplicated */ |
| 271 | 271 | if (!get_promisc_qp(dev, 0, steer, qpn)) |
| @@ -306,7 +306,7 @@ static bool can_remove_steering_entry(struct mlx4_dev *dev, u8 port, · 34 unmodified lines | ||
| 306 | 306 | bool ret = false; |
| 307 | 307 | int i; |
| 308 | 308 | |
| 309 | − s_steer = &mlx4_priv(dev)->steer[0]; | |
| 309 | + s_steer = &mlx4_priv(dev)->steer[port - 1]; | |
| 310 | 310 | |
| 311 | 311 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
| 312 | 312 | if (IS_ERR(mailbox)) |
| @@ -361,7 +361,7 @@ static int add_promisc_qp(struct mlx4_dev *dev, u8 port, · 48 unmodified lines | ||
| 361 | 361 | int err; |
| 362 | 362 | struct mlx4_priv *priv = mlx4_priv(dev); |
| 363 | 363 | |
| 364 | − s_steer = &mlx4_priv(dev)->steer[0]; | |
| 364 | + s_steer = &mlx4_priv(dev)->steer[port - 1]; | |
| 365 | 365 | |
| 366 | 366 | mutex_lock(&priv->mcg_table.mutex); |
| 367 | 367 | |
| @@ -466,7 +466,7 @@ static int remove_promisc_qp(struct mlx4_dev *dev, u8 port, · 98 unmodified lines | ||
| 466 | 466 | int loc, i; |
| 467 | 467 | int err; |
| 468 | 468 | |
| 469 | − s_steer = &mlx4_priv(dev)->steer[0]; | |
| 469 | + s_steer = &mlx4_priv(dev)->steer[port - 1]; | |
| 470 | 470 | mutex_lock(&priv->mcg_table.mutex); |
| 471 | 471 | |
| 472 | 472 | pqp = get_promisc_qp(dev, 0, steer, qpn); |
| @@ -1004,7 +1004,7 @@ EXPORT_SYMBOL_GPL(mlx4_multicast_promisc_remove); · 531 unmodified lines | ||
| 1004 | 1004 | |
| 1005 | 1005 | int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port) |
| 1006 | 1006 | { |
| 1007 | − if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER)) | |
| 1007 | + if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_UC_STEER)) | |
| 1008 | 1008 | return 0; |
| 1009 | 1009 | |
| 1010 | 1010 | if (mlx4_is_mfunc(dev)) |
| @@ -1016,7 +1016,7 @@ EXPORT_SYMBOL_GPL(mlx4_unicast_promisc_add); · 5 unmodified lines | ||
| 1016 | 1016 | |
| 1017 | 1017 | int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port) |
| 1018 | 1018 | { |
| 1019 | − if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER)) | |
| 1019 | + if (!(dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_UC_STEER)) | |
| 1020 | 1020 | return 0; |
| 1021 | 1021 | |
| 1022 | 1022 | if (mlx4_is_mfunc(dev)) |
| @@ -697,7 +697,7 @@ struct mlx4_sense { · 696 unmodified lines | ||
| 697 | 697 | |
| 698 | 698 | struct mlx4_msix_ctl { |
| 699 | 699 | u64 pool_bm; |
| 700 | − spinlock_t pool_lock; | |
| 700 | + struct mutex pool_lock; | |
| 701 | 701 | }; |
| 702 | 702 | |
| 703 | 703 | struct mlx4_steer { |
| @@ -528,7 +528,8 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, · 527 unmodified lines | ||
| 528 | 528 | struct mlx4_en_rx_ring *ring, |
| 529 | 529 | u32 size, u16 stride); |
| 530 | 530 | void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, |
| 531 | − struct mlx4_en_rx_ring *ring); | |
| 531 | + struct mlx4_en_rx_ring *ring, | |
| 532 | + u32 size, u16 stride); | |
| 532 | 533 | int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv); |
| 533 | 534 | void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, |
| 534 | 535 | struct mlx4_en_rx_ring *ring); |
| @@ -304,7 +304,7 @@ static int mlx4_HW2SW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox · 303 unmodified lines | ||
| 304 | 304 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | −static int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align, | |
| 307 | +int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align, | |
| 308 | 308 | u32 *base_mridx) |
| 309 | 309 | { |
| 310 | 310 | struct mlx4_priv *priv = mlx4_priv(dev); |
| @@ -320,14 +320,14 @@ static int mlx4_mr_reserve_range(struct mlx4_dev *dev, int cnt, int align, · 9 unmodified lines | ||
| 320 | 320 | } |
| 321 | 321 | EXPORT_SYMBOL_GPL(mlx4_mr_reserve_range); |
| 322 | 322 | |
| 323 | −static void mlx4_mr_release_range(struct mlx4_dev *dev, u32 base_mridx, int cnt) | |
| 323 | +void mlx4_mr_release_range(struct mlx4_dev *dev, u32 base_mridx, int cnt) | |
| 324 | 324 | { |
| 325 | 325 | struct mlx4_priv *priv = mlx4_priv(dev); |
| 326 | 326 | mlx4_bitmap_free_range(&priv->mr_table.mpt_bitmap, base_mridx, cnt); |
| 327 | 327 | } |
| 328 | 328 | EXPORT_SYMBOL_GPL(mlx4_mr_release_range); |
| 329 | 329 | |
| 330 | −static int mlx4_mr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, u32 pd, | |
| 330 | +int mlx4_mr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, u32 pd, | |
| 331 | 331 | u64 iova, u64 size, u32 access, int npages, |
| 332 | 332 | int page_shift, struct mlx4_mr *mr) |
| 333 | 333 | { |
| @@ -457,7 +457,7 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access, · 123 unmodified lines | ||
| 457 | 457 | } |
| 458 | 458 | EXPORT_SYMBOL_GPL(mlx4_mr_alloc); |
| 459 | 459 | |
| 460 | −static void mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr) | |
| 460 | +void mlx4_mr_free_reserved(struct mlx4_dev *dev, struct mlx4_mr *mr) | |
| 461 | 461 | { |
| 462 | 462 | int err; |
| 463 | 463 | |
| @@ -852,7 +852,7 @@ err_free: · 388 unmodified lines | ||
| 852 | 852 | } |
| 853 | 853 | EXPORT_SYMBOL_GPL(mlx4_fmr_alloc); |
| 854 | 854 | |
| 855 | −static int mlx4_fmr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, | |
| 855 | +int mlx4_fmr_alloc_reserved(struct mlx4_dev *dev, u32 mridx, | |
| 856 | 856 | u32 pd, u32 access, int max_pages, |
| 857 | 857 | int max_maps, u8 page_shift, struct mlx4_fmr *fmr) |
| 858 | 858 | { |
| @@ -954,7 +954,7 @@ int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr) · 95 unmodified lines | ||
| 954 | 954 | } |
| 955 | 955 | EXPORT_SYMBOL_GPL(mlx4_fmr_free); |
| 956 | 956 | |
| 957 | −static int mlx4_fmr_free_reserved(struct mlx4_dev *dev, struct mlx4_fmr *fmr) | |
| 957 | +int mlx4_fmr_free_reserved(struct mlx4_dev *dev, struct mlx4_fmr *fmr) | |
| 958 | 958 | { |
| 959 | 959 | if (fmr->maps) |
| 960 | 960 | return -EBUSY; |
| @@ -73,6 +73,7 @@ struct res_gid { · 72 unmodified lines | ||
| 73 | 73 | struct list_head list; |
| 74 | 74 | u8 gid[16]; |
| 75 | 75 | enum mlx4_protocol prot; |
| 76 | + enum mlx4_steer_type steer; | |
| 76 | 77 | }; |
| 77 | 78 | |
| 78 | 79 | enum res_qp_states { |
| @@ -374,6 +375,7 @@ static struct res_common *alloc_qp_tr(int id) · 295 unmodified lines | ||
| 374 | 375 | |
| 375 | 376 | ret->com.res_id = id; |
| 376 | 377 | ret->com.state = RES_QP_RESERVED; |
| 378 | + ret->local_qpn = id; | |
| 377 | 379 | INIT_LIST_HEAD(&ret->mcg_list); |
| 378 | 380 | spin_lock_init(&ret->mcg_spl); |
| 379 | 381 | |
| @@ -2479,7 +2481,8 @@ static struct res_gid *find_gid(struct mlx4_dev *dev, int slave, · 2099 unmodified lines | ||
| 2479 | 2481 | } |
| 2480 | 2482 | |
| 2481 | 2483 | static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, |
| 2482 | − u8 *gid, enum mlx4_protocol prot) | |
| 2484 | + u8 *gid, enum mlx4_protocol prot, | |
| 2485 | + enum mlx4_steer_type steer) | |
| 2483 | 2486 | { |
| 2484 | 2487 | struct res_gid *res; |
| 2485 | 2488 | int err; |
| @@ -2495,6 +2498,7 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, · 9 unmodified lines | ||
| 2495 | 2498 | } else { |
| 2496 | 2499 | memcpy(res->gid, gid, 16); |
| 2497 | 2500 | res->prot = prot; |
| 2501 | + res->steer = steer; | |
| 2498 | 2502 | list_add_tail(&res->list, &rqp->mcg_list); |
| 2499 | 2503 | err = 0; |
| 2500 | 2504 | } |
| @@ -2504,14 +2508,15 @@ static int add_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, · 3 unmodified lines | ||
| 2504 | 2508 | } |
| 2505 | 2509 | |
| 2506 | 2510 | static int rem_mcg_res(struct mlx4_dev *dev, int slave, struct res_qp *rqp, |
| 2507 | − u8 *gid, enum mlx4_protocol prot) | |
| 2511 | + u8 *gid, enum mlx4_protocol prot, | |
| 2512 | + enum mlx4_steer_type steer) | |
| 2508 | 2513 | { |
| 2509 | 2514 | struct res_gid *res; |
| 2510 | 2515 | int err; |
| 2511 | 2516 | |
| 2512 | 2517 | spin_lock_irq(&rqp->mcg_spl); |
| 2513 | 2518 | res = find_gid(dev, slave, rqp, gid); |
| 2514 | − if (!res || res->prot != prot) | |
| 2519 | + if (!res || res->prot != prot || res->steer != steer) | |
| 2515 | 2520 | err = -EINVAL; |
| 2516 | 2521 | else { |
| 2517 | 2522 | list_del(&res->list); |
| @@ -2538,7 +2543,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, · 20 unmodified lines | ||
| 2538 | 2543 | int attach = vhcr->op_modifier; |
| 2539 | 2544 | int block_loopback = vhcr->in_modifier >> 31; |
| 2540 | 2545 | u8 steer_type_mask = 2; |
| 2541 | − enum mlx4_steer_type type = gid[7] & steer_type_mask; | |
| 2546 | + enum mlx4_steer_type type = (gid[7] & steer_type_mask) >> 1; | |
| 2542 | 2547 | |
| 2543 | 2548 | qpn = vhcr->in_modifier & 0xffffff; |
| 2544 | 2549 | err = get_res(dev, slave, qpn, RES_QP, &rqp); |
| @@ -2547,7 +2552,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, · 2 unmodified lines | ||
| 2547 | 2552 | |
| 2548 | 2553 | qp.qpn = qpn; |
| 2549 | 2554 | if (attach) { |
| 2550 | − err = add_mcg_res(dev, slave, rqp, gid, prot); | |
| 2555 | + err = add_mcg_res(dev, slave, rqp, gid, prot, type); | |
| 2551 | 2556 | if (err) |
| 2552 | 2557 | goto ex_put; |
| 2553 | 2558 | |
| @@ -2556,7 +2561,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, · 2 unmodified lines | ||
| 2556 | 2561 | if (err) |
| 2557 | 2562 | goto ex_rem; |
| 2558 | 2563 | } else { |
| 2559 | − err = rem_mcg_res(dev, slave, rqp, gid, prot); | |
| 2564 | + err = rem_mcg_res(dev, slave, rqp, gid, prot, type); | |
| 2560 | 2565 | if (err) |
| 2561 | 2566 | goto ex_put; |
| 2562 | 2567 | err = mlx4_qp_detach_common(dev, &qp, gid, prot, type); |
| @@ -2567,7 +2572,7 @@ int mlx4_QP_ATTACH_wrapper(struct mlx4_dev *dev, int slave, · 4 unmodified lines | ||
| 2567 | 2572 | |
| 2568 | 2573 | ex_rem: |
| 2569 | 2574 | /* ignore error return below, already in error */ |
| 2570 | − err1 = rem_mcg_res(dev, slave, rqp, gid, prot); | |
| 2575 | + err1 = rem_mcg_res(dev, slave, rqp, gid, prot, type); | |
| 2571 | 2576 | ex_put: |
| 2572 | 2577 | put_res(dev, slave, qpn, RES_QP); |
| 2573 | 2578 | |
| @@ -2606,7 +2611,7 @@ static void detach_qp(struct mlx4_dev *dev, int slave, struct res_qp *rqp) · 32 unmodified lines | ||
| 2606 | 2611 | list_for_each_entry_safe(rgid, tmp, &rqp->mcg_list, list) { |
| 2607 | 2612 | qp.qpn = rqp->local_qpn; |
| 2608 | 2613 | err = mlx4_qp_detach_common(dev, &qp, rgid->gid, rgid->prot, |
| 2609 | − MLX4_MC_STEER); | |
| 2614 | + rgid->steer); | |
| 2610 | 2615 | list_del(&rgid->list); |
| 2611 | 2616 | kfree(rgid); |
| 2612 | 2617 | } |
| @@ -42,7 +42,6 @@ config KS8851 · 41 unmodified lines | ||
| 42 | 42 | select NET_CORE |
| 43 | 43 | select MII |
| 44 | 44 | select CRC32 |
| 45 | − select MISC_DEVICES | |
| 46 | 45 | select EEPROM_93CX6 |
| 47 | 46 | ---help--- |
| 48 | 47 | SPI driver for Micrel KS8851 SPI attached network chip. |
| @@ -583,7 +583,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks) · 582 unmodified lines | ||
| 583 | 583 | ks8851_dbg_dumpkkt(ks, rxpkt); |
| 584 | 584 | |
| 585 | 585 | skb->protocol = eth_type_trans(skb, ks->netdev); |
| 586 | − netif_rx(skb); | |
| 586 | + netif_rx_ni(skb); | |
| 587 | 587 | |
| 588 | 588 | ks->netdev->stats.rx_packets++; |
| 589 | 589 | ks->netdev->stats.rx_bytes += rxlen; |
| @@ -394,7 +394,6 @@ union ks_tx_hdr { · 393 unmodified lines | ||
| 394 | 394 | * @msg_enable : The message flags controlling driver output (see ethtool). |
| 395 | 395 | * @frame_cnt : number of frames received. |
| 396 | 396 | * @bus_width : i/o bus width. |
| 397 | − * @irq : irq number assigned to this device. | |
| 398 | 397 | * @rc_rxqcr : Cached copy of KS_RXQCR. |
| 399 | 398 | * @rc_txcr : Cached copy of KS_TXCR. |
| 400 | 399 | * @rc_ier : Cached copy of KS_IER. |
| @@ -441,7 +440,6 @@ struct ks_net { · 40 unmodified lines | ||
| 441 | 440 | u32 msg_enable; |
| 442 | 441 | u32 frame_cnt; |
| 443 | 442 | int bus_width; |
| 444 | − int irq; | |
| 445 | 443 | |
| 446 | 444 | u16 rc_rxqcr; |
| 447 | 445 | u16 rc_txcr; |
| @@ -907,10 +905,10 @@ static int ks_net_open(struct net_device *netdev) · 459 unmodified lines | ||
| 907 | 905 | netif_dbg(ks, ifup, ks->netdev, "%s - entry\n", __func__); |
| 908 | 906 | |
| 909 | 907 | /* reset the HW */ |
| 910 | − err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, netdev); | |
| 908 | + err = request_irq(netdev->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, netdev); | |
| 911 | 909 | |
| 912 | 910 | if (err) { |
| 913 | − pr_err("Failed to request IRQ: %d: %d\n", ks->irq, err); | |
| 911 | + pr_err("Failed to request IRQ: %d: %d\n", netdev->irq, err); | |
| 914 | 912 | return err; |
| 915 | 913 | } |
| 916 | 914 | |
| @@ -955,7 +953,7 @@ static int ks_net_stop(struct net_device *netdev) · 38 unmodified lines | ||
| 955 | 953 | |
| 956 | 954 | /* set powermode to soft power down to save power */ |
| 957 | 955 | ks_set_powermode(ks, PMECR_PM_SOFTDOWN); |
| 958 | − free_irq(ks->irq, netdev); | |
| 956 | + free_irq(netdev->irq, netdev); | |
| 959 | 957 | mutex_unlock(&ks->lock); |
| 960 | 958 | return 0; |
| 961 | 959 | } |
| @@ -1545,10 +1543,10 @@ static int __devinit ks8851_probe(struct platform_device *pdev) · 583 unmodified lines | ||
| 1545 | 1543 | if (!ks->hw_addr_cmd) |
| 1546 | 1544 | goto err_ioremap1; |
| 1547 | 1545 | |
| 1548 | − ks->irq = platform_get_irq(pdev, 0); | |
| 1546 | + netdev->irq = platform_get_irq(pdev, 0); | |
| 1549 | 1547 | |
| 1550 | − if (ks->irq < 0) { | |
| 1551 | − err = ks->irq; | |
| 1548 | + if ((int)netdev->irq < 0) { | |
| 1549 | + err = netdev->irq; | |
| 1552 | 1550 | goto err_get_irq; |
| 1553 | 1551 | } |
| 1554 | 1552 | |
| @@ -670,7 +670,7 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev) · 669 unmodified lines | ||
| 670 | 670 | static int octeon_mgmt_init_phy(struct net_device *netdev) |
| 671 | 671 | { |
| 672 | 672 | struct octeon_mgmt *p = netdev_priv(netdev); |
| 673 | − char phy_id[20]; | |
| 673 | + char phy_id[MII_BUS_ID_SIZE + 3]; | |
| 674 | 674 | |
| 675 | 675 | if (octeon_is_simulation()) { |
| 676 | 676 | /* No PHYs in the simulator. */ |
| @@ -678,7 +678,7 @@ static int octeon_mgmt_init_phy(struct net_device *netdev) · 1 unmodified line | ||
| 678 | 678 | return 0; |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | − snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "0", p->port); | |
| 681 | + snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, "mdio-octeon-0", p->port); | |
| 682 | 682 | |
| 683 | 683 | p->phydev = phy_connect(netdev, phy_id, octeon_mgmt_adjust_link, 0, |
| 684 | 684 | PHY_INTERFACE_MODE_MII); |
| @@ -38,6 +38,7 @@ · 37 unmodified lines | ||
| 38 | 38 | #include <linux/pm_runtime.h> |
| 39 | 39 | #include <linux/slab.h> |
| 40 | 40 | #include <linux/ethtool.h> |
| 41 | +#include <linux/if_vlan.h> | |
| 41 | 42 | #include <linux/sh_eth.h> |
| 42 | 43 | |
| 43 | 44 | #include "sh_eth.h" |
| @@ -817,7 +818,8 @@ static int sh_eth_dev_init(struct net_device *ndev) · 773 unmodified lines | ||
| 817 | 818 | sh_eth_write(ndev, 0, TRIMD); |
| 818 | 819 | |
| 819 | 820 | /* Recv frame limit set register */ |
| 820 | − sh_eth_write(ndev, RFLR_VALUE, RFLR); | |
| 821 | + sh_eth_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, | |
| 822 | + RFLR); | |
| 821 | 823 | |
| 822 | 824 | sh_eth_write(ndev, sh_eth_read(ndev, EESR), EESR); |
| 823 | 825 | sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); |
| @@ -575,9 +575,6 @@ enum RPADIR_BIT { · 574 unmodified lines | ||
| 575 | 575 | RPADIR_PADR = 0x0003f, |
| 576 | 576 | }; |
| 577 | 577 | |
| 578 | −/* RFLR */ | |
| 579 | −#define RFLR_VALUE 0x1000 | |
| 580 | − | |
| 581 | 578 | /* FDR */ |
| 582 | 579 | #define DEFAULT_FDR_INIT 0x00000707 |
| 583 | 580 | |
| @@ -156,11 +156,10 @@ static int efx_init_rx_buffers_skb(struct efx_rx_queue *rx_queue) · 155 unmodified lines | ||
| 156 | 156 | if (unlikely(!skb)) |
| 157 | 157 | return -ENOMEM; |
| 158 | 158 | |
| 159 | − /* Adjust the SKB for padding and checksum */ | |
| 159 | + /* Adjust the SKB for padding */ | |
| 160 | 160 | skb_reserve(skb, NET_IP_ALIGN); |
| 161 | 161 | rx_buf->len = skb_len - NET_IP_ALIGN; |
| 162 | 162 | rx_buf->is_page = false; |
| 163 | − skb->ip_summed = CHECKSUM_UNNECESSARY; | |
| 164 | 163 | |
| 165 | 164 | rx_buf->dma_addr = pci_map_single(efx->pci_dev, |
| 166 | 165 | skb->data, rx_buf->len, |
| @@ -496,6 +495,7 @@ static void efx_rx_packet_gro(struct efx_channel *channel, · 329 unmodified lines | ||
| 496 | 495 | |
| 497 | 496 | EFX_BUG_ON_PARANOID(!checksummed); |
| 498 | 497 | rx_buf->u.skb = NULL; |
| 498 | + skb->ip_summed = CHECKSUM_UNNECESSARY; | |
| 499 | 499 | |
| 500 | 500 | gro_result = napi_gro_receive(napi, skb); |
| 501 | 501 | } |
| @@ -67,6 +67,7 @@ struct stmmac_extra_stats { · 66 unmodified lines | ||
| 67 | 67 | unsigned long ipc_csum_error; |
| 68 | 68 | unsigned long rx_collision; |
| 69 | 69 | unsigned long rx_crc; |
| 70 | + unsigned long dribbling_bit; | |
| 70 | 71 | unsigned long rx_length; |
| 71 | 72 | unsigned long rx_mii; |
| 72 | 73 | unsigned long rx_multicast; |
| @@ -201,7 +201,7 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x, · 200 unmodified lines | ||
| 201 | 201 | |
| 202 | 202 | if (unlikely(p->des01.erx.dribbling)) { |
| 203 | 203 | CHIP_DBG(KERN_ERR "GMAC RX: dribbling error\n"); |
| 204 | − ret = discard_frame; | |
| 204 | + x->dribbling_bit++; | |
| 205 | 205 | } |
| 206 | 206 | if (unlikely(p->des01.erx.sa_filter_fail)) { |
| 207 | 207 | CHIP_DBG(KERN_ERR "GMAC RX : Source Address filter fail\n"); |
| @@ -104,7 +104,7 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x, · 103 unmodified lines | ||
| 104 | 104 | ret = discard_frame; |
| 105 | 105 | } |
| 106 | 106 | if (unlikely(p->des01.rx.dribbling)) |
| 107 | − ret = discard_frame; | |
| 107 | + x->dribbling_bit++; | |
| 108 | 108 | |
| 109 | 109 | if (unlikely(p->des01.rx.length_error)) { |
| 110 | 110 | x->rx_length++; |
| @@ -21,7 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | *******************************************************************************/ |
| 22 | 22 | |
| 23 | 23 | #define STMMAC_RESOURCE_NAME "stmmaceth" |
| 24 | −#define DRV_MODULE_VERSION "Dec_2011" | |
| 24 | +#define DRV_MODULE_VERSION "Feb_2012" | |
| 25 | 25 | #include <linux/stmmac.h> |
| 26 | 26 | #include <linux/phy.h> |
| 27 | 27 | #include "common.h" |
| @@ -97,4 +97,5 @@ int stmmac_resume(struct net_device *ndev); · 69 unmodified lines | ||
| 97 | 97 | int stmmac_suspend(struct net_device *ndev); |
| 98 | 98 | int stmmac_dvr_remove(struct net_device *ndev); |
| 99 | 99 | struct stmmac_priv *stmmac_dvr_probe(struct device *device, |
| 100 | − struct plat_stmmacenet_data *plat_dat); | |
| 100 | + struct plat_stmmacenet_data *plat_dat, | |
| 101 | + void __iomem *addr); | |
| @@ -47,23 +47,25 @@ struct stmmac_stats { · 46 unmodified lines | ||
| 47 | 47 | offsetof(struct stmmac_priv, xstats.m)} |
| 48 | 48 | |
| 49 | 49 | static const struct stmmac_stats stmmac_gstrings_stats[] = { |
| 50 | + /* Transmit errors */ | |
| 50 | 51 | STMMAC_STAT(tx_underflow), |
| 51 | 52 | STMMAC_STAT(tx_carrier), |
| 52 | 53 | STMMAC_STAT(tx_losscarrier), |
| 53 | 54 | STMMAC_STAT(vlan_tag), |
| 54 | 55 | STMMAC_STAT(tx_deferred), |
| 55 | 56 | STMMAC_STAT(tx_vlan), |
| 56 | − STMMAC_STAT(rx_vlan), | |
| 57 | 57 | STMMAC_STAT(tx_jabber), |
| 58 | 58 | STMMAC_STAT(tx_frame_flushed), |
| 59 | 59 | STMMAC_STAT(tx_payload_error), |
| 60 | 60 | STMMAC_STAT(tx_ip_header_error), |
| 61 | + /* Receive errors */ | |
| 61 | 62 | STMMAC_STAT(rx_desc), |
| 62 | 63 | STMMAC_STAT(sa_filter_fail), |
| 63 | 64 | STMMAC_STAT(overflow_error), |
| 64 | 65 | STMMAC_STAT(ipc_csum_error), |
| 65 | 66 | STMMAC_STAT(rx_collision), |
| 66 | 67 | STMMAC_STAT(rx_crc), |
| 68 | + STMMAC_STAT(dribbling_bit), | |
| 67 | 69 | STMMAC_STAT(rx_length), |
| 68 | 70 | STMMAC_STAT(rx_mii), |
| 69 | 71 | STMMAC_STAT(rx_multicast), |
| @@ -73,6 +75,8 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = { · 3 unmodified lines | ||
| 73 | 75 | STMMAC_STAT(sa_rx_filter_fail), |
| 74 | 76 | STMMAC_STAT(rx_missed_cntr), |
| 75 | 77 | STMMAC_STAT(rx_overflow_cntr), |
| 78 | + STMMAC_STAT(rx_vlan), | |
| 79 | + /* Tx/Rx IRQ errors */ | |
| 76 | 80 | STMMAC_STAT(tx_undeflow_irq), |
| 77 | 81 | STMMAC_STAT(tx_process_stopped_irq), |
| 78 | 82 | STMMAC_STAT(tx_jabber_irq), |
| @@ -82,6 +86,7 @@ static const struct stmmac_stats stmmac_gstrings_stats[] = { · 3 unmodified lines | ||
| 82 | 86 | STMMAC_STAT(rx_watchdog_irq), |
| 83 | 87 | STMMAC_STAT(tx_early_irq), |
| 84 | 88 | STMMAC_STAT(fatal_bus_error_irq), |
| 89 | + /* Extra info */ | |
| 85 | 90 | STMMAC_STAT(threshold), |
| 86 | 91 | STMMAC_STAT(tx_pkt_n), |
| 87 | 92 | STMMAC_STAT(rx_pkt_n), |
| @@ -241,7 +241,7 @@ static void stmmac_adjust_link(struct net_device *dev) · 240 unmodified lines | ||
| 241 | 241 | case 1000: |
| 242 | 242 | if (likely(priv->plat->has_gmac)) |
| 243 | 243 | ctrl &= ~priv->hw->link.port; |
| 244 | − stmmac_hw_fix_mac_speed(priv); | |
| 244 | + stmmac_hw_fix_mac_speed(priv); | |
| 245 | 245 | break; |
| 246 | 246 | case 100: |
| 247 | 247 | case 10: |
| @@ -785,7 +785,7 @@ static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv) · 537 unmodified lines | ||
| 785 | 785 | u32 uid = ((hwid & 0x0000ff00) >> 8); |
| 786 | 786 | u32 synid = (hwid & 0x000000ff); |
| 787 | 787 | |
| 788 | − pr_info("STMMAC - user ID: 0x%x, Synopsys ID: 0x%x\n", | |
| 788 | + pr_info("stmmac - user ID: 0x%x, Synopsys ID: 0x%x\n", | |
| 789 | 789 | uid, synid); |
| 790 | 790 | |
| 791 | 791 | return synid; |
| @@ -869,38 +869,6 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv) · 77 unmodified lines | ||
| 869 | 869 | return hw_cap; |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | −/** | |
| 873 | − * stmmac_mac_device_setup | |
| 874 | − * @dev : device pointer | |
| 875 | − * Description: this is to attach the GMAC or MAC 10/100 | |
| 876 | − * main core structures that will be completed during the | |
| 877 | − * open step. | |
| 878 | − */ | |
| 879 | −static int stmmac_mac_device_setup(struct net_device *dev) | |
| 880 | −{ | |
| 881 | − struct stmmac_priv *priv = netdev_priv(dev); | |
| 882 | − | |
| 883 | − struct mac_device_info *device; | |
| 884 | − | |
| 885 | − if (priv->plat->has_gmac) | |
| 886 | − device = dwmac1000_setup(priv->ioaddr); | |
| 887 | − else | |
| 888 | − device = dwmac100_setup(priv->ioaddr); | |
| 889 | − | |
| 890 | − if (!device) | |
| 891 | − return -ENOMEM; | |
| 892 | − | |
| 893 | − priv->hw = device; | |
| 894 | − priv->hw->ring = &ring_mode_ops; | |
| 895 | − | |
| 896 | − if (device_can_wakeup(priv->device)) { | |
| 897 | − priv->wolopts = WAKE_MAGIC; /* Magic Frame as default */ | |
| 898 | − enable_irq_wake(priv->wol_irq); | |
| 899 | − } | |
| 900 | − | |
| 901 | − return 0; | |
| 902 | −} | |
| 903 | − | |
| 904 | 872 | static void stmmac_check_ether_addr(struct stmmac_priv *priv) |
| 905 | 873 | { |
| 906 | 874 | /* verify if the MAC address is valid, in case of failures it |
| @@ -930,20 +898,8 @@ static int stmmac_open(struct net_device *dev) · 23 unmodified lines | ||
| 930 | 898 | struct stmmac_priv *priv = netdev_priv(dev); |
| 931 | 899 | int ret; |
| 932 | 900 | |
| 933 | − /* MAC HW device setup */ | |
| 934 | − ret = stmmac_mac_device_setup(dev); | |
| 935 | − if (ret < 0) | |
| 936 | − return ret; | |
| 937 | − | |
| 938 | 901 | stmmac_check_ether_addr(priv); |
| 939 | 902 | |
| 940 | − stmmac_verify_args(); | |
| 941 | − | |
| 942 | − /* Override with kernel parameters if supplied XXX CRS XXX | |
| 943 | − * this needs to have multiple instances */ | |
| 944 | − if ((phyaddr >= 0) && (phyaddr <= 31)) | |
| 945 | − priv->plat->phy_addr = phyaddr; | |
| 946 | − | |
| 947 | 903 | /* MDIO bus Registration */ |
| 948 | 904 | ret = stmmac_mdio_register(dev); |
| 949 | 905 | if (ret < 0) { |
| @@ -976,44 +932,6 @@ static int stmmac_open(struct net_device *dev) · 26 unmodified lines | ||
| 976 | 932 | goto open_error; |
| 977 | 933 | } |
| 978 | 934 | |
| 979 | − stmmac_get_synopsys_id(priv); | |
| 980 | − | |
| 981 | − priv->hw_cap_support = stmmac_get_hw_features(priv); | |
| 982 | − | |
| 983 | − if (priv->hw_cap_support) { | |
| 984 | − pr_info(" Support DMA HW capability register"); | |
| 985 | − | |
| 986 | − /* We can override some gmac/dma configuration fields: e.g. | |
| 987 | − * enh_desc, tx_coe (e.g. that are passed through the | |
| 988 | − * platform) with the values from the HW capability | |
| 989 | − * register (if supported). | |
| 990 | − */ | |
| 991 | − priv->plat->enh_desc = priv->dma_cap.enh_desc; | |
| 992 | − priv->plat->tx_coe = priv->dma_cap.tx_coe; | |
| 993 | − priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up; | |
| 994 | − | |
| 995 | − /* By default disable wol on magic frame if not supported */ | |
| 996 | − if (!priv->dma_cap.pmt_magic_frame) | |
| 997 | − priv->wolopts &= ~WAKE_MAGIC; | |
| 998 | − | |
| 999 | − } else | |
| 1000 | − pr_info(" No HW DMA feature register supported"); | |
| 1001 | − | |
| 1002 | − /* Select the enhnaced/normal descriptor structures */ | |
| 1003 | − stmmac_selec_desc_mode(priv); | |
| 1004 | − | |
| 1005 | − /* PMT module is not integrated in all the MAC devices. */ | |
| 1006 | − if (priv->plat->pmt) { | |
| 1007 | − pr_info(" Remote wake-up capable\n"); | |
| 1008 | − device_set_wakeup_capable(priv->device, 1); | |
| 1009 | − } | |
| 1010 | − | |
| 1011 | − priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr); | |
| 1012 | − if (priv->rx_coe) | |
| 1013 | − pr_info(" Checksum Offload Engine supported\n"); | |
| 1014 | − if (priv->plat->tx_coe) | |
| 1015 | − pr_info(" Checksum insertion supported\n"); | |
| 1016 | − | |
| 1017 | 935 | /* Create and initialize the TX/RX descriptors chains. */ |
| 1018 | 936 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); |
| 1019 | 937 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); |
| @@ -1030,14 +948,14 @@ static int stmmac_open(struct net_device *dev) · 10 unmodified lines | ||
| 1030 | 948 | |
| 1031 | 949 | /* Copy the MAC addr into the HW */ |
| 1032 | 950 | priv->hw->mac->set_umac_addr(priv->ioaddr, dev->dev_addr, 0); |
| 951 | + | |
| 1033 | 952 | /* If required, perform hw setup of the bus. */ |
| 1034 | 953 | if (priv->plat->bus_setup) |
| 1035 | 954 | priv->plat->bus_setup(priv->ioaddr); |
| 955 | + | |
| 1036 | 956 | /* Initialize the MAC Core */ |
| 1037 | 957 | priv->hw->mac->core_init(priv->ioaddr); |
| 1038 | 958 | |
| 1039 | − netdev_update_features(dev); | |
| 1040 | − | |
| 1041 | 959 | /* Request the IRQ lines */ |
| 1042 | 960 | ret = request_irq(dev->irq, stmmac_interrupt, |
| 1043 | 961 | IRQF_SHARED, dev->name, dev); |
| @@ -1047,6 +965,17 @@ static int stmmac_open(struct net_device *dev) · 3 unmodified lines | ||
| 1047 | 965 | goto open_error; |
| 1048 | 966 | } |
| 1049 | 967 | |
| 968 | + /* Request the Wake IRQ in case of another line is used for WoL */ | |
| 969 | + if (priv->wol_irq != dev->irq) { | |
| 970 | + ret = request_irq(priv->wol_irq, stmmac_interrupt, | |
| 971 | + IRQF_SHARED, dev->name, dev); | |
| 972 | + if (unlikely(ret < 0)) { | |
| 973 | + pr_err("%s: ERROR: allocating the ext WoL IRQ %d " | |
| 974 | + "(error: %d)\n", __func__, priv->wol_irq, ret); | |
| 975 | + goto open_error_wolirq; | |
| 976 | + } | |
| 977 | + } | |
| 978 | + | |
| 1050 | 979 | /* Enable the MAC Rx/Tx */ |
| 1051 | 980 | stmmac_set_mac(priv->ioaddr, true); |
| 1052 | 981 | |
| @@ -1062,7 +991,7 @@ static int stmmac_open(struct net_device *dev) · 9 unmodified lines | ||
| 1062 | 991 | #ifdef CONFIG_STMMAC_DEBUG_FS |
| 1063 | 992 | ret = stmmac_init_fs(dev); |
| 1064 | 993 | if (ret < 0) |
| 1065 | − pr_warning("\tFailed debugFS registration"); | |
| 994 | + pr_warning("%s: failed debugFS registration\n", __func__); | |
| 1066 | 995 | #endif |
| 1067 | 996 | /* Start the ball rolling... */ |
| 1068 | 997 | DBG(probe, DEBUG, "%s: DMA RX/TX processes started...\n", dev->name); |
| @@ -1072,6 +1001,7 @@ static int stmmac_open(struct net_device *dev) · 3 unmodified lines | ||
| 1072 | 1001 | #ifdef CONFIG_STMMAC_TIMER |
| 1073 | 1002 | priv->tm->timer_start(tmrate); |
| 1074 | 1003 | #endif |
| 1004 | + | |
| 1075 | 1005 | /* Dump DMA/MAC registers */ |
| 1076 | 1006 | if (netif_msg_hw(priv)) { |
| 1077 | 1007 | priv->hw->mac->dump_regs(priv->ioaddr); |
| @@ -1087,6 +1017,9 @@ static int stmmac_open(struct net_device *dev) · 9 unmodified lines | ||
| 1087 | 1017 | |
| 1088 | 1018 | return 0; |
| 1089 | 1019 | |
| 1020 | +open_error_wolirq: | |
| 1021 | + free_irq(dev->irq, dev); | |
| 1022 | + | |
| 1090 | 1023 | open_error: |
| 1091 | 1024 | #ifdef CONFIG_STMMAC_TIMER |
| 1092 | 1025 | kfree(priv->tm); |
| @@ -1127,6 +1060,8 @@ static int stmmac_release(struct net_device *dev) · 34 unmodified lines | ||
| 1127 | 1060 | |
| 1128 | 1061 | /* Free the IRQ lines */ |
| 1129 | 1062 | free_irq(dev->irq, dev); |
| 1063 | + if (priv->wol_irq != dev->irq) | |
| 1064 | + free_irq(priv->wol_irq, dev); | |
| 1130 | 1065 | |
| 1131 | 1066 | /* Stop TX/RX DMA and clear the descriptors */ |
| 1132 | 1067 | priv->hw->dma->stop_tx(priv->ioaddr); |
| @@ -1788,6 +1723,69 @@ static const struct net_device_ops stmmac_netdev_ops = { · 655 unmodified lines | ||
| 1788 | 1723 | .ndo_set_mac_address = eth_mac_addr, |
| 1789 | 1724 | }; |
| 1790 | 1725 | |
| 1726 | +/** | |
| 1727 | + * stmmac_hw_init - Init the MAC device | |
| 1728 | + * @priv : pointer to the private device structure. | |
| 1729 | + * Description: this function detects which MAC device | |
| 1730 | + * (GMAC/MAC10-100) has to attached, checks the HW capability | |
| 1731 | + * (if supported) and sets the driver's features (for example | |
| 1732 | + * to use the ring or chaine mode or support the normal/enh | |
| 1733 | + * descriptor structure). | |
| 1734 | + */ | |
| 1735 | +static int stmmac_hw_init(struct stmmac_priv *priv) | |
| 1736 | +{ | |
| 1737 | + int ret = 0; | |
| 1738 | + struct mac_device_info *mac; | |
| 1739 | + | |
| 1740 | + /* Identify the MAC HW device */ | |
| 1741 | + if (priv->plat->has_gmac) | |
| 1742 | + mac = dwmac1000_setup(priv->ioaddr); | |
| 1743 | + else | |
| 1744 | + mac = dwmac100_setup(priv->ioaddr); | |
| 1745 | + if (!mac) | |
| 1746 | + return -ENOMEM; | |
| 1747 | + | |
| 1748 | + priv->hw = mac; | |
| 1749 | + | |
| 1750 | + /* To use the chained or ring mode */ | |
| 1751 | + priv->hw->ring = &ring_mode_ops; | |
| 1752 | + | |
| 1753 | + /* Get and dump the chip ID */ | |
| 1754 | + stmmac_get_synopsys_id(priv); | |
| 1755 | + | |
| 1756 | + /* Get the HW capability (new GMAC newer than 3.50a) */ | |
| 1757 | + priv->hw_cap_support = stmmac_get_hw_features(priv); | |
| 1758 | + if (priv->hw_cap_support) { | |
| 1759 | + pr_info(" DMA HW capability register supported"); | |
| 1760 | + | |
| 1761 | + /* We can override some gmac/dma configuration fields: e.g. | |
| 1762 | + * enh_desc, tx_coe (e.g. that are passed through the | |
| 1763 | + * platform) with the values from the HW capability | |
| 1764 | + * register (if supported). | |
| 1765 | + */ | |
| 1766 | + priv->plat->enh_desc = priv->dma_cap.enh_desc; | |
| 1767 | + priv->plat->tx_coe = priv->dma_cap.tx_coe; | |
| 1768 | + priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up; | |
| 1769 | + } else | |
| 1770 | + pr_info(" No HW DMA feature register supported"); | |
| 1771 | + | |
| 1772 | + /* Select the enhnaced/normal descriptor structures */ | |
| 1773 | + stmmac_selec_desc_mode(priv); | |
| 1774 | + | |
| 1775 | + priv->rx_coe = priv->hw->mac->rx_coe(priv->ioaddr); | |
| 1776 | + if (priv->rx_coe) | |
| 1777 | + pr_info(" RX Checksum Offload Engine supported\n"); | |
| 1778 | + if (priv->plat->tx_coe) | |
| 1779 | + pr_info(" TX Checksum insertion supported\n"); | |
| 1780 | + | |
| 1781 | + if (priv->plat->pmt) { | |
| 1782 | + pr_info(" Wake-Up On Lan supported\n"); | |
| 1783 | + device_set_wakeup_capable(priv->device, 1); | |
| 1784 | + } | |
| 1785 | + | |
| 1786 | + return ret; | |
| 1787 | +} | |
| 1788 | + | |
| 1791 | 1789 | /** |
| 1792 | 1790 | * stmmac_dvr_probe |
| 1793 | 1791 | * @device: device pointer |
| @@ -1795,7 +1793,8 @@ static const struct net_device_ops stmmac_netdev_ops = { · 1 unmodified line | ||
| 1795 | 1793 | * call the alloc_etherdev, allocate the priv structure. |
| 1796 | 1794 | */ |
| 1797 | 1795 | struct stmmac_priv *stmmac_dvr_probe(struct device *device, |
| 1798 | − struct plat_stmmacenet_data *plat_dat) | |
| 1796 | + struct plat_stmmacenet_data *plat_dat, | |
| 1797 | + void __iomem *addr) | |
| 1799 | 1798 | { |
| 1800 | 1799 | int ret = 0; |
| 1801 | 1800 | struct net_device *ndev = NULL; |
| @@ -1815,10 +1814,27 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, · 13 unmodified lines | ||
| 1815 | 1814 | |
| 1816 | 1815 | ether_setup(ndev); |
| 1817 | 1816 | |
| 1818 | − ndev->netdev_ops = &stmmac_netdev_ops; | |
| 1819 | 1817 | stmmac_set_ethtool_ops(ndev); |
| 1818 | + priv->pause = pause; | |
| 1819 | + priv->plat = plat_dat; | |
| 1820 | + priv->ioaddr = addr; | |
| 1821 | + priv->dev->base_addr = (unsigned long)addr; | |
| 1822 | + | |
| 1823 | + /* Verify driver arguments */ | |
| 1824 | + stmmac_verify_args(); | |
| 1825 | + | |
| 1826 | + /* Override with kernel parameters if supplied XXX CRS XXX | |
| 1827 | + * this needs to have multiple instances */ | |
| 1828 | + if ((phyaddr >= 0) && (phyaddr <= 31)) | |
| 1829 | + priv->plat->phy_addr = phyaddr; | |
| 1830 | + | |
| 1831 | + /* Init MAC and get the capabilities */ | |
| 1832 | + stmmac_hw_init(priv); | |
| 1833 | + | |
| 1834 | + ndev->netdev_ops = &stmmac_netdev_ops; | |
| 1820 | 1835 | |
| 1821 | − ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | |
| 1836 | + ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | |
| 1837 | + NETIF_F_RXCSUM; | |
| 1822 | 1838 | ndev->features |= ndev->hw_features | NETIF_F_HIGHDMA; |
| 1823 | 1839 | ndev->watchdog_timeo = msecs_to_jiffies(watchdog); |
| 1824 | 1840 | #ifdef STMMAC_VLAN_TAG_USED |
| @@ -1830,8 +1846,6 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, · 5 unmodified lines | ||
| 1830 | 1846 | if (flow_ctrl) |
| 1831 | 1847 | priv->flow_ctrl = FLOW_AUTO; /* RX/TX pause on */ |
| 1832 | 1848 | |
| 1833 | − priv->pause = pause; | |
| 1834 | − priv->plat = plat_dat; | |
| 1835 | 1849 | netif_napi_add(ndev, &priv->napi, stmmac_poll, 64); |
| 1836 | 1850 | |
| 1837 | 1851 | spin_lock_init(&priv->lock); |
| @@ -1839,15 +1853,10 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, · 1 unmodified line | ||
| 1839 | 1853 | |
| 1840 | 1854 | ret = register_netdev(ndev); |
| 1841 | 1855 | if (ret) { |
| 1842 | − pr_err("%s: ERROR %i registering the device\n", | |
| 1843 | − __func__, ret); | |
| 1856 | + pr_err("%s: ERROR %i registering the device\n", __func__, ret); | |
| 1844 | 1857 | goto error; |
| 1845 | 1858 | } |
| 1846 | 1859 | |
| 1847 | − DBG(probe, DEBUG, "%s: Scatter/Gather: %s - HW checksums: %s\n", | |
| 1848 | − ndev->name, (ndev->features & NETIF_F_SG) ? "on" : "off", | |
| 1849 | − (ndev->features & NETIF_F_IP_CSUM) ? "on" : "off"); | |
| 1850 | − | |
| 1851 | 1860 | return priv; |
| 1852 | 1861 | |
| 1853 | 1862 | error: |
| @@ -96,13 +96,11 @@ static int __devinit stmmac_pci_probe(struct pci_dev *pdev, · 95 unmodified lines | ||
| 96 | 96 | |
| 97 | 97 | stmmac_default_data(); |
| 98 | 98 | |
| 99 | − priv = stmmac_dvr_probe(&(pdev->dev), &plat_dat); | |
| 99 | + priv = stmmac_dvr_probe(&(pdev->dev), &plat_dat, addr); | |
| 100 | 100 | if (!priv) { |
| 101 | − pr_err("%s: main drivr probe failed", __func__); | |
| 101 | + pr_err("%s: main driver probe failed", __func__); | |
| 102 | 102 | goto err_out; |
| 103 | 103 | } |
| 104 | − priv->ioaddr = addr; | |
| 105 | − priv->dev->base_addr = (unsigned long)addr; | |
| 106 | 104 | priv->dev->irq = pdev->irq; |
| 107 | 105 | priv->wol_irq = pdev->irq; |
| 108 | 106 | |
| @@ -59,16 +59,20 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) · 58 unmodified lines | ||
| 59 | 59 | goto out_release_region; |
| 60 | 60 | } |
| 61 | 61 | plat_dat = pdev->dev.platform_data; |
| 62 | − priv = stmmac_dvr_probe(&(pdev->dev), plat_dat); | |
| 62 | + | |
| 63 | + /* Custom initialisation (if needed)*/ | |
| 64 | + if (plat_dat->init) { | |
| 65 | + ret = plat_dat->init(pdev); | |
| 66 | + if (unlikely(ret)) | |
| 67 | + goto out_unmap; | |
| 68 | + } | |
| 69 | + | |
| 70 | + priv = stmmac_dvr_probe(&(pdev->dev), plat_dat, addr); | |
| 63 | 71 | if (!priv) { |
| 64 | − pr_err("%s: main drivr probe failed", __func__); | |
| 72 | + pr_err("%s: main driver probe failed", __func__); | |
| 65 | 73 | goto out_unmap; |
| 66 | 74 | } |
| 67 | 75 | |
| 68 | − priv->ioaddr = addr; | |
| 69 | − /* Set the I/O base addr */ | |
| 70 | − priv->dev->base_addr = (unsigned long)addr; | |
| 71 | − | |
| 72 | 76 | /* Get the MAC information */ |
| 73 | 77 | priv->dev->irq = platform_get_irq_byname(pdev, "macirq"); |
| 74 | 78 | if (priv->dev->irq == -ENXIO) { |
| @@ -92,13 +96,6 @@ static int stmmac_pltfr_probe(struct platform_device *pdev) · 17 unmodified lines | ||
| 92 | 96 | |
| 93 | 97 | platform_set_drvdata(pdev, priv->dev); |
| 94 | 98 | |
| 95 | − /* Custom initialisation */ | |
| 96 | − if (priv->plat->init) { | |
| 97 | − ret = priv->plat->init(pdev); | |
| 98 | − if (unlikely(ret)) | |
| 99 | − goto out_unmap; | |
| 100 | − } | |
| 101 | − | |
| 102 | 99 | pr_debug("STMMAC platform driver registration completed"); |
| 103 | 100 | |
| 104 | 101 | return 0; |
| @@ -1122,7 +1122,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev) · 1121 unmodified lines | ||
| 1122 | 1122 | pdata = pdev->dev.platform_data; |
| 1123 | 1123 | |
| 1124 | 1124 | if (external_switch || dumb_switch) { |
| 1125 | − strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */ | |
| 1125 | + strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */ | |
| 1126 | 1126 | phy_id = pdev->id; |
| 1127 | 1127 | } else { |
| 1128 | 1128 | for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) { |
| @@ -1138,7 +1138,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev) · 9 unmodified lines | ||
| 1138 | 1138 | if (phy_id == PHY_MAX_ADDR) { |
| 1139 | 1139 | dev_err(&pdev->dev, "no PHY present, falling back " |
| 1140 | 1140 | "to switch on MDIO bus 0\n"); |
| 1141 | − strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */ | |
| 1141 | + strncpy(mdio_bus_id, "fixed-0", MII_BUS_ID_SIZE); /* fixed phys bus */ | |
| 1142 | 1142 | phy_id = pdev->id; |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| @@ -1009,7 +1009,7 @@ static void emac_rx_handler(void *token, int len, int status) · 1008 unmodified lines | ||
| 1009 | 1009 | int ret; |
| 1010 | 1010 | |
| 1011 | 1011 | /* free and bail if we are shutting down */ |
| 1012 | − if (unlikely(!netif_running(ndev) || !netif_carrier_ok(ndev))) { | |
| 1012 | + if (unlikely(!netif_running(ndev))) { | |
| 1013 | 1013 | dev_kfree_skb_any(skb); |
| 1014 | 1014 | return; |
| 1015 | 1015 | } |
| @@ -1038,7 +1038,9 @@ static void emac_rx_handler(void *token, int len, int status) · 22 unmodified lines | ||
| 1038 | 1038 | recycle: |
| 1039 | 1039 | ret = cpdma_chan_submit(priv->rxchan, skb, skb->data, |
| 1040 | 1040 | skb_tailroom(skb), GFP_KERNEL); |
| 1041 | − if (WARN_ON(ret < 0)) | |
| 1041 | + | |
| 1042 | + WARN_ON(ret == -ENOMEM); | |
| 1043 | + if (unlikely(ret < 0)) | |
| 1042 | 1044 | dev_kfree_skb_any(skb); |
| 1043 | 1045 | } |
| 1044 | 1046 | |
| @@ -1600,8 +1602,9 @@ static int emac_dev_open(struct net_device *ndev) · 555 unmodified lines | ||
| 1600 | 1602 | if (IS_ERR(priv->phydev)) { |
| 1601 | 1603 | dev_err(emac_dev, "could not connect to phy %s\n", |
| 1602 | 1604 | priv->phy_id); |
| 1605 | + ret = PTR_ERR(priv->phydev); | |
| 1603 | 1606 | priv->phydev = NULL; |
| 1604 | − return PTR_ERR(priv->phydev); | |
| 1607 | + return ret; | |
| 1605 | 1608 | } |
| 1606 | 1609 | |
| 1607 | 1610 | priv->link = 0; |
| @@ -318,9 +318,9 @@ static int __devinit davinci_mdio_probe(struct platform_device *pdev) · 317 unmodified lines | ||
| 318 | 318 | |
| 319 | 319 | data->clk = clk_get(dev, NULL); |
| 320 | 320 | if (IS_ERR(data->clk)) { |
| 321 | − data->clk = NULL; | |
| 322 | 321 | dev_err(dev, "failed to get device clock\n"); |
| 323 | 322 | ret = PTR_ERR(data->clk); |
| 323 | + data->clk = NULL; | |
| 324 | 324 | goto bail_out; |
| 325 | 325 | } |
| 326 | 326 | |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | config NET_VENDOR_TOSHIBA |
| 6 | 6 | bool "Toshiba devices" |
| 7 | 7 | default y |
| 8 | − depends on PCI && (PPC_IBM_CELL_BLADE || PPC_CELLEB) || PPC_PS3 | |
| 8 | + depends on PCI && (PPC_IBM_CELL_BLADE || PPC_CELLEB || MIPS) || PPC_PS3 | |
| 9 | 9 | ---help--- |
| 10 | 10 | If you have a network (Ethernet) card belonging to this class, say Y |
| 11 | 11 | and read the Ethernet-HOWTO, available from |
| @@ -2491,9 +2491,6 @@ static int velocity_close(struct net_device *dev) · 2490 unmodified lines | ||
| 2491 | 2491 | if (dev->irq != 0) |
| 2492 | 2492 | free_irq(dev->irq, dev); |
| 2493 | 2493 | |
| 2494 | − /* Power down the chip */ | |
| 2495 | − pci_set_power_state(vptr->pdev, PCI_D3hot); | |
| 2496 | − | |
| 2497 | 2494 | velocity_free_rings(vptr); |
| 2498 | 2495 | |
| 2499 | 2496 | vptr->flags &= (~VELOCITY_FLAGS_OPENED); |
| @@ -1416,7 +1416,8 @@ static int __devinit eth_init_one(struct platform_device *pdev) · 1415 unmodified lines | ||
| 1416 | 1416 | __raw_writel(DEFAULT_CORE_CNTRL, &port->regs->core_control); |
| 1417 | 1417 | udelay(50); |
| 1418 | 1418 | |
| 1419 | − snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, "0", plat->phy); | |
| 1419 | + snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, | |
| 1420 | + mdio_bus->id, plat->phy); | |
| 1420 | 1421 | port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, |
| 1421 | 1422 | PHY_INTERFACE_MODE_MII); |
| 1422 | 1423 | if (IS_ERR(port->phydev)) { |
| @@ -123,7 +123,7 @@ static int netvsc_close(struct net_device *net) · 122 unmodified lines | ||
| 123 | 123 | struct hv_device *device_obj = net_device_ctx->device_ctx; |
| 124 | 124 | int ret; |
| 125 | 125 | |
| 126 | − netif_stop_queue(net); | |
| 126 | + netif_tx_disable(net); | |
| 127 | 127 | |
| 128 | 128 | ret = rndis_filter_close(device_obj); |
| 129 | 129 | if (ret != 0) |
| @@ -151,10 +151,10 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) · 21 unmodified lines | ||
| 151 | 151 | int ret; |
| 152 | 152 | unsigned int i, num_pages, npg_data; |
| 153 | 153 | |
| 154 | − /* Add multipage for skb->data and additional one for RNDIS */ | |
| 154 | + /* Add multipages for skb->data and additional 2 for RNDIS */ | |
| 155 | 155 | npg_data = (((unsigned long)skb->data + skb_headlen(skb) - 1) |
| 156 | 156 | >> PAGE_SHIFT) - ((unsigned long)skb->data >> PAGE_SHIFT) + 1; |
| 157 | − num_pages = skb_shinfo(skb)->nr_frags + npg_data + 1; | |
| 157 | + num_pages = skb_shinfo(skb)->nr_frags + npg_data + 2; | |
| 158 | 158 | |
| 159 | 159 | /* Allocate a netvsc packet based on # of frags. */ |
| 160 | 160 | packet = kzalloc(sizeof(struct hv_netvsc_packet) + |
| @@ -173,8 +173,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) · 12 unmodified lines | ||
| 173 | 173 | sizeof(struct hv_netvsc_packet) + |
| 174 | 174 | (num_pages * sizeof(struct hv_page_buffer)); |
| 175 | 175 | |
| 176 | − /* Setup the rndis header */ | |
| 177 | − packet->page_buf_cnt = num_pages; | |
| 176 | + /* If the rndis msg goes beyond 1 page, we will add 1 later */ | |
| 177 | + packet->page_buf_cnt = num_pages - 1; | |
| 178 | 178 | |
| 179 | 179 | /* Initialize it from the skb */ |
| 180 | 180 | packet->total_data_buflen = skb->len; |
| @@ -256,7 +256,7 @@ void netvsc_linkstatus_callback(struct hv_device *device_obj, · 75 unmodified lines | ||
| 256 | 256 | schedule_delayed_work(&ndev_ctx->dwork, msecs_to_jiffies(20)); |
| 257 | 257 | } else { |
| 258 | 258 | netif_carrier_off(net); |
| 259 | − netif_stop_queue(net); | |
| 259 | + netif_tx_disable(net); | |
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
| @@ -298,7 +298,7 @@ int netvsc_recv_callback(struct hv_device *device_obj, · 35 unmodified lines | ||
| 298 | 298 | skb->ip_summed = CHECKSUM_NONE; |
| 299 | 299 | |
| 300 | 300 | net->stats.rx_packets++; |
| 301 | − net->stats.rx_bytes += skb->len; | |
| 301 | + net->stats.rx_bytes += packet->total_data_buflen; | |
| 302 | 302 | |
| 303 | 303 | /* |
| 304 | 304 | * Pass the skb back up. Network stack will deallocate the skb when it |
| @@ -337,7 +337,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) · 32 unmodified lines | ||
| 337 | 337 | |
| 338 | 338 | nvdev->start_remove = true; |
| 339 | 339 | cancel_delayed_work_sync(&ndevctx->dwork); |
| 340 | − netif_stop_queue(ndev); | |
| 340 | + netif_tx_disable(ndev); | |
| 341 | 341 | rndis_filter_device_remove(hdev); |
| 342 | 342 | |
| 343 | 343 | ndev->mtu = mtu; |
| @@ -460,7 +460,7 @@ static int netvsc_remove(struct hv_device *dev) · 116 unmodified lines | ||
| 460 | 460 | cancel_delayed_work_sync(&ndev_ctx->dwork); |
| 461 | 461 | |
| 462 | 462 | /* Stop outbound asap */ |
| 463 | − netif_stop_queue(net); | |
| 463 | + netif_tx_disable(net); | |
| 464 | 464 | |
| 465 | 465 | unregister_netdev(net); |
| 466 | 466 | |
| @@ -321,6 +321,25 @@ static void rndis_filter_receive_data(struct rndis_device *dev, · 320 unmodified lines | ||
| 321 | 321 | data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset; |
| 322 | 322 | |
| 323 | 323 | pkt->total_data_buflen -= data_offset; |
| 324 | + | |
| 325 | + /* | |
| 326 | + * Make sure we got a valid RNDIS message, now total_data_buflen | |
| 327 | + * should be the data packet size plus the trailer padding size | |
| 328 | + */ | |
| 329 | + if (pkt->total_data_buflen < rndis_pkt->data_len) { | |
| 330 | + netdev_err(dev->net_dev->ndev, "rndis message buffer " | |
| 331 | + "overflow detected (got %u, min %u)" | |
| 332 | + "...dropping this message!\n", | |
| 333 | + pkt->total_data_buflen, rndis_pkt->data_len); | |
| 334 | + return; | |
| 335 | + } | |
| 336 | + | |
| 337 | + /* | |
| 338 | + * Remove the rndis trailer padding from rndis packet message | |
| 339 | + * rndis_pkt->data_len tell us the real data length, we only copy | |
| 340 | + * the data packet to the stack, without the rndis trailer padding | |
| 341 | + */ | |
| 342 | + pkt->total_data_buflen = rndis_pkt->data_len; | |
| 324 | 343 | pkt->data = (void *)((unsigned long)pkt->data + data_offset); |
| 325 | 344 | |
| 326 | 345 | pkt->is_data_pkt = true; |
| @@ -778,6 +797,19 @@ int rndis_filter_send(struct hv_device *dev, · 451 unmodified lines | ||
| 778 | 797 | (unsigned long)rndisMessage & (PAGE_SIZE-1); |
| 779 | 798 | pkt->page_buf[0].len = rndisMessageSize; |
| 780 | 799 | |
| 800 | + /* Add one page_buf if the rndis msg goes beyond page boundary */ | |
| 801 | + if (pkt->page_buf[0].offset + rndisMessageSize > PAGE_SIZE) { | |
| 802 | + int i; | |
| 803 | + for (i = pkt->page_buf_cnt; i > 1; i--) | |
| 804 | + pkt->page_buf[i] = pkt->page_buf[i-1]; | |
| 805 | + pkt->page_buf_cnt++; | |
| 806 | + pkt->page_buf[0].len = PAGE_SIZE - pkt->page_buf[0].offset; | |
| 807 | + pkt->page_buf[1].pfn = virt_to_phys((void *)((ulong) | |
| 808 | + rndisMessage + pkt->page_buf[0].len)) >> PAGE_SHIFT; | |
| 809 | + pkt->page_buf[1].offset = 0; | |
| 810 | + pkt->page_buf[1].len = rndisMessageSize - pkt->page_buf[0].len; | |
| 811 | + } | |
| 812 | + | |
| 781 | 813 | /* Save the packet send completion and context */ |
| 782 | 814 | filterPacket->completion = pkt->completion.send.send_completion; |
| 783 | 815 | filterPacket->completion_ctx = |
| @@ -30,16 +30,16 @@ · 29 unmodified lines | ||
| 30 | 30 | #include <asm/irq.h> |
| 31 | 31 | #include <asm/uaccess.h> |
| 32 | 32 | |
| 33 | −MODULE_DESCRIPTION("ICPlus IP175C/IP101A/IC1001 PHY drivers"); | |
| 33 | +MODULE_DESCRIPTION("ICPlus IP175C/IP101A/IP101G/IC1001 PHY drivers"); | |
| 34 | 34 | MODULE_AUTHOR("Michael Barkowski"); |
| 35 | 35 | MODULE_LICENSE("GPL"); |
| 36 | 36 | |
| 37 | −/* IP101A/IP1001 */ | |
| 38 | −#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ | |
| 39 | −#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ | |
| 40 | −#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ | |
| 41 | −#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ | |
| 42 | −#define IP101A_APS_ON 2 /* IP101A APS Mode bit */ | |
| 37 | +/* IP101A/G - IP1001 */ | |
| 38 | +#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ | |
| 39 | +#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ | |
| 40 | +#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ | |
| 41 | +#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ | |
| 42 | +#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ | |
| 43 | 43 | |
| 44 | 44 | static int ip175c_config_init(struct phy_device *phydev) |
| 45 | 45 | { |
| @@ -98,20 +98,24 @@ static int ip175c_config_init(struct phy_device *phydev) · 52 unmodified lines | ||
| 98 | 98 | |
| 99 | 99 | static int ip1xx_reset(struct phy_device *phydev) |
| 100 | 100 | { |
| 101 | − int err, bmcr; | |
| 101 | + int bmcr; | |
| 102 | 102 | |
| 103 | 103 | /* Software Reset PHY */ |
| 104 | 104 | bmcr = phy_read(phydev, MII_BMCR); |
| 105 | + if (bmcr < 0) | |
| 106 | + return bmcr; | |
| 105 | 107 | bmcr |= BMCR_RESET; |
| 106 | − err = phy_write(phydev, MII_BMCR, bmcr); | |
| 107 | − if (err < 0) | |
| 108 | − return err; | |
| 108 | + bmcr = phy_write(phydev, MII_BMCR, bmcr); | |
| 109 | + if (bmcr < 0) | |
| 110 | + return bmcr; | |
| 109 | 111 | |
| 110 | 112 | do { |
| 111 | 113 | bmcr = phy_read(phydev, MII_BMCR); |
| 114 | + if (bmcr < 0) | |
| 115 | + return bmcr; | |
| 112 | 116 | } while (bmcr & BMCR_RESET); |
| 113 | 117 | |
| 114 | − return err; | |
| 118 | + return 0; | |
| 115 | 119 | } |
| 116 | 120 | |
| 117 | 121 | static int ip1001_config_init(struct phy_device *phydev) |
| @@ -124,7 +128,10 @@ static int ip1001_config_init(struct phy_device *phydev) · 6 unmodified lines | ||
| 124 | 128 | |
| 125 | 129 | /* Enable Auto Power Saving mode */ |
| 126 | 130 | c = phy_read(phydev, IP1001_SPEC_CTRL_STATUS_2); |
| 131 | + if (c < 0) | |
| 132 | + return c; | |
| 127 | 133 | c |= IP1001_APS_ON; |
| 134 | + c = phy_write(phydev, IP1001_SPEC_CTRL_STATUS_2, c); | |
| 128 | 135 | if (c < 0) |
| 129 | 136 | return c; |
| 130 | 137 | |
| @@ -132,14 +139,19 @@ static int ip1001_config_init(struct phy_device *phydev) · 1 unmodified line | ||
| 132 | 139 | /* Additional delay (2ns) used to adjust RX clock phase |
| 133 | 140 | * at RGMII interface */ |
| 134 | 141 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); |
| 142 | + if (c < 0) | |
| 143 | + return c; | |
| 144 | + | |
| 135 | 145 | c |= IP1001_PHASE_SEL_MASK; |
| 136 | 146 | c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); |
| 147 | + if (c < 0) | |
| 148 | + return c; | |
| 137 | 149 | } |
| 138 | 150 | |
| 139 | − return c; | |
| 151 | + return 0; | |
| 140 | 152 | } |
| 141 | 153 | |
| 142 | −static int ip101a_config_init(struct phy_device *phydev) | |
| 154 | +static int ip101a_g_config_init(struct phy_device *phydev) | |
| 143 | 155 | { |
| 144 | 156 | int c; |
| 145 | 157 | |
| @@ -149,7 +161,7 @@ static int ip101a_config_init(struct phy_device *phydev) · 3 unmodified lines | ||
| 149 | 161 | |
| 150 | 162 | /* Enable Auto Power Saving mode */ |
| 151 | 163 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); |
| 152 | − c |= IP101A_APS_ON; | |
| 164 | + c |= IP101A_G_APS_ON; | |
| 153 | 165 | return c; |
| 154 | 166 | } |
| 155 | 167 | |
| @@ -191,6 +203,7 @@ static struct phy_driver ip1001_driver = { · 35 unmodified lines | ||
| 191 | 203 | .phy_id_mask = 0x0ffffff0, |
| 192 | 204 | .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | |
| 193 | 205 | SUPPORTED_Asym_Pause, |
| 206 | + .flags = PHY_HAS_INTERRUPT, | |
| 194 | 207 | .config_init = &ip1001_config_init, |
| 195 | 208 | .config_aneg = &genphy_config_aneg, |
| 196 | 209 | .read_status = &genphy_read_status, |
| @@ -199,13 +212,14 @@ static struct phy_driver ip1001_driver = { · 2 unmodified lines | ||
| 199 | 212 | .driver = { .owner = THIS_MODULE,}, |
| 200 | 213 | }; |
| 201 | 214 | |
| 202 | −static struct phy_driver ip101a_driver = { | |
| 215 | +static struct phy_driver ip101a_g_driver = { | |
| 203 | 216 | .phy_id = 0x02430c54, |
| 204 | − .name = "ICPlus IP101A", | |
| 217 | + .name = "ICPlus IP101A/G", | |
| 205 | 218 | .phy_id_mask = 0x0ffffff0, |
| 206 | 219 | .features = PHY_BASIC_FEATURES | SUPPORTED_Pause | |
| 207 | 220 | SUPPORTED_Asym_Pause, |
| 208 | − .config_init = &ip101a_config_init, | |
| 221 | + .flags = PHY_HAS_INTERRUPT, | |
| 222 | + .config_init = &ip101a_g_config_init, | |
| 209 | 223 | .config_aneg = &genphy_config_aneg, |
| 210 | 224 | .read_status = &genphy_read_status, |
| 211 | 225 | .suspend = genphy_suspend, |
| @@ -221,7 +235,7 @@ static int __init icplus_init(void) · 9 unmodified lines | ||
| 221 | 235 | if (ret < 0) |
| 222 | 236 | return -ENODEV; |
| 223 | 237 | |
| 224 | − ret = phy_driver_register(&ip101a_driver); | |
| 238 | + ret = phy_driver_register(&ip101a_g_driver); | |
| 225 | 239 | if (ret < 0) |
| 226 | 240 | return -ENODEV; |
| 227 | 241 | |
| @@ -231,7 +245,7 @@ static int __init icplus_init(void) · 3 unmodified lines | ||
| 231 | 245 | static void __exit icplus_exit(void) |
| 232 | 246 | { |
| 233 | 247 | phy_driver_unregister(&ip1001_driver); |
| 234 | − phy_driver_unregister(&ip101a_driver); | |
| 248 | + phy_driver_unregister(&ip101a_g_driver); | |
| 235 | 249 | phy_driver_unregister(&ip175c_driver); |
| 236 | 250 | } |
| 237 | 251 | |
| @@ -241,6 +255,7 @@ module_exit(icplus_exit); · 3 unmodified lines | ||
| 241 | 255 | static struct mdio_device_id __maybe_unused icplus_tbl[] = { |
| 242 | 256 | { 0x02430d80, 0x0ffffff0 }, |
| 243 | 257 | { 0x02430d90, 0x0ffffff0 }, |
| 258 | + { 0x02430c54, 0x0ffffff0 }, | |
| 244 | 259 | { } |
| 245 | 260 | }; |
| 246 | 261 | |
| @@ -2024,14 +2024,22 @@ ppp_mp_reconstruct(struct ppp *ppp) · 2023 unmodified lines | ||
| 2024 | 2024 | continue; |
| 2025 | 2025 | } |
| 2026 | 2026 | if (PPP_MP_CB(p)->sequence != seq) { |
| 2027 | + u32 oldseq; | |
| 2027 | 2028 | /* Fragment `seq' is missing. If it is after |
| 2028 | 2029 | minseq, it might arrive later, so stop here. */ |
| 2029 | 2030 | if (seq_after(seq, minseq)) |
| 2030 | 2031 | break; |
| 2031 | 2032 | /* Fragment `seq' is lost, keep going. */ |
| 2032 | 2033 | lost = 1; |
| 2034 | + oldseq = seq; | |
| 2033 | 2035 | seq = seq_before(minseq, PPP_MP_CB(p)->sequence)? |
| 2034 | 2036 | minseq + 1: PPP_MP_CB(p)->sequence; |
| 2037 | + | |
| 2038 | + if (ppp->debug & 1) | |
| 2039 | + netdev_printk(KERN_DEBUG, ppp->dev, | |
| 2040 | + "lost frag %u..%u\n", | |
| 2041 | + oldseq, seq-1); | |
| 2042 | + | |
| 2035 | 2043 | goto again; |
| 2036 | 2044 | } |
| 2037 | 2045 | |
| @@ -2076,6 +2084,10 @@ ppp_mp_reconstruct(struct ppp *ppp) · 38 unmodified lines | ||
| 2076 | 2084 | struct sk_buff *tmp2; |
| 2077 | 2085 | |
| 2078 | 2086 | skb_queue_reverse_walk_from_safe(list, p, tmp2) { |
| 2087 | + if (ppp->debug & 1) | |
| 2088 | + netdev_printk(KERN_DEBUG, ppp->dev, | |
| 2089 | + "discarding frag %u\n", | |
| 2090 | + PPP_MP_CB(p)->sequence); | |
| 2079 | 2091 | __skb_unlink(p, list); |
| 2080 | 2092 | kfree_skb(p); |
| 2081 | 2093 | } |
| @@ -2091,6 +2103,17 @@ ppp_mp_reconstruct(struct ppp *ppp) · 9 unmodified lines | ||
| 2091 | 2103 | /* If we have discarded any fragments, |
| 2092 | 2104 | signal a receive error. */ |
| 2093 | 2105 | if (PPP_MP_CB(head)->sequence != ppp->nextseq) { |
| 2106 | + skb_queue_walk_safe(list, p, tmp) { | |
| 2107 | + if (p == head) | |
| 2108 | + break; | |
| 2109 | + if (ppp->debug & 1) | |
| 2110 | + netdev_printk(KERN_DEBUG, ppp->dev, | |
| 2111 | + "discarding frag %u\n", | |
| 2112 | + PPP_MP_CB(p)->sequence); | |
| 2113 | + __skb_unlink(p, list); | |
| 2114 | + kfree_skb(p); | |
| 2115 | + } | |
| 2116 | + | |
| 2094 | 2117 | if (ppp->debug & 1) |
| 2095 | 2118 | netdev_printk(KERN_DEBUG, ppp->dev, |
| 2096 | 2119 | " missed pkts %u..%u\n", |
| @@ -7,7 +7,6 @@ menuconfig TR · 6 unmodified lines | ||
| 7 | 7 | bool "Token Ring driver support" |
| 8 | 8 | depends on NETDEVICES && !UML |
| 9 | 9 | depends on (PCI || ISA || MCA || CCW || PCMCIA) |
| 10 | − select LLC | |
| 11 | 10 | help |
| 12 | 11 | Token Ring is IBM's way of communication on a local network; the |
| 13 | 12 | rest of the world uses Ethernet. To participate on a Token Ring |
| @@ -20,6 +19,10 @@ menuconfig TR · 6 unmodified lines | ||
| 20 | 19 | |
| 21 | 20 | if TR |
| 22 | 21 | |
| 22 | +config WANT_LLC | |
| 23 | + def_bool y | |
| 24 | + select LLC | |
| 25 | + | |
| 23 | 26 | config PCMCIA_IBMTR |
| 24 | 27 | tristate "IBM PCMCIA tokenring adapter support" |
| 25 | 28 | depends on IBMTR!=y && PCMCIA |
| @@ -573,6 +573,13 @@ static const struct usb_device_id products [] = { · 572 unmodified lines | ||
| 573 | 573 | .driver_info = 0, |
| 574 | 574 | }, |
| 575 | 575 | |
| 576 | +/* Logitech Harmony 900 - uses the pseudo-MDLM (BLAN) driver */ | |
| 577 | +{ | |
| 578 | + USB_DEVICE_AND_INTERFACE_INFO(0x046d, 0xc11f, USB_CLASS_COMM, | |
| 579 | + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | |
| 580 | + .driver_info = 0, | |
| 581 | +}, | |
| 582 | + | |
| 576 | 583 | /* |
| 577 | 584 | * WHITELIST!!! |
| 578 | 585 | * |
| @@ -1632,7 +1632,7 @@ static int hso_get_count(struct tty_struct *tty, · 1631 unmodified lines | ||
| 1632 | 1632 | struct hso_serial *serial = get_serial_by_tty(tty); |
| 1633 | 1633 | struct hso_tiocmget *tiocmget = serial->tiocmget; |
| 1634 | 1634 | |
| 1635 | − memset(&icount, 0, sizeof(struct serial_icounter_struct)); | |
| 1635 | + memset(icount, 0, sizeof(struct serial_icounter_struct)); | |
| 1636 | 1636 | |
| 1637 | 1637 | if (!tiocmget) |
| 1638 | 1638 | return -ENOENT; |
| @@ -60,6 +60,7 @@ · 59 unmodified lines | ||
| 60 | 60 | #define USB_PRODUCT_IPHONE_3GS 0x1294 |
| 61 | 61 | #define USB_PRODUCT_IPHONE_4 0x1297 |
| 62 | 62 | #define USB_PRODUCT_IPHONE_4_VZW 0x129c |
| 63 | +#define USB_PRODUCT_IPHONE_4S 0x12a0 | |
| 63 | 64 | |
| 64 | 65 | #define IPHETH_USBINTF_CLASS 255 |
| 65 | 66 | #define IPHETH_USBINTF_SUBCLASS 253 |
| @@ -103,6 +104,10 @@ static struct usb_device_id ipheth_table[] = { · 37 unmodified lines | ||
| 103 | 104 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW, |
| 104 | 105 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, |
| 105 | 106 | IPHETH_USBINTF_PROTO) }, |
| 107 | + { USB_DEVICE_AND_INTERFACE_INFO( | |
| 108 | + USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4S, | |
| 109 | + IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | |
| 110 | + IPHETH_USBINTF_PROTO) }, | |
| 106 | 111 | { } |
| 107 | 112 | }; |
| 108 | 113 | MODULE_DEVICE_TABLE(usb, ipheth_table); |
| @@ -315,6 +315,11 @@ static const struct usb_device_id products [] = { · 314 unmodified lines | ||
| 315 | 315 | .idProduct = 0x9031, /* C-750 C-760 */ |
| 316 | 316 | ZAURUS_MASTER_INTERFACE, |
| 317 | 317 | .driver_info = ZAURUS_PXA_INFO, |
| 318 | +}, { | |
| 319 | + /* C-750/C-760/C-860/SL-C3000 PDA in MDLM mode */ | |
| 320 | + USB_DEVICE_AND_INTERFACE_INFO(0x04DD, 0x9031, USB_CLASS_COMM, | |
| 321 | + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | |
| 322 | + .driver_info = (unsigned long) &bogus_mdlm_info, | |
| 318 | 323 | }, { |
| 319 | 324 | .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
| 320 | 325 | | USB_DEVICE_ID_MATCH_DEVICE, |
| @@ -349,6 +354,13 @@ static const struct usb_device_id products [] = { · 28 unmodified lines | ||
| 349 | 354 | ZAURUS_MASTER_INTERFACE, |
| 350 | 355 | .driver_info = OLYMPUS_MXL_INFO, |
| 351 | 356 | }, |
| 357 | + | |
| 358 | +/* Logitech Harmony 900 - uses the pseudo-MDLM (BLAN) driver */ | |
| 359 | +{ | |
| 360 | + USB_DEVICE_AND_INTERFACE_INFO(0x046d, 0xc11f, USB_CLASS_COMM, | |
| 361 | + USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | |
| 362 | + .driver_info = (unsigned long) &bogus_mdlm_info, | |
| 363 | +}, | |
| 352 | 364 | { }, // END |
| 353 | 365 | }; |
| 354 | 366 | MODULE_DEVICE_TABLE(usb, products); |
| @@ -422,7 +422,9 @@ static void veth_dellink(struct net_device *dev, struct list_head *head) · 421 unmodified lines | ||
| 422 | 422 | unregister_netdevice_queue(peer, head); |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | −static const struct nla_policy veth_policy[VETH_INFO_MAX + 1]; | |
| 425 | +static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] = { | |
| 426 | + [VETH_INFO_PEER] = { .len = sizeof(struct ifinfomsg) }, | |
| 427 | +}; | |
| 426 | 428 | |
| 427 | 429 | static struct rtnl_link_ops veth_link_ops = { |
| 428 | 430 | .kind = DRV_NAME, |
| @@ -843,8 +843,8 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, · 842 unmodified lines | ||
| 843 | 843 | /* for simplicity, don't copy L4 headers */ |
| 844 | 844 | ctx->l4_hdr_size = 0; |
| 845 | 845 | } |
| 846 | − ctx->copy_size = ctx->eth_ip_hdr_size + | |
| 847 | − ctx->l4_hdr_size; | |
| 846 | + ctx->copy_size = min(ctx->eth_ip_hdr_size + | |
| 847 | + ctx->l4_hdr_size, skb->len); | |
| 848 | 848 | } else { |
| 849 | 849 | ctx->eth_ip_hdr_size = 0; |
| 850 | 850 | ctx->l4_hdr_size = 0; |
| @@ -1037,13 +1037,16 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah) · 1036 unmodified lines | ||
| 1037 | 1037 | |
| 1038 | 1038 | /* |
| 1039 | 1039 | * Workaround for early ACK timeouts, add an offset to match the |
| 1040 | − * initval's 64us ack timeout value. | |
| 1040 | + * initval's 64us ack timeout value. Use 48us for the CTS timeout. | |
| 1041 | 1041 | * This was initially only meant to work around an issue with delayed |
| 1042 | 1042 | * BA frames in some implementations, but it has been found to fix ACK |
| 1043 | 1043 | * timeout issues in other cases as well. |
| 1044 | 1044 | */ |
| 1045 | − if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ) | |
| 1045 | + if (conf->channel && conf->channel->band == IEEE80211_BAND_2GHZ) { | |
| 1046 | 1046 | acktimeout += 64 - sifstime - ah->slottime; |
| 1047 | + ctstimeout += 48 - sifstime - ah->slottime; | |
| 1048 | + } | |
| 1049 | + | |
| 1047 | 1050 | |
| 1048 | 1051 | ath9k_hw_set_sifs_time(ah, sifstime); |
| 1049 | 1052 | ath9k_hw_setslottime(ah, slottime); |
| @@ -822,6 +822,11 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, · 821 unmodified lines | ||
| 822 | 822 | ARRAY_SIZE(ath9k_tpt_blink)); |
| 823 | 823 | #endif |
| 824 | 824 | |
| 825 | + INIT_WORK(&sc->hw_reset_work, ath_reset_work); | |
| 826 | + INIT_WORK(&sc->hw_check_work, ath_hw_check); | |
| 827 | + INIT_WORK(&sc->paprd_work, ath_paprd_calibrate); | |
| 828 | + INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work); | |
| 829 | + | |
| 825 | 830 | /* Register with mac80211 */ |
| 826 | 831 | error = ieee80211_register_hw(hw); |
| 827 | 832 | if (error) |
| @@ -840,10 +845,6 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, · 12 unmodified lines | ||
| 840 | 845 | goto error_world; |
| 841 | 846 | } |
| 842 | 847 | |
| 843 | − INIT_WORK(&sc->hw_reset_work, ath_reset_work); | |
| 844 | − INIT_WORK(&sc->hw_check_work, ath_hw_check); | |
| 845 | − INIT_WORK(&sc->paprd_work, ath_paprd_calibrate); | |
| 846 | − INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work); | |
| 847 | 848 | sc->last_rssi = ATH_RSSI_DUMMY_MARKER; |
| 848 | 849 | |
| 849 | 850 | ath_init_leds(sc); |
| @@ -694,7 +694,7 @@ static u8 ath_rc_get_highest_rix(struct ath_softc *sc, · 693 unmodified lines | ||
| 694 | 694 | return rate; |
| 695 | 695 | |
| 696 | 696 | /* This should not happen */ |
| 697 | − WARN_ON(1); | |
| 697 | + WARN_ON_ONCE(1); | |
| 698 | 698 | |
| 699 | 699 | rate = ath_rc_priv->valid_rate_index[0]; |
| 700 | 700 | |
| @@ -1346,7 +1346,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, · 645 unmodified lines | ||
| 1346 | 1346 | fc = hdr->frame_control; |
| 1347 | 1347 | for (i = 0; i < sc->hw->max_rates; i++) { |
| 1348 | 1348 | struct ieee80211_tx_rate *rate = &tx_info->status.rates[i]; |
| 1349 | − if (!rate->count) | |
| 1349 | + if (rate->idx < 0 || !rate->count) | |
| 1350 | 1350 | break; |
| 1351 | 1351 | |
| 1352 | 1352 | final_ts_idx = i; |
| @@ -822,6 +822,14 @@ static bool ath9k_rx_accept(struct ath_common *common, · 821 unmodified lines | ||
| 822 | 822 | (ATH9K_RXERR_DECRYPT | ATH9K_RXERR_CRC | ATH9K_RXERR_MIC | |
| 823 | 823 | ATH9K_RXERR_KEYMISS)); |
| 824 | 824 | |
| 825 | + /* | |
| 826 | + * Key miss events are only relevant for pairwise keys where the | |
| 827 | + * descriptor does contain a valid key index. This has been observed | |
| 828 | + * mostly with CCMP encryption. | |
| 829 | + */ | |
| 830 | + if (rx_stats->rs_keyix == ATH9K_RXKEYIX_INVALID) | |
| 831 | + rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS; | |
| 832 | + | |
| 825 | 833 | if (!rx_stats->rs_datalen) |
| 826 | 834 | return false; |
| 827 | 835 | /* |
| @@ -91,6 +91,7 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv, · 90 unmodified lines | ||
| 91 | 91 | tx_cmd->tid_tspec = qc[0] & 0xf; |
| 92 | 92 | tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; |
| 93 | 93 | } else { |
| 94 | + tx_cmd->tid_tspec = IWL_TID_NON_QOS; | |
| 94 | 95 | if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) |
| 95 | 96 | tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; |
| 96 | 97 | else |
| @@ -620,7 +621,7 @@ int iwlagn_tx_agg_oper(struct iwl_priv *priv, struct ieee80211_vif *vif, · 523 unmodified lines | ||
| 620 | 621 | sta_priv->lq_sta.lq.agg_params.agg_frame_cnt_limit = |
| 621 | 622 | sta_priv->max_agg_bufsize; |
| 622 | 623 | |
| 623 | − IWL_INFO(priv, "Tx aggregation enabled on ra = %pM tid = %d\n", | |
| 624 | + IWL_DEBUG_HT(priv, "Tx aggregation enabled on ra = %pM tid = %d\n", | |
| 624 | 625 | sta->addr, tid); |
| 625 | 626 | |
| 626 | 627 | return iwl_send_lq_cmd(priv, ctx, |
| @@ -808,6 +809,8 @@ static void iwl_rx_reply_tx_agg(struct iwl_priv *priv, · 181 unmodified lines | ||
| 808 | 809 | u32 status = le16_to_cpu(tx_resp->status.status); |
| 809 | 810 | int i; |
| 810 | 811 | |
| 812 | + WARN_ON(tid == IWL_TID_NON_QOS); | |
| 813 | + | |
| 811 | 814 | if (agg->wait_for_ba) |
| 812 | 815 | IWL_DEBUG_TX_REPLY(priv, |
| 813 | 816 | "got tx response w/o block-ack\n"); |
| @@ -1035,10 +1038,13 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb, · 221 unmodified lines | ||
| 1035 | 1038 | } |
| 1036 | 1039 | |
| 1037 | 1040 | __skb_queue_head_init(&skbs); |
| 1038 | − priv->tid_data[sta_id][tid].next_reclaimed = next_reclaimed; | |
| 1039 | 1041 | |
| 1040 | − IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d", | |
| 1041 | − next_reclaimed); | |
| 1042 | + if (tid != IWL_TID_NON_QOS) { | |
| 1043 | + priv->tid_data[sta_id][tid].next_reclaimed = | |
| 1044 | + next_reclaimed; | |
| 1045 | + IWL_DEBUG_TX_REPLY(priv, "Next reclaimed packet:%d", | |
| 1046 | + next_reclaimed); | |
| 1047 | + } | |
| 1042 | 1048 | |
| 1043 | 1049 | /*we can free until ssn % q.n_bd not inclusive */ |
| 1044 | 1050 | WARN_ON(iwl_trans_reclaim(trans(priv), sta_id, tid, txq_id, |
| @@ -815,6 +815,7 @@ struct iwl_qosparam_cmd { · 814 unmodified lines | ||
| 815 | 815 | |
| 816 | 816 | #define IWL_INVALID_STATION 255 |
| 817 | 817 | #define IWL_MAX_TID_COUNT 8 |
| 818 | +#define IWL_TID_NON_QOS IWL_MAX_TID_COUNT | |
| 818 | 819 | |
| 819 | 820 | #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2) |
| 820 | 821 | #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8) |
| @@ -1262,6 +1262,7 @@ static int iwl_trans_pcie_reclaim(struct iwl_trans *trans, int sta_id, int tid, · 1261 unmodified lines | ||
| 1262 | 1262 | txq->time_stamp = jiffies; |
| 1263 | 1263 | |
| 1264 | 1264 | if (unlikely(txq_id >= IWLAGN_FIRST_AMPDU_QUEUE && |
| 1265 | + tid != IWL_TID_NON_QOS && | |
| 1265 | 1266 | txq_id != trans_pcie->agg_txq[sta_id][tid])) { |
| 1266 | 1267 | /* |
| 1267 | 1268 | * FIXME: this is a uCode bug which need to be addressed, |
| @@ -841,7 +841,12 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, · 840 unmodified lines | ||
| 841 | 841 | ret = mwifiex_set_rf_channel(priv, channel, |
| 842 | 842 | priv->adapter->channel_type); |
| 843 | 843 | |
| 844 | − ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); /* Disable keys */ | |
| 844 | + /* As this is new association, clear locally stored | |
| 845 | + * keys and security related flags */ | |
| 846 | + priv->sec_info.wpa_enabled = false; | |
| 847 | + priv->sec_info.wpa2_enabled = false; | |
| 848 | + priv->wep_key_curr_index = 0; | |
| 849 | + ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); | |
| 845 | 850 | |
| 846 | 851 | if (mode == NL80211_IFTYPE_ADHOC) { |
| 847 | 852 | /* "privacy" is set only for ad-hoc mode */ |
| @@ -886,6 +891,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, · 38 unmodified lines | ||
| 886 | 891 | dev_dbg(priv->adapter->dev, |
| 887 | 892 | "info: setting wep encryption" |
| 888 | 893 | " with key len %d\n", sme->key_len); |
| 894 | + priv->wep_key_curr_index = sme->key_idx; | |
| 889 | 895 | ret = mwifiex_set_encode(priv, sme->key, sme->key_len, |
| 890 | 896 | sme->key_idx, 0); |
| 891 | 897 | } |
| @@ -382,7 +382,8 @@ mwifiex_free_adapter(struct mwifiex_adapter *adapter) · 381 unmodified lines | ||
| 382 | 382 | |
| 383 | 383 | adapter->if_ops.cleanup_if(adapter); |
| 384 | 384 | |
| 385 | − dev_kfree_skb_any(adapter->sleep_cfm); | |
| 385 | + if (adapter->sleep_cfm) | |
| 386 | + dev_kfree_skb_any(adapter->sleep_cfm); | |
| 386 | 387 | } |
| 387 | 388 | |
| 388 | 389 | /* |
| @@ -822,7 +822,9 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) · 821 unmodified lines | ||
| 822 | 822 | continue; |
| 823 | 823 | |
| 824 | 824 | rtnl_lock(); |
| 825 | − mwifiex_del_virtual_intf(priv->wdev->wiphy, priv->netdev); | |
| 825 | + if (priv->wdev && priv->netdev) | |
| 826 | + mwifiex_del_virtual_intf(priv->wdev->wiphy, | |
| 827 | + priv->netdev); | |
| 826 | 828 | rtnl_unlock(); |
| 827 | 829 | } |
| 828 | 830 | |
| @@ -830,9 +832,11 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) · 1 unmodified line | ||
| 830 | 832 | if (!priv) |
| 831 | 833 | goto exit_remove; |
| 832 | 834 | |
| 833 | − wiphy_unregister(priv->wdev->wiphy); | |
| 834 | − wiphy_free(priv->wdev->wiphy); | |
| 835 | − kfree(priv->wdev); | |
| 835 | + if (priv->wdev) { | |
| 836 | + wiphy_unregister(priv->wdev->wiphy); | |
| 837 | + wiphy_free(priv->wdev->wiphy); | |
| 838 | + kfree(priv->wdev); | |
| 839 | + } | |
| 836 | 840 | |
| 837 | 841 | mwifiex_terminate_workqueue(adapter); |
| 838 | 842 | |
| @@ -54,7 +54,7 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, · 53 unmodified lines | ||
| 54 | 54 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) |
| 55 | 55 | { |
| 56 | 56 | bool cancel_flag = false; |
| 57 | − int status = adapter->cmd_wait_q.status; | |
| 57 | + int status; | |
| 58 | 58 | struct cmd_ctrl_node *cmd_queued; |
| 59 | 59 | |
| 60 | 60 | if (!adapter->cmd_queued) |
| @@ -79,6 +79,8 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) · 18 unmodified lines | ||
| 79 | 79 | mwifiex_cancel_pending_ioctl(adapter); |
| 80 | 80 | dev_dbg(adapter->dev, "cmd cancel\n"); |
| 81 | 81 | } |
| 82 | + | |
| 83 | + status = adapter->cmd_wait_q.status; | |
| 82 | 84 | adapter->cmd_wait_q.status = 0; |
| 83 | 85 | |
| 84 | 86 | return status; |
| @@ -240,6 +242,8 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, · 155 unmodified lines | ||
| 240 | 242 | |
| 241 | 243 | if (!netif_queue_stopped(priv->netdev)) |
| 242 | 244 | mwifiex_stop_net_dev_queue(priv->netdev, adapter); |
| 245 | + if (netif_carrier_ok(priv->netdev)) | |
| 246 | + netif_carrier_off(priv->netdev); | |
| 243 | 247 | |
| 244 | 248 | /* Clear any past association response stored for |
| 245 | 249 | * application retrieval */ |
| @@ -271,6 +275,8 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, · 25 unmodified lines | ||
| 271 | 275 | |
| 272 | 276 | if (!netif_queue_stopped(priv->netdev)) |
| 273 | 277 | mwifiex_stop_net_dev_queue(priv->netdev, adapter); |
| 278 | + if (netif_carrier_ok(priv->netdev)) | |
| 279 | + netif_carrier_off(priv->netdev); | |
| 274 | 280 | |
| 275 | 281 | if (!ret) { |
| 276 | 282 | dev_dbg(adapter->dev, "info: network found in scan" |
| @@ -514,9 +514,9 @@ EXPORT_SYMBOL_GPL(rt2800_write_tx_data); · 513 unmodified lines | ||
| 514 | 514 | |
| 515 | 515 | static int rt2800_agc_to_rssi(struct rt2x00_dev *rt2x00dev, u32 rxwi_w2) |
| 516 | 516 | { |
| 517 | − int rssi0 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI0); | |
| 518 | − int rssi1 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI1); | |
| 519 | − int rssi2 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI2); | |
| 517 | + s8 rssi0 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI0); | |
| 518 | + s8 rssi1 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI1); | |
| 519 | + s8 rssi2 = rt2x00_get_field32(rxwi_w2, RXWI_W2_RSSI2); | |
| 520 | 520 | u16 eeprom; |
| 521 | 521 | u8 offset0; |
| 522 | 522 | u8 offset1; |
| @@ -552,7 +552,7 @@ static int rt2800_agc_to_rssi(struct rt2x00_dev *rt2x00dev, u32 rxwi_w2) · 29 unmodified lines | ||
| 552 | 552 | * which gives less energy... |
| 553 | 553 | */ |
| 554 | 554 | rssi0 = max(rssi0, rssi1); |
| 555 | − return max(rssi0, rssi2); | |
| 555 | + return (int)max(rssi0, rssi2); | |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | void rt2800_process_rxwi(struct queue_entry *entry, |
| @@ -1501,7 +1501,7 @@ static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev) · 1500 unmodified lines | ||
| 1501 | 1501 | return err; |
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | − return 1; | |
| 1504 | + return 0; | |
| 1505 | 1505 | } |
| 1506 | 1506 | |
| 1507 | 1507 | static int rtl_pci_start(struct ieee80211_hw *hw) |
| @@ -1870,7 +1870,7 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev, · 362 unmodified lines | ||
| 1870 | 1870 | } |
| 1871 | 1871 | |
| 1872 | 1872 | /* Init PCI sw */ |
| 1873 | − err = !rtl_pci_init(hw, pdev); | |
| 1873 | + err = rtl_pci_init(hw, pdev); | |
| 1874 | 1874 | if (err) { |
| 1875 | 1875 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, |
| 1876 | 1876 | ("Failed to init PCI.\n")); |
| @@ -866,6 +866,14 @@ static int fill_ctrlset(struct zd_mac *mac, · 865 unmodified lines | ||
| 866 | 866 | |
| 867 | 867 | ZD_ASSERT(frag_len <= 0xffff); |
| 868 | 868 | |
| 869 | + /* | |
| 870 | + * Firmware computes the duration itself (for all frames except PSPoll) | |
| 871 | + * and needs the field set to 0 at input, otherwise firmware messes up | |
| 872 | + * duration_id and sets bits 14 and 15 on. | |
| 873 | + */ | |
| 874 | + if (!ieee80211_is_pspoll(hdr->frame_control)) | |
| 875 | + hdr->duration_id = 0; | |
| 876 | + | |
| 869 | 877 | txrate = ieee80211_get_tx_rate(mac->hw, info); |
| 870 | 878 | |
| 871 | 879 | cs->modulation = txrate->hw_value; |
| @@ -347,8 +347,6 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) · 346 unmodified lines | ||
| 347 | 347 | return rc; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | − pci_write_config_dword(dev, iov->pos + PCI_SRIOV_SYS_PGSIZE, iov->pgsz); | |
| 351 | − | |
| 352 | 350 | iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE; |
| 353 | 351 | pci_cfg_access_lock(dev); |
| 354 | 352 | pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl); |
| @@ -466,6 +464,7 @@ found: · 111 unmodified lines | ||
| 466 | 464 | return -EIO; |
| 467 | 465 | |
| 468 | 466 | pgsz &= ~(pgsz - 1); |
| 467 | + pci_write_config_dword(dev, pos + PCI_SRIOV_SYS_PGSIZE, pgsz); | |
| 469 | 468 | |
| 470 | 469 | nres = 0; |
| 471 | 470 | for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { |
| @@ -651,6 +651,11 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, · 650 unmodified lines | ||
| 651 | 651 | dev_dbg(&dev->dev, "scanning [bus %02x-%02x] behind bridge, pass %d\n", |
| 652 | 652 | secondary, subordinate, pass); |
| 653 | 653 | |
| 654 | + if (!primary && (primary != bus->number) && secondary && subordinate) { | |
| 655 | + dev_warn(&dev->dev, "Primary bus is hard wired to 0\n"); | |
| 656 | + primary = bus->number; | |
| 657 | + } | |
| 658 | + | |
| 654 | 659 | /* Check if setup is sensible at all */ |
| 655 | 660 | if (!pass && |
| 656 | 661 | (primary != bus->number || secondary <= bus->number)) { |
| @@ -77,6 +77,7 @@ void pci_remove_bus(struct pci_bus *pci_bus) · 76 unmodified lines | ||
| 77 | 77 | } |
| 78 | 78 | EXPORT_SYMBOL(pci_remove_bus); |
| 79 | 79 | |
| 80 | +static void __pci_remove_behind_bridge(struct pci_dev *dev); | |
| 80 | 81 | /** |
| 81 | 82 | * pci_remove_bus_device - remove a PCI device and any children |
| 82 | 83 | * @dev: the device to remove |
| @@ -94,7 +95,7 @@ static void __pci_remove_bus_device(struct pci_dev *dev) · 11 unmodified lines | ||
| 94 | 95 | if (dev->subordinate) { |
| 95 | 96 | struct pci_bus *b = dev->subordinate; |
| 96 | 97 | |
| 97 | − pci_remove_behind_bridge(dev); | |
| 98 | + __pci_remove_behind_bridge(dev); | |
| 98 | 99 | pci_remove_bus(b); |
| 99 | 100 | dev->subordinate = NULL; |
| 100 | 101 | } |
| @@ -107,6 +108,24 @@ void pci_remove_bus_device(struct pci_dev *dev) · 6 unmodified lines | ||
| 107 | 108 | __pci_remove_bus_device(dev); |
| 108 | 109 | } |
| 109 | 110 | |
| 111 | +static void __pci_remove_behind_bridge(struct pci_dev *dev) | |
| 112 | +{ | |
| 113 | + struct list_head *l, *n; | |
| 114 | + | |
| 115 | + if (dev->subordinate) | |
| 116 | + list_for_each_safe(l, n, &dev->subordinate->devices) | |
| 117 | + __pci_remove_bus_device(pci_dev_b(l)); | |
| 118 | +} | |
| 119 | + | |
| 120 | +static void pci_stop_behind_bridge(struct pci_dev *dev) | |
| 121 | +{ | |
| 122 | + struct list_head *l, *n; | |
| 123 | + | |
| 124 | + if (dev->subordinate) | |
| 125 | + list_for_each_safe(l, n, &dev->subordinate->devices) | |
| 126 | + pci_stop_bus_device(pci_dev_b(l)); | |
| 127 | +} | |
| 128 | + | |
| 110 | 129 | /** |
| 111 | 130 | * pci_remove_behind_bridge - remove all devices behind a PCI bridge |
| 112 | 131 | * @dev: PCI bridge device |
| @@ -117,11 +136,8 @@ void pci_remove_bus_device(struct pci_dev *dev) · 4 unmodified lines | ||
| 117 | 136 | */ |
| 118 | 137 | void pci_remove_behind_bridge(struct pci_dev *dev) |
| 119 | 138 | { |
| 120 | − struct list_head *l, *n; | |
| 121 | − | |
| 122 | − if (dev->subordinate) | |
| 123 | − list_for_each_safe(l, n, &dev->subordinate->devices) | |
| 124 | − __pci_remove_bus_device(pci_dev_b(l)); | |
| 139 | + pci_stop_behind_bridge(dev); | |
| 140 | + __pci_remove_behind_bridge(dev); | |
| 125 | 141 | } |
| 126 | 142 | |
| 127 | 143 | static void pci_stop_bus_devices(struct pci_bus *bus) |
| @@ -189,7 +189,7 @@ static int pcifront_bus_read(struct pci_bus *bus, unsigned int devfn, · 188 unmodified lines | ||
| 189 | 189 | |
| 190 | 190 | if (verbose_request) |
| 191 | 191 | dev_info(&pdev->xdev->dev, |
| 192 | − "read dev=%04x:%02x:%02x.%01x - offset %x size %d\n", | |
| 192 | + "read dev=%04x:%02x:%02x.%d - offset %x size %d\n", | |
| 193 | 193 | pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), |
| 194 | 194 | PCI_FUNC(devfn), where, size); |
| 195 | 195 | |
| @@ -228,7 +228,7 @@ static int pcifront_bus_write(struct pci_bus *bus, unsigned int devfn, · 32 unmodified lines | ||
| 228 | 228 | |
| 229 | 229 | if (verbose_request) |
| 230 | 230 | dev_info(&pdev->xdev->dev, |
| 231 | − "write dev=%04x:%02x:%02x.%01x - " | |
| 231 | + "write dev=%04x:%02x:%02x.%d - " | |
| 232 | 232 | "offset %x size %d val %x\n", |
| 233 | 233 | pci_domain_nr(bus), bus->number, |
| 234 | 234 | PCI_SLOT(devfn), PCI_FUNC(devfn), where, size, val); |
| @@ -432,7 +432,7 @@ static int __devinit pcifront_scan_bus(struct pcifront_device *pdev, · 197 unmodified lines | ||
| 432 | 432 | d = pci_scan_single_device(b, devfn); |
| 433 | 433 | if (d) |
| 434 | 434 | dev_info(&pdev->xdev->dev, "New device on " |
| 435 | − "%04x:%02x:%02x.%02x found.\n", domain, bus, | |
| 435 | + "%04x:%02x:%02x.%d found.\n", domain, bus, | |
| 436 | 436 | PCI_SLOT(devfn), PCI_FUNC(devfn)); |
| 437 | 437 | } |
| 438 | 438 | |
| @@ -1041,7 +1041,7 @@ static int pcifront_detach_devices(struct pcifront_device *pdev) · 602 unmodified lines | ||
| 1041 | 1041 | pci_dev = pci_get_slot(pci_bus, PCI_DEVFN(slot, func)); |
| 1042 | 1042 | if (!pci_dev) { |
| 1043 | 1043 | dev_dbg(&pdev->xdev->dev, |
| 1044 | − "Cannot get PCI device %04x:%02x:%02x.%02x\n", | |
| 1044 | + "Cannot get PCI device %04x:%02x:%02x.%d\n", | |
| 1045 | 1045 | domain, bus, slot, func); |
| 1046 | 1046 | continue; |
| 1047 | 1047 | } |
| @@ -1049,7 +1049,7 @@ static int pcifront_detach_devices(struct pcifront_device *pdev) · 1 unmodified line | ||
| 1049 | 1049 | pci_dev_put(pci_dev); |
| 1050 | 1050 | |
| 1051 | 1051 | dev_dbg(&pdev->xdev->dev, |
| 1052 | − "PCI device %04x:%02x:%02x.%02x removed.\n", | |
| 1052 | + "PCI device %04x:%02x:%02x.%d removed.\n", | |
| 1053 | 1053 | domain, bus, slot, func); |
| 1054 | 1054 | } |
| 1055 | 1055 | |
| @@ -1269,10 +1269,8 @@ static int pcmcia_bus_add(struct pcmcia_socket *skt) · 1268 unmodified lines | ||
| 1269 | 1269 | |
| 1270 | 1270 | static int pcmcia_bus_early_resume(struct pcmcia_socket *skt) |
| 1271 | 1271 | { |
| 1272 | − if (!verify_cis_cache(skt)) { | |
| 1273 | − pcmcia_put_socket(skt); | |
| 1272 | + if (!verify_cis_cache(skt)) | |
| 1274 | 1273 | return 0; |
| 1275 | − } | |
| 1276 | 1274 | |
| 1277 | 1275 | dev_dbg(&skt->dev, "cis mismatch - different card\n"); |
| 1278 | 1276 | |
| @@ -189,7 +189,7 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev, · 188 unmodified lines | ||
| 189 | 189 | pindesc->pctldev = pctldev; |
| 190 | 190 | |
| 191 | 191 | /* Copy basic pin info */ |
| 192 | − if (pindesc->name) { | |
| 192 | + if (name) { | |
| 193 | 193 | pindesc->name = name; |
| 194 | 194 | } else { |
| 195 | 195 | pindesc->name = kasprintf(GFP_KERNEL, "PIN%u", number); |
| @@ -33,6 +33,8 @@ · 32 unmodified lines | ||
| 33 | 33 | #include <linux/mutex.h> |
| 34 | 34 | #include <asm/bios_ebda.h> |
| 35 | 35 | |
| 36 | +#include <asm-generic/io-64-nonatomic-lo-hi.h> | |
| 37 | + | |
| 36 | 38 | static bool force; |
| 37 | 39 | module_param(force, bool, 0); |
| 38 | 40 | MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); |
| @@ -83,19 +85,6 @@ static void __iomem *rtl_cmd_addr; · 44 unmodified lines | ||
| 83 | 85 | static u8 rtl_cmd_type; |
| 84 | 86 | static u8 rtl_cmd_width; |
| 85 | 87 | |
| 86 | −#ifndef readq | |
| 87 | −static inline __u64 readq(const volatile void __iomem *addr) | |
| 88 | −{ | |
| 89 | − const volatile u32 __iomem *p = addr; | |
| 90 | − u32 low, high; | |
| 91 | − | |
| 92 | − low = readl(p); | |
| 93 | − high = readl(p + 1); | |
| 94 | − | |
| 95 | − return low + ((u64)high << 32); | |
| 96 | −} | |
| 97 | −#endif | |
| 98 | − | |
| 99 | 88 | static void __iomem *rtl_port_map(phys_addr_t addr, unsigned long len) |
| 100 | 89 | { |
| 101 | 90 | if (rtl_cmd_type == RTL_ADDR_TYPE_MMIO) |
| @@ -77,6 +77,8 @@ · 76 unmodified lines | ||
| 77 | 77 | #include <asm/processor.h> |
| 78 | 78 | #include "intel_ips.h" |
| 79 | 79 | |
| 80 | +#include <asm-generic/io-64-nonatomic-lo-hi.h> | |
| 81 | + | |
| 80 | 82 | #define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32 |
| 81 | 83 | |
| 82 | 84 | /* |
| @@ -344,19 +346,6 @@ struct ips_driver { · 261 unmodified lines | ||
| 344 | 346 | static bool |
| 345 | 347 | ips_gpu_turbo_enabled(struct ips_driver *ips); |
| 346 | 348 | |
| 347 | −#ifndef readq | |
| 348 | −static inline __u64 readq(const volatile void __iomem *addr) | |
| 349 | −{ | |
| 350 | − const volatile u32 __iomem *p = addr; | |
| 351 | − u32 low, high; | |
| 352 | − | |
| 353 | − low = readl(p); | |
| 354 | − high = readl(p + 1); | |
| 355 | − | |
| 356 | − return low + ((u64)high << 32); | |
| 357 | −} | |
| 358 | −#endif | |
| 359 | − | |
| 360 | 349 | /** |
| 361 | 350 | * ips_cpu_busy - is CPU busy? |
| 362 | 351 | * @ips: IPS driver struct |
| @@ -62,11 +62,10 @@ · 61 unmodified lines | ||
| 62 | 62 | |
| 63 | 63 | #define BQ27500_REG_SOC 0x2C |
| 64 | 64 | #define BQ27500_REG_DCAP 0x3C /* Design capacity */ |
| 65 | −#define BQ27500_FLAG_DSG BIT(0) /* Discharging */ | |
| 65 | +#define BQ27500_FLAG_DSC BIT(0) | |
| 66 | 66 | #define BQ27500_FLAG_SOCF BIT(1) /* State-of-Charge threshold final */ |
| 67 | 67 | #define BQ27500_FLAG_SOC1 BIT(2) /* State-of-Charge threshold 1 */ |
| 68 | −#define BQ27500_FLAG_CHG BIT(8) /* Charging */ | |
| 69 | −#define BQ27500_FLAG_FC BIT(9) /* Fully charged */ | |
| 68 | +#define BQ27500_FLAG_FC BIT(9) | |
| 70 | 69 | |
| 71 | 70 | #define BQ27000_RS 20 /* Resistor sense */ |
| 72 | 71 | |
| @@ -312,7 +311,7 @@ static void bq27x00_update(struct bq27x00_device_info *di) · 239 unmodified lines | ||
| 312 | 311 | struct bq27x00_reg_cache cache = {0, }; |
| 313 | 312 | bool is_bq27500 = di->chip == BQ27500; |
| 314 | 313 | |
| 315 | − cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, is_bq27500); | |
| 314 | + cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, !is_bq27500); | |
| 316 | 315 | if (cache.flags >= 0) { |
| 317 | 316 | if (!is_bq27500 && (cache.flags & BQ27000_FLAG_CI)) { |
| 318 | 317 | dev_info(di->dev, "battery is not calibrated! ignoring capacity values\n"); |
| @@ -401,14 +400,10 @@ static int bq27x00_battery_status(struct bq27x00_device_info *di, · 82 unmodified lines | ||
| 401 | 400 | if (di->chip == BQ27500) { |
| 402 | 401 | if (di->cache.flags & BQ27500_FLAG_FC) |
| 403 | 402 | status = POWER_SUPPLY_STATUS_FULL; |
| 404 | − else if (di->cache.flags & BQ27500_FLAG_DSG) | |
| 403 | + else if (di->cache.flags & BQ27500_FLAG_DSC) | |
| 405 | 404 | status = POWER_SUPPLY_STATUS_DISCHARGING; |
| 406 | − else if (di->cache.flags & BQ27500_FLAG_CHG) | |
| 407 | − status = POWER_SUPPLY_STATUS_CHARGING; | |
| 408 | − else if (power_supply_am_i_supplied(&di->bat)) | |
| 409 | − status = POWER_SUPPLY_STATUS_NOT_CHARGING; | |
| 410 | 405 | else |
| 411 | − status = POWER_SUPPLY_STATUS_UNKNOWN; | |
| 406 | + status = POWER_SUPPLY_STATUS_CHARGING; | |
| 412 | 407 | } else { |
| 413 | 408 | if (di->cache.flags & BQ27000_FLAG_FC) |
| 414 | 409 | status = POWER_SUPPLY_STATUS_FULL; |
| @@ -974,10 +974,11 @@ static int __devexit charger_manager_remove(struct platform_device *pdev) · 973 unmodified lines | ||
| 974 | 974 | return 0; |
| 975 | 975 | } |
| 976 | 976 | |
| 977 | −const struct platform_device_id charger_manager_id[] = { | |
| 977 | +static const struct platform_device_id charger_manager_id[] = { | |
| 978 | 978 | { "charger-manager", 0 }, |
| 979 | 979 | { }, |
| 980 | 980 | }; |
| 981 | +MODULE_DEVICE_TABLE(platform, charger_manager_id); | |
| 981 | 982 | |
| 982 | 983 | static int cm_suspend_prepare(struct device *dev) |
| 983 | 984 | { |
| @@ -1069,4 +1070,3 @@ module_exit(charger_manager_cleanup); · 85 unmodified lines | ||
| 1069 | 1070 | MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>"); |
| 1070 | 1071 | MODULE_DESCRIPTION("Charger Manager"); |
| 1071 | 1072 | MODULE_LICENSE("GPL"); |
| 1072 | −MODULE_ALIAS("charger-manager"); | |
| @@ -464,6 +464,7 @@ static int __devexit lp8727_remove(struct i2c_client *cl) · 463 unmodified lines | ||
| 464 | 464 | |
| 465 | 465 | static const struct i2c_device_id lp8727_ids[] = { |
| 466 | 466 | {"lp8727", 0}, |
| 467 | + { } | |
| 467 | 468 | }; |
| 468 | 469 | |
| 469 | 470 | static struct i2c_driver lp8727_driver = { |
| @@ -150,7 +150,7 @@ static int max8649_enable_time(struct regulator_dev *rdev) · 149 unmodified lines | ||
| 150 | 150 | if (ret != 0) |
| 151 | 151 | return ret; |
| 152 | 152 | val &= MAX8649_VOL_MASK; |
| 153 | − voltage = max8649_list_voltage(rdev, (unsigned char)ret); /* uV */ | |
| 153 | + voltage = max8649_list_voltage(rdev, (unsigned char)val); /* uV */ | |
| 154 | 154 | |
| 155 | 155 | /* get rate */ |
| 156 | 156 | ret = regmap_read(info->regmap, MAX8649_RAMP, &val); |
| @@ -254,6 +254,7 @@ int __devinit mc13xxx_get_num_regulators_dt(struct platform_device *pdev) · 253 unmodified lines | ||
| 254 | 254 | |
| 255 | 255 | return num; |
| 256 | 256 | } |
| 257 | +EXPORT_SYMBOL_GPL(mc13xxx_get_num_regulators_dt); | |
| 257 | 258 | |
| 258 | 259 | struct mc13xxx_regulator_init_data * __devinit mc13xxx_parse_regulators_dt( |
| 259 | 260 | struct platform_device *pdev, struct mc13xxx_regulator *regulators, |
| @@ -291,6 +292,7 @@ struct mc13xxx_regulator_init_data * __devinit mc13xxx_parse_regulators_dt( · 31 unmodified lines | ||
| 291 | 292 | |
| 292 | 293 | return data; |
| 293 | 294 | } |
| 295 | +EXPORT_SYMBOL_GPL(mc13xxx_parse_regulators_dt); | |
| 294 | 296 | #endif |
| 295 | 297 | |
| 296 | 298 | MODULE_LICENSE("GPL v2"); |
| @@ -307,8 +307,12 @@ static int __init at91_rtc_probe(struct platform_device *pdev) · 306 unmodified lines | ||
| 307 | 307 | device_init_wakeup(&pdev->dev, 1); |
| 308 | 308 | |
| 309 | 309 | platform_set_drvdata(pdev, rtc); |
| 310 | − rtc->rtt = (void __force __iomem *) (AT91_VA_BASE_SYS - AT91_BASE_SYS); | |
| 311 | − rtc->rtt += r->start; | |
| 310 | + rtc->rtt = ioremap(r->start, resource_size(r)); | |
| 311 | + if (!rtc->rtt) { | |
| 312 | + dev_err(&pdev->dev, "failed to map registers, aborting.\n"); | |
| 313 | + ret = -ENOMEM; | |
| 314 | + goto fail; | |
| 315 | + } | |
| 312 | 316 | |
| 313 | 317 | mr = rtt_readl(rtc, MR); |
| 314 | 318 | |
| @@ -326,7 +330,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) · 11 unmodified lines | ||
| 326 | 330 | &at91_rtc_ops, THIS_MODULE); |
| 327 | 331 | if (IS_ERR(rtc->rtcdev)) { |
| 328 | 332 | ret = PTR_ERR(rtc->rtcdev); |
| 329 | − goto fail; | |
| 333 | + goto fail_register; | |
| 330 | 334 | } |
| 331 | 335 | |
| 332 | 336 | /* register irq handler after we know what name we'll use */ |
| @@ -351,6 +355,8 @@ static int __init at91_rtc_probe(struct platform_device *pdev) · 18 unmodified lines | ||
| 351 | 355 | |
| 352 | 356 | return 0; |
| 353 | 357 | |
| 358 | +fail_register: | |
| 359 | + iounmap(rtc->rtt); | |
| 354 | 360 | fail: |
| 355 | 361 | platform_set_drvdata(pdev, NULL); |
| 356 | 362 | kfree(rtc); |
| @@ -371,6 +377,7 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) · 14 unmodified lines | ||
| 371 | 377 | |
| 372 | 378 | rtc_device_unregister(rtc->rtcdev); |
| 373 | 379 | |
| 380 | + iounmap(rtc->rtt); | |
| 374 | 381 | platform_set_drvdata(pdev, NULL); |
| 375 | 382 | kfree(rtc); |
| 376 | 383 | return 0; |
| @@ -18,12 +18,12 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/hdreg.h> /* HDIO_GETGEO */ |
| 19 | 19 | #include <linux/bio.h> |
| 20 | 20 | #include <linux/module.h> |
| 21 | +#include <linux/compat.h> | |
| 21 | 22 | #include <linux/init.h> |
| 22 | 23 | |
| 23 | 24 | #include <asm/debug.h> |
| 24 | 25 | #include <asm/idals.h> |
| 25 | 26 | #include <asm/ebcdic.h> |
| 26 | −#include <asm/compat.h> | |
| 27 | 27 | #include <asm/io.h> |
| 28 | 28 | #include <asm/uaccess.h> |
| 29 | 29 | #include <asm/cio.h> |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | #define KMSG_COMPONENT "dasd" |
| 14 | 14 | |
| 15 | 15 | #include <linux/interrupt.h> |
| 16 | +#include <linux/compat.h> | |
| 16 | 17 | #include <linux/major.h> |
| 17 | 18 | #include <linux/fs.h> |
| 18 | 19 | #include <linux/blkpg.h> |
| @@ -87,6 +87,7 @@ struct raw3215_info { · 86 unmodified lines | ||
| 87 | 87 | struct tty_struct *tty; /* pointer to tty structure if present */ |
| 88 | 88 | struct raw3215_req *queued_read; /* pointer to queued read requests */ |
| 89 | 89 | struct raw3215_req *queued_write;/* pointer to queued write requests */ |
| 90 | + struct tasklet_struct tlet; /* tasklet to invoke tty_wakeup */ | |
| 90 | 91 | wait_queue_head_t empty_wait; /* wait queue for flushing */ |
| 91 | 92 | struct timer_list timer; /* timer for delayed output */ |
| 92 | 93 | int line_pos; /* position on the line (for tabs) */ |
| @@ -333,20 +334,24 @@ static inline void raw3215_try_io(struct raw3215_info *raw) · 240 unmodified lines | ||
| 333 | 334 | } |
| 334 | 335 | } |
| 335 | 336 | |
| 337 | +/* | |
| 338 | + * Call tty_wakeup from tasklet context | |
| 339 | + */ | |
| 340 | +static void raw3215_wakeup(unsigned long data) | |
| 341 | +{ | |
| 342 | + struct raw3215_info *raw = (struct raw3215_info *) data; | |
| 343 | + tty_wakeup(raw->tty); | |
| 344 | +} | |
| 345 | + | |
| 336 | 346 | /* |
| 337 | 347 | * Try to start the next IO and wake up processes waiting on the tty. |
| 338 | 348 | */ |
| 339 | 349 | static void raw3215_next_io(struct raw3215_info *raw) |
| 340 | 350 | { |
| 341 | − struct tty_struct *tty; | |
| 342 | − | |
| 343 | 351 | raw3215_mk_write_req(raw); |
| 344 | 352 | raw3215_try_io(raw); |
| 345 | − tty = raw->tty; | |
| 346 | − if (tty != NULL && | |
| 347 | − RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE) { | |
| 348 | − tty_wakeup(tty); | |
| 349 | − } | |
| 353 | + if (raw->tty && RAW3215_BUFFER_SIZE - raw->count >= RAW3215_MIN_SPACE) | |
| 354 | + tasklet_schedule(&raw->tlet); | |
| 350 | 355 | } |
| 351 | 356 | |
| 352 | 357 | /* |
| @@ -682,6 +687,7 @@ static int raw3215_probe (struct ccw_device *cdev) · 329 unmodified lines | ||
| 682 | 687 | return -ENOMEM; |
| 683 | 688 | } |
| 684 | 689 | init_waitqueue_head(&raw->empty_wait); |
| 690 | + tasklet_init(&raw->tlet, raw3215_wakeup, (unsigned long) raw); | |
| 685 | 691 | |
| 686 | 692 | dev_set_drvdata(&cdev->dev, raw); |
| 687 | 693 | cdev->handler = raw3215_irq; |
| @@ -901,6 +907,7 @@ static int __init con3215_init(void) · 213 unmodified lines | ||
| 901 | 907 | |
| 902 | 908 | raw->flags |= RAW3215_FIXED; |
| 903 | 909 | init_waitqueue_head(&raw->empty_wait); |
| 910 | + tasklet_init(&raw->tlet, raw3215_wakeup, (unsigned long) raw); | |
| 904 | 911 | |
| 905 | 912 | /* Request the console irq */ |
| 906 | 913 | if (raw3215_startup(raw) != 0) { |
| @@ -966,6 +973,7 @@ static void tty3215_close(struct tty_struct *tty, struct file * filp) · 59 unmodified lines | ||
| 966 | 973 | tty->closing = 1; |
| 967 | 974 | /* Shutdown the terminal */ |
| 968 | 975 | raw3215_shutdown(raw); |
| 976 | + tasklet_kill(&raw->tlet); | |
| 969 | 977 | tty->closing = 0; |
| 970 | 978 | raw->tty = NULL; |
| 971 | 979 | } |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #include <linux/console.h> |
| 12 | 12 | #include <linux/init.h> |
| 13 | 13 | #include <linux/interrupt.h> |
| 14 | +#include <linux/compat.h> | |
| 14 | 15 | #include <linux/module.h> |
| 15 | 16 | #include <linux/list.h> |
| 16 | 17 | #include <linux/slab.h> |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | #include <linux/fs.h> |
| 15 | 15 | #include <linux/init.h> |
| 16 | +#include <linux/compat.h> | |
| 16 | 17 | #include <linux/kernel.h> |
| 17 | 18 | #include <linux/miscdevice.h> |
| 18 | 19 | #include <linux/slab.h> |
| @@ -8,6 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | #include <linux/slab.h> |
| 11 | +#include <linux/compat.h> | |
| 11 | 12 | #include <linux/device.h> |
| 12 | 13 | #include <linux/module.h> |
| 13 | 14 | #include <linux/uaccess.h> |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | #define KMSG_COMPONENT "zfcp" |
| 12 | 12 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
| 13 | 13 | |
| 14 | +#include <linux/compat.h> | |
| 14 | 15 | #include <linux/slab.h> |
| 15 | 16 | #include <linux/types.h> |
| 16 | 17 | #include <linux/miscdevice.h> |
| @@ -364,10 +364,7 @@ static void release_controller(struct kref *kref) · 363 unmodified lines | ||
| 364 | 364 | struct rdac_controller *ctlr; |
| 365 | 365 | ctlr = container_of(kref, struct rdac_controller, kref); |
| 366 | 366 | |
| 367 | − flush_workqueue(kmpath_rdacd); | |
| 368 | − spin_lock(&list_lock); | |
| 369 | 367 | list_del(&ctlr->node); |
| 370 | − spin_unlock(&list_lock); | |
| 371 | 368 | kfree(ctlr); |
| 372 | 369 | } |
| 373 | 370 | |
| @@ -376,20 +373,17 @@ static struct rdac_controller *get_controller(int index, char *array_name, · 2 unmodified lines | ||
| 376 | 373 | { |
| 377 | 374 | struct rdac_controller *ctlr, *tmp; |
| 378 | 375 | |
| 379 | − spin_lock(&list_lock); | |
| 380 | − | |
| 381 | 376 | list_for_each_entry(tmp, &ctlr_list, node) { |
| 382 | 377 | if ((memcmp(tmp->array_id, array_id, UNIQUE_ID_LEN) == 0) && |
| 383 | 378 | (tmp->index == index) && |
| 384 | 379 | (tmp->host == sdev->host)) { |
| 385 | 380 | kref_get(&tmp->kref); |
| 386 | − spin_unlock(&list_lock); | |
| 387 | 381 | return tmp; |
| 388 | 382 | } |
| 389 | 383 | } |
| 390 | 384 | ctlr = kmalloc(sizeof(*ctlr), GFP_ATOMIC); |
| 391 | 385 | if (!ctlr) |
| 392 | − goto done; | |
| 386 | + return NULL; | |
| 393 | 387 | |
| 394 | 388 | /* initialize fields of controller */ |
| 395 | 389 | memcpy(ctlr->array_id, array_id, UNIQUE_ID_LEN); |
| @@ -405,8 +399,7 @@ static struct rdac_controller *get_controller(int index, char *array_name, · 9 unmodified lines | ||
| 405 | 399 | INIT_WORK(&ctlr->ms_work, send_mode_select); |
| 406 | 400 | INIT_LIST_HEAD(&ctlr->ms_head); |
| 407 | 401 | list_add(&ctlr->node, &ctlr_list); |
| 408 | −done: | |
| 409 | − spin_unlock(&list_lock); | |
| 402 | + | |
| 410 | 403 | return ctlr; |
| 411 | 404 | } |
| 412 | 405 | |
| @@ -517,9 +510,12 @@ static int initialize_controller(struct scsi_device *sdev, · 104 unmodified lines | ||
| 517 | 510 | index = 0; |
| 518 | 511 | else |
| 519 | 512 | index = 1; |
| 513 | + | |
| 514 | + spin_lock(&list_lock); | |
| 520 | 515 | h->ctlr = get_controller(index, array_name, array_id, sdev); |
| 521 | 516 | if (!h->ctlr) |
| 522 | 517 | err = SCSI_DH_RES_TEMP_UNAVAIL; |
| 518 | + spin_unlock(&list_lock); | |
| 523 | 519 | } |
| 524 | 520 | return err; |
| 525 | 521 | } |
| @@ -906,7 +902,9 @@ static int rdac_bus_attach(struct scsi_device *sdev) · 380 unmodified lines | ||
| 906 | 902 | return 0; |
| 907 | 903 | |
| 908 | 904 | clean_ctlr: |
| 905 | + spin_lock(&list_lock); | |
| 909 | 906 | kref_put(&h->ctlr->kref, release_controller); |
| 907 | + spin_unlock(&list_lock); | |
| 910 | 908 | |
| 911 | 909 | failed: |
| 912 | 910 | kfree(scsi_dh_data); |
| @@ -921,14 +919,19 @@ static void rdac_bus_detach( struct scsi_device *sdev ) · 8 unmodified lines | ||
| 921 | 919 | struct rdac_dh_data *h; |
| 922 | 920 | unsigned long flags; |
| 923 | 921 | |
| 924 | − spin_lock_irqsave(sdev->request_queue->queue_lock, flags); | |
| 925 | 922 | scsi_dh_data = sdev->scsi_dh_data; |
| 923 | + h = (struct rdac_dh_data *) scsi_dh_data->buf; | |
| 924 | + if (h->ctlr && h->ctlr->ms_queued) | |
| 925 | + flush_workqueue(kmpath_rdacd); | |
| 926 | + | |
| 927 | + spin_lock_irqsave(sdev->request_queue->queue_lock, flags); | |
| 926 | 928 | sdev->scsi_dh_data = NULL; |
| 927 | 929 | spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); |
| 928 | 930 | |
| 929 | − h = (struct rdac_dh_data *) scsi_dh_data->buf; | |
| 931 | + spin_lock(&list_lock); | |
| 930 | 932 | if (h->ctlr) |
| 931 | 933 | kref_put(&h->ctlr->kref, release_controller); |
| 934 | + spin_unlock(&list_lock); | |
| 932 | 935 | kfree(scsi_dh_data); |
| 933 | 936 | module_put(THIS_MODULE); |
| 934 | 937 | sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", RDAC_NAME); |
| @@ -4613,11 +4613,13 @@ static int __ipr_eh_host_reset(struct scsi_cmnd * scsi_cmd) · 4612 unmodified lines | ||
| 4613 | 4613 | ENTER; |
| 4614 | 4614 | ioa_cfg = (struct ipr_ioa_cfg *) scsi_cmd->device->host->hostdata; |
| 4615 | 4615 | |
| 4616 | − dev_err(&ioa_cfg->pdev->dev, | |
| 4617 | − "Adapter being reset as a result of error recovery.\n"); | |
| 4616 | + if (!ioa_cfg->in_reset_reload) { | |
| 4617 | + dev_err(&ioa_cfg->pdev->dev, | |
| 4618 | + "Adapter being reset as a result of error recovery.\n"); | |
| 4618 | 4619 | |
| 4619 | − if (WAIT_FOR_DUMP == ioa_cfg->sdt_state) | |
| 4620 | − ioa_cfg->sdt_state = GET_DUMP; | |
| 4620 | + if (WAIT_FOR_DUMP == ioa_cfg->sdt_state) | |
| 4621 | + ioa_cfg->sdt_state = GET_DUMP; | |
| 4622 | + } | |
| 4621 | 4623 | |
| 4622 | 4624 | rc = ipr_reset_reload(ioa_cfg, IPR_SHUTDOWN_ABBREV); |
| 4623 | 4625 | |
| @@ -4907,7 +4909,7 @@ static int ipr_cancel_op(struct scsi_cmnd * scsi_cmd) · 283 unmodified lines | ||
| 4907 | 4909 | struct ipr_ioa_cfg *ioa_cfg; |
| 4908 | 4910 | struct ipr_resource_entry *res; |
| 4909 | 4911 | struct ipr_cmd_pkt *cmd_pkt; |
| 4910 | − u32 ioasc; | |
| 4912 | + u32 ioasc, int_reg; | |
| 4911 | 4913 | int op_found = 0; |
| 4912 | 4914 | |
| 4913 | 4915 | ENTER; |
| @@ -4920,7 +4922,17 @@ static int ipr_cancel_op(struct scsi_cmnd * scsi_cmd) · 6 unmodified lines | ||
| 4920 | 4922 | */ |
| 4921 | 4923 | if (ioa_cfg->in_reset_reload || ioa_cfg->ioa_is_dead) |
| 4922 | 4924 | return FAILED; |
| 4923 | − if (!res || !ipr_is_gscsi(res)) | |
| 4925 | + if (!res) | |
| 4926 | + return FAILED; | |
| 4927 | + | |
| 4928 | + /* | |
| 4929 | + * If we are aborting a timed out op, chances are that the timeout was caused | |
| 4930 | + * by a still not detected EEH error. In such cases, reading a register will | |
| 4931 | + * trigger the EEH recovery infrastructure. | |
| 4932 | + */ | |
| 4933 | + int_reg = readl(ioa_cfg->regs.sense_interrupt_reg); | |
| 4934 | + | |
| 4935 | + if (!ipr_is_gscsi(res)) | |
| 4924 | 4936 | return FAILED; |
| 4925 | 4937 | |
| 4926 | 4938 | list_for_each_entry(ipr_cmd, &ioa_cfg->pending_q, queue) { |
| @@ -1848,9 +1848,11 @@ static enum sci_status sci_oem_parameters_set(struct isci_host *ihost) · 1847 unmodified lines | ||
| 1848 | 1848 | if (state == SCIC_RESET || |
| 1849 | 1849 | state == SCIC_INITIALIZING || |
| 1850 | 1850 | state == SCIC_INITIALIZED) { |
| 1851 | + u8 oem_version = pci_info->orom ? pci_info->orom->hdr.version : | |
| 1852 | + ISCI_ROM_VER_1_0; | |
| 1851 | 1853 | |
| 1852 | 1854 | if (sci_oem_parameters_validate(&ihost->oem_parameters, |
| 1853 | − pci_info->orom->hdr.version)) | |
| 1855 | + oem_version)) | |
| 1854 | 1856 | return SCI_FAILURE_INVALID_PARAMETER_VALUE; |
| 1855 | 1857 | |
| 1856 | 1858 | return SCI_SUCCESS; |
| @@ -4548,7 +4548,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, · 4547 unmodified lines | ||
| 4548 | 4548 | printk(MPT2SAS_ERR_FMT "%s: pci error recovery reset\n", |
| 4549 | 4549 | ioc->name, __func__); |
| 4550 | 4550 | r = 0; |
| 4551 | − goto out; | |
| 4551 | + goto out_unlocked; | |
| 4552 | 4552 | } |
| 4553 | 4553 | |
| 4554 | 4554 | if (mpt2sas_fwfault_debug) |
| @@ -4604,6 +4604,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, · 49 unmodified lines | ||
| 4604 | 4604 | spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); |
| 4605 | 4605 | mutex_unlock(&ioc->reset_in_progress_mutex); |
| 4606 | 4606 | |
| 4607 | + out_unlocked: | |
| 4607 | 4608 | dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: exit\n", ioc->name, |
| 4608 | 4609 | __func__)); |
| 4609 | 4610 | return r; |
| @@ -1036,8 +1036,7 @@ qla2x00_link_state_show(struct device *dev, struct device_attribute *attr, · 1035 unmodified lines | ||
| 1036 | 1036 | vha->device_flags & DFLG_NO_CABLE) |
| 1037 | 1037 | len = snprintf(buf, PAGE_SIZE, "Link Down\n"); |
| 1038 | 1038 | else if (atomic_read(&vha->loop_state) != LOOP_READY || |
| 1039 | − test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | |
| 1040 | − test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) | |
| 1039 | + qla2x00_reset_active(vha)) | |
| 1041 | 1040 | len = snprintf(buf, PAGE_SIZE, "Unknown Link State\n"); |
| 1042 | 1041 | else { |
| 1043 | 1042 | len = snprintf(buf, PAGE_SIZE, "Link Up - "); |
| @@ -1359,8 +1358,7 @@ qla2x00_thermal_temp_show(struct device *dev, · 315 unmodified lines | ||
| 1359 | 1358 | return snprintf(buf, PAGE_SIZE, "\n"); |
| 1360 | 1359 | |
| 1361 | 1360 | temp = frac = 0; |
| 1362 | − if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | |
| 1363 | − test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) | |
| 1361 | + if (qla2x00_reset_active(vha)) | |
| 1364 | 1362 | ql_log(ql_log_warn, vha, 0x707b, |
| 1365 | 1363 | "ISP reset active.\n"); |
| 1366 | 1364 | else if (!vha->hw->flags.eeh_busy) |
| @@ -1379,8 +1377,7 @@ qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr, · 12 unmodified lines | ||
| 1379 | 1377 | int rval = QLA_FUNCTION_FAILED; |
| 1380 | 1378 | uint16_t state[5]; |
| 1381 | 1379 | |
| 1382 | − if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | |
| 1383 | − test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags)) | |
| 1380 | + if (qla2x00_reset_active(vha)) | |
| 1384 | 1381 | ql_log(ql_log_warn, vha, 0x707c, |
| 1385 | 1382 | "ISP reset active.\n"); |
| 1386 | 1383 | else if (!vha->hw->flags.eeh_busy) |
| @@ -1693,9 +1690,7 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) · 306 unmodified lines | ||
| 1693 | 1690 | if (IS_FWI2_CAPABLE(ha)) { |
| 1694 | 1691 | rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma); |
| 1695 | 1692 | } else if (atomic_read(&base_vha->loop_state) == LOOP_READY && |
| 1696 | − !test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) && | |
| 1697 | − !test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) && | |
| 1698 | − !ha->dpc_active) { | |
| 1693 | + !qla2x00_reset_active(vha) && !ha->dpc_active) { | |
| 1699 | 1694 | /* Must be in a 'READY' state for statistics retrieval. */ |
| 1700 | 1695 | rval = qla2x00_get_link_status(base_vha, base_vha->loop_id, |
| 1701 | 1696 | stats, stats_dma); |
| @@ -108,13 +108,6 @@ qla24xx_proc_fcp_prio_cfg_cmd(struct fc_bsg_job *bsg_job) · 107 unmodified lines | ||
| 108 | 108 | goto exit_fcp_prio_cfg; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | − if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | |
| 112 | − test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | |
| 113 | − test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | |
| 114 | − ret = -EBUSY; | |
| 115 | − goto exit_fcp_prio_cfg; | |
| 116 | − } | |
| 117 | − | |
| 118 | 111 | /* Get the sub command */ |
| 119 | 112 | oper = bsg_job->request->rqst_data.h_vendor.vendor_cmd[1]; |
| 120 | 113 | |
| @@ -646,13 +639,6 @@ qla2x00_process_loopback(struct fc_bsg_job *bsg_job) · 525 unmodified lines | ||
| 646 | 639 | dma_addr_t rsp_data_dma; |
| 647 | 640 | uint32_t rsp_data_len; |
| 648 | 641 | |
| 649 | − if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | |
| 650 | − test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | |
| 651 | − test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | |
| 652 | − ql_log(ql_log_warn, vha, 0x7018, "Abort active or needed.\n"); | |
| 653 | − return -EBUSY; | |
| 654 | − } | |
| 655 | − | |
| 656 | 642 | if (!vha->flags.online) { |
| 657 | 643 | ql_log(ql_log_warn, vha, 0x7019, "Host is not online.\n"); |
| 658 | 644 | return -EIO; |
| @@ -874,13 +860,6 @@ qla84xx_reset(struct fc_bsg_job *bsg_job) · 215 unmodified lines | ||
| 874 | 860 | int rval = 0; |
| 875 | 861 | uint32_t flag; |
| 876 | 862 | |
| 877 | − if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | |
| 878 | − test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | |
| 879 | − test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | |
| 880 | − ql_log(ql_log_warn, vha, 0x702e, "Abort active or needed.\n"); | |
| 881 | − return -EBUSY; | |
| 882 | − } | |
| 883 | − | |
| 884 | 863 | if (!IS_QLA84XX(ha)) { |
| 885 | 864 | ql_dbg(ql_dbg_user, vha, 0x702f, "Not 84xx, exiting.\n"); |
| 886 | 865 | return -EINVAL; |
| @@ -922,11 +901,6 @@ qla84xx_updatefw(struct fc_bsg_job *bsg_job) · 35 unmodified lines | ||
| 922 | 901 | uint32_t flag; |
| 923 | 902 | uint32_t fw_ver; |
| 924 | 903 | |
| 925 | − if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | |
| 926 | − test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | |
| 927 | − test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) | |
| 928 | − return -EBUSY; | |
| 929 | − | |
| 930 | 904 | if (!IS_QLA84XX(ha)) { |
| 931 | 905 | ql_dbg(ql_dbg_user, vha, 0x7032, |
| 932 | 906 | "Not 84xx, exiting.\n"); |
| @@ -1036,14 +1010,6 @@ qla84xx_mgmt_cmd(struct fc_bsg_job *bsg_job) · 103 unmodified lines | ||
| 1036 | 1010 | uint32_t data_len = 0; |
| 1037 | 1011 | uint32_t dma_direction = DMA_NONE; |
| 1038 | 1012 | |
| 1039 | − if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | |
| 1040 | − test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | |
| 1041 | − test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | |
| 1042 | − ql_log(ql_log_warn, vha, 0x7039, | |
| 1043 | − "Abort active or needed.\n"); | |
| 1044 | − return -EBUSY; | |
| 1045 | − } | |
| 1046 | − | |
| 1047 | 1013 | if (!IS_QLA84XX(ha)) { |
| 1048 | 1014 | ql_log(ql_log_warn, vha, 0x703a, |
| 1049 | 1015 | "Not 84xx, exiting.\n"); |
| @@ -1246,13 +1212,6 @@ qla24xx_iidma(struct fc_bsg_job *bsg_job) · 196 unmodified lines | ||
| 1246 | 1212 | |
| 1247 | 1213 | bsg_job->reply->reply_payload_rcv_len = 0; |
| 1248 | 1214 | |
| 1249 | − if (test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | |
| 1250 | − test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) || | |
| 1251 | − test_bit(ISP_ABORT_RETRY, &vha->dpc_flags)) { | |
| 1252 | − ql_log(ql_log_warn, vha, 0x7045, "abort active or needed.\n"); | |
| 1253 | − return -EBUSY; | |
| 1254 | − } | |
| 1255 | − | |
| 1256 | 1215 | if (!IS_IIDMA_CAPABLE(vha->hw)) { |
| 1257 | 1216 | ql_log(ql_log_info, vha, 0x7046, "iiDMA not supported.\n"); |
| 1258 | 1217 | return -EINVAL; |
| @@ -1668,6 +1627,15 @@ qla24xx_bsg_request(struct fc_bsg_job *bsg_job) · 409 unmodified lines | ||
| 1668 | 1627 | vha = shost_priv(host); |
| 1669 | 1628 | } |
| 1670 | 1629 | |
| 1630 | + if (qla2x00_reset_active(vha)) { | |
| 1631 | + ql_dbg(ql_dbg_user, vha, 0x709f, | |
| 1632 | + "BSG: ISP abort active/needed -- cmd=%d.\n", | |
| 1633 | + bsg_job->request->msgcode); | |
| 1634 | + bsg_job->reply->result = (DID_ERROR << 16); | |
| 1635 | + bsg_job->job_done(bsg_job); | |
| 1636 | + return -EBUSY; | |
| 1637 | + } | |
| 1638 | + | |
| 1671 | 1639 | ql_dbg(ql_dbg_user, vha, 0x7000, |
| 1672 | 1640 | "Entered %s msgcode=0x%x.\n", __func__, bsg_job->request->msgcode); |
| 1673 | 1641 | |
| @@ -19,7 +19,8 @@ · 18 unmodified lines | ||
| 19 | 19 | * | DPC Thread | 0x401c | | |
| 20 | 20 | * | Async Events | 0x5057 | 0x5052 | |
| 21 | 21 | * | Timer Routines | 0x6011 | 0x600e,0x600f | |
| 22 | − * | User Space Interactions | 0x709e | | | |
| 22 | + * | User Space Interactions | 0x709e | 0x7018,0x702e | | |
| 23 | + * | | | 0x7039,0x7045 | | |
| 23 | 24 | * | Task Management | 0x803c | 0x8025-0x8026 | |
| 24 | 25 | * | | | 0x800b,0x8039 | |
| 25 | 26 | * | AER/EEH | 0x900f | | |
| @@ -44,6 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | * ISP2100 HBAs. |
| 45 | 45 | */ |
| 46 | 46 | #define MAILBOX_REGISTER_COUNT_2100 8 |
| 47 | +#define MAILBOX_REGISTER_COUNT_2200 24 | |
| 47 | 48 | #define MAILBOX_REGISTER_COUNT 32 |
| 48 | 49 | |
| 49 | 50 | #define QLA2200A_RISC_ROM_VER 4 |
| @@ -131,3 +131,16 @@ qla2x00_hba_err_chk_enabled(srb_t *sp) · 130 unmodified lines | ||
| 131 | 131 | } |
| 132 | 132 | return 0; |
| 133 | 133 | } |
| 134 | + | |
| 135 | +static inline int | |
| 136 | +qla2x00_reset_active(scsi_qla_host_t *vha) | |
| 137 | +{ | |
| 138 | + scsi_qla_host_t *base_vha = pci_get_drvdata(vha->hw->pdev); | |
| 139 | + | |
| 140 | + /* Test appropriate base-vha and vha flags. */ | |
| 141 | + return test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags) || | |
| 142 | + test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) || | |
| 143 | + test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) || | |
| 144 | + test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) || | |
| 145 | + test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); | |
| 146 | +} | |
| @@ -2090,7 +2090,6 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, · 2089 unmodified lines | ||
| 2090 | 2090 | break; |
| 2091 | 2091 | case CT_IOCB_TYPE: |
| 2092 | 2092 | qla24xx_els_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE); |
| 2093 | − clear_bit(MBX_INTERRUPT, &vha->hw->mbx_cmd_flags); | |
| 2094 | 2093 | break; |
| 2095 | 2094 | case ELS_IOCB_TYPE: |
| 2096 | 2095 | qla24xx_els_ct_entry(vha, rsp->req, pkt, ELS_IOCB_TYPE); |
| @@ -342,6 +342,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) · 341 unmodified lines | ||
| 342 | 342 | |
| 343 | 343 | set_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); |
| 344 | 344 | clear_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); |
| 345 | + /* Allow next mbx cmd to come in. */ | |
| 346 | + complete(&ha->mbx_cmd_comp); | |
| 345 | 347 | if (ha->isp_ops->abort_isp(vha)) { |
| 346 | 348 | /* Failed. retry later. */ |
| 347 | 349 | set_bit(ISP_ABORT_NEEDED, |
| @@ -350,6 +352,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) · 2 unmodified lines | ||
| 350 | 352 | clear_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags); |
| 351 | 353 | ql_dbg(ql_dbg_mbx, base_vha, 0x101f, |
| 352 | 354 | "Finished abort_isp.\n"); |
| 355 | + goto mbx_done; | |
| 353 | 356 | } |
| 354 | 357 | } |
| 355 | 358 | } |
| @@ -358,6 +361,7 @@ premature_exit: · 2 unmodified lines | ||
| 358 | 361 | /* Allow next mbx cmd to come in. */ |
| 359 | 362 | complete(&ha->mbx_cmd_comp); |
| 360 | 363 | |
| 364 | +mbx_done: | |
| 361 | 365 | if (rval) { |
| 362 | 366 | ql_dbg(ql_dbg_mbx, base_vha, 0x1020, |
| 363 | 367 | "**** Failed mbx[0]=%x, mb[1]=%x, mb[2]=%x, cmd=%x ****.\n", |
| @@ -2581,7 +2585,8 @@ qla2x00_stop_firmware(scsi_qla_host_t *vha) · 2217 unmodified lines | ||
| 2581 | 2585 | ql_dbg(ql_dbg_mbx, vha, 0x10a1, "Entered %s.\n", __func__); |
| 2582 | 2586 | |
| 2583 | 2587 | mcp->mb[0] = MBC_STOP_FIRMWARE; |
| 2584 | − mcp->out_mb = MBX_0; | |
| 2588 | + mcp->mb[1] = 0; | |
| 2589 | + mcp->out_mb = MBX_1|MBX_0; | |
| 2585 | 2590 | mcp->in_mb = MBX_0; |
| 2586 | 2591 | mcp->tov = 5; |
| 2587 | 2592 | mcp->flags = 0; |
| @@ -1165,19 +1165,6 @@ qla82xx_pinit_from_rom(scsi_qla_host_t *vha) · 1164 unmodified lines | ||
| 1165 | 1165 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xfeffffff); |
| 1166 | 1166 | else |
| 1167 | 1167 | qla82xx_wr_32(ha, QLA82XX_ROMUSB_GLB_SW_RESET, 0xffffffff); |
| 1168 | − | |
| 1169 | − /* reset ms */ | |
| 1170 | − val = qla82xx_rd_32(ha, QLA82XX_CRB_QDR_NET + 0xe4); | |
| 1171 | − val |= (1 << 1); | |
| 1172 | − qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val); | |
| 1173 | − msleep(20); | |
| 1174 | − | |
| 1175 | − /* unreset ms */ | |
| 1176 | − val = qla82xx_rd_32(ha, QLA82XX_CRB_QDR_NET + 0xe4); | |
| 1177 | − val &= ~(1 << 1); | |
| 1178 | − qla82xx_wr_32(ha, QLA82XX_CRB_QDR_NET + 0xe4, val); | |
| 1179 | − msleep(20); | |
| 1180 | − | |
| 1181 | 1168 | qla82xx_rom_unlock(ha); |
| 1182 | 1169 | |
| 1183 | 1170 | /* Read the signature value from the flash. |
| @@ -3392,7 +3379,7 @@ void qla82xx_watchdog(scsi_qla_host_t *vha) · 2208 unmodified lines | ||
| 3392 | 3379 | QLA82XX_CRB_PEG_NET_3 + 0x3c), |
| 3393 | 3380 | qla82xx_rd_32(ha, |
| 3394 | 3381 | QLA82XX_CRB_PEG_NET_4 + 0x3c)); |
| 3395 | − if (LSW(MSB(halt_status)) == 0x67) | |
| 3382 | + if (((halt_status & 0x1fffff00) >> 8) == 0x67) | |
| 3396 | 3383 | ql_log(ql_log_warn, vha, 0xb052, |
| 3397 | 3384 | "Firmware aborted with " |
| 3398 | 3385 | "error code 0x00006700. Device is " |
| @@ -625,6 +625,12 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) · 624 unmodified lines | ||
| 625 | 625 | cmd->result = DID_NO_CONNECT << 16; |
| 626 | 626 | goto qc24_fail_command; |
| 627 | 627 | } |
| 628 | + | |
| 629 | + if (!fcport) { | |
| 630 | + cmd->result = DID_NO_CONNECT << 16; | |
| 631 | + goto qc24_fail_command; | |
| 632 | + } | |
| 633 | + | |
| 628 | 634 | if (atomic_read(&fcport->state) != FCS_ONLINE) { |
| 629 | 635 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD || |
| 630 | 636 | atomic_read(&base_vha->loop_state) == LOOP_DEAD) { |
| @@ -877,6 +883,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) · 246 unmodified lines | ||
| 877 | 883 | |
| 878 | 884 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| 879 | 885 | if (ha->isp_ops->abort_command(sp)) { |
| 886 | + ret = FAILED; | |
| 880 | 887 | ql_dbg(ql_dbg_taskm, vha, 0x8003, |
| 881 | 888 | "Abort command mbx failed cmd=%p.\n", cmd); |
| 882 | 889 | } else { |
| @@ -1124,7 +1131,6 @@ static int · 241 unmodified lines | ||
| 1124 | 1131 | qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) |
| 1125 | 1132 | { |
| 1126 | 1133 | scsi_qla_host_t *vha = shost_priv(cmd->device->host); |
| 1127 | − fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; | |
| 1128 | 1134 | struct qla_hw_data *ha = vha->hw; |
| 1129 | 1135 | int ret = FAILED; |
| 1130 | 1136 | unsigned int id, lun; |
| @@ -1133,15 +1139,6 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd) · 2 unmodified lines | ||
| 1133 | 1139 | id = cmd->device->id; |
| 1134 | 1140 | lun = cmd->device->lun; |
| 1135 | 1141 | |
| 1136 | − if (!fcport) { | |
| 1137 | − return ret; | |
| 1138 | − } | |
| 1139 | − | |
| 1140 | − ret = fc_block_scsi_eh(cmd); | |
| 1141 | − if (ret != 0) | |
| 1142 | − return ret; | |
| 1143 | − ret = FAILED; | |
| 1144 | − | |
| 1145 | 1142 | ql_log(ql_log_info, vha, 0x8018, |
| 1146 | 1143 | "ADAPTER RESET ISSUED nexus=%ld:%d:%d.\n", vha->host_no, id, lun); |
| 1147 | 1144 | |
| @@ -2047,7 +2044,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 899 unmodified lines | ||
| 2047 | 2044 | ha->nvram_data_off = ~0; |
| 2048 | 2045 | ha->isp_ops = &qla2100_isp_ops; |
| 2049 | 2046 | } else if (IS_QLA2200(ha)) { |
| 2050 | − ha->mbx_count = MAILBOX_REGISTER_COUNT; | |
| 2047 | + ha->mbx_count = MAILBOX_REGISTER_COUNT_2200; | |
| 2051 | 2048 | req_length = REQUEST_ENTRY_CNT_2200; |
| 2052 | 2049 | rsp_length = RESPONSE_ENTRY_CNT_2100; |
| 2053 | 2050 | ha->max_loop_id = SNS_LAST_LOOP_ID_2100; |
| @@ -7,7 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | /* |
| 8 | 8 | * Driver version |
| 9 | 9 | */ |
| 10 | −#define QLA2XXX_VERSION "8.03.07.12-k" | |
| 10 | +#define QLA2XXX_VERSION "8.03.07.13-k" | |
| 11 | 11 | |
| 12 | 12 | #define QLA_DRIVER_MAJOR_VER 8 |
| 13 | 13 | #define QLA_DRIVER_MINOR_VER 3 |
| @@ -10,6 +10,8 @@ · 9 unmodified lines | ||
| 10 | 10 | #include "ql4_def.h" |
| 11 | 11 | #include "ql4_glbl.h" |
| 12 | 12 | |
| 13 | +#include <asm-generic/io-64-nonatomic-lo-hi.h> | |
| 14 | + | |
| 13 | 15 | #define MASK(n) DMA_BIT_MASK(n) |
| 14 | 16 | #define MN_WIN(addr) (((addr & 0x1fc0000) >> 1) | ((addr >> 25) & 0x3ff)) |
| 15 | 17 | #define OCM_WIN(addr) (((addr & 0x1ff0000) >> 1) | ((addr >> 25) & 0x3ff)) |
| @@ -655,27 +657,6 @@ static int qla4_8xxx_pci_is_same_window(struct scsi_qla_host *ha, · 639 unmodified lines | ||
| 655 | 657 | return 0; |
| 656 | 658 | } |
| 657 | 659 | |
| 658 | −#ifndef readq | |
| 659 | −static inline __u64 readq(const volatile void __iomem *addr) | |
| 660 | −{ | |
| 661 | − const volatile u32 __iomem *p = addr; | |
| 662 | − u32 low, high; | |
| 663 | − | |
| 664 | − low = readl(p); | |
| 665 | − high = readl(p + 1); | |
| 666 | − | |
| 667 | − return low + ((u64)high << 32); | |
| 668 | −} | |
| 669 | −#endif | |
| 670 | − | |
| 671 | −#ifndef writeq | |
| 672 | −static inline void writeq(__u64 val, volatile void __iomem *addr) | |
| 673 | −{ | |
| 674 | − writel(val, addr); | |
| 675 | − writel(val >> 32, addr+4); | |
| 676 | −} | |
| 677 | −#endif | |
| 678 | − | |
| 679 | 660 | static int qla4_8xxx_pci_mem_read_direct(struct scsi_qla_host *ha, |
| 680 | 661 | u64 off, void *data, int size) |
| 681 | 662 | { |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | |
| 8 | 8 | #include <linux/pm_runtime.h> |
| 9 | 9 | #include <linux/export.h> |
| 10 | +#include <linux/async.h> | |
| 10 | 11 | |
| 11 | 12 | #include <scsi/scsi.h> |
| 12 | 13 | #include <scsi/scsi_device.h> |
| @@ -92,6 +93,19 @@ static int scsi_bus_resume_common(struct device *dev) · 79 unmodified lines | ||
| 92 | 93 | return err; |
| 93 | 94 | } |
| 94 | 95 | |
| 96 | +static int scsi_bus_prepare(struct device *dev) | |
| 97 | +{ | |
| 98 | + if (scsi_is_sdev_device(dev)) { | |
| 99 | + /* sd probing uses async_schedule. Wait until it finishes. */ | |
| 100 | + async_synchronize_full(); | |
| 101 | + | |
| 102 | + } else if (scsi_is_host_device(dev)) { | |
| 103 | + /* Wait until async scanning is finished */ | |
| 104 | + scsi_complete_async_scans(); | |
| 105 | + } | |
| 106 | + return 0; | |
| 107 | +} | |
| 108 | + | |
| 95 | 109 | static int scsi_bus_suspend(struct device *dev) |
| 96 | 110 | { |
| 97 | 111 | return scsi_bus_suspend_common(dev, PMSG_SUSPEND); |
| @@ -110,6 +124,7 @@ static int scsi_bus_poweroff(struct device *dev) · 12 unmodified lines | ||
| 110 | 124 | #else /* CONFIG_PM_SLEEP */ |
| 111 | 125 | |
| 112 | 126 | #define scsi_bus_resume_common NULL |
| 127 | +#define scsi_bus_prepare NULL | |
| 113 | 128 | #define scsi_bus_suspend NULL |
| 114 | 129 | #define scsi_bus_freeze NULL |
| 115 | 130 | #define scsi_bus_poweroff NULL |
| @@ -218,6 +233,7 @@ void scsi_autopm_put_host(struct Scsi_Host *shost) · 102 unmodified lines | ||
| 218 | 233 | #endif /* CONFIG_PM_RUNTIME */ |
| 219 | 234 | |
| 220 | 235 | const struct dev_pm_ops scsi_bus_pm_ops = { |
| 236 | + .prepare = scsi_bus_prepare, | |
| 221 | 237 | .suspend = scsi_bus_suspend, |
| 222 | 238 | .resume = scsi_bus_resume_common, |
| 223 | 239 | .freeze = scsi_bus_freeze, |
| @@ -109,6 +109,7 @@ extern void scsi_exit_procfs(void); · 108 unmodified lines | ||
| 109 | 109 | #endif /* CONFIG_PROC_FS */ |
| 110 | 110 | |
| 111 | 111 | /* scsi_scan.c */ |
| 112 | +extern int scsi_complete_async_scans(void); | |
| 112 | 113 | extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int, |
| 113 | 114 | unsigned int, unsigned int, int); |
| 114 | 115 | extern void scsi_forget_host(struct Scsi_Host *); |
| @@ -1815,6 +1815,7 @@ static void scsi_finish_async_scan(struct async_scan_data *data) · 1814 unmodified lines | ||
| 1815 | 1815 | } |
| 1816 | 1816 | spin_unlock(&async_scan_lock); |
| 1817 | 1817 | |
| 1818 | + scsi_autopm_put_host(shost); | |
| 1818 | 1819 | scsi_host_put(shost); |
| 1819 | 1820 | kfree(data); |
| 1820 | 1821 | } |
| @@ -1841,7 +1842,6 @@ static int do_scan_async(void *_data) · 20 unmodified lines | ||
| 1841 | 1842 | |
| 1842 | 1843 | do_scsi_scan_host(shost); |
| 1843 | 1844 | scsi_finish_async_scan(data); |
| 1844 | − scsi_autopm_put_host(shost); | |
| 1845 | 1845 | return 0; |
| 1846 | 1846 | } |
| 1847 | 1847 | |
| @@ -1869,7 +1869,7 @@ void scsi_scan_host(struct Scsi_Host *shost) · 21 unmodified lines | ||
| 1869 | 1869 | p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no); |
| 1870 | 1870 | if (IS_ERR(p)) |
| 1871 | 1871 | do_scan_async(data); |
| 1872 | − /* scsi_autopm_put_host(shost) is called in do_scan_async() */ | |
| 1872 | + /* scsi_autopm_put_host(shost) is called in scsi_finish_async_scan() */ | |
| 1873 | 1873 | } |
| 1874 | 1874 | EXPORT_SYMBOL(scsi_scan_host); |
| 1875 | 1875 | |
| @@ -190,7 +190,7 @@ static int __init sh_clk_init_parent(struct clk *clk) · 189 unmodified lines | ||
| 190 | 190 | return -EINVAL; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | − clk->parent = clk->parent_table[val]; | |
| 193 | + clk_reparent(clk, clk->parent_table[val]); | |
| 194 | 194 | if (!clk->parent) { |
| 195 | 195 | pr_err("sh_clk_init_parent: unable to set parent"); |
| 196 | 196 | return -EINVAL; |
| @@ -299,7 +299,7 @@ config SPI_S3C24XX_FIQ · 298 unmodified lines | ||
| 299 | 299 | |
| 300 | 300 | config SPI_S3C64XX |
| 301 | 301 | tristate "Samsung S3C64XX series type SPI" |
| 302 | − depends on (ARCH_S3C64XX || ARCH_S5P64X0) | |
| 302 | + depends on (ARCH_S3C64XX || ARCH_S5P64X0 || ARCH_EXYNOS) | |
| 303 | 303 | select S3C64XX_DMA if ARCH_S3C64XX |
| 304 | 304 | help |
| 305 | 305 | SPI driver for Samsung S3C64XX and newer SoCs. |
| @@ -1720,7 +1720,7 @@ static int pch_spi_resume(struct pci_dev *pdev) · 1719 unmodified lines | ||
| 1720 | 1720 | |
| 1721 | 1721 | #endif |
| 1722 | 1722 | |
| 1723 | −static struct pci_driver pch_spi_pcidev = { | |
| 1723 | +static struct pci_driver pch_spi_pcidev_driver = { | |
| 1724 | 1724 | .name = "pch_spi", |
| 1725 | 1725 | .id_table = pch_spi_pcidev_id, |
| 1726 | 1726 | .probe = pch_spi_probe, |
| @@ -1736,7 +1736,7 @@ static int __init pch_spi_init(void) · 9 unmodified lines | ||
| 1736 | 1736 | if (ret) |
| 1737 | 1737 | return ret; |
| 1738 | 1738 | |
| 1739 | − ret = pci_register_driver(&pch_spi_pcidev); | |
| 1739 | + ret = pci_register_driver(&pch_spi_pcidev_driver); | |
| 1740 | 1740 | if (ret) |
| 1741 | 1741 | return ret; |
| 1742 | 1742 | |
| @@ -1746,7 +1746,7 @@ module_init(pch_spi_init); · 3 unmodified lines | ||
| 1746 | 1746 | |
| 1747 | 1747 | static void __exit pch_spi_exit(void) |
| 1748 | 1748 | { |
| 1749 | − pci_unregister_driver(&pch_spi_pcidev); | |
| 1749 | + pci_unregister_driver(&pch_spi_pcidev_driver); | |
| 1750 | 1750 | platform_driver_unregister(&pch_spi_pd_driver); |
| 1751 | 1751 | } |
| 1752 | 1752 | module_exit(pch_spi_exit); |
| @@ -75,7 +75,7 @@ static u32 get_cfgspace_addr(struct ssb_pcicore *pc, · 74 unmodified lines | ||
| 75 | 75 | u32 tmp; |
| 76 | 76 | |
| 77 | 77 | /* We do only have one cardbus device behind the bridge. */ |
| 78 | − if (pc->cardbusmode && (dev >= 1)) | |
| 78 | + if (pc->cardbusmode && (dev > 1)) | |
| 79 | 79 | goto out; |
| 80 | 80 | |
| 81 | 81 | if (bus == 0) { |
| @@ -60,8 +60,6 @@ source "drivers/staging/rts5139/Kconfig" · 59 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | source "drivers/staging/frontier/Kconfig" |
| 62 | 62 | |
| 63 | −source "drivers/staging/pohmelfs/Kconfig" | |
| 64 | − | |
| 65 | 63 | source "drivers/staging/phison/Kconfig" |
| 66 | 64 | |
| 67 | 65 | source "drivers/staging/line6/Kconfig" |
| @@ -120,8 +118,6 @@ source "drivers/staging/cptm1217/Kconfig" · 52 unmodified lines | ||
| 120 | 118 | |
| 121 | 119 | source "drivers/staging/ste_rmi4/Kconfig" |
| 122 | 120 | |
| 123 | −source "drivers/staging/gma500/Kconfig" | |
| 124 | − | |
| 125 | 121 | source "drivers/staging/mei/Kconfig" |
| 126 | 122 | |
| 127 | 123 | source "drivers/staging/nvec/Kconfig" |
| @@ -22,7 +22,6 @@ obj-$(CONFIG_R8712U) += rtl8712/ · 21 unmodified lines | ||
| 22 | 22 | obj-$(CONFIG_RTS_PSTOR) += rts_pstor/ |
| 23 | 23 | obj-$(CONFIG_RTS5139) += rts5139/ |
| 24 | 24 | obj-$(CONFIG_TRANZPORT) += frontier/ |
| 25 | −obj-$(CONFIG_POHMELFS) += pohmelfs/ | |
| 26 | 25 | obj-$(CONFIG_IDE_PHISON) += phison/ |
| 27 | 26 | obj-$(CONFIG_LINE6_USB) += line6/ |
| 28 | 27 | obj-$(CONFIG_USB_SERIAL_QUATECH2) += serqt_usb2/ |
| @@ -52,7 +51,6 @@ obj-$(CONFIG_FT1000) += ft1000/ · 23 unmodified lines | ||
| 52 | 51 | obj-$(CONFIG_SPEAKUP) += speakup/ |
| 53 | 52 | obj-$(CONFIG_TOUCHSCREEN_CLEARPAD_TM1217) += cptm1217/ |
| 54 | 53 | obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/ |
| 55 | −obj-$(CONFIG_DRM_PSB) += gma500/ | |
| 56 | 54 | obj-$(CONFIG_INTEL_MEI) += mei/ |
| 57 | 55 | obj-$(CONFIG_MFD_NVEC) += nvec/ |
| 58 | 56 | obj-$(CONFIG_DRM_OMAP) += omapdrm/ |
| @@ -27,6 +27,7 @@ config ANDROID_LOGGER · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | config ANDROID_RAM_CONSOLE |
| 29 | 29 | bool "Android RAM buffer console" |
| 30 | + depends on !S390 && !UML | |
| 30 | 31 | default n |
| 31 | 32 | |
| 32 | 33 | config ANDROID_RAM_CONSOLE_ENABLE_VERBOSE |
| @@ -99,10 +100,6 @@ config ANDROID_LOW_MEMORY_KILLER · 66 unmodified lines | ||
| 99 | 100 | ---help--- |
| 100 | 101 | Register processes to be killed when memory is low |
| 101 | 102 | |
| 102 | −config ANDROID_PMEM | |
| 103 | − bool "Android pmem allocator" | |
| 104 | − depends on ARM | |
| 105 | − | |
| 106 | 103 | source "drivers/staging/android/switch/Kconfig" |
| 107 | 104 | |
| 108 | 105 | endif # if ANDROID |
| @@ -5,5 +5,4 @@ obj-$(CONFIG_ANDROID_RAM_CONSOLE) += ram_console.o · 4 unmodified lines | ||
| 5 | 5 | obj-$(CONFIG_ANDROID_TIMED_OUTPUT) += timed_output.o |
| 6 | 6 | obj-$(CONFIG_ANDROID_TIMED_GPIO) += timed_gpio.o |
| 7 | 7 | obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o |
| 8 | −obj-$(CONFIG_ANDROID_PMEM) += pmem.o | |
| 9 | 8 | obj-$(CONFIG_ANDROID_SWITCH) += switch/ |
| @@ -1,93 +0,0 @@ | ||
| 1 | −/* include/linux/android_pmem.h | |
| 2 | − * | |
| 3 | − * Copyright (C) 2007 Google, Inc. | |
| 4 | − * | |
| 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 | |
| 7 | − * may be copied, distributed, and modified under those terms. | |
| 8 | − * | |
| 9 | − * This program is distributed in the hope that it will be useful, | |
| 10 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 | − * GNU General Public License for more details. | |
| 13 | − * | |
| 14 | − */ | |
| 15 | − | |
| 16 | −#ifndef _ANDROID_PMEM_H_ | |
| 17 | −#define _ANDROID_PMEM_H_ | |
| 18 | − | |
| 19 | −#define PMEM_IOCTL_MAGIC 'p' | |
| 20 | −#define PMEM_GET_PHYS _IOW(PMEM_IOCTL_MAGIC, 1, unsigned int) | |
| 21 | −#define PMEM_MAP _IOW(PMEM_IOCTL_MAGIC, 2, unsigned int) | |
| 22 | −#define PMEM_GET_SIZE _IOW(PMEM_IOCTL_MAGIC, 3, unsigned int) | |
| 23 | −#define PMEM_UNMAP _IOW(PMEM_IOCTL_MAGIC, 4, unsigned int) | |
| 24 | −/* This ioctl will allocate pmem space, backing the file, it will fail | |
| 25 | − * if the file already has an allocation, pass it the len as the argument | |
| 26 | − * to the ioctl */ | |
| 27 | −#define PMEM_ALLOCATE _IOW(PMEM_IOCTL_MAGIC, 5, unsigned int) | |
| 28 | −/* This will connect a one pmem file to another, pass the file that is already | |
| 29 | − * backed in memory as the argument to the ioctl | |
| 30 | − */ | |
| 31 | −#define PMEM_CONNECT _IOW(PMEM_IOCTL_MAGIC, 6, unsigned int) | |
| 32 | −/* Returns the total size of the pmem region it is sent to as a pmem_region | |
| 33 | − * struct (with offset set to 0). | |
| 34 | − */ | |
| 35 | −#define PMEM_GET_TOTAL_SIZE _IOW(PMEM_IOCTL_MAGIC, 7, unsigned int) | |
| 36 | −#define PMEM_CACHE_FLUSH _IOW(PMEM_IOCTL_MAGIC, 8, unsigned int) | |
| 37 | − | |
| 38 | −struct android_pmem_platform_data | |
| 39 | −{ | |
| 40 | − const char* name; | |
| 41 | − /* starting physical address of memory region */ | |
| 42 | − unsigned long start; | |
| 43 | − /* size of memory region */ | |
| 44 | − unsigned long size; | |
| 45 | − /* set to indicate the region should not be managed with an allocator */ | |
| 46 | − unsigned no_allocator; | |
| 47 | − /* set to indicate maps of this region should be cached, if a mix of | |
| 48 | − * cached and uncached is desired, set this and open the device with | |
| 49 | − * O_SYNC to get an uncached region */ | |
| 50 | − unsigned cached; | |
| 51 | − /* The MSM7k has bits to enable a write buffer in the bus controller*/ | |
| 52 | − unsigned buffered; | |
| 53 | −}; | |
| 54 | − | |
| 55 | −struct pmem_region { | |
| 56 | − unsigned long offset; | |
| 57 | − unsigned long len; | |
| 58 | −}; | |
| 59 | − | |
| 60 | −#ifdef CONFIG_ANDROID_PMEM | |
| 61 | −int is_pmem_file(struct file *file); | |
| 62 | −int get_pmem_file(int fd, unsigned long *start, unsigned long *vstart, | |
| 63 | − unsigned long *end, struct file **filp); | |
| 64 | −int get_pmem_user_addr(struct file *file, unsigned long *start, | |
| 65 | − unsigned long *end); | |
| 66 | −void put_pmem_file(struct file* file); | |
| 67 | −void flush_pmem_file(struct file *file, unsigned long start, unsigned long len); | |
| 68 | −int pmem_setup(struct android_pmem_platform_data *pdata, | |
| 69 | − long (*ioctl)(struct file *, unsigned int, unsigned long), | |
| 70 | − int (*release)(struct inode *, struct file *)); | |
| 71 | −int pmem_remap(struct pmem_region *region, struct file *file, | |
| 72 | − unsigned operation); | |
| 73 | − | |
| 74 | −#else | |
| 75 | −static inline int is_pmem_file(struct file *file) { return 0; } | |
| 76 | −static inline int get_pmem_file(int fd, unsigned long *start, | |
| 77 | − unsigned long *vstart, unsigned long *end, | |
| 78 | − struct file **filp) { return -ENOSYS; } | |
| 79 | −static inline int get_pmem_user_addr(struct file *file, unsigned long *start, | |
| 80 | − unsigned long *end) { return -ENOSYS; } | |
| 81 | −static inline void put_pmem_file(struct file* file) { return; } | |
| 82 | −static inline void flush_pmem_file(struct file *file, unsigned long start, | |
| 83 | − unsigned long len) { return; } | |
| 84 | −static inline int pmem_setup(struct android_pmem_platform_data *pdata, | |
| 85 | − long (*ioctl)(struct file *, unsigned int, unsigned long), | |
| 86 | − int (*release)(struct inode *, struct file *)) { return -ENOSYS; } | |
| 87 | − | |
| 88 | −static inline int pmem_remap(struct pmem_region *region, struct file *file, | |
| 89 | − unsigned operation) { return -ENOSYS; } | |
| 90 | −#endif | |
| 91 | − | |
| 92 | −#endif //_ANDROID_PPP_H_ | |
| 93 | − | |
| @@ -38,6 +38,7 @@ · 37 unmodified lines | ||
| 38 | 38 | |
| 39 | 39 | static DEFINE_MUTEX(binder_lock); |
| 40 | 40 | static DEFINE_MUTEX(binder_deferred_lock); |
| 41 | +static DEFINE_MUTEX(binder_mmap_lock); | |
| 41 | 42 | |
| 42 | 43 | static HLIST_HEAD(binder_procs); |
| 43 | 44 | static HLIST_HEAD(binder_deferred_list); |
| @@ -632,6 +633,11 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate, · 588 unmodified lines | ||
| 632 | 633 | if (mm) { |
| 633 | 634 | down_write(&mm->mmap_sem); |
| 634 | 635 | vma = proc->vma; |
| 636 | + if (vma && mm != vma->vm_mm) { | |
| 637 | + pr_err("binder: %d: vma mm and task mm mismatch\n", | |
| 638 | + proc->pid); | |
| 639 | + vma = NULL; | |
| 640 | + } | |
| 635 | 641 | } |
| 636 | 642 | |
| 637 | 643 | if (allocate == 0) |
| @@ -2759,7 +2765,6 @@ static void binder_vma_open(struct vm_area_struct *vma) · 2121 unmodified lines | ||
| 2759 | 2765 | proc->pid, vma->vm_start, vma->vm_end, |
| 2760 | 2766 | (vma->vm_end - vma->vm_start) / SZ_1K, vma->vm_flags, |
| 2761 | 2767 | (unsigned long)pgprot_val(vma->vm_page_prot)); |
| 2762 | − dump_stack(); | |
| 2763 | 2768 | } |
| 2764 | 2769 | |
| 2765 | 2770 | static void binder_vma_close(struct vm_area_struct *vma) |
| @@ -2803,6 +2808,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) · 37 unmodified lines | ||
| 2803 | 2808 | } |
| 2804 | 2809 | vma->vm_flags = (vma->vm_flags | VM_DONTCOPY) & ~VM_MAYWRITE; |
| 2805 | 2810 | |
| 2811 | + mutex_lock(&binder_mmap_lock); | |
| 2806 | 2812 | if (proc->buffer) { |
| 2807 | 2813 | ret = -EBUSY; |
| 2808 | 2814 | failure_string = "already mapped"; |
| @@ -2817,6 +2823,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) · 8 unmodified lines | ||
| 2817 | 2823 | } |
| 2818 | 2824 | proc->buffer = area->addr; |
| 2819 | 2825 | proc->user_buffer_offset = vma->vm_start - (uintptr_t)proc->buffer; |
| 2826 | + mutex_unlock(&binder_mmap_lock); | |
| 2820 | 2827 | |
| 2821 | 2828 | #ifdef CONFIG_CPU_CACHE_VIPT |
| 2822 | 2829 | if (cache_is_vipt_aliasing()) { |
| @@ -2849,7 +2856,7 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) · 26 unmodified lines | ||
| 2849 | 2856 | binder_insert_free_buffer(proc, buffer); |
| 2850 | 2857 | proc->free_async_space = proc->buffer_size / 2; |
| 2851 | 2858 | barrier(); |
| 2852 | − proc->files = get_files_struct(current); | |
| 2859 | + proc->files = get_files_struct(proc->tsk); | |
| 2853 | 2860 | proc->vma = vma; |
| 2854 | 2861 | |
| 2855 | 2862 | /*printk(KERN_INFO "binder_mmap: %d %lx-%lx maps %p\n", |
| @@ -2860,10 +2867,12 @@ err_alloc_small_buf_failed: · 4 unmodified lines | ||
| 2860 | 2867 | kfree(proc->pages); |
| 2861 | 2868 | proc->pages = NULL; |
| 2862 | 2869 | err_alloc_pages_failed: |
| 2870 | + mutex_lock(&binder_mmap_lock); | |
| 2863 | 2871 | vfree(proc->buffer); |
| 2864 | 2872 | proc->buffer = NULL; |
| 2865 | 2873 | err_get_vm_area_failed: |
| 2866 | 2874 | err_already_mapped: |
| 2875 | + mutex_unlock(&binder_mmap_lock); | |
| 2867 | 2876 | err_bad_arg: |
| 2868 | 2877 | printk(KERN_ERR "binder_mmap: %d %lx-%lx %s failed %d\n", |
| 2869 | 2878 | proc->pid, vma->vm_start, vma->vm_end, failure_string, ret); |
| @@ -54,6 +54,7 @@ static size_t lowmem_minfree[6] = { · 53 unmodified lines | ||
| 54 | 54 | static int lowmem_minfree_size = 4; |
| 55 | 55 | |
| 56 | 56 | static struct task_struct *lowmem_deathpending; |
| 57 | +static unsigned long lowmem_deathpending_timeout; | |
| 57 | 58 | |
| 58 | 59 | #define lowmem_print(level, x...) \ |
| 59 | 60 | do { \ |
| @@ -103,7 +104,8 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) · 43 unmodified lines | ||
| 103 | 104 | * Note: Currently you need CONFIG_PROFILING |
| 104 | 105 | * for this to work correctly. |
| 105 | 106 | */ |
| 106 | − if (lowmem_deathpending) | |
| 107 | + if (lowmem_deathpending && | |
| 108 | + time_before_eq(jiffies, lowmem_deathpending_timeout)) | |
| 107 | 109 | return 0; |
| 108 | 110 | |
| 109 | 111 | if (lowmem_adj_size < array_size) |
| @@ -178,6 +180,7 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) · 68 unmodified lines | ||
| 178 | 180 | */ |
| 179 | 181 | #ifdef CONFIG_PROFILING |
| 180 | 182 | lowmem_deathpending = selected; |
| 183 | + lowmem_deathpending_timeout = jiffies + HZ; | |
| 181 | 184 | task_handoff_register(&task_nb); |
| 182 | 185 | #endif |
| 183 | 186 | force_sig(SIGKILL, selected); |
| @@ -1,1345 +0,0 @@ | ||
| 1 | −/* pmem.c | |
| 2 | − * | |
| 3 | − * Copyright (C) 2007 Google, Inc. | |
| 4 | − * | |
| 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 | |
| 7 | − * may be copied, distributed, and modified under those terms. | |
| 8 | − * | |
| 9 | − * This program is distributed in the hope that it will be useful, | |
| 10 | − * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 | − * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 | − * GNU General Public License for more details. | |
| 13 | − * | |
| 14 | − */ | |
| 15 | − | |
| 16 | −#include <linux/miscdevice.h> | |
| 17 | −#include <linux/platform_device.h> | |
| 18 | −#include <linux/fs.h> | |
| 19 | −#include <linux/file.h> | |
| 20 | −#include <linux/mm.h> | |
| 21 | −#include <linux/list.h> | |
| 22 | −#include <linux/mutex.h> | |
| 23 | −#include <linux/debugfs.h> | |
| 24 | −#include <linux/mempolicy.h> | |
| 25 | −#include <linux/sched.h> | |
| 26 | −#include <asm/io.h> | |
| 27 | −#include <asm/uaccess.h> | |
| 28 | −#include <asm/cacheflush.h> | |
| 29 | −#include "android_pmem.h" | |
| 30 | − | |
| 31 | −#define PMEM_MAX_DEVICES 10 | |
| 32 | −#define PMEM_MAX_ORDER 128 | |
| 33 | −#define PMEM_MIN_ALLOC PAGE_SIZE | |
| 34 | − | |
| 35 | −#define PMEM_DEBUG 1 | |
| 36 | − | |
| 37 | −/* indicates that a refernce to this file has been taken via get_pmem_file, | |
| 38 | − * the file should not be released until put_pmem_file is called */ | |
| 39 | −#define PMEM_FLAGS_BUSY 0x1 | |
| 40 | −/* indicates that this is a suballocation of a larger master range */ | |
| 41 | −#define PMEM_FLAGS_CONNECTED 0x1 << 1 | |
| 42 | −/* indicates this is a master and not a sub allocation and that it is mmaped */ | |
| 43 | −#define PMEM_FLAGS_MASTERMAP 0x1 << 2 | |
| 44 | −/* submap and unsubmap flags indicate: | |
| 45 | − * 00: subregion has never been mmaped | |
| 46 | − * 10: subregion has been mmaped, reference to the mm was taken | |
| 47 | − * 11: subretion has ben released, refernece to the mm still held | |
| 48 | − * 01: subretion has been released, reference to the mm has been released | |
| 49 | − */ | |
| 50 | −#define PMEM_FLAGS_SUBMAP 0x1 << 3 | |
| 51 | −#define PMEM_FLAGS_UNSUBMAP 0x1 << 4 | |
| 52 | − | |
| 53 | − | |
| 54 | −struct pmem_data { | |
| 55 | − /* in alloc mode: an index into the bitmap | |
| 56 | − * in no_alloc mode: the size of the allocation */ | |
| 57 | − int index; | |
| 58 | − /* see flags above for descriptions */ | |
| 59 | − unsigned int flags; | |
| 60 | − /* protects this data field, if the mm_mmap sem will be held at the | |
| 61 | − * same time as this sem, the mm sem must be taken first (as this is | |
| 62 | − * the order for vma_open and vma_close ops */ | |
| 63 | − struct rw_semaphore sem; | |
| 64 | − /* info about the mmaping process */ | |
| 65 | − struct vm_area_struct *vma; | |
| 66 | − /* task struct of the mapping process */ | |
| 67 | − struct task_struct *task; | |
| 68 | − /* process id of teh mapping process */ | |
| 69 | − pid_t pid; | |
| 70 | − /* file descriptor of the master */ | |
| 71 | − int master_fd; | |
| 72 | − /* file struct of the master */ | |
| 73 | − struct file *master_file; | |
| 74 | − /* a list of currently available regions if this is a suballocation */ | |
| 75 | − struct list_head region_list; | |
| 76 | − /* a linked list of data so we can access them for debugging */ | |
| 77 | − struct list_head list; | |
| 78 | −#if PMEM_DEBUG | |
| 79 | − int ref; | |
| 80 | −#endif | |
| 81 | −}; | |
| 82 | − | |
| 83 | −struct pmem_bits { | |
| 84 | − unsigned allocated:1; /* 1 if allocated, 0 if free */ | |
| 85 | − unsigned order:7; /* size of the region in pmem space */ | |
| 86 | −}; | |
| 87 | − | |
| 88 | −struct pmem_region_node { | |
| 89 | − struct pmem_region region; | |
| 90 | − struct list_head list; | |
| 91 | −}; | |
| 92 | − | |
| 93 | −#define PMEM_DEBUG_MSGS 0 | |
| 94 | −#if PMEM_DEBUG_MSGS | |
| 95 | −#define DLOG(fmt,args...) \ | |
| 96 | − do { printk(KERN_INFO "[%s:%s:%d] "fmt, __FILE__, __func__, __LINE__, \ | |
| 97 | − ##args); } \ | |
| 98 | − while (0) | |
| 99 | −#else | |
| 100 | −#define DLOG(x...) do {} while (0) | |
| 101 | −#endif | |
| 102 | − | |
| 103 | −struct pmem_info { | |
| 104 | − struct miscdevice dev; | |
| 105 | − /* physical start address of the remaped pmem space */ | |
| 106 | − unsigned long base; | |
| 107 | − /* vitual start address of the remaped pmem space */ | |
| 108 | − unsigned char __iomem *vbase; | |
| 109 | − /* total size of the pmem space */ | |
| 110 | − unsigned long size; | |
| 111 | − /* number of entries in the pmem space */ | |
| 112 | − unsigned long num_entries; | |
| 113 | − /* pfn of the garbage page in memory */ | |
| 114 | − unsigned long garbage_pfn; | |
| 115 | − /* index of the garbage page in the pmem space */ | |
| 116 | − int garbage_index; | |
| 117 | − /* the bitmap for the region indicating which entries are allocated | |
| 118 | − * and which are free */ | |
| 119 | − struct pmem_bits *bitmap; | |
| 120 | − /* indicates the region should not be managed with an allocator */ | |
| 121 | − unsigned no_allocator; | |
| 122 | − /* indicates maps of this region should be cached, if a mix of | |
| 123 | − * cached and uncached is desired, set this and open the device with | |
| 124 | − * O_SYNC to get an uncached region */ | |
| 125 | − unsigned cached; | |
| 126 | − unsigned buffered; | |
| 127 | − /* in no_allocator mode the first mapper gets the whole space and sets | |
| 128 | − * this flag */ | |
| 129 | − unsigned allocated; | |
| 130 | − /* for debugging, creates a list of pmem file structs, the | |
| 131 | − * data_list_lock should be taken before pmem_data->sem if both are | |
| 132 | − * needed */ | |
| 133 | − struct mutex data_list_lock; | |
| 134 | − struct list_head data_list; | |
| 135 | − /* pmem_sem protects the bitmap array | |
| 136 | − * a write lock should be held when modifying entries in bitmap | |
| 137 | − * a read lock should be held when reading data from bits or | |
| 138 | − * dereferencing a pointer into bitmap | |
| 139 | − * | |
| 140 | − * pmem_data->sem protects the pmem data of a particular file | |
| 141 | − * Many of the function that require the pmem_data->sem have a non- | |
| 142 | − * locking version for when the caller is already holding that sem. | |
| 143 | − * | |
| 144 | − * IF YOU TAKE BOTH LOCKS TAKE THEM IN THIS ORDER: | |
| 145 | − * down(pmem_data->sem) => down(bitmap_sem) | |
| 146 | − */ | |
| 147 | − struct rw_semaphore bitmap_sem; | |
| 148 | − | |
| 149 | − long (*ioctl)(struct file *, unsigned int, unsigned long); | |
| 150 | − int (*release)(struct inode *, struct file *); | |
| 151 | −}; | |
| 152 | − | |
| 153 | −static struct pmem_info pmem[PMEM_MAX_DEVICES]; | |
| 154 | −static int id_count; | |
| 155 | − | |
| 156 | −#define PMEM_IS_FREE(id, index) !(pmem[id].bitmap[index].allocated) | |
| 157 | −#define PMEM_ORDER(id, index) pmem[id].bitmap[index].order | |
| 158 | −#define PMEM_BUDDY_INDEX(id, index) (index ^ (1 << PMEM_ORDER(id, index))) | |
| 159 | −#define PMEM_NEXT_INDEX(id, index) (index + (1 << PMEM_ORDER(id, index))) | |
| 160 | −#define PMEM_OFFSET(index) (index * PMEM_MIN_ALLOC) | |
| 161 | −#define PMEM_START_ADDR(id, index) (PMEM_OFFSET(index) + pmem[id].base) | |
| 162 | −#define PMEM_LEN(id, index) ((1 << PMEM_ORDER(id, index)) * PMEM_MIN_ALLOC) | |
| 163 | −#define PMEM_END_ADDR(id, index) (PMEM_START_ADDR(id, index) + \ | |
| 164 | − PMEM_LEN(id, index)) | |
| 165 | −#define PMEM_START_VADDR(id, index) (PMEM_OFFSET(id, index) + pmem[id].vbase) | |
| 166 | −#define PMEM_END_VADDR(id, index) (PMEM_START_VADDR(id, index) + \ | |
| 167 | − PMEM_LEN(id, index)) | |
| 168 | −#define PMEM_REVOKED(data) (data->flags & PMEM_FLAGS_REVOKED) | |
| 169 | −#define PMEM_IS_PAGE_ALIGNED(addr) (!((addr) & (~PAGE_MASK))) | |
| 170 | −#define PMEM_IS_SUBMAP(data) ((data->flags & PMEM_FLAGS_SUBMAP) && \ | |
| 171 | − (!(data->flags & PMEM_FLAGS_UNSUBMAP))) | |
| 172 | − | |
| 173 | −static int pmem_release(struct inode *, struct file *); | |
| 174 | −static int pmem_mmap(struct file *, struct vm_area_struct *); | |
| 175 | −static int pmem_open(struct inode *, struct file *); | |
| 176 | −static long pmem_ioctl(struct file *, unsigned int, unsigned long); | |
| 177 | − | |
| 178 | −struct file_operations pmem_fops = { | |
| 179 | − .release = pmem_release, | |
| 180 | − .mmap = pmem_mmap, | |
| 181 | − .open = pmem_open, | |
| 182 | − .unlocked_ioctl = pmem_ioctl, | |
| 183 | −}; | |
| 184 | − | |
| 185 | −static int get_id(struct file *file) | |
| 186 | −{ | |
| 187 | − return MINOR(file->f_dentry->d_inode->i_rdev); | |
| 188 | −} | |
| 189 | − | |
| 190 | −int is_pmem_file(struct file *file) | |
| 191 | −{ | |
| 192 | − int id; | |
| 193 | − | |
| 194 | − if (unlikely(!file || !file->f_dentry || !file->f_dentry->d_inode)) | |
| 195 | − return 0; | |
| 196 | − id = get_id(file); | |
| 197 | − if (unlikely(id >= PMEM_MAX_DEVICES)) | |
| 198 | − return 0; | |
| 199 | − if (unlikely(file->f_dentry->d_inode->i_rdev != | |
| 200 | − MKDEV(MISC_MAJOR, pmem[id].dev.minor))) | |
| 201 | − return 0; | |
| 202 | − return 1; | |
| 203 | −} | |
| 204 | − | |
| 205 | −static int has_allocation(struct file *file) | |
| 206 | −{ | |
| 207 | − struct pmem_data *data; | |
| 208 | − /* check is_pmem_file first if not accessed via pmem_file_ops */ | |
| 209 | − | |
| 210 | − if (unlikely(!file->private_data)) | |
| 211 | − return 0; | |
| 212 | − data = (struct pmem_data *)file->private_data; | |
| 213 | − if (unlikely(data->index < 0)) | |
| 214 | − return 0; | |
| 215 | − return 1; | |
| 216 | −} | |
| 217 | − | |
| 218 | −static int is_master_owner(struct file *file) | |
| 219 | −{ | |
| 220 | − struct file *master_file; | |
| 221 | − struct pmem_data *data; | |
| 222 | − int put_needed, ret = 0; | |
| 223 | − | |
| 224 | − if (!is_pmem_file(file) || !has_allocation(file)) | |
| 225 | − return 0; | |
| 226 | − data = (struct pmem_data *)file->private_data; | |
| 227 | − if (PMEM_FLAGS_MASTERMAP & data->flags) | |
| 228 | − return 1; | |
| 229 | − master_file = fget_light(data->master_fd, &put_needed); | |
| 230 | − if (master_file && data->master_file == master_file) | |
| 231 | − ret = 1; | |
| 232 | − fput_light(master_file, put_needed); | |
| 233 | − return ret; | |
| 234 | −} | |
| 235 | − | |
| 236 | −static int pmem_free(int id, int index) | |
| 237 | −{ | |
| 238 | − /* caller should hold the write lock on pmem_sem! */ | |
| 239 | − int buddy, curr = index; | |
| 240 | − DLOG("index %d\n", index); | |
| 241 | − | |
| 242 | − if (pmem[id].no_allocator) { | |
| 243 | − pmem[id].allocated = 0; | |
| 244 | − return 0; | |
| 245 | − } | |
| 246 | − /* clean up the bitmap, merging any buddies */ | |
| 247 | − pmem[id].bitmap[curr].allocated = 0; | |
| 248 | − /* find a slots buddy Buddy# = Slot# ^ (1 << order) | |
| 249 | − * if the buddy is also free merge them | |
| 250 | − * repeat until the buddy is not free or end of the bitmap is reached | |
| 251 | − */ | |
| 252 | − do { | |
| 253 | − buddy = PMEM_BUDDY_INDEX(id, curr); | |
| 254 | − if (PMEM_IS_FREE(id, buddy) && | |
| 255 | − PMEM_ORDER(id, buddy) == PMEM_ORDER(id, curr)) { | |
| 256 | − PMEM_ORDER(id, buddy)++; | |
| 257 | − PMEM_ORDER(id, curr)++; | |
| 258 | − curr = min(buddy, curr); | |
| 259 | − } else { | |
| 260 | − break; | |
| 261 | − } | |
| 262 | − } while (curr < pmem[id].num_entries); | |
| 263 | − | |
| 264 | − return 0; | |
| 265 | −} | |
| 266 | − | |
| 267 | −static void pmem_revoke(struct file *file, struct pmem_data *data); | |
| 268 | − | |
| 269 | −static int pmem_release(struct inode *inode, struct file *file) | |
| 270 | −{ | |
| 271 | − struct pmem_data *data = (struct pmem_data *)file->private_data; | |
| 272 | − struct pmem_region_node *region_node; | |
| 273 | − struct list_head *elt, *elt2; | |
| 274 | − int id = get_id(file), ret = 0; | |
| 275 | − | |
| 276 | − | |
| 277 | − mutex_lock(&pmem[id].data_list_lock); | |
| 278 | − /* if this file is a master, revoke all the memory in the connected | |
| 279 | − * files */ | |
| 280 | − if (PMEM_FLAGS_MASTERMAP & data->flags) { | |
| 281 | − struct pmem_data *sub_data; | |
| 282 | − list_for_each(elt, &pmem[id].data_list) { | |
| 283 | − sub_data = list_entry(elt, struct pmem_data, list); | |
| 284 | − down_read(&sub_data->sem); | |
| 285 | − if (PMEM_IS_SUBMAP(sub_data) && | |
| 286 | − file == sub_data->master_file) { | |
| 287 | − up_read(&sub_data->sem); | |
| 288 | − pmem_revoke(file, sub_data); | |
| 289 | − } else | |
| 290 | − up_read(&sub_data->sem); | |
| 291 | − } | |
| 292 | − } | |
| 293 | − list_del(&data->list); | |
| 294 | − mutex_unlock(&pmem[id].data_list_lock); | |
| 295 | − | |
| 296 | − | |
| 297 | − down_write(&data->sem); | |
| 298 | − | |
| 299 | − /* if its not a conencted file and it has an allocation, free it */ | |
| 300 | − if (!(PMEM_FLAGS_CONNECTED & data->flags) && has_allocation(file)) { | |
| 301 | − down_write(&pmem[id].bitmap_sem); | |
| 302 | − ret = pmem_free(id, data->index); | |
| 303 | − up_write(&pmem[id].bitmap_sem); | |
| 304 | − } | |
| 305 | − | |
| 306 | − /* if this file is a submap (mapped, connected file), downref the | |
| 307 | − * task struct */ | |
| 308 | − if (PMEM_FLAGS_SUBMAP & data->flags) | |
| 309 | − if (data->task) { | |
| 310 | − put_task_struct(data->task); | |
| 311 | − data->task = NULL; | |
| 312 | − } | |
| 313 | − | |
| 314 | − file->private_data = NULL; | |
| 315 | − | |
| 316 | − list_for_each_safe(elt, elt2, &data->region_list) { | |
| 317 | − region_node = list_entry(elt, struct pmem_region_node, list); | |
| 318 | − list_del(elt); | |
| 319 | − kfree(region_node); | |
| 320 | − } | |
| 321 | − BUG_ON(!list_empty(&data->region_list)); | |
| 322 | − | |
| 323 | − up_write(&data->sem); | |
| 324 | − kfree(data); | |
| 325 | − if (pmem[id].release) | |
| 326 | − ret = pmem[id].release(inode, file); | |
| 327 | − | |
| 328 | − return ret; | |
| 329 | −} | |
| 330 | − | |
| 331 | −static int pmem_open(struct inode *inode, struct file *file) | |
| 332 | −{ | |
| 333 | − struct pmem_data *data; | |
| 334 | − int id = get_id(file); | |
| 335 | − int ret = 0; | |
| 336 | − | |
| 337 | − DLOG("current %u file %p(%d)\n", current->pid, file, file_count(file)); | |
| 338 | − /* setup file->private_data to indicate its unmapped */ | |
| 339 | − /* you can only open a pmem device one time */ | |
| 340 | − if (file->private_data != NULL) | |
| 341 | − return -1; | |
| 342 | − data = kmalloc(sizeof(struct pmem_data), GFP_KERNEL); | |
| 343 | − if (!data) { | |
| 344 | − printk("pmem: unable to allocate memory for pmem metadata."); | |
| 345 | − return -1; | |
| 346 | − } | |
| 347 | − data->flags = 0; | |
| 348 | − data->index = -1; | |
| 349 | − data->task = NULL; | |
| 350 | − data->vma = NULL; | |
| 351 | − data->pid = 0; | |
| 352 | − data->master_file = NULL; | |
| 353 | −#if PMEM_DEBUG | |
| 354 | − data->ref = 0; | |
| 355 | −#endif | |
| 356 | − INIT_LIST_HEAD(&data->region_list); | |
| 357 | − init_rwsem(&data->sem); | |
| 358 | − | |
| 359 | − file->private_data = data; | |
| 360 | − INIT_LIST_HEAD(&data->list); | |
| 361 | − | |
| 362 | − mutex_lock(&pmem[id].data_list_lock); | |
| 363 | − list_add(&data->list, &pmem[id].data_list); | |
| 364 | − mutex_unlock(&pmem[id].data_list_lock); | |
| 365 | − return ret; | |
| 366 | −} | |
| 367 | − | |
| 368 | −static unsigned long pmem_order(unsigned long len) | |
| 369 | −{ | |
| 370 | − int i; | |
| 371 | − | |
| 372 | − len = (len + PMEM_MIN_ALLOC - 1)/PMEM_MIN_ALLOC; | |
| 373 | − len--; | |
| 374 | − for (i = 0; i < sizeof(len)*8; i++) | |
| 375 | − if (len >> i == 0) | |
| 376 | − break; | |
| 377 | − return i; | |
| 378 | −} | |
| 379 | − | |
| 380 | −static int pmem_allocate(int id, unsigned long len) | |
| 381 | −{ | |
| 382 | − /* caller should hold the write lock on pmem_sem! */ | |
| 383 | − /* return the corresponding pdata[] entry */ | |
| 384 | − int curr = 0; | |
| 385 | − int end = pmem[id].num_entries; | |
| 386 | − int best_fit = -1; | |
| 387 | − unsigned long order = pmem_order(len); | |
| 388 | − | |
| 389 | − if (pmem[id].no_allocator) { | |
| 390 | − DLOG("no allocator"); | |
| 391 | − if ((len > pmem[id].size) || pmem[id].allocated) | |
| 392 | − return -1; | |
| 393 | − pmem[id].allocated = 1; | |
| 394 | − return len; | |
| 395 | − } | |
| 396 | − | |
| 397 | − if (order > PMEM_MAX_ORDER) | |
| 398 | − return -1; | |
| 399 | − DLOG("order %lx\n", order); | |
| 400 | − | |
| 401 | − /* look through the bitmap: | |
| 402 | − * if you find a free slot of the correct order use it | |
| 403 | − * otherwise, use the best fit (smallest with size > order) slot | |
| 404 | − */ | |
| 405 | − while (curr < end) { | |
| 406 | − if (PMEM_IS_FREE(id, curr)) { | |
| 407 | − if (PMEM_ORDER(id, curr) == (unsigned char)order) { | |
| 408 | − /* set the not free bit and clear others */ | |
| 409 | − best_fit = curr; | |
| 410 | − break; | |
| 411 | − } | |
| 412 | − if (PMEM_ORDER(id, curr) > (unsigned char)order && | |
| 413 | − (best_fit < 0 || | |
| 414 | − PMEM_ORDER(id, curr) < PMEM_ORDER(id, best_fit))) | |
| 415 | − best_fit = curr; | |
| 416 | − } | |
| 417 | − curr = PMEM_NEXT_INDEX(id, curr); | |
| 418 | − } | |
| 419 | − | |
| 420 | − /* if best_fit < 0, there are no suitable slots, | |
| 421 | − * return an error | |
| 422 | − */ | |
| 423 | − if (best_fit < 0) { | |
| 424 | − printk("pmem: no space left to allocate!\n"); | |
| 425 | − return -1; | |
| 426 | − } | |
| 427 | − | |
| 428 | − /* now partition the best fit: | |
| 429 | − * split the slot into 2 buddies of order - 1 | |
| 430 | − * repeat until the slot is of the correct order | |
| 431 | − */ | |
| 432 | − while (PMEM_ORDER(id, best_fit) > (unsigned char)order) { | |
| 433 | − int buddy; | |
| 434 | − PMEM_ORDER(id, best_fit) -= 1; | |
| 435 | − buddy = PMEM_BUDDY_INDEX(id, best_fit); | |
| 436 | − PMEM_ORDER(id, buddy) = PMEM_ORDER(id, best_fit); | |
| 437 | − } | |
| 438 | − pmem[id].bitmap[best_fit].allocated = 1; | |
| 439 | − return best_fit; | |
| 440 | −} | |
| 441 | − | |
| 442 | −static pgprot_t pmem_access_prot(struct file *file, pgprot_t vma_prot) | |
| 443 | −{ | |
| 444 | − int id = get_id(file); | |
| 445 | −#ifdef pgprot_noncached | |
| 446 | − if (pmem[id].cached == 0 || file->f_flags & O_SYNC) | |
| 447 | − return pgprot_noncached(vma_prot); | |
| 448 | −#endif | |
| 449 | −#ifdef pgprot_ext_buffered | |
| 450 | − else if (pmem[id].buffered) | |
| 451 | − return pgprot_ext_buffered(vma_prot); | |
| 452 | −#endif | |
| 453 | − return vma_prot; | |
| 454 | −} | |
| 455 | − | |
| 456 | −static unsigned long pmem_start_addr(int id, struct pmem_data *data) | |
| 457 | −{ | |
| 458 | − if (pmem[id].no_allocator) | |
| 459 | − return PMEM_START_ADDR(id, 0); | |
| 460 | − else | |
| 461 | − return PMEM_START_ADDR(id, data->index); | |
| 462 | − | |
| 463 | −} | |
| 464 | − | |
| 465 | −static void *pmem_start_vaddr(int id, struct pmem_data *data) | |
| 466 | −{ | |
| 467 | − return pmem_start_addr(id, data) - pmem[id].base + pmem[id].vbase; | |
| 468 | −} | |
| 469 | − | |
| 470 | −static unsigned long pmem_len(int id, struct pmem_data *data) | |
| 471 | −{ | |
| 472 | − if (pmem[id].no_allocator) | |
| 473 | − return data->index; | |
| 474 | − else | |
| 475 | − return PMEM_LEN(id, data->index); | |
| 476 | −} | |
| 477 | − | |
| 478 | −static int pmem_map_garbage(int id, struct vm_area_struct *vma, | |
| 479 | − struct pmem_data *data, unsigned long offset, | |
| 480 | − unsigned long len) | |
| 481 | −{ | |
| 482 | − int i, garbage_pages = len >> PAGE_SHIFT; | |
| 483 | − | |
| 484 | − vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP | VM_SHARED | VM_WRITE; | |
| 485 | − for (i = 0; i < garbage_pages; i++) { | |
| 486 | − if (vm_insert_pfn(vma, vma->vm_start + offset + (i * PAGE_SIZE), | |
| 487 | − pmem[id].garbage_pfn)) | |
| 488 | − return -EAGAIN; | |
| 489 | − } | |
| 490 | − return 0; | |
| 491 | −} | |
| 492 | − | |
| 493 | −static int pmem_unmap_pfn_range(int id, struct vm_area_struct *vma, | |
| 494 | − struct pmem_data *data, unsigned long offset, | |
| 495 | − unsigned long len) | |
| 496 | −{ | |
| 497 | − int garbage_pages; | |
| 498 | − DLOG("unmap offset %lx len %lx\n", offset, len); | |
| 499 | − | |
| 500 | − BUG_ON(!PMEM_IS_PAGE_ALIGNED(len)); | |
| 501 | − | |
| 502 | − garbage_pages = len >> PAGE_SHIFT; | |
| 503 | − zap_page_range(vma, vma->vm_start + offset, len, NULL); | |
| 504 | − pmem_map_garbage(id, vma, data, offset, len); | |
| 505 | − return 0; | |
| 506 | −} | |
| 507 | − | |
| 508 | −static int pmem_map_pfn_range(int id, struct vm_area_struct *vma, | |
| 509 | − struct pmem_data *data, unsigned long offset, | |
| 510 | − unsigned long len) | |
| 511 | −{ | |
| 512 | − DLOG("map offset %lx len %lx\n", offset, len); | |
| 513 | − BUG_ON(!PMEM_IS_PAGE_ALIGNED(vma->vm_start)); | |
| 514 | − BUG_ON(!PMEM_IS_PAGE_ALIGNED(vma->vm_end)); | |
| 515 | − BUG_ON(!PMEM_IS_PAGE_ALIGNED(len)); | |
| 516 | − BUG_ON(!PMEM_IS_PAGE_ALIGNED(offset)); | |
| 517 | − | |
| 518 | − if (io_remap_pfn_range(vma, vma->vm_start + offset, | |
| 519 | − (pmem_start_addr(id, data) + offset) >> PAGE_SHIFT, | |
| 520 | − len, vma->vm_page_prot)) { | |
| 521 | − return -EAGAIN; | |
| 522 | − } | |
| 523 | − return 0; | |
| 524 | −} | |
| 525 | − | |
| 526 | −static int pmem_remap_pfn_range(int id, struct vm_area_struct *vma, | |
| 527 | − struct pmem_data *data, unsigned long offset, | |
| 528 | − unsigned long len) | |
| 529 | −{ | |
| 530 | − /* hold the mm semp for the vma you are modifying when you call this */ | |
| 531 | − BUG_ON(!vma); | |
| 532 | − zap_page_range(vma, vma->vm_start + offset, len, NULL); | |
| 533 | − return pmem_map_pfn_range(id, vma, data, offset, len); | |
| 534 | −} | |
| 535 | − | |
| 536 | −static void pmem_vma_open(struct vm_area_struct *vma) | |
| 537 | −{ | |
| 538 | − struct file *file = vma->vm_file; | |
| 539 | − struct pmem_data *data = file->private_data; | |
| 540 | − int id = get_id(file); | |
| 541 | − /* this should never be called as we don't support copying pmem | |
| 542 | − * ranges via fork */ | |
| 543 | − BUG_ON(!has_allocation(file)); | |
| 544 | − down_write(&data->sem); | |
| 545 | − /* remap the garbage pages, forkers don't get access to the data */ | |
| 546 | − pmem_unmap_pfn_range(id, vma, data, 0, vma->vm_start - vma->vm_end); | |
| 547 | − up_write(&data->sem); | |
| 548 | −} | |
| 549 | − | |
| 550 | −static void pmem_vma_close(struct vm_area_struct *vma) | |
| 551 | −{ | |
| 552 | − struct file *file = vma->vm_file; | |
| 553 | − struct pmem_data *data = file->private_data; | |
| 554 | − | |
| 555 | − DLOG("current %u ppid %u file %p count %d\n", current->pid, | |
| 556 | − current->parent->pid, file, file_count(file)); | |
| 557 | − if (unlikely(!is_pmem_file(file) || !has_allocation(file))) { | |
| 558 | − printk(KERN_WARNING "pmem: something is very wrong, you are " | |
| 559 | − "closing a vm backing an allocation that doesn't " | |
| 560 | − "exist!\n"); | |
| 561 | − return; | |
| 562 | − } | |
| 563 | − down_write(&data->sem); | |
| 564 | − if (data->vma == vma) { | |
| 565 | − data->vma = NULL; | |
| 566 | − if ((data->flags & PMEM_FLAGS_CONNECTED) && | |
| 567 | − (data->flags & PMEM_FLAGS_SUBMAP)) | |
| 568 | − data->flags |= PMEM_FLAGS_UNSUBMAP; | |
| 569 | − } | |
| 570 | − /* the kernel is going to free this vma now anyway */ | |
| 571 | − up_write(&data->sem); | |
| 572 | −} | |
| 573 | − | |
| 574 | −static struct vm_operations_struct vm_ops = { | |
| 575 | − .open = pmem_vma_open, | |
| 576 | − .close = pmem_vma_close, | |
| 577 | −}; | |
| 578 | − | |
| 579 | −static int pmem_mmap(struct file *file, struct vm_area_struct *vma) | |
| 580 | −{ | |
| 581 | − struct pmem_data *data; | |
| 582 | − int index; | |
| 583 | − unsigned long vma_size = vma->vm_end - vma->vm_start; | |
| 584 | − int ret = 0, id = get_id(file); | |
| 585 | − | |
| 586 | − if (vma->vm_pgoff || !PMEM_IS_PAGE_ALIGNED(vma_size)) { | |
| 587 | −#if PMEM_DEBUG | |
| 588 | − printk(KERN_ERR "pmem: mmaps must be at offset zero, aligned" | |
| 589 | − " and a multiple of pages_size.\n"); | |
| 590 | −#endif | |
| 591 | − return -EINVAL; | |
| 592 | − } | |
| 593 | − | |
| 594 | − data = (struct pmem_data *)file->private_data; | |
| 595 | − down_write(&data->sem); | |
| 596 | − /* check this file isn't already mmaped, for submaps check this file | |
| 597 | − * has never been mmaped */ | |
| 598 | − if ((data->flags & PMEM_FLAGS_SUBMAP) || | |
| 599 | − (data->flags & PMEM_FLAGS_UNSUBMAP)) { | |
| 600 | −#if PMEM_DEBUG | |
| 601 | − printk(KERN_ERR "pmem: you can only mmap a pmem file once, " | |
| 602 | − "this file is already mmaped. %x\n", data->flags); | |
| 603 | −#endif | |
| 604 | − ret = -EINVAL; | |
| 605 | − goto error; | |
| 606 | − } | |
| 607 | − /* if file->private_data == unalloced, alloc*/ | |
| 608 | − if (data && data->index == -1) { | |
| 609 | − down_write(&pmem[id].bitmap_sem); | |
| 610 | − index = pmem_allocate(id, vma->vm_end - vma->vm_start); | |
| 611 | − up_write(&pmem[id].bitmap_sem); | |
| 612 | − data->index = index; | |
| 613 | − } | |
| 614 | − /* either no space was available or an error occured */ | |
| 615 | − if (!has_allocation(file)) { | |
| 616 | − ret = -EINVAL; | |
| 617 | − printk("pmem: could not find allocation for map.\n"); | |
| 618 | − goto error; | |
| 619 | − } | |
| 620 | − | |
| 621 | − if (pmem_len(id, data) < vma_size) { | |
| 622 | −#if PMEM_DEBUG | |
| 623 | − printk(KERN_WARNING "pmem: mmap size [%lu] does not match" | |
| 624 | − "size of backing region [%lu].\n", vma_size, | |
| 625 | − pmem_len(id, data)); | |
| 626 | −#endif | |
| 627 | − ret = -EINVAL; | |
| 628 | − goto error; | |
| 629 | − } | |
| 630 | − | |
| 631 | − vma->vm_pgoff = pmem_start_addr(id, data) >> PAGE_SHIFT; | |
| 632 | − vma->vm_page_prot = pmem_access_prot(file, vma->vm_page_prot); | |
| 633 | − | |
| 634 | − if (data->flags & PMEM_FLAGS_CONNECTED) { | |
| 635 | − struct pmem_region_node *region_node; | |
| 636 | − struct list_head *elt; | |
| 637 | − if (pmem_map_garbage(id, vma, data, 0, vma_size)) { | |
| 638 | − printk("pmem: mmap failed in kernel!\n"); | |
| 639 | − ret = -EAGAIN; | |
| 640 | − goto error; | |
| 641 | − } | |
| 642 | − list_for_each(elt, &data->region_list) { | |
| 643 | − region_node = list_entry(elt, struct pmem_region_node, | |
| 644 | − list); | |
| 645 | − DLOG("remapping file: %p %lx %lx\n", file, | |
| 646 | − region_node->region.offset, | |
| 647 | − region_node->region.len); | |
| 648 | − if (pmem_remap_pfn_range(id, vma, data, | |
| 649 | − region_node->region.offset, | |
| 650 | − region_node->region.len)) { | |
| 651 | − ret = -EAGAIN; | |
| 652 | − goto error; | |
| 653 | − } | |
| 654 | − } | |
| 655 | − data->flags |= PMEM_FLAGS_SUBMAP; | |
| 656 | − get_task_struct(current->group_leader); | |
| 657 | − data->task = current->group_leader; | |
| 658 | − data->vma = vma; | |
| 659 | −#if PMEM_DEBUG | |
| 660 | − data->pid = current->pid; | |
| 661 | −#endif | |
| 662 | − DLOG("submmapped file %p vma %p pid %u\n", file, vma, | |
| 663 | − current->pid); | |
| 664 | − } else { | |
| 665 | − if (pmem_map_pfn_range(id, vma, data, 0, vma_size)) { | |
| 666 | − printk(KERN_INFO "pmem: mmap failed in kernel!\n"); | |
| 667 | − ret = -EAGAIN; | |
| 668 | − goto error; | |
| 669 | − } | |
| 670 | − data->flags |= PMEM_FLAGS_MASTERMAP; | |
| 671 | − data->pid = current->pid; | |
| 672 | − } | |
| 673 | − vma->vm_ops = &vm_ops; | |
| 674 | −error: | |
| 675 | − up_write(&data->sem); | |
| 676 | − return ret; | |
| 677 | −} | |
| 678 | − | |
| 679 | −/* the following are the api for accessing pmem regions by other drivers | |
| 680 | − * from inside the kernel */ | |
| 681 | −int get_pmem_user_addr(struct file *file, unsigned long *start, | |
| 682 | − unsigned long *len) | |
| 683 | −{ | |
| 684 | − struct pmem_data *data; | |
| 685 | − if (!is_pmem_file(file) || !has_allocation(file)) { | |
| 686 | −#if PMEM_DEBUG | |
| 687 | − printk(KERN_INFO "pmem: requested pmem data from invalid" | |
| 688 | − "file.\n"); | |
| 689 | −#endif | |
| 690 | − return -1; | |
| 691 | − } | |
| 692 | − data = (struct pmem_data *)file->private_data; | |
| 693 | − down_read(&data->sem); | |
| 694 | − if (data->vma) { | |
| 695 | − *start = data->vma->vm_start; | |
| 696 | − *len = data->vma->vm_end - data->vma->vm_start; | |
| 697 | − } else { | |
| 698 | − *start = 0; | |
| 699 | − *len = 0; | |
| 700 | − } | |
| 701 | − up_read(&data->sem); | |
| 702 | − return 0; | |
| 703 | −} | |
| 704 | − | |
| 705 | −int get_pmem_addr(struct file *file, unsigned long *start, | |
| 706 | − unsigned long *vstart, unsigned long *len) | |
| 707 | −{ | |
| 708 | − struct pmem_data *data; | |
| 709 | − int id; | |
| 710 | − | |
| 711 | − if (!is_pmem_file(file) || !has_allocation(file)) { | |
| 712 | − return -1; | |
| 713 | − } | |
| 714 | − | |
| 715 | − data = (struct pmem_data *)file->private_data; | |
| 716 | − if (data->index == -1) { | |
| 717 | −#if PMEM_DEBUG | |
| 718 | − printk(KERN_INFO "pmem: requested pmem data from file with no " | |
| 719 | − "allocation.\n"); | |
| 720 | − return -1; | |
| 721 | −#endif | |
| 722 | − } | |
| 723 | − id = get_id(file); | |
| 724 | − | |
| 725 | − down_read(&data->sem); | |
| 726 | − *start = pmem_start_addr(id, data); | |
| 727 | − *len = pmem_len(id, data); | |
| 728 | − *vstart = (unsigned long)pmem_start_vaddr(id, data); | |
| 729 | − up_read(&data->sem); | |
| 730 | −#if PMEM_DEBUG | |
| 731 | − down_write(&data->sem); | |
| 732 | − data->ref++; | |
| 733 | − up_write(&data->sem); | |
| 734 | −#endif | |
| 735 | − return 0; | |
| 736 | −} | |
| 737 | − | |
| 738 | −int get_pmem_file(int fd, unsigned long *start, unsigned long *vstart, | |
| 739 | − unsigned long *len, struct file **filp) | |
| 740 | −{ | |
| 741 | − struct file *file; | |
| 742 | − | |
| 743 | − file = fget(fd); | |
| 744 | − if (unlikely(file == NULL)) { | |
| 745 | − printk(KERN_INFO "pmem: requested data from file descriptor " | |
| 746 | − "that doesn't exist."); | |
| 747 | − return -1; | |
| 748 | − } | |
| 749 | − | |
| 750 | − if (get_pmem_addr(file, start, vstart, len)) | |
| 751 | − goto end; | |
| 752 | − | |
| 753 | − if (filp) | |
| 754 | − *filp = file; | |
| 755 | − return 0; | |
| 756 | −end: | |
| 757 | − fput(file); | |
| 758 | − return -1; | |
| 759 | −} | |
| 760 | − | |
| 761 | −void put_pmem_file(struct file *file) | |
| 762 | −{ | |
| 763 | − struct pmem_data *data; | |
| 764 | − int id; | |
| 765 | − | |
| 766 | − if (!is_pmem_file(file)) | |
| 767 | − return; | |
| 768 | − id = get_id(file); | |
| 769 | − data = (struct pmem_data *)file->private_data; | |
| 770 | −#if PMEM_DEBUG | |
| 771 | − down_write(&data->sem); | |
| 772 | − if (data->ref == 0) { | |
| 773 | − printk("pmem: pmem_put > pmem_get %s (pid %d)\n", | |
| 774 | − pmem[id].dev.name, data->pid); | |
| 775 | − BUG(); | |
| 776 | − } | |
| 777 | − data->ref--; | |
| 778 | − up_write(&data->sem); | |
| 779 | −#endif | |
| 780 | − fput(file); | |
| 781 | −} | |
| 782 | − | |
| 783 | −void flush_pmem_file(struct file *file, unsigned long offset, unsigned long len) | |
| 784 | −{ | |
| 785 | − struct pmem_data *data; | |
| 786 | − int id; | |
| 787 | − void *vaddr; | |
| 788 | − struct pmem_region_node *region_node; | |
| 789 | − struct list_head *elt; | |
| 790 | − void *flush_start, *flush_end; | |
| 791 | − | |
| 792 | − if (!is_pmem_file(file) || !has_allocation(file)) { | |
| 793 | − return; | |
| 794 | − } | |
| 795 | − | |
| 796 | − id = get_id(file); | |
| 797 | − data = (struct pmem_data *)file->private_data; | |
| 798 | − if (!pmem[id].cached || file->f_flags & O_SYNC) | |
| 799 | − return; | |
| 800 | − | |
| 801 | − down_read(&data->sem); | |
| 802 | − vaddr = pmem_start_vaddr(id, data); | |
| 803 | − /* if this isn't a submmapped file, flush the whole thing */ | |
| 804 | − if (unlikely(!(data->flags & PMEM_FLAGS_CONNECTED))) { | |
| 805 | − dmac_flush_range(vaddr, vaddr + pmem_len(id, data)); | |
| 806 | − goto end; | |
| 807 | − } | |
| 808 | − /* otherwise, flush the region of the file we are drawing */ | |
| 809 | − list_for_each(elt, &data->region_list) { | |
| 810 | − region_node = list_entry(elt, struct pmem_region_node, list); | |
| 811 | − if ((offset >= region_node->region.offset) && | |
| 812 | − ((offset + len) <= (region_node->region.offset + | |
| 813 | − region_node->region.len))) { | |
| 814 | − flush_start = vaddr + region_node->region.offset; | |
| 815 | − flush_end = flush_start + region_node->region.len; | |
| 816 | − dmac_flush_range(flush_start, flush_end); | |
| 817 | − break; | |
| 818 | − } | |
| 819 | − } | |
| 820 | −end: | |
| 821 | − up_read(&data->sem); | |
| 822 | −} | |
| 823 | − | |
| 824 | −static int pmem_connect(unsigned long connect, struct file *file) | |
| 825 | −{ | |
| 826 | − struct pmem_data *data = (struct pmem_data *)file->private_data; | |
| 827 | − struct pmem_data *src_data; | |
| 828 | − struct file *src_file; | |
| 829 | − int ret = 0, put_needed; | |
| 830 | − | |
| 831 | − down_write(&data->sem); | |
| 832 | − /* retrieve the src file and check it is a pmem file with an alloc */ | |
| 833 | − src_file = fget_light(connect, &put_needed); | |
| 834 | − DLOG("connect %p to %p\n", file, src_file); | |
| 835 | − if (!src_file) { | |
| 836 | − printk("pmem: src file not found!\n"); | |
| 837 | − ret = -EINVAL; | |
| 838 | − goto err_no_file; | |
| 839 | − } | |
| 840 | − if (unlikely(!is_pmem_file(src_file) || !has_allocation(src_file))) { | |
| 841 | − printk(KERN_INFO "pmem: src file is not a pmem file or has no " | |
| 842 | − "alloc!\n"); | |
| 843 | − ret = -EINVAL; | |
| 844 | − goto err_bad_file; | |
| 845 | − } | |
| 846 | − src_data = (struct pmem_data *)src_file->private_data; | |
| 847 | − | |
| 848 | − if (has_allocation(file) && (data->index != src_data->index)) { | |
| 849 | − printk("pmem: file is already mapped but doesn't match this" | |
| 850 | − " src_file!\n"); | |
| 851 | − ret = -EINVAL; | |
| 852 | − goto err_bad_file; | |
| 853 | − } | |
| 854 | − data->index = src_data->index; | |
| 855 | − data->flags |= PMEM_FLAGS_CONNECTED; | |
| 856 | − data->master_fd = connect; | |
| 857 | − data->master_file = src_file; | |
| 858 | − | |
| 859 | −err_bad_file: | |
| 860 | − fput_light(src_file, put_needed); | |
| 861 | −err_no_file: | |
| 862 | − up_write(&data->sem); | |
| 863 | − return ret; | |
| 864 | −} | |
| 865 | − | |
| 866 | −static void pmem_unlock_data_and_mm(struct pmem_data *data, | |
| 867 | − struct mm_struct *mm) | |
| 868 | −{ | |
| 869 | − up_write(&data->sem); | |
| 870 | − if (mm != NULL) { | |
| 871 | − up_write(&mm->mmap_sem); | |
| 872 | − mmput(mm); | |
| 873 | − } | |
| 874 | −} | |
| 875 | − | |
| 876 | −static int pmem_lock_data_and_mm(struct file *file, struct pmem_data *data, | |
| 877 | − struct mm_struct **locked_mm) | |
| 878 | −{ | |
| 879 | − int ret = 0; | |
| 880 | − struct mm_struct *mm = NULL; | |
| 881 | − *locked_mm = NULL; | |
| 882 | −lock_mm: | |
| 883 | − down_read(&data->sem); | |
| 884 | − if (PMEM_IS_SUBMAP(data)) { | |
| 885 | − mm = get_task_mm(data->task); | |
| 886 | − if (!mm) { | |
| 887 | −#if PMEM_DEBUG | |
| 888 | − printk("pmem: can't remap task is gone!\n"); | |
| 889 | −#endif | |
| 890 | − up_read(&data->sem); | |
| 891 | − return -1; | |
| 892 | − } | |
| 893 | − } | |
| 894 | − up_read(&data->sem); | |
| 895 | − | |
| 896 | − if (mm) | |
| 897 | − down_write(&mm->mmap_sem); | |
| 898 | − | |
| 899 | − down_write(&data->sem); | |
| 900 | − /* check that the file didn't get mmaped before we could take the | |
| 901 | − * data sem, this should be safe b/c you can only submap each file | |
| 902 | − * once */ | |
| 903 | − if (PMEM_IS_SUBMAP(data) && !mm) { | |
| 904 | − pmem_unlock_data_and_mm(data, mm); | |
| 905 | − up_write(&data->sem); | |
| 906 | − goto lock_mm; | |
| 907 | − } | |
| 908 | − /* now check that vma.mm is still there, it could have been | |
| 909 | − * deleted by vma_close before we could get the data->sem */ | |
| 910 | − if ((data->flags & PMEM_FLAGS_UNSUBMAP) && (mm != NULL)) { | |
| 911 | − /* might as well release this */ | |
| 912 | − if (data->flags & PMEM_FLAGS_SUBMAP) { | |
| 913 | − put_task_struct(data->task); | |
| 914 | − data->task = NULL; | |
| 915 | − /* lower the submap flag to show the mm is gone */ | |
| 916 | − data->flags &= ~(PMEM_FLAGS_SUBMAP); | |
| 917 | − } | |
| 918 | − pmem_unlock_data_and_mm(data, mm); | |
| 919 | − return -1; | |
| 920 | − } | |
| 921 | − *locked_mm = mm; | |
| 922 | − return ret; | |
| 923 | −} | |
| 924 | − | |
| 925 | −int pmem_remap(struct pmem_region *region, struct file *file, | |
| 926 | − unsigned operation) | |
| 927 | −{ | |
| 928 | − int ret; | |
| 929 | − struct pmem_region_node *region_node; | |
| 930 | − struct mm_struct *mm = NULL; | |
| 931 | − struct list_head *elt, *elt2; | |
| 932 | − int id = get_id(file); | |
| 933 | − struct pmem_data *data = (struct pmem_data *)file->private_data; | |
| 934 | − | |
| 935 | − /* pmem region must be aligned on a page boundry */ | |
| 936 | − if (unlikely(!PMEM_IS_PAGE_ALIGNED(region->offset) || | |
| 937 | − !PMEM_IS_PAGE_ALIGNED(region->len))) { | |
| 938 | −#if PMEM_DEBUG | |
| 939 | − printk("pmem: request for unaligned pmem suballocation " | |
| 940 | − "%lx %lx\n", region->offset, region->len); | |
| 941 | −#endif | |
| 942 | − return -EINVAL; | |
| 943 | − } | |
| 944 | − | |
| 945 | − /* if userspace requests a region of len 0, there's nothing to do */ | |
| 946 | − if (region->len == 0) | |
| 947 | − return 0; | |
| 948 | − | |
| 949 | − /* lock the mm and data */ | |
| 950 | − ret = pmem_lock_data_and_mm(file, data, &mm); | |
| 951 | − if (ret) | |
| 952 | − return 0; | |
| 953 | − | |
| 954 | − /* only the owner of the master file can remap the client fds | |
| 955 | − * that back in it */ | |
| 956 | − if (!is_master_owner(file)) { | |
| 957 | −#if PMEM_DEBUG | |
| 958 | − printk("pmem: remap requested from non-master process\n"); | |
| 959 | −#endif | |
| 960 | − ret = -EINVAL; | |
| 961 | − goto err; | |
| 962 | − } | |
| 963 | − | |
| 964 | − /* check that the requested range is within the src allocation */ | |
| 965 | − if (unlikely((region->offset > pmem_len(id, data)) || | |
| 966 | − (region->len > pmem_len(id, data)) || | |
| 967 | − (region->offset + region->len > pmem_len(id, data)))) { | |
| 968 | −#if PMEM_DEBUG | |
| 969 | − printk(KERN_INFO "pmem: suballoc doesn't fit in src_file!\n"); | |
| 970 | −#endif | |
| 971 | − ret = -EINVAL; | |
| 972 | − goto err; | |
| 973 | − } | |
| 974 | − | |
| 975 | − if (operation == PMEM_MAP) { | |
| 976 | − region_node = kmalloc(sizeof(struct pmem_region_node), | |
| 977 | − GFP_KERNEL); | |
| 978 | − if (!region_node) { | |
| 979 | − ret = -ENOMEM; | |
| 980 | −#if PMEM_DEBUG | |
| 981 | − printk(KERN_INFO "No space to allocate metadata!"); | |
| 982 | −#endif | |
| 983 | − goto err; | |
| 984 | − } | |
| 985 | − region_node->region = *region; | |
| 986 | − list_add(®ion_node->list, &data->region_list); | |
| 987 | − } else if (operation == PMEM_UNMAP) { | |
| 988 | − int found = 0; | |
| 989 | − list_for_each_safe(elt, elt2, &data->region_list) { | |
| 990 | − region_node = list_entry(elt, struct pmem_region_node, | |
| 991 | − list); | |
| 992 | − if (region->len == 0 || | |
| 993 | − (region_node->region.offset == region->offset && | |
| 994 | − region_node->region.len == region->len)) { | |
| 995 | − list_del(elt); | |
| 996 | − kfree(region_node); | |
| 997 | − found = 1; | |
| 998 | − } | |
| 999 | − } | |
| 1000 | − if (!found) { | |
| 1001 | −#if PMEM_DEBUG | |
| 1002 | − printk("pmem: Unmap region does not map any mapped " | |
| 1003 | − "region!"); | |
| 1004 | −#endif | |
| 1005 | − ret = -EINVAL; | |
| 1006 | − goto err; | |
| 1007 | − } | |
| 1008 | − } | |
| 1009 | − | |
| 1010 | − if (data->vma && PMEM_IS_SUBMAP(data)) { | |
| 1011 | − if (operation == PMEM_MAP) | |
| 1012 | − ret = pmem_remap_pfn_range(id, data->vma, data, | |
| 1013 | − region->offset, region->len); | |
| 1014 | − else if (operation == PMEM_UNMAP) | |
| 1015 | − ret = pmem_unmap_pfn_range(id, data->vma, data, | |
| 1016 | − region->offset, region->len); | |
| 1017 | − } | |
| 1018 | − | |
| 1019 | −err: | |
| 1020 | − pmem_unlock_data_and_mm(data, mm); | |
| 1021 | − return ret; | |
| 1022 | −} | |
| 1023 | − | |
| 1024 | −static void pmem_revoke(struct file *file, struct pmem_data *data) | |
| 1025 | −{ | |
| 1026 | − struct pmem_region_node *region_node; | |
| 1027 | − struct list_head *elt, *elt2; | |
| 1028 | − struct mm_struct *mm = NULL; | |
| 1029 | − int id = get_id(file); | |
| 1030 | − int ret = 0; | |
| 1031 | − | |
| 1032 | − data->master_file = NULL; | |
| 1033 | − ret = pmem_lock_data_and_mm(file, data, &mm); | |
| 1034 | − /* if lock_data_and_mm fails either the task that mapped the fd, or | |
| 1035 | − * the vma that mapped it have already gone away, nothing more | |
| 1036 | − * needs to be done */ | |
| 1037 | − if (ret) | |
| 1038 | − return; | |
| 1039 | − /* unmap everything */ | |
| 1040 | − /* delete the regions and region list nothing is mapped any more */ | |
| 1041 | − if (data->vma) | |
| 1042 | − list_for_each_safe(elt, elt2, &data->region_list) { | |
| 1043 | − region_node = list_entry(elt, struct pmem_region_node, | |
| 1044 | − list); | |
| 1045 | − pmem_unmap_pfn_range(id, data->vma, data, | |
| 1046 | − region_node->region.offset, | |
| 1047 | − region_node->region.len); | |
| 1048 | − list_del(elt); | |
| 1049 | − kfree(region_node); | |
| 1050 | − } | |
| 1051 | − /* delete the master file */ | |
| 1052 | − pmem_unlock_data_and_mm(data, mm); | |
| 1053 | −} | |
| 1054 | − | |
| 1055 | −static void pmem_get_size(struct pmem_region *region, struct file *file) | |
| 1056 | −{ | |
| 1057 | − struct pmem_data *data = (struct pmem_data *)file->private_data; | |
| 1058 | − int id = get_id(file); | |
| 1059 | − | |
| 1060 | − if (!has_allocation(file)) { | |
| 1061 | − region->offset = 0; | |
| 1062 | − region->len = 0; | |
| 1063 | − return; | |
| 1064 | − } else { | |
| 1065 | − region->offset = pmem_start_addr(id, data); | |
| 1066 | − region->len = pmem_len(id, data); | |
| 1067 | − } | |
| 1068 | − DLOG("offset %lx len %lx\n", region->offset, region->len); | |
| 1069 | −} | |
| 1070 | − | |
| 1071 | − | |
| 1072 | −static long pmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |
| 1073 | −{ | |
| 1074 | − struct pmem_data *data; | |
| 1075 | − int id = get_id(file); | |
| 1076 | − | |
| 1077 | − switch (cmd) { | |
| 1078 | − case PMEM_GET_PHYS: | |
| 1079 | − { | |
| 1080 | − struct pmem_region region; | |
| 1081 | − DLOG("get_phys\n"); | |
| 1082 | − if (!has_allocation(file)) { | |
| 1083 | − region.offset = 0; | |
| 1084 | − region.len = 0; | |
| 1085 | − } else { | |
| 1086 | − data = (struct pmem_data *)file->private_data; | |
| 1087 | − region.offset = pmem_start_addr(id, data); | |
| 1088 | − region.len = pmem_len(id, data); | |
| 1089 | − } | |
| 1090 | − printk(KERN_INFO "pmem: request for physical address of pmem region " | |
| 1091 | − "from process %d.\n", current->pid); | |
| 1092 | − if (copy_to_user((void __user *)arg, ®ion, | |
| 1093 | − sizeof(struct pmem_region))) | |
| 1094 | − return -EFAULT; | |
| 1095 | − break; | |
| 1096 | − } | |
| 1097 | − case PMEM_MAP: | |
| 1098 | − { | |
| 1099 | − struct pmem_region region; | |
| 1100 | − if (copy_from_user(®ion, (void __user *)arg, | |
| 1101 | − sizeof(struct pmem_region))) | |
| 1102 | − return -EFAULT; | |
| 1103 | − data = (struct pmem_data *)file->private_data; | |
| 1104 | − return pmem_remap(®ion, file, PMEM_MAP); | |
| 1105 | − } | |
| 1106 | − break; | |
| 1107 | − case PMEM_UNMAP: | |
| 1108 | − { | |
| 1109 | − struct pmem_region region; | |
| 1110 | − if (copy_from_user(®ion, (void __user *)arg, | |
| 1111 | − sizeof(struct pmem_region))) | |
| 1112 | − return -EFAULT; | |
| 1113 | − data = (struct pmem_data *)file->private_data; | |
| 1114 | − return pmem_remap(®ion, file, PMEM_UNMAP); | |
| 1115 | − break; | |
| 1116 | − } | |
| 1117 | − case PMEM_GET_SIZE: | |
| 1118 | − { | |
| 1119 | − struct pmem_region region; | |
| 1120 | − DLOG("get_size\n"); | |
| 1121 | − pmem_get_size(®ion, file); | |
| 1122 | − if (copy_to_user((void __user *)arg, ®ion, | |
| 1123 | − sizeof(struct pmem_region))) | |
| 1124 | − return -EFAULT; | |
| 1125 | − break; | |
| 1126 | − } | |
| 1127 | − case PMEM_GET_TOTAL_SIZE: | |
| 1128 | − { | |
| 1129 | − struct pmem_region region; | |
| 1130 | − DLOG("get total size\n"); | |
| 1131 | − region.offset = 0; | |
| 1132 | − get_id(file); | |
| 1133 | − region.len = pmem[id].size; | |
| 1134 | − if (copy_to_user((void __user *)arg, ®ion, | |
| 1135 | − sizeof(struct pmem_region))) | |
| 1136 | − return -EFAULT; | |
| 1137 | − break; | |
| 1138 | − } | |
| 1139 | − case PMEM_ALLOCATE: | |
| 1140 | − { | |
| 1141 | − if (has_allocation(file)) | |
| 1142 | − return -EINVAL; | |
| 1143 | − data = (struct pmem_data *)file->private_data; | |
| 1144 | − data->index = pmem_allocate(id, arg); | |
| 1145 | − break; | |
| 1146 | − } | |
| 1147 | − case PMEM_CONNECT: | |
| 1148 | − DLOG("connect\n"); | |
| 1149 | − return pmem_connect(arg, file); | |
| 1150 | − break; | |
| 1151 | − case PMEM_CACHE_FLUSH: | |
| 1152 | − { | |
| 1153 | − struct pmem_region region; | |
| 1154 | − DLOG("flush\n"); | |
| 1155 | − if (copy_from_user(®ion, (void __user *)arg, | |
| 1156 | − sizeof(struct pmem_region))) | |
| 1157 | − return -EFAULT; | |
| 1158 | − flush_pmem_file(file, region.offset, region.len); | |
| 1159 | − break; | |
| 1160 | − } | |
| 1161 | − default: | |
| 1162 | − if (pmem[id].ioctl) | |
| 1163 | − return pmem[id].ioctl(file, cmd, arg); | |
| 1164 | − return -EINVAL; | |
| 1165 | − } | |
| 1166 | − return 0; | |
| 1167 | −} | |
| 1168 | − | |
| 1169 | −#if PMEM_DEBUG | |
| 1170 | −static ssize_t debug_open(struct inode *inode, struct file *file) | |
| 1171 | −{ | |
| 1172 | − file->private_data = inode->i_private; | |
| 1173 | − return 0; | |
| 1174 | −} | |
| 1175 | − | |
| 1176 | −static ssize_t debug_read(struct file *file, char __user *buf, size_t count, | |
| 1177 | − loff_t *ppos) | |
| 1178 | −{ | |
| 1179 | − struct list_head *elt, *elt2; | |
| 1180 | − struct pmem_data *data; | |
| 1181 | − struct pmem_region_node *region_node; | |
| 1182 | − int id = (int)file->private_data; | |
| 1183 | − const int debug_bufmax = 4096; | |
| 1184 | − static char buffer[4096]; | |
| 1185 | − int n = 0; | |
| 1186 | − | |
| 1187 | − DLOG("debug open\n"); | |
| 1188 | − n = scnprintf(buffer, debug_bufmax, | |
| 1189 | − "pid #: mapped regions (offset, len) (offset,len)...\n"); | |
| 1190 | − | |
| 1191 | − mutex_lock(&pmem[id].data_list_lock); | |
| 1192 | − list_for_each(elt, &pmem[id].data_list) { | |
| 1193 | − data = list_entry(elt, struct pmem_data, list); | |
| 1194 | − down_read(&data->sem); | |
| 1195 | − n += scnprintf(buffer + n, debug_bufmax - n, "pid %u:", | |
| 1196 | − data->pid); | |
| 1197 | − list_for_each(elt2, &data->region_list) { | |
| 1198 | − region_node = list_entry(elt2, struct pmem_region_node, | |
| 1199 | − list); | |
| 1200 | − n += scnprintf(buffer + n, debug_bufmax - n, | |
| 1201 | − "(%lx,%lx) ", | |
| 1202 | − region_node->region.offset, | |
| 1203 | − region_node->region.len); | |
| 1204 | − } | |
| 1205 | − n += scnprintf(buffer + n, debug_bufmax - n, "\n"); | |
| 1206 | − up_read(&data->sem); | |
| 1207 | − } | |
| 1208 | − mutex_unlock(&pmem[id].data_list_lock); | |
| 1209 | − | |
| 1210 | − n++; | |
| 1211 | − buffer[n] = 0; | |
| 1212 | − return simple_read_from_buffer(buf, count, ppos, buffer, n); | |
| 1213 | −} | |
| 1214 | − | |
| 1215 | −static struct file_operations debug_fops = { | |
| 1216 | − .read = debug_read, | |
| 1217 | − .open = debug_open, | |
| 1218 | −}; | |
| 1219 | −#endif | |
| 1220 | − | |
| 1221 | −#if 0 | |
| 1222 | −static struct miscdevice pmem_dev = { | |
| 1223 | − .name = "pmem", | |
| 1224 | − .fops = &pmem_fops, | |
| 1225 | −}; | |
| 1226 | −#endif | |
| 1227 | − | |
| 1228 | −int pmem_setup(struct android_pmem_platform_data *pdata, | |
| 1229 | − long (*ioctl)(struct file *, unsigned int, unsigned long), | |
| 1230 | − int (*release)(struct inode *, struct file *)) | |
| 1231 | −{ | |
| 1232 | − int err = 0; | |
| 1233 | − int i, index = 0; | |
| 1234 | − int id = id_count; | |
| 1235 | − id_count++; | |
| 1236 | − | |
| 1237 | − pmem[id].no_allocator = pdata->no_allocator; | |
| 1238 | − pmem[id].cached = pdata->cached; | |
| 1239 | − pmem[id].buffered = pdata->buffered; | |
| 1240 | − pmem[id].base = pdata->start; | |
| 1241 | − pmem[id].size = pdata->size; | |
| 1242 | − pmem[id].ioctl = ioctl; | |
| 1243 | − pmem[id].release = release; | |
| 1244 | − init_rwsem(&pmem[id].bitmap_sem); | |
| 1245 | − mutex_init(&pmem[id].data_list_lock); | |
| 1246 | − INIT_LIST_HEAD(&pmem[id].data_list); | |
| 1247 | − pmem[id].dev.name = pdata->name; | |
| 1248 | − pmem[id].dev.minor = id; | |
| 1249 | − pmem[id].dev.fops = &pmem_fops; | |
| 1250 | − printk(KERN_INFO "%s: %d init\n", pdata->name, pdata->cached); | |
| 1251 | − | |
| 1252 | − err = misc_register(&pmem[id].dev); | |
| 1253 | − if (err) { | |
| 1254 | − printk(KERN_ALERT "Unable to register pmem driver!\n"); | |
| 1255 | − goto err_cant_register_device; | |
| 1256 | − } | |
| 1257 | − pmem[id].num_entries = pmem[id].size / PMEM_MIN_ALLOC; | |
| 1258 | − | |
| 1259 | − pmem[id].bitmap = kmalloc(pmem[id].num_entries * | |
| 1260 | − sizeof(struct pmem_bits), GFP_KERNEL); | |
| 1261 | − if (!pmem[id].bitmap) | |
| 1262 | − goto err_no_mem_for_metadata; | |
| 1263 | − | |
| 1264 | − memset(pmem[id].bitmap, 0, sizeof(struct pmem_bits) * | |
| 1265 | − pmem[id].num_entries); | |
| 1266 | − | |
| 1267 | − for (i = sizeof(pmem[id].num_entries) * 8 - 1; i >= 0; i--) { | |
| 1268 | − if ((pmem[id].num_entries) & 1<<i) { | |
| 1269 | − PMEM_ORDER(id, index) = i; | |
| 1270 | − index = PMEM_NEXT_INDEX(id, index); | |
| 1271 | − } | |
| 1272 | − } | |
| 1273 | − | |
| 1274 | − if (pmem[id].cached) | |
| 1275 | − pmem[id].vbase = ioremap_cached(pmem[id].base, | |
| 1276 | − pmem[id].size); | |
| 1277 | −#ifdef ioremap_ext_buffered | |
| 1278 | − else if (pmem[id].buffered) | |
| 1279 | − pmem[id].vbase = ioremap_ext_buffered(pmem[id].base, | |
| 1280 | − pmem[id].size); | |
| 1281 | −#endif | |
| 1282 | − else | |
| 1283 | − pmem[id].vbase = ioremap(pmem[id].base, pmem[id].size); | |
| 1284 | − | |
| 1285 | − if (pmem[id].vbase == 0) | |
| 1286 | − goto error_cant_remap; | |
| 1287 | − | |
| 1288 | − pmem[id].garbage_pfn = page_to_pfn(alloc_page(GFP_KERNEL)); | |
| 1289 | − if (pmem[id].no_allocator) | |
| 1290 | − pmem[id].allocated = 0; | |
| 1291 | − | |
| 1292 | −#if PMEM_DEBUG | |
| 1293 | − debugfs_create_file(pdata->name, S_IFREG | S_IRUGO, NULL, (void *)id, | |
| 1294 | − &debug_fops); | |
| 1295 | −#endif | |
| 1296 | − return 0; | |
| 1297 | −error_cant_remap: | |
| 1298 | − kfree(pmem[id].bitmap); | |
| 1299 | −err_no_mem_for_metadata: | |
| 1300 | − misc_deregister(&pmem[id].dev); | |
| 1301 | −err_cant_register_device: | |
| 1302 | − return -1; | |
| 1303 | −} | |
| 1304 | − | |
| 1305 | −static int pmem_probe(struct platform_device *pdev) | |
| 1306 | −{ | |
| 1307 | − struct android_pmem_platform_data *pdata; | |
| 1308 | − | |
| 1309 | − if (!pdev || !pdev->dev.platform_data) { | |
| 1310 | − printk(KERN_ALERT "Unable to probe pmem!\n"); | |
| 1311 | − return -1; | |
| 1312 | − } | |
| 1313 | − pdata = pdev->dev.platform_data; | |
| 1314 | − return pmem_setup(pdata, NULL, NULL); | |
| 1315 | −} | |
| 1316 | − | |
| 1317 | − | |
| 1318 | −static int pmem_remove(struct platform_device *pdev) | |
| 1319 | −{ | |
| 1320 | − int id = pdev->id; | |
| 1321 | − __free_page(pfn_to_page(pmem[id].garbage_pfn)); | |
| 1322 | − misc_deregister(&pmem[id].dev); | |
| 1323 | − return 0; | |
| 1324 | −} | |
| 1325 | − | |
| 1326 | −static struct platform_driver pmem_driver = { | |
| 1327 | − .probe = pmem_probe, | |
| 1328 | − .remove = pmem_remove, | |
| 1329 | − .driver = { .name = "android_pmem" } | |
| 1330 | −}; | |
| 1331 | − | |
| 1332 | − | |
| 1333 | −static int __init pmem_init(void) | |
| 1334 | −{ | |
| 1335 | − return platform_driver_register(&pmem_driver); | |
| 1336 | −} | |
| 1337 | − | |
| 1338 | −static void __exit pmem_exit(void) | |
| 1339 | −{ | |
| 1340 | − platform_driver_unregister(&pmem_driver); | |
| 1341 | −} | |
| 1342 | − | |
| 1343 | −module_init(pmem_init); | |
| 1344 | −module_exit(pmem_exit); | |
| 1345 | − | |
| @@ -355,7 +355,14 @@ static void send_data(struct asus_oled_dev *odev) · 354 unmodified lines | ||
| 355 | 355 | |
| 356 | 356 | static int append_values(struct asus_oled_dev *odev, uint8_t val, size_t count) |
| 357 | 357 | { |
| 358 | − while (count-- > 0 && val) { | |
| 358 | + odev->last_val = val; | |
| 359 | + | |
| 360 | + if (val == 0) { | |
| 361 | + odev->buf_offs += count; | |
| 362 | + return 0; | |
| 363 | + } | |
| 364 | + | |
| 365 | + while (count-- > 0) { | |
| 359 | 366 | size_t x = odev->buf_offs % odev->width; |
| 360 | 367 | size_t y = odev->buf_offs / odev->width; |
| 361 | 368 | size_t i; |
| @@ -406,7 +413,6 @@ static int append_values(struct asus_oled_dev *odev, uint8_t val, size_t count) · 44 unmodified lines | ||
| 406 | 413 | ; |
| 407 | 414 | } |
| 408 | 415 | |
| 409 | − odev->last_val = val; | |
| 410 | 416 | odev->buf_offs++; |
| 411 | 417 | } |
| 412 | 418 | |
| @@ -805,10 +811,9 @@ error: · 392 unmodified lines | ||
| 805 | 811 | |
| 806 | 812 | static void __exit asus_oled_exit(void) |
| 807 | 813 | { |
| 814 | + usb_deregister(&oled_driver); | |
| 808 | 815 | class_remove_file(oled_class, &class_attr_version.attr); |
| 809 | 816 | class_destroy(oled_class); |
| 810 | − | |
| 811 | − usb_deregister(&oled_driver); | |
| 812 | 817 | } |
| 813 | 818 | |
| 814 | 819 | module_init(asus_oled_init); |
| @@ -1,33 +0,0 @@ | ||
| 1 | −config DRM_PSB | |
| 2 | − tristate "Intel GMA5/600 KMS Framebuffer" | |
| 3 | − depends on DRM && PCI && X86 && BROKEN | |
| 4 | − select FB_CFB_COPYAREA | |
| 5 | − select FB_CFB_FILLRECT | |
| 6 | − select FB_CFB_IMAGEBLIT | |
| 7 | − select DRM_KMS_HELPER | |
| 8 | − select DRM_TTM | |
| 9 | − help | |
| 10 | − Say yes for an experimental 2D KMS framebuffer driver for the | |
| 11 | − Intel GMA500 ('Poulsbo') and other Intel IMG based graphics | |
| 12 | − devices. | |
| 13 | − | |
| 14 | −config DRM_PSB_MRST | |
| 15 | − bool "Intel GMA600 support (Experimental)" | |
| 16 | − depends on DRM_PSB | |
| 17 | − help | |
| 18 | − Say yes to include support for GMA600 (Intel Moorestown/Oaktrail) | |
| 19 | − platforms with LVDS ports. HDMI and MIPI are not currently | |
| 20 | − supported. | |
| 21 | − | |
| 22 | −config DRM_PSB_MFLD | |
| 23 | − bool "Intel Medfield support (Experimental)" | |
| 24 | − depends on DRM_PSB | |
| 25 | − help | |
| 26 | − Say yes to include support for Intel Medfield platforms with MIPI | |
| 27 | − interfaces. | |
| 28 | − | |
| 29 | −config DRM_PSB_CDV | |
| 30 | − bool "Intel Cedarview support (Experimental)" | |
| 31 | − depends on DRM_PSB | |
| 32 | − help | |
| 33 | − Say yes to include support for Intel Cedarview platforms | |
| @@ -1,52 +0,0 @@ | ||
| 1 | −# | |
| 2 | −# KMS driver for the GMA500 | |
| 3 | −# | |
| 4 | −ccflags-y += -Iinclude/drm | |
| 5 | − | |
| 6 | −psb_gfx-y += gem_glue.o \ | |
| 7 | − accel_2d.o \ | |
| 8 | − backlight.o \ | |
| 9 | − framebuffer.o \ | |
| 10 | − gem.o \ | |
| 11 | − gtt.o \ | |
| 12 | − intel_bios.o \ | |
| 13 | − intel_i2c.o \ | |
| 14 | − intel_opregion.o \ | |
| 15 | − mmu.o \ | |
| 16 | − power.o \ | |
| 17 | − psb_drv.o \ | |
| 18 | − psb_intel_display.o \ | |
| 19 | − psb_intel_lvds.o \ | |
| 20 | − psb_intel_modes.o \ | |
| 21 | − psb_intel_sdvo.o \ | |
| 22 | − psb_lid.o \ | |
| 23 | − psb_irq.o \ | |
| 24 | − psb_device.o \ | |
| 25 | − mid_bios.o | |
| 26 | − | |
| 27 | −psb_gfx-$(CONFIG_DRM_PSB_CDV) += cdv_device.o \ | |
| 28 | − cdv_intel_crt.o \ | |
| 29 | − cdv_intel_display.o \ | |
| 30 | − cdv_intel_hdmi.o \ | |
| 31 | − cdv_intel_lvds.o | |
| 32 | − | |
| 33 | −psb_gfx-$(CONFIG_DRM_PSB_MRST) += mrst_device.o \ | |
| 34 | − mrst_crtc.o \ | |
| 35 | − mrst_lvds.o \ | |
| 36 | − mrst_hdmi.o \ | |
| 37 | − mrst_hdmi_i2c.o | |
| 38 | − | |
| 39 | −psb_gfx-$(CONFIG_DRM_PSB_MFLD) += mdfld_device.o \ | |
| 40 | − mdfld_output.o \ | |
| 41 | − mdfld_pyr_cmd.o \ | |
| 42 | − mdfld_tmd_vid.o \ | |
| 43 | − mdfld_tpo_cmd.o \ | |
| 44 | − mdfld_tpo_vid.o \ | |
| 45 | − mdfld_dsi_pkg_sender.o \ | |
| 46 | − mdfld_dsi_dpi.o \ | |
| 47 | − mdfld_dsi_output.o \ | |
| 48 | − mdfld_dsi_dbi.o \ | |
| 49 | − mdfld_dsi_dbi_dpu.o \ | |
| 50 | − mdfld_intel_display.o | |
| 51 | − | |
| 52 | −obj-$(CONFIG_DRM_PSB) += psb_gfx.o | |
| @@ -1,15 +0,0 @@ | ||
| 1 | −- Sort out the power management side. Not important for Poulsbo but | |
| 2 | − matters for Moorestown/Medfield | |
| 3 | −- Debug Oaktrail/Moorestown support (single pipe, no BIOS on mrst, | |
| 4 | − some other differences) | |
| 5 | −- Add 2D acceleration via console and DRM | |
| 6 | −- Add scrolling acceleration using the GTT to do remapping on the main | |
| 7 | − framebuffer. | |
| 8 | −- HDMI testing | |
| 9 | −- Oaktrail HDMI and other features | |
| 10 | −- Oaktrail MIPI | |
| 11 | −- Medfield needs a lot of further love | |
| 12 | − | |
| 13 | −As per kernel policy and the in the interest of the safety of various | |
| 14 | −kittens there is no support or plans to add hooks for the closed user space | |
| 15 | −stuff. | |
| @@ -1,414 +0,0 @@ | ||
| 1 | −/************************************************************************** | |
| 2 | − * Copyright (c) 2007-2011, Intel Corporation. | |
| 3 | − * All Rights Reserved. | |
| 4 | − * | |
| 5 | − * This program is free software; you can redistribute it and/or modify it | |
| 6 | − * under the terms and conditions of the GNU General Public License, | |
| 7 | − * version 2, as published by the Free Software Foundation. | |
| 8 | − * | |
| 9 | − * This program is distributed in the hope it will be useful, but WITHOUT | |
| 10 | − * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 11 | − * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
| 12 | − * more details. | |
| 13 | − * | |
| 14 | − * You should have received a copy of the GNU General Public License along with | |
| 15 | − * this program; if not, write to the Free Software Foundation, Inc., | |
| 16 | − * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | |
| 17 | − * | |
| 18 | − * Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to | |
| 19 | − * develop this driver. | |
| 20 | − * | |
| 21 | − **************************************************************************/ | |
| 22 | − | |
| 23 | −#include <linux/module.h> | |
| 24 | −#include <linux/kernel.h> | |
| 25 | −#include <linux/errno.h> | |
| 26 | −#include <linux/string.h> | |
| 27 | −#include <linux/mm.h> | |
| 28 | −#include <linux/tty.h> | |
| 29 | −#include <linux/slab.h> | |
| 30 | −#include <linux/delay.h> | |
| 31 | −#include <linux/fb.h> | |
| 32 | −#include <linux/init.h> | |
| 33 | −#include <linux/console.h> | |
| 34 | − | |
| 35 | −#include <drm/drmP.h> | |
| 36 | −#include <drm/drm.h> | |
| 37 | −#include <drm/drm_crtc.h> | |
| 38 | − | |
| 39 | −#include "psb_drv.h" | |
| 40 | −#include "psb_reg.h" | |
| 41 | −#include "framebuffer.h" | |
| 42 | − | |
| 43 | −/** | |
| 44 | − * psb_spank - reset the 2D engine | |
| 45 | − * @dev_priv: our PSB DRM device | |
| 46 | − * | |
| 47 | − * Soft reset the graphics engine and then reload the necessary registers. | |
| 48 | − * We use this at initialisation time but it will become relevant for | |
| 49 | − * accelerated X later | |
| 50 | − */ | |
| 51 | −void psb_spank(struct drm_psb_private *dev_priv) | |
| 52 | −{ | |
| 53 | − PSB_WSGX32(_PSB_CS_RESET_BIF_RESET | _PSB_CS_RESET_DPM_RESET | | |
| 54 | − _PSB_CS_RESET_TA_RESET | _PSB_CS_RESET_USE_RESET | | |
| 55 | − _PSB_CS_RESET_ISP_RESET | _PSB_CS_RESET_TSP_RESET | | |
| 56 | − _PSB_CS_RESET_TWOD_RESET, PSB_CR_SOFT_RESET); | |
| 57 | − PSB_RSGX32(PSB_CR_SOFT_RESET); | |
| 58 | − | |
| 59 | − msleep(1); | |
| 60 | − | |
| 61 | − PSB_WSGX32(0, PSB_CR_SOFT_RESET); | |
| 62 | − wmb(); | |
| 63 | − PSB_WSGX32(PSB_RSGX32(PSB_CR_BIF_CTRL) | _PSB_CB_CTRL_CLEAR_FAULT, | |
| 64 | − PSB_CR_BIF_CTRL); | |
| 65 | − wmb(); | |
| 66 | − (void) PSB_RSGX32(PSB_CR_BIF_CTRL); | |
| 67 | − | |
| 68 | − msleep(1); | |
| 69 | − PSB_WSGX32(PSB_RSGX32(PSB_CR_BIF_CTRL) & ~_PSB_CB_CTRL_CLEAR_FAULT, | |
| 70 | − PSB_CR_BIF_CTRL); | |
| 71 | − (void) PSB_RSGX32(PSB_CR_BIF_CTRL); | |
| 72 | − PSB_WSGX32(dev_priv->gtt.gatt_start, PSB_CR_BIF_TWOD_REQ_BASE); | |
| 73 | −} | |
| 74 | − | |
| 75 | −/** | |
| 76 | − * psb2_2d_wait_available - wait for FIFO room | |
| 77 | − * @dev_priv: our DRM device | |
| 78 | − * @size: size (in dwords) of the command we want to issue | |
| 79 | − * | |
| 80 | − * Wait until there is room to load the FIFO with our data. If the | |
| 81 | − * device is not responding then reset it | |
| 82 | − */ | |
| 83 | −static int psb_2d_wait_available(struct drm_psb_private *dev_priv, | |
| 84 | − unsigned size) | |
| 85 | −{ | |
| 86 | − uint32_t avail = PSB_RSGX32(PSB_CR_2D_SOCIF); | |
| 87 | − unsigned long t = jiffies + HZ; | |
| 88 | − | |
| 89 | − while (avail < size) { | |
| 90 | − avail = PSB_RSGX32(PSB_CR_2D_SOCIF); | |
| 91 | − if (time_after(jiffies, t)) { | |
| 92 | − psb_spank(dev_priv); | |
| 93 | − return -EIO; | |
| 94 | − } | |
| 95 | − } | |
| 96 | − return 0; | |
| 97 | −} | |
| 98 | − | |
| 99 | −/** | |
| 100 | − * psb_2d_submit - submit a 2D command | |
| 101 | − * @dev_priv: our DRM device | |
| 102 | − * @cmdbuf: command to issue | |
| 103 | − * @size: length (in dwords) | |
| 104 | − * | |
| 105 | − * Issue one or more 2D commands to the accelerator. This needs to be | |
| 106 | − * serialized later when we add the GEM interfaces for acceleration | |
| 107 | − */ | |
| 108 | −static int psbfb_2d_submit(struct drm_psb_private *dev_priv, uint32_t *cmdbuf, | |
| 109 | − unsigned size) | |
| 110 | −{ | |
| 111 | − int ret = 0; | |
| 112 | − int i; | |
| 113 | − unsigned submit_size; | |
| 114 | − unsigned long flags; | |
| 115 | − | |
| 116 | − spin_lock_irqsave(&dev_priv->lock_2d, flags); | |
| 117 | − while (size > 0) { | |
| 118 | − submit_size = (size < 0x60) ? size : 0x60; | |
| 119 | − size -= submit_size; | |
| 120 | − ret = psb_2d_wait_available(dev_priv, submit_size); | |
| 121 | − if (ret) | |
| 122 | − break; | |
| 123 | − | |
| 124 | − submit_size <<= 2; | |
| 125 | − | |
| 126 | − for (i = 0; i < submit_size; i += 4) | |
| 127 | − PSB_WSGX32(*cmdbuf++, PSB_SGX_2D_SLAVE_PORT + i); | |
| 128 | − | |
| 129 | − (void)PSB_RSGX32(PSB_SGX_2D_SLAVE_PORT + i - 4); | |
| 130 | − } | |
| 131 | − spin_unlock_irqrestore(&dev_priv->lock_2d, flags); | |
| 132 | − return ret; | |
| 133 | −} | |
| 134 | − | |
| 135 | − | |
| 136 | −/** | |
| 137 | − * psb_accel_2d_copy_direction - compute blit order | |
| 138 | − * @xdir: X direction of move | |
| 139 | − * @ydir: Y direction of move | |
| 140 | − * | |
| 141 | − * Compute the correct order setings to ensure that an overlapping blit | |
| 142 | − * correctly copies all the pixels. | |
| 143 | − */ | |
| 144 | −static u32 psb_accel_2d_copy_direction(int xdir, int ydir) | |
| 145 | −{ | |
| 146 | − if (xdir < 0) | |
| 147 | − return (ydir < 0) ? PSB_2D_COPYORDER_BR2TL : | |
| 148 | − PSB_2D_COPYORDER_TR2BL; | |
| 149 | − else | |
| 150 | − return (ydir < 0) ? PSB_2D_COPYORDER_BL2TR : | |
| 151 | − PSB_2D_COPYORDER_TL2BR; | |
| 152 | −} | |
| 153 | − | |
| 154 | −/** | |
| 155 | − * psb_accel_2d_copy - accelerated 2D copy | |
| 156 | − * @dev_priv: our DRM device | |
| 157 | − * @src_offset in bytes | |
| 158 | − * @src_stride in bytes | |
| 159 | − * @src_format psb 2D format defines | |
| 160 | − * @dst_offset in bytes | |
| 161 | − * @dst_stride in bytes | |
| 162 | − * @dst_format psb 2D format defines | |
| 163 | − * @src_x offset in pixels | |
| 164 | − * @src_y offset in pixels | |
| 165 | − * @dst_x offset in pixels | |
| 166 | − * @dst_y offset in pixels | |
| 167 | − * @size_x of the copied area | |
| 168 | − * @size_y of the copied area | |
| 169 | − * | |
| 170 | − * Format and issue a 2D accelerated copy command. | |
| 171 | − */ | |
| 172 | −static int psb_accel_2d_copy(struct drm_psb_private *dev_priv, | |
| 173 | − uint32_t src_offset, uint32_t src_stride, | |
| 174 | − uint32_t src_format, uint32_t dst_offset, | |
| 175 | − uint32_t dst_stride, uint32_t dst_format, | |
| 176 | − uint16_t src_x, uint16_t src_y, | |
| 177 | − uint16_t dst_x, uint16_t dst_y, | |
| 178 | − uint16_t size_x, uint16_t size_y) | |
| 179 | −{ | |
| 180 | − uint32_t blit_cmd; | |
| 181 | − uint32_t buffer[10]; | |
| 182 | − uint32_t *buf; | |
| 183 | − uint32_t direction; | |
| 184 | − | |
| 185 | − buf = buffer; | |
| 186 | − | |
| 187 | − direction = | |
| 188 | − psb_accel_2d_copy_direction(src_x - dst_x, src_y - dst_y); | |
| 189 | − | |
| 190 | − if (direction == PSB_2D_COPYORDER_BR2TL || | |
| 191 | − direction == PSB_2D_COPYORDER_TR2BL) { | |
| 192 | − src_x += size_x - 1; | |
| 193 | − dst_x += size_x - 1; | |
| 194 | − } | |
| 195 | − if (direction == PSB_2D_COPYORDER_BR2TL || | |
| 196 | − direction == PSB_2D_COPYORDER_BL2TR) { | |
| 197 | − src_y += size_y - 1; | |
| 198 | − dst_y += size_y - 1; | |
| 199 | − } | |
| 200 | − | |
| 201 | − blit_cmd = | |
| 202 | − PSB_2D_BLIT_BH | | |
| 203 | − PSB_2D_ROT_NONE | | |
| 204 | − PSB_2D_DSTCK_DISABLE | | |
| 205 | − PSB_2D_SRCCK_DISABLE | | |
| 206 | − PSB_2D_USE_PAT | PSB_2D_ROP3_SRCCOPY | direction; | |
| 207 | − | |
| 208 | − *buf++ = PSB_2D_FENCE_BH; | |
| 209 | − *buf++ = | |
| 210 | − PSB_2D_DST_SURF_BH | dst_format | (dst_stride << | |
| 211 | − PSB_2D_DST_STRIDE_SHIFT); | |
| 212 | − *buf++ = dst_offset; | |
| 213 | − *buf++ = | |
| 214 | − PSB_2D_SRC_SURF_BH | src_format | (src_stride << | |
| 215 | − PSB_2D_SRC_STRIDE_SHIFT); | |
| 216 | − *buf++ = src_offset; | |
| 217 | − *buf++ = | |
| 218 | − PSB_2D_SRC_OFF_BH | (src_x << PSB_2D_SRCOFF_XSTART_SHIFT) | | |
| 219 | − (src_y << PSB_2D_SRCOFF_YSTART_SHIFT); | |
| 220 | − *buf++ = blit_cmd; | |
| 221 | − *buf++ = | |
| 222 | − (dst_x << PSB_2D_DST_XSTART_SHIFT) | (dst_y << | |
| 223 | − PSB_2D_DST_YSTART_SHIFT); | |
| 224 | − *buf++ = | |
| 225 | − (size_x << PSB_2D_DST_XSIZE_SHIFT) | (size_y << | |
| 226 | − PSB_2D_DST_YSIZE_SHIFT); | |
| 227 | − *buf++ = PSB_2D_FLUSH_BH; | |
| 228 | − | |
| 229 | − return psbfb_2d_submit(dev_priv, buffer, buf - buffer); | |
| 230 | −} | |
| 231 | − | |
| 232 | −/** | |
| 233 | − * psbfb_copyarea_accel - copyarea acceleration for /dev/fb | |
| 234 | − * @info: our framebuffer | |
| 235 | − * @a: copyarea parameters from the framebuffer core | |
| 236 | − * | |
| 237 | − * Perform a 2D copy via the accelerator | |
| 238 | − */ | |
| 239 | −static void psbfb_copyarea_accel(struct fb_info *info, | |
| 240 | − const struct fb_copyarea *a) | |
| 241 | −{ | |
| 242 | − struct psb_fbdev *fbdev = info->par; | |
| 243 | − struct psb_framebuffer *psbfb = &fbdev->pfb; | |
| 244 | − struct drm_device *dev = psbfb->base.dev; | |
| 245 | − struct drm_framebuffer *fb = fbdev->psb_fb_helper.fb; | |
| 246 | − struct drm_psb_private *dev_priv = dev->dev_private; | |
| 247 | − uint32_t offset; | |
| 248 | − uint32_t stride; | |
| 249 | − uint32_t src_format; | |
| 250 | − uint32_t dst_format; | |
| 251 | − | |
| 252 | − if (!fb) | |
| 253 | − return; | |
| 254 | − | |
| 255 | − offset = psbfb->gtt->offset; | |
| 256 | − stride = fb->pitches[0]; | |
| 257 | − | |
| 258 | − switch (fb->depth) { | |
| 259 | − case 8: | |
| 260 | − src_format = PSB_2D_SRC_332RGB; | |
| 261 | − dst_format = PSB_2D_DST_332RGB; | |
| 262 | − break; | |
| 263 | − case 15: | |
| 264 | − src_format = PSB_2D_SRC_555RGB; | |
| 265 | − dst_format = PSB_2D_DST_555RGB; | |
| 266 | − break; | |
| 267 | − case 16: | |
| 268 | − src_format = PSB_2D_SRC_565RGB; | |
| 269 | − dst_format = PSB_2D_DST_565RGB; | |
| 270 | − break; | |
| 271 | − case 24: | |
| 272 | − case 32: | |
| 273 | − /* this is wrong but since we don't do blending its okay */ | |
| 274 | − src_format = PSB_2D_SRC_8888ARGB; | |
| 275 | − dst_format = PSB_2D_DST_8888ARGB; | |
| 276 | − break; | |
| 277 | − default: | |
| 278 | − /* software fallback */ | |
| 279 | − cfb_copyarea(info, a); | |
| 280 | − return; | |
| 281 | − } | |
| 282 | − | |
| 283 | − if (!gma_power_begin(dev, false)) { | |
| 284 | − cfb_copyarea(info, a); | |
| 285 | − return; | |
| 286 | − } | |
| 287 | − psb_accel_2d_copy(dev_priv, | |
| 288 | − offset, stride, src_format, | |
| 289 | − offset, stride, dst_format, | |
| 290 | − a->sx, a->sy, a->dx, a->dy, a->width, a->height); | |
| 291 | − gma_power_end(dev); | |
| 292 | −} | |
| 293 | − | |
| 294 | −/** | |
| 295 | − * psbfb_copyarea - 2D copy interface | |
| 296 | − * @info: our framebuffer | |
| 297 | − * @region: region to copy | |
| 298 | − * | |
| 299 | − * Copy an area of the framebuffer console either by the accelerator | |
| 300 | − * or directly using the cfb helpers according to the request | |
| 301 | − */ | |
| 302 | −void psbfb_copyarea(struct fb_info *info, | |
| 303 | − const struct fb_copyarea *region) | |
| 304 | −{ | |
| 305 | − if (unlikely(info->state != FBINFO_STATE_RUNNING)) | |
| 306 | − return; | |
| 307 | − | |
| 308 | − /* Avoid the 8 pixel erratum */ | |
| 309 | − if (region->width == 8 || region->height == 8 || | |
| 310 | − (info->flags & FBINFO_HWACCEL_DISABLED)) | |
| 311 | − return cfb_copyarea(info, region); | |
| 312 | − | |
| 313 | − psbfb_copyarea_accel(info, region); | |
| 314 | −} | |
| 315 | − | |
| 316 | −/** | |
| 317 | − * psbfb_sync - synchronize 2D | |
| 318 | − * @info: our framebuffer | |
| 319 | − * | |
| 320 | − * Wait for the 2D engine to quiesce so that we can do CPU | |
| 321 | − * access to the framebuffer again | |
| 322 | − */ | |
| 323 | −int psbfb_sync(struct fb_info *info) | |
| 324 | −{ | |
| 325 | − struct psb_fbdev *fbdev = info->par; | |
| 326 | − struct psb_framebuffer *psbfb = &fbdev->pfb; | |
| 327 | − struct drm_device *dev = psbfb->base.dev; | |
| 328 | − struct drm_psb_private *dev_priv = dev->dev_private; | |
| 329 | − unsigned long _end = jiffies + DRM_HZ; | |
| 330 | − int busy = 0; | |
| 331 | − unsigned long flags; | |
| 332 | − | |
| 333 | − spin_lock_irqsave(&dev_priv->lock_2d, flags); | |
| 334 | − /* | |
| 335 | − * First idle the 2D engine. | |
| 336 | − */ | |
| 337 | − | |
| 338 | − if ((PSB_RSGX32(PSB_CR_2D_SOCIF) == _PSB_C2_SOCIF_EMPTY) && | |
| 339 | − ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) & _PSB_C2B_STATUS_BUSY) == 0)) | |
| 340 | − goto out; | |
| 341 | − | |
| 342 | − do { | |
| 343 | − busy = (PSB_RSGX32(PSB_CR_2D_SOCIF) != _PSB_C2_SOCIF_EMPTY); | |
| 344 | − cpu_relax(); | |
| 345 | − } while (busy && !time_after_eq(jiffies, _end)); | |
| 346 | − | |
| 347 | − if (busy) | |
| 348 | − busy = (PSB_RSGX32(PSB_CR_2D_SOCIF) != _PSB_C2_SOCIF_EMPTY); | |
| 349 | − if (busy) | |
| 350 | − goto out; | |
| 351 | − | |
| 352 | − do { | |
| 353 | − busy = ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) & | |
| 354 | − _PSB_C2B_STATUS_BUSY) != 0); | |
| 355 | − cpu_relax(); | |
| 356 | − } while (busy && !time_after_eq(jiffies, _end)); | |
| 357 | − if (busy) | |
| 358 | − busy = ((PSB_RSGX32(PSB_CR_2D_BLIT_STATUS) & | |
| 359 | − _PSB_C2B_STATUS_BUSY) != 0); | |
| 360 | − | |
| 361 | −out: | |
| 362 | − spin_unlock_irqrestore(&dev_priv->lock_2d, flags); | |
| 363 | − return (busy) ? -EBUSY : 0; | |
| 364 | −} | |
| 365 | − | |
| 366 | −int psb_accel_ioctl(struct drm_device *dev, void *data, struct drm_file *file) | |
| 367 | −{ | |
| 368 | − struct drm_psb_private *dev_priv = dev->dev_private; | |
| 369 | − struct drm_psb_2d_op *op = data; | |
| 370 | − u32 *op_ptr = &op->cmd[0]; | |
| 371 | − int i; | |
| 372 | − struct drm_gem_object *obj; | |
| 373 | − struct gtt_range *gtt; | |
| 374 | − int err = -EINVAL; | |
| 375 | − | |
| 376 | − if (!dev_priv->ops->accel_2d) | |
| 377 | − return -EOPNOTSUPP; | |
| 378 | − if (op->size > PSB_2D_OP_BUFLEN) | |
| 379 | − return -EINVAL; | |
| 380 | − | |
| 381 | − /* The GEM object being used. We need to support separate src/dst/etc | |
| 382 | − in the end but for now keep them all the same */ | |
| 383 | − obj = drm_gem_object_lookup(dev, file, op->src); | |
| 384 | − if (obj == NULL) | |
| 385 | − return -ENOENT; | |
| 386 | − gtt = container_of(obj, struct gtt_range, gem); | |
| 387 | − | |
| 388 | − if (psb_gtt_pin(gtt) < 0) | |
| 389 | − goto bad_2; | |
| 390 | − for (i = 0; i < op->size; i++, op_ptr++) { | |
| 391 | − u32 r = *op_ptr & 0xF0000000; | |
| 392 | − /* Fill in the GTT offsets for the command buffer */ | |
| 393 | − if (r == PSB_2D_SRC_SURF_BH || | |
| 394 | − r == PSB_2D_DST_SURF_BH || | |
| 395 | − r == PSB_2D_MASK_SURF_BH || | |
| 396 | − r == PSB_2D_PAT_SURF_BH) { | |
| 397 | − i++; | |
| 398 | − op_ptr++; | |
| 399 | − if (i == op->size) | |
| 400 | − goto bad; | |
| 401 | − if (*op_ptr) | |
| 402 | − goto bad; | |
| 403 | − *op_ptr = gtt->offset; | |
| 404 | − continue; | |
| 405 | − } | |
| 406 | − } | |
| 407 | − psbfb_2d_submit(dev_priv, op->cmd, op->size); | |
| 408 | − err = 0; | |
| 409 | −bad: | |
| 410 | − psb_gtt_unpin(gtt); | |
| 411 | −bad_2: | |
| 412 | − drm_gem_object_unreference(obj); | |
| 413 | − return err; | |
| 414 | −} | |
| @@ -1,49 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * GMA500 Backlight Interface | |
| 3 | − * | |
| 4 | − * Copyright (c) 2009-2011, Intel Corporation. | |
| 5 | − * | |
| 6 | − * This program is free software; you can redistribute it and/or modify it | |
| 7 | − * under the terms and conditions of the GNU General Public License, | |
| 8 | − * version 2, as published by the Free Software Foundation. | |
| 9 | − * | |
| 10 | − * This program is distributed in the hope it will be useful, but WITHOUT | |
| 11 | − * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 12 | − * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
| 13 | − * more details. | |
| 14 | − * | |
| 15 | − * You should have received a copy of the GNU General Public License along with | |
| 16 | − * this program; if not, write to the Free Software Foundation, Inc., | |
| 17 | − * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | |
| 18 | − * | |
| 19 | − * Authors: Eric Knopp | |
| 20 | − * | |
| 21 | − */ | |
| 22 | − | |
| 23 | −#include "psb_drv.h" | |
| 24 | −#include "psb_intel_reg.h" | |
| 25 | −#include "psb_intel_drv.h" | |
| 26 | −#include "intel_bios.h" | |
| 27 | −#include "power.h" | |
| 28 | − | |
| 29 | −int gma_backlight_init(struct drm_device *dev) | |
| 30 | −{ | |
| 31 | −#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE | |
| 32 | − struct drm_psb_private *dev_priv = dev->dev_private; | |
| 33 | − return dev_priv->ops->backlight_init(dev); | |
| 34 | −#else | |
| 35 | − return 0; | |
| 36 | −#endif | |
| 37 | −} | |
| 38 | − | |
| 39 | −void gma_backlight_exit(struct drm_device *dev) | |
| 40 | −{ | |
| 41 | −#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE | |
| 42 | − struct drm_psb_private *dev_priv = dev->dev_private; | |
| 43 | − if (dev_priv->backlight_device) { | |
| 44 | − dev_priv->backlight_device->props.brightness = 0; | |
| 45 | − backlight_update_status(dev_priv->backlight_device); | |
| 46 | − backlight_device_unregister(dev_priv->backlight_device); | |
| 47 | − } | |
| 48 | −#endif | |
| 49 | −} | |
| @@ -1,350 +0,0 @@ | ||
| 1 | −/************************************************************************** | |
| 2 | − * Copyright (c) 2011, Intel Corporation. | |
| 3 | − * All Rights Reserved. | |
| 4 | − * | |
| 5 | − * This program is free software; you can redistribute it and/or modify it | |
| 6 | − * under the terms and conditions of the GNU General Public License, | |
| 7 | − * version 2, as published by the Free Software Foundation. | |
| 8 | − * | |
| 9 | − * This program is distributed in the hope it will be useful, but WITHOUT | |
| 10 | − * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 11 | − * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
| 12 | − * more details. | |
| 13 | − * | |
| 14 | − * You should have received a copy of the GNU General Public License along with | |
| 15 | − * this program; if not, write to the Free Software Foundation, Inc., | |
| 16 | − * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | |
| 17 | − * | |
| 18 | − **************************************************************************/ | |
| 19 | − | |
| 20 | −#include <linux/backlight.h> | |
| 21 | −#include <drm/drmP.h> | |
| 22 | −#include <drm/drm.h> | |
| 23 | −#include "psb_drm.h" | |
| 24 | −#include "psb_drv.h" | |
| 25 | −#include "psb_reg.h" | |
| 26 | −#include "psb_intel_reg.h" | |
| 27 | −#include "intel_bios.h" | |
| 28 | −#include "cdv_device.h" | |
| 29 | − | |
| 30 | −#define VGA_SR_INDEX 0x3c4 | |
| 31 | −#define VGA_SR_DATA 0x3c5 | |
| 32 | − | |
| 33 | −static void cdv_disable_vga(struct drm_device *dev) | |
| 34 | −{ | |
| 35 | − u8 sr1; | |
| 36 | − u32 vga_reg; | |
| 37 | − | |
| 38 | − vga_reg = VGACNTRL; | |
| 39 | − | |
| 40 | − outb(1, VGA_SR_INDEX); | |
| 41 | − sr1 = inb(VGA_SR_DATA); | |
| 42 | − outb(sr1 | 1<<5, VGA_SR_DATA); | |
| 43 | − udelay(300); | |
| 44 | − | |
| 45 | − REG_WRITE(vga_reg, VGA_DISP_DISABLE); | |
| 46 | − REG_READ(vga_reg); | |
| 47 | −} | |
| 48 | − | |
| 49 | −static int cdv_output_init(struct drm_device *dev) | |
| 50 | −{ | |
| 51 | − struct drm_psb_private *dev_priv = dev->dev_private; | |
| 52 | − cdv_disable_vga(dev); | |
| 53 | − | |
| 54 | − cdv_intel_crt_init(dev, &dev_priv->mode_dev); | |
| 55 | − cdv_intel_lvds_init(dev, &dev_priv->mode_dev); | |
| 56 | − | |
| 57 | − /* These bits indicate HDMI not SDVO on CDV, but we don't yet support | |
| 58 | − the HDMI interface */ | |
| 59 | − if (REG_READ(SDVOB) & SDVO_DETECTED) | |
| 60 | − cdv_hdmi_init(dev, &dev_priv->mode_dev, SDVOB); | |
| 61 | − if (REG_READ(SDVOC) & SDVO_DETECTED) | |
| 62 | − cdv_hdmi_init(dev, &dev_priv->mode_dev, SDVOC); | |
| 63 | − return 0; | |
| 64 | −} | |
| 65 | − | |
| 66 | −#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE | |
| 67 | − | |
| 68 | −/* | |
| 69 | − * Poulsbo Backlight Interfaces | |
| 70 | − */ | |
| 71 | − | |
| 72 | −#define BLC_PWM_PRECISION_FACTOR 100 /* 10000000 */ | |
| 73 | −#define BLC_PWM_FREQ_CALC_CONSTANT 32 | |
| 74 | −#define MHz 1000000 | |
| 75 | − | |
| 76 | −#define PSB_BLC_PWM_PRECISION_FACTOR 10 | |
| 77 | −#define PSB_BLC_MAX_PWM_REG_FREQ 0xFFFE | |
| 78 | −#define PSB_BLC_MIN_PWM_REG_FREQ 0x2 | |
| 79 | − | |
| 80 | −#define PSB_BACKLIGHT_PWM_POLARITY_BIT_CLEAR (0xFFFE) | |
| 81 | −#define PSB_BACKLIGHT_PWM_CTL_SHIFT (16) | |
| 82 | − | |
| 83 | −static int cdv_brightness; | |
| 84 | −static struct backlight_device *cdv_backlight_device; | |
| 85 | − | |
| 86 | −static int cdv_get_brightness(struct backlight_device *bd) | |
| 87 | −{ | |
| 88 | − /* return locally cached var instead of HW read (due to DPST etc.) */ | |
| 89 | − /* FIXME: ideally return actual value in case firmware fiddled with | |
| 90 | − it */ | |
| 91 | − return cdv_brightness; | |
| 92 | −} | |
| 93 | − | |
| 94 | − | |
| 95 | −static int cdv_backlight_setup(struct drm_device *dev) | |
| 96 | −{ | |
| 97 | − struct drm_psb_private *dev_priv = dev->dev_private; | |
| 98 | − unsigned long core_clock; | |
| 99 | − /* u32 bl_max_freq; */ | |
| 100 | − /* unsigned long value; */ | |
| 101 | − u16 bl_max_freq; | |
| 102 | − uint32_t value; | |
| 103 | − uint32_t blc_pwm_precision_factor; | |
| 104 | − | |
| 105 | − /* get bl_max_freq and pol from dev_priv*/ | |
| 106 | − if (!dev_priv->lvds_bl) { | |
| 107 | − dev_err(dev->dev, "Has no valid LVDS backlight info\n"); | |
| 108 | − return -ENOENT; | |
| 109 | − } | |
| 110 | − bl_max_freq = dev_priv->lvds_bl->freq; | |
| 111 | − blc_pwm_precision_factor = PSB_BLC_PWM_PRECISION_FACTOR; | |
| 112 | − | |
| 113 | − core_clock = dev_priv->core_freq; | |
| 114 | − | |
| 115 | − value = (core_clock * MHz) / BLC_PWM_FREQ_CALC_CONSTANT; | |
| 116 | − value *= blc_pwm_precision_factor; | |
| 117 | − value /= bl_max_freq; | |
| 118 | − value /= blc_pwm_precision_factor; | |
| 119 | − | |
| 120 | − if (value > (unsigned long long)PSB_BLC_MAX_PWM_REG_FREQ || | |
| 121 | − value < (unsigned long long)PSB_BLC_MIN_PWM_REG_FREQ) | |
| 122 | − return -ERANGE; | |
| 123 | − else { | |
| 124 | − /* FIXME */ | |
| 125 | − } | |
| 126 | − return 0; | |
| 127 | −} | |
| 128 | − | |
| 129 | −static int cdv_set_brightness(struct backlight_device *bd) | |
| 130 | −{ | |
| 131 | − int level = bd->props.brightness; | |
| 132 | − | |
| 133 | − /* Percentage 1-100% being valid */ | |
| 134 | − if (level < 1) | |
| 135 | − level = 1; | |
| 136 | − | |
| 137 | − /*cdv_intel_lvds_set_brightness(dev, level); FIXME */ | |
| 138 | − cdv_brightness = level; | |
| 139 | − return 0; | |
| 140 | −} | |
| 141 | − | |
| 142 | −static const struct backlight_ops cdv_ops = { | |
| 143 | − .get_brightness = cdv_get_brightness, | |
| 144 | − .update_status = cdv_set_brightness, | |
| 145 | −}; | |
| 146 | − | |
| 147 | −static int cdv_backlight_init(struct drm_device *dev) | |
| 148 | −{ | |
| 149 | − struct drm_psb_private *dev_priv = dev->dev_private; | |
| 150 | − int ret; | |
| 151 | − struct backlight_properties props; | |
| 152 | − | |
| 153 | − memset(&props, 0, sizeof(struct backlight_properties)); | |
| 154 | − props.max_brightness = 100; | |
| 155 | − props.type = BACKLIGHT_PLATFORM; | |
| 156 | − | |
| 157 | − cdv_backlight_device = backlight_device_register("psb-bl", | |
| 158 | − NULL, (void *)dev, &cdv_ops, &props); | |
| 159 | − if (IS_ERR(cdv_backlight_device)) | |
| 160 | − return PTR_ERR(cdv_backlight_device); | |
| 161 | − | |
| 162 | − ret = cdv_backlight_setup(dev); | |
| 163 | − if (ret < 0) { | |
| 164 | − backlight_device_unregister(cdv_backlight_device); | |
| 165 | − cdv_backlight_device = NULL; | |
| 166 | − return ret; | |
| 167 | − } | |
| 168 | − cdv_backlight_device->props.brightness = 100; | |
| 169 | − cdv_backlight_device->props.max_brightness = 100; | |
| 170 | − backlight_update_status(cdv_backlight_device); | |
| 171 | − dev_priv->backlight_device = cdv_backlight_device; | |
| 172 | − return 0; | |
| 173 | −} | |
| 174 | − | |
| 175 | −#endif | |
| 176 | − | |
| 177 | −/* | |
| 178 | − * Provide the Cedarview specific chip logic and low level methods | |
| 179 | − * for power management | |
| 180 | − * | |
| 181 | − * FIXME: we need to implement the apm/ospm base management bits | |
| 182 | − * for this and the MID devices. | |
| 183 | − */ | |
| 184 | − | |
| 185 | −static inline u32 CDV_MSG_READ32(uint port, uint offset) | |
| 186 | −{ | |
| 187 | − int mcr = (0x10<<24) | (port << 16) | (offset << 8); | |
| 188 | − uint32_t ret_val = 0; | |
| 189 | − struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0); | |
| 190 | − pci_write_config_dword(pci_root, 0xD0, mcr); | |
| 191 | − pci_read_config_dword(pci_root, 0xD4, &ret_val); | |
| 192 | − pci_dev_put(pci_root); | |
| 193 | − return ret_val; | |
| 194 | −} | |
| 195 | − | |
| 196 | −static inline void CDV_MSG_WRITE32(uint port, uint offset, u32 value) | |
| 197 | −{ | |
| 198 | − int mcr = (0x11<<24) | (port << 16) | (offset << 8) | 0xF0; | |
| 199 | − struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0); | |
| 200 | − pci_write_config_dword(pci_root, 0xD4, value); | |
| 201 | − pci_write_config_dword(pci_root, 0xD0, mcr); | |
| 202 | − pci_dev_put(pci_root); | |
| 203 | −} | |
| 204 | − | |
| 205 | −#define PSB_APM_CMD 0x0 | |
| 206 | −#define PSB_APM_STS 0x04 | |
| 207 | −#define PSB_PM_SSC 0x20 | |
| 208 | −#define PSB_PM_SSS 0x30 | |
| 209 | −#define PSB_PWRGT_GFX_MASK 0x3 | |
| 210 | −#define CDV_PWRGT_DISPLAY_CNTR 0x000fc00c | |
| 211 | −#define CDV_PWRGT_DISPLAY_STS 0x000fc00c | |
| 212 | − | |
| 213 | −static void cdv_init_pm(struct drm_device *dev) | |
| 214 | −{ | |
| 215 | − struct drm_psb_private *dev_priv = dev->dev_private; | |
| 216 | − u32 pwr_cnt; | |
| 217 | − int i; | |
| 218 | − | |
| 219 | − dev_priv->apm_base = CDV_MSG_READ32(PSB_PUNIT_PORT, | |
| 220 | − PSB_APMBA) & 0xFFFF; | |
| 221 | − dev_priv->ospm_base = CDV_MSG_READ32(PSB_PUNIT_PORT, | |
| 222 | − PSB_OSPMBA) & 0xFFFF; | |
| 223 | − | |
| 224 | − /* Force power on for now */ | |
| 225 | − pwr_cnt = inl(dev_priv->apm_base + PSB_APM_CMD); | |
| 226 | − pwr_cnt &= ~PSB_PWRGT_GFX_MASK; | |
| 227 | − | |
| 228 | − outl(pwr_cnt, dev_priv->apm_base + PSB_APM_CMD); | |
| 229 | − for (i = 0; i < 5; i++) { | |
| 230 | − u32 pwr_sts = inl(dev_priv->apm_base + PSB_APM_STS); | |
| 231 | − if ((pwr_sts & PSB_PWRGT_GFX_MASK) == 0) | |
| 232 | − break; | |
| 233 | − udelay(10); | |
| 234 | − } | |
| 235 | − pwr_cnt = inl(dev_priv->ospm_base + PSB_PM_SSC); | |
| 236 | − pwr_cnt &= ~CDV_PWRGT_DISPLAY_CNTR; | |
| 237 | − outl(pwr_cnt, dev_priv->ospm_base + PSB_PM_SSC); | |
| 238 | − for (i = 0; i < 5; i++) { | |
| 239 | − u32 pwr_sts = inl(dev_priv->ospm_base + PSB_PM_SSS); | |
| 240 | − if ((pwr_sts & CDV_PWRGT_DISPLAY_STS) == 0) | |
| 241 | − break; | |
| 242 | − udelay(10); | |
| 243 | − } | |
| 244 | −} | |
| 245 | − | |
| 246 | −/** | |
| 247 | − * cdv_save_display_registers - save registers lost on suspend | |
| 248 | − * @dev: our DRM device | |
| 249 | − * | |
| 250 | − * Save the state we need in order to be able to restore the interface | |
| 251 | − * upon resume from suspend | |
| 252 | − * | |
| 253 | − * FIXME: review | |
| 254 | − */ | |
| 255 | −static int cdv_save_display_registers(struct drm_device *dev) | |
| 256 | −{ | |
| 257 | − return 0; | |
| 258 | −} | |
| 259 | − | |
| 260 | −/** | |
| 261 | − * cdv_restore_display_registers - restore lost register state | |
| 262 | − * @dev: our DRM device | |
| 263 | − * | |
| 264 | − * Restore register state that was lost during suspend and resume. | |
| 265 | − * | |
| 266 | − * FIXME: review | |
| 267 | − */ | |
| 268 | −static int cdv_restore_display_registers(struct drm_device *dev) | |
| 269 | −{ | |
| 270 | − return 0; | |
| 271 | −} | |
| 272 | − | |
| 273 | −static int cdv_power_down(struct drm_device *dev) | |
| 274 | −{ | |
| 275 | − return 0; | |
| 276 | −} | |
| 277 | − | |
| 278 | −static int cdv_power_up(struct drm_device *dev) | |
| 279 | −{ | |
| 280 | − return 0; | |
| 281 | −} | |
| 282 | − | |
| 283 | −/* FIXME ? - shared with Poulsbo */ | |
| 284 | −static void cdv_get_core_freq(struct drm_device *dev) | |
| 285 | −{ | |
| 286 | − uint32_t clock; | |
| 287 | − struct pci_dev *pci_root = pci_get_bus_and_slot(0, 0); | |
| 288 | − struct drm_psb_private *dev_priv = dev->dev_private; | |
| 289 | − | |
| 290 | − pci_write_config_dword(pci_root, 0xD0, 0xD0050300); | |
| 291 | − pci_read_config_dword(pci_root, 0xD4, &clock); | |
| 292 | − pci_dev_put(pci_root); | |
| 293 | − | |
| 294 | − switch (clock & 0x07) { | |
| 295 | − case 0: | |
| 296 | − dev_priv->core_freq = 100; | |
| 297 | − break; | |
| 298 | − case 1: | |
| 299 | − dev_priv->core_freq = 133; | |
| 300 | − break; | |
| 301 | − case 2: | |
| 302 | − dev_priv->core_freq = 150; | |
| 303 | − break; | |
| 304 | − case 3: | |
| 305 | − dev_priv->core_freq = 178; | |
| 306 | − break; | |
| 307 | − case 4: | |
| 308 | − dev_priv->core_freq = 200; | |
| 309 | − break; | |
| 310 | − case 5: | |
| 311 | − case 6: | |
| 312 | − case 7: | |
| 313 | − dev_priv->core_freq = 266; | |
| 314 | − default: | |
| 315 | − dev_priv->core_freq = 0; | |
| 316 | − } | |
| 317 | −} | |
| 318 | − | |
| 319 | −static int cdv_chip_setup(struct drm_device *dev) | |
| 320 | −{ | |
| 321 | − cdv_get_core_freq(dev); | |
| 322 | − gma_intel_opregion_init(dev); | |
| 323 | − psb_intel_init_bios(dev); | |
| 324 | − return 0; | |
| 325 | −} | |
| 326 | − | |
| 327 | −/* CDV is much like Poulsbo but has MID like SGX offsets and PM */ | |
| 328 | − | |
| 329 | −const struct psb_ops cdv_chip_ops = { | |
| 330 | − .name = "Cedartrail", | |
| 331 | − .accel_2d = 0, | |
| 332 | − .pipes = 2, | |
| 333 | − .sgx_offset = MRST_SGX_OFFSET, | |
| 334 | − .chip_setup = cdv_chip_setup, | |
| 335 | − | |
| 336 | − .crtc_helper = &cdv_intel_helper_funcs, | |
| 337 | − .crtc_funcs = &cdv_intel_crtc_funcs, | |
| 338 | − | |
| 339 | − .output_init = cdv_output_init, | |
| 340 | − | |
| 341 | −#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE | |
| 342 | − .backlight_init = cdv_backlight_init, | |
| 343 | −#endif | |
| 344 | − | |
| 345 | − .init_pm = cdv_init_pm, | |
| 346 | − .save_regs = cdv_save_display_registers, | |
| 347 | − .restore_regs = cdv_restore_display_registers, | |
| 348 | − .power_down = cdv_power_down, | |
| 349 | − .power_up = cdv_power_up, | |
| 350 | −}; | |
| @@ -1,36 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright © 2011 Intel Corporation | |
| 3 | − * | |
| 4 | − * This program is free software; you can redistribute it and/or modify it | |
| 5 | − * under the terms and conditions of the GNU General Public License, | |
| 6 | − * version 2, as published by the Free Software Foundation. | |
| 7 | − * | |
| 8 | − * This program is distributed in the hope it will be useful, but WITHOUT | |
| 9 | − * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 10 | − * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
| 11 | − * more details. | |
| 12 | − * | |
| 13 | − * You should have received a copy of the GNU General Public License along with | |
| 14 | − * this program; if not, write to the Free Software Foundation, Inc., | |
| 15 | − * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | |
| 16 | − */ | |
| 17 | − | |
| 18 | −extern const struct drm_crtc_helper_funcs cdv_intel_helper_funcs; | |
| 19 | −extern const struct drm_crtc_funcs cdv_intel_crtc_funcs; | |
| 20 | −extern void cdv_intel_crt_init(struct drm_device *dev, | |
| 21 | − struct psb_intel_mode_device *mode_dev); | |
| 22 | −extern void cdv_intel_lvds_init(struct drm_device *dev, | |
| 23 | − struct psb_intel_mode_device *mode_dev); | |
| 24 | −extern void cdv_hdmi_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev, | |
| 25 | − int reg); | |
| 26 | −extern struct drm_display_mode *cdv_intel_crtc_mode_get(struct drm_device *dev, | |
| 27 | − struct drm_crtc *crtc); | |
| 28 | − | |
| 29 | −extern inline void cdv_intel_wait_for_vblank(struct drm_device *dev) | |
| 30 | −{ | |
| 31 | − /* Wait for 20ms, i.e. one cycle at 50hz. */ | |
| 32 | − /* FIXME: msleep ?? */ | |
| 33 | − mdelay(20); | |
| 34 | −} | |
| 35 | − | |
| 36 | − | |
| @@ -1,326 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright © 2006-2007 Intel Corporation | |
| 3 | − * | |
| 4 | − * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | − * copy of this software and associated documentation files (the "Software"), | |
| 6 | − * to deal in the Software without restriction, including without limitation | |
| 7 | − * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| 8 | − * and/or sell copies of the Software, and to permit persons to whom the | |
| 9 | − * Software is furnished to do so, subject to the following conditions: | |
| 10 | − * | |
| 11 | − * The above copyright notice and this permission notice (including the next | |
| 12 | − * paragraph) shall be included in all copies or substantial portions of the | |
| 13 | − * Software. | |
| 14 | − * | |
| 15 | − * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 16 | − * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 17 | − * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 18 | − * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 19 | − * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
| 20 | − * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
| 21 | − * DEALINGS IN THE SOFTWARE. | |
| 22 | − * | |
| 23 | − * Authors: | |
| 24 | − * Eric Anholt <eric@anholt.net> | |
| 25 | − */ | |
| 26 | − | |
| 27 | −#include <linux/i2c.h> | |
| 28 | −#include <drm/drmP.h> | |
| 29 | − | |
| 30 | −#include "intel_bios.h" | |
| 31 | −#include "psb_drv.h" | |
| 32 | −#include "psb_intel_drv.h" | |
| 33 | −#include "psb_intel_reg.h" | |
| 34 | −#include "power.h" | |
| 35 | −#include <linux/pm_runtime.h> | |
| 36 | − | |
| 37 | − | |
| 38 | −static void cdv_intel_crt_dpms(struct drm_encoder *encoder, int mode) | |
| 39 | −{ | |
| 40 | − struct drm_device *dev = encoder->dev; | |
| 41 | − u32 temp, reg; | |
| 42 | − reg = ADPA; | |
| 43 | − | |
| 44 | − temp = REG_READ(reg); | |
| 45 | − temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE); | |
| 46 | − temp &= ~ADPA_DAC_ENABLE; | |
| 47 | − | |
| 48 | − switch (mode) { | |
| 49 | − case DRM_MODE_DPMS_ON: | |
| 50 | − temp |= ADPA_DAC_ENABLE; | |
| 51 | − break; | |
| 52 | − case DRM_MODE_DPMS_STANDBY: | |
| 53 | − temp |= ADPA_DAC_ENABLE | ADPA_HSYNC_CNTL_DISABLE; | |
| 54 | − break; | |
| 55 | − case DRM_MODE_DPMS_SUSPEND: | |
| 56 | − temp |= ADPA_DAC_ENABLE | ADPA_VSYNC_CNTL_DISABLE; | |
| 57 | − break; | |
| 58 | − case DRM_MODE_DPMS_OFF: | |
| 59 | − temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE; | |
| 60 | − break; | |
| 61 | − } | |
| 62 | − | |
| 63 | − REG_WRITE(reg, temp); | |
| 64 | −} | |
| 65 | − | |
| 66 | −static int cdv_intel_crt_mode_valid(struct drm_connector *connector, | |
| 67 | − struct drm_display_mode *mode) | |
| 68 | −{ | |
| 69 | − int max_clock = 0; | |
| 70 | − if (mode->flags & DRM_MODE_FLAG_DBLSCAN) | |
| 71 | − return MODE_NO_DBLESCAN; | |
| 72 | − | |
| 73 | − /* The lowest clock for CDV is 20000KHz */ | |
| 74 | − if (mode->clock < 20000) | |
| 75 | − return MODE_CLOCK_LOW; | |
| 76 | − | |
| 77 | − /* The max clock for CDV is 355 instead of 400 */ | |
| 78 | − max_clock = 355000; | |
| 79 | − if (mode->clock > max_clock) | |
| 80 | − return MODE_CLOCK_HIGH; | |
| 81 | − | |
| 82 | − if (mode->hdisplay > 1680 || mode->vdisplay > 1050) | |
| 83 | − return MODE_PANEL; | |
| 84 | − | |
| 85 | − return MODE_OK; | |
| 86 | −} | |
| 87 | − | |
| 88 | −static bool cdv_intel_crt_mode_fixup(struct drm_encoder *encoder, | |
| 89 | − struct drm_display_mode *mode, | |
| 90 | − struct drm_display_mode *adjusted_mode) | |
| 91 | −{ | |
| 92 | − return true; | |
| 93 | −} | |
| 94 | − | |
| 95 | −static void cdv_intel_crt_mode_set(struct drm_encoder *encoder, | |
| 96 | − struct drm_display_mode *mode, | |
| 97 | − struct drm_display_mode *adjusted_mode) | |
| 98 | −{ | |
| 99 | − | |
| 100 | − struct drm_device *dev = encoder->dev; | |
| 101 | − struct drm_crtc *crtc = encoder->crtc; | |
| 102 | − struct psb_intel_crtc *psb_intel_crtc = | |
| 103 | − to_psb_intel_crtc(crtc); | |
| 104 | − int dpll_md_reg; | |
| 105 | − u32 adpa, dpll_md; | |
| 106 | − u32 adpa_reg; | |
| 107 | − | |
| 108 | − if (psb_intel_crtc->pipe == 0) | |
| 109 | − dpll_md_reg = DPLL_A_MD; | |
| 110 | − else | |
| 111 | − dpll_md_reg = DPLL_B_MD; | |
| 112 | − | |
| 113 | − adpa_reg = ADPA; | |
| 114 | − | |
| 115 | − /* | |
| 116 | − * Disable separate mode multiplier used when cloning SDVO to CRT | |
| 117 | − * XXX this needs to be adjusted when we really are cloning | |
| 118 | − */ | |
| 119 | − { | |
| 120 | − dpll_md = REG_READ(dpll_md_reg); | |
| 121 | − REG_WRITE(dpll_md_reg, | |
| 122 | − dpll_md & ~DPLL_MD_UDI_MULTIPLIER_MASK); | |
| 123 | − } | |
| 124 | − | |
| 125 | − adpa = 0; | |
| 126 | − if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | |
| 127 | − adpa |= ADPA_HSYNC_ACTIVE_HIGH; | |
| 128 | − if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) | |
| 129 | − adpa |= ADPA_VSYNC_ACTIVE_HIGH; | |
| 130 | − | |
| 131 | − if (psb_intel_crtc->pipe == 0) | |
| 132 | − adpa |= ADPA_PIPE_A_SELECT; | |
| 133 | − else | |
| 134 | − adpa |= ADPA_PIPE_B_SELECT; | |
| 135 | − | |
| 136 | − REG_WRITE(adpa_reg, adpa); | |
| 137 | −} | |
| 138 | − | |
| 139 | − | |
| 140 | −/** | |
| 141 | − * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect CRT presence. | |
| 142 | − * | |
| 143 | − * \return true if CRT is connected. | |
| 144 | − * \return false if CRT is disconnected. | |
| 145 | − */ | |
| 146 | −static bool cdv_intel_crt_detect_hotplug(struct drm_connector *connector, | |
| 147 | − bool force) | |
| 148 | −{ | |
| 149 | − struct drm_device *dev = connector->dev; | |
| 150 | − u32 hotplug_en; | |
| 151 | − int i, tries = 0, ret = false; | |
| 152 | − u32 adpa_orig; | |
| 153 | − | |
| 154 | − /* disable the DAC when doing the hotplug detection */ | |
| 155 | − | |
| 156 | − adpa_orig = REG_READ(ADPA); | |
| 157 | − | |
| 158 | − REG_WRITE(ADPA, adpa_orig & ~(ADPA_DAC_ENABLE)); | |
| 159 | − | |
| 160 | − /* | |
| 161 | − * On a CDV thep, CRT detect sequence need to be done twice | |
| 162 | − * to get a reliable result. | |
| 163 | − */ | |
| 164 | − tries = 2; | |
| 165 | − | |
| 166 | − hotplug_en = REG_READ(PORT_HOTPLUG_EN); | |
| 167 | − hotplug_en &= ~(CRT_HOTPLUG_DETECT_MASK); | |
| 168 | − hotplug_en |= CRT_HOTPLUG_FORCE_DETECT; | |
| 169 | − | |
| 170 | − hotplug_en |= CRT_HOTPLUG_ACTIVATION_PERIOD_64; | |
| 171 | − hotplug_en |= CRT_HOTPLUG_VOLTAGE_COMPARE_50; | |
| 172 | − | |
| 173 | − for (i = 0; i < tries ; i++) { | |
| 174 | − unsigned long timeout; | |
| 175 | − /* turn on the FORCE_DETECT */ | |
| 176 | − REG_WRITE(PORT_HOTPLUG_EN, hotplug_en); | |
| 177 | − timeout = jiffies + msecs_to_jiffies(1000); | |
| 178 | − /* wait for FORCE_DETECT to go off */ | |
| 179 | − do { | |
| 180 | − if (!(REG_READ(PORT_HOTPLUG_EN) & | |
| 181 | − CRT_HOTPLUG_FORCE_DETECT)) | |
| 182 | − break; | |
| 183 | − msleep(1); | |
| 184 | − } while (time_after(timeout, jiffies)); | |
| 185 | − } | |
| 186 | − | |
| 187 | − if ((REG_READ(PORT_HOTPLUG_STAT) & CRT_HOTPLUG_MONITOR_MASK) != | |
| 188 | − CRT_HOTPLUG_MONITOR_NONE) | |
| 189 | − ret = true; | |
| 190 | − | |
| 191 | − /* Restore the saved ADPA */ | |
| 192 | − REG_WRITE(ADPA, adpa_orig); | |
| 193 | − return ret; | |
| 194 | −} | |
| 195 | − | |
| 196 | −static enum drm_connector_status cdv_intel_crt_detect( | |
| 197 | − struct drm_connector *connector, bool force) | |
| 198 | −{ | |
| 199 | − if (cdv_intel_crt_detect_hotplug(connector, force)) | |
| 200 | − return connector_status_connected; | |
| 201 | − else | |
| 202 | − return connector_status_disconnected; | |
| 203 | −} | |
| 204 | − | |
| 205 | −static void cdv_intel_crt_destroy(struct drm_connector *connector) | |
| 206 | −{ | |
| 207 | − struct psb_intel_output *intel_output = to_psb_intel_output(connector); | |
| 208 | − | |
| 209 | − psb_intel_i2c_destroy(intel_output->ddc_bus); | |
| 210 | − drm_sysfs_connector_remove(connector); | |
| 211 | − drm_connector_cleanup(connector); | |
| 212 | − kfree(connector); | |
| 213 | −} | |
| 214 | − | |
| 215 | −static int cdv_intel_crt_get_modes(struct drm_connector *connector) | |
| 216 | −{ | |
| 217 | − struct psb_intel_output *intel_output = | |
| 218 | − to_psb_intel_output(connector); | |
| 219 | − return psb_intel_ddc_get_modes(intel_output); | |
| 220 | −} | |
| 221 | − | |
| 222 | −static int cdv_intel_crt_set_property(struct drm_connector *connector, | |
| 223 | − struct drm_property *property, | |
| 224 | − uint64_t value) | |
| 225 | −{ | |
| 226 | − return 0; | |
| 227 | −} | |
| 228 | − | |
| 229 | −/* | |
| 230 | − * Routines for controlling stuff on the analog port | |
| 231 | − */ | |
| 232 | − | |
| 233 | −static const struct drm_encoder_helper_funcs cdv_intel_crt_helper_funcs = { | |
| 234 | − .dpms = cdv_intel_crt_dpms, | |
| 235 | − .mode_fixup = cdv_intel_crt_mode_fixup, | |
| 236 | − .prepare = psb_intel_encoder_prepare, | |
| 237 | − .commit = psb_intel_encoder_commit, | |
| 238 | − .mode_set = cdv_intel_crt_mode_set, | |
| 239 | −}; | |
| 240 | − | |
| 241 | −static const struct drm_connector_funcs cdv_intel_crt_connector_funcs = { | |
| 242 | − .dpms = drm_helper_connector_dpms, | |
| 243 | − .detect = cdv_intel_crt_detect, | |
| 244 | − .fill_modes = drm_helper_probe_single_connector_modes, | |
| 245 | − .destroy = cdv_intel_crt_destroy, | |
| 246 | − .set_property = cdv_intel_crt_set_property, | |
| 247 | −}; | |
| 248 | − | |
| 249 | −static const struct drm_connector_helper_funcs | |
| 250 | − cdv_intel_crt_connector_helper_funcs = { | |
| 251 | − .mode_valid = cdv_intel_crt_mode_valid, | |
| 252 | − .get_modes = cdv_intel_crt_get_modes, | |
| 253 | − .best_encoder = psb_intel_best_encoder, | |
| 254 | −}; | |
| 255 | − | |
| 256 | −static void cdv_intel_crt_enc_destroy(struct drm_encoder *encoder) | |
| 257 | −{ | |
| 258 | − drm_encoder_cleanup(encoder); | |
| 259 | −} | |
| 260 | − | |
| 261 | −static const struct drm_encoder_funcs cdv_intel_crt_enc_funcs = { | |
| 262 | − .destroy = cdv_intel_crt_enc_destroy, | |
| 263 | −}; | |
| 264 | − | |
| 265 | −void cdv_intel_crt_init(struct drm_device *dev, | |
| 266 | − struct psb_intel_mode_device *mode_dev) | |
| 267 | −{ | |
| 268 | − | |
| 269 | − struct psb_intel_output *psb_intel_output; | |
| 270 | − struct drm_connector *connector; | |
| 271 | − struct drm_encoder *encoder; | |
| 272 | − | |
| 273 | − u32 i2c_reg; | |
| 274 | − | |
| 275 | − psb_intel_output = kzalloc(sizeof(struct psb_intel_output), GFP_KERNEL); | |
| 276 | − if (!psb_intel_output) | |
| 277 | − return; | |
| 278 | − | |
| 279 | − psb_intel_output->mode_dev = mode_dev; | |
| 280 | − connector = &psb_intel_output->base; | |
| 281 | − drm_connector_init(dev, connector, | |
| 282 | − &cdv_intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); | |
| 283 | − | |
| 284 | − encoder = &psb_intel_output->enc; | |
| 285 | − drm_encoder_init(dev, encoder, | |
| 286 | − &cdv_intel_crt_enc_funcs, DRM_MODE_ENCODER_DAC); | |
| 287 | − | |
| 288 | − drm_mode_connector_attach_encoder(&psb_intel_output->base, | |
| 289 | − &psb_intel_output->enc); | |
| 290 | − | |
| 291 | − /* Set up the DDC bus. */ | |
| 292 | − i2c_reg = GPIOA; | |
| 293 | − /* Remove the following code for CDV */ | |
| 294 | − /* | |
| 295 | − if (dev_priv->crt_ddc_bus != 0) | |
| 296 | − i2c_reg = dev_priv->crt_ddc_bus; | |
| 297 | − }*/ | |
| 298 | − psb_intel_output->ddc_bus = psb_intel_i2c_create(dev, | |
| 299 | − i2c_reg, "CRTDDC_A"); | |
| 300 | − if (!psb_intel_output->ddc_bus) { | |
| 301 | − dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " | |
| 302 | − "failed.\n"); | |
| 303 | − goto failed_ddc; | |
| 304 | − } | |
| 305 | − | |
| 306 | − psb_intel_output->type = INTEL_OUTPUT_ANALOG; | |
| 307 | − /* | |
| 308 | − psb_intel_output->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT); | |
| 309 | − psb_intel_output->crtc_mask = (1 << 0) | (1 << 1); | |
| 310 | − */ | |
| 311 | − connector->interlace_allowed = 0; | |
| 312 | − connector->doublescan_allowed = 0; | |
| 313 | − | |
| 314 | − drm_encoder_helper_add(encoder, &cdv_intel_crt_helper_funcs); | |
| 315 | − drm_connector_helper_add(connector, | |
| 316 | − &cdv_intel_crt_connector_helper_funcs); | |
| 317 | − | |
| 318 | − drm_sysfs_connector_add(connector); | |
| 319 | − | |
| 320 | − return; | |
| 321 | −failed_ddc: | |
| 322 | − drm_encoder_cleanup(&psb_intel_output->enc); | |
| 323 | − drm_connector_cleanup(&psb_intel_output->base); | |
| 324 | − kfree(psb_intel_output); | |
| 325 | − return; | |
| 326 | −} | |
| @@ -1,1508 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright © 2006-2011 Intel Corporation | |
| 3 | − * | |
| 4 | − * This program is free software; you can redistribute it and/or modify it | |
| 5 | − * under the terms and conditions of the GNU General Public License, | |
| 6 | − * version 2, as published by the Free Software Foundation. | |
| 7 | − * | |
| 8 | − * This program is distributed in the hope it will be useful, but WITHOUT | |
| 9 | − * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 10 | − * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
| 11 | − * more details. | |
| 12 | − * | |
| 13 | − * You should have received a copy of the GNU General Public License along with | |
| 14 | − * this program; if not, write to the Free Software Foundation, Inc., | |
| 15 | − * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | |
| 16 | − * | |
| 17 | − * Authors: | |
| 18 | − * Eric Anholt <eric@anholt.net> | |
| 19 | − */ | |
| 20 | − | |
| 21 | −#include <linux/i2c.h> | |
| 22 | −#include <linux/pm_runtime.h> | |
| 23 | − | |
| 24 | −#include <drm/drmP.h> | |
| 25 | −#include "framebuffer.h" | |
| 26 | −#include "psb_drv.h" | |
| 27 | −#include "psb_intel_drv.h" | |
| 28 | −#include "psb_intel_reg.h" | |
| 29 | −#include "psb_intel_display.h" | |
| 30 | −#include "power.h" | |
| 31 | −#include "cdv_device.h" | |
| 32 | − | |
| 33 | − | |
| 34 | −struct cdv_intel_range_t { | |
| 35 | − int min, max; | |
| 36 | −}; | |
| 37 | − | |
| 38 | −struct cdv_intel_p2_t { | |
| 39 | − int dot_limit; | |
| 40 | − int p2_slow, p2_fast; | |
| 41 | −}; | |
| 42 | − | |
| 43 | −struct cdv_intel_clock_t { | |
| 44 | − /* given values */ | |
| 45 | − int n; | |
| 46 | − int m1, m2; | |
| 47 | − int p1, p2; | |
| 48 | − /* derived values */ | |
| 49 | − int dot; | |
| 50 | − int vco; | |
| 51 | − int m; | |
| 52 | − int p; | |
| 53 | −}; | |
| 54 | − | |
| 55 | −#define INTEL_P2_NUM 2 | |
| 56 | − | |
| 57 | −struct cdv_intel_limit_t { | |
| 58 | − struct cdv_intel_range_t dot, vco, n, m, m1, m2, p, p1; | |
| 59 | − struct cdv_intel_p2_t p2; | |
| 60 | −}; | |
| 61 | − | |
| 62 | −#define CDV_LIMIT_SINGLE_LVDS_96 0 | |
| 63 | −#define CDV_LIMIT_SINGLE_LVDS_100 1 | |
| 64 | −#define CDV_LIMIT_DAC_HDMI_27 2 | |
| 65 | −#define CDV_LIMIT_DAC_HDMI_96 3 | |
| 66 | − | |
| 67 | −static const struct cdv_intel_limit_t cdv_intel_limits[] = { | |
| 68 | − { /* CDV_SIGNLE_LVDS_96MHz */ | |
| 69 | − .dot = {.min = 20000, .max = 115500}, | |
| 70 | − .vco = {.min = 1800000, .max = 3600000}, | |
| 71 | − .n = {.min = 2, .max = 6}, | |
| 72 | − .m = {.min = 60, .max = 160}, | |
| 73 | − .m1 = {.min = 0, .max = 0}, | |
| 74 | − .m2 = {.min = 58, .max = 158}, | |
| 75 | − .p = {.min = 28, .max = 140}, | |
| 76 | − .p1 = {.min = 2, .max = 10}, | |
| 77 | − .p2 = {.dot_limit = 200000, | |
| 78 | − .p2_slow = 14, .p2_fast = 14}, | |
| 79 | − }, | |
| 80 | − { /* CDV_SINGLE_LVDS_100MHz */ | |
| 81 | − .dot = {.min = 20000, .max = 115500}, | |
| 82 | − .vco = {.min = 1800000, .max = 3600000}, | |
| 83 | − .n = {.min = 2, .max = 6}, | |
| 84 | − .m = {.min = 60, .max = 160}, | |
| 85 | − .m1 = {.min = 0, .max = 0}, | |
| 86 | − .m2 = {.min = 58, .max = 158}, | |
| 87 | − .p = {.min = 28, .max = 140}, | |
| 88 | − .p1 = {.min = 2, .max = 10}, | |
| 89 | − /* The single-channel range is 25-112Mhz, and dual-channel | |
| 90 | − * is 80-224Mhz. Prefer single channel as much as possible. | |
| 91 | − */ | |
| 92 | − .p2 = {.dot_limit = 200000, .p2_slow = 14, .p2_fast = 14}, | |
| 93 | − }, | |
| 94 | − { /* CDV_DAC_HDMI_27MHz */ | |
| 95 | − .dot = {.min = 20000, .max = 400000}, | |
| 96 | − .vco = {.min = 1809000, .max = 3564000}, | |
| 97 | − .n = {.min = 1, .max = 1}, | |
| 98 | − .m = {.min = 67, .max = 132}, | |
| 99 | − .m1 = {.min = 0, .max = 0}, | |
| 100 | − .m2 = {.min = 65, .max = 130}, | |
| 101 | − .p = {.min = 5, .max = 90}, | |
| 102 | − .p1 = {.min = 1, .max = 9}, | |
| 103 | − .p2 = {.dot_limit = 225000, .p2_slow = 10, .p2_fast = 5}, | |
| 104 | − }, | |
| 105 | − { /* CDV_DAC_HDMI_96MHz */ | |
| 106 | − .dot = {.min = 20000, .max = 400000}, | |
| 107 | − .vco = {.min = 1800000, .max = 3600000}, | |
| 108 | − .n = {.min = 2, .max = 6}, | |
| 109 | − .m = {.min = 60, .max = 160}, | |
| 110 | − .m1 = {.min = 0, .max = 0}, | |
| 111 | − .m2 = {.min = 58, .max = 158}, | |
| 112 | − .p = {.min = 5, .max = 100}, | |
| 113 | − .p1 = {.min = 1, .max = 10}, | |
| 114 | − .p2 = {.dot_limit = 225000, .p2_slow = 10, .p2_fast = 5}, | |
| 115 | − }, | |
| 116 | −}; | |
| 117 | − | |
| 118 | −#define _wait_for(COND, MS, W) ({ \ | |
| 119 | − unsigned long timeout__ = jiffies + msecs_to_jiffies(MS); \ | |
| 120 | − int ret__ = 0; \ | |
| 121 | − while (!(COND)) { \ | |
| 122 | − if (time_after(jiffies, timeout__)) { \ | |
| 123 | − ret__ = -ETIMEDOUT; \ | |
| 124 | − break; \ | |
| 125 | − } \ | |
| 126 | − if (W && !in_dbg_master()) \ | |
| 127 | − msleep(W); \ | |
| 128 | − } \ | |
| 129 | − ret__; \ | |
| 130 | −}) | |
| 131 | − | |
| 132 | −#define wait_for(COND, MS) _wait_for(COND, MS, 1) | |
| 133 | − | |
| 134 | − | |
| 135 | −static int cdv_sb_read(struct drm_device *dev, u32 reg, u32 *val) | |
| 136 | −{ | |
| 137 | − int ret; | |
| 138 | − | |
| 139 | − ret = wait_for((REG_READ(SB_PCKT) & SB_BUSY) == 0, 1000); | |
| 140 | − if (ret) { | |
| 141 | − DRM_ERROR("timeout waiting for SB to idle before read\n"); | |
| 142 | − return ret; | |
| 143 | − } | |
| 144 | − | |
| 145 | − REG_WRITE(SB_ADDR, reg); | |
| 146 | − REG_WRITE(SB_PCKT, | |
| 147 | − SET_FIELD(SB_OPCODE_READ, SB_OPCODE) | | |
| 148 | − SET_FIELD(SB_DEST_DPLL, SB_DEST) | | |
| 149 | − SET_FIELD(0xf, SB_BYTE_ENABLE)); | |
| 150 | − | |
| 151 | − ret = wait_for((REG_READ(SB_PCKT) & SB_BUSY) == 0, 1000); | |
| 152 | − if (ret) { | |
| 153 | − DRM_ERROR("timeout waiting for SB to idle after read\n"); | |
| 154 | − return ret; | |
| 155 | − } | |
| 156 | − | |
| 157 | − *val = REG_READ(SB_DATA); | |
| 158 | − | |
| 159 | − return 0; | |
| 160 | −} | |
| 161 | − | |
| 162 | −static int cdv_sb_write(struct drm_device *dev, u32 reg, u32 val) | |
| 163 | −{ | |
| 164 | − int ret; | |
| 165 | − static bool dpio_debug = true; | |
| 166 | − u32 temp; | |
| 167 | − | |
| 168 | − if (dpio_debug) { | |
| 169 | − if (cdv_sb_read(dev, reg, &temp) == 0) | |
| 170 | − DRM_DEBUG_KMS("0x%08x: 0x%08x (before)\n", reg, temp); | |
| 171 | − DRM_DEBUG_KMS("0x%08x: 0x%08x\n", reg, val); | |
| 172 | − } | |
| 173 | − | |
| 174 | − ret = wait_for((REG_READ(SB_PCKT) & SB_BUSY) == 0, 1000); | |
| 175 | − if (ret) { | |
| 176 | − DRM_ERROR("timeout waiting for SB to idle before write\n"); | |
| 177 | − return ret; | |
| 178 | − } | |
| 179 | − | |
| 180 | − REG_WRITE(SB_ADDR, reg); | |
| 181 | − REG_WRITE(SB_DATA, val); | |
| 182 | − REG_WRITE(SB_PCKT, | |
| 183 | − SET_FIELD(SB_OPCODE_WRITE, SB_OPCODE) | | |
| 184 | − SET_FIELD(SB_DEST_DPLL, SB_DEST) | | |
| 185 | − SET_FIELD(0xf, SB_BYTE_ENABLE)); | |
| 186 | − | |
| 187 | − ret = wait_for((REG_READ(SB_PCKT) & SB_BUSY) == 0, 1000); | |
| 188 | − if (ret) { | |
| 189 | − DRM_ERROR("timeout waiting for SB to idle after write\n"); | |
| 190 | − return ret; | |
| 191 | − } | |
| 192 | − | |
| 193 | − if (dpio_debug) { | |
| 194 | − if (cdv_sb_read(dev, reg, &temp) == 0) | |
| 195 | − DRM_DEBUG_KMS("0x%08x: 0x%08x (after)\n", reg, temp); | |
| 196 | − } | |
| 197 | − | |
| 198 | − return 0; | |
| 199 | −} | |
| 200 | − | |
| 201 | −/* Reset the DPIO configuration register. The BIOS does this at every | |
| 202 | − * mode set. | |
| 203 | − */ | |
| 204 | −static void cdv_sb_reset(struct drm_device *dev) | |
| 205 | −{ | |
| 206 | − | |
| 207 | − REG_WRITE(DPIO_CFG, 0); | |
| 208 | − REG_READ(DPIO_CFG); | |
| 209 | − REG_WRITE(DPIO_CFG, DPIO_MODE_SELECT_0 | DPIO_CMN_RESET_N); | |
| 210 | −} | |
| 211 | − | |
| 212 | −/* Unlike most Intel display engines, on Cedarview the DPLL registers | |
| 213 | − * are behind this sideband bus. They must be programmed while the | |
| 214 | − * DPLL reference clock is on in the DPLL control register, but before | |
| 215 | − * the DPLL is enabled in the DPLL control register. | |
| 216 | − */ | |
| 217 | −static int | |
| 218 | −cdv_dpll_set_clock_cdv(struct drm_device *dev, struct drm_crtc *crtc, | |
| 219 | − struct cdv_intel_clock_t *clock) | |
| 220 | −{ | |
| 221 | − struct psb_intel_crtc *psb_crtc = | |
| 222 | − to_psb_intel_crtc(crtc); | |
| 223 | − int pipe = psb_crtc->pipe; | |
| 224 | − u32 m, n_vco, p; | |
| 225 | − int ret = 0; | |
| 226 | − int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B; | |
| 227 | − u32 ref_value; | |
| 228 | − | |
| 229 | − cdv_sb_reset(dev); | |
| 230 | − | |
| 231 | − if ((REG_READ(dpll_reg) & DPLL_SYNCLOCK_ENABLE) == 0) { | |
| 232 | − DRM_ERROR("Attempting to set DPLL with refclk disabled\n"); | |
| 233 | − return -EBUSY; | |
| 234 | − } | |
| 235 | − | |
| 236 | − /* Follow the BIOS and write the REF/SFR Register. Hardcoded value */ | |
| 237 | − ref_value = 0x68A701; | |
| 238 | − | |
| 239 | − cdv_sb_write(dev, SB_REF_SFR(pipe), ref_value); | |
| 240 | − | |
| 241 | − /* We don't know what the other fields of these regs are, so | |
| 242 | − * leave them in place. | |
| 243 | − */ | |
| 244 | − ret = cdv_sb_read(dev, SB_M(pipe), &m); | |
| 245 | − if (ret) | |
| 246 | − return ret; | |
| 247 | − m &= ~SB_M_DIVIDER_MASK; | |
| 248 | − m |= ((clock->m2) << SB_M_DIVIDER_SHIFT); | |
| 249 | − ret = cdv_sb_write(dev, SB_M(pipe), m); | |
| 250 | − if (ret) | |
| 251 | − return ret; | |
| 252 | − | |
| 253 | − ret = cdv_sb_read(dev, SB_N_VCO(pipe), &n_vco); | |
| 254 | − if (ret) | |
| 255 | − return ret; | |
| 256 | − | |
| 257 | − /* Follow the BIOS to program the N_DIVIDER REG */ | |
| 258 | − n_vco &= 0xFFFF; | |
| 259 | − n_vco |= 0x107; | |
| 260 | − n_vco &= ~(SB_N_VCO_SEL_MASK | | |
| 261 | − SB_N_DIVIDER_MASK | | |
| 262 | − SB_N_CB_TUNE_MASK); | |
| 263 | − | |
| 264 | − n_vco |= ((clock->n) << SB_N_DIVIDER_SHIFT); | |
| 265 | − | |
| 266 | − if (clock->vco < 2250000) { | |
| 267 | − n_vco |= (2 << SB_N_CB_TUNE_SHIFT); | |
| 268 | − n_vco |= (0 << SB_N_VCO_SEL_SHIFT); | |
| 269 | − } else if (clock->vco < 2750000) { | |
| 270 | − n_vco |= (1 << SB_N_CB_TUNE_SHIFT); | |
| 271 | − n_vco |= (1 << SB_N_VCO_SEL_SHIFT); | |
| 272 | − } else if (clock->vco < 3300000) { | |
| 273 | − n_vco |= (0 << SB_N_CB_TUNE_SHIFT); | |
| 274 | − n_vco |= (2 << SB_N_VCO_SEL_SHIFT); | |
| 275 | − } else { | |
| 276 | − n_vco |= (0 << SB_N_CB_TUNE_SHIFT); | |
| 277 | − n_vco |= (3 << SB_N_VCO_SEL_SHIFT); | |
| 278 | − } | |
| 279 | − | |
| 280 | − ret = cdv_sb_write(dev, SB_N_VCO(pipe), n_vco); | |
| 281 | − if (ret) | |
| 282 | − return ret; | |
| 283 | − | |
| 284 | − ret = cdv_sb_read(dev, SB_P(pipe), &p); | |
| 285 | − if (ret) | |
| 286 | − return ret; | |
| 287 | − p &= ~(SB_P2_DIVIDER_MASK | SB_P1_DIVIDER_MASK); | |
| 288 | − p |= SET_FIELD(clock->p1, SB_P1_DIVIDER); | |
| 289 | − switch (clock->p2) { | |
| 290 | − case 5: | |
| 291 | − p |= SET_FIELD(SB_P2_5, SB_P2_DIVIDER); | |
| 292 | − break; | |
| 293 | − case 10: | |
| 294 | − p |= SET_FIELD(SB_P2_10, SB_P2_DIVIDER); | |
| 295 | − break; | |
| 296 | − case 14: | |
| 297 | − p |= SET_FIELD(SB_P2_14, SB_P2_DIVIDER); | |
| 298 | − break; | |
| 299 | − case 7: | |
| 300 | − p |= SET_FIELD(SB_P2_7, SB_P2_DIVIDER); | |
| 301 | − break; | |
| 302 | − default: | |
| 303 | − DRM_ERROR("Bad P2 clock: %d\n", clock->p2); | |
| 304 | − return -EINVAL; | |
| 305 | − } | |
| 306 | − ret = cdv_sb_write(dev, SB_P(pipe), p); | |
| 307 | − if (ret) | |
| 308 | − return ret; | |
| 309 | − | |
| 310 | − /* always Program the Lane Register for the Pipe A*/ | |
| 311 | − if (pipe == 0) { | |
| 312 | − /* Program the Lane0/1 for HDMI B */ | |
| 313 | − u32 lane_reg, lane_value; | |
| 314 | − | |
| 315 | − lane_reg = PSB_LANE0; | |
| 316 | − cdv_sb_read(dev, lane_reg, &lane_value); | |
| 317 | − lane_value &= ~(LANE_PLL_MASK); | |
| 318 | − lane_value |= LANE_PLL_ENABLE; | |
| 319 | − cdv_sb_write(dev, lane_reg, lane_value); | |
| 320 | − | |
| 321 | − lane_reg = PSB_LANE1; | |
| 322 | − cdv_sb_read(dev, lane_reg, &lane_value); | |
| 323 | − lane_value &= ~(LANE_PLL_MASK); | |
| 324 | − lane_value |= LANE_PLL_ENABLE; | |
| 325 | − cdv_sb_write(dev, lane_reg, lane_value); | |
| 326 | − | |
| 327 | − /* Program the Lane2/3 for HDMI C */ | |
| 328 | − lane_reg = PSB_LANE2; | |
| 329 | − cdv_sb_read(dev, lane_reg, &lane_value); | |
| 330 | − lane_value &= ~(LANE_PLL_MASK); | |
| 331 | − lane_value |= LANE_PLL_ENABLE; | |
| 332 | − cdv_sb_write(dev, lane_reg, lane_value); | |
| 333 | − | |
| 334 | − lane_reg = PSB_LANE3; | |
| 335 | − cdv_sb_read(dev, lane_reg, &lane_value); | |
| 336 | − lane_value &= ~(LANE_PLL_MASK); | |
| 337 | − lane_value |= LANE_PLL_ENABLE; | |
| 338 | − cdv_sb_write(dev, lane_reg, lane_value); | |
| 339 | − } | |
| 340 | − | |
| 341 | − return 0; | |
| 342 | −} | |
| 343 | − | |
| 344 | −/* | |
| 345 | − * Returns whether any output on the specified pipe is of the specified type | |
| 346 | − */ | |
| 347 | −bool cdv_intel_pipe_has_type(struct drm_crtc *crtc, int type) | |
| 348 | −{ | |
| 349 | − struct drm_device *dev = crtc->dev; | |
| 350 | − struct drm_mode_config *mode_config = &dev->mode_config; | |
| 351 | − struct drm_connector *l_entry; | |
| 352 | − | |
| 353 | − list_for_each_entry(l_entry, &mode_config->connector_list, head) { | |
| 354 | − if (l_entry->encoder && l_entry->encoder->crtc == crtc) { | |
| 355 | − struct psb_intel_output *psb_intel_output = | |
| 356 | − to_psb_intel_output(l_entry); | |
| 357 | − if (psb_intel_output->type == type) | |
| 358 | − return true; | |
| 359 | − } | |
| 360 | − } | |
| 361 | − return false; | |
| 362 | −} | |
| 363 | − | |
| 364 | −static const struct cdv_intel_limit_t *cdv_intel_limit(struct drm_crtc *crtc, | |
| 365 | − int refclk) | |
| 366 | −{ | |
| 367 | − const struct cdv_intel_limit_t *limit; | |
| 368 | − if (cdv_intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | |
| 369 | − /* | |
| 370 | − * Now only single-channel LVDS is supported on CDV. If it is | |
| 371 | − * incorrect, please add the dual-channel LVDS. | |
| 372 | − */ | |
| 373 | − if (refclk == 96000) | |
| 374 | − limit = &cdv_intel_limits[CDV_LIMIT_SINGLE_LVDS_96]; | |
| 375 | − else | |
| 376 | − limit = &cdv_intel_limits[CDV_LIMIT_SINGLE_LVDS_100]; | |
| 377 | − } else { | |
| 378 | − if (refclk == 27000) | |
| 379 | − limit = &cdv_intel_limits[CDV_LIMIT_DAC_HDMI_27]; | |
| 380 | − else | |
| 381 | − limit = &cdv_intel_limits[CDV_LIMIT_DAC_HDMI_96]; | |
| 382 | − } | |
| 383 | − return limit; | |
| 384 | −} | |
| 385 | − | |
| 386 | −/* m1 is reserved as 0 in CDV, n is a ring counter */ | |
| 387 | −static void cdv_intel_clock(struct drm_device *dev, | |
| 388 | − int refclk, struct cdv_intel_clock_t *clock) | |
| 389 | −{ | |
| 390 | − clock->m = clock->m2 + 2; | |
| 391 | − clock->p = clock->p1 * clock->p2; | |
| 392 | − clock->vco = (refclk * clock->m) / clock->n; | |
| 393 | − clock->dot = clock->vco / clock->p; | |
| 394 | −} | |
| 395 | − | |
| 396 | − | |
| 397 | −#define INTELPllInvalid(s) { /* ErrorF (s) */; return false; } | |
| 398 | −static bool cdv_intel_PLL_is_valid(struct drm_crtc *crtc, | |
| 399 | − const struct cdv_intel_limit_t *limit, | |
| 400 | − struct cdv_intel_clock_t *clock) | |
| 401 | −{ | |
| 402 | − if (clock->p1 < limit->p1.min || limit->p1.max < clock->p1) | |
| 403 | − INTELPllInvalid("p1 out of range\n"); | |
| 404 | − if (clock->p < limit->p.min || limit->p.max < clock->p) | |
| 405 | − INTELPllInvalid("p out of range\n"); | |
| 406 | − /* unnecessary to check the range of m(m1/M2)/n again */ | |
| 407 | − if (clock->vco < limit->vco.min || limit->vco.max < clock->vco) | |
| 408 | − INTELPllInvalid("vco out of range\n"); | |
| 409 | − /* XXX: We may need to be checking "Dot clock" | |
| 410 | − * depending on the multiplier, connector, etc., | |
| 411 | − * rather than just a single range. | |
| 412 | − */ | |
| 413 | − if (clock->dot < limit->dot.min || limit->dot.max < clock->dot) | |
| 414 | − INTELPllInvalid("dot out of range\n"); | |
| 415 | − | |
| 416 | − return true; | |
| 417 | −} | |
| 418 | − | |
| 419 | −static bool cdv_intel_find_best_PLL(struct drm_crtc *crtc, int target, | |
| 420 | − int refclk, | |
| 421 | − struct cdv_intel_clock_t *best_clock) | |
| 422 | −{ | |
| 423 | − struct drm_device *dev = crtc->dev; | |
| 424 | − struct cdv_intel_clock_t clock; | |
| 425 | − const struct cdv_intel_limit_t *limit = cdv_intel_limit(crtc, refclk); | |
| 426 | − int err = target; | |
| 427 | − | |
| 428 | − | |
| 429 | − if (cdv_intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) && | |
| 430 | − (REG_READ(LVDS) & LVDS_PORT_EN) != 0) { | |
| 431 | − /* | |
| 432 | − * For LVDS, if the panel is on, just rely on its current | |
| 433 | − * settings for dual-channel. We haven't figured out how to | |
| 434 | − * reliably set up different single/dual channel state, if we | |
| 435 | − * even can. | |
| 436 | − */ | |
| 437 | − if ((REG_READ(LVDS) & LVDS_CLKB_POWER_MASK) == | |
| 438 | − LVDS_CLKB_POWER_UP) | |
| 439 | − clock.p2 = limit->p2.p2_fast; | |
| 440 | − else | |
| 441 | − clock.p2 = limit->p2.p2_slow; | |
| 442 | − } else { | |
| 443 | − if (target < limit->p2.dot_limit) | |
| 444 | − clock.p2 = limit->p2.p2_slow; | |
| 445 | − else | |
| 446 | − clock.p2 = limit->p2.p2_fast; | |
| 447 | − } | |
| 448 | − | |
| 449 | − memset(best_clock, 0, sizeof(*best_clock)); | |
| 450 | − clock.m1 = 0; | |
| 451 | − /* m1 is reserved as 0 in CDV, n is a ring counter. | |
| 452 | − So skip the m1 loop */ | |
| 453 | − for (clock.n = limit->n.min; clock.n <= limit->n.max; clock.n++) { | |
| 454 | − for (clock.m2 = limit->m2.min; clock.m2 <= limit->m2.max; | |
| 455 | − clock.m2++) { | |
| 456 | − for (clock.p1 = limit->p1.min; | |
| 457 | − clock.p1 <= limit->p1.max; | |
| 458 | − clock.p1++) { | |
| 459 | − int this_err; | |
| 460 | − | |
| 461 | − cdv_intel_clock(dev, refclk, &clock); | |
| 462 | − | |
| 463 | − if (!cdv_intel_PLL_is_valid(crtc, | |
| 464 | − limit, &clock)) | |
| 465 | − continue; | |
| 466 | − | |
| 467 | − this_err = abs(clock.dot - target); | |
| 468 | − if (this_err < err) { | |
| 469 | − *best_clock = clock; | |
| 470 | − err = this_err; | |
| 471 | − } | |
| 472 | − } | |
| 473 | − } | |
| 474 | − } | |
| 475 | − | |
| 476 | − return err != target; | |
| 477 | −} | |
| 478 | − | |
| 479 | −int cdv_intel_pipe_set_base(struct drm_crtc *crtc, | |
| 480 | − int x, int y, struct drm_framebuffer *old_fb) | |
| 481 | −{ | |
| 482 | − struct drm_device *dev = crtc->dev; | |
| 483 | − struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); | |
| 484 | − struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb); | |
| 485 | − int pipe = psb_intel_crtc->pipe; | |
| 486 | − unsigned long start, offset; | |
| 487 | − int dspbase = (pipe == 0 ? DSPABASE : DSPBBASE); | |
| 488 | − int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF); | |
| 489 | − int dspstride = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE; | |
| 490 | − int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR; | |
| 491 | − u32 dspcntr; | |
| 492 | − int ret = 0; | |
| 493 | − | |
| 494 | − if (!gma_power_begin(dev, true)) | |
| 495 | − return 0; | |
| 496 | − | |
| 497 | − /* no fb bound */ | |
| 498 | − if (!crtc->fb) { | |
| 499 | − dev_err(dev->dev, "No FB bound\n"); | |
| 500 | − goto psb_intel_pipe_cleaner; | |
| 501 | − } | |
| 502 | − | |
| 503 | − | |
| 504 | − /* We are displaying this buffer, make sure it is actually loaded | |
| 505 | − into the GTT */ | |
| 506 | − ret = psb_gtt_pin(psbfb->gtt); | |
| 507 | − if (ret < 0) | |
| 508 | − goto psb_intel_pipe_set_base_exit; | |
| 509 | − start = psbfb->gtt->offset; | |
| 510 | − offset = y * crtc->fb->pitches[0] + x * (crtc->fb->bits_per_pixel / 8); | |
| 511 | − | |
| 512 | − REG_WRITE(dspstride, crtc->fb->pitches[0]); | |
| 513 | − | |
| 514 | − dspcntr = REG_READ(dspcntr_reg); | |
| 515 | − dspcntr &= ~DISPPLANE_PIXFORMAT_MASK; | |
| 516 | − | |
| 517 | − switch (crtc->fb->bits_per_pixel) { | |
| 518 | − case 8: | |
| 519 | − dspcntr |= DISPPLANE_8BPP; | |
| 520 | − break; | |
| 521 | − case 16: | |
| 522 | − if (crtc->fb->depth == 15) | |
| 523 | − dspcntr |= DISPPLANE_15_16BPP; | |
| 524 | − else | |
| 525 | − dspcntr |= DISPPLANE_16BPP; | |
| 526 | − break; | |
| 527 | − case 24: | |
| 528 | − case 32: | |
| 529 | − dspcntr |= DISPPLANE_32BPP_NO_ALPHA; | |
| 530 | − break; | |
| 531 | − default: | |
| 532 | − dev_err(dev->dev, "Unknown color depth\n"); | |
| 533 | − ret = -EINVAL; | |
| 534 | − goto psb_intel_pipe_set_base_exit; | |
| 535 | − } | |
| 536 | − REG_WRITE(dspcntr_reg, dspcntr); | |
| 537 | − | |
| 538 | − dev_dbg(dev->dev, | |
| 539 | − "Writing base %08lX %08lX %d %d\n", start, offset, x, y); | |
| 540 | − | |
| 541 | − REG_WRITE(dspbase, offset); | |
| 542 | − REG_READ(dspbase); | |
| 543 | − REG_WRITE(dspsurf, start); | |
| 544 | − REG_READ(dspsurf); | |
| 545 | − | |
| 546 | −psb_intel_pipe_cleaner: | |
| 547 | − /* If there was a previous display we can now unpin it */ | |
| 548 | − if (old_fb) | |
| 549 | − psb_gtt_unpin(to_psb_fb(old_fb)->gtt); | |
| 550 | − | |
| 551 | −psb_intel_pipe_set_base_exit: | |
| 552 | − gma_power_end(dev); | |
| 553 | − return ret; | |
| 554 | −} | |
| 555 | − | |
| 556 | −/** | |
| 557 | − * Sets the power management mode of the pipe and plane. | |
| 558 | − * | |
| 559 | − * This code should probably grow support for turning the cursor off and back | |
| 560 | − * on appropriately at the same time as we're turning the pipe off/on. | |
| 561 | − */ | |
| 562 | −static void cdv_intel_crtc_dpms(struct drm_crtc *crtc, int mode) | |
| 563 | −{ | |
| 564 | − struct drm_device *dev = crtc->dev; | |
| 565 | − struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); | |
| 566 | − int pipe = psb_intel_crtc->pipe; | |
| 567 | − int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B; | |
| 568 | − int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR; | |
| 569 | − int dspbase_reg = (pipe == 0) ? DSPABASE : DSPBBASE; | |
| 570 | − int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; | |
| 571 | − u32 temp; | |
| 572 | − bool enabled; | |
| 573 | − | |
| 574 | − /* XXX: When our outputs are all unaware of DPMS modes other than off | |
| 575 | − * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC. | |
| 576 | − */ | |
| 577 | − switch (mode) { | |
| 578 | − case DRM_MODE_DPMS_ON: | |
| 579 | − case DRM_MODE_DPMS_STANDBY: | |
| 580 | − case DRM_MODE_DPMS_SUSPEND: | |
| 581 | − /* Enable the DPLL */ | |
| 582 | − temp = REG_READ(dpll_reg); | |
| 583 | − if ((temp & DPLL_VCO_ENABLE) == 0) { | |
| 584 | − REG_WRITE(dpll_reg, temp); | |
| 585 | − REG_READ(dpll_reg); | |
| 586 | − /* Wait for the clocks to stabilize. */ | |
| 587 | − udelay(150); | |
| 588 | − REG_WRITE(dpll_reg, temp | DPLL_VCO_ENABLE); | |
| 589 | − REG_READ(dpll_reg); | |
| 590 | − /* Wait for the clocks to stabilize. */ | |
| 591 | − udelay(150); | |
| 592 | − REG_WRITE(dpll_reg, temp | DPLL_VCO_ENABLE); | |
| 593 | − REG_READ(dpll_reg); | |
| 594 | − /* Wait for the clocks to stabilize. */ | |
| 595 | − udelay(150); | |
| 596 | − } | |
| 597 | − | |
| 598 | − /* Jim Bish - switch plan and pipe per scott */ | |
| 599 | − /* Enable the plane */ | |
| 600 | − temp = REG_READ(dspcntr_reg); | |
| 601 | − if ((temp & DISPLAY_PLANE_ENABLE) == 0) { | |
| 602 | − REG_WRITE(dspcntr_reg, | |
| 603 | − temp | DISPLAY_PLANE_ENABLE); | |
| 604 | − /* Flush the plane changes */ | |
| 605 | − REG_WRITE(dspbase_reg, REG_READ(dspbase_reg)); | |
| 606 | − } | |
| 607 | − | |
| 608 | − udelay(150); | |
| 609 | − | |
| 610 | − /* Enable the pipe */ | |
| 611 | − temp = REG_READ(pipeconf_reg); | |
| 612 | − if ((temp & PIPEACONF_ENABLE) == 0) | |
| 613 | − REG_WRITE(pipeconf_reg, temp | PIPEACONF_ENABLE); | |
| 614 | − | |
| 615 | − psb_intel_crtc_load_lut(crtc); | |
| 616 | − | |
| 617 | − /* Give the overlay scaler a chance to enable | |
| 618 | − * if it's on this pipe */ | |
| 619 | − /* psb_intel_crtc_dpms_video(crtc, true); TODO */ | |
| 620 | − break; | |
| 621 | − case DRM_MODE_DPMS_OFF: | |
| 622 | − /* Give the overlay scaler a chance to disable | |
| 623 | − * if it's on this pipe */ | |
| 624 | − /* psb_intel_crtc_dpms_video(crtc, FALSE); TODO */ | |
| 625 | − | |
| 626 | − /* Disable the VGA plane that we never use */ | |
| 627 | − REG_WRITE(VGACNTRL, VGA_DISP_DISABLE); | |
| 628 | − | |
| 629 | − /* Jim Bish - changed pipe/plane here as well. */ | |
| 630 | − | |
| 631 | − /* Wait for vblank for the disable to take effect */ | |
| 632 | − cdv_intel_wait_for_vblank(dev); | |
| 633 | − | |
| 634 | − /* Next, disable display pipes */ | |
| 635 | − temp = REG_READ(pipeconf_reg); | |
| 636 | − if ((temp & PIPEACONF_ENABLE) != 0) { | |
| 637 | − REG_WRITE(pipeconf_reg, temp & ~PIPEACONF_ENABLE); | |
| 638 | − REG_READ(pipeconf_reg); | |
| 639 | − } | |
| 640 | − | |
| 641 | − /* Wait for vblank for the disable to take effect. */ | |
| 642 | − cdv_intel_wait_for_vblank(dev); | |
| 643 | − | |
| 644 | − udelay(150); | |
| 645 | − | |
| 646 | − /* Disable display plane */ | |
| 647 | − temp = REG_READ(dspcntr_reg); | |
| 648 | − if ((temp & DISPLAY_PLANE_ENABLE) != 0) { | |
| 649 | − REG_WRITE(dspcntr_reg, | |
| 650 | − temp & ~DISPLAY_PLANE_ENABLE); | |
| 651 | − /* Flush the plane changes */ | |
| 652 | − REG_WRITE(dspbase_reg, REG_READ(dspbase_reg)); | |
| 653 | − REG_READ(dspbase_reg); | |
| 654 | − } | |
| 655 | − | |
| 656 | − temp = REG_READ(dpll_reg); | |
| 657 | − if ((temp & DPLL_VCO_ENABLE) != 0) { | |
| 658 | − REG_WRITE(dpll_reg, temp & ~DPLL_VCO_ENABLE); | |
| 659 | − REG_READ(dpll_reg); | |
| 660 | − } | |
| 661 | − | |
| 662 | − /* Wait for the clocks to turn off. */ | |
| 663 | − udelay(150); | |
| 664 | − break; | |
| 665 | − } | |
| 666 | − enabled = crtc->enabled && mode != DRM_MODE_DPMS_OFF; | |
| 667 | − /*Set FIFO Watermarks*/ | |
| 668 | − REG_WRITE(DSPARB, 0x3F3E); | |
| 669 | −} | |
| 670 | − | |
| 671 | −static void cdv_intel_crtc_prepare(struct drm_crtc *crtc) | |
| 672 | −{ | |
| 673 | − struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; | |
| 674 | − crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); | |
| 675 | −} | |
| 676 | − | |
| 677 | −static void cdv_intel_crtc_commit(struct drm_crtc *crtc) | |
| 678 | −{ | |
| 679 | − struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; | |
| 680 | − crtc_funcs->dpms(crtc, DRM_MODE_DPMS_ON); | |
| 681 | −} | |
| 682 | − | |
| 683 | −void cdv_intel_encoder_prepare(struct drm_encoder *encoder) | |
| 684 | −{ | |
| 685 | − struct drm_encoder_helper_funcs *encoder_funcs = | |
| 686 | − encoder->helper_private; | |
| 687 | − /* lvds has its own version of prepare see cdv_intel_lvds_prepare */ | |
| 688 | − encoder_funcs->dpms(encoder, DRM_MODE_DPMS_OFF); | |
| 689 | −} | |
| 690 | − | |
| 691 | −void cdv_intel_encoder_commit(struct drm_encoder *encoder) | |
| 692 | −{ | |
| 693 | − struct drm_encoder_helper_funcs *encoder_funcs = | |
| 694 | − encoder->helper_private; | |
| 695 | − /* lvds has its own version of commit see cdv_intel_lvds_commit */ | |
| 696 | − encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON); | |
| 697 | −} | |
| 698 | − | |
| 699 | −static bool cdv_intel_crtc_mode_fixup(struct drm_crtc *crtc, | |
| 700 | − struct drm_display_mode *mode, | |
| 701 | − struct drm_display_mode *adjusted_mode) | |
| 702 | −{ | |
| 703 | − return true; | |
| 704 | −} | |
| 705 | − | |
| 706 | − | |
| 707 | −/** | |
| 708 | − * Return the pipe currently connected to the panel fitter, | |
| 709 | − * or -1 if the panel fitter is not present or not in use | |
| 710 | − */ | |
| 711 | −static int cdv_intel_panel_fitter_pipe(struct drm_device *dev) | |
| 712 | −{ | |
| 713 | − u32 pfit_control; | |
| 714 | − | |
| 715 | − pfit_control = REG_READ(PFIT_CONTROL); | |
| 716 | − | |
| 717 | − /* See if the panel fitter is in use */ | |
| 718 | − if ((pfit_control & PFIT_ENABLE) == 0) | |
| 719 | − return -1; | |
| 720 | − return (pfit_control >> 29) & 0x3; | |
| 721 | −} | |
| 722 | − | |
| 723 | −static int cdv_intel_crtc_mode_set(struct drm_crtc *crtc, | |
| 724 | − struct drm_display_mode *mode, | |
| 725 | − struct drm_display_mode *adjusted_mode, | |
| 726 | − int x, int y, | |
| 727 | − struct drm_framebuffer *old_fb) | |
| 728 | −{ | |
| 729 | − struct drm_device *dev = crtc->dev; | |
| 730 | − struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); | |
| 731 | − int pipe = psb_intel_crtc->pipe; | |
| 732 | − int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B; | |
| 733 | − int dpll_md_reg = (psb_intel_crtc->pipe == 0) ? DPLL_A_MD : DPLL_B_MD; | |
| 734 | − int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR; | |
| 735 | − int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; | |
| 736 | − int htot_reg = (pipe == 0) ? HTOTAL_A : HTOTAL_B; | |
| 737 | − int hblank_reg = (pipe == 0) ? HBLANK_A : HBLANK_B; | |
| 738 | − int hsync_reg = (pipe == 0) ? HSYNC_A : HSYNC_B; | |
| 739 | − int vtot_reg = (pipe == 0) ? VTOTAL_A : VTOTAL_B; | |
| 740 | − int vblank_reg = (pipe == 0) ? VBLANK_A : VBLANK_B; | |
| 741 | − int vsync_reg = (pipe == 0) ? VSYNC_A : VSYNC_B; | |
| 742 | − int dspsize_reg = (pipe == 0) ? DSPASIZE : DSPBSIZE; | |
| 743 | − int dsppos_reg = (pipe == 0) ? DSPAPOS : DSPBPOS; | |
| 744 | − int pipesrc_reg = (pipe == 0) ? PIPEASRC : PIPEBSRC; | |
| 745 | − int refclk; | |
| 746 | − struct cdv_intel_clock_t clock; | |
| 747 | − u32 dpll = 0, dspcntr, pipeconf; | |
| 748 | − bool ok, is_sdvo = false, is_dvo = false; | |
| 749 | − bool is_crt = false, is_lvds = false, is_tv = false; | |
| 750 | − bool is_hdmi = false; | |
| 751 | − struct drm_mode_config *mode_config = &dev->mode_config; | |
| 752 | − struct drm_connector *connector; | |
| 753 | − | |
| 754 | − list_for_each_entry(connector, &mode_config->connector_list, head) { | |
| 755 | − struct psb_intel_output *psb_intel_output = | |
| 756 | − to_psb_intel_output(connector); | |
| 757 | − | |
| 758 | − if (!connector->encoder | |
| 759 | − || connector->encoder->crtc != crtc) | |
| 760 | − continue; | |
| 761 | − | |
| 762 | − switch (psb_intel_output->type) { | |
| 763 | − case INTEL_OUTPUT_LVDS: | |
| 764 | − is_lvds = true; | |
| 765 | − break; | |
| 766 | − case INTEL_OUTPUT_SDVO: | |
| 767 | − is_sdvo = true; | |
| 768 | − break; | |
| 769 | − case INTEL_OUTPUT_DVO: | |
| 770 | − is_dvo = true; | |
| 771 | − break; | |
| 772 | − case INTEL_OUTPUT_TVOUT: | |
| 773 | − is_tv = true; | |
| 774 | − break; | |
| 775 | − case INTEL_OUTPUT_ANALOG: | |
| 776 | − is_crt = true; | |
| 777 | − break; | |
| 778 | − case INTEL_OUTPUT_HDMI: | |
| 779 | − is_hdmi = true; | |
| 780 | − break; | |
| 781 | − } | |
| 782 | − } | |
| 783 | − | |
| 784 | − refclk = 96000; | |
| 785 | − | |
| 786 | − /* Hack selection about ref clk for CRT */ | |
| 787 | − /* Select 27MHz as the reference clk for HDMI */ | |
| 788 | − if (is_crt || is_hdmi) | |
| 789 | − refclk = 27000; | |
| 790 | − | |
| 791 | − drm_mode_debug_printmodeline(adjusted_mode); | |
| 792 | − | |
| 793 | − ok = cdv_intel_find_best_PLL(crtc, adjusted_mode->clock, refclk, | |
| 794 | − &clock); | |
| 795 | − if (!ok) { | |
| 796 | − dev_err(dev->dev, "Couldn't find PLL settings for mode!\n"); | |
| 797 | − return 0; | |
| 798 | − } | |
| 799 | − | |
| 800 | − dpll = DPLL_VGA_MODE_DIS; | |
| 801 | − if (is_tv) { | |
| 802 | − /* XXX: just matching BIOS for now */ | |
| 803 | −/* dpll |= PLL_REF_INPUT_TVCLKINBC; */ | |
| 804 | − dpll |= 3; | |
| 805 | − } | |
| 806 | − dpll |= PLL_REF_INPUT_DREFCLK; | |
| 807 | − | |
| 808 | − dpll |= DPLL_SYNCLOCK_ENABLE; | |
| 809 | − dpll |= DPLL_VGA_MODE_DIS; | |
| 810 | − if (is_lvds) | |
| 811 | − dpll |= DPLLB_MODE_LVDS; | |
| 812 | − else | |
| 813 | − dpll |= DPLLB_MODE_DAC_SERIAL; | |
| 814 | − /* dpll |= (2 << 11); */ | |
| 815 | − | |
| 816 | − /* setup pipeconf */ | |
| 817 | − pipeconf = REG_READ(pipeconf_reg); | |
| 818 | − | |
| 819 | − /* Set up the display plane register */ | |
| 820 | − dspcntr = DISPPLANE_GAMMA_ENABLE; | |
| 821 | − | |
| 822 | − if (pipe == 0) | |
| 823 | − dspcntr |= DISPPLANE_SEL_PIPE_A; | |
| 824 | − else | |
| 825 | − dspcntr |= DISPPLANE_SEL_PIPE_B; | |
| 826 | − | |
| 827 | − dspcntr |= DISPLAY_PLANE_ENABLE; | |
| 828 | − pipeconf |= PIPEACONF_ENABLE; | |
| 829 | − | |
| 830 | − REG_WRITE(dpll_reg, dpll | DPLL_VGA_MODE_DIS | DPLL_SYNCLOCK_ENABLE); | |
| 831 | − REG_READ(dpll_reg); | |
| 832 | − | |
| 833 | − cdv_dpll_set_clock_cdv(dev, crtc, &clock); | |
| 834 | − | |
| 835 | − udelay(150); | |
| 836 | − | |
| 837 | − | |
| 838 | − /* The LVDS pin pair needs to be on before the DPLLs are enabled. | |
| 839 | − * This is an exception to the general rule that mode_set doesn't turn | |
669 more lines aren’t shown here.
This diff is large: its 377 lines aren’t shown here.
This diff is large: its 722 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 857 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 293 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 3 lines aren’t shown here.
This diff is large: its 554 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 304 lines aren’t shown here.
This diff is large: its 431 lines aren’t shown here.
This diff is large: its 171 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 715 lines aren’t shown here.
This diff is large: its 762 lines aren’t shown here.
This diff is large: its 174 lines aren’t shown here.
This diff is large: its 779 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 806 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 1015 lines aren’t shown here.
This diff is large: its 139 lines aren’t shown here.
This diff is large: its 1485 lines aren’t shown here.
This diff is large: its 185 lines aren’t shown here.
This diff is large: its 1405 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 172 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 559 lines aren’t shown here.
This diff is large: its 207 lines aren’t shown here.
This diff is large: its 510 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 269 lines aren’t shown here.
This diff is large: its 271 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 859 lines aren’t shown here.
This diff is large: its 253 lines aren’t shown here.
This diff is large: its 605 lines aren’t shown here.
This diff is large: its 635 lines aren’t shown here.
This diff is large: its 853 lines aren’t shown here.
This diff is large: its 329 lines aren’t shown here.
This diff is large: its 408 lines aren’t shown here.
This diff is large: its 319 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 322 lines aren’t shown here.
This diff is large: its 220 lines aren’t shown here.
This diff is large: its 1231 lines aren’t shown here.
This diff is large: its 953 lines aren’t shown here.
This diff is large: its 1430 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 231 lines aren’t shown here.
This diff is large: its 855 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 1236 lines aren’t shown here.
This diff is large: its 1294 lines aren’t shown here.
This diff is large: its 339 lines aren’t shown here.
This diff is large: its 628 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 583 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 292 lines aren’t shown here.
This diff is large: its 144 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 313 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 345 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 4 lines aren’t shown here.
This diff is large: its 612 lines aren’t shown here.
This diff is large: its 879 lines aren’t shown here.
This diff is large: its 1103 lines aren’t shown here.
This diff is large: its 2056 lines aren’t shown here.
This diff is large: its 183 lines aren’t shown here.
This diff is large: its 172 lines aren’t shown here.
This diff is large: its 1210 lines aren’t shown here.
This diff is large: its 920 lines aren’t shown here.
This diff is large: its 121 lines aren’t shown here.
This diff is large: its 707 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 85 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 167 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 194 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 264 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 114 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 138 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 214 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 87 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 196 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 195 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 352 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 208 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 116 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 90 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 242 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 599 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 118 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.