diff options
author | Linus Torvalds | 2007-07-20 17:35:25 -0700 |
---|---|---|
committer | Linus Torvalds | 2007-07-20 17:35:25 -0700 |
commit | c2e68052429fdf87702fccd272951282bef1c60a (patch) | |
tree | b9f3bf3918526af068ed264190a85fb18dd3d8b0 /include | |
parent | d6f410bdbcb435c744c4f8259d6659ae2c6e447a (diff) | |
parent | 1256efd5519a8eca2dfa6039ce5cf58f44d1626d (diff) |
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:
[SPARC64]: fix section mismatch warning in mdesc.c
[SPARC64]: fix section mismatch warning in pci_sunv4
[SPARC64]: Stop using drivers/char/rtc.c
[SPARC64]: Convert parport to of_platform_driver.
[SPARC]: Implement fb_is_primary_device().
[SPARC64]: Fix virq decomposition.
[SPARC64]: Use KERN_ERR in IRQ manipulation error printks.
[SPARC64]: Do not flood log with failed DS messages.
[SPARC64]: Add proper multicast support to VNET driver.
[SPARC64]: Handle multiple domain-services-port nodes properly.
[SPARC64]: Improve VIO device naming further.
[SPARC]: Make sure dev_archdata is filled in for all devices.
[SPARC]: Define minimal struct dev_archdata, similarly to sparc64.
[SPARC]: Fix serial console device detection.
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-sparc/device.h | 14 | ||||
-rw-r--r-- | include/asm-sparc/fb.h | 9 | ||||
-rw-r--r-- | include/asm-sparc/oplib.h | 26 | ||||
-rw-r--r-- | include/asm-sparc/prom.h | 4 | ||||
-rw-r--r-- | include/asm-sparc64/fb.h | 9 | ||||
-rw-r--r-- | include/asm-sparc64/oplib.h | 28 | ||||
-rw-r--r-- | include/asm-sparc64/parport.h | 233 | ||||
-rw-r--r-- | include/asm-sparc64/prom.h | 4 | ||||
-rw-r--r-- | include/asm-sparc64/system.h | 6 |
9 files changed, 174 insertions, 159 deletions
diff --git a/include/asm-sparc/device.h b/include/asm-sparc/device.h index d8f9872b0e2d..4a56d84d69c4 100644 --- a/include/asm-sparc/device.h +++ b/include/asm-sparc/device.h @@ -3,5 +3,17 @@ * * This file is released under the GPLv2 */ -#include <asm-generic/device.h> +#ifndef _ASM_SPARC_DEVICE_H +#define _ASM_SPARC_DEVICE_H + +struct device_node; +struct of_device; + +struct dev_archdata { + struct device_node *prom_node; + struct of_device *op; +}; + +#endif /* _ASM_SPARC_DEVICE_H */ + diff --git a/include/asm-sparc/fb.h b/include/asm-sparc/fb.h index c7df38030992..c73ca081e1f5 100644 --- a/include/asm-sparc/fb.h +++ b/include/asm-sparc/fb.h @@ -1,11 +1,20 @@ #ifndef _ASM_FB_H_ #define _ASM_FB_H_ #include <linux/fb.h> +#include <asm/prom.h> #define fb_pgprotect(...) do {} while (0) static inline int fb_is_primary_device(struct fb_info *info) { + struct device *dev = info->device; + struct device_node *node; + + node = dev->archdata.prom_node; + if (node && + node == of_console_device) + return 1; + return 0; } diff --git a/include/asm-sparc/oplib.h b/include/asm-sparc/oplib.h index 91691e52c058..17ba82ee220a 100644 --- a/include/asm-sparc/oplib.h +++ b/include/asm-sparc/oplib.h @@ -158,32 +158,6 @@ extern void prom_putchar(char character); extern void prom_printf(char *fmt, ...); extern void prom_write(const char *buf, unsigned int len); -/* Query for input device type */ - -enum prom_input_device { - PROMDEV_IKBD, /* input from keyboard */ - PROMDEV_ITTYA, /* input from ttya */ - PROMDEV_ITTYB, /* input from ttyb */ - PROMDEV_IRSC, /* input from rsc */ - PROMDEV_IVCONS, /* input from virtual-console */ - PROMDEV_I_UNK, -}; - -extern enum prom_input_device prom_query_input_device(void); - -/* Query for output device type */ - -enum prom_output_device { - PROMDEV_OSCREEN, /* to screen */ - PROMDEV_OTTYA, /* to ttya */ - PROMDEV_OTTYB, /* to ttyb */ - PROMDEV_ORSC, /* to rsc */ - PROMDEV_OVCONS, /* to virtual-console */ - PROMDEV_O_UNK, -}; - -extern enum prom_output_device prom_query_output_device(void); - /* Multiprocessor operations... */ /* Start the CPU with the given device tree node, context table, and context diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h index db9feb75bd86..350676c589f9 100644 --- a/include/asm-sparc/prom.h +++ b/include/asm-sparc/prom.h @@ -85,5 +85,9 @@ static inline void of_node_put(struct device_node *node) */ #include <linux/of.h> +extern struct device_node *of_console_device; +extern char *of_console_path; +extern char *of_console_options; + #endif /* __KERNEL__ */ #endif /* _SPARC_PROM_H */ diff --git a/include/asm-sparc64/fb.h b/include/asm-sparc64/fb.h index d6cd3a175fc3..389012e5fbad 100644 --- a/include/asm-sparc64/fb.h +++ b/include/asm-sparc64/fb.h @@ -3,6 +3,7 @@ #include <linux/fb.h> #include <linux/fs.h> #include <asm/page.h> +#include <asm/prom.h> static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, unsigned long off) @@ -12,6 +13,14 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, static inline int fb_is_primary_device(struct fb_info *info) { + struct device *dev = info->device; + struct device_node *node; + + node = dev->archdata.prom_node; + if (node && + node == of_console_device) + return 1; + return 0; } diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h index 992f9f7a476c..3f23c5dc5f21 100644 --- a/include/asm-sparc64/oplib.h +++ b/include/asm-sparc64/oplib.h @@ -140,32 +140,6 @@ extern void prom_putchar(char character); extern void prom_printf(const char *fmt, ...); extern void prom_write(const char *buf, unsigned int len); -/* Query for input device type */ - -enum prom_input_device { - PROMDEV_IKBD, /* input from keyboard */ - PROMDEV_ITTYA, /* input from ttya */ - PROMDEV_ITTYB, /* input from ttyb */ - PROMDEV_IRSC, /* input from rsc */ - PROMDEV_IVCONS, /* input from virtual-console */ - PROMDEV_I_UNK, -}; - -extern enum prom_input_device prom_query_input_device(void); - -/* Query for output device type */ - -enum prom_output_device { - PROMDEV_OSCREEN, /* to screen */ - PROMDEV_OTTYA, /* to ttya */ - PROMDEV_OTTYB, /* to ttyb */ - PROMDEV_ORSC, /* to rsc */ - PROMDEV_OVCONS, /* to virtual-console */ - PROMDEV_O_UNK, -}; - -extern enum prom_output_device prom_query_output_device(void); - /* Multiprocessor operations... */ #ifdef CONFIG_SMP /* Start the CPU with the given device tree node at the passed program @@ -319,6 +293,8 @@ extern int prom_inst2pkg(int); extern int prom_service_exists(const char *service_name); extern void prom_sun4v_guest_soft_state(void); +extern int prom_ihandle2path(int handle, char *buffer, int bufsize); + /* Client interface level routines. */ extern void prom_set_trap_table(unsigned long tba); extern void prom_set_trap_table_sun4v(unsigned long tba, unsigned long mmfsa); diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h index 23cc63f049a8..600afe5ae2e3 100644 --- a/include/asm-sparc64/parport.h +++ b/include/asm-sparc64/parport.h @@ -8,8 +8,9 @@ #define _ASM_SPARC64_PARPORT_H 1 #include <asm/ebus.h> -#include <asm/isa.h> #include <asm/ns87303.h> +#include <asm/of_device.h> +#include <asm/prom.h> #define PARPORT_PC_MAX_PORTS PARPORT_MAX @@ -35,8 +36,12 @@ static struct sparc_ebus_info { unsigned int addr; unsigned int count; int lock; + + struct parport *port; } sparc_ebus_dmas[PARPORT_PC_MAX_PORTS]; +static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS); + static __inline__ int request_dma(unsigned int dmanr, const char *device_id) { if (dmanr >= PARPORT_PC_MAX_PORTS) @@ -98,117 +103,145 @@ static __inline__ unsigned int get_dma_residue(unsigned int dmanr) return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); } -static int ebus_ecpp_p(struct linux_ebus_device *edev) +static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match) { - if (!strcmp(edev->prom_node->name, "ecpp")) - return 1; - if (!strcmp(edev->prom_node->name, "parallel")) { - const char *compat; - - compat = of_get_property(edev->prom_node, - "compatible", NULL); - if (compat && - (!strcmp(compat, "ecpp") || - !strcmp(compat, "ns87317-ecpp") || - !strcmp(compat + 13, "ecpp"))) - return 1; + unsigned long base = op->resource[0].start; + unsigned long config = op->resource[1].start; + unsigned long d_base = op->resource[2].start; + unsigned long d_len; + struct device_node *parent; + struct parport *p; + int slot, err; + + parent = op->node->parent; + if (!strcmp(parent->name, "dma")) { + p = parport_pc_probe_port(base, base + 0x400, + op->irqs[0], PARPORT_DMA_NOFIFO, + op->dev.parent); + if (!p) + return -ENOMEM; + dev_set_drvdata(&op->dev, p); + return 0; } + + for (slot = 0; slot < PARPORT_PC_MAX_PORTS; slot++) { + if (!test_and_set_bit(slot, dma_slot_map)) + break; + } + err = -ENODEV; + if (slot >= PARPORT_PC_MAX_PORTS) + goto out_err; + + spin_lock_init(&sparc_ebus_dmas[slot].info.lock); + + d_len = (op->resource[2].end - d_base) + 1UL; + sparc_ebus_dmas[slot].info.regs = + of_ioremap(&op->resource[2], 0, d_len, "ECPP DMA"); + + if (!sparc_ebus_dmas[slot].info.regs) + goto out_clear_map; + + sparc_ebus_dmas[slot].info.flags = 0; + sparc_ebus_dmas[slot].info.callback = NULL; + sparc_ebus_dmas[slot].info.client_cookie = NULL; + sparc_ebus_dmas[slot].info.irq = 0xdeadbeef; + strcpy(sparc_ebus_dmas[slot].info.name, "parport"); + if (ebus_dma_register(&sparc_ebus_dmas[slot].info)) + goto out_unmap_regs; + + ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 1); + + /* Configure IRQ to Push Pull, Level Low */ + /* Enable ECP, set bit 2 of the CTR first */ + outb(0x04, base + 0x02); + ns87303_modify(config, PCR, + PCR_EPP_ENABLE | + PCR_IRQ_ODRAIN, + PCR_ECP_ENABLE | + PCR_ECP_CLK_ENA | + PCR_IRQ_POLAR); + + /* CTR bit 5 controls direction of port */ + ns87303_modify(config, PTR, + 0, PTR_LPT_REG_DIR); + + p = parport_pc_probe_port(base, base + 0x400, + op->irqs[0], + slot, + op->dev.parent); + err = -ENOMEM; + if (!p) + goto out_disable_irq; + + dev_set_drvdata(&op->dev, p); + return 0; + +out_disable_irq: + ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0); + ebus_dma_unregister(&sparc_ebus_dmas[slot].info); + +out_unmap_regs: + of_iounmap(&op->resource[2], sparc_ebus_dmas[slot].info.regs, d_len); + +out_clear_map: + clear_bit(slot, dma_slot_map); + +out_err: + return err; } -static int parport_isa_probe(int count) +static int __devexit ecpp_remove(struct of_device *op) { - struct sparc_isa_bridge *isa_br; - struct sparc_isa_device *isa_dev; - - for_each_isa(isa_br) { - for_each_isadev(isa_dev, isa_br) { - struct sparc_isa_device *child; - unsigned long base; - - if (strcmp(isa_dev->prom_node->name, "dma")) - continue; - - child = isa_dev->child; - while (child) { - if (!strcmp(child->prom_node->name, "parallel")) - break; - child = child->next; - } - if (!child) - continue; - - base = child->resource.start; - - /* No DMA, see commentary in - * asm-sparc64/floppy.h:isa_floppy_init() - */ - if (parport_pc_probe_port(base, base + 0x400, - child->irq, PARPORT_DMA_NOFIFO, - &child->bus->self->dev)) - count++; - } + struct parport *p = dev_get_drvdata(&op->dev); + int slot = p->dma; + + parport_pc_unregister_port(p); + + if (slot != PARPORT_DMA_NOFIFO) { + unsigned long d_base = op->resource[2].start; + unsigned long d_len; + + d_len = (op->resource[2].end - d_base) + 1UL; + + ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0); + ebus_dma_unregister(&sparc_ebus_dmas[slot].info); + of_iounmap(&op->resource[2], + sparc_ebus_dmas[slot].info.regs, + d_len); + clear_bit(slot, dma_slot_map); } - return count; + return 0; } -static int parport_pc_find_nonpci_ports (int autoirq, int autodma) +static struct of_device_id ecpp_match[] = { + { + .name = "ecpp", + }, + { + .name = "parallel", + .compatible = "ecpp", + }, + { + .name = "parallel", + .compatible = "ns87317-ecpp", + }, + {}, +}; + +static struct of_platform_driver ecpp_driver = { + .name = "ecpp", + .match_table = ecpp_match, + .probe = ecpp_probe, + .remove = __devexit_p(ecpp_remove), +}; + +static int parport_pc_find_nonpci_ports(int autoirq, int autodma) { - struct linux_ebus *ebus; - struct linux_ebus_device *edev; - int count = 0; - - for_each_ebus(ebus) { - for_each_ebusdev(edev, ebus) { - if (ebus_ecpp_p(edev)) { - unsigned long base = edev->resource[0].start; - unsigned long config = edev->resource[1].start; - unsigned long d_base = edev->resource[2].start; - unsigned long d_len; - - spin_lock_init(&sparc_ebus_dmas[count].info.lock); - d_len = (edev->resource[2].end - - d_base) + 1; - sparc_ebus_dmas[count].info.regs = - ioremap(d_base, d_len); - if (!sparc_ebus_dmas[count].info.regs) - continue; - sparc_ebus_dmas[count].info.flags = 0; - sparc_ebus_dmas[count].info.callback = NULL; - sparc_ebus_dmas[count].info.client_cookie = NULL; - sparc_ebus_dmas[count].info.irq = 0xdeadbeef; - strcpy(sparc_ebus_dmas[count].info.name, "parport"); - if (ebus_dma_register(&sparc_ebus_dmas[count].info)) - continue; - ebus_dma_irq_enable(&sparc_ebus_dmas[count].info, 1); - - /* Configure IRQ to Push Pull, Level Low */ - /* Enable ECP, set bit 2 of the CTR first */ - outb(0x04, base + 0x02); - ns87303_modify(config, PCR, - PCR_EPP_ENABLE | - PCR_IRQ_ODRAIN, - PCR_ECP_ENABLE | - PCR_ECP_CLK_ENA | - PCR_IRQ_POLAR); - - /* CTR bit 5 controls direction of port */ - ns87303_modify(config, PTR, - 0, PTR_LPT_REG_DIR); - - if (parport_pc_probe_port(base, base + 0x400, - edev->irqs[0], - count, - &ebus->self->dev)) - count++; - } - } - } + of_register_driver(&ecpp_driver, &of_bus_type); - count = parport_isa_probe(count); - - return count; + return 0; } #endif /* !(_ASM_SPARC64_PARPORT_H */ diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h index 2b9e0d795faf..31dcb92fbae0 100644 --- a/include/asm-sparc64/prom.h +++ b/include/asm-sparc64/prom.h @@ -94,5 +94,9 @@ static inline void of_node_put(struct device_node *node) */ #include <linux/of.h> +extern struct device_node *of_console_device; +extern char *of_console_path; +extern char *of_console_options; + #endif /* __KERNEL__ */ #endif /* _SPARC64_PROM_H */ diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index 409067408eec..64891cb10f05 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -115,14 +115,8 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ #ifndef __ASSEMBLY__ extern void sun_do_break(void); -extern int serial_console; extern int stop_a_enabled; -static __inline__ int con_is_present(void) -{ - return serial_console ? 0 : 1; -} - extern void synchronize_user_stack(void); extern void __flushw_user(void); |