Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6

Signed-off-by: David Woodhouse <dwmw2@infradead.org>

authored by

David Woodhouse and committed by
David Woodhouse
b07019f2 c3ce7e20

+1246 -2161
+25 -15
arch/powerpc/configs/cell_defconfig
··· 9 9 CONFIG_MMU=y 10 10 CONFIG_GENERIC_HARDIRQS=y 11 11 CONFIG_RWSEM_XCHGADD_ALGORITHM=y 12 + CONFIG_GENERIC_HWEIGHT=y 12 13 CONFIG_GENERIC_CALIBRATE_DELAY=y 13 14 CONFIG_PPC=y 14 15 CONFIG_EARLY_PRINTK=y ··· 56 55 CONFIG_IKCONFIG=y 57 56 CONFIG_IKCONFIG_PROC=y 58 57 # CONFIG_CPUSETS is not set 58 + # CONFIG_RELAY is not set 59 59 CONFIG_INITRAMFS_SOURCE="" 60 60 CONFIG_CC_OPTIMIZE_FOR_SIZE=y 61 61 # CONFIG_EMBEDDED is not set ··· 71 69 CONFIG_FUTEX=y 72 70 CONFIG_EPOLL=y 73 71 CONFIG_SHMEM=y 74 - CONFIG_CC_ALIGN_FUNCTIONS=0 75 - CONFIG_CC_ALIGN_LABELS=0 76 - CONFIG_CC_ALIGN_LOOPS=0 77 - CONFIG_CC_ALIGN_JUMPS=0 78 72 CONFIG_SLAB=y 79 73 # CONFIG_TINY_SHMEM is not set 80 74 CONFIG_BASE_SMALL=0 ··· 82 84 CONFIG_MODULES=y 83 85 CONFIG_MODULE_UNLOAD=y 84 86 # CONFIG_MODULE_FORCE_UNLOAD is not set 85 - CONFIG_OBSOLETE_MODPARM=y 86 87 # CONFIG_MODVERSIONS is not set 87 88 # CONFIG_MODULE_SRCVERSION_ALL is not set 88 89 CONFIG_KMOD=y ··· 90 93 # 91 94 # Block layer 92 95 # 96 + # CONFIG_BLK_DEV_IO_TRACE is not set 93 97 94 98 # 95 99 # IO Schedulers ··· 124 126 CONFIG_MMIO_NVRAM=y 125 127 CONFIG_CELL_IIC=y 126 128 # CONFIG_PPC_MPC106 is not set 129 + # CONFIG_PPC_970_NAP is not set 127 130 # CONFIG_CPU_FREQ is not set 128 131 # CONFIG_WANT_EARLY_SERIAL is not set 129 132 ··· 166 167 CONFIG_SPARSEMEM_EXTREME=y 167 168 # CONFIG_MEMORY_HOTPLUG is not set 168 169 CONFIG_SPLIT_PTLOCK_CPUS=4 169 - CONFIG_MIGRATION=y 170 170 # CONFIG_PPC_64K_PAGES is not set 171 171 CONFIG_SCHED_SMT=y 172 172 CONFIG_PROC_DEVICETREE=y ··· 182 184 # CONFIG_PPC_INDIRECT_PCI is not set 183 185 CONFIG_PCI=y 184 186 CONFIG_PCI_DOMAINS=y 185 - CONFIG_PCI_LEGACY_PROC=y 186 187 # CONFIG_PCI_DEBUG is not set 187 188 188 189 # ··· 223 226 # CONFIG_INET_AH is not set 224 227 # CONFIG_INET_ESP is not set 225 228 # CONFIG_INET_IPCOMP is not set 229 + # CONFIG_INET_XFRM_TUNNEL is not set 226 230 CONFIG_INET_TUNNEL=y 227 231 CONFIG_INET_DIAG=y 228 232 CONFIG_INET_TCP_DIAG=y ··· 240 242 CONFIG_INET6_AH=m 241 243 CONFIG_INET6_ESP=m 242 244 CONFIG_INET6_IPCOMP=m 245 + CONFIG_INET6_XFRM_TUNNEL=m 243 246 CONFIG_INET6_TUNNEL=m 244 247 CONFIG_IPV6_TUNNEL=m 245 248 CONFIG_NETFILTER=y ··· 631 632 # 632 633 CONFIG_SERIAL_8250=y 633 634 CONFIG_SERIAL_8250_CONSOLE=y 635 + CONFIG_SERIAL_8250_PCI=y 634 636 CONFIG_SERIAL_8250_NR_UARTS=4 635 637 CONFIG_SERIAL_8250_RUNTIME_UARTS=4 636 638 # CONFIG_SERIAL_8250_EXTENDED is not set ··· 717 717 # CONFIG_I2C_PARPORT_LIGHT is not set 718 718 # CONFIG_I2C_PROSAVAGE is not set 719 719 # CONFIG_I2C_SAVAGE4 is not set 720 - # CONFIG_SCx200_ACB is not set 721 720 # CONFIG_I2C_SIS5595 is not set 722 721 # CONFIG_I2C_SIS630 is not set 723 722 # CONFIG_I2C_SIS96X is not set ··· 735 736 # CONFIG_SENSORS_PCF8574 is not set 736 737 # CONFIG_SENSORS_PCA9539 is not set 737 738 # CONFIG_SENSORS_PCF8591 is not set 738 - # CONFIG_SENSORS_RTC8564 is not set 739 739 # CONFIG_SENSORS_MAX6875 is not set 740 - # CONFIG_RTC_X1205_I2C is not set 741 740 # CONFIG_I2C_DEBUG_CORE is not set 742 741 # CONFIG_I2C_DEBUG_ALGO is not set 743 742 # CONFIG_I2C_DEBUG_BUS is not set ··· 760 763 761 764 # 762 765 # Misc devices 763 - # 764 - 765 - # 766 - # Multimedia Capabilities Port drivers 767 766 # 768 767 769 768 # ··· 811 818 # CONFIG_MMC is not set 812 819 813 820 # 821 + # LED devices 822 + # 823 + # CONFIG_NEW_LEDS is not set 824 + 825 + # 826 + # LED drivers 827 + # 828 + 829 + # 830 + # LED Triggers 831 + # 832 + 833 + # 814 834 # InfiniBand support 815 835 # 816 836 CONFIG_INFINIBAND=y ··· 838 832 # 839 833 # EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 840 834 # 835 + 836 + # 837 + # Real Time Clock 838 + # 839 + # CONFIG_RTC_CLASS is not set 841 840 842 841 # 843 842 # File systems ··· 900 889 CONFIG_HUGETLBFS=y 901 890 CONFIG_HUGETLB_PAGE=y 902 891 CONFIG_RAMFS=y 903 - # CONFIG_RELAYFS_FS is not set 904 892 # CONFIG_CONFIGFS_FS is not set 905 893 906 894 #
+16
arch/powerpc/kernel/cputable.c
··· 57 57 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) 58 58 #define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\ 59 59 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) 60 + #define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\ 61 + PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP) 60 62 #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \ 61 63 PPC_FEATURE_BOOKE) 62 64 ··· 264 262 .oprofile_cpu_type = "ppc64/power5+", 265 263 .oprofile_type = PPC_OPROFILE_POWER4, 266 264 .platform = "power5+", 265 + }, 266 + { /* Power6 */ 267 + .pvr_mask = 0xffff0000, 268 + .pvr_value = 0x003e0000, 269 + .cpu_name = "POWER6", 270 + .cpu_features = CPU_FTRS_POWER6, 271 + .cpu_user_features = COMMON_USER_POWER6, 272 + .icache_bsize = 128, 273 + .dcache_bsize = 128, 274 + .num_pmcs = 6, 275 + .cpu_setup = __setup_cpu_power4, 276 + .oprofile_cpu_type = "ppc64/power6", 277 + .oprofile_type = PPC_OPROFILE_POWER4, 278 + .platform = "power6", 267 279 }, 268 280 { /* Cell Broadband Engine */ 269 281 .pvr_mask = 0xffff0000,
+12 -4
arch/powerpc/kernel/module_64.c
··· 191 191 (void *)hdr 192 192 + sechdrs[sechdrs[i].sh_link].sh_offset); 193 193 } 194 - if (!me->arch.stubs_section || !me->arch.toc_section) { 195 - printk("%s: doesn't contain .toc or .stubs.\n", me->name); 194 + 195 + if (!me->arch.stubs_section) { 196 + printk("%s: doesn't contain .stubs.\n", me->name); 196 197 return -ENOEXEC; 197 198 } 199 + 200 + /* If we don't have a .toc, just use .stubs. We need to set r2 201 + to some reasonable value in case the module calls out to 202 + other functions via a stub, or if a function pointer escapes 203 + the module by some means. */ 204 + if (!me->arch.toc_section) 205 + me->arch.toc_section = me->arch.stubs_section; 198 206 199 207 /* Override the stubs size */ 200 208 sechdrs[me->arch.stubs_section].sh_size = get_stubs_size(hdr, sechdrs); ··· 350 342 break; 351 343 352 344 case R_PPC64_TOC16: 353 - /* Subtact TOC pointer */ 345 + /* Subtract TOC pointer */ 354 346 value -= my_r2(sechdrs, me); 355 347 if (value + 0x8000 > 0xffff) { 356 348 printk("%s: bad TOC16 relocation (%lu)\n", ··· 363 355 break; 364 356 365 357 case R_PPC64_TOC16_DS: 366 - /* Subtact TOC pointer */ 358 + /* Subtract TOC pointer */ 367 359 value -= my_r2(sechdrs, me); 368 360 if ((value & 3) != 0 || value + 0x8000 > 0xffff) { 369 361 printk("%s: bad TOC16_DS relocation (%lu)\n",
+108 -4
arch/powerpc/kernel/prom_init.c
··· 636 636 637 637 #ifdef CONFIG_PPC_PSERIES 638 638 /* 639 - * To tell the firmware what our capabilities are, we have to pass 640 - * it a fake 32-bit ELF header containing a couple of PT_NOTE sections 641 - * that contain structures that contain the actual values. 639 + * There are two methods for telling firmware what our capabilities are. 640 + * Newer machines have an "ibm,client-architecture-support" method on the 641 + * root node. For older machines, we have to call the "process-elf-header" 642 + * method in the /packages/elf-loader node, passing it a fake 32-bit 643 + * ELF header containing a couple of PT_NOTE sections that contain 644 + * structures that contain various information. 642 645 */ 646 + 647 + /* 648 + * New method - extensible architecture description vector. 649 + * 650 + * Because the description vector contains a mix of byte and word 651 + * values, we declare it as an unsigned char array, and use this 652 + * macro to put word values in. 653 + */ 654 + #define W(x) ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \ 655 + ((x) >> 8) & 0xff, (x) & 0xff 656 + 657 + /* Option vector bits - generic bits in byte 1 */ 658 + #define OV_IGNORE 0x80 /* ignore this vector */ 659 + #define OV_CESSATION_POLICY 0x40 /* halt if unsupported option present*/ 660 + 661 + /* Option vector 1: processor architectures supported */ 662 + #define OV1_PPC_2_00 0x80 /* set if we support PowerPC 2.00 */ 663 + #define OV1_PPC_2_01 0x40 /* set if we support PowerPC 2.01 */ 664 + #define OV1_PPC_2_02 0x20 /* set if we support PowerPC 2.02 */ 665 + #define OV1_PPC_2_03 0x10 /* set if we support PowerPC 2.03 */ 666 + #define OV1_PPC_2_04 0x08 /* set if we support PowerPC 2.04 */ 667 + #define OV1_PPC_2_05 0x04 /* set if we support PowerPC 2.05 */ 668 + 669 + /* Option vector 2: Open Firmware options supported */ 670 + #define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */ 671 + 672 + /* Option vector 3: processor options supported */ 673 + #define OV3_FP 0x80 /* floating point */ 674 + #define OV3_VMX 0x40 /* VMX/Altivec */ 675 + 676 + /* Option vector 5: PAPR/OF options supported */ 677 + #define OV5_LPAR 0x80 /* logical partitioning supported */ 678 + #define OV5_SPLPAR 0x40 /* shared-processor LPAR supported */ 679 + /* ibm,dynamic-reconfiguration-memory property supported */ 680 + #define OV5_DRCONF_MEMORY 0x20 681 + #define OV5_LARGE_PAGES 0x10 /* large pages supported */ 682 + 683 + /* 684 + * The architecture vector has an array of PVR mask/value pairs, 685 + * followed by # option vectors - 1, followed by the option vectors. 686 + */ 687 + static unsigned char ibm_architecture_vec[] = { 688 + W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */ 689 + W(0xffff0000), W(0x003e0000), /* POWER6 */ 690 + W(0xfffffffe), W(0x0f000001), /* all 2.04-compliant and earlier */ 691 + 5 - 1, /* 5 option vectors */ 692 + 693 + /* option vector 1: processor architectures supported */ 694 + 3 - 1, /* length */ 695 + 0, /* don't ignore, don't halt */ 696 + OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 | 697 + OV1_PPC_2_04 | OV1_PPC_2_05, 698 + 699 + /* option vector 2: Open Firmware options supported */ 700 + 34 - 1, /* length */ 701 + OV2_REAL_MODE, 702 + 0, 0, 703 + W(0xffffffff), /* real_base */ 704 + W(0xffffffff), /* real_size */ 705 + W(0xffffffff), /* virt_base */ 706 + W(0xffffffff), /* virt_size */ 707 + W(0xffffffff), /* load_base */ 708 + W(64), /* 128MB min RMA */ 709 + W(0xffffffff), /* full client load */ 710 + 0, /* min RMA percentage of total RAM */ 711 + 48, /* max log_2(hash table size) */ 712 + 713 + /* option vector 3: processor options supported */ 714 + 3 - 1, /* length */ 715 + 0, /* don't ignore, don't halt */ 716 + OV3_FP | OV3_VMX, 717 + 718 + /* option vector 4: IBM PAPR implementation */ 719 + 2 - 1, /* length */ 720 + 0, /* don't halt */ 721 + 722 + /* option vector 5: PAPR/OF options */ 723 + 3 - 1, /* length */ 724 + 0, /* don't ignore, don't halt */ 725 + OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES, 726 + }; 727 + 728 + /* Old method - ELF header with PT_NOTE sections */ 643 729 static struct fake_elf { 644 730 Elf32_Ehdr elfhdr; 645 731 Elf32_Phdr phdr[2]; ··· 814 728 815 729 static void __init prom_send_capabilities(void) 816 730 { 817 - ihandle elfloader; 731 + ihandle elfloader, root; 732 + prom_arg_t ret; 818 733 734 + root = call_prom("open", 1, 1, ADDR("/")); 735 + if (root != 0) { 736 + /* try calling the ibm,client-architecture-support method */ 737 + if (call_prom_ret("call-method", 3, 2, &ret, 738 + ADDR("ibm,client-architecture-support"), 739 + ADDR(ibm_architecture_vec)) == 0) { 740 + /* the call exists... */ 741 + if (ret) 742 + prom_printf("WARNING: ibm,client-architecture" 743 + "-support call FAILED!\n"); 744 + call_prom("close", 1, 0, root); 745 + return; 746 + } 747 + call_prom("close", 1, 0, root); 748 + } 749 + 750 + /* no ibm,client-architecture-support call, try the old way */ 819 751 elfloader = call_prom("open", 1, 1, ADDR("/packages/elf-loader")); 820 752 if (elfloader == 0) { 821 753 prom_printf("couldn't open /packages/elf-loader\n");
+8
arch/powerpc/kernel/setup-common.c
··· 516 516 517 517 printk(KERN_INFO "Using %s machine description\n", ppc_md.name); 518 518 } 519 + 520 + int check_legacy_ioport(unsigned long base_port) 521 + { 522 + if (ppc_md.check_legacy_ioport == NULL) 523 + return 0; 524 + return ppc_md.check_legacy_ioport(base_port); 525 + } 526 + EXPORT_SYMBOL(check_legacy_ioport);
-8
arch/powerpc/kernel/setup_64.c
··· 594 594 printk("[terminate]%04x %s\n", src, msg); 595 595 } 596 596 597 - int check_legacy_ioport(unsigned long base_port) 598 - { 599 - if (ppc_md.check_legacy_ioport == NULL) 600 - return 0; 601 - return ppc_md.check_legacy_ioport(base_port); 602 - } 603 - EXPORT_SYMBOL(check_legacy_ioport); 604 - 605 597 void cpu_die(void) 606 598 { 607 599 if (ppc_md.cpu_die)
+13
arch/powerpc/kernel/systbl.S
··· 325 325 SYSCALL(splice) 326 326 SYSCALL(tee) 327 327 SYSCALL(vmsplice) 328 + COMPAT_SYS(openat) 329 + SYSCALL(mkdirat) 330 + SYSCALL(mknodat) 331 + SYSCALL(fchownat) 332 + COMPAT_SYS(futimesat) 333 + SYSX(sys_newfstatat, sys_fstatat64, sys_fstatat64) 334 + SYSCALL(unlinkat) 335 + SYSCALL(renameat) 336 + SYSCALL(linkat) 337 + SYSCALL(symlinkat) 338 + SYSCALL(readlinkat) 339 + SYSCALL(fchmodat) 340 + SYSCALL(faccessat) 328 341 329 342 /* 330 343 * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c
+260 -37
arch/powerpc/mm/hugetlbpage.c
··· 30 30 #define NUM_LOW_AREAS (0x100000000UL >> SID_SHIFT) 31 31 #define NUM_HIGH_AREAS (PGTABLE_RANGE >> HTLB_AREA_SHIFT) 32 32 33 + #ifdef CONFIG_PPC_64K_PAGES 34 + #define HUGEPTE_INDEX_SIZE (PMD_SHIFT-HPAGE_SHIFT) 35 + #else 36 + #define HUGEPTE_INDEX_SIZE (PUD_SHIFT-HPAGE_SHIFT) 37 + #endif 38 + #define PTRS_PER_HUGEPTE (1 << HUGEPTE_INDEX_SIZE) 39 + #define HUGEPTE_TABLE_SIZE (sizeof(pte_t) << HUGEPTE_INDEX_SIZE) 40 + 41 + #define HUGEPD_SHIFT (HPAGE_SHIFT + HUGEPTE_INDEX_SIZE) 42 + #define HUGEPD_SIZE (1UL << HUGEPD_SHIFT) 43 + #define HUGEPD_MASK (~(HUGEPD_SIZE-1)) 44 + 45 + #define huge_pgtable_cache (pgtable_cache[HUGEPTE_CACHE_NUM]) 46 + 47 + /* Flag to mark huge PD pointers. This means pmd_bad() and pud_bad() 48 + * will choke on pointers to hugepte tables, which is handy for 49 + * catching screwups early. */ 50 + #define HUGEPD_OK 0x1 51 + 52 + typedef struct { unsigned long pd; } hugepd_t; 53 + 54 + #define hugepd_none(hpd) ((hpd).pd == 0) 55 + 56 + static inline pte_t *hugepd_page(hugepd_t hpd) 57 + { 58 + BUG_ON(!(hpd.pd & HUGEPD_OK)); 59 + return (pte_t *)(hpd.pd & ~HUGEPD_OK); 60 + } 61 + 62 + static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr) 63 + { 64 + unsigned long idx = ((addr >> HPAGE_SHIFT) & (PTRS_PER_HUGEPTE-1)); 65 + pte_t *dir = hugepd_page(*hpdp); 66 + 67 + return dir + idx; 68 + } 69 + 70 + static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, 71 + unsigned long address) 72 + { 73 + pte_t *new = kmem_cache_alloc(huge_pgtable_cache, 74 + GFP_KERNEL|__GFP_REPEAT); 75 + 76 + if (! new) 77 + return -ENOMEM; 78 + 79 + spin_lock(&mm->page_table_lock); 80 + if (!hugepd_none(*hpdp)) 81 + kmem_cache_free(huge_pgtable_cache, new); 82 + else 83 + hpdp->pd = (unsigned long)new | HUGEPD_OK; 84 + spin_unlock(&mm->page_table_lock); 85 + return 0; 86 + } 87 + 33 88 /* Modelled after find_linux_pte() */ 34 89 pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) 35 90 { 36 91 pgd_t *pg; 37 92 pud_t *pu; 38 - pmd_t *pm; 39 - pte_t *pt; 40 93 41 94 BUG_ON(! in_hugepage_area(mm->context, addr)); 42 95 ··· 99 46 if (!pgd_none(*pg)) { 100 47 pu = pud_offset(pg, addr); 101 48 if (!pud_none(*pu)) { 102 - pm = pmd_offset(pu, addr); 103 49 #ifdef CONFIG_PPC_64K_PAGES 104 - /* Currently, we use the normal PTE offset within full 105 - * size PTE pages, thus our huge PTEs are scattered in 106 - * the PTE page and we do waste some. We may change 107 - * that in the future, but the current mecanism keeps 108 - * things much simpler 109 - */ 110 - if (!pmd_none(*pm)) { 111 - /* Note: pte_offset_* are all equivalent on 112 - * ppc64 as we don't have HIGHMEM 113 - */ 114 - pt = pte_offset_kernel(pm, addr); 115 - return pt; 116 - } 117 - #else /* CONFIG_PPC_64K_PAGES */ 118 - /* On 4k pages, we put huge PTEs in the PMD page */ 119 - pt = (pte_t *)pm; 120 - return pt; 121 - #endif /* CONFIG_PPC_64K_PAGES */ 50 + pmd_t *pm; 51 + pm = pmd_offset(pu, addr); 52 + if (!pmd_none(*pm)) 53 + return hugepte_offset((hugepd_t *)pm, addr); 54 + #else 55 + return hugepte_offset((hugepd_t *)pu, addr); 56 + #endif 122 57 } 123 58 } 124 59 ··· 117 76 { 118 77 pgd_t *pg; 119 78 pud_t *pu; 120 - pmd_t *pm; 121 - pte_t *pt; 79 + hugepd_t *hpdp = NULL; 122 80 123 81 BUG_ON(! in_hugepage_area(mm->context, addr)); 124 82 ··· 127 87 pu = pud_alloc(mm, pg, addr); 128 88 129 89 if (pu) { 130 - pm = pmd_alloc(mm, pu, addr); 131 - if (pm) { 132 90 #ifdef CONFIG_PPC_64K_PAGES 133 - /* See comment in huge_pte_offset. Note that if we ever 134 - * want to put the page size in the PMD, we would have 135 - * to open code our own pte_alloc* function in order 136 - * to populate and set the size atomically 137 - */ 138 - pt = pte_alloc_map(mm, pm, addr); 139 - #else /* CONFIG_PPC_64K_PAGES */ 140 - pt = (pte_t *)pm; 141 - #endif /* CONFIG_PPC_64K_PAGES */ 142 - return pt; 143 - } 91 + pmd_t *pm; 92 + pm = pmd_alloc(mm, pu, addr); 93 + if (pm) 94 + hpdp = (hugepd_t *)pm; 95 + #else 96 + hpdp = (hugepd_t *)pu; 97 + #endif 144 98 } 145 99 146 - return NULL; 100 + if (! hpdp) 101 + return NULL; 102 + 103 + if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr)) 104 + return NULL; 105 + 106 + return hugepte_offset(hpdp, addr); 107 + } 108 + 109 + static void free_hugepte_range(struct mmu_gather *tlb, hugepd_t *hpdp) 110 + { 111 + pte_t *hugepte = hugepd_page(*hpdp); 112 + 113 + hpdp->pd = 0; 114 + tlb->need_flush = 1; 115 + pgtable_free_tlb(tlb, pgtable_free_cache(hugepte, HUGEPTE_CACHE_NUM, 116 + HUGEPTE_TABLE_SIZE-1)); 117 + } 118 + 119 + #ifdef CONFIG_PPC_64K_PAGES 120 + static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, 121 + unsigned long addr, unsigned long end, 122 + unsigned long floor, unsigned long ceiling) 123 + { 124 + pmd_t *pmd; 125 + unsigned long next; 126 + unsigned long start; 127 + 128 + start = addr; 129 + pmd = pmd_offset(pud, addr); 130 + do { 131 + next = pmd_addr_end(addr, end); 132 + if (pmd_none(*pmd)) 133 + continue; 134 + free_hugepte_range(tlb, (hugepd_t *)pmd); 135 + } while (pmd++, addr = next, addr != end); 136 + 137 + start &= PUD_MASK; 138 + if (start < floor) 139 + return; 140 + if (ceiling) { 141 + ceiling &= PUD_MASK; 142 + if (!ceiling) 143 + return; 144 + } 145 + if (end - 1 > ceiling - 1) 146 + return; 147 + 148 + pmd = pmd_offset(pud, start); 149 + pud_clear(pud); 150 + pmd_free_tlb(tlb, pmd); 151 + } 152 + #endif 153 + 154 + static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd, 155 + unsigned long addr, unsigned long end, 156 + unsigned long floor, unsigned long ceiling) 157 + { 158 + pud_t *pud; 159 + unsigned long next; 160 + unsigned long start; 161 + 162 + start = addr; 163 + pud = pud_offset(pgd, addr); 164 + do { 165 + next = pud_addr_end(addr, end); 166 + #ifdef CONFIG_PPC_64K_PAGES 167 + if (pud_none_or_clear_bad(pud)) 168 + continue; 169 + hugetlb_free_pmd_range(tlb, pud, addr, next, floor, ceiling); 170 + #else 171 + if (pud_none(*pud)) 172 + continue; 173 + free_hugepte_range(tlb, (hugepd_t *)pud); 174 + #endif 175 + } while (pud++, addr = next, addr != end); 176 + 177 + start &= PGDIR_MASK; 178 + if (start < floor) 179 + return; 180 + if (ceiling) { 181 + ceiling &= PGDIR_MASK; 182 + if (!ceiling) 183 + return; 184 + } 185 + if (end - 1 > ceiling - 1) 186 + return; 187 + 188 + pud = pud_offset(pgd, start); 189 + pgd_clear(pgd); 190 + pud_free_tlb(tlb, pud); 191 + } 192 + 193 + /* 194 + * This function frees user-level page tables of a process. 195 + * 196 + * Must be called with pagetable lock held. 197 + */ 198 + void hugetlb_free_pgd_range(struct mmu_gather **tlb, 199 + unsigned long addr, unsigned long end, 200 + unsigned long floor, unsigned long ceiling) 201 + { 202 + pgd_t *pgd; 203 + unsigned long next; 204 + unsigned long start; 205 + 206 + /* 207 + * Comments below take from the normal free_pgd_range(). They 208 + * apply here too. The tests against HUGEPD_MASK below are 209 + * essential, because we *don't* test for this at the bottom 210 + * level. Without them we'll attempt to free a hugepte table 211 + * when we unmap just part of it, even if there are other 212 + * active mappings using it. 213 + * 214 + * The next few lines have given us lots of grief... 215 + * 216 + * Why are we testing HUGEPD* at this top level? Because 217 + * often there will be no work to do at all, and we'd prefer 218 + * not to go all the way down to the bottom just to discover 219 + * that. 220 + * 221 + * Why all these "- 1"s? Because 0 represents both the bottom 222 + * of the address space and the top of it (using -1 for the 223 + * top wouldn't help much: the masks would do the wrong thing). 224 + * The rule is that addr 0 and floor 0 refer to the bottom of 225 + * the address space, but end 0 and ceiling 0 refer to the top 226 + * Comparisons need to use "end - 1" and "ceiling - 1" (though 227 + * that end 0 case should be mythical). 228 + * 229 + * Wherever addr is brought up or ceiling brought down, we 230 + * must be careful to reject "the opposite 0" before it 231 + * confuses the subsequent tests. But what about where end is 232 + * brought down by HUGEPD_SIZE below? no, end can't go down to 233 + * 0 there. 234 + * 235 + * Whereas we round start (addr) and ceiling down, by different 236 + * masks at different levels, in order to test whether a table 237 + * now has no other vmas using it, so can be freed, we don't 238 + * bother to round floor or end up - the tests don't need that. 239 + */ 240 + 241 + addr &= HUGEPD_MASK; 242 + if (addr < floor) { 243 + addr += HUGEPD_SIZE; 244 + if (!addr) 245 + return; 246 + } 247 + if (ceiling) { 248 + ceiling &= HUGEPD_MASK; 249 + if (!ceiling) 250 + return; 251 + } 252 + if (end - 1 > ceiling - 1) 253 + end -= HUGEPD_SIZE; 254 + if (addr > end - 1) 255 + return; 256 + 257 + start = addr; 258 + pgd = pgd_offset((*tlb)->mm, addr); 259 + do { 260 + BUG_ON(! in_hugepage_area((*tlb)->mm->context, addr)); 261 + next = pgd_addr_end(addr, end); 262 + if (pgd_none_or_clear_bad(pgd)) 263 + continue; 264 + hugetlb_free_pud_range(*tlb, pgd, addr, next, floor, ceiling); 265 + } while (pgd++, addr = next, addr != end); 147 266 } 148 267 149 268 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, ··· 1040 841 out: 1041 842 return err; 1042 843 } 844 + 845 + static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags) 846 + { 847 + memset(addr, 0, kmem_cache_size(cache)); 848 + } 849 + 850 + static int __init hugetlbpage_init(void) 851 + { 852 + if (!cpu_has_feature(CPU_FTR_16M_PAGE)) 853 + return -ENODEV; 854 + 855 + huge_pgtable_cache = kmem_cache_create("hugepte_cache", 856 + HUGEPTE_TABLE_SIZE, 857 + HUGEPTE_TABLE_SIZE, 858 + SLAB_HWCACHE_ALIGN | 859 + SLAB_MUST_HWCACHE_ALIGN, 860 + zero_ctor, NULL); 861 + if (! huge_pgtable_cache) 862 + panic("hugetlbpage_init(): could not create hugepte cache\n"); 863 + 864 + return 0; 865 + } 866 + 867 + module_init(hugetlbpage_init);
+7
arch/powerpc/mm/init_64.c
··· 162 162 }; 163 163 #endif /* CONFIG_PPC_64K_PAGES */ 164 164 165 + #ifdef CONFIG_HUGETLB_PAGE 166 + /* Hugepages need one extra cache, initialized in hugetlbpage.c. We 167 + * can't put into the tables above, because HPAGE_SHIFT is not compile 168 + * time constant. */ 169 + kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)+1]; 170 + #else 165 171 kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)]; 172 + #endif 166 173 167 174 void pgtable_cache_init(void) 168 175 {
+7 -3
arch/powerpc/platforms/cell/spu_base.c
··· 306 306 307 307 snprintf(spu->irq_c0, sizeof (spu->irq_c0), "spe%02d.0", spu->number); 308 308 ret = request_irq(irq_base + spu->isrc, 309 - spu_irq_class_0, 0, spu->irq_c0, spu); 309 + spu_irq_class_0, SA_INTERRUPT, spu->irq_c0, spu); 310 310 if (ret) 311 311 goto out; 312 312 313 313 snprintf(spu->irq_c1, sizeof (spu->irq_c1), "spe%02d.1", spu->number); 314 314 ret = request_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc, 315 - spu_irq_class_1, 0, spu->irq_c1, spu); 315 + spu_irq_class_1, SA_INTERRUPT, spu->irq_c1, spu); 316 316 if (ret) 317 317 goto out1; 318 318 319 319 snprintf(spu->irq_c2, sizeof (spu->irq_c2), "spe%02d.2", spu->number); 320 320 ret = request_irq(irq_base + 2*IIC_CLASS_STRIDE + spu->isrc, 321 - spu_irq_class_2, 0, spu->irq_c2, spu); 321 + spu_irq_class_2, SA_INTERRUPT, spu->irq_c2, spu); 322 322 if (ret) 323 323 goto out2; 324 324 goto out; ··· 487 487 ea = spu->dar; 488 488 dsisr = spu->dsisr; 489 489 if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) { 490 + u64 flags; 491 + 490 492 access = (_PAGE_PRESENT | _PAGE_USER); 491 493 access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL; 494 + local_irq_save(flags); 492 495 if (hash_page(ea, access, 0x300) != 0) 493 496 error |= CLASS1_ENABLE_STORAGE_FAULT_INTR; 497 + local_irq_restore(flags); 494 498 } 495 499 if (error & CLASS1_ENABLE_STORAGE_FAULT_INTR) { 496 500 if ((ret = spu_handle_mm_fault(spu)) != 0)
+13
arch/powerpc/platforms/cell/spu_callbacks.c
··· 319 319 [__NR_splice] sys_splice, 320 320 [__NR_tee] sys_tee, 321 321 [__NR_vmsplice] sys_vmsplice, 322 + [__NR_openat] sys_openat, 323 + [__NR_mkdirat] sys_mkdirat, 324 + [__NR_mknodat] sys_mknodat, 325 + [__NR_fchownat] sys_fchownat, 326 + [__NR_futimesat] sys_futimesat, 327 + [__NR_newfstatat] sys_newfstatat, 328 + [__NR_unlinkat] sys_unlinkat, 329 + [__NR_renameat] sys_renameat, 330 + [__NR_linkat] sys_linkat, 331 + [__NR_symlinkat] sys_symlinkat, 332 + [__NR_readlinkat] sys_readlinkat, 333 + [__NR_fchmodat] sys_fchmodat, 334 + [__NR_faccessat] sys_faccessat, 322 335 }; 323 336 324 337 long spu_sys_callback(struct spu_syscall_block *s)
+1 -1
arch/ppc/platforms/4xx/ocotea.c
··· 331 331 void __init platform_init(unsigned long r3, unsigned long r4, 332 332 unsigned long r5, unsigned long r6, unsigned long r7) 333 333 { 334 - ibm44x_platform_init(r3, r4, r5, r6, r7); 334 + ibm440gx_platform_init(r3, r4, r5, r6, r7); 335 335 336 336 ppc_md.setup_arch = ocotea_setup_arch; 337 337 ppc_md.show_cpuinfo = ocotea_show_cpuinfo;
+114
arch/ppc/platforms/mpc8272ads_setup.c
··· 26 26 #include <asm/irq.h> 27 27 #include <asm/ppc_sys.h> 28 28 #include <asm/ppcboot.h> 29 + #include <linux/fs_uart_pd.h> 29 30 30 31 #include "pq2ads_pd.h" 31 32 32 33 static void init_fcc1_ioports(void); 33 34 static void init_fcc2_ioports(void); 35 + static void init_scc1_uart_ioports(void); 36 + static void init_scc4_uart_ioports(void); 37 + 38 + static struct fs_uart_platform_info mpc8272_uart_pdata[] = { 39 + [fsid_scc1_uart] = { 40 + .init_ioports = init_scc1_uart_ioports, 41 + .fs_no = fsid_scc1_uart, 42 + .brg = 1, 43 + .tx_num_fifo = 4, 44 + .tx_buf_size = 32, 45 + .rx_num_fifo = 4, 46 + .rx_buf_size = 32, 47 + }, 48 + [fsid_scc4_uart] = { 49 + .init_ioports = init_scc4_uart_ioports, 50 + .fs_no = fsid_scc4_uart, 51 + .brg = 4, 52 + .tx_num_fifo = 4, 53 + .tx_buf_size = 32, 54 + .rx_num_fifo = 4, 55 + .rx_buf_size = 32, 56 + }, 57 + }; 34 58 35 59 static struct fs_mii_bus_info mii_bus_info = { 36 60 .method = fsmii_bitbang, ··· 225 201 } 226 202 } 227 203 204 + static void mpc8272ads_fixup_uart_pdata(struct platform_device *pdev, 205 + int idx) 206 + { 207 + bd_t *bd = (bd_t *) __res; 208 + struct fs_uart_platform_info *pinfo; 209 + int num = ARRAY_SIZE(mpc8272_uart_pdata); 210 + int id = fs_uart_id_scc2fsid(idx); 211 + 212 + /* no need to alter anything if console */ 213 + if ((id <= num) && (!pdev->dev.platform_data)) { 214 + pinfo = &mpc8272_uart_pdata[id]; 215 + pinfo->uart_clk = bd->bi_intfreq; 216 + pdev->dev.platform_data = pinfo; 217 + } 218 + } 219 + 220 + static void init_scc1_uart_ioports(void) 221 + { 222 + cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t)); 223 + 224 + /* SCC1 is only on port D */ 225 + setbits32(&immap->im_ioport.iop_ppard,0x00000003); 226 + clrbits32(&immap->im_ioport.iop_psord,0x00000001); 227 + setbits32(&immap->im_ioport.iop_psord,0x00000002); 228 + clrbits32(&immap->im_ioport.iop_pdird,0x00000001); 229 + setbits32(&immap->im_ioport.iop_pdird,0x00000002); 230 + 231 + /* Wire BRG1 to SCC1 */ 232 + clrbits32(&immap->im_cpmux.cmx_scr,0x00ffffff); 233 + 234 + iounmap(immap); 235 + } 236 + 237 + static void init_scc4_uart_ioports(void) 238 + { 239 + cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t)); 240 + 241 + setbits32(&immap->im_ioport.iop_ppard,0x00000600); 242 + clrbits32(&immap->im_ioport.iop_psord,0x00000600); 243 + clrbits32(&immap->im_ioport.iop_pdird,0x00000200); 244 + setbits32(&immap->im_ioport.iop_pdird,0x00000400); 245 + 246 + /* Wire BRG4 to SCC4 */ 247 + clrbits32(&immap->im_cpmux.cmx_scr,0x000000ff); 248 + setbits32(&immap->im_cpmux.cmx_scr,0x0000001b); 249 + 250 + iounmap(immap); 251 + } 252 + 228 253 static int mpc8272ads_platform_notify(struct device *dev) 229 254 { 230 255 static const struct platform_notify_dev_map dev_map[] = { 231 256 { 232 257 .bus_id = "fsl-cpm-fcc", 233 258 .rtn = mpc8272ads_fixup_enet_pdata 259 + }, 260 + { 261 + .bus_id = "fsl-cpm-scc:uart", 262 + .rtn = mpc 234 263 }, 235 264 { 236 265 .bus_id = NULL ··· 307 230 ppc_sys_device_enable(MPC82xx_CPM_FCC1); 308 231 ppc_sys_device_enable(MPC82xx_CPM_FCC2); 309 232 233 + /* to be ready for console, let's attach pdata here */ 234 + #ifdef CONFIG_SERIAL_CPM_SCC1 235 + ppc_sys_device_setfunc(MPC82xx_CPM_SCC1, PPC_SYS_FUNC_UART); 236 + ppc_sys_device_enable(MPC82xx_CPM_SCC1); 237 + 238 + #endif 239 + 240 + #ifdef CONFIG_SERIAL_CPM_SCC4 241 + ppc_sys_device_setfunc(MPC82xx_CPM_SCC4, PPC_SYS_FUNC_UART); 242 + ppc_sys_device_enable(MPC82xx_CPM_SCC4); 243 + #endif 244 + 245 + 310 246 return 0; 247 + } 248 + 249 + /* 250 + To prevent confusion, console selection is gross: 251 + by 0 assumed SCC1 and by 1 assumed SCC4 252 + */ 253 + struct platform_device* early_uart_get_pdev(int index) 254 + { 255 + bd_t *bd = (bd_t *) __res; 256 + struct fs_uart_platform_info *pinfo; 257 + 258 + struct platform_device* pdev = NULL; 259 + if(index) { /*assume SCC4 here*/ 260 + pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC4]; 261 + pinfo = &mpc8272<F12>_uart_pdata[1]; 262 + } else { /*over SCC1*/ 263 + pdev = &ppc_sys_platform_devices[MPC82xx_CPM_SCC1]; 264 + pinfo = &mpc8272_uart_pdata[0]; 265 + } 266 + 267 + pinfo->uart_clk = bd->bi_intfreq; 268 + pdev->dev.platform_data = pinfo; 269 + ppc_sys_fixup_mem_resource(pdev, IMAP_ADDR); 270 + return NULL; 311 271 } 312 272 313 273 arch_initcall(mpc8272ads_init);
+140
arch/ppc/platforms/mpc866ads_setup.c
··· 20 20 #include <linux/device.h> 21 21 22 22 #include <linux/fs_enet_pd.h> 23 + #include <linux/fs_uart_pd.h> 23 24 #include <linux/mii.h> 24 25 25 26 #include <asm/delay.h> ··· 37 36 #include <asm/mpc8xx.h> 38 37 39 38 extern unsigned char __res[]; 39 + 40 + static void setup_fec1_ioports(void); 41 + static void setup_scc1_ioports(void); 42 + static void setup_smc1_ioports(void); 43 + static void setup_smc2_ioports(void); 40 44 41 45 static struct fs_mii_bus_info fec_mii_bus_info = { 42 46 .method = fsmii_fec, ··· 85 79 .phy_irq = -1, 86 80 87 81 .bus_info = &scc_mii_bus_info, 82 + 83 + }; 84 + 85 + static struct fs_uart_platform_info mpc866_uart_pdata[] = { 86 + [fsid_smc1_uart] = { 87 + .brg = 1, 88 + .fs_no = fsid_smc1_uart, 89 + .init_ioports = setup_smc1_ioports, 90 + .tx_num_fifo = 4, 91 + .tx_buf_size = 32, 92 + .rx_num_fifo = 4, 93 + .rx_buf_size = 32, 94 + }, 95 + [fsid_smc2_uart] = { 96 + .brg = 2, 97 + .fs_no = fsid_smc2_uart, 98 + .init_ioports = setup_smc2_ioports, 99 + .tx_num_fifo = 4, 100 + .tx_buf_size = 32, 101 + .rx_num_fifo = 4, 102 + .rx_buf_size = 32, 103 + }, 88 104 }; 89 105 90 106 void __init board_init(void) ··· 120 92 printk(KERN_CRIT "Could not remap BCSR1\n"); 121 93 return; 122 94 } 95 + 123 96 #ifdef CONFIG_SERIAL_CPM_SMC1 124 97 cp->cp_simode &= ~(0xe0000000 >> 17); /* brg1 */ 125 98 clrbits32(bcsr_io,(0x80000000 >> 7)); 99 + cp->cp_smc[0].smc_smcm |= (SMCM_RX | SMCM_TX); 100 + cp->cp_smc[0].smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 126 101 #else 127 102 setbits32(bcsr_io,(0x80000000 >> 7)); 128 103 ··· 139 108 cp->cp_simode &= ~(0xe0000000 >> 1); 140 109 cp->cp_simode |= (0x20000000 >> 1); /* brg2 */ 141 110 clrbits32(bcsr_io,(0x80000000 >> 13)); 111 + cp->cp_smc[1].smc_smcm |= (SMCM_RX | SMCM_TX); 112 + cp->cp_smc[1].smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 142 113 #else 143 114 clrbits32(bcsr_io,(0x80000000 >> 13)); 144 115 cp->cp_pbpar &= ~(0x00000c00); ··· 265 232 mpc866ads_fixup_enet_pdata(pdev, fsid_scc1 + pdev->id - 1); 266 233 } 267 234 235 + static void setup_smc1_ioports(void) 236 + { 237 + immap_t *immap = (immap_t *) IMAP_ADDR; 238 + unsigned *bcsr_io; 239 + unsigned int iobits = 0x000000c0; 240 + 241 + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); 242 + 243 + if (bcsr_io == NULL) { 244 + printk(KERN_CRIT "Could not remap BCSR1\n"); 245 + return; 246 + } 247 + 248 + clrbits32(bcsr_io,BCSR1_RS232EN_1); 249 + iounmap(bcsr_io); 250 + 251 + setbits32(&immap->im_cpm.cp_pbpar, iobits); 252 + clrbits32(&immap->im_cpm.cp_pbdir, iobits); 253 + clrbits16(&immap->im_cpm.cp_pbodr, iobits); 254 + 255 + } 256 + 257 + static void setup_smc2_ioports(void) 258 + { 259 + immap_t *immap = (immap_t *) IMAP_ADDR; 260 + unsigned *bcsr_io; 261 + unsigned int iobits = 0x00000c00; 262 + 263 + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); 264 + 265 + if (bcsr_io == NULL) { 266 + printk(KERN_CRIT "Could not remap BCSR1\n"); 267 + return; 268 + } 269 + 270 + clrbits32(bcsr_io,BCSR1_RS232EN_2); 271 + 272 + iounmap(bcsr_io); 273 + 274 + #ifndef CONFIG_SERIAL_CPM_ALT_SMC2 275 + setbits32(&immap->im_cpm.cp_pbpar, iobits); 276 + clrbits32(&immap->im_cpm.cp_pbdir, iobits); 277 + clrbits16(&immap->im_cpm.cp_pbodr, iobits); 278 + #else 279 + setbits16(&immap->im_ioport.iop_papar, iobits); 280 + clrbits16(&immap->im_ioport.iop_padir, iobits); 281 + clrbits16(&immap->im_ioport.iop_paodr, iobits); 282 + #endif 283 + 284 + } 285 + 286 + static void __init mpc866ads_fixup_uart_pdata(struct platform_device *pdev, 287 + int idx) 288 + { 289 + bd_t *bd = (bd_t *) __res; 290 + struct fs_uart_platform_info *pinfo; 291 + int num = ARRAY_SIZE(mpc866_uart_pdata); 292 + 293 + int id = fs_uart_id_smc2fsid(idx); 294 + 295 + /* no need to alter anything if console */ 296 + if ((id <= num) && (!pdev->dev.platform_data)) { 297 + pinfo = &mpc866_uart_pdata[id]; 298 + pinfo->uart_clk = bd->bi_intfreq; 299 + pdev->dev.platform_data = pinfo; 300 + } 301 + } 302 + 268 303 static int mpc866ads_platform_notify(struct device *dev) 269 304 { 270 305 static const struct platform_notify_dev_map dev_map[] = { ··· 343 242 { 344 243 .bus_id = "fsl-cpm-scc", 345 244 .rtn = mpc866ads_fixup_scc_enet_pdata, 245 + }, 246 + { 247 + .bus_id = "fsl-cpm-smc:uart", 248 + .rtn = mpc866ads_fixup_uart_pdata 346 249 }, 347 250 { 348 251 .bus_id = NULL ··· 372 267 #endif 373 268 ppc_sys_device_enable(MPC8xx_CPM_FEC1); 374 269 270 + /* Since either of the uarts could be used as console, they need to ready */ 271 + #ifdef CONFIG_SERIAL_CPM_SMC1 272 + ppc_sys_device_enable(MPC8xx_CPM_SMC1); 273 + ppc_sys_device_setfunc(MPC8xx_CPM_SMC1, PPC_SYS_FUNC_UART); 274 + #endif 275 + 276 + #ifdef CONFIG_SERIAL_CPM_SMCer 277 + ppc_sys_device_enable(MPC8xx_CPM_SMC2); 278 + ppc_sys_device_setfunc(MPC8xx_CPM_SMC2, PPC_SYS_FUNC_UART); 279 + #endif 280 + 375 281 return 0; 282 + } 283 + 284 + /* 285 + To prevent confusion, console selection is gross: 286 + by 0 assumed SMC1 and by 1 assumed SMC2 287 + */ 288 + struct platform_device* early_uart_get_pdev(int index) 289 + { 290 + bd_t *bd = (bd_t *) __res; 291 + struct fs_uart_platform_info *pinfo; 292 + 293 + struct platform_device* pdev = NULL; 294 + if(index) { /*assume SMC2 here*/ 295 + pdev = &ppc_sys_platform_devices[MPC8xx_CPM_SMC2]; 296 + pinfo = &mpc866_uart_pdata[1]; 297 + } else { /*over SMC1*/ 298 + pdev = &ppc_sys_platform_devices[MPC8xx_CPM_SMC1]; 299 + pinfo = &mpc866_uart_pdata[0]; 300 + } 301 + 302 + pinfo->uart_clk = bd->bi_intfreq; 303 + pdev->dev.platform_data = pinfo; 304 + ppc_sys_fixup_mem_resource(pdev, IMAP_ADDR); 305 + return NULL; 376 306 } 377 307 378 308 arch_initcall(mpc866ads_init);
+131
arch/ppc/platforms/mpc885ads_setup.c
··· 20 20 #include <linux/device.h> 21 21 22 22 #include <linux/fs_enet_pd.h> 23 + #include <linux/fs_uart_pd.h> 23 24 #include <linux/mii.h> 24 25 25 26 #include <asm/delay.h> ··· 36 35 #include <asm/ppc_sys.h> 37 36 38 37 extern unsigned char __res[]; 38 + static void setup_smc1_ioports(void); 39 + static void setup_smc2_ioports(void); 39 40 40 41 static void __init mpc885ads_scc_phy_init(char); 42 + 43 + static struct fs_uart_platform_info mpc885_uart_pdata[] = { 44 + [fsid_smc1_uart] = { 45 + .brg = 1, 46 + .fs_no = fsid_smc1_uart, 47 + .init_ioports = setup_smc1_ioports, 48 + .tx_num_fifo = 4, 49 + .tx_buf_size = 32, 50 + .rx_num_fifo = 4, 51 + .rx_buf_size = 32, 52 + }, 53 + [fsid_smc2_uart] = { 54 + .brg = 2, 55 + .fs_no = fsid_smc2_uart, 56 + .init_ioports = setup_smc2_ioports, 57 + .tx_num_fifo = 4, 58 + .tx_buf_size = 32, 59 + .rx_num_fifo = 4, 60 + .rx_buf_size = 32, 61 + }, 62 + }; 41 63 42 64 static struct fs_mii_bus_info fec_mii_bus_info = { 43 65 .method = fsmii_fec, ··· 140 116 #ifdef CONFIG_SERIAL_CPM_SMC1 141 117 cp->cp_simode &= ~(0xe0000000 >> 17); /* brg1 */ 142 118 clrbits32(bcsr_io, BCSR1_RS232EN_1); 119 + cp->cp_smc[0].smc_smcm |= (SMCM_RX | SMCM_TX); 120 + cp->cp_smc[0].smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 143 121 #else 144 122 setbits32(bcsr_io,BCSR1_RS232EN_1); 145 123 cp->cp_smc[0].smc_smcmr = 0; ··· 152 126 cp->cp_simode &= ~(0xe0000000 >> 1); 153 127 cp->cp_simode |= (0x20000000 >> 1); /* brg2 */ 154 128 clrbits32(bcsr_io,BCSR1_RS232EN_2); 129 + cp->cp_smc[1].smc_smcm |= (SMCM_RX | SMCM_TX); 130 + cp->cp_smc[1].smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 155 131 #else 156 132 setbits32(bcsr_io,BCSR1_RS232EN_2); 157 133 cp->cp_smc[1].smc_smcmr = 0; ··· 371 343 out_be32(&fecp->fec_mii_speed, 0); 372 344 } 373 345 346 + static void setup_smc1_ioports(void) 347 + { 348 + immap_t *immap = (immap_t *) IMAP_ADDR; 349 + unsigned *bcsr_io; 350 + unsigned int iobits = 0x000000c0; 351 + 352 + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); 353 + 354 + if (bcsr_io == NULL) { 355 + printk(KERN_CRIT "Could not remap BCSR1\n"); 356 + return; 357 + } 358 + clrbits32(bcsr_io,BCSR1_RS232EN_1); 359 + iounmap(bcsr_io); 360 + 361 + setbits32(&immap->im_cpm.cp_pbpar, iobits); 362 + clrbits32(&immap->im_cpm.cp_pbdir, iobits); 363 + clrbits16(&immap->im_cpm.cp_pbodr, iobits); 364 + } 365 + 366 + static void setup_smc2_ioports(void) 367 + { 368 + immap_t *immap = (immap_t *) IMAP_ADDR; 369 + unsigned *bcsr_io; 370 + unsigned int iobits = 0x00000c00; 371 + 372 + bcsr_io = ioremap(BCSR1, sizeof(unsigned long)); 373 + 374 + if (bcsr_io == NULL) { 375 + printk(KERN_CRIT "Could not remap BCSR1\n"); 376 + return; 377 + } 378 + clrbits32(bcsr_io,BCSR1_RS232EN_2); 379 + iounmap(bcsr_io); 380 + 381 + #ifndef CONFIG_SERIAL_CPM_ALT_SMC2 382 + setbits32(&immap->im_cpm.cp_pbpar, iobits); 383 + clrbits32(&immap->im_cpm.cp_pbdir, iobits); 384 + clrbits16(&immap->im_cpm.cp_pbodr, iobits); 385 + #else 386 + setbits16(&immap->im_ioport.iop_papar, iobits); 387 + clrbits16(&immap->im_ioport.iop_padir, iobits); 388 + clrbits16(&immap->im_ioport.iop_paodr, iobits); 389 + #endif 390 + } 391 + 392 + static void __init mpc885ads_fixup_uart_pdata(struct platform_device *pdev, 393 + int idx) 394 + { 395 + bd_t *bd = (bd_t *) __res; 396 + struct fs_uart_platform_info *pinfo; 397 + int num = ARRAY_SIZE(mpc885_uart_pdata); 398 + 399 + int id = fs_uart_id_smc2fsid(idx); 400 + 401 + /* no need to alter anything if console */ 402 + if ((id <= num) && (!pdev->dev.platform_data)) { 403 + pinfo = &mpc885_uart_pdata[id]; 404 + pinfo->uart_clk = bd->bi_intfreq; 405 + pdev->dev.platform_data = pinfo; 406 + } 407 + } 408 + 409 + 374 410 static int mpc885ads_platform_notify(struct device *dev) 375 411 { 376 412 ··· 448 356 .rtn = mpc885ads_fixup_scc_enet_pdata, 449 357 }, 450 358 { 359 + .bus_id = "fsl-cpm-smc:uart", 360 + .rtn = mpc885ads_fixup_uart_pdata 361 + }, 362 + { 451 363 .bus_id = NULL 452 364 } 453 365 }; 454 366 455 367 platform_notify_map(dev_map,dev); 456 368 369 + return 0; 457 370 } 458 371 459 372 int __init mpc885ads_init(void) ··· 480 383 ppc_sys_device_enable(MPC8xx_CPM_FEC2); 481 384 #endif 482 385 386 + #ifdef CONFIG_SERIAL_CPM_SMC1 387 + ppc_sys_device_enable(MPC8xx_CPM_SMC1); 388 + ppc_sys_device_setfunc(MPC8xx_CPM_SMC1, PPC_SYS_FUNC_UART); 389 + #endif 390 + 391 + #ifdef CONFIG_SERIAL_CPM_SMC2 392 + ppc_sys_device_enable(MPC8xx_CPM_SMC2); 393 + ppc_sys_device_setfunc(MPC8xx_CPM_SMC2, PPC_SYS_FUNC_UART); 394 + #endif 483 395 return 0; 484 396 } 485 397 486 398 arch_initcall(mpc885ads_init); 399 + 400 + /* 401 + To prevent confusion, console selection is gross: 402 + by 0 assumed SMC1 and by 1 assumed SMC2 403 + */ 404 + struct platform_device* early_uart_get_pdev(int index) 405 + { 406 + bd_t *bd = (bd_t *) __res; 407 + struct fs_uart_platform_info *pinfo; 408 + 409 + struct platform_device* pdev = NULL; 410 + if(index) { /*assume SMC2 here*/ 411 + pdev = &ppc_sys_platform_devices[MPC8xx_CPM_SMC2]; 412 + pinfo = &mpc885_uart_pdata[1]; 413 + } else { /*over SMC1*/ 414 + pdev = &ppc_sys_platform_devices[MPC8xx_CPM_SMC1]; 415 + pinfo = &mpc885_uart_pdata[0]; 416 + } 417 + 418 + pinfo->uart_clk = bd->bi_intfreq; 419 + pdev->dev.platform_data = pinfo; 420 + ppc_sys_fixup_mem_resource(pdev, IMAP_ADDR); 421 + return NULL; 422 + } 423 +
+30 -1
arch/ppc/platforms/pq2ads.c
··· 14 14 15 15 #include <linux/init.h> 16 16 17 + #include <asm/io.h> 17 18 #include <asm/mpc8260.h> 19 + #include <asm/cpm2.h> 20 + #include <asm/immap_cpm2.h> 18 21 19 22 void __init 20 23 m82xx_board_setup(void) 21 24 { 25 + cpm2_map_t* immap = ioremap(CPM_MAP_ADDR, sizeof(cpm2_map_t)); 26 + u32 *bcsr = ioremap(BCSR_ADDR+4, sizeof(u32)); 27 + 22 28 /* Enable the 2nd UART port */ 23 - *(volatile uint *)(BCSR_ADDR + 4) &= ~BCSR1_RS232_EN2; 29 + clrbits32(bcsr, BCSR1_RS232_EN2); 30 + 31 + #ifdef CONFIG_SERIAL_CPM_SCC1 32 + clrbits32((u32*)&immap->im_scc[0].scc_sccm, UART_SCCM_TX | UART_SCCM_RX); 33 + clrbits32((u32*)&immap->im_scc[0].scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); 34 + #endif 35 + 36 + #ifdef CONFIG_SERIAL_CPM_SCC2 37 + clrbits32((u32*)&immap->im_scc[1].scc_sccm, UART_SCCM_TX | UART_SCCM_RX); 38 + clrbits32((u32*)&immap->im_scc[1].scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); 39 + #endif 40 + 41 + #ifdef CONFIG_SERIAL_CPM_SCC3 42 + clrbits32((u32*)&immap->im_scc[2].scc_sccm, UART_SCCM_TX | UART_SCCM_RX); 43 + clrbits32((u32*)&immap->im_scc[2].scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); 44 + #endif 45 + 46 + #ifdef CONFIG_SERIAL_CPM_SCC4 47 + clrbits32((u32*)&immap->im_scc[3].scc_sccm, UART_SCCM_TX | UART_SCCM_RX); 48 + clrbits32((u32*)&immap->im_scc[3].scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); 49 + #endif 50 + 51 + iounmap(bcsr); 52 + iounmap(immap); 24 53 }
+12 -1
arch/ppc/syslib/ibm440gx_common.c
··· 2 2 * PPC440GX system library 3 3 * 4 4 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net> 5 - * Copyright (c) 2003, 2004 Zultys Technologies 5 + * Copyright (c) 2003 - 2006 Zultys Technologies 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify it 8 8 * under the terms of the GNU General Public License as published by the ··· 282 282 return 0; 283 283 } 284 284 285 + void __init ibm440gx_platform_init(unsigned long r3, unsigned long r4, 286 + unsigned long r5, unsigned long r6, 287 + unsigned long r7) 288 + { 289 + /* Erratum 440_43 workaround, disable L1 cache parity checking */ 290 + if (!strcmp(cur_cpu_spec->cpu_name, "440GX Rev. C") || 291 + !strcmp(cur_cpu_spec->cpu_name, "440GX Rev. F")) 292 + mtspr(SPRN_CCR1, mfspr(SPRN_CCR1) | CCR1_DPC); 293 + 294 + ibm44x_platform_init(r3, r4, r5, r6, r7); 295 + }
+4
arch/ppc/syslib/ibm440gx_common.h
··· 29 29 void ibm440gx_get_clocks(struct ibm44x_clocks*, unsigned int sys_clk, 30 30 unsigned int ser_clk) __init; 31 31 32 + /* common 440GX platform init */ 33 + void ibm440gx_platform_init(unsigned long r3, unsigned long r4, unsigned long r5, 34 + unsigned long r6, unsigned long r7) __init; 35 + 32 36 /* Enable L2 cache */ 33 37 void ibm440gx_l2c_enable(void) __init; 34 38
+19 -6
arch/ppc/syslib/mpc8xx_devices.c
··· 170 170 [MPC8xx_CPM_SMC1] = { 171 171 .name = "fsl-cpm-smc", 172 172 .id = 1, 173 - .num_resources = 2, 173 + .num_resources = 3, 174 174 .resource = (struct resource[]) { 175 175 { 176 176 .name = "regs", 177 - .start = 0xa82, 178 - .end = 0xa91, 177 + .start = 0xa80, 178 + .end = 0xa8f, 179 + .flags = IORESOURCE_MEM, 180 + }, 181 + { 182 + .name = "pram", 183 + .start = 0x3e80, 184 + .end = 0x3ebf, 179 185 .flags = IORESOURCE_MEM, 180 186 }, 181 187 { ··· 195 189 [MPC8xx_CPM_SMC2] = { 196 190 .name = "fsl-cpm-smc", 197 191 .id = 2, 198 - .num_resources = 2, 192 + .num_resources = 3, 199 193 .resource = (struct resource[]) { 200 194 { 201 195 .name = "regs", 202 - .start = 0xa92, 203 - .end = 0xaa1, 196 + .start = 0xa90, 197 + .end = 0xa9f, 204 198 .flags = IORESOURCE_MEM, 199 + }, 200 + { 201 + .name = "pram", 202 + .start = 0x3f80, 203 + .end = 0x3fbf, 204 + .flags = IORESOURCE_MEM, 205 + 205 206 }, 206 207 { 207 208 .name = "interrupt",
+3 -1
arch/ppc/syslib/ppc_sys.c
··· 109 109 int i; 110 110 for (i = 0; i < pdev->num_resources; i++) { 111 111 struct resource *r = &pdev->resource[i]; 112 - if ((r->flags & IORESOURCE_MEM) == IORESOURCE_MEM) { 112 + if (((r->flags & IORESOURCE_MEM) == IORESOURCE_MEM) && 113 + ((r->flags & PPC_SYS_IORESOURCE_FIXUPPED) != PPC_SYS_IORESOURCE_FIXUPPED)) { 113 114 r->start += paddr; 114 115 r->end += paddr; 116 + r->flags |= PPC_SYS_IORESOURCE_FIXUPPED; 115 117 } 116 118 } 117 119 }
+4 -4
arch/ppc/syslib/pq2_sys.c
··· 113 113 .ppc_sys_name = "8248", 114 114 .mask = 0x0000ff00, 115 115 .value = 0x00000c00, 116 - .num_devices = 11, 116 + .num_devices = 12, 117 117 .device_list = (enum ppc_sys_devices[]) 118 118 { 119 119 MPC82xx_CPM_FCC1, MPC82xx_CPM_FCC2, MPC82xx_CPM_SCC1, 120 - MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SMC1, 121 - MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, MPC82xx_CPM_I2C, 122 - MPC82xx_CPM_USB, MPC82xx_SEC1, 120 + MPC82xx_CPM_SCC2, MPC82xx_CPM_SCC3, MPC82xx_CPM_SCC4, 121 + MPC82xx_CPM_SMC1, MPC82xx_CPM_SMC2, MPC82xx_CPM_SPI, 122 + MPC82xx_CPM_I2C, MPC82xx_CPM_USB, MPC82xx_SEC1, 123 123 }, 124 124 }, 125 125 {
+1 -1
drivers/block/floppy.c
··· 4301 4301 } 4302 4302 4303 4303 use_virtual_dma = can_use_virtual_dma & 1; 4304 - #if defined(CONFIG_PPC64) 4304 + #if defined(CONFIG_PPC_MERGE) 4305 4305 if (check_legacy_ioport(FDC1)) { 4306 4306 del_timer(&fd_timeout); 4307 4307 err = -ENODEV;
+2 -2
drivers/input/serio/i8042-io.h
··· 67 67 * On some platforms touching the i8042 data register region can do really 68 68 * bad things. Because of this the region is always reserved on such boxes. 69 69 */ 70 - #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC64) 70 + #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC_MERGE) 71 71 if (!request_region(I8042_DATA_REG, 16, "i8042")) 72 72 return -EBUSY; 73 73 #endif 74 74 75 75 i8042_reset = 1; 76 76 77 - #if defined(CONFIG_PPC64) 77 + #if defined(CONFIG_PPC_MERGE) 78 78 if (check_legacy_ioport(I8042_DATA_REG)) 79 79 return -EBUSY; 80 80 if (!request_region(I8042_DATA_REG, 16, "i8042"))
+3 -1
drivers/scsi/Kconfig
··· 446 446 447 447 config SCSI_ADVANSYS 448 448 tristate "AdvanSys SCSI support" 449 - depends on (ISA || EISA || PCI) && SCSI && BROKEN 449 + depends on SCSI 450 + depends on ISA || EISA || PCI 451 + depends on BROKEN || X86_32 450 452 help 451 453 This is a driver for all SCSI host adapters manufactured by 452 454 AdvanSys. It is documented in the kernel source in
+1 -1
drivers/scsi/advansys.c
··· 2051 2051 #define ADV_VADDR_TO_U32 virt_to_bus 2052 2052 #define ADV_U32_TO_VADDR bus_to_virt 2053 2053 2054 - #define AdvPortAddr ulong /* Virtual memory address size */ 2054 + #define AdvPortAddr void __iomem * /* Virtual memory address size */ 2055 2055 2056 2056 /* 2057 2057 * Define Adv Library required memory access macros.
+42 -7
drivers/serial/cpm_uart/cpm_uart.h
··· 10 10 #define CPM_UART_H 11 11 12 12 #include <linux/config.h> 13 + #include <linux/platform_device.h> 14 + #include <linux/fs_uart_pd.h> 13 15 14 16 #if defined(CONFIG_CPM2) 15 17 #include "cpm_uart_cpm2.h" ··· 28 26 #define FLAG_SMC 0x00000002 29 27 #define FLAG_CONSOLE 0x00000001 30 28 31 - #define UART_SMC1 0 32 - #define UART_SMC2 1 33 - #define UART_SCC1 2 34 - #define UART_SCC2 3 35 - #define UART_SCC3 4 36 - #define UART_SCC4 5 29 + #define UART_SMC1 fsid_smc1_uart 30 + #define UART_SMC2 fsid_smc2_uart 31 + #define UART_SCC1 fsid_scc1_uart 32 + #define UART_SCC2 fsid_scc2_uart 33 + #define UART_SCC3 fsid_scc3_uart 34 + #define UART_SCC4 fsid_scc4_uart 37 35 38 - #define UART_NR 6 36 + #define UART_NR fs_uart_nr 39 37 40 38 #define RX_NUM_FIFO 4 41 39 #define RX_BUF_SIZE 32 ··· 66 64 uint dp_addr; 67 65 void *mem_addr; 68 66 dma_addr_t dma_addr; 67 + u32 mem_size; 69 68 /* helpers */ 70 69 int baud; 71 70 int bits; ··· 92 89 void scc2_lineif(struct uart_cpm_port *pinfo); 93 90 void scc3_lineif(struct uart_cpm_port *pinfo); 94 91 void scc4_lineif(struct uart_cpm_port *pinfo); 92 + 93 + /* 94 + virtual to phys transtalion 95 + */ 96 + static inline unsigned long cpu2cpm_addr(void* addr, struct uart_cpm_port *pinfo) 97 + { 98 + int offset; 99 + u32 val = (u32)addr; 100 + /* sane check */ 101 + if ((val >= (u32)pinfo->mem_addr) && 102 + (val<((u32)pinfo->mem_addr + pinfo->mem_size))) { 103 + offset = val - (u32)pinfo->mem_addr; 104 + return pinfo->dma_addr+offset; 105 + } 106 + printk("%s(): address %x to translate out of range!\n", __FUNCTION__, val); 107 + return 0; 108 + } 109 + 110 + static inline void *cpm2cpu_addr(unsigned long addr, struct uart_cpm_port *pinfo) 111 + { 112 + int offset; 113 + u32 val = addr; 114 + /* sane check */ 115 + if ((val >= pinfo->dma_addr) && 116 + (val<(pinfo->dma_addr + pinfo->mem_size))) { 117 + offset = val - (u32)pinfo->dma_addr; 118 + return (void*)(pinfo->mem_addr+offset); 119 + } 120 + printk("%s(): address %x to translate out of range!\n", __FUNCTION__, val); 121 + return 0; 122 + } 123 + 95 124 96 125 #endif /* CPM_UART_H */
+220 -70
drivers/serial/cpm_uart/cpm_uart_core.c
··· 41 41 #include <linux/device.h> 42 42 #include <linux/bootmem.h> 43 43 #include <linux/dma-mapping.h> 44 + #include <linux/fs_uart_pd.h> 44 45 45 46 #include <asm/io.h> 46 47 #include <asm/irq.h> ··· 61 60 /* Track which ports are configured as uarts */ 62 61 int cpm_uart_port_map[UART_NR]; 63 62 /* How many ports did we config as uarts */ 64 - int cpm_uart_nr; 63 + int cpm_uart_nr = 0; 65 64 66 65 /**************************************************************/ 67 66 ··· 72 71 73 72 /**************************************************************/ 74 73 75 - static inline unsigned long cpu2cpm_addr(void *addr) 74 + 75 + /* Place-holder for board-specific stuff */ 76 + struct platform_device* __attribute__ ((weak)) __init 77 + early_uart_get_pdev(int index) 76 78 { 77 - if ((unsigned long)addr >= CPM_ADDR) 78 - return (unsigned long)addr; 79 - return virt_to_bus(addr); 79 + return NULL; 80 80 } 81 81 82 - static inline void *cpm2cpu_addr(unsigned long addr) 82 + 83 + void cpm_uart_count(void) 83 84 { 84 - if (addr >= CPM_ADDR) 85 - return (void *)addr; 86 - return bus_to_virt(addr); 85 + cpm_uart_nr = 0; 86 + #ifdef CONFIG_SERIAL_CPM_SMC1 87 + cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1; 88 + #endif 89 + #ifdef CONFIG_SERIAL_CPM_SMC2 90 + cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2; 91 + #endif 92 + #ifdef CONFIG_SERIAL_CPM_SCC1 93 + cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1; 94 + #endif 95 + #ifdef CONFIG_SERIAL_CPM_SCC2 96 + cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2; 97 + #endif 98 + #ifdef CONFIG_SERIAL_CPM_SCC3 99 + cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3; 100 + #endif 101 + #ifdef CONFIG_SERIAL_CPM_SCC4 102 + cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4; 103 + #endif 87 104 } 88 105 89 106 /* ··· 277 258 } 278 259 279 260 /* get pointer */ 280 - cp = cpm2cpu_addr(bdp->cbd_bufaddr); 261 + cp = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo); 281 262 282 263 /* loop through the buffer */ 283 264 while (i-- > 0) { ··· 620 601 /* Pick next descriptor and fill from buffer */ 621 602 bdp = pinfo->tx_cur; 622 603 623 - p = cpm2cpu_addr(bdp->cbd_bufaddr); 604 + p = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo); 624 605 625 606 *p++ = port->x_char; 626 607 bdp->cbd_datlen = 1; ··· 647 628 648 629 while (!(bdp->cbd_sc & BD_SC_READY) && (xmit->tail != xmit->head)) { 649 630 count = 0; 650 - p = cpm2cpu_addr(bdp->cbd_bufaddr); 631 + p = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo); 651 632 while (count < pinfo->tx_fifosize) { 652 633 *p++ = xmit->buf[xmit->tail]; 653 634 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); ··· 696 677 mem_addr = pinfo->mem_addr; 697 678 bdp = pinfo->rx_cur = pinfo->rx_bd_base; 698 679 for (i = 0; i < (pinfo->rx_nrfifos - 1); i++, bdp++) { 699 - bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); 680 + bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr, pinfo); 700 681 bdp->cbd_sc = BD_SC_EMPTY | BD_SC_INTRPT; 701 682 mem_addr += pinfo->rx_fifosize; 702 683 } 703 684 704 - bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); 685 + bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr, pinfo); 705 686 bdp->cbd_sc = BD_SC_WRAP | BD_SC_EMPTY | BD_SC_INTRPT; 706 687 707 688 /* Set the physical address of the host memory ··· 711 692 mem_addr = pinfo->mem_addr + L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize); 712 693 bdp = pinfo->tx_cur = pinfo->tx_bd_base; 713 694 for (i = 0; i < (pinfo->tx_nrfifos - 1); i++, bdp++) { 714 - bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); 695 + bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr, pinfo); 715 696 bdp->cbd_sc = BD_SC_INTRPT; 716 697 mem_addr += pinfo->tx_fifosize; 717 698 } 718 699 719 - bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr); 700 + bdp->cbd_bufaddr = cpu2cpm_addr(mem_addr, pinfo); 720 701 bdp->cbd_sc = BD_SC_WRAP | BD_SC_INTRPT; 721 702 } 722 703 ··· 847 828 848 829 if (pinfo->flags & FLAG_CONSOLE) 849 830 return 0; 850 - 851 - /* 852 - * Setup any port IO, connect any baud rate generators, 853 - * etc. This is expected to be handled by board 854 - * dependant code 855 - */ 856 - if (pinfo->set_lineif) 857 - pinfo->set_lineif(pinfo); 858 831 859 832 if (IS_SMC(pinfo)) { 860 833 pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX); ··· 999 988 }, 1000 989 }; 1001 990 991 + int cpm_uart_drv_get_platform_data(struct platform_device *pdev, int is_con) 992 + { 993 + struct resource *r; 994 + struct fs_uart_platform_info *pdata = pdev->dev.platform_data; 995 + int idx = pdata->fs_no; /* It is UART_SMCx or UART_SCCx index */ 996 + struct uart_cpm_port *pinfo; 997 + int line; 998 + u32 mem, pram; 999 + 1000 + for (line=0; line<UART_NR && cpm_uart_port_map[line]!=pdata->fs_no; line++); 1001 + 1002 + pinfo = (struct uart_cpm_port *) &cpm_uart_ports[idx]; 1003 + 1004 + pinfo->brg = pdata->brg; 1005 + 1006 + if (!is_con) { 1007 + pinfo->port.line = line; 1008 + pinfo->port.flags = UPF_BOOT_AUTOCONF; 1009 + } 1010 + 1011 + if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"))) 1012 + return -EINVAL; 1013 + mem = r->start; 1014 + 1015 + if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram"))) 1016 + return -EINVAL; 1017 + pram = r->start; 1018 + 1019 + if(idx > fsid_smc2_uart) { 1020 + pinfo->sccp = (scc_t *)mem; 1021 + pinfo->sccup = (scc_uart_t *)pram; 1022 + } else { 1023 + pinfo->smcp = (smc_t *)mem; 1024 + pinfo->smcup = (smc_uart_t *)pram; 1025 + } 1026 + pinfo->tx_nrfifos = pdata->tx_num_fifo; 1027 + pinfo->tx_fifosize = pdata->tx_buf_size; 1028 + 1029 + pinfo->rx_nrfifos = pdata->rx_num_fifo; 1030 + pinfo->rx_fifosize = pdata->rx_buf_size; 1031 + 1032 + pinfo->port.uartclk = pdata->uart_clk; 1033 + pinfo->port.mapbase = (unsigned long)mem; 1034 + pinfo->port.irq = platform_get_irq(pdev, 0); 1035 + 1036 + return 0; 1037 + } 1038 + 1002 1039 #ifdef CONFIG_SERIAL_CPM_CONSOLE 1003 1040 /* 1004 1041 * Print a string to the serial port trying not to disturb ··· 1086 1027 * If the buffer address is in the CPM DPRAM, don't 1087 1028 * convert it. 1088 1029 */ 1089 - cp = cpm2cpu_addr(bdp->cbd_bufaddr); 1030 + cp = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo); 1090 1031 1091 1032 *cp = *s; 1092 1033 ··· 1103 1044 while ((bdp->cbd_sc & BD_SC_READY) != 0) 1104 1045 ; 1105 1046 1106 - cp = cpm2cpu_addr(bdp->cbd_bufaddr); 1047 + cp = cpm2cpu_addr(bdp->cbd_bufaddr, pinfo); 1107 1048 1108 1049 *cp = 13; 1109 1050 bdp->cbd_datlen = 1; ··· 1126 1067 pinfo->tx_cur = (volatile cbd_t *) bdp; 1127 1068 } 1128 1069 1129 - /* 1130 - * Setup console. Be careful is called early ! 1131 - */ 1070 + 1132 1071 static int __init cpm_uart_console_setup(struct console *co, char *options) 1133 1072 { 1134 1073 struct uart_port *port; ··· 1137 1080 int flow = 'n'; 1138 1081 int ret; 1139 1082 1083 + struct fs_uart_platform_info *pdata; 1084 + struct platform_device* pdev = early_uart_get_pdev(co->index); 1085 + 1140 1086 port = 1141 1087 (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]]; 1142 1088 pinfo = (struct uart_cpm_port *)port; 1089 + if (!pdev) { 1090 + pr_info("cpm_uart: console: compat mode\n"); 1091 + /* compatibility - will be cleaned up */ 1092 + cpm_uart_init_portdesc(); 1093 + 1094 + if (pinfo->set_lineif) 1095 + pinfo->set_lineif(pinfo); 1096 + } else { 1097 + pdata = pdev->dev.platform_data; 1098 + if (pdata) 1099 + if (pdata->init_ioports) 1100 + pdata->init_ioports(); 1101 + 1102 + cpm_uart_drv_get_platform_data(pdev, 1); 1103 + } 1143 1104 1144 1105 pinfo->flags |= FLAG_CONSOLE; 1145 1106 ··· 1171 1096 else 1172 1097 baud = 9600; 1173 1098 } 1174 - 1175 - /* 1176 - * Setup any port IO, connect any baud rate generators, 1177 - * etc. This is expected to be handled by board 1178 - * dependant code 1179 - */ 1180 - if (pinfo->set_lineif) 1181 - pinfo->set_lineif(pinfo); 1182 1099 1183 1100 if (IS_SMC(pinfo)) { 1184 1101 pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX); ··· 1210 1143 1211 1144 int __init cpm_uart_console_init(void) 1212 1145 { 1213 - int ret = cpm_uart_init_portdesc(); 1214 - 1215 - if (!ret) 1216 - register_console(&cpm_scc_uart_console); 1217 - return ret; 1146 + register_console(&cpm_scc_uart_console); 1147 + return 0; 1218 1148 } 1219 1149 1220 1150 console_initcall(cpm_uart_console_init); ··· 1229 1165 .minor = SERIAL_CPM_MINOR, 1230 1166 .cons = CPM_UART_CONSOLE, 1231 1167 }; 1232 - 1233 - static int __init cpm_uart_init(void) 1168 + static int cpm_uart_drv_probe(struct device *dev) 1234 1169 { 1235 - int ret, i; 1170 + struct platform_device *pdev = to_platform_device(dev); 1171 + struct fs_uart_platform_info *pdata; 1172 + int ret = -ENODEV; 1236 1173 1237 - printk(KERN_INFO "Serial: CPM driver $Revision: 0.01 $\n"); 1238 - 1239 - #ifndef CONFIG_SERIAL_CPM_CONSOLE 1240 - ret = cpm_uart_init_portdesc(); 1241 - if (ret) 1174 + if(!pdev) { 1175 + printk(KERN_ERR"CPM UART: platform data missing!\n"); 1242 1176 return ret; 1243 - #endif 1244 - 1245 - cpm_reg.nr = cpm_uart_nr; 1246 - ret = uart_register_driver(&cpm_reg); 1247 - 1248 - if (ret) 1249 - return ret; 1250 - 1251 - for (i = 0; i < cpm_uart_nr; i++) { 1252 - int con = cpm_uart_port_map[i]; 1253 - cpm_uart_ports[con].port.line = i; 1254 - cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF; 1255 - uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port); 1256 1177 } 1257 1178 1179 + pdata = pdev->dev.platform_data; 1180 + pr_debug("cpm_uart_drv_probe: Adding CPM UART %d\n", 1181 + cpm_uart_port_map[pdata->fs_no]); 1182 + 1183 + if ((ret = cpm_uart_drv_get_platform_data(pdev, 0))) 1184 + return ret; 1185 + 1186 + if (pdata->init_ioports) 1187 + pdata->init_ioports(); 1188 + 1189 + ret = uart_add_one_port(&cpm_reg, &cpm_uart_ports[pdata->fs_no].port); 1190 + 1191 + return ret; 1192 + } 1193 + 1194 + static int cpm_uart_drv_remove(struct device *dev) 1195 + { 1196 + struct platform_device *pdev = to_platform_device(dev); 1197 + struct fs_uart_platform_info *pdata = pdev->dev.platform_data; 1198 + 1199 + pr_debug("cpm_uart_drv_remove: Removing CPM UART %d\n", 1200 + cpm_uart_port_map[pdata->fs_no]); 1201 + 1202 + uart_remove_one_port(&cpm_reg, &cpm_uart_ports[pdata->fs_no].port); 1203 + return 0; 1204 + } 1205 + 1206 + static struct device_driver cpm_smc_uart_driver = { 1207 + .name = "fsl-cpm-smc:uart", 1208 + .bus = &platform_bus_type, 1209 + .probe = cpm_uart_drv_probe, 1210 + .remove = cpm_uart_drv_remove, 1211 + }; 1212 + 1213 + static struct device_driver cpm_scc_uart_driver = { 1214 + .name = "fsl-cpm-scc:uart", 1215 + .bus = &platform_bus_type, 1216 + .probe = cpm_uart_drv_probe, 1217 + .remove = cpm_uart_drv_remove, 1218 + }; 1219 + 1220 + /* 1221 + This is supposed to match uart devices on platform bus, 1222 + */ 1223 + static int match_is_uart (struct device* dev, void* data) 1224 + { 1225 + struct platform_device* pdev = container_of(dev, struct platform_device, dev); 1226 + int ret = 0; 1227 + /* this was setfunc as uart */ 1228 + if(strstr(pdev->name,":uart")) { 1229 + ret = 1; 1230 + } 1231 + return ret; 1232 + } 1233 + 1234 + 1235 + static int cpm_uart_init(void) { 1236 + 1237 + int ret; 1238 + int i; 1239 + struct device *dev; 1240 + printk(KERN_INFO "Serial: CPM driver $Revision: 0.02 $\n"); 1241 + 1242 + /* lookup the bus for uart devices */ 1243 + dev = bus_find_device(&platform_bus_type, NULL, 0, match_is_uart); 1244 + 1245 + /* There are devices on the bus - all should be OK */ 1246 + if (dev) { 1247 + cpm_uart_count(); 1248 + cpm_reg.nr = cpm_uart_nr; 1249 + 1250 + if (!(ret = uart_register_driver(&cpm_reg))) { 1251 + if ((ret = driver_register(&cpm_smc_uart_driver))) { 1252 + uart_unregister_driver(&cpm_reg); 1253 + return ret; 1254 + } 1255 + if ((ret = driver_register(&cpm_scc_uart_driver))) { 1256 + driver_unregister(&cpm_scc_uart_driver); 1257 + uart_unregister_driver(&cpm_reg); 1258 + } 1259 + } 1260 + } else { 1261 + /* No capable platform devices found - falling back to legacy mode */ 1262 + pr_info("cpm_uart: WARNING: no UART devices found on platform bus!\n"); 1263 + pr_info( 1264 + "cpm_uart: the driver will guess configuration, but this mode is no longer supported.\n"); 1265 + #ifndef CONFIG_SERIAL_CPM_CONSOLE 1266 + ret = cpm_uart_init_portdesc(); 1267 + if (ret) 1268 + return ret; 1269 + #endif 1270 + 1271 + cpm_reg.nr = cpm_uart_nr; 1272 + ret = uart_register_driver(&cpm_reg); 1273 + 1274 + if (ret) 1275 + return ret; 1276 + 1277 + for (i = 0; i < cpm_uart_nr; i++) { 1278 + int con = cpm_uart_port_map[i]; 1279 + cpm_uart_ports[con].port.line = i; 1280 + cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF; 1281 + uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port); 1282 + } 1283 + 1284 + } 1258 1285 return ret; 1259 1286 } 1260 1287 1261 1288 static void __exit cpm_uart_exit(void) 1262 1289 { 1263 - int i; 1264 - 1265 - for (i = 0; i < cpm_uart_nr; i++) { 1266 - int con = cpm_uart_port_map[i]; 1267 - uart_remove_one_port(&cpm_reg, &cpm_uart_ports[con].port); 1268 - } 1269 - 1290 + driver_unregister(&cpm_scc_uart_driver); 1291 + driver_unregister(&cpm_smc_uart_driver); 1270 1292 uart_unregister_driver(&cpm_reg); 1271 1293 } 1272 1294
+4 -50
drivers/serial/cpm_uart/cpm_uart_cpm1.c
··· 81 81 82 82 void smc1_lineif(struct uart_cpm_port *pinfo) 83 83 { 84 - volatile cpm8xx_t *cp = cpmp; 85 - 86 - (void)cp; /* fix warning */ 87 - #if defined (CONFIG_MPC885ADS) 88 - /* Enable SMC1 transceivers */ 89 - { 90 - cp->cp_pepar |= 0x000000c0; 91 - cp->cp_pedir &= ~0x000000c0; 92 - cp->cp_peso &= ~0x00000040; 93 - cp->cp_peso |= 0x00000080; 94 - } 95 - #elif defined (CONFIG_MPC86XADS) 96 - unsigned int iobits = 0x000000c0; 97 - 98 - if (!pinfo->is_portb) { 99 - cp->cp_pbpar |= iobits; 100 - cp->cp_pbdir &= ~iobits; 101 - cp->cp_pbodr &= ~iobits; 102 - } else { 103 - ((immap_t *)IMAP_ADDR)->im_ioport.iop_papar |= iobits; 104 - ((immap_t *)IMAP_ADDR)->im_ioport.iop_padir &= ~iobits; 105 - ((immap_t *)IMAP_ADDR)->im_ioport.iop_paodr &= ~iobits; 106 - } 107 - #endif 108 84 pinfo->brg = 1; 109 85 } 110 86 111 87 void smc2_lineif(struct uart_cpm_port *pinfo) 112 88 { 113 - volatile cpm8xx_t *cp = cpmp; 114 - 115 - (void)cp; /* fix warning */ 116 - #if defined (CONFIG_MPC885ADS) 117 - cp->cp_pepar |= 0x00000c00; 118 - cp->cp_pedir &= ~0x00000c00; 119 - cp->cp_peso &= ~0x00000400; 120 - cp->cp_peso |= 0x00000800; 121 - #elif defined (CONFIG_MPC86XADS) 122 - unsigned int iobits = 0x00000c00; 123 - 124 - if (!pinfo->is_portb) { 125 - cp->cp_pbpar |= iobits; 126 - cp->cp_pbdir &= ~iobits; 127 - cp->cp_pbodr &= ~iobits; 128 - } else { 129 - ((immap_t *)IMAP_ADDR)->im_ioport.iop_papar |= iobits; 130 - ((immap_t *)IMAP_ADDR)->im_ioport.iop_padir &= ~iobits; 131 - ((immap_t *)IMAP_ADDR)->im_ioport.iop_paodr &= ~iobits; 132 - } 133 - 134 - #endif 135 - 136 89 pinfo->brg = 2; 137 90 } 138 91 ··· 144 191 /* was hostalloc but changed cause it blows away the */ 145 192 /* large tlb mapping when pinning the kernel area */ 146 193 mem_addr = (u8 *) cpm_dpram_addr(cpm_dpalloc(memsz, 8)); 147 - dma_addr = 0; 194 + dma_addr = (u32)mem_addr; 148 195 } else 149 196 mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, 150 197 GFP_KERNEL); ··· 157 204 } 158 205 159 206 pinfo->dp_addr = dp_offset; 160 - pinfo->mem_addr = mem_addr; 161 - pinfo->dma_addr = dma_addr; 207 + pinfo->mem_addr = mem_addr; /* virtual address*/ 208 + pinfo->dma_addr = dma_addr; /* physical address*/ 209 + pinfo->mem_size = memsz; 162 210 163 211 pinfo->rx_buf = mem_addr; 164 212 pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos
+4 -10
drivers/serial/cpm_uart/cpm_uart_cpm2.c
··· 142 142 * be supported in a sane fashion. 143 143 */ 144 144 #ifndef CONFIG_STX_GP3 145 - #ifdef CONFIG_MPC8560_ADS 146 - volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; 147 - io->iop_ppard |= 0x00000018; 148 - io->iop_psord &= ~0x00000008; /* Rx */ 149 - io->iop_psord &= ~0x00000010; /* Tx */ 150 - io->iop_pdird &= ~0x00000008; /* Rx */ 151 - io->iop_pdird |= 0x00000010; /* Tx */ 152 - #else 153 145 volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; 154 146 io->iop_pparb |= 0x008b0000; 155 147 io->iop_pdirb |= 0x00880000; 156 148 io->iop_psorb |= 0x00880000; 157 149 io->iop_pdirb &= ~0x00030000; 158 150 io->iop_psorb &= ~0x00030000; 159 - #endif 160 151 #endif 161 152 cpm2_immr->im_cpmux.cmx_scr &= 0xff00ffff; 162 153 cpm2_immr->im_cpmux.cmx_scr |= 0x00090000; ··· 209 218 210 219 memsz = L1_CACHE_ALIGN(pinfo->rx_nrfifos * pinfo->rx_fifosize) + 211 220 L1_CACHE_ALIGN(pinfo->tx_nrfifos * pinfo->tx_fifosize); 212 - if (is_con) 221 + if (is_con) { 213 222 mem_addr = alloc_bootmem(memsz); 223 + dma_addr = mem_addr; 224 + } 214 225 else 215 226 mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr, 216 227 GFP_KERNEL); ··· 227 234 pinfo->dp_addr = dp_offset; 228 235 pinfo->mem_addr = mem_addr; 229 236 pinfo->dma_addr = dma_addr; 237 + pinfo->mem_size = memsz; 230 238 231 239 pinfo->rx_buf = mem_addr; 232 240 pinfo->tx_buf = pinfo->rx_buf + L1_CACHE_ALIGN(pinfo->rx_nrfifos
-1922
drivers/video/au1200fb.c
··· 1920 1920 1921 1921 MODULE_DESCRIPTION(DRIVER_DESC); 1922 1922 MODULE_LICENSE("GPL"); 1923 - /* 1924 - * BRIEF MODULE DESCRIPTION 1925 - * Au1200 LCD Driver. 1926 - * 1927 - * Copyright 2004-2005 AMD 1928 - * Author: AMD 1929 - * 1930 - * Based on: 1931 - * linux/drivers/video/skeletonfb.c -- Skeleton for a frame buffer device 1932 - * Created 28 Dec 1997 by Geert Uytterhoeven 1933 - * 1934 - * This program is free software; you can redistribute it and/or modify it 1935 - * under the terms of the GNU General Public License as published by the 1936 - * Free Software Foundation; either version 2 of the License, or (at your 1937 - * option) any later version. 1938 - * 1939 - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 1940 - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1941 - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 1942 - * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1943 - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1944 - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1945 - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 1946 - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1947 - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 1948 - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1949 - * 1950 - * You should have received a copy of the GNU General Public License along 1951 - * with this program; if not, write to the Free Software Foundation, Inc., 1952 - * 675 Mass Ave, Cambridge, MA 02139, USA. 1953 - */ 1954 - 1955 - #include <linux/module.h> 1956 - #include <linux/platform_device.h> 1957 - #include <linux/kernel.h> 1958 - #include <linux/errno.h> 1959 - #include <linux/string.h> 1960 - #include <linux/mm.h> 1961 - #include <linux/fb.h> 1962 - #include <linux/init.h> 1963 - #include <linux/interrupt.h> 1964 - #include <linux/ctype.h> 1965 - #include <linux/dma-mapping.h> 1966 - 1967 - #include <asm/mach-au1x00/au1000.h> 1968 - #include "au1200fb.h" 1969 - 1970 - #ifdef CONFIG_PM 1971 - #include <asm/mach-au1x00/au1xxx_pm.h> 1972 - #endif 1973 - 1974 - #ifndef CONFIG_FB_AU1200_DEVS 1975 - #define CONFIG_FB_AU1200_DEVS 4 1976 - #endif 1977 - 1978 - #define DRIVER_NAME "au1200fb" 1979 - #define DRIVER_DESC "LCD controller driver for AU1200 processors" 1980 - 1981 - #define DEBUG 1 1982 - 1983 - #define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg) 1984 - #define print_warn(f, arg...) printk(KERN_WARNING DRIVER_NAME ": " f "\n", ## arg) 1985 - #define print_info(f, arg...) printk(KERN_INFO DRIVER_NAME ": " f "\n", ## arg) 1986 - 1987 - #if DEBUG 1988 - #define print_dbg(f, arg...) printk(KERN_DEBUG __FILE__ ": " f "\n", ## arg) 1989 - #else 1990 - #define print_dbg(f, arg...) do {} while (0) 1991 - #endif 1992 - 1993 - 1994 - #define AU1200_LCD_FB_IOCTL 0x46FF 1995 - 1996 - #define AU1200_LCD_SET_SCREEN 1 1997 - #define AU1200_LCD_GET_SCREEN 2 1998 - #define AU1200_LCD_SET_WINDOW 3 1999 - #define AU1200_LCD_GET_WINDOW 4 2000 - #define AU1200_LCD_SET_PANEL 5 2001 - #define AU1200_LCD_GET_PANEL 6 2002 - 2003 - #define SCREEN_SIZE (1<< 1) 2004 - #define SCREEN_BACKCOLOR (1<< 2) 2005 - #define SCREEN_BRIGHTNESS (1<< 3) 2006 - #define SCREEN_COLORKEY (1<< 4) 2007 - #define SCREEN_MASK (1<< 5) 2008 - 2009 - struct au1200_lcd_global_regs_t { 2010 - unsigned int flags; 2011 - unsigned int xsize; 2012 - unsigned int ysize; 2013 - unsigned int backcolor; 2014 - unsigned int brightness; 2015 - unsigned int colorkey; 2016 - unsigned int mask; 2017 - unsigned int panel_choice; 2018 - char panel_desc[80]; 2019 - 2020 - }; 2021 - 2022 - #define WIN_POSITION (1<< 0) 2023 - #define WIN_ALPHA_COLOR (1<< 1) 2024 - #define WIN_ALPHA_MODE (1<< 2) 2025 - #define WIN_PRIORITY (1<< 3) 2026 - #define WIN_CHANNEL (1<< 4) 2027 - #define WIN_BUFFER_FORMAT (1<< 5) 2028 - #define WIN_COLOR_ORDER (1<< 6) 2029 - #define WIN_PIXEL_ORDER (1<< 7) 2030 - #define WIN_SIZE (1<< 8) 2031 - #define WIN_COLORKEY_MODE (1<< 9) 2032 - #define WIN_DOUBLE_BUFFER_MODE (1<< 10) 2033 - #define WIN_RAM_ARRAY_MODE (1<< 11) 2034 - #define WIN_BUFFER_SCALE (1<< 12) 2035 - #define WIN_ENABLE (1<< 13) 2036 - 2037 - struct au1200_lcd_window_regs_t { 2038 - unsigned int flags; 2039 - unsigned int xpos; 2040 - unsigned int ypos; 2041 - unsigned int alpha_color; 2042 - unsigned int alpha_mode; 2043 - unsigned int priority; 2044 - unsigned int channel; 2045 - unsigned int buffer_format; 2046 - unsigned int color_order; 2047 - unsigned int pixel_order; 2048 - unsigned int xsize; 2049 - unsigned int ysize; 2050 - unsigned int colorkey_mode; 2051 - unsigned int double_buffer_mode; 2052 - unsigned int ram_array_mode; 2053 - unsigned int xscale; 2054 - unsigned int yscale; 2055 - unsigned int enable; 2056 - }; 2057 - 2058 - 2059 - struct au1200_lcd_iodata_t { 2060 - unsigned int subcmd; 2061 - struct au1200_lcd_global_regs_t global; 2062 - struct au1200_lcd_window_regs_t window; 2063 - }; 2064 - 2065 - #if defined(__BIG_ENDIAN) 2066 - #define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_11 2067 - #else 2068 - #define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_00 2069 - #endif 2070 - #define LCD_CONTROL_DEFAULT_SBPPF LCD_CONTROL_SBPPF_565 2071 - 2072 - /* Private, per-framebuffer management information (independent of the panel itself) */ 2073 - struct au1200fb_device { 2074 - struct fb_info fb_info; /* FB driver info record */ 2075 - 2076 - int plane; 2077 - unsigned char* fb_mem; /* FrameBuffer memory map */ 2078 - unsigned int fb_len; 2079 - dma_addr_t fb_phys; 2080 - }; 2081 - 2082 - static struct au1200fb_device _au1200fb_devices[CONFIG_FB_AU1200_DEVS]; 2083 - /********************************************************************/ 2084 - 2085 - /* LCD controller restrictions */ 2086 - #define AU1200_LCD_MAX_XRES 1280 2087 - #define AU1200_LCD_MAX_YRES 1024 2088 - #define AU1200_LCD_MAX_BPP 32 2089 - #define AU1200_LCD_MAX_CLK 96000000 /* fixme: this needs to go away ? */ 2090 - #define AU1200_LCD_NBR_PALETTE_ENTRIES 256 2091 - 2092 - /* Default number of visible screen buffer to allocate */ 2093 - #define AU1200FB_NBR_VIDEO_BUFFERS 1 2094 - 2095 - /********************************************************************/ 2096 - 2097 - static struct au1200_lcd *lcd = (struct au1200_lcd *) AU1200_LCD_ADDR; 2098 - static int window_index = 2; /* default is zero */ 2099 - static int panel_index = 2; /* default is zero */ 2100 - static struct window_settings *win; 2101 - static struct panel_settings *panel; 2102 - static int noblanking = 1; 2103 - static int nohwcursor = 0; 2104 - 2105 - struct window_settings { 2106 - unsigned char name[64]; 2107 - uint32 mode_backcolor; 2108 - uint32 mode_colorkey; 2109 - uint32 mode_colorkeymsk; 2110 - struct { 2111 - int xres; 2112 - int yres; 2113 - int xpos; 2114 - int ypos; 2115 - uint32 mode_winctrl1; /* winctrl1[FRM,CCO,PO,PIPE] */ 2116 - uint32 mode_winenable; 2117 - } w[4]; 2118 - }; 2119 - 2120 - #if defined(__BIG_ENDIAN) 2121 - #define LCD_WINCTRL1_PO_16BPP LCD_WINCTRL1_PO_00 2122 - #else 2123 - #define LCD_WINCTRL1_PO_16BPP LCD_WINCTRL1_PO_01 2124 - #endif 2125 - 2126 - extern int board_au1200fb_panel_init (void); 2127 - extern int board_au1200fb_panel_shutdown (void); 2128 - 2129 - #ifdef CONFIG_PM 2130 - int au1200fb_pm_callback(au1xxx_power_dev_t *dev, 2131 - au1xxx_request_t request, void *data); 2132 - au1xxx_power_dev_t *LCD_pm_dev; 2133 - #endif 2134 - 2135 - /* 2136 - * Default window configurations 2137 - */ 2138 - static struct window_settings windows[] = { 2139 - { /* Index 0 */ 2140 - "0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx", 2141 - /* mode_backcolor */ 0x006600ff, 2142 - /* mode_colorkey,msk*/ 0, 0, 2143 - { 2144 - { 2145 - /* xres, yres, xpos, ypos */ 0, 0, 0, 0, 2146 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 | 2147 - LCD_WINCTRL1_PO_16BPP, 2148 - /* mode_winenable*/ LCD_WINENABLE_WEN0, 2149 - }, 2150 - { 2151 - /* xres, yres, xpos, ypos */ 100, 100, 100, 100, 2152 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 | 2153 - LCD_WINCTRL1_PO_16BPP | 2154 - LCD_WINCTRL1_PIPE, 2155 - /* mode_winenable*/ LCD_WINENABLE_WEN1, 2156 - }, 2157 - { 2158 - /* xres, yres, xpos, ypos */ 0, 0, 0, 0, 2159 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 | 2160 - LCD_WINCTRL1_PO_16BPP, 2161 - /* mode_winenable*/ 0, 2162 - }, 2163 - { 2164 - /* xres, yres, xpos, ypos */ 0, 0, 0, 0, 2165 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 | 2166 - LCD_WINCTRL1_PO_16BPP | 2167 - LCD_WINCTRL1_PIPE, 2168 - /* mode_winenable*/ 0, 2169 - }, 2170 - }, 2171 - }, 2172 - 2173 - { /* Index 1 */ 2174 - "0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx", 2175 - /* mode_backcolor */ 0x006600ff, 2176 - /* mode_colorkey,msk*/ 0, 0, 2177 - { 2178 - { 2179 - /* xres, yres, xpos, ypos */ 320, 240, 5, 5, 2180 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_24BPP | 2181 - LCD_WINCTRL1_PO_00, 2182 - /* mode_winenable*/ LCD_WINENABLE_WEN0, 2183 - }, 2184 - { 2185 - /* xres, yres, xpos, ypos */ 0, 0, 0, 0, 2186 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 2187 - | LCD_WINCTRL1_PO_16BPP, 2188 - /* mode_winenable*/ 0, 2189 - }, 2190 - { 2191 - /* xres, yres, xpos, ypos */ 100, 100, 0, 0, 2192 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 | 2193 - LCD_WINCTRL1_PO_16BPP | 2194 - LCD_WINCTRL1_PIPE, 2195 - /* mode_winenable*/ 0/*LCD_WINENABLE_WEN2*/, 2196 - }, 2197 - { 2198 - /* xres, yres, xpos, ypos */ 200, 25, 0, 0, 2199 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 | 2200 - LCD_WINCTRL1_PO_16BPP | 2201 - LCD_WINCTRL1_PIPE, 2202 - /* mode_winenable*/ 0, 2203 - }, 2204 - }, 2205 - }, 2206 - { /* Index 2 */ 2207 - "0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx", 2208 - /* mode_backcolor */ 0x006600ff, 2209 - /* mode_colorkey,msk*/ 0, 0, 2210 - { 2211 - { 2212 - /* xres, yres, xpos, ypos */ 0, 0, 0, 0, 2213 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 | 2214 - LCD_WINCTRL1_PO_16BPP, 2215 - /* mode_winenable*/ LCD_WINENABLE_WEN0, 2216 - }, 2217 - { 2218 - /* xres, yres, xpos, ypos */ 0, 0, 0, 0, 2219 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 | 2220 - LCD_WINCTRL1_PO_16BPP, 2221 - /* mode_winenable*/ 0, 2222 - }, 2223 - { 2224 - /* xres, yres, xpos, ypos */ 0, 0, 0, 0, 2225 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_32BPP | 2226 - LCD_WINCTRL1_PO_00|LCD_WINCTRL1_PIPE, 2227 - /* mode_winenable*/ 0/*LCD_WINENABLE_WEN2*/, 2228 - }, 2229 - { 2230 - /* xres, yres, xpos, ypos */ 0, 0, 0, 0, 2231 - /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 | 2232 - LCD_WINCTRL1_PO_16BPP | 2233 - LCD_WINCTRL1_PIPE, 2234 - /* mode_winenable*/ 0, 2235 - }, 2236 - }, 2237 - }, 2238 - /* Need VGA 640 @ 24bpp, @ 32bpp */ 2239 - /* Need VGA 800 @ 24bpp, @ 32bpp */ 2240 - /* Need VGA 1024 @ 24bpp, @ 32bpp */ 2241 - }; 2242 - 2243 - /* 2244 - * Controller configurations for various panels. 2245 - */ 2246 - 2247 - struct panel_settings 2248 - { 2249 - const char name[25]; /* Full name <vendor>_<model> */ 2250 - 2251 - struct fb_monspecs monspecs; /* FB monitor specs */ 2252 - 2253 - /* panel timings */ 2254 - uint32 mode_screen; 2255 - uint32 mode_horztiming; 2256 - uint32 mode_verttiming; 2257 - uint32 mode_clkcontrol; 2258 - uint32 mode_pwmdiv; 2259 - uint32 mode_pwmhi; 2260 - uint32 mode_outmask; 2261 - uint32 mode_fifoctrl; 2262 - uint32 mode_toyclksrc; 2263 - uint32 mode_backlight; 2264 - uint32 mode_auxpll; 2265 - int (*device_init)(void); 2266 - int (*device_shutdown)(void); 2267 - #define Xres min_xres 2268 - #define Yres min_yres 2269 - u32 min_xres; /* Minimum horizontal resolution */ 2270 - u32 max_xres; /* Maximum horizontal resolution */ 2271 - u32 min_yres; /* Minimum vertical resolution */ 2272 - u32 max_yres; /* Maximum vertical resolution */ 2273 - }; 2274 - 2275 - /********************************************************************/ 2276 - /* fixme: Maybe a modedb for the CRT ? otherwise panels should be as-is */ 2277 - 2278 - /* List of panels known to work with the AU1200 LCD controller. 2279 - * To add a new panel, enter the same specifications as the 2280 - * Generic_TFT one, and MAKE SURE that it doesn't conflicts 2281 - * with the controller restrictions. Restrictions are: 2282 - * 2283 - * STN color panels: max_bpp <= 12 2284 - * STN mono panels: max_bpp <= 4 2285 - * TFT panels: max_bpp <= 16 2286 - * max_xres <= 800 2287 - * max_yres <= 600 2288 - */ 2289 - static struct panel_settings known_lcd_panels[] = 2290 - { 2291 - [0] = { /* QVGA 320x240 H:33.3kHz V:110Hz */ 2292 - .name = "QVGA_320x240", 2293 - .monspecs = { 2294 - .modedb = NULL, 2295 - .modedb_len = 0, 2296 - .hfmin = 30000, 2297 - .hfmax = 70000, 2298 - .vfmin = 60, 2299 - .vfmax = 60, 2300 - .dclkmin = 6000000, 2301 - .dclkmax = 28000000, 2302 - .input = FB_DISP_RGB, 2303 - }, 2304 - .mode_screen = LCD_SCREEN_SX_N(320) | 2305 - LCD_SCREEN_SY_N(240), 2306 - .mode_horztiming = 0x00c4623b, 2307 - .mode_verttiming = 0x00502814, 2308 - .mode_clkcontrol = 0x00020002, /* /4=24Mhz */ 2309 - .mode_pwmdiv = 0x00000000, 2310 - .mode_pwmhi = 0x00000000, 2311 - .mode_outmask = 0x00FFFFFF, 2312 - .mode_fifoctrl = 0x2f2f2f2f, 2313 - .mode_toyclksrc = 0x00000004, /* AUXPLL directly */ 2314 - .mode_backlight = 0x00000000, 2315 - .mode_auxpll = 8, /* 96MHz AUXPLL */ 2316 - .device_init = NULL, 2317 - .device_shutdown = NULL, 2318 - 320, 320, 2319 - 240, 240, 2320 - }, 2321 - 2322 - [1] = { /* VGA 640x480 H:30.3kHz V:58Hz */ 2323 - .name = "VGA_640x480", 2324 - .monspecs = { 2325 - .modedb = NULL, 2326 - .modedb_len = 0, 2327 - .hfmin = 30000, 2328 - .hfmax = 70000, 2329 - .vfmin = 60, 2330 - .vfmax = 60, 2331 - .dclkmin = 6000000, 2332 - .dclkmax = 28000000, 2333 - .input = FB_DISP_RGB, 2334 - }, 2335 - .mode_screen = 0x13f9df80, 2336 - .mode_horztiming = 0x003c5859, 2337 - .mode_verttiming = 0x00741201, 2338 - .mode_clkcontrol = 0x00020001, /* /4=24Mhz */ 2339 - .mode_pwmdiv = 0x00000000, 2340 - .mode_pwmhi = 0x00000000, 2341 - .mode_outmask = 0x00FFFFFF, 2342 - .mode_fifoctrl = 0x2f2f2f2f, 2343 - .mode_toyclksrc = 0x00000004, /* AUXPLL directly */ 2344 - .mode_backlight = 0x00000000, 2345 - .mode_auxpll = 8, /* 96MHz AUXPLL */ 2346 - .device_init = NULL, 2347 - .device_shutdown = NULL, 2348 - 640, 480, 2349 - 640, 480, 2350 - }, 2351 - 2352 - [2] = { /* SVGA 800x600 H:46.1kHz V:69Hz */ 2353 - .name = "SVGA_800x600", 2354 - .monspecs = { 2355 - .modedb = NULL, 2356 - .modedb_len = 0, 2357 - .hfmin = 30000, 2358 - .hfmax = 70000, 2359 - .vfmin = 60, 2360 - .vfmax = 60, 2361 - .dclkmin = 6000000, 2362 - .dclkmax = 28000000, 2363 - .input = FB_DISP_RGB, 2364 - }, 2365 - .mode_screen = 0x18fa5780, 2366 - .mode_horztiming = 0x00dc7e77, 2367 - .mode_verttiming = 0x00584805, 2368 - .mode_clkcontrol = 0x00020000, /* /2=48Mhz */ 2369 - .mode_pwmdiv = 0x00000000, 2370 - .mode_pwmhi = 0x00000000, 2371 - .mode_outmask = 0x00FFFFFF, 2372 - .mode_fifoctrl = 0x2f2f2f2f, 2373 - .mode_toyclksrc = 0x00000004, /* AUXPLL directly */ 2374 - .mode_backlight = 0x00000000, 2375 - .mode_auxpll = 8, /* 96MHz AUXPLL */ 2376 - .device_init = NULL, 2377 - .device_shutdown = NULL, 2378 - 800, 800, 2379 - 600, 600, 2380 - }, 2381 - 2382 - [3] = { /* XVGA 1024x768 H:56.2kHz V:70Hz */ 2383 - .name = "XVGA_1024x768", 2384 - .monspecs = { 2385 - .modedb = NULL, 2386 - .modedb_len = 0, 2387 - .hfmin = 30000, 2388 - .hfmax = 70000, 2389 - .vfmin = 60, 2390 - .vfmax = 60, 2391 - .dclkmin = 6000000, 2392 - .dclkmax = 28000000, 2393 - .input = FB_DISP_RGB, 2394 - }, 2395 - .mode_screen = 0x1ffaff80, 2396 - .mode_horztiming = 0x007d0e57, 2397 - .mode_verttiming = 0x00740a01, 2398 - .mode_clkcontrol = 0x000A0000, /* /1 */ 2399 - .mode_pwmdiv = 0x00000000, 2400 - .mode_pwmhi = 0x00000000, 2401 - .mode_outmask = 0x00FFFFFF, 2402 - .mode_fifoctrl = 0x2f2f2f2f, 2403 - .mode_toyclksrc = 0x00000004, /* AUXPLL directly */ 2404 - .mode_backlight = 0x00000000, 2405 - .mode_auxpll = 6, /* 72MHz AUXPLL */ 2406 - .device_init = NULL, 2407 - .device_shutdown = NULL, 2408 - 1024, 1024, 2409 - 768, 768, 2410 - }, 2411 - 2412 - [4] = { /* XVGA XVGA 1280x1024 H:68.5kHz V:65Hz */ 2413 - .name = "XVGA_1280x1024", 2414 - .monspecs = { 2415 - .modedb = NULL, 2416 - .modedb_len = 0, 2417 - .hfmin = 30000, 2418 - .hfmax = 70000, 2419 - .vfmin = 60, 2420 - .vfmax = 60, 2421 - .dclkmin = 6000000, 2422 - .dclkmax = 28000000, 2423 - .input = FB_DISP_RGB, 2424 - }, 2425 - .mode_screen = 0x27fbff80, 2426 - .mode_horztiming = 0x00cdb2c7, 2427 - .mode_verttiming = 0x00600002, 2428 - .mode_clkcontrol = 0x000A0000, /* /1 */ 2429 - .mode_pwmdiv = 0x00000000, 2430 - .mode_pwmhi = 0x00000000, 2431 - .mode_outmask = 0x00FFFFFF, 2432 - .mode_fifoctrl = 0x2f2f2f2f, 2433 - .mode_toyclksrc = 0x00000004, /* AUXPLL directly */ 2434 - .mode_backlight = 0x00000000, 2435 - .mode_auxpll = 10, /* 120MHz AUXPLL */ 2436 - .device_init = NULL, 2437 - .device_shutdown = NULL, 2438 - 1280, 1280, 2439 - 1024, 1024, 2440 - }, 2441 - 2442 - [5] = { /* Samsung 1024x768 TFT */ 2443 - .name = "Samsung_1024x768_TFT", 2444 - .monspecs = { 2445 - .modedb = NULL, 2446 - .modedb_len = 0, 2447 - .hfmin = 30000, 2448 - .hfmax = 70000, 2449 - .vfmin = 60, 2450 - .vfmax = 60, 2451 - .dclkmin = 6000000, 2452 - .dclkmax = 28000000, 2453 - .input = FB_DISP_RGB, 2454 - }, 2455 - .mode_screen = 0x1ffaff80, 2456 - .mode_horztiming = 0x018cc677, 2457 - .mode_verttiming = 0x00241217, 2458 - .mode_clkcontrol = 0x00000000, /* SCB 0x1 /4=24Mhz */ 2459 - .mode_pwmdiv = 0x8000063f, /* SCB 0x0 */ 2460 - .mode_pwmhi = 0x03400000, /* SCB 0x0 */ 2461 - .mode_outmask = 0x00FFFFFF, 2462 - .mode_fifoctrl = 0x2f2f2f2f, 2463 - .mode_toyclksrc = 0x00000004, /* AUXPLL directly */ 2464 - .mode_backlight = 0x00000000, 2465 - .mode_auxpll = 8, /* 96MHz AUXPLL */ 2466 - .device_init = board_au1200fb_panel_init, 2467 - .device_shutdown = board_au1200fb_panel_shutdown, 2468 - 1024, 1024, 2469 - 768, 768, 2470 - }, 2471 - 2472 - [6] = { /* Toshiba 640x480 TFT */ 2473 - .name = "Toshiba_640x480_TFT", 2474 - .monspecs = { 2475 - .modedb = NULL, 2476 - .modedb_len = 0, 2477 - .hfmin = 30000, 2478 - .hfmax = 70000, 2479 - .vfmin = 60, 2480 - .vfmax = 60, 2481 - .dclkmin = 6000000, 2482 - .dclkmax = 28000000, 2483 - .input = FB_DISP_RGB, 2484 - }, 2485 - .mode_screen = LCD_SCREEN_SX_N(640) | 2486 - LCD_SCREEN_SY_N(480), 2487 - .mode_horztiming = LCD_HORZTIMING_HPW_N(96) | 2488 - LCD_HORZTIMING_HND1_N(13) | LCD_HORZTIMING_HND2_N(51), 2489 - .mode_verttiming = LCD_VERTTIMING_VPW_N(2) | 2490 - LCD_VERTTIMING_VND1_N(11) | LCD_VERTTIMING_VND2_N(32), 2491 - .mode_clkcontrol = 0x00000000, /* /4=24Mhz */ 2492 - .mode_pwmdiv = 0x8000063f, 2493 - .mode_pwmhi = 0x03400000, 2494 - .mode_outmask = 0x00fcfcfc, 2495 - .mode_fifoctrl = 0x2f2f2f2f, 2496 - .mode_toyclksrc = 0x00000004, /* AUXPLL directly */ 2497 - .mode_backlight = 0x00000000, 2498 - .mode_auxpll = 8, /* 96MHz AUXPLL */ 2499 - .device_init = board_au1200fb_panel_init, 2500 - .device_shutdown = board_au1200fb_panel_shutdown, 2501 - 640, 480, 2502 - 640, 480, 2503 - }, 2504 - 2505 - [7] = { /* Sharp 320x240 TFT */ 2506 - .name = "Sharp_320x240_TFT", 2507 - .monspecs = { 2508 - .modedb = NULL, 2509 - .modedb_len = 0, 2510 - .hfmin = 12500, 2511 - .hfmax = 20000, 2512 - .vfmin = 38, 2513 - .vfmax = 81, 2514 - .dclkmin = 4500000, 2515 - .dclkmax = 6800000, 2516 - .input = FB_DISP_RGB, 2517 - }, 2518 - .mode_screen = LCD_SCREEN_SX_N(320) | 2519 - LCD_SCREEN_SY_N(240), 2520 - .mode_horztiming = LCD_HORZTIMING_HPW_N(60) | 2521 - LCD_HORZTIMING_HND1_N(13) | LCD_HORZTIMING_HND2_N(2), 2522 - .mode_verttiming = LCD_VERTTIMING_VPW_N(2) | 2523 - LCD_VERTTIMING_VND1_N(2) | LCD_VERTTIMING_VND2_N(5), 2524 - .mode_clkcontrol = LCD_CLKCONTROL_PCD_N(7), /*16=6Mhz*/ 2525 - .mode_pwmdiv = 0x8000063f, 2526 - .mode_pwmhi = 0x03400000, 2527 - .mode_outmask = 0x00fcfcfc, 2528 - .mode_fifoctrl = 0x2f2f2f2f, 2529 - .mode_toyclksrc = 0x00000004, /* AUXPLL directly */ 2530 - .mode_backlight = 0x00000000, 2531 - .mode_auxpll = 8, /* 96MHz AUXPLL */ 2532 - .device_init = board_au1200fb_panel_init, 2533 - .device_shutdown = board_au1200fb_panel_shutdown, 2534 - 320, 320, 2535 - 240, 240, 2536 - }, 2537 - 2538 - [8] = { /* Toppoly TD070WGCB2 7" 856x480 TFT */ 2539 - .name = "Toppoly_TD070WGCB2", 2540 - .monspecs = { 2541 - .modedb = NULL, 2542 - .modedb_len = 0, 2543 - .hfmin = 30000, 2544 - .hfmax = 70000, 2545 - .vfmin = 60, 2546 - .vfmax = 60, 2547 - .dclkmin = 6000000, 2548 - .dclkmax = 28000000, 2549 - .input = FB_DISP_RGB, 2550 - }, 2551 - .mode_screen = LCD_SCREEN_SX_N(856) | 2552 - LCD_SCREEN_SY_N(480), 2553 - .mode_horztiming = LCD_HORZTIMING_HND2_N(43) | 2554 - LCD_HORZTIMING_HND1_N(43) | LCD_HORZTIMING_HPW_N(114), 2555 - .mode_verttiming = LCD_VERTTIMING_VND2_N(20) | 2556 - LCD_VERTTIMING_VND1_N(21) | LCD_VERTTIMING_VPW_N(4), 2557 - .mode_clkcontrol = 0x00020001, /* /4=24Mhz */ 2558 - .mode_pwmdiv = 0x8000063f, 2559 - .mode_pwmhi = 0x03400000, 2560 - .mode_outmask = 0x00fcfcfc, 2561 - .mode_fifoctrl = 0x2f2f2f2f, 2562 - .mode_toyclksrc = 0x00000004, /* AUXPLL directly */ 2563 - .mode_backlight = 0x00000000, 2564 - .mode_auxpll = 8, /* 96MHz AUXPLL */ 2565 - .device_init = board_au1200fb_panel_init, 2566 - .device_shutdown = board_au1200fb_panel_shutdown, 2567 - 856, 856, 2568 - 480, 480, 2569 - }, 2570 - }; 2571 - 2572 - #define NUM_PANELS (ARRAY_SIZE(known_lcd_panels)) 2573 - 2574 - /********************************************************************/ 2575 - 2576 - #ifdef CONFIG_PM 2577 - static int set_brightness(unsigned int brightness) 2578 - { 2579 - unsigned int hi1, divider; 2580 - 2581 - /* limit brightness pwm duty to >= 30/1600 */ 2582 - if (brightness < 30) { 2583 - brightness = 30; 2584 - } 2585 - divider = (lcd->pwmdiv & 0x3FFFF) + 1; 2586 - hi1 = (lcd->pwmhi >> 16) + 1; 2587 - hi1 = (((brightness & 0xFF) + 1) * divider >> 8); 2588 - lcd->pwmhi &= 0xFFFF; 2589 - lcd->pwmhi |= (hi1 << 16); 2590 - 2591 - return brightness; 2592 - } 2593 - #endif /* CONFIG_PM */ 2594 - 2595 - static int winbpp (unsigned int winctrl1) 2596 - { 2597 - int bits = 0; 2598 - 2599 - /* how many bits are needed for each pixel format */ 2600 - switch (winctrl1 & LCD_WINCTRL1_FRM) { 2601 - case LCD_WINCTRL1_FRM_1BPP: 2602 - bits = 1; 2603 - break; 2604 - case LCD_WINCTRL1_FRM_2BPP: 2605 - bits = 2; 2606 - break; 2607 - case LCD_WINCTRL1_FRM_4BPP: 2608 - bits = 4; 2609 - break; 2610 - case LCD_WINCTRL1_FRM_8BPP: 2611 - bits = 8; 2612 - break; 2613 - case LCD_WINCTRL1_FRM_12BPP: 2614 - case LCD_WINCTRL1_FRM_16BPP655: 2615 - case LCD_WINCTRL1_FRM_16BPP565: 2616 - case LCD_WINCTRL1_FRM_16BPP556: 2617 - case LCD_WINCTRL1_FRM_16BPPI1555: 2618 - case LCD_WINCTRL1_FRM_16BPPI5551: 2619 - case LCD_WINCTRL1_FRM_16BPPA1555: 2620 - case LCD_WINCTRL1_FRM_16BPPA5551: 2621 - bits = 16; 2622 - break; 2623 - case LCD_WINCTRL1_FRM_24BPP: 2624 - case LCD_WINCTRL1_FRM_32BPP: 2625 - bits = 32; 2626 - break; 2627 - } 2628 - 2629 - return bits; 2630 - } 2631 - 2632 - static int fbinfo2index (struct fb_info *fb_info) 2633 - { 2634 - int i; 2635 - 2636 - for (i = 0; i < CONFIG_FB_AU1200_DEVS; ++i) { 2637 - if (fb_info == (struct fb_info *)(&_au1200fb_devices[i].fb_info)) 2638 - return i; 2639 - } 2640 - printk("au1200fb: ERROR: fbinfo2index failed!\n"); 2641 - return -1; 2642 - } 2643 - 2644 - static int au1200_setlocation (struct au1200fb_device *fbdev, int plane, 2645 - int xpos, int ypos) 2646 - { 2647 - uint32 winctrl0, winctrl1, winenable, fb_offset = 0; 2648 - int xsz, ysz; 2649 - 2650 - /* FIX!!! NOT CHECKING FOR COMPLETE OFFSCREEN YET */ 2651 - 2652 - winctrl0 = lcd->window[plane].winctrl0; 2653 - winctrl1 = lcd->window[plane].winctrl1; 2654 - winctrl0 &= (LCD_WINCTRL0_A | LCD_WINCTRL0_AEN); 2655 - winctrl1 &= ~(LCD_WINCTRL1_SZX | LCD_WINCTRL1_SZY); 2656 - 2657 - /* Check for off-screen adjustments */ 2658 - xsz = win->w[plane].xres; 2659 - ysz = win->w[plane].yres; 2660 - if ((xpos + win->w[plane].xres) > panel->Xres) { 2661 - /* Off-screen to the right */ 2662 - xsz = panel->Xres - xpos; /* off by 1 ??? */ 2663 - /*printk("off screen right\n");*/ 2664 - } 2665 - 2666 - if ((ypos + win->w[plane].yres) > panel->Yres) { 2667 - /* Off-screen to the bottom */ 2668 - ysz = panel->Yres - ypos; /* off by 1 ??? */ 2669 - /*printk("off screen bottom\n");*/ 2670 - } 2671 - 2672 - if (xpos < 0) { 2673 - /* Off-screen to the left */ 2674 - xsz = win->w[plane].xres + xpos; 2675 - fb_offset += (((0 - xpos) * winbpp(lcd->window[plane].winctrl1))/8); 2676 - xpos = 0; 2677 - /*printk("off screen left\n");*/ 2678 - } 2679 - 2680 - if (ypos < 0) { 2681 - /* Off-screen to the top */ 2682 - ysz = win->w[plane].yres + ypos; 2683 - /* fixme: fb_offset += ((0-ypos)*fb_pars[plane].line_length); */ 2684 - ypos = 0; 2685 - /*printk("off screen top\n");*/ 2686 - } 2687 - 2688 - /* record settings */ 2689 - win->w[plane].xpos = xpos; 2690 - win->w[plane].ypos = ypos; 2691 - 2692 - xsz -= 1; 2693 - ysz -= 1; 2694 - winctrl0 |= (xpos << 21); 2695 - winctrl0 |= (ypos << 10); 2696 - winctrl1 |= (xsz << 11); 2697 - winctrl1 |= (ysz << 0); 2698 - 2699 - /* Disable the window while making changes, then restore WINEN */ 2700 - winenable = lcd->winenable & (1 << plane); 2701 - au_sync(); 2702 - lcd->winenable &= ~(1 << plane); 2703 - lcd->window[plane].winctrl0 = winctrl0; 2704 - lcd->window[plane].winctrl1 = winctrl1; 2705 - lcd->window[plane].winbuf0 = 2706 - lcd->window[plane].winbuf1 = fbdev->fb_phys; 2707 - lcd->window[plane].winbufctrl = 0; /* select winbuf0 */ 2708 - lcd->winenable |= winenable; 2709 - au_sync(); 2710 - 2711 - return 0; 2712 - } 2713 - 2714 - static void au1200_setpanel (struct panel_settings *newpanel) 2715 - { 2716 - /* 2717 - * Perform global setup/init of LCD controller 2718 - */ 2719 - uint32 winenable; 2720 - 2721 - /* Make sure all windows disabled */ 2722 - winenable = lcd->winenable; 2723 - lcd->winenable = 0; 2724 - au_sync(); 2725 - /* 2726 - * Ensure everything is disabled before reconfiguring 2727 - */ 2728 - if (lcd->screen & LCD_SCREEN_SEN) { 2729 - /* Wait for vertical sync period */ 2730 - lcd->intstatus = LCD_INT_SS; 2731 - while ((lcd->intstatus & LCD_INT_SS) == 0) { 2732 - au_sync(); 2733 - } 2734 - 2735 - lcd->screen &= ~LCD_SCREEN_SEN; /*disable the controller*/ 2736 - 2737 - do { 2738 - lcd->intstatus = lcd->intstatus; /*clear interrupts*/ 2739 - au_sync(); 2740 - /*wait for controller to shut down*/ 2741 - } while ((lcd->intstatus & LCD_INT_SD) == 0); 2742 - 2743 - /* Call shutdown of current panel (if up) */ 2744 - /* this must occur last, because if an external clock is driving 2745 - the controller, the clock cannot be turned off before first 2746 - shutting down the controller. 2747 - */ 2748 - if (panel->device_shutdown != NULL) 2749 - panel->device_shutdown(); 2750 - } 2751 - 2752 - /* Newpanel == NULL indicates a shutdown operation only */ 2753 - if (newpanel == NULL) 2754 - return; 2755 - 2756 - panel = newpanel; 2757 - 2758 - printk("Panel(%s), %dx%d\n", panel->name, panel->Xres, panel->Yres); 2759 - 2760 - /* 2761 - * Setup clocking if internal LCD clock source (assumes sys_auxpll valid) 2762 - */ 2763 - if (!(panel->mode_clkcontrol & LCD_CLKCONTROL_EXT)) 2764 - { 2765 - uint32 sys_clksrc; 2766 - au_writel(panel->mode_auxpll, SYS_AUXPLL); 2767 - sys_clksrc = au_readl(SYS_CLKSRC) & ~0x0000001f; 2768 - sys_clksrc |= panel->mode_toyclksrc; 2769 - au_writel(sys_clksrc, SYS_CLKSRC); 2770 - } 2771 - 2772 - /* 2773 - * Configure panel timings 2774 - */ 2775 - lcd->screen = panel->mode_screen; 2776 - lcd->horztiming = panel->mode_horztiming; 2777 - lcd->verttiming = panel->mode_verttiming; 2778 - lcd->clkcontrol = panel->mode_clkcontrol; 2779 - lcd->pwmdiv = panel->mode_pwmdiv; 2780 - lcd->pwmhi = panel->mode_pwmhi; 2781 - lcd->outmask = panel->mode_outmask; 2782 - lcd->fifoctrl = panel->mode_fifoctrl; 2783 - au_sync(); 2784 - 2785 - /* fixme: Check window settings to make sure still valid 2786 - * for new geometry */ 2787 - #if 0 2788 - au1200_setlocation(fbdev, 0, win->w[0].xpos, win->w[0].ypos); 2789 - au1200_setlocation(fbdev, 1, win->w[1].xpos, win->w[1].ypos); 2790 - au1200_setlocation(fbdev, 2, win->w[2].xpos, win->w[2].ypos); 2791 - au1200_setlocation(fbdev, 3, win->w[3].xpos, win->w[3].ypos); 2792 - #endif 2793 - lcd->winenable = winenable; 2794 - 2795 - /* 2796 - * Re-enable screen now that it is configured 2797 - */ 2798 - lcd->screen |= LCD_SCREEN_SEN; 2799 - au_sync(); 2800 - 2801 - /* Call init of panel */ 2802 - if (panel->device_init != NULL) panel->device_init(); 2803 - 2804 - /* FIX!!!! not appropriate on panel change!!! Global setup/init */ 2805 - lcd->intenable = 0; 2806 - lcd->intstatus = ~0; 2807 - lcd->backcolor = win->mode_backcolor; 2808 - 2809 - /* Setup Color Key - FIX!!! */ 2810 - lcd->colorkey = win->mode_colorkey; 2811 - lcd->colorkeymsk = win->mode_colorkeymsk; 2812 - 2813 - /* Setup HWCursor - FIX!!! Need to support this eventually */ 2814 - lcd->hwc.cursorctrl = 0; 2815 - lcd->hwc.cursorpos = 0; 2816 - lcd->hwc.cursorcolor0 = 0; 2817 - lcd->hwc.cursorcolor1 = 0; 2818 - lcd->hwc.cursorcolor2 = 0; 2819 - lcd->hwc.cursorcolor3 = 0; 2820 - 2821 - 2822 - #if 0 2823 - #define D(X) printk("%25s: %08X\n", #X, X) 2824 - D(lcd->screen); 2825 - D(lcd->horztiming); 2826 - D(lcd->verttiming); 2827 - D(lcd->clkcontrol); 2828 - D(lcd->pwmdiv); 2829 - D(lcd->pwmhi); 2830 - D(lcd->outmask); 2831 - D(lcd->fifoctrl); 2832 - D(lcd->window[0].winctrl0); 2833 - D(lcd->window[0].winctrl1); 2834 - D(lcd->window[0].winctrl2); 2835 - D(lcd->window[0].winbuf0); 2836 - D(lcd->window[0].winbuf1); 2837 - D(lcd->window[0].winbufctrl); 2838 - D(lcd->window[1].winctrl0); 2839 - D(lcd->window[1].winctrl1); 2840 - D(lcd->window[1].winctrl2); 2841 - D(lcd->window[1].winbuf0); 2842 - D(lcd->window[1].winbuf1); 2843 - D(lcd->window[1].winbufctrl); 2844 - D(lcd->window[2].winctrl0); 2845 - D(lcd->window[2].winctrl1); 2846 - D(lcd->window[2].winctrl2); 2847 - D(lcd->window[2].winbuf0); 2848 - D(lcd->window[2].winbuf1); 2849 - D(lcd->window[2].winbufctrl); 2850 - D(lcd->window[3].winctrl0); 2851 - D(lcd->window[3].winctrl1); 2852 - D(lcd->window[3].winctrl2); 2853 - D(lcd->window[3].winbuf0); 2854 - D(lcd->window[3].winbuf1); 2855 - D(lcd->window[3].winbufctrl); 2856 - D(lcd->winenable); 2857 - D(lcd->intenable); 2858 - D(lcd->intstatus); 2859 - D(lcd->backcolor); 2860 - D(lcd->winenable); 2861 - D(lcd->colorkey); 2862 - D(lcd->colorkeymsk); 2863 - D(lcd->hwc.cursorctrl); 2864 - D(lcd->hwc.cursorpos); 2865 - D(lcd->hwc.cursorcolor0); 2866 - D(lcd->hwc.cursorcolor1); 2867 - D(lcd->hwc.cursorcolor2); 2868 - D(lcd->hwc.cursorcolor3); 2869 - #endif 2870 - } 2871 - 2872 - static void au1200_setmode(struct au1200fb_device *fbdev) 2873 - { 2874 - int plane = fbdev->plane; 2875 - /* Window/plane setup */ 2876 - lcd->window[plane].winctrl1 = ( 0 2877 - | LCD_WINCTRL1_PRI_N(plane) 2878 - | win->w[plane].mode_winctrl1 /* FRM,CCO,PO,PIPE */ 2879 - ) ; 2880 - 2881 - au1200_setlocation(fbdev, plane, win->w[plane].xpos, win->w[plane].ypos); 2882 - 2883 - lcd->window[plane].winctrl2 = ( 0 2884 - | LCD_WINCTRL2_CKMODE_00 2885 - | LCD_WINCTRL2_DBM 2886 - | LCD_WINCTRL2_BX_N( fbdev->fb_info.fix.line_length) 2887 - | LCD_WINCTRL2_SCX_1 2888 - | LCD_WINCTRL2_SCY_1 2889 - ) ; 2890 - lcd->winenable |= win->w[plane].mode_winenable; 2891 - au_sync(); 2892 - } 2893 - 2894 - 2895 - /* Inline helpers */ 2896 - 2897 - /*#define panel_is_dual(panel) ((panel->mode_screen & LCD_SCREEN_PT) == LCD_SCREEN_PT_010)*/ 2898 - /*#define panel_is_active(panel)((panel->mode_screen & LCD_SCREEN_PT) == LCD_SCREEN_PT_010)*/ 2899 - 2900 - #define panel_is_color(panel) ((panel->mode_screen & LCD_SCREEN_PT) <= LCD_SCREEN_PT_CDSTN) 2901 - 2902 - /* Bitfields format supported by the controller. */ 2903 - static struct fb_bitfield rgb_bitfields[][4] = { 2904 - /* Red, Green, Blue, Transp */ 2905 - [LCD_WINCTRL1_FRM_16BPP655 >> 25] = 2906 - { { 10, 6, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 0, 0, 0 } }, 2907 - 2908 - [LCD_WINCTRL1_FRM_16BPP565 >> 25] = 2909 - { { 11, 5, 0 }, { 5, 6, 0 }, { 0, 5, 0 }, { 0, 0, 0 } }, 2910 - 2911 - [LCD_WINCTRL1_FRM_16BPP556 >> 25] = 2912 - { { 11, 5, 0 }, { 6, 5, 0 }, { 0, 6, 0 }, { 0, 0, 0 } }, 2913 - 2914 - [LCD_WINCTRL1_FRM_16BPPI1555 >> 25] = 2915 - { { 10, 5, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 0, 0, 0 } }, 2916 - 2917 - [LCD_WINCTRL1_FRM_16BPPI5551 >> 25] = 2918 - { { 11, 5, 0 }, { 6, 5, 0 }, { 1, 5, 0 }, { 0, 0, 0 } }, 2919 - 2920 - [LCD_WINCTRL1_FRM_16BPPA1555 >> 25] = 2921 - { { 10, 5, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 15, 1, 0 } }, 2922 - 2923 - [LCD_WINCTRL1_FRM_16BPPA5551 >> 25] = 2924 - { { 11, 5, 0 }, { 6, 5, 0 }, { 1, 5, 0 }, { 0, 1, 0 } }, 2925 - 2926 - [LCD_WINCTRL1_FRM_24BPP >> 25] = 2927 - { { 16, 8, 0 }, { 8, 8, 0 }, { 0, 8, 0 }, { 0, 0, 0 } }, 2928 - 2929 - [LCD_WINCTRL1_FRM_32BPP >> 25] = 2930 - { { 16, 8, 0 }, { 8, 8, 0 }, { 0, 8, 0 }, { 24, 0, 0 } }, 2931 - }; 2932 - 2933 - /*-------------------------------------------------------------------------*/ 2934 - 2935 - /* Helpers */ 2936 - 2937 - static void au1200fb_update_fbinfo(struct fb_info *fbi) 2938 - { 2939 - /* FIX!!!! This also needs to take the window pixel format into account!!! */ 2940 - 2941 - /* Update var-dependent FB info */ 2942 - if (panel_is_color(panel)) { 2943 - if (fbi->var.bits_per_pixel <= 8) { 2944 - /* palettized */ 2945 - fbi->fix.visual = FB_VISUAL_PSEUDOCOLOR; 2946 - fbi->fix.line_length = fbi->var.xres_virtual / 2947 - (8/fbi->var.bits_per_pixel); 2948 - } else { 2949 - /* non-palettized */ 2950 - fbi->fix.visual = FB_VISUAL_TRUECOLOR; 2951 - fbi->fix.line_length = fbi->var.xres_virtual * (fbi->var.bits_per_pixel / 8); 2952 - } 2953 - } else { 2954 - /* mono FIX!!! mono 8 and 4 bits */ 2955 - fbi->fix.visual = FB_VISUAL_MONO10; 2956 - fbi->fix.line_length = fbi->var.xres_virtual / 8; 2957 - } 2958 - 2959 - fbi->screen_size = fbi->fix.line_length * fbi->var.yres_virtual; 2960 - print_dbg("line length: %d\n", fbi->fix.line_length); 2961 - print_dbg("bits_per_pixel: %d\n", fbi->var.bits_per_pixel); 2962 - } 2963 - 2964 - /*-------------------------------------------------------------------------*/ 2965 - 2966 - /* AU1200 framebuffer driver */ 2967 - 2968 - /* fb_check_var 2969 - * Validate var settings with hardware restrictions and modify it if necessary 2970 - */ 2971 - static int au1200fb_fb_check_var(struct fb_var_screeninfo *var, 2972 - struct fb_info *fbi) 2973 - { 2974 - struct au1200fb_device *fbdev = (struct au1200fb_device *)fbi; 2975 - u32 pixclock; 2976 - int screen_size, plane; 2977 - 2978 - plane = fbdev->plane; 2979 - 2980 - /* Make sure that the mode respect all LCD controller and 2981 - * panel restrictions. */ 2982 - var->xres = win->w[plane].xres; 2983 - var->yres = win->w[plane].yres; 2984 - 2985 - /* No need for virtual resolution support */ 2986 - var->xres_virtual = var->xres; 2987 - var->yres_virtual = var->yres; 2988 - 2989 - var->bits_per_pixel = winbpp(win->w[plane].mode_winctrl1); 2990 - 2991 - screen_size = var->xres_virtual * var->yres_virtual; 2992 - if (var->bits_per_pixel > 8) screen_size *= (var->bits_per_pixel / 8); 2993 - else screen_size /= (8/var->bits_per_pixel); 2994 - 2995 - if (fbdev->fb_len < screen_size) 2996 - return -EINVAL; /* Virtual screen is to big, abort */ 2997 - 2998 - /* FIX!!!! what are the implicaitons of ignoring this for windows ??? */ 2999 - /* The max LCD clock is fixed to 48MHz (value of AUX_CLK). The pixel 3000 - * clock can only be obtain by dividing this value by an even integer. 3001 - * Fallback to a slower pixel clock if necessary. */ 3002 - pixclock = max((u32)(PICOS2KHZ(var->pixclock) * 1000), fbi->monspecs.dclkmin); 3003 - pixclock = min(pixclock, min(fbi->monspecs.dclkmax, (u32)AU1200_LCD_MAX_CLK/2)); 3004 - 3005 - if (AU1200_LCD_MAX_CLK % pixclock) { 3006 - int diff = AU1200_LCD_MAX_CLK % pixclock; 3007 - pixclock -= diff; 3008 - } 3009 - 3010 - var->pixclock = KHZ2PICOS(pixclock/1000); 3011 - #if 0 3012 - if (!panel_is_active(panel)) { 3013 - int pcd = AU1200_LCD_MAX_CLK / (pixclock * 2) - 1; 3014 - 3015 - if (!panel_is_color(panel) 3016 - && (panel->control_base & LCD_CONTROL_MPI) && (pcd < 3)) { 3017 - /* STN 8bit mono panel support is up to 6MHz pixclock */ 3018 - var->pixclock = KHZ2PICOS(6000); 3019 - } else if (!pcd) { 3020 - /* Other STN panel support is up to 12MHz */ 3021 - var->pixclock = KHZ2PICOS(12000); 3022 - } 3023 - } 3024 - #endif 3025 - /* Set bitfield accordingly */ 3026 - switch (var->bits_per_pixel) { 3027 - case 16: 3028 - { 3029 - /* 16bpp True color. 3030 - * These must be set to MATCH WINCTRL[FORM] */ 3031 - int idx; 3032 - idx = (win->w[0].mode_winctrl1 & LCD_WINCTRL1_FRM) >> 25; 3033 - var->red = rgb_bitfields[idx][0]; 3034 - var->green = rgb_bitfields[idx][1]; 3035 - var->blue = rgb_bitfields[idx][2]; 3036 - var->transp = rgb_bitfields[idx][3]; 3037 - break; 3038 - } 3039 - 3040 - case 32: 3041 - { 3042 - /* 32bpp True color. 3043 - * These must be set to MATCH WINCTRL[FORM] */ 3044 - int idx; 3045 - idx = (win->w[0].mode_winctrl1 & LCD_WINCTRL1_FRM) >> 25; 3046 - var->red = rgb_bitfields[idx][0]; 3047 - var->green = rgb_bitfields[idx][1]; 3048 - var->blue = rgb_bitfields[idx][2]; 3049 - var->transp = rgb_bitfields[idx][3]; 3050 - break; 3051 - } 3052 - default: 3053 - print_dbg("Unsupported depth %dbpp", var->bits_per_pixel); 3054 - return -EINVAL; 3055 - } 3056 - 3057 - return 0; 3058 - } 3059 - 3060 - /* fb_set_par 3061 - * Set hardware with var settings. This will enable the controller with a 3062 - * specific mode, normally validated with the fb_check_var method 3063 - */ 3064 - static int au1200fb_fb_set_par(struct fb_info *fbi) 3065 - { 3066 - struct au1200fb_device *fbdev = (struct au1200fb_device *)fbi; 3067 - 3068 - au1200fb_update_fbinfo(fbi); 3069 - au1200_setmode(fbdev); 3070 - 3071 - return 0; 3072 - } 3073 - 3074 - /* fb_setcolreg 3075 - * Set color in LCD palette. 3076 - */ 3077 - static int au1200fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, 3078 - unsigned blue, unsigned transp, struct fb_info *fbi) 3079 - { 3080 - volatile u32 *palette = lcd->palette; 3081 - u32 value; 3082 - 3083 - if (regno > (AU1200_LCD_NBR_PALETTE_ENTRIES - 1)) 3084 - return -EINVAL; 3085 - 3086 - if (fbi->var.grayscale) { 3087 - /* Convert color to grayscale */ 3088 - red = green = blue = 3089 - (19595 * red + 38470 * green + 7471 * blue) >> 16; 3090 - } 3091 - 3092 - if (fbi->fix.visual == FB_VISUAL_TRUECOLOR) { 3093 - /* Place color in the pseudopalette */ 3094 - if (regno > 16) 3095 - return -EINVAL; 3096 - 3097 - palette = (u32*) fbi->pseudo_palette; 3098 - 3099 - red >>= (16 - fbi->var.red.length); 3100 - green >>= (16 - fbi->var.green.length); 3101 - blue >>= (16 - fbi->var.blue.length); 3102 - 3103 - value = (red << fbi->var.red.offset) | 3104 - (green << fbi->var.green.offset)| 3105 - (blue << fbi->var.blue.offset); 3106 - value &= 0xFFFF; 3107 - 3108 - } else if (1 /*FIX!!! panel_is_active(fbdev->panel)*/) { 3109 - /* COLOR TFT PALLETTIZED (use RGB 565) */ 3110 - value = (red & 0xF800)|((green >> 5) & 3111 - 0x07E0)|((blue >> 11) & 0x001F); 3112 - value &= 0xFFFF; 3113 - 3114 - } else if (0 /*panel_is_color(fbdev->panel)*/) { 3115 - /* COLOR STN MODE */ 3116 - value = 0x1234; 3117 - value &= 0xFFF; 3118 - } else { 3119 - /* MONOCHROME MODE */ 3120 - value = (green >> 12) & 0x000F; 3121 - value &= 0xF; 3122 - } 3123 - 3124 - palette[regno] = value; 3125 - 3126 - return 0; 3127 - } 3128 - 3129 - /* fb_blank 3130 - * Blank the screen. Depending on the mode, the screen will be 3131 - * activated with the backlight color, or desactivated 3132 - */ 3133 - static int au1200fb_fb_blank(int blank_mode, struct fb_info *fbi) 3134 - { 3135 - /* Short-circuit screen blanking */ 3136 - if (noblanking) 3137 - return 0; 3138 - 3139 - switch (blank_mode) { 3140 - 3141 - case FB_BLANK_UNBLANK: 3142 - case FB_BLANK_NORMAL: 3143 - /* printk("turn on panel\n"); */ 3144 - au1200_setpanel(panel); 3145 - break; 3146 - case FB_BLANK_VSYNC_SUSPEND: 3147 - case FB_BLANK_HSYNC_SUSPEND: 3148 - case FB_BLANK_POWERDOWN: 3149 - /* printk("turn off panel\n"); */ 3150 - au1200_setpanel(NULL); 3151 - break; 3152 - default: 3153 - break; 3154 - 3155 - } 3156 - 3157 - /* FB_BLANK_NORMAL is a soft blank */ 3158 - return (blank_mode == FB_BLANK_NORMAL) ? -EINVAL : 0; 3159 - } 3160 - 3161 - /* fb_mmap 3162 - * Map video memory in user space. We don't use the generic fb_mmap 3163 - * method mainly to allow the use of the TLB streaming flag (CCA=6) 3164 - */ 3165 - static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) 3166 - 3167 - { 3168 - unsigned int len; 3169 - unsigned long start=0, off; 3170 - struct au1200fb_device *fbdev = (struct au1200fb_device *) info; 3171 - 3172 - #ifdef CONFIG_PM 3173 - au1xxx_pm_access(LCD_pm_dev); 3174 - #endif 3175 - 3176 - if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { 3177 - return -EINVAL; 3178 - } 3179 - 3180 - start = fbdev->fb_phys & PAGE_MASK; 3181 - len = PAGE_ALIGN((start & ~PAGE_MASK) + fbdev->fb_len); 3182 - 3183 - off = vma->vm_pgoff << PAGE_SHIFT; 3184 - 3185 - if ((vma->vm_end - vma->vm_start + off) > len) { 3186 - return -EINVAL; 3187 - } 3188 - 3189 - off += start; 3190 - vma->vm_pgoff = off >> PAGE_SHIFT; 3191 - 3192 - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); 3193 - pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */ 3194 - 3195 - vma->vm_flags |= VM_IO; 3196 - 3197 - return io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, 3198 - vma->vm_end - vma->vm_start, 3199 - vma->vm_page_prot); 3200 - 3201 - return 0; 3202 - } 3203 - 3204 - static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) 3205 - { 3206 - 3207 - unsigned int hi1, divider; 3208 - 3209 - /* SCREEN_SIZE: user cannot reset size, must switch panel choice */ 3210 - 3211 - if (pdata->flags & SCREEN_BACKCOLOR) 3212 - lcd->backcolor = pdata->backcolor; 3213 - 3214 - if (pdata->flags & SCREEN_BRIGHTNESS) { 3215 - 3216 - // limit brightness pwm duty to >= 30/1600 3217 - if (pdata->brightness < 30) { 3218 - pdata->brightness = 30; 3219 - } 3220 - divider = (lcd->pwmdiv & 0x3FFFF) + 1; 3221 - hi1 = (lcd->pwmhi >> 16) + 1; 3222 - hi1 = (((pdata->brightness & 0xFF)+1) * divider >> 8); 3223 - lcd->pwmhi &= 0xFFFF; 3224 - lcd->pwmhi |= (hi1 << 16); 3225 - } 3226 - 3227 - if (pdata->flags & SCREEN_COLORKEY) 3228 - lcd->colorkey = pdata->colorkey; 3229 - 3230 - if (pdata->flags & SCREEN_MASK) 3231 - lcd->colorkeymsk = pdata->mask; 3232 - au_sync(); 3233 - } 3234 - 3235 - static void get_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata) 3236 - { 3237 - unsigned int hi1, divider; 3238 - 3239 - pdata->xsize = ((lcd->screen & LCD_SCREEN_SX) >> 19) + 1; 3240 - pdata->ysize = ((lcd->screen & LCD_SCREEN_SY) >> 8) + 1; 3241 - 3242 - pdata->backcolor = lcd->backcolor; 3243 - pdata->colorkey = lcd->colorkey; 3244 - pdata->mask = lcd->colorkeymsk; 3245 - 3246 - // brightness 3247 - hi1 = (lcd->pwmhi >> 16) + 1; 3248 - divider = (lcd->pwmdiv & 0x3FFFF) + 1; 3249 - pdata->brightness = ((hi1 << 8) / divider) - 1; 3250 - au_sync(); 3251 - } 3252 - 3253 - static void set_window(unsigned int plane, 3254 - struct au1200_lcd_window_regs_t *pdata) 3255 - { 3256 - unsigned int val, bpp; 3257 - 3258 - /* Window control register 0 */ 3259 - if (pdata->flags & WIN_POSITION) { 3260 - val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_OX | 3261 - LCD_WINCTRL0_OY); 3262 - val |= ((pdata->xpos << 21) & LCD_WINCTRL0_OX); 3263 - val |= ((pdata->ypos << 10) & LCD_WINCTRL0_OY); 3264 - lcd->window[plane].winctrl0 = val; 3265 - } 3266 - if (pdata->flags & WIN_ALPHA_COLOR) { 3267 - val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_A); 3268 - val |= ((pdata->alpha_color << 2) & LCD_WINCTRL0_A); 3269 - lcd->window[plane].winctrl0 = val; 3270 - } 3271 - if (pdata->flags & WIN_ALPHA_MODE) { 3272 - val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_AEN); 3273 - val |= ((pdata->alpha_mode << 1) & LCD_WINCTRL0_AEN); 3274 - lcd->window[plane].winctrl0 = val; 3275 - } 3276 - 3277 - /* Window control register 1 */ 3278 - if (pdata->flags & WIN_PRIORITY) { 3279 - val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PRI); 3280 - val |= ((pdata->priority << 30) & LCD_WINCTRL1_PRI); 3281 - lcd->window[plane].winctrl1 = val; 3282 - } 3283 - if (pdata->flags & WIN_CHANNEL) { 3284 - val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PIPE); 3285 - val |= ((pdata->channel << 29) & LCD_WINCTRL1_PIPE); 3286 - lcd->window[plane].winctrl1 = val; 3287 - } 3288 - if (pdata->flags & WIN_BUFFER_FORMAT) { 3289 - val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_FRM); 3290 - val |= ((pdata->buffer_format << 25) & LCD_WINCTRL1_FRM); 3291 - lcd->window[plane].winctrl1 = val; 3292 - } 3293 - if (pdata->flags & WIN_COLOR_ORDER) { 3294 - val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_CCO); 3295 - val |= ((pdata->color_order << 24) & LCD_WINCTRL1_CCO); 3296 - lcd->window[plane].winctrl1 = val; 3297 - } 3298 - if (pdata->flags & WIN_PIXEL_ORDER) { 3299 - val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PO); 3300 - val |= ((pdata->pixel_order << 22) & LCD_WINCTRL1_PO); 3301 - lcd->window[plane].winctrl1 = val; 3302 - } 3303 - if (pdata->flags & WIN_SIZE) { 3304 - val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_SZX | 3305 - LCD_WINCTRL1_SZY); 3306 - val |= (((pdata->xsize << 11) - 1) & LCD_WINCTRL1_SZX); 3307 - val |= (((pdata->ysize) - 1) & LCD_WINCTRL1_SZY); 3308 - lcd->window[plane].winctrl1 = val; 3309 - /* program buffer line width */ 3310 - bpp = winbpp(val) / 8; 3311 - val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_BX); 3312 - val |= (((pdata->xsize * bpp) << 8) & LCD_WINCTRL2_BX); 3313 - lcd->window[plane].winctrl2 = val; 3314 - } 3315 - 3316 - /* Window control register 2 */ 3317 - if (pdata->flags & WIN_COLORKEY_MODE) { 3318 - val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_CKMODE); 3319 - val |= ((pdata->colorkey_mode << 24) & LCD_WINCTRL2_CKMODE); 3320 - lcd->window[plane].winctrl2 = val; 3321 - } 3322 - if (pdata->flags & WIN_DOUBLE_BUFFER_MODE) { 3323 - val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_DBM); 3324 - val |= ((pdata->double_buffer_mode << 23) & LCD_WINCTRL2_DBM); 3325 - lcd->window[plane].winctrl2 = val; 3326 - } 3327 - if (pdata->flags & WIN_RAM_ARRAY_MODE) { 3328 - val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_RAM); 3329 - val |= ((pdata->ram_array_mode << 21) & LCD_WINCTRL2_RAM); 3330 - lcd->window[plane].winctrl2 = val; 3331 - } 3332 - 3333 - /* Buffer line width programmed with WIN_SIZE */ 3334 - 3335 - if (pdata->flags & WIN_BUFFER_SCALE) { 3336 - val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_SCX | 3337 - LCD_WINCTRL2_SCY); 3338 - val |= ((pdata->xsize << 11) & LCD_WINCTRL2_SCX); 3339 - val |= ((pdata->ysize) & LCD_WINCTRL2_SCY); 3340 - lcd->window[plane].winctrl2 = val; 3341 - } 3342 - 3343 - if (pdata->flags & WIN_ENABLE) { 3344 - val = lcd->winenable; 3345 - val &= ~(1<<plane); 3346 - val |= (pdata->enable & 1) << plane; 3347 - lcd->winenable = val; 3348 - } 3349 - au_sync(); 3350 - } 3351 - 3352 - static void get_window(unsigned int plane, 3353 - struct au1200_lcd_window_regs_t *pdata) 3354 - { 3355 - /* Window control register 0 */ 3356 - pdata->xpos = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_OX) >> 21; 3357 - pdata->ypos = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_OY) >> 10; 3358 - pdata->alpha_color = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_A) >> 2; 3359 - pdata->alpha_mode = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_AEN) >> 1; 3360 - 3361 - /* Window control register 1 */ 3362 - pdata->priority = (lcd->window[plane].winctrl1& LCD_WINCTRL1_PRI) >> 30; 3363 - pdata->channel = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_PIPE) >> 29; 3364 - pdata->buffer_format = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_FRM) >> 25; 3365 - pdata->color_order = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_CCO) >> 24; 3366 - pdata->pixel_order = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_PO) >> 22; 3367 - pdata->xsize = ((lcd->window[plane].winctrl1 & LCD_WINCTRL1_SZX) >> 11) + 1; 3368 - pdata->ysize = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_SZY) + 1; 3369 - 3370 - /* Window control register 2 */ 3371 - pdata->colorkey_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_CKMODE) >> 24; 3372 - pdata->double_buffer_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_DBM) >> 23; 3373 - pdata->ram_array_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_RAM) >> 21; 3374 - 3375 - pdata->enable = (lcd->winenable >> plane) & 1; 3376 - au_sync(); 3377 - } 3378 - 3379 - static int au1200fb_ioctl(struct fb_info *info, unsigned int cmd, 3380 - unsigned long arg) 3381 - { 3382 - int plane; 3383 - int val; 3384 - 3385 - #ifdef CONFIG_PM 3386 - au1xxx_pm_access(LCD_pm_dev); 3387 - #endif 3388 - 3389 - plane = fbinfo2index(info); 3390 - print_dbg("au1200fb: ioctl %d on plane %d\n", cmd, plane); 3391 - 3392 - if (cmd == AU1200_LCD_FB_IOCTL) { 3393 - struct au1200_lcd_iodata_t iodata; 3394 - 3395 - if (copy_from_user(&iodata, (void __user *) arg, sizeof(iodata))) 3396 - return -EFAULT; 3397 - 3398 - print_dbg("FB IOCTL called\n"); 3399 - 3400 - switch (iodata.subcmd) { 3401 - case AU1200_LCD_SET_SCREEN: 3402 - print_dbg("AU1200_LCD_SET_SCREEN\n"); 3403 - set_global(cmd, &iodata.global); 3404 - break; 3405 - 3406 - case AU1200_LCD_GET_SCREEN: 3407 - print_dbg("AU1200_LCD_GET_SCREEN\n"); 3408 - get_global(cmd, &iodata.global); 3409 - break; 3410 - 3411 - case AU1200_LCD_SET_WINDOW: 3412 - print_dbg("AU1200_LCD_SET_WINDOW\n"); 3413 - set_window(plane, &iodata.window); 3414 - break; 3415 - 3416 - case AU1200_LCD_GET_WINDOW: 3417 - print_dbg("AU1200_LCD_GET_WINDOW\n"); 3418 - get_window(plane, &iodata.window); 3419 - break; 3420 - 3421 - case AU1200_LCD_SET_PANEL: 3422 - print_dbg("AU1200_LCD_SET_PANEL\n"); 3423 - if ((iodata.global.panel_choice >= 0) && 3424 - (iodata.global.panel_choice < 3425 - NUM_PANELS)) 3426 - { 3427 - struct panel_settings *newpanel; 3428 - panel_index = iodata.global.panel_choice; 3429 - newpanel = &known_lcd_panels[panel_index]; 3430 - au1200_setpanel(newpanel); 3431 - } 3432 - break; 3433 - 3434 - case AU1200_LCD_GET_PANEL: 3435 - print_dbg("AU1200_LCD_GET_PANEL\n"); 3436 - iodata.global.panel_choice = panel_index; 3437 - break; 3438 - 3439 - default: 3440 - return -EINVAL; 3441 - } 3442 - 3443 - val = copy_to_user((void __user *) arg, &iodata, sizeof(iodata)); 3444 - if (val) { 3445 - print_dbg("error: could not copy %d bytes\n", val); 3446 - return -EFAULT; 3447 - } 3448 - } 3449 - 3450 - return 0; 3451 - } 3452 - 3453 - 3454 - static struct fb_ops au1200fb_fb_ops = { 3455 - .owner = THIS_MODULE, 3456 - .fb_check_var = au1200fb_fb_check_var, 3457 - .fb_set_par = au1200fb_fb_set_par, 3458 - .fb_setcolreg = au1200fb_fb_setcolreg, 3459 - .fb_blank = au1200fb_fb_blank, 3460 - .fb_fillrect = cfb_fillrect, 3461 - .fb_copyarea = cfb_copyarea, 3462 - .fb_imageblit = cfb_imageblit, 3463 - .fb_sync = NULL, 3464 - .fb_ioctl = au1200fb_ioctl, 3465 - .fb_mmap = au1200fb_fb_mmap, 3466 - }; 3467 - 3468 - /*-------------------------------------------------------------------------*/ 3469 - 3470 - static irqreturn_t au1200fb_handle_irq(int irq, void* dev_id, struct pt_regs *regs) 3471 - { 3472 - /* Nothing to do for now, just clear any pending interrupt */ 3473 - lcd->intstatus = lcd->intstatus; 3474 - au_sync(); 3475 - 3476 - return IRQ_HANDLED; 3477 - } 3478 - 3479 - /*-------------------------------------------------------------------------*/ 3480 - 3481 - /* AU1200 LCD device probe helpers */ 3482 - 3483 - static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev) 3484 - { 3485 - struct fb_info *fbi = &fbdev->fb_info; 3486 - int bpp; 3487 - 3488 - memset(fbi, 0, sizeof(struct fb_info)); 3489 - fbi->fbops = &au1200fb_fb_ops; 3490 - 3491 - bpp = winbpp(win->w[fbdev->plane].mode_winctrl1); 3492 - 3493 - /* Copy monitor specs from panel data */ 3494 - /* fixme: we're setting up LCD controller windows, so these dont give a 3495 - damn as to what the monitor specs are (the panel itself does, but that 3496 - isnt done here...so maybe need a generic catchall monitor setting??? */ 3497 - memcpy(&fbi->monspecs, &panel->monspecs, sizeof(struct fb_monspecs)); 3498 - 3499 - /* We first try the user mode passed in argument. If that failed, 3500 - * or if no one has been specified, we default to the first mode of the 3501 - * panel list. Note that after this call, var data will be set */ 3502 - if (!fb_find_mode(&fbi->var, 3503 - fbi, 3504 - NULL, /* drv_info.opt_mode, */ 3505 - fbi->monspecs.modedb, 3506 - fbi->monspecs.modedb_len, 3507 - fbi->monspecs.modedb, 3508 - bpp)) { 3509 - 3510 - print_err("Cannot find valid mode for panel %s", panel->name); 3511 - return -EFAULT; 3512 - } 3513 - 3514 - fbi->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL); 3515 - if (!fbi->pseudo_palette) { 3516 - return -ENOMEM; 3517 - } 3518 - memset(fbi->pseudo_palette, 0, sizeof(u32) * 16); 3519 - 3520 - if (fb_alloc_cmap(&fbi->cmap, AU1200_LCD_NBR_PALETTE_ENTRIES, 0) < 0) { 3521 - print_err("Fail to allocate colormap (%d entries)", 3522 - AU1200_LCD_NBR_PALETTE_ENTRIES); 3523 - kfree(fbi->pseudo_palette); 3524 - return -EFAULT; 3525 - } 3526 - 3527 - strncpy(fbi->fix.id, "AU1200", sizeof(fbi->fix.id)); 3528 - fbi->fix.smem_start = fbdev->fb_phys; 3529 - fbi->fix.smem_len = fbdev->fb_len; 3530 - fbi->fix.type = FB_TYPE_PACKED_PIXELS; 3531 - fbi->fix.xpanstep = 0; 3532 - fbi->fix.ypanstep = 0; 3533 - fbi->fix.mmio_start = 0; 3534 - fbi->fix.mmio_len = 0; 3535 - fbi->fix.accel = FB_ACCEL_NONE; 3536 - 3537 - fbi->screen_base = (char __iomem *) fbdev->fb_mem; 3538 - 3539 - au1200fb_update_fbinfo(fbi); 3540 - 3541 - return 0; 3542 - } 3543 - 3544 - /*-------------------------------------------------------------------------*/ 3545 - 3546 - /* AU1200 LCD controller device driver */ 3547 - 3548 - static int au1200fb_drv_probe(struct device *dev) 3549 - { 3550 - struct au1200fb_device *fbdev; 3551 - unsigned long page; 3552 - int bpp, plane, ret; 3553 - 3554 - if (!dev) 3555 - return -EINVAL; 3556 - 3557 - for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) { 3558 - bpp = winbpp(win->w[plane].mode_winctrl1); 3559 - if (win->w[plane].xres == 0) 3560 - win->w[plane].xres = panel->Xres; 3561 - if (win->w[plane].yres == 0) 3562 - win->w[plane].yres = panel->Yres; 3563 - 3564 - fbdev = &_au1200fb_devices[plane]; 3565 - memset(fbdev, 0, sizeof(struct au1200fb_device)); 3566 - fbdev->plane = plane; 3567 - 3568 - /* Allocate the framebuffer to the maximum screen size */ 3569 - fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8; 3570 - 3571 - fbdev->fb_mem = dma_alloc_noncoherent(dev, 3572 - PAGE_ALIGN(fbdev->fb_len), 3573 - &fbdev->fb_phys, GFP_KERNEL); 3574 - if (!fbdev->fb_mem) { 3575 - print_err("fail to allocate frambuffer (size: %dK))", 3576 - fbdev->fb_len / 1024); 3577 - return -ENOMEM; 3578 - } 3579 - 3580 - /* 3581 - * Set page reserved so that mmap will work. This is necessary 3582 - * since we'll be remapping normal memory. 3583 - */ 3584 - for (page = (unsigned long)fbdev->fb_phys; 3585 - page < PAGE_ALIGN((unsigned long)fbdev->fb_phys + 3586 - fbdev->fb_len); 3587 - page += PAGE_SIZE) { 3588 - SetPageReserved(pfn_to_page(page >> PAGE_SHIFT)); /* LCD DMA is NOT coherent on Au1200 */ 3589 - } 3590 - print_dbg("Framebuffer memory map at %p", fbdev->fb_mem); 3591 - print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024); 3592 - 3593 - /* Init FB data */ 3594 - if ((ret = au1200fb_init_fbinfo(fbdev)) < 0) 3595 - goto failed; 3596 - 3597 - /* Register new framebuffer */ 3598 - if ((ret = register_framebuffer(&fbdev->fb_info)) < 0) { 3599 - print_err("cannot register new framebuffer"); 3600 - goto failed; 3601 - } 3602 - 3603 - au1200fb_fb_set_par(&fbdev->fb_info); 3604 - 3605 - #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) 3606 - if (plane == 0) 3607 - if (fb_prepare_logo(&fbdev->fb_info, FB_ROTATE_UR)) { 3608 - /* Start display and show logo on boot */ 3609 - fb_set_cmap(&fbdev->fb_info.cmap, 3610 - &fbdev->fb_info); 3611 - 3612 - fb_show_logo(&fbdev->fb_info, FB_ROTATE_UR); 3613 - } 3614 - #endif 3615 - } 3616 - 3617 - /* Now hook interrupt too */ 3618 - if ((ret = request_irq(AU1200_LCD_INT, au1200fb_handle_irq, 3619 - SA_INTERRUPT | SA_SHIRQ, "lcd", (void *)dev)) < 0) { 3620 - print_err("fail to request interrupt line %d (err: %d)", 3621 - AU1200_LCD_INT, ret); 3622 - goto failed; 3623 - } 3624 - 3625 - return 0; 3626 - 3627 - failed: 3628 - /* NOTE: This only does the current plane/window that failed; others are still active */ 3629 - if (fbdev->fb_mem) 3630 - dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len), 3631 - fbdev->fb_mem, fbdev->fb_phys); 3632 - if (fbdev->fb_info.cmap.len != 0) 3633 - fb_dealloc_cmap(&fbdev->fb_info.cmap); 3634 - if (fbdev->fb_info.pseudo_palette) 3635 - kfree(fbdev->fb_info.pseudo_palette); 3636 - if (plane == 0) 3637 - free_irq(AU1200_LCD_INT, (void*)dev); 3638 - return ret; 3639 - } 3640 - 3641 - static int au1200fb_drv_remove(struct device *dev) 3642 - { 3643 - struct au1200fb_device *fbdev; 3644 - int plane; 3645 - 3646 - if (!dev) 3647 - return -ENODEV; 3648 - 3649 - /* Turn off the panel */ 3650 - au1200_setpanel(NULL); 3651 - 3652 - for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) 3653 - { 3654 - fbdev = &_au1200fb_devices[plane]; 3655 - 3656 - /* Clean up all probe data */ 3657 - unregister_framebuffer(&fbdev->fb_info); 3658 - if (fbdev->fb_mem) 3659 - dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len), 3660 - fbdev->fb_mem, fbdev->fb_phys); 3661 - if (fbdev->fb_info.cmap.len != 0) 3662 - fb_dealloc_cmap(&fbdev->fb_info.cmap); 3663 - if (fbdev->fb_info.pseudo_palette) 3664 - kfree(fbdev->fb_info.pseudo_palette); 3665 - } 3666 - 3667 - free_irq(AU1200_LCD_INT, (void *)dev); 3668 - 3669 - return 0; 3670 - } 3671 - 3672 - #ifdef CONFIG_PM 3673 - static int au1200fb_drv_suspend(struct device *dev, u32 state, u32 level) 3674 - { 3675 - /* TODO */ 3676 - return 0; 3677 - } 3678 - 3679 - static int au1200fb_drv_resume(struct device *dev, u32 level) 3680 - { 3681 - /* TODO */ 3682 - return 0; 3683 - } 3684 - #endif /* CONFIG_PM */ 3685 - 3686 - static struct device_driver au1200fb_driver = { 3687 - .name = "au1200-lcd", 3688 - .bus = &platform_bus_type, 3689 - .probe = au1200fb_drv_probe, 3690 - .remove = au1200fb_drv_remove, 3691 - #ifdef CONFIG_PM 3692 - .suspend = au1200fb_drv_suspend, 3693 - .resume = au1200fb_drv_resume, 3694 - #endif 3695 - }; 3696 - 3697 - /*-------------------------------------------------------------------------*/ 3698 - 3699 - /* Kernel driver */ 3700 - 3701 - static void au1200fb_setup(void) 3702 - { 3703 - char* options = NULL; 3704 - char* this_opt; 3705 - int num_panels = ARRAY_SIZE(known_lcd_panels); 3706 - int panel_idx = -1; 3707 - 3708 - fb_get_options(DRIVER_NAME, &options); 3709 - 3710 - if (options) { 3711 - while ((this_opt = strsep(&options,",")) != NULL) { 3712 - /* Panel option - can be panel name, 3713 - * "bs" for board-switch, or number/index */ 3714 - if (!strncmp(this_opt, "panel:", 6)) { 3715 - int i; 3716 - long int li; 3717 - char *endptr; 3718 - this_opt += 6; 3719 - /* First check for index, which allows 3720 - * to short circuit this mess */ 3721 - li = simple_strtol(this_opt, &endptr, 0); 3722 - if (*endptr == '\0') { 3723 - panel_idx = (int)li; 3724 - } 3725 - else if (strcmp(this_opt, "bs") == 0) { 3726 - extern int board_au1200fb_panel(void); 3727 - panel_idx = board_au1200fb_panel(); 3728 - } 3729 - 3730 - else 3731 - for (i = 0; i < num_panels; i++) { 3732 - if (!strcmp(this_opt, known_lcd_panels[i].name)) { 3733 - panel_idx = i; 3734 - break; 3735 - } 3736 - } 3737 - 3738 - if ((panel_idx < 0) || (panel_idx >= num_panels)) { 3739 - print_warn("Panel %s not supported!", this_opt); 3740 - } 3741 - else 3742 - panel_index = panel_idx; 3743 - } 3744 - 3745 - else if (strncmp(this_opt, "nohwcursor", 10) == 0) { 3746 - nohwcursor = 1; 3747 - } 3748 - 3749 - /* Unsupported option */ 3750 - else { 3751 - print_warn("Unsupported option \"%s\"", this_opt); 3752 - } 3753 - } 3754 - } 3755 - } 3756 - 3757 - #ifdef CONFIG_PM 3758 - static int au1200fb_pm_callback(au1xxx_power_dev_t *dev, 3759 - au1xxx_request_t request, void *data) { 3760 - int retval = -1; 3761 - unsigned int d = 0; 3762 - unsigned int brightness = 0; 3763 - 3764 - if (request == AU1XXX_PM_SLEEP) { 3765 - board_au1200fb_panel_shutdown(); 3766 - } 3767 - else if (request == AU1XXX_PM_WAKEUP) { 3768 - if(dev->prev_state == SLEEP_STATE) 3769 - { 3770 - int plane; 3771 - au1200_setpanel(panel); 3772 - for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) { 3773 - struct au1200fb_device *fbdev; 3774 - fbdev = &_au1200fb_devices[plane]; 3775 - au1200fb_fb_set_par(&fbdev->fb_info); 3776 - } 3777 - } 3778 - 3779 - d = *((unsigned int*)data); 3780 - if(d <=10) brightness = 26; 3781 - else if(d<=20) brightness = 51; 3782 - else if(d<=30) brightness = 77; 3783 - else if(d<=40) brightness = 102; 3784 - else if(d<=50) brightness = 128; 3785 - else if(d<=60) brightness = 153; 3786 - else if(d<=70) brightness = 179; 3787 - else if(d<=80) brightness = 204; 3788 - else if(d<=90) brightness = 230; 3789 - else brightness = 255; 3790 - set_brightness(brightness); 3791 - } else if (request == AU1XXX_PM_GETSTATUS) { 3792 - return dev->cur_state; 3793 - } else if (request == AU1XXX_PM_ACCESS) { 3794 - if (dev->cur_state != SLEEP_STATE) 3795 - return retval; 3796 - else { 3797 - au1200_setpanel(panel); 3798 - } 3799 - } else if (request == AU1XXX_PM_IDLE) { 3800 - } else if (request == AU1XXX_PM_CLEANUP) { 3801 - } 3802 - 3803 - return retval; 3804 - } 3805 - #endif 3806 - 3807 - static int __init au1200fb_init(void) 3808 - { 3809 - print_info("" DRIVER_DESC ""); 3810 - 3811 - /* Setup driver with options */ 3812 - au1200fb_setup(); 3813 - 3814 - /* Point to the panel selected */ 3815 - panel = &known_lcd_panels[panel_index]; 3816 - win = &windows[window_index]; 3817 - 3818 - printk(DRIVER_NAME ": Panel %d %s\n", panel_index, panel->name); 3819 - printk(DRIVER_NAME ": Win %d %s\n", window_index, win->name); 3820 - 3821 - /* Kickstart the panel, the framebuffers/windows come soon enough */ 3822 - au1200_setpanel(panel); 3823 - 3824 - #ifdef CONFIG_PM 3825 - LCD_pm_dev = new_au1xxx_power_device("LCD", &au1200fb_pm_callback, NULL); 3826 - if ( LCD_pm_dev == NULL) 3827 - printk(KERN_INFO "Unable to create a power management device entry for the au1200fb.\n"); 3828 - else 3829 - printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n"); 3830 - #endif 3831 - 3832 - return driver_register(&au1200fb_driver); 3833 - } 3834 - 3835 - static void __exit au1200fb_cleanup(void) 3836 - { 3837 - driver_unregister(&au1200fb_driver); 3838 - } 3839 - 3840 - module_init(au1200fb_init); 3841 - module_exit(au1200fb_cleanup); 3842 - 3843 - MODULE_DESCRIPTION(DRIVER_DESC); 3844 - MODULE_LICENSE("GPL");
+1 -1
fs/stat.c
··· 261 261 return error; 262 262 } 263 263 264 - #ifndef __ARCH_WANT_STAT64 264 + #if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT) 265 265 asmlinkage long sys_newfstatat(int dfd, char __user *filename, 266 266 struct stat __user *statbuf, int flag) 267 267 {
+2 -2
include/asm-i386/i387.h
··· 58 58 alternative_input( 59 59 "fnsave %[fx] ;fwait;" GENERIC_NOP8 GENERIC_NOP4, 60 60 "fxsave %[fx]\n" 61 - "bt $7,%[fsw] ; jc 1f ; fnclex\n1:", 61 + "bt $7,%[fsw] ; jnc 1f ; fnclex\n1:", 62 62 X86_FEATURE_FXSR, 63 63 [fx] "m" (tsk->thread.i387.fxsave), 64 64 [fsw] "m" (tsk->thread.i387.fxsave.swd) : "memory"); 65 65 /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception 66 66 is pending. Clear the x87 state here by setting it to fixed 67 - values. __per_cpu_offset[0] is a random variable that should be in L1 */ 67 + values. safe_address is a random variable that should be in L1 */ 68 68 alternative_input( 69 69 GENERIC_NOP8 GENERIC_NOP2, 70 70 "emms\n\t" /* clear stack tags */
+10 -4
include/asm-powerpc/cputable.h
··· 22 22 #define PPC_FEATURE_BOOKE 0x00008000 23 23 #define PPC_FEATURE_SMT 0x00004000 24 24 #define PPC_FEATURE_ICACHE_SNOOP 0x00002000 25 + #define PPC_FEATURE_ARCH_2_05 0x00001000 25 26 26 27 #ifdef __KERNEL__ 27 28 #ifndef __ASSEMBLY__ ··· 321 320 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 322 321 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 323 322 CPU_FTR_MMCRA_SIHV | CPU_FTR_PURR) 323 + #define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 324 + CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 325 + CPU_FTR_MMCRA | CPU_FTR_SMT | \ 326 + CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 327 + CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE) 324 328 #define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 325 329 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 326 330 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ ··· 337 331 #ifdef __powerpc64__ 338 332 #define CPU_FTRS_POSSIBLE \ 339 333 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ 340 - CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL | \ 341 - CPU_FTR_CI_LARGE_PAGE) 334 + CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \ 335 + CPU_FTRS_CELL | CPU_FTR_CI_LARGE_PAGE) 342 336 #else 343 337 enum { 344 338 CPU_FTRS_POSSIBLE = ··· 382 376 #ifdef __powerpc64__ 383 377 #define CPU_FTRS_ALWAYS \ 384 378 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \ 385 - CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_CELL & \ 386 - CPU_FTRS_POSSIBLE) 379 + CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \ 380 + CPU_FTRS_CELL & CPU_FTRS_POSSIBLE) 387 381 #else 388 382 enum { 389 383 CPU_FTRS_ALWAYS =
+3 -3
include/asm-powerpc/io.h
··· 9 9 * 2 of the License, or (at your option) any later version. 10 10 */ 11 11 12 + /* Check of existence of legacy devices */ 13 + extern int check_legacy_ioport(unsigned long base_port); 14 + 12 15 #ifndef CONFIG_PPC64 13 16 #include <asm-ppc/io.h> 14 17 #else ··· 439 436 #define dma_cache_inv(_start,_size) do { } while (0) 440 437 #define dma_cache_wback(_start,_size) do { } while (0) 441 438 #define dma_cache_wback_inv(_start,_size) do { } while (0) 442 - 443 - /* Check of existence of legacy devices */ 444 - extern int check_legacy_ioport(unsigned long base_port); 445 439 446 440 447 441 /*
+1
include/asm-powerpc/page_64.h
··· 101 101 - (1U << GET_HTLB_AREA(addr))) & 0xffff) 102 102 103 103 #define ARCH_HAS_HUGEPAGE_ONLY_RANGE 104 + #define ARCH_HAS_HUGETLB_FREE_PGD_RANGE 104 105 #define ARCH_HAS_PREPARE_HUGEPAGE_RANGE 105 106 #define ARCH_HAS_SETCLEAR_HUGE_PTE 106 107
+2
include/asm-powerpc/pgalloc.h
··· 17 17 #define PTE_CACHE_NUM 0 18 18 #define PMD_CACHE_NUM 1 19 19 #define PGD_CACHE_NUM 2 20 + #define HUGEPTE_CACHE_NUM 3 20 21 #else 21 22 #define PTE_CACHE_NUM 0 22 23 #define PMD_CACHE_NUM 1 23 24 #define PUD_CACHE_NUM 1 24 25 #define PGD_CACHE_NUM 0 26 + #define HUGEPTE_CACHE_NUM 2 25 27 #endif 26 28 27 29 /*
+19 -1
include/asm-powerpc/unistd.h
··· 304 304 #define __NR_splice 283 305 305 #define __NR_tee 284 306 306 #define __NR_vmsplice 285 307 + #define __NR_openat 286 308 + #define __NR_mkdirat 287 309 + #define __NR_mknodat 288 310 + #define __NR_fchownat 289 311 + #define __NR_futimesat 290 312 + #ifdef __powerpc64__ 313 + #define __NR_newfstatat 291 314 + #else 315 + #define __NR_fstatat64 291 316 + #endif 317 + #define __NR_unlinkat 292 318 + #define __NR_renameat 293 319 + #define __NR_linkat 294 320 + #define __NR_symlinkat 295 321 + #define __NR_readlinkat 296 322 + #define __NR_fchmodat 297 323 + #define __NR_faccessat 298 307 324 308 325 #ifdef __KERNEL__ 309 326 310 - #define __NR_syscalls 286 327 + #define __NR_syscalls 299 311 328 312 329 #define __NR__exit __NR_exit 313 330 #define NR_syscalls __NR_syscalls ··· 473 456 #ifdef CONFIG_PPC64 474 457 #define __ARCH_WANT_COMPAT_SYS_TIME 475 458 #define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND 459 + #define __ARCH_WANT_SYS_NEWFSTATAT 476 460 #endif 477 461 478 462 /*
+2
include/asm-ppc/ppc_sys.h
··· 39 39 #error "need definition of ppc_sys_devices" 40 40 #endif 41 41 42 + #define PPC_SYS_IORESOURCE_FIXUPPED 0x00000001 43 + 42 44 struct ppc_sys_spec { 43 45 /* PPC sys is matched via (ID & mask) == value, id could be 44 46 * PVR, SVR, IMMR, * etc. */
+1
include/asm-ppc/reg_booke.h
··· 237 237 #endif 238 238 239 239 /* Bit definitions for CCR1. */ 240 + #define CCR1_DPC 0x00000100 /* Disable L1 I-Cache/D-Cache parity checking */ 240 241 #define CCR1_TCS 0x00000080 /* Timer Clock Select */ 241 242 242 243 /* Bit definitions for the MCSR. */
+1 -1
sound/ppc/toonie.c
··· 335 335 chip->mixer_data = NULL; 336 336 } 337 337 338 - int snd_pmac_toonie_init(struct snd_pmac *chip) 338 + int __init snd_pmac_toonie_init(struct snd_pmac *chip) 339 339 { 340 340 struct pmac_toonie *mix; 341 341