I have a M.2 M-keyed slot on my laptop, and multiple M.2 PCI-e devices that I'd like to use at the same time. I've been looking for a M.2 switch or splitter of sorts but couldn't find anything, so I decided to design my own & also gain some PCI Express experience.
I tried to look up specifications for PCI Express physical layer but I couldn't find much information. Most articles I found refer to PCI-SIG website which needs a membership with a work email (that I don't have) from one of the member companies. So I tried to learn as much as possible on my own.
As far as I could figure out, a M.2 M-key slot exposes 4x PCI-e lanes. The devices I have are a combination of A/E, E and M keys. The A/E and E key devices require 1 or 2 PCIe lanes. None of the cards I have need the M.2 specific features like USB or DisplayPort. I'm also completely fine with the M-key (x4) devices running on 2 lanes or even a single lane at reduced speeds. I also learned that each PCI-e lane has a differential transmit and receive pair, and there's a reference clock that's provided by the host. So I am wondering;
- if I design a board that would split the 4 lanes on the M-key slot out to 2 lanes on a M.2 E-key (at the matching pin numbers) plus 2 more lanes on a M.2 M-key (with the other 2 lanes N/C) and use the reference clock on both slots, would that just work?
- Do I need to buffer the reference clock or can I just tie them together?
- Since the I2C bus is open drain, can I just tie them all together? (Same with SMBus)
- What does the CLKREQ# line do in PCI Express? As far as I could figure out, the PCIe card asserts this line when it needs a reference clock. Can I just pull it down, keeping all cards clocked all the time? Or can I use an OR gate so when any card plugged in needs a clock, all cards plugged in receive the reference clock?
- What's the function of the WAKE# and PERST# lines?
- Are there any more PCIe signals other than the TX/RX pairs, REFCLK, WAKE, PERST, CLKREQ?
- Is there a specific power-up sequence for PCI Express?
- Will the host detect and enumerate all devices separately, or does it need special BIOS or UEFI firmware support for this?
- Is there anything else I should keep in mind?
I'm looking into this as more of a learning experience than just a solution for my need, so I appreciate any help I can get. Thank you!