Skip to contentSkip to conversation

: SGI Octane (IP30) Patches, Part one, Intro & IOC3

PATCH/RFC Kumba 2 participants 2 messages Jul 31, 2008 – Jul 27, 2013

Subsystems (4)
lore
Share & tools
lore

Kumba

author
#0 lore raw

Hey all,

Herein is the current IP30 Patches that I have. They apply to 2.6.26 using a recent snap from LMO Git. So far, everything works pretty well, and my box had been building several times gcc-4.3.1 the last few days (which isn't much of a test, but I digress). 2.6.25 seems busted, so I decided to skip even looking at that.

Anyways, the point of posting this here is to get other eyes to look at it and maybe elicit some help in getting these things cleaned up so we can finally get this sucker into mainline in the near future.

There's several pieces to this patchset, the first being IOC3 changes. A lot of this are in the SN version of the IOC3 driver, and I know some work was done on making that driver cross-functional with mips, but I don't think that work ever got merged in. So maybe this is a starting point for that?

Feel free to poke n' prod and make suggestions.

Thanks!,

--Kumba

Signature · 6 lines
Unofficial Gentoo/MIPS Hermit & Kernel Monkey

"The past tempts us, the present confuses us, the future frightens us.  And our
lives slip away, moment by moment, lost in that vast, terrible in-between."

--Emperor Turhan, Centauri Republic
arch/mips/Kconfig +8 -0
diff -Naurp linux-2.6.26.orig/arch/mips/Kconfig linux-2.6.26/arch/mips/Kconfig
@@ -2000,6 +2000,14 @@ config PCI_DOMAINS
 
 source "drivers/pci/Kconfig"
 
+config SGI_IOC3
+	bool "SGI IOC3 Master Driver"
+	depends on PCI
+	help
+	  If you have a Silicon Graphics Origin or Octane, say Y.
+	  This driver provides base for IOC3 feature drivers, such as
+	  Ethernet, keyboard, mouse, serial ports, LEDs and RTC.
+
 #
 # ISA support is now enabled via select.  Too many systems still have the one
 # or other ISA chip on the board that users don't know about so don't expect
arch/mips/pci/Makefile +3 -0
diff -Naurp linux-2.6.26.orig/arch/mips/pci/Makefile linux-2.6.26/arch/mips/pci/Makefile
@@ -48,3 +48,6 @@ obj-$(CONFIG_TOSHIBA_RBTX4938)	+= fixup-
 obj-$(CONFIG_VICTOR_MPC30X)	+= fixup-mpc30x.o
 obj-$(CONFIG_ZAO_CAPCELLA)	+= fixup-capcella.o
 obj-$(CONFIG_WR_PPMC)		+= fixup-wrppmc.o
+
+obj-$(CONFIG_SGI_IOC3)		+= ioc3.o
+
arch/mips/pci/ioc3.c +898 -0

898 lines not on this page · raw message

drivers/input/serio/Kconfig +7 -0
diff -Naurp linux-2.6.26.orig/drivers/input/serio/Kconfig linux-2.6.26/drivers/input/serio/Kconfig
@@ -18,6 +18,13 @@ config SERIO
 
 if SERIO
 
+config SERIO_SGI_IOC3
+	tristate "SGI IOC3 keyboard controller"
+	default y
+	depends on SGI_IOC3
+	---help---
+	  If you have an Octane and you want to use its keyboard, select this.
+
 config SERIO_I8042
 	tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86
 	default y
drivers/input/serio/Makefile +1 -0
diff -Naurp linux-2.6.26.orig/drivers/input/serio/Makefile linux-2.6.26/drivers/input/serio/Makefile
@@ -19,5 +19,6 @@ obj-$(CONFIG_HP_SDC)		+= hp_sdc.o
 obj-$(CONFIG_HIL_MLC)		+= hp_sdc_mlc.o hil_mlc.o
 obj-$(CONFIG_SERIO_PCIPS2)	+= pcips2.o
 obj-$(CONFIG_SERIO_MACEPS2)	+= maceps2.o
+obj-$(CONFIG_SERIO_SGI_IOC3)	+= ioc3kbd.o
 obj-$(CONFIG_SERIO_LIBPS2)	+= libps2.o
 obj-$(CONFIG_SERIO_RAW)		+= serio_raw.o
drivers/input/serio/ioc3kbd.c +187 -0

187 lines not on this page · raw message

drivers/net/Kconfig +1 -1
diff -Naurp linux-2.6.26.orig/drivers/net/Kconfig linux-2.6.26/drivers/net/Kconfig
@@ -492,7 +492,7 @@ config MIPS_AU1X00_ENET
 
 config SGI_IOC3_ETH
 	bool "SGI IOC3 Ethernet"
-	depends on PCI && SGI_IP27
+	depends on SGI_IOC3
 	select CRC32
 	select MII
 	help
drivers/net/ioc3-eth.c +61 -452

679 lines not on this page · raw message

drivers/serial/8250.c +7 -0
diff -Naurp linux-2.6.26.orig/drivers/serial/8250.c linux-2.6.26/drivers/serial/8250.c
@@ -368,6 +368,9 @@ static unsigned int serial_in(struct uar
 	case UPIO_MEM32:
 		return readl(up->port.membase + offset);
 
+	case UPIO_IOC3:
+		return readb(up->port.membase + (offset^3));
+
 #ifdef CONFIG_SERIAL_8250_AU1X00
 	case UPIO_AU:
 		return __raw_readl(up->port.membase + offset);
@@ -407,6 +410,10 @@ serial_out(struct uart_8250_port *up, in
 		writel(value, up->port.membase + offset);
 		break;
 
+	case UPIO_IOC3:
+		writeb(value, up->port.membase + (offset^3));
+		break;
+
 #ifdef CONFIG_SERIAL_8250_AU1X00
 	case UPIO_AU:
 		__raw_writel(value, up->port.membase + offset);
drivers/serial/Kconfig +7 -0
diff -Naurp linux-2.6.26.orig/drivers/serial/Kconfig linux-2.6.26/drivers/serial/Kconfig
@@ -278,6 +278,13 @@ config SERIAL_8250_RM9K
 	  port hardware found on MIPS RM9122 and similar processors.
 	  If unsure, say N.
 
+config SGI_IOC3_UART
+	bool "SGI IOC3 UART support"
+	depends on SGI_IOC3 && SERIAL_8250
+	help
+	  Enable this if you have a SGI Origin or Octane machine. This module
+	  provides serial port support for IOC3 chips on those systems.
+
 comment "Non-8250 serial port support"
 
 config SERIAL_AMBA_PL010
drivers/serial/Makefile +1 -0
diff -Naurp linux-2.6.26.orig/drivers/serial/Makefile linux-2.6.26/drivers/serial/Makefile
@@ -59,6 +59,7 @@ obj-$(CONFIG_SERIAL_SC26XX) += sc26xx.o
 obj-$(CONFIG_SERIAL_JSM) += jsm/
 obj-$(CONFIG_SERIAL_TXX9) += serial_txx9.o
 obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o
+obj-$(CONFIG_SGI_IOC3_UART) += ioc3uart.o
 obj-$(CONFIG_SERIAL_SGI_IOC4) += ioc4_serial.o
 obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o
 obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o
drivers/serial/ioc3uart.c +142 -0

142 lines not on this page · raw message

drivers/serial/serial_core.c +5 -0
diff -Naurp linux-2.6.26.orig/drivers/serial/serial_core.c linux-2.6.26/drivers/serial/serial_core.c
@@ -2162,6 +2162,10 @@ uart_report_port(struct uart_driver *drv
 		snprintf(address, sizeof(address),
 			 "MMIO 0x%llx", (unsigned long long)port->mapbase);
 		break;
+	case UPIO_IOC3:
+		snprintf(address, sizeof(address), "IOC3 0x%lx",
+			 port->mapbase);
+		break;
 	default:
 		strlcpy(address, "*unknown*", sizeof(address));
 		break;
@@ -2573,6 +2577,7 @@ int uart_match_port(struct uart_port *po
 	case UPIO_AU:
 	case UPIO_TSI:
 	case UPIO_DWAPB:
+	case UPIO_IOC3:
 		return (port1->mapbase == port2->mapbase);
 	}
 	return 0;
include/asm-mips/mach-ip27/mangle-port.h +1 -1
diff -Naurp linux-2.6.26.orig/include/asm-mips/mach-ip27/mangle-port.h linux-2.6.26/include/asm-mips/mach-ip27/mangle-port.h
@@ -8,7 +8,7 @@
 #ifndef __ASM_MACH_IP27_MANGLE_PORT_H
 #define __ASM_MACH_IP27_MANGLE_PORT_H
 
-#define __swizzle_addr_b(port)	(port)
+#define __swizzle_addr_b(port)	((port) ^ 3)
 #define __swizzle_addr_w(port)	((port) ^ 2)
 #define __swizzle_addr_l(port)	(port)
 #define __swizzle_addr_q(port)	(port)
include/linux/ioc3.h +9 -10
diff -Naurp linux-2.6.26.orig/include/linux/ioc3.h linux-2.6.26/include/linux/ioc3.h
@@ -9,7 +9,7 @@
 #ifndef _LINUX_IOC3_H
 #define _LINUX_IOC3_H
 
-#include <asm/sn/ioc3.h>
+#include <asm-mips/sn/ioc3.h>
 
 #define IOC3_MAX_SUBMODULES	32
 
@@ -27,7 +27,7 @@ struct ioc3_driver_data {
 	int id;				/* IOC3 sequence number */
 	/* PCI mapping */
 	unsigned long pma;		/* physical address */
-	struct ioc3 __iomem *vma;	/* pointer to registers */
+	struct __iomem ioc3 *vma;	/* pointer to registers */
 	struct pci_dev *pdev;		/* PCI device */
 	/* IRQ stuff */
 	int dual_irq;			/* set if separate IRQs are used */
@@ -72,9 +72,6 @@ struct ioc3_submodule {
  * Functions needed by submodules *
  **********************************/
 
-#define IOC3_W_IES		0
-#define IOC3_W_IEC		1
-
 /* registers a submodule for all existing and future IOC3 chips */
 extern int ioc3_register_submodule(struct ioc3_submodule *);
 /* unregisters a submodule */
@@ -85,9 +82,11 @@ extern void ioc3_enable(struct ioc3_subm
 extern void ioc3_ack(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
 /* disables IRQs indicated by irq_mask for a specified IOC3 chip */
 extern void ioc3_disable(struct ioc3_submodule *, struct ioc3_driver_data *, unsigned int);
-/* atomically sets GPCR bits */
-extern void ioc3_gpcr_set(struct ioc3_driver_data *, unsigned int);
-/* general ireg writer */
-extern void ioc3_write_ireg(struct ioc3_driver_data *idd, uint32_t value, int reg);
-
+/* atomically sets/clears GPIO bits */
+#ifdef CONFIG_IA64_SGI_SN2
+extern void ioc3_gpcr_set(struct ioc3_driver_data *, unsigned int)
+#else
+extern void ioc3_gpio(struct ioc3_driver_data *, unsigned int, unsigned int);
 #endif
+
+#endif /* _LINUX_IOC3_H */
include/linux/serial.h +1 -0
diff -Naurp linux-2.6.26.orig/include/linux/serial.h linux-2.6.26/include/linux/serial.h
@@ -81,6 +81,7 @@ struct serial_struct {
 #define SERIAL_IO_PORT	0
 #define SERIAL_IO_HUB6	1
 #define SERIAL_IO_MEM	2
+#define SERIAL_IO_IOC3	5
 
 struct serial_uart_config {
 	char	*name;
include/linux/serial_core.h +1 -0
diff -Naurp linux-2.6.26.orig/include/linux/serial_core.h linux-2.6.26/include/linux/serial_core.h
@@ -261,6 +261,7 @@ struct uart_port {
 #define UPIO_TSI		(5)			/* Tsi108/109 type IO */
 #define UPIO_DWAPB		(6)			/* DesignWare APB UART */
 #define UPIO_RM9000		(7)			/* RM9000 type IO */
+#define UPIO_IOC3		(8)			/* SGI IOC3 (IP30) UART */
 
 	unsigned int		read_status_mask;	/* driver specific */
 	unsigned int		ignore_status_mask;	/* driver specific */