All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janne Grunau <j@jannau.net>
To: Sasha Finkelstein <k@chaosmail.tech>
Cc: Sven Peter <sven@kernel.org>, Vinod Koul <vkoul@kernel.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/5] phy: apple: atc: Add initial M3 series support
Date: Thu, 26 Nov 2026 01:02:24 +0100	[thread overview]
Message-ID: <20261126000224.GD372978@robin.jannau.net> (raw)
In-Reply-To: <20261125-t8122-phy-v3-3-196e20b3537e@chaosmail.tech>

On Wed, Nov 25, 2026 at 02:11:47PM +0100, Sasha Finkelstein wrote:
> Adds initial support for the new t8122 phy. USB/TB only for now, DP
> will fail to negotiate
> 
> Signed-off-by: Sasha Finkelstein <k@chaosmail.tech>
> ---
>  drivers/phy/apple/atc.c | 449 +++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 347 insertions(+), 102 deletions(-)
> 
> diff --git a/drivers/phy/apple/atc.c b/drivers/phy/apple/atc.c
> index 45f1280a6faa..68fc93a88f41 100644
> --- a/drivers/phy/apple/atc.c
> +++ b/drivers/phy/apple/atc.c
> @@ -100,9 +100,15 @@
>  #define AUSPLL_FREQ_CFG 0x2224
>  #define AUSPLL_FREQ_REFCLK GENMASK(1, 0)
>  
> +#define AUS_COMMON_SHIM_BLK_BIAS_REG 0x0a00
> +#define AUS_COMMON_SHIM_BLK_BIAS_REG_BGBIAS_OV BIT(1)
> +
>  #define AUS_COMMON_SHIM_BLK_VREG 0x0a04
>  #define AUS_VREG_TRIM GENMASK(6, 2)
>  
> +#define AUS_COMMON_DIG_RCAL1 0x804
> +#define AUS_COMMON_DIG_RCAL1_ALL_CODES_DONE BIT(0)
> +
>  #define AUS_UNK_A20 0x0a20
>  #define AUS_UNK_A20_TX_CAL_CODE GENMASK(23, 20)
>  
> @@ -123,15 +129,23 @@
>  #define CIO3PLL_DTC_VREG 0x2a20
>  #define CIO3PLL_DTC_VREG_ADJUST GENMASK(16, 14)
>  
> +#define ATCPHY_EVT_USB2_CTL 0x0
> +#define ATCPHY_EVT_USB2_CTL_EVT_EN 0x1
> +#define ATCPHY_EVT_USB2_CTL_LOAD_CNT 0x8
> +
>  #define ACIOPHY_CFG0 0x08
> +#define ACIOPHY_CFG0_COMMON_BIG BIT(0)
>  #define ACIOPHY_CFG0_COMMON_BIG_OV BIT(1)
> +#define ACIOPHY_CFG0_COMMON_SMALL BIT(2)
>  #define ACIOPHY_CFG0_COMMON_SMALL_OV BIT(3)
> +#define ACIOPHY_CFG0_COMMON_CLAMP BIT(4)
>  #define ACIOPHY_CFG0_COMMON_CLAMP_OV BIT(5)
>  #define ACIOPHY_CFG0_RX_SMALL_OV GENMASK(9, 8)
>  #define ACIOPHY_CFG0_RX_BIG_OV GENMASK(13, 12)
>  #define ACIOPHY_CFG0_RX_CLAMP_OV GENMASK(17, 16)
>  
> -#define ACIOPHY_CROSSBAR 0x4c
> +#define ACIOPHY_CROSSBAR_T8103 0x4c
> +#define ACIOPHY_CROSSBAR_T8122 0x64
>  #define ACIOPHY_CROSSBAR_PROTOCOL GENMASK(4, 0)
>  #define ACIOPHY_CROSSBAR_PROTOCOL_USB4 0x0
>  #define ACIOPHY_CROSSBAR_PROTOCOL_USB4_SWAPPED 0x1
> @@ -146,7 +160,8 @@
>  #define ACIOPHY_CROSSBAR_DP_SINGLE_PMA_UNK008 0x008
>  #define ACIOPHY_CROSSBAR_DP_BOTH_PMA BIT(17)
>  
> -#define ACIOPHY_LANE_MODE 0x48
> +#define ACIOPHY_LANE_MODE_T8103 0x48
> +#define ACIOPHY_LANE_MODE_T8122 0x60
>  #define ACIOPHY_LANE_MODE_RX0 GENMASK(2, 0)
>  #define ACIOPHY_LANE_MODE_TX0 GENMASK(5, 3)
>  #define ACIOPHY_LANE_MODE_RX1 GENMASK(8, 6)
> @@ -180,6 +195,24 @@ enum atcphy_lane_mode {
>  #define ACIOPHY_TOP_BIST_PHY_CFG1 0xac
>  #define ACIOPHY_TOP_BIST_PHY_CFG1_LN0_PWR_DOWN GENMASK(13, 10)
>  
> +#define ACIOPHY_BIST_CFG1 0x17000
> +#define ACIOPHY_BIST_CFG1_CLOCK_EN BIT(0)
> +#define ACIOPHY_BIST_CFG1_USB_EN BIT(2)
> +
> +#define ACIOPHY_BIST_CFG2 0x17004
> +#define ACIOPHY_BIST_CFG2_LN0_PHY_STATUS_RE BIT(2)
> +
> +#define ACIOPHY_BIST_MAC_USBPHY_STATUS2 0x17080
> +#define ACIOPHY_BIST_MAC_USBPHY_STATUS2_LN0_PHY_STATUS2 BIT(7)
> +
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV1 0x17088
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PIPE_RESET_N_OV 0x100000
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PWR_DOWN_OV GENMASK(26, 25)
> +
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV2 0x1708c
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_RESET_N_OV 0x200
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_PWR_DOWN_OV 0x20
> +
>  #define ACIOPHY_SLEEP_CTRL 0x1b0
>  #define ACIOPHY_SLEEP_CTRL_TX_BIG_OV GENMASK(3, 2)
>  #define ACIOPHY_SLEEP_CTRL_TX_SMALL_OV GENMASK(7, 6)
> @@ -463,6 +496,7 @@ enum atcphy_lane_mode {
>  
>  /* USB2 PHY regs */
>  #define USB2PHY_USBCTL 0x00
> +#define USB2PHY_USBCTL_USB_MODE 0x7
>  #define USB2PHY_USBCTL_RUN 2
>  #define USB2PHY_USBCTL_ISOLATION 4
>  
> @@ -556,6 +590,21 @@ struct atcphy_mode_configuration {
>  	bool set_swap;
>  };
>  
> +struct apple_atcphy;
> +
> +struct atcphy_hw {
> +	void (*configure_post_tunable)(struct apple_atcphy *atcphy, enum atcphy_mode mode);
> +	void (*configure_pipehandler_usb3_host)(struct apple_atcphy *atcphy);
> +	void (*configure_usb2_evt_ctl)(struct apple_atcphy *atcphy);
> +	void (*enable_cio3pll_clk)(struct apple_atcphy *atcphy);
> +	int (*wait_rcal1_done)(struct apple_atcphy *atcphy, enum atcphy_mode mode);
> +	void (*configure_lane_pmafsm)(struct apple_atcphy *atcphy,
> +				      const struct atcphy_mode_configuration *mode_cfg);
> +	int aciophy_lane_mode;
> +	int aciophy_crossbar;
> +	bool need_dp_tunables;
> +};
> +
>  /**
>   * struct apple_atcphy - Apple Type-C PHY device struct
>   * @np: Device node pointer
> @@ -566,6 +615,7 @@ struct atcphy_mode_configuration {
>   * @tunables.lane_usb3: USB3 lane-specific tunables
>   * @tunables.lane_dp: DisplayPort lane-specific tunables
>   * @tunables.lane_usb4: USB4 lane-specific tunables
> + * @hw: Hardware version specific data
>   * @mode: Current PHY operating mode
>   * @swap_lanes: True if lanes must be swapped due to cable orientation
>   * @dp_link_rate: DisplayPort link rate
> @@ -599,9 +649,10 @@ struct apple_atcphy {
>  		struct apple_tunable *lane_usb4[2];
>  	} tunables;
>  
> +	const struct atcphy_hw *hw;
>  	enum atcphy_mode mode;
> -	bool swap_lanes;
>  	int dp_link_rate;
> +	bool swap_lanes;
>  	bool pipehandler_up;
>  
>  	struct {
> @@ -983,11 +1034,141 @@ static void atcphy_pipehandler_set_mux(struct apple_atcphy *atcphy, u32 data, u3
>  	udelay(10);
>  }
>  
> -static int atcphy_configure_pipehandler_usb3(struct apple_atcphy *atcphy, bool host)
> +static void atcphy_clear_nonselected_phy_reset(struct apple_atcphy *atcphy)
> +{
> +	/* Clear reset for non-selected USB3 PHY (?) */
> +	mask32(atcphy->regs.pipehandler + PIPEHANDLER_NONSELECTED_OVERRIDE,
> +	       PIPEHANDLER_NATIVE_POWER_DOWN, FIELD_PREP(PIPEHANDLER_NATIVE_POWER_DOWN, 3));
> +	clear32(atcphy->regs.pipehandler + PIPEHANDLER_NONSELECTED_OVERRIDE,
> +		PIPEHANDLER_NATIVE_RESET);
> +}
> +
> +static void atcphy_configure_pipehandler_usb3_host_t8122(struct apple_atcphy *atcphy)
> +{
> +	int ret;
> +	u32 reg;
> +
> +	core_set32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_CLOCK_EN);
> +	/* This should be a mask, but unsure what bits should be cleared */
> +	writel(ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PIPE_RESET_N_OV |
> +	       FIELD_PREP(ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PWR_DOWN_OV, 2),
> +	       atcphy->regs.core + ACIOPHY_BIST_MAC_USBPHY_CFG_OV1);
> +	/* This should be a mask, but unsure what bits should be cleared */
> +	writel(ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_RESET_N_OV |
> +	       ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_PWR_DOWN_OV,
> +	       atcphy->regs.core + ACIOPHY_BIST_MAC_USBPHY_CFG_OV2);
> +	core_set32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_BIST_CFG1, reg,
> +				 (reg & ACIOPHY_BIST_CFG1_USB_EN), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_BIST_CFG1_USB_EN\n");
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_BIST_MAC_USBPHY_STATUS2, reg,
> +				 !(reg & ACIOPHY_BIST_MAC_USBPHY_STATUS2_LN0_PHY_STATUS2),
> +				 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_BIST_MAC_USBPHY_STATUS2_LN0_PHY_STATUS2\n");
> +
> +	core_set32(atcphy, ACIOPHY_BIST_CFG2, ACIOPHY_BIST_CFG2_LN0_PHY_STATUS_RE);
> +	udelay(10);
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG2, ACIOPHY_BIST_CFG2_LN0_PHY_STATUS_RE);
> +	core_mask32(atcphy, ACIOPHY_BIST_MAC_USBPHY_CFG_OV1,
> +		    ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PWR_DOWN_OV,
> +		    FIELD_PREP(ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PWR_DOWN_OV, 3));
> +
> +	/* there is a read and write of ACIOPHY_BIST_MAC_USBPHY_CFG_OV2 here with same values */
> +	udelay(10);
> +	core_set32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_BIST_CFG1, reg,
> +				 (reg & ACIOPHY_BIST_CFG1_USB_EN), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_BIST_CFG1_USB_EN 2nd toggle\n");
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_BIST_MAC_USBPHY_STATUS2, reg,
> +				 !(reg & ACIOPHY_BIST_MAC_USBPHY_STATUS2_LN0_PHY_STATUS2),
> +				 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_BIST_MAC_USBPHY_STATUS2_LN0_PHY_STATUS2 2nd time\n");
> +	core_set32(atcphy, ACIOPHY_BIST_CFG2, ACIOPHY_BIST_CFG2_LN0_PHY_STATUS_RE);
> +	udelay(10);
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG2, ACIOPHY_BIST_CFG2_LN0_PHY_STATUS_RE);
> +
> +	atcphy_clear_nonselected_phy_reset(atcphy);
> +
> +	core_clear32(atcphy, ACIOPHY_BIST_MAC_USBPHY_CFG_OV2,
> +		     ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_RESET_N_OV |
> +		     ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_PWR_DOWN_OV);
> +	core_set32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_BIST_CFG1, reg,
> +				 (reg & ACIOPHY_BIST_CFG1_USB_EN), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_BIST_CFG1_USB_EN 3rd toggle\n");
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_CLOCK_EN);
> +}
> +
> +static void atcphy_configure_pipehandler_usb3_host_t8103(struct apple_atcphy *atcphy)
>  {
>  	int ret;
>  	u32 reg;
>  
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_PHY_CFG0,
> +		   ACIOPHY_TOP_BIST_PHY_CFG0_LN0_RESET_N);
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_OV_CFG, ACIOPHY_TOP_BIST_OV_CFG_LN0_RESET_N_OV);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> +				 !(reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK23), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK23\n");
> +
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_READ_CTRL,
> +		   ACIOPHY_TOP_BIST_READ_CTRL_LN0_PHY_STATUS_RE);
> +	core_clear32(atcphy, ACIOPHY_TOP_BIST_READ_CTRL,
> +		     ACIOPHY_TOP_BIST_READ_CTRL_LN0_PHY_STATUS_RE);
> +
> +	core_mask32(atcphy, ACIOPHY_TOP_BIST_PHY_CFG1,
> +		    ACIOPHY_TOP_BIST_PHY_CFG1_LN0_PWR_DOWN,
> +		    FIELD_PREP(ACIOPHY_TOP_BIST_PHY_CFG1_LN0_PWR_DOWN, 3));
> +
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_OV_CFG,
> +		   ACIOPHY_TOP_BIST_OV_CFG_LN0_PWR_DOWN_OV);
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> +		   ACIOPHY_TOP_BIST_CIOPHY_CFG1_CLK_EN);
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> +		   ACIOPHY_TOP_BIST_CIOPHY_CFG1_BIST_EN);
> +	writel(0, atcphy->regs.core + ACIOPHY_TOP_BIST_CIOPHY_CFG1);
> +
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> +				 (reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK0), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK0\n");
> +
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> +				 !(reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK23), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK23\n");
> +
> +	atcphy_clear_nonselected_phy_reset(atcphy);
> +
> +	/* More BIST stuff (?) */
> +	writel(0, atcphy->regs.core + ACIOPHY_TOP_BIST_OV_CFG);
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> +		   ACIOPHY_TOP_BIST_CIOPHY_CFG1_CLK_EN);
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> +		   ACIOPHY_TOP_BIST_CIOPHY_CFG1_BIST_EN);
> +}
> +
> +static int atcphy_configure_pipehandler_usb3(struct apple_atcphy *atcphy, bool host)
> +{
> +	int ret;
> +
>  	ret = atcphy_pipehandler_check(atcphy);
>  	if (ret)
>  		return ret;
> @@ -1012,56 +1193,7 @@ static int atcphy_configure_pipehandler_usb3(struct apple_atcphy *atcphy, bool h
>  		}
>  
>  		/* BIST dance */
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_PHY_CFG0,
> -			   ACIOPHY_TOP_BIST_PHY_CFG0_LN0_RESET_N);
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_OV_CFG, ACIOPHY_TOP_BIST_OV_CFG_LN0_RESET_N_OV);
> -		ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> -					 !(reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK23), 10, 10000);
> -		if (ret)
> -			dev_warn(atcphy->dev,
> -				 "Timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK23\n");
> -
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_READ_CTRL,
> -			   ACIOPHY_TOP_BIST_READ_CTRL_LN0_PHY_STATUS_RE);
> -		core_clear32(atcphy, ACIOPHY_TOP_BIST_READ_CTRL,
> -			     ACIOPHY_TOP_BIST_READ_CTRL_LN0_PHY_STATUS_RE);
> -
> -		core_mask32(atcphy, ACIOPHY_TOP_BIST_PHY_CFG1,
> -			    ACIOPHY_TOP_BIST_PHY_CFG1_LN0_PWR_DOWN,
> -			    FIELD_PREP(ACIOPHY_TOP_BIST_PHY_CFG1_LN0_PWR_DOWN, 3));
> -
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_OV_CFG,
> -			   ACIOPHY_TOP_BIST_OV_CFG_LN0_PWR_DOWN_OV);
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> -			   ACIOPHY_TOP_BIST_CIOPHY_CFG1_CLK_EN);
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> -			   ACIOPHY_TOP_BIST_CIOPHY_CFG1_BIST_EN);
> -		writel(0, atcphy->regs.core + ACIOPHY_TOP_BIST_CIOPHY_CFG1);
> -
> -		ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> -					 (reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK0), 10, 10000);
> -		if (ret)
> -			dev_warn(atcphy->dev,
> -				 "timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK0\n");
> -
> -		ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> -					 !(reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK23), 10, 10000);
> -		if (ret)
> -			dev_warn(atcphy->dev,
> -				 "timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK23\n");
> -
> -		/* Clear reset for non-selected USB3 PHY (?) */
> -		mask32(atcphy->regs.pipehandler + PIPEHANDLER_NONSELECTED_OVERRIDE,
> -		       PIPEHANDLER_NATIVE_POWER_DOWN, FIELD_PREP(PIPEHANDLER_NATIVE_POWER_DOWN, 3));
> -		clear32(atcphy->regs.pipehandler + PIPEHANDLER_NONSELECTED_OVERRIDE,
> -			PIPEHANDLER_NATIVE_RESET);
> -
> -		/* More BIST stuff (?) */
> -		writel(0, atcphy->regs.core + ACIOPHY_TOP_BIST_OV_CFG);
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> -			   ACIOPHY_TOP_BIST_CIOPHY_CFG1_CLK_EN);
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> -			   ACIOPHY_TOP_BIST_CIOPHY_CFG1_BIST_EN);
> +		atcphy->hw->configure_pipehandler_usb3_host(atcphy);
>  	}
>  
>  	/* Configure PIPE mux to USB3 PHY */
> @@ -1183,33 +1315,10 @@ static void atcphy_setup_pipehandler(struct apple_atcphy *atcphy)
>  				   PIPEHANDLER_MUX_CTRL_CLK_DUMMY);
>  }
>  
> -static void atcphy_configure_lanes(struct apple_atcphy *atcphy, enum atcphy_mode mode)
> +static void
> +atcphy_configure_lane_pmafsm_t8103(struct apple_atcphy *atcphy,
> +				   const struct atcphy_mode_configuration *mode_cfg)

