From patchwork Fri Jun 2 21:49:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Edwards X-Patchwork-Id: 1789837 X-Patchwork-Delegate: andre.przywara@arm.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=T+7mpcQB; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QXxXG5160z20Tk for ; Sat, 3 Jun 2023 07:51:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9AC1A863A5; Fri, 2 Jun 2023 23:50:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="T+7mpcQB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 33F4B862CB; Fri, 2 Jun 2023 23:50:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B45968637B for ; Fri, 2 Jun 2023 23:50:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=cfsworks@gmail.com Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-33d269dd56bso7880475ab.1 for ; Fri, 02 Jun 2023 14:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685742633; x=1688334633; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=J9KGir3bdrIQ1nzHG9q+NC2Gkys7UDof/gVG9qpjSkA=; b=T+7mpcQBvkQ7/mjIev3TbD5jvT7b9MPa6eOgwnPMRcFTc+8oK3/rixA3PSxscvFeJC tV7eCG1vx0zhcF77SwiQFqV4luA2bQo5b1IAOLQTn95p+eFgW8a5ZF0k6Au9N/zEaxh5 8PdjEH8axj6flWU2Q2cORhUKGrFxz4mWsAZNmhLnBQMIKiNQEZLSPHIWV5isCsbEmIcQ +lMoGcnASnCcQrOkdQe9v23tGnsuKufmCGHGKdoFfeekIA63ZaiRBHw2znHU2OIO51j6 FUNjK/l4TrwlL827/c5WJJ4aB7BT5sKmMLVZY+WjY1ipwLj45f39+pghnXCRpoUSIqvA bpSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685742633; x=1688334633; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J9KGir3bdrIQ1nzHG9q+NC2Gkys7UDof/gVG9qpjSkA=; b=eiGLLmPpzxKO5EwUTnhIJfhCDSOunr6u2uMqWbY4KdT4muoin0ficnpHzC0Wkxg5B5 uEMarHoOqoKiWeYUprww1svM9kcX7NyPX+2kLmcdw7+taw6Z9qgAi+j/IGVlS8JCZIZK ZNCZQaOjT0d21KbqWxIMAmsJtId81OYzikolcUNQSUAVOQ1Wt/zhvt1E39TVAUjjhJlX 2KgjZL/bU7LhTyHD4DdtsAeUs4ASEN3wwqye2oXX1lxF/LqetArAn7cGLwv2oG9niTjN XHIxxCZ0HK0mPFCjZHgKWkwtkI7RPT/IAoTbALYw6PoJTbW+lamjwIGZ6553ZxxTwVga 1eXg== X-Gm-Message-State: AC+VfDzHnZRkhGPXjblKGuCSP5JYCX79XZstkDCBPlTZXS0gPOqLK6us 0KT4zKbay4dRz/KaV+ZOeWAkFbUDFbPOTfDn X-Google-Smtp-Source: ACHHUZ7DyRNBdba3vjKdpklQYX8ArFcUZCUk2n4IbR/JCH1KllEec7LkZZV71t0jSHemu+UJhDAEPA== X-Received: by 2002:a92:c648:0:b0:33d:16b6:3dfa with SMTP id 8-20020a92c648000000b0033d16b63dfamr4766636ill.26.1685742633108; Fri, 02 Jun 2023 14:50:33 -0700 (PDT) Received: from celestia.nettie.lan ([2001:470:42c4:101:7b1d:313:b371:dfda]) by smtp.gmail.com with ESMTPSA id r4-20020a02c6c4000000b004164fe77c06sm566672jan.26.2023.06.02.14.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jun 2023 14:50:32 -0700 (PDT) From: Sam Edwards X-Google-Original-From: Sam Edwards To: u-boot@lists.denx.de Cc: Andre Przywara , Jagan Teki , Marek Vasut , Maksim Kiselev , Sam Edwards Subject: [PATCH 1/3] usb: musb-new: sunxi: do not attempt to access NULL SRAMC Date: Fri, 2 Jun 2023 15:49:56 -0600 Message-Id: <20230602214958.167909-2-CFSworks@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230602214958.167909-1-CFSworks@gmail.com> References: <20230602214958.167909-1-CFSworks@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean I believe that some sunxis (ncat2?) lack a SRAMC block, as accessing this region results in a data abort. Checking that it's non-null before accessing it allows this to be set to NULL for SoCs where it's not present. Signed-off-by: Sam Edwards --- drivers/usb/musb-new/sunxi.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c index dc4cfc2194..6e60dd47e0 100644 --- a/drivers/usb/musb-new/sunxi.c +++ b/drivers/usb/musb-new/sunxi.c @@ -174,13 +174,15 @@ static void USBC_ForceVbusValidToHigh(__iomem void *base) static void USBC_ConfigFIFO_Base(void) { - u32 reg_value; - - /* config usb fifo, 8kb mode */ - reg_value = readl(SUNXI_SRAMC_BASE + 0x04); - reg_value &= ~(0x03 << 0); - reg_value |= BIT(0); - writel(reg_value, SUNXI_SRAMC_BASE + 0x04); + if (SUNXI_SRAMC_BASE) { + u32 reg_value; + + /* config usb fifo, 8kb mode */ + reg_value = readl(SUNXI_SRAMC_BASE + 0x04); + reg_value &= ~(0x03 << 0); + reg_value |= BIT(0); + writel(reg_value, SUNXI_SRAMC_BASE + 0x04); + } } /******************************************************************************