Message ID | 20240107163307.3677347-1-enachman@marvell.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-18921-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp612955dyq; Sun, 7 Jan 2024 08:33:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IFnyxK6xGqkneX4td4P/wIA9KX1UVHf3113jpbPbCGAyK6I06E1zgd+crNO44AaJlyRFDok X-Received: by 2002:a05:620a:1644:b0:781:990e:4a79 with SMTP id c4-20020a05620a164400b00781990e4a79mr2877595qko.134.1704645219605; Sun, 07 Jan 2024 08:33:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704645219; cv=none; d=google.com; s=arc-20160816; b=lBuB00gwhYpGAQGADo7zt2KXbroL67lVRicdJS9cSt92NqmVtdYQfwqhko/sBRC6QG et6WPmDZM87N1QVHNjcSsDaLfyrqA+QaLt3rt1NmmuOs+lVJs7g8OSwmu3WniC3QuvgK mVQPBC6fFypNlgBzKKcq9fsYBoTsc43c9Dd8yBFesVuxVxMF3td9/pO+vPAkTuqxUrTs ccbQ6Dxmet5CA2iJNbLRlJOFGbPGmI/5lTuG/FWTpHuiX6UlGeUu7p6wKWYuceWkA0mC ZJv6BLJQ4BVZKrywSu2C5kpwwlFyJMiROAhgh60RdrWYbjmReGdBIvHqBpPYji+b+SSG ZTiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=WDxjLpWFywVjI7e3JN7C+93DE50ObRVKfEdfvwswpes=; fh=iDIZ5aSPpQeNywpVw15BsRLfxGh9o5LcO1zfmGIjqG4=; b=Uubxx0RZKCg6CvrQkcQpFFms4xcRArvrnBH5vRGdlGxv1Xl+/SsRiuwl+CJwMxIXar f733QWDZ7dKt1QOS5+Kt8VVjqMHedl7H3ZMC5N1t3+8aydTa/yB8L7eWkkcmtL7Bcf8U 2ELL2cWSQ1ljc2uIBE/oO1f0q1quAWbqYDA8IgKkQFsXiAVAbDJske8zxOhlnQuIiR1e IDBdsBI6AKZFeCTQUymvxbNy0C52hSjfVA+ttz5omozsdRNfVcfvO+76CXxB4MOKr8Dp aGqhoKexzUEJwiKJuvL787mDTnEvUoJ28JGweNpeuRIoP0S4mCiiA0QbI+ff6U9GuBkz PwmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=VIbkm3ZQ; spf=pass (google.com: domain of linux-kernel+bounces-18921-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18921-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id cz34-20020a05620a36e200b007816c8b03a1si5856393qkb.744.2024.01.07.08.33.39 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jan 2024 08:33:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18921-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=VIbkm3ZQ; spf=pass (google.com: domain of linux-kernel+bounces-18921-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18921-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 63F981C215BC for <ouuuleilei@gmail.com>; Sun, 7 Jan 2024 16:33:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AB7013FE6; Sun, 7 Jan 2024 16:33:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="VIbkm3ZQ" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A40F13FE0; Sun, 7 Jan 2024 16:33:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.helo=mx0b-0016f401.pphosted.com Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 407GRCeT025535; Sun, 7 Jan 2024 08:33:14 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=pfpt0220; bh=WDxjLpWF ywVjI7e3JN7C+93DE50ObRVKfEdfvwswpes=; b=VIbkm3ZQWmwQs2I3011UT/us X6JyOJu3wH7/hvODSf/YMd+w7GJLlIealn87RU7CJ4AUV/0hDpcF5zqgo8XvSxRK ps+3gAppymcKdY1D4erjZ0ssvIF+ig9I2cDcyF3nNEIr3NFr2sRUfbH1S4/MDZpM ZQoPb84EyQNgzXExQ1zfGHxWaCe/CCs5NOaTTNqdgq0EMl0gw5JJLGmPDeNDK51e szXPYu1SA+bsNdeqWQmjSQC0p4hKaovUyuJrgmFRrayv/DQK4y/910XkhYzDsjSX A3CMmi8TWl6ayG1eNbpMabilAeainjcjl11FyYUIaDho1REK+MjWD3BT+VMBOw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vf53qjpk1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 07 Jan 2024 08:33:14 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 7 Jan 2024 08:33:12 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sun, 7 Jan 2024 08:33:12 -0800 Received: from dc3lp-swdev041.marvell.com (dc3lp-swdev041.marvell.com [10.6.60.191]) by maili.marvell.com (Postfix) with ESMTP id 2B1393F7093; Sun, 7 Jan 2024 08:33:10 -0800 (PST) From: Elad Nachman <enachman@marvell.com> To: <stern@rowland.harvard.edu>, <gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: <enachman@marvell.com> Subject: [PATCH] usb: host: Add ac5 to EHCI Orion Date: Sun, 7 Jan 2024 18:33:07 +0200 Message-ID: <20240107163307.3677347-1-enachman@marvell.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: haiESmOofzJmdZjmPhpp3VhZn8PwyalB X-Proofpoint-GUID: haiESmOofzJmdZjmPhpp3VhZn8PwyalB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787450065803063581 X-GMAIL-MSGID: 1787450065803063581 |
Series |
usb: host: Add ac5 to EHCI Orion
|
|
Commit Message
Elad Nachman
Jan. 7, 2024, 4:33 p.m. UTC
From: Elad Nachman <enachman@marvell.com> Add support for ac5 to the EHCI Orion platform driver. The ac5 SOC has DDR starting at offset 0x2_0000_0000, Hence it requires a larger than 32-bit DMA mask to operate. Move the dma mask to be pointed by the OF match data, and use that match data when initializng the DMA mask. Signed-off-by: Elad Nachman <enachman@marvell.com> --- drivers/usb/host/ehci-orion.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
Comments
Hi Elad, kernel test robot noticed the following build errors: [auto build test ERROR on usb/usb-testing] [also build test ERROR on usb/usb-next usb/usb-linus char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus westeri-thunderbolt/next linus/master v6.7 next-20240108] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Elad-Nachman/usb-host-Add-ac5-to-EHCI-Orion/20240108-003512 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing patch link: https://lore.kernel.org/r/20240107163307.3677347-1-enachman%40marvell.com patch subject: [PATCH] usb: host: Add ac5 to EHCI Orion config: s390-randconfig-r071-20240108 (https://download.01.org/0day-ci/archive/20240109/202401090012.KFgRr4iR-lkp@intel.com/config) compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 7e186d366d6c7def0543acc255931f617e76dff0) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240109/202401090012.KFgRr4iR-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202401090012.KFgRr4iR-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from drivers/usb/host/ehci-orion.c:18: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:78: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 547 | val = __raw_readb(PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu' 37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) | ^ include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16' 102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) | ^ In file included from drivers/usb/host/ehci-orion.c:18: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:78: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu' 35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x)) | ^ include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32' 115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) | ^ In file included from drivers/usb/host/ehci-orion.c:18: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:78: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 584 | __raw_writeb(value, PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 692 | readsb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 700 | readsw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 708 | readsl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 717 | writesb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 726 | writesw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 735 | writesl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ >> drivers/usb/host/ehci-orion.c:241:15: error: assigning to 'u64 *' (aka 'unsigned long long *') from 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers] 241 | dma_mask_ptr = of_device_get_match_data(&pdev->dev); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 12 warnings and 1 error generated. vim +241 drivers/usb/host/ehci-orion.c 211 212 static int ehci_orion_drv_probe(struct platform_device *pdev) 213 { 214 struct orion_ehci_data *pd = dev_get_platdata(&pdev->dev); 215 const struct mbus_dram_target_info *dram; 216 struct resource *res; 217 struct usb_hcd *hcd; 218 struct ehci_hcd *ehci; 219 void __iomem *regs; 220 int irq, err; 221 enum orion_ehci_phy_ver phy_version; 222 struct orion_ehci_hcd *priv; 223 u64 *dma_mask_ptr; 224 225 if (usb_disabled()) 226 return -ENODEV; 227 228 pr_debug("Initializing Orion-SoC USB Host Controller\n"); 229 230 irq = platform_get_irq(pdev, 0); 231 if (irq < 0) { 232 err = irq; 233 goto err; 234 } 235 236 /* 237 * Right now device-tree probed devices don't get dma_mask 238 * set. Since shared usb code relies on it, set it here for 239 * now. Once we have dma capability bindings this can go away. 240 */ > 241 dma_mask_ptr = of_device_get_match_data(&pdev->dev); 242 err = dma_coerce_mask_and_coherent(&pdev->dev, *dma_mask_ptr); 243 if (err) 244 goto err; 245 246 regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); 247 if (IS_ERR(regs)) { 248 err = PTR_ERR(regs); 249 goto err; 250 } 251 252 hcd = usb_create_hcd(&ehci_orion_hc_driver, 253 &pdev->dev, dev_name(&pdev->dev)); 254 if (!hcd) { 255 err = -ENOMEM; 256 goto err; 257 } 258 259 hcd->rsrc_start = res->start; 260 hcd->rsrc_len = resource_size(res); 261 hcd->regs = regs; 262 263 ehci = hcd_to_ehci(hcd); 264 ehci->caps = hcd->regs + 0x100; 265 hcd->has_tt = 1; 266 267 priv = hcd_to_orion_priv(hcd); 268 /* 269 * Not all platforms can gate the clock, so it is not an error if 270 * the clock does not exists. 271 */ 272 priv->clk = devm_clk_get(&pdev->dev, NULL); 273 if (!IS_ERR(priv->clk)) { 274 err = clk_prepare_enable(priv->clk); 275 if (err) 276 goto err_put_hcd; 277 } 278 279 priv->phy = devm_phy_optional_get(&pdev->dev, "usb"); 280 if (IS_ERR(priv->phy)) { 281 err = PTR_ERR(priv->phy); 282 if (err != -ENOSYS) 283 goto err_dis_clk; 284 } 285 286 /* 287 * (Re-)program MBUS remapping windows if we are asked to. 288 */ 289 dram = mv_mbus_dram_info(); 290 if (dram) 291 ehci_orion_conf_mbus_windows(hcd, dram); 292 293 /* 294 * setup Orion USB controller. 295 */ 296 if (pdev->dev.of_node) 297 phy_version = EHCI_PHY_NA; 298 else 299 phy_version = pd->phy_version; 300 301 switch (phy_version) { 302 case EHCI_PHY_NA: /* dont change USB phy settings */ 303 break; 304 case EHCI_PHY_ORION: 305 orion_usb_phy_v1_setup(hcd); 306 break; 307 case EHCI_PHY_DD: 308 case EHCI_PHY_KW: 309 default: 310 dev_warn(&pdev->dev, "USB phy version isn't supported.\n"); 311 } 312 313 err = usb_add_hcd(hcd, irq, IRQF_SHARED); 314 if (err) 315 goto err_dis_clk; 316 317 device_wakeup_enable(hcd->self.controller); 318 return 0; 319 320 err_dis_clk: 321 if (!IS_ERR(priv->clk)) 322 clk_disable_unprepare(priv->clk); 323 err_put_hcd: 324 usb_put_hcd(hcd); 325 err: 326 dev_err(&pdev->dev, "init %s fail, %d\n", 327 dev_name(&pdev->dev), err); 328 329 return err; 330 } 331
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 6c47ab0a491d..bcf99f31a840 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c @@ -65,6 +65,15 @@ struct orion_ehci_hcd { static struct hc_driver __read_mostly ehci_orion_hc_driver; +/* + * Legacy DMA mask is 32 bit. + * AC5 has the DDR starting at 8GB, hence it requires + * a larger (34-bit) DMA mask, in order for DMA allocations + * to succeed: + */ +static const u64 dma_mask_orion = DMA_BIT_MASK(32); +static const u64 dma_mask_ac5 = DMA_BIT_MASK(34); + /* * Implement Orion USB controller specification guidelines */ @@ -211,6 +220,7 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) int irq, err; enum orion_ehci_phy_ver phy_version; struct orion_ehci_hcd *priv; + u64 *dma_mask_ptr; if (usb_disabled()) return -ENODEV; @@ -228,7 +238,8 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) * set. Since shared usb code relies on it, set it here for * now. Once we have dma capability bindings this can go away. */ - err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + dma_mask_ptr = of_device_get_match_data(&pdev->dev); + err = dma_coerce_mask_and_coherent(&pdev->dev, *dma_mask_ptr); if (err) goto err; @@ -332,9 +343,9 @@ static void ehci_orion_drv_remove(struct platform_device *pdev) } static const struct of_device_id ehci_orion_dt_ids[] = { - { .compatible = "marvell,orion-ehci", }, - { .compatible = "marvell,armada-3700-ehci", }, - {}, + { .compatible = "marvell,orion-ehci", .data = &dma_mask_orion}, + { .compatible = "marvell,armada-3700-ehci", .data = &dma_mask_orion}, + { .compatible = "marvell,ac5-ehci", .data = &dma_mask_ac5}, }; MODULE_DEVICE_TABLE(of, ehci_orion_dt_ids);