patch-2.4.19 linux-2.4.19/drivers/pcmcia/ti113x.h

Next file: linux-2.4.19/drivers/pcmcia/yenta.c
Previous file: linux-2.4.19/drivers/pcmcia/sa1111_generic.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/drivers/pcmcia/ti113x.h linux-2.4.19/drivers/pcmcia/ti113x.h
@@ -170,9 +170,88 @@
 	return 0;
 }
 
+/*
+ *	Zoom video control for TI122x/113x chips
+ */
+
+static void ti_zoom_video(pci_socket_t *socket, int onoff)
+{
+	u8 reg;
+
+	/* If we don't have a Zoom Video switch this is harmless,
+	   we just tristate the unused (ZV) lines */
+	reg = config_readb(socket, TI113X_CARD_CONTROL);
+	if (onoff)
+		/* Zoom zoom, we will all go together, zoom zoom, zoom zoom */
+		reg |= TI113X_CCR_ZVENABLE;
+	else
+		reg &= ~TI113X_CCR_ZVENABLE;
+	config_writeb(socket, TI113X_CARD_CONTROL, reg);
+}
+
+/*
+ *	The 145x series can also use this. They have an additional
+ *	ZV autodetect mode we don't use but don't actually need.
+ *	FIXME: manual says its in func0 and func1 but disagrees with
+ *	itself about this - do we need to force func0, if so we need
+ *	to know a lot more about socket pairings in pci_socket than we
+ *	do now.. uggh.
+ */
+ 
+static void ti1250_zoom_video(pci_socket_t *socket, int onoff)
+{	
+	int shift = 0;
+	u8 reg;
+
+	ti_zoom_video(socket, onoff);
+
+	reg = config_readb(socket, 0x84);
+	reg |= (1<<7);	/* ZV bus enable */
+
+	if(PCI_FUNC(socket->dev->devfn)==1)
+		shift = 1;
+	
+	if(onoff)
+	{
+		reg &= ~(1<<6); 	/* Clear select bit */
+		reg |= shift<<6;	/* Favour our socket */
+		reg |= 1<<shift;	/* Socket zoom video on */
+	}
+	else
+	{
+		reg &= ~(1<<6); 	/* Clear select bit */
+		reg |= (1^shift)<<6;	/* Favour other socket */
+		reg &= ~(1<<shift);	/* Socket zoon video off */
+	}
+
+	config_writeb(socket, 0x84, reg);
+}
+
+static void ti_set_zv(pci_socket_t *socket)
+{
+	if(socket->dev->vendor == PCI_VENDOR_ID_TI)
+	{
+		switch(socket->dev->device)
+		{
+			/* There may be more .. */
+			case PCI_DEVICE_ID_TI_1220:
+			case PCI_DEVICE_ID_TI_1221:
+			case PCI_DEVICE_ID_TI_1225:
+				socket->zoom_video = ti_zoom_video;
+				break;	
+			case PCI_DEVICE_ID_TI_1250:
+			case PCI_DEVICE_ID_TI_1251A:
+			case PCI_DEVICE_ID_TI_1251B:
+			case PCI_DEVICE_ID_TI_1450:
+				socket->zoom_video = ti1250_zoom_video;
+		}
+	}
+}
+
 static int ti_init(pci_socket_t *socket)
 {
 	yenta_init(socket);
+	ti_set_zv(socket);
 	ti_intctl(socket);
 	return 0;
 }
@@ -251,7 +330,7 @@
 static int ti1250_init(pci_socket_t *socket)
 {
 	yenta_init(socket);
-
+	ti_set_zv(socket);
 	config_writeb(socket, TI1250_DIAGNOSTIC, ti_diag(socket));
 	ti_intctl(socket);
 	return 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)