From patchwork Wed Mar 17 11:31:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1454615 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=eih5e126; 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 RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F0p0123Xmz9sWP for ; Wed, 17 Mar 2021 22:31:44 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D890F82777; Wed, 17 Mar 2021 12:31:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="eih5e126"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B94E6827F9; Wed, 17 Mar 2021 12:31:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (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 C46EC82759 for ; Wed, 17 Mar 2021 12:31:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x629.google.com with SMTP id mj10so2015295ejb.5 for ; Wed, 17 Mar 2021 04:31:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3Ps3tE7qS5HlGSH5Zs4LPfxFRKXZnEFmcVb3QAHzhmg=; b=eih5e126/Zs1v+HLPcSVrs8po2Poi+B5e0aQkGJAlGgUnr4+7fsQWK+LAj4VK9LjNj KyXQ5J/GQbFgrjMRUXvSEDACkbDHi7UwLsowXeNncGXr6sWjhm3m+rgd1ADL9gP/OvSJ FYTKolMyLQVoWss5hpFuc/bQ2dy+bdYSbgE+qghOTpXKEcNotDIiUOj70PUFOTRWCveu 2+s/Xpq6SOdFMbF7+mS7GHKc9GWivxitPmBEY0qp7VOdsZNqqZEp7K1Yvb/e+NMJuWLT TNKnc3VI1tPGDWGdK+grNZoZmQ8DVdFKAyaB9uwNcQc2ZC5/RhnDX9v8qH59Yj+LJUc1 WngA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=3Ps3tE7qS5HlGSH5Zs4LPfxFRKXZnEFmcVb3QAHzhmg=; b=d0eyDnQ+QixKa3i65HnyaJCynhakTAa9sEvEz4vU2srNlVjaeEPfOiPyy+6mjL74+d 2sFSCgUHrESPljdOOtjs7HxpD9xtWNO8n9H+fWTUJC5SQk8NesyMhNOiDFSK+c53TYmI zgK+p/l9FwWUFF8yWU2YVH4wA7pM4C5mv2UMRuxWU3APoy7bLx7k66YcSI95rUrlFqlh 6xbBLxL1Tz4Ez/UbAW6PTQ9epHcp0mX1f8CocXahUGy/mATSCkrNSFIiD4913EiYcnSv HhHUJ1xzfm3Jxg/xq/ZWbk37XTgp5rHepZzgKGTA1lkJYXihIWDaOqW2fs7MMYwzok1J 7CFw== X-Gm-Message-State: AOAM531wLN3QfSRh88liwME8X1U+KINzcjhR8+WUED8BYviCM4QdcGXw ATOVYtqZf00i3RpdIQRfwEyRzSX7OQzMZN2C X-Google-Smtp-Source: ABdhPJzLvnrwSuHqpnWaXFZp7CfwJM1ZfNaKIMYpvfiEH2bTF4PZOHMBDRipG+T9uzJaDy6aUNZWbA== X-Received: by 2002:a17:906:489b:: with SMTP id v27mr34786553ejq.1.1615980697332; Wed, 17 Mar 2021 04:31:37 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::45a]) by smtp.gmail.com with ESMTPSA id u14sm11134208ejx.60.2021.03.17.04.31.36 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Mar 2021 04:31:36 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: T Karthik Reddy , Ashok Reddy Soma , Jagan Teki Subject: [PATCH v2] spi: spi-uclass: Add support to manually relocate spi memory ops Date: Wed, 17 Mar 2021 12:31:30 +0100 Message-Id: <02cc610fb2e0c16f40dfaf7deac19271c718b2b3.1615980689.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean From: T Karthik Reddy Add spi memory operations to relocate manually when CONFIG_NEEDS_MANUAL_RELOC is enabled. Signed-off-by: T Karthik Reddy Acked-by: Ashok Reddy Soma Signed-off-by: Michal Simek Reviewed-by: Pratyush Yadav Reviewed-by: Pratyush Yadav --- Changes in v2: - Check if mem_ops is defined before relocation - reported-by Pratyush Yadav drivers/spi/spi-uclass.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c index 7155d4aebd6d..ee30110b5658 100644 --- a/drivers/spi/spi-uclass.c +++ b/drivers/spi/spi-uclass.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -199,6 +200,16 @@ static int spi_post_probe(struct udevice *bus) ops->set_mode += gd->reloc_off; if (ops->cs_info) ops->cs_info += gd->reloc_off; + if (ops->mem_ops) { + struct spi_controller_mem_ops *mem_ops = + (struct spi_controller_mem_ops *)ops->mem_ops; + if (mem_ops->adjust_op_size) + mem_ops->adjust_op_size += gd->reloc_off; + if (mem_ops->supports_op) + mem_ops->supports_op += gd->reloc_off; + if (mem_ops->exec_op) + mem_ops->exec_op += gd->reloc_off; + } reloc_done++; } #endif