aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>2011-11-22 09:38:02 -0500
committerRalf Baechle <ralf@linux-mips.org>2011-12-07 17:03:44 -0500
commite84de0c61905030a0fe66b7210b6f1bb7c3e1eab (patch)
tree005bbd00a34966e36dd99dcbfd66428bf97769fa /drivers/video
parent5611cc4572e889b62a7b4c72a413536bf6a9c416 (diff)
MIPS: GIO bus support for SGI IP22/28
SGI IP22/IP28 machines have GIO busses for adding graphics and other extension cards. This patch adds support for GIO driver/device handling and converts the newport console driver to a GIO driver. [ralf@linux-mips.org: Fixed build error caused by the modules.h -> export.h changes.] Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Acked-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> To: linux-fbdev@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/2886/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/console/newport_con.c63
1 files changed, 44 insertions, 19 deletions
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c
index 93317b5b8740..a122d9287d16 100644
--- a/drivers/video/console/newport_con.c
+++ b/drivers/video/console/newport_con.c
@@ -25,14 +25,13 @@
25#include <asm/system.h> 25#include <asm/system.h>
26#include <asm/page.h> 26#include <asm/page.h>
27#include <asm/pgtable.h> 27#include <asm/pgtable.h>
28#include <asm/gio_device.h>
29
28#include <video/newport.h> 30#include <video/newport.h>
29 31
30#include <linux/linux_logo.h> 32#include <linux/linux_logo.h>
31#include <linux/font.h> 33#include <linux/font.h>
32 34
33
34extern unsigned long sgi_gfxaddr;
35
36#define FONT_DATA ((unsigned char *)font_vga_8x16.data) 35#define FONT_DATA ((unsigned char *)font_vga_8x16.data)
37 36
38/* borrowed from fbcon.c */ 37/* borrowed from fbcon.c */
@@ -304,12 +303,6 @@ static const char *newport_startup(void)
304{ 303{
305 int i; 304 int i;
306 305
307 if (!sgi_gfxaddr)
308 return NULL;
309
310 if (!npregs)
311 npregs = (struct newport_regs *)/* ioremap cannot fail */
312 ioremap(sgi_gfxaddr, sizeof(struct newport_regs));
313 npregs->cset.config = NPORT_CFG_GD0; 306 npregs->cset.config = NPORT_CFG_GD0;
314 307
315 if (newport_wait(npregs)) 308 if (newport_wait(npregs))
@@ -743,26 +736,58 @@ const struct consw newport_con = {
743 .con_save_screen = DUMMY 736 .con_save_screen = DUMMY
744}; 737};
745 738
746#ifdef MODULE 739static int newport_probe(struct gio_device *dev,
747static int __init newport_console_init(void) 740 const struct gio_device_id *id)
748{ 741{
749 if (!sgi_gfxaddr) 742 unsigned long newport_addr;
750 return 0;
751 743
752 if (!npregs) 744 if (!dev->resource.start)
753 npregs = (struct newport_regs *)/* ioremap cannot fail */ 745 return -EINVAL;
754 ioremap(sgi_gfxaddr, sizeof(struct newport_regs)); 746
747 if (npregs)
748 return -EBUSY; /* we only support one Newport as console */
749
750 newport_addr = dev->resource.start + 0xF0000;
751 if (!request_mem_region(newport_addr, 0x10000, "Newport"))
752 return -ENODEV;
753
754 npregs = (struct newport_regs *)/* ioremap cannot fail */
755 ioremap(newport_addr, sizeof(struct newport_regs));
755 756
756 return take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1); 757 return take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1);
757} 758}
758module_init(newport_console_init);
759 759
760static void __exit newport_console_exit(void) 760static void newport_remove(struct gio_device *dev)
761{ 761{
762 give_up_console(&newport_con); 762 give_up_console(&newport_con);
763 iounmap((void *)npregs); 763 iounmap((void *)npregs);
764} 764}
765
766static struct gio_device_id newport_ids[] = {
767 { .id = 0x7e },
768 { .id = 0xff }
769};
770
771MODULE_ALIAS("gio:7e");
772
773static struct gio_driver newport_driver = {
774 .name = "newport",
775 .id_table = newport_ids,
776 .probe = newport_probe,
777 .remove = newport_remove,
778};
779
780int __init newport_console_init(void)
781{
782 return gio_register_driver(&newport_driver);
783}
784
785void __exit newport_console_exit(void)
786{
787 gio_unregister_driver(&newport_driver);
788}
789
790module_init(newport_console_init);
765module_exit(newport_console_exit); 791module_exit(newport_console_exit);
766#endif
767 792
768MODULE_LICENSE("GPL"); 793MODULE_LICENSE("GPL");