diff options
284 files changed, 5828 insertions, 1939 deletions
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index 9e642c5bf526..8dfc6708a257 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX | |||
| @@ -232,6 +232,8 @@ memory.txt | |||
| 232 | - info on typical Linux memory problems. | 232 | - info on typical Linux memory problems. |
| 233 | mips/ | 233 | mips/ |
| 234 | - directory with info about Linux on MIPS architecture. | 234 | - directory with info about Linux on MIPS architecture. |
| 235 | mmc/ | ||
| 236 | - directory with info about the MMC subsystem | ||
| 235 | mono.txt | 237 | mono.txt |
| 236 | - how to execute Mono-based .NET binaries with the help of BINFMT_MISC. | 238 | - how to execute Mono-based .NET binaries with the help of BINFMT_MISC. |
| 237 | mutex-design.txt | 239 | mutex-design.txt |
diff --git a/Documentation/mmc/00-INDEX b/Documentation/mmc/00-INDEX new file mode 100644 index 000000000000..fca586f5b853 --- /dev/null +++ b/Documentation/mmc/00-INDEX | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | 00-INDEX | ||
| 2 | - this file | ||
| 3 | mmc-dev-attrs.txt | ||
| 4 | - info on SD and MMC device attributes | ||
diff --git a/Documentation/mmc/mmc-dev-attrs.txt b/Documentation/mmc/mmc-dev-attrs.txt new file mode 100644 index 000000000000..ff2bd685bced --- /dev/null +++ b/Documentation/mmc/mmc-dev-attrs.txt | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | SD and MMC Device Attributes | ||
| 2 | ============================ | ||
| 3 | |||
| 4 | All attributes are read-only. | ||
| 5 | |||
| 6 | cid Card Identifaction Register | ||
| 7 | csd Card Specific Data Register | ||
| 8 | scr SD Card Configuration Register (SD only) | ||
| 9 | date Manufacturing Date (from CID Register) | ||
| 10 | fwrev Firmware/Product Revision (from CID Register) (SD and MMCv1 only) | ||
| 11 | hwrev Hardware/Product Revision (from CID Register) (SD and MMCv1 only) | ||
| 12 | manfid Manufacturer ID (from CID Register) | ||
| 13 | name Product Name (from CID Register) | ||
| 14 | oemid OEM/Application ID (from CID Register) | ||
| 15 | serial Product Serial Number (from CID Register) | ||
| 16 | erase_size Erase group size | ||
| 17 | preferred_erase_size Preferred erase size | ||
| 18 | |||
| 19 | Note on Erase Size and Preferred Erase Size: | ||
| 20 | |||
| 21 | "erase_size" is the minimum size, in bytes, of an erase | ||
| 22 | operation. For MMC, "erase_size" is the erase group size | ||
| 23 | reported by the card. Note that "erase_size" does not apply | ||
| 24 | to trim or secure trim operations where the minimum size is | ||
| 25 | always one 512 byte sector. For SD, "erase_size" is 512 | ||
| 26 | if the card is block-addressed, 0 otherwise. | ||
| 27 | |||
| 28 | SD/MMC cards can erase an arbitrarily large area up to and | ||
| 29 | including the whole card. When erasing a large area it may | ||
| 30 | be desirable to do it in smaller chunks for three reasons: | ||
| 31 | 1. A single erase command will make all other I/O on | ||
| 32 | the card wait. This is not a problem if the whole card | ||
| 33 | is being erased, but erasing one partition will make | ||
| 34 | I/O for another partition on the same card wait for the | ||
| 35 | duration of the erase - which could be a several | ||
| 36 | minutes. | ||
| 37 | 2. To be able to inform the user of erase progress. | ||
| 38 | 3. The erase timeout becomes too large to be very | ||
| 39 | useful. Because the erase timeout contains a margin | ||
| 40 | which is multiplied by the size of the erase area, | ||
| 41 | the value can end up being several minutes for large | ||
| 42 | areas. | ||
| 43 | |||
| 44 | "erase_size" is not the most efficient unit to erase | ||
| 45 | (especially for SD where it is just one sector), | ||
| 46 | hence "preferred_erase_size" provides a good chunk | ||
| 47 | size for erasing large areas. | ||
| 48 | |||
| 49 | For MMC, "preferred_erase_size" is the high-capacity | ||
| 50 | erase size if a card specifies one, otherwise it is | ||
| 51 | based on the capacity of the card. | ||
| 52 | |||
| 53 | For SD, "preferred_erase_size" is the allocation unit | ||
| 54 | size specified by the card. | ||
| 55 | |||
| 56 | "preferred_erase_size" is in bytes. | ||
diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c index 92d496ad07c9..838d0259cd27 100644 --- a/arch/parisc/mm/ioremap.c +++ b/arch/parisc/mm/ioremap.c | |||
| @@ -71,7 +71,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l | |||
| 71 | */ | 71 | */ |
| 72 | offset = phys_addr & ~PAGE_MASK; | 72 | offset = phys_addr & ~PAGE_MASK; |
| 73 | phys_addr &= PAGE_MASK; | 73 | phys_addr &= PAGE_MASK; |
| 74 | size = PAGE_ALIGN(last_addr) - phys_addr; | 74 | size = PAGE_ALIGN(last_addr + 1) - phys_addr; |
| 75 | 75 | ||
| 76 | /* | 76 | /* |
| 77 | * Ok, go for it.. | 77 | * Ok, go for it.. |
diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c b/arch/powerpc/platforms/83xx/mpc837x_mds.c index 51df7e754698..f9751c8905be 100644 --- a/arch/powerpc/platforms/83xx/mpc837x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c | |||
| @@ -102,7 +102,7 @@ static struct of_device_id mpc837x_ids[] = { | |||
| 102 | 102 | ||
| 103 | static int __init mpc837x_declare_of_platform_devices(void) | 103 | static int __init mpc837x_declare_of_platform_devices(void) |
| 104 | { | 104 | { |
| 105 | /* Publish of_device */ | 105 | /* Publish platform_device */ |
| 106 | of_platform_bus_probe(NULL, mpc837x_ids, NULL); | 106 | of_platform_bus_probe(NULL, mpc837x_ids, NULL); |
| 107 | 107 | ||
| 108 | return 0; | 108 | return 0; |
diff --git a/arch/powerpc/platforms/83xx/mpc837x_rdb.c b/arch/powerpc/platforms/83xx/mpc837x_rdb.c index e00801c42540..910caa6b5810 100644 --- a/arch/powerpc/platforms/83xx/mpc837x_rdb.c +++ b/arch/powerpc/platforms/83xx/mpc837x_rdb.c | |||
| @@ -78,7 +78,7 @@ static struct of_device_id mpc837x_ids[] = { | |||
| 78 | 78 | ||
| 79 | static int __init mpc837x_declare_of_platform_devices(void) | 79 | static int __init mpc837x_declare_of_platform_devices(void) |
| 80 | { | 80 | { |
| 81 | /* Publish of_device */ | 81 | /* Publish platform_device */ |
| 82 | of_platform_bus_probe(NULL, mpc837x_ids, NULL); | 82 | of_platform_bus_probe(NULL, mpc837x_ids, NULL); |
| 83 | 83 | ||
| 84 | return 0; | 84 | return 0; |
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c index 8bd86530ee25..6425abe5b7db 100644 --- a/arch/powerpc/sysdev/fsl_rio.c +++ b/arch/powerpc/sysdev/fsl_rio.c | |||
| @@ -1332,7 +1332,7 @@ static inline void fsl_rio_info(struct device *dev, u32 ccsr) | |||
| 1332 | 1332 | ||
| 1333 | /** | 1333 | /** |
| 1334 | * fsl_rio_setup - Setup Freescale PowerPC RapidIO interface | 1334 | * fsl_rio_setup - Setup Freescale PowerPC RapidIO interface |
| 1335 | * @dev: of_device pointer | 1335 | * @dev: platform_device pointer |
| 1336 | * | 1336 | * |
| 1337 | * Initializes MPC85xx RapidIO hardware interface, configures | 1337 | * Initializes MPC85xx RapidIO hardware interface, configures |
| 1338 | * master port with system-specific info, and registers the | 1338 | * master port with system-specific info, and registers the |
diff --git a/arch/score/mm/tlb-score.c b/arch/score/mm/tlb-score.c index 4fa5aa5afecc..6fdb100244c8 100644 --- a/arch/score/mm/tlb-score.c +++ b/arch/score/mm/tlb-score.c | |||
| @@ -158,7 +158,7 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end) | |||
| 158 | 158 | ||
| 159 | void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) | 159 | void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) |
| 160 | { | 160 | { |
| 161 | if (!vma || vma->vm_mm->context != 0) { | 161 | if (vma && vma->vm_mm->context != 0) { |
| 162 | unsigned long flags; | 162 | unsigned long flags; |
| 163 | int oldpid, newpid, idx; | 163 | int oldpid, newpid, idx; |
| 164 | unsigned long vma_ASID = vma->vm_mm->context; | 164 | unsigned long vma_ASID = vma->vm_mm->context; |
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index 018a0a400799..bf5f7d32bd08 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h | |||
| @@ -112,13 +112,9 @@ static inline xpaddr_t machine_to_phys(xmaddr_t machine) | |||
| 112 | */ | 112 | */ |
| 113 | static inline unsigned long mfn_to_local_pfn(unsigned long mfn) | 113 | static inline unsigned long mfn_to_local_pfn(unsigned long mfn) |
| 114 | { | 114 | { |
| 115 | extern unsigned long max_mapnr; | ||
| 116 | unsigned long pfn = mfn_to_pfn(mfn); | 115 | unsigned long pfn = mfn_to_pfn(mfn); |
| 117 | if ((pfn < max_mapnr) | 116 | if (get_phys_to_machine(pfn) != mfn) |
| 118 | && !xen_feature(XENFEAT_auto_translated_physmap) | 117 | return -1; /* force !pfn_valid() */ |
| 119 | && (get_phys_to_machine(pfn) != mfn)) | ||
| 120 | return max_mapnr; /* force !pfn_valid() */ | ||
| 121 | /* XXX fixme; not true with sparsemem */ | ||
| 122 | return pfn; | 118 | return pfn; |
| 123 | } | 119 | } |
| 124 | 120 | ||
diff --git a/arch/x86/include/asm/xen/swiotlb-xen.h b/arch/x86/include/asm/xen/swiotlb-xen.h new file mode 100644 index 000000000000..1be1ab7d6a41 --- /dev/null +++ b/arch/x86/include/asm/xen/swiotlb-xen.h | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | #ifndef _ASM_X86_SWIOTLB_XEN_H | ||
| 2 | #define _ASM_X86_SWIOTLB_XEN_H | ||
| 3 | |||
| 4 | #ifdef CONFIG_SWIOTLB_XEN | ||
| 5 | extern int xen_swiotlb; | ||
| 6 | extern int __init pci_xen_swiotlb_detect(void); | ||
| 7 | extern void __init pci_xen_swiotlb_init(void); | ||
| 8 | #else | ||
| 9 | #define xen_swiotlb (0) | ||
| 10 | static inline int __init pci_xen_swiotlb_detect(void) { return 0; } | ||
| 11 | static inline void __init pci_xen_swiotlb_init(void) { } | ||
| 12 | #endif | ||
| 13 | |||
| 14 | #endif /* _ASM_X86_SWIOTLB_XEN_H */ | ||
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 4b7e3d8b01dd..9f07cfcbd3a5 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <asm/calgary.h> | 13 | #include <asm/calgary.h> |
| 14 | #include <asm/amd_iommu.h> | 14 | #include <asm/amd_iommu.h> |
| 15 | #include <asm/x86_init.h> | 15 | #include <asm/x86_init.h> |
| 16 | #include <asm/xen/swiotlb-xen.h> | ||
| 16 | 17 | ||
| 17 | static int forbid_dac __read_mostly; | 18 | static int forbid_dac __read_mostly; |
| 18 | 19 | ||
| @@ -132,7 +133,7 @@ void __init pci_iommu_alloc(void) | |||
| 132 | /* free the range so iommu could get some range less than 4G */ | 133 | /* free the range so iommu could get some range less than 4G */ |
| 133 | dma32_free_bootmem(); | 134 | dma32_free_bootmem(); |
| 134 | 135 | ||
| 135 | if (pci_swiotlb_detect()) | 136 | if (pci_xen_swiotlb_detect() || pci_swiotlb_detect()) |
| 136 | goto out; | 137 | goto out; |
| 137 | 138 | ||
| 138 | gart_iommu_hole_init(); | 139 | gart_iommu_hole_init(); |
| @@ -144,6 +145,8 @@ void __init pci_iommu_alloc(void) | |||
| 144 | /* needs to be called after gart_iommu_hole_init */ | 145 | /* needs to be called after gart_iommu_hole_init */ |
| 145 | amd_iommu_detect(); | 146 | amd_iommu_detect(); |
| 146 | out: | 147 | out: |
| 148 | pci_xen_swiotlb_init(); | ||
| 149 | |||
| 147 | pci_swiotlb_init(); | 150 | pci_swiotlb_init(); |
| 148 | } | 151 | } |
| 149 | 152 | ||
| @@ -296,7 +299,7 @@ static int __init pci_iommu_init(void) | |||
| 296 | #endif | 299 | #endif |
| 297 | x86_init.iommu.iommu_init(); | 300 | x86_init.iommu.iommu_init(); |
| 298 | 301 | ||
| 299 | if (swiotlb) { | 302 | if (swiotlb || xen_swiotlb) { |
| 300 | printk(KERN_INFO "PCI-DMA: " | 303 | printk(KERN_INFO "PCI-DMA: " |
| 301 | "Using software bounce buffering for IO (SWIOTLB)\n"); | 304 | "Using software bounce buffering for IO (SWIOTLB)\n"); |
| 302 | swiotlb_print_info(); | 305 | swiotlb_print_info(); |
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile index 930954685980..779385158915 100644 --- a/arch/x86/xen/Makefile +++ b/arch/x86/xen/Makefile | |||
| @@ -18,3 +18,4 @@ obj-$(CONFIG_SMP) += smp.o | |||
| 18 | obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o | 18 | obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o |
| 19 | obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o | 19 | obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o |
| 20 | 20 | ||
| 21 | obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o | ||
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index d4ff5e83621d..7d46c8441418 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
| @@ -1172,6 +1172,10 @@ asmlinkage void __init xen_start_kernel(void) | |||
| 1172 | 1172 | ||
| 1173 | pgd = (pgd_t *)xen_start_info->pt_base; | 1173 | pgd = (pgd_t *)xen_start_info->pt_base; |
| 1174 | 1174 | ||
| 1175 | if (!xen_initial_domain()) | ||
| 1176 | __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD); | ||
| 1177 | |||
| 1178 | __supported_pte_mask |= _PAGE_IOMAP; | ||
| 1175 | /* Don't do the full vcpu_info placement stuff until we have a | 1179 | /* Don't do the full vcpu_info placement stuff until we have a |
| 1176 | possible map and a non-dummy shared_info. */ | 1180 | possible map and a non-dummy shared_info. */ |
| 1177 | per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; | 1181 | per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 413b19b3d0fe..42086ac406af 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | #include <linux/highmem.h> | 42 | #include <linux/highmem.h> |
| 43 | #include <linux/debugfs.h> | 43 | #include <linux/debugfs.h> |
| 44 | #include <linux/bug.h> | 44 | #include <linux/bug.h> |
| 45 | #include <linux/vmalloc.h> | ||
| 45 | #include <linux/module.h> | 46 | #include <linux/module.h> |
| 46 | #include <linux/gfp.h> | 47 | #include <linux/gfp.h> |
| 47 | 48 | ||
| @@ -51,15 +52,19 @@ | |||
| 51 | #include <asm/mmu_context.h> | 52 | #include <asm/mmu_context.h> |
| 52 | #include <asm/setup.h> | 53 | #include <asm/setup.h> |
| 53 | #include <asm/paravirt.h> | 54 | #include <asm/paravirt.h> |
| 55 | #include <asm/e820.h> | ||
| 54 | #include <asm/linkage.h> | 56 | #include <asm/linkage.h> |
| 57 | #include <asm/page.h> | ||
| 55 | 58 | ||
| 56 | #include <asm/xen/hypercall.h> | 59 | #include <asm/xen/hypercall.h> |
| 57 | #include <asm/xen/hypervisor.h> | 60 | #include <asm/xen/hypervisor.h> |
| 58 | 61 | ||
| 62 | #include <xen/xen.h> | ||
| 59 | #include <xen/page.h> | 63 | #include <xen/page.h> |
| 60 | #include <xen/interface/xen.h> | 64 | #include <xen/interface/xen.h> |
| 61 | #include <xen/interface/hvm/hvm_op.h> | 65 | #include <xen/interface/hvm/hvm_op.h> |
| 62 | #include <xen/interface/version.h> | 66 | #include <xen/interface/version.h> |
| 67 | #include <xen/interface/memory.h> | ||
| 63 | #include <xen/hvc-console.h> | 68 | #include <xen/hvc-console.h> |
| 64 | 69 | ||
| 65 | #include "multicalls.h" | 70 | #include "multicalls.h" |
| @@ -68,6 +73,13 @@ | |||
| 68 | 73 | ||
| 69 | #define MMU_UPDATE_HISTO 30 | 74 | #define MMU_UPDATE_HISTO 30 |
| 70 | 75 | ||
| 76 | /* | ||
| 77 | * Protects atomic reservation decrease/increase against concurrent increases. | ||
| 78 | * Also protects non-atomic updates of current_pages and driver_pages, and | ||
| 79 | * balloon lists. | ||
| 80 | */ | ||
| 81 | DEFINE_SPINLOCK(xen_reservation_lock); | ||
| 82 | |||
| 71 | #ifdef CONFIG_XEN_DEBUG_FS | 83 | #ifdef CONFIG_XEN_DEBUG_FS |
| 72 | 84 | ||
| 73 | static struct { | 85 | static struct { |
| @@ -378,6 +390,28 @@ static bool xen_page_pinned(void *ptr) | |||
| 378 | return PagePinned(page); | 390 | return PagePinned(page); |
| 379 | } | 391 | } |
| 380 | 392 | ||
| 393 | static bool xen_iomap_pte(pte_t pte) | ||
| 394 | { | ||
| 395 | return pte_flags(pte) & _PAGE_IOMAP; | ||
| 396 | } | ||
| 397 | |||
| 398 | static void xen_set_iomap_pte(pte_t *ptep, pte_t pteval) | ||
| 399 | { | ||
| 400 | struct multicall_space mcs; | ||
| 401 | struct mmu_update *u; | ||
| 402 | |||
| 403 | mcs = xen_mc_entry(sizeof(*u)); | ||
| 404 | u = mcs.args; | ||
| 405 | |||
| 406 | /* ptep might be kmapped when using 32-bit HIGHPTE */ | ||
| 407 | u->ptr = arbitrary_virt_to_machine(ptep).maddr; | ||
| 408 | u->val = pte_val_ma(pteval); | ||
| 409 | |||
| 410 | MULTI_mmu_update(mcs.mc, mcs.args, 1, NULL, DOMID_IO); | ||
| 411 | |||
| 412 | xen_mc_issue(PARAVIRT_LAZY_MMU); | ||
| 413 | } | ||
| 414 | |||
| 381 | static void xen_extend_mmu_update(const struct mmu_update *update) | 415 | static void xen_extend_mmu_update(const struct mmu_update *update) |
| 382 | { | 416 | { |
| 383 | struct multicall_space mcs; | 417 | struct multicall_space mcs; |
| @@ -454,6 +488,11 @@ void set_pte_mfn(unsigned long vaddr, unsigned long mfn, pgprot_t flags) | |||
| 454 | void xen_set_pte_at(struct mm_struct *mm, unsigned long addr, | 488 | void xen_set_pte_at(struct mm_struct *mm, unsigned long addr, |
| 455 | pte_t *ptep, pte_t pteval) | 489 | pte_t *ptep, pte_t pteval) |
| 456 | { | 490 | { |
| 491 | if (xen_iomap_pte(pteval)) { | ||
| 492 | xen_set_iomap_pte(ptep, pteval); | ||
| 493 | goto out; | ||
| 494 | } | ||
| 495 | |||
| 457 | ADD_STATS(set_pte_at, 1); | 496 | ADD_STATS(set_pte_at, 1); |
| 458 | // ADD_STATS(set_pte_at_pinned, xen_page_pinned(ptep)); | 497 | // ADD_STATS(set_pte_at_pinned, xen_page_pinned(ptep)); |
| 459 | ADD_STATS(set_pte_at_current, mm == current->mm); | 498 | ADD_STATS(set_pte_at_current, mm == current->mm); |
| @@ -524,8 +563,25 @@ static pteval_t pte_pfn_to_mfn(pteval_t val) | |||
| 524 | return val; | 563 | return val; |
| 525 | } | 564 | } |
| 526 | 565 | ||
| 566 | static pteval_t iomap_pte(pteval_t val) | ||
| 567 | { | ||
| 568 | if (val & _PAGE_PRESENT) { | ||
| 569 | unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; | ||
| 570 | pteval_t flags = val & PTE_FLAGS_MASK; | ||
| 571 | |||
| 572 | /* We assume the pte frame number is a MFN, so | ||
| 573 | just use it as-is. */ | ||
| 574 | val = ((pteval_t)pfn << PAGE_SHIFT) | flags; | ||
| 575 | } | ||
| 576 | |||
| 577 | return val; | ||
| 578 | } | ||
| 579 | |||
| 527 | pteval_t xen_pte_val(pte_t pte) | 580 | pteval_t xen_pte_val(pte_t pte) |
| 528 | { | 581 | { |
| 582 | if (xen_initial_domain() && (pte.pte & _PAGE_IOMAP)) | ||
| 583 | return pte.pte; | ||
| 584 | |||
| 529 | return pte_mfn_to_pfn(pte.pte); | 585 | return pte_mfn_to_pfn(pte.pte); |
| 530 | } | 586 | } |
| 531 | PV_CALLEE_SAVE_REGS_THUNK(xen_pte_val); | 587 | PV_CALLEE_SAVE_REGS_THUNK(xen_pte_val); |
| @@ -538,7 +594,22 @@ PV_CALLEE_SAVE_REGS_THUNK(xen_pgd_val); | |||
| 538 | 594 | ||
| 539 | pte_t xen_make_pte(pteval_t pte) | 595 | pte_t xen_make_pte(pteval_t pte) |
| 540 | { | 596 | { |
| 541 | pte = pte_pfn_to_mfn(pte); | 597 | phys_addr_t addr = (pte & PTE_PFN_MASK); |
| 598 | |||
| 599 | /* | ||
| 600 | * Unprivileged domains are allowed to do IOMAPpings for | ||
| 601 | * PCI passthrough, but not map ISA space. The ISA | ||
| 602 | * mappings are just dummy local mappings to keep other | ||
| 603 | * parts of the kernel happy. | ||
| 604 | */ | ||
| 605 | if (unlikely(pte & _PAGE_IOMAP) && | ||
| 606 | (xen_initial_domain() || addr >= ISA_END_ADDRESS)) { | ||
| 607 | pte = iomap_pte(pte); | ||
| 608 | } else { | ||
| 609 | pte &= ~_PAGE_IOMAP; | ||
| 610 | pte = pte_pfn_to_mfn(pte); | ||
| 611 | } | ||
| 612 | |||
| 542 | return native_make_pte(pte); | 613 | return native_make_pte(pte); |
| 543 | } | 614 | } |
| 544 | PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte); | 615 | PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte); |
| @@ -594,6 +665,11 @@ void xen_set_pud(pud_t *ptr, pud_t val) | |||
| 594 | 665 | ||
| 595 | void xen_set_pte(pte_t *ptep, pte_t pte) | 666 | void xen_set_pte(pte_t *ptep, pte_t pte) |
| 596 | { | 667 | { |
| 668 | if (xen_iomap_pte(pte)) { | ||
| 669 | xen_set_iomap_pte(ptep, pte); | ||
| 670 | return; | ||
| 671 | } | ||
| 672 | |||
| 597 | ADD_STATS(pte_update, 1); | 673 | ADD_STATS(pte_update, 1); |
| 598 | // ADD_STATS(pte_update_pinned, xen_page_pinned(ptep)); | 674 | // ADD_STATS(pte_update_pinned, xen_page_pinned(ptep)); |
| 599 | ADD_STATS(pte_update_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU); | 675 | ADD_STATS(pte_update_batched, paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU); |
| @@ -610,6 +686,11 @@ void xen_set_pte(pte_t *ptep, pte_t pte) | |||
| 610 | #ifdef CONFIG_X86_PAE | 686 | #ifdef CONFIG_X86_PAE |
| 611 | void xen_set_pte_atomic(pte_t *ptep, pte_t pte) | 687 | void xen_set_pte_atomic(pte_t *ptep, pte_t pte) |
| 612 | { | 688 | { |
| 689 | if (xen_iomap_pte(pte)) { | ||
| 690 | xen_set_iomap_pte(ptep, pte); | ||
| 691 | return; | ||
| 692 | } | ||
| 693 | |||
| 613 | set_64bit((u64 *)ptep, native_pte_val(pte)); | 694 | set_64bit((u64 *)ptep, native_pte_val(pte)); |
| 614 | } | 695 | } |
| 615 | 696 | ||
| @@ -936,8 +1017,6 @@ static int xen_pin_page(struct mm_struct *mm, struct page *page, | |||
| 936 | read-only, and can be pinned. */ | 1017 | read-only, and can be pinned. */ |
| 937 | static void __xen_pgd_pin(struct mm_struct *mm, pgd_t *pgd) | 1018 | static void __xen_pgd_pin(struct mm_struct *mm, pgd_t *pgd) |
| 938 | { | 1019 | { |
| 939 | vm_unmap_aliases(); | ||
| 940 | |||
| 941 | xen_mc_batch(); | 1020 | xen_mc_batch(); |
| 942 | 1021 | ||
| 943 | if (__xen_pgd_walk(mm, pgd, xen_pin_page, USER_LIMIT)) { | 1022 | if (__xen_pgd_walk(mm, pgd, xen_pin_page, USER_LIMIT)) { |
| @@ -1501,7 +1580,6 @@ static void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn, unsigned l | |||
| 1501 | if (PagePinned(virt_to_page(mm->pgd))) { | 1580 | if (PagePinned(virt_to_page(mm->pgd))) { |
| 1502 | SetPagePinned(page); | 1581 | SetPagePinned(page); |
| 1503 | 1582 | ||
| 1504 | vm_unmap_aliases(); | ||
| 1505 | if (!PageHighMem(page)) { | 1583 | if (!PageHighMem(page)) { |
| 1506 | make_lowmem_page_readonly(__va(PFN_PHYS((unsigned long)pfn))); | 1584 | make_lowmem_page_readonly(__va(PFN_PHYS((unsigned long)pfn))); |
| 1507 | if (level == PT_PTE && USE_SPLIT_PTLOCKS) | 1585 | if (level == PT_PTE && USE_SPLIT_PTLOCKS) |
| @@ -1812,9 +1890,16 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) | |||
| 1812 | pte = pfn_pte(phys, prot); | 1890 | pte = pfn_pte(phys, prot); |
| 1813 | break; | 1891 | break; |
| 1814 | 1892 | ||
| 1815 | default: | 1893 | case FIX_PARAVIRT_BOOTMAP: |
| 1894 | /* This is an MFN, but it isn't an IO mapping from the | ||
| 1895 | IO domain */ | ||
| 1816 | pte = mfn_pte(phys, prot); | 1896 | pte = mfn_pte(phys, prot); |
| 1817 | break; | 1897 | break; |
| 1898 | |||
| 1899 | default: | ||
| 1900 | /* By default, set_fixmap is used for hardware mappings */ | ||
| 1901 | pte = mfn_pte(phys, __pgprot(pgprot_val(prot) | _PAGE_IOMAP)); | ||
| 1902 | break; | ||
| 1818 | } | 1903 | } |
| 1819 | 1904 | ||
| 1820 | __native_set_fixmap(idx, pte); | 1905 | __native_set_fixmap(idx, pte); |
| @@ -1940,7 +2025,205 @@ void __init xen_init_mmu_ops(void) | |||
| 1940 | x86_init.paging.pagetable_setup_start = xen_pagetable_setup_start; | 2025 | x86_init.paging.pagetable_setup_start = xen_pagetable_setup_start; |
| 1941 | x86_init.paging.pagetable_setup_done = xen_pagetable_setup_done; | 2026 | x86_init.paging.pagetable_setup_done = xen_pagetable_setup_done; |
| 1942 | pv_mmu_ops = xen_mmu_ops; | 2027 | pv_mmu_ops = xen_mmu_ops; |
| 2028 | |||
| 2029 | vmap_lazy_unmap = false; | ||
| 2030 | } | ||
| 2031 | |||
| 2032 | /* Protected by xen_reservation_lock. */ | ||
| 2033 | #define MAX_CONTIG_ORDER 9 /* 2MB */ | ||
| 2034 | static unsigned long discontig_frames[1<<MAX_CONTIG_ORDER]; | ||
| 2035 | |||
| 2036 | #define VOID_PTE (mfn_pte(0, __pgprot(0))) | ||
| 2037 | static void xen_zap_pfn_range(unsigned long vaddr, unsigned int order, | ||
| 2038 | unsigned long *in_frames, | ||
| 2039 | unsigned long *out_frames) | ||
| 2040 | { | ||
| 2041 | int i; | ||
| 2042 | struct multicall_space mcs; | ||
| 2043 | |||
| 2044 | xen_mc_batch(); | ||
| 2045 | for (i = 0; i < (1UL<<order); i++, vaddr += PAGE_SIZE) { | ||
| 2046 | mcs = __xen_mc_entry(0); | ||
| 2047 | |||
| 2048 | if (in_frames) | ||
| 2049 | in_frames[i] = virt_to_mfn(vaddr); | ||
| 2050 | |||
| 2051 | MULTI_update_va_mapping(mcs.mc, vaddr, VOID_PTE, 0); | ||
| 2052 | set_phys_to_machine(virt_to_pfn(vaddr), INVALID_P2M_ENTRY); | ||
| 2053 | |||
| 2054 | if (out_frames) | ||
| 2055 | out_frames[i] = virt_to_pfn(vaddr); | ||
| 2056 | } | ||
| 2057 | xen_mc_issue(0); | ||
| 2058 | } | ||
| 2059 | |||
| 2060 | /* | ||
| 2061 | * Update the pfn-to-mfn mappings for a virtual address range, either to | ||
| 2062 | * point to an array of mfns, or contiguously from a single starting | ||
| 2063 | * mfn. | ||
| 2064 | */ | ||
| 2065 | static void xen_remap_exchanged_ptes(unsigned long vaddr, int order, | ||
| 2066 | unsigned long *mfns, | ||
| 2067 | unsigned long first_mfn) | ||
| 2068 | { | ||
| 2069 | unsigned i, limit; | ||
| 2070 | unsigned long mfn; | ||
| 2071 | |||
| 2072 | xen_mc_batch(); | ||
| 2073 | |||
| 2074 | limit = 1u << order; | ||
| 2075 | for (i = 0; i < limit; i++, vaddr += PAGE_SIZE) { | ||
| 2076 | struct multicall_space mcs; | ||
| 2077 | unsigned flags; | ||
| 2078 | |||
| 2079 | mcs = __xen_mc_entry(0); | ||
| 2080 | if (mfns) | ||
| 2081 | mfn = mfns[i]; | ||
| 2082 | else | ||
| 2083 | mfn = first_mfn + i; | ||
| 2084 | |||
| 2085 | if (i < (limit - 1)) | ||
| 2086 | flags = 0; | ||
| 2087 | else { | ||
| 2088 | if (order == 0) | ||
| 2089 | flags = UVMF_INVLPG | UVMF_ALL; | ||
| 2090 | else | ||
| 2091 | flags = UVMF_TLB_FLUSH | UVMF_ALL; | ||
| 2092 | } | ||
| 2093 | |||
| 2094 | MULTI_update_va_mapping(mcs.mc, vaddr, | ||
| 2095 | mfn_pte(mfn, PAGE_KERNEL), flags); | ||
| 2096 | |||
| 2097 | set_phys_to_machine(virt_to_pfn(vaddr), mfn); | ||
| 2098 | } | ||
| 2099 | |||
| 2100 | xen_mc_issue(0); | ||
| 2101 | } | ||
| 2102 | |||
| 2103 | /* | ||
| 2104 | * Perform the hypercall to exchange a region of our pfns to point to | ||
| 2105 | * memory with the required contiguous alignment. Takes the pfns as | ||
| 2106 | * input, and populates mfns as output. | ||
| 2107 | * | ||
| 2108 | * Returns a success code indicating whether the hypervisor was able to | ||
| 2109 | * satisfy the request or not. | ||
| 2110 | */ | ||
| 2111 | static int xen_exchange_memory(unsigned long extents_in, unsigned int order_in, | ||
| 2112 | unsigned long *pfns_in, | ||
| 2113 | unsigned long extents_out, | ||
| 2114 | unsigned int order_out, | ||
| 2115 | unsigned long *mfns_out, | ||
| 2116 | unsigned int address_bits) | ||
| 2117 | { | ||
| 2118 | long rc; | ||
| 2119 | int success; | ||
| 2120 | |||
| 2121 | struct xen_memory_exchange exchange = { | ||
| 2122 | .in = { | ||
| 2123 | .nr_extents = extents_in, | ||
| 2124 | .extent_order = order_in, | ||
| 2125 | .extent_start = pfns_in, | ||
| 2126 | .domid = DOMID_SELF | ||
| 2127 | }, | ||
| 2128 | .out = { | ||
| 2129 | .nr_extents = extents_out, | ||
| 2130 | .extent_order = order_out, | ||
| 2131 | .extent_start = mfns_out, | ||
| 2132 | .address_bits = address_bits, | ||
| 2133 | .domid = DOMID_SELF | ||
| 2134 | } | ||
| 2135 | }; | ||
| 2136 | |||
| 2137 | BUG_ON(extents_in << order_in != extents_out << order_out); | ||
| 2138 | |||
| 2139 | rc = HYPERVISOR_memory_op(XENMEM_exchange, &exchange); | ||
| 2140 | success = (exchange.nr_exchanged == extents_in); | ||
| 2141 | |||
| 2142 | BUG_ON(!success && ((exchange.nr_exchanged != 0) || (rc == 0))); | ||
| 2143 | BUG_ON(success && (rc != 0)); | ||
| 2144 | |||
| 2145 | return success; | ||
| 2146 | } | ||
| 2147 | |||
| 2148 | int xen_create_contiguous_region(unsigned long vstart, unsigned int order, | ||
| 2149 | unsigned int address_bits) | ||
| 2150 | { | ||
| 2151 | unsigned long *in_frames = discontig_frames, out_frame; | ||
| 2152 | unsigned long flags; | ||
| 2153 | int success; | ||
| 2154 | |||
| 2155 | /* | ||
| 2156 | * Currently an auto-translated guest will not perform I/O, nor will | ||
| 2157 | * it require PAE page directories below 4GB. Therefore any calls to | ||
| 2158 | * this function are redundant and can be ignored. | ||
| 2159 | */ | ||
| 2160 | |||
| 2161 | if (xen_feature(XENFEAT_auto_translated_physmap)) | ||
| 2162 | return 0; | ||
| 2163 | |||
| 2164 | if (unlikely(order > MAX_CONTIG_ORDER)) | ||
| 2165 | return -ENOMEM; | ||
| 2166 | |||
| 2167 | memset((void *) vstart, 0, PAGE_SIZE << order); | ||
| 2168 | |||
| 2169 | spin_lock_irqsave(&xen_reservation_lock, flags); | ||
| 2170 | |||
| 2171 | /* 1. Zap current PTEs, remembering MFNs. */ | ||
| 2172 | xen_zap_pfn_range(vstart, order, in_frames, NULL); | ||
| 2173 | |||
| 2174 | /* 2. Get a new contiguous memory extent. */ | ||
| 2175 | out_frame = virt_to_pfn(vstart); | ||
| 2176 | success = xen_exchange_memory(1UL << order, 0, in_frames, | ||
| 2177 | 1, order, &out_frame, | ||
| 2178 | address_bits); | ||
| 2179 | |||
| 2180 | /* 3. Map the new extent in place of old pages. */ | ||
| 2181 | if (success) | ||
| 2182 | xen_remap_exchanged_ptes(vstart, order, NULL, out_frame); | ||
| 2183 | else | ||
| 2184 | xen_remap_exchanged_ptes(vstart, order, in_frames, 0); | ||
| 2185 | |||
| 2186 | spin_unlock_irqrestore(&xen_reservation_lock, flags); | ||
| 2187 | |||
| 2188 | return success ? 0 : -ENOMEM; | ||
| 2189 | } | ||
| 2190 | EXPORT_SYMBOL_GPL(xen_create_contiguous_region); | ||
| 2191 | |||
| 2192 | void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order) | ||
| 2193 | { | ||
| 2194 | unsigned long *out_frames = discontig_frames, in_frame; | ||
| 2195 | unsigned long flags; | ||
| 2196 | int success; | ||
| 2197 | |||
| 2198 | if (xen_feature(XENFEAT_auto_translated_physmap)) | ||
| 2199 | return; | ||
| 2200 | |||
| 2201 | if (unlikely(order > MAX_CONTIG_ORDER)) | ||
| 2202 | return; | ||
| 2203 | |||
| 2204 | memset((void *) vstart, 0, PAGE_SIZE << order); | ||
| 2205 | |||
| 2206 | spin_lock_irqsave(&xen_reservation_lock, flags); | ||
| 2207 | |||
| 2208 | /* 1. Find start MFN of contiguous extent. */ | ||
| 2209 | in_frame = virt_to_mfn(vstart); | ||
| 2210 | |||
| 2211 | /* 2. Zap current PTEs. */ | ||
| 2212 | xen_zap_pfn_range(vstart, order, NULL, out_frames); | ||
| 2213 | |||
| 2214 | /* 3. Do the exchange for non-contiguous MFNs. */ | ||
| 2215 | success = xen_exchange_memory(1, order, &in_frame, 1UL << order, | ||
| 2216 | 0, out_frames, 0); | ||
| 2217 | |||
| 2218 | /* 4. Map new pages in place of old pages. */ | ||
| 2219 | if (success) | ||
| 2220 | xen_remap_exchanged_ptes(vstart, order, out_frames, 0); | ||
| 2221 | else | ||
| 2222 | xen_remap_exchanged_ptes(vstart, order, NULL, in_frame); | ||
| 2223 | |||
| 2224 | spin_unlock_irqrestore(&xen_reservation_lock, flags); | ||
| 1943 | } | 2225 | } |
| 2226 | EXPORT_SYMBOL_GPL(xen_destroy_contiguous_region); | ||
| 1944 | 2227 | ||
| 1945 | #ifdef CONFIG_XEN_PVHVM | 2228 | #ifdef CONFIG_XEN_PVHVM |
| 1946 | static void xen_hvm_exit_mmap(struct mm_struct *mm) | 2229 | static void xen_hvm_exit_mmap(struct mm_struct *mm) |
diff --git a/arch/x86/xen/pci-swiotlb-xen.c b/arch/x86/xen/pci-swiotlb-xen.c new file mode 100644 index 000000000000..a013ec9d0c54 --- /dev/null +++ b/arch/x86/xen/pci-swiotlb-xen.c | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /* Glue code to lib/swiotlb-xen.c */ | ||
| 2 | |||
| 3 | #include <linux/dma-mapping.h> | ||
| 4 | #include <xen/swiotlb-xen.h> | ||
| 5 | |||
| 6 | #include <asm/xen/hypervisor.h> | ||
| 7 | #include <xen/xen.h> | ||
| 8 | |||
| 9 | int xen_swiotlb __read_mostly; | ||
| 10 | |||
| 11 | static struct dma_map_ops xen_swiotlb_dma_ops = { | ||
| 12 | .mapping_error = xen_swiotlb_dma_mapping_error, | ||
| 13 | .alloc_coherent = xen_swiotlb_alloc_coherent, | ||
| 14 | .free_coherent = xen_swiotlb_free_coherent, | ||
| 15 | .sync_single_for_cpu = xen_swiotlb_sync_single_for_cpu, | ||
| 16 | .sync_single_for_device = xen_swiotlb_sync_single_for_device, | ||
| 17 | .sync_sg_for_cpu = xen_swiotlb_sync_sg_for_cpu, | ||
| 18 | .sync_sg_for_device = xen_swiotlb_sync_sg_for_device, | ||
| 19 | .map_sg = xen_swiotlb_map_sg_attrs, | ||
| 20 | .unmap_sg = xen_swiotlb_unmap_sg_attrs, | ||
| 21 | .map_page = xen_swiotlb_map_page, | ||
| 22 | .unmap_page = xen_swiotlb_unmap_page, | ||
| 23 | .dma_supported = xen_swiotlb_dma_supported, | ||
| 24 | }; | ||
| 25 | |||
| 26 | /* | ||
| 27 | * pci_xen_swiotlb_detect - set xen_swiotlb to 1 if necessary | ||
| 28 | * | ||
| 29 | * This returns non-zero if we are forced to use xen_swiotlb (by the boot | ||
| 30 | * option). | ||
| 31 | */ | ||
| 32 | int __init pci_xen_swiotlb_detect(void) | ||
| 33 | { | ||
| 34 | |||
| 35 | /* If running as PV guest, either iommu=soft, or swiotlb=force will | ||
| 36 | * activate this IOMMU. If running as PV privileged, activate it | ||
| 37 | * irregardlesss. | ||
| 38 | */ | ||
| 39 | if ((xen_initial_domain() || swiotlb || swiotlb_force) && | ||
| 40 | (xen_pv_domain())) | ||
| 41 | xen_swiotlb = 1; | ||
| 42 | |||
| 43 | /* If we are running under Xen, we MUST disable the native SWIOTLB. | ||
| 44 | * Don't worry about swiotlb_force flag activating the native, as | ||
| 45 | * the 'swiotlb' flag is the only one turning it on. */ | ||
| 46 | if (xen_pv_domain()) | ||
| 47 | swiotlb = 0; | ||
| 48 | |||
| 49 | return xen_swiotlb; | ||
| 50 | } | ||
| 51 | |||
| 52 | void __init pci_xen_swiotlb_init(void) | ||
| 53 | { | ||
| 54 | if (xen_swiotlb) { | ||
| 55 | xen_swiotlb_init(1); | ||
| 56 | dma_ops = &xen_swiotlb_dma_ops; | ||
| 57 | } | ||
| 58 | } | ||
diff --git a/block/blk-core.c b/block/blk-core.c index 7da630e25ae7..ee1a1e7e63cc 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
| @@ -1514,7 +1514,10 @@ static inline void __generic_make_request(struct bio *bio) | |||
| 1514 | if (bio_check_eod(bio, nr_sectors)) | 1514 | if (bio_check_eod(bio, nr_sectors)) |
| 1515 | goto end_io; | 1515 | goto end_io; |
| 1516 | 1516 | ||
| 1517 | if ((bio->bi_rw & REQ_DISCARD) && !blk_queue_discard(q)) { | 1517 | if ((bio->bi_rw & REQ_DISCARD) && |
| 1518 | (!blk_queue_discard(q) || | ||
| 1519 | ((bio->bi_rw & REQ_SECURE) && | ||
| 1520 | !blk_queue_secdiscard(q)))) { | ||
| 1518 | err = -EOPNOTSUPP; | 1521 | err = -EOPNOTSUPP; |
| 1519 | goto end_io; | 1522 | goto end_io; |
| 1520 | } | 1523 | } |
diff --git a/block/blk-lib.c b/block/blk-lib.c index c1fc55a83ba1..c392029a104e 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c | |||
| @@ -62,6 +62,12 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | |||
| 62 | max_discard_sectors &= ~(disc_sects - 1); | 62 | max_discard_sectors &= ~(disc_sects - 1); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | if (flags & BLKDEV_IFL_SECURE) { | ||
| 66 | if (!blk_queue_secdiscard(q)) | ||
| 67 | return -EOPNOTSUPP; | ||
| 68 | type |= DISCARD_SECURE; | ||
| 69 | } | ||
| 70 | |||
| 65 | while (nr_sects && !ret) { | 71 | while (nr_sects && !ret) { |
| 66 | bio = bio_alloc(gfp_mask, 1); | 72 | bio = bio_alloc(gfp_mask, 1); |
| 67 | if (!bio) { | 73 | if (!bio) { |
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c index d53085637731..119f07b74dc0 100644 --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c | |||
| @@ -703,6 +703,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
| 703 | case BLKFLSBUF: | 703 | case BLKFLSBUF: |
| 704 | case BLKROSET: | 704 | case BLKROSET: |
| 705 | case BLKDISCARD: | 705 | case BLKDISCARD: |
| 706 | case BLKSECDISCARD: | ||
| 706 | /* | 707 | /* |
| 707 | * the ones below are implemented in blkdev_locked_ioctl, | 708 | * the ones below are implemented in blkdev_locked_ioctl, |
| 708 | * but we call blkdev_ioctl, which gets the lock for us | 709 | * but we call blkdev_ioctl, which gets the lock for us |
diff --git a/block/elevator.c b/block/elevator.c index 816a7c8d6394..ec585c9554d3 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
| @@ -83,6 +83,12 @@ int elv_rq_merge_ok(struct request *rq, struct bio *bio) | |||
| 83 | return 0; | 83 | return 0; |
| 84 | 84 | ||
| 85 | /* | 85 | /* |
| 86 | * Don't merge discard requests and secure discard requests | ||
| 87 | */ | ||
| 88 | if ((bio->bi_rw & REQ_SECURE) != (rq->bio->bi_rw & REQ_SECURE)) | ||
| 89 | return 0; | ||
| 90 | |||
| 91 | /* | ||
| 86 | * different data direction or already started, don't merge | 92 | * different data direction or already started, don't merge |
| 87 | */ | 93 | */ |
| 88 | if (bio_data_dir(bio) != rq_data_dir(rq)) | 94 | if (bio_data_dir(bio) != rq_data_dir(rq)) |
diff --git a/block/ioctl.c b/block/ioctl.c index 09fd7f1ef23a..d8052f0dabd3 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
| @@ -114,8 +114,10 @@ static int blkdev_reread_part(struct block_device *bdev) | |||
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | static int blk_ioctl_discard(struct block_device *bdev, uint64_t start, | 116 | static int blk_ioctl_discard(struct block_device *bdev, uint64_t start, |
| 117 | uint64_t len) | 117 | uint64_t len, int secure) |
| 118 | { | 118 | { |
| 119 | unsigned long flags = BLKDEV_IFL_WAIT; | ||
| 120 | |||
| 119 | if (start & 511) | 121 | if (start & 511) |
| 120 | return -EINVAL; | 122 | return -EINVAL; |
| 121 | if (len & 511) | 123 | if (len & 511) |
| @@ -125,8 +127,9 @@ static int blk_ioctl_discard(struct block_device *bdev, uint64_t start, | |||
| 125 | 127 | ||
| 126 | if (start + len > (bdev->bd_inode->i_size >> 9)) | 128 | if (start + len > (bdev->bd_inode->i_size >> 9)) |
| 127 | return -EINVAL; | 129 | return -EINVAL; |
| 128 | return blkdev_issue_discard(bdev, start, len, GFP_KERNEL, | 130 | if (secure) |
| 129 | BLKDEV_IFL_WAIT); | 131 | flags |= BLKDEV_IFL_SECURE; |
| 132 | return blkdev_issue_discard(bdev, start, len, GFP_KERNEL, flags); | ||
| 130 | } | 133 | } |
| 131 | 134 | ||
| 132 | static int put_ushort(unsigned long arg, unsigned short val) | 135 | static int put_ushort(unsigned long arg, unsigned short val) |
| @@ -213,7 +216,8 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
| 213 | set_device_ro(bdev, n); | 216 | set_device_ro(bdev, n); |
| 214 | return 0; | 217 | return 0; |
| 215 | 218 | ||
| 216 | case BLKDISCARD: { | 219 | case BLKDISCARD: |
| 220 | case BLKSECDISCARD: { | ||
| 217 | uint64_t range[2]; | 221 | uint64_t range[2]; |
| 218 | 222 | ||
| 219 | if (!(mode & FMODE_WRITE)) | 223 | if (!(mode & FMODE_WRITE)) |
| @@ -222,7 +226,8 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
| 222 | if (copy_from_user(range, (void __user *)arg, sizeof(range))) | 226 | if (copy_from_user(range, (void __user *)arg, sizeof(range))) |
| 223 | return -EFAULT; | 227 | return -EFAULT; |
| 224 | 228 | ||
| 225 | return blk_ioctl_discard(bdev, range[0], range[1]); | 229 | return blk_ioctl_discard(bdev, range[0], range[1], |
| 230 | cmd == BLKSECDISCARD); | ||
| 226 | } | 231 | } |
| 227 | 232 | ||
| 228 | case HDIO_GETGEO: { | 233 | case HDIO_GETGEO: { |
diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 864dd46c346f..18645f4e83cd 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #include <linux/uaccess.h> | 33 | #include <linux/uaccess.h> |
| 34 | #include <linux/cper.h> | 34 | #include <linux/cper.h> |
| 35 | #include <linux/nmi.h> | 35 | #include <linux/nmi.h> |
| 36 | #include <linux/hardirq.h> | ||
| 36 | #include <acpi/apei.h> | 37 | #include <acpi/apei.h> |
| 37 | 38 | ||
| 38 | #include "apei-internal.h" | 39 | #include "apei-internal.h" |
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index f087ab55b1df..8cc536e49a0a 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c | |||
| @@ -680,7 +680,7 @@ mpc52xx_ata_remove_one(struct device *dev) | |||
| 680 | /* ======================================================================== */ | 680 | /* ======================================================================== */ |
| 681 | 681 | ||
| 682 | static int __devinit | 682 | static int __devinit |
| 683 | mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match) | 683 | mpc52xx_ata_probe(struct platform_device *op, const struct of_device_id *match) |
| 684 | { | 684 | { |
| 685 | unsigned int ipb_freq; | 685 | unsigned int ipb_freq; |
| 686 | struct resource res_mem; | 686 | struct resource res_mem; |
| @@ -821,7 +821,7 @@ mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match) | |||
| 821 | } | 821 | } |
| 822 | 822 | ||
| 823 | static int | 823 | static int |
| 824 | mpc52xx_ata_remove(struct of_device *op) | 824 | mpc52xx_ata_remove(struct platform_device *op) |
| 825 | { | 825 | { |
| 826 | struct mpc52xx_ata_priv *priv; | 826 | struct mpc52xx_ata_priv *priv; |
| 827 | int task_irq; | 827 | int task_irq; |
| @@ -848,7 +848,7 @@ mpc52xx_ata_remove(struct of_device *op) | |||
| 848 | #ifdef CONFIG_PM | 848 | #ifdef CONFIG_PM |
| 849 | 849 | ||
| 850 | static int | 850 | static int |
| 851 | mpc52xx_ata_suspend(struct of_device *op, pm_message_t state) | 851 | mpc52xx_ata_suspend(struct platform_device *op, pm_message_t state) |
| 852 | { | 852 | { |
| 853 | struct ata_host *host = dev_get_drvdata(&op->dev); | 853 | struct ata_host *host = dev_get_drvdata(&op->dev); |
| 854 | 854 | ||
| @@ -856,7 +856,7 @@ mpc52xx_ata_suspend(struct of_device *op, pm_message_t state) | |||
| 856 | } | 856 | } |
| 857 | 857 | ||
| 858 | static int | 858 | static int |
| 859 | mpc52xx_ata_resume(struct of_device *op) | 859 | mpc52xx_ata_resume(struct platform_device *op) |
| 860 | { | 860 | { |
| 861 | struct ata_host *host = dev_get_drvdata(&op->dev); | 861 | struct ata_host *host = dev_get_drvdata(&op->dev); |
| 862 | struct mpc52xx_ata_priv *priv = host->private_data; | 862 | struct mpc52xx_ata_priv *priv = host->private_data; |
diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c index 5a1b82c08be9..480e043ce6b8 100644 --- a/drivers/ata/pata_of_platform.c +++ b/drivers/ata/pata_of_platform.c | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include <linux/of_platform.h> | 14 | #include <linux/of_platform.h> |
| 15 | #include <linux/ata_platform.h> | 15 | #include <linux/ata_platform.h> |
| 16 | 16 | ||
| 17 | static int __devinit pata_of_platform_probe(struct of_device *ofdev, | 17 | static int __devinit pata_of_platform_probe(struct platform_device *ofdev, |
| 18 | const struct of_device_id *match) | 18 | const struct of_device_id *match) |
| 19 | { | 19 | { |
| 20 | int ret; | 20 | int ret; |
| @@ -78,7 +78,7 @@ static int __devinit pata_of_platform_probe(struct of_device *ofdev, | |||
| 78 | reg_shift, pio_mask); | 78 | reg_shift, pio_mask); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | static int __devexit pata_of_platform_remove(struct of_device *ofdev) | 81 | static int __devexit pata_of_platform_remove(struct platform_device *ofdev) |
| 82 | { | 82 | { |
| 83 | return __pata_platform_remove(&ofdev->dev); | 83 | return __pata_platform_remove(&ofdev->dev); |
| 84 | } | 84 | } |
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index 18c986dbb7f1..7325f77480dc 100644 --- a/drivers/ata/sata_fsl.c +++ b/drivers/ata/sata_fsl.c | |||
| @@ -1296,7 +1296,7 @@ static const struct ata_port_info sata_fsl_port_info[] = { | |||
| 1296 | }, | 1296 | }, |
| 1297 | }; | 1297 | }; |
| 1298 | 1298 | ||
| 1299 | static int sata_fsl_probe(struct of_device *ofdev, | 1299 | static int sata_fsl_probe(struct platform_device *ofdev, |
| 1300 | const struct of_device_id *match) | 1300 | const struct of_device_id *match) |
| 1301 | { | 1301 | { |
| 1302 | int retval = -ENXIO; | 1302 | int retval = -ENXIO; |
| @@ -1370,7 +1370,7 @@ error_exit_with_cleanup: | |||
| 1370 | return retval; | 1370 | return retval; |
| 1371 | } | 1371 | } |
| 1372 | 1372 | ||
| 1373 | static int sata_fsl_remove(struct of_device *ofdev) | 1373 | static int sata_fsl_remove(struct platform_device *ofdev) |
| 1374 | { | 1374 | { |
| 1375 | struct ata_host *host = dev_get_drvdata(&ofdev->dev); | 1375 | struct ata_host *host = dev_get_drvdata(&ofdev->dev); |
| 1376 | struct sata_fsl_host_priv *host_priv = host->private_data; | 1376 | struct sata_fsl_host_priv *host_priv = host->private_data; |
| @@ -1387,13 +1387,13 @@ static int sata_fsl_remove(struct of_device *ofdev) | |||
| 1387 | } | 1387 | } |
| 1388 | 1388 | ||
| 1389 | #ifdef CONFIG_PM | 1389 | #ifdef CONFIG_PM |
| 1390 | static int sata_fsl_suspend(struct of_device *op, pm_message_t state) | 1390 | static int sata_fsl_suspend(struct platform_device *op, pm_message_t state) |
| 1391 | { | 1391 | { |
| 1392 | struct ata_host *host = dev_get_drvdata(&op->dev); | 1392 | struct ata_host *host = dev_get_drvdata(&op->dev); |
| 1393 | return ata_host_suspend(host, state); | 1393 | return ata_host_suspend(host, state); |
| 1394 | } | 1394 | } |
| 1395 | 1395 | ||
| 1396 | static int sata_fsl_resume(struct of_device *op) | 1396 | static int sata_fsl_resume(struct platform_device *op) |
| 1397 | { | 1397 | { |
| 1398 | struct ata_host *host = dev_get_drvdata(&op->dev); | 1398 | struct ata_host *host = dev_get_drvdata(&op->dev); |
| 1399 | struct sata_fsl_host_priv *host_priv = host->private_data; | 1399 | struct sata_fsl_host_priv *host_priv = host->private_data; |
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index b7385e077717..c8fc69c85a06 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c | |||
| @@ -674,7 +674,7 @@ static void fore200e_sba_write(u32 val, volatile u32 __iomem *addr) | |||
| 674 | 674 | ||
| 675 | static u32 fore200e_sba_dma_map(struct fore200e *fore200e, void* virt_addr, int size, int direction) | 675 | static u32 fore200e_sba_dma_map(struct fore200e *fore200e, void* virt_addr, int size, int direction) |
| 676 | { | 676 | { |
| 677 | struct of_device *op = fore200e->bus_dev; | 677 | struct platform_device *op = fore200e->bus_dev; |
| 678 | u32 dma_addr; | 678 | u32 dma_addr; |
| 679 | 679 | ||
| 680 | dma_addr = dma_map_single(&op->dev, virt_addr, size, direction); | 680 | dma_addr = dma_map_single(&op->dev, virt_addr, size, direction); |
| @@ -687,7 +687,7 @@ static u32 fore200e_sba_dma_map(struct fore200e *fore200e, void* virt_addr, int | |||
| 687 | 687 | ||
| 688 | static void fore200e_sba_dma_unmap(struct fore200e *fore200e, u32 dma_addr, int size, int direction) | 688 | static void fore200e_sba_dma_unmap(struct fore200e *fore200e, u32 dma_addr, int size, int direction) |
| 689 | { | 689 | { |
| 690 | struct of_device *op = fore200e->bus_dev; | 690 | struct platform_device *op = fore200e->bus_dev; |
| 691 | 691 | ||
| 692 | DPRINTK(3, "SBUS DVMA unmapping: dma_addr = 0x%08x, size = %d, direction = %d,\n", | 692 | DPRINTK(3, "SBUS DVMA unmapping: dma_addr = 0x%08x, size = %d, direction = %d,\n", |
| 693 | dma_addr, size, direction); | 693 | dma_addr, size, direction); |
| @@ -697,7 +697,7 @@ static void fore200e_sba_dma_unmap(struct fore200e *fore200e, u32 dma_addr, int | |||
| 697 | 697 | ||
| 698 | static void fore200e_sba_dma_sync_for_cpu(struct fore200e *fore200e, u32 dma_addr, int size, int direction) | 698 | static void fore200e_sba_dma_sync_for_cpu(struct fore200e *fore200e, u32 dma_addr, int size, int direction) |
| 699 | { | 699 | { |
| 700 | struct of_device *op = fore200e->bus_dev; | 700 | struct platform_device *op = fore200e->bus_dev; |
| 701 | 701 | ||
| 702 | DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); | 702 | DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); |
| 703 | 703 | ||
| @@ -706,7 +706,7 @@ static void fore200e_sba_dma_sync_for_cpu(struct fore200e *fore200e, u32 dma_add | |||
| 706 | 706 | ||
| 707 | static void fore200e_sba_dma_sync_for_device(struct fore200e *fore200e, u32 dma_addr, int size, int direction) | 707 | static void fore200e_sba_dma_sync_for_device(struct fore200e *fore200e, u32 dma_addr, int size, int direction) |
| 708 | { | 708 | { |
| 709 | struct of_device *op = fore200e->bus_dev; | 709 | struct platform_device *op = fore200e->bus_dev; |
| 710 | 710 | ||
| 711 | DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); | 711 | DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction); |
| 712 | 712 | ||
| @@ -719,7 +719,7 @@ static void fore200e_sba_dma_sync_for_device(struct fore200e *fore200e, u32 dma_ | |||
| 719 | static int fore200e_sba_dma_chunk_alloc(struct fore200e *fore200e, struct chunk *chunk, | 719 | static int fore200e_sba_dma_chunk_alloc(struct fore200e *fore200e, struct chunk *chunk, |
| 720 | int size, int nbr, int alignment) | 720 | int size, int nbr, int alignment) |
| 721 | { | 721 | { |
| 722 | struct of_device *op = fore200e->bus_dev; | 722 | struct platform_device *op = fore200e->bus_dev; |
| 723 | 723 | ||
| 724 | chunk->alloc_size = chunk->align_size = size * nbr; | 724 | chunk->alloc_size = chunk->align_size = size * nbr; |
| 725 | 725 | ||
| @@ -738,7 +738,7 @@ static int fore200e_sba_dma_chunk_alloc(struct fore200e *fore200e, struct chunk | |||
| 738 | /* free a DVMA consistent chunk of memory */ | 738 | /* free a DVMA consistent chunk of memory */ |
| 739 | static void fore200e_sba_dma_chunk_free(struct fore200e *fore200e, struct chunk *chunk) | 739 | static void fore200e_sba_dma_chunk_free(struct fore200e *fore200e, struct chunk *chunk) |
| 740 | { | 740 | { |
| 741 | struct of_device *op = fore200e->bus_dev; | 741 | struct platform_device *op = fore200e->bus_dev; |
| 742 | 742 | ||
| 743 | dma_free_coherent(&op->dev, chunk->alloc_size, | 743 | dma_free_coherent(&op->dev, chunk->alloc_size, |
| 744 | chunk->alloc_addr, chunk->dma_addr); | 744 | chunk->alloc_addr, chunk->dma_addr); |
| @@ -770,7 +770,7 @@ static void fore200e_sba_reset(struct fore200e *fore200e) | |||
| 770 | 770 | ||
| 771 | static int __init fore200e_sba_map(struct fore200e *fore200e) | 771 | static int __init fore200e_sba_map(struct fore200e *fore200e) |
| 772 | { | 772 | { |
| 773 | struct of_device *op = fore200e->bus_dev; | 773 | struct platform_device *op = fore200e->bus_dev; |
| 774 | unsigned int bursts; | 774 | unsigned int bursts; |
| 775 | 775 | ||
| 776 | /* gain access to the SBA specific registers */ | 776 | /* gain access to the SBA specific registers */ |
| @@ -800,7 +800,7 @@ static int __init fore200e_sba_map(struct fore200e *fore200e) | |||
| 800 | 800 | ||
| 801 | static void fore200e_sba_unmap(struct fore200e *fore200e) | 801 | static void fore200e_sba_unmap(struct fore200e *fore200e) |
| 802 | { | 802 | { |
| 803 | struct of_device *op = fore200e->bus_dev; | 803 | struct platform_device *op = fore200e->bus_dev; |
| 804 | 804 | ||
| 805 | of_iounmap(&op->resource[0], fore200e->regs.sba.hcr, SBA200E_HCR_LENGTH); | 805 | of_iounmap(&op->resource[0], fore200e->regs.sba.hcr, SBA200E_HCR_LENGTH); |
| 806 | of_iounmap(&op->resource[1], fore200e->regs.sba.bsr, SBA200E_BSR_LENGTH); | 806 | of_iounmap(&op->resource[1], fore200e->regs.sba.bsr, SBA200E_BSR_LENGTH); |
| @@ -816,7 +816,7 @@ static int __init fore200e_sba_configure(struct fore200e *fore200e) | |||
| 816 | 816 | ||
| 817 | static int __init fore200e_sba_prom_read(struct fore200e *fore200e, struct prom_data *prom) | 817 | static int __init fore200e_sba_prom_read(struct fore200e *fore200e, struct prom_data *prom) |
| 818 | { | 818 | { |
| 819 | struct of_device *op = fore200e->bus_dev; | 819 | struct platform_device *op = fore200e->bus_dev; |
| 820 | const u8 *prop; | 820 | const u8 *prop; |
| 821 | int len; | 821 | int len; |
| 822 | 822 | ||
| @@ -840,7 +840,7 @@ static int __init fore200e_sba_prom_read(struct fore200e *fore200e, struct prom_ | |||
| 840 | 840 | ||
| 841 | static int fore200e_sba_proc_read(struct fore200e *fore200e, char *page) | 841 | static int fore200e_sba_proc_read(struct fore200e *fore200e, char *page) |
| 842 | { | 842 | { |
| 843 | struct of_device *op = fore200e->bus_dev; | 843 | struct platform_device *op = fore200e->bus_dev; |
| 844 | const struct linux_prom_registers *regs; | 844 | const struct linux_prom_registers *regs; |
| 845 | 845 | ||
| 846 | regs = of_get_property(op->dev.of_node, "reg", NULL); | 846 | regs = of_get_property(op->dev.of_node, "reg", NULL); |
| @@ -2513,7 +2513,7 @@ fore200e_load_and_start_fw(struct fore200e* fore200e) | |||
| 2513 | device = &((struct pci_dev *) fore200e->bus_dev)->dev; | 2513 | device = &((struct pci_dev *) fore200e->bus_dev)->dev; |
| 2514 | #ifdef CONFIG_SBUS | 2514 | #ifdef CONFIG_SBUS |
| 2515 | else if (strcmp(fore200e->bus->model_name, "SBA-200E") == 0) | 2515 | else if (strcmp(fore200e->bus->model_name, "SBA-200E") == 0) |
| 2516 | device = &((struct of_device *) fore200e->bus_dev)->dev; | 2516 | device = &((struct platform_device *) fore200e->bus_dev)->dev; |
| 2517 | #endif | 2517 | #endif |
| 2518 | else | 2518 | else |
| 2519 | return err; | 2519 | return err; |
| @@ -2643,7 +2643,7 @@ fore200e_init(struct fore200e* fore200e) | |||
| 2643 | } | 2643 | } |
| 2644 | 2644 | ||
| 2645 | #ifdef CONFIG_SBUS | 2645 | #ifdef CONFIG_SBUS |
| 2646 | static int __devinit fore200e_sba_probe(struct of_device *op, | 2646 | static int __devinit fore200e_sba_probe(struct platform_device *op, |
| 2647 | const struct of_device_id *match) | 2647 | const struct of_device_id *match) |
| 2648 | { | 2648 | { |
| 2649 | const struct fore200e_bus *bus = match->data; | 2649 | const struct fore200e_bus *bus = match->data; |
| @@ -2675,7 +2675,7 @@ static int __devinit fore200e_sba_probe(struct of_device *op, | |||
| 2675 | return 0; | 2675 | return 0; |
| 2676 | } | 2676 | } |
| 2677 | 2677 | ||
| 2678 | static int __devexit fore200e_sba_remove(struct of_device *op) | 2678 | static int __devexit fore200e_sba_remove(struct platform_device *op) |
| 2679 | { | 2679 | { |
| 2680 | struct fore200e *fore200e = dev_get_drvdata(&op->dev); | 2680 | struct fore200e *fore200e = dev_get_drvdata(&op->dev); |
| 2681 | 2681 | ||
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index b71888b909a0..2982b3ee9465 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
| @@ -1194,7 +1194,7 @@ static struct platform_driver ace_platform_driver = { | |||
| 1194 | 1194 | ||
| 1195 | #if defined(CONFIG_OF) | 1195 | #if defined(CONFIG_OF) |
| 1196 | static int __devinit | 1196 | static int __devinit |
| 1197 | ace_of_probe(struct of_device *op, const struct of_device_id *match) | 1197 | ace_of_probe(struct platform_device *op, const struct of_device_id *match) |
| 1198 | { | 1198 | { |
| 1199 | struct resource res; | 1199 | struct resource res; |
| 1200 | resource_size_t physaddr; | 1200 | resource_size_t physaddr; |
| @@ -1226,7 +1226,7 @@ ace_of_probe(struct of_device *op, const struct of_device_id *match) | |||
| 1226 | return ace_alloc(&op->dev, id ? *id : 0, physaddr, irq, bus_width); | 1226 | return ace_alloc(&op->dev, id ? *id : 0, physaddr, irq, bus_width); |
| 1227 | } | 1227 | } |
| 1228 | 1228 | ||
| 1229 | static int __devexit ace_of_remove(struct of_device *op) | 1229 | static int __devexit ace_of_remove(struct platform_device *op) |
| 1230 | { | 1230 | { |
| 1231 | ace_free(&op->dev); | 1231 | ace_free(&op->dev); |
| 1232 | return 0; | 1232 | return 0; |
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 7cfcc629a7fd..3d44ec724c17 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
| @@ -1002,7 +1002,7 @@ config SCx200_GPIO | |||
| 1002 | 1002 | ||
| 1003 | config PC8736x_GPIO | 1003 | config PC8736x_GPIO |
| 1004 | tristate "NatSemi PC8736x GPIO Support" | 1004 | tristate "NatSemi PC8736x GPIO Support" |
| 1005 | depends on X86 | 1005 | depends on X86_32 |
| 1006 | default SCx200_GPIO # mostly N | 1006 | default SCx200_GPIO # mostly N |
| 1007 | select NSC_GPIO # needed for support routines | 1007 | select NSC_GPIO # needed for support routines |
| 1008 | help | 1008 | help |
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c index 7a4f080f8356..1acdb2509511 100644 --- a/drivers/char/hw_random/n2-drv.c +++ b/drivers/char/hw_random/n2-drv.c | |||
| @@ -619,7 +619,7 @@ static void __devinit n2rng_driver_version(void) | |||
| 619 | pr_info("%s", version); | 619 | pr_info("%s", version); |
| 620 | } | 620 | } |
| 621 | 621 | ||
| 622 | static int __devinit n2rng_probe(struct of_device *op, | 622 | static int __devinit n2rng_probe(struct platform_device *op, |
| 623 | const struct of_device_id *match) | 623 | const struct of_device_id *match) |
| 624 | { | 624 | { |
| 625 | int victoria_falls = (match->data != NULL); | 625 | int victoria_falls = (match->data != NULL); |
| @@ -714,7 +714,7 @@ out: | |||
| 714 | return err; | 714 | return err; |
| 715 | } | 715 | } |
| 716 | 716 | ||
| 717 | static int __devexit n2rng_remove(struct of_device *op) | 717 | static int __devexit n2rng_remove(struct platform_device *op) |
| 718 | { | 718 | { |
| 719 | struct n2rng *np = dev_get_drvdata(&op->dev); | 719 | struct n2rng *np = dev_get_drvdata(&op->dev); |
| 720 | 720 | ||
diff --git a/drivers/char/hw_random/n2rng.h b/drivers/char/hw_random/n2rng.h index a2b81e7bfc18..4bea07f30978 100644 --- a/drivers/char/hw_random/n2rng.h +++ b/drivers/char/hw_random/n2rng.h | |||
| @@ -65,7 +65,7 @@ struct n2rng_unit { | |||
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | struct n2rng { | 67 | struct n2rng { |
| 68 | struct of_device *op; | 68 | struct platform_device *op; |
| 69 | 69 | ||
| 70 | unsigned long flags; | 70 | unsigned long flags; |
| 71 | #define N2RNG_FLAG_VF 0x00000001 /* Victoria Falls RNG, else N2 */ | 71 | #define N2RNG_FLAG_VF 0x00000001 /* Victoria Falls RNG, else N2 */ |
diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c index 261ba8f22b8b..a31c830ca8cd 100644 --- a/drivers/char/hw_random/pasemi-rng.c +++ b/drivers/char/hw_random/pasemi-rng.c | |||
| @@ -94,7 +94,7 @@ static struct hwrng pasemi_rng = { | |||
| 94 | .data_read = pasemi_rng_data_read, | 94 | .data_read = pasemi_rng_data_read, |
| 95 | }; | 95 | }; |
| 96 | 96 | ||
| 97 | static int __devinit rng_probe(struct of_device *ofdev, | 97 | static int __devinit rng_probe(struct platform_device *ofdev, |
| 98 | const struct of_device_id *match) | 98 | const struct of_device_id *match) |
| 99 | { | 99 | { |
| 100 | void __iomem *rng_regs; | 100 | void __iomem *rng_regs; |
| @@ -123,7 +123,7 @@ static int __devinit rng_probe(struct of_device *ofdev, | |||
| 123 | return err; | 123 | return err; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | static int __devexit rng_remove(struct of_device *dev) | 126 | static int __devexit rng_remove(struct platform_device *dev) |
| 127 | { | 127 | { |
| 128 | void __iomem *rng_regs = (void __iomem *)pasemi_rng.priv; | 128 | void __iomem *rng_regs = (void __iomem *)pasemi_rng.priv; |
| 129 | 129 | ||
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 48330e0fd488..3822b4f49c84 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
| @@ -2528,7 +2528,7 @@ static struct pci_driver ipmi_pci_driver = { | |||
| 2528 | 2528 | ||
| 2529 | 2529 | ||
| 2530 | #ifdef CONFIG_PPC_OF | 2530 | #ifdef CONFIG_PPC_OF |
| 2531 | static int __devinit ipmi_of_probe(struct of_device *dev, | 2531 | static int __devinit ipmi_of_probe(struct platform_device *dev, |
| 2532 | const struct of_device_id *match) | 2532 | const struct of_device_id *match) |
| 2533 | { | 2533 | { |
| 2534 | struct smi_info *info; | 2534 | struct smi_info *info; |
| @@ -2607,7 +2607,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev, | |||
| 2607 | return 0; | 2607 | return 0; |
| 2608 | } | 2608 | } |
| 2609 | 2609 | ||
| 2610 | static int __devexit ipmi_of_remove(struct of_device *dev) | 2610 | static int __devexit ipmi_of_remove(struct platform_device *dev) |
| 2611 | { | 2611 | { |
| 2612 | cleanup_one_si(dev_get_drvdata(&dev->dev)); | 2612 | cleanup_one_si(dev_get_drvdata(&dev->dev)); |
| 2613 | return 0; | 2613 | return 0; |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index 95acb8c880f4..dfa8b3062fda 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
| @@ -961,7 +961,7 @@ static int __init rtc_init(void) | |||
| 961 | #endif | 961 | #endif |
| 962 | #ifdef CONFIG_SPARC32 | 962 | #ifdef CONFIG_SPARC32 |
| 963 | struct device_node *ebus_dp; | 963 | struct device_node *ebus_dp; |
| 964 | struct of_device *op; | 964 | struct platform_device *op; |
| 965 | #else | 965 | #else |
| 966 | void *r; | 966 | void *r; |
| 967 | #ifdef RTC_IRQ | 967 | #ifdef RTC_IRQ |
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index ed8a9cec2a05..0ed763cd2e77 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c | |||
| @@ -761,7 +761,7 @@ static struct platform_driver hwicap_platform_driver = { | |||
| 761 | 761 | ||
| 762 | #if defined(CONFIG_OF) | 762 | #if defined(CONFIG_OF) |
| 763 | static int __devinit | 763 | static int __devinit |
| 764 | hwicap_of_probe(struct of_device *op, const struct of_device_id *match) | 764 | hwicap_of_probe(struct platform_device *op, const struct of_device_id *match) |
| 765 | { | 765 | { |
| 766 | struct resource res; | 766 | struct resource res; |
| 767 | const unsigned int *id; | 767 | const unsigned int *id; |
| @@ -798,7 +798,7 @@ hwicap_of_probe(struct of_device *op, const struct of_device_id *match) | |||
| 798 | regs); | 798 | regs); |
| 799 | } | 799 | } |
| 800 | 800 | ||
| 801 | static int __devexit hwicap_of_remove(struct of_device *op) | 801 | static int __devexit hwicap_of_remove(struct platform_device *op) |
| 802 | { | 802 | { |
| 803 | return hwicap_remove(&op->dev); | 803 | return hwicap_remove(&op->dev); |
| 804 | } | 804 | } |
diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c index 983530ba04a7..2b1baee525bc 100644 --- a/drivers/crypto/amcc/crypto4xx_core.c +++ b/drivers/crypto/amcc/crypto4xx_core.c | |||
| @@ -1150,7 +1150,7 @@ struct crypto4xx_alg_common crypto4xx_alg[] = { | |||
| 1150 | /** | 1150 | /** |
| 1151 | * Module Initialization Routine | 1151 | * Module Initialization Routine |
| 1152 | */ | 1152 | */ |
| 1153 | static int __init crypto4xx_probe(struct of_device *ofdev, | 1153 | static int __init crypto4xx_probe(struct platform_device *ofdev, |
| 1154 | const struct of_device_id *match) | 1154 | const struct of_device_id *match) |
| 1155 | { | 1155 | { |
| 1156 | int rc; | 1156 | int rc; |
| @@ -1258,7 +1258,7 @@ err_alloc_dev: | |||
| 1258 | return rc; | 1258 | return rc; |
| 1259 | } | 1259 | } |
| 1260 | 1260 | ||
| 1261 | static int __exit crypto4xx_remove(struct of_device *ofdev) | 1261 | static int __exit crypto4xx_remove(struct platform_device *ofdev) |
| 1262 | { | 1262 | { |
| 1263 | struct device *dev = &ofdev->dev; | 1263 | struct device *dev = &ofdev->dev; |
| 1264 | struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev); | 1264 | struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev); |
diff --git a/drivers/crypto/amcc/crypto4xx_core.h b/drivers/crypto/amcc/crypto4xx_core.h index da9cbe3b9fc3..bac0bdeb4b5f 100644 --- a/drivers/crypto/amcc/crypto4xx_core.h +++ b/drivers/crypto/amcc/crypto4xx_core.h | |||
| @@ -104,7 +104,7 @@ struct crypto4xx_device { | |||
| 104 | 104 | ||
| 105 | struct crypto4xx_core_device { | 105 | struct crypto4xx_core_device { |
| 106 | struct device *device; | 106 | struct device *device; |
| 107 | struct of_device *ofdev; | 107 | struct platform_device *ofdev; |
| 108 | struct crypto4xx_device *dev; | 108 | struct crypto4xx_device *dev; |
| 109 | u32 int_status; | 109 | u32 int_status; |
| 110 | u32 irq; | 110 | u32 irq; |
diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c index 26af2dd5d831..88ee01510ec0 100644 --- a/drivers/crypto/n2_core.c +++ b/drivers/crypto/n2_core.c | |||
| @@ -1552,7 +1552,7 @@ static void __exit n2_unregister_algs(void) | |||
| 1552 | 1552 | ||
| 1553 | /* To map CWQ queues to interrupt sources, the hypervisor API provides | 1553 | /* To map CWQ queues to interrupt sources, the hypervisor API provides |
| 1554 | * a devino. This isn't very useful to us because all of the | 1554 | * a devino. This isn't very useful to us because all of the |
| 1555 | * interrupts listed in the of_device node have been translated to | 1555 | * interrupts listed in the device_node have been translated to |
| 1556 | * Linux virtual IRQ cookie numbers. | 1556 | * Linux virtual IRQ cookie numbers. |
| 1557 | * | 1557 | * |
| 1558 | * So we have to back-translate, going through the 'intr' and 'ino' | 1558 | * So we have to back-translate, going through the 'intr' and 'ino' |
| @@ -1560,7 +1560,7 @@ static void __exit n2_unregister_algs(void) | |||
| 1560 | * 'interrupts' property entries, in order to to figure out which | 1560 | * 'interrupts' property entries, in order to to figure out which |
| 1561 | * devino goes to which already-translated IRQ. | 1561 | * devino goes to which already-translated IRQ. |
| 1562 | */ | 1562 | */ |
| 1563 | static int find_devino_index(struct of_device *dev, struct spu_mdesc_info *ip, | 1563 | static int find_devino_index(struct platform_device *dev, struct spu_mdesc_info *ip, |
| 1564 | unsigned long dev_ino) | 1564 | unsigned long dev_ino) |
| 1565 | { | 1565 | { |
| 1566 | const unsigned int *dev_intrs; | 1566 | const unsigned int *dev_intrs; |
| @@ -1580,7 +1580,7 @@ static int find_devino_index(struct of_device *dev, struct spu_mdesc_info *ip, | |||
| 1580 | if (!dev_intrs) | 1580 | if (!dev_intrs) |
| 1581 | return -ENODEV; | 1581 | return -ENODEV; |
| 1582 | 1582 | ||
| 1583 | for (i = 0; i < dev->num_irqs; i++) { | 1583 | for (i = 0; i < dev->archdata.num_irqs; i++) { |
| 1584 | if (dev_intrs[i] == intr) | 1584 | if (dev_intrs[i] == intr) |
| 1585 | return i; | 1585 | return i; |
| 1586 | } | 1586 | } |
| @@ -1588,7 +1588,7 @@ static int find_devino_index(struct of_device *dev, struct spu_mdesc_info *ip, | |||
| 1588 | return -ENODEV; | 1588 | return -ENODEV; |
| 1589 | } | 1589 | } |
| 1590 | 1590 | ||
| 1591 | static int spu_map_ino(struct of_device *dev, struct spu_mdesc_info *ip, | 1591 | static int spu_map_ino(struct platform_device *dev, struct spu_mdesc_info *ip, |
| 1592 | const char *irq_name, struct spu_queue *p, | 1592 | const char *irq_name, struct spu_queue *p, |
| 1593 | irq_handler_t handler) | 1593 | irq_handler_t handler) |
| 1594 | { | 1594 | { |
| @@ -1603,7 +1603,7 @@ static int spu_map_ino(struct of_device *dev, struct spu_mdesc_info *ip, | |||
| 1603 | if (index < 0) | 1603 | if (index < 0) |
| 1604 | return index; | 1604 | return index; |
| 1605 | 1605 | ||
| 1606 | p->irq = dev->irqs[index]; | 1606 | p->irq = dev->archdata.irqs[index]; |
| 1607 | 1607 | ||
| 1608 | sprintf(p->irq_name, "%s-%d", irq_name, index); | 1608 | sprintf(p->irq_name, "%s-%d", irq_name, index); |
| 1609 | 1609 | ||
| @@ -1736,7 +1736,7 @@ static void spu_list_destroy(struct list_head *list) | |||
| 1736 | * gathering cpu membership information. | 1736 | * gathering cpu membership information. |
| 1737 | */ | 1737 | */ |
| 1738 | static int spu_mdesc_walk_arcs(struct mdesc_handle *mdesc, | 1738 | static int spu_mdesc_walk_arcs(struct mdesc_handle *mdesc, |
| 1739 | struct of_device *dev, | 1739 | struct platform_device *dev, |
| 1740 | u64 node, struct spu_queue *p, | 1740 | u64 node, struct spu_queue *p, |
| 1741 | struct spu_queue **table) | 1741 | struct spu_queue **table) |
| 1742 | { | 1742 | { |
| @@ -1763,7 +1763,7 @@ static int spu_mdesc_walk_arcs(struct mdesc_handle *mdesc, | |||
| 1763 | 1763 | ||
| 1764 | /* Process an 'exec-unit' MDESC node of type 'cwq'. */ | 1764 | /* Process an 'exec-unit' MDESC node of type 'cwq'. */ |
| 1765 | static int handle_exec_unit(struct spu_mdesc_info *ip, struct list_head *list, | 1765 | static int handle_exec_unit(struct spu_mdesc_info *ip, struct list_head *list, |
| 1766 | struct of_device *dev, struct mdesc_handle *mdesc, | 1766 | struct platform_device *dev, struct mdesc_handle *mdesc, |
| 1767 | u64 node, const char *iname, unsigned long q_type, | 1767 | u64 node, const char *iname, unsigned long q_type, |
| 1768 | irq_handler_t handler, struct spu_queue **table) | 1768 | irq_handler_t handler, struct spu_queue **table) |
| 1769 | { | 1769 | { |
| @@ -1794,7 +1794,7 @@ static int handle_exec_unit(struct spu_mdesc_info *ip, struct list_head *list, | |||
| 1794 | return spu_map_ino(dev, ip, iname, p, handler); | 1794 | return spu_map_ino(dev, ip, iname, p, handler); |
| 1795 | } | 1795 | } |
| 1796 | 1796 | ||
| 1797 | static int spu_mdesc_scan(struct mdesc_handle *mdesc, struct of_device *dev, | 1797 | static int spu_mdesc_scan(struct mdesc_handle *mdesc, struct platform_device *dev, |
| 1798 | struct spu_mdesc_info *ip, struct list_head *list, | 1798 | struct spu_mdesc_info *ip, struct list_head *list, |
| 1799 | const char *exec_name, unsigned long q_type, | 1799 | const char *exec_name, unsigned long q_type, |
| 1800 | irq_handler_t handler, struct spu_queue **table) | 1800 | irq_handler_t handler, struct spu_queue **table) |
| @@ -1855,7 +1855,7 @@ static int __devinit get_irq_props(struct mdesc_handle *mdesc, u64 node, | |||
| 1855 | } | 1855 | } |
| 1856 | 1856 | ||
| 1857 | static int __devinit grab_mdesc_irq_props(struct mdesc_handle *mdesc, | 1857 | static int __devinit grab_mdesc_irq_props(struct mdesc_handle *mdesc, |
| 1858 | struct of_device *dev, | 1858 | struct platform_device *dev, |
| 1859 | struct spu_mdesc_info *ip, | 1859 | struct spu_mdesc_info *ip, |
| 1860 | const char *node_name) | 1860 | const char *node_name) |
| 1861 | { | 1861 | { |
| @@ -2004,7 +2004,7 @@ static void __devinit n2_spu_driver_version(void) | |||
| 2004 | pr_info("%s", version); | 2004 | pr_info("%s", version); |
| 2005 | } | 2005 | } |
| 2006 | 2006 | ||
| 2007 | static int __devinit n2_crypto_probe(struct of_device *dev, | 2007 | static int __devinit n2_crypto_probe(struct platform_device *dev, |
| 2008 | const struct of_device_id *match) | 2008 | const struct of_device_id *match) |
| 2009 | { | 2009 | { |
| 2010 | struct mdesc_handle *mdesc; | 2010 | struct mdesc_handle *mdesc; |
| @@ -2081,7 +2081,7 @@ out_free_n2cp: | |||
| 2081 | return err; | 2081 | return err; |
| 2082 | } | 2082 | } |
| 2083 | 2083 | ||
| 2084 | static int __devexit n2_crypto_remove(struct of_device *dev) | 2084 | static int __devexit n2_crypto_remove(struct platform_device *dev) |
| 2085 | { | 2085 | { |
| 2086 | struct n2_crypto *np = dev_get_drvdata(&dev->dev); | 2086 | struct n2_crypto *np = dev_get_drvdata(&dev->dev); |
| 2087 | 2087 | ||
| @@ -2116,7 +2116,7 @@ static void free_ncp(struct n2_mau *mp) | |||
| 2116 | kfree(mp); | 2116 | kfree(mp); |
| 2117 | } | 2117 | } |
| 2118 | 2118 | ||
| 2119 | static int __devinit n2_mau_probe(struct of_device *dev, | 2119 | static int __devinit n2_mau_probe(struct platform_device *dev, |
| 2120 | const struct of_device_id *match) | 2120 | const struct of_device_id *match) |
| 2121 | { | 2121 | { |
| 2122 | struct mdesc_handle *mdesc; | 2122 | struct mdesc_handle *mdesc; |
| @@ -2184,7 +2184,7 @@ out_free_ncp: | |||
| 2184 | return err; | 2184 | return err; |
| 2185 | } | 2185 | } |
| 2186 | 2186 | ||
| 2187 | static int __devexit n2_mau_remove(struct of_device *dev) | 2187 | static int __devexit n2_mau_remove(struct platform_device *dev) |
| 2188 | { | 2188 | { |
| 2189 | struct n2_mau *mp = dev_get_drvdata(&dev->dev); | 2189 | struct n2_mau *mp = dev_get_drvdata(&dev->dev); |
| 2190 | 2190 | ||
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 97f4af1d8a64..4bcd825b5739 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
| @@ -118,7 +118,7 @@ struct talitos_channel { | |||
| 118 | 118 | ||
| 119 | struct talitos_private { | 119 | struct talitos_private { |
| 120 | struct device *dev; | 120 | struct device *dev; |
| 121 | struct of_device *ofdev; | 121 | struct platform_device *ofdev; |
| 122 | void __iomem *reg; | 122 | void __iomem *reg; |
| 123 | int irq; | 123 | int irq; |
| 124 | 124 | ||
| @@ -2308,7 +2308,7 @@ static int hw_supports(struct device *dev, __be32 desc_hdr_template) | |||
| 2308 | return ret; | 2308 | return ret; |
| 2309 | } | 2309 | } |
| 2310 | 2310 | ||
| 2311 | static int talitos_remove(struct of_device *ofdev) | 2311 | static int talitos_remove(struct platform_device *ofdev) |
| 2312 | { | 2312 | { |
| 2313 | struct device *dev = &ofdev->dev; | 2313 | struct device *dev = &ofdev->dev; |
| 2314 | struct talitos_private *priv = dev_get_drvdata(dev); | 2314 | struct talitos_private *priv = dev_get_drvdata(dev); |
| @@ -2401,7 +2401,7 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, | |||
| 2401 | return t_alg; | 2401 | return t_alg; |
| 2402 | } | 2402 | } |
| 2403 | 2403 | ||
| 2404 | static int talitos_probe(struct of_device *ofdev, | 2404 | static int talitos_probe(struct platform_device *ofdev, |
| 2405 | const struct of_device_id *match) | 2405 | const struct of_device_id *match) |
| 2406 | { | 2406 | { |
| 2407 | struct device *dev = &ofdev->dev; | 2407 | struct device *dev = &ofdev->dev; |
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index f0fd6db6063c..cea08bed9cf9 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c | |||
| @@ -1297,7 +1297,7 @@ static void fsl_dma_chan_remove(struct fsldma_chan *chan) | |||
| 1297 | kfree(chan); | 1297 | kfree(chan); |
| 1298 | } | 1298 | } |
| 1299 | 1299 | ||
| 1300 | static int __devinit fsldma_of_probe(struct of_device *op, | 1300 | static int __devinit fsldma_of_probe(struct platform_device *op, |
| 1301 | const struct of_device_id *match) | 1301 | const struct of_device_id *match) |
| 1302 | { | 1302 | { |
| 1303 | struct fsldma_device *fdev; | 1303 | struct fsldma_device *fdev; |
| @@ -1382,7 +1382,7 @@ out_return: | |||
| 1382 | return err; | 1382 | return err; |
| 1383 | } | 1383 | } |
| 1384 | 1384 | ||
| 1385 | static int fsldma_of_remove(struct of_device *op) | 1385 | static int fsldma_of_remove(struct platform_device *op) |
| 1386 | { | 1386 | { |
| 1387 | struct fsldma_device *fdev; | 1387 | struct fsldma_device *fdev; |
| 1388 | unsigned int i; | 1388 | unsigned int i; |
diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c index 14a8c0f1698e..4e9cbf300594 100644 --- a/drivers/dma/mpc512x_dma.c +++ b/drivers/dma/mpc512x_dma.c | |||
| @@ -627,7 +627,7 @@ mpc_dma_prep_memcpy(struct dma_chan *chan, dma_addr_t dst, dma_addr_t src, | |||
| 627 | return &mdesc->desc; | 627 | return &mdesc->desc; |
| 628 | } | 628 | } |
| 629 | 629 | ||
| 630 | static int __devinit mpc_dma_probe(struct of_device *op, | 630 | static int __devinit mpc_dma_probe(struct platform_device *op, |
| 631 | const struct of_device_id *match) | 631 | const struct of_device_id *match) |
| 632 | { | 632 | { |
| 633 | struct device_node *dn = op->dev.of_node; | 633 | struct device_node *dn = op->dev.of_node; |
| @@ -753,7 +753,7 @@ static int __devinit mpc_dma_probe(struct of_device *op, | |||
| 753 | return retval; | 753 | return retval; |
| 754 | } | 754 | } |
| 755 | 755 | ||
| 756 | static int __devexit mpc_dma_remove(struct of_device *op) | 756 | static int __devexit mpc_dma_remove(struct platform_device *op) |
| 757 | { | 757 | { |
| 758 | struct device *dev = &op->dev; | 758 | struct device *dev = &op->dev; |
| 759 | struct mpc_dma *mdma = dev_get_drvdata(dev); | 759 | struct mpc_dma *mdma = dev_get_drvdata(dev); |
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c index 7c3747902a37..0d58a4a4487f 100644 --- a/drivers/dma/ppc4xx/adma.c +++ b/drivers/dma/ppc4xx/adma.c | |||
| @@ -4257,11 +4257,11 @@ static int ppc440spe_adma_setup_irqs(struct ppc440spe_adma_device *adev, | |||
| 4257 | struct ppc440spe_adma_chan *chan, | 4257 | struct ppc440spe_adma_chan *chan, |
| 4258 | int *initcode) | 4258 | int *initcode) |
| 4259 | { | 4259 | { |
| 4260 | struct of_device *ofdev; | 4260 | struct platform_device *ofdev; |
| 4261 | struct device_node *np; | 4261 | struct device_node *np; |
| 4262 | int ret; | 4262 | int ret; |
| 4263 | 4263 | ||
| 4264 | ofdev = container_of(adev->dev, struct of_device, dev); | 4264 | ofdev = container_of(adev->dev, struct platform_device, dev); |
| 4265 | np = ofdev->dev.of_node; | 4265 | np = ofdev->dev.of_node; |
| 4266 | if (adev->id != PPC440SPE_XOR_ID) { | 4266 | if (adev->id != PPC440SPE_XOR_ID) { |
| 4267 | adev->err_irq = irq_of_parse_and_map(np, 1); | 4267 | adev->err_irq = irq_of_parse_and_map(np, 1); |
| @@ -4393,7 +4393,7 @@ static void ppc440spe_adma_release_irqs(struct ppc440spe_adma_device *adev, | |||
| 4393 | /** | 4393 | /** |
| 4394 | * ppc440spe_adma_probe - probe the asynch device | 4394 | * ppc440spe_adma_probe - probe the asynch device |
| 4395 | */ | 4395 | */ |
| 4396 | static int __devinit ppc440spe_adma_probe(struct of_device *ofdev, | 4396 | static int __devinit ppc440spe_adma_probe(struct platform_device *ofdev, |
| 4397 | const struct of_device_id *match) | 4397 | const struct of_device_id *match) |
| 4398 | { | 4398 | { |
| 4399 | struct device_node *np = ofdev->dev.of_node; | 4399 | struct device_node *np = ofdev->dev.of_node; |
| @@ -4625,7 +4625,7 @@ out: | |||
| 4625 | /** | 4625 | /** |
| 4626 | * ppc440spe_adma_remove - remove the asynch device | 4626 | * ppc440spe_adma_remove - remove the asynch device |
| 4627 | */ | 4627 | */ |
| 4628 | static int __devexit ppc440spe_adma_remove(struct of_device *ofdev) | 4628 | static int __devexit ppc440spe_adma_remove(struct platform_device *ofdev) |
| 4629 | { | 4629 | { |
| 4630 | struct ppc440spe_adma_device *adev = dev_get_drvdata(&ofdev->dev); | 4630 | struct ppc440spe_adma_device *adev = dev_get_drvdata(&ofdev->dev); |
| 4631 | struct device_node *np = ofdev->dev.of_node; | 4631 | struct device_node *np = ofdev->dev.of_node; |
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index af75e27f5224..b123bb308a4a 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c | |||
| @@ -200,7 +200,7 @@ static irqreturn_t mpc85xx_pci_isr(int irq, void *dev_id) | |||
| 200 | return IRQ_HANDLED; | 200 | return IRQ_HANDLED; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | static int __devinit mpc85xx_pci_err_probe(struct of_device *op, | 203 | static int __devinit mpc85xx_pci_err_probe(struct platform_device *op, |
| 204 | const struct of_device_id *match) | 204 | const struct of_device_id *match) |
| 205 | { | 205 | { |
| 206 | struct edac_pci_ctl_info *pci; | 206 | struct edac_pci_ctl_info *pci; |
| @@ -305,7 +305,7 @@ err: | |||
| 305 | return res; | 305 | return res; |
| 306 | } | 306 | } |
| 307 | 307 | ||
| 308 | static int mpc85xx_pci_err_remove(struct of_device *op) | 308 | static int mpc85xx_pci_err_remove(struct platform_device *op) |
| 309 | { | 309 | { |
| 310 | struct edac_pci_ctl_info *pci = dev_get_drvdata(&op->dev); | 310 | struct edac_pci_ctl_info *pci = dev_get_drvdata(&op->dev); |
| 311 | struct mpc85xx_pci_pdata *pdata = pci->pvt_info; | 311 | struct mpc85xx_pci_pdata *pdata = pci->pvt_info; |
| @@ -503,7 +503,7 @@ static irqreturn_t mpc85xx_l2_isr(int irq, void *dev_id) | |||
| 503 | return IRQ_HANDLED; | 503 | return IRQ_HANDLED; |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | static int __devinit mpc85xx_l2_err_probe(struct of_device *op, | 506 | static int __devinit mpc85xx_l2_err_probe(struct platform_device *op, |
| 507 | const struct of_device_id *match) | 507 | const struct of_device_id *match) |
| 508 | { | 508 | { |
| 509 | struct edac_device_ctl_info *edac_dev; | 509 | struct edac_device_ctl_info *edac_dev; |
| @@ -613,7 +613,7 @@ err: | |||
| 613 | return res; | 613 | return res; |
| 614 | } | 614 | } |
| 615 | 615 | ||
| 616 | static int mpc85xx_l2_err_remove(struct of_device *op) | 616 | static int mpc85xx_l2_err_remove(struct platform_device *op) |
| 617 | { | 617 | { |
| 618 | struct edac_device_ctl_info *edac_dev = dev_get_drvdata(&op->dev); | 618 | struct edac_device_ctl_info *edac_dev = dev_get_drvdata(&op->dev); |
| 619 | struct mpc85xx_l2_pdata *pdata = edac_dev->pvt_info; | 619 | struct mpc85xx_l2_pdata *pdata = edac_dev->pvt_info; |
| @@ -956,7 +956,7 @@ static void __devinit mpc85xx_init_csrows(struct mem_ctl_info *mci) | |||
| 956 | } | 956 | } |
| 957 | } | 957 | } |
| 958 | 958 | ||
| 959 | static int __devinit mpc85xx_mc_err_probe(struct of_device *op, | 959 | static int __devinit mpc85xx_mc_err_probe(struct platform_device *op, |
| 960 | const struct of_device_id *match) | 960 | const struct of_device_id *match) |
| 961 | { | 961 | { |
| 962 | struct mem_ctl_info *mci; | 962 | struct mem_ctl_info *mci; |
| @@ -1088,7 +1088,7 @@ err: | |||
| 1088 | return res; | 1088 | return res; |
| 1089 | } | 1089 | } |
| 1090 | 1090 | ||
| 1091 | static int mpc85xx_mc_err_remove(struct of_device *op) | 1091 | static int mpc85xx_mc_err_remove(struct platform_device *op) |
| 1092 | { | 1092 | { |
| 1093 | struct mem_ctl_info *mci = dev_get_drvdata(&op->dev); | 1093 | struct mem_ctl_info *mci = dev_get_drvdata(&op->dev); |
| 1094 | struct mpc85xx_mc_pdata *pdata = mci->pvt_info; | 1094 | struct mpc85xx_mc_pdata *pdata = mci->pvt_info; |
diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c index e78839e89a06..070cea41b661 100644 --- a/drivers/edac/ppc4xx_edac.c +++ b/drivers/edac/ppc4xx_edac.c | |||
| @@ -184,9 +184,9 @@ struct ppc4xx_ecc_status { | |||
| 184 | 184 | ||
| 185 | /* Function Prototypes */ | 185 | /* Function Prototypes */ |
| 186 | 186 | ||
| 187 | static int ppc4xx_edac_probe(struct of_device *device, | 187 | static int ppc4xx_edac_probe(struct platform_device *device, |
| 188 | const struct of_device_id *device_id); | 188 | const struct of_device_id *device_id); |
| 189 | static int ppc4xx_edac_remove(struct of_device *device); | 189 | static int ppc4xx_edac_remove(struct platform_device *device); |
| 190 | 190 | ||
| 191 | /* Global Variables */ | 191 | /* Global Variables */ |
| 192 | 192 | ||
| @@ -1014,7 +1014,7 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1) | |||
| 1014 | */ | 1014 | */ |
| 1015 | static int __devinit | 1015 | static int __devinit |
| 1016 | ppc4xx_edac_mc_init(struct mem_ctl_info *mci, | 1016 | ppc4xx_edac_mc_init(struct mem_ctl_info *mci, |
| 1017 | struct of_device *op, | 1017 | struct platform_device *op, |
| 1018 | const struct of_device_id *match, | 1018 | const struct of_device_id *match, |
| 1019 | const dcr_host_t *dcr_host, | 1019 | const dcr_host_t *dcr_host, |
| 1020 | u32 mcopt1) | 1020 | u32 mcopt1) |
| @@ -1108,7 +1108,7 @@ ppc4xx_edac_mc_init(struct mem_ctl_info *mci, | |||
| 1108 | * mapped and assigned. | 1108 | * mapped and assigned. |
| 1109 | */ | 1109 | */ |
| 1110 | static int __devinit | 1110 | static int __devinit |
| 1111 | ppc4xx_edac_register_irq(struct of_device *op, struct mem_ctl_info *mci) | 1111 | ppc4xx_edac_register_irq(struct platform_device *op, struct mem_ctl_info *mci) |
| 1112 | { | 1112 | { |
| 1113 | int status = 0; | 1113 | int status = 0; |
| 1114 | int ded_irq, sec_irq; | 1114 | int ded_irq, sec_irq; |
| @@ -1238,7 +1238,7 @@ ppc4xx_edac_map_dcrs(const struct device_node *np, dcr_host_t *dcr_host) | |||
| 1238 | * driver; otherwise, < 0 on error. | 1238 | * driver; otherwise, < 0 on error. |
| 1239 | */ | 1239 | */ |
| 1240 | static int __devinit | 1240 | static int __devinit |
| 1241 | ppc4xx_edac_probe(struct of_device *op, const struct of_device_id *match) | 1241 | ppc4xx_edac_probe(struct platform_device *op, const struct of_device_id *match) |
| 1242 | { | 1242 | { |
| 1243 | int status = 0; | 1243 | int status = 0; |
| 1244 | u32 mcopt1, memcheck; | 1244 | u32 mcopt1, memcheck; |
| @@ -1359,7 +1359,7 @@ ppc4xx_edac_probe(struct of_device *op, const struct of_device_id *match) | |||
| 1359 | * Unconditionally returns 0. | 1359 | * Unconditionally returns 0. |
| 1360 | */ | 1360 | */ |
| 1361 | static int | 1361 | static int |
| 1362 | ppc4xx_edac_remove(struct of_device *op) | 1362 | ppc4xx_edac_remove(struct platform_device *op) |
| 1363 | { | 1363 | { |
| 1364 | struct mem_ctl_info *mci = dev_get_drvdata(&op->dev); | 1364 | struct mem_ctl_info *mci = dev_get_drvdata(&op->dev); |
| 1365 | struct ppc4xx_edac_pdata *pdata = mci->pvt_info; | 1365 | struct ppc4xx_edac_pdata *pdata = mci->pvt_info; |
diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c index 17be051b7aa3..1c3649242208 100644 --- a/drivers/gpu/drm/ati_pcigart.c +++ b/drivers/gpu/drm/ati_pcigart.c | |||
| @@ -152,7 +152,7 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga | |||
| 152 | /* we need to support large memory configurations */ | 152 | /* we need to support large memory configurations */ |
| 153 | entry->busaddr[i] = pci_map_page(dev->pdev, entry->pagelist[i], | 153 | entry->busaddr[i] = pci_map_page(dev->pdev, entry->pagelist[i], |
| 154 | 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); | 154 | 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
| 155 | if (entry->busaddr[i] == 0) { | 155 | if (pci_dma_mapping_error(dev->pdev, entry->busaddr[i])) { |
| 156 | DRM_ERROR("unable to map PCIGART pages!\n"); | 156 | DRM_ERROR("unable to map PCIGART pages!\n"); |
| 157 | drm_ati_pcigart_cleanup(dev, gart_info); | 157 | drm_ati_pcigart_cleanup(dev, gart_info); |
| 158 | address = NULL; | 158 | address = NULL; |
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index a5c9ce93bbcb..3e257a50bf56 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
| @@ -328,14 +328,13 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, | |||
| 328 | return -EINVAL; | 328 | return -EINVAL; |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | list = kmalloc(sizeof(*list), GFP_KERNEL); | 331 | list = kzalloc(sizeof(*list), GFP_KERNEL); |
| 332 | if (!list) { | 332 | if (!list) { |
| 333 | if (map->type == _DRM_REGISTERS) | 333 | if (map->type == _DRM_REGISTERS) |
| 334 | iounmap(map->handle); | 334 | iounmap(map->handle); |
| 335 | kfree(map); | 335 | kfree(map); |
| 336 | return -EINVAL; | 336 | return -EINVAL; |
| 337 | } | 337 | } |
| 338 | memset(list, 0, sizeof(*list)); | ||
| 339 | list->map = map; | 338 | list->map = map; |
| 340 | 339 | ||
| 341 | mutex_lock(&dev->struct_mutex); | 340 | mutex_lock(&dev->struct_mutex); |
| @@ -678,13 +677,12 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) | |||
| 678 | return -EINVAL; | 677 | return -EINVAL; |
| 679 | } | 678 | } |
| 680 | 679 | ||
| 681 | entry->buflist = kmalloc(count * sizeof(*entry->buflist), GFP_KERNEL); | 680 | entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL); |
| 682 | if (!entry->buflist) { | 681 | if (!entry->buflist) { |
| 683 | mutex_unlock(&dev->struct_mutex); | 682 | mutex_unlock(&dev->struct_mutex); |
| 684 | atomic_dec(&dev->buf_alloc); | 683 | atomic_dec(&dev->buf_alloc); |
| 685 | return -ENOMEM; | 684 | return -ENOMEM; |
| 686 | } | 685 | } |
| 687 | memset(entry->buflist, 0, count * sizeof(*entry->buflist)); | ||
| 688 | 686 | ||
| 689 | entry->buf_size = size; | 687 | entry->buf_size = size; |
| 690 | entry->page_order = page_order; | 688 | entry->page_order = page_order; |
| @@ -708,7 +706,7 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) | |||
| 708 | buf->file_priv = NULL; | 706 | buf->file_priv = NULL; |
| 709 | 707 | ||
| 710 | buf->dev_priv_size = dev->driver->dev_priv_size; | 708 | buf->dev_priv_size = dev->driver->dev_priv_size; |
| 711 | buf->dev_private = kmalloc(buf->dev_priv_size, GFP_KERNEL); | 709 | buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); |
| 712 | if (!buf->dev_private) { | 710 | if (!buf->dev_private) { |
| 713 | /* Set count correctly so we free the proper amount. */ | 711 | /* Set count correctly so we free the proper amount. */ |
| 714 | entry->buf_count = count; | 712 | entry->buf_count = count; |
| @@ -717,7 +715,6 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) | |||
| 717 | atomic_dec(&dev->buf_alloc); | 715 | atomic_dec(&dev->buf_alloc); |
| 718 | return -ENOMEM; | 716 | return -ENOMEM; |
| 719 | } | 717 | } |
| 720 | memset(buf->dev_private, 0, buf->dev_priv_size); | ||
| 721 | 718 | ||
| 722 | DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address); | 719 | DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address); |
| 723 | 720 | ||
| @@ -832,22 +829,20 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) | |||
| 832 | return -EINVAL; | 829 | return -EINVAL; |
| 833 | } | 830 | } |
| 834 | 831 | ||
| 835 | entry->buflist = kmalloc(count * sizeof(*entry->buflist), GFP_KERNEL); | 832 | entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL); |
| 836 | if (!entry->buflist) { | 833 | if (!entry->buflist) { |
| 837 | mutex_unlock(&dev->struct_mutex); | 834 | mutex_unlock(&dev->struct_mutex); |
| 838 | atomic_dec(&dev->buf_alloc); | 835 | atomic_dec(&dev->buf_alloc); |
| 839 | return -ENOMEM; | 836 | return -ENOMEM; |
| 840 | } | 837 | } |
| 841 | memset(entry->buflist, 0, count * sizeof(*entry->buflist)); | ||
| 842 | 838 | ||
| 843 | entry->seglist = kmalloc(count * sizeof(*entry->seglist), GFP_KERNEL); | 839 | entry->seglist = kzalloc(count * sizeof(*entry->seglist), GFP_KERNEL); |
| 844 | if (!entry->seglist) { | 840 | if (!entry->seglist) { |
| 845 | kfree(entry->buflist); | 841 | kfree(entry->buflist); |
| 846 | mutex_unlock(&dev->struct_mutex); | 842 | mutex_unlock(&dev->struct_mutex); |
| 847 | atomic_dec(&dev->buf_alloc); | 843 | atomic_dec(&dev->buf_alloc); |
| 848 | return -ENOMEM; | 844 | return -ENOMEM; |
| 849 | } | 845 | } |
| 850 | memset(entry->seglist, 0, count * sizeof(*entry->seglist)); | ||
| 851 | 846 | ||
| 852 | /* Keep the original pagelist until we know all the allocations | 847 | /* Keep the original pagelist until we know all the allocations |
| 853 | * have succeeded | 848 | * have succeeded |
| @@ -911,8 +906,8 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) | |||
| 911 | buf->file_priv = NULL; | 906 | buf->file_priv = NULL; |
| 912 | 907 | ||
| 913 | buf->dev_priv_size = dev->driver->dev_priv_size; | 908 | buf->dev_priv_size = dev->driver->dev_priv_size; |
| 914 | buf->dev_private = kmalloc(buf->dev_priv_size, | 909 | buf->dev_private = kzalloc(buf->dev_priv_size, |
| 915 | GFP_KERNEL); | 910 | GFP_KERNEL); |
| 916 | if (!buf->dev_private) { | 911 | if (!buf->dev_private) { |
| 917 | /* Set count correctly so we free the proper amount. */ | 912 | /* Set count correctly so we free the proper amount. */ |
| 918 | entry->buf_count = count; | 913 | entry->buf_count = count; |
| @@ -923,7 +918,6 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) | |||
| 923 | atomic_dec(&dev->buf_alloc); | 918 | atomic_dec(&dev->buf_alloc); |
| 924 | return -ENOMEM; | 919 | return -ENOMEM; |
| 925 | } | 920 | } |
| 926 | memset(buf->dev_private, 0, buf->dev_priv_size); | ||
| 927 | 921 | ||
| 928 | DRM_DEBUG("buffer %d @ %p\n", | 922 | DRM_DEBUG("buffer %d @ %p\n", |
| 929 | entry->buf_count, buf->address); | 923 | entry->buf_count, buf->address); |
| @@ -1048,14 +1042,13 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request | |||
| 1048 | return -EINVAL; | 1042 | return -EINVAL; |
| 1049 | } | 1043 | } |
| 1050 | 1044 | ||
| 1051 | entry->buflist = kmalloc(count * sizeof(*entry->buflist), | 1045 | entry->buflist = kzalloc(count * sizeof(*entry->buflist), |
| 1052 | GFP_KERNEL); | 1046 | GFP_KERNEL); |
| 1053 | if (!entry->buflist) { | 1047 | if (!entry->buflist) { |
| 1054 | mutex_unlock(&dev->struct_mutex); | 1048 | mutex_unlock(&dev->struct_mutex); |
| 1055 | atomic_dec(&dev->buf_alloc); | 1049 | atomic_dec(&dev->buf_alloc); |
| 1056 | return -ENOMEM; | 1050 | return -ENOMEM; |
| 1057 | } | 1051 | } |
| 1058 | memset(entry->buflist, 0, count * sizeof(*entry->buflist)); | ||
| 1059 | 1052 | ||
| 1060 | entry->buf_size = size; | 1053 | entry->buf_size = size; |
| 1061 | entry->page_order = page_order; | 1054 | entry->page_order = page_order; |
| @@ -1080,7 +1073,7 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request | |||
| 1080 | buf->file_priv = NULL; | 1073 | buf->file_priv = NULL; |
| 1081 | 1074 | ||
| 1082 | buf->dev_priv_size = dev->driver->dev_priv_size; | 1075 | buf->dev_priv_size = dev->driver->dev_priv_size; |
| 1083 | buf->dev_private = kmalloc(buf->dev_priv_size, GFP_KERNEL); | 1076 | buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); |
| 1084 | if (!buf->dev_private) { | 1077 | if (!buf->dev_private) { |
| 1085 | /* Set count correctly so we free the proper amount. */ | 1078 | /* Set count correctly so we free the proper amount. */ |
| 1086 | entry->buf_count = count; | 1079 | entry->buf_count = count; |
| @@ -1090,8 +1083,6 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request | |||
| 1090 | return -ENOMEM; | 1083 | return -ENOMEM; |
| 1091 | } | 1084 | } |
| 1092 | 1085 | ||
| 1093 | memset(buf->dev_private, 0, buf->dev_priv_size); | ||
| 1094 | |||
| 1095 | DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address); | 1086 | DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address); |
| 1096 | 1087 | ||
| 1097 | offset += alignment; | 1088 | offset += alignment; |
| @@ -1209,14 +1200,13 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request | |||
| 1209 | return -EINVAL; | 1200 | return -EINVAL; |
| 1210 | } | 1201 | } |
| 1211 | 1202 | ||
| 1212 | entry->buflist = kmalloc(count * sizeof(*entry->buflist), | 1203 | entry->buflist = kzalloc(count * sizeof(*entry->buflist), |
| 1213 | GFP_KERNEL); | 1204 | GFP_KERNEL); |
| 1214 | if (!entry->buflist) { | 1205 | if (!entry->buflist) { |
| 1215 | mutex_unlock(&dev->struct_mutex); | 1206 | mutex_unlock(&dev->struct_mutex); |
| 1216 | atomic_dec(&dev->buf_alloc); | 1207 | atomic_dec(&dev->buf_alloc); |
| 1217 | return -ENOMEM; | 1208 | return -ENOMEM; |
| 1218 | } | 1209 | } |
| 1219 | memset(entry->buflist, 0, count * sizeof(*entry->buflist)); | ||
| 1220 | 1210 | ||
| 1221 | entry->buf_size = size; | 1211 | entry->buf_size = size; |
| 1222 | entry->page_order = page_order; | 1212 | entry->page_order = page_order; |
| @@ -1240,7 +1230,7 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request | |||
| 1240 | buf->file_priv = NULL; | 1230 | buf->file_priv = NULL; |
| 1241 | 1231 | ||
| 1242 | buf->dev_priv_size = dev->driver->dev_priv_size; | 1232 | buf->dev_priv_size = dev->driver->dev_priv_size; |
| 1243 | buf->dev_private = kmalloc(buf->dev_priv_size, GFP_KERNEL); | 1233 | buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); |
| 1244 | if (!buf->dev_private) { | 1234 | if (!buf->dev_private) { |
| 1245 | /* Set count correctly so we free the proper amount. */ | 1235 | /* Set count correctly so we free the proper amount. */ |
| 1246 | entry->buf_count = count; | 1236 | entry->buf_count = count; |
| @@ -1249,7 +1239,6 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request | |||
| 1249 | atomic_dec(&dev->buf_alloc); | 1239 | atomic_dec(&dev->buf_alloc); |
| 1250 | return -ENOMEM; | 1240 | return -ENOMEM; |
| 1251 | } | 1241 | } |
| 1252 | memset(buf->dev_private, 0, buf->dev_priv_size); | ||
| 1253 | 1242 | ||
| 1254 | DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address); | 1243 | DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address); |
| 1255 | 1244 | ||
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 4c68f76993d8..37e0b4fa482a 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
| @@ -1682,9 +1682,9 @@ int drm_mode_addfb(struct drm_device *dev, | |||
| 1682 | /* TODO setup destructor callback */ | 1682 | /* TODO setup destructor callback */ |
| 1683 | 1683 | ||
| 1684 | fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); | 1684 | fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); |
| 1685 | if (!fb) { | 1685 | if (IS_ERR(fb)) { |
| 1686 | DRM_ERROR("could not create framebuffer\n"); | 1686 | DRM_ERROR("could not create framebuffer\n"); |
| 1687 | ret = -EINVAL; | 1687 | ret = PTR_ERR(fb); |
| 1688 | goto out; | 1688 | goto out; |
| 1689 | } | 1689 | } |
| 1690 | 1690 | ||
| @@ -2541,7 +2541,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, | |||
| 2541 | goto out; | 2541 | goto out; |
| 2542 | } | 2542 | } |
| 2543 | 2543 | ||
| 2544 | crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, crtc->gamma_size); | 2544 | crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, 0, crtc->gamma_size); |
| 2545 | 2545 | ||
| 2546 | out: | 2546 | out: |
| 2547 | mutex_unlock(&dev->mode_config.mutex); | 2547 | mutex_unlock(&dev->mode_config.mutex); |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index b9e4dbfa0533..7e31d4348340 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
| @@ -817,12 +817,12 @@ int drm_helper_resume_force_mode(struct drm_device *dev) | |||
| 817 | if (encoder_funcs->dpms) | 817 | if (encoder_funcs->dpms) |
| 818 | (*encoder_funcs->dpms) (encoder, | 818 | (*encoder_funcs->dpms) (encoder, |
| 819 | drm_helper_choose_encoder_dpms(encoder)); | 819 | drm_helper_choose_encoder_dpms(encoder)); |
| 820 | |||
| 821 | crtc_funcs = crtc->helper_private; | ||
| 822 | if (crtc_funcs->dpms) | ||
| 823 | (*crtc_funcs->dpms) (crtc, | ||
| 824 | drm_helper_choose_crtc_dpms(crtc)); | ||
| 825 | } | 820 | } |
| 821 | |||
| 822 | crtc_funcs = crtc->helper_private; | ||
| 823 | if (crtc_funcs->dpms) | ||
| 824 | (*crtc_funcs->dpms) (crtc, | ||
| 825 | drm_helper_choose_crtc_dpms(crtc)); | ||
| 826 | } | 826 | } |
| 827 | } | 827 | } |
| 828 | /* disable the unused connectors while restoring the modesetting */ | 828 | /* disable the unused connectors while restoring the modesetting */ |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index dce5c4a97f8d..96e963108225 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
| @@ -33,6 +33,11 @@ | |||
| 33 | #include <linux/i2c-algo-bit.h> | 33 | #include <linux/i2c-algo-bit.h> |
| 34 | #include "drmP.h" | 34 | #include "drmP.h" |
| 35 | #include "drm_edid.h" | 35 | #include "drm_edid.h" |
| 36 | #include "drm_edid_modes.h" | ||
| 37 | |||
| 38 | #define version_greater(edid, maj, min) \ | ||
| 39 | (((edid)->version > (maj)) || \ | ||
| 40 | ((edid)->version == (maj) && (edid)->revision > (min))) | ||
| 36 | 41 | ||
| 37 | #define EDID_EST_TIMINGS 16 | 42 | #define EDID_EST_TIMINGS 16 |
| 38 | #define EDID_STD_TIMINGS 8 | 43 | #define EDID_STD_TIMINGS 8 |
| @@ -62,6 +67,13 @@ | |||
| 62 | /* use +hsync +vsync for detailed mode */ | 67 | /* use +hsync +vsync for detailed mode */ |
| 63 | #define EDID_QUIRK_DETAILED_SYNC_PP (1 << 6) | 68 | #define EDID_QUIRK_DETAILED_SYNC_PP (1 << 6) |
| 64 | 69 | ||
| 70 | struct detailed_mode_closure { | ||
| 71 | struct drm_connector *connector; | ||
| 72 | struct edid *edid; | ||
| 73 | bool preferred; | ||
| 74 | u32 quirks; | ||
| 75 | int modes; | ||
| 76 | }; | ||
| 65 | 77 | ||
| 66 | #define LEVEL_DMT 0 | 78 | #define LEVEL_DMT 0 |
| 67 | #define LEVEL_GTF 1 | 79 | #define LEVEL_GTF 1 |
| @@ -375,7 +387,6 @@ static u32 edid_get_quirks(struct edid *edid) | |||
| 375 | #define MODE_SIZE(m) ((m)->hdisplay * (m)->vdisplay) | 387 | #define MODE_SIZE(m) ((m)->hdisplay * (m)->vdisplay) |
| 376 | #define MODE_REFRESH_DIFF(m,r) (abs((m)->vrefresh - target_refresh)) | 388 | #define MODE_REFRESH_DIFF(m,r) (abs((m)->vrefresh - target_refresh)) |
| 377 | 389 | ||
| 378 | |||
| 379 | /** | 390 | /** |
| 380 | * edid_fixup_preferred - set preferred modes based on quirk list | 391 | * edid_fixup_preferred - set preferred modes based on quirk list |
| 381 | * @connector: has mode list to fix up | 392 | * @connector: has mode list to fix up |
| @@ -422,245 +433,6 @@ static void edid_fixup_preferred(struct drm_connector *connector, | |||
| 422 | preferred_mode->type |= DRM_MODE_TYPE_PREFERRED; | 433 | preferred_mode->type |= DRM_MODE_TYPE_PREFERRED; |
| 423 | } | 434 | } |
| 424 | 435 | ||
| 425 | /* | ||
| 426 | * Add the Autogenerated from the DMT spec. | ||
| 427 | * This table is copied from xfree86/modes/xf86EdidModes.c. | ||
| 428 | * But the mode with Reduced blank feature is deleted. | ||
| 429 | */ | ||
| 430 | static struct drm_display_mode drm_dmt_modes[] = { | ||
| 431 | /* 640x350@85Hz */ | ||
| 432 | { DRM_MODE("640x350", DRM_MODE_TYPE_DRIVER, 31500, 640, 672, | ||
| 433 | 736, 832, 0, 350, 382, 385, 445, 0, | ||
| 434 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 435 | /* 640x400@85Hz */ | ||
| 436 | { DRM_MODE("640x400", DRM_MODE_TYPE_DRIVER, 31500, 640, 672, | ||
| 437 | 736, 832, 0, 400, 401, 404, 445, 0, | ||
| 438 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 439 | /* 720x400@85Hz */ | ||
| 440 | { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER, 35500, 720, 756, | ||
| 441 | 828, 936, 0, 400, 401, 404, 446, 0, | ||
| 442 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 443 | /* 640x480@60Hz */ | ||
| 444 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656, | ||
| 445 | 752, 800, 0, 480, 489, 492, 525, 0, | ||
| 446 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 447 | /* 640x480@72Hz */ | ||
| 448 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 664, | ||
| 449 | 704, 832, 0, 480, 489, 492, 520, 0, | ||
| 450 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 451 | /* 640x480@75Hz */ | ||
| 452 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 656, | ||
| 453 | 720, 840, 0, 480, 481, 484, 500, 0, | ||
| 454 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 455 | /* 640x480@85Hz */ | ||
| 456 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 36000, 640, 696, | ||
| 457 | 752, 832, 0, 480, 481, 484, 509, 0, | ||
| 458 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 459 | /* 800x600@56Hz */ | ||
| 460 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 36000, 800, 824, | ||
| 461 | 896, 1024, 0, 600, 601, 603, 625, 0, | ||
| 462 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 463 | /* 800x600@60Hz */ | ||
| 464 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 40000, 800, 840, | ||
| 465 | 968, 1056, 0, 600, 601, 605, 628, 0, | ||
| 466 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 467 | /* 800x600@72Hz */ | ||
| 468 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 50000, 800, 856, | ||
| 469 | 976, 1040, 0, 600, 637, 643, 666, 0, | ||
| 470 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 471 | /* 800x600@75Hz */ | ||
| 472 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 49500, 800, 816, | ||
| 473 | 896, 1056, 0, 600, 601, 604, 625, 0, | ||
| 474 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 475 | /* 800x600@85Hz */ | ||
| 476 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 56250, 800, 832, | ||
| 477 | 896, 1048, 0, 600, 601, 604, 631, 0, | ||
| 478 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 479 | /* 848x480@60Hz */ | ||
| 480 | { DRM_MODE("848x480", DRM_MODE_TYPE_DRIVER, 33750, 848, 864, | ||
| 481 | 976, 1088, 0, 480, 486, 494, 517, 0, | ||
| 482 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 483 | /* 1024x768@43Hz, interlace */ | ||
| 484 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 44900, 1024, 1032, | ||
| 485 | 1208, 1264, 0, 768, 768, 772, 817, 0, | ||
| 486 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC | | ||
| 487 | DRM_MODE_FLAG_INTERLACE) }, | ||
| 488 | /* 1024x768@60Hz */ | ||
| 489 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000, 1024, 1048, | ||
| 490 | 1184, 1344, 0, 768, 771, 777, 806, 0, | ||
| 491 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 492 | /* 1024x768@70Hz */ | ||
| 493 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 75000, 1024, 1048, | ||
| 494 | 1184, 1328, 0, 768, 771, 777, 806, 0, | ||
| 495 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 496 | /* 1024x768@75Hz */ | ||
| 497 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 78750, 1024, 1040, | ||
| 498 | 1136, 1312, 0, 768, 769, 772, 800, 0, | ||
| 499 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 500 | /* 1024x768@85Hz */ | ||
| 501 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 94500, 1024, 1072, | ||
| 502 | 1168, 1376, 0, 768, 769, 772, 808, 0, | ||
| 503 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 504 | /* 1152x864@75Hz */ | ||
| 505 | { DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER, 108000, 1152, 1216, | ||
| 506 | 1344, 1600, 0, 864, 865, 868, 900, 0, | ||
| 507 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 508 | /* 1280x768@60Hz */ | ||
| 509 | { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 79500, 1280, 1344, | ||
| 510 | 1472, 1664, 0, 768, 771, 778, 798, 0, | ||
| 511 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 512 | /* 1280x768@75Hz */ | ||
| 513 | { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 102250, 1280, 1360, | ||
| 514 | 1488, 1696, 0, 768, 771, 778, 805, 0, | ||
| 515 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 516 | /* 1280x768@85Hz */ | ||
| 517 | { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 117500, 1280, 1360, | ||
| 518 | 1496, 1712, 0, 768, 771, 778, 809, 0, | ||
| 519 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 520 | /* 1280x800@60Hz */ | ||
| 521 | { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 83500, 1280, 1352, | ||
| 522 | 1480, 1680, 0, 800, 803, 809, 831, 0, | ||
| 523 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 524 | /* 1280x800@75Hz */ | ||
| 525 | { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 106500, 1280, 1360, | ||
| 526 | 1488, 1696, 0, 800, 803, 809, 838, 0, | ||
| 527 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 528 | /* 1280x800@85Hz */ | ||
| 529 | { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 122500, 1280, 1360, | ||
| 530 | 1496, 1712, 0, 800, 803, 809, 843, 0, | ||
| 531 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 532 | /* 1280x960@60Hz */ | ||
| 533 | { DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 108000, 1280, 1376, | ||
| 534 | 1488, 1800, 0, 960, 961, 964, 1000, 0, | ||
| 535 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 536 | /* 1280x960@85Hz */ | ||
| 537 | { DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1344, | ||
| 538 | 1504, 1728, 0, 960, 961, 964, 1011, 0, | ||
| 539 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 540 | /* 1280x1024@60Hz */ | ||
| 541 | { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 108000, 1280, 1328, | ||
| 542 | 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, | ||
| 543 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 544 | /* 1280x1024@75Hz */ | ||
| 545 | { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 135000, 1280, 1296, | ||
| 546 | 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, | ||
| 547 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 548 | /* 1280x1024@85Hz */ | ||
| 549 | { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 157500, 1280, 1344, | ||
| 550 | 1504, 1728, 0, 1024, 1025, 1028, 1072, 0, | ||
| 551 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 552 | /* 1360x768@60Hz */ | ||
| 553 | { DRM_MODE("1360x768", DRM_MODE_TYPE_DRIVER, 85500, 1360, 1424, | ||
| 554 | 1536, 1792, 0, 768, 771, 777, 795, 0, | ||
| 555 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 556 | /* 1440x1050@60Hz */ | ||
| 557 | { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 121750, 1400, 1488, | ||
| 558 | 1632, 1864, 0, 1050, 1053, 1057, 1089, 0, | ||
| 559 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 560 | /* 1440x1050@75Hz */ | ||
| 561 | { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 156000, 1400, 1504, | ||
| 562 | 1648, 1896, 0, 1050, 1053, 1057, 1099, 0, | ||
| 563 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 564 | /* 1440x1050@85Hz */ | ||
| 565 | { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 179500, 1400, 1504, | ||
| 566 | 1656, 1912, 0, 1050, 1053, 1057, 1105, 0, | ||
| 567 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 568 | /* 1440x900@60Hz */ | ||
| 569 | { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 106500, 1440, 1520, | ||
| 570 | 1672, 1904, 0, 900, 903, 909, 934, 0, | ||
| 571 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 572 | /* 1440x900@75Hz */ | ||
| 573 | { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 136750, 1440, 1536, | ||
| 574 | 1688, 1936, 0, 900, 903, 909, 942, 0, | ||
| 575 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 576 | /* 1440x900@85Hz */ | ||
| 577 | { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 157000, 1440, 1544, | ||
| 578 | 1696, 1952, 0, 900, 903, 909, 948, 0, | ||
| 579 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 580 | /* 1600x1200@60Hz */ | ||
| 581 | { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 162000, 1600, 1664, | ||
| 582 | 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, | ||
| 583 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 584 | /* 1600x1200@65Hz */ | ||
| 585 | { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 175500, 1600, 1664, | ||
| 586 | 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, | ||
| 587 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 588 | /* 1600x1200@70Hz */ | ||
| 589 | { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 189000, 1600, 1664, | ||
| 590 | 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, | ||
| 591 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 592 | /* 1600x1200@75Hz */ | ||
| 593 | { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 202500, 1600, 1664, | ||
| 594 | 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, | ||
| 595 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 596 | /* 1600x1200@85Hz */ | ||
| 597 | { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 229500, 1600, 1664, | ||
| 598 | 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, | ||
| 599 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 600 | /* 1680x1050@60Hz */ | ||
| 601 | { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 146250, 1680, 1784, | ||
| 602 | 1960, 2240, 0, 1050, 1053, 1059, 1089, 0, | ||
| 603 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 604 | /* 1680x1050@75Hz */ | ||
| 605 | { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 187000, 1680, 1800, | ||
| 606 | 1976, 2272, 0, 1050, 1053, 1059, 1099, 0, | ||
| 607 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 608 | /* 1680x1050@85Hz */ | ||
| 609 | { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 214750, 1680, 1808, | ||
| 610 | 1984, 2288, 0, 1050, 1053, 1059, 1105, 0, | ||
| 611 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 612 | /* 1792x1344@60Hz */ | ||
| 613 | { DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 204750, 1792, 1920, | ||
| 614 | 2120, 2448, 0, 1344, 1345, 1348, 1394, 0, | ||
| 615 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 616 | /* 1729x1344@75Hz */ | ||
| 617 | { DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 261000, 1792, 1888, | ||
| 618 | 2104, 2456, 0, 1344, 1345, 1348, 1417, 0, | ||
| 619 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 620 | /* 1853x1392@60Hz */ | ||
| 621 | { DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 218250, 1856, 1952, | ||
| 622 | 2176, 2528, 0, 1392, 1393, 1396, 1439, 0, | ||
| 623 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 624 | /* 1856x1392@75Hz */ | ||
| 625 | { DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 288000, 1856, 1984, | ||
| 626 | 2208, 2560, 0, 1392, 1395, 1399, 1500, 0, | ||
| 627 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 628 | /* 1920x1200@60Hz */ | ||
| 629 | { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 193250, 1920, 2056, | ||
| 630 | 2256, 2592, 0, 1200, 1203, 1209, 1245, 0, | ||
| 631 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 632 | /* 1920x1200@75Hz */ | ||
| 633 | { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 245250, 1920, 2056, | ||
| 634 | 2264, 2608, 0, 1200, 1203, 1209, 1255, 0, | ||
| 635 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 636 | /* 1920x1200@85Hz */ | ||
| 637 | { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 281250, 1920, 2064, | ||
| 638 | 2272, 2624, 0, 1200, 1203, 1209, 1262, 0, | ||
| 639 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 640 | /* 1920x1440@60Hz */ | ||
| 641 | { DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 234000, 1920, 2048, | ||
| 642 | 2256, 2600, 0, 1440, 1441, 1444, 1500, 0, | ||
| 643 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 644 | /* 1920x1440@75Hz */ | ||
| 645 | { DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2064, | ||
| 646 | 2288, 2640, 0, 1440, 1441, 1444, 1500, 0, | ||
| 647 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 648 | /* 2560x1600@60Hz */ | ||
| 649 | { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 348500, 2560, 2752, | ||
| 650 | 3032, 3504, 0, 1600, 1603, 1609, 1658, 0, | ||
| 651 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 652 | /* 2560x1600@75HZ */ | ||
| 653 | { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 443250, 2560, 2768, | ||
| 654 | 3048, 3536, 0, 1600, 1603, 1609, 1672, 0, | ||
| 655 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 656 | /* 2560x1600@85HZ */ | ||
| 657 | { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 505250, 2560, 2768, | ||
| 658 | 3048, 3536, 0, 1600, 1603, 1609, 1682, 0, | ||
| 659 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 660 | }; | ||
| 661 | static const int drm_num_dmt_modes = | ||
| 662 | sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode); | ||
| 663 | |||
| 664 | struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, | 436 | struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, |
| 665 | int hsize, int vsize, int fresh) | 437 | int hsize, int vsize, int fresh) |
| 666 | { | 438 | { |
| @@ -685,6 +457,46 @@ EXPORT_SYMBOL(drm_mode_find_dmt); | |||
| 685 | typedef void detailed_cb(struct detailed_timing *timing, void *closure); | 457 | typedef void detailed_cb(struct detailed_timing *timing, void *closure); |
| 686 | 458 | ||
| 687 | static void | 459 | static void |
| 460 | cea_for_each_detailed_block(u8 *ext, detailed_cb *cb, void *closure) | ||
| 461 | { | ||
| 462 | int i, n = 0; | ||
| 463 | u8 rev = ext[0x01], d = ext[0x02]; | ||
| 464 | u8 *det_base = ext + d; | ||
| 465 | |||
| 466 | switch (rev) { | ||
| 467 | case 0: | ||
| 468 | /* can't happen */ | ||
| 469 | return; | ||
| 470 | case 1: | ||
| 471 | /* have to infer how many blocks we have, check pixel clock */ | ||
| 472 | for (i = 0; i < 6; i++) | ||
| 473 | if (det_base[18*i] || det_base[18*i+1]) | ||
| 474 | n++; | ||
| 475 | break; | ||
| 476 | default: | ||
| 477 | /* explicit count */ | ||
| 478 | n = min(ext[0x03] & 0x0f, 6); | ||
| 479 | break; | ||
| 480 | } | ||
| 481 | |||
| 482 | for (i = 0; i < n; i++) | ||
| 483 | cb((struct detailed_timing *)(det_base + 18 * i), closure); | ||
| 484 | } | ||
| 485 | |||
| 486 | static void | ||
| 487 | vtb_for_each_detailed_block(u8 *ext, detailed_cb *cb, void *closure) | ||
| 488 | { | ||
| 489 | unsigned int i, n = min((int)ext[0x02], 6); | ||
| 490 | u8 *det_base = ext + 5; | ||
| 491 | |||
| 492 | if (ext[0x01] != 1) | ||
| 493 | return; /* unknown version */ | ||
| 494 | |||
| 495 | for (i = 0; i < n; i++) | ||
| 496 | cb((struct detailed_timing *)(det_base + 18 * i), closure); | ||
| 497 | } | ||
| 498 | |||
| 499 | static void | ||
| 688 | drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure) | 500 | drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure) |
| 689 | { | 501 | { |
| 690 | int i; | 502 | int i; |
| @@ -696,7 +508,19 @@ drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure) | |||
| 696 | for (i = 0; i < EDID_DETAILED_TIMINGS; i++) | 508 | for (i = 0; i < EDID_DETAILED_TIMINGS; i++) |
| 697 | cb(&(edid->detailed_timings[i]), closure); | 509 | cb(&(edid->detailed_timings[i]), closure); |
| 698 | 510 | ||
| 699 | /* XXX extension block walk */ | 511 | for (i = 1; i <= raw_edid[0x7e]; i++) { |
| 512 | u8 *ext = raw_edid + (i * EDID_LENGTH); | ||
| 513 | switch (*ext) { | ||
| 514 | case CEA_EXT: | ||
| 515 | cea_for_each_detailed_block(ext, cb, closure); | ||
| 516 | break; | ||
| 517 | case VTB_EXT: | ||
| 518 | vtb_for_each_detailed_block(ext, cb, closure); | ||
| 519 | break; | ||
| 520 | default: | ||
| 521 | break; | ||
| 522 | } | ||
| 523 | } | ||
| 700 | } | 524 | } |
| 701 | 525 | ||
| 702 | static void | 526 | static void |
| @@ -1047,117 +871,6 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev, | |||
| 1047 | return mode; | 871 | return mode; |
| 1048 | } | 872 | } |
| 1049 | 873 | ||
| 1050 | /* | ||
| 1051 | * Detailed mode info for the EDID "established modes" data to use. | ||
| 1052 | */ | ||
| 1053 | static struct drm_display_mode edid_est_modes[] = { | ||
| 1054 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 40000, 800, 840, | ||
| 1055 | 968, 1056, 0, 600, 601, 605, 628, 0, | ||
| 1056 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@60Hz */ | ||
| 1057 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 36000, 800, 824, | ||
| 1058 | 896, 1024, 0, 600, 601, 603, 625, 0, | ||
| 1059 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@56Hz */ | ||
| 1060 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 656, | ||
| 1061 | 720, 840, 0, 480, 481, 484, 500, 0, | ||
| 1062 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@75Hz */ | ||
| 1063 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 664, | ||
| 1064 | 704, 832, 0, 480, 489, 491, 520, 0, | ||
| 1065 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@72Hz */ | ||
| 1066 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 30240, 640, 704, | ||
| 1067 | 768, 864, 0, 480, 483, 486, 525, 0, | ||
| 1068 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@67Hz */ | ||
| 1069 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25200, 640, 656, | ||
| 1070 | 752, 800, 0, 480, 490, 492, 525, 0, | ||
| 1071 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@60Hz */ | ||
| 1072 | { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER, 35500, 720, 738, | ||
| 1073 | 846, 900, 0, 400, 421, 423, 449, 0, | ||
| 1074 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 720x400@88Hz */ | ||
| 1075 | { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER, 28320, 720, 738, | ||
| 1076 | 846, 900, 0, 400, 412, 414, 449, 0, | ||
| 1077 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 720x400@70Hz */ | ||
| 1078 | { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 135000, 1280, 1296, | ||
| 1079 | 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, | ||
| 1080 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1280x1024@75Hz */ | ||
| 1081 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 78800, 1024, 1040, | ||
| 1082 | 1136, 1312, 0, 768, 769, 772, 800, 0, | ||
| 1083 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1024x768@75Hz */ | ||
| 1084 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 75000, 1024, 1048, | ||
| 1085 | 1184, 1328, 0, 768, 771, 777, 806, 0, | ||
| 1086 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1024x768@70Hz */ | ||
| 1087 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000, 1024, 1048, | ||
| 1088 | 1184, 1344, 0, 768, 771, 777, 806, 0, | ||
| 1089 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1024x768@60Hz */ | ||
| 1090 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER,44900, 1024, 1032, | ||
| 1091 | 1208, 1264, 0, 768, 768, 776, 817, 0, | ||
| 1092 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_INTERLACE) }, /* 1024x768@43Hz */ | ||
| 1093 | { DRM_MODE("832x624", DRM_MODE_TYPE_DRIVER, 57284, 832, 864, | ||
| 1094 | 928, 1152, 0, 624, 625, 628, 667, 0, | ||
| 1095 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 832x624@75Hz */ | ||
| 1096 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 49500, 800, 816, | ||
| 1097 | 896, 1056, 0, 600, 601, 604, 625, 0, | ||
| 1098 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@75Hz */ | ||
| 1099 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 50000, 800, 856, | ||
| 1100 | 976, 1040, 0, 600, 637, 643, 666, 0, | ||
| 1101 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@72Hz */ | ||
| 1102 | { DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER, 108000, 1152, 1216, | ||
| 1103 | 1344, 1600, 0, 864, 865, 868, 900, 0, | ||
| 1104 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1152x864@75Hz */ | ||
| 1105 | }; | ||
| 1106 | |||
| 1107 | /** | ||
| 1108 | * add_established_modes - get est. modes from EDID and add them | ||
| 1109 | * @edid: EDID block to scan | ||
| 1110 | * | ||
| 1111 | * Each EDID block contains a bitmap of the supported "established modes" list | ||
| 1112 | * (defined above). Tease them out and add them to the global modes list. | ||
| 1113 | */ | ||
| 1114 | static int add_established_modes(struct drm_connector *connector, struct edid *edid) | ||
| 1115 | { | ||
| 1116 | struct drm_device *dev = connector->dev; | ||
| 1117 | unsigned long est_bits = edid->established_timings.t1 | | ||
| 1118 | (edid->established_timings.t2 << 8) | | ||
| 1119 | ((edid->established_timings.mfg_rsvd & 0x80) << 9); | ||
| 1120 | int i, modes = 0; | ||
| 1121 | |||
| 1122 | for (i = 0; i <= EDID_EST_TIMINGS; i++) | ||
| 1123 | if (est_bits & (1<<i)) { | ||
| 1124 | struct drm_display_mode *newmode; | ||
| 1125 | newmode = drm_mode_duplicate(dev, &edid_est_modes[i]); | ||
| 1126 | if (newmode) { | ||
| 1127 | drm_mode_probed_add(connector, newmode); | ||
| 1128 | modes++; | ||
| 1129 | } | ||
| 1130 | } | ||
| 1131 | |||
| 1132 | return modes; | ||
| 1133 | } | ||
| 1134 | |||
| 1135 | /** | ||
| 1136 | * add_standard_modes - get std. modes from EDID and add them | ||
| 1137 | * @edid: EDID block to scan | ||
| 1138 | * | ||
| 1139 | * Standard modes can be calculated using the CVT standard. Grab them from | ||
| 1140 | * @edid, calculate them, and add them to the list. | ||
| 1141 | */ | ||
| 1142 | static int add_standard_modes(struct drm_connector *connector, struct edid *edid) | ||
| 1143 | { | ||
| 1144 | int i, modes = 0; | ||
| 1145 | |||
| 1146 | for (i = 0; i < EDID_STD_TIMINGS; i++) { | ||
| 1147 | struct drm_display_mode *newmode; | ||
| 1148 | |||
| 1149 | newmode = drm_mode_std(connector, edid, | ||
| 1150 | &edid->standard_timings[i], | ||
| 1151 | edid->revision); | ||
| 1152 | if (newmode) { | ||
| 1153 | drm_mode_probed_add(connector, newmode); | ||
| 1154 | modes++; | ||
| 1155 | } | ||
| 1156 | } | ||
| 1157 | |||
| 1158 | return modes; | ||
| 1159 | } | ||
| 1160 | |||
| 1161 | static bool | 874 | static bool |
| 1162 | mode_is_rb(struct drm_display_mode *mode) | 875 | mode_is_rb(struct drm_display_mode *mode) |
| 1163 | { | 876 | { |
| @@ -1267,113 +980,33 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid, | |||
| 1267 | return modes; | 980 | return modes; |
| 1268 | } | 981 | } |
| 1269 | 982 | ||
| 1270 | static int drm_cvt_modes(struct drm_connector *connector, | 983 | static void |
| 1271 | struct detailed_timing *timing) | 984 | do_inferred_modes(struct detailed_timing *timing, void *c) |
| 1272 | { | 985 | { |
| 1273 | int i, j, modes = 0; | 986 | struct detailed_mode_closure *closure = c; |
| 1274 | struct drm_display_mode *newmode; | 987 | struct detailed_non_pixel *data = &timing->data.other_data; |
| 1275 | struct drm_device *dev = connector->dev; | 988 | int gtf = (closure->edid->features & DRM_EDID_FEATURE_DEFAULT_GTF); |
| 1276 | struct cvt_timing *cvt; | ||
| 1277 | const int rates[] = { 60, 85, 75, 60, 50 }; | ||
| 1278 | const u8 empty[3] = { 0, 0, 0 }; | ||
| 1279 | |||
| 1280 | for (i = 0; i < 4; i++) { | ||
| 1281 | int uninitialized_var(width), height; | ||
| 1282 | cvt = &(timing->data.other_data.data.cvt[i]); | ||
| 1283 | 989 | ||
| 1284 | if (!memcmp(cvt->code, empty, 3)) | 990 | if (gtf && data->type == EDID_DETAIL_MONITOR_RANGE) |
| 1285 | continue; | 991 | closure->modes += drm_gtf_modes_for_range(closure->connector, |
| 992 | closure->edid, | ||
| 993 | timing); | ||
| 994 | } | ||
| 1286 | 995 | ||
| 1287 | height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2; | 996 | static int |
| 1288 | switch (cvt->code[1] & 0x0c) { | 997 | add_inferred_modes(struct drm_connector *connector, struct edid *edid) |
| 1289 | case 0x00: | 998 | { |
| 1290 | width = height * 4 / 3; | 999 | struct detailed_mode_closure closure = { |
| 1291 | break; | 1000 | connector, edid, 0, 0, 0 |
| 1292 | case 0x04: | 1001 | }; |
| 1293 | width = height * 16 / 9; | ||
| 1294 | break; | ||
| 1295 | case 0x08: | ||
| 1296 | width = height * 16 / 10; | ||
| 1297 | break; | ||
| 1298 | case 0x0c: | ||
| 1299 | width = height * 15 / 9; | ||
| 1300 | break; | ||
| 1301 | } | ||
| 1302 | 1002 | ||
| 1303 | for (j = 1; j < 5; j++) { | 1003 | if (version_greater(edid, 1, 0)) |
| 1304 | if (cvt->code[2] & (1 << j)) { | 1004 | drm_for_each_detailed_block((u8 *)edid, do_inferred_modes, |
| 1305 | newmode = drm_cvt_mode(dev, width, height, | 1005 | &closure); |
| 1306 | rates[j], j == 0, | ||
| 1307 | false, false); | ||
| 1308 | if (newmode) { | ||
| 1309 | drm_mode_probed_add(connector, newmode); | ||
| 1310 | modes++; | ||
| 1311 | } | ||
| 1312 | } | ||
| 1313 | } | ||
| 1314 | } | ||
| 1315 | 1006 | ||
| 1316 | return modes; | 1007 | return closure.modes; |
| 1317 | } | 1008 | } |
| 1318 | 1009 | ||
| 1319 | static const struct { | ||
| 1320 | short w; | ||
| 1321 | short h; | ||
| 1322 | short r; | ||
| 1323 | short rb; | ||
| 1324 | } est3_modes[] = { | ||
| 1325 | /* byte 6 */ | ||
| 1326 | { 640, 350, 85, 0 }, | ||
| 1327 | { 640, 400, 85, 0 }, | ||
| 1328 | { 720, 400, 85, 0 }, | ||
| 1329 | { 640, 480, 85, 0 }, | ||
| 1330 | { 848, 480, 60, 0 }, | ||
| 1331 | { 800, 600, 85, 0 }, | ||
| 1332 | { 1024, 768, 85, 0 }, | ||
| 1333 | { 1152, 864, 75, 0 }, | ||
| 1334 | /* byte 7 */ | ||
| 1335 | { 1280, 768, 60, 1 }, | ||
| 1336 | { 1280, 768, 60, 0 }, | ||
| 1337 | { 1280, 768, 75, 0 }, | ||
| 1338 | { 1280, 768, 85, 0 }, | ||
| 1339 | { 1280, 960, 60, 0 }, | ||
| 1340 | { 1280, 960, 85, 0 }, | ||
| 1341 | { 1280, 1024, 60, 0 }, | ||
| 1342 | { 1280, 1024, 85, 0 }, | ||
| 1343 | /* byte 8 */ | ||
| 1344 | { 1360, 768, 60, 0 }, | ||
| 1345 | { 1440, 900, 60, 1 }, | ||
| 1346 | { 1440, 900, 60, 0 }, | ||
| 1347 | { 1440, 900, 75, 0 }, | ||
| 1348 | { 1440, 900, 85, 0 }, | ||
| 1349 | { 1400, 1050, 60, 1 }, | ||
| 1350 | { 1400, 1050, 60, 0 }, | ||
| 1351 | { 1400, 1050, 75, 0 }, | ||
| 1352 | /* byte 9 */ | ||
| 1353 | { 1400, 1050, 85, 0 }, | ||
| 1354 | { 1680, 1050, 60, 1 }, | ||
| 1355 | { 1680, 1050, 60, 0 }, | ||
| 1356 | { 1680, 1050, 75, 0 }, | ||
| 1357 | { 1680, 1050, 85, 0 }, | ||
| 1358 | { 1600, 1200, 60, 0 }, | ||
| 1359 | { 1600, 1200, 65, 0 }, | ||
| 1360 | { 1600, 1200, 70, 0 }, | ||
| 1361 | /* byte 10 */ | ||
| 1362 | { 1600, 1200, 75, 0 }, | ||
| 1363 | { 1600, 1200, 85, 0 }, | ||
| 1364 | { 1792, 1344, 60, 0 }, | ||
| 1365 | { 1792, 1344, 85, 0 }, | ||
| 1366 | { 1856, 1392, 60, 0 }, | ||
| 1367 | { 1856, 1392, 75, 0 }, | ||
| 1368 | { 1920, 1200, 60, 1 }, | ||
| 1369 | { 1920, 1200, 60, 0 }, | ||
| 1370 | /* byte 11 */ | ||
| 1371 | { 1920, 1200, 75, 0 }, | ||
| 1372 | { 1920, 1200, 85, 0 }, | ||
| 1373 | { 1920, 1440, 60, 0 }, | ||
| 1374 | { 1920, 1440, 75, 0 }, | ||
| 1375 | }; | ||
| 1376 | |||
| 1377 | static int | 1010 | static int |
| 1378 | drm_est3_modes(struct drm_connector *connector, struct detailed_timing *timing) | 1011 | drm_est3_modes(struct drm_connector *connector, struct detailed_timing *timing) |
| 1379 | { | 1012 | { |
| @@ -1403,37 +1036,63 @@ drm_est3_modes(struct drm_connector *connector, struct detailed_timing *timing) | |||
| 1403 | return modes; | 1036 | return modes; |
| 1404 | } | 1037 | } |
| 1405 | 1038 | ||
| 1406 | static int add_detailed_modes(struct drm_connector *connector, | 1039 | static void |
| 1407 | struct detailed_timing *timing, | 1040 | do_established_modes(struct detailed_timing *timing, void *c) |
| 1408 | struct edid *edid, u32 quirks, int preferred) | ||
| 1409 | { | 1041 | { |
| 1410 | int i, modes = 0; | 1042 | struct detailed_mode_closure *closure = c; |
| 1411 | struct detailed_non_pixel *data = &timing->data.other_data; | 1043 | struct detailed_non_pixel *data = &timing->data.other_data; |
| 1412 | int gtf = (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF); | ||
| 1413 | struct drm_display_mode *newmode; | ||
| 1414 | struct drm_device *dev = connector->dev; | ||
| 1415 | 1044 | ||
| 1416 | if (timing->pixel_clock) { | 1045 | if (data->type == EDID_DETAIL_EST_TIMINGS) |
| 1417 | newmode = drm_mode_detailed(dev, edid, timing, quirks); | 1046 | closure->modes += drm_est3_modes(closure->connector, timing); |
| 1418 | if (!newmode) | 1047 | } |
| 1419 | return 0; | ||
| 1420 | 1048 | ||
| 1421 | if (preferred) | 1049 | /** |
| 1422 | newmode->type |= DRM_MODE_TYPE_PREFERRED; | 1050 | * add_established_modes - get est. modes from EDID and add them |
| 1051 | * @edid: EDID block to scan | ||
| 1052 | * | ||
| 1053 | * Each EDID block contains a bitmap of the supported "established modes" list | ||
| 1054 | * (defined above). Tease them out and add them to the global modes list. | ||
| 1055 | */ | ||
| 1056 | static int | ||
| 1057 | add_established_modes(struct drm_connector *connector, struct edid *edid) | ||
| 1058 | { | ||
| 1059 | struct drm_device *dev = connector->dev; | ||
| 1060 | unsigned long est_bits = edid->established_timings.t1 | | ||
| 1061 | (edid->established_timings.t2 << 8) | | ||
| 1062 | ((edid->established_timings.mfg_rsvd & 0x80) << 9); | ||
| 1063 | int i, modes = 0; | ||
| 1064 | struct detailed_mode_closure closure = { | ||
| 1065 | connector, edid, 0, 0, 0 | ||
| 1066 | }; | ||
| 1423 | 1067 | ||
| 1424 | drm_mode_probed_add(connector, newmode); | 1068 | for (i = 0; i <= EDID_EST_TIMINGS; i++) { |
| 1425 | return 1; | 1069 | if (est_bits & (1<<i)) { |
| 1070 | struct drm_display_mode *newmode; | ||
| 1071 | newmode = drm_mode_duplicate(dev, &edid_est_modes[i]); | ||
| 1072 | if (newmode) { | ||
| 1073 | drm_mode_probed_add(connector, newmode); | ||
| 1074 | modes++; | ||
| 1075 | } | ||
| 1076 | } | ||
| 1426 | } | 1077 | } |
| 1427 | 1078 | ||
| 1428 | /* other timing types */ | 1079 | if (version_greater(edid, 1, 0)) |
| 1429 | switch (data->type) { | 1080 | drm_for_each_detailed_block((u8 *)edid, |
| 1430 | case EDID_DETAIL_MONITOR_RANGE: | 1081 | do_established_modes, &closure); |
| 1431 | if (gtf) | 1082 | |
| 1432 | modes += drm_gtf_modes_for_range(connector, edid, | 1083 | return modes + closure.modes; |
| 1433 | timing); | 1084 | } |
| 1434 | break; | 1085 | |
| 1435 | case EDID_DETAIL_STD_MODES: | 1086 | static void |
| 1436 | /* Six modes per detailed section */ | 1087 | do_standard_modes(struct detailed_timing *timing, void *c) |
| 1088 | { | ||
| 1089 | struct detailed_mode_closure *closure = c; | ||
| 1090 | struct detailed_non_pixel *data = &timing->data.other_data; | ||
| 1091 | struct drm_connector *connector = closure->connector; | ||
| 1092 | struct edid *edid = closure->edid; | ||
| 1093 | |||
| 1094 | if (data->type == EDID_DETAIL_STD_MODES) { | ||
| 1095 | int i; | ||
| 1437 | for (i = 0; i < 6; i++) { | 1096 | for (i = 0; i < 6; i++) { |
| 1438 | struct std_timing *std; | 1097 | struct std_timing *std; |
| 1439 | struct drm_display_mode *newmode; | 1098 | struct drm_display_mode *newmode; |
| @@ -1443,108 +1102,169 @@ static int add_detailed_modes(struct drm_connector *connector, | |||
| 1443 | edid->revision); | 1102 | edid->revision); |
| 1444 | if (newmode) { | 1103 | if (newmode) { |
| 1445 | drm_mode_probed_add(connector, newmode); | 1104 | drm_mode_probed_add(connector, newmode); |
| 1446 | modes++; | 1105 | closure->modes++; |
| 1447 | } | 1106 | } |
| 1448 | } | 1107 | } |
| 1449 | break; | ||
| 1450 | case EDID_DETAIL_CVT_3BYTE: | ||
| 1451 | modes += drm_cvt_modes(connector, timing); | ||
| 1452 | break; | ||
| 1453 | case EDID_DETAIL_EST_TIMINGS: | ||
| 1454 | modes += drm_est3_modes(connector, timing); | ||
| 1455 | break; | ||
| 1456 | default: | ||
| 1457 | break; | ||
| 1458 | } | 1108 | } |
| 1459 | |||
| 1460 | return modes; | ||
| 1461 | } | 1109 | } |
| 1462 | 1110 | ||
| 1463 | /** | 1111 | /** |
| 1464 | * add_detailed_info - get detailed mode info from EDID data | 1112 | * add_standard_modes - get std. modes from EDID and add them |
| 1465 | * @connector: attached connector | ||
| 1466 | * @edid: EDID block to scan | 1113 | * @edid: EDID block to scan |
| 1467 | * @quirks: quirks to apply | ||
| 1468 | * | 1114 | * |
| 1469 | * Some of the detailed timing sections may contain mode information. Grab | 1115 | * Standard modes can be calculated using the appropriate standard (DMT, |
| 1470 | * it and add it to the list. | 1116 | * GTF or CVT. Grab them from @edid and add them to the list. |
| 1471 | */ | 1117 | */ |
| 1472 | static int add_detailed_info(struct drm_connector *connector, | 1118 | static int |
| 1473 | struct edid *edid, u32 quirks) | 1119 | add_standard_modes(struct drm_connector *connector, struct edid *edid) |
| 1474 | { | 1120 | { |
| 1475 | int i, modes = 0; | 1121 | int i, modes = 0; |
| 1122 | struct detailed_mode_closure closure = { | ||
| 1123 | connector, edid, 0, 0, 0 | ||
| 1124 | }; | ||
| 1125 | |||
| 1126 | for (i = 0; i < EDID_STD_TIMINGS; i++) { | ||
| 1127 | struct drm_display_mode *newmode; | ||
| 1128 | |||
| 1129 | newmode = drm_mode_std(connector, edid, | ||
| 1130 | &edid->standard_timings[i], | ||
| 1131 | edid->revision); | ||
| 1132 | if (newmode) { | ||
| 1133 | drm_mode_probed_add(connector, newmode); | ||
| 1134 | modes++; | ||
| 1135 | } | ||
| 1136 | } | ||
| 1137 | |||
| 1138 | if (version_greater(edid, 1, 0)) | ||
| 1139 | drm_for_each_detailed_block((u8 *)edid, do_standard_modes, | ||
| 1140 | &closure); | ||
| 1141 | |||
| 1142 | /* XXX should also look for standard codes in VTB blocks */ | ||
| 1143 | |||
| 1144 | return modes + closure.modes; | ||
| 1145 | } | ||
| 1476 | 1146 | ||
| 1477 | for (i = 0; i < EDID_DETAILED_TIMINGS; i++) { | 1147 | static int drm_cvt_modes(struct drm_connector *connector, |
| 1478 | struct detailed_timing *timing = &edid->detailed_timings[i]; | 1148 | struct detailed_timing *timing) |
| 1479 | int preferred = (i == 0); | 1149 | { |
| 1150 | int i, j, modes = 0; | ||
| 1151 | struct drm_display_mode *newmode; | ||
| 1152 | struct drm_device *dev = connector->dev; | ||
| 1153 | struct cvt_timing *cvt; | ||
| 1154 | const int rates[] = { 60, 85, 75, 60, 50 }; | ||
| 1155 | const u8 empty[3] = { 0, 0, 0 }; | ||
| 1480 | 1156 | ||
| 1481 | if (preferred && edid->version == 1 && edid->revision < 4) | 1157 | for (i = 0; i < 4; i++) { |
| 1482 | preferred = (edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING); | 1158 | int uninitialized_var(width), height; |
| 1159 | cvt = &(timing->data.other_data.data.cvt[i]); | ||
| 1483 | 1160 | ||
| 1484 | /* In 1.0, only timings are allowed */ | 1161 | if (!memcmp(cvt->code, empty, 3)) |
| 1485 | if (!timing->pixel_clock && edid->version == 1 && | ||
| 1486 | edid->revision == 0) | ||
| 1487 | continue; | 1162 | continue; |
| 1488 | 1163 | ||
| 1489 | modes += add_detailed_modes(connector, timing, edid, quirks, | 1164 | height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2; |
| 1490 | preferred); | 1165 | switch (cvt->code[1] & 0x0c) { |
| 1166 | case 0x00: | ||
| 1167 | width = height * 4 / 3; | ||
| 1168 | break; | ||
| 1169 | case 0x04: | ||
| 1170 | width = height * 16 / 9; | ||
| 1171 | break; | ||
| 1172 | case 0x08: | ||
| 1173 | width = height * 16 / 10; | ||
| 1174 | break; | ||
| 1175 | case 0x0c: | ||
| 1176 | width = height * 15 / 9; | ||
| 1177 | break; | ||
| 1178 | } | ||
| 1179 | |||
| 1180 | for (j = 1; j < 5; j++) { | ||
| 1181 | if (cvt->code[2] & (1 << j)) { | ||
| 1182 | newmode = drm_cvt_mode(dev, width, height, | ||
| 1183 | rates[j], j == 0, | ||
| 1184 | false, false); | ||
| 1185 | if (newmode) { | ||
| 1186 | drm_mode_probed_add(connector, newmode); | ||
| 1187 | modes++; | ||
| 1188 | } | ||
| 1189 | } | ||
| 1190 | } | ||
| 1491 | } | 1191 | } |
| 1492 | 1192 | ||
| 1493 | return modes; | 1193 | return modes; |
| 1494 | } | 1194 | } |
| 1495 | 1195 | ||
| 1496 | /** | 1196 | static void |
| 1497 | * add_detailed_mode_eedid - get detailed mode info from addtional timing | 1197 | do_cvt_mode(struct detailed_timing *timing, void *c) |
| 1498 | * EDID block | ||
| 1499 | * @connector: attached connector | ||
| 1500 | * @edid: EDID block to scan(It is only to get addtional timing EDID block) | ||
| 1501 | * @quirks: quirks to apply | ||
| 1502 | * | ||
| 1503 | * Some of the detailed timing sections may contain mode information. Grab | ||
| 1504 | * it and add it to the list. | ||
| 1505 | */ | ||
| 1506 | static int add_detailed_info_eedid(struct drm_connector *connector, | ||
| 1507 | struct edid *edid, u32 quirks) | ||
| 1508 | { | 1198 | { |
| 1509 | int i, modes = 0; | 1199 | struct detailed_mode_closure *closure = c; |
| 1510 | char *edid_ext = NULL; | 1200 | struct detailed_non_pixel *data = &timing->data.other_data; |
| 1511 | struct detailed_timing *timing; | ||
| 1512 | int start_offset, end_offset; | ||
| 1513 | 1201 | ||
| 1514 | if (edid->version == 1 && edid->revision < 3) | 1202 | if (data->type == EDID_DETAIL_CVT_3BYTE) |
| 1515 | return 0; | 1203 | closure->modes += drm_cvt_modes(closure->connector, timing); |
| 1516 | if (!edid->extensions) | 1204 | } |
| 1517 | return 0; | ||
| 1518 | 1205 | ||
| 1519 | /* Find CEA extension */ | 1206 | static int |
| 1520 | for (i = 0; i < edid->extensions; i++) { | 1207 | add_cvt_modes(struct drm_connector *connector, struct edid *edid) |
| 1521 | edid_ext = (char *)edid + EDID_LENGTH * (i + 1); | 1208 | { |
| 1522 | if (edid_ext[0] == 0x02) | 1209 | struct detailed_mode_closure closure = { |
| 1523 | break; | 1210 | connector, edid, 0, 0, 0 |
| 1524 | } | 1211 | }; |
| 1525 | 1212 | ||
| 1526 | if (i == edid->extensions) | 1213 | if (version_greater(edid, 1, 2)) |
| 1527 | return 0; | 1214 | drm_for_each_detailed_block((u8 *)edid, do_cvt_mode, &closure); |
| 1528 | 1215 | ||
| 1529 | /* Get the start offset of detailed timing block */ | 1216 | /* XXX should also look for CVT codes in VTB blocks */ |
| 1530 | start_offset = edid_ext[2]; | ||
| 1531 | if (start_offset == 0) { | ||
| 1532 | /* If the start_offset is zero, it means that neither detailed | ||
| 1533 | * info nor data block exist. In such case it is also | ||
| 1534 | * unnecessary to parse the detailed timing info. | ||
| 1535 | */ | ||
| 1536 | return 0; | ||
| 1537 | } | ||
| 1538 | 1217 | ||
| 1539 | end_offset = EDID_LENGTH; | 1218 | return closure.modes; |
| 1540 | end_offset -= sizeof(struct detailed_timing); | 1219 | } |
| 1541 | for (i = start_offset; i < end_offset; | 1220 | |
| 1542 | i += sizeof(struct detailed_timing)) { | 1221 | static void |
| 1543 | timing = (struct detailed_timing *)(edid_ext + i); | 1222 | do_detailed_mode(struct detailed_timing *timing, void *c) |
| 1544 | modes += add_detailed_modes(connector, timing, edid, quirks, 0); | 1223 | { |
| 1224 | struct detailed_mode_closure *closure = c; | ||
| 1225 | struct drm_display_mode *newmode; | ||
| 1226 | |||
| 1227 | if (timing->pixel_clock) { | ||
| 1228 | newmode = drm_mode_detailed(closure->connector->dev, | ||
| 1229 | closure->edid, timing, | ||
| 1230 | closure->quirks); | ||
| 1231 | if (!newmode) | ||
| 1232 | return; | ||
| 1233 | |||
| 1234 | if (closure->preferred) | ||
| 1235 | newmode->type |= DRM_MODE_TYPE_PREFERRED; | ||
| 1236 | |||
| 1237 | drm_mode_probed_add(closure->connector, newmode); | ||
| 1238 | closure->modes++; | ||
| 1239 | closure->preferred = 0; | ||
| 1545 | } | 1240 | } |
| 1241 | } | ||
| 1546 | 1242 | ||
| 1547 | return modes; | 1243 | /* |
| 1244 | * add_detailed_modes - Add modes from detailed timings | ||
| 1245 | * @connector: attached connector | ||
| 1246 | * @edid: EDID block to scan | ||
| 1247 | * @quirks: quirks to apply | ||
| 1248 | */ | ||
| 1249 | static int | ||
| 1250 | add_detailed_modes(struct drm_connector *connector, struct edid *edid, | ||
| 1251 | u32 quirks) | ||
| 1252 | { | ||
| 1253 | struct detailed_mode_closure closure = { | ||
| 1254 | connector, | ||
| 1255 | edid, | ||
| 1256 | 1, | ||
| 1257 | quirks, | ||
| 1258 | 0 | ||
| 1259 | }; | ||
| 1260 | |||
| 1261 | if (closure.preferred && !version_greater(edid, 1, 3)) | ||
| 1262 | closure.preferred = | ||
| 1263 | (edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING); | ||
| 1264 | |||
| 1265 | drm_for_each_detailed_block((u8 *)edid, do_detailed_mode, &closure); | ||
| 1266 | |||
| 1267 | return closure.modes; | ||
| 1548 | } | 1268 | } |
| 1549 | 1269 | ||
| 1550 | #define HDMI_IDENTIFIER 0x000C03 | 1270 | #define HDMI_IDENTIFIER 0x000C03 |
| @@ -1640,35 +1360,21 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) | |||
| 1640 | * - established timing codes | 1360 | * - established timing codes |
| 1641 | * - modes inferred from GTF or CVT range information | 1361 | * - modes inferred from GTF or CVT range information |
| 1642 | * | 1362 | * |
| 1643 | * We don't quite implement this yet, but we're close. | 1363 | * We get this pretty much right. |
| 1644 | * | 1364 | * |
| 1645 | * XXX order for additional mode types in extension blocks? | 1365 | * XXX order for additional mode types in extension blocks? |
| 1646 | */ | 1366 | */ |
| 1647 | num_modes += add_detailed_info(connector, edid, quirks); | 1367 | num_modes += add_detailed_modes(connector, edid, quirks); |
| 1648 | num_modes += add_detailed_info_eedid(connector, edid, quirks); | 1368 | num_modes += add_cvt_modes(connector, edid); |
| 1649 | num_modes += add_standard_modes(connector, edid); | 1369 | num_modes += add_standard_modes(connector, edid); |
| 1650 | num_modes += add_established_modes(connector, edid); | 1370 | num_modes += add_established_modes(connector, edid); |
| 1371 | num_modes += add_inferred_modes(connector, edid); | ||
| 1651 | 1372 | ||
| 1652 | if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75)) | 1373 | if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75)) |
| 1653 | edid_fixup_preferred(connector, quirks); | 1374 | edid_fixup_preferred(connector, quirks); |
| 1654 | 1375 | ||
| 1655 | connector->display_info.serration_vsync = (edid->input & DRM_EDID_INPUT_SERRATION_VSYNC) ? 1 : 0; | ||
| 1656 | connector->display_info.sync_on_green = (edid->input & DRM_EDID_INPUT_SYNC_ON_GREEN) ? 1 : 0; | ||
| 1657 | connector->display_info.composite_sync = (edid->input & DRM_EDID_INPUT_COMPOSITE_SYNC) ? 1 : 0; | ||
| 1658 | connector->display_info.separate_syncs = (edid->input & DRM_EDID_INPUT_SEPARATE_SYNCS) ? 1 : 0; | ||
| 1659 | connector->display_info.blank_to_black = (edid->input & DRM_EDID_INPUT_BLANK_TO_BLACK) ? 1 : 0; | ||
| 1660 | connector->display_info.video_level = (edid->input & DRM_EDID_INPUT_VIDEO_LEVEL) >> 5; | ||
| 1661 | connector->display_info.digital = (edid->input & DRM_EDID_INPUT_DIGITAL) ? 1 : 0; | ||
| 1662 | connector->display_info.width_mm = edid->width_cm * 10; | 1376 | connector->display_info.width_mm = edid->width_cm * 10; |
| 1663 | connector->display_info.height_mm = edid->height_cm * 10; | 1377 | connector->display_info.height_mm = edid->height_cm * 10; |
| 1664 | connector->display_info.gamma = edid->gamma; | ||
| 1665 | connector->display_info.gtf_supported = (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF) ? 1 : 0; | ||
| 1666 | connector->display_info.standard_color = (edid->features & DRM_EDID_FEATURE_STANDARD_COLOR) ? 1 : 0; | ||
| 1667 | connector->display_info.display_type = (edid->features & DRM_EDID_FEATURE_DISPLAY_TYPE) >> 3; | ||
| 1668 | connector->display_info.active_off_supported = (edid->features & DRM_EDID_FEATURE_PM_ACTIVE_OFF) ? 1 : 0; | ||
| 1669 | connector->display_info.suspend_supported = (edid->features & DRM_EDID_FEATURE_PM_SUSPEND) ? 1 : 0; | ||
| 1670 | connector->display_info.standby_supported = (edid->features & DRM_EDID_FEATURE_PM_STANDBY) ? 1 : 0; | ||
| 1671 | connector->display_info.gamma = edid->gamma; | ||
| 1672 | 1378 | ||
| 1673 | return num_modes; | 1379 | return num_modes; |
| 1674 | } | 1380 | } |
diff --git a/drivers/gpu/drm/drm_edid_modes.h b/drivers/gpu/drm/drm_edid_modes.h new file mode 100644 index 000000000000..6eb7592e152f --- /dev/null +++ b/drivers/gpu/drm/drm_edid_modes.h | |||
| @@ -0,0 +1,380 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2007-2008 Intel Corporation | ||
| 3 | * Jesse Barnes <jesse.barnes@intel.com> | ||
| 4 | * Copyright 2010 Red Hat, Inc. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the "Software"), | ||
| 8 | * to deal in the Software without restriction, including without limitation | ||
| 9 | * the rights to use, copy, modify, merge, publish, distribute, sub license, | ||
| 10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 11 | * Software is furnished to do so, subject to the following conditions: | ||
| 12 | * | ||
| 13 | * The above copyright notice and this permission notice (including the | ||
| 14 | * next paragraph) shall be included in all copies or substantial portions | ||
| 15 | * of the Software. | ||
| 16 | * | ||
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| 22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| 23 | * DEALINGS IN THE SOFTWARE. | ||
| 24 | */ | ||
| 25 | |||
| 26 | #include <linux/kernel.h> | ||
| 27 | #include "drmP.h" | ||
| 28 | #include "drm_edid.h" | ||
| 29 | |||
| 30 | /* | ||
| 31 | * Autogenerated from the DMT spec. | ||
| 32 | * This table is copied from xfree86/modes/xf86EdidModes.c. | ||
| 33 | * But the mode with Reduced blank feature is deleted. | ||
| 34 | */ | ||
| 35 | static struct drm_display_mode drm_dmt_modes[] = { | ||
| 36 | /* 640x350@85Hz */ | ||
| 37 | { DRM_MODE("640x350", DRM_MODE_TYPE_DRIVER, 31500, 640, 672, | ||
| 38 | 736, 832, 0, 350, 382, 385, 445, 0, | ||
| 39 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 40 | /* 640x400@85Hz */ | ||
| 41 | { DRM_MODE("640x400", DRM_MODE_TYPE_DRIVER, 31500, 640, 672, | ||
| 42 | 736, 832, 0, 400, 401, 404, 445, 0, | ||
| 43 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 44 | /* 720x400@85Hz */ | ||
| 45 | { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER, 35500, 720, 756, | ||
| 46 | 828, 936, 0, 400, 401, 404, 446, 0, | ||
| 47 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 48 | /* 640x480@60Hz */ | ||
| 49 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656, | ||
| 50 | 752, 800, 0, 480, 489, 492, 525, 0, | ||
| 51 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 52 | /* 640x480@72Hz */ | ||
| 53 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 664, | ||
| 54 | 704, 832, 0, 480, 489, 492, 520, 0, | ||
| 55 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 56 | /* 640x480@75Hz */ | ||
| 57 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 656, | ||
| 58 | 720, 840, 0, 480, 481, 484, 500, 0, | ||
| 59 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 60 | /* 640x480@85Hz */ | ||
| 61 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 36000, 640, 696, | ||
| 62 | 752, 832, 0, 480, 481, 484, 509, 0, | ||
| 63 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 64 | /* 800x600@56Hz */ | ||
| 65 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 36000, 800, 824, | ||
| 66 | 896, 1024, 0, 600, 601, 603, 625, 0, | ||
| 67 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 68 | /* 800x600@60Hz */ | ||
| 69 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 40000, 800, 840, | ||
| 70 | 968, 1056, 0, 600, 601, 605, 628, 0, | ||
| 71 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 72 | /* 800x600@72Hz */ | ||
| 73 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 50000, 800, 856, | ||
| 74 | 976, 1040, 0, 600, 637, 643, 666, 0, | ||
| 75 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 76 | /* 800x600@75Hz */ | ||
| 77 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 49500, 800, 816, | ||
| 78 | 896, 1056, 0, 600, 601, 604, 625, 0, | ||
| 79 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 80 | /* 800x600@85Hz */ | ||
| 81 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 56250, 800, 832, | ||
| 82 | 896, 1048, 0, 600, 601, 604, 631, 0, | ||
| 83 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 84 | /* 848x480@60Hz */ | ||
| 85 | { DRM_MODE("848x480", DRM_MODE_TYPE_DRIVER, 33750, 848, 864, | ||
| 86 | 976, 1088, 0, 480, 486, 494, 517, 0, | ||
| 87 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 88 | /* 1024x768@43Hz, interlace */ | ||
| 89 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 44900, 1024, 1032, | ||
| 90 | 1208, 1264, 0, 768, 768, 772, 817, 0, | ||
| 91 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC | | ||
| 92 | DRM_MODE_FLAG_INTERLACE) }, | ||
| 93 | /* 1024x768@60Hz */ | ||
| 94 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000, 1024, 1048, | ||
| 95 | 1184, 1344, 0, 768, 771, 777, 806, 0, | ||
| 96 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 97 | /* 1024x768@70Hz */ | ||
| 98 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 75000, 1024, 1048, | ||
| 99 | 1184, 1328, 0, 768, 771, 777, 806, 0, | ||
| 100 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 101 | /* 1024x768@75Hz */ | ||
| 102 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 78750, 1024, 1040, | ||
| 103 | 1136, 1312, 0, 768, 769, 772, 800, 0, | ||
| 104 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 105 | /* 1024x768@85Hz */ | ||
| 106 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 94500, 1024, 1072, | ||
| 107 | 1168, 1376, 0, 768, 769, 772, 808, 0, | ||
| 108 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 109 | /* 1152x864@75Hz */ | ||
| 110 | { DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER, 108000, 1152, 1216, | ||
| 111 | 1344, 1600, 0, 864, 865, 868, 900, 0, | ||
| 112 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 113 | /* 1280x768@60Hz */ | ||
| 114 | { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 79500, 1280, 1344, | ||
| 115 | 1472, 1664, 0, 768, 771, 778, 798, 0, | ||
| 116 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 117 | /* 1280x768@75Hz */ | ||
| 118 | { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 102250, 1280, 1360, | ||
| 119 | 1488, 1696, 0, 768, 771, 778, 805, 0, | ||
| 120 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 121 | /* 1280x768@85Hz */ | ||
| 122 | { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 117500, 1280, 1360, | ||
| 123 | 1496, 1712, 0, 768, 771, 778, 809, 0, | ||
| 124 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 125 | /* 1280x800@60Hz */ | ||
| 126 | { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 83500, 1280, 1352, | ||
| 127 | 1480, 1680, 0, 800, 803, 809, 831, 0, | ||
| 128 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, | ||
| 129 | /* 1280x800@75Hz */ | ||
| 130 | { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 106500, 1280, 1360, | ||
| 131 | 1488, 1696, 0, 800, 803, 809, 838, 0, | ||
| 132 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 133 | /* 1280x800@85Hz */ | ||
| 134 | { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 122500, 1280, 1360, | ||
| 135 | 1496, 1712, 0, 800, 803, 809, 843, 0, | ||
| 136 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 137 | /* 1280x960@60Hz */ | ||
| 138 | { DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 108000, 1280, 1376, | ||
| 139 | 1488, 1800, 0, 960, 961, 964, 1000, 0, | ||
| 140 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 141 | /* 1280x960@85Hz */ | ||
| 142 | { DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1344, | ||
| 143 | 1504, 1728, 0, 960, 961, 964, 1011, 0, | ||
| 144 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 145 | /* 1280x1024@60Hz */ | ||
| 146 | { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 108000, 1280, 1328, | ||
| 147 | 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, | ||
| 148 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 149 | /* 1280x1024@75Hz */ | ||
| 150 | { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 135000, 1280, 1296, | ||
| 151 | 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, | ||
| 152 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 153 | /* 1280x1024@85Hz */ | ||
| 154 | { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 157500, 1280, 1344, | ||
| 155 | 1504, 1728, 0, 1024, 1025, 1028, 1072, 0, | ||
| 156 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 157 | /* 1360x768@60Hz */ | ||
| 158 | { DRM_MODE("1360x768", DRM_MODE_TYPE_DRIVER, 85500, 1360, 1424, | ||
| 159 | 1536, 1792, 0, 768, 771, 777, 795, 0, | ||
| 160 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 161 | /* 1440x1050@60Hz */ | ||
| 162 | { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 121750, 1400, 1488, | ||
| 163 | 1632, 1864, 0, 1050, 1053, 1057, 1089, 0, | ||
| 164 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 165 | /* 1440x1050@75Hz */ | ||
| 166 | { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 156000, 1400, 1504, | ||
| 167 | 1648, 1896, 0, 1050, 1053, 1057, 1099, 0, | ||
| 168 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 169 | /* 1440x1050@85Hz */ | ||
| 170 | { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 179500, 1400, 1504, | ||
| 171 | 1656, 1912, 0, 1050, 1053, 1057, 1105, 0, | ||
| 172 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 173 | /* 1440x900@60Hz */ | ||
| 174 | { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 106500, 1440, 1520, | ||
| 175 | 1672, 1904, 0, 900, 903, 909, 934, 0, | ||
| 176 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 177 | /* 1440x900@75Hz */ | ||
| 178 | { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 136750, 1440, 1536, | ||
| 179 | 1688, 1936, 0, 900, 903, 909, 942, 0, | ||
| 180 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 181 | /* 1440x900@85Hz */ | ||
| 182 | { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 157000, 1440, 1544, | ||
| 183 | 1696, 1952, 0, 900, 903, 909, 948, 0, | ||
| 184 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 185 | /* 1600x1200@60Hz */ | ||
| 186 | { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 162000, 1600, 1664, | ||
| 187 | 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, | ||
| 188 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 189 | /* 1600x1200@65Hz */ | ||
| 190 | { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 175500, 1600, 1664, | ||
| 191 | 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, | ||
| 192 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 193 | /* 1600x1200@70Hz */ | ||
| 194 | { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 189000, 1600, 1664, | ||
| 195 | 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, | ||
| 196 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 197 | /* 1600x1200@75Hz */ | ||
| 198 | { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 202500, 1600, 1664, | ||
| 199 | 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, | ||
| 200 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 201 | /* 1600x1200@85Hz */ | ||
| 202 | { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 229500, 1600, 1664, | ||
| 203 | 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, | ||
| 204 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 205 | /* 1680x1050@60Hz */ | ||
| 206 | { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 146250, 1680, 1784, | ||
| 207 | 1960, 2240, 0, 1050, 1053, 1059, 1089, 0, | ||
| 208 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 209 | /* 1680x1050@75Hz */ | ||
| 210 | { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 187000, 1680, 1800, | ||
| 211 | 1976, 2272, 0, 1050, 1053, 1059, 1099, 0, | ||
| 212 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 213 | /* 1680x1050@85Hz */ | ||
| 214 | { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 214750, 1680, 1808, | ||
| 215 | 1984, 2288, 0, 1050, 1053, 1059, 1105, 0, | ||
| 216 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 217 | /* 1792x1344@60Hz */ | ||
| 218 | { DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 204750, 1792, 1920, | ||
| 219 | 2120, 2448, 0, 1344, 1345, 1348, 1394, 0, | ||
| 220 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 221 | /* 1729x1344@75Hz */ | ||
| 222 | { DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 261000, 1792, 1888, | ||
| 223 | 2104, 2456, 0, 1344, 1345, 1348, 1417, 0, | ||
| 224 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 225 | /* 1853x1392@60Hz */ | ||
| 226 | { DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 218250, 1856, 1952, | ||
| 227 | 2176, 2528, 0, 1392, 1393, 1396, 1439, 0, | ||
| 228 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 229 | /* 1856x1392@75Hz */ | ||
| 230 | { DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 288000, 1856, 1984, | ||
| 231 | 2208, 2560, 0, 1392, 1395, 1399, 1500, 0, | ||
| 232 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 233 | /* 1920x1200@60Hz */ | ||
| 234 | { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 193250, 1920, 2056, | ||
| 235 | 2256, 2592, 0, 1200, 1203, 1209, 1245, 0, | ||
| 236 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 237 | /* 1920x1200@75Hz */ | ||
| 238 | { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 245250, 1920, 2056, | ||
| 239 | 2264, 2608, 0, 1200, 1203, 1209, 1255, 0, | ||
| 240 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 241 | /* 1920x1200@85Hz */ | ||
| 242 | { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 281250, 1920, 2064, | ||
| 243 | 2272, 2624, 0, 1200, 1203, 1209, 1262, 0, | ||
| 244 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 245 | /* 1920x1440@60Hz */ | ||
| 246 | { DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 234000, 1920, 2048, | ||
| 247 | 2256, 2600, 0, 1440, 1441, 1444, 1500, 0, | ||
| 248 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 249 | /* 1920x1440@75Hz */ | ||
| 250 | { DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2064, | ||
| 251 | 2288, 2640, 0, 1440, 1441, 1444, 1500, 0, | ||
| 252 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 253 | /* 2560x1600@60Hz */ | ||
| 254 | { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 348500, 2560, 2752, | ||
| 255 | 3032, 3504, 0, 1600, 1603, 1609, 1658, 0, | ||
| 256 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 257 | /* 2560x1600@75HZ */ | ||
| 258 | { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 443250, 2560, 2768, | ||
| 259 | 3048, 3536, 0, 1600, 1603, 1609, 1672, 0, | ||
| 260 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 261 | /* 2560x1600@85HZ */ | ||
| 262 | { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 505250, 2560, 2768, | ||
| 263 | 3048, 3536, 0, 1600, 1603, 1609, 1682, 0, | ||
| 264 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, | ||
| 265 | }; | ||
| 266 | static const int drm_num_dmt_modes = | ||
| 267 | sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode); | ||
| 268 | |||
| 269 | static struct drm_display_mode edid_est_modes[] = { | ||
| 270 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 40000, 800, 840, | ||
| 271 | 968, 1056, 0, 600, 601, 605, 628, 0, | ||
| 272 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@60Hz */ | ||
| 273 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 36000, 800, 824, | ||
| 274 | 896, 1024, 0, 600, 601, 603, 625, 0, | ||
| 275 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@56Hz */ | ||
| 276 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 656, | ||
| 277 | 720, 840, 0, 480, 481, 484, 500, 0, | ||
| 278 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@75Hz */ | ||
| 279 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 664, | ||
| 280 | 704, 832, 0, 480, 489, 491, 520, 0, | ||
| 281 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@72Hz */ | ||
| 282 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 30240, 640, 704, | ||
| 283 | 768, 864, 0, 480, 483, 486, 525, 0, | ||
| 284 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@67Hz */ | ||
| 285 | { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25200, 640, 656, | ||
| 286 | 752, 800, 0, 480, 490, 492, 525, 0, | ||
| 287 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@60Hz */ | ||
| 288 | { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER, 35500, 720, 738, | ||
| 289 | 846, 900, 0, 400, 421, 423, 449, 0, | ||
| 290 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 720x400@88Hz */ | ||
| 291 | { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER, 28320, 720, 738, | ||
| 292 | 846, 900, 0, 400, 412, 414, 449, 0, | ||
| 293 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 720x400@70Hz */ | ||
| 294 | { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 135000, 1280, 1296, | ||
| 295 | 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, | ||
| 296 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1280x1024@75Hz */ | ||
| 297 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 78800, 1024, 1040, | ||
| 298 | 1136, 1312, 0, 768, 769, 772, 800, 0, | ||
| 299 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1024x768@75Hz */ | ||
| 300 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 75000, 1024, 1048, | ||
| 301 | 1184, 1328, 0, 768, 771, 777, 806, 0, | ||
| 302 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1024x768@70Hz */ | ||
| 303 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000, 1024, 1048, | ||
| 304 | 1184, 1344, 0, 768, 771, 777, 806, 0, | ||
| 305 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1024x768@60Hz */ | ||
| 306 | { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER,44900, 1024, 1032, | ||
| 307 | 1208, 1264, 0, 768, 768, 776, 817, 0, | ||
| 308 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_INTERLACE) }, /* 1024x768@43Hz */ | ||
| 309 | { DRM_MODE("832x624", DRM_MODE_TYPE_DRIVER, 57284, 832, 864, | ||
| 310 | 928, 1152, 0, 624, 625, 628, 667, 0, | ||
| 311 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 832x624@75Hz */ | ||
| 312 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 49500, 800, 816, | ||
| 313 | 896, 1056, 0, 600, 601, 604, 625, 0, | ||
| 314 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@75Hz */ | ||
| 315 | { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 50000, 800, 856, | ||
| 316 | 976, 1040, 0, 600, 637, 643, 666, 0, | ||
| 317 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@72Hz */ | ||
| 318 | { DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER, 108000, 1152, 1216, | ||
| 319 | 1344, 1600, 0, 864, 865, 868, 900, 0, | ||
| 320 | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1152x864@75Hz */ | ||
| 321 | }; | ||
| 322 | |||
| 323 | static const struct { | ||
| 324 | short w; | ||
| 325 | short h; | ||
| 326 | short r; | ||
| 327 | short rb; | ||
| 328 | } est3_modes[] = { | ||
| 329 | /* byte 6 */ | ||
| 330 | { 640, 350, 85, 0 }, | ||
| 331 | { 640, 400, 85, 0 }, | ||
| 332 | { 720, 400, 85, 0 }, | ||
| 333 | { 640, 480, 85, 0 }, | ||
| 334 | { 848, 480, 60, 0 }, | ||
| 335 | { 800, 600, 85, 0 }, | ||
| 336 | { 1024, 768, 85, 0 }, | ||
| 337 | { 1152, 864, 75, 0 }, | ||
| 338 | /* byte 7 */ | ||
| 339 | { 1280, 768, 60, 1 }, | ||
| 340 | { 1280, 768, 60, 0 }, | ||
| 341 | { 1280, 768, 75, 0 }, | ||
| 342 | { 1280, 768, 85, 0 }, | ||
| 343 | { 1280, 960, 60, 0 }, | ||
| 344 | { 1280, 960, 85, 0 }, | ||
| 345 | { 1280, 1024, 60, 0 }, | ||
| 346 | { 1280, 1024, 85, 0 }, | ||
| 347 | /* byte 8 */ | ||
| 348 | { 1360, 768, 60, 0 }, | ||
| 349 | { 1440, 900, 60, 1 }, | ||
| 350 | { 1440, 900, 60, 0 }, | ||
| 351 | { 1440, 900, 75, 0 }, | ||
| 352 | { 1440, 900, 85, 0 }, | ||
| 353 | { 1400, 1050, 60, 1 }, | ||
| 354 | { 1400, 1050, 60, 0 }, | ||
| 355 | { 1400, 1050, 75, 0 }, | ||
| 356 | /* byte 9 */ | ||
| 357 | { 1400, 1050, 85, 0 }, | ||
| 358 | { 1680, 1050, 60, 1 }, | ||
| 359 | { 1680, 1050, 60, 0 }, | ||
| 360 | { 1680, 1050, 75, 0 }, | ||
| 361 | { 1680, 1050, 85, 0 }, | ||
| 362 | { 1600, 1200, 60, 0 }, | ||
| 363 | { 1600, 1200, 65, 0 }, | ||
| 364 | { 1600, 1200, 70, 0 }, | ||
| 365 | /* byte 10 */ | ||
| 366 | { 1600, 1200, 75, 0 }, | ||
| 367 | { 1600, 1200, 85, 0 }, | ||
| 368 | { 1792, 1344, 60, 0 }, | ||
| 369 | { 1792, 1344, 85, 0 }, | ||
| 370 | { 1856, 1392, 60, 0 }, | ||
| 371 | { 1856, 1392, 75, 0 }, | ||
| 372 | { 1920, 1200, 60, 1 }, | ||
| 373 | { 1920, 1200, 60, 0 }, | ||
| 374 | /* byte 11 */ | ||
| 375 | { 1920, 1200, 75, 0 }, | ||
| 376 | { 1920, 1200, 85, 0 }, | ||
| 377 | { 1920, 1440, 60, 0 }, | ||
| 378 | { 1920, 1440, 75, 0 }, | ||
| 379 | }; | ||
| 380 | static const int num_est3_modes = sizeof(est3_modes) / sizeof(est3_modes[0]); | ||
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 2ca8df8b6102..3a652a65546f 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
| @@ -135,15 +135,9 @@ int drm_open(struct inode *inode, struct file *filp) | |||
| 135 | retcode = drm_open_helper(inode, filp, dev); | 135 | retcode = drm_open_helper(inode, filp, dev); |
| 136 | if (!retcode) { | 136 | if (!retcode) { |
| 137 | atomic_inc(&dev->counts[_DRM_STAT_OPENS]); | 137 | atomic_inc(&dev->counts[_DRM_STAT_OPENS]); |
| 138 | spin_lock(&dev->count_lock); | 138 | if (!dev->open_count++) |
| 139 | if (!dev->open_count++) { | ||
| 140 | spin_unlock(&dev->count_lock); | ||
| 141 | retcode = drm_setup(dev); | 139 | retcode = drm_setup(dev); |
| 142 | goto out; | ||
| 143 | } | ||
| 144 | spin_unlock(&dev->count_lock); | ||
| 145 | } | 140 | } |
| 146 | out: | ||
| 147 | if (!retcode) { | 141 | if (!retcode) { |
| 148 | mutex_lock(&dev->struct_mutex); | 142 | mutex_lock(&dev->struct_mutex); |
| 149 | if (minor->type == DRM_MINOR_LEGACY) { | 143 | if (minor->type == DRM_MINOR_LEGACY) { |
| @@ -570,18 +564,14 @@ int drm_release(struct inode *inode, struct file *filp) | |||
| 570 | */ | 564 | */ |
| 571 | 565 | ||
| 572 | atomic_inc(&dev->counts[_DRM_STAT_CLOSES]); | 566 | atomic_inc(&dev->counts[_DRM_STAT_CLOSES]); |
| 573 | spin_lock(&dev->count_lock); | ||
| 574 | if (!--dev->open_count) { | 567 | if (!--dev->open_count) { |
| 575 | if (atomic_read(&dev->ioctl_count)) { | 568 | if (atomic_read(&dev->ioctl_count)) { |
| 576 | DRM_ERROR("Device busy: %d\n", | 569 | DRM_ERROR("Device busy: %d\n", |
| 577 | atomic_read(&dev->ioctl_count)); | 570 | atomic_read(&dev->ioctl_count)); |
| 578 | retcode = -EBUSY; | 571 | retcode = -EBUSY; |
| 579 | goto out; | 572 | } else |
| 580 | } | 573 | retcode = drm_lastclose(dev); |
| 581 | retcode = drm_lastclose(dev); | ||
| 582 | } | 574 | } |
| 583 | out: | ||
| 584 | spin_unlock(&dev->count_lock); | ||
| 585 | mutex_unlock(&drm_global_mutex); | 575 | mutex_unlock(&drm_global_mutex); |
| 586 | 576 | ||
| 587 | return retcode; | 577 | return retcode; |
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 4f1b86714489..bf92d07510df 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
| @@ -322,7 +322,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data, | |||
| 322 | 322 | ||
| 323 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); | 323 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); |
| 324 | if (obj == NULL) | 324 | if (obj == NULL) |
| 325 | return -EBADF; | 325 | return -ENOENT; |
| 326 | 326 | ||
| 327 | again: | 327 | again: |
| 328 | if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0) { | 328 | if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0) { |
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 7b03b197fc00..47db4df37a69 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c | |||
| @@ -392,6 +392,7 @@ int drm_setversion(struct drm_device *dev, void *data, struct drm_file *file_pri | |||
| 392 | if (sv->drm_di_minor >= 1) { | 392 | if (sv->drm_di_minor >= 1) { |
| 393 | /* | 393 | /* |
| 394 | * Version 1.1 includes tying of DRM to specific device | 394 | * Version 1.1 includes tying of DRM to specific device |
| 395 | * Version 1.4 has proper PCI domain support | ||
| 395 | */ | 396 | */ |
| 396 | retcode = drm_set_busid(dev, file_priv); | 397 | retcode = drm_set_busid(dev, file_priv); |
| 397 | if (retcode) | 398 | if (retcode) |
diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c index 833b35f44a77..08792a740f18 100644 --- a/drivers/gpu/drm/i2c/ch7006_drv.c +++ b/drivers/gpu/drm/i2c/ch7006_drv.c | |||
| @@ -470,6 +470,7 @@ static int ch7006_encoder_init(struct i2c_client *client, | |||
| 470 | priv->hmargin = 50; | 470 | priv->hmargin = 50; |
| 471 | priv->vmargin = 50; | 471 | priv->vmargin = 50; |
| 472 | priv->last_dpms = -1; | 472 | priv->last_dpms = -1; |
| 473 | priv->chip_version = ch7006_read(client, CH7006_VERSION_ID); | ||
| 473 | 474 | ||
| 474 | if (ch7006_tv_norm) { | 475 | if (ch7006_tv_norm) { |
| 475 | for (i = 0; i < NUM_TV_NORMS; i++) { | 476 | for (i = 0; i < NUM_TV_NORMS; i++) { |
diff --git a/drivers/gpu/drm/i2c/ch7006_mode.c b/drivers/gpu/drm/i2c/ch7006_mode.c index e447dfb63890..c860f24a5afc 100644 --- a/drivers/gpu/drm/i2c/ch7006_mode.c +++ b/drivers/gpu/drm/i2c/ch7006_mode.c | |||
| @@ -316,7 +316,10 @@ void ch7006_setup_power_state(struct drm_encoder *encoder) | |||
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | } else { | 318 | } else { |
| 319 | *power |= bitfs(CH7006_POWER_LEVEL, FULL_POWER_OFF); | 319 | if (priv->chip_version >= 0x20) |
| 320 | *power |= bitfs(CH7006_POWER_LEVEL, FULL_POWER_OFF); | ||
| 321 | else | ||
| 322 | *power |= bitfs(CH7006_POWER_LEVEL, POWER_OFF); | ||
| 320 | } | 323 | } |
| 321 | } | 324 | } |
| 322 | 325 | ||
diff --git a/drivers/gpu/drm/i2c/ch7006_priv.h b/drivers/gpu/drm/i2c/ch7006_priv.h index 1c6d2e3bd96f..17667b7d57e7 100644 --- a/drivers/gpu/drm/i2c/ch7006_priv.h +++ b/drivers/gpu/drm/i2c/ch7006_priv.h | |||
| @@ -95,6 +95,7 @@ struct ch7006_priv { | |||
| 95 | int flicker; | 95 | int flicker; |
| 96 | int scale; | 96 | int scale; |
| 97 | 97 | ||
| 98 | int chip_version; | ||
| 98 | int last_dpms; | 99 | int last_dpms; |
| 99 | }; | 100 | }; |
| 100 | 101 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 2a4ed7ca8b4e..0758c7802e6b 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
| @@ -456,7 +456,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, | |||
| 456 | 456 | ||
| 457 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); | 457 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); |
| 458 | if (obj == NULL) | 458 | if (obj == NULL) |
| 459 | return -EBADF; | 459 | return -ENOENT; |
| 460 | obj_priv = to_intel_bo(obj); | 460 | obj_priv = to_intel_bo(obj); |
| 461 | 461 | ||
| 462 | /* Bounds check source. | 462 | /* Bounds check source. |
| @@ -919,7 +919,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
| 919 | 919 | ||
| 920 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); | 920 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); |
| 921 | if (obj == NULL) | 921 | if (obj == NULL) |
| 922 | return -EBADF; | 922 | return -ENOENT; |
| 923 | obj_priv = to_intel_bo(obj); | 923 | obj_priv = to_intel_bo(obj); |
| 924 | 924 | ||
| 925 | /* Bounds check destination. | 925 | /* Bounds check destination. |
| @@ -1002,7 +1002,7 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, | |||
| 1002 | 1002 | ||
| 1003 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); | 1003 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); |
| 1004 | if (obj == NULL) | 1004 | if (obj == NULL) |
| 1005 | return -EBADF; | 1005 | return -ENOENT; |
| 1006 | obj_priv = to_intel_bo(obj); | 1006 | obj_priv = to_intel_bo(obj); |
| 1007 | 1007 | ||
| 1008 | mutex_lock(&dev->struct_mutex); | 1008 | mutex_lock(&dev->struct_mutex); |
| @@ -1060,7 +1060,7 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, | |||
| 1060 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); | 1060 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); |
| 1061 | if (obj == NULL) { | 1061 | if (obj == NULL) { |
| 1062 | mutex_unlock(&dev->struct_mutex); | 1062 | mutex_unlock(&dev->struct_mutex); |
| 1063 | return -EBADF; | 1063 | return -ENOENT; |
| 1064 | } | 1064 | } |
| 1065 | 1065 | ||
| 1066 | #if WATCH_BUF | 1066 | #if WATCH_BUF |
| @@ -1099,7 +1099,7 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
| 1099 | 1099 | ||
| 1100 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); | 1100 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); |
| 1101 | if (obj == NULL) | 1101 | if (obj == NULL) |
| 1102 | return -EBADF; | 1102 | return -ENOENT; |
| 1103 | 1103 | ||
| 1104 | offset = args->offset; | 1104 | offset = args->offset; |
| 1105 | 1105 | ||
| @@ -1373,7 +1373,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, | |||
| 1373 | 1373 | ||
| 1374 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); | 1374 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); |
| 1375 | if (obj == NULL) | 1375 | if (obj == NULL) |
| 1376 | return -EBADF; | 1376 | return -ENOENT; |
| 1377 | 1377 | ||
| 1378 | mutex_lock(&dev->struct_mutex); | 1378 | mutex_lock(&dev->struct_mutex); |
| 1379 | 1379 | ||
| @@ -3364,7 +3364,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
| 3364 | reloc->target_handle); | 3364 | reloc->target_handle); |
| 3365 | if (target_obj == NULL) { | 3365 | if (target_obj == NULL) { |
| 3366 | i915_gem_object_unpin(obj); | 3366 | i915_gem_object_unpin(obj); |
| 3367 | return -EBADF; | 3367 | return -ENOENT; |
| 3368 | } | 3368 | } |
| 3369 | target_obj_priv = to_intel_bo(target_obj); | 3369 | target_obj_priv = to_intel_bo(target_obj); |
| 3370 | 3370 | ||
| @@ -3781,7 +3781,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
| 3781 | exec_list[i].handle, i); | 3781 | exec_list[i].handle, i); |
| 3782 | /* prevent error path from reading uninitialized data */ | 3782 | /* prevent error path from reading uninitialized data */ |
| 3783 | args->buffer_count = i + 1; | 3783 | args->buffer_count = i + 1; |
| 3784 | ret = -EBADF; | 3784 | ret = -ENOENT; |
| 3785 | goto err; | 3785 | goto err; |
| 3786 | } | 3786 | } |
| 3787 | 3787 | ||
| @@ -3791,7 +3791,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
| 3791 | object_list[i]); | 3791 | object_list[i]); |
| 3792 | /* prevent error path from reading uninitialized data */ | 3792 | /* prevent error path from reading uninitialized data */ |
| 3793 | args->buffer_count = i + 1; | 3793 | args->buffer_count = i + 1; |
| 3794 | ret = -EBADF; | 3794 | ret = -EINVAL; |
| 3795 | goto err; | 3795 | goto err; |
| 3796 | } | 3796 | } |
| 3797 | obj_priv->in_execbuffer = true; | 3797 | obj_priv->in_execbuffer = true; |
| @@ -4265,7 +4265,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data, | |||
| 4265 | DRM_ERROR("Bad handle in i915_gem_pin_ioctl(): %d\n", | 4265 | DRM_ERROR("Bad handle in i915_gem_pin_ioctl(): %d\n", |
| 4266 | args->handle); | 4266 | args->handle); |
| 4267 | mutex_unlock(&dev->struct_mutex); | 4267 | mutex_unlock(&dev->struct_mutex); |
| 4268 | return -EBADF; | 4268 | return -ENOENT; |
| 4269 | } | 4269 | } |
| 4270 | obj_priv = to_intel_bo(obj); | 4270 | obj_priv = to_intel_bo(obj); |
| 4271 | 4271 | ||
| @@ -4321,7 +4321,7 @@ i915_gem_unpin_ioctl(struct drm_device *dev, void *data, | |||
| 4321 | DRM_ERROR("Bad handle in i915_gem_unpin_ioctl(): %d\n", | 4321 | DRM_ERROR("Bad handle in i915_gem_unpin_ioctl(): %d\n", |
| 4322 | args->handle); | 4322 | args->handle); |
| 4323 | mutex_unlock(&dev->struct_mutex); | 4323 | mutex_unlock(&dev->struct_mutex); |
| 4324 | return -EBADF; | 4324 | return -ENOENT; |
| 4325 | } | 4325 | } |
| 4326 | 4326 | ||
| 4327 | obj_priv = to_intel_bo(obj); | 4327 | obj_priv = to_intel_bo(obj); |
| @@ -4355,7 +4355,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
| 4355 | if (obj == NULL) { | 4355 | if (obj == NULL) { |
| 4356 | DRM_ERROR("Bad handle in i915_gem_busy_ioctl(): %d\n", | 4356 | DRM_ERROR("Bad handle in i915_gem_busy_ioctl(): %d\n", |
| 4357 | args->handle); | 4357 | args->handle); |
| 4358 | return -EBADF; | 4358 | return -ENOENT; |
| 4359 | } | 4359 | } |
| 4360 | 4360 | ||
| 4361 | mutex_lock(&dev->struct_mutex); | 4361 | mutex_lock(&dev->struct_mutex); |
| @@ -4408,7 +4408,7 @@ i915_gem_madvise_ioctl(struct drm_device *dev, void *data, | |||
| 4408 | if (obj == NULL) { | 4408 | if (obj == NULL) { |
| 4409 | DRM_ERROR("Bad handle in i915_gem_madvise_ioctl(): %d\n", | 4409 | DRM_ERROR("Bad handle in i915_gem_madvise_ioctl(): %d\n", |
| 4410 | args->handle); | 4410 | args->handle); |
| 4411 | return -EBADF; | 4411 | return -ENOENT; |
| 4412 | } | 4412 | } |
| 4413 | 4413 | ||
| 4414 | mutex_lock(&dev->struct_mutex); | 4414 | mutex_lock(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 155719e4d16f..710eca70b323 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
| @@ -275,7 +275,7 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
| 275 | 275 | ||
| 276 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); | 276 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); |
| 277 | if (obj == NULL) | 277 | if (obj == NULL) |
| 278 | return -EINVAL; | 278 | return -ENOENT; |
| 279 | obj_priv = to_intel_bo(obj); | 279 | obj_priv = to_intel_bo(obj); |
| 280 | 280 | ||
| 281 | if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode)) { | 281 | if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode)) { |
| @@ -362,7 +362,7 @@ i915_gem_get_tiling(struct drm_device *dev, void *data, | |||
| 362 | 362 | ||
| 363 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); | 363 | obj = drm_gem_object_lookup(dev, file_priv, args->handle); |
| 364 | if (obj == NULL) | 364 | if (obj == NULL) |
| 365 | return -EINVAL; | 365 | return -ENOENT; |
| 366 | obj_priv = to_intel_bo(obj); | 366 | obj_priv = to_intel_bo(obj); |
| 367 | 367 | ||
| 368 | mutex_lock(&dev->struct_mutex); | 368 | mutex_lock(&dev->struct_mutex); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 1e5e0d379fa9..5ec10e02341b 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -4429,15 +4429,12 @@ void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, | |||
| 4429 | } | 4429 | } |
| 4430 | 4430 | ||
| 4431 | static void intel_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | 4431 | static void intel_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, |
| 4432 | u16 *blue, uint32_t size) | 4432 | u16 *blue, uint32_t start, uint32_t size) |
| 4433 | { | 4433 | { |
| 4434 | int end = (start + size > 256) ? 256 : start + size, i; | ||
| 4434 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 4435 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 4435 | int i; | ||
| 4436 | |||
| 4437 | if (size != 256) | ||
| 4438 | return; | ||
| 4439 | 4436 | ||
| 4440 | for (i = 0; i < 256; i++) { | 4437 | for (i = start; i < end; i++) { |
| 4441 | intel_crtc->lut_r[i] = red[i] >> 8; | 4438 | intel_crtc->lut_r[i] = red[i] >> 8; |
| 4442 | intel_crtc->lut_g[i] = green[i] >> 8; | 4439 | intel_crtc->lut_g[i] = green[i] >> 8; |
| 4443 | intel_crtc->lut_b[i] = blue[i] >> 8; | 4440 | intel_crtc->lut_b[i] = blue[i] >> 8; |
| @@ -5412,18 +5409,18 @@ intel_user_framebuffer_create(struct drm_device *dev, | |||
| 5412 | 5409 | ||
| 5413 | obj = drm_gem_object_lookup(dev, filp, mode_cmd->handle); | 5410 | obj = drm_gem_object_lookup(dev, filp, mode_cmd->handle); |
| 5414 | if (!obj) | 5411 | if (!obj) |
| 5415 | return NULL; | 5412 | return ERR_PTR(-ENOENT); |
| 5416 | 5413 | ||
| 5417 | intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); | 5414 | intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL); |
| 5418 | if (!intel_fb) | 5415 | if (!intel_fb) |
| 5419 | return NULL; | 5416 | return ERR_PTR(-ENOMEM); |
| 5420 | 5417 | ||
| 5421 | ret = intel_framebuffer_init(dev, intel_fb, | 5418 | ret = intel_framebuffer_init(dev, intel_fb, |
| 5422 | mode_cmd, obj); | 5419 | mode_cmd, obj); |
| 5423 | if (ret) { | 5420 | if (ret) { |
| 5424 | drm_gem_object_unreference_unlocked(obj); | 5421 | drm_gem_object_unreference_unlocked(obj); |
| 5425 | kfree(intel_fb); | 5422 | kfree(intel_fb); |
| 5426 | return NULL; | 5423 | return ERR_PTR(ret); |
| 5427 | } | 5424 | } |
| 5428 | 5425 | ||
| 5429 | return &intel_fb->base; | 5426 | return &intel_fb->base; |
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index a79525f434a8..7bdc96256bf5 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
| @@ -121,7 +121,9 @@ static int intelfb_create(struct intel_fbdev *ifbdev, | |||
| 121 | 121 | ||
| 122 | info->par = ifbdev; | 122 | info->par = ifbdev; |
| 123 | 123 | ||
| 124 | intel_framebuffer_init(dev, &ifbdev->ifb, &mode_cmd, fbo); | 124 | ret = intel_framebuffer_init(dev, &ifbdev->ifb, &mode_cmd, fbo); |
| 125 | if (ret) | ||
| 126 | goto out_unpin; | ||
| 125 | 127 | ||
| 126 | fb = &ifbdev->ifb.base; | 128 | fb = &ifbdev->ifb.base; |
| 127 | 129 | ||
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index 2405d5ef0ca7..e9b06e4ef2a2 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile | |||
| @@ -12,12 +12,12 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \ | |||
| 12 | nouveau_dp.o \ | 12 | nouveau_dp.o \ |
| 13 | nv04_timer.o \ | 13 | nv04_timer.o \ |
| 14 | nv04_mc.o nv40_mc.o nv50_mc.o \ | 14 | nv04_mc.o nv40_mc.o nv50_mc.o \ |
| 15 | nv04_fb.o nv10_fb.o nv30_fb.o nv40_fb.o nv50_fb.o \ | 15 | nv04_fb.o nv10_fb.o nv30_fb.o nv40_fb.o nv50_fb.o nvc0_fb.o \ |
| 16 | nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \ | 16 | nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o nvc0_fifo.o \ |
| 17 | nv04_graph.o nv10_graph.o nv20_graph.o \ | 17 | nv04_graph.o nv10_graph.o nv20_graph.o \ |
| 18 | nv40_graph.o nv50_graph.o \ | 18 | nv40_graph.o nv50_graph.o nvc0_graph.o \ |
| 19 | nv40_grctx.o nv50_grctx.o \ | 19 | nv40_grctx.o nv50_grctx.o \ |
| 20 | nv04_instmem.o nv50_instmem.o \ | 20 | nv04_instmem.o nv50_instmem.o nvc0_instmem.o \ |
| 21 | nv50_crtc.o nv50_dac.o nv50_sor.o \ | 21 | nv50_crtc.o nv50_dac.o nv50_sor.o \ |
| 22 | nv50_cursor.o nv50_display.o nv50_fbcon.o \ | 22 | nv50_cursor.o nv50_display.o nv50_fbcon.o \ |
| 23 | nv04_dac.o nv04_dfp.o nv04_tv.o nv17_tv.o nv17_tv_modes.o \ | 23 | nv04_dac.o nv04_dfp.o nv04_tv.o nv17_tv.o nv17_tv_modes.o \ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 7369b5e73649..0b69a9628c95 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
| @@ -1928,6 +1928,31 @@ init_condition_time(struct nvbios *bios, uint16_t offset, | |||
| 1928 | } | 1928 | } |
| 1929 | 1929 | ||
| 1930 | static int | 1930 | static int |
| 1931 | init_ltime(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | ||
| 1932 | { | ||
| 1933 | /* | ||
| 1934 | * INIT_LTIME opcode: 0x57 ('V') | ||
| 1935 | * | ||
| 1936 | * offset (8 bit): opcode | ||
| 1937 | * offset + 1 (16 bit): time | ||
| 1938 | * | ||
| 1939 | * Sleep for "time" miliseconds. | ||
| 1940 | */ | ||
| 1941 | |||
| 1942 | unsigned time = ROM16(bios->data[offset + 1]); | ||
| 1943 | |||
| 1944 | if (!iexec->execute) | ||
| 1945 | return 3; | ||
| 1946 | |||
| 1947 | BIOSLOG(bios, "0x%04X: Sleeping for 0x%04X miliseconds\n", | ||
| 1948 | offset, time); | ||
| 1949 | |||
| 1950 | msleep(time); | ||
| 1951 | |||
| 1952 | return 3; | ||
| 1953 | } | ||
| 1954 | |||
| 1955 | static int | ||
| 1931 | init_zm_reg_sequence(struct nvbios *bios, uint16_t offset, | 1956 | init_zm_reg_sequence(struct nvbios *bios, uint16_t offset, |
| 1932 | struct init_exec *iexec) | 1957 | struct init_exec *iexec) |
| 1933 | { | 1958 | { |
| @@ -1995,6 +2020,64 @@ init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
| 1995 | } | 2020 | } |
| 1996 | 2021 | ||
| 1997 | static int | 2022 | static int |
| 2023 | init_i2c_if(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | ||
| 2024 | { | ||
| 2025 | /* | ||
| 2026 | * INIT_I2C_IF opcode: 0x5E ('^') | ||
| 2027 | * | ||
| 2028 | * offset (8 bit): opcode | ||
| 2029 | * offset + 1 (8 bit): DCB I2C table entry index | ||
| 2030 | * offset + 2 (8 bit): I2C slave address | ||
| 2031 | * offset + 3 (8 bit): I2C register | ||
| 2032 | * offset + 4 (8 bit): mask | ||
| 2033 | * offset + 5 (8 bit): data | ||
| 2034 | * | ||
| 2035 | * Read the register given by "I2C register" on the device addressed | ||
| 2036 | * by "I2C slave address" on the I2C bus given by "DCB I2C table | ||
| 2037 | * entry index". Compare the result AND "mask" to "data". | ||
| 2038 | * If they're not equal, skip subsequent opcodes until condition is | ||
| 2039 | * inverted (INIT_NOT), or we hit INIT_RESUME | ||
| 2040 | */ | ||
| 2041 | |||
| 2042 | uint8_t i2c_index = bios->data[offset + 1]; | ||
| 2043 | uint8_t i2c_address = bios->data[offset + 2] >> 1; | ||
| 2044 | uint8_t reg = bios->data[offset + 3]; | ||
| 2045 | uint8_t mask = bios->data[offset + 4]; | ||
| 2046 | uint8_t data = bios->data[offset + 5]; | ||
| 2047 | struct nouveau_i2c_chan *chan; | ||
| 2048 | union i2c_smbus_data val; | ||
| 2049 | int ret; | ||
| 2050 | |||
| 2051 | /* no execute check by design */ | ||
| 2052 | |||
| 2053 | BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X\n", | ||
| 2054 | offset, i2c_index, i2c_address); | ||
| 2055 | |||
| 2056 | chan = init_i2c_device_find(bios->dev, i2c_index); | ||
| 2057 | if (!chan) | ||
| 2058 | return -ENODEV; | ||
| 2059 | |||
| 2060 | ret = i2c_smbus_xfer(&chan->adapter, i2c_address, 0, | ||
| 2061 | I2C_SMBUS_READ, reg, | ||
| 2062 | I2C_SMBUS_BYTE_DATA, &val); | ||
| 2063 | if (ret < 0) { | ||
| 2064 | BIOSLOG(bios, "0x%04X: I2CReg: 0x%02X, Value: [no device], " | ||
| 2065 | "Mask: 0x%02X, Data: 0x%02X\n", | ||
| 2066 | offset, reg, mask, data); | ||
| 2067 | iexec->execute = 0; | ||
| 2068 | return 6; | ||
| 2069 | } | ||
| 2070 | |||
| 2071 | BIOSLOG(bios, "0x%04X: I2CReg: 0x%02X, Value: 0x%02X, " | ||
| 2072 | "Mask: 0x%02X, Data: 0x%02X\n", | ||
| 2073 | offset, reg, val.byte, mask, data); | ||
| 2074 | |||
| 2075 | iexec->execute = ((val.byte & mask) == data); | ||
| 2076 | |||
| 2077 | return 6; | ||
| 2078 | } | ||
| 2079 | |||
| 2080 | static int | ||
| 1998 | init_copy_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2081 | init_copy_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
| 1999 | { | 2082 | { |
| 2000 | /* | 2083 | /* |
| @@ -2083,9 +2166,10 @@ peek_fb(struct drm_device *dev, struct io_mapping *fb, | |||
| 2083 | uint32_t val = 0; | 2166 | uint32_t val = 0; |
| 2084 | 2167 | ||
| 2085 | if (off < pci_resource_len(dev->pdev, 1)) { | 2168 | if (off < pci_resource_len(dev->pdev, 1)) { |
| 2086 | uint32_t __iomem *p = io_mapping_map_atomic_wc(fb, off, KM_USER0); | 2169 | uint32_t __iomem *p = |
| 2170 | io_mapping_map_atomic_wc(fb, off & PAGE_MASK, KM_USER0); | ||
| 2087 | 2171 | ||
| 2088 | val = ioread32(p); | 2172 | val = ioread32(p + (off & ~PAGE_MASK)); |
| 2089 | 2173 | ||
| 2090 | io_mapping_unmap_atomic(p, KM_USER0); | 2174 | io_mapping_unmap_atomic(p, KM_USER0); |
| 2091 | } | 2175 | } |
| @@ -2098,9 +2182,10 @@ poke_fb(struct drm_device *dev, struct io_mapping *fb, | |||
| 2098 | uint32_t off, uint32_t val) | 2182 | uint32_t off, uint32_t val) |
| 2099 | { | 2183 | { |
| 2100 | if (off < pci_resource_len(dev->pdev, 1)) { | 2184 | if (off < pci_resource_len(dev->pdev, 1)) { |
| 2101 | uint32_t __iomem *p = io_mapping_map_atomic_wc(fb, off, KM_USER0); | 2185 | uint32_t __iomem *p = |
| 2186 | io_mapping_map_atomic_wc(fb, off & PAGE_MASK, KM_USER0); | ||
| 2102 | 2187 | ||
| 2103 | iowrite32(val, p); | 2188 | iowrite32(val, p + (off & ~PAGE_MASK)); |
| 2104 | wmb(); | 2189 | wmb(); |
| 2105 | 2190 | ||
| 2106 | io_mapping_unmap_atomic(p, KM_USER0); | 2191 | io_mapping_unmap_atomic(p, KM_USER0); |
| @@ -2165,7 +2250,7 @@ nv04_init_compute_mem(struct nvbios *bios) | |||
| 2165 | NV04_PFB_BOOT_0_RAM_AMOUNT, | 2250 | NV04_PFB_BOOT_0_RAM_AMOUNT, |
| 2166 | NV04_PFB_BOOT_0_RAM_AMOUNT_4MB); | 2251 | NV04_PFB_BOOT_0_RAM_AMOUNT_4MB); |
| 2167 | 2252 | ||
| 2168 | } else if (peek_fb(dev, fb, 0) == patt) { | 2253 | } else if (peek_fb(dev, fb, 0) != patt) { |
| 2169 | if (read_back_fb(dev, fb, 0x800000, patt)) | 2254 | if (read_back_fb(dev, fb, 0x800000, patt)) |
| 2170 | bios_md32(bios, NV04_PFB_BOOT_0, | 2255 | bios_md32(bios, NV04_PFB_BOOT_0, |
| 2171 | NV04_PFB_BOOT_0_RAM_AMOUNT, | 2256 | NV04_PFB_BOOT_0_RAM_AMOUNT, |
| @@ -2593,7 +2678,7 @@ init_configure_preinit(struct nvbios *bios, uint16_t offset, | |||
| 2593 | /* no iexec->execute check by design */ | 2678 | /* no iexec->execute check by design */ |
| 2594 | 2679 | ||
| 2595 | uint32_t straps = bios_rd32(bios, NV_PEXTDEV_BOOT_0); | 2680 | uint32_t straps = bios_rd32(bios, NV_PEXTDEV_BOOT_0); |
| 2596 | uint8_t cr3c = ((straps << 2) & 0xf0) | (straps & (1 << 6)); | 2681 | uint8_t cr3c = ((straps << 2) & 0xf0) | (straps & 0x40) >> 6; |
| 2597 | 2682 | ||
| 2598 | if (bios->major_version > 2) | 2683 | if (bios->major_version > 2) |
| 2599 | return 0; | 2684 | return 0; |
| @@ -3140,7 +3225,7 @@ init_gpio(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
| 3140 | const uint32_t nv50_gpio_ctl[2] = { 0xe100, 0xe28c }; | 3225 | const uint32_t nv50_gpio_ctl[2] = { 0xe100, 0xe28c }; |
| 3141 | int i; | 3226 | int i; |
| 3142 | 3227 | ||
| 3143 | if (dev_priv->card_type != NV_50) { | 3228 | if (dev_priv->card_type < NV_50) { |
| 3144 | NV_ERROR(bios->dev, "INIT_GPIO on unsupported chipset\n"); | 3229 | NV_ERROR(bios->dev, "INIT_GPIO on unsupported chipset\n"); |
| 3145 | return 1; | 3230 | return 1; |
| 3146 | } | 3231 | } |
| @@ -3490,6 +3575,69 @@ init_zm_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
| 3490 | return len; | 3575 | return len; |
| 3491 | } | 3576 | } |
| 3492 | 3577 | ||
| 3578 | static int | ||
| 3579 | init_i2c_long_if(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | ||
| 3580 | { | ||
| 3581 | /* | ||
| 3582 | * INIT_I2C_LONG_IF opcode: 0x9A ('') | ||
| 3583 | * | ||
| 3584 | * offset (8 bit): opcode | ||
| 3585 | * offset + 1 (8 bit): DCB I2C table entry index | ||
| 3586 | * offset + 2 (8 bit): I2C slave address | ||
| 3587 | * offset + 3 (16 bit): I2C register | ||
| 3588 | * offset + 5 (8 bit): mask | ||
| 3589 | * offset + 6 (8 bit): data | ||
| 3590 | * | ||
| 3591 | * Read the register given by "I2C register" on the device addressed | ||
| 3592 | * by "I2C slave address" on the I2C bus given by "DCB I2C table | ||
| 3593 | * entry index". Compare the result AND "mask" to "data". | ||
| 3594 | * If they're not equal, skip subsequent opcodes until condition is | ||
| 3595 | * inverted (INIT_NOT), or we hit INIT_RESUME | ||
| 3596 | */ | ||
| 3597 | |||
| 3598 | uint8_t i2c_index = bios->data[offset + 1]; | ||
| 3599 | uint8_t i2c_address = bios->data[offset + 2] >> 1; | ||
| 3600 | uint8_t reglo = bios->data[offset + 3]; | ||
| 3601 | uint8_t reghi = bios->data[offset + 4]; | ||
| 3602 | uint8_t mask = bios->data[offset + 5]; | ||
| 3603 | uint8_t data = bios->data[offset + 6]; | ||
| 3604 | struct nouveau_i2c_chan *chan; | ||
| 3605 | uint8_t buf0[2] = { reghi, reglo }; | ||
| 3606 | uint8_t buf1[1]; | ||
| 3607 | struct i2c_msg msg[2] = { | ||
| 3608 | { i2c_address, 0, 1, buf0 }, | ||
| 3609 | { i2c_address, I2C_M_RD, 1, buf1 }, | ||
| 3610 | }; | ||
| 3611 | int ret; | ||
| 3612 | |||
| 3613 | /* no execute check by design */ | ||
| 3614 | |||
| 3615 | BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X\n", | ||
| 3616 | offset, i2c_index, i2c_address); | ||
| 3617 | |||
| 3618 | chan = init_i2c_device_find(bios->dev, i2c_index); | ||
| 3619 | if (!chan) | ||
| 3620 | return -ENODEV; | ||
| 3621 | |||
| 3622 | |||
| 3623 | ret = i2c_transfer(&chan->adapter, msg, 2); | ||
| 3624 | if (ret < 0) { | ||
| 3625 | BIOSLOG(bios, "0x%04X: I2CReg: 0x%02X:0x%02X, Value: [no device], " | ||
| 3626 | "Mask: 0x%02X, Data: 0x%02X\n", | ||
| 3627 | offset, reghi, reglo, mask, data); | ||
| 3628 | iexec->execute = 0; | ||
| 3629 | return 7; | ||
| 3630 | } | ||
| 3631 | |||
| 3632 | BIOSLOG(bios, "0x%04X: I2CReg: 0x%02X:0x%02X, Value: 0x%02X, " | ||
| 3633 | "Mask: 0x%02X, Data: 0x%02X\n", | ||
| 3634 | offset, reghi, reglo, buf1[0], mask, data); | ||
| 3635 | |||
| 3636 | iexec->execute = ((buf1[0] & mask) == data); | ||
| 3637 | |||
| 3638 | return 7; | ||
| 3639 | } | ||
| 3640 | |||
| 3493 | static struct init_tbl_entry itbl_entry[] = { | 3641 | static struct init_tbl_entry itbl_entry[] = { |
| 3494 | /* command name , id , length , offset , mult , command handler */ | 3642 | /* command name , id , length , offset , mult , command handler */ |
| 3495 | /* INIT_PROG (0x31, 15, 10, 4) removed due to no example of use */ | 3643 | /* INIT_PROG (0x31, 15, 10, 4) removed due to no example of use */ |
| @@ -3516,9 +3664,11 @@ static struct init_tbl_entry itbl_entry[] = { | |||
| 3516 | { "INIT_ZM_CR" , 0x53, init_zm_cr }, | 3664 | { "INIT_ZM_CR" , 0x53, init_zm_cr }, |
| 3517 | { "INIT_ZM_CR_GROUP" , 0x54, init_zm_cr_group }, | 3665 | { "INIT_ZM_CR_GROUP" , 0x54, init_zm_cr_group }, |
| 3518 | { "INIT_CONDITION_TIME" , 0x56, init_condition_time }, | 3666 | { "INIT_CONDITION_TIME" , 0x56, init_condition_time }, |
| 3667 | { "INIT_LTIME" , 0x57, init_ltime }, | ||
| 3519 | { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence }, | 3668 | { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence }, |
| 3520 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ | 3669 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ |
| 3521 | { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct }, | 3670 | { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct }, |
| 3671 | { "INIT_I2C_IF" , 0x5E, init_i2c_if }, | ||
| 3522 | { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg }, | 3672 | { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg }, |
| 3523 | { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io }, | 3673 | { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io }, |
| 3524 | { "INIT_COMPUTE_MEM" , 0x63, init_compute_mem }, | 3674 | { "INIT_COMPUTE_MEM" , 0x63, init_compute_mem }, |
| @@ -3552,6 +3702,7 @@ static struct init_tbl_entry itbl_entry[] = { | |||
| 3552 | { "INIT_97" , 0x97, init_97 }, | 3702 | { "INIT_97" , 0x97, init_97 }, |
| 3553 | { "INIT_AUXCH" , 0x98, init_auxch }, | 3703 | { "INIT_AUXCH" , 0x98, init_auxch }, |
| 3554 | { "INIT_ZM_AUXCH" , 0x99, init_zm_auxch }, | 3704 | { "INIT_ZM_AUXCH" , 0x99, init_zm_auxch }, |
| 3705 | { "INIT_I2C_LONG_IF" , 0x9A, init_i2c_long_if }, | ||
| 3555 | { NULL , 0 , NULL } | 3706 | { NULL , 0 , NULL } |
| 3556 | }; | 3707 | }; |
| 3557 | 3708 | ||
| @@ -4410,7 +4561,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent, | |||
| 4410 | bios->display.script_table_ptr, | 4561 | bios->display.script_table_ptr, |
| 4411 | table[2], table[3], table[0] >= 0x21); | 4562 | table[2], table[3], table[0] >= 0x21); |
| 4412 | if (!otable) { | 4563 | if (!otable) { |
| 4413 | NV_ERROR(dev, "Couldn't find matching output script table\n"); | 4564 | NV_DEBUG_KMS(dev, "failed to match any output table\n"); |
| 4414 | return 1; | 4565 | return 1; |
| 4415 | } | 4566 | } |
| 4416 | 4567 | ||
| @@ -4467,7 +4618,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent, | |||
| 4467 | if (script) | 4618 | if (script) |
| 4468 | script = clkcmptable(bios, script, pxclk); | 4619 | script = clkcmptable(bios, script, pxclk); |
| 4469 | if (!script) { | 4620 | if (!script) { |
| 4470 | NV_ERROR(dev, "clock script 0 not found\n"); | 4621 | NV_DEBUG_KMS(dev, "clock script 0 not found\n"); |
| 4471 | return 1; | 4622 | return 1; |
| 4472 | } | 4623 | } |
| 4473 | 4624 | ||
| @@ -4826,7 +4977,7 @@ int get_pll_limits(struct drm_device *dev, uint32_t limit_match, struct pll_lims | |||
| 4826 | pll_lim->min_p = record[12]; | 4977 | pll_lim->min_p = record[12]; |
| 4827 | pll_lim->max_p = record[13]; | 4978 | pll_lim->max_p = record[13]; |
| 4828 | /* where did this go to?? */ | 4979 | /* where did this go to?? */ |
| 4829 | if (limit_match == 0x00614100 || limit_match == 0x00614900) | 4980 | if ((entry[0] & 0xf0) == 0x80) |
| 4830 | pll_lim->refclk = 27000; | 4981 | pll_lim->refclk = 27000; |
| 4831 | else | 4982 | else |
| 4832 | pll_lim->refclk = 100000; | 4983 | pll_lim->refclk = 100000; |
| @@ -5852,7 +6003,7 @@ static void fabricate_vga_output(struct dcb_table *dcb, int i2c, int heads) | |||
| 5852 | entry->i2c_index = i2c; | 6003 | entry->i2c_index = i2c; |
| 5853 | entry->heads = heads; | 6004 | entry->heads = heads; |
| 5854 | entry->location = DCB_LOC_ON_CHIP; | 6005 | entry->location = DCB_LOC_ON_CHIP; |
| 5855 | /* "or" mostly unused in early gen crt modesetting, 0 is fine */ | 6006 | entry->or = 1; |
| 5856 | } | 6007 | } |
| 5857 | 6008 | ||
| 5858 | static void fabricate_dvi_i_output(struct dcb_table *dcb, bool twoHeads) | 6009 | static void fabricate_dvi_i_output(struct dcb_table *dcb, bool twoHeads) |
| @@ -5980,7 +6131,13 @@ parse_dcb20_entry(struct drm_device *dev, struct dcb_table *dcb, | |||
| 5980 | } | 6131 | } |
| 5981 | break; | 6132 | break; |
| 5982 | case OUTPUT_TMDS: | 6133 | case OUTPUT_TMDS: |
| 5983 | entry->tmdsconf.sor.link = (conf & 0x00000030) >> 4; | 6134 | if (dcb->version >= 0x40) |
| 6135 | entry->tmdsconf.sor.link = (conf & 0x00000030) >> 4; | ||
| 6136 | else if (dcb->version >= 0x30) | ||
| 6137 | entry->tmdsconf.slave_addr = (conf & 0x00000700) >> 8; | ||
| 6138 | else if (dcb->version >= 0x22) | ||
| 6139 | entry->tmdsconf.slave_addr = (conf & 0x00000070) >> 4; | ||
| 6140 | |||
| 5984 | break; | 6141 | break; |
| 5985 | case 0xe: | 6142 | case 0xe: |
| 5986 | /* weird g80 mobile type that "nv" treats as a terminator */ | 6143 | /* weird g80 mobile type that "nv" treats as a terminator */ |
| @@ -6270,6 +6427,19 @@ parse_dcb_table(struct drm_device *dev, struct nvbios *bios, bool twoHeads) | |||
| 6270 | dcb->i2c_table = &bios->data[i2ctabptr]; | 6427 | dcb->i2c_table = &bios->data[i2ctabptr]; |
| 6271 | if (dcb->version >= 0x30) | 6428 | if (dcb->version >= 0x30) |
| 6272 | dcb->i2c_default_indices = dcb->i2c_table[4]; | 6429 | dcb->i2c_default_indices = dcb->i2c_table[4]; |
| 6430 | |||
| 6431 | /* | ||
| 6432 | * Parse the "management" I2C bus, used for hardware | ||
| 6433 | * monitoring and some external TMDS transmitters. | ||
| 6434 | */ | ||
| 6435 | if (dcb->version >= 0x22) { | ||
| 6436 | int idx = (dcb->version >= 0x40 ? | ||
| 6437 | dcb->i2c_default_indices & 0xf : | ||
| 6438 | 2); | ||
| 6439 | |||
| 6440 | read_dcb_i2c_entry(dev, dcb->version, dcb->i2c_table, | ||
| 6441 | idx, &dcb->i2c[idx]); | ||
| 6442 | } | ||
| 6273 | } | 6443 | } |
| 6274 | 6444 | ||
| 6275 | if (entries > DCB_MAX_NUM_ENTRIES) | 6445 | if (entries > DCB_MAX_NUM_ENTRIES) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.h b/drivers/gpu/drm/nouveau/nouveau_bios.h index 024458a8d060..fd14dfd3d780 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.h +++ b/drivers/gpu/drm/nouveau/nouveau_bios.h | |||
| @@ -131,6 +131,7 @@ struct dcb_entry { | |||
| 131 | } dpconf; | 131 | } dpconf; |
| 132 | struct { | 132 | struct { |
| 133 | struct sor_conf sor; | 133 | struct sor_conf sor; |
| 134 | int slave_addr; | ||
| 134 | } tmdsconf; | 135 | } tmdsconf; |
| 135 | }; | 136 | }; |
| 136 | bool i2c_upper_default; | 137 | bool i2c_upper_default; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 3ca8343c15df..84f85183d041 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
| @@ -51,9 +51,6 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) | |||
| 51 | if (nvbo->tile) | 51 | if (nvbo->tile) |
| 52 | nv10_mem_expire_tiling(dev, nvbo->tile, NULL); | 52 | nv10_mem_expire_tiling(dev, nvbo->tile, NULL); |
| 53 | 53 | ||
| 54 | spin_lock(&dev_priv->ttm.bo_list_lock); | ||
| 55 | list_del(&nvbo->head); | ||
| 56 | spin_unlock(&dev_priv->ttm.bo_list_lock); | ||
| 57 | kfree(nvbo); | 54 | kfree(nvbo); |
| 58 | } | 55 | } |
| 59 | 56 | ||
| @@ -166,9 +163,6 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
| 166 | } | 163 | } |
| 167 | nvbo->channel = NULL; | 164 | nvbo->channel = NULL; |
| 168 | 165 | ||
| 169 | spin_lock(&dev_priv->ttm.bo_list_lock); | ||
| 170 | list_add_tail(&nvbo->head, &dev_priv->ttm.bo_list); | ||
| 171 | spin_unlock(&dev_priv->ttm.bo_list_lock); | ||
| 172 | *pnvbo = nvbo; | 166 | *pnvbo = nvbo; |
| 173 | return 0; | 167 | return 0; |
| 174 | } | 168 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 734e92635e83..b1b22baf1428 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
| @@ -37,12 +37,6 @@ | |||
| 37 | #include "nouveau_connector.h" | 37 | #include "nouveau_connector.h" |
| 38 | #include "nouveau_hw.h" | 38 | #include "nouveau_hw.h" |
| 39 | 39 | ||
| 40 | static inline struct drm_encoder_slave_funcs * | ||
| 41 | get_slave_funcs(struct nouveau_encoder *enc) | ||
| 42 | { | ||
| 43 | return to_encoder_slave(to_drm_encoder(enc))->slave_funcs; | ||
| 44 | } | ||
| 45 | |||
| 46 | static struct nouveau_encoder * | 40 | static struct nouveau_encoder * |
| 47 | find_encoder_by_type(struct drm_connector *connector, int type) | 41 | find_encoder_by_type(struct drm_connector *connector, int type) |
| 48 | { | 42 | { |
| @@ -360,6 +354,7 @@ nouveau_connector_set_property(struct drm_connector *connector, | |||
| 360 | { | 354 | { |
| 361 | struct nouveau_connector *nv_connector = nouveau_connector(connector); | 355 | struct nouveau_connector *nv_connector = nouveau_connector(connector); |
| 362 | struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; | 356 | struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; |
| 357 | struct drm_encoder *encoder = to_drm_encoder(nv_encoder); | ||
| 363 | struct drm_device *dev = connector->dev; | 358 | struct drm_device *dev = connector->dev; |
| 364 | int ret; | 359 | int ret; |
| 365 | 360 | ||
| @@ -432,8 +427,8 @@ nouveau_connector_set_property(struct drm_connector *connector, | |||
| 432 | } | 427 | } |
| 433 | 428 | ||
| 434 | if (nv_encoder && nv_encoder->dcb->type == OUTPUT_TV) | 429 | if (nv_encoder && nv_encoder->dcb->type == OUTPUT_TV) |
| 435 | return get_slave_funcs(nv_encoder)-> | 430 | return get_slave_funcs(encoder)->set_property( |
| 436 | set_property(to_drm_encoder(nv_encoder), connector, property, value); | 431 | encoder, connector, property, value); |
| 437 | 432 | ||
| 438 | return -EINVAL; | 433 | return -EINVAL; |
| 439 | } | 434 | } |
| @@ -545,6 +540,7 @@ nouveau_connector_get_modes(struct drm_connector *connector) | |||
| 545 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 540 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 546 | struct nouveau_connector *nv_connector = nouveau_connector(connector); | 541 | struct nouveau_connector *nv_connector = nouveau_connector(connector); |
| 547 | struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; | 542 | struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; |
| 543 | struct drm_encoder *encoder = to_drm_encoder(nv_encoder); | ||
| 548 | int ret = 0; | 544 | int ret = 0; |
| 549 | 545 | ||
| 550 | /* destroy the native mode, the attached monitor could have changed. | 546 | /* destroy the native mode, the attached monitor could have changed. |
| @@ -580,8 +576,7 @@ nouveau_connector_get_modes(struct drm_connector *connector) | |||
| 580 | } | 576 | } |
| 581 | 577 | ||
| 582 | if (nv_encoder->dcb->type == OUTPUT_TV) | 578 | if (nv_encoder->dcb->type == OUTPUT_TV) |
| 583 | ret = get_slave_funcs(nv_encoder)-> | 579 | ret = get_slave_funcs(encoder)->get_modes(encoder, connector); |
| 584 | get_modes(to_drm_encoder(nv_encoder), connector); | ||
| 585 | 580 | ||
| 586 | if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS || | 581 | if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS || |
| 587 | nv_connector->dcb->type == DCB_CONNECTOR_eDP) | 582 | nv_connector->dcb->type == DCB_CONNECTOR_eDP) |
| @@ -597,6 +592,7 @@ nouveau_connector_mode_valid(struct drm_connector *connector, | |||
| 597 | struct drm_nouveau_private *dev_priv = connector->dev->dev_private; | 592 | struct drm_nouveau_private *dev_priv = connector->dev->dev_private; |
| 598 | struct nouveau_connector *nv_connector = nouveau_connector(connector); | 593 | struct nouveau_connector *nv_connector = nouveau_connector(connector); |
| 599 | struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; | 594 | struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; |
| 595 | struct drm_encoder *encoder = to_drm_encoder(nv_encoder); | ||
| 600 | unsigned min_clock = 25000, max_clock = min_clock; | 596 | unsigned min_clock = 25000, max_clock = min_clock; |
| 601 | unsigned clock = mode->clock; | 597 | unsigned clock = mode->clock; |
| 602 | 598 | ||
| @@ -623,8 +619,7 @@ nouveau_connector_mode_valid(struct drm_connector *connector, | |||
| 623 | max_clock = 350000; | 619 | max_clock = 350000; |
| 624 | break; | 620 | break; |
| 625 | case OUTPUT_TV: | 621 | case OUTPUT_TV: |
| 626 | return get_slave_funcs(nv_encoder)-> | 622 | return get_slave_funcs(encoder)->mode_valid(encoder, mode); |
| 627 | mode_valid(to_drm_encoder(nv_encoder), mode); | ||
| 628 | case OUTPUT_DP: | 623 | case OUTPUT_DP: |
| 629 | if (nv_encoder->dp.link_bw == DP_LINK_BW_2_7) | 624 | if (nv_encoder->dp.link_bw == DP_LINK_BW_2_7) |
| 630 | max_clock = nv_encoder->dp.link_nr * 270000; | 625 | max_clock = nv_encoder->dp.link_nr * 270000; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 74e6b4ed12c0..2e11fd65b4dd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
| @@ -84,16 +84,16 @@ nouveau_user_framebuffer_create(struct drm_device *dev, | |||
| 84 | 84 | ||
| 85 | gem = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle); | 85 | gem = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle); |
| 86 | if (!gem) | 86 | if (!gem) |
| 87 | return NULL; | 87 | return ERR_PTR(-ENOENT); |
| 88 | 88 | ||
| 89 | nouveau_fb = kzalloc(sizeof(struct nouveau_framebuffer), GFP_KERNEL); | 89 | nouveau_fb = kzalloc(sizeof(struct nouveau_framebuffer), GFP_KERNEL); |
| 90 | if (!nouveau_fb) | 90 | if (!nouveau_fb) |
| 91 | return NULL; | 91 | return ERR_PTR(-ENOMEM); |
| 92 | 92 | ||
| 93 | ret = nouveau_framebuffer_init(dev, nouveau_fb, mode_cmd, nouveau_gem_object(gem)); | 93 | ret = nouveau_framebuffer_init(dev, nouveau_fb, mode_cmd, nouveau_gem_object(gem)); |
| 94 | if (ret) { | 94 | if (ret) { |
| 95 | drm_gem_object_unreference(gem); | 95 | drm_gem_object_unreference(gem); |
| 96 | return NULL; | 96 | return ERR_PTR(ret); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | return &nouveau_fb->base; | 99 | return &nouveau_fb->base; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c index 33742b11188b..8a1b188b4cd1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dp.c +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c | |||
| @@ -572,47 +572,64 @@ out: | |||
| 572 | return ret ? ret : (stat & NV50_AUXCH_STAT_REPLY); | 572 | return ret ? ret : (stat & NV50_AUXCH_STAT_REPLY); |
| 573 | } | 573 | } |
| 574 | 574 | ||
| 575 | int | 575 | static int |
| 576 | nouveau_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | 576 | nouveau_dp_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) |
| 577 | uint8_t write_byte, uint8_t *read_byte) | ||
| 578 | { | 577 | { |
| 579 | struct i2c_algo_dp_aux_data *algo_data = adapter->algo_data; | 578 | struct nouveau_i2c_chan *auxch = (struct nouveau_i2c_chan *)adap; |
| 580 | struct nouveau_i2c_chan *auxch = (struct nouveau_i2c_chan *)adapter; | ||
| 581 | struct drm_device *dev = auxch->dev; | 579 | struct drm_device *dev = auxch->dev; |
| 582 | int ret = 0, cmd, addr = algo_data->address; | 580 | struct i2c_msg *msg = msgs; |
| 583 | uint8_t *buf; | 581 | int ret, mcnt = num; |
| 584 | |||
| 585 | if (mode == MODE_I2C_READ) { | ||
| 586 | cmd = AUX_I2C_READ; | ||
| 587 | buf = read_byte; | ||
| 588 | } else { | ||
| 589 | cmd = (mode & MODE_I2C_READ) ? AUX_I2C_READ : AUX_I2C_WRITE; | ||
| 590 | buf = &write_byte; | ||
| 591 | } | ||
| 592 | 582 | ||
| 593 | if (!(mode & MODE_I2C_STOP)) | 583 | while (mcnt--) { |
| 594 | cmd |= AUX_I2C_MOT; | 584 | u8 remaining = msg->len; |
| 585 | u8 *ptr = msg->buf; | ||
| 595 | 586 | ||
| 596 | if (mode & MODE_I2C_START) | 587 | while (remaining) { |
| 597 | return 1; | 588 | u8 cnt = (remaining > 16) ? 16 : remaining; |
| 589 | u8 cmd; | ||
| 598 | 590 | ||
| 599 | for (;;) { | 591 | if (msg->flags & I2C_M_RD) |
| 600 | ret = nouveau_dp_auxch(auxch, cmd, addr, buf, 1); | 592 | cmd = AUX_I2C_READ; |
| 601 | if (ret < 0) | 593 | else |
| 602 | return ret; | 594 | cmd = AUX_I2C_WRITE; |
| 603 | 595 | ||
| 604 | switch (ret & NV50_AUXCH_STAT_REPLY_I2C) { | 596 | if (mcnt || remaining > 16) |
| 605 | case NV50_AUXCH_STAT_REPLY_I2C_ACK: | 597 | cmd |= AUX_I2C_MOT; |
| 606 | return 1; | 598 | |
| 607 | case NV50_AUXCH_STAT_REPLY_I2C_NACK: | 599 | ret = nouveau_dp_auxch(auxch, cmd, msg->addr, ptr, cnt); |
| 608 | return -EREMOTEIO; | 600 | if (ret < 0) |
| 609 | case NV50_AUXCH_STAT_REPLY_I2C_DEFER: | 601 | return ret; |
| 610 | udelay(100); | 602 | |
| 611 | break; | 603 | switch (ret & NV50_AUXCH_STAT_REPLY_I2C) { |
| 612 | default: | 604 | case NV50_AUXCH_STAT_REPLY_I2C_ACK: |
| 613 | NV_ERROR(dev, "invalid auxch status: 0x%08x\n", ret); | 605 | break; |
| 614 | return -EREMOTEIO; | 606 | case NV50_AUXCH_STAT_REPLY_I2C_NACK: |
| 607 | return -EREMOTEIO; | ||
| 608 | case NV50_AUXCH_STAT_REPLY_I2C_DEFER: | ||
| 609 | udelay(100); | ||
| 610 | continue; | ||
| 611 | default: | ||
| 612 | NV_ERROR(dev, "bad auxch reply: 0x%08x\n", ret); | ||
| 613 | return -EREMOTEIO; | ||
| 614 | } | ||
| 615 | |||
| 616 | ptr += cnt; | ||
| 617 | remaining -= cnt; | ||
| 615 | } | 618 | } |
| 619 | |||
| 620 | msg++; | ||
| 616 | } | 621 | } |
| 622 | |||
| 623 | return num; | ||
| 624 | } | ||
| 625 | |||
| 626 | static u32 | ||
| 627 | nouveau_dp_i2c_func(struct i2c_adapter *adap) | ||
| 628 | { | ||
| 629 | return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; | ||
| 617 | } | 630 | } |
| 618 | 631 | ||
| 632 | const struct i2c_algorithm nouveau_dp_i2c_algo = { | ||
| 633 | .master_xfer = nouveau_dp_i2c_xfer, | ||
| 634 | .functionality = nouveau_dp_i2c_func | ||
| 635 | }; | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index e15db15dca77..e424bf74d706 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
| @@ -410,7 +410,7 @@ enum nv04_fp_display_regs { | |||
| 410 | 410 | ||
| 411 | struct nv04_crtc_reg { | 411 | struct nv04_crtc_reg { |
| 412 | unsigned char MiscOutReg; /* */ | 412 | unsigned char MiscOutReg; /* */ |
| 413 | uint8_t CRTC[0x9f]; | 413 | uint8_t CRTC[0xa0]; |
| 414 | uint8_t CR58[0x10]; | 414 | uint8_t CR58[0x10]; |
| 415 | uint8_t Sequencer[5]; | 415 | uint8_t Sequencer[5]; |
| 416 | uint8_t Graphics[9]; | 416 | uint8_t Graphics[9]; |
| @@ -509,6 +509,7 @@ enum nouveau_card_type { | |||
| 509 | NV_30 = 0x30, | 509 | NV_30 = 0x30, |
| 510 | NV_40 = 0x40, | 510 | NV_40 = 0x40, |
| 511 | NV_50 = 0x50, | 511 | NV_50 = 0x50, |
| 512 | NV_C0 = 0xc0, | ||
| 512 | }; | 513 | }; |
| 513 | 514 | ||
| 514 | struct drm_nouveau_private { | 515 | struct drm_nouveau_private { |
| @@ -536,8 +537,6 @@ struct drm_nouveau_private { | |||
| 536 | struct drm_global_reference mem_global_ref; | 537 | struct drm_global_reference mem_global_ref; |
| 537 | struct ttm_bo_global_ref bo_global_ref; | 538 | struct ttm_bo_global_ref bo_global_ref; |
| 538 | struct ttm_bo_device bdev; | 539 | struct ttm_bo_device bdev; |
| 539 | spinlock_t bo_list_lock; | ||
| 540 | struct list_head bo_list; | ||
| 541 | atomic_t validate_sequence; | 540 | atomic_t validate_sequence; |
| 542 | } ttm; | 541 | } ttm; |
| 543 | 542 | ||
| @@ -931,6 +930,10 @@ extern void nv40_fb_set_region_tiling(struct drm_device *, int, uint32_t, | |||
| 931 | extern int nv50_fb_init(struct drm_device *); | 930 | extern int nv50_fb_init(struct drm_device *); |
| 932 | extern void nv50_fb_takedown(struct drm_device *); | 931 | extern void nv50_fb_takedown(struct drm_device *); |
| 933 | 932 | ||
| 933 | /* nvc0_fb.c */ | ||
| 934 | extern int nvc0_fb_init(struct drm_device *); | ||
| 935 | extern void nvc0_fb_takedown(struct drm_device *); | ||
| 936 | |||
| 934 | /* nv04_fifo.c */ | 937 | /* nv04_fifo.c */ |
| 935 | extern int nv04_fifo_init(struct drm_device *); | 938 | extern int nv04_fifo_init(struct drm_device *); |
| 936 | extern void nv04_fifo_disable(struct drm_device *); | 939 | extern void nv04_fifo_disable(struct drm_device *); |
| @@ -968,6 +971,20 @@ extern void nv50_fifo_destroy_context(struct nouveau_channel *); | |||
| 968 | extern int nv50_fifo_load_context(struct nouveau_channel *); | 971 | extern int nv50_fifo_load_context(struct nouveau_channel *); |
| 969 | extern int nv50_fifo_unload_context(struct drm_device *); | 972 | extern int nv50_fifo_unload_context(struct drm_device *); |
| 970 | 973 | ||
| 974 | /* nvc0_fifo.c */ | ||
| 975 | extern int nvc0_fifo_init(struct drm_device *); | ||
| 976 | extern void nvc0_fifo_takedown(struct drm_device *); | ||
| 977 | extern void nvc0_fifo_disable(struct drm_device *); | ||
| 978 | extern void nvc0_fifo_enable(struct drm_device *); | ||
| 979 | extern bool nvc0_fifo_reassign(struct drm_device *, bool); | ||
| 980 | extern bool nvc0_fifo_cache_flush(struct drm_device *); | ||
| 981 | extern bool nvc0_fifo_cache_pull(struct drm_device *, bool); | ||
| 982 | extern int nvc0_fifo_channel_id(struct drm_device *); | ||
| 983 | extern int nvc0_fifo_create_context(struct nouveau_channel *); | ||
| 984 | extern void nvc0_fifo_destroy_context(struct nouveau_channel *); | ||
| 985 | extern int nvc0_fifo_load_context(struct nouveau_channel *); | ||
| 986 | extern int nvc0_fifo_unload_context(struct drm_device *); | ||
| 987 | |||
| 971 | /* nv04_graph.c */ | 988 | /* nv04_graph.c */ |
| 972 | extern struct nouveau_pgraph_object_class nv04_graph_grclass[]; | 989 | extern struct nouveau_pgraph_object_class nv04_graph_grclass[]; |
| 973 | extern int nv04_graph_init(struct drm_device *); | 990 | extern int nv04_graph_init(struct drm_device *); |
| @@ -1032,6 +1049,16 @@ extern int nv50_graph_unload_context(struct drm_device *); | |||
| 1032 | extern void nv50_graph_context_switch(struct drm_device *); | 1049 | extern void nv50_graph_context_switch(struct drm_device *); |
| 1033 | extern int nv50_grctx_init(struct nouveau_grctx *); | 1050 | extern int nv50_grctx_init(struct nouveau_grctx *); |
| 1034 | 1051 | ||
| 1052 | /* nvc0_graph.c */ | ||
| 1053 | extern int nvc0_graph_init(struct drm_device *); | ||
| 1054 | extern void nvc0_graph_takedown(struct drm_device *); | ||
| 1055 | extern void nvc0_graph_fifo_access(struct drm_device *, bool); | ||
| 1056 | extern struct nouveau_channel *nvc0_graph_channel(struct drm_device *); | ||
| 1057 | extern int nvc0_graph_create_context(struct nouveau_channel *); | ||
| 1058 | extern void nvc0_graph_destroy_context(struct nouveau_channel *); | ||
| 1059 | extern int nvc0_graph_load_context(struct nouveau_channel *); | ||
| 1060 | extern int nvc0_graph_unload_context(struct drm_device *); | ||
| 1061 | |||
| 1035 | /* nv04_instmem.c */ | 1062 | /* nv04_instmem.c */ |
| 1036 | extern int nv04_instmem_init(struct drm_device *); | 1063 | extern int nv04_instmem_init(struct drm_device *); |
| 1037 | extern void nv04_instmem_takedown(struct drm_device *); | 1064 | extern void nv04_instmem_takedown(struct drm_device *); |
| @@ -1058,6 +1085,18 @@ extern void nv50_instmem_flush(struct drm_device *); | |||
| 1058 | extern void nv84_instmem_flush(struct drm_device *); | 1085 | extern void nv84_instmem_flush(struct drm_device *); |
| 1059 | extern void nv50_vm_flush(struct drm_device *, int engine); | 1086 | extern void nv50_vm_flush(struct drm_device *, int engine); |
| 1060 | 1087 | ||
| 1088 | /* nvc0_instmem.c */ | ||
| 1089 | extern int nvc0_instmem_init(struct drm_device *); | ||
| 1090 | extern void nvc0_instmem_takedown(struct drm_device *); | ||
| 1091 | extern int nvc0_instmem_suspend(struct drm_device *); | ||
| 1092 | extern void nvc0_instmem_resume(struct drm_device *); | ||
| 1093 | extern int nvc0_instmem_populate(struct drm_device *, struct nouveau_gpuobj *, | ||
| 1094 | uint32_t *size); | ||
| 1095 | extern void nvc0_instmem_clear(struct drm_device *, struct nouveau_gpuobj *); | ||
| 1096 | extern int nvc0_instmem_bind(struct drm_device *, struct nouveau_gpuobj *); | ||
| 1097 | extern int nvc0_instmem_unbind(struct drm_device *, struct nouveau_gpuobj *); | ||
| 1098 | extern void nvc0_instmem_flush(struct drm_device *); | ||
| 1099 | |||
| 1061 | /* nv04_mc.c */ | 1100 | /* nv04_mc.c */ |
| 1062 | extern int nv04_mc_init(struct drm_device *); | 1101 | extern int nv04_mc_init(struct drm_device *); |
| 1063 | extern void nv04_mc_takedown(struct drm_device *); | 1102 | extern void nv04_mc_takedown(struct drm_device *); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_encoder.h b/drivers/gpu/drm/nouveau/nouveau_encoder.h index a1a0d48ae70c..7c82d68bc155 100644 --- a/drivers/gpu/drm/nouveau/nouveau_encoder.h +++ b/drivers/gpu/drm/nouveau/nouveau_encoder.h | |||
| @@ -71,6 +71,12 @@ static inline struct drm_encoder *to_drm_encoder(struct nouveau_encoder *enc) | |||
| 71 | return &enc->base.base; | 71 | return &enc->base.base; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | static inline struct drm_encoder_slave_funcs * | ||
| 75 | get_slave_funcs(struct drm_encoder *enc) | ||
| 76 | { | ||
| 77 | return to_encoder_slave(enc)->slave_funcs; | ||
| 78 | } | ||
| 79 | |||
| 74 | struct nouveau_connector * | 80 | struct nouveau_connector * |
| 75 | nouveau_encoder_connector_get(struct nouveau_encoder *encoder); | 81 | nouveau_encoder_connector_get(struct nouveau_encoder *encoder); |
| 76 | int nv50_sor_create(struct drm_connector *, struct dcb_entry *); | 82 | int nv50_sor_create(struct drm_connector *, struct dcb_entry *); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 099f637264aa..dbd30b2e43fd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
| @@ -281,6 +281,8 @@ nouveau_fbcon_create(struct nouveau_fbdev *nfbdev, | |||
| 281 | 281 | ||
| 282 | if (dev_priv->channel && !nouveau_nofbaccel) { | 282 | if (dev_priv->channel && !nouveau_nofbaccel) { |
| 283 | switch (dev_priv->card_type) { | 283 | switch (dev_priv->card_type) { |
| 284 | case NV_C0: | ||
| 285 | break; | ||
| 284 | case NV_50: | 286 | case NV_50: |
| 285 | nv50_fbcon_accel_init(info); | 287 | nv50_fbcon_accel_init(info); |
| 286 | info->fbops = &nv50_fbcon_ops; | 288 | info->fbops = &nv50_fbcon_ops; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 547f2c24c1e7..0f417ac1b696 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
| @@ -284,7 +284,7 @@ retry: | |||
| 284 | if (!gem) { | 284 | if (!gem) { |
| 285 | NV_ERROR(dev, "Unknown handle 0x%08x\n", b->handle); | 285 | NV_ERROR(dev, "Unknown handle 0x%08x\n", b->handle); |
| 286 | validate_fini(op, NULL); | 286 | validate_fini(op, NULL); |
| 287 | return -EINVAL; | 287 | return -ENOENT; |
| 288 | } | 288 | } |
| 289 | nvbo = gem->driver_private; | 289 | nvbo = gem->driver_private; |
| 290 | 290 | ||
| @@ -759,7 +759,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data, | |||
| 759 | 759 | ||
| 760 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); | 760 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); |
| 761 | if (!gem) | 761 | if (!gem) |
| 762 | return ret; | 762 | return -ENOENT; |
| 763 | nvbo = nouveau_gem_object(gem); | 763 | nvbo = nouveau_gem_object(gem); |
| 764 | 764 | ||
| 765 | if (nvbo->cpu_filp) { | 765 | if (nvbo->cpu_filp) { |
| @@ -797,7 +797,7 @@ nouveau_gem_ioctl_cpu_fini(struct drm_device *dev, void *data, | |||
| 797 | 797 | ||
| 798 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); | 798 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); |
| 799 | if (!gem) | 799 | if (!gem) |
| 800 | return ret; | 800 | return -ENOENT; |
| 801 | nvbo = nouveau_gem_object(gem); | 801 | nvbo = nouveau_gem_object(gem); |
| 802 | 802 | ||
| 803 | if (nvbo->cpu_filp != file_priv) | 803 | if (nvbo->cpu_filp != file_priv) |
| @@ -822,7 +822,7 @@ nouveau_gem_ioctl_info(struct drm_device *dev, void *data, | |||
| 822 | 822 | ||
| 823 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); | 823 | gem = drm_gem_object_lookup(dev, file_priv, req->handle); |
| 824 | if (!gem) | 824 | if (!gem) |
| 825 | return -EINVAL; | 825 | return -ENOENT; |
| 826 | 826 | ||
| 827 | ret = nouveau_gem_info(gem, req); | 827 | ret = nouveau_gem_info(gem, req); |
| 828 | drm_gem_object_unreference_unlocked(gem); | 828 | drm_gem_object_unreference_unlocked(gem); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_hw.c b/drivers/gpu/drm/nouveau/nouveau_hw.c index 7855b35effc3..7b613682e400 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hw.c +++ b/drivers/gpu/drm/nouveau/nouveau_hw.c | |||
| @@ -865,8 +865,12 @@ nv_save_state_ext(struct drm_device *dev, int head, | |||
| 865 | rd_cio_state(dev, head, regp, NV_CIO_CRE_FF_INDEX); | 865 | rd_cio_state(dev, head, regp, NV_CIO_CRE_FF_INDEX); |
| 866 | rd_cio_state(dev, head, regp, NV_CIO_CRE_FFLWM__INDEX); | 866 | rd_cio_state(dev, head, regp, NV_CIO_CRE_FFLWM__INDEX); |
| 867 | rd_cio_state(dev, head, regp, NV_CIO_CRE_21); | 867 | rd_cio_state(dev, head, regp, NV_CIO_CRE_21); |
| 868 | if (dev_priv->card_type >= NV_30) | 868 | |
| 869 | if (dev_priv->card_type >= NV_30) { | ||
| 869 | rd_cio_state(dev, head, regp, NV_CIO_CRE_47); | 870 | rd_cio_state(dev, head, regp, NV_CIO_CRE_47); |
| 871 | rd_cio_state(dev, head, regp, 0x9f); | ||
| 872 | } | ||
| 873 | |||
| 870 | rd_cio_state(dev, head, regp, NV_CIO_CRE_49); | 874 | rd_cio_state(dev, head, regp, NV_CIO_CRE_49); |
| 871 | rd_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR0_INDEX); | 875 | rd_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR0_INDEX); |
| 872 | rd_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR1_INDEX); | 876 | rd_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR1_INDEX); |
| @@ -971,8 +975,11 @@ nv_load_state_ext(struct drm_device *dev, int head, | |||
| 971 | wr_cio_state(dev, head, regp, NV_CIO_CRE_ENH_INDEX); | 975 | wr_cio_state(dev, head, regp, NV_CIO_CRE_ENH_INDEX); |
| 972 | wr_cio_state(dev, head, regp, NV_CIO_CRE_FF_INDEX); | 976 | wr_cio_state(dev, head, regp, NV_CIO_CRE_FF_INDEX); |
| 973 | wr_cio_state(dev, head, regp, NV_CIO_CRE_FFLWM__INDEX); | 977 | wr_cio_state(dev, head, regp, NV_CIO_CRE_FFLWM__INDEX); |
| 974 | if (dev_priv->card_type >= NV_30) | 978 | |
| 979 | if (dev_priv->card_type >= NV_30) { | ||
| 975 | wr_cio_state(dev, head, regp, NV_CIO_CRE_47); | 980 | wr_cio_state(dev, head, regp, NV_CIO_CRE_47); |
| 981 | wr_cio_state(dev, head, regp, 0x9f); | ||
| 982 | } | ||
| 976 | 983 | ||
| 977 | wr_cio_state(dev, head, regp, NV_CIO_CRE_49); | 984 | wr_cio_state(dev, head, regp, NV_CIO_CRE_49); |
| 978 | wr_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR0_INDEX); | 985 | wr_cio_state(dev, head, regp, NV_CIO_CRE_HCUR_ADDR0_INDEX); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_i2c.c b/drivers/gpu/drm/nouveau/nouveau_i2c.c index cb0cb34440c6..0bd407ca3d42 100644 --- a/drivers/gpu/drm/nouveau/nouveau_i2c.c +++ b/drivers/gpu/drm/nouveau/nouveau_i2c.c | |||
| @@ -163,7 +163,7 @@ nouveau_i2c_init(struct drm_device *dev, struct dcb_i2c_entry *entry, int index) | |||
| 163 | if (entry->chan) | 163 | if (entry->chan) |
| 164 | return -EEXIST; | 164 | return -EEXIST; |
| 165 | 165 | ||
| 166 | if (dev_priv->card_type == NV_50 && entry->read >= NV50_I2C_PORTS) { | 166 | if (dev_priv->card_type == NV_C0 && entry->read >= NV50_I2C_PORTS) { |
| 167 | NV_ERROR(dev, "unknown i2c port %d\n", entry->read); | 167 | NV_ERROR(dev, "unknown i2c port %d\n", entry->read); |
| 168 | return -EINVAL; | 168 | return -EINVAL; |
| 169 | } | 169 | } |
| @@ -174,26 +174,26 @@ nouveau_i2c_init(struct drm_device *dev, struct dcb_i2c_entry *entry, int index) | |||
| 174 | 174 | ||
| 175 | switch (entry->port_type) { | 175 | switch (entry->port_type) { |
| 176 | case 0: | 176 | case 0: |
| 177 | i2c->algo.bit.setsda = nv04_i2c_setsda; | 177 | i2c->bit.setsda = nv04_i2c_setsda; |
| 178 | i2c->algo.bit.setscl = nv04_i2c_setscl; | 178 | i2c->bit.setscl = nv04_i2c_setscl; |
| 179 | i2c->algo.bit.getsda = nv04_i2c_getsda; | 179 | i2c->bit.getsda = nv04_i2c_getsda; |
| 180 | i2c->algo.bit.getscl = nv04_i2c_getscl; | 180 | i2c->bit.getscl = nv04_i2c_getscl; |
| 181 | i2c->rd = entry->read; | 181 | i2c->rd = entry->read; |
| 182 | i2c->wr = entry->write; | 182 | i2c->wr = entry->write; |
| 183 | break; | 183 | break; |
| 184 | case 4: | 184 | case 4: |
| 185 | i2c->algo.bit.setsda = nv4e_i2c_setsda; | 185 | i2c->bit.setsda = nv4e_i2c_setsda; |
| 186 | i2c->algo.bit.setscl = nv4e_i2c_setscl; | 186 | i2c->bit.setscl = nv4e_i2c_setscl; |
| 187 | i2c->algo.bit.getsda = nv4e_i2c_getsda; | 187 | i2c->bit.getsda = nv4e_i2c_getsda; |
| 188 | i2c->algo.bit.getscl = nv4e_i2c_getscl; | 188 | i2c->bit.getscl = nv4e_i2c_getscl; |
| 189 | i2c->rd = 0x600800 + entry->read; | 189 | i2c->rd = 0x600800 + entry->read; |
| 190 | i2c->wr = 0x600800 + entry->write; | 190 | i2c->wr = 0x600800 + entry->write; |
| 191 | break; | 191 | break; |
| 192 | case 5: | 192 | case 5: |
| 193 | i2c->algo.bit.setsda = nv50_i2c_setsda; | 193 | i2c->bit.setsda = nv50_i2c_setsda; |
| 194 | i2c->algo.bit.setscl = nv50_i2c_setscl; | 194 | i2c->bit.setscl = nv50_i2c_setscl; |
| 195 | i2c->algo.bit.getsda = nv50_i2c_getsda; | 195 | i2c->bit.getsda = nv50_i2c_getsda; |
| 196 | i2c->algo.bit.getscl = nv50_i2c_getscl; | 196 | i2c->bit.getscl = nv50_i2c_getscl; |
| 197 | i2c->rd = nv50_i2c_port[entry->read]; | 197 | i2c->rd = nv50_i2c_port[entry->read]; |
| 198 | i2c->wr = i2c->rd; | 198 | i2c->wr = i2c->rd; |
| 199 | break; | 199 | break; |
| @@ -216,17 +216,14 @@ nouveau_i2c_init(struct drm_device *dev, struct dcb_i2c_entry *entry, int index) | |||
| 216 | i2c_set_adapdata(&i2c->adapter, i2c); | 216 | i2c_set_adapdata(&i2c->adapter, i2c); |
| 217 | 217 | ||
| 218 | if (entry->port_type < 6) { | 218 | if (entry->port_type < 6) { |
| 219 | i2c->adapter.algo_data = &i2c->algo.bit; | 219 | i2c->adapter.algo_data = &i2c->bit; |
| 220 | i2c->algo.bit.udelay = 40; | 220 | i2c->bit.udelay = 40; |
| 221 | i2c->algo.bit.timeout = usecs_to_jiffies(5000); | 221 | i2c->bit.timeout = usecs_to_jiffies(5000); |
| 222 | i2c->algo.bit.data = i2c; | 222 | i2c->bit.data = i2c; |
| 223 | ret = i2c_bit_add_bus(&i2c->adapter); | 223 | ret = i2c_bit_add_bus(&i2c->adapter); |
| 224 | } else { | 224 | } else { |
| 225 | i2c->adapter.algo_data = &i2c->algo.dp; | 225 | i2c->adapter.algo = &nouveau_dp_i2c_algo; |
| 226 | i2c->algo.dp.running = false; | 226 | ret = i2c_add_adapter(&i2c->adapter); |
| 227 | i2c->algo.dp.address = 0; | ||
| 228 | i2c->algo.dp.aux_ch = nouveau_dp_i2c_aux_ch; | ||
| 229 | ret = i2c_dp_aux_add_bus(&i2c->adapter); | ||
| 230 | } | 227 | } |
| 231 | 228 | ||
| 232 | if (ret) { | 229 | if (ret) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_i2c.h b/drivers/gpu/drm/nouveau/nouveau_i2c.h index 6dd2f8713cd1..f71cb32f7571 100644 --- a/drivers/gpu/drm/nouveau/nouveau_i2c.h +++ b/drivers/gpu/drm/nouveau/nouveau_i2c.h | |||
| @@ -33,10 +33,7 @@ struct dcb_i2c_entry; | |||
| 33 | struct nouveau_i2c_chan { | 33 | struct nouveau_i2c_chan { |
| 34 | struct i2c_adapter adapter; | 34 | struct i2c_adapter adapter; |
| 35 | struct drm_device *dev; | 35 | struct drm_device *dev; |
| 36 | union { | 36 | struct i2c_algo_bit_data bit; |
| 37 | struct i2c_algo_bit_data bit; | ||
| 38 | struct i2c_algo_dp_aux_data dp; | ||
| 39 | } algo; | ||
| 40 | unsigned rd; | 37 | unsigned rd; |
| 41 | unsigned wr; | 38 | unsigned wr; |
| 42 | unsigned data; | 39 | unsigned data; |
| @@ -49,7 +46,6 @@ bool nouveau_probe_i2c_addr(struct nouveau_i2c_chan *i2c, int addr); | |||
| 49 | int nouveau_i2c_identify(struct drm_device *dev, const char *what, | 46 | int nouveau_i2c_identify(struct drm_device *dev, const char *what, |
| 50 | struct i2c_board_info *info, int index); | 47 | struct i2c_board_info *info, int index); |
| 51 | 48 | ||
| 52 | int nouveau_dp_i2c_aux_ch(struct i2c_adapter *, int mode, uint8_t write_byte, | 49 | extern const struct i2c_algorithm nouveau_dp_i2c_algo; |
| 53 | uint8_t *read_byte); | ||
| 54 | 50 | ||
| 55 | #endif /* __NOUVEAU_I2C_H__ */ | 51 | #endif /* __NOUVEAU_I2C_H__ */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c index 53360f156063..794b0ee30cf6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_irq.c +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c | |||
| @@ -49,7 +49,7 @@ nouveau_irq_preinstall(struct drm_device *dev) | |||
| 49 | /* Master disable */ | 49 | /* Master disable */ |
| 50 | nv_wr32(dev, NV03_PMC_INTR_EN_0, 0); | 50 | nv_wr32(dev, NV03_PMC_INTR_EN_0, 0); |
| 51 | 51 | ||
| 52 | if (dev_priv->card_type == NV_50) { | 52 | if (dev_priv->card_type >= NV_50) { |
| 53 | INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh); | 53 | INIT_WORK(&dev_priv->irq_work, nv50_display_irq_handler_bh); |
| 54 | INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh); | 54 | INIT_WORK(&dev_priv->hpd_work, nv50_display_irq_hotplug_bh); |
| 55 | INIT_LIST_HEAD(&dev_priv->vbl_waiting); | 55 | INIT_LIST_HEAD(&dev_priv->vbl_waiting); |
| @@ -586,11 +586,11 @@ nouveau_pgraph_irq_handler(struct drm_device *dev) | |||
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | if (status & NV_PGRAPH_INTR_CONTEXT_SWITCH) { | 588 | if (status & NV_PGRAPH_INTR_CONTEXT_SWITCH) { |
| 589 | nouveau_pgraph_intr_context_switch(dev); | ||
| 590 | |||
| 591 | status &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH; | 589 | status &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH; |
| 592 | nv_wr32(dev, NV03_PGRAPH_INTR, | 590 | nv_wr32(dev, NV03_PGRAPH_INTR, |
| 593 | NV_PGRAPH_INTR_CONTEXT_SWITCH); | 591 | NV_PGRAPH_INTR_CONTEXT_SWITCH); |
| 592 | |||
| 593 | nouveau_pgraph_intr_context_switch(dev); | ||
| 594 | } | 594 | } |
| 595 | 595 | ||
| 596 | if (status) { | 596 | if (status) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index a9f36ab256b7..9689d4147686 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
| @@ -320,7 +320,8 @@ nouveau_mem_detect(struct drm_device *dev) | |||
| 320 | if (dev_priv->card_type < NV_50) { | 320 | if (dev_priv->card_type < NV_50) { |
| 321 | dev_priv->vram_size = nv_rd32(dev, NV04_PFB_FIFO_DATA); | 321 | dev_priv->vram_size = nv_rd32(dev, NV04_PFB_FIFO_DATA); |
| 322 | dev_priv->vram_size &= NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK; | 322 | dev_priv->vram_size &= NV10_PFB_FIFO_DATA_RAM_AMOUNT_MB_MASK; |
| 323 | } else { | 323 | } else |
| 324 | if (dev_priv->card_type < NV_C0) { | ||
| 324 | dev_priv->vram_size = nv_rd32(dev, NV04_PFB_FIFO_DATA); | 325 | dev_priv->vram_size = nv_rd32(dev, NV04_PFB_FIFO_DATA); |
| 325 | dev_priv->vram_size |= (dev_priv->vram_size & 0xff) << 32; | 326 | dev_priv->vram_size |= (dev_priv->vram_size & 0xff) << 32; |
| 326 | dev_priv->vram_size &= 0xffffffff00ll; | 327 | dev_priv->vram_size &= 0xffffffff00ll; |
| @@ -328,6 +329,9 @@ nouveau_mem_detect(struct drm_device *dev) | |||
| 328 | dev_priv->vram_sys_base = nv_rd32(dev, 0x100e10); | 329 | dev_priv->vram_sys_base = nv_rd32(dev, 0x100e10); |
| 329 | dev_priv->vram_sys_base <<= 12; | 330 | dev_priv->vram_sys_base <<= 12; |
| 330 | } | 331 | } |
| 332 | } else { | ||
| 333 | dev_priv->vram_size = nv_rd32(dev, 0x10f20c) << 20; | ||
| 334 | dev_priv->vram_size *= nv_rd32(dev, 0x121c74); | ||
| 331 | } | 335 | } |
| 332 | 336 | ||
| 333 | NV_INFO(dev, "Detected %dMiB VRAM\n", (int)(dev_priv->vram_size >> 20)); | 337 | NV_INFO(dev, "Detected %dMiB VRAM\n", (int)(dev_priv->vram_size >> 20)); |
| @@ -351,7 +355,7 @@ nouveau_mem_reset_agp(struct drm_device *dev) | |||
| 351 | /* First of all, disable fast writes, otherwise if it's | 355 | /* First of all, disable fast writes, otherwise if it's |
| 352 | * already enabled in the AGP bridge and we disable the card's | 356 | * already enabled in the AGP bridge and we disable the card's |
| 353 | * AGP controller we might be locking ourselves out of it. */ | 357 | * AGP controller we might be locking ourselves out of it. */ |
| 354 | if (dev->agp->acquired) { | 358 | if (nv_rd32(dev, NV04_PBUS_PCI_NV_19) & PCI_AGP_COMMAND_FW) { |
| 355 | struct drm_agp_info info; | 359 | struct drm_agp_info info; |
| 356 | struct drm_agp_mode mode; | 360 | struct drm_agp_mode mode; |
| 357 | 361 | ||
| @@ -359,7 +363,7 @@ nouveau_mem_reset_agp(struct drm_device *dev) | |||
| 359 | if (ret) | 363 | if (ret) |
| 360 | return ret; | 364 | return ret; |
| 361 | 365 | ||
| 362 | mode.mode = info.mode & ~0x10; | 366 | mode.mode = info.mode & ~PCI_AGP_COMMAND_FW; |
| 363 | ret = drm_agp_enable(dev, mode); | 367 | ret = drm_agp_enable(dev, mode); |
| 364 | if (ret) | 368 | if (ret) |
| 365 | return ret; | 369 | return ret; |
| @@ -405,6 +409,8 @@ nouveau_mem_init_agp(struct drm_device *dev) | |||
| 405 | } | 409 | } |
| 406 | } | 410 | } |
| 407 | 411 | ||
| 412 | nouveau_mem_reset_agp(dev); | ||
| 413 | |||
| 408 | ret = drm_agp_info(dev, &info); | 414 | ret = drm_agp_info(dev, &info); |
| 409 | if (ret) { | 415 | if (ret) { |
| 410 | NV_ERROR(dev, "Unable to get AGP info: %d\n", ret); | 416 | NV_ERROR(dev, "Unable to get AGP info: %d\n", ret); |
| @@ -459,8 +465,6 @@ nouveau_mem_init(struct drm_device *dev) | |||
| 459 | return ret; | 465 | return ret; |
| 460 | } | 466 | } |
| 461 | 467 | ||
| 462 | INIT_LIST_HEAD(&dev_priv->ttm.bo_list); | ||
| 463 | spin_lock_init(&dev_priv->ttm.bo_list_lock); | ||
| 464 | spin_lock_init(&dev_priv->tile.lock); | 468 | spin_lock_init(&dev_priv->tile.lock); |
| 465 | 469 | ||
| 466 | dev_priv->fb_available_size = dev_priv->vram_size; | 470 | dev_priv->fb_available_size = dev_priv->vram_size; |
| @@ -494,7 +498,6 @@ nouveau_mem_init(struct drm_device *dev) | |||
| 494 | /* GART */ | 498 | /* GART */ |
| 495 | #if !defined(__powerpc__) && !defined(__ia64__) | 499 | #if !defined(__powerpc__) && !defined(__ia64__) |
| 496 | if (drm_device_is_agp(dev) && dev->agp && !nouveau_noagp) { | 500 | if (drm_device_is_agp(dev) && dev->agp && !nouveau_noagp) { |
| 497 | nouveau_mem_reset_agp(dev); | ||
| 498 | ret = nouveau_mem_init_agp(dev); | 501 | ret = nouveau_mem_init_agp(dev); |
| 499 | if (ret) | 502 | if (ret) |
| 500 | NV_ERROR(dev, "Error initialising AGP: %d\n", ret); | 503 | NV_ERROR(dev, "Error initialising AGP: %d\n", ret); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_reg.h b/drivers/gpu/drm/nouveau/nouveau_reg.h index 9c1056cb8a90..21a6e453b975 100644 --- a/drivers/gpu/drm/nouveau/nouveau_reg.h +++ b/drivers/gpu/drm/nouveau/nouveau_reg.h | |||
| @@ -220,28 +220,21 @@ | |||
| 220 | # define NV_PGRAPH_INTR_ERROR (1<<20) | 220 | # define NV_PGRAPH_INTR_ERROR (1<<20) |
| 221 | #define NV10_PGRAPH_CTX_CONTROL 0x00400144 | 221 | #define NV10_PGRAPH_CTX_CONTROL 0x00400144 |
| 222 | #define NV10_PGRAPH_CTX_USER 0x00400148 | 222 | #define NV10_PGRAPH_CTX_USER 0x00400148 |
| 223 | #define NV10_PGRAPH_CTX_SWITCH1 0x0040014C | 223 | #define NV10_PGRAPH_CTX_SWITCH(i) (0x0040014C + 0x4*(i)) |
| 224 | #define NV10_PGRAPH_CTX_SWITCH2 0x00400150 | ||
| 225 | #define NV10_PGRAPH_CTX_SWITCH3 0x00400154 | ||
| 226 | #define NV10_PGRAPH_CTX_SWITCH4 0x00400158 | ||
| 227 | #define NV10_PGRAPH_CTX_SWITCH5 0x0040015C | ||
| 228 | #define NV04_PGRAPH_CTX_SWITCH1 0x00400160 | 224 | #define NV04_PGRAPH_CTX_SWITCH1 0x00400160 |
| 229 | #define NV10_PGRAPH_CTX_CACHE1 0x00400160 | 225 | #define NV10_PGRAPH_CTX_CACHE(i, j) (0x00400160 \ |
| 226 | + 0x4*(i) + 0x20*(j)) | ||
| 230 | #define NV04_PGRAPH_CTX_SWITCH2 0x00400164 | 227 | #define NV04_PGRAPH_CTX_SWITCH2 0x00400164 |
| 231 | #define NV04_PGRAPH_CTX_SWITCH3 0x00400168 | 228 | #define NV04_PGRAPH_CTX_SWITCH3 0x00400168 |
| 232 | #define NV04_PGRAPH_CTX_SWITCH4 0x0040016C | 229 | #define NV04_PGRAPH_CTX_SWITCH4 0x0040016C |
| 233 | #define NV04_PGRAPH_CTX_CONTROL 0x00400170 | 230 | #define NV04_PGRAPH_CTX_CONTROL 0x00400170 |
| 234 | #define NV04_PGRAPH_CTX_USER 0x00400174 | 231 | #define NV04_PGRAPH_CTX_USER 0x00400174 |
| 235 | #define NV04_PGRAPH_CTX_CACHE1 0x00400180 | 232 | #define NV04_PGRAPH_CTX_CACHE1 0x00400180 |
| 236 | #define NV10_PGRAPH_CTX_CACHE2 0x00400180 | ||
| 237 | #define NV03_PGRAPH_CTX_CONTROL 0x00400190 | 233 | #define NV03_PGRAPH_CTX_CONTROL 0x00400190 |
| 238 | #define NV03_PGRAPH_CTX_USER 0x00400194 | 234 | #define NV03_PGRAPH_CTX_USER 0x00400194 |
| 239 | #define NV04_PGRAPH_CTX_CACHE2 0x004001A0 | 235 | #define NV04_PGRAPH_CTX_CACHE2 0x004001A0 |
| 240 | #define NV10_PGRAPH_CTX_CACHE3 0x004001A0 | ||
| 241 | #define NV04_PGRAPH_CTX_CACHE3 0x004001C0 | 236 | #define NV04_PGRAPH_CTX_CACHE3 0x004001C0 |
| 242 | #define NV10_PGRAPH_CTX_CACHE4 0x004001C0 | ||
| 243 | #define NV04_PGRAPH_CTX_CACHE4 0x004001E0 | 237 | #define NV04_PGRAPH_CTX_CACHE4 0x004001E0 |
| 244 | #define NV10_PGRAPH_CTX_CACHE5 0x004001E0 | ||
| 245 | #define NV40_PGRAPH_CTXCTL_0304 0x00400304 | 238 | #define NV40_PGRAPH_CTXCTL_0304 0x00400304 |
| 246 | #define NV40_PGRAPH_CTXCTL_0304_XFER_CTX 0x00000001 | 239 | #define NV40_PGRAPH_CTXCTL_0304_XFER_CTX 0x00000001 |
| 247 | #define NV40_PGRAPH_CTXCTL_UCODE_STAT 0x00400308 | 240 | #define NV40_PGRAPH_CTXCTL_UCODE_STAT 0x00400308 |
| @@ -356,9 +349,12 @@ | |||
| 356 | #define NV04_PGRAPH_FFINTFC_ST2 0x00400754 | 349 | #define NV04_PGRAPH_FFINTFC_ST2 0x00400754 |
| 357 | #define NV10_PGRAPH_RDI_DATA 0x00400754 | 350 | #define NV10_PGRAPH_RDI_DATA 0x00400754 |
| 358 | #define NV04_PGRAPH_DMA_PITCH 0x00400760 | 351 | #define NV04_PGRAPH_DMA_PITCH 0x00400760 |
| 359 | #define NV10_PGRAPH_FFINTFC_ST2 0x00400764 | 352 | #define NV10_PGRAPH_FFINTFC_FIFO_PTR 0x00400760 |
| 360 | #define NV04_PGRAPH_DVD_COLORFMT 0x00400764 | 353 | #define NV04_PGRAPH_DVD_COLORFMT 0x00400764 |
| 354 | #define NV10_PGRAPH_FFINTFC_ST2 0x00400764 | ||
| 361 | #define NV04_PGRAPH_SCALED_FORMAT 0x00400768 | 355 | #define NV04_PGRAPH_SCALED_FORMAT 0x00400768 |
| 356 | #define NV10_PGRAPH_FFINTFC_ST2_DL 0x00400768 | ||
| 357 | #define NV10_PGRAPH_FFINTFC_ST2_DH 0x0040076c | ||
| 362 | #define NV10_PGRAPH_DMA_PITCH 0x00400770 | 358 | #define NV10_PGRAPH_DMA_PITCH 0x00400770 |
| 363 | #define NV10_PGRAPH_DVD_COLORFMT 0x00400774 | 359 | #define NV10_PGRAPH_DVD_COLORFMT 0x00400774 |
| 364 | #define NV10_PGRAPH_SCALED_FORMAT 0x00400778 | 360 | #define NV10_PGRAPH_SCALED_FORMAT 0x00400778 |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index ee3729e7823b..989322be3728 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
| @@ -359,6 +359,54 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
| 359 | engine->gpio.set = nv50_gpio_set; | 359 | engine->gpio.set = nv50_gpio_set; |
| 360 | engine->gpio.irq_enable = nv50_gpio_irq_enable; | 360 | engine->gpio.irq_enable = nv50_gpio_irq_enable; |
| 361 | break; | 361 | break; |
| 362 | case 0xC0: | ||
| 363 | engine->instmem.init = nvc0_instmem_init; | ||
| 364 | engine->instmem.takedown = nvc0_instmem_takedown; | ||
| 365 | engine->instmem.suspend = nvc0_instmem_suspend; | ||
| 366 | engine->instmem.resume = nvc0_instmem_resume; | ||
| 367 | engine->instmem.populate = nvc0_instmem_populate; | ||
| 368 | engine->instmem.clear = nvc0_instmem_clear; | ||
| 369 | engine->instmem.bind = nvc0_instmem_bind; | ||
| 370 | engine->instmem.unbind = nvc0_instmem_unbind; | ||
| 371 | engine->instmem.flush = nvc0_instmem_flush; | ||
| 372 | engine->mc.init = nv50_mc_init; | ||
| 373 | engine->mc.takedown = nv50_mc_takedown; | ||
| 374 | engine->timer.init = nv04_timer_init; | ||
| 375 | engine->timer.read = nv04_timer_read; | ||
| 376 | engine->timer.takedown = nv04_timer_takedown; | ||
| 377 | engine->fb.init = nvc0_fb_init; | ||
| 378 | engine->fb.takedown = nvc0_fb_takedown; | ||
| 379 | engine->graph.grclass = NULL; //nvc0_graph_grclass; | ||
| 380 | engine->graph.init = nvc0_graph_init; | ||
| 381 | engine->graph.takedown = nvc0_graph_takedown; | ||
| 382 | engine->graph.fifo_access = nvc0_graph_fifo_access; | ||
| 383 | engine->graph.channel = nvc0_graph_channel; | ||
| 384 | engine->graph.create_context = nvc0_graph_create_context; | ||
| 385 | engine->graph.destroy_context = nvc0_graph_destroy_context; | ||
| 386 | engine->graph.load_context = nvc0_graph_load_context; | ||
| 387 | engine->graph.unload_context = nvc0_graph_unload_context; | ||
| 388 | engine->fifo.channels = 128; | ||
| 389 | engine->fifo.init = nvc0_fifo_init; | ||
| 390 | engine->fifo.takedown = nvc0_fifo_takedown; | ||
| 391 | engine->fifo.disable = nvc0_fifo_disable; | ||
| 392 | engine->fifo.enable = nvc0_fifo_enable; | ||
| 393 | engine->fifo.reassign = nvc0_fifo_reassign; | ||
| 394 | engine->fifo.channel_id = nvc0_fifo_channel_id; | ||
| 395 | engine->fifo.create_context = nvc0_fifo_create_context; | ||
| 396 | engine->fifo.destroy_context = nvc0_fifo_destroy_context; | ||
| 397 | engine->fifo.load_context = nvc0_fifo_load_context; | ||
| 398 | engine->fifo.unload_context = nvc0_fifo_unload_context; | ||
| 399 | engine->display.early_init = nv50_display_early_init; | ||
| 400 | engine->display.late_takedown = nv50_display_late_takedown; | ||
| 401 | engine->display.create = nv50_display_create; | ||
| 402 | engine->display.init = nv50_display_init; | ||
| 403 | engine->display.destroy = nv50_display_destroy; | ||
| 404 | engine->gpio.init = nv50_gpio_init; | ||
| 405 | engine->gpio.takedown = nouveau_stub_takedown; | ||
| 406 | engine->gpio.get = nv50_gpio_get; | ||
| 407 | engine->gpio.set = nv50_gpio_set; | ||
| 408 | engine->gpio.irq_enable = nv50_gpio_irq_enable; | ||
| 409 | break; | ||
| 362 | default: | 410 | default: |
| 363 | NV_ERROR(dev, "NV%02x unsupported\n", dev_priv->chipset); | 411 | NV_ERROR(dev, "NV%02x unsupported\n", dev_priv->chipset); |
| 364 | return 1; | 412 | return 1; |
| @@ -739,8 +787,10 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
| 739 | int ret; | 787 | int ret; |
| 740 | 788 | ||
| 741 | dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); | 789 | dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); |
| 742 | if (!dev_priv) | 790 | if (!dev_priv) { |
| 743 | return -ENOMEM; | 791 | ret = -ENOMEM; |
| 792 | goto err_out; | ||
| 793 | } | ||
| 744 | dev->dev_private = dev_priv; | 794 | dev->dev_private = dev_priv; |
| 745 | dev_priv->dev = dev; | 795 | dev_priv->dev = dev; |
| 746 | 796 | ||
| @@ -750,8 +800,10 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
| 750 | dev->pci_vendor, dev->pci_device, dev->pdev->class); | 800 | dev->pci_vendor, dev->pci_device, dev->pdev->class); |
| 751 | 801 | ||
| 752 | dev_priv->wq = create_workqueue("nouveau"); | 802 | dev_priv->wq = create_workqueue("nouveau"); |
| 753 | if (!dev_priv->wq) | 803 | if (!dev_priv->wq) { |
| 754 | return -EINVAL; | 804 | ret = -EINVAL; |
| 805 | goto err_priv; | ||
| 806 | } | ||
| 755 | 807 | ||
| 756 | /* resource 0 is mmio regs */ | 808 | /* resource 0 is mmio regs */ |
| 757 | /* resource 1 is linear FB */ | 809 | /* resource 1 is linear FB */ |
| @@ -764,7 +816,8 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
| 764 | if (!dev_priv->mmio) { | 816 | if (!dev_priv->mmio) { |
| 765 | NV_ERROR(dev, "Unable to initialize the mmio mapping. " | 817 | NV_ERROR(dev, "Unable to initialize the mmio mapping. " |
| 766 | "Please report your setup to " DRIVER_EMAIL "\n"); | 818 | "Please report your setup to " DRIVER_EMAIL "\n"); |
| 767 | return -EINVAL; | 819 | ret = -EINVAL; |
| 820 | goto err_wq; | ||
| 768 | } | 821 | } |
| 769 | NV_DEBUG(dev, "regs mapped ok at 0x%llx\n", | 822 | NV_DEBUG(dev, "regs mapped ok at 0x%llx\n", |
| 770 | (unsigned long long)mmio_start_offs); | 823 | (unsigned long long)mmio_start_offs); |
| @@ -810,9 +863,13 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
| 810 | case 0xa0: | 863 | case 0xa0: |
| 811 | dev_priv->card_type = NV_50; | 864 | dev_priv->card_type = NV_50; |
| 812 | break; | 865 | break; |
| 866 | case 0xc0: | ||
| 867 | dev_priv->card_type = NV_C0; | ||
| 868 | break; | ||
| 813 | default: | 869 | default: |
| 814 | NV_INFO(dev, "Unsupported chipset 0x%08x\n", reg0); | 870 | NV_INFO(dev, "Unsupported chipset 0x%08x\n", reg0); |
| 815 | return -EINVAL; | 871 | ret = -EINVAL; |
| 872 | goto err_mmio; | ||
| 816 | } | 873 | } |
| 817 | 874 | ||
| 818 | NV_INFO(dev, "Detected an NV%2x generation card (0x%08x)\n", | 875 | NV_INFO(dev, "Detected an NV%2x generation card (0x%08x)\n", |
| @@ -820,7 +877,7 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
| 820 | 877 | ||
| 821 | ret = nouveau_remove_conflicting_drivers(dev); | 878 | ret = nouveau_remove_conflicting_drivers(dev); |
| 822 | if (ret) | 879 | if (ret) |
| 823 | return ret; | 880 | goto err_mmio; |
| 824 | 881 | ||
| 825 | /* Map PRAMIN BAR, or on older cards, the aperture withing BAR0 */ | 882 | /* Map PRAMIN BAR, or on older cards, the aperture withing BAR0 */ |
| 826 | if (dev_priv->card_type >= NV_40) { | 883 | if (dev_priv->card_type >= NV_40) { |
| @@ -834,7 +891,8 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
| 834 | dev_priv->ramin_size); | 891 | dev_priv->ramin_size); |
| 835 | if (!dev_priv->ramin) { | 892 | if (!dev_priv->ramin) { |
| 836 | NV_ERROR(dev, "Failed to PRAMIN BAR"); | 893 | NV_ERROR(dev, "Failed to PRAMIN BAR"); |
| 837 | return -ENOMEM; | 894 | ret = -ENOMEM; |
| 895 | goto err_mmio; | ||
| 838 | } | 896 | } |
| 839 | } else { | 897 | } else { |
| 840 | dev_priv->ramin_size = 1 * 1024 * 1024; | 898 | dev_priv->ramin_size = 1 * 1024 * 1024; |
| @@ -842,7 +900,8 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
| 842 | dev_priv->ramin_size); | 900 | dev_priv->ramin_size); |
| 843 | if (!dev_priv->ramin) { | 901 | if (!dev_priv->ramin) { |
| 844 | NV_ERROR(dev, "Failed to map BAR0 PRAMIN.\n"); | 902 | NV_ERROR(dev, "Failed to map BAR0 PRAMIN.\n"); |
| 845 | return -ENOMEM; | 903 | ret = -ENOMEM; |
| 904 | goto err_mmio; | ||
| 846 | } | 905 | } |
| 847 | } | 906 | } |
| 848 | 907 | ||
| @@ -857,9 +916,21 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
| 857 | /* For kernel modesetting, init card now and bring up fbcon */ | 916 | /* For kernel modesetting, init card now and bring up fbcon */ |
| 858 | ret = nouveau_card_init(dev); | 917 | ret = nouveau_card_init(dev); |
| 859 | if (ret) | 918 | if (ret) |
| 860 | return ret; | 919 | goto err_ramin; |
| 861 | 920 | ||
| 862 | return 0; | 921 | return 0; |
| 922 | |||
| 923 | err_ramin: | ||
| 924 | iounmap(dev_priv->ramin); | ||
| 925 | err_mmio: | ||
| 926 | iounmap(dev_priv->mmio); | ||
| 927 | err_wq: | ||
| 928 | destroy_workqueue(dev_priv->wq); | ||
| 929 | err_priv: | ||
| 930 | kfree(dev_priv); | ||
| 931 | dev->dev_private = NULL; | ||
| 932 | err_out: | ||
| 933 | return ret; | ||
| 863 | } | 934 | } |
| 864 | 935 | ||
| 865 | void nouveau_lastclose(struct drm_device *dev) | 936 | void nouveau_lastclose(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c index 1c20c08ce67c..497df8765f28 100644 --- a/drivers/gpu/drm/nouveau/nv04_crtc.c +++ b/drivers/gpu/drm/nouveau/nv04_crtc.c | |||
| @@ -542,6 +542,9 @@ nv_crtc_mode_set_regs(struct drm_crtc *crtc, struct drm_display_mode * mode) | |||
| 542 | * 1 << 30 on 0x60.830), for no apparent reason */ | 542 | * 1 << 30 on 0x60.830), for no apparent reason */ |
| 543 | regp->CRTC[NV_CIO_CRE_59] = off_chip_digital; | 543 | regp->CRTC[NV_CIO_CRE_59] = off_chip_digital; |
| 544 | 544 | ||
| 545 | if (dev_priv->card_type >= NV_30) | ||
| 546 | regp->CRTC[0x9f] = off_chip_digital ? 0x11 : 0x1; | ||
| 547 | |||
| 545 | regp->crtc_830 = mode->crtc_vdisplay - 3; | 548 | regp->crtc_830 = mode->crtc_vdisplay - 3; |
| 546 | regp->crtc_834 = mode->crtc_vdisplay - 1; | 549 | regp->crtc_834 = mode->crtc_vdisplay - 1; |
| 547 | 550 | ||
| @@ -739,15 +742,13 @@ nv_crtc_gamma_load(struct drm_crtc *crtc) | |||
| 739 | } | 742 | } |
| 740 | 743 | ||
| 741 | static void | 744 | static void |
| 742 | nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t size) | 745 | nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t start, |
| 746 | uint32_t size) | ||
| 743 | { | 747 | { |
| 748 | int end = (start + size > 256) ? 256 : start + size, i; | ||
| 744 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 749 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
| 745 | int i; | ||
| 746 | 750 | ||
| 747 | if (size != 256) | 751 | for (i = start; i < end; i++) { |
| 748 | return; | ||
| 749 | |||
| 750 | for (i = 0; i < 256; i++) { | ||
| 751 | nv_crtc->lut.r[i] = r[i]; | 752 | nv_crtc->lut.r[i] = r[i]; |
| 752 | nv_crtc->lut.g[i] = g[i]; | 753 | nv_crtc->lut.g[i] = g[i]; |
| 753 | nv_crtc->lut.b[i] = b[i]; | 754 | nv_crtc->lut.b[i] = b[i]; |
| @@ -914,7 +915,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | |||
| 914 | 915 | ||
| 915 | gem = drm_gem_object_lookup(dev, file_priv, buffer_handle); | 916 | gem = drm_gem_object_lookup(dev, file_priv, buffer_handle); |
| 916 | if (!gem) | 917 | if (!gem) |
| 917 | return -EINVAL; | 918 | return -ENOENT; |
| 918 | cursor = nouveau_gem_object(gem); | 919 | cursor = nouveau_gem_object(gem); |
| 919 | 920 | ||
| 920 | ret = nouveau_bo_map(cursor); | 921 | ret = nouveau_bo_map(cursor); |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index 3311f3a8c818..a5dcf7685800 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
| @@ -34,6 +34,8 @@ | |||
| 34 | #include "nouveau_hw.h" | 34 | #include "nouveau_hw.h" |
| 35 | #include "nvreg.h" | 35 | #include "nvreg.h" |
| 36 | 36 | ||
| 37 | #include "i2c/sil164.h" | ||
| 38 | |||
| 37 | #define FP_TG_CONTROL_ON (NV_PRAMDAC_FP_TG_CONTROL_DISPEN_POS | \ | 39 | #define FP_TG_CONTROL_ON (NV_PRAMDAC_FP_TG_CONTROL_DISPEN_POS | \ |
| 38 | NV_PRAMDAC_FP_TG_CONTROL_HSYNC_POS | \ | 40 | NV_PRAMDAC_FP_TG_CONTROL_HSYNC_POS | \ |
| 39 | NV_PRAMDAC_FP_TG_CONTROL_VSYNC_POS) | 41 | NV_PRAMDAC_FP_TG_CONTROL_VSYNC_POS) |
| @@ -144,6 +146,36 @@ void nv04_dfp_update_fp_control(struct drm_encoder *encoder, int mode) | |||
| 144 | } | 146 | } |
| 145 | } | 147 | } |
| 146 | 148 | ||
| 149 | static struct drm_encoder *get_tmds_slave(struct drm_encoder *encoder) | ||
| 150 | { | ||
| 151 | struct drm_device *dev = encoder->dev; | ||
| 152 | struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb; | ||
| 153 | struct drm_encoder *slave; | ||
| 154 | |||
| 155 | if (dcb->type != OUTPUT_TMDS || dcb->location == DCB_LOC_ON_CHIP) | ||
| 156 | return NULL; | ||
| 157 | |||
| 158 | /* Some BIOSes (e.g. the one in a Quadro FX1000) report several | ||
| 159 | * TMDS transmitters at the same I2C address, in the same I2C | ||
| 160 | * bus. This can still work because in that case one of them is | ||
| 161 | * always hard-wired to a reasonable configuration using straps, | ||
| 162 | * and the other one needs to be programmed. | ||
| 163 | * | ||
| 164 | * I don't think there's a way to know which is which, even the | ||
| 165 | * blob programs the one exposed via I2C for *both* heads, so | ||
| 166 | * let's do the same. | ||
| 167 | */ | ||
| 168 | list_for_each_entry(slave, &dev->mode_config.encoder_list, head) { | ||
| 169 | struct dcb_entry *slave_dcb = nouveau_encoder(slave)->dcb; | ||
| 170 | |||
| 171 | if (slave_dcb->type == OUTPUT_TMDS && get_slave_funcs(slave) && | ||
| 172 | slave_dcb->tmdsconf.slave_addr == dcb->tmdsconf.slave_addr) | ||
| 173 | return slave; | ||
| 174 | } | ||
| 175 | |||
| 176 | return NULL; | ||
| 177 | } | ||
| 178 | |||
| 147 | static bool nv04_dfp_mode_fixup(struct drm_encoder *encoder, | 179 | static bool nv04_dfp_mode_fixup(struct drm_encoder *encoder, |
| 148 | struct drm_display_mode *mode, | 180 | struct drm_display_mode *mode, |
| 149 | struct drm_display_mode *adjusted_mode) | 181 | struct drm_display_mode *adjusted_mode) |
| @@ -429,6 +461,11 @@ static void nv04_dfp_commit(struct drm_encoder *encoder) | |||
| 429 | else | 461 | else |
| 430 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + nv04_dac_output_offset(encoder), 0x00100000); | 462 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + nv04_dac_output_offset(encoder), 0x00100000); |
| 431 | 463 | ||
| 464 | /* Init external transmitters */ | ||
| 465 | if (get_tmds_slave(encoder)) | ||
| 466 | get_slave_funcs(get_tmds_slave(encoder))->mode_set( | ||
| 467 | encoder, &nv_encoder->mode, &nv_encoder->mode); | ||
| 468 | |||
| 432 | helper->dpms(encoder, DRM_MODE_DPMS_ON); | 469 | helper->dpms(encoder, DRM_MODE_DPMS_ON); |
| 433 | 470 | ||
| 434 | NV_INFO(dev, "Output %s is running on CRTC %d using output %c\n", | 471 | NV_INFO(dev, "Output %s is running on CRTC %d using output %c\n", |
| @@ -550,10 +587,42 @@ static void nv04_dfp_destroy(struct drm_encoder *encoder) | |||
| 550 | 587 | ||
| 551 | NV_DEBUG_KMS(encoder->dev, "\n"); | 588 | NV_DEBUG_KMS(encoder->dev, "\n"); |
| 552 | 589 | ||
| 590 | if (get_slave_funcs(encoder)) | ||
| 591 | get_slave_funcs(encoder)->destroy(encoder); | ||
| 592 | |||
| 553 | drm_encoder_cleanup(encoder); | 593 | drm_encoder_cleanup(encoder); |
| 554 | kfree(nv_encoder); | 594 | kfree(nv_encoder); |
| 555 | } | 595 | } |
| 556 | 596 | ||
| 597 | static void nv04_tmds_slave_init(struct drm_encoder *encoder) | ||
| 598 | { | ||
| 599 | struct drm_device *dev = encoder->dev; | ||
| 600 | struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb; | ||
| 601 | struct nouveau_i2c_chan *i2c = nouveau_i2c_find(dev, 2); | ||
| 602 | struct i2c_board_info info[] = { | ||
| 603 | { | ||
| 604 | .type = "sil164", | ||
| 605 | .addr = (dcb->tmdsconf.slave_addr == 0x7 ? 0x3a : 0x38), | ||
| 606 | .platform_data = &(struct sil164_encoder_params) { | ||
| 607 | SIL164_INPUT_EDGE_RISING | ||
| 608 | } | ||
| 609 | }, | ||
| 610 | { } | ||
| 611 | }; | ||
| 612 | int type; | ||
| 613 | |||
| 614 | if (!nv_gf4_disp_arch(dev) || !i2c || | ||
| 615 | get_tmds_slave(encoder)) | ||
| 616 | return; | ||
| 617 | |||
| 618 | type = nouveau_i2c_identify(dev, "TMDS transmitter", info, 2); | ||
| 619 | if (type < 0) | ||
| 620 | return; | ||
| 621 | |||
| 622 | drm_i2c_encoder_init(dev, to_encoder_slave(encoder), | ||
| 623 | &i2c->adapter, &info[type]); | ||
| 624 | } | ||
| 625 | |||
| 557 | static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs = { | 626 | static const struct drm_encoder_helper_funcs nv04_lvds_helper_funcs = { |
| 558 | .dpms = nv04_lvds_dpms, | 627 | .dpms = nv04_lvds_dpms, |
| 559 | .save = nv04_dfp_save, | 628 | .save = nv04_dfp_save, |
| @@ -616,6 +685,10 @@ nv04_dfp_create(struct drm_connector *connector, struct dcb_entry *entry) | |||
| 616 | encoder->possible_crtcs = entry->heads; | 685 | encoder->possible_crtcs = entry->heads; |
| 617 | encoder->possible_clones = 0; | 686 | encoder->possible_clones = 0; |
| 618 | 687 | ||
| 688 | if (entry->type == OUTPUT_TMDS && | ||
| 689 | entry->location != DCB_LOC_ON_CHIP) | ||
| 690 | nv04_tmds_slave_init(encoder); | ||
| 691 | |||
| 619 | drm_mode_connector_attach_encoder(connector, encoder); | 692 | drm_mode_connector_attach_encoder(connector, encoder); |
| 620 | return 0; | 693 | return 0; |
| 621 | } | 694 | } |
diff --git a/drivers/gpu/drm/nouveau/nv04_tv.c b/drivers/gpu/drm/nouveau/nv04_tv.c index 94e299cef0b2..0b5d012d7c28 100644 --- a/drivers/gpu/drm/nouveau/nv04_tv.c +++ b/drivers/gpu/drm/nouveau/nv04_tv.c | |||
| @@ -89,7 +89,7 @@ static void nv04_tv_dpms(struct drm_encoder *encoder, int mode) | |||
| 89 | 89 | ||
| 90 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_PLL_COEFF_SELECT, state->pllsel); | 90 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_PLL_COEFF_SELECT, state->pllsel); |
| 91 | 91 | ||
| 92 | to_encoder_slave(encoder)->slave_funcs->dpms(encoder, mode); | 92 | get_slave_funcs(encoder)->dpms(encoder, mode); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | static void nv04_tv_bind(struct drm_device *dev, int head, bool bind) | 95 | static void nv04_tv_bind(struct drm_device *dev, int head, bool bind) |
| @@ -152,7 +152,7 @@ static void nv04_tv_mode_set(struct drm_encoder *encoder, | |||
| 152 | regp->tv_vskew = 1; | 152 | regp->tv_vskew = 1; |
| 153 | regp->tv_vsync_delay = 1; | 153 | regp->tv_vsync_delay = 1; |
| 154 | 154 | ||
| 155 | to_encoder_slave(encoder)->slave_funcs->mode_set(encoder, mode, adjusted_mode); | 155 | get_slave_funcs(encoder)->mode_set(encoder, mode, adjusted_mode); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | static void nv04_tv_commit(struct drm_encoder *encoder) | 158 | static void nv04_tv_commit(struct drm_encoder *encoder) |
| @@ -171,8 +171,7 @@ static void nv04_tv_commit(struct drm_encoder *encoder) | |||
| 171 | 171 | ||
| 172 | static void nv04_tv_destroy(struct drm_encoder *encoder) | 172 | static void nv04_tv_destroy(struct drm_encoder *encoder) |
| 173 | { | 173 | { |
| 174 | to_encoder_slave(encoder)->slave_funcs->destroy(encoder); | 174 | get_slave_funcs(encoder)->destroy(encoder); |
| 175 | |||
| 176 | drm_encoder_cleanup(encoder); | 175 | drm_encoder_cleanup(encoder); |
| 177 | 176 | ||
| 178 | kfree(encoder->helper_private); | 177 | kfree(encoder->helper_private); |
| @@ -229,7 +228,7 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_entry *entry) | |||
| 229 | goto fail_cleanup; | 228 | goto fail_cleanup; |
| 230 | 229 | ||
| 231 | /* Fill the function pointers */ | 230 | /* Fill the function pointers */ |
| 232 | sfuncs = to_encoder_slave(encoder)->slave_funcs; | 231 | sfuncs = get_slave_funcs(encoder); |
| 233 | 232 | ||
| 234 | *hfuncs = (struct drm_encoder_helper_funcs) { | 233 | *hfuncs = (struct drm_encoder_helper_funcs) { |
| 235 | .dpms = nv04_tv_dpms, | 234 | .dpms = nv04_tv_dpms, |
| @@ -243,7 +242,6 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_entry *entry) | |||
| 243 | }; | 242 | }; |
| 244 | 243 | ||
| 245 | /* Attach it to the specified connector. */ | 244 | /* Attach it to the specified connector. */ |
| 246 | sfuncs->set_config(encoder, nv04_tv_encoder_info[type].platform_data); | ||
| 247 | sfuncs->create_resources(encoder, connector); | 245 | sfuncs->create_resources(encoder, connector); |
| 248 | drm_mode_connector_attach_encoder(connector, encoder); | 246 | drm_mode_connector_attach_encoder(connector, encoder); |
| 249 | 247 | ||
diff --git a/drivers/gpu/drm/nouveau/nv10_graph.c b/drivers/gpu/drm/nouveau/nv10_graph.c index fcf2cdd19493..b2f6a57c0cc5 100644 --- a/drivers/gpu/drm/nouveau/nv10_graph.c +++ b/drivers/gpu/drm/nouveau/nv10_graph.c | |||
| @@ -43,51 +43,51 @@ struct pipe_state { | |||
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | static int nv10_graph_ctx_regs[] = { | 45 | static int nv10_graph_ctx_regs[] = { |
| 46 | NV10_PGRAPH_CTX_SWITCH1, | 46 | NV10_PGRAPH_CTX_SWITCH(0), |
| 47 | NV10_PGRAPH_CTX_SWITCH2, | 47 | NV10_PGRAPH_CTX_SWITCH(1), |
| 48 | NV10_PGRAPH_CTX_SWITCH3, | 48 | NV10_PGRAPH_CTX_SWITCH(2), |
| 49 | NV10_PGRAPH_CTX_SWITCH4, | 49 | NV10_PGRAPH_CTX_SWITCH(3), |
| 50 | NV10_PGRAPH_CTX_SWITCH5, | 50 | NV10_PGRAPH_CTX_SWITCH(4), |
| 51 | NV10_PGRAPH_CTX_CACHE1, /* 8 values from 0x400160 to 0x40017c */ | 51 | NV10_PGRAPH_CTX_CACHE(0, 0), |
| 52 | NV10_PGRAPH_CTX_CACHE2, /* 8 values from 0x400180 to 0x40019c */ | 52 | NV10_PGRAPH_CTX_CACHE(0, 1), |
| 53 | NV10_PGRAPH_CTX_CACHE3, /* 8 values from 0x4001a0 to 0x4001bc */ | 53 | NV10_PGRAPH_CTX_CACHE(0, 2), |
| 54 | NV10_PGRAPH_CTX_CACHE4, /* 8 values from 0x4001c0 to 0x4001dc */ | 54 | NV10_PGRAPH_CTX_CACHE(0, 3), |
| 55 | NV10_PGRAPH_CTX_CACHE5, /* 8 values from 0x4001e0 to 0x4001fc */ | 55 | NV10_PGRAPH_CTX_CACHE(0, 4), |
| 56 | 0x00400164, | 56 | NV10_PGRAPH_CTX_CACHE(1, 0), |
| 57 | 0x00400184, | 57 | NV10_PGRAPH_CTX_CACHE(1, 1), |
| 58 | 0x004001a4, | 58 | NV10_PGRAPH_CTX_CACHE(1, 2), |
| 59 | 0x004001c4, | 59 | NV10_PGRAPH_CTX_CACHE(1, 3), |
| 60 | 0x004001e4, | 60 | NV10_PGRAPH_CTX_CACHE(1, 4), |
| 61 | 0x00400168, | 61 | NV10_PGRAPH_CTX_CACHE(2, 0), |
| 62 | 0x00400188, | 62 | NV10_PGRAPH_CTX_CACHE(2, 1), |
| 63 | 0x004001a8, | 63 | NV10_PGRAPH_CTX_CACHE(2, 2), |
| 64 | 0x004001c8, | 64 | NV10_PGRAPH_CTX_CACHE(2, 3), |
| 65 | 0x004001e8, | 65 | NV10_PGRAPH_CTX_CACHE(2, 4), |
| 66 | 0x0040016c, | 66 | NV10_PGRAPH_CTX_CACHE(3, 0), |
| 67 | 0x0040018c, | 67 | NV10_PGRAPH_CTX_CACHE(3, 1), |
| 68 | 0x004001ac, | 68 | NV10_PGRAPH_CTX_CACHE(3, 2), |
| 69 | 0x004001cc, | 69 | NV10_PGRAPH_CTX_CACHE(3, 3), |
| 70 | 0x004001ec, | 70 | NV10_PGRAPH_CTX_CACHE(3, 4), |
| 71 | 0x00400170, | 71 | NV10_PGRAPH_CTX_CACHE(4, 0), |
| 72 | 0x00400190, | 72 | NV10_PGRAPH_CTX_CACHE(4, 1), |
| 73 | 0x004001b0, | 73 | NV10_PGRAPH_CTX_CACHE(4, 2), |
| 74 | 0x004001d0, | 74 | NV10_PGRAPH_CTX_CACHE(4, 3), |
| 75 | 0x004001f0, | 75 | NV10_PGRAPH_CTX_CACHE(4, 4), |
| 76 | 0x00400174, | 76 | NV10_PGRAPH_CTX_CACHE(5, 0), |
| 77 | 0x00400194, | 77 | NV10_PGRAPH_CTX_CACHE(5, 1), |
| 78 | 0x004001b4, | 78 | NV10_PGRAPH_CTX_CACHE(5, 2), |
| 79 | 0x004001d4, | 79 | NV10_PGRAPH_CTX_CACHE(5, 3), |
| 80 | 0x004001f4, | 80 | NV10_PGRAPH_CTX_CACHE(5, 4), |
| 81 | 0x00400178, | 81 | NV10_PGRAPH_CTX_CACHE(6, 0), |
| 82 | 0x00400198, | 82 | NV10_PGRAPH_CTX_CACHE(6, 1), |
| 83 | 0x004001b8, | 83 | NV10_PGRAPH_CTX_CACHE(6, 2), |
| 84 | 0x004001d8, | 84 | NV10_PGRAPH_CTX_CACHE(6, 3), |
| 85 | 0x004001f8, | 85 | NV10_PGRAPH_CTX_CACHE(6, 4), |
| 86 | 0x0040017c, | 86 | NV10_PGRAPH_CTX_CACHE(7, 0), |
| 87 | 0x0040019c, | 87 | NV10_PGRAPH_CTX_CACHE(7, 1), |
| 88 | 0x004001bc, | 88 | NV10_PGRAPH_CTX_CACHE(7, 2), |
| 89 | 0x004001dc, | 89 | NV10_PGRAPH_CTX_CACHE(7, 3), |
| 90 | 0x004001fc, | 90 | NV10_PGRAPH_CTX_CACHE(7, 4), |
| 91 | NV10_PGRAPH_CTX_USER, | 91 | NV10_PGRAPH_CTX_USER, |
| 92 | NV04_PGRAPH_DMA_START_0, | 92 | NV04_PGRAPH_DMA_START_0, |
| 93 | NV04_PGRAPH_DMA_START_1, | 93 | NV04_PGRAPH_DMA_START_1, |
| @@ -653,6 +653,78 @@ static int nv17_graph_ctx_regs_find_offset(struct drm_device *dev, int reg) | |||
| 653 | return -1; | 653 | return -1; |
| 654 | } | 654 | } |
| 655 | 655 | ||
| 656 | static void nv10_graph_load_dma_vtxbuf(struct nouveau_channel *chan, | ||
| 657 | uint32_t inst) | ||
| 658 | { | ||
| 659 | struct drm_device *dev = chan->dev; | ||
| 660 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 661 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
| 662 | uint32_t st2, st2_dl, st2_dh, fifo_ptr, fifo[0x60/4]; | ||
| 663 | uint32_t ctx_user, ctx_switch[5]; | ||
| 664 | int i, subchan = -1; | ||
| 665 | |||
| 666 | /* NV10TCL_DMA_VTXBUF (method 0x18c) modifies hidden state | ||
| 667 | * that cannot be restored via MMIO. Do it through the FIFO | ||
| 668 | * instead. | ||
| 669 | */ | ||
| 670 | |||
| 671 | /* Look for a celsius object */ | ||
| 672 | for (i = 0; i < 8; i++) { | ||
| 673 | int class = nv_rd32(dev, NV10_PGRAPH_CTX_CACHE(i, 0)) & 0xfff; | ||
| 674 | |||
| 675 | if (class == 0x56 || class == 0x96 || class == 0x99) { | ||
| 676 | subchan = i; | ||
| 677 | break; | ||
| 678 | } | ||
| 679 | } | ||
| 680 | |||
| 681 | if (subchan < 0 || !inst) | ||
| 682 | return; | ||
| 683 | |||
| 684 | /* Save the current ctx object */ | ||
| 685 | ctx_user = nv_rd32(dev, NV10_PGRAPH_CTX_USER); | ||
| 686 | for (i = 0; i < 5; i++) | ||
| 687 | ctx_switch[i] = nv_rd32(dev, NV10_PGRAPH_CTX_SWITCH(i)); | ||
| 688 | |||
| 689 | /* Save the FIFO state */ | ||
| 690 | st2 = nv_rd32(dev, NV10_PGRAPH_FFINTFC_ST2); | ||
| 691 | st2_dl = nv_rd32(dev, NV10_PGRAPH_FFINTFC_ST2_DL); | ||
| 692 | st2_dh = nv_rd32(dev, NV10_PGRAPH_FFINTFC_ST2_DH); | ||
| 693 | fifo_ptr = nv_rd32(dev, NV10_PGRAPH_FFINTFC_FIFO_PTR); | ||
| 694 | |||
| 695 | for (i = 0; i < ARRAY_SIZE(fifo); i++) | ||
| 696 | fifo[i] = nv_rd32(dev, 0x4007a0 + 4 * i); | ||
| 697 | |||
| 698 | /* Switch to the celsius subchannel */ | ||
| 699 | for (i = 0; i < 5; i++) | ||
| 700 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH(i), | ||
| 701 | nv_rd32(dev, NV10_PGRAPH_CTX_CACHE(subchan, i))); | ||
| 702 | nv_mask(dev, NV10_PGRAPH_CTX_USER, 0xe000, subchan << 13); | ||
| 703 | |||
| 704 | /* Inject NV10TCL_DMA_VTXBUF */ | ||
| 705 | nv_wr32(dev, NV10_PGRAPH_FFINTFC_FIFO_PTR, 0); | ||
| 706 | nv_wr32(dev, NV10_PGRAPH_FFINTFC_ST2, | ||
| 707 | 0x2c000000 | chan->id << 20 | subchan << 16 | 0x18c); | ||
| 708 | nv_wr32(dev, NV10_PGRAPH_FFINTFC_ST2_DL, inst); | ||
| 709 | nv_mask(dev, NV10_PGRAPH_CTX_CONTROL, 0, 0x10000); | ||
| 710 | pgraph->fifo_access(dev, true); | ||
| 711 | pgraph->fifo_access(dev, false); | ||
| 712 | |||
| 713 | /* Restore the FIFO state */ | ||
| 714 | for (i = 0; i < ARRAY_SIZE(fifo); i++) | ||
| 715 | nv_wr32(dev, 0x4007a0 + 4 * i, fifo[i]); | ||
| 716 | |||
| 717 | nv_wr32(dev, NV10_PGRAPH_FFINTFC_FIFO_PTR, fifo_ptr); | ||
| 718 | nv_wr32(dev, NV10_PGRAPH_FFINTFC_ST2, st2); | ||
| 719 | nv_wr32(dev, NV10_PGRAPH_FFINTFC_ST2_DL, st2_dl); | ||
| 720 | nv_wr32(dev, NV10_PGRAPH_FFINTFC_ST2_DH, st2_dh); | ||
| 721 | |||
| 722 | /* Restore the current ctx object */ | ||
| 723 | for (i = 0; i < 5; i++) | ||
| 724 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH(i), ctx_switch[i]); | ||
| 725 | nv_wr32(dev, NV10_PGRAPH_CTX_USER, ctx_user); | ||
| 726 | } | ||
| 727 | |||
| 656 | int nv10_graph_load_context(struct nouveau_channel *chan) | 728 | int nv10_graph_load_context(struct nouveau_channel *chan) |
| 657 | { | 729 | { |
| 658 | struct drm_device *dev = chan->dev; | 730 | struct drm_device *dev = chan->dev; |
| @@ -670,6 +742,8 @@ int nv10_graph_load_context(struct nouveau_channel *chan) | |||
| 670 | } | 742 | } |
| 671 | 743 | ||
| 672 | nv10_graph_load_pipe(chan); | 744 | nv10_graph_load_pipe(chan); |
| 745 | nv10_graph_load_dma_vtxbuf(chan, (nv_rd32(dev, NV10_PGRAPH_GLOBALSTATE1) | ||
| 746 | & 0xffff)); | ||
| 673 | 747 | ||
| 674 | nv_wr32(dev, NV10_PGRAPH_CTX_CONTROL, 0x10010100); | 748 | nv_wr32(dev, NV10_PGRAPH_CTX_CONTROL, 0x10010100); |
| 675 | tmp = nv_rd32(dev, NV10_PGRAPH_CTX_USER); | 749 | tmp = nv_rd32(dev, NV10_PGRAPH_CTX_USER); |
| @@ -856,11 +930,12 @@ int nv10_graph_init(struct drm_device *dev) | |||
| 856 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) | 930 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) |
| 857 | nv10_graph_set_region_tiling(dev, i, 0, 0, 0); | 931 | nv10_graph_set_region_tiling(dev, i, 0, 0, 0); |
| 858 | 932 | ||
| 859 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH1, 0x00000000); | 933 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH(0), 0x00000000); |
| 860 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH2, 0x00000000); | 934 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH(1), 0x00000000); |
| 861 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH3, 0x00000000); | 935 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH(2), 0x00000000); |
| 862 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH4, 0x00000000); | 936 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH(3), 0x00000000); |
| 863 | nv_wr32(dev, NV10_PGRAPH_STATE , 0xFFFFFFFF); | 937 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH(4), 0x00000000); |
| 938 | nv_wr32(dev, NV10_PGRAPH_STATE, 0xFFFFFFFF); | ||
| 864 | 939 | ||
| 865 | tmp = nv_rd32(dev, NV10_PGRAPH_CTX_USER) & 0x00ffffff; | 940 | tmp = nv_rd32(dev, NV10_PGRAPH_CTX_USER) & 0x00ffffff; |
| 866 | tmp |= (dev_priv->engine.fifo.channels - 1) << 24; | 941 | tmp |= (dev_priv->engine.fifo.channels - 1) << 24; |
diff --git a/drivers/gpu/drm/nouveau/nv30_fb.c b/drivers/gpu/drm/nouveau/nv30_fb.c index 9d35c8b3b839..4a3f2f095128 100644 --- a/drivers/gpu/drm/nouveau/nv30_fb.c +++ b/drivers/gpu/drm/nouveau/nv30_fb.c | |||
| @@ -30,15 +30,25 @@ | |||
| 30 | #include "nouveau_drm.h" | 30 | #include "nouveau_drm.h" |
| 31 | 31 | ||
| 32 | static int | 32 | static int |
| 33 | calc_ref(int b, int l, int i) | 33 | calc_bias(struct drm_device *dev, int k, int i, int j) |
| 34 | { | ||
| 35 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 36 | int b = (dev_priv->chipset > 0x30 ? | ||
| 37 | nv_rd32(dev, 0x122c + 0x10 * k + 0x4 * j) >> (4 * (i ^ 1)) : | ||
| 38 | 0) & 0xf; | ||
| 39 | |||
| 40 | return 2 * (b & 0x8 ? b - 0x10 : b); | ||
| 41 | } | ||
| 42 | |||
| 43 | static int | ||
| 44 | calc_ref(struct drm_device *dev, int l, int k, int i) | ||
| 34 | { | 45 | { |
| 35 | int j, x = 0; | 46 | int j, x = 0; |
| 36 | 47 | ||
| 37 | for (j = 0; j < 4; j++) { | 48 | for (j = 0; j < 4; j++) { |
| 38 | int n = (b >> (8 * j) & 0xf); | 49 | int m = (l >> (8 * i) & 0xff) + calc_bias(dev, k, i, j); |
| 39 | int m = (l >> (8 * i) & 0xff) + 2 * (n & 0x8 ? n - 0x10 : n); | ||
| 40 | 50 | ||
| 41 | x |= (0x80 | (m & 0x1f)) << (8 * j); | 51 | x |= (0x80 | clamp(m, 0, 0x1f)) << (8 * j); |
| 42 | } | 52 | } |
| 43 | 53 | ||
| 44 | return x; | 54 | return x; |
| @@ -63,18 +73,16 @@ nv30_fb_init(struct drm_device *dev) | |||
| 63 | dev_priv->chipset == 0x35) { | 73 | dev_priv->chipset == 0x35) { |
| 64 | /* Related to ROP count */ | 74 | /* Related to ROP count */ |
| 65 | int n = (dev_priv->chipset == 0x31 ? 2 : 4); | 75 | int n = (dev_priv->chipset == 0x31 ? 2 : 4); |
| 66 | int b = (dev_priv->chipset > 0x30 ? | ||
| 67 | nv_rd32(dev, 0x122c) & 0xf : 0); | ||
| 68 | int l = nv_rd32(dev, 0x1003d0); | 76 | int l = nv_rd32(dev, 0x1003d0); |
| 69 | 77 | ||
| 70 | for (i = 0; i < n; i++) { | 78 | for (i = 0; i < n; i++) { |
| 71 | for (j = 0; j < 3; j++) | 79 | for (j = 0; j < 3; j++) |
| 72 | nv_wr32(dev, 0x10037c + 0xc * i + 0x4 * j, | 80 | nv_wr32(dev, 0x10037c + 0xc * i + 0x4 * j, |
| 73 | calc_ref(b, l, j)); | 81 | calc_ref(dev, l, 0, j)); |
| 74 | 82 | ||
| 75 | for (j = 0; j < 2; j++) | 83 | for (j = 0; j < 2; j++) |
| 76 | nv_wr32(dev, 0x1003ac + 0x8 * i + 0x4 * j, | 84 | nv_wr32(dev, 0x1003ac + 0x8 * i + 0x4 * j, |
| 77 | calc_ref(b, l, j)); | 85 | calc_ref(dev, l, 1, j)); |
| 78 | } | 86 | } |
| 79 | } | 87 | } |
| 80 | 88 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index 5d11ea101666..bfd4ca2fe7ef 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
| @@ -264,11 +264,16 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, int scaling_mode, bool update) | |||
| 264 | int | 264 | int |
| 265 | nv50_crtc_set_clock(struct drm_device *dev, int head, int pclk) | 265 | nv50_crtc_set_clock(struct drm_device *dev, int head, int pclk) |
| 266 | { | 266 | { |
| 267 | uint32_t reg = NV50_PDISPLAY_CRTC_CLK_CTRL1(head); | 267 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
| 268 | struct pll_lims pll; | 268 | struct pll_lims pll; |
| 269 | uint32_t reg1, reg2; | 269 | uint32_t reg, reg1, reg2; |
| 270 | int ret, N1, M1, N2, M2, P; | 270 | int ret, N1, M1, N2, M2, P; |
| 271 | 271 | ||
| 272 | if (dev_priv->chipset < NV_C0) | ||
| 273 | reg = NV50_PDISPLAY_CRTC_CLK_CTRL1(head); | ||
| 274 | else | ||
| 275 | reg = 0x614140 + (head * 0x800); | ||
| 276 | |||
| 272 | ret = get_pll_limits(dev, reg, &pll); | 277 | ret = get_pll_limits(dev, reg, &pll); |
| 273 | if (ret) | 278 | if (ret) |
| 274 | return ret; | 279 | return ret; |
| @@ -286,7 +291,8 @@ nv50_crtc_set_clock(struct drm_device *dev, int head, int pclk) | |||
| 286 | nv_wr32(dev, reg, 0x10000611); | 291 | nv_wr32(dev, reg, 0x10000611); |
| 287 | nv_wr32(dev, reg + 4, reg1 | (M1 << 16) | N1); | 292 | nv_wr32(dev, reg + 4, reg1 | (M1 << 16) | N1); |
| 288 | nv_wr32(dev, reg + 8, reg2 | (P << 28) | (M2 << 16) | N2); | 293 | nv_wr32(dev, reg + 8, reg2 | (P << 28) | (M2 << 16) | N2); |
| 289 | } else { | 294 | } else |
| 295 | if (dev_priv->chipset < NV_C0) { | ||
| 290 | ret = nv50_calc_pll2(dev, &pll, pclk, &N1, &N2, &M1, &P); | 296 | ret = nv50_calc_pll2(dev, &pll, pclk, &N1, &N2, &M1, &P); |
| 291 | if (ret <= 0) | 297 | if (ret <= 0) |
| 292 | return 0; | 298 | return 0; |
| @@ -298,6 +304,17 @@ nv50_crtc_set_clock(struct drm_device *dev, int head, int pclk) | |||
| 298 | nv_wr32(dev, reg, 0x50000610); | 304 | nv_wr32(dev, reg, 0x50000610); |
| 299 | nv_wr32(dev, reg + 4, reg1 | (P << 16) | (M1 << 8) | N1); | 305 | nv_wr32(dev, reg + 4, reg1 | (P << 16) | (M1 << 8) | N1); |
| 300 | nv_wr32(dev, reg + 8, N2); | 306 | nv_wr32(dev, reg + 8, N2); |
| 307 | } else { | ||
| 308 | ret = nv50_calc_pll2(dev, &pll, pclk, &N1, &N2, &M1, &P); | ||
| 309 | if (ret <= 0) | ||
| 310 | return 0; | ||
| 311 | |||
| 312 | NV_DEBUG(dev, "pclk %d out %d N %d fN 0x%04x M %d P %d\n", | ||
| 313 | pclk, ret, N1, N2, M1, P); | ||
| 314 | |||
| 315 | nv_mask(dev, reg + 0x0c, 0x00000000, 0x00000100); | ||
| 316 | nv_wr32(dev, reg + 0x04, (P << 16) | (N1 << 8) | M1); | ||
| 317 | nv_wr32(dev, reg + 0x10, N2 << 16); | ||
| 301 | } | 318 | } |
| 302 | 319 | ||
| 303 | return 0; | 320 | return 0; |
| @@ -348,7 +365,7 @@ nv50_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | |||
| 348 | 365 | ||
| 349 | gem = drm_gem_object_lookup(dev, file_priv, buffer_handle); | 366 | gem = drm_gem_object_lookup(dev, file_priv, buffer_handle); |
| 350 | if (!gem) | 367 | if (!gem) |
| 351 | return -EINVAL; | 368 | return -ENOENT; |
| 352 | cursor = nouveau_gem_object(gem); | 369 | cursor = nouveau_gem_object(gem); |
| 353 | 370 | ||
| 354 | ret = nouveau_bo_map(cursor); | 371 | ret = nouveau_bo_map(cursor); |
| @@ -381,15 +398,12 @@ nv50_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) | |||
| 381 | 398 | ||
| 382 | static void | 399 | static void |
| 383 | nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, | 400 | nv50_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, |
| 384 | uint32_t size) | 401 | uint32_t start, uint32_t size) |
| 385 | { | 402 | { |
| 403 | int end = (start + size > 256) ? 256 : start + size, i; | ||
| 386 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 404 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
| 387 | int i; | ||
| 388 | |||
| 389 | if (size != 256) | ||
| 390 | return; | ||
| 391 | 405 | ||
| 392 | for (i = 0; i < 256; i++) { | 406 | for (i = start; i < end; i++) { |
| 393 | nv_crtc->lut.r[i] = r[i]; | 407 | nv_crtc->lut.r[i] = r[i]; |
| 394 | nv_crtc->lut.g[i] = g[i]; | 408 | nv_crtc->lut.g[i] = g[i]; |
| 395 | nv_crtc->lut.b[i] = b[i]; | 409 | nv_crtc->lut.b[i] = b[i]; |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index f13ad0de9c8f..612fa6d6a0cb 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
| @@ -76,7 +76,10 @@ nv50_evo_dmaobj_new(struct nouveau_channel *evo, uint32_t class, uint32_t name, | |||
| 76 | nv_wo32(dev, obj, 2, offset); | 76 | nv_wo32(dev, obj, 2, offset); |
| 77 | nv_wo32(dev, obj, 3, 0x00000000); | 77 | nv_wo32(dev, obj, 3, 0x00000000); |
| 78 | nv_wo32(dev, obj, 4, 0x00000000); | 78 | nv_wo32(dev, obj, 4, 0x00000000); |
| 79 | nv_wo32(dev, obj, 5, 0x00010000); | 79 | if (dev_priv->card_type < NV_C0) |
| 80 | nv_wo32(dev, obj, 5, 0x00010000); | ||
| 81 | else | ||
| 82 | nv_wo32(dev, obj, 5, 0x00020000); | ||
| 80 | dev_priv->engine.instmem.flush(dev); | 83 | dev_priv->engine.instmem.flush(dev); |
| 81 | 84 | ||
| 82 | return 0; | 85 | return 0; |
diff --git a/drivers/gpu/drm/nouveau/nvc0_fb.c b/drivers/gpu/drm/nouveau/nvc0_fb.c new file mode 100644 index 000000000000..26a996025dd2 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvc0_fb.c | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2010 Red Hat Inc. | ||
| 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 shall be included in | ||
| 12 | * all copies or substantial portions of the Software. | ||
| 13 | * | ||
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 21 | * | ||
| 22 | * Authors: Ben Skeggs | ||
| 23 | */ | ||
| 24 | |||
| 25 | #include "drmP.h" | ||
| 26 | |||
| 27 | #include "nouveau_drv.h" | ||
| 28 | |||
| 29 | int | ||
| 30 | nvc0_fb_init(struct drm_device *dev) | ||
| 31 | { | ||
| 32 | return 0; | ||
| 33 | } | ||
| 34 | |||
| 35 | void | ||
| 36 | nvc0_fb_takedown(struct drm_device *dev) | ||
| 37 | { | ||
| 38 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvc0_fifo.c b/drivers/gpu/drm/nouveau/nvc0_fifo.c new file mode 100644 index 000000000000..d64375871979 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvc0_fifo.c | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2010 Red Hat Inc. | ||
| 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 shall be included in | ||
| 12 | * all copies or substantial portions of the Software. | ||
| 13 | * | ||
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 21 | * | ||
| 22 | * Authors: Ben Skeggs | ||
| 23 | */ | ||
| 24 | |||
| 25 | #include "drmP.h" | ||
| 26 | |||
| 27 | #include "nouveau_drv.h" | ||
| 28 | |||
| 29 | void | ||
| 30 | nvc0_fifo_disable(struct drm_device *dev) | ||
| 31 | { | ||
| 32 | } | ||
| 33 | |||
| 34 | void | ||
| 35 | nvc0_fifo_enable(struct drm_device *dev) | ||
| 36 | { | ||
| 37 | } | ||
| 38 | |||
| 39 | bool | ||
| 40 | nvc0_fifo_reassign(struct drm_device *dev, bool enable) | ||
| 41 | { | ||
| 42 | return false; | ||
| 43 | } | ||
| 44 | |||
| 45 | bool | ||
| 46 | nvc0_fifo_cache_flush(struct drm_device *dev) | ||
| 47 | { | ||
| 48 | return true; | ||
| 49 | } | ||
| 50 | |||
| 51 | bool | ||
| 52 | nvc0_fifo_cache_pull(struct drm_device *dev, bool enable) | ||
| 53 | { | ||
| 54 | return false; | ||
| 55 | } | ||
| 56 | |||
| 57 | int | ||
| 58 | nvc0_fifo_channel_id(struct drm_device *dev) | ||
| 59 | { | ||
| 60 | return 127; | ||
| 61 | } | ||
| 62 | |||
| 63 | int | ||
| 64 | nvc0_fifo_create_context(struct nouveau_channel *chan) | ||
| 65 | { | ||
| 66 | return 0; | ||
| 67 | } | ||
| 68 | |||
| 69 | void | ||
| 70 | nvc0_fifo_destroy_context(struct nouveau_channel *chan) | ||
| 71 | { | ||
| 72 | } | ||
| 73 | |||
| 74 | int | ||
| 75 | nvc0_fifo_load_context(struct nouveau_channel *chan) | ||
| 76 | { | ||
| 77 | return 0; | ||
| 78 | } | ||
| 79 | |||
| 80 | int | ||
| 81 | nvc0_fifo_unload_context(struct drm_device *dev) | ||
| 82 | { | ||
| 83 | return 0; | ||
| 84 | } | ||
| 85 | |||
| 86 | void | ||
| 87 | nvc0_fifo_takedown(struct drm_device *dev) | ||
| 88 | { | ||
| 89 | } | ||
| 90 | |||
| 91 | int | ||
| 92 | nvc0_fifo_init(struct drm_device *dev) | ||
| 93 | { | ||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | |||
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c new file mode 100644 index 000000000000..717a5177a8d8 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvc0_graph.c | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2010 Red Hat Inc. | ||
| 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 shall be included in | ||
| 12 | * all copies or substantial portions of the Software. | ||
| 13 | * | ||
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 21 | * | ||
| 22 | * Authors: Ben Skeggs | ||
| 23 | */ | ||
| 24 | |||
| 25 | #include "drmP.h" | ||
| 26 | |||
| 27 | #include "nouveau_drv.h" | ||
| 28 | |||
| 29 | void | ||
| 30 | nvc0_graph_fifo_access(struct drm_device *dev, bool enabled) | ||
| 31 | { | ||
| 32 | } | ||
| 33 | |||
| 34 | struct nouveau_channel * | ||
| 35 | nvc0_graph_channel(struct drm_device *dev) | ||
| 36 | { | ||
| 37 | return NULL; | ||
| 38 | } | ||
| 39 | |||
| 40 | int | ||
| 41 | nvc0_graph_create_context(struct nouveau_channel *chan) | ||
| 42 | { | ||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | |||
| 46 | void | ||
| 47 | nvc0_graph_destroy_context(struct nouveau_channel *chan) | ||
| 48 | { | ||
| 49 | } | ||
| 50 | |||
| 51 | int | ||
| 52 | nvc0_graph_load_context(struct nouveau_channel *chan) | ||
| 53 | { | ||
| 54 | return 0; | ||
| 55 | } | ||
| 56 | |||
| 57 | int | ||
| 58 | nvc0_graph_unload_context(struct drm_device *dev) | ||
| 59 | { | ||
| 60 | return 0; | ||
| 61 | } | ||
| 62 | |||
| 63 | void | ||
| 64 | nvc0_graph_takedown(struct drm_device *dev) | ||
| 65 | { | ||
| 66 | } | ||
| 67 | |||
| 68 | int | ||
| 69 | nvc0_graph_init(struct drm_device *dev) | ||
| 70 | { | ||
| 71 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 72 | dev_priv->engine.graph.accel_blocked = true; | ||
| 73 | return 0; | ||
| 74 | } | ||
| 75 | |||
diff --git a/drivers/gpu/drm/nouveau/nvc0_instmem.c b/drivers/gpu/drm/nouveau/nvc0_instmem.c new file mode 100644 index 000000000000..3ab3cdc42173 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvc0_instmem.c | |||
| @@ -0,0 +1,232 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2010 Red Hat Inc. | ||
| 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 shall be included in | ||
| 12 | * all copies or substantial portions of the Software. | ||
| 13 | * | ||
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 21 | * | ||
| 22 | * Authors: Ben Skeggs | ||
| 23 | */ | ||
| 24 | |||
| 25 | #include "drmP.h" | ||
| 26 | |||
| 27 | #include "nouveau_drv.h" | ||
| 28 | |||
| 29 | int | ||
| 30 | nvc0_instmem_populate(struct drm_device *dev, struct nouveau_gpuobj *gpuobj, | ||
| 31 | uint32_t *size) | ||
| 32 | { | ||
| 33 | int ret; | ||
| 34 | |||
| 35 | *size = ALIGN(*size, 4096); | ||
| 36 | if (*size == 0) | ||
| 37 | return -EINVAL; | ||
| 38 | |||
| 39 | ret = nouveau_bo_new(dev, NULL, *size, 0, TTM_PL_FLAG_VRAM, 0, 0x0000, | ||
| 40 | true, false, &gpuobj->im_backing); | ||
| 41 | if (ret) { | ||
| 42 | NV_ERROR(dev, "error getting PRAMIN backing pages: %d\n", ret); | ||
| 43 | return ret; | ||
| 44 | } | ||
| 45 | |||
| 46 | ret = nouveau_bo_pin(gpuobj->im_backing, TTM_PL_FLAG_VRAM); | ||
| 47 | if (ret) { | ||
| 48 | NV_ERROR(dev, "error pinning PRAMIN backing VRAM: %d\n", ret); | ||
| 49 | nouveau_bo_ref(NULL, &gpuobj->im_backing); | ||
| 50 | return ret; | ||
| 51 | } | ||
| 52 | |||
| 53 | gpuobj->im_backing_start = gpuobj->im_backing->bo.mem.mm_node->start; | ||
| 54 | gpuobj->im_backing_start <<= PAGE_SHIFT; | ||
| 55 | return 0; | ||
| 56 | } | ||
| 57 | |||
| 58 | void | ||
| 59 | nvc0_instmem_clear(struct drm_device *dev, struct nouveau_gpuobj *gpuobj) | ||
| 60 | { | ||
| 61 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 62 | |||
| 63 | if (gpuobj && gpuobj->im_backing) { | ||
| 64 | if (gpuobj->im_bound) | ||
| 65 | dev_priv->engine.instmem.unbind(dev, gpuobj); | ||
| 66 | nouveau_bo_unpin(gpuobj->im_backing); | ||
| 67 | nouveau_bo_ref(NULL, &gpuobj->im_backing); | ||
| 68 | gpuobj->im_backing = NULL; | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | int | ||
| 73 | nvc0_instmem_bind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj) | ||
| 74 | { | ||
| 75 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 76 | uint32_t pte, pte_end; | ||
| 77 | uint64_t vram; | ||
| 78 | |||
| 79 | if (!gpuobj->im_backing || !gpuobj->im_pramin || gpuobj->im_bound) | ||
| 80 | return -EINVAL; | ||
| 81 | |||
| 82 | NV_DEBUG(dev, "st=0x%lx sz=0x%lx\n", | ||
| 83 | gpuobj->im_pramin->start, gpuobj->im_pramin->size); | ||
| 84 | |||
| 85 | pte = gpuobj->im_pramin->start >> 12; | ||
| 86 | pte_end = (gpuobj->im_pramin->size >> 12) + pte; | ||
| 87 | vram = gpuobj->im_backing_start; | ||
| 88 | |||
| 89 | NV_DEBUG(dev, "pramin=0x%lx, pte=%d, pte_end=%d\n", | ||
| 90 | gpuobj->im_pramin->start, pte, pte_end); | ||
| 91 | NV_DEBUG(dev, "first vram page: 0x%08x\n", gpuobj->im_backing_start); | ||
| 92 | |||
| 93 | while (pte < pte_end) { | ||
| 94 | nv_wr32(dev, 0x702000 + (pte * 8), (vram >> 8) | 1); | ||
| 95 | nv_wr32(dev, 0x702004 + (pte * 8), 0); | ||
| 96 | vram += 4096; | ||
| 97 | pte++; | ||
| 98 | } | ||
| 99 | dev_priv->engine.instmem.flush(dev); | ||
| 100 | |||
| 101 | if (1) { | ||
| 102 | u32 chan = nv_rd32(dev, 0x1700) << 16; | ||
| 103 | nv_wr32(dev, 0x100cb8, (chan + 0x1000) >> 8); | ||
| 104 | nv_wr32(dev, 0x100cbc, 0x80000005); | ||
| 105 | } | ||
| 106 | |||
| 107 | gpuobj->im_bound = 1; | ||
| 108 | return 0; | ||
| 109 | } | ||
| 110 | |||
| 111 | int | ||
| 112 | nvc0_instmem_unbind(struct drm_device *dev, struct nouveau_gpuobj *gpuobj) | ||
| 113 | { | ||
| 114 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 115 | uint32_t pte, pte_end; | ||
| 116 | |||
| 117 | if (gpuobj->im_bound == 0) | ||
| 118 | return -EINVAL; | ||
| 119 | |||
| 120 | pte = gpuobj->im_pramin->start >> 12; | ||
| 121 | pte_end = (gpuobj->im_pramin->size >> 12) + pte; | ||
| 122 | while (pte < pte_end) { | ||
| 123 | nv_wr32(dev, 0x702000 + (pte * 8), 0); | ||
| 124 | nv_wr32(dev, 0x702004 + (pte * 8), 0); | ||
| 125 | pte++; | ||
| 126 | } | ||
| 127 | dev_priv->engine.instmem.flush(dev); | ||
| 128 | |||
| 129 | gpuobj->im_bound = 0; | ||
| 130 | return 0; | ||
| 131 | } | ||
| 132 | |||
| 133 | void | ||
| 134 | nvc0_instmem_flush(struct drm_device *dev) | ||
| 135 | { | ||
| 136 | nv_wr32(dev, 0x070000, 1); | ||
| 137 | if (!nv_wait(0x070000, 0x00000002, 0x00000000)) | ||
| 138 | NV_ERROR(dev, "PRAMIN flush timeout\n"); | ||
| 139 | } | ||
| 140 | |||
| 141 | int | ||
| 142 | nvc0_instmem_suspend(struct drm_device *dev) | ||
| 143 | { | ||
| 144 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 145 | int i; | ||
| 146 | |||
| 147 | dev_priv->susres.ramin_copy = vmalloc(65536); | ||
| 148 | if (!dev_priv->susres.ramin_copy) | ||
| 149 | return -ENOMEM; | ||
| 150 | |||
| 151 | for (i = 0x700000; i < 0x710000; i += 4) | ||
| 152 | dev_priv->susres.ramin_copy[i/4] = nv_rd32(dev, i); | ||
| 153 | return 0; | ||
| 154 | } | ||
| 155 | |||
| 156 | void | ||
| 157 | nvc0_instmem_resume(struct drm_device *dev) | ||
| 158 | { | ||
| 159 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 160 | u64 chan; | ||
| 161 | int i; | ||
| 162 | |||
| 163 | chan = dev_priv->vram_size - dev_priv->ramin_rsvd_vram; | ||
| 164 | nv_wr32(dev, 0x001700, chan >> 16); | ||
| 165 | |||
| 166 | for (i = 0x700000; i < 0x710000; i += 4) | ||
| 167 | nv_wr32(dev, i, dev_priv->susres.ramin_copy[i/4]); | ||
| 168 | vfree(dev_priv->susres.ramin_copy); | ||
| 169 | dev_priv->susres.ramin_copy = NULL; | ||
| 170 | |||
| 171 | nv_wr32(dev, 0x001714, 0xc0000000 | (chan >> 12)); | ||
| 172 | } | ||
| 173 | |||
| 174 | int | ||
| 175 | nvc0_instmem_init(struct drm_device *dev) | ||
| 176 | { | ||
| 177 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
| 178 | u64 chan, pgt3, imem, lim3 = dev_priv->ramin_size - 1; | ||
| 179 | int ret, i; | ||
| 180 | |||
| 181 | dev_priv->ramin_rsvd_vram = 1 * 1024 * 1024; | ||
| 182 | chan = dev_priv->vram_size - dev_priv->ramin_rsvd_vram; | ||
| 183 | imem = 4096 + 4096 + 32768; | ||
| 184 | |||
| 185 | nv_wr32(dev, 0x001700, chan >> 16); | ||
| 186 | |||
| 187 | /* channel setup */ | ||
| 188 | nv_wr32(dev, 0x700200, lower_32_bits(chan + 0x1000)); | ||
| 189 | nv_wr32(dev, 0x700204, upper_32_bits(chan + 0x1000)); | ||
| 190 | nv_wr32(dev, 0x700208, lower_32_bits(lim3)); | ||
| 191 | nv_wr32(dev, 0x70020c, upper_32_bits(lim3)); | ||
| 192 | |||
| 193 | /* point pgd -> pgt */ | ||
| 194 | nv_wr32(dev, 0x701000, 0); | ||
| 195 | nv_wr32(dev, 0x701004, ((chan + 0x2000) >> 8) | 1); | ||
| 196 | |||
| 197 | /* point pgt -> physical vram for channel */ | ||
| 198 | pgt3 = 0x2000; | ||
| 199 | for (i = 0; i < dev_priv->ramin_rsvd_vram; i += 4096, pgt3 += 8) { | ||
| 200 | nv_wr32(dev, 0x700000 + pgt3, ((chan + i) >> 8) | 1); | ||
| 201 | nv_wr32(dev, 0x700004 + pgt3, 0); | ||
| 202 | } | ||
| 203 | |||
| 204 | /* clear rest of pgt */ | ||
| 205 | for (; i < dev_priv->ramin_size; i += 4096, pgt3 += 8) { | ||
| 206 | nv_wr32(dev, 0x700000 + pgt3, 0); | ||
| 207 | nv_wr32(dev, 0x700004 + pgt3, 0); | ||
| 208 | } | ||
| 209 | |||
| 210 | /* point bar3 at the channel */ | ||
| 211 | nv_wr32(dev, 0x001714, 0xc0000000 | (chan >> 12)); | ||
| 212 | |||
| 213 | /* Global PRAMIN heap */ | ||
| 214 | ret = drm_mm_init(&dev_priv->ramin_heap, imem, | ||
| 215 | dev_priv->ramin_size - imem); | ||
| 216 | if (ret) { | ||
| 217 | NV_ERROR(dev, "Failed to init RAMIN heap\n"); | ||
| 218 | return -ENOMEM; | ||
| 219 | } | ||
| 220 | |||
| 221 | /*XXX: incorrect, but needed to make hash func "work" */ | ||
| 222 | dev_priv->ramht_offset = 0x10000; | ||
| 223 | dev_priv->ramht_bits = 9; | ||
| 224 | dev_priv->ramht_size = (1 << dev_priv->ramht_bits); | ||
| 225 | return 0; | ||
| 226 | } | ||
| 227 | |||
| 228 | void | ||
| 229 | nvc0_instmem_takedown(struct drm_device *dev) | ||
| 230 | { | ||
| 231 | } | ||
| 232 | |||
diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c index 68e6f4349309..4f4cd8b286d5 100644 --- a/drivers/gpu/drm/radeon/r600_cp.c +++ b/drivers/gpu/drm/radeon/r600_cp.c | |||
| @@ -200,7 +200,7 @@ int r600_page_table_init(struct drm_device *dev) | |||
| 200 | entry->pagelist[i], 0, | 200 | entry->pagelist[i], 0, |
| 201 | PAGE_SIZE, | 201 | PAGE_SIZE, |
| 202 | PCI_DMA_BIDIRECTIONAL); | 202 | PCI_DMA_BIDIRECTIONAL); |
| 203 | if (entry->busaddr[i] == 0) { | 203 | if (pci_dma_mapping_error(dev->pdev, entry->busaddr[i])) { |
| 204 | DRM_ERROR("unable to map PCIGART pages!\n"); | 204 | DRM_ERROR("unable to map PCIGART pages!\n"); |
| 205 | r600_page_table_cleanup(dev, gart_info); | 205 | r600_page_table_cleanup(dev, gart_info); |
| 206 | goto done; | 206 | goto done; |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index c3ea212e0c3c..d8864949e387 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
| @@ -133,6 +133,7 @@ static inline int r600_bpe_from_format(u32 *bpe, u32 format) | |||
| 133 | case V_038004_FMT_GB_GR: | 133 | case V_038004_FMT_GB_GR: |
| 134 | case V_038004_FMT_BG_RG: | 134 | case V_038004_FMT_BG_RG: |
| 135 | case V_038004_COLOR_INVALID: | 135 | case V_038004_COLOR_INVALID: |
| 136 | default: | ||
| 136 | *bpe = 16; | 137 | *bpe = 16; |
| 137 | return -EINVAL; | 138 | return -EINVAL; |
| 138 | } | 139 | } |
| @@ -174,7 +175,7 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) | |||
| 174 | dev_warn(p->dev, "FMASK or CMASK buffer are not supported by this kernel\n"); | 175 | dev_warn(p->dev, "FMASK or CMASK buffer are not supported by this kernel\n"); |
| 175 | return -EINVAL; | 176 | return -EINVAL; |
| 176 | } | 177 | } |
| 177 | size = radeon_bo_size(track->cb_color_bo[i]); | 178 | size = radeon_bo_size(track->cb_color_bo[i]) - track->cb_color_bo_offset[i]; |
| 178 | if (r600_bpe_from_format(&bpe, G_0280A0_FORMAT(track->cb_color_info[i]))) { | 179 | if (r600_bpe_from_format(&bpe, G_0280A0_FORMAT(track->cb_color_info[i]))) { |
| 179 | dev_warn(p->dev, "%s:%d cb invalid format %d for %d (0x%08X)\n", | 180 | dev_warn(p->dev, "%s:%d cb invalid format %d for %d (0x%08X)\n", |
| 180 | __func__, __LINE__, G_0280A0_FORMAT(track->cb_color_info[i]), | 181 | __func__, __LINE__, G_0280A0_FORMAT(track->cb_color_info[i]), |
| @@ -327,7 +328,6 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) | |||
| 327 | dev_warn(p->dev, "z/stencil buffer size not set\n"); | 328 | dev_warn(p->dev, "z/stencil buffer size not set\n"); |
| 328 | return -EINVAL; | 329 | return -EINVAL; |
| 329 | } | 330 | } |
| 330 | printk_once(KERN_WARNING "You have old & broken userspace please consider updating mesa\n"); | ||
| 331 | tmp = radeon_bo_size(track->db_bo) - track->db_offset; | 331 | tmp = radeon_bo_size(track->db_bo) - track->db_offset; |
| 332 | tmp = (tmp / bpe) >> 6; | 332 | tmp = (tmp / bpe) >> 6; |
| 333 | if (!tmp) { | 333 | if (!tmp) { |
| @@ -882,8 +882,6 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx | |||
| 882 | return -EINVAL; | 882 | return -EINVAL; |
| 883 | } | 883 | } |
| 884 | ib[idx] = track->cb_color_base_last[tmp]; | 884 | ib[idx] = track->cb_color_base_last[tmp]; |
| 885 | printk_once(KERN_WARNING "You have old & broken userspace " | ||
| 886 | "please consider updating mesa & xf86-video-ati\n"); | ||
| 887 | track->cb_color_frag_bo[tmp] = track->cb_color_bo[tmp]; | 885 | track->cb_color_frag_bo[tmp] = track->cb_color_bo[tmp]; |
| 888 | } else { | 886 | } else { |
| 889 | r = r600_cs_packet_next_reloc(p, &reloc); | 887 | r = r600_cs_packet_next_reloc(p, &reloc); |
| @@ -910,8 +908,6 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx | |||
| 910 | return -EINVAL; | 908 | return -EINVAL; |
| 911 | } | 909 | } |
| 912 | ib[idx] = track->cb_color_base_last[tmp]; | 910 | ib[idx] = track->cb_color_base_last[tmp]; |
| 913 | printk_once(KERN_WARNING "You have old & broken userspace " | ||
| 914 | "please consider updating mesa & xf86-video-ati\n"); | ||
| 915 | track->cb_color_tile_bo[tmp] = track->cb_color_bo[tmp]; | 911 | track->cb_color_tile_bo[tmp] = track->cb_color_bo[tmp]; |
| 916 | } else { | 912 | } else { |
| 917 | r = r600_cs_packet_next_reloc(p, &reloc); | 913 | r = r600_cs_packet_next_reloc(p, &reloc); |
| @@ -938,7 +934,7 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx | |||
| 938 | return -EINVAL; | 934 | return -EINVAL; |
| 939 | } | 935 | } |
| 940 | tmp = (reg - CB_COLOR0_BASE) / 4; | 936 | tmp = (reg - CB_COLOR0_BASE) / 4; |
| 941 | track->cb_color_bo_offset[tmp] = radeon_get_ib_value(p, idx); | 937 | track->cb_color_bo_offset[tmp] = radeon_get_ib_value(p, idx) << 8; |
| 942 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 938 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
| 943 | track->cb_color_base_last[tmp] = ib[idx]; | 939 | track->cb_color_base_last[tmp] = ib[idx]; |
| 944 | track->cb_color_bo[tmp] = reloc->robj; | 940 | track->cb_color_bo[tmp] = reloc->robj; |
| @@ -950,7 +946,7 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx | |||
| 950 | "0x%04X\n", reg); | 946 | "0x%04X\n", reg); |
| 951 | return -EINVAL; | 947 | return -EINVAL; |
| 952 | } | 948 | } |
| 953 | track->db_offset = radeon_get_ib_value(p, idx); | 949 | track->db_offset = radeon_get_ib_value(p, idx) << 8; |
| 954 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 950 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
| 955 | track->db_bo = reloc->robj; | 951 | track->db_bo = reloc->robj; |
| 956 | break; | 952 | break; |
| @@ -1055,10 +1051,10 @@ static void r600_texture_size(unsigned nfaces, unsigned blevel, unsigned nlevels | |||
| 1055 | } | 1051 | } |
| 1056 | *l0_size = ALIGN((w0 * bpe), pitch_align) * h0 * d0; | 1052 | *l0_size = ALIGN((w0 * bpe), pitch_align) * h0 * d0; |
| 1057 | *mipmap_size = offset; | 1053 | *mipmap_size = offset; |
| 1058 | if (!blevel) | ||
| 1059 | *mipmap_size -= *l0_size; | ||
| 1060 | if (!nlevels) | 1054 | if (!nlevels) |
| 1061 | *mipmap_size = *l0_size; | 1055 | *mipmap_size = *l0_size; |
| 1056 | if (!blevel) | ||
| 1057 | *mipmap_size -= *l0_size; | ||
| 1062 | } | 1058 | } |
| 1063 | 1059 | ||
| 1064 | /** | 1060 | /** |
| @@ -1165,14 +1161,14 @@ static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 i | |||
| 1165 | (pitch_align * bpe), | 1161 | (pitch_align * bpe), |
| 1166 | &l0_size, &mipmap_size); | 1162 | &l0_size, &mipmap_size); |
| 1167 | /* using get ib will give us the offset into the texture bo */ | 1163 | /* using get ib will give us the offset into the texture bo */ |
| 1168 | word0 = radeon_get_ib_value(p, idx + 2); | 1164 | word0 = radeon_get_ib_value(p, idx + 2) << 8; |
| 1169 | if ((l0_size + word0) > radeon_bo_size(texture)) { | 1165 | if ((l0_size + word0) > radeon_bo_size(texture)) { |
| 1170 | dev_warn(p->dev, "texture bo too small (%d %d %d %d -> %d have %ld)\n", | 1166 | dev_warn(p->dev, "texture bo too small (%d %d %d %d -> %d have %ld)\n", |
| 1171 | w0, h0, bpe, word0, l0_size, radeon_bo_size(texture)); | 1167 | w0, h0, bpe, word0, l0_size, radeon_bo_size(texture)); |
| 1172 | return -EINVAL; | 1168 | return -EINVAL; |
| 1173 | } | 1169 | } |
| 1174 | /* using get ib will give us the offset into the mipmap bo */ | 1170 | /* using get ib will give us the offset into the mipmap bo */ |
| 1175 | word0 = radeon_get_ib_value(p, idx + 3); | 1171 | word0 = radeon_get_ib_value(p, idx + 3) << 8; |
| 1176 | if ((mipmap_size + word0) > radeon_bo_size(mipmap)) { | 1172 | if ((mipmap_size + word0) > radeon_bo_size(mipmap)) { |
| 1177 | dev_warn(p->dev, "mipmap bo too small (%d %d %d %d %d %d -> %d have %ld)\n", | 1173 | dev_warn(p->dev, "mipmap bo too small (%d %d %d %d %d %d -> %d have %ld)\n", |
| 1178 | w0, h0, bpe, blevel, nlevels, word0, mipmap_size, radeon_bo_size(texture)); | 1174 | w0, h0, bpe, blevel, nlevels, word0, mipmap_size, radeon_bo_size(texture)); |
| @@ -1366,7 +1362,7 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
| 1366 | } | 1362 | } |
| 1367 | for (i = 0; i < (pkt->count / 7); i++) { | 1363 | for (i = 0; i < (pkt->count / 7); i++) { |
| 1368 | struct radeon_bo *texture, *mipmap; | 1364 | struct radeon_bo *texture, *mipmap; |
| 1369 | u32 size, offset; | 1365 | u32 size, offset, base_offset, mip_offset; |
| 1370 | 1366 | ||
| 1371 | switch (G__SQ_VTX_CONSTANT_TYPE(radeon_get_ib_value(p, idx+(i*7)+6+1))) { | 1367 | switch (G__SQ_VTX_CONSTANT_TYPE(radeon_get_ib_value(p, idx+(i*7)+6+1))) { |
| 1372 | case SQ_TEX_VTX_VALID_TEXTURE: | 1368 | case SQ_TEX_VTX_VALID_TEXTURE: |
| @@ -1376,7 +1372,7 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
| 1376 | DRM_ERROR("bad SET_RESOURCE\n"); | 1372 | DRM_ERROR("bad SET_RESOURCE\n"); |
| 1377 | return -EINVAL; | 1373 | return -EINVAL; |
| 1378 | } | 1374 | } |
| 1379 | ib[idx+1+(i*7)+2] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1375 | base_offset = (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
| 1380 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) | 1376 | if (reloc->lobj.tiling_flags & RADEON_TILING_MACRO) |
| 1381 | ib[idx+1+(i*7)+0] |= S_038000_TILE_MODE(V_038000_ARRAY_2D_TILED_THIN1); | 1377 | ib[idx+1+(i*7)+0] |= S_038000_TILE_MODE(V_038000_ARRAY_2D_TILED_THIN1); |
| 1382 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) | 1378 | else if (reloc->lobj.tiling_flags & RADEON_TILING_MICRO) |
| @@ -1388,12 +1384,14 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
| 1388 | DRM_ERROR("bad SET_RESOURCE\n"); | 1384 | DRM_ERROR("bad SET_RESOURCE\n"); |
| 1389 | return -EINVAL; | 1385 | return -EINVAL; |
| 1390 | } | 1386 | } |
| 1391 | ib[idx+1+(i*7)+3] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 1387 | mip_offset = (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
| 1392 | mipmap = reloc->robj; | 1388 | mipmap = reloc->robj; |
| 1393 | r = r600_check_texture_resource(p, idx+(i*7)+1, | 1389 | r = r600_check_texture_resource(p, idx+(i*7)+1, |
| 1394 | texture, mipmap, reloc->lobj.tiling_flags); | 1390 | texture, mipmap, reloc->lobj.tiling_flags); |
| 1395 | if (r) | 1391 | if (r) |
| 1396 | return r; | 1392 | return r; |
| 1393 | ib[idx+1+(i*7)+2] += base_offset; | ||
| 1394 | ib[idx+1+(i*7)+3] += mip_offset; | ||
| 1397 | break; | 1395 | break; |
| 1398 | case SQ_TEX_VTX_VALID_BUFFER: | 1396 | case SQ_TEX_VTX_VALID_BUFFER: |
| 1399 | /* vtx base */ | 1397 | /* vtx base */ |
| @@ -1403,10 +1401,11 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
| 1403 | return -EINVAL; | 1401 | return -EINVAL; |
| 1404 | } | 1402 | } |
| 1405 | offset = radeon_get_ib_value(p, idx+1+(i*7)+0); | 1403 | offset = radeon_get_ib_value(p, idx+1+(i*7)+0); |
| 1406 | size = radeon_get_ib_value(p, idx+1+(i*7)+1); | 1404 | size = radeon_get_ib_value(p, idx+1+(i*7)+1) + 1; |
| 1407 | if (p->rdev && (size + offset) > radeon_bo_size(reloc->robj)) { | 1405 | if (p->rdev && (size + offset) > radeon_bo_size(reloc->robj)) { |
| 1408 | /* force size to size of the buffer */ | 1406 | /* force size to size of the buffer */ |
| 1409 | dev_warn(p->dev, "vbo resource seems too big for the bo\n"); | 1407 | dev_warn(p->dev, "vbo resource seems too big (%d) for the bo (%ld)\n", |
| 1408 | size + offset, radeon_bo_size(reloc->robj)); | ||
| 1410 | ib[idx+1+(i*7)+1] = radeon_bo_size(reloc->robj); | 1409 | ib[idx+1+(i*7)+1] = radeon_bo_size(reloc->robj); |
| 1411 | } | 1410 | } |
| 1412 | ib[idx+1+(i*7)+0] += (u32)((reloc->lobj.gpu_offset) & 0xffffffff); | 1411 | ib[idx+1+(i*7)+0] += (u32)((reloc->lobj.gpu_offset) & 0xffffffff); |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 3cd1c470b777..3dfcfa3ca425 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
| @@ -1100,6 +1100,8 @@ struct radeon_device { | |||
| 1100 | struct notifier_block acpi_nb; | 1100 | struct notifier_block acpi_nb; |
| 1101 | /* only one userspace can use Hyperz features at a time */ | 1101 | /* only one userspace can use Hyperz features at a time */ |
| 1102 | struct drm_file *hyperz_filp; | 1102 | struct drm_file *hyperz_filp; |
| 1103 | /* i2c buses */ | ||
| 1104 | struct radeon_i2c_chan *i2c_bus[RADEON_MAX_I2C_BUS]; | ||
| 1103 | }; | 1105 | }; |
| 1104 | 1106 | ||
| 1105 | int radeon_device_init(struct radeon_device *rdev, | 1107 | int radeon_device_init(struct radeon_device *rdev, |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 3bc2bcdf5308..6d30868744ee 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
| @@ -48,7 +48,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 48 | struct radeon_i2c_bus_rec *i2c_bus, | 48 | struct radeon_i2c_bus_rec *i2c_bus, |
| 49 | bool linkb, uint32_t igp_lane_info, | 49 | bool linkb, uint32_t igp_lane_info, |
| 50 | uint16_t connector_object_id, | 50 | uint16_t connector_object_id, |
| 51 | struct radeon_hpd *hpd); | 51 | struct radeon_hpd *hpd, |
| 52 | struct radeon_router *router); | ||
| 52 | 53 | ||
| 53 | /* from radeon_legacy_encoder.c */ | 54 | /* from radeon_legacy_encoder.c */ |
| 54 | extern void | 55 | extern void |
| @@ -114,7 +115,8 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev | |||
| 114 | 115 | ||
| 115 | i2c.i2c_id = gpio->sucI2cId.ucAccess; | 116 | i2c.i2c_id = gpio->sucI2cId.ucAccess; |
| 116 | 117 | ||
| 117 | i2c.valid = true; | 118 | if (i2c.mask_clk_reg) |
| 119 | i2c.valid = true; | ||
| 118 | break; | 120 | break; |
| 119 | } | 121 | } |
| 120 | } | 122 | } |
| @@ -123,6 +125,66 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev | |||
| 123 | return i2c; | 125 | return i2c; |
| 124 | } | 126 | } |
| 125 | 127 | ||
| 128 | void radeon_atombios_i2c_init(struct radeon_device *rdev) | ||
| 129 | { | ||
| 130 | struct atom_context *ctx = rdev->mode_info.atom_context; | ||
| 131 | ATOM_GPIO_I2C_ASSIGMENT *gpio; | ||
| 132 | struct radeon_i2c_bus_rec i2c; | ||
| 133 | int index = GetIndexIntoMasterTable(DATA, GPIO_I2C_Info); | ||
| 134 | struct _ATOM_GPIO_I2C_INFO *i2c_info; | ||
| 135 | uint16_t data_offset, size; | ||
| 136 | int i, num_indices; | ||
| 137 | char stmp[32]; | ||
| 138 | |||
| 139 | memset(&i2c, 0, sizeof(struct radeon_i2c_bus_rec)); | ||
| 140 | |||
| 141 | if (atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset)) { | ||
| 142 | i2c_info = (struct _ATOM_GPIO_I2C_INFO *)(ctx->bios + data_offset); | ||
| 143 | |||
| 144 | num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / | ||
| 145 | sizeof(ATOM_GPIO_I2C_ASSIGMENT); | ||
| 146 | |||
| 147 | for (i = 0; i < num_indices; i++) { | ||
| 148 | gpio = &i2c_info->asGPIO_Info[i]; | ||
| 149 | i2c.valid = false; | ||
| 150 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; | ||
| 151 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; | ||
| 152 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; | ||
| 153 | i2c.en_data_reg = le16_to_cpu(gpio->usDataEnRegisterIndex) * 4; | ||
| 154 | i2c.y_clk_reg = le16_to_cpu(gpio->usClkY_RegisterIndex) * 4; | ||
| 155 | i2c.y_data_reg = le16_to_cpu(gpio->usDataY_RegisterIndex) * 4; | ||
| 156 | i2c.a_clk_reg = le16_to_cpu(gpio->usClkA_RegisterIndex) * 4; | ||
| 157 | i2c.a_data_reg = le16_to_cpu(gpio->usDataA_RegisterIndex) * 4; | ||
| 158 | i2c.mask_clk_mask = (1 << gpio->ucClkMaskShift); | ||
| 159 | i2c.mask_data_mask = (1 << gpio->ucDataMaskShift); | ||
| 160 | i2c.en_clk_mask = (1 << gpio->ucClkEnShift); | ||
| 161 | i2c.en_data_mask = (1 << gpio->ucDataEnShift); | ||
| 162 | i2c.y_clk_mask = (1 << gpio->ucClkY_Shift); | ||
| 163 | i2c.y_data_mask = (1 << gpio->ucDataY_Shift); | ||
| 164 | i2c.a_clk_mask = (1 << gpio->ucClkA_Shift); | ||
| 165 | i2c.a_data_mask = (1 << gpio->ucDataA_Shift); | ||
| 166 | |||
| 167 | if (gpio->sucI2cId.sbfAccess.bfHW_Capable) | ||
| 168 | i2c.hw_capable = true; | ||
| 169 | else | ||
| 170 | i2c.hw_capable = false; | ||
| 171 | |||
| 172 | if (gpio->sucI2cId.ucAccess == 0xa0) | ||
| 173 | i2c.mm_i2c = true; | ||
| 174 | else | ||
| 175 | i2c.mm_i2c = false; | ||
| 176 | |||
| 177 | i2c.i2c_id = gpio->sucI2cId.ucAccess; | ||
| 178 | |||
| 179 | if (i2c.mask_clk_reg) { | ||
| 180 | i2c.valid = true; | ||
| 181 | sprintf(stmp, "0x%x", i2c.i2c_id); | ||
| 182 | rdev->i2c_bus[i] = radeon_i2c_create(rdev->ddev, &i2c, stmp); | ||
| 183 | } | ||
| 184 | } | ||
| 185 | } | ||
| 186 | } | ||
| 187 | |||
| 126 | static inline struct radeon_gpio_rec radeon_lookup_gpio(struct radeon_device *rdev, | 188 | static inline struct radeon_gpio_rec radeon_lookup_gpio(struct radeon_device *rdev, |
| 127 | u8 id) | 189 | u8 id) |
| 128 | { | 190 | { |
| @@ -206,6 +268,7 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
| 206 | uint16_t *line_mux, | 268 | uint16_t *line_mux, |
| 207 | struct radeon_hpd *hpd) | 269 | struct radeon_hpd *hpd) |
| 208 | { | 270 | { |
| 271 | struct radeon_device *rdev = dev->dev_private; | ||
| 209 | 272 | ||
| 210 | /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ | 273 | /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ |
| 211 | if ((dev->pdev->device == 0x791e) && | 274 | if ((dev->pdev->device == 0x791e) && |
| @@ -308,13 +371,22 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
| 308 | } | 371 | } |
| 309 | } | 372 | } |
| 310 | 373 | ||
| 311 | /* Acer laptop reports DVI-D as DVI-I */ | 374 | /* Acer laptop reports DVI-D as DVI-I and hpd pins reversed */ |
| 312 | if ((dev->pdev->device == 0x95c4) && | 375 | if ((dev->pdev->device == 0x95c4) && |
| 313 | (dev->pdev->subsystem_vendor == 0x1025) && | 376 | (dev->pdev->subsystem_vendor == 0x1025) && |
| 314 | (dev->pdev->subsystem_device == 0x013c)) { | 377 | (dev->pdev->subsystem_device == 0x013c)) { |
| 378 | struct radeon_gpio_rec gpio; | ||
| 379 | |||
| 315 | if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && | 380 | if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && |
| 316 | (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) | 381 | (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) { |
| 382 | gpio = radeon_lookup_gpio(rdev, 6); | ||
| 383 | *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio); | ||
| 317 | *connector_type = DRM_MODE_CONNECTOR_DVID; | 384 | *connector_type = DRM_MODE_CONNECTOR_DVID; |
| 385 | } else if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) && | ||
| 386 | (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) { | ||
| 387 | gpio = radeon_lookup_gpio(rdev, 7); | ||
| 388 | *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio); | ||
| 389 | } | ||
| 318 | } | 390 | } |
| 319 | 391 | ||
| 320 | /* XFX Pine Group device rv730 reports no VGA DDC lines | 392 | /* XFX Pine Group device rv730 reports no VGA DDC lines |
| @@ -399,13 +471,15 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
| 399 | u16 size, data_offset; | 471 | u16 size, data_offset; |
| 400 | u8 frev, crev; | 472 | u8 frev, crev; |
| 401 | ATOM_CONNECTOR_OBJECT_TABLE *con_obj; | 473 | ATOM_CONNECTOR_OBJECT_TABLE *con_obj; |
| 474 | ATOM_OBJECT_TABLE *router_obj; | ||
| 402 | ATOM_DISPLAY_OBJECT_PATH_TABLE *path_obj; | 475 | ATOM_DISPLAY_OBJECT_PATH_TABLE *path_obj; |
| 403 | ATOM_OBJECT_HEADER *obj_header; | 476 | ATOM_OBJECT_HEADER *obj_header; |
| 404 | int i, j, path_size, device_support; | 477 | int i, j, k, path_size, device_support; |
| 405 | int connector_type; | 478 | int connector_type; |
| 406 | u16 igp_lane_info, conn_id, connector_object_id; | 479 | u16 igp_lane_info, conn_id, connector_object_id; |
| 407 | bool linkb; | 480 | bool linkb; |
| 408 | struct radeon_i2c_bus_rec ddc_bus; | 481 | struct radeon_i2c_bus_rec ddc_bus; |
| 482 | struct radeon_router router; | ||
| 409 | struct radeon_gpio_rec gpio; | 483 | struct radeon_gpio_rec gpio; |
| 410 | struct radeon_hpd hpd; | 484 | struct radeon_hpd hpd; |
| 411 | 485 | ||
| @@ -415,6 +489,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
| 415 | if (crev < 2) | 489 | if (crev < 2) |
| 416 | return false; | 490 | return false; |
| 417 | 491 | ||
| 492 | router.valid = false; | ||
| 493 | |||
| 418 | obj_header = (ATOM_OBJECT_HEADER *) (ctx->bios + data_offset); | 494 | obj_header = (ATOM_OBJECT_HEADER *) (ctx->bios + data_offset); |
| 419 | path_obj = (ATOM_DISPLAY_OBJECT_PATH_TABLE *) | 495 | path_obj = (ATOM_DISPLAY_OBJECT_PATH_TABLE *) |
| 420 | (ctx->bios + data_offset + | 496 | (ctx->bios + data_offset + |
| @@ -422,6 +498,9 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
| 422 | con_obj = (ATOM_CONNECTOR_OBJECT_TABLE *) | 498 | con_obj = (ATOM_CONNECTOR_OBJECT_TABLE *) |
| 423 | (ctx->bios + data_offset + | 499 | (ctx->bios + data_offset + |
| 424 | le16_to_cpu(obj_header->usConnectorObjectTableOffset)); | 500 | le16_to_cpu(obj_header->usConnectorObjectTableOffset)); |
| 501 | router_obj = (ATOM_OBJECT_TABLE *) | ||
| 502 | (ctx->bios + data_offset + | ||
| 503 | le16_to_cpu(obj_header->usRouterObjectTableOffset)); | ||
| 425 | device_support = le16_to_cpu(obj_header->usDeviceSupport); | 504 | device_support = le16_to_cpu(obj_header->usDeviceSupport); |
| 426 | 505 | ||
| 427 | path_size = 0; | 506 | path_size = 0; |
| @@ -508,33 +587,86 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
| 508 | if (connector_type == DRM_MODE_CONNECTOR_Unknown) | 587 | if (connector_type == DRM_MODE_CONNECTOR_Unknown) |
| 509 | continue; | 588 | continue; |
| 510 | 589 | ||
| 511 | for (j = 0; j < ((le16_to_cpu(path->usSize) - 8) / 2); | 590 | for (j = 0; j < ((le16_to_cpu(path->usSize) - 8) / 2); j++) { |
| 512 | j++) { | 591 | uint8_t grph_obj_id, grph_obj_num, grph_obj_type; |
| 513 | uint8_t enc_obj_id, enc_obj_num, enc_obj_type; | ||
| 514 | 592 | ||
| 515 | enc_obj_id = | 593 | grph_obj_id = |
| 516 | (le16_to_cpu(path->usGraphicObjIds[j]) & | 594 | (le16_to_cpu(path->usGraphicObjIds[j]) & |
| 517 | OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; | 595 | OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; |
| 518 | enc_obj_num = | 596 | grph_obj_num = |
| 519 | (le16_to_cpu(path->usGraphicObjIds[j]) & | 597 | (le16_to_cpu(path->usGraphicObjIds[j]) & |
| 520 | ENUM_ID_MASK) >> ENUM_ID_SHIFT; | 598 | ENUM_ID_MASK) >> ENUM_ID_SHIFT; |
| 521 | enc_obj_type = | 599 | grph_obj_type = |
| 522 | (le16_to_cpu(path->usGraphicObjIds[j]) & | 600 | (le16_to_cpu(path->usGraphicObjIds[j]) & |
| 523 | OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; | 601 | OBJECT_TYPE_MASK) >> OBJECT_TYPE_SHIFT; |
| 524 | 602 | ||
| 525 | /* FIXME: add support for router objects */ | 603 | if (grph_obj_type == GRAPH_OBJECT_TYPE_ENCODER) { |
| 526 | if (enc_obj_type == GRAPH_OBJECT_TYPE_ENCODER) { | 604 | if (grph_obj_num == 2) |
| 527 | if (enc_obj_num == 2) | ||
| 528 | linkb = true; | 605 | linkb = true; |
| 529 | else | 606 | else |
| 530 | linkb = false; | 607 | linkb = false; |
| 531 | 608 | ||
| 532 | radeon_add_atom_encoder(dev, | 609 | radeon_add_atom_encoder(dev, |
| 533 | enc_obj_id, | 610 | grph_obj_id, |
| 534 | le16_to_cpu | 611 | le16_to_cpu |
| 535 | (path-> | 612 | (path-> |
| 536 | usDeviceTag)); | 613 | usDeviceTag)); |
| 537 | 614 | ||
| 615 | } else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) { | ||
| 616 | router.valid = false; | ||
| 617 | for (k = 0; k < router_obj->ucNumberOfObjects; k++) { | ||
| 618 | u16 router_obj_id = le16_to_cpu(router_obj->asObjects[j].usObjectID); | ||
| 619 | if (le16_to_cpu(path->usGraphicObjIds[j]) == router_obj_id) { | ||
| 620 | ATOM_COMMON_RECORD_HEADER *record = (ATOM_COMMON_RECORD_HEADER *) | ||
| 621 | (ctx->bios + data_offset + | ||
| 622 | le16_to_cpu(router_obj->asObjects[k].usRecordOffset)); | ||
| 623 | ATOM_I2C_RECORD *i2c_record; | ||
| 624 | ATOM_I2C_ID_CONFIG_ACCESS *i2c_config; | ||
| 625 | ATOM_ROUTER_DDC_PATH_SELECT_RECORD *ddc_path; | ||
| 626 | ATOM_SRC_DST_TABLE_FOR_ONE_OBJECT *router_src_dst_table = | ||
| 627 | (ATOM_SRC_DST_TABLE_FOR_ONE_OBJECT *) | ||
| 628 | (ctx->bios + data_offset + | ||
| 629 | le16_to_cpu(router_obj->asObjects[k].usSrcDstTableOffset)); | ||
| 630 | int enum_id; | ||
| 631 | |||
| 632 | router.router_id = router_obj_id; | ||
| 633 | for (enum_id = 0; enum_id < router_src_dst_table->ucNumberOfDst; | ||
| 634 | enum_id++) { | ||
| 635 | if (le16_to_cpu(path->usConnObjectId) == | ||
| 636 | le16_to_cpu(router_src_dst_table->usDstObjectID[enum_id])) | ||
| 637 | break; | ||
| 638 | } | ||
| 639 | |||
| 640 | while (record->ucRecordType > 0 && | ||
| 641 | record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { | ||
| 642 | switch (record->ucRecordType) { | ||
| 643 | case ATOM_I2C_RECORD_TYPE: | ||
| 644 | i2c_record = | ||
| 645 | (ATOM_I2C_RECORD *) | ||
| 646 | record; | ||
| 647 | i2c_config = | ||
| 648 | (ATOM_I2C_ID_CONFIG_ACCESS *) | ||
| 649 | &i2c_record->sucI2cId; | ||
| 650 | router.i2c_info = | ||
| 651 | radeon_lookup_i2c_gpio(rdev, | ||
| 652 | i2c_config-> | ||
| 653 | ucAccess); | ||
| 654 | router.i2c_addr = i2c_record->ucI2CAddr >> 1; | ||
| 655 | break; | ||
| 656 | case ATOM_ROUTER_DDC_PATH_SELECT_RECORD_TYPE: | ||
| 657 | ddc_path = (ATOM_ROUTER_DDC_PATH_SELECT_RECORD *) | ||
| 658 | record; | ||
| 659 | router.valid = true; | ||
| 660 | router.mux_type = ddc_path->ucMuxType; | ||
| 661 | router.mux_control_pin = ddc_path->ucMuxControlPin; | ||
| 662 | router.mux_state = ddc_path->ucMuxState[enum_id]; | ||
| 663 | break; | ||
| 664 | } | ||
| 665 | record = (ATOM_COMMON_RECORD_HEADER *) | ||
| 666 | ((char *)record + record->ucRecordSize); | ||
| 667 | } | ||
| 668 | } | ||
| 669 | } | ||
| 538 | } | 670 | } |
| 539 | } | 671 | } |
| 540 | 672 | ||
| @@ -614,7 +746,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | |||
| 614 | connector_type, &ddc_bus, | 746 | connector_type, &ddc_bus, |
| 615 | linkb, igp_lane_info, | 747 | linkb, igp_lane_info, |
| 616 | connector_object_id, | 748 | connector_object_id, |
| 617 | &hpd); | 749 | &hpd, |
| 750 | &router); | ||
| 618 | 751 | ||
| 619 | } | 752 | } |
| 620 | } | 753 | } |
| @@ -691,6 +824,9 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct | |||
| 691 | int i, j, max_device; | 824 | int i, j, max_device; |
| 692 | struct bios_connector *bios_connectors; | 825 | struct bios_connector *bios_connectors; |
| 693 | size_t bc_size = sizeof(*bios_connectors) * ATOM_MAX_SUPPORTED_DEVICE; | 826 | size_t bc_size = sizeof(*bios_connectors) * ATOM_MAX_SUPPORTED_DEVICE; |
| 827 | struct radeon_router router; | ||
| 828 | |||
| 829 | router.valid = false; | ||
| 694 | 830 | ||
| 695 | bios_connectors = kzalloc(bc_size, GFP_KERNEL); | 831 | bios_connectors = kzalloc(bc_size, GFP_KERNEL); |
| 696 | if (!bios_connectors) | 832 | if (!bios_connectors) |
| @@ -862,7 +998,8 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct | |||
| 862 | &bios_connectors[i].ddc_bus, | 998 | &bios_connectors[i].ddc_bus, |
| 863 | false, 0, | 999 | false, 0, |
| 864 | connector_object_id, | 1000 | connector_object_id, |
| 865 | &bios_connectors[i].hpd); | 1001 | &bios_connectors[i].hpd, |
| 1002 | &router); | ||
| 866 | } | 1003 | } |
| 867 | } | 1004 | } |
| 868 | 1005 | ||
| @@ -1521,7 +1658,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) | |||
| 1521 | thermal_controller_names[power_info->info.ucOverdriveThermalController], | 1658 | thermal_controller_names[power_info->info.ucOverdriveThermalController], |
| 1522 | power_info->info.ucOverdriveControllerAddress >> 1); | 1659 | power_info->info.ucOverdriveControllerAddress >> 1); |
| 1523 | i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine); | 1660 | i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine); |
| 1524 | rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal"); | 1661 | rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
| 1525 | if (rdev->pm.i2c_bus) { | 1662 | if (rdev->pm.i2c_bus) { |
| 1526 | struct i2c_board_info info = { }; | 1663 | struct i2c_board_info info = { }; |
| 1527 | const char *name = thermal_controller_names[power_info->info. | 1664 | const char *name = thermal_controller_names[power_info->info. |
| @@ -1814,7 +1951,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) | |||
| 1814 | (controller->ucFanParameters & | 1951 | (controller->ucFanParameters & |
| 1815 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | 1952 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); |
| 1816 | i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); | 1953 | i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); |
| 1817 | rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal"); | 1954 | rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
| 1818 | if (rdev->pm.i2c_bus) { | 1955 | if (rdev->pm.i2c_bus) { |
| 1819 | struct i2c_board_info info = { }; | 1956 | struct i2c_board_info info = { }; |
| 1820 | const char *name = pp_lib_thermal_controller_names[controller->ucType]; | 1957 | const char *name = pp_lib_thermal_controller_names[controller->ucType]; |
| @@ -1927,6 +2064,11 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) | |||
| 1927 | rdev->pm.power_state[state_index].type = | 2064 | rdev->pm.power_state[state_index].type = |
| 1928 | POWER_STATE_TYPE_PERFORMANCE; | 2065 | POWER_STATE_TYPE_PERFORMANCE; |
| 1929 | break; | 2066 | break; |
| 2067 | case ATOM_PPLIB_CLASSIFICATION_UI_NONE: | ||
| 2068 | if (misc2 & ATOM_PPLIB_CLASSIFICATION_3DPERFORMANCE) | ||
| 2069 | rdev->pm.power_state[state_index].type = | ||
| 2070 | POWER_STATE_TYPE_PERFORMANCE; | ||
| 2071 | break; | ||
| 1930 | } | 2072 | } |
| 1931 | rdev->pm.power_state[state_index].flags = 0; | 2073 | rdev->pm.power_state[state_index].flags = 0; |
| 1932 | if (misc & ATOM_PPLIB_SINGLE_DISPLAY_ONLY) | 2074 | if (misc & ATOM_PPLIB_SINGLE_DISPLAY_ONLY) |
diff --git a/drivers/gpu/drm/radeon/radeon_clocks.c b/drivers/gpu/drm/radeon/radeon_clocks.c index f64936cc4dd9..14448a740ba6 100644 --- a/drivers/gpu/drm/radeon/radeon_clocks.c +++ b/drivers/gpu/drm/radeon/radeon_clocks.c | |||
| @@ -91,6 +91,85 @@ uint32_t radeon_legacy_get_memory_clock(struct radeon_device *rdev) | |||
| 91 | return mclk; | 91 | return mclk; |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | #ifdef CONFIG_OF | ||
| 95 | /* | ||
| 96 | * Read XTAL (ref clock), SCLK and MCLK from Open Firmware device | ||
| 97 | * tree. Hopefully, ATI OF driver is kind enough to fill these | ||
| 98 | */ | ||
| 99 | static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) | ||
| 100 | { | ||
| 101 | struct radeon_device *rdev = dev->dev_private; | ||
| 102 | struct device_node *dp = rdev->pdev->dev.of_node; | ||
| 103 | const u32 *val; | ||
| 104 | struct radeon_pll *p1pll = &rdev->clock.p1pll; | ||
| 105 | struct radeon_pll *p2pll = &rdev->clock.p2pll; | ||
| 106 | struct radeon_pll *spll = &rdev->clock.spll; | ||
| 107 | struct radeon_pll *mpll = &rdev->clock.mpll; | ||
| 108 | |||
| 109 | if (dp == NULL) | ||
| 110 | return false; | ||
| 111 | val = of_get_property(dp, "ATY,RefCLK", NULL); | ||
| 112 | if (!val || !*val) { | ||
| 113 | printk(KERN_WARNING "radeonfb: No ATY,RefCLK property !\n"); | ||
| 114 | return false; | ||
| 115 | } | ||
| 116 | p1pll->reference_freq = p2pll->reference_freq = (*val) / 10; | ||
| 117 | p1pll->reference_div = RREG32_PLL(RADEON_PPLL_REF_DIV) & 0x3ff; | ||
| 118 | if (p1pll->reference_div < 2) | ||
| 119 | p1pll->reference_div = 12; | ||
| 120 | p2pll->reference_div = p1pll->reference_div; | ||
| 121 | |||
| 122 | /* These aren't in the device-tree */ | ||
| 123 | if (rdev->family >= CHIP_R420) { | ||
| 124 | p1pll->pll_in_min = 100; | ||
| 125 | p1pll->pll_in_max = 1350; | ||
| 126 | p1pll->pll_out_min = 20000; | ||
| 127 | p1pll->pll_out_max = 50000; | ||
| 128 | p2pll->pll_in_min = 100; | ||
| 129 | p2pll->pll_in_max = 1350; | ||
| 130 | p2pll->pll_out_min = 20000; | ||
| 131 | p2pll->pll_out_max = 50000; | ||
| 132 | } else { | ||
| 133 | p1pll->pll_in_min = 40; | ||
| 134 | p1pll->pll_in_max = 500; | ||
| 135 | p1pll->pll_out_min = 12500; | ||
| 136 | p1pll->pll_out_max = 35000; | ||
| 137 | p2pll->pll_in_min = 40; | ||
| 138 | p2pll->pll_in_max = 500; | ||
| 139 | p2pll->pll_out_min = 12500; | ||
| 140 | p2pll->pll_out_max = 35000; | ||
| 141 | } | ||
| 142 | |||
| 143 | spll->reference_freq = mpll->reference_freq = p1pll->reference_freq; | ||
| 144 | spll->reference_div = mpll->reference_div = | ||
| 145 | RREG32_PLL(RADEON_M_SPLL_REF_FB_DIV) & | ||
| 146 | RADEON_M_SPLL_REF_DIV_MASK; | ||
| 147 | |||
| 148 | val = of_get_property(dp, "ATY,SCLK", NULL); | ||
| 149 | if (val && *val) | ||
| 150 | rdev->clock.default_sclk = (*val) / 10; | ||
| 151 | else | ||
| 152 | rdev->clock.default_sclk = | ||
| 153 | radeon_legacy_get_engine_clock(rdev); | ||
| 154 | |||
| 155 | val = of_get_property(dp, "ATY,MCLK", NULL); | ||
| 156 | if (val && *val) | ||
| 157 | rdev->clock.default_mclk = (*val) / 10; | ||
| 158 | else | ||
| 159 | rdev->clock.default_mclk = | ||
| 160 | radeon_legacy_get_memory_clock(rdev); | ||
| 161 | |||
| 162 | DRM_INFO("Using device-tree clock info\n"); | ||
| 163 | |||
| 164 | return true; | ||
| 165 | } | ||
| 166 | #else | ||
| 167 | static bool __devinit radeon_read_clocks_OF(struct drm_device *dev) | ||
| 168 | { | ||
| 169 | return false; | ||
| 170 | } | ||
| 171 | #endif /* CONFIG_OF */ | ||
| 172 | |||
| 94 | void radeon_get_clock_info(struct drm_device *dev) | 173 | void radeon_get_clock_info(struct drm_device *dev) |
| 95 | { | 174 | { |
| 96 | struct radeon_device *rdev = dev->dev_private; | 175 | struct radeon_device *rdev = dev->dev_private; |
| @@ -105,6 +184,8 @@ void radeon_get_clock_info(struct drm_device *dev) | |||
| 105 | ret = radeon_atom_get_clock_info(dev); | 184 | ret = radeon_atom_get_clock_info(dev); |
| 106 | else | 185 | else |
| 107 | ret = radeon_combios_get_clock_info(dev); | 186 | ret = radeon_combios_get_clock_info(dev); |
| 187 | if (!ret) | ||
| 188 | ret = radeon_read_clocks_OF(dev); | ||
| 108 | 189 | ||
| 109 | if (ret) { | 190 | if (ret) { |
| 110 | if (p1pll->reference_div < 2) { | 191 | if (p1pll->reference_div < 2) { |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 5e1474cde4b4..885dcfac1838 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
| @@ -480,9 +480,66 @@ radeon_combios_get_hardcoded_edid(struct radeon_device *rdev) | |||
| 480 | } | 480 | } |
| 481 | 481 | ||
| 482 | static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rdev, | 482 | static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rdev, |
| 483 | int ddc_line) | 483 | enum radeon_combios_ddc ddc, |
| 484 | u32 clk_mask, | ||
| 485 | u32 data_mask) | ||
| 484 | { | 486 | { |
| 485 | struct radeon_i2c_bus_rec i2c; | 487 | struct radeon_i2c_bus_rec i2c; |
| 488 | int ddc_line = 0; | ||
| 489 | |||
| 490 | /* ddc id = mask reg | ||
| 491 | * DDC_NONE_DETECTED = none | ||
| 492 | * DDC_DVI = RADEON_GPIO_DVI_DDC | ||
| 493 | * DDC_VGA = RADEON_GPIO_VGA_DDC | ||
| 494 | * DDC_LCD = RADEON_GPIOPAD_MASK | ||
| 495 | * DDC_GPIO = RADEON_MDGPIO_MASK | ||
| 496 | * r1xx/r2xx | ||
| 497 | * DDC_MONID = RADEON_GPIO_MONID | ||
| 498 | * DDC_CRT2 = RADEON_GPIO_CRT2_DDC | ||
| 499 | * r3xx | ||
| 500 | * DDC_MONID = RADEON_GPIO_MONID | ||
| 501 | * DDC_CRT2 = RADEON_GPIO_DVI_DDC | ||
| 502 | * rs3xx/rs4xx | ||
| 503 | * DDC_MONID = RADEON_GPIOPAD_MASK | ||
| 504 | * DDC_CRT2 = RADEON_GPIO_MONID | ||
| 505 | */ | ||
| 506 | switch (ddc) { | ||
| 507 | case DDC_NONE_DETECTED: | ||
| 508 | default: | ||
| 509 | ddc_line = 0; | ||
| 510 | break; | ||
| 511 | case DDC_DVI: | ||
| 512 | ddc_line = RADEON_GPIO_DVI_DDC; | ||
| 513 | break; | ||
| 514 | case DDC_VGA: | ||
| 515 | ddc_line = RADEON_GPIO_VGA_DDC; | ||
| 516 | break; | ||
| 517 | case DDC_LCD: | ||
| 518 | ddc_line = RADEON_GPIOPAD_MASK; | ||
| 519 | break; | ||
| 520 | case DDC_GPIO: | ||
| 521 | ddc_line = RADEON_MDGPIO_MASK; | ||
| 522 | break; | ||
| 523 | case DDC_MONID: | ||
| 524 | if (rdev->family == CHIP_RS300 || | ||
| 525 | rdev->family == CHIP_RS400 || | ||
| 526 | rdev->family == CHIP_RS480) | ||
| 527 | ddc_line = RADEON_GPIOPAD_MASK; | ||
| 528 | else | ||
| 529 | ddc_line = RADEON_GPIO_MONID; | ||
| 530 | break; | ||
| 531 | case DDC_CRT2: | ||
| 532 | if (rdev->family == CHIP_RS300 || | ||
| 533 | rdev->family == CHIP_RS400 || | ||
| 534 | rdev->family == CHIP_RS480) | ||
| 535 | ddc_line = RADEON_GPIO_MONID; | ||
| 536 | else if (rdev->family >= CHIP_R300) { | ||
| 537 | ddc_line = RADEON_GPIO_DVI_DDC; | ||
| 538 | ddc = DDC_DVI; | ||
| 539 | } else | ||
| 540 | ddc_line = RADEON_GPIO_CRT2_DDC; | ||
| 541 | break; | ||
| 542 | } | ||
| 486 | 543 | ||
| 487 | if (ddc_line == RADEON_GPIOPAD_MASK) { | 544 | if (ddc_line == RADEON_GPIOPAD_MASK) { |
| 488 | i2c.mask_clk_reg = RADEON_GPIOPAD_MASK; | 545 | i2c.mask_clk_reg = RADEON_GPIOPAD_MASK; |
| @@ -503,15 +560,6 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
| 503 | i2c.y_clk_reg = RADEON_MDGPIO_Y; | 560 | i2c.y_clk_reg = RADEON_MDGPIO_Y; |
| 504 | i2c.y_data_reg = RADEON_MDGPIO_Y; | 561 | i2c.y_data_reg = RADEON_MDGPIO_Y; |
| 505 | } else { | 562 | } else { |
| 506 | i2c.mask_clk_mask = RADEON_GPIO_EN_1; | ||
| 507 | i2c.mask_data_mask = RADEON_GPIO_EN_0; | ||
| 508 | i2c.a_clk_mask = RADEON_GPIO_A_1; | ||
| 509 | i2c.a_data_mask = RADEON_GPIO_A_0; | ||
| 510 | i2c.en_clk_mask = RADEON_GPIO_EN_1; | ||
| 511 | i2c.en_data_mask = RADEON_GPIO_EN_0; | ||
| 512 | i2c.y_clk_mask = RADEON_GPIO_Y_1; | ||
| 513 | i2c.y_data_mask = RADEON_GPIO_Y_0; | ||
| 514 | |||
| 515 | i2c.mask_clk_reg = ddc_line; | 563 | i2c.mask_clk_reg = ddc_line; |
| 516 | i2c.mask_data_reg = ddc_line; | 564 | i2c.mask_data_reg = ddc_line; |
| 517 | i2c.a_clk_reg = ddc_line; | 565 | i2c.a_clk_reg = ddc_line; |
| @@ -522,6 +570,26 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
| 522 | i2c.y_data_reg = ddc_line; | 570 | i2c.y_data_reg = ddc_line; |
| 523 | } | 571 | } |
| 524 | 572 | ||
| 573 | if (clk_mask && data_mask) { | ||
| 574 | i2c.mask_clk_mask = clk_mask; | ||
| 575 | i2c.mask_data_mask = data_mask; | ||
| 576 | i2c.a_clk_mask = clk_mask; | ||
| 577 | i2c.a_data_mask = data_mask; | ||
| 578 | i2c.en_clk_mask = clk_mask; | ||
| 579 | i2c.en_data_mask = data_mask; | ||
| 580 | i2c.y_clk_mask = clk_mask; | ||
| 581 | i2c.y_data_mask = data_mask; | ||
| 582 | } else { | ||
| 583 | i2c.mask_clk_mask = RADEON_GPIO_EN_1; | ||
| 584 | i2c.mask_data_mask = RADEON_GPIO_EN_0; | ||
| 585 | i2c.a_clk_mask = RADEON_GPIO_A_1; | ||
| 586 | i2c.a_data_mask = RADEON_GPIO_A_0; | ||
| 587 | i2c.en_clk_mask = RADEON_GPIO_EN_1; | ||
| 588 | i2c.en_data_mask = RADEON_GPIO_EN_0; | ||
| 589 | i2c.y_clk_mask = RADEON_GPIO_Y_1; | ||
| 590 | i2c.y_data_mask = RADEON_GPIO_Y_0; | ||
| 591 | } | ||
| 592 | |||
| 525 | switch (rdev->family) { | 593 | switch (rdev->family) { |
| 526 | case CHIP_R100: | 594 | case CHIP_R100: |
| 527 | case CHIP_RV100: | 595 | case CHIP_RV100: |
| @@ -599,7 +667,8 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
| 599 | break; | 667 | break; |
| 600 | } | 668 | } |
| 601 | i2c.mm_i2c = false; | 669 | i2c.mm_i2c = false; |
| 602 | i2c.i2c_id = 0; | 670 | |
| 671 | i2c.i2c_id = ddc; | ||
| 603 | i2c.hpd = RADEON_HPD_NONE; | 672 | i2c.hpd = RADEON_HPD_NONE; |
| 604 | 673 | ||
| 605 | if (ddc_line) | 674 | if (ddc_line) |
| @@ -610,6 +679,62 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
| 610 | return i2c; | 679 | return i2c; |
| 611 | } | 680 | } |
| 612 | 681 | ||
| 682 | void radeon_combios_i2c_init(struct radeon_device *rdev) | ||
| 683 | { | ||
| 684 | struct drm_device *dev = rdev->ddev; | ||
| 685 | struct radeon_i2c_bus_rec i2c; | ||
| 686 | |||
| 687 | |||
| 688 | i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); | ||
| 689 | rdev->i2c_bus[0] = radeon_i2c_create(dev, &i2c, "DVI_DDC"); | ||
| 690 | |||
| 691 | i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); | ||
| 692 | rdev->i2c_bus[1] = radeon_i2c_create(dev, &i2c, "VGA_DDC"); | ||
| 693 | |||
| 694 | i2c.valid = true; | ||
| 695 | i2c.hw_capable = true; | ||
| 696 | i2c.mm_i2c = true; | ||
| 697 | i2c.i2c_id = 0xa0; | ||
| 698 | rdev->i2c_bus[2] = radeon_i2c_create(dev, &i2c, "MM_I2C"); | ||
| 699 | |||
| 700 | if (rdev->family == CHIP_RS300 || | ||
| 701 | rdev->family == CHIP_RS400 || | ||
| 702 | rdev->family == CHIP_RS480) { | ||
| 703 | u16 offset; | ||
| 704 | u8 id, blocks, clk, data; | ||
| 705 | int i; | ||
| 706 | |||
| 707 | i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); | ||
| 708 | rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID"); | ||
| 709 | |||
| 710 | offset = combios_get_table_offset(dev, COMBIOS_I2C_INFO_TABLE); | ||
| 711 | if (offset) { | ||
| 712 | blocks = RBIOS8(offset + 2); | ||
| 713 | for (i = 0; i < blocks; i++) { | ||
| 714 | id = RBIOS8(offset + 3 + (i * 5) + 0); | ||
| 715 | if (id == 136) { | ||
| 716 | clk = RBIOS8(offset + 3 + (i * 5) + 3); | ||
| 717 | data = RBIOS8(offset + 3 + (i * 5) + 4); | ||
| 718 | i2c = combios_setup_i2c_bus(rdev, DDC_MONID, | ||
| 719 | clk, data); | ||
| 720 | rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK"); | ||
| 721 | break; | ||
| 722 | } | ||
| 723 | } | ||
| 724 | } | ||
| 725 | |||
| 726 | } else if (rdev->family >= CHIP_R300) { | ||
| 727 | i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); | ||
| 728 | rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID"); | ||
| 729 | } else { | ||
| 730 | i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); | ||
| 731 | rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID"); | ||
| 732 | |||
| 733 | i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); | ||
| 734 | rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "CRT2_DDC"); | ||
| 735 | } | ||
| 736 | } | ||
| 737 | |||
| 613 | bool radeon_combios_get_clock_info(struct drm_device *dev) | 738 | bool radeon_combios_get_clock_info(struct drm_device *dev) |
| 614 | { | 739 | { |
| 615 | struct radeon_device *rdev = dev->dev_private; | 740 | struct radeon_device *rdev = dev->dev_private; |
| @@ -1247,8 +1372,8 @@ bool radeon_legacy_get_ext_tmds_info_from_table(struct radeon_encoder *encoder, | |||
| 1247 | struct radeon_i2c_bus_rec i2c_bus; | 1372 | struct radeon_i2c_bus_rec i2c_bus; |
| 1248 | 1373 | ||
| 1249 | /* default for macs */ | 1374 | /* default for macs */ |
| 1250 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); | 1375 | i2c_bus = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); |
| 1251 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1376 | tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
| 1252 | 1377 | ||
| 1253 | /* XXX some macs have duallink chips */ | 1378 | /* XXX some macs have duallink chips */ |
| 1254 | switch (rdev->mode_info.connector_table) { | 1379 | switch (rdev->mode_info.connector_table) { |
| @@ -1269,47 +1394,16 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder | |||
| 1269 | struct drm_device *dev = encoder->base.dev; | 1394 | struct drm_device *dev = encoder->base.dev; |
| 1270 | struct radeon_device *rdev = dev->dev_private; | 1395 | struct radeon_device *rdev = dev->dev_private; |
| 1271 | uint16_t offset; | 1396 | uint16_t offset; |
| 1272 | uint8_t ver, id, blocks, clk, data; | 1397 | uint8_t ver; |
| 1273 | int i; | ||
| 1274 | enum radeon_combios_ddc gpio; | 1398 | enum radeon_combios_ddc gpio; |
| 1275 | struct radeon_i2c_bus_rec i2c_bus; | 1399 | struct radeon_i2c_bus_rec i2c_bus; |
| 1276 | 1400 | ||
| 1277 | tmds->i2c_bus = NULL; | 1401 | tmds->i2c_bus = NULL; |
| 1278 | if (rdev->flags & RADEON_IS_IGP) { | 1402 | if (rdev->flags & RADEON_IS_IGP) { |
| 1279 | offset = combios_get_table_offset(dev, COMBIOS_I2C_INFO_TABLE); | 1403 | i2c_bus = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); |
| 1280 | if (offset) { | 1404 | tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
| 1281 | ver = RBIOS8(offset); | 1405 | tmds->dvo_chip = DVO_SIL164; |
| 1282 | DRM_INFO("GPIO Table revision: %d\n", ver); | 1406 | tmds->slave_addr = 0x70 >> 1; /* 7 bit addressing */ |
| 1283 | blocks = RBIOS8(offset + 2); | ||
| 1284 | for (i = 0; i < blocks; i++) { | ||
| 1285 | id = RBIOS8(offset + 3 + (i * 5) + 0); | ||
| 1286 | if (id == 136) { | ||
| 1287 | clk = RBIOS8(offset + 3 + (i * 5) + 3); | ||
| 1288 | data = RBIOS8(offset + 3 + (i * 5) + 4); | ||
| 1289 | i2c_bus.valid = true; | ||
| 1290 | i2c_bus.mask_clk_mask = (1 << clk); | ||
| 1291 | i2c_bus.mask_data_mask = (1 << data); | ||
| 1292 | i2c_bus.a_clk_mask = (1 << clk); | ||
| 1293 | i2c_bus.a_data_mask = (1 << data); | ||
| 1294 | i2c_bus.en_clk_mask = (1 << clk); | ||
| 1295 | i2c_bus.en_data_mask = (1 << data); | ||
| 1296 | i2c_bus.y_clk_mask = (1 << clk); | ||
| 1297 | i2c_bus.y_data_mask = (1 << data); | ||
| 1298 | i2c_bus.mask_clk_reg = RADEON_GPIOPAD_MASK; | ||
| 1299 | i2c_bus.mask_data_reg = RADEON_GPIOPAD_MASK; | ||
| 1300 | i2c_bus.a_clk_reg = RADEON_GPIOPAD_A; | ||
| 1301 | i2c_bus.a_data_reg = RADEON_GPIOPAD_A; | ||
| 1302 | i2c_bus.en_clk_reg = RADEON_GPIOPAD_EN; | ||
| 1303 | i2c_bus.en_data_reg = RADEON_GPIOPAD_EN; | ||
| 1304 | i2c_bus.y_clk_reg = RADEON_GPIOPAD_Y; | ||
| 1305 | i2c_bus.y_data_reg = RADEON_GPIOPAD_Y; | ||
| 1306 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | ||
| 1307 | tmds->dvo_chip = DVO_SIL164; | ||
| 1308 | tmds->slave_addr = 0x70 >> 1; /* 7 bit addressing */ | ||
| 1309 | break; | ||
| 1310 | } | ||
| 1311 | } | ||
| 1312 | } | ||
| 1313 | } else { | 1407 | } else { |
| 1314 | offset = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE); | 1408 | offset = combios_get_table_offset(dev, COMBIOS_EXT_TMDS_INFO_TABLE); |
| 1315 | if (offset) { | 1409 | if (offset) { |
| @@ -1318,37 +1412,15 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder | |||
| 1318 | tmds->slave_addr = RBIOS8(offset + 4 + 2); | 1412 | tmds->slave_addr = RBIOS8(offset + 4 + 2); |
| 1319 | tmds->slave_addr >>= 1; /* 7 bit addressing */ | 1413 | tmds->slave_addr >>= 1; /* 7 bit addressing */ |
| 1320 | gpio = RBIOS8(offset + 4 + 3); | 1414 | gpio = RBIOS8(offset + 4 + 3); |
| 1321 | switch (gpio) { | 1415 | if (gpio == DDC_LCD) { |
| 1322 | case DDC_MONID: | 1416 | /* MM i2c */ |
| 1323 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); | ||
| 1324 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | ||
| 1325 | break; | ||
| 1326 | case DDC_DVI: | ||
| 1327 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | ||
| 1328 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | ||
| 1329 | break; | ||
| 1330 | case DDC_VGA: | ||
| 1331 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | ||
| 1332 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | ||
| 1333 | break; | ||
| 1334 | case DDC_CRT2: | ||
| 1335 | /* R3xx+ chips don't have GPIO_CRT2_DDC gpio pad */ | ||
| 1336 | if (rdev->family >= CHIP_R300) | ||
| 1337 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); | ||
| 1338 | else | ||
| 1339 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); | ||
| 1340 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | ||
| 1341 | break; | ||
| 1342 | case DDC_LCD: /* MM i2c */ | ||
| 1343 | i2c_bus.valid = true; | 1417 | i2c_bus.valid = true; |
| 1344 | i2c_bus.hw_capable = true; | 1418 | i2c_bus.hw_capable = true; |
| 1345 | i2c_bus.mm_i2c = true; | 1419 | i2c_bus.mm_i2c = true; |
| 1346 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1420 | i2c_bus.i2c_id = 0xa0; |
| 1347 | break; | 1421 | } else |
| 1348 | default: | 1422 | i2c_bus = combios_setup_i2c_bus(rdev, gpio, 0, 0); |
| 1349 | DRM_ERROR("Unsupported gpio %d\n", gpio); | 1423 | tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
| 1350 | break; | ||
| 1351 | } | ||
| 1352 | } | 1424 | } |
| 1353 | } | 1425 | } |
| 1354 | 1426 | ||
| @@ -1430,7 +1502,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1430 | /* these are the most common settings */ | 1502 | /* these are the most common settings */ |
| 1431 | if (rdev->flags & RADEON_SINGLE_CRTC) { | 1503 | if (rdev->flags & RADEON_SINGLE_CRTC) { |
| 1432 | /* VGA - primary dac */ | 1504 | /* VGA - primary dac */ |
| 1433 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | 1505 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); |
| 1434 | hpd.hpd = RADEON_HPD_NONE; | 1506 | hpd.hpd = RADEON_HPD_NONE; |
| 1435 | radeon_add_legacy_encoder(dev, | 1507 | radeon_add_legacy_encoder(dev, |
| 1436 | radeon_get_encoder_id(dev, | 1508 | radeon_get_encoder_id(dev, |
| @@ -1445,7 +1517,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1445 | &hpd); | 1517 | &hpd); |
| 1446 | } else if (rdev->flags & RADEON_IS_MOBILITY) { | 1518 | } else if (rdev->flags & RADEON_IS_MOBILITY) { |
| 1447 | /* LVDS */ | 1519 | /* LVDS */ |
| 1448 | ddc_i2c = combios_setup_i2c_bus(rdev, 0); | 1520 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_NONE_DETECTED, 0, 0); |
| 1449 | hpd.hpd = RADEON_HPD_NONE; | 1521 | hpd.hpd = RADEON_HPD_NONE; |
| 1450 | radeon_add_legacy_encoder(dev, | 1522 | radeon_add_legacy_encoder(dev, |
| 1451 | radeon_get_encoder_id(dev, | 1523 | radeon_get_encoder_id(dev, |
| @@ -1460,7 +1532,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1460 | &hpd); | 1532 | &hpd); |
| 1461 | 1533 | ||
| 1462 | /* VGA - primary dac */ | 1534 | /* VGA - primary dac */ |
| 1463 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | 1535 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); |
| 1464 | hpd.hpd = RADEON_HPD_NONE; | 1536 | hpd.hpd = RADEON_HPD_NONE; |
| 1465 | radeon_add_legacy_encoder(dev, | 1537 | radeon_add_legacy_encoder(dev, |
| 1466 | radeon_get_encoder_id(dev, | 1538 | radeon_get_encoder_id(dev, |
| @@ -1475,7 +1547,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1475 | &hpd); | 1547 | &hpd); |
| 1476 | } else { | 1548 | } else { |
| 1477 | /* DVI-I - tv dac, int tmds */ | 1549 | /* DVI-I - tv dac, int tmds */ |
| 1478 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | 1550 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); |
| 1479 | hpd.hpd = RADEON_HPD_1; | 1551 | hpd.hpd = RADEON_HPD_1; |
| 1480 | radeon_add_legacy_encoder(dev, | 1552 | radeon_add_legacy_encoder(dev, |
| 1481 | radeon_get_encoder_id(dev, | 1553 | radeon_get_encoder_id(dev, |
| @@ -1496,7 +1568,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1496 | &hpd); | 1568 | &hpd); |
| 1497 | 1569 | ||
| 1498 | /* VGA - primary dac */ | 1570 | /* VGA - primary dac */ |
| 1499 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | 1571 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); |
| 1500 | hpd.hpd = RADEON_HPD_NONE; | 1572 | hpd.hpd = RADEON_HPD_NONE; |
| 1501 | radeon_add_legacy_encoder(dev, | 1573 | radeon_add_legacy_encoder(dev, |
| 1502 | radeon_get_encoder_id(dev, | 1574 | radeon_get_encoder_id(dev, |
| @@ -1532,7 +1604,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1532 | DRM_INFO("Connector Table: %d (ibook)\n", | 1604 | DRM_INFO("Connector Table: %d (ibook)\n", |
| 1533 | rdev->mode_info.connector_table); | 1605 | rdev->mode_info.connector_table); |
| 1534 | /* LVDS */ | 1606 | /* LVDS */ |
| 1535 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | 1607 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); |
| 1536 | hpd.hpd = RADEON_HPD_NONE; | 1608 | hpd.hpd = RADEON_HPD_NONE; |
| 1537 | radeon_add_legacy_encoder(dev, | 1609 | radeon_add_legacy_encoder(dev, |
| 1538 | radeon_get_encoder_id(dev, | 1610 | radeon_get_encoder_id(dev, |
| @@ -1544,7 +1616,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1544 | CONNECTOR_OBJECT_ID_LVDS, | 1616 | CONNECTOR_OBJECT_ID_LVDS, |
| 1545 | &hpd); | 1617 | &hpd); |
| 1546 | /* VGA - TV DAC */ | 1618 | /* VGA - TV DAC */ |
| 1547 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | 1619 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); |
| 1548 | hpd.hpd = RADEON_HPD_NONE; | 1620 | hpd.hpd = RADEON_HPD_NONE; |
| 1549 | radeon_add_legacy_encoder(dev, | 1621 | radeon_add_legacy_encoder(dev, |
| 1550 | radeon_get_encoder_id(dev, | 1622 | radeon_get_encoder_id(dev, |
| @@ -1573,7 +1645,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1573 | DRM_INFO("Connector Table: %d (powerbook external tmds)\n", | 1645 | DRM_INFO("Connector Table: %d (powerbook external tmds)\n", |
| 1574 | rdev->mode_info.connector_table); | 1646 | rdev->mode_info.connector_table); |
| 1575 | /* LVDS */ | 1647 | /* LVDS */ |
| 1576 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | 1648 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); |
| 1577 | hpd.hpd = RADEON_HPD_NONE; | 1649 | hpd.hpd = RADEON_HPD_NONE; |
| 1578 | radeon_add_legacy_encoder(dev, | 1650 | radeon_add_legacy_encoder(dev, |
| 1579 | radeon_get_encoder_id(dev, | 1651 | radeon_get_encoder_id(dev, |
| @@ -1585,7 +1657,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1585 | CONNECTOR_OBJECT_ID_LVDS, | 1657 | CONNECTOR_OBJECT_ID_LVDS, |
| 1586 | &hpd); | 1658 | &hpd); |
| 1587 | /* DVI-I - primary dac, ext tmds */ | 1659 | /* DVI-I - primary dac, ext tmds */ |
| 1588 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | 1660 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); |
| 1589 | hpd.hpd = RADEON_HPD_2; /* ??? */ | 1661 | hpd.hpd = RADEON_HPD_2; /* ??? */ |
| 1590 | radeon_add_legacy_encoder(dev, | 1662 | radeon_add_legacy_encoder(dev, |
| 1591 | radeon_get_encoder_id(dev, | 1663 | radeon_get_encoder_id(dev, |
| @@ -1622,7 +1694,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1622 | DRM_INFO("Connector Table: %d (powerbook internal tmds)\n", | 1694 | DRM_INFO("Connector Table: %d (powerbook internal tmds)\n", |
| 1623 | rdev->mode_info.connector_table); | 1695 | rdev->mode_info.connector_table); |
| 1624 | /* LVDS */ | 1696 | /* LVDS */ |
| 1625 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | 1697 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); |
| 1626 | hpd.hpd = RADEON_HPD_NONE; | 1698 | hpd.hpd = RADEON_HPD_NONE; |
| 1627 | radeon_add_legacy_encoder(dev, | 1699 | radeon_add_legacy_encoder(dev, |
| 1628 | radeon_get_encoder_id(dev, | 1700 | radeon_get_encoder_id(dev, |
| @@ -1634,7 +1706,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1634 | CONNECTOR_OBJECT_ID_LVDS, | 1706 | CONNECTOR_OBJECT_ID_LVDS, |
| 1635 | &hpd); | 1707 | &hpd); |
| 1636 | /* DVI-I - primary dac, int tmds */ | 1708 | /* DVI-I - primary dac, int tmds */ |
| 1637 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | 1709 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); |
| 1638 | hpd.hpd = RADEON_HPD_1; /* ??? */ | 1710 | hpd.hpd = RADEON_HPD_1; /* ??? */ |
| 1639 | radeon_add_legacy_encoder(dev, | 1711 | radeon_add_legacy_encoder(dev, |
| 1640 | radeon_get_encoder_id(dev, | 1712 | radeon_get_encoder_id(dev, |
| @@ -1670,7 +1742,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1670 | DRM_INFO("Connector Table: %d (powerbook vga)\n", | 1742 | DRM_INFO("Connector Table: %d (powerbook vga)\n", |
| 1671 | rdev->mode_info.connector_table); | 1743 | rdev->mode_info.connector_table); |
| 1672 | /* LVDS */ | 1744 | /* LVDS */ |
| 1673 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | 1745 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); |
| 1674 | hpd.hpd = RADEON_HPD_NONE; | 1746 | hpd.hpd = RADEON_HPD_NONE; |
| 1675 | radeon_add_legacy_encoder(dev, | 1747 | radeon_add_legacy_encoder(dev, |
| 1676 | radeon_get_encoder_id(dev, | 1748 | radeon_get_encoder_id(dev, |
| @@ -1682,7 +1754,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1682 | CONNECTOR_OBJECT_ID_LVDS, | 1754 | CONNECTOR_OBJECT_ID_LVDS, |
| 1683 | &hpd); | 1755 | &hpd); |
| 1684 | /* VGA - primary dac */ | 1756 | /* VGA - primary dac */ |
| 1685 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | 1757 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); |
| 1686 | hpd.hpd = RADEON_HPD_NONE; | 1758 | hpd.hpd = RADEON_HPD_NONE; |
| 1687 | radeon_add_legacy_encoder(dev, | 1759 | radeon_add_legacy_encoder(dev, |
| 1688 | radeon_get_encoder_id(dev, | 1760 | radeon_get_encoder_id(dev, |
| @@ -1711,7 +1783,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1711 | DRM_INFO("Connector Table: %d (mini external tmds)\n", | 1783 | DRM_INFO("Connector Table: %d (mini external tmds)\n", |
| 1712 | rdev->mode_info.connector_table); | 1784 | rdev->mode_info.connector_table); |
| 1713 | /* DVI-I - tv dac, ext tmds */ | 1785 | /* DVI-I - tv dac, ext tmds */ |
| 1714 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); | 1786 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); |
| 1715 | hpd.hpd = RADEON_HPD_2; /* ??? */ | 1787 | hpd.hpd = RADEON_HPD_2; /* ??? */ |
| 1716 | radeon_add_legacy_encoder(dev, | 1788 | radeon_add_legacy_encoder(dev, |
| 1717 | radeon_get_encoder_id(dev, | 1789 | radeon_get_encoder_id(dev, |
| @@ -1748,7 +1820,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1748 | DRM_INFO("Connector Table: %d (mini internal tmds)\n", | 1820 | DRM_INFO("Connector Table: %d (mini internal tmds)\n", |
| 1749 | rdev->mode_info.connector_table); | 1821 | rdev->mode_info.connector_table); |
| 1750 | /* DVI-I - tv dac, int tmds */ | 1822 | /* DVI-I - tv dac, int tmds */ |
| 1751 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); | 1823 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); |
| 1752 | hpd.hpd = RADEON_HPD_1; /* ??? */ | 1824 | hpd.hpd = RADEON_HPD_1; /* ??? */ |
| 1753 | radeon_add_legacy_encoder(dev, | 1825 | radeon_add_legacy_encoder(dev, |
| 1754 | radeon_get_encoder_id(dev, | 1826 | radeon_get_encoder_id(dev, |
| @@ -1784,7 +1856,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1784 | DRM_INFO("Connector Table: %d (imac g5 isight)\n", | 1856 | DRM_INFO("Connector Table: %d (imac g5 isight)\n", |
| 1785 | rdev->mode_info.connector_table); | 1857 | rdev->mode_info.connector_table); |
| 1786 | /* DVI-D - int tmds */ | 1858 | /* DVI-D - int tmds */ |
| 1787 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); | 1859 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); |
| 1788 | hpd.hpd = RADEON_HPD_1; /* ??? */ | 1860 | hpd.hpd = RADEON_HPD_1; /* ??? */ |
| 1789 | radeon_add_legacy_encoder(dev, | 1861 | radeon_add_legacy_encoder(dev, |
| 1790 | radeon_get_encoder_id(dev, | 1862 | radeon_get_encoder_id(dev, |
| @@ -1796,7 +1868,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1796 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D, | 1868 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D, |
| 1797 | &hpd); | 1869 | &hpd); |
| 1798 | /* VGA - tv dac */ | 1870 | /* VGA - tv dac */ |
| 1799 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | 1871 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); |
| 1800 | hpd.hpd = RADEON_HPD_NONE; | 1872 | hpd.hpd = RADEON_HPD_NONE; |
| 1801 | radeon_add_legacy_encoder(dev, | 1873 | radeon_add_legacy_encoder(dev, |
| 1802 | radeon_get_encoder_id(dev, | 1874 | radeon_get_encoder_id(dev, |
| @@ -1825,7 +1897,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1825 | DRM_INFO("Connector Table: %d (emac)\n", | 1897 | DRM_INFO("Connector Table: %d (emac)\n", |
| 1826 | rdev->mode_info.connector_table); | 1898 | rdev->mode_info.connector_table); |
| 1827 | /* VGA - primary dac */ | 1899 | /* VGA - primary dac */ |
| 1828 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | 1900 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); |
| 1829 | hpd.hpd = RADEON_HPD_NONE; | 1901 | hpd.hpd = RADEON_HPD_NONE; |
| 1830 | radeon_add_legacy_encoder(dev, | 1902 | radeon_add_legacy_encoder(dev, |
| 1831 | radeon_get_encoder_id(dev, | 1903 | radeon_get_encoder_id(dev, |
| @@ -1837,7 +1909,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1837 | CONNECTOR_OBJECT_ID_VGA, | 1909 | CONNECTOR_OBJECT_ID_VGA, |
| 1838 | &hpd); | 1910 | &hpd); |
| 1839 | /* VGA - tv dac */ | 1911 | /* VGA - tv dac */ |
| 1840 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); | 1912 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); |
| 1841 | hpd.hpd = RADEON_HPD_NONE; | 1913 | hpd.hpd = RADEON_HPD_NONE; |
| 1842 | radeon_add_legacy_encoder(dev, | 1914 | radeon_add_legacy_encoder(dev, |
| 1843 | radeon_get_encoder_id(dev, | 1915 | radeon_get_encoder_id(dev, |
| @@ -1866,7 +1938,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1866 | DRM_INFO("Connector Table: %d (rn50-power)\n", | 1938 | DRM_INFO("Connector Table: %d (rn50-power)\n", |
| 1867 | rdev->mode_info.connector_table); | 1939 | rdev->mode_info.connector_table); |
| 1868 | /* VGA - primary dac */ | 1940 | /* VGA - primary dac */ |
| 1869 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | 1941 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); |
| 1870 | hpd.hpd = RADEON_HPD_NONE; | 1942 | hpd.hpd = RADEON_HPD_NONE; |
| 1871 | radeon_add_legacy_encoder(dev, | 1943 | radeon_add_legacy_encoder(dev, |
| 1872 | radeon_get_encoder_id(dev, | 1944 | radeon_get_encoder_id(dev, |
| @@ -1877,7 +1949,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
| 1877 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c, | 1949 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c, |
| 1878 | CONNECTOR_OBJECT_ID_VGA, | 1950 | CONNECTOR_OBJECT_ID_VGA, |
| 1879 | &hpd); | 1951 | &hpd); |
| 1880 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); | 1952 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); |
| 1881 | hpd.hpd = RADEON_HPD_NONE; | 1953 | hpd.hpd = RADEON_HPD_NONE; |
| 1882 | radeon_add_legacy_encoder(dev, | 1954 | radeon_add_legacy_encoder(dev, |
| 1883 | radeon_get_encoder_id(dev, | 1955 | radeon_get_encoder_id(dev, |
| @@ -1907,31 +1979,6 @@ static bool radeon_apply_legacy_quirks(struct drm_device *dev, | |||
| 1907 | struct radeon_i2c_bus_rec *ddc_i2c, | 1979 | struct radeon_i2c_bus_rec *ddc_i2c, |
| 1908 | struct radeon_hpd *hpd) | 1980 | struct radeon_hpd *hpd) |
| 1909 | { | 1981 | { |
| 1910 | struct radeon_device *rdev = dev->dev_private; | ||
| 1911 | |||
| 1912 | /* XPRESS DDC quirks */ | ||
| 1913 | if ((rdev->family == CHIP_RS400 || | ||
| 1914 | rdev->family == CHIP_RS480) && | ||
| 1915 | ddc_i2c->mask_clk_reg == RADEON_GPIO_CRT2_DDC) | ||
| 1916 | *ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); | ||
| 1917 | else if ((rdev->family == CHIP_RS400 || | ||
| 1918 | rdev->family == CHIP_RS480) && | ||
| 1919 | ddc_i2c->mask_clk_reg == RADEON_GPIO_MONID) { | ||
| 1920 | *ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIOPAD_MASK); | ||
| 1921 | ddc_i2c->mask_clk_mask = (0x20 << 8); | ||
| 1922 | ddc_i2c->mask_data_mask = 0x80; | ||
| 1923 | ddc_i2c->a_clk_mask = (0x20 << 8); | ||
| 1924 | ddc_i2c->a_data_mask = 0x80; | ||
| 1925 | ddc_i2c->en_clk_mask = (0x20 << 8); | ||
| 1926 | ddc_i2c->en_data_mask = 0x80; | ||
| 1927 | ddc_i2c->y_clk_mask = (0x20 << 8); | ||
| 1928 | ddc_i2c->y_data_mask = 0x80; | ||
| 1929 | } | ||
| 1930 | |||
| 1931 | /* R3xx+ chips don't have GPIO_CRT2_DDC gpio pad */ | ||
| 1932 | if ((rdev->family >= CHIP_R300) && | ||
| 1933 | ddc_i2c->mask_clk_reg == RADEON_GPIO_CRT2_DDC) | ||
| 1934 | *ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | ||
| 1935 | 1982 | ||
| 1936 | /* Certain IBM chipset RN50s have a BIOS reporting two VGAs, | 1983 | /* Certain IBM chipset RN50s have a BIOS reporting two VGAs, |
| 1937 | one with VGA DDC and one with CRT2 DDC. - kill the CRT2 DDC one */ | 1984 | one with VGA DDC and one with CRT2 DDC. - kill the CRT2 DDC one */ |
| @@ -2035,27 +2082,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 2035 | connector = (tmp >> 12) & 0xf; | 2082 | connector = (tmp >> 12) & 0xf; |
| 2036 | 2083 | ||
| 2037 | ddc_type = (tmp >> 8) & 0xf; | 2084 | ddc_type = (tmp >> 8) & 0xf; |
| 2038 | switch (ddc_type) { | 2085 | ddc_i2c = combios_setup_i2c_bus(rdev, ddc_type, 0, 0); |
| 2039 | case DDC_MONID: | ||
| 2040 | ddc_i2c = | ||
| 2041 | combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); | ||
| 2042 | break; | ||
| 2043 | case DDC_DVI: | ||
| 2044 | ddc_i2c = | ||
| 2045 | combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | ||
| 2046 | break; | ||
| 2047 | case DDC_VGA: | ||
| 2048 | ddc_i2c = | ||
| 2049 | combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | ||
| 2050 | break; | ||
| 2051 | case DDC_CRT2: | ||
| 2052 | ddc_i2c = | ||
| 2053 | combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); | ||
| 2054 | break; | ||
| 2055 | default: | ||
| 2056 | ddc_i2c.valid = false; | ||
| 2057 | break; | ||
| 2058 | } | ||
| 2059 | 2086 | ||
| 2060 | switch (connector) { | 2087 | switch (connector) { |
| 2061 | case CONNECTOR_PROPRIETARY_LEGACY: | 2088 | case CONNECTOR_PROPRIETARY_LEGACY: |
| @@ -2225,7 +2252,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 2225 | 0), | 2252 | 0), |
| 2226 | ATOM_DEVICE_DFP1_SUPPORT); | 2253 | ATOM_DEVICE_DFP1_SUPPORT); |
| 2227 | 2254 | ||
| 2228 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | 2255 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); |
| 2229 | hpd.hpd = RADEON_HPD_1; | 2256 | hpd.hpd = RADEON_HPD_1; |
| 2230 | radeon_add_legacy_connector(dev, | 2257 | radeon_add_legacy_connector(dev, |
| 2231 | 0, | 2258 | 0, |
| @@ -2245,7 +2272,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 2245 | ATOM_DEVICE_CRT1_SUPPORT, | 2272 | ATOM_DEVICE_CRT1_SUPPORT, |
| 2246 | 1), | 2273 | 1), |
| 2247 | ATOM_DEVICE_CRT1_SUPPORT); | 2274 | ATOM_DEVICE_CRT1_SUPPORT); |
| 2248 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | 2275 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); |
| 2249 | hpd.hpd = RADEON_HPD_NONE; | 2276 | hpd.hpd = RADEON_HPD_NONE; |
| 2250 | radeon_add_legacy_connector(dev, | 2277 | radeon_add_legacy_connector(dev, |
| 2251 | 0, | 2278 | 0, |
| @@ -2278,70 +2305,25 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
| 2278 | if (lcd_ddc_info) { | 2305 | if (lcd_ddc_info) { |
| 2279 | ddc_type = RBIOS8(lcd_ddc_info + 2); | 2306 | ddc_type = RBIOS8(lcd_ddc_info + 2); |
| 2280 | switch (ddc_type) { | 2307 | switch (ddc_type) { |
| 2281 | case DDC_MONID: | ||
| 2282 | ddc_i2c = | ||
| 2283 | combios_setup_i2c_bus | ||
| 2284 | (rdev, RADEON_GPIO_MONID); | ||
| 2285 | break; | ||
| 2286 | case DDC_DVI: | ||
| 2287 | ddc_i2c = | ||
| 2288 | combios_setup_i2c_bus | ||
| 2289 | (rdev, RADEON_GPIO_DVI_DDC); | ||
| 2290 | break; | ||
| 2291 | case DDC_VGA: | ||
| 2292 | ddc_i2c = | ||
| 2293 | combios_setup_i2c_bus | ||
| 2294 | (rdev, RADEON_GPIO_VGA_DDC); | ||
| 2295 | break; | ||
| 2296 | case DDC_CRT2: | ||
| 2297 | ddc_i2c = | ||
| 2298 | combios_setup_i2c_bus | ||
| 2299 | (rdev, RADEON_GPIO_CRT2_DDC); | ||
| 2300 | break; | ||
| 2301 | case DDC_LCD: | 2308 | case DDC_LCD: |
| 2302 | ddc_i2c = | 2309 | ddc_i2c = |
| 2303 | combios_setup_i2c_bus | 2310 | combios_setup_i2c_bus(rdev, |
| 2304 | (rdev, RADEON_GPIOPAD_MASK); | 2311 | DDC_LCD, |
| 2305 | ddc_i2c.mask_clk_mask = | 2312 | RBIOS32(lcd_ddc_info + 3), |
| 2306 | RBIOS32(lcd_ddc_info + 3); | 2313 | RBIOS32(lcd_ddc_info + 7)); |
| 2307 | ddc_i2c.mask_data_mask = | 2314 | radeon_i2c_add(rdev, &ddc_i2c, "LCD"); |
| 2308 | RBIOS32(lcd_ddc_info + 7); | ||
| 2309 | ddc_i2c.a_clk_mask = | ||
| 2310 | RBIOS32(lcd_ddc_info + 3); | ||
| 2311 | ddc_i2c.a_data_mask = | ||
| 2312 | RBIOS32(lcd_ddc_info + 7); | ||
| 2313 | ddc_i2c.en_clk_mask = | ||
| 2314 | RBIOS32(lcd_ddc_info + 3); | ||
| 2315 | ddc_i2c.en_data_mask = | ||
| 2316 | RBIOS32(lcd_ddc_info + 7); | ||
| 2317 | ddc_i2c.y_clk_mask = | ||
| 2318 | RBIOS32(lcd_ddc_info + 3); | ||
| 2319 | ddc_i2c.y_data_mask = | ||
| 2320 | RBIOS32(lcd_ddc_info + 7); | ||
| 2321 | break; | 2315 | break; |
| 2322 | case DDC_GPIO: | 2316 | case DDC_GPIO: |
| 2323 | ddc_i2c = | 2317 | ddc_i2c = |
| 2324 | combios_setup_i2c_bus | 2318 | combios_setup_i2c_bus(rdev, |
| 2325 | (rdev, RADEON_MDGPIO_MASK); | 2319 | DDC_GPIO, |
| 2326 | ddc_i2c.mask_clk_mask = | 2320 | RBIOS32(lcd_ddc_info + 3), |
| 2327 | RBIOS32(lcd_ddc_info + 3); | 2321 | RBIOS32(lcd_ddc_info + 7)); |
| 2328 | ddc_i2c.mask_data_mask = | 2322 | radeon_i2c_add(rdev, &ddc_i2c, "LCD"); |
| 2329 | RBIOS32(lcd_ddc_info + 7); | ||
| 2330 | ddc_i2c.a_clk_mask = | ||
| 2331 | RBIOS32(lcd_ddc_info + 3); | ||
| 2332 | ddc_i2c.a_data_mask = | ||
| 2333 | RBIOS32(lcd_ddc_info + 7); | ||
| 2334 | ddc_i2c.en_clk_mask = | ||
| 2335 | RBIOS32(lcd_ddc_info + 3); | ||
| 2336 | ddc_i2c.en_data_mask = | ||
| 2337 | RBIOS32(lcd_ddc_info + 7); | ||
| 2338 | ddc_i2c.y_clk_mask = | ||
| 2339 | RBIOS32(lcd_ddc_info + 3); | ||
| 2340 | ddc_i2c.y_data_mask = | ||
| 2341 | RBIOS32(lcd_ddc_info + 7); | ||
| 2342 | break; | 2323 | break; |
| 2343 | default: | 2324 | default: |
| 2344 | ddc_i2c.valid = false; | 2325 | ddc_i2c = |
| 2326 | combios_setup_i2c_bus(rdev, ddc_type, 0, 0); | ||
| 2345 | break; | 2327 | break; |
| 2346 | } | 2328 | } |
| 2347 | DRM_DEBUG_KMS("LCD DDC Info Table found!\n"); | 2329 | DRM_DEBUG_KMS("LCD DDC Info Table found!\n"); |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 2395c8600cf4..47c4b276d30c 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
| @@ -518,8 +518,6 @@ static void radeon_connector_destroy(struct drm_connector *connector) | |||
| 518 | { | 518 | { |
| 519 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 519 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 520 | 520 | ||
| 521 | if (radeon_connector->ddc_bus) | ||
| 522 | radeon_i2c_destroy(radeon_connector->ddc_bus); | ||
| 523 | if (radeon_connector->edid) | 521 | if (radeon_connector->edid) |
| 524 | kfree(radeon_connector->edid); | 522 | kfree(radeon_connector->edid); |
| 525 | kfree(radeon_connector->con_priv); | 523 | kfree(radeon_connector->con_priv); |
| @@ -955,8 +953,6 @@ static void radeon_dp_connector_destroy(struct drm_connector *connector) | |||
| 955 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 953 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 956 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; | 954 | struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv; |
| 957 | 955 | ||
| 958 | if (radeon_connector->ddc_bus) | ||
| 959 | radeon_i2c_destroy(radeon_connector->ddc_bus); | ||
| 960 | if (radeon_connector->edid) | 956 | if (radeon_connector->edid) |
| 961 | kfree(radeon_connector->edid); | 957 | kfree(radeon_connector->edid); |
| 962 | if (radeon_dig_connector->dp_i2c_bus) | 958 | if (radeon_dig_connector->dp_i2c_bus) |
| @@ -1044,7 +1040,8 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1044 | bool linkb, | 1040 | bool linkb, |
| 1045 | uint32_t igp_lane_info, | 1041 | uint32_t igp_lane_info, |
| 1046 | uint16_t connector_object_id, | 1042 | uint16_t connector_object_id, |
| 1047 | struct radeon_hpd *hpd) | 1043 | struct radeon_hpd *hpd, |
| 1044 | struct radeon_router *router) | ||
| 1048 | { | 1045 | { |
| 1049 | struct radeon_device *rdev = dev->dev_private; | 1046 | struct radeon_device *rdev = dev->dev_private; |
| 1050 | struct drm_connector *connector; | 1047 | struct drm_connector *connector; |
| @@ -1069,6 +1066,11 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1069 | radeon_connector->shared_ddc = true; | 1066 | radeon_connector->shared_ddc = true; |
| 1070 | shared_ddc = true; | 1067 | shared_ddc = true; |
| 1071 | } | 1068 | } |
| 1069 | if (radeon_connector->router_bus && router->valid && | ||
| 1070 | (radeon_connector->router.router_id == router->router_id)) { | ||
| 1071 | radeon_connector->shared_ddc = false; | ||
| 1072 | shared_ddc = false; | ||
| 1073 | } | ||
| 1072 | } | 1074 | } |
| 1073 | } | 1075 | } |
| 1074 | 1076 | ||
| @@ -1083,12 +1085,18 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1083 | radeon_connector->shared_ddc = shared_ddc; | 1085 | radeon_connector->shared_ddc = shared_ddc; |
| 1084 | radeon_connector->connector_object_id = connector_object_id; | 1086 | radeon_connector->connector_object_id = connector_object_id; |
| 1085 | radeon_connector->hpd = *hpd; | 1087 | radeon_connector->hpd = *hpd; |
| 1088 | radeon_connector->router = *router; | ||
| 1089 | if (router->valid) { | ||
| 1090 | radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info); | ||
| 1091 | if (!radeon_connector->router_bus) | ||
| 1092 | goto failed; | ||
| 1093 | } | ||
| 1086 | switch (connector_type) { | 1094 | switch (connector_type) { |
| 1087 | case DRM_MODE_CONNECTOR_VGA: | 1095 | case DRM_MODE_CONNECTOR_VGA: |
| 1088 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 1096 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
| 1089 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); | 1097 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
| 1090 | if (i2c_bus->valid) { | 1098 | if (i2c_bus->valid) { |
| 1091 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "VGA"); | 1099 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1092 | if (!radeon_connector->ddc_bus) | 1100 | if (!radeon_connector->ddc_bus) |
| 1093 | goto failed; | 1101 | goto failed; |
| 1094 | } | 1102 | } |
| @@ -1104,7 +1112,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1104 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 1112 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
| 1105 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); | 1113 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
| 1106 | if (i2c_bus->valid) { | 1114 | if (i2c_bus->valid) { |
| 1107 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); | 1115 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1108 | if (!radeon_connector->ddc_bus) | 1116 | if (!radeon_connector->ddc_bus) |
| 1109 | goto failed; | 1117 | goto failed; |
| 1110 | } | 1118 | } |
| @@ -1126,7 +1134,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1126 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); | 1134 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); |
| 1127 | drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); | 1135 | drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); |
| 1128 | if (i2c_bus->valid) { | 1136 | if (i2c_bus->valid) { |
| 1129 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); | 1137 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1130 | if (!radeon_connector->ddc_bus) | 1138 | if (!radeon_connector->ddc_bus) |
| 1131 | goto failed; | 1139 | goto failed; |
| 1132 | } | 1140 | } |
| @@ -1156,7 +1164,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1156 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); | 1164 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); |
| 1157 | drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); | 1165 | drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); |
| 1158 | if (i2c_bus->valid) { | 1166 | if (i2c_bus->valid) { |
| 1159 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "HDMI"); | 1167 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1160 | if (!radeon_connector->ddc_bus) | 1168 | if (!radeon_connector->ddc_bus) |
| 1161 | goto failed; | 1169 | goto failed; |
| 1162 | } | 1170 | } |
| @@ -1187,10 +1195,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1187 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); | 1195 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); |
| 1188 | if (!radeon_dig_connector->dp_i2c_bus) | 1196 | if (!radeon_dig_connector->dp_i2c_bus) |
| 1189 | goto failed; | 1197 | goto failed; |
| 1190 | if (connector_type == DRM_MODE_CONNECTOR_eDP) | 1198 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1191 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "eDP"); | ||
| 1192 | else | ||
| 1193 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DP"); | ||
| 1194 | if (!radeon_connector->ddc_bus) | 1199 | if (!radeon_connector->ddc_bus) |
| 1195 | goto failed; | 1200 | goto failed; |
| 1196 | } | 1201 | } |
| @@ -1230,7 +1235,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1230 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); | 1235 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); |
| 1231 | drm_connector_helper_add(&radeon_connector->base, &radeon_lvds_connector_helper_funcs); | 1236 | drm_connector_helper_add(&radeon_connector->base, &radeon_lvds_connector_helper_funcs); |
| 1232 | if (i2c_bus->valid) { | 1237 | if (i2c_bus->valid) { |
| 1233 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "LVDS"); | 1238 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1234 | if (!radeon_connector->ddc_bus) | 1239 | if (!radeon_connector->ddc_bus) |
| 1235 | goto failed; | 1240 | goto failed; |
| 1236 | } | 1241 | } |
| @@ -1252,8 +1257,6 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
| 1252 | return; | 1257 | return; |
| 1253 | 1258 | ||
| 1254 | failed: | 1259 | failed: |
| 1255 | if (radeon_connector->ddc_bus) | ||
| 1256 | radeon_i2c_destroy(radeon_connector->ddc_bus); | ||
| 1257 | drm_connector_cleanup(connector); | 1260 | drm_connector_cleanup(connector); |
| 1258 | kfree(connector); | 1261 | kfree(connector); |
| 1259 | } | 1262 | } |
| @@ -1300,7 +1303,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 1300 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 1303 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
| 1301 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); | 1304 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
| 1302 | if (i2c_bus->valid) { | 1305 | if (i2c_bus->valid) { |
| 1303 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "VGA"); | 1306 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1304 | if (!radeon_connector->ddc_bus) | 1307 | if (!radeon_connector->ddc_bus) |
| 1305 | goto failed; | 1308 | goto failed; |
| 1306 | } | 1309 | } |
| @@ -1316,7 +1319,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 1316 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 1319 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
| 1317 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); | 1320 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
| 1318 | if (i2c_bus->valid) { | 1321 | if (i2c_bus->valid) { |
| 1319 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); | 1322 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1320 | if (!radeon_connector->ddc_bus) | 1323 | if (!radeon_connector->ddc_bus) |
| 1321 | goto failed; | 1324 | goto failed; |
| 1322 | } | 1325 | } |
| @@ -1332,7 +1335,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 1332 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); | 1335 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); |
| 1333 | drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); | 1336 | drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); |
| 1334 | if (i2c_bus->valid) { | 1337 | if (i2c_bus->valid) { |
| 1335 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); | 1338 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1336 | if (!radeon_connector->ddc_bus) | 1339 | if (!radeon_connector->ddc_bus) |
| 1337 | goto failed; | 1340 | goto failed; |
| 1338 | } | 1341 | } |
| @@ -1372,7 +1375,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 1372 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); | 1375 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); |
| 1373 | drm_connector_helper_add(&radeon_connector->base, &radeon_lvds_connector_helper_funcs); | 1376 | drm_connector_helper_add(&radeon_connector->base, &radeon_lvds_connector_helper_funcs); |
| 1374 | if (i2c_bus->valid) { | 1377 | if (i2c_bus->valid) { |
| 1375 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "LVDS"); | 1378 | radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); |
| 1376 | if (!radeon_connector->ddc_bus) | 1379 | if (!radeon_connector->ddc_bus) |
| 1377 | goto failed; | 1380 | goto failed; |
| 1378 | } | 1381 | } |
| @@ -1393,8 +1396,6 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
| 1393 | return; | 1396 | return; |
| 1394 | 1397 | ||
| 1395 | failed: | 1398 | failed: |
| 1396 | if (radeon_connector->ddc_bus) | ||
| 1397 | radeon_i2c_destroy(radeon_connector->ddc_bus); | ||
| 1398 | drm_connector_cleanup(connector); | 1399 | drm_connector_cleanup(connector); |
| 1399 | kfree(connector); | 1400 | kfree(connector); |
| 1400 | } | 1401 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index ae0fb7356e62..fcc79b5d22d1 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
| @@ -72,7 +72,7 @@ int radeon_cs_parser_relocs(struct radeon_cs_parser *p) | |||
| 72 | if (p->relocs[i].gobj == NULL) { | 72 | if (p->relocs[i].gobj == NULL) { |
| 73 | DRM_ERROR("gem object lookup failed 0x%x\n", | 73 | DRM_ERROR("gem object lookup failed 0x%x\n", |
| 74 | r->handle); | 74 | r->handle); |
| 75 | return -EINVAL; | 75 | return -ENOENT; |
| 76 | } | 76 | } |
| 77 | p->relocs_ptr[i] = &p->relocs[i]; | 77 | p->relocs_ptr[i] = &p->relocs[i]; |
| 78 | p->relocs[i].robj = p->relocs[i].gobj->driver_private; | 78 | p->relocs[i].robj = p->relocs[i].gobj->driver_private; |
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c index 4eb67c0e0996..5731fc9b1ae3 100644 --- a/drivers/gpu/drm/radeon/radeon_cursor.c +++ b/drivers/gpu/drm/radeon/radeon_cursor.c | |||
| @@ -170,7 +170,7 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc, | |||
| 170 | obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); | 170 | obj = drm_gem_object_lookup(crtc->dev, file_priv, handle); |
| 171 | if (!obj) { | 171 | if (!obj) { |
| 172 | DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id); | 172 | DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id); |
| 173 | return -EINVAL; | 173 | return -ENOENT; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | ret = radeon_gem_object_pin(obj, RADEON_GEM_DOMAIN_VRAM, &gpu_addr); | 176 | ret = radeon_gem_object_pin(obj, RADEON_GEM_DOMAIN_VRAM, &gpu_addr); |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index a64811a94519..4f7a170d1566 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
| @@ -347,7 +347,8 @@ int radeon_dummy_page_init(struct radeon_device *rdev) | |||
| 347 | return -ENOMEM; | 347 | return -ENOMEM; |
| 348 | rdev->dummy_page.addr = pci_map_page(rdev->pdev, rdev->dummy_page.page, | 348 | rdev->dummy_page.addr = pci_map_page(rdev->pdev, rdev->dummy_page.page, |
| 349 | 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); | 349 | 0, PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); |
| 350 | if (!rdev->dummy_page.addr) { | 350 | if (pci_dma_mapping_error(rdev->pdev, rdev->dummy_page.addr)) { |
| 351 | dev_err(&rdev->pdev->dev, "Failed to DMA MAP the dummy page\n"); | ||
| 351 | __free_page(rdev->dummy_page.page); | 352 | __free_page(rdev->dummy_page.page); |
| 352 | rdev->dummy_page.page = NULL; | 353 | rdev->dummy_page.page = NULL; |
| 353 | return -ENOMEM; | 354 | return -ENOMEM; |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 74dac9635d70..5764f4d3b4f1 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
| @@ -161,17 +161,13 @@ void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, | |||
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, | 163 | static void radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, |
| 164 | u16 *blue, uint32_t size) | 164 | u16 *blue, uint32_t start, uint32_t size) |
| 165 | { | 165 | { |
| 166 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 166 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
| 167 | int i; | 167 | int end = (start + size > 256) ? 256 : start + size, i; |
| 168 | |||
| 169 | if (size != 256) { | ||
| 170 | return; | ||
| 171 | } | ||
| 172 | 168 | ||
| 173 | /* userspace palettes are always correct as is */ | 169 | /* userspace palettes are always correct as is */ |
| 174 | for (i = 0; i < 256; i++) { | 170 | for (i = start; i < end; i++) { |
| 175 | radeon_crtc->lut_r[i] = red[i] >> 6; | 171 | radeon_crtc->lut_r[i] = red[i] >> 6; |
| 176 | radeon_crtc->lut_g[i] = green[i] >> 6; | 172 | radeon_crtc->lut_g[i] = green[i] >> 6; |
| 177 | radeon_crtc->lut_b[i] = blue[i] >> 6; | 173 | radeon_crtc->lut_b[i] = blue[i] >> 6; |
| @@ -319,6 +315,10 @@ static void radeon_print_display_setup(struct drm_device *dev) | |||
| 319 | radeon_connector->ddc_bus->rec.en_data_reg, | 315 | radeon_connector->ddc_bus->rec.en_data_reg, |
| 320 | radeon_connector->ddc_bus->rec.y_clk_reg, | 316 | radeon_connector->ddc_bus->rec.y_clk_reg, |
| 321 | radeon_connector->ddc_bus->rec.y_data_reg); | 317 | radeon_connector->ddc_bus->rec.y_data_reg); |
| 318 | if (radeon_connector->router_bus) | ||
| 319 | DRM_INFO(" DDC Router 0x%x/0x%x\n", | ||
| 320 | radeon_connector->router.mux_control_pin, | ||
| 321 | radeon_connector->router.mux_state); | ||
| 322 | } else { | 322 | } else { |
| 323 | if (connector->connector_type == DRM_MODE_CONNECTOR_VGA || | 323 | if (connector->connector_type == DRM_MODE_CONNECTOR_VGA || |
| 324 | connector->connector_type == DRM_MODE_CONNECTOR_DVII || | 324 | connector->connector_type == DRM_MODE_CONNECTOR_DVII || |
| @@ -395,6 +395,10 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) | |||
| 395 | struct radeon_device *rdev = dev->dev_private; | 395 | struct radeon_device *rdev = dev->dev_private; |
| 396 | int ret = 0; | 396 | int ret = 0; |
| 397 | 397 | ||
| 398 | /* on hw with routers, select right port */ | ||
| 399 | if (radeon_connector->router.valid) | ||
| 400 | radeon_router_select_port(radeon_connector); | ||
| 401 | |||
| 398 | if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || | 402 | if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || |
| 399 | (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) { | 403 | (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) { |
| 400 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; | 404 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; |
| @@ -425,6 +429,10 @@ static int radeon_ddc_dump(struct drm_connector *connector) | |||
| 425 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 429 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 426 | int ret = 0; | 430 | int ret = 0; |
| 427 | 431 | ||
| 432 | /* on hw with routers, select right port */ | ||
| 433 | if (radeon_connector->router.valid) | ||
| 434 | radeon_router_select_port(radeon_connector); | ||
| 435 | |||
| 428 | if (!radeon_connector->ddc_bus) | 436 | if (!radeon_connector->ddc_bus) |
| 429 | return -1; | 437 | return -1; |
| 430 | edid = drm_get_edid(connector, &radeon_connector->ddc_bus->adapter); | 438 | edid = drm_get_edid(connector, &radeon_connector->ddc_bus->adapter); |
| @@ -876,13 +884,12 @@ radeon_user_framebuffer_create(struct drm_device *dev, | |||
| 876 | if (obj == NULL) { | 884 | if (obj == NULL) { |
| 877 | dev_err(&dev->pdev->dev, "No GEM object associated to handle 0x%08X, " | 885 | dev_err(&dev->pdev->dev, "No GEM object associated to handle 0x%08X, " |
| 878 | "can't create framebuffer\n", mode_cmd->handle); | 886 | "can't create framebuffer\n", mode_cmd->handle); |
| 879 | return NULL; | 887 | return ERR_PTR(-ENOENT); |
| 880 | } | 888 | } |
| 881 | 889 | ||
| 882 | radeon_fb = kzalloc(sizeof(*radeon_fb), GFP_KERNEL); | 890 | radeon_fb = kzalloc(sizeof(*radeon_fb), GFP_KERNEL); |
| 883 | if (radeon_fb == NULL) { | 891 | if (radeon_fb == NULL) |
| 884 | return NULL; | 892 | return ERR_PTR(-ENOMEM); |
| 885 | } | ||
| 886 | 893 | ||
| 887 | radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj); | 894 | radeon_framebuffer_init(dev, radeon_fb, mode_cmd, obj); |
| 888 | 895 | ||
| @@ -1040,6 +1047,9 @@ int radeon_modeset_init(struct radeon_device *rdev) | |||
| 1040 | return ret; | 1047 | return ret; |
| 1041 | } | 1048 | } |
| 1042 | 1049 | ||
| 1050 | /* init i2c buses */ | ||
| 1051 | radeon_i2c_init(rdev); | ||
| 1052 | |||
| 1043 | /* check combios for a valid hardcoded EDID - Sun servers */ | 1053 | /* check combios for a valid hardcoded EDID - Sun servers */ |
| 1044 | if (!rdev->is_atom_bios) { | 1054 | if (!rdev->is_atom_bios) { |
| 1045 | /* check for hardcoded EDID in BIOS */ | 1055 | /* check for hardcoded EDID in BIOS */ |
| @@ -1080,6 +1090,8 @@ void radeon_modeset_fini(struct radeon_device *rdev) | |||
| 1080 | drm_mode_config_cleanup(rdev->ddev); | 1090 | drm_mode_config_cleanup(rdev->ddev); |
| 1081 | rdev->mode_info.mode_config_initialized = false; | 1091 | rdev->mode_info.mode_config_initialized = false; |
| 1082 | } | 1092 | } |
| 1093 | /* free i2c buses */ | ||
| 1094 | radeon_i2c_fini(rdev); | ||
| 1083 | } | 1095 | } |
| 1084 | 1096 | ||
| 1085 | bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, | 1097 | bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index a72a3ee5d69b..c578f265b24c 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
| @@ -226,7 +226,7 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data, | |||
| 226 | /* just do a BO wait for now */ | 226 | /* just do a BO wait for now */ |
| 227 | gobj = drm_gem_object_lookup(dev, filp, args->handle); | 227 | gobj = drm_gem_object_lookup(dev, filp, args->handle); |
| 228 | if (gobj == NULL) { | 228 | if (gobj == NULL) { |
| 229 | return -EINVAL; | 229 | return -ENOENT; |
| 230 | } | 230 | } |
| 231 | robj = gobj->driver_private; | 231 | robj = gobj->driver_private; |
| 232 | 232 | ||
| @@ -245,7 +245,7 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
| 245 | 245 | ||
| 246 | gobj = drm_gem_object_lookup(dev, filp, args->handle); | 246 | gobj = drm_gem_object_lookup(dev, filp, args->handle); |
| 247 | if (gobj == NULL) { | 247 | if (gobj == NULL) { |
| 248 | return -EINVAL; | 248 | return -ENOENT; |
| 249 | } | 249 | } |
| 250 | robj = gobj->driver_private; | 250 | robj = gobj->driver_private; |
| 251 | args->addr_ptr = radeon_bo_mmap_offset(robj); | 251 | args->addr_ptr = radeon_bo_mmap_offset(robj); |
| @@ -264,7 +264,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
| 264 | 264 | ||
| 265 | gobj = drm_gem_object_lookup(dev, filp, args->handle); | 265 | gobj = drm_gem_object_lookup(dev, filp, args->handle); |
| 266 | if (gobj == NULL) { | 266 | if (gobj == NULL) { |
| 267 | return -EINVAL; | 267 | return -ENOENT; |
| 268 | } | 268 | } |
| 269 | robj = gobj->driver_private; | 269 | robj = gobj->driver_private; |
| 270 | r = radeon_bo_wait(robj, &cur_placement, true); | 270 | r = radeon_bo_wait(robj, &cur_placement, true); |
| @@ -294,7 +294,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | |||
| 294 | 294 | ||
| 295 | gobj = drm_gem_object_lookup(dev, filp, args->handle); | 295 | gobj = drm_gem_object_lookup(dev, filp, args->handle); |
| 296 | if (gobj == NULL) { | 296 | if (gobj == NULL) { |
| 297 | return -EINVAL; | 297 | return -ENOENT; |
| 298 | } | 298 | } |
| 299 | robj = gobj->driver_private; | 299 | robj = gobj->driver_private; |
| 300 | r = radeon_bo_wait(robj, NULL, false); | 300 | r = radeon_bo_wait(robj, NULL, false); |
| @@ -316,7 +316,7 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data, | |||
| 316 | DRM_DEBUG("%d \n", args->handle); | 316 | DRM_DEBUG("%d \n", args->handle); |
| 317 | gobj = drm_gem_object_lookup(dev, filp, args->handle); | 317 | gobj = drm_gem_object_lookup(dev, filp, args->handle); |
| 318 | if (gobj == NULL) | 318 | if (gobj == NULL) |
| 319 | return -EINVAL; | 319 | return -ENOENT; |
| 320 | robj = gobj->driver_private; | 320 | robj = gobj->driver_private; |
| 321 | r = radeon_bo_set_tiling_flags(robj, args->tiling_flags, args->pitch); | 321 | r = radeon_bo_set_tiling_flags(robj, args->tiling_flags, args->pitch); |
| 322 | drm_gem_object_unreference_unlocked(gobj); | 322 | drm_gem_object_unreference_unlocked(gobj); |
| @@ -334,7 +334,7 @@ int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data, | |||
| 334 | DRM_DEBUG("\n"); | 334 | DRM_DEBUG("\n"); |
| 335 | gobj = drm_gem_object_lookup(dev, filp, args->handle); | 335 | gobj = drm_gem_object_lookup(dev, filp, args->handle); |
| 336 | if (gobj == NULL) | 336 | if (gobj == NULL) |
| 337 | return -EINVAL; | 337 | return -ENOENT; |
| 338 | rbo = gobj->driver_private; | 338 | rbo = gobj->driver_private; |
| 339 | r = radeon_bo_reserve(rbo, false); | 339 | r = radeon_bo_reserve(rbo, false); |
| 340 | if (unlikely(r != 0)) | 340 | if (unlikely(r != 0)) |
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index 5def6f5dff38..bfd2ce5f5372 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
| @@ -52,6 +52,10 @@ bool radeon_ddc_probe(struct radeon_connector *radeon_connector) | |||
| 52 | } | 52 | } |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | /* on hw with routers, select right port */ | ||
| 56 | if (radeon_connector->router.valid) | ||
| 57 | radeon_router_select_port(radeon_connector); | ||
| 58 | |||
| 55 | ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); | 59 | ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); |
| 56 | if (ret == 2) | 60 | if (ret == 2) |
| 57 | return true; | 61 | return true; |
| @@ -960,6 +964,59 @@ void radeon_i2c_destroy(struct radeon_i2c_chan *i2c) | |||
| 960 | kfree(i2c); | 964 | kfree(i2c); |
| 961 | } | 965 | } |
| 962 | 966 | ||
| 967 | /* Add the default buses */ | ||
| 968 | void radeon_i2c_init(struct radeon_device *rdev) | ||
| 969 | { | ||
| 970 | if (rdev->is_atom_bios) | ||
| 971 | radeon_atombios_i2c_init(rdev); | ||
| 972 | else | ||
| 973 | radeon_combios_i2c_init(rdev); | ||
| 974 | } | ||
| 975 | |||
| 976 | /* remove all the buses */ | ||
| 977 | void radeon_i2c_fini(struct radeon_device *rdev) | ||
| 978 | { | ||
| 979 | int i; | ||
| 980 | |||
| 981 | for (i = 0; i < RADEON_MAX_I2C_BUS; i++) { | ||
| 982 | if (rdev->i2c_bus[i]) { | ||
| 983 | radeon_i2c_destroy(rdev->i2c_bus[i]); | ||
| 984 | rdev->i2c_bus[i] = NULL; | ||
| 985 | } | ||
| 986 | } | ||
| 987 | } | ||
| 988 | |||
| 989 | /* Add additional buses */ | ||
| 990 | void radeon_i2c_add(struct radeon_device *rdev, | ||
| 991 | struct radeon_i2c_bus_rec *rec, | ||
| 992 | const char *name) | ||
| 993 | { | ||
| 994 | struct drm_device *dev = rdev->ddev; | ||
| 995 | int i; | ||
| 996 | |||
| 997 | for (i = 0; i < RADEON_MAX_I2C_BUS; i++) { | ||
| 998 | if (!rdev->i2c_bus[i]) { | ||
| 999 | rdev->i2c_bus[i] = radeon_i2c_create(dev, rec, name); | ||
| 1000 | return; | ||
| 1001 | } | ||
| 1002 | } | ||
| 1003 | } | ||
| 1004 | |||
| 1005 | /* looks up bus based on id */ | ||
| 1006 | struct radeon_i2c_chan *radeon_i2c_lookup(struct radeon_device *rdev, | ||
| 1007 | struct radeon_i2c_bus_rec *i2c_bus) | ||
| 1008 | { | ||
| 1009 | int i; | ||
| 1010 | |||
| 1011 | for (i = 0; i < RADEON_MAX_I2C_BUS; i++) { | ||
| 1012 | if (rdev->i2c_bus[i] && | ||
| 1013 | (rdev->i2c_bus[i]->rec.i2c_id == i2c_bus->i2c_id)) { | ||
| 1014 | return rdev->i2c_bus[i]; | ||
| 1015 | } | ||
| 1016 | } | ||
| 1017 | return NULL; | ||
| 1018 | } | ||
| 1019 | |||
| 963 | struct drm_encoder *radeon_best_encoder(struct drm_connector *connector) | 1020 | struct drm_encoder *radeon_best_encoder(struct drm_connector *connector) |
| 964 | { | 1021 | { |
| 965 | return NULL; | 1022 | return NULL; |
| @@ -1020,3 +1077,28 @@ void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c_bus, | |||
| 1020 | addr, val); | 1077 | addr, val); |
| 1021 | } | 1078 | } |
| 1022 | 1079 | ||
| 1080 | /* router switching */ | ||
| 1081 | void radeon_router_select_port(struct radeon_connector *radeon_connector) | ||
| 1082 | { | ||
| 1083 | u8 val; | ||
| 1084 | |||
| 1085 | if (!radeon_connector->router.valid) | ||
| 1086 | return; | ||
| 1087 | |||
| 1088 | radeon_i2c_get_byte(radeon_connector->router_bus, | ||
| 1089 | radeon_connector->router.i2c_addr, | ||
| 1090 | 0x3, &val); | ||
| 1091 | val &= radeon_connector->router.mux_control_pin; | ||
| 1092 | radeon_i2c_put_byte(radeon_connector->router_bus, | ||
| 1093 | radeon_connector->router.i2c_addr, | ||
| 1094 | 0x3, val); | ||
| 1095 | radeon_i2c_get_byte(radeon_connector->router_bus, | ||
| 1096 | radeon_connector->router.i2c_addr, | ||
| 1097 | 0x1, &val); | ||
| 1098 | val &= radeon_connector->router.mux_control_pin; | ||
| 1099 | val |= radeon_connector->router.mux_state; | ||
| 1100 | radeon_i2c_put_byte(radeon_connector->router_bus, | ||
| 1101 | radeon_connector->router.i2c_addr, | ||
| 1102 | 0x1, val); | ||
| 1103 | } | ||
| 1104 | |||
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index ddcd3b13f151..b1c8ace5f080 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
| @@ -112,7 +112,9 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
| 112 | 112 | ||
| 113 | info = data; | 113 | info = data; |
| 114 | value_ptr = (uint32_t *)((unsigned long)info->value); | 114 | value_ptr = (uint32_t *)((unsigned long)info->value); |
| 115 | value = *value_ptr; | 115 | if (DRM_COPY_FROM_USER(&value, value_ptr, sizeof(value))) |
| 116 | return -EFAULT; | ||
| 117 | |||
| 116 | switch (info->request) { | 118 | switch (info->request) { |
| 117 | case RADEON_INFO_DEVICE_ID: | 119 | case RADEON_INFO_DEVICE_ID: |
| 118 | value = dev->pci_device; | 120 | value = dev->pci_device; |
| @@ -160,13 +162,27 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
| 160 | return -EINVAL; | 162 | return -EINVAL; |
| 161 | } | 163 | } |
| 162 | case RADEON_INFO_WANT_HYPERZ: | 164 | case RADEON_INFO_WANT_HYPERZ: |
| 165 | /* The "value" here is both an input and output parameter. | ||
| 166 | * If the input value is 1, filp requests hyper-z access. | ||
| 167 | * If the input value is 0, filp revokes its hyper-z access. | ||
| 168 | * | ||
| 169 | * When returning, the value is 1 if filp owns hyper-z access, | ||
| 170 | * 0 otherwise. */ | ||
| 171 | if (value >= 2) { | ||
| 172 | DRM_DEBUG_KMS("WANT_HYPERZ: invalid value %d\n", value); | ||
| 173 | return -EINVAL; | ||
| 174 | } | ||
| 163 | mutex_lock(&dev->struct_mutex); | 175 | mutex_lock(&dev->struct_mutex); |
| 164 | if (rdev->hyperz_filp) | 176 | if (value == 1) { |
| 165 | value = 0; | 177 | /* wants hyper-z */ |
| 166 | else { | 178 | if (!rdev->hyperz_filp) |
| 167 | rdev->hyperz_filp = filp; | 179 | rdev->hyperz_filp = filp; |
| 168 | value = 1; | 180 | } else if (value == 0) { |
| 181 | /* revokes hyper-z */ | ||
| 182 | if (rdev->hyperz_filp == filp) | ||
| 183 | rdev->hyperz_filp = NULL; | ||
| 169 | } | 184 | } |
| 185 | value = rdev->hyperz_filp == filp ? 1 : 0; | ||
| 170 | mutex_unlock(&dev->struct_mutex); | 186 | mutex_unlock(&dev->struct_mutex); |
| 171 | break; | 187 | break; |
| 172 | default: | 188 | default: |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 71aea4037e90..5bbc086b9267 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
| @@ -82,6 +82,8 @@ enum radeon_hpd_id { | |||
| 82 | RADEON_HPD_NONE = 0xff, | 82 | RADEON_HPD_NONE = 0xff, |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | #define RADEON_MAX_I2C_BUS 16 | ||
| 86 | |||
| 85 | /* radeon gpio-based i2c | 87 | /* radeon gpio-based i2c |
| 86 | * 1. "mask" reg and bits | 88 | * 1. "mask" reg and bits |
| 87 | * grabs the gpio pins for software use | 89 | * grabs the gpio pins for software use |
| @@ -398,6 +400,16 @@ struct radeon_hpd { | |||
| 398 | struct radeon_gpio_rec gpio; | 400 | struct radeon_gpio_rec gpio; |
| 399 | }; | 401 | }; |
| 400 | 402 | ||
| 403 | struct radeon_router { | ||
| 404 | bool valid; | ||
| 405 | u32 router_id; | ||
| 406 | struct radeon_i2c_bus_rec i2c_info; | ||
| 407 | u8 i2c_addr; | ||
| 408 | u8 mux_type; | ||
| 409 | u8 mux_control_pin; | ||
| 410 | u8 mux_state; | ||
| 411 | }; | ||
| 412 | |||
| 401 | struct radeon_connector { | 413 | struct radeon_connector { |
| 402 | struct drm_connector base; | 414 | struct drm_connector base; |
| 403 | uint32_t connector_id; | 415 | uint32_t connector_id; |
| @@ -413,6 +425,8 @@ struct radeon_connector { | |||
| 413 | bool dac_load_detect; | 425 | bool dac_load_detect; |
| 414 | uint16_t connector_object_id; | 426 | uint16_t connector_object_id; |
| 415 | struct radeon_hpd hpd; | 427 | struct radeon_hpd hpd; |
| 428 | struct radeon_router router; | ||
| 429 | struct radeon_i2c_chan *router_bus; | ||
| 416 | }; | 430 | }; |
| 417 | 431 | ||
| 418 | struct radeon_framebuffer { | 432 | struct radeon_framebuffer { |
| @@ -445,6 +459,15 @@ extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, | |||
| 445 | extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | 459 | extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, |
| 446 | uint8_t write_byte, uint8_t *read_byte); | 460 | uint8_t write_byte, uint8_t *read_byte); |
| 447 | 461 | ||
| 462 | extern void radeon_i2c_init(struct radeon_device *rdev); | ||
| 463 | extern void radeon_i2c_fini(struct radeon_device *rdev); | ||
| 464 | extern void radeon_combios_i2c_init(struct radeon_device *rdev); | ||
| 465 | extern void radeon_atombios_i2c_init(struct radeon_device *rdev); | ||
| 466 | extern void radeon_i2c_add(struct radeon_device *rdev, | ||
| 467 | struct radeon_i2c_bus_rec *rec, | ||
| 468 | const char *name); | ||
| 469 | extern struct radeon_i2c_chan *radeon_i2c_lookup(struct radeon_device *rdev, | ||
| 470 | struct radeon_i2c_bus_rec *i2c_bus); | ||
| 448 | extern struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, | 471 | extern struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, |
| 449 | struct radeon_i2c_bus_rec *rec, | 472 | struct radeon_i2c_bus_rec *rec, |
| 450 | const char *name); | 473 | const char *name); |
| @@ -460,6 +483,7 @@ extern void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c, | |||
| 460 | u8 slave_addr, | 483 | u8 slave_addr, |
| 461 | u8 addr, | 484 | u8 addr, |
| 462 | u8 val); | 485 | u8 val); |
| 486 | extern void radeon_router_select_port(struct radeon_connector *radeon_connector); | ||
| 463 | extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector); | 487 | extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector); |
| 464 | extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector); | 488 | extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector); |
| 465 | 489 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 95f8b3a3c43d..58038f5cab38 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
| @@ -472,9 +472,9 @@ static const struct attribute_group hwmon_attrgroup = { | |||
| 472 | .attrs = hwmon_attributes, | 472 | .attrs = hwmon_attributes, |
| 473 | }; | 473 | }; |
| 474 | 474 | ||
| 475 | static void radeon_hwmon_init(struct radeon_device *rdev) | 475 | static int radeon_hwmon_init(struct radeon_device *rdev) |
| 476 | { | 476 | { |
| 477 | int err; | 477 | int err = 0; |
| 478 | 478 | ||
| 479 | rdev->pm.int_hwmon_dev = NULL; | 479 | rdev->pm.int_hwmon_dev = NULL; |
| 480 | 480 | ||
| @@ -483,15 +483,26 @@ static void radeon_hwmon_init(struct radeon_device *rdev) | |||
| 483 | case THERMAL_TYPE_RV770: | 483 | case THERMAL_TYPE_RV770: |
| 484 | case THERMAL_TYPE_EVERGREEN: | 484 | case THERMAL_TYPE_EVERGREEN: |
| 485 | rdev->pm.int_hwmon_dev = hwmon_device_register(rdev->dev); | 485 | rdev->pm.int_hwmon_dev = hwmon_device_register(rdev->dev); |
| 486 | if (IS_ERR(rdev->pm.int_hwmon_dev)) { | ||
| 487 | err = PTR_ERR(rdev->pm.int_hwmon_dev); | ||
| 488 | dev_err(rdev->dev, | ||
| 489 | "Unable to register hwmon device: %d\n", err); | ||
| 490 | break; | ||
| 491 | } | ||
| 486 | dev_set_drvdata(rdev->pm.int_hwmon_dev, rdev->ddev); | 492 | dev_set_drvdata(rdev->pm.int_hwmon_dev, rdev->ddev); |
| 487 | err = sysfs_create_group(&rdev->pm.int_hwmon_dev->kobj, | 493 | err = sysfs_create_group(&rdev->pm.int_hwmon_dev->kobj, |
| 488 | &hwmon_attrgroup); | 494 | &hwmon_attrgroup); |
| 489 | if (err) | 495 | if (err) { |
| 490 | DRM_ERROR("Unable to create hwmon sysfs file: %d\n", err); | 496 | dev_err(rdev->dev, |
| 497 | "Unable to create hwmon sysfs file: %d\n", err); | ||
| 498 | hwmon_device_unregister(rdev->dev); | ||
| 499 | } | ||
| 491 | break; | 500 | break; |
| 492 | default: | 501 | default: |
| 493 | break; | 502 | break; |
| 494 | } | 503 | } |
| 504 | |||
| 505 | return err; | ||
| 495 | } | 506 | } |
| 496 | 507 | ||
| 497 | static void radeon_hwmon_fini(struct radeon_device *rdev) | 508 | static void radeon_hwmon_fini(struct radeon_device *rdev) |
| @@ -540,6 +551,7 @@ void radeon_pm_resume(struct radeon_device *rdev) | |||
| 540 | int radeon_pm_init(struct radeon_device *rdev) | 551 | int radeon_pm_init(struct radeon_device *rdev) |
| 541 | { | 552 | { |
| 542 | int ret; | 553 | int ret; |
| 554 | |||
| 543 | /* default to profile method */ | 555 | /* default to profile method */ |
| 544 | rdev->pm.pm_method = PM_METHOD_PROFILE; | 556 | rdev->pm.pm_method = PM_METHOD_PROFILE; |
| 545 | rdev->pm.profile = PM_PROFILE_DEFAULT; | 557 | rdev->pm.profile = PM_PROFILE_DEFAULT; |
| @@ -561,7 +573,9 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
| 561 | } | 573 | } |
| 562 | 574 | ||
| 563 | /* set up the internal thermal sensor if applicable */ | 575 | /* set up the internal thermal sensor if applicable */ |
| 564 | radeon_hwmon_init(rdev); | 576 | ret = radeon_hwmon_init(rdev); |
| 577 | if (ret) | ||
| 578 | return ret; | ||
| 565 | if (rdev->pm.num_power_states > 1) { | 579 | if (rdev->pm.num_power_states > 1) { |
| 566 | /* where's the best place to put these? */ | 580 | /* where's the best place to put these? */ |
| 567 | ret = device_create_file(rdev->dev, &dev_attr_power_profile); | 581 | ret = device_create_file(rdev->dev, &dev_attr_power_profile); |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/rv515 b/drivers/gpu/drm/radeon/reg_srcs/rv515 index 8293855f5f0d..b3f9f1d92005 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/rv515 +++ b/drivers/gpu/drm/radeon/reg_srcs/rv515 | |||
| @@ -316,6 +316,7 @@ rv515 0x6d40 | |||
| 316 | 0x4BD0 FG_FOG_COLOR_B | 316 | 0x4BD0 FG_FOG_COLOR_B |
| 317 | 0x4BD4 FG_ALPHA_FUNC | 317 | 0x4BD4 FG_ALPHA_FUNC |
| 318 | 0x4BD8 FG_DEPTH_SRC | 318 | 0x4BD8 FG_DEPTH_SRC |
| 319 | 0x4BE0 FG_ALPHA_VALUE | ||
| 319 | 0x4C00 US_ALU_CONST_R_0 | 320 | 0x4C00 US_ALU_CONST_R_0 |
| 320 | 0x4C04 US_ALU_CONST_G_0 | 321 | 0x4C04 US_ALU_CONST_G_0 |
| 321 | 0x4C08 US_ALU_CONST_B_0 | 322 | 0x4C08 US_ALU_CONST_B_0 |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 437ac786277a..64d7f47df868 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
| @@ -737,7 +737,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, | |||
| 737 | 737 | ||
| 738 | if (ret) { | 738 | if (ret) { |
| 739 | DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret); | 739 | DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret); |
| 740 | return NULL; | 740 | return ERR_PTR(ret); |
| 741 | } | 741 | } |
| 742 | return &vfb->base; | 742 | return &vfb->base; |
| 743 | 743 | ||
| @@ -747,7 +747,7 @@ try_dmabuf: | |||
| 747 | ret = vmw_user_dmabuf_lookup(tfile, mode_cmd->handle, &bo); | 747 | ret = vmw_user_dmabuf_lookup(tfile, mode_cmd->handle, &bo); |
| 748 | if (ret) { | 748 | if (ret) { |
| 749 | DRM_ERROR("failed to find buffer: %i\n", ret); | 749 | DRM_ERROR("failed to find buffer: %i\n", ret); |
| 750 | return NULL; | 750 | return ERR_PTR(-ENOENT); |
| 751 | } | 751 | } |
| 752 | 752 | ||
| 753 | ret = vmw_kms_new_framebuffer_dmabuf(dev_priv, bo, &vfb, | 753 | ret = vmw_kms_new_framebuffer_dmabuf(dev_priv, bo, &vfb, |
| @@ -758,7 +758,7 @@ try_dmabuf: | |||
| 758 | 758 | ||
| 759 | if (ret) { | 759 | if (ret) { |
| 760 | DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret); | 760 | DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret); |
| 761 | return NULL; | 761 | return ERR_PTR(ret); |
| 762 | } | 762 | } |
| 763 | 763 | ||
| 764 | return &vfb->base; | 764 | return &vfb->base; |
| @@ -768,7 +768,7 @@ err_not_scanout: | |||
| 768 | /* vmw_user_surface_lookup takes one ref */ | 768 | /* vmw_user_surface_lookup takes one ref */ |
| 769 | vmw_surface_unreference(&surface); | 769 | vmw_surface_unreference(&surface); |
| 770 | 770 | ||
| 771 | return NULL; | 771 | return ERR_PTR(-EINVAL); |
| 772 | } | 772 | } |
| 773 | 773 | ||
| 774 | static struct drm_mode_config_funcs vmw_kms_funcs = { | 774 | static struct drm_mode_config_funcs vmw_kms_funcs = { |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c index cfaf690a5b2f..2ff5cf78235f 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | |||
| @@ -79,7 +79,7 @@ static void vmw_ldu_crtc_restore(struct drm_crtc *crtc) | |||
| 79 | 79 | ||
| 80 | static void vmw_ldu_crtc_gamma_set(struct drm_crtc *crtc, | 80 | static void vmw_ldu_crtc_gamma_set(struct drm_crtc *crtc, |
| 81 | u16 *r, u16 *g, u16 *b, | 81 | u16 *r, u16 *g, u16 *b, |
| 82 | uint32_t size) | 82 | uint32_t start, uint32_t size) |
| 83 | { | 83 | { |
| 84 | } | 84 | } |
| 85 | 85 | ||
diff --git a/drivers/hwmon/ams/ams.h b/drivers/hwmon/ams/ams.h index b28d7e27a031..90f094d45450 100644 --- a/drivers/hwmon/ams/ams.h +++ b/drivers/hwmon/ams/ams.h | |||
| @@ -23,7 +23,7 @@ struct ams { | |||
| 23 | 23 | ||
| 24 | /* General properties */ | 24 | /* General properties */ |
| 25 | struct device_node *of_node; | 25 | struct device_node *of_node; |
| 26 | struct of_device *of_dev; | 26 | struct platform_device *of_dev; |
| 27 | char has_device; | 27 | char has_device; |
| 28 | char vflag; | 28 | char vflag; |
| 29 | u32 orient1; | 29 | u32 orient1; |
diff --git a/drivers/hwmon/ultra45_env.c b/drivers/hwmon/ultra45_env.c index 89643261ccdb..d863e13a50b8 100644 --- a/drivers/hwmon/ultra45_env.c +++ b/drivers/hwmon/ultra45_env.c | |||
| @@ -234,7 +234,7 @@ static const struct attribute_group env_group = { | |||
| 234 | .attrs = env_attributes, | 234 | .attrs = env_attributes, |
| 235 | }; | 235 | }; |
| 236 | 236 | ||
| 237 | static int __devinit env_probe(struct of_device *op, | 237 | static int __devinit env_probe(struct platform_device *op, |
| 238 | const struct of_device_id *match) | 238 | const struct of_device_id *match) |
| 239 | { | 239 | { |
| 240 | struct env *p = kzalloc(sizeof(*p), GFP_KERNEL); | 240 | struct env *p = kzalloc(sizeof(*p), GFP_KERNEL); |
| @@ -276,7 +276,7 @@ out_free: | |||
| 276 | goto out; | 276 | goto out; |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | static int __devexit env_remove(struct of_device *op) | 279 | static int __devexit env_remove(struct platform_device *op) |
| 280 | { | 280 | { |
| 281 | struct env *p = dev_get_drvdata(&op->dev); | 281 | struct env *p = dev_get_drvdata(&op->dev); |
| 282 | 282 | ||
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index e591de1bc704..f7bd2613cecc 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c | |||
| @@ -105,7 +105,7 @@ struct i2c_reg { | |||
| 105 | 105 | ||
| 106 | struct cpm_i2c { | 106 | struct cpm_i2c { |
| 107 | char *base; | 107 | char *base; |
| 108 | struct of_device *ofdev; | 108 | struct platform_device *ofdev; |
| 109 | struct i2c_adapter adap; | 109 | struct i2c_adapter adap; |
| 110 | uint dp_addr; | 110 | uint dp_addr; |
| 111 | int version; /* CPM1=1, CPM2=2 */ | 111 | int version; /* CPM1=1, CPM2=2 */ |
| @@ -428,7 +428,7 @@ static const struct i2c_adapter cpm_ops = { | |||
| 428 | 428 | ||
| 429 | static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) | 429 | static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) |
| 430 | { | 430 | { |
| 431 | struct of_device *ofdev = cpm->ofdev; | 431 | struct platform_device *ofdev = cpm->ofdev; |
| 432 | const u32 *data; | 432 | const u32 *data; |
| 433 | int len, ret, i; | 433 | int len, ret, i; |
| 434 | void __iomem *i2c_base; | 434 | void __iomem *i2c_base; |
| @@ -634,7 +634,7 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm) | |||
| 634 | cpm_muram_free(cpm->i2c_addr); | 634 | cpm_muram_free(cpm->i2c_addr); |
| 635 | } | 635 | } |
| 636 | 636 | ||
| 637 | static int __devinit cpm_i2c_probe(struct of_device *ofdev, | 637 | static int __devinit cpm_i2c_probe(struct platform_device *ofdev, |
| 638 | const struct of_device_id *match) | 638 | const struct of_device_id *match) |
| 639 | { | 639 | { |
| 640 | int result, len; | 640 | int result, len; |
| @@ -687,7 +687,7 @@ out_free: | |||
| 687 | return result; | 687 | return result; |
| 688 | } | 688 | } |
| 689 | 689 | ||
| 690 | static int __devexit cpm_i2c_remove(struct of_device *ofdev) | 690 | static int __devexit cpm_i2c_remove(struct platform_device *ofdev) |
| 691 | { | 691 | { |
| 692 | struct cpm_i2c *cpm = dev_get_drvdata(&ofdev->dev); | 692 | struct cpm_i2c *cpm = dev_get_drvdata(&ofdev->dev); |
| 693 | 693 | ||
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 1168d61418c9..43ca32fddde2 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
| @@ -661,7 +661,7 @@ static inline u8 iic_clckdiv(unsigned int opb) | |||
| 661 | return (u8)((opb + 9) / 10 - 1); | 661 | return (u8)((opb + 9) / 10 - 1); |
| 662 | } | 662 | } |
| 663 | 663 | ||
| 664 | static int __devinit iic_request_irq(struct of_device *ofdev, | 664 | static int __devinit iic_request_irq(struct platform_device *ofdev, |
| 665 | struct ibm_iic_private *dev) | 665 | struct ibm_iic_private *dev) |
| 666 | { | 666 | { |
| 667 | struct device_node *np = ofdev->dev.of_node; | 667 | struct device_node *np = ofdev->dev.of_node; |
| @@ -692,7 +692,7 @@ static int __devinit iic_request_irq(struct of_device *ofdev, | |||
| 692 | /* | 692 | /* |
| 693 | * Register single IIC interface | 693 | * Register single IIC interface |
| 694 | */ | 694 | */ |
| 695 | static int __devinit iic_probe(struct of_device *ofdev, | 695 | static int __devinit iic_probe(struct platform_device *ofdev, |
| 696 | const struct of_device_id *match) | 696 | const struct of_device_id *match) |
| 697 | { | 697 | { |
| 698 | struct device_node *np = ofdev->dev.of_node; | 698 | struct device_node *np = ofdev->dev.of_node; |
| @@ -780,7 +780,7 @@ error_cleanup: | |||
| 780 | /* | 780 | /* |
| 781 | * Cleanup initialized IIC interface | 781 | * Cleanup initialized IIC interface |
| 782 | */ | 782 | */ |
| 783 | static int __devexit iic_remove(struct of_device *ofdev) | 783 | static int __devexit iic_remove(struct platform_device *ofdev) |
| 784 | { | 784 | { |
| 785 | struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev); | 785 | struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev); |
| 786 | 786 | ||
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 6545d1c99b61..a1c419a716af 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
| @@ -560,7 +560,7 @@ static struct i2c_adapter mpc_ops = { | |||
| 560 | .timeout = HZ, | 560 | .timeout = HZ, |
| 561 | }; | 561 | }; |
| 562 | 562 | ||
| 563 | static int __devinit fsl_i2c_probe(struct of_device *op, | 563 | static int __devinit fsl_i2c_probe(struct platform_device *op, |
| 564 | const struct of_device_id *match) | 564 | const struct of_device_id *match) |
| 565 | { | 565 | { |
| 566 | struct mpc_i2c *i2c; | 566 | struct mpc_i2c *i2c; |
| @@ -646,7 +646,7 @@ static int __devinit fsl_i2c_probe(struct of_device *op, | |||
| 646 | return result; | 646 | return result; |
| 647 | }; | 647 | }; |
| 648 | 648 | ||
| 649 | static int __devexit fsl_i2c_remove(struct of_device *op) | 649 | static int __devexit fsl_i2c_remove(struct platform_device *op) |
| 650 | { | 650 | { |
| 651 | struct mpc_i2c *i2c = dev_get_drvdata(&op->dev); | 651 | struct mpc_i2c *i2c = dev_get_drvdata(&op->dev); |
| 652 | 652 | ||
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 0136abd50dd4..aaf6023a4835 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
| @@ -112,7 +112,7 @@ struct ehca_sport { | |||
| 112 | 112 | ||
| 113 | struct ehca_shca { | 113 | struct ehca_shca { |
| 114 | struct ib_device ib_device; | 114 | struct ib_device ib_device; |
| 115 | struct of_device *ofdev; | 115 | struct platform_device *ofdev; |
| 116 | u8 num_ports; | 116 | u8 num_ports; |
| 117 | int hw_level; | 117 | int hw_level; |
| 118 | struct list_head shca_list; | 118 | struct list_head shca_list; |
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index cfc4de7a5da4..c240e9972cb0 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
| @@ -713,7 +713,7 @@ static struct attribute_group ehca_dev_attr_grp = { | |||
| 713 | .attrs = ehca_dev_attrs | 713 | .attrs = ehca_dev_attrs |
| 714 | }; | 714 | }; |
| 715 | 715 | ||
| 716 | static int __devinit ehca_probe(struct of_device *dev, | 716 | static int __devinit ehca_probe(struct platform_device *dev, |
| 717 | const struct of_device_id *id) | 717 | const struct of_device_id *id) |
| 718 | { | 718 | { |
| 719 | struct ehca_shca *shca; | 719 | struct ehca_shca *shca; |
| @@ -879,7 +879,7 @@ probe1: | |||
| 879 | return -EINVAL; | 879 | return -EINVAL; |
| 880 | } | 880 | } |
| 881 | 881 | ||
| 882 | static int __devexit ehca_remove(struct of_device *dev) | 882 | static int __devexit ehca_remove(struct platform_device *dev) |
| 883 | { | 883 | { |
| 884 | struct ehca_shca *shca = dev_get_drvdata(&dev->dev); | 884 | struct ehca_shca *shca = dev_get_drvdata(&dev->dev); |
| 885 | unsigned long flags; | 885 | unsigned long flags; |
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index f3bb92e9755f..8e130bf7d32b 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c | |||
| @@ -173,7 +173,7 @@ static int __devinit sparcspkr_probe(struct device *dev) | |||
| 173 | return 0; | 173 | return 0; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | static int sparcspkr_shutdown(struct of_device *dev) | 176 | static int sparcspkr_shutdown(struct platform_device *dev) |
| 177 | { | 177 | { |
| 178 | struct sparcspkr_state *state = dev_get_drvdata(&dev->dev); | 178 | struct sparcspkr_state *state = dev_get_drvdata(&dev->dev); |
| 179 | struct input_dev *input_dev = state->input_dev; | 179 | struct input_dev *input_dev = state->input_dev; |
| @@ -184,7 +184,7 @@ static int sparcspkr_shutdown(struct of_device *dev) | |||
| 184 | return 0; | 184 | return 0; |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | static int __devinit bbc_beep_probe(struct of_device *op, const struct of_device_id *match) | 187 | static int __devinit bbc_beep_probe(struct platform_device *op, const struct of_device_id *match) |
| 188 | { | 188 | { |
| 189 | struct sparcspkr_state *state; | 189 | struct sparcspkr_state *state; |
| 190 | struct bbc_beep_info *info; | 190 | struct bbc_beep_info *info; |
| @@ -231,7 +231,7 @@ out_err: | |||
| 231 | return err; | 231 | return err; |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | static int __devexit bbc_remove(struct of_device *op) | 234 | static int __devexit bbc_remove(struct platform_device *op) |
| 235 | { | 235 | { |
| 236 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); | 236 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); |
| 237 | struct input_dev *input_dev = state->input_dev; | 237 | struct input_dev *input_dev = state->input_dev; |
| @@ -269,7 +269,7 @@ static struct of_platform_driver bbc_beep_driver = { | |||
| 269 | .shutdown = sparcspkr_shutdown, | 269 | .shutdown = sparcspkr_shutdown, |
| 270 | }; | 270 | }; |
| 271 | 271 | ||
| 272 | static int __devinit grover_beep_probe(struct of_device *op, const struct of_device_id *match) | 272 | static int __devinit grover_beep_probe(struct platform_device *op, const struct of_device_id *match) |
| 273 | { | 273 | { |
| 274 | struct sparcspkr_state *state; | 274 | struct sparcspkr_state *state; |
| 275 | struct grover_beep_info *info; | 275 | struct grover_beep_info *info; |
| @@ -312,7 +312,7 @@ out_err: | |||
| 312 | return err; | 312 | return err; |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | static int __devexit grover_remove(struct of_device *op) | 315 | static int __devexit grover_remove(struct platform_device *op) |
| 316 | { | 316 | { |
| 317 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); | 317 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); |
| 318 | struct grover_beep_info *info = &state->u.grover; | 318 | struct grover_beep_info *info = &state->u.grover; |
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index cb2a24b94746..c5cc4508d6df 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h | |||
| @@ -49,7 +49,7 @@ static inline void i8042_write_command(int val) | |||
| 49 | #define OBP_PS2MS_NAME1 "kdmouse" | 49 | #define OBP_PS2MS_NAME1 "kdmouse" |
| 50 | #define OBP_PS2MS_NAME2 "mouse" | 50 | #define OBP_PS2MS_NAME2 "mouse" |
| 51 | 51 | ||
| 52 | static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_device_id *match) | 52 | static int __devinit sparc_i8042_probe(struct platform_device *op, const struct of_device_id *match) |
| 53 | { | 53 | { |
| 54 | struct device_node *dp = op->dev.of_node; | 54 | struct device_node *dp = op->dev.of_node; |
| 55 | 55 | ||
| @@ -57,7 +57,7 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_dev | |||
| 57 | while (dp) { | 57 | while (dp) { |
| 58 | if (!strcmp(dp->name, OBP_PS2KBD_NAME1) || | 58 | if (!strcmp(dp->name, OBP_PS2KBD_NAME1) || |
| 59 | !strcmp(dp->name, OBP_PS2KBD_NAME2)) { | 59 | !strcmp(dp->name, OBP_PS2KBD_NAME2)) { |
| 60 | struct of_device *kbd = of_find_device_by_node(dp); | 60 | struct platform_device *kbd = of_find_device_by_node(dp); |
| 61 | unsigned int irq = kbd->archdata.irqs[0]; | 61 | unsigned int irq = kbd->archdata.irqs[0]; |
| 62 | if (irq == 0xffffffff) | 62 | if (irq == 0xffffffff) |
| 63 | irq = op->archdata.irqs[0]; | 63 | irq = op->archdata.irqs[0]; |
| @@ -67,7 +67,7 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_dev | |||
| 67 | kbd_res = &kbd->resource[0]; | 67 | kbd_res = &kbd->resource[0]; |
| 68 | } else if (!strcmp(dp->name, OBP_PS2MS_NAME1) || | 68 | } else if (!strcmp(dp->name, OBP_PS2MS_NAME1) || |
| 69 | !strcmp(dp->name, OBP_PS2MS_NAME2)) { | 69 | !strcmp(dp->name, OBP_PS2MS_NAME2)) { |
| 70 | struct of_device *ms = of_find_device_by_node(dp); | 70 | struct platform_device *ms = of_find_device_by_node(dp); |
| 71 | unsigned int irq = ms->archdata.irqs[0]; | 71 | unsigned int irq = ms->archdata.irqs[0]; |
| 72 | if (irq == 0xffffffff) | 72 | if (irq == 0xffffffff) |
| 73 | irq = op->archdata.irqs[0]; | 73 | irq = op->archdata.irqs[0]; |
| @@ -80,7 +80,7 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_dev | |||
| 80 | return 0; | 80 | return 0; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | static int __devexit sparc_i8042_remove(struct of_device *op) | 83 | static int __devexit sparc_i8042_remove(struct platform_device *op) |
| 84 | { | 84 | { |
| 85 | of_iounmap(kbd_res, kbd_iobase, 8); | 85 | of_iounmap(kbd_res, kbd_iobase, 8); |
| 86 | 86 | ||
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c index e2c028d2638f..bb14449fb022 100644 --- a/drivers/input/serio/xilinx_ps2.c +++ b/drivers/input/serio/xilinx_ps2.c | |||
| @@ -232,7 +232,7 @@ static void sxps2_close(struct serio *pserio) | |||
| 232 | * It returns 0, if the driver is bound to the PS/2 device, or a negative | 232 | * It returns 0, if the driver is bound to the PS/2 device, or a negative |
| 233 | * value if there is an error. | 233 | * value if there is an error. |
| 234 | */ | 234 | */ |
| 235 | static int __devinit xps2_of_probe(struct of_device *ofdev, | 235 | static int __devinit xps2_of_probe(struct platform_device *ofdev, |
| 236 | const struct of_device_id *match) | 236 | const struct of_device_id *match) |
| 237 | { | 237 | { |
| 238 | struct resource r_irq; /* Interrupt resources */ | 238 | struct resource r_irq; /* Interrupt resources */ |
| @@ -332,7 +332,7 @@ failed1: | |||
| 332 | * if the driver module is being unloaded. It frees any resources allocated to | 332 | * if the driver module is being unloaded. It frees any resources allocated to |
| 333 | * the device. | 333 | * the device. |
| 334 | */ | 334 | */ |
| 335 | static int __devexit xps2_of_remove(struct of_device *of_dev) | 335 | static int __devexit xps2_of_remove(struct platform_device *of_dev) |
| 336 | { | 336 | { |
| 337 | struct device *dev = &of_dev->dev; | 337 | struct device *dev = &of_dev->dev; |
| 338 | struct xps2data *drvdata = dev_get_drvdata(dev); | 338 | struct xps2data *drvdata = dev_get_drvdata(dev); |
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index cc22eeefa10b..ea57e05d08f3 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c | |||
| @@ -224,7 +224,7 @@ struct gpio_led_of_platform_data { | |||
| 224 | struct gpio_led_data led_data[]; | 224 | struct gpio_led_data led_data[]; |
| 225 | }; | 225 | }; |
| 226 | 226 | ||
| 227 | static int __devinit of_gpio_leds_probe(struct of_device *ofdev, | 227 | static int __devinit of_gpio_leds_probe(struct platform_device *ofdev, |
| 228 | const struct of_device_id *match) | 228 | const struct of_device_id *match) |
| 229 | { | 229 | { |
| 230 | struct device_node *np = ofdev->dev.of_node, *child; | 230 | struct device_node *np = ofdev->dev.of_node, *child; |
| @@ -283,7 +283,7 @@ err: | |||
| 283 | return ret; | 283 | return ret; |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | static int __devexit of_gpio_leds_remove(struct of_device *ofdev) | 286 | static int __devexit of_gpio_leds_remove(struct platform_device *ofdev) |
| 287 | { | 287 | { |
| 288 | struct gpio_led_of_platform_data *pdata = dev_get_drvdata(&ofdev->dev); | 288 | struct gpio_led_of_platform_data *pdata = dev_get_drvdata(&ofdev->dev); |
| 289 | int i; | 289 | int i; |
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c index 6024038a5b9d..8eb40afbd0f5 100644 --- a/drivers/macintosh/macio_sysfs.c +++ b/drivers/macintosh/macio_sysfs.c | |||
| @@ -15,7 +15,7 @@ field##_show (struct device *dev, struct device_attribute *attr, \ | |||
| 15 | static ssize_t | 15 | static ssize_t |
| 16 | compatible_show (struct device *dev, struct device_attribute *attr, char *buf) | 16 | compatible_show (struct device *dev, struct device_attribute *attr, char *buf) |
| 17 | { | 17 | { |
| 18 | struct of_device *of; | 18 | struct platform_device *of; |
| 19 | const char *compat; | 19 | const char *compat; |
| 20 | int cplen; | 20 | int cplen; |
| 21 | int length = 0; | 21 | int length = 0; |
| @@ -52,9 +52,9 @@ static ssize_t modalias_show (struct device *dev, struct device_attribute *attr, | |||
| 52 | static ssize_t devspec_show(struct device *dev, | 52 | static ssize_t devspec_show(struct device *dev, |
| 53 | struct device_attribute *attr, char *buf) | 53 | struct device_attribute *attr, char *buf) |
| 54 | { | 54 | { |
| 55 | struct of_device *ofdev; | 55 | struct platform_device *ofdev; |
| 56 | 56 | ||
| 57 | ofdev = to_of_device(dev); | 57 | ofdev = to_platform_device(dev); |
| 58 | return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name); | 58 | return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name); |
| 59 | } | 59 | } |
| 60 | 60 | ||
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index 2506c957712e..e58c3d33e035 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
| @@ -75,7 +75,7 @@ struct smu_cmd_buf { | |||
| 75 | struct smu_device { | 75 | struct smu_device { |
| 76 | spinlock_t lock; | 76 | spinlock_t lock; |
| 77 | struct device_node *of_node; | 77 | struct device_node *of_node; |
| 78 | struct of_device *of_dev; | 78 | struct platform_device *of_dev; |
| 79 | int doorbell; /* doorbell gpio */ | 79 | int doorbell; /* doorbell gpio */ |
| 80 | u32 __iomem *db_buf; /* doorbell buffer */ | 80 | u32 __iomem *db_buf; /* doorbell buffer */ |
| 81 | struct device_node *db_node; | 81 | struct device_node *db_node; |
| @@ -645,7 +645,7 @@ static void smu_expose_childs(struct work_struct *unused) | |||
| 645 | 645 | ||
| 646 | static DECLARE_WORK(smu_expose_childs_work, smu_expose_childs); | 646 | static DECLARE_WORK(smu_expose_childs_work, smu_expose_childs); |
| 647 | 647 | ||
| 648 | static int smu_platform_probe(struct of_device* dev, | 648 | static int smu_platform_probe(struct platform_device* dev, |
| 649 | const struct of_device_id *match) | 649 | const struct of_device_id *match) |
| 650 | { | 650 | { |
| 651 | if (!smu) | 651 | if (!smu) |
| @@ -695,7 +695,7 @@ static int __init smu_init_sysfs(void) | |||
| 695 | 695 | ||
| 696 | device_initcall(smu_init_sysfs); | 696 | device_initcall(smu_init_sysfs); |
| 697 | 697 | ||
| 698 | struct of_device *smu_get_ofdev(void) | 698 | struct platform_device *smu_get_ofdev(void) |
| 699 | { | 699 | { |
| 700 | if (!smu) | 700 | if (!smu) |
| 701 | return NULL; | 701 | return NULL; |
diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index c42eeb43042d..d0d221332db0 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c | |||
| @@ -84,7 +84,7 @@ struct thermostat { | |||
| 84 | 84 | ||
| 85 | static enum {ADT7460, ADT7467} therm_type; | 85 | static enum {ADT7460, ADT7467} therm_type; |
| 86 | static int therm_bus, therm_address; | 86 | static int therm_bus, therm_address; |
| 87 | static struct of_device * of_dev; | 87 | static struct platform_device * of_dev; |
| 88 | static struct thermostat* thermostat; | 88 | static struct thermostat* thermostat; |
| 89 | static struct task_struct *thread_therm = NULL; | 89 | static struct task_struct *thread_therm = NULL; |
| 90 | 90 | ||
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index e60605bd0ea9..44549272333c 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c | |||
| @@ -148,7 +148,7 @@ | |||
| 148 | * Driver statics | 148 | * Driver statics |
| 149 | */ | 149 | */ |
| 150 | 150 | ||
| 151 | static struct of_device * of_dev; | 151 | static struct platform_device * of_dev; |
| 152 | static struct i2c_adapter * u3_0; | 152 | static struct i2c_adapter * u3_0; |
| 153 | static struct i2c_adapter * u3_1; | 153 | static struct i2c_adapter * u3_1; |
| 154 | static struct i2c_adapter * k2; | 154 | static struct i2c_adapter * k2; |
| @@ -2210,7 +2210,7 @@ static void fcu_lookup_fans(struct device_node *fcu_node) | |||
| 2210 | } | 2210 | } |
| 2211 | } | 2211 | } |
| 2212 | 2212 | ||
| 2213 | static int fcu_of_probe(struct of_device* dev, const struct of_device_id *match) | 2213 | static int fcu_of_probe(struct platform_device* dev, const struct of_device_id *match) |
| 2214 | { | 2214 | { |
| 2215 | state = state_detached; | 2215 | state = state_detached; |
| 2216 | 2216 | ||
| @@ -2221,7 +2221,7 @@ static int fcu_of_probe(struct of_device* dev, const struct of_device_id *match) | |||
| 2221 | return i2c_add_driver(&therm_pm72_driver); | 2221 | return i2c_add_driver(&therm_pm72_driver); |
| 2222 | } | 2222 | } |
| 2223 | 2223 | ||
| 2224 | static int fcu_of_remove(struct of_device* dev) | 2224 | static int fcu_of_remove(struct platform_device* dev) |
| 2225 | { | 2225 | { |
| 2226 | i2c_del_driver(&therm_pm72_driver); | 2226 | i2c_del_driver(&therm_pm72_driver); |
| 2227 | 2227 | ||
diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index 5c9367acf0cf..133f195de1fd 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c | |||
| @@ -52,7 +52,7 @@ static struct { | |||
| 52 | struct task_struct *poll_task; | 52 | struct task_struct *poll_task; |
| 53 | 53 | ||
| 54 | struct mutex lock; | 54 | struct mutex lock; |
| 55 | struct of_device *of_dev; | 55 | struct platform_device *of_dev; |
| 56 | 56 | ||
| 57 | struct i2c_client *thermostat; | 57 | struct i2c_client *thermostat; |
| 58 | struct i2c_client *fan; | 58 | struct i2c_client *fan; |
| @@ -444,13 +444,13 @@ static struct i2c_driver g4fan_driver = { | |||
| 444 | /************************************************************************/ | 444 | /************************************************************************/ |
| 445 | 445 | ||
| 446 | static int | 446 | static int |
| 447 | therm_of_probe( struct of_device *dev, const struct of_device_id *match ) | 447 | therm_of_probe( struct platform_device *dev, const struct of_device_id *match ) |
| 448 | { | 448 | { |
| 449 | return i2c_add_driver( &g4fan_driver ); | 449 | return i2c_add_driver( &g4fan_driver ); |
| 450 | } | 450 | } |
| 451 | 451 | ||
| 452 | static int | 452 | static int |
| 453 | therm_of_remove( struct of_device *dev ) | 453 | therm_of_remove( struct platform_device *dev ) |
| 454 | { | 454 | { |
| 455 | i2c_del_driver( &g4fan_driver ); | 455 | i2c_del_driver( &g4fan_driver ); |
| 456 | return 0; | 456 | return 0; |
diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c index 8f1c94f7e00c..43d208f1f586 100644 --- a/drivers/media/video/fsl-viu.c +++ b/drivers/media/video/fsl-viu.c | |||
| @@ -1418,7 +1418,7 @@ static struct video_device viu_template = { | |||
| 1418 | .current_norm = V4L2_STD_NTSC_M, | 1418 | .current_norm = V4L2_STD_NTSC_M, |
| 1419 | }; | 1419 | }; |
| 1420 | 1420 | ||
| 1421 | static int __devinit viu_of_probe(struct of_device *op, | 1421 | static int __devinit viu_of_probe(struct platform_device *op, |
| 1422 | const struct of_device_id *match) | 1422 | const struct of_device_id *match) |
| 1423 | { | 1423 | { |
| 1424 | struct viu_dev *viu_dev; | 1424 | struct viu_dev *viu_dev; |
| @@ -1549,7 +1549,7 @@ err: | |||
| 1549 | return ret; | 1549 | return ret; |
| 1550 | } | 1550 | } |
| 1551 | 1551 | ||
| 1552 | static int __devexit viu_of_remove(struct of_device *op) | 1552 | static int __devexit viu_of_remove(struct platform_device *op) |
| 1553 | { | 1553 | { |
| 1554 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); | 1554 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); |
| 1555 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); | 1555 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); |
| @@ -1570,7 +1570,7 @@ static int __devexit viu_of_remove(struct of_device *op) | |||
| 1570 | } | 1570 | } |
| 1571 | 1571 | ||
| 1572 | #ifdef CONFIG_PM | 1572 | #ifdef CONFIG_PM |
| 1573 | static int viu_suspend(struct of_device *op, pm_message_t state) | 1573 | static int viu_suspend(struct platform_device *op, pm_message_t state) |
| 1574 | { | 1574 | { |
| 1575 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); | 1575 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); |
| 1576 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); | 1576 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); |
| @@ -1579,7 +1579,7 @@ static int viu_suspend(struct of_device *op, pm_message_t state) | |||
| 1579 | return 0; | 1579 | return 0; |
| 1580 | } | 1580 | } |
| 1581 | 1581 | ||
| 1582 | static int viu_resume(struct of_device *op) | 1582 | static int viu_resume(struct platform_device *op) |
| 1583 | { | 1583 | { |
| 1584 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); | 1584 | struct v4l2_device *v4l2_dev = dev_get_drvdata(&op->dev); |
| 1585 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); | 1585 | struct viu_dev *dev = container_of(v4l2_dev, struct viu_dev, v4l2_dev); |
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index eef78a068fd1..d3f1a087eced 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c | |||
| @@ -1048,6 +1048,7 @@ static int mspro_block_read_attributes(struct memstick_dev *card) | |||
| 1048 | snprintf(s_attr->name, sizeof(s_attr->name), | 1048 | snprintf(s_attr->name, sizeof(s_attr->name), |
| 1049 | "attr_x%02x", attr->entries[cnt].id); | 1049 | "attr_x%02x", attr->entries[cnt].id); |
| 1050 | 1050 | ||
| 1051 | sysfs_attr_init(&s_attr->dev_attr.attr); | ||
| 1051 | s_attr->dev_attr.attr.name = s_attr->name; | 1052 | s_attr->dev_attr.attr.name = s_attr->name; |
| 1052 | s_attr->dev_attr.attr.mode = S_IRUGO; | 1053 | s_attr->dev_attr.attr.mode = S_IRUGO; |
| 1053 | s_attr->dev_attr.show = mspro_block_attr_show(s_attr->id); | 1054 | s_attr->dev_attr.show = mspro_block_attr_show(s_attr->id); |
| @@ -1338,13 +1339,14 @@ static void mspro_block_remove(struct memstick_dev *card) | |||
| 1338 | struct mspro_block_data *msb = memstick_get_drvdata(card); | 1339 | struct mspro_block_data *msb = memstick_get_drvdata(card); |
| 1339 | unsigned long flags; | 1340 | unsigned long flags; |
| 1340 | 1341 | ||
| 1341 | del_gendisk(msb->disk); | ||
| 1342 | dev_dbg(&card->dev, "mspro block remove\n"); | ||
| 1343 | spin_lock_irqsave(&msb->q_lock, flags); | 1342 | spin_lock_irqsave(&msb->q_lock, flags); |
| 1344 | msb->eject = 1; | 1343 | msb->eject = 1; |
| 1345 | blk_start_queue(msb->queue); | 1344 | blk_start_queue(msb->queue); |
| 1346 | spin_unlock_irqrestore(&msb->q_lock, flags); | 1345 | spin_unlock_irqrestore(&msb->q_lock, flags); |
| 1347 | 1346 | ||
| 1347 | del_gendisk(msb->disk); | ||
| 1348 | dev_dbg(&card->dev, "mspro block remove\n"); | ||
| 1349 | |||
| 1348 | blk_cleanup_queue(msb->queue); | 1350 | blk_cleanup_queue(msb->queue); |
| 1349 | msb->queue = NULL; | 1351 | msb->queue = NULL; |
| 1350 | 1352 | ||
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 8433cde29c8b..d545f79f6000 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
| @@ -247,7 +247,76 @@ static u32 get_card_status(struct mmc_card *card, struct request *req) | |||
| 247 | return cmd.resp[0]; | 247 | return cmd.resp[0]; |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | 250 | static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req) |
| 251 | { | ||
| 252 | struct mmc_blk_data *md = mq->data; | ||
| 253 | struct mmc_card *card = md->queue.card; | ||
| 254 | unsigned int from, nr, arg; | ||
| 255 | int err = 0; | ||
| 256 | |||
| 257 | mmc_claim_host(card->host); | ||
| 258 | |||
| 259 | if (!mmc_can_erase(card)) { | ||
| 260 | err = -EOPNOTSUPP; | ||
| 261 | goto out; | ||
| 262 | } | ||
| 263 | |||
| 264 | from = blk_rq_pos(req); | ||
| 265 | nr = blk_rq_sectors(req); | ||
| 266 | |||
| 267 | if (mmc_can_trim(card)) | ||
| 268 | arg = MMC_TRIM_ARG; | ||
| 269 | else | ||
| 270 | arg = MMC_ERASE_ARG; | ||
| 271 | |||
| 272 | err = mmc_erase(card, from, nr, arg); | ||
| 273 | out: | ||
| 274 | spin_lock_irq(&md->lock); | ||
| 275 | __blk_end_request(req, err, blk_rq_bytes(req)); | ||
| 276 | spin_unlock_irq(&md->lock); | ||
| 277 | |||
| 278 | mmc_release_host(card->host); | ||
| 279 | |||
| 280 | return err ? 0 : 1; | ||
| 281 | } | ||
| 282 | |||
| 283 | static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, | ||
| 284 | struct request *req) | ||
| 285 | { | ||
| 286 | struct mmc_blk_data *md = mq->data; | ||
| 287 | struct mmc_card *card = md->queue.card; | ||
| 288 | unsigned int from, nr, arg; | ||
| 289 | int err = 0; | ||
| 290 | |||
| 291 | mmc_claim_host(card->host); | ||
| 292 | |||
| 293 | if (!mmc_can_secure_erase_trim(card)) { | ||
| 294 | err = -EOPNOTSUPP; | ||
| 295 | goto out; | ||
| 296 | } | ||
| 297 | |||
| 298 | from = blk_rq_pos(req); | ||
| 299 | nr = blk_rq_sectors(req); | ||
| 300 | |||
| 301 | if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr)) | ||
| 302 | arg = MMC_SECURE_TRIM1_ARG; | ||
| 303 | else | ||
| 304 | arg = MMC_SECURE_ERASE_ARG; | ||
| 305 | |||
| 306 | err = mmc_erase(card, from, nr, arg); | ||
| 307 | if (!err && arg == MMC_SECURE_TRIM1_ARG) | ||
| 308 | err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); | ||
| 309 | out: | ||
| 310 | spin_lock_irq(&md->lock); | ||
| 311 | __blk_end_request(req, err, blk_rq_bytes(req)); | ||
| 312 | spin_unlock_irq(&md->lock); | ||
| 313 | |||
| 314 | mmc_release_host(card->host); | ||
| 315 | |||
| 316 | return err ? 0 : 1; | ||
| 317 | } | ||
| 318 | |||
| 319 | static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req) | ||
| 251 | { | 320 | { |
| 252 | struct mmc_blk_data *md = mq->data; | 321 | struct mmc_blk_data *md = mq->data; |
| 253 | struct mmc_card *card = md->queue.card; | 322 | struct mmc_card *card = md->queue.card; |
| @@ -475,6 +544,17 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
| 475 | return 0; | 544 | return 0; |
| 476 | } | 545 | } |
| 477 | 546 | ||
| 547 | static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | ||
| 548 | { | ||
| 549 | if (req->cmd_flags & REQ_DISCARD) { | ||
| 550 | if (req->cmd_flags & REQ_SECURE) | ||
| 551 | return mmc_blk_issue_secdiscard_rq(mq, req); | ||
| 552 | else | ||
| 553 | return mmc_blk_issue_discard_rq(mq, req); | ||
| 554 | } else { | ||
| 555 | return mmc_blk_issue_rw_rq(mq, req); | ||
| 556 | } | ||
| 557 | } | ||
| 478 | 558 | ||
| 479 | static inline int mmc_blk_readonly(struct mmc_card *card) | 559 | static inline int mmc_blk_readonly(struct mmc_card *card) |
| 480 | { | 560 | { |
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index 445d7db2277e..5dd8576b5c18 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
| 17 | 17 | ||
| 18 | #include <linux/scatterlist.h> | 18 | #include <linux/scatterlist.h> |
| 19 | #include <linux/swap.h> /* For nr_free_buffer_pages() */ | ||
| 19 | 20 | ||
| 20 | #define RESULT_OK 0 | 21 | #define RESULT_OK 0 |
| 21 | #define RESULT_FAIL 1 | 22 | #define RESULT_FAIL 1 |
| @@ -25,6 +26,60 @@ | |||
| 25 | #define BUFFER_ORDER 2 | 26 | #define BUFFER_ORDER 2 |
| 26 | #define BUFFER_SIZE (PAGE_SIZE << BUFFER_ORDER) | 27 | #define BUFFER_SIZE (PAGE_SIZE << BUFFER_ORDER) |
| 27 | 28 | ||
| 29 | /* | ||
| 30 | * Limit the test area size to the maximum MMC HC erase group size. Note that | ||
| 31 | * the maximum SD allocation unit size is just 4MiB. | ||
| 32 | */ | ||
| 33 | #define TEST_AREA_MAX_SIZE (128 * 1024 * 1024) | ||
| 34 | |||
| 35 | /** | ||
| 36 | * struct mmc_test_pages - pages allocated by 'alloc_pages()'. | ||
| 37 | * @page: first page in the allocation | ||
| 38 | * @order: order of the number of pages allocated | ||
| 39 | */ | ||
| 40 | struct mmc_test_pages { | ||
| 41 | struct page *page; | ||
| 42 | unsigned int order; | ||
| 43 | }; | ||
| 44 | |||
| 45 | /** | ||
| 46 | * struct mmc_test_mem - allocated memory. | ||
| 47 | * @arr: array of allocations | ||
| 48 | * @cnt: number of allocations | ||
| 49 | */ | ||
| 50 | struct mmc_test_mem { | ||
| 51 | struct mmc_test_pages *arr; | ||
| 52 | unsigned int cnt; | ||
| 53 | }; | ||
| 54 | |||
| 55 | /** | ||
| 56 | * struct mmc_test_area - information for performance tests. | ||
| 57 | * @max_sz: test area size (in bytes) | ||
| 58 | * @dev_addr: address on card at which to do performance tests | ||
| 59 | * @max_segs: maximum segments in scatterlist @sg | ||
| 60 | * @blocks: number of (512 byte) blocks currently mapped by @sg | ||
| 61 | * @sg_len: length of currently mapped scatterlist @sg | ||
| 62 | * @mem: allocated memory | ||
| 63 | * @sg: scatterlist | ||
| 64 | */ | ||
| 65 | struct mmc_test_area { | ||
| 66 | unsigned long max_sz; | ||
| 67 | unsigned int dev_addr; | ||
| 68 | unsigned int max_segs; | ||
| 69 | unsigned int blocks; | ||
| 70 | unsigned int sg_len; | ||
| 71 | struct mmc_test_mem *mem; | ||
| 72 | struct scatterlist *sg; | ||
| 73 | }; | ||
| 74 | |||
| 75 | /** | ||
| 76 | * struct mmc_test_card - test information. | ||
| 77 | * @card: card under test | ||
| 78 | * @scratch: transfer buffer | ||
| 79 | * @buffer: transfer buffer | ||
| 80 | * @highmem: buffer for highmem tests | ||
| 81 | * @area: information for performance tests | ||
| 82 | */ | ||
| 28 | struct mmc_test_card { | 83 | struct mmc_test_card { |
| 29 | struct mmc_card *card; | 84 | struct mmc_card *card; |
| 30 | 85 | ||
| @@ -33,6 +88,7 @@ struct mmc_test_card { | |||
| 33 | #ifdef CONFIG_HIGHMEM | 88 | #ifdef CONFIG_HIGHMEM |
| 34 | struct page *highmem; | 89 | struct page *highmem; |
| 35 | #endif | 90 | #endif |
| 91 | struct mmc_test_area area; | ||
| 36 | }; | 92 | }; |
| 37 | 93 | ||
| 38 | /*******************************************************************/ | 94 | /*******************************************************************/ |
| @@ -97,6 +153,12 @@ static void mmc_test_prepare_mrq(struct mmc_test_card *test, | |||
| 97 | mmc_set_data_timeout(mrq->data, test->card); | 153 | mmc_set_data_timeout(mrq->data, test->card); |
| 98 | } | 154 | } |
| 99 | 155 | ||
| 156 | static int mmc_test_busy(struct mmc_command *cmd) | ||
| 157 | { | ||
| 158 | return !(cmd->resp[0] & R1_READY_FOR_DATA) || | ||
| 159 | (R1_CURRENT_STATE(cmd->resp[0]) == 7); | ||
| 160 | } | ||
| 161 | |||
| 100 | /* | 162 | /* |
| 101 | * Wait for the card to finish the busy state | 163 | * Wait for the card to finish the busy state |
| 102 | */ | 164 | */ |
| @@ -117,13 +179,13 @@ static int mmc_test_wait_busy(struct mmc_test_card *test) | |||
| 117 | if (ret) | 179 | if (ret) |
| 118 | break; | 180 | break; |
| 119 | 181 | ||
| 120 | if (!busy && !(cmd.resp[0] & R1_READY_FOR_DATA)) { | 182 | if (!busy && mmc_test_busy(&cmd)) { |
| 121 | busy = 1; | 183 | busy = 1; |
| 122 | printk(KERN_INFO "%s: Warning: Host did not " | 184 | printk(KERN_INFO "%s: Warning: Host did not " |
| 123 | "wait for busy state to end.\n", | 185 | "wait for busy state to end.\n", |
| 124 | mmc_hostname(test->card->host)); | 186 | mmc_hostname(test->card->host)); |
| 125 | } | 187 | } |
| 126 | } while (!(cmd.resp[0] & R1_READY_FOR_DATA)); | 188 | } while (mmc_test_busy(&cmd)); |
| 127 | 189 | ||
| 128 | return ret; | 190 | return ret; |
| 129 | } | 191 | } |
| @@ -170,6 +232,248 @@ static int mmc_test_buffer_transfer(struct mmc_test_card *test, | |||
| 170 | return 0; | 232 | return 0; |
| 171 | } | 233 | } |
| 172 | 234 | ||
| 235 | static void mmc_test_free_mem(struct mmc_test_mem *mem) | ||
| 236 | { | ||
| 237 | if (!mem) | ||
| 238 | return; | ||
| 239 | while (mem->cnt--) | ||
| 240 | __free_pages(mem->arr[mem->cnt].page, | ||
| 241 | mem->arr[mem->cnt].order); | ||
| 242 | kfree(mem->arr); | ||
| 243 | kfree(mem); | ||
| 244 | } | ||
| 245 | |||
| 246 | /* | ||
| 247 | * Allocate a lot of memory, preferrably max_sz but at least min_sz. In case | ||
| 248 | * there isn't much memory do not exceed 1/16th total lowmem pages. | ||
| 249 | */ | ||
| 250 | static struct mmc_test_mem *mmc_test_alloc_mem(unsigned long min_sz, | ||
| 251 | unsigned long max_sz) | ||
| 252 | { | ||
| 253 | unsigned long max_page_cnt = DIV_ROUND_UP(max_sz, PAGE_SIZE); | ||
| 254 | unsigned long min_page_cnt = DIV_ROUND_UP(min_sz, PAGE_SIZE); | ||
| 255 | unsigned long page_cnt = 0; | ||
| 256 | unsigned long limit = nr_free_buffer_pages() >> 4; | ||
| 257 | struct mmc_test_mem *mem; | ||
| 258 | |||
| 259 | if (max_page_cnt > limit) | ||
| 260 | max_page_cnt = limit; | ||
| 261 | if (max_page_cnt < min_page_cnt) | ||
| 262 | max_page_cnt = min_page_cnt; | ||
| 263 | |||
| 264 | mem = kzalloc(sizeof(struct mmc_test_mem), GFP_KERNEL); | ||
| 265 | if (!mem) | ||
| 266 | return NULL; | ||
| 267 | |||
| 268 | mem->arr = kzalloc(sizeof(struct mmc_test_pages) * max_page_cnt, | ||
| 269 | GFP_KERNEL); | ||
| 270 | if (!mem->arr) | ||
| 271 | goto out_free; | ||
| 272 | |||
| 273 | while (max_page_cnt) { | ||
| 274 | struct page *page; | ||
| 275 | unsigned int order; | ||
| 276 | gfp_t flags = GFP_KERNEL | GFP_DMA | __GFP_NOWARN | | ||
| 277 | __GFP_NORETRY; | ||
| 278 | |||
| 279 | order = get_order(max_page_cnt << PAGE_SHIFT); | ||
| 280 | while (1) { | ||
| 281 | page = alloc_pages(flags, order); | ||
| 282 | if (page || !order) | ||
| 283 | break; | ||
| 284 | order -= 1; | ||
| 285 | } | ||
| 286 | if (!page) { | ||
| 287 | if (page_cnt < min_page_cnt) | ||
| 288 | goto out_free; | ||
| 289 | break; | ||
| 290 | } | ||
| 291 | mem->arr[mem->cnt].page = page; | ||
| 292 | mem->arr[mem->cnt].order = order; | ||
| 293 | mem->cnt += 1; | ||
| 294 | if (max_page_cnt <= (1UL << order)) | ||
| 295 | break; | ||
| 296 | max_page_cnt -= 1UL << order; | ||
| 297 | page_cnt += 1UL << order; | ||
| 298 | } | ||
| 299 | |||
| 300 | return mem; | ||
| 301 | |||
| 302 | out_free: | ||
| 303 | mmc_test_free_mem(mem); | ||
| 304 | return NULL; | ||
| 305 | } | ||
| 306 | |||
| 307 | /* | ||
| 308 | * Map memory into a scatterlist. Optionally allow the same memory to be | ||
| 309 | * mapped more than once. | ||
| 310 | */ | ||
| 311 | static int mmc_test_map_sg(struct mmc_test_mem *mem, unsigned long sz, | ||
| 312 | struct scatterlist *sglist, int repeat, | ||
| 313 | unsigned int max_segs, unsigned int *sg_len) | ||
| 314 | { | ||
| 315 | struct scatterlist *sg = NULL; | ||
| 316 | unsigned int i; | ||
| 317 | |||
| 318 | sg_init_table(sglist, max_segs); | ||
| 319 | |||
| 320 | *sg_len = 0; | ||
| 321 | do { | ||
| 322 | for (i = 0; i < mem->cnt; i++) { | ||
| 323 | unsigned long len = PAGE_SIZE << mem->arr[i].order; | ||
| 324 | |||
| 325 | if (sz < len) | ||
| 326 | len = sz; | ||
| 327 | if (sg) | ||
| 328 | sg = sg_next(sg); | ||
| 329 | else | ||
| 330 | sg = sglist; | ||
| 331 | if (!sg) | ||
| 332 | return -EINVAL; | ||
| 333 | sg_set_page(sg, mem->arr[i].page, len, 0); | ||
| 334 | sz -= len; | ||
| 335 | *sg_len += 1; | ||
| 336 | if (!sz) | ||
| 337 | break; | ||
| 338 | } | ||
| 339 | } while (sz && repeat); | ||
| 340 | |||
| 341 | if (sz) | ||
| 342 | return -EINVAL; | ||
| 343 | |||
| 344 | if (sg) | ||
| 345 | sg_mark_end(sg); | ||
| 346 | |||
| 347 | return 0; | ||
| 348 | } | ||
| 349 | |||
| 350 | /* | ||
| 351 | * Map memory into a scatterlist so that no pages are contiguous. Allow the | ||
| 352 | * same memory to be mapped more than once. | ||
| 353 | */ | ||
| 354 | static int mmc_test_map_sg_max_scatter(struct mmc_test_mem *mem, | ||
| 355 | unsigned long sz, | ||
| 356 | struct scatterlist *sglist, | ||
| 357 | unsigned int max_segs, | ||
| 358 | unsigned int *sg_len) | ||
| 359 | { | ||
| 360 | struct scatterlist *sg = NULL; | ||
| 361 | unsigned int i = mem->cnt, cnt; | ||
| 362 | unsigned long len; | ||
| 363 | void *base, *addr, *last_addr = NULL; | ||
| 364 | |||
| 365 | sg_init_table(sglist, max_segs); | ||
| 366 | |||
| 367 | *sg_len = 0; | ||
| 368 | while (sz && i) { | ||
| 369 | base = page_address(mem->arr[--i].page); | ||
| 370 | cnt = 1 << mem->arr[i].order; | ||
| 371 | while (sz && cnt) { | ||
| 372 | addr = base + PAGE_SIZE * --cnt; | ||
| 373 | if (last_addr && last_addr + PAGE_SIZE == addr) | ||
| 374 | continue; | ||
| 375 | last_addr = addr; | ||
| 376 | len = PAGE_SIZE; | ||
| 377 | if (sz < len) | ||
| 378 | len = sz; | ||
| 379 | if (sg) | ||
| 380 | sg = sg_next(sg); | ||
| 381 | else | ||
| 382 | sg = sglist; | ||
| 383 | if (!sg) | ||
| 384 | return -EINVAL; | ||
| 385 | sg_set_page(sg, virt_to_page(addr), len, 0); | ||
| 386 | sz -= len; | ||
| 387 | *sg_len += 1; | ||
| 388 | } | ||
| 389 | } | ||
| 390 | |||
| 391 | if (sg) | ||
| 392 | sg_mark_end(sg); | ||
| 393 | |||
| 394 | return 0; | ||
| 395 | } | ||
| 396 | |||
| 397 | /* | ||
| 398 | * Calculate transfer rate in bytes per second. | ||
| 399 | */ | ||
| 400 | static unsigned int mmc_test_rate(uint64_t bytes, struct timespec *ts) | ||
| 401 | { | ||
| 402 | uint64_t ns; | ||
| 403 | |||
| 404 | ns = ts->tv_sec; | ||
| 405 | ns *= 1000000000; | ||
| 406 | ns += ts->tv_nsec; | ||
| 407 | |||
| 408 | bytes *= 1000000000; | ||
| 409 | |||
| 410 | while (ns > UINT_MAX) { | ||
| 411 | bytes >>= 1; | ||
| 412 | ns >>= 1; | ||
| 413 | } | ||
| 414 | |||
| 415 | if (!ns) | ||
| 416 | return 0; | ||
| 417 | |||
| 418 | do_div(bytes, (uint32_t)ns); | ||
| 419 | |||
| 420 | return bytes; | ||
| 421 | } | ||
| 422 | |||
| 423 | /* | ||
| 424 | * Print the transfer rate. | ||
| 425 | */ | ||
| 426 | static void mmc_test_print_rate(struct mmc_test_card *test, uint64_t bytes, | ||
| 427 | struct timespec *ts1, struct timespec *ts2) | ||
| 428 | { | ||
| 429 | unsigned int rate, sectors = bytes >> 9; | ||
| 430 | struct timespec ts; | ||
| 431 | |||
| 432 | ts = timespec_sub(*ts2, *ts1); | ||
| 433 | |||
| 434 | rate = mmc_test_rate(bytes, &ts); | ||
| 435 | |||
| 436 | printk(KERN_INFO "%s: Transfer of %u sectors (%u%s KiB) took %lu.%09lu " | ||
| 437 | "seconds (%u kB/s, %u KiB/s)\n", | ||
| 438 | mmc_hostname(test->card->host), sectors, sectors >> 1, | ||
| 439 | (sectors == 1 ? ".5" : ""), (unsigned long)ts.tv_sec, | ||
| 440 | (unsigned long)ts.tv_nsec, rate / 1000, rate / 1024); | ||
| 441 | } | ||
| 442 | |||
| 443 | /* | ||
| 444 | * Print the average transfer rate. | ||
| 445 | */ | ||
| 446 | static void mmc_test_print_avg_rate(struct mmc_test_card *test, uint64_t bytes, | ||
| 447 | unsigned int count, struct timespec *ts1, | ||
| 448 | struct timespec *ts2) | ||
| 449 | { | ||
| 450 | unsigned int rate, sectors = bytes >> 9; | ||
| 451 | uint64_t tot = bytes * count; | ||
| 452 | struct timespec ts; | ||
| 453 | |||
| 454 | ts = timespec_sub(*ts2, *ts1); | ||
| 455 | |||
| 456 | rate = mmc_test_rate(tot, &ts); | ||
| 457 | |||
| 458 | printk(KERN_INFO "%s: Transfer of %u x %u sectors (%u x %u%s KiB) took " | ||
| 459 | "%lu.%09lu seconds (%u kB/s, %u KiB/s)\n", | ||
| 460 | mmc_hostname(test->card->host), count, sectors, count, | ||
| 461 | sectors >> 1, (sectors == 1 ? ".5" : ""), | ||
| 462 | (unsigned long)ts.tv_sec, (unsigned long)ts.tv_nsec, | ||
| 463 | rate / 1000, rate / 1024); | ||
| 464 | } | ||
| 465 | |||
| 466 | /* | ||
| 467 | * Return the card size in sectors. | ||
| 468 | */ | ||
| 469 | static unsigned int mmc_test_capacity(struct mmc_card *card) | ||
| 470 | { | ||
| 471 | if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) | ||
| 472 | return card->ext_csd.sectors; | ||
| 473 | else | ||
| 474 | return card->csd.capacity << (card->csd.read_blkbits - 9); | ||
| 475 | } | ||
| 476 | |||
| 173 | /*******************************************************************/ | 477 | /*******************************************************************/ |
| 174 | /* Test preparation and cleanup */ | 478 | /* Test preparation and cleanup */ |
| 175 | /*******************************************************************/ | 479 | /*******************************************************************/ |
| @@ -893,8 +1197,419 @@ static int mmc_test_multi_read_high(struct mmc_test_card *test) | |||
| 893 | return 0; | 1197 | return 0; |
| 894 | } | 1198 | } |
| 895 | 1199 | ||
| 1200 | #else | ||
| 1201 | |||
| 1202 | static int mmc_test_no_highmem(struct mmc_test_card *test) | ||
| 1203 | { | ||
| 1204 | printk(KERN_INFO "%s: Highmem not configured - test skipped\n", | ||
| 1205 | mmc_hostname(test->card->host)); | ||
| 1206 | return 0; | ||
| 1207 | } | ||
| 1208 | |||
| 896 | #endif /* CONFIG_HIGHMEM */ | 1209 | #endif /* CONFIG_HIGHMEM */ |
| 897 | 1210 | ||
| 1211 | /* | ||
| 1212 | * Map sz bytes so that it can be transferred. | ||
| 1213 | */ | ||
| 1214 | static int mmc_test_area_map(struct mmc_test_card *test, unsigned long sz, | ||
| 1215 | int max_scatter) | ||
| 1216 | { | ||
| 1217 | struct mmc_test_area *t = &test->area; | ||
| 1218 | |||
| 1219 | t->blocks = sz >> 9; | ||
| 1220 | |||
| 1221 | if (max_scatter) { | ||
| 1222 | return mmc_test_map_sg_max_scatter(t->mem, sz, t->sg, | ||
| 1223 | t->max_segs, &t->sg_len); | ||
| 1224 | } else { | ||
| 1225 | return mmc_test_map_sg(t->mem, sz, t->sg, 1, t->max_segs, | ||
| 1226 | &t->sg_len); | ||
| 1227 | } | ||
| 1228 | } | ||
| 1229 | |||
| 1230 | /* | ||
| 1231 | * Transfer bytes mapped by mmc_test_area_map(). | ||
| 1232 | */ | ||
| 1233 | static int mmc_test_area_transfer(struct mmc_test_card *test, | ||
| 1234 | unsigned int dev_addr, int write) | ||
| 1235 | { | ||
| 1236 | struct mmc_test_area *t = &test->area; | ||
| 1237 | |||
| 1238 | return mmc_test_simple_transfer(test, t->sg, t->sg_len, dev_addr, | ||
| 1239 | t->blocks, 512, write); | ||
| 1240 | } | ||
| 1241 | |||
| 1242 | /* | ||
| 1243 | * Map and transfer bytes. | ||
| 1244 | */ | ||
| 1245 | static int mmc_test_area_io(struct mmc_test_card *test, unsigned long sz, | ||
| 1246 | unsigned int dev_addr, int write, int max_scatter, | ||
| 1247 | int timed) | ||
| 1248 | { | ||
| 1249 | struct timespec ts1, ts2; | ||
| 1250 | int ret; | ||
| 1251 | |||
| 1252 | ret = mmc_test_area_map(test, sz, max_scatter); | ||
| 1253 | if (ret) | ||
| 1254 | return ret; | ||
| 1255 | |||
| 1256 | if (timed) | ||
| 1257 | getnstimeofday(&ts1); | ||
| 1258 | |||
| 1259 | ret = mmc_test_area_transfer(test, dev_addr, write); | ||
| 1260 | if (ret) | ||
| 1261 | return ret; | ||
| 1262 | |||
| 1263 | if (timed) | ||
| 1264 | getnstimeofday(&ts2); | ||
| 1265 | |||
| 1266 | if (timed) | ||
| 1267 | mmc_test_print_rate(test, sz, &ts1, &ts2); | ||
| 1268 | |||
| 1269 | return 0; | ||
| 1270 | } | ||
| 1271 | |||
| 1272 | /* | ||
| 1273 | * Write the test area entirely. | ||
| 1274 | */ | ||
| 1275 | static int mmc_test_area_fill(struct mmc_test_card *test) | ||
| 1276 | { | ||
| 1277 | return mmc_test_area_io(test, test->area.max_sz, test->area.dev_addr, | ||
| 1278 | 1, 0, 0); | ||
| 1279 | } | ||
| 1280 | |||
| 1281 | /* | ||
| 1282 | * Erase the test area entirely. | ||
| 1283 | */ | ||
| 1284 | static int mmc_test_area_erase(struct mmc_test_card *test) | ||
| 1285 | { | ||
| 1286 | struct mmc_test_area *t = &test->area; | ||
| 1287 | |||
| 1288 | if (!mmc_can_erase(test->card)) | ||
| 1289 | return 0; | ||
| 1290 | |||
| 1291 | return mmc_erase(test->card, t->dev_addr, test->area.max_sz >> 9, | ||
| 1292 | MMC_ERASE_ARG); | ||
| 1293 | } | ||
| 1294 | |||
| 1295 | /* | ||
| 1296 | * Cleanup struct mmc_test_area. | ||
| 1297 | */ | ||
| 1298 | static int mmc_test_area_cleanup(struct mmc_test_card *test) | ||
| 1299 | { | ||
| 1300 | struct mmc_test_area *t = &test->area; | ||
| 1301 | |||
| 1302 | kfree(t->sg); | ||
| 1303 | mmc_test_free_mem(t->mem); | ||
| 1304 | |||
| 1305 | return 0; | ||
| 1306 | } | ||
| 1307 | |||
| 1308 | /* | ||
| 1309 | * Initialize an area for testing large transfers. The size of the area is the | ||
| 1310 | * preferred erase size which is a good size for optimal transfer speed. Note | ||
| 1311 | * that is typically 4MiB for modern cards. The test area is set to the middle | ||
| 1312 | * of the card because cards may have different charateristics at the front | ||
| 1313 | * (for FAT file system optimization). Optionally, the area is erased (if the | ||
| 1314 | * card supports it) which may improve write performance. Optionally, the area | ||
| 1315 | * is filled with data for subsequent read tests. | ||
| 1316 | */ | ||
| 1317 | static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill) | ||
| 1318 | { | ||
| 1319 | struct mmc_test_area *t = &test->area; | ||
| 1320 | unsigned long min_sz = 64 * 1024; | ||
| 1321 | int ret; | ||
| 1322 | |||
| 1323 | ret = mmc_test_set_blksize(test, 512); | ||
| 1324 | if (ret) | ||
| 1325 | return ret; | ||
| 1326 | |||
| 1327 | if (test->card->pref_erase > TEST_AREA_MAX_SIZE >> 9) | ||
| 1328 | t->max_sz = TEST_AREA_MAX_SIZE; | ||
| 1329 | else | ||
| 1330 | t->max_sz = (unsigned long)test->card->pref_erase << 9; | ||
| 1331 | /* | ||
| 1332 | * Try to allocate enough memory for the whole area. Less is OK | ||
| 1333 | * because the same memory can be mapped into the scatterlist more than | ||
| 1334 | * once. | ||
| 1335 | */ | ||
| 1336 | t->mem = mmc_test_alloc_mem(min_sz, t->max_sz); | ||
| 1337 | if (!t->mem) | ||
| 1338 | return -ENOMEM; | ||
| 1339 | |||
| 1340 | t->max_segs = DIV_ROUND_UP(t->max_sz, PAGE_SIZE); | ||
| 1341 | t->sg = kmalloc(sizeof(struct scatterlist) * t->max_segs, GFP_KERNEL); | ||
| 1342 | if (!t->sg) { | ||
| 1343 | ret = -ENOMEM; | ||
| 1344 | goto out_free; | ||
| 1345 | } | ||
| 1346 | |||
| 1347 | t->dev_addr = mmc_test_capacity(test->card) / 2; | ||
| 1348 | t->dev_addr -= t->dev_addr % (t->max_sz >> 9); | ||
| 1349 | |||
| 1350 | if (erase) { | ||
| 1351 | ret = mmc_test_area_erase(test); | ||
| 1352 | if (ret) | ||
| 1353 | goto out_free; | ||
| 1354 | } | ||
| 1355 | |||
| 1356 | if (fill) { | ||
| 1357 | ret = mmc_test_area_fill(test); | ||
| 1358 | if (ret) | ||
| 1359 | goto out_free; | ||
| 1360 | } | ||
| 1361 | |||
| 1362 | return 0; | ||
| 1363 | |||
| 1364 | out_free: | ||
| 1365 | mmc_test_area_cleanup(test); | ||
| 1366 | return ret; | ||
| 1367 | } | ||
| 1368 | |||
| 1369 | /* | ||
| 1370 | * Prepare for large transfers. Do not erase the test area. | ||
| 1371 | */ | ||
| 1372 | static int mmc_test_area_prepare(struct mmc_test_card *test) | ||
| 1373 | { | ||
| 1374 | return mmc_test_area_init(test, 0, 0); | ||
| 1375 | } | ||
| 1376 | |||
| 1377 | /* | ||
| 1378 | * Prepare for large transfers. Do erase the test area. | ||
| 1379 | */ | ||
| 1380 | static int mmc_test_area_prepare_erase(struct mmc_test_card *test) | ||
| 1381 | { | ||
| 1382 | return mmc_test_area_init(test, 1, 0); | ||
| 1383 | } | ||
| 1384 | |||
| 1385 | /* | ||
| 1386 | * Prepare for large transfers. Erase and fill the test area. | ||
| 1387 | */ | ||
| 1388 | static int mmc_test_area_prepare_fill(struct mmc_test_card *test) | ||
| 1389 | { | ||
| 1390 | return mmc_test_area_init(test, 1, 1); | ||
| 1391 | } | ||
| 1392 | |||
| 1393 | /* | ||
| 1394 | * Test best-case performance. Best-case performance is expected from | ||
| 1395 | * a single large transfer. | ||
| 1396 | * | ||
| 1397 | * An additional option (max_scatter) allows the measurement of the same | ||
| 1398 | * transfer but with no contiguous pages in the scatter list. This tests | ||
| 1399 | * the efficiency of DMA to handle scattered pages. | ||
| 1400 | */ | ||
| 1401 | static int mmc_test_best_performance(struct mmc_test_card *test, int write, | ||
| 1402 | int max_scatter) | ||
| 1403 | { | ||
| 1404 | return mmc_test_area_io(test, test->area.max_sz, test->area.dev_addr, | ||
| 1405 | write, max_scatter, 1); | ||
| 1406 | } | ||
| 1407 | |||
| 1408 | /* | ||
| 1409 | * Best-case read performance. | ||
| 1410 | */ | ||
| 1411 | static int mmc_test_best_read_performance(struct mmc_test_card *test) | ||
| 1412 | { | ||
| 1413 | return mmc_test_best_performance(test, 0, 0); | ||
| 1414 | } | ||
| 1415 | |||
| 1416 | /* | ||
| 1417 | * Best-case write performance. | ||
| 1418 | */ | ||
| 1419 | static int mmc_test_best_write_performance(struct mmc_test_card *test) | ||
| 1420 | { | ||
| 1421 | return mmc_test_best_performance(test, 1, 0); | ||
| 1422 | } | ||
| 1423 | |||
| 1424 | /* | ||
| 1425 | * Best-case read performance into scattered pages. | ||
| 1426 | */ | ||
| 1427 | static int mmc_test_best_read_perf_max_scatter(struct mmc_test_card *test) | ||
| 1428 | { | ||
| 1429 | return mmc_test_best_performance(test, 0, 1); | ||
| 1430 | } | ||
| 1431 | |||
| 1432 | /* | ||
| 1433 | * Best-case write performance from scattered pages. | ||
| 1434 | */ | ||
| 1435 | static int mmc_test_best_write_perf_max_scatter(struct mmc_test_card *test) | ||
| 1436 | { | ||
| 1437 | return mmc_test_best_performance(test, 1, 1); | ||
| 1438 | } | ||
| 1439 | |||
| 1440 | /* | ||
| 1441 | * Single read performance by transfer size. | ||
| 1442 | */ | ||
| 1443 | static int mmc_test_profile_read_perf(struct mmc_test_card *test) | ||
| 1444 | { | ||
| 1445 | unsigned long sz; | ||
| 1446 | unsigned int dev_addr; | ||
| 1447 | int ret; | ||
| 1448 | |||
| 1449 | for (sz = 512; sz < test->area.max_sz; sz <<= 1) { | ||
| 1450 | dev_addr = test->area.dev_addr + (sz >> 9); | ||
| 1451 | ret = mmc_test_area_io(test, sz, dev_addr, 0, 0, 1); | ||
| 1452 | if (ret) | ||
| 1453 | return ret; | ||
| 1454 | } | ||
| 1455 | dev_addr = test->area.dev_addr; | ||
| 1456 | return mmc_test_area_io(test, sz, dev_addr, 0, 0, 1); | ||
| 1457 | } | ||
| 1458 | |||
| 1459 | /* | ||
| 1460 | * Single write performance by transfer size. | ||
| 1461 | */ | ||
| 1462 | static int mmc_test_profile_write_perf(struct mmc_test_card *test) | ||
| 1463 | { | ||
| 1464 | unsigned long sz; | ||
| 1465 | unsigned int dev_addr; | ||
| 1466 | int ret; | ||
| 1467 | |||
| 1468 | ret = mmc_test_area_erase(test); | ||
| 1469 | if (ret) | ||
| 1470 | return ret; | ||
| 1471 | for (sz = 512; sz < test->area.max_sz; sz <<= 1) { | ||
| 1472 | dev_addr = test->area.dev_addr + (sz >> 9); | ||
| 1473 | ret = mmc_test_area_io(test, sz, dev_addr, 1, 0, 1); | ||
| 1474 | if (ret) | ||
| 1475 | return ret; | ||
| 1476 | } | ||
| 1477 | ret = mmc_test_area_erase(test); | ||
| 1478 | if (ret) | ||
| 1479 | return ret; | ||
| 1480 | dev_addr = test->area.dev_addr; | ||
| 1481 | return mmc_test_area_io(test, sz, dev_addr, 1, 0, 1); | ||
| 1482 | } | ||
| 1483 | |||
| 1484 | /* | ||
| 1485 | * Single trim performance by transfer size. | ||
| 1486 | */ | ||
| 1487 | static int mmc_test_profile_trim_perf(struct mmc_test_card *test) | ||
| 1488 | { | ||
| 1489 | unsigned long sz; | ||
| 1490 | unsigned int dev_addr; | ||
| 1491 | struct timespec ts1, ts2; | ||
| 1492 | int ret; | ||
| 1493 | |||
| 1494 | if (!mmc_can_trim(test->card)) | ||
| 1495 | return RESULT_UNSUP_CARD; | ||
| 1496 | |||
| 1497 | if (!mmc_can_erase(test->card)) | ||
| 1498 | return RESULT_UNSUP_HOST; | ||
| 1499 | |||
| 1500 | for (sz = 512; sz < test->area.max_sz; sz <<= 1) { | ||
| 1501 | dev_addr = test->area.dev_addr + (sz >> 9); | ||
| 1502 | getnstimeofday(&ts1); | ||
| 1503 | ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG); | ||
| 1504 | if (ret) | ||
| 1505 | return ret; | ||
| 1506 | getnstimeofday(&ts2); | ||
| 1507 | mmc_test_print_rate(test, sz, &ts1, &ts2); | ||
| 1508 | } | ||
| 1509 | dev_addr = test->area.dev_addr; | ||
| 1510 | getnstimeofday(&ts1); | ||
| 1511 | ret = mmc_erase(test->card, dev_addr, sz >> 9, MMC_TRIM_ARG); | ||
| 1512 | if (ret) | ||
| 1513 | return ret; | ||
| 1514 | getnstimeofday(&ts2); | ||
| 1515 | mmc_test_print_rate(test, sz, &ts1, &ts2); | ||
| 1516 | return 0; | ||
| 1517 | } | ||
| 1518 | |||
| 1519 | /* | ||
| 1520 | * Consecutive read performance by transfer size. | ||
| 1521 | */ | ||
| 1522 | static int mmc_test_profile_seq_read_perf(struct mmc_test_card *test) | ||
| 1523 | { | ||
| 1524 | unsigned long sz; | ||
| 1525 | unsigned int dev_addr, i, cnt; | ||
| 1526 | struct timespec ts1, ts2; | ||
| 1527 | int ret; | ||
| 1528 | |||
| 1529 | for (sz = 512; sz <= test->area.max_sz; sz <<= 1) { | ||
| 1530 | cnt = test->area.max_sz / sz; | ||
| 1531 | dev_addr = test->area.dev_addr; | ||
| 1532 | getnstimeofday(&ts1); | ||
| 1533 | for (i = 0; i < cnt; i++) { | ||
| 1534 | ret = mmc_test_area_io(test, sz, dev_addr, 0, 0, 0); | ||
| 1535 | if (ret) | ||
| 1536 | return ret; | ||
| 1537 | dev_addr += (sz >> 9); | ||
| 1538 | } | ||
| 1539 | getnstimeofday(&ts2); | ||
| 1540 | mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); | ||
| 1541 | } | ||
| 1542 | return 0; | ||
| 1543 | } | ||
| 1544 | |||
| 1545 | /* | ||
| 1546 | * Consecutive write performance by transfer size. | ||
| 1547 | */ | ||
| 1548 | static int mmc_test_profile_seq_write_perf(struct mmc_test_card *test) | ||
| 1549 | { | ||
| 1550 | unsigned long sz; | ||
| 1551 | unsigned int dev_addr, i, cnt; | ||
| 1552 | struct timespec ts1, ts2; | ||
| 1553 | int ret; | ||
| 1554 | |||
| 1555 | for (sz = 512; sz <= test->area.max_sz; sz <<= 1) { | ||
| 1556 | ret = mmc_test_area_erase(test); | ||
| 1557 | if (ret) | ||
| 1558 | return ret; | ||
| 1559 | cnt = test->area.max_sz / sz; | ||
| 1560 | dev_addr = test->area.dev_addr; | ||
| 1561 | getnstimeofday(&ts1); | ||
| 1562 | for (i = 0; i < cnt; i++) { | ||
| 1563 | ret = mmc_test_area_io(test, sz, dev_addr, 1, 0, 0); | ||
| 1564 | if (ret) | ||
| 1565 | return ret; | ||
| 1566 | dev_addr += (sz >> 9); | ||
| 1567 | } | ||
| 1568 | getnstimeofday(&ts2); | ||
| 1569 | mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); | ||
| 1570 | } | ||
| 1571 | return 0; | ||
| 1572 | } | ||
| 1573 | |||
| 1574 | /* | ||
| 1575 | * Consecutive trim performance by transfer size. | ||
| 1576 | */ | ||
| 1577 | static int mmc_test_profile_seq_trim_perf(struct mmc_test_card *test) | ||
| 1578 | { | ||
| 1579 | unsigned long sz; | ||
| 1580 | unsigned int dev_addr, i, cnt; | ||
| 1581 | struct timespec ts1, ts2; | ||
| 1582 | int ret; | ||
| 1583 | |||
| 1584 | if (!mmc_can_trim(test->card)) | ||
| 1585 | return RESULT_UNSUP_CARD; | ||
| 1586 | |||
| 1587 | if (!mmc_can_erase(test->card)) | ||
| 1588 | return RESULT_UNSUP_HOST; | ||
| 1589 | |||
| 1590 | for (sz = 512; sz <= test->area.max_sz; sz <<= 1) { | ||
| 1591 | ret = mmc_test_area_erase(test); | ||
| 1592 | if (ret) | ||
| 1593 | return ret; | ||
| 1594 | ret = mmc_test_area_fill(test); | ||
| 1595 | if (ret) | ||
| 1596 | return ret; | ||
| 1597 | cnt = test->area.max_sz / sz; | ||
| 1598 | dev_addr = test->area.dev_addr; | ||
| 1599 | getnstimeofday(&ts1); | ||
| 1600 | for (i = 0; i < cnt; i++) { | ||
| 1601 | ret = mmc_erase(test->card, dev_addr, sz >> 9, | ||
| 1602 | MMC_TRIM_ARG); | ||
| 1603 | if (ret) | ||
| 1604 | return ret; | ||
| 1605 | dev_addr += (sz >> 9); | ||
| 1606 | } | ||
| 1607 | getnstimeofday(&ts2); | ||
| 1608 | mmc_test_print_avg_rate(test, sz, cnt, &ts1, &ts2); | ||
| 1609 | } | ||
| 1610 | return 0; | ||
| 1611 | } | ||
| 1612 | |||
| 898 | static const struct mmc_test_case mmc_test_cases[] = { | 1613 | static const struct mmc_test_case mmc_test_cases[] = { |
| 899 | { | 1614 | { |
| 900 | .name = "Basic write (no data verification)", | 1615 | .name = "Basic write (no data verification)", |
| @@ -1040,8 +1755,100 @@ static const struct mmc_test_case mmc_test_cases[] = { | |||
| 1040 | .cleanup = mmc_test_cleanup, | 1755 | .cleanup = mmc_test_cleanup, |
| 1041 | }, | 1756 | }, |
| 1042 | 1757 | ||
| 1758 | #else | ||
| 1759 | |||
| 1760 | { | ||
| 1761 | .name = "Highmem write", | ||
| 1762 | .run = mmc_test_no_highmem, | ||
| 1763 | }, | ||
| 1764 | |||
| 1765 | { | ||
| 1766 | .name = "Highmem read", | ||
| 1767 | .run = mmc_test_no_highmem, | ||
| 1768 | }, | ||
| 1769 | |||
| 1770 | { | ||
| 1771 | .name = "Multi-block highmem write", | ||
| 1772 | .run = mmc_test_no_highmem, | ||
| 1773 | }, | ||
| 1774 | |||
| 1775 | { | ||
| 1776 | .name = "Multi-block highmem read", | ||
| 1777 | .run = mmc_test_no_highmem, | ||
| 1778 | }, | ||
| 1779 | |||
| 1043 | #endif /* CONFIG_HIGHMEM */ | 1780 | #endif /* CONFIG_HIGHMEM */ |
| 1044 | 1781 | ||
| 1782 | { | ||
| 1783 | .name = "Best-case read performance", | ||
| 1784 | .prepare = mmc_test_area_prepare_fill, | ||
| 1785 | .run = mmc_test_best_read_performance, | ||
| 1786 | .cleanup = mmc_test_area_cleanup, | ||
| 1787 | }, | ||
| 1788 | |||
| 1789 | { | ||
| 1790 | .name = "Best-case write performance", | ||
| 1791 | .prepare = mmc_test_area_prepare_erase, | ||
| 1792 | .run = mmc_test_best_write_performance, | ||
| 1793 | .cleanup = mmc_test_area_cleanup, | ||
| 1794 | }, | ||
| 1795 | |||
| 1796 | { | ||
| 1797 | .name = "Best-case read performance into scattered pages", | ||
| 1798 | .prepare = mmc_test_area_prepare_fill, | ||
| 1799 | .run = mmc_test_best_read_perf_max_scatter, | ||
| 1800 | .cleanup = mmc_test_area_cleanup, | ||
| 1801 | }, | ||
| 1802 | |||
| 1803 | { | ||
| 1804 | .name = "Best-case write performance from scattered pages", | ||
| 1805 | .prepare = mmc_test_area_prepare_erase, | ||
| 1806 | .run = mmc_test_best_write_perf_max_scatter, | ||
| 1807 | .cleanup = mmc_test_area_cleanup, | ||
| 1808 | }, | ||
| 1809 | |||
| 1810 | { | ||
| 1811 | .name = "Single read performance by transfer size", | ||
| 1812 | .prepare = mmc_test_area_prepare_fill, | ||
| 1813 | .run = mmc_test_profile_read_perf, | ||
| 1814 | .cleanup = mmc_test_area_cleanup, | ||
| 1815 | }, | ||
| 1816 | |||
| 1817 | { | ||
| 1818 | .name = "Single write performance by transfer size", | ||
| 1819 | .prepare = mmc_test_area_prepare, | ||
| 1820 | .run = mmc_test_profile_write_perf, | ||
| 1821 | .cleanup = mmc_test_area_cleanup, | ||
| 1822 | }, | ||
| 1823 | |||
| 1824 | { | ||
| 1825 | .name = "Single trim performance by transfer size", | ||
| 1826 | .prepare = mmc_test_area_prepare_fill, | ||
| 1827 | .run = mmc_test_profile_trim_perf, | ||
| 1828 | .cleanup = mmc_test_area_cleanup, | ||
| 1829 | }, | ||
| 1830 | |||
| 1831 | { | ||
| 1832 | .name = "Consecutive read performance by transfer size", | ||
| 1833 | .prepare = mmc_test_area_prepare_fill, | ||
| 1834 | .run = mmc_test_profile_seq_read_perf, | ||
| 1835 | .cleanup = mmc_test_area_cleanup, | ||
| 1836 | }, | ||
| 1837 | |||
| 1838 | { | ||
| 1839 | .name = "Consecutive write performance by transfer size", | ||
| 1840 | .prepare = mmc_test_area_prepare, | ||
| 1841 | .run = mmc_test_profile_seq_write_perf, | ||
| 1842 | .cleanup = mmc_test_area_cleanup, | ||
| 1843 | }, | ||
| 1844 | |||
| 1845 | { | ||
| 1846 | .name = "Consecutive trim performance by transfer size", | ||
| 1847 | .prepare = mmc_test_area_prepare, | ||
| 1848 | .run = mmc_test_profile_seq_trim_perf, | ||
| 1849 | .cleanup = mmc_test_area_cleanup, | ||
| 1850 | }, | ||
| 1851 | |||
| 1045 | }; | 1852 | }; |
| 1046 | 1853 | ||
| 1047 | static DEFINE_MUTEX(mmc_test_lock); | 1854 | static DEFINE_MUTEX(mmc_test_lock); |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index c77eb49eda0e..e876678176be 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
| @@ -30,9 +30,9 @@ | |||
| 30 | static int mmc_prep_request(struct request_queue *q, struct request *req) | 30 | static int mmc_prep_request(struct request_queue *q, struct request *req) |
| 31 | { | 31 | { |
| 32 | /* | 32 | /* |
| 33 | * We only like normal block requests. | 33 | * We only like normal block requests and discards. |
| 34 | */ | 34 | */ |
| 35 | if (req->cmd_type != REQ_TYPE_FS) { | 35 | if (req->cmd_type != REQ_TYPE_FS && !(req->cmd_flags & REQ_DISCARD)) { |
| 36 | blk_dump_rq_flags(req, "MMC bad request"); | 36 | blk_dump_rq_flags(req, "MMC bad request"); |
| 37 | return BLKPREP_KILL; | 37 | return BLKPREP_KILL; |
| 38 | } | 38 | } |
| @@ -130,6 +130,21 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
| 130 | blk_queue_prep_rq(mq->queue, mmc_prep_request); | 130 | blk_queue_prep_rq(mq->queue, mmc_prep_request); |
| 131 | blk_queue_ordered(mq->queue, QUEUE_ORDERED_DRAIN); | 131 | blk_queue_ordered(mq->queue, QUEUE_ORDERED_DRAIN); |
| 132 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mq->queue); | 132 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, mq->queue); |
| 133 | if (mmc_can_erase(card)) { | ||
| 134 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mq->queue); | ||
| 135 | mq->queue->limits.max_discard_sectors = UINT_MAX; | ||
| 136 | if (card->erased_byte == 0) | ||
| 137 | mq->queue->limits.discard_zeroes_data = 1; | ||
| 138 | if (!mmc_can_trim(card) && is_power_of_2(card->erase_size)) { | ||
| 139 | mq->queue->limits.discard_granularity = | ||
| 140 | card->erase_size << 9; | ||
| 141 | mq->queue->limits.discard_alignment = | ||
| 142 | card->erase_size << 9; | ||
| 143 | } | ||
| 144 | if (mmc_can_secure_erase_trim(card)) | ||
| 145 | queue_flag_set_unlocked(QUEUE_FLAG_SECDISCARD, | ||
| 146 | mq->queue); | ||
| 147 | } | ||
| 133 | 148 | ||
| 134 | #ifdef CONFIG_MMC_BLOCK_BOUNCE | 149 | #ifdef CONFIG_MMC_BLOCK_BOUNCE |
| 135 | if (host->max_hw_segs == 1) { | 150 | if (host->max_hw_segs == 1) { |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 83240faa1dc8..5db49b124ffa 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
| @@ -1050,6 +1050,352 @@ void mmc_detect_change(struct mmc_host *host, unsigned long delay) | |||
| 1050 | 1050 | ||
| 1051 | EXPORT_SYMBOL(mmc_detect_change); | 1051 | EXPORT_SYMBOL(mmc_detect_change); |
| 1052 | 1052 | ||
| 1053 | void mmc_init_erase(struct mmc_card *card) | ||
| 1054 | { | ||
| 1055 | unsigned int sz; | ||
| 1056 | |||
| 1057 | if (is_power_of_2(card->erase_size)) | ||
| 1058 | card->erase_shift = ffs(card->erase_size) - 1; | ||
| 1059 | else | ||
| 1060 | card->erase_shift = 0; | ||
| 1061 | |||
| 1062 | /* | ||
| 1063 | * It is possible to erase an arbitrarily large area of an SD or MMC | ||
| 1064 | * card. That is not desirable because it can take a long time | ||
| 1065 | * (minutes) potentially delaying more important I/O, and also the | ||
| 1066 | * timeout calculations become increasingly hugely over-estimated. | ||
| 1067 | * Consequently, 'pref_erase' is defined as a guide to limit erases | ||
| 1068 | * to that size and alignment. | ||
| 1069 | * | ||
| 1070 | * For SD cards that define Allocation Unit size, limit erases to one | ||
| 1071 | * Allocation Unit at a time. For MMC cards that define High Capacity | ||
| 1072 | * Erase Size, whether it is switched on or not, limit to that size. | ||
| 1073 | * Otherwise just have a stab at a good value. For modern cards it | ||
| 1074 | * will end up being 4MiB. Note that if the value is too small, it | ||
| 1075 | * can end up taking longer to erase. | ||
| 1076 | */ | ||
| 1077 | if (mmc_card_sd(card) && card->ssr.au) { | ||
| 1078 | card->pref_erase = card->ssr.au; | ||
| 1079 | card->erase_shift = ffs(card->ssr.au) - 1; | ||
| 1080 | } else if (card->ext_csd.hc_erase_size) { | ||
| 1081 | card->pref_erase = card->ext_csd.hc_erase_size; | ||
| 1082 | } else { | ||
| 1083 | sz = (card->csd.capacity << (card->csd.read_blkbits - 9)) >> 11; | ||
| 1084 | if (sz < 128) | ||
| 1085 | card->pref_erase = 512 * 1024 / 512; | ||
| 1086 | else if (sz < 512) | ||
| 1087 | card->pref_erase = 1024 * 1024 / 512; | ||
| 1088 | else if (sz < 1024) | ||
| 1089 | card->pref_erase = 2 * 1024 * 1024 / 512; | ||
| 1090 | else | ||
| 1091 | card->pref_erase = 4 * 1024 * 1024 / 512; | ||
| 1092 | if (card->pref_erase < card->erase_size) | ||
| 1093 | card->pref_erase = card->erase_size; | ||
| 1094 | else { | ||
| 1095 | sz = card->pref_erase % card->erase_size; | ||
| 1096 | if (sz) | ||
| 1097 | card->pref_erase += card->erase_size - sz; | ||
| 1098 | } | ||
| 1099 | } | ||
| 1100 | } | ||
| 1101 | |||
| 1102 | static void mmc_set_mmc_erase_timeout(struct mmc_card *card, | ||
| 1103 | struct mmc_command *cmd, | ||
| 1104 | unsigned int arg, unsigned int qty) | ||
| 1105 | { | ||
| 1106 | unsigned int erase_timeout; | ||
| 1107 | |||
| 1108 | if (card->ext_csd.erase_group_def & 1) { | ||
| 1109 | /* High Capacity Erase Group Size uses HC timeouts */ | ||
| 1110 | if (arg == MMC_TRIM_ARG) | ||
| 1111 | erase_timeout = card->ext_csd.trim_timeout; | ||
| 1112 | else | ||
| 1113 | erase_timeout = card->ext_csd.hc_erase_timeout; | ||
| 1114 | } else { | ||
| 1115 | /* CSD Erase Group Size uses write timeout */ | ||
| 1116 | unsigned int mult = (10 << card->csd.r2w_factor); | ||
| 1117 | unsigned int timeout_clks = card->csd.tacc_clks * mult; | ||
| 1118 | unsigned int timeout_us; | ||
| 1119 | |||
| 1120 | /* Avoid overflow: e.g. tacc_ns=80000000 mult=1280 */ | ||
| 1121 | if (card->csd.tacc_ns < 1000000) | ||
| 1122 | timeout_us = (card->csd.tacc_ns * mult) / 1000; | ||
| 1123 | else | ||
| 1124 | timeout_us = (card->csd.tacc_ns / 1000) * mult; | ||
| 1125 | |||
| 1126 | /* | ||
| 1127 | * ios.clock is only a target. The real clock rate might be | ||
| 1128 | * less but not that much less, so fudge it by multiplying by 2. | ||
| 1129 | */ | ||
| 1130 | timeout_clks <<= 1; | ||
| 1131 | timeout_us += (timeout_clks * 1000) / | ||
| 1132 | (card->host->ios.clock / 1000); | ||
| 1133 | |||
| 1134 | erase_timeout = timeout_us / 1000; | ||
| 1135 | |||
| 1136 | /* | ||
| 1137 | * Theoretically, the calculation could underflow so round up | ||
| 1138 | * to 1ms in that case. | ||
| 1139 | */ | ||
| 1140 | if (!erase_timeout) | ||
| 1141 | erase_timeout = 1; | ||
| 1142 | } | ||
| 1143 | |||
| 1144 | /* Multiplier for secure operations */ | ||
| 1145 | if (arg & MMC_SECURE_ARGS) { | ||
| 1146 | if (arg == MMC_SECURE_ERASE_ARG) | ||
| 1147 | erase_timeout *= card->ext_csd.sec_erase_mult; | ||
| 1148 | else | ||
| 1149 | erase_timeout *= card->ext_csd.sec_trim_mult; | ||
| 1150 | } | ||
| 1151 | |||
| 1152 | erase_timeout *= qty; | ||
| 1153 | |||
| 1154 | /* | ||
| 1155 | * Ensure at least a 1 second timeout for SPI as per | ||
| 1156 | * 'mmc_set_data_timeout()' | ||
| 1157 | */ | ||
| 1158 | if (mmc_host_is_spi(card->host) && erase_timeout < 1000) | ||
| 1159 | erase_timeout = 1000; | ||
| 1160 | |||
| 1161 | cmd->erase_timeout = erase_timeout; | ||
| 1162 | } | ||
| 1163 | |||
| 1164 | static void mmc_set_sd_erase_timeout(struct mmc_card *card, | ||
| 1165 | struct mmc_command *cmd, unsigned int arg, | ||
| 1166 | unsigned int qty) | ||
| 1167 | { | ||
| 1168 | if (card->ssr.erase_timeout) { | ||
| 1169 | /* Erase timeout specified in SD Status Register (SSR) */ | ||
| 1170 | cmd->erase_timeout = card->ssr.erase_timeout * qty + | ||
| 1171 | card->ssr.erase_offset; | ||
| 1172 | } else { | ||
| 1173 | /* | ||
| 1174 | * Erase timeout not specified in SD Status Register (SSR) so | ||
| 1175 | * use 250ms per write block. | ||
| 1176 | */ | ||
| 1177 | cmd->erase_timeout = 250 * qty; | ||
| 1178 | } | ||
| 1179 | |||
| 1180 | /* Must not be less than 1 second */ | ||
| 1181 | if (cmd->erase_timeout < 1000) | ||
| 1182 | cmd->erase_timeout = 1000; | ||
| 1183 | } | ||
| 1184 | |||
| 1185 | static void mmc_set_erase_timeout(struct mmc_card *card, | ||
| 1186 | struct mmc_command *cmd, unsigned int arg, | ||
| 1187 | unsigned int qty) | ||
| 1188 | { | ||
| 1189 | if (mmc_card_sd(card)) | ||
| 1190 | mmc_set_sd_erase_timeout(card, cmd, arg, qty); | ||
| 1191 | else | ||
| 1192 | mmc_set_mmc_erase_timeout(card, cmd, arg, qty); | ||
| 1193 | } | ||
| 1194 | |||
| 1195 | static int mmc_do_erase(struct mmc_card *card, unsigned int from, | ||
| 1196 | unsigned int to, unsigned int arg) | ||
| 1197 | { | ||
| 1198 | struct mmc_command cmd; | ||
| 1199 | unsigned int qty = 0; | ||
| 1200 | int err; | ||
| 1201 | |||
| 1202 | /* | ||
| 1203 | * qty is used to calculate the erase timeout which depends on how many | ||
| 1204 | * erase groups (or allocation units in SD terminology) are affected. | ||
| 1205 | * We count erasing part of an erase group as one erase group. | ||
| 1206 | * For SD, the allocation units are always a power of 2. For MMC, the | ||
| 1207 | * erase group size is almost certainly also power of 2, but it does not | ||
| 1208 | * seem to insist on that in the JEDEC standard, so we fall back to | ||
| 1209 | * division in that case. SD may not specify an allocation unit size, | ||
| 1210 | * in which case the timeout is based on the number of write blocks. | ||
| 1211 | * | ||
| 1212 | * Note that the timeout for secure trim 2 will only be correct if the | ||
| 1213 | * number of erase groups specified is the same as the total of all | ||
| 1214 | * preceding secure trim 1 commands. Since the power may have been | ||
| 1215 | * lost since the secure trim 1 commands occurred, it is generally | ||
| 1216 | * impossible to calculate the secure trim 2 timeout correctly. | ||
| 1217 | */ | ||
| 1218 | if (card->erase_shift) | ||
| 1219 | qty += ((to >> card->erase_shift) - | ||
| 1220 | (from >> card->erase_shift)) + 1; | ||
| 1221 | else if (mmc_card_sd(card)) | ||
| 1222 | qty += to - from + 1; | ||
| 1223 | else | ||
| 1224 | qty += ((to / card->erase_size) - | ||
| 1225 | (from / card->erase_size)) + 1; | ||
| 1226 | |||
| 1227 | if (!mmc_card_blockaddr(card)) { | ||
| 1228 | from <<= 9; | ||
| 1229 | to <<= 9; | ||
| 1230 | } | ||
| 1231 | |||
| 1232 | memset(&cmd, 0, sizeof(struct mmc_command)); | ||
| 1233 | if (mmc_card_sd(card)) | ||
| 1234 | cmd.opcode = SD_ERASE_WR_BLK_START; | ||
| 1235 | else | ||
| 1236 | cmd.opcode = MMC_ERASE_GROUP_START; | ||
| 1237 | cmd.arg = from; | ||
| 1238 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; | ||
| 1239 | err = mmc_wait_for_cmd(card->host, &cmd, 0); | ||
| 1240 | if (err) { | ||
| 1241 | printk(KERN_ERR "mmc_erase: group start error %d, " | ||
| 1242 | "status %#x\n", err, cmd.resp[0]); | ||
| 1243 | err = -EINVAL; | ||
| 1244 | goto out; | ||
| 1245 | } | ||
| 1246 | |||
| 1247 | memset(&cmd, 0, sizeof(struct mmc_command)); | ||
| 1248 | if (mmc_card_sd(card)) | ||
| 1249 | cmd.opcode = SD_ERASE_WR_BLK_END; | ||
| 1250 | else | ||
| 1251 | cmd.opcode = MMC_ERASE_GROUP_END; | ||
| 1252 | cmd.arg = to; | ||
| 1253 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; | ||
| 1254 | err = mmc_wait_for_cmd(card->host, &cmd, 0); | ||
| 1255 | if (err) { | ||
| 1256 | printk(KERN_ERR "mmc_erase: group end error %d, status %#x\n", | ||
| 1257 | err, cmd.resp[0]); | ||
| 1258 | err = -EINVAL; | ||
| 1259 | goto out; | ||
| 1260 | } | ||
| 1261 | |||
| 1262 | memset(&cmd, 0, sizeof(struct mmc_command)); | ||
| 1263 | cmd.opcode = MMC_ERASE; | ||
| 1264 | cmd.arg = arg; | ||
| 1265 | cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; | ||
| 1266 | mmc_set_erase_timeout(card, &cmd, arg, qty); | ||
| 1267 | err = mmc_wait_for_cmd(card->host, &cmd, 0); | ||
| 1268 | if (err) { | ||
| 1269 | printk(KERN_ERR "mmc_erase: erase error %d, status %#x\n", | ||
| 1270 | err, cmd.resp[0]); | ||
| 1271 | err = -EIO; | ||
| 1272 | goto out; | ||
| 1273 | } | ||
| 1274 | |||
| 1275 | if (mmc_host_is_spi(card->host)) | ||
| 1276 | goto out; | ||
| 1277 | |||
| 1278 | do { | ||
| 1279 | memset(&cmd, 0, sizeof(struct mmc_command)); | ||
| 1280 | cmd.opcode = MMC_SEND_STATUS; | ||
| 1281 | cmd.arg = card->rca << 16; | ||
| 1282 | cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; | ||
| 1283 | /* Do not retry else we can't see errors */ | ||
| 1284 | err = mmc_wait_for_cmd(card->host, &cmd, 0); | ||
| 1285 | if (err || (cmd.resp[0] & 0xFDF92000)) { | ||
| 1286 | printk(KERN_ERR "error %d requesting status %#x\n", | ||
| 1287 | err, cmd.resp[0]); | ||
| 1288 | err = -EIO; | ||
| 1289 | goto out; | ||
| 1290 | } | ||
| 1291 | } while (!(cmd.resp[0] & R1_READY_FOR_DATA) || | ||
| 1292 | R1_CURRENT_STATE(cmd.resp[0]) == 7); | ||
| 1293 | out: | ||
| 1294 | return err; | ||
| 1295 | } | ||
| 1296 | |||
| 1297 | /** | ||
| 1298 | * mmc_erase - erase sectors. | ||
| 1299 | * @card: card to erase | ||
| 1300 | * @from: first sector to erase | ||
| 1301 | * @nr: number of sectors to erase | ||
| 1302 | * @arg: erase command argument (SD supports only %MMC_ERASE_ARG) | ||
| 1303 | * | ||
| 1304 | * Caller must claim host before calling this function. | ||
| 1305 | */ | ||
| 1306 | int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr, | ||
| 1307 | unsigned int arg) | ||
| 1308 | { | ||
| 1309 | unsigned int rem, to = from + nr; | ||
| 1310 | |||
| 1311 | if (!(card->host->caps & MMC_CAP_ERASE) || | ||
| 1312 | !(card->csd.cmdclass & CCC_ERASE)) | ||
| 1313 | return -EOPNOTSUPP; | ||
| 1314 | |||
| 1315 | if (!card->erase_size) | ||
| 1316 | return -EOPNOTSUPP; | ||
| 1317 | |||
| 1318 | if (mmc_card_sd(card) && arg != MMC_ERASE_ARG) | ||
| 1319 | return -EOPNOTSUPP; | ||
| 1320 | |||
| 1321 | if ((arg & MMC_SECURE_ARGS) && | ||
| 1322 | !(card->ext_csd.sec_feature_support & EXT_CSD_SEC_ER_EN)) | ||
| 1323 | return -EOPNOTSUPP; | ||
| 1324 | |||
| 1325 | if ((arg & MMC_TRIM_ARGS) && | ||
| 1326 | !(card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN)) | ||
| 1327 | return -EOPNOTSUPP; | ||
| 1328 | |||
| 1329 | if (arg == MMC_SECURE_ERASE_ARG) { | ||
| 1330 | if (from % card->erase_size || nr % card->erase_size) | ||
| 1331 | return -EINVAL; | ||
| 1332 | } | ||
| 1333 | |||
| 1334 | if (arg == MMC_ERASE_ARG) { | ||
| 1335 | rem = from % card->erase_size; | ||
| 1336 | if (rem) { | ||
| 1337 | rem = card->erase_size - rem; | ||
| 1338 | from += rem; | ||
| 1339 | if (nr > rem) | ||
| 1340 | nr -= rem; | ||
| 1341 | else | ||
| 1342 | return 0; | ||
| 1343 | } | ||
| 1344 | rem = nr % card->erase_size; | ||
| 1345 | if (rem) | ||
| 1346 | nr -= rem; | ||
| 1347 | } | ||
| 1348 | |||
| 1349 | if (nr == 0) | ||
| 1350 | return 0; | ||
| 1351 | |||
| 1352 | to = from + nr; | ||
| 1353 | |||
| 1354 | if (to <= from) | ||
| 1355 | return -EINVAL; | ||
| 1356 | |||
| 1357 | /* 'from' and 'to' are inclusive */ | ||
| 1358 | to -= 1; | ||
| 1359 | |||
| 1360 | return mmc_do_erase(card, from, to, arg); | ||
| 1361 | } | ||
| 1362 | EXPORT_SYMBOL(mmc_erase); | ||
| 1363 | |||
| 1364 | int mmc_can_erase(struct mmc_card *card) | ||
| 1365 | { | ||
| 1366 | if ((card->host->caps & MMC_CAP_ERASE) && | ||
| 1367 | (card->csd.cmdclass & CCC_ERASE) && card->erase_size) | ||
| 1368 | return 1; | ||
| 1369 | return 0; | ||
| 1370 | } | ||
| 1371 | EXPORT_SYMBOL(mmc_can_erase); | ||
| 1372 | |||
| 1373 | int mmc_can_trim(struct mmc_card *card) | ||
| 1374 | { | ||
| 1375 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) | ||
| 1376 | return 1; | ||
| 1377 | return 0; | ||
| 1378 | } | ||
| 1379 | EXPORT_SYMBOL(mmc_can_trim); | ||
| 1380 | |||
| 1381 | int mmc_can_secure_erase_trim(struct mmc_card *card) | ||
| 1382 | { | ||
| 1383 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_ER_EN) | ||
| 1384 | return 1; | ||
| 1385 | return 0; | ||
| 1386 | } | ||
| 1387 | EXPORT_SYMBOL(mmc_can_secure_erase_trim); | ||
| 1388 | |||
| 1389 | int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from, | ||
| 1390 | unsigned int nr) | ||
| 1391 | { | ||
| 1392 | if (!card->erase_size) | ||
| 1393 | return 0; | ||
| 1394 | if (from % card->erase_size || nr % card->erase_size) | ||
| 1395 | return 0; | ||
| 1396 | return 1; | ||
| 1397 | } | ||
| 1398 | EXPORT_SYMBOL(mmc_erase_group_aligned); | ||
| 1053 | 1399 | ||
| 1054 | void mmc_rescan(struct work_struct *work) | 1400 | void mmc_rescan(struct work_struct *work) |
| 1055 | { | 1401 | { |
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index a811c52a1659..9d9eef50e5d1 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h | |||
| @@ -29,6 +29,8 @@ struct mmc_bus_ops { | |||
| 29 | void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops); | 29 | void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops); |
| 30 | void mmc_detach_bus(struct mmc_host *host); | 30 | void mmc_detach_bus(struct mmc_host *host); |
| 31 | 31 | ||
| 32 | void mmc_init_erase(struct mmc_card *card); | ||
| 33 | |||
| 32 | void mmc_set_chip_select(struct mmc_host *host, int mode); | 34 | void mmc_set_chip_select(struct mmc_host *host, int mode); |
| 33 | void mmc_set_clock(struct mmc_host *host, unsigned int hz); | 35 | void mmc_set_clock(struct mmc_host *host, unsigned int hz); |
| 34 | void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode); | 36 | void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode); |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index ccba3869c029..6909a54c39be 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
| @@ -108,13 +108,23 @@ static int mmc_decode_cid(struct mmc_card *card) | |||
| 108 | return 0; | 108 | return 0; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | static void mmc_set_erase_size(struct mmc_card *card) | ||
| 112 | { | ||
| 113 | if (card->ext_csd.erase_group_def & 1) | ||
| 114 | card->erase_size = card->ext_csd.hc_erase_size; | ||
| 115 | else | ||
| 116 | card->erase_size = card->csd.erase_size; | ||
| 117 | |||
| 118 | mmc_init_erase(card); | ||
| 119 | } | ||
| 120 | |||
| 111 | /* | 121 | /* |
| 112 | * Given a 128-bit response, decode to our card CSD structure. | 122 | * Given a 128-bit response, decode to our card CSD structure. |
| 113 | */ | 123 | */ |
| 114 | static int mmc_decode_csd(struct mmc_card *card) | 124 | static int mmc_decode_csd(struct mmc_card *card) |
| 115 | { | 125 | { |
| 116 | struct mmc_csd *csd = &card->csd; | 126 | struct mmc_csd *csd = &card->csd; |
| 117 | unsigned int e, m; | 127 | unsigned int e, m, a, b; |
| 118 | u32 *resp = card->raw_csd; | 128 | u32 *resp = card->raw_csd; |
| 119 | 129 | ||
| 120 | /* | 130 | /* |
| @@ -152,6 +162,13 @@ static int mmc_decode_csd(struct mmc_card *card) | |||
| 152 | csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4); | 162 | csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4); |
| 153 | csd->write_partial = UNSTUFF_BITS(resp, 21, 1); | 163 | csd->write_partial = UNSTUFF_BITS(resp, 21, 1); |
| 154 | 164 | ||
| 165 | if (csd->write_blkbits >= 9) { | ||
| 166 | a = UNSTUFF_BITS(resp, 42, 5); | ||
| 167 | b = UNSTUFF_BITS(resp, 37, 5); | ||
| 168 | csd->erase_size = (a + 1) * (b + 1); | ||
| 169 | csd->erase_size <<= csd->write_blkbits - 9; | ||
| 170 | } | ||
| 171 | |||
| 155 | return 0; | 172 | return 0; |
| 156 | } | 173 | } |
| 157 | 174 | ||
| @@ -261,8 +278,30 @@ static int mmc_read_ext_csd(struct mmc_card *card) | |||
| 261 | if (sa_shift > 0 && sa_shift <= 0x17) | 278 | if (sa_shift > 0 && sa_shift <= 0x17) |
| 262 | card->ext_csd.sa_timeout = | 279 | card->ext_csd.sa_timeout = |
| 263 | 1 << ext_csd[EXT_CSD_S_A_TIMEOUT]; | 280 | 1 << ext_csd[EXT_CSD_S_A_TIMEOUT]; |
| 281 | card->ext_csd.erase_group_def = | ||
| 282 | ext_csd[EXT_CSD_ERASE_GROUP_DEF]; | ||
| 283 | card->ext_csd.hc_erase_timeout = 300 * | ||
| 284 | ext_csd[EXT_CSD_ERASE_TIMEOUT_MULT]; | ||
| 285 | card->ext_csd.hc_erase_size = | ||
| 286 | ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE] << 10; | ||
| 287 | } | ||
| 288 | |||
| 289 | if (card->ext_csd.rev >= 4) { | ||
| 290 | card->ext_csd.sec_trim_mult = | ||
| 291 | ext_csd[EXT_CSD_SEC_TRIM_MULT]; | ||
| 292 | card->ext_csd.sec_erase_mult = | ||
| 293 | ext_csd[EXT_CSD_SEC_ERASE_MULT]; | ||
| 294 | card->ext_csd.sec_feature_support = | ||
| 295 | ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT]; | ||
| 296 | card->ext_csd.trim_timeout = 300 * | ||
| 297 | ext_csd[EXT_CSD_TRIM_MULT]; | ||
| 264 | } | 298 | } |
| 265 | 299 | ||
| 300 | if (ext_csd[EXT_CSD_ERASED_MEM_CONT]) | ||
| 301 | card->erased_byte = 0xFF; | ||
| 302 | else | ||
| 303 | card->erased_byte = 0x0; | ||
| 304 | |||
| 266 | out: | 305 | out: |
| 267 | kfree(ext_csd); | 306 | kfree(ext_csd); |
| 268 | 307 | ||
| @@ -274,6 +313,8 @@ MMC_DEV_ATTR(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], | |||
| 274 | MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | 313 | MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], |
| 275 | card->raw_csd[2], card->raw_csd[3]); | 314 | card->raw_csd[2], card->raw_csd[3]); |
| 276 | MMC_DEV_ATTR(date, "%02d/%04d\n", card->cid.month, card->cid.year); | 315 | MMC_DEV_ATTR(date, "%02d/%04d\n", card->cid.month, card->cid.year); |
| 316 | MMC_DEV_ATTR(erase_size, "%u\n", card->erase_size << 9); | ||
| 317 | MMC_DEV_ATTR(preferred_erase_size, "%u\n", card->pref_erase << 9); | ||
| 277 | MMC_DEV_ATTR(fwrev, "0x%x\n", card->cid.fwrev); | 318 | MMC_DEV_ATTR(fwrev, "0x%x\n", card->cid.fwrev); |
| 278 | MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev); | 319 | MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev); |
| 279 | MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid); | 320 | MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid); |
| @@ -285,6 +326,8 @@ static struct attribute *mmc_std_attrs[] = { | |||
| 285 | &dev_attr_cid.attr, | 326 | &dev_attr_cid.attr, |
| 286 | &dev_attr_csd.attr, | 327 | &dev_attr_csd.attr, |
| 287 | &dev_attr_date.attr, | 328 | &dev_attr_date.attr, |
| 329 | &dev_attr_erase_size.attr, | ||
| 330 | &dev_attr_preferred_erase_size.attr, | ||
| 288 | &dev_attr_fwrev.attr, | 331 | &dev_attr_fwrev.attr, |
| 289 | &dev_attr_hwrev.attr, | 332 | &dev_attr_hwrev.attr, |
| 290 | &dev_attr_manfid.attr, | 333 | &dev_attr_manfid.attr, |
| @@ -421,6 +464,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
| 421 | err = mmc_read_ext_csd(card); | 464 | err = mmc_read_ext_csd(card); |
| 422 | if (err) | 465 | if (err) |
| 423 | goto free_card; | 466 | goto free_card; |
| 467 | /* Erase size depends on CSD and Extended CSD */ | ||
| 468 | mmc_set_erase_size(card); | ||
| 424 | } | 469 | } |
| 425 | 470 | ||
| 426 | /* | 471 | /* |
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index e6d7d9fab446..0f5241085557 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
| @@ -119,6 +119,13 @@ static int mmc_decode_csd(struct mmc_card *card) | |||
| 119 | csd->r2w_factor = UNSTUFF_BITS(resp, 26, 3); | 119 | csd->r2w_factor = UNSTUFF_BITS(resp, 26, 3); |
| 120 | csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4); | 120 | csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4); |
| 121 | csd->write_partial = UNSTUFF_BITS(resp, 21, 1); | 121 | csd->write_partial = UNSTUFF_BITS(resp, 21, 1); |
| 122 | |||
| 123 | if (UNSTUFF_BITS(resp, 46, 1)) { | ||
| 124 | csd->erase_size = 1; | ||
| 125 | } else if (csd->write_blkbits >= 9) { | ||
| 126 | csd->erase_size = UNSTUFF_BITS(resp, 39, 7) + 1; | ||
| 127 | csd->erase_size <<= csd->write_blkbits - 9; | ||
| 128 | } | ||
| 122 | break; | 129 | break; |
| 123 | case 1: | 130 | case 1: |
| 124 | /* | 131 | /* |
| @@ -147,6 +154,7 @@ static int mmc_decode_csd(struct mmc_card *card) | |||
| 147 | csd->r2w_factor = 4; /* Unused */ | 154 | csd->r2w_factor = 4; /* Unused */ |
| 148 | csd->write_blkbits = 9; | 155 | csd->write_blkbits = 9; |
| 149 | csd->write_partial = 0; | 156 | csd->write_partial = 0; |
| 157 | csd->erase_size = 1; | ||
| 150 | break; | 158 | break; |
| 151 | default: | 159 | default: |
| 152 | printk(KERN_ERR "%s: unrecognised CSD structure version %d\n", | 160 | printk(KERN_ERR "%s: unrecognised CSD structure version %d\n", |
| @@ -154,6 +162,8 @@ static int mmc_decode_csd(struct mmc_card *card) | |||
| 154 | return -EINVAL; | 162 | return -EINVAL; |
| 155 | } | 163 | } |
| 156 | 164 | ||
| 165 | card->erase_size = csd->erase_size; | ||
| 166 | |||
| 157 | return 0; | 167 | return 0; |
| 158 | } | 168 | } |
| 159 | 169 | ||
| @@ -179,10 +189,68 @@ static int mmc_decode_scr(struct mmc_card *card) | |||
| 179 | scr->sda_vsn = UNSTUFF_BITS(resp, 56, 4); | 189 | scr->sda_vsn = UNSTUFF_BITS(resp, 56, 4); |
| 180 | scr->bus_widths = UNSTUFF_BITS(resp, 48, 4); | 190 | scr->bus_widths = UNSTUFF_BITS(resp, 48, 4); |
| 181 | 191 | ||
| 192 | if (UNSTUFF_BITS(resp, 55, 1)) | ||
| 193 | card->erased_byte = 0xFF; | ||
| 194 | else | ||
| 195 | card->erased_byte = 0x0; | ||
| 196 | |||
| 182 | return 0; | 197 | return 0; |
| 183 | } | 198 | } |
| 184 | 199 | ||
| 185 | /* | 200 | /* |
| 201 | * Fetch and process SD Status register. | ||
| 202 | */ | ||
| 203 | static int mmc_read_ssr(struct mmc_card *card) | ||
| 204 | { | ||
| 205 | unsigned int au, es, et, eo; | ||
| 206 | int err, i; | ||
| 207 | u32 *ssr; | ||
| 208 | |||
| 209 | if (!(card->csd.cmdclass & CCC_APP_SPEC)) { | ||
| 210 | printk(KERN_WARNING "%s: card lacks mandatory SD Status " | ||
| 211 | "function.\n", mmc_hostname(card->host)); | ||
| 212 | return 0; | ||
| 213 | } | ||
| 214 | |||
| 215 | ssr = kmalloc(64, GFP_KERNEL); | ||
| 216 | if (!ssr) | ||
| 217 | return -ENOMEM; | ||
| 218 | |||
| 219 | err = mmc_app_sd_status(card, ssr); | ||
| 220 | if (err) { | ||
| 221 | printk(KERN_WARNING "%s: problem reading SD Status " | ||
| 222 | "register.\n", mmc_hostname(card->host)); | ||
| 223 | err = 0; | ||
| 224 | goto out; | ||
| 225 | } | ||
| 226 | |||
| 227 | for (i = 0; i < 16; i++) | ||
| 228 | ssr[i] = be32_to_cpu(ssr[i]); | ||
| 229 | |||
| 230 | /* | ||
| 231 | * UNSTUFF_BITS only works with four u32s so we have to offset the | ||
| 232 | * bitfield positions accordingly. | ||
| 233 | */ | ||
| 234 | au = UNSTUFF_BITS(ssr, 428 - 384, 4); | ||
| 235 | if (au > 0 || au <= 9) { | ||
| 236 | card->ssr.au = 1 << (au + 4); | ||
| 237 | es = UNSTUFF_BITS(ssr, 408 - 384, 16); | ||
| 238 | et = UNSTUFF_BITS(ssr, 402 - 384, 6); | ||
| 239 | eo = UNSTUFF_BITS(ssr, 400 - 384, 2); | ||
| 240 | if (es && et) { | ||
| 241 | card->ssr.erase_timeout = (et * 1000) / es; | ||
| 242 | card->ssr.erase_offset = eo * 1000; | ||
| 243 | } | ||
| 244 | } else { | ||
| 245 | printk(KERN_WARNING "%s: SD Status: Invalid Allocation Unit " | ||
| 246 | "size.\n", mmc_hostname(card->host)); | ||
| 247 | } | ||
| 248 | out: | ||
| 249 | kfree(ssr); | ||
| 250 | return err; | ||
| 251 | } | ||
| 252 | |||
| 253 | /* | ||
| 186 | * Fetches and decodes switch information | 254 | * Fetches and decodes switch information |
| 187 | */ | 255 | */ |
| 188 | static int mmc_read_switch(struct mmc_card *card) | 256 | static int mmc_read_switch(struct mmc_card *card) |
| @@ -289,6 +357,8 @@ MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | |||
| 289 | card->raw_csd[2], card->raw_csd[3]); | 357 | card->raw_csd[2], card->raw_csd[3]); |
| 290 | MMC_DEV_ATTR(scr, "%08x%08x\n", card->raw_scr[0], card->raw_scr[1]); | 358 | MMC_DEV_ATTR(scr, "%08x%08x\n", card->raw_scr[0], card->raw_scr[1]); |
| 291 | MMC_DEV_ATTR(date, "%02d/%04d\n", card->cid.month, card->cid.year); | 359 | MMC_DEV_ATTR(date, "%02d/%04d\n", card->cid.month, card->cid.year); |
| 360 | MMC_DEV_ATTR(erase_size, "%u\n", card->erase_size << 9); | ||
| 361 | MMC_DEV_ATTR(preferred_erase_size, "%u\n", card->pref_erase << 9); | ||
| 292 | MMC_DEV_ATTR(fwrev, "0x%x\n", card->cid.fwrev); | 362 | MMC_DEV_ATTR(fwrev, "0x%x\n", card->cid.fwrev); |
| 293 | MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev); | 363 | MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev); |
| 294 | MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid); | 364 | MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid); |
| @@ -302,6 +372,8 @@ static struct attribute *sd_std_attrs[] = { | |||
| 302 | &dev_attr_csd.attr, | 372 | &dev_attr_csd.attr, |
| 303 | &dev_attr_scr.attr, | 373 | &dev_attr_scr.attr, |
| 304 | &dev_attr_date.attr, | 374 | &dev_attr_date.attr, |
| 375 | &dev_attr_erase_size.attr, | ||
| 376 | &dev_attr_preferred_erase_size.attr, | ||
| 305 | &dev_attr_fwrev.attr, | 377 | &dev_attr_fwrev.attr, |
| 306 | &dev_attr_hwrev.attr, | 378 | &dev_attr_hwrev.attr, |
| 307 | &dev_attr_manfid.attr, | 379 | &dev_attr_manfid.attr, |
| @@ -397,6 +469,16 @@ int mmc_sd_setup_card(struct mmc_host *host, struct mmc_card *card, | |||
| 397 | return err; | 469 | return err; |
| 398 | 470 | ||
| 399 | /* | 471 | /* |
| 472 | * Fetch and process SD Status register. | ||
| 473 | */ | ||
| 474 | err = mmc_read_ssr(card); | ||
| 475 | if (err) | ||
| 476 | return err; | ||
| 477 | |||
| 478 | /* Erase init depends on CSD and SSR */ | ||
| 479 | mmc_init_erase(card); | ||
| 480 | |||
| 481 | /* | ||
| 400 | * Fetch switch information from card. | 482 | * Fetch switch information from card. |
| 401 | */ | 483 | */ |
| 402 | err = mmc_read_switch(card); | 484 | err = mmc_read_switch(card); |
diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c index 63772e7e7608..797cdb5887fd 100644 --- a/drivers/mmc/core/sd_ops.c +++ b/drivers/mmc/core/sd_ops.c | |||
| @@ -346,3 +346,51 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group, | |||
| 346 | return 0; | 346 | return 0; |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | int mmc_app_sd_status(struct mmc_card *card, void *ssr) | ||
| 350 | { | ||
| 351 | int err; | ||
| 352 | struct mmc_request mrq; | ||
| 353 | struct mmc_command cmd; | ||
| 354 | struct mmc_data data; | ||
| 355 | struct scatterlist sg; | ||
| 356 | |||
| 357 | BUG_ON(!card); | ||
| 358 | BUG_ON(!card->host); | ||
| 359 | BUG_ON(!ssr); | ||
| 360 | |||
| 361 | /* NOTE: caller guarantees ssr is heap-allocated */ | ||
| 362 | |||
| 363 | err = mmc_app_cmd(card->host, card); | ||
| 364 | if (err) | ||
| 365 | return err; | ||
| 366 | |||
| 367 | memset(&mrq, 0, sizeof(struct mmc_request)); | ||
| 368 | memset(&cmd, 0, sizeof(struct mmc_command)); | ||
| 369 | memset(&data, 0, sizeof(struct mmc_data)); | ||
| 370 | |||
| 371 | mrq.cmd = &cmd; | ||
| 372 | mrq.data = &data; | ||
| 373 | |||
| 374 | cmd.opcode = SD_APP_SD_STATUS; | ||
| 375 | cmd.arg = 0; | ||
| 376 | cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_ADTC; | ||
| 377 | |||
| 378 | data.blksz = 64; | ||
| 379 | data.blocks = 1; | ||
| 380 | data.flags = MMC_DATA_READ; | ||
| 381 | data.sg = &sg; | ||
| 382 | data.sg_len = 1; | ||
| 383 | |||
| 384 | sg_init_one(&sg, ssr, 64); | ||
| 385 | |||
| 386 | mmc_set_data_timeout(&data, card); | ||
| 387 | |||
| 388 | mmc_wait_for_req(card->host, &mrq); | ||
| 389 | |||
| 390 | if (cmd.error) | ||
| 391 | return cmd.error; | ||
| 392 | if (data.error) | ||
| 393 | return data.error; | ||
| 394 | |||
| 395 | return 0; | ||
| 396 | } | ||
diff --git a/drivers/mmc/core/sd_ops.h b/drivers/mmc/core/sd_ops.h index 9742d8a30664..ffc2305d905f 100644 --- a/drivers/mmc/core/sd_ops.h +++ b/drivers/mmc/core/sd_ops.h | |||
| @@ -19,6 +19,7 @@ int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca); | |||
| 19 | int mmc_app_send_scr(struct mmc_card *card, u32 *scr); | 19 | int mmc_app_send_scr(struct mmc_card *card, u32 *scr); |
| 20 | int mmc_sd_switch(struct mmc_card *card, int mode, int group, | 20 | int mmc_sd_switch(struct mmc_card *card, int mode, int group, |
| 21 | u8 value, u8 *resp); | 21 | u8 value, u8 *resp); |
| 22 | int mmc_app_sd_status(struct mmc_card *card, void *ssr); | ||
| 22 | 23 | ||
| 23 | #endif | 24 | #endif |
| 24 | 25 | ||
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 7b0f3ef50f96..1145ea0792e6 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c | |||
| @@ -1536,6 +1536,7 @@ static int __devexit mmc_spi_remove(struct spi_device *spi) | |||
| 1536 | #if defined(CONFIG_OF) | 1536 | #if defined(CONFIG_OF) |
| 1537 | static struct of_device_id mmc_spi_of_match_table[] __devinitdata = { | 1537 | static struct of_device_id mmc_spi_of_match_table[] __devinitdata = { |
| 1538 | { .compatible = "mmc-spi-slot", }, | 1538 | { .compatible = "mmc-spi-slot", }, |
| 1539 | {}, | ||
| 1539 | }; | 1540 | }; |
| 1540 | #endif | 1541 | #endif |
| 1541 | 1542 | ||
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index dc57ef6aef4f..4a8776f8afdd 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/clk.h> | 28 | #include <linux/clk.h> |
| 29 | #include <linux/mmc/host.h> | 29 | #include <linux/mmc/host.h> |
| 30 | #include <linux/mmc/core.h> | 30 | #include <linux/mmc/core.h> |
| 31 | #include <linux/mmc/mmc.h> | ||
| 31 | #include <linux/io.h> | 32 | #include <linux/io.h> |
| 32 | #include <linux/semaphore.h> | 33 | #include <linux/semaphore.h> |
| 33 | #include <linux/gpio.h> | 34 | #include <linux/gpio.h> |
| @@ -78,6 +79,7 @@ | |||
| 78 | #define INT_EN_MASK 0x307F0033 | 79 | #define INT_EN_MASK 0x307F0033 |
| 79 | #define BWR_ENABLE (1 << 4) | 80 | #define BWR_ENABLE (1 << 4) |
| 80 | #define BRR_ENABLE (1 << 5) | 81 | #define BRR_ENABLE (1 << 5) |
| 82 | #define DTO_ENABLE (1 << 20) | ||
| 81 | #define INIT_STREAM (1 << 1) | 83 | #define INIT_STREAM (1 << 1) |
| 82 | #define DP_SELECT (1 << 21) | 84 | #define DP_SELECT (1 << 21) |
| 83 | #define DDIR (1 << 4) | 85 | #define DDIR (1 << 4) |
| @@ -523,7 +525,8 @@ static void omap_hsmmc_stop_clock(struct omap_hsmmc_host *host) | |||
| 523 | dev_dbg(mmc_dev(host->mmc), "MMC Clock is not stoped\n"); | 525 | dev_dbg(mmc_dev(host->mmc), "MMC Clock is not stoped\n"); |
| 524 | } | 526 | } |
| 525 | 527 | ||
| 526 | static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host) | 528 | static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host, |
| 529 | struct mmc_command *cmd) | ||
| 527 | { | 530 | { |
| 528 | unsigned int irq_mask; | 531 | unsigned int irq_mask; |
| 529 | 532 | ||
| @@ -532,6 +535,10 @@ static void omap_hsmmc_enable_irq(struct omap_hsmmc_host *host) | |||
| 532 | else | 535 | else |
| 533 | irq_mask = INT_EN_MASK; | 536 | irq_mask = INT_EN_MASK; |
| 534 | 537 | ||
| 538 | /* Disable timeout for erases */ | ||
| 539 | if (cmd->opcode == MMC_ERASE) | ||
| 540 | irq_mask &= ~DTO_ENABLE; | ||
| 541 | |||
| 535 | OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR); | 542 | OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR); |
| 536 | OMAP_HSMMC_WRITE(host->base, ISE, irq_mask); | 543 | OMAP_HSMMC_WRITE(host->base, ISE, irq_mask); |
| 537 | OMAP_HSMMC_WRITE(host->base, IE, irq_mask); | 544 | OMAP_HSMMC_WRITE(host->base, IE, irq_mask); |
| @@ -782,7 +789,7 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd, | |||
| 782 | mmc_hostname(host->mmc), cmd->opcode, cmd->arg); | 789 | mmc_hostname(host->mmc), cmd->opcode, cmd->arg); |
| 783 | host->cmd = cmd; | 790 | host->cmd = cmd; |
| 784 | 791 | ||
| 785 | omap_hsmmc_enable_irq(host); | 792 | omap_hsmmc_enable_irq(host, cmd); |
| 786 | 793 | ||
| 787 | host->response_busy = 0; | 794 | host->response_busy = 0; |
| 788 | if (cmd->flags & MMC_RSP_PRESENT) { | 795 | if (cmd->flags & MMC_RSP_PRESENT) { |
| @@ -2107,7 +2114,7 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
| 2107 | mmc->max_seg_size = mmc->max_req_size; | 2114 | mmc->max_seg_size = mmc->max_req_size; |
| 2108 | 2115 | ||
| 2109 | mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | | 2116 | mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | |
| 2110 | MMC_CAP_WAIT_WHILE_BUSY; | 2117 | MMC_CAP_WAIT_WHILE_BUSY | MMC_CAP_ERASE; |
| 2111 | 2118 | ||
| 2112 | switch (mmc_slot(host).wires) { | 2119 | switch (mmc_slot(host).wires) { |
| 2113 | case 8: | 2120 | case 8: |
diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c index dd1bdd168e66..c51b71174c1d 100644 --- a/drivers/mmc/host/sdhci-of-core.c +++ b/drivers/mmc/host/sdhci-of-core.c | |||
| @@ -85,14 +85,14 @@ void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg) | |||
| 85 | 85 | ||
| 86 | #ifdef CONFIG_PM | 86 | #ifdef CONFIG_PM |
| 87 | 87 | ||
| 88 | static int sdhci_of_suspend(struct of_device *ofdev, pm_message_t state) | 88 | static int sdhci_of_suspend(struct platform_device *ofdev, pm_message_t state) |
| 89 | { | 89 | { |
| 90 | struct sdhci_host *host = dev_get_drvdata(&ofdev->dev); | 90 | struct sdhci_host *host = dev_get_drvdata(&ofdev->dev); |
| 91 | 91 | ||
| 92 | return mmc_suspend_host(host->mmc); | 92 | return mmc_suspend_host(host->mmc); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | static int sdhci_of_resume(struct of_device *ofdev) | 95 | static int sdhci_of_resume(struct platform_device *ofdev) |
| 96 | { | 96 | { |
| 97 | struct sdhci_host *host = dev_get_drvdata(&ofdev->dev); | 97 | struct sdhci_host *host = dev_get_drvdata(&ofdev->dev); |
| 98 | 98 | ||
| @@ -115,7 +115,7 @@ static bool __devinit sdhci_of_wp_inverted(struct device_node *np) | |||
| 115 | return machine_is(mpc837x_rdb) || machine_is(mpc837x_mds); | 115 | return machine_is(mpc837x_rdb) || machine_is(mpc837x_mds); |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | static int __devinit sdhci_of_probe(struct of_device *ofdev, | 118 | static int __devinit sdhci_of_probe(struct platform_device *ofdev, |
| 119 | const struct of_device_id *match) | 119 | const struct of_device_id *match) |
| 120 | { | 120 | { |
| 121 | struct device_node *np = ofdev->dev.of_node; | 121 | struct device_node *np = ofdev->dev.of_node; |
| @@ -183,7 +183,7 @@ err_addr_map: | |||
| 183 | return ret; | 183 | return ret; |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | static int __devexit sdhci_of_remove(struct of_device *ofdev) | 186 | static int __devexit sdhci_of_remove(struct platform_device *ofdev) |
| 187 | { | 187 | { |
| 188 | struct sdhci_host *host = dev_get_drvdata(&ofdev->dev); | 188 | struct sdhci_host *host = dev_get_drvdata(&ofdev->dev); |
| 189 | 189 | ||
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 6ac5f9f28ac3..00af55d7afba 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
| @@ -43,7 +43,7 @@ struct of_flash { | |||
| 43 | #ifdef CONFIG_MTD_PARTITIONS | 43 | #ifdef CONFIG_MTD_PARTITIONS |
| 44 | #define OF_FLASH_PARTS(info) ((info)->parts) | 44 | #define OF_FLASH_PARTS(info) ((info)->parts) |
| 45 | 45 | ||
| 46 | static int parse_obsolete_partitions(struct of_device *dev, | 46 | static int parse_obsolete_partitions(struct platform_device *dev, |
| 47 | struct of_flash *info, | 47 | struct of_flash *info, |
| 48 | struct device_node *dp) | 48 | struct device_node *dp) |
| 49 | { | 49 | { |
| @@ -93,7 +93,7 @@ static int parse_obsolete_partitions(struct of_device *dev, | |||
| 93 | #define parse_partitions(info, dev) (0) | 93 | #define parse_partitions(info, dev) (0) |
| 94 | #endif /* MTD_PARTITIONS */ | 94 | #endif /* MTD_PARTITIONS */ |
| 95 | 95 | ||
| 96 | static int of_flash_remove(struct of_device *dev) | 96 | static int of_flash_remove(struct platform_device *dev) |
| 97 | { | 97 | { |
| 98 | struct of_flash *info; | 98 | struct of_flash *info; |
| 99 | int i; | 99 | int i; |
| @@ -140,7 +140,7 @@ static int of_flash_remove(struct of_device *dev) | |||
| 140 | /* Helper function to handle probing of the obsolete "direct-mapped" | 140 | /* Helper function to handle probing of the obsolete "direct-mapped" |
| 141 | * compatible binding, which has an extra "probe-type" property | 141 | * compatible binding, which has an extra "probe-type" property |
| 142 | * describing the type of flash probe necessary. */ | 142 | * describing the type of flash probe necessary. */ |
| 143 | static struct mtd_info * __devinit obsolete_probe(struct of_device *dev, | 143 | static struct mtd_info * __devinit obsolete_probe(struct platform_device *dev, |
| 144 | struct map_info *map) | 144 | struct map_info *map) |
| 145 | { | 145 | { |
| 146 | struct device_node *dp = dev->dev.of_node; | 146 | struct device_node *dp = dev->dev.of_node; |
| @@ -215,7 +215,7 @@ static void __devinit of_free_probes(const char **probes) | |||
| 215 | } | 215 | } |
| 216 | #endif | 216 | #endif |
| 217 | 217 | ||
| 218 | static int __devinit of_flash_probe(struct of_device *dev, | 218 | static int __devinit of_flash_probe(struct platform_device *dev, |
| 219 | const struct of_device_id *match) | 219 | const struct of_device_id *match) |
| 220 | { | 220 | { |
| 221 | #ifdef CONFIG_MTD_PARTITIONS | 221 | #ifdef CONFIG_MTD_PARTITIONS |
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c index 8984236a8d0a..3582ba1f9b09 100644 --- a/drivers/mtd/maps/sun_uflash.c +++ b/drivers/mtd/maps/sun_uflash.c | |||
| @@ -48,7 +48,7 @@ struct map_info uflash_map_templ = { | |||
| 48 | .bankwidth = UFLASH_BUSWIDTH, | 48 | .bankwidth = UFLASH_BUSWIDTH, |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | int uflash_devinit(struct of_device *op, struct device_node *dp) | 51 | int uflash_devinit(struct platform_device *op, struct device_node *dp) |
| 52 | { | 52 | { |
| 53 | struct uflash_dev *up; | 53 | struct uflash_dev *up; |
| 54 | 54 | ||
| @@ -108,7 +108,7 @@ int uflash_devinit(struct of_device *op, struct device_node *dp) | |||
| 108 | return 0; | 108 | return 0; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | static int __devinit uflash_probe(struct of_device *op, const struct of_device_id *match) | 111 | static int __devinit uflash_probe(struct platform_device *op, const struct of_device_id *match) |
| 112 | { | 112 | { |
| 113 | struct device_node *dp = op->dev.of_node; | 113 | struct device_node *dp = op->dev.of_node; |
| 114 | 114 | ||
| @@ -121,7 +121,7 @@ static int __devinit uflash_probe(struct of_device *op, const struct of_device_i | |||
| 121 | return uflash_devinit(op, dp); | 121 | return uflash_devinit(op, dp); |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | static int __devexit uflash_remove(struct of_device *op) | 124 | static int __devexit uflash_remove(struct platform_device *op) |
| 125 | { | 125 | { |
| 126 | struct uflash_dev *up = dev_get_drvdata(&op->dev); | 126 | struct uflash_dev *up = dev_get_drvdata(&op->dev); |
| 127 | 127 | ||
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c index 5084cc517944..80de0bff6c3a 100644 --- a/drivers/mtd/nand/fsl_elbc_nand.c +++ b/drivers/mtd/nand/fsl_elbc_nand.c | |||
| @@ -958,7 +958,7 @@ static int __devinit fsl_elbc_ctrl_init(struct fsl_elbc_ctrl *ctrl) | |||
| 958 | return 0; | 958 | return 0; |
| 959 | } | 959 | } |
| 960 | 960 | ||
| 961 | static int fsl_elbc_ctrl_remove(struct of_device *ofdev) | 961 | static int fsl_elbc_ctrl_remove(struct platform_device *ofdev) |
| 962 | { | 962 | { |
| 963 | struct fsl_elbc_ctrl *ctrl = dev_get_drvdata(&ofdev->dev); | 963 | struct fsl_elbc_ctrl *ctrl = dev_get_drvdata(&ofdev->dev); |
| 964 | int i; | 964 | int i; |
| @@ -1013,7 +1013,7 @@ static irqreturn_t fsl_elbc_ctrl_irq(int irqno, void *data) | |||
| 1013 | * in the chip probe function. | 1013 | * in the chip probe function. |
| 1014 | */ | 1014 | */ |
| 1015 | 1015 | ||
| 1016 | static int __devinit fsl_elbc_ctrl_probe(struct of_device *ofdev, | 1016 | static int __devinit fsl_elbc_ctrl_probe(struct platform_device *ofdev, |
| 1017 | const struct of_device_id *match) | 1017 | const struct of_device_id *match) |
| 1018 | { | 1018 | { |
| 1019 | struct device_node *child; | 1019 | struct device_node *child; |
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c index 1312eda57ba6..4eff8b25e5af 100644 --- a/drivers/mtd/nand/fsl_upm.c +++ b/drivers/mtd/nand/fsl_upm.c | |||
| @@ -217,7 +217,7 @@ err: | |||
| 217 | return ret; | 217 | return ret; |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | static int __devinit fun_probe(struct of_device *ofdev, | 220 | static int __devinit fun_probe(struct platform_device *ofdev, |
| 221 | const struct of_device_id *ofid) | 221 | const struct of_device_id *ofid) |
| 222 | { | 222 | { |
| 223 | struct fsl_upm_nand *fun; | 223 | struct fsl_upm_nand *fun; |
| @@ -335,7 +335,7 @@ err1: | |||
| 335 | return ret; | 335 | return ret; |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | static int __devexit fun_remove(struct of_device *ofdev) | 338 | static int __devexit fun_remove(struct platform_device *ofdev) |
| 339 | { | 339 | { |
| 340 | struct fsl_upm_nand *fun = dev_get_drvdata(&ofdev->dev); | 340 | struct fsl_upm_nand *fun = dev_get_drvdata(&ofdev->dev); |
| 341 | int i; | 341 | int i; |
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c index 0a130dcaa129..df0c1da4ff49 100644 --- a/drivers/mtd/nand/mpc5121_nfc.c +++ b/drivers/mtd/nand/mpc5121_nfc.c | |||
| @@ -647,7 +647,7 @@ static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd) | |||
| 647 | iounmap(prv->csreg); | 647 | iounmap(prv->csreg); |
| 648 | } | 648 | } |
| 649 | 649 | ||
| 650 | static int __devinit mpc5121_nfc_probe(struct of_device *op, | 650 | static int __devinit mpc5121_nfc_probe(struct platform_device *op, |
| 651 | const struct of_device_id *match) | 651 | const struct of_device_id *match) |
| 652 | { | 652 | { |
| 653 | struct device_node *rootnode, *dn = op->dev.of_node; | 653 | struct device_node *rootnode, *dn = op->dev.of_node; |
| @@ -869,7 +869,7 @@ error: | |||
| 869 | return retval; | 869 | return retval; |
| 870 | } | 870 | } |
| 871 | 871 | ||
| 872 | static int __devexit mpc5121_nfc_remove(struct of_device *op) | 872 | static int __devexit mpc5121_nfc_remove(struct platform_device *op) |
| 873 | { | 873 | { |
| 874 | struct device *dev = &op->dev; | 874 | struct device *dev = &op->dev; |
| 875 | struct mtd_info *mtd = dev_get_drvdata(dev); | 875 | struct mtd_info *mtd = dev_get_drvdata(dev); |
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index 98fd2bdf8be1..510554e6c115 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | struct ndfc_controller { | 37 | struct ndfc_controller { |
| 38 | struct of_device *ofdev; | 38 | struct platform_device *ofdev; |
| 39 | void __iomem *ndfcbase; | 39 | void __iomem *ndfcbase; |
| 40 | struct mtd_info mtd; | 40 | struct mtd_info mtd; |
| 41 | struct nand_chip chip; | 41 | struct nand_chip chip; |
| @@ -225,7 +225,7 @@ err: | |||
| 225 | return ret; | 225 | return ret; |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | static int __devinit ndfc_probe(struct of_device *ofdev, | 228 | static int __devinit ndfc_probe(struct platform_device *ofdev, |
| 229 | const struct of_device_id *match) | 229 | const struct of_device_id *match) |
| 230 | { | 230 | { |
| 231 | struct ndfc_controller *ndfc = &ndfc_ctrl; | 231 | struct ndfc_controller *ndfc = &ndfc_ctrl; |
| @@ -277,7 +277,7 @@ static int __devinit ndfc_probe(struct of_device *ofdev, | |||
| 277 | return 0; | 277 | return 0; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | static int __devexit ndfc_remove(struct of_device *ofdev) | 280 | static int __devexit ndfc_remove(struct platform_device *ofdev) |
| 281 | { | 281 | { |
| 282 | struct ndfc_controller *ndfc = dev_get_drvdata(&ofdev->dev); | 282 | struct ndfc_controller *ndfc = dev_get_drvdata(&ofdev->dev); |
| 283 | 283 | ||
diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c index f02af24d033a..6ddb2461d740 100644 --- a/drivers/mtd/nand/pasemi_nand.c +++ b/drivers/mtd/nand/pasemi_nand.c | |||
| @@ -89,7 +89,7 @@ int pasemi_device_ready(struct mtd_info *mtd) | |||
| 89 | return !!(inl(lpcctl) & LBICTRL_LPCCTL_NR); | 89 | return !!(inl(lpcctl) & LBICTRL_LPCCTL_NR); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | static int __devinit pasemi_nand_probe(struct of_device *ofdev, | 92 | static int __devinit pasemi_nand_probe(struct platform_device *ofdev, |
| 93 | const struct of_device_id *match) | 93 | const struct of_device_id *match) |
| 94 | { | 94 | { |
| 95 | struct pci_dev *pdev; | 95 | struct pci_dev *pdev; |
| @@ -185,7 +185,7 @@ static int __devinit pasemi_nand_probe(struct of_device *ofdev, | |||
| 185 | return err; | 185 | return err; |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | static int __devexit pasemi_nand_remove(struct of_device *ofdev) | 188 | static int __devexit pasemi_nand_remove(struct platform_device *ofdev) |
| 189 | { | 189 | { |
| 190 | struct nand_chip *chip; | 190 | struct nand_chip *chip; |
| 191 | 191 | ||
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c index cc728b12de82..a8e403eebedb 100644 --- a/drivers/mtd/nand/socrates_nand.c +++ b/drivers/mtd/nand/socrates_nand.c | |||
| @@ -162,7 +162,7 @@ static const char *part_probes[] = { "cmdlinepart", NULL }; | |||
| 162 | /* | 162 | /* |
| 163 | * Probe for the NAND device. | 163 | * Probe for the NAND device. |
| 164 | */ | 164 | */ |
| 165 | static int __devinit socrates_nand_probe(struct of_device *ofdev, | 165 | static int __devinit socrates_nand_probe(struct platform_device *ofdev, |
| 166 | const struct of_device_id *ofid) | 166 | const struct of_device_id *ofid) |
| 167 | { | 167 | { |
| 168 | struct socrates_nand_host *host; | 168 | struct socrates_nand_host *host; |
| @@ -276,7 +276,7 @@ out: | |||
| 276 | /* | 276 | /* |
| 277 | * Remove a NAND device. | 277 | * Remove a NAND device. |
| 278 | */ | 278 | */ |
| 279 | static int __devexit socrates_nand_remove(struct of_device *ofdev) | 279 | static int __devexit socrates_nand_remove(struct platform_device *ofdev) |
| 280 | { | 280 | { |
| 281 | struct socrates_nand_host *host = dev_get_drvdata(&ofdev->dev); | 281 | struct socrates_nand_host *host = dev_get_drvdata(&ofdev->dev); |
| 282 | struct mtd_info *mtd = &host->mtd; | 282 | struct mtd_info *mtd = &host->mtd; |
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c index af753936e835..b1bdc909090f 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c | |||
| @@ -38,7 +38,7 @@ | |||
| 38 | 38 | ||
| 39 | struct mpc5xxx_can_data { | 39 | struct mpc5xxx_can_data { |
| 40 | unsigned int type; | 40 | unsigned int type; |
| 41 | u32 (*get_clock)(struct of_device *ofdev, const char *clock_name, | 41 | u32 (*get_clock)(struct platform_device *ofdev, const char *clock_name, |
| 42 | int *mscan_clksrc); | 42 | int *mscan_clksrc); |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| @@ -48,7 +48,7 @@ static struct of_device_id __devinitdata mpc52xx_cdm_ids[] = { | |||
| 48 | {} | 48 | {} |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | static u32 __devinit mpc52xx_can_get_clock(struct of_device *ofdev, | 51 | static u32 __devinit mpc52xx_can_get_clock(struct platform_device *ofdev, |
| 52 | const char *clock_name, | 52 | const char *clock_name, |
| 53 | int *mscan_clksrc) | 53 | int *mscan_clksrc) |
| 54 | { | 54 | { |
| @@ -101,7 +101,7 @@ static u32 __devinit mpc52xx_can_get_clock(struct of_device *ofdev, | |||
| 101 | return freq; | 101 | return freq; |
| 102 | } | 102 | } |
| 103 | #else /* !CONFIG_PPC_MPC52xx */ | 103 | #else /* !CONFIG_PPC_MPC52xx */ |
| 104 | static u32 __devinit mpc52xx_can_get_clock(struct of_device *ofdev, | 104 | static u32 __devinit mpc52xx_can_get_clock(struct platform_device *ofdev, |
| 105 | const char *clock_name, | 105 | const char *clock_name, |
| 106 | int *mscan_clksrc) | 106 | int *mscan_clksrc) |
| 107 | { | 107 | { |
| @@ -129,7 +129,7 @@ static struct of_device_id __devinitdata mpc512x_clock_ids[] = { | |||
| 129 | {} | 129 | {} |
| 130 | }; | 130 | }; |
| 131 | 131 | ||
| 132 | static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev, | 132 | static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, |
| 133 | const char *clock_name, | 133 | const char *clock_name, |
| 134 | int *mscan_clksrc) | 134 | int *mscan_clksrc) |
| 135 | { | 135 | { |
| @@ -239,7 +239,7 @@ exit_unmap: | |||
| 239 | return freq; | 239 | return freq; |
| 240 | } | 240 | } |
| 241 | #else /* !CONFIG_PPC_MPC512x */ | 241 | #else /* !CONFIG_PPC_MPC512x */ |
| 242 | static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev, | 242 | static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, |
| 243 | const char *clock_name, | 243 | const char *clock_name, |
| 244 | int *mscan_clksrc) | 244 | int *mscan_clksrc) |
| 245 | { | 245 | { |
| @@ -247,7 +247,7 @@ static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev, | |||
| 247 | } | 247 | } |
| 248 | #endif /* CONFIG_PPC_MPC512x */ | 248 | #endif /* CONFIG_PPC_MPC512x */ |
| 249 | 249 | ||
| 250 | static int __devinit mpc5xxx_can_probe(struct of_device *ofdev, | 250 | static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev, |
| 251 | const struct of_device_id *id) | 251 | const struct of_device_id *id) |
| 252 | { | 252 | { |
| 253 | struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data; | 253 | struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data; |
| @@ -317,7 +317,7 @@ exit_unmap_mem: | |||
| 317 | return err; | 317 | return err; |
| 318 | } | 318 | } |
| 319 | 319 | ||
| 320 | static int __devexit mpc5xxx_can_remove(struct of_device *ofdev) | 320 | static int __devexit mpc5xxx_can_remove(struct platform_device *ofdev) |
| 321 | { | 321 | { |
| 322 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); | 322 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); |
| 323 | struct mscan_priv *priv = netdev_priv(dev); | 323 | struct mscan_priv *priv = netdev_priv(dev); |
| @@ -334,7 +334,7 @@ static int __devexit mpc5xxx_can_remove(struct of_device *ofdev) | |||
| 334 | 334 | ||
| 335 | #ifdef CONFIG_PM | 335 | #ifdef CONFIG_PM |
| 336 | static struct mscan_regs saved_regs; | 336 | static struct mscan_regs saved_regs; |
| 337 | static int mpc5xxx_can_suspend(struct of_device *ofdev, pm_message_t state) | 337 | static int mpc5xxx_can_suspend(struct platform_device *ofdev, pm_message_t state) |
| 338 | { | 338 | { |
| 339 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); | 339 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); |
| 340 | struct mscan_priv *priv = netdev_priv(dev); | 340 | struct mscan_priv *priv = netdev_priv(dev); |
| @@ -345,7 +345,7 @@ static int mpc5xxx_can_suspend(struct of_device *ofdev, pm_message_t state) | |||
| 345 | return 0; | 345 | return 0; |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | static int mpc5xxx_can_resume(struct of_device *ofdev) | 348 | static int mpc5xxx_can_resume(struct platform_device *ofdev) |
| 349 | { | 349 | { |
| 350 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); | 350 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); |
| 351 | struct mscan_priv *priv = netdev_priv(dev); | 351 | struct mscan_priv *priv = netdev_priv(dev); |
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c index ac1a83d7c204..5bfccfdf3bbb 100644 --- a/drivers/net/can/sja1000/sja1000_of_platform.c +++ b/drivers/net/can/sja1000/sja1000_of_platform.c | |||
| @@ -67,7 +67,7 @@ static void sja1000_ofp_write_reg(const struct sja1000_priv *priv, | |||
| 67 | out_8(priv->reg_base + reg, val); | 67 | out_8(priv->reg_base + reg, val); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | static int __devexit sja1000_ofp_remove(struct of_device *ofdev) | 70 | static int __devexit sja1000_ofp_remove(struct platform_device *ofdev) |
| 71 | { | 71 | { |
| 72 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); | 72 | struct net_device *dev = dev_get_drvdata(&ofdev->dev); |
| 73 | struct sja1000_priv *priv = netdev_priv(dev); | 73 | struct sja1000_priv *priv = netdev_priv(dev); |
| @@ -87,7 +87,7 @@ static int __devexit sja1000_ofp_remove(struct of_device *ofdev) | |||
| 87 | return 0; | 87 | return 0; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | static int __devinit sja1000_ofp_probe(struct of_device *ofdev, | 90 | static int __devinit sja1000_ofp_probe(struct platform_device *ofdev, |
| 91 | const struct of_device_id *id) | 91 | const struct of_device_id *id) |
| 92 | { | 92 | { |
| 93 | struct device_node *np = ofdev->dev.of_node; | 93 | struct device_node *np = ofdev->dev.of_node; |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 0060e422f171..99a929964e3c 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
| @@ -413,7 +413,7 @@ struct ehea_port_res { | |||
| 413 | 413 | ||
| 414 | struct ehea_adapter { | 414 | struct ehea_adapter { |
| 415 | u64 handle; | 415 | u64 handle; |
| 416 | struct of_device *ofdev; | 416 | struct platform_device *ofdev; |
| 417 | struct ehea_port *port[EHEA_MAX_PORTS]; | 417 | struct ehea_port *port[EHEA_MAX_PORTS]; |
| 418 | struct ehea_eq *neq; /* notification event queue */ | 418 | struct ehea_eq *neq; /* notification event queue */ |
| 419 | struct tasklet_struct neq_tasklet; | 419 | struct tasklet_struct neq_tasklet; |
| @@ -465,7 +465,7 @@ struct ehea_port { | |||
| 465 | struct net_device *netdev; | 465 | struct net_device *netdev; |
| 466 | struct net_device_stats stats; | 466 | struct net_device_stats stats; |
| 467 | struct ehea_port_res port_res[EHEA_MAX_PORT_RES]; | 467 | struct ehea_port_res port_res[EHEA_MAX_PORT_RES]; |
| 468 | struct of_device ofdev; /* Open Firmware Device */ | 468 | struct platform_device ofdev; /* Open Firmware Device */ |
| 469 | struct ehea_mc_list *mc_list; /* Multicast MAC addresses */ | 469 | struct ehea_mc_list *mc_list; /* Multicast MAC addresses */ |
| 470 | struct vlan_group *vgrp; | 470 | struct vlan_group *vgrp; |
| 471 | struct ehea_eq *qp_eq; | 471 | struct ehea_eq *qp_eq; |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 3beba70b7dea..897719b49f96 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
| @@ -107,10 +107,10 @@ struct ehea_fw_handle_array ehea_fw_handles; | |||
| 107 | struct ehea_bcmc_reg_array ehea_bcmc_regs; | 107 | struct ehea_bcmc_reg_array ehea_bcmc_regs; |
| 108 | 108 | ||
| 109 | 109 | ||
| 110 | static int __devinit ehea_probe_adapter(struct of_device *dev, | 110 | static int __devinit ehea_probe_adapter(struct platform_device *dev, |
| 111 | const struct of_device_id *id); | 111 | const struct of_device_id *id); |
| 112 | 112 | ||
| 113 | static int __devexit ehea_remove(struct of_device *dev); | 113 | static int __devexit ehea_remove(struct platform_device *dev); |
| 114 | 114 | ||
| 115 | static struct of_device_id ehea_device_table[] = { | 115 | static struct of_device_id ehea_device_table[] = { |
| 116 | { | 116 | { |
| @@ -3376,7 +3376,7 @@ static ssize_t ehea_remove_port(struct device *dev, | |||
| 3376 | static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port); | 3376 | static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port); |
| 3377 | static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port); | 3377 | static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port); |
| 3378 | 3378 | ||
| 3379 | int ehea_create_device_sysfs(struct of_device *dev) | 3379 | int ehea_create_device_sysfs(struct platform_device *dev) |
| 3380 | { | 3380 | { |
| 3381 | int ret = device_create_file(&dev->dev, &dev_attr_probe_port); | 3381 | int ret = device_create_file(&dev->dev, &dev_attr_probe_port); |
| 3382 | if (ret) | 3382 | if (ret) |
| @@ -3387,13 +3387,13 @@ out: | |||
| 3387 | return ret; | 3387 | return ret; |
| 3388 | } | 3388 | } |
| 3389 | 3389 | ||
| 3390 | void ehea_remove_device_sysfs(struct of_device *dev) | 3390 | void ehea_remove_device_sysfs(struct platform_device *dev) |
| 3391 | { | 3391 | { |
| 3392 | device_remove_file(&dev->dev, &dev_attr_probe_port); | 3392 | device_remove_file(&dev->dev, &dev_attr_probe_port); |
| 3393 | device_remove_file(&dev->dev, &dev_attr_remove_port); | 3393 | device_remove_file(&dev->dev, &dev_attr_remove_port); |
| 3394 | } | 3394 | } |
| 3395 | 3395 | ||
| 3396 | static int __devinit ehea_probe_adapter(struct of_device *dev, | 3396 | static int __devinit ehea_probe_adapter(struct platform_device *dev, |
| 3397 | const struct of_device_id *id) | 3397 | const struct of_device_id *id) |
| 3398 | { | 3398 | { |
| 3399 | struct ehea_adapter *adapter; | 3399 | struct ehea_adapter *adapter; |
| @@ -3492,7 +3492,7 @@ out: | |||
| 3492 | return ret; | 3492 | return ret; |
| 3493 | } | 3493 | } |
| 3494 | 3494 | ||
| 3495 | static int __devexit ehea_remove(struct of_device *dev) | 3495 | static int __devexit ehea_remove(struct platform_device *dev) |
| 3496 | { | 3496 | { |
| 3497 | struct ehea_adapter *adapter = dev_get_drvdata(&dev->dev); | 3497 | struct ehea_adapter *adapter = dev_get_drvdata(&dev->dev); |
| 3498 | int i; | 3498 | int i; |
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c index d1a5b17b2a95..e3e10b4add9c 100644 --- a/drivers/net/fec_mpc52xx.c +++ b/drivers/net/fec_mpc52xx.c | |||
| @@ -850,7 +850,7 @@ static const struct net_device_ops mpc52xx_fec_netdev_ops = { | |||
| 850 | /* ======================================================================== */ | 850 | /* ======================================================================== */ |
| 851 | 851 | ||
| 852 | static int __devinit | 852 | static int __devinit |
| 853 | mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) | 853 | mpc52xx_fec_probe(struct platform_device *op, const struct of_device_id *match) |
| 854 | { | 854 | { |
| 855 | int rv; | 855 | int rv; |
| 856 | struct net_device *ndev; | 856 | struct net_device *ndev; |
| @@ -995,7 +995,7 @@ err_netdev: | |||
| 995 | } | 995 | } |
| 996 | 996 | ||
| 997 | static int | 997 | static int |
| 998 | mpc52xx_fec_remove(struct of_device *op) | 998 | mpc52xx_fec_remove(struct platform_device *op) |
| 999 | { | 999 | { |
| 1000 | struct net_device *ndev; | 1000 | struct net_device *ndev; |
| 1001 | struct mpc52xx_fec_priv *priv; | 1001 | struct mpc52xx_fec_priv *priv; |
| @@ -1025,7 +1025,7 @@ mpc52xx_fec_remove(struct of_device *op) | |||
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| 1027 | #ifdef CONFIG_PM | 1027 | #ifdef CONFIG_PM |
| 1028 | static int mpc52xx_fec_of_suspend(struct of_device *op, pm_message_t state) | 1028 | static int mpc52xx_fec_of_suspend(struct platform_device *op, pm_message_t state) |
| 1029 | { | 1029 | { |
| 1030 | struct net_device *dev = dev_get_drvdata(&op->dev); | 1030 | struct net_device *dev = dev_get_drvdata(&op->dev); |
| 1031 | 1031 | ||
| @@ -1035,7 +1035,7 @@ static int mpc52xx_fec_of_suspend(struct of_device *op, pm_message_t state) | |||
| 1035 | return 0; | 1035 | return 0; |
| 1036 | } | 1036 | } |
| 1037 | 1037 | ||
| 1038 | static int mpc52xx_fec_of_resume(struct of_device *op) | 1038 | static int mpc52xx_fec_of_resume(struct platform_device *op) |
| 1039 | { | 1039 | { |
| 1040 | struct net_device *dev = dev_get_drvdata(&op->dev); | 1040 | struct net_device *dev = dev_get_drvdata(&op->dev); |
| 1041 | 1041 | ||
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c index dbaf72cbb233..0b4cb6f15984 100644 --- a/drivers/net/fec_mpc52xx_phy.c +++ b/drivers/net/fec_mpc52xx_phy.c | |||
| @@ -61,7 +61,7 @@ static int mpc52xx_fec_mdio_write(struct mii_bus *bus, int phy_id, int reg, | |||
| 61 | data | FEC_MII_WRITE_FRAME); | 61 | data | FEC_MII_WRITE_FRAME); |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | static int mpc52xx_fec_mdio_probe(struct of_device *of, | 64 | static int mpc52xx_fec_mdio_probe(struct platform_device *of, |
| 65 | const struct of_device_id *match) | 65 | const struct of_device_id *match) |
| 66 | { | 66 | { |
| 67 | struct device *dev = &of->dev; | 67 | struct device *dev = &of->dev; |
| @@ -122,7 +122,7 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of, | |||
| 122 | return err; | 122 | return err; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | static int mpc52xx_fec_mdio_remove(struct of_device *of) | 125 | static int mpc52xx_fec_mdio_remove(struct platform_device *of) |
| 126 | { | 126 | { |
| 127 | struct device *dev = &of->dev; | 127 | struct device *dev = &of->dev; |
| 128 | struct mii_bus *bus = dev_get_drvdata(dev); | 128 | struct mii_bus *bus = dev_get_drvdata(dev); |
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index f08cff9020bd..d6e3111959ab 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
| @@ -997,7 +997,7 @@ static const struct net_device_ops fs_enet_netdev_ops = { | |||
| 997 | #endif | 997 | #endif |
| 998 | }; | 998 | }; |
| 999 | 999 | ||
| 1000 | static int __devinit fs_enet_probe(struct of_device *ofdev, | 1000 | static int __devinit fs_enet_probe(struct platform_device *ofdev, |
| 1001 | const struct of_device_id *match) | 1001 | const struct of_device_id *match) |
| 1002 | { | 1002 | { |
| 1003 | struct net_device *ndev; | 1003 | struct net_device *ndev; |
| @@ -1105,7 +1105,7 @@ out_free_fpi: | |||
| 1105 | return ret; | 1105 | return ret; |
| 1106 | } | 1106 | } |
| 1107 | 1107 | ||
| 1108 | static int fs_enet_remove(struct of_device *ofdev) | 1108 | static int fs_enet_remove(struct platform_device *ofdev) |
| 1109 | { | 1109 | { |
| 1110 | struct net_device *ndev = dev_get_drvdata(&ofdev->dev); | 1110 | struct net_device *ndev = dev_get_drvdata(&ofdev->dev); |
| 1111 | struct fs_enet_private *fep = netdev_priv(ndev); | 1111 | struct fs_enet_private *fep = netdev_priv(ndev); |
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c index 48e91b6242ce..7a84e45487e8 100644 --- a/drivers/net/fs_enet/mac-fcc.c +++ b/drivers/net/fs_enet/mac-fcc.c | |||
| @@ -84,7 +84,7 @@ static inline int fcc_cr_cmd(struct fs_enet_private *fep, u32 op) | |||
| 84 | 84 | ||
| 85 | static int do_pd_setup(struct fs_enet_private *fep) | 85 | static int do_pd_setup(struct fs_enet_private *fep) |
| 86 | { | 86 | { |
| 87 | struct of_device *ofdev = to_of_device(fep->dev); | 87 | struct platform_device *ofdev = to_platform_device(fep->dev); |
| 88 | struct fs_platform_info *fpi = fep->fpi; | 88 | struct fs_platform_info *fpi = fep->fpi; |
| 89 | int ret = -EINVAL; | 89 | int ret = -EINVAL; |
| 90 | 90 | ||
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c index 7ca1642276d0..61035fc5599b 100644 --- a/drivers/net/fs_enet/mac-fec.c +++ b/drivers/net/fs_enet/mac-fec.c | |||
| @@ -96,7 +96,7 @@ static int whack_reset(struct fec __iomem *fecp) | |||
| 96 | 96 | ||
| 97 | static int do_pd_setup(struct fs_enet_private *fep) | 97 | static int do_pd_setup(struct fs_enet_private *fep) |
| 98 | { | 98 | { |
| 99 | struct of_device *ofdev = to_of_device(fep->dev); | 99 | struct platform_device *ofdev = to_platform_device(fep->dev); |
| 100 | 100 | ||
| 101 | fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); | 101 | fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); |
| 102 | if (fep->interrupt == NO_IRQ) | 102 | if (fep->interrupt == NO_IRQ) |
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c index a3c44544846d..22a02a767069 100644 --- a/drivers/net/fs_enet/mac-scc.c +++ b/drivers/net/fs_enet/mac-scc.c | |||
| @@ -96,7 +96,7 @@ static inline int scc_cr_cmd(struct fs_enet_private *fep, u32 op) | |||
| 96 | 96 | ||
| 97 | static int do_pd_setup(struct fs_enet_private *fep) | 97 | static int do_pd_setup(struct fs_enet_private *fep) |
| 98 | { | 98 | { |
| 99 | struct of_device *ofdev = to_of_device(fep->dev); | 99 | struct platform_device *ofdev = to_platform_device(fep->dev); |
| 100 | 100 | ||
| 101 | fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); | 101 | fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); |
| 102 | if (fep->interrupt == NO_IRQ) | 102 | if (fep->interrupt == NO_IRQ) |
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c index 3607340f3da7..3cda2b515471 100644 --- a/drivers/net/fs_enet/mii-bitbang.c +++ b/drivers/net/fs_enet/mii-bitbang.c | |||
| @@ -150,7 +150,7 @@ static int __devinit fs_mii_bitbang_init(struct mii_bus *bus, | |||
| 150 | return 0; | 150 | return 0; |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, | 153 | static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev, |
| 154 | const struct of_device_id *match) | 154 | const struct of_device_id *match) |
| 155 | { | 155 | { |
| 156 | struct mii_bus *new_bus; | 156 | struct mii_bus *new_bus; |
| @@ -200,7 +200,7 @@ out: | |||
| 200 | return ret; | 200 | return ret; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | static int fs_enet_mdio_remove(struct of_device *ofdev) | 203 | static int fs_enet_mdio_remove(struct platform_device *ofdev) |
| 204 | { | 204 | { |
| 205 | struct mii_bus *bus = dev_get_drvdata(&ofdev->dev); | 205 | struct mii_bus *bus = dev_get_drvdata(&ofdev->dev); |
| 206 | struct bb_info *bitbang = bus->priv; | 206 | struct bb_info *bitbang = bus->priv; |
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c index bddffd169b93..dbb9c48623df 100644 --- a/drivers/net/fs_enet/mii-fec.c +++ b/drivers/net/fs_enet/mii-fec.c | |||
| @@ -101,7 +101,7 @@ static int fs_enet_fec_mii_reset(struct mii_bus *bus) | |||
| 101 | return 0; | 101 | return 0; |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, | 104 | static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev, |
| 105 | const struct of_device_id *match) | 105 | const struct of_device_id *match) |
| 106 | { | 106 | { |
| 107 | struct resource res; | 107 | struct resource res; |
| @@ -192,7 +192,7 @@ out: | |||
| 192 | return ret; | 192 | return ret; |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | static int fs_enet_mdio_remove(struct of_device *ofdev) | 195 | static int fs_enet_mdio_remove(struct platform_device *ofdev) |
| 196 | { | 196 | { |
| 197 | struct mii_bus *bus = dev_get_drvdata(&ofdev->dev); | 197 | struct mii_bus *bus = dev_get_drvdata(&ofdev->dev); |
| 198 | struct fec_info *fec = bus->priv; | 198 | struct fec_info *fec = bus->priv; |
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c index f53f850b6418..d4bf91aac25f 100644 --- a/drivers/net/fsl_pq_mdio.c +++ b/drivers/net/fsl_pq_mdio.c | |||
| @@ -265,7 +265,7 @@ static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id) | |||
| 265 | #endif | 265 | #endif |
| 266 | 266 | ||
| 267 | 267 | ||
| 268 | static int fsl_pq_mdio_probe(struct of_device *ofdev, | 268 | static int fsl_pq_mdio_probe(struct platform_device *ofdev, |
| 269 | const struct of_device_id *match) | 269 | const struct of_device_id *match) |
| 270 | { | 270 | { |
| 271 | struct device_node *np = ofdev->dev.of_node; | 271 | struct device_node *np = ofdev->dev.of_node; |
| @@ -425,7 +425,7 @@ err_free_priv: | |||
| 425 | } | 425 | } |
| 426 | 426 | ||
| 427 | 427 | ||
| 428 | static int fsl_pq_mdio_remove(struct of_device *ofdev) | 428 | static int fsl_pq_mdio_remove(struct platform_device *ofdev) |
| 429 | { | 429 | { |
| 430 | struct device *device = &ofdev->dev; | 430 | struct device *device = &ofdev->dev; |
| 431 | struct mii_bus *bus = dev_get_drvdata(device); | 431 | struct mii_bus *bus = dev_get_drvdata(device); |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index a1b6301bc674..4f7c3f3ca234 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
| @@ -122,9 +122,9 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id); | |||
| 122 | static void adjust_link(struct net_device *dev); | 122 | static void adjust_link(struct net_device *dev); |
| 123 | static void init_registers(struct net_device *dev); | 123 | static void init_registers(struct net_device *dev); |
| 124 | static int init_phy(struct net_device *dev); | 124 | static int init_phy(struct net_device *dev); |
| 125 | static int gfar_probe(struct of_device *ofdev, | 125 | static int gfar_probe(struct platform_device *ofdev, |
| 126 | const struct of_device_id *match); | 126 | const struct of_device_id *match); |
| 127 | static int gfar_remove(struct of_device *ofdev); | 127 | static int gfar_remove(struct platform_device *ofdev); |
| 128 | static void free_skb_resources(struct gfar_private *priv); | 128 | static void free_skb_resources(struct gfar_private *priv); |
| 129 | static void gfar_set_multi(struct net_device *dev); | 129 | static void gfar_set_multi(struct net_device *dev); |
| 130 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); | 130 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); |
| @@ -605,7 +605,7 @@ static int gfar_parse_group(struct device_node *np, | |||
| 605 | return 0; | 605 | return 0; |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev) | 608 | static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) |
| 609 | { | 609 | { |
| 610 | const char *model; | 610 | const char *model; |
| 611 | const char *ctype; | 611 | const char *ctype; |
| @@ -959,7 +959,7 @@ static void gfar_detect_errata(struct gfar_private *priv) | |||
| 959 | 959 | ||
| 960 | /* Set up the ethernet device structure, private data, | 960 | /* Set up the ethernet device structure, private data, |
| 961 | * and anything else we need before we start */ | 961 | * and anything else we need before we start */ |
| 962 | static int gfar_probe(struct of_device *ofdev, | 962 | static int gfar_probe(struct platform_device *ofdev, |
| 963 | const struct of_device_id *match) | 963 | const struct of_device_id *match) |
| 964 | { | 964 | { |
| 965 | u32 tempval; | 965 | u32 tempval; |
| @@ -1238,7 +1238,7 @@ register_fail: | |||
| 1238 | return err; | 1238 | return err; |
| 1239 | } | 1239 | } |
| 1240 | 1240 | ||
| 1241 | static int gfar_remove(struct of_device *ofdev) | 1241 | static int gfar_remove(struct platform_device *ofdev) |
| 1242 | { | 1242 | { |
| 1243 | struct gfar_private *priv = dev_get_drvdata(&ofdev->dev); | 1243 | struct gfar_private *priv = dev_get_drvdata(&ofdev->dev); |
| 1244 | 1244 | ||
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index 710810e2adb4..68984eb88ae0 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
| @@ -1054,7 +1054,7 @@ struct gfar_private { | |||
| 1054 | 1054 | ||
| 1055 | struct device_node *node; | 1055 | struct device_node *node; |
| 1056 | struct net_device *ndev; | 1056 | struct net_device *ndev; |
| 1057 | struct of_device *ofdev; | 1057 | struct platform_device *ofdev; |
| 1058 | enum gfar_errata errata; | 1058 | enum gfar_errata errata; |
| 1059 | 1059 | ||
| 1060 | struct gfar_priv_grp gfargrp[MAXGROUPS]; | 1060 | struct gfar_priv_grp gfargrp[MAXGROUPS]; |
diff --git a/drivers/net/greth.c b/drivers/net/greth.c index 4d09eab3548e..f15c64f1cd38 100644 --- a/drivers/net/greth.c +++ b/drivers/net/greth.c | |||
| @@ -1373,7 +1373,7 @@ error: | |||
| 1373 | } | 1373 | } |
| 1374 | 1374 | ||
| 1375 | /* Initialize the GRETH MAC */ | 1375 | /* Initialize the GRETH MAC */ |
| 1376 | static int __devinit greth_of_probe(struct of_device *ofdev, const struct of_device_id *match) | 1376 | static int __devinit greth_of_probe(struct platform_device *ofdev, const struct of_device_id *match) |
| 1377 | { | 1377 | { |
| 1378 | struct net_device *dev; | 1378 | struct net_device *dev; |
| 1379 | struct greth_private *greth; | 1379 | struct greth_private *greth; |
| @@ -1412,7 +1412,7 @@ static int __devinit greth_of_probe(struct of_device *ofdev, const struct of_dev | |||
| 1412 | } | 1412 | } |
| 1413 | 1413 | ||
| 1414 | regs = (struct greth_regs *) greth->regs; | 1414 | regs = (struct greth_regs *) greth->regs; |
| 1415 | greth->irq = ofdev->irqs[0]; | 1415 | greth->irq = ofdev->archdata.irqs[0]; |
| 1416 | 1416 | ||
| 1417 | dev_set_drvdata(greth->dev, dev); | 1417 | dev_set_drvdata(greth->dev, dev); |
| 1418 | SET_NETDEV_DEV(dev, greth->dev); | 1418 | SET_NETDEV_DEV(dev, greth->dev); |
| @@ -1572,7 +1572,7 @@ error1: | |||
| 1572 | return err; | 1572 | return err; |
| 1573 | } | 1573 | } |
| 1574 | 1574 | ||
| 1575 | static int __devexit greth_of_remove(struct of_device *of_dev) | 1575 | static int __devexit greth_of_remove(struct platform_device *of_dev) |
| 1576 | { | 1576 | { |
| 1577 | struct net_device *ndev = dev_get_drvdata(&of_dev->dev); | 1577 | struct net_device *ndev = dev_get_drvdata(&of_dev->dev); |
| 1578 | struct greth_private *greth = netdev_priv(ndev); | 1578 | struct greth_private *greth = netdev_priv(ndev); |
diff --git a/drivers/net/greth.h b/drivers/net/greth.h index 973388d6abca..03ad903cd676 100644 --- a/drivers/net/greth.h +++ b/drivers/net/greth.h | |||
| @@ -118,7 +118,7 @@ struct greth_private { | |||
| 118 | 118 | ||
| 119 | int irq; | 119 | int irq; |
| 120 | 120 | ||
| 121 | struct device *dev; /* Pointer to of_device->dev */ | 121 | struct device *dev; /* Pointer to platform_device->dev */ |
| 122 | struct net_device *netdev; | 122 | struct net_device *netdev; |
| 123 | struct napi_struct napi; | 123 | struct napi_struct napi; |
| 124 | spinlock_t devlock; | 124 | spinlock_t devlock; |
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index eeec7bc2ce74..3506fd6ad726 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
| @@ -2245,7 +2245,7 @@ static int emac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd) | |||
| 2245 | struct emac_depentry { | 2245 | struct emac_depentry { |
| 2246 | u32 phandle; | 2246 | u32 phandle; |
| 2247 | struct device_node *node; | 2247 | struct device_node *node; |
| 2248 | struct of_device *ofdev; | 2248 | struct platform_device *ofdev; |
| 2249 | void *drvdata; | 2249 | void *drvdata; |
| 2250 | }; | 2250 | }; |
| 2251 | 2251 | ||
| @@ -2719,7 +2719,7 @@ static const struct net_device_ops emac_gige_netdev_ops = { | |||
| 2719 | .ndo_change_mtu = emac_change_mtu, | 2719 | .ndo_change_mtu = emac_change_mtu, |
| 2720 | }; | 2720 | }; |
| 2721 | 2721 | ||
| 2722 | static int __devinit emac_probe(struct of_device *ofdev, | 2722 | static int __devinit emac_probe(struct platform_device *ofdev, |
| 2723 | const struct of_device_id *match) | 2723 | const struct of_device_id *match) |
| 2724 | { | 2724 | { |
| 2725 | struct net_device *ndev; | 2725 | struct net_device *ndev; |
| @@ -2941,7 +2941,7 @@ static int __devinit emac_probe(struct of_device *ofdev, | |||
| 2941 | return err; | 2941 | return err; |
| 2942 | } | 2942 | } |
| 2943 | 2943 | ||
| 2944 | static int __devexit emac_remove(struct of_device *ofdev) | 2944 | static int __devexit emac_remove(struct platform_device *ofdev) |
| 2945 | { | 2945 | { |
| 2946 | struct emac_instance *dev = dev_get_drvdata(&ofdev->dev); | 2946 | struct emac_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 2947 | 2947 | ||
diff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h index b1cbe6fdfc7a..9e37e3d9c51d 100644 --- a/drivers/net/ibm_newemac/core.h +++ b/drivers/net/ibm_newemac/core.h | |||
| @@ -170,12 +170,12 @@ struct emac_instance { | |||
| 170 | struct net_device *ndev; | 170 | struct net_device *ndev; |
| 171 | struct resource rsrc_regs; | 171 | struct resource rsrc_regs; |
| 172 | struct emac_regs __iomem *emacp; | 172 | struct emac_regs __iomem *emacp; |
| 173 | struct of_device *ofdev; | 173 | struct platform_device *ofdev; |
| 174 | struct device_node **blist; /* bootlist entry */ | 174 | struct device_node **blist; /* bootlist entry */ |
| 175 | 175 | ||
| 176 | /* MAL linkage */ | 176 | /* MAL linkage */ |
| 177 | u32 mal_ph; | 177 | u32 mal_ph; |
| 178 | struct of_device *mal_dev; | 178 | struct platform_device *mal_dev; |
| 179 | u32 mal_rx_chan; | 179 | u32 mal_rx_chan; |
| 180 | u32 mal_tx_chan; | 180 | u32 mal_tx_chan; |
| 181 | struct mal_instance *mal; | 181 | struct mal_instance *mal; |
| @@ -196,24 +196,24 @@ struct emac_instance { | |||
| 196 | 196 | ||
| 197 | /* Shared MDIO if any */ | 197 | /* Shared MDIO if any */ |
| 198 | u32 mdio_ph; | 198 | u32 mdio_ph; |
| 199 | struct of_device *mdio_dev; | 199 | struct platform_device *mdio_dev; |
| 200 | struct emac_instance *mdio_instance; | 200 | struct emac_instance *mdio_instance; |
| 201 | struct mutex mdio_lock; | 201 | struct mutex mdio_lock; |
| 202 | 202 | ||
| 203 | /* ZMII infos if any */ | 203 | /* ZMII infos if any */ |
| 204 | u32 zmii_ph; | 204 | u32 zmii_ph; |
| 205 | u32 zmii_port; | 205 | u32 zmii_port; |
| 206 | struct of_device *zmii_dev; | 206 | struct platform_device *zmii_dev; |
| 207 | 207 | ||
| 208 | /* RGMII infos if any */ | 208 | /* RGMII infos if any */ |
| 209 | u32 rgmii_ph; | 209 | u32 rgmii_ph; |
| 210 | u32 rgmii_port; | 210 | u32 rgmii_port; |
| 211 | struct of_device *rgmii_dev; | 211 | struct platform_device *rgmii_dev; |
| 212 | 212 | ||
| 213 | /* TAH infos if any */ | 213 | /* TAH infos if any */ |
| 214 | u32 tah_ph; | 214 | u32 tah_ph; |
| 215 | u32 tah_port; | 215 | u32 tah_port; |
| 216 | struct of_device *tah_dev; | 216 | struct platform_device *tah_dev; |
| 217 | 217 | ||
| 218 | /* IRQs */ | 218 | /* IRQs */ |
| 219 | int wol_irq; | 219 | int wol_irq; |
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c index fcff9e0bd382..d5717e2123e1 100644 --- a/drivers/net/ibm_newemac/mal.c +++ b/drivers/net/ibm_newemac/mal.c | |||
| @@ -517,7 +517,7 @@ void *mal_dump_regs(struct mal_instance *mal, void *buf) | |||
| 517 | return regs + 1; | 517 | return regs + 1; |
| 518 | } | 518 | } |
| 519 | 519 | ||
| 520 | static int __devinit mal_probe(struct of_device *ofdev, | 520 | static int __devinit mal_probe(struct platform_device *ofdev, |
| 521 | const struct of_device_id *match) | 521 | const struct of_device_id *match) |
| 522 | { | 522 | { |
| 523 | struct mal_instance *mal; | 523 | struct mal_instance *mal; |
| @@ -730,7 +730,7 @@ static int __devinit mal_probe(struct of_device *ofdev, | |||
| 730 | return err; | 730 | return err; |
| 731 | } | 731 | } |
| 732 | 732 | ||
| 733 | static int __devexit mal_remove(struct of_device *ofdev) | 733 | static int __devexit mal_remove(struct platform_device *ofdev) |
| 734 | { | 734 | { |
| 735 | struct mal_instance *mal = dev_get_drvdata(&ofdev->dev); | 735 | struct mal_instance *mal = dev_get_drvdata(&ofdev->dev); |
| 736 | 736 | ||
diff --git a/drivers/net/ibm_newemac/mal.h b/drivers/net/ibm_newemac/mal.h index 9ededfbf0726..66084214bf45 100644 --- a/drivers/net/ibm_newemac/mal.h +++ b/drivers/net/ibm_newemac/mal.h | |||
| @@ -210,7 +210,7 @@ struct mal_instance { | |||
| 210 | dma_addr_t bd_dma; | 210 | dma_addr_t bd_dma; |
| 211 | struct mal_descriptor *bd_virt; | 211 | struct mal_descriptor *bd_virt; |
| 212 | 212 | ||
| 213 | struct of_device *ofdev; | 213 | struct platform_device *ofdev; |
| 214 | int index; | 214 | int index; |
| 215 | spinlock_t lock; | 215 | spinlock_t lock; |
| 216 | 216 | ||
diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c index 108919bcdf13..dd61798897ac 100644 --- a/drivers/net/ibm_newemac/rgmii.c +++ b/drivers/net/ibm_newemac/rgmii.c | |||
| @@ -93,7 +93,7 @@ static inline u32 rgmii_mode_mask(int mode, int input) | |||
| 93 | } | 93 | } |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | int __devinit rgmii_attach(struct of_device *ofdev, int input, int mode) | 96 | int __devinit rgmii_attach(struct platform_device *ofdev, int input, int mode) |
| 97 | { | 97 | { |
| 98 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 98 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 99 | struct rgmii_regs __iomem *p = dev->base; | 99 | struct rgmii_regs __iomem *p = dev->base; |
| @@ -122,7 +122,7 @@ int __devinit rgmii_attach(struct of_device *ofdev, int input, int mode) | |||
| 122 | return 0; | 122 | return 0; |
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | void rgmii_set_speed(struct of_device *ofdev, int input, int speed) | 125 | void rgmii_set_speed(struct platform_device *ofdev, int input, int speed) |
| 126 | { | 126 | { |
| 127 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 127 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 128 | struct rgmii_regs __iomem *p = dev->base; | 128 | struct rgmii_regs __iomem *p = dev->base; |
| @@ -144,7 +144,7 @@ void rgmii_set_speed(struct of_device *ofdev, int input, int speed) | |||
| 144 | mutex_unlock(&dev->lock); | 144 | mutex_unlock(&dev->lock); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | void rgmii_get_mdio(struct of_device *ofdev, int input) | 147 | void rgmii_get_mdio(struct platform_device *ofdev, int input) |
| 148 | { | 148 | { |
| 149 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 149 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 150 | struct rgmii_regs __iomem *p = dev->base; | 150 | struct rgmii_regs __iomem *p = dev->base; |
| @@ -165,7 +165,7 @@ void rgmii_get_mdio(struct of_device *ofdev, int input) | |||
| 165 | DBG2(dev, " fer = 0x%08x\n", fer); | 165 | DBG2(dev, " fer = 0x%08x\n", fer); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | void rgmii_put_mdio(struct of_device *ofdev, int input) | 168 | void rgmii_put_mdio(struct platform_device *ofdev, int input) |
| 169 | { | 169 | { |
| 170 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 170 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 171 | struct rgmii_regs __iomem *p = dev->base; | 171 | struct rgmii_regs __iomem *p = dev->base; |
| @@ -186,7 +186,7 @@ void rgmii_put_mdio(struct of_device *ofdev, int input) | |||
| 186 | mutex_unlock(&dev->lock); | 186 | mutex_unlock(&dev->lock); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | void rgmii_detach(struct of_device *ofdev, int input) | 189 | void rgmii_detach(struct platform_device *ofdev, int input) |
| 190 | { | 190 | { |
| 191 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 191 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 192 | struct rgmii_regs __iomem *p; | 192 | struct rgmii_regs __iomem *p; |
| @@ -206,13 +206,13 @@ void rgmii_detach(struct of_device *ofdev, int input) | |||
| 206 | mutex_unlock(&dev->lock); | 206 | mutex_unlock(&dev->lock); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | int rgmii_get_regs_len(struct of_device *ofdev) | 209 | int rgmii_get_regs_len(struct platform_device *ofdev) |
| 210 | { | 210 | { |
| 211 | return sizeof(struct emac_ethtool_regs_subhdr) + | 211 | return sizeof(struct emac_ethtool_regs_subhdr) + |
| 212 | sizeof(struct rgmii_regs); | 212 | sizeof(struct rgmii_regs); |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | void *rgmii_dump_regs(struct of_device *ofdev, void *buf) | 215 | void *rgmii_dump_regs(struct platform_device *ofdev, void *buf) |
| 216 | { | 216 | { |
| 217 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 217 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 218 | struct emac_ethtool_regs_subhdr *hdr = buf; | 218 | struct emac_ethtool_regs_subhdr *hdr = buf; |
| @@ -228,7 +228,7 @@ void *rgmii_dump_regs(struct of_device *ofdev, void *buf) | |||
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | 230 | ||
| 231 | static int __devinit rgmii_probe(struct of_device *ofdev, | 231 | static int __devinit rgmii_probe(struct platform_device *ofdev, |
| 232 | const struct of_device_id *match) | 232 | const struct of_device_id *match) |
| 233 | { | 233 | { |
| 234 | struct device_node *np = ofdev->dev.of_node; | 234 | struct device_node *np = ofdev->dev.of_node; |
| @@ -293,7 +293,7 @@ static int __devinit rgmii_probe(struct of_device *ofdev, | |||
| 293 | return rc; | 293 | return rc; |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | static int __devexit rgmii_remove(struct of_device *ofdev) | 296 | static int __devexit rgmii_remove(struct platform_device *ofdev) |
| 297 | { | 297 | { |
| 298 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 298 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 299 | 299 | ||
diff --git a/drivers/net/ibm_newemac/rgmii.h b/drivers/net/ibm_newemac/rgmii.h index c4a4b358a270..d69799049865 100644 --- a/drivers/net/ibm_newemac/rgmii.h +++ b/drivers/net/ibm_newemac/rgmii.h | |||
| @@ -51,20 +51,20 @@ struct rgmii_instance { | |||
| 51 | int users; | 51 | int users; |
| 52 | 52 | ||
| 53 | /* OF device instance */ | 53 | /* OF device instance */ |
| 54 | struct of_device *ofdev; | 54 | struct platform_device *ofdev; |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | #ifdef CONFIG_IBM_NEW_EMAC_RGMII | 57 | #ifdef CONFIG_IBM_NEW_EMAC_RGMII |
| 58 | 58 | ||
| 59 | extern int rgmii_init(void); | 59 | extern int rgmii_init(void); |
| 60 | extern void rgmii_exit(void); | 60 | extern void rgmii_exit(void); |
| 61 | extern int rgmii_attach(struct of_device *ofdev, int input, int mode); | 61 | extern int rgmii_attach(struct platform_device *ofdev, int input, int mode); |
| 62 | extern void rgmii_detach(struct of_device *ofdev, int input); | 62 | extern void rgmii_detach(struct platform_device *ofdev, int input); |
| 63 | extern void rgmii_get_mdio(struct of_device *ofdev, int input); | 63 | extern void rgmii_get_mdio(struct platform_device *ofdev, int input); |
| 64 | extern void rgmii_put_mdio(struct of_device *ofdev, int input); | 64 | extern void rgmii_put_mdio(struct platform_device *ofdev, int input); |
| 65 | extern void rgmii_set_speed(struct of_device *ofdev, int input, int speed); | 65 | extern void rgmii_set_speed(struct platform_device *ofdev, int input, int speed); |
| 66 | extern int rgmii_get_regs_len(struct of_device *ofdev); | 66 | extern int rgmii_get_regs_len(struct platform_device *ofdev); |
| 67 | extern void *rgmii_dump_regs(struct of_device *ofdev, void *buf); | 67 | extern void *rgmii_dump_regs(struct platform_device *ofdev, void *buf); |
| 68 | 68 | ||
| 69 | #else | 69 | #else |
| 70 | 70 | ||
diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c index 044637144c43..299aa49490c0 100644 --- a/drivers/net/ibm_newemac/tah.c +++ b/drivers/net/ibm_newemac/tah.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | #include "emac.h" | 23 | #include "emac.h" |
| 24 | #include "core.h" | 24 | #include "core.h" |
| 25 | 25 | ||
| 26 | int __devinit tah_attach(struct of_device *ofdev, int channel) | 26 | int __devinit tah_attach(struct platform_device *ofdev, int channel) |
| 27 | { | 27 | { |
| 28 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); | 28 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 29 | 29 | ||
| @@ -35,7 +35,7 @@ int __devinit tah_attach(struct of_device *ofdev, int channel) | |||
| 35 | return 0; | 35 | return 0; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | void tah_detach(struct of_device *ofdev, int channel) | 38 | void tah_detach(struct platform_device *ofdev, int channel) |
| 39 | { | 39 | { |
| 40 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); | 40 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 41 | 41 | ||
| @@ -44,7 +44,7 @@ void tah_detach(struct of_device *ofdev, int channel) | |||
| 44 | mutex_unlock(&dev->lock); | 44 | mutex_unlock(&dev->lock); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | void tah_reset(struct of_device *ofdev) | 47 | void tah_reset(struct platform_device *ofdev) |
| 48 | { | 48 | { |
| 49 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); | 49 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 50 | struct tah_regs __iomem *p = dev->base; | 50 | struct tah_regs __iomem *p = dev->base; |
| @@ -66,13 +66,13 @@ void tah_reset(struct of_device *ofdev) | |||
| 66 | TAH_MR_DIG); | 66 | TAH_MR_DIG); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | int tah_get_regs_len(struct of_device *ofdev) | 69 | int tah_get_regs_len(struct platform_device *ofdev) |
| 70 | { | 70 | { |
| 71 | return sizeof(struct emac_ethtool_regs_subhdr) + | 71 | return sizeof(struct emac_ethtool_regs_subhdr) + |
| 72 | sizeof(struct tah_regs); | 72 | sizeof(struct tah_regs); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | void *tah_dump_regs(struct of_device *ofdev, void *buf) | 75 | void *tah_dump_regs(struct platform_device *ofdev, void *buf) |
| 76 | { | 76 | { |
| 77 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); | 77 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 78 | struct emac_ethtool_regs_subhdr *hdr = buf; | 78 | struct emac_ethtool_regs_subhdr *hdr = buf; |
| @@ -87,7 +87,7 @@ void *tah_dump_regs(struct of_device *ofdev, void *buf) | |||
| 87 | return regs + 1; | 87 | return regs + 1; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | static int __devinit tah_probe(struct of_device *ofdev, | 90 | static int __devinit tah_probe(struct platform_device *ofdev, |
| 91 | const struct of_device_id *match) | 91 | const struct of_device_id *match) |
| 92 | { | 92 | { |
| 93 | struct device_node *np = ofdev->dev.of_node; | 93 | struct device_node *np = ofdev->dev.of_node; |
| @@ -139,7 +139,7 @@ static int __devinit tah_probe(struct of_device *ofdev, | |||
| 139 | return rc; | 139 | return rc; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | static int __devexit tah_remove(struct of_device *ofdev) | 142 | static int __devexit tah_remove(struct platform_device *ofdev) |
| 143 | { | 143 | { |
| 144 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); | 144 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 145 | 145 | ||
diff --git a/drivers/net/ibm_newemac/tah.h b/drivers/net/ibm_newemac/tah.h index a068b5658dad..61dbeca006d1 100644 --- a/drivers/net/ibm_newemac/tah.h +++ b/drivers/net/ibm_newemac/tah.h | |||
| @@ -48,7 +48,7 @@ struct tah_instance { | |||
| 48 | int users; | 48 | int users; |
| 49 | 49 | ||
| 50 | /* OF device instance */ | 50 | /* OF device instance */ |
| 51 | struct of_device *ofdev; | 51 | struct platform_device *ofdev; |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| 54 | 54 | ||
| @@ -74,11 +74,11 @@ struct tah_instance { | |||
| 74 | 74 | ||
| 75 | extern int tah_init(void); | 75 | extern int tah_init(void); |
| 76 | extern void tah_exit(void); | 76 | extern void tah_exit(void); |
| 77 | extern int tah_attach(struct of_device *ofdev, int channel); | 77 | extern int tah_attach(struct platform_device *ofdev, int channel); |
| 78 | extern void tah_detach(struct of_device *ofdev, int channel); | 78 | extern void tah_detach(struct platform_device *ofdev, int channel); |
| 79 | extern void tah_reset(struct of_device *ofdev); | 79 | extern void tah_reset(struct platform_device *ofdev); |
| 80 | extern int tah_get_regs_len(struct of_device *ofdev); | 80 | extern int tah_get_regs_len(struct platform_device *ofdev); |
| 81 | extern void *tah_dump_regs(struct of_device *ofdev, void *buf); | 81 | extern void *tah_dump_regs(struct platform_device *ofdev, void *buf); |
| 82 | 82 | ||
| 83 | #else | 83 | #else |
| 84 | 84 | ||
diff --git a/drivers/net/ibm_newemac/zmii.c b/drivers/net/ibm_newemac/zmii.c index 046dcd069c45..34ed6ee8ca8a 100644 --- a/drivers/net/ibm_newemac/zmii.c +++ b/drivers/net/ibm_newemac/zmii.c | |||
| @@ -82,7 +82,7 @@ static inline u32 zmii_mode_mask(int mode, int input) | |||
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | int __devinit zmii_attach(struct of_device *ofdev, int input, int *mode) | 85 | int __devinit zmii_attach(struct platform_device *ofdev, int input, int *mode) |
| 86 | { | 86 | { |
| 87 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 87 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 88 | struct zmii_regs __iomem *p = dev->base; | 88 | struct zmii_regs __iomem *p = dev->base; |
| @@ -148,7 +148,7 @@ int __devinit zmii_attach(struct of_device *ofdev, int input, int *mode) | |||
| 148 | return 0; | 148 | return 0; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | void zmii_get_mdio(struct of_device *ofdev, int input) | 151 | void zmii_get_mdio(struct platform_device *ofdev, int input) |
| 152 | { | 152 | { |
| 153 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 153 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 154 | u32 fer; | 154 | u32 fer; |
| @@ -161,7 +161,7 @@ void zmii_get_mdio(struct of_device *ofdev, int input) | |||
| 161 | out_be32(&dev->base->fer, fer | ZMII_FER_MDI(input)); | 161 | out_be32(&dev->base->fer, fer | ZMII_FER_MDI(input)); |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | void zmii_put_mdio(struct of_device *ofdev, int input) | 164 | void zmii_put_mdio(struct platform_device *ofdev, int input) |
| 165 | { | 165 | { |
| 166 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 166 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 167 | 167 | ||
| @@ -170,7 +170,7 @@ void zmii_put_mdio(struct of_device *ofdev, int input) | |||
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | 172 | ||
| 173 | void zmii_set_speed(struct of_device *ofdev, int input, int speed) | 173 | void zmii_set_speed(struct platform_device *ofdev, int input, int speed) |
| 174 | { | 174 | { |
| 175 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 175 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 176 | u32 ssr; | 176 | u32 ssr; |
| @@ -191,7 +191,7 @@ void zmii_set_speed(struct of_device *ofdev, int input, int speed) | |||
| 191 | mutex_unlock(&dev->lock); | 191 | mutex_unlock(&dev->lock); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | void zmii_detach(struct of_device *ofdev, int input) | 194 | void zmii_detach(struct platform_device *ofdev, int input) |
| 195 | { | 195 | { |
| 196 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 196 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 197 | 197 | ||
| @@ -210,13 +210,13 @@ void zmii_detach(struct of_device *ofdev, int input) | |||
| 210 | mutex_unlock(&dev->lock); | 210 | mutex_unlock(&dev->lock); |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | int zmii_get_regs_len(struct of_device *ofdev) | 213 | int zmii_get_regs_len(struct platform_device *ofdev) |
| 214 | { | 214 | { |
| 215 | return sizeof(struct emac_ethtool_regs_subhdr) + | 215 | return sizeof(struct emac_ethtool_regs_subhdr) + |
| 216 | sizeof(struct zmii_regs); | 216 | sizeof(struct zmii_regs); |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | void *zmii_dump_regs(struct of_device *ofdev, void *buf) | 219 | void *zmii_dump_regs(struct platform_device *ofdev, void *buf) |
| 220 | { | 220 | { |
| 221 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 221 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 222 | struct emac_ethtool_regs_subhdr *hdr = buf; | 222 | struct emac_ethtool_regs_subhdr *hdr = buf; |
| @@ -231,7 +231,7 @@ void *zmii_dump_regs(struct of_device *ofdev, void *buf) | |||
| 231 | return regs + 1; | 231 | return regs + 1; |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | static int __devinit zmii_probe(struct of_device *ofdev, | 234 | static int __devinit zmii_probe(struct platform_device *ofdev, |
| 235 | const struct of_device_id *match) | 235 | const struct of_device_id *match) |
| 236 | { | 236 | { |
| 237 | struct device_node *np = ofdev->dev.of_node; | 237 | struct device_node *np = ofdev->dev.of_node; |
| @@ -286,7 +286,7 @@ static int __devinit zmii_probe(struct of_device *ofdev, | |||
| 286 | return rc; | 286 | return rc; |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | static int __devexit zmii_remove(struct of_device *ofdev) | 289 | static int __devexit zmii_remove(struct platform_device *ofdev) |
| 290 | { | 290 | { |
| 291 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 291 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); |
| 292 | 292 | ||
diff --git a/drivers/net/ibm_newemac/zmii.h b/drivers/net/ibm_newemac/zmii.h index 6c9beba0c4b6..1333fa2b2781 100644 --- a/drivers/net/ibm_newemac/zmii.h +++ b/drivers/net/ibm_newemac/zmii.h | |||
| @@ -48,20 +48,20 @@ struct zmii_instance { | |||
| 48 | u32 fer_save; | 48 | u32 fer_save; |
| 49 | 49 | ||
| 50 | /* OF device instance */ | 50 | /* OF device instance */ |
| 51 | struct of_device *ofdev; | 51 | struct platform_device *ofdev; |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| 54 | #ifdef CONFIG_IBM_NEW_EMAC_ZMII | 54 | #ifdef CONFIG_IBM_NEW_EMAC_ZMII |
| 55 | 55 | ||
| 56 | extern int zmii_init(void); | 56 | extern int zmii_init(void); |
| 57 | extern void zmii_exit(void); | 57 | extern void zmii_exit(void); |
| 58 | extern int zmii_attach(struct of_device *ofdev, int input, int *mode); | 58 | extern int zmii_attach(struct platform_device *ofdev, int input, int *mode); |
| 59 | extern void zmii_detach(struct of_device *ofdev, int input); | 59 | extern void zmii_detach(struct platform_device *ofdev, int input); |
| 60 | extern void zmii_get_mdio(struct of_device *ofdev, int input); | 60 | extern void zmii_get_mdio(struct platform_device *ofdev, int input); |
| 61 | extern void zmii_put_mdio(struct of_device *ofdev, int input); | 61 | extern void zmii_put_mdio(struct platform_device *ofdev, int input); |
| 62 | extern void zmii_set_speed(struct of_device *ofdev, int input, int speed); | 62 | extern void zmii_set_speed(struct platform_device *ofdev, int input, int speed); |
| 63 | extern int zmii_get_regs_len(struct of_device *ocpdev); | 63 | extern int zmii_get_regs_len(struct platform_device *ocpdev); |
| 64 | extern void *zmii_dump_regs(struct of_device *ofdev, void *buf); | 64 | extern void *zmii_dump_regs(struct platform_device *ofdev, void *buf); |
| 65 | 65 | ||
| 66 | #else | 66 | #else |
| 67 | # define zmii_init() 0 | 67 | # define zmii_init() 0 |
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c index 4eea3f70c5cf..c7b624711f5e 100644 --- a/drivers/net/ll_temac_main.c +++ b/drivers/net/ll_temac_main.c | |||
| @@ -159,7 +159,7 @@ static void temac_dma_dcr_out(struct temac_local *lp, int reg, u32 value) | |||
| 159 | * temac_dcr_setup - If the DMA is DCR based, then setup the address and | 159 | * temac_dcr_setup - If the DMA is DCR based, then setup the address and |
| 160 | * I/O functions | 160 | * I/O functions |
| 161 | */ | 161 | */ |
| 162 | static int temac_dcr_setup(struct temac_local *lp, struct of_device *op, | 162 | static int temac_dcr_setup(struct temac_local *lp, struct platform_device *op, |
| 163 | struct device_node *np) | 163 | struct device_node *np) |
| 164 | { | 164 | { |
| 165 | unsigned int dcrs; | 165 | unsigned int dcrs; |
| @@ -184,7 +184,7 @@ static int temac_dcr_setup(struct temac_local *lp, struct of_device *op, | |||
| 184 | * temac_dcr_setup - This is a stub for when DCR is not supported, | 184 | * temac_dcr_setup - This is a stub for when DCR is not supported, |
| 185 | * such as with MicroBlaze | 185 | * such as with MicroBlaze |
| 186 | */ | 186 | */ |
| 187 | static int temac_dcr_setup(struct temac_local *lp, struct of_device *op, | 187 | static int temac_dcr_setup(struct temac_local *lp, struct platform_device *op, |
| 188 | struct device_node *np) | 188 | struct device_node *np) |
| 189 | { | 189 | { |
| 190 | return -1; | 190 | return -1; |
| @@ -952,7 +952,7 @@ static const struct attribute_group temac_attr_group = { | |||
| 952 | }; | 952 | }; |
| 953 | 953 | ||
| 954 | static int __init | 954 | static int __init |
| 955 | temac_of_probe(struct of_device *op, const struct of_device_id *match) | 955 | temac_of_probe(struct platform_device *op, const struct of_device_id *match) |
| 956 | { | 956 | { |
| 957 | struct device_node *np; | 957 | struct device_node *np; |
| 958 | struct temac_local *lp; | 958 | struct temac_local *lp; |
| @@ -1094,7 +1094,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match) | |||
| 1094 | return rc; | 1094 | return rc; |
| 1095 | } | 1095 | } |
| 1096 | 1096 | ||
| 1097 | static int __devexit temac_of_remove(struct of_device *op) | 1097 | static int __devexit temac_of_remove(struct platform_device *op) |
| 1098 | { | 1098 | { |
| 1099 | struct net_device *ndev = dev_get_drvdata(&op->dev); | 1099 | struct net_device *ndev = dev_get_drvdata(&op->dev); |
| 1100 | struct temac_local *lp = netdev_priv(ndev); | 1100 | struct temac_local *lp = netdev_priv(ndev); |
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c index 04e552aa14ec..617f898ba5f0 100644 --- a/drivers/net/myri_sbus.c +++ b/drivers/net/myri_sbus.c | |||
| @@ -926,7 +926,7 @@ static const struct net_device_ops myri_ops = { | |||
| 926 | .ndo_validate_addr = eth_validate_addr, | 926 | .ndo_validate_addr = eth_validate_addr, |
| 927 | }; | 927 | }; |
| 928 | 928 | ||
| 929 | static int __devinit myri_sbus_probe(struct of_device *op, const struct of_device_id *match) | 929 | static int __devinit myri_sbus_probe(struct platform_device *op, const struct of_device_id *match) |
| 930 | { | 930 | { |
| 931 | struct device_node *dp = op->dev.of_node; | 931 | struct device_node *dp = op->dev.of_node; |
| 932 | static unsigned version_printed; | 932 | static unsigned version_printed; |
| @@ -1124,7 +1124,7 @@ err: | |||
| 1124 | return -ENODEV; | 1124 | return -ENODEV; |
| 1125 | } | 1125 | } |
| 1126 | 1126 | ||
| 1127 | static int __devexit myri_sbus_remove(struct of_device *op) | 1127 | static int __devexit myri_sbus_remove(struct platform_device *op) |
| 1128 | { | 1128 | { |
| 1129 | struct myri_eth *mp = dev_get_drvdata(&op->dev); | 1129 | struct myri_eth *mp = dev_get_drvdata(&op->dev); |
| 1130 | struct net_device *net_dev = mp->dev; | 1130 | struct net_device *net_dev = mp->dev; |
diff --git a/drivers/net/myri_sbus.h b/drivers/net/myri_sbus.h index ff363e95d9cf..80a2fa5cf757 100644 --- a/drivers/net/myri_sbus.h +++ b/drivers/net/myri_sbus.h | |||
| @@ -288,7 +288,7 @@ struct myri_eth { | |||
| 288 | struct myri_eeprom eeprom; /* Local copy of EEPROM. */ | 288 | struct myri_eeprom eeprom; /* Local copy of EEPROM. */ |
| 289 | unsigned int reg_size; /* Size of register space. */ | 289 | unsigned int reg_size; /* Size of register space. */ |
| 290 | unsigned int shmem_base; /* Offset to shared ram. */ | 290 | unsigned int shmem_base; /* Offset to shared ram. */ |
| 291 | struct of_device *myri_op; /* Our OF device struct. */ | 291 | struct platform_device *myri_op; /* Our OF device struct. */ |
| 292 | }; | 292 | }; |
| 293 | 293 | ||
| 294 | /* We use this to acquire receive skb's that we can DMA directly into. */ | 294 | /* We use this to acquire receive skb's that we can DMA directly into. */ |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 404f2d552888..bc695d53cdcc 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
| @@ -9103,7 +9103,7 @@ retry: | |||
| 9103 | static int __devinit niu_n2_irq_init(struct niu *np, u8 *ldg_num_map) | 9103 | static int __devinit niu_n2_irq_init(struct niu *np, u8 *ldg_num_map) |
| 9104 | { | 9104 | { |
| 9105 | #ifdef CONFIG_SPARC64 | 9105 | #ifdef CONFIG_SPARC64 |
| 9106 | struct of_device *op = np->op; | 9106 | struct platform_device *op = np->op; |
| 9107 | const u32 *int_prop; | 9107 | const u32 *int_prop; |
| 9108 | int i; | 9108 | int i; |
| 9109 | 9109 | ||
| @@ -9688,7 +9688,7 @@ static void __devinit niu_driver_version(void) | |||
| 9688 | 9688 | ||
| 9689 | static struct net_device * __devinit niu_alloc_and_init( | 9689 | static struct net_device * __devinit niu_alloc_and_init( |
| 9690 | struct device *gen_dev, struct pci_dev *pdev, | 9690 | struct device *gen_dev, struct pci_dev *pdev, |
| 9691 | struct of_device *op, const struct niu_ops *ops, | 9691 | struct platform_device *op, const struct niu_ops *ops, |
| 9692 | u8 port) | 9692 | u8 port) |
| 9693 | { | 9693 | { |
| 9694 | struct net_device *dev; | 9694 | struct net_device *dev; |
| @@ -10064,7 +10064,7 @@ static const struct niu_ops niu_phys_ops = { | |||
| 10064 | .unmap_single = niu_phys_unmap_single, | 10064 | .unmap_single = niu_phys_unmap_single, |
| 10065 | }; | 10065 | }; |
| 10066 | 10066 | ||
| 10067 | static int __devinit niu_of_probe(struct of_device *op, | 10067 | static int __devinit niu_of_probe(struct platform_device *op, |
| 10068 | const struct of_device_id *match) | 10068 | const struct of_device_id *match) |
| 10069 | { | 10069 | { |
| 10070 | union niu_parent_id parent_id; | 10070 | union niu_parent_id parent_id; |
| @@ -10179,7 +10179,7 @@ err_out: | |||
| 10179 | return err; | 10179 | return err; |
| 10180 | } | 10180 | } |
| 10181 | 10181 | ||
| 10182 | static int __devexit niu_of_remove(struct of_device *op) | 10182 | static int __devexit niu_of_remove(struct platform_device *op) |
| 10183 | { | 10183 | { |
| 10184 | struct net_device *dev = dev_get_drvdata(&op->dev); | 10184 | struct net_device *dev = dev_get_drvdata(&op->dev); |
| 10185 | 10185 | ||
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c index fc5fef2a8175..f62c7b717bc8 100644 --- a/drivers/net/phy/mdio-gpio.c +++ b/drivers/net/phy/mdio-gpio.c | |||
| @@ -188,7 +188,7 @@ static int __devexit mdio_gpio_remove(struct platform_device *pdev) | |||
| 188 | 188 | ||
| 189 | #ifdef CONFIG_OF_GPIO | 189 | #ifdef CONFIG_OF_GPIO |
| 190 | 190 | ||
| 191 | static int __devinit mdio_ofgpio_probe(struct of_device *ofdev, | 191 | static int __devinit mdio_ofgpio_probe(struct platform_device *ofdev, |
| 192 | const struct of_device_id *match) | 192 | const struct of_device_id *match) |
| 193 | { | 193 | { |
| 194 | struct mdio_gpio_platform_data *pdata; | 194 | struct mdio_gpio_platform_data *pdata; |
| @@ -224,7 +224,7 @@ out_free: | |||
| 224 | return -ENODEV; | 224 | return -ENODEV; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | static int __devexit mdio_ofgpio_remove(struct of_device *ofdev) | 227 | static int __devexit mdio_ofgpio_remove(struct platform_device *ofdev) |
| 228 | { | 228 | { |
| 229 | mdio_gpio_bus_destroy(&ofdev->dev); | 229 | mdio_gpio_bus_destroy(&ofdev->dev); |
| 230 | kfree(ofdev->dev.platform_data); | 230 | kfree(ofdev->dev.platform_data); |
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c index 09c071bd6ad4..618643e3ca3e 100644 --- a/drivers/net/sunbmac.c +++ b/drivers/net/sunbmac.c | |||
| @@ -97,7 +97,7 @@ static int qec_global_reset(void __iomem *gregs) | |||
| 97 | 97 | ||
| 98 | static void qec_init(struct bigmac *bp) | 98 | static void qec_init(struct bigmac *bp) |
| 99 | { | 99 | { |
| 100 | struct of_device *qec_op = bp->qec_op; | 100 | struct platform_device *qec_op = bp->qec_op; |
| 101 | void __iomem *gregs = bp->gregs; | 101 | void __iomem *gregs = bp->gregs; |
| 102 | u8 bsizes = bp->bigmac_bursts; | 102 | u8 bsizes = bp->bigmac_bursts; |
| 103 | u32 regval; | 103 | u32 regval; |
| @@ -1083,8 +1083,8 @@ static const struct net_device_ops bigmac_ops = { | |||
| 1083 | .ndo_validate_addr = eth_validate_addr, | 1083 | .ndo_validate_addr = eth_validate_addr, |
| 1084 | }; | 1084 | }; |
| 1085 | 1085 | ||
| 1086 | static int __devinit bigmac_ether_init(struct of_device *op, | 1086 | static int __devinit bigmac_ether_init(struct platform_device *op, |
| 1087 | struct of_device *qec_op) | 1087 | struct platform_device *qec_op) |
| 1088 | { | 1088 | { |
| 1089 | static int version_printed; | 1089 | static int version_printed; |
| 1090 | struct net_device *dev; | 1090 | struct net_device *dev; |
| @@ -1242,25 +1242,25 @@ fail_and_cleanup: | |||
| 1242 | /* QEC can be the parent of either QuadEthernet or a BigMAC. We want | 1242 | /* QEC can be the parent of either QuadEthernet or a BigMAC. We want |
| 1243 | * the latter. | 1243 | * the latter. |
| 1244 | */ | 1244 | */ |
| 1245 | static int __devinit bigmac_sbus_probe(struct of_device *op, | 1245 | static int __devinit bigmac_sbus_probe(struct platform_device *op, |
| 1246 | const struct of_device_id *match) | 1246 | const struct of_device_id *match) |
| 1247 | { | 1247 | { |
| 1248 | struct device *parent = op->dev.parent; | 1248 | struct device *parent = op->dev.parent; |
| 1249 | struct of_device *qec_op; | 1249 | struct platform_device *qec_op; |
| 1250 | 1250 | ||
| 1251 | qec_op = to_of_device(parent); | 1251 | qec_op = to_platform_device(parent); |
| 1252 | 1252 | ||
| 1253 | return bigmac_ether_init(op, qec_op); | 1253 | return bigmac_ether_init(op, qec_op); |
| 1254 | } | 1254 | } |
| 1255 | 1255 | ||
| 1256 | static int __devexit bigmac_sbus_remove(struct of_device *op) | 1256 | static int __devexit bigmac_sbus_remove(struct platform_device *op) |
| 1257 | { | 1257 | { |
| 1258 | struct bigmac *bp = dev_get_drvdata(&op->dev); | 1258 | struct bigmac *bp = dev_get_drvdata(&op->dev); |
| 1259 | struct device *parent = op->dev.parent; | 1259 | struct device *parent = op->dev.parent; |
| 1260 | struct net_device *net_dev = bp->dev; | 1260 | struct net_device *net_dev = bp->dev; |
| 1261 | struct of_device *qec_op; | 1261 | struct platform_device *qec_op; |
| 1262 | 1262 | ||
| 1263 | qec_op = to_of_device(parent); | 1263 | qec_op = to_platform_device(parent); |
| 1264 | 1264 | ||
| 1265 | unregister_netdev(net_dev); | 1265 | unregister_netdev(net_dev); |
| 1266 | 1266 | ||
diff --git a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h index 8840bc0b840b..8db88945b889 100644 --- a/drivers/net/sunbmac.h +++ b/drivers/net/sunbmac.h | |||
| @@ -329,8 +329,8 @@ struct bigmac { | |||
| 329 | unsigned int timer_ticks; | 329 | unsigned int timer_ticks; |
| 330 | 330 | ||
| 331 | struct net_device_stats enet_stats; | 331 | struct net_device_stats enet_stats; |
| 332 | struct of_device *qec_op; | 332 | struct platform_device *qec_op; |
| 333 | struct of_device *bigmac_op; | 333 | struct platform_device *bigmac_op; |
| 334 | struct net_device *dev; | 334 | struct net_device *dev; |
| 335 | }; | 335 | }; |
| 336 | 336 | ||
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index eec443f64079..bd0df1c14955 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c | |||
| @@ -1591,7 +1591,7 @@ static int happy_meal_init(struct happy_meal *hp) | |||
| 1591 | */ | 1591 | */ |
| 1592 | #ifdef CONFIG_SBUS | 1592 | #ifdef CONFIG_SBUS |
| 1593 | if ((hp->happy_flags & HFLAG_PCI) == 0) { | 1593 | if ((hp->happy_flags & HFLAG_PCI) == 0) { |
| 1594 | struct of_device *op = hp->happy_dev; | 1594 | struct platform_device *op = hp->happy_dev; |
| 1595 | if (sbus_can_dma_64bit()) { | 1595 | if (sbus_can_dma_64bit()) { |
| 1596 | sbus_set_sbus64(&op->dev, | 1596 | sbus_set_sbus64(&op->dev, |
| 1597 | hp->happy_bursts); | 1597 | hp->happy_bursts); |
| @@ -2480,7 +2480,7 @@ static void hme_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info | |||
| 2480 | #ifdef CONFIG_SBUS | 2480 | #ifdef CONFIG_SBUS |
| 2481 | else { | 2481 | else { |
| 2482 | const struct linux_prom_registers *regs; | 2482 | const struct linux_prom_registers *regs; |
| 2483 | struct of_device *op = hp->happy_dev; | 2483 | struct platform_device *op = hp->happy_dev; |
| 2484 | regs = of_get_property(op->dev.of_node, "regs", NULL); | 2484 | regs = of_get_property(op->dev.of_node, "regs", NULL); |
| 2485 | if (regs) | 2485 | if (regs) |
| 2486 | sprintf(info->bus_info, "SBUS:%d", | 2486 | sprintf(info->bus_info, "SBUS:%d", |
| @@ -2515,13 +2515,13 @@ static int hme_version_printed; | |||
| 2515 | * | 2515 | * |
| 2516 | * Return NULL on failure. | 2516 | * Return NULL on failure. |
| 2517 | */ | 2517 | */ |
| 2518 | static struct quattro * __devinit quattro_sbus_find(struct of_device *child) | 2518 | static struct quattro * __devinit quattro_sbus_find(struct platform_device *child) |
| 2519 | { | 2519 | { |
| 2520 | struct device *parent = child->dev.parent; | 2520 | struct device *parent = child->dev.parent; |
| 2521 | struct of_device *op; | 2521 | struct platform_device *op; |
| 2522 | struct quattro *qp; | 2522 | struct quattro *qp; |
| 2523 | 2523 | ||
| 2524 | op = to_of_device(parent); | 2524 | op = to_platform_device(parent); |
| 2525 | qp = dev_get_drvdata(&op->dev); | 2525 | qp = dev_get_drvdata(&op->dev); |
| 2526 | if (qp) | 2526 | if (qp) |
| 2527 | return qp; | 2527 | return qp; |
| @@ -2551,7 +2551,7 @@ static int __init quattro_sbus_register_irqs(void) | |||
| 2551 | struct quattro *qp; | 2551 | struct quattro *qp; |
| 2552 | 2552 | ||
| 2553 | for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { | 2553 | for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { |
| 2554 | struct of_device *op = qp->quattro_dev; | 2554 | struct platform_device *op = qp->quattro_dev; |
| 2555 | int err, qfe_slot, skip = 0; | 2555 | int err, qfe_slot, skip = 0; |
| 2556 | 2556 | ||
| 2557 | for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) { | 2557 | for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) { |
| @@ -2580,7 +2580,7 @@ static void quattro_sbus_free_irqs(void) | |||
| 2580 | struct quattro *qp; | 2580 | struct quattro *qp; |
| 2581 | 2581 | ||
| 2582 | for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { | 2582 | for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { |
| 2583 | struct of_device *op = qp->quattro_dev; | 2583 | struct platform_device *op = qp->quattro_dev; |
| 2584 | int qfe_slot, skip = 0; | 2584 | int qfe_slot, skip = 0; |
| 2585 | 2585 | ||
| 2586 | for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) { | 2586 | for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) { |
| @@ -2639,7 +2639,7 @@ static const struct net_device_ops hme_netdev_ops = { | |||
| 2639 | }; | 2639 | }; |
| 2640 | 2640 | ||
| 2641 | #ifdef CONFIG_SBUS | 2641 | #ifdef CONFIG_SBUS |
| 2642 | static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe) | 2642 | static int __devinit happy_meal_sbus_probe_one(struct platform_device *op, int is_qfe) |
| 2643 | { | 2643 | { |
| 2644 | struct device_node *dp = op->dev.of_node, *sbus_dp; | 2644 | struct device_node *dp = op->dev.of_node, *sbus_dp; |
| 2645 | struct quattro *qp = NULL; | 2645 | struct quattro *qp = NULL; |
| @@ -2648,7 +2648,7 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe) | |||
| 2648 | int i, qfe_slot = -1; | 2648 | int i, qfe_slot = -1; |
| 2649 | int err = -ENODEV; | 2649 | int err = -ENODEV; |
| 2650 | 2650 | ||
| 2651 | sbus_dp = to_of_device(op->dev.parent)->dev.of_node; | 2651 | sbus_dp = op->dev.parent->of_node; |
| 2652 | 2652 | ||
| 2653 | /* We can match PCI devices too, do not accept those here. */ | 2653 | /* We can match PCI devices too, do not accept those here. */ |
| 2654 | if (strcmp(sbus_dp->name, "sbus")) | 2654 | if (strcmp(sbus_dp->name, "sbus")) |
| @@ -3235,7 +3235,7 @@ static void happy_meal_pci_exit(void) | |||
| 3235 | #endif | 3235 | #endif |
| 3236 | 3236 | ||
| 3237 | #ifdef CONFIG_SBUS | 3237 | #ifdef CONFIG_SBUS |
| 3238 | static int __devinit hme_sbus_probe(struct of_device *op, const struct of_device_id *match) | 3238 | static int __devinit hme_sbus_probe(struct platform_device *op, const struct of_device_id *match) |
| 3239 | { | 3239 | { |
| 3240 | struct device_node *dp = op->dev.of_node; | 3240 | struct device_node *dp = op->dev.of_node; |
| 3241 | const char *model = of_get_property(dp, "model", NULL); | 3241 | const char *model = of_get_property(dp, "model", NULL); |
| @@ -3247,7 +3247,7 @@ static int __devinit hme_sbus_probe(struct of_device *op, const struct of_device | |||
| 3247 | return happy_meal_sbus_probe_one(op, is_qfe); | 3247 | return happy_meal_sbus_probe_one(op, is_qfe); |
| 3248 | } | 3248 | } |
| 3249 | 3249 | ||
| 3250 | static int __devexit hme_sbus_remove(struct of_device *op) | 3250 | static int __devexit hme_sbus_remove(struct platform_device *op) |
| 3251 | { | 3251 | { |
| 3252 | struct happy_meal *hp = dev_get_drvdata(&op->dev); | 3252 | struct happy_meal *hp = dev_get_drvdata(&op->dev); |
| 3253 | struct net_device *net_dev = hp->dev; | 3253 | struct net_device *net_dev = hp->dev; |
diff --git a/drivers/net/sunhme.h b/drivers/net/sunhme.h index efd2ca0fcad3..756b5bf3aa89 100644 --- a/drivers/net/sunhme.h +++ b/drivers/net/sunhme.h | |||
| @@ -407,7 +407,7 @@ struct happy_meal { | |||
| 407 | void (*write_rxd)(struct happy_meal_rxd *, u32, u32); | 407 | void (*write_rxd)(struct happy_meal_rxd *, u32, u32); |
| 408 | #endif | 408 | #endif |
| 409 | 409 | ||
| 410 | /* This is either an of_device or a pci_dev. */ | 410 | /* This is either an platform_device or a pci_dev. */ |
| 411 | void *happy_dev; | 411 | void *happy_dev; |
| 412 | struct device *dma_dev; | 412 | struct device *dma_dev; |
| 413 | 413 | ||
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c index ee364fa75634..8dcb858f2168 100644 --- a/drivers/net/sunlance.c +++ b/drivers/net/sunlance.c | |||
| @@ -250,7 +250,7 @@ struct lance_private { | |||
| 250 | int rx_new, tx_new; | 250 | int rx_new, tx_new; |
| 251 | int rx_old, tx_old; | 251 | int rx_old, tx_old; |
| 252 | 252 | ||
| 253 | struct of_device *ledma; /* If set this points to ledma */ | 253 | struct platform_device *ledma; /* If set this points to ledma */ |
| 254 | char tpe; /* cable-selection is TPE */ | 254 | char tpe; /* cable-selection is TPE */ |
| 255 | char auto_select; /* cable-selection by carrier */ | 255 | char auto_select; /* cable-selection by carrier */ |
| 256 | char burst_sizes; /* ledma SBus burst sizes */ | 256 | char burst_sizes; /* ledma SBus burst sizes */ |
| @@ -265,8 +265,8 @@ struct lance_private { | |||
| 265 | char *name; | 265 | char *name; |
| 266 | dma_addr_t init_block_dvma; | 266 | dma_addr_t init_block_dvma; |
| 267 | struct net_device *dev; /* Backpointer */ | 267 | struct net_device *dev; /* Backpointer */ |
| 268 | struct of_device *op; | 268 | struct platform_device *op; |
| 269 | struct of_device *lebuffer; | 269 | struct platform_device *lebuffer; |
| 270 | struct timer_list multicast_timer; | 270 | struct timer_list multicast_timer; |
| 271 | }; | 271 | }; |
| 272 | 272 | ||
| @@ -1272,7 +1272,7 @@ static void lance_free_hwresources(struct lance_private *lp) | |||
| 1272 | if (lp->lregs) | 1272 | if (lp->lregs) |
| 1273 | of_iounmap(&lp->op->resource[0], lp->lregs, LANCE_REG_SIZE); | 1273 | of_iounmap(&lp->op->resource[0], lp->lregs, LANCE_REG_SIZE); |
| 1274 | if (lp->dregs) { | 1274 | if (lp->dregs) { |
| 1275 | struct of_device *ledma = lp->ledma; | 1275 | struct platform_device *ledma = lp->ledma; |
| 1276 | 1276 | ||
| 1277 | of_iounmap(&ledma->resource[0], lp->dregs, | 1277 | of_iounmap(&ledma->resource[0], lp->dregs, |
| 1278 | resource_size(&ledma->resource[0])); | 1278 | resource_size(&ledma->resource[0])); |
| @@ -1319,9 +1319,9 @@ static const struct net_device_ops sparc_lance_ops = { | |||
| 1319 | .ndo_validate_addr = eth_validate_addr, | 1319 | .ndo_validate_addr = eth_validate_addr, |
| 1320 | }; | 1320 | }; |
| 1321 | 1321 | ||
| 1322 | static int __devinit sparc_lance_probe_one(struct of_device *op, | 1322 | static int __devinit sparc_lance_probe_one(struct platform_device *op, |
| 1323 | struct of_device *ledma, | 1323 | struct platform_device *ledma, |
| 1324 | struct of_device *lebuffer) | 1324 | struct platform_device *lebuffer) |
| 1325 | { | 1325 | { |
| 1326 | struct device_node *dp = op->dev.of_node; | 1326 | struct device_node *dp = op->dev.of_node; |
| 1327 | static unsigned version_printed; | 1327 | static unsigned version_printed; |
| @@ -1503,9 +1503,9 @@ fail: | |||
| 1503 | return -ENODEV; | 1503 | return -ENODEV; |
| 1504 | } | 1504 | } |
| 1505 | 1505 | ||
| 1506 | static int __devinit sunlance_sbus_probe(struct of_device *op, const struct of_device_id *match) | 1506 | static int __devinit sunlance_sbus_probe(struct platform_device *op, const struct of_device_id *match) |
| 1507 | { | 1507 | { |
| 1508 | struct of_device *parent = to_of_device(op->dev.parent); | 1508 | struct platform_device *parent = to_platform_device(op->dev.parent); |
| 1509 | struct device_node *parent_dp = parent->dev.of_node; | 1509 | struct device_node *parent_dp = parent->dev.of_node; |
| 1510 | int err; | 1510 | int err; |
| 1511 | 1511 | ||
| @@ -1519,7 +1519,7 @@ static int __devinit sunlance_sbus_probe(struct of_device *op, const struct of_d | |||
| 1519 | return err; | 1519 | return err; |
| 1520 | } | 1520 | } |
| 1521 | 1521 | ||
| 1522 | static int __devexit sunlance_sbus_remove(struct of_device *op) | 1522 | static int __devexit sunlance_sbus_remove(struct platform_device *op) |
| 1523 | { | 1523 | { |
| 1524 | struct lance_private *lp = dev_get_drvdata(&op->dev); | 1524 | struct lance_private *lp = dev_get_drvdata(&op->dev); |
| 1525 | struct net_device *net_dev = lp->dev; | 1525 | struct net_device *net_dev = lp->dev; |
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c index 5f84a5dadedd..72e65d4666ef 100644 --- a/drivers/net/sunqe.c +++ b/drivers/net/sunqe.c | |||
| @@ -689,7 +689,7 @@ static void qe_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
| 689 | { | 689 | { |
| 690 | const struct linux_prom_registers *regs; | 690 | const struct linux_prom_registers *regs; |
| 691 | struct sunqe *qep = netdev_priv(dev); | 691 | struct sunqe *qep = netdev_priv(dev); |
| 692 | struct of_device *op; | 692 | struct platform_device *op; |
| 693 | 693 | ||
| 694 | strcpy(info->driver, "sunqe"); | 694 | strcpy(info->driver, "sunqe"); |
| 695 | strcpy(info->version, "3.0"); | 695 | strcpy(info->version, "3.0"); |
| @@ -720,7 +720,7 @@ static const struct ethtool_ops qe_ethtool_ops = { | |||
| 720 | }; | 720 | }; |
| 721 | 721 | ||
| 722 | /* This is only called once at boot time for each card probed. */ | 722 | /* This is only called once at boot time for each card probed. */ |
| 723 | static void qec_init_once(struct sunqec *qecp, struct of_device *op) | 723 | static void qec_init_once(struct sunqec *qecp, struct platform_device *op) |
| 724 | { | 724 | { |
| 725 | u8 bsizes = qecp->qec_bursts; | 725 | u8 bsizes = qecp->qec_bursts; |
| 726 | 726 | ||
| @@ -770,9 +770,9 @@ static u8 __devinit qec_get_burst(struct device_node *dp) | |||
| 770 | return bsizes; | 770 | return bsizes; |
| 771 | } | 771 | } |
| 772 | 772 | ||
| 773 | static struct sunqec * __devinit get_qec(struct of_device *child) | 773 | static struct sunqec * __devinit get_qec(struct platform_device *child) |
| 774 | { | 774 | { |
| 775 | struct of_device *op = to_of_device(child->dev.parent); | 775 | struct platform_device *op = to_platform_device(child->dev.parent); |
| 776 | struct sunqec *qecp; | 776 | struct sunqec *qecp; |
| 777 | 777 | ||
| 778 | qecp = dev_get_drvdata(&op->dev); | 778 | qecp = dev_get_drvdata(&op->dev); |
| @@ -836,7 +836,7 @@ static const struct net_device_ops qec_ops = { | |||
| 836 | .ndo_validate_addr = eth_validate_addr, | 836 | .ndo_validate_addr = eth_validate_addr, |
| 837 | }; | 837 | }; |
| 838 | 838 | ||
| 839 | static int __devinit qec_ether_init(struct of_device *op) | 839 | static int __devinit qec_ether_init(struct platform_device *op) |
| 840 | { | 840 | { |
| 841 | static unsigned version_printed; | 841 | static unsigned version_printed; |
| 842 | struct net_device *dev; | 842 | struct net_device *dev; |
| @@ -941,12 +941,12 @@ fail: | |||
| 941 | return res; | 941 | return res; |
| 942 | } | 942 | } |
| 943 | 943 | ||
| 944 | static int __devinit qec_sbus_probe(struct of_device *op, const struct of_device_id *match) | 944 | static int __devinit qec_sbus_probe(struct platform_device *op, const struct of_device_id *match) |
| 945 | { | 945 | { |
| 946 | return qec_ether_init(op); | 946 | return qec_ether_init(op); |
| 947 | } | 947 | } |
| 948 | 948 | ||
| 949 | static int __devexit qec_sbus_remove(struct of_device *op) | 949 | static int __devexit qec_sbus_remove(struct platform_device *op) |
| 950 | { | 950 | { |
| 951 | struct sunqe *qp = dev_get_drvdata(&op->dev); | 951 | struct sunqe *qp = dev_get_drvdata(&op->dev); |
| 952 | struct net_device *net_dev = qp->dev; | 952 | struct net_device *net_dev = qp->dev; |
| @@ -997,7 +997,7 @@ static void __exit qec_exit(void) | |||
| 997 | 997 | ||
| 998 | while (root_qec_dev) { | 998 | while (root_qec_dev) { |
| 999 | struct sunqec *next = root_qec_dev->next_module; | 999 | struct sunqec *next = root_qec_dev->next_module; |
| 1000 | struct of_device *op = root_qec_dev->op; | 1000 | struct platform_device *op = root_qec_dev->op; |
| 1001 | 1001 | ||
| 1002 | free_irq(op->archdata.irqs[0], (void *) root_qec_dev); | 1002 | free_irq(op->archdata.irqs[0], (void *) root_qec_dev); |
| 1003 | of_iounmap(&op->resource[0], root_qec_dev->gregs, | 1003 | of_iounmap(&op->resource[0], root_qec_dev->gregs, |
diff --git a/drivers/net/sunqe.h b/drivers/net/sunqe.h index 5813a7b2faa5..581781b6b2fa 100644 --- a/drivers/net/sunqe.h +++ b/drivers/net/sunqe.h | |||
| @@ -314,7 +314,7 @@ struct sunqec { | |||
| 314 | void __iomem *gregs; /* QEC Global Registers */ | 314 | void __iomem *gregs; /* QEC Global Registers */ |
| 315 | struct sunqe *qes[4]; /* Each child MACE */ | 315 | struct sunqe *qes[4]; /* Each child MACE */ |
| 316 | unsigned int qec_bursts; /* Support burst sizes */ | 316 | unsigned int qec_bursts; /* Support burst sizes */ |
| 317 | struct of_device *op; /* QEC's OF device */ | 317 | struct platform_device *op; /* QEC's OF device */ |
| 318 | struct sunqec *next_module; /* List of all QECs in system */ | 318 | struct sunqec *next_module; /* List of all QECs in system */ |
| 319 | }; | 319 | }; |
| 320 | 320 | ||
| @@ -342,7 +342,7 @@ struct sunqe { | |||
| 342 | __u32 buffers_dvma; /* DVMA visible address. */ | 342 | __u32 buffers_dvma; /* DVMA visible address. */ |
| 343 | struct sunqec *parent; | 343 | struct sunqec *parent; |
| 344 | u8 mconfig; /* Base MACE mconfig value */ | 344 | u8 mconfig; /* Base MACE mconfig value */ |
| 345 | struct of_device *op; /* QE's OF device struct */ | 345 | struct platform_device *op; /* QE's OF device struct */ |
| 346 | struct net_device *dev; /* QE's netdevice struct */ | 346 | struct net_device *dev; /* QE's netdevice struct */ |
| 347 | int channel; /* Who am I? */ | 347 | int channel; /* Who am I? */ |
| 348 | }; | 348 | }; |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index 8d532f9b50d0..a4c3f5708246 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
| @@ -3601,7 +3601,7 @@ static void ucc_geth_timeout(struct net_device *dev) | |||
| 3601 | 3601 | ||
| 3602 | #ifdef CONFIG_PM | 3602 | #ifdef CONFIG_PM |
| 3603 | 3603 | ||
| 3604 | static int ucc_geth_suspend(struct of_device *ofdev, pm_message_t state) | 3604 | static int ucc_geth_suspend(struct platform_device *ofdev, pm_message_t state) |
| 3605 | { | 3605 | { |
| 3606 | struct net_device *ndev = dev_get_drvdata(&ofdev->dev); | 3606 | struct net_device *ndev = dev_get_drvdata(&ofdev->dev); |
| 3607 | struct ucc_geth_private *ugeth = netdev_priv(ndev); | 3607 | struct ucc_geth_private *ugeth = netdev_priv(ndev); |
| @@ -3629,7 +3629,7 @@ static int ucc_geth_suspend(struct of_device *ofdev, pm_message_t state) | |||
| 3629 | return 0; | 3629 | return 0; |
| 3630 | } | 3630 | } |
| 3631 | 3631 | ||
| 3632 | static int ucc_geth_resume(struct of_device *ofdev) | 3632 | static int ucc_geth_resume(struct platform_device *ofdev) |
| 3633 | { | 3633 | { |
| 3634 | struct net_device *ndev = dev_get_drvdata(&ofdev->dev); | 3634 | struct net_device *ndev = dev_get_drvdata(&ofdev->dev); |
| 3635 | struct ucc_geth_private *ugeth = netdev_priv(ndev); | 3635 | struct ucc_geth_private *ugeth = netdev_priv(ndev); |
| @@ -3732,7 +3732,7 @@ static const struct net_device_ops ucc_geth_netdev_ops = { | |||
| 3732 | #endif | 3732 | #endif |
| 3733 | }; | 3733 | }; |
| 3734 | 3734 | ||
| 3735 | static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *match) | 3735 | static int ucc_geth_probe(struct platform_device* ofdev, const struct of_device_id *match) |
| 3736 | { | 3736 | { |
| 3737 | struct device *device = &ofdev->dev; | 3737 | struct device *device = &ofdev->dev; |
| 3738 | struct device_node *np = ofdev->dev.of_node; | 3738 | struct device_node *np = ofdev->dev.of_node; |
| @@ -3954,7 +3954,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma | |||
| 3954 | return 0; | 3954 | return 0; |
| 3955 | } | 3955 | } |
| 3956 | 3956 | ||
| 3957 | static int ucc_geth_remove(struct of_device* ofdev) | 3957 | static int ucc_geth_remove(struct platform_device* ofdev) |
| 3958 | { | 3958 | { |
| 3959 | struct device *device = &ofdev->dev; | 3959 | struct device *device = &ofdev->dev; |
| 3960 | struct net_device *dev = dev_get_drvdata(device); | 3960 | struct net_device *dev = dev_get_drvdata(device); |
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index b2c2f391b29d..ecbbb688eba0 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c | |||
| @@ -1086,7 +1086,7 @@ static void xemaclite_remove_ndev(struct net_device *ndev) | |||
| 1086 | * | 1086 | * |
| 1087 | * Return: Value of the parameter if the parameter is found, or 0 otherwise | 1087 | * Return: Value of the parameter if the parameter is found, or 0 otherwise |
| 1088 | */ | 1088 | */ |
| 1089 | static bool get_bool(struct of_device *ofdev, const char *s) | 1089 | static bool get_bool(struct platform_device *ofdev, const char *s) |
| 1090 | { | 1090 | { |
| 1091 | u32 *p = (u32 *)of_get_property(ofdev->dev.of_node, s, NULL); | 1091 | u32 *p = (u32 *)of_get_property(ofdev->dev.of_node, s, NULL); |
| 1092 | 1092 | ||
| @@ -1115,7 +1115,7 @@ static struct net_device_ops xemaclite_netdev_ops; | |||
| 1115 | * Return: 0, if the driver is bound to the Emaclite device, or | 1115 | * Return: 0, if the driver is bound to the Emaclite device, or |
| 1116 | * a negative error if there is failure. | 1116 | * a negative error if there is failure. |
| 1117 | */ | 1117 | */ |
| 1118 | static int __devinit xemaclite_of_probe(struct of_device *ofdev, | 1118 | static int __devinit xemaclite_of_probe(struct platform_device *ofdev, |
| 1119 | const struct of_device_id *match) | 1119 | const struct of_device_id *match) |
| 1120 | { | 1120 | { |
| 1121 | struct resource r_irq; /* Interrupt resources */ | 1121 | struct resource r_irq; /* Interrupt resources */ |
| @@ -1240,7 +1240,7 @@ error2: | |||
| 1240 | * | 1240 | * |
| 1241 | * Return: 0, always. | 1241 | * Return: 0, always. |
| 1242 | */ | 1242 | */ |
| 1243 | static int __devexit xemaclite_of_remove(struct of_device *of_dev) | 1243 | static int __devexit xemaclite_of_remove(struct platform_device *of_dev) |
| 1244 | { | 1244 | { |
| 1245 | struct device *dev = &of_dev->dev; | 1245 | struct device *dev = &of_dev->dev; |
| 1246 | struct net_device *ndev = dev_get_drvdata(dev); | 1246 | struct net_device *ndev = dev_get_drvdata(dev); |
diff --git a/drivers/of/device.c b/drivers/of/device.c index 0d8a0644f540..92de0eb74aea 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | * @ids: array of of device match structures to search in | 14 | * @ids: array of of device match structures to search in |
| 15 | * @dev: the of device structure to match against | 15 | * @dev: the of device structure to match against |
| 16 | * | 16 | * |
| 17 | * Used by a driver to check whether an of_device present in the | 17 | * Used by a driver to check whether an platform_device present in the |
| 18 | * system is in its list of supported devices. | 18 | * system is in its list of supported devices. |
| 19 | */ | 19 | */ |
| 20 | const struct of_device_id *of_match_device(const struct of_device_id *matches, | 20 | const struct of_device_id *of_match_device(const struct of_device_id *matches, |
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c index 210a6441a066..55ba118f1cf1 100644 --- a/drivers/parport/parport_sunbpp.c +++ b/drivers/parport/parport_sunbpp.c | |||
| @@ -286,7 +286,7 @@ static struct parport_operations parport_sunbpp_ops = | |||
| 286 | .owner = THIS_MODULE, | 286 | .owner = THIS_MODULE, |
| 287 | }; | 287 | }; |
| 288 | 288 | ||
| 289 | static int __devinit bpp_probe(struct of_device *op, const struct of_device_id *match) | 289 | static int __devinit bpp_probe(struct platform_device *op, const struct of_device_id *match) |
| 290 | { | 290 | { |
| 291 | struct parport_operations *ops; | 291 | struct parport_operations *ops; |
| 292 | struct bpp_regs __iomem *regs; | 292 | struct bpp_regs __iomem *regs; |
| @@ -351,7 +351,7 @@ out_unmap: | |||
| 351 | return err; | 351 | return err; |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | static int __devexit bpp_remove(struct of_device *op) | 354 | static int __devexit bpp_remove(struct platform_device *op) |
| 355 | { | 355 | { |
| 356 | struct parport *p = dev_get_drvdata(&op->dev); | 356 | struct parport *p = dev_get_drvdata(&op->dev); |
| 357 | struct parport_operations *ops = p->ops; | 357 | struct parport_operations *ops = p->ops; |
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c index f94d8281cfb0..546d3024b6f0 100644 --- a/drivers/pcmcia/electra_cf.c +++ b/drivers/pcmcia/electra_cf.c | |||
| @@ -44,7 +44,7 @@ struct electra_cf_socket { | |||
| 44 | unsigned present:1; | 44 | unsigned present:1; |
| 45 | unsigned active:1; | 45 | unsigned active:1; |
| 46 | 46 | ||
| 47 | struct of_device *ofdev; | 47 | struct platform_device *ofdev; |
| 48 | unsigned long mem_phys; | 48 | unsigned long mem_phys; |
| 49 | void __iomem * mem_base; | 49 | void __iomem * mem_base; |
| 50 | unsigned long mem_size; | 50 | unsigned long mem_size; |
| @@ -181,7 +181,7 @@ static struct pccard_operations electra_cf_ops = { | |||
| 181 | .set_mem_map = electra_cf_set_mem_map, | 181 | .set_mem_map = electra_cf_set_mem_map, |
| 182 | }; | 182 | }; |
| 183 | 183 | ||
| 184 | static int __devinit electra_cf_probe(struct of_device *ofdev, | 184 | static int __devinit electra_cf_probe(struct platform_device *ofdev, |
| 185 | const struct of_device_id *match) | 185 | const struct of_device_id *match) |
| 186 | { | 186 | { |
| 187 | struct device *device = &ofdev->dev; | 187 | struct device *device = &ofdev->dev; |
| @@ -325,7 +325,7 @@ fail1: | |||
| 325 | 325 | ||
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | static int __devexit electra_cf_remove(struct of_device *ofdev) | 328 | static int __devexit electra_cf_remove(struct platform_device *ofdev) |
| 329 | { | 329 | { |
| 330 | struct device *device = &ofdev->dev; | 330 | struct device *device = &ofdev->dev; |
| 331 | struct electra_cf_socket *cf; | 331 | struct electra_cf_socket *cf; |
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index f2f90a7d3e12..f0ecad99ce81 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c | |||
| @@ -1149,7 +1149,7 @@ static struct pccard_operations m8xx_services = { | |||
| 1149 | .set_mem_map = m8xx_set_mem_map, | 1149 | .set_mem_map = m8xx_set_mem_map, |
| 1150 | }; | 1150 | }; |
| 1151 | 1151 | ||
| 1152 | static int __init m8xx_probe(struct of_device *ofdev, | 1152 | static int __init m8xx_probe(struct platform_device *ofdev, |
| 1153 | const struct of_device_id *match) | 1153 | const struct of_device_id *match) |
| 1154 | { | 1154 | { |
| 1155 | struct pcmcia_win *w; | 1155 | struct pcmcia_win *w; |
| @@ -1249,7 +1249,7 @@ static int __init m8xx_probe(struct of_device *ofdev, | |||
| 1249 | return 0; | 1249 | return 0; |
| 1250 | } | 1250 | } |
| 1251 | 1251 | ||
| 1252 | static int m8xx_remove(struct of_device *ofdev) | 1252 | static int m8xx_remove(struct platform_device *ofdev) |
| 1253 | { | 1253 | { |
| 1254 | u32 m, i; | 1254 | u32 m, i; |
| 1255 | struct pcmcia_win *w; | 1255 | struct pcmcia_win *w; |
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index db5d8c416d26..dfcdf0901d21 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c | |||
| @@ -268,7 +268,7 @@ static const struct rtc_class_ops mpc5121_rtc_ops = { | |||
| 268 | .update_irq_enable = mpc5121_rtc_update_irq_enable, | 268 | .update_irq_enable = mpc5121_rtc_update_irq_enable, |
| 269 | }; | 269 | }; |
| 270 | 270 | ||
| 271 | static int __devinit mpc5121_rtc_probe(struct of_device *op, | 271 | static int __devinit mpc5121_rtc_probe(struct platform_device *op, |
| 272 | const struct of_device_id *match) | 272 | const struct of_device_id *match) |
| 273 | { | 273 | { |
| 274 | struct mpc5121_rtc_data *rtc; | 274 | struct mpc5121_rtc_data *rtc; |
| @@ -338,7 +338,7 @@ out_free: | |||
| 338 | return err; | 338 | return err; |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | static int __devexit mpc5121_rtc_remove(struct of_device *op) | 341 | static int __devexit mpc5121_rtc_remove(struct platform_device *op) |
| 342 | { | 342 | { |
| 343 | struct mpc5121_rtc_data *rtc = dev_get_drvdata(&op->dev); | 343 | struct mpc5121_rtc_data *rtc = dev_get_drvdata(&op->dev); |
| 344 | struct mpc5121_rtc_regs __iomem *regs = rtc->regs; | 344 | struct mpc5121_rtc_regs __iomem *regs = rtc->regs; |
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c index 103fdf6b0b89..160e7510aca6 100644 --- a/drivers/sbus/char/bbc_envctrl.c +++ b/drivers/sbus/char/bbc_envctrl.c | |||
| @@ -443,7 +443,7 @@ static int kenvctrld(void *__unused) | |||
| 443 | return 0; | 443 | return 0; |
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | static void attach_one_temp(struct bbc_i2c_bus *bp, struct of_device *op, | 446 | static void attach_one_temp(struct bbc_i2c_bus *bp, struct platform_device *op, |
| 447 | int temp_idx) | 447 | int temp_idx) |
| 448 | { | 448 | { |
| 449 | struct bbc_cpu_temperature *tp; | 449 | struct bbc_cpu_temperature *tp; |
| @@ -488,7 +488,7 @@ static void attach_one_temp(struct bbc_i2c_bus *bp, struct of_device *op, | |||
| 488 | tp->fan_todo[FAN_CPU] = FAN_SAME; | 488 | tp->fan_todo[FAN_CPU] = FAN_SAME; |
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | static void attach_one_fan(struct bbc_i2c_bus *bp, struct of_device *op, | 491 | static void attach_one_fan(struct bbc_i2c_bus *bp, struct platform_device *op, |
| 492 | int fan_idx) | 492 | int fan_idx) |
| 493 | { | 493 | { |
| 494 | struct bbc_fan_control *fp; | 494 | struct bbc_fan_control *fp; |
| @@ -559,7 +559,7 @@ static void destroy_all_fans(struct bbc_i2c_bus *bp) | |||
| 559 | 559 | ||
| 560 | int bbc_envctrl_init(struct bbc_i2c_bus *bp) | 560 | int bbc_envctrl_init(struct bbc_i2c_bus *bp) |
| 561 | { | 561 | { |
| 562 | struct of_device *op; | 562 | struct platform_device *op; |
| 563 | int temp_index = 0; | 563 | int temp_index = 0; |
| 564 | int fan_index = 0; | 564 | int fan_index = 0; |
| 565 | int devidx = 0; | 565 | int devidx = 0; |
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c index 3e89c313e98d..614a5e114a19 100644 --- a/drivers/sbus/char/bbc_i2c.c +++ b/drivers/sbus/char/bbc_i2c.c | |||
| @@ -51,7 +51,7 @@ | |||
| 51 | * The second controller also connects to the smartcard reader, if present. | 51 | * The second controller also connects to the smartcard reader, if present. |
| 52 | */ | 52 | */ |
| 53 | 53 | ||
| 54 | static void set_device_claimage(struct bbc_i2c_bus *bp, struct of_device *op, int val) | 54 | static void set_device_claimage(struct bbc_i2c_bus *bp, struct platform_device *op, int val) |
| 55 | { | 55 | { |
| 56 | int i; | 56 | int i; |
| 57 | 57 | ||
| @@ -66,9 +66,9 @@ static void set_device_claimage(struct bbc_i2c_bus *bp, struct of_device *op, in | |||
| 66 | #define claim_device(BP,ECHILD) set_device_claimage(BP,ECHILD,1) | 66 | #define claim_device(BP,ECHILD) set_device_claimage(BP,ECHILD,1) |
| 67 | #define release_device(BP,ECHILD) set_device_claimage(BP,ECHILD,0) | 67 | #define release_device(BP,ECHILD) set_device_claimage(BP,ECHILD,0) |
| 68 | 68 | ||
| 69 | struct of_device *bbc_i2c_getdev(struct bbc_i2c_bus *bp, int index) | 69 | struct platform_device *bbc_i2c_getdev(struct bbc_i2c_bus *bp, int index) |
| 70 | { | 70 | { |
| 71 | struct of_device *op = NULL; | 71 | struct platform_device *op = NULL; |
| 72 | int curidx = 0, i; | 72 | int curidx = 0, i; |
| 73 | 73 | ||
| 74 | for (i = 0; i < NUM_CHILDREN; i++) { | 74 | for (i = 0; i < NUM_CHILDREN; i++) { |
| @@ -86,7 +86,7 @@ out: | |||
| 86 | return NULL; | 86 | return NULL; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | struct bbc_i2c_client *bbc_i2c_attach(struct bbc_i2c_bus *bp, struct of_device *op) | 89 | struct bbc_i2c_client *bbc_i2c_attach(struct bbc_i2c_bus *bp, struct platform_device *op) |
| 90 | { | 90 | { |
| 91 | struct bbc_i2c_client *client; | 91 | struct bbc_i2c_client *client; |
| 92 | const u32 *reg; | 92 | const u32 *reg; |
| @@ -114,7 +114,7 @@ struct bbc_i2c_client *bbc_i2c_attach(struct bbc_i2c_bus *bp, struct of_device * | |||
| 114 | void bbc_i2c_detach(struct bbc_i2c_client *client) | 114 | void bbc_i2c_detach(struct bbc_i2c_client *client) |
| 115 | { | 115 | { |
| 116 | struct bbc_i2c_bus *bp = client->bp; | 116 | struct bbc_i2c_bus *bp = client->bp; |
| 117 | struct of_device *op = client->op; | 117 | struct platform_device *op = client->op; |
| 118 | 118 | ||
| 119 | release_device(bp, op); | 119 | release_device(bp, op); |
| 120 | kfree(client); | 120 | kfree(client); |
| @@ -297,7 +297,7 @@ static void __init reset_one_i2c(struct bbc_i2c_bus *bp) | |||
| 297 | writeb(I2C_PCF_IDLE, bp->i2c_control_regs + 0x0); | 297 | writeb(I2C_PCF_IDLE, bp->i2c_control_regs + 0x0); |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | static struct bbc_i2c_bus * __init attach_one_i2c(struct of_device *op, int index) | 300 | static struct bbc_i2c_bus * __init attach_one_i2c(struct platform_device *op, int index) |
| 301 | { | 301 | { |
| 302 | struct bbc_i2c_bus *bp; | 302 | struct bbc_i2c_bus *bp; |
| 303 | struct device_node *dp; | 303 | struct device_node *dp; |
| @@ -330,7 +330,7 @@ static struct bbc_i2c_bus * __init attach_one_i2c(struct of_device *op, int inde | |||
| 330 | for (dp = op->dev.of_node->child; | 330 | for (dp = op->dev.of_node->child; |
| 331 | dp && entry < 8; | 331 | dp && entry < 8; |
| 332 | dp = dp->sibling, entry++) { | 332 | dp = dp->sibling, entry++) { |
| 333 | struct of_device *child_op; | 333 | struct platform_device *child_op; |
| 334 | 334 | ||
| 335 | child_op = of_find_device_by_node(dp); | 335 | child_op = of_find_device_by_node(dp); |
| 336 | bp->devs[entry].device = child_op; | 336 | bp->devs[entry].device = child_op; |
| @@ -361,7 +361,7 @@ fail: | |||
| 361 | extern int bbc_envctrl_init(struct bbc_i2c_bus *bp); | 361 | extern int bbc_envctrl_init(struct bbc_i2c_bus *bp); |
| 362 | extern void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp); | 362 | extern void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp); |
| 363 | 363 | ||
| 364 | static int __devinit bbc_i2c_probe(struct of_device *op, | 364 | static int __devinit bbc_i2c_probe(struct platform_device *op, |
| 365 | const struct of_device_id *match) | 365 | const struct of_device_id *match) |
| 366 | { | 366 | { |
| 367 | struct bbc_i2c_bus *bp; | 367 | struct bbc_i2c_bus *bp; |
| @@ -386,7 +386,7 @@ static int __devinit bbc_i2c_probe(struct of_device *op, | |||
| 386 | return err; | 386 | return err; |
| 387 | } | 387 | } |
| 388 | 388 | ||
| 389 | static int __devexit bbc_i2c_remove(struct of_device *op) | 389 | static int __devexit bbc_i2c_remove(struct platform_device *op) |
| 390 | { | 390 | { |
| 391 | struct bbc_i2c_bus *bp = dev_get_drvdata(&op->dev); | 391 | struct bbc_i2c_bus *bp = dev_get_drvdata(&op->dev); |
| 392 | 392 | ||
diff --git a/drivers/sbus/char/bbc_i2c.h b/drivers/sbus/char/bbc_i2c.h index 83c4811b7b5e..4b4531066e75 100644 --- a/drivers/sbus/char/bbc_i2c.h +++ b/drivers/sbus/char/bbc_i2c.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | struct bbc_i2c_client { | 8 | struct bbc_i2c_client { |
| 9 | struct bbc_i2c_bus *bp; | 9 | struct bbc_i2c_bus *bp; |
| 10 | struct of_device *op; | 10 | struct platform_device *op; |
| 11 | int bus; | 11 | int bus; |
| 12 | int address; | 12 | int address; |
| 13 | }; | 13 | }; |
| @@ -64,16 +64,16 @@ struct bbc_i2c_bus { | |||
| 64 | struct list_head temps; | 64 | struct list_head temps; |
| 65 | struct list_head fans; | 65 | struct list_head fans; |
| 66 | 66 | ||
| 67 | struct of_device *op; | 67 | struct platform_device *op; |
| 68 | struct { | 68 | struct { |
| 69 | struct of_device *device; | 69 | struct platform_device *device; |
| 70 | int client_claimed; | 70 | int client_claimed; |
| 71 | } devs[NUM_CHILDREN]; | 71 | } devs[NUM_CHILDREN]; |
| 72 | }; | 72 | }; |
| 73 | 73 | ||
| 74 | /* Probing and attachment. */ | 74 | /* Probing and attachment. */ |
| 75 | extern struct of_device *bbc_i2c_getdev(struct bbc_i2c_bus *, int); | 75 | extern struct platform_device *bbc_i2c_getdev(struct bbc_i2c_bus *, int); |
| 76 | extern struct bbc_i2c_client *bbc_i2c_attach(struct bbc_i2c_bus *bp, struct of_device *); | 76 | extern struct bbc_i2c_client *bbc_i2c_attach(struct bbc_i2c_bus *bp, struct platform_device *); |
| 77 | extern void bbc_i2c_detach(struct bbc_i2c_client *); | 77 | extern void bbc_i2c_detach(struct bbc_i2c_client *); |
| 78 | 78 | ||
| 79 | /* Register read/write. NOTE: Blocking! */ | 79 | /* Register read/write. NOTE: Blocking! */ |
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c index 47db97583ea7..1690e53fb84a 100644 --- a/drivers/sbus/char/display7seg.c +++ b/drivers/sbus/char/display7seg.c | |||
| @@ -170,7 +170,7 @@ static struct miscdevice d7s_miscdev = { | |||
| 170 | .fops = &d7s_fops | 170 | .fops = &d7s_fops |
| 171 | }; | 171 | }; |
| 172 | 172 | ||
| 173 | static int __devinit d7s_probe(struct of_device *op, | 173 | static int __devinit d7s_probe(struct platform_device *op, |
| 174 | const struct of_device_id *match) | 174 | const struct of_device_id *match) |
| 175 | { | 175 | { |
| 176 | struct device_node *opts; | 176 | struct device_node *opts; |
| @@ -236,7 +236,7 @@ out_free: | |||
| 236 | goto out; | 236 | goto out; |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | static int __devexit d7s_remove(struct of_device *op) | 239 | static int __devexit d7s_remove(struct platform_device *op) |
| 240 | { | 240 | { |
| 241 | struct d7s *p = dev_get_drvdata(&op->dev); | 241 | struct d7s *p = dev_get_drvdata(&op->dev); |
| 242 | u8 regs = readb(p->regs); | 242 | u8 regs = readb(p->regs); |
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c index 3c27f45e2b6d..078e5f4520ef 100644 --- a/drivers/sbus/char/envctrl.c +++ b/drivers/sbus/char/envctrl.c | |||
| @@ -1027,7 +1027,7 @@ static int kenvctrld(void *__unused) | |||
| 1027 | return 0; | 1027 | return 0; |
| 1028 | } | 1028 | } |
| 1029 | 1029 | ||
| 1030 | static int __devinit envctrl_probe(struct of_device *op, | 1030 | static int __devinit envctrl_probe(struct platform_device *op, |
| 1031 | const struct of_device_id *match) | 1031 | const struct of_device_id *match) |
| 1032 | { | 1032 | { |
| 1033 | struct device_node *dp; | 1033 | struct device_node *dp; |
| @@ -1104,7 +1104,7 @@ out_iounmap: | |||
| 1104 | return err; | 1104 | return err; |
| 1105 | } | 1105 | } |
| 1106 | 1106 | ||
| 1107 | static int __devexit envctrl_remove(struct of_device *op) | 1107 | static int __devexit envctrl_remove(struct platform_device *op) |
| 1108 | { | 1108 | { |
| 1109 | int index; | 1109 | int index; |
| 1110 | 1110 | ||
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c index 8bb31c584b64..2b4b4b613c48 100644 --- a/drivers/sbus/char/flash.c +++ b/drivers/sbus/char/flash.c | |||
| @@ -160,7 +160,7 @@ static const struct file_operations flash_fops = { | |||
| 160 | 160 | ||
| 161 | static struct miscdevice flash_dev = { FLASH_MINOR, "flash", &flash_fops }; | 161 | static struct miscdevice flash_dev = { FLASH_MINOR, "flash", &flash_fops }; |
| 162 | 162 | ||
| 163 | static int __devinit flash_probe(struct of_device *op, | 163 | static int __devinit flash_probe(struct platform_device *op, |
| 164 | const struct of_device_id *match) | 164 | const struct of_device_id *match) |
| 165 | { | 165 | { |
| 166 | struct device_node *dp = op->dev.of_node; | 166 | struct device_node *dp = op->dev.of_node; |
| @@ -192,7 +192,7 @@ static int __devinit flash_probe(struct of_device *op, | |||
| 192 | return misc_register(&flash_dev); | 192 | return misc_register(&flash_dev); |
| 193 | } | 193 | } |
| 194 | 194 | ||
| 195 | static int __devexit flash_remove(struct of_device *op) | 195 | static int __devexit flash_remove(struct platform_device *op) |
| 196 | { | 196 | { |
| 197 | misc_deregister(&flash_dev); | 197 | misc_deregister(&flash_dev); |
| 198 | 198 | ||
diff --git a/drivers/sbus/char/uctrl.c b/drivers/sbus/char/uctrl.c index 41eb6725ff5f..1b345be5cc02 100644 --- a/drivers/sbus/char/uctrl.c +++ b/drivers/sbus/char/uctrl.c | |||
| @@ -348,7 +348,7 @@ static void uctrl_get_external_status(struct uctrl_driver *driver) | |||
| 348 | 348 | ||
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | static int __devinit uctrl_probe(struct of_device *op, | 351 | static int __devinit uctrl_probe(struct platform_device *op, |
| 352 | const struct of_device_id *match) | 352 | const struct of_device_id *match) |
| 353 | { | 353 | { |
| 354 | struct uctrl_driver *p; | 354 | struct uctrl_driver *p; |
| @@ -404,7 +404,7 @@ out_free: | |||
| 404 | goto out; | 404 | goto out; |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | static int __devexit uctrl_remove(struct of_device *op) | 407 | static int __devexit uctrl_remove(struct platform_device *op) |
| 408 | { | 408 | { |
| 409 | struct uctrl_driver *p = dev_get_drvdata(&op->dev); | 409 | struct uctrl_driver *p = dev_get_drvdata(&op->dev); |
| 410 | 410 | ||
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 53d7ed0dc169..f8c561cf751e 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
| @@ -704,7 +704,7 @@ static void __devexit qpti_chain_del(struct qlogicpti *qpti) | |||
| 704 | 704 | ||
| 705 | static int __devinit qpti_map_regs(struct qlogicpti *qpti) | 705 | static int __devinit qpti_map_regs(struct qlogicpti *qpti) |
| 706 | { | 706 | { |
| 707 | struct of_device *op = qpti->op; | 707 | struct platform_device *op = qpti->op; |
| 708 | 708 | ||
| 709 | qpti->qregs = of_ioremap(&op->resource[0], 0, | 709 | qpti->qregs = of_ioremap(&op->resource[0], 0, |
| 710 | resource_size(&op->resource[0]), | 710 | resource_size(&op->resource[0]), |
| @@ -727,7 +727,7 @@ static int __devinit qpti_map_regs(struct qlogicpti *qpti) | |||
| 727 | 727 | ||
| 728 | static int __devinit qpti_register_irq(struct qlogicpti *qpti) | 728 | static int __devinit qpti_register_irq(struct qlogicpti *qpti) |
| 729 | { | 729 | { |
| 730 | struct of_device *op = qpti->op; | 730 | struct platform_device *op = qpti->op; |
| 731 | 731 | ||
| 732 | qpti->qhost->irq = qpti->irq = op->archdata.irqs[0]; | 732 | qpti->qhost->irq = qpti->irq = op->archdata.irqs[0]; |
| 733 | 733 | ||
| @@ -752,7 +752,7 @@ fail: | |||
| 752 | 752 | ||
| 753 | static void __devinit qpti_get_scsi_id(struct qlogicpti *qpti) | 753 | static void __devinit qpti_get_scsi_id(struct qlogicpti *qpti) |
| 754 | { | 754 | { |
| 755 | struct of_device *op = qpti->op; | 755 | struct platform_device *op = qpti->op; |
| 756 | struct device_node *dp; | 756 | struct device_node *dp; |
| 757 | 757 | ||
| 758 | dp = op->dev.of_node; | 758 | dp = op->dev.of_node; |
| @@ -773,7 +773,7 @@ static void __devinit qpti_get_scsi_id(struct qlogicpti *qpti) | |||
| 773 | 773 | ||
| 774 | static void qpti_get_bursts(struct qlogicpti *qpti) | 774 | static void qpti_get_bursts(struct qlogicpti *qpti) |
| 775 | { | 775 | { |
| 776 | struct of_device *op = qpti->op; | 776 | struct platform_device *op = qpti->op; |
| 777 | u8 bursts, bmask; | 777 | u8 bursts, bmask; |
| 778 | 778 | ||
| 779 | bursts = of_getintprop_default(op->dev.of_node, "burst-sizes", 0xff); | 779 | bursts = of_getintprop_default(op->dev.of_node, "burst-sizes", 0xff); |
| @@ -806,7 +806,7 @@ static void qpti_get_clock(struct qlogicpti *qpti) | |||
| 806 | */ | 806 | */ |
| 807 | static int __devinit qpti_map_queues(struct qlogicpti *qpti) | 807 | static int __devinit qpti_map_queues(struct qlogicpti *qpti) |
| 808 | { | 808 | { |
| 809 | struct of_device *op = qpti->op; | 809 | struct platform_device *op = qpti->op; |
| 810 | 810 | ||
| 811 | #define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) | 811 | #define QSIZE(entries) (((entries) + 1) * QUEUE_ENTRY_LEN) |
| 812 | qpti->res_cpu = dma_alloc_coherent(&op->dev, | 812 | qpti->res_cpu = dma_alloc_coherent(&op->dev, |
| @@ -1290,7 +1290,7 @@ static struct scsi_host_template qpti_template = { | |||
| 1290 | .use_clustering = ENABLE_CLUSTERING, | 1290 | .use_clustering = ENABLE_CLUSTERING, |
| 1291 | }; | 1291 | }; |
| 1292 | 1292 | ||
| 1293 | static int __devinit qpti_sbus_probe(struct of_device *op, const struct of_device_id *match) | 1293 | static int __devinit qpti_sbus_probe(struct platform_device *op, const struct of_device_id *match) |
| 1294 | { | 1294 | { |
| 1295 | struct scsi_host_template *tpnt = match->data; | 1295 | struct scsi_host_template *tpnt = match->data; |
| 1296 | struct device_node *dp = op->dev.of_node; | 1296 | struct device_node *dp = op->dev.of_node; |
| @@ -1401,7 +1401,7 @@ fail_unlink: | |||
| 1401 | return -ENODEV; | 1401 | return -ENODEV; |
| 1402 | } | 1402 | } |
| 1403 | 1403 | ||
| 1404 | static int __devexit qpti_sbus_remove(struct of_device *op) | 1404 | static int __devexit qpti_sbus_remove(struct platform_device *op) |
| 1405 | { | 1405 | { |
| 1406 | struct qlogicpti *qpti = dev_get_drvdata(&op->dev); | 1406 | struct qlogicpti *qpti = dev_get_drvdata(&op->dev); |
| 1407 | 1407 | ||
diff --git a/drivers/scsi/qlogicpti.h b/drivers/scsi/qlogicpti.h index e3c74d1ee2db..4377e87ee79c 100644 --- a/drivers/scsi/qlogicpti.h +++ b/drivers/scsi/qlogicpti.h | |||
| @@ -342,7 +342,7 @@ struct qlogicpti { | |||
| 342 | u_int req_in_ptr; /* index of next request slot */ | 342 | u_int req_in_ptr; /* index of next request slot */ |
| 343 | u_int res_out_ptr; /* index of next result slot */ | 343 | u_int res_out_ptr; /* index of next result slot */ |
| 344 | long send_marker; /* must we send a marker? */ | 344 | long send_marker; /* must we send a marker? */ |
| 345 | struct of_device *op; | 345 | struct platform_device *op; |
| 346 | unsigned long __pad; | 346 | unsigned long __pad; |
| 347 | 347 | ||
| 348 | int cmd_count[MAX_TARGETS]; | 348 | int cmd_count[MAX_TARGETS]; |
diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c index 89ba6fe02f80..193b37ba1834 100644 --- a/drivers/scsi/sun_esp.c +++ b/drivers/scsi/sun_esp.c | |||
| @@ -44,7 +44,7 @@ enum dvma_rev { | |||
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | static int __devinit esp_sbus_setup_dma(struct esp *esp, | 46 | static int __devinit esp_sbus_setup_dma(struct esp *esp, |
| 47 | struct of_device *dma_of) | 47 | struct platform_device *dma_of) |
| 48 | { | 48 | { |
| 49 | esp->dma = dma_of; | 49 | esp->dma = dma_of; |
| 50 | 50 | ||
| @@ -81,7 +81,7 @@ static int __devinit esp_sbus_setup_dma(struct esp *esp, | |||
| 81 | 81 | ||
| 82 | static int __devinit esp_sbus_map_regs(struct esp *esp, int hme) | 82 | static int __devinit esp_sbus_map_regs(struct esp *esp, int hme) |
| 83 | { | 83 | { |
| 84 | struct of_device *op = esp->dev; | 84 | struct platform_device *op = esp->dev; |
| 85 | struct resource *res; | 85 | struct resource *res; |
| 86 | 86 | ||
| 87 | /* On HME, two reg sets exist, first is DVMA, | 87 | /* On HME, two reg sets exist, first is DVMA, |
| @@ -101,7 +101,7 @@ static int __devinit esp_sbus_map_regs(struct esp *esp, int hme) | |||
| 101 | 101 | ||
| 102 | static int __devinit esp_sbus_map_command_block(struct esp *esp) | 102 | static int __devinit esp_sbus_map_command_block(struct esp *esp) |
| 103 | { | 103 | { |
| 104 | struct of_device *op = esp->dev; | 104 | struct platform_device *op = esp->dev; |
| 105 | 105 | ||
| 106 | esp->command_block = dma_alloc_coherent(&op->dev, 16, | 106 | esp->command_block = dma_alloc_coherent(&op->dev, 16, |
| 107 | &esp->command_block_dma, | 107 | &esp->command_block_dma, |
| @@ -114,15 +114,15 @@ static int __devinit esp_sbus_map_command_block(struct esp *esp) | |||
| 114 | static int __devinit esp_sbus_register_irq(struct esp *esp) | 114 | static int __devinit esp_sbus_register_irq(struct esp *esp) |
| 115 | { | 115 | { |
| 116 | struct Scsi_Host *host = esp->host; | 116 | struct Scsi_Host *host = esp->host; |
| 117 | struct of_device *op = esp->dev; | 117 | struct platform_device *op = esp->dev; |
| 118 | 118 | ||
| 119 | host->irq = op->archdata.irqs[0]; | 119 | host->irq = op->archdata.irqs[0]; |
| 120 | return request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp); | 120 | return request_irq(host->irq, scsi_esp_intr, IRQF_SHARED, "ESP", esp); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | static void __devinit esp_get_scsi_id(struct esp *esp, struct of_device *espdma) | 123 | static void __devinit esp_get_scsi_id(struct esp *esp, struct platform_device *espdma) |
| 124 | { | 124 | { |
| 125 | struct of_device *op = esp->dev; | 125 | struct platform_device *op = esp->dev; |
| 126 | struct device_node *dp; | 126 | struct device_node *dp; |
| 127 | 127 | ||
| 128 | dp = op->dev.of_node; | 128 | dp = op->dev.of_node; |
| @@ -144,7 +144,7 @@ done: | |||
| 144 | 144 | ||
| 145 | static void __devinit esp_get_differential(struct esp *esp) | 145 | static void __devinit esp_get_differential(struct esp *esp) |
| 146 | { | 146 | { |
| 147 | struct of_device *op = esp->dev; | 147 | struct platform_device *op = esp->dev; |
| 148 | struct device_node *dp; | 148 | struct device_node *dp; |
| 149 | 149 | ||
| 150 | dp = op->dev.of_node; | 150 | dp = op->dev.of_node; |
| @@ -156,7 +156,7 @@ static void __devinit esp_get_differential(struct esp *esp) | |||
| 156 | 156 | ||
| 157 | static void __devinit esp_get_clock_params(struct esp *esp) | 157 | static void __devinit esp_get_clock_params(struct esp *esp) |
| 158 | { | 158 | { |
| 159 | struct of_device *op = esp->dev; | 159 | struct platform_device *op = esp->dev; |
| 160 | struct device_node *bus_dp, *dp; | 160 | struct device_node *bus_dp, *dp; |
| 161 | int fmhz; | 161 | int fmhz; |
| 162 | 162 | ||
| @@ -170,10 +170,10 @@ static void __devinit esp_get_clock_params(struct esp *esp) | |||
| 170 | esp->cfreq = fmhz; | 170 | esp->cfreq = fmhz; |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | static void __devinit esp_get_bursts(struct esp *esp, struct of_device *dma_of) | 173 | static void __devinit esp_get_bursts(struct esp *esp, struct platform_device *dma_of) |
| 174 | { | 174 | { |
| 175 | struct device_node *dma_dp = dma_of->dev.of_node; | 175 | struct device_node *dma_dp = dma_of->dev.of_node; |
| 176 | struct of_device *op = esp->dev; | 176 | struct platform_device *op = esp->dev; |
| 177 | struct device_node *dp; | 177 | struct device_node *dp; |
| 178 | u8 bursts, val; | 178 | u8 bursts, val; |
| 179 | 179 | ||
| @@ -195,7 +195,7 @@ static void __devinit esp_get_bursts(struct esp *esp, struct of_device *dma_of) | |||
| 195 | esp->bursts = bursts; | 195 | esp->bursts = bursts; |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | static void __devinit esp_sbus_get_props(struct esp *esp, struct of_device *espdma) | 198 | static void __devinit esp_sbus_get_props(struct esp *esp, struct platform_device *espdma) |
| 199 | { | 199 | { |
| 200 | esp_get_scsi_id(esp, espdma); | 200 | esp_get_scsi_id(esp, espdma); |
| 201 | esp_get_differential(esp); | 201 | esp_get_differential(esp); |
| @@ -216,7 +216,7 @@ static u8 sbus_esp_read8(struct esp *esp, unsigned long reg) | |||
| 216 | static dma_addr_t sbus_esp_map_single(struct esp *esp, void *buf, | 216 | static dma_addr_t sbus_esp_map_single(struct esp *esp, void *buf, |
| 217 | size_t sz, int dir) | 217 | size_t sz, int dir) |
| 218 | { | 218 | { |
| 219 | struct of_device *op = esp->dev; | 219 | struct platform_device *op = esp->dev; |
| 220 | 220 | ||
| 221 | return dma_map_single(&op->dev, buf, sz, dir); | 221 | return dma_map_single(&op->dev, buf, sz, dir); |
| 222 | } | 222 | } |
| @@ -224,7 +224,7 @@ static dma_addr_t sbus_esp_map_single(struct esp *esp, void *buf, | |||
| 224 | static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg, | 224 | static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg, |
| 225 | int num_sg, int dir) | 225 | int num_sg, int dir) |
| 226 | { | 226 | { |
| 227 | struct of_device *op = esp->dev; | 227 | struct platform_device *op = esp->dev; |
| 228 | 228 | ||
| 229 | return dma_map_sg(&op->dev, sg, num_sg, dir); | 229 | return dma_map_sg(&op->dev, sg, num_sg, dir); |
| 230 | } | 230 | } |
| @@ -232,7 +232,7 @@ static int sbus_esp_map_sg(struct esp *esp, struct scatterlist *sg, | |||
| 232 | static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr, | 232 | static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr, |
| 233 | size_t sz, int dir) | 233 | size_t sz, int dir) |
| 234 | { | 234 | { |
| 235 | struct of_device *op = esp->dev; | 235 | struct platform_device *op = esp->dev; |
| 236 | 236 | ||
| 237 | dma_unmap_single(&op->dev, addr, sz, dir); | 237 | dma_unmap_single(&op->dev, addr, sz, dir); |
| 238 | } | 238 | } |
| @@ -240,7 +240,7 @@ static void sbus_esp_unmap_single(struct esp *esp, dma_addr_t addr, | |||
| 240 | static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, | 240 | static void sbus_esp_unmap_sg(struct esp *esp, struct scatterlist *sg, |
| 241 | int num_sg, int dir) | 241 | int num_sg, int dir) |
| 242 | { | 242 | { |
| 243 | struct of_device *op = esp->dev; | 243 | struct platform_device *op = esp->dev; |
| 244 | 244 | ||
| 245 | dma_unmap_sg(&op->dev, sg, num_sg, dir); | 245 | dma_unmap_sg(&op->dev, sg, num_sg, dir); |
| 246 | } | 246 | } |
| @@ -256,7 +256,7 @@ static void sbus_esp_reset_dma(struct esp *esp) | |||
| 256 | { | 256 | { |
| 257 | int can_do_burst16, can_do_burst32, can_do_burst64; | 257 | int can_do_burst16, can_do_burst32, can_do_burst64; |
| 258 | int can_do_sbus64, lim; | 258 | int can_do_sbus64, lim; |
| 259 | struct of_device *op; | 259 | struct platform_device *op; |
| 260 | u32 val; | 260 | u32 val; |
| 261 | 261 | ||
| 262 | can_do_burst16 = (esp->bursts & DMA_BURST16) != 0; | 262 | can_do_burst16 = (esp->bursts & DMA_BURST16) != 0; |
| @@ -487,8 +487,8 @@ static const struct esp_driver_ops sbus_esp_ops = { | |||
| 487 | .dma_error = sbus_esp_dma_error, | 487 | .dma_error = sbus_esp_dma_error, |
| 488 | }; | 488 | }; |
| 489 | 489 | ||
| 490 | static int __devinit esp_sbus_probe_one(struct of_device *op, | 490 | static int __devinit esp_sbus_probe_one(struct platform_device *op, |
| 491 | struct of_device *espdma, | 491 | struct platform_device *espdma, |
| 492 | int hme) | 492 | int hme) |
| 493 | { | 493 | { |
| 494 | struct scsi_host_template *tpnt = &scsi_esp_template; | 494 | struct scsi_host_template *tpnt = &scsi_esp_template; |
| @@ -562,11 +562,11 @@ fail: | |||
| 562 | return err; | 562 | return err; |
| 563 | } | 563 | } |
| 564 | 564 | ||
| 565 | static int __devinit esp_sbus_probe(struct of_device *op, const struct of_device_id *match) | 565 | static int __devinit esp_sbus_probe(struct platform_device *op, const struct of_device_id *match) |
| 566 | { | 566 | { |
| 567 | struct device_node *dma_node = NULL; | 567 | struct device_node *dma_node = NULL; |
| 568 | struct device_node *dp = op->dev.of_node; | 568 | struct device_node *dp = op->dev.of_node; |
| 569 | struct of_device *dma_of = NULL; | 569 | struct platform_device *dma_of = NULL; |
| 570 | int hme = 0; | 570 | int hme = 0; |
| 571 | 571 | ||
| 572 | if (dp->parent && | 572 | if (dp->parent && |
| @@ -585,10 +585,10 @@ static int __devinit esp_sbus_probe(struct of_device *op, const struct of_device | |||
| 585 | return esp_sbus_probe_one(op, dma_of, hme); | 585 | return esp_sbus_probe_one(op, dma_of, hme); |
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | static int __devexit esp_sbus_remove(struct of_device *op) | 588 | static int __devexit esp_sbus_remove(struct platform_device *op) |
| 589 | { | 589 | { |
| 590 | struct esp *esp = dev_get_drvdata(&op->dev); | 590 | struct esp *esp = dev_get_drvdata(&op->dev); |
| 591 | struct of_device *dma_of = esp->dma; | 591 | struct platform_device *dma_of = esp->dma; |
| 592 | unsigned int irq = esp->host->irq; | 592 | unsigned int irq = esp->host->irq; |
| 593 | bool is_hme; | 593 | bool is_hme; |
| 594 | u32 val; | 594 | u32 val; |
diff --git a/drivers/serial/apbuart.c b/drivers/serial/apbuart.c index 0099b8692b60..cc01c650a144 100644 --- a/drivers/serial/apbuart.c +++ b/drivers/serial/apbuart.c | |||
| @@ -551,7 +551,7 @@ static struct uart_driver grlib_apbuart_driver = { | |||
| 551 | /* OF Platform Driver */ | 551 | /* OF Platform Driver */ |
| 552 | /* ======================================================================== */ | 552 | /* ======================================================================== */ |
| 553 | 553 | ||
| 554 | static int __devinit apbuart_probe(struct of_device *op, | 554 | static int __devinit apbuart_probe(struct platform_device *op, |
| 555 | const struct of_device_id *match) | 555 | const struct of_device_id *match) |
| 556 | { | 556 | { |
| 557 | int i = -1; | 557 | int i = -1; |
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c index 6016179db533..f2b8adcc6c92 100644 --- a/drivers/serial/cpm_uart/cpm_uart_core.c +++ b/drivers/serial/cpm_uart/cpm_uart_core.c | |||
| @@ -1340,7 +1340,7 @@ static struct uart_driver cpm_reg = { | |||
| 1340 | 1340 | ||
| 1341 | static int probe_index; | 1341 | static int probe_index; |
| 1342 | 1342 | ||
| 1343 | static int __devinit cpm_uart_probe(struct of_device *ofdev, | 1343 | static int __devinit cpm_uart_probe(struct platform_device *ofdev, |
| 1344 | const struct of_device_id *match) | 1344 | const struct of_device_id *match) |
| 1345 | { | 1345 | { |
| 1346 | int index = probe_index++; | 1346 | int index = probe_index++; |
| @@ -1364,7 +1364,7 @@ static int __devinit cpm_uart_probe(struct of_device *ofdev, | |||
| 1364 | return uart_add_one_port(&cpm_reg, &pinfo->port); | 1364 | return uart_add_one_port(&cpm_reg, &pinfo->port); |
| 1365 | } | 1365 | } |
| 1366 | 1366 | ||
| 1367 | static int __devexit cpm_uart_remove(struct of_device *ofdev) | 1367 | static int __devexit cpm_uart_remove(struct platform_device *ofdev) |
| 1368 | { | 1368 | { |
| 1369 | struct uart_cpm_port *pinfo = dev_get_drvdata(&ofdev->dev); | 1369 | struct uart_cpm_port *pinfo = dev_get_drvdata(&ofdev->dev); |
| 1370 | return uart_remove_one_port(&cpm_reg, &pinfo->port); | 1370 | return uart_remove_one_port(&cpm_reg, &pinfo->port); |
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 1a88b363005c..8dedb266f143 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
| @@ -1298,7 +1298,7 @@ static struct of_device_id mpc52xx_uart_of_match[] = { | |||
| 1298 | }; | 1298 | }; |
| 1299 | 1299 | ||
| 1300 | static int __devinit | 1300 | static int __devinit |
| 1301 | mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match) | 1301 | mpc52xx_uart_of_probe(struct platform_device *op, const struct of_device_id *match) |
| 1302 | { | 1302 | { |
| 1303 | int idx = -1; | 1303 | int idx = -1; |
| 1304 | unsigned int uartclk; | 1304 | unsigned int uartclk; |
| @@ -1369,7 +1369,7 @@ mpc52xx_uart_of_probe(struct of_device *op, const struct of_device_id *match) | |||
| 1369 | } | 1369 | } |
| 1370 | 1370 | ||
| 1371 | static int | 1371 | static int |
| 1372 | mpc52xx_uart_of_remove(struct of_device *op) | 1372 | mpc52xx_uart_of_remove(struct platform_device *op) |
| 1373 | { | 1373 | { |
| 1374 | struct uart_port *port = dev_get_drvdata(&op->dev); | 1374 | struct uart_port *port = dev_get_drvdata(&op->dev); |
| 1375 | dev_set_drvdata(&op->dev, NULL); | 1375 | dev_set_drvdata(&op->dev, NULL); |
| @@ -1382,7 +1382,7 @@ mpc52xx_uart_of_remove(struct of_device *op) | |||
| 1382 | 1382 | ||
| 1383 | #ifdef CONFIG_PM | 1383 | #ifdef CONFIG_PM |
| 1384 | static int | 1384 | static int |
| 1385 | mpc52xx_uart_of_suspend(struct of_device *op, pm_message_t state) | 1385 | mpc52xx_uart_of_suspend(struct platform_device *op, pm_message_t state) |
| 1386 | { | 1386 | { |
| 1387 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(&op->dev); | 1387 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(&op->dev); |
| 1388 | 1388 | ||
| @@ -1393,7 +1393,7 @@ mpc52xx_uart_of_suspend(struct of_device *op, pm_message_t state) | |||
| 1393 | } | 1393 | } |
| 1394 | 1394 | ||
| 1395 | static int | 1395 | static int |
| 1396 | mpc52xx_uart_of_resume(struct of_device *op) | 1396 | mpc52xx_uart_of_resume(struct platform_device *op) |
| 1397 | { | 1397 | { |
| 1398 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(&op->dev); | 1398 | struct uart_port *port = (struct uart_port *) dev_get_drvdata(&op->dev); |
| 1399 | 1399 | ||
diff --git a/drivers/serial/nwpserial.c b/drivers/serial/nwpserial.c index e65b0d9202a5..de173671e3d0 100644 --- a/drivers/serial/nwpserial.c +++ b/drivers/serial/nwpserial.c | |||
| @@ -344,7 +344,7 @@ int nwpserial_register_port(struct uart_port *port) | |||
| 344 | 344 | ||
| 345 | mutex_lock(&nwpserial_mutex); | 345 | mutex_lock(&nwpserial_mutex); |
| 346 | 346 | ||
| 347 | dn = to_of_device(port->dev)->dev.of_node; | 347 | dn = port->dev->of_node; |
| 348 | if (dn == NULL) | 348 | if (dn == NULL) |
| 349 | goto out; | 349 | goto out; |
| 350 | 350 | ||
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c index a48d9080f552..659a695bdad6 100644 --- a/drivers/serial/of_serial.c +++ b/drivers/serial/of_serial.c | |||
| @@ -27,7 +27,7 @@ struct of_serial_info { | |||
| 27 | /* | 27 | /* |
| 28 | * Fill a struct uart_port for a given device node | 28 | * Fill a struct uart_port for a given device node |
| 29 | */ | 29 | */ |
| 30 | static int __devinit of_platform_serial_setup(struct of_device *ofdev, | 30 | static int __devinit of_platform_serial_setup(struct platform_device *ofdev, |
| 31 | int type, struct uart_port *port) | 31 | int type, struct uart_port *port) |
| 32 | { | 32 | { |
| 33 | struct resource resource; | 33 | struct resource resource; |
| @@ -80,7 +80,7 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev, | |||
| 80 | /* | 80 | /* |
| 81 | * Try to register a serial port | 81 | * Try to register a serial port |
| 82 | */ | 82 | */ |
| 83 | static int __devinit of_platform_serial_probe(struct of_device *ofdev, | 83 | static int __devinit of_platform_serial_probe(struct platform_device *ofdev, |
| 84 | const struct of_device_id *id) | 84 | const struct of_device_id *id) |
| 85 | { | 85 | { |
| 86 | struct of_serial_info *info; | 86 | struct of_serial_info *info; |
| @@ -134,7 +134,7 @@ out: | |||
| 134 | /* | 134 | /* |
| 135 | * Release a line | 135 | * Release a line |
| 136 | */ | 136 | */ |
| 137 | static int of_platform_serial_remove(struct of_device *ofdev) | 137 | static int of_platform_serial_remove(struct platform_device *ofdev) |
| 138 | { | 138 | { |
| 139 | struct of_serial_info *info = dev_get_drvdata(&ofdev->dev); | 139 | struct of_serial_info *info = dev_get_drvdata(&ofdev->dev); |
| 140 | switch (info->type) { | 140 | switch (info->type) { |
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c index a779e22d213e..c9014868297d 100644 --- a/drivers/serial/sunhv.c +++ b/drivers/serial/sunhv.c | |||
| @@ -519,7 +519,7 @@ static struct console sunhv_console = { | |||
| 519 | .data = &sunhv_reg, | 519 | .data = &sunhv_reg, |
| 520 | }; | 520 | }; |
| 521 | 521 | ||
| 522 | static int __devinit hv_probe(struct of_device *op, const struct of_device_id *match) | 522 | static int __devinit hv_probe(struct platform_device *op, const struct of_device_id *match) |
| 523 | { | 523 | { |
| 524 | struct uart_port *port; | 524 | struct uart_port *port; |
| 525 | unsigned long minor; | 525 | unsigned long minor; |
| @@ -598,7 +598,7 @@ out_free_port: | |||
| 598 | return err; | 598 | return err; |
| 599 | } | 599 | } |
| 600 | 600 | ||
| 601 | static int __devexit hv_remove(struct of_device *dev) | 601 | static int __devexit hv_remove(struct platform_device *dev) |
| 602 | { | 602 | { |
| 603 | struct uart_port *port = dev_get_drvdata(&dev->dev); | 603 | struct uart_port *port = dev_get_drvdata(&dev->dev); |
| 604 | 604 | ||
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index 9845fb1cfb1f..5b246b18f42f 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
| @@ -883,7 +883,7 @@ static int sunsab_console_setup(struct console *con, char *options) | |||
| 883 | printk("Console: ttyS%d (SAB82532)\n", | 883 | printk("Console: ttyS%d (SAB82532)\n", |
| 884 | (sunsab_reg.minor - 64) + con->index); | 884 | (sunsab_reg.minor - 64) + con->index); |
| 885 | 885 | ||
| 886 | sunserial_console_termios(con, to_of_device(up->port.dev)->dev.of_node); | 886 | sunserial_console_termios(con, up->port.dev->of_node); |
| 887 | 887 | ||
| 888 | switch (con->cflag & CBAUD) { | 888 | switch (con->cflag & CBAUD) { |
| 889 | case B150: baud = 150; break; | 889 | case B150: baud = 150; break; |
| @@ -954,7 +954,7 @@ static inline struct console *SUNSAB_CONSOLE(void) | |||
| 954 | #endif | 954 | #endif |
| 955 | 955 | ||
| 956 | static int __devinit sunsab_init_one(struct uart_sunsab_port *up, | 956 | static int __devinit sunsab_init_one(struct uart_sunsab_port *up, |
| 957 | struct of_device *op, | 957 | struct platform_device *op, |
| 958 | unsigned long offset, | 958 | unsigned long offset, |
| 959 | int line) | 959 | int line) |
| 960 | { | 960 | { |
| @@ -1006,7 +1006,7 @@ static int __devinit sunsab_init_one(struct uart_sunsab_port *up, | |||
| 1006 | return 0; | 1006 | return 0; |
| 1007 | } | 1007 | } |
| 1008 | 1008 | ||
| 1009 | static int __devinit sab_probe(struct of_device *op, const struct of_device_id *match) | 1009 | static int __devinit sab_probe(struct platform_device *op, const struct of_device_id *match) |
| 1010 | { | 1010 | { |
| 1011 | static int inst; | 1011 | static int inst; |
| 1012 | struct uart_sunsab_port *up; | 1012 | struct uart_sunsab_port *up; |
| @@ -1062,7 +1062,7 @@ out: | |||
| 1062 | return err; | 1062 | return err; |
| 1063 | } | 1063 | } |
| 1064 | 1064 | ||
| 1065 | static int __devexit sab_remove(struct of_device *op) | 1065 | static int __devexit sab_remove(struct platform_device *op) |
| 1066 | { | 1066 | { |
| 1067 | struct uart_sunsab_port *up = dev_get_drvdata(&op->dev); | 1067 | struct uart_sunsab_port *up = dev_get_drvdata(&op->dev); |
| 1068 | 1068 | ||
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 3cdf74822db5..551ebfe3ccbb 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
| @@ -1200,7 +1200,7 @@ static int __devinit sunsu_kbd_ms_init(struct uart_sunsu_port *up) | |||
| 1200 | return -ENODEV; | 1200 | return -ENODEV; |
| 1201 | 1201 | ||
| 1202 | printk("%s: %s port at %llx, irq %u\n", | 1202 | printk("%s: %s port at %llx, irq %u\n", |
| 1203 | to_of_device(up->port.dev)->dev.of_node->full_name, | 1203 | up->port.dev->of_node->full_name, |
| 1204 | (up->su_type == SU_PORT_KBD) ? "Keyboard" : "Mouse", | 1204 | (up->su_type == SU_PORT_KBD) ? "Keyboard" : "Mouse", |
| 1205 | (unsigned long long) up->port.mapbase, | 1205 | (unsigned long long) up->port.mapbase, |
| 1206 | up->port.irq); | 1206 | up->port.irq); |
| @@ -1352,7 +1352,7 @@ static int __init sunsu_console_setup(struct console *co, char *options) | |||
| 1352 | spin_lock_init(&port->lock); | 1352 | spin_lock_init(&port->lock); |
| 1353 | 1353 | ||
| 1354 | /* Get firmware console settings. */ | 1354 | /* Get firmware console settings. */ |
| 1355 | sunserial_console_termios(co, to_of_device(port->dev)->dev.of_node); | 1355 | sunserial_console_termios(co, port->dev->of_node); |
| 1356 | 1356 | ||
| 1357 | memset(&termios, 0, sizeof(struct ktermios)); | 1357 | memset(&termios, 0, sizeof(struct ktermios)); |
| 1358 | termios.c_cflag = co->cflag; | 1358 | termios.c_cflag = co->cflag; |
| @@ -1406,7 +1406,7 @@ static enum su_type __devinit su_get_type(struct device_node *dp) | |||
| 1406 | return SU_PORT_PORT; | 1406 | return SU_PORT_PORT; |
| 1407 | } | 1407 | } |
| 1408 | 1408 | ||
| 1409 | static int __devinit su_probe(struct of_device *op, const struct of_device_id *match) | 1409 | static int __devinit su_probe(struct platform_device *op, const struct of_device_id *match) |
| 1410 | { | 1410 | { |
| 1411 | static int inst; | 1411 | static int inst; |
| 1412 | struct device_node *dp = op->dev.of_node; | 1412 | struct device_node *dp = op->dev.of_node; |
| @@ -1497,7 +1497,7 @@ out_unmap: | |||
| 1497 | return err; | 1497 | return err; |
| 1498 | } | 1498 | } |
| 1499 | 1499 | ||
| 1500 | static int __devexit su_remove(struct of_device *op) | 1500 | static int __devexit su_remove(struct platform_device *op) |
| 1501 | { | 1501 | { |
| 1502 | struct uart_sunsu_port *up = dev_get_drvdata(&op->dev); | 1502 | struct uart_sunsu_port *up = dev_get_drvdata(&op->dev); |
| 1503 | bool kbdms = false; | 1503 | bool kbdms = false; |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index d1e6bcb59546..c1967ac1c07f 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
| @@ -1230,7 +1230,7 @@ static int __init sunzilog_console_setup(struct console *con, char *options) | |||
| 1230 | (sunzilog_reg.minor - 64) + con->index, con->index); | 1230 | (sunzilog_reg.minor - 64) + con->index, con->index); |
| 1231 | 1231 | ||
| 1232 | /* Get firmware console settings. */ | 1232 | /* Get firmware console settings. */ |
| 1233 | sunserial_console_termios(con, to_of_device(up->port.dev)->dev.of_node); | 1233 | sunserial_console_termios(con, up->port.dev->of_node); |
| 1234 | 1234 | ||
| 1235 | /* Firmware console speed is limited to 150-->38400 baud so | 1235 | /* Firmware console speed is limited to 150-->38400 baud so |
| 1236 | * this hackish cflag thing is OK. | 1236 | * this hackish cflag thing is OK. |
| @@ -1399,7 +1399,7 @@ static void __devinit sunzilog_init_hw(struct uart_sunzilog_port *up) | |||
| 1399 | 1399 | ||
| 1400 | static int zilog_irq = -1; | 1400 | static int zilog_irq = -1; |
| 1401 | 1401 | ||
| 1402 | static int __devinit zs_probe(struct of_device *op, const struct of_device_id *match) | 1402 | static int __devinit zs_probe(struct platform_device *op, const struct of_device_id *match) |
| 1403 | { | 1403 | { |
| 1404 | static int kbm_inst, uart_inst; | 1404 | static int kbm_inst, uart_inst; |
| 1405 | int inst; | 1405 | int inst; |
| @@ -1516,7 +1516,7 @@ static void __devexit zs_remove_one(struct uart_sunzilog_port *up) | |||
| 1516 | uart_remove_one_port(&sunzilog_reg, &up->port); | 1516 | uart_remove_one_port(&sunzilog_reg, &up->port); |
| 1517 | } | 1517 | } |
| 1518 | 1518 | ||
| 1519 | static int __devexit zs_remove(struct of_device *op) | 1519 | static int __devexit zs_remove(struct platform_device *op) |
| 1520 | { | 1520 | { |
| 1521 | struct uart_sunzilog_port *up = dev_get_drvdata(&op->dev); | 1521 | struct uart_sunzilog_port *up = dev_get_drvdata(&op->dev); |
| 1522 | struct zilog_layout __iomem *regs; | 1522 | struct zilog_layout __iomem *regs; |
diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c index caf085d3a76a..9b03d7b3e456 100644 --- a/drivers/serial/uartlite.c +++ b/drivers/serial/uartlite.c | |||
| @@ -584,7 +584,7 @@ static struct platform_driver ulite_platform_driver = { | |||
| 584 | */ | 584 | */ |
| 585 | #if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE)) | 585 | #if defined(CONFIG_OF) && (defined(CONFIG_PPC32) || defined(CONFIG_MICROBLAZE)) |
| 586 | static int __devinit | 586 | static int __devinit |
| 587 | ulite_of_probe(struct of_device *op, const struct of_device_id *match) | 587 | ulite_of_probe(struct platform_device *op, const struct of_device_id *match) |
| 588 | { | 588 | { |
| 589 | struct resource res; | 589 | struct resource res; |
| 590 | const unsigned int *id; | 590 | const unsigned int *id; |
| @@ -605,7 +605,7 @@ ulite_of_probe(struct of_device *op, const struct of_device_id *match) | |||
| 605 | return ulite_assign(&op->dev, id ? *id : -1, res.start, irq); | 605 | return ulite_assign(&op->dev, id ? *id : -1, res.start, irq); |
| 606 | } | 606 | } |
| 607 | 607 | ||
| 608 | static int __devexit ulite_of_remove(struct of_device *op) | 608 | static int __devexit ulite_of_remove(struct platform_device *op) |
| 609 | { | 609 | { |
| 610 | return ulite_release(&op->dev); | 610 | return ulite_release(&op->dev); |
| 611 | } | 611 | } |
diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c index 907b06f5c447..3f4848e2174a 100644 --- a/drivers/serial/ucc_uart.c +++ b/drivers/serial/ucc_uart.c | |||
| @@ -1194,7 +1194,7 @@ static void uart_firmware_cont(const struct firmware *fw, void *context) | |||
| 1194 | release_firmware(fw); | 1194 | release_firmware(fw); |
| 1195 | } | 1195 | } |
| 1196 | 1196 | ||
| 1197 | static int ucc_uart_probe(struct of_device *ofdev, | 1197 | static int ucc_uart_probe(struct platform_device *ofdev, |
| 1198 | const struct of_device_id *match) | 1198 | const struct of_device_id *match) |
| 1199 | { | 1199 | { |
| 1200 | struct device_node *np = ofdev->dev.of_node; | 1200 | struct device_node *np = ofdev->dev.of_node; |
| @@ -1462,7 +1462,7 @@ static int ucc_uart_probe(struct of_device *ofdev, | |||
| 1462 | return 0; | 1462 | return 0; |
| 1463 | } | 1463 | } |
| 1464 | 1464 | ||
| 1465 | static int ucc_uart_remove(struct of_device *ofdev) | 1465 | static int ucc_uart_remove(struct platform_device *ofdev) |
| 1466 | { | 1466 | { |
| 1467 | struct uart_qe_port *qe_port = dev_get_drvdata(&ofdev->dev); | 1467 | struct uart_qe_port *qe_port = dev_get_drvdata(&ofdev->dev); |
| 1468 | 1468 | ||
diff --git a/drivers/spi/mpc512x_psc_spi.c b/drivers/spi/mpc512x_psc_spi.c index 10baac3f8ea5..cddbfceb324f 100644 --- a/drivers/spi/mpc512x_psc_spi.c +++ b/drivers/spi/mpc512x_psc_spi.c | |||
| @@ -507,7 +507,7 @@ static int __exit mpc512x_psc_spi_do_remove(struct device *dev) | |||
| 507 | return 0; | 507 | return 0; |
| 508 | } | 508 | } |
| 509 | 509 | ||
| 510 | static int __init mpc512x_psc_spi_of_probe(struct of_device *op, | 510 | static int __init mpc512x_psc_spi_of_probe(struct platform_device *op, |
| 511 | const struct of_device_id *match) | 511 | const struct of_device_id *match) |
| 512 | { | 512 | { |
| 513 | const u32 *regaddr_p; | 513 | const u32 *regaddr_p; |
| @@ -539,7 +539,7 @@ static int __init mpc512x_psc_spi_of_probe(struct of_device *op, | |||
| 539 | irq_of_parse_and_map(op->dev.of_node, 0), id); | 539 | irq_of_parse_and_map(op->dev.of_node, 0), id); |
| 540 | } | 540 | } |
| 541 | 541 | ||
| 542 | static int __exit mpc512x_psc_spi_of_remove(struct of_device *op) | 542 | static int __exit mpc512x_psc_spi_of_remove(struct platform_device *op) |
| 543 | { | 543 | { |
| 544 | return mpc512x_psc_spi_do_remove(&op->dev); | 544 | return mpc512x_psc_spi_do_remove(&op->dev); |
| 545 | } | 545 | } |
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index 66d170147dcc..983fbbfce76e 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c | |||
| @@ -465,7 +465,7 @@ static int __exit mpc52xx_psc_spi_do_remove(struct device *dev) | |||
| 465 | return 0; | 465 | return 0; |
| 466 | } | 466 | } |
| 467 | 467 | ||
| 468 | static int __init mpc52xx_psc_spi_of_probe(struct of_device *op, | 468 | static int __init mpc52xx_psc_spi_of_probe(struct platform_device *op, |
| 469 | const struct of_device_id *match) | 469 | const struct of_device_id *match) |
| 470 | { | 470 | { |
| 471 | const u32 *regaddr_p; | 471 | const u32 *regaddr_p; |
| @@ -495,7 +495,7 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op, | |||
| 495 | irq_of_parse_and_map(op->dev.of_node, 0), id); | 495 | irq_of_parse_and_map(op->dev.of_node, 0), id); |
| 496 | } | 496 | } |
| 497 | 497 | ||
| 498 | static int __exit mpc52xx_psc_spi_of_remove(struct of_device *op) | 498 | static int __exit mpc52xx_psc_spi_of_remove(struct platform_device *op) |
| 499 | { | 499 | { |
| 500 | return mpc52xx_psc_spi_do_remove(&op->dev); | 500 | return mpc52xx_psc_spi_do_remove(&op->dev); |
| 501 | } | 501 | } |
diff --git a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c index 56136ff00e01..ec9f0b1bf864 100644 --- a/drivers/spi/mpc52xx_spi.c +++ b/drivers/spi/mpc52xx_spi.c | |||
| @@ -390,7 +390,7 @@ static int mpc52xx_spi_transfer(struct spi_device *spi, struct spi_message *m) | |||
| 390 | /* | 390 | /* |
| 391 | * OF Platform Bus Binding | 391 | * OF Platform Bus Binding |
| 392 | */ | 392 | */ |
| 393 | static int __devinit mpc52xx_spi_probe(struct of_device *op, | 393 | static int __devinit mpc52xx_spi_probe(struct platform_device *op, |
| 394 | const struct of_device_id *match) | 394 | const struct of_device_id *match) |
| 395 | { | 395 | { |
| 396 | struct spi_master *master; | 396 | struct spi_master *master; |
| @@ -530,7 +530,7 @@ static int __devinit mpc52xx_spi_probe(struct of_device *op, | |||
| 530 | return rc; | 530 | return rc; |
| 531 | } | 531 | } |
| 532 | 532 | ||
| 533 | static int __devexit mpc52xx_spi_remove(struct of_device *op) | 533 | static int __devexit mpc52xx_spi_remove(struct platform_device *op) |
| 534 | { | 534 | { |
| 535 | struct spi_master *master = dev_get_drvdata(&op->dev); | 535 | struct spi_master *master = dev_get_drvdata(&op->dev); |
| 536 | struct mpc52xx_spi *ms = spi_master_get_devdata(master); | 536 | struct mpc52xx_spi *ms = spi_master_get_devdata(master); |
diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c index aad9ae1b9c69..d31b57f7baaf 100644 --- a/drivers/spi/spi_mpc8xxx.c +++ b/drivers/spi/spi_mpc8xxx.c | |||
| @@ -1236,7 +1236,7 @@ static int of_mpc8xxx_spi_free_chipselects(struct device *dev) | |||
| 1236 | return 0; | 1236 | return 0; |
| 1237 | } | 1237 | } |
| 1238 | 1238 | ||
| 1239 | static int __devinit of_mpc8xxx_spi_probe(struct of_device *ofdev, | 1239 | static int __devinit of_mpc8xxx_spi_probe(struct platform_device *ofdev, |
| 1240 | const struct of_device_id *ofid) | 1240 | const struct of_device_id *ofid) |
| 1241 | { | 1241 | { |
| 1242 | struct device *dev = &ofdev->dev; | 1242 | struct device *dev = &ofdev->dev; |
| @@ -1308,7 +1308,7 @@ err_clk: | |||
| 1308 | return ret; | 1308 | return ret; |
| 1309 | } | 1309 | } |
| 1310 | 1310 | ||
| 1311 | static int __devexit of_mpc8xxx_spi_remove(struct of_device *ofdev) | 1311 | static int __devexit of_mpc8xxx_spi_remove(struct platform_device *ofdev) |
| 1312 | { | 1312 | { |
| 1313 | int ret; | 1313 | int ret; |
| 1314 | 1314 | ||
diff --git a/drivers/spi/spi_ppc4xx.c b/drivers/spi/spi_ppc4xx.c index 0f5fa7e2a550..80e172d3e72a 100644 --- a/drivers/spi/spi_ppc4xx.c +++ b/drivers/spi/spi_ppc4xx.c | |||
| @@ -388,9 +388,9 @@ static void free_gpios(struct ppc4xx_spi *hw) | |||
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | /* | 390 | /* |
| 391 | * of_device layer stuff... | 391 | * platform_device layer stuff... |
| 392 | */ | 392 | */ |
| 393 | static int __init spi_ppc4xx_of_probe(struct of_device *op, | 393 | static int __init spi_ppc4xx_of_probe(struct platform_device *op, |
| 394 | const struct of_device_id *match) | 394 | const struct of_device_id *match) |
| 395 | { | 395 | { |
| 396 | struct ppc4xx_spi *hw; | 396 | struct ppc4xx_spi *hw; |
| @@ -565,7 +565,7 @@ free_master: | |||
| 565 | return ret; | 565 | return ret; |
| 566 | } | 566 | } |
| 567 | 567 | ||
| 568 | static int __exit spi_ppc4xx_of_remove(struct of_device *op) | 568 | static int __exit spi_ppc4xx_of_remove(struct platform_device *op) |
| 569 | { | 569 | { |
| 570 | struct spi_master *master = dev_get_drvdata(&op->dev); | 570 | struct spi_master *master = dev_get_drvdata(&op->dev); |
| 571 | struct ppc4xx_spi *hw = spi_master_get_devdata(master); | 571 | struct ppc4xx_spi *hw = spi_master_get_devdata(master); |
diff --git a/drivers/spi/xilinx_spi_of.c b/drivers/spi/xilinx_spi_of.c index f53d3f6b9f61..b66c2dbf20a5 100644 --- a/drivers/spi/xilinx_spi_of.c +++ b/drivers/spi/xilinx_spi_of.c | |||
| @@ -38,7 +38,7 @@ | |||
| 38 | #include "xilinx_spi.h" | 38 | #include "xilinx_spi.h" |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | static int __devinit xilinx_spi_of_probe(struct of_device *ofdev, | 41 | static int __devinit xilinx_spi_of_probe(struct platform_device *ofdev, |
| 42 | const struct of_device_id *match) | 42 | const struct of_device_id *match) |
| 43 | { | 43 | { |
| 44 | struct spi_master *master; | 44 | struct spi_master *master; |
| @@ -84,7 +84,7 @@ static int __devinit xilinx_spi_of_probe(struct of_device *ofdev, | |||
| 84 | return 0; | 84 | return 0; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | static int __devexit xilinx_spi_remove(struct of_device *ofdev) | 87 | static int __devexit xilinx_spi_remove(struct platform_device *ofdev) |
| 88 | { | 88 | { |
| 89 | xilinx_spi_deinit(dev_get_drvdata(&ofdev->dev)); | 89 | xilinx_spi_deinit(dev_get_drvdata(&ofdev->dev)); |
| 90 | dev_set_drvdata(&ofdev->dev, 0); | 90 | dev_set_drvdata(&ofdev->dev, 0); |
| @@ -93,7 +93,7 @@ static int __devexit xilinx_spi_remove(struct of_device *ofdev) | |||
| 93 | return 0; | 93 | return 0; |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | static int __exit xilinx_spi_of_remove(struct of_device *op) | 96 | static int __exit xilinx_spi_of_remove(struct platform_device *op) |
| 97 | { | 97 | { |
| 98 | return xilinx_spi_remove(op); | 98 | return xilinx_spi_remove(op); |
| 99 | } | 99 | } |
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c index 9648b75f0283..a5ea2c1d8c93 100644 --- a/drivers/usb/gadget/fsl_qe_udc.c +++ b/drivers/usb/gadget/fsl_qe_udc.c | |||
| @@ -2398,7 +2398,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
| 2398 | EXPORT_SYMBOL(usb_gadget_unregister_driver); | 2398 | EXPORT_SYMBOL(usb_gadget_unregister_driver); |
| 2399 | 2399 | ||
| 2400 | /* udc structure's alloc and setup, include ep-param alloc */ | 2400 | /* udc structure's alloc and setup, include ep-param alloc */ |
| 2401 | static struct qe_udc __devinit *qe_udc_config(struct of_device *ofdev) | 2401 | static struct qe_udc __devinit *qe_udc_config(struct platform_device *ofdev) |
| 2402 | { | 2402 | { |
| 2403 | struct qe_udc *udc; | 2403 | struct qe_udc *udc; |
| 2404 | struct device_node *np = ofdev->dev.of_node; | 2404 | struct device_node *np = ofdev->dev.of_node; |
| @@ -2523,7 +2523,7 @@ static void qe_udc_release(struct device *dev) | |||
| 2523 | } | 2523 | } |
| 2524 | 2524 | ||
| 2525 | /* Driver probe functions */ | 2525 | /* Driver probe functions */ |
| 2526 | static int __devinit qe_udc_probe(struct of_device *ofdev, | 2526 | static int __devinit qe_udc_probe(struct platform_device *ofdev, |
| 2527 | const struct of_device_id *match) | 2527 | const struct of_device_id *match) |
| 2528 | { | 2528 | { |
| 2529 | struct device_node *np = ofdev->dev.of_node; | 2529 | struct device_node *np = ofdev->dev.of_node; |
| @@ -2679,18 +2679,18 @@ err1: | |||
| 2679 | } | 2679 | } |
| 2680 | 2680 | ||
| 2681 | #ifdef CONFIG_PM | 2681 | #ifdef CONFIG_PM |
| 2682 | static int qe_udc_suspend(struct of_device *dev, pm_message_t state) | 2682 | static int qe_udc_suspend(struct platform_device *dev, pm_message_t state) |
| 2683 | { | 2683 | { |
| 2684 | return -ENOTSUPP; | 2684 | return -ENOTSUPP; |
| 2685 | } | 2685 | } |
| 2686 | 2686 | ||
| 2687 | static int qe_udc_resume(struct of_device *dev) | 2687 | static int qe_udc_resume(struct platform_device *dev) |
| 2688 | { | 2688 | { |
| 2689 | return -ENOTSUPP; | 2689 | return -ENOTSUPP; |
| 2690 | } | 2690 | } |
| 2691 | #endif | 2691 | #endif |
| 2692 | 2692 | ||
| 2693 | static int __devexit qe_udc_remove(struct of_device *ofdev) | 2693 | static int __devexit qe_udc_remove(struct platform_device *ofdev) |
| 2694 | { | 2694 | { |
| 2695 | struct qe_ep *ep; | 2695 | struct qe_ep *ep; |
| 2696 | unsigned int size; | 2696 | unsigned int size; |
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index 5aec92866ab3..335ee699fd85 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c | |||
| @@ -106,7 +106,7 @@ ppc44x_enable_bmt(struct device_node *dn) | |||
| 106 | 106 | ||
| 107 | 107 | ||
| 108 | static int __devinit | 108 | static int __devinit |
| 109 | ehci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match) | 109 | ehci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *match) |
| 110 | { | 110 | { |
| 111 | struct device_node *dn = op->dev.of_node; | 111 | struct device_node *dn = op->dev.of_node; |
| 112 | struct usb_hcd *hcd; | 112 | struct usb_hcd *hcd; |
| @@ -210,7 +210,7 @@ err_rmr: | |||
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | 212 | ||
| 213 | static int ehci_hcd_ppc_of_remove(struct of_device *op) | 213 | static int ehci_hcd_ppc_of_remove(struct platform_device *op) |
| 214 | { | 214 | { |
| 215 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 215 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); |
| 216 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 216 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
| @@ -253,7 +253,7 @@ static int ehci_hcd_ppc_of_remove(struct of_device *op) | |||
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | 255 | ||
| 256 | static int ehci_hcd_ppc_of_shutdown(struct of_device *op) | 256 | static int ehci_hcd_ppc_of_shutdown(struct platform_device *op) |
| 257 | { | 257 | { |
| 258 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 258 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); |
| 259 | 259 | ||
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c index 4899f451add9..6c8076ad821d 100644 --- a/drivers/usb/host/ehci-xilinx-of.c +++ b/drivers/usb/host/ehci-xilinx-of.c | |||
| @@ -140,7 +140,7 @@ static const struct hc_driver ehci_xilinx_of_hc_driver = { | |||
| 140 | 140 | ||
| 141 | /** | 141 | /** |
| 142 | * ehci_hcd_xilinx_of_probe - Probe method for the USB host controller | 142 | * ehci_hcd_xilinx_of_probe - Probe method for the USB host controller |
| 143 | * @op: pointer to the of_device to which the host controller bound | 143 | * @op: pointer to the platform_device bound to the host controller |
| 144 | * @match: pointer to of_device_id structure, not used | 144 | * @match: pointer to of_device_id structure, not used |
| 145 | * | 145 | * |
| 146 | * This function requests resources and sets up appropriate properties for the | 146 | * This function requests resources and sets up appropriate properties for the |
| @@ -149,7 +149,7 @@ static const struct hc_driver ehci_xilinx_of_hc_driver = { | |||
| 149 | * entry, and sets an appropriate value for hcd->has_tt. | 149 | * entry, and sets an appropriate value for hcd->has_tt. |
| 150 | */ | 150 | */ |
| 151 | static int __devinit | 151 | static int __devinit |
| 152 | ehci_hcd_xilinx_of_probe(struct of_device *op, const struct of_device_id *match) | 152 | ehci_hcd_xilinx_of_probe(struct platform_device *op, const struct of_device_id *match) |
| 153 | { | 153 | { |
| 154 | struct device_node *dn = op->dev.of_node; | 154 | struct device_node *dn = op->dev.of_node; |
| 155 | struct usb_hcd *hcd; | 155 | struct usb_hcd *hcd; |
| @@ -242,12 +242,12 @@ err_rmr: | |||
| 242 | 242 | ||
| 243 | /** | 243 | /** |
| 244 | * ehci_hcd_xilinx_of_remove - shutdown hcd and release resources | 244 | * ehci_hcd_xilinx_of_remove - shutdown hcd and release resources |
| 245 | * @op: pointer to of_device structure that is to be removed | 245 | * @op: pointer to platform_device structure that is to be removed |
| 246 | * | 246 | * |
| 247 | * Remove the hcd structure, and release resources that has been requested | 247 | * Remove the hcd structure, and release resources that has been requested |
| 248 | * during probe. | 248 | * during probe. |
| 249 | */ | 249 | */ |
| 250 | static int ehci_hcd_xilinx_of_remove(struct of_device *op) | 250 | static int ehci_hcd_xilinx_of_remove(struct platform_device *op) |
| 251 | { | 251 | { |
| 252 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 252 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); |
| 253 | dev_set_drvdata(&op->dev, NULL); | 253 | dev_set_drvdata(&op->dev, NULL); |
| @@ -266,11 +266,11 @@ static int ehci_hcd_xilinx_of_remove(struct of_device *op) | |||
| 266 | 266 | ||
| 267 | /** | 267 | /** |
| 268 | * ehci_hcd_xilinx_of_shutdown - shutdown the hcd | 268 | * ehci_hcd_xilinx_of_shutdown - shutdown the hcd |
| 269 | * @op: pointer to of_device structure that is to be removed | 269 | * @op: pointer to platform_device structure that is to be removed |
| 270 | * | 270 | * |
| 271 | * Properly shutdown the hcd, call driver's shutdown routine. | 271 | * Properly shutdown the hcd, call driver's shutdown routine. |
| 272 | */ | 272 | */ |
| 273 | static int ehci_hcd_xilinx_of_shutdown(struct of_device *op) | 273 | static int ehci_hcd_xilinx_of_shutdown(struct platform_device *op) |
| 274 | { | 274 | { |
| 275 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 275 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); |
| 276 | 276 | ||
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c index c7c8392a88b9..20092a27a1e8 100644 --- a/drivers/usb/host/fhci-hcd.c +++ b/drivers/usb/host/fhci-hcd.c | |||
| @@ -561,7 +561,7 @@ static const struct hc_driver fhci_driver = { | |||
| 561 | .hub_control = fhci_hub_control, | 561 | .hub_control = fhci_hub_control, |
| 562 | }; | 562 | }; |
| 563 | 563 | ||
| 564 | static int __devinit of_fhci_probe(struct of_device *ofdev, | 564 | static int __devinit of_fhci_probe(struct platform_device *ofdev, |
| 565 | const struct of_device_id *ofid) | 565 | const struct of_device_id *ofid) |
| 566 | { | 566 | { |
| 567 | struct device *dev = &ofdev->dev; | 567 | struct device *dev = &ofdev->dev; |
| @@ -801,7 +801,7 @@ static int __devexit fhci_remove(struct device *dev) | |||
| 801 | return 0; | 801 | return 0; |
| 802 | } | 802 | } |
| 803 | 803 | ||
| 804 | static int __devexit of_fhci_remove(struct of_device *ofdev) | 804 | static int __devexit of_fhci_remove(struct platform_device *ofdev) |
| 805 | { | 805 | { |
| 806 | return fhci_remove(&ofdev->dev); | 806 | return fhci_remove(&ofdev->dev); |
| 807 | } | 807 | } |
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index ec85d0c3cc3e..3b28dbfca058 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | #endif | 27 | #endif |
| 28 | 28 | ||
| 29 | #ifdef CONFIG_PPC_OF | 29 | #ifdef CONFIG_PPC_OF |
| 30 | static int of_isp1760_probe(struct of_device *dev, | 30 | static int of_isp1760_probe(struct platform_device *dev, |
| 31 | const struct of_device_id *match) | 31 | const struct of_device_id *match) |
| 32 | { | 32 | { |
| 33 | struct usb_hcd *hcd; | 33 | struct usb_hcd *hcd; |
| @@ -95,7 +95,7 @@ release_reg: | |||
| 95 | return ret; | 95 | return ret; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | static int of_isp1760_remove(struct of_device *dev) | 98 | static int of_isp1760_remove(struct platform_device *dev) |
| 99 | { | 99 | { |
| 100 | struct usb_hcd *hcd = dev_get_drvdata(&dev->dev); | 100 | struct usb_hcd *hcd = dev_get_drvdata(&dev->dev); |
| 101 | 101 | ||
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c index df165917412a..b2c2dbf08766 100644 --- a/drivers/usb/host/ohci-ppc-of.c +++ b/drivers/usb/host/ohci-ppc-of.c | |||
| @@ -81,7 +81,7 @@ static const struct hc_driver ohci_ppc_of_hc_driver = { | |||
| 81 | 81 | ||
| 82 | 82 | ||
| 83 | static int __devinit | 83 | static int __devinit |
| 84 | ohci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match) | 84 | ohci_hcd_ppc_of_probe(struct platform_device *op, const struct of_device_id *match) |
| 85 | { | 85 | { |
| 86 | struct device_node *dn = op->dev.of_node; | 86 | struct device_node *dn = op->dev.of_node; |
| 87 | struct usb_hcd *hcd; | 87 | struct usb_hcd *hcd; |
| @@ -183,7 +183,7 @@ err_rmr: | |||
| 183 | return rv; | 183 | return rv; |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | static int ohci_hcd_ppc_of_remove(struct of_device *op) | 186 | static int ohci_hcd_ppc_of_remove(struct platform_device *op) |
| 187 | { | 187 | { |
| 188 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 188 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); |
| 189 | dev_set_drvdata(&op->dev, NULL); | 189 | dev_set_drvdata(&op->dev, NULL); |
| @@ -201,7 +201,7 @@ static int ohci_hcd_ppc_of_remove(struct of_device *op) | |||
| 201 | return 0; | 201 | return 0; |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | static int ohci_hcd_ppc_of_shutdown(struct of_device *op) | 204 | static int ohci_hcd_ppc_of_shutdown(struct platform_device *op) |
| 205 | { | 205 | { |
| 206 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 206 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); |
| 207 | 207 | ||
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index c7796637bafd..4dc13467281d 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c | |||
| @@ -273,7 +273,7 @@ static int __devinit bw2_do_default_mode(struct bw2_par *par, | |||
| 273 | return 0; | 273 | return 0; |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | static int __devinit bw2_probe(struct of_device *op, const struct of_device_id *match) | 276 | static int __devinit bw2_probe(struct platform_device *op, const struct of_device_id *match) |
| 277 | { | 277 | { |
| 278 | struct device_node *dp = op->dev.of_node; | 278 | struct device_node *dp = op->dev.of_node; |
| 279 | struct fb_info *info; | 279 | struct fb_info *info; |
| @@ -350,7 +350,7 @@ out_err: | |||
| 350 | return err; | 350 | return err; |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | static int __devexit bw2_remove(struct of_device *op) | 353 | static int __devexit bw2_remove(struct platform_device *op) |
| 354 | { | 354 | { |
| 355 | struct fb_info *info = dev_get_drvdata(&op->dev); | 355 | struct fb_info *info = dev_get_drvdata(&op->dev); |
| 356 | struct bw2_par *par = info->par; | 356 | struct bw2_par *par = info->par; |
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index d09fde8beb69..24249535ac86 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c | |||
| @@ -446,7 +446,7 @@ static struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] __devinitdata = { | |||
| 446 | { .size = 0 } | 446 | { .size = 0 } |
| 447 | }; | 447 | }; |
| 448 | 448 | ||
| 449 | static void cg14_unmap_regs(struct of_device *op, struct fb_info *info, | 449 | static void cg14_unmap_regs(struct platform_device *op, struct fb_info *info, |
| 450 | struct cg14_par *par) | 450 | struct cg14_par *par) |
| 451 | { | 451 | { |
| 452 | if (par->regs) | 452 | if (par->regs) |
| @@ -463,7 +463,7 @@ static void cg14_unmap_regs(struct of_device *op, struct fb_info *info, | |||
| 463 | info->screen_base, info->fix.smem_len); | 463 | info->screen_base, info->fix.smem_len); |
| 464 | } | 464 | } |
| 465 | 465 | ||
| 466 | static int __devinit cg14_probe(struct of_device *op, const struct of_device_id *match) | 466 | static int __devinit cg14_probe(struct platform_device *op, const struct of_device_id *match) |
| 467 | { | 467 | { |
| 468 | struct device_node *dp = op->dev.of_node; | 468 | struct device_node *dp = op->dev.of_node; |
| 469 | struct fb_info *info; | 469 | struct fb_info *info; |
| @@ -570,7 +570,7 @@ out_err: | |||
| 570 | return err; | 570 | return err; |
| 571 | } | 571 | } |
| 572 | 572 | ||
| 573 | static int __devexit cg14_remove(struct of_device *op) | 573 | static int __devexit cg14_remove(struct platform_device *op) |
| 574 | { | 574 | { |
| 575 | struct fb_info *info = dev_get_drvdata(&op->dev); | 575 | struct fb_info *info = dev_get_drvdata(&op->dev); |
| 576 | struct cg14_par *par = info->par; | 576 | struct cg14_par *par = info->par; |
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index 64aa29809fb9..09c0c3c42482 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c | |||
| @@ -346,7 +346,7 @@ static int __devinit cg3_do_default_mode(struct cg3_par *par) | |||
| 346 | return 0; | 346 | return 0; |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | static int __devinit cg3_probe(struct of_device *op, | 349 | static int __devinit cg3_probe(struct platform_device *op, |
| 350 | const struct of_device_id *match) | 350 | const struct of_device_id *match) |
| 351 | { | 351 | { |
| 352 | struct device_node *dp = op->dev.of_node; | 352 | struct device_node *dp = op->dev.of_node; |
| @@ -433,7 +433,7 @@ out_err: | |||
| 433 | return err; | 433 | return err; |
| 434 | } | 434 | } |
| 435 | 435 | ||
| 436 | static int __devexit cg3_remove(struct of_device *op) | 436 | static int __devexit cg3_remove(struct platform_device *op) |
| 437 | { | 437 | { |
| 438 | struct fb_info *info = dev_get_drvdata(&op->dev); | 438 | struct fb_info *info = dev_get_drvdata(&op->dev); |
| 439 | struct cg3_par *par = info->par; | 439 | struct cg3_par *par = info->par; |
diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index 2389a719dcc7..2b5a97058b08 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c | |||
| @@ -718,7 +718,7 @@ static void __devinit cg6_chip_init(struct fb_info *info) | |||
| 718 | sbus_writel(info->var.yres - 1, &fbc->clipmaxy); | 718 | sbus_writel(info->var.yres - 1, &fbc->clipmaxy); |
| 719 | } | 719 | } |
| 720 | 720 | ||
| 721 | static void cg6_unmap_regs(struct of_device *op, struct fb_info *info, | 721 | static void cg6_unmap_regs(struct platform_device *op, struct fb_info *info, |
| 722 | struct cg6_par *par) | 722 | struct cg6_par *par) |
| 723 | { | 723 | { |
| 724 | if (par->fbc) | 724 | if (par->fbc) |
| @@ -737,7 +737,7 @@ static void cg6_unmap_regs(struct of_device *op, struct fb_info *info, | |||
| 737 | info->fix.smem_len); | 737 | info->fix.smem_len); |
| 738 | } | 738 | } |
| 739 | 739 | ||
| 740 | static int __devinit cg6_probe(struct of_device *op, | 740 | static int __devinit cg6_probe(struct platform_device *op, |
| 741 | const struct of_device_id *match) | 741 | const struct of_device_id *match) |
| 742 | { | 742 | { |
| 743 | struct device_node *dp = op->dev.of_node; | 743 | struct device_node *dp = op->dev.of_node; |
| @@ -827,7 +827,7 @@ out_err: | |||
| 827 | return err; | 827 | return err; |
| 828 | } | 828 | } |
| 829 | 829 | ||
| 830 | static int __devexit cg6_remove(struct of_device *op) | 830 | static int __devexit cg6_remove(struct platform_device *op) |
| 831 | { | 831 | { |
| 832 | struct fb_info *info = dev_get_drvdata(&op->dev); | 832 | struct fb_info *info = dev_get_drvdata(&op->dev); |
| 833 | struct cg6_par *par = info->par; | 833 | struct cg6_par *par = info->par; |
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index f6ecfab296d3..6739b2af3bc0 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c | |||
| @@ -893,7 +893,7 @@ static void ffb_init_fix(struct fb_info *info) | |||
| 893 | info->fix.accel = FB_ACCEL_SUN_CREATOR; | 893 | info->fix.accel = FB_ACCEL_SUN_CREATOR; |
| 894 | } | 894 | } |
| 895 | 895 | ||
| 896 | static int __devinit ffb_probe(struct of_device *op, | 896 | static int __devinit ffb_probe(struct platform_device *op, |
| 897 | const struct of_device_id *match) | 897 | const struct of_device_id *match) |
| 898 | { | 898 | { |
| 899 | struct device_node *dp = op->dev.of_node; | 899 | struct device_node *dp = op->dev.of_node; |
| @@ -1023,7 +1023,7 @@ out_err: | |||
| 1023 | return err; | 1023 | return err; |
| 1024 | } | 1024 | } |
| 1025 | 1025 | ||
| 1026 | static int __devexit ffb_remove(struct of_device *op) | 1026 | static int __devexit ffb_remove(struct platform_device *op) |
| 1027 | { | 1027 | { |
| 1028 | struct fb_info *info = dev_get_drvdata(&op->dev); | 1028 | struct fb_info *info = dev_get_drvdata(&op->dev); |
| 1029 | struct ffb_par *par = info->par; | 1029 | struct ffb_par *par = info->par; |
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index e38ad2224540..8bbbf08fa3ce 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c | |||
| @@ -1393,7 +1393,7 @@ static void free_irq_local(int irq) | |||
| 1393 | * Power management hooks. Note that we won't be called from IRQ context, | 1393 | * Power management hooks. Note that we won't be called from IRQ context, |
| 1394 | * unlike the blank functions above, so we may sleep. | 1394 | * unlike the blank functions above, so we may sleep. |
| 1395 | */ | 1395 | */ |
| 1396 | static int fsl_diu_suspend(struct of_device *ofdev, pm_message_t state) | 1396 | static int fsl_diu_suspend(struct platform_device *ofdev, pm_message_t state) |
| 1397 | { | 1397 | { |
| 1398 | struct fsl_diu_data *machine_data; | 1398 | struct fsl_diu_data *machine_data; |
| 1399 | 1399 | ||
| @@ -1403,7 +1403,7 @@ static int fsl_diu_suspend(struct of_device *ofdev, pm_message_t state) | |||
| 1403 | return 0; | 1403 | return 0; |
| 1404 | } | 1404 | } |
| 1405 | 1405 | ||
| 1406 | static int fsl_diu_resume(struct of_device *ofdev) | 1406 | static int fsl_diu_resume(struct platform_device *ofdev) |
| 1407 | { | 1407 | { |
| 1408 | struct fsl_diu_data *machine_data; | 1408 | struct fsl_diu_data *machine_data; |
| 1409 | 1409 | ||
| @@ -1487,7 +1487,7 @@ static ssize_t show_monitor(struct device *device, | |||
| 1487 | return diu_ops.show_monitor_port(machine_data->monitor_port, buf); | 1487 | return diu_ops.show_monitor_port(machine_data->monitor_port, buf); |
| 1488 | } | 1488 | } |
| 1489 | 1489 | ||
| 1490 | static int __devinit fsl_diu_probe(struct of_device *ofdev, | 1490 | static int __devinit fsl_diu_probe(struct platform_device *ofdev, |
| 1491 | const struct of_device_id *match) | 1491 | const struct of_device_id *match) |
| 1492 | { | 1492 | { |
| 1493 | struct device_node *np = ofdev->dev.of_node; | 1493 | struct device_node *np = ofdev->dev.of_node; |
| @@ -1667,7 +1667,7 @@ error2: | |||
| 1667 | } | 1667 | } |
| 1668 | 1668 | ||
| 1669 | 1669 | ||
| 1670 | static int fsl_diu_remove(struct of_device *ofdev) | 1670 | static int fsl_diu_remove(struct platform_device *ofdev) |
| 1671 | { | 1671 | { |
| 1672 | struct fsl_diu_data *machine_data; | 1672 | struct fsl_diu_data *machine_data; |
| 1673 | int i; | 1673 | int i; |
diff --git a/drivers/video/leo.c b/drivers/video/leo.c index ad677637ffbb..b599e5e36ced 100644 --- a/drivers/video/leo.c +++ b/drivers/video/leo.c | |||
| @@ -529,7 +529,7 @@ static void leo_fixup_var_rgb(struct fb_var_screeninfo *var) | |||
| 529 | var->transp.length = 0; | 529 | var->transp.length = 0; |
| 530 | } | 530 | } |
| 531 | 531 | ||
| 532 | static void leo_unmap_regs(struct of_device *op, struct fb_info *info, | 532 | static void leo_unmap_regs(struct platform_device *op, struct fb_info *info, |
| 533 | struct leo_par *par) | 533 | struct leo_par *par) |
| 534 | { | 534 | { |
| 535 | if (par->lc_ss0_usr) | 535 | if (par->lc_ss0_usr) |
| @@ -547,7 +547,7 @@ static void leo_unmap_regs(struct of_device *op, struct fb_info *info, | |||
| 547 | of_iounmap(&op->resource[0], info->screen_base, 0x800000); | 547 | of_iounmap(&op->resource[0], info->screen_base, 0x800000); |
| 548 | } | 548 | } |
| 549 | 549 | ||
| 550 | static int __devinit leo_probe(struct of_device *op, | 550 | static int __devinit leo_probe(struct platform_device *op, |
| 551 | const struct of_device_id *match) | 551 | const struct of_device_id *match) |
| 552 | { | 552 | { |
| 553 | struct device_node *dp = op->dev.of_node; | 553 | struct device_node *dp = op->dev.of_node; |
| @@ -637,7 +637,7 @@ out_err: | |||
| 637 | return err; | 637 | return err; |
| 638 | } | 638 | } |
| 639 | 639 | ||
| 640 | static int __devexit leo_remove(struct of_device *op) | 640 | static int __devexit leo_remove(struct platform_device *op) |
| 641 | { | 641 | { |
| 642 | struct fb_info *info = dev_get_drvdata(&op->dev); | 642 | struct fb_info *info = dev_get_drvdata(&op->dev); |
| 643 | struct leo_par *par = info->par; | 643 | struct leo_par *par = info->par; |
diff --git a/drivers/video/mb862xx/mb862xxfb.c b/drivers/video/mb862xx/mb862xxfb.c index 4e2b8cc3d460..b1c4374cf940 100644 --- a/drivers/video/mb862xx/mb862xxfb.c +++ b/drivers/video/mb862xx/mb862xxfb.c | |||
| @@ -550,7 +550,7 @@ static int mb862xx_gdc_init(struct mb862xxfb_par *par) | |||
| 550 | return 0; | 550 | return 0; |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | static int __devinit of_platform_mb862xx_probe(struct of_device *ofdev, | 553 | static int __devinit of_platform_mb862xx_probe(struct platform_device *ofdev, |
| 554 | const struct of_device_id *id) | 554 | const struct of_device_id *id) |
| 555 | { | 555 | { |
| 556 | struct device_node *np = ofdev->dev.of_node; | 556 | struct device_node *np = ofdev->dev.of_node; |
| @@ -669,7 +669,7 @@ fbrel: | |||
| 669 | return ret; | 669 | return ret; |
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | static int __devexit of_platform_mb862xx_remove(struct of_device *ofdev) | 672 | static int __devexit of_platform_mb862xx_remove(struct platform_device *ofdev) |
| 673 | { | 673 | { |
| 674 | struct fb_info *fbi = dev_get_drvdata(&ofdev->dev); | 674 | struct fb_info *fbi = dev_get_drvdata(&ofdev->dev); |
| 675 | struct mb862xxfb_par *par = fbi->par; | 675 | struct mb862xxfb_par *par = fbi->par; |
diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c index 688b055abab2..b6c3fc2db632 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/p9100.c | |||
| @@ -249,7 +249,7 @@ static void p9100_init_fix(struct fb_info *info, int linebytes, struct device_no | |||
| 249 | info->fix.accel = FB_ACCEL_SUN_CGTHREE; | 249 | info->fix.accel = FB_ACCEL_SUN_CGTHREE; |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | static int __devinit p9100_probe(struct of_device *op, const struct of_device_id *match) | 252 | static int __devinit p9100_probe(struct platform_device *op, const struct of_device_id *match) |
| 253 | { | 253 | { |
| 254 | struct device_node *dp = op->dev.of_node; | 254 | struct device_node *dp = op->dev.of_node; |
| 255 | struct fb_info *info; | 255 | struct fb_info *info; |
| @@ -326,7 +326,7 @@ out_err: | |||
| 326 | return err; | 326 | return err; |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | static int __devexit p9100_remove(struct of_device *op) | 329 | static int __devexit p9100_remove(struct platform_device *op) |
| 330 | { | 330 | { |
| 331 | struct fb_info *info = dev_get_drvdata(&op->dev); | 331 | struct fb_info *info = dev_get_drvdata(&op->dev); |
| 332 | struct p9100_par *par = info->par; | 332 | struct p9100_par *par = info->par; |
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c index 72a1f4c04732..a50e1977b316 100644 --- a/drivers/video/platinumfb.c +++ b/drivers/video/platinumfb.c | |||
| @@ -533,7 +533,7 @@ static int __init platinumfb_setup(char *options) | |||
| 533 | #define invalidate_cache(addr) | 533 | #define invalidate_cache(addr) |
| 534 | #endif | 534 | #endif |
| 535 | 535 | ||
| 536 | static int __devinit platinumfb_probe(struct of_device* odev, | 536 | static int __devinit platinumfb_probe(struct platform_device* odev, |
| 537 | const struct of_device_id *match) | 537 | const struct of_device_id *match) |
| 538 | { | 538 | { |
| 539 | struct device_node *dp = odev->dev.of_node; | 539 | struct device_node *dp = odev->dev.of_node; |
| @@ -646,7 +646,7 @@ static int __devinit platinumfb_probe(struct of_device* odev, | |||
| 646 | return rc; | 646 | return rc; |
| 647 | } | 647 | } |
| 648 | 648 | ||
| 649 | static int __devexit platinumfb_remove(struct of_device* odev) | 649 | static int __devexit platinumfb_remove(struct platform_device* odev) |
| 650 | { | 650 | { |
| 651 | struct fb_info *info = dev_get_drvdata(&odev->dev); | 651 | struct fb_info *info = dev_get_drvdata(&odev->dev); |
| 652 | struct fb_info_platinum *pinfo = info->par; | 652 | struct fb_info_platinum *pinfo = info->par; |
diff --git a/drivers/video/sunxvr1000.c b/drivers/video/sunxvr1000.c index 7288934c0d49..5dbe06af2226 100644 --- a/drivers/video/sunxvr1000.c +++ b/drivers/video/sunxvr1000.c | |||
| @@ -111,7 +111,7 @@ static int __devinit gfb_set_fbinfo(struct gfb_info *gp) | |||
| 111 | return 0; | 111 | return 0; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | static int __devinit gfb_probe(struct of_device *op, | 114 | static int __devinit gfb_probe(struct platform_device *op, |
| 115 | const struct of_device_id *match) | 115 | const struct of_device_id *match) |
| 116 | { | 116 | { |
| 117 | struct device_node *dp = op->dev.of_node; | 117 | struct device_node *dp = op->dev.of_node; |
| @@ -172,7 +172,7 @@ err_out: | |||
| 172 | return err; | 172 | return err; |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | static int __devexit gfb_remove(struct of_device *op) | 175 | static int __devexit gfb_remove(struct platform_device *op) |
| 176 | { | 176 | { |
| 177 | struct fb_info *info = dev_get_drvdata(&op->dev); | 177 | struct fb_info *info = dev_get_drvdata(&op->dev); |
| 178 | struct gfb_info *gp = info->par; | 178 | struct gfb_info *gp = info->par; |
diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c index f375e0db6776..77ad27955cf0 100644 --- a/drivers/video/tcx.c +++ b/drivers/video/tcx.c | |||
| @@ -342,7 +342,7 @@ tcx_init_fix(struct fb_info *info, int linebytes) | |||
| 342 | info->fix.accel = FB_ACCEL_SUN_TCX; | 342 | info->fix.accel = FB_ACCEL_SUN_TCX; |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | static void tcx_unmap_regs(struct of_device *op, struct fb_info *info, | 345 | static void tcx_unmap_regs(struct platform_device *op, struct fb_info *info, |
| 346 | struct tcx_par *par) | 346 | struct tcx_par *par) |
| 347 | { | 347 | { |
| 348 | if (par->tec) | 348 | if (par->tec) |
| @@ -362,7 +362,7 @@ static void tcx_unmap_regs(struct of_device *op, struct fb_info *info, | |||
| 362 | info->screen_base, info->fix.smem_len); | 362 | info->screen_base, info->fix.smem_len); |
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | static int __devinit tcx_probe(struct of_device *op, | 365 | static int __devinit tcx_probe(struct platform_device *op, |
| 366 | const struct of_device_id *match) | 366 | const struct of_device_id *match) |
| 367 | { | 367 | { |
| 368 | struct device_node *dp = op->dev.of_node; | 368 | struct device_node *dp = op->dev.of_node; |
| @@ -486,7 +486,7 @@ out_err: | |||
| 486 | return err; | 486 | return err; |
| 487 | } | 487 | } |
| 488 | 488 | ||
| 489 | static int __devexit tcx_remove(struct of_device *op) | 489 | static int __devexit tcx_remove(struct platform_device *op) |
| 490 | { | 490 | { |
| 491 | struct fb_info *info = dev_get_drvdata(&op->dev); | 491 | struct fb_info *info = dev_get_drvdata(&op->dev); |
| 492 | struct tcx_par *par = info->par; | 492 | struct tcx_par *par = info->par; |
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index 29b5daacc217..0c9ce88e95e8 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c | |||
| @@ -397,7 +397,7 @@ static int xilinxfb_release(struct device *dev) | |||
| 397 | */ | 397 | */ |
| 398 | 398 | ||
| 399 | static int __devinit | 399 | static int __devinit |
| 400 | xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match) | 400 | xilinxfb_of_probe(struct platform_device *op, const struct of_device_id *match) |
| 401 | { | 401 | { |
| 402 | const u32 *prop; | 402 | const u32 *prop; |
| 403 | u32 *p; | 403 | u32 *p; |
| @@ -477,7 +477,7 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match) | |||
| 477 | return -ENODEV; | 477 | return -ENODEV; |
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | static int __devexit xilinxfb_of_remove(struct of_device *op) | 480 | static int __devexit xilinxfb_of_remove(struct platform_device *op) |
| 481 | { | 481 | { |
| 482 | return xilinxfb_release(&op->dev); | 482 | return xilinxfb_release(&op->dev); |
| 483 | } | 483 | } |
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c index 30a2512fd52e..566343b3c131 100644 --- a/drivers/watchdog/cpwd.c +++ b/drivers/watchdog/cpwd.c | |||
| @@ -526,7 +526,7 @@ static const struct file_operations cpwd_fops = { | |||
| 526 | .release = cpwd_release, | 526 | .release = cpwd_release, |
| 527 | }; | 527 | }; |
| 528 | 528 | ||
| 529 | static int __devinit cpwd_probe(struct of_device *op, | 529 | static int __devinit cpwd_probe(struct platform_device *op, |
| 530 | const struct of_device_id *match) | 530 | const struct of_device_id *match) |
| 531 | { | 531 | { |
| 532 | struct device_node *options; | 532 | struct device_node *options; |
| @@ -639,7 +639,7 @@ out_free: | |||
| 639 | goto out; | 639 | goto out; |
| 640 | } | 640 | } |
| 641 | 641 | ||
| 642 | static int __devexit cpwd_remove(struct of_device *op) | 642 | static int __devexit cpwd_remove(struct platform_device *op) |
| 643 | { | 643 | { |
| 644 | struct cpwd *p = dev_get_drvdata(&op->dev); | 644 | struct cpwd *p = dev_get_drvdata(&op->dev); |
| 645 | int i; | 645 | int i; |
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c index 1df284f9c2a1..9c21d19043a6 100644 --- a/drivers/watchdog/gef_wdt.c +++ b/drivers/watchdog/gef_wdt.c | |||
| @@ -260,7 +260,7 @@ static struct miscdevice gef_wdt_miscdev = { | |||
| 260 | }; | 260 | }; |
| 261 | 261 | ||
| 262 | 262 | ||
| 263 | static int __devinit gef_wdt_probe(struct of_device *dev, | 263 | static int __devinit gef_wdt_probe(struct platform_device *dev, |
| 264 | const struct of_device_id *match) | 264 | const struct of_device_id *match) |
| 265 | { | 265 | { |
| 266 | int timeout = 10; | 266 | int timeout = 10; |
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c index 4cda64dd309c..8fa213cdb499 100644 --- a/drivers/watchdog/mpc8xxx_wdt.c +++ b/drivers/watchdog/mpc8xxx_wdt.c | |||
| @@ -185,7 +185,7 @@ static struct miscdevice mpc8xxx_wdt_miscdev = { | |||
| 185 | .fops = &mpc8xxx_wdt_fops, | 185 | .fops = &mpc8xxx_wdt_fops, |
| 186 | }; | 186 | }; |
| 187 | 187 | ||
| 188 | static int __devinit mpc8xxx_wdt_probe(struct of_device *ofdev, | 188 | static int __devinit mpc8xxx_wdt_probe(struct platform_device *ofdev, |
| 189 | const struct of_device_id *match) | 189 | const struct of_device_id *match) |
| 190 | { | 190 | { |
| 191 | int ret; | 191 | int ret; |
| @@ -238,7 +238,7 @@ err_unmap: | |||
| 238 | return ret; | 238 | return ret; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | static int __devexit mpc8xxx_wdt_remove(struct of_device *ofdev) | 241 | static int __devexit mpc8xxx_wdt_remove(struct platform_device *ofdev) |
| 242 | { | 242 | { |
| 243 | mpc8xxx_wdt_pr_warn("watchdog removed"); | 243 | mpc8xxx_wdt_pr_warn("watchdog removed"); |
| 244 | del_timer_sync(&wdt_timer); | 244 | del_timer_sync(&wdt_timer); |
diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c index 4082b4ace1fc..3faee1ae64bd 100644 --- a/drivers/watchdog/riowd.c +++ b/drivers/watchdog/riowd.c | |||
| @@ -172,7 +172,7 @@ static struct miscdevice riowd_miscdev = { | |||
| 172 | .fops = &riowd_fops | 172 | .fops = &riowd_fops |
| 173 | }; | 173 | }; |
| 174 | 174 | ||
| 175 | static int __devinit riowd_probe(struct of_device *op, | 175 | static int __devinit riowd_probe(struct platform_device *op, |
| 176 | const struct of_device_id *match) | 176 | const struct of_device_id *match) |
| 177 | { | 177 | { |
| 178 | struct riowd *p; | 178 | struct riowd *p; |
| @@ -219,7 +219,7 @@ out: | |||
| 219 | return err; | 219 | return err; |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | static int __devexit riowd_remove(struct of_device *op) | 222 | static int __devexit riowd_remove(struct platform_device *op) |
| 223 | { | 223 | { |
| 224 | struct riowd *p = dev_get_drvdata(&op->dev); | 224 | struct riowd *p = dev_get_drvdata(&op->dev); |
| 225 | 225 | ||
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 0a8826936639..60d71e9abe9f 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
| @@ -71,4 +71,9 @@ config XEN_PLATFORM_PCI | |||
| 71 | initializing xenbus and grant_table when running in a Xen HVM | 71 | initializing xenbus and grant_table when running in a Xen HVM |
| 72 | domain. As a consequence this driver is required to run any Xen PV | 72 | domain. As a consequence this driver is required to run any Xen PV |
| 73 | frontend on Xen HVM. | 73 | frontend on Xen HVM. |
| 74 | |||
| 75 | config SWIOTLB_XEN | ||
| 76 | def_bool y | ||
| 77 | depends on SWIOTLB | ||
| 78 | |||
| 74 | endmenu | 79 | endmenu |
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index e392fb776af3..fcaf838f54be 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile | |||
| @@ -11,3 +11,4 @@ obj-$(CONFIG_XEN_DEV_EVTCHN) += evtchn.o | |||
| 11 | obj-$(CONFIG_XENFS) += xenfs/ | 11 | obj-$(CONFIG_XENFS) += xenfs/ |
| 12 | obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o | 12 | obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o |
| 13 | obj-$(CONFIG_XEN_PLATFORM_PCI) += platform-pci.o | 13 | obj-$(CONFIG_XEN_PLATFORM_PCI) += platform-pci.o |
| 14 | obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o | ||
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 1a0d8c2a0354..500290b150bb 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
| @@ -85,13 +85,6 @@ static struct sys_device balloon_sysdev; | |||
| 85 | 85 | ||
| 86 | static int register_balloon(struct sys_device *sysdev); | 86 | static int register_balloon(struct sys_device *sysdev); |
| 87 | 87 | ||
| 88 | /* | ||
| 89 | * Protects atomic reservation decrease/increase against concurrent increases. | ||
| 90 | * Also protects non-atomic updates of current_pages and driver_pages, and | ||
| 91 | * balloon lists. | ||
| 92 | */ | ||
| 93 | static DEFINE_SPINLOCK(balloon_lock); | ||
| 94 | |||
| 95 | static struct balloon_stats balloon_stats; | 88 | static struct balloon_stats balloon_stats; |
| 96 | 89 | ||
| 97 | /* We increase/decrease in batches which fit in a page */ | 90 | /* We increase/decrease in batches which fit in a page */ |
| @@ -210,7 +203,7 @@ static int increase_reservation(unsigned long nr_pages) | |||
| 210 | if (nr_pages > ARRAY_SIZE(frame_list)) | 203 | if (nr_pages > ARRAY_SIZE(frame_list)) |
| 211 | nr_pages = ARRAY_SIZE(frame_list); | 204 | nr_pages = ARRAY_SIZE(frame_list); |
| 212 | 205 | ||
| 213 | spin_lock_irqsave(&balloon_lock, flags); | 206 | spin_lock_irqsave(&xen_reservation_lock, flags); |
| 214 | 207 | ||
| 215 | page = balloon_first_page(); | 208 | page = balloon_first_page(); |
| 216 | for (i = 0; i < nr_pages; i++) { | 209 | for (i = 0; i < nr_pages; i++) { |
| @@ -254,7 +247,7 @@ static int increase_reservation(unsigned long nr_pages) | |||
| 254 | balloon_stats.current_pages += rc; | 247 | balloon_stats.current_pages += rc; |
| 255 | 248 | ||
| 256 | out: | 249 | out: |
| 257 | spin_unlock_irqrestore(&balloon_lock, flags); | 250 | spin_unlock_irqrestore(&xen_reservation_lock, flags); |
| 258 | 251 | ||
| 259 | return rc < 0 ? rc : rc != nr_pages; | 252 | return rc < 0 ? rc : rc != nr_pages; |
| 260 | } | 253 | } |
| @@ -299,7 +292,7 @@ static int decrease_reservation(unsigned long nr_pages) | |||
| 299 | kmap_flush_unused(); | 292 | kmap_flush_unused(); |
| 300 | flush_tlb_all(); | 293 | flush_tlb_all(); |
| 301 | 294 | ||
| 302 | spin_lock_irqsave(&balloon_lock, flags); | 295 | spin_lock_irqsave(&xen_reservation_lock, flags); |
| 303 | 296 | ||
| 304 | /* No more mappings: invalidate P2M and add to balloon. */ | 297 | /* No more mappings: invalidate P2M and add to balloon. */ |
| 305 | for (i = 0; i < nr_pages; i++) { | 298 | for (i = 0; i < nr_pages; i++) { |
| @@ -315,7 +308,7 @@ static int decrease_reservation(unsigned long nr_pages) | |||
| 315 | 308 | ||
| 316 | balloon_stats.current_pages -= nr_pages; | 309 | balloon_stats.current_pages -= nr_pages; |
| 317 | 310 | ||
| 318 | spin_unlock_irqrestore(&balloon_lock, flags); | 311 | spin_unlock_irqrestore(&xen_reservation_lock, flags); |
| 319 | 312 | ||
| 320 | return need_sleep; | 313 | return need_sleep; |
| 321 | } | 314 | } |
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c new file mode 100644 index 000000000000..54469c3eeacd --- /dev/null +++ b/drivers/xen/swiotlb-xen.c | |||
| @@ -0,0 +1,515 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2010 | ||
| 3 | * by Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | ||
| 4 | * | ||
| 5 | * This code provides a IOMMU for Xen PV guests with PCI passthrough. | ||
| 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 v2.0 as published by | ||
| 9 | * the Free Software Foundation | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * PV guests under Xen are running in an non-contiguous memory architecture. | ||
| 17 | * | ||
| 18 | * When PCI pass-through is utilized, this necessitates an IOMMU for | ||
| 19 | * translating bus (DMA) to virtual and vice-versa and also providing a | ||
| 20 | * mechanism to have contiguous pages for device drivers operations (say DMA | ||
| 21 | * operations). | ||
| 22 | * | ||
| 23 | * Specifically, under Xen the Linux idea of pages is an illusion. It | ||
| 24 | * assumes that pages start at zero and go up to the available memory. To | ||
| 25 | * help with that, the Linux Xen MMU provides a lookup mechanism to | ||
| 26 | * translate the page frame numbers (PFN) to machine frame numbers (MFN) | ||
| 27 | * and vice-versa. The MFN are the "real" frame numbers. Furthermore | ||
| 28 | * memory is not contiguous. Xen hypervisor stitches memory for guests | ||
| 29 | * from different pools, which means there is no guarantee that PFN==MFN | ||
| 30 | * and PFN+1==MFN+1. Lastly with Xen 4.0, pages (in debug mode) are | ||
| 31 | * allocated in descending order (high to low), meaning the guest might | ||
| 32 | * never get any MFN's under the 4GB mark. | ||
| 33 | * | ||
| 34 | */ | ||
| 35 | |||
| 36 | #include <linux/bootmem.h> | ||
| 37 | #include <linux/dma-mapping.h> | ||
| 38 | #include <xen/swiotlb-xen.h> | ||
| 39 | #include <xen/page.h> | ||
| 40 | #include <xen/xen-ops.h> | ||
| 41 | /* | ||
| 42 | * Used to do a quick range check in swiotlb_tbl_unmap_single and | ||
| 43 | * swiotlb_tbl_sync_single_*, to see if the memory was in fact allocated by this | ||
| 44 | * API. | ||
| 45 | */ | ||
| 46 | |||
| 47 | static char *xen_io_tlb_start, *xen_io_tlb_end; | ||
| 48 | static unsigned long xen_io_tlb_nslabs; | ||
| 49 | /* | ||
| 50 | * Quick lookup value of the bus address of the IOTLB. | ||
| 51 | */ | ||
| 52 | |||
| 53 | u64 start_dma_addr; | ||
| 54 | |||
| 55 | static dma_addr_t xen_phys_to_bus(phys_addr_t paddr) | ||
| 56 | { | ||
| 57 | return phys_to_machine(XPADDR(paddr)).maddr;; | ||
| 58 | } | ||
| 59 | |||
| 60 | static phys_addr_t xen_bus_to_phys(dma_addr_t baddr) | ||
| 61 | { | ||
| 62 | return machine_to_phys(XMADDR(baddr)).paddr; | ||
| 63 | } | ||
| 64 | |||
| 65 | static dma_addr_t xen_virt_to_bus(void *address) | ||
| 66 | { | ||
| 67 | return xen_phys_to_bus(virt_to_phys(address)); | ||
| 68 | } | ||
| 69 | |||
| 70 | static int check_pages_physically_contiguous(unsigned long pfn, | ||
| 71 | unsigned int offset, | ||
| 72 | size_t length) | ||
| 73 | { | ||
| 74 | unsigned long next_mfn; | ||
| 75 | int i; | ||
| 76 | int nr_pages; | ||
| 77 | |||
| 78 | next_mfn = pfn_to_mfn(pfn); | ||
| 79 | nr_pages = (offset + length + PAGE_SIZE-1) >> PAGE_SHIFT; | ||
| 80 | |||
| 81 | for (i = 1; i < nr_pages; i++) { | ||
| 82 | if (pfn_to_mfn(++pfn) != ++next_mfn) | ||
| 83 | return 0; | ||
| 84 | } | ||
| 85 | return 1; | ||
| 86 | } | ||
| 87 | |||
| 88 | static int range_straddles_page_boundary(phys_addr_t p, size_t size) | ||
| 89 | { | ||
| 90 | unsigned long pfn = PFN_DOWN(p); | ||
| 91 | unsigned int offset = p & ~PAGE_MASK; | ||
| 92 | |||
| 93 | if (offset + size <= PAGE_SIZE) | ||
| 94 | return 0; | ||
| 95 | if (check_pages_physically_contiguous(pfn, offset, size)) | ||
| 96 | return 0; | ||
| 97 | return 1; | ||
| 98 | } | ||
| 99 | |||
| 100 | static int is_xen_swiotlb_buffer(dma_addr_t dma_addr) | ||
| 101 | { | ||
| 102 | unsigned long mfn = PFN_DOWN(dma_addr); | ||
| 103 | unsigned long pfn = mfn_to_local_pfn(mfn); | ||
| 104 | phys_addr_t paddr; | ||
| 105 | |||
| 106 | /* If the address is outside our domain, it CAN | ||
| 107 | * have the same virtual address as another address | ||
| 108 | * in our domain. Therefore _only_ check address within our domain. | ||
| 109 | */ | ||
| 110 | if (pfn_valid(pfn)) { | ||
| 111 | paddr = PFN_PHYS(pfn); | ||
| 112 | return paddr >= virt_to_phys(xen_io_tlb_start) && | ||
| 113 | paddr < virt_to_phys(xen_io_tlb_end); | ||
| 114 | } | ||
| 115 | return 0; | ||
| 116 | } | ||
| 117 | |||
| 118 | static int max_dma_bits = 32; | ||
| 119 | |||
| 120 | static int | ||
| 121 | xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs) | ||
| 122 | { | ||
| 123 | int i, rc; | ||
| 124 | int dma_bits; | ||
| 125 | |||
| 126 | dma_bits = get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT) + PAGE_SHIFT; | ||
| 127 | |||
| 128 | i = 0; | ||
| 129 | do { | ||
| 130 | int slabs = min(nslabs - i, (unsigned long)IO_TLB_SEGSIZE); | ||
| 131 | |||
| 132 | do { | ||
| 133 | rc = xen_create_contiguous_region( | ||
| 134 | (unsigned long)buf + (i << IO_TLB_SHIFT), | ||
| 135 | get_order(slabs << IO_TLB_SHIFT), | ||
| 136 | dma_bits); | ||
| 137 | } while (rc && dma_bits++ < max_dma_bits); | ||
| 138 | if (rc) | ||
| 139 | return rc; | ||
| 140 | |||
| 141 | i += slabs; | ||
| 142 | } while (i < nslabs); | ||
| 143 | return 0; | ||
| 144 | } | ||
| 145 | |||
| 146 | void __init xen_swiotlb_init(int verbose) | ||
| 147 | { | ||
| 148 | unsigned long bytes; | ||
| 149 | int rc; | ||
| 150 | |||
| 151 | xen_io_tlb_nslabs = (64 * 1024 * 1024 >> IO_TLB_SHIFT); | ||
| 152 | xen_io_tlb_nslabs = ALIGN(xen_io_tlb_nslabs, IO_TLB_SEGSIZE); | ||
| 153 | |||
| 154 | bytes = xen_io_tlb_nslabs << IO_TLB_SHIFT; | ||
| 155 | |||
| 156 | /* | ||
| 157 | * Get IO TLB memory from any location. | ||
| 158 | */ | ||
| 159 | xen_io_tlb_start = alloc_bootmem(bytes); | ||
| 160 | if (!xen_io_tlb_start) | ||
| 161 | panic("Cannot allocate SWIOTLB buffer"); | ||
| 162 | |||
| 163 | xen_io_tlb_end = xen_io_tlb_start + bytes; | ||
| 164 | /* | ||
| 165 | * And replace that memory with pages under 4GB. | ||
| 166 | */ | ||
| 167 | rc = xen_swiotlb_fixup(xen_io_tlb_start, | ||
| 168 | bytes, | ||
| 169 | xen_io_tlb_nslabs); | ||
| 170 | if (rc) | ||
| 171 | goto error; | ||
| 172 | |||
| 173 | start_dma_addr = xen_virt_to_bus(xen_io_tlb_start); | ||
| 174 | swiotlb_init_with_tbl(xen_io_tlb_start, xen_io_tlb_nslabs, verbose); | ||
| 175 | |||
| 176 | return; | ||
| 177 | error: | ||
| 178 | panic("DMA(%d): Failed to exchange pages allocated for DMA with Xen! "\ | ||
| 179 | "We either don't have the permission or you do not have enough"\ | ||
| 180 | "free memory under 4GB!\n", rc); | ||
| 181 | } | ||
| 182 | |||
| 183 | void * | ||
| 184 | xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, | ||
| 185 | dma_addr_t *dma_handle, gfp_t flags) | ||
| 186 | { | ||
| 187 | void *ret; | ||
| 188 | int order = get_order(size); | ||
| 189 | u64 dma_mask = DMA_BIT_MASK(32); | ||
| 190 | unsigned long vstart; | ||
| 191 | |||
| 192 | /* | ||
| 193 | * Ignore region specifiers - the kernel's ideas of | ||
| 194 | * pseudo-phys memory layout has nothing to do with the | ||
| 195 | * machine physical layout. We can't allocate highmem | ||
| 196 | * because we can't return a pointer to it. | ||
| 197 | */ | ||
| 198 | flags &= ~(__GFP_DMA | __GFP_HIGHMEM); | ||
| 199 | |||
| 200 | if (dma_alloc_from_coherent(hwdev, size, dma_handle, &ret)) | ||
| 201 | return ret; | ||
| 202 | |||
| 203 | vstart = __get_free_pages(flags, order); | ||
| 204 | ret = (void *)vstart; | ||
| 205 | |||
| 206 | if (hwdev && hwdev->coherent_dma_mask) | ||
| 207 | dma_mask = dma_alloc_coherent_mask(hwdev, flags); | ||
| 208 | |||
| 209 | if (ret) { | ||
| 210 | if (xen_create_contiguous_region(vstart, order, | ||
| 211 | fls64(dma_mask)) != 0) { | ||
| 212 | free_pages(vstart, order); | ||
| 213 | return NULL; | ||
| 214 | } | ||
| 215 | memset(ret, 0, size); | ||
| 216 | *dma_handle = virt_to_machine(ret).maddr; | ||
| 217 | } | ||
| 218 | return ret; | ||
| 219 | } | ||
| 220 | EXPORT_SYMBOL_GPL(xen_swiotlb_alloc_coherent); | ||
| 221 | |||
| 222 | void | ||
| 223 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, | ||
| 224 | dma_addr_t dev_addr) | ||
| 225 | { | ||
| 226 | int order = get_order(size); | ||
| 227 | |||
| 228 | if (dma_release_from_coherent(hwdev, order, vaddr)) | ||
| 229 | return; | ||
| 230 | |||
| 231 | xen_destroy_contiguous_region((unsigned long)vaddr, order); | ||
| 232 | free_pages((unsigned long)vaddr, order); | ||
| 233 | } | ||
| 234 | EXPORT_SYMBOL_GPL(xen_swiotlb_free_coherent); | ||
| 235 | |||
| 236 | |||
| 237 | /* | ||
| 238 | * Map a single buffer of the indicated size for DMA in streaming mode. The | ||
| 239 | * physical address to use is returned. | ||
| 240 | * | ||
| 241 | * Once the device is given the dma address, the device owns this memory until | ||
| 242 | * either xen_swiotlb_unmap_page or xen_swiotlb_dma_sync_single is performed. | ||
| 243 | */ | ||
| 244 | dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, | ||
| 245 | unsigned long offset, size_t size, | ||
| 246 | enum dma_data_direction dir, | ||
| 247 | struct dma_attrs *attrs) | ||
| 248 | { | ||
| 249 | phys_addr_t phys = page_to_phys(page) + offset; | ||
| 250 | dma_addr_t dev_addr = xen_phys_to_bus(phys); | ||
| 251 | void *map; | ||
| 252 | |||
| 253 | BUG_ON(dir == DMA_NONE); | ||
| 254 | /* | ||
| 255 | * If the address happens to be in the device's DMA window, | ||
| 256 | * we can safely return the device addr and not worry about bounce | ||
| 257 | * buffering it. | ||
| 258 | */ | ||
| 259 | if (dma_capable(dev, dev_addr, size) && | ||
| 260 | !range_straddles_page_boundary(phys, size) && !swiotlb_force) | ||
| 261 | return dev_addr; | ||
| 262 | |||
| 263 | /* | ||
| 264 | * Oh well, have to allocate and map a bounce buffer. | ||
| 265 | */ | ||
| 266 | map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir); | ||
| 267 | if (!map) | ||
| 268 | return DMA_ERROR_CODE; | ||
| 269 | |||
| 270 | dev_addr = xen_virt_to_bus(map); | ||
| 271 | |||
| 272 | /* | ||
| 273 | * Ensure that the address returned is DMA'ble | ||
| 274 | */ | ||
| 275 | if (!dma_capable(dev, dev_addr, size)) | ||
| 276 | panic("map_single: bounce buffer is not DMA'ble"); | ||
| 277 | |||
| 278 | return dev_addr; | ||
| 279 | } | ||
| 280 | EXPORT_SYMBOL_GPL(xen_swiotlb_map_page); | ||
| 281 | |||
| 282 | /* | ||
| 283 | * Unmap a single streaming mode DMA translation. The dma_addr and size must | ||
| 284 | * match what was provided for in a previous xen_swiotlb_map_page call. All | ||
| 285 | * other usages are undefined. | ||
| 286 | * | ||
| 287 | * After this call, reads by the cpu to the buffer are guaranteed to see | ||
| 288 | * whatever the device wrote there. | ||
| 289 | */ | ||
| 290 | static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr, | ||
| 291 | size_t size, enum dma_data_direction dir) | ||
| 292 | { | ||
| 293 | phys_addr_t paddr = xen_bus_to_phys(dev_addr); | ||
| 294 | |||
| 295 | BUG_ON(dir == DMA_NONE); | ||
| 296 | |||
| 297 | /* NOTE: We use dev_addr here, not paddr! */ | ||
| 298 | if (is_xen_swiotlb_buffer(dev_addr)) { | ||
| 299 | swiotlb_tbl_unmap_single(hwdev, phys_to_virt(paddr), size, dir); | ||
| 300 | return; | ||
| 301 | } | ||
| 302 | |||
| 303 | if (dir != DMA_FROM_DEVICE) | ||
| 304 | return; | ||
| 305 | |||
| 306 | /* | ||
| 307 | * phys_to_virt doesn't work with hihgmem page but we could | ||
| 308 | * call dma_mark_clean() with hihgmem page here. However, we | ||
| 309 | * are fine since dma_mark_clean() is null on POWERPC. We can | ||
| 310 | * make dma_mark_clean() take a physical address if necessary. | ||
| 311 | */ | ||
| 312 | dma_mark_clean(phys_to_virt(paddr), size); | ||
| 313 | } | ||
| 314 | |||
| 315 | void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr, | ||
| 316 | size_t size, enum dma_data_direction dir, | ||
| 317 | struct dma_attrs *attrs) | ||
| 318 | { | ||
| 319 | xen_unmap_single(hwdev, dev_addr, size, dir); | ||
| 320 | } | ||
| 321 | EXPORT_SYMBOL_GPL(xen_swiotlb_unmap_page); | ||
| 322 | |||
| 323 | /* | ||
| 324 | * Make physical memory consistent for a single streaming mode DMA translation | ||
| 325 | * after a transfer. | ||
| 326 | * | ||
| 327 | * If you perform a xen_swiotlb_map_page() but wish to interrogate the buffer | ||
| 328 | * using the cpu, yet do not wish to teardown the dma mapping, you must | ||
| 329 | * call this function before doing so. At the next point you give the dma | ||
| 330 | * address back to the card, you must first perform a | ||
| 331 | * xen_swiotlb_dma_sync_for_device, and then the device again owns the buffer | ||
| 332 | */ | ||
| 333 | static void | ||
| 334 | xen_swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr, | ||
| 335 | size_t size, enum dma_data_direction dir, | ||
| 336 | enum dma_sync_target target) | ||
| 337 | { | ||
| 338 | phys_addr_t paddr = xen_bus_to_phys(dev_addr); | ||
| 339 | |||
| 340 | BUG_ON(dir == DMA_NONE); | ||
| 341 | |||
| 342 | /* NOTE: We use dev_addr here, not paddr! */ | ||
| 343 | if (is_xen_swiotlb_buffer(dev_addr)) { | ||
| 344 | swiotlb_tbl_sync_single(hwdev, phys_to_virt(paddr), size, dir, | ||
| 345 | target); | ||
| 346 | return; | ||
| 347 | } | ||
| 348 | |||
| 349 | if (dir != DMA_FROM_DEVICE) | ||
| 350 | return; | ||
| 351 | |||
| 352 | dma_mark_clean(phys_to_virt(paddr), size); | ||
| 353 | } | ||
| 354 | |||
| 355 | void | ||
| 356 | xen_swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, | ||
| 357 | size_t size, enum dma_data_direction dir) | ||
| 358 | { | ||
| 359 | xen_swiotlb_sync_single(hwdev, dev_addr, size, dir, SYNC_FOR_CPU); | ||
| 360 | } | ||
| 361 | EXPORT_SYMBOL_GPL(xen_swiotlb_sync_single_for_cpu); | ||
| 362 | |||
| 363 | void | ||
| 364 | xen_swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr, | ||
| 365 | size_t size, enum dma_data_direction dir) | ||
| 366 | { | ||
| 367 | xen_swiotlb_sync_single(hwdev, dev_addr, size, dir, SYNC_FOR_DEVICE); | ||
| 368 | } | ||
| 369 | EXPORT_SYMBOL_GPL(xen_swiotlb_sync_single_for_device); | ||
| 370 | |||
| 371 | /* | ||
| 372 | * Map a set of buffers described by scatterlist in streaming mode for DMA. | ||
| 373 | * This is the scatter-gather version of the above xen_swiotlb_map_page | ||
| 374 | * interface. Here the scatter gather list elements are each tagged with the | ||
| 375 | * appropriate dma address and length. They are obtained via | ||
| 376 | * sg_dma_{address,length}(SG). | ||
| 377 | * | ||
| 378 | * NOTE: An implementation may be able to use a smaller number of | ||
| 379 | * DMA address/length pairs than there are SG table elements. | ||
| 380 | * (for example via virtual mapping capabilities) | ||
| 381 | * The routine returns the number of addr/length pairs actually | ||
| 382 | * used, at most nents. | ||
| 383 | * | ||
| 384 | * Device ownership issues as mentioned above for xen_swiotlb_map_page are the | ||
| 385 | * same here. | ||
| 386 | */ | ||
| 387 | int | ||
| 388 | xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, | ||
| 389 | int nelems, enum dma_data_direction dir, | ||
| 390 | struct dma_attrs *attrs) | ||
| 391 | { | ||
| 392 | struct scatterlist *sg; | ||
| 393 | int i; | ||
| 394 | |||
| 395 | BUG_ON(dir == DMA_NONE); | ||
| 396 | |||
| 397 | for_each_sg(sgl, sg, nelems, i) { | ||
| 398 | phys_addr_t paddr = sg_phys(sg); | ||
| 399 | dma_addr_t dev_addr = xen_phys_to_bus(paddr); | ||
| 400 | |||
| 401 | if (swiotlb_force || | ||
| 402 | !dma_capable(hwdev, dev_addr, sg->length) || | ||
| 403 | range_straddles_page_boundary(paddr, sg->length)) { | ||
| 404 | void *map = swiotlb_tbl_map_single(hwdev, | ||
| 405 | start_dma_addr, | ||
| 406 | sg_phys(sg), | ||
| 407 | sg->length, dir); | ||
| 408 | if (!map) { | ||
| 409 | /* Don't panic here, we expect map_sg users | ||
| 410 | to do proper error handling. */ | ||
| 411 | xen_swiotlb_unmap_sg_attrs(hwdev, sgl, i, dir, | ||
| 412 | attrs); | ||
| 413 | sgl[0].dma_length = 0; | ||
| 414 | return DMA_ERROR_CODE; | ||
| 415 | } | ||
| 416 | sg->dma_address = xen_virt_to_bus(map); | ||
| 417 | } else | ||
| 418 | sg->dma_address = dev_addr; | ||
| 419 | sg->dma_length = sg->length; | ||
| 420 | } | ||
| 421 | return nelems; | ||
| 422 | } | ||
| 423 | EXPORT_SYMBOL_GPL(xen_swiotlb_map_sg_attrs); | ||
| 424 | |||
| 425 | int | ||
| 426 | xen_swiotlb_map_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, | ||
| 427 | enum dma_data_direction dir) | ||
| 428 | { | ||
| 429 | return xen_swiotlb_map_sg_attrs(hwdev, sgl, nelems, dir, NULL); | ||
| 430 | } | ||
| 431 | EXPORT_SYMBOL_GPL(xen_swiotlb_map_sg); | ||
| 432 | |||
| 433 | /* | ||
| 434 | * Unmap a set of streaming mode DMA translations. Again, cpu read rules | ||
| 435 | * concerning calls here are the same as for swiotlb_unmap_page() above. | ||
| 436 | */ | ||
| 437 | void | ||
| 438 | xen_swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl, | ||
| 439 | int nelems, enum dma_data_direction dir, | ||
| 440 | struct dma_attrs *attrs) | ||
| 441 | { | ||
| 442 | struct scatterlist *sg; | ||
| 443 | int i; | ||
| 444 | |||
| 445 | BUG_ON(dir == DMA_NONE); | ||
| 446 | |||
| 447 | for_each_sg(sgl, sg, nelems, i) | ||
| 448 | xen_unmap_single(hwdev, sg->dma_address, sg->dma_length, dir); | ||
| 449 | |||
| 450 | } | ||
| 451 | EXPORT_SYMBOL_GPL(xen_swiotlb_unmap_sg_attrs); | ||
| 452 | |||
| 453 | void | ||
| 454 | xen_swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sgl, int nelems, | ||
| 455 | enum dma_data_direction dir) | ||
| 456 | { | ||
| 457 | return xen_swiotlb_unmap_sg_attrs(hwdev, sgl, nelems, dir, NULL); | ||
| 458 | } | ||
| 459 | EXPORT_SYMBOL_GPL(xen_swiotlb_unmap_sg); | ||
| 460 | |||
| 461 | /* | ||
| 462 | * Make physical memory consistent for a set of streaming mode DMA translations | ||
| 463 | * after a transfer. | ||
| 464 | * | ||
| 465 | * The same as swiotlb_sync_single_* but for a scatter-gather list, same rules | ||
| 466 | * and usage. | ||
| 467 | */ | ||
| 468 | static void | ||
| 469 | xen_swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sgl, | ||
| 470 | int nelems, enum dma_data_direction dir, | ||
| 471 | enum dma_sync_target target) | ||
| 472 | { | ||
| 473 | struct scatterlist *sg; | ||
| 474 | int i; | ||
| 475 | |||
| 476 | for_each_sg(sgl, sg, nelems, i) | ||
| 477 | xen_swiotlb_sync_single(hwdev, sg->dma_address, | ||
| 478 | sg->dma_length, dir, target); | ||
| 479 | } | ||
| 480 | |||
| 481 | void | ||
| 482 | xen_swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, | ||
| 483 | int nelems, enum dma_data_direction dir) | ||
| 484 | { | ||
| 485 | xen_swiotlb_sync_sg(hwdev, sg, nelems, dir, SYNC_FOR_CPU); | ||
| 486 | } | ||
| 487 | EXPORT_SYMBOL_GPL(xen_swiotlb_sync_sg_for_cpu); | ||
| 488 | |||
| 489 | void | ||
| 490 | xen_swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, | ||
| 491 | int nelems, enum dma_data_direction dir) | ||
| 492 | { | ||
| 493 | xen_swiotlb_sync_sg(hwdev, sg, nelems, dir, SYNC_FOR_DEVICE); | ||
| 494 | } | ||
| 495 | EXPORT_SYMBOL_GPL(xen_swiotlb_sync_sg_for_device); | ||
| 496 | |||
| 497 | int | ||
| 498 | xen_swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr) | ||
| 499 | { | ||
| 500 | return !dma_addr; | ||
| 501 | } | ||
| 502 | EXPORT_SYMBOL_GPL(xen_swiotlb_dma_mapping_error); | ||
| 503 | |||
| 504 | /* | ||
| 505 | * Return whether the given device DMA address mask can be supported | ||
| 506 | * properly. For example, if your device can only drive the low 24-bits | ||
| 507 | * during bus mastering, then you would pass 0x00ffffff as the mask to | ||
| 508 | * this function. | ||
| 509 | */ | ||
| 510 | int | ||
| 511 | xen_swiotlb_dma_supported(struct device *hwdev, u64 mask) | ||
| 512 | { | ||
| 513 | return xen_virt_to_bus(xen_io_tlb_end - 1) <= mask; | ||
| 514 | } | ||
| 515 | EXPORT_SYMBOL_GPL(xen_swiotlb_dma_supported); | ||
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 2f76c4a081a2..7d9d06ba184b 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
| @@ -68,7 +68,7 @@ int nr_pdflush_threads; | |||
| 68 | */ | 68 | */ |
| 69 | int writeback_in_progress(struct backing_dev_info *bdi) | 69 | int writeback_in_progress(struct backing_dev_info *bdi) |
| 70 | { | 70 | { |
| 71 | return !list_empty(&bdi->work_list); | 71 | return test_bit(BDI_writeback_running, &bdi->state); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | static void bdi_queue_work(struct backing_dev_info *bdi, | 74 | static void bdi_queue_work(struct backing_dev_info *bdi, |
| @@ -249,10 +249,18 @@ static void move_expired_inodes(struct list_head *delaying_queue, | |||
| 249 | 249 | ||
| 250 | /* | 250 | /* |
| 251 | * Queue all expired dirty inodes for io, eldest first. | 251 | * Queue all expired dirty inodes for io, eldest first. |
| 252 | * Before | ||
| 253 | * newly dirtied b_dirty b_io b_more_io | ||
| 254 | * =============> gf edc BA | ||
| 255 | * After | ||
| 256 | * newly dirtied b_dirty b_io b_more_io | ||
| 257 | * =============> g fBAedc | ||
| 258 | * | | ||
| 259 | * +--> dequeue for IO | ||
| 252 | */ | 260 | */ |
| 253 | static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this) | 261 | static void queue_io(struct bdi_writeback *wb, unsigned long *older_than_this) |
| 254 | { | 262 | { |
| 255 | list_splice_init(&wb->b_more_io, wb->b_io.prev); | 263 | list_splice_init(&wb->b_more_io, &wb->b_io); |
| 256 | move_expired_inodes(&wb->b_dirty, &wb->b_io, older_than_this); | 264 | move_expired_inodes(&wb->b_dirty, &wb->b_io, older_than_this); |
| 257 | } | 265 | } |
| 258 | 266 | ||
| @@ -363,62 +371,35 @@ writeback_single_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 363 | spin_lock(&inode_lock); | 371 | spin_lock(&inode_lock); |
| 364 | inode->i_state &= ~I_SYNC; | 372 | inode->i_state &= ~I_SYNC; |
| 365 | if (!(inode->i_state & I_FREEING)) { | 373 | if (!(inode->i_state & I_FREEING)) { |
| 366 | if ((inode->i_state & I_DIRTY_PAGES) && wbc->for_kupdate) { | 374 | if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) { |
| 367 | /* | ||
| 368 | * More pages get dirtied by a fast dirtier. | ||
| 369 | */ | ||
| 370 | goto select_queue; | ||
| 371 | } else if (inode->i_state & I_DIRTY) { | ||
| 372 | /* | ||
| 373 | * At least XFS will redirty the inode during the | ||
| 374 | * writeback (delalloc) and on io completion (isize). | ||
| 375 | */ | ||
| 376 | redirty_tail(inode); | ||
| 377 | } else if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) { | ||
| 378 | /* | 375 | /* |
| 379 | * We didn't write back all the pages. nfs_writepages() | 376 | * We didn't write back all the pages. nfs_writepages() |
| 380 | * sometimes bales out without doing anything. Redirty | 377 | * sometimes bales out without doing anything. |
| 381 | * the inode; Move it from b_io onto b_more_io/b_dirty. | ||
| 382 | */ | 378 | */ |
| 383 | /* | 379 | inode->i_state |= I_DIRTY_PAGES; |
| 384 | * akpm: if the caller was the kupdate function we put | 380 | if (wbc->nr_to_write <= 0) { |
| 385 | * this inode at the head of b_dirty so it gets first | ||
| 386 | * consideration. Otherwise, move it to the tail, for | ||
| 387 | * the reasons described there. I'm not really sure | ||
| 388 | * how much sense this makes. Presumably I had a good | ||
| 389 | * reasons for doing it this way, and I'd rather not | ||
| 390 | * muck with it at present. | ||
| 391 | */ | ||
| 392 | if (wbc->for_kupdate) { | ||
| 393 | /* | 381 | /* |
| 394 | * For the kupdate function we move the inode | 382 | * slice used up: queue for next turn |
| 395 | * to b_more_io so it will get more writeout as | ||
| 396 | * soon as the queue becomes uncongested. | ||
| 397 | */ | 383 | */ |
| 398 | inode->i_state |= I_DIRTY_PAGES; | 384 | requeue_io(inode); |
| 399 | select_queue: | ||
| 400 | if (wbc->nr_to_write <= 0) { | ||
| 401 | /* | ||
| 402 | * slice used up: queue for next turn | ||
| 403 | */ | ||
| 404 | requeue_io(inode); | ||
| 405 | } else { | ||
| 406 | /* | ||
| 407 | * somehow blocked: retry later | ||
| 408 | */ | ||
| 409 | redirty_tail(inode); | ||
| 410 | } | ||
| 411 | } else { | 385 | } else { |
| 412 | /* | 386 | /* |
| 413 | * Otherwise fully redirty the inode so that | 387 | * Writeback blocked by something other than |
| 414 | * other inodes on this superblock will get some | 388 | * congestion. Delay the inode for some time to |
| 415 | * writeout. Otherwise heavy writing to one | 389 | * avoid spinning on the CPU (100% iowait) |
| 416 | * file would indefinitely suspend writeout of | 390 | * retrying writeback of the dirty page/inode |
| 417 | * all the other files. | 391 | * that cannot be performed immediately. |
| 418 | */ | 392 | */ |
| 419 | inode->i_state |= I_DIRTY_PAGES; | ||
| 420 | redirty_tail(inode); | 393 | redirty_tail(inode); |
| 421 | } | 394 | } |
| 395 | } else if (inode->i_state & I_DIRTY) { | ||
| 396 | /* | ||
| 397 | * Filesystems can dirty the inode during writeback | ||
| 398 | * operations, such as delayed allocation during | ||
| 399 | * submission or metadata updates after data IO | ||
| 400 | * completion. | ||
| 401 | */ | ||
| 402 | redirty_tail(inode); | ||
| 422 | } else if (atomic_read(&inode->i_count)) { | 403 | } else if (atomic_read(&inode->i_count)) { |
| 423 | /* | 404 | /* |
| 424 | * The inode is clean, inuse | 405 | * The inode is clean, inuse |
| @@ -590,7 +571,7 @@ static inline bool over_bground_thresh(void) | |||
| 590 | { | 571 | { |
| 591 | unsigned long background_thresh, dirty_thresh; | 572 | unsigned long background_thresh, dirty_thresh; |
| 592 | 573 | ||
| 593 | get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL); | 574 | global_dirty_limits(&background_thresh, &dirty_thresh); |
| 594 | 575 | ||
| 595 | return (global_page_state(NR_FILE_DIRTY) + | 576 | return (global_page_state(NR_FILE_DIRTY) + |
| 596 | global_page_state(NR_UNSTABLE_NFS) >= background_thresh); | 577 | global_page_state(NR_UNSTABLE_NFS) >= background_thresh); |
| @@ -759,6 +740,7 @@ long wb_do_writeback(struct bdi_writeback *wb, int force_wait) | |||
| 759 | struct wb_writeback_work *work; | 740 | struct wb_writeback_work *work; |
| 760 | long wrote = 0; | 741 | long wrote = 0; |
| 761 | 742 | ||
| 743 | set_bit(BDI_writeback_running, &wb->bdi->state); | ||
| 762 | while ((work = get_next_work_item(bdi)) != NULL) { | 744 | while ((work = get_next_work_item(bdi)) != NULL) { |
| 763 | /* | 745 | /* |
| 764 | * Override sync mode, in case we must wait for completion | 746 | * Override sync mode, in case we must wait for completion |
| @@ -785,6 +767,7 @@ long wb_do_writeback(struct bdi_writeback *wb, int force_wait) | |||
| 785 | * Check for periodic writeback, kupdated() style | 767 | * Check for periodic writeback, kupdated() style |
| 786 | */ | 768 | */ |
| 787 | wrote += wb_check_old_data_flush(wb); | 769 | wrote += wb_check_old_data_flush(wb); |
| 770 | clear_bit(BDI_writeback_running, &wb->bdi->state); | ||
| 788 | 771 | ||
| 789 | return wrote; | 772 | return wrote; |
| 790 | } | 773 | } |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index e5039a2856f8..103f08aca764 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
| @@ -148,13 +148,17 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache) | |||
| 148 | #define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) | 148 | #define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) |
| 149 | #define ACPI_FREE(a) kfree(a) | 149 | #define ACPI_FREE(a) kfree(a) |
| 150 | 150 | ||
| 151 | /* Used within ACPICA to show where it is safe to preempt execution */ | 151 | #ifndef CONFIG_PREEMPT |
| 152 | #include <linux/hardirq.h> | 152 | /* |
| 153 | * Used within ACPICA to show where it is safe to preempt execution | ||
| 154 | * when CONFIG_PREEMPT=n | ||
| 155 | */ | ||
| 153 | #define ACPI_PREEMPTION_POINT() \ | 156 | #define ACPI_PREEMPTION_POINT() \ |
| 154 | do { \ | 157 | do { \ |
| 155 | if (!in_atomic_preempt_off() && !irqs_disabled()) \ | 158 | if (!irqs_disabled()) \ |
| 156 | cond_resched(); \ | 159 | cond_resched(); \ |
| 157 | } while (0) | 160 | } while (0) |
| 161 | #endif | ||
| 158 | 162 | ||
| 159 | #endif /* __KERNEL__ */ | 163 | #endif /* __KERNEL__ */ |
| 160 | 164 | ||
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index e2a4da7d7fab..2a512bc0d4ab 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -1075,7 +1075,6 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev, | |||
| 1075 | return ((dev->driver->driver_features & feature) ? 1 : 0); | 1075 | return ((dev->driver->driver_features & feature) ? 1 : 0); |
| 1076 | } | 1076 | } |
| 1077 | 1077 | ||
| 1078 | |||
| 1079 | static inline int drm_dev_to_irq(struct drm_device *dev) | 1078 | static inline int drm_dev_to_irq(struct drm_device *dev) |
| 1080 | { | 1079 | { |
| 1081 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) | 1080 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) |
| @@ -1084,11 +1083,22 @@ static inline int drm_dev_to_irq(struct drm_device *dev) | |||
| 1084 | return dev->pdev->irq; | 1083 | return dev->pdev->irq; |
| 1085 | } | 1084 | } |
| 1086 | 1085 | ||
| 1087 | #ifdef __alpha__ | 1086 | static inline int drm_get_pci_domain(struct drm_device *dev) |
| 1088 | #define drm_get_pci_domain(dev) dev->hose->index | 1087 | { |
| 1089 | #else | 1088 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) |
| 1090 | #define drm_get_pci_domain(dev) 0 | 1089 | return 0; |
| 1091 | #endif | 1090 | |
| 1091 | #ifndef __alpha__ | ||
| 1092 | /* For historical reasons, drm_get_pci_domain() is busticated | ||
| 1093 | * on most archs and has to remain so for userspace interface | ||
| 1094 | * < 1.4, except on alpha which was right from the beginning | ||
| 1095 | */ | ||
| 1096 | if (dev->if_version < 0x10004) | ||
| 1097 | return 0; | ||
| 1098 | #endif /* __alpha__ */ | ||
| 1099 | |||
| 1100 | return pci_domain_nr(dev->pdev->bus); | ||
| 1101 | } | ||
| 1092 | 1102 | ||
| 1093 | #if __OS_HAS_AGP | 1103 | #if __OS_HAS_AGP |
| 1094 | static inline int drm_core_has_AGP(struct drm_device *dev) | 1104 | static inline int drm_core_has_AGP(struct drm_device *dev) |
diff --git a/include/drm/drm_core.h b/include/drm/drm_core.h index 316739036079..4e7523863a4b 100644 --- a/include/drm/drm_core.h +++ b/include/drm/drm_core.h | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | #define CORE_DATE "20060810" | 27 | #define CORE_DATE "20060810" |
| 28 | 28 | ||
| 29 | #define DRM_IF_MAJOR 1 | 29 | #define DRM_IF_MAJOR 1 |
| 30 | #define DRM_IF_MINOR 3 | 30 | #define DRM_IF_MINOR 4 |
| 31 | 31 | ||
| 32 | #define CORE_MAJOR 1 | 32 | #define CORE_MAJOR 1 |
| 33 | #define CORE_MINOR 1 | 33 | #define CORE_MINOR 1 |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index c707270bff5a..c9f3cc5949a8 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -189,49 +189,16 @@ enum subpixel_order { | |||
| 189 | */ | 189 | */ |
| 190 | struct drm_display_info { | 190 | struct drm_display_info { |
| 191 | char name[DRM_DISPLAY_INFO_LEN]; | 191 | char name[DRM_DISPLAY_INFO_LEN]; |
| 192 | /* Input info */ | 192 | |
| 193 | bool serration_vsync; | ||
| 194 | bool sync_on_green; | ||
| 195 | bool composite_sync; | ||
| 196 | bool separate_syncs; | ||
| 197 | bool blank_to_black; | ||
| 198 | unsigned char video_level; | ||
| 199 | bool digital; | ||
| 200 | /* Physical size */ | 193 | /* Physical size */ |
| 201 | unsigned int width_mm; | 194 | unsigned int width_mm; |
| 202 | unsigned int height_mm; | 195 | unsigned int height_mm; |
| 203 | 196 | ||
| 204 | /* Display parameters */ | ||
| 205 | unsigned char gamma; /* FIXME: storage format */ | ||
| 206 | bool gtf_supported; | ||
| 207 | bool standard_color; | ||
| 208 | enum { | ||
| 209 | monochrome = 0, | ||
| 210 | rgb, | ||
| 211 | other, | ||
| 212 | unknown, | ||
| 213 | } display_type; | ||
| 214 | bool active_off_supported; | ||
| 215 | bool suspend_supported; | ||
| 216 | bool standby_supported; | ||
| 217 | |||
| 218 | /* Color info FIXME: storage format */ | ||
| 219 | unsigned short redx, redy; | ||
| 220 | unsigned short greenx, greeny; | ||
| 221 | unsigned short bluex, bluey; | ||
| 222 | unsigned short whitex, whitey; | ||
| 223 | |||
| 224 | /* Clock limits FIXME: storage format */ | 197 | /* Clock limits FIXME: storage format */ |
| 225 | unsigned int min_vfreq, max_vfreq; | 198 | unsigned int min_vfreq, max_vfreq; |
| 226 | unsigned int min_hfreq, max_hfreq; | 199 | unsigned int min_hfreq, max_hfreq; |
| 227 | unsigned int pixel_clock; | 200 | unsigned int pixel_clock; |
| 228 | 201 | ||
| 229 | /* White point indices FIXME: storage format */ | ||
| 230 | unsigned int wpx1, wpy1; | ||
| 231 | unsigned int wpgamma1; | ||
| 232 | unsigned int wpx2, wpy2; | ||
| 233 | unsigned int wpgamma2; | ||
| 234 | |||
| 235 | enum subpixel_order subpixel_order; | 202 | enum subpixel_order subpixel_order; |
| 236 | 203 | ||
| 237 | char *raw_edid; /* if any */ | 204 | char *raw_edid; /* if any */ |
| @@ -342,7 +309,7 @@ struct drm_crtc_funcs { | |||
| 342 | 309 | ||
| 343 | /* Set gamma on the CRTC */ | 310 | /* Set gamma on the CRTC */ |
| 344 | void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, | 311 | void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, |
| 345 | uint32_t size); | 312 | uint32_t start, uint32_t size); |
| 346 | /* Object destroy routine */ | 313 | /* Object destroy routine */ |
| 347 | void (*destroy)(struct drm_crtc *crtc); | 314 | void (*destroy)(struct drm_crtc *crtc); |
| 348 | 315 | ||
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 39e2cc5c7e66..5881fad91faa 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
| @@ -28,6 +28,12 @@ | |||
| 28 | #define EDID_LENGTH 128 | 28 | #define EDID_LENGTH 128 |
| 29 | #define DDC_ADDR 0x50 | 29 | #define DDC_ADDR 0x50 |
| 30 | 30 | ||
| 31 | #define CEA_EXT 0x02 | ||
| 32 | #define VTB_EXT 0x10 | ||
| 33 | #define DI_EXT 0x40 | ||
| 34 | #define LS_EXT 0x50 | ||
| 35 | #define MI_EXT 0x60 | ||
| 36 | |||
| 31 | struct est_timings { | 37 | struct est_timings { |
| 32 | u8 t1; | 38 | u8 t1; |
| 33 | u8 t2; | 39 | u8 t2; |
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 7628219e5386..35b00746c712 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
| @@ -31,6 +31,7 @@ enum bdi_state { | |||
| 31 | BDI_async_congested, /* The async (write) queue is getting full */ | 31 | BDI_async_congested, /* The async (write) queue is getting full */ |
| 32 | BDI_sync_congested, /* The sync queue is getting full */ | 32 | BDI_sync_congested, /* The sync queue is getting full */ |
| 33 | BDI_registered, /* bdi_register() was done */ | 33 | BDI_registered, /* bdi_register() was done */ |
| 34 | BDI_writeback_running, /* Writeback is in progress */ | ||
| 34 | BDI_unused, /* Available bits start here */ | 35 | BDI_unused, /* Available bits start here */ |
| 35 | }; | 36 | }; |
| 36 | 37 | ||
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 53691774d34e..ca83a97c9715 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h | |||
| @@ -150,6 +150,7 @@ enum rq_flag_bits { | |||
| 150 | __REQ_FLUSH, /* request for cache flush */ | 150 | __REQ_FLUSH, /* request for cache flush */ |
| 151 | __REQ_IO_STAT, /* account I/O stat */ | 151 | __REQ_IO_STAT, /* account I/O stat */ |
| 152 | __REQ_MIXED_MERGE, /* merge of different types, fail separately */ | 152 | __REQ_MIXED_MERGE, /* merge of different types, fail separately */ |
| 153 | __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */ | ||
| 153 | __REQ_NR_BITS, /* stops here */ | 154 | __REQ_NR_BITS, /* stops here */ |
| 154 | }; | 155 | }; |
| 155 | 156 | ||
| @@ -190,5 +191,6 @@ enum rq_flag_bits { | |||
| 190 | #define REQ_FLUSH (1 << __REQ_FLUSH) | 191 | #define REQ_FLUSH (1 << __REQ_FLUSH) |
| 191 | #define REQ_IO_STAT (1 << __REQ_IO_STAT) | 192 | #define REQ_IO_STAT (1 << __REQ_IO_STAT) |
| 192 | #define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) | 193 | #define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) |
| 194 | #define REQ_SECURE (1 << __REQ_SECURE) | ||
| 193 | 195 | ||
| 194 | #endif /* __LINUX_BLK_TYPES_H */ | 196 | #endif /* __LINUX_BLK_TYPES_H */ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 89c855c5655c..2c54906f678f 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -389,6 +389,7 @@ struct request_queue | |||
| 389 | #define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ | 389 | #define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ |
| 390 | #define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ | 390 | #define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ |
| 391 | #define QUEUE_FLAG_ADD_RANDOM 18 /* Contributes to random pool */ | 391 | #define QUEUE_FLAG_ADD_RANDOM 18 /* Contributes to random pool */ |
| 392 | #define QUEUE_FLAG_SECDISCARD 19 /* supports SECDISCARD */ | ||
| 392 | 393 | ||
| 393 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 394 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
| 394 | (1 << QUEUE_FLAG_CLUSTER) | \ | 395 | (1 << QUEUE_FLAG_CLUSTER) | \ |
| @@ -524,6 +525,8 @@ enum { | |||
| 524 | #define blk_queue_stackable(q) \ | 525 | #define blk_queue_stackable(q) \ |
| 525 | test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) | 526 | test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) |
| 526 | #define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) | 527 | #define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) |
| 528 | #define blk_queue_secdiscard(q) (blk_queue_discard(q) && \ | ||
| 529 | test_bit(QUEUE_FLAG_SECDISCARD, &(q)->queue_flags)) | ||
| 527 | 530 | ||
| 528 | #define blk_noretry_request(rq) \ | 531 | #define blk_noretry_request(rq) \ |
| 529 | ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \ | 532 | ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \ |
| @@ -918,10 +921,12 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt, | |||
| 918 | } | 921 | } |
| 919 | enum{ | 922 | enum{ |
| 920 | BLKDEV_WAIT, /* wait for completion */ | 923 | BLKDEV_WAIT, /* wait for completion */ |
| 921 | BLKDEV_BARRIER, /*issue request with barrier */ | 924 | BLKDEV_BARRIER, /* issue request with barrier */ |
| 925 | BLKDEV_SECURE, /* secure discard */ | ||
| 922 | }; | 926 | }; |
| 923 | #define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT) | 927 | #define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT) |
| 924 | #define BLKDEV_IFL_BARRIER (1 << BLKDEV_BARRIER) | 928 | #define BLKDEV_IFL_BARRIER (1 << BLKDEV_BARRIER) |
| 929 | #define BLKDEV_IFL_SECURE (1 << BLKDEV_SECURE) | ||
| 925 | extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *, | 930 | extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *, |
| 926 | unsigned long); | 931 | unsigned long); |
| 927 | extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector, | 932 | extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector, |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 267d02630517..7a0625e26a39 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -174,6 +174,7 @@ struct inodes_stat_t { | |||
| 174 | */ | 174 | */ |
| 175 | #define DISCARD_NOBARRIER (WRITE | REQ_DISCARD) | 175 | #define DISCARD_NOBARRIER (WRITE | REQ_DISCARD) |
| 176 | #define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER) | 176 | #define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER) |
| 177 | #define DISCARD_SECURE (DISCARD_NOBARRIER | REQ_SECURE) | ||
| 177 | 178 | ||
| 178 | #define SEL_IN 1 | 179 | #define SEL_IN 1 |
| 179 | #define SEL_OUT 2 | 180 | #define SEL_OUT 2 |
| @@ -317,6 +318,7 @@ struct inodes_stat_t { | |||
| 317 | #define BLKALIGNOFF _IO(0x12,122) | 318 | #define BLKALIGNOFF _IO(0x12,122) |
| 318 | #define BLKPBSZGET _IO(0x12,123) | 319 | #define BLKPBSZGET _IO(0x12,123) |
| 319 | #define BLKDISCARDZEROES _IO(0x12,124) | 320 | #define BLKDISCARDZEROES _IO(0x12,124) |
| 321 | #define BLKSECDISCARD _IO(0x12,125) | ||
| 320 | 322 | ||
| 321 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ | 323 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ |
| 322 | #define FIBMAP _IO(0x00,1) /* bmap access */ | 324 | #define FIBMAP _IO(0x00,1) /* bmap access */ |
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h index e0ea40f6c515..0a6b3d5c490c 100644 --- a/include/linux/io-mapping.h +++ b/include/linux/io-mapping.h | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
| 23 | #include <asm/io.h> | 23 | #include <asm/io.h> |
| 24 | #include <asm/page.h> | 24 | #include <asm/page.h> |
| 25 | #include <asm/iomap.h> | ||
| 26 | 25 | ||
| 27 | /* | 26 | /* |
| 28 | * The io_mapping mechanism provides an abstraction for mapping | 27 | * The io_mapping mechanism provides an abstraction for mapping |
| @@ -33,6 +32,8 @@ | |||
| 33 | 32 | ||
| 34 | #ifdef CONFIG_HAVE_ATOMIC_IOMAP | 33 | #ifdef CONFIG_HAVE_ATOMIC_IOMAP |
| 35 | 34 | ||
| 35 | #include <asm/iomap.h> | ||
| 36 | |||
| 36 | struct io_mapping { | 37 | struct io_mapping { |
| 37 | resource_size_t base; | 38 | resource_size_t base; |
| 38 | unsigned long size; | 39 | unsigned long size; |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 4d893eaf8174..6b7525099e56 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
| @@ -31,6 +31,7 @@ struct mmc_csd { | |||
| 31 | unsigned int tacc_ns; | 31 | unsigned int tacc_ns; |
| 32 | unsigned int r2w_factor; | 32 | unsigned int r2w_factor; |
| 33 | unsigned int max_dtr; | 33 | unsigned int max_dtr; |
| 34 | unsigned int erase_size; /* In sectors */ | ||
| 34 | unsigned int read_blkbits; | 35 | unsigned int read_blkbits; |
| 35 | unsigned int write_blkbits; | 36 | unsigned int write_blkbits; |
| 36 | unsigned int capacity; | 37 | unsigned int capacity; |
| @@ -42,9 +43,16 @@ struct mmc_csd { | |||
| 42 | 43 | ||
| 43 | struct mmc_ext_csd { | 44 | struct mmc_ext_csd { |
| 44 | u8 rev; | 45 | u8 rev; |
| 46 | u8 erase_group_def; | ||
| 47 | u8 sec_feature_support; | ||
| 45 | unsigned int sa_timeout; /* Units: 100ns */ | 48 | unsigned int sa_timeout; /* Units: 100ns */ |
| 46 | unsigned int hs_max_dtr; | 49 | unsigned int hs_max_dtr; |
| 47 | unsigned int sectors; | 50 | unsigned int sectors; |
| 51 | unsigned int hc_erase_size; /* In sectors */ | ||
| 52 | unsigned int hc_erase_timeout; /* In milliseconds */ | ||
| 53 | unsigned int sec_trim_mult; /* Secure trim multiplier */ | ||
| 54 | unsigned int sec_erase_mult; /* Secure erase multiplier */ | ||
| 55 | unsigned int trim_timeout; /* In milliseconds */ | ||
| 48 | }; | 56 | }; |
| 49 | 57 | ||
| 50 | struct sd_scr { | 58 | struct sd_scr { |
| @@ -54,6 +62,12 @@ struct sd_scr { | |||
| 54 | #define SD_SCR_BUS_WIDTH_4 (1<<2) | 62 | #define SD_SCR_BUS_WIDTH_4 (1<<2) |
| 55 | }; | 63 | }; |
| 56 | 64 | ||
| 65 | struct sd_ssr { | ||
| 66 | unsigned int au; /* In sectors */ | ||
| 67 | unsigned int erase_timeout; /* In milliseconds */ | ||
| 68 | unsigned int erase_offset; /* In milliseconds */ | ||
| 69 | }; | ||
| 70 | |||
| 57 | struct sd_switch_caps { | 71 | struct sd_switch_caps { |
| 58 | unsigned int hs_max_dtr; | 72 | unsigned int hs_max_dtr; |
| 59 | }; | 73 | }; |
| @@ -106,6 +120,11 @@ struct mmc_card { | |||
| 106 | #define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */ | 120 | #define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */ |
| 107 | /* (missing CIA registers) */ | 121 | /* (missing CIA registers) */ |
| 108 | 122 | ||
| 123 | unsigned int erase_size; /* erase size in sectors */ | ||
| 124 | unsigned int erase_shift; /* if erase unit is power 2 */ | ||
| 125 | unsigned int pref_erase; /* in sectors */ | ||
| 126 | u8 erased_byte; /* value of erased bytes */ | ||
| 127 | |||
| 109 | u32 raw_cid[4]; /* raw card CID */ | 128 | u32 raw_cid[4]; /* raw card CID */ |
| 110 | u32 raw_csd[4]; /* raw card CSD */ | 129 | u32 raw_csd[4]; /* raw card CSD */ |
| 111 | u32 raw_scr[2]; /* raw card SCR */ | 130 | u32 raw_scr[2]; /* raw card SCR */ |
| @@ -113,6 +132,7 @@ struct mmc_card { | |||
| 113 | struct mmc_csd csd; /* card specific */ | 132 | struct mmc_csd csd; /* card specific */ |
| 114 | struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */ | 133 | struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */ |
| 115 | struct sd_scr scr; /* extra SD information */ | 134 | struct sd_scr scr; /* extra SD information */ |
| 135 | struct sd_ssr ssr; /* yet more SD information */ | ||
| 116 | struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ | 136 | struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ |
| 117 | 137 | ||
| 118 | unsigned int sdio_funcs; /* number of SDIO functions */ | 138 | unsigned int sdio_funcs; /* number of SDIO functions */ |
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index e4898e9eeb59..7429033acb66 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h | |||
| @@ -92,6 +92,8 @@ struct mmc_command { | |||
| 92 | * actively failing requests | 92 | * actively failing requests |
| 93 | */ | 93 | */ |
| 94 | 94 | ||
| 95 | unsigned int erase_timeout; /* in milliseconds */ | ||
| 96 | |||
| 95 | struct mmc_data *data; /* data segment associated with cmd */ | 97 | struct mmc_data *data; /* data segment associated with cmd */ |
| 96 | struct mmc_request *mrq; /* associated request */ | 98 | struct mmc_request *mrq; /* associated request */ |
| 97 | }; | 99 | }; |
| @@ -134,6 +136,23 @@ extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int); | |||
| 134 | extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, | 136 | extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, |
| 135 | struct mmc_command *, int); | 137 | struct mmc_command *, int); |
| 136 | 138 | ||
| 139 | #define MMC_ERASE_ARG 0x00000000 | ||
| 140 | #define MMC_SECURE_ERASE_ARG 0x80000000 | ||
| 141 | #define MMC_TRIM_ARG 0x00000001 | ||
| 142 | #define MMC_SECURE_TRIM1_ARG 0x80000001 | ||
| 143 | #define MMC_SECURE_TRIM2_ARG 0x80008000 | ||
| 144 | |||
| 145 | #define MMC_SECURE_ARGS 0x80000000 | ||
| 146 | #define MMC_TRIM_ARGS 0x00008001 | ||
| 147 | |||
| 148 | extern int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr, | ||
| 149 | unsigned int arg); | ||
| 150 | extern int mmc_can_erase(struct mmc_card *card); | ||
| 151 | extern int mmc_can_trim(struct mmc_card *card); | ||
| 152 | extern int mmc_can_secure_erase_trim(struct mmc_card *card); | ||
| 153 | extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from, | ||
| 154 | unsigned int nr); | ||
| 155 | |||
| 137 | extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *); | 156 | extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *); |
| 138 | extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int); | 157 | extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int); |
| 139 | 158 | ||
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 513ff0376b09..1575b52c3bfa 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
| @@ -156,6 +156,7 @@ struct mmc_host { | |||
| 156 | #define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */ | 156 | #define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */ |
| 157 | #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ | 157 | #define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */ |
| 158 | #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ | 158 | #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */ |
| 159 | #define MMC_CAP_ERASE (1 << 10) /* Allow erase/trim commands */ | ||
| 159 | 160 | ||
| 160 | mmc_pm_flag_t pm_caps; /* supported pm features */ | 161 | mmc_pm_flag_t pm_caps; /* supported pm features */ |
| 161 | 162 | ||
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 52ce98866287..dd11ae51fb68 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h | |||
| @@ -251,13 +251,21 @@ struct _mmc_csd { | |||
| 251 | * EXT_CSD fields | 251 | * EXT_CSD fields |
| 252 | */ | 252 | */ |
| 253 | 253 | ||
| 254 | #define EXT_CSD_BUS_WIDTH 183 /* R/W */ | 254 | #define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ |
| 255 | #define EXT_CSD_HS_TIMING 185 /* R/W */ | 255 | #define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ |
| 256 | #define EXT_CSD_CARD_TYPE 196 /* RO */ | 256 | #define EXT_CSD_BUS_WIDTH 183 /* R/W */ |
| 257 | #define EXT_CSD_STRUCTURE 194 /* RO */ | 257 | #define EXT_CSD_HS_TIMING 185 /* R/W */ |
| 258 | #define EXT_CSD_REV 192 /* RO */ | 258 | #define EXT_CSD_REV 192 /* RO */ |
| 259 | #define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ | 259 | #define EXT_CSD_STRUCTURE 194 /* RO */ |
| 260 | #define EXT_CSD_S_A_TIMEOUT 217 | 260 | #define EXT_CSD_CARD_TYPE 196 /* RO */ |
| 261 | #define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ | ||
| 262 | #define EXT_CSD_S_A_TIMEOUT 217 /* RO */ | ||
| 263 | #define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */ | ||
| 264 | #define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */ | ||
| 265 | #define EXT_CSD_SEC_TRIM_MULT 229 /* RO */ | ||
| 266 | #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ | ||
| 267 | #define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ | ||
| 268 | #define EXT_CSD_TRIM_MULT 232 /* RO */ | ||
| 261 | 269 | ||
| 262 | /* | 270 | /* |
| 263 | * EXT_CSD field definitions | 271 | * EXT_CSD field definitions |
| @@ -275,6 +283,10 @@ struct _mmc_csd { | |||
| 275 | #define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ | 283 | #define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ |
| 276 | #define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */ | 284 | #define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */ |
| 277 | 285 | ||
| 286 | #define EXT_CSD_SEC_ER_EN BIT(0) | ||
| 287 | #define EXT_CSD_SEC_BD_BLK_EN BIT(2) | ||
| 288 | #define EXT_CSD_SEC_GB_CL_EN BIT(4) | ||
| 289 | |||
| 278 | /* | 290 | /* |
| 279 | * MMC_SWITCH access modes | 291 | * MMC_SWITCH access modes |
| 280 | */ | 292 | */ |
diff --git a/include/linux/mmc/sd.h b/include/linux/mmc/sd.h index f310062cffb4..3fd85e088cc3 100644 --- a/include/linux/mmc/sd.h +++ b/include/linux/mmc/sd.h | |||
| @@ -21,8 +21,13 @@ | |||
| 21 | /* class 10 */ | 21 | /* class 10 */ |
| 22 | #define SD_SWITCH 6 /* adtc [31:0] See below R1 */ | 22 | #define SD_SWITCH 6 /* adtc [31:0] See below R1 */ |
| 23 | 23 | ||
| 24 | /* class 5 */ | ||
| 25 | #define SD_ERASE_WR_BLK_START 32 /* ac [31:0] data addr R1 */ | ||
| 26 | #define SD_ERASE_WR_BLK_END 33 /* ac [31:0] data addr R1 */ | ||
| 27 | |||
| 24 | /* Application commands */ | 28 | /* Application commands */ |
| 25 | #define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */ | 29 | #define SD_APP_SET_BUS_WIDTH 6 /* ac [1:0] bus width R1 */ |
| 30 | #define SD_APP_SD_STATUS 13 /* adtc R1 */ | ||
| 26 | #define SD_APP_SEND_NUM_WR_BLKS 22 /* adtc R1 */ | 31 | #define SD_APP_SEND_NUM_WR_BLKS 22 /* adtc R1 */ |
| 27 | #define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */ | 32 | #define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */ |
| 28 | #define SD_APP_SEND_SCR 51 /* adtc R1 */ | 33 | #define SD_APP_SEND_SCR 51 /* adtc R1 */ |
diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 35aa44ad9f2c..835f85ecd2de 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h | |||
| @@ -1,20 +1,6 @@ | |||
| 1 | #ifndef _LINUX_OF_DEVICE_H | 1 | #ifndef _LINUX_OF_DEVICE_H |
| 2 | #define _LINUX_OF_DEVICE_H | 2 | #define _LINUX_OF_DEVICE_H |
| 3 | 3 | ||
| 4 | /* | ||
| 5 | * The of_device *was* a kind of "base class" that was a superset of | ||
| 6 | * struct device for use by devices attached to an OF node and probed | ||
| 7 | * using OF properties. However, the important bit of OF-style | ||
| 8 | * probing, namely the device node pointer, has been moved into the | ||
| 9 | * common struct device when CONFIG_OF is set to make OF-style probing | ||
| 10 | * available to all bus types. So now, just make of_device and | ||
| 11 | * platform_device equivalent so that current of_platform bus users | ||
| 12 | * can be transparently migrated over to using the platform bus. | ||
| 13 | * | ||
| 14 | * This line will go away once all references to of_device are removed | ||
| 15 | * from the kernel. | ||
| 16 | */ | ||
| 17 | #define of_device platform_device | ||
| 18 | #include <linux/platform_device.h> | 4 | #include <linux/platform_device.h> |
| 19 | #include <linux/of_platform.h> /* temporary until merge */ | 5 | #include <linux/of_platform.h> /* temporary until merge */ |
| 20 | 6 | ||
| @@ -23,8 +9,6 @@ | |||
| 23 | #include <linux/of.h> | 9 | #include <linux/of.h> |
| 24 | #include <linux/mod_devicetable.h> | 10 | #include <linux/mod_devicetable.h> |
| 25 | 11 | ||
| 26 | #define to_of_device(d) container_of(d, struct of_device, dev) | ||
| 27 | |||
| 28 | extern const struct of_device_id *of_match_device( | 12 | extern const struct of_device_id *of_match_device( |
| 29 | const struct of_device_id *matches, const struct device *dev); | 13 | const struct of_device_id *matches, const struct device *dev); |
| 30 | extern void of_device_make_bus_id(struct device *dev); | 14 | extern void of_device_make_bus_id(struct device *dev); |
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 4e6d989c06df..a68716ad38ce 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h | |||
| @@ -19,9 +19,17 @@ | |||
| 19 | #include <linux/of_device.h> | 19 | #include <linux/of_device.h> |
| 20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
| 21 | 21 | ||
| 22 | /* | 22 | /** |
| 23 | * An of_platform_driver driver is attached to a basic of_device on | 23 | * of_platform_driver - Legacy of-aware driver for platform devices. |
| 24 | * the "platform bus" (platform_bus_type). | 24 | * |
| 25 | * An of_platform_driver driver is attached to a basic platform_device on | ||
| 26 | * ether the "platform bus" (platform_bus_type), or the ibm ebus | ||
| 27 | * (ibmebus_bus_type). | ||
| 28 | * | ||
| 29 | * of_platform_driver is being phased out when used with the platform_bus_type, | ||
| 30 | * and regular platform_drivers should be used instead. When the transition | ||
| 31 | * is complete, only ibmebus will be using this structure, and the | ||
| 32 | * platform_driver member of this structure will be removed. | ||
| 25 | */ | 33 | */ |
| 26 | struct of_platform_driver | 34 | struct of_platform_driver |
| 27 | { | 35 | { |
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h index 814f294d4cd0..6228b5b77d35 100644 --- a/include/linux/vgaarb.h +++ b/include/linux/vgaarb.h | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | #ifndef LINUX_VGA_H | 31 | #ifndef LINUX_VGA_H |
| 32 | #define LINUX_VGA_H | 32 | #define LINUX_VGA_H |
| 33 | 33 | ||
| 34 | #include <asm/vga.h> | ||
| 35 | 34 | ||
| 36 | /* Legacy VGA regions */ | 35 | /* Legacy VGA regions */ |
| 37 | #define VGA_RSRC_NONE 0x00 | 36 | #define VGA_RSRC_NONE 0x00 |
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index de05e96e0a70..01c2145118dc 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | 7 | ||
| 8 | struct vm_area_struct; /* vma defining user mapping in mm_types.h */ | 8 | struct vm_area_struct; /* vma defining user mapping in mm_types.h */ |
| 9 | 9 | ||
| 10 | extern bool vmap_lazy_unmap; | ||
| 11 | |||
| 10 | /* bits in flags of vmalloc's vm_struct below */ | 12 | /* bits in flags of vmalloc's vm_struct below */ |
| 11 | #define VM_IOREMAP 0x00000001 /* ioremap() and friends */ | 13 | #define VM_IOREMAP 0x00000001 /* ioremap() and friends */ |
| 12 | #define VM_ALLOC 0x00000002 /* vmalloc() */ | 14 | #define VM_ALLOC 0x00000002 /* vmalloc() */ |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index c24eca71e80c..72a5d647a5f2 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
| @@ -124,8 +124,9 @@ struct ctl_table; | |||
| 124 | int dirty_writeback_centisecs_handler(struct ctl_table *, int, | 124 | int dirty_writeback_centisecs_handler(struct ctl_table *, int, |
| 125 | void __user *, size_t *, loff_t *); | 125 | void __user *, size_t *, loff_t *); |
| 126 | 126 | ||
| 127 | void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty, | 127 | void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty); |
| 128 | unsigned long *pbdi_dirty, struct backing_dev_info *bdi); | 128 | unsigned long bdi_dirty_limit(struct backing_dev_info *bdi, |
| 129 | unsigned long dirty); | ||
| 129 | 130 | ||
| 130 | void page_writeback_init(void); | 131 | void page_writeback_init(void); |
| 131 | void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, | 132 | void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, |
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h index af36ead16817..d3938d3e71f8 100644 --- a/include/xen/interface/memory.h +++ b/include/xen/interface/memory.h | |||
| @@ -9,6 +9,8 @@ | |||
| 9 | #ifndef __XEN_PUBLIC_MEMORY_H__ | 9 | #ifndef __XEN_PUBLIC_MEMORY_H__ |
| 10 | #define __XEN_PUBLIC_MEMORY_H__ | 10 | #define __XEN_PUBLIC_MEMORY_H__ |
| 11 | 11 | ||
| 12 | #include <linux/spinlock.h> | ||
| 13 | |||
| 12 | /* | 14 | /* |
| 13 | * Increase or decrease the specified domain's memory reservation. Returns a | 15 | * Increase or decrease the specified domain's memory reservation. Returns a |
| 14 | * -ve errcode on failure, or the # extents successfully allocated or freed. | 16 | * -ve errcode on failure, or the # extents successfully allocated or freed. |
| @@ -53,6 +55,48 @@ struct xen_memory_reservation { | |||
| 53 | DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation); | 55 | DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation); |
| 54 | 56 | ||
| 55 | /* | 57 | /* |
| 58 | * An atomic exchange of memory pages. If return code is zero then | ||
| 59 | * @out.extent_list provides GMFNs of the newly-allocated memory. | ||
| 60 | * Returns zero on complete success, otherwise a negative error code. | ||
| 61 | * On complete success then always @nr_exchanged == @in.nr_extents. | ||
| 62 | * On partial success @nr_exchanged indicates how much work was done. | ||
| 63 | */ | ||
| 64 | #define XENMEM_exchange 11 | ||
| 65 | struct xen_memory_exchange { | ||
| 66 | /* | ||
| 67 | * [IN] Details of memory extents to be exchanged (GMFN bases). | ||
| 68 | * Note that @in.address_bits is ignored and unused. | ||
| 69 | */ | ||
| 70 | struct xen_memory_reservation in; | ||
| 71 | |||
| 72 | /* | ||
| 73 | * [IN/OUT] Details of new memory extents. | ||
| 74 | * We require that: | ||
| 75 | * 1. @in.domid == @out.domid | ||
| 76 | * 2. @in.nr_extents << @in.extent_order == | ||
| 77 | * @out.nr_extents << @out.extent_order | ||
| 78 | * 3. @in.extent_start and @out.extent_start lists must not overlap | ||
| 79 | * 4. @out.extent_start lists GPFN bases to be populated | ||
| 80 | * 5. @out.extent_start is overwritten with allocated GMFN bases | ||
| 81 | */ | ||
| 82 | struct xen_memory_reservation out; | ||
| 83 | |||
| 84 | /* | ||
| 85 | * [OUT] Number of input extents that were successfully exchanged: | ||
| 86 | * 1. The first @nr_exchanged input extents were successfully | ||
| 87 | * deallocated. | ||
| 88 | * 2. The corresponding first entries in the output extent list correctly | ||
| 89 | * indicate the GMFNs that were successfully exchanged. | ||
| 90 | * 3. All other input and output extents are untouched. | ||
| 91 | * 4. If not all input exents are exchanged then the return code of this | ||
| 92 | * command will be non-zero. | ||
| 93 | * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER! | ||
| 94 | */ | ||
| 95 | unsigned long nr_exchanged; | ||
| 96 | }; | ||
| 97 | |||
| 98 | DEFINE_GUEST_HANDLE_STRUCT(xen_memory_exchange); | ||
| 99 | /* | ||
| 56 | * Returns the maximum machine frame number of mapped RAM in this system. | 100 | * Returns the maximum machine frame number of mapped RAM in this system. |
| 57 | * This command always succeeds (it never returns an error code). | 101 | * This command always succeeds (it never returns an error code). |
| 58 | * arg == NULL. | 102 | * arg == NULL. |
| @@ -142,4 +186,10 @@ struct xen_translate_gpfn_list { | |||
| 142 | }; | 186 | }; |
| 143 | DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list); | 187 | DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list); |
| 144 | 188 | ||
| 189 | |||
| 190 | /* | ||
| 191 | * Prevent the balloon driver from changing the memory reservation | ||
| 192 | * during a driver critical region. | ||
| 193 | */ | ||
| 194 | extern spinlock_t xen_reservation_lock; | ||
| 145 | #endif /* __XEN_PUBLIC_MEMORY_H__ */ | 195 | #endif /* __XEN_PUBLIC_MEMORY_H__ */ |
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h new file mode 100644 index 000000000000..2ea2fdc79c16 --- /dev/null +++ b/include/xen/swiotlb-xen.h | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | #ifndef __LINUX_SWIOTLB_XEN_H | ||
| 2 | #define __LINUX_SWIOTLB_XEN_H | ||
| 3 | |||
| 4 | #include <linux/swiotlb.h> | ||
| 5 | |||
| 6 | extern void xen_swiotlb_init(int verbose); | ||
| 7 | |||
| 8 | extern void | ||
| 9 | *xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, | ||
| 10 | dma_addr_t *dma_handle, gfp_t flags); | ||
| 11 | |||
| 12 | extern void | ||
| 13 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, | ||
| 14 | void *vaddr, dma_addr_t dma_handle); | ||
| 15 | |||
| 16 | extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page, | ||
| 17 | unsigned long offset, size_t size, | ||
| 18 | enum dma_data_direction dir, | ||
| 19 | struct dma_attrs *attrs); | ||
| 20 | |||
| 21 | extern void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr, | ||
| 22 | size_t size, enum dma_data_direction dir, | ||
| 23 | struct dma_attrs *attrs); | ||
| 24 | /* | ||
| 25 | extern int | ||
| 26 | xen_swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, | ||
| 27 | enum dma_data_direction dir); | ||
| 28 | |||
| 29 | extern void | ||
| 30 | xen_swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, | ||
| 31 | enum dma_data_direction dir); | ||
| 32 | */ | ||
| 33 | extern int | ||
| 34 | xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, | ||
| 35 | int nelems, enum dma_data_direction dir, | ||
| 36 | struct dma_attrs *attrs); | ||
| 37 | |||
| 38 | extern void | ||
| 39 | xen_swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl, | ||
| 40 | int nelems, enum dma_data_direction dir, | ||
| 41 | struct dma_attrs *attrs); | ||
| 42 | |||
| 43 | extern void | ||
| 44 | xen_swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, | ||
| 45 | size_t size, enum dma_data_direction dir); | ||
| 46 | |||
| 47 | extern void | ||
| 48 | xen_swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, | ||
| 49 | int nelems, enum dma_data_direction dir); | ||
| 50 | |||
| 51 | extern void | ||
| 52 | xen_swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr, | ||
| 53 | size_t size, enum dma_data_direction dir); | ||
| 54 | |||
| 55 | extern void | ||
| 56 | xen_swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, | ||
| 57 | int nelems, enum dma_data_direction dir); | ||
| 58 | |||
| 59 | extern int | ||
| 60 | xen_swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr); | ||
| 61 | |||
| 62 | extern int | ||
| 63 | xen_swiotlb_dma_supported(struct device *hwdev, u64 mask); | ||
| 64 | |||
| 65 | #endif /* __LINUX_SWIOTLB_XEN_H */ | ||
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index 46bc81ef74c6..351f4051f6d8 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h | |||
| @@ -17,4 +17,10 @@ void xen_arch_resume(void); | |||
| 17 | 17 | ||
| 18 | int xen_setup_shutdown_event(void); | 18 | int xen_setup_shutdown_event(void); |
| 19 | 19 | ||
| 20 | extern unsigned long *xen_contiguous_bitmap; | ||
| 21 | int xen_create_contiguous_region(unsigned long vstart, unsigned int order, | ||
| 22 | unsigned int address_bits); | ||
| 23 | |||
| 24 | void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order); | ||
| 25 | |||
| 20 | #endif /* INCLUDE_XEN_OPS_H */ | 26 | #endif /* INCLUDE_XEN_OPS_H */ |
diff --git a/kernel/kfifo.c b/kernel/kfifo.c index 02192dd905cc..4502604ecadf 100644 --- a/kernel/kfifo.c +++ b/kernel/kfifo.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * | 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
| 15 | * | 15 | * |
| 16 | * You should have received a copy of the GNU General Public License | 16 | * You should have received a copy of the GNU General Public License |
| @@ -333,17 +333,16 @@ static int setup_sgl_buf(struct scatterlist *sgl, void *buf, | |||
| 333 | buf += PAGE_SIZE; | 333 | buf += PAGE_SIZE; |
| 334 | npage = virt_to_page(buf); | 334 | npage = virt_to_page(buf); |
| 335 | if (page_to_phys(page) != page_to_phys(npage) - l) { | 335 | if (page_to_phys(page) != page_to_phys(npage) - l) { |
| 336 | sgl->page_link = 0; | 336 | sg_set_page(sgl, page, l - off, off); |
| 337 | sg_set_page(sgl++, page, l - off, off); | 337 | sgl = sg_next(sgl); |
| 338 | if (++n == nents) | 338 | if (++n == nents || sgl == NULL) |
| 339 | return n; | 339 | return n; |
| 340 | page = npage; | 340 | page = npage; |
| 341 | len -= l - off; | 341 | len -= l - off; |
| 342 | l = off = 0; | 342 | l = off = 0; |
| 343 | } | 343 | } |
| 344 | } | 344 | } |
| 345 | sgl->page_link = 0; | 345 | sg_set_page(sgl, page, len, off); |
| 346 | sg_set_page(sgl++, page, len, off); | ||
| 347 | return n + 1; | 346 | return n + 1; |
| 348 | } | 347 | } |
| 349 | 348 | ||
| @@ -363,7 +362,7 @@ static unsigned int setup_sgl(struct __kfifo *fifo, struct scatterlist *sgl, | |||
| 363 | } | 362 | } |
| 364 | l = min(len, size - off); | 363 | l = min(len, size - off); |
| 365 | 364 | ||
| 366 | n = setup_sgl_buf(sgl, fifo->data + off, nents, l); | 365 | n = setup_sgl_buf(sgl, fifo->data + off, nents, l); |
| 367 | n += setup_sgl_buf(sgl + n, fifo->data, nents - n, len - l); | 366 | n += setup_sgl_buf(sgl + n, fifo->data, nents - n, len - l); |
| 368 | 367 | ||
| 369 | if (n) | 368 | if (n) |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 82499a5bdcb7..959f8d6c8cc1 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
| @@ -710,6 +710,9 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq, | |||
| 710 | if (rq->cmd_flags & REQ_DISCARD) | 710 | if (rq->cmd_flags & REQ_DISCARD) |
| 711 | rw |= REQ_DISCARD; | 711 | rw |= REQ_DISCARD; |
| 712 | 712 | ||
| 713 | if (rq->cmd_flags & REQ_SECURE) | ||
| 714 | rw |= REQ_SECURE; | ||
| 715 | |||
| 713 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { | 716 | if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { |
| 714 | what |= BLK_TC_ACT(BLK_TC_PC); | 717 | what |= BLK_TC_ACT(BLK_TC_PC); |
| 715 | __blk_add_trace(bt, 0, blk_rq_bytes(rq), rw, | 718 | __blk_add_trace(bt, 0, blk_rq_bytes(rq), rw, |
| @@ -1816,6 +1819,8 @@ void blk_fill_rwbs(char *rwbs, u32 rw, int bytes) | |||
| 1816 | rwbs[i++] = 'S'; | 1819 | rwbs[i++] = 'S'; |
| 1817 | if (rw & REQ_META) | 1820 | if (rw & REQ_META) |
| 1818 | rwbs[i++] = 'M'; | 1821 | rwbs[i++] = 'M'; |
| 1822 | if (rw & REQ_SECURE) | ||
| 1823 | rwbs[i++] = 'E'; | ||
| 1819 | 1824 | ||
| 1820 | rwbs[i] = '\0'; | 1825 | rwbs[i] = '\0'; |
| 1821 | } | 1826 | } |
| @@ -1828,6 +1833,9 @@ void blk_fill_rwbs_rq(char *rwbs, struct request *rq) | |||
| 1828 | if (rq->cmd_flags & REQ_DISCARD) | 1833 | if (rq->cmd_flags & REQ_DISCARD) |
| 1829 | rw |= REQ_DISCARD; | 1834 | rw |= REQ_DISCARD; |
| 1830 | 1835 | ||
| 1836 | if (rq->cmd_flags & REQ_SECURE) | ||
| 1837 | rw |= REQ_SECURE; | ||
| 1838 | |||
| 1831 | bytes = blk_rq_bytes(rq); | 1839 | bytes = blk_rq_bytes(rq); |
| 1832 | 1840 | ||
| 1833 | blk_fill_rwbs(rwbs, rw, bytes); | 1841 | blk_fill_rwbs(rwbs, rw, bytes); |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 08d357522e78..eaa4a5bbe063 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
| @@ -81,7 +81,8 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v) | |||
| 81 | nr_more_io++; | 81 | nr_more_io++; |
| 82 | spin_unlock(&inode_lock); | 82 | spin_unlock(&inode_lock); |
| 83 | 83 | ||
| 84 | get_dirty_limits(&background_thresh, &dirty_thresh, &bdi_thresh, bdi); | 84 | global_dirty_limits(&background_thresh, &dirty_thresh); |
| 85 | bdi_thresh = bdi_dirty_limit(bdi, dirty_thresh); | ||
| 85 | 86 | ||
| 86 | #define K(x) ((x) << (PAGE_SHIFT - 10)) | 87 | #define K(x) ((x) << (PAGE_SHIFT - 10)) |
| 87 | seq_printf(m, | 88 | seq_printf(m, |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 0c6258bd1ba3..20890d80c7ef 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
| @@ -253,32 +253,6 @@ static void bdi_writeout_fraction(struct backing_dev_info *bdi, | |||
| 253 | } | 253 | } |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | /* | ||
| 257 | * Clip the earned share of dirty pages to that which is actually available. | ||
| 258 | * This avoids exceeding the total dirty_limit when the floating averages | ||
| 259 | * fluctuate too quickly. | ||
| 260 | */ | ||
| 261 | static void clip_bdi_dirty_limit(struct backing_dev_info *bdi, | ||
| 262 | unsigned long dirty, unsigned long *pbdi_dirty) | ||
| 263 | { | ||
| 264 | unsigned long avail_dirty; | ||
| 265 | |||
| 266 | avail_dirty = global_page_state(NR_FILE_DIRTY) + | ||
| 267 | global_page_state(NR_WRITEBACK) + | ||
| 268 | global_page_state(NR_UNSTABLE_NFS) + | ||
| 269 | global_page_state(NR_WRITEBACK_TEMP); | ||
| 270 | |||
| 271 | if (avail_dirty < dirty) | ||
| 272 | avail_dirty = dirty - avail_dirty; | ||
| 273 | else | ||
| 274 | avail_dirty = 0; | ||
| 275 | |||
| 276 | avail_dirty += bdi_stat(bdi, BDI_RECLAIMABLE) + | ||
| 277 | bdi_stat(bdi, BDI_WRITEBACK); | ||
| 278 | |||
| 279 | *pbdi_dirty = min(*pbdi_dirty, avail_dirty); | ||
| 280 | } | ||
| 281 | |||
| 282 | static inline void task_dirties_fraction(struct task_struct *tsk, | 256 | static inline void task_dirties_fraction(struct task_struct *tsk, |
| 283 | long *numerator, long *denominator) | 257 | long *numerator, long *denominator) |
| 284 | { | 258 | { |
| @@ -287,16 +261,24 @@ static inline void task_dirties_fraction(struct task_struct *tsk, | |||
| 287 | } | 261 | } |
| 288 | 262 | ||
| 289 | /* | 263 | /* |
| 290 | * scale the dirty limit | 264 | * task_dirty_limit - scale down dirty throttling threshold for one task |
| 291 | * | 265 | * |
| 292 | * task specific dirty limit: | 266 | * task specific dirty limit: |
| 293 | * | 267 | * |
| 294 | * dirty -= (dirty/8) * p_{t} | 268 | * dirty -= (dirty/8) * p_{t} |
| 269 | * | ||
| 270 | * To protect light/slow dirtying tasks from heavier/fast ones, we start | ||
| 271 | * throttling individual tasks before reaching the bdi dirty limit. | ||
| 272 | * Relatively low thresholds will be allocated to heavy dirtiers. So when | ||
| 273 | * dirty pages grow large, heavy dirtiers will be throttled first, which will | ||
| 274 | * effectively curb the growth of dirty pages. Light dirtiers with high enough | ||
| 275 | * dirty threshold may never get throttled. | ||
| 295 | */ | 276 | */ |
| 296 | static void task_dirty_limit(struct task_struct *tsk, unsigned long *pdirty) | 277 | static unsigned long task_dirty_limit(struct task_struct *tsk, |
| 278 | unsigned long bdi_dirty) | ||
| 297 | { | 279 | { |
| 298 | long numerator, denominator; | 280 | long numerator, denominator; |
| 299 | unsigned long dirty = *pdirty; | 281 | unsigned long dirty = bdi_dirty; |
| 300 | u64 inv = dirty >> 3; | 282 | u64 inv = dirty >> 3; |
| 301 | 283 | ||
| 302 | task_dirties_fraction(tsk, &numerator, &denominator); | 284 | task_dirties_fraction(tsk, &numerator, &denominator); |
| @@ -304,10 +286,8 @@ static void task_dirty_limit(struct task_struct *tsk, unsigned long *pdirty) | |||
| 304 | do_div(inv, denominator); | 286 | do_div(inv, denominator); |
| 305 | 287 | ||
| 306 | dirty -= inv; | 288 | dirty -= inv; |
| 307 | if (dirty < *pdirty/2) | ||
| 308 | dirty = *pdirty/2; | ||
| 309 | 289 | ||
| 310 | *pdirty = dirty; | 290 | return max(dirty, bdi_dirty/2); |
| 311 | } | 291 | } |
| 312 | 292 | ||
| 313 | /* | 293 | /* |
| @@ -417,9 +397,16 @@ unsigned long determine_dirtyable_memory(void) | |||
| 417 | return x + 1; /* Ensure that we never return 0 */ | 397 | return x + 1; /* Ensure that we never return 0 */ |
| 418 | } | 398 | } |
| 419 | 399 | ||
| 420 | void | 400 | /** |
| 421 | get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty, | 401 | * global_dirty_limits - background-writeback and dirty-throttling thresholds |
| 422 | unsigned long *pbdi_dirty, struct backing_dev_info *bdi) | 402 | * |
| 403 | * Calculate the dirty thresholds based on sysctl parameters | ||
| 404 | * - vm.dirty_background_ratio or vm.dirty_background_bytes | ||
| 405 | * - vm.dirty_ratio or vm.dirty_bytes | ||
| 406 | * The dirty limits will be lifted by 1/4 for PF_LESS_THROTTLE (ie. nfsd) and | ||
| 407 | * runtime tasks. | ||
| 408 | */ | ||
| 409 | void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty) | ||
| 423 | { | 410 | { |
| 424 | unsigned long background; | 411 | unsigned long background; |
| 425 | unsigned long dirty; | 412 | unsigned long dirty; |
| @@ -451,27 +438,37 @@ get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty, | |||
| 451 | } | 438 | } |
| 452 | *pbackground = background; | 439 | *pbackground = background; |
| 453 | *pdirty = dirty; | 440 | *pdirty = dirty; |
| 441 | } | ||
| 442 | |||
| 443 | /** | ||
| 444 | * bdi_dirty_limit - @bdi's share of dirty throttling threshold | ||
| 445 | * | ||
| 446 | * Allocate high/low dirty limits to fast/slow devices, in order to prevent | ||
| 447 | * - starving fast devices | ||
| 448 | * - piling up dirty pages (that will take long time to sync) on slow devices | ||
| 449 | * | ||
| 450 | * The bdi's share of dirty limit will be adapting to its throughput and | ||
| 451 | * bounded by the bdi->min_ratio and/or bdi->max_ratio parameters, if set. | ||
| 452 | */ | ||
| 453 | unsigned long bdi_dirty_limit(struct backing_dev_info *bdi, unsigned long dirty) | ||
| 454 | { | ||
| 455 | u64 bdi_dirty; | ||
| 456 | long numerator, denominator; | ||
| 457 | |||
| 458 | /* | ||
| 459 | * Calculate this BDI's share of the dirty ratio. | ||
| 460 | */ | ||
| 461 | bdi_writeout_fraction(bdi, &numerator, &denominator); | ||
| 454 | 462 | ||
| 455 | if (bdi) { | 463 | bdi_dirty = (dirty * (100 - bdi_min_ratio)) / 100; |
| 456 | u64 bdi_dirty; | 464 | bdi_dirty *= numerator; |
| 457 | long numerator, denominator; | 465 | do_div(bdi_dirty, denominator); |
| 458 | 466 | ||
| 459 | /* | 467 | bdi_dirty += (dirty * bdi->min_ratio) / 100; |
| 460 | * Calculate this BDI's share of the dirty ratio. | 468 | if (bdi_dirty > (dirty * bdi->max_ratio) / 100) |
| 461 | */ | 469 | bdi_dirty = dirty * bdi->max_ratio / 100; |
| 462 | bdi_writeout_fraction(bdi, &numerator, &denominator); | 470 | |
| 463 | 471 | return bdi_dirty; | |
| 464 | bdi_dirty = (dirty * (100 - bdi_min_ratio)) / 100; | ||
| 465 | bdi_dirty *= numerator; | ||
| 466 | do_div(bdi_dirty, denominator); | ||
| 467 | bdi_dirty += (dirty * bdi->min_ratio) / 100; | ||
| 468 | if (bdi_dirty > (dirty * bdi->max_ratio) / 100) | ||
| 469 | bdi_dirty = dirty * bdi->max_ratio / 100; | ||
| 470 | |||
| 471 | *pbdi_dirty = bdi_dirty; | ||
| 472 | clip_bdi_dirty_limit(bdi, dirty, pbdi_dirty); | ||
| 473 | task_dirty_limit(current, pbdi_dirty); | ||
| 474 | } | ||
| 475 | } | 472 | } |
| 476 | 473 | ||
| 477 | /* | 474 | /* |
| @@ -491,7 +488,7 @@ static void balance_dirty_pages(struct address_space *mapping, | |||
| 491 | unsigned long bdi_thresh; | 488 | unsigned long bdi_thresh; |
| 492 | unsigned long pages_written = 0; | 489 | unsigned long pages_written = 0; |
| 493 | unsigned long pause = 1; | 490 | unsigned long pause = 1; |
| 494 | 491 | bool dirty_exceeded = false; | |
| 495 | struct backing_dev_info *bdi = mapping->backing_dev_info; | 492 | struct backing_dev_info *bdi = mapping->backing_dev_info; |
| 496 | 493 | ||
| 497 | for (;;) { | 494 | for (;;) { |
| @@ -502,18 +499,11 @@ static void balance_dirty_pages(struct address_space *mapping, | |||
| 502 | .range_cyclic = 1, | 499 | .range_cyclic = 1, |
| 503 | }; | 500 | }; |
| 504 | 501 | ||
| 505 | get_dirty_limits(&background_thresh, &dirty_thresh, | ||
| 506 | &bdi_thresh, bdi); | ||
| 507 | |||
| 508 | nr_reclaimable = global_page_state(NR_FILE_DIRTY) + | 502 | nr_reclaimable = global_page_state(NR_FILE_DIRTY) + |
| 509 | global_page_state(NR_UNSTABLE_NFS); | 503 | global_page_state(NR_UNSTABLE_NFS); |
| 510 | nr_writeback = global_page_state(NR_WRITEBACK); | 504 | nr_writeback = global_page_state(NR_WRITEBACK); |
| 511 | 505 | ||
| 512 | bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE); | 506 | global_dirty_limits(&background_thresh, &dirty_thresh); |
| 513 | bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK); | ||
| 514 | |||
| 515 | if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh) | ||
| 516 | break; | ||
| 517 | 507 | ||
| 518 | /* | 508 | /* |
| 519 | * Throttle it only when the background writeback cannot | 509 | * Throttle it only when the background writeback cannot |
| @@ -524,26 +514,8 @@ static void balance_dirty_pages(struct address_space *mapping, | |||
| 524 | (background_thresh + dirty_thresh) / 2) | 514 | (background_thresh + dirty_thresh) / 2) |
| 525 | break; | 515 | break; |
| 526 | 516 | ||
| 527 | if (!bdi->dirty_exceeded) | 517 | bdi_thresh = bdi_dirty_limit(bdi, dirty_thresh); |
| 528 | bdi->dirty_exceeded = 1; | 518 | bdi_thresh = task_dirty_limit(current, bdi_thresh); |
| 529 | |||
| 530 | /* Note: nr_reclaimable denotes nr_dirty + nr_unstable. | ||
| 531 | * Unstable writes are a feature of certain networked | ||
| 532 | * filesystems (i.e. NFS) in which data may have been | ||
| 533 | * written to the server's write cache, but has not yet | ||
| 534 | * been flushed to permanent storage. | ||
| 535 | * Only move pages to writeback if this bdi is over its | ||
| 536 | * threshold otherwise wait until the disk writes catch | ||
| 537 | * up. | ||
| 538 | */ | ||
| 539 | trace_wbc_balance_dirty_start(&wbc, bdi); | ||
| 540 | if (bdi_nr_reclaimable > bdi_thresh) { | ||
| 541 | writeback_inodes_wb(&bdi->wb, &wbc); | ||
| 542 | pages_written += write_chunk - wbc.nr_to_write; | ||
| 543 | get_dirty_limits(&background_thresh, &dirty_thresh, | ||
| 544 | &bdi_thresh, bdi); | ||
| 545 | trace_wbc_balance_dirty_written(&wbc, bdi); | ||
| 546 | } | ||
| 547 | 519 | ||
| 548 | /* | 520 | /* |
| 549 | * In order to avoid the stacked BDI deadlock we need | 521 | * In order to avoid the stacked BDI deadlock we need |
| @@ -558,16 +530,44 @@ static void balance_dirty_pages(struct address_space *mapping, | |||
| 558 | if (bdi_thresh < 2*bdi_stat_error(bdi)) { | 530 | if (bdi_thresh < 2*bdi_stat_error(bdi)) { |
| 559 | bdi_nr_reclaimable = bdi_stat_sum(bdi, BDI_RECLAIMABLE); | 531 | bdi_nr_reclaimable = bdi_stat_sum(bdi, BDI_RECLAIMABLE); |
| 560 | bdi_nr_writeback = bdi_stat_sum(bdi, BDI_WRITEBACK); | 532 | bdi_nr_writeback = bdi_stat_sum(bdi, BDI_WRITEBACK); |
| 561 | } else if (bdi_nr_reclaimable) { | 533 | } else { |
| 562 | bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE); | 534 | bdi_nr_reclaimable = bdi_stat(bdi, BDI_RECLAIMABLE); |
| 563 | bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK); | 535 | bdi_nr_writeback = bdi_stat(bdi, BDI_WRITEBACK); |
| 564 | } | 536 | } |
| 565 | 537 | ||
| 566 | if (bdi_nr_reclaimable + bdi_nr_writeback <= bdi_thresh) | 538 | /* |
| 539 | * The bdi thresh is somehow "soft" limit derived from the | ||
| 540 | * global "hard" limit. The former helps to prevent heavy IO | ||
| 541 | * bdi or process from holding back light ones; The latter is | ||
| 542 | * the last resort safeguard. | ||
| 543 | */ | ||
| 544 | dirty_exceeded = | ||
| 545 | (bdi_nr_reclaimable + bdi_nr_writeback >= bdi_thresh) | ||
| 546 | || (nr_reclaimable + nr_writeback >= dirty_thresh); | ||
| 547 | |||
| 548 | if (!dirty_exceeded) | ||
| 567 | break; | 549 | break; |
| 568 | if (pages_written >= write_chunk) | ||
| 569 | break; /* We've done our duty */ | ||
| 570 | 550 | ||
| 551 | if (!bdi->dirty_exceeded) | ||
| 552 | bdi->dirty_exceeded = 1; | ||
| 553 | |||
| 554 | /* Note: nr_reclaimable denotes nr_dirty + nr_unstable. | ||
| 555 | * Unstable writes are a feature of certain networked | ||
| 556 | * filesystems (i.e. NFS) in which data may have been | ||
| 557 | * written to the server's write cache, but has not yet | ||
| 558 | * been flushed to permanent storage. | ||
| 559 | * Only move pages to writeback if this bdi is over its | ||
| 560 | * threshold otherwise wait until the disk writes catch | ||
| 561 | * up. | ||
| 562 | */ | ||
| 563 | trace_wbc_balance_dirty_start(&wbc, bdi); | ||
| 564 | if (bdi_nr_reclaimable > bdi_thresh) { | ||
| 565 | writeback_inodes_wb(&bdi->wb, &wbc); | ||
| 566 | pages_written += write_chunk - wbc.nr_to_write; | ||
| 567 | trace_wbc_balance_dirty_written(&wbc, bdi); | ||
| 568 | if (pages_written >= write_chunk) | ||
| 569 | break; /* We've done our duty */ | ||
| 570 | } | ||
| 571 | trace_wbc_balance_dirty_wait(&wbc, bdi); | 571 | trace_wbc_balance_dirty_wait(&wbc, bdi); |
| 572 | __set_current_state(TASK_INTERRUPTIBLE); | 572 | __set_current_state(TASK_INTERRUPTIBLE); |
| 573 | io_schedule_timeout(pause); | 573 | io_schedule_timeout(pause); |
| @@ -581,8 +581,7 @@ static void balance_dirty_pages(struct address_space *mapping, | |||
| 581 | pause = HZ / 10; | 581 | pause = HZ / 10; |
| 582 | } | 582 | } |
| 583 | 583 | ||
| 584 | if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh && | 584 | if (!dirty_exceeded && bdi->dirty_exceeded) |
| 585 | bdi->dirty_exceeded) | ||
| 586 | bdi->dirty_exceeded = 0; | 585 | bdi->dirty_exceeded = 0; |
| 587 | 586 | ||
| 588 | if (writeback_in_progress(bdi)) | 587 | if (writeback_in_progress(bdi)) |
| @@ -597,9 +596,7 @@ static void balance_dirty_pages(struct address_space *mapping, | |||
| 597 | * background_thresh, to keep the amount of dirty memory low. | 596 | * background_thresh, to keep the amount of dirty memory low. |
| 598 | */ | 597 | */ |
| 599 | if ((laptop_mode && pages_written) || | 598 | if ((laptop_mode && pages_written) || |
| 600 | (!laptop_mode && ((global_page_state(NR_FILE_DIRTY) | 599 | (!laptop_mode && (nr_reclaimable > background_thresh))) |
| 601 | + global_page_state(NR_UNSTABLE_NFS)) | ||
| 602 | > background_thresh))) | ||
| 603 | bdi_start_background_writeback(bdi); | 600 | bdi_start_background_writeback(bdi); |
| 604 | } | 601 | } |
| 605 | 602 | ||
| @@ -663,7 +660,7 @@ void throttle_vm_writeout(gfp_t gfp_mask) | |||
| 663 | unsigned long dirty_thresh; | 660 | unsigned long dirty_thresh; |
| 664 | 661 | ||
| 665 | for ( ; ; ) { | 662 | for ( ; ; ) { |
| 666 | get_dirty_limits(&background_thresh, &dirty_thresh, NULL, NULL); | 663 | global_dirty_limits(&background_thresh, &dirty_thresh); |
| 667 | 664 | ||
| 668 | /* | 665 | /* |
| 669 | * Boost the allowable dirty threshold a bit for page | 666 | * Boost the allowable dirty threshold a bit for page |
| @@ -825,10 +822,10 @@ void __init page_writeback_init(void) | |||
| 825 | /* | 822 | /* |
| 826 | * We tag pages in batches of WRITEBACK_TAG_BATCH to reduce tree_lock latency. | 823 | * We tag pages in batches of WRITEBACK_TAG_BATCH to reduce tree_lock latency. |
| 827 | */ | 824 | */ |
| 828 | #define WRITEBACK_TAG_BATCH 4096 | ||
| 829 | void tag_pages_for_writeback(struct address_space *mapping, | 825 | void tag_pages_for_writeback(struct address_space *mapping, |
| 830 | pgoff_t start, pgoff_t end) | 826 | pgoff_t start, pgoff_t end) |
| 831 | { | 827 | { |
| 828 | #define WRITEBACK_TAG_BATCH 4096 | ||
| 832 | unsigned long tagged; | 829 | unsigned long tagged; |
| 833 | 830 | ||
| 834 | do { | 831 | do { |
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 918c51335d64..6b8889da69a6 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <asm/tlbflush.h> | 31 | #include <asm/tlbflush.h> |
| 32 | #include <asm/shmparam.h> | 32 | #include <asm/shmparam.h> |
| 33 | 33 | ||
| 34 | bool vmap_lazy_unmap __read_mostly = true; | ||
| 34 | 35 | ||
| 35 | /*** Page table manipulation functions ***/ | 36 | /*** Page table manipulation functions ***/ |
| 36 | 37 | ||
| @@ -502,6 +503,9 @@ static unsigned long lazy_max_pages(void) | |||
| 502 | { | 503 | { |
| 503 | unsigned int log; | 504 | unsigned int log; |
| 504 | 505 | ||
| 506 | if (!vmap_lazy_unmap) | ||
| 507 | return 0; | ||
| 508 | |||
| 505 | log = fls(num_online_cpus()); | 509 | log = fls(num_online_cpus()); |
| 506 | 510 | ||
| 507 | return log * (32UL * 1024 * 1024 / PAGE_SIZE); | 511 | return log * (32UL * 1024 * 1024 / PAGE_SIZE); |
diff --git a/sound/aoa/soundbus/core.c b/sound/aoa/soundbus/core.c index 99ca7120e269..7487eb76e034 100644 --- a/sound/aoa/soundbus/core.c +++ b/sound/aoa/soundbus/core.c | |||
| @@ -59,7 +59,7 @@ static int soundbus_probe(struct device *dev) | |||
| 59 | static int soundbus_uevent(struct device *dev, struct kobj_uevent_env *env) | 59 | static int soundbus_uevent(struct device *dev, struct kobj_uevent_env *env) |
| 60 | { | 60 | { |
| 61 | struct soundbus_dev * soundbus_dev; | 61 | struct soundbus_dev * soundbus_dev; |
| 62 | struct of_device * of; | 62 | struct platform_device * of; |
| 63 | const char *compat; | 63 | const char *compat; |
| 64 | int retval = 0; | 64 | int retval = 0; |
| 65 | int cplen, seen = 0; | 65 | int cplen, seen = 0; |
diff --git a/sound/aoa/soundbus/soundbus.h b/sound/aoa/soundbus/soundbus.h index a0f223c13f66..adecbf36f4f6 100644 --- a/sound/aoa/soundbus/soundbus.h +++ b/sound/aoa/soundbus/soundbus.h | |||
| @@ -141,7 +141,7 @@ struct soundbus_dev { | |||
| 141 | struct list_head onbuslist; | 141 | struct list_head onbuslist; |
| 142 | 142 | ||
| 143 | /* the of device it represents */ | 143 | /* the of device it represents */ |
| 144 | struct of_device ofdev; | 144 | struct platform_device ofdev; |
| 145 | 145 | ||
| 146 | /* what modules go by */ | 146 | /* what modules go by */ |
| 147 | char modalias[32]; | 147 | char modalias[32]; |
diff --git a/sound/aoa/soundbus/sysfs.c b/sound/aoa/soundbus/sysfs.c index 6496e754f00a..e0980b5c2cd8 100644 --- a/sound/aoa/soundbus/sysfs.c +++ b/sound/aoa/soundbus/sysfs.c | |||
| @@ -16,7 +16,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, | |||
| 16 | char *buf) | 16 | char *buf) |
| 17 | { | 17 | { |
| 18 | struct soundbus_dev *sdev = to_soundbus_device(dev); | 18 | struct soundbus_dev *sdev = to_soundbus_device(dev); |
| 19 | struct of_device *of = &sdev->ofdev; | 19 | struct platform_device *of = &sdev->ofdev; |
| 20 | int length; | 20 | int length; |
| 21 | 21 | ||
| 22 | if (*sdev->modalias) { | 22 | if (*sdev->modalias) { |
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index 1d4e7164e80a..3dcd1469f283 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c | |||
| @@ -369,7 +369,7 @@ struct snd_soc_platform mpc5200_audio_dma_platform = { | |||
| 369 | }; | 369 | }; |
| 370 | EXPORT_SYMBOL_GPL(mpc5200_audio_dma_platform); | 370 | EXPORT_SYMBOL_GPL(mpc5200_audio_dma_platform); |
| 371 | 371 | ||
| 372 | int mpc5200_audio_dma_create(struct of_device *op) | 372 | int mpc5200_audio_dma_create(struct platform_device *op) |
| 373 | { | 373 | { |
| 374 | phys_addr_t fifo; | 374 | phys_addr_t fifo; |
| 375 | struct psc_dma *psc_dma; | 375 | struct psc_dma *psc_dma; |
| @@ -488,7 +488,7 @@ out_unmap: | |||
| 488 | } | 488 | } |
| 489 | EXPORT_SYMBOL_GPL(mpc5200_audio_dma_create); | 489 | EXPORT_SYMBOL_GPL(mpc5200_audio_dma_create); |
| 490 | 490 | ||
| 491 | int mpc5200_audio_dma_destroy(struct of_device *op) | 491 | int mpc5200_audio_dma_destroy(struct platform_device *op) |
| 492 | { | 492 | { |
| 493 | struct psc_dma *psc_dma = dev_get_drvdata(&op->dev); | 493 | struct psc_dma *psc_dma = dev_get_drvdata(&op->dev); |
| 494 | 494 | ||
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h index e1ec6d91ea38..ca99586f2ad9 100644 --- a/sound/soc/fsl/mpc5200_dma.h +++ b/sound/soc/fsl/mpc5200_dma.h | |||
| @@ -81,8 +81,8 @@ to_psc_dma_stream(struct snd_pcm_substream *substream, struct psc_dma *psc_dma) | |||
| 81 | return &psc_dma->playback; | 81 | return &psc_dma->playback; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | int mpc5200_audio_dma_create(struct of_device *op); | 84 | int mpc5200_audio_dma_create(struct platform_device *op); |
| 85 | int mpc5200_audio_dma_destroy(struct of_device *op); | 85 | int mpc5200_audio_dma_destroy(struct platform_device *op); |
| 86 | 86 | ||
| 87 | extern struct snd_soc_platform mpc5200_audio_dma_platform; | 87 | extern struct snd_soc_platform mpc5200_audio_dma_platform; |
| 88 | 88 | ||
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c index e7f5d50ed084..a9560235daee 100644 --- a/sound/soc/fsl/mpc5200_psc_ac97.c +++ b/sound/soc/fsl/mpc5200_psc_ac97.c | |||
| @@ -277,7 +277,7 @@ EXPORT_SYMBOL_GPL(psc_ac97_dai); | |||
| 277 | * - Probe/remove operations | 277 | * - Probe/remove operations |
| 278 | * - OF device match table | 278 | * - OF device match table |
| 279 | */ | 279 | */ |
| 280 | static int __devinit psc_ac97_of_probe(struct of_device *op, | 280 | static int __devinit psc_ac97_of_probe(struct platform_device *op, |
| 281 | const struct of_device_id *match) | 281 | const struct of_device_id *match) |
| 282 | { | 282 | { |
| 283 | int rc, i; | 283 | int rc, i; |
| @@ -317,7 +317,7 @@ static int __devinit psc_ac97_of_probe(struct of_device *op, | |||
| 317 | return 0; | 317 | return 0; |
| 318 | } | 318 | } |
| 319 | 319 | ||
| 320 | static int __devexit psc_ac97_of_remove(struct of_device *op) | 320 | static int __devexit psc_ac97_of_remove(struct platform_device *op) |
| 321 | { | 321 | { |
| 322 | return mpc5200_audio_dma_destroy(op); | 322 | return mpc5200_audio_dma_destroy(op); |
| 323 | } | 323 | } |
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c index 676841cbae98..534f04cb15d7 100644 --- a/sound/soc/fsl/mpc5200_psc_i2s.c +++ b/sound/soc/fsl/mpc5200_psc_i2s.c | |||
| @@ -152,7 +152,7 @@ EXPORT_SYMBOL_GPL(psc_i2s_dai); | |||
| 152 | * - Probe/remove operations | 152 | * - Probe/remove operations |
| 153 | * - OF device match table | 153 | * - OF device match table |
| 154 | */ | 154 | */ |
| 155 | static int __devinit psc_i2s_of_probe(struct of_device *op, | 155 | static int __devinit psc_i2s_of_probe(struct platform_device *op, |
| 156 | const struct of_device_id *match) | 156 | const struct of_device_id *match) |
| 157 | { | 157 | { |
| 158 | int rc; | 158 | int rc; |
| @@ -205,7 +205,7 @@ static int __devinit psc_i2s_of_probe(struct of_device *op, | |||
| 205 | 205 | ||
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | static int __devexit psc_i2s_of_remove(struct of_device *op) | 208 | static int __devexit psc_i2s_of_remove(struct platform_device *op) |
| 209 | { | 209 | { |
| 210 | return mpc5200_audio_dma_destroy(op); | 210 | return mpc5200_audio_dma_destroy(op); |
| 211 | } | 211 | } |
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index 3a501062c244..3b13b8d65262 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c | |||
| @@ -200,7 +200,7 @@ static struct snd_soc_ops mpc8610_hpcd_ops = { | |||
| 200 | * SSI devices. We also probably aren't compatible with the generic Elo DMA | 200 | * SSI devices. We also probably aren't compatible with the generic Elo DMA |
| 201 | * device driver. | 201 | * device driver. |
| 202 | */ | 202 | */ |
| 203 | static int mpc8610_hpcd_probe(struct of_device *ofdev, | 203 | static int mpc8610_hpcd_probe(struct platform_device *ofdev, |
| 204 | const struct of_device_id *match) | 204 | const struct of_device_id *match) |
| 205 | { | 205 | { |
| 206 | struct device_node *np = ofdev->dev.of_node; | 206 | struct device_node *np = ofdev->dev.of_node; |
| @@ -534,7 +534,7 @@ error: | |||
| 534 | * | 534 | * |
| 535 | * This function is called when the OF device is removed. | 535 | * This function is called when the OF device is removed. |
| 536 | */ | 536 | */ |
| 537 | static int mpc8610_hpcd_remove(struct of_device *ofdev) | 537 | static int mpc8610_hpcd_remove(struct platform_device *ofdev) |
| 538 | { | 538 | { |
| 539 | struct platform_device *sound_device = dev_get_drvdata(&ofdev->dev); | 539 | struct platform_device *sound_device = dev_get_drvdata(&ofdev->dev); |
| 540 | struct mpc8610_hpcd_data *machine_data = | 540 | struct mpc8610_hpcd_data *machine_data = |
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c index 9eb1a4e0363b..f8bcfc30f800 100644 --- a/sound/sparc/amd7930.c +++ b/sound/sparc/amd7930.c | |||
| @@ -336,7 +336,7 @@ struct snd_amd7930 { | |||
| 336 | int pgain; | 336 | int pgain; |
| 337 | int mgain; | 337 | int mgain; |
| 338 | 338 | ||
| 339 | struct of_device *op; | 339 | struct platform_device *op; |
| 340 | unsigned int irq; | 340 | unsigned int irq; |
| 341 | struct snd_amd7930 *next; | 341 | struct snd_amd7930 *next; |
| 342 | }; | 342 | }; |
| @@ -906,7 +906,7 @@ static int __devinit snd_amd7930_mixer(struct snd_amd7930 *amd) | |||
| 906 | 906 | ||
| 907 | static int snd_amd7930_free(struct snd_amd7930 *amd) | 907 | static int snd_amd7930_free(struct snd_amd7930 *amd) |
| 908 | { | 908 | { |
| 909 | struct of_device *op = amd->op; | 909 | struct platform_device *op = amd->op; |
| 910 | 910 | ||
| 911 | amd7930_idle(amd); | 911 | amd7930_idle(amd); |
| 912 | 912 | ||
| @@ -934,7 +934,7 @@ static struct snd_device_ops snd_amd7930_dev_ops = { | |||
| 934 | }; | 934 | }; |
| 935 | 935 | ||
| 936 | static int __devinit snd_amd7930_create(struct snd_card *card, | 936 | static int __devinit snd_amd7930_create(struct snd_card *card, |
| 937 | struct of_device *op, | 937 | struct platform_device *op, |
| 938 | int irq, int dev, | 938 | int irq, int dev, |
| 939 | struct snd_amd7930 **ramd) | 939 | struct snd_amd7930 **ramd) |
| 940 | { | 940 | { |
| @@ -1002,7 +1002,7 @@ static int __devinit snd_amd7930_create(struct snd_card *card, | |||
| 1002 | return 0; | 1002 | return 0; |
| 1003 | } | 1003 | } |
| 1004 | 1004 | ||
| 1005 | static int __devinit amd7930_sbus_probe(struct of_device *op, const struct of_device_id *match) | 1005 | static int __devinit amd7930_sbus_probe(struct platform_device *op, const struct of_device_id *match) |
| 1006 | { | 1006 | { |
| 1007 | struct resource *rp = &op->resource[0]; | 1007 | struct resource *rp = &op->resource[0]; |
| 1008 | static int dev_num; | 1008 | static int dev_num; |
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 68570ee2c9bb..c276086c3b57 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c | |||
| @@ -111,7 +111,7 @@ struct snd_cs4231 { | |||
| 111 | struct mutex mce_mutex; /* mutex for mce register */ | 111 | struct mutex mce_mutex; /* mutex for mce register */ |
| 112 | struct mutex open_mutex; /* mutex for ALSA open/close */ | 112 | struct mutex open_mutex; /* mutex for ALSA open/close */ |
| 113 | 113 | ||
| 114 | struct of_device *op; | 114 | struct platform_device *op; |
| 115 | unsigned int irq[2]; | 115 | unsigned int irq[2]; |
| 116 | unsigned int regs_size; | 116 | unsigned int regs_size; |
| 117 | struct snd_cs4231 *next; | 117 | struct snd_cs4231 *next; |
| @@ -1771,7 +1771,7 @@ static unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont) | |||
| 1771 | 1771 | ||
| 1772 | static int snd_cs4231_sbus_free(struct snd_cs4231 *chip) | 1772 | static int snd_cs4231_sbus_free(struct snd_cs4231 *chip) |
| 1773 | { | 1773 | { |
| 1774 | struct of_device *op = chip->op; | 1774 | struct platform_device *op = chip->op; |
| 1775 | 1775 | ||
| 1776 | if (chip->irq[0]) | 1776 | if (chip->irq[0]) |
| 1777 | free_irq(chip->irq[0], chip); | 1777 | free_irq(chip->irq[0], chip); |
| @@ -1794,7 +1794,7 @@ static struct snd_device_ops snd_cs4231_sbus_dev_ops = { | |||
| 1794 | }; | 1794 | }; |
| 1795 | 1795 | ||
| 1796 | static int __devinit snd_cs4231_sbus_create(struct snd_card *card, | 1796 | static int __devinit snd_cs4231_sbus_create(struct snd_card *card, |
| 1797 | struct of_device *op, | 1797 | struct platform_device *op, |
| 1798 | int dev) | 1798 | int dev) |
| 1799 | { | 1799 | { |
| 1800 | struct snd_cs4231 *chip = card->private_data; | 1800 | struct snd_cs4231 *chip = card->private_data; |
| @@ -1856,7 +1856,7 @@ static int __devinit snd_cs4231_sbus_create(struct snd_card *card, | |||
| 1856 | return 0; | 1856 | return 0; |
| 1857 | } | 1857 | } |
| 1858 | 1858 | ||
| 1859 | static int __devinit cs4231_sbus_probe(struct of_device *op, const struct of_device_id *match) | 1859 | static int __devinit cs4231_sbus_probe(struct platform_device *op, const struct of_device_id *match) |
| 1860 | { | 1860 | { |
| 1861 | struct resource *rp = &op->resource[0]; | 1861 | struct resource *rp = &op->resource[0]; |
| 1862 | struct snd_card *card; | 1862 | struct snd_card *card; |
| @@ -1931,7 +1931,7 @@ static unsigned int _ebus_dma_addr(struct cs4231_dma_control *dma_cont) | |||
| 1931 | 1931 | ||
| 1932 | static int snd_cs4231_ebus_free(struct snd_cs4231 *chip) | 1932 | static int snd_cs4231_ebus_free(struct snd_cs4231 *chip) |
| 1933 | { | 1933 | { |
| 1934 | struct of_device *op = chip->op; | 1934 | struct platform_device *op = chip->op; |
| 1935 | 1935 | ||
| 1936 | if (chip->c_dma.ebus_info.regs) { | 1936 | if (chip->c_dma.ebus_info.regs) { |
| 1937 | ebus_dma_unregister(&chip->c_dma.ebus_info); | 1937 | ebus_dma_unregister(&chip->c_dma.ebus_info); |
| @@ -1960,7 +1960,7 @@ static struct snd_device_ops snd_cs4231_ebus_dev_ops = { | |||
| 1960 | }; | 1960 | }; |
| 1961 | 1961 | ||
| 1962 | static int __devinit snd_cs4231_ebus_create(struct snd_card *card, | 1962 | static int __devinit snd_cs4231_ebus_create(struct snd_card *card, |
| 1963 | struct of_device *op, | 1963 | struct platform_device *op, |
| 1964 | int dev) | 1964 | int dev) |
| 1965 | { | 1965 | { |
| 1966 | struct snd_cs4231 *chip = card->private_data; | 1966 | struct snd_cs4231 *chip = card->private_data; |
| @@ -2048,7 +2048,7 @@ static int __devinit snd_cs4231_ebus_create(struct snd_card *card, | |||
| 2048 | return 0; | 2048 | return 0; |
| 2049 | } | 2049 | } |
| 2050 | 2050 | ||
| 2051 | static int __devinit cs4231_ebus_probe(struct of_device *op, const struct of_device_id *match) | 2051 | static int __devinit cs4231_ebus_probe(struct platform_device *op, const struct of_device_id *match) |
| 2052 | { | 2052 | { |
| 2053 | struct snd_card *card; | 2053 | struct snd_card *card; |
| 2054 | int err; | 2054 | int err; |
| @@ -2072,7 +2072,7 @@ static int __devinit cs4231_ebus_probe(struct of_device *op, const struct of_dev | |||
| 2072 | } | 2072 | } |
| 2073 | #endif | 2073 | #endif |
| 2074 | 2074 | ||
| 2075 | static int __devinit cs4231_probe(struct of_device *op, const struct of_device_id *match) | 2075 | static int __devinit cs4231_probe(struct platform_device *op, const struct of_device_id *match) |
| 2076 | { | 2076 | { |
| 2077 | #ifdef EBUS_SUPPORT | 2077 | #ifdef EBUS_SUPPORT |
| 2078 | if (!strcmp(op->dev.of_node->parent->name, "ebus")) | 2078 | if (!strcmp(op->dev.of_node->parent->name, "ebus")) |
| @@ -2086,7 +2086,7 @@ static int __devinit cs4231_probe(struct of_device *op, const struct of_device_i | |||
| 2086 | return -ENODEV; | 2086 | return -ENODEV; |
| 2087 | } | 2087 | } |
| 2088 | 2088 | ||
| 2089 | static int __devexit cs4231_remove(struct of_device *op) | 2089 | static int __devexit cs4231_remove(struct platform_device *op) |
| 2090 | { | 2090 | { |
| 2091 | struct snd_cs4231 *chip = dev_get_drvdata(&op->dev); | 2091 | struct snd_cs4231 *chip = dev_get_drvdata(&op->dev); |
| 2092 | 2092 | ||
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index c421901c48d0..39cd5d69d051 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c | |||
| @@ -299,7 +299,7 @@ struct dbri_streaminfo { | |||
| 299 | /* This structure holds the information for both chips (DBRI & CS4215) */ | 299 | /* This structure holds the information for both chips (DBRI & CS4215) */ |
| 300 | struct snd_dbri { | 300 | struct snd_dbri { |
| 301 | int regs_size, irq; /* Needed for unload */ | 301 | int regs_size, irq; /* Needed for unload */ |
| 302 | struct of_device *op; /* OF device info */ | 302 | struct platform_device *op; /* OF device info */ |
| 303 | spinlock_t lock; | 303 | spinlock_t lock; |
| 304 | 304 | ||
| 305 | struct dbri_dma *dma; /* Pointer to our DMA block */ | 305 | struct dbri_dma *dma; /* Pointer to our DMA block */ |
| @@ -2523,7 +2523,7 @@ static void __devinit snd_dbri_proc(struct snd_card *card) | |||
| 2523 | static void snd_dbri_free(struct snd_dbri *dbri); | 2523 | static void snd_dbri_free(struct snd_dbri *dbri); |
| 2524 | 2524 | ||
| 2525 | static int __devinit snd_dbri_create(struct snd_card *card, | 2525 | static int __devinit snd_dbri_create(struct snd_card *card, |
| 2526 | struct of_device *op, | 2526 | struct platform_device *op, |
| 2527 | int irq, int dev) | 2527 | int irq, int dev) |
| 2528 | { | 2528 | { |
| 2529 | struct snd_dbri *dbri = card->private_data; | 2529 | struct snd_dbri *dbri = card->private_data; |
| @@ -2592,7 +2592,7 @@ static void snd_dbri_free(struct snd_dbri *dbri) | |||
| 2592 | (void *)dbri->dma, dbri->dma_dvma); | 2592 | (void *)dbri->dma, dbri->dma_dvma); |
| 2593 | } | 2593 | } |
| 2594 | 2594 | ||
| 2595 | static int __devinit dbri_probe(struct of_device *op, const struct of_device_id *match) | 2595 | static int __devinit dbri_probe(struct platform_device *op, const struct of_device_id *match) |
| 2596 | { | 2596 | { |
| 2597 | struct snd_dbri *dbri; | 2597 | struct snd_dbri *dbri; |
| 2598 | struct resource *rp; | 2598 | struct resource *rp; |
| @@ -2662,7 +2662,7 @@ _err: | |||
| 2662 | return err; | 2662 | return err; |
| 2663 | } | 2663 | } |
| 2664 | 2664 | ||
| 2665 | static int __devexit dbri_remove(struct of_device *op) | 2665 | static int __devexit dbri_remove(struct platform_device *op) |
| 2666 | { | 2666 | { |
| 2667 | struct snd_card *card = dev_get_drvdata(&op->dev); | 2667 | struct snd_card *card = dev_get_drvdata(&op->dev); |
| 2668 | 2668 | ||