Since atcphy_configure_lane_pmafsm_t8103() is called through a function
pointer the diff would be a more readable if the previous
atcphy_configure_lanes() would be split

Janne

WARNING: multiple messages have this Message-ID (diff)
From: Janne Grunau <j@jannau.net>
To: Sasha Finkelstein <k@chaosmail.tech>
Cc: Sven Peter <sven@kernel.org>, Vinod Koul <vkoul@kernel.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/5] phy: apple: atc: Add initial M3 series support
Date: Thu, 26 Nov 2026 01:02:24 +0100	[thread overview]
Message-ID: <20261126000224.GD372978@robin.jannau.net> (raw)
In-Reply-To: <20261125-t8122-phy-v3-3-196e20b3537e@chaosmail.tech>

On Wed, Nov 25, 2026 at 02:11:47PM +0100, Sasha Finkelstein wrote:
> Adds initial support for the new t8122 phy. USB/TB only for now, DP
> will fail to negotiate
> 
> Signed-off-by: Sasha Finkelstein <k@chaosmail.tech>
> ---
>  drivers/phy/apple/atc.c | 449 +++++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 347 insertions(+), 102 deletions(-)
> 
> diff --git a/drivers/phy/apple/atc.c b/drivers/phy/apple/atc.c
> index 45f1280a6faa..68fc93a88f41 100644
> --- a/drivers/phy/apple/atc.c
> +++ b/drivers/phy/apple/atc.c
> @@ -100,9 +100,15 @@
>  #define AUSPLL_FREQ_CFG 0x2224
>  #define AUSPLL_FREQ_REFCLK GENMASK(1, 0)
>  
> +#define AUS_COMMON_SHIM_BLK_BIAS_REG 0x0a00
> +#define AUS_COMMON_SHIM_BLK_BIAS_REG_BGBIAS_OV BIT(1)
> +
>  #define AUS_COMMON_SHIM_BLK_VREG 0x0a04
>  #define AUS_VREG_TRIM GENMASK(6, 2)
>  
> +#define AUS_COMMON_DIG_RCAL1 0x804
> +#define AUS_COMMON_DIG_RCAL1_ALL_CODES_DONE BIT(0)
> +
>  #define AUS_UNK_A20 0x0a20
>  #define AUS_UNK_A20_TX_CAL_CODE GENMASK(23, 20)
>  
> @@ -123,15 +129,23 @@
>  #define CIO3PLL_DTC_VREG 0x2a20
>  #define CIO3PLL_DTC_VREG_ADJUST GENMASK(16, 14)
>  
> +#define ATCPHY_EVT_USB2_CTL 0x0
> +#define ATCPHY_EVT_USB2_CTL_EVT_EN 0x1
> +#define ATCPHY_EVT_USB2_CTL_LOAD_CNT 0x8
> +
>  #define ACIOPHY_CFG0 0x08
> +#define ACIOPHY_CFG0_COMMON_BIG BIT(0)
>  #define ACIOPHY_CFG0_COMMON_BIG_OV BIT(1)
> +#define ACIOPHY_CFG0_COMMON_SMALL BIT(2)
>  #define ACIOPHY_CFG0_COMMON_SMALL_OV BIT(3)
> +#define ACIOPHY_CFG0_COMMON_CLAMP BIT(4)
>  #define ACIOPHY_CFG0_COMMON_CLAMP_OV BIT(5)
>  #define ACIOPHY_CFG0_RX_SMALL_OV GENMASK(9, 8)
>  #define ACIOPHY_CFG0_RX_BIG_OV GENMASK(13, 12)
>  #define ACIOPHY_CFG0_RX_CLAMP_OV GENMASK(17, 16)
>  
> -#define ACIOPHY_CROSSBAR 0x4c
> +#define ACIOPHY_CROSSBAR_T8103 0x4c
> +#define ACIOPHY_CROSSBAR_T8122 0x64
>  #define ACIOPHY_CROSSBAR_PROTOCOL GENMASK(4, 0)
>  #define ACIOPHY_CROSSBAR_PROTOCOL_USB4 0x0
>  #define ACIOPHY_CROSSBAR_PROTOCOL_USB4_SWAPPED 0x1
> @@ -146,7 +160,8 @@
>  #define ACIOPHY_CROSSBAR_DP_SINGLE_PMA_UNK008 0x008
>  #define ACIOPHY_CROSSBAR_DP_BOTH_PMA BIT(17)
>  
> -#define ACIOPHY_LANE_MODE 0x48
> +#define ACIOPHY_LANE_MODE_T8103 0x48
> +#define ACIOPHY_LANE_MODE_T8122 0x60
>  #define ACIOPHY_LANE_MODE_RX0 GENMASK(2, 0)
>  #define ACIOPHY_LANE_MODE_TX0 GENMASK(5, 3)
>  #define ACIOPHY_LANE_MODE_RX1 GENMASK(8, 6)
> @@ -180,6 +195,24 @@ enum atcphy_lane_mode {
>  #define ACIOPHY_TOP_BIST_PHY_CFG1 0xac
>  #define ACIOPHY_TOP_BIST_PHY_CFG1_LN0_PWR_DOWN GENMASK(13, 10)
>  
> +#define ACIOPHY_BIST_CFG1 0x17000
> +#define ACIOPHY_BIST_CFG1_CLOCK_EN BIT(0)
> +#define ACIOPHY_BIST_CFG1_USB_EN BIT(2)
> +
> +#define ACIOPHY_BIST_CFG2 0x17004
> +#define ACIOPHY_BIST_CFG2_LN0_PHY_STATUS_RE BIT(2)
> +
> +#define ACIOPHY_BIST_MAC_USBPHY_STATUS2 0x17080
> +#define ACIOPHY_BIST_MAC_USBPHY_STATUS2_LN0_PHY_STATUS2 BIT(7)
> +
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV1 0x17088
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PIPE_RESET_N_OV 0x100000
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PWR_DOWN_OV GENMASK(26, 25)
> +
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV2 0x1708c
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_RESET_N_OV 0x200
> +#define ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_PWR_DOWN_OV 0x20
> +
>  #define ACIOPHY_SLEEP_CTRL 0x1b0
>  #define ACIOPHY_SLEEP_CTRL_TX_BIG_OV GENMASK(3, 2)
>  #define ACIOPHY_SLEEP_CTRL_TX_SMALL_OV GENMASK(7, 6)
> @@ -463,6 +496,7 @@ enum atcphy_lane_mode {
>  
>  /* USB2 PHY regs */
>  #define USB2PHY_USBCTL 0x00
> +#define USB2PHY_USBCTL_USB_MODE 0x7
>  #define USB2PHY_USBCTL_RUN 2
>  #define USB2PHY_USBCTL_ISOLATION 4
>  
> @@ -556,6 +590,21 @@ struct atcphy_mode_configuration {
>  	bool set_swap;
>  };
>  
> +struct apple_atcphy;
> +
> +struct atcphy_hw {
> +	void (*configure_post_tunable)(struct apple_atcphy *atcphy, enum atcphy_mode mode);
> +	void (*configure_pipehandler_usb3_host)(struct apple_atcphy *atcphy);
> +	void (*configure_usb2_evt_ctl)(struct apple_atcphy *atcphy);
> +	void (*enable_cio3pll_clk)(struct apple_atcphy *atcphy);
> +	int (*wait_rcal1_done)(struct apple_atcphy *atcphy, enum atcphy_mode mode);
> +	void (*configure_lane_pmafsm)(struct apple_atcphy *atcphy,
> +				      const struct atcphy_mode_configuration *mode_cfg);
> +	int aciophy_lane_mode;
> +	int aciophy_crossbar;
> +	bool need_dp_tunables;
> +};
> +
>  /**
>   * struct apple_atcphy - Apple Type-C PHY device struct
>   * @np: Device node pointer
> @@ -566,6 +615,7 @@ struct atcphy_mode_configuration {
>   * @tunables.lane_usb3: USB3 lane-specific tunables
>   * @tunables.lane_dp: DisplayPort lane-specific tunables
>   * @tunables.lane_usb4: USB4 lane-specific tunables
> + * @hw: Hardware version specific data
>   * @mode: Current PHY operating mode
>   * @swap_lanes: True if lanes must be swapped due to cable orientation
>   * @dp_link_rate: DisplayPort link rate
> @@ -599,9 +649,10 @@ struct apple_atcphy {
>  		struct apple_tunable *lane_usb4[2];
>  	} tunables;
>  
> +	const struct atcphy_hw *hw;
>  	enum atcphy_mode mode;
> -	bool swap_lanes;
>  	int dp_link_rate;
> +	bool swap_lanes;
>  	bool pipehandler_up;
>  
>  	struct {
> @@ -983,11 +1034,141 @@ static void atcphy_pipehandler_set_mux(struct apple_atcphy *atcphy, u32 data, u3
>  	udelay(10);
>  }
>  
> -static int atcphy_configure_pipehandler_usb3(struct apple_atcphy *atcphy, bool host)
> +static void atcphy_clear_nonselected_phy_reset(struct apple_atcphy *atcphy)
> +{
> +	/* Clear reset for non-selected USB3 PHY (?) */
> +	mask32(atcphy->regs.pipehandler + PIPEHANDLER_NONSELECTED_OVERRIDE,
> +	       PIPEHANDLER_NATIVE_POWER_DOWN, FIELD_PREP(PIPEHANDLER_NATIVE_POWER_DOWN, 3));
> +	clear32(atcphy->regs.pipehandler + PIPEHANDLER_NONSELECTED_OVERRIDE,
> +		PIPEHANDLER_NATIVE_RESET);
> +}
> +
> +static void atcphy_configure_pipehandler_usb3_host_t8122(struct apple_atcphy *atcphy)
> +{
> +	int ret;
> +	u32 reg;
> +
> +	core_set32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_CLOCK_EN);
> +	/* This should be a mask, but unsure what bits should be cleared */
> +	writel(ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PIPE_RESET_N_OV |
> +	       FIELD_PREP(ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PWR_DOWN_OV, 2),
> +	       atcphy->regs.core + ACIOPHY_BIST_MAC_USBPHY_CFG_OV1);
> +	/* This should be a mask, but unsure what bits should be cleared */
> +	writel(ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_RESET_N_OV |
> +	       ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_PWR_DOWN_OV,
> +	       atcphy->regs.core + ACIOPHY_BIST_MAC_USBPHY_CFG_OV2);
> +	core_set32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_BIST_CFG1, reg,
> +				 (reg & ACIOPHY_BIST_CFG1_USB_EN), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_BIST_CFG1_USB_EN\n");
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_BIST_MAC_USBPHY_STATUS2, reg,
> +				 !(reg & ACIOPHY_BIST_MAC_USBPHY_STATUS2_LN0_PHY_STATUS2),
> +				 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_BIST_MAC_USBPHY_STATUS2_LN0_PHY_STATUS2\n");
> +
> +	core_set32(atcphy, ACIOPHY_BIST_CFG2, ACIOPHY_BIST_CFG2_LN0_PHY_STATUS_RE);
> +	udelay(10);
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG2, ACIOPHY_BIST_CFG2_LN0_PHY_STATUS_RE);
> +	core_mask32(atcphy, ACIOPHY_BIST_MAC_USBPHY_CFG_OV1,
> +		    ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PWR_DOWN_OV,
> +		    FIELD_PREP(ACIOPHY_BIST_MAC_USBPHY_CFG_OV1_LN0_PWR_DOWN_OV, 3));
> +
> +	/* there is a read and write of ACIOPHY_BIST_MAC_USBPHY_CFG_OV2 here with same values */
> +	udelay(10);
> +	core_set32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_BIST_CFG1, reg,
> +				 (reg & ACIOPHY_BIST_CFG1_USB_EN), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_BIST_CFG1_USB_EN 2nd toggle\n");
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_BIST_MAC_USBPHY_STATUS2, reg,
> +				 !(reg & ACIOPHY_BIST_MAC_USBPHY_STATUS2_LN0_PHY_STATUS2),
> +				 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_BIST_MAC_USBPHY_STATUS2_LN0_PHY_STATUS2 2nd time\n");
> +	core_set32(atcphy, ACIOPHY_BIST_CFG2, ACIOPHY_BIST_CFG2_LN0_PHY_STATUS_RE);
> +	udelay(10);
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG2, ACIOPHY_BIST_CFG2_LN0_PHY_STATUS_RE);
> +
> +	atcphy_clear_nonselected_phy_reset(atcphy);
> +
> +	core_clear32(atcphy, ACIOPHY_BIST_MAC_USBPHY_CFG_OV2,
> +		     ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_RESET_N_OV |
> +		     ACIOPHY_BIST_MAC_USBPHY_CFG_OV2_LN0_PWR_DOWN_OV);
> +	core_set32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_BIST_CFG1, reg,
> +				 (reg & ACIOPHY_BIST_CFG1_USB_EN), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_BIST_CFG1_USB_EN 3rd toggle\n");
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_USB_EN);
> +	core_clear32(atcphy, ACIOPHY_BIST_CFG1, ACIOPHY_BIST_CFG1_CLOCK_EN);
> +}
> +
> +static void atcphy_configure_pipehandler_usb3_host_t8103(struct apple_atcphy *atcphy)
>  {
>  	int ret;
>  	u32 reg;
>  
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_PHY_CFG0,
> +		   ACIOPHY_TOP_BIST_PHY_CFG0_LN0_RESET_N);
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_OV_CFG, ACIOPHY_TOP_BIST_OV_CFG_LN0_RESET_N_OV);
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> +				 !(reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK23), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "Timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK23\n");
> +
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_READ_CTRL,
> +		   ACIOPHY_TOP_BIST_READ_CTRL_LN0_PHY_STATUS_RE);
> +	core_clear32(atcphy, ACIOPHY_TOP_BIST_READ_CTRL,
> +		     ACIOPHY_TOP_BIST_READ_CTRL_LN0_PHY_STATUS_RE);
> +
> +	core_mask32(atcphy, ACIOPHY_TOP_BIST_PHY_CFG1,
> +		    ACIOPHY_TOP_BIST_PHY_CFG1_LN0_PWR_DOWN,
> +		    FIELD_PREP(ACIOPHY_TOP_BIST_PHY_CFG1_LN0_PWR_DOWN, 3));
> +
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_OV_CFG,
> +		   ACIOPHY_TOP_BIST_OV_CFG_LN0_PWR_DOWN_OV);
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> +		   ACIOPHY_TOP_BIST_CIOPHY_CFG1_CLK_EN);
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> +		   ACIOPHY_TOP_BIST_CIOPHY_CFG1_BIST_EN);
> +	writel(0, atcphy->regs.core + ACIOPHY_TOP_BIST_CIOPHY_CFG1);
> +
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> +				 (reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK0), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK0\n");
> +
> +	ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> +				 !(reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK23), 10, 10000);
> +	if (ret)
> +		dev_warn(atcphy->dev,
> +			 "timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK23\n");
> +
> +	atcphy_clear_nonselected_phy_reset(atcphy);
> +
> +	/* More BIST stuff (?) */
> +	writel(0, atcphy->regs.core + ACIOPHY_TOP_BIST_OV_CFG);
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> +		   ACIOPHY_TOP_BIST_CIOPHY_CFG1_CLK_EN);
> +	core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> +		   ACIOPHY_TOP_BIST_CIOPHY_CFG1_BIST_EN);
> +}
> +
> +static int atcphy_configure_pipehandler_usb3(struct apple_atcphy *atcphy, bool host)
> +{
> +	int ret;
> +
>  	ret = atcphy_pipehandler_check(atcphy);
>  	if (ret)
>  		return ret;
> @@ -1012,56 +1193,7 @@ static int atcphy_configure_pipehandler_usb3(struct apple_atcphy *atcphy, bool h
>  		}
>  
>  		/* BIST dance */
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_PHY_CFG0,
> -			   ACIOPHY_TOP_BIST_PHY_CFG0_LN0_RESET_N);
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_OV_CFG, ACIOPHY_TOP_BIST_OV_CFG_LN0_RESET_N_OV);
> -		ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> -					 !(reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK23), 10, 10000);
> -		if (ret)
> -			dev_warn(atcphy->dev,
> -				 "Timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK23\n");
> -
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_READ_CTRL,
> -			   ACIOPHY_TOP_BIST_READ_CTRL_LN0_PHY_STATUS_RE);
> -		core_clear32(atcphy, ACIOPHY_TOP_BIST_READ_CTRL,
> -			     ACIOPHY_TOP_BIST_READ_CTRL_LN0_PHY_STATUS_RE);
> -
> -		core_mask32(atcphy, ACIOPHY_TOP_BIST_PHY_CFG1,
> -			    ACIOPHY_TOP_BIST_PHY_CFG1_LN0_PWR_DOWN,
> -			    FIELD_PREP(ACIOPHY_TOP_BIST_PHY_CFG1_LN0_PWR_DOWN, 3));
> -
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_OV_CFG,
> -			   ACIOPHY_TOP_BIST_OV_CFG_LN0_PWR_DOWN_OV);
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> -			   ACIOPHY_TOP_BIST_CIOPHY_CFG1_CLK_EN);
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> -			   ACIOPHY_TOP_BIST_CIOPHY_CFG1_BIST_EN);
> -		writel(0, atcphy->regs.core + ACIOPHY_TOP_BIST_CIOPHY_CFG1);
> -
> -		ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> -					 (reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK0), 10, 10000);
> -		if (ret)
> -			dev_warn(atcphy->dev,
> -				 "timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK0\n");
> -
> -		ret = readl_poll_timeout(atcphy->regs.core + ACIOPHY_TOP_PHY_STAT, reg,
> -					 !(reg & ACIOPHY_TOP_PHY_STAT_LN0_UNK23), 10, 10000);
> -		if (ret)
> -			dev_warn(atcphy->dev,
> -				 "timed out waiting for ACIOPHY_TOP_PHY_STAT_LN0_UNK23\n");
> -
> -		/* Clear reset for non-selected USB3 PHY (?) */
> -		mask32(atcphy->regs.pipehandler + PIPEHANDLER_NONSELECTED_OVERRIDE,
> -		       PIPEHANDLER_NATIVE_POWER_DOWN, FIELD_PREP(PIPEHANDLER_NATIVE_POWER_DOWN, 3));
> -		clear32(atcphy->regs.pipehandler + PIPEHANDLER_NONSELECTED_OVERRIDE,
> -			PIPEHANDLER_NATIVE_RESET);
> -
> -		/* More BIST stuff (?) */
> -		writel(0, atcphy->regs.core + ACIOPHY_TOP_BIST_OV_CFG);
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> -			   ACIOPHY_TOP_BIST_CIOPHY_CFG1_CLK_EN);
> -		core_set32(atcphy, ACIOPHY_TOP_BIST_CIOPHY_CFG1,
> -			   ACIOPHY_TOP_BIST_CIOPHY_CFG1_BIST_EN);
> +		atcphy->hw->configure_pipehandler_usb3_host(atcphy);
>  	}
>  
>  	/* Configure PIPE mux to USB3 PHY */
> @@ -1183,33 +1315,10 @@ static void atcphy_setup_pipehandler(struct apple_atcphy *atcphy)
>  				   PIPEHANDLER_MUX_CTRL_CLK_DUMMY);
>  }
>  
> -static void atcphy_configure_lanes(struct apple_atcphy *atcphy, enum atcphy_mode mode)
> +static void
> +atcphy_configure_lane_pmafsm_t8103(struct apple_atcphy *atcphy,
> +				   const struct atcphy_mode_configuration *mode_cfg)

