Patchwork add functions to set Subsystem Vendor/Device to rl5c746

login
register
about
Submitter Sven Schnelle
Date 2011-02-28 16:12:45
Message ID <871v2s6stl.fsf@begreifnix.stackframe.org>
Download mbox | patch
Permalink /patch/2712/
State Accepted
Headers show

Comments

Sven Schnelle - 2011-02-28 16:12:45
Hi List,

this patch adds functions to set the Subsystem Vendor/Device ID fields
on Ricoh RL5C746.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Peter Stuge - 2011-02-28 16:28:21
Sven Schnelle wrote:
> this patch adds functions to set the Subsystem Vendor/Device ID fields
> on Ricoh RL5C746.

Is the procedure device specific?


> Signed-off-by: Sven Schnelle <svens@stackframe.org>

If yes,

Acked-by: Peter Stuge <peter@stuge.se>

Otherwise maybe rather add it to pci_device.c ?


//Peter
Alexandru Gagniuc - 2011-02-28 17:00:12
On 02/28/2011 06:28 PM, Peter Stuge wrote:
> Sven Schnelle wrote:
>> this patch adds functions to set the Subsystem Vendor/Device ID fields
>> on Ricoh RL5C746.
> 
> Is the procedure device specific?
> 
It seems so. The procedure is different on VIA hardware.

Alex
Sven Schnelle - 2011-02-28 18:11:25
Peter Stuge <peter@stuge.se> writes:

> Sven Schnelle wrote:
>> this patch adds functions to set the Subsystem Vendor/Device ID fields
>> on Ricoh RL5C746.
>
> Is the procedure device specific?

Yes, the ricoh chip needs an additional Write enable to
set the Subsystem Vendor/Device ID.

~sven
Sven Schnelle - 2011-02-28 18:11:53
Sven Schnelle <svens@stackframe.org> writes:

> this patch adds functions to set the Subsystem Vendor/Device ID fields
> on Ricoh RL5C746.

r6412.

~svens

Patch

Index: src/southbridge/ricoh/rl5c476/rl5c476.c
===================================================================
--- src/southbridge/ricoh/rl5c476/rl5c476.c	(revision 6374)
+++ src/southbridge/ricoh/rl5c476/rl5c476.c	(working copy)
@@ -198,12 +198,29 @@ 
 
 }
 
+static void rl5c476_set_subsystem(device_t dev, unsigned vendor, unsigned device)
+{
+	int miscreg = pci_read_config16(dev, 0x82);
+	/* Enable subsystem id register writes */
+	pci_write_config16(dev, 0x82, miscreg | 0x40);
+
+	pci_write_config16(dev, 0x40, vendor);
+	pci_write_config16(dev, 0x42, device);
+	/* restore original contents */
+	pci_write_config16(dev, 0x82, miscreg);
+}
+
+static struct pci_operations rl5c476_pci_ops = {
+	.set_subsystem    = rl5c476_set_subsystem,
+};
+
 static struct device_operations ricoh_rl5c476_ops = {
 	.read_resources   = rl5c476_read_resources,
 	.set_resources    = rl5c476_set_resources,
 	.enable_resources = cardbus_enable_resources,
 	.init             = rl5c476_init,
 	.scan_bus         = pci_scan_bridge,
+	.ops_pci	  = &rl5c476_pci_ops,
 };
 
 static const struct pci_driver ricoh_rl5c476_driver __pci_driver = {