···99CONFIG_MMU=y1010CONFIG_GENERIC_HARDIRQS=y1111CONFIG_RWSEM_XCHGADD_ALGORITHM=y1212+CONFIG_GENERIC_HWEIGHT=y1213CONFIG_GENERIC_CALIBRATE_DELAY=y1314CONFIG_PPC=y1415CONFIG_EARLY_PRINTK=y···5655CONFIG_IKCONFIG=y5756CONFIG_IKCONFIG_PROC=y5857# CONFIG_CPUSETS is not set5858+# CONFIG_RELAY is not set5959CONFIG_INITRAMFS_SOURCE=""6060CONFIG_CC_OPTIMIZE_FOR_SIZE=y6161# CONFIG_EMBEDDED is not set···7169CONFIG_FUTEX=y7270CONFIG_EPOLL=y7371CONFIG_SHMEM=y7474-CONFIG_CC_ALIGN_FUNCTIONS=07575-CONFIG_CC_ALIGN_LABELS=07676-CONFIG_CC_ALIGN_LOOPS=07777-CONFIG_CC_ALIGN_JUMPS=07872CONFIG_SLAB=y7973# CONFIG_TINY_SHMEM is not set8074CONFIG_BASE_SMALL=0···8284CONFIG_MODULES=y8385CONFIG_MODULE_UNLOAD=y8486# CONFIG_MODULE_FORCE_UNLOAD is not set8585-CONFIG_OBSOLETE_MODPARM=y8687# CONFIG_MODVERSIONS is not set8788# CONFIG_MODULE_SRCVERSION_ALL is not set8889CONFIG_KMOD=y···9093#9194# Block layer9295#9696+# CONFIG_BLK_DEV_IO_TRACE is not set93979498#9599# IO Schedulers···124126CONFIG_MMIO_NVRAM=y125127CONFIG_CELL_IIC=y126128# CONFIG_PPC_MPC106 is not set129129+# CONFIG_PPC_970_NAP is not set127130# CONFIG_CPU_FREQ is not set128131# CONFIG_WANT_EARLY_SERIAL is not set129132···166167CONFIG_SPARSEMEM_EXTREME=y167168# CONFIG_MEMORY_HOTPLUG is not set168169CONFIG_SPLIT_PTLOCK_CPUS=4169169-CONFIG_MIGRATION=y170170# CONFIG_PPC_64K_PAGES is not set171171CONFIG_SCHED_SMT=y172172CONFIG_PROC_DEVICETREE=y···182184# CONFIG_PPC_INDIRECT_PCI is not set183185CONFIG_PCI=y184186CONFIG_PCI_DOMAINS=y185185-CONFIG_PCI_LEGACY_PROC=y186187# CONFIG_PCI_DEBUG is not set187188188189#···223226# CONFIG_INET_AH is not set224227# CONFIG_INET_ESP is not set225228# CONFIG_INET_IPCOMP is not set229229+# CONFIG_INET_XFRM_TUNNEL is not set226230CONFIG_INET_TUNNEL=y227231CONFIG_INET_DIAG=y228232CONFIG_INET_TCP_DIAG=y···240242CONFIG_INET6_AH=m241243CONFIG_INET6_ESP=m242244CONFIG_INET6_IPCOMP=m245245+CONFIG_INET6_XFRM_TUNNEL=m243246CONFIG_INET6_TUNNEL=m244247CONFIG_IPV6_TUNNEL=m245248CONFIG_NETFILTER=y···631632#632633CONFIG_SERIAL_8250=y633634CONFIG_SERIAL_8250_CONSOLE=y635635+CONFIG_SERIAL_8250_PCI=y634636CONFIG_SERIAL_8250_NR_UARTS=4635637CONFIG_SERIAL_8250_RUNTIME_UARTS=4636638# CONFIG_SERIAL_8250_EXTENDED is not set···717717# CONFIG_I2C_PARPORT_LIGHT is not set718718# CONFIG_I2C_PROSAVAGE is not set719719# CONFIG_I2C_SAVAGE4 is not set720720-# CONFIG_SCx200_ACB is not set721720# CONFIG_I2C_SIS5595 is not set722721# CONFIG_I2C_SIS630 is not set723722# CONFIG_I2C_SIS96X is not set···735736# CONFIG_SENSORS_PCF8574 is not set736737# CONFIG_SENSORS_PCA9539 is not set737738# CONFIG_SENSORS_PCF8591 is not set738738-# CONFIG_SENSORS_RTC8564 is not set739739# CONFIG_SENSORS_MAX6875 is not set740740-# CONFIG_RTC_X1205_I2C is not set741740# CONFIG_I2C_DEBUG_CORE is not set742741# CONFIG_I2C_DEBUG_ALGO is not set743742# CONFIG_I2C_DEBUG_BUS is not set···760763761764#762765# Misc devices763763-#764764-765765-#766766-# Multimedia Capabilities Port drivers767766#768767769768#···811818# CONFIG_MMC is not set812819813820#821821+# LED devices822822+#823823+# CONFIG_NEW_LEDS is not set824824+825825+#826826+# LED drivers827827+#828828+829829+#830830+# LED Triggers831831+#832832+833833+#814834# InfiniBand support815835#816836CONFIG_INFINIBAND=y···838832#839833# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)840834#835835+836836+#837837+# Real Time Clock838838+#839839+# CONFIG_RTC_CLASS is not set841840842841#843842# File systems···900889CONFIG_HUGETLBFS=y901890CONFIG_HUGETLB_PAGE=y902891CONFIG_RAMFS=y903903-# CONFIG_RELAYFS_FS is not set904892# CONFIG_CONFIGFS_FS is not set905893906894#
···191191 (void *)hdr192192 + sechdrs[sechdrs[i].sh_link].sh_offset);193193 }194194- if (!me->arch.stubs_section || !me->arch.toc_section) {195195- printk("%s: doesn't contain .toc or .stubs.\n", me->name);194194+195195+ if (!me->arch.stubs_section) {196196+ printk("%s: doesn't contain .stubs.\n", me->name);196197 return -ENOEXEC;197198 }199199+200200+ /* If we don't have a .toc, just use .stubs. We need to set r2201201+ to some reasonable value in case the module calls out to202202+ other functions via a stub, or if a function pointer escapes203203+ the module by some means. */204204+ if (!me->arch.toc_section)205205+ me->arch.toc_section = me->arch.stubs_section;198206199207 /* Override the stubs size */200208 sechdrs[me->arch.stubs_section].sh_size = get_stubs_size(hdr, sechdrs);···350342 break;351343352344 case R_PPC64_TOC16:353353- /* Subtact TOC pointer */345345+ /* Subtract TOC pointer */354346 value -= my_r2(sechdrs, me);355347 if (value + 0x8000 > 0xffff) {356348 printk("%s: bad TOC16 relocation (%lu)\n",···363355 break;364356365357 case R_PPC64_TOC16_DS:366366- /* Subtact TOC pointer */358358+ /* Subtract TOC pointer */367359 value -= my_r2(sechdrs, me);368360 if ((value & 3) != 0 || value + 0x8000 > 0xffff) {369361 printk("%s: bad TOC16_DS relocation (%lu)\n",
+108-4
arch/powerpc/kernel/prom_init.c
···636636637637#ifdef CONFIG_PPC_PSERIES638638/*639639- * To tell the firmware what our capabilities are, we have to pass640640- * it a fake 32-bit ELF header containing a couple of PT_NOTE sections641641- * that contain structures that contain the actual values.639639+ * There are two methods for telling firmware what our capabilities are.640640+ * Newer machines have an "ibm,client-architecture-support" method on the641641+ * root node. For older machines, we have to call the "process-elf-header"642642+ * method in the /packages/elf-loader node, passing it a fake 32-bit643643+ * ELF header containing a couple of PT_NOTE sections that contain644644+ * structures that contain various information.642645 */646646+647647+/*648648+ * New method - extensible architecture description vector.649649+ *650650+ * Because the description vector contains a mix of byte and word651651+ * values, we declare it as an unsigned char array, and use this652652+ * macro to put word values in.653653+ */654654+#define W(x) ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \655655+ ((x) >> 8) & 0xff, (x) & 0xff656656+657657+/* Option vector bits - generic bits in byte 1 */658658+#define OV_IGNORE 0x80 /* ignore this vector */659659+#define OV_CESSATION_POLICY 0x40 /* halt if unsupported option present*/660660+661661+/* Option vector 1: processor architectures supported */662662+#define OV1_PPC_2_00 0x80 /* set if we support PowerPC 2.00 */663663+#define OV1_PPC_2_01 0x40 /* set if we support PowerPC 2.01 */664664+#define OV1_PPC_2_02 0x20 /* set if we support PowerPC 2.02 */665665+#define OV1_PPC_2_03 0x10 /* set if we support PowerPC 2.03 */666666+#define OV1_PPC_2_04 0x08 /* set if we support PowerPC 2.04 */667667+#define OV1_PPC_2_05 0x04 /* set if we support PowerPC 2.05 */668668+669669+/* Option vector 2: Open Firmware options supported */670670+#define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */671671+672672+/* Option vector 3: processor options supported */673673+#define OV3_FP 0x80 /* floating point */674674+#define OV3_VMX 0x40 /* VMX/Altivec */675675+676676+/* Option vector 5: PAPR/OF options supported */677677+#define OV5_LPAR 0x80 /* logical partitioning supported */678678+#define OV5_SPLPAR 0x40 /* shared-processor LPAR supported */679679+/* ibm,dynamic-reconfiguration-memory property supported */680680+#define OV5_DRCONF_MEMORY 0x20681681+#define OV5_LARGE_PAGES 0x10 /* large pages supported */682682+683683+/*684684+ * The architecture vector has an array of PVR mask/value pairs,685685+ * followed by # option vectors - 1, followed by the option vectors.686686+ */687687+static unsigned char ibm_architecture_vec[] = {688688+ W(0xfffe0000), W(0x003a0000), /* POWER5/POWER5+ */689689+ W(0xffff0000), W(0x003e0000), /* POWER6 */690690+ W(0xfffffffe), W(0x0f000001), /* all 2.04-compliant and earlier */691691+ 5 - 1, /* 5 option vectors */692692+693693+ /* option vector 1: processor architectures supported */694694+ 3 - 1, /* length */695695+ 0, /* don't ignore, don't halt */696696+ OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 |697697+ OV1_PPC_2_04 | OV1_PPC_2_05,698698+699699+ /* option vector 2: Open Firmware options supported */700700+ 34 - 1, /* length */701701+ OV2_REAL_MODE,702702+ 0, 0,703703+ W(0xffffffff), /* real_base */704704+ W(0xffffffff), /* real_size */705705+ W(0xffffffff), /* virt_base */706706+ W(0xffffffff), /* virt_size */707707+ W(0xffffffff), /* load_base */708708+ W(64), /* 128MB min RMA */709709+ W(0xffffffff), /* full client load */710710+ 0, /* min RMA percentage of total RAM */711711+ 48, /* max log_2(hash table size) */712712+713713+ /* option vector 3: processor options supported */714714+ 3 - 1, /* length */715715+ 0, /* don't ignore, don't halt */716716+ OV3_FP | OV3_VMX,717717+718718+ /* option vector 4: IBM PAPR implementation */719719+ 2 - 1, /* length */720720+ 0, /* don't halt */721721+722722+ /* option vector 5: PAPR/OF options */723723+ 3 - 1, /* length */724724+ 0, /* don't ignore, don't halt */725725+ OV5_LPAR | OV5_SPLPAR | OV5_LARGE_PAGES,726726+};727727+728728+/* Old method - ELF header with PT_NOTE sections */643729static struct fake_elf {644730 Elf32_Ehdr elfhdr;645731 Elf32_Phdr phdr[2];···814728815729static void __init prom_send_capabilities(void)816730{817817- ihandle elfloader;731731+ ihandle elfloader, root;732732+ prom_arg_t ret;818733734734+ root = call_prom("open", 1, 1, ADDR("/"));735735+ if (root != 0) {736736+ /* try calling the ibm,client-architecture-support method */737737+ if (call_prom_ret("call-method", 3, 2, &ret,738738+ ADDR("ibm,client-architecture-support"),739739+ ADDR(ibm_architecture_vec)) == 0) {740740+ /* the call exists... */741741+ if (ret)742742+ prom_printf("WARNING: ibm,client-architecture"743743+ "-support call FAILED!\n");744744+ call_prom("close", 1, 0, root);745745+ return;746746+ }747747+ call_prom("close", 1, 0, root);748748+ }749749+750750+ /* no ibm,client-architecture-support call, try the old way */819751 elfloader = call_prom("open", 1, 1, ADDR("/packages/elf-loader"));820752 if (elfloader == 0) {821753 prom_printf("couldn't open /packages/elf-loader\n");
+8
arch/powerpc/kernel/setup-common.c
···516516517517 printk(KERN_INFO "Using %s machine description\n", ppc_md.name);518518}519519+520520+int check_legacy_ioport(unsigned long base_port)521521+{522522+ if (ppc_md.check_legacy_ioport == NULL)523523+ return 0;524524+ return ppc_md.check_legacy_ioport(base_port);525525+}526526+EXPORT_SYMBOL(check_legacy_ioport);
-8
arch/powerpc/kernel/setup_64.c
···594594 printk("[terminate]%04x %s\n", src, msg);595595}596596597597-int check_legacy_ioport(unsigned long base_port)598598-{599599- if (ppc_md.check_legacy_ioport == NULL)600600- return 0;601601- return ppc_md.check_legacy_ioport(base_port);602602-}603603-EXPORT_SYMBOL(check_legacy_ioport);604604-605597void cpu_die(void)606598{607599 if (ppc_md.cpu_die)
+13
arch/powerpc/kernel/systbl.S
···325325SYSCALL(splice)326326SYSCALL(tee)327327SYSCALL(vmsplice)328328+COMPAT_SYS(openat)329329+SYSCALL(mkdirat)330330+SYSCALL(mknodat)331331+SYSCALL(fchownat)332332+COMPAT_SYS(futimesat)333333+SYSX(sys_newfstatat, sys_fstatat64, sys_fstatat64)334334+SYSCALL(unlinkat)335335+SYSCALL(renameat)336336+SYSCALL(linkat)337337+SYSCALL(symlinkat)338338+SYSCALL(readlinkat)339339+SYSCALL(fchmodat)340340+SYSCALL(faccessat)328341329342/*330343 * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c
+260-37
arch/powerpc/mm/hugetlbpage.c
···3030#define NUM_LOW_AREAS (0x100000000UL >> SID_SHIFT)3131#define NUM_HIGH_AREAS (PGTABLE_RANGE >> HTLB_AREA_SHIFT)32323333+#ifdef CONFIG_PPC_64K_PAGES3434+#define HUGEPTE_INDEX_SIZE (PMD_SHIFT-HPAGE_SHIFT)3535+#else3636+#define HUGEPTE_INDEX_SIZE (PUD_SHIFT-HPAGE_SHIFT)3737+#endif3838+#define PTRS_PER_HUGEPTE (1 << HUGEPTE_INDEX_SIZE)3939+#define HUGEPTE_TABLE_SIZE (sizeof(pte_t) << HUGEPTE_INDEX_SIZE)4040+4141+#define HUGEPD_SHIFT (HPAGE_SHIFT + HUGEPTE_INDEX_SIZE)4242+#define HUGEPD_SIZE (1UL << HUGEPD_SHIFT)4343+#define HUGEPD_MASK (~(HUGEPD_SIZE-1))4444+4545+#define huge_pgtable_cache (pgtable_cache[HUGEPTE_CACHE_NUM])4646+4747+/* Flag to mark huge PD pointers. This means pmd_bad() and pud_bad()4848+ * will choke on pointers to hugepte tables, which is handy for4949+ * catching screwups early. */5050+#define HUGEPD_OK 0x15151+5252+typedef struct { unsigned long pd; } hugepd_t;5353+5454+#define hugepd_none(hpd) ((hpd).pd == 0)5555+5656+static inline pte_t *hugepd_page(hugepd_t hpd)5757+{5858+ BUG_ON(!(hpd.pd & HUGEPD_OK));5959+ return (pte_t *)(hpd.pd & ~HUGEPD_OK);6060+}6161+6262+static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr)6363+{6464+ unsigned long idx = ((addr >> HPAGE_SHIFT) & (PTRS_PER_HUGEPTE-1));6565+ pte_t *dir = hugepd_page(*hpdp);6666+6767+ return dir + idx;6868+}6969+7070+static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,7171+ unsigned long address)7272+{7373+ pte_t *new = kmem_cache_alloc(huge_pgtable_cache,7474+ GFP_KERNEL|__GFP_REPEAT);7575+7676+ if (! new)7777+ return -ENOMEM;7878+7979+ spin_lock(&mm->page_table_lock);8080+ if (!hugepd_none(*hpdp))8181+ kmem_cache_free(huge_pgtable_cache, new);8282+ else8383+ hpdp->pd = (unsigned long)new | HUGEPD_OK;8484+ spin_unlock(&mm->page_table_lock);8585+ return 0;8686+}8787+3388/* Modelled after find_linux_pte() */3489pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)3590{3691 pgd_t *pg;3792 pud_t *pu;3838- pmd_t *pm;3939- pte_t *pt;40934194 BUG_ON(! in_hugepage_area(mm->context, addr));4295···9946 if (!pgd_none(*pg)) {10047 pu = pud_offset(pg, addr);10148 if (!pud_none(*pu)) {102102- pm = pmd_offset(pu, addr);10349#ifdef CONFIG_PPC_64K_PAGES104104- /* Currently, we use the normal PTE offset within full105105- * size PTE pages, thus our huge PTEs are scattered in106106- * the PTE page and we do waste some. We may change107107- * that in the future, but the current mecanism keeps108108- * things much simpler109109- */110110- if (!pmd_none(*pm)) {111111- /* Note: pte_offset_* are all equivalent on112112- * ppc64 as we don't have HIGHMEM113113- */114114- pt = pte_offset_kernel(pm, addr);115115- return pt;116116- }117117-#else /* CONFIG_PPC_64K_PAGES */118118- /* On 4k pages, we put huge PTEs in the PMD page */119119- pt = (pte_t *)pm;120120- return pt;121121-#endif /* CONFIG_PPC_64K_PAGES */5050+ pmd_t *pm;5151+ pm = pmd_offset(pu, addr);5252+ if (!pmd_none(*pm))5353+ return hugepte_offset((hugepd_t *)pm, addr);5454+#else5555+ return hugepte_offset((hugepd_t *)pu, addr);5656+#endif12257 }12358 }12459···11776{11877 pgd_t *pg;11978 pud_t *pu;120120- pmd_t *pm;121121- pte_t *pt;7979+ hugepd_t *hpdp = NULL;1228012381 BUG_ON(! in_hugepage_area(mm->context, addr));12482···12787 pu = pud_alloc(mm, pg, addr);1288812989 if (pu) {130130- pm = pmd_alloc(mm, pu, addr);131131- if (pm) {13290#ifdef CONFIG_PPC_64K_PAGES133133- /* See comment in huge_pte_offset. Note that if we ever134134- * want to put the page size in the PMD, we would have135135- * to open code our own pte_alloc* function in order136136- * to populate and set the size atomically137137- */138138- pt = pte_alloc_map(mm, pm, addr);139139-#else /* CONFIG_PPC_64K_PAGES */140140- pt = (pte_t *)pm;141141-#endif /* CONFIG_PPC_64K_PAGES */142142- return pt;143143- }9191+ pmd_t *pm;9292+ pm = pmd_alloc(mm, pu, addr);9393+ if (pm)9494+ hpdp = (hugepd_t *)pm;9595+#else9696+ hpdp = (hugepd_t *)pu;9797+#endif14498 }14599146146- return NULL;100100+ if (! hpdp)101101+ return NULL;102102+103103+ if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr))104104+ return NULL;105105+106106+ return hugepte_offset(hpdp, addr);107107+}108108+109109+static void free_hugepte_range(struct mmu_gather *tlb, hugepd_t *hpdp)110110+{111111+ pte_t *hugepte = hugepd_page(*hpdp);112112+113113+ hpdp->pd = 0;114114+ tlb->need_flush = 1;115115+ pgtable_free_tlb(tlb, pgtable_free_cache(hugepte, HUGEPTE_CACHE_NUM,116116+ HUGEPTE_TABLE_SIZE-1));117117+}118118+119119+#ifdef CONFIG_PPC_64K_PAGES120120+static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,121121+ unsigned long addr, unsigned long end,122122+ unsigned long floor, unsigned long ceiling)123123+{124124+ pmd_t *pmd;125125+ unsigned long next;126126+ unsigned long start;127127+128128+ start = addr;129129+ pmd = pmd_offset(pud, addr);130130+ do {131131+ next = pmd_addr_end(addr, end);132132+ if (pmd_none(*pmd))133133+ continue;134134+ free_hugepte_range(tlb, (hugepd_t *)pmd);135135+ } while (pmd++, addr = next, addr != end);136136+137137+ start &= PUD_MASK;138138+ if (start < floor)139139+ return;140140+ if (ceiling) {141141+ ceiling &= PUD_MASK;142142+ if (!ceiling)143143+ return;144144+ }145145+ if (end - 1 > ceiling - 1)146146+ return;147147+148148+ pmd = pmd_offset(pud, start);149149+ pud_clear(pud);150150+ pmd_free_tlb(tlb, pmd);151151+}152152+#endif153153+154154+static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,155155+ unsigned long addr, unsigned long end,156156+ unsigned long floor, unsigned long ceiling)157157+{158158+ pud_t *pud;159159+ unsigned long next;160160+ unsigned long start;161161+162162+ start = addr;163163+ pud = pud_offset(pgd, addr);164164+ do {165165+ next = pud_addr_end(addr, end);166166+#ifdef CONFIG_PPC_64K_PAGES167167+ if (pud_none_or_clear_bad(pud))168168+ continue;169169+ hugetlb_free_pmd_range(tlb, pud, addr, next, floor, ceiling);170170+#else171171+ if (pud_none(*pud))172172+ continue;173173+ free_hugepte_range(tlb, (hugepd_t *)pud);174174+#endif175175+ } while (pud++, addr = next, addr != end);176176+177177+ start &= PGDIR_MASK;178178+ if (start < floor)179179+ return;180180+ if (ceiling) {181181+ ceiling &= PGDIR_MASK;182182+ if (!ceiling)183183+ return;184184+ }185185+ if (end - 1 > ceiling - 1)186186+ return;187187+188188+ pud = pud_offset(pgd, start);189189+ pgd_clear(pgd);190190+ pud_free_tlb(tlb, pud);191191+}192192+193193+/*194194+ * This function frees user-level page tables of a process.195195+ *196196+ * Must be called with pagetable lock held.197197+ */198198+void hugetlb_free_pgd_range(struct mmu_gather **tlb,199199+ unsigned long addr, unsigned long end,200200+ unsigned long floor, unsigned long ceiling)201201+{202202+ pgd_t *pgd;203203+ unsigned long next;204204+ unsigned long start;205205+206206+ /*207207+ * Comments below take from the normal free_pgd_range(). They208208+ * apply here too. The tests against HUGEPD_MASK below are209209+ * essential, because we *don't* test for this at the bottom210210+ * level. Without them we'll attempt to free a hugepte table211211+ * when we unmap just part of it, even if there are other212212+ * active mappings using it.213213+ *214214+ * The next few lines have given us lots of grief...215215+ *216216+ * Why are we testing HUGEPD* at this top level? Because217217+ * often there will be no work to do at all, and we'd prefer218218+ * not to go all the way down to the bottom just to discover219219+ * that.220220+ *221221+ * Why all these "- 1"s? Because 0 represents both the bottom222222+ * of the address space and the top of it (using -1 for the223223+ * top wouldn't help much: the masks would do the wrong thing).224224+ * The rule is that addr 0 and floor 0 refer to the bottom of225225+ * the address space, but end 0 and ceiling 0 refer to the top226226+ * Comparisons need to use "end - 1" and "ceiling - 1" (though227227+ * that end 0 case should be mythical).228228+ *229229+ * Wherever addr is brought up or ceiling brought down, we230230+ * must be careful to reject "the opposite 0" before it231231+ * confuses the subsequent tests. But what about where end is232232+ * brought down by HUGEPD_SIZE below? no, end can't go down to233233+ * 0 there.234234+ *235235+ * Whereas we round start (addr) and ceiling down, by different236236+ * masks at different levels, in order to test whether a table237237+ * now has no other vmas using it, so can be freed, we don't238238+ * bother to round floor or end up - the tests don't need that.239239+ */240240+241241+ addr &= HUGEPD_MASK;242242+ if (addr < floor) {243243+ addr += HUGEPD_SIZE;244244+ if (!addr)245245+ return;246246+ }247247+ if (ceiling) {248248+ ceiling &= HUGEPD_MASK;249249+ if (!ceiling)250250+ return;251251+ }252252+ if (end - 1 > ceiling - 1)253253+ end -= HUGEPD_SIZE;254254+ if (addr > end - 1)255255+ return;256256+257257+ start = addr;258258+ pgd = pgd_offset((*tlb)->mm, addr);259259+ do {260260+ BUG_ON(! in_hugepage_area((*tlb)->mm->context, addr));261261+ next = pgd_addr_end(addr, end);262262+ if (pgd_none_or_clear_bad(pgd))263263+ continue;264264+ hugetlb_free_pud_range(*tlb, pgd, addr, next, floor, ceiling);265265+ } while (pgd++, addr = next, addr != end);147266}148267149268void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,···1040841 out:1041842 return err;1042843}844844+845845+static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags)846846+{847847+ memset(addr, 0, kmem_cache_size(cache));848848+}849849+850850+static int __init hugetlbpage_init(void)851851+{852852+ if (!cpu_has_feature(CPU_FTR_16M_PAGE))853853+ return -ENODEV;854854+855855+ huge_pgtable_cache = kmem_cache_create("hugepte_cache",856856+ HUGEPTE_TABLE_SIZE,857857+ HUGEPTE_TABLE_SIZE,858858+ SLAB_HWCACHE_ALIGN |859859+ SLAB_MUST_HWCACHE_ALIGN,860860+ zero_ctor, NULL);861861+ if (! huge_pgtable_cache)862862+ panic("hugetlbpage_init(): could not create hugepte cache\n");863863+864864+ return 0;865865+}866866+867867+module_init(hugetlbpage_init);
+7
arch/powerpc/mm/init_64.c
···162162};163163#endif /* CONFIG_PPC_64K_PAGES */164164165165+#ifdef CONFIG_HUGETLB_PAGE166166+/* Hugepages need one extra cache, initialized in hugetlbpage.c. We167167+ * can't put into the tables above, because HPAGE_SHIFT is not compile168168+ * time constant. */169169+kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)+1];170170+#else165171kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)];172172+#endif166173167174void pgtable_cache_init(void)168175{
···22 * PPC440GX system library33 *44 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>55- * Copyright (c) 2003, 2004 Zultys Technologies55+ * Copyright (c) 2003 - 2006 Zultys Technologies66 *77 * This program is free software; you can redistribute it and/or modify it88 * under the terms of the GNU General Public License as published by the···282282 return 0;283283}284284285285+void __init ibm440gx_platform_init(unsigned long r3, unsigned long r4,286286+ unsigned long r5, unsigned long r6,287287+ unsigned long r7)288288+{289289+ /* Erratum 440_43 workaround, disable L1 cache parity checking */290290+ if (!strcmp(cur_cpu_spec->cpu_name, "440GX Rev. C") ||291291+ !strcmp(cur_cpu_spec->cpu_name, "440GX Rev. F"))292292+ mtspr(SPRN_CCR1, mfspr(SPRN_CCR1) | CCR1_DPC);293293+294294+ ibm44x_platform_init(r3, r4, r5, r6, r7);295295+}
+4
arch/ppc/syslib/ibm440gx_common.h
···2929void ibm440gx_get_clocks(struct ibm44x_clocks*, unsigned int sys_clk,3030 unsigned int ser_clk) __init;31313232+/* common 440GX platform init */3333+void ibm440gx_platform_init(unsigned long r3, unsigned long r4, unsigned long r5,3434+ unsigned long r6, unsigned long r7) __init;3535+3236/* Enable L2 cache */3337void ibm440gx_l2c_enable(void) __init;3438
···6767 * On some platforms touching the i8042 data register region can do really6868 * bad things. Because of this the region is always reserved on such boxes.6969 */7070-#if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC64)7070+#if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC_MERGE)7171 if (!request_region(I8042_DATA_REG, 16, "i8042"))7272 return -EBUSY;7373#endif74747575 i8042_reset = 1;76767777-#if defined(CONFIG_PPC64)7777+#if defined(CONFIG_PPC_MERGE)7878 if (check_legacy_ioport(I8042_DATA_REG))7979 return -EBUSY;8080 if (!request_region(I8042_DATA_REG, 16, "i8042"))
+3-1
drivers/scsi/Kconfig
···446446447447config SCSI_ADVANSYS448448 tristate "AdvanSys SCSI support"449449- depends on (ISA || EISA || PCI) && SCSI && BROKEN449449+ depends on SCSI450450+ depends on ISA || EISA || PCI451451+ depends on BROKEN || X86_32450452 help451453 This is a driver for all SCSI host adapters manufactured by452454 AdvanSys. It is documented in the kernel source in
···1920192019211921MODULE_DESCRIPTION(DRIVER_DESC);19221922MODULE_LICENSE("GPL");19231923-/*19241924- * BRIEF MODULE DESCRIPTION19251925- * Au1200 LCD Driver.19261926- *19271927- * Copyright 2004-2005 AMD19281928- * Author: AMD19291929- *19301930- * Based on:19311931- * linux/drivers/video/skeletonfb.c -- Skeleton for a frame buffer device19321932- * Created 28 Dec 1997 by Geert Uytterhoeven19331933- *19341934- * This program is free software; you can redistribute it and/or modify it19351935- * under the terms of the GNU General Public License as published by the19361936- * Free Software Foundation; either version 2 of the License, or (at your19371937- * option) any later version.19381938- *19391939- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED19401940- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF19411941- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN19421942- * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,19431943- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT19441944- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF19451945- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON19461946- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT19471947- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF19481948- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.19491949- *19501950- * You should have received a copy of the GNU General Public License along19511951- * with this program; if not, write to the Free Software Foundation, Inc.,19521952- * 675 Mass Ave, Cambridge, MA 02139, USA.19531953- */19541954-19551955-#include <linux/module.h>19561956-#include <linux/platform_device.h>19571957-#include <linux/kernel.h>19581958-#include <linux/errno.h>19591959-#include <linux/string.h>19601960-#include <linux/mm.h>19611961-#include <linux/fb.h>19621962-#include <linux/init.h>19631963-#include <linux/interrupt.h>19641964-#include <linux/ctype.h>19651965-#include <linux/dma-mapping.h>19661966-19671967-#include <asm/mach-au1x00/au1000.h>19681968-#include "au1200fb.h"19691969-19701970-#ifdef CONFIG_PM19711971-#include <asm/mach-au1x00/au1xxx_pm.h>19721972-#endif19731973-19741974-#ifndef CONFIG_FB_AU1200_DEVS19751975-#define CONFIG_FB_AU1200_DEVS 419761976-#endif19771977-19781978-#define DRIVER_NAME "au1200fb"19791979-#define DRIVER_DESC "LCD controller driver for AU1200 processors"19801980-19811981-#define DEBUG 119821982-19831983-#define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg)19841984-#define print_warn(f, arg...) printk(KERN_WARNING DRIVER_NAME ": " f "\n", ## arg)19851985-#define print_info(f, arg...) printk(KERN_INFO DRIVER_NAME ": " f "\n", ## arg)19861986-19871987-#if DEBUG19881988-#define print_dbg(f, arg...) printk(KERN_DEBUG __FILE__ ": " f "\n", ## arg)19891989-#else19901990-#define print_dbg(f, arg...) do {} while (0)19911991-#endif19921992-19931993-19941994-#define AU1200_LCD_FB_IOCTL 0x46FF19951995-19961996-#define AU1200_LCD_SET_SCREEN 119971997-#define AU1200_LCD_GET_SCREEN 219981998-#define AU1200_LCD_SET_WINDOW 319991999-#define AU1200_LCD_GET_WINDOW 420002000-#define AU1200_LCD_SET_PANEL 520012001-#define AU1200_LCD_GET_PANEL 620022002-20032003-#define SCREEN_SIZE (1<< 1)20042004-#define SCREEN_BACKCOLOR (1<< 2)20052005-#define SCREEN_BRIGHTNESS (1<< 3)20062006-#define SCREEN_COLORKEY (1<< 4)20072007-#define SCREEN_MASK (1<< 5)20082008-20092009-struct au1200_lcd_global_regs_t {20102010- unsigned int flags;20112011- unsigned int xsize;20122012- unsigned int ysize;20132013- unsigned int backcolor;20142014- unsigned int brightness;20152015- unsigned int colorkey;20162016- unsigned int mask;20172017- unsigned int panel_choice;20182018- char panel_desc[80];20192019-20202020-};20212021-20222022-#define WIN_POSITION (1<< 0)20232023-#define WIN_ALPHA_COLOR (1<< 1)20242024-#define WIN_ALPHA_MODE (1<< 2)20252025-#define WIN_PRIORITY (1<< 3)20262026-#define WIN_CHANNEL (1<< 4)20272027-#define WIN_BUFFER_FORMAT (1<< 5)20282028-#define WIN_COLOR_ORDER (1<< 6)20292029-#define WIN_PIXEL_ORDER (1<< 7)20302030-#define WIN_SIZE (1<< 8)20312031-#define WIN_COLORKEY_MODE (1<< 9)20322032-#define WIN_DOUBLE_BUFFER_MODE (1<< 10)20332033-#define WIN_RAM_ARRAY_MODE (1<< 11)20342034-#define WIN_BUFFER_SCALE (1<< 12)20352035-#define WIN_ENABLE (1<< 13)20362036-20372037-struct au1200_lcd_window_regs_t {20382038- unsigned int flags;20392039- unsigned int xpos;20402040- unsigned int ypos;20412041- unsigned int alpha_color;20422042- unsigned int alpha_mode;20432043- unsigned int priority;20442044- unsigned int channel;20452045- unsigned int buffer_format;20462046- unsigned int color_order;20472047- unsigned int pixel_order;20482048- unsigned int xsize;20492049- unsigned int ysize;20502050- unsigned int colorkey_mode;20512051- unsigned int double_buffer_mode;20522052- unsigned int ram_array_mode;20532053- unsigned int xscale;20542054- unsigned int yscale;20552055- unsigned int enable;20562056-};20572057-20582058-20592059-struct au1200_lcd_iodata_t {20602060- unsigned int subcmd;20612061- struct au1200_lcd_global_regs_t global;20622062- struct au1200_lcd_window_regs_t window;20632063-};20642064-20652065-#if defined(__BIG_ENDIAN)20662066-#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_1120672067-#else20682068-#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_0020692069-#endif20702070-#define LCD_CONTROL_DEFAULT_SBPPF LCD_CONTROL_SBPPF_56520712071-20722072-/* Private, per-framebuffer management information (independent of the panel itself) */20732073-struct au1200fb_device {20742074- struct fb_info fb_info; /* FB driver info record */20752075-20762076- int plane;20772077- unsigned char* fb_mem; /* FrameBuffer memory map */20782078- unsigned int fb_len;20792079- dma_addr_t fb_phys;20802080-};20812081-20822082-static struct au1200fb_device _au1200fb_devices[CONFIG_FB_AU1200_DEVS];20832083-/********************************************************************/20842084-20852085-/* LCD controller restrictions */20862086-#define AU1200_LCD_MAX_XRES 128020872087-#define AU1200_LCD_MAX_YRES 102420882088-#define AU1200_LCD_MAX_BPP 3220892089-#define AU1200_LCD_MAX_CLK 96000000 /* fixme: this needs to go away ? */20902090-#define AU1200_LCD_NBR_PALETTE_ENTRIES 25620912091-20922092-/* Default number of visible screen buffer to allocate */20932093-#define AU1200FB_NBR_VIDEO_BUFFERS 120942094-20952095-/********************************************************************/20962096-20972097-static struct au1200_lcd *lcd = (struct au1200_lcd *) AU1200_LCD_ADDR;20982098-static int window_index = 2; /* default is zero */20992099-static int panel_index = 2; /* default is zero */21002100-static struct window_settings *win;21012101-static struct panel_settings *panel;21022102-static int noblanking = 1;21032103-static int nohwcursor = 0;21042104-21052105-struct window_settings {21062106- unsigned char name[64];21072107- uint32 mode_backcolor;21082108- uint32 mode_colorkey;21092109- uint32 mode_colorkeymsk;21102110- struct {21112111- int xres;21122112- int yres;21132113- int xpos;21142114- int ypos;21152115- uint32 mode_winctrl1; /* winctrl1[FRM,CCO,PO,PIPE] */21162116- uint32 mode_winenable;21172117- } w[4];21182118-};21192119-21202120-#if defined(__BIG_ENDIAN)21212121-#define LCD_WINCTRL1_PO_16BPP LCD_WINCTRL1_PO_0021222122-#else21232123-#define LCD_WINCTRL1_PO_16BPP LCD_WINCTRL1_PO_0121242124-#endif21252125-21262126-extern int board_au1200fb_panel_init (void);21272127-extern int board_au1200fb_panel_shutdown (void);21282128-21292129-#ifdef CONFIG_PM21302130-int au1200fb_pm_callback(au1xxx_power_dev_t *dev,21312131- au1xxx_request_t request, void *data);21322132-au1xxx_power_dev_t *LCD_pm_dev;21332133-#endif21342134-21352135-/*21362136- * Default window configurations21372137- */21382138-static struct window_settings windows[] = {21392139- { /* Index 0 */21402140- "0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx",21412141- /* mode_backcolor */ 0x006600ff,21422142- /* mode_colorkey,msk*/ 0, 0,21432143- {21442144- {21452145- /* xres, yres, xpos, ypos */ 0, 0, 0, 0,21462146- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |21472147- LCD_WINCTRL1_PO_16BPP,21482148- /* mode_winenable*/ LCD_WINENABLE_WEN0,21492149- },21502150- {21512151- /* xres, yres, xpos, ypos */ 100, 100, 100, 100,21522152- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |21532153- LCD_WINCTRL1_PO_16BPP |21542154- LCD_WINCTRL1_PIPE,21552155- /* mode_winenable*/ LCD_WINENABLE_WEN1,21562156- },21572157- {21582158- /* xres, yres, xpos, ypos */ 0, 0, 0, 0,21592159- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |21602160- LCD_WINCTRL1_PO_16BPP,21612161- /* mode_winenable*/ 0,21622162- },21632163- {21642164- /* xres, yres, xpos, ypos */ 0, 0, 0, 0,21652165- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |21662166- LCD_WINCTRL1_PO_16BPP |21672167- LCD_WINCTRL1_PIPE,21682168- /* mode_winenable*/ 0,21692169- },21702170- },21712171- },21722172-21732173- { /* Index 1 */21742174- "0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx",21752175- /* mode_backcolor */ 0x006600ff,21762176- /* mode_colorkey,msk*/ 0, 0,21772177- {21782178- {21792179- /* xres, yres, xpos, ypos */ 320, 240, 5, 5,21802180- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_24BPP |21812181- LCD_WINCTRL1_PO_00,21822182- /* mode_winenable*/ LCD_WINENABLE_WEN0,21832183- },21842184- {21852185- /* xres, yres, xpos, ypos */ 0, 0, 0, 0,21862186- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP56521872187- | LCD_WINCTRL1_PO_16BPP,21882188- /* mode_winenable*/ 0,21892189- },21902190- {21912191- /* xres, yres, xpos, ypos */ 100, 100, 0, 0,21922192- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |21932193- LCD_WINCTRL1_PO_16BPP |21942194- LCD_WINCTRL1_PIPE,21952195- /* mode_winenable*/ 0/*LCD_WINENABLE_WEN2*/,21962196- },21972197- {21982198- /* xres, yres, xpos, ypos */ 200, 25, 0, 0,21992199- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |22002200- LCD_WINCTRL1_PO_16BPP |22012201- LCD_WINCTRL1_PIPE,22022202- /* mode_winenable*/ 0,22032203- },22042204- },22052205- },22062206- { /* Index 2 */22072207- "0-FS gfx, 1-video, 2-ovly gfx, 3-ovly gfx",22082208- /* mode_backcolor */ 0x006600ff,22092209- /* mode_colorkey,msk*/ 0, 0,22102210- {22112211- {22122212- /* xres, yres, xpos, ypos */ 0, 0, 0, 0,22132213- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |22142214- LCD_WINCTRL1_PO_16BPP,22152215- /* mode_winenable*/ LCD_WINENABLE_WEN0,22162216- },22172217- {22182218- /* xres, yres, xpos, ypos */ 0, 0, 0, 0,22192219- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |22202220- LCD_WINCTRL1_PO_16BPP,22212221- /* mode_winenable*/ 0,22222222- },22232223- {22242224- /* xres, yres, xpos, ypos */ 0, 0, 0, 0,22252225- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_32BPP |22262226- LCD_WINCTRL1_PO_00|LCD_WINCTRL1_PIPE,22272227- /* mode_winenable*/ 0/*LCD_WINENABLE_WEN2*/,22282228- },22292229- {22302230- /* xres, yres, xpos, ypos */ 0, 0, 0, 0,22312231- /* mode_winctrl1 */ LCD_WINCTRL1_FRM_16BPP565 |22322232- LCD_WINCTRL1_PO_16BPP |22332233- LCD_WINCTRL1_PIPE,22342234- /* mode_winenable*/ 0,22352235- },22362236- },22372237- },22382238- /* Need VGA 640 @ 24bpp, @ 32bpp */22392239- /* Need VGA 800 @ 24bpp, @ 32bpp */22402240- /* Need VGA 1024 @ 24bpp, @ 32bpp */22412241-};22422242-22432243-/*22442244- * Controller configurations for various panels.22452245- */22462246-22472247-struct panel_settings22482248-{22492249- const char name[25]; /* Full name <vendor>_<model> */22502250-22512251- struct fb_monspecs monspecs; /* FB monitor specs */22522252-22532253- /* panel timings */22542254- uint32 mode_screen;22552255- uint32 mode_horztiming;22562256- uint32 mode_verttiming;22572257- uint32 mode_clkcontrol;22582258- uint32 mode_pwmdiv;22592259- uint32 mode_pwmhi;22602260- uint32 mode_outmask;22612261- uint32 mode_fifoctrl;22622262- uint32 mode_toyclksrc;22632263- uint32 mode_backlight;22642264- uint32 mode_auxpll;22652265- int (*device_init)(void);22662266- int (*device_shutdown)(void);22672267-#define Xres min_xres22682268-#define Yres min_yres22692269- u32 min_xres; /* Minimum horizontal resolution */22702270- u32 max_xres; /* Maximum horizontal resolution */22712271- u32 min_yres; /* Minimum vertical resolution */22722272- u32 max_yres; /* Maximum vertical resolution */22732273-};22742274-22752275-/********************************************************************/22762276-/* fixme: Maybe a modedb for the CRT ? otherwise panels should be as-is */22772277-22782278-/* List of panels known to work with the AU1200 LCD controller.22792279- * To add a new panel, enter the same specifications as the22802280- * Generic_TFT one, and MAKE SURE that it doesn't conflicts22812281- * with the controller restrictions. Restrictions are:22822282- *22832283- * STN color panels: max_bpp <= 1222842284- * STN mono panels: max_bpp <= 422852285- * TFT panels: max_bpp <= 1622862286- * max_xres <= 80022872287- * max_yres <= 60022882288- */22892289-static struct panel_settings known_lcd_panels[] =22902290-{22912291- [0] = { /* QVGA 320x240 H:33.3kHz V:110Hz */22922292- .name = "QVGA_320x240",22932293- .monspecs = {22942294- .modedb = NULL,22952295- .modedb_len = 0,22962296- .hfmin = 30000,22972297- .hfmax = 70000,22982298- .vfmin = 60,22992299- .vfmax = 60,23002300- .dclkmin = 6000000,23012301- .dclkmax = 28000000,23022302- .input = FB_DISP_RGB,23032303- },23042304- .mode_screen = LCD_SCREEN_SX_N(320) |23052305- LCD_SCREEN_SY_N(240),23062306- .mode_horztiming = 0x00c4623b,23072307- .mode_verttiming = 0x00502814,23082308- .mode_clkcontrol = 0x00020002, /* /4=24Mhz */23092309- .mode_pwmdiv = 0x00000000,23102310- .mode_pwmhi = 0x00000000,23112311- .mode_outmask = 0x00FFFFFF,23122312- .mode_fifoctrl = 0x2f2f2f2f,23132313- .mode_toyclksrc = 0x00000004, /* AUXPLL directly */23142314- .mode_backlight = 0x00000000,23152315- .mode_auxpll = 8, /* 96MHz AUXPLL */23162316- .device_init = NULL,23172317- .device_shutdown = NULL,23182318- 320, 320,23192319- 240, 240,23202320- },23212321-23222322- [1] = { /* VGA 640x480 H:30.3kHz V:58Hz */23232323- .name = "VGA_640x480",23242324- .monspecs = {23252325- .modedb = NULL,23262326- .modedb_len = 0,23272327- .hfmin = 30000,23282328- .hfmax = 70000,23292329- .vfmin = 60,23302330- .vfmax = 60,23312331- .dclkmin = 6000000,23322332- .dclkmax = 28000000,23332333- .input = FB_DISP_RGB,23342334- },23352335- .mode_screen = 0x13f9df80,23362336- .mode_horztiming = 0x003c5859,23372337- .mode_verttiming = 0x00741201,23382338- .mode_clkcontrol = 0x00020001, /* /4=24Mhz */23392339- .mode_pwmdiv = 0x00000000,23402340- .mode_pwmhi = 0x00000000,23412341- .mode_outmask = 0x00FFFFFF,23422342- .mode_fifoctrl = 0x2f2f2f2f,23432343- .mode_toyclksrc = 0x00000004, /* AUXPLL directly */23442344- .mode_backlight = 0x00000000,23452345- .mode_auxpll = 8, /* 96MHz AUXPLL */23462346- .device_init = NULL,23472347- .device_shutdown = NULL,23482348- 640, 480,23492349- 640, 480,23502350- },23512351-23522352- [2] = { /* SVGA 800x600 H:46.1kHz V:69Hz */23532353- .name = "SVGA_800x600",23542354- .monspecs = {23552355- .modedb = NULL,23562356- .modedb_len = 0,23572357- .hfmin = 30000,23582358- .hfmax = 70000,23592359- .vfmin = 60,23602360- .vfmax = 60,23612361- .dclkmin = 6000000,23622362- .dclkmax = 28000000,23632363- .input = FB_DISP_RGB,23642364- },23652365- .mode_screen = 0x18fa5780,23662366- .mode_horztiming = 0x00dc7e77,23672367- .mode_verttiming = 0x00584805,23682368- .mode_clkcontrol = 0x00020000, /* /2=48Mhz */23692369- .mode_pwmdiv = 0x00000000,23702370- .mode_pwmhi = 0x00000000,23712371- .mode_outmask = 0x00FFFFFF,23722372- .mode_fifoctrl = 0x2f2f2f2f,23732373- .mode_toyclksrc = 0x00000004, /* AUXPLL directly */23742374- .mode_backlight = 0x00000000,23752375- .mode_auxpll = 8, /* 96MHz AUXPLL */23762376- .device_init = NULL,23772377- .device_shutdown = NULL,23782378- 800, 800,23792379- 600, 600,23802380- },23812381-23822382- [3] = { /* XVGA 1024x768 H:56.2kHz V:70Hz */23832383- .name = "XVGA_1024x768",23842384- .monspecs = {23852385- .modedb = NULL,23862386- .modedb_len = 0,23872387- .hfmin = 30000,23882388- .hfmax = 70000,23892389- .vfmin = 60,23902390- .vfmax = 60,23912391- .dclkmin = 6000000,23922392- .dclkmax = 28000000,23932393- .input = FB_DISP_RGB,23942394- },23952395- .mode_screen = 0x1ffaff80,23962396- .mode_horztiming = 0x007d0e57,23972397- .mode_verttiming = 0x00740a01,23982398- .mode_clkcontrol = 0x000A0000, /* /1 */23992399- .mode_pwmdiv = 0x00000000,24002400- .mode_pwmhi = 0x00000000,24012401- .mode_outmask = 0x00FFFFFF,24022402- .mode_fifoctrl = 0x2f2f2f2f,24032403- .mode_toyclksrc = 0x00000004, /* AUXPLL directly */24042404- .mode_backlight = 0x00000000,24052405- .mode_auxpll = 6, /* 72MHz AUXPLL */24062406- .device_init = NULL,24072407- .device_shutdown = NULL,24082408- 1024, 1024,24092409- 768, 768,24102410- },24112411-24122412- [4] = { /* XVGA XVGA 1280x1024 H:68.5kHz V:65Hz */24132413- .name = "XVGA_1280x1024",24142414- .monspecs = {24152415- .modedb = NULL,24162416- .modedb_len = 0,24172417- .hfmin = 30000,24182418- .hfmax = 70000,24192419- .vfmin = 60,24202420- .vfmax = 60,24212421- .dclkmin = 6000000,24222422- .dclkmax = 28000000,24232423- .input = FB_DISP_RGB,24242424- },24252425- .mode_screen = 0x27fbff80,24262426- .mode_horztiming = 0x00cdb2c7,24272427- .mode_verttiming = 0x00600002,24282428- .mode_clkcontrol = 0x000A0000, /* /1 */24292429- .mode_pwmdiv = 0x00000000,24302430- .mode_pwmhi = 0x00000000,24312431- .mode_outmask = 0x00FFFFFF,24322432- .mode_fifoctrl = 0x2f2f2f2f,24332433- .mode_toyclksrc = 0x00000004, /* AUXPLL directly */24342434- .mode_backlight = 0x00000000,24352435- .mode_auxpll = 10, /* 120MHz AUXPLL */24362436- .device_init = NULL,24372437- .device_shutdown = NULL,24382438- 1280, 1280,24392439- 1024, 1024,24402440- },24412441-24422442- [5] = { /* Samsung 1024x768 TFT */24432443- .name = "Samsung_1024x768_TFT",24442444- .monspecs = {24452445- .modedb = NULL,24462446- .modedb_len = 0,24472447- .hfmin = 30000,24482448- .hfmax = 70000,24492449- .vfmin = 60,24502450- .vfmax = 60,24512451- .dclkmin = 6000000,24522452- .dclkmax = 28000000,24532453- .input = FB_DISP_RGB,24542454- },24552455- .mode_screen = 0x1ffaff80,24562456- .mode_horztiming = 0x018cc677,24572457- .mode_verttiming = 0x00241217,24582458- .mode_clkcontrol = 0x00000000, /* SCB 0x1 /4=24Mhz */24592459- .mode_pwmdiv = 0x8000063f, /* SCB 0x0 */24602460- .mode_pwmhi = 0x03400000, /* SCB 0x0 */24612461- .mode_outmask = 0x00FFFFFF,24622462- .mode_fifoctrl = 0x2f2f2f2f,24632463- .mode_toyclksrc = 0x00000004, /* AUXPLL directly */24642464- .mode_backlight = 0x00000000,24652465- .mode_auxpll = 8, /* 96MHz AUXPLL */24662466- .device_init = board_au1200fb_panel_init,24672467- .device_shutdown = board_au1200fb_panel_shutdown,24682468- 1024, 1024,24692469- 768, 768,24702470- },24712471-24722472- [6] = { /* Toshiba 640x480 TFT */24732473- .name = "Toshiba_640x480_TFT",24742474- .monspecs = {24752475- .modedb = NULL,24762476- .modedb_len = 0,24772477- .hfmin = 30000,24782478- .hfmax = 70000,24792479- .vfmin = 60,24802480- .vfmax = 60,24812481- .dclkmin = 6000000,24822482- .dclkmax = 28000000,24832483- .input = FB_DISP_RGB,24842484- },24852485- .mode_screen = LCD_SCREEN_SX_N(640) |24862486- LCD_SCREEN_SY_N(480),24872487- .mode_horztiming = LCD_HORZTIMING_HPW_N(96) |24882488- LCD_HORZTIMING_HND1_N(13) | LCD_HORZTIMING_HND2_N(51),24892489- .mode_verttiming = LCD_VERTTIMING_VPW_N(2) |24902490- LCD_VERTTIMING_VND1_N(11) | LCD_VERTTIMING_VND2_N(32),24912491- .mode_clkcontrol = 0x00000000, /* /4=24Mhz */24922492- .mode_pwmdiv = 0x8000063f,24932493- .mode_pwmhi = 0x03400000,24942494- .mode_outmask = 0x00fcfcfc,24952495- .mode_fifoctrl = 0x2f2f2f2f,24962496- .mode_toyclksrc = 0x00000004, /* AUXPLL directly */24972497- .mode_backlight = 0x00000000,24982498- .mode_auxpll = 8, /* 96MHz AUXPLL */24992499- .device_init = board_au1200fb_panel_init,25002500- .device_shutdown = board_au1200fb_panel_shutdown,25012501- 640, 480,25022502- 640, 480,25032503- },25042504-25052505- [7] = { /* Sharp 320x240 TFT */25062506- .name = "Sharp_320x240_TFT",25072507- .monspecs = {25082508- .modedb = NULL,25092509- .modedb_len = 0,25102510- .hfmin = 12500,25112511- .hfmax = 20000,25122512- .vfmin = 38,25132513- .vfmax = 81,25142514- .dclkmin = 4500000,25152515- .dclkmax = 6800000,25162516- .input = FB_DISP_RGB,25172517- },25182518- .mode_screen = LCD_SCREEN_SX_N(320) |25192519- LCD_SCREEN_SY_N(240),25202520- .mode_horztiming = LCD_HORZTIMING_HPW_N(60) |25212521- LCD_HORZTIMING_HND1_N(13) | LCD_HORZTIMING_HND2_N(2),25222522- .mode_verttiming = LCD_VERTTIMING_VPW_N(2) |25232523- LCD_VERTTIMING_VND1_N(2) | LCD_VERTTIMING_VND2_N(5),25242524- .mode_clkcontrol = LCD_CLKCONTROL_PCD_N(7), /*16=6Mhz*/25252525- .mode_pwmdiv = 0x8000063f,25262526- .mode_pwmhi = 0x03400000,25272527- .mode_outmask = 0x00fcfcfc,25282528- .mode_fifoctrl = 0x2f2f2f2f,25292529- .mode_toyclksrc = 0x00000004, /* AUXPLL directly */25302530- .mode_backlight = 0x00000000,25312531- .mode_auxpll = 8, /* 96MHz AUXPLL */25322532- .device_init = board_au1200fb_panel_init,25332533- .device_shutdown = board_au1200fb_panel_shutdown,25342534- 320, 320,25352535- 240, 240,25362536- },25372537-25382538- [8] = { /* Toppoly TD070WGCB2 7" 856x480 TFT */25392539- .name = "Toppoly_TD070WGCB2",25402540- .monspecs = {25412541- .modedb = NULL,25422542- .modedb_len = 0,25432543- .hfmin = 30000,25442544- .hfmax = 70000,25452545- .vfmin = 60,25462546- .vfmax = 60,25472547- .dclkmin = 6000000,25482548- .dclkmax = 28000000,25492549- .input = FB_DISP_RGB,25502550- },25512551- .mode_screen = LCD_SCREEN_SX_N(856) |25522552- LCD_SCREEN_SY_N(480),25532553- .mode_horztiming = LCD_HORZTIMING_HND2_N(43) |25542554- LCD_HORZTIMING_HND1_N(43) | LCD_HORZTIMING_HPW_N(114),25552555- .mode_verttiming = LCD_VERTTIMING_VND2_N(20) |25562556- LCD_VERTTIMING_VND1_N(21) | LCD_VERTTIMING_VPW_N(4),25572557- .mode_clkcontrol = 0x00020001, /* /4=24Mhz */25582558- .mode_pwmdiv = 0x8000063f,25592559- .mode_pwmhi = 0x03400000,25602560- .mode_outmask = 0x00fcfcfc,25612561- .mode_fifoctrl = 0x2f2f2f2f,25622562- .mode_toyclksrc = 0x00000004, /* AUXPLL directly */25632563- .mode_backlight = 0x00000000,25642564- .mode_auxpll = 8, /* 96MHz AUXPLL */25652565- .device_init = board_au1200fb_panel_init,25662566- .device_shutdown = board_au1200fb_panel_shutdown,25672567- 856, 856,25682568- 480, 480,25692569- },25702570-};25712571-25722572-#define NUM_PANELS (ARRAY_SIZE(known_lcd_panels))25732573-25742574-/********************************************************************/25752575-25762576-#ifdef CONFIG_PM25772577-static int set_brightness(unsigned int brightness)25782578-{25792579- unsigned int hi1, divider;25802580-25812581- /* limit brightness pwm duty to >= 30/1600 */25822582- if (brightness < 30) {25832583- brightness = 30;25842584- }25852585- divider = (lcd->pwmdiv & 0x3FFFF) + 1;25862586- hi1 = (lcd->pwmhi >> 16) + 1;25872587- hi1 = (((brightness & 0xFF) + 1) * divider >> 8);25882588- lcd->pwmhi &= 0xFFFF;25892589- lcd->pwmhi |= (hi1 << 16);25902590-25912591- return brightness;25922592-}25932593-#endif /* CONFIG_PM */25942594-25952595-static int winbpp (unsigned int winctrl1)25962596-{25972597- int bits = 0;25982598-25992599- /* how many bits are needed for each pixel format */26002600- switch (winctrl1 & LCD_WINCTRL1_FRM) {26012601- case LCD_WINCTRL1_FRM_1BPP:26022602- bits = 1;26032603- break;26042604- case LCD_WINCTRL1_FRM_2BPP:26052605- bits = 2;26062606- break;26072607- case LCD_WINCTRL1_FRM_4BPP:26082608- bits = 4;26092609- break;26102610- case LCD_WINCTRL1_FRM_8BPP:26112611- bits = 8;26122612- break;26132613- case LCD_WINCTRL1_FRM_12BPP:26142614- case LCD_WINCTRL1_FRM_16BPP655:26152615- case LCD_WINCTRL1_FRM_16BPP565:26162616- case LCD_WINCTRL1_FRM_16BPP556:26172617- case LCD_WINCTRL1_FRM_16BPPI1555:26182618- case LCD_WINCTRL1_FRM_16BPPI5551:26192619- case LCD_WINCTRL1_FRM_16BPPA1555:26202620- case LCD_WINCTRL1_FRM_16BPPA5551:26212621- bits = 16;26222622- break;26232623- case LCD_WINCTRL1_FRM_24BPP:26242624- case LCD_WINCTRL1_FRM_32BPP:26252625- bits = 32;26262626- break;26272627- }26282628-26292629- return bits;26302630-}26312631-26322632-static int fbinfo2index (struct fb_info *fb_info)26332633-{26342634- int i;26352635-26362636- for (i = 0; i < CONFIG_FB_AU1200_DEVS; ++i) {26372637- if (fb_info == (struct fb_info *)(&_au1200fb_devices[i].fb_info))26382638- return i;26392639- }26402640- printk("au1200fb: ERROR: fbinfo2index failed!\n");26412641- return -1;26422642-}26432643-26442644-static int au1200_setlocation (struct au1200fb_device *fbdev, int plane,26452645- int xpos, int ypos)26462646-{26472647- uint32 winctrl0, winctrl1, winenable, fb_offset = 0;26482648- int xsz, ysz;26492649-26502650- /* FIX!!! NOT CHECKING FOR COMPLETE OFFSCREEN YET */26512651-26522652- winctrl0 = lcd->window[plane].winctrl0;26532653- winctrl1 = lcd->window[plane].winctrl1;26542654- winctrl0 &= (LCD_WINCTRL0_A | LCD_WINCTRL0_AEN);26552655- winctrl1 &= ~(LCD_WINCTRL1_SZX | LCD_WINCTRL1_SZY);26562656-26572657- /* Check for off-screen adjustments */26582658- xsz = win->w[plane].xres;26592659- ysz = win->w[plane].yres;26602660- if ((xpos + win->w[plane].xres) > panel->Xres) {26612661- /* Off-screen to the right */26622662- xsz = panel->Xres - xpos; /* off by 1 ??? */26632663- /*printk("off screen right\n");*/26642664- }26652665-26662666- if ((ypos + win->w[plane].yres) > panel->Yres) {26672667- /* Off-screen to the bottom */26682668- ysz = panel->Yres - ypos; /* off by 1 ??? */26692669- /*printk("off screen bottom\n");*/26702670- }26712671-26722672- if (xpos < 0) {26732673- /* Off-screen to the left */26742674- xsz = win->w[plane].xres + xpos;26752675- fb_offset += (((0 - xpos) * winbpp(lcd->window[plane].winctrl1))/8);26762676- xpos = 0;26772677- /*printk("off screen left\n");*/26782678- }26792679-26802680- if (ypos < 0) {26812681- /* Off-screen to the top */26822682- ysz = win->w[plane].yres + ypos;26832683- /* fixme: fb_offset += ((0-ypos)*fb_pars[plane].line_length); */26842684- ypos = 0;26852685- /*printk("off screen top\n");*/26862686- }26872687-26882688- /* record settings */26892689- win->w[plane].xpos = xpos;26902690- win->w[plane].ypos = ypos;26912691-26922692- xsz -= 1;26932693- ysz -= 1;26942694- winctrl0 |= (xpos << 21);26952695- winctrl0 |= (ypos << 10);26962696- winctrl1 |= (xsz << 11);26972697- winctrl1 |= (ysz << 0);26982698-26992699- /* Disable the window while making changes, then restore WINEN */27002700- winenable = lcd->winenable & (1 << plane);27012701- au_sync();27022702- lcd->winenable &= ~(1 << plane);27032703- lcd->window[plane].winctrl0 = winctrl0;27042704- lcd->window[plane].winctrl1 = winctrl1;27052705- lcd->window[plane].winbuf0 =27062706- lcd->window[plane].winbuf1 = fbdev->fb_phys;27072707- lcd->window[plane].winbufctrl = 0; /* select winbuf0 */27082708- lcd->winenable |= winenable;27092709- au_sync();27102710-27112711- return 0;27122712-}27132713-27142714-static void au1200_setpanel (struct panel_settings *newpanel)27152715-{27162716- /*27172717- * Perform global setup/init of LCD controller27182718- */27192719- uint32 winenable;27202720-27212721- /* Make sure all windows disabled */27222722- winenable = lcd->winenable;27232723- lcd->winenable = 0;27242724- au_sync();27252725- /*27262726- * Ensure everything is disabled before reconfiguring27272727- */27282728- if (lcd->screen & LCD_SCREEN_SEN) {27292729- /* Wait for vertical sync period */27302730- lcd->intstatus = LCD_INT_SS;27312731- while ((lcd->intstatus & LCD_INT_SS) == 0) {27322732- au_sync();27332733- }27342734-27352735- lcd->screen &= ~LCD_SCREEN_SEN; /*disable the controller*/27362736-27372737- do {27382738- lcd->intstatus = lcd->intstatus; /*clear interrupts*/27392739- au_sync();27402740- /*wait for controller to shut down*/27412741- } while ((lcd->intstatus & LCD_INT_SD) == 0);27422742-27432743- /* Call shutdown of current panel (if up) */27442744- /* this must occur last, because if an external clock is driving27452745- the controller, the clock cannot be turned off before first27462746- shutting down the controller.27472747- */27482748- if (panel->device_shutdown != NULL)27492749- panel->device_shutdown();27502750- }27512751-27522752- /* Newpanel == NULL indicates a shutdown operation only */27532753- if (newpanel == NULL)27542754- return;27552755-27562756- panel = newpanel;27572757-27582758- printk("Panel(%s), %dx%d\n", panel->name, panel->Xres, panel->Yres);27592759-27602760- /*27612761- * Setup clocking if internal LCD clock source (assumes sys_auxpll valid)27622762- */27632763- if (!(panel->mode_clkcontrol & LCD_CLKCONTROL_EXT))27642764- {27652765- uint32 sys_clksrc;27662766- au_writel(panel->mode_auxpll, SYS_AUXPLL);27672767- sys_clksrc = au_readl(SYS_CLKSRC) & ~0x0000001f;27682768- sys_clksrc |= panel->mode_toyclksrc;27692769- au_writel(sys_clksrc, SYS_CLKSRC);27702770- }27712771-27722772- /*27732773- * Configure panel timings27742774- */27752775- lcd->screen = panel->mode_screen;27762776- lcd->horztiming = panel->mode_horztiming;27772777- lcd->verttiming = panel->mode_verttiming;27782778- lcd->clkcontrol = panel->mode_clkcontrol;27792779- lcd->pwmdiv = panel->mode_pwmdiv;27802780- lcd->pwmhi = panel->mode_pwmhi;27812781- lcd->outmask = panel->mode_outmask;27822782- lcd->fifoctrl = panel->mode_fifoctrl;27832783- au_sync();27842784-27852785- /* fixme: Check window settings to make sure still valid27862786- * for new geometry */27872787-#if 027882788- au1200_setlocation(fbdev, 0, win->w[0].xpos, win->w[0].ypos);27892789- au1200_setlocation(fbdev, 1, win->w[1].xpos, win->w[1].ypos);27902790- au1200_setlocation(fbdev, 2, win->w[2].xpos, win->w[2].ypos);27912791- au1200_setlocation(fbdev, 3, win->w[3].xpos, win->w[3].ypos);27922792-#endif27932793- lcd->winenable = winenable;27942794-27952795- /*27962796- * Re-enable screen now that it is configured27972797- */27982798- lcd->screen |= LCD_SCREEN_SEN;27992799- au_sync();28002800-28012801- /* Call init of panel */28022802- if (panel->device_init != NULL) panel->device_init();28032803-28042804- /* FIX!!!! not appropriate on panel change!!! Global setup/init */28052805- lcd->intenable = 0;28062806- lcd->intstatus = ~0;28072807- lcd->backcolor = win->mode_backcolor;28082808-28092809- /* Setup Color Key - FIX!!! */28102810- lcd->colorkey = win->mode_colorkey;28112811- lcd->colorkeymsk = win->mode_colorkeymsk;28122812-28132813- /* Setup HWCursor - FIX!!! Need to support this eventually */28142814- lcd->hwc.cursorctrl = 0;28152815- lcd->hwc.cursorpos = 0;28162816- lcd->hwc.cursorcolor0 = 0;28172817- lcd->hwc.cursorcolor1 = 0;28182818- lcd->hwc.cursorcolor2 = 0;28192819- lcd->hwc.cursorcolor3 = 0;28202820-28212821-28222822-#if 028232823-#define D(X) printk("%25s: %08X\n", #X, X)28242824- D(lcd->screen);28252825- D(lcd->horztiming);28262826- D(lcd->verttiming);28272827- D(lcd->clkcontrol);28282828- D(lcd->pwmdiv);28292829- D(lcd->pwmhi);28302830- D(lcd->outmask);28312831- D(lcd->fifoctrl);28322832- D(lcd->window[0].winctrl0);28332833- D(lcd->window[0].winctrl1);28342834- D(lcd->window[0].winctrl2);28352835- D(lcd->window[0].winbuf0);28362836- D(lcd->window[0].winbuf1);28372837- D(lcd->window[0].winbufctrl);28382838- D(lcd->window[1].winctrl0);28392839- D(lcd->window[1].winctrl1);28402840- D(lcd->window[1].winctrl2);28412841- D(lcd->window[1].winbuf0);28422842- D(lcd->window[1].winbuf1);28432843- D(lcd->window[1].winbufctrl);28442844- D(lcd->window[2].winctrl0);28452845- D(lcd->window[2].winctrl1);28462846- D(lcd->window[2].winctrl2);28472847- D(lcd->window[2].winbuf0);28482848- D(lcd->window[2].winbuf1);28492849- D(lcd->window[2].winbufctrl);28502850- D(lcd->window[3].winctrl0);28512851- D(lcd->window[3].winctrl1);28522852- D(lcd->window[3].winctrl2);28532853- D(lcd->window[3].winbuf0);28542854- D(lcd->window[3].winbuf1);28552855- D(lcd->window[3].winbufctrl);28562856- D(lcd->winenable);28572857- D(lcd->intenable);28582858- D(lcd->intstatus);28592859- D(lcd->backcolor);28602860- D(lcd->winenable);28612861- D(lcd->colorkey);28622862- D(lcd->colorkeymsk);28632863- D(lcd->hwc.cursorctrl);28642864- D(lcd->hwc.cursorpos);28652865- D(lcd->hwc.cursorcolor0);28662866- D(lcd->hwc.cursorcolor1);28672867- D(lcd->hwc.cursorcolor2);28682868- D(lcd->hwc.cursorcolor3);28692869-#endif28702870-}28712871-28722872-static void au1200_setmode(struct au1200fb_device *fbdev)28732873-{28742874- int plane = fbdev->plane;28752875- /* Window/plane setup */28762876- lcd->window[plane].winctrl1 = ( 028772877- | LCD_WINCTRL1_PRI_N(plane)28782878- | win->w[plane].mode_winctrl1 /* FRM,CCO,PO,PIPE */28792879- ) ;28802880-28812881- au1200_setlocation(fbdev, plane, win->w[plane].xpos, win->w[plane].ypos);28822882-28832883- lcd->window[plane].winctrl2 = ( 028842884- | LCD_WINCTRL2_CKMODE_0028852885- | LCD_WINCTRL2_DBM28862886- | LCD_WINCTRL2_BX_N( fbdev->fb_info.fix.line_length)28872887- | LCD_WINCTRL2_SCX_128882888- | LCD_WINCTRL2_SCY_128892889- ) ;28902890- lcd->winenable |= win->w[plane].mode_winenable;28912891- au_sync();28922892-}28932893-28942894-28952895-/* Inline helpers */28962896-28972897-/*#define panel_is_dual(panel) ((panel->mode_screen & LCD_SCREEN_PT) == LCD_SCREEN_PT_010)*/28982898-/*#define panel_is_active(panel)((panel->mode_screen & LCD_SCREEN_PT) == LCD_SCREEN_PT_010)*/28992899-29002900-#define panel_is_color(panel) ((panel->mode_screen & LCD_SCREEN_PT) <= LCD_SCREEN_PT_CDSTN)29012901-29022902-/* Bitfields format supported by the controller. */29032903-static struct fb_bitfield rgb_bitfields[][4] = {29042904- /* Red, Green, Blue, Transp */29052905- [LCD_WINCTRL1_FRM_16BPP655 >> 25] =29062906- { { 10, 6, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 0, 0, 0 } },29072907-29082908- [LCD_WINCTRL1_FRM_16BPP565 >> 25] =29092909- { { 11, 5, 0 }, { 5, 6, 0 }, { 0, 5, 0 }, { 0, 0, 0 } },29102910-29112911- [LCD_WINCTRL1_FRM_16BPP556 >> 25] =29122912- { { 11, 5, 0 }, { 6, 5, 0 }, { 0, 6, 0 }, { 0, 0, 0 } },29132913-29142914- [LCD_WINCTRL1_FRM_16BPPI1555 >> 25] =29152915- { { 10, 5, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 0, 0, 0 } },29162916-29172917- [LCD_WINCTRL1_FRM_16BPPI5551 >> 25] =29182918- { { 11, 5, 0 }, { 6, 5, 0 }, { 1, 5, 0 }, { 0, 0, 0 } },29192919-29202920- [LCD_WINCTRL1_FRM_16BPPA1555 >> 25] =29212921- { { 10, 5, 0 }, { 5, 5, 0 }, { 0, 5, 0 }, { 15, 1, 0 } },29222922-29232923- [LCD_WINCTRL1_FRM_16BPPA5551 >> 25] =29242924- { { 11, 5, 0 }, { 6, 5, 0 }, { 1, 5, 0 }, { 0, 1, 0 } },29252925-29262926- [LCD_WINCTRL1_FRM_24BPP >> 25] =29272927- { { 16, 8, 0 }, { 8, 8, 0 }, { 0, 8, 0 }, { 0, 0, 0 } },29282928-29292929- [LCD_WINCTRL1_FRM_32BPP >> 25] =29302930- { { 16, 8, 0 }, { 8, 8, 0 }, { 0, 8, 0 }, { 24, 0, 0 } },29312931-};29322932-29332933-/*-------------------------------------------------------------------------*/29342934-29352935-/* Helpers */29362936-29372937-static void au1200fb_update_fbinfo(struct fb_info *fbi)29382938-{29392939- /* FIX!!!! This also needs to take the window pixel format into account!!! */29402940-29412941- /* Update var-dependent FB info */29422942- if (panel_is_color(panel)) {29432943- if (fbi->var.bits_per_pixel <= 8) {29442944- /* palettized */29452945- fbi->fix.visual = FB_VISUAL_PSEUDOCOLOR;29462946- fbi->fix.line_length = fbi->var.xres_virtual /29472947- (8/fbi->var.bits_per_pixel);29482948- } else {29492949- /* non-palettized */29502950- fbi->fix.visual = FB_VISUAL_TRUECOLOR;29512951- fbi->fix.line_length = fbi->var.xres_virtual * (fbi->var.bits_per_pixel / 8);29522952- }29532953- } else {29542954- /* mono FIX!!! mono 8 and 4 bits */29552955- fbi->fix.visual = FB_VISUAL_MONO10;29562956- fbi->fix.line_length = fbi->var.xres_virtual / 8;29572957- }29582958-29592959- fbi->screen_size = fbi->fix.line_length * fbi->var.yres_virtual;29602960- print_dbg("line length: %d\n", fbi->fix.line_length);29612961- print_dbg("bits_per_pixel: %d\n", fbi->var.bits_per_pixel);29622962-}29632963-29642964-/*-------------------------------------------------------------------------*/29652965-29662966-/* AU1200 framebuffer driver */29672967-29682968-/* fb_check_var29692969- * Validate var settings with hardware restrictions and modify it if necessary29702970- */29712971-static int au1200fb_fb_check_var(struct fb_var_screeninfo *var,29722972- struct fb_info *fbi)29732973-{29742974- struct au1200fb_device *fbdev = (struct au1200fb_device *)fbi;29752975- u32 pixclock;29762976- int screen_size, plane;29772977-29782978- plane = fbdev->plane;29792979-29802980- /* Make sure that the mode respect all LCD controller and29812981- * panel restrictions. */29822982- var->xres = win->w[plane].xres;29832983- var->yres = win->w[plane].yres;29842984-29852985- /* No need for virtual resolution support */29862986- var->xres_virtual = var->xres;29872987- var->yres_virtual = var->yres;29882988-29892989- var->bits_per_pixel = winbpp(win->w[plane].mode_winctrl1);29902990-29912991- screen_size = var->xres_virtual * var->yres_virtual;29922992- if (var->bits_per_pixel > 8) screen_size *= (var->bits_per_pixel / 8);29932993- else screen_size /= (8/var->bits_per_pixel);29942994-29952995- if (fbdev->fb_len < screen_size)29962996- return -EINVAL; /* Virtual screen is to big, abort */29972997-29982998- /* FIX!!!! what are the implicaitons of ignoring this for windows ??? */29992999- /* The max LCD clock is fixed to 48MHz (value of AUX_CLK). The pixel30003000- * clock can only be obtain by dividing this value by an even integer.30013001- * Fallback to a slower pixel clock if necessary. */30023002- pixclock = max((u32)(PICOS2KHZ(var->pixclock) * 1000), fbi->monspecs.dclkmin);30033003- pixclock = min(pixclock, min(fbi->monspecs.dclkmax, (u32)AU1200_LCD_MAX_CLK/2));30043004-30053005- if (AU1200_LCD_MAX_CLK % pixclock) {30063006- int diff = AU1200_LCD_MAX_CLK % pixclock;30073007- pixclock -= diff;30083008- }30093009-30103010- var->pixclock = KHZ2PICOS(pixclock/1000);30113011-#if 030123012- if (!panel_is_active(panel)) {30133013- int pcd = AU1200_LCD_MAX_CLK / (pixclock * 2) - 1;30143014-30153015- if (!panel_is_color(panel)30163016- && (panel->control_base & LCD_CONTROL_MPI) && (pcd < 3)) {30173017- /* STN 8bit mono panel support is up to 6MHz pixclock */30183018- var->pixclock = KHZ2PICOS(6000);30193019- } else if (!pcd) {30203020- /* Other STN panel support is up to 12MHz */30213021- var->pixclock = KHZ2PICOS(12000);30223022- }30233023- }30243024-#endif30253025- /* Set bitfield accordingly */30263026- switch (var->bits_per_pixel) {30273027- case 16:30283028- {30293029- /* 16bpp True color.30303030- * These must be set to MATCH WINCTRL[FORM] */30313031- int idx;30323032- idx = (win->w[0].mode_winctrl1 & LCD_WINCTRL1_FRM) >> 25;30333033- var->red = rgb_bitfields[idx][0];30343034- var->green = rgb_bitfields[idx][1];30353035- var->blue = rgb_bitfields[idx][2];30363036- var->transp = rgb_bitfields[idx][3];30373037- break;30383038- }30393039-30403040- case 32:30413041- {30423042- /* 32bpp True color.30433043- * These must be set to MATCH WINCTRL[FORM] */30443044- int idx;30453045- idx = (win->w[0].mode_winctrl1 & LCD_WINCTRL1_FRM) >> 25;30463046- var->red = rgb_bitfields[idx][0];30473047- var->green = rgb_bitfields[idx][1];30483048- var->blue = rgb_bitfields[idx][2];30493049- var->transp = rgb_bitfields[idx][3];30503050- break;30513051- }30523052- default:30533053- print_dbg("Unsupported depth %dbpp", var->bits_per_pixel);30543054- return -EINVAL;30553055- }30563056-30573057- return 0;30583058-}30593059-30603060-/* fb_set_par30613061- * Set hardware with var settings. This will enable the controller with a30623062- * specific mode, normally validated with the fb_check_var method30633063- */30643064-static int au1200fb_fb_set_par(struct fb_info *fbi)30653065-{30663066- struct au1200fb_device *fbdev = (struct au1200fb_device *)fbi;30673067-30683068- au1200fb_update_fbinfo(fbi);30693069- au1200_setmode(fbdev);30703070-30713071- return 0;30723072-}30733073-30743074-/* fb_setcolreg30753075- * Set color in LCD palette.30763076- */30773077-static int au1200fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green,30783078- unsigned blue, unsigned transp, struct fb_info *fbi)30793079-{30803080- volatile u32 *palette = lcd->palette;30813081- u32 value;30823082-30833083- if (regno > (AU1200_LCD_NBR_PALETTE_ENTRIES - 1))30843084- return -EINVAL;30853085-30863086- if (fbi->var.grayscale) {30873087- /* Convert color to grayscale */30883088- red = green = blue =30893089- (19595 * red + 38470 * green + 7471 * blue) >> 16;30903090- }30913091-30923092- if (fbi->fix.visual == FB_VISUAL_TRUECOLOR) {30933093- /* Place color in the pseudopalette */30943094- if (regno > 16)30953095- return -EINVAL;30963096-30973097- palette = (u32*) fbi->pseudo_palette;30983098-30993099- red >>= (16 - fbi->var.red.length);31003100- green >>= (16 - fbi->var.green.length);31013101- blue >>= (16 - fbi->var.blue.length);31023102-31033103- value = (red << fbi->var.red.offset) |31043104- (green << fbi->var.green.offset)|31053105- (blue << fbi->var.blue.offset);31063106- value &= 0xFFFF;31073107-31083108- } else if (1 /*FIX!!! panel_is_active(fbdev->panel)*/) {31093109- /* COLOR TFT PALLETTIZED (use RGB 565) */31103110- value = (red & 0xF800)|((green >> 5) &31113111- 0x07E0)|((blue >> 11) & 0x001F);31123112- value &= 0xFFFF;31133113-31143114- } else if (0 /*panel_is_color(fbdev->panel)*/) {31153115- /* COLOR STN MODE */31163116- value = 0x1234;31173117- value &= 0xFFF;31183118- } else {31193119- /* MONOCHROME MODE */31203120- value = (green >> 12) & 0x000F;31213121- value &= 0xF;31223122- }31233123-31243124- palette[regno] = value;31253125-31263126- return 0;31273127-}31283128-31293129-/* fb_blank31303130- * Blank the screen. Depending on the mode, the screen will be31313131- * activated with the backlight color, or desactivated31323132- */31333133-static int au1200fb_fb_blank(int blank_mode, struct fb_info *fbi)31343134-{31353135- /* Short-circuit screen blanking */31363136- if (noblanking)31373137- return 0;31383138-31393139- switch (blank_mode) {31403140-31413141- case FB_BLANK_UNBLANK:31423142- case FB_BLANK_NORMAL:31433143- /* printk("turn on panel\n"); */31443144- au1200_setpanel(panel);31453145- break;31463146- case FB_BLANK_VSYNC_SUSPEND:31473147- case FB_BLANK_HSYNC_SUSPEND:31483148- case FB_BLANK_POWERDOWN:31493149- /* printk("turn off panel\n"); */31503150- au1200_setpanel(NULL);31513151- break;31523152- default:31533153- break;31543154-31553155- }31563156-31573157- /* FB_BLANK_NORMAL is a soft blank */31583158- return (blank_mode == FB_BLANK_NORMAL) ? -EINVAL : 0;31593159-}31603160-31613161-/* fb_mmap31623162- * Map video memory in user space. We don't use the generic fb_mmap31633163- * method mainly to allow the use of the TLB streaming flag (CCA=6)31643164- */31653165-static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)31663166-31673167-{31683168- unsigned int len;31693169- unsigned long start=0, off;31703170- struct au1200fb_device *fbdev = (struct au1200fb_device *) info;31713171-31723172-#ifdef CONFIG_PM31733173- au1xxx_pm_access(LCD_pm_dev);31743174-#endif31753175-31763176- if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) {31773177- return -EINVAL;31783178- }31793179-31803180- start = fbdev->fb_phys & PAGE_MASK;31813181- len = PAGE_ALIGN((start & ~PAGE_MASK) + fbdev->fb_len);31823182-31833183- off = vma->vm_pgoff << PAGE_SHIFT;31843184-31853185- if ((vma->vm_end - vma->vm_start + off) > len) {31863186- return -EINVAL;31873187- }31883188-31893189- off += start;31903190- vma->vm_pgoff = off >> PAGE_SHIFT;31913191-31923192- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);31933193- pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */31943194-31953195- vma->vm_flags |= VM_IO;31963196-31973197- return io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT,31983198- vma->vm_end - vma->vm_start,31993199- vma->vm_page_prot);32003200-32013201- return 0;32023202-}32033203-32043204-static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata)32053205-{32063206-32073207- unsigned int hi1, divider;32083208-32093209- /* SCREEN_SIZE: user cannot reset size, must switch panel choice */32103210-32113211- if (pdata->flags & SCREEN_BACKCOLOR)32123212- lcd->backcolor = pdata->backcolor;32133213-32143214- if (pdata->flags & SCREEN_BRIGHTNESS) {32153215-32163216- // limit brightness pwm duty to >= 30/160032173217- if (pdata->brightness < 30) {32183218- pdata->brightness = 30;32193219- }32203220- divider = (lcd->pwmdiv & 0x3FFFF) + 1;32213221- hi1 = (lcd->pwmhi >> 16) + 1;32223222- hi1 = (((pdata->brightness & 0xFF)+1) * divider >> 8);32233223- lcd->pwmhi &= 0xFFFF;32243224- lcd->pwmhi |= (hi1 << 16);32253225- }32263226-32273227- if (pdata->flags & SCREEN_COLORKEY)32283228- lcd->colorkey = pdata->colorkey;32293229-32303230- if (pdata->flags & SCREEN_MASK)32313231- lcd->colorkeymsk = pdata->mask;32323232- au_sync();32333233-}32343234-32353235-static void get_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata)32363236-{32373237- unsigned int hi1, divider;32383238-32393239- pdata->xsize = ((lcd->screen & LCD_SCREEN_SX) >> 19) + 1;32403240- pdata->ysize = ((lcd->screen & LCD_SCREEN_SY) >> 8) + 1;32413241-32423242- pdata->backcolor = lcd->backcolor;32433243- pdata->colorkey = lcd->colorkey;32443244- pdata->mask = lcd->colorkeymsk;32453245-32463246- // brightness32473247- hi1 = (lcd->pwmhi >> 16) + 1;32483248- divider = (lcd->pwmdiv & 0x3FFFF) + 1;32493249- pdata->brightness = ((hi1 << 8) / divider) - 1;32503250- au_sync();32513251-}32523252-32533253-static void set_window(unsigned int plane,32543254- struct au1200_lcd_window_regs_t *pdata)32553255-{32563256- unsigned int val, bpp;32573257-32583258- /* Window control register 0 */32593259- if (pdata->flags & WIN_POSITION) {32603260- val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_OX |32613261- LCD_WINCTRL0_OY);32623262- val |= ((pdata->xpos << 21) & LCD_WINCTRL0_OX);32633263- val |= ((pdata->ypos << 10) & LCD_WINCTRL0_OY);32643264- lcd->window[plane].winctrl0 = val;32653265- }32663266- if (pdata->flags & WIN_ALPHA_COLOR) {32673267- val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_A);32683268- val |= ((pdata->alpha_color << 2) & LCD_WINCTRL0_A);32693269- lcd->window[plane].winctrl0 = val;32703270- }32713271- if (pdata->flags & WIN_ALPHA_MODE) {32723272- val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_AEN);32733273- val |= ((pdata->alpha_mode << 1) & LCD_WINCTRL0_AEN);32743274- lcd->window[plane].winctrl0 = val;32753275- }32763276-32773277- /* Window control register 1 */32783278- if (pdata->flags & WIN_PRIORITY) {32793279- val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PRI);32803280- val |= ((pdata->priority << 30) & LCD_WINCTRL1_PRI);32813281- lcd->window[plane].winctrl1 = val;32823282- }32833283- if (pdata->flags & WIN_CHANNEL) {32843284- val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PIPE);32853285- val |= ((pdata->channel << 29) & LCD_WINCTRL1_PIPE);32863286- lcd->window[plane].winctrl1 = val;32873287- }32883288- if (pdata->flags & WIN_BUFFER_FORMAT) {32893289- val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_FRM);32903290- val |= ((pdata->buffer_format << 25) & LCD_WINCTRL1_FRM);32913291- lcd->window[plane].winctrl1 = val;32923292- }32933293- if (pdata->flags & WIN_COLOR_ORDER) {32943294- val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_CCO);32953295- val |= ((pdata->color_order << 24) & LCD_WINCTRL1_CCO);32963296- lcd->window[plane].winctrl1 = val;32973297- }32983298- if (pdata->flags & WIN_PIXEL_ORDER) {32993299- val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PO);33003300- val |= ((pdata->pixel_order << 22) & LCD_WINCTRL1_PO);33013301- lcd->window[plane].winctrl1 = val;33023302- }33033303- if (pdata->flags & WIN_SIZE) {33043304- val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_SZX |33053305- LCD_WINCTRL1_SZY);33063306- val |= (((pdata->xsize << 11) - 1) & LCD_WINCTRL1_SZX);33073307- val |= (((pdata->ysize) - 1) & LCD_WINCTRL1_SZY);33083308- lcd->window[plane].winctrl1 = val;33093309- /* program buffer line width */33103310- bpp = winbpp(val) / 8;33113311- val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_BX);33123312- val |= (((pdata->xsize * bpp) << 8) & LCD_WINCTRL2_BX);33133313- lcd->window[plane].winctrl2 = val;33143314- }33153315-33163316- /* Window control register 2 */33173317- if (pdata->flags & WIN_COLORKEY_MODE) {33183318- val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_CKMODE);33193319- val |= ((pdata->colorkey_mode << 24) & LCD_WINCTRL2_CKMODE);33203320- lcd->window[plane].winctrl2 = val;33213321- }33223322- if (pdata->flags & WIN_DOUBLE_BUFFER_MODE) {33233323- val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_DBM);33243324- val |= ((pdata->double_buffer_mode << 23) & LCD_WINCTRL2_DBM);33253325- lcd->window[plane].winctrl2 = val;33263326- }33273327- if (pdata->flags & WIN_RAM_ARRAY_MODE) {33283328- val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_RAM);33293329- val |= ((pdata->ram_array_mode << 21) & LCD_WINCTRL2_RAM);33303330- lcd->window[plane].winctrl2 = val;33313331- }33323332-33333333- /* Buffer line width programmed with WIN_SIZE */33343334-33353335- if (pdata->flags & WIN_BUFFER_SCALE) {33363336- val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_SCX |33373337- LCD_WINCTRL2_SCY);33383338- val |= ((pdata->xsize << 11) & LCD_WINCTRL2_SCX);33393339- val |= ((pdata->ysize) & LCD_WINCTRL2_SCY);33403340- lcd->window[plane].winctrl2 = val;33413341- }33423342-33433343- if (pdata->flags & WIN_ENABLE) {33443344- val = lcd->winenable;33453345- val &= ~(1<<plane);33463346- val |= (pdata->enable & 1) << plane;33473347- lcd->winenable = val;33483348- }33493349- au_sync();33503350-}33513351-33523352-static void get_window(unsigned int plane,33533353- struct au1200_lcd_window_regs_t *pdata)33543354-{33553355- /* Window control register 0 */33563356- pdata->xpos = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_OX) >> 21;33573357- pdata->ypos = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_OY) >> 10;33583358- pdata->alpha_color = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_A) >> 2;33593359- pdata->alpha_mode = (lcd->window[plane].winctrl0 & LCD_WINCTRL0_AEN) >> 1;33603360-33613361- /* Window control register 1 */33623362- pdata->priority = (lcd->window[plane].winctrl1& LCD_WINCTRL1_PRI) >> 30;33633363- pdata->channel = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_PIPE) >> 29;33643364- pdata->buffer_format = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_FRM) >> 25;33653365- pdata->color_order = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_CCO) >> 24;33663366- pdata->pixel_order = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_PO) >> 22;33673367- pdata->xsize = ((lcd->window[plane].winctrl1 & LCD_WINCTRL1_SZX) >> 11) + 1;33683368- pdata->ysize = (lcd->window[plane].winctrl1 & LCD_WINCTRL1_SZY) + 1;33693369-33703370- /* Window control register 2 */33713371- pdata->colorkey_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_CKMODE) >> 24;33723372- pdata->double_buffer_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_DBM) >> 23;33733373- pdata->ram_array_mode = (lcd->window[plane].winctrl2 & LCD_WINCTRL2_RAM) >> 21;33743374-33753375- pdata->enable = (lcd->winenable >> plane) & 1;33763376- au_sync();33773377-}33783378-33793379-static int au1200fb_ioctl(struct fb_info *info, unsigned int cmd,33803380- unsigned long arg)33813381-{33823382- int plane;33833383- int val;33843384-33853385-#ifdef CONFIG_PM33863386- au1xxx_pm_access(LCD_pm_dev);33873387-#endif33883388-33893389- plane = fbinfo2index(info);33903390- print_dbg("au1200fb: ioctl %d on plane %d\n", cmd, plane);33913391-33923392- if (cmd == AU1200_LCD_FB_IOCTL) {33933393- struct au1200_lcd_iodata_t iodata;33943394-33953395- if (copy_from_user(&iodata, (void __user *) arg, sizeof(iodata)))33963396- return -EFAULT;33973397-33983398- print_dbg("FB IOCTL called\n");33993399-34003400- switch (iodata.subcmd) {34013401- case AU1200_LCD_SET_SCREEN:34023402- print_dbg("AU1200_LCD_SET_SCREEN\n");34033403- set_global(cmd, &iodata.global);34043404- break;34053405-34063406- case AU1200_LCD_GET_SCREEN:34073407- print_dbg("AU1200_LCD_GET_SCREEN\n");34083408- get_global(cmd, &iodata.global);34093409- break;34103410-34113411- case AU1200_LCD_SET_WINDOW:34123412- print_dbg("AU1200_LCD_SET_WINDOW\n");34133413- set_window(plane, &iodata.window);34143414- break;34153415-34163416- case AU1200_LCD_GET_WINDOW:34173417- print_dbg("AU1200_LCD_GET_WINDOW\n");34183418- get_window(plane, &iodata.window);34193419- break;34203420-34213421- case AU1200_LCD_SET_PANEL:34223422- print_dbg("AU1200_LCD_SET_PANEL\n");34233423- if ((iodata.global.panel_choice >= 0) &&34243424- (iodata.global.panel_choice <34253425- NUM_PANELS))34263426- {34273427- struct panel_settings *newpanel;34283428- panel_index = iodata.global.panel_choice;34293429- newpanel = &known_lcd_panels[panel_index];34303430- au1200_setpanel(newpanel);34313431- }34323432- break;34333433-34343434- case AU1200_LCD_GET_PANEL:34353435- print_dbg("AU1200_LCD_GET_PANEL\n");34363436- iodata.global.panel_choice = panel_index;34373437- break;34383438-34393439- default:34403440- return -EINVAL;34413441- }34423442-34433443- val = copy_to_user((void __user *) arg, &iodata, sizeof(iodata));34443444- if (val) {34453445- print_dbg("error: could not copy %d bytes\n", val);34463446- return -EFAULT;34473447- }34483448- }34493449-34503450- return 0;34513451-}34523452-34533453-34543454-static struct fb_ops au1200fb_fb_ops = {34553455- .owner = THIS_MODULE,34563456- .fb_check_var = au1200fb_fb_check_var,34573457- .fb_set_par = au1200fb_fb_set_par,34583458- .fb_setcolreg = au1200fb_fb_setcolreg,34593459- .fb_blank = au1200fb_fb_blank,34603460- .fb_fillrect = cfb_fillrect,34613461- .fb_copyarea = cfb_copyarea,34623462- .fb_imageblit = cfb_imageblit,34633463- .fb_sync = NULL,34643464- .fb_ioctl = au1200fb_ioctl,34653465- .fb_mmap = au1200fb_fb_mmap,34663466-};34673467-34683468-/*-------------------------------------------------------------------------*/34693469-34703470-static irqreturn_t au1200fb_handle_irq(int irq, void* dev_id, struct pt_regs *regs)34713471-{34723472- /* Nothing to do for now, just clear any pending interrupt */34733473- lcd->intstatus = lcd->intstatus;34743474- au_sync();34753475-34763476- return IRQ_HANDLED;34773477-}34783478-34793479-/*-------------------------------------------------------------------------*/34803480-34813481-/* AU1200 LCD device probe helpers */34823482-34833483-static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev)34843484-{34853485- struct fb_info *fbi = &fbdev->fb_info;34863486- int bpp;34873487-34883488- memset(fbi, 0, sizeof(struct fb_info));34893489- fbi->fbops = &au1200fb_fb_ops;34903490-34913491- bpp = winbpp(win->w[fbdev->plane].mode_winctrl1);34923492-34933493- /* Copy monitor specs from panel data */34943494- /* fixme: we're setting up LCD controller windows, so these dont give a34953495- damn as to what the monitor specs are (the panel itself does, but that34963496- isnt done here...so maybe need a generic catchall monitor setting??? */34973497- memcpy(&fbi->monspecs, &panel->monspecs, sizeof(struct fb_monspecs));34983498-34993499- /* We first try the user mode passed in argument. If that failed,35003500- * or if no one has been specified, we default to the first mode of the35013501- * panel list. Note that after this call, var data will be set */35023502- if (!fb_find_mode(&fbi->var,35033503- fbi,35043504- NULL, /* drv_info.opt_mode, */35053505- fbi->monspecs.modedb,35063506- fbi->monspecs.modedb_len,35073507- fbi->monspecs.modedb,35083508- bpp)) {35093509-35103510- print_err("Cannot find valid mode for panel %s", panel->name);35113511- return -EFAULT;35123512- }35133513-35143514- fbi->pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL);35153515- if (!fbi->pseudo_palette) {35163516- return -ENOMEM;35173517- }35183518- memset(fbi->pseudo_palette, 0, sizeof(u32) * 16);35193519-35203520- if (fb_alloc_cmap(&fbi->cmap, AU1200_LCD_NBR_PALETTE_ENTRIES, 0) < 0) {35213521- print_err("Fail to allocate colormap (%d entries)",35223522- AU1200_LCD_NBR_PALETTE_ENTRIES);35233523- kfree(fbi->pseudo_palette);35243524- return -EFAULT;35253525- }35263526-35273527- strncpy(fbi->fix.id, "AU1200", sizeof(fbi->fix.id));35283528- fbi->fix.smem_start = fbdev->fb_phys;35293529- fbi->fix.smem_len = fbdev->fb_len;35303530- fbi->fix.type = FB_TYPE_PACKED_PIXELS;35313531- fbi->fix.xpanstep = 0;35323532- fbi->fix.ypanstep = 0;35333533- fbi->fix.mmio_start = 0;35343534- fbi->fix.mmio_len = 0;35353535- fbi->fix.accel = FB_ACCEL_NONE;35363536-35373537- fbi->screen_base = (char __iomem *) fbdev->fb_mem;35383538-35393539- au1200fb_update_fbinfo(fbi);35403540-35413541- return 0;35423542-}35433543-35443544-/*-------------------------------------------------------------------------*/35453545-35463546-/* AU1200 LCD controller device driver */35473547-35483548-static int au1200fb_drv_probe(struct device *dev)35493549-{35503550- struct au1200fb_device *fbdev;35513551- unsigned long page;35523552- int bpp, plane, ret;35533553-35543554- if (!dev)35553555- return -EINVAL;35563556-35573557- for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) {35583558- bpp = winbpp(win->w[plane].mode_winctrl1);35593559- if (win->w[plane].xres == 0)35603560- win->w[plane].xres = panel->Xres;35613561- if (win->w[plane].yres == 0)35623562- win->w[plane].yres = panel->Yres;35633563-35643564- fbdev = &_au1200fb_devices[plane];35653565- memset(fbdev, 0, sizeof(struct au1200fb_device));35663566- fbdev->plane = plane;35673567-35683568- /* Allocate the framebuffer to the maximum screen size */35693569- fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8;35703570-35713571- fbdev->fb_mem = dma_alloc_noncoherent(dev,35723572- PAGE_ALIGN(fbdev->fb_len),35733573- &fbdev->fb_phys, GFP_KERNEL);35743574- if (!fbdev->fb_mem) {35753575- print_err("fail to allocate frambuffer (size: %dK))",35763576- fbdev->fb_len / 1024);35773577- return -ENOMEM;35783578- }35793579-35803580- /*35813581- * Set page reserved so that mmap will work. This is necessary35823582- * since we'll be remapping normal memory.35833583- */35843584- for (page = (unsigned long)fbdev->fb_phys;35853585- page < PAGE_ALIGN((unsigned long)fbdev->fb_phys +35863586- fbdev->fb_len);35873587- page += PAGE_SIZE) {35883588- SetPageReserved(pfn_to_page(page >> PAGE_SHIFT)); /* LCD DMA is NOT coherent on Au1200 */35893589- }35903590- print_dbg("Framebuffer memory map at %p", fbdev->fb_mem);35913591- print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024);35923592-35933593- /* Init FB data */35943594- if ((ret = au1200fb_init_fbinfo(fbdev)) < 0)35953595- goto failed;35963596-35973597- /* Register new framebuffer */35983598- if ((ret = register_framebuffer(&fbdev->fb_info)) < 0) {35993599- print_err("cannot register new framebuffer");36003600- goto failed;36013601- }36023602-36033603- au1200fb_fb_set_par(&fbdev->fb_info);36043604-36053605-#if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO)36063606- if (plane == 0)36073607- if (fb_prepare_logo(&fbdev->fb_info, FB_ROTATE_UR)) {36083608- /* Start display and show logo on boot */36093609- fb_set_cmap(&fbdev->fb_info.cmap,36103610- &fbdev->fb_info);36113611-36123612- fb_show_logo(&fbdev->fb_info, FB_ROTATE_UR);36133613- }36143614-#endif36153615- }36163616-36173617- /* Now hook interrupt too */36183618- if ((ret = request_irq(AU1200_LCD_INT, au1200fb_handle_irq,36193619- SA_INTERRUPT | SA_SHIRQ, "lcd", (void *)dev)) < 0) {36203620- print_err("fail to request interrupt line %d (err: %d)",36213621- AU1200_LCD_INT, ret);36223622- goto failed;36233623- }36243624-36253625- return 0;36263626-36273627-failed:36283628- /* NOTE: This only does the current plane/window that failed; others are still active */36293629- if (fbdev->fb_mem)36303630- dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len),36313631- fbdev->fb_mem, fbdev->fb_phys);36323632- if (fbdev->fb_info.cmap.len != 0)36333633- fb_dealloc_cmap(&fbdev->fb_info.cmap);36343634- if (fbdev->fb_info.pseudo_palette)36353635- kfree(fbdev->fb_info.pseudo_palette);36363636- if (plane == 0)36373637- free_irq(AU1200_LCD_INT, (void*)dev);36383638- return ret;36393639-}36403640-36413641-static int au1200fb_drv_remove(struct device *dev)36423642-{36433643- struct au1200fb_device *fbdev;36443644- int plane;36453645-36463646- if (!dev)36473647- return -ENODEV;36483648-36493649- /* Turn off the panel */36503650- au1200_setpanel(NULL);36513651-36523652- for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane)36533653- {36543654- fbdev = &_au1200fb_devices[plane];36553655-36563656- /* Clean up all probe data */36573657- unregister_framebuffer(&fbdev->fb_info);36583658- if (fbdev->fb_mem)36593659- dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len),36603660- fbdev->fb_mem, fbdev->fb_phys);36613661- if (fbdev->fb_info.cmap.len != 0)36623662- fb_dealloc_cmap(&fbdev->fb_info.cmap);36633663- if (fbdev->fb_info.pseudo_palette)36643664- kfree(fbdev->fb_info.pseudo_palette);36653665- }36663666-36673667- free_irq(AU1200_LCD_INT, (void *)dev);36683668-36693669- return 0;36703670-}36713671-36723672-#ifdef CONFIG_PM36733673-static int au1200fb_drv_suspend(struct device *dev, u32 state, u32 level)36743674-{36753675- /* TODO */36763676- return 0;36773677-}36783678-36793679-static int au1200fb_drv_resume(struct device *dev, u32 level)36803680-{36813681- /* TODO */36823682- return 0;36833683-}36843684-#endif /* CONFIG_PM */36853685-36863686-static struct device_driver au1200fb_driver = {36873687- .name = "au1200-lcd",36883688- .bus = &platform_bus_type,36893689- .probe = au1200fb_drv_probe,36903690- .remove = au1200fb_drv_remove,36913691-#ifdef CONFIG_PM36923692- .suspend = au1200fb_drv_suspend,36933693- .resume = au1200fb_drv_resume,36943694-#endif36953695-};36963696-36973697-/*-------------------------------------------------------------------------*/36983698-36993699-/* Kernel driver */37003700-37013701-static void au1200fb_setup(void)37023702-{37033703- char* options = NULL;37043704- char* this_opt;37053705- int num_panels = ARRAY_SIZE(known_lcd_panels);37063706- int panel_idx = -1;37073707-37083708- fb_get_options(DRIVER_NAME, &options);37093709-37103710- if (options) {37113711- while ((this_opt = strsep(&options,",")) != NULL) {37123712- /* Panel option - can be panel name,37133713- * "bs" for board-switch, or number/index */37143714- if (!strncmp(this_opt, "panel:", 6)) {37153715- int i;37163716- long int li;37173717- char *endptr;37183718- this_opt += 6;37193719- /* First check for index, which allows37203720- * to short circuit this mess */37213721- li = simple_strtol(this_opt, &endptr, 0);37223722- if (*endptr == '\0') {37233723- panel_idx = (int)li;37243724- }37253725- else if (strcmp(this_opt, "bs") == 0) {37263726- extern int board_au1200fb_panel(void);37273727- panel_idx = board_au1200fb_panel();37283728- }37293729-37303730- else37313731- for (i = 0; i < num_panels; i++) {37323732- if (!strcmp(this_opt, known_lcd_panels[i].name)) {37333733- panel_idx = i;37343734- break;37353735- }37363736- }37373737-37383738- if ((panel_idx < 0) || (panel_idx >= num_panels)) {37393739- print_warn("Panel %s not supported!", this_opt);37403740- }37413741- else37423742- panel_index = panel_idx;37433743- }37443744-37453745- else if (strncmp(this_opt, "nohwcursor", 10) == 0) {37463746- nohwcursor = 1;37473747- }37483748-37493749- /* Unsupported option */37503750- else {37513751- print_warn("Unsupported option \"%s\"", this_opt);37523752- }37533753- }37543754- }37553755-}37563756-37573757-#ifdef CONFIG_PM37583758-static int au1200fb_pm_callback(au1xxx_power_dev_t *dev,37593759- au1xxx_request_t request, void *data) {37603760- int retval = -1;37613761- unsigned int d = 0;37623762- unsigned int brightness = 0;37633763-37643764- if (request == AU1XXX_PM_SLEEP) {37653765- board_au1200fb_panel_shutdown();37663766- }37673767- else if (request == AU1XXX_PM_WAKEUP) {37683768- if(dev->prev_state == SLEEP_STATE)37693769- {37703770- int plane;37713771- au1200_setpanel(panel);37723772- for (plane = 0; plane < CONFIG_FB_AU1200_DEVS; ++plane) {37733773- struct au1200fb_device *fbdev;37743774- fbdev = &_au1200fb_devices[plane];37753775- au1200fb_fb_set_par(&fbdev->fb_info);37763776- }37773777- }37783778-37793779- d = *((unsigned int*)data);37803780- if(d <=10) brightness = 26;37813781- else if(d<=20) brightness = 51;37823782- else if(d<=30) brightness = 77;37833783- else if(d<=40) brightness = 102;37843784- else if(d<=50) brightness = 128;37853785- else if(d<=60) brightness = 153;37863786- else if(d<=70) brightness = 179;37873787- else if(d<=80) brightness = 204;37883788- else if(d<=90) brightness = 230;37893789- else brightness = 255;37903790- set_brightness(brightness);37913791- } else if (request == AU1XXX_PM_GETSTATUS) {37923792- return dev->cur_state;37933793- } else if (request == AU1XXX_PM_ACCESS) {37943794- if (dev->cur_state != SLEEP_STATE)37953795- return retval;37963796- else {37973797- au1200_setpanel(panel);37983798- }37993799- } else if (request == AU1XXX_PM_IDLE) {38003800- } else if (request == AU1XXX_PM_CLEANUP) {38013801- }38023802-38033803- return retval;38043804-}38053805-#endif38063806-38073807-static int __init au1200fb_init(void)38083808-{38093809- print_info("" DRIVER_DESC "");38103810-38113811- /* Setup driver with options */38123812- au1200fb_setup();38133813-38143814- /* Point to the panel selected */38153815- panel = &known_lcd_panels[panel_index];38163816- win = &windows[window_index];38173817-38183818- printk(DRIVER_NAME ": Panel %d %s\n", panel_index, panel->name);38193819- printk(DRIVER_NAME ": Win %d %s\n", window_index, win->name);38203820-38213821- /* Kickstart the panel, the framebuffers/windows come soon enough */38223822- au1200_setpanel(panel);38233823-38243824- #ifdef CONFIG_PM38253825- LCD_pm_dev = new_au1xxx_power_device("LCD", &au1200fb_pm_callback, NULL);38263826- if ( LCD_pm_dev == NULL)38273827- printk(KERN_INFO "Unable to create a power management device entry for the au1200fb.\n");38283828- else38293829- printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n");38303830- #endif38313831-38323832- return driver_register(&au1200fb_driver);38333833-}38343834-38353835-static void __exit au1200fb_cleanup(void)38363836-{38373837- driver_unregister(&au1200fb_driver);38383838-}38393839-38403840-module_init(au1200fb_init);38413841-module_exit(au1200fb_cleanup);38423842-38433843-MODULE_DESCRIPTION(DRIVER_DESC);38443844-MODULE_LICENSE("GPL");
+1-1
fs/stat.c
···261261 return error;262262}263263264264-#ifndef __ARCH_WANT_STAT64264264+#if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT)265265asmlinkage long sys_newfstatat(int dfd, char __user *filename,266266 struct stat __user *statbuf, int flag)267267{
+2-2
include/asm-i386/i387.h
···5858 alternative_input(5959 "fnsave %[fx] ;fwait;" GENERIC_NOP8 GENERIC_NOP4,6060 "fxsave %[fx]\n"6161- "bt $7,%[fsw] ; jc 1f ; fnclex\n1:",6161+ "bt $7,%[fsw] ; jnc 1f ; fnclex\n1:",6262 X86_FEATURE_FXSR,6363 [fx] "m" (tsk->thread.i387.fxsave),6464 [fsw] "m" (tsk->thread.i387.fxsave.swd) : "memory");6565 /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception6666 is pending. Clear the x87 state here by setting it to fixed6767- values. __per_cpu_offset[0] is a random variable that should be in L1 */6767+ values. safe_address is a random variable that should be in L1 */6868 alternative_input(6969 GENERIC_NOP8 GENERIC_NOP2,7070 "emms\n\t" /* clear stack tags */
···99 * 2 of the License, or (at your option) any later version.1010 */11111212+/* Check of existence of legacy devices */1313+extern int check_legacy_ioport(unsigned long base_port);1414+1215#ifndef CONFIG_PPC641316#include <asm-ppc/io.h>1417#else···439436#define dma_cache_inv(_start,_size) do { } while (0)440437#define dma_cache_wback(_start,_size) do { } while (0)441438#define dma_cache_wback_inv(_start,_size) do { } while (0)442442-443443-/* Check of existence of legacy devices */444444-extern int check_legacy_ioport(unsigned long base_port);445439446440447441/*
···3939#error "need definition of ppc_sys_devices"4040#endif41414242+#define PPC_SYS_IORESOURCE_FIXUPPED 0x00000001 4343+4244struct ppc_sys_spec {4345 /* PPC sys is matched via (ID & mask) == value, id could be4446 * PVR, SVR, IMMR, * etc. */
+1
include/asm-ppc/reg_booke.h
···237237#endif238238239239/* Bit definitions for CCR1. */240240+#define CCR1_DPC 0x00000100 /* Disable L1 I-Cache/D-Cache parity checking */240241#define CCR1_TCS 0x00000080 /* Timer Clock Select */241242242243/* Bit definitions for the MCSR. */