From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796316784; b=BGxmB+eojgHVbmQck4GFM6tgvn1En+G9+mFLVQDitHyi0fPd0pwcIW2FZsiN/UTW/kn6 gt3ao08JdYaArGWDVlkAmhHk305UsSzbXIVDpk5YBtPxM5yuxtECFX/CcOuyays0OEg0B 5zaTZNP00b2+/KIX6yPPY4xMb85oCE69PSaxyJ7/Djs2Klcw6fmX6HcW8rhY86AdG/jXn nUK6jEaQIySwmN/ZJr/fAjq5YyRqaTI0GGFTmMAKCO8Cqbkr9lqnYfwCSK6/PBcglAJ29 W9TiL3HAqwAA+XyNfqil3WMF/rEoWvV5jYMyknxzdRkdSeCmz/DAaQiSFDqSXgPmhrQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796316784; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=ZtxUAK90aCRVhE56MHT1k+U7fGenYGq6G7UAHeiA6Tg=; b=GWxdPWKPARLnRBS9bSpVO+Z5Rg5qbOh6gZ6SmMUmen0/kkb9zWBeQqvUekf8pjsHA1+/ qAWpjvfN14vXvQ2qKTNNdp25QarOTn2uqrHM72mLibEiTW6uJFHpXwD6DZdjGr6PUn+Wk +ddHEPerwvANzXYCw8w814po3TxaHN2Ttbk07IIhmSxw3gxKVUtGEtmp+UnjhBj0U0utJ dR3YSHUKeczwXBA0UcwMH9lUehuvG869OQDNC0Nqy6UE83oYHzVDneM47ApRza5bCglJ9 XYFncmOCqU8wWMBHQXs/M8di8+QkCoiHbbLASJ9gVLw4uhqD1UAtVKF3rqalrSAL+LA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iF8Ol5rE; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9447A606A32F; Thu, 3 Dec 2026 16:53:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=iF8Ol5rE Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C6C11F00893; Thu, 3 Dec 2026 16:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796316784; bh=ZtxUAK90aCRVhE56MHT1k+U7fGenYGq6G7UAHeiA6Tg=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=iF8Ol5rEpwsbRQBdtNa5ydojPZSCIBeXkC+HhczQhT4+9205y7rGAIG9sCwk2zrNS XDasLk35hc7T0GAzmSu8IBFIuUJ2gYDxfM1j4zy11IODzFNussFxtK9pVO73plMmoZ OoYdYfEtCJ3Vn+jNQHf7GribzMgv63Jx6XPg+/UnhOC/SdK7xfHk08BHxazQHPMyOf 7CryMzqPrsRcF4WuO6ZmJ4+K/FSMKiVB2HDcc+FeO9ZpC4i3suU8xdLEN4R2VjE+Wf BkV+94HlwdkNQl/bAUUfygreShD5RKkOgvkI6uyO8h7HaHi0YGTnCTi6IG9ZRXp+1a uZJ1Nbr5+frIw== Date: Thu, 3 Dec 2026 17:52:59 +0100 From: Niklas Cassel To: Koichiro Den , Rob Herring Cc: Marek Vasut , linux-pci@vger.kernel.org, Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Geert Uytterhoeven , Lorenzo Pieralisi , Magnus Damm , Manivannan Sadhasivam , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org Subject: Re: [PATCH] PCI: rcar-gen4: Set SRIS mode in rcar_gen4_pcie_common_init() Message-ID: References: <20261129154135.277882-1-marek.vasut+renesas@mailbox.org> X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Hello Koichiro, On Wed, Dec 02, 2026 at 11:54:51PM +0900, Koichiro Den wrote: > P.S. Just thinking out loud about S4 and Niklas's RFC v2... > As you might remember, I've got two Spiders connected at a remote site, one as > RC and the other as EP. Going by the schematic (around R377/R378 marked "Do not > stuff"), I'd expect each board to use its own REFCLK in the stock configuration. > The link still comes up with the S4 driver effectively following the "Common > REFCLK" branch in Figure 104.5 of the S4 UM. The same figure shows a single > "Separate REFCLK" branch for both SRNS and SRIS. The host can supply REFCLK at > the OcuLink connector (pls see c588e1c9846b for the GPIO control). Since a > different endpoint may use that clock, I'd imagine we'd leave refclk-mode > unspecified in the stock Spider host DTS with the binding as proposed in v2. Well, it depends. The normal case, e.g. for a PC, is that the the RC is running in common clock mode, with spread. For an add-in card that sources the clock from the slot, that is fine as the PC's spread would hit both ends the same way and be harmless. (Sometimes you can disable the clock spread in BIOS.) The problem comes when the endpoint uses its own clock. (E.g. RK3588 in EP mode cannot source the clock from the slot.) For RK3588 specifically (with the help of LLM parsing the TRM): What rxX_cmn_refclk_mode = 1 does on the RK3588 PCIe3 PHY. The TRM says that in this mode the elastic buffer runs in its "lowest latency mode", and that "SKP symbol manipulation is disabled". The reason given is that with a common refclk the local and recovered clocks have the same frequency, so nothing needs compensating. The reset value is 1, so the PHY assumes a common clock by default. What goes wrong if the clocks are actually separate. Two independent 100 MHz oscillators may differ by up to 600 ppm, ±300 ppm each. Even at 100 ppm, the buffer gains or loses a symbol roughly every 10,000 symbols, which at 8 GT/s is about every 10 µs. With SKP manipulation disabled, nothing corrects that, so the buffer quickly overflows or underflows. The result is corrupted data, errors and link recovery, or a link that doesn't work at all. With an ordinary M.2 SSD, the SSD uses the refclk the RC board drives onto the slot. That's a common clock, so the default mode is correct, and gives the lowest latency. With the second ROCK 5B as the endpoint, that board uses its own oscillator, but the RC board can't see this. Its PHY stays in common mode with SKP manipulation off, while the two oscillators drift apart, and the link breaks. rk3588-rock-5b-pcie-srns.dtso sets rockchip,rx-common-refclk-mode = <0 0 0 0>, which turns SKP manipulation back on. The RC receiver can then absorb the offset using the SKPs the endpoint sends. I don't know if the PHY on the S4 also disables SKP manipulation when running in common clock mode. If it does not, then it is fully possible that you can run the RC in the default (common clock) mode, and only modify the EP to run in SRNS or SRIS mode. (Because the normal SKP Ordered Set rate already covers +/- 300 ppm per side.) Do you see any correctable errors on that Link? If you have a S4 RC connected to S4 EP, then selecting SRIS or SRNS even on the RC side is clearly more correct (assuming that S4 EP cannot run in common clock mode), even if it happens to work when you configure your S4 RC in common clock. Because, it really is a property of the link. E.g. to run in SRNS mode, clock spread must be disabled on both sides (otherwise the link will not be stable). If either side spreads, then the link is SRIS, and e.g. for RK3588 you need to enable SRIS using a specific register write (regardless of RC / EP mode). This is the proper link DT configuration when using two ROCK 5Bs (or two S4): ┌────────────┬──────────┬──────┬───────────────────────────────────────┬─────────────────────────────────────┐ │ Host clock │ EP clock │ Link │ Host DT │ EP DT │ ├────────────┼──────────┼──────┼───────────────────────────────────────┼─────────────────────────────────────┤ │ no SSC │ no SSC │ SRNS │ refclk-mode = "srns" │ refclk-mode = "srns" │ ├────────────┼──────────┼──────┼───────────────────────────────────────┼─────────────────────────────────────┤ │ SSC │ no SSC │ SRIS │ "sris" , plus the host's SSC setting │ "sris" │ ├────────────┼──────────┼──────┼───────────────────────────────────────┼─────────────────────────────────────┤ │ no SSC │ SSC │ SRIS │ "sris" │ "sris" , plus the EP's SSC setting │ ├────────────┼──────────┼──────┼───────────────────────────────────────┼─────────────────────────────────────┤ │ SSC │ SSC │ SRIS │ "sris" , plus the host's SSC setting │ "sris" , plus the EP's SSC setting │ └────────────┴──────────┴──────┴───────────────────────────────────────┴─────────────────────────────────────┘ "SSC setting" means DT property 'assigned-clock-sscs' on whichever clock does the spreading. With a common refclk (e.g. the endpoint uses the refclk the host supplies on the slot), it doesn't matter whether that clock spreads. Not sure if I should somehow add the above table in the RFC, or try to document it more clearly in the DT binding. It is already mentioned with words, but sometimes an table is easier to understand. Kind regards, Niklas