Skip to contentSkip to conversation

GIO bus support for SGI IP22/28

PATCH Superseded Thomas Bogendoerfer 3 participants 5 messages Oct 20, 2011

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Thomas Bogendoerfer

author maintainer
#0 lore raw

PATCH 1/1 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.

---

 arch/mips/include/asm/gio_device.h  |   56 +++++
 arch/mips/sgi-ip22/Makefile         |    2 +-
 arch/mips/sgi-ip22/ip22-gio.c       |  408 +++++++++++++++++++++++++++++++++++
 arch/mips/sgi-ip22/ip22-mc.c        |   10 +-
 arch/mips/sgi-ip22/ip22-setup.c     |   21 --
 drivers/video/console/newport_con.c |   61 ++++--
 6 files changed, 512 insertions(+), 46 deletions(-)
arch/mips/include/asm/gio_device.h new file +56 -0
new file mode 100644
index 0000000..5437c84
@@ -0,0 +1,56 @@
+#include <linux/device.h>
+#include <linux/mod_devicetable.h>
+
+struct gio_device_id {
+	__u8 id;
+};
+
+struct gio_device {
+	struct device   dev;
+	struct resource resource;
+	unsigned int    irq;
+	unsigned int    slotno;
+
+	const char      *name;
+	struct gio_device_id id;
+	unsigned        id32:1;
+	unsigned        gio64:1;
+};
+#define to_gio_device(d) container_of(d, struct gio_device, dev)
+
+struct gio_driver {
+	const char    *name;
+	struct module *owner;
+	const struct gio_device_id *id_table;
+
+	int  (*probe)(struct gio_device *, const struct gio_device_id *);
+	void (*remove)(struct gio_device *);
+	int  (*suspend)(struct gio_device *, pm_message_t);
+	int  (*resume)(struct gio_device *);
+	void (*shutdown)(struct gio_device *);
+
+	struct device_driver driver;
+};
+#define to_gio_driver(drv) container_of(drv, struct gio_driver, driver)
+
+extern const struct gio_device_id *gio_match_device(const struct gio_device_id *,
+						    const struct gio_device *);
+extern struct gio_device *gio_dev_get(struct gio_device *);
+extern void gio_dev_put(struct gio_device *);
+
+extern int gio_device_register(struct gio_device *);
+extern void gio_device_unregister(struct gio_device *);
+extern void gio_release_dev(struct device *);
+
+static inline void gio_device_free(struct gio_device *dev)
+{
+	gio_release_dev(&dev->dev);
+}
+
+extern int gio_register_driver(struct gio_driver *);
+extern void gio_unregister_driver(struct gio_driver *);
+
+#define gio_get_drvdata(_dev)        drv_get_drvdata(&(_dev)->dev)
+#define gio_set_drvdata(_dev, data)  drv_set_drvdata(&(_dev)->dev, (data))
+
+extern void gio_set_master(struct gio_device *);
arch/mips/sgi-ip22/Makefile +1 -1
index cc53849..411cda9 100644
@@ -4,7 +4,7 @@
 #
 
 obj-y	+= ip22-mc.o ip22-hpc.o ip22-int.o ip22-time.o ip22-nvram.o \
-	   ip22-platform.o ip22-reset.o ip22-setup.o
+	   ip22-platform.o ip22-reset.o ip22-setup.o ip22-gio.o
 
 obj-$(CONFIG_SGI_IP22) += ip22-berr.o
 obj-$(CONFIG_SGI_IP28) += ip28-berr.o
arch/mips/sgi-ip22/ip22-gio.c new file +408 -0

408 lines not on this page · raw message

arch/mips/sgi-ip22/ip22-mc.c +5 -5
index d22262e..75ada8a 100644
@@ -139,11 +139,11 @@ void __init sgimc_init(void)
 	 *         zero.
 	 */
 	/* don't touch parity settings for IP28 */
-#ifndef CONFIG_SGI_IP28
 	tmp = sgimc->cpuctrl0;
-	tmp |= (SGIMC_CCTRL0_EPERRGIO | SGIMC_CCTRL0_EPERRMEM |
-		SGIMC_CCTRL0_R4KNOCHKPARR);
+#ifndef CONFIG_SGI_IP28
+	tmp |= SGIMC_CCTRL0_EPERRGIO | SGIMC_CCTRL0_EPERRMEM;
 #endif
+	tmp |= SGIMC_CCTRL0_R4KNOCHKPARR;
 	sgimc->cpuctrl0 = tmp;
 
 	/* Step 3: Setup the MC write buffer depth, this is controlled
@@ -178,7 +178,8 @@ void __init sgimc_init(void)
 	 */
 
 	/* First the basic invariants across all GIO64 implementations. */
