PINE64
How to reengage PCIe when reapplying power? - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Quartz64 (https://forum.pine64.org/forumdisplay.php?fid=166)
+--- Forum: General Discussion on Quartz64 (https://forum.pine64.org/forumdisplay.php?fid=167)
+--- Thread: How to reengage PCIe when reapplying power? (/showthread.php?tid=19449)



How to reengage PCIe when reapplying power? - rotdrop - 10-06-2024

Hi there,

thanks for this nice board. So far I have a working NAS setup with a Quartz64 model A, using the Startech 8 port SATA board plugged into the PCIe slot.

I am now trying to switch between battery powered "low power" mode and the "regular" 12V power supply. I know from reading the Wiki

https://wiki.pine64.org/wiki/Quartz64_Model_A_Using_a_battery

that the PCIe slot is powerd down while using the battery.

Now comes the challenge: how to properly reengage the PCIe slot when switching back from battery mode to the "fully powered" mode?

So far I tried:

- unmount all drives before disconnecting the 12V main power supply
- remove the PCIe slot via "echo 1 > /sys/bus/pci/devices/0000:00:00.0/remove"
- switch off the 12V supply

So far so good. The system keeps on running, the NIC is still powered, everything seems to work as expected, I am still logged in via ssh after disconnecting the 12V supply.

Now, when I reengage the 12V supply, I try to resurrect the PCIe bus via

echo 1 > /sys/bus/pci/rescan

This makes the PCEe bridge reappear. But the SATA-controller plugged into the slot is not reinitialized. I tried also

echo 1 >  /sys/devices/platform/3c0000000.pcie/pci0000\:00/pci_bus/0000\:00/rescan

But this does not seem to have an effect. The output of "lspci" still only reads:

root@nas:~# lspci  
00:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3568 Remote Signal Processor (rev 01)


but should be something like this

root@nas:~# lspci  
00:00.0 PCI bridge: Rockchip Electronics Co., Ltd RK3568 Remote Signal Processor (rev 01)
01:00.0 PCI bridge: Pericom Semiconductor PI7C9X2G608GP PCIe2 6-Port/8-Lane Packet Switch
02:01.0 PCI bridge: Pericom Semiconductor PI7C9X2G608GP PCIe2 6-Port/8-Lane Packet Switch
02:02.0 PCI bridge: Pericom Semiconductor PI7C9X2G608GP PCIe2 6-Port/8-Lane Packet Switch
02:03.0 PCI bridge: Pericom Semiconductor PI7C9X2G608GP PCIe2 6-Port/8-Lane Packet Switch
02:04.0 PCI bridge: Pericom Semiconductor PI7C9X2G608GP PCIe2 6-Port/8-Lane Packet Switch
03:00.0 SATA controller: ASMedia Technology Inc. ASM1061/ASM1062 Serial ATA Controller (rev 02)
42:00.0 SATA controller: ASMedia Technology Inc. ASM1061/ASM1062 Serial ATA Controller (rev 02)
81:00.0 SATA controller: ASMedia Technology Inc. ASM1061/ASM1062 Serial ATA Controller (rev 02)
c0:00.0 SATA controller: ASMedia Technology Inc. ASM1061/ASM1062 Serial ATA Controller (rev 02)


I would be kind of cool (for power-saving reasons) if it would be possible to dynamically switch between battery and 12V main power supply. Is there any knowledge in this forum how to achieve this?

Kind thanks in advance for any comments, best

Claus


RE: How to reengage PCIe when reapplying power? - rotdrop - 10-10-2024

Ok, have it working. After realizing that the PCIe-controller driver used by Quartz64 is the DesignWare controller



drivers/pci/controller/dwc/pcie-dw-rockchip.c


(and not the other one name pcie-rockchip.c in drivers/pci/) it showed that unfortunately the dw-controller had not been shaped as a loadable module. However,  it was easy enough to change hat.

I'd rather continue with the story in the Wiki

https://wiki.pine64.org/index.php?title=Quartz64_Model_A_Using_a_battery