From patchwork Wed Jan 9 14:58:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitor Soares X-Patchwork-Id: 10754355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96DCB17E1 for ; Wed, 9 Jan 2019 14:58:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85D5528B81 for ; Wed, 9 Jan 2019 14:58:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79DB128C74; Wed, 9 Jan 2019 14:58:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E567B28B81 for ; Wed, 9 Jan 2019 14:58:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=i+18TwlPVmQNrrdWjF0Pm2WH0Zbivzgp0v0Ji28QrDQ=; b=L0z oH46ZESgJWhLeiQdGwCGpHy20XzhvBaQnrvtNIMVC6nT/A3abXgZmcHGKq1rCLlqE6Sv+hJx9ZZDs rtMzDb5D6DHbv/L8OcaUn4cPPm+cHGMCgjd/D3yQ9P9EnKtbMytijsbHhgyElzodK9R8o1Ub/sId7 otfReXd35CPhSBtqhc7CBEHT4O9lKYtDmkuB4ZEWyEPZnMgyHVwSdVLFsZRD1VRQf8DXiI9AnojOM o/JDUIMwnU2ZONUM5rFg/r2hoDEF0zgIl+838k+jFJkE2/EicjWRENHdWAD1C/2OJ0cIG1nb087aD JfHavYNwTOmx/T/+VUsHQmbsjNYYfPw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghFJG-0008GU-8e; Wed, 09 Jan 2019 14:58:22 +0000 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghFJ5-00086c-3U for linux-i3c@lists.infradead.org; Wed, 09 Jan 2019 14:58:12 +0000 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 2E4D524E14FB; Wed, 9 Jan 2019 06:58:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1547045888; bh=8AwVsi0qvDh+rgfT/vt5PEcypnkBnL+xnltrtMhWZ58=; h=From:To:Cc:Subject:Date:From; b=WgtjT2mI++7WIiNvanUutiM6QDliwTE5Ht3N/zWRSNsNxl29v1RA1kD6ENb36zuyK bjPUSGydPseuD8uwPLXI4L/FABknfHUl7a1za6nf1bTSmfePB97Ht3GOfL1a8WUCi3 ChY0xgZkPFXHXRQTCCI7O1cExelm7BGwVQUZkVzLKVkZrQ0NqE7PBdD6r6P7yfkYD0 YRVwaLBbSU/tNhBp7k8yppoeGqsJBsu2RPiLQjUBHJl98Sd2ism+gBoGJAwJAKR39e hPdQGs8v1u9rKACe4Mbv4JIuMb8EEOJGb2DaH/VqYfmOm69e34XE7LDMq3DKzJ/aZe 0I26dWhvx5w9w== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id 4159157E7; Wed, 9 Jan 2019 06:58:07 -0800 (PST) From: Vitor Soares To: linux-i3c@lists.infradead.org Subject: [PATCH] i3c: master: dw-i3c-master: fix i3c_attach/reatach Date: Wed, 9 Jan 2019 15:58:05 +0100 Message-Id: <2e33e1f72db978f77ced019ae085c972050ca4e9.1547040890.git.vitor.soares@synopsys.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190109_065811_147978_390AC635 X-CRM114-Status: UNSURE ( 9.21 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux I3C List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: joao.pinto@synopsys.com, Vitor Soares , bbrezillon@kernel.org MIME-Version: 1.0 Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fix i3c attach/reatach functions. During the i3c_attach the driver doesn't threat the static address used for SETDASA CCC command. During the i3c_reatach the driver doesn't update master->addrs[data->index] with new address if old_dyn_addr = 0. Signed-off-by: Vitor Soares --- drivers/i3c/master/dw-i3c-master.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c index b532e2c..b84acbc 100644 --- a/drivers/i3c/master/dw-i3c-master.c +++ b/drivers/i3c/master/dw-i3c-master.c @@ -901,9 +901,6 @@ static int dw_i3c_master_reattach_i3c_dev(struct i3c_dev_desc *dev, master->regs + DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index)); - if (!old_dyn_addr) - return 0; - master->addrs[data->index] = dev->info.dyn_addr; return 0; @@ -925,11 +922,11 @@ static int dw_i3c_master_attach_i3c_dev(struct i3c_dev_desc *dev) return -ENOMEM; data->index = pos; - master->addrs[pos] = dev->info.dyn_addr; + master->addrs[pos] = dev->info.dyn_addr ?: dev->info.static_addr; master->free_pos &= ~BIT(pos); i3c_dev_set_master_data(dev, data); - writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(dev->info.dyn_addr), + writel(DEV_ADDR_TABLE_DYNAMIC_ADDR(master->addrs[pos]), master->regs + DEV_ADDR_TABLE_LOC(master->datstartaddr, data->index));