Since atcphy_configure_lane_pmafsm_t8103() is called through a function
pointer the diff would be a more readable if the previous
atcphy_configure_lanes() would be split

Janne

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  parent reply	other threads:[~2026-11-26  0:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 13:11 [PATCH v3 0/5] phy: apple: atc: Add M3 support Sasha Finkelstein
2026-11-25 13:11 ` Sasha Finkelstein
2026-11-25 13:11 ` [PATCH v3 1/5] dt-bindings: phy: atcphy: Add M3 series Sasha Finkelstein
2026-11-25 13:11   ` Sasha Finkelstein
2026-11-25 23:44   ` Janne Grunau
2026-11-25 23:44     ` Janne Grunau
2026-11-25 13:11 ` [PATCH v3 2/5] soc: apple: tunable: Allow passing NULL to tunable_apply Sasha Finkelstein
2026-11-25 13:11   ` Sasha Finkelstein
2026-11-25 13:11 ` [PATCH v3 3/5] phy: apple: atc: Add initial M3 series support Sasha Finkelstein
2026-11-25 13:11   ` Sasha Finkelstein
2026-11-25 21:38   ` sashiko-bot
2026-11-25 21:38     ` sashiko-bot
2026-11-26  0:02   ` Janne Grunau [this message]
2026-11-26  0:02     ` Janne Grunau
2026-11-25 13:11 ` [PATCH v3 4/5] phy: apple: atc: Add T8122 DisplayPort support Sasha Finkelstein
2026-11-25 13:11   ` Sasha Finkelstein
2026-11-25 21:39   ` sashiko-bot
2026-11-25 21:39     ` sashiko-bot
2026-11-26  1:05   ` Janne Grunau
2026-11-26  1:05     ` Janne Grunau
2026-11-25 13:11 ` [PATCH v3 5/5] phy: apple: atc: Split generation-specific code Sasha Finkelstein
2026-11-25 13:11   ` Sasha Finkelstein
2026-11-26  1:12   ` Janne Grunau
2026-11-26  1:12     ` Janne Grunau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261126000224.GD372978@robin.jannau.net \
    --to=j@jannau.net \
    --cc=asahi@lists.linux.dev \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=k@chaosmail.tech \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=mani@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=robh@kernel.org \
    --cc=sven@kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.