-	tmp = SGIMC_GIOPAR_HPC64;	/* All 1st HPC's interface at 64bits */
+	tmp = sgimc->giopar & SGIMC_GIOPAR_GFX64; /* keep gfx 64bit settings */
+	tmp |= SGIMC_GIOPAR_HPC64;	/* All 1st HPC's interface at 64bits */
 	tmp |= SGIMC_GIOPAR_ONEBUS;	/* Only one physical GIO bus exists */
 
 	if (ip22_is_fullhouse()) {
@@ -193,7 +194,6 @@ void __init sgimc_init(void)
 			tmp |= SGIMC_GIOPAR_PLINEEXP0;	/* exp[01] pipelined */
 			tmp |= SGIMC_GIOPAR_PLINEEXP1;
 			tmp |= SGIMC_GIOPAR_MASTEREISA;	/* EISA masters */
-			tmp |= SGIMC_GIOPAR_GFX64;	/* GFX at 64 bits */
 		}
 	} else {
 		/* Guiness specific settings. */
arch/mips/sgi-ip22/ip22-setup.c +0 -21
index 5e66213..c7bdfe4 100644
@@ -26,9 +26,6 @@
 #include <asm/sgi/hpc3.h>
 #include <asm/sgi/ip22.h>
 
-unsigned long sgi_gfxaddr;
-EXPORT_SYMBOL_GPL(sgi_gfxaddr);
-
 extern void ip22_be_init(void) __init;
 
 void __init plat_mem_setup(void)
@@ -78,22 +75,4 @@ void __init plat_mem_setup(void)
 		prom_flags |= PROM_FLAG_USE_AS_CONSOLE;
 		add_preferred_console("arc", 0, NULL);
 	}
-
-#if defined(CONFIG_VT) && defined(CONFIG_SGI_NEWPORT_CONSOLE)
-	{
-		ULONG *gfxinfo;
-		ULONG * (*__vec)(void) = (void *) (long)
-			*((_PULONG *)(long)((PROMBLOCK)->pvector + 0x20));
-
-		gfxinfo = __vec();
-		sgi_gfxaddr = ((gfxinfo[1] >= 0xa0000000
-			       && gfxinfo[1] <= 0xc0000000)
-			       ? gfxinfo[1] - 0xa0000000 : 0);
-
-		/* newport addresses? */
-		if (sgi_gfxaddr == 0x1f0f0000 || sgi_gfxaddr == 0x1f4f0000) {
-			conswitchp = &newport_con;
-		}
-	}
-#endif
 }
drivers/video/console/newport_con.c +42 -19

94 lines not on this page · raw message

#1 lore raw
Quoted 3 lines · Thomas Bogendoerfer

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.

I like it - finally proper driver structure in the year 15 of Indy support :D

I usually ask submitters to consider if they want to change their newly exported kernel symbols from EXPORT_SYMBOL to EXPORT_SYMBOL_GPL. This may not be relevant for this platform - I'm just asking all submitters equally.

Also please cc the drivers/video/ maintainer.

Thanks!

Ralf

#2 lore raw
Quoted 8 lines · Ralf Baechle
Quoted 3 lines · Thomas Bogendoerfer

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.

I like it - finally proper driver structure in the year 15 of Indy support :D

Did GIO ever appeared on non-MIPS platforms?
If yes, you want to move it to drivers/gio/.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds

#3 lore raw
Quoted 11 lines · Geert Uytterhoeven
Quoted 8 lines · Ralf Baechle
Quoted 3 lines · Thomas Bogendoerfer

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.

I like it - finally proper driver structure in the year 15 of Indy support :D

Did GIO ever appeared on non-MIPS platforms?

There may have been obscure prototypes at SGI but I doubt any non-MIPS GIO systems ever reached production status.

Quoted 1 line

If yes, you want to move it to drivers/gio/.

Good point - it probably should go there anyway.

Ralf

author maintainer
#4 lore raw
Quoted 2 lines · Ralf Baechle

There may have been obscure prototypes at SGI but I doubt any non-MIPS GIO systems ever reached production status.

wikipedia only mentions MIPS based stuff from SGI with GIO.

Quoted 3 lines
Quoted 1 line

If yes, you want to move it to drivers/gio/.

Good point - it probably should go there anyway.

does a single file really need it's own directoy ? GIO is pretty simple and most of the magic lies inside the board specific parts. My idea is to factor out the common code as soon as IP12/IP20 support comes up (which is probably never).

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]