Patchwork Asrock 939a785gmh - fix PCIe x16

login
register
about
Submitter Rudolf Marek
Date 2011-02-26 19:40:23
Message ID <4D695727.10109@assembler.cz>
Download mbox | patch
Permalink /patch/2709/
State Accepted
Commit r6384
Headers show

Comments

Rudolf Marek - 2011-02-26 19:40:23
Hello,

I just found out how to take the PCIe x16 out of reset.

Following patch fills in the callbacks for PCIe x16 resets. This board uses 
GPM8,GPM9 as reset toggles.

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

Thanks,
Rudolf
Peter Stuge - 2011-02-26 19:43:02
Rudolf Marek wrote:
> I just found out how to take the PCIe x16 out of reset.
>
> Following patch fills in the callbacks for PCIe x16 resets. This board uses 
> GPM8,GPM9 as reset toggles.
>
> Signed-off-by: Rudolf Marek <r.marek@assembler.cz>

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

Patch

Index: src/mainboard/asrock/939a785gmh/mainboard.c
===================================================================
--- src/mainboard/asrock/939a785gmh/mainboard.c	(revision 6381)
+++ src/mainboard/asrock/939a785gmh/mainboard.c	(working copy)
@@ -35,12 +35,31 @@ 
 void set_pcie_dereset(void);
 void set_pcie_reset(void);
 u8 is_dev3_present(void);
+
+static void pcie_rst_toggle(u8 val) {
+	u8 byte;
+
+	byte = pm_ioread(0x8d);
+	byte &= ~(3 << 1);
+	pm_iowrite(0x8d, byte);
+
+	byte = pm_ioread(0x94);
+	/* Output enable */
+	byte &= ~(3 << 2);
+	/* Toggle GPM8, GPM9 */
+	byte &= ~(3 << 0);
+	byte |= val;
+	pm_iowrite(0x94, byte);
+}
+
 void set_pcie_dereset()
 {
+    pcie_rst_toggle(0x3);
 }
 
 void set_pcie_reset()
 {
+    pcie_rst_toggle(0x0);
 }
 
 #if 0	     /* not tested yet */