From patchwork Mon Jul 15 17:47:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 13733754 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 334F5C3DA4A for ; Mon, 15 Jul 2024 17:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ywxTILTlmJ6tjP7wuNUYl7CbllkLqss9NjOm4vPjFqw=; b=nJYbAUZbfWODh26RDeDv2uoJ6o c11/MTAWoBu9u5NnMlh5pzsmiPgMoGVJGMNgUq/QjFdV7s/EwqTIdjt4bC8PL7yn/8L3UD4JFPo+r DKyCRClMLE7s04cMwPPdCDqsABP594oQ9+/vUQsHeL3VcknSr+vWld6m6k9IDqwVMyNZnyB2TXgxN 3ODEzGYU/O4hUJUot4tLOYvA0t4+G809pXctozrbCDlJqeHqcc57yOMwduqFM7lCUwMZ+Z3urITF8 Y1khcqZqNp93O8HyiO4yEo/FabTaGiCUB33rS2prRhFUN8HhuAnKQKSaEzgfHXMwGSnczz4smkaMB f1vuVwoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTPoF-00000007v6h-2xGY; Mon, 15 Jul 2024 17:48:23 +0000 Received: from mail-westeuropeazlp170110003.outbound.protection.outlook.com ([2a01:111:f403:c201::3] helo=AS8PR04CU009.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTPnf-00000007ute-3vfM; Mon, 15 Jul 2024 17:47:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=g0cyqRohSVSPrCHXpXO1F8dtcHJnGe7eneW6VhHAeu5PVMjxDAzrUo3WAgZctJlmmNNMctPTJcpnrHK0ntv2eyzep9UcuxKt4D9NhTvhnBWeWsATgo8OZP1In+KbnaJqLLq0jsOoEdVZ0FQFLgozxCRTqmM+8qOEdiY5UYSG8ZOKA6z0sy8OSIkYhXxnHXegnaz1ChZ09+tlVwZrybDG5Y8+7GrQvtesvVUznlALJ8B00hOEHm1oiyokOSUCH5yqbBw8iy+J+kB/BbARon3fTU2qG17AXdFXrgJmzGwr3iZwdmU/mfpQNGDq5PjsuMNK2z7lGdRgeHrhW6aynlmOww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mpdXz/bNsDro2f1pk2K50xMI39UVVP7u0DZ5T93NaqE=; b=APaK1UxAajvqXMFdIOoCA4CWZO5P6V4v3hqwS2VHstLoJtPEI6rYddmi1BDIPj6mgJz9K4KPaCiuBFrUsoZGlNp+jrsOryq/l0iazNiA6w4yDgnxjzWEzoKwgoGHrkrLYlAcjDf3AH9FQzAKYKNoImF6aYoUXsjiv7S9kkjKhH2wKG/CSBOUselETqHGkbSMPVr+p0DAM4Q3uZI+PVE6Z1XYDPCf0UhaKLMZQQnMCD+DUIK49WKLb/beROZEsOzAYEbebREHnAQAKyzAcqYikXCGIHeGHYZrmoG5wcKS5sNdRcy9IpY5OM3WS778QxeOfhVe3nBipp5I5SxlgNUgng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=solid-run.com; dmarc=pass action=none header.from=solid-run.com; dkim=pass header.d=solid-run.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solidrn.onmicrosoft.com; s=selector1-solidrn-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mpdXz/bNsDro2f1pk2K50xMI39UVVP7u0DZ5T93NaqE=; b=HfftTcbSYAzxMDwtsek8o4D+Ptkm+D90QmX0fbTnfcPNXrbZUAMBwMBAFvEfh76R81fGRGpums8W7tkKK0YYSKXaOzgH5JQd/l/Z7F5hvUYPjV4+jEOJF6Fq9S+JBoUxgzUo/7kISkMd7A+OOvFV3W1ki1baqMaDEfpYi9VY+ck= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=solid-run.com; Received: from AM9PR04MB7586.eurprd04.prod.outlook.com (2603:10a6:20b:2d5::17) by PA4PR04MB9271.eurprd04.prod.outlook.com (2603:10a6:102:2a6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28; Mon, 15 Jul 2024 17:47:36 +0000 Received: from AM9PR04MB7586.eurprd04.prod.outlook.com ([fe80::c04e:8a97:516c:5529]) by AM9PR04MB7586.eurprd04.prod.outlook.com ([fe80::c04e:8a97:516c:5529%3]) with mapi id 15.20.7762.027; Mon, 15 Jul 2024 17:47:36 +0000 From: Josua Mayer Date: Mon, 15 Jul 2024 19:47:29 +0200 Subject: [PATCH RFC 1/2] phy: mvebu-cp110-utmi: add support for armada-380 utmi phys Message-Id: <20240715-a38x-utmi-phy-v1-1-d57250f53cf2@solid-run.com> References: <20240715-a38x-utmi-phy-v1-0-d57250f53cf2@solid-run.com> In-Reply-To: <20240715-a38x-utmi-phy-v1-0-d57250f53cf2@solid-run.com> To: Vinod Koul , Kishon Vijay Abraham I , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Yazan Shhady , linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Josua Mayer X-Mailer: b4 0.12.4 X-ClientProxiedBy: FR0P281CA0092.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a9::13) To AM9PR04MB7586.eurprd04.prod.outlook.com (2603:10a6:20b:2d5::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB7586:EE_|PA4PR04MB9271:EE_ X-MS-Office365-Filtering-Correlation-Id: d24115b5-f2af-428c-3c60-08dca4f63603 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|7416014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?q+YMvmGLi4wQK47Sa7g3J0pdSKNNHKd?= =?utf-8?q?Qggagva6wHC0YJloAwJ46RkuhkaDf//t75rnqzO80oE9KgHq4E+VOmY8FxeDsOHJO?= =?utf-8?q?DJP8qioyMH5GU5Bkv8ZvPahX6UOQrZTCbsHCe+feEUIcUta6ZfuHqzf6RSGKdJj06?= =?utf-8?q?9tGKNevkyUAV2oK1ywTxU2UXBZbZQPrcuL5d4MWaRzr0EXeFA8DesZnALtuBjlvdg?= =?utf-8?q?GATIdlmNfw20RnCTq8zI15qTvNz5qcoSJ5PgYF3NMn7MzzEZk3Jqn9gmA5UqZtb/v?= =?utf-8?q?CG2jlO4CYzjU8G/xgXaA4EhzsZ9NIzWyJAuU4YUD3j3ZZSViDCpraihLu9WP/ixDC?= =?utf-8?q?BzZLoEPVLbGU+ZY88yLLfplTLZM1RmJ7WQPd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FH2aVEcvtdVPYQLYa6cBK0w1mPJQ7KrRGpSOI?= =?utf-8?q?xCS0N8TIjKFRA+rbHsAdDk2+7rPiqcbzv3C7VDvuBJjHCDdW1bpsDGtmIbecxfYei?= =?utf-8?q?3iwqFWYz7Y1gVw4pCQHlFvGnXcZ4dLMN8g=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB7586.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(1800799024)(7416014)(376014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Bs/m9hW8eeNlzkbCrqIDsTKOh5yO?= =?utf-8?q?flYBnQG25p6Ku7bFQ2h5DUjzfLCdgSWi6F7yuLEYQa4Ds7Bdlzp7uLz73MxSMNCj+?= =?utf-8?q?ZpizcQOt4eafar1H+afzzu54AVaXCjjoc2Xn4O4921SgBhYgXnpIwwyqzla+gACi4?= =?utf-8?q?dxN2b8QwOV9P9NTmtgyFkNCh6mmhC2asKJrQR1N3cLYHEoU7w3V038yeHYTIGlztg?= =?utf-8?q?AFaj17jmear0ivcs/FEB65zA+kdBlI1+vMVBtXMp9D0kseu5wamfBKN7RZh2WxD1h?= =?utf-8?q?+qaBFi4cnTTbdSDbBYyCsgWfj5ROFmgUhjkzp7ug9PwKEE75wSKY30KwBq+AWH4/x?= =?utf-8?q?jIe9aziamjhS6rz+usewonIR+HH3/VP1dlr4bhZ86Gn7QWKnHcIfAITlyrQbvzMY6?= =?utf-8?q?B+CNLuKiAJL//g0NIr7skMiCNBLk78aCTEJ+rrLrdRTjlETdsfNxKnh0kiG0BqW/1?= =?utf-8?q?HzP/VcOrfQ+/zetq7Tygw8ZEMmT5C2Wa6hm7hx5wSPyuaXXsgKEhoAI2L0/USACsn?= =?utf-8?q?UR/OUU5f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rQ+EIirk9CQzpDz93v3onkQXwXNYq7cJdE6qLGVhqaXOW?= =?utf-8?q?NI/Un83yDPPys+LzIK9AtIE7278IDoPYY7mydj53mNei/eqsKOTZm2o9g5JyAsZWl?= =?utf-8?q?8KV/5yT+434W?= X-OriginatorOrg: solid-run.com X-MS-Exchange-CrossTenant-Network-Message-Id: d24115b5-f2af-428c-3c60-08dca4f63603 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB7586.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2024 17:47:35.6099 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a4a8aaf3-fd27-4e27-add2-604707ce5b82 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yw38KF7g1MtahuqzQ3zJ+4SQlF93U3yXTW8Sv1PLcpvE0/xPHhoFCsnUFaFbn4r1Ajq/t7Do6EsaWgHgPmvEYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9271 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_104748_046168_5A634F2C X-CRM114-Status: GOOD ( 15.56 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Armada 380 has smilar USB-2.0 PHYs as CP-110. The differences are: - register base addresses - gap between port registers - number of ports: 388 has three, cp110 two - device-mode mux has bit refers to different ports - syscon register's base address (offsets identical) Differentiation uses of_match_data with distinct compatible strings. Add support for Armada 380 PHYs by introducing a per-port regs pointer, and add extra logic mapping port id to device-mode mux register value. This driver is not immediately usable on Armada 38x as it relies on syscon framework for access to shared registers. While all CP110 based designs declare a syscon node in device-tree, Armada 38x has various drivers claiming parts of the respective area. Signed-off-by: Josua Mayer --- drivers/phy/marvell/phy-mvebu-cp110-utmi.c | 97 +++++++++++++++++++++++------- 1 file changed, 75 insertions(+), 22 deletions(-) diff --git a/drivers/phy/marvell/phy-mvebu-cp110-utmi.c b/drivers/phy/marvell/phy-mvebu-cp110-utmi.c index 4922a5f3327d..29ee73b6d8b5 100644 --- a/drivers/phy/marvell/phy-mvebu-cp110-utmi.c +++ b/drivers/phy/marvell/phy-mvebu-cp110-utmi.c @@ -76,7 +76,11 @@ #define PLL_LOCK_DELAY_US 10000 #define PLL_LOCK_TIMEOUT_US 1000000 -#define PORT_REGS(p) ((p)->priv->regs + (p)->id * 0x1000) +enum mvebu_cp110_utmi_type { + /* 0 is reserved to avoid clashing with NULL */ + A380_UTMI = 1, + CP110_UTMI = 2, +}; /** * struct mvebu_cp110_utmi - PHY driver data @@ -104,6 +108,7 @@ struct mvebu_cp110_utmi_port { struct mvebu_cp110_utmi *priv; u32 id; enum usb_dr_mode dr_mode; + void __iomem *regs; }; static void mvebu_cp110_utmi_port_setup(struct mvebu_cp110_utmi_port *port) @@ -118,47 +123,47 @@ static void mvebu_cp110_utmi_port_setup(struct mvebu_cp110_utmi_port *port) * The crystal used for all platform boards is now 25MHz. * See the functional specification for details. */ - reg = readl(PORT_REGS(port) + UTMI_PLL_CTRL_REG); + reg = readl(port->regs + UTMI_PLL_CTRL_REG); reg &= ~(PLL_REFDIV_MASK | PLL_FBDIV_MASK | PLL_SEL_LPFR_MASK); reg |= (PLL_REFDIV_VAL << PLL_REFDIV_OFFSET) | (PLL_FBDIV_VAL << PLL_FBDIV_OFFSET); - writel(reg, PORT_REGS(port) + UTMI_PLL_CTRL_REG); + writel(reg, port->regs + UTMI_PLL_CTRL_REG); /* Impedance Calibration Threshold Setting */ - reg = readl(PORT_REGS(port) + UTMI_CAL_CTRL_REG); + reg = readl(port->regs + UTMI_CAL_CTRL_REG); reg &= ~IMPCAL_VTH_MASK; reg |= IMPCAL_VTH_VAL << IMPCAL_VTH_OFFSET; - writel(reg, PORT_REGS(port) + UTMI_CAL_CTRL_REG); + writel(reg, port->regs + UTMI_CAL_CTRL_REG); /* Set LS TX driver strength coarse control */ - reg = readl(PORT_REGS(port) + UTMI_TX_CH_CTRL_REG); + reg = readl(port->regs + UTMI_TX_CH_CTRL_REG); reg &= ~TX_AMP_MASK; reg |= TX_AMP_VAL << TX_AMP_OFFSET; - writel(reg, PORT_REGS(port) + UTMI_TX_CH_CTRL_REG); + writel(reg, port->regs + UTMI_TX_CH_CTRL_REG); /* Disable SQ and enable analog squelch detect */ - reg = readl(PORT_REGS(port) + UTMI_RX_CH_CTRL0_REG); + reg = readl(port->regs + UTMI_RX_CH_CTRL0_REG); reg &= ~SQ_DET_EN; reg |= SQ_ANA_DTC_SEL; - writel(reg, PORT_REGS(port) + UTMI_RX_CH_CTRL0_REG); + writel(reg, port->regs + UTMI_RX_CH_CTRL0_REG); /* * Set External squelch calibration number and * enable the External squelch calibration */ - reg = readl(PORT_REGS(port) + UTMI_RX_CH_CTRL1_REG); + reg = readl(port->regs + UTMI_RX_CH_CTRL1_REG); reg &= ~SQ_AMP_CAL_MASK; reg |= (SQ_AMP_CAL_VAL << SQ_AMP_CAL_OFFSET) | SQ_AMP_CAL_EN; - writel(reg, PORT_REGS(port) + UTMI_RX_CH_CTRL1_REG); + writel(reg, port->regs + UTMI_RX_CH_CTRL1_REG); /* * Set Control VDAT Reference Voltage - 0.325V and * Control VSRC Reference Voltage - 0.6V */ - reg = readl(PORT_REGS(port) + UTMI_CHGDTC_CTRL_REG); + reg = readl(port->regs + UTMI_CHGDTC_CTRL_REG); reg &= ~(VDAT_MASK | VSRC_MASK); reg |= (VDAT_VAL << VDAT_OFFSET) | (VSRC_VAL << VSRC_OFFSET); - writel(reg, PORT_REGS(port) + UTMI_CHGDTC_CTRL_REG); + writel(reg, port->regs + UTMI_CHGDTC_CTRL_REG); } static int mvebu_cp110_utmi_phy_power_off(struct phy *phy) @@ -191,8 +196,15 @@ static int mvebu_cp110_utmi_phy_power_on(struct phy *phy) struct mvebu_cp110_utmi_port *port = phy_get_drvdata(phy); struct mvebu_cp110_utmi *utmi = port->priv; struct device *dev = &phy->dev; + const void *match; + enum mvebu_cp110_utmi_type type; int ret; u32 reg; + u32 sel; + + match = of_device_get_match_data(dev); + if (match) + type = (enum mvebu_cp110_utmi_type)(uintptr_t)match; /* It is necessary to power off UTMI before configuration */ ret = mvebu_cp110_utmi_phy_power_off(phy); @@ -208,16 +220,38 @@ static int mvebu_cp110_utmi_phy_power_on(struct phy *phy) * to UTMI0 or to UTMI1 PHY port, but not to both. */ if (port->dr_mode == USB_DR_MODE_PERIPHERAL) { + switch (type) { + case A380_UTMI: + /* + * A380 muxes between ports 0/2: + * - 0: Device mode on Port 2 + * - 1: Device mode on Port 0 + */ + if (port->id == 1) + return -EINVAL; + sel = !!(port->id == 0); + break; + case CP110_UTMI: + /* + * CP110 muxes between ports 0/1: + * - 0: Device mode on Port 0 + * - 1: Device mode on Port 1 + */ + sel = port->id; + break; + default: + return -EINVAL; + } regmap_update_bits(utmi->syscon, SYSCON_USB_CFG_REG, USB_CFG_DEVICE_EN_MASK | USB_CFG_DEVICE_MUX_MASK, USB_CFG_DEVICE_EN_MASK | - (port->id << USB_CFG_DEVICE_MUX_OFFSET)); + (sel << USB_CFG_DEVICE_MUX_OFFSET)); } /* Set Test suspendm mode and enable Test UTMI select */ - reg = readl(PORT_REGS(port) + UTMI_CTRL_STATUS0_REG); + reg = readl(port->regs + UTMI_CTRL_STATUS0_REG); reg |= SUSPENDM | TEST_SEL; - writel(reg, PORT_REGS(port) + UTMI_CTRL_STATUS0_REG); + writel(reg, port->regs + UTMI_CTRL_STATUS0_REG); /* Wait for UTMI power down */ mdelay(1); @@ -230,12 +264,12 @@ static int mvebu_cp110_utmi_phy_power_on(struct phy *phy) UTMI_PHY_CFG_PU_MASK); /* Disable Test UTMI select */ - reg = readl(PORT_REGS(port) + UTMI_CTRL_STATUS0_REG); + reg = readl(port->regs + UTMI_CTRL_STATUS0_REG); reg &= ~TEST_SEL; - writel(reg, PORT_REGS(port) + UTMI_CTRL_STATUS0_REG); + writel(reg, port->regs + UTMI_CTRL_STATUS0_REG); /* Wait for impedance calibration */ - ret = readl_poll_timeout(PORT_REGS(port) + UTMI_CAL_CTRL_REG, reg, + ret = readl_poll_timeout(port->regs + UTMI_CAL_CTRL_REG, reg, reg & IMPCAL_DONE, PLL_LOCK_DELAY_US, PLL_LOCK_TIMEOUT_US); if (ret) { @@ -244,7 +278,7 @@ static int mvebu_cp110_utmi_phy_power_on(struct phy *phy) } /* Wait for PLL calibration */ - ret = readl_poll_timeout(PORT_REGS(port) + UTMI_CAL_CTRL_REG, reg, + ret = readl_poll_timeout(port->regs + UTMI_CAL_CTRL_REG, reg, reg & PLLCAL_DONE, PLL_LOCK_DELAY_US, PLL_LOCK_TIMEOUT_US); if (ret) { @@ -253,7 +287,7 @@ static int mvebu_cp110_utmi_phy_power_on(struct phy *phy) } /* Wait for PLL ready */ - ret = readl_poll_timeout(PORT_REGS(port) + UTMI_PLL_CTRL_REG, reg, + ret = readl_poll_timeout(port->regs + UTMI_PLL_CTRL_REG, reg, reg & PLL_RDY, PLL_LOCK_DELAY_US, PLL_LOCK_TIMEOUT_US); if (ret) { @@ -274,7 +308,8 @@ static const struct phy_ops mvebu_cp110_utmi_phy_ops = { }; static const struct of_device_id mvebu_cp110_utmi_of_match[] = { - { .compatible = "marvell,cp110-utmi-phy" }, + { .compatible = "marvell,armada-380-utmi-phy", .data = (void *)A380_UTMI }, + { .compatible = "marvell,cp110-utmi-phy", .data = (void *)CP110_UTMI }, {}, }; MODULE_DEVICE_TABLE(of, mvebu_cp110_utmi_of_match); @@ -285,6 +320,8 @@ static int mvebu_cp110_utmi_phy_probe(struct platform_device *pdev) struct mvebu_cp110_utmi *utmi; struct phy_provider *provider; struct device_node *child; + const void *match; + enum mvebu_cp110_utmi_type type; u32 usb_devices = 0; utmi = devm_kzalloc(dev, sizeof(*utmi), GFP_KERNEL); @@ -293,6 +330,10 @@ static int mvebu_cp110_utmi_phy_probe(struct platform_device *pdev) utmi->dev = dev; + match = of_device_get_match_data(dev); + if (match) + type = (enum mvebu_cp110_utmi_type)(uintptr_t)match; + /* Get system controller region */ utmi->syscon = syscon_regmap_lookup_by_phandle(dev->of_node, "marvell,system-controller"); @@ -326,6 +367,18 @@ static int mvebu_cp110_utmi_phy_probe(struct platform_device *pdev) return -ENOMEM; } + /* Get port memory region */ + switch (type) { + case A380_UTMI: + port->regs = utmi->regs + port_id * 0x1000; + break; + case CP110_UTMI: + port->regs = utmi->regs + port_id * 0x2000; + break; + default: + return -EINVAL; + } + port->dr_mode = of_usb_get_dr_mode_by_phy(child, -1); if ((port->dr_mode != USB_DR_MODE_HOST) && (port->dr_mode != USB_DR_MODE_PERIPHERAL)) { From patchwork Mon Jul 15 17:47:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 13733755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 111CEC3DA59 for ; Mon, 15 Jul 2024 17:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=BvT1h4f+wQZikhBkM0L6gc/Ft/rC1ZbGIigXFfOszuQ=; b=Ep8vTDicscHx1r/OWdn6J47xPC nT7aOdXipKuGYSdbG273DKJ43dXdKKh2nWuiQr2jVf3Kner34CShz1eGB4gt0Hkz5sjPVI+DxvWmr Nd7qX12A1UxzruyO6TKd26lNF1bRcHCc0PdaioDn9K+X4prKh9EjxKblrsWv3RR4jRD7BG7ro/Drk V1QS8kXSNPggWWflmSfQclifTmkgzVpMVf0jcfkxj7B/dqluBJGESXJ3drkH+RKu9jebh3Z4a6Hjj ykZi+oqMWSVfQBRSkr6uYWX1y8nCSYJVn3kQ4YudQXjnGT1aM1aZUVCDL/bXRUQtPAXJ54P7+7Z/d RfJc9xTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTPoW-00000007vCz-2qQx; Mon, 15 Jul 2024 17:48:40 +0000 Received: from mail-westeuropeazlp170110003.outbound.protection.outlook.com ([2a01:111:f403:c201::3] helo=AS8PR04CU009.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTPnh-00000007ute-37bv; Mon, 15 Jul 2024 17:47:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qRoziaaXzzaT08ZB1EAphlDie9oVjdkDfOI1uY7qv4tmKYyQuFczu5uPhjxsLvPpHk/WIsoRL90/E0gVvM7p8sEJgZD+nXKVakxPbs/2z1ABUA9/GsCTX++NX2kgx/pKPTgcgwydRONpt1BmvU6CVlyDTKYsPnqM6pRnjN5RbIkKqdlhwFDQ3ATFiZOGCcYYBkZGgTJAnU/01roVRPrLMCYWKUt8UmemypzZnHqDgr3vhuzL9D+M0nOBGPeBuT9PAIS55yhtzBsiDq/h9HkOtGtq0Y5cIvAIeHgw7B6QRzxC8F2bGX5MOlyPf//I7ptNt1xQTP64b37Iov6Cx//0Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8Oi3RouF20WfVOBahTNcNxtEwDcyD1SPtjLvRWqqGUE=; b=UhZoxu7vd7hk4zO9FYQmBkxOnd2aQ9ImE7VvnEFEKb8PdSIsDgM4qlDYyEYn2dvdwL8qM/4PZReSrxsN1WMgBG9s3ix5wDxbf4W1bzuqgxx8TiHTQGSkKB17/k1IZjjFwZehtMi9ulNgEmElj7G/okgVuyb0aDm/S1PkIiP3nW+yd4X3AxiAnG4+eUouL9eaOqdohzX965W5d04vhwZi4Z6qcp/dDYQRhQgk8w5VTjk4ZWWoccr0n/jtQTnoIwujbc8lqVfobUuOUKtxZe1lysDaONKhDYdOYMuXlUyBDS6ATgoxiLjQfnxMJot4SSL7TbfJ1DwqIPyo9D6UbGhVoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=solid-run.com; dmarc=pass action=none header.from=solid-run.com; dkim=pass header.d=solid-run.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solidrn.onmicrosoft.com; s=selector1-solidrn-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8Oi3RouF20WfVOBahTNcNxtEwDcyD1SPtjLvRWqqGUE=; b=qx9b7V5kjK4w1lZM2MBhz44XLrA9xwwqhX5GZX/SkaP95HLHSaK2QAxXsV4C8j2YvjODewT1GIT1PKK8qF/TaD/FGXDCDxyJacMDLXIc3+Y6MurDLMpZkyzHjGfiBta2zHuyss6dD0ASi+HyY1wDtj0AnKEy7zX3EfxfgSoNPyk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=solid-run.com; Received: from AM9PR04MB7586.eurprd04.prod.outlook.com (2603:10a6:20b:2d5::17) by PA4PR04MB9271.eurprd04.prod.outlook.com (2603:10a6:102:2a6::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.28; Mon, 15 Jul 2024 17:47:37 +0000 Received: from AM9PR04MB7586.eurprd04.prod.outlook.com ([fe80::c04e:8a97:516c:5529]) by AM9PR04MB7586.eurprd04.prod.outlook.com ([fe80::c04e:8a97:516c:5529%3]) with mapi id 15.20.7762.027; Mon, 15 Jul 2024 17:47:37 +0000 From: Josua Mayer Date: Mon, 15 Jul 2024 19:47:30 +0200 Subject: [PATCH RFC 2/2] arm: dts: marvell: armada-38x: add description for usb phys Message-Id: <20240715-a38x-utmi-phy-v1-2-d57250f53cf2@solid-run.com> References: <20240715-a38x-utmi-phy-v1-0-d57250f53cf2@solid-run.com> In-Reply-To: <20240715-a38x-utmi-phy-v1-0-d57250f53cf2@solid-run.com> To: Vinod Koul , Kishon Vijay Abraham I , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Yazan Shhady , linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Josua Mayer X-Mailer: b4 0.12.4 X-ClientProxiedBy: FR0P281CA0092.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a9::13) To AM9PR04MB7586.eurprd04.prod.outlook.com (2603:10a6:20b:2d5::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB7586:EE_|PA4PR04MB9271:EE_ X-MS-Office365-Filtering-Correlation-Id: 34b326a1-fa00-4479-2047-08dca4f636a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|7416014|376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=?utf-8?q?XO5zcZmLpCnuUdIO05oiUXwyvFZ8pjz3do6It3J4w3sY8AlHc52huUVvUs6IzTJJz?= =?utf-8?q?QknLu2PsaUmRBN7+pZQsiT0rJ/MTgsbrMezMOQz0EDK5tHv7YhuP8XCq4c6P34Kp0?= =?utf-8?q?lIRlppmmYJ6W0FTT1IMzcLQv2eZ2P//ZJj+Sfx3bUExr4k8Mp51D0OcI1h4PvZ3i9?= =?utf-8?q?jBpRuOLXc+Voirn2R2okWA0QSwOudeS/OQL2zr/JGJ0WiORef9IGHvkSeAQUK31AB?= =?utf-8?q?wOC/NZ50+LxFzDCRSYPLmZNy3lUKUdyjpm2luS+9AjezQTGMOOX5ZfOh90z8AVCyc?= =?utf-8?q?pecwuolJ8w2CLM5gnmrnQtUaX5BtAS+KWuX4CHQIWT5mrgEwADuelrRI+WBhvMHQw?= =?utf-8?q?tIVOmfhYunZV46ZLdWYZ+BZypCyJ/RQEMyHZdqxg4xRWUSqtqrQOXkf9l1IoHi4B3?= =?utf-8?q?OpTe4AdOIsUvQ2NyHc0Gv8r9JdAQQIs8CTOW/xr0/C+DNCgJUd4OmpvVdHegtWdPP?= =?utf-8?q?ejUcVRTKzYPUvtAfAYgd/pYa1EkKWubVBA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB7586.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(1800799024)(7416014)(376014)(366016)(38350700014);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?90Xd95v9Bc95eSzKFWGiJkmZujpS?= =?utf-8?q?ATxwwwKLz4YF8yvPV/+K1nS69nPZq1y0ls48BIqFtYY/HdTEDHSWp5tUG2qwWyAke?= =?utf-8?q?Cm57sqJ8+xFwgyf6SRSprvxgGI8MAWhlRh9cSQ/m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3w1CsqjClIQ4+Z2mrwTJH8?= =?utf-8?q?7bqj2qQ5hfzAzBVZHpj+VKgJCu0tAusuZTk63FUo7Yr8a5dGmVXQb42u1mSZszhdQ?= =?utf-8?q?DL8xiB5V3tfaDeCWoRwRm5jypIJo4I4CIi+IlHr4srRf5gcOicqU8trKH0ETV5iJS?= =?utf-8?q?GwyU6kXCJbgoTzrvTLNJYsMm1fInv9A324ShTeRmfAqGkLOJK6IqYSddRGH7jMdR0?= =?utf-8?q?dtdaeaLhESf3BhlRcPUiuoYfyWVF62HH3GKtU09wP3gROLwQs56kjK2e0XcdjbuE1?= =?utf-8?q?DERiwXEHRLnby0abwssEOTaH903ed2MbNAyRjCc7l0AThgEbaHgp971vLQAXxCUMO?= =?utf-8?q?U471R6cW5DMAb6beftw4zFHBGNai3cajALqaKOMHBm3jHknznP0aKnto7YZAY7D/W?= =?utf-8?q?kAaSs3UaczPc4GsmVPCkfwcHdUgYV1dTyXzE3A0vbJBO5AeCLEKebZ5CW4R9z/n+r?= =?utf-8?q?Je5dTVykwYG6vXM3xu9wSABgQaNq9W4c62vWLCLsu7iEjRyO/Lm5496KM+weGiovr?= =?utf-8?q?82rgrOLgsEmT?= X-OriginatorOrg: solid-run.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34b326a1-fa00-4479-2047-08dca4f636a7 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB7586.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2024 17:47:36.6862 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a4a8aaf3-fd27-4e27-add2-604707ce5b82 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: grwpo3JR11XQhsatTzUWOCXewwr7vTSCoFCegJbrfS45s096QQjnHJuckTeNHU3iOT0b6AnDQ3o9Ld83SZXqhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB9271 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_104749_824150_59E8B2BE X-CRM114-Status: GOOD ( 11.64 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Armada 38x has 3x USB-2.0 utmi phys. They are almost identical to the 2x utmi phys on armada 8k. Add descriptions for all 3 phy ports. Also add a syscon node covering just the usb configuration registers. Armada 8K have a syscon node covering configuration registers for various functions including pinmux, woith dirvers using syscon framework for register access. Armada 388 has various drivers directly claiming some of those configuration registers. Hence a similar syscon node would compete for resources with these drivers. This patch-set is marked RFC to figure out a solution. I have some ideas: 1. Can syscon have holes, i.e. facilitate consumer drivers accessing certain offsets only? 2. Declare a tiny syscon (see this patch) covering just the area used by utmi phy driver: This impacts driver access offsets - can those be hard-coded - or is there a mechanism in device-tree? E.g. marvell,system-controller = <&syscon any-poffset-here>? 3. utmi phy driver access just three registers using syscon: all-ports power-up (probably enables clocks), device-mode mux, per-port power-up. Assign these registers individually to the phy device-node, and implement access in driver when syscon is not available. If this is preferred, which dt property should s[ecify their address? reg, ranges, ...? Signed-off-by: Josua Mayer --- arch/arm/boot/dts/marvell/armada-38x.dtsi | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/arch/arm/boot/dts/marvell/armada-38x.dtsi b/arch/arm/boot/dts/marvell/armada-38x.dtsi index 446861b6b17b..5cf9449162b1 100644 --- a/arch/arm/boot/dts/marvell/armada-38x.dtsi +++ b/arch/arm/boot/dts/marvell/armada-38x.dtsi @@ -392,6 +392,11 @@ comphy5: phy@5 { }; }; + syscon0: system-controller@18400 { + compatible = "syscon", "simple-mfd"; + reg = <0x18420 0x30>; + }; + coreclk: mvebu-sar@18600 { compatible = "marvell,armada-380-core-clock"; reg = <0x18600 0x04>; @@ -580,6 +585,31 @@ ahci0: sata@a8000 { status = "disabled"; }; + utmi: utmi@c0000 { + compatible = "marvell,armada-380-utmi-phy"; + reg = <0xc0000 0x6000>; + ranges = <0x18420>, <0x00018440>, <0x00018444>, <0x00018448>; + marvell,system-controller = <&syscon0>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + + utmi0: usb-phy@0 { + reg = <0>; + #phy-cells = <0>; + }; + + utmi1: usb-phy@1 { + reg = <1>; + #phy-cells = <0>; + }; + + utmi2: usb-phy@2 { + reg = <2>; + #phy-cells = <0>; + }; + }; + bm: bm@c8000 { compatible = "marvell,armada-380-neta-bm"; reg = <0xc8000 0xac>;