Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
[SPARC]: Fix O_CLOEXEC values.
[SPARC32]: Fix modular build of floppy driver.
[SOUND] CS4231 SBus: Two fixes.
[CG6]: fix memory size detection
[SPARC64]: Add missing dma_sync_single_range_for_*().

+105 -84
+3 -4
arch/sparc/kernel/entry.S
··· 1 - /* $Id: entry.S,v 1.170 2001/11/13 00:57:05 davem Exp $ 2 - * arch/sparc/kernel/entry.S: Sparc trap low-level entry points. 1 + /* arch/sparc/kernel/entry.S: Sparc trap low-level entry points. 3 2 * 4 - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 3 + * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net) 5 4 * Copyright (C) 1996 Eddie C. Dost (ecd@skynet.be) 6 5 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) 7 6 * Copyright (C) 1996-1999 Jakub Jelinek (jj@sunsite.mff.cuni.cz) ··· 128 129 RESTORE_ALL 129 130 #endif 130 131 131 - #ifdef CONFIG_BLK_DEV_FD 132 + #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE) 132 133 .text 133 134 .align 4 134 135 .globl floppy_hardint
+59 -25
arch/sparc/kernel/irq.c
··· 351 351 set_irq_regs(old_regs); 352 352 } 353 353 354 - #ifdef CONFIG_BLK_DEV_FD 355 - extern void floppy_interrupt(int irq, void *dev_id); 356 - 357 - void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs) 358 - { 359 - struct pt_regs *old_regs; 360 - int cpu = smp_processor_id(); 361 - 362 - old_regs = set_irq_regs(regs); 363 - disable_pil_irq(irq); 364 - irq_enter(); 365 - kstat_cpu(cpu).irqs[irq]++; 366 - floppy_interrupt(irq, dev_id); 367 - irq_exit(); 368 - enable_pil_irq(irq); 369 - set_irq_regs(old_regs); 370 - // XXX Eek, it's totally changed with preempt_count() and such 371 - // if (softirq_pending(cpu)) 372 - // do_softirq(); 373 - } 374 - #endif 354 + #if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE) 375 355 376 356 /* Fast IRQs on the Sparc can only have one routine attached to them, 377 357 * thus no sharing possible. 378 358 */ 379 - int request_fast_irq(unsigned int irq, 380 - irq_handler_t handler, 381 - unsigned long irqflags, const char *devname) 359 + static int request_fast_irq(unsigned int irq, 360 + void (*handler)(void), 361 + unsigned long irqflags, const char *devname) 382 362 { 383 363 struct irqaction *action; 384 364 unsigned long flags; ··· 437 457 */ 438 458 flush_cache_all(); 439 459 440 - action->handler = handler; 441 460 action->flags = irqflags; 442 461 cpus_clear(action->mask); 443 462 action->name = devname; ··· 453 474 out: 454 475 return ret; 455 476 } 477 + 478 + /* These variables are used to access state from the assembler 479 + * interrupt handler, floppy_hardint, so we cannot put these in 480 + * the floppy driver image because that would not work in the 481 + * modular case. 482 + */ 483 + volatile unsigned char *fdc_status; 484 + EXPORT_SYMBOL(fdc_status); 485 + 486 + char *pdma_vaddr; 487 + EXPORT_SYMBOL(pdma_vaddr); 488 + 489 + unsigned long pdma_size; 490 + EXPORT_SYMBOL(pdma_size); 491 + 492 + volatile int doing_pdma; 493 + EXPORT_SYMBOL(doing_pdma); 494 + 495 + char *pdma_base; 496 + EXPORT_SYMBOL(pdma_base); 497 + 498 + unsigned long pdma_areasize; 499 + EXPORT_SYMBOL(pdma_areasize); 500 + 501 + extern void floppy_hardint(void); 502 + 503 + static irqreturn_t (*floppy_irq_handler)(int irq, void *dev_id); 504 + 505 + void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs) 506 + { 507 + struct pt_regs *old_regs; 508 + int cpu = smp_processor_id(); 509 + 510 + old_regs = set_irq_regs(regs); 511 + disable_pil_irq(irq); 512 + irq_enter(); 513 + kstat_cpu(cpu).irqs[irq]++; 514 + floppy_irq_handler(irq, dev_id); 515 + irq_exit(); 516 + enable_pil_irq(irq); 517 + set_irq_regs(old_regs); 518 + // XXX Eek, it's totally changed with preempt_count() and such 519 + // if (softirq_pending(cpu)) 520 + // do_softirq(); 521 + } 522 + 523 + int sparc_floppy_request_irq(int irq, unsigned long flags, 524 + irqreturn_t (*irq_handler)(int irq, void *)) 525 + { 526 + floppy_irq_handler = irq_handler; 527 + return request_fast_irq(irq, floppy_hardint, flags, "floppy"); 528 + } 529 + EXPORT_SYMBOL(sparc_floppy_request_irq); 530 + 531 + #endif 456 532 457 533 int request_irq(unsigned int irq, 458 534 irq_handler_t handler,
-1
arch/sparc/kernel/sparc_ksyms.c
··· 143 143 EXPORT_SYMBOL(set_auxio); 144 144 EXPORT_SYMBOL(get_auxio); 145 145 #endif 146 - EXPORT_SYMBOL(request_fast_irq); 147 146 EXPORT_SYMBOL(io_remap_pfn_range); 148 147 /* P3: iounit_xxx may be needed, sun4d users */ 149 148 /* EXPORT_SYMBOL(iounit_map_dma_init); */
+4 -1
drivers/video/cg6.c
··· 677 677 struct fb_info *info; 678 678 struct cg6_par *par; 679 679 int linebytes, err; 680 + int dblbuf; 680 681 681 682 info = framebuffer_alloc(sizeof(struct cg6_par), &op->dev); 682 683 ··· 699 698 linebytes = of_getintprop_default(dp, "linebytes", 700 699 info->var.xres); 701 700 par->fbsize = PAGE_ALIGN(linebytes * info->var.yres); 702 - if (of_find_property(dp, "dblbuf", NULL)) 701 + 702 + dblbuf = of_getintprop_default(dp, "dblbuf", 0); 703 + if (dblbuf) 703 704 par->fbsize *= 4; 704 705 705 706 par->fbc = of_ioremap(&op->resource[0], CG6_FBC_OFFSET,
+1 -1
include/asm-sparc/fcntl.h
··· 16 16 #define O_LARGEFILE 0x40000 17 17 #define O_DIRECT 0x100000 /* direct disk access hint */ 18 18 #define O_NOATIME 0x200000 19 + #define O_CLOEXEC 0x400000 19 20 20 21 #define F_GETOWN 5 /* for sockets. */ 21 22 #define F_SETOWN 6 /* for sockets. */ ··· 32 31 #define __ARCH_FLOCK_PAD short __unused; 33 32 #define __ARCH_FLOCK64_PAD short __unused; 34 33 35 - #include <asm-generic/fcntl.h> 36 34 37 35 #endif
+11 -9
include/asm-sparc/floppy.h
··· 48 48 49 49 /* You'll only ever find one controller on a SparcStation anyways. */ 50 50 static struct sun_flpy_controller *sun_fdc = NULL; 51 - volatile unsigned char *fdc_status; 51 + extern volatile unsigned char *fdc_status; 52 52 53 53 struct sun_floppy_ops { 54 54 unsigned char (*fd_inb)(int port); ··· 225 225 * underruns. If non-zero, doing_pdma encodes the direction of 226 226 * the transfer for debugging. 1=read 2=write 227 227 */ 228 - char *pdma_vaddr; 229 - unsigned long pdma_size; 230 - volatile int doing_pdma = 0; 228 + extern char *pdma_vaddr; 229 + extern unsigned long pdma_size; 230 + extern volatile int doing_pdma; 231 231 232 232 /* This is software state */ 233 - char *pdma_base = NULL; 234 - unsigned long pdma_areasize; 233 + extern char *pdma_base; 234 + extern unsigned long pdma_areasize; 235 235 236 236 /* Common routines to all controller types on the Sparc. */ 237 237 static __inline__ void virtual_dma_init(void) ··· 281 281 } 282 282 283 283 /* Our low-level entry point in arch/sparc/kernel/entry.S */ 284 - irqreturn_t floppy_hardint(int irq, void *unused); 284 + extern int sparc_floppy_request_irq(int irq, unsigned long flags, 285 + irqreturn_t (*irq_handler)(int irq, void *)); 285 286 286 287 static int sun_fd_request_irq(void) 287 288 { ··· 291 290 292 291 if(!once) { 293 292 once = 1; 294 - error = request_fast_irq(FLOPPY_IRQ, floppy_hardint, 295 - IRQF_DISABLED, "floppy"); 293 + error = sparc_floppy_request_irq(FLOPPY_IRQ, 294 + IRQF_DISABLED, 295 + floppy_interrupt); 296 296 return ((error == 0) ? 0 : -1); 297 297 } else return 0; 298 298 }
+2 -5
include/asm-sparc/irq.h
··· 1 - /* $Id: irq.h,v 1.32 2000/08/26 02:42:28 anton Exp $ 2 - * irq.h: IRQ registers on the Sparc. 1 + /* irq.h: IRQ registers on the Sparc. 3 2 * 4 - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 3 + * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net) 5 4 */ 6 5 7 6 #ifndef _SPARC_IRQ_H ··· 11 12 #define NR_IRQS 16 12 13 13 14 #define irq_canonicalize(irq) (irq) 14 - 15 - extern int request_fast_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, __const__ char *devname); 16 15 17 16 #endif
+19
include/asm-sparc64/dma-mapping.h
··· 108 108 dma_ops->sync_single_for_device(dev, dma_handle, size, direction); 109 109 } 110 110 111 + static inline void dma_sync_single_range_for_cpu(struct device *dev, 112 + dma_addr_t dma_handle, 113 + unsigned long offset, 114 + size_t size, 115 + enum dma_data_direction direction) 116 + { 117 + dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction); 118 + } 119 + 120 + static inline void dma_sync_single_range_for_device(struct device *dev, 121 + dma_addr_t dma_handle, 122 + unsigned long offset, 123 + size_t size, 124 + enum dma_data_direction direction) 125 + { 126 + dma_sync_single_for_device(dev, dma_handle+offset, size, direction); 127 + } 128 + 129 + 111 130 static inline void dma_sync_sg_for_cpu(struct device *dev, 112 131 struct scatterlist *sg, int nelems, 113 132 enum dma_data_direction direction)
+1 -1
include/asm-sparc64/fcntl.h
··· 16 16 #define O_LARGEFILE 0x40000 17 17 #define O_DIRECT 0x100000 /* direct disk access hint */ 18 18 #define O_NOATIME 0x200000 19 - 19 + #define O_CLOEXEC 0x400000 20 20 21 21 #define F_GETOWN 5 /* for sockets. */ 22 22 #define F_SETOWN 6 /* for sockets. */
+5 -37
sound/sparc/cs4231.c
··· 74 74 void (*enable)(struct cs4231_dma_control *dma_cont, int on); 75 75 int (*request)(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len); 76 76 unsigned int (*address)(struct cs4231_dma_control *dma_cont); 77 - void (*reset)(struct snd_cs4231 *chip); 78 77 void (*preallocate)(struct snd_cs4231 *chip, struct snd_pcm *pcm); 79 78 #ifdef EBUS_SUPPORT 80 79 struct ebus_dma_info ebus_info; ··· 1213 1214 1214 1215 spin_lock_irqsave(&chip->lock, flags); 1215 1216 1216 - 1217 - /* Reset DMA engine (sbus only). */ 1218 - chip->p_dma.reset(chip); 1219 - 1220 1217 __cs4231_readb(chip, CS4231P(chip, STATUS)); /* clear any pendings IRQ */ 1221 1218 __cs4231_writeb(chip, 0, CS4231P(chip, STATUS)); 1222 1219 mb(); ··· 1856 1861 if (!on) { 1857 1862 sbus_writel(0, base->regs + base->dir + APCNC); 1858 1863 sbus_writel(0, base->regs + base->dir + APCNVA); 1859 - sbus_writel(0, base->regs + base->dir + APCC); 1860 - sbus_writel(0, base->regs + base->dir + APCVA); 1864 + if ( base->dir == APC_PLAY ) { 1865 + sbus_writel(0, base->regs + base->dir + APCC); 1866 + sbus_writel(0, base->regs + base->dir + APCVA); 1867 + } 1861 1868 1862 - /* ACK any APC interrupts. */ 1863 - csr = sbus_readl(base->regs + APCCSR); 1864 - sbus_writel(csr, base->regs + APCCSR); 1869 + udelay(1200); 1865 1870 } 1866 - udelay(1000); 1867 1871 csr = sbus_readl(base->regs + APCCSR); 1868 1872 shift = 0; 1869 1873 if ( base->dir == APC_PLAY ) ··· 1886 1892 struct sbus_dma_info *base = &dma_cont->sbus_info; 1887 1893 1888 1894 return sbus_readl(base->regs + base->dir + APCVA); 1889 - } 1890 - 1891 - static void sbus_dma_reset(struct snd_cs4231 *chip) 1892 - { 1893 - sbus_writel(APC_CHIP_RESET, chip->port + APCCSR); 1894 - sbus_writel(0x00, chip->port + APCCSR); 1895 - sbus_writel(sbus_readl(chip->port + APCCSR) | APC_CDC_RESET, 1896 - chip->port + APCCSR); 1897 - 1898 - udelay(20); 1899 - 1900 - sbus_writel(sbus_readl(chip->port + APCCSR) & ~APC_CDC_RESET, 1901 - chip->port + APCCSR); 1902 - sbus_writel(sbus_readl(chip->port + APCCSR) | (APC_XINT_ENA | 1903 - APC_XINT_PENA | 1904 - APC_XINT_CENA), 1905 - chip->port + APCCSR); 1906 1895 } 1907 1896 1908 1897 static void sbus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm) ··· 1963 1986 chip->p_dma.enable = sbus_dma_enable; 1964 1987 chip->p_dma.request = sbus_dma_request; 1965 1988 chip->p_dma.address = sbus_dma_addr; 1966 - chip->p_dma.reset = sbus_dma_reset; 1967 1989 chip->p_dma.preallocate = sbus_dma_preallocate; 1968 1990 1969 1991 chip->c_dma.prepare = sbus_dma_prepare; 1970 1992 chip->c_dma.enable = sbus_dma_enable; 1971 1993 chip->c_dma.request = sbus_dma_request; 1972 1994 chip->c_dma.address = sbus_dma_addr; 1973 - chip->c_dma.reset = sbus_dma_reset; 1974 1995 chip->c_dma.preallocate = sbus_dma_preallocate; 1975 1996 1976 1997 if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt, ··· 2062 2087 return ebus_dma_addr(&dma_cont->ebus_info); 2063 2088 } 2064 2089 2065 - static void _ebus_dma_reset(struct snd_cs4231 *chip) 2066 - { 2067 - return; 2068 - } 2069 - 2070 2090 static void _ebus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm) 2071 2091 { 2072 2092 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, ··· 2141 2171 chip->p_dma.enable = _ebus_dma_enable; 2142 2172 chip->p_dma.request = _ebus_dma_request; 2143 2173 chip->p_dma.address = _ebus_dma_addr; 2144 - chip->p_dma.reset = _ebus_dma_reset; 2145 2174 chip->p_dma.preallocate = _ebus_dma_preallocate; 2146 2175 2147 2176 chip->c_dma.prepare = _ebus_dma_prepare; 2148 2177 chip->c_dma.enable = _ebus_dma_enable; 2149 2178 chip->c_dma.request = _ebus_dma_request; 2150 2179 chip->c_dma.address = _ebus_dma_addr; 2151 - chip->c_dma.reset = _ebus_dma_reset; 2152 2180 chip->c_dma.preallocate = _ebus_dma_preallocate; 2153 2181 2154 2182 chip->port = ioremap(edev->resource[0].start, 0x10);