Patchwork Add subsystem callbacks for VIA

login
register
about
Submitter Rudolf Marek
Date 2011-04-22 20:48:21
Message ID <4DB1E995.2000902@assembler.cz>
Download mbox | patch
Permalink /patch/2909/
State Accepted
Headers show

Comments

Rudolf Marek - 2011-04-22 20:48:21
Hi all,

Following patch adds subsystem callbacks for VT8237x and VT890 family of chipsets.

Tested only partially because the device on/off is done in strange way not using 
the devicetree, which I might address in the future.

Signed-off-by: Rudolf Marek <r.marek@assembler.cz>

Thanks,
Rudolf
Stefan Reinauer - 2011-04-22 21:41:08
* Rudolf Marek <r.marek@assembler.cz> [110422 22:48]:
> Hi all,
> 
> Following patch adds subsystem callbacks for VT8237x and VT890 family of chipsets.
> 
> Tested only partially because the device on/off is done in strange
> way not using the devicetree, which I might address in the future.
> 
> Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
> 

Acked-by: Stefan Reinauer <stefan.reinauer@coreboot.org>

Patch

Index: src/southbridge/via/vt8237r/lpc.c
===================================================================
--- src/southbridge/via/vt8237r/lpc.c	(revision 6540)
+++ src/southbridge/via/vt8237r/lpc.c	(working copy)
@@ -598,12 +598,24 @@ 
 	init_keyboard(dev);
 }
 
+
+static void vt8237_set_subsystem(device_t dev, unsigned vendor, unsigned device)
+{
+	pci_write_config16(dev, 0x70, vendor);
+	pci_write_config16(dev, 0x72, device);
+}
+
+static struct pci_operations lops_pci = {
+	.set_subsystem = vt8237_set_subsystem,
+};
+
 static const struct device_operations vt8237r_lpc_ops_s = {
 	.read_resources		= vt8237r_read_resources,
 	.set_resources		= pci_dev_set_resources,
 	.enable_resources	= pci_dev_enable_resources,
 	.init			= vt8237s_init,
 	.scan_bus		= scan_static_bus,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct device_operations vt8237r_lpc_ops_r = {
@@ -612,6 +624,7 @@ 
 	.enable_resources	= pci_dev_enable_resources,
 	.init			= vt8237r_init,
 	.scan_bus		= scan_static_bus,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct device_operations vt8237r_lpc_ops_a = {
@@ -620,6 +633,7 @@ 
 	.enable_resources	= pci_dev_enable_resources,
 	.init			= vt8237a_init,
 	.scan_bus		= scan_static_bus,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct pci_driver lpc_driver_r __pci_driver = {
Index: src/southbridge/via/vt8237r/sata.c
===================================================================
--- src/southbridge/via/vt8237r/sata.c	(revision 6540)
+++ src/southbridge/via/vt8237r/sata.c	(working copy)
@@ -95,13 +95,24 @@ 
 	}
 }
 
+
+static void vt8237_set_subsystem(device_t dev, unsigned vendor, unsigned device)
+{
+	pci_write_config16(dev, 0xd4, vendor);
+	pci_write_config16(dev, 0xd6, device);
+}
+
+static struct pci_operations lops_pci = {
+	.set_subsystem = vt8237_set_subsystem,
+};
+
 static const struct device_operations sata_i_ops = {
 	.read_resources		= pci_dev_read_resources,
 	.set_resources		= pci_dev_set_resources,
 	.enable_resources	= pci_dev_enable_resources,
 	.init			= sata_i_init,
 	.enable			= 0,
-	.ops_pci		= 0,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct device_operations sata_ii_ops = {
@@ -110,7 +121,7 @@ 
 	.enable_resources	= pci_dev_enable_resources,
 	.init			= sata_ii_init,
 	.enable			= 0,
-	.ops_pci		= 0,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct pci_driver northbridge_driver_ii __pci_driver = {
Index: src/southbridge/via/vt8237r/usb.c
===================================================================
--- src/southbridge/via/vt8237r/usb.c	(revision 6540)
+++ src/southbridge/via/vt8237r/usb.c	(working copy)
@@ -134,13 +134,25 @@ 
 	return;
 }
 
+static void vt8237_set_subsystem(device_t dev, unsigned vendor, unsigned device)
+{
+	pci_write_config32(dev, 0x42, pci_read_config32(dev, 0x42) | 0x10);
+	pci_write_config16(dev, 0x2c, vendor);
+	pci_write_config16(dev, 0x2e, device);
+	pci_write_config32(dev, 0x42, pci_read_config32(dev, 0x42) & ~0x10);
+}
+
+static struct pci_operations lops_pci = {
+	.set_subsystem = vt8237_set_subsystem,
+};
+
 static const struct device_operations usb_i_ops = {
 	.read_resources		= vt8237_usb_i_read_resources,
 	.set_resources		= pci_dev_set_resources,
 	.enable_resources	= pci_dev_enable_resources,
 	.init				= usb_i_init,
 	.enable				= 0,
-	.ops_pci			= 0,
+	.ops_pci			= &lops_pci,
 };
 
 static const struct device_operations usb_ii_ops = {
@@ -149,7 +161,7 @@ 
 	.enable_resources	= pci_dev_enable_resources,
 	.init				= usb_ii_init,
 	.enable				= 0,
-	.ops_pci			= 0,
+	.ops_pci			= &lops_pci,
 };
 
 static const struct pci_driver vt8237r_driver_usbii __pci_driver = {
Index: src/southbridge/via/k8t890/host_ctrl.c
===================================================================
--- src/southbridge/via/k8t890/host_ctrl.c	(revision 6540)
+++ src/southbridge/via/k8t890/host_ctrl.c	(working copy)
@@ -122,12 +122,16 @@ 
 		outl((u32) toc, K8T890_NVRAM_IO_BASE+K8T890_NVRAM_CBMEM_TOC);
 }
 
+static struct pci_operations lops_pci = {
+	.set_subsystem = pci_dev_set_subsystem,
+};
+
 static const struct device_operations host_ctrl_ops_t = {
 	.read_resources		= pci_dev_read_resources,
 	.set_resources		= pci_dev_set_resources,
 	.enable_resources	= pci_dev_enable_resources,
 	.enable			= host_ctrl_enable_k8t8xx,
-	.ops_pci		= 0,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct device_operations host_ctrl_ops_m = {
@@ -135,7 +139,7 @@ 
 	.set_resources		= pci_dev_set_resources,
 	.enable_resources	= pci_dev_enable_resources,
 	.enable			= host_ctrl_enable_k8m8xx,
-	.ops_pci		= 0,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct pci_driver northbridge_driver_t800 __pci_driver = {
Index: src/southbridge/via/k8t890/ctrl.c
===================================================================
--- src/southbridge/via/k8t890/ctrl.c	(revision 6540)
+++ src/southbridge/via/k8t890/ctrl.c	(working copy)
@@ -187,12 +187,16 @@ 
 
 }
 
+static struct pci_operations lops_pci = {
+	.set_subsystem = pci_dev_set_subsystem,
+};
+
 static const struct device_operations ctrl_ops = {
 	.read_resources		= pci_dev_read_resources,
 	.set_resources		= pci_dev_set_resources,
 	.enable_resources	= pci_dev_enable_resources,
 	.init			= ctrl_init,
-	.ops_pci		= 0,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct pci_driver northbridge_driver_t800 __pci_driver = {
Index: src/southbridge/via/k8t890/host.c
===================================================================
--- src/southbridge/via/k8t890/host.c	(revision 6540)
+++ src/southbridge/via/k8t890/host.c	(working copy)
@@ -56,12 +56,16 @@ 
 
 }
 
+static struct pci_operations lops_pci = {
+	.set_subsystem = pci_dev_set_subsystem,
+};
+
 static const struct device_operations host_ops_t = {
 	.read_resources		= pci_dev_read_resources,
 	.set_resources		= pci_dev_set_resources,
 	.enable_resources	= pci_dev_enable_resources,
 	.enable			= host_enable,
-	.ops_pci		= 0,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct device_operations host_ops_m = {
@@ -70,7 +74,7 @@ 
 	.enable_resources	= pci_dev_enable_resources,
 	.enable			= host_enable,
 	.init			= host_init,
-	.ops_pci		= 0,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct pci_driver northbridge_driver_t800 __pci_driver = {
Index: src/southbridge/via/k8t890/dram.c
===================================================================
--- src/southbridge/via/k8t890/dram.c	(revision 6540)
+++ src/southbridge/via/k8t890/dram.c	(working copy)
@@ -153,12 +153,16 @@ 
 #endif
 }
 
+static struct pci_operations lops_pci = {
+	.set_subsystem = pci_dev_set_subsystem,
+};
+
 static const struct device_operations dram_ops_t = {
 	.read_resources		= pci_dev_read_resources,
 	.set_resources		= pci_dev_set_resources,
 	.enable_resources	= pci_dev_enable_resources,
 	.enable			= dram_enable,
-	.ops_pci		= 0,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct device_operations dram_ops_m = {
@@ -167,7 +171,7 @@ 
 	.enable_resources	= pci_dev_enable_resources,
 	.enable			= dram_enable_k8m890,
 	.init			= dram_init_fb,
-	.ops_pci		= 0,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct pci_driver northbridge_driver_t800 __pci_driver = {
Index: src/southbridge/via/k8t890/error.c
===================================================================
--- src/southbridge/via/k8t890/error.c	(revision 6540)
+++ src/southbridge/via/k8t890/error.c	(working copy)
@@ -41,12 +41,16 @@ 
 	dump_south(dev);
 }
 
+static struct pci_operations lops_pci = {
+	.set_subsystem = pci_dev_set_subsystem,
+};
+
 static const struct device_operations error_ops = {
 	.read_resources		= pci_dev_read_resources,
 	.set_resources		= pci_dev_set_resources,
 	.enable_resources	= pci_dev_enable_resources,
 	.enable			= error_enable,
-	.ops_pci		= 0,
+	.ops_pci		= &lops_pci,
 };
 
 static const struct pci_driver northbridge_driver_t800 __pci_driver